summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortalasila <talasila@research.att.com>2017-02-07 11:47:55 -0500
committertalasila <talasila@research.att.com>2017-02-07 12:51:32 -0500
commit1faf201e8608dfa4d7af3460fd3d1fc7ebec398b (patch)
tree2208f76271cc6b1a81dbfb9143cd7118b071a909
parentca23569858b8cc9f60010e193b7041feb2d3227b (diff)
Initial OpenECOMP Portal SDK commit
Change-Id: I66a3491600a4b9ea241128dc29267eed6a78ed76 Signed-off-by: talasila <talasila@research.att.com>
-rw-r--r--.gitreview4
-rw-r--r--.idea/ecompsdkos.iml9
-rw-r--r--.idea/misc.xml19
-rw-r--r--.idea/modules.xml8
-rw-r--r--.idea/vcs.xml6
-rw-r--r--.idea/workspace.xml328
-rw-r--r--ecomp-sdk/LICENSE.txt19
-rw-r--r--ecomp-sdk/README.md15
-rw-r--r--ecomp-sdk/pom.xml249
-rw-r--r--ecomp-sdk/quantum/.gitignore1
-rw-r--r--ecomp-sdk/quantum/README.md11
-rw-r--r--ecomp-sdk/quantum/pom.xml330
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/FusionObject.java113
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/LoginBean.java196
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostDroolsBean.java51
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostSearchBean.java374
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/UserRowBean.java85
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchBase.java268
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchResult.java58
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppConfig.java301
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppInitializer.java69
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/Configurable.java38
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateConfiguration.java155
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateMappingLocatable.java28
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AdminAuthGenericController.java134
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AngularAdminController.java50
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastController.java130
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastListController.java142
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CacheAdminController.java252
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborateListController.java84
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborationController.java47
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ElementModelController.java91
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ExternalLoginController.java121
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FavoritesController.java117
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FnMenuController.java224
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FuncMenuController.java174
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FusionBaseController.java135
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/LogoutController.java110
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/MenuListController.java245
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/PostSearchController.java219
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileController.java349
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileSearchController.java149
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedBaseController.java50
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedRESTfulBaseController.java50
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleController.java332
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleFunctionListController.java184
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleListController.java179
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/SingleSignOnController.java232
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UnRestrictedBaseController.java40
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UsageListController.java163
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/AbstractDao.java62
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDao.java29
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDaoImpl.java50
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/hibernate/ModelOperationsCommon.java453
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/support/FusionDao.java35
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/App.java206
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/AuditLog.java79
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/BroadcastMessage.java123
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/DomainVo.java177
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FnMenu.java142
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FusionVo.java27
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LoginBean.java187
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Lookup.java85
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuCountry.java86
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuState.java68
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuTimeZone.java77
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Menu.java160
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/MenuData.java61
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Profile.java96
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Role.java174
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/RoleFunction.java69
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UrlsAccessible.java83
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UrlsAccessibleKey.java90
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/User.java585
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserApp.java108
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserAppId.java88
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/sessionmgt/TimeoutVO.java63
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Attribute.java62
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/CollaborateList.java56
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Container.java331
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Domain.java259
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/DomainVo.java179
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Element.java161
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/ElementDetails.java68
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/FusionCommand.java39
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Layout.java991
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/NameValueId.java94
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Position.java40
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Size.java40
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleService.java27
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleServiceImpl.java58
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/FusionExceptionResolver.java50
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/SessionExpiredException.java34
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/UrlAccessRestrictedException.java34
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionException.java24
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionRuntimeException.java36
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/ResourceInterceptor.java164
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/SessionTimeoutInterceptor.java103
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interfaces/SecurityInterface.java24
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/ApplicationContextListener.java43
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/CollaborateListBindingListener.java61
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/UserSessionListener.java62
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/AuditLog.java32
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAdvice.java193
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAspect.java88
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/MetricsLog.java32
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AlarmSeverityEnum.java28
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AppMessagesEnum.java249
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ApplicationCodes.properties221
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AuditLogFormatter.java106
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorCodesEnum.java87
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorSeverityEnum.java27
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorTypeEnum.java29
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/logic/EELFLoggerDelegate.java323
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuBuilder.java164
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuProperties.java114
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/AbstractCacheManager.java60
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheEventHandler.java60
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheManager.java186
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/support/FusionCacheManager.java36
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/AppContextManager.java45
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/OnBoardingApiServiceImpl.java316
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/session/TestClass.java24
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/sso/TestClass.java24
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/HttpStatusAndResponse.java42
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/PortalRestClientBase.java171
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/SharedContextRestClient.java330
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CoreRegister.java95
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CronRegistry.java124
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/Registerable.java30
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppService.java61
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppServiceImpl.java106
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditService.java36
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditServiceImpl.java50
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastService.java37
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastServiceImpl.java248
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessService.java80
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessServiceImpl.java592
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java269
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementMapService.java915
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java46
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java145
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapService.java31
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapServiceImpl.java269
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginService.java36
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceImpl.java190
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsService.java34
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsServiceImpl.java179
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchService.java30
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchServiceImpl.java203
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileService.java36
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceImpl.java72
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java50
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceImpl.java171
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceNonSpringImpl.java122
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java36
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java210
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallService.java26
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallServiceImpl.java189
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/FusionService.java27
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocator.java27
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocatorImpl.java74
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CacheManager.java43
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CipherUtil.java125
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncDecUtilTest.java112
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncTest.java39
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/JSONUtil.java56
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/SystemProperties.java279
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/UsageUtils.java92
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/YamlUtils.java69
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/PeerBroadcastSocket.java104
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/WebRTCSocket.java143
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/AppUtils.java195
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/ControllerProperties.java41
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/FeedbackMessage.java80
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/JsonMessage.java118
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/MessagesList.java93
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java373
-rw-r--r--ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockApplicationContextTestSuite.java127
-rw-r--r--ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockHibernateMappingLocations.java20
-rw-r--r--ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/controller/sessionmgt/PortalCommunicationTest.java56
-rw-r--r--ecomp-sdk/sdk-analytics/.gitignore2
-rw-r--r--ecomp-sdk/sdk-analytics/README.md8
-rw-r--r--ecomp-sdk/sdk-analytics/pom.xml160
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/AntBuild.java89
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/RaptorObject.java44
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/config/ConfigLoader.java196
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Action.java89
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionHandler.java2417
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionMapping.java34
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Controller.java124
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ErrorHandler.java112
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardProcessor.java2354
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequence.java189
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceCrossTab.java43
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceDashboard.java38
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceLinear.java45
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java42
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java44
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java45
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java44
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorException.java35
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorRuntimeException.java36
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorSchedularException.java36
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ReportSQLException.java51
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserAccessException.java34
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserDefinedException.java35
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ValidationException.java42
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/Line.java86
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineCollection.java158
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineInfo.java190
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/ColorProperties.java119
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GMapProperties.java46
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GeoCoordinate.java25
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/MapConstant.java44
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/NovaMap.java504
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/layer/SwingLayer.java234
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/Node.java178
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeCollection.java188
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeInfo.java210
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/MapUtils.java62
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/SwingWorker.java155
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/DataCache.java524
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportHandler.java6605
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportLoader.java1061
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/SearchHandler.java490
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ChartSeqComparator.java49
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameColLookup.java35
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameList.java183
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameLookup.java198
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameSql.java400
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameValue.java100
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/NameComparator.java32
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderBySeqComparator.java37
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderSeqComparator.java37
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportSecurity.java407
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportWrapper.java5719
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DBColumnInfo.java76
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DrillDownParamDef.java111
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/Marker.java79
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportDefinition.java1465
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportLogEntry.java89
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportMap.java82
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportSchedule.java1407
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/SecurityEntry.java44
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableJoin.java67
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableSource.java101
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PageEvent.java256
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfBean.java242
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfReportHandler.java1890
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/BarChartOptions.java75
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CategoryAxisJSON.java24
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartD3Helper.java4064
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartGen.java73
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSON.java448
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSONHelper.java1550
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartWebRuntime.java420
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CommonChartOptions.java81
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ErrorJSONRuntime.java43
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FlexTimeSeriesChartOptions.java38
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FormField.java2111
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FormatProcessor.java375
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/Item.java54
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/LookupDBInfo.java89
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/RangeAxisJSON.java93
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportFormFields.java366
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportJSONRuntime.java694
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamDateValueParser.java194
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamValues.java370
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamValuesForPDFExcel.java419
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportRuntime.java3618
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/TimeSeriesChartOptions.java62
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/VisualManager.java68
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResult.java84
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResultJSON.java251
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResult.java213
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultColumn.java254
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultField.java212
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultJSON.java80
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultRow.java92
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SchedulerUtil.java369
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SendEmail.java415
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SendNotifications.java460
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/AppUtils.java333
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ConnectionUtils.java69
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/DbUtils.java1298
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ExecuteQuery.java60
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/Globals.java2282
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IAppUtils.java175
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IDbUtils.java35
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RDbUtils.java36
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RemDbUtils.java200
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AntBuild.java66
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AppUtils.java363
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/DbUtils.java75
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/RemoteDbUtils.java50
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/AdapterSessionFactoryContainer.java39
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/DateUtils.java287
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java135
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/IdName.java59
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Item.java55
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Lookup.java85
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java368
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/SpringContext.java37
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/controller/FileServletController.java206
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/CR_Report.java306
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/QuickLink.java61
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/RaptorSearch.java188
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/ReportInfo.java159
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorService.java36
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorServiceImpl.java163
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorController.java191
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java410
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/ReportsSearchListController.java74
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/AppConstants.java658
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/DataSet.java177
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/ExcelColorDef.java68
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/HtmlStripper.java155
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Log.java40
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/RemDbInfo.java93
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/SQLCorrector.java343
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Scheduler.java91
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Utils.java378
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/XSSFilter.java90
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/upgrade/SystemUpgrade.java125
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeader.java239
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeaderRow.java100
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnVisual.java74
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabColumnValues.java75
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabOrderManager.java98
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabTotalValue.java56
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataRow.java169
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataValue.java359
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/HtmlFormatter.java205
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportColumnHeaderRows.java71
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportData.java812
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportDataRows.java72
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportRowHeaderCols.java71
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeader.java119
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeaderCol.java156
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartAdditionalOptions.java1178
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartDrillFormfield.java86
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartDrillOptions.java207
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ColFilterList.java94
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ColFilterType.java298
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/CustomReportType.java2011
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardEditorList.java94
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardEditorReport.java172
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardReports.java94
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardReportsNew.java148
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataColumnList.java96
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataColumnType.java1455
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataSourceList.java94
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataSourceType.java281
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataminingOptions.java167
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormFieldList.java121
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormFieldType.java610
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormatList.java96
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormatType.java366
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/JavascriptItemType.java144
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/JavascriptList.java94
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/Marker.java167
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ObjectFactory.java305
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/PDFAdditionalOptions.java340
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/PredefinedValueList.java94
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ReportMap.java445
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/Reports.java113
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/SemaphoreList.java94
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/SemaphoreType.java227
-rw-r--r--ecomp-sdk/sdk-app/.gitignore1
-rw-r--r--ecomp-sdk/sdk-app/README.md14
-rw-r--r--ecomp-sdk/sdk-app/db-scripts/EcompSdkDDLMySql_1610_Complete_OS.sql1402
-rw-r--r--ecomp-sdk/sdk-app/db-scripts/EcompSdkDMLMySql_1610_Complete_OS.sql2891
-rw-r--r--ecomp-sdk/sdk-app/distribution.xml21
-rw-r--r--ecomp-sdk/sdk-app/pom.xml351
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java188
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java60
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java37
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/AngularSinglePageController.java48
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/CallflowController.java44
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/ElasticSearchController.java128
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/LeafletMapContoller.java43
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/PostDroolsController.java138
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/UserProfileController.java72
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/WelcomeController.java43
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/model/Result.java37
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java47
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java57
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/Register.java82
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java108
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java34
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java73
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java104
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java46
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java54
-rw-r--r--ecomp-sdk/sdk-app/src/main/resources/att-rules.drl16
-rw-r--r--ecomp-sdk/sdk-app/src/main/resources/cache.ccf30
-rw-r--r--ecomp-sdk/sdk-app/src/main/resources/logback.xml370
-rw-r--r--ecomp-sdk/sdk-app/src/main/resources/mchange-log.properties23
-rw-r--r--ecomp-sdk/sdk-app/src/main/resources/portal.properties69
-rw-r--r--ecomp-sdk/sdk-app/src/main/resources/state-rules.drl38
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/quartz.properties30
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor.properties187
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_app_fusion.properties39
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_db_fusion.properties19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_pdf.properties49
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/sql.properties322
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/system.properties86
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/defs/definitions.xml22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/conf/fusion.properties61
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/defs/definitions.xml240
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/.gitignore0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/broadcast.jsp137
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/broadcast_list.jsp201
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/collaborateList.jsp146
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/data_out.jsp20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_footer.jsp46
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp799
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/loginSnippet.html120
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template.jsp45
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_noheader_nofooter.jsp35
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_report_embedded.jsp48
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_search_demo.jsp97
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_suggest_demo.jsp97
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/frame_insert.jsp44
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/include.jsp30
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/jcs_admin.jsp144
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/meta.jsp36
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal.html324
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_role.html274
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_rolefunction.html87
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/post_search.jsp356
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile.jsp442
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile_search.jsp104
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role.jsp286
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_function_list.jsp213
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_list.jsp139
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/usage_list.jsp87
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/webrtc/collaboration.jsp492
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml352
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/RNoteBookIntegration.hbm.xml44
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Workflow.hbm.xml48
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_header_include.jsp135
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_js_include.jsp31
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_end_field_run_sql.jsp38
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_start_field_run_sql.jsp39
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/default_field_run_sql.jsp39
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/disclaimer.jsp38
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_include.jsp58
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_page.jsp229
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/footer.jsp25
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_drill_down_report.jsp601
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_import_semaphore.jsp80
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_semaphore.jsp419
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_sql.jsp55
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_table_cols.jsp171
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_testrun_sql.jsp103
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_csv.jsp89
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_pdf.jsp40
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_xls.jsp64
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_ebz.jsp179
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_import.jsp69
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_sample.jsp40
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_search.jsp2432
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_wizard.jsp309
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_field_run_sql.jsp39
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_run_sql.jsp38
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_adhoc_schedule.jsp733
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_chart.jsp1335
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_add_multi.jsp96
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_edit.jsp1127
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_list.jsp157
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_order_all.jsp88
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_data_forecasting.jsp184
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_definition.jsp1122
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_filters_edit.jsp320
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_filters_list.jsp115
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_form_fields_edit.jsp771
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_form_fields_list.jsp107
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_javascript.jsp167
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_log.jsp109
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_map.jsp424
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_run.jsp74
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule.jsp376
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_formfield_include.jsp754
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_multiple.jsp157
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only.jsp172
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only_from_search.jsp173
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_edit.jsp86
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_list.jsp116
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_order_all.jsp112
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sql_def.jsp226
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_edit.jsp369
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_list.jsp85
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_user_access.jsp184
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/error.jsp20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/leafletMap.jsp288
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/login_external.jsp154
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/net_map.jsp38
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/user_profile.jsp84
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/welcome.jsp630
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/web.xml17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.js4121
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.min.js56
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.min.js.map8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.js398
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js.map8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.js322
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js.map8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-csp.css20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.js484
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.min.js10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.min.js.map8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.js980
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.min.js26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.min.js.map8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.js687
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js.map8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-mocks.js2842
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.js768
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.min.js15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.min.js.map8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.js1016
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.min.js15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.min.js.map8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.js717
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js.map8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-scenario.js41849
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.js729
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.min.js14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.min.js.map8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.js30428
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.min.js307
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.min.js.map8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/errors.json1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/version.json1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/version.txt1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-ui/ui-bootstrap-tpls-1.2.4.min.js10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/bootstrap/bs.css678
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/css/nv.d3.css656
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/cie.js155
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/colorbrewer.js302
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/core.js122
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/crossfilter.js1180
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/crossfilter.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.geom.js816
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.js5
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.layout.cloud.js433
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.layout.js908
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v2.js7037
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v2.min.js4
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v3.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/fisheye.js86
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/hive.js80
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/horizon.js192
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/interactiveLayer.js251
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/intro.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis-min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis.js470
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/backup/bullet.js250
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/backup/bulletChart.js349
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/boilerplate.js104
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/bullet.js385
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/bulletChart.js343
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/cumulativeLineChart.js782
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/discreteBar.js349
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/discreteBarChart.js333
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/distribution.js148
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/historicalBar.js331
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/historicalBarChart.js419
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/indentedTree.js337
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/legend.js270
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/line.js284
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineChart.js465
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/linePlusBarChart.js433
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/linePlusBarWithFocusChart.js658
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFisheye.js200
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFisheyeChart.js297
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFocusChart.js574
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBar.js461
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarChart.js524
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarHorizontal.js424
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarHorizontalChart.js434
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarTimeSeries.js384
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarTimeSeriesChart.js405
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiChart.js452
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/ohlcBar.js380
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/parallelCoordinates.js239
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/pie.js400
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/pieChart.js292
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatter.js674
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatterChart.js628
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatterPlusLineChart.js620
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/sparkline.js194
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/sparklinePlus.js295
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/stackedArea.js368
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/stackedAreaChart.js629
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/nv.d3.js13097
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/nv.d3.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/outro.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/sankey.js292
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/tooltip.js490
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/utils.js152
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-animate.js3721
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-cookies.js206
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-route.js911
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-route.min.js14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-sanitize.js647
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-touch.js628
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular.js22024
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/app.js6
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/checklist-model.js99
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/checklist-model.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/gestures.js1495
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/ng_base.js4
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/ui-charts-tpls.js3909
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/footer.css311
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/header.css1866
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/portal_ebz_header.css63
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/fn-ebz.css1614
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/images/no_favorites_star.pngbin0 -> 2794 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/js/attHeaderSnippet.js210
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/js/footer.js110
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/att-abs-tpls.js20451
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/att-abs-tpls.min.js22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/base.css1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/btn.css1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/demo.css2
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/dtpk.css9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/frms.css1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/ie/backgroundsize.min.htc12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/images/upanddown.pngbin0 -> 1033 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/pages/iconography.css2
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/sldr.css1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/style.css1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/tbs.css1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/.gitignore4
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/LICENSE21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/bower.json31
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/component.json19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/composer.json36
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/css/ionicons.css1480
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/css/ionicons.min.css11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.eotbin0 -> 120724 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.svg2230
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.ttfbin0 -> 188508 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.woffbin0 -> 67904 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-font.less27
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-icons.less1473
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-variables.less747
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/ionicons.less3
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/alert-circled.pngbin0 -> 2551 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/alert.pngbin0 -> 766 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-add-contact.pngbin0 -> 3279 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-add.pngbin0 -> 240 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-alarm.pngbin0 -> 6428 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-archive.pngbin0 -> 1628 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-back.pngbin0 -> 1218 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-down-left.pngbin0 -> 1451 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-down-right.pngbin0 -> 1462 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-forward.pngbin0 -> 1191 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-up-left.pngbin0 -> 1499 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-up-right.pngbin0 -> 1482 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-battery.pngbin0 -> 238 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-book.pngbin0 -> 3746 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-calendar.pngbin0 -> 849 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-call.pngbin0 -> 4766 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-camera.pngbin0 -> 3871 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-chat.pngbin0 -> 3577 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-checkmark.pngbin0 -> 1846 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-clock.pngbin0 -> 5268 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-close.pngbin0 -> 2156 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-contact.pngbin0 -> 3658 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-contacts.pngbin0 -> 4299 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-data.pngbin0 -> 4808 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-developer.pngbin0 -> 4115 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-display.pngbin0 -> 4909 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-download.pngbin0 -> 4890 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-drawer.pngbin0 -> 190 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-dropdown.pngbin0 -> 777 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-earth.pngbin0 -> 6517 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-folder.pngbin0 -> 1688 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-forums.pngbin0 -> 1739 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-friends.pngbin0 -> 4868 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-hand.pngbin0 -> 4650 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-image.pngbin0 -> 1433 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-inbox.pngbin0 -> 3018 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-information.pngbin0 -> 3370 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-keypad.pngbin0 -> 1055 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-lightbulb.pngbin0 -> 3515 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-locate.pngbin0 -> 5003 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-location.pngbin0 -> 3067 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-mail.pngbin0 -> 3455 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-microphone.pngbin0 -> 3267 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-mixer.pngbin0 -> 2727 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-more.pngbin0 -> 224 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-note.pngbin0 -> 249 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-playstore.pngbin0 -> 3165 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-printer.pngbin0 -> 1721 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-promotion.pngbin0 -> 2374 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-reminder.pngbin0 -> 2890 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-remove.pngbin0 -> 160 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-search.pngbin0 -> 4232 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-send.pngbin0 -> 2079 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-settings.pngbin0 -> 3883 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-share.pngbin0 -> 3212 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-social-user.pngbin0 -> 3644 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-social.pngbin0 -> 3849 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-sort.pngbin0 -> 197 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-stair-drawer.pngbin0 -> 209 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-star.pngbin0 -> 2926 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-stopwatch.pngbin0 -> 5225 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-storage.pngbin0 -> 233 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-back.pngbin0 -> 1796 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-home.pngbin0 -> 1107 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-windows.pngbin0 -> 202 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-timer.pngbin0 -> 3904 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-trash.pngbin0 -> 2865 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-user-menu.pngbin0 -> 3568 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-volume.pngbin0 -> 6022 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-wifi.pngbin0 -> 4868 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/aperture.pngbin0 -> 9500 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/archive.pngbin0 -> 2445 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-a.pngbin0 -> 1173 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-b.pngbin0 -> 1307 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-c.pngbin0 -> 1966 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-expand.pngbin0 -> 2498 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-down-left.pngbin0 -> 2478 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-down-right.pngbin0 -> 2545 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-up-left.pngbin0 -> 2440 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-up-right.pngbin0 -> 2440 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-a.pngbin0 -> 1260 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-b.pngbin0 -> 1608 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-c.pngbin0 -> 1662 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-move.pngbin0 -> 1948 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-resize.pngbin0 -> 1266 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-return-left.pngbin0 -> 1082 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-return-right.pngbin0 -> 1124 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-a.pngbin0 -> 1317 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-b.pngbin0 -> 1671 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-c.pngbin0 -> 1657 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-shrink.pngbin0 -> 2594 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-swap.pngbin0 -> 1521 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-a.pngbin0 -> 1115 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-b.pngbin0 -> 1343 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-c.pngbin0 -> 2002 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/asterisk.pngbin0 -> 4023 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/at.pngbin0 -> 5852 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bag.pngbin0 -> 3665 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-charging.pngbin0 -> 1897 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-empty.pngbin0 -> 1019 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-full.pngbin0 -> 982 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-half.pngbin0 -> 1320 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-low.pngbin0 -> 1342 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/beaker.pngbin0 -> 3931 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/beer.pngbin0 -> 4559 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bluetooth.pngbin0 -> 2909 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bonfire.pngbin0 -> 4852 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bookmark.pngbin0 -> 1102 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/briefcase.pngbin0 -> 1475 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bug.pngbin0 -> 4736 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/calculator.pngbin0 -> 1315 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/calendar.pngbin0 -> 2577 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/camera.pngbin0 -> 4190 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/card.pngbin0 -> 1494 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cash.pngbin0 -> 3435 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbox-working.pngbin0 -> 2301 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbox.pngbin0 -> 1870 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatboxes.pngbin0 -> 2562 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubble-working.pngbin0 -> 3028 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubble.pngbin0 -> 2579 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubbles.pngbin0 -> 3751 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark-circled.pngbin0 -> 3687 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark-round.pngbin0 -> 2367 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark.pngbin0 -> 2134 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-down.pngbin0 -> 1689 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-left.pngbin0 -> 1769 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-right.pngbin0 -> 1831 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-up.pngbin0 -> 1677 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/clipboard.pngbin0 -> 2593 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/clock.pngbin0 -> 5866 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close-circled.pngbin0 -> 3809 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close-round.pngbin0 -> 2177 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close.pngbin0 -> 2244 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/closed-captioning.pngbin0 -> 3665 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cloud.pngbin0 -> 2067 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code-download.pngbin0 -> 2423 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code-working.pngbin0 -> 2433 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code.pngbin0 -> 1720 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/coffee.pngbin0 -> 3205 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/compass.pngbin0 -> 7318 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/compose.pngbin0 -> 4296 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/connection-bars.pngbin0 -> 214 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/contrast.pngbin0 -> 4087 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cube.pngbin0 -> 3265 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/disc.pngbin0 -> 4935 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/document-text.pngbin0 -> 1918 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/document.pngbin0 -> 1914 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/drag.pngbin0 -> 178 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/earth.pngbin0 -> 6476 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/edit.pngbin0 -> 2741 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/egg.pngbin0 -> 4234 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eject.pngbin0 -> 3209 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/email.pngbin0 -> 3125 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eye-disabled.pngbin0 -> 3558 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eye.pngbin0 -> 3297 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/female.pngbin0 -> 2779 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/filing.pngbin0 -> 2349 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/film-marker.pngbin0 -> 2645 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fireball.pngbin0 -> 3325 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flag.pngbin0 -> 2337 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flame.pngbin0 -> 3012 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flash-off.pngbin0 -> 5437 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flash.pngbin0 -> 1965 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flask.pngbin0 -> 2939 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/folder.pngbin0 -> 1689 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fork-repo.pngbin0 -> 3236 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fork.pngbin0 -> 3007 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/forward.pngbin0 -> 2142 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/funnel.pngbin0 -> 3354 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/game-controller-a.pngbin0 -> 2548 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/game-controller-b.pngbin0 -> 3623 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/gear-a.pngbin0 -> 3806 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/gear-b.pngbin0 -> 2756 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/grid.pngbin0 -> 1066 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/hammer.pngbin0 -> 2493 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/happy.pngbin0 -> 5732 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/headphone.pngbin0 -> 4082 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/heart-broken.pngbin0 -> 4007 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/heart.pngbin0 -> 2322 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help-buoy.pngbin0 -> 5824 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help-circled.pngbin0 -> 3940 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help.pngbin0 -> 2678 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/home.pngbin0 -> 1275 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icecream.pngbin0 -> 2317 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icon-social-google-plus-outline.pngbin0 -> 4071 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icon-social-google-plus.pngbin0 -> 3888 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/image.pngbin0 -> 2952 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/images.pngbin0 -> 5073 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/information-circled.pngbin0 -> 3300 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/information.pngbin0 -> 2236 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ionic.pngbin0 -> 5541 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-alarm-outline.pngbin0 -> 5769 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-alarm.pngbin0 -> 3922 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-albums-outline.pngbin0 -> 231 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-albums.pngbin0 -> 226 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-americanfootball-outline.pngbin0 -> 5767 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-americanfootball.pngbin0 -> 5675 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-analytics-outline.pngbin0 -> 5847 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-analytics.pngbin0 -> 4406 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-back.pngbin0 -> 881 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-down.pngbin0 -> 1451 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-forward.pngbin0 -> 898 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-left.pngbin0 -> 1550 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-right.pngbin0 -> 1537 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-down.pngbin0 -> 1632 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-left.pngbin0 -> 1258 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-right.pngbin0 -> 1235 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-up.pngbin0 -> 1647 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-up.pngbin0 -> 1482 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-at-outline.pngbin0 -> 4303 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-at.pngbin0 -> 4153 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-barcode-outline.pngbin0 -> 233 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-barcode.pngbin0 -> 219 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-baseball-outline.pngbin0 -> 6676 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-baseball.pngbin0 -> 5565 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-basketball-outline.pngbin0 -> 6200 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-basketball.pngbin0 -> 6525 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bell-outline.pngbin0 -> 3615 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bell.pngbin0 -> 2769 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bolt-outline.pngbin0 -> 2384 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bolt.pngbin0 -> 1892 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bookmarks-outline.pngbin0 -> 2454 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bookmarks.pngbin0 -> 2172 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-box-outline.pngbin0 -> 1602 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-box.pngbin0 -> 1032 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-briefcase-outline.pngbin0 -> 1359 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-briefcase.pngbin0 -> 1316 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-browsers-outline.pngbin0 -> 372 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-browsers.pngbin0 -> 357 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calculator-outline.pngbin0 -> 1785 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calculator.pngbin0 -> 1500 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calendar-outline.pngbin0 -> 236 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calendar.pngbin0 -> 230 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-camera-outline.pngbin0 -> 3582 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-camera.pngbin0 -> 3099 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cart-outline.pngbin0 -> 2861 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cart.pngbin0 -> 2200 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatboxes-outline.pngbin0 -> 901 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatboxes.pngbin0 -> 512 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatbubble-outline.pngbin0 -> 3640 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatbubble.pngbin0 -> 2259 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark-empty.pngbin0 -> 920 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark-outline.pngbin0 -> 4706 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark.pngbin0 -> 3080 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-circle-filled.pngbin0 -> 6478 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-circle-outline.pngbin0 -> 4120 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-clock-outline.pngbin0 -> 4320 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-clock.pngbin0 -> 2762 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close-empty.pngbin0 -> 1204 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close-outline.pngbin0 -> 4999 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close.pngbin0 -> 3426 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-download-outline.pngbin0 -> 3953 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-download.pngbin0 -> 2782 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-outline.pngbin0 -> 3339 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-upload-outline.pngbin0 -> 3927 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-upload.pngbin0 -> 2815 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud.pngbin0 -> 2082 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-night-outline.pngbin0 -> 3814 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-night.pngbin0 -> 2870 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-outline.pngbin0 -> 2280 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy.pngbin0 -> 1572 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cog-outline.pngbin0 -> 8008 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cog.pngbin0 -> 6029 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-compose-outline.pngbin0 -> 1584 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-compose.pngbin0 -> 2061 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-contact-outline.pngbin0 -> 4846 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-contact.pngbin0 -> 4218 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-copy-outline.pngbin0 -> 927 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-copy.pngbin0 -> 782 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-download-outline.pngbin0 -> 1163 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-download.pngbin0 -> 1135 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-drag.pngbin0 -> 165 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-email-outline.pngbin0 -> 2592 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-email.pngbin0 -> 4167 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-expand.pngbin0 -> 485 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-eye-outline.pngbin0 -> 4381 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-eye.pngbin0 -> 2973 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-fastforward-outline.pngbin0 -> 2726 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-fastforward.pngbin0 -> 2158 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-filing-outline.pngbin0 -> 2041 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-filing.pngbin0 -> 1933 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-film-outline.pngbin0 -> 772 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-film.pngbin0 -> 722 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-flag-outline.pngbin0 -> 1928 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-flag.pngbin0 -> 1483 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-folder-outline.pngbin0 -> 1606 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-folder.pngbin0 -> 1640 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-football-outline.pngbin0 -> 6266 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-football.pngbin0 -> 5391 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-gear-outline.pngbin0 -> 5721 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-gear.pngbin0 -> 3445 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-glasses-outline.pngbin0 -> 3597 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-glasses.pngbin0 -> 2350 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-heart-outline.pngbin0 -> 3097 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-heart.pngbin0 -> 2078 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help-empty.pngbin0 -> 1669 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help-outline.pngbin0 -> 5608 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help.pngbin0 -> 3587 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-home-outline.pngbin0 -> 1710 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-home.pngbin0 -> 1518 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-infinite-outline.pngbin0 -> 3028 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-infinite.pngbin0 -> 2989 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information-empty.pngbin0 -> 837 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information-outline.pngbin0 -> 4563 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information.pngbin0 -> 2959 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-ionic-outline.pngbin0 -> 5780 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-keypad-outline.pngbin0 -> 7485 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-keypad.pngbin0 -> 7505 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-lightbulb-outline.pngbin0 -> 3791 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-lightbulb.pngbin0 -> 2696 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-location-outline.pngbin0 -> 4116 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-location.pngbin0 -> 2767 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-locked-outline.pngbin0 -> 2640 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-locked.pngbin0 -> 2674 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-loop-strong.pngbin0 -> 4101 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-loop.pngbin0 -> 4270 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-medkit-outline.pngbin0 -> 1386 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-medkit.pngbin0 -> 1373 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic-off.pngbin0 -> 7597 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic-outline.pngbin0 -> 3550 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic.pngbin0 -> 3878 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus-empty.pngbin0 -> 153 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus-outline.pngbin0 -> 4137 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus.pngbin0 -> 2520 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-monitor-outline.pngbin0 -> 225 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-monitor.pngbin0 -> 230 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-moon-outline.pngbin0 -> 2566 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-moon.pngbin0 -> 1784 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-more-outline.pngbin0 -> 1598 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-more.pngbin0 -> 1700 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-musical-note.pngbin0 -> 1521 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-musical-notes.pngbin0 -> 2124 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-navigate-outline.pngbin0 -> 4901 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-navigate.pngbin0 -> 3333 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paper-outline.pngbin0 -> 1361 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paper.pngbin0 -> 1197 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paperplane-outline.pngbin0 -> 2952 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paperplane.pngbin0 -> 4805 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-partlysunny-outline.pngbin0 -> 4823 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-partlysunny.pngbin0 -> 4052 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pause-outline.pngbin0 -> 227 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pause.pngbin0 -> 213 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paw-outline.pngbin0 -> 6318 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paw.pngbin0 -> 4119 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-people-outline.pngbin0 -> 5295 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-people.pngbin0 -> 3439 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-person-outline.pngbin0 -> 3189 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-person.pngbin0 -> 2046 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-personadd-outline.pngbin0 -> 3246 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-personadd.pngbin0 -> 2110 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-photos-outline.pngbin0 -> 234 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-photos.pngbin0 -> 226 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pie-outline.pngbin0 -> 4549 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pie.pngbin0 -> 3646 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-play-outline.pngbin0 -> 1474 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-play.pngbin0 -> 1216 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus-empty.pngbin0 -> 204 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus-outline.pngbin0 -> 4415 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus.pngbin0 -> 2970 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetag-outline.pngbin0 -> 3007 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetag.pngbin0 -> 2593 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetags-outline.pngbin0 -> 3563 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetags.pngbin0 -> 3219 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-printer-outline.pngbin0 -> 1764 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-printer.pngbin0 -> 1456 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pulse-strong.pngbin0 -> 3326 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pulse.pngbin0 -> 2955 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rainy-outline.pngbin0 -> 3346 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rainy.pngbin0 -> 2567 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-recording-outline.pngbin0 -> 4926 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-recording.pngbin0 -> 3762 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-redo-outline.pngbin0 -> 3094 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-redo.pngbin0 -> 2054 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh-empty.pngbin0 -> 2685 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh-outline.pngbin0 -> 6021 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh.pngbin0 -> 4579 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reload.pngbin0 -> 4195 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reverse-camera-outline.pngbin0 -> 3404 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reverse-camera.pngbin0 -> 3019 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rewind-outline.pngbin0 -> 2898 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rewind.pngbin0 -> 2362 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-search-strong.pngbin0 -> 3329 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-search.pngbin0 -> 3361 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-settings-strong.pngbin0 -> 1714 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-settings.pngbin0 -> 2160 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-shrink.pngbin0 -> 490 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipbackward-outline.pngbin0 -> 1890 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipbackward.pngbin0 -> 1533 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipforward-outline.pngbin0 -> 1827 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipforward.pngbin0 -> 1556 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-snowy.pngbin0 -> 3775 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-speedometer-outline.pngbin0 -> 4678 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-speedometer.pngbin0 -> 5748 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star-half.pngbin0 -> 3431 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star-outline.pngbin0 -> 3572 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star.pngbin0 -> 2463 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-stopwatch-outline.pngbin0 -> 4823 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-stopwatch.pngbin0 -> 3451 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-sunny-outline.pngbin0 -> 2669 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-sunny.pngbin0 -> 2506 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-telephone-outline.pngbin0 -> 3779 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-telephone.pngbin0 -> 2352 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-tennisball-outline.pngbin0 -> 5535 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-tennisball.pngbin0 -> 6356 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-thunderstorm-outline.pngbin0 -> 3053 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-thunderstorm.pngbin0 -> 2492 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-time-outline.pngbin0 -> 5875 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-time.pngbin0 -> 4136 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-timer-outline.pngbin0 -> 4578 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-timer.pngbin0 -> 6013 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-toggle-outline.pngbin0 -> 5660 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-toggle.pngbin0 -> 4825 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-trash-outline.pngbin0 -> 4497 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-trash.pngbin0 -> 2760 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-undo-outline.pngbin0 -> 3114 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-undo.pngbin0 -> 1954 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-unlocked-outline.pngbin0 -> 2580 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-unlocked.pngbin0 -> 2605 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-upload-outline.pngbin0 -> 1128 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-upload.pngbin0 -> 1085 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-videocam-outline.pngbin0 -> 2038 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-videocam.pngbin0 -> 2715 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-volume-high.pngbin0 -> 2977 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-volume-low.pngbin0 -> 956 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-wineglass-outline.pngbin0 -> 2527 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-wineglass.pngbin0 -> 2013 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-world-outline.pngbin0 -> 7420 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-world.pngbin0 -> 10031 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ipad.pngbin0 -> 1356 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/iphone.pngbin0 -> 1651 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ipod.pngbin0 -> 3207 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/jet.pngbin0 -> 2856 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/key.pngbin0 -> 2722 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/knife.pngbin0 -> 1822 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/laptop.pngbin0 -> 2474 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/leaf.pngbin0 -> 3440 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/levels.pngbin0 -> 2431 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/lightbulb.pngbin0 -> 2474 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/link.pngbin0 -> 2306 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-a.pngbin0 -> 3941 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-b.pngbin0 -> 5473 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-c.pngbin0 -> 4337 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-d.pngbin0 -> 6618 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/location.pngbin0 -> 2739 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/locked.pngbin0 -> 2494 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/log-in.pngbin0 -> 1460 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/log-out.pngbin0 -> 1637 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/loop.pngbin0 -> 3794 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/magnet.pngbin0 -> 4495 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/male.pngbin0 -> 3788 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/man.pngbin0 -> 2126 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/map.pngbin0 -> 4906 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/medkit.pngbin0 -> 1605 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/merge.pngbin0 -> 3879 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-a.pngbin0 -> 4098 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-b.pngbin0 -> 2576 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-c.pngbin0 -> 1726 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus-circled.pngbin0 -> 2655 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus-round.pngbin0 -> 937 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus.pngbin0 -> 160 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/model-s.pngbin0 -> 4262 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/monitor.pngbin0 -> 1469 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/more.pngbin0 -> 3357 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mouse.pngbin0 -> 2891 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/music-note.pngbin0 -> 2519 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navicon-round.pngbin0 -> 1628 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navicon.pngbin0 -> 175 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navigate.pngbin0 -> 1693 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/network.pngbin0 -> 3041 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/no-smoking.pngbin0 -> 5816 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/nuclear.pngbin0 -> 3618 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/outlet.pngbin0 -> 2882 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/paper-airplane.pngbin0 -> 3678 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/paperclip.pngbin0 -> 2710 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pause.pngbin0 -> 1340 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person-add.pngbin0 -> 2410 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person-stalker.pngbin0 -> 3272 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person.pngbin0 -> 2258 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pie-graph.pngbin0 -> 3608 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pin.pngbin0 -> 2270 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pinpoint.pngbin0 -> 4799 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pizza.pngbin0 -> 4548 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plane.pngbin0 -> 3218 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/planet.pngbin0 -> 4319 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/play.pngbin0 -> 1787 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/playstation.pngbin0 -> 3275 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus-circled.pngbin0 -> 3114 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus-round.pngbin0 -> 1567 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus.pngbin0 -> 223 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/podium.pngbin0 -> 209 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pound.pngbin0 -> 2383 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/power.pngbin0 -> 4727 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pricetag.pngbin0 -> 2457 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pricetags.pngbin0 -> 2906 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/printer.pngbin0 -> 1869 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pull-request.pngbin0 -> 3613 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/qr-scanner.pngbin0 -> 1842 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/quote.pngbin0 -> 1743 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/radio-waves.pngbin0 -> 4978 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/record.pngbin0 -> 3779 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/refresh.pngbin0 -> 3582 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/reply-all.pngbin0 -> 3033 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/reply.pngbin0 -> 2131 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ribbon-a.pngbin0 -> 6449 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ribbon-b.pngbin0 -> 5913 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/sad.pngbin0 -> 5517 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/scissors.pngbin0 -> 5061 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/search.pngbin0 -> 3229 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/settings.pngbin0 -> 4141 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/share.pngbin0 -> 2616 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/shuffle.pngbin0 -> 3420 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/skip-backward.pngbin0 -> 2421 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/skip-forward.pngbin0 -> 2402 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-android-outline.pngbin0 -> 3772 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-android.pngbin0 -> 2784 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-apple-outline.pngbin0 -> 4104 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-apple.pngbin0 -> 2647 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-bitcoin-outline.pngbin0 -> 3790 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-bitcoin.pngbin0 -> 2424 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-buffer-outline.pngbin0 -> 3913 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-buffer.pngbin0 -> 4687 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-designernews-outline.pngbin0 -> 4754 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-designernews.pngbin0 -> 4242 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dribbble-outline.pngbin0 -> 5588 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dribbble.pngbin0 -> 6983 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dropbox-outline.pngbin0 -> 5113 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dropbox.pngbin0 -> 6161 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-facebook-outline.pngbin0 -> 1788 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-facebook.pngbin0 -> 1402 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-foursquare-outline.pngbin0 -> 3364 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-foursquare.pngbin0 -> 3021 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-freebsd-devil.pngbin0 -> 5300 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-github-outline.pngbin0 -> 7475 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-github.pngbin0 -> 4561 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-google-outline.pngbin0 -> 3890 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-google.pngbin0 -> 3682 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-googleplus-outline.pngbin0 -> 4071 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-googleplus.pngbin0 -> 3888 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-hackernews-outline.pngbin0 -> 1994 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-hackernews.pngbin0 -> 1905 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-instagram-outline.pngbin0 -> 3317 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-instagram.pngbin0 -> 4403 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-linkedin-outline.pngbin0 -> 2370 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-linkedin.pngbin0 -> 2275 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-pinterest-outline.pngbin0 -> 6933 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-pinterest.pngbin0 -> 5532 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-reddit-outline.pngbin0 -> 6414 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-reddit.pngbin0 -> 4498 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-rss-outline.pngbin0 -> 5945 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-rss.pngbin0 -> 4789 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-skype-outline.pngbin0 -> 5608 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-skype.pngbin0 -> 4269 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tumblr-outline.pngbin0 -> 2725 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tumblr.pngbin0 -> 1946 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tux.pngbin0 -> 7103 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-twitter-outline.pngbin0 -> 5569 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-twitter.pngbin0 -> 3405 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-usd-outline.pngbin0 -> 5744 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-usd.pngbin0 -> 3446 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-vimeo-outline.pngbin0 -> 5525 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-vimeo.pngbin0 -> 3456 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-windows-outline.pngbin0 -> 1775 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-windows.pngbin0 -> 2550 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-wordpress-outline.pngbin0 -> 6418 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-wordpress.pngbin0 -> 5465 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-yahoo-outline.pngbin0 -> 2119 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-yahoo.pngbin0 -> 1729 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-youtube-outline.pngbin0 -> 4655 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-youtube.pngbin0 -> 2511 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/speakerphone.pngbin0 -> 4310 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/speedometer.pngbin0 -> 4238 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/spoon.pngbin0 -> 2306 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/star.pngbin0 -> 2195 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/stats-bars.pngbin0 -> 218 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/steam.pngbin0 -> 3875 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/stop.pngbin0 -> 1090 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thermometer.pngbin0 -> 1980 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thumbsdown.pngbin0 -> 2288 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thumbsup.pngbin0 -> 2356 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/toggle-filled.pngbin0 -> 3194 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/toggle.pngbin0 -> 3599 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trash-a.pngbin0 -> 2752 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trash-b.pngbin0 -> 1882 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trophy.pngbin0 -> 3579 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/umbrella.pngbin0 -> 3416 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/university.pngbin0 -> 3167 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/unlocked.pngbin0 -> 2412 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/upload.pngbin0 -> 2480 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/usb.pngbin0 -> 3950 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/videocamera.pngbin0 -> 2381 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-high.pngbin0 -> 4334 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-low.pngbin0 -> 2136 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-medium.pngbin0 -> 3174 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-mute.pngbin0 -> 4803 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wand.pngbin0 -> 1933 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/waterdrop.pngbin0 -> 3169 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wifi.pngbin0 -> 3037 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wineglass.pngbin0 -> 3734 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/woman.pngbin0 -> 3592 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wrench.pngbin0 -> 2866 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/xbox.pngbin0 -> 4958 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/readme.md60
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-font.scss27
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-icons.scss1473
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-variables.scss741
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/ionicons.scss15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/alert-circled.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/alert.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-add-circle.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-add.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-alarm-clock.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-alert.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-apps.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-archive.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-back.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-down.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropdown-circle.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropdown.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropleft-circle.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropleft.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropright-circle.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropright.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropup-circle.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropup.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-forward.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-up.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-attach.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bar.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bicycle.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-boat.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bookmark.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bulb.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bus.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-calendar.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-call.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-camera.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cancel.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-car.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cart.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-chat.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-blank.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-outline-blank.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-outline.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkmark-circle.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-clipboard.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-close.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-circle.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-done.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-outline.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-color-palette.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-compass.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contact.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contacts.svg26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contract.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-create.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-delete.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-desktop.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-document.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-done-all.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-done.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-download.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-drafts.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-exit.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-expand.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-favorite-outline.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-favorite.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-film.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-folder-open.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-folder.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-funnel.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-globe.svg24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-hand.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-hangout.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-happy.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-home.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-image.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-laptop.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-list.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-locate.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-lock.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-mail.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-map.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-menu.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-microphone-off.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-microphone.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-more-horizontal.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-more-vertical.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-navigate.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications-none.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications-off.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-open.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-options.svg26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-people.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-person-add.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-person.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-phone-landscape.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-phone-portrait.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-pin.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-plane.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-playstore.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-print.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-radio-button-off.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-radio-button-on.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-refresh.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-remove-circle.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-remove.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-restaurant.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sad.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-search.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-send.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-settings.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-share-alt.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-share.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star-half.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star-outline.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-stopwatch.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-subway.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sunny.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sync.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-textsms.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-time.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-train.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-unlock.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-upload.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-down.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-mute.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-off.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-up.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-walk.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-warning.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-watch.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-wifi.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/aperture.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/archive.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-a.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-b.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-c.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-expand.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-down-left.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-down-right.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-up-left.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-up-right.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-a.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-b.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-c.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-move.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-resize.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-return-left.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-return-right.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-a.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-b.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-c.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-shrink.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-swap.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-a.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-b.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-c.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/asterisk.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/at.svg25
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/backspace-outline.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/backspace.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bag.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-charging.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-empty.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-full.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-half.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-low.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/beaker.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/beer.svg28
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bluetooth.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bonfire.svg32
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bookmark.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bowtie.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/briefcase.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bug.svg30
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/calculator.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/calendar.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/camera.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/card.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cash.svg31
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbox-working.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbox.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatboxes.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubble-working.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubble.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubbles.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark-circled.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark-round.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-down.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-left.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-right.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-up.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/clipboard.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/clock.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close-circled.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close-round.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/closed-captioning.svg31
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cloud.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code-download.svg31
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code-working.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/coffee.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/compass.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/compose.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/connection-bars.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/contrast.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/crop.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cube.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/disc.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/document-text.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/document.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/drag.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/earth.svg44
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/easel.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/edit.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/egg.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eject.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/email-unread.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/email.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/erlenmeyer-flask-bubbles.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/erlenmeyer-flask.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eye-disabled.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eye.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/female.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/filing.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/film-marker.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fireball.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flag.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flame.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flash-off.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flash.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/folder.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fork-repo.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fork.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/forward.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/funnel.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/gear-a.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/gear-b.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/grid.svg32
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/hammer.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/happy-outline.svg23
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/happy.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/headphone.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/heart-broken.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/heart.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help-buoy.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help-circled.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/home.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/icecream.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/image.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/images.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/information-circled.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/information.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ionic.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-alarm-outline.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-alarm.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-albums-outline.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-albums.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-americanfootball-outline.svg24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-americanfootball.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-analytics-outline.svg24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-analytics.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-back.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-down.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-forward.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-left.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-right.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-down.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-left.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-right.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-up.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-up.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-at-outline.svg26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-at.svg24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-barcode-outline.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-barcode.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-baseball-outline.svg35
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-baseball.svg27
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-basketball-outline.svg25
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-basketball.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bell-outline.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bell.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-body-outline.svg27
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-body.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bolt-outline.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bolt.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-book-outline.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-book.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bookmarks-outline.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bookmarks.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-box-outline.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-box.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-briefcase-outline.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-briefcase.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-browsers-outline.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-browsers.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calculator-outline.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calculator.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calendar-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calendar.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-camera-outline.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-camera.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cart-outline.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cart.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatboxes-outline.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatboxes.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatbubble-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatbubble.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark-empty.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-circle-filled.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-circle-outline.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-clock-outline.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-clock.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close-empty.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close-outline.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-download-outline.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-download.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-outline.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-upload-outline.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-upload.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-night-outline.svg24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-night.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-outline.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cog-outline.svg29
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cog.svg23
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-filter-outline.svg25
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-filter.svg29
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-wand-outline.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-wand.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-compose-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-compose.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-contact-outline.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-contact.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-copy-outline.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-copy.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-crop-strong.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-crop.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-download-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-download.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-drag.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-email-outline.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-email.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-eye-outline.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-eye.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-fastforward-outline.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-fastforward.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-filing-outline.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-filing.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-film-outline.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-film.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flag-outline.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flag.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flame-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flame.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flask-outline.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flask.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flower-outline.svg75
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flower.svg38
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-folder-outline.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-folder.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-football-outline.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-football.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-a-outline.svg26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-a.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-b-outline.svg35
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-b.svg23
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-gear-outline.svg40
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-gear.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-glasses-outline.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-glasses.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-grid-view-outline.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-grid-view.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-heart-outline.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-heart.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help-empty.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help-outline.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-home-outline.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-home.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-infinite-outline.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-infinite.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information-empty.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information-outline.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-ionic-outline.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-keypad-outline.svg28
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-keypad.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-lightbulb-outline.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-lightbulb.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-list-outline.svg23
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-list.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-location-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-location.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-locked-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-locked.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-loop-strong.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-loop.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medical-outline.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medical.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medkit-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medkit.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic-off.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic-outline.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus-empty.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus-outline.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-monitor-outline.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-monitor.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-moon-outline.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-moon.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-more-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-more.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-musical-note.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-musical-notes.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-navigate-outline.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-navigate.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-nutrition-outline.svg29
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-nutrition.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paper-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paper.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paperplane-outline.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paperplane.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-partlysunny-outline.svg33
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-partlysunny.svg28
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pause-outline.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pause.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paw-outline.svg43
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paw.svg26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-people-outline.svg44
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-people.svg29
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-person-outline.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-person.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-personadd-outline.svg25
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-personadd.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-photos-outline.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-photos.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pie-outline.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pie.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pint-outline.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pint.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-play-outline.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-play.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus-empty.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus-outline.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetag-outline.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetag.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetags-outline.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetags.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-printer-outline.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-printer.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pulse-strong.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pulse.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rainy-outline.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rainy.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-recording-outline.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-recording.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-redo-outline.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-redo.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh-empty.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh-outline.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reload.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reverse-camera-outline.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reverse-camera.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rewind-outline.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rewind.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rose-outline.svg29
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rose.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-search-strong.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-search.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-settings-strong.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-settings.svg24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-shuffle-strong.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-shuffle.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipbackward-outline.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipbackward.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipforward-outline.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipforward.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-snowy.svg26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-speedometer-outline.svg24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-speedometer.svg28
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star-half.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star-outline.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-stopwatch-outline.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-stopwatch.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-sunny-outline.svg27
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-sunny.svg26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-telephone-outline.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-telephone.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-tennisball-outline.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-tennisball.svg25
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-thunderstorm-outline.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-thunderstorm.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-time-outline.svg36
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-time.svg27
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-timer-outline.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-timer.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-toggle-outline.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-toggle.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-trash-outline.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-trash.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-undo-outline.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-undo.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-unlocked-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-unlocked.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-upload-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-upload.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-videocam-outline.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-videocam.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-volume-high.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-volume-low.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-wineglass-outline.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-wineglass.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-world-outline.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-world.svg29
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ipad.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/iphone.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ipod.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/jet.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/key.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/knife.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/laptop.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/leaf.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/levels.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/lightbulb.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/link.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-a.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-b.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-c.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-d.svg28
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/location.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/lock-combination.svg28
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/locked.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/log-in.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/log-out.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/loop.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/magnet.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/male.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/man.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/map.svg30
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/medkit.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/merge.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-a.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-b.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-c.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus-circled.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus-round.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/model-s.svg33
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/monitor.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/more.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mouse.svg24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/music-note.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navicon-round.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navicon.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navigate.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/network.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/no-smoking.svg33
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/nuclear.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/outlet.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paintbrush.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paintbucket.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paper-airplane.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paperclip.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pause.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person-add.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person-stalker.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pie-graph.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pin.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pinpoint.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pizza.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plane.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/planet.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/play.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/playstation.svg27
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus-circled.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus-round.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/podium.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pound.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/power.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pricetag.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pricetags.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/printer.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pull-request.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/qr-scanner.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/quote.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/radio-waves.svg25
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/record.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/refresh.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/reply-all.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/reply.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ribbon-a.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ribbon-b.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/sad-outline.svg28
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/sad.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/scissors.svg23
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/search.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/settings.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/share.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/shuffle.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/skip-backward.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/skip-forward.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-android-outline.svg29
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-android.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-angular-outline.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-angular.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-apple-outline.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-apple.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-bitcoin-outline.svg27
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-bitcoin.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-buffer-outline.svg24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-buffer.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-chrome-outline.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-chrome.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-codepen-outline.svg26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-codepen.svg26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-css3-outline.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-css3.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-designernews-outline.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-designernews.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dribbble-outline.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dribbble.svg26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dropbox-outline.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dropbox.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-euro-outline.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-euro.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-facebook-outline.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-facebook.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-foursquare-outline.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-foursquare.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-freebsd-devil.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-github-outline.svg24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-github.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-google-outline.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-google.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-googleplus-outline.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-googleplus.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-hackernews-outline.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-hackernews.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-html5-outline.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-html5.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-instagram-outline.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-instagram.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-javascript-outline.svg27
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-javascript.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-linkedin-outline.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-linkedin.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-markdown.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-nodejs.svg26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-octocat.svg28
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-pinterest-outline.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-pinterest.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-python.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-reddit-outline.svg26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-reddit.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-rss-outline.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-rss.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-sass.svg35
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-skype-outline.svg26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-skype.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-snapchat-outline.svg42
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-snapchat.svg31
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tumblr-outline.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tumblr.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tux.svg53
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitch-outline.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitch.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitter-outline.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitter.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-usd-outline.svg44
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-usd.svg24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-vimeo-outline.svg23
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-vimeo.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-whatsapp-outline.svg25
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-whatsapp.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-windows-outline.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-windows.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-wordpress-outline.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-wordpress.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yahoo-outline.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yahoo.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yen-outline.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yen.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-youtube-outline.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-youtube.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/soup-can-outline.svg28
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/soup-can.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/speakerphone.svg19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/speedometer.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/spoon.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/star.svg7
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/stats-bars.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/steam.svg20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/stop.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thermometer.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thumbsdown.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thumbsup.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/toggle-filled.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/toggle.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/transgender.svg12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trash-a.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trash-b.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trophy.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/tshirt-outline.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/tshirt.svg8
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/umbrella.svg18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/university.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/unlocked.svg10
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/upload.svg9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/usb.svg22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/videocamera.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-high.svg15
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-low.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-medium.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-mute.svg14
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wand.svg17
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/waterdrop.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wifi.svg16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wineglass.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/woman.svg13
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wrench.svg11
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/xbox.svg21
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/utils/js/browserCheck.js24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/nbook-framecontroller.js34
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/nbookController.js179
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/notebookFrameController.js65
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/dependency/angular.js29400
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook-frame.html85
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook-viz.html26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook.htm54
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebookInputs.html90
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/angular-gridster.js2244
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/ui-gridster-tpls.js168
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/adminController.js65
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/admin_menu_edit.js230
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/ase-controller.js22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-controller.js79
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-list-controller.js120
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/collaborate-list-controller.js63
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/fn_menu_add_popup_controller.js281
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/jcs-admin-controller.js83
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/modelpopupController.js40
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/post-search-controller.js202
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-controller.js286
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-search-controller.js80
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profileController.js38
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-controller.js226
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-function-list-controller.js157
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-list-controller.js102
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolefunctionpopupController.js84
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolepopupmodelController.js205
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/self-profile-controller.js284
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/usage-list-controller.js41
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowApp.js24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowController.js509
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowRouting.js26
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/footer.js30
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/header.js504
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/leftMenu.js203
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/jquery.resize.js139
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/debug.js329
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery-latest.js9555
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery-ui-latest.js14879
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery.layout-latest.js6086
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/modalService.js185
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/moment.min.js6
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/adminService.js160
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/headerService.js89
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/leftMenuService.js54
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/profileService.js98
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/userInfoService.js51
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/socket/peerBroadcast.js122
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/page-resource.js95
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/sandbox-resources.html9
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/admin.html115
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/profile.html50
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/footer.html42
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/header.html186
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/left_menu.html41
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/admin_menu_edit.html175
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast.html61
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast_list.html71
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/collaborate_list.html57
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/jcs_admin.html87
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal.html282
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_add.html155
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_edit.html148
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_role.html82
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html46
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/post_search.html139
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_detail.html188
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_search.html72
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role.html118
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_function_list.html88
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_list.html61
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/self_profile.html183
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/usage_list.html64
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-landing.html130
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-listing.html85
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-new.html108
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-preview.html36
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-remove.html38
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-schedule.html116
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/RTCMultiConnection.js6788
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html78
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/sandbox-gridster.css173
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/ui-gridster.css116
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/fusion-sunny.css362
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/jquery-ui.css1225
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/layout/layout-default-latest.css224
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/workflows/workflows.css50
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-list-controller.js62
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-view-controller.js64
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/droolsController.js30
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/directives/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/services/droolsService.js76
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/utils/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsList.html47
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsSinglePage.html92
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsView.html61
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/external/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/fonts/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/images/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-controller.js80
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-iframe-controller.js23
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sampleController.js30
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/directives/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/utils/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sample.html60
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sampleWithIframe.html22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/singlePageSample.html87
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/styles/dummy.txt0
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/index.jsp24
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/manifest.jsp47
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/sandbox-gridster.css173
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/ui-gridster.css116
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/fusion-sunny.css362
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/jquery-ui.css1225
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/layout/layout-default-latest.css224
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/css/nv.d3.css656
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/cie.js155
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/colorbrewer.js302
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js122
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.js1180
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.geom.js816
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.js5
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.cloud.js433
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.js908
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.js7037
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.min.js4
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v3.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/fisheye.js86
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/hive.js80
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/horizon.js192
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/interactiveLayer.js251
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/intro.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis-min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.js470
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bullet.js250
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bulletChart.js349
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/boilerplate.js104
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bullet.js385
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bulletChart.js343
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/cumulativeLineChart.js782
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBar.js349
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBarChart.js333
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/distribution.js148
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBar.js331
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBarChart.js419
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/indentedTree.js337
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/legend.js270
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/line.js284
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineChart.js465
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarChart.js433
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarWithFocusChart.js658
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheye.js200
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheyeChart.js297
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFocusChart.js574
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBar.js461
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarChart.js524
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontal.js424
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontalChart.js434
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarTimeSeries.js384
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarTimeSeriesChart.js405
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiChart.js452
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/ohlcBar.js380
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/parallelCoordinates.js239
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pie.js400
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pieChart.js292
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatter.js674
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterChart.js628
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterPlusLineChart.js620
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparkline.js194
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparklinePlus.js295
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedArea.js368
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedAreaChart.js629
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.js13097
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/outro.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/sankey.js292
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/tooltip.js490
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/utils.js152
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Rlogo.jpgbin0 -> 3173 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Thumbs.dbbin0 -> 102912 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_icon.pngbin0 -> 2388 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_list_spacer.gifbin0 -> 73 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/active.pngbin0 -> 682 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add.pngbin0 -> 352 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add_tool_button.pngbin0 -> 31105 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/addicon.pngbin0 -> 463 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/application_window_bg.jpgbin0 -> 914 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-next.pngbin0 -> 1561 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-prev.pngbin0 -> 1557 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/att_angular_gridster/grips.pngbin0 -> 951 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/backButton.pngbin0 -> 816 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blank.gifbin0 -> 49 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blueButton.pngbin0 -> 1468 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/bubble.pngbin0 -> 662 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/cache.pngbin0 -> 1081 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/calendar.gifbin0 -> 929 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/chevron.pngbin0 -> 252 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/close_container.gifbin0 -> 85 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/collapsed-icon.pngbin0 -> 1379 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/column-bg.pngbin0 -> 165 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon-highlighted.pngbin0 -> 264 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon.pngbin0 -> 235 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.jpgbin0 -> 632 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.pngbin0 -> 938 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-add.pngbin0 -> 755 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-search.pngbin0 -> 976 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers.pngbin0 -> 749 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/decrypted.pngbin0 -> 628 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.gifbin0 -> 592 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.pngbin0 -> 566 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon.gifbin0 -> 579 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp.pngbin0 -> 107597 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp_trans.pngbin0 -> 109926 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/editicon.gifbin0 -> 360 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/error_type.gifbin0 -> 398 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/example-frame.pngbin0 -> 33699 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/excelicon_multi.gifbin0 -> 1028 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/executeicon.pngbin0 -> 1076 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/expanded-icon.pngbin0 -> 1372 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file-add.pngbin0 -> 675 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_import.pngbin0 -> 653 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_save-all.pngbin0 -> 610 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/filter_icon.pngbin0 -> 29069 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_add.pngbin0 -> 772 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_closed.pngbin0 -> 559 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_delete.pngbin0 -> 767 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_edit.pngbin0 -> 829 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_open.pngbin0 -> 632 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_user.pngbin0 -> 887 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/funnel.pngbin0 -> 543 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/fusion.gifbin0 -> 8821 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/grayButton.pngbin0 -> 1361 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/gray_add_tool_button.pngbin0 -> 30883 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/headerChatIcon.pngbin0 -> 465 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/icon_remove_all.gifbin0 -> 982 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/inactive.pngbin0 -> 842 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/info_type.gifbin0 -> 291 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/leftButton.pngbin0 -> 681 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading.gifbin0 -> 6820 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading_bar.gifbin0 -> 28954 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/login_button.gifbin0 -> 1222 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/m1.gifbin0 -> 636 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/mail.pngbin0 -> 449 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/map.pngbin0 -> 611 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/minus.gifbin0 -> 75 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/modify_icon.gifbin0 -> 246 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/no_favorites_star.pngbin0 -> 2794 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-add.pngbin0 -> 589 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-search.pngbin0 -> 876 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note.pngbin0 -> 583 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/notes.pngbin0 -> 673 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offline.pngbin0 -> 3483 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offlineMsg.gifbin0 -> 1004 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/online.pngbin0 -> 888 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/page.gifbin0 -> 131 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pagination.pngbin0 -> 724 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-e-w-toggle.pngbin0 -> 459 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-n-s-toggle.pngbin0 -> 335 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pix.gifbin0 -> 49 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/plus.gifbin0 -> 78 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/printer.gifbin0 -> 1036 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/profile.pngbin0 -> 462 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-add.pngbin0 -> 724 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-favorite.pngbin0 -> 693 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-my.pngbin0 -> 739 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-public.pngbin0 -> 776 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report.pngbin0 -> 563 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/reports.pngbin0 -> 769 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-active.pngbin0 -> 545 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-disabled.pngbin0 -> 421 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-active.pngbin0 -> 541 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-disabled.pngbin0 -> 421 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-active.pngbin0 -> 416 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-disabled.pngbin0 -> 326 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-active.pngbin0 -> 421 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-disabled.pngbin0 -> 322 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_last.pngbin0 -> 506 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_previous.pngbin0 -> 381 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/return_to_top.gifbin0 -> 846 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/rightButton.pngbin0 -> 731 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search.pngbin0 -> 3501 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search_profile.pngbin0 -> 880 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_asc.gifbin0 -> 57 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_desc.gifbin0 -> 58 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/spacer.gifbin0 -> 43 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/success_type.gifbin0 -> 260 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/swoosh.gifbin0 -> 14250 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-hm.pngbin0 -> 249 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-v-hm.pngbin0 -> 317 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab.pngbin0 -> 343 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-add.pngbin0 -> 3314 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-delete.pngbin0 -> 3342 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-edit.pngbin0 -> 3348 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table.pngbin0 -> 496 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tabs-bg.pngbin0 -> 147 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.gifbin0 -> 414 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.pngbin0 -> 531 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolbar.pngbin0 -> 171 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/users.pngbin0 -> 938 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/warning_type.gifbin0 -> 1055 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/webphone.icobin0 -> 241 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/whiteButton.pngbin0 -> 1430 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/angular-gridster.js2244
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/ui-gridster-tpls.js168
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/jquery.resize.js139
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/debug.js329
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery-latest.js9555
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery-ui-latest.js14879
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery.layout-latest.js6086
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/moment.min.js6
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/Style.css77
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/bd_quantum_raptor.css305
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/calendar.css97
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/dashboard.css36
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/drupal.css83
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/form-field-tooltip.css12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/mobile_raptor.css73
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/novamap.css25
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/picker.css40
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/ral.css1437
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/raptor.css62
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/css/nv.d3.css656
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/cie.js155
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/colorbrewer.js302
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/core.js122
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.js1180
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.geom.js816
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.js3015
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.layout.js908
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.js7033
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.min.js4
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.js8444
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/fisheye.js86
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/hive.js80
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/horizon.js192
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/interactiveLayer.js251
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/intro.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis-min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.js470
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/boilerplate.js104
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bullet.js385
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bulletChart.js343
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/cumulativeLineChart.js782
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBar.js349
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBarChart.js333
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/distribution.js148
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBar.js331
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBarChart.js419
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/indentedTree.js337
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/legend.js270
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/line.js284
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineChart.js465
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarChart.js433
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarWithFocusChart.js658
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheye.js200
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheyeChart.js297
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFocusChart.js574
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBar.js461
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarChart.js524
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontal.js424
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontalChart.js434
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarTimeSeries.js384
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarTimeSeriesChart.js405
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiChart.js452
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/ohlcBar.js380
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/parallelCoordinates.js239
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js400
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js.bak400
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pieChart.js292
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatter.js674
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterChart.js628
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterPlusLineChart.js620
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparkline.js194
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparklinePlus.js295
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedArea.js368
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedAreaChart.js629
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/nv.d3.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/outro.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/sankey.js292
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/tooltip.js490
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/utils.js152
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dashed-canvas.js176
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/data.js63
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-canvas.js816
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-combined.js2
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-combined_bak_color.js2
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-dev.js45
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-externs.js93
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-gviz.js82
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-interaction-model.js676
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-layout.js349
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options-reference.js867
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options.js384
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-base.js4
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-install.js19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-tickers.js487
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-utils.js1305
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph.js3857
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/excanvas.js924
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.js333
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction_sun.js303
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/moment.min.js6
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/phantom-driver.js206
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/phantom-perf.js94
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/README113
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/annotations.js182
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/axes.js315
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/chart-labels.js202
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/grid.js124
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/legend.js332
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/range-selector.js852
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/rgbcolor/rgbcolor.js257
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/stacktrace.js411
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/Doxyfile243
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime-min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime.js731
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.css557
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.js277
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/dynamicform.js112
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/moment.js3688
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/multiselect.js62
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/quick_links.js33
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.html313
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.js671
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.html67
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.js293
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.html34
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.js136
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/CalendarPopup.js1486
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax.js214
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax_dynamic_content.js97
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/cingular_button.js217
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/drupal.js1018
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/editabledropdown.js363
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/form-field-tooltip.js715
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/gmap.js634
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/jquery.js4376
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/jquery.min.js154
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/label_quantum.js5
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/nova_button.js1184
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/other_scripts.js331
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/persist_table_header.js47
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/prototype-1.6.0.3.js4320
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/raptor.js314
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/rounded-corners.js353
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/script.js482
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.css1971
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.eotbin0 -> 8728 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.js26735
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.svg34
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.ttfbin0 -> 8564 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.woffbin0 -> 4792 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/vfs_fonts.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/images/blank.gifbin0 -> 49 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/scribble.css40
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/slider.css142
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/spacegallery.css18
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/welcome.css169
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/area_chart.html49
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/bar_chart.html95
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/d3_gauges_demo.html39
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer2.csv16
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer3.csv2
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/worddata.csv22
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/donut_d3.html43
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/area_chart.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/donut.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/gauges.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/line_chart.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/pie_chart.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/worddata.min.js1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/line_chart.html49
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/pie_chart.html38
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/wordcloud.html37
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/Calendar-16x16.pngbin0 -> 552 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-next.pngbin0 -> 1561 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-prev.pngbin0 -> 1557 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_drive_test_map.pngbin0 -> 202465 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_county.pngbin0 -> 21222 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_regression.pngbin0 -> 11536 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_ios_throughput.pngbin0 -> 26131 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map.pngbin0 -> 192031 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map_legend.pngbin0 -> 3021 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_nova_sdn_map.pngbin0 -> 179361 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/copyicon.pngbin0 -> 235 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/deleteicon.gifbin0 -> 579 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/example-frame.pngbin0 -> 33699 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/loading.gifbin0 -> 6820 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/1_mon.pngbin0 -> 22762 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/2_tue.pngbin0 -> 22772 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/3_wed.pngbin0 -> 24012 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/4_thu.pngbin0 -> 23902 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/5_fri.pngbin0 -> 22349 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/6_sat.pngbin0 -> 23674 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/7_sun.pngbin0 -> 22845 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_IN.pngbin0 -> 10575 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_OUT.pngbin0 -> 10460 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat.pngbin0 -> 10420 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Def.pngbin0 -> 8941 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Priority.pngbin0 -> 10590 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/FusionCharts.js361
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/charts.js132
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/eye.js34
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/jquery.flexslider-min.js5
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/scribble.js19
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/slides.min.jquery.js20
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/spacegallery.js235
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/utils.js252
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/bootstrap.min.css351
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/custom.css97
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/jquery.jOrgChart.css51
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/prettify.css1
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example.html85
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example_vsp.html88
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/bkgd.pngbin0 -> 133 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/raspberry.jpgbin0 -> 5755 bytes
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/jquery.jOrgChart.js267
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/prettify.js28
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery-1.10.2.js9789
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery-ui.js16617
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery.mask.min.js12
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/js/modalService.js169
-rw-r--r--ecomp-sdk/sdk-app/src/main/webapp/static/js/search.js829
-rw-r--r--ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/SanityTest.java20
-rw-r--r--ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/controller/CollaborationControllerTest.java27
-rw-r--r--ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/controller/NetMapTest.java19
-rw-r--r--ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/service/ProfileServiceTest.java37
-rw-r--r--ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalsdk/core/MockApplicationContextTestSuite.java126
-rw-r--r--ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleServiceTest.java41
-rw-r--r--ecomp-sdk/sdk-workflow/.gitignore1
-rw-r--r--ecomp-sdk/sdk-workflow/README.md7
-rw-r--r--ecomp-sdk/sdk-workflow/pom.xml111
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/NotebookController.java54
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/NotebookTestController.java56
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/RNoteBookController.java84
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/RNoteBookFEController.java113
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/domain/RNoteBookCredentials.java93
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/exception/RNotebookIntegrationException.java41
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/service/RNoteBookIntegrationService.java31
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/service/RNoteBookIntegrationServiceImpl.java144
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/controllers/WorkflowController.java183
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/HibernateConfiguration.java20
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/WorkflowDAO.java32
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/WorkflowDAOImpl.java109
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/domain/WorkflowSchedule.java91
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/models/Workflow.java202
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/models/WorkflowLite.java174
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/scheduler/WorkFlowScheduleJob.java45
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/scheduler/WorkFlowScheduleRegistry.java107
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleExecutor.java108
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleService.java34
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleServiceImpl.java144
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowService.java35
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowServiceImpl.java77
-rw-r--r--ecomp-sdk/sdk-workflow/src/main/resources/RNoteBookIntegration.hbm.xml43
-rw-r--r--ecomp-sdk/thirdparty/.gitignore1
-rw-r--r--ecomp-sdk/thirdparty/README.md23
-rw-r--r--ecomp-sdk/thirdparty/pom.xml93
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/ECOMPSSOFilter.java77
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/SecureServlet.java61
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/UnSecureServlet.java61
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/CipherUtil.java125
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/ECOMPSSO.java238
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/IPortalRestAPIService.java133
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/IPortalUebAPIService.java46
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalAPIException.java49
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalAPIResponse.java58
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalApiConstants.java62
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalApiProperties.java98
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalRestAPIProxy.java498
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutBindingListener.java52
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutHandler.java419
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutVO.java63
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/SessionCommunication.java161
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/UserContextListener.java52
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/UserSessionListener.java84
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FavoritesClient.java51
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FunctionalMenuClient.java54
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java178
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Consumer.java164
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/FunctionalMenu.java61
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Helper.java64
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Publisher.java124
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/PublisherList.java77
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/TopicManager.java121
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebException.java65
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebManager.java358
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebMsg.java119
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebMsgTypes.java28
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/WaitingRequestersQueueList.java73
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/EcompRole.java87
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/EcompUser.java197
-rw-r--r--ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/SharedContext.java300
2605 files changed, 632830 insertions, 0 deletions
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 00000000..8a5478ca
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,4 @@
+[gerrit]
+host=gerrit.openecomp.org
+port=29418
+project=ecompsdkos.git \ No newline at end of file
diff --git a/.idea/ecompsdkos.iml b/.idea/ecompsdkos.iml
new file mode 100644
index 00000000..d6ebd480
--- /dev/null
+++ b/.idea/ecompsdkos.iml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$" />
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module> \ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000..107a11b6
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectRootManager" version="2" default="true" />
+ <component name="masterDetails">
+ <states>
+ <state key="ProjectJDKs.UI">
+ <settings>
+ <splitter-proportions>
+ <option name="proportions">
+ <list>
+ <option value="0.2" />
+ </list>
+ </option>
+ </splitter-proportions>
+ </settings>
+ </state>
+ </states>
+ </component>
+</project> \ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000..ed67d0f2
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/.idea/ecompsdkos.iml" filepath="$PROJECT_DIR$/.idea/ecompsdkos.iml" />
+ </modules>
+ </component>
+</project> \ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..35eb1ddf
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="Git" />
+ </component>
+</project> \ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 00000000..51e13c4a
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,328 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ChangeListManager">
+ <list default="true" id="8d1c1877-2634-48b1-8947-2fa1a6a8ca90" name="Default" comment="" />
+ <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
+ <option name="TRACKING_ENABLED" value="true" />
+ <option name="SHOW_DIALOG" value="false" />
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+ <option name="LAST_RESOLUTION" value="IGNORE" />
+ </component>
+ <component name="CreatePatchCommitExecutor">
+ <option name="PATCH_PATH" value="" />
+ </component>
+ <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
+ <component name="Git.Settings">
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
+ </component>
+ <component name="GradleLocalSettings">
+ <option name="externalProjectsViewState">
+ <projects_view />
+ </option>
+ </component>
+ <component name="ProjectFrameBounds">
+ <option name="x" value="-8" />
+ <option name="y" value="-8" />
+ <option name="width" value="1616" />
+ <option name="height" value="1176" />
+ </component>
+ <component name="ProjectView">
+ <navigator currentView="ProjectPane" proportions="" version="1">
+ <flattenPackages />
+ <showMembers />
+ <showModules />
+ <showLibraryContents />
+ <hideEmptyPackages />
+ <abbreviatePackageNames />
+ <autoscrollToSource />
+ <autoscrollFromSource />
+ <sortByType />
+ <manualOrder />
+ <foldersAlwaysOnTop value="true" />
+ </navigator>
+ <panes>
+ <pane id="Scope" />
+ <pane id="ProjectPane">
+ <subPane>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="ecompsdkos" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="ecompsdkos" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ </subPane>
+ </pane>
+ <pane id="PackagesPane" />
+ <pane id="Scratches" />
+ </panes>
+ </component>
+ <component name="PropertiesComponent">
+ <property name="settings.editor.selected.configurable" value="settings.gerrit" />
+ </component>
+ <component name="RunManager">
+ <configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
+ <module name="" />
+ <option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
+ <option name="PROGRAM_PARAMETERS" />
+ <predefined_log_file id="idea.log" enabled="true" />
+ <method />
+ </configuration>
+ <configuration default="true" type="AndroidRunConfigurationType" factoryName="Android App">
+ <module name="" />
+ <option name="DEPLOY" value="true" />
+ <option name="ARTIFACT_NAME" value="" />
+ <option name="PM_INSTALL_OPTIONS" value="" />
+ <option name="ACTIVITY_EXTRA_FLAGS" value="" />
+ <option name="MODE" value="default_activity" />
+ <option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
+ <option name="PREFERRED_AVD" value="" />
+ <option name="CLEAR_LOGCAT" value="false" />
+ <option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
+ <option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
+ <option name="FORCE_STOP_RUNNING_APP" value="true" />
+ <option name="DEBUGGER_TYPE" value="Java" />
+ <option name="USE_LAST_SELECTED_DEVICE" value="false" />
+ <option name="PREFERRED_AVD" value="" />
+ <Java />
+ <Profilers>
+ <option name="ENABLE_ADVANCED_PROFILING" value="true" />
+ <option name="GAPID_ENABLED" value="false" />
+ <option name="GAPID_DISABLE_PCS" value="false" />
+ <option name="SUPPORT_LIB_ENABLED" value="true" />
+ <option name="INSTRUMENTATION_ENABLED" value="true" />
+ </Profilers>
+ <option name="DEEP_LINK" value="" />
+ <option name="ACTIVITY_CLASS" value="" />
+ <method />
+ </configuration>
+ <configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Tests">
+ <module name="" />
+ <option name="TESTING_TYPE" value="0" />
+ <option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
+ <option name="METHOD_NAME" value="" />
+ <option name="CLASS_NAME" value="" />
+ <option name="PACKAGE_NAME" value="" />
+ <option name="EXTRA_OPTIONS" value="" />
+ <option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
+ <option name="PREFERRED_AVD" value="" />
+ <option name="CLEAR_LOGCAT" value="false" />
+ <option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
+ <option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
+ <option name="FORCE_STOP_RUNNING_APP" value="true" />
+ <option name="DEBUGGER_TYPE" value="Java" />
+ <option name="USE_LAST_SELECTED_DEVICE" value="false" />
+ <option name="PREFERRED_AVD" value="" />
+ <Java />
+ <Profilers>
+ <option name="ENABLE_ADVANCED_PROFILING" value="true" />
+ <option name="GAPID_ENABLED" value="false" />
+ <option name="GAPID_DISABLE_PCS" value="false" />
+ <option name="SUPPORT_LIB_ENABLED" value="true" />
+ <option name="INSTRUMENTATION_ENABLED" value="true" />
+ </Profilers>
+ <method />
+ </configuration>
+ <configuration default="true" type="Applet" factoryName="Applet">
+ <option name="HTML_USED" value="false" />
+ <option name="WIDTH" value="400" />
+ <option name="HEIGHT" value="300" />
+ <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
+ <module />
+ <method />
+ </configuration>
+ <configuration default="true" type="Application" factoryName="Application">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="VM_PARAMETERS" />
+ <option name="PROGRAM_PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="ENABLE_SWING_INSPECTOR" value="false" />
+ <option name="ENV_VARIABLES" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <module name="" />
+ <envs />
+ <method />
+ </configuration>
+ <configuration default="true" type="GradleRunConfiguration" factoryName="Gradle">
+ <ExternalSystemSettings>
+ <option name="executionName" />
+ <option name="externalProjectPath" />
+ <option name="externalSystemIdString" value="GRADLE" />
+ <option name="scriptParameters" />
+ <option name="taskDescriptions">
+ <list />
+ </option>
+ <option name="taskNames">
+ <list />
+ </option>
+ <option name="vmOptions" />
+ </ExternalSystemSettings>
+ <method />
+ </configuration>
+ <configuration default="true" type="JUnit" factoryName="JUnit">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+ <module name="" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="PACKAGE_NAME" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="METHOD_NAME" />
+ <option name="TEST_OBJECT" value="class" />
+ <option name="VM_PARAMETERS" value="-ea" />
+ <option name="PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
+ <option name="ENV_VARIABLES" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <option name="TEST_SEARCH_SCOPE">
+ <value defaultName="singleModule" />
+ </option>
+ <envs />
+ <patterns />
+ <method />
+ </configuration>
+ <configuration default="true" type="JarApplication" factoryName="JAR Application">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+ <envs />
+ <method />
+ </configuration>
+ <configuration default="true" type="Java Scratch" factoryName="Java Scratch">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+ <option name="SCRATCH_FILE_ID" value="0" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="VM_PARAMETERS" />
+ <option name="PROGRAM_PARAMETERS" />
+ <option name="WORKING_DIRECTORY" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="ENABLE_SWING_INSPECTOR" value="false" />
+ <option name="ENV_VARIABLES" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <module name="" />
+ <envs />
+ <method />
+ </configuration>
+ <configuration default="true" type="JetRunConfigurationType" factoryName="Kotlin">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="VM_PARAMETERS" />
+ <option name="PROGRAM_PARAMETERS" />
+ <option name="WORKING_DIRECTORY" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <module name="ecompsdkos" />
+ <envs />
+ <method />
+ </configuration>
+ <configuration default="true" type="KotlinStandaloneScriptRunConfigurationType" factoryName="Kotlin script">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+ <option name="filePath" />
+ <option name="vmParameters" />
+ <option name="alternativeJrePath" />
+ <option name="programParameters" />
+ <option name="passParentEnvs" value="true" />
+ <option name="workingDirectory" />
+ <option name="isAlternativeJrePathEnabled" value="false" />
+ <envs />
+ <method />
+ </configuration>
+ <configuration default="true" type="Remote" factoryName="Remote">
+ <option name="USE_SOCKET_TRANSPORT" value="true" />
+ <option name="SERVER_MODE" value="false" />
+ <option name="SHMEM_ADDRESS" value="javadebug" />
+ <option name="HOST" value="localhost" />
+ <option name="PORT" value="5005" />
+ <method />
+ </configuration>
+ <configuration default="true" type="TestNG" factoryName="TestNG">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+ <module name="" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="SUITE_NAME" />
+ <option name="PACKAGE_NAME" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="METHOD_NAME" />
+ <option name="GROUP_NAME" />
+ <option name="TEST_OBJECT" value="CLASS" />
+ <option name="VM_PARAMETERS" value="-ea" />
+ <option name="PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="ANNOTATION_TYPE" />
+ <option name="ENV_VARIABLES" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <option name="TEST_SEARCH_SCOPE">
+ <value defaultName="singleModule" />
+ </option>
+ <option name="USE_DEFAULT_REPORTERS" value="false" />
+ <option name="PROPERTIES_FILE" />
+ <envs />
+ <properties />
+ <listeners />
+ <method />
+ </configuration>
+ </component>
+ <component name="ShelveChangesManager" show_recycled="false">
+ <option name="remove_strategy" value="false" />
+ </component>
+ <component name="TaskManager">
+ <task active="true" id="Default" summary="Default task">
+ <changelist id="8d1c1877-2634-48b1-8947-2fa1a6a8ca90" name="Default" comment="" />
+ <created>1486485514698</created>
+ <option name="number" value="Default" />
+ <option name="presentableId" value="Default" />
+ <updated>1486485514698</updated>
+ </task>
+ <servers />
+ </component>
+ <component name="ToolWindowManager">
+ <frame x="-8" y="-8" width="1616" height="1176" extended-state="6" />
+ <editor active="false" />
+ <layout>
+ <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
+ <window_info id="Nl-Palette" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Gerrit" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
+ <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Properties" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32981783" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
+ <window_info id="BPMNPalette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+ <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
+ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
+ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+ </layout>
+ </component>
+ <component name="VcsContentAnnotationSettings">
+ <option name="myLimit" value="2678400000" />
+ </component>
+ <component name="XDebuggerManager">
+ <breakpoint-manager />
+ <watches-manager />
+ </component>
+</project> \ No newline at end of file
diff --git a/ecomp-sdk/LICENSE.txt b/ecomp-sdk/LICENSE.txt
new file mode 100644
index 00000000..880bbc9d
--- /dev/null
+++ b/ecomp-sdk/LICENSE.txt
@@ -0,0 +1,19 @@
+/*
+ * ============LICENSE_START===========================================================
+ * ====================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ====================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================================
+ * ECOMP and OpenECOMP are trademarks and service marks of AT&T Intellectual Property.
+ */ \ No newline at end of file
diff --git a/ecomp-sdk/README.md b/ecomp-sdk/README.md
new file mode 100644
index 00000000..f3a52dcb
--- /dev/null
+++ b/ecomp-sdk/README.md
@@ -0,0 +1,15 @@
+ECOMP Portal SDK
+================
+
+This is the parent Maven project for the following
+ECOMP Portal SDK maven child projects:
+
+* SDK Framework library
+* SDK Core library
+* SDK Analytics library
+* SDK Workflow library
+
+This area also includes the ECOMP Portal SDK web application, which
+is a sample web app to build and deploy to a Tomcat instance.
+
+Release notes are published in each project.
diff --git a/ecomp-sdk/pom.xml b/ecomp-sdk/pom.xml
new file mode 100644
index 00000000..c327a7f0
--- /dev/null
+++ b/ecomp-sdk/pom.xml
@@ -0,0 +1,249 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>ecompSDK-project</artifactId>
+ <packaging>pom</packaging>
+ <!-- NOTE This value will not be picked from the property tag below, pass it as -Drelease.version="" when doing mvn deploy -->
+ <version>1.0.0</version>
+ <name>Ecomp Portal SDK Project (parent)</name>
+ <url>https://wiki/display/EcompPortal</url>
+ <scm>
+ <connection>scm:git:https://gitlab/scm/st_quantum/quantum.git</connection>
+ <developerConnection>scm:git:ssh://git@gitlab/st_quantum/quantum.git</developerConnection>
+ <tag>HEAD</tag>
+ </scm>
+
+ <modules>
+ <!-- ecompFW -->
+ <module>thirdparty</module>
+ <!-- ecompSDK-core -->
+ <module>quantum</module>
+ <module>sdk-analytics</module>
+ <module>sdk-workflow</module>
+ </modules>
+
+ <properties>
+ <encoding>UTF-8</encoding>
+ <sdk-internal.version>1610.3.10</sdk-internal.version>
+ <springframework.version>4.2.0.RELEASE</springframework.version>
+ <hibernate.version>4.3.11.Final</hibernate.version>
+ <!-- Tests usually require some setup that maven cannot do, so skip. -->
+ <skiptests>true</skiptests>
+ </properties>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.10.4</version>
+ <configuration>
+ <failOnError>false</failOnError>
+ <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
+ <docletArtifact>
+ <groupId>org.umlgraph</groupId>
+ <artifactId>umlgraph</artifactId>
+ <version>5.6</version>
+ </docletArtifact>
+ <additionalparam>-views</additionalparam>
+ <useStandardDocletOptions>true</useStandardDocletOptions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <repositories>
+ <repository>
+ <!-- Snapshots repository has ECOMP snapshot artifacts -->
+ <id>nexus-snapshots</id>
+ <name>Nexus Maven Central - Snapshots</name>
+ <url>https://ecomp-nexus:8443/repository/maven-snapshots/</url>
+ </repository>
+ <repository>
+ <!-- Releases repository has ECOMP release artifacts -->
+ <id>nexus</id>
+ <name>Nexus Maven Central - Releases</name>
+ <url>https://ecomp-nexus:8443/repository/maven-releases/</url>
+ </repository>
+ <repository>
+ <id>oss-sonatype</id>
+ <name>oss sonatype Central</name>
+ <url>https://oss.sonatype.org/service/local/repositories/releases/content/</url>
+ </repository>
+
+ </repositories>
+
+ <profiles>
+ <!-- disable doclint, a new feature in Java 8, when generating javadoc -->
+ <profile>
+ <id>doclint-java8-disable</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <additionalparam>-Xdoclint:none</additionalparam>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.blackducksoftware.integration</groupId>
+ <artifactId>hub-maven-plugin</artifactId>
+ <version>1.4.0</version>
+ <inherited>false</inherited>
+ <configuration>
+ <hubProjectName>${project.name}</hubProjectName>
+ <outputDirectory>${project.basedir}</outputDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>create-bdio-file</id>
+ <phase>package</phase>
+ <goals>
+ <goal>createHubOutput</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>sonar-maven-plugin</artifactId>
+ <version>3.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.6</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav-jackrabbit</artifactId>
+ <version>2.10</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <!-- Name the "master" branch -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-scm-plugin</artifactId>
+ <version>1.8.1</version>
+ <configuration>
+ <connectionType>developerConnection</connectionType>
+ <scmVersionType>branch</scmVersionType>
+ <scmVersion>feature/BRANCH_OS</scmVersion>
+ </configuration>
+ </plugin>
+
+ <!-- Compile to Java 1.8 class output format -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+
+ <!-- Link iteration name with jar version -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <archive-version>${project.version}</archive-version>
+ <internal-version>${sdk-internal.version}</internal-version>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <!-- Generate javadoc jar; see profile for Java 8 -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.10.3</version>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Generate source jar -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>3.0.0</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.5.3</version>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+ <distributionManagement>
+ <!-- Publish jars to the Nexus Repository - public group -->
+ <!-- The id below must match your .m2/settings.xml/servers/server/id -->
+ <repository>
+ <id>nexus</id>
+ <name>ecompsdk-repository-releases</name>
+ <url>https://ecomp-nexus:8443/repository/maven-releases</url>
+ </repository>
+
+ <snapshotRepository>
+ <id>nexus-snapshots</id>
+ <name>ecompsdk-repository-snapshots</name>
+ <url>https://ecomp-nexus:8443/repository/maven-snapshots</url>
+ </snapshotRepository>
+
+ <site>
+ <id>nexus</id>
+ <url>dav:https://ecomp-nexus:8443/repository/portalsdk-javadoc/${version}</url>
+ </site>
+ </distributionManagement>
+ <pluginRepositories>
+ <!-- Black Duck plugin dependencies -->
+ <pluginRepository>
+ <id>JCenter</id>
+ <name>JCenter Repository</name>
+ <url>http://jcenter.bintray.com</url>
+ </pluginRepository>
+
+ <pluginRepository>
+ <id>Restlet</id>
+ <name>Restlet Repository</name>
+ <url>http://maven.restlet.com</url>
+ </pluginRepository>
+ </pluginRepositories>
+</project>
diff --git a/ecomp-sdk/quantum/.gitignore b/ecomp-sdk/quantum/.gitignore
new file mode 100644
index 00000000..ea8c4bf7
--- /dev/null
+++ b/ecomp-sdk/quantum/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/ecomp-sdk/quantum/README.md b/ecomp-sdk/quantum/README.md
new file mode 100644
index 00000000..bf00b41d
--- /dev/null
+++ b/ecomp-sdk/quantum/README.md
@@ -0,0 +1,11 @@
+ECOMP Portal SDK Core
+=====================
+
+This is the Maven project for the ECOMP Portal SDK Core,
+which is distributed as ecompSDK-core-nnn.jar. This library
+requires Hibernate and Spring, and provides many features
+such as data access, session management, logging, on-boarding
+and more. Most of these features are used in the ECOMP SDK
+web application.
+
+
diff --git a/ecomp-sdk/quantum/pom.xml b/ecomp-sdk/quantum/pom.xml
new file mode 100644
index 00000000..2ae9388e
--- /dev/null
+++ b/ecomp-sdk/quantum/pom.xml
@@ -0,0 +1,330 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>ecompSDK-project</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <artifactId>ecompSDK-core</artifactId>
+ <packaging>jar</packaging>
+ <name>Ecomp Portal SDK Core (quantum)</name>
+
+ <!-- properties are inherited from parent -->
+ <properties>
+ <drools.version>6.4.0.Final</drools.version>
+ </properties>
+
+ <!-- repositories are inherited from parent -->
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.19.1</version>
+ <configuration>
+ <skipTests>${skiptests}</skipTests>
+ <includes>
+ <include>**/Test*.java</include>
+ <include>**/*Test.java</include>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <systemPropertyVariables>
+ <container.classpath>classpath:</container.classpath>
+ </systemPropertyVariables>
+ </configuration>
+
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <!-- AT&T internal -->
+ <dependency>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>ecompFW</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>apache-log4j-extras</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+
+
+ <!-- Drools -->
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-compiler</artifactId>
+ <version>${drools.version}</version>
+ </dependency>
+
+ <!-- Spring -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${springframework.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-orm</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ <version>1.3.0.RELEASE</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>log4j-over-slf4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <version>1.8.9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjweaver</artifactId>
+ <version>1.8.9</version>
+ </dependency>
+
+
+ <!-- Hibernate -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>${hibernate.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>5.1.3.Final</version>
+ </dependency>
+ <!-- Servlet+JSP+JSTL -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>javax.servlet.jsp-api</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <!-- bridge to implement commons-logging using slf4j -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>1.7.12</version>
+ </dependency>
+ <!-- bridge to implement log4j using slf4j -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>log4j-over-slf4j</artifactId>
+ <version>1.7.12</version>
+ </dependency>
+ <dependency>
+ <groupId>com.mchange</groupId>
+ <artifactId>c3p0</artifactId>
+ <version>0.9.5.2</version>
+ </dependency>
+ <!-- Apache Tiles -->
+ <dependency>
+ <groupId>org.apache.tiles</groupId>
+ <artifactId>tiles-core</artifactId>
+ <version>3.0.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tiles</groupId>
+ <artifactId>tiles-jsp</artifactId>
+ <version>3.0.5</version>
+ </dependency>
+ <!-- Yaml -->
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>1.15</version>
+ </dependency>
+ <!-- Mapper -->
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.22</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.jcs</groupId>
+ <artifactId>jcs</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ <!-- -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-websocket</artifactId>
+ <version>8.0.28</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ <version>1.3.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ </dependency>
+
+ <!-- Raptor required Libraries -->
+ <!-- for static charts -->
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.10</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ </dependency>
+
+ <!-- Quartz -->
+ <dependency>
+ <groupId>org.quartz-scheduler</groupId>
+ <artifactId>quartz</artifactId>
+ <version>2.2.1</version>
+ <exclusions>
+ <!-- exclude 0.9.1.1 to avoid dupe of com.mchange:c3p0:0.9.2.1 -->
+ <exclusion>
+ <groupId>c3p0</groupId>
+ <artifactId>c3p0</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- Elastic Search -->
+ <dependency>
+ <groupId>org.elasticsearch</groupId>
+ <artifactId>elasticsearch</artifactId>
+ <version>2.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>io.searchbox</groupId>
+ <artifactId>jest</artifactId>
+ <version>2.0.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ <version>0.0.1</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/FusionObject.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/FusionObject.java
new file mode 100644
index 00000000..00866388
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/FusionObject.java
@@ -0,0 +1,113 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core;
+
+/**
+ * <p>
+ * Title: FusionObject
+ * </p>
+ *
+ * <p>
+ * Description: This interface is implemented by all top-level support classes
+ * of each package in FUSION. This allows all top-level support classes to have
+ * some commonality for easier maintenance.
+ * </p>
+ *
+ * <p>
+ * Copyright: Copyright (c) 2007
+ * </p>
+ *
+ *
+ * @version 1.1
+ */
+public interface FusionObject {
+
+ public class Parameters {
+ // HashMap parameters passed to the Service and Dao tiers
+ public static final String PARAM_USERID = "userId";
+ public static final String PARAM_HTTP_REQUEST = "request";
+ public static final String PARAM_FILTERS = "filters";
+ public static final String PARAM_CLIENT_DEVICE = "client_device";
+ // Request parameters passed in the Web tier
+ public static final String REQUEST_PARAM_DISPLAY_SUCCESS_MESSAGE = "display_success_message";
+ }
+
+ /**
+ * <p>
+ * Title: FusionObject.Utilities
+ * </p>
+ *
+ * <p>
+ * Description: Inner class that has some utility functions available for
+ * any class that implements it.
+ * </p>
+ *
+ * <p>
+ * Copyright: Copyright (c) 2007
+ * </p>
+ *
+ *
+ * @version 1.1
+ */
+ public class Utilities {
+ /**
+ * nvl - replaces a string value with an empty string if null.
+ *
+ * @param s
+ * String - the string value that needs to be checked
+ * @return String - returns the original string value if not null.
+ * Otherwise an empty string ("") is returned.
+ */
+ public static String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ /**
+ * nvl - replaces a string value with a default value if null.
+ *
+ * @param s
+ * String - the string value that needs to be checked
+ * @param sDefault
+ * String - the default value
+ * @return String - returns the original string value if not null.
+ * Otherwise the default value is returned.
+ */
+ public static String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ /**
+ * Tests the specified string for nullity.
+ *
+ * @param a
+ * String to test for nullity.
+ * @return True if the specified string is null, empty or the 4-character
+ * sequence "null" (ignoring case); otherwise false.
+ */
+ public static boolean isNull(String a) {
+ if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null"))
+ return true;
+ else
+ return false;
+ }
+
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/LoginBean.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/LoginBean.java
new file mode 100644
index 00000000..e5a58e82
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/LoginBean.java
@@ -0,0 +1,196 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.command;
+
+import java.util.Set;
+
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.domain.support.FusionCommand;
+
+public class LoginBean extends FusionCommand {
+
+ private String loginId;
+ private String loginPwd;
+ private String hrid;
+ private String userid;
+ private String siteAccess;
+ private String loginErrorMessage;
+
+ private User user;
+ @SuppressWarnings("rawtypes")
+ private Set menu;
+ @SuppressWarnings("rawtypes")
+ private Set businessDirectMenu;
+
+ /**
+ * getLoginId
+ *
+ * @return String
+ */
+ public String getLoginId() {
+ return loginId;
+ }
+
+ /**
+ * getLoginPwd
+ *
+ * @return String
+ */
+ public String getLoginPwd() {
+ return loginPwd;
+ }
+
+ /**
+ * getMenu
+ *
+ * @return Set
+ */
+ @SuppressWarnings("rawtypes")
+ public Set getMenu() {
+ return menu;
+ }
+
+ /**
+ * getUser
+ *
+ * @return User
+ */
+ public User getUser() {
+ return user;
+ }
+
+ /**
+ * getHrid
+ *
+ * @return String
+ */
+ public String getHrid() {
+ return hrid;
+ }
+
+ /**
+ * getSiteAccess
+ *
+ * @return String
+ */
+ public String getSiteAccess() {
+ return siteAccess;
+ }
+
+ /**
+ * getBusinessDirectMenu
+ *
+ * @return Set
+ */
+ @SuppressWarnings("rawtypes")
+ public Set getBusinessDirectMenu() {
+ return businessDirectMenu;
+ }
+
+ /**
+ * getLoginErrorMessage
+ *
+ * @return String
+ */
+ public String getLoginErrorMessage() {
+ return loginErrorMessage;
+ }
+
+
+
+ /**
+ * setLoginId
+ *
+ * @param loginId String
+ */
+ public void setLoginId(String loginId) {
+ this.loginId = loginId;
+ }
+
+ /**
+ * setLoginPwd
+ *
+ * @param loginPwd String
+ */
+ public void setLoginPwd(String loginPwd) {
+ this.loginPwd = loginPwd;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void setMenu(Set menu) {
+ this.menu = menu;
+ }
+
+ /**
+ * setUser
+ *
+ * @param user User
+ */
+ public void setUser(User user) {
+ this.user = user;
+ }
+
+ /**
+ * setHrid
+ *
+ * @param hrid String
+ */
+ public void setHrid(String hrid) {
+ this.hrid = hrid;
+ }
+
+ /**
+ * setSiteAccess
+ *
+ * @param siteAccess String
+ */
+ public void setSiteAccess(String siteAccess) {
+ this.siteAccess = siteAccess;
+ }
+
+ /**
+ * setBusinessDirectMenu
+ *
+ * @param businessDirectMenu Set
+ */
+ @SuppressWarnings("rawtypes")
+ public void setBusinessDirectMenu(Set businessDirectMenu) {
+ this.businessDirectMenu = businessDirectMenu;
+ }
+
+ /**
+ * setLoginErrorMessage
+ *
+ * @param loginErrorMessage String
+ */
+ public void setLoginErrorMessage(String loginErrorMessage) {
+ this.loginErrorMessage = loginErrorMessage;
+ }
+
+ public String getUserid() {
+ return userid;
+ }
+
+ public void setUserid(String userid) {
+ this.userid = userid;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostDroolsBean.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostDroolsBean.java
new file mode 100644
index 00000000..541d9f71
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostDroolsBean.java
@@ -0,0 +1,51 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.command;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+@JsonSerialize
+public class PostDroolsBean {
+
+ private String droolsFile;
+ private String className;
+ private String selectedRules;
+
+ public String getDroolsFile() {
+ return droolsFile;
+ }
+ public void setDroolsFile(String droolsFile) {
+ this.droolsFile = droolsFile;
+ }
+ public String getSelectedRules() {
+ return selectedRules;
+ }
+ public void setSelectedRules(String selectedRules) {
+ this.selectedRules = selectedRules;
+ }
+ public String getClassName() {
+ return className;
+ }
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostSearchBean.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostSearchBean.java
new file mode 100644
index 00000000..b07b8fed
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostSearchBean.java
@@ -0,0 +1,374 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.command;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.core.command.support.SearchBase;
+import org.openecomp.portalsdk.core.domain.User;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+@JsonSerialize
+public class PostSearchBean extends SearchBase {
+
+ private User user = null;
+ private User userOrig = null;
+ private String[] selected;
+ private String[] postHrid;
+ private String[] postOrgUserId;
+ private String[] postFirstName;
+ private String[] postLastName;
+ private String[] postOrgCode;
+ private String[] postPhone;
+ private String[] postEmail;
+ private String[] postAddress1;
+ private String[] postAddress2;
+ private String[] postCity;
+ private String[] postState;
+ private String[] postZipCode;
+ private String[] postLocationClli;
+ private String[] postBusinessCountryCode;
+ private String[] postBusinessCountryName;
+ private String[] postDepartment;
+ private String[] postDepartmentName;
+ private String[] postBusinessUnit;
+ private String[] postBusinessUnitName;
+ private String[] postJobTitle;
+ private String[] postOrgManagerUserId;
+ private String[] postCommandChain;
+ private String[] postCompanyCode;
+ private String[] postCompany;
+ private String[] postCostCenter;
+ private String[] postSiloStatus;
+ private String[] postFinancialLocCode;
+
+
+ public PostSearchBean() {
+ this(null);
+ } // PostSearchBean
+
+ @SuppressWarnings("rawtypes")
+ public PostSearchBean(List items) {
+ super(items);
+
+ user = new User();
+ userOrig = new User();
+
+ setSortBy1("");
+ setSortBy1Orig("");
+
+ //setSortByList(...);
+ } // PostSearchBean
+
+
+ public String getFirstName() { return user.getFirstName(); }
+ public String getLastName() { return user.getLastName(); }
+ public String getHrid() { return user.getHrid(); }
+ public String getOrgUserId() { return user.getOrgUserId(); }
+ public String getOrgCode() { return user.getOrgCode(); }
+ public String getEmail() { return user.getEmail(); }
+ public String getOrgManagerUserId() { return user.getOrgManagerUserId(); }
+
+ public String getFirstNameOrig() { return user.getFirstName(); }
+ public String getLastNameOrig() { return user.getLastName(); }
+ public String getHridOrig() { return user.getHrid(); }
+ public String getOrgUserIdOrig() { return user.getOrgUserId(); }
+ public String getOrgCodeOrig() { return user.getOrgCode(); }
+ public String getEmailOrig() { return user.getEmail(); }
+ public String getOrgManagerUserIdOrig() { return user.getOrgManagerUserId(); }
+
+
+ public User getUser() { return user; }
+
+ public String[] getPostEmail() {
+ return postEmail;
+ }
+
+ public String[] getPostFirstName() {
+ return postFirstName;
+ }
+
+ public String[] getPostHrid() {
+ return postHrid;
+ }
+
+ public String[] getPostLastName() {
+ return postLastName;
+ }
+
+ public String[] getPostOrgCode() {
+ return postOrgCode;
+ }
+
+ public String[] getPostPhone() {
+ return postPhone;
+ }
+
+ public String[] getPostOrgUserId() {
+ return postOrgUserId;
+ }
+
+ public String[] getSelected() {
+ return selected;
+ }
+
+ public String[] getPostAddress1() {
+ return postAddress1;
+ }
+
+ public String[] getPostBusinessCountryCode() {
+ return postBusinessCountryCode;
+ }
+
+ public String[] getPostCity() {
+ return postCity;
+ }
+
+ public String[] getPostCommandChain() {
+ return postCommandChain;
+ }
+
+ public String[] getPostCompany() {
+ return postCompany;
+ }
+
+ public String[] getPostCompanyCode() {
+ return postCompanyCode;
+ }
+
+ public String[] getPostDepartment() {
+ return postDepartment;
+ }
+
+ public String[] getPostDepartmentName() {
+ return postDepartmentName;
+ }
+
+ public String[] getPostBusinessCountryName() {
+ return postBusinessCountryName;
+ }
+
+ public String[] getPostJobTitle() {
+ return postJobTitle;
+ }
+
+ public String[] getPostLocationClli() {
+ return postLocationClli;
+ }
+
+ public String[] getPostOrgManagerUserId() {
+ return postOrgManagerUserId;
+ }
+
+ public String[] getPostState() {
+ return postState;
+ }
+
+ public String[] getPostZipCode() {
+ return postZipCode;
+ }
+
+ public void setFirstName(String value) { user.setFirstName(value); }
+ public void setLastName(String value) { user.setLastName(value); }
+ public void setHrid(String value) { user.setHrid(value); }
+ public void setOrgUserId(String value) { user.setOrgUserId(value); }
+ public void setOrgCode(String value) { user.setOrgCode(value); }
+ public void setEmail(String value) { user.setEmail(value); }
+ public void setOrgManagerUserId(String value) { user.setOrgManagerUserId(value); }
+
+ public void setFirstNameOrig(String value) { userOrig.setFirstName(value); }
+ public void setLastNameOrig(String value) { userOrig.setLastName(value); }
+ public void setHridOrig(String value) { userOrig.setHrid(value); }
+ public void setOrgUserIdOrig(String value) { userOrig.setOrgUserId(value); }
+ public void setOrgCodeOrig(String value) { userOrig.setOrgCode(value); }
+ public void setEmailOrig(String value) { userOrig.setEmail(value); }
+ public void setOrgManagerUserIdOrig(String value) { userOrig.setOrgManagerUserId(value); }
+
+ public void setUser(User value) { this.user = value; }
+
+ public void setPostEmail(String[] postEmail) {
+ this.postEmail = postEmail;
+ }
+
+ public void setPostFirstName(String[] postFirstName) {
+ this.postFirstName = postFirstName;
+ }
+
+ public void setPostHrid(String[] postHrid) {
+ this.postHrid = postHrid;
+ }
+
+ public void setPostLastName(String[] postLastName) {
+ this.postLastName = postLastName;
+ }
+
+ public void setPostOrgCode(String[] postOrgCode) {
+ this.postOrgCode = postOrgCode;
+ }
+
+ public void setPostPhone(String[] postPhone) {
+ this.postPhone = postPhone;
+ }
+
+ public void setPostOrgUserId(String[] postOrgUserId) {
+ this.postOrgUserId = postOrgUserId;
+ }
+
+ public void setSelected(String[] selected) {
+ this.selected = selected;
+ }
+
+ public void setPostAddress1(String[] postAddress1) {
+ this.postAddress1 = postAddress1;
+ }
+
+ public void setPostBusinessCountryCode(String[] postBusinessCountryCode) {
+ this.postBusinessCountryCode = postBusinessCountryCode;
+ }
+
+ public void setPostCity(String[] postCity) {
+ this.postCity = postCity;
+ }
+
+ public void setPostCommandChain(String[] postCommandChain) {
+ this.postCommandChain = postCommandChain;
+ }
+
+ public void setPostCompany(String[] postCompany) {
+ this.postCompany = postCompany;
+ }
+
+ public void setPostCompanyCode(String[] postCompanyCode) {
+ this.postCompanyCode = postCompanyCode;
+ }
+
+ public void setPostDepartment(String[] postDepartment) {
+ this.postDepartment = postDepartment;
+ }
+
+ public void setPostDepartmentName(String[] postDepartmentName) {
+ this.postDepartmentName = postDepartmentName;
+ }
+
+ public void setPostBusinessCountryName(String[] postBusinessCountryName) {
+ this.postBusinessCountryName = postBusinessCountryName;
+ }
+
+ public void setPostJobTitle(String[] postJobTitle) {
+ this.postJobTitle = postJobTitle;
+ }
+
+ public void setPostLocationClli(String[] postLocationClli) {
+ this.postLocationClli = postLocationClli;
+ }
+
+ public void setPostOrgManagerUserId(String[] postOrgManagerUserId) {
+ this.postOrgManagerUserId = postOrgManagerUserId;
+ }
+
+ public void setPostState(String[] postState) {
+ this.postState = postState;
+ }
+
+ public void setPostZipCode(String[] postZipCode) {
+ this.postZipCode = postZipCode;
+ }
+
+ public String[] getPostAddress2() {
+ return postAddress2;
+ }
+
+ public void setPostAddress2(String[] postAddress2) {
+ this.postAddress2 = postAddress2;
+ }
+
+ public User getUserOrig() {
+ return userOrig;
+ }
+
+ public void setUserOrig(User userOrig) {
+ this.userOrig = userOrig;
+ }
+
+ public String[] getPostBusinessUnit() {
+ return postBusinessUnit;
+ }
+
+ public void setPostBusinessUnit(String[] postBusinessUnit) {
+ this.postBusinessUnit = postBusinessUnit;
+ }
+
+ public String[] getPostBusinessUnitName() {
+ return postBusinessUnitName;
+ }
+
+ public void setPostBusinessUnitName(String[] postBusinessUnitName) {
+ this.postBusinessUnitName = postBusinessUnitName;
+ }
+
+ public String[] getPostCostCenter() {
+ return postCostCenter;
+ }
+
+ public void setPostCostCenter(String[] postCostCenter) {
+ this.postCostCenter = postCostCenter;
+ }
+
+ public String[] getPostSiloStatus() {
+ return postSiloStatus;
+ }
+
+ public void setPostSiloStatus(String[] postSiloStatus) {
+ this.postSiloStatus = postSiloStatus;
+ }
+
+ public String[] getPostFinancialLocCode() {
+ return postFinancialLocCode;
+ }
+
+ public void setPostFinancialLocCode(String[] postFinancialLocCode) {
+ this.postFinancialLocCode = postFinancialLocCode;
+ }
+
+ public void resetSearch() {
+ super.resetSearch();
+ setUser(new User());
+ } // resetSearch
+
+
+ public boolean isCriteriaUpdated() {
+ if(user==null&&userOrig==null)
+ return false;
+ else if(user==null||userOrig==null)
+ return true;
+ else
+ return (! (
+ Utilities.nvl(user.getFirstName()).equals(Utilities.nvl(userOrig.getFirstName()))&&
+ Utilities.nvl(user.getLastName()).equals(Utilities.nvl(userOrig.getLastName()))&&
+ //Utilities.nvl(user.getHrid()).equals(Utilities.nvl(userOrig.getHrid()))&&
+ Utilities.nvl(user.getOrgUserId()).equals(Utilities.nvl(userOrig.getOrgUserId()))&&
+ Utilities.nvl(user.getOrgCode()).equals(Utilities.nvl(userOrig.getOrgCode()))&&
+ Utilities.nvl(user.getEmail()).equals(Utilities.nvl(userOrig.getEmail()))&&
+ Utilities.nvl(user.getOrgManagerUserId()).equals(Utilities.nvl(userOrig.getOrgManagerUserId()))&&
+ true));
+ } // isCriteriaUpdated
+
+} // PostSearchBean
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/UserRowBean.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/UserRowBean.java
new file mode 100644
index 00000000..7230add8
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/UserRowBean.java
@@ -0,0 +1,85 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.command;
+
+import org.openecomp.portalsdk.core.domain.User;
+
+public class UserRowBean extends User {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2724597119083972190L;
+ private String sessionId;
+ private String lastAccess;
+ private String remaining;
+ private String loginTime;
+ private String LastLoginTime;
+
+
+ public String getLastAccess(){
+ return this.lastAccess;
+ }
+
+
+ public void setLastAccess(String lastAccess){
+ this.lastAccess = lastAccess;
+ }
+
+
+ public String getRemaining(){
+ return this.remaining;
+ }
+
+
+ public void setRemaining(String remaining){
+ this.remaining = remaining;
+ }
+
+
+ public String getSessionId() {
+ return sessionId;
+ }
+
+
+ public void setSessionId(String sessionId) {
+ this.sessionId = sessionId;
+ }
+
+
+ public String getLoginTime() {
+ return loginTime;
+ }
+
+
+ public void setLoginTime(String loginTime) {
+ this.loginTime = loginTime;
+ }
+
+
+ public String getLastLoginTime() {
+ return LastLoginTime;
+ }
+
+
+ public void setLastLoginTime(String lastLoginTime) {
+ LastLoginTime = lastLoginTime;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchBase.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchBase.java
new file mode 100644
index 00000000..6fb60aa7
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchBase.java
@@ -0,0 +1,268 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.command.support;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.core.domain.support.FusionCommand;
+
+public abstract class SearchBase extends FusionCommand {
+
+ public static String SORT_BY_MODIFIER_DESC = "D";
+ public static String SORT_BY_MODIFIER_ASC = "A";
+ public static String SORT_BY_MODIFIER_DESC_IMAGE_NAME = "sort_desc.gif";
+ public static String SORT_BY_MODIFIER_ASC_IMAGE_NAME = "sort_asc.gif";
+
+
+ private String sortBy1 = null;
+ private String sortBy2 = null;
+ private String sortBy3 = null;
+
+ private String sortBy1Orig = null;
+ private String sortBy2Orig = null;
+ private String sortBy3Orig = null;
+
+ private String sortByModifier1 = null;
+ private String sortByModifier2 = null;
+ private String sortByModifier3 = null;
+
+ private String sortByModifier1Orig = null;
+ private String sortByModifier2Orig = null;
+ private String sortByModifier3Orig = null;
+
+ private String accessType = "WRITE"; //null;
+
+ private String submitAction = "";
+ private String masterId = "";
+ private String detailId = "";
+
+ private String showResult = "Y";
+
+ private SearchResult searchResult = null;
+
+ @SuppressWarnings("rawtypes")
+ public SearchBase(List items) {
+ searchResult = (items == null) ? (new SearchResult()) : (new SearchResult(items));
+ } // SearchBase
+
+
+ public String getSortBy1() {
+ return sortBy1;
+ }
+
+ public String getSortBy2() {
+ return sortBy2;
+ }
+
+ public String getSortBy3() {
+ return sortBy3;
+ }
+
+ public String getSortBy1Orig() {
+ return sortBy1;
+ }
+
+ public String getSortBy2Orig() {
+ return sortBy2;
+ }
+
+ public String getSortBy3Orig() {
+ return sortBy3;
+ }
+
+ public String getAccessType() {
+ return accessType;
+ }
+
+ public String getSubmitAction() {
+ return submitAction;
+ }
+
+ public String getMasterId() {
+ return masterId;
+ }
+
+ public String getDetailId() {
+ return detailId;
+ }
+
+ public String getShowResult() {
+ return showResult;
+ }
+
+ //public ArrayList getSortByList() { return sortByList; }
+
+ public SearchResult getSearchResult() {
+ return searchResult;
+ }
+
+ public String getSortByModifier1() {
+ return sortByModifier1;
+ }
+
+ public String getSortByModifier1Orig() {
+ return sortByModifier1;
+ }
+
+ public String getSortByModifier2() {
+ return sortByModifier2;
+ }
+
+ public String getSortByModifier2Orig() {
+ return sortByModifier2;
+ }
+
+ public String getSortByModifier3() {
+ return sortByModifier3;
+ }
+
+ public String getSortByModifier3Orig() {
+ return sortByModifier3;
+ }
+
+ public int getPageNo() {
+ return (isCriteriaUpdated() || isSortingUpdated()) ? 0 : getSearchResult().getPageNo();
+ }
+
+ public int getPageSize() {
+ return getSearchResult().getPageSize();
+ }
+
+ public int getDataSize() {
+ return getSearchResult().getDataSize();
+ }
+
+ public int getNewDataSize() {
+ return isCriteriaUpdated() ? -1 : getDataSize();
+ }
+
+
+ public void setSortBy1(String sortBy1) {
+ this.sortBy1 = sortBy1;
+ }
+
+ public void setSortBy2(String sortBy2) {
+ this.sortBy2 = sortBy2;
+ }
+
+ public void setSortBy3(String sortBy3) {
+ this.sortBy3 = sortBy3;
+ }
+
+ public void setSortBy1Orig(String sortBy1Orig) {
+ this.sortBy1Orig = sortBy1Orig;
+ }
+
+ public void setSortBy2Orig(String sortBy2Orig) {
+ this.sortBy2Orig = sortBy2Orig;
+ }
+
+ public void setSortBy3Orig(String sortBy3Orig) {
+ this.sortBy3Orig = sortBy3Orig;
+ }
+
+ public void setAccessType(String accessType) {
+ this.accessType = accessType;
+ }
+
+ public void setSubmitAction(String submitAction) {
+ this.submitAction = submitAction;
+ }
+
+ public void setMasterId(String masterId) {
+ this.masterId = masterId;
+ }
+
+ public void setDetailId(String detailId) {
+ this.detailId = detailId;
+ }
+
+ public void setShowResult(String showResult) {
+ this.showResult = showResult;
+ }
+
+ public void setSearchResult(SearchResult searchResult) {
+ this.searchResult = searchResult;
+ }
+
+ public void setSortByModifier1(String sortByModifier1) {
+ this.sortByModifier1 = sortByModifier1;
+ }
+
+ public void setSortByModifier1Orig(String sortByModifier1Orig) {
+ this.sortByModifier1Orig = sortByModifier1Orig;
+ }
+
+ public void setSortByModifier2(String sortByModifier2) {
+ this.sortByModifier2 = sortByModifier2;
+ }
+
+ public void setSortByModifier2Orig(String sortByModifier2Orig) {
+ this.sortByModifier2Orig = sortByModifier2Orig;
+ }
+
+ public void setSortByModifier3(String sortByModifier3) {
+ this.sortByModifier3 = sortByModifier3;
+ }
+
+ public void setSortByModifier3Orig(String sortByModifier3Orig) {
+ this.sortByModifier3Orig = sortByModifier3Orig;
+ }
+
+ public void setSortingUpdated(boolean sortingUpdated) {
+ }
+
+ public void setPageNo(int pageNo) {
+ getSearchResult().setPageNo(pageNo);
+ }
+
+ public void setPageSize(int pageSize) {
+ getSearchResult().setPageSize(pageSize);
+ }
+
+ public void setDataSize(int dataSize) {
+ getSearchResult().setDataSize(dataSize);
+ }
+
+
+ public void resetSearch() {
+ setSortBy1(null);
+ setSortBy2(null);
+ setSortBy3(null);
+ setSortByModifier1(SearchBase.SORT_BY_MODIFIER_ASC);
+ setSortByModifier2(SearchBase.SORT_BY_MODIFIER_ASC);
+ setSortByModifier3(SearchBase.SORT_BY_MODIFIER_ASC);
+ setPageNo(0);
+ setDataSize( -1);
+ } // resetSearch
+
+
+ public abstract boolean isCriteriaUpdated();
+
+ public boolean isSortingUpdated() {
+ return (!(Utilities.nvl(sortBy1).equals(Utilities.nvl(sortBy1Orig)) &&
+ Utilities.nvl(sortBy2).equals(Utilities.nvl(sortBy2Orig)) &&
+ Utilities.nvl(sortBy3).equals(Utilities.nvl(sortBy3Orig)) &&
+ Utilities.nvl(sortByModifier1).equals(Utilities.nvl(sortByModifier1Orig)) &&
+ Utilities.nvl(sortByModifier2).equals(Utilities.nvl(sortByModifier2Orig)) &&
+ Utilities.nvl(sortByModifier3).equals(Utilities.nvl(sortByModifier3Orig))));
+ } // isSortingUpdated
+
+} // SearchBase
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchResult.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchResult.java
new file mode 100644
index 00000000..4a2c05f1
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchResult.java
@@ -0,0 +1,58 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.command.support;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@SuppressWarnings("rawtypes")
+public class SearchResult extends ArrayList implements java.io.Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -451947878984459011L;
+ private int pageNo = 0;
+ private int pageSize = 50;
+ private int dataSize = -1;
+
+ private String accessType = null;
+
+ public SearchResult() {}
+
+ @SuppressWarnings("unchecked")
+ public SearchResult(List items) {
+ super(items);
+ }
+
+ public int getPageNo() { return pageNo; }
+ public int getPageSize() { return pageSize; }
+ public int getDataSize() { return dataSize; }
+
+ public int getSize() { return size(); } // for Struts bean property access
+
+ public String getAccessType() { return accessType; }
+
+ public void setPageNo(int pageNo) { this.pageNo=pageNo; }
+ public void setPageSize(int pageSize) { this.dataSize=pageSize; }
+ public void setDataSize(int dataSize) { this.dataSize=dataSize; }
+
+ public void setAccessType(String accessType) { this.accessType = accessType; }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppConfig.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppConfig.java
new file mode 100644
index 00000000..3a4753e3
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppConfig.java
@@ -0,0 +1,301 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.conf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.sql.DataSource;
+
+import org.openecomp.portalsdk.core.interceptor.ResourceInterceptor;
+import org.openecomp.portalsdk.core.interceptor.SessionTimeoutInterceptor;
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.format.AppMessagesEnum;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.menu.MenuBuilder;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.service.DataAccessServiceImpl;
+import org.openecomp.portalsdk.core.util.CipherUtil;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.AppUtils;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.servlet.ViewResolver;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.view.InternalResourceViewResolver;
+import org.springframework.web.servlet.view.JstlView;
+import org.springframework.web.servlet.view.UrlBasedViewResolver;
+import org.springframework.web.servlet.view.tiles3.TilesConfigurer;
+import org.springframework.web.servlet.view.tiles3.TilesView;
+
+import com.mchange.v2.c3p0.ComboPooledDataSource;
+
+/**
+ * Configures Spring features in the ECOMP Portal SDK including request
+ * interceptors and view resolvers. Application should subclass and override
+ * methods as needed.
+ */
+public class AppConfig extends WebMvcConfigurerAdapter implements Configurable, ApplicationContextAware {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppConfig.class);
+
+ private final List<String> tileDefinitions = new ArrayList<String>();
+ protected ApplicationContext appApplicationContext = null;
+
+ public AppConfig() {
+ //loads all default fields and marks logging
+ //has been started for each log file type.
+ initGlobalLocalContext();
+ }
+
+ /**
+ * Creates and returns a new instance of a secondary (order=2)
+ * {@link ViewResolver} that finds files by adding prefix "/WEB-INF/jsp/"
+ * and suffix ".jsp" to the base view name.
+ *
+ * @return New instance of {@link ViewResolver}.
+ */
+ @Bean
+ public ViewResolver viewResolver() {
+ InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
+ viewResolver.setViewClass(JstlView.class);
+ viewResolver.setPrefix("/WEB-INF/jsp/");
+ viewResolver.setSuffix(".jsp");
+ viewResolver.setOrder(2);
+ return viewResolver;
+ }
+
+ /**
+ * Loads all the default logging fields into the
+ * global MDC context and marks each log file type
+ * that logging has been started.
+ */
+ private void initGlobalLocalContext() {
+ logger.init();
+ }
+
+ /*
+ * Any requests from the url pattern /static/**, Spring will look for the
+ * resources from the /static/ Same as <mvc:resources mapping="/static/**"
+ * location="/static/"/> in xml
+ */
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ // registry.addResourceHandler("/static/**").addResourceLocations("/static/");
+ registry.addResourceHandler("/**").addResourceLocations("/");
+ }
+
+ /**
+ * Creates and returns a new instance of a {@link DataAccessService} class.
+ *
+ * @return New instance of {@link DataAccessService}.
+ */
+ @Bean
+ public DataAccessService dataAccessService() {
+ return new DataAccessServiceImpl();
+ }
+
+ /**
+ * Creates and returns a new instance of a {@link SystemProperties} class.
+ *
+ * @return New instance of {@link SystemProperties}.
+ */
+ @Bean
+ public SystemProperties systemProperties() {
+ return new SystemProperties();
+ }
+
+ /**
+ * Creates and returns a new instance of a {@link MenuBuilder} class.
+ *
+ * @return New instance of {@link MenuBuilder}.
+ */
+ @Bean
+ public MenuBuilder menuBuilder() {
+ return new MenuBuilder();
+ }
+
+ /**
+ * Creates and returns a new instance of a {@link UserUtils} class.
+ *
+ * @return New instance of {@link UserUtils}.
+ */
+ @Bean
+ public UserUtils userUtil() {
+ return new UserUtils();
+ }
+
+ /**
+ * Creates and returns a new instance of an {@link AppUtils} class.
+ *
+ * @return New instance of {@link AppUtils}.
+ */
+ @Bean
+ public AppUtils appUtils() {
+ return new AppUtils();
+ }
+
+ /**
+ * Creates and returns a new instance of a {@link TilesConfigurer} class.
+ *
+ * @return New instance of {@link TilesConfigurer}.
+ */
+ @Bean
+ public TilesConfigurer tilesConfigurer() {
+ TilesConfigurer tilesConfigurer = new TilesConfigurer();
+ tilesConfigurer.setDefinitions(tileDefinitions());
+ tilesConfigurer.setCheckRefresh(true);
+ return tilesConfigurer;
+ }
+
+ /**
+ *
+ * Application Data Source
+ *
+ * @return DataSource Object
+ */
+
+ @Bean
+ public DataSource dataSource() throws Exception {
+ systemProperties();
+ ComboPooledDataSource dataSource = new ComboPooledDataSource();
+ try {
+ dataSource.setDriverClass(SystemProperties.getProperty(SystemProperties.DB_DRIVER));
+ dataSource.setJdbcUrl(SystemProperties.getProperty(SystemProperties.DB_CONNECTIONURL));
+ dataSource.setUser(SystemProperties.getProperty(SystemProperties.DB_USERNAME));
+ // dataSource.setPassword(SystemProperties.getProperty(SystemProperties.DB_PASSWOR));
+ String password = SystemProperties.getProperty(SystemProperties.DB_PASSWOR);
+ if (SystemProperties.containsProperty(SystemProperties.DB_ENCRYPT_FLAG)) {
+ String encryptFlag = SystemProperties.getProperty(SystemProperties.DB_ENCRYPT_FLAG);
+ if (encryptFlag != null && encryptFlag.equalsIgnoreCase("true")) {
+ password = CipherUtil.decrypt(password);
+ }
+ }
+ dataSource.setPassword(password);
+ dataSource
+ .setMinPoolSize(Integer.parseInt(SystemProperties.getProperty(SystemProperties.DB_MIN_POOL_SIZE)));
+ dataSource
+ .setMaxPoolSize(Integer.parseInt(SystemProperties.getProperty(SystemProperties.DB_MAX_POOL_SIZE)));
+ dataSource.setIdleConnectionTestPeriod(
+ Integer.parseInt(SystemProperties.getProperty(SystemProperties.IDLE_CONNECTION_TEST_PERIOD)));
+ dataSource.setTestConnectionOnCheckout(true);
+ dataSource.setPreferredTestQuery("SELECT 1");
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Error initializing database, verify database settings in properties file: "
+ + UserUtils.getStackTrace(e),AlarmSeverityEnum.CRITICAL);
+ logger.error(EELFLoggerDelegate.debugLogger, "Error initializing database, verify database settings in properties file: "
+ + UserUtils.getStackTrace(e),AlarmSeverityEnum.CRITICAL);
+ // Raise an alarm that opening a connection to the database is
+ // failed.
+ logger.logEcompError(AppMessagesEnum.BeDaoSystemError);
+ throw e;
+ }
+ return dataSource;
+ }
+
+ /*
+ * TODO: Check whether it is appropriate to extend the list of tile
+ * definitions at every invocation.
+ */
+ protected String[] tileDefinitions() {
+ tileDefinitions.add("/WEB-INF/fusion/defs/definitions.xml");
+ tileDefinitions.addAll(addTileDefinitions());
+
+ return tileDefinitions.toArray(new String[0]);
+ }
+
+ /**
+ * Creates and returns a new empty list. This method should be overridden by
+ * child classes.
+ *
+ * @return An empty list.
+ */
+ public List<String> addTileDefinitions() {
+ return new ArrayList<String>();
+ }
+
+ /**
+ * Creates and returns a new instance of a primary (order=1)
+ * {@link UrlBasedViewResolver} that finds files using the contents of
+ * definitions.xml files.
+ *
+ * @return New instance of {@link UrlBasedViewResolver}
+ */
+ @Bean
+ public UrlBasedViewResolver tileViewResolver() {
+ UrlBasedViewResolver viewResolver = new UrlBasedViewResolver();
+ viewResolver.setViewClass(TilesView.class);
+ viewResolver.setOrder(1);
+ return viewResolver;
+ }
+
+ /**
+ * Adds new instances of the following interceptors to the specified
+ * interceptor registry: {@link SessionTimeoutInterceptor},
+ * {@link ResourceInterceptor}
+ */
+ @Override
+ public void addInterceptors(InterceptorRegistry registry) {
+ registry.addInterceptor(new SessionTimeoutInterceptor())
+ .excludePathPatterns(getExcludeUrlPathsForSessionTimeout());
+ registry.addInterceptor(resourceInterceptor());
+ }
+
+ /**
+ * Creates and returns a new instance of a {@link ResourceInterceptor}.
+ *
+ * @return New instance of {@link ResourceInterceptor}
+ */
+ @Bean
+ public ResourceInterceptor resourceInterceptor() {
+ return new ResourceInterceptor();
+ }
+
+ private String[] excludeUrlPathsForSessionTimeout = {};
+
+ /**
+ * Gets the array of Strings that are paths excluded for session timeout.
+ *
+ * @return Array of String
+ */
+ public String[] getExcludeUrlPathsForSessionTimeout() {
+ return excludeUrlPathsForSessionTimeout;
+ }
+
+ /**
+ * Sets the array of Strings that are paths excluded for session timeout.
+ */
+ public void setExcludeUrlPathsForSessionTimeout(final String... excludeUrlPathsForSessionTimeout) {
+ this.excludeUrlPathsForSessionTimeout = excludeUrlPathsForSessionTimeout;
+ }
+
+
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+ appApplicationContext = applicationContext;
+
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppInitializer.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppInitializer.java
new file mode 100644
index 00000000..df0d56d6
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppInitializer.java
@@ -0,0 +1,69 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.conf;
+
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
+
+public abstract class AppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppInitializer.class);
+ private final String activeProfile = "src";
+
+ @Override
+ protected WebApplicationContext createServletApplicationContext() {
+ WebApplicationContext context = super.createServletApplicationContext();
+
+ try {
+
+ ((ConfigurableEnvironment) context.getEnvironment()).setActiveProfiles(activeProfile);
+ } catch (Exception e) {
+
+ logger.error(EELFLoggerDelegate.errorLogger, "Unable to set the active profile" + e.getMessage(),AlarmSeverityEnum.MAJOR);
+ throw e;
+
+ }
+
+ return context;
+ }
+
+ @Override
+ protected Class<?>[] getRootConfigClasses() {
+ return null;
+ }
+
+ @Override
+ protected Class<?>[] getServletConfigClasses() {
+
+ return new Class[] { AppConfig.class };
+ }
+
+ /*
+ * URL request will direct to the Spring dispatcher for processing
+ */
+ @Override
+ protected String[] getServletMappings() {
+ return new String[] { "/" };
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/Configurable.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/Configurable.java
new file mode 100644
index 00000000..9585e45d
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/Configurable.java
@@ -0,0 +1,38 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.conf;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.springframework.web.servlet.ViewResolver;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+
+public interface Configurable {
+
+ public ViewResolver viewResolver();
+
+ public void addResourceHandlers(ResourceHandlerRegistry registry) ;
+
+ public DataAccessService dataAccessService();
+
+ public List<String> addTileDefinitions();
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateConfiguration.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateConfiguration.java
new file mode 100644
index 00000000..b70ced48
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateConfiguration.java
@@ -0,0 +1,155 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.conf;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.sql.DataSource;
+
+import org.hibernate.SessionFactory;
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.orm.hibernate4.HibernateTransactionManager;
+import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import com.mchange.v2.c3p0.ComboPooledDataSource;
+
+@Configuration
+@EnableTransactionManagement
+public class HibernateConfiguration {
+
+ @Autowired
+ private SystemProperties systemProperties;
+
+ @Autowired
+ private HibernateMappingLocatable mappingLocate;
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HibernateConfiguration.class);
+
+ DataSource dataSource;
+
+
+ @Bean
+ public LocalSessionFactoryBean sessionFactory() {
+ LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
+ sessionFactory.setDataSource(getDataSource());
+ sessionFactory.setPackagesToScan(new String[] { "org.openecomp"});
+ sessionFactory.setHibernateProperties(hibernateProperties());
+ sessionFactory.setMappingLocations(mappingLocate.getMappingLocations());
+ return sessionFactory;
+ }
+
+
+
+
+ @SuppressWarnings("rawtypes")
+ @Bean
+ public Map dataSourceMap() throws Exception {
+ Connection conn = null;
+ Statement stmt = null;
+ Map<String, ComboPooledDataSource> dataSourceMap = new HashMap<String, ComboPooledDataSource>();
+
+ try {
+ conn = getDataSource().getConnection();
+ stmt = conn.createStatement();
+ String sql;
+ sql = "SELECT schema_id,datasource_type,connection_url,user_name,password,driver_class,min_pool_size,max_pool_size,idle_connection_test_period FROM schema_info";
+ ResultSet rs = stmt.executeQuery(sql);
+
+ while (rs.next()) {
+ ComboPooledDataSource dataSource = new ComboPooledDataSource();
+ dataSource.setDriverClass(rs.getString("driver_class"));
+ dataSource.setJdbcUrl(rs.getString("connection_url"));
+ dataSource.setUser(rs.getString("user_name"));
+ dataSource.setPassword(rs.getString("password"));
+ dataSource.setMinPoolSize(rs.getInt("min_pool_size"));
+ dataSource.setMaxPoolSize(rs.getInt("max_pool_size"));
+ dataSource.setIdleConnectionTestPeriod(rs.getInt("idle_connection_test_period"));
+ dataSourceMap.put(rs.getString("schema_id"), dataSource);
+ }
+ rs.close();
+ stmt.close();
+ conn.close();
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Error initializing database, verify database settings in properties file: " + e.getMessage(),AlarmSeverityEnum.CRITICAL);
+ e.printStackTrace();
+ dataSourceMap = null;
+ throw e;
+ } finally {
+ try {
+ if (stmt != null)
+ stmt.close();
+ } catch (SQLException se2) {}
+ try {
+ if (conn != null)
+ conn.close();
+ } catch (SQLException se) { se.printStackTrace();}
+ }
+
+ return dataSourceMap;
+ }
+
+ private Properties hibernateProperties() {
+ Properties properties = new Properties();
+ properties.put("hibernate.dialect", SystemProperties.getProperty(SystemProperties.HB_DIALECT));
+ properties.put("hibernate.show_sql", SystemProperties.getProperty(SystemProperties.HB_SHOW_SQL));
+ return properties;
+ }
+
+ @Bean
+ @Autowired
+ public HibernateTransactionManager transactionManager(SessionFactory s) {
+ HibernateTransactionManager txManager = new HibernateTransactionManager();
+ txManager.setSessionFactory(s);
+ return txManager;
+ }
+
+ public SystemProperties getSystemProperties() {
+ return systemProperties;
+ }
+
+ public void setSystemProperties(SystemProperties systemProperties) {
+ this.systemProperties = systemProperties;
+ }
+
+
+
+
+ public DataSource getDataSource() {
+ return dataSource;
+ }
+
+
+ @Autowired
+ public void setDataSource(DataSource dataSource) {
+ this.dataSource = dataSource;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateMappingLocatable.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateMappingLocatable.java
new file mode 100644
index 00000000..a3bbe18d
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateMappingLocatable.java
@@ -0,0 +1,28 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.conf;
+
+import org.springframework.core.io.Resource;
+
+public interface HibernateMappingLocatable {
+
+ public Resource[] getMappingLocations();
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AdminAuthGenericController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AdminAuthGenericController.java
new file mode 100644
index 00000000..8a1f1d2c
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AdminAuthGenericController.java
@@ -0,0 +1,134 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+/*package org.openecomp.portalsdk.core.controller;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.onboarding.crossapi.IGenericRolesService;
+import org.openecomp.portalsdk.core.onboarding.crossapi.IGenericUsersService;
+import com.fasterxml.jackson.core.JsonProcessingException;
+
+
+@RestController
+@RequestMapping("/api")
+public class AdminAuthGenericController extends RestrictedRESTfulBaseController {
+ protected final Log logger = LogFactory.getLog(getClass());
+ @Autowired
+ IGenericUsersService genericUserService;
+
+ @Autowired
+ IGenericRolesService genericRolesService;
+
+ *//**
+ * RESTful service method to fetch available roles
+ * @return
+ *//*
+ @RequestMapping(value={"/roles"}, method = RequestMethod.GET, produces = "application/json")
+ public String getAvailableRoles() throws Exception{
+ return genericRolesService.getAvailableRoles();
+ }
+
+ *//**
+ * RESTful service method to save user - expects user details in json string
+ * @param userJson
+ *//*
+ @RequestMapping(value={"/user"}, method = RequestMethod.POST)
+ public String pushUser(@RequestBody String userJson) throws Exception{
+ return genericUserService.pushUser(userJson);
+ }
+
+ *//**
+ * RESTful service method to edit user - expects user details in json string
+ * @param userJson
+ *//*
+ @RequestMapping(value={"/user/{loginId}"}, method = RequestMethod.POST)
+ public String editUser(@PathVariable("loginId") String loginId, @RequestBody String userJson) throws Exception{
+ return genericUserService.editUser(loginId, userJson);
+ }
+
+ *//**
+ * RESTful service method to save user role using user's login Id and details in role Json string
+ * @param loginId
+ * @param roleJson
+ * @throws JsonProcessingException
+ *//*
+ @RequestMapping(value={"/user/{loginId}/roles"}, method = RequestMethod.POST)
+ public String pushUserRole(@PathVariable("loginId") String loginId, @RequestBody String rolesJson) throws Exception{
+ return genericRolesService.pushUserRole(loginId, rolesJson);
+ }
+
+
+ *//**
+ * Below method is to retrieve user - TODO @Talasila - Created to test the fn_app relation to fn_user_role. If not needed, please remove this method.
+ * @param id
+ * @return
+ * @throws Exception
+ *//*
+ @RequestMapping(value={"/user/{loginId}"}, method = RequestMethod.GET, produces = "application/json")
+ public String getUser(@PathVariable("loginId") String loginId) throws Exception{
+ return genericUserService.getUser(loginId);
+ }
+
+ @RequestMapping(value={"/users"}, method = RequestMethod.GET, produces = "application/json")
+ public String getUsers() throws Exception{
+ return genericUserService.getUsers();
+ }
+
+ *//**
+ * RESTful service method to fetch individual user's roles using user's loginId
+ * @param loginId
+ * @return
+ *//*
+ @RequestMapping(value={"/user/{loginId}/roles"}, method = RequestMethod.GET, produces = "application/json")
+ public String getUserRoles(@PathVariable("loginId") String loginId) throws Exception{
+ return genericRolesService.getUserRoles(loginId);
+ }
+
+ *//**
+ * RESTful service method to fetch available roles
+ * @return
+ *//*
+
+ //Commenting this out as it depends on Role API - Ikram
+ @RequestMapping(value={"/rolesFull"}, method = RequestMethod.GET, produces = "application/json")
+ public List<Role> getAvailableFullRoles(){
+ return genericRolesService.getAvailableFullRoles();
+ }
+
+ @ExceptionHandler(Exception.class)
+ void handleBadRequests(Exception e, HttpServletResponse response) throws IOException {
+ response.sendError(HttpStatus.BAD_REQUEST.value(),e.getMessage());
+ }
+}
+*/
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AngularAdminController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AngularAdminController.java
new file mode 100644
index 00000000..e3aab7dd
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AngularAdminController.java
@@ -0,0 +1,50 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+@RequestMapping("/")
+public class AngularAdminController extends RestrictedBaseController{
+
+ @RequestMapping(value = {"/userProfile" }, method = RequestMethod.GET)
+ public ModelAndView view(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+
+ return new ModelAndView("user_profile_list","model", model);
+ }
+
+ @RequestMapping(value = {"/admin" }, method = RequestMethod.GET)
+ public ModelAndView adminView(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+
+ return new ModelAndView(getViewName(),"model", model);
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastController.java
new file mode 100644
index 00000000..6dfe9cac
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastController.java
@@ -0,0 +1,130 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.domain.BroadcastMessage;
+import org.openecomp.portalsdk.core.service.BroadcastService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.AppUtils;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+@RequestMapping("/")
+public class BroadcastController extends RestrictedBaseController {
+
+ @Autowired
+ private BroadcastService broadcastService;
+
+ @RequestMapping(value = { "/broadcast" }, method = RequestMethod.GET)
+ public ModelAndView broadcast(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ model.put("broadcastMessage", mapper.writeValueAsString(broadcastService.getBroadcastMessage(request)));
+ model.put("broadcastSites", mapper.writeValueAsString(referenceData(request).get("broadcastSites")));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return new ModelAndView(getViewName(), model);
+ }
+
+ @RequestMapping(value = { "/get_broadcast" }, method = RequestMethod.GET)
+ public void getBroadcast(HttpServletRequest request, HttpServletResponse response) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+
+ model.put("broadcastMessage", mapper.writeValueAsString(broadcastService.getBroadcastMessage(request)));
+ model.put("broadcastSites", mapper.writeValueAsString(referenceData(request).get("broadcastSites")));
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ protected Map referenceData(HttpServletRequest request) {
+ Map lookupData = new HashMap();
+
+ if ("true".equals(SystemProperties.getProperty(SystemProperties.CLUSTERED))) {
+ lookupData.put("broadcastSites", AppUtils.getLookupList("fn_lu_broadcast_site", "broadcast_site_cd",
+ "broadcast_site_descr", "", "broadcast_site_descr"));
+ }
+
+ return lookupData;
+ }
+
+ @RequestMapping(value = { "/broadcast/save" }, method = RequestMethod.POST)
+ public ModelAndView save(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ BroadcastMessage broadcastMessage = mapper.readValue(root.get("broadcastMessage").toString(),
+ BroadcastMessage.class);
+
+ broadcastService.saveBroadcastMessage(broadcastMessage);
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+ String responseString = mapper.writeValueAsString(broadcastMessage);
+ JSONObject j = new JSONObject("{broadcastMessage: " + responseString + "}");
+
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastListController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastListController.java
new file mode 100644
index 00000000..7e0789c2
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastListController.java
@@ -0,0 +1,142 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.domain.BroadcastMessage;
+import org.openecomp.portalsdk.core.service.BroadcastService;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+@RequestMapping("/")
+public class BroadcastListController extends RestrictedBaseController {
+
+ @Autowired
+ private BroadcastService broadcastService;
+
+ @RequestMapping(value = { "/broadcast_list" }, method = RequestMethod.GET)
+ public ModelAndView broadcastList(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+
+ model.put("model", broadcastService.getBcModel(request));
+ return new ModelAndView(getViewName(), model);
+ }
+
+ @RequestMapping(value = { "/get_broadcast_list" }, method = RequestMethod.GET)
+ public void getBroadcast(HttpServletRequest request, HttpServletResponse response) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ model.put("model", broadcastService.getBcModel(request));
+ model.put("messagesList", broadcastService.getBcModel(request).get("messagesList"));
+ model.put("messageLocations", broadcastService.getBcModel(request).get("messageLocations"));
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ @RequestMapping(value = { "/broadcast_list/remove" }, method = RequestMethod.POST)
+ public ModelAndView remove(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ BroadcastMessage broadcastMessage = mapper.readValue(root.get("broadcastMessage").toString(),
+ BroadcastMessage.class);
+
+ broadcastService.removeBroadcastMessage(broadcastMessage);
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+ String responseString = mapper.writeValueAsString(broadcastMessage);
+ JSONObject j = new JSONObject("{broadcastMessage: " + responseString + "}");
+
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+
+ @RequestMapping(value = { "/broadcast_list/toggleActive" }, method = RequestMethod.POST)
+ public ModelAndView toggleActive(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ BroadcastMessage broadcastMessage = mapper.readValue(root.get("broadcastMessage").toString(),
+ BroadcastMessage.class);
+
+ broadcastService.saveBroadcastMessage(broadcastMessage);
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+ String responseString = mapper.writeValueAsString(broadcastMessage);
+ JSONObject j = new JSONObject("{broadcastMessage: " + responseString + "}");
+
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CacheAdminController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CacheAdminController.java
new file mode 100644
index 00000000..095c41b6
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CacheAdminController.java
@@ -0,0 +1,252 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.jcs.JCS;
+import org.apache.jcs.admin.CacheRegionInfo;
+import org.apache.jcs.admin.JCSAdminBean;
+import org.apache.jcs.engine.behavior.ICacheElement;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+@Controller
+@RequestMapping("/")
+public class CacheAdminController extends RestrictedBaseController {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CacheAdminController.class);
+ private JCSAdminBean jcsAdminBean = new JCSAdminBean();
+
+ @RequestMapping(value = {"/jcs_admin" }, method = RequestMethod.GET)
+ public ModelAndView cacheAdmin(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+
+ model.put("model", getRegions());
+
+ return new ModelAndView(getViewName(),model);
+ }
+
+ @RequestMapping(value = {"/get_regions" }, method = RequestMethod.GET)
+ public void getRegions(HttpServletRequest request,HttpServletResponse response) {
+ // ObjectMapper mapper = new ObjectMapper();
+ try{
+ JsonMessage msg = new JsonMessage(getRegions().toString());
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ @RequestMapping(value = {"/jcs_admin/clearRegion" }, method = RequestMethod.GET)
+ public void clearRegion(HttpServletRequest request,HttpServletResponse response) throws Exception {
+ String cacheName = (String) request.getParameter("cacheName");
+ clearCacheRegion(cacheName);
+
+ response.setContentType("application/json");
+ PrintWriter out = response.getWriter();
+ out.write(getRegions().toString());
+ }
+
+ @RequestMapping(value = {"/jcs_admin/clearAll" }, method = RequestMethod.GET)
+ public void clearAll(HttpServletRequest request,HttpServletResponse response) throws Exception {
+ clearAllRegions();
+
+ response.setContentType("application/json");
+ PrintWriter out = response.getWriter();
+ out.write(getRegions().toString());
+ }
+
+ @RequestMapping(value = {"/jcs_admin/clearItem" }, method = RequestMethod.GET)
+ public void clearItem(HttpServletRequest request,HttpServletResponse response) throws Exception {
+ String keyName = (String) request.getParameter("keyName");
+ String cacheName = (String) request.getParameter("cacheName");
+ clearCacheRegionItem(cacheName, keyName);
+
+ response.setContentType("application/json");
+ PrintWriter out = response.getWriter();
+ out.write(getRegions().toString());
+ }
+
+ @RequestMapping(value = {"/jcs_admin/showItemDetails" }, method = RequestMethod.GET)
+ public void showItemDetails(HttpServletRequest request,HttpServletResponse response) throws Exception {
+ String cacheName = (String) request.getParameter("cacheName");
+ String keyName = (String) request.getParameter("keyName");
+ String details = null;
+
+ try {
+ details = getItemDetails(cacheName, keyName);
+ } catch (Exception e) {
+ details = "There was an error retrieving the region details. Please try again.";
+ logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while retrieving the item details for the cache region - "
+ + cacheName + e.getMessage());
+
+ }
+
+ response.setContentType("application/json");
+ PrintWriter out = response.getWriter();
+ out.write(details);
+ }
+
+ @RequestMapping(value = {"/jcs_admin/showRegionDetails" }, method = RequestMethod.GET)
+ public void showRegionDetails(HttpServletRequest request,HttpServletResponse response) throws Exception {
+ String cacheName = (String) request.getParameter("cacheName");
+ String details = null;
+
+ try {
+ details = getRegionStats(cacheName);
+ } catch (Exception e) {
+ details = "There was an error retrieving the region details. Please try again.";
+ logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while retrieving the region details for the cache region - "
+ + cacheName + e.getMessage());
+
+ }
+
+ response.setContentType("application/json");
+ PrintWriter out = response.getWriter();
+ out.write(details);
+ }
+
+ @SuppressWarnings("unchecked")
+ public JSONArray getRegions(){
+ LinkedList<CacheRegionInfo> regions = null;
+ JSONArray ja = new JSONArray();
+ try {
+ regions = getJcsAdminBean().buildCacheInfo();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
+ for (CacheRegionInfo cri : regions) {
+ JSONObject jo = new JSONObject();
+ jo.put("cacheName", cri.getCache().getCacheName());
+ jo.put("size", cri.getCache().getSize());
+ jo.put("byteCount", cri.getByteCount());
+ jo.put("status", cri.getStatus());
+ jo.put("hitCountRam", cri.getCache().getHitCountRam());
+ jo.put("hitCountAux", cri.getCache().getHitCountAux());
+ jo.put("missCountNotFound", cri.getCache().getMissCountNotFound());
+ jo.put("missCountExpired", cri.getCache().getMissCountExpired());
+ jo.put("items",new JSONArray(mapper.writeValueAsString(getRegionItems(cri.getCache().getCacheName()))));
+ ja.put(jo);
+ }
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while retrieving the list of cache regions" + e.getMessage());
+
+ }
+
+ return ja;
+ }
+
+ private String getRegionStats(String cacheName) throws Exception {
+ String stats = "";
+
+ JCS cache = JCS.getInstance(cacheName);
+ stats = cache.getStats();
+
+ return stats;
+ }
+
+ private String getItemDetails(String cacheName, String keyName)
+ throws Exception {
+ String details = "";
+
+ JCS cache = JCS.getInstance(cacheName);
+ ICacheElement element = cache.getCacheElement(keyName);
+
+ if (element != null) {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
+ details = mapper.writeValueAsString(element);
+ }
+
+ return details;
+ }
+
+ @SuppressWarnings("rawtypes")
+ private List getRegionItems(String cacheName) {
+ List items = null;
+
+ try {
+ items = getJcsAdminBean().buildElementInfo(cacheName);
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while retrieving the list of items for cache region - "
+ + cacheName + e.getMessage());
+
+ }
+
+ return items;
+ }
+
+ private void clearAllRegions() {
+ try {
+ getJcsAdminBean().clearAllRegions();
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while clearing all cache regions." + e.getMessage());
+
+ }
+ }
+
+ private void clearCacheRegion(String cacheName) {
+ try {
+ getJcsAdminBean().clearRegion(cacheName);
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while clearing the cache region - "
+ + cacheName + e.getMessage());
+
+ }
+ }
+
+ private void clearCacheRegionItem(String cacheName, String keyName) {
+ try {
+ getJcsAdminBean().removeItem(cacheName, keyName);
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while removing cache region item - "
+ + keyName + e.getMessage());
+
+ }
+ }
+
+ public JCSAdminBean getJcsAdminBean() {
+ return jcsAdminBean;
+ }
+
+ public void setJcsAdminBean(JCSAdminBean jcsAdminBean) {
+ this.jcsAdminBean = jcsAdminBean;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborateListController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborateListController.java
new file mode 100644
index 00000000..9e43e948
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborateListController.java
@@ -0,0 +1,84 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.UserProfileService;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+@RequestMapping("/")
+public class CollaborateListController extends RestrictedBaseController{
+ @Autowired
+ UserProfileService service;
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CollaborateListController.class);
+
+ @RequestMapping(value = {"/collaborate_list" }, method = RequestMethod.GET)
+ public ModelAndView ProfileSearch(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+ User user = UserUtils.getUserSession(request);
+
+ List<User> profileList =null;
+ try {
+ profileList = service.findAllUserWithOnOffline(user.getOrgUserId());
+ model.put("profileList", mapper.writeValueAsString(profileList));
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Error happened during collaborate list search" + e.getMessage());
+
+ }
+ return new ModelAndView(getViewName(),"model", model);
+ }
+
+ @RequestMapping(value = {"/get_collaborate_list" }, method = RequestMethod.GET)
+ public void getCollaborateList(HttpServletRequest request,HttpServletResponse response) {
+
+ ObjectMapper mapper = new ObjectMapper();
+ User user = UserUtils.getUserSession(request);
+
+ List<User> profileList =null;
+ try {
+ profileList = service.findAllUserWithOnOffline(user.getOrgUserId());
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(profileList));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Error happened during get collaborate list" + e.getMessage());
+
+ }
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborationController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborationController.java
new file mode 100644
index 00000000..a9c1d44b
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborationController.java
@@ -0,0 +1,47 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+@RequestMapping("/")
+public class CollaborationController extends RestrictedBaseController{
+
+ @RequestMapping(value = {"/collaboration" }, method = RequestMethod.GET)
+ public ModelAndView view(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ User user = UserUtils.getUserSession(request);
+
+ model.put("name",(user.getFirstName() + " " + (user.getLastName() != null? user.getLastName().substring(0,1): "" )));
+ return new ModelAndView(getViewName(),"model", model);
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ElementModelController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ElementModelController.java
new file mode 100644
index 00000000..a6e7b966
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ElementModelController.java
@@ -0,0 +1,91 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.portalsdk.core.service.ElementLinkService;
+import org.openecomp.portalsdk.core.service.ElementMapService;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+
+@Controller
+@RequestMapping("/")
+public class ElementModelController extends RestrictedBaseController{
+
+ @RequestMapping(value = {"/elementMapLayout" }, method = RequestMethod.POST)
+ public ModelAndView layout(HttpServletRequest request,
+ HttpServletResponse response) throws Exception{
+
+ Map<String, Object> model = new HashMap<String, Object>();
+ String collapseDomains = request.getParameter("collapsedDomains");
+ String expandDomains = request.getParameter("expandedDomains");
+
+ String contentFileName = request.getParameter("contentFileName");
+ String layoutFileName = request.getParameter("layoutFileName");
+
+ ElementMapService main = new ElementMapService();
+ String yamlString = main.main1(new String[]{collapseDomains,expandDomains, contentFileName, layoutFileName });
+
+ //response.setContentType("application/json");
+ //PrintWriter out = response.getWriter();
+ //out.print(yamlString);
+ //out.flush();
+
+ //return null;
+ model.put("output_string", yamlString);
+ return new ModelAndView("data_out", "model", model);
+ }
+
+ @RequestMapping(value = {"/elementMapLink" }, method = RequestMethod.POST)
+ public ModelAndView callflow(HttpServletRequest request,
+ HttpServletResponse response) throws Exception{
+
+ Map<String, Object> model = new HashMap<String, Object>();
+ String callFlowName = request.getParameter("callFlowName");
+ String callFlowStep = request.getParameter("callFlowStep");
+
+ ElementLinkService main = new ElementLinkService();
+ String yamlString = main.main1(new String[]{callFlowName,callFlowStep });
+ model.put("output_string", yamlString);
+ return new ModelAndView("data_out", "model", model);
+ }
+
+ public ModelAndView callflowAdditional(HttpServletRequest request,
+ HttpServletResponse response) throws Exception{
+
+ Map<String, Object> model = new HashMap<String, Object>();
+ String callFlowName = request.getParameter("callFlowName");
+ String callFlowStep = request.getParameter("callFlowStep");
+
+ ElementLinkService main = new ElementLinkService();
+ String yamlString = main.main2(new String[]{callFlowName,callFlowStep });
+ model.put("output_string", yamlString);
+ return new ModelAndView("data_out", "model", model);
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ExternalLoginController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ExternalLoginController.java
new file mode 100644
index 00000000..90e47d42
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ExternalLoginController.java
@@ -0,0 +1,121 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.portalsdk.core.command.LoginBean;
+import org.openecomp.portalsdk.core.menu.MenuProperties;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalTimeoutHandler;
+import org.openecomp.portalsdk.core.service.LoginService;
+import org.openecomp.portalsdk.core.service.ProfileService;
+import org.openecomp.portalsdk.core.web.support.AppUtils;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+@RequestMapping("/")
+public class ExternalLoginController extends UnRestrictedBaseController{
+ @Autowired
+ ProfileService service;
+ @Autowired
+ private LoginService loginService;
+ String viewName;
+
+ @RequestMapping(value = {"/login_external.htm" }, method = RequestMethod.GET)
+ public ModelAndView ExternalLogin(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ return new ModelAndView(getViewName(),"model", model);
+ }
+
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @RequestMapping(value = {"/login_external/login" }, method = RequestMethod.POST)
+ public @ResponseBody String ExternalLogin(HttpServletRequest request, HttpServletResponse response) throws Exception{
+
+ Map model = new HashMap();
+ LoginBean commandBean = new LoginBean();
+ String loginId = request.getParameter("loginId");
+ String password = request.getParameter("password");
+ commandBean.setLoginId(loginId);
+ commandBean.setLoginPwd(password);
+ HashMap additionalParamsMap = new HashMap();
+
+ commandBean = getLoginService().findUser(commandBean, (String)request.getAttribute(MenuProperties.MENU_PROPERTIES_FILENAME_KEY),
+ additionalParamsMap);
+
+ if (commandBean.getUser() == null) {
+ String loginErrorMessage = (commandBean.getLoginErrorMessage() != null) ? commandBean.getLoginErrorMessage()
+ : "login.error.external.invalid";
+ model.put("error", loginErrorMessage);
+ String[] errorCodes = new String[1];
+ errorCodes[0] = loginErrorMessage;
+ return "failure";
+
+ }
+ else {
+ // store the currently logged in user's information in the session
+ UserUtils.setUserSession(request, commandBean.getUser(), commandBean.getMenu(), commandBean.getBusinessDirectMenu(),
+ null);
+ initateSessionMgtHandler(request);
+ // user has been authenticated, now take them to the welcome page
+ return "success";
+
+ }
+
+
+ }
+
+ public String getJessionId(HttpServletRequest request){
+
+ return request.getSession().getId();
+
+ }
+
+ protected void initateSessionMgtHandler(HttpServletRequest request) {
+ String jSessionId = getJessionId(request);
+ PortalTimeoutHandler.sessionCreated(jSessionId, jSessionId, AppUtils.getSession(request));
+ }
+
+ public String getViewName() {
+ return viewName;
+ }
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+ public LoginService getLoginService() {
+ return loginService;
+ }
+
+ public void setLoginService(LoginService loginService) {
+ this.loginService = loginService;
+ }
+
+}
+
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FavoritesController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FavoritesController.java
new file mode 100644
index 00000000..b2ad61f4
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FavoritesController.java
@@ -0,0 +1,117 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.domain.App;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.aspect.AuditLog;
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.onboarding.rest.FavoritesClient;
+import org.openecomp.portalsdk.core.service.AppService;
+import org.openecomp.portalsdk.core.util.CipherUtil;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+@Controller
+@RequestMapping("/")
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+@AuditLog
+public class FavoritesController extends UnRestrictedBaseController {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FavoritesController.class);
+
+ @Autowired
+ AppService appService;
+
+ /**
+ * Makes the REST API call to Portal Back-end and retrieves Favorite menu
+ * items for the currently logged in user.
+ *
+ * @param request
+ * @param response
+ */
+ @RequestMapping(value = { "/get_favorites" }, method = RequestMethod.GET)
+ public void getFavorites(HttpServletRequest request, HttpServletResponse response) {
+ String appName = "";
+ String requestId = "";
+ String appUserName = "";
+ String decryptedPwd = "";
+
+ try {
+ HttpSession session = request.getSession();
+ User user = (User) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME));
+ if (user == null || user.getId() == null) {
+ logger.info(EELFLoggerDelegate.errorLogger,
+ ("Http request did not contain user info, cannot retrieve favorites."));
+
+ response.setContentType("application/json");
+ JSONArray jsonResponse = new JSONArray();
+ JSONObject error = new JSONObject();
+ error.put("error", "Http request did not contain user info, cannot retrieve favorites.");
+ jsonResponse.put(error);
+ response.getWriter().write(jsonResponse.toString());
+ } else {
+ logger.info(EELFLoggerDelegate.errorLogger,
+ "Retrieving Favorites for the user '" + MDC.get(SystemProperties.MDC_LOGIN_ID) + "'.");
+
+ App app = appService.getDefaultApp();
+ if (app!=null) {
+ appName = app.getName();
+ appUserName = app.getUsername();
+ try{
+ decryptedPwd = CipherUtil.decrypt(app.getAppPassword(), SystemProperties.getProperty(SystemProperties.Decryption_Key));
+ } catch(Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in WebServiceCallServiceImpl.get while decrypting the password. Details: " + e.getMessage());
+ }
+ } else {
+ logger.warn(EELFLoggerDelegate.errorLogger, "Unable to locate the app information from the database.");
+ appName = SystemProperties.SDK_NAME;
+ }
+ requestId = MDC.get(MDC_KEY_REQUEST_ID);
+
+ String jsonResponse = FavoritesClient.getFavorites(MDC.get(SystemProperties.MDC_LOGIN_ID), appName, requestId, appUserName, decryptedPwd);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, "FavoritesMenu response: " + jsonResponse);
+
+ response.setContentType("application/json");
+ response.getWriter().write(jsonResponse);
+ }
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "Exception occurred in FavoritesController.getFavorites while performing get_favorites. Details: "
+ + e.getMessage(), AlarmSeverityEnum.MINOR);
+ }
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FnMenuController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FnMenuController.java
new file mode 100644
index 00000000..f19a6f19
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FnMenuController.java
@@ -0,0 +1,224 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.domain.Menu;
+import org.openecomp.portalsdk.core.domain.MenuData;
+import org.openecomp.portalsdk.core.service.FnMenuService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * Description: this java class is a controller for Admin to add/edit/delete menu items from FN_MENU
+ */
+
+@Controller
+@RequestMapping("/")
+public class FnMenuController extends RestrictedBaseController {
+ @Autowired
+ FnMenuService service;
+
+ String viewName;
+
+ @RequestMapping(value = {"/admin_fn_menu/get_parent_list" }, method = RequestMethod.GET)
+ public void getParentList(HttpServletRequest request,HttpServletResponse response) throws Exception {
+ ObjectMapper mapper = new ObjectMapper();
+ try{
+
+ response.getWriter().write(mapper.writeValueAsString(service.getParentList()));
+
+ } catch (Exception e) {
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+
+ }
+
+ }
+
+ @RequestMapping(value = {"/admin_fn_menu/get_function_cd_list" }, method = RequestMethod.GET)
+ public void getFunctionCDList(HttpServletRequest request,HttpServletResponse response) throws Exception {
+ ObjectMapper mapper = new ObjectMapper();
+ try{
+
+ response.getWriter().write(mapper.writeValueAsString(service.getFunctionCDList()));
+
+ } catch (Exception e) {
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+
+ }
+
+ }
+
+ @RequestMapping(value = {"/admin_fn_menu" }, method = RequestMethod.GET)
+ public void getFnMenuList(HttpServletRequest request,HttpServletResponse response) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+ List<MenuData> temp =null;
+ List<List<MenuData>> childItemList = new ArrayList<List<MenuData>>();
+ List<MenuData> parentList = new ArrayList<>();
+
+ try {
+ temp = service.getFnMenuItems();
+ for(MenuData menu: temp){
+ MenuData parentData = new MenuData();
+ parentData.setId(menu.getId());
+ parentData.setLabel(menu.getLabel());
+ if(menu.getParentMenu()!=null){
+ parentData.setParentId(menu.getParentMenu().getId());
+ }
+ parentData.setAction(menu.getAction());
+ parentData.setFunctionCd(menu.getFunctionCd());
+ parentData.setImageSrc(menu.getImageSrc());
+ parentData.setSortOrder(menu.getSortOrder());
+ parentData.setActive(menu.isActive());
+ parentData.setServlet(menu.getServlet());
+ parentData.setQueryString(menu.getQueryString());
+ parentData.setExternalUrl(menu.getExternalUrl());
+ parentData.setTarget(menu.getTarget());
+ parentData.setMenuSetCode(menu.getMenuSetCode());
+ parentData.setSeparator(menu.isSeparator());
+ parentData.setImageSrc(menu.getImageSrc());
+ parentList.add(parentData);
+ List<MenuData> tempList = new ArrayList<MenuData>();
+ childItemList.add(tempList);
+ }
+ model.put("fnMenuItems", parentList);
+
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+
+ @RequestMapping(value = {"/admin_fn_menu/updateFnMenu" }, method = RequestMethod.POST)
+ public ModelAndView updateFnMenu(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ Menu fnMenuItem = mapper.readValue(root.get("availableFnMenuItem").toString(), Menu.class);
+
+ service.saveFnMenu(fnMenuItem);
+ request.getSession().removeAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME));
+ request.getSession().removeAttribute(SystemProperties.LEFT_MENU_CHILDREND);
+ request.getSession().removeAttribute(SystemProperties.LEFT_MENU_PARENT);
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+ String responseString = mapper.writeValueAsString(service.getMenuItem(fnMenuItem.getId()));
+
+ out.write(responseString);
+
+ return null;
+
+ } catch (Exception e) {
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+
+ }
+ return null;
+
+ }
+
+ @RequestMapping(value = {"/admin_fn_menu/removeMenuItem" }, method = RequestMethod.POST)
+ public ModelAndView removeFnMenu(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ Menu fnMenuItem = mapper.readValue(root.get("fnMenuItem").toString(), Menu.class);
+ Menu fnMenuItemRow = service.getMenuItemRow(fnMenuItem.getId());
+
+ service.removeMenuItem(fnMenuItemRow);
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ String responseString = mapper.writeValueAsString(service.getMenuItem(fnMenuItem.getId()));
+ out.write(responseString);
+
+ return null;
+
+ } catch (Exception e) {
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+
+
+ }
+ return null;
+
+ }
+
+ public String getViewName() {
+ return viewName;
+ }
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FuncMenuController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FuncMenuController.java
new file mode 100644
index 00000000..5baebf00
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FuncMenuController.java
@@ -0,0 +1,174 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.domain.App;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.aspect.AuditLog;
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
+import org.openecomp.portalsdk.core.onboarding.rest.FunctionalMenuClient;
+import org.openecomp.portalsdk.core.onboarding.ueb.UebException;
+import org.openecomp.portalsdk.core.onboarding.ueb.UebManager;
+import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg;
+import org.openecomp.portalsdk.core.onboarding.ueb.UebMsgTypes;
+import org.openecomp.portalsdk.core.service.AppService;
+import org.openecomp.portalsdk.core.util.CipherUtil;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+@Controller
+@RequestMapping("/")
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+public class FuncMenuController extends UnRestrictedBaseController{
+
+ @Autowired
+ AppService appService;
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FuncMenuController.class);
+
+ @AuditLog
+ @RequestMapping(value = {"/get_functional_menu" }, method = RequestMethod.GET)
+ public void functionalMenu(HttpServletRequest request, HttpServletResponse response) {
+
+ User user = UserUtils.getUserSession(request);
+ //JSONArray validMenu = new JSONArray("[{\"menuId\":140,\"column\":1,\"text\":\"RT SDK Menu\",\"parentMenuId\":139,\"url\":\"http://www.cnn.com\"},{\"menuId\":139,\"column\":1,\"text\":\"RT Menu\",\"parentMenuId\":11,\"url\":\"\"},{\"menuId\":11,\"column\":1,\"text\":\"Product Design\",\"parentMenuId\":1,\"url\":\"\"},{\"menuId\":1,\"column\":1,\"text\":\"Design\",\"url\":\"\"}]");
+
+ try {
+ if ( user != null ) {
+ String useRestForFunctionalMenu = PortalApiProperties.getProperty(PortalApiConstants.USE_REST_FOR_FUNCTIONAL_MENU);
+ String funcMenuJsonString = "";
+ if (useRestForFunctionalMenu==null || useRestForFunctionalMenu=="" || useRestForFunctionalMenu.equalsIgnoreCase("false")) {
+ logger.info(EELFLoggerDelegate.errorLogger, "Making use of UEB communication and Requesting functional menu for user " + user.getOrgUserId());
+ funcMenuJsonString = getFunctionalMenu(user.getOrgUserId());
+ } else {
+ funcMenuJsonString = getFunctionalMenuViaREST(user.getOrgUserId());
+ }
+ response.setContentType("application/json");
+ response.getWriter().write(funcMenuJsonString);
+ } else {
+ logger.info(EELFLoggerDelegate.errorLogger, "Http request did not contain user info, cannot retrieve functional menu");
+ response.setContentType("application/json");
+ JSONArray jsonResponse = new JSONArray();
+ JSONObject error = new JSONObject();
+ error.put("error","Http request did not contain user info, cannot retrieve functional menu");
+ jsonResponse.put(error);
+ response.getWriter().write(jsonResponse.toString());
+ }
+ } catch (Exception e) {
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application/json");
+ JSONArray jsonResponse = new JSONArray();
+ JSONObject error = new JSONObject();
+ try {
+ if ( null == e.getMessage() ) {
+ error.put("error","No menu data");
+ } else {
+ error.put("error",e.getMessage());
+ }
+ jsonResponse.put(error);
+ response.getWriter().write(jsonResponse.toString());
+ logger.error(EELFLoggerDelegate.errorLogger, "Error getting functional_menu: " + e.getMessage(),AlarmSeverityEnum.MAJOR);
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ }
+
+ //--------------------------------------------------------------------------
+ // Makes a synchronous call to ECOMP Portal to get the JSON file that
+ // contains the contents of the functional menu. The JSON file will be
+ // in the payload of the returned UEB message.
+ //--------------------------------------------------------------------------
+ private String getFunctionalMenu(String userId) throws UebException
+ {
+ String returnString = null;
+ UebMsg funcMenuUebMsg = null;
+ UebMsg msg = new UebMsg();
+ msg.putMsgType(UebMsgTypes.UEB_MSG_TYPE_GET_FUNC_MENU);
+ msg.putUserId(userId);
+ funcMenuUebMsg = UebManager.getInstance().requestReply(msg);
+ if (funcMenuUebMsg != null) {
+ if (funcMenuUebMsg.getPayload().startsWith("Error:")) {
+ logger.error(EELFLoggerDelegate.errorLogger, "getFunctionalMenu received an error in UEB msg = " + funcMenuUebMsg.getPayload());
+ } else {
+ returnString = funcMenuUebMsg.getPayload();
+ }
+ }
+
+ logger.debug(EELFLoggerDelegate.debugLogger, "FunctionalMenu response: " + returnString);
+
+ return returnString;
+ }
+
+ private String getFunctionalMenuViaREST(String userId) {
+ String appName = "";
+ String requestId = "";
+ String appUserName = "";
+ String decryptedPwd = "";
+
+ logger.info(EELFLoggerDelegate.debugLogger, "Making use of REST API communication and Requesting functional menu for user " + userId);
+
+ App app = appService.getDefaultApp();
+ if (app!=null) {
+ appName = app.getName();
+ appUserName = app.getUsername();
+ try{
+ decryptedPwd = CipherUtil.decrypt(app.getAppPassword(), SystemProperties.getProperty(SystemProperties.Decryption_Key));
+ } catch(Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in WebServiceCallServiceImpl.get while decrypting the password. Details: " + e.toString());
+ }
+ } else {
+ logger.warn(EELFLoggerDelegate.errorLogger, "Unable to locate the app information from the database.");
+ appName = SystemProperties.SDK_NAME;
+ }
+ requestId = MDC.get(MDC_KEY_REQUEST_ID);
+
+ String fnMenu = null;
+ try {
+ fnMenu = FunctionalMenuClient.getFunctionalMenu(userId, appName, requestId, appUserName, decryptedPwd);
+ }catch(Exception ex) {
+ fnMenu = "Failed to get functional menu: " + ex.toString();
+ }
+
+ logger.debug(EELFLoggerDelegate.debugLogger, "FunctionalMenu response: {}", fnMenu);
+
+ return fnMenu;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FusionBaseController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FusionBaseController.java
new file mode 100644
index 00000000..c7820115
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FusionBaseController.java
@@ -0,0 +1,135 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.core.domain.MenuData;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.interfaces.SecurityInterface;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.menu.MenuBuilder;
+import org.openecomp.portalsdk.core.service.AppService;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.service.FnMenuService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ModelAttribute;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+public abstract class FusionBaseController implements SecurityInterface{
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FusionBaseController.class);
+
+ @Override
+ public boolean isAccessible() {
+ return true;
+ }
+
+ public boolean isRESTfulCall(){
+ return true;
+ }
+ @Autowired
+ private FnMenuService fnMenuService;
+
+ @Autowired
+ private MenuBuilder menuBuilder;
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ @Autowired
+ AppService appService;
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @ModelAttribute("menu")
+ public Map<String, Object> getMenu(HttpServletRequest request) {
+ HttpSession session = null;
+ Map<String, Object> model = new HashMap<String, Object>();
+ try {
+ try {
+ String appName = appService.getDefaultAppName();
+ if (appName==null || appName=="") {
+ appName = SystemProperties.SDK_NAME;
+ }
+ logger.setRequestBasedDefaultsIntoGlobalLoggingContext(request, appName);
+ } catch (Exception e) {
+ }
+
+ session = request.getSession();
+ User user = UserUtils.getUserSession(request);
+ if(session!=null && user!=null){
+ Set<MenuData> menuResult = (Set<MenuData>) session.getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME));
+ if(menuResult==null){
+ Set appMenu = getMenuBuilder().getMenu(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME),dataAccessService);
+ session.setAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME), MenuBuilder.filterMenu(appMenu, request));
+ menuResult = (Set<MenuData>) session.getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME));
+ }
+ model = setMenu(menuResult);
+ }
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage());
+ }
+ return model;
+ }
+
+ public Map<String, Object> setMenu(Set<MenuData> menuResult) throws Exception{
+ ObjectMapper mapper = new ObjectMapper();
+ List<List<MenuData>> childItemList = new ArrayList<List<MenuData>>();;
+ List<MenuData> parentList = new ArrayList<MenuData>();;
+ Map<String, Object> model = new HashMap<String, Object>();
+ try{
+ fnMenuService.setMenuDataStructure(childItemList, parentList, menuResult);
+ }catch(Exception e){
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage());
+ }
+ model.put("childItemList",childItemList!=null?mapper.writeValueAsString(childItemList):"");
+ model.put("parentList",parentList!=null?mapper.writeValueAsString(parentList):"");
+ return model;
+ }
+
+ public MenuBuilder getMenuBuilder() {
+ return menuBuilder;
+ }
+
+ public void setMenuBuilder(MenuBuilder menuBuilder) {
+ this.menuBuilder = menuBuilder;
+ }
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/LogoutController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/LogoutController.java
new file mode 100644
index 00000000..57983621
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/LogoutController.java
@@ -0,0 +1,110 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+@RequestMapping("/")
+public class LogoutController extends UnRestrictedBaseController{
+
+ private User user;
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LogoutController.class);
+ /**
+ * @param request
+ * @param response
+ * @return modelView
+ *
+ * globalLogout will invalid the current application session, then redirects to portal logout
+ */
+ @RequestMapping(value = {"/logout.htm" }, method = RequestMethod.GET)
+ public ModelAndView globalLogout(HttpServletRequest request, HttpServletResponse response) {
+ ModelAndView modelView = null;
+ try{
+ chatRoomLogout(request);
+ request.getSession().invalidate();
+ String portalUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL);
+ String portalDomain = portalUrl.substring(0, portalUrl.lastIndexOf('/'));
+ String redirectUrl = portalDomain+"/logout.htm";
+ modelView = new ModelAndView("redirect:"+redirectUrl);
+ }catch(Exception e){
+ logger.error(EELFLoggerDelegate.errorLogger, "Logout Error: " + e.getMessage(),AlarmSeverityEnum.MAJOR);
+ }
+ return modelView;
+ }
+
+ /**
+ * @param request
+ * @param response
+ * @return modelView
+ *
+ * appLogout is a function that will invalid the current session (application logout) and redirects user to Portal.
+ */
+ @RequestMapping(value = {"/app_logout.htm" }, method = RequestMethod.GET)
+ public ModelAndView appLogout(HttpServletRequest request, HttpServletResponse response) {
+ ModelAndView modelView = null;
+ try{
+ chatRoomLogout(request);
+ modelView = new ModelAndView("redirect:"+PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL));
+ UserUtils.clearUserSession(request);
+ request.getSession().invalidate();
+ }catch(Exception e){
+ logger.error(EELFLoggerDelegate.errorLogger, "Application Logout Error: " + e.getMessage(),AlarmSeverityEnum.MAJOR);
+ }
+ return modelView;
+ }
+
+
+ public void chatRoomLogout(HttpServletRequest request){
+ request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
+ setUser(UserUtils.getUserSession(request));
+ // if(getUser()!=null){
+ // Long login_IdLong = getUser().getId();
+ // String name = getUser().getFirstName();
+ // String login_IdStr = Long.toString(login_IdLong);
+ // }
+ //UserListName.getInstance().delUserName(name);
+ //UserListID.getInstance().delUserName(login_IdStr);
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ public void setUser(User user) {
+ this.user = user;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/MenuListController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/MenuListController.java
new file mode 100644
index 00000000..ee66a948
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/MenuListController.java
@@ -0,0 +1,245 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.domain.MenuData;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
+import org.openecomp.portalsdk.core.restful.client.SharedContextRestClient;
+import org.openecomp.portalsdk.core.restful.domain.SharedContext;
+import org.openecomp.portalsdk.core.service.AppService;
+import org.openecomp.portalsdk.core.service.FnMenuService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+@Controller
+@RequestMapping("/")
+public class MenuListController extends UnRestrictedBaseController{
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MenuListController.class);
+ @Autowired
+ AppService appService;
+ @Autowired
+ FnMenuService fnMenuService;
+ @Autowired
+ SharedContextRestClient sharedContextRestClient;
+ /**
+ *
+ * Get Menu items and store into session.
+ *
+ * @param request
+ * @param response
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = {"/get_menu" }, method = RequestMethod.GET)
+ public void ProfileSearch(HttpServletRequest request, HttpServletResponse response) {
+ logger.info("calling /get_menu..");
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ Set<MenuData> menuResult=null;
+ HttpSession session = request.getSession();
+ List<List<MenuData>> childItemList = (List<List<MenuData>>) session.getAttribute(SystemProperties.LEFT_MENU_CHILDREND);
+ List<MenuData> parentList = (List<MenuData>) session.getAttribute(SystemProperties.LEFT_MENU_PARENT);
+ if(parentList==null || childItemList==null || parentList.size()==0 || childItemList.size()==0){
+ childItemList=new ArrayList<List<MenuData>>();
+ parentList = new ArrayList<MenuData>();
+ menuResult = (Set<MenuData>) session.getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME));
+ fnMenuService.setMenuDataStructure(childItemList, parentList, menuResult);
+ logger.info("storing leftmenu items into session");
+ session.setAttribute(SystemProperties.LEFT_MENU_PARENT, parentList);
+ session.setAttribute(SystemProperties.LEFT_MENU_CHILDREND, childItemList);
+ }
+ String userName = (String) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_NAME));
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(parentList),mapper.writeValueAsString(childItemList),userName);
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ logger.info("done with /get_menu call without any errors");
+ } catch (Exception e) {
+ logger.info("errors while calling /get_menu",e);
+ }
+ }
+
+ /**
+ *
+ * Get app name from system.properties file.
+ *
+ * @param request
+ * @param response
+ */
+
+ @RequestMapping(value = {"/get_app_name" }, method = RequestMethod.GET)
+ public void getAppName(HttpServletRequest request, HttpServletResponse response) {
+ logger.info("calling /get_app_name.");
+ HttpSession session = request.getSession(true);
+ try {
+ // String appName = SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME);
+ String appName = (String) session.getAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME));
+ if(appName!=null && appName.equals("app_display_name")){
+ appName = "";
+ }
+ JsonMessage msg = new JsonMessage(appName);
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ logger.info("done with /get_app_name call without any errors");
+ } catch (Exception e) {
+ logger.error("errors while calling /get_app_name",e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @ModelAttribute("menu")
+ public Map<String, Object> getLeftMenuJSP(HttpServletRequest request) {
+ logger.info("invoking getting left menu");
+ ObjectMapper mapper = new ObjectMapper();
+ Map<String, Object> model = new HashMap<String, Object>();
+ try {
+ HttpSession session = request.getSession();
+ List<List<MenuData>> childItemList = (List<List<MenuData>>) session.getAttribute(SystemProperties.LEFT_MENU_CHILDREND);
+ List<MenuData> parentList = (List<MenuData>) session.getAttribute(SystemProperties.LEFT_MENU_PARENT);
+ if(parentList==null || childItemList==null){
+ childItemList=new ArrayList<List<MenuData>>();
+ parentList = new ArrayList<MenuData>();
+ Set<MenuData> menuResult = (Set<MenuData>) session.getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME));
+ fnMenuService.setMenuDataStructure(childItemList, parentList, menuResult);
+ session.setAttribute(SystemProperties.LEFT_MENU_PARENT, parentList);
+ session.setAttribute(SystemProperties.LEFT_MENU_CHILDREND, childItemList);
+ }
+ model.put("childItemList",mapper.writeValueAsString(childItemList));
+ model.put("parentList",mapper.writeValueAsString(parentList));
+ } catch (Exception e) {
+ logger.info("errors while getting left menu",e);
+ }
+ logger.info("done with getting left menu without any errors");
+ return model;
+ }
+
+ /**
+ * Answers requests for user information, which is fetched from the shared context at Portal.
+ *
+ * @param request
+ * @param response
+ * @return JSON block with user information.
+ */
+ @RequestMapping(value = {"/get_userinfo" }, method = RequestMethod.GET)
+ public String getUserInfo(HttpServletRequest request, HttpServletResponse response) {
+ logger.info(EELFLoggerDelegate.debugLogger, "Getting shared context for user");
+ try{
+ String contextId= null;
+ if(request.getCookies()!=null){
+ for(Cookie ck :request.getCookies()){
+ if(ck.getName().equalsIgnoreCase("EPService"))
+ contextId = ck.getValue();
+ }
+ }
+ logger.info(EELFLoggerDelegate.debugLogger, "ContextId is : " + contextId);
+ List<SharedContext> sharedContextRes = sharedContextRestClient.getUserContext(contextId);
+ logger.info(EELFLoggerDelegate.debugLogger, "Shared Context Response is : " + sharedContextRes);
+ Map<String, Object> model = new HashMap<String, Object>();
+ for(SharedContext sharedContext: sharedContextRes){
+ model.put(sharedContext.getCkey(), sharedContext.getCvalue());
+ }
+ JSONObject j = new JSONObject(model);
+ response.getWriter().write(j.toString());
+ } catch(Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Failed to get shared context for user" + e.getMessage());
+ }
+ return null;
+ }
+
+ /**
+ * Get User information from app sessions
+ * @param request
+ * @param response
+ */
+ @RequestMapping(value = {"/get_topMenuInfo" }, method = RequestMethod.GET)
+ public void getTopMenu(HttpServletRequest request, HttpServletResponse response) {
+
+ HttpSession session = request.getSession();
+ try {
+ String userName = (String) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_NAME));
+ String firstName = (String) session.getAttribute(SystemProperties.FIRST_NAME);
+ String lastName = (String) session.getAttribute(SystemProperties.LAST_NAME);
+ User user = (User) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME));
+ Map<String,String> map = new HashMap<String,String>();
+ String redirectUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL);
+ String portalDomain = redirectUrl.substring(0, redirectUrl.lastIndexOf('/'));
+ String portalUrl = portalDomain + "/processSingleSignOn";
+ String getAccessUrl = portalDomain + "/get_access";
+ String email = user.getEmail();
+ String contactUsLink = SystemProperties.getProperty(SystemProperties.CONTACT_US_LINK);
+ String userId = UserUtils.getUserIdFromCookie(request);
+
+ map.put("portalUrl", portalUrl);
+ map.put("contactUsLink", contactUsLink);
+ map.put("userName", userName);
+ map.put("firstName", firstName);
+ map.put("lastName", lastName);
+ map.put("userid", userId);
+ map.put("email", email);
+ map.put("getAccessUrl",getAccessUrl);
+ JSONObject j = new JSONObject(map);
+ response.getWriter().write(j.toString());
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Failed to serialize JSON" + e.getMessage());
+ }
+
+ }
+
+ @RequestMapping(value = {"/page_redirect" }, method = RequestMethod.GET)
+ public void pageRedirect(HttpServletRequest request, HttpServletResponse response) {
+ String pageToURL=null;
+ try {
+ String pageTo = request.getParameter("page");
+ if(pageTo.equals("contact"))
+ pageToURL = SystemProperties.getProperty(SystemProperties.CONTACT_US_LINK);
+ else if(pageTo.equals("access")){
+ String redirectUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL);
+ String portalDomain = redirectUrl.substring(0, redirectUrl.lastIndexOf('/'));
+ pageToURL = portalDomain + "/get_access";
+ }
+ response.getWriter().write(pageToURL);
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Failed to serialize JSON" + e.getMessage());
+ }
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/PostSearchController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/PostSearchController.java
new file mode 100644
index 00000000..fa5a1082
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/PostSearchController.java
@@ -0,0 +1,219 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.command.PostSearchBean;
+import org.openecomp.portalsdk.core.domain.Lookup;
+import org.openecomp.portalsdk.core.domain.Profile;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.LdapService;
+import org.openecomp.portalsdk.core.service.PostSearchService;
+import org.openecomp.portalsdk.core.service.ProfileService;
+import org.openecomp.portalsdk.core.service.UserProfileService;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+@RequestMapping("/")
+public class PostSearchController extends RestrictedBaseController {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PostSearchController.class);
+
+ @SuppressWarnings("rawtypes")
+ private static List sortByList = null;
+
+ @Autowired
+ private PostSearchService postSearchService;
+
+ @Autowired
+ LdapService ldapService;
+
+ @Autowired
+ private ProfileService profileService;
+
+ @Autowired
+ UserProfileService userProfileService;
+
+ public UserProfileService getUserProfileService() {
+ return userProfileService;
+ }
+
+ public void setUserProfileService(UserProfileService userProfileService) {
+ this.userProfileService = userProfileService;
+ }
+
+ @RequestMapping(value = { "/post_search" }, method = RequestMethod.GET)
+ public ModelAndView welcome(HttpServletRequest request,
+ @ModelAttribute("postSearchBean") PostSearchBean postSearchBean) {
+ Map<String, Object> model = new HashMap<String, Object>();
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ postSearchBean = new PostSearchBean();
+ model.put("profileList", mapper.writeValueAsString(postSearchBean.getSearchResult()));
+ model.put("postSearchBean", mapper.writeValueAsString(postSearchBean));
+ model.put("existingUsers", mapper.writeValueAsString(getExistingUsers()));
+ model.put("sortByList", mapper.writeValueAsString(getSortByList()));
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger, "welcome: failed to write JSON" + ex.getMessage());
+ }
+
+ return new ModelAndView(getViewName(), model);
+ }
+
+ @RequestMapping(value = { "/post_search_sample" }, method = RequestMethod.GET)
+ public void getPostSearchProfile(HttpServletRequest request, HttpServletResponse response,
+ @ModelAttribute("postSearchBean") PostSearchBean postSearchBean) {
+ Map<String, Object> model = new HashMap<String, Object>();
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ postSearchBean = new PostSearchBean();
+ model.put("profileList", mapper.writeValueAsString(postSearchBean.getSearchResult()));
+ model.put("postSearchBean", mapper.writeValueAsString(postSearchBean));
+ model.put("existingUsers", mapper.writeValueAsString(getExistingUsers()));
+ model.put("sortByList", mapper.writeValueAsString(getSortByList()));
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger, "getPostSearchProfile: failed to write JSON" + ex.getMessage());
+ }
+
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ private HashMap getExistingUsers() {
+ HashMap existingUsers = new HashMap();
+
+ List<Profile> list = profileService.findAll();
+
+ if (list != null) {
+ Iterator<Profile> i = list.iterator();
+ while (i.hasNext()) {
+ Profile user = i.next();
+ String orgUserId = user.getOrgUserId();
+ Long id = user.getId(); // id scalar
+ if (orgUserId != null)
+ existingUsers.put(orgUserId, id);
+ }
+ }
+ return existingUsers;
+ }
+
+ @RequestMapping(value = { "/post_search/search" }, method = RequestMethod.POST)
+ public ModelAndView search(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ PostSearchBean postSearchBean = mapper.readValue(root.get("postSearchBean").toString(),
+ PostSearchBean.class);
+
+ //postSearchBean.setSearchResult(loadSearchResultData(request, postSearchBean));
+ List<User> users = loadSearchResultDataFromFnTableOrExt(request,postSearchBean);
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+ String responseString = mapper.writeValueAsString(users);
+ JSONObject j = new JSONObject("{users: " + responseString + "}");
+
+ out.write(j.toString());
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger, "search: failed to send search result" + ex.getMessage());
+ }
+
+ return null;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public static List getSortByList() {
+ if (sortByList == null) {
+ sortByList = new ArrayList();
+ sortByList.add(new Lookup("Last Name", "last_name"));
+ sortByList.add(new Lookup("First Name", "first_name"));
+ sortByList.add(new Lookup("HRID", "hrid"));
+ sortByList.add(new Lookup("SBCID", "sbcid"));
+ sortByList.add(new Lookup("Organization", "org_code"));
+ sortByList.add(new Lookup("Email", "email"));
+ } // if
+
+ return sortByList;
+ } // getSortByList
+
+ private List<User> loadSearchResultDataFromFnTableOrExt(HttpServletRequest request, PostSearchBean searchCriteria)
+ throws Exception {
+ return userProfileService.searchPost(searchCriteria.getUser(), searchCriteria.getSortBy1(),
+ searchCriteria.getSortBy2(), searchCriteria.getSortBy3(), searchCriteria.getPageNo(),
+ searchCriteria.getNewDataSize(), UserUtils.getUserSession(request).getId().intValue());
+ }
+
+ @RequestMapping(value = { "/post_search/process" }, method = RequestMethod.POST)
+ public ModelAndView process(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
+ JsonNode root = mapper.readTree(request.getReader());
+ PostSearchBean postSearch = mapper.readValue(root.get("postSearchBean").toString(), PostSearchBean.class);
+
+ postSearchService.process(request, postSearch);
+ List<User> users = loadSearchResultDataFromFnTableOrExt(request,postSearch);
+
+ logger.info(EELFLoggerDelegate.auditLogger, "Import new user from webphone ");
+
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+ String userString = mapper.writeValueAsString(users);
+ JSONObject j = new JSONObject("{users: " + userString + ",existingUsers: "
+ + mapper.writeValueAsString(getExistingUsers()) + "}");
+
+ out.write(j.toString());
+
+ return null;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileController.java
new file mode 100644
index 00000000..1fd7800f
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileController.java
@@ -0,0 +1,349 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.RoleService;
+import org.openecomp.portalsdk.core.service.UserProfileService;
+import org.openecomp.portalsdk.core.web.support.AppUtils;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+@RequestMapping("/")
+public class ProfileController extends RestrictedBaseController {
+
+ @Autowired
+ UserProfileService service;
+ @Autowired
+ RoleService roleService;
+
+ String viewName;
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ProfileController.class);
+
+ @RequestMapping(value = { "/profile" }, method = RequestMethod.GET)
+ public ModelAndView profile(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+
+ User profile = null;
+ Long profileId = null;
+
+ if (request.getRequestURI().indexOf("self_profile.htm") > -1) {
+ profile = UserUtils.getUserSession(request);
+ profileId = profile.getId();
+ } else {
+ profileId = Long.parseLong(request.getParameter("profile_id"));
+ profile = (User) service.getUser(request.getParameter("profile_id"));
+ }
+
+ try {
+ model.put("stateList", mapper.writeValueAsString(getStates()));
+ model.put("countries", mapper.writeValueAsString(getCountries()));
+ model.put("timeZones", mapper.writeValueAsString(getTimeZones()));
+ model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles()));
+ model.put("profile", mapper.writeValueAsString(profile));
+ model.put("profileId", mapper.writeValueAsString(profileId));
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "profile: failed to write JSON" + e.getMessage());
+ }
+ return new ModelAndView("profile", "model", model);
+ }
+
+ @RequestMapping(value = { "/self_profile" }, method = RequestMethod.GET)
+ public ModelAndView self_profile(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+
+ User profile = null;
+ Long profileId = null;
+
+ profile = UserUtils.getUserSession(request);
+ profileId = profile.getId();
+ profile = (User) service.getUser(profileId.toString());
+
+ try {
+ model.put("stateList", mapper.writeValueAsString(getStates()));
+ model.put("countries", mapper.writeValueAsString(getCountries()));
+ model.put("timeZones", mapper.writeValueAsString(getTimeZones()));
+ model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles()));
+ model.put("profile", mapper.writeValueAsString(profile));
+ model.put("profileId", mapper.writeValueAsString(profileId));
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "self_profile: failed to write JSON" + e.getMessage());
+ }
+ return new ModelAndView("profile", "model", model);
+ }
+
+ @RequestMapping(value = { "/get_self_profile" }, method = RequestMethod.GET)
+ public void getSelfProfile(HttpServletRequest request, HttpServletResponse response) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+
+ User profile = null;
+ Long profileId = null;
+
+ profile = UserUtils.getUserSession(request);
+ profileId = profile.getId();
+ profile = (User) service.getUser(profileId.toString());
+
+ try {
+ model.put("stateList", mapper.writeValueAsString(getStates()));
+ model.put("countries", mapper.writeValueAsString(getCountries()));
+ model.put("timeZones", mapper.writeValueAsString(getTimeZones()));
+ model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles()));
+ model.put("profile", mapper.writeValueAsString(profile));
+ model.put("profileId", mapper.writeValueAsString(profileId));
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "getSelfProfile: failed to write JSON" + e.getMessage());
+ }
+
+ }
+
+ @RequestMapping(value = { "/get_profile" }, method = RequestMethod.GET)
+ public void GetUser(HttpServletRequest request, HttpServletResponse response) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ User profile = null;
+ Long profileId = null;
+ if (request.getRequestURI().indexOf("self_profile.htm") > -1) {
+ profile = UserUtils.getUserSession(request);
+ profileId = profile.getId();
+ } else {
+ profileId = Long.parseLong(request.getParameter("profile_id"));
+ profile = (User) service.getUser(request.getParameter("profile_id"));
+ }
+ model.put("stateList", mapper.writeValueAsString(getStates()));
+ model.put("countries", mapper.writeValueAsString(getCountries()));
+ model.put("timeZones", mapper.writeValueAsString(getTimeZones()));
+ model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles()));
+ model.put("profile", mapper.writeValueAsString(profile));
+ model.put("profileId", mapper.writeValueAsString(profileId));
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "GetUser: failed to write JSON" + e.getMessage());
+ }
+ }
+
+ @RequestMapping(value = { "/profile/saveProfile" }, method = RequestMethod.POST)
+ public ModelAndView saveProfile(HttpServletRequest request, HttpServletResponse response) {
+ logger.info(EELFLoggerDelegate.debugLogger, "ProfileController.save");
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ User user = mapper.readValue(root.get("profile").toString(), User.class);
+
+ String selectedCountry = mapper.readValue(root.get("selectedCountry").toString(), String.class);
+ String selectedState = mapper.readValue(root.get("selectedState").toString(), String.class);
+ String selectedTimeZone = mapper.readValue(root.get("selectedTimeZone").toString(), String.class);
+
+ Long profileId = Long.parseLong(request.getParameter("profile_id"));
+
+ User domainUser = (User) service.getUser(request.getParameter("profile_id"));
+ // user.setRoles(domainUser.getRoles());
+ user.setPseudoRoles(domainUser.getPseudoRoles());
+ user.setUserApps(domainUser.getUserApps());
+ if (!selectedCountry.equals("")) {
+ user.setCountry(selectedCountry);
+ }
+ if (!selectedState.equals("")) {
+ user.setState(selectedState);
+ }
+ if (!selectedTimeZone.equals("")) {
+ user.setTimeZoneId(Long.parseLong(selectedTimeZone));
+ }
+ service.saveUser(user);
+ logger.info(EELFLoggerDelegate.auditLogger, "Save user's profile for user " + profileId);
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+ out.write("" + profileId);
+ return null;
+ } catch (Exception e) {
+ response.setCharacterEncoding("UTF-8");
+ try {
+ request.setCharacterEncoding("UTF-8");
+ } catch (UnsupportedEncodingException e1) {
+
+ e1.printStackTrace();
+
+ }
+ PrintWriter out = null;
+ try {
+ out = response.getWriter();
+ } catch (IOException e1) {
+ logger.error(EELFLoggerDelegate.errorLogger, "saveProfile: failed to get writer" + e1.getMessage());
+ }
+ out.write(e.getMessage());
+ return null;
+ }
+ }
+
+ @RequestMapping(value = { "/profile/removeRole" }, method = RequestMethod.POST)
+ public ModelAndView removeRole(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ logger.info(EELFLoggerDelegate.debugLogger, "ProfileController.save");
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ Role role = mapper.readValue(root.get("role").toString(), Role.class);
+
+ // Long profileId = Long.parseLong(request.getParameter("profile_id"));
+
+ User domainUser = (User) service.getUser(request.getParameter("profile_id"));
+
+ domainUser.removeRole(role.getId());
+
+ service.saveUser(domainUser);
+ logger.info(EELFLoggerDelegate.auditLogger, "Remove role " + role.getId() + " from user " + request.getParameter("profile_id"));
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+
+ Map<String, Object> model = new HashMap<String, Object>();
+ model.put("profile", mapper.writeValueAsString(domainUser));
+ JSONObject j = new JSONObject(mapper.writeValueAsString(domainUser));
+
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "removeRole" + e.getMessage());
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+
+ @RequestMapping(value = { "/profile/addNewRole" }, method = RequestMethod.POST)
+ public ModelAndView addNewRole(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ logger.info(EELFLoggerDelegate.debugLogger, "ProfileController.save" );
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ Role role = mapper.readValue(root.get("role").toString(), Role.class);
+
+ // Long profileId = Long.parseLong(request.getParameter("profile_id"));
+
+ User domainUser = (User) service.getUser(request.getParameter("profile_id"));
+
+ domainUser.addRole(role);
+
+ service.saveUser(domainUser);
+ logger.info(EELFLoggerDelegate.auditLogger, "Add new role " + role.getName() + " to user " + request.getParameter("profile_id"));
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+
+ Map<String, Object> model = new HashMap<String, Object>();
+ model.put("profile", mapper.writeValueAsString(domainUser));
+ JSONObject j = new JSONObject(mapper.writeValueAsString(domainUser));
+
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "addNewRole" + e.getMessage());
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+
+ public String getViewName() {
+ return viewName;
+ }
+
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public List getStates() {
+ return AppUtils.getLookupList("FN_LU_STATE", "STATE_CD", "STATE", null, "STATE_CD");
+ }
+
+ @SuppressWarnings("rawtypes")
+ public List getCountries() {
+ return AppUtils.getLookupList("FN_LU_COUNTRY", "COUNTRY_CD", "COUNTRY", null, "COUNTRY");
+ }
+
+ @SuppressWarnings("rawtypes")
+ public List getTimeZones() {
+ return AppUtils.getLookupList("FN_LU_TIMEZONE", "TIMEZONE_ID", "TIMEZONE_NAME", null, "TIMEZONE_NAME");
+ }
+
+ @SuppressWarnings("rawtypes")
+ public List getAvailableRoles() {
+ return roleService.getAvailableRoles();
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileSearchController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileSearchController.java
new file mode 100644
index 00000000..42ebd41e
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileSearchController.java
@@ -0,0 +1,149 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.domain.MenuData;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.FnMenuService;
+import org.openecomp.portalsdk.core.service.UserProfileService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+@RequestMapping("/")
+public class ProfileSearchController extends RestrictedBaseController{
+ @Autowired
+ UserProfileService service;
+ @Autowired
+ FnMenuService fnMenuService;
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ProfileSearchController.class);
+ @RequestMapping(value = {"/profile_search" }, method = RequestMethod.GET)
+ public ModelAndView ProfileSearch(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+ List<User> profileList =null;
+ logger.info(EELFLoggerDelegate.applicationLogger, "Initiating ProfileSearch in ProfileSearchController");
+ try {
+ profileList = service.findAll();
+ model.putAll(setDashboardData(request));
+ model.put("profileList", mapper.writeValueAsString(profileList));
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "error while profile_search process in ProfileSearchController" + e.getMessage());
+ }
+ return new ModelAndView(getViewName(),"model", model);
+ }
+
+ @RequestMapping(value = {"/get_user" }, method = RequestMethod.GET)
+ public void GetUser(HttpServletRequest request, HttpServletResponse response) {
+ logger.info(EELFLoggerDelegate.applicationLogger, "Initiating get_user in ProfileSearchController");
+ ObjectMapper mapper = new ObjectMapper();
+ List<User> profileList =null;
+ try {
+ profileList = service.findAll();
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(profileList));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "error while get_user process in ProfileSearchController" + e.getMessage());
+ }
+ }
+
+ @RequestMapping(value = {"/get_user_pagination" }, method = RequestMethod.GET)
+ public void getUserPagination(HttpServletRequest request, HttpServletResponse response) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+ logger.info(EELFLoggerDelegate.applicationLogger, "Initiating get_user_pagination in ProfileSearchController");
+ int pageNum = Integer.parseInt(request.getParameter("pageNum"));
+ int viewPerPage = Integer.parseInt(request.getParameter("viewPerPage"));
+ List<User> profileList =null;
+ try {
+ profileList = service.findAll();
+ model.put("totalPage",(int) Math.ceil((double)profileList.size() / viewPerPage));
+ profileList = profileList.subList(viewPerPage*(pageNum-1)<profileList.size()?viewPerPage*(pageNum-1):profileList.size(), viewPerPage*pageNum<profileList.size()?viewPerPage*pageNum:profileList.size());
+ model.put("profileList", mapper.writeValueAsString(profileList));
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "error while get_user_pagination process in ProfileSearchController" + e.getMessage());
+ }
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public Map<String, Object>setDashboardData(HttpServletRequest request) throws Exception{
+ ObjectMapper mapper = new ObjectMapper();
+ Map<String, Object> model = new HashMap<String, Object>();
+ List<List<MenuData>> childItemList = new ArrayList<List<MenuData>>();
+ List<MenuData> parentList = new ArrayList<MenuData>();
+ logger.info(EELFLoggerDelegate.applicationLogger, "Initiating setDashboardData in ProfileSearchController");
+ HttpSession session = request.getSession();
+ try{
+ Set<MenuData> menuResult = (Set<MenuData>) session.getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME));
+ fnMenuService.setMenuDataStructure(childItemList, parentList, menuResult);
+ }catch(Exception e){
+ logger.error(EELFLoggerDelegate.applicationLogger, "error while setDashboardData process in ProfileSearchController" + e.getMessage());
+ }
+ model.put("childItemList",mapper.writeValueAsString(childItemList));
+ model.put("parentList",mapper.writeValueAsString(parentList));
+ return model;
+ }
+
+ @RequestMapping(value = {"/profile/toggleProfileActive" }, method = RequestMethod.GET)
+ public void toggleProfileActive(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ try{
+ logger.info(EELFLoggerDelegate.applicationLogger, "Initiating toggleProfileActive in ProfileSearchController");
+ String userId = request.getParameter("profile_id");
+ User user = (User)service.getUser(userId);
+ user.setActive(!user.getActive());
+ service.saveUser(user);
+ logger.info(EELFLoggerDelegate.auditLogger, "Change active status for user " + user.getId() + " to " + user.getActive());
+ ObjectMapper mapper = new ObjectMapper();
+ response.setContentType("application/json");
+ PrintWriter out = response.getWriter();
+ out.write(mapper.writeValueAsString(user.getActive()));
+ }catch(Exception e){
+ logger.error(EELFLoggerDelegate.applicationLogger, "error while toggleProfileActive process in ProfileSearchController" + e.getMessage());
+ }
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedBaseController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedBaseController.java
new file mode 100644
index 00000000..2b2e3426
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedBaseController.java
@@ -0,0 +1,50 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+public class RestrictedBaseController extends FusionBaseController{
+
+ protected String viewName;
+ private String exceptionView;
+ @Override
+ public boolean isAccessible() {
+ return false;
+ }
+ @Override
+ public boolean isRESTfulCall(){
+ return false;
+ }
+ protected String getViewName() {
+ return viewName;
+ }
+ protected void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+ public String getExceptionView() {
+ return (exceptionView == null) ? "runtime_error_handler" : exceptionView;
+ }
+
+ public void setExceptionView(String exceptionView) {
+ this.exceptionView = exceptionView;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedRESTfulBaseController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedRESTfulBaseController.java
new file mode 100644
index 00000000..d11c7d76
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedRESTfulBaseController.java
@@ -0,0 +1,50 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+public class RestrictedRESTfulBaseController extends FusionBaseController{
+
+ protected String viewName;
+ private String exceptionView;
+ @Override
+ public boolean isAccessible() {
+ return false;
+ }
+ @Override
+ public boolean isRESTfulCall(){
+ return true;
+ }
+ protected String getViewName() {
+ return viewName;
+ }
+ protected void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+ public String getExceptionView() {
+ return (exceptionView == null) ? "runtime_error_handler" : exceptionView;
+ }
+
+ public void setExceptionView(String exceptionView) {
+ this.exceptionView = exceptionView;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleController.java
new file mode 100644
index 00000000..0419e2b8
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleController.java
@@ -0,0 +1,332 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.domain.RoleFunction;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.RoleService;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.ServletRequestUtils;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+
+@Controller
+@RequestMapping("/")
+public class RoleController extends RestrictedBaseController {
+ @Autowired
+ RoleService service;
+
+ String viewName;
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleController.class);
+
+ @RequestMapping(value = { "/role" }, method = RequestMethod.GET)
+ public ModelAndView role(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+
+ Role role = service.getRole(new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0)));
+ logger.info("role_id" + role.getId());
+ try {
+ model.put("availableRoleFunctions", mapper.writeValueAsString(service.getRoleFunctions()));
+ model.put("availableRoles", mapper.writeValueAsString(service.getAvailableChildRoles(role.getId())));
+ model.put("role", mapper.writeValueAsString(role));
+ } catch (Exception e) {
+ logger.error("role: failed", e);
+ logger.error(EELFLoggerDelegate.errorLogger, "Unable to set the active profile" + e.getMessage());
+ }
+ return new ModelAndView(getViewName(), model);
+ }
+
+ @RequestMapping(value = { "/get_role" }, method = RequestMethod.GET)
+ public void getRole(HttpServletRequest request, HttpServletResponse response) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+
+ Role role = service.getRole(new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0)));
+ logger.info(EELFLoggerDelegate.applicationLogger, "role_id" + role.getId());
+ try {
+ model.put("availableRoleFunctions", mapper.writeValueAsString(service.getRoleFunctions()));
+ model.put("availableRoles", mapper.writeValueAsString(service.getAvailableChildRoles(role.getId())));
+ model.put("role", mapper.writeValueAsString(role));
+
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "getRole failed" + e.getMessage());
+ }
+
+ }
+
+ @RequestMapping(value = { "/role/saveRole" }, method = RequestMethod.POST)
+ public ModelAndView saveRole(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.save");
+ logger.info(EELFLoggerDelegate.auditLogger, "RoleController.save");
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ Role role = mapper.readValue(root.get("role").toString(), Role.class);
+
+ List<Role> childRoles = mapper.readValue(root.get("childRoles").toString(),
+ TypeFactory.defaultInstance().constructCollectionType(List.class, Role.class));
+
+ List<RoleFunction> roleFunctions = mapper.readValue(root.get("roleFunctions").toString(),
+ TypeFactory.defaultInstance().constructCollectionType(List.class, RoleFunction.class));
+
+ Role domainRole = null;
+ if (role.getId() != null) {
+ logger.info(EELFLoggerDelegate.auditLogger, "updating existing role " + role.getId());
+ domainRole = service.getRole(role.getId());
+
+ domainRole.setName(role.getName());
+ domainRole.setPriority(role.getPriority());
+ } else {
+ logger.info(EELFLoggerDelegate.auditLogger, "saving as new role");
+ domainRole = new Role();
+ domainRole.setName(role.getName());
+ domainRole.setPriority(role.getPriority());
+ if (role.getChildRoles().size() > 0) {
+ for (Object childRole : childRoles) {
+ domainRole.addChildRole((Role) childRole);
+ }
+ }
+ if (role.getRoleFunctions().size() > 0) {
+ for (Object roleFunction : roleFunctions) {
+ domainRole.addRoleFunction((RoleFunction) roleFunction);
+ }
+ }
+ }
+
+ service.saveRole(domainRole);
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+ String responseString = mapper.writeValueAsString(domainRole);
+ JSONObject j = new JSONObject("{role: " + responseString + "}");
+
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "saveRole failed" + e.getMessage());
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+
+ @RequestMapping(value = { "/role/removeRoleFunction" }, method = RequestMethod.POST)
+ public ModelAndView removeRoleFunction(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.removeRoleFunction");
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ RoleFunction roleFunction = mapper.readValue(root.get("roleFunction").toString(), RoleFunction.class);
+
+ Role domainRole = service.getRole(new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0)));
+ logger.info(EELFLoggerDelegate.auditLogger, "Remove role function " + roleFunction.getCode() + " from role " + ServletRequestUtils.getIntParameter(request, "role_id", 0));
+
+ domainRole.removeRoleFunction(roleFunction.getCode());
+
+ service.saveRole(domainRole);
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+
+ String responseString = mapper.writeValueAsString(domainRole);
+ JSONObject j = new JSONObject("{role: " + responseString + "}");
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "removeRole failed" + e.getMessage());
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+
+ @RequestMapping(value = { "/role/addRoleFunction" }, method = RequestMethod.POST)
+ public ModelAndView addRoleFunction(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.removeRoleFunction");
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ RoleFunction roleFunction = mapper.readValue(root.get("roleFunction").toString(), RoleFunction.class);
+
+ Role domainRole = service.getRole(new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0)));
+
+ domainRole.addRoleFunction(roleFunction);
+
+ service.saveRole(domainRole);
+ logger.info(EELFLoggerDelegate.auditLogger, "Add role function " + roleFunction.getCode() + " to role " + ServletRequestUtils.getIntParameter(request, "role_id", 0));
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+
+ String responseString = mapper.writeValueAsString(domainRole);
+ JSONObject j = new JSONObject("{role: " + responseString + "}");
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "removeRoleFunction failed" + e.getMessage());
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+
+ @RequestMapping(value = { "/role/removeChildRole" }, method = RequestMethod.POST)
+ public ModelAndView removeChildRole(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.removeChileRole");
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ Role childRole = mapper.readValue(root.get("childRole").toString(), Role.class);
+
+ Role domainRole = service.getRole(new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0)));
+
+ domainRole.removeChildRole(childRole.getId());
+ logger.info(EELFLoggerDelegate.auditLogger, "remove child role " + childRole.getId() + " from role " + ServletRequestUtils.getIntParameter(request, "role_id", 0));
+
+
+ service.saveRole(domainRole);
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+
+ String responseString = mapper.writeValueAsString(domainRole);
+ JSONObject j = new JSONObject("{role: " + responseString + "}");
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "removeChildRole failed" + e.getMessage());
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+
+ @RequestMapping(value = { "/role/addChildRole" }, method = RequestMethod.POST)
+ public ModelAndView addChildRole(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.addChileRole");
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ Role childRole = mapper.readValue(root.get("childRole").toString(), Role.class);
+
+ Role domainRole = service.getRole(new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0)));
+
+ domainRole.addChildRole(childRole);
+
+ service.saveRole(domainRole);
+ logger.info(EELFLoggerDelegate.auditLogger, "Add child role " + childRole.getId() + " to role " + ServletRequestUtils.getIntParameter(request, "role_id", 0));
+
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+
+ String responseString = mapper.writeValueAsString(domainRole);
+ JSONObject j = new JSONObject("{role: " + responseString + "}");
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "addChildRole failed" + e.getMessage());
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+
+ public String getViewName() {
+ return viewName;
+ }
+
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleFunctionListController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleFunctionListController.java
new file mode 100644
index 00000000..3b9eed62
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleFunctionListController.java
@@ -0,0 +1,184 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.domain.RoleFunction;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.RoleService;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+@RequestMapping("/")
+public class RoleFunctionListController extends RestrictedBaseController {
+ @Autowired
+ RoleService service;
+
+ String viewName;
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleFunctionListController.class);
+
+ @RequestMapping(value = {"/role_function_list" }, method = RequestMethod.GET)
+ public ModelAndView welcome(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ model.put("availableRoleFunctions", mapper.writeValueAsString(service.getRoleFunctions()));
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return new ModelAndView(getViewName(),model);
+ }
+
+ @RequestMapping(value = {"/get_role_functions" }, method = RequestMethod.GET)
+ public void getRoleFunctionList(HttpServletRequest request,HttpServletResponse response) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ model.put("availableRoleFunctions", mapper.writeValueAsString(service.getRoleFunctions()));
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ @RequestMapping(value = {"/role_function_list/saveRoleFunction" }, method = RequestMethod.POST)
+ public ModelAndView saveRoleFunction(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ RoleFunction availableRoleFunction = mapper.readValue(root.get("availableRoleFunction").toString(), RoleFunction.class);
+
+ RoleFunction domainRoleFunction = service.getRoleFunction(availableRoleFunction.getCode());
+
+ //role. toggle active ind
+ domainRoleFunction.setName(availableRoleFunction.getName());
+ domainRoleFunction.setCode(availableRoleFunction.getCode());
+
+ service.saveRoleFunction(domainRoleFunction);
+ logger.info(EELFLoggerDelegate.auditLogger, "Save role function " + domainRoleFunction.getName());
+
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+ String responseString = mapper.writeValueAsString(service.getRoleFunctions());
+ JSONObject j = new JSONObject("{availableRoleFunctions: "+responseString+"}");
+
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+
+ @RequestMapping(value = {"/role_function_list/removeRoleFunction" }, method = RequestMethod.POST)
+ public ModelAndView removeRoleFunction(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ RoleFunction availableRoleFunction = mapper.readValue(root.get("availableRoleFunction").toString(), RoleFunction.class);
+
+ RoleFunction domainRoleFunction = service.getRoleFunction(availableRoleFunction.getCode());
+
+ service.deleteRoleFunction(domainRoleFunction);
+ logger.info(EELFLoggerDelegate.auditLogger, "Remove role function " + domainRoleFunction.getName());
+
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+
+ String responseString = mapper.writeValueAsString(service.getRoleFunctions());
+ JSONObject j = new JSONObject("{availableRoleFunctions: "+responseString+"}");
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ System.out.println(e);
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+
+ public String getViewName() {
+ return viewName;
+ }
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleListController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleListController.java
new file mode 100644
index 00000000..78fbc19f
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleListController.java
@@ -0,0 +1,179 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.RoleService;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+@RequestMapping("/")
+public class RoleListController extends RestrictedBaseController {
+ @Autowired
+ RoleService service;
+ String viewName;
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleListController.class);
+
+
+ @RequestMapping(value = {"/role_list" }, method = RequestMethod.GET)
+ public ModelAndView role(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ model.put("availableRoles", mapper.writeValueAsString(service.getAvailableRoles()));
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return new ModelAndView(getViewName(),model);
+ }
+
+ @RequestMapping(value = {"/get_roles" }, method = RequestMethod.GET)
+ public void getRoles(HttpServletRequest request, HttpServletResponse response) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ model.put("availableRoles", mapper.writeValueAsString(service.getAvailableRoles()));
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ @RequestMapping(value = {"/role_list/toggleRole" }, method = RequestMethod.POST)
+ public ModelAndView toggleRole(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ Role role = mapper.readValue(root.get("role").toString(), Role.class);
+
+ Role domainRole = service.getRole(role.getId());
+ //role. toggle active ind
+ boolean active = domainRole.getActive();
+ domainRole.setActive(!active);
+
+ service.saveRole(domainRole);
+ logger.info(EELFLoggerDelegate.auditLogger, "Toggle active status for role " + domainRole.getId());
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+ String responseString = mapper.writeValueAsString(service.getAvailableRoles());
+ JSONObject j = new JSONObject("{availableRoles: "+responseString+"}");
+
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+
+ @RequestMapping(value = {"/role_list/removeRole" }, method = RequestMethod.POST)
+ public ModelAndView removeRole(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ try {
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ Role role = mapper.readValue(root.get("role").toString(), Role.class);
+
+ Role domainRole = service.getRole(role.getId());
+
+ service.deleteDependcyRoleRecord(role.getId());
+ service.deleteRole(domainRole);
+ logger.info(EELFLoggerDelegate.auditLogger, "Remove role " + domainRole.getId());
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+
+ String responseString = mapper.writeValueAsString(service.getAvailableRoles());
+ JSONObject j = new JSONObject("{availableRoles: "+responseString+"}");
+ out.write(j.toString());
+
+ return null;
+ } catch (Exception e) {
+ System.out.println(e);
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+ return null;
+ }
+
+ }
+
+ public String getViewName() {
+ return viewName;
+ }
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/SingleSignOnController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/SingleSignOnController.java
new file mode 100644
index 00000000..4a0fb6f7
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/SingleSignOnController.java
@@ -0,0 +1,232 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.core.command.LoginBean;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.menu.MenuProperties;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalTimeoutHandler;
+import org.openecomp.portalsdk.core.service.LoginService;
+import org.openecomp.portalsdk.core.service.ProfileService;
+import org.openecomp.portalsdk.core.util.CipherUtil;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.AppUtils;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.util.WebUtils;
+
+@Controller
+@RequestMapping("/")
+public class SingleSignOnController extends UnRestrictedBaseController {
+
+ private static final String EP_SERVICE = "EPService";
+ private static final String USER_ID = "UserId";
+ public static final String DEFAULT_SUCCESS_VIEW = "welcome";
+ public static final String DEFAULT_FAILURE_VIEW = "login";
+ public static final String ERROR_MESSAGE_KEY = "error";
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SingleSignOnController.class);
+
+ @Autowired
+ ProfileService service;
+ @Autowired
+ private LoginService loginService;
+ String viewName;
+ private String welcomeView;
+
+ public String getWelcomeView() {
+ return welcomeView;
+ }
+
+ public void setWelcomeView(String welcomeView) {
+ this.welcomeView = welcomeView;
+ }
+
+ /**
+ * Handles requests directed to the single sign-on page by the session
+ * timeout interceptor.
+ *
+ * @param request
+ * @return Redirect to an appropriate address
+ * @throws Exception
+ */
+ @RequestMapping(value = { "/single_signon.htm" }, method = RequestMethod.GET)
+ public ModelAndView singleSignOnLogin(HttpServletRequest request) throws Exception {
+
+ Map<String, String> model = new HashMap<String, String>();
+ HashMap<String, String> additionalParamsMap = new HashMap<String, String>();
+ LoginBean commandBean = new LoginBean();
+
+ // SessionTimeoutInterceptor sets these parameters
+ String forwardURL = URLDecoder.decode(request.getParameter("forwardURL"), "UTF-8");
+ String redirectToPortal = request.getParameter("redirectToPortal");
+
+ if (isLoginCookieExist(request) && redirectToPortal == null) {
+ HttpSession session = null;
+ session = AppUtils.getSession(request);
+ User user = UserUtils.getUserSession(request);
+ if (session == null || user == null) {
+ String orgUserId = "";
+ orgUserId = getUserIdFromCookie(request);
+ commandBean.setUserid(orgUserId);
+ commandBean = getLoginService().findUser(commandBean,
+ (String) request.getAttribute(MenuProperties.MENU_PROPERTIES_FILENAME_KEY),
+ additionalParamsMap);
+ if (commandBean.getUser() == null) {
+ String loginErrorMessage = (commandBean.getLoginErrorMessage() != null)
+ ? commandBean.getLoginErrorMessage()
+ : SystemProperties.MESSAGE_KEY_LOGIN_ERROR_USER_NOT_FOUND;
+ model.put(ERROR_MESSAGE_KEY, SystemProperties.getProperty(loginErrorMessage));
+ final String redirectUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)
+ + "?noUserError=Yes";
+ logger.debug(EELFLoggerDelegate.debugLogger, "singleSignOnLogin: user is null, redirect URL is {}",
+ redirectUrl);
+ return new ModelAndView("redirect:" + redirectUrl);
+ } else {
+ // store the user's information in the session
+
+ UserUtils.setUserSession(request, commandBean.getUser(), commandBean.getMenu(),
+ commandBean.getBusinessDirectMenu(), "");
+ initateSessionMgtHandler(request);
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "singleSignOnLogin: create new user session for expired user {}; user {} exists in the system",
+ commandBean.getUser().getOrgUserId());
+ return new ModelAndView("redirect:" + forwardURL);
+ }
+ } // user is null or session is null
+ else {
+ // both user and session are non-null.
+ logger.info(EELFLoggerDelegate.debugLogger, "singleSignOnLogin: redirecting to the forwardURL {}",
+ forwardURL);
+ return new ModelAndView("redirect:" + forwardURL);
+ }
+
+ } else {
+ /*
+ * Login cookie not found, or redirect-to-portal parameter was found.
+ *
+ * Redirect the user to the portal with a suitable return URL. The
+ * forwardURL parameter that arrives as a parameter is a partial
+ * (not absolute) request path for a page in the application. The
+ * challenge here is to compute the correct absolute path for the
+ * original request so the portal can redirect the user back to the
+ * right place.
+ */
+ String returnToAppUrl = null;
+ if (SystemProperties.containsProperty(SystemProperties.APP_BASE_URL)) {
+ // New feature:
+ // application can publish a base URL in system.properties
+ String appUrl = SystemProperties.getProperty(SystemProperties.APP_BASE_URL);
+ returnToAppUrl = appUrl + (appUrl.endsWith("/") ? "" : "/") + forwardURL;
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "singleSignOnLogin: using app base URL {} and redirectURL {}", appUrl, returnToAppUrl);
+ } else {
+ // Be backward compatible with applications that don't need this
+ // feature.
+ // This is the controller for the single_signon.htm page, so the
+ // replace
+ // should always find the specified token.
+ returnToAppUrl = ((HttpServletRequest) request).getRequestURL().toString().replace("single_signon.htm",
+ forwardURL);
+ logger.debug(EELFLoggerDelegate.debugLogger, "singleSignOnLogin: computed redirectURL {}", returnToAppUrl);
+ }
+ final String encodedReturnToAppUrl = URLEncoder.encode(returnToAppUrl, "UTF-8");
+ // Also send the application's UEB key so Portal can block URL
+ // reflection attacks.
+ final String uebAppKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY);
+ final String url = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL);
+ final String portalUrl = url.substring(0, url.lastIndexOf('/')) + "/processSingleSignOn";
+ final String redirectUrl = portalUrl + "?uebAppKey=" + uebAppKey + "&redirectUrl=" + encodedReturnToAppUrl;
+ logger.debug(EELFLoggerDelegate.debugLogger, "singleSignOnLogin: portal-bound redirect URL is {}",
+ redirectUrl);
+ return new ModelAndView("redirect:" + redirectUrl);
+ }
+ }
+
+ protected void initateSessionMgtHandler(HttpServletRequest request) {
+ String portalJSessionId = getPortalJSessionId(request);
+ String jSessionId = getJessionId(request);
+ PortalTimeoutHandler.sessionCreated(portalJSessionId, jSessionId, AppUtils.getSession(request));
+ }
+
+ public boolean isLoginCookieExist(HttpServletRequest request) {
+ Cookie ep = WebUtils.getCookie(request, EP_SERVICE);
+ return (ep != null);
+ }
+
+ public static String getUserIdFromCookie(HttpServletRequest request) throws Exception {
+ String userId = "";
+ Cookie[] cookies = request.getCookies();
+ Cookie userIdcookie = null;
+ if (cookies != null)
+ for (Cookie cookie : cookies)
+ if (cookie.getName().equals(USER_ID))
+ userIdcookie = cookie;
+ if(userIdcookie!=null){
+ userId = CipherUtil.decrypt(userIdcookie.getValue(),
+ SystemProperties.getProperty(SystemProperties.Decryption_Key));
+ }
+ return userId;
+
+ }
+
+ public String getPortalJSessionId(HttpServletRequest request) {
+ Cookie ep = WebUtils.getCookie(request, EP_SERVICE);
+ return ep.getValue();
+
+ }
+
+ public String getJessionId(HttpServletRequest request) {
+ return request.getSession().getId();
+ }
+
+ public String getViewName() {
+ return viewName;
+ }
+
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+ public LoginService getLoginService() {
+ return loginService;
+ }
+
+ public void setLoginService(LoginService loginService) {
+ this.loginService = loginService;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UnRestrictedBaseController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UnRestrictedBaseController.java
new file mode 100644
index 00000000..78bf4c51
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UnRestrictedBaseController.java
@@ -0,0 +1,40 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+public class UnRestrictedBaseController extends FusionBaseController{
+ protected String viewName;
+
+ @Override
+ public boolean isAccessible() {
+ return true;
+ }
+ @Override
+ public boolean isRESTfulCall(){
+ return false;
+ }
+ protected String getViewName() {
+ return viewName;
+ }
+
+ protected void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UsageListController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UsageListController.java
new file mode 100644
index 00000000..c5616575
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UsageListController.java
@@ -0,0 +1,163 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.controller;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.command.UserRowBean;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.UsageUtils;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+@RequestMapping("/")
+public class UsageListController extends RestrictedBaseController {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UsageListController.class);
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @RequestMapping(value = { "/usage_list" }, method = RequestMethod.GET)
+ public ModelAndView usageList(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+
+ HttpSession httpSession = request.getSession();
+ HashMap activeUsers = (HashMap) httpSession.getServletContext().getAttribute("activeUsers");
+ if (activeUsers.size() == 0) {
+ activeUsers.put(httpSession.getId(), httpSession);
+ httpSession.getServletContext().setAttribute("activeUsers", activeUsers);
+ }
+ ArrayList<UserRowBean> rows = UsageUtils.getActiveUsers(activeUsers);
+ JSONArray ja = new JSONArray();
+ try {
+ for (UserRowBean userRowBean : rows) {
+ JSONObject jo = new JSONObject();
+ jo.put("id", userRowBean.getId());
+ jo.put("lastName", userRowBean.getLastName());
+ jo.put("email", userRowBean.getEmail());
+ jo.put("lastAccess", userRowBean.getLastAccess());
+ jo.put("remaining", userRowBean.getRemaining());
+ jo.put("sessionId", userRowBean.getSessionId());
+ if (!(httpSession.getId().equals(userRowBean.getSessionId()))) {
+ jo.put("delete", "yes");
+ } else {
+ jo.put("delete", "no");
+ }
+ ja.put(jo);
+ }
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "usageList 1: failed" + e.getMessage());
+ }
+
+ model.put("model", ja);
+
+ return new ModelAndView(getViewName(), model);
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @RequestMapping(value = { "/get_usage_list" }, method = RequestMethod.GET)
+ public void usageList(HttpServletRequest request, HttpServletResponse response) {
+ HttpSession httpSession = request.getSession();
+ HashMap activeUsers = (HashMap) httpSession.getServletContext().getAttribute("activeUsers");
+ if (activeUsers.size() == 0) {
+ activeUsers.put(httpSession.getId(), httpSession);
+ httpSession.getServletContext().setAttribute("activeUsers", activeUsers);
+ }
+ ArrayList<UserRowBean> rows = UsageUtils.getActiveUsers(activeUsers);
+ JSONArray ja = new JSONArray();
+ try {
+ for (UserRowBean userRowBean : rows) {
+ JSONObject jo = new JSONObject();
+ jo.put("id", userRowBean.getId());
+ jo.put("lastName", userRowBean.getLastName());
+ jo.put("email", userRowBean.getEmail());
+ jo.put("lastAccess", userRowBean.getLastAccess());
+ jo.put("remaining", userRowBean.getRemaining());
+ jo.put("sessionId", userRowBean.getSessionId());
+ if (!(httpSession.getId().equals(userRowBean.getSessionId()))) {
+ jo.put("delete", "yes");
+ } else {
+ jo.put("delete", "no");
+ }
+ ja.put(jo);
+ }
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "usageList 2: failed" + e.getMessage());
+ }
+ JsonMessage msg;
+ try {
+ msg = new JsonMessage(ja.toString());
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "usageList 3: failed" + e.getMessage());
+ }
+
+ }
+
+ @SuppressWarnings("rawtypes")
+ @RequestMapping(value = { "/usage_list/removeSession" }, method = RequestMethod.GET)
+ public void removeSession(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ HashMap activeUsers = (HashMap) request.getSession().getServletContext().getAttribute("activeUsers");
+ UserRowBean data = new UserRowBean();
+ data.setSessionId(request.getParameter("deleteSessionId"));
+ UsageUtils.getActiveUsersAfterDelete(activeUsers, data);
+
+ HttpSession httpSession = request.getSession();
+ ArrayList<UserRowBean> rows = UsageUtils.getActiveUsers(activeUsers);
+ JSONArray ja = new JSONArray();
+ try {
+ for (UserRowBean userRowBean : rows) {
+ JSONObject jo = new JSONObject();
+ jo.put("id", userRowBean.getId());
+ jo.put("lastName", userRowBean.getLastName());
+ jo.put("email", userRowBean.getEmail());
+ jo.put("lastAccess", userRowBean.getLastAccess());
+ jo.put("remaining", userRowBean.getRemaining());
+ jo.put("sessionId", userRowBean.getSessionId());
+ if (!(httpSession.getId().equals(userRowBean.getSessionId()))) {
+ jo.put("delete", "yes");
+ } else {
+ jo.put("delete", "no");
+ }
+ ja.put(jo);
+ }
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "removeSession: failed" + e.getMessage());
+ }
+
+ response.setContentType("application/json");
+ PrintWriter out = response.getWriter();
+ out.write(ja.toString());
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/AbstractDao.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/AbstractDao.java
new file mode 100644
index 00000000..0b274068
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/AbstractDao.java
@@ -0,0 +1,62 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.dao;
+import java.io.Serializable;
+import java.lang.reflect.ParameterizedType;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public abstract class AbstractDao<PK extends Serializable, T> {
+
+ private final Class<T> persistentClass;
+
+ @SuppressWarnings("unchecked")
+ public AbstractDao(){
+ this.persistentClass =(Class<T>) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[1];
+ }
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ protected Session getSession(){
+ return sessionFactory.getCurrentSession();
+ }
+
+ @SuppressWarnings("unchecked")
+ public T getByKey(PK key) {
+ return (T) getSession().get(persistentClass, key);
+ }
+
+ public void persist(T entity) {
+ getSession().persist(entity);
+ }
+
+ public void delete(T entity) {
+ getSession().delete(entity);
+ }
+
+ protected Criteria createEntityCriteria(){
+ return getSession().createCriteria(persistentClass);
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDao.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDao.java
new file mode 100644
index 00000000..0094072c
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDao.java
@@ -0,0 +1,29 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.dao;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.core.domain.Profile;
+
+public interface ProfileDao {
+ List<Profile> findAll();
+ Profile getProfile(int id);
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDaoImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDaoImpl.java
new file mode 100644
index 00000000..8d8d0d6e
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDaoImpl.java
@@ -0,0 +1,50 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.dao;
+
+import java.util.List;
+
+import org.hibernate.Criteria;
+import org.hibernate.criterion.Restrictions;
+import org.openecomp.portalsdk.core.domain.Profile;
+import org.springframework.stereotype.Repository;
+
+@Repository("profileDao")
+public class ProfileDaoImpl extends AbstractDao<Integer, Profile> implements ProfileDao{
+
+
+ public List<Profile> findAll() {
+ Criteria crit = getSession().createCriteria(Profile.class);
+ @SuppressWarnings("unchecked")
+ List<Profile> p = crit.list();
+
+ return p;
+ }
+
+
+ public Profile getProfile(int id) {
+ Criteria crit = getSession().createCriteria(Profile.class);
+ crit.add(Restrictions.eq("id", id));
+ Profile profile = (Profile) crit.uniqueResult();
+
+ return profile;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/hibernate/ModelOperationsCommon.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/hibernate/ModelOperationsCommon.java
new file mode 100644
index 00000000..cd9e644b
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/hibernate/ModelOperationsCommon.java
@@ -0,0 +1,453 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.dao.hibernate;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.hibernate.Criteria;
+import org.hibernate.FetchMode;
+import org.hibernate.Query;
+import org.hibernate.SQLQuery;
+import org.hibernate.Session;
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.ProjectionList;
+import org.hibernate.type.LongType;
+import org.openecomp.portalsdk.core.dao.support.FusionDao;
+import org.openecomp.portalsdk.core.domain.Lookup;
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+
+public abstract class ModelOperationsCommon extends FusionDao {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ModelOperationsCommon.class);
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public List _getList(Class domainClass, String filterClause, Integer fromIndex, Integer toIndex, String orderBy) {
+ List list = null;
+ String className = domainClass.getName();
+
+ Session session = getSessionFactory().getCurrentSession();
+
+ logger.info(EELFLoggerDelegate.debugLogger, "Getting " + className.toLowerCase() + " records"
+ + ((fromIndex != null) ? " from rows " + fromIndex.toString() + " to " + toIndex.toString() : "")
+ + "...");
+
+
+ if (filterClause != null && filterClause.length() > 0) {
+ logger.info(EELFLoggerDelegate.debugLogger, "Filtering " + className + " by: " + filterClause);
+
+ }
+
+ list = session.createQuery("from " + className + Utilities.nvl(filterClause, "")
+ + ((orderBy != null) ? " order by " + orderBy : "")).list();
+ list = (fromIndex != null) ? list.subList(fromIndex.intValue() - 1, toIndex.intValue()) : list;
+
+ if (orderBy == null && list != null) {
+ Collections.sort(list);
+ }
+
+ return list;
+ }
+
+ public List<?> _getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList,
+ List<Order> orderByList) {
+ return _getList(domainClass, projectionsList, restrictionsList, orderByList, null);
+ }
+
+ public List<?> _getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList,
+ List<Order> orderByList, HashMap<String, FetchMode> fetchModeMap) {
+
+ Session session = getSessionFactory().getCurrentSession();
+
+ Criteria criteria = session.createCriteria(domainClass);
+
+ if (projectionsList != null) {
+ criteria.setProjection(projectionsList);
+ }
+
+ if (restrictionsList != null && !restrictionsList.isEmpty()) {
+ for (Criterion criterion : restrictionsList)
+ criteria.add(criterion);
+ }
+
+ if (orderByList != null && !orderByList.isEmpty()) {
+ for (Order order : orderByList)
+ criteria.addOrder(order);
+ }
+
+ if (fetchModeMap != null) {
+ Iterator<String> itr = fetchModeMap.keySet().iterator();
+ String key = null;
+ while (itr.hasNext()) {
+ key = itr.next();
+ criteria.setFetchMode(key, fetchModeMap.get(key));
+ }
+
+ }
+ return criteria.list();
+ }
+
+ @SuppressWarnings("rawtypes")
+ public DomainVo _get(Class domainClass, Serializable id) {
+ DomainVo vo = null;
+
+ Session session = getSessionFactory().getCurrentSession();
+
+ logger.info(EELFLoggerDelegate.debugLogger, "Getting " + domainClass.getName() + " record for id - " + id.toString());
+
+
+ vo = (DomainVo) session.get(domainClass, id);
+
+ if (vo == null) {
+ try {
+ vo = (DomainVo) domainClass.newInstance();
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Failed while instantiating a class of " + domainClass.getName() + e.getMessage());
+
+ }
+ }
+
+ return vo;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public List _getLookupList(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy,
+ HashMap additionalParams) {
+ logger.info(EELFLoggerDelegate.debugLogger, "Retrieving " + dbTable + " lookup list...");
+
+ List list = null;
+ String dbOrderByCol = dbOrderBy;
+
+ Session session = getSessionFactory().getCurrentSession();
+
+ // default the orderBy if null;
+ if (Utilities.nvl(dbOrderBy).length() == 0) {
+ dbOrderByCol = dbLabelCol;
+ dbOrderBy = dbLabelCol;
+ } else {
+ if (dbOrderBy.lastIndexOf(" ") > -1) {
+ dbOrderByCol = dbOrderBy.substring(0, dbOrderBy.lastIndexOf(" "));
+ }
+ }
+
+ StringBuffer sql = new StringBuffer();
+
+ sql.append("select distinct ").append(dbLabelCol).append(" as lab, ").append(dbValueCol).append(" as val, ")
+ .append(dbOrderByCol).append(" as sortOrder ").append("from ").append(dbTable).append(" ")
+ .append((Utilities.nvl(dbFilter).length() == 0) ? "" : (" where " + dbFilter)).append(" order by ")
+ .append(dbOrderBy);
+
+ try {
+ list = session.createSQLQuery(sql.toString()).addEntity(Lookup.class).list();
+ } catch (Exception e) {
+ list = null;
+ logger.info(EELFLoggerDelegate.debugLogger, "The results for the lookup list query [" + sql + "] were empty.");
+ }
+
+ return list;
+ } // getLookupList
+
+ /* This method is used to execute SQL queries */
+ @SuppressWarnings("rawtypes")
+ protected final List _executeSQLQuery(String sql, Class domainClass) {
+ return _executeSQLQuery(sql, domainClass, null, null);
+ }
+
+ /* This method is used to execute SQL queries with paging */
+ @SuppressWarnings("rawtypes")
+ protected final List _executeSQLQuery(String sql, Class domainClass, Integer fromIndex, Integer toIndex) {
+ Session session = getSessionFactory().getCurrentSession();
+
+ SQLQuery query = session.createSQLQuery(sql).addEntity(domainClass.getName().toLowerCase(), domainClass);
+
+ if (fromIndex != null && toIndex != null) {
+ query.setFirstResult(fromIndex.intValue());
+ int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1;
+ query.setMaxResults(pageSize);
+ }
+
+ return query.list();
+ }
+
+ /* This method is used to execute HQL queries */
+ @SuppressWarnings("rawtypes")
+ protected final List _executeQuery(String sql) {
+ return _executeQuery(sql, null, null);
+ }
+
+ /* This method is used to execute HQL queries with paging */
+ @SuppressWarnings("rawtypes")
+ protected final List _executeQuery(String sql, Integer fromIndex, Integer toIndex) {
+ Session session = getSessionFactory().getCurrentSession();
+
+ Query query = session.createQuery(sql);
+
+ if (fromIndex != null && toIndex != null) {
+ query.setFirstResult(fromIndex.intValue());
+ int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1;
+ query.setMaxResults(pageSize);
+ }
+
+ return query.list();
+ }
+
+ /*
+ * This method can be used to execute both HQL or SQL named queries. The
+ * distinction will come in the hbm.xml mapping file defining the named
+ * query. Named HQL queries use the <query> tag while named SQL queries use
+ * the <sql-query> tag.
+ */
+ @SuppressWarnings("rawtypes")
+ protected final List _executeNamedQuery(String queryName, Map params) {
+ return _executeNamedQuery(queryName, params, null, null);
+ }
+
+ /*
+ * This method can be used to execute both HQL or SQL named queries with
+ * paging. The distinction will come in the hbm.xml mapping file defining
+ * the named query. Named HQL queries use the <query> tag while named SQL
+ * queries use the <sql-query> tag.
+ */
+ @SuppressWarnings("rawtypes")
+ protected final List _executeNamedQuery(String queryName, Map params, Integer fromIndex, Integer toIndex) {
+ Session session = getSessionFactory().getCurrentSession();
+ Query query = session.getNamedQuery(queryName);
+ bindQueryParameters(query, params);
+ if (fromIndex != null && toIndex != null) {
+ query.setFirstResult(fromIndex.intValue());
+ int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1;
+ query.setMaxResults(pageSize);
+ }
+ return query.list();
+ }
+
+ // RAPTOR ZK
+ /*
+ * This method can be used to execute both HQL or SQL named queries with
+ * paging. The distinction will come in the hbm.xml mapping file defining
+ * the named query. Named HQL queries use the <query> tag while named SQL
+ * queries use the <sql-query> tag.
+ */
+ @SuppressWarnings("rawtypes")
+ protected final List _executeNamedCountQuery(Class entity, String queryName, String whereClause, Map params) {
+ Session session = getSessionFactory().getCurrentSession();
+ Query query = session.getNamedQuery(queryName);
+ String queryStr = query.getQueryString();
+ StringBuffer modifiedSql = new StringBuffer(" select count(*) as countRows from (" + queryStr + " ) al ");
+ if (whereClause != null && whereClause.length() > 0)
+ modifiedSql.append("where " + whereClause);
+ // SQLQuery sqlQuery = session.createSQLQuery(" select count(*) as
+ // {reportSearch.countRows} from ("+ modifiedSql.toString()+")");
+ SQLQuery sqlQuery = session.createSQLQuery(modifiedSql.toString());
+ bindQueryParameters(sqlQuery, params);
+ sqlQuery.addScalar("countRows", LongType.INSTANCE);
+ // sqlQuery.addEntity("reportSearch", entity);
+ // sqlQuery.setResultTransformer(new
+ // AliasToBeanResultTransformer(SearchCount.class));
+ return sqlQuery.list();
+
+ }
+
+ /*
+ * This method can be used to execute both HQL or SQL named queries with
+ * paging. The distinction will come in the hbm.xml mapping file defining
+ * the named query. Named HQL queries use the <query> tag while named SQL
+ * queries use the <sql-query> tag. It is modified to test ZK filter.
+ */
+ @SuppressWarnings("rawtypes")
+ protected final List _executeNamedQuery(Class entity, String queryName, String whereClause, Map params,
+ Integer fromIndex, Integer toIndex) {
+ Session session = getSessionFactory().getCurrentSession();
+ Query query = session.getNamedQuery(queryName);
+ bindQueryParameters(query, params);
+ String queryStr = query.getQueryString();
+ StringBuffer modifiedSql = new StringBuffer(" select * from (" + queryStr + " ) al ");
+ if (whereClause != null && whereClause.length() > 0)
+ modifiedSql.append("where " + whereClause);
+
+ SQLQuery sqlQuery = session.createSQLQuery(modifiedSql.toString());
+ bindQueryParameters(sqlQuery, params);
+ sqlQuery.addEntity("reportSearch", entity);
+
+ if (fromIndex != null && toIndex != null) {
+ sqlQuery.setFirstResult(fromIndex.intValue());
+ int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1;
+ sqlQuery.setMaxResults(pageSize);
+ }
+ return sqlQuery.list();
+ }
+
+ /*
+ * This method can be used to execute both HQL or SQL named queries with
+ * paging. The distinction will come in the hbm.xml mapping file defining
+ * the named query. Named HQL queries use the <query> tag while named SQL
+ * queries use the <sql-query> tag.
+ */
+ @SuppressWarnings("rawtypes")
+ protected final List _executeNamedQueryWithOrderBy(Class entity, String queryName, Map params, String _orderBy,
+ boolean asc, Integer fromIndex, Integer toIndex) {
+ Session session = getSessionFactory().getCurrentSession();
+ Query query = session.getNamedQuery(queryName);
+ bindQueryParameters(query, params);
+ String queryStr = query.getQueryString();
+ queryStr = String.format(queryStr, _orderBy, asc ? "ASC" : "DESC");
+ SQLQuery sqlQuery = session.createSQLQuery(queryStr);
+ bindQueryParameters(sqlQuery, params);
+ sqlQuery.addEntity("reportSearch", entity);
+ if (fromIndex != null && toIndex != null) {
+ sqlQuery.setFirstResult(fromIndex.intValue());
+ int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1;
+ sqlQuery.setMaxResults(pageSize);
+ }
+ return sqlQuery.list();
+ }
+
+ // Where Clause
+ @SuppressWarnings("rawtypes")
+ protected final List _executeNamedQueryWithOrderBy(Class entity, String queryName, String whereClause, Map params,
+ String _orderBy, boolean asc, Integer fromIndex, Integer toIndex) {
+ Session session = getSessionFactory().getCurrentSession();
+ Query query = session.getNamedQuery(queryName);
+ bindQueryParameters(query, params);
+ String queryStr = query.getQueryString();
+ queryStr = String.format(queryStr, _orderBy, asc ? "ASC" : "DESC");
+ // StringBuffer modifiedSql = new StringBuffer(queryStr );
+ StringBuffer modifiedSql = new StringBuffer(" select * from (" + queryStr + " ) al ");
+ // modifiedSql.insert(queryStr.lastIndexOf("order by"), " " +
+ // whereClause + " ");
+ if (whereClause != null && whereClause.length() > 0)
+ modifiedSql.append("where " + whereClause);
+ SQLQuery sqlQuery = session.createSQLQuery(modifiedSql.toString());
+ bindQueryParameters(sqlQuery, params);
+ sqlQuery.addEntity("reportSearch", entity);
+ if (fromIndex != null && toIndex != null) {
+ sqlQuery.setFirstResult(fromIndex.intValue());
+ int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1;
+ sqlQuery.setMaxResults(pageSize);
+ }
+ return sqlQuery.list();
+ }
+
+ // RAPTOR ZK END
+
+ /* Processes custom Insert/Update/Delete SQL statements */
+ protected final int _executeUpdateQuery(String sql) throws Exception {
+ Session session = getSessionFactory().getCurrentSession();
+ Query query = session.createSQLQuery(sql);
+ return query.executeUpdate();
+ }
+
+ /* Processes Insert/Update/Delete Named SQL statements */
+ @SuppressWarnings("rawtypes")
+ protected final int _executeNamedUpdateQuery(String queryName, Map params) throws Exception {
+ Session session = getSessionFactory().getCurrentSession();
+ Query query = session.getNamedQuery(queryName);
+ bindQueryParameters(query, params);
+ return query.executeUpdate();
+ }
+
+ protected final void _update(DomainVo vo, Integer userId) {
+ _update(vo, ((userId != null) ? userId.intValue() : 0));
+ }
+
+ protected final void _update(DomainVo vo, int userId) {
+ Date timestamp = new Date();
+
+ Session session = getSessionFactory().getCurrentSession();
+
+ if (vo.getId() == null || vo.getId().intValue() == 0) { // add new
+ vo.setCreated(timestamp);
+ vo.setModified(timestamp);
+
+ if (userId != 0
+ && userId != Integer.parseInt(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID))) {
+ vo.setCreatedId(new Long(userId));
+ vo.setModifiedId(new Long(userId));
+ }
+ } else { // update existing
+ vo.setModified(timestamp);
+
+ if (userId != 0
+ && userId != Integer.parseInt(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID))) {
+ vo.setModifiedId(new Long(userId));
+ }
+ }
+
+ session.saveOrUpdate(vo);
+ }
+
+ protected final void _remove(DomainVo vo) {
+ Session session = getSessionFactory().getCurrentSession();
+ session.delete(vo);
+ }
+
+ @SuppressWarnings("rawtypes")
+ protected final int _remove(Class domainClass, String whereClause) {
+ int rowsAffected = 0;
+
+ Session session = getSessionFactory().getCurrentSession();
+
+ StringBuffer sql = new StringBuffer("delete from ");
+
+ sql.append(domainClass.getName()).append(" where ").append(whereClause);
+
+ rowsAffected = session.createQuery(sql.toString()).executeUpdate();
+
+ return rowsAffected;
+ }
+
+ protected final void _flush() {
+ Session session = getSessionFactory().getCurrentSession();
+ session.flush();
+ }
+
+ @SuppressWarnings("rawtypes")
+ private void bindQueryParameters(Query query, Map params) {
+ if (params != null) {
+ for (Iterator i = params.entrySet().iterator(); i.hasNext();) {
+ Map.Entry entry = (Map.Entry) i.next();
+
+ Object parameterValue = entry.getValue();
+
+ if (!(parameterValue instanceof Collection) && !(parameterValue instanceof Object[])) {
+ query.setParameter((String) entry.getKey(), parameterValue);
+ } else {
+ if (parameterValue instanceof Collection) {
+ query.setParameterList((String) entry.getKey(), (Collection) parameterValue);
+ } else {
+ if (parameterValue instanceof Object[]) {
+ query.setParameterList((String) entry.getKey(), (Object[]) parameterValue);
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/support/FusionDao.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/support/FusionDao.java
new file mode 100644
index 00000000..75b3c80b
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/support/FusionDao.java
@@ -0,0 +1,35 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.dao.support;
+
+import org.hibernate.SessionFactory;
+import org.openecomp.portalsdk.core.FusionObject;
+
+public class FusionDao implements FusionObject {
+ private SessionFactory sessionFactory;
+
+ public void setSessionFactory(SessionFactory sessionFactory) {
+ this.sessionFactory = sessionFactory;
+ }
+
+ public SessionFactory getSessionFactory() {
+ return this.sessionFactory;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/App.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/App.java
new file mode 100644
index 00000000..6e8e6c80
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/App.java
@@ -0,0 +1,206 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+/**
+ * Represents a row in the FN_APP table in the EP_SDK database. (A nearly
+ * identical table is defined in Portal database.)
+ *
+ * @version 1.0
+ */
+public class App extends DomainVo {
+
+ private static final long serialVersionUID = 3465979916929796990L;
+
+ // superclass defines Id
+ private String name; // app_name
+ private String imageUrl; // app_image_url
+ private String description; // app_description
+ private String notes; // app_notes
+ private String url; // app_url
+ private String alternateUrl; // app_alternate_url
+ private String restEndpoint; // app_rest_endpoint
+ private String mlAppName; // ml_app_name
+ private String mlAppAdminId; // ml_app_admin_id;
+ private String motsId; // mots_id
+ private String appPassword; // app_password
+ private String open;
+ private String enabled;
+ private byte[] thumbnail;
+ private String username; // app_username
+ private String uebKey; // ueb_key
+ private String uebSecret; // ueb_secret
+ private String uebTopicName; // ueb_topic_name
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getAppPassword() {
+ return appPassword;
+ }
+
+ public void setAppPassword(String appPassword) {
+ this.appPassword = appPassword;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getImageUrl() {
+ return imageUrl;
+ }
+
+ public void setImageUrl(String imageUrl) {
+ this.imageUrl = imageUrl;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getAlternateUrl() {
+ return alternateUrl;
+ }
+
+ public void setAlternateUrl(String alternateUrl) {
+ this.alternateUrl = alternateUrl;
+ }
+
+ public String getRestEndpoint() {
+ return restEndpoint;
+ }
+
+ public void setRestEndpoint(String restEndpoint) {
+ this.restEndpoint = restEndpoint;
+ }
+
+ public String getMlAppName() {
+ return mlAppName;
+ }
+
+ public void setMlAppName(String mlAppName) {
+ this.mlAppName = mlAppName;
+ }
+
+ public String getMlAppAdminId() {
+ return mlAppAdminId;
+ }
+
+ public void setMlAppAdminId(String mlAppAdminId) {
+ this.mlAppAdminId = mlAppAdminId;
+ }
+
+ public String getMotsId() {
+ return motsId;
+ }
+
+ public void setMotsId(String motsId) {
+ this.motsId = motsId;
+ }
+
+ public String getOpen() {
+ return open;
+ }
+
+ public void setOpen(String open) {
+ this.open = open;
+ }
+
+ public String getEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(String enabled) {
+ this.enabled = enabled;
+ }
+
+ public byte[] getThumbnail() {
+ return this.thumbnail;
+ }
+
+ public void setThumbnail(byte[] thumbnail) {
+ this.thumbnail = thumbnail;
+ }
+
+ public String getUebKey() {
+ return uebKey;
+ }
+
+ public void setUebKey(String uebKey) {
+ this.uebKey = uebKey;
+ }
+
+ public String getUebSecret() {
+ return uebSecret;
+ }
+
+ public void setUebSecret(String uebSecret) {
+ this.uebSecret = uebSecret;
+ }
+
+ public String getUebTopicName() {
+ return uebTopicName;
+ }
+
+ public void setUebTopicName(String uebTopicName) {
+ this.uebTopicName = uebTopicName;
+ }
+
+ /**
+ * Answers true if the objects have the same ID.
+ */
+ public int compareTo(Object obj) {
+ Long c1 = getId();
+ Long c2 = ((App) obj).getId();
+ return c1.compareTo(c2);
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/AuditLog.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/AuditLog.java
new file mode 100644
index 00000000..f861232f
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/AuditLog.java
@@ -0,0 +1,79 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+import java.util.Date;
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+public class AuditLog extends DomainVo {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ public static final String CD_ACTIVITY_LOGIN = "login";
+ public static final String CD_ACTIVITY_LOGOUT = "logout";
+ public static final String CD_ACTIVITY_MOBILE_LOGIN = "mobile_login";
+ public static final String CD_ACTIVITY_MOBILE_LOGOUT = "mobile_logout";
+
+ /*-------Profile activities -----------*/
+ public static final String CD_ACTIVITY_ROLE_ADD = "add_role";
+ public static final String CD_ACTIVITY_ROLE_REMOVE = "remove_role";
+ public static final String CD_ACTIVITY_CHILD_ROLE_ADD = "add_child_role";
+ public static final String CD_ACTIVITY_CHILD_ROLE_REMOVE = "remove_child_role";
+ public static final String CD_ACTIVITY_ROLE_ADD_FUNCTION = "add_role_function";
+ public static final String CD_ACTIVITY_ROLE_REMOVE_FUNCTION = "remove_role_function";
+ public static final String CD_ACTIVITY_USER_ROLE_ADD = "add_user_role";
+ public static final String CD_ACTIVITY_USER_ROLE_REMOVE = "remove_user_role";
+
+
+ private String activityCode;
+ private String affectedRecordId;
+ private String comments;
+
+ public AuditLog() {
+ setCreated(new Date());
+ }
+
+ public String getActivityCode() {
+ return activityCode;
+ }
+
+ public String getComments() {
+ return comments;
+ }
+
+ public String getAffectedRecordId() {
+ return affectedRecordId;
+ }
+
+ public void setActivityCode(String activityCode) {
+ this.activityCode = activityCode;
+ }
+
+ public void setComments(String comments) {
+ this.comments = comments;
+ }
+
+ public void setAffectedRecordId(String affectedRecordId) {
+ this.affectedRecordId = affectedRecordId;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/BroadcastMessage.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/BroadcastMessage.java
new file mode 100644
index 00000000..e005df41
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/BroadcastMessage.java
@@ -0,0 +1,123 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+import java.util.Date;
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+public class BroadcastMessage extends DomainVo{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public BroadcastMessage() {
+ }
+
+ public static final String ID_MESSAGE_LOCATION_LOGIN = "10";
+ public static final String ID_MESSAGE_LOCATION_WELCOME = "20";
+
+ private String messageText;
+ private Integer locationId;
+ private Date startDate;
+ private Date endDate;
+ private Integer sortOrder;
+ private Boolean active;
+ private String siteCd;
+
+ public Boolean getActive() {
+ return active;
+ }
+
+ public Date getEndDate() {
+ return endDate;
+ }
+
+ public Integer getLocationId() {
+ return locationId;
+ }
+
+ public String getMessageText() {
+ return messageText;
+ }
+
+ public Integer getSortOrder() {
+ return sortOrder;
+ }
+
+ public Date getStartDate() {
+ return startDate;
+ }
+
+ public String getSiteCd() {
+ return siteCd;
+ }
+
+
+ public void setActive(Boolean active) {
+ this.active = active;
+ }
+
+ public void setEndDate(Date endDate) {
+ this.endDate = endDate;
+ }
+
+ public void setLocationId(Integer locationId) {
+ this.locationId = locationId;
+ }
+
+ public void setMessageText(String messageText) {
+ this.messageText = messageText;
+ }
+
+ public void setSortOrder(Integer sortOrder) {
+ this.sortOrder = sortOrder;
+ }
+
+ public void setStartDate(Date startDate) {
+ this.startDate = startDate;
+ }
+
+ public void setSiteCd(String siteCd) {
+ this.siteCd = siteCd;
+ }
+
+
+ public int compareTo(Object obj){
+ Integer c1 = getLocationId();
+ Integer c2 = ((BroadcastMessage)obj).getLocationId();
+
+ if (c1.compareTo(c2) == 0) {
+ c1 = getSortOrder();
+ c2 = ((BroadcastMessage)obj).getSortOrder();
+
+ if (c1.compareTo(c2) == 0) {
+ Long c3 = getId();
+ Long c4 = ((BroadcastMessage)obj).getId();
+
+ return c3.compareTo(c4);
+ }
+ }
+
+ return c1.compareTo(c2);
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/DomainVo.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/DomainVo.java
new file mode 100644
index 00000000..9d173996
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/DomainVo.java
@@ -0,0 +1,177 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+/* Super class from which all data objects descend
+ *
+ * Per Sunder T on 3 June 2016:
+ *
+ * Yes, we need to get rid of domain.DomainVO and fold all the references to the support.DomainVO.
+ */
+@SuppressWarnings("rawtypes")
+@Deprecated
+public class DomainVo extends FusionVo implements Serializable, Cloneable, Comparable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ protected Long id;
+ protected Date created;
+ protected Date modified;
+ protected Long createdId;
+ protected Long modifiedId;
+ protected Long rowNum;
+
+ protected Serializable auditUserId;
+
+ Set auditTrail = null;
+
+ public DomainVo() {
+ }
+
+ public void setId(Long i) {
+ id = i;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public void setModified(Date modified) {
+ this.modified = modified;
+ }
+
+ public void setCreatedId(Long createdId) {
+ this.createdId = createdId;
+ }
+
+ public void setModifiedId(Long modifiedId) {
+ this.modifiedId = modifiedId;
+ }
+
+ public void setAuditUserId(Serializable auditUserId) {
+ this.auditUserId = auditUserId;
+ }
+
+ public void setRowNum(Long rowNum) {
+ this.rowNum = rowNum;
+ }
+
+ public void setAuditTrail(Set auditTrail) {
+ this.auditTrail = auditTrail;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public Date getModified() {
+ return modified;
+ }
+
+ public Long getCreatedId() {
+ return createdId;
+ }
+
+ public Long getModifiedId() {
+ return modifiedId;
+ }
+
+ public Serializable getAuditUserId() {
+ return auditUserId;
+ }
+
+ public Long getRowNum() {
+ return rowNum;
+ }
+
+ public Set getAuditTrail() {
+ return auditTrail;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void addAuditTrailLog(AuditLog auditLog) {
+ if (getAuditTrail() == null) {
+ setAuditTrail(new HashSet());
+ }
+
+ getAuditTrail().add(auditLog);
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public Object copy() {
+ return copy(false);
+ }
+
+ public Object copy(boolean isIdNull) {
+ // let's create a "copy" of the object using serialization
+ ByteArrayOutputStream baos = null;
+ ByteArrayInputStream bais = null;
+ ObjectOutputStream oos = null;
+ ObjectInputStream ois = null;
+
+ DomainVo newVo = null;
+
+ try {
+
+ baos = new ByteArrayOutputStream();
+ oos = new ObjectOutputStream(baos);
+ oos.writeObject(this);
+
+ bais = new ByteArrayInputStream(baos.toByteArray());
+ ois = new ObjectInputStream(bais);
+ newVo = (DomainVo) ois.readObject();
+
+ if (isIdNull) {
+ newVo.setId(null);
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return newVo;
+ }
+
+ public int compareTo(Object obj) {
+ Long c1 = getId();
+ Long c2 = ((DomainVo) obj).getId();
+
+ return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FnMenu.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FnMenu.java
new file mode 100644
index 00000000..e2c1f46d
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FnMenu.java
@@ -0,0 +1,142 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+/**
+ * <p>RoleFunction.java</p>
+ *
+ * <p>Represents a role function data object.</p>
+ *
+ * @version 1.0
+ */
+public class FnMenu extends DomainVo {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public FnMenu() {}
+
+ private Integer menuId;
+ private String label;
+ private Integer parentId;
+ private String action;
+ private String functionCd;
+ private Integer sortOrder;
+ private String servlet;
+ private String queryString;
+ private String externalUrl;
+ private String target;
+ private String active;
+ private String separator;
+ private String imageSrc;
+ private String menuSetCode;
+
+ public Integer getMenuId() {
+ return menuId;
+ }
+ public void setMenuId(Integer menuId) {
+ this.menuId = menuId;
+ }
+ public String getLabel() {
+ return label;
+ }
+ public void setLabel(String label) {
+ this.label = label;
+ }
+ public Integer getParentId() {
+ return parentId;
+ }
+ public void setParentId(Integer parentId) {
+ this.parentId = parentId;
+ }
+ public String getAction() {
+ return action;
+ }
+ public void setAction(String action) {
+ this.action = action;
+ }
+ public String getFunctionCd() {
+ return functionCd;
+ }
+ public void setFunctionCd(String functionCd) {
+ this.functionCd = functionCd;
+ }
+ public Integer getSortOrder() {
+ return sortOrder;
+ }
+ public void setSortOrder(Integer sortOrder) {
+ this.sortOrder = sortOrder;
+ }
+ public String getServlet() {
+ return servlet;
+ }
+ public void setServlet(String servlet) {
+ this.servlet = servlet;
+ }
+ public String getQueryString() {
+ return queryString;
+ }
+ public void setQueryString(String queryString) {
+ this.queryString = queryString;
+ }
+ public String getExternalUrl() {
+ return externalUrl;
+ }
+ public void setExternalUrl(String externalUrl) {
+ this.externalUrl = externalUrl;
+ }
+ public String getTarget() {
+ return target;
+ }
+ public void setTarget(String target) {
+ this.target = target;
+ }
+ public String getActive() {
+ return active;
+ }
+ public void setActive(String active) {
+ this.active = active;
+ }
+ public String getSeparator() {
+ return separator;
+ }
+ public void setSeparator(String separator) {
+ this.separator = separator;
+ }
+ public String getImageSrc() {
+ return imageSrc;
+ }
+ public void setImageSrc(String imageSrc) {
+ this.imageSrc = imageSrc;
+ }
+ public String getMenuSetCode() {
+ return menuSetCode;
+ }
+ public void setMenuSetCode(String menuSetCode) {
+ this.menuSetCode = menuSetCode;
+ }
+
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FusionVo.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FusionVo.java
new file mode 100644
index 00000000..dc1b8d4c
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FusionVo.java
@@ -0,0 +1,27 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+import org.openecomp.portalsdk.core.FusionObject;
+
+public class FusionVo implements FusionObject {
+ public FusionVo() {
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LoginBean.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LoginBean.java
new file mode 100644
index 00000000..52c6d00e
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LoginBean.java
@@ -0,0 +1,187 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+import java.util.Set;
+
+import org.openecomp.portalsdk.core.domain.support.FusionCommand;
+
+@SuppressWarnings("rawtypes")
+public class LoginBean extends FusionCommand {
+
+ private String loginId;
+ private String loginPwd;
+ private String hrid;
+ private String orgUserId;
+ private String siteAccess;
+ private String loginErrorMessage;
+
+ private User user;
+ private Set menu;
+ private Set businessDirectMenu;
+
+ /**
+ * getLoginId
+ *
+ * @return String
+ */
+ public String getLoginId() {
+ return loginId;
+ }
+
+ /**
+ * getLoginPwd
+ *
+ * @return String
+ */
+ public String getLoginPwd() {
+ return loginPwd;
+ }
+
+ /**
+ * getMenu
+ *
+ * @return Set
+ */
+ public Set getMenu() {
+ return menu;
+ }
+
+ /**
+ * getUser
+ *
+ * @return User
+ */
+ public User getUser() {
+ return user;
+ }
+
+ /**
+ * getHrid
+ *
+ * @return String
+ */
+ public String getHrid() {
+ return hrid;
+ }
+
+ /**
+ * getSiteAccess
+ *
+ * @return String
+ */
+ public String getSiteAccess() {
+ return siteAccess;
+ }
+
+ /**
+ * getBusinessDirectMenu
+ *
+ * @return Set
+ */
+ public Set getBusinessDirectMenu() {
+ return businessDirectMenu;
+ }
+
+ /**
+ * getLoginErrorMessage
+ *
+ * @return String
+ */
+ public String getLoginErrorMessage() {
+ return loginErrorMessage;
+ }
+
+ public String getOrgUserId() {
+ return orgUserId;
+ }
+
+ /**
+ * setLoginId
+ *
+ * @param loginId String
+ */
+ public void setLoginId(String loginId) {
+ this.loginId = loginId;
+ }
+
+ /**
+ * setLoginPwd
+ *
+ * @param loginPwd String
+ */
+ public void setLoginPwd(String loginPwd) {
+ this.loginPwd = loginPwd;
+ }
+
+ public void setMenu(Set menu) {
+ this.menu = menu;
+ }
+
+ /**
+ * setUser
+ *
+ * @param user User
+ */
+ public void setUser(User user) {
+ this.user = user;
+ }
+
+ /**
+ * setHrid
+ *
+ * @param hrid String
+ */
+ public void setHrid(String hrid) {
+ this.hrid = hrid;
+ }
+
+ /**
+ * setSiteAccess
+ *
+ * @param siteAccess String
+ */
+ public void setSiteAccess(String siteAccess) {
+ this.siteAccess = siteAccess;
+ }
+
+ /**
+ * setBusinessDirectMenu
+ *
+ * @param businessDirectMenu Set
+ */
+ public void setBusinessDirectMenu(Set businessDirectMenu) {
+ this.businessDirectMenu = businessDirectMenu;
+ }
+
+ /**
+ * setLoginErrorMessage
+ *
+ * @param loginErrorMessage String
+ */
+ public void setLoginErrorMessage(String loginErrorMessage) {
+ this.loginErrorMessage = loginErrorMessage;
+ }
+
+ public void setOrgUserId(String orgUserId) {
+ this.orgUserId = orgUserId;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Lookup.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Lookup.java
new file mode 100644
index 00000000..a71bdfc1
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Lookup.java
@@ -0,0 +1,85 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+import java.io.Serializable;
+
+import org.openecomp.portalsdk.core.domain.support.NameValueId;
+
+public class Lookup extends FusionVo implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private NameValueId nameValueId = new NameValueId();
+
+ public Lookup() {}
+
+ public Lookup(String label, String value) {
+ this();
+ setLabel(label);
+ setValue(value);
+ }
+
+ public String getValue() {
+ return getNameValueId().getVal();
+ }
+
+ public String getLabel() {
+ return getNameValueId().getLab();
+ }
+
+ public void setValue(String value) {
+ getNameValueId().setVal(value);
+ }
+
+ public void setLabel(String label) {
+ getNameValueId().setLab(label);
+ }
+
+ public NameValueId getNameValueId() {
+ return nameValueId;
+ }
+
+ public void setNameValueId(NameValueId nameValueId) {
+ this.nameValueId = nameValueId;
+ }
+
+ // required by ZK for to set the selectedItems of Listboxes (used heavily for <select>-style drop-downs)
+ public int hashCode() {
+ int hash = getValue().hashCode();
+ hash = hash + getLabel().hashCode();
+
+ return hash;
+ }
+
+ public boolean equals( Object obj ) {
+ boolean equivalent = false;
+
+ Lookup lookup = (Lookup)obj;
+ if( lookup.getValue().equals(getValue()) && lookup.getLabel().equals(getLabel())) {
+ equivalent = true;
+ }
+
+ return equivalent;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuCountry.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuCountry.java
new file mode 100644
index 00000000..946df58a
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuCountry.java
@@ -0,0 +1,86 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+/**
+ * <p>luCountry.java</p>
+ *
+ * <p>Represents a country data object.</p>
+ *
+ * @version 1.0
+ */
+public class LuCountry extends DomainVo{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ LuCountry() {}
+
+ public String getCountry() {
+ return country;
+ }
+
+ public String getAbbr() {
+ return abbr;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public void setAbbr(String abbr) {
+ this.abbr = abbr;
+ }
+
+
+ public String getFullName() {
+ return fullName;
+ }
+
+ public void setFullName(String fullName) {
+ this.fullName = fullName;
+ }
+
+ public String getWebphoneCountryLabel() {
+ return webphoneCountryLabel;
+ }
+
+ public void setWebphoneCountryLabel(String webphoneCountryLabel) {
+ this.webphoneCountryLabel = webphoneCountryLabel;
+ }
+
+ public int compareTo(Object obj){
+ String c1 = getCountry();
+ String c2 = ((LuCountry)obj).getCountry();
+
+ return c1.compareTo(c2);
+ }
+
+
+ private String abbr;
+ private String country;
+ private String fullName;
+ private String webphoneCountryLabel;
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuState.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuState.java
new file mode 100644
index 00000000..283ab011
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuState.java
@@ -0,0 +1,68 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+/**
+ * <p>State.java</p>
+ *
+ * <p>Represents a state data object.</p>
+ *
+ * @version 1.0
+ */
+public class LuState extends DomainVo {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ LuState() {}
+
+ public String getState() {
+ return state;
+ }
+
+ public String getAbbr() {
+ return abbr;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public void setAbbr(String abbr) {
+ this.abbr = abbr;
+ }
+
+
+ public int compareTo(Object obj){
+ String c1 = getState();
+ String c2 = ((LuState)obj).getState();
+
+ return c1.compareTo(c2);
+ }
+
+
+ private String abbr;
+ private String state;
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuTimeZone.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuTimeZone.java
new file mode 100644
index 00000000..e1a7a474
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuTimeZone.java
@@ -0,0 +1,77 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+/**
+ * <p>LuTimeZone.java</p>
+ *
+ * <p>Represents a LuTimeZone data object.</p>
+ *
+ * @version 1.0
+ */
+public class LuTimeZone extends DomainVo {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ LuTimeZone() {}
+
+ public String getName() {
+ return name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+
+ public Long getTimezoneId() {
+ return timezoneId;
+ }
+
+ public void setTimezoneId(Long timezoneId) {
+ this.timezoneId = timezoneId;
+ }
+
+ public int compareTo(Object obj){
+ Long c1 = getId();
+ Long c2 = ((LuTimeZone)obj).getId();
+
+ return c1.compareTo(c2);
+ }
+
+
+ private String name;
+ private Long timezoneId;
+ private String value;
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Menu.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Menu.java
new file mode 100644
index 00000000..6d57e6d0
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Menu.java
@@ -0,0 +1,160 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+public class Menu extends DomainVo {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public Menu() {}
+
+ public String getAction() {
+ return action;
+ }
+
+ public boolean isActive() {
+ return active;
+ }
+
+ public String getExternalUrl() {
+ return externalUrl;
+ }
+
+ public String getFunctionCd() {
+ return functionCd;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public String getMenuLevel() {
+ return menuLevel;
+ }
+
+ public Long getParentId() {
+ return parentId;
+ }
+
+ public String getQueryString() {
+ return queryString;
+ }
+
+ public String getServlet() {
+ return servlet;
+ }
+
+ public Short getSortOrder() {
+ return sortOrder;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+ public String getMenuSetCode() {
+ return menuSetCode;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+ public void setExternalUrl(String externalUrl) {
+ this.externalUrl = externalUrl;
+ }
+
+ public void setFunctionCd(String functionCd) {
+ this.functionCd = functionCd;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public void setMenuLevel(String menuLevel) {
+ this.menuLevel = menuLevel;
+ }
+
+ public void setParentId(Long parentId) {
+ this.parentId = parentId;
+ }
+
+ public void setQueryString(String queryString) {
+ this.queryString = queryString;
+ }
+
+ public void setServlet(String servlet) {
+ this.servlet = servlet;
+ }
+
+ public void setSortOrder(Short sortOrder) {
+ this.sortOrder = sortOrder;
+ }
+
+ public void setTarget(String target) {
+ this.target = target;
+ }
+
+ public void setMenuSetCode(String menuSetCode) {
+ this.menuSetCode = menuSetCode;
+ }
+
+ public boolean isSeparator() {
+ return separator;
+ }
+
+ public void setSeparator(boolean separator) {
+ this.separator = separator;
+ }
+
+ public String getImageSrc() {
+ return imageSrc;
+ }
+
+ public void setImageSrc(String imageSrc) {
+ this.imageSrc = imageSrc;
+ }
+
+ private String menuLevel;
+ private String label;
+ private Long parentId;
+ private String action;
+ private String functionCd;
+ private Short sortOrder;
+ private String servlet;
+ private String queryString;
+ private String externalUrl;
+ private String target;
+ private boolean active;
+ private String menuSetCode;
+ private boolean separator;
+ private String imageSrc;
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/MenuData.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/MenuData.java
new file mode 100644
index 00000000..a5758b80
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/MenuData.java
@@ -0,0 +1,61 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+@SuppressWarnings("rawtypes")
+public class MenuData extends Menu {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private MenuData parentMenu;
+ private Set childMenus = new TreeSet();
+
+ public MenuData() {}
+
+ public Set getChildMenus() {
+ return childMenus;
+ }
+
+ public MenuData getParentMenu() {
+ return parentMenu;
+ }
+
+ public void setChildMenus(Set childMenus) {
+ this.childMenus = childMenus;
+ }
+
+ public void setParentMenu(MenuData parentMenu) {
+ this.parentMenu = parentMenu;
+ }
+
+ public int compareTo(Object obj){
+
+ Short c1 = getSortOrder();
+ Short c2 = ((MenuData)obj).getSortOrder();
+
+ return (c1 == null || c2 == null) ? 1 : ((c1.compareTo(c2) == 0) ? 1 : c1.compareTo(c2));
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Profile.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Profile.java
new file mode 100644
index 00000000..b5592021
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Profile.java
@@ -0,0 +1,96 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+public class Profile extends DomainVo{
+
+ private static final long serialVersionUID = 3409056457412656883L;
+
+ private Long id;
+ private String first_name;
+ private String last_name;
+ private String email;
+ private String orgManagerUserId;
+ private String active_yn;
+ private String orgUserId;
+ public Profile() {}
+
+
+ public Long getId() {
+ return id;
+ }
+
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+
+ public String getFirst_name() {
+ return first_name;
+ }
+
+ public void setFirst_name(String first_name) {
+ this.first_name = first_name;
+ }
+
+ public String getLast_name() {
+ return last_name;
+ }
+
+ public void setLast_name(String last_name) {
+ this.last_name = last_name;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getOrgManagerUserId() {
+ return orgManagerUserId;
+ }
+
+ public void setOrgManagerUserId(String orgManagerUserId) {
+ this.orgManagerUserId = orgManagerUserId;
+ }
+
+ public String getActive_yn() {
+ return active_yn;
+ }
+
+ public void setActive_yn(String active_yn) {
+ this.active_yn = active_yn;
+ }
+
+ public String getOrgUserId() {
+ return orgUserId;
+ }
+
+ public void setOrgUserId(String orgUserId) {
+ this.orgUserId = orgUserId;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Role.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Role.java
new file mode 100644
index 00000000..474bbb95
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Role.java
@@ -0,0 +1,174 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+/**
+ * <p>Role.java</p>
+ * <p>Represents a role data object.</p>
+ *
+ * @version 1.0
+ */
+@SuppressWarnings("rawtypes")
+public class Role extends DomainVo {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private String name;
+ private boolean active;
+ private Integer priority;
+
+ private Set roleFunctions = new TreeSet();
+
+ private Set childRoles = new TreeSet();
+ @JsonIgnore
+ private Set parentRoles = new TreeSet();
+
+ public Role() {}
+
+ public String getName() {
+ return name;
+ }
+
+ public boolean getActive() {
+ return active;
+ }
+
+ public Set getRoleFunctions() {
+ return roleFunctions;
+ }
+
+ public Integer getPriority() {
+ return priority;
+ }
+
+ public Set getChildRoles() {
+ return childRoles;
+ }
+
+ public Set getParentRoles() {
+ return parentRoles;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+ public void setRoleFunctions(Set roleFunctions) {
+ this.roleFunctions = roleFunctions;
+ }
+
+ public void setPriority(Integer priority) {
+ this.priority = priority;
+ }
+
+ public void setChildRoles(Set childRoles) {
+ this.childRoles = childRoles;
+ }
+
+ public void setParentRoles(Set parentRoles) {
+ this.parentRoles = parentRoles;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void addRoleFunction(RoleFunction roleFunction) {
+ this.roleFunctions.add(roleFunction);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void addChildRole(Role role) {
+ this.childRoles.add(role);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void addParentRole(Role role) {
+ this.parentRoles.add(role);
+ }
+
+ public String getEditUrl() {
+ return "/role.htm?role_id=" + getId();
+ }
+
+ public String getToggleActiveImage() {
+ return "/static/fusion/images/" + (getActive() ? "active.png" : "inactive.png" );
+ }
+
+ public String getToggleActiveAltText() {
+ return getActive() ? "Click to Deactivate Role" : "Click to Activate Role";
+ }
+
+ public void removeChildRole(Long roleId) {
+ Iterator i = this.childRoles.iterator();
+
+ while (i.hasNext()) {
+ Role childRole = (Role)i.next();
+ if (childRole.getId().equals(roleId)) {
+ this.childRoles.remove(childRole);
+ break;
+ }
+ }
+ }
+
+ public void removeParentRole(Long roleId) {
+ Iterator i = this.parentRoles.iterator();
+
+ while (i.hasNext()) {
+ Role parentRole = (Role)i.next();
+ if (parentRole.getId().equals(roleId)) {
+ this.parentRoles.remove(parentRole);
+ break;
+ }
+ }
+ }
+
+ public void removeRoleFunction(String roleFunctionCd) {
+ Iterator i = this.roleFunctions.iterator();
+
+ while (i.hasNext()) {
+ RoleFunction roleFunction = (RoleFunction)i.next();
+ if (roleFunction.getCode().equals(roleFunctionCd)) {
+ this.roleFunctions.remove(roleFunction);
+ break;
+ }
+ }
+ }
+
+ public int compareTo(Object obj){
+ String c1 = getName();
+ String c2 = ((Role)obj).getName();
+
+ return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/RoleFunction.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/RoleFunction.java
new file mode 100644
index 00000000..c0387fda
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/RoleFunction.java
@@ -0,0 +1,69 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+/**
+ * <p>RoleFunction.java</p>
+ *
+ * <p>Represents a role function data object.</p>
+ *
+ * @version 1.0
+ */
+public class RoleFunction extends DomainVo {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ public RoleFunction() {}
+
+ public String getName() {
+ return name;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getEditUrl() {
+ return "/role_function.htm?role_function_id=" + getCode();
+ }
+
+ public int compareTo(Object obj){
+ String c1 = getName();
+ String c2 = ((RoleFunction)obj).getName();
+
+ return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
+ }
+
+ private String code;
+ private String name;
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UrlsAccessible.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UrlsAccessible.java
new file mode 100644
index 00000000..53edefe4
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UrlsAccessible.java
@@ -0,0 +1,83 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+import java.io.Serializable;
+
+public class UrlsAccessible extends FusionVo implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private UrlsAccessibleKey urlsAccessibleKey = new UrlsAccessibleKey();
+
+ public UrlsAccessible() {}
+
+ public UrlsAccessible(String url, String functionCd) {
+ this();
+ setUrl(url);
+ setFunctionCd(functionCd);
+ }
+
+ public String getUrl() {
+ return getUrlsAccessibleKey().getUrl();
+ }
+
+ public String getFunctionCd() {
+ return getUrlsAccessibleKey().getFunctionCd();
+ }
+
+ public void setUrl(String url) {
+ getUrlsAccessibleKey().setUrl(url);
+ }
+
+ public void setFunctionCd(String functionCd) {
+ getUrlsAccessibleKey().setFunctionCd(functionCd);
+ }
+
+ public UrlsAccessibleKey getUrlsAccessibleKey() {
+ return urlsAccessibleKey;
+ }
+
+ public void setUrlsAccessibleKey(UrlsAccessibleKey urlsAccessibleKey) {
+ this.urlsAccessibleKey = urlsAccessibleKey;
+ }
+
+ // required by ZK for to set the selectedItems of Listboxes (used heavily for <select>-style drop-downs)
+ public int hashCode() {
+ int hash = getUrl().hashCode();
+ hash = hash + getFunctionCd().hashCode();
+
+ return hash;
+ }
+
+ public boolean equals( Object obj ) {
+ boolean equivalent = false;
+
+ UrlsAccessible lookup = (UrlsAccessible)obj;
+ if( lookup.getUrl().equals(getUrl()) && lookup.getFunctionCd().equals(getFunctionCd())) {
+ equivalent = true;
+ }
+
+ return equivalent;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UrlsAccessibleKey.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UrlsAccessibleKey.java
new file mode 100644
index 00000000..f1cec496
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UrlsAccessibleKey.java
@@ -0,0 +1,90 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+import java.io.Serializable;
+
+
+public class UrlsAccessibleKey implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private String url;
+ private String functionCd;
+
+ public UrlsAccessibleKey() {
+ }
+
+ public UrlsAccessibleKey(String url, String functionCd) {
+ setUrl(url);
+ setFunctionCd(functionCd);
+ }
+
+
+ public String getUrl() {
+ return url;
+ }
+
+
+ public String getFunctionCd() {
+ return functionCd;
+ }
+
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+
+ public void setFunctionCd(String functionCd) {
+ this.functionCd = functionCd;
+ }
+
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+
+ if (o == null) {
+ return false;
+ }
+
+ if (!(o instanceof UrlsAccessibleKey)) {
+ return false;
+ }
+
+ final UrlsAccessibleKey key = (UrlsAccessibleKey)o;
+
+ if (getFunctionCd().equals(key.getFunctionCd()) & getUrl().equals(key.getUrl())) {
+ return true;
+ }
+
+ return false;
+ }
+
+
+ public int hashCode() {
+ return getUrl().hashCode() + getFunctionCd().hashCode();
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/User.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/User.java
new file mode 100644
index 00000000..e6c4a178
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/User.java
@@ -0,0 +1,585 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+/**
+ * <p>User.java</p>
+ *
+ * <p>Represents a user data object.</p>
+ *
+ * @version 1.0
+ */
+@SuppressWarnings("rawtypes")
+public class User extends DomainVo {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private Long orgId;
+ private Long managerId;
+ private String firstName;
+ private String middleInitial;
+ private String lastName;
+ private String phone;
+ private String fax;
+ private String cellular;
+ private String email;
+ private Long addressId;
+ private String alertMethodCd;
+ private String hrid;
+ private String orgUserId;
+ private String orgCode;
+ private String address1;
+ private String address2;
+ private String city;
+ private String state;
+ private String zipCode;
+ private String country;
+ private String orgManagerUserId;
+ private String locationClli;
+ private String businessCountryCode;
+ private String businessCountryName;
+ private String businessUnit;
+ private String businessUnitName;
+ private String department;
+ private String departmentName;
+ private String companyCode;
+ private String company;
+ private String zipCodeSuffix;
+ private String jobTitle;
+ private String commandChain;
+ private String siloStatus;
+ private String costCenter;
+ private String financialLocCode;
+
+
+
+ private String loginId;
+ private String loginPwd;
+ private Date lastLoginDate;
+ private boolean active;
+ private boolean internal;
+ private Long selectedProfileId;
+ private Long timeZoneId;
+ private boolean online;
+ private String chatId;
+
+ private Set userApps = new TreeSet();
+
+ private Set pseudoRoles = new TreeSet();
+
+
+ public User() {}
+
+ public Long getAddressId() {
+ return addressId;
+ }
+
+ public String getAlertMethodCd() {
+ return alertMethodCd;
+ }
+
+ public String getCellular() {
+ return cellular;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public String getFax() {
+ return fax;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public String getHrid() {
+ return hrid;
+ }
+
+ public Date getLastLoginDate() {
+ return lastLoginDate;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public String getFullName() {
+ return getFirstName() + " " + getLastName();
+ }
+
+ public String getLoginId() {
+ return loginId;
+ }
+
+ public String getLoginPwd() {
+ return loginPwd;
+ }
+
+ public Long getManagerId() {
+ return managerId;
+ }
+
+ public String getMiddleInitial() {
+ return middleInitial;
+ }
+
+ public String getOrgCode() {
+ return orgCode;
+ }
+
+ public Long getOrgId() {
+ return orgId;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public String getOrgUserId() {
+ return orgUserId;
+ }
+
+ public boolean getActive() {
+ return active;
+ }
+
+ public boolean getInternal() {
+ return internal;
+ }
+
+ public String getAddress1() {
+ return address1;
+ }
+
+ public String getAddress2() {
+ return address2;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public String getZipCode() {
+ return zipCode;
+ }
+
+ public String getBusinessCountryCode() {
+ return businessCountryCode;
+ }
+
+ public String getCommandChain() {
+ return commandChain;
+ }
+
+ public String getCompany() {
+ return company;
+ }
+
+ public String getCompanyCode() {
+ return companyCode;
+ }
+
+ public String getDepartment() {
+ return department;
+ }
+
+ public String getJobTitle() {
+ return jobTitle;
+ }
+
+ public String getLocationClli() {
+ return locationClli;
+ }
+
+ public String getOrgManagerUserId() {
+ return orgManagerUserId;
+ }
+
+ public String getZipCodeSuffix() {
+ return zipCodeSuffix;
+ }
+
+ public String getBusinessCountryName() {
+ return businessCountryName;
+ }
+
+ public Set getPseudoRoles() {
+ return pseudoRoles;
+ }
+
+ public Long getSelectedProfileId() {
+ return selectedProfileId;
+ }
+
+ public void setAddressId(Long addressId) {
+ this.addressId = addressId;
+ }
+
+ public void setAlertMethodCd(String alertMethodCd) {
+ this.alertMethodCd = alertMethodCd;
+ }
+
+ public void setCellular(String cellular) {
+ this.cellular = cellular;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public void setFax(String fax) {
+ this.fax = fax;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public void setHrid(String hrid) {
+ this.hrid = hrid;
+ }
+
+ public void setLastLoginDate(Date lastLoginDate) {
+ this.lastLoginDate = lastLoginDate;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public void setLoginId(String loginId) {
+ this.loginId = loginId;
+ }
+
+ public void setLoginPwd(String loginPwd) {
+ this.loginPwd = loginPwd;
+ }
+
+ public void setManagerId(Long managerId) {
+ this.managerId = managerId;
+ }
+
+ public void setMiddleInitial(String middleInitial) {
+ this.middleInitial = middleInitial;
+ }
+
+ public void setOrgCode(String orgCode) {
+ this.orgCode = orgCode;
+ }
+
+ public void setOrgId(Long orgId) {
+ this.orgId = orgId;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public void setOrgUserId(String orgUserId) {
+ this.orgUserId = orgUserId;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+ public void setInternal(boolean internal) {
+ this.internal = internal;
+ }
+
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ public void setAddress2(String address2) {
+ this.address2 = address2;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public void setZipCode(String zipCode) {
+ this.zipCode = zipCode;
+ }
+
+ public void setBusinessCountryCode(String businessCountryCode) {
+ this.businessCountryCode = businessCountryCode;
+ }
+
+ public void setCommandChain(String commandChain) {
+ this.commandChain = commandChain;
+ }
+
+ public void setCompany(String company) {
+ this.company = company;
+ }
+
+ public void setCompanyCode(String companyCode) {
+ this.companyCode = companyCode;
+ }
+
+ public void setDepartment(String department) {
+ this.department = department;
+ }
+
+ public void setJobTitle(String jobTitle) {
+ this.jobTitle = jobTitle;
+ }
+
+ public void setLocationClli(String locationClli) {
+ this.locationClli = locationClli;
+ }
+
+ public void setOrgManagerUserId(String orgManagerUserId) {
+ this.orgManagerUserId = orgManagerUserId;
+ }
+
+ public void setZipCodeSuffix(String zipCodeSuffix) {
+ this.zipCodeSuffix = zipCodeSuffix;
+ }
+
+ public void setBusinessCountryName(String businessCountryName) {
+ this.businessCountryName = businessCountryName;
+ }
+
+ public void setPseudoRoles(Set pseudoRoles) {
+ this.pseudoRoles = pseudoRoles;
+ }
+
+ public void setSelectedProfileId(Long selectedProfileId) {
+ this.selectedProfileId = selectedProfileId;
+ }
+
+ public Long getTimeZoneId() {
+ return timeZoneId;
+ }
+
+ public void setTimeZoneId(Long timeZoneId) {
+ this.timeZoneId = timeZoneId;
+ }
+
+ public String getBusinessUnit() {
+ return businessUnit;
+ }
+
+ public void setBusinessUnit(String businessUnit) {
+ this.businessUnit = businessUnit;
+ }
+
+ public String getSiloStatus() {
+ return siloStatus;
+ }
+
+ public void setSiloStatus(String siloStatus) {
+ this.siloStatus = siloStatus;
+ }
+
+ public String getCostCenter() {
+ return costCenter;
+ }
+
+ public void setCostCenter(String costCenter) {
+ this.costCenter = costCenter;
+ }
+
+ public String getFinancialLocCode() {
+ return financialLocCode;
+ }
+
+ public void setFinancialLocCode(String financialLocCode) {
+ this.financialLocCode = financialLocCode;
+ }
+
+ public String getBusinessUnitName() {
+ return businessUnitName;
+ }
+
+ public void setBusinessUnitName(String businessUnitName) {
+ this.businessUnitName = businessUnitName;
+ }
+
+ public String getDepartmentName() {
+ return departmentName;
+ }
+
+ public void setDepartmentName(String departmentName) {
+ this.departmentName = departmentName;
+ }
+
+ public int compareTo(Object obj){
+ User user = (User)obj;
+
+ String c1 = getLastName() + getFirstName() + getMiddleInitial();
+ String c2 = user.getLastName() + user.getFirstName() + user.getMiddleInitial();
+
+ return c1.compareTo(c2);
+ }
+
+ public boolean isOnline() {
+ return online;
+ }
+
+ public void setOnline(boolean online) {
+ this.online = online;
+ }
+
+ public String getChatId() {
+ return chatId;
+ }
+
+ public void setChatId(String chatId) {
+ this.chatId = chatId;
+ }
+
+ public Set getUserApps() {
+ return userApps;
+ }
+
+ public void setUserApps(Set userApps) {
+ this.userApps = userApps;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void addAppRoles(App app, SortedSet<Role> roles) {
+ if(roles!=null){
+ //add all
+ Set userApps = new TreeSet();
+ Iterator itr = roles.iterator();
+ while(itr.hasNext()){
+ Role role = (Role) itr.next();
+ UserApp userApp = new UserApp();
+ userApp.setUserId(this.id);
+ userApp.setApp(app);
+ userApp.setRole(role);
+ userApps.add(userApp);
+ }
+ setUserApps(userApps);
+ } else {
+ //remove all
+ this.userApps.clear();
+ }
+
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public SortedSet<Role> getAppRoles(App app) {
+ SortedSet<Role> roles = new TreeSet();
+ Set apps = getUserApps();
+ Iterator appsItr = apps.iterator();
+ UserApp userApp = null;
+ //getting default app
+ while(appsItr.hasNext()){
+ UserApp tempUserApp = (UserApp)appsItr.next();
+ if(tempUserApp.getApp().getId().equals(app.getId())){
+ userApp = tempUserApp;
+ roles.add(userApp.getRole());
+ }
+ }
+ return roles;
+ }
+
+ public SortedSet<Role> getRoles() {
+ App app = new App();
+ app.setId(new Long(1));
+ app.setName("Default");
+ return getAppRoles(app);
+ }
+
+ public UserApp getDefaultUserApp(){
+ Set apps = getUserApps();
+ Iterator appsItr = apps.iterator();
+ UserApp userApp = null;
+ //getting default app
+ while(appsItr.hasNext()){
+ UserApp tempApp = (UserApp)appsItr.next();
+ if(tempApp.equals(new Long(1))){
+ userApp = tempApp;
+ break;
+ }
+ }
+ return userApp;
+ }
+
+ public void setRoles(SortedSet<Role> roles) {
+ App app = new App();
+ app.setId(new Long(1));
+ app.setName("Default");
+ addAppRoles(app,roles);
+ }
+
+ public void removeRole(Long roleId) {
+ Set apps = getUserApps();
+ Iterator appsItr = apps.iterator();
+ //getting default app
+ while(appsItr.hasNext()){
+ UserApp tempUserApp = (UserApp)appsItr.next();
+ if(tempUserApp.getRole().getId().equals(roleId)){
+ appsItr.remove();
+ }
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public void addRole(Role role){
+ if(role!=null){
+ SortedSet<Role> roles = getRoles();
+ if(roles==null){
+ roles = new TreeSet();
+ }
+ roles.add(role);
+ setRoles(roles);
+ }
+
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserApp.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserApp.java
new file mode 100644
index 00000000..5c2c383f
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserApp.java
@@ -0,0 +1,108 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+// Generated Aug 27, 2014 5:51:36 PM by Hibernate Tools 3.4.0.CR1
+
+/**
+ * FnUserRole generated by hbm2java
+ */
+@SuppressWarnings("rawtypes")
+public class UserApp implements java.io.Serializable, Comparable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private Long userId;
+ private App app;
+ private Role role;
+ private Short priority;
+
+ public UserApp() {
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ public App getApp() {
+ return app;
+ }
+
+ public void setApp(App app) {
+ this.app = app;
+ }
+
+ public Role getRole() {
+ return role;
+ }
+
+ public void setRole(Role role) {
+ this.role = role;
+ }
+
+ public Short getPriority() {
+ return this.priority;
+ }
+
+ public void setPriority(Short priority) {
+ this.priority = priority;
+ }
+
+ public boolean equals(Object other) {
+ if ((this == other))
+ return true;
+ if ((other == null))
+ return false;
+ if (!(other instanceof UserApp))
+ return false;
+ UserApp castOther = (UserApp) other;
+
+ return (this.getUserId().equals(castOther.getUserId()))
+ && (this.getApp().getId().equals(castOther.getApp().getId()))
+ && (this.getRole().getId().equals(castOther.getRole().getId()))
+ && ((this.priority==null && castOther.getPriority()==null) || this.getPriority().equals(castOther.getPriority()));
+ }
+
+ public int hashCode() {
+ int result = 17;
+
+ result = 37 * result + (int) (this.getUserId()==null ? 0 : this.getUserId().intValue());
+ result = 37 * result + (int) (this.getApp().getId()==null ? 0 : this.getApp().getId().intValue());
+ result = 37 * result + (int) (this.getRole().getId()==null ? 0 : this.getRole().getId().intValue());
+ result = 37 * result + (int) (this.priority==null ? 0 : this.priority);
+ return result;
+ }
+
+ public int compareTo(Object other){
+ UserApp castOther = (UserApp) other;
+
+ Long c1 = (this.getUserId()==null ? 0 : this.getUserId()) + (this.getApp()==null||this.getApp().getId()==null ? 0 : this.getApp().getId()) + (this.getRole()==null||this.getRole().getId()==null ? 0 : this.getRole().getId()) + (this.priority==null ? 0 : this.priority);
+ Long c2 = (castOther.getUserId()==null ? 0 : castOther.getUserId()) + (castOther.getApp()==null||castOther.getApp().getId()==null ? 0 : castOther.getApp().getId()) + (castOther.getRole()==null||castOther.getRole().getId()==null ? 0 : castOther.getRole().getId()) + (castOther.priority==null ? 0 : castOther.priority);
+
+ return c1.compareTo(c2);
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserAppId.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserAppId.java
new file mode 100644
index 00000000..9458b90a
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserAppId.java
@@ -0,0 +1,88 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain;
+
+// Generated Aug 27, 2014 5:51:36 PM by Hibernate Tools 3.4.0.CR1
+
+/**
+ * FnUserRoleId generated by hbm2java
+ */
+public class UserAppId implements java.io.Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private Long userId;
+ private App app;
+ private Role role;
+
+ public UserAppId() {
+ super();
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ public App getApp() {
+ return app;
+ }
+
+ public void setApp(App app) {
+ this.app = app;
+ }
+
+ public Role getRole() {
+ return role;
+ }
+
+ public void setRole(Role role) {
+ this.role = role;
+ }
+
+ public boolean equals(Object other) {
+ if ((this == other))
+ return true;
+ if ((other == null))
+ return false;
+ if (!(other instanceof UserAppId))
+ return false;
+ UserAppId castOther = (UserAppId) other;
+
+ return (this.getUserId() == castOther.getUserId())
+ && (this.getApp().getId() == castOther.getApp().getId())
+ && (this.getRole().getId() == castOther.getRole().getId());
+ }
+
+ public int hashCode() {
+ int result = 17;
+
+ result = 37 * result + (int) (this.getUserId()==null ? 0 : this.getUserId().intValue());
+ result = 37 * result + (int) (this.getApp().getId()==null ? 0 : this.getApp().getId().intValue());
+ result = 37 * result + (int) (this.getRole().getId()==null ? 0 : this.getRole().getId().intValue());
+ return result;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/sessionmgt/TimeoutVO.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/sessionmgt/TimeoutVO.java
new file mode 100644
index 00000000..57e474c2
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/sessionmgt/TimeoutVO.java
@@ -0,0 +1,63 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain.sessionmgt;
+
+public class TimeoutVO implements Comparable<TimeoutVO>{
+
+ private String jSessionId;
+ private Long sessionTimOutMilliSec;
+
+ public TimeoutVO(){
+
+ }
+
+ public TimeoutVO(String _jSessionId, Long _sessionTimOutMilliSec) {
+ setjSessionId(_jSessionId);
+ setSessionTimOutMilliSec(_sessionTimOutMilliSec);
+
+ }
+
+ public String getjSessionId() {
+ return jSessionId;
+ }
+
+ public void setjSessionId(String jSessionId) {
+ this.jSessionId = jSessionId;
+ }
+
+ public Long getSessionTimOutMilliSec() {
+ return sessionTimOutMilliSec;
+ }
+
+ public void setSessionTimOutMilliSec(Long sessionTimOutMilliSec) {
+ this.sessionTimOutMilliSec = sessionTimOutMilliSec;
+ }
+
+ @Override
+ public int compareTo(TimeoutVO o) {
+ return sessionTimOutMilliSec.compareTo(o.sessionTimOutMilliSec);
+ }
+
+
+
+
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Attribute.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Attribute.java
new file mode 100644
index 00000000..a78d7bfa
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Attribute.java
@@ -0,0 +1,62 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain.support;
+
+public class Attribute {
+ public double width;
+ public double top;
+ public double left;
+ public String name;
+ public double height;
+
+ public double getWidth() {
+ return width;
+ }
+ public void setWidth(double width) {
+ this.width = width;
+ }
+ public double getTop() {
+ return top;
+ }
+ public void setTop(double top) {
+ this.top = top;
+ }
+ public double getLeft() {
+ return left;
+ }
+ public void setLeft(double left) {
+ this.left = left;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public double getHeight() {
+ return height;
+ }
+ public void setHeight(double height) {
+ this.height = height;
+ }
+
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/CollaborateList.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/CollaborateList.java
new file mode 100644
index 00000000..eaeab84d
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/CollaborateList.java
@@ -0,0 +1,56 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain.support;
+
+import java.io.Serializable;
+import java.util.HashSet;
+
+public class CollaborateList implements Serializable {
+
+ private static final long serialVersionUID = -4104440747626736243L;
+ private HashSet<String> userNameList = new HashSet<String>();
+ private static CollaborateList userListData = new CollaborateList();
+ private CollaborateList(){}
+
+ public static CollaborateList getInstance(){
+ return userListData;
+ }
+
+ public HashSet<String> getAllUserName(){
+ return userNameList;
+ }
+
+ public static void addUserName(String name){
+ final HashSet<String> allUserName = CollaborateList.getInstance().getAllUserName();
+ if(allUserName.contains(name)){
+ //System.out.println("cannot add this user");
+ }else{
+ allUserName.add(name);
+ }
+ }
+
+ public static void delUserName(String name){
+ final HashSet<String> allUserName = CollaborateList.getInstance().getAllUserName();
+ allUserName.remove((String) name);
+ }
+
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Container.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Container.java
new file mode 100644
index 00000000..7d52af40
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Container.java
@@ -0,0 +1,331 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain.support;
+
+import java.util.List;
+import java.util.Map;
+
+public class Container {
+
+ String id;
+
+ public String name;
+
+ Size size;
+
+ Position p;
+
+ public Map<String,Container> containerRowCol;
+
+ public Map<String,Element> elementRowCol;
+
+ int numOfRows;
+
+ int numOfCols;
+
+ double sum = 0;
+
+ double interEleWd;
+
+ double interEleH;
+
+ double interEleToContainerWd;
+
+ double interEleToContainerH;
+
+ double interEleToInnerContainerWd;
+
+ double interEleToInnerContainerH;
+
+ public double top;
+
+ public double left;
+
+ public double height;
+
+ public double width;
+
+ public String visibilityType;
+
+
+
+
+
+ public Container(String id, String name, int numOfRows, int numOfCols, double interEleWd, double interEleH,
+ double interEleToContainerWd, double interEleToContainerH, double interEleToInnerContainerWd,
+ double interEleToInnerContainerH) {
+
+ this.id = id;
+ this.name = name;
+ this.numOfRows = numOfRows;
+ this.numOfCols = numOfCols;
+ this.interEleWd = interEleWd;
+ this.interEleH = interEleH;
+ this.interEleToContainerWd = interEleToContainerWd;
+ this.interEleToContainerH = interEleToContainerH;
+ this.interEleToInnerContainerWd = interEleToInnerContainerWd;
+ this.interEleToInnerContainerH = interEleToInnerContainerH;
+
+ }
+
+
+ public List<Container> innerCList;
+
+ public List<Element> elementList;
+
+ public Container() {
+
+ }
+
+
+
+ public Map<String, Container> getContainerRowCol() {
+ return containerRowCol;
+ }
+
+
+
+
+ public Map<String, Element> getElementRowCol() {
+ return elementRowCol;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+ public void setInnerContainer(Map<String,Container> innerCon) {
+ containerRowCol = innerCon;
+ }
+
+ public void setElements(Map<String,Element> innerE) {
+ elementRowCol = innerE;
+ }
+
+
+ public Position getP() {
+ return p;
+ }
+
+ public void setP(Position p) {
+ this.p = p;
+ }
+
+
+ public void setTop(double top) {
+ this.top = top;
+ }
+
+
+ public void setLeft(double left) {
+ this.left = left;
+ }
+
+
+ public void setHeight(double height) {
+ this.height = height;
+ }
+
+
+ public void setWidth(double width) {
+ this.width = width;
+ }
+
+
+ public void setInnerCList(List<Container> innerCList) {
+ this.innerCList = innerCList;
+ }
+
+
+
+ public void setElementList(List<Element> elementList) {
+ this.elementList = elementList;
+ }
+
+ public void setVisibilityType(String visibilityType) {
+ this.visibilityType = visibilityType;
+ }
+
+ public Size computeSize() {
+ Size size = new Size();
+ double width = 0;
+ double height = 0;
+ // System.out.println("Inside computesize");
+ for (int i = 0; i<numOfRows; i++) {
+ if ((containerRowCol != null && containerRowCol.containsKey(i+String.valueOf(numOfCols-1))) ||
+ (elementRowCol!=null && elementRowCol.containsKey(i+String.valueOf(numOfCols-1)))) {
+ for (int j = 0; j < numOfCols; j++) {
+ if (containerRowCol!=null && containerRowCol.containsKey(i+String.valueOf(j))) {
+ width+=containerRowCol.get(i+String.valueOf(j)).computeSize().getWidth();
+ // System.out.println(containerRowCol.get(i+String.valueOf(j)).getName()+" "+
+ // containerRowCol.get(i+String.valueOf(j)).computeSize().getWidth());
+ }else if (elementRowCol!=null && elementRowCol.containsKey(i+String.valueOf(j)))
+ width+=elementRowCol.get(i+String.valueOf(j)).computeSize().getWidth();
+ }
+ break;
+ }
+ }
+ // System.out.println("Object name "+this.getName());
+ if (this.getName().equals("Broadworks complex") || this.getName().equals("Application Servers")
+ || this.getName().equals("Call Session Control") || this.getName().equals("GMLC Provider") || this.getName().equals("Neo") || this.getName().equals("Support")) {
+ width+=(numOfCols-1)*interEleWd+2*interEleToInnerContainerWd;
+ } else {
+ width+=(numOfCols-1)*interEleWd+2*interEleToContainerWd;
+ }
+ size.setWidth(width);
+ for (int j = 0; j<numOfCols; j++) {
+ // System.out.println("Inside computesize height "+numOfCols);
+ // System.out.println(containerRowCol.toString());
+ if ((containerRowCol != null && containerRowCol.containsKey(String.valueOf(numOfRows-1)+j)) ||
+ (elementRowCol!= null && elementRowCol.containsKey(String.valueOf(numOfRows-1)+j))) {
+ //System.out.println("Inside if");
+ for (int i = 0; i < numOfRows; i++) {
+ if (containerRowCol!= null && containerRowCol.containsKey(i+String.valueOf(j))) {
+ height+=containerRowCol.get(i+String.valueOf(j)).computeSize().getHeight();
+ System.out.println("My C name "+this.getName()+":"+containerRowCol.get(i+String.valueOf(j)).computeSize().getHeight());
+ }
+ else if (elementRowCol!=null && elementRowCol.containsKey(i+String.valueOf(j)))
+ height+=elementRowCol.get(String.valueOf(i)+String.valueOf(j)).computeSize().getHeight();
+ }
+ break;
+ }
+ }
+ if (this.getName().equals("Broadworks complex") || this.getName().equals("Application Servers")
+ || this.getName().equals("Call Session Control") || this.getName().equals("GMLC Provider") || this.getName().equals("Neo") || this.getName().equals("Support")) {
+ height+=(numOfRows-1)*interEleH+2*interEleToInnerContainerH+0.1;
+ } else {
+ if (this.getName().equals("VoLTE UE") || this.getName().equals("3G UE") || this.getName().equals("HC UE-A")
+ || this.getName().equals("HC UE-B") || this.getName().equals("VNI UE") || this.getName().equals("PSTN")) {
+ height+=(numOfRows-1)*interEleH+interEleToContainerH/2;
+ }else
+ height+=(numOfRows-1)*interEleH+2*interEleToContainerH;
+ }
+ size.setHeight(height);
+ // System.out.println("C name "+this.getName()+" height "+height);
+ System.out.println("test C height "+this.getName()+" height "+height+" (numOfRows-1)*interEleH "+(numOfRows-1)*interEleH+
+ " interEleToContainerH "+interEleToContainerH/2);
+ return size;
+ }
+
+
+
+ public void computeElementPositions() {
+ double xsum = 0;
+ double ysum = 0;
+ for (int i=0; i<numOfRows; i++){
+ for (int j=0; j<numOfCols; j++){
+ if (containerRowCol != null && containerRowCol.containsKey(String.valueOf(i)+ String.valueOf(j))) {
+ Container c = containerRowCol.get(String.valueOf(i)+ String.valueOf(j));
+ Position p = new Position();
+ //System.out.println("within container");
+ p.x =j*interEleWd+xsum+this.getP().getX()+
+ interEleToContainerWd;
+ ysum = 0;
+ for (int k=0; k<i; k++) {
+ if (containerRowCol.containsKey(String.valueOf(k)+ String.valueOf(j)))
+ ysum+= containerRowCol.get(String.valueOf(k)+ String.valueOf(j)).computeSize().getHeight();
+ else if (elementRowCol.containsKey(String.valueOf(k)+ String.valueOf(j)))
+ ysum+= elementRowCol.get(String.valueOf(k)+ String.valueOf(j)).computeSize().getHeight();
+ }
+ p.y = i*interEleH+ysum+this.getP().getY() + interEleToContainerH;
+ // containerCoord.add(c,p);
+ xsum+= c.computeSize().getWidth();
+ c.setP(p);
+
+ } else if (elementRowCol!=null && elementRowCol.containsKey(String.valueOf(i)+ String.valueOf(j))) {
+ Element e = elementRowCol.get(String.valueOf(i)+ String.valueOf(j));
+ Position p = new Position();
+ // System.out.println("i "+i+"j "+j);
+ // System.out.println("element "+e.getName());
+ // System.out.println("Is this "+this.getP());
+ if (j==numOfCols-1) {
+ for (int t=0; t<i; t++) {
+ if (containerRowCol!=null && containerRowCol.containsKey(String.valueOf(t)+ String.valueOf(j-1))) {
+ if (!elementRowCol.containsKey(String.valueOf(i)+ String.valueOf(j-1)) &&
+ !containerRowCol.containsKey(String.valueOf(i)+ String.valueOf(j-1))) {
+ xsum+=containerRowCol.get(String.valueOf(t)+ String.valueOf(j-1)).computeSize().getWidth();
+ break;
+ }
+ }
+ }
+ }
+ if (this.getName().equals("Broadworks complex") || this.getName().equals("Application Servers")
+ || this.getName().equals("Call Session Control") || this.getName().equals("GMLC Provider")
+ || this.getName().equals("Neo") || this.getName().equals("Support")) {
+ p.x = j*interEleWd+xsum+this.getP().getX()+interEleToInnerContainerWd;
+ }
+ else if (this.getName().equals("VNI UE") || this.getName().equals("PSTN") || this.getName().equals("3G UE")
+ || this.getName().equals("HC UE-A") || this.getName().equals("HC UE-B")) {
+ p.x = j*interEleWd+xsum+this.getP().getX()+interEleToContainerWd-0.8;
+ }else {
+ p.x = j*interEleWd+xsum+this.getP().getX()+interEleToContainerWd;
+ System.out.println("element name "+e.getName()+" j*interEleWd "+j*interEleWd
+ +" xsum " +xsum+"this.getP().getX() "+this.getP().getX()+" interEleToContainerWd " +interEleToContainerWd+" p.x "+p.x);
+ }
+ ysum = 0;
+ for (int k=0; k<i; k++) {
+ if (containerRowCol!= null && containerRowCol.containsKey(String.valueOf(k)+ String.valueOf(j)))
+ ysum+= containerRowCol.get(String.valueOf(k)+ String.valueOf(j)).computeSize().getHeight();
+ else if (elementRowCol!=null && elementRowCol.containsKey(String.valueOf(k)+ String.valueOf(j)))
+ ysum+= elementRowCol.get(String.valueOf(k)+ String.valueOf(j)).computeSize().getHeight();
+ else if (containerRowCol!= null) {
+ for (int chk=j; chk>0; chk--) {
+ if (containerRowCol.containsKey(String.valueOf(k)+ String.valueOf(chk-1))) {
+ if (containerRowCol.get(String.valueOf(k)+ String.valueOf(chk-1)).computeSize().getWidth()
+ + containerRowCol.get(String.valueOf(k)+ String.valueOf(chk-1)).getP().getX() > p.x) {
+ ysum+= containerRowCol.get(String.valueOf(k)+ String.valueOf(chk-1)).computeSize().getHeight();
+ break;
+ }
+ }
+ }
+ }
+
+ }
+ if (this.getName().equals("Broadworks complex") || this.getName().equals("Application Servers")
+ || this.getName().equals("Call Session Control") || this.getName().equals("GMLC Provider") || this.getName().equals("Neo") || this.getName().equals("Support")) {
+ p.y = this.getP().getY()+ysum+i*interEleH+interEleToInnerContainerH+1;
+ } else {
+ // System.out.println("element name "+e.getName()+" this.getP().getY() "+this.getP().getY()
+ // +" ysum " +ysum+" i*interEleH "+i*interEleH+" interEleToContainerH " +interEleToContainerH);
+ if (e.getName().equals("")) {
+ p.y = this.getP().getY()+ysum+i*interEleH+(interEleToContainerH);
+ System.out.println("test element name "+this.getName()+" Container height "+this.computeSize().getHeight()+" this.getP().getY() "+this.getP().getY()
+ +" ysum " +ysum+" i*interEleH "+i*interEleH+" interEleToContainerH-3 " +interEleToContainerH+" p.y "+p.y);
+ }else
+ p.y = this.getP().getY()+ysum+i*interEleH+interEleToContainerH;
+ // System.out.println(e.getName()+"My contain this.getP().getY() "+this.getP().getY()
+ // +"elements Y "+p.y);
+ }
+ xsum+= e.computeSize().getWidth();
+ e.setP(p);
+ System.out.println("my element name "+e.getName()+" e.getP().getX() "+e.getP().getX());
+ System.out.println();
+ }
+ }
+ xsum = 0;
+ }
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Domain.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Domain.java
new file mode 100644
index 00000000..3e742785
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Domain.java
@@ -0,0 +1,259 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+
+package org.openecomp.portalsdk.core.domain.support;
+
+import java.util.List;
+import java.util.Map;
+
+public class Domain {
+ // Unique identifier of the domain
+ String id;
+ // List<Container> cList;
+
+ public String name;
+ Size size;
+ Position p;
+
+ //Attribute1 at;
+
+ public Position getP() {
+ return p;
+ }
+
+ public void setP(Position p) {
+ this.p = p;
+ }
+
+ //Horizontal space between a pair of containers
+ double interContWd = 1.0;
+ //Vertical space between a pair of containers
+ double interContH;
+ double domainToLayoutWd;
+ double domainToContH;
+ double domainToLayoutH;
+ int numOfRowsofContainer;
+ int numOfColsofContainer;
+ boolean indexChanged;
+ Map<String,Container> containerRowCol;
+ public Domain(String id, String name, double interContWd, double interContH, double domainToLayoutWd,
+ double domainToLayoutH, double domainToContH, int numOfRowsofContainer, int numOfColsofContainer) {
+ this.id = id;
+ this.name = name;
+ this.interContWd = interContWd;
+ this.interContH = interContH;
+ this.domainToLayoutWd = domainToLayoutWd;
+ this.domainToLayoutH = domainToLayoutH;
+ this.domainToContH = domainToContH;
+ this.numOfRowsofContainer = numOfRowsofContainer;
+ this.numOfColsofContainer = numOfColsofContainer;
+ // at = new Attribute1();
+ }
+
+
+
+
+ public double top;
+
+ public double left;
+
+ public double height;
+
+ public double width;
+
+ public List<Container> containerList;
+
+ public double newXafterColl;
+
+ public double YafterColl;
+
+ public void setNewXafterColl(double newXafterColl) {
+ this.newXafterColl = newXafterColl;
+ }
+
+ public double getNewXafterColl() {
+ return newXafterColl;
+ }
+
+ public double getYafterColl() {
+ return YafterColl;
+ }
+
+ public void setYafterColl(double yafterColl) {
+ YafterColl = yafterColl;
+ }
+
+ public void setDomainToLayoutWd(double domainToLayoutWd) {
+ this.domainToLayoutWd = domainToLayoutWd;
+ }
+
+ public double getDomainToLayoutWd() {
+ return domainToLayoutWd;
+ }
+
+ public double getTop() {
+ return top;
+ }
+
+ public void setTop(double top) {
+ this.top = top;
+ }
+
+ public double getLeft() {
+ return left;
+ }
+
+ public void setLeft(double left) {
+ this.left = left;
+ }
+
+ public double getHeight() {
+ return height;
+ }
+
+ public void setHeight(double height) {
+ this.height = height;
+ }
+
+ public double getWidth() {
+ return width;
+ }
+
+ public void setWidth(double width) {
+ this.width = width;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setContainers(Map<String,Container> containerRowCol) {
+ this.containerRowCol = containerRowCol;
+ }
+
+ public Map<String, Container> getContainerRowCol() {
+ return containerRowCol;
+ }
+
+
+ /* public Attribute1 getAt() {
+ return at;
+ }
+
+ public void setAt(Attribute1 at) {
+ this.at = at;
+ }*/
+
+ public void setContainerList(List<Container> containerList) {
+ // new ArrayList<Container>();
+ this.containerList = containerList;
+ }
+
+
+
+/* public boolean isCollapsed() {
+ return collapsed;
+ }
+
+ public void setCollapsed(boolean collapsed) {
+ this.collapsed = collapsed;
+ }*/
+
+ public boolean isIndexChanged() {
+ return indexChanged;
+ }
+
+ public void setIndexChanged(boolean indexChanged) {
+ this.indexChanged = indexChanged;
+ }
+
+ //Compute the size of any domain
+ public Size computeSize() {
+ size = new Size();
+ size.setHeight(5);
+ double width = 0;
+ for (int i = 0; i < numOfRowsofContainer; i++) {
+ if (containerRowCol!=null && containerRowCol.containsKey(String.valueOf(i)+String.valueOf(numOfColsofContainer-1))) {
+ for (int j = 0; j < numOfColsofContainer; j++) {
+ width+=containerRowCol.get(String.valueOf(i)+String.valueOf(j)).computeSize().getWidth();
+ }
+ break;
+ }
+
+ }
+ width+=(numOfColsofContainer-1)*interContWd;
+ if (this.getName().equals("VNI"))
+ size.setWidth(width-4);
+ else
+ size.setWidth(width);
+ return size;
+ }
+
+ public void computeConatinerPositions() {
+
+ double xsum = 0;
+ double ysum = 0;
+ for (int i=0; i< numOfRowsofContainer; i++){
+ for (int j=0; j<numOfColsofContainer; j++){
+ if (containerRowCol!=null && containerRowCol.containsKey(String.valueOf(i)+ String.valueOf(j))) {
+ Container c = containerRowCol.get(String.valueOf(i)+ String.valueOf(j));
+ // System.out.println("container "+c.toString());
+ Position p = new Position();
+ if (this.getName().equals("VNI")) {
+ p.x = j*(interContWd-2)+xsum+domainToLayoutWd;
+ } else
+ p.x = j*interContWd+xsum+domainToLayoutWd;
+ // this.computeSize();
+ // p.x = j*interContWd+xsum+this.getP().getX();
+ ysum = 0;
+ for (int k=0; k<i; k++) {
+ // System.out.println("i value "+i);
+ if (containerRowCol.containsKey(String.valueOf(k)+ String.valueOf(j)))
+ ysum+= containerRowCol.get(String.valueOf(k)+ String.valueOf(j)).computeSize().getHeight();
+ // System.out.println("Container height "+containerRowCol.get(String.valueOf(k)+ String.valueOf(j)).getName()+
+ // ":"+" "+containerRowCol.get(String.valueOf(k)+ String.valueOf(j)).computeSize().getHeight());
+ else if (j>0 && containerRowCol.containsKey(String.valueOf(k)+ String.valueOf(j-1)) &&
+ !containerRowCol.get(String.valueOf(i)+ String.valueOf(j)).getName().equals("Alpharetta")) {
+ ysum+= containerRowCol.get(String.valueOf(k)+ String.valueOf(j-1)).computeSize().getHeight();
+ }
+ }
+ System.out.println("C name "+c.getName()+" ysum "+ysum+" domainToLayoutH "+domainToLayoutH+" this.computeSize().getHeight() "+
+ this.computeSize().getHeight()+" domainToContH "+domainToContH+" interContH "+interContH);
+ p.y = domainToLayoutH+ysum+this.computeSize().getHeight()+
+ domainToContH+i*interContH;
+
+ c.setP(p);
+ xsum+= c.computeSize().getWidth();
+
+ }
+ }
+ xsum = 0;
+
+ }
+
+ }
+
+}
+
+
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/DomainVo.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/DomainVo.java
new file mode 100644
index 00000000..645a9132
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/DomainVo.java
@@ -0,0 +1,179 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain.support;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+import org.openecomp.portalsdk.core.domain.FusionVo;
+
+
+/* Super class from which all data objects descend */
+@SuppressWarnings("rawtypes")
+public class DomainVo extends FusionVo implements Serializable, Cloneable, Comparable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ protected Long id;
+ protected Date created;
+ protected Date modified;
+ protected Long createdId;
+ protected Long modifiedId;
+ protected Long rowNum;
+
+ protected Serializable auditUserId;
+
+ Set auditTrail = null;
+
+ public DomainVo() {}
+
+
+ public void setId(Long i) {
+ id = i;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public void setModified(Date modified) {
+ this.modified = modified;
+ }
+
+ public void setCreatedId(Long createdId) {
+ this.createdId = createdId;
+ }
+
+ public void setModifiedId(Long modifiedId) {
+ this.modifiedId = modifiedId;
+ }
+
+ public void setAuditUserId(Serializable auditUserId) {
+ this.auditUserId = auditUserId;
+ }
+
+ public void setRowNum(Long rowNum) {
+ this.rowNum = rowNum;
+ }
+
+ public void setAuditTrail(Set auditTrail) {
+ this.auditTrail = auditTrail;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public Date getModified() {
+ return modified;
+ }
+
+ public Long getCreatedId() {
+ return createdId;
+ }
+
+ public Long getModifiedId() {
+ return modifiedId;
+ }
+
+ public Serializable getAuditUserId() {
+ return auditUserId;
+ }
+
+ public Long getRowNum() {
+ return rowNum;
+ }
+
+ public Set getAuditTrail() {
+ return auditTrail;
+ }
+
+/* public void addAuditTrailLog(AuditLog auditLog) {
+ if (getAuditTrail() == null) {
+ setAuditTrail(new HashSet());
+ }
+
+ getAuditTrail().add(auditLog);
+ }*/
+
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+
+ public Object copy() {
+ return copy(false);
+ }
+
+
+ public Object copy(boolean isIdNull) {
+ // let's create a "copy" of the object using serialization
+ ByteArrayOutputStream baos = null;
+ ByteArrayInputStream bais = null;
+ ObjectOutputStream oos = null;
+ ObjectInputStream ois = null;
+
+ DomainVo newVo = null;
+
+ try {
+
+ baos = new ByteArrayOutputStream();
+ oos = new ObjectOutputStream(baos);
+ oos.writeObject(this);
+
+ bais = new ByteArrayInputStream(baos.toByteArray());
+ ois = new ObjectInputStream(bais);
+ newVo = (DomainVo)ois.readObject();
+
+ if (isIdNull) {
+ newVo.setId(null);
+ }
+
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return newVo;
+ }
+
+
+
+ public int compareTo(Object obj){
+ Long c1 = getId();
+ Long c2 = ((DomainVo)obj).getId();
+
+ return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Element.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Element.java
new file mode 100644
index 00000000..84f929fd
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Element.java
@@ -0,0 +1,161 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain.support;
+
+public class Element {
+
+ public String id;
+ public String name;
+
+ public double top;
+
+ public double left;
+
+ public double height;
+
+ public String imgFileName;
+
+ public String borderType;
+
+ public String bgColor;
+
+ public ElementDetails details;
+
+ //public List<ElementDetails> details;
+
+
+ public void setBgColor(String bgColor) {
+ this.bgColor = bgColor;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setTop(double top) {
+ this.top = top;
+ }
+
+ public void setLeft(double left) {
+ this.left = left;
+ }
+
+ public void setHeight(double height) {
+ this.height = height;
+ }
+
+ public void setWidth(double width) {
+ this.width = width;
+ }
+
+
+ public double width;
+
+
+ public String getId() {
+ return id;
+ }
+
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+ Position p;
+
+ public Position getP() {
+ return p;
+ }
+
+ public void setP(Position p) {
+ this.p = p;
+ }
+
+
+
+ public Element(String id, String name, String imgPath, String bgColor, String logical_group, String display_longname,
+ String description, String primary_function, String key_interfaces, String location, String vendor, String vendor_shortname) {
+ this.id = id;
+ this.name = name;
+ this.imgFileName = imgPath;
+ this.bgColor = bgColor;
+
+
+ }
+
+ public Element(String id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public Element(String id, String name, String imgFilename, String bgColor, String borderType, ElementDetails details) {
+ this.id = id;
+ this.name = name;
+ this.imgFileName = imgFilename;
+ this.bgColor = bgColor;
+ this.borderType = borderType;
+ this.details = details;
+
+ }
+
+
+ public void setBorderType(String borderType) {
+ this.borderType = borderType;
+ }
+
+ public String getImgFileName() {
+ return imgFileName;
+ }
+
+ public void setImgFileName(String imgFileName) {
+ this.imgFileName = imgFileName;
+ }
+
+ public String getBorderType() {
+ return borderType;
+ }
+
+
+
+ public ElementDetails getDetails() {
+ return details;
+ }
+
+
+
+ public void setDetails(ElementDetails details) {
+ this.details = details;
+ }
+
+ public Size computeSize() {
+ Size size= new Size();
+ size.setWidth(0.5*7.0);
+ size.setHeight(0.5*3.0);
+ // size.setWidth(0.5*10.0);
+ // size.setHeight(0.5*6.0);
+ return size;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/ElementDetails.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/ElementDetails.java
new file mode 100644
index 00000000..cebaeddc
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/ElementDetails.java
@@ -0,0 +1,68 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain.support;
+
+public class ElementDetails {
+ public String logical_group;
+ public String display_longname;
+ public String description;
+ public String primary_function;
+ public String network_function;
+ public String key_interfaces;
+ public String location;
+ public String vendor;
+ public String vendor_shortname;
+ public String enclosingContainer;
+
+
+// public Map<String,String> details1;
+
+// public ElementDetails(Map<String, String> details) {
+
+ // this.details = new HashMap<String, String>();
+ // this.details1 = details;
+// }
+
+
+
+
+
+ public ElementDetails(String logical_group, String display_longname, String description, String primary_function, String network_function,
+ String key_interfaces, String location, String vendor, String vendor_shortname, String enclosingContainer) {
+
+ this.logical_group = logical_group;
+ this.display_longname = display_longname;
+ this.description = description;
+ this.primary_function = primary_function;
+ this.network_function = network_function;
+ this.key_interfaces = key_interfaces;
+ this.location = location;
+ this.vendor = vendor;
+ this.vendor_shortname = vendor_shortname;
+ this.enclosingContainer = enclosingContainer;
+ }
+
+ public void setLogical_group(String logical_group) {
+ this.logical_group = logical_group;
+ }
+
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/FusionCommand.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/FusionCommand.java
new file mode 100644
index 00000000..6ac85b6f
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/FusionCommand.java
@@ -0,0 +1,39 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain.support;
+
+import org.openecomp.portalsdk.core.FusionObject;
+
+public class FusionCommand implements FusionObject {
+
+ private String task;
+
+ public FusionCommand() {
+ }
+
+ public String getTask() {
+ return task;
+ }
+
+ public void setTask(String task) {
+ this.task = task;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Layout.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Layout.java
new file mode 100644
index 00000000..58056232
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Layout.java
@@ -0,0 +1,991 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain.support;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+public class Layout {
+
+ public Map<String,Domain> domainRowCol;
+
+ Map<String,Domain> originalDomainRowCol;
+
+ //Horizontal space between a pair of domains
+ double interDomainWd;
+ //Vertical space between a pair of domains
+ double interDomainH;
+ //Computing the co-ordinates of any domain
+ int numberofRowsofDomains;
+
+ int numberofColsofDomains;
+
+ Map<String, Domain> collapsedDomains;
+
+ List<Domain> collapsedDomainsNewList;
+
+ public List<Domain> getCollapsedDomainsNewList() {
+ return collapsedDomainsNewList;
+ }
+
+ public void setCollapsedDomainsNewList(List<Domain> collapsedDomainsNewList) {
+ this.collapsedDomainsNewList = collapsedDomainsNewList;
+ }
+
+ public void setCollapsedDomains(Map<String, Domain> collapsedDomains) {
+ this.collapsedDomains = collapsedDomains;
+ }
+
+ public Map<String, Domain> getCollapsedDomains() {
+ return collapsedDomains;
+ }
+
+ public int getNumberofColsofDomains() {
+ return numberofColsofDomains;
+ }
+
+ public void setNumberofColsofDomains(int numberofColsofDomains) {
+ this.numberofColsofDomains = numberofColsofDomains;
+ }
+
+ public Layout(Map<String,Domain> domainRowCol, double interDomainWd, double interDomainH,
+ int numberofRowsofDomains, int numberofColsofDomains) {
+
+ this.domainRowCol = domainRowCol;
+ this.interDomainWd = interDomainWd;
+ this.interDomainH = interDomainH;
+ this.numberofRowsofDomains = numberofRowsofDomains;
+ this.numberofColsofDomains = numberofColsofDomains;
+ this.collapsedDomains = new HashMap<String, Domain>();
+ this.originalDomainRowCol = new TreeMap<String,Domain>();
+ this.collapsedDomainsNewList = new ArrayList<Domain>();
+ }
+
+ public Map<String, Domain> getDomainRowCol() {
+ return domainRowCol;
+ }
+
+ public void setDomainRowCol(Map<String, Domain> domainRowCol) {
+ this.domainRowCol = domainRowCol;
+ }
+
+
+ public void computeDomainPositions() {
+ double xsum = 0;
+ double domainTolayout = 10.6;
+ for (int i=0; i< numberofRowsofDomains; i++){
+ for (int j=0; j<numberofColsofDomains; j++){
+ if (domainRowCol.containsKey(String.valueOf(i)+ String.valueOf(j))) {
+ Domain d = domainRowCol.get(String.valueOf(i)+ String.valueOf(j));
+ Position p = new Position();
+ if (j==0)
+ p.x = domainTolayout;
+ else
+ p.x = j*interDomainWd + xsum + domainTolayout;
+ if (getCollapsedDomainsNewList().size() > 0)
+ p.x+= accountForPlusSpaceBefore(d);
+ xsum+=d.computeSize().getWidth();
+ double ysum=0;
+ for (int k=0; k<i; k++) {
+ if (domainRowCol.containsKey(String.valueOf(k)+ String.valueOf(j)))
+ ysum+= domainRowCol.get(String.valueOf(k)+ String.valueOf(j)).computeSize().getHeight();
+ }
+ p.y = (i+1)* interDomainH + ysum;
+ d.setP(p);
+
+ }
+ }
+ xsum = 0;
+ }
+ }
+
+ public void computeDomainPositionsModified() {
+ for (int i=0; i< numberofRowsofDomains; i++){
+ for (int j=0; j<numberofColsofDomains; j++){
+ if (domainRowCol.containsKey(String.valueOf(i)+ String.valueOf(j))) {
+ Domain d = domainRowCol.get(String.valueOf(i)+ String.valueOf(j));
+ Position p = new Position();
+ Map<String,Container> enclosedContainers = d.getContainerRowCol();
+ for (Map.Entry<String, Container> entry : enclosedContainers.entrySet()) {
+ if (entry.getKey().equals("00")) {
+ double containerX = entry.getValue().getP().getX();
+ p.x = containerX;
+ double ysum=0;
+ for (int k=0; k<i; k++) {
+ if (domainRowCol.containsKey(String.valueOf(k)+ String.valueOf(j)))
+ ysum+= domainRowCol.get(String.valueOf(k)+ String.valueOf(j)).computeSize().getHeight();
+ }
+ p.y = (i+1)* interDomainH + ysum;
+ d.setP(p);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+
+ }
+ public Layout collapseDomainModified(String domainsToCollapse) {
+
+ if(domainsToCollapse == null || domainsToCollapse.isEmpty())
+ return null;
+
+ Map<String,Domain> updatedRC = new HashMap<String, Domain>();
+
+ for (Map.Entry<String, Domain> copyEntry : domainRowCol.entrySet()) {
+ updatedRC.put(copyEntry.getKey(), copyEntry.getValue());
+ System.out.println("copyEntry.getKey() "+copyEntry.getKey()+ " copyEntry.getValue() "+copyEntry.getValue());
+ }
+
+ Map<String, Domain> updatedRCSorted = new TreeMap<String, Domain>(updatedRC);
+
+ Map<String, Domain> collapsedDomainMap = getCollapsedDomains();
+
+ List<Domain> collapsedDomainNewL = getCollapsedDomainsNewList();
+
+
+ if (collapsedDomainNewL.size() == 0) {
+ for (Map.Entry<String, Domain> copyEntry : domainRowCol.entrySet()) {
+ originalDomainRowCol.put(copyEntry.getKey(), copyEntry.getValue());
+ }
+ }
+
+
+ Map<String, Domain> updatedRCSortedTrunc = new TreeMap<String, Domain>();
+
+ int colToDelete = 0;
+ for (Map.Entry<String, Domain> entry : updatedRCSorted.entrySet()) {
+ if (entry.getValue().getName().equals(domainsToCollapse)) {
+ if (entry.getValue().isIndexChanged()) {
+ collapsedDomainMap.put("0"+String.valueOf(Integer.parseInt(entry.getKey())+1), entry.getValue());
+
+ }
+ else {
+ collapsedDomainMap.put(entry.getKey(),entry.getValue());
+ }
+
+ collapsedDomainNewL.add(entry.getValue());
+ setNumberofColsofDomains(getNumberofColsofDomains()-1);
+ updatedRC.remove(entry.getKey());
+ colToDelete = Character.getNumericValue(entry.getKey().toCharArray()[1]);
+ break;
+ }
+ }
+
+
+ for (Map.Entry<String, Domain> copyEntry : updatedRCSorted.entrySet()) {
+ updatedRCSortedTrunc.put(copyEntry.getKey(), copyEntry.getValue());
+ System.out.println("copyEntry.getKey() "+copyEntry.getKey()+ " copyEntry.getValue() "+copyEntry.getValue());
+ }
+
+ for (Map.Entry<String, Domain> rmv : updatedRCSorted.entrySet()) {
+ if (Character.getNumericValue(rmv.getKey().toCharArray()[1]) <= colToDelete) {
+ updatedRCSortedTrunc.remove(rmv.getKey());
+ }
+ }
+
+ for (Map.Entry<String, Domain> updateOthers : updatedRCSortedTrunc.entrySet()) {
+ char update[] = updateOthers.getKey().toCharArray();
+ int charToupdate = Character.getNumericValue(update[1]);
+ --charToupdate;
+ String resultRowCol = String.valueOf(update[0])+String.valueOf(charToupdate);
+ updateOthers.getValue().setIndexChanged(true);
+ updatedRC.put(resultRowCol, updateOthers.getValue());
+ updatedRC.remove(updateOthers.getKey());
+
+ }
+ setDomainRowCol(updatedRC);
+
+ double currDistFromLftM = 11.0;
+ for (Map.Entry<String,Domain> cd : updatedRC.entrySet()) {
+
+ Domain d = cd.getValue();
+ double accountPlus = accountForPlusSpaceBefore(d);
+ d.setDomainToLayoutWd(currDistFromLftM+accountPlus);
+ d.computeConatinerPositions();
+ for (Map.Entry<String, Container> entry1 : d.getContainerRowCol().entrySet()) {
+ Container c = entry1.getValue();
+ c.computeSize();
+ c.computeElementPositions();
+ if (c.getContainerRowCol() != null) {
+ for (Map.Entry<String, Container> entryInner : c.getContainerRowCol().entrySet()) {
+ Container inner = entryInner.getValue();
+ inner.computeElementPositions();
+ }
+ }
+ }
+ currDistFromLftM += d.computeSize().getWidth()+2;
+
+ }
+
+
+
+
+ //nline
+ // Insert method invocation
+ updatePlusPosition(collapsedDomainNewL, updatedRC);
+
+ //order changed
+ setCollapsedDomains(collapsedDomainMap);
+ setCollapsedDomainsNewList(collapsedDomainNewL);
+
+
+ computeDomainPositionsModified();
+ return this;
+ }
+
+
+
+ public Layout collapseDomainNew(String domainsToCollapse) {
+
+ if(domainsToCollapse == null || domainsToCollapse.isEmpty())
+ return null;
+
+ Map<String,Domain> updatedRC = new HashMap<String, Domain>();
+
+ for (Map.Entry<String, Domain> copyEntry : domainRowCol.entrySet()) {
+ updatedRC.put(copyEntry.getKey(), copyEntry.getValue());
+ System.out.println("copyEntry.getKey() "+copyEntry.getKey()+ " copyEntry.getValue() "+copyEntry.getValue());
+ }
+
+ Map<String, Domain> updatedRCSorted = new TreeMap<String, Domain>(updatedRC);
+
+ Map<String, Domain> collapsedDomainMap = getCollapsedDomains();
+
+ List<Domain> collapsedDomainNewL = getCollapsedDomainsNewList();
+
+
+ if (collapsedDomainNewL.size() == 0) {
+ for (Map.Entry<String, Domain> copyEntry : domainRowCol.entrySet()) {
+ originalDomainRowCol.put(copyEntry.getKey(), copyEntry.getValue());
+ }
+ }
+
+
+ Map<String, Domain> updatedRCSortedTrunc = new TreeMap<String, Domain>();
+
+ int colToDelete = 0;
+ for (Map.Entry<String, Domain> entry : updatedRCSorted.entrySet()) {
+ if (entry.getValue().getName().equals(domainsToCollapse)) {
+ if (entry.getValue().isIndexChanged()) {
+ collapsedDomainMap.put("0"+String.valueOf(Integer.parseInt(entry.getKey())+1), entry.getValue());
+
+ }
+ else {
+ collapsedDomainMap.put(entry.getKey(),entry.getValue());
+ }
+
+ collapsedDomainNewL.add(entry.getValue());
+ setNumberofColsofDomains(getNumberofColsofDomains()-1);
+ updatedRC.remove(entry.getKey());
+ colToDelete = Character.getNumericValue(entry.getKey().toCharArray()[1]);
+ break;
+ }
+ }
+
+
+ for (Map.Entry<String, Domain> copyEntry : updatedRCSorted.entrySet()) {
+ updatedRCSortedTrunc.put(copyEntry.getKey(), copyEntry.getValue());
+ System.out.println("copyEntry.getKey() "+copyEntry.getKey()+ " copyEntry.getValue() "+copyEntry.getValue());
+ }
+
+ for (Map.Entry<String, Domain> rmv : updatedRCSorted.entrySet()) {
+ if (Character.getNumericValue(rmv.getKey().toCharArray()[1]) <= colToDelete) {
+ updatedRCSortedTrunc.remove(rmv.getKey());
+ }
+ }
+
+ for (Map.Entry<String, Domain> updateOthers : updatedRCSortedTrunc.entrySet()) {
+ char update[] = updateOthers.getKey().toCharArray();
+ int charToupdate = Character.getNumericValue(update[1]);
+ --charToupdate;
+ String resultRowCol = String.valueOf(update[0])+String.valueOf(charToupdate);
+ updateOthers.getValue().setIndexChanged(true);
+ updatedRC.put(resultRowCol, updateOthers.getValue());
+ updatedRC.remove(updateOthers.getKey());
+
+ }
+ setDomainRowCol(updatedRC);
+
+ double currDistFromLftM = 11.0;
+
+ boolean isDisplayed;
+ for (Map.Entry<String,Domain> orgEntry : originalDomainRowCol.entrySet()) {
+ isDisplayed = false;
+ for (Map.Entry<String,Domain> cd : updatedRC.entrySet()) {
+ if (cd.getValue().getName().equals(orgEntry.getValue().getName())) {
+ Domain d = cd.getValue();
+ d.setDomainToLayoutWd(currDistFromLftM);
+ d.computeConatinerPositions();
+ for (Map.Entry<String, Container> entry1 : d.getContainerRowCol().entrySet()) {
+ Container c = entry1.getValue();
+ c.computeSize();
+ c.computeElementPositions();
+ if (c.getContainerRowCol() != null) {
+ for (Map.Entry<String, Container> entryInner : c.getContainerRowCol().entrySet()) {
+ Container inner = entryInner.getValue();
+ inner.computeElementPositions();
+ }
+ }
+ }
+ currDistFromLftM += d.computeSize().getWidth()+1;
+ isDisplayed = true;
+ break;
+ }
+ }
+
+ if (!isDisplayed) {
+ Domain myCollapsed = orgEntry.getValue();
+ myCollapsed.setNewXafterColl(currDistFromLftM);
+ myCollapsed.setYafterColl(myCollapsed.getP().getY());
+ currDistFromLftM += 4;
+ }
+ }
+
+ setCollapsedDomains(collapsedDomainMap);
+ setCollapsedDomainsNewList(collapsedDomainNewL);
+
+
+ computeDomainPositionsModified();
+ return this;
+
+ }
+
+
+ public Layout collapseDomain(String domainsToCollapse) {
+
+ Map<String,Domain> updatedRC = new HashMap<String, Domain>();
+
+ for (Map.Entry<String, Domain> copyEntry : domainRowCol.entrySet()) {
+ updatedRC.put(copyEntry.getKey(), copyEntry.getValue());
+ System.out.println("copyEntry.getKey() "+copyEntry.getKey()+ " copyEntry.getValue() "+copyEntry.getValue());
+ }
+
+ Map<String, Domain> updatedRCSorted = new TreeMap<String, Domain>(updatedRC);
+
+ Map<String, Domain> collapsedDomainMap = getCollapsedDomains();
+
+ if (collapsedDomainMap.size() == 0) {
+ for (Map.Entry<String, Domain> copyEntry : domainRowCol.entrySet()) {
+ originalDomainRowCol.put(copyEntry.getKey(), copyEntry.getValue());
+ }
+ }
+
+
+ double prevDomXCordinate = 0.0;
+ Map<String, Domain> updatedRCSortedTrunc = new TreeMap<String, Domain>();
+ int colToDelete = 0;
+ for (Map.Entry<String, Domain> entry : updatedRCSorted.entrySet()) {
+ if (entry.getValue().getName().equals(domainsToCollapse)) {
+ if (entry.getValue().isIndexChanged())
+ collapsedDomainMap.put("0"+String.valueOf(Integer.parseInt(entry.getKey())+1), entry.getValue());
+ else
+ collapsedDomainMap.put(entry.getKey(),entry.getValue());
+ prevDomXCordinate = entry.getValue().getP().getX();
+ entry.getValue().getP().setX(prevDomXCordinate-2);
+ setNumberofColsofDomains(getNumberofColsofDomains()-1);
+ updatedRC.remove(entry.getKey());
+ colToDelete = Character.getNumericValue(entry.getKey().toCharArray()[1]);
+ break;
+ }
+ }
+
+ setCollapsedDomains(collapsedDomainMap);
+
+ for (Map.Entry<String, Domain> copyEntry : updatedRCSorted.entrySet()) {
+ updatedRCSortedTrunc.put(copyEntry.getKey(), copyEntry.getValue());
+ System.out.println("copyEntry.getKey() "+copyEntry.getKey()+ " copyEntry.getValue() "+copyEntry.getValue());
+ }
+
+ for (Map.Entry<String, Domain> rmv : updatedRCSorted.entrySet()) {
+ if (Character.getNumericValue(rmv.getKey().toCharArray()[1]) <= colToDelete) {
+ updatedRCSortedTrunc.remove(rmv.getKey());
+ }
+ }
+
+ for (Map.Entry<String, Domain> updateOthers : updatedRCSortedTrunc.entrySet()) {
+ char update[] = updateOthers.getKey().toCharArray();
+ int charToupdate = Character.getNumericValue(update[1]);
+ --charToupdate;
+ String resultRowCol = String.valueOf(update[0])+String.valueOf(charToupdate);
+ updateOthers.getValue().setIndexChanged(true);
+ updatedRC.put(resultRowCol, updateOthers.getValue());
+ updatedRC.remove(updateOthers.getKey());
+ }
+
+ setDomainRowCol(updatedRC);
+
+
+
+ for (Map.Entry<String, Domain> entry : updatedRCSortedTrunc.entrySet()) {
+ Domain d = entry.getValue();
+ if (collapsedDomains.size() == 2 && collapsedDomains.containsKey("00") && collapsedDomains.containsKey("01") && domainsToCollapse.equals("RAN")) {
+ if (d.getName().equals("USP"))
+ d.setDomainToLayoutWd(prevDomXCordinate);
+ else if (d.getName().equals("VNI"))
+ d.setDomainToLayoutWd(prevDomXCordinate+8);
+ else
+ d.setDomainToLayoutWd(prevDomXCordinate+10);
+ }
+ else if (domainsToCollapse.equals("RAN") && !d.getName().equals("EPC") && collapsedDomains.size() < 3)
+ d.setDomainToLayoutWd(prevDomXCordinate+11);
+ else if (domainsToCollapse.equals("RAN") && collapsedDomains.size() == 3 && collapsedDomains.containsKey("01") && collapsedDomains.containsKey("04")) {
+ if (d.getName().equals("USP"))
+ d.setDomainToLayoutWd(prevDomXCordinate);
+ else
+ d.setDomainToLayoutWd(prevDomXCordinate+10);
+ }
+
+ else if (collapsedDomains.containsKey("00") && collapsedDomains.size() == 3 && collapsedDomains.containsKey("01") && collapsedDomains.containsKey("02")) {
+ if (d.getName().equals("VNI"))
+ d.setDomainToLayoutWd(prevDomXCordinate+10);
+ else
+ d.setDomainToLayoutWd(prevDomXCordinate);
+
+ }
+
+ else if (collapsedDomains.containsKey("00") && collapsedDomains.size() == 3 && collapsedDomains.containsKey("01") && collapsedDomains.containsKey("03")) {
+ if (d.getName().equals("VNI"))
+ d.setDomainToLayoutWd(prevDomXCordinate+10);
+ else
+ d.setDomainToLayoutWd(prevDomXCordinate);
+
+ }
+
+
+
+ else {
+ d.setDomainToLayoutWd(prevDomXCordinate);
+ }
+ d.computeConatinerPositions();
+ prevDomXCordinate = d.getP().getX();
+ for (Map.Entry<String, Container> entry1 : d.getContainerRowCol().entrySet()) {
+ Container c = entry1.getValue();
+ c.computeSize();
+ c.computeElementPositions();
+ if (c.getContainerRowCol() != null) {
+ for (Map.Entry<String, Container> entryInner : c.getContainerRowCol().entrySet()) {
+ Container inner = entryInner.getValue();
+ inner.computeElementPositions();
+ }
+ }
+ }
+ }
+ computeDomainPositions();
+ return this;
+
+ }
+
+ public Layout uncollapseDomainModified(String domainToUnCollapse) {
+ Map<String, Domain> currentDomainsSorted = new TreeMap<String,Domain>(domainRowCol);
+ Map<String, Domain> updateDomains = new TreeMap<String,Domain>();
+ Map<String, Domain> collapsedDomainList = getCollapsedDomains();
+ Map<String, Domain> collapsedDomainListSorted = new TreeMap<String, Domain>(collapsedDomainList);
+
+ List<Domain> domainstoUpd = new ArrayList<Domain>();
+
+ int colToUnCollapse = 99;
+
+ Domain domainToInsert = null;
+
+ if (collapsedDomains.size() == 0) {
+ for (Map.Entry<String, Domain> unindexDomain : originalDomainRowCol.entrySet()) {
+ Domain dm = unindexDomain.getValue();
+ dm.setIndexChanged(false);
+ }
+ }
+
+
+ for (Map.Entry<String, Domain> entry : collapsedDomainListSorted.entrySet()) {
+ if (entry.getValue().getName().equals(domainToUnCollapse)) {
+ colToUnCollapse = Character.getNumericValue(entry.getKey().toCharArray()[1]);
+ domainToInsert = entry.getValue();
+ collapsedDomainList.remove(entry.getKey());
+ break;
+ }
+ }
+
+ domainstoUpd.add(domainToInsert);
+
+ for (Map.Entry<String, Domain> e : originalDomainRowCol.entrySet())
+ System.out.println("Original key value"+e.getKey()+":"+e.getValue().getName());
+
+ int lastKeyCol = -1;
+ for (Map.Entry<String, Domain> entry : originalDomainRowCol.entrySet()) {
+ int currcol = Character.getNumericValue(entry.getKey().toCharArray()[1]);
+ if (currcol < colToUnCollapse) {
+ for (Map.Entry<String, Domain> currDomainsEntry : currentDomainsSorted.entrySet()) {
+ if (currDomainsEntry.getValue().getName().equals(entry.getValue().getName())) {
+ updateDomains.put(currDomainsEntry.getKey(), currDomainsEntry.getValue());
+ lastKeyCol = Character.getNumericValue(currDomainsEntry.getKey().toCharArray()[1]);
+ break;
+ }
+ }
+ } else {
+ String newKey = "0"+String.valueOf(lastKeyCol+1);
+ if (currcol == colToUnCollapse) {
+ updateDomains.put(newKey, domainToInsert);
+ ++lastKeyCol;
+ } else {
+ for (Map.Entry<String, Domain> currDomainsEnt : currentDomainsSorted.entrySet()) {
+ if (currDomainsEnt.getValue().getName().equals(entry.getValue().getName())) {
+ updateDomains.put(newKey, currDomainsEnt.getValue());
+ domainstoUpd.add(currDomainsEnt.getValue());
+ ++lastKeyCol;
+ break;
+ }
+ }
+ }
+
+ }
+ }
+
+ setNumberofColsofDomains(getNumberofColsofDomains()+1);
+ setDomainRowCol(updateDomains);
+ setCollapsedDomains(collapsedDomainList);
+
+ for (Map.Entry<String, Domain> e : updateDomains.entrySet())
+ System.out.println("me Updatedomains key value"+e.getKey()+":"+e.getValue().getName());
+
+ for (int i = 0; i < domainstoUpd.size(); i++) {
+ Domain d = domainstoUpd.get(i);
+ double newX = 0.0;
+ if (i+1 < domainstoUpd.size())
+ newX = domainstoUpd.get(i+1).getP().getX();
+ else
+ newX = domainstoUpd.get(i).getP().getX()+32;
+
+ if (d.getName().equals("Datacenter"))
+ newX+= 2;
+ d.setDomainToLayoutWd(newX);
+ d.computeConatinerPositions();
+ for (Map.Entry<String, Container> entry1 : d.getContainerRowCol().entrySet()) {
+ Container c = entry1.getValue();
+ c.computeSize();
+ c.computeElementPositions();
+ if (c.getContainerRowCol() != null) {
+ for (Map.Entry<String, Container> entryInner : c.getContainerRowCol().entrySet()) {
+ Container inner = entryInner.getValue();
+ inner.computeElementPositions();
+ }
+ }
+ }
+ }
+
+ computeDomainPositions();
+ return this;
+
+ }
+
+
+
+ public Layout uncollapseDomain(String domainToCollapse) {
+ Map<String, Domain> currentDomainsSorted = new TreeMap<String,Domain>(domainRowCol);
+ Map<String, Domain> updateDomains = new TreeMap<String,Domain>();
+ Map<String, Domain> collapsedDomainList = getCollapsedDomains();
+ Map<String, Domain> collapsedDomainListSorted = new TreeMap<String, Domain>(collapsedDomainList);
+
+ List<Domain> domainstoUpd = new ArrayList<Domain>();
+
+
+ for (Map.Entry<String, Domain> entry : collapsedDomainListSorted.entrySet()) {
+ if (entry.getValue().getName().equals(domainToCollapse)) {
+ if (currentDomainsSorted != null) {
+ int colToUnCollapse = Character.getNumericValue(entry.getKey().toCharArray()[1]);
+ for (Map.Entry<String, Domain> curr : currentDomainsSorted.entrySet()) {
+ if (Character.getNumericValue(curr.getKey().toCharArray()[1]) < colToUnCollapse) {
+ updateDomains.put(curr.getKey(),curr.getValue());
+ } else {
+ updateDomains.put("0"+String.valueOf(Integer.parseInt(curr.getKey())+1),curr.getValue());
+ domainstoUpd.add(curr.getValue());
+ }
+ }
+ }
+ updateDomains.put(entry.getKey(), entry.getValue());
+ collapsedDomainList.remove(entry.getKey());
+ break;
+
+ }
+ }
+ setNumberofColsofDomains(getNumberofColsofDomains()+1);
+ setDomainRowCol(updateDomains);
+ setCollapsedDomains(collapsedDomainList);
+
+ for (Map.Entry<String, Domain> e : updateDomains.entrySet())
+ System.out.println("Updatedomains key value"+e.getKey()+":"+e.getValue().getName());
+
+
+ for (int i = 0; i < domainstoUpd.size(); i++) {
+ Domain d = domainstoUpd.get(i);
+ double newX = 0.0;
+ if (i+1 < domainstoUpd.size())
+ newX = domainstoUpd.get(i+1).getP().getX();
+ else
+ newX = domainstoUpd.get(i).getP().getX()+38;
+
+ if (d.getName().equals("Datacenter"))
+ newX+= 5;
+ d.setDomainToLayoutWd(newX);
+ d.computeConatinerPositions();
+ for (Map.Entry<String, Container> entry1 : d.getContainerRowCol().entrySet()) {
+ Container c = entry1.getValue();
+ c.computeSize();
+ c.computeElementPositions();
+ if (c.getContainerRowCol() != null) {
+ for (Map.Entry<String, Container> entryInner : c.getContainerRowCol().entrySet()) {
+ Container inner = entryInner.getValue();
+ inner.computeElementPositions();
+ }
+ }
+ }
+ }
+
+ computeDomainPositions();
+ return this;
+ }
+
+ public Layout uncollapseDomainNew(String domainToUnCollapse) {
+ Map<String, Domain> currentDomainsSorted = new TreeMap<String,Domain>(domainRowCol);
+ Map<String, Domain> updateDomains = new TreeMap<String,Domain>();
+ Map<String, Domain> collapsedDomainList = getCollapsedDomains();
+ List<Domain> domainstoUpd = new ArrayList<Domain>();
+
+ //nline
+ List<Domain> collapsedDomainNewLL = getCollapsedDomainsNewList();
+
+ int colToUnCollapse = 99;
+
+ Domain domainToInsert = null;
+
+ //nline
+ if (collapsedDomainNewLL.size() == 0) {
+ for (Map.Entry<String, Domain> unindexDomain : originalDomainRowCol.entrySet()) {
+ Domain dm = unindexDomain.getValue();
+ dm.setIndexChanged(false);
+ }
+ }
+
+
+ for (Map.Entry<String, Domain> entry : originalDomainRowCol.entrySet()) {
+ if (entry.getValue().getName().equals(domainToUnCollapse)) {
+ colToUnCollapse = Character.getNumericValue(entry.getKey().toCharArray()[1]);
+ domainToInsert = entry.getValue();
+ collapsedDomainList.remove(entry.getKey());
+ //nline
+ collapsedDomainNewLL.remove(entry.getValue());
+ break;
+ }
+ }
+
+ domainstoUpd.add(domainToInsert);
+
+ for (Map.Entry<String, Domain> e : originalDomainRowCol.entrySet())
+ System.out.println("Original key value"+e.getKey()+":"+e.getValue().getName());
+
+ int lastKeyCol = -1;
+ for (Map.Entry<String, Domain> entry : originalDomainRowCol.entrySet()) {
+ int currcol = Character.getNumericValue(entry.getKey().toCharArray()[1]);
+ if (currcol < colToUnCollapse) {
+ for (Map.Entry<String, Domain> currDomainsEntry : currentDomainsSorted.entrySet()) {
+ if (currDomainsEntry.getValue().getName().equals(entry.getValue().getName())) {
+ updateDomains.put(currDomainsEntry.getKey(), currDomainsEntry.getValue());
+ lastKeyCol = Character.getNumericValue(currDomainsEntry.getKey().toCharArray()[1]);
+ break;
+ }
+ }
+ } else {
+ String newKey = "0"+String.valueOf(lastKeyCol+1);
+ if (currcol == colToUnCollapse) {
+ updateDomains.put(newKey, domainToInsert);
+ ++lastKeyCol;
+ } else {
+ for (Map.Entry<String, Domain> currDomainsEnt : currentDomainsSorted.entrySet()) {
+ if (currDomainsEnt.getValue().getName().equals(entry.getValue().getName())) {
+ updateDomains.put(newKey, currDomainsEnt.getValue());
+ domainstoUpd.add(currDomainsEnt.getValue());
+ ++lastKeyCol;
+ break;
+ }
+ }
+ }
+
+ }
+ }
+
+ setNumberofColsofDomains(getNumberofColsofDomains()+1);
+ setDomainRowCol(updateDomains);
+
+ for (Map.Entry<String, Domain> e : updateDomains.entrySet())
+ System.out.println("me Updatedomains key value"+e.getKey()+":"+e.getValue().getName());
+
+
+
+ double currDistFromLftMargin = 11.0;
+ for (Map.Entry<String,Domain> cd : updateDomains.entrySet()) {
+ Domain d = cd.getValue();
+ double accountPlus = accountForPlusSpaceBefore(d);
+ d.setDomainToLayoutWd(currDistFromLftMargin+accountPlus);
+ d.computeConatinerPositions();
+ for (Map.Entry<String, Container> entry1 : d.getContainerRowCol().entrySet()) {
+ Container c = entry1.getValue();
+ c.computeSize();
+ c.computeElementPositions();
+ if (c.getContainerRowCol() != null) {
+ for (Map.Entry<String, Container> entryInner : c.getContainerRowCol().entrySet()) {
+ Container inner = entryInner.getValue();
+ inner.computeElementPositions();
+ }
+ }
+ }
+ currDistFromLftMargin += d.computeSize().getWidth()+2;
+
+ }
+
+ //nline
+ updatePlusPosition(collapsedDomainNewLL, updateDomains);
+
+ //order changed
+ setCollapsedDomains(collapsedDomainList);
+
+ //nline
+ setCollapsedDomainsNewList(collapsedDomainNewLL);
+
+
+ computeDomainPositionsModified();
+ return this;
+
+ }
+
+ public Layout uncollapseDomainNew1(String domainToUnCollapse) {
+
+ if(domainToUnCollapse == null || domainToUnCollapse.isEmpty())
+ return null;
+
+ Map<String, Domain> currentDomainsSorted = new TreeMap<String,Domain>(domainRowCol);
+ Map<String, Domain> updateDomains = new TreeMap<String,Domain>();
+ Map<String, Domain> collapsedDomainList = getCollapsedDomains();
+ List<Domain> domainstoUpd = new ArrayList<Domain>();
+
+ //nline
+ List<Domain> collapsedDomainNewLL = getCollapsedDomainsNewList();
+
+ int colToUnCollapse = 99;
+
+ Domain domainToInsert = null;
+
+ //nline
+ if (collapsedDomainNewLL.size() == 0) {
+ for (Map.Entry<String, Domain> unindexDomain : originalDomainRowCol.entrySet()) {
+ Domain dm = unindexDomain.getValue();
+ dm.setIndexChanged(false);
+ }
+ }
+
+
+ for (Map.Entry<String, Domain> entry : originalDomainRowCol.entrySet()) {
+ if (entry.getValue().getName().equals(domainToUnCollapse)) {
+ colToUnCollapse = Character.getNumericValue(entry.getKey().toCharArray()[1]);
+ domainToInsert = entry.getValue();
+ collapsedDomainList.remove(entry.getKey());
+ //nline
+ collapsedDomainNewLL.remove(entry.getValue());
+ break;
+ }
+ }
+
+ domainstoUpd.add(domainToInsert);
+
+ for (Map.Entry<String, Domain> e : originalDomainRowCol.entrySet())
+ System.out.println("Original key value"+e.getKey()+":"+e.getValue().getName());
+
+ int lastKeyCol = -1;
+ for (Map.Entry<String, Domain> entry : originalDomainRowCol.entrySet()) {
+ int currcol = Character.getNumericValue(entry.getKey().toCharArray()[1]);
+ if (currcol < colToUnCollapse) {
+ for (Map.Entry<String, Domain> currDomainsEntry : currentDomainsSorted.entrySet()) {
+ if (currDomainsEntry.getValue().getName().equals(entry.getValue().getName())) {
+ updateDomains.put(currDomainsEntry.getKey(), currDomainsEntry.getValue());
+ lastKeyCol = Character.getNumericValue(currDomainsEntry.getKey().toCharArray()[1]);
+ break;
+ }
+ }
+ } else {
+ String newKey = "0"+String.valueOf(lastKeyCol+1);
+ if (currcol == colToUnCollapse) {
+ updateDomains.put(newKey, domainToInsert);
+ ++lastKeyCol;
+ } else {
+ for (Map.Entry<String, Domain> currDomainsEnt : currentDomainsSorted.entrySet()) {
+ if (currDomainsEnt.getValue().getName().equals(entry.getValue().getName())) {
+ updateDomains.put(newKey, currDomainsEnt.getValue());
+ domainstoUpd.add(currDomainsEnt.getValue());
+ ++lastKeyCol;
+ break;
+ }
+ }
+ }
+
+ }
+ }
+
+ setNumberofColsofDomains(getNumberofColsofDomains()+1);
+ setDomainRowCol(updateDomains);
+
+ for (Map.Entry<String, Domain> e : updateDomains.entrySet())
+ System.out.println("me Updatedomains key value"+e.getKey()+":"+e.getValue().getName());
+
+
+
+
+ double currDistFromLftM = 11.0;
+
+ boolean isDisplayed;
+ for (Map.Entry<String,Domain> orgEntry : originalDomainRowCol.entrySet()) {
+ isDisplayed = false;
+ for (Map.Entry<String,Domain> cd : updateDomains.entrySet()) {
+ if (cd.getValue().getName().equals(orgEntry.getValue().getName())) {
+ Domain d = cd.getValue();
+ d.setDomainToLayoutWd(currDistFromLftM);
+ d.computeConatinerPositions();
+ for (Map.Entry<String, Container> entry1 : d.getContainerRowCol().entrySet()) {
+ Container c = entry1.getValue();
+ c.computeSize();
+ c.computeElementPositions();
+ if (c.getContainerRowCol() != null) {
+ for (Map.Entry<String, Container> entryInner : c.getContainerRowCol().entrySet()) {
+ Container inner = entryInner.getValue();
+ inner.computeElementPositions();
+ }
+ }
+ }
+ currDistFromLftM += d.computeSize().getWidth()+1;
+ isDisplayed = true;
+ break;
+ }
+ }
+
+ if (!isDisplayed) {
+ Domain myCollapsed = orgEntry.getValue();
+ myCollapsed.setNewXafterColl(currDistFromLftM);
+ currDistFromLftM += 4;
+ }
+ }
+
+
+ //order changed
+ setCollapsedDomains(collapsedDomainList);
+
+ //nline
+ setCollapsedDomainsNewList(collapsedDomainNewLL);
+
+
+ computeDomainPositionsModified();
+ return this;
+
+ }
+
+ private void updatePlusPosition(List<Domain> collapsedDNewL, Map<String, Domain> displayedDomainMap) {
+ List<Domain> copyCollapseList = new ArrayList<Domain>();
+
+ for (Domain copyCollapse : collapsedDNewL) {
+ copyCollapseList.add(copyCollapse);
+ }
+
+ int orgColofCollapsed = -1;
+ int orgColofDisplayed = -1;
+ int orgColofDisplayedOtherPlus = -1;
+ for (Domain plus : collapsedDNewL) {
+ double distOfCollFrmLft = 0.0;
+ for (Map.Entry<String, Domain> colCheck : originalDomainRowCol.entrySet()) {
+ if (colCheck.getValue().getName().equals(plus.getName())) {
+ orgColofCollapsed = Character.getNumericValue(colCheck.getKey().toCharArray()[1]);
+ break;
+ }
+ }
+ for (Map.Entry<String, Domain> displayedEntry : displayedDomainMap.entrySet()) {
+
+ for (Map.Entry<String, Domain> colCheck1 : originalDomainRowCol.entrySet()) {
+ if (colCheck1.getValue().getName().equals(displayedEntry.getValue().getName())) {
+ orgColofDisplayed = Character.getNumericValue(colCheck1.getKey().toCharArray()[1]);
+ break;
+ }
+ }
+ if (orgColofDisplayed < orgColofCollapsed) {
+ distOfCollFrmLft+= displayedEntry.getValue().computeSize().getWidth();
+
+ }
+
+ }
+
+ for (Domain collp : copyCollapseList) {
+ if (!collp.getName().equals(plus.getName())) {
+ for (Map.Entry<String, Domain> colCheck2 : originalDomainRowCol.entrySet()) {
+ if (colCheck2.getValue().getName().equals(collp.getName())) {
+ orgColofDisplayedOtherPlus = Character.getNumericValue(colCheck2.getKey().toCharArray()[1]);
+ break;
+ }
+ }
+ if (orgColofDisplayedOtherPlus < orgColofCollapsed) {
+ distOfCollFrmLft+=3.0;
+ }
+ }
+ }
+
+ plus.setNewXafterColl(distOfCollFrmLft+1.5);
+
+
+ }
+ }
+
+
+ private double accountForPlusSpaceBefore(Domain d) {
+
+ int orgColofCollapsed = 0;
+ int orgColofDisplayed = 0;
+ double distFromLftM = 0.0;
+
+ for (Map.Entry<String, Domain> colCheckk : originalDomainRowCol.entrySet()) {
+ if (colCheckk.getValue().getName().equals(d.getName())) {
+ orgColofDisplayed = Character.getNumericValue(colCheckk.getKey().toCharArray()[1]);
+ break;
+ }
+ }
+
+ for (Domain collapsed : getCollapsedDomainsNewList()) {
+ for (Map.Entry<String, Domain> colCheck : originalDomainRowCol.entrySet()) {
+ if (colCheck.getValue().getName().equals(collapsed.getName())) {
+ orgColofCollapsed = Character.getNumericValue(colCheck.getKey().toCharArray()[1]);
+ break;
+ }
+ }
+
+ if (orgColofCollapsed < orgColofDisplayed) {
+ distFromLftM+= 2;
+ }
+ }
+ return distFromLftM;
+
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/NameValueId.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/NameValueId.java
new file mode 100644
index 00000000..52d03c5f
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/NameValueId.java
@@ -0,0 +1,94 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain.support;
+
+import java.io.Serializable;
+
+
+public class NameValueId implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private String lab;
+ private String val;
+
+ public NameValueId() {
+ }
+
+ public NameValueId(String value, String label) {
+ setVal(value);
+ setLab(label);
+ }
+
+
+ public String getLab() {
+ return lab;
+ }
+
+
+ public String getVal() {
+ return val;
+ }
+
+
+ public void setLab(String label) {
+ this.lab = label;
+ }
+
+
+ public void setVal(String value) {
+ this.val = value;
+ }
+
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+
+ if (o == null) {
+ return false;
+ }
+
+ if (!(o instanceof NameValueId)) {
+ return false;
+ }
+
+ final NameValueId nameValueId = (NameValueId)o;
+
+ if (!getVal().equals(nameValueId.getVal())) {
+ return false;
+ }
+
+ if (!getLab().equals(nameValueId.getLab())) {
+ return false;
+ }
+
+ return true;
+ }
+
+
+ public int hashCode() {
+ return getVal().hashCode();
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Position.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Position.java
new file mode 100644
index 00000000..db137c80
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Position.java
@@ -0,0 +1,40 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain.support;
+
+public class Position {
+ double x;
+ double y;
+
+ public double getX() {
+ return x;
+ }
+ public void setX(double x) {
+ this.x = x;
+ }
+ public double getY() {
+ return y;
+ }
+ public void setY(double y) {
+ this.y = y;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Size.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Size.java
new file mode 100644
index 00000000..4ebfb962
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Size.java
@@ -0,0 +1,40 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.domain.support;
+
+public class Size {
+ private double width;
+ private double height;
+
+ public double getWidth() {
+ return width;
+ }
+ public void setWidth(double width) {
+ this.width = width;
+ }
+ public double getHeight() {
+ return height;
+ }
+ public void setHeight(double height) {
+ this.height = height;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleService.java
new file mode 100644
index 00000000..c556aa13
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleService.java
@@ -0,0 +1,27 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.drools;
+
+public interface DroolsRuleService {
+
+ public void init(String... params);
+ public String getResultsString();
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleServiceImpl.java
new file mode 100644
index 00000000..7328c472
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleServiceImpl.java
@@ -0,0 +1,58 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.drools;
+
+
+/**
+ *
+ * This is POC test class to execute sample rules
+ */
+public class DroolsRuleServiceImpl implements DroolsRuleService{
+
+
+ private String state;
+ private String resultsString;
+
+ public DroolsRuleServiceImpl() {
+
+ }
+
+ public void init(String... params) {
+ this.state = params[0];
+ }
+
+
+
+ public String getState() {
+ return state;
+ }
+
+ public String accessLabel() {
+ return "Drools POC Test";
+ }
+
+ public String getResultsString() {
+ return resultsString;
+ }
+
+ public void setResultsString(String resultsString) {
+ this.resultsString = resultsString;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/FusionExceptionResolver.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/FusionExceptionResolver.java
new file mode 100644
index 00000000..f756d760
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/FusionExceptionResolver.java
@@ -0,0 +1,50 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.exception;
+
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.servlet.ModelAndView;
+
+@ControllerAdvice
+public class FusionExceptionResolver {
+
+ @ExceptionHandler(UrlAccessRestrictedException.class)
+ public ModelAndView handleUrlAccessException(UrlAccessRestrictedException ex) {
+ ModelAndView model = new ModelAndView("error");
+ model.addObject("errMsg", ex.getMessage());
+ return model;
+
+ }
+ @ExceptionHandler(SessionExpiredException.class)
+ public ModelAndView handleSessionException(SessionExpiredException ex) {
+ ModelAndView model = new ModelAndView("error");
+ model.addObject("errMsg", ex.getMessage());
+ return model;
+ }
+ @ExceptionHandler(Exception.class)
+ public ModelAndView handleAllException(Exception ex) {
+ ModelAndView model = new ModelAndView("error");
+ model.addObject("errMsg", ex.getMessage());
+ return model;
+
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/SessionExpiredException.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/SessionExpiredException.java
new file mode 100644
index 00000000..ba8f76bd
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/SessionExpiredException.java
@@ -0,0 +1,34 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.exception;
+
+import org.openecomp.portalsdk.core.exception.support.FusionRuntimeException;
+
+public class SessionExpiredException extends FusionRuntimeException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ public static final String MESSAGE = "Your session has expired. Please login again.";
+
+ public SessionExpiredException() {
+ super(MESSAGE);
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/UrlAccessRestrictedException.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/UrlAccessRestrictedException.java
new file mode 100644
index 00000000..39fe264a
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/UrlAccessRestrictedException.java
@@ -0,0 +1,34 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.exception;
+
+import org.openecomp.portalsdk.core.exception.support.FusionRuntimeException;
+
+public class UrlAccessRestrictedException extends FusionRuntimeException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ public static final String MESSAGE = "Authorization Denied";
+
+ public UrlAccessRestrictedException() {
+ super(MESSAGE);
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionException.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionException.java
new file mode 100644
index 00000000..135fc3e3
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionException.java
@@ -0,0 +1,24 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.exception.support;
+
+import org.openecomp.portalsdk.core.FusionObject;
+
+public interface FusionException extends FusionObject {}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionRuntimeException.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionRuntimeException.java
new file mode 100644
index 00000000..f7ca61fa
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionRuntimeException.java
@@ -0,0 +1,36 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.exception.support;
+
+public class FusionRuntimeException extends RuntimeException implements FusionException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public FusionRuntimeException() {
+ this("");
+ }
+
+ public FusionRuntimeException(String message) {
+ super(message);
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/ResourceInterceptor.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/ResourceInterceptor.java
new file mode 100644
index 00000000..24088cdb
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/ResourceInterceptor.java
@@ -0,0 +1,164 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.interceptor;
+
+import java.net.HttpURLConnection;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.portalsdk.core.controller.FusionBaseController;
+import org.openecomp.portalsdk.core.domain.App;
+import org.openecomp.portalsdk.core.exception.UrlAccessRestrictedException;
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalTimeoutHandler;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.service.LoginService;
+import org.openecomp.portalsdk.core.service.WebServiceCallService;
+import org.openecomp.portalsdk.core.util.CipherUtil;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+public class ResourceInterceptor extends HandlerInterceptorAdapter {
+ public static final String APP_METADATA = "APP.METADATA";
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ResourceInterceptor.class);
+
+ @Autowired
+ private DataAccessService dataAccessService;
+ @Autowired
+ private LoginService loginService;
+ @Autowired
+ private WebServiceCallService webServiceCallService;
+
+ private AbstractCacheManager cacheManager;
+
+ @Override
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
+ throws Exception {
+ String uri = request.getRequestURI();
+ String url = uri.substring(uri.indexOf("/", 1) + 1);
+ logger.info(EELFLoggerDelegate.debugLogger, "Url - " + url);
+ logger.info(EELFLoggerDelegate.debugLogger, "lastIndexOf - " + uri.substring(uri.lastIndexOf("/") + 1));
+ if (handler instanceof HandlerMethod) {
+ HandlerMethod method = (HandlerMethod) handler;
+ FusionBaseController controller = (FusionBaseController) method.getBean();
+ if (!controller.isAccessible()) {
+ if (controller.isRESTfulCall()) {
+ // check user authentication for RESTful calls
+ String secretKey = null;
+ try {
+ if (!webServiceCallService.verifyRESTCredential(secretKey, request.getHeader("username"),
+ request.getHeader("password"))) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Error accesing RESTful service. Un-authorized",AlarmSeverityEnum.MINOR);
+ throw new UrlAccessRestrictedException();
+ }
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Error authenticating RESTful service :" + e,AlarmSeverityEnum.MINOR);
+ ((HttpServletResponse) response).setStatus(HttpURLConnection.HTTP_UNAUTHORIZED);
+ return false;
+ }
+ }
+ if (!UserUtils.isUrlAccessible(request, url)) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Error accesing URL. Un-authorized",AlarmSeverityEnum.MINOR);
+ throw new UrlAccessRestrictedException();
+ }
+ }
+ }
+
+ logger.debug("successfully authorized rest call");
+ logger.info(EELFLoggerDelegate.debugLogger, "successfully authorized rest call");
+ handleSessionUpdates(request);
+ logger.debug("handled session updates for synchronization");
+ logger.info(EELFLoggerDelegate.debugLogger, "handled session updates for synchronization");
+ return super.preHandle(request, response, handler);
+ }
+
+ /**
+ *
+ * @param request
+ */
+ protected void handleSessionUpdates(HttpServletRequest request) {
+
+ App app = null;
+ Object appObj = getCacheManager().getObject(APP_METADATA);
+ if (appObj == null) {
+ app = findApp();
+ getCacheManager().putObject(APP_METADATA, app);
+
+ } else {
+ app = (App) appObj;
+ }
+
+ String ecompRestURL = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REST_URL);
+ String decreptedPwd = "";
+ try {
+ decreptedPwd = CipherUtil.decrypt(app.getAppPassword(),
+ SystemProperties.getProperty(SystemProperties.Decryption_Key));
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Could not decrypt Password" + e.getMessage(),AlarmSeverityEnum.MINOR);
+ }
+
+ PortalTimeoutHandler.handleSessionUpdatesNative(request, app.getUsername(), decreptedPwd,
+ PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY), ecompRestURL, null);
+ }
+
+ public App findApp() {
+ List<?> list = null;
+ StringBuffer criteria = new StringBuffer();
+ criteria.append(" where id = 1");
+ list = getDataAccessService().getList(App.class, criteria.toString(), null, null);
+ return (list == null || list.size() == 0) ? null : (App) list.get(0);
+ }
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ public LoginService getLoginService() {
+ return loginService;
+ }
+
+ public void setLoginService(LoginService loginService) {
+ this.loginService = loginService;
+ }
+
+ @Autowired
+ public void setCacheManager(AbstractCacheManager cacheManager) {
+ this.cacheManager = cacheManager;
+ }
+
+ public AbstractCacheManager getCacheManager() {
+ return cacheManager;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/SessionTimeoutInterceptor.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/SessionTimeoutInterceptor.java
new file mode 100644
index 00000000..e28ce866
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/SessionTimeoutInterceptor.java
@@ -0,0 +1,103 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.interceptor;
+
+import java.net.URLEncoder;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.core.controller.FusionBaseController;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.exception.SessionExpiredException;
+import org.openecomp.portalsdk.core.listener.CollaborateListBindingListener;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.web.support.AppUtils;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+public class SessionTimeoutInterceptor extends HandlerInterceptorAdapter {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SessionTimeoutInterceptor.class);
+
+ public SessionTimeoutInterceptor() {
+ }
+
+ /**
+ * Checks all requests for valid session information. If not found,
+ * redirects to a controller that will establish a valid session.
+ */
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
+ throws Exception {
+ if (handler instanceof HandlerMethod) {
+ HandlerMethod method = (HandlerMethod) handler;
+ FusionBaseController controller = (FusionBaseController) method.getBean();
+ if (!controller.isAccessible() && !controller.isRESTfulCall()) {
+ try {
+ // getSession() throws SessionExpiredException
+ HttpSession session = AppUtils.getSession(request);
+ User user = UserUtils.getUserSession(request);
+ // check if user is logging out
+ if (request.getRequestURI().indexOf("logout.htm") > -1) {
+ session.removeAttribute(CollaborateListBindingListener.SESSION_ATTR_NAME);
+ throw new SessionExpiredException();
+ } else if (user == null) {
+ // Jump to the redirection code
+ throw new Exception("preHandle: user not found in session");
+ } else {
+ // session binding listener will add this value to the
+ // map, and with session replication the listener will
+ // fire in all tomcat instances
+ session.setAttribute(CollaborateListBindingListener.SESSION_ATTR_NAME,
+ new CollaborateListBindingListener(user.getOrgUserId()));
+ }
+ } catch (Exception ex) {
+ // get the path within the webapp that the user requested (no host name etc.)
+ final String forwardUrl = request.getRequestURI().substring(request.getContextPath().length() + 1)
+ + (request.getQueryString() == null ? "" : "?" + request.getQueryString());
+ final String forwardUrlParm = "forwardURL=" + URLEncoder.encode(forwardUrl, "UTF-8");
+ final String singleSignonPrefix = "/single_signon.htm?";
+ if (ex instanceof SessionExpiredException) {
+ // Session is expired; send to portal.
+ // Redirect to an absolute path in the webapp; e.g., "/context/single_signon.htm"
+ final String redirectUrl = request.getContextPath() + singleSignonPrefix + "redirectToPortal=Yes&" + forwardUrlParm;
+ logger.debug(EELFLoggerDelegate.debugLogger, "preHandle: session is expired, redirecting to {}",
+ redirectUrl);
+ response.sendRedirect(redirectUrl);
+ return false;
+ } else {
+ // Other issue; do not send to portal.
+ // Redirect to an absolute path in the webapp; e.g., "/context/single_signon.htm"
+ final String redirectUrl = request.getContextPath() + singleSignonPrefix + forwardUrlParm;
+ logger.debug(EELFLoggerDelegate.debugLogger, "preHandle: took exception {}, redirecting to {}",
+ ex.getMessage(), redirectUrl);
+ response.sendRedirect(redirectUrl);
+ return false;
+ }
+ }
+ }
+ }
+
+ return super.preHandle(request, response, handler);
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interfaces/SecurityInterface.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interfaces/SecurityInterface.java
new file mode 100644
index 00000000..b40c4713
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interfaces/SecurityInterface.java
@@ -0,0 +1,24 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.interfaces;
+
+public interface SecurityInterface {
+ public boolean isAccessible();
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/ApplicationContextListener.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/ApplicationContextListener.java
new file mode 100644
index 00000000..10e2b2d9
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/ApplicationContextListener.java
@@ -0,0 +1,43 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.listener;
+
+import javax.servlet.ServletContext;
+import javax.servlet.annotation.WebListener;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.event.ContextRefreshedEvent;
+import org.springframework.stereotype.Component;
+
+@WebListener
+@Component
+public class ApplicationContextListener implements ApplicationListener<ContextRefreshedEvent> {
+
+ @Autowired
+ ServletContext context;
+
+
+ public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent ) {
+
+// String contextPath = context.getContextPath();
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/CollaborateListBindingListener.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/CollaborateListBindingListener.java
new file mode 100644
index 00000000..9306aaf1
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/CollaborateListBindingListener.java
@@ -0,0 +1,61 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.listener;
+
+import java.io.Serializable;
+
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSessionBindingListener;
+
+import org.openecomp.portalsdk.core.domain.support.CollaborateList;
+
+public class CollaborateListBindingListener implements HttpSessionBindingListener, Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private String userName;
+ public static final String SESSION_ATTR_NAME = "CollaborateListSessionAttrName";
+
+ public CollaborateListBindingListener(String _userName) {
+ userName = _userName;
+ }
+
+ @Override
+ public void valueBound(HttpSessionBindingEvent event) {
+ final CollaborateListBindingListener value = ((CollaborateListBindingListener) event.getValue());
+ CollaborateList.addUserName(value.getUserName());
+
+ }
+
+ @Override
+ public void valueUnbound(HttpSessionBindingEvent event) {
+ final CollaborateListBindingListener value = ((CollaborateListBindingListener) event.getValue());
+ if (value != null)
+ CollaborateList.delUserName(value.getUserName());
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/UserSessionListener.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/UserSessionListener.java
new file mode 100644
index 00000000..adc84775
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/UserSessionListener.java
@@ -0,0 +1,62 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.listener;
+
+import javax.servlet.annotation.WebListener;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+
+@WebListener
+public class UserSessionListener implements HttpSessionListener{
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserSessionListener.class);
+
+ public void sessionCreated(HttpSessionEvent event){
+
+ }
+
+ /**
+ * Removes sessions from the context scoped HashMap when they expire
+ * or are invalidated.
+ */
+ public void sessionDestroyed(HttpSessionEvent event){
+ try {
+ HttpSession session = event.getSession();
+ session.removeAttribute(CollaborateListBindingListener.SESSION_ATTR_NAME);
+
+ // Object user = session.getAttribute(SystemProperties.getProperty("user.attribute.name"));
+
+ //if( user != null)
+ // {
+ session.removeAttribute(CollaborateListBindingListener.SESSION_ATTR_NAME);
+ //CollaborateList.getInstance().delUserName(user.getOrgUserId());
+ // }
+
+ }
+ catch(Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "sessionDestroyed" + e.getMessage(),AlarmSeverityEnum.MINOR);
+ }
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/AuditLog.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/AuditLog.java
new file mode 100644
index 00000000..5a1a8640
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/AuditLog.java
@@ -0,0 +1,32 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.logging.aspect;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AuditLog {
+ String value() default "";
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAdvice.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAdvice.java
new file mode 100644
index 00000000..5264c70b
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAdvice.java
@@ -0,0 +1,193 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.logging.aspect;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.logging.format.AuditLogFormatter;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.AppService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.util.SystemProperties.SecurityEventTypeEnum;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.att.eelf.configuration.Configuration;
+
+@org.springframework.context.annotation.Configuration
+public class EELFLoggerAdvice {
+
+ @Autowired
+ AppService appService;
+
+ EELFLoggerDelegate adviceLogger = EELFLoggerDelegate.getLogger(EELFLoggerAdvice.class);
+
+ //DateTime Format according to the ECOMP Application Logging Guidelines.
+ private static final SimpleDateFormat ecompLogDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
+
+ public Object[] before(SecurityEventTypeEnum securityEventType, Object[] args, Object[] passOnArgs) {
+ try {
+ String className = "";
+ if (passOnArgs[0]!=null) {
+ className = passOnArgs[0].toString();
+ }
+
+ String methodName = "";
+ if (passOnArgs[1]!=null) {
+ methodName = passOnArgs[1].toString();
+ }
+
+ String appName = appService.getDefaultAppName();
+ if (appName==null || appName=="") {
+ appName = SystemProperties.SDK_NAME;
+ }
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(className);
+
+ //Initialize Request defaults only for controller methods.
+ MDC.put(className + methodName + SystemProperties.METRICSLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC());
+ MDC.put(SystemProperties.TARGET_ENTITY, appName + "_BE");
+ MDC.put(SystemProperties.TARGET_SERVICE_NAME, methodName);
+ if (securityEventType!=null) {
+ MDC.put(className + methodName + SystemProperties.AUDITLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC());
+ HttpServletRequest req = null;
+ if (args[0]!=null && args[0] instanceof HttpServletRequest ) {
+ req = (HttpServletRequest)args[0];
+ logger.setRequestBasedDefaultsIntoGlobalLoggingContext(req, appName);
+ }
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, (methodName +" was invoked."));
+ } catch(Exception e) {
+ adviceLogger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in EELFLoggerAdvice.before() method. Details: " + e.getMessage());
+ }
+
+ return new Object[] {""};
+ }
+
+ public void after(SecurityEventTypeEnum securityEventType, String result, Object[] args, Object[] returnArgs, Object[] passOnArgs) {
+ try {
+ String className = "";
+ if (passOnArgs[0]!=null) {
+ className = passOnArgs[0].toString();
+ }
+
+ String methodName = "";
+ if (passOnArgs[1]!=null) {
+ methodName = passOnArgs[1].toString();
+ }
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(className);
+
+ String appName = appService.getDefaultAppName();
+ if (appName==null || appName=="") {
+ appName = SystemProperties.SDK_NAME;
+ }
+
+ if (MDC.get(SystemProperties.TARGET_SERVICE_NAME) == null || MDC.get(SystemProperties.TARGET_SERVICE_NAME) == "") {
+ MDC.put(SystemProperties.TARGET_SERVICE_NAME, methodName);
+ }
+
+ if (MDC.get(SystemProperties.TARGET_ENTITY) == null || MDC.get(SystemProperties.TARGET_ENTITY) == "") {
+ MDC.put(SystemProperties.TARGET_ENTITY, appName + "_BE");
+ }
+
+ MDC.put(SystemProperties.METRICSLOG_BEGIN_TIMESTAMP, MDC.get(className + methodName + SystemProperties.METRICSLOG_BEGIN_TIMESTAMP));
+ MDC.put(SystemProperties.METRICSLOG_END_TIMESTAMP, getCurrentDateTimeUTC());
+ this.calculateDateTimeDifference(MDC.get(SystemProperties.METRICSLOG_BEGIN_TIMESTAMP), MDC.get(SystemProperties.METRICSLOG_END_TIMESTAMP));
+
+ logger.info(EELFLoggerDelegate.metricsLogger, methodName + " operation is completed.");
+ logger.debug(EELFLoggerDelegate.debugLogger, "Finished executing " + methodName + ".");
+
+ if (securityEventType!=null) {
+
+ MDC.put(SystemProperties.AUDITLOG_BEGIN_TIMESTAMP, MDC.get(className + methodName + SystemProperties.AUDITLOG_BEGIN_TIMESTAMP));
+ MDC.put(SystemProperties.AUDITLOG_END_TIMESTAMP, getCurrentDateTimeUTC());
+ this.calculateDateTimeDifference(MDC.get(SystemProperties.AUDITLOG_BEGIN_TIMESTAMP), MDC.get(SystemProperties.AUDITLOG_END_TIMESTAMP));
+
+ this.logSecurityMessage(logger, securityEventType, result, methodName);
+
+ //clear when finishes audit logging
+ MDC.remove(Configuration.MDC_KEY_REQUEST_ID);
+ MDC.remove(SystemProperties.PARTNER_NAME);
+ MDC.remove(SystemProperties.MDC_LOGIN_ID);
+ MDC.remove(SystemProperties.PROTOCOL);
+ MDC.remove(SystemProperties.FULL_URL);
+ MDC.remove(Configuration.MDC_SERVICE_NAME);
+ MDC.remove(SystemProperties.RESPONSE_CODE);
+ MDC.remove(SystemProperties.STATUS_CODE);
+ MDC.remove(className + methodName + SystemProperties.AUDITLOG_BEGIN_TIMESTAMP);
+ MDC.remove(SystemProperties.AUDITLOG_BEGIN_TIMESTAMP);
+ MDC.remove(SystemProperties.AUDITLOG_END_TIMESTAMP);
+ }
+
+ MDC.remove(className + methodName + SystemProperties.METRICSLOG_BEGIN_TIMESTAMP);
+ MDC.remove(SystemProperties.METRICSLOG_BEGIN_TIMESTAMP);
+ MDC.remove(SystemProperties.METRICSLOG_END_TIMESTAMP);
+ MDC.remove(SystemProperties.MDC_TIMER);
+ MDC.remove(SystemProperties.TARGET_ENTITY);
+ MDC.remove(SystemProperties.TARGET_SERVICE_NAME);
+ } catch(Exception e) {
+ adviceLogger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in EELFLoggerAdvice.after() method. Details: " + e.getMessage());
+ }
+ }
+
+ private void logSecurityMessage(EELFLoggerDelegate logger, SecurityEventTypeEnum securityEventType, String result, String restMethod) {
+ StringBuilder additionalInfoAppender = new StringBuilder();
+ String auditMessage = "";
+
+ additionalInfoAppender.append(String.format("%s request was received.", restMethod));
+
+ //Status code
+ MDC.put(SystemProperties.STATUS_CODE, result);
+
+ String fullURL = MDC.get(SystemProperties.FULL_URL);
+ if (fullURL!=null && fullURL!="") {
+ additionalInfoAppender.append(" Request-URL:" + MDC.get(SystemProperties.FULL_URL));
+ }
+
+ auditMessage = AuditLogFormatter.getInstance().createMessage( MDC.get(SystemProperties.PROTOCOL),
+ securityEventType.name(),
+ MDC.get(SystemProperties.MDC_LOGIN_ID),
+ additionalInfoAppender.toString());
+
+ logger.info(EELFLoggerDelegate.auditLogger, auditMessage);
+ }
+
+ private String getCurrentDateTimeUTC() {
+ String currentDateTime = ecompLogDateFormat.format(new Date());
+ return currentDateTime;
+ }
+
+ private void calculateDateTimeDifference(String beginDateTime, String endDateTime) {
+ if (beginDateTime!=null && endDateTime!=null) {
+ try {
+ Date beginDate = ecompLogDateFormat.parse(beginDateTime);
+ Date endDate = ecompLogDateFormat.parse(endDateTime);
+ String timeDifference = String.format("%d ms", endDate.getTime() - beginDate.getTime());
+ MDC.put(SystemProperties.MDC_TIMER, timeDifference);
+ } catch(Exception e) {
+ adviceLogger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in EELFLoggerAdvice.calculateDateTimeDifference() method. Details: " + e.getMessage());
+ }
+ }
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAspect.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAspect.java
new file mode 100644
index 00000000..3138d21a
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAspect.java
@@ -0,0 +1,88 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.logging.aspect;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.openecomp.portalsdk.core.util.SystemProperties.SecurityEventTypeEnum;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+@Aspect
+@org.springframework.context.annotation.Configuration
+public class EELFLoggerAspect {
+
+ @Autowired
+ EELFLoggerAdvice advice;
+
+ /*
+ * Point-cut expression to handle all INCOMING_REST_MESSAGES
+ */
+ @Pointcut("execution(public * org.openecomp.portalsdk.core.controller.*.*(..))")
+ public void incomingAuditMessages() {}
+
+ @Around("incomingAuditMessages() && @annotation(auditLog)")
+ public Object logAuditMethodAround(ProceedingJoinPoint joinPoint, AuditLog auditLog) throws Throwable {
+ return this.logAroundMethod(joinPoint, SecurityEventTypeEnum.INCOMING_REST_MESSAGE);
+ }
+
+ @Around("incomingAuditMessages() && @within(auditLog)")
+ public Object logAuditMethodClassAround(ProceedingJoinPoint joinPoint, AuditLog auditLog) throws Throwable {
+ return this.logAroundMethod(joinPoint, SecurityEventTypeEnum.INCOMING_REST_MESSAGE);
+ }
+
+ /*
+ * Point cut expression to capture metrics logging
+ */
+ @Pointcut("execution(public * *(..))")
+ public void publicMethod() {}
+
+ @Around("publicMethod() && @within(metricsLog)")
+ public Object logMetricsClassAround(ProceedingJoinPoint joinPoint, MetricsLog metricsLog) throws Throwable {
+ return this.logAroundMethod(joinPoint, null);
+ }
+
+ @Around("publicMethod() && @annotation(metricsLog)")
+ public Object logMetricsMethodAround(ProceedingJoinPoint joinPoint, MetricsLog metricsLog) throws Throwable {
+ return this.logAroundMethod(joinPoint, null);
+ }
+
+ private Object logAroundMethod(ProceedingJoinPoint joinPoint, SecurityEventTypeEnum securityEventType) throws Throwable {
+ //Before
+ Object[] passOnArgs = new Object[] {joinPoint.getSignature().getDeclaringType().getName(),joinPoint.getSignature().getName()};
+ Object[] returnArgs = advice.before(securityEventType, joinPoint.getArgs(), passOnArgs);
+
+ //Execute the actual method
+ Object result = null;
+ String restStatus = "COMPLETE";
+ try {
+ result = joinPoint.proceed();
+ } catch(Exception e) {
+ restStatus = "ERROR";
+ }
+
+ //After
+ advice.after(securityEventType, restStatus, joinPoint.getArgs(), returnArgs, passOnArgs);
+
+ return result;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/MetricsLog.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/MetricsLog.java
new file mode 100644
index 00000000..f795ffb1
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/MetricsLog.java
@@ -0,0 +1,32 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.logging.aspect;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MetricsLog {
+ String value() default "";
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AlarmSeverityEnum.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AlarmSeverityEnum.java
new file mode 100644
index 00000000..360d8d81
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AlarmSeverityEnum.java
@@ -0,0 +1,28 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.logging.format;
+
+public enum AlarmSeverityEnum {
+ CRITICAL,
+ MAJOR,
+ MINOR,
+ INFORMATIONAL,
+ NONE,
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AppMessagesEnum.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AppMessagesEnum.java
new file mode 100644
index 00000000..a6924ba0
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AppMessagesEnum.java
@@ -0,0 +1,249 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.logging.format;
+
+public enum AppMessagesEnum {
+ /*
+ 100-199 Security/Permission Related
+ - Authentication problems (from external client, to external server)
+ - Certification errors
+ -
+
+ 200-299 Availability/Timeout Related
+ - connectivity error
+ - connection timeout
+
+ 300-399 Data Access/Integrity Related
+ - Data in graph in invalid(E.g. no creator is found for service)
+ - Artifact is missing in ES, but exists in graph.
+
+ 400-499 Schema Interface Type/Validation
+ - received Pay-load checksum is invalid
+ - received JSON is not valid
+
+ 500-599 Business/Flow Processing Related
+ - check out to service is not allowed
+ - Roll-back is done
+ - failed to generate heat file
+
+
+ 600-899 Reserved - do not use
+
+ 900-999 Unknown Errors
+ - Unexpected exception
+ */
+
+ BeUebAuthenticationError(ErrorCodesEnum.BEUEBAUTHENTICATIONERROR_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR100E", "An Authentication failure occurred during access to UEB server", "Details: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."),
+
+ BeRestApiAuthenticationError(ErrorCodesEnum.BERESTAPIAUTHENTICATIONERROR, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR101E", "Rejected an incoming REST API request due to invalid credentials", "", "Please check application credentials defined in Database or properties files."),
+
+ InternalAuthenticationInfo(ErrorCodesEnum.INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO,
+ "ERR199I", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."),
+
+ InternalAuthenticationWarning(ErrorCodesEnum.INTERNALAUTHENTICATIONWARNING_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN,
+ "ERR199W", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."),
+
+ InternalAuthenticationError(ErrorCodesEnum.INTERNALAUTHENTICATIONERROR_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR199E", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."),
+
+ InternalAuthenticationFatal(ErrorCodesEnum.INTERNALAUTHENTICATIONFATAL_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL,
+ "ERR199F", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."),
+
+ BeHealthCheckError(ErrorCodesEnum.BeHEALTHCHECKERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR,
+ "ERR200E", "ECOMP-PORTAL Back-end probably lost connectivity to either one of the following components: MySQL DB, UEB Cluster", "", "Please check the logs for more information."),
+
+ BeHealthCheckMySqlError(ErrorCodesEnum.BEHEALTHCHECKMYSQLERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR,
+ "ERR201E", "ECOMP-PORTAL Back-end probably lost connectivity to MySQL DB", "", "Check connectivity to MYSQL is configured correctly under system.properties file."),
+
+ BeHealthCheckUebClusterError(ErrorCodesEnum.BEHEALTHCHECKUEBCLUSTERERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR,
+ "ERR203E", "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "", "Check connectivity to UEB cluster which is configured under portal.properties file."),
+
+ FeHealthCheckError(ErrorCodesEnum.FEHEALTHCHECKERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR,
+ "ERR204E", "Unable to connect to a valid ECOMP-PORTAL Back-end Server.", "", "Please check connectivity from this FE instance towards BE or BE Load Balancer."),
+
+ BeHealthCheckRecovery(ErrorCodesEnum.BEHEALTHCHECKRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO,
+ "ERR205I", "ECOMP-PORTAL Back-end Recovery to either one of the following components: MySQL DB, UEB Cluster", "", "Please check logs for more specific information about the problem."),
+
+ BeHealthCheckMySqlRecovery(ErrorCodesEnum.BEHEALTHCHECKMYSQLRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO,
+ "ERR206I", "ECOMP-PORTAL Back-end connection recovery to MySQL DB", "", "Please check logs for more specific information about the problem."),
+
+ BeHealthCheckUebClusterRecovery(ErrorCodesEnum.BEHEALTHCHECKUEBCLUSTERRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO,
+ "ERR208I", "ECOMP-PORTAL Back-end connection recovery to UEB Cluster", "", "Please check logs for more specific information about the problem."),
+
+ FeHealthCheckRecovery(ErrorCodesEnum.FEHEALTHCHECKRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO,
+ "ERR209I", "Connectivity to ECOMP-PORTAL Front-end Server is recovered", "", "Please check logs for more specific information about the problem."),
+
+ BeUebConnectionError(ErrorCodesEnum.BEUEBCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR210E", "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "Details: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."),
+
+ BeUebUnkownHostError(ErrorCodesEnum.BEUEBUNKOWNHOSTERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR211E", "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "Cannot reach host: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."),
+
+ BeUebRegisterOnboardingAppError(ErrorCodesEnum.BEUEBREGISTERONBOARDINGAPPERROR, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR212E", "Failed to register the On-boarding application with UEB Communication server", "Details: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."),
+
+ BeHttpConnectionError(ErrorCodesEnum.BEHTTPCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR213E", "It could be that communication to an external application might resulted an exception or failed to reach the external application",
+ "Details: {0}.", "Please check logs for more information."),
+
+ InternalConnectionInfo(ErrorCodesEnum.INTERNALCONNECTIONINFO_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO,
+ "ERR299I", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."),
+
+ InternalConnectionWarning(ErrorCodesEnum.INTERNALCONNECTIONWARNING_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN,
+ "ERR299W", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."),
+
+ InternalConnectionError(ErrorCodesEnum.INTERNALCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR299E", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."),
+
+ InternalConnectionFatal(ErrorCodesEnum.INTERNALCONNECTIONFATAL_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL,
+ "ERR299F", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."),
+
+ BeUebObjectNotFoundError(ErrorCodesEnum.BEUEBOBJECTNOTFOUNDERROR_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR303E", "Error occurred during access to U-EB Server.", "Data not found: {0}.", "An error occurred during access to UEB Server, {1} failed to either register or unregister to/from UEB topic."),
+
+ BeUserMissingError(ErrorCodesEnum.BEUSERMISSINGERROR_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR310E", "User is not found", "", "User {0} must be added to the corresponding application with proper user roles."),
+
+ BeUserInactiveWarning(ErrorCodesEnum.BEUSERINACTIVEWARNING_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN,
+ "ERR313W", "User is found but in-active", "", "User {0} must be added to the corresponding application with proper user roles."),
+
+ BeUserAdminPrivilegesInfo(ErrorCodesEnum.BEUSERADMINPRIVILEGESINFO_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN,
+ "ERR314W", "User is found but don't have administrative privileges", "", "User {0} should be given administrator role for the corresponding application to perform the necessary actions."),
+
+ BeInvalidJsonInput(ErrorCodesEnum.BEINVALIDJSONINPUT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR405E", "Failed to convert JSON input to object", "", "Please check logs for more information."),
+
+ BeIncorrectHttpStatusError(ErrorCodesEnum.BEINCORRECTHTTPSTATUSERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR407E", "Communication to an external application is resulted in with Incorrect Http response code", "", "Please check logs for more information."),
+
+ BeInitializationError(ErrorCodesEnum.BEINITIALIZATIONERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR,
+ "ERR500E", "ECOMP-PORTAL Back-end was not initialized properly", "", "Please check logs for more information."),
+
+ BeUebSystemError(ErrorCodesEnum.BEUEBSYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR502E", "Error occurred during access to U-EB Server", "Details: {0}.", "An error occurred in {1} distribution mechanism. Please check the logs for more information."),
+
+ BeDaoSystemError(ErrorCodesEnum.BEDAOSYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR,
+ "ERR505E", "Performing DDL or DML operations on database might have failed", "", "Please check MySQL DB health or look at the logs for more details."),
+
+ BeSystemError(ErrorCodesEnum.BESYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR,
+ "ERR506E", "Unexpected error during operation", "", "Please check logs for more information."),
+
+ BeExecuteRollbackError(ErrorCodesEnum.BEEXECUTEROLLBACKERROR, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR507E", "Roll-back operation towards database has failed", "", "Please check MYSQL DB health or look at the logs for more details."),
+
+ FeHttpLoggingError(ErrorCodesEnum.FEHTTPLOGGINGERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.ERROR,
+ "ERR517E", "Error when logging FE HTTP request/response", "", "Please check MYSQL DB health or look at the logs for more details."),
+
+ FePortalServletError(ErrorCodesEnum.FEPORTALSERVLETERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR518E", "Error when trying to access FE Portal page.", "", "Please check logs for more information."),
+
+ BeDaoCloseSessionError(ErrorCodesEnum.BEDAOCLOSESESSIONERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR519E", "Close local session operation with database failed", "", "Please check MYSQL DB health or look at the logs form more details."),
+
+ BeRestApiGeneralError(ErrorCodesEnum.BERESTAPIGENERALERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR,
+ "ERR900E", "Unexpected error during ECOMP-PORTAL Back-end REST API execution", "", "Please check error log for more information."),
+
+ FeHealthCheckGeneralError(ErrorCodesEnum.FEHEALTHCHECKGENERALERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR,
+ "ERR901E", "General error during FE Health Check", "", "Please check error log for more information."),
+
+ InternalUnexpectedInfo(ErrorCodesEnum.INTERNALUNEXPECTEDINFO_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO,
+ "ERR999I", "Unexpected error", "Details: {0}.", "Please check logs for more information."),
+
+ InternalUnexpectedWarning(ErrorCodesEnum.INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN,
+ "ERR999W", "Unexpected error", "Details: {0}.", "Please check logs for more information."),
+
+ InternalUnexpectedError(ErrorCodesEnum.INTERNALUNEXPECTEDERROR_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
+ "ERR999E", "Unexpected error", "Details: {0}.", "Please check logs for more information."),
+
+ InternalUnexpectedFatal(ErrorCodesEnum.INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL,
+ "ERR999F", "Unexpected error", "Details: {0}.", "Please check logs for more information."),
+
+ ;
+
+ ErrorTypeEnum eType;
+ AlarmSeverityEnum alarmSeverity;
+ ErrorCodesEnum messageCode;
+ ErrorSeverityEnum errorSeverity;
+ String errorCode;
+ String errorDescription;
+ String details;
+ String resolution;
+
+ AppMessagesEnum(ErrorCodesEnum messageCode, ErrorTypeEnum eType, AlarmSeverityEnum alarmSeverity, ErrorSeverityEnum errorSeverity, String errorCode, String errorDescription,
+ String details, String resolution) {
+ this.messageCode = messageCode;
+ this.eType = eType;
+ this.alarmSeverity = alarmSeverity;
+ this.errorSeverity = errorSeverity;
+ this.errorCode = errorCode;
+ this.errorDescription = errorDescription;
+ this.details = details;
+ this.resolution = resolution;
+ }
+
+ public String getDetails() {
+ return this.details;
+ }
+
+ public String getResolution() {
+ return this.resolution;
+ }
+ public String getErrorCode() {
+ return this.errorCode;
+ }
+
+ public String getErrorDescription() {
+ return this.errorDescription;
+ }
+
+ public ErrorSeverityEnum getErrorSeverity() {
+ return this.errorSeverity;
+ }
+
+ public void setErrorSeverity(ErrorSeverityEnum errorSeverity) {
+ this.errorSeverity = errorSeverity;
+ }
+
+ public ErrorCodesEnum getMessageCode() {
+ return messageCode;
+ }
+
+ public void setMessageCode(ErrorCodesEnum messageCode) {
+ this.messageCode = messageCode;
+ }
+
+ public AlarmSeverityEnum getAlarmSeverity() {
+ return alarmSeverity;
+ }
+
+ public void setAlarmSeverity(AlarmSeverityEnum alarmSeverity) {
+ this.alarmSeverity = alarmSeverity;
+ }
+
+ public ErrorTypeEnum getErrorType() {
+ return eType;
+ }
+
+ public void setErrorType(ErrorTypeEnum eType) {
+ this.eType = eType;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ApplicationCodes.properties b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ApplicationCodes.properties
new file mode 100644
index 00000000..efd9ac24
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ApplicationCodes.properties
@@ -0,0 +1,221 @@
+###
+# ================================================================================
+# eCOMP Portal SDK
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ================================================================================
+###
+########################################################################
+#Resource key=Error Code|Message text|Resolution text |Description text
+#######
+#Newlines can be utilized to add some clarity ensuring continuing line
+#has atleast one leading space
+#ResourceKey=\
+# ERR0000E\
+# Sample error msg txt\
+# Sample resolution msg\
+# Sample description txt
+#
+######
+#Error code classification category
+#100 Permission errors
+#200 Availability errors/Timeouts
+#300 Data errors
+#400 Schema Interface type/validation errors
+#500 Business process errors
+#900 Unknown errors
+#
+########################################################################
+
+#Health check
+BEUEBAUTHENTICATIONERROR_ONE_ARGUMENT=\
+ ERR100E|\
+ Authentication problem towards U-EB server. Reason: {0}.|\
+ An Authentication failure occurred during access to UEB server. Please check that UEB keys are configured correctly under fusion.properties file.|
+
+BERESTAPIAUTHENTICATIONERROR =\
+ ERR101E|\
+ Rejected an incoming REST API request to {0} from {1} due to invalid credentials.|\
+ Please check application credentials defined in Database or portal.properties file.|
+
+INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT=\
+ ERR199I|\
+ Internal authentication problem. Description: {0}.|
+
+INTERNALAUTHENTICATIONWARNING_ONE_ARGUMENT=\
+ ERR199W|\
+ Internal authentication problem. Description: {0}.|
+
+INTERNALAUTHENTICATIONERROR_ONE_ARGUMENT=\
+ ERR199E|\
+ Internal authentication problem. Description: {0}.|
+
+INTERNALAUTHENTICATIONFATAL_ONE_ARGUMENT=\
+ ERR199F|\
+ Internal authentication problem. Description: {0}.|
+
+BEHEALTHCHECKERROR=\
+ ERR200E|\
+ {0} probably lost connectivity to either one of the following components: MySQL DB, UEB Cluster. Please check the logs for more information.|
+
+BEHEALTHCHECKMYSQLERROR=\
+ ERR201E|\
+ {0} probably lost connectivity to MySQL DB. Please check the logs for more information.|\
+ Check connectivity to MYSQL is configured correctly under system.properties file.|
+
+BEHEALTHCHECKUEBCLUSTERERROR=\
+ ERR203E|\
+ {0} probably lost connectivity to UEB Cluster. Please check the logs for more information.|\
+ Check connectivity to UEB cluster which is configured under portal.properties file.|
+
+BEHEALTHCHECKRECOVERY=\
+ ERR205I|\
+ {0} Recovery to either one of the following components: MySQL DB, UEB Cluster.|
+
+BEHEALTHCHECKMYSQLRECOVERY=\
+ ERR206I|\
+ {0} connection recovery to MySQL DB.|
+
+BEHEALTHCHECKUEBCLUSTERRECOVERY=\
+ ERR208I|\
+ {0} connection recovery to UEB Cluster.|
+
+FEHEALTHCHECKRECOVERY=\
+ ERR209I|\
+ Connectivity to {0} Server is recovered.|
+
+#UEB communication
+BEUEBCONNECTIONERROR_ONE_ARGUMENT=\
+ ERR210E|\
+ Connection problem towards U-EB server. Reason: {0}.|\
+ Please check that that parameter uebServers in portal.properties points to a valid UEB Cluster.|
+
+BEUEBSYSTEMERROR=\
+ ERR502E|\
+ Error occurred during access to U-EB Server. Operation: {0}.|\
+ An error occurred in {1} distribution mechanism. Please check the logs for more information.|
+
+BEUEBUNKOWNHOSTERROR_ONE_ARGUMENT=\
+ ERR211E|\
+ Connection problem towards U-EB server. Cannot reach host {0}.|\
+ Please check that that parameter uebServers in portal.properties points to a valid UEB Cluster.|
+
+#Onboarding apps
+BEUEBREGISTERONBOARDINGAPPERROR=\
+ ERR212E|\
+ Unable to register the On-boarding application with the U-EB server. Reason: {0}.|\
+ Please check that that parameter uebServers in system.properties points to a valid UEB Cluster.|
+
+#HTTP communication
+BEHTTPCONNECTIONERROR_ONE_ARGUMENT=\
+ ERR213E|\
+ HTTP connection to an external application is failed. Reason: {0}.|\
+ Please check the logs for more information.|
+
+INTERNALCONNECTIONINFO_ONE_ARGUMENT=\
+ ERR299I|\
+ Internal Connection problem. Description: {0}.|
+
+INTERNALCONNECTIONWARNING_ONE_ARGUMENT=\
+ ERR299W|\
+ Internal Connection problem. Description: {0}.|
+
+INTERNALCONNECTIONERROR_ONE_ARGUMENT=\
+ ERR299E|\
+ Internal Connection problem. Description: {0}.|
+
+INTERNALCONNECTIONFATAL_ONE_ARGUMENT=\
+ ERR299F|\
+ Internal Connection problem. Description: {0}.|
+
+BEUEBOBJECTNOTFOUNDERROR_ONE_ARGUMENT=\
+ ERR303E|\
+ Error occurred during access to U-EB Server. Data not found: {0}.|\
+ An error occurred during access to UEB Server, {1} failed to either register or unregister to/from UEB topic.|
+
+#Login error codes
+BEUSERMISSINGERROR_ONE_ARGUMENT=\
+ ERR310E|\
+ User {0} requested is not found.|
+
+BEUSERINACTIVEWARNING_ONE_ARGUMENT=\
+ ERR313W|\
+ User {0} is found but inactive.|
+
+BEUSERADMINPRIVILEGESINFO_ONE_ARGUMENT=\
+ ERR314W|\
+ User {0} is found but don't have administrative privileges.|
+
+BEINVALIDJSONINPUT=\
+ ERR405E|\
+ Failed to convert JSON input to object.|\
+ Please check error logs for more information.|
+
+BEINCORRECTHTTPSTATUSERROR=\
+ ERR407E|\
+ Incorrect HttpResponse Received.|\
+ Please check error & metrics logs for more information.|
+
+BEINITIALIZATIONERROR=\
+ ERR500E|\
+ BE was not initialized properly.|
+
+BEDAOSYSTEMERROR=\
+ ERR505E|\
+ Operation towards database failed.|\
+ Please check MySQL DB health or look at the logs for more details.|
+
+BESYSTEMERROR=\
+ ERR506E|\
+ Unexpected error during operation.|
+
+BEEXECUTEROLLBACKERROR=\
+ ERR507E|\
+ Roll-back operation towards database failed.|\
+ Please check MYSQL DB health or look at the logs for more details.|
+
+FEHTTPLOGGINGERROR=\
+ ERR517E|\
+ Error when logging FE HTTP request/response.|
+
+BEDAOCLOSESESSIONERROR=\
+ ERR519E|\
+ Close local session operation with database failed.|\
+ Please check MYSQL DB health or look at the logs form more details.|
+
+BERESTAPIGENERALERROR=\
+ ERR900E|\
+ Unexpected error during BE REST API execution.|\
+ Please check error log for more information.|
+
+FEHEALTHCHECKGENERALERROR=\
+ ERR901E|\
+ General error during FE Health Check.|
+
+INTERNALUNEXPECTEDINFO_ONE_ARGUMENT=\
+ ERR999I|\
+ Unexpected error. Description: {0}.|
+
+INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT=\
+ ERR999W|\
+ Unexpected error. Description: {0}.|
+
+INTERNALUNEXPECTEDERROR_ONE_ARGUMENT=\
+ ERR999E|\
+ Unexpected error. Description: {0}.|
+
+INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT=\
+ ERR999F|\
+ Unexpected error. Description: {0}.|
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AuditLogFormatter.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AuditLogFormatter.java
new file mode 100644
index 00000000..2cb336e2
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AuditLogFormatter.java
@@ -0,0 +1,106 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.logging.format;
+
+import java.text.MessageFormat;
+import java.util.Map;
+
+import org.openecomp.portalsdk.core.util.SystemProperties;
+
+public class AuditLogFormatter {
+ //Singleton
+ private static AuditLogFormatter instance = new AuditLogFormatter();
+
+ public static AuditLogFormatter getInstance() {
+
+ return instance;
+ }
+
+ public String createMessage(String protocol,String set,
+ String loginId, String message) {
+
+ Object[] securityMessageArgs = prepareFormatArgs(
+ protocol,
+ set,
+ loginId,
+ message );
+
+ return MessageFormat.format(SystemProperties.SECURITY_LOG_TEMPLATE, securityMessageArgs);
+ }
+
+ /**
+ * A method for normalizing the security log field - returns
+ * the @Param defaultValue in case the entry is null or empty.
+ * If the @param entry is not empty, a single quotation is added to it.
+ *
+ * @param entry the entry
+ * @param defaultValue The default value in case the entry is empty
+ * @return String (formatted)
+ */
+ private String formatEntry(Object entry, String defaultValue) {
+ return (entry!=null && !entry.toString().isEmpty()) ? addSingleQuotes(entry.toString()): defaultValue;
+
+ }
+
+ private String addSingleQuotes(String s) {
+ if (null!=s && !s.isEmpty()) {
+ s = SystemProperties.SINGLE_QUOTE+s+SystemProperties.SINGLE_QUOTE;
+ }
+ return s;
+ }
+
+
+ /**
+ * This method prepares an Object array of arguments that would be passed
+ * to the MessageFormat.format() method, to format the security log.
+ *
+ * @param protocol
+ * @param set
+ * @param loginId
+ * @param accessingClient
+ * @param isSuccess
+ * @param message
+ * @return
+ */
+ private Object[] prepareFormatArgs(String protocol,String set,
+ String loginId, String message) {
+
+ Object[] messageFormatArgs = {
+ formatEntry(protocol, SystemProperties.NA),
+ formatEntry(set, SystemProperties.NA),
+ formatEntry(loginId, SystemProperties.UNKNOWN),
+ message
+ };
+ return messageFormatArgs;
+ }
+
+
+ public String createMessage(Map<String, String> logArgsMap) {
+
+ Object[] securityMessageArgs = prepareFormatArgs(
+ logArgsMap.get(SystemProperties.PROTOCOL),
+ logArgsMap.get(SystemProperties.SECURIRY_EVENT_TYPE),
+ logArgsMap.get(SystemProperties.LOGIN_ID),
+ logArgsMap.get(SystemProperties.ADDITIONAL_INFO)
+ );
+
+ return MessageFormat.format(SystemProperties.SECURITY_LOG_TEMPLATE, securityMessageArgs);
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorCodesEnum.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorCodesEnum.java
new file mode 100644
index 00000000..59fe2bb7
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorCodesEnum.java
@@ -0,0 +1,87 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.logging.format;
+
+import com.att.eelf.i18n.EELFResolvableErrorEnum;
+//import com.att.eelf.i18n.EELFResourceManager;
+
+public enum ErrorCodesEnum implements EELFResolvableErrorEnum {
+ BERESTAPIAUTHENTICATIONERROR,
+ BEHTTPCONNECTIONERROR_ONE_ARGUMENT,
+ BEUEBAUTHENTICATIONERROR_ONE_ARGUMENT,
+
+ INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT,
+ INTERNALAUTHENTICATIONWARNING_ONE_ARGUMENT,
+ INTERNALAUTHENTICATIONERROR_ONE_ARGUMENT,
+ INTERNALAUTHENTICATIONFATAL_ONE_ARGUMENT,
+
+ BEHEALTHCHECKRECOVERY,
+ BEHEALTHCHECKMYSQLRECOVERY,
+ BEHEALTHCHECKUEBCLUSTERRECOVERY,
+ FEHEALTHCHECKRECOVERY,
+ BeHEALTHCHECKERROR,
+
+ BEHEALTHCHECKMYSQLERROR,
+ BEHEALTHCHECKUEBCLUSTERERROR,
+ FEHEALTHCHECKERROR,
+ BEUEBCONNECTIONERROR_ONE_ARGUMENT,
+ BEUEBUNKOWNHOSTERROR_ONE_ARGUMENT,
+ BEUEBREGISTERONBOARDINGAPPERROR,
+
+ INTERNALCONNECTIONINFO_ONE_ARGUMENT,
+ INTERNALCONNECTIONWARNING_ONE_ARGUMENT,
+ INTERNALCONNECTIONERROR_ONE_ARGUMENT,
+ INTERNALCONNECTIONFATAL_ONE_ARGUMENT,
+
+ BEUEBOBJECTNOTFOUNDERROR_ONE_ARGUMENT,
+ BEUSERMISSINGERROR_ONE_ARGUMENT,
+
+ BEUSERINACTIVEWARNING_ONE_ARGUMENT,
+ BEUSERADMINPRIVILEGESINFO_ONE_ARGUMENT,
+
+ BEINVALIDJSONINPUT,
+ BEINCORRECTHTTPSTATUSERROR,
+
+ BEINITIALIZATIONERROR,
+ BEUEBSYSTEMERROR,
+ BEDAOSYSTEMERROR,
+ BESYSTEMERROR,
+ BEEXECUTEROLLBACKERROR,
+
+ FEHTTPLOGGINGERROR,
+ FEPORTALSERVLETERROR,
+ BEDAOCLOSESESSIONERROR,
+
+ BERESTAPIGENERALERROR,
+ FEHEALTHCHECKGENERALERROR,
+
+ INTERNALUNEXPECTEDINFO_ONE_ARGUMENT,
+ INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT,
+ INTERNALUNEXPECTEDERROR_ONE_ARGUMENT,
+ INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT,
+
+ ;
+
+ /**
+ * Static initializer to ensure the resource bundles for this class are loaded...
+ * Here this application loads messages from three bundles
+ */
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorSeverityEnum.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorSeverityEnum.java
new file mode 100644
index 00000000..5908fda9
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorSeverityEnum.java
@@ -0,0 +1,27 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.logging.format;
+
+public enum ErrorSeverityEnum {
+ INFO,
+ WARN,
+ ERROR,
+ FATAL,
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorTypeEnum.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorTypeEnum.java
new file mode 100644
index 00000000..8ce2d4dc
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorTypeEnum.java
@@ -0,0 +1,29 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.logging.format;
+
+public enum ErrorTypeEnum {
+ RECOVERY,
+ CONFIG_ERROR,
+ SYSTEM_ERROR,
+ DATA_ERROR,
+ CONNECTION_PROBLEM,
+ AUTHENTICATION_PROBLEM
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/logic/EELFLoggerDelegate.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/logic/EELFLoggerDelegate.java
new file mode 100644
index 00000000..7cf5ee40
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/logic/EELFLoggerDelegate.java
@@ -0,0 +1,323 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.logging.logic;
+
+import static com.att.eelf.configuration.Configuration.MDC_ALERT_SEVERITY;
+import static com.att.eelf.configuration.Configuration.MDC_INSTANCE_UUID;
+import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
+import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN;
+import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS;
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID;
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
+
+import java.net.InetAddress;
+import java.text.MessageFormat;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.format.AppMessagesEnum;
+import org.openecomp.portalsdk.core.logging.format.ErrorSeverityEnum;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.slf4j.MDC;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.att.eelf.configuration.SLF4jWrapper;
+
+public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
+
+ public static EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger();
+ public static EELFLogger applicationLogger = EELFManager.getInstance().getApplicationLogger();
+ public static EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+ public static EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+ public static EELFLogger debugLogger = EELFManager.getInstance().getDebugLogger();
+ private String className;
+ private static ConcurrentMap<String, EELFLoggerDelegate> classMap = new ConcurrentHashMap<String, EELFLoggerDelegate>();
+
+ public EELFLoggerDelegate(String _className) {
+ super(_className);
+ className = _className;
+ }
+
+ public static EELFLoggerDelegate getLogger(Class<?> clazz) {
+
+ String className = clazz.getName();
+ EELFLoggerDelegate delegate = classMap.get(className);
+ if (delegate == null) {
+ delegate = new EELFLoggerDelegate(className);
+ classMap.put(className, delegate);
+ }
+
+ return delegate;
+
+ }
+
+ public static EELFLoggerDelegate getLogger(String className) {
+ if (className==null || className=="") {
+ className = EELFLoggerDelegate.class.getName();
+ }
+ EELFLoggerDelegate delegate = classMap.get(className);
+ if (delegate == null) {
+ delegate = new EELFLoggerDelegate(className);
+ classMap.put(className, delegate);
+ }
+
+ return delegate;
+ }
+
+ public void debug(EELFLogger logger, String msg) {
+ if (logger.isDebugEnabled()) {
+ MDC.put(SystemProperties.MDC_CLASS_NAME, className);
+ logger.debug(msg);
+ MDC.remove(SystemProperties.MDC_CLASS_NAME);
+ }
+ }
+
+ public void debug(EELFLogger logger, String msg, Object... arguments) {
+ if (logger.isDebugEnabled()) {
+ MDC.put(SystemProperties.MDC_CLASS_NAME, className);
+ logger.debug(msg, arguments);
+ MDC.remove(SystemProperties.MDC_CLASS_NAME);
+ }
+ }
+
+ public void debug(EELFLogger logger, String msg, Throwable th) {
+ if (logger.isDebugEnabled()) {
+ MDC.put(SystemProperties.MDC_CLASS_NAME, className);
+ logger.debug(msg, th);
+ MDC.remove(SystemProperties.MDC_CLASS_NAME);
+ }
+ }
+
+ // does not solve the superfluous overhead of string append
+ public void info(EELFLogger logger, String msg) {
+ MDC.put(SystemProperties.MDC_CLASS_NAME, className);
+ logger.info(msg);
+ MDC.remove(SystemProperties.MDC_CLASS_NAME);
+ }
+
+ public void info(EELFLogger logger, String msg, Object... arguments) {
+ MDC.put(SystemProperties.MDC_CLASS_NAME, className);
+ logger.info(msg, arguments);
+ MDC.remove(SystemProperties.MDC_CLASS_NAME);
+ }
+
+ public void info(EELFLogger logger, String msg, Throwable th) {
+ MDC.put(SystemProperties.MDC_CLASS_NAME, className);
+ logger.info(msg, th);
+ MDC.remove(SystemProperties.MDC_CLASS_NAME);
+ }
+
+ public void warn(EELFLogger logger, String msg) {
+ MDC.put(SystemProperties.MDC_CLASS_NAME, className);
+ logger.warn(msg);
+ MDC.remove(SystemProperties.MDC_CLASS_NAME);
+ }
+
+ public void warn(EELFLogger logger, String msg, Object... arguments) {
+ MDC.put(SystemProperties.MDC_CLASS_NAME, className);
+ logger.warn(msg, arguments);
+ MDC.remove(SystemProperties.MDC_CLASS_NAME);
+ }
+
+ public void warn(EELFLogger logger, String msg, Throwable th) {
+ MDC.put(SystemProperties.MDC_CLASS_NAME, className);
+ logger.warn(msg, th);
+ MDC.remove(SystemProperties.MDC_CLASS_NAME);
+ }
+
+ public void error(EELFLogger logger, String msg) {
+ MDC.put(SystemProperties.MDC_CLASS_NAME, className);
+ logger.error(msg);
+ MDC.remove(SystemProperties.MDC_CLASS_NAME);
+ }
+
+ public void error(EELFLogger logger, String msg, Object... arguments) {
+ MDC.put(SystemProperties.MDC_CLASS_NAME, className);
+ logger.warn(msg, arguments);
+ MDC.remove(SystemProperties.MDC_CLASS_NAME);
+ }
+
+ public void error(EELFLogger logger, String msg, Throwable th) {
+ MDC.put(SystemProperties.MDC_CLASS_NAME, className);
+ logger.warn(msg, th);
+ MDC.remove(SystemProperties.MDC_CLASS_NAME);
+ }
+
+ public void error(EELFLogger logger, String msg, AlarmSeverityEnum severtiy) {
+ MDC.put(MDC_ALERT_SEVERITY, severtiy.name());
+ MDC.put(SystemProperties.MDC_CLASS_NAME, className);
+ logger.error(msg);
+ MDC.remove(MDC_ALERT_SEVERITY);
+ MDC.remove(SystemProperties.MDC_CLASS_NAME);
+ }
+
+ public void init() {
+ // Initialize the logger context
+ setGlobalLoggingContext();
+
+ String msg = "############################ Logging is started. ############################";
+ info(applicationLogger, msg);
+ error(errorLogger, msg);
+ info(auditLogger, msg);
+ info(metricsLogger, msg);
+ debug(debugLogger, msg);
+ info(errorLogger, "Successfully initialized the Global logger context.");
+ }
+
+ public void logEcompError(AppMessagesEnum epMessageEnum, String... param) {
+ try {
+ AlarmSeverityEnum alarmSeverityEnum = epMessageEnum.getAlarmSeverity();
+ ErrorSeverityEnum errorSeverityEnum = epMessageEnum.getErrorSeverity();
+
+ MDC.put(MDC_ALERT_SEVERITY, alarmSeverityEnum.name());
+ MDC.put("ErrorCode", epMessageEnum.getErrorCode());
+ MDC.put("ErrorDescription", epMessageEnum.getErrorDescription());
+
+ String resolution = this.formatMessage(epMessageEnum.getDetails() + " " + epMessageEnum.getResolution(), (Object[]) param);
+ if (errorSeverityEnum == ErrorSeverityEnum.WARN) {
+ errorLogger.warn(resolution);
+ } else if(errorSeverityEnum == ErrorSeverityEnum.INFO) {
+ errorLogger.info(resolution);
+ } else {
+ errorLogger.error(resolution);
+ }
+ } catch(Exception e) {
+ errorLogger.error("Failed to log the error code. Details: " + UserUtils.getStackTrace(e));
+ } finally {
+ MDC.remove("ErrorCode");
+ MDC.remove("ErrorDescription");
+ MDC.remove(MDC_ALERT_SEVERITY);
+ }
+ }
+
+ private String formatMessage(String message, Object...args) {
+ StringBuilder sbFormattedMessage = new StringBuilder();
+ if (args!=null && args.length>0 && message!=null && message != "") {
+ MessageFormat mf = new MessageFormat(message);
+ sbFormattedMessage.append(mf.format(args));
+ } else {
+ sbFormattedMessage.append(message);
+ }
+
+ return sbFormattedMessage.toString();
+ }
+
+ /**
+ * Loads all the default logging fields into the MDC context.
+ */
+ private void setGlobalLoggingContext() {
+ MDC.put(MDC_SERVICE_INSTANCE_ID, "");
+ MDC.put(MDC_ALERT_SEVERITY, AlarmSeverityEnum.INFORMATIONAL.toString());
+ try {
+ MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());
+ MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
+ MDC.put(MDC_INSTANCE_UUID, SystemProperties.getProperty(SystemProperties.INSTANCE_UUID));
+ } catch (Exception e) {
+ }
+ }
+
+ public static void mdcPut(String key, String value) {
+ MDC.put(key, value);
+ }
+
+ public static String mdcGet(String key) {
+ return MDC.get(key);
+ }
+
+ public static void mdcRemove(String key) {
+ MDC.remove(key);
+ }
+
+ /**
+ * Loads the RequestId/TransactionId into the MDC which it should be receiving
+ * with an each incoming REST API request. Also, configures few other request
+ * based logging fields into the MDC context.
+ * @param req
+ */
+ public void setRequestBasedDefaultsIntoGlobalLoggingContext(HttpServletRequest req, String appName) {
+ //Load the default fields
+ setGlobalLoggingContext();
+
+ //Load the request based fields
+ if (req!=null) {
+ //Load the Request into MDC context.
+ String requestId = UserUtils.getRequestId(req);
+ MDC.put(MDC_KEY_REQUEST_ID, requestId);
+
+ //Load user agent into MDC context, if available.
+ String accessingClient = "Unknown";
+ accessingClient = req.getHeader(SystemProperties.USERAGENT_NAME);
+ if (accessingClient!=null && accessingClient!="" &&
+ (accessingClient.contains("Mozilla") || accessingClient.contains("Chrome") || accessingClient.contains("Safari"))) {
+ accessingClient = appName + "_FE";
+ }
+ MDC.put(SystemProperties.PARTNER_NAME, accessingClient);
+
+ //Protocol, Rest URL & Rest Path
+ String restURL = "";
+ MDC.put(SystemProperties.FULL_URL, SystemProperties.UNKNOWN);
+ MDC.put(SystemProperties.PROTOCOL, SystemProperties.HTTP);
+ restURL = UserUtils.getFullURL(req);
+ if (restURL!=null && restURL!="") {
+ MDC.put(SystemProperties.FULL_URL, restURL);
+ if (restURL.toLowerCase().contains("https")) {
+ MDC.put(SystemProperties.PROTOCOL, SystemProperties.HTTPS);
+ }
+ }
+
+ //Rest Path
+ MDC.put(MDC_SERVICE_NAME, req.getServletPath());
+
+ //Client IPAddress i.e. IPAddress of the remote host who is making this request.
+ String clientIPAddress = "";
+ clientIPAddress = req.getHeader("X-FORWARDED-FOR");
+ if (clientIPAddress == null) {
+ clientIPAddress = req.getRemoteAddr();
+ }
+ MDC.put(SystemProperties.CLIENT_IP_ADDRESS, clientIPAddress);
+
+ //Load loginId into MDC context.
+ MDC.put(SystemProperties.MDC_LOGIN_ID, "Unknown");
+ String loginId = "";
+ try {
+ loginId = UserUtils.getUserIdFromCookie(req);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if (loginId == null || loginId == "") {
+ User user = UserUtils.getUserSession(req);
+ if (user != null) {
+ loginId = user.getLoginId();
+ }
+ }
+
+ if (loginId!=null && loginId!="") {
+ MDC.put(SystemProperties.MDC_LOGIN_ID, loginId);
+ }
+ }
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuBuilder.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuBuilder.java
new file mode 100644
index 00000000..aac57025
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuBuilder.java
@@ -0,0 +1,164 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.menu;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.FusionObject;
+import org.openecomp.portalsdk.core.domain.MenuData;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@SuppressWarnings("rawtypes")
+public class MenuBuilder implements FusionObject {
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ public MenuBuilder() {
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public Set getMenu(String menuSetName, DataAccessService dataAccessService) {
+
+ Set menu = null;
+ MenuData root = null;
+
+ HashMap params = new HashMap();
+
+ params.put("menu_set_cd", menuSetName);
+
+ // execute a query of the latest configuration of the FN_MENU table for the given menu_set_cd.
+ List menuItems = dataAccessService.executeNamedQuery(SystemProperties.getProperty(SystemProperties.MENU_QUERY_NAME), params, null);
+
+ Iterator i = menuItems.iterator();
+ if (i.hasNext()) {
+ root = (MenuData)i.next();
+ menu = root.getChildMenus();
+ }
+
+ return menu;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Set getMenu(String menuSetName) {
+
+ Set menu = null;
+ MenuData root = null;
+
+ HashMap params = new HashMap();
+
+ params.put("menu_set_cd", menuSetName);
+
+ // execute a query of the latest configuration of the FN_MENU table for the given menu_set_cd.
+ List menuItems = getDataAccessService().executeNamedQuery(SystemProperties.getProperty(SystemProperties.MENU_QUERY_NAME), params, null);
+
+ Iterator i = menuItems.iterator();
+ if (i.hasNext()) {
+ root = (MenuData)i.next();
+ menu = root.getChildMenus();
+ }
+
+ return menu;
+ }
+
+ public static Set filterMenu(Set menus, HttpServletRequest request) {
+ Iterator j = menus.iterator();
+
+ while (j.hasNext()) {
+ MenuData menuItem = (MenuData)j.next();
+
+ if (!UserUtils.isAccessible(request, menuItem.getFunctionCd())) {
+ // remove the menu if the user doesn't have access to it
+ j.remove();
+ }
+ else {
+ // if an accessible menu has a child menu, let's filter that recursively
+
+ Set childMenus = menuItem.getChildMenus();
+ if (childMenus != null && childMenus.size() > 0) {
+ filterMenu(childMenus, request);
+ }
+
+ }
+ }
+
+ return menus;
+ }
+
+
+ public static String getUrlHtml(MenuData menuData) {
+ String html = "";
+
+ if (menuData.getExternalUrl() != null && menuData.getExternalUrl().length() > 0) {
+ html = menuData.getExternalUrl();
+ }
+ else if (menuData.getServlet() != null && menuData.getServlet().length() > 0) {
+ html = "/" + menuData.getServlet();
+ }
+ else if (menuData.getAction() != null && menuData.getAction().length() > 0) {
+ html = "/" + menuData.getAction();
+ }
+
+ return html;
+ }
+
+
+ public static String getTargetHtml(MenuData menuData) {
+ String html = "";
+
+ if (menuData.getTarget() != null && menuData.getTarget().length() > 0) {
+ html = "target=\"" + menuData.getTarget() + "\"";
+ }
+
+ return html;
+ }
+
+
+ public static String getQueryStringHtml(MenuData menuData) {
+ String html = "";
+
+ if (menuData.getQueryString() != null && menuData.getQueryString().length() > 0) {
+ html = "?" + menuData.getQueryString();
+ }
+
+ return html;
+ }
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+}
+
+
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuProperties.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuProperties.java
new file mode 100644
index 00000000..007a7f30
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuProperties.java
@@ -0,0 +1,114 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.menu;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Properties;
+
+import javax.servlet.ServletContext;
+
+import org.openecomp.portalsdk.core.util.SystemProperties;
+
+
+/*
+ MenuProperties contains a list of constants used during the creation,
+ privilege screening, and rendering of the application menu.
+*/
+public class MenuProperties {
+ private MenuProperties() {
+ // cannot instantiate
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static HashMap menuProperties = new HashMap();
+
+ // keys used to reference values in the menu.properties file
+ public static final String WIDTH = "width";
+ public static final String LEFT_POSITION = "left_position";
+ public static final String TOP_POSITION = "top_position";
+ public static final String FONT_COLOR = "font_color";
+ public static final String MOUSEOVER_FONT_COLOR = "mouseover_font_color";
+ public static final String BACKGROUND_COLOR = "background_color";
+ public static final String MOUSEOVER_BACKGROUND_COLOR = "mouseover_background_color";
+ public static final String BORDER_COLOR = "border_color";
+ public static final String SEPARATOR_COLOR = "separator_color";
+ public static final String IMAGE_SRC = "image_src";
+ public static final String IMAGE_SRC_LEFT = "image_src_left";
+ public static final String IMAGE_SRC_OVER = "image_src_over";
+ public static final String IMAGE_SRC_LEFT_OVER = "image_src_left_over";
+ public static final String EVALUATE_UPON_TREE_SHOW = "evaluate_upon_tree_show";
+ public static final String EVALUATE_UPON_TREE_HIDE = "evaluate_upon_tree_hide";
+ public static final String TOP_IS_PERMANENT = "top_is_permanent";
+ public static final String TOP_IS_HORIZONTAL = "top_is_horizontal";
+ public static final String TREE_IS_HORIZONTAL = "tree_is_horizontal";
+ public static final String POSITION_UNDER = "position_under";
+ public static final String TOP_MORE_IMAGES_VISIBLE = "top_more_images_visible";
+ public static final String TREE_MORE_IMAGES_VISIBLE = "tree_more_images_visible";
+ public static final String RIGHT_TO_LEFT = "right_to_left";
+ public static final String DISPLAY_ON_CLICK = "display_on_click";
+ public static final String TOP_IS_VARIABLE_WIDTH = "top_is_variable_width";
+ public static final String TREE_IS_VARIABLE_WIDTH = "tree_is_variable_width";
+ public static final String TOP_KEEP_IN_WINDOW_X = "top_keep_in_window_x";
+ public static final String TOP_KEEP_IN_WINDOW_Y = "top_keep_in_window_y";
+ public static final String MENU_ID_ADMIN = "menu_id_admin";
+ public static final String MENU_ID_LOGOUT = "menu_id_logout";
+ public static final String MENU_FRAME = "menu_frame";
+ public static final String MAIN_FRAME = "main_frame";
+ public static final String NESTED_MAIN_FRAME = "nested_main_frame";
+ public static final String ROLE_FUNCTIONS_TAG = "role_functions_tag";
+
+ public static final String MAX_DISPLAYABLE_ADMIN_MENU_SORT_ORDER = "max_displayable_admin_menu_sort_order";
+ public static final String MENU_PROPERTIES_FILENAME_KEY = "menu_properties_filename";
+ public static final String DEFAULT_SERVLET_NAME = "dispatcher";
+ public static final String DEFAULT_TARGET = "_self";
+
+ public static final String TOP_MENU_CLASS = "top_menu_class";
+ public static final String TOP_MENU_LINK_CLASS = "top_menu_link_class";
+
+ public static final String ON_MOUSE_OUT_TRAILER = "on_mouse_out_trailer";
+ public static final String ON_MOUSE_OVER_TRAILER = "on_mouse_over_trailer";
+ public static final String ON_CLICK_TRAILER = "on_click_trailer";
+
+ public static final String MENU_ID_PREFIX = "menu_id_prefix";
+
+
+ @SuppressWarnings("unchecked")
+public static void loadFromFile(ServletContext servletContext, String filename, String menuSetName) throws IOException {
+ Properties p = new Properties();
+
+ if (filename == null) {
+ filename = SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_PROPERTIES_NAME);
+ }
+
+ p.load(servletContext.getResourceAsStream(SystemProperties.getProperty(SystemProperties.MENU_PROPERTIES_FILE_LOCATION) + filename));
+ menuProperties.put(menuSetName, p);
+ } // loadMenuProperties
+
+ public static String getProperty(String key) {
+ return getProperty(key, SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME));
+ }
+
+ public static String getProperty(String key, String menuSetName) {
+ Properties p = (Properties)menuProperties.get(menuSetName);
+ return p.getProperty(key);
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/AbstractCacheManager.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/AbstractCacheManager.java
new file mode 100644
index 00000000..6fb56d9d
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/AbstractCacheManager.java
@@ -0,0 +1,60 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.objectcache;
+
+import java.io.IOException;
+
+import org.openecomp.portalsdk.core.objectcache.support.FusionCacheManager;
+
+
+public abstract class AbstractCacheManager implements FusionCacheManager {
+ public AbstractCacheManager() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public Object getObject(String key) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void putObject(String key, Object objectToCache) {
+ // TODO Auto-generated method stub
+ }
+
+ public boolean isObjectInCache(String key) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void removeObject(String key) {
+ // TODO Auto-generated method stub
+ }
+
+ public void clearCache() {
+ // TODO Auto-generated method stub
+ }
+
+ public void configure() throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+}
+
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheEventHandler.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheEventHandler.java
new file mode 100644
index 00000000..0695876f
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheEventHandler.java
@@ -0,0 +1,60 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.objectcache.jcs;
+
+import org.apache.jcs.engine.control.event.behavior.IElementEvent;
+import org.apache.jcs.engine.control.event.behavior.IElementEventConstants;
+import org.apache.jcs.engine.control.event.behavior.IElementEventHandler;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class JCSCacheEventHandler implements IElementEventHandler, IElementEventConstants {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(JCSCacheEventHandler.class);
+
+ public JCSCacheEventHandler() {
+ super();
+ }
+
+ public void handleElementEvent(IElementEvent event) {
+ // Handle code for various event notifications on cached elements by JCS.
+ switch (event.getElementEvent()) {
+ case ELEMENT_EVENT_EXCEEDED_MAXLIFE_BACKGROUND:
+ logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_EXCEEDED_MAXLIFE_BACKGROUND occurred for element " + event);
+ break;
+ case ELEMENT_EVENT_EXCEEDED_MAXLIFE_ONREQUEST:
+ logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_EXCEEDED_MAXLIFE_ONREQUEST occurred for element " + event);
+ break;
+ case ELEMENT_EVENT_EXCEEDED_IDLETIME_BACKGROUND:
+ logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_EXCEEDED_IDLETIME_BACKGROUND occurred for element " + event);
+ break;
+ case ELEMENT_EVENT_EXCEEDED_IDLETIME_ONREQUEST:
+ logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_EXCEEDED_IDLETIME_ONREQUEST occurred for element " + event);
+ break;
+ case ELEMENT_EVENT_SPOOLED_DISK_AVAILABLE:
+ logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_SPOOLED_DISK_AVAILABLE occurred for element " + event);
+ break;
+ case ELEMENT_EVENT_SPOOLED_DISK_NOT_AVAILABLE:
+ logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_SPOOLED_DISK_NOT_AVAILABLE occurred for element " + event);
+ break;
+ case ELEMENT_EVENT_SPOOLED_NOT_ALLOWED:
+ logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_SPOOLED_NOT_ALLOWED occurred for element " + event);
+ }
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheManager.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheManager.java
new file mode 100644
index 00000000..39b3f0cb
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheManager.java
@@ -0,0 +1,186 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.objectcache.jcs;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.Vector;
+
+import javax.annotation.PostConstruct;
+import javax.servlet.ServletContext;
+
+import org.apache.jcs.JCS;
+import org.apache.jcs.access.exception.CacheException;
+import org.apache.jcs.engine.CacheConstants;
+import org.apache.jcs.engine.behavior.IElementAttributes;
+import org.apache.jcs.engine.control.CompositeCacheManager;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.web.context.ServletContextAware;
+
+public abstract class JCSCacheManager extends AbstractCacheManager implements CacheConstants, ServletContextAware {
+
+ public static String LOOKUP_OBJECT_CACHE_NAME = "lookUpObjectCache";
+ public static String JCS_CONFIG_FILE_PATH = "cache_config_file_path";
+ public static String CACHE_LOAD_ON_STARTUP = "cache_load_on_startup";
+ public static String CACHE_PROPERTY_VALUE_TRUE = "true";
+ public static String CACHE_CONTROL_SWITCH_ON = "1";
+ public static String CACHE_CONTROL_SWITCH_OFF = "0";
+ public static String CACHE_CONTROL_SWITCH = "cache_switch";
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(JCSCacheManager.class);
+
+ private static JCS lookUpCache;
+ private ServletContext servletContext;
+
+ private Properties cacheConfigProperties = null;
+ private final Vector<String> jscManagedCacheList = new Vector<String>();
+
+ private DataAccessService dataAccessService;
+
+ public JCSCacheManager() {
+ super();
+ jscManagedCacheList.add(LOOKUP_OBJECT_CACHE_NAME);
+ }
+
+ @PostConstruct
+ public void configure() throws IOException {
+ super.configure();
+
+ String jcsConfigFilePath = SystemProperties.getProperty(JCS_CONFIG_FILE_PATH);
+ // getProperty throws if the key is missing; but check anyhow.
+ if (jcsConfigFilePath == null || jcsConfigFilePath.length() == 0)
+ throw new IOException("configure: failed to get value for config property " + JCS_CONFIG_FILE_PATH);
+ InputStream jcsConfigInputStream = getServletContext().getResourceAsStream(jcsConfigFilePath);
+ if (jcsConfigInputStream == null)
+ throw new IOException("configure: failed to open stream for config property " + JCS_CONFIG_FILE_PATH
+ + " with name " + jcsConfigFilePath);
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "configure: loading cache properties from classpath resource {} ", jcsConfigFilePath);
+ Properties p = new Properties();
+ p.load(jcsConfigInputStream);
+ jcsConfigInputStream.close();
+
+ CompositeCacheManager ccm = CompositeCacheManager.getUnconfiguredInstance();
+ ccm.configure(p);
+ setCacheConfigProperties(p);
+
+ try {
+ initializeLookUpCache();
+ } catch (CacheException ce) {
+ throw new IOException("configure: failed to initialize lookup cache", ce);
+ }
+
+ }
+
+ private void initializeLookUpCache() throws CacheException {
+ lookUpCache = JCS.getInstance(LOOKUP_OBJECT_CACHE_NAME);
+
+ JCSCacheEventHandler eventHandler = new JCSCacheEventHandler();
+ IElementAttributes elementAttributes = lookUpCache.getDefaultElementAttributes();
+
+ elementAttributes.addElementEventHandler(eventHandler);
+
+ lookUpCache.setDefaultElementAttributes(elementAttributes);
+
+ if (CACHE_PROPERTY_VALUE_TRUE.equalsIgnoreCase(SystemProperties.getProperty(CACHE_LOAD_ON_STARTUP))) {
+ loadDataOnStartUp();
+ }
+ }
+
+ public Object getObject(String key) {
+ if (CACHE_CONTROL_SWITCH_ON.equalsIgnoreCase(SystemProperties.getProperty(CACHE_CONTROL_SWITCH))) {
+ if (lookUpCache == null)
+ return null;
+ else
+ return lookUpCache.get(key);
+ } else
+ return null;
+ }
+
+ public void putObject(String key, Object objectToCache) {
+ try {
+ if (CACHE_CONTROL_SWITCH_ON.equalsIgnoreCase(SystemProperties.getProperty(CACHE_CONTROL_SWITCH))) {
+ if (lookUpCache != null) {
+ lookUpCache.put(key, objectToCache);
+ }
+ }
+ } catch (CacheException ce) {
+ logger.error(EELFLoggerDelegate.errorLogger, "putObject: failed to put the object with key " + key, ce);
+ }
+ }
+
+ public void clearCache(String region) {
+ try {
+ if (region.equals(LOOKUP_OBJECT_CACHE_NAME))
+ lookUpCache.clear();
+ } catch (CacheException ce) {
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "clearCache: failed to clear the cache for the region " + region, ce);
+ }
+ }
+
+ public void clearCache() {
+ clearCache(LOOKUP_OBJECT_CACHE_NAME);
+ }
+
+ private void loadDataOnStartUp() {
+ loadLookUpCache();
+ }
+
+ public abstract void loadLookUpCache();
+
+ public void refreshLookUpCache() {
+ clearCache(LOOKUP_OBJECT_CACHE_NAME);
+ loadLookUpCache();
+ }
+
+ public Properties getCacheConfigProperties() {
+ return cacheConfigProperties;
+ }
+
+ public void setCacheConfigProperties(Properties cacheConfigProperties) {
+ this.cacheConfigProperties = cacheConfigProperties;
+ }
+
+ public Vector<String> getJscManagedCacheList() {
+ return jscManagedCacheList;
+ }
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ public ServletContext getServletContext() {
+ return servletContext;
+ }
+
+ public void setServletContext(ServletContext servletContext) {
+ this.servletContext = servletContext;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/support/FusionCacheManager.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/support/FusionCacheManager.java
new file mode 100644
index 00000000..01cc9ce0
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/support/FusionCacheManager.java
@@ -0,0 +1,36 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.objectcache.support;
+
+import java.io.IOException;
+
+import org.openecomp.portalsdk.core.FusionObject;
+
+public interface FusionCacheManager extends FusionObject {
+
+ Object getObject(String key);
+ void putObject(String key, Object objectToCache);
+ boolean isObjectInCache(String key);
+
+ void removeObject(String key);
+ void clearCache();
+ void configure() throws IOException;
+}
+
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/AppContextManager.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/AppContextManager.java
new file mode 100644
index 00000000..0e564457
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/AppContextManager.java
@@ -0,0 +1,45 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.client;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+/**
+ *
+ *
+ * Use this class to get access to ApplicationContext for classes who were not created by Spring.
+ */
+
+
+@Component
+public class AppContextManager implements ApplicationContextAware{
+ private static ApplicationContext _appCtx;
+
+ @Override
+ public void setApplicationContext(ApplicationContext ctx){
+ _appCtx = ctx;
+ }
+
+ public static ApplicationContext getAppContext(){
+ return _appCtx;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/OnBoardingApiServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/OnBoardingApiServiceImpl.java
new file mode 100644
index 00000000..1d71afd6
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/OnBoardingApiServiceImpl.java
@@ -0,0 +1,316 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.client;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.domain.UserApp;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.onboarding.crossapi.IPortalRestAPIService;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalAPIException;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalTimeoutHandler;
+import org.openecomp.portalsdk.core.restful.domain.EcompRole;
+import org.openecomp.portalsdk.core.restful.domain.EcompUser;
+import org.openecomp.portalsdk.core.service.RoleService;
+import org.openecomp.portalsdk.core.service.UserProfileService;
+import org.openecomp.portalsdk.core.service.WebServiceCallService;
+import org.openecomp.portalsdk.core.util.JSONUtil;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.slf4j.MDC;
+import org.springframework.context.ApplicationContext;
+
+/**
+ * Implements the REST API interface to answer requests made by Portal app about
+ * users and active sessions.
+ *
+ * Since an instance of this class will be instantiated by the OnBoarding
+ * servlet from the ecompFW library, we cannot use Spring injections here. This
+ * 'injection' is done indirectly using AppContextManager class.
+ *
+
+ */
+@SuppressWarnings("rawtypes")
+public class OnBoardingApiServiceImpl implements IPortalRestAPIService {
+ RoleService roleService;
+ UserProfileService userProfileService;
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(OnBoardingApiServiceImpl.class);
+
+ public OnBoardingApiServiceImpl() {
+ // Defend against null-pointer exception during server startup
+ // that was caused by a spurious Spring annotation on this class.
+ ApplicationContext appContext = AppContextManager.getAppContext();
+ if (appContext == null)
+ throw new RuntimeException("OnBoardingApiServiceImpl ctor failed to get appContext");
+ roleService = appContext.getBean(RoleService.class);
+ userProfileService = appContext.getBean(UserProfileService.class);
+ }
+
+ private void setCurrentAttributes(User user, EcompUser userJson) {
+
+ user.setEmail(userJson.getEmail());
+ user.setFirstName(userJson.getFirstName());
+ user.setHrid(userJson.getHrid());
+ user.setJobTitle(userJson.getJobTitle());
+ user.setLastName(userJson.getLastName());
+ user.setLoginId(userJson.getLoginId());
+ user.setOrgManagerUserId(userJson.getOrgManagerUserId());
+ user.setMiddleInitial(userJson.getMiddleInitial());
+ user.setOrgCode(userJson.getOrgCode());
+ user.setOrgId(userJson.getOrgId());
+ user.setPhone(userJson.getPhone());
+ user.setOrgUserId(userJson.getOrgUserId());
+ user.setActive(userJson.isActive());
+ // user.setRoles(new TreeSet(userJson.getRoles()));
+ }
+
+ @Override
+ public void pushUser(EcompUser userJson) throws PortalAPIException {
+
+ if (logger.isDebugEnabled())
+ logger.debug(EELFLoggerDelegate.debugLogger, "pushUser was invoked: " + userJson);
+ User user = new User();
+ String response = "";
+ try {
+ // Set input attributes to the object obout to be saved
+ setCurrentAttributes(user, userJson);
+ user.setRoles(new TreeSet<Role>());
+ user.setUserApps(new TreeSet());
+ user.setPseudoRoles(new TreeSet());
+ userProfileService.saveUser(user);
+ logger.debug(EELFLoggerDelegate.debugLogger, "push user success.");
+ response = "push user success.";
+ response = JSONUtil.convertResponseToJSON(response);
+ } catch (Exception e) {
+ response = "OnboardingApiService.pushUser failed";
+ logger.error(EELFLoggerDelegate.errorLogger, response, e);
+ throw new PortalAPIException(response, e);
+ } finally {
+ MDC.remove(SystemProperties.MDC_TIMER);
+ }
+ }
+
+ @Override
+ public void editUser(String loginId, EcompUser userJson) throws PortalAPIException {
+
+ if (logger.isDebugEnabled())
+ logger.debug(EELFLoggerDelegate.debugLogger, "OnboardingApi editUser was invoked with loginID " + loginId + ", JSON: " + userJson);
+ User editUser = new User();
+ String response = "";
+ try {
+ setCurrentAttributes(editUser, userJson);
+ if (editUser.getOrgUserId() != null) {
+ editUser.setLoginId(editUser.getOrgUserId());
+ }
+ User domainUser = userProfileService.getUserByLoginId(loginId);
+ if (domainUser != null)
+ domainUser = JSONUtil.mapToDomainUser(domainUser, editUser);
+ else
+ domainUser = editUser;
+ userProfileService.saveUser(domainUser);
+ logger.debug(EELFLoggerDelegate.debugLogger, "edit user success.");
+ response = "edit user success.";
+ response = JSONUtil.convertResponseToJSON(response);
+ } catch (Exception e) {
+ response = "OnboardingApiService.editUser failed";
+ logger.error(EELFLoggerDelegate.errorLogger, response, e);
+ throw new PortalAPIException(response, e);
+ } finally {
+ MDC.remove(SystemProperties.MDC_TIMER);
+ }
+
+ // return response;
+ }
+
+ @Override
+ public EcompUser getUser(String loginId) throws PortalAPIException {
+ try {
+ if (logger.isDebugEnabled())
+ logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: " + loginId);
+ User user = userProfileService.getUserByLoginId(loginId);
+ if (user == null) {
+ logger.info(EELFLoggerDelegate.debugLogger, "User + " + loginId + " doesn't exist");
+ return null;
+ // Unforunately, Portal is not ready to accept proper error
+ // response yet ..
+ // commenting throw clauses until portal is ready
+ // throw new PortalAPIException("User + " + loginId + " doesn't
+ // exist");
+ } else
+ return UserUtils.convertToEcompUser(user);
+ } catch (Exception e) {
+ String response = "OnboardingApiService.getUser failed";
+ logger.error(EELFLoggerDelegate.errorLogger, response, e);
+ return null;
+ // Unforunately, Portal is not ready to accept proper error response
+ // yet .. commenting throw clauses until portal is ready
+ // throw new PortalAPIException(response, e);
+ }
+
+ }
+
+ @Override
+ public List<EcompUser> getUsers() throws PortalAPIException {
+ try {
+ List<User> users = userProfileService.findAllActive();
+ List<EcompUser> ecompUsers = new ArrayList<EcompUser>();
+ for (User user : users)
+ ecompUsers.add(UserUtils.convertToEcompUser(user));
+ return ecompUsers;
+ } catch (Exception e) {
+ String response = "OnboardingApiService.getUsers failed";
+ logger.error(EELFLoggerDelegate.errorLogger, response, e);
+ throw new PortalAPIException(response, e);
+ }
+ }
+
+ @Override
+ public List<EcompRole> getAvailableRoles() throws PortalAPIException {
+ try {
+ List<Role> roles = roleService.getActiveRoles();
+ List<EcompRole> ecompRoles = new ArrayList<EcompRole>();
+ for (Role role : roles)
+ ecompRoles.add(UserUtils.convertToEcompRole(role));
+ return ecompRoles;
+ } catch (Exception e) {
+ String response = "OnboardingApiService.getAvailableRoles failed";
+ logger.error(EELFLoggerDelegate.errorLogger, response, e);
+ throw new PortalAPIException(response, e);
+ }
+ }
+
+ @Override
+ public void pushUserRole(String loginId, List<EcompRole> rolesJson) throws PortalAPIException {
+ String response = "";
+ try {
+ logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: " + loginId);
+ logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## rolesJson: " + rolesJson);
+ User user = userProfileService.getUserByLoginId(loginId);
+ /*
+ * List<EcompRole> ecompRoles = mapper.readValue(rolesJson,
+ * TypeFactory.defaultInstance().constructCollectionType(List.class,
+ * EcompRole.class));
+ */
+ SortedSet<Role> roles = new TreeSet<Role>();
+ for (EcompRole role : rolesJson) {
+ roles.add(roleService.getRole(role.getId()));
+ }
+ // Replace existing roles with new ones
+ replaceExistingRoles(roles, user);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, "push user role success.");
+ response = "push user role success.";
+ response = JSONUtil.convertResponseToJSON(response);
+
+ } catch (Exception e) {
+ response = "OnboardingApiService.pushUserRole failed";
+ logger.error(EELFLoggerDelegate.errorLogger, response, e);
+ throw new PortalAPIException(response, e);
+ } finally {
+ MDC.remove(SystemProperties.MDC_TIMER);
+ }
+
+ }
+
+ @Override
+ public List<EcompRole> getUserRoles(String loginId) throws PortalAPIException {
+ if (logger.isDebugEnabled())
+ logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: " + loginId);
+ List<EcompRole> ecompRoles = new ArrayList<EcompRole>();
+ try {
+ User user = userProfileService.getUserByLoginId(loginId);
+ SortedSet<Role> currentRoles = null;
+ if (user != null) {
+ currentRoles = user.getRoles();
+ if (currentRoles != null)
+ for (Role role : currentRoles)
+ ecompRoles.add(UserUtils.convertToEcompRole(role));
+ }
+ return ecompRoles;
+ } catch (Exception e) {
+ String response = "OnboardingApiService.getUserRoles failed";
+ logger.error(EELFLoggerDelegate.errorLogger, response, e);
+ throw new PortalAPIException(response, e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void replaceExistingRoles(SortedSet<Role> roles, User user) {
+ // 1. remove existing roles
+ Set<UserApp> userApps = user.getUserApps();
+ Iterator appsItr = userApps.iterator();
+ while (appsItr.hasNext()) {
+ UserApp tempUserApp = (UserApp) appsItr.next();
+ boolean roleFound = false;
+ for (Role role : roles) {
+ if (tempUserApp.getRole().getId().equals(role.getId())) {
+ roleFound = true;
+ break;
+ }
+ }
+ if (!roleFound)
+ appsItr.remove();
+ }
+ user.setUserApps(userApps);
+ userProfileService.saveUser(user);
+
+ // 2. add new roles
+ user.setRoles(roles);
+ userProfileService.saveUser(user);
+ }
+
+ @Override
+ public boolean isAppAuthenticated(HttpServletRequest request) throws PortalAPIException {
+ WebServiceCallService securityService = AppContextManager.getAppContext().getBean(WebServiceCallService.class);
+ try {
+ String appUser = request.getHeader("username");
+ String password = request.getHeader("password");
+ // System.out.println("username = " + appUser);
+ // System.out.println("password = " + password);
+ boolean flag = securityService.verifyRESTCredential(null, appUser, password);
+ // System.out.println("username = " + appUser);
+ // System.out.println("password = " + password);
+ return flag;
+
+ } catch (Exception e) {
+ String response = "OnboardingApiService.isAppAuthenticated failed";
+ logger.error(EELFLoggerDelegate.errorLogger, response, e);
+ throw new PortalAPIException(response, e);
+ }
+ }
+
+ public String getSessionTimeOuts() throws Exception {
+ return PortalTimeoutHandler.gatherSessionExtensions();
+ }
+
+ public void updateSessionTimeOuts(String sessionMap) throws Exception {
+ PortalTimeoutHandler.updateSessionExtensions(sessionMap);
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/session/TestClass.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/session/TestClass.java
new file mode 100644
index 00000000..6bbf8c1d
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/session/TestClass.java
@@ -0,0 +1,24 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.session;
+
+public class TestClass {
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/sso/TestClass.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/sso/TestClass.java
new file mode 100644
index 00000000..ccd903a9
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/sso/TestClass.java
@@ -0,0 +1,24 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.sso;
+
+public class TestClass {
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/HttpStatusAndResponse.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/HttpStatusAndResponse.java
new file mode 100644
index 00000000..a8242234
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/HttpStatusAndResponse.java
@@ -0,0 +1,42 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.restful.client;
+
+/**
+ * Holds the status code and body that result from accessing an HTTP URL.
+ */
+public class HttpStatusAndResponse {
+
+ private int statusCode;
+ private String response;
+
+ public HttpStatusAndResponse(int status, String resp) {
+ this.statusCode = status;
+ this.response = resp;
+ }
+
+ public int getStatusCode() {
+ return statusCode;
+ }
+
+ public String getResponse() {
+ return response;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/PortalRestClientBase.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/PortalRestClientBase.java
new file mode 100644
index 00000000..a7c517ec
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/PortalRestClientBase.java
@@ -0,0 +1,171 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.restful.client;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.http.Consts;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+import org.openecomp.portalsdk.core.domain.App;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
+import org.openecomp.portalsdk.core.service.AppService;
+import org.openecomp.portalsdk.core.util.CipherUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * Provides a basic client to access a REST endpoint at the Portal via get or
+ * post. Usage caveats:
+ * <OL>
+ * <LI>Must be auto-wired by Spring, because this in turn auto-wires a
+ * data-access service to read application credentials from the FN_APP table.
+ * <LI>If HTTP access is used and the server uses a self-signed certificate, the
+ * local trust store must be extended appropriately. The HTTP client throws
+ * exceptions if the JVM cannot validate the server certificate.
+ * </OL>
+ */
+@Component
+public class PortalRestClientBase {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PortalRestClientBase.class);
+
+ @Autowired
+ AppService appService;
+
+ /**
+ * Constructs and sends a GET request for the URI, with REST application
+ * credentials in the header as the Portal expects.
+ *
+ * @param uri
+ * URI of the service
+ * @return Result of the get; null if an error happens
+ * @throws URISyntaxException
+ * @throws IOException
+ * @throws ClientProtocolException
+ */
+ public HttpStatusAndResponse getRestWithCredentials(final URI uri) throws Exception {
+
+ String uebKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY);
+ App app = appService.getDefaultApp();
+ if (uebKey == null || app == null || app.getUsername() == null || app.getAppPassword() == null)
+ throw new Exception("Missing one or more required properties and/or database entries");
+ String decryptedPassword = CipherUtil.decrypt(app.getAppPassword());
+ CloseableHttpClient httpClient = HttpClients.createDefault();
+ HttpGet httpGet = new HttpGet(uri);
+ httpGet.setHeader("uebkey", uebKey);
+ httpGet.setHeader("username", app.getUsername());
+ httpGet.setHeader("password", decryptedPassword);
+
+ String responseJson = null;
+ CloseableHttpResponse response = null;
+ try {
+ logger.info(EELFLoggerDelegate.debugLogger, "GET from " + uri);
+ response = httpClient.execute(httpGet);
+ logger.info(EELFLoggerDelegate.debugLogger, "Status is " + response.getStatusLine());
+ if (response.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK)
+ logger.info(EELFLoggerDelegate.debugLogger, "Status is " + response.getStatusLine().toString());
+ HttpEntity entity = response.getEntity();
+ if (entity == null) {
+ logger.info(EELFLoggerDelegate.debugLogger, "Entity is null!");
+ } else {
+ // entity content length is never set.
+ // this naively tries to read everything.
+ responseJson = EntityUtils.toString(entity);
+ logger.info(EELFLoggerDelegate.debugLogger, responseJson);
+ EntityUtils.consume(entity);
+ }
+ } finally {
+ if (response != null)
+ response.close();
+ }
+ if (response == null)
+ return null;
+ return new HttpStatusAndResponse(response.getStatusLine().getStatusCode(), responseJson);
+ }
+
+ /**
+ * Constructs and sends a POST request using the specified body, with REST
+ * application credentials in the header as the Portal expects.
+ *
+ * @param uri
+ * REST endpoint
+ * @param json
+ * Content to post
+ * @return Result of the post; null if an error happens
+ * @throws Exception
+ */
+ public HttpStatusAndResponse postRestWithCredentials(final URI uri, final String json) throws Exception {
+
+ String uebKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY);
+ App app = appService.getDefaultApp();
+ if (uebKey == null || app == null || app.getUsername() == null || app.getAppPassword() == null)
+ throw new Exception("Missing one or more required properties and/or database entries");
+
+ CloseableHttpClient httpClient = HttpClients.createDefault();
+ HttpPost httpPost = new HttpPost(uri);
+ httpPost.setHeader("uebkey", uebKey);
+ httpPost.setHeader("username", app.getUsername());
+ httpPost.setHeader("password", app.getAppPassword());
+
+ StringEntity postEntity = new StringEntity(json, ContentType.create("application/json", Consts.UTF_8));
+ httpPost.setEntity(postEntity);
+
+ String responseJson = null;
+ CloseableHttpResponse response = null;
+ try {
+ logger.info(EELFLoggerDelegate.debugLogger, "POST to " + uri);
+ response = httpClient.execute(httpPost);
+ logger.info(EELFLoggerDelegate.debugLogger, "Status is " + response.getStatusLine());
+ if (response.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK)
+ throw new Exception("Status is " + response.getStatusLine().toString());
+
+ HttpEntity entity = response.getEntity();
+ if (entity == null) {
+ logger.info(EELFLoggerDelegate.debugLogger, "Entity is null!");
+ } else {
+ // entity content length is never set.
+ // this naively tries to read everything.
+ responseJson = EntityUtils.toString(entity);
+ logger.info(EELFLoggerDelegate.debugLogger, responseJson);
+ EntityUtils.consume(entity);
+ }
+ } finally {
+ if (response != null)
+ response.close();
+ }
+ return new HttpStatusAndResponse(response.getStatusLine().getStatusCode(), responseJson);
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/SharedContextRestClient.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/SharedContextRestClient.java
new file mode 100644
index 00000000..f017a7df
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/SharedContextRestClient.java
@@ -0,0 +1,330 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.restful.client;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.http.client.utils.URIBuilder;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
+import org.openecomp.portalsdk.core.restful.domain.SharedContext;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * Provides convenience methods to use the shared-context service at Portal.
+ * This hides all JSON; instead it accepts and returns Java objects.
+ * Usage caveats (repeated from superclass):
+ * <OL>
+ * <LI>Must be auto-wired by Spring, because this in turn auto-wires a data
+ * access service to read application credentials from the FN_APP table.
+ * <LI>If HTTP access is used and the server uses a self-signed certificate, the
+ * local trust store must be extended appropriately. The HTTP client throws
+ * exceptions if the JVM cannot validate the server certificate.
+ * </OL>
+ */
+@Component
+public class SharedContextRestClient extends PortalRestClientBase {
+
+ @Autowired
+ SystemProperties systemProperties;
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SharedContextRestClient.class);
+
+ /**
+ * Reusable JSON (de)serializer
+ */
+ private final ObjectMapper mapper = new ObjectMapper();
+
+ /**
+ * Gets the shared-context value for the specified context ID and key.
+ *
+ * @param contextId
+ * An Ecomp Portal session ID
+ * @param key
+ * Key for the shared-context entry; e.g., "lastName"
+ * @return SharedContext object; null if not found.
+ * @throws Exception
+ */
+ public SharedContext getContextValue(String contextId, String key) throws Exception {
+ HttpStatusAndResponse hsr = getContext("get", contextId, key);
+ logger.info(EELFLoggerDelegate.debugLogger, "getSharedContext: resp is " + hsr);
+ if (hsr == null) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "getContextValue: unexpected null response");
+ return null;
+ }
+ SharedContext jsonObj = null;
+ try {
+ jsonObj = mapper.readValue(hsr.getResponse(), SharedContext.class);
+ } catch (JsonMappingException ex) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "getContextValue: failed to map response onto object" + ex.getMessage());
+ } catch (JsonParseException ex) {
+ logger.info(EELFLoggerDelegate.applicationLogger, "getContextValue: failed to parse response" + ex.getMessage());
+ }
+ if (jsonObj != null && jsonObj.getResponse() != null)
+ return null;
+ return jsonObj;
+ }
+
+ /**
+ * Gets user information for the specified context ID.
+ *
+ * @param contextId
+ * An Ecomp Portal session ID
+ * @return List of SharedContext objects corresponding to the following
+ * keys: USER_FIRST_NAME, USER_LAST_NAME, USER_EMAIL and
+ * USER_ORGUSERID; empty if none were found; null if an error happens.
+ * @throws Exception
+ */
+ public List<SharedContext> getUserContext(String contextId) throws Exception {
+ HttpStatusAndResponse hsr = getContext("get_user", contextId, null);
+ logger.info(EELFLoggerDelegate.debugLogger, "getUserContext: resp is " + hsr);
+ if (hsr == null) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "getUserContext: unexpected null response");
+ return null;
+ }
+ List<SharedContext> jsonList = null;
+ try {
+ TypeReference<List<SharedContext>> typeRef = new TypeReference<List<SharedContext>>() {
+ };
+ jsonList = mapper.readValue(hsr.getResponse(), typeRef);
+ } catch (JsonMappingException ex) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "getUserContext: failed to map response onto object" + ex.getMessage());
+ } catch (JsonParseException ex) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "getUserContext: failed to parse response" + ex.getMessage());
+ }
+ return jsonList;
+ }
+
+ /**
+ * Checks whether a shared-context entry exists for the specified context ID
+ * and key.
+ *
+ * @param contextId
+ * An Ecomp Portal session ID
+ * @param key
+ * Key for the shared-context entry; e.g., "lastName"
+ * @return True if the object exists, false otherwise; null on error.
+ * @throws Exception
+ */
+ public Boolean checkSharedContext(String contextId, String key) throws Exception {
+ HttpStatusAndResponse hsr = getContext("check", contextId, key);
+ logger.info(EELFLoggerDelegate.debugLogger, "checkSharedContext: resp is " + hsr);
+ if (hsr == null) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "checkSharedContext: unexpected null response");
+ return null;
+ }
+ String response = null;
+ try {
+ SharedContext jsonObj = mapper.readValue(hsr.getResponse(), SharedContext.class);
+ response = jsonObj.getResponse();
+ } catch (JsonMappingException ex) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "checkSharedContext: failed to map response onto object" + ex.getMessage());
+ } catch (JsonParseException ex) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "checkSharedContext: failed to parse response" + ex.getMessage());
+ }
+ if (response == null)
+ return null;
+ return ("exists".equals(response));
+ }
+
+ /**
+ * Removes a shared-context entry with the specified context ID and key.
+ *
+ * @param contextId
+ * An Ecomp Portal session ID
+ * @param key
+ * Key for the shared-context entry; e.g., "lastName"
+ * @return True if the entry was removed, false otherwise; null on error.
+ * @throws Exception
+ */
+ public Boolean removeSharedContext(String contextId, String key) throws Exception {
+ HttpStatusAndResponse hsr = getContext("remove", contextId, key);
+ logger.info(EELFLoggerDelegate.debugLogger, "removeSharedContext: resp is " + hsr);
+ if (hsr == null) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "removeSharedContext: unexpected null response");
+ return null;
+ }
+ SharedContext jsonObj = null;
+ try {
+ jsonObj = mapper.readValue(hsr.getResponse(), SharedContext.class);
+ } catch (JsonMappingException ex) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "removeSharedContext: failed to map response onto object" + ex.getMessage());
+ } catch (JsonParseException ex) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "removeSharedContext: failed to parse response" + ex.getMessage());
+ }
+ if (jsonObj == null)
+ return null;
+ String response = jsonObj.getResponse();
+ return ("removed".equals(response));
+ }
+
+ /**
+ * Clears the shared context for the specified context ID; i.e., removes all
+ * key-value pairs.
+ *
+ * @param contextId
+ * An Ecomp Portal session ID
+ * @return Number of key-value pairs removed; -1 if not found or any
+ * problems occur.
+ * @throws Exception
+ */
+ public int clearSharedContext(String contextId) throws Exception {
+ HttpStatusAndResponse hsr = getContext("remove", contextId, null);
+ logger.info(EELFLoggerDelegate.debugLogger, "clearSharedContext: resp is " + hsr);
+ if (hsr == null) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "clearSharedContext: unexpected null response");
+ return -1;
+ }
+ SharedContext jsonObj = null;
+ try {
+ jsonObj = mapper.readValue(hsr.getResponse(), SharedContext.class);
+ } catch (JsonMappingException ex) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "clearSharedContext: failed to map response onto object" + ex.getMessage());
+ } catch (JsonParseException ex) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "clearSharedContext: failed to parse response" + ex.getMessage());
+ }
+ if (jsonObj == null)
+ return -1;
+ String response = jsonObj.getResponse();
+ if (response == null)
+ return -1;
+ return Integer.parseInt(response);
+ }
+
+ /**
+ * Creates a shared-context entry.
+ *
+ * @param contextId
+ * An Ecomp Portal session ID
+ * @param key
+ * Key for the shared-context entry; e.g., "lastName"
+ * @param value
+ * Value for the entry
+ * @throws Exception
+ * @return True if the object previously existed, false otherwise; null if
+ * any problem happened.
+ */
+ public Boolean setSharedContext(String contextId, String key, String value) throws Exception {
+ String body = buildContext(contextId, key, value);
+ HttpStatusAndResponse hsr = postContext("set", body);
+ logger.info(EELFLoggerDelegate.debugLogger, "setSharedContext: resp is " + hsr);
+ if (hsr == null) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "setSharedContext: unexpected null response");
+ return null;
+ }
+ SharedContext jsonObj = null;
+ try {
+ jsonObj = mapper.readValue(hsr.getResponse(), SharedContext.class);
+ } catch (JsonMappingException ex) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "setSharedContext: failed to map response onto object" + ex.getMessage());
+ } catch (JsonParseException ex) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "setSharedContext: failed to parse response" + ex.getMessage());
+ }
+ if (jsonObj == null)
+ return null;
+ String response = jsonObj.getResponse();
+ return ("replaced".equals(response));
+ }
+
+ /**
+ * Builds the full URL with the specified parameters, then calls the method
+ * that adds credentials and GETs.
+ *
+ * @param requestPath
+ * @param contextId
+ * @param contextKey
+ * @return HttpStatusAndResponse object; may be null.
+ * @throws Exception
+ */
+ @SuppressWarnings("unused")
+ private HttpStatusAndResponse getContext(String requestPath, String contextId, String contextKey) throws Exception{
+ String restUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REST_URL);
+ String portalDomain = restUrl.substring(0, restUrl.lastIndexOf('/'));
+ String contextRestUrl = portalDomain + "/context";
+ if (contextRestUrl == null)
+ throw new Exception("getContext: failed to get property " + SystemProperties.ECOMP_SHARED_CONTEXT_REST_URL);
+ URIBuilder uriBuilder = new URIBuilder(contextRestUrl + "/" + requestPath);
+ uriBuilder.addParameter("context_id", contextId);
+ if (contextKey != null)
+ uriBuilder.addParameter("ckey", contextKey);
+ final URI uri = uriBuilder.build();
+ return getRestWithCredentials(uri);
+ }
+
+ /**
+ * Builds the full URL, then calls the method that adds credentials and
+ * POSTs.
+ *
+ * @param requestPath
+ * @param contextId
+ * @param contextKey
+ * @return HttpStatusAndResponse object; may be null.
+ * @throws Exception
+ */
+ private HttpStatusAndResponse postContext(String requestPath, String json) throws Exception {
+ String contextRestUrl = SystemProperties.getProperty(SystemProperties.ECOMP_SHARED_CONTEXT_REST_URL);
+ if (contextRestUrl == null)
+ throw new Exception("postContext: failed to get property " + SystemProperties.ECOMP_SHARED_CONTEXT_REST_URL);
+ URIBuilder uriBuilder = new URIBuilder(contextRestUrl + "/" + requestPath);
+ URI uri = uriBuilder.build();
+ return postRestWithCredentials(uri, json);
+ }
+
+ /**
+ * Builds a JSON block with a single shared-context entry.
+ *
+ * @param cxid
+ * Context ID
+ * @param ckey
+ * Context Key
+ * @param cvalue
+ * Context value
+ * @return JSON block
+ */
+ private String buildContext(String cxid, String ckey, String cvalue) throws JsonProcessingException {
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> stringMap = new HashMap<String, String>();
+ stringMap.put("context_id", cxid);
+ stringMap.put("ckey", ckey);
+ stringMap.put("cvalue", cvalue);
+ String json = mapper.writeValueAsString(stringMap);
+ return json;
+ }
+
+ // Simple test scaffold
+ public static void main(String[] args) throws Exception {
+
+ SharedContextRestClient client = new SharedContextRestClient();
+ SharedContext get = client.getContextValue("abc", "123");
+ System.out.println("Get yields " + get.toString());
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CoreRegister.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CoreRegister.java
new file mode 100644
index 00000000..5f81308f
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CoreRegister.java
@@ -0,0 +1,95 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.scheduler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.quartz.CronTrigger;
+import org.quartz.Trigger;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.stereotype.Component;
+
+@Component
+@DependsOn({"systemProperties"})
+public class CoreRegister {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CoreRegister.class);
+ Trigger trigger[] = new Trigger[1];
+
+
+
+ //@Autowired
+ //private SessionMgtRegistry sessionMgtRegistry;
+
+ protected List<Trigger> scheduleTriggers = new ArrayList<Trigger>();
+
+
+ public void registerTriggers() {
+ // we can use this method to add any schedules to the core
+
+ /*
+ try {
+ if(SystemProperties.getProperty(SystemProperties.SESSIONTIMEOUT_FEED_CRON) != null)
+ getScheduleTriggers().add(sessionMgtRegistry.getTrigger());
+
+ } catch(IllegalStateException ies) {
+ logger.info("Session Timout Cron not available");
+ }
+ */
+
+ }
+
+ protected void addTrigger(final String cron, final CronTrigger cronRegistryTrigger) {
+ // if the property value is not available; the cron will not be added and can be ignored. its safe to ignore the exceptions
+
+ try {
+
+ if(SystemProperties.getProperty(cron) != null) {
+ getScheduleTriggers().add(cronRegistryTrigger);
+ }
+
+ } catch(IllegalStateException ies) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Log Cron not available", AlarmSeverityEnum.MAJOR);
+ }
+ }
+
+
+
+
+ public List<Trigger> getScheduleTriggers() {
+ return scheduleTriggers;
+ }
+
+
+
+ public void setScheduleTriggers(List<Trigger> scheduleTriggers) {
+ this.scheduleTriggers = scheduleTriggers;
+ }
+
+
+
+
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CronRegistry.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CronRegistry.java
new file mode 100644
index 00000000..fdfda984
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CronRegistry.java
@@ -0,0 +1,124 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.scheduler;
+
+import java.text.ParseException;
+import java.util.Map;
+
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.quartz.CronTrigger;
+import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
+import org.springframework.scheduling.quartz.JobDetailFactoryBean;
+import org.springframework.scheduling.quartz.QuartzJobBean;
+
+import com.mchange.v2.c3p0.ComboPooledDataSource;
+
+public abstract class CronRegistry {
+
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CronRegistry.class);
+ protected JobDetailFactoryBean jobDetailFactory;
+ protected CronTriggerFactoryBean cronTriggerFactory;
+
+ private ComboPooledDataSource dataSource;
+
+ public CronRegistry() {
+ try {
+ jobDetailFactoryBean();
+ cronTriggerFactoryBean();
+ }
+ catch(Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, e.getMessage());
+ }
+ }
+
+ //@Autowired
+ public CronRegistry(ComboPooledDataSource dataSource) {
+ try {
+ this.dataSource = dataSource;
+ jobDetailFactoryBean();
+ cronTriggerFactoryBean();
+ }
+ catch(Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AlarmSeverityEnum.MAJOR);
+ }
+ }
+
+ //@Autowired
+ public CronRegistry(Object... initializeObjects) {
+ try {
+ initializeObjects(initializeObjects);
+ jobDetailFactoryBean();
+ cronTriggerFactoryBean();
+ }
+ catch(Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, e.getMessage());
+ }
+ }
+
+ protected void initializeObjects(Object... initializeObjects) {
+ }
+
+ public abstract JobDetailFactoryBean jobDetailFactoryBean() throws ParseException;
+
+ protected JobDetailFactoryBean jobDetailFactoryBean(String groupName, String jobName,
+ Class<? extends QuartzJobBean> jobClass, Map<String, Object> map) {
+
+ jobDetailFactory = new JobDetailFactoryBean();
+ jobDetailFactory.setJobClass(jobClass);
+ jobDetailFactory.setJobDataAsMap(map);
+ jobDetailFactory.setGroup(groupName);
+ jobDetailFactory.setName(jobName);
+ jobDetailFactory.afterPropertiesSet();
+
+ return jobDetailFactory;
+ }
+
+ public abstract CronTriggerFactoryBean cronTriggerFactoryBean() throws ParseException;
+
+ protected CronTriggerFactoryBean cronTriggerFactoryBean(String groupName, String triggerName, String cronExpression) throws ParseException {
+ cronTriggerFactory = new CronTriggerFactoryBean();
+ cronTriggerFactory.setJobDetail(jobDetailFactory.getObject());
+ cronTriggerFactory.setStartDelay(3000);
+ cronTriggerFactory.setName(triggerName);
+ cronTriggerFactory.setGroup(groupName);
+ logger.info(EELFLoggerDelegate.applicationLogger, triggerName + " Scheduled: " + cronExpression);
+ cronTriggerFactory.setCronExpression( cronExpression); //"0 * * * * ? *"
+ cronTriggerFactory.afterPropertiesSet();
+ return cronTriggerFactory;
+ }
+
+ public CronTrigger getTrigger() {
+ return cronTriggerFactory.getObject();
+ }
+
+
+ public void setDataSource(ComboPooledDataSource dataSource) {
+ this.dataSource = dataSource;
+ }
+
+
+ public ComboPooledDataSource getDataSource() {
+ return dataSource;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/Registerable.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/Registerable.java
new file mode 100644
index 00000000..e2e4c385
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/Registerable.java
@@ -0,0 +1,30 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.scheduler;
+
+import org.quartz.Trigger;
+
+public interface Registerable {
+
+ public void registerTriggers();
+
+ public Trigger[] getTriggers();
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppService.java
new file mode 100644
index 00000000..55180fd7
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppService.java
@@ -0,0 +1,61 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.core.domain.App;
+
+/**
+ * Defines methods to fetch App domain objects.
+ *
+ * Very thin interface; Portal defines a much richer interface.
+ */
+public interface AppService {
+
+ /**
+ * Gets all apps defined in the table.
+ *
+ * @return List of apps.
+ */
+ List<App> getApps();
+
+ /**
+ * Gets the app with the specified ID.
+ *
+ * @param appId
+ * @return App with the specified ID.
+ */
+ App getApp(Long appId);
+
+ /**
+ * Gets the singleton entry - applications should have exactly 1 row in the
+ * FN_APP table.
+ */
+ App getDefaultApp();
+
+ /**
+ * Fetches the application name once from database
+ * and keep refers to the same name later on as required.
+ * @return Default Application Name
+ */
+ String getDefaultAppName();
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppServiceImpl.java
new file mode 100644
index 00000000..30e566a2
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppServiceImpl.java
@@ -0,0 +1,106 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.core.domain.App;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service("appService")
+@Transactional
+public class AppServiceImpl implements AppService{
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppServiceImpl.class);
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ /**
+ * Loads the appName once from database and
+ * keep refers to it as required.
+ */
+ private static String defaultAppName = "";
+
+ /*
+ * (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.service.AppService#getApps()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<App> getApps() {
+ return getDataAccessService().getList(App.class, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.service.AppService#getApp(long)
+ */
+ @Override
+ public App getApp(Long appId) {
+ return (App)getDataAccessService().getDomainObject(App.class, appId, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.service.AppService#getApp()
+ */
+ @Override
+ public App getDefaultApp() {
+ return getApp(1L);
+ }
+
+ /**
+ * Gets the data access service.
+ * @return DataAccessService
+ */
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ /**
+ * Sets the data access service.
+ * @param dataAccessService
+ */
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ /**
+ * Fetches the application name once from database
+ * and keep refers to the same name later on as required.
+ * @return Default Application Name
+ */
+ @Override
+ public String getDefaultAppName() {
+ if (AppServiceImpl.defaultAppName==null || AppServiceImpl.defaultAppName=="") {
+ App app = getApp(1L);
+ if (app!=null) {
+ AppServiceImpl.defaultAppName = app.getName();
+ } else {
+ logger.warn(EELFLoggerDelegate.errorLogger, ("Unable to locate the app information from the database."));
+ }
+ }
+ return AppServiceImpl.defaultAppName;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditService.java
new file mode 100644
index 00000000..b632c92c
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditService.java
@@ -0,0 +1,36 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.HashMap;
+
+import org.openecomp.portalsdk.core.domain.AuditLog;
+
+public interface AuditService {
+ /**
+ *
+ * Update log data in database
+ *
+ * @param auditLog
+ * @param additionalParams
+ */
+ @SuppressWarnings("rawtypes")
+ void logActivity(AuditLog auditLog, HashMap additionalParams);
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditServiceImpl.java
new file mode 100644
index 00000000..8fbd550c
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditServiceImpl.java
@@ -0,0 +1,50 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.HashMap;
+
+import org.openecomp.portalsdk.core.domain.AuditLog;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service("auditService")
+@Transactional
+public class AuditServiceImpl implements AuditService {
+ public AuditServiceImpl() {}
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ @SuppressWarnings("rawtypes")
+ public void logActivity(AuditLog auditLog, HashMap additionalParams) {
+ getDataAccessService().saveDomainObject(auditLog, additionalParams);
+ }
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastService.java
new file mode 100644
index 00000000..8d60e74b
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastService.java
@@ -0,0 +1,37 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.HashMap;
+import java.util.Hashtable;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.domain.BroadcastMessage;
+
+@SuppressWarnings("rawtypes")
+public interface BroadcastService {
+ HashMap getBcModel(HttpServletRequest request);
+ Hashtable getBroadcastMessages();
+ void loadMessages();
+ BroadcastMessage getBroadcastMessage(HttpServletRequest request);
+ void saveBroadcastMessage(BroadcastMessage broadcastMessage);
+ void removeBroadcastMessage(BroadcastMessage broadcastMessage);
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastServiceImpl.java
new file mode 100644
index 00000000..def1c1a6
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastServiceImpl.java
@@ -0,0 +1,248 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.domain.BroadcastMessage;
+import org.openecomp.portalsdk.core.domain.Lookup;
+import org.openecomp.portalsdk.core.service.support.FusionService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.AppUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.ServletRequestBindingException;
+import org.springframework.web.bind.ServletRequestUtils;
+
+@SuppressWarnings("rawtypes")
+@Service("broadcastService")
+@Transactional
+public class BroadcastServiceImpl extends FusionService implements BroadcastService {
+
+ public BroadcastServiceImpl() {
+ }
+
+ @Autowired
+ private DataAccessService dataAccessService;
+ private static Hashtable broadcastMessages = new Hashtable();
+
+ @SuppressWarnings("unchecked")
+ public void loadMessages() {
+ List messageLocations = AppUtils.getLookupListNoCache("fn_lu_message_location", "message_location_id", "message_location_descr", "", "message_location_id");
+
+ for (int i=0; i < messageLocations.size(); i++) {
+ Lookup location = (Lookup)messageLocations.get(i);
+ String locationId = location.getValue();
+
+ broadcastMessages.put(locationId, getPersistedBroadcastMessages(locationId));
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public HashMap getBcModel(HttpServletRequest request){
+ HashMap bcModel = new HashMap();
+
+ List items = null;
+ int messageId = ServletRequestUtils.getIntParameter(request, "message_id", 0);
+ String task = ServletRequestUtils.getStringParameter(request, "task", "get");
+
+ // delete or toggle activation on the selected record (if applicable)
+ if (messageId != 0 && (task.equals("delete") || task.equals("toggleActive"))) {
+ BroadcastMessage message = (BroadcastMessage)getDataAccessService().getDomainObject(BroadcastMessage.class, new Long(messageId), null);
+
+ if (task.equals("delete")) {
+ getDataAccessService().deleteDomainObject(message, null);
+ }
+ else if (task.equals("toggleActive")) {
+ HashMap additionalParams = new HashMap();
+ additionalParams.put(Parameters.PARAM_HTTP_REQUEST, request);
+
+ message.setActive(new Boolean(!message.getActive().booleanValue()));
+ getDataAccessService().saveDomainObject(message, additionalParams);
+ }
+ loadMessages();
+ }
+
+ items = getDataAccessService().getList(BroadcastMessage.class, null);
+ Collections.sort(items);
+ bcModel.put("messagesList", packageMessages(items));
+
+ List locations = AppUtils.getLookupList("fn_lu_message_location", "message_location_id", "message_location_descr", "", "message_location_id");
+ bcModel.put("messageLocations", locations);
+
+ if ("true".equals(SystemProperties.getProperty(SystemProperties.CLUSTERED))) {
+ List sites = AppUtils.getLookupList("fn_lu_broadcast_site", "broadcast_site_cd", "broadcast_site_descr", "", "broadcast_site_descr");
+ bcModel.put("broadcastSites", sites);
+ }
+
+ return bcModel;
+ }
+
+ @SuppressWarnings("unchecked")
+ private HashMap packageMessages(List messages) {
+ HashMap messagesList = new HashMap();
+ Set locationMessages = null;
+
+ Integer previousLocationId = null;
+
+ for (int i=0; i < messages.size(); i++) {
+ BroadcastMessage message = (BroadcastMessage)messages.get(i);
+
+ if (!message.getLocationId().equals(previousLocationId)) {
+ if (previousLocationId != null) {
+ messagesList.put(previousLocationId.toString(), locationMessages);
+ }
+
+ locationMessages = new TreeSet();
+ previousLocationId = message.getLocationId();
+ }
+
+ locationMessages.add(message);
+ }
+
+ if (previousLocationId != null) {
+ messagesList.put(previousLocationId.toString(), locationMessages);
+ }
+
+ return messagesList;
+ }
+
+
+ @SuppressWarnings("unchecked")
+ private List getPersistedBroadcastMessages(String locationId) {
+
+ HashMap params = new HashMap();
+ params.put("location_id", new Integer(locationId));
+ Calendar calInstanceToday = Calendar.getInstance();
+ calInstanceToday.set(Calendar.HOUR, 0);
+ calInstanceToday.set(Calendar.MINUTE, 0);
+ calInstanceToday.set(Calendar.SECOND, 0);
+ params.put("today_date", calInstanceToday.getTime());
+
+ return getDataAccessService().executeNamedQuery("broadcastMessages", params, null);
+ }
+
+ public Hashtable getBroadcastMessages() {
+ return broadcastMessages;
+ }
+
+ public static List getBroadcastMessages(String locationId) {
+ return (List)broadcastMessages.get(locationId);
+ }
+
+ public static String displayMessages(String locationId) {
+ return displayServerMessages(locationId, null);
+ }
+
+ public static String displayServerMessages(String locationId, String siteCd) {
+ StringBuffer html = new StringBuffer();
+
+ List messages = getBroadcastMessages(locationId);
+
+ for (int i=0; i < messages.size(); i++) {
+ BroadcastMessage message = (BroadcastMessage)messages.get(i);
+
+ if ((message.getSiteCd() == null) || ((message.getSiteCd() != null) && message.getSiteCd().equals(siteCd))) {
+ html.append("<li class=\"broadcastMessage\">")
+ .append(message.getMessageText());
+ }
+ }
+
+ if (html.length() > 0) {
+ html.insert(0, "<ul class=\"broadcastMessageList\">");
+ html.append("</ul>");
+ }
+
+ return html.toString();
+ }
+
+ public static boolean hasMessages(String locationId) {
+ return hasServerMessages(locationId, null);
+ }
+
+ public static boolean hasServerMessages(String locationId, String siteCd) {
+ List messages = getBroadcastMessages(locationId);
+
+ boolean messagesExist = !((messages == null) || messages.size() == 0);
+
+ if (siteCd == null) {
+ return messagesExist;
+ }
+ else {
+ for (int i=0; i < messages.size(); i++) {
+ BroadcastMessage message = (BroadcastMessage)messages.get(i);
+
+ if ((message.getSiteCd() == null) || message.getSiteCd().equals(siteCd)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ public BroadcastMessage getBroadcastMessage(HttpServletRequest request) {
+ long messageId = ServletRequestUtils.getLongParameter(request, "message_id", 0);
+
+ BroadcastMessage message = new BroadcastMessage();
+ if(messageId!=0)
+ message = (BroadcastMessage)getDataAccessService().getDomainObject(BroadcastMessage.class, new Long(messageId), null);
+
+ if (message.getLocationId() == null) {
+ try {
+ message.setLocationId(new Integer(ServletRequestUtils.getStringParameter(request, "message_location_id")));
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ } catch (ServletRequestBindingException e) {
+ e.printStackTrace();
+ }
+ message.setActive(Boolean.TRUE);
+ }
+
+ return message;
+ }
+
+ @Override
+ public void saveBroadcastMessage(BroadcastMessage broadcastMessage) {
+ dataAccessService.saveDomainObject(broadcastMessage, null);
+ }
+
+ @Override
+ public void removeBroadcastMessage(BroadcastMessage broadcastMessage) {
+ dataAccessService.deleteDomainObject(broadcastMessage, null);
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessService.java
new file mode 100644
index 00000000..26892b88
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessService.java
@@ -0,0 +1,80 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hibernate.FetchMode;
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.ProjectionList;
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+@SuppressWarnings("rawtypes")
+public interface DataAccessService {
+
+ // generic view, save, delete methods
+ DomainVo getDomainObject(Class domainClass, Serializable id, HashMap additionalParams);
+ void deleteDomainObject(DomainVo domainObject, HashMap additionalParams);
+ void deleteDomainObjects(Class domainClass, String whereClause, HashMap additionalParams);
+ void saveDomainObject(DomainVo domainObject, HashMap additionalParams);
+
+ // generic get list method(s)
+ List getList(Class domainClass, HashMap additionalParams);
+ List getList(Class domainClass, String filter, String orderBy, HashMap additionalParams);
+ List getList(Class domainClass, String filter, int fromIndex, int toIndex, String orderBy, HashMap additionalParams);
+ List<?> getList(Class<?> domainClass, ProjectionList projectionsList , List<Criterion> restrictionsList , List<Order> orderByList);
+ public List<?> getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList, List<Order> orderByList,HashMap<String,FetchMode> fetchModeMap);
+
+ List getLookupList(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy, HashMap additionalParams);
+
+ // generic native-SQL execution methods
+ List executeSQLQuery(String sql, Class domainClass, HashMap additionalParams);
+ List executeSQLQuery(String sql, Class domainClass, Integer fromIndex, Integer toIndex,HashMap additionalParams);
+
+ // generic HQL execution methods
+ List executeQuery(String hql, HashMap additionalParams);
+ List executeQuery(String hql, Integer fromIndex, Integer toIndex, HashMap additionalParams);
+
+ // generic named query execution methods
+ List executeNamedQuery(String queryName, Integer fromIndex, Integer toIndex, HashMap additionalParams);
+ List executeNamedQuery(String queryName, Map params, HashMap additionalParams);
+ List executeNamedQuery(String queryName, Map params, Integer fromIndex, Integer toIndex, HashMap additionalParams);
+
+ //with Where Clause for RAPTOR ZK
+ List executeNamedQueryWithOrderBy(Class entity, String queryName, Map params, String _orderBy, boolean asc, Integer fromIndex, Integer toIndex, HashMap additionalParams);
+ List executeNamedCountQuery(Class entity, String queryName, String whereClause, Map params);
+ List executeNamedQuery(Class entity, String queryName, String whereClause, Map params, Integer fromIndex, Integer toIndex, HashMap additionalParams);
+ List executeNamedQueryWithOrderBy(Class entity, String queryName, String whereClause, Map params, String _orderBy, boolean asc, Integer fromIndex, Integer toIndex, HashMap additionalParams);
+
+ // generic update query execution method
+ int executeUpdateQuery(String sql, HashMap additionalParams) throws RuntimeException;
+
+ // generic named update query execution method
+ int executeNamedUpdateQuery(String queryName, Map params, HashMap additionalParams) throws RuntimeException;
+
+ // synchronizes the local updates with the database (and vice versa)
+ void synchronize(HashMap additionalParams);
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessServiceImpl.java
new file mode 100644
index 00000000..a4644b72
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessServiceImpl.java
@@ -0,0 +1,592 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.hibernate.Criteria;
+import org.hibernate.FetchMode;
+import org.hibernate.Query;
+import org.hibernate.SQLQuery;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.ProjectionList;
+import org.openecomp.portalsdk.core.domain.Lookup;
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.support.FusionService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Provides implementations of methods in {@link DataAccessService}.
+ */
+@Transactional
+public class DataAccessServiceImpl extends FusionService implements DataAccessService {
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(DataAccessServiceImpl.class);
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#getDomainObject(java.lang.
+ * Class, java.io.Serializable, java.util.HashMap)
+ */
+ @Override
+ public DomainVo getDomainObject(Class domainClass, Serializable id, HashMap additionalParams) {
+ DomainVo vo = null;
+ Session session = sessionFactory.getCurrentSession();
+ logger.info(EELFLoggerDelegate.debugLogger, "Getting " + domainClass.getName() + " record for id - " + id.toString());
+ vo = (DomainVo) session.get(domainClass, id);
+
+ if (vo == null) {
+ try {
+ vo = (DomainVo) domainClass.newInstance();
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "An error occured while instantiating a class of " + domainClass.getName() + e.getMessage());
+ }
+ }
+ return vo;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ */
+ @Override
+ public void deleteDomainObject(DomainVo domainObject, HashMap additionalParams) {
+ Session session = sessionFactory.getCurrentSession();
+ session.delete(domainObject);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#deleteDomainObjects(java.
+ * lang.Class, java.lang.String, java.util.HashMap)
+ */
+ @Override
+ public void deleteDomainObjects(Class domainClass, String whereClause, HashMap additionalParams) {
+ Session session = sessionFactory.getCurrentSession();
+
+ StringBuffer sql = new StringBuffer("delete from ");
+
+ sql.append(domainClass.getName()).append(" where ").append(whereClause);
+
+ session.createQuery(sql.toString()).executeUpdate();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#saveDomainObject
+ */
+ @Override
+ public void saveDomainObject(DomainVo vo, HashMap additionalParams) {
+ Integer userId = 1;
+ if (additionalParams != null) {
+ // look for a passed user id
+ // userId = (Integer)additionalParams.get(Parameters.PARAM_USERID);
+ Object uid = additionalParams.get(Parameters.PARAM_USERID);
+ if (uid instanceof Integer) {
+ userId = (Integer) uid;
+ } else if (uid instanceof Long) {
+ userId = ((Long) uid).intValue();
+ }
+ // if (userId == null) {
+ // look for a passed request to get the user id from
+ // userId = new
+ // Integer(UserUtils.getUserId((HttpServletRequest)additionalParams.get(Parameters.PARAM_HTTP_REQUEST)));
+ // }
+ }
+ _update(vo, userId);
+ }
+
+ /**
+ * Creates or updates the specified virtual object. Uses the specified user
+ * ID as the creator and modifier if a new object is created; uses ID only
+ * as modifier if an object already exists.
+ *
+ * @param vo
+ * @param userId
+ * Ignored if value is zero.
+ */
+ protected final void _update(DomainVo vo, int userId) {
+ Date timestamp = new Date();
+
+ Session session = sessionFactory.getCurrentSession();
+
+ if (vo.getId() == null || vo.getId().intValue() == 0) { // add new
+ vo.setCreated(timestamp);
+ vo.setModified(timestamp);
+
+ if (userId != 0
+ && userId != Integer.parseInt(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID))) {
+ vo.setCreatedId(new Long(userId));
+ vo.setModifiedId(new Long(userId));
+ }
+ } else { // update existing
+ vo.setModified(timestamp);
+
+ if (userId != 0
+ && userId != Integer.parseInt(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID))) {
+ vo.setModifiedId(new Long(userId));
+ }
+ }
+
+ session.saveOrUpdate(vo);
+ }
+
+ /**
+ * generic get list method
+ *
+ * @param domainClass
+ * @param filterClause
+ * @param fromIndex
+ * @param toIndex
+ * @param orderBy
+ * @return
+ */
+ private List getListCommon(Class domainClass, String filterClause, Integer fromIndex, Integer toIndex,
+ String orderBy) {
+ List list = null;
+ String className = domainClass.getName();
+ Session session = sessionFactory.getCurrentSession();
+
+ if (logger.isInfoEnabled()) {
+ logger.info(EELFLoggerDelegate.debugLogger, "Getting " + className.toLowerCase() + " records"
+ + ((fromIndex != null) ? " from rows " + fromIndex.toString() + " to " + toIndex.toString() : "")
+ + "...");
+ if (filterClause != null && filterClause.length() > 0)
+ logger.info(EELFLoggerDelegate.debugLogger, "Filtering " + className + " by: " + filterClause);
+ }
+
+ list = session.createQuery("from " + className + Utilities.nvl(filterClause, "")
+ + ((orderBy != null) ? " order by " + orderBy : "")).list();
+ list = (fromIndex != null) ? list.subList(fromIndex.intValue() - 1, toIndex.intValue()) : list;
+
+ if (orderBy == null && list != null)
+ Collections.sort(list);
+
+ return list;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class,
+ * java.util.HashMap)
+ */
+ @Override
+ public List getList(Class domainClass, HashMap additionalParams) {
+ return getListCommon(domainClass, null, null, null, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class,
+ * java.lang.String, java.lang.String, java.util.HashMap)
+ */
+ @Override
+ public List getList(Class domainClass, String filter, String orderBy, HashMap additionalParams) {
+ return getListCommon(domainClass, filter, null, null, orderBy);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class,
+ * java.lang.String, int, int, java.lang.String, java.util.HashMap)
+ */
+ @Override
+ public List getList(Class domainClass, String filter, int fromIndex, int toIndex, String orderBy,
+ HashMap additionalParams) {
+ return getListCommon(domainClass, filter, new Integer(fromIndex), new Integer(toIndex), orderBy);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class,
+ * org.hibernate.criterion.ProjectionList, java.util.List, java.util.List)
+ */
+ @Override
+ public List<?> getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList,
+ List<Order> orderByList) {
+
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria(domainClass);
+
+ if (projectionsList != null) {
+ criteria.setProjection(projectionsList);
+ }
+
+ if (restrictionsList != null && !restrictionsList.isEmpty()) {
+ for (Criterion criterion : restrictionsList)
+ criteria.add(criterion);
+ }
+
+ if (orderByList != null && !orderByList.isEmpty()) {
+ for (Order order : orderByList)
+ criteria.addOrder(order);
+ }
+ /*
+ * if(fetchModeMap!=null){ Iterator<String> itr =
+ * fetchModeMap.keySet().iterator(); String key=null;
+ * while(itr.hasNext()){ key = itr.next();
+ * criteria.setFetchMode(key,fetchModeMap.get(key)); } }
+ */
+ return criteria.list();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#getLookupList(java.lang.
+ * String, java.lang.String, java.lang.String, java.lang.String,
+ * java.lang.String, java.util.HashMap)
+ */
+ @Override
+ public List getLookupList(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy,
+ HashMap additionalParams) {
+ if (logger.isInfoEnabled())
+ logger.info(EELFLoggerDelegate.debugLogger, "Retrieving " + dbTable + " lookup list...");
+ String dbOrderByCol = dbOrderBy;
+
+ Session session = sessionFactory.getCurrentSession();
+
+ // default the orderBy if null;
+ if (Utilities.nvl(dbOrderBy).length() == 0) {
+ dbOrderByCol = dbLabelCol;
+ dbOrderBy = dbLabelCol;
+ } else {
+ if (dbOrderBy.lastIndexOf(" ") > -1) {
+ dbOrderByCol = dbOrderBy.substring(0, dbOrderBy.lastIndexOf(" "));
+ }
+ }
+
+ StringBuffer sql = new StringBuffer();
+
+ sql.append("select distinct ").append(dbLabelCol).append(" as lab, ").append(dbValueCol).append(" as val, ")
+ .append(dbOrderByCol).append(" as sortOrder ").append("from ").append(dbTable).append(" ")
+ .append((Utilities.nvl(dbFilter).length() == 0) ? "" : (" where " + dbFilter)).append(" order by ")
+ .append(dbOrderBy);
+
+ List list = null;
+ try {
+ list = session.createSQLQuery(sql.toString()).addEntity(Lookup.class).list();
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, "Failed to create SQL lookup query for [" + sql + "]" + e.getMessage());
+ }
+ return list;
+ }
+
+ /*
+ * methods accepting a Map of additional params to passed to the DAO (for
+ * extensibility, just in case)
+ */
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#executeSQLQuery(java.lang.
+ * String, java.lang.Class, java.util.HashMap)
+ */
+ @Override
+ public List executeSQLQuery(String sql, Class domainClass, HashMap additionalParams) {
+ return executeSQLQuery(sql, domainClass, null, null, additionalParams);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#executeSQLQuery(java.lang.
+ * String, java.lang.Class, java.lang.Integer, java.lang.Integer,
+ * java.util.HashMap)
+ */
+ @Override
+ public List executeSQLQuery(String sql, Class domainClass, Integer fromIndex, Integer toIndex,
+ HashMap additionalParams) {
+ Session session = sessionFactory.getCurrentSession();
+
+ SQLQuery query = session.createSQLQuery(sql).addEntity(domainClass.getName().toLowerCase(), domainClass);
+
+ if (fromIndex != null && toIndex != null) {
+ query.setFirstResult(fromIndex.intValue());
+ int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1;
+ query.setMaxResults(pageSize);
+ }
+
+ return query.list();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#executeQuery(java.lang.
+ * String, java.util.HashMap)
+ */
+ @Override
+ public List executeQuery(String sql, HashMap additionalParams) {
+ return executeQuery(sql, null, null, additionalParams);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#executeQuery(java.lang.
+ * String, java.lang.Integer, java.lang.Integer, java.util.HashMap)
+ */
+ @Override
+ public List executeQuery(String sql, Integer fromIndex, Integer toIndex, HashMap additionalParams) {
+ Session session = sessionFactory.getCurrentSession();
+
+ Query query = session.createQuery(sql);
+
+ if (fromIndex != null && toIndex != null) {
+ query.setFirstResult(fromIndex.intValue());
+ int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1;
+ query.setMaxResults(pageSize);
+ }
+
+ return query.list();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedQuery(java.lang
+ * .String, java.lang.Integer, java.lang.Integer, java.util.HashMap)
+ */
+ @Override
+ public List executeNamedQuery(String queryName, Integer fromIndex, Integer toIndex, HashMap additionalParams) {
+ return executeNamedQuery(queryName, null, fromIndex, toIndex, additionalParams);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedQuery(java.lang
+ * .String, java.util.Map, java.util.HashMap)
+ */
+ @Override
+ public List executeNamedQuery(String queryName, Map params, HashMap additionalParams) {
+ return executeNamedQuery(queryName, params, null, null, additionalParams);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedQuery(java.lang
+ * .String, java.util.Map, java.lang.Integer, java.lang.Integer,
+ * java.util.HashMap)
+ */
+ @Override
+ public List executeNamedQuery(String queryName, Map params, Integer fromIndex, Integer toIndex,
+ HashMap additionalParams) {
+ Session session = sessionFactory.getCurrentSession();
+ Query query = session.getNamedQuery(queryName);
+ bindQueryParameters(query, params);
+ if (fromIndex != null && toIndex != null) {
+ query.setFirstResult(fromIndex.intValue());
+ int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1;
+ query.setMaxResults(pageSize);
+ }
+ return query.list();
+ }
+
+ /**
+ * Stores parameters into the query using String keys from the map. Gives
+ * special treatment to map values of Collection and array type.
+ *
+ * @param query
+ * Query with parameters
+ * @param params
+ * Map of String to Object.
+ */
+ private void bindQueryParameters(Query query, Map params) {
+ if (params != null) {
+ for (Iterator i = params.entrySet().iterator(); i.hasNext();) {
+ Map.Entry entry = (Map.Entry) i.next();
+
+ Object parameterValue = entry.getValue();
+
+ if (!(parameterValue instanceof Collection) && !(parameterValue instanceof Object[])) {
+ query.setParameter((String) entry.getKey(), parameterValue);
+ } else if (parameterValue instanceof Collection) {
+ query.setParameterList((String) entry.getKey(), (Collection) parameterValue);
+ } else if (parameterValue instanceof Object[]) {
+ query.setParameterList((String) entry.getKey(), (Object[]) parameterValue);
+ }
+ }
+ }
+ }
+
+ // With Where Clause & RAPTOR's ZK
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.openecomp.portalsdk.core.service.DataAccessService#
+ * executeNamedQueryWithOrderBy(java.lang.Class, java.lang.String,
+ * java.util.Map, java.lang.String, boolean, java.lang.Integer,
+ * java.lang.Integer, java.util.HashMap)
+ */
+ @Override
+ public List executeNamedQueryWithOrderBy(Class entity, String queryName, Map params, String _orderBy, boolean asc,
+ Integer fromIndex, Integer toIndex, HashMap additionalParams) {
+ // TODO Auto-generated method stub
+ logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedCountQuery(java
+ * .lang.Class, java.lang.String, java.lang.String, java.util.Map)
+ */
+ @Override
+ public List executeNamedCountQuery(Class entity, String queryName, String whereClause, Map params) {
+ // TODO Auto-generated method stub
+ logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedQuery(java.lang
+ * .Class, java.lang.String, java.lang.String, java.util.Map,
+ * java.lang.Integer, java.lang.Integer, java.util.HashMap)
+ */
+ @Override
+ public List executeNamedQuery(Class entity, String queryName, String whereClause, Map params, Integer fromIndex,
+ Integer toIndex, HashMap additionalParams) {
+ // TODO Auto-generated method stub
+ logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.openecomp.portalsdk.core.service.DataAccessService#
+ * executeNamedQueryWithOrderBy(java.lang.Class, java.lang.String,
+ * java.lang.String, java.util.Map, java.lang.String, boolean,
+ * java.lang.Integer, java.lang.Integer, java.util.HashMap)
+ */
+ @Override
+ public List executeNamedQueryWithOrderBy(Class entity, String queryName, String whereClause, Map params,
+ String _orderBy, boolean asc, Integer fromIndex, Integer toIndex, HashMap additionalParams) {
+ // TODO Auto-generated method stub
+ logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class,
+ * org.hibernate.criterion.ProjectionList, java.util.List, java.util.List,
+ * java.util.HashMap)
+ */
+ @Override
+ public List<?> getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList,
+ List<Order> orderByList, HashMap<String, FetchMode> fetchModeMap) {
+ // TODO Auto-generated method stub
+ logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#executeUpdateQuery(java.
+ * lang.String, java.util.HashMap)
+ */
+ @Override
+ public int executeUpdateQuery(String sql, HashMap additionalParams) throws RuntimeException {
+ // TODO Auto-generated method stub
+ logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedUpdateQuery(
+ * java.lang.String, java.util.Map, java.util.HashMap)
+ */
+ @Override
+ public int executeNamedUpdateQuery(String queryName, Map params, HashMap additionalParams) throws RuntimeException {
+ // TODO Auto-generated method stub
+ logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.openecomp.portalsdk.core.service.DataAccessService#synchronize(java.util.
+ * HashMap)
+ */
+ @Override
+ public void synchronize(HashMap additionalParams) {
+ // TODO Auto-generated method stub
+ logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java
new file mode 100644
index 00000000..948b635f
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java
@@ -0,0 +1,269 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.util.YamlUtils;
+
+
+
+public class ElementLinkService {
+
+
+ public String main1(String[] args) throws Exception{
+ String filePath;
+ if(args[0].startsWith("custom")){
+ filePath = SystemProperties.getProperty("customCallFlow_path");
+ }else{
+ filePath = SystemProperties.getProperty("element_map_file_path") + File.separator;
+ }
+
+ String callFlowBusinessYml = "";
+ String callFlowStep = "";
+
+ if(args != null && args.length > 0 ) {
+
+ if( args[0] != null) {
+ callFlowBusinessYml = args[0] + ".yml";
+ }
+
+ if( args[1] != null) {
+ callFlowStep = args[1];
+ }
+ }
+
+
+ ElementLinkService mapper = new ElementLinkService();
+
+ return mapper.createLinkFile(filePath, callFlowBusinessYml, callFlowStep);
+ }
+
+ public String main2(String[] args) throws Exception{
+
+ String filePath = SystemProperties.getProperty("element_map_file_path") + File.separator;
+ String callFlowBusinessYml = "";
+ String callFlowStep = "";
+
+ if(args != null && args.length > 0 ) {
+
+ if( args[0] != null) {
+ callFlowBusinessYml = args[0] + "-Override.yml";
+ }
+
+ if( args[1] != null) {
+ callFlowStep = args[1];
+ }
+ }
+
+
+ ElementLinkService mapper = new ElementLinkService();
+
+ return mapper.createLinkFileAdditional(filePath, callFlowBusinessYml, callFlowStep);
+ }
+
+
+ public static void main(String[] args) throws Exception{
+
+ String filePath = "C:\\Users\\statta\\git\\D2Platform\\war\\WEB-INF\\resources\\trisim_files";
+ String callFlowBusinessYml = "call_flow_hc-origination-termination-to-volteue-3.3.16-Override.yml";
+
+
+ ElementLinkService mapper = new ElementLinkService();
+ System.out.print(mapper.createLinkFileAdditional(filePath, callFlowBusinessYml, "Step_2"));
+ }
+
+ @SuppressWarnings("unchecked")
+ protected String createLinkFile(String resourceFilePath, String callFLowBsFileName, String callFlowStep) throws Exception {
+
+ Map<String, Object> callFlowBs = YamlUtils.readYamlFile(resourceFilePath, callFLowBsFileName);
+
+ List<Map<String,Object>> callSteps = (List<Map<String,Object>>) callFlowBs.get("callSequenceSteps");
+ String callFlowName = (String) callFlowBs.get("shortName");
+ return addLinks( resourceFilePath, callFlowName, callSteps, callFlowStep);
+
+
+ }
+
+ @SuppressWarnings("unchecked")
+ protected String createLinkFileAdditional(String resourceFilePath, String callFLowBsFileName, String callFlowStep) throws Exception {
+
+ Map<String, Object> callFlowBs;
+
+ try{
+ callFlowBs = YamlUtils.readYamlFile(resourceFilePath, callFLowBsFileName);
+
+ List<Map<String,Object>> callSteps = (List<Map<String,Object>>) callFlowBs.get("callSequenceSteps");
+ String callFlowName = (String) callFlowBs.get("shortName");
+ return addLinksAdditional( resourceFilePath, callFlowName, callSteps, callFlowStep);
+
+ } catch (Exception e) {
+
+ return "";
+ }
+
+
+ }
+
+ @SuppressWarnings("unchecked")
+ protected String addLinks(String filePath, String callFlowName,
+ List<Map<String, Object>> callSteps, String callFlowStep) throws IOException {
+
+ Map<String,List<String>> checkDuplicateMap = new HashMap<String,List<String>>();
+
+ for(Map<String,Object> callStep : callSteps) {
+
+ if(((String)callStep.get("name")).split(":")[0].trim().replace(" ", "_").equals(callFlowStep)) {
+
+ List<Map<String,Object>> links = new ArrayList<Map<String,Object>>();
+
+ List<Map<String,Object>> subSteps = (List<Map<String,Object>>)callStep.get("subSteps");
+
+ for(Map<String,Object> subStep : subSteps) {
+ Map<String,Object> link = new HashMap<String,Object>();
+
+ String source = (String) subStep.get("source_tosca_id");
+ String destination = (String) subStep.get("destination_tosca_id");
+
+ if((checkDuplicateMap.get(source) == null || checkDuplicateMap.get(source).isEmpty() || !checkDuplicateMap.get(source).contains(destination)) && !source.equals(destination)) {
+ if(checkDuplicateMap.get(destination) == null) {
+ List<String> toscaList = new ArrayList<String>();
+ checkDuplicateMap.put(destination, toscaList);
+ }
+
+ if(checkDuplicateMap.get(source) == null) {
+ List<String> toscaList = new ArrayList<String>();
+ checkDuplicateMap.put(source, toscaList);
+ }
+
+
+ List<String> toscaSourceList = checkDuplicateMap.get(destination);
+ toscaSourceList.add(source);
+
+ List<String> toscaDestinationList = checkDuplicateMap.get(source);
+ toscaDestinationList.add(destination);
+
+ link.put("s", source);
+ link.put("d", destination);
+ links.add(link);
+
+ }
+
+ }
+
+ Map<String,Object> callFlowUI = new HashMap<String,Object>();
+ callFlowUI.put("linkList", links);
+
+ return YamlUtils.returnYaml(callFlowUI);
+
+ }
+
+
+ }
+ return "";
+ }
+
+ protected String addLinksAdditional(String filePath, String callFlowName,
+ List<Map<String, Object>> callSteps, String callFlowStep) throws IOException {
+
+
+ for(Map<String,Object> callStep : callSteps) {
+
+ if(((String)callStep.get("name")).split(":")[0].trim().replace(" ", "_").equals(callFlowStep)) {
+
+ Map<String,Object> callFlowUI = new HashMap<String,Object>();
+ try{
+ List<Map<String, Object>> links = addLinkVertices(callStep);
+ callFlowUI.put("linkList", links); }
+ catch(Exception e) {}
+ try{
+ List<String> activeIds = addActiveNodes(callStep);
+ callFlowUI.put("activeIds", activeIds);}
+ catch(Exception e) {}
+ try{
+ List<Map<String, Object>> disconnectLinks = addDisconnectLinks(callStep);
+ callFlowUI.put("disconnectLinks", disconnectLinks); }
+ catch(Exception e) {}
+
+ return YamlUtils.returnYaml(callFlowUI);
+ }
+ }
+
+ return "";
+ }
+
+ @SuppressWarnings("unchecked")
+ List<String> addActiveNodes(Map<String, Object> callStep) {
+
+ List<String> activeIds = (List<String>)callStep.get("activeIds");
+
+ return activeIds;
+ }
+
+ @SuppressWarnings("unchecked")
+ List<Map<String,Object>> addDisconnectLinks(Map<String, Object> callStep) {
+
+ List<Map<String,Object>> disconnectLinks = (List<Map<String,Object>>)callStep.get("disconnectLinks");
+
+ return disconnectLinks;
+ }
+
+ @SuppressWarnings("unchecked")
+ List<Map<String, Object>> addLinkVertices(Map<String, Object> callStep) {
+ List<Map<String,Object>> links = new ArrayList<Map<String,Object>>();
+
+ List<Map<String,Object>> vertices = (List<Map<String,Object>>)callStep.get("vertices");
+
+ for(int i=0; i< vertices.size()-1;i++) {
+ Map<String,Object> vertex = (Map<String,Object>) vertices.get(i);
+ Map<String,Object> vertexNext = (Map<String,Object>) vertices.get(i+1);
+
+ Integer sourceX = (Integer) vertex.get("x");
+ Integer sourceY = (Integer) vertex.get("y");
+ String sourceD = (String) vertex.get("D");
+ String sourceL = (vertex.get("L") != null) ? (String) vertex.get("L") : "-";
+
+ if(sourceX == -999) // there is a break in the linkage
+ continue;
+
+ Integer destinationX = (Integer) vertexNext.get("x");
+ Integer destinationY = (Integer) vertexNext.get("y");
+ String destinationD = (String) vertexNext.get("D");
+
+ if(destinationX == -999) // there is a break in the linkage
+ continue;
+
+ Map<String,Object> link = new HashMap<String,Object>();
+
+ link.put("s", sourceX + "," + sourceY +","+sourceD + "," + sourceL);
+ link.put("d", destinationX + "," + destinationY +"," + destinationD);
+ links.add(link);
+ }
+ return links;
+ }
+}
+
+
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementMapService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementMapService.java
new file mode 100644
index 00000000..d88213f3
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementMapService.java
@@ -0,0 +1,915 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.commons.lang.StringUtils;
+import org.openecomp.portalsdk.core.domain.support.Container;
+import org.openecomp.portalsdk.core.domain.support.Domain;
+import org.openecomp.portalsdk.core.domain.support.Element;
+import org.openecomp.portalsdk.core.domain.support.ElementDetails;
+import org.openecomp.portalsdk.core.domain.support.Layout;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.util.YamlUtils;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.nodes.Tag;
+import org.yaml.snakeyaml.representer.Representer;
+
+public class ElementMapService {
+
+ public String convertToYAML(Layout layout) throws Exception{
+ Map<String,Domain> resultDomain= layout.domainRowCol;
+ Map<String,List<Domain>> domainMap = new HashMap<String, List<Domain>>();
+ List<Domain> domainList = new ArrayList<Domain>();
+ String pathToImg = SystemProperties.getProperty("element_map_icon_path"); //"static/img/map/icons/";
+ for (Domain d : resultDomain.values()) {
+
+ d.setWidth(10*d.computeSize().getWidth());
+ d.setHeight(10*d.computeSize().getHeight());
+ d.setLeft(10*d.getP().getX());
+ d.setTop(10*d.getP().getY());
+
+
+ List<Container> containerList = new ArrayList<Container>();
+ for (Container c : d.getContainerRowCol().values()) {
+ c.setWidth(10*c.computeSize().getWidth());
+ c.setHeight(10*c.computeSize().getHeight());
+ c.setLeft(10*c.getP().getX());
+ c.setTop(10*c.getP().getY());
+ Element ue = (Element)c.getElementRowCol().values().toArray()[0];
+ if (ue.getName().equals("ue1") || ue.getName().equals("ue2") || ue.getName().equals("ue3") ||
+ ue.getName().equals("ue4") || ue.getName().equals("ue5") || ue.getName().equals("ue6")) {
+ c.setVisibilityType("invisible");
+ }
+
+ if (c.getContainerRowCol() != null) {
+ List<Container> innerContainerList = new ArrayList<Container>();
+ for (Container innerC : c.getContainerRowCol().values()) {
+ innerC.setName(innerC.getName());
+ innerC.setWidth(10*innerC.computeSize().getWidth());
+ innerC.setHeight(10*innerC.computeSize().getHeight());
+ innerC.setLeft(10*innerC.getP().getX());
+ innerC.setTop(10*innerC.getP().getY());
+
+ if (innerC.getElementRowCol() != null) {
+ List<Element> innerContainerEList = new ArrayList<Element>();
+ for (Element ele : innerC.getElementRowCol().values()) {
+ ele.setWidth(10*ele.computeSize().getWidth());
+ ele.setHeight(10*ele.computeSize().getHeight());
+ ele.setLeft(10*ele.getP().getX());
+ ele.setTop(10*ele.getP().getY()-10);
+ ele.setImgFileName(pathToImg+ele.getImgFileName());
+ if (ele.getBorderType().equals("V"))
+ ele.setBorderType("dashed");
+ else
+ ele.setBorderType("solid");
+
+ innerContainerEList.add(ele);
+ }
+ innerC.setElementList(innerContainerEList);
+ }
+ innerContainerList.add(innerC);
+ }
+ c.setInnerCList(innerContainerList);
+ }
+
+ if (c.getElementRowCol() != null) {
+ List<Element> elementList = new ArrayList<Element>();
+ for (Element e : c.getElementRowCol().values()) {
+ e.setWidth(10*e.computeSize().getWidth());
+ e.setHeight(10*e.computeSize().getHeight());
+ e.setLeft(10*e.getP().getX());
+ e.setTop(10*e.getP().getY()-10);
+ e.setImgFileName(pathToImg+e.getImgFileName());
+
+ if (e.getBorderType().equals("V"))
+ e.setBorderType("dashed");
+ else
+ e.setBorderType("solid");
+
+ if (e.getName().equals("ue1") || e.getName().equals("ue2") || e.getName().equals("ue3")
+ || e.getName().equals("ue4") || e.getName().equals("ue5") || e.getName().equals("ue6"))
+ e.setBgColor("white");
+ elementList.add(e);
+ }
+ c.setElementList(elementList);
+ }
+ containerList.add(c);
+ }
+ d.setContainerList(containerList);
+ domainList.add(d);
+
+ }
+ domainMap.put("domainList", domainList);
+
+ List<Domain> collapsedDomains = new ArrayList<Domain>();
+
+ //nline
+ for (Domain collapsed : layout.getCollapsedDomainsNewList()) {
+ collapsed.setWidth(10*collapsed.computeSize().getWidth());
+ collapsed.setHeight(10*collapsed.computeSize().getHeight());
+ collapsed.setLeft(10*collapsed.getP().getX());
+ collapsed.setTop(10*collapsed.getP().getY());
+ //nline
+ collapsed.setNewXafterColl(10*collapsed.getNewXafterColl());
+ collapsed.setYafterColl(10*collapsed.getYafterColl());
+ collapsedDomains.add(collapsed);
+ }
+
+ domainMap.put("collapsedDomainList", collapsedDomains);
+
+ Representer representer = new Representer();
+ representer.addClassTag(Domain.class, Tag.MAP);
+
+
+ Yaml yaml = new Yaml(representer);
+ String output = yaml.dump(domainMap);
+
+ return output;
+
+}
+
+
+
+ public static HashMap<String, Object> toscaElementsMap = new HashMap<String, Object>();
+ public static HashMap<String,Element> elementMap = new HashMap<String, Element>();
+ public static HashMap<String,Element> miscElementMap = new HashMap<String, Element>();
+ public static HashMap<String,Container> outercontainers = new HashMap<String, Container>();
+ public static HashMap<String,Container> innercontainers = new HashMap<String, Container>();
+ public static HashMap<String,Domain> domainMap = new HashMap<String, Domain>();
+
+
+ static String filePath =
+ SystemProperties.getProperty("element_map_file_path") ;
+ static String callFlowBusinessYml = "call_flow_sip_digest.yml";
+ static String networkToscaYml = null;//"NetworkMap_topology_composition.yml";
+ static String networkLayoutYml = null;// "network_map_layout.yml";
+
+
+ @SuppressWarnings({ "unchecked", "unused" })
+ public String main1(String args[]) throws Exception{
+
+
+ if(args != null && args.length > 0 ) {
+
+ if( args[2] != null) {
+ networkToscaYml = args[2] + ".yml";
+ }
+
+ if( args[3] != null) {
+ networkLayoutYml = args[3] + ".yml";
+ }
+ }
+
+ HashMap<String, Object> toscaYaml = (HashMap<String, Object>)YamlUtils.readYamlFile(filePath, networkToscaYml); //TrinityYAMLHelper.getToscaYaml();
+ HashMap<String, Object> networkMapLayoutYaml = (HashMap<String, Object>)YamlUtils.readYamlFile(filePath, networkLayoutYml); //TrinityYAMLHelper.getNetworkMapLayoutYaml();
+
+ toscaElementsMap = new HashMap<String, Object>();
+ elementMap = new HashMap<String, Element>();
+ domainMap = new HashMap<String, Domain>();
+ outercontainers = new HashMap<String, Container>();
+ innercontainers = new HashMap<String, Container>();
+ miscElementMap = new HashMap<String, Element>();
+
+ if(toscaYaml != null){
+ for(String key : toscaYaml.keySet()){
+ if("topology_template".equalsIgnoreCase(key) && toscaYaml.get(key) instanceof HashMap){
+ HashMap<String, Object> toscaTopologyDetails = (HashMap<String, Object>) toscaYaml.get(key);
+
+ for(String detailsKey: toscaTopologyDetails.keySet()){
+
+ if("node_templates".equalsIgnoreCase(detailsKey) && toscaTopologyDetails.get(detailsKey) instanceof HashMap){
+
+ toscaElementsMap = (HashMap<String, Object>) toscaTopologyDetails.get(detailsKey);
+
+ for(String toscaElementKey: toscaElementsMap.keySet()){
+ }
+
+ }
+ }
+ }
+
+ }
+ }
+
+ if(networkMapLayoutYaml != null){
+ if(networkMapLayoutYaml.containsKey("toscaNetworkMapElementStyleList") && networkMapLayoutYaml.get("toscaNetworkMapElementStyleList") instanceof ArrayList){
+
+ ArrayList<Object> elementlist = (ArrayList<Object>)networkMapLayoutYaml.get("toscaNetworkMapElementStyleList");
+ String elementName;
+ String elementID;
+ String imgPath;
+ String row;
+ String column;
+ String mapKey;
+ int i=0;
+
+ if(elementlist != null){
+ for(Object eachElement: elementlist){
+ if(eachElement != null && eachElement instanceof HashMap){
+ HashMap<String, String> elementDetails = (HashMap<String, String>) eachElement;
+ if(elementDetails != null){
+ elementName = "NA"+i;
+ elementID = "NA"+i;
+ imgPath = "NA"+i;
+ row = "0";
+ column = "0";
+ for(String detailsKey: elementDetails.keySet()){
+ if ("tosca_id".equalsIgnoreCase(detailsKey)) elementName = elementDetails.get(detailsKey).toString();
+ if ("id".equalsIgnoreCase(detailsKey)) {
+ elementID = String.valueOf(elementDetails.get(detailsKey));
+ }
+ if ("row".equalsIgnoreCase(detailsKey)) {
+ row = String.valueOf(elementDetails.get(detailsKey));
+ }
+ if ("column".equalsIgnoreCase(detailsKey)) {
+ column = String.valueOf(elementDetails.get(detailsKey));
+ }
+ if ("icon".equalsIgnoreCase(detailsKey)) imgPath = elementDetails.get(detailsKey).toString();
+ }
+
+ if(elementMap.containsKey(elementName.concat("/").concat(row).concat(column))){
+ if(elementMap.containsKey(elementName.concat("/").concat(String.valueOf(i)).concat(String.valueOf(i)))){
+ mapKey = elementName;
+ } else mapKey = elementName.concat("/").concat(String.valueOf(i)).concat(String.valueOf(i));
+
+ } else mapKey = elementName.concat("/").concat(row).concat(column);
+
+ elementMap.put(mapKey, fetchElementObject(elementID,elementName,imgPath));
+ }
+ }
+ i++;
+ }
+ }
+
+ for(String elementkey : elementMap.keySet()){
+ Element c = (Element) elementMap.get(elementkey);
+ }
+
+ if(!elementMap.isEmpty()){
+ miscElementMap = new HashMap<String, Element>(elementMap);
+ }
+ }
+
+
+ if(networkMapLayoutYaml.containsKey("containerStyleList") && networkMapLayoutYaml.get("containerStyleList") instanceof ArrayList){
+
+ ArrayList<Object> containerstylelist = (ArrayList<Object>)networkMapLayoutYaml.get("containerStyleList");
+ String containerName;
+ String containerID;
+ String domain;
+ String row;
+ String column;
+ String mapKey;
+ int i=0;
+
+ if(containerstylelist != null){
+ //Inner Containers
+ for(Object eachContainer: containerstylelist){
+ if(eachContainer != null && eachContainer instanceof HashMap){
+ HashMap<String, String> containerDetails = (HashMap<String, String>) eachContainer;
+ if(containerDetails != null){
+ containerName = "NA"+i;
+ containerID = "NA"+i;
+ domain = "NA"+i;
+ row = "0";
+ column = "0";
+
+ for(String detailsKey: containerDetails.keySet()){
+ if ("logical_group_name".equalsIgnoreCase(detailsKey)) containerName = containerDetails.get(detailsKey).toString();
+ if ("id".equalsIgnoreCase(detailsKey)) {
+ containerID = String.valueOf(containerDetails.get(detailsKey));
+ }
+ if("domain".equalsIgnoreCase(detailsKey)){
+ domain = containerDetails.get(detailsKey).toString();
+ }
+ if ("row".equalsIgnoreCase(detailsKey)) {
+ row = String.valueOf(containerDetails.get(detailsKey));
+ }
+ if ("column".equalsIgnoreCase(detailsKey)) {
+ column = String.valueOf(containerDetails.get(detailsKey));
+ }
+ }
+ if(containerName.contains("/")){
+
+ if(innercontainers.containsKey((domain +":"+ containerName).concat("/").concat(row).concat(column))){
+ if(elementMap.containsKey((domain +":"+ containerName).concat("/").concat(String.valueOf(i)).concat(String.valueOf(i)))){
+ mapKey = (domain +":"+ containerName);
+ } else mapKey = (domain +":"+ containerName).concat("/").concat(String.valueOf(i)).concat(String.valueOf(i));
+
+ } else mapKey = (domain +":"+ containerName).concat("/").concat(row).concat(column);
+
+ innercontainers.put(mapKey, fetchContainerObject(containerID,containerName.substring(containerName.indexOf("/")+1),true,containerName,domain));
+ }
+ }
+ }
+ i++;
+ }
+
+ //OuterContainers
+ i=0;
+ for(Object eachContainer: containerstylelist){
+ if(eachContainer != null && eachContainer instanceof HashMap){
+ HashMap<String, String> containerDetails = (HashMap<String, String>) eachContainer;
+ if(containerDetails != null){
+ containerName = "NA"+i;
+ containerID = "NA"+i;
+ domain = "NA"+i;
+ row = "0";
+ column = "0";
+
+ for(String detailsKey: containerDetails.keySet()){
+ if ("logical_group_name".equalsIgnoreCase(detailsKey)) containerName = containerDetails.get(detailsKey).toString();
+ if ("id".equalsIgnoreCase(detailsKey)) {
+ containerID = String.valueOf(containerDetails.get(detailsKey));
+ }
+ if("domain".equalsIgnoreCase(detailsKey)){
+ domain = containerDetails.get(detailsKey).toString();
+ }
+ if ("row".equalsIgnoreCase(detailsKey)) {
+ row = String.valueOf(containerDetails.get(detailsKey));
+ }
+ if ("column".equalsIgnoreCase(detailsKey)) {
+ column = String.valueOf(containerDetails.get(detailsKey));
+ }
+ }
+ if(!containerName.contains("/")){
+ if(outercontainers.containsKey((domain +":"+ containerName).concat("/").concat(row).concat(column))){
+ if(outercontainers.containsKey((domain +":"+ containerName).concat("/").concat(String.valueOf(i)).concat(String.valueOf(i)))){
+ mapKey = (domain +":"+ containerName);
+ } else mapKey = (domain +":"+ containerName).concat("/").concat(String.valueOf(i)).concat(String.valueOf(i));
+
+ } else mapKey = (domain +":"+ containerName).concat("/").concat(row).concat(column);
+ outercontainers.put(mapKey, fetchContainerObject(containerID,containerName,false,containerName,domain));
+ }
+
+ }
+ }
+ i++;
+ }
+ }
+
+ for(String innerContainerkey : innercontainers.keySet()){
+ Container c = (Container) innercontainers.get(innerContainerkey);
+ }
+
+ for(String outerContainerkey : outercontainers.keySet()){
+ Container c = (Container) outercontainers.get(outerContainerkey);
+ }
+
+ }
+
+ if(networkMapLayoutYaml.containsKey("domainList") && networkMapLayoutYaml.get("domainList") instanceof ArrayList){
+
+ ArrayList<Object> domainlist = (ArrayList<Object>)networkMapLayoutYaml.get("domainList");
+ String domainName;
+ String domainID;
+ String row;
+ String column;
+ String mapKey;
+ int i=0;
+
+ if(domainlist != null){
+
+ Double leftPosition = 7d;
+ HashMap<String,String> domainStagingMap = new HashMap<String, String>();
+
+ for(Object eachDomain: domainlist){
+ if(eachDomain != null && eachDomain instanceof HashMap){
+ HashMap<String, String> domainDetails = (HashMap<String, String>) eachDomain;
+ if(domainDetails != null){
+ domainName = "NA"+i;
+ domainID = "NA"+i;
+ row = "0";
+ column = "0";
+ for(String detailsKey: domainDetails.keySet()){
+ if ("name".equalsIgnoreCase(detailsKey)) domainName = domainDetails.get(detailsKey).toString();
+ if ("id".equalsIgnoreCase(detailsKey)) {
+ domainID = String.valueOf(domainDetails.get(detailsKey));
+ }
+ if ("row".equalsIgnoreCase(detailsKey)) {
+ row = String.valueOf(domainDetails.get(detailsKey));
+ }
+ if ("column".equalsIgnoreCase(detailsKey)) {
+ column = String.valueOf(domainDetails.get(detailsKey));
+ }
+ }
+
+ if(domainStagingMap.containsKey(row.concat(column))){
+ mapKey = domainName;
+ } else mapKey = row.concat(column);
+
+ domainStagingMap.put(mapKey, domainID+"%"+domainName);
+ }
+ }
+ i++;
+ }
+
+ if(domainStagingMap != null && !domainStagingMap.isEmpty()){
+ for(String domainsKey: new TreeSet<String>(domainStagingMap.keySet())){
+ String value = domainStagingMap.get(domainsKey);
+ if(value.contains("%")){
+ domainMap.put(domainsKey, fetchDomainObject(value.substring(0,value.indexOf("%")),value.substring(value.indexOf("%")+1)));
+ }
+ }
+ }
+ }
+
+ for(String domainkey : domainMap.keySet()){
+ Domain c = (Domain) domainMap.get(domainkey);
+ }
+
+ }
+
+
+ }
+
+ Layout dynamicLayout = new Layout(domainMap, 2, 10, 1, 5);
+
+ dynamicLayout.computeDomainPositionsModified();
+ Map<String,Domain> resultDomain2= dynamicLayout.domainRowCol;
+
+ for (String key : resultDomain2.keySet()) {
+ if (resultDomain2.get(key).getP() !=null) {
+
+ }
+ }
+
+ ElementMapService cm2 = new ElementMapService();
+ try {
+
+ if(args != null && args.length > 0 ) {
+
+ if( args[0] != null) {
+ String collapsedDomains[] = args[0].split(",");
+ for(String collapsedDomain : collapsedDomains)
+ dynamicLayout.collapseDomainNew(collapsedDomain);
+ }
+
+ if( args[1] != null) {
+ String expandedDomains[] = args[1].split(",");
+ for(String expandedDomain : expandedDomains)
+ dynamicLayout.uncollapseDomainNew1(expandedDomain);
+ }
+
+ return cm2.convertToYAML(dynamicLayout);
+
+ }
+ }catch (Exception e) {
+
+ e.printStackTrace();
+ }
+
+
+ return "";
+
+
+ }
+
+ private static int computeRows(Set<String> keys){
+ int i = 0;
+ if(keys!= null && !keys.isEmpty()){
+ for(String s: keys){
+ String r = s.substring(0, 1);
+ if(StringUtils.isNumeric(r)){
+ int j = Integer.parseInt(r);
+ if(i<= j){
+ i=j;
+ }
+
+ }
+ }
+
+ return i+1;
+ }
+
+ return 1;
+ }
+
+ private static int computeColumns(Set<String> keys){
+ int i = 0;
+ if(keys!= null && !keys.isEmpty()){
+ for(String s: keys){
+ String r = s.substring(1, 2);
+ if(StringUtils.isNumeric(r)){
+ int j = Integer.parseInt(r);
+ if(i<= j){
+ i=j;
+ }
+
+ }
+ }
+
+ return i+1;
+ }
+
+ return 1;
+ }
+
+ private static Container fetchContainerObject(String id, String name, boolean isInner, String logicalGroupName, String domain){
+ Map<String,Element> containerElementsMap = new HashMap<String, Element>();
+
+ containerElementsMap = fetchElementsMapForContainer(name, isInner, logicalGroupName, domain);
+ int rows = 1;
+ int columns = 1;
+
+ if(isInner){
+
+ if(containerElementsMap != null && !containerElementsMap.isEmpty()){
+ rows = computeRows(containerElementsMap.keySet());
+ columns = computeColumns(containerElementsMap.keySet());
+ }
+
+ Container thisContainer = new Container(id, name, rows, columns, 1, 4, 8, 12, 1, 2);
+ thisContainer.setElements(containerElementsMap);
+
+ return thisContainer;
+ } else {
+ Map<String,Container> innerContainersMap = fetchInnerContainersMapForOuter(name, isInner, logicalGroupName,domain);
+
+ if(innerContainersMap != null && !innerContainersMap.isEmpty()){
+ if(containerElementsMap != null && !containerElementsMap.isEmpty()){
+ Set<String> keys = new HashSet<String>(innerContainersMap.keySet());
+ keys.addAll(containerElementsMap.keySet());
+ rows = computeRows(keys);
+ columns = computeColumns(keys);
+ } else {
+ rows = computeRows(innerContainersMap.keySet());
+ columns = computeColumns(innerContainersMap.keySet());
+ }
+ } else if(containerElementsMap != null && !containerElementsMap.isEmpty()){
+ rows = computeRows(containerElementsMap.keySet());
+ columns = computeColumns(containerElementsMap.keySet());
+ }
+
+ Container thisContainer = new Container(id, name, rows, columns,2 , 6, 2, 5, 0, 0);
+ thisContainer.setElements(containerElementsMap);
+ thisContainer.setInnerContainer(innerContainersMap);
+
+
+ return thisContainer;
+ }
+
+ }
+
+ private static Domain fetchDomainObject(String id, String name){
+ HashMap<String,Container> domainContainersMap = fetchContainersForDomain(name);
+
+ int rows = 1;
+ int columns = 1;
+ if(domainContainersMap != null && !domainContainersMap.isEmpty()){
+ rows = computeRows(domainContainersMap.keySet());
+ columns = computeColumns(domainContainersMap.keySet());
+ }
+
+ double domainWidth = 11;
+ Domain thisDomain;
+
+ if(domainMap != null && !domainMap.isEmpty()){
+ int domainsCountSoFar = domainMap.size();
+ switch(domainsCountSoFar){
+ case 1: {domainWidth = 12.1; break;}
+ case 2: {domainWidth = 13.3; break;}
+ case 3: {domainWidth = 14.5; break;}
+ case 4: {domainWidth = 15.6; break;}
+ default: {domainWidth = 11; break;}
+ }
+
+ for(String domainsKey: new TreeSet<String>(domainMap.keySet())){
+ Domain eachDomain = domainMap.get(domainsKey);
+ domainWidth+= eachDomain.computeSize().getWidth();
+ }
+ thisDomain = new Domain(id, name, 2, 2, domainWidth, 10, 3, rows, columns);
+ } else {
+
+ thisDomain = new Domain(id, name, 2, 1, 11, 10, 3, rows, columns);
+ }
+
+ thisDomain.setContainers(domainContainersMap);
+
+ thisDomain.computeConatinerPositions();
+ if(domainContainersMap!= null && !domainContainersMap.isEmpty()){
+ for(Container thisContainer : domainContainersMap.values()){
+ thisContainer.computeSize();
+ thisContainer.computeElementPositions();
+ Map<String,Element> resultElementMap = thisContainer.elementRowCol;
+ for (String key : resultElementMap.keySet()) {
+ if(resultElementMap.get(key) == null || resultElementMap.get(key).getP() == null) {
+ }
+
+ }
+
+ HashMap<String,Container> innerContainersMap = (HashMap<String, Container>) thisContainer.getContainerRowCol();
+ if(innerContainersMap != null && !innerContainersMap.isEmpty()){
+ for(Container thisInnerContainer : innerContainersMap.values()){
+ thisInnerContainer.computeElementPositions();
+ }
+ }
+ }
+ }
+
+ return thisDomain;
+ }
+
+ private static HashMap<String,Container> fetchContainersForDomain(String domain){
+ HashMap<String,Container> domainContainersMap = new HashMap<String, Container>();
+
+ domainContainersMap = fetchFromOuterContainers(domain);
+
+ return domainContainersMap;
+
+ }
+
+ @SuppressWarnings("unchecked")
+ private static Element fetchElementObject(String id, String name, String imgPath){
+ String bgColor = "bgColor";
+ String logical_group;
+ String display_longname;
+ String display_shortname;
+ String description;
+ String primary_function;
+ String key_interfaces;
+ String location;
+ String vendor;
+ String vendor_shortname;
+ String enclosingContainer;
+ String borderType;
+ String network_function;
+
+ if(toscaElementsMap.containsKey(name)){
+
+ if(toscaElementsMap.get(name) != null && toscaElementsMap.get(name) instanceof HashMap){
+ HashMap<String, Object> toscaElementDetails = (HashMap<String, Object>) toscaElementsMap.get(name);
+
+ for(String detailsKey: toscaElementDetails.keySet()){
+ if("properties".equalsIgnoreCase(detailsKey) && toscaElementDetails.get(detailsKey) instanceof HashMap){
+ HashMap<String, String> elementDetails = (HashMap<String, String>) toscaElementDetails.get(detailsKey);
+
+ if(elementDetails != null){
+ logical_group = elementDetails.get("logical_group") == null? "" : elementDetails.get("logical_group").toString();
+ display_longname = elementDetails.get("display_longname") == null? "" : elementDetails.get("display_longname").toString();
+ display_shortname = elementDetails.get("display_shortname") == null? "" : elementDetails.get("display_shortname").toString();
+ description = elementDetails.get("description") == null? "" : elementDetails.get("description").toString();
+ primary_function = elementDetails.get("primary_function") == null? "" : elementDetails.get("primary_function").toString();
+ key_interfaces = elementDetails.get("key_interfaces") == null? "" : elementDetails.get("key_interfaces").toString();
+ location = elementDetails.get("location") == null? "" : elementDetails.get("location").toString();
+ vendor = elementDetails.get("vendor") == null? "" : elementDetails.get("vendor").toString();
+ vendor_shortname = elementDetails.get("vendor_shortname") == null? "" : elementDetails.get("vendor_shortname").toString();
+ enclosingContainer = logical_group.replace("/", "-");
+ network_function = elementDetails.get("network_function");
+ borderType = elementDetails.get("network_function") == null? "P" : elementDetails.get("network_function").toString().toUpperCase();
+ bgColor = elementDetails.get("background_color") == null? "bgColor" : elementDetails.get("background_color").toString();
+
+ ElementDetails details = new ElementDetails(logical_group,display_longname,description,primary_function, network_function,
+ key_interfaces,location,vendor,vendor_shortname,enclosingContainer);
+
+ return new Element(name, display_shortname, imgPath, bgColor,borderType, details);
+ }
+
+ }
+ }
+
+ }
+
+ } else {
+ return new Element(id,name);
+ }
+
+ return new Element(id,name);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static String fetchDomainNameOfElement(String name){
+ if(toscaElementsMap.containsKey(name)){
+
+ if(toscaElementsMap.get(name) != null && toscaElementsMap.get(name) instanceof HashMap){
+ HashMap<String, Object> toscaElementDetails = (HashMap<String, Object>) toscaElementsMap.get(name);
+
+ for(String detailsKey: toscaElementDetails.keySet()){
+ if("properties".equalsIgnoreCase(detailsKey) && toscaElementDetails.get(detailsKey) instanceof HashMap){
+ HashMap<String, String> elementDetails = (HashMap<String, String>) toscaElementDetails.get(detailsKey);
+
+ if(elementDetails != null){
+ return elementDetails.get("domain") == null? "" : elementDetails.get("domain").toString();
+ }
+
+ }
+ }
+
+ }
+
+ } else {
+ return "";
+ }
+
+ return "";
+ }
+
+ private static HashMap<String, Container> fetchInnerContainersMapForOuter(String name, boolean isInner, String logicalGroupName, String domain){
+ return fetchInnerContainersMap(name,logicalGroupName,domain);
+ }
+
+ private static HashMap<String, Element> fetchElementsMapForContainer(String name, boolean isInner, String logicalGroupName, String domain){
+ return fetchElementsMap(logicalGroupName,domain);
+ }
+
+ private static HashMap<String, Container> fetchInnerContainersMap(String name, String logicalGroupName, String domain){
+ HashMap<String,Container> containersMap = new HashMap<String, Container>();
+ String rowColumnKey = "";
+ int count = 0;
+
+ if(innercontainers!=null && !innercontainers.isEmpty()){
+ for(String key : innercontainers.keySet()){
+
+
+ Container eachContainer = innercontainers.get(key);
+
+ if(key.toUpperCase().contains((domain+":"+name).toUpperCase())){
+ if(key.contains("/")){
+ rowColumnKey = key.substring(key.lastIndexOf("/")+1);
+ }
+
+ if(rowColumnKey.isEmpty() || containersMap.containsKey(rowColumnKey)){
+ count=0;
+ while(count<=9){
+ if(containersMap.containsKey(String.valueOf(count).concat(String.valueOf(count)))){
+ count++;
+ } else
+ {
+ rowColumnKey = String.valueOf(count).concat(String.valueOf(count));
+ break;
+ }
+ }
+
+
+ }
+
+ containersMap.put(rowColumnKey,eachContainer);
+ }
+
+
+ }
+ }
+ return containersMap.isEmpty()?null:containersMap;
+
+ }
+
+ private static HashMap<String, Container> fetchFromOuterContainers(String domain){
+ HashMap<String,Container> thisContainersMap = new HashMap<String, Container>();
+ String rowColumnKey = "";
+ int count = 0;
+
+ if(outercontainers!=null && !outercontainers.isEmpty()){
+ for(String key : outercontainers.keySet()){
+ Container eachContainer = outercontainers.get(key);
+
+ if(key.toUpperCase().contains((domain+":").toUpperCase())){
+ if(key.contains("/")){
+ rowColumnKey = key.substring(key.lastIndexOf("/")+1);
+ }
+
+ if(rowColumnKey.isEmpty() || thisContainersMap.containsKey(rowColumnKey)){
+ count=0;
+ while(count<=9){
+ if(thisContainersMap.containsKey(String.valueOf(count).concat(String.valueOf(count)))){
+ count++;
+ } else
+ {
+ rowColumnKey = String.valueOf(count).concat(String.valueOf(count));
+ break;
+ }
+ }
+
+
+ }
+
+ thisContainersMap.put(rowColumnKey,eachContainer);
+ }
+ }
+
+ }
+
+ //Misc Elements Containers
+
+ if(miscElementMap!=null && !miscElementMap.isEmpty()){
+ for(String key : miscElementMap.keySet()){
+ Element eachElement = miscElementMap.get(key);
+ String elementName = eachElement.getName();
+ String domainName = fetchDomainNameOfElement(elementName);
+
+ if(domain.equalsIgnoreCase(domainName)){
+ Container eachContainer = new Container(domainName+":"+elementName, elementName, 1, 1, 3, 6, 2, 5, 0, 0);
+ count=0;
+ while(count<=9){
+ if(thisContainersMap.containsKey(String.valueOf(count).concat(String.valueOf(count)))){
+ count++;
+ } else
+ {
+ rowColumnKey = String.valueOf(count).concat(String.valueOf(count));
+ break;
+ }
+ }
+
+ thisContainersMap.put(rowColumnKey,eachContainer);
+ }
+
+
+ }
+
+ }
+
+
+ return thisContainersMap.isEmpty()?null:thisContainersMap;
+ }
+
+
+
+ @SuppressWarnings("unused")
+ private static HashMap<String,Container> addOuterContainersForMiscElements(String domain){
+ HashMap<String,Container> containerElementsMap = new HashMap<String, Container>();
+ if(miscElementMap!=null && !miscElementMap.isEmpty()){
+ for(String key : miscElementMap.keySet()){
+ Element eachElement = miscElementMap.get(key);
+ String elementName = eachElement.getName();
+ String domainName = fetchDomainNameOfElement(elementName);
+
+ if(domain.equalsIgnoreCase(domainName)){
+ Container newContainer = new Container(domainName+":"+elementName, elementName, 1, 1, 3, 6, 2, 5, 0, 0);
+ containerElementsMap.put(domainName+":"+elementName, newContainer);
+ }
+
+
+ }
+
+ }
+ return containerElementsMap.isEmpty()? null:containerElementsMap;
+ }
+
+ private static HashMap<String, Element> fetchElementsMap(String logicalGroupName, String domain){
+ HashMap<String,Element> innerElementMap = new HashMap<String, Element>();
+ String rowColumnKey = "";
+ int count = 0;
+
+ if(elementMap!=null && !elementMap.isEmpty()){
+ for(String key : elementMap.keySet()){
+ Element eachElement = elementMap.get(key);
+
+ String elementName = eachElement.getId();
+ String elementLogicalGroup = eachElement.details == null ? "" : eachElement.details.logical_group;
+ if(elementLogicalGroup.equalsIgnoreCase(logicalGroupName) && domain.equalsIgnoreCase(fetchDomainNameOfElement(elementName))){
+ if(key.contains("/")){
+ rowColumnKey = key.substring(key.indexOf("/")+1);
+ }
+
+ if(rowColumnKey.isEmpty() || innerElementMap.containsKey(rowColumnKey)){
+ count=0;
+ while(count<=9){
+ if(innerElementMap.containsKey(String.valueOf(count).concat(String.valueOf(count)))){
+ count++;
+ } else
+ {
+ rowColumnKey = String.valueOf(count).concat(String.valueOf(count));
+ break;
+ }
+ }
+
+
+ }
+
+ innerElementMap.put(rowColumnKey,eachElement);
+ miscElementMap.remove(key);
+ }
+
+ }
+ }
+
+ return innerElementMap.isEmpty()?null:innerElementMap;
+ }
+
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java
new file mode 100644
index 00000000..040c9d26
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java
@@ -0,0 +1,46 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.openecomp.portalsdk.core.domain.Menu;
+import org.openecomp.portalsdk.core.domain.MenuData;
+import org.openecomp.portalsdk.core.domain.RoleFunction;
+
+/**
+ * Description: this java class is an interface of services for Admin to add/edit/delete menu items from FN_MENU
+ */
+public interface FnMenuService {
+ List<MenuData> getFnMenuItems();
+ void saveFnMenuData(MenuData domainFnMenu);
+ void saveFnMenu(Menu domainFnMenu);
+ void removeMenuItem(MenuData domainFnMenu);
+ MenuData getMenuItemRow(Long id);
+ Menu getMenuItem(Long id);
+ List<Long> getParentId(String label);
+ @SuppressWarnings("rawtypes")
+ List<List> getParentList();
+ List<RoleFunction> getFunctionCDList();
+ void removeMenuItem(Menu domainFnMenu);
+ Map<String, List<MenuData>> setMenuDataStructure(List<List<MenuData>> childItemList, List<MenuData> parentList, Set<MenuData> menuResult) throws Exception;
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java
new file mode 100644
index 00000000..b17be180
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java
@@ -0,0 +1,145 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.openecomp.portalsdk.core.domain.Menu;
+import org.openecomp.portalsdk.core.domain.MenuData;
+import org.openecomp.portalsdk.core.domain.RoleFunction;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Description: this java class is an implementation of services for Admin to add/edit/delete menu items from FN_MENU
+ */
+
+@Service("fnMenuService")
+@Transactional
+public class FnMenuServiceImpl implements FnMenuService{
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ @SuppressWarnings("unchecked")
+ public List<MenuData> getFnMenuItems() {
+ return getDataAccessService().getList(MenuData.class, null, "1", null);
+
+ }
+
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+
+ @Override
+ public void saveFnMenuData(MenuData domainFnMenu) {
+ // TODO Auto-generated method stub
+ getDataAccessService().saveDomainObject(domainFnMenu, null);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<Long> getParentId(String label) {
+ // TODO Auto-generated method stub
+ Map<String, String> params = new HashMap<String, String>();
+ params.put("paramLabel", label);
+ return getDataAccessService().executeNamedQuery("IdForLabelList", params, null);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public List<List> getParentList() {
+ // TODO Auto-generated method stub
+
+ return getDataAccessService().executeNamedQuery("parentList", null, null);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<RoleFunction> getFunctionCDList() {
+ // TODO Auto-generated method stub
+
+ return getDataAccessService().executeNamedQuery("functionCDlist", null, null);
+
+ }
+
+ @Override
+ public void removeMenuItem(MenuData domainFnMenu) {
+ getDataAccessService().deleteDomainObject(domainFnMenu, null);
+ }
+
+ @Override
+ public void removeMenuItem(Menu domainFnMenu) {
+ getDataAccessService().deleteDomainObject(domainFnMenu, null);
+ }
+
+ public MenuData getMenuItemRow(Long id) {
+ return (MenuData)getDataAccessService().getDomainObject(MenuData.class, id, null);
+ }
+
+ @Override
+ public Menu getMenuItem(Long id) {
+ return (Menu)getDataAccessService().getDomainObject(Menu.class, id, null);
+ }
+
+ @Override
+ public void saveFnMenu(Menu domainFnMenu) {
+ // TODO Auto-generated method stub
+ getDataAccessService().saveDomainObject(domainFnMenu, null);
+
+ }
+ @Override
+ public Map<String, List<MenuData>> setMenuDataStructure(List<List<MenuData>> childItemList, List<MenuData> parentList, Set<MenuData> menuResult) throws Exception{
+ for(MenuData menu: menuResult){
+ MenuData parentData = new MenuData();
+ parentData.setLabel(menu.getLabel());
+ parentData.setAction(menu.getAction());
+ parentData.setImageSrc(menu.getImageSrc());
+ parentList.add(parentData);
+ List<MenuData> tempList = new ArrayList<MenuData>();
+ for(Object o:menu.getChildMenus()){
+ MenuData m = (MenuData)o;
+ MenuData data = new MenuData();
+ data.setLabel(m.getLabel());
+ data.setAction(m.getAction());
+ data.setImageSrc(m.getImageSrc());
+ tempList.add(data);
+ }
+ childItemList.add(tempList);
+ }
+ return null;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapService.java
new file mode 100644
index 00000000..9c790eb2
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapService.java
@@ -0,0 +1,31 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import org.openecomp.portalsdk.core.command.support.SearchResult;
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+
+public interface LdapService {
+
+ // search POST for users based on the criteria selected in the Request
+ SearchResult searchPost(DomainVo searchCriteria, String sortBy1, String sortBy2, String sortBy3, int pageNo, int dataSize, int userId) throws Exception;
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapServiceImpl.java
new file mode 100644
index 00000000..d1176c1c
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapServiceImpl.java
@@ -0,0 +1,269 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
+
+import org.openecomp.portalsdk.core.command.support.SearchResult;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.support.FusionService;
+import org.openecomp.portalsdk.core.service.support.ServiceLocator;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service("ldapService")
+@Transactional
+public class LdapServiceImpl extends FusionService implements LdapService {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LdapServiceImpl.class);
+ @Autowired
+ private ServiceLocator serviceLocator;
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public SearchResult searchPost(DomainVo searchCriteria, String sortBy1, String sortBy2, String sortBy3,
+ int pageNo, int dataSize, int userId) throws Exception {
+
+ // initialize the directory context to access POST
+ DirContext dirContext = serviceLocator.getDirContext(SystemProperties.getProperty(SystemProperties.POST_INITIAL_CONTEXT_FACTORY),
+ SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL),
+ SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL));
+
+ SearchResult searchResult = new SearchResult();
+
+ try {
+
+ String[] postAttributes = {"nickname","givenName","initials","sn","employeeNumber","mail","telephoneNumber",
+ "departmentNumber","a1","street","roomNumber","l","st","postalCode","zip4","physicalDeliveryOfficeName","bc",
+ "friendlyCountryName","bd","bdname","bu","buname","jtname","mgrid","a2","compcode","compdesc",
+ "costcenter","silo","b2"};
+
+ SearchControls searchControls = new SearchControls();
+ searchControls.setTimeLimit(5000);
+ searchControls.setReturningAttributes(postAttributes);
+
+ StringBuffer filterClause = new StringBuffer("(&(objectClass=*)");
+
+ User user = (User)searchCriteria;
+
+ if(Utilities.nvl(user.getFirstName()).length() > 0) {
+ filterClause.append("(givenName=").append(user.getFirstName()).append("*)");
+ }
+ if(Utilities.nvl(user.getLastName()).length() > 0) {
+ filterClause.append("(sn=").append(user.getLastName()).append("*)");
+ }
+ if(Utilities.nvl(user.getHrid()).length() > 0) {
+ filterClause.append("(employeeNumber=").append(user.getHrid()).append("*)");
+ }
+ if(Utilities.nvl(user.getOrgManagerUserId()).length() > 0) {
+ filterClause.append("(mgrid=").append(user.getOrgManagerUserId()).append("*)");
+ }
+ if(Utilities.nvl(user.getOrgCode()).length() > 0) {
+ filterClause.append("(departmentNumber=").append(user.getOrgCode()).append("*)");
+ }
+ if(Utilities.nvl(user.getEmail()).length() > 0) {
+ filterClause.append("(mail=").append(user.getEmail()).append("*)");
+ }
+ if(Utilities.nvl(user.getOrgUserId()).length() > 0) {
+ filterClause.append("(a1=").append(user.getOrgUserId()).append("*)");
+ }
+ filterClause.append("(c3=N)"); // this has been added to filter CP09 entries on the LDAP server that are duplicates of existing individuals
+ filterClause.append(")");
+
+ List list = new ArrayList();
+ if (!filterClause.toString().equals("(&(objectClass=*))")) {
+ NamingEnumeration e = dirContext.search(SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL) + "/" +
+ SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL),
+ filterClause.toString(),
+ searchControls);
+
+ list = processResults(e);
+ }
+
+ Collections.sort(list);
+
+ searchResult = new SearchResult(list);
+ searchResult.setPageNo(pageNo);
+ if(dataSize >= 0) {
+ searchResult.setDataSize(dataSize);
+ }
+ else {
+ searchResult.setDataSize(list.size());
+ } // else
+
+ }
+ catch(NamingException ne) {
+ logger.error(EELFLoggerDelegate.errorLogger,ne.getMessage());
+ }
+ finally {
+ dirContext.close();
+ }
+
+ return searchResult;
+ }
+
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private ArrayList processResults(NamingEnumeration e) throws NamingException {
+ ArrayList results = new ArrayList();
+ int count = 0;
+
+ while (e.hasMore()) {
+ javax.naming.directory.SearchResult searchResult = (javax.naming.directory.SearchResult)e.next();
+ results.add(processAttributes(searchResult.getAttributes()));
+ count++;
+
+ if(count > Integer.parseInt(SystemProperties.getProperty(SystemProperties.POST_MAX_RESULT_SIZE))) {
+ break;
+ }
+
+ }
+
+ return results;
+ }
+
+
+ @SuppressWarnings("rawtypes")
+ private DomainVo processAttributes(Attributes resultAttributes) throws NamingException {
+ User user = new User();
+
+ try {
+ if (resultAttributes == null) {
+ System.out.println("This result has no attributes");
+ } else {
+ for (NamingEnumeration e = resultAttributes.getAll(); e.hasMore();) { //why the nested loop?
+ Attribute attribute = (Attribute)e.next();
+ for (NamingEnumeration ie = attribute.getAll(); ie.hasMore();) {
+ if (attribute.getID().equalsIgnoreCase("nickname")) {
+ user.setFirstName((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("initials")) {
+ user.setMiddleInitial((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("sn")) {
+ user.setLastName((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("employeeNumber")) {
+ user.setHrid((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("mail")) {
+ user.setEmail((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("telephoneNumber")) {
+ user.setPhone((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("departmentNumber")) {
+ user.setOrgCode((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("a1")) {
+ user.setOrgUserId((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("street")) {
+ user.setAddress1((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("roomNumber")) {
+ user.setAddress2((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("l")) {
+ user.setCity((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("st")) {
+ user.setState((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("postalCode")) {
+ user.setZipCode((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("zip4")) {
+ user.setZipCodeSuffix((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("physicalDeliveryOfficeName")) {
+ user.setLocationClli((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("bc")) {
+ user.setBusinessCountryCode((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("friendlyCountryName")) {
+ user.setBusinessCountryName((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("bd")) {
+ user.setDepartment((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("bdname")) {
+ user.setDepartmentName((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("jtname")) {
+ user.setJobTitle((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("mgrid")) {
+ user.setOrgManagerUserId((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("a2")) {
+ user.setCommandChain((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("compcode")) {
+ user.setCompanyCode((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("compdesc")) {
+ user.setCompany((String) ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("bu")) {
+ user.setBusinessUnit((String)ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("buname")) {
+ user.setBusinessUnitName((String)ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("silo")) {
+ user.setSiloStatus((String)ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("costcenter")) {
+ user.setCostCenter((String)ie.next());
+ }
+ else if (attribute.getID().equalsIgnoreCase("b2")) {
+ user.setFinancialLocCode((String)ie.next());
+ }
+ else { //we don't care about returned attribute, let's move on
+ ie.next();
+ }
+
+ }
+ }
+ }
+ } catch (NamingException e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "An error occurred while processing the following user from POST with an ORGUSERID of " + user.getOrgUserId() + e.getMessage());
+ } finally {
+
+ }
+ return user;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginService.java
new file mode 100644
index 00000000..113833bf
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginService.java
@@ -0,0 +1,36 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+
+import java.util.HashMap;
+
+import org.openecomp.portalsdk.core.command.LoginBean;
+
+
+public interface LoginService {
+
+ // validate user exists in the system
+ @SuppressWarnings("rawtypes")
+ LoginBean findUser(LoginBean bean, String menuPropertiesFilename, HashMap additionalParams) throws Exception;
+
+ @SuppressWarnings("rawtypes")
+ LoginBean findUser(LoginBean bean, String menuPropertiesFilename, HashMap additionalParams, boolean matchPassword) throws Exception;
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceImpl.java
new file mode 100644
index 00000000..7da427ba
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceImpl.java
@@ -0,0 +1,190 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.openecomp.portalsdk.core.command.LoginBean;
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.menu.MenuBuilder;
+import org.openecomp.portalsdk.core.service.support.FusionService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.AppUtils;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service("loginService")
+@Transactional
+public class LoginServiceImpl extends FusionService implements LoginService {
+
+ @SuppressWarnings("unused")
+ private MenuBuilder menuBuilder;
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+
+ @SuppressWarnings("rawtypes")
+ public LoginBean findUser(LoginBean bean, String menuPropertiesFilename, HashMap additionalParams ) throws Exception {
+ return findUser(bean, menuPropertiesFilename, additionalParams, true);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public LoginBean findUser(LoginBean bean, String menuPropertiesFilename, HashMap additionalParams, boolean matchPassword) throws Exception {
+ User user = null;
+ User userCopy = null;
+
+ if (bean.getUserid() != null && bean.getUserid() != null) {
+ user = (User)findUser(bean);
+ }
+ else {
+ if (matchPassword)
+ user = (User)findUser(bean.getLoginId(), bean.getLoginPwd());
+ else
+ user = (User)findUserWithoutPwd(bean.getLoginId());
+ }
+
+ if (user != null) {
+
+ // raise an error if the application is locked and the user does not have system administrator privileges
+ if (AppUtils.isApplicationLocked() && !UserUtils.hasRole(user, SystemProperties.getProperty(SystemProperties.SYS_ADMIN_ROLE_ID))) {
+ bean.setLoginErrorMessage(SystemProperties.MESSAGE_KEY_LOGIN_ERROR_APPLICATION_LOCKED);
+ }
+
+ // raise an error if the user is inactive
+ if (!user.getActive()) {
+ bean.setLoginErrorMessage(SystemProperties.MESSAGE_KEY_LOGIN_ERROR_USER_INACTIVE);
+ }
+
+ if (!userHasActiveRoles(user)) {
+ bean.setLoginErrorMessage(SystemProperties.MESSAGE_KEY_LOGIN_ERROR_USER_INACTIVE);
+ }
+ // only login the user if no errors have occurred
+ if (bean.getLoginErrorMessage() == null) {
+
+ // this will be a snapshot of the user's information as retrieved from the database
+ userCopy = (User)user.clone();
+
+ // update the last logged in date for the user
+ user.setLastLoginDate(new Date());
+ getDataAccessService().saveDomainObject(user, additionalParams);
+
+ // update the audit log of the user
+ //Check for the client device type and set log attributes appropriately
+
+ // save the above changes to the User and their audit trail
+
+ // create the application menu based on the user's privileges
+ Set appMenu = getMenuBuilder().getMenu(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME),dataAccessService);
+ bean.setMenu(appMenu != null?appMenu:new HashSet());
+ Set businessDirectMenu = getMenuBuilder().getMenu(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_SET_NAME),dataAccessService);
+ bean.setBusinessDirectMenu(businessDirectMenu != null?businessDirectMenu:new HashSet());
+
+ bean.setUser(userCopy);
+ }
+
+ }
+
+ return bean;
+ }
+
+ @SuppressWarnings("rawtypes")
+ private boolean userHasActiveRoles(User user) {
+ boolean hasActiveRole = false;
+ Iterator roles = user.getRoles().iterator();
+ while (roles.hasNext()) {
+ Role role = (Role)roles.next();
+ if (role.getActive()) {
+ hasActiveRole = true;
+ break;
+ }
+ }
+ return hasActiveRole;
+ }
+
+
+ @SuppressWarnings("rawtypes")
+ public User findUser(String loginId, String password) {
+ List list = null;
+
+ StringBuffer criteria = new StringBuffer();
+ criteria.append(" where login_id = '").append(loginId).append("'")
+ .append(" and login_pwd = '").append(password).append("'");
+
+ list = getDataAccessService().getList(User.class, criteria.toString(), null, null);
+
+ return (list == null || list.size() == 0) ? null : (User)list.get(0);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private User findUserWithoutPwd(String loginId) {
+ List list = null;
+
+ StringBuffer criteria = new StringBuffer();
+ criteria.append(" where login_id = '").append(loginId).append("'");
+
+ list = getDataAccessService().getList(User.class, criteria.toString(), null, null);
+
+ return (list == null || list.size() == 0) ? null : (User)list.get(0);
+ }
+
+
+ @SuppressWarnings("rawtypes")
+ public User findUser(LoginBean bean) {
+ List list = null;
+
+ StringBuffer criteria = new StringBuffer();
+ criteria.append(" where org_user_id = '").append(bean.getUserid()).append("'");
+
+ list = getDataAccessService().getList(User.class, criteria.toString(), null, null);
+
+ return (list == null || list.size() == 0) ? null : (User)list.get(0);
+ }
+
+
+ public MenuBuilder getMenuBuilder() {
+ return new MenuBuilder();
+ }
+
+
+ public void setMenuBuilder(MenuBuilder menuBuilder) {
+ this.menuBuilder = menuBuilder;
+ }
+
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsService.java
new file mode 100644
index 00000000..596ebed2
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsService.java
@@ -0,0 +1,34 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.core.command.PostDroolsBean;
+
+public interface PostDroolsService {
+
+ String execute(String droolsFile, String className, String selectedRules);
+
+ List<PostDroolsBean> fetchDroolBeans();
+
+ String retrieveClass(String droolsFile);
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsServiceImpl.java
new file mode 100644
index 00000000..726d8973
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsServiceImpl.java
@@ -0,0 +1,179 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.DirectoryIteratorException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.kie.api.io.ResourceType;
+import org.kie.internal.KnowledgeBase;
+import org.kie.internal.KnowledgeBaseFactory;
+import org.kie.internal.builder.KnowledgeBuilder;
+import org.kie.internal.builder.KnowledgeBuilderFactory;
+import org.kie.internal.definition.KnowledgePackage;
+import org.kie.internal.io.ResourceFactory;
+import org.kie.internal.runtime.StatefulKnowledgeSession;
+import org.openecomp.portalsdk.core.command.PostDroolsBean;
+import org.openecomp.portalsdk.core.drools.DroolsRuleService;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+@Service("postDroolsService")
+@Transactional
+public class PostDroolsServiceImpl implements PostDroolsService{
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PostDroolsServiceImpl.class);
+
+ @Override
+ public String execute(String droolsFile, String className, String selectedRules) {
+ logger.info(EELFLoggerDelegate.applicationLogger, "Executing Drools...");
+ String resultsString = executeDemoRules(droolsFile, className, selectedRules);
+ return resultsString;
+ }
+
+
+ public List<PostDroolsBean> fetchDroolBeans() {
+
+ List<PostDroolsBean> beanList = new ArrayList<PostDroolsBean>();
+ Path path = FileSystems.getDefault().getPath(SystemProperties.getProperty(SystemProperties.FILES_PATH));
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(path,"*.{drl}")) {
+ for (Path entry: stream) {
+
+ PostDroolsBean postDroolsBean = new PostDroolsBean();
+ String fileName = entry.getName(entry.getNameCount()-1).toString();
+ postDroolsBean.setDroolsFile(fileName);//sample populated
+ postDroolsBean.setClassName(retrieveClass(fileName));
+ //postDroolsBean.setSelectedRules("[\"NJ\",\"NY\",\"KY\"]");
+ beanList.add(postDroolsBean);
+ }
+ } catch (DirectoryIteratorException ex) {
+ logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage());
+ } catch (IOException e) {
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage());
+ }
+ return beanList;
+ }
+
+ @Override
+ public String retrieveClass(String fileName) {
+ String resultsString = "";
+ try {
+ // load up the knowledge base
+ final KnowledgeBuilder kbuilder = loadKBuilder(fileName);
+ final Collection<KnowledgePackage> pkgs = kbuilder.getKnowledgePackages();
+ return pkgs.iterator().next().getFactTypes().iterator().next().getFactClass().getName();
+
+ } catch (Throwable t) {
+ logger.error(EELFLoggerDelegate.errorLogger, t.getMessage());
+ }
+
+ return resultsString;
+ }
+
+ protected static KnowledgeBuilder loadKBuilder(String fileName) {
+ final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+
+ // this will parse and compile in one step
+ kbuilder.add(ResourceFactory.newFileResource(SystemProperties.getProperty(SystemProperties.FILES_PATH) + File.separator + fileName),
+ ResourceType.DRL);
+
+ if (kbuilder.hasErrors()) {
+
+ logger.error(EELFLoggerDelegate.errorLogger, kbuilder.getErrors().toString());
+
+ throw new RuntimeException("Unable to compile \".drl\".");
+
+ }
+ return kbuilder;
+ }
+
+
+ @SuppressWarnings({ "deprecation", "unchecked" })
+ public static String executeDemoRules(String fileName, String className, String ruleValue) {
+ String resultsString = "";
+ try {
+ // load up the knowledge base
+ // KieServices ks = KieServices.Factory.get();
+ // KieContainer kContainer = ks.getKieClasspathContainer();
+ // KieSession kSession = kContainer.newKieSession("ksession-rules");
+
+ final KnowledgeBuilder kbuilder = loadKBuilder(fileName);
+
+ // get the compiled packages (which are serializable)
+
+ final Collection<KnowledgePackage> pkgs = kbuilder.getKnowledgePackages();
+
+ // add the packages to a knowledgebase (deploy the knowledge
+ // packages).
+
+ final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
+
+ kbase.addKnowledgePackages(pkgs);
+
+ final StatefulKnowledgeSession kSession = kbase.newStatefulKnowledgeSession();
+
+ ObjectMapper mapper = new ObjectMapper();
+ if(ruleValue == null || ruleValue.equals("")) {
+ resultsString = "Please enter valid rule";
+ return resultsString;
+ }
+ List<String> selectedRules = mapper.readValue(ruleValue, List.class);
+ List<String> ruleResponse = new ArrayList<String>();
+
+ for(String rule : selectedRules){
+ Class<DroolsRuleService> clazz = (Class<DroolsRuleService>) Class.forName(className);
+ DroolsRuleService droolsIntroduction =clazz.newInstance();
+ droolsIntroduction.init(rule);
+ kSession.insert(droolsIntroduction);
+ kSession.fireAllRules();
+ ruleResponse.add(droolsIntroduction.getResultsString());
+ }
+
+ resultsString = mapper.writeValueAsString(ruleResponse);
+
+// kSession.insert(new DroolsRuleService("KY"));
+// kSession.fireAllRules();
+//
+// kSession.setGlobal("age", "25");
+// kSession.insert(new DroolsRuleService("NY"));
+// kSession.fireAllRules();
+ } catch (Throwable t) {
+ logger.error(EELFLoggerDelegate.errorLogger, t.getMessage());
+ }
+
+ return resultsString;
+ }
+
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchService.java
new file mode 100644
index 00000000..55c9db3f
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchService.java
@@ -0,0 +1,30 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.command.PostSearchBean;
+
+public interface PostSearchService {
+
+ void process(HttpServletRequest request, PostSearchBean postSearch);
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchServiceImpl.java
new file mode 100644
index 00000000..2ecedbea
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchServiceImpl.java
@@ -0,0 +1,203 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.FusionObject.Parameters;
+import org.openecomp.portalsdk.core.command.PostSearchBean;
+import org.openecomp.portalsdk.core.domain.Lookup;
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.FeedbackMessage;
+import org.openecomp.portalsdk.core.web.support.MessagesList;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service("postSearchService")
+@Transactional
+public class PostSearchServiceImpl implements PostSearchService{
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PostSearchServiceImpl.class);
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void process(HttpServletRequest request, PostSearchBean postSearch) {
+ HashMap additionalParams = new HashMap();
+ additionalParams.put(Parameters.PARAM_HTTP_REQUEST, request);
+
+ if (postSearch.getSelected() != null) {
+ //sort the selected users for quick validation
+
+ Arrays.sort(postSearch.getSelected());
+ System.out.println("list - " + postSearch.getPostOrgUserId().length);
+ // import the users that have been selected
+ for(int i=0; i < postSearch.getPostOrgUserId().length; i++){
+ if (Arrays.binarySearch(postSearch.getSelected(), postSearch.getPostOrgUserId()[i]) >= 0) {
+ logger.info(EELFLoggerDelegate.debugLogger, "Adding ORGUSERID - " + postSearch.getPostOrgUserId()[i]);
+ logger.info(EELFLoggerDelegate.auditLogger, "Import new user from webphone " + postSearch.getPostOrgUserId()[i]);
+
+ User user = new User();
+ user.setLastName(postSearch.getPostLastName()[i]);
+ user.setFirstName(postSearch.getPostFirstName()[i]);
+
+ if (postSearch.getPostHrid() != null && postSearch.getPostHrid().length > 0) {
+ user.setHrid(postSearch.getPostHrid()[i]);
+ }
+
+ if (postSearch.getPostPhone() != null && postSearch.getPostPhone().length > 0) {
+ user.setPhone(postSearch.getPostPhone()[i]);
+ }
+
+ if (postSearch.getPostEmail() != null && postSearch.getPostEmail().length > 0) {
+ user.setEmail(postSearch.getPostEmail()[i]);
+ }
+
+ if (postSearch.getPostOrgUserId() != null && postSearch.getPostOrgUserId().length > 0) {
+ user.setOrgUserId(postSearch.getPostOrgUserId()[i]);
+ user.setLoginId(postSearch.getPostOrgUserId()[i]);
+ }
+
+ if (postSearch.getPostAddress1() != null && postSearch.getPostAddress1().length > 0) {
+ user.setAddress1(postSearch.getPostAddress1()[i]);
+ }
+
+ if (postSearch.getPostAddress2() != null && postSearch.getPostAddress2().length > 0) {
+ user.setAddress2(postSearch.getPostAddress2()[i]);
+ }
+
+ if (postSearch.getPostCity() != null && postSearch.getPostCity().length > 0) {
+ user.setCity(postSearch.getPostCity()[i]);
+ }
+
+ if (postSearch.getPostState() != null && postSearch.getPostState().length > 0) {
+ user.setState(postSearch.getPostState()[i]);
+ }
+
+ if (postSearch.getPostZipCode() != null && postSearch.getPostZipCode().length > 0) {
+ user.setZipCode(postSearch.getPostZipCode()[i]);
+ }
+
+ if (postSearch.getPostLocationClli() != null && postSearch.getPostLocationClli().length > 0) {
+ user.setLocationClli(postSearch.getPostLocationClli()[i]);
+ }
+
+ if (postSearch.getPostBusinessCountryCode() != null && postSearch.getPostBusinessCountryCode().length > 0) {
+ user.setBusinessCountryCode(postSearch.getPostBusinessCountryCode()[i]);
+ }
+
+ if (postSearch.getPostBusinessCountryName() != null && postSearch.getPostBusinessCountryName().length > 0) {
+
+ // find the country cd for the indicated country
+ List countries = dataAccessService.getLookupList("fn_lu_country", "country_cd", "country", "country = '"
+ + postSearch.getPostBusinessCountryName()[i] + "'", null, null);
+
+ if (countries!=null&&countries.size() == 1) {
+ Lookup country = (Lookup)countries.get(0);
+ user.setCountry(country.getValue());
+ }
+ else {
+ logger.info(EELFLoggerDelegate.debugLogger, "No countries or more than one country was found matching the country returned from WEBPHONE. " +
+ "Therefore, no country was set for this user.");
+ }
+
+ }
+
+ if (postSearch.getPostDepartment() != null && postSearch.getPostDepartment().length > 0) {
+ user.setDepartment(postSearch.getPostDepartment()[i]);
+ }
+
+ if (postSearch.getPostDepartmentName() != null && postSearch.getPostDepartmentName().length > 0) {
+ user.setDepartmentName(postSearch.getPostDepartmentName()[i]);
+ }
+
+ if (postSearch.getPostBusinessUnit() != null && postSearch.getPostBusinessUnit().length > 0) {
+ user.setBusinessUnit(postSearch.getPostBusinessUnit()[i]);
+ }
+
+ if (postSearch.getPostBusinessUnitName() != null && postSearch.getPostBusinessUnitName().length > 0) {
+ user.setBusinessUnitName(postSearch.getPostBusinessUnitName()[i]);
+ }
+
+ if (postSearch.getPostJobTitle() != null && postSearch.getPostJobTitle().length > 0) {
+ user.setJobTitle(postSearch.getPostJobTitle()[i]);
+ }
+
+ if (postSearch.getPostOrgManagerUserId() != null && postSearch.getPostOrgManagerUserId().length > 0) {
+ user.setOrgManagerUserId(postSearch.getPostOrgManagerUserId()[i]);
+ }
+
+ if (postSearch.getPostCommandChain() != null && postSearch.getPostCommandChain().length > 0) {
+ user.setCommandChain(postSearch.getPostCommandChain()[i]);
+ }
+
+ if (postSearch.getPostCompanyCode() != null && postSearch.getPostCompanyCode().length > 0) {
+ user.setCompanyCode(postSearch.getPostCompanyCode()[i]);
+ }
+
+ if (postSearch.getPostCompany() != null && postSearch.getPostCompany().length > 0) {
+ user.setCompany(postSearch.getPostCompany()[i]);
+ }
+
+ if (postSearch.getPostCostCenter() != null && postSearch.getPostCostCenter().length > 0) {
+ user.setCostCenter(postSearch.getPostCostCenter()[i]);
+ }
+
+ if (postSearch.getPostSiloStatus() != null && postSearch.getPostSiloStatus().length > 0) {
+ user.setSiloStatus(postSearch.getPostSiloStatus()[i]);
+ }
+
+ if (postSearch.getPostFinancialLocCode() != null && postSearch.getPostFinancialLocCode().length > 0) {
+ user.setFinancialLocCode(postSearch.getPostFinancialLocCode()[i]);
+ }
+
+ user.setActive(true);
+
+ try {
+ dataAccessService.saveDomainObject(user, additionalParams);
+
+ Role role = (Role)dataAccessService.getDomainObject(Role.class,Long.valueOf(SystemProperties.getProperty(SystemProperties.POST_DEFAULT_ROLE_ID)), null);
+ user.addRole(role);
+ }
+ catch (Exception e) {
+ MessagesList messages = new MessagesList();
+ messages.addExceptionMessage(new FeedbackMessage("An error occurred while attempting to import " + user.getFirstName() + " "
+ + user.getLastName() + ": " + e.getMessage(), FeedbackMessage.MESSAGE_TYPE_ERROR));
+
+ }
+ }
+ }
+
+ }
+
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileService.java
new file mode 100644
index 00000000..61bd3b6e
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileService.java
@@ -0,0 +1,36 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.core.domain.Profile;
+import org.openecomp.portalsdk.core.domain.User;
+
+
+public interface ProfileService {
+ List<Profile> findAll();
+
+ Profile getProfile(int id);
+
+ User getUser(String id);
+
+ void saveUser(User user);
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceImpl.java
new file mode 100644
index 00000000..3927d727
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceImpl.java
@@ -0,0 +1,72 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.core.dao.ProfileDao;
+import org.openecomp.portalsdk.core.domain.Profile;
+import org.openecomp.portalsdk.core.domain.User;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service("profileService")
+@Transactional
+public class ProfileServiceImpl implements ProfileService{
+
+ @Autowired
+ private ProfileDao profileDao;
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ @SuppressWarnings("unchecked")
+ public List<Profile> findAll() {
+ return getDataAccessService().getList(Profile.class, null);
+ }
+
+ public User getUser(String userId){
+ return (User) getDataAccessService().getDomainObject(User.class, Long.parseLong(userId), null);
+ }
+
+ public void saveUser(User user){
+
+ getDataAccessService().saveDomainObject(user, null);
+ }
+
+
+ public Profile getProfile(int id) {
+ return profileDao.getProfile(id);
+ }
+
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java
new file mode 100644
index 00000000..01367ecd
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java
@@ -0,0 +1,50 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.domain.RoleFunction;
+
+
+public interface RoleService {
+ List<RoleFunction> getRoleFunctions();
+
+ List<Role> getAvailableChildRoles(Long roleId);
+
+ Role getRole(Long id);
+
+ void saveRole(Role domainRole);
+
+ void deleteRole(Role domainRole);
+
+ List<Role> getAvailableRoles();
+
+ List<Role> getActiveRoles();
+
+ RoleFunction getRoleFunction(String code);
+
+ void saveRoleFunction(RoleFunction domainRoleFunction);
+
+ void deleteRoleFunction(RoleFunction domainRoleFunction);
+
+ void deleteDependcyRoleRecord(Long id);
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceImpl.java
new file mode 100644
index 00000000..e71e0c58
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceImpl.java
@@ -0,0 +1,171 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.sql.DataSource;
+
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.domain.RoleFunction;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service("roleService")
+@Transactional
+public class RoleServiceImpl implements RoleService{
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ DataSource dataSource;
+
+ public DataSource getDataSource() {
+ return dataSource;
+ }
+
+
+ @Autowired
+ public void setDataSource(DataSource dataSource) {
+ this.dataSource = dataSource;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<RoleFunction> getRoleFunctions() {
+ //List msgDB = getDataAccessService().getList(Profile.class, null);
+ return getDataAccessService().getList(RoleFunction.class, null);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Role> getAvailableChildRoles(Long roleId) {
+ List<Role> availableChildRoles = (List<Role>)getDataAccessService().getList(Role.class,null);
+ if(roleId==null || roleId==0){
+ return availableChildRoles;
+ }
+
+ Role currentRole = (Role)getDataAccessService().getDomainObject(Role.class,roleId,null);
+ Set<Role> allParentRoles = new TreeSet<Role>();
+ allParentRoles = getAllParentRolesAsList(currentRole, allParentRoles);
+
+
+ Iterator<Role> availableChildRolesIterator = availableChildRoles.iterator();
+ while (availableChildRolesIterator.hasNext()) {
+ Role role = availableChildRolesIterator.next();
+ if(!role.getActive() || allParentRoles.contains(role) || role.getId().equals(roleId)){
+ availableChildRolesIterator.remove();
+ }
+ }
+ return availableChildRoles;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Set<Role> getAllParentRolesAsList(Role role, Set<Role> allParentRoles) {
+ Set<Role> parentRoles = role.getParentRoles();
+ allParentRoles.addAll(parentRoles);
+ Iterator<Role> parentRolesIterator = parentRoles.iterator();
+ while (parentRolesIterator.hasNext()) {
+ getAllParentRolesAsList(parentRolesIterator.next(),allParentRoles);
+ }
+ return allParentRoles;
+ }
+
+ public RoleFunction getRoleFunction(String code) {
+ return (RoleFunction)getDataAccessService().getDomainObject(RoleFunction.class, code, null);
+ }
+
+ public void saveRoleFunction(RoleFunction domainRoleFunction) {
+ getDataAccessService().saveDomainObject(domainRoleFunction, null);
+ }
+
+ public void deleteRoleFunction(RoleFunction domainRoleFunction) {
+ getDataAccessService().deleteDomainObject(domainRoleFunction, null);
+ }
+
+ public Role getRole(Long id) {
+ return (Role)getDataAccessService().getDomainObject(Role.class, id, null);
+ }
+
+ public void saveRole(Role domainRole) {
+ getDataAccessService().saveDomainObject(domainRole, null);
+ }
+
+ public void deleteRole(Role domainRole) {
+ getDataAccessService().deleteDomainObject(domainRole, null);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Role> getAvailableRoles() {
+ return getDataAccessService().getList(Role.class, null);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<Role> getActiveRoles() {
+ String filter = " where active_yn = 'Y' ";
+ return getDataAccessService().getList(Role.class, filter, null,null);
+ }
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ @Override
+ public void deleteDependcyRoleRecord(Long id) {
+
+ Connection conn = null;
+ Statement stmt = null;
+
+ try {
+ conn = getDataSource().getConnection();
+ stmt = conn.createStatement();
+ String sql = "delete from fn_user_role where role_id = '" + id + "'";
+ stmt.executeUpdate(sql);
+ stmt.close();
+ conn.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if (stmt != null)
+ stmt.close();
+ } catch (SQLException se2) {}
+ try {
+ if (conn != null)
+ conn.close();
+ } catch (SQLException se) { se.printStackTrace();}
+ }
+
+ }
+
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceNonSpringImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceNonSpringImpl.java
new file mode 100644
index 00000000..bd6796c1
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceNonSpringImpl.java
@@ -0,0 +1,122 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+/*package org.openecomp.portalsdk.core.service;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.domain.RoleFunction;
+
+@Service("roleService")
+@Transactional
+public class RoleServiceNonSpringImpl implements RoleService{
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ @SuppressWarnings("unchecked")
+ public List<RoleFunction> getRoleFunctions() {
+ //List msgDB = getDataAccessService().getList(Profile.class, null);
+ return getDataAccessService().getList(RoleFunction.class, null);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Role> getAvailableChildRoles(Long roleId) {
+ List<Role> availableChildRoles = (List<Role>)getDataAccessService().getList(Role.class,null);
+ if(roleId==null || roleId==0){
+ return availableChildRoles;
+ }
+
+ Role currentRole = (Role)getDataAccessService().getDomainObject(Role.class,roleId,null);
+ Set<Role> allParentRoles = new TreeSet<Role>();
+ allParentRoles = getAllParentRolesAsList(currentRole, allParentRoles);
+
+
+ Iterator<Role> availableChildRolesIterator = availableChildRoles.iterator();
+ while (availableChildRolesIterator.hasNext()) {
+ Role role = availableChildRolesIterator.next();
+ if(!role.getActive() || allParentRoles.contains(role) || role.getId().equals(roleId)){
+ availableChildRolesIterator.remove();
+ }
+ }
+ return availableChildRoles;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Set<Role> getAllParentRolesAsList(Role role, Set<Role> allParentRoles) {
+ Set<Role> parentRoles = role.getParentRoles();
+ allParentRoles.addAll(parentRoles);
+ Iterator<Role> parentRolesIterator = parentRoles.iterator();
+ while (parentRolesIterator.hasNext()) {
+ getAllParentRolesAsList(parentRolesIterator.next(),allParentRoles);
+ }
+ return allParentRoles;
+ }
+
+ public RoleFunction getRoleFunction(String code) {
+ return (RoleFunction)getDataAccessService().getDomainObject(RoleFunction.class, code, null);
+ }
+
+ public void saveRoleFunction(RoleFunction domainRoleFunction) {
+ getDataAccessService().saveDomainObject(domainRoleFunction, null);
+ }
+
+ public void deleteRoleFunction(RoleFunction domainRoleFunction) {
+ getDataAccessService().deleteDomainObject(domainRoleFunction, null);
+ }
+
+ public Role getRole(Long id) {
+ return (Role)getDataAccessService().getDomainObject(Role.class, id, null);
+ }
+
+ public void saveRole(Role domainRole) {
+ getDataAccessService().saveDomainObject(domainRole, null);
+ }
+
+ public void deleteRole(Role domainRole) {
+ getDataAccessService().deleteDomainObject(domainRole, null);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Role> getAvailableRoles() {
+ return getDataAccessService().getList(Role.class, null);
+ }
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+
+
+}
+*/
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java
new file mode 100644
index 00000000..0cf3986b
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java
@@ -0,0 +1,36 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.core.domain.User;
+
+
+public interface UserProfileService {
+ List<User> findAll();
+ User getUser(String id);
+ User getUserByLoginId(String loginId);
+ void saveUser(User user);
+ public List<User> findAllUserWithOnOffline(String originOrgUserId);
+ List<User> findAllActive();
+ List<User> searchPost(User user, String sortBy1, String sortBy2, String sortBy3, int pageNo, int newDataSize,
+ int intValue);
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java
new file mode 100644
index 00000000..e0899917
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java
@@ -0,0 +1,210 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.SortedSet;
+
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Restrictions;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.FusionObject.Utilities;
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.domain.support.CollaborateList;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service("userProfileService")
+@Transactional
+public class UserProfileServiceImpl implements UserProfileService{
+
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ @SuppressWarnings("unchecked")
+ public List<User> findAll() {
+ return getDataAccessService().getList(User.class, null);
+ }
+
+ public User getUser(String userId){
+ return (User) getDataAccessService().getDomainObject(User.class, Long.parseLong(userId), null);
+ }
+
+ @SuppressWarnings("unchecked")
+ public User getUserByLoginId(String loginId){
+ User user=null;
+ List<Criterion> restrictionsList = new ArrayList<Criterion>();
+ Criterion criterion1= Restrictions.eq("loginId",loginId);
+ restrictionsList.add(criterion1);
+ List<User> users = (List<User>) getDataAccessService().getList(User.class,null, restrictionsList, null);
+ if(users!=null && users.size()==1)
+ user = users.get(0);
+ return user;
+ }
+
+ public void saveUser(User user){
+
+ getDataAccessService().saveDomainObject(user, null);
+ }
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<User> findAllUserWithOnOffline(String originOrgUserId) {
+ HashSet<String> onlineUser = CollaborateList.getInstance().getAllUserName();
+ List<User> users = getDataAccessService().getList(User.class, null);
+ for(User u:users){
+ if(onlineUser.contains(u.getOrgUserId()))
+ u.setOnline(true);
+ if(u.getOrgUserId()!=null){
+ if(originOrgUserId.compareTo(u.getOrgUserId()) > 0) {
+ u.setChatId(originOrgUserId + "-" + u.getOrgUserId());
+ } else u.setChatId(u.getOrgUserId() + "-" + originOrgUserId );
+ }
+ }
+ return users;
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<User> findAllActive() {
+ List<User> users = getDataAccessService().getList(User.class, null);
+ Iterator<User> itr = users.iterator();
+ while(itr.hasNext()){
+ User u = (User) itr.next();
+ if(!u.getActive())
+ itr.remove();//if not active remove user from list
+ else {
+ SortedSet<Role> roles = u.getRoles();
+ Iterator<Role> itrRoles = roles.iterator();
+ while(itrRoles.hasNext()){
+ Role role = (Role) itrRoles.next();
+ if(!role.getActive())
+ u.removeRole(role.getId());//if not active remove role from list
+ }
+ }
+ }
+ return users;
+ }
+
+
+ @Override
+ public List<User> searchPost(User user, String sortBy1, String sortBy2, String sortBy3, int pageNo,
+ int newDataSize, int intValue) {
+
+ List<User> users=new ArrayList<User>();
+ List<User> filterdUsers=new ArrayList<User>();
+ BufferedReader in = null;
+
+ try{
+ String url = SystemProperties.getProperty(SystemProperties.AUTH_USER_SERVER);
+ URL obj = new URL(url);
+
+ HttpURLConnection con = (HttpURLConnection) obj.openConnection();
+
+ // optional default is GET
+ con.setRequestMethod("GET");
+ con.setConnectTimeout(3000);
+ con.setReadTimeout(8000);
+
+ StringBuffer response = new StringBuffer();
+
+
+
+ in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));
+ String inputLine;
+ while ((inputLine = in.readLine()) != null)
+ response.append(inputLine);
+
+ JSONObject jObject = new JSONObject(response.toString()); // json
+ JSONArray jsonUsers = jObject.getJSONArray("response"); // get data object
+ for (int i = 0; i < jsonUsers.length(); i++) {
+ JSONObject eachObject = jsonUsers.getJSONObject(i);
+ User eachUser = new User();
+ eachUser.setOrgUserId(eachObject.get("id").toString());// getString("id"));
+ eachUser.setFirstName(eachObject.get("givenName").toString());
+ eachUser.setLastName(eachObject.get("familyName").toString());
+ eachUser.setEmail(eachObject.get("email").toString());
+
+ users.add(eachUser);
+ }
+
+ for(int i = 0 ; i < users.size(); i ++){
+
+ if(Utilities.nvl(user.getFirstName()).length() > 0){
+ if(!user.getFirstName().equalsIgnoreCase(users.get(i).getFirstName())){
+ continue;
+ }
+ }
+ if(Utilities.nvl(user.getLastName()).length() > 0){
+ if(!user.getLastName().equalsIgnoreCase(users.get(i).getLastName())){
+ continue;
+ }
+ }
+ if(Utilities.nvl(user.getOrgUserId()).length() > 0){
+ if(!user.getOrgUserId().equalsIgnoreCase(users.get(i).getOrgUserId())){
+ continue;
+ }
+ }
+ if(Utilities.nvl(user.getEmail()).length() > 0){
+ if(!user.getEmail().equalsIgnoreCase(users.get(i).getEmail())){
+ continue;
+ }
+ }
+
+ filterdUsers.add(users.get(i));
+
+ }
+
+ }catch (Exception e){
+
+ }finally{
+ try {
+ in.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ return filterdUsers;
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallService.java
new file mode 100644
index 00000000..a7a5ad07
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallService.java
@@ -0,0 +1,26 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+
+public interface WebServiceCallService {
+ public boolean verifyRESTCredential(String secretKey, String requestAppName, String requestPassword)throws Exception;
+ /*public String get(String restURL, String restPath);*/
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallServiceImpl.java
new file mode 100644
index 00000000..3e1a1a40
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallServiceImpl.java
@@ -0,0 +1,189 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.core.domain.App;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.CipherUtil;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service("webServiceCallService")
+@Transactional
+public class WebServiceCallServiceImpl implements WebServiceCallService{
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ @Autowired
+ AppService appService;
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WebServiceCallServiceImpl.class);
+
+ /**
+ * Verify REST Credential
+ * @return true if the credential is accepted; else false.
+ */
+ @Override
+ public boolean verifyRESTCredential(String secretKey, String requestAppName, String requestPassword)throws Exception {
+ App app = appService.getDefaultApp();
+ if (app!=null) {
+ String encriptedPwdDB = app.getAppPassword();
+ String appUserName = app.getUsername();
+ String decreptedPwd = CipherUtil.decrypt(encriptedPwdDB, secretKey==null?SystemProperties.getProperty(SystemProperties.Decryption_Key):secretKey);
+ if(decreptedPwd.equals(requestPassword) && appUserName.equals(requestAppName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Getting App information from FN_APP table
+ * @return App domain object, or null if not found.
+ */
+ public App findApp(){
+ List<?> list = null;
+ StringBuffer criteria = new StringBuffer();
+ criteria.append(" where id = 1");
+ list = getDataAccessService().getList(App.class, criteria.toString(), null, null);
+ return (list == null || list.size() == 0) ? null : (App) list.get(0);
+ }
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ /*/
+ @Override
+ public String get(String restURL, String restPath) {
+ String appUserName = "";
+ String appUebKey = "";
+ String decreptedPwd = "";
+ String appName = "";
+ String inputLine = "";
+ String serviceName = "";
+ String loginId = "";
+ StringBuffer jsonResponse = new StringBuffer();
+
+ StopWatch stopWatch = new StopWatch("WebServiceCallServiceImpl.get");
+ stopWatch.start();
+ try {
+ logger.info(EELFLoggerDelegate.metricsLogger, "WebServiceCallServiceImpl.get (" + restPath + ") operation is started.");
+ logger.debug(EELFLoggerDelegate.debugLogger, "WebServiceCallServiceImpl.get (" + restPath + ") operation is started.");
+ loginId = MDC.get("LoginId");
+ appUebKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY);
+ App app = appService.getDefaultApp();
+ if (app!=null) {
+ appName = app.getName();
+ appUserName = app.getUsername();
+ try{
+ decreptedPwd = CipherUtil.decrypt(app.getAppPassword(), SystemProperties.getProperty(SystemProperties.Decryption_Key));
+ } catch(Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in WebServiceCallServiceImpl.get while decrypting the password. Details: " + e.getMessage());
+ }
+ } else {
+ logger.warn(EELFLoggerDelegate.errorLogger, "Unable to locate the app information from the database.");
+ appName = SystemProperties.SERVICE_NAME;
+ }
+
+ //Create the connection object
+ URL obj = new URL(restURL + restPath);
+ HttpURLConnection con = (HttpURLConnection) obj.openConnection();
+ con.setRequestMethod("GET");
+ con.setConnectTimeout(3000);
+ con.setReadTimeout(8000);
+
+ //add request header
+ con.setRequestProperty("username", appUserName);
+ con.setRequestProperty("password", decreptedPwd);
+ con.setRequestProperty("uebkey", appUebKey);
+ con.setRequestProperty(SystemProperties.LOGIN_ID, loginId);
+ con.setRequestProperty(SystemProperties.USERAGENT_NAME, appName);
+ con.setRequestProperty(SystemProperties.ECOMP_REQUEST_ID, MDC.get(MDC_KEY_REQUEST_ID));
+
+ //set MDC context for outgoing audit logging
+ serviceName = String.format("%s:%s.%s", appName, SystemProperties.ECOMP_PORTAL_BE, restPath);
+ MDC.put(Configuration.MDC_SERVICE_NAME, serviceName);
+ MDC.put(Configuration.MDC_REMOTE_HOST, restURL);
+ MDC.put(SystemProperties.MDC_APPNAME, appName);
+ MDC.put(SystemProperties.MDC_REST_PATH, restPath);
+ MDC.put(SystemProperties.MDC_REST_METHOD, "GET");
+
+ int responseCode = con.getResponseCode();
+ logger.info(EELFLoggerDelegate.errorLogger, "Received the response code '" + responseCode + "' while getting the '" + restPath + "' for user: " + loginId);
+
+ BufferedReader in = new BufferedReader(
+ new InputStreamReader(con.getInputStream()));
+
+ while ((inputLine = in.readLine()) != null) {
+ jsonResponse.append(inputLine);
+ }
+ in.close();
+
+ logSecurityMessage(RESULT_ENUM.SUCCESS);
+ logger.debug(EELFLoggerDelegate.debugLogger, restPath + " response: " + jsonResponse.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, "WebServiceCallServiceImpl.get (" + restPath + ") operation is started.");
+ } catch(UrlAccessRestrictedException e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Authentication exception occurred in WebServiceCallServiceImpl.get (" + restPath + "). Details: " + e.getMessage());
+ logSecurityMessage(RESULT_ENUM.FAILURE);
+ } catch(Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in WebServiceCallServiceImpl.get (" + restPath + "). Details: " + e.getMessage());
+ logSecurityMessage(RESULT_ENUM.FAILURE);
+ } finally {
+ if (stopWatch.isRunning()) stopWatch.stop();
+ MDC.put(SystemProperties.MDC_TIMER, stopWatch.getTotalTimeMillis() + "ms");
+ logger.info(EELFLoggerDelegate.metricsLogger, "WebServiceCallServiceImpl.get (" + restPath + ") operation is completed.");
+
+ //clear the temporary MDC context values
+ MDC.remove(SystemProperties.MDC_TIMER);
+ MDC.remove(SystemProperties.MDC_REST_METHOD);
+ MDC.remove(SystemProperties.MDC_REST_PATH);
+ MDC.remove(SystemProperties.MDC_APPNAME);
+ MDC.remove(Configuration.MDC_REMOTE_HOST);
+ MDC.remove(Configuration.MDC_SERVICE_NAME);
+ }
+
+ return jsonResponse.toString();
+ }
+
+ //Handles all the outgoing rest/ueb messages.
+ public void logSecurityMessage(RESULT_ENUM isSuccess) {
+ String additionalInfo = "";
+ String protocol = "HTTP";
+ String loginId = MDC.get("LoginId");
+ additionalInfo = String.format("Rest API=%s, Rest Method=%s, App-Name=%s, Request-URL=%s",
+ MDC.get(SystemProperties.MDC_REST_PATH), MDC.get(SystemProperties.MDC_REST_METHOD),
+ MDC.get(SystemProperties.MDC_APPNAME), MDC.get(Configuration.MDC_REMOTE_HOST));
+
+ logger.info(EELFLoggerDelegate.auditLogger, AuditLogFormatter.getInstance().createMessage(
+ protocol, SecurityEventTypeEnum.OUTGOING_REST_MESSAGE.name(), loginId, SystemProperties.SERVICE_NAME,
+ isSuccess.name(), additionalInfo));
+ }
+ /**/
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/FusionService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/FusionService.java
new file mode 100644
index 00000000..34649ee1
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/FusionService.java
@@ -0,0 +1,27 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service.support;
+
+
+import org.openecomp.portalsdk.core.FusionObject;
+
+public class FusionService implements FusionObject {
+ /** Logger for this class and subclasses */
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocator.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocator.java
new file mode 100644
index 00000000..5858c3fa
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocator.java
@@ -0,0 +1,27 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service.support;
+
+import javax.naming.directory.DirContext;
+
+
+public interface ServiceLocator {
+ DirContext getDirContext(String initialContextFactory, String providerUrl, String securityPrincipal);
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocatorImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocatorImpl.java
new file mode 100644
index 00000000..e7437835
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocatorImpl.java
@@ -0,0 +1,74 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.service.support;
+
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+import javax.naming.ldap.InitialLdapContext;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.stereotype.Service;
+
+/**
+ * This class implements the J2EE service locator pattern. It provides lookup
+ * facilities for various services. Currenttly LDAP (pre-v3) is supported
+ */
+@Service("serviceLocator")
+public class ServiceLocatorImpl implements ServiceLocator {
+
+ private Context context; // JNDI context (not currently in use)
+ private Context rootContext; // Java env root context (not currently in use)
+ private DirContext dirContext; // LDAP DIR context
+ private InitialLdapContext ldapContext; // LDAP context LDAPv3-style (not currently in use)
+
+
+ // cannot directly instantiate
+ public ServiceLocatorImpl() {}
+
+ // Get an LDAP directory context
+ public DirContext getDirContext(String initialContextFactory, String providerUrl, String securityPrincipal) {
+
+ if (dirContext == null) {
+
+ Properties properties = new Properties();
+ properties.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
+ properties.put(Context.PROVIDER_URL, providerUrl);
+ properties.put(Context.SECURITY_PRINCIPAL, securityPrincipal);
+
+ try {
+ dirContext = new InitialDirContext(properties);
+ }
+ catch (NamingException ne) {
+ logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while creating an Initial Directory Context: " + ne.getMessage());
+ logger.error(EELFLoggerDelegate.errorLogger, "Explanation: " + ne.getExplanation());
+ }
+ }
+
+ return dirContext;
+ }
+
+ /** Logger for this class and subclasses */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ServiceLocatorImpl.class);
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CacheManager.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CacheManager.java
new file mode 100644
index 00000000..e26ac884
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CacheManager.java
@@ -0,0 +1,43 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.util;
+
+import org.openecomp.portalsdk.core.objectcache.jcs.JCSCacheManager;
+import org.springframework.context.annotation.Configuration;
+@Configuration
+public class CacheManager extends JCSCacheManager {
+ public CacheManager() {
+
+ }
+
+ /* The following can be customized for your application to cache the appropriate data upon application startup. The provided
+ example retrieves a list of sample lookup data and puts the list in the Cache Manager. To retrieve that data, simply call the
+ Cache Manager's getObject(String key) method which will return an Object instance. To put additional data in the Cache Manager
+ outside of application startup, call the Cache Manager's putObject(String key, Object objectToCache) method. */
+ public void loadLookUpCache() {
+ /*
+ List<Role> result = (List<Role>)getDataAccessService().getList(Role.class,null);
+
+ if (result != null) {
+ putObject("lookupRoles", result);
+ }*/
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CipherUtil.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CipherUtil.java
new file mode 100644
index 00000000..0eec9295
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CipherUtil.java
@@ -0,0 +1,125 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.util;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+
+import org.apache.commons.codec.binary.Base64;
+
+public class CipherUtil {
+
+ private final static String key = "AGLDdG4D04BKm2IxIWEr8o==!";
+
+ /**
+ * @param plainText
+ * @param secretKey
+ * @return encrypted version of plain text.
+ * @throws Exception
+ */
+ public static String encrypt(String plainText, String secretKey) throws Exception{
+ byte[] rawKey;
+ String encryptedString;
+ SecretKeySpec sKeySpec;
+ byte[] encryptText = plainText.getBytes("UTF-8");
+ Cipher cipher;
+ rawKey = Base64.decodeBase64(secretKey);
+ sKeySpec = new SecretKeySpec(rawKey, "AES");
+ cipher = Cipher.getInstance("AES");
+ cipher.init(Cipher.ENCRYPT_MODE, sKeySpec);
+ encryptedString = Base64.encodeBase64String(cipher.doFinal(encryptText));
+
+ return encryptedString;
+ }
+
+ /**
+ *
+ * @param plainText
+ * @return Encrypted Text
+ * @throws Exception
+ */
+ public static String encrypt(String plainText) throws Exception
+ {
+ return CipherUtil.encrypt(plainText,key);
+ }
+
+ /**
+ * @param encryptedText
+ * @param secretKey
+ * @return plain text version of encrypted text
+ * @throws Exception
+ */
+ public static String decrypt(String encryptedText, String secretKey) throws Exception {
+ Cipher cipher;
+ String encryptedString;
+ byte[] encryptText = null;
+ byte[] rawKey;
+ SecretKeySpec sKeySpec;
+
+ rawKey = Base64.decodeBase64(secretKey);
+ sKeySpec = new SecretKeySpec(rawKey, "AES");
+ encryptText = Base64.decodeBase64(encryptedText.getBytes("UTF-8"));
+ cipher = Cipher.getInstance("AES");
+ cipher.init(Cipher.DECRYPT_MODE, sKeySpec);
+ encryptedString = new String(cipher.doFinal(encryptText));
+
+ return encryptedString;
+ }
+
+ /**
+ * @param encryptedText
+ * @return Decrypted Text
+ * @throws Exception
+ */
+ public static String decrypt(String encryptedText) throws Exception
+ {
+ return CipherUtil.decrypt(encryptedText,key);
+ }
+
+
+ public static void main(String[] args) throws Exception {
+
+ String password = "Welcome123";
+ String encrypted;
+ String decrypted;
+
+ if (args.length != 2) {
+ System.out.println("Default password testing... ");
+ System.out.println("Plain password: " + password);
+ encrypted = encrypt(password);
+ System.out.println("Encrypted password: " + encrypted);
+ decrypted = decrypt(encrypted);
+ System.out.println("Decrypted password: " + decrypted);
+ } else {
+ String whatToDo = args[0];
+ if (whatToDo.equalsIgnoreCase("d")) {
+ encrypted = args[1];
+ System.out.println("Encrypted Text: " + encrypted);
+ decrypted = decrypt(encrypted);
+ System.out.println("Decrypted Text: " + decrypted);
+ } else {
+ decrypted = args[1];
+ System.out.println("Plain Text: " + decrypted);
+ encrypted = encrypt(decrypted);
+ System.out.println("Encrypted Text" + encrypted);
+ }
+ }
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncDecUtilTest.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncDecUtilTest.java
new file mode 100644
index 00000000..46a24533
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncDecUtilTest.java
@@ -0,0 +1,112 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.util;
+import java.security.AlgorithmParameters;
+import java.security.SecureRandom;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.PBEKeySpec;
+import javax.crypto.spec.SecretKeySpec;
+
+import org.apache.commons.codec.binary.Base64;
+
+public class EncDecUtilTest {
+
+ private static final String password = "test";
+ private static final String salt = "r n�HN~��|f��X�" ;
+ private static int pswdIterations = 65536 ;
+ private static int keySize = 256;
+ private byte[] ivBytes;
+
+ public String encrypt(String plainText) throws Exception {
+
+ //get salt
+ //salt = generateSalt();
+ byte[] saltBytes = salt.getBytes("UTF-8");
+
+ // Derive the key
+ SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
+ PBEKeySpec spec = new PBEKeySpec(
+ password.toCharArray(),
+ saltBytes,
+ pswdIterations,
+ keySize
+ );
+
+ SecretKey secretKey = factory.generateSecret(spec);
+ SecretKeySpec secret = new SecretKeySpec(secretKey.getEncoded(), "AES");
+
+ //encrypt the message
+ Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ cipher.init(Cipher.ENCRYPT_MODE, secret);
+ AlgorithmParameters params = cipher.getParameters();
+ ivBytes = params.getParameterSpec(IvParameterSpec.class).getIV();
+ byte[] encryptedTextBytes = cipher.doFinal(plainText.getBytes("UTF-8"));
+ return new Base64().encodeAsString(encryptedTextBytes);
+ }
+
+ @SuppressWarnings("static-access")
+ public String decrypt(String encryptedText) throws Exception {
+
+ byte[] saltBytes = salt.getBytes("UTF-8");
+ byte[] encryptedTextBytes = new Base64().decodeBase64(encryptedText);
+
+ // Derive the key
+ SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
+ PBEKeySpec spec = new PBEKeySpec(
+ password.toCharArray(),
+ saltBytes,
+ pswdIterations,
+ keySize
+ );
+
+ SecretKey secretKey = factory.generateSecret(spec);
+ SecretKeySpec secret = new SecretKeySpec(secretKey.getEncoded(), "AES");
+
+ // Decrypt the message
+ Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ cipher.init(Cipher.DECRYPT_MODE, secret, new IvParameterSpec(ivBytes));
+
+
+ byte[] decryptedTextBytes = null;
+ try {
+ decryptedTextBytes = cipher.doFinal(encryptedTextBytes);
+ } catch (IllegalBlockSizeException e) {
+ e.printStackTrace();
+ } catch (BadPaddingException e) {
+ e.printStackTrace();
+ }
+
+ return new String(decryptedTextBytes);
+ }
+
+ public String generateSalt() {
+ SecureRandom random = new SecureRandom();
+ byte bytes[] = new byte[20];
+ random.nextBytes(bytes);
+ String s = new String(bytes);
+ return s;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncTest.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncTest.java
new file mode 100644
index 00000000..865731db
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncTest.java
@@ -0,0 +1,39 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.util;
+
+public class EncTest {
+
+
+ public static void main(String[] args) {
+ String secretKey = "AGLDdG4D04BKm2IxIWEr8o==";
+ String value1= "AppPassword!1";
+ try {
+ String encryptedValue1= CipherUtil.encrypt(value1, secretKey);
+ System.out.println(encryptedValue1);
+ String decryptedValue1 = CipherUtil.decrypt(encryptedValue1, secretKey);
+ System.out.println(decryptedValue1);
+ } catch (Exception e) {
+ // Invalid key would throw an exception.
+ e.printStackTrace();
+ }
+
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/JSONUtil.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/JSONUtil.java
new file mode 100644
index 00000000..6b849e81
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/JSONUtil.java
@@ -0,0 +1,56 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.portalsdk.core.domain.User;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class JSONUtil {
+ public static String convertResponseToJSON(String response) throws JsonProcessingException{
+ ObjectMapper mapper = new ObjectMapper();
+ Map<String, String> responseMap = new HashMap<String, String>();
+ responseMap.put("response", response);
+ response = mapper.writeValueAsString(responseMap);
+ return response;
+ }
+
+ public static User mapToDomainUser(User domainUser, User editUser) {
+ domainUser.setOrgId(editUser.getOrgId());
+ domainUser.setManagerId(editUser.getManagerId());
+ domainUser.setFirstName(editUser.getFirstName());
+ domainUser.setMiddleInitial(editUser.getMiddleInitial());
+ domainUser.setLastName(editUser.getLastName());
+ domainUser.setPhone(editUser.getPhone());
+ domainUser.setEmail(editUser.getEmail());
+ domainUser.setHrid(editUser.getHrid());
+ domainUser.setOrgUserId(editUser.getOrgUserId());
+ domainUser.setOrgCode(editUser.getOrgCode());
+ domainUser.setOrgManagerUserId(editUser.getOrgManagerUserId());
+ domainUser.setJobTitle(editUser.getJobTitle());
+ domainUser.setLoginId(editUser.getLoginId());
+ domainUser.setActive(editUser.getActive());
+ return domainUser;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/SystemProperties.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/SystemProperties.java
new file mode 100644
index 00000000..8bc6d7a1
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/SystemProperties.java
@@ -0,0 +1,279 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.util;
+
+import javax.servlet.ServletContext;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+
+/**
+ * SystemProperties contains a list of constants used throughout portions of the
+ * application. Populated by Spring from multiple configuration files.
+ *
+ * Should be used like this:
+ *
+ * <pre>
+ *
+ * &#64;Autowired
+ * SystemProperties systemProperties;
+ * </pre>
+ */
+@Configuration
+@PropertySource(value = { "${container.classpath:}/WEB-INF/conf/system.properties",
+ "${container.classpath:}/WEB-INF/fusion/conf/fusion.properties",
+ "${container.classpath:}/WEB-INF/conf/sql.properties" })
+public class SystemProperties {
+
+ private static Environment environment;
+
+ public SystemProperties() {
+ }
+
+ protected Environment getEnvironment() {
+ return environment;
+ }
+
+ @Autowired
+ public void setEnvironment(Environment environment) {
+ SystemProperties.environment = environment;
+ }
+
+ public ServletContext getServletContext() {
+ return servletContext;
+ }
+
+ public void setServletContext(ServletContext servletContext) {
+ this.servletContext = servletContext;
+ }
+
+
+ public static boolean containsProperty(String key) {
+ return environment.containsProperty(key);
+ }
+
+ public static String getProperty(String key) {
+ if (environment!=null) {
+ return environment.getRequiredProperty(key);
+ } else {
+ return "";
+ }
+ }
+
+ // method created to get around JSTL 1.0 limitation of not being able to
+ // access a static method of a bean
+ public String getApplicationName() {
+ return getProperty(APPLICATION_NAME);
+ }
+
+ public String getAppDisplayName() {
+ return getProperty(APP_DISPLAY_NAME);
+ }
+
+ private ServletContext servletContext;
+
+ // keys used to reference values in the system properties file
+ public static final String DOMAIN_CLASS_LOCATION = "domain_class_location";
+ public static final String DEFAULT_ERROR_MESSAGE = "default_error_message";
+
+ public static final String AUTHENTICATION_MECHANISM = "authentication_mechanism";
+
+ public static final String APPLICATION_NAME = "application_name";
+ public static final String HIBERNATE_CONFIG_FILE_PATH = "hibernate_config_file_path";
+ public static final String APPLICATION_USER_ID = "application_user_id";
+
+ public static final String POST_INITIAL_CONTEXT_FACTORY = "post_initial_context_factory";
+ public static final String POST_PROVIDER_URL = "post_provider_url";
+ public static final String POST_SECURITY_PRINCIPAL = "post_security_principal";
+ public static final String POST_MAX_RESULT_SIZE = "post_max_result_size";
+ public static final String POST_DEFAULT_ROLE_ID = "post_default_role_id";
+
+ public static final String FILES_PATH = "files_path";
+ public static final String TEMP_PATH = "temp_path";
+
+ public static final String NUM_UPLOAD_FILES = "num_upload_files";
+
+ public static final String SYS_ADMIN_ROLE_ID = "sys_admin_role_id";
+
+ public static final String SYS_ADMIN_ROLE_FUNCTION_DELETE_FROM_UI = "sys_admin_role_function_delete_from_ui";
+ public static final String USER_NAME = "user_name";
+ public static final String FIRST_NAME = "first_name";
+ public static final String LAST_NAME = "last_name";
+ public static final String APP_DISPLAY_NAME = "app_display_name";
+ // Application base URL is a proper prefix of the on-boarding URL
+ public static final String APP_BASE_URL = "app_base_url";
+
+ public static final String MENU_PROPERTIES_FILE_LOCATION = "menu_properties_file_location";
+ public static final String MENU_QUERY_NAME = "menu_query_name";
+ public static final String APPLICATION_MENU_SET_NAME = "application_menu_set_name";
+ public static final String APPLICATION_MENU_ATTRIBUTE_NAME = "application_menu_attribute_name";
+ public static final String APPLICATION_MENU_PROPERTIES_NAME = "application_menu_properties_name";
+ public static final String BUSINESS_DIRECT_MENU_SET_NAME = "business_direct_menu_set_name";
+ public static final String BUSINESS_DIRECT_MENU_ATTRIBUTE_NAME = "business_direct_menu_attribute_name";
+ public static final String BUSINESS_DIRECT_MENU_PROPERTIES_NAME = "business_direct_menu_properties_name";
+ public static final String RAPTOR_CONFIG_FILE_PATH = "raptor_config_file_path";
+ public static final String HOMEPAGE_DATA_CALLBACK_CLASS = "homepage_data_callback_class";
+ public static final String ERROR_EMAIL_DISTRIBUTION = "error_email_distribution";
+ public static final String ERROR_EMAIL_SOURCE_ADDRESS = "error_email_source_address";
+ public static final String ERROR_EMAIL_SUBJECT_LINE = "error_email_subject_line";
+ public static final String PROFILE_SEARCH_REPORT_ID = "profile_search_report_id";
+ public static final String CALLABLE_PROFILE_SEARCH_REPORT_ID = "callable_profile_search_report_id";
+ public static final String CLUSTERED = "clustered";
+
+ public static final String USER_ATTRIBUTE_NAME = "user_attribute_name";
+ public static final String ROLES_ATTRIBUTE_NAME = "roles_attribute_name";
+ public static final String ROLE_FUNCTIONS_ATTRIBUTE_NAME = "role_functions_attribute_name";
+ public static final String CLIENT_DEVICE_ATTRIBUTE_NAME = "client_device_attribute_name";
+ public static final String CLIENT_DEVICE_EMULATION = "client_device_emulation";
+ public static final String CLIENT_DEVICE_TYPE_TO_EMULATE = "client_device_type_to_emulate";
+ // File generation - Document
+ public static final String TEMPLATES_PATH = "templates_path";
+ public static final String DOCUMENT_XML_ENCODING = "document_xml_encoding";
+
+ // Transaction
+ public static final String ROUTING_DATASOURCE_KEY = "routing_datasource_key";
+
+ // Document Library keys
+ public static final String DOCLIB_ADMIN_ROLE_ID = "doclib_admin_role_id";
+ public static final String DOCLIB_USER_ROLE_ID = "doclib_user_role_id";
+
+ public static final String SYSTEM_PROPERTIES_FILENAME = "system.properties";
+ public static final String FUSION_PROPERTIES_FILENAME = "fusion.properties";
+ public static final String SUCCESS_TASKS_PROPERTIES_FILENAME = "success_tasks.properties";
+
+ // login error message keys
+ public static final String MESSAGE_KEY_LOGIN_ERROR_COOKIE_EMPTY = "login.error.hrid.empty";
+ public static final String MESSAGE_KEY_LOGIN_ERROR_HEADER_EMPTY = "login.error.header.empty";
+ public static final String MESSAGE_KEY_LOGIN_ERROR_USER_INACTIVE = "login.error.user.inactive";
+ public static final String MESSAGE_KEY_LOGIN_ERROR_USER_NOT_FOUND = "login.error.hrid.not-found";
+ public static final String MESSAGE_KEY_LOGIN_ERROR_APPLICATION_LOCKED = "login.error.application.locked";
+ public static final String MESSAGE_KEY_AUTOLOGIN_NONE = "webphone.autoimport.nouser";
+ public static final String MESSAGE_KEY_AUTOLOGIN_MULTIPLE = "webphone.autoimport.multiple";
+
+ // Application Mobile capability
+ public static final String MOBILE_ENABLE = "mobile_enable";
+
+ public static final String DATABASE_TIME_ZONE = "db.time_zone";
+
+ public static final String AUTO_USER_IMPORT_ENABLE = "auto_user_import_enable";
+ public static final String AUTO_USER_IMPORT_ROLE = "auto_user_import_role";
+
+ public static final String ITRACKER_EMAIL_SOURCE_ADDRESS = "itracker_email_source_address";
+ public static final String ITRACKER_EMAIL_DISTRIBUTION = "itracker_email_distribution";
+ public static final String ITRACKER_SYSTEM_USER = "itracker_system_user_id";
+
+ public static final String MAIL_SERVER_HOST = "mail_server_host";
+ public static final String MAIL_SERVER_PORT = "mail_server_port";
+
+ // Routing Data Source keys
+ public static final String ROUTING_DATASOURCE_KEY_NON_XA = "NON-XA";
+ public static final String ROUTING_DATASOURCE_KEY_XA = "XA";
+ public static final String QUARTZ_JOB_ENABLED = "quartz_job_enable";
+ public static final String WORKFLOW_EMAIL_SENDER = "workflow_email_sender";
+ public static final String DROOLS_GUVNOR_HOME = "drools.guvnor.home";
+
+ // Hibernate Config
+ public static final String HB_DIALECT = "hb.dialect";
+ public static final String HB_SHOW_SQL = "hb.show_sql";
+ // DataSource
+ public static final String DB_DRIVER = "db.driver";
+ public static final String DB_CONNECTIONURL = "db.connectionURL";
+ public static final String DB_USERNAME = "db.userName";
+ public static final String DB_PASSWOR = "db.password";
+ public static final String DB_MIN_POOL_SIZE = "db.min_pool_size";
+ public static final String DB_MAX_POOL_SIZE = "db.max_pool_size";
+ public static final String IDLE_CONNECTION_TEST_PERIOD = "hb.idle_connection_test_period";
+
+ public static final String MYLOGINS_FEED_CRON = "mylogins_feed_cron";
+ public static final String SESSIONTIMEOUT_FEED_CRON = "sessiontimeout_feed_cron";
+ public static final String LOG_CRON = "log_cron";
+
+ public static final String DB_ENCRYPT_FLAG = "db.encrypt_flag";
+
+ // Decryption Key
+ public static final String Decryption_Key = "decryption_key";
+
+ // Logging/Audit Fields
+ public static final String MDC_APPNAME = "AppName";
+ public static final String MDC_REST_PATH = "RestPath";
+ public static final String MDC_REST_METHOD = "RestMethod";
+ public static final String INSTANCE_UUID = "instance_uuid";
+ public static final String MDC_CLASS_NAME = "ClassName";
+ public static final String MDC_LOGIN_ID = "LoginId";
+ public static final String MDC_TIMER = "Timer";
+ public static final String SDK_NAME = "ECOMP_SDK";
+ public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID";
+ public static final String PARTNER_NAME = "PartnerName";
+ public static final String FULL_URL = "Full-URL";
+ public static final String AUDITLOG_BEGIN_TIMESTAMP = "AuditLogBeginTimestamp";
+ public static final String AUDITLOG_END_TIMESTAMP = "AuditLogEndTimestamp";
+ public static final String METRICSLOG_BEGIN_TIMESTAMP = "MetricsLogBeginTimestamp";
+ public static final String METRICSLOG_END_TIMESTAMP = "MetricsLogEndTimestamp";
+ public static final String CLIENT_IP_ADDRESS = "ClientIPAddress";
+ public static final String STATUS_CODE = "StatusCode";
+ public static final String RESPONSE_CODE = "ResponseCode";
+ public static final String TARGET_ENTITY = "TargetEntity"; //Component or sub component name
+ public static final String TARGET_SERVICE_NAME = "TargetServiceName"; //API or operation name
+
+ // Logging Compliance
+ public static final String DOUBLE_WHITESPACE_SEPARATOR = " ";
+ public static final String SINGLE_WHITESPACE_SEPARATOR = " ";
+ public static final String SINGLE_QUOTE = "'";
+ public static final String NA = "N/A";
+ public static final String UNKNOWN = "Unknown";
+ public static final String SECURITY_LOG_TEMPLATE = "Protocol:{0} Security-Event-Type:{1} Login-ID:{2} {3}";
+ public static final String ECOMP_PORTAL_BE = "ECOMP_PORTAL_BE";
+ public static final String PROTOCOL = "PROTOCOL";
+ public static final String SECURIRY_EVENT_TYPE = "SECURIRY_EVENT_TYPE";
+ public static final String LOGIN_ID = "LOGIN_ID";
+ public static final String ACCESSING_CLIENT = "ACCESSING_CLIENT";
+ public static final String RESULT_STR = "RESULT";
+ public static final String ECOMP_PORTAL_FE = "ECOMP_PORTAL_FE";
+ public static final String ADDITIONAL_INFO = "ADDITIONAL_INFO";
+ public static final String INTERFACE_NAME = "INTERFACE_NAME";
+ public static final String USERAGENT_NAME = "user-agent";
+
+ // Protocols
+ public static final String HTTP = "HTTP";
+ public static final String HTTPS = "HTTPS";
+ public static final String SSO_VALUE = "sso";
+
+ public enum RESULT_ENUM {
+ SUCCESS, FAILURE
+ }
+
+ public enum SecurityEventTypeEnum {
+ FE_LOGIN_ATTEMPT, FE_LOGOUT, SSO_LOGIN_ATTEMPT_PHASE_1, SSO_LOGIN_ATTEMPT_PHASE_2, SSO_LOGOUT, LDAP_PHONEBOOK_USER_SEARCH, INCOMING_REST_MESSAGE, OUTGOING_REST_MESSAGE, REST_AUTHORIZATION_CREDENTIALS_MODIFIED, ECOMP_PORTAL_USER_MODIFIED, ECOMP_PORTAL_USER_ADDED, ECOMP_PORTAL_USER_REMOVED, ECOMP_PORTAL_WIDGET, INCOMING_UEB_MESSAGE, ECOMP_PORTAL_HEALTHCHECK
+ }
+
+ // Menu
+ public static final String CONTACT_US_LINK = "contact_us_link";
+
+ //Left Menu
+ public static final String LEFT_MENU_PARENT = "parentList";
+ public static final String LEFT_MENU_CHILDREND = "childItemList";
+
+ // URL of the portal site that provides the shared-context REST service
+ public static final String ECOMP_SHARED_CONTEXT_REST_URL = "ecomp_shared_context_rest_url";
+
+ public static final String AUTH_USER_SERVER = "authenticate_user_server";
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/UsageUtils.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/UsageUtils.java
new file mode 100644
index 00000000..a8cc7fd7
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/UsageUtils.java
@@ -0,0 +1,92 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.util;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.core.command.UserRowBean;
+import org.openecomp.portalsdk.core.domain.User;
+
+public class UsageUtils {
+ @SuppressWarnings("rawtypes")
+ public static ArrayList<UserRowBean> getActiveUsers(HashMap activeUsers) {
+ ArrayList<UserRowBean> rows = new ArrayList<UserRowBean>();
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+
+ for(Iterator i = activeUsers.keySet().iterator(); i.hasNext(); ){
+ String sessionId = (String)i.next();
+ HttpSession session = (HttpSession)activeUsers.get(sessionId);
+ User userBean = (User)session.getAttribute("user");
+ //
+ // Not all sessions will be valid logins
+ // Skip those ones
+ //
+ if(null == userBean)
+ continue;
+
+ UserRowBean userRow = new UserRowBean();
+ userRow.setFirstName(userBean.getFirstName());
+ userRow.setLastName(userBean.getLastName());
+ userRow.setEmail(userBean.getEmail());
+ userRow.setId(userBean.getId());
+ userRow.setSessionId(sessionId);
+ userRow.setLoginTime(sdf.format(new Date(session.getCreationTime())));
+ userRow.setLastLoginTime(sdf.format(userBean.getLastLoginDate()));
+
+ //
+ // Calculate the last time and time remaining for these sessions.
+ //
+ int sessionLength = session.getMaxInactiveInterval();
+ long now = new java.util.Date().getTime();
+ long lastAccessed = (now - session.getLastAccessedTime()) / 1000;
+ long lengthInactive = (now - session.getLastAccessedTime());
+ long minutesRemaining = sessionLength - (lengthInactive / 1000);
+
+ userRow.setLastAccess((lastAccessed / 60) + ":" + String.format("%02d", (lastAccessed % 60)));
+ userRow.setRemaining((minutesRemaining / 60) + ":" + String.format("%02d", (minutesRemaining % 60)));
+
+ rows.add(userRow);
+ }
+
+ return rows;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public static ArrayList<UserRowBean> getActiveUsersAfterDelete(HashMap activeUsers, final java.lang.Object data) {
+ return getActiveUsers(deleteSession(activeUsers,data));
+
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static HashMap deleteSession(HashMap activeUsers, Object data) {
+ String sessionId = ((UserRowBean)data).getSessionId();
+ HttpSession session = (HttpSession)activeUsers.get(sessionId);
+ session.invalidate();
+ activeUsers.remove(sessionId);
+
+ return activeUsers;
+ }
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/YamlUtils.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/YamlUtils.java
new file mode 100644
index 00000000..58bcb252
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/YamlUtils.java
@@ -0,0 +1,69 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.util;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Map;
+
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.representer.Representer;
+
+public class YamlUtils {
+
+ static Yaml yaml;
+
+ static {
+
+ Representer representer = new Representer();
+ yaml = new Yaml(representer);
+
+ }
+
+ public static void writeYamlFile(String filePath, String fileName,
+ Map<String, Object> model) throws IOException {
+ FileWriter writer = new FileWriter(filePath + File.separator + fileName);
+ yaml.dump(model, writer);
+ writer.close();
+ }
+
+ public static String returnYaml(
+ Map<String, Object> model) throws IOException {
+
+ return yaml.dump(model);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Map<String, Object> readYamlFile(
+ String filePath, String fileName) throws FileNotFoundException,
+ IOException {
+ FileReader reader = new FileReader(filePath + File.separator + fileName);
+
+ Map<String,Object> callFlowBs = (Map<String,Object>)yaml.load(reader);
+ reader.close();
+ return callFlowBs;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/PeerBroadcastSocket.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/PeerBroadcastSocket.java
new file mode 100644
index 00000000..ddf08c8f
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/PeerBroadcastSocket.java
@@ -0,0 +1,104 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.web.socket;
+
+import java.io.IOException;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.websocket.OnClose;
+import javax.websocket.OnMessage;
+import javax.websocket.OnOpen;
+import javax.websocket.Session;
+import javax.websocket.server.ServerEndpoint;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@ServerEndpoint("/contact")
+public class PeerBroadcastSocket {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PeerBroadcastSocket.class);
+
+ public static Map<String, Object> channelMap = new Hashtable<String, Object>();
+ public Map<String, String> sessionMap = new Hashtable<String, String>();
+ ObjectMapper mapper = new ObjectMapper();
+
+ @OnMessage
+ public void message(String message, Session session) {
+ try {
+ // JSONObject jsonObject = new JSONObject(message);
+ @SuppressWarnings("unchecked")
+ Map<String, Object> jsonObject = mapper.readValue(message, Map.class);
+ try {
+ Object from = jsonObject.get("from");
+ if (from != null) {
+ channelMap.put(from.toString(), session);
+ sessionMap.put(session.getId(), from.toString());
+ }
+ } catch (Exception je) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Failed to read value" + je.getMessage());
+ }
+
+ try {
+ Object to = jsonObject.get("to");
+ if (to == null)
+ return;
+ Object toSessionObj = channelMap.get(to);
+ if (toSessionObj != null) {
+ Session toSession = null;
+ toSession = (Session) toSessionObj;
+ toSession.getBasicRemote().sendText(message);
+ }
+
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Failed to send text" + ex.getMessage());
+ }
+
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Failed" + ex.getMessage());
+ }
+
+ }
+
+ @OnOpen
+ public void open(Session session) {
+ logger.info(EELFLoggerDelegate.debugLogger, "Channel opened");
+ }
+
+ @OnClose
+ public void close(Session session) {
+ String channel = sessionMap.get(session.getId());
+ if (channel != null) {
+ Object sessObj = channelMap.get(channel);
+ if (sessObj != null) {
+ try {
+ ((Session) sessObj).close();
+ } catch (IOException e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Failed to close" + e.getMessage());
+ }
+ }
+ channelMap.remove(channel);
+ }
+ logger.info(EELFLoggerDelegate.debugLogger, "Channel closed");
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/WebRTCSocket.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/WebRTCSocket.java
new file mode 100644
index 00000000..810cba5c
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/WebRTCSocket.java
@@ -0,0 +1,143 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.web.socket;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.websocket.OnClose;
+import javax.websocket.OnMessage;
+import javax.websocket.OnOpen;
+import javax.websocket.Session;
+import javax.websocket.server.ServerEndpoint;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@ServerEndpoint("/webrtc")
+public class WebRTCSocket {
+
+
+ public static Map<String,Hashtable<String,Object[]>> channelMap = new Hashtable<String,Hashtable<String,Object[]>>();
+ public Map<String,String> sessionMap = new Hashtable<String,String>();
+ ObjectMapper mapper = new ObjectMapper();
+
+
+ @OnMessage
+ public void message(String message, Session session) {
+ try {
+ //JSONObject jsonObject = new JSONObject(message);
+ @SuppressWarnings("unchecked")
+ Map<String,Object> jsonObject = mapper.readValue(message, Map.class);
+ try {
+ Object isOpen = jsonObject.get("open");
+ if(isOpen != null && (Boolean)isOpen == true) {
+ String channel = (String) jsonObject.get("channel");
+ Object value = channelMap.get(channel);
+ Hashtable<String,Object[]> sourceDestMap = null;
+ if(value == null)
+ sourceDestMap = new Hashtable<String,Object[]>();
+ else
+ sourceDestMap = (Hashtable<String,Object[]>) value;
+
+ sourceDestMap.put(session.getId(), new Object[]{session});
+ channelMap.put(channel, sourceDestMap);
+ sessionMap.put(session.getId(), channel);
+
+
+ }
+ }
+ catch (Exception je) {
+ je.printStackTrace();
+ }
+
+ try{
+
+ Object dataObj = jsonObject.get("data");
+ if(dataObj == null)
+ return;
+ Map<String,Object> dataMapObj = ( Map<String,Object>)dataObj;
+ //Object thisUserId = dataMapObj.get("userid");
+ String channel = null;
+ try{
+ Object channelObj = dataMapObj.get("sessionid");
+ if(channelObj != null)
+ channel = (String) channelObj;
+ else
+ channel = (String) jsonObject.get("channel");
+ }
+ catch(Exception json) {
+ json.printStackTrace();
+ }
+
+ /*
+ JSONObject dataMapObj = (JSONObject)dataObj;
+ Object thisUserId = dataMapObj.get("userid");
+ String channel = (String) dataMapObj.get("sessionid");
+ Hashtable<String,Object> sourceDestMap = sessionMap.get(channel);
+
+ if(thisUserId != null && sourceDestMap.get((String)thisUserId) == null) {
+ sourceDestMap.put((String)thisUserId, new Object[] {message, session});
+ }
+
+ for(String userId : sourceDestMap.keySet()){
+ if(!userId.equals(thisUserId)) {
+ Session otherSession = (Session) ((Object[])sourceDestMap.get(userId))[1];
+ otherSession.getBasicRemote().sendText(message);
+ }
+ }
+ */
+
+ Hashtable<String,Object[]> sourceDestMap = channelMap.get(channel);
+ if(sourceDestMap != null)
+ for(String id : sourceDestMap.keySet()){
+ if(!id.equals(session.getId())) {
+ Session otherSession = (Session) ((Object[])sourceDestMap.get(id))[0];
+ if(otherSession.isOpen())
+ otherSession.getBasicRemote().sendText(mapper.writeValueAsString(dataObj));
+ }
+
+ }
+ }
+ catch (Exception je) {
+ je.printStackTrace();
+ }
+
+ }
+ catch (Exception je) {
+ je.printStackTrace();
+ }
+ //System.out.println("Message received:" + message);
+ }
+
+ @OnOpen
+ public void open(Session session) {
+ // System.out.println("Channel opened");
+ }
+
+ @OnClose
+ public void close(Session session) {
+ String channel = sessionMap.get(session.getId());
+ if (channel != null) {
+ channelMap.remove(channel);
+ }
+ // System.out.println("Channel closed");
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/AppUtils.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/AppUtils.java
new file mode 100644
index 00000000..170d87cb
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/AppUtils.java
@@ -0,0 +1,195 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.web.support;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.sql.DataSource;
+
+import org.hibernate.Session;
+import org.openecomp.portalsdk.core.exception.SessionExpiredException;
+import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public class AppUtils {
+
+ private static DataAccessService dataAccessService;
+
+ private static AbstractCacheManager cacheManager;
+
+ private static boolean applicationLocked;
+
+ private static Hashtable feedback = new Hashtable();
+
+ private static DataSource datasource;
+
+ public static DataSource getDatasource() {
+ return datasource;
+ }
+
+ @Autowired
+ public void setDatasource(DataSource datasource) {
+ AppUtils.datasource = datasource;
+ }
+
+ public AppUtils() {
+ }
+
+ public static HttpSession getSession(HttpServletRequest request) {
+ HttpSession session = null;
+ if (request != null) {
+ session = request.getSession(false);
+ if (session == null) {
+ throw new SessionExpiredException();
+ }
+ } else {
+ throw new SessionExpiredException();
+ }
+ return session;
+ }
+
+ public static List getLookupList(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy) {
+ return getLookupList(dbTable, dbValueCol, dbLabelCol, dbFilter, dbOrderBy, null);
+ } // getLookupList
+
+ public static List getLookupList(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy, Session session) {
+ String cacheKey = dbTable + "|" + dbValueCol + "|" + dbLabelCol + "|" + dbFilter + "|" + dbOrderBy;
+ List list = getLookupListFromCache(cacheKey);
+ if (list == null) {
+ list = getDataAccessService().getLookupList(dbTable, dbValueCol, dbLabelCol, dbFilter, dbOrderBy, null);
+ if (list != null) {
+ addLookupListToCache(cacheKey, list);
+ }
+ } // if
+ return list;
+ } // getLookupList
+
+ private static List getLookupListFromCache(String key) {
+ return (List)getObjectFromCache(key);
+ } // getLookupListFromCache
+
+ public static Object getObjectFromCache(String key) {
+ if (isCacheManagerAvailable()) {
+ return getCacheManager().getObject(key);
+ } else {
+ return null;
+ }
+ } // getObjectFromCache
+
+ private static void addLookupListToCache(String key, List list) {
+ addObjectToCache(key, list);
+ } // addLookupListToCache
+
+ public static void addObjectToCache(String key, Object o) {
+ if (isCacheManagerAvailable()) {
+ getCacheManager().putObject(key, o);
+ }
+ } // addObjectToCache
+
+ @Autowired
+ public void setCacheManager(AbstractCacheManager cacheManager) {
+ this.cacheManager = cacheManager;
+ }
+
+ public static AbstractCacheManager getCacheManager() {
+ return cacheManager;
+ }
+
+ public static boolean isCacheManagerAvailable() {
+ return (getCacheManager() != null);
+ }
+
+ public void setFeedback(Hashtable feedback) {
+ this.feedback = feedback;
+ }
+
+ public static boolean isApplicationLocked() {
+ return applicationLocked;
+ }
+
+ public static DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ @Autowired
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ public static void setApplicationLocked(boolean locked) {
+ applicationLocked = locked;
+ }
+
+ public static String getLookupValueByLabel(String label, String dbTable, String dbValueCol, String dbLabelCol) {
+ if (label == null || label.equals("")) {
+ return "";
+ }
+
+ List<org.openecomp.portalsdk.core.domain.Lookup> lstResult = getLookupListNoCache(dbTable, dbValueCol, dbLabelCol, dbLabelCol + "='" + label.replaceAll("'", "''") + "'", "");
+ if (lstResult == null) {
+ return "";
+ }
+ if (lstResult.size() > 0) {
+ return ((org.openecomp.portalsdk.core.domain.Lookup)lstResult.toArray()[0]).getValue();
+ } else {
+ return "";
+ }
+ }
+
+ public static String getLookupValueByLabel(String label, List lookupList) {
+ Iterator i = null;
+
+ if (label == null || label.equalsIgnoreCase("")) {
+ return "";
+ }
+
+ if (lookupList == null || lookupList.size() == 0) {
+ return "";
+ }
+
+ i = lookupList.iterator();
+ while (i.hasNext()) {
+ org.openecomp.portalsdk.core.domain.Lookup lookup = (org.openecomp.portalsdk.core.domain.Lookup)i.next();
+
+ if (lookup.getLabel().equals(label)) {
+ return lookup.getValue();
+ }
+ }
+
+ return "";
+}
+ public static List getLookupListNoCache(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy) {
+ return getLookupListNoCache(dbTable, dbValueCol, dbLabelCol, dbFilter, dbOrderBy, null);
+ } // getLookupListNoCache
+
+
+ public static List getLookupListNoCache(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy, Session session) {
+ return getDataAccessService().getLookupList(dbTable, dbValueCol, dbLabelCol, dbFilter, dbOrderBy, null);
+ } // getLookupListNoCache
+
+
+
+} // AppUtils
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/ControllerProperties.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/ControllerProperties.java
new file mode 100644
index 00000000..1d09eba0
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/ControllerProperties.java
@@ -0,0 +1,41 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.web.support;
+
+public interface ControllerProperties {
+
+ static final String TASK_GET = "get";
+ static final String TASK_DELETE = "delete";
+ static final String TASK_SAVE = "save";
+ static final String TASK_PROCESS = "process";
+ static final String TASK_TOGGLE_ACTIVE = "toggleActive";
+ static final String TASK_DOWNLOAD = "download";
+ static final String TASK_POPUP = "popup";
+ static final String TASK_LOOKUP = "lookup";
+ static final String TASK_ADD_ROW = "addRow";
+ static final String TASK_APPROVE = "approve";
+ static final String TASK_REJECT = "reject";
+ static final String TASK_RESET = "reset";
+ static final String TASK_ASSIGN = "assign";
+ static final String TASK_CUT = "cut";
+ static final String TASK_COPY = "copy";
+ static final String TASK_PASTE = "paste";
+ static final String TASK_SELECT = "select";
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/FeedbackMessage.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/FeedbackMessage.java
new file mode 100644
index 00000000..d8993b03
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/FeedbackMessage.java
@@ -0,0 +1,80 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.web.support;
+
+public class FeedbackMessage {
+
+ private String message;
+ private int messageType;
+ private boolean keyed;
+
+ public static final int MESSAGE_TYPE_ERROR = 10;
+ public static final int MESSAGE_TYPE_WARNING = 20;
+ public static final int MESSAGE_TYPE_INFO = 30;
+ public static final int MESSAGE_TYPE_SUCCESS = 40;
+
+ public static final String DEFAULT_MESSAGE_SUCCESS = "Update successful.";
+ public static final String DEFAULT_MESSAGE_ERROR = "An error occurred while processing the request: ";
+
+ public static final String DEFAULT_MESSAGE_SYSTEM_ADMINISTRATOR = "If the problem persists, please contact your Administrator.";
+
+ public FeedbackMessage() {
+ }
+
+ public FeedbackMessage(String message) {
+ this(message, MESSAGE_TYPE_ERROR);
+ }
+
+ public FeedbackMessage(String message, int messageType) {
+ this(message, messageType, false);
+ }
+
+ public FeedbackMessage(String message, int messageType, boolean keyed) {
+ this.message = message;
+ this.messageType = messageType;
+ this.keyed = keyed;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public int getMessageType() {
+ return messageType;
+ }
+
+ public boolean isKeyed() {
+ return keyed;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public void setMessageType(int messageType) {
+ this.messageType = messageType;
+ }
+
+ public void setKeyed(boolean keyed) {
+ this.keyed = keyed;
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/JsonMessage.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/JsonMessage.java
new file mode 100644
index 00000000..5566bf90
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/JsonMessage.java
@@ -0,0 +1,118 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.web.support;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalAPIResponse;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class JsonMessage {
+
+ private String data;
+ private String data2;
+ private String data3;
+ public JsonMessage(String data) {
+ super();
+ this.data = data;
+ }
+ public JsonMessage(String data,String data2) {
+ super();
+ this.data = data;
+ this.data2 = data2;
+ }
+
+ public JsonMessage(String data,String data2,String data3) {
+ super();
+ this.data = data;
+ this.data2 = data2;
+ this.data3 = data3;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+ public String getData2() {
+ return data2;
+ }
+ public void setData2(String data2) {
+ this.data2 = data2;
+ }
+ public String getData3() {
+ return data3;
+ }
+ public void setData3(String data3) {
+ this.data3 = data3;
+ }
+
+
+ /**
+ * Builds JSON object with status + message response body.
+ *
+ * @param success
+ * True to indicate success, false to signal failure.
+ * @param msg
+ * Message to include in the response object; ignored if null.
+ * @return
+ *
+ * <pre>
+ * { "status" : "ok" (or "error"), "message": "some explanation" }
+ * </pre>
+ */
+ public static String buildJsonResponse(boolean success, String msg) {
+ PortalAPIResponse response = new PortalAPIResponse(success, msg);
+ String json = null;
+ try {
+ json = new ObjectMapper().writeValueAsString(response);
+ } catch (JsonProcessingException ex) {
+ // Truly should never, ever happen
+ json = "{ \"status\": \"error\",\"message\":\"" + ex.toString() + "\" }";
+ }
+ return json;
+ }
+
+ /**
+ * Builds JSON object with status of error and message containing stack
+ * trace for the specified throwable.
+ *
+ * @param t
+ * Throwable with stack trace to use as message
+ * @return
+ *
+ * <pre>
+ * { "status" : "error", "message": "some-big-stacktrace" }
+ * </pre>
+ */
+ public static String buildJsonResponse(Throwable t) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ t.printStackTrace(pw);
+ return buildJsonResponse(false, sw.toString());
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/MessagesList.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/MessagesList.java
new file mode 100644
index 00000000..9ab956d0
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/MessagesList.java
@@ -0,0 +1,93 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.web.support;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MessagesList {
+
+ private boolean successMessageDisplayed = true;
+ private boolean includeCauseInCustomExceptions = false;
+
+ private List successMessages;
+ private List exceptionMessages;
+
+ public MessagesList() {
+ setExceptionMessages(new ArrayList());
+ setSuccessMessages(new ArrayList());
+ }
+
+ public MessagesList(boolean displaySuccess) {
+ this();
+ setSuccessMessageDisplayed(displaySuccess);
+ }
+
+ public List getExceptionMessages() {
+ return exceptionMessages;
+ }
+
+ public List getSuccessMessages() {
+ return successMessages;
+ }
+
+ public boolean isSuccessMessageDisplayed() {
+ return successMessageDisplayed;
+ }
+
+ public boolean isIncludeCauseInCustomExceptions() {
+ return includeCauseInCustomExceptions;
+ }
+
+
+ public void setExceptionMessages(List exceptionMessages) {
+ this.exceptionMessages = exceptionMessages;
+ }
+
+ public void setSuccessMessages(List successMessages) {
+ this.successMessages = successMessages;
+ }
+
+ public void setSuccessMessageDisplayed(boolean successMessageDisplayed) {
+ this.successMessageDisplayed = successMessageDisplayed;
+ }
+
+ public void setIncludeCauseInCustomExceptions(boolean includeCauseInCustomExceptions) {
+ this.includeCauseInCustomExceptions = includeCauseInCustomExceptions;
+ }
+
+
+ public void addSuccessMessage(FeedbackMessage message) {
+ getSuccessMessages().add(message);
+ }
+
+ public void addExceptionMessage(FeedbackMessage message) {
+ getExceptionMessages().add(message);
+ }
+
+ public boolean hasExceptionMessages() {
+ return!getExceptionMessages().isEmpty();
+ }
+
+ public boolean hasSuccessMessages() {
+ return!getSuccessMessages().isEmpty();
+ }
+
+}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java
new file mode 100644
index 00000000..7f974574
--- /dev/null
+++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java
@@ -0,0 +1,373 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.web.support;
+
+import java.io.PrintWriter;
+import java.io.Serializable;
+import java.io.StringWriter;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.UUID;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.core.FusionObject;
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.domain.RoleFunction;
+import org.openecomp.portalsdk.core.domain.UrlsAccessible;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.exception.SessionExpiredException;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.menu.MenuBuilder;
+import org.openecomp.portalsdk.core.restful.domain.EcompRole;
+import org.openecomp.portalsdk.core.restful.domain.EcompUser;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.util.CipherUtil;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@SuppressWarnings("rawtypes")
+public class UserUtils implements Serializable, FusionObject {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private static final String USER_ID = "UserId";
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserUtils.class);
+
+ public static final String KEY_USER_ROLES_CACHE = "userRoles";
+
+ public static final String WJ_HEADER_USER_NAME = "iv-user";
+ public static final String WJ_HEADER_USER_GROUP = "iv-groups";
+
+ private static DataAccessService dataAccessService;
+
+ public static void setUserSession(HttpServletRequest request, User user, Set applicationMenuData, Set businessDirectMenuData, String loginMethod) {
+ HttpSession session = request.getSession(true);
+
+ UserUtils.clearUserSession(request); // let's clear the current user session to avoid any conflicts during the set
+
+ session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
+
+ getRoleFunctions(request);
+
+ // truncate the role (and therefore the role function) data to save memory in the session
+ user.setRoles(null);
+ session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_NAME), user.getFullName());
+ session.setAttribute(SystemProperties.FIRST_NAME, user.getFirstName());
+ session.setAttribute(SystemProperties.LAST_NAME, user.getLastName());
+ String displayName = "";
+ if (SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME) != null)
+ displayName = SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME);
+ session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME), displayName);
+
+ session.setAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME), MenuBuilder.filterMenu(applicationMenuData, request));
+ session.setAttribute(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_ATTRIBUTE_NAME), MenuBuilder.filterMenu(businessDirectMenuData, request));
+ }
+
+ public static void clearUserSession(HttpServletRequest request) {
+ HttpSession session = AppUtils.getSession(request);
+
+ if (session == null) {
+ throw new SessionExpiredException();
+ }
+
+ // removes all stored attributes from the current user's session
+ session.removeAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME));
+ session.removeAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME));
+ session.removeAttribute(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_ATTRIBUTE_NAME));
+ session.removeAttribute(SystemProperties.getProperty(SystemProperties.ROLES_ATTRIBUTE_NAME));
+ session.removeAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME));
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Set getRoleFunctions(HttpServletRequest request) {
+ HashSet roleFunctions = null;
+
+ HttpSession session = request.getSession();
+ roleFunctions = (HashSet)session.getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME));
+
+ if (roleFunctions == null) {
+ HashMap roles = getRoles(request);
+ roleFunctions = new HashSet();
+
+ Iterator i = roles.keySet().iterator();
+
+ while (i.hasNext()) {
+ Long roleKey = (Long)i.next();
+ Role role = (Role)roles.get(roleKey);
+
+ Iterator j = role.getRoleFunctions().iterator();
+
+ while (j.hasNext()) {
+ RoleFunction function = (RoleFunction) j.next();
+ roleFunctions.add(function.getCode());
+ }
+ }
+
+ session.setAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME), roleFunctions);
+ }
+
+ return roleFunctions;
+ }
+
+ public static HashMap getRoles(HttpServletRequest request) {
+ HashMap roles = null;
+
+ //HttpSession session = request.getSession();
+ HttpSession session = AppUtils.getSession(request);
+ roles = (HashMap)session.getAttribute(SystemProperties.getProperty(SystemProperties.ROLES_ATTRIBUTE_NAME));
+
+ // if roles are not already cached, let's grab them from the user session
+ if (roles == null) {
+ User user = getUserSession(request);
+
+ // get all user roles (including the tree of child roles)
+ roles = getAllUserRoles(user);
+
+ session.setAttribute(SystemProperties.getProperty(SystemProperties.ROLES_ATTRIBUTE_NAME), getAllUserRoles(user));
+ }
+
+ return roles;
+ }
+
+ public static User getUserSession(HttpServletRequest request) {
+ HttpSession session = AppUtils.getSession(request);
+
+ if (session == null) {
+ throw new SessionExpiredException();
+ }
+
+ return (User)session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME));
+ }
+
+ @SuppressWarnings("unchecked")
+ public static HashMap getAllUserRoles(User user) {
+ HashMap roles = new HashMap();
+ Iterator i = user.getRoles().iterator();
+
+ while (i.hasNext()) {
+ Role role = (Role)i.next();
+
+ if (role.getActive()) {
+ roles.put(role.getId(), role);
+
+ // let's take a recursive trip down the tree to add all child roles
+ addChildRoles(role, roles);
+ }
+ }
+
+ return roles;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static void addChildRoles(Role role, HashMap roles) {
+ Set childRoles = role.getChildRoles();
+
+ if (childRoles != null && childRoles.size() > 0) {
+ Iterator j = childRoles.iterator();
+ while (j.hasNext()) {
+ Role childRole = (Role)j.next();
+
+ if (childRole.getActive()) {
+ roles.put(childRole.getId(), childRole);
+
+ addChildRoles(childRole, roles);
+ }
+ }
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public static boolean isUrlAccessible(HttpServletRequest request, String currentUrl) {
+ boolean isAccessible = false;
+
+ Map params = new HashMap();
+ params.put("current_url", currentUrl);
+
+ List list = getDataAccessService().executeNamedQuery("restrictedUrls", params, null);
+
+ // loop through the list of restricted URL's
+ if (list != null && list.size() > 0) {
+ for (int i=0; i < list.size(); i++) {
+
+ UrlsAccessible urlFunctions = (UrlsAccessible) list.get(i);
+ String functionCd = (String)urlFunctions.getFunctionCd();
+
+ if (UserUtils.isAccessible(request, functionCd)) {
+ isAccessible = true;
+ }
+ }
+ return isAccessible;
+ }
+
+ return true;
+ }
+
+ public static boolean hasRole(HttpServletRequest request, String roleKey) {
+ return getRoles(request).keySet().contains(new Long(roleKey));
+ }
+
+
+ public static boolean hasRole(User user, String roleKey) {
+ return getAllUserRoles(user).keySet().contains(new Long(roleKey));
+ }
+
+ public static boolean isAccessible(HttpServletRequest request, String functionKey) {
+ return getRoleFunctions(request).contains(functionKey);
+ }
+
+ public static DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ @Autowired
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ UserUtils.dataAccessService = dataAccessService;
+ }
+
+ public static int getUserId(HttpServletRequest request) {
+ return getUserIdAsLong(request).intValue();
+ }
+
+ public static Long getUserIdAsLong(HttpServletRequest request) {
+ Long userId = new Long(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID));
+
+ if (request != null) {
+ if (getUserSession(request) != null) {
+ userId = getUserSession(request).getId();
+ }
+ }
+
+ return userId;
+ }
+
+
+ private static final Object stackTraceLock = new Object();
+ public static String getStackTrace(Throwable t) {
+ synchronized(stackTraceLock) {
+ StringWriter sw = new StringWriter ();
+ PrintWriter pw = new PrintWriter (sw);
+ t.printStackTrace (pw);
+ return sw.toString ();
+ }
+ }
+
+ public static String getFullURL(HttpServletRequest request) {
+ if (request!=null) {
+ StringBuffer requestURL = request.getRequestURL();
+ String queryString = request.getQueryString();
+
+ if (queryString == null) {
+ return requestURL.toString();
+ } else {
+ return requestURL.append('?').append(queryString).toString();
+ }
+ }
+
+ return "";
+ }
+
+ public static String getRequestId(HttpServletRequest request) {
+ Enumeration<String> headerNames = request.getHeaderNames();
+
+ String requestId = "";
+ try {
+ while (headerNames.hasMoreElements()) {
+ String headerName = (String) headerNames.nextElement();
+ logger.info(EELFLoggerDelegate.debugLogger, "One header is " + headerName + " : " + request.getHeader(headerName));
+ if (headerName.equalsIgnoreCase(SystemProperties.ECOMP_REQUEST_ID)) {
+ requestId = request.getHeader(headerName);
+ break;
+ }
+ }
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, "HEADER!!!! Exception : " + UserUtils.getStackTrace(e));
+ }
+
+ return (requestId.isEmpty() ? UUID.randomUUID().toString() : requestId);
+ }
+
+
+ public static EcompUser convertToEcompUser (User user){
+ EcompUser userJson = new EcompUser();
+
+
+ userJson.setEmail(user.getEmail());
+ userJson.setFirstName(user.getFirstName());
+ userJson.setHrid(user.getHrid());
+ userJson.setJobTitle(user.getJobTitle());
+ userJson.setLastName(user.getLastName());
+ userJson.setLoginId(user.getLoginId());
+ userJson.setOrgManagerUserId(user.getOrgManagerUserId());
+ userJson.setMiddleInitial(user.getMiddleInitial());
+ userJson.setOrgCode(user.getOrgCode());
+ userJson.setOrgId(user.getOrgId());
+ userJson.setPhone(user.getPhone());
+ userJson.setOrgUserId(user.getOrgUserId());
+
+
+ Set<EcompRole> ecompRoles = new TreeSet<EcompRole>();
+
+ for(Role role : user.getRoles()){
+ ecompRoles.add(convertToEcompRole(role));
+ }
+
+ userJson.setRoles(ecompRoles);
+
+ return userJson;
+ }
+
+ public static EcompRole convertToEcompRole(Role role){
+
+ EcompRole ecompRole = new EcompRole();
+ ecompRole.setId(role.getId());
+ ecompRole.setName(role.getName());
+
+ return ecompRole;
+ }
+
+ public static String getUserIdFromCookie(HttpServletRequest request) throws Exception {
+ String userId = "";
+ Cookie[] cookies = request.getCookies();
+ Cookie userIdcookie = null;
+ if (cookies != null)
+ for (Cookie cookie : cookies)
+ if (cookie.getName().equals(USER_ID))
+ userIdcookie = cookie;
+ if(userIdcookie!=null){
+ userId = CipherUtil.decrypt(userIdcookie.getValue(),
+ SystemProperties.getProperty(SystemProperties.Decryption_Key));
+ }
+ return userId;
+
+ }
+}
diff --git a/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockApplicationContextTestSuite.java b/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockApplicationContextTestSuite.java
new file mode 100644
index 00000000..0f918f6b
--- /dev/null
+++ b/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockApplicationContextTestSuite.java
@@ -0,0 +1,127 @@
+package org.openecomp.portalsdk.core;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.openecomp.portalsdk.core.conf.AppConfig;
+import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager;
+import org.openecomp.portalsdk.core.util.CacheManager;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.AnnotationConfigWebContextLoader;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+
+
+/**
+ *
+ *
+ *
+ * In order to write a unit test,
+ * 1. inherit this class - See SanityTest.java
+ * 2. place the "war" folder on your test class's classpath
+ * 3. run the test with the following VM argument; This is important because when starting the application from Container, the System Properties file (SystemProperties.java) can have the direct path
+ * but, when running from the Mock Junit container, the path should be prefixed with "classpath" to enable the mock container to search for the file in the classpath
+ * -Dcontainer.classpath="classpath:"
+ *
+ */
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@WebAppConfiguration
+@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = {MockAppConfig.class})
+@ActiveProfiles(value="test")
+public class MockApplicationContextTestSuite {
+
+ @Autowired
+ public WebApplicationContext wac;
+
+ private MockMvc mockMvc;
+
+ @Before
+ public void setup() {
+ if(mockMvc == null) {
+ this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
+
+ }
+ }
+
+ public Object getBean(String name) {
+ return this.wac.getBean(name);
+ }
+
+
+ public MockMvc getMockMvc() {
+ return mockMvc;
+ }
+
+ public void setMockMvc(MockMvc mockMvc) {
+ this.mockMvc = mockMvc;
+ }
+
+ public WebApplicationContext getWebApplicationContext() {
+ return wac;
+ }
+
+
+
+
+}
+
+
+ @Configuration
+ @ComponentScan(basePackages = "org.openecomp",
+ excludeFilters = {
+
+ }
+ )
+ @Profile("test")
+ class MockAppConfig extends AppConfig {
+
+ @Bean
+ public SystemProperties systemProperties(){
+ return new MockSystemProperties();
+ }
+
+ @Bean
+ public AbstractCacheManager cacheManager() {
+ return new CacheManager() {
+
+ public void configure() throws IOException {
+
+ }
+ };
+ }
+
+ protected String[] tileDefinitions() {
+ return new String[] {"classpath:/WEB-INF/fusion/defs/definitions.xml", "classpath:/WEB-INF/defs/definitions.xml"};
+ }
+
+ @Override
+ public void addInterceptors(InterceptorRegistry registry) {
+ //registry.addInterceptor(new SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout());
+ //registry.addInterceptor(resourceInterceptor());
+ }
+
+ public static class MockSystemProperties extends SystemProperties {
+
+ public MockSystemProperties() {
+ }
+
+ }
+
+ }
+
+
+
+
diff --git a/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockHibernateMappingLocations.java b/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockHibernateMappingLocations.java
new file mode 100644
index 00000000..a7de5159
--- /dev/null
+++ b/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockHibernateMappingLocations.java
@@ -0,0 +1,20 @@
+package org.openecomp.portalsdk.core;
+
+
+
+import org.openecomp.portalsdk.core.conf.HibernateMappingLocatable;
+import org.springframework.context.annotation.Profile;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+import org.springframework.stereotype.Component;
+
+@Component
+@Profile("test")
+public class MockHibernateMappingLocations implements HibernateMappingLocatable{
+
+ public Resource[] getMappingLocations() {
+ return new Resource[]{new ClassPathResource("WEB-INF/fusion/orm/Fusion.hbm.xml"), new ClassPathResource("WEB-INF/fusion/orm/Workflow.hbm.xml")};
+ }
+
+
+}
diff --git a/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/controller/sessionmgt/PortalCommunicationTest.java b/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/controller/sessionmgt/PortalCommunicationTest.java
new file mode 100644
index 00000000..3e14becb
--- /dev/null
+++ b/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/controller/sessionmgt/PortalCommunicationTest.java
@@ -0,0 +1,56 @@
+package org.openecomp.portalsdk.core.controller.sessionmgt;
+/*package org.openecomp.portalsdk.core.controller.sessionmgt;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.mock.web.MockHttpSession;
+import org.springframework.test.web.servlet.ResultActions;
+import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+
+import org.openecomp.portalsdk.core.MockApplicationContextTestSuite;
+import org.openecomp.portalsdk.core.service.sessionmgt.CoreTimeoutHandler;
+
+public class PortalCommunicationTest extends MockApplicationContextTestSuite{
+
+
+ @Test
+ public void testGetTimeoutSessions() throws Exception {
+
+ MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/api/sessionTimeOuts");
+ MockHttpSession httpSession = new MockHttpSession(this.wac.getServletContext(),"1234");
+ CoreTimeoutHandler.sessionCreated("12", "1234", httpSession);
+
+ ResultActions ra = this.getMockMvc().perform(requestBuilder);
+
+ System.out.println(" %%%%%%%%%%%%%%%%%%%%%%%%% " + ra.andReturn().getResponse().getContentAsString());
+ System.out.println(" %%%%%%%%%%%%%%%%%%%%%%%%% " + "{\"12\":{\"jSessionId\":\"1234\",\"sessionTimOutMilliSec\":");
+
+ Assert.assertTrue(ra.andReturn().getResponse().getContentAsString().startsWith("{\"12\":{\"jSessionId\":\"1234\",\"sessionTimOutMilliSec\":"));
+
+ }
+
+ @Test
+ public void testUpdateTimeoutSessions() throws Exception {
+
+ // pre condition
+ MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/api/sessionTimeOuts");
+ MockHttpSession httpSession = new MockHttpSession(this.wac.getServletContext(),"1234");
+ CoreTimeoutHandler.sessionCreated("12", "1234", httpSession);
+ ResultActions ra = this.getMockMvc().perform(requestBuilder);
+
+ String responseSessMapStr = ra.andReturn().getResponse().getContentAsString();
+
+
+ // test
+ requestBuilder = MockMvcRequestBuilders.post("/api/updateSessionTimeOuts");
+ requestBuilder.param("sessionMap", responseSessMapStr);
+ ra = this.getMockMvc().perform(requestBuilder);
+
+
+ }
+
+
+
+}
+*/ \ No newline at end of file
diff --git a/ecomp-sdk/sdk-analytics/.gitignore b/ecomp-sdk/sdk-analytics/.gitignore
new file mode 100644
index 00000000..d4111ffd
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/.gitignore
@@ -0,0 +1,2 @@
+/.settings/
+/target/
diff --git a/ecomp-sdk/sdk-analytics/README.md b/ecomp-sdk/sdk-analytics/README.md
new file mode 100644
index 00000000..e7a5d130
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/README.md
@@ -0,0 +1,8 @@
+ECOMP Portal SDK Analytics
+==========================
+
+This is the Maven project for the ECOMP Portal SDK Analytics,
+which is distributed as ecompSDK-analytics-nnn.jar. This library
+requires Hibernate and Spring, and provides features including
+charts, maps and reports.
+
diff --git a/ecomp-sdk/sdk-analytics/pom.xml b/ecomp-sdk/sdk-analytics/pom.xml
new file mode 100644
index 00000000..7e3e8d9f
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/pom.xml
@@ -0,0 +1,160 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>ecompSDK-project</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <artifactId>ecompSDK-analytics</artifactId>
+ <name>Ecomp Portal SDK Analytics</name>
+ <description>Provides reporting features for SDK applications</description>
+ <packaging>jar</packaging>
+
+
+ <!-- repositories are inherited from parent -->
+
+ <dependencies>
+
+ <!-- sdk-core -->
+ <dependency>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>ecompSDK-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <!-- Raptor required Libraries -->
+ <!-- for static charts -->
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.10</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+ <!-- for generating PDF -->
+ <dependency>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext</artifactId>
+ <version>2.0.8</version>
+ </dependency>
+ <!-- bridge to implement commons-logging using slf4j -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>1.7.12</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${springframework.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-orm</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <!-- for generating excel/csv/excelx -->
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi</artifactId>
+ <version>3.5-FINAL</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi-ooxml</artifactId>
+ <version>3.5-FINAL</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi-scratchpad</artifactId>
+ <version>3.5-FINAL</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi-contrib</artifactId>
+ <version>3.5-FINAL</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/AntBuild.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/AntBuild.java
new file mode 100644
index 00000000..eeb2b605
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/AntBuild.java
@@ -0,0 +1,89 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+/**
+ * This class is used to get version and Build information when
+ * user run "java -jar raptor_classes.jar" command.
+ */
+public class AntBuild {
+
+ public static String buildNum = "";
+
+ public static void main(String[] args) {
+ System.out.println("Jar (raptor_classes.jar) Information: ");
+ readManifest();
+ }
+
+ public static void readManifest() {
+ try {
+ Class clazz = AntBuild.class;
+ String classContainer = clazz.getProtectionDomain().getCodeSource().getLocation().toString();
+ URL manifestUrl = new URL("jar:" + classContainer + "!/META-INF/MANIFEST.MF");
+ Manifest manifest = new Manifest(manifestUrl.openStream());
+
+ //JarFile jar = new JarFile("../lib/raptor_classes.jar");
+ //Manifest manifest = jar.getManifest();
+
+ Attributes attribs = manifest.getMainAttributes();
+ Iterator it = attribs.entrySet().iterator();
+ while(it.hasNext()) {
+ Map.Entry entry = (Map.Entry) it.next();
+ Attributes.Name attributeName = (Attributes.Name) entry.getKey();
+ String attributeValue = (String) entry.getValue();
+ if (attributeName.toString().equals("Created-By"))
+ System.out.println("Java HotSpot(TM) Client VM " + " : " + attributeValue);
+ else if (attributeName.toString().equals("Java-Version"))
+ System.out.println("Java Version " + " : " + attributeValue);
+ else if (attributeName.toString().equals("Java-Runtime-Version"))
+ System.out.println("Java Runtime Version " + " : " + attributeValue);
+ else if (attributeName.toString().equals("Ant-Version"))
+ System.out.println(attributeName.toString() + " : " + attributeValue);
+ else {
+ if(attributeName.toString().startsWith("Raptor")) {
+ if (attributeName.toString().startsWith("Raptor-Build-Version"))
+ buildNum = attributeValue;
+ System.out.println(attributeName.toString() + " : " + attributeValue);
+ }
+ }
+ }
+
+ } catch (IOException e) {
+ System.err.println("Cannot read jar-file manifest: "
+ + e.getMessage());
+ }
+ }
+
+ public static String getBuildNum() {
+ if (buildNum.length()>0)
+ return buildNum;
+ else {
+ readManifest();
+ return buildNum;
+ }
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/RaptorObject.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/RaptorObject.java
new file mode 100644
index 00000000..9a45c19c
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/RaptorObject.java
@@ -0,0 +1,44 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics;
+
+public class RaptorObject extends java.lang.Object {
+
+ protected String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ protected String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ protected static String nvls(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ protected static String nvls(String s, String sDefault) {
+ return nvls(s).equals("") ? sDefault : s;
+ }
+
+ protected boolean getFlagInBoolean(String s) {
+ return nvl(s).toUpperCase().startsWith("Y") || nvl(s).toLowerCase().equals("true");
+ }
+
+} // RaptorObject
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/config/ConfigLoader.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/config/ConfigLoader.java
new file mode 100644
index 00000000..826d7a29
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/config/ConfigLoader.java
@@ -0,0 +1,196 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.config;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Properties;
+
+import javax.servlet.ServletContext;
+
+import org.openecomp.portalsdk.analytics.controller.Action;
+import org.openecomp.portalsdk.analytics.controller.ActionMapping;
+import org.openecomp.portalsdk.analytics.util.Log;
+
+public class ConfigLoader {
+ // public static final String RAPTOR_ACTION_MAP =
+ // "raptor_action_map.properties";
+
+ private static final String P_FILE_EXTENSION = ".properties";
+
+ public static final String RAPTOR_PROPERTIES = "raptor";
+
+ public static final String SQL_PROPERTIES = "sql";
+
+ public static final String APP_PROPERTIES = "raptor_app";
+
+ public static final String DB_PROPERTIES = "raptor_db";
+
+ private static String configFilesPath = "/WEB-INF/conf/";
+
+ public static final String RAPTOR_PDF_PROPERTIES = "raptor_pdf";
+
+ // private static String internalFilesPath =
+ // are not supposed to be modified by the user; may be unavailable in some
+ // cases - so defaults are expected
+
+ private static String raptorActionMapString =
+ "report.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_run.jsp \n"
+ + "mobile.report.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |mobile_report_run.jsp \n"
+ + "report.dashrep1.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportDashRep1 |report_run_dashrep1.jsp \n"
+ + "report.dashrep2.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportDashRep2 |report_run_dashrep2.jsp \n"
+ + "report.dashrep3.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportDashRep3 |report_run_dashrep3.jsp \n"
+ + "report.dashrep4.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportDashRep4 |report_run_dashrep4.jsp \n"
+ + "report.download |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_xls.jsp \n"
+ + "report.download.excel2007 |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_xlsx.jsp \n"
+ + "report.download.page |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_page_xls.jsp \n"
+ + "report.csv.download |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_csv.jsp \n"
+ + "report.text.download |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_txt.jsp \n"
+ + "report.search |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportSearch |report_search.jsp \n"
+ + "report.search.execute |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportSearchExecute |report_search \n"
+ + "report.search.user |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportSearchUser |report_search.jsp \n"
+ + "report.search.public |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportSearchPublic |report_search.jsp \n"
+ + "report.search.favorite |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportSearchFavorites |report_search.jsp \n"
+ + "report.wizard |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportWizard |report_wizard \n"
+ + "report.create |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportCreate |report_wizard \n"
+ + "report.import |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_import \n"
+ + "report.import.save |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportImportSave |report_wizard \n"
+ + "report.copy |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportCopy |report_wizard \n"
+ + "report.copy.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportCopy |raptor_wizard_container.jsp \n"
+ + "report.edit |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportEdit |report_wizard \n"
+ + "report.delete |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportDelete |report_search \n"
+ + "report.popup.field |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportFormFieldPopup |popup_field.jsp \n"
+ + "report.popup.map |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportValuesMapDefPopup |popup_map.jsp \n"
+ + "report.popup.drilldown.table |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |popup_drill_down_table.jsp \n"
+ + "report.popup.drilldown.report|org.openecomp.portalsdk.analytics.controller.ActionHandler|reportDrillDownToReportDefPopup|popup_drill_down_report \n"
+ + "report.popup.import.semaphore|org.openecomp.portalsdk.analytics.controller.ActionHandler|importSemaphorePopup |popup_import_semaphore \n"
+ + "report.popup.semaphore |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |popup_semaphore \n"
+ + "report.popup.semaphore.save |org.openecomp.portalsdk.analytics.controller.ActionHandler|saveSemaphorePopup |popup_semaphore \n"
+ + "report.popup.filter.col |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |popup_filter_col.jsp \n"
+ + "report.popup.filter.data |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportFilterDataPopup |popup_filter_data.jsp \n"
+ + "report.popup.sql |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportShowSQLPopup |popup_sql \n "
+ + "report.run.popup |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_run_popup.jsp \n"
+ + "report.popup.test.cond |org.openecomp.portalsdk.analytics.controller.ActionHandler|testSchedCondPopup |popup_sql \n"
+ + "report.popup.testrun.sql |org.openecomp.portalsdk.analytics.controller.ActionHandler|testRunSQLPopup |popup_testrun_sql \n"
+ + "report.test.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |test_run_sql \n"
+ + "report.field.testrun.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |test_field_run_sql \n"
+ + "report.field.default.testrun.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |default_field_run_sql \n"
+ + "report.field.date.start.testrun.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |date_start_field_run_sql \n"
+ + "report.field.date.end.testrun.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |date_end_field_run_sql \n"
+ + "report.popup.table.cols |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |popup_table_cols \n"
+ + "refresh.cache |org.openecomp.portalsdk.analytics.controller.ActionHandler|refreshCache |message.jsp \n"
+ + "report.message |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |message.jsp \n"
+ + "report.download.pdf |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_pdf.jsp \n"
+ + "report.popup.pdfconfig |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |popup_pdf_config.jsp \n"
+ + "download.all |org.openecomp.portalsdk.analytics.controller.ActionHandler|downloadAll |close.jsp \n"
+ + "download.all.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |popup_download_flat_file.jsp \n"
+ + "download.data.file |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |download_data_file.jsp \n"
+ + "popup.calendar |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |gtm_calendar.jsp \n"
+ + "report.folderlist |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |folder_report_list.jsp \n"
+ + "report.folderlist_iframe |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |folder_report_list_iframe.jsp \n"
+ + "report.childDropDown |org.openecomp.portalsdk.analytics.controller.ActionHandler|getChildDropDown |raptor_childdropdown.jsp \n"
+ + "report.create.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_create_container.jsp \n"
+ + "report.search.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_search_container.jsp \n"
+ + "report.search.execute.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_search_execute_container.jsp \n"
+ + "report.search.user.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_search_user_container.jsp \n"
+ + "report.search.public.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_search_public_container.jsp \n"
+ + "report.search.favorite.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_search_favorite_container.jsp \n"
+ + "report.run.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_run_container.jsp \n"
+ + "report.formfields.run.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|formFieldRun |report_run_container.jsp \n"
+ + "report.run.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_run.jsp \n"
+ + "report.schedule.multiple |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |wizard_schedule_multiple.jsp \n"
+ + "report.schedule.submit |org.openecomp.portalsdk.analytics.controller.ActionHandler|processSchedule |wizard_schedule_only.jsp \n"
+ + "report.schedule.report.submit |org.openecomp.portalsdk.analytics.controller.ActionHandler|processScheduleReportList |wizard_schedule_only.jsp \n"
+ + "report.schedule.report.submit_wmenu |org.openecomp.portalsdk.analytics.controller.ActionHandler|processScheduleReportList |wizard_schedule_only_from_search.jsp \n"
+ + "report.schedule_only |org.openecomp.portalsdk.analytics.controller.ActionHandler|processSchedule |wizard_schedule_only \n"
+ + "report.schedule_only_from_search |org.openecomp.portalsdk.analytics.controller.ActionHandler|processSchedule |wizard_schedule_only_from_search.jsp \n"
+ + "report.schedule_delete |org.openecomp.portalsdk.analytics.controller.ActionHandler|processScheduleDelete |report_run_container.jsp \n"
+ + "report.schedule.submit_from_search |org.openecomp.portalsdk.analytics.controller.ActionHandler|processSchedule |wizard_schedule_only_from_search.jsp \n"
+ + "report.dashboard.detail |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |dashboard_report_run_detail.jsp \n"
+ + "report.csv.download.direct |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_csv.jsp \n"
+ + "report.csv.download.direct |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_csv.jsp \n"
+ + "report.download.csv.session |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_download_csv \n"
+ + "report.download.excel2007.session |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_download_xlsx.jsp \n"
+ + "report.download.excel.session |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_download_xls.jsp \n"
+ + "report.download.pdf.session |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_download_pdf.jsp \n"
+ + "report.download.page.session |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_download_page_xls.jsp \n"
+ + "report.data.remove.session |org.openecomp.portalsdk.analytics.controller.ActionHandler|removeReportDataFromSession |report_run_container.jsp \n"
+ + "report.dashboard.run.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_dashboard_run_container.jsp \n"
+ + "chart.force.cluster |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |force_cluster.jsp \n"
+ + "chart.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportChartRun |report_run_container.jsp \n"
+ + "chart.json |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportChartRun |report_run_container.jsp \n"
+ + "chart.data.json |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportChartDataRun |report_run_container.jsp \n"
+ + "quicklinks.json |org.openecomp.portalsdk.analytics.controller.ActionHandler|getQuickLinksJSON |report_run_container.jsp \n"
+ + "embed.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_embed_run_container.zul \n"
+ + "schedule.edit |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |wizard_adhoc_schedule.zul \n"
+ + "chart.annotations.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |plugin_chart_annotation.jsp \n"
+ + "chart.annotations.exec |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |chart_annotations.jsp \n"
+ + "chart.mini |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |chart_minified.jsp \n"
+ + "report.olap.run.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_olap_run_container.jsp \n"
+ + "report.hive.run.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_hive_run_container.jsp \n"
+
+ ;
+
+ private ConfigLoader() {
+ }
+
+ public static void setConfigFilesPath(String path) {
+ configFilesPath = path;
+ } // setConfigFilesPath
+
+ public static Properties getProperties(ServletContext servletContext, String propertiesFile)
+ throws IOException {
+ return getProperties(servletContext, propertiesFile, null);
+ } // getProperties
+
+ public static Properties getProperties(ServletContext servletContext,
+ String propertiesFile, String systemTypeExtension) throws IOException {
+ Properties p = new Properties();
+ p.load(servletContext.getResourceAsStream(configFilesPath + propertiesFile
+ + ((systemTypeExtension == null) ? "" : "_" + systemTypeExtension)
+ + P_FILE_EXTENSION));
+ return p;
+ } // getProperties
+
+ public static ActionMapping loadRaptorActionMapping(ServletContext servletContext)
+ throws IOException {
+ ActionMapping actionMapping = new ActionMapping();
+
+ String pLine = null;
+ // BufferedReader pFile = new BufferedReader(new
+ // InputStreamReader(servletContext.getResourceAsStream(internalFilesPath+RAPTOR_ACTION_MAP)));
+ BufferedReader pFile = new BufferedReader(new StringReader(raptorActionMapString));
+ while ((pLine = pFile.readLine()) != null)
+ if (pLine.trim().length() > 0)
+ try {
+ actionMapping.addAction(Action.parse(pLine));
+ } catch (Exception e) {
+ Log
+ .write("[ConfigLoader.loadRaptorActionMapping] Error - unable to parse action ["
+ + pLine + "]");
+ }
+ pFile.close();
+
+ return actionMapping;
+ } // loadRaptorActionMapping
+
+} // ConfigLoader
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Action.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Action.java
new file mode 100644
index 00000000..3d14dcbf
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Action.java
@@ -0,0 +1,89 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.StringTokenizer;
+
+public class Action extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private String action = null;
+
+ private String controllerClass = null;
+
+ private String controllerMethod = null;
+
+ private String jspName = null;
+
+ private Action() {
+ }
+
+ public Action(String action, String controllerClass, String controllerMethod,
+ String jspName) {
+ setAction(action);
+ setControllerClass(controllerClass);
+ setControllerMethod(controllerMethod);
+ setJspName(jspName);
+ } // Action
+
+ public static Action parse(String configFileEntry) {
+ Action a = new Action();
+
+ StringTokenizer st = new StringTokenizer(configFileEntry, "| \t", false);
+ // if(st.hasMoreTokens())
+ a.setAction(st.nextToken());
+ a.setControllerClass(st.nextToken());
+ a.setControllerMethod(st.nextToken());
+ a.setJspName(st.nextToken());
+
+ return a;
+ } // parse
+
+ public String getAction() {
+ return action;
+ }
+
+ public String getControllerClass() {
+ return controllerClass;
+ }
+
+ public String getControllerMethod() {
+ return controllerMethod;
+ }
+
+ public String getJspName() {
+ return jspName;
+ }
+
+ private void setAction(String action) {
+ this.action = action;
+ }
+
+ private void setControllerClass(String controllerClass) {
+ this.controllerClass = controllerClass;
+ }
+
+ private void setControllerMethod(String controllerMethod) {
+ this.controllerMethod = controllerMethod;
+ }
+
+ private void setJspName(String jspName) {
+ this.jspName = jspName;
+ }
+
+} // Action
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionHandler.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionHandler.java
new file mode 100644
index 00000000..e0cd8d2f
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionHandler.java
@@ -0,0 +1,2417 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+/* ===========================================================================================
+ * This class is part of <I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I>
+ * Raptor : This tool is used to generate different kinds of reports with lot of utilities
+ * ===========================================================================================
+ *
+ * -------------------------------------------------------------------------------------------
+ * ActionHandler.java - This class is used to call actions related to reports.
+ * -------------------------------------------------------------------------------------------
+ *
+ *
+ *
+ * Changes
+ * -------
+ * 31-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> reportFormFieldPopup iterates form field collections. </LI></UL>
+ * 18-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> request Object is passed to prevent caching user/roles - Datamining/Hosting. </LI></UL>
+ * 13-Aug-2009 : Version 8.5 (Sundar);<UL><LI> reportFormFieldPopup is changed to have effect on textfield with popup. </LI></UL>
+ * 06-Aug-2009 : Version 9.0 (Sundar);<UL><LI> reportFormFieldPopupB is changed. </LI></UL>
+ * 29-Jul-2009 : Version 8.4 (Sundar);<UL><LI> Previously report data for dashboard stored only page level data. This has been changed to show all the data up to the maximum specified. </LI></UL>
+ * 27-Jul-2009 : Version 8.4 (Sundar);<UL><LI>Bug due to not showing back button after child report in drilldown is navigated more than
+ * one page is resolved. </LI></UL>
+ * 14-Jul-2009 : Version 8.4 (Sundar); <UL><LI>Dashboard reports can now be generated excel as separate sheets or group together in PDF.
+ * They can also be scheduled.</LI></UL>
+ *
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.Vector;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
+import org.openecomp.portalsdk.analytics.error.RaptorSchedularException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.error.UserDefinedException;
+import org.openecomp.portalsdk.analytics.error.ValidationException;
+import org.openecomp.portalsdk.analytics.model.DataCache;
+import org.openecomp.portalsdk.analytics.model.ReportHandler;
+import org.openecomp.portalsdk.analytics.model.ReportLoader;
+import org.openecomp.portalsdk.analytics.model.SearchHandler;
+import org.openecomp.portalsdk.analytics.model.base.IdNameColLookup;
+import org.openecomp.portalsdk.analytics.model.base.IdNameList;
+import org.openecomp.portalsdk.analytics.model.base.IdNameSql;
+import org.openecomp.portalsdk.analytics.model.base.ReportSecurity;
+import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition;
+import org.openecomp.portalsdk.analytics.model.definition.ReportSchedule;
+import org.openecomp.portalsdk.analytics.model.runtime.ChartWebRuntime;
+import org.openecomp.portalsdk.analytics.model.runtime.ErrorJSONRuntime;
+import org.openecomp.portalsdk.analytics.model.runtime.FormField;
+import org.openecomp.portalsdk.analytics.model.runtime.FormatProcessor;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportFormFields;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportJSONRuntime;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.model.runtime.VisualManager;
+import org.openecomp.portalsdk.analytics.model.search.ReportSearchResultJSON;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.system.fusion.domain.QuickLink;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.view.DataRow;
+import org.openecomp.portalsdk.analytics.view.DataValue;
+import org.openecomp.portalsdk.analytics.view.ReportData;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+public class ActionHandler extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ //private static Log debugLogger = LogFactory.getLog(ActionHandler.class.getName());
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ActionHandler.class);
+
+ private void preserveReportRuntimeAsBackup(HttpServletRequest request) {
+ HttpSession session = request.getSession();
+ ArrayList repAl = null;
+
+ if(session.getAttribute(AppConstants.DRILLDOWN_REPORTS_LIST)!=null)
+ repAl = ((ArrayList)session.getAttribute(AppConstants.DRILLDOWN_REPORTS_LIST));
+ int index = Integer.parseInt(nvl((String) session.getAttribute(AppConstants.DRILLDOWN_INDEX), "0"));
+ int form_index = Integer.parseInt(nvl((String) session.getAttribute(AppConstants.FORM_DRILLDOWN_INDEX), "0"));
+ int flag = 0;
+ if(repAl ==null || repAl.size() <= 0) {
+ //session.setAttribute(AppConstants.SI_BACKUP_FOR_REP_ID, ((ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID());
+ //session.setAttribute(AppConstants.SI_REPORT_RUN_BACKUP, request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME));
+ repAl = new ArrayList();
+ repAl.add((ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME));
+
+ } else {
+ if(Globals.getMaxDrillDownLevel() < repAl.size()) {
+ repAl.remove(0);
+ if(index > 0) index--;
+ } else if(index < repAl.size())
+ repAl.remove(index);
+ repAl.add(index, (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME));
+ }
+ index = index + 1;
+ // needed to differentiate form and report index to store form parameters for ZK
+ form_index = form_index + 1;
+ session.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index));
+ session.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index));
+ request.getSession().setAttribute(AppConstants.DRILLDOWN_REPORTS_LIST, repAl);
+ } // preserveReportRuntimeAsBackup
+
+ private void clearReportRuntimeBackup(HttpServletRequest request) {
+// debugLogger.debug("in Action Handler clear is been called.");
+ HttpSession session = request.getSession();
+ session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ request.removeAttribute(AppConstants.DRILLDOWN_INDEX);
+ request.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX);
+ Enumeration<String> enum1 = session.getAttributeNames();
+ String attributeName = "";
+ while(enum1.hasMoreElements()) {
+ attributeName = enum1.nextElement();
+ if(attributeName.startsWith("parent_")) {
+ session.removeAttribute(attributeName);
+ }
+ }
+ //request.getSession().removeAttribute(AppConstants.SI_REPORT_RUN_BACKUP);
+ //request.getSession().removeAttribute(AppConstants.SI_BACKUP_FOR_REP_ID);
+ } // clearReportRuntimeBackup
+
+ private boolean isDashboardInDrillDownList(HttpServletRequest request) throws RaptorException {
+ ArrayList aL = (ArrayList) request.getSession().getAttribute(
+ AppConstants.DRILLDOWN_REPORTS_LIST);
+ ReportRuntime rr = null;
+ if(aL ==null || aL.size() <= 0) {
+ return false;
+ } else {
+ for (int i =0; i<aL.size(); i++) {
+ rr = (ReportRuntime) aL.get(i);
+ if( rr!=null && rr.getReportType().equals(AppConstants.RT_DASHBOARD))
+ return true;
+ }
+ }
+ return false;
+ }
+ private ReportRuntime getReportRuntimeFromBackup(HttpServletRequest request) {
+ ArrayList aL = (ArrayList) request.getSession().getAttribute(
+ AppConstants.DRILLDOWN_REPORTS_LIST);
+ ReportRuntime rr = null;
+ HttpSession session = request.getSession();
+ /*if(aL==null || (aL.size() <=0) ) {
+ rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUN_BACKUP);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr);
+ } else {*/
+ //clearReportRuntimeBackup(request);
+
+ int index = Integer.parseInt(nvl(AppUtils.getRequestValue(request, AppConstants.DRILLDOWN_INDEX), "0"));
+ int form_index = Integer.parseInt(nvl(AppUtils.getRequestValue(request, AppConstants.FORM_DRILLDOWN_INDEX), "0"));
+ index = index>0 ? --index : 0;
+ form_index = form_index>0 ? --form_index : 0;
+ request.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index));
+ session.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index));
+ request.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index));
+ session.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index));
+
+ rr = (ReportRuntime)aL.get(index);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr);
+ //clearReportRuntimeBackup(request);
+ //}
+ return rr;
+ } // getReportRuntimeFromBackup
+
+ public String reportRun(HttpServletRequest request, String nextPage) {
+ String action = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));
+ ReportRuntime rr = null;
+ String userId = null;
+ String formFields = "";
+ ReportData rd = null;
+ boolean isEmailAttachment = false;
+ boolean fromDashboard = AppUtils.getRequestFlag(request,"fromDashboard");
+ request.getSession().setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request));
+
+ boolean rDisplayContent = AppUtils.getRequestFlag(request,
+ AppConstants.RI_DISPLAY_CONTENT)
+ || AppUtils.getRequestFlag(request, "noFormFields");
+
+ try {
+ //if "refresh=Y" is in request parameter, session variables are removed.
+ if(AppUtils.getRequestFlag(request, AppConstants.RI_REFRESH)) {
+ removeVariablesFromSession(request);
+ }
+
+
+ long currentTime = System.currentTimeMillis();
+ request.setAttribute("triggeredStartTime", new Long(currentTime));
+ String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));
+ String pdfAttachmentKey = AppUtils.getRequestNvlValue(request, "pdfAttachmentKey");
+ String parent = "";
+ int parentFlag = 0;
+ if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), "");
+ if(parent.startsWith("parent_")) parentFlag = 1;
+
+ if (pdfAttachmentKey.length()<=0) {
+ if(actionKey.equals("report.download.page") || actionKey.equals("report.download") || actionKey.equals("report.download.pdf") || actionKey.equals("report.download.excel2007") || actionKey.equals("report.csv.download") || actionKey.equals("report.text.download")) {
+ if(parentFlag == 1) rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr");
+ if(rr==null)
+ rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); //changing session to request
+ if(!(rr!=null && fromDashboard)) {
+ userId = AppUtils.getUserID(request);
+ boolean isFromReportLog = AppUtils.getRequestFlag(request, "fromReportLog");
+ int downloadLimit = 0;
+ if(rr!=null)
+ downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ if(actionKey.equals("report.csv.download"))
+ downloadLimit = Globals.getCSVDownloadLimit();
+
+ if(rr!=null && rr.getReportType().equals(AppConstants.RT_LINEAR)) {
+ String sql_whole = rr.getReportDataSQL(userId, downloadLimit, request);
+ request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sql_whole);
+ } else if(rr!=null && rr.getReportType().equals(AppConstants.RT_CROSSTAB)) {
+ rd = rr.loadReportData(-1, userId, downloadLimit,request, false); /* TODO: should be changed to true */
+ request.getSession().setAttribute(AppConstants.RI_REPORT_DATA, rd);
+ }
+ if(!isFromReportLog) {
+ if(pdfAttachmentKey!=null && pdfAttachmentKey.length()>0) {
+ if(actionKey.equals("report.download")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCEL, formFields);
+ } else if (actionKey.equals("report.download.pdf")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_PDF, formFields);
+ } else if (actionKey.equals("report.download.excel2007")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCELX, formFields);
+ }
+ } else {
+ if(actionKey.equals("report.download") ) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_EXCEL, formFields);
+ } else if (actionKey.equals("report.download.pdf")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_PDF, formFields);
+ } else if (actionKey.equals("report.csv.download")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_CSV, formFields);
+ } else if (actionKey.equals("report.text.download")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_TEXT, formFields);
+ } else if (actionKey.equals("report.download.page")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_PAGE_EXCEL, formFields);
+ } else if (actionKey.equals("report.download.excel2007")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_EXCELX, formFields);
+ }
+ }
+ }
+ return nextPage;
+ }
+
+ }
+ }// pdfAttachmentKey
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); //changing session to request
+
+ String reportIDFromSession = (rr!=null)?rr.getReportID():"";
+ logger.debug(EELFLoggerDelegate.debugLogger, ("in Action Handler ********** " + reportID + " " + reportIDFromSession + " "+ actionKey));
+// ReportRuntime rr = (ReportRuntime) request.getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^^^^^^^^^^report ID from session " + ((rr!=null)?rr.getReportID():"no report id in session")));
+ // if(rr!=null && !(rr.getReportID().equals(reportID))) {
+// rr = null;
+// request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, null);
+// }
+
+ ReportHandler rh1 = new ReportHandler();
+ ReportRuntime rr1 = null;
+
+ //debugLogger.debug("Report ID B4 rr1 in ActionHandler "
+ // + ( request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null?((ReportRuntime)request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID():"Not in session"));
+
+
+ //try {
+ boolean isGoBackAction = AppUtils.getRequestFlag(request, AppConstants.RI_GO_BACK);
+
+ if (AppUtils.getRequestFlag(request, AppConstants.RI_SHOW_BACK_BTN) && !isGoBackAction) {
+ // debugLogger.debug("Preserving report");
+ if(!reportID.equals(reportIDFromSession))
+ preserveReportRuntimeAsBackup(request);
+ }
+
+ if(reportID !=null)
+ rr1 = rh1.loadReportRuntime(request, reportID, true, 1);
+ //} catch(Exception e) {
+
+ // }
+// debugLogger.debug("Report ID After rr1 in ActionHandler "
+// + ( request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null?((ReportRuntime)request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID():"Not in session"));
+ if(rr1!=null && rr1.getReportType().equals(AppConstants.RT_DASHBOARD)) {
+ int DASH=7;
+ int requestFlag = DASH;
+ ReportHandler rh = new ReportHandler();
+ // Added below statement to add parent dashboard report id in session.
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REP_ID, reportID);
+ //rr = null;
+ // get dashboard HTML from report runtime. getListOfReportsFromDashBoardHTML
+ String strHTML = rr1.getDashboardLayoutHTML();
+
+ //System.out.println("StrHTML " + strHTML);
+ // call getListOfReportsFromDashBoardHTML returns HashMap
+
+ TreeMap treeMap = getListOfReportsFromDashBoardHTML(strHTML);
+ //System.out.println("Size " + hashMap.size());
+ Set set = treeMap.entrySet();
+ String value = "";
+
+ HashMap reportsRuntimeMap = new HashMap();
+ HashMap reportDataMap = new HashMap();
+ HashMap reportChartDataMap = new HashMap();
+ // displayTypeMap differentiates whether report need to be displayed as data or chart
+ HashMap reportDisplayTypeMap = new HashMap();
+
+ userId = null;
+ userId = AppUtils.getUserID(request);
+ int pageNo = -1;
+ //int downloadLimit = (rr1.getMaxRowsInExcelDownload()>0)?rr1.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ int downloadLimit = 0;
+ int rep_idx = 0;
+ int widthFlag = 0;
+ int heightFlag = 0;
+ ReportRuntime rrDashboardReports = null;
+ Integer intObj = null;
+ ReportRuntime similiarReportRuntime = null;
+ rd = null;
+ DataSet ds = null;
+ String reportIDFromMap = null;
+ int record = 0;
+ boolean buildReportdata = true;
+
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ record++;
+ Map.Entry entry = (Entry) iter.next();
+ //System.out.println("Key "+ entry.getKey());
+ //System.out.println("Value "+ entry.getValue());
+ reportIDFromMap = entry.getValue().toString().substring(1);
+ // The below line is used to optimize, so that if there is already same report id it wouldn't go through the whole process
+ similiarReportRuntime = getSimiliarReportRuntime(reportsRuntimeMap, reportIDFromMap);
+ if(similiarReportRuntime != null ) {
+ rrDashboardReports = (ReportRuntime) getSimiliarReportRuntime(reportsRuntimeMap, reportIDFromMap).clone();
+ intObj = getKey(reportsRuntimeMap,reportIDFromMap);
+ } else {
+ rrDashboardReports = rh.loadReportRuntime(request, reportIDFromMap, true, requestFlag);
+ }
+ if(entry.getValue().toString().toLowerCase().startsWith("c")) {
+ rrDashboardReports.setDisplayMode(ReportRuntime.DISPLAY_CHART_ONLY);
+ } else {
+ rrDashboardReports.setDisplayMode(ReportRuntime.DISPLAY_DATA_ONLY);
+ }
+
+ downloadLimit = (rrDashboardReports.getMaxRowsInExcelDownload()>0)?rrDashboardReports.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ if (new Integer(nvl(rrDashboardReports.getDataContainerWidth(),"100")).intValue() >100) widthFlag = 1;
+ if (new Integer(nvl(rrDashboardReports.getDataContainerHeight(),"100")).intValue() >100) heightFlag = 1;
+
+ if(record == 1) {
+ if(rrDashboardReports.getReportFormFields()!=null && rrDashboardReports.getReportFormFields().size()>0) {
+ buildReportdata = false;
+ if(rDisplayContent) buildReportdata = true;
+ }
+ }
+
+ if(buildReportdata) {
+ if(similiarReportRuntime != null ) {
+ rd = (ReportData) reportDataMap.get(intObj);
+ ds = (DataSet) reportChartDataMap.get(intObj);
+ } else {
+ if (!rrDashboardReports.getReportType().equals(AppConstants.RT_HIVE))
+ rd = rrDashboardReports.loadReportData(pageNo, userId, downloadLimit,request, false /*download*/);
+ else
+ rd = rrDashboardReports.loadHiveLinearReportData(rrDashboardReports.getReportSQL(), userId, 2,request);
+ ds = rrDashboardReports.loadChartData(userId,request);
+ }
+ }
+
+
+ long totalTime = System.currentTimeMillis() - currentTime;
+ formFields = AppUtils.getRequestNvlValue(request, "formFields");
+ if(buildReportdata) {
+ rrDashboardReports.logReportRun(userId, String.valueOf(totalTime),formFields);
+ rrDashboardReports.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_EXECUTION_TIME, formFields);
+ }
+
+ /*reportsRuntimeMap.put(new Integer(entry.getKey().toString()), rrDashboardReports);
+ reportDataMap.put(new Integer(entry.getKey().toString()), rd);
+ reportChartDataMap.put(new Integer(entry.getKey().toString()), ds);
+ reportDisplayTypeMap.put(new Integer(entry.getKey().toString()), entry.getValue().toString().substring(0,1));*/
+
+ reportsRuntimeMap.put(new Integer(entry.getKey().toString())+"_"+rrDashboardReports.getReportID(), rrDashboardReports);
+ reportDisplayTypeMap.put(new Integer(entry.getKey().toString())+"_"+rrDashboardReports.getReportID(), entry.getValue().toString().substring(0,1));
+ if(buildReportdata) {
+ reportDataMap.put(new Integer(entry.getKey().toString())+"_"+rrDashboardReports.getReportID(), rd);
+ reportChartDataMap.put(new Integer(entry.getKey().toString())+"_"+rrDashboardReports.getReportID(), ds);
+ }
+
+ }
+
+ /*if(widthFlag ==1) request.getSession().setAttribute("extendedWidth", "Y");
+ else request.getSession().removeAttribute("extendedWidth");
+ if(heightFlag ==1) request.getSession().setAttribute("extendedHeight", "Y");
+ else request.getSession().removeAttribute("extendedHeight");
+ */
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP, new TreeMap(reportsRuntimeMap));
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP, new TreeMap(reportDisplayTypeMap));
+ if(buildReportdata) {
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP, new TreeMap(reportDataMap));
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP, new TreeMap(reportChartDataMap));
+ }
+// debugLogger.debug("I am inside this if " + rr1.getReportType() + " "+rr1.getReportID());
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr1); //changing session to request
+ //request.setAttribute(AppConstants.SI_REPORT_RUNTIME, rr1);
+ if((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!= null || rr1.getReportType().equals(AppConstants.RT_DASHBOARD)) {
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME, rr1);
+ }
+
+ return "raptor/report_dashboard_run_container.jsp";
+ } else {
+ fromDashboard = AppUtils.getRequestFlag(request,"fromDashboard");
+ if(isDashboardInDrillDownList(request)) fromDashboard= true;
+
+ if(!fromDashboard) {
+ request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP);
+ request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP);
+ request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP);
+ request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP);
+ request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_REP_ID);
+ request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME);
+ request.getSession().removeAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP);
+ request.getSession().removeAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP);
+ }
+ //String pdfAttachmentKey = AppUtils.getRequestValue(request, "pdfAttachmentKey");
+ String report_email_sent_log_id = AppUtils.getRequestValue(request, "log_id");
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Email PDF" + pdfAttachmentKey+" "+ report_email_sent_log_id));
+
+ //email pdf attachment specific
+ if(nvl(pdfAttachmentKey).length()>0 && report_email_sent_log_id !=null)
+ isEmailAttachment = true;
+ if(isEmailAttachment) {
+ /* String query = "Select user_id, rep_id from CR_REPORT_EMAIL_SENT_LOG" +
+ " where rownum = 1" +
+ " and gen_key='"+pdfAttachmentKey.trim()+"'" +
+ " and log_id ="+report_email_sent_log_id.trim() +
+ " and (sysdate - sent_date) < 1 ";*/
+
+
+ String query = Globals.getDownloadAllEmailSent();
+ query = query.replace("[pdfAttachmentKey.trim()]", pdfAttachmentKey.trim());
+ query = query.replace("[report_email_sent_log_id.trim()]", report_email_sent_log_id.trim());
+
+ DataSet ds = DbUtils.executeQuery(query, 1);
+ if(!ds.isEmpty()) {
+ userId = ds.getString(0,"user_id");
+ reportID = ds.getString(0, "rep_id");
+ request.setAttribute("schedule_email_userId", userId);
+ } else {
+ request.setAttribute("message", "This link has expired, please <a href=''>login</a> and regenerate the report");
+ return "raptor/message.jsp";
+ }
+ } else userId = AppUtils.getUserID(request);
+// debugLogger.debug("Report ID b4 showbutton in ActionHandler "
+// + ( request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null?((ReportRuntime)request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID():"Not in session"));
+// debugLogger.debug("Report ID " + reportID + " " + reportIDFromSession);
+
+ // Scheduling Dashoard report
+ if(reportID !=null && nvl(pdfAttachmentKey).length()>0)
+ rr = rh1.loadReportRuntime(request, reportID, true, 1);
+ if(rr!=null && rr.getReportType().equals(AppConstants.RT_DASHBOARD) && nvl(pdfAttachmentKey).length()>0) {
+ int DASH=7;
+ int requestFlag = DASH;
+ ReportHandler rh = new ReportHandler();
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REP_ID, reportID);
+ //rr = null;
+ // get dashboard HTML from report runtime. getListOfReportsFromDashBoardHTML
+ String strHTML = rr.getDashboardLayoutHTML();
+ //System.out.println("StrHTML " + strHTML);
+ // call getListOfReportsFromDashBoardHTML returns HashMap
+
+ TreeMap treeMap = getListOfReportsFromDashBoardHTML(strHTML);
+ //System.out.println("Size " + hashMap.size());
+ Set set = treeMap.entrySet();
+ String value = "";
+
+ HashMap reportsRuntimeMap = new HashMap();
+ HashMap reportDataMap = new HashMap();
+ HashMap reportChartDataMap = new HashMap();
+ HashMap reportDisplayTypeMap = new HashMap();
+
+ userId = null;
+ userId = AppUtils.getUserID(request);
+ int pageNo = -1;
+ int downloadLimit = 0;
+ int rep_idx = 0;
+ int widthFlag = 0;
+ int heightFlag = 0;
+ ReportRuntime rrDashboardReports = null;
+ Integer intObj = null;
+ ReportRuntime similiarReportRuntime = null;
+ rd = null;
+ DataSet ds = null;
+ String reportIDFromMap = null;
+ int record = 0;
+ boolean buildReportdata = true;
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ record++;
+ Map.Entry entry = (Entry) iter.next();
+
+ reportIDFromMap = entry.getValue().toString().substring(1);
+ similiarReportRuntime = getSimiliarReportRuntime(reportsRuntimeMap, reportIDFromMap);
+ if(similiarReportRuntime != null ) {
+ rrDashboardReports = getSimiliarReportRuntime(reportsRuntimeMap, reportIDFromMap);
+ intObj = getKey(reportsRuntimeMap,reportIDFromMap);
+ } else {
+ rrDashboardReports = rh.loadReportRuntime(request, reportIDFromMap, true, requestFlag);
+ }
+
+ downloadLimit = (rrDashboardReports.getMaxRowsInExcelDownload()>0)?rrDashboardReports.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+
+ if (new Integer(nvl(rrDashboardReports.getDataContainerWidth(),"100")).intValue() >100) widthFlag = 1;
+ if (new Integer(nvl(rrDashboardReports.getDataContainerHeight(),"100")).intValue() >100) heightFlag = 1;
+ if(record == 1) {
+ if(rrDashboardReports.getReportFormFields()!=null && rrDashboardReports.getReportFormFields().size()>0) {
+ buildReportdata = false;
+ if(rDisplayContent) buildReportdata = true;
+ }
+ }
+ if(buildReportdata) {
+ if(similiarReportRuntime != null ) {
+ rd = (ReportData) reportDataMap.get(intObj);
+ ds = (DataSet) reportChartDataMap.get(intObj);
+ } else {
+
+ if (!rrDashboardReports.getReportType().equals(AppConstants.RT_HIVE))
+ rd = rrDashboardReports.loadReportData(pageNo, userId, downloadLimit,request, false /*download*/);
+ else
+ rd = rrDashboardReports.loadHiveLinearReportData(rrDashboardReports.getReportSQL(), userId, 2,request);
+ ds = rrDashboardReports.loadChartData(userId,request);
+ }
+ }
+
+
+
+ long totalTime = System.currentTimeMillis() - currentTime;
+ formFields = AppUtils.getRequestNvlValue(request, "formFields");
+
+ rrDashboardReports.logReportRun(userId, String.valueOf(totalTime),formFields);
+ rrDashboardReports.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_EXECUTION_TIME, formFields);
+
+ reportsRuntimeMap.put(new Integer(entry.getKey().toString()), rrDashboardReports);
+ reportDisplayTypeMap.put(new Integer(entry.getKey().toString()), entry.getValue().toString().substring(0,1));
+ if(buildReportdata) {
+ reportDataMap.put(new Integer(entry.getKey().toString()), rd);
+ reportChartDataMap.put(new Integer(entry.getKey().toString()), ds);
+ //reportDisplayTypeMap.put(new Integer(entry.getKey().toString()), entry.getValue().toString().substring(0,1));
+ }
+ }
+
+ /*if(widthFlag ==1) request.getSession().setAttribute("extendedWidth", "Y");
+ else request.getSession().removeAttribute("extendedWidth");
+ if(heightFlag ==1) request.getSession().setAttribute("extendedHeight", "Y");
+ else request.getSession().removeAttribute("extendedHeight");
+ */
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP, new TreeMap(reportsRuntimeMap));
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); //changing session to request
+ if(buildReportdata) {
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP, new TreeMap(reportDisplayTypeMap));
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP, new TreeMap(reportDataMap));
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP, new TreeMap(reportChartDataMap));
+ }
+ //request.setAttribute(AppConstants.SI_REPORT_RUNTIME, rr1);
+ //return nextPage;
+ } else {
+
+ // Ends
+
+
+// debugLogger.debug("Action Handler *****************" + new java.util.Date()+ " " + isGoBackAction);
+ ReportHandler rh = new ReportHandler();
+ //rr = null; // COMMENT THIS LINE
+ boolean resetParams = AppUtils.getRequestFlag(request,
+ AppConstants.RI_RESET_PARAMS);
+ boolean resetAction = AppUtils.getRequestFlag(request,
+ AppConstants.RI_RESET_ACTION);
+ boolean refresh = false;
+ if (resetAction) {
+ rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ resetParams=true;
+ refresh = true;
+ if(rr!=null) {
+ rr.setParamValues(request, resetParams,refresh);
+ request.getSession().removeAttribute(AppConstants.RI_REPORT_DATA);
+ rr.resetVisualSettings();
+ }
+ return nextPage;
+ }
+
+ /*if (isGoBackAction) {
+// debugLogger.debug("Report back in action handler " + ((ReportRuntime) request.getSession().getAttribute(
+// AppConstants.SI_REPORT_RUN_BACKUP))!=null?((ReportRuntime) request.getSession().getAttribute(
+// AppConstants.SI_REPORT_RUN_BACKUP)).getReportID():((ReportRuntime) request.getSession().getAttribute(
+// AppConstants.SI_REPORT_RUN_BACKUP)));
+ rr = null;
+ rr = getReportRuntimeFromBackup(request);
+ if (rr == null)
+ throw new Exception("[ActionHandler.reportRun] Report backup not found");
+ reportID = rr.getReportID();
+ } else {*/
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Ocurring during Schedule "));
+ //TODO differentiate Schedule with other actions
+// if(isEmailAttachment) {
+//
+// } else {
+//
+// }
+ rr = rh.loadReportRuntime(request, reportID);
+ //setParamValues called for Drilldown to display formfield
+ //rr.setParamValues(request, false,true);
+
+ //} // else
+
+ ArrayList aL = (ArrayList)request.getSession().getAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ ReportRuntime aLR = null;
+ if(aL != null) {
+// for (int i = 1; i < aL.size(); i++) {
+// aLR = (ReportRuntime) aL.get(i);
+// if (!aLR.getReportID().equals(reportID)) {
+// request.setAttribute(AppConstants.RI_SHOW_BACK_BTN, "Y");
+// }
+// }
+// if(reportID.equals(reportIDFromSession)) {
+ aLR = (ReportRuntime) aL.get(0);
+ if (aLR!=null && !aLR.getReportID().equals(reportID)) {
+ request.setAttribute(AppConstants.RI_SHOW_BACK_BTN, "Y");
+ }
+// }
+ }
+
+ if(rDisplayContent)
+ rr.setDisplayFlags(true, true);
+
+ if (rr.getDisplayContent()) {
+ int pageNo = 0;
+ if (isGoBackAction)
+ pageNo = rr.getCachedPageNo();
+ else {
+ try {
+ pageNo = Integer.parseInt(AppUtils.getRequestNvlValue(request, AppConstants.RI_NEXT_PAGE));
+ } catch (Exception e) {
+ }
+
+ String vAction = AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_VISUAL_ACTION);
+ String vCoId = AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID);
+ if (vAction.equals(AppConstants.VA_HIDE))
+ rr.hideColVisual(vCoId);
+ else if (vAction.equals(AppConstants.VA_SHOW))
+ rr.showColVisual(vCoId);
+ else if (vAction.equals(AppConstants.VA_SORT)) {
+ rr.sortColVisual(vCoId);
+ pageNo = 0;
+ } // else
+ } // else
+
+ int downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ if(isEmailAttachment) {
+ String limit = nvl(request.getParameter("download_limit"),"1000");
+ downloadLimit = Integer.parseInt(limit);
+ }
+ //if (action.startsWith("mobile")) rr.setPageSize(5);
+ long reportTime = System.currentTimeMillis();
+ if (!rr.getReportType().equals(AppConstants.RT_HIVE))
+ rd = rr.loadReportData(pageNo, userId, downloadLimit,request,false /*download*/);
+ else
+ rd = rr.loadHiveLinearReportData(rr.getReportSQL(), userId, 2,request);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] ------->Time Taken for the loading report data --- " + (System.currentTimeMillis() - reportTime)));
+ ReportData rd_whole = null;
+ boolean hideReportMap = rr.isDisplayOptionHideMap()||AppUtils.getRequestNvlValue(request, "noMap").equals("Y");
+/* if (Globals.getMapAllowedYN().equals("Y") && !hideReportMap && rr.getReportMap()!=null){
+ rd_whole = rr.loadReportData(-1, userId, downloadLimit,request);
+ }
+*/
+ request.getSession().setAttribute(AppConstants.RI_REPORT_DATA, rd);
+ //if (Globals.getMapAllowedYN().equals("Y") && !hideReportMap && (rr.getReportMap()!=null && rr.getReportMap().getLatColumn()!=null && rr.getReportMap().getLongColumn()!=null)) {
+ if(rr!=null && rr.getReportType().equals(AppConstants.RT_LINEAR)) {
+ String sql_whole = rr.getReportDataSQL(userId, downloadLimit, request);
+ request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sql_whole);
+ } else if(rr.getReportType().equals(AppConstants.RT_HIVE)) {
+ String sql_whole = rr.getReportSQL();
+ request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sql_whole);
+ }
+ //}
+ //request.setAttribute(AppConstants.RI_REPORT_DATA_WHOLE, rd_whole);
+ // if(rr.getReportDataSize() > Globals.getFlatFileLowerLimit() && rr.getReportDataSize() <= Globals.getFlatFileUpperLimit() ) {
+ // rr.setFlatFileName(rh.saveFlatFile(request, rd, rr
+ // .getParamNameValuePairs(), rr.getReportName(), rr.getReportDescr()));
+ // }
+ //if(actionKey!=null && actionKey.equals("report.download")) {
+// rr.setExcelPageFileName(rh.saveAsExcelFile(request, rd, rr
+// .getParamNameValuePairs(), rr.getReportName(), rr.getReportDescr()));
+ //}
+ if (!rr.getReportType().equals(AppConstants.RT_HIVE)) {
+ long currentChartTime = System.currentTimeMillis();
+ DataSet chartDS = rr.loadChartData(userId,request);
+ if(chartDS != null)
+ request.getSession().setAttribute(AppConstants.RI_CHART_DATA, rr.loadChartData(userId,request));
+ else
+ request.getSession().removeAttribute(AppConstants.RI_CHART_DATA);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] ------->Time Taken for the loading chart data --- " + (System.currentTimeMillis() - currentChartTime)));
+ }
+
+/* if((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) {
+ request.getSession().setAttribute("FirstDashReport", rr);
+ }
+*/
+ }
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); //changing session to request
+ request.getSession().setAttribute(AppConstants.RI_REPORT_DATA, rd);
+ } // else
+ long totalTime = System.currentTimeMillis() - currentTime;
+ formFields = AppUtils.getRequestNvlValue(request, "formFields");
+ request.setAttribute(AppConstants.RLA_EXECUTION_TIME, "" + totalTime);
+
+
+ boolean isFromReportLog = AppUtils.getRequestFlag(request, "fromReportLog");
+ if(!isFromReportLog) {
+ if(pdfAttachmentKey!=null && pdfAttachmentKey.length()>0) {
+ if(actionKey.equals("report.download")) {
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCEL, formFields);
+ } else if (actionKey.equals("report.download.pdf")) {
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_SCHEDULED_DOWNLOAD_PDF, formFields);
+ }
+ } else {
+ if(actionKey.equals("report.download") ) {
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_EXCEL, formFields);
+ } else if (actionKey.equals("report.download.pdf")) {
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_PDF, formFields);
+ } else if (actionKey.equals("report.csv.download")) {
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_CSV, formFields);
+ } else if (actionKey.equals("report.text.download")) {
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_TEXT, formFields);
+ } else {
+
+ //rr.logReportRun(userId, String.valueOf(totalTime),formFields);
+ if(rd!=null && !action.equals("report.run.container"))
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_EXECUTION_TIME, formFields);
+ }
+ }
+ } else {
+ rr.logReportExecutionTimeFromLogList(userId, String.valueOf(totalTime),formFields);
+ }
+
+/* if((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) {
+ reportID = (String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID);
+ ReportRuntime rrDash = rh1.loadReportRuntime(request, reportID, true, 1);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rrDash);
+ }
+*/
+ if(rr.isDrillDownURLInPopupPresent()) {
+ request.getSession().setAttribute("parent_"+rr.getReportID()+"_rr", rr);
+ request.getSession().setAttribute("parent_"+rr.getReportID()+"_rd", rd);
+ }
+
+ if(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) {
+ return "raptor/report_crosstab_run_container.jsp";
+ } else if (rr.getReportType().equals(AppConstants.RT_HIVE) && !isEmailAttachment) {
+ return "raptor/report_hive_run_container.jsp";
+ }
+ } // else
+
+ boolean isEmbedded = false;
+ Object temp = request.getSession().getAttribute("isEmbedded");
+ if(temp!=null){
+ isEmbedded = (boolean)temp;
+ }
+ if(isEmbedded && !action.equals("chart.run")){
+ HashMap embeddedReportsRuntimeMap = null;
+ HashMap embeddedReportsDataMap = null;
+ if(request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP)!= null){
+ embeddedReportsRuntimeMap = (HashMap)request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP);
+ } else {
+ embeddedReportsRuntimeMap = new HashMap();
+ }
+ if(request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP)!= null){
+ embeddedReportsDataMap = (HashMap)request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP);
+ } else {
+ embeddedReportsDataMap = new HashMap();
+ }
+ embeddedReportsRuntimeMap.put(rr.getReportID(), rr);
+ embeddedReportsDataMap.put(rr.getReportID(), rd);
+
+
+ request.getSession().setAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP, embeddedReportsRuntimeMap);
+ request.getSession().setAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP, embeddedReportsDataMap);
+
+ }
+
+ ReportJSONRuntime reportJSONRuntime = rr.createReportJSONRuntime(request, rd);
+ ObjectMapper mapper = new ObjectMapper();
+ //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
+ //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String jsonInString = "";
+ try {
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(reportJSONRuntime);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+
+ }
+ return jsonInString;
+ } catch (RaptorException e) {
+ try {
+ e.printStackTrace();
+
+ if(rr!=null) { // when user tries report they don't have access this should not throw exception that's why this if is added.
+ if(isEmailAttachment)
+ rr.logReportExecutionTime(userId, "", "Scheduled: " + AppConstants.RLA_ERROR, formFields);
+ else
+ rr.logReportExecutionTime(userId, "", "On Demand: " + AppConstants.RLA_ERROR, formFields);
+ }
+
+ ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime();
+ errorJSONRuntime.setErrormessage(e.getMessage());
+ errorJSONRuntime.setStacktrace(getStackTrace(e));
+ ObjectMapper mapper = new ObjectMapper();
+ //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
+ //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String jsonInString = "";
+ try {
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+
+ }
+ return jsonInString;
+
+ } catch (RaptorException ex) {
+ nextPage = (new ErrorHandler()).processFatalError(request, ex);
+ ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime();
+ errorJSONRuntime.setErrormessage(ex.getMessage());
+ errorJSONRuntime.setStacktrace(getStackTrace(ex));
+ ObjectMapper mapper = new ObjectMapper();
+ //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
+ //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String jsonInString = "";
+ try {
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime);
+ } catch (Exception ex1) {
+ ex1.printStackTrace();
+ }
+ return jsonInString;
+ }
+ //nextPage = (new ErrorHandler()).processFatalError(request, e);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime();
+ errorJSONRuntime.setErrormessage(t.toString());
+ errorJSONRuntime.setStacktrace(getStackTrace(t));
+ ObjectMapper mapper = new ObjectMapper();
+ //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
+ //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String jsonInString = "";
+ try {
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+
+ }
+ return jsonInString;
+
+ }
+ //return nextPage;
+ } // reportRun
+
+ public static String getStackTrace(Throwable aThrowable) {
+ Writer result = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(result);
+ aThrowable.printStackTrace(printWriter);
+ return result.toString();
+ }
+
+ /**
+ * The below method is used to optimize, so that if there is already same report id in hashMap it wouldn't go through the whole process again.
+ **/
+ private ReportRuntime getSimiliarReportRuntime(HashMap reportsRuntimeMap, String reportID) {
+ Set set = reportsRuntimeMap.entrySet();
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ if (((ReportRuntime) entry.getValue()).getReportID().equals(reportID)) {
+ return (ReportRuntime) entry.getValue();
+ }
+ }
+ return null;
+ }
+
+ private Integer getKey(HashMap reportsRuntimeMap, String reportID) {
+ Set set = reportsRuntimeMap.entrySet();
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ if (((ReportRuntime) entry.getValue()).getReportID().equals(reportID)) {
+ return new Integer(((String) entry.getKey()).substring(2));
+ }
+ }
+ return null;
+ }
+
+ public String reportSearch(HttpServletRequest request, String nextPage) {
+ return reportSearchExecute(request, nextPage);
+ } // reportSearch
+
+ public String reportSearchUser(HttpServletRequest request, String nextPage) {
+ removeVariablesFromSession(request);
+ request.setAttribute(AppConstants.RI_USER_REPORTS, "Y");
+ return reportSearchExecute(request, nextPage);
+ } // reportSearchUser
+
+ public String reportSearchPublic(HttpServletRequest request, String nextPage) {
+ removeVariablesFromSession(request);
+ request.setAttribute(AppConstants.RI_PUBLIC_REPORTS, "Y");
+ return reportSearchExecute(request, nextPage);
+ } // reportSearchPublic
+
+ public String reportSearchFavorites(HttpServletRequest request, String nextPage) {
+ removeVariablesFromSession(request);
+ request.setAttribute(AppConstants.RI_FAVORITE_REPORTS, "Y");
+ return reportSearchExecute(request, nextPage);
+ } // reportSearchFavorites
+
+ public String reportSearchExecute(HttpServletRequest request, String nextPage) {
+ removeVariablesFromSession(request);
+ try {
+ SearchHandler sh = new SearchHandler();
+ ReportSearchResultJSON sr = sh.loadReportSearchResult(request);
+ return sr.getJSONString();
+ //request.setAttribute(AppConstants.RI_SEARCH_RESULT, sr);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportSearchExecute
+
+ public String reportChartRun(HttpServletRequest request, String nextPage) {
+ ChartWebRuntime cwr = new ChartWebRuntime();
+ return cwr.generateChart(request, false); //no data
+ } // reportSearchExecute
+
+ public String reportChartDataRun(HttpServletRequest request, String nextPage) {
+ ChartWebRuntime cwr = new ChartWebRuntime();
+ return cwr.generateChart(request); //data
+ } // reportSearchExecute
+
+
+ // public String reportRunExecute(HttpServletRequest request, String nextPage) {
+// try {
+// ReportRunHandler rh = new ReportRunHandler();
+// ReportRunResultJSON sr = rh.loadReportRunResult(request);
+// return sr.getJSONString();
+// //request.setAttribute(AppConstants.RI_SEARCH_RESULT, sr);
+// } catch (RaptorException e) {
+// nextPage = (new ErrorHandler()).processFatalError(request, e);
+// }
+//
+// return nextPage;
+// }
+
+ public String getQuickLinksJSON(HttpServletRequest request, String nextPage) {
+ String jsonInString = null;
+ try {
+ ArrayList<QuickLink> quickLinks = ReportLoader.getQuickLinksJSON(request, request.getParameter("quick_links_menu_id"),true);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(quickLinks);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return jsonInString;
+ }
+
+ public String processScheduleReportList(HttpServletRequest request, String nextPage) {
+ String reportID = "";
+ reportID = AppUtils.getRequestNvlValue(request, "schedule_reports");
+ if (nvl(reportID).length()<=0)
+ reportID = AppUtils.getRequestNvlValue(request, AppConstants.RI_REPORT_ID);
+ // Added for form field chaining in schedule tab so that setParamValues() is called
+ request.setAttribute(AppConstants.SCHEDULE_ACTION, "Y");
+
+ try {
+ boolean isAdmin = AppUtils.isAdminUser(request);
+ boolean check = ReportLoader.doesUserCanScheduleReport(request, null);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^^^^^^^^^Check " + check + " Admin "+ isAdmin));
+
+ if(check || isAdmin) {
+ if(reportID.length()>0) {
+ ReportHandler rh = new ReportHandler();
+ ReportDefinition rdef = rh.loadReportDefinition(request, reportID);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+ ReportSchedule reportSchedule = null;
+ if(rdef!=null) {
+ reportSchedule = new ReportSchedule(reportID, AppUtils.getUserID(request), false, request);
+ }
+ request.getSession().setAttribute(AppConstants.SI_REPORT_SCHEDULE, reportSchedule);
+ }
+ } else {
+ //String message = "You have reached your schedule limit. Please visit this page again after removing your old schedules in \"My Schedule\" section.";
+ String message = "You have reached the scheduled report limit for your Login ID. Please remove any old schedule requests in the \"My Scheduled Reports\" screen before attempting to schedule any additional reports.";
+ nextPage = (new ErrorHandler()).processFatalError(request, new RaptorSchedularException(message));
+ }
+
+ } catch(Exception ex) { ex.printStackTrace();}
+ return nextPage;
+ }
+
+ public String processSchedule(HttpServletRequest request, String nextPage) {
+
+ // Added for form field chaining in schedule tab so that setParamValues() is called
+
+ request.setAttribute(AppConstants.SCHEDULE_ACTION, "Y");
+ if(request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE)!=null && (!AppUtils.getRequestNvlValue(request, AppConstants.RI_ACTION).equals("report.schedule_only_from_search"))) {
+ String action = nvl(request.getParameter(AppConstants.RI_WIZARD_ACTION),
+ AppConstants.WA_BACK);
+ String scheduleID = "";
+ scheduleID = AppUtils.getRequestValue(request, AppConstants.RI_SCHEDULE_ID);
+ ReportSchedule reportSchedule = null;
+
+ if( nvl(scheduleID).length() <= 0) {
+ reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE);
+ scheduleID = reportSchedule.getScheduleID();
+ }
+
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ try {
+ boolean isAdmin = AppUtils.isAdminUser(request);
+ boolean check = ReportLoader.doesUserCanScheduleReport(request, scheduleID);
+ if(!isAdmin && !check) {
+ String message = "You have reached the scheduled report limit for your Login ID. Please remove any old schedule requests in the My Scheduled Reports screen before attempting to schedule any additional reports.";
+ nextPage = (new ErrorHandler()).processFatalError(request, new RaptorSchedularException(message));
+ return nextPage;
+ }
+
+ } catch (Exception ex) { ex.printStackTrace();}
+ if(reportSchedule == null) reportSchedule = new ReportSchedule(reportID, scheduleID, AppUtils.getUserID(request), request);
+ String formFields = "";
+ formFields = reportSchedule.getFormFields();
+ formFields = (formFields.length()>1)?formFields.substring(1):formFields;
+ String formFieldsArr[] = formFields.split("&");
+ String sessionParams[] = Globals.getSessionParamsForScheduling().split(",");
+
+ for (int i=0; i<sessionParams.length; i++) {
+ for (int j = 0; j < formFieldsArr.length; j++) {
+ if(formFieldsArr[j].startsWith(sessionParams[i])) {
+ request.setAttribute(sessionParams[i], formFieldsArr[j].substring(formFieldsArr[j].indexOf("=")+1));
+ }
+
+ }
+ }
+
+ boolean reportUpdated = false;
+ WizardProcessor wp = null;
+ Connection connection = null;
+ try {
+ connection = DbUtils.startTransaction();
+ wp = new WizardProcessor();
+ String toListUpdated = nvl(request.getParameter("toListUpdated"),"false" );
+ reportUpdated = wp.processAdhocSchedule(request, action);
+ if(reportUpdated && toListUpdated.equals("false")) {
+ request.setAttribute("message", "Report has been scheduled successfully");
+ reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE);
+ //if(AppUtils.getRequestNvlValue(request, AppConstants.RI_SCHEDULE_ID).length()<=0) {
+ reportSchedule.persistScheduleData(connection, request);
+ DbUtils.commitTransaction(connection);
+ //}
+ }
+ } catch (ValidationException ve) {
+ (new ErrorHandler()).processError(request, ve);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ e.printStackTrace();
+ try {
+ DbUtils.rollbackTransaction(connection);
+ } catch (Exception e1) {e1.printStackTrace();}
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ finally {
+ try {
+ DbUtils.clearConnection(connection);
+ } catch (Exception e1) {e1.printStackTrace();}
+ }
+ request.setAttribute("schedule_only", "Y");
+ //request.getSession().removeAttribute(AppConstants.SI_REPORT_SCHEDULE);
+
+ return nextPage;
+ } else {
+ try {
+ String scheduleID = "";
+ scheduleID = AppUtils.getRequestValue(request, AppConstants.RI_SCHEDULE_ID);
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ request.setAttribute("schedule_only", "Y");
+ ReportHandler rh = new ReportHandler();
+ ReportDefinition rdef = rh.loadReportDefinition(request, reportID);
+ ReportSchedule reportSchedule = null;
+ if(rdef!=null) {
+ reportSchedule = new ReportSchedule(reportID, scheduleID, AppUtils.getUserID(request), request);
+ }
+ String formFields = "";
+ formFields = reportSchedule.getFormFields();
+ formFields = (formFields.length()>1)?formFields.substring(1):formFields;
+ String formFieldsArr[] = formFields.split("&");
+ String sessionParams[] = Globals.getSessionParamsForScheduling().split(",");
+
+ for (int i=0; i<sessionParams.length; i++) {
+ for (int j = 0; j < formFieldsArr.length; j++) {
+ if(formFieldsArr[j].startsWith(sessionParams[i])) {
+ request.setAttribute(sessionParams[i], formFieldsArr[j].substring(formFieldsArr[j].indexOf("=")+1));
+ }
+
+ }
+ }
+ request.getSession().setAttribute(AppConstants.SI_REPORT_SCHEDULE, reportSchedule);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ }
+ } // processSchedule
+
+ /****Remove Report Data from Session when Javascript throw error on onSubmit***/
+ public String removeReportDataFromSession (HttpServletRequest request, String nextPage) {
+ HttpSession session = request.getSession(false);
+/* if (session.getAttribute(AppConstants.RI_REPORT_DATA)!=null)
+ request.getSession().removeAttribute(AppConstants.RI_REPORT_DATA);
+ if (request.getAttribute(AppConstants.RI_REPORT_DATA)!=null)
+ request.removeAttribute(AppConstants.RI_REPORT_DATA);
+ if (session.getAttribute(AppConstants.RI_CHART_DATA)!=null)
+ request.getSession().removeAttribute(AppConstants.RI_CHART_DATA);
+ if (request.getAttribute(AppConstants.RI_CHART_DATA)!=null)
+ request.removeAttribute(AppConstants.RI_CHART_DATA);
+*/ /*if (session.getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null)
+ request.getSession().removeAttribute(AppConstants.SI_REPORT_RUNTIME);*/
+ //request.setAttribute(AppConstants.RI_RESET_ACTION, "Y");
+ return nextPage;
+
+ } // processScheduleDelete
+
+ /****Added to delete a schedule***/
+ public String processScheduleDelete(HttpServletRequest request, String nextPage) {
+
+ // Added for form field chaining in schedule tab so that setParamValues() is called
+ request.setAttribute(AppConstants.SCHEDULE_ACTION, "Y");
+ try {
+ String scheduleID = "";
+ scheduleID = AppUtils.getRequestValue(request, AppConstants.RI_SCHEDULE_ID);
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ ReportHandler rh = new ReportHandler();
+ ReportDefinition rdef = rh.loadReportDefinition(request, reportID);
+ String myScheduleRepID = AppUtils.getRequestNvlValue(request, "myScheduleRepId");
+ if (myScheduleRepID.equals(""))
+ myScheduleRepID = "2670";
+ ReportSchedule reportSchedule = null;
+ if(rdef!=null) {
+ reportSchedule = new ReportSchedule(reportID, scheduleID, AppUtils.getUserID(request), request);
+ Connection connection = null;
+
+ try {
+ connection = DbUtils.startTransaction();
+ reportSchedule.deleteScheduleData(connection);
+ DbUtils.commitTransaction(connection);
+ } catch (ValidationException ve) {
+ (new ErrorHandler()).processError(request, ve);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ e.printStackTrace();
+ try {
+ DbUtils.rollbackTransaction(connection);
+ } catch (Exception e1) {e1.printStackTrace();}
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ finally {
+ try {
+ DbUtils.clearConnection(connection);
+ } catch (Exception e1) {e1.printStackTrace();}
+ }
+ }
+ request.setAttribute(AppConstants.RI_REPORT_ID, myScheduleRepID);
+ request.setAttribute(AppConstants.RI_REFRESH, "y");
+ nextPage = this.reportRun(request, nextPage);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+ return nextPage;
+
+ } // processScheduleDelete
+
+ public String reportWizard(HttpServletRequest request, String nextPage) {
+ String action = nvl(request.getParameter(AppConstants.RI_WIZARD_ACTION),
+ AppConstants.WA_BACK);
+ String goToStep = nvl(request.getParameter(AppConstants.RI_GO_TO_STEP));
+ try {
+ (new WizardProcessor()).processWizardStep(request);
+
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ //debugLogger.debug("Step Count " + ws.getStepCount());
+ //debugLogger.debug("Dashboard " + ((ws instanceof WizardSequenceDashboard) ? ws.getStepCount(): "Not a Dashboard"));
+ //debugLogger.debug("GO TO STEP LENGTH " + goToStep.length());
+ //debugLogger.debug("NumDash Cols in Action Handler " + AppUtils.getRequestNvlValue(request, "numDashCols"));
+ if (goToStep.length() > 0)
+ ws.performGoToStep(goToStep);
+ else
+ ws.performAction(action, rdef);
+ } catch (ValidationException ve) {
+ (new ErrorHandler()).processError(request, ve);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+ return nextPage;
+ } // reportWizard
+
+ public String refreshCache ( HttpServletRequest request, String nextPage ) {
+ //DataCache.refreshReportTableSources();
+ removeVariablesFromSession(request);
+ DataCache.refreshAll();
+ Globals.getAppUtils().resetUserCache();
+ request.setAttribute("message", "Cache Refreshed");
+ return nextPage;
+ }
+ public String reportCreate(HttpServletRequest request, String nextPage) {
+ try {
+ removeVariablesFromSession(request);
+ ReportDefinition rdef = ReportDefinition.createBlank(request);
+
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+ // request.setAttribute(AppConstants.RI_CUR_STEP,
+ // AppConstants.WS_DEFINITION);
+ DataCache.refreshReportTableSources();
+ request.getSession().removeAttribute("remoteDB");
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportCreate
+
+ public String reportImportSave(HttpServletRequest request, String nextPage) {
+ try {
+ String reportXML = nvl(AppUtils.getRequestValue(request, "reportXML")).trim();
+
+ ReportHandler rh = new ReportHandler();
+ ReportDefinition rdef = rh.createReportDefinition(request, "-1", reportXML);
+ rdef.updateReportDefType();
+ rdef.generateWizardSequence(request);
+ rdef.setReportName("Import: " + rdef.getReportName());
+ rdef.clearAllDrillDowns();
+
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+ } catch (RaptorException e) {
+ request.setAttribute("error_extra_msg", "Unable to parse XML. Nested error: ");
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportImportSave
+
+ private String reportLoad(HttpServletRequest request, String nextPage, boolean asCopy) {
+ try {
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+
+ ReportHandler rh = new ReportHandler();
+ ReportDefinition rdef = rh.loadReportDefinition(request, reportID);
+ if (asCopy)
+ rdef.setAsCopy(request);
+ else
+ rdef.checkUserWriteAccess(request);
+
+ rdef.getWizardSequence().performGoToStep(AppConstants.WS_DEFINITION);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+ // request.setAttribute(AppConstants.RI_CUR_STEP,
+ // AppConstants.WS_DEFINITION);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportLoad
+
+ public String reportCopy(HttpServletRequest request, String nextPage) {
+ return reportLoad(request, nextPage, true);
+ } // reportCopy
+
+ public String reportEdit(HttpServletRequest request, String nextPage) {
+ return reportLoad(request, nextPage, false);
+ } // reportEdit
+
+ public String reportDelete(HttpServletRequest request, String nextPage) {
+ try {
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ try {
+ int i = Integer.parseInt(reportID);
+ } catch(NumberFormatException ex) {
+ throw new UserDefinedException("Not a valid report id");
+ }
+ String userID = AppUtils.getUserID(request);
+
+ (new ReportSecurity(reportID)).checkUserDeleteAccess(request);
+
+ ReportLoader.deleteReportRecord(reportID);
+
+ return "deleted:true";
+ //nextPage = reportSearchExecute(request, nextPage);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ //return nextPage;
+ return "deleted:false";
+ } // reportDelete
+
+ private String generateSearchString(HttpServletRequest request) {
+ String searchString = AppUtils.getRequestNvlValue(request, AppConstants.RI_SEARCH_STRING);
+ boolean containFlag = AppUtils.getRequestFlag(request, AppConstants.RI_CONTAIN_FLAG);
+ return (searchString.length() > 0) ? ((containFlag ? "%" : "") + searchString + "%"):"";
+ } // generateSearchString
+
+ public String reportFormFieldPopup(HttpServletRequest request, String nextPage) {
+ try {
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+
+ FormField ff = rr.getFormField(request.getParameter(AppConstants.RI_FIELD_NAME));
+ ReportFormFields rff = rr.getReportFormFields();
+
+ int idx = 0;
+ FormField ff1 = null;
+ Map fieldNameMap = new HashMap();
+ int countOfFields = 0 ;
+ String userId = AppUtils.getUserID(request);
+ IdNameList lookup = ff.getLookupList();
+ String oldSQL = lookup.getOldSql();
+
+ if(AppUtils.getRequestFlag(request, AppConstants.RI_TEXTFIELD_POP)) {
+ for(rff.resetNext(); rff.hasNext(); idx++) {
+ ff1 = rff.getNext();
+ fieldNameMap.put(ff1.getFieldName(), ff1.getFieldDisplayName());
+ countOfFields++;
+ }
+
+
+ //List formParameter = new ArrayList();
+ String formField = "";
+ HashMap valuesMap = new HashMap();
+ for(int i = 0 ; i < rff.size(); i++) {
+ formField = ((FormField)rff.getFormField(i)).getFieldName();
+ if(request.getParameterValues(formField) != null && request.getParameterValues(formField).length > 1 ) {
+ String[] vals = (String[]) request.getParameterValues(formField);
+ String value = "";
+ StringBuffer valueBuf = new StringBuffer();
+ for(int ii = 0 ; ii < vals.length; ii++) {
+ if(ii == 0) valueBuf.append("(");
+ valueBuf.append(vals[ii]);
+ if(ii == vals.length-1) valueBuf.append(")");
+ else valueBuf.append(",");
+ }
+ value = valueBuf.toString();
+ valuesMap.put(fieldNameMap.get(formField), value);
+ } else if(request.getParameter(formField) != null) {
+ valuesMap.put(fieldNameMap.get(formField), request.getParameter(formField));
+ }
+ }
+ if(countOfFields != 0) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = (oldSQL==null)?lu.getSql():oldSQL;
+ oldSQL = SQL;
+ Set set = valuesMap.entrySet();
+ String value = "";
+ StringBuffer valueBuf = new StringBuffer();
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ if(entry.getValue() instanceof String[]) {
+ String[] vals = (String[]) entry.getValue();
+ for(int i = 0 ; i < vals.length; i++) {
+ if(i == 0) valueBuf.append("(");
+ valueBuf.append(vals[i]);
+ if(i == vals.length-1) valueBuf.append(")");
+ else valueBuf.append(",");
+ }
+ value = valueBuf.toString();
+ } else {
+ value = (String) entry.getValue();
+ }
+ // added so empty string would be treated as null value if not given in single quotes.
+ if(value==null || value.trim().length()<=0) value="NULL";
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", Utils.oracleSafe(value));
+ }
+ if(request.getParameter(ff.getFieldName())!=null) {
+ lookup = new IdNameSql(-1,SQL,null);
+ lookup.setOldSql(oldSQL);
+ }
+ else {
+ lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
+ lookup.setOldSql(oldSQL);
+ }
+ //lookup.loadData("0");
+ }
+ if(lookup instanceof IdNameSql) ((IdNameSql)lookup).setDataSizeUsedinPopup(-3); // -3 indicates to run the count sql for pagination.
+ }
+ if(lookup instanceof IdNameSql) {
+ ((IdNameSql)lookup).loadUserData(request.getParameter(AppConstants.RI_NEXT_PAGE),
+ nvl(generateSearchString(request),"%"), rr.getDBInfo(),userId);
+ }
+
+ int dataSizeForPopUp = 0;
+ if(lookup instanceof IdNameSql) {
+ dataSizeForPopUp = ((IdNameSql)lookup).getDataSizeUsedinPopup();
+ } else
+ dataSizeForPopUp = lookup.getDataSize();
+
+ ff.setLookupList(lookup);
+ request.setAttribute("lookupList", lookup);
+ if(dataSizeForPopUp >= 0)
+ request.getSession().setAttribute(AppConstants.SI_DATA_SIZE_FOR_TEXTFIELD_POPUP, ""+dataSizeForPopUp);
+ } catch (RaptorException e) {
+ e.printStackTrace();
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+ return nextPage;
+ } // reportFormFieldPopup
+
+ public String reportValuesMapDefPopup(HttpServletRequest request, String nextPage) {
+ try {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String colName = AppUtils.getRequestNvlValue(request, "colName");
+ String colType = nvl(AppUtils.getRequestValue(request, "colType"),
+ AppConstants.CT_CHAR);
+ String displayName = AppUtils.getRequestNvlValue(request, "displayName");
+ String displayFormat = AppUtils.getRequestNvlValue(request, "displayFormat");
+ String tableId = AppUtils.getRequestNvlValue(request, "tableId");
+ String dbInfo = rdef.getDBInfo();
+ if (Utils.isNull(dbInfo)) {
+ dbInfo = (String) request.getSession().getAttribute("remoteDB");
+ }
+ /*String query = "SELECT x FROM (SELECT DISTINCT "
+ + (colType.equals(AppConstants.CT_DATE) ? ("TO_CHAR(" + colName + ", '"
+ + nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT) + "')")
+ : colName) + " x FROM "
+ + rdef.getTableById(tableId).getTableName() + " WHERE " + colName
+ + " IS NOT NULL ORDER BY 1) xx WHERE ROWNUM <= "
+ + Globals.getDefaultPageSize();*/
+
+
+ String q1 = Globals.getReportValuesMapDefA();
+
+ String q2 = Globals.getReportValuesMapDefB();
+ q2 = q2.replace("[colName]", colName);
+ q2 = q2.replace("[nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT)]", nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT));
+
+ String q3 = Globals.getReportValuesMapDefC();
+ q3 = q3.replace("[colName]", colName);
+
+ String q4 = Globals.getReportValuesMapDefD();
+ q4 = q4.replace("[rdef.getTableById(tableId).getTableName()]", rdef.getTableById(tableId).getTableName());
+ q4 = q4.replace("[colName]", colName);
+ q4 = q4.replace("[Globals.getDefaultPageSize()]", String.valueOf(Globals.getDefaultPageSize()));
+
+ String query = q1 + (colType.equals(AppConstants.CT_DATE) ? q2 : q3) + q4;
+
+ DataSet ds = ConnectionUtils.getDataSet(query, dbInfo);
+ request.setAttribute(AppConstants.RI_DATA_SET, ds);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportValuesMapDefPopup
+
+ public String reportDrillDownToReportDefPopup(HttpServletRequest request, String nextPage) {
+ try {
+ // ReportDefinition rdef = (ReportDefinition)
+ // request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ String ddReportID = AppUtils
+ .getRequestNvlValue(request, AppConstants.RI_REPORT_ID);
+ ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, ddReportID,
+ false);
+ if (ddRr != null)
+ request.setAttribute(AppConstants.RI_FORM_FIELDS, ddRr.getReportFormFields());
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportDrillDownToReportDefPopup
+
+ public String reportFilterDataPopup(HttpServletRequest request, String nextPage) {
+ try {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String colId = AppUtils.getRequestNvlValue(request, AppConstants.RI_COLUMN_ID);
+ IdNameColLookup lookup = null;
+ String dbInfo = rdef.getDBInfo();
+ if (Utils.isNull(dbInfo)) {
+ dbInfo = (String) request.getSession().getAttribute("remoteDB");
+ }
+ if (!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_PARAMS))
+ lookup = (IdNameColLookup) request.getSession().getAttribute(
+ AppConstants.SI_COLUMN_LOOKUP);
+ if (lookup == null || (!colId.equals(lookup.getColId()))) {
+ DataColumnType dct = rdef.getColumnById(colId);
+ lookup = new IdNameColLookup(colId, rdef.getTableById(dct.getTableId())
+ .getTableName(), dct.getColName(), rdef.getSelectExpr(dct), dct
+ .getColName()
+ + (dct.getColType().equals(AppConstants.CT_DATE) ? " DESC" : ""));
+ request.getSession().setAttribute(AppConstants.SI_COLUMN_LOOKUP, lookup);
+ } // if
+
+ lookup.loadData(nvl(request.getParameter(AppConstants.RI_NEXT_PAGE), "0"),
+ generateSearchString(request), dbInfo);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportFilterDataPopup
+
+ public String reportShowSQLPopup(HttpServletRequest request, String nextPage) {
+ try {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ String reportSQL = rdef.generateSQL(AppUtils.getUserID(request),request);
+
+ String[] sqlClause = { "SELECT ", "FROM ", "WHERE ", "GROUP BY ", "HAVING ",
+ "ORDER BY " };
+
+ int idxNext = 0;
+ StringBuffer sb = new StringBuffer();
+ while (idxNext < sqlClause.length) {
+ sb.append("<b>");
+ if (idxNext > 0)
+ sb.append("&nbsp;&nbsp;&nbsp;&nbsp;");
+ sb.append(sqlClause[idxNext]);
+ sb.append("</b><br>\n");
+
+ int clauseStartPos = reportSQL.indexOf(sqlClause[idxNext])
+ + sqlClause[idxNext].length();
+ do
+ idxNext++;
+ while ((idxNext < sqlClause.length)
+ && (reportSQL.indexOf(sqlClause[idxNext]) < 0));
+
+ String clauseContent = null;
+ if (idxNext < sqlClause.length)
+ clauseContent = reportSQL.substring(clauseStartPos, reportSQL
+ .indexOf(sqlClause[idxNext]) - 1);
+ else
+ clauseContent = reportSQL.substring(clauseStartPos);
+
+ while (clauseContent.length() > 0) {
+ int braketCount = 0;
+ StringBuffer nextToken = new StringBuffer();
+ for (int i = 0; i < clauseContent.length(); i++) {
+ char ch = clauseContent.charAt(i);
+ nextToken.append(ch);
+ if (ch == '(')
+ braketCount++;
+ else if (ch == ')')
+ braketCount--;
+ else if (ch == ',')
+ if (braketCount == 0)
+ break;
+ } // for %>
+
+ sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
+ sb.append(nextToken.toString());
+ sb.append("<br>\n");
+
+ if (nextToken.length() < clauseContent.length())
+ clauseContent = clauseContent.substring(nextToken.length() + 1);
+ else
+ clauseContent = "";
+ } // while
+ } // while
+
+ request.setAttribute(AppConstants.RI_FORMATTED_SQL, sb.toString());
+ request.setAttribute(AppConstants.RI_PAGE_TITLE, "Generated SQL");
+ request.setAttribute(AppConstants.RI_PAGE_SUBTITLE, "Generated SQL for report "
+ + rdef.getReportName());
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportShowSQLPopup
+
+ public String testSchedCondPopup(HttpServletRequest request, String nextPage) {
+ try {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String sql = AppUtils.getRequestNvlValue(request, AppConstants.RI_FORMATTED_SQL);
+
+ request.setAttribute("msg_align", " align=center");
+ request.setAttribute(AppConstants.RI_PAGE_TITLE, "Test Scheduler Condition");
+ // request.setAttribute(AppConstants.RI_PAGE_SUBTITLE, ...);
+ //String query = "SELECT 1 FROM DUAL WHERE EXISTS (" + sql + ")";
+
+ String query = Globals.getTestSchedCondPopup();
+ query = query.replace("[sql]", sql);
+
+ DataSet ds = null;
+ String remoteDb = request.getParameter("remoteDbPrefix");
+ String remoteDbPrefix = (remoteDb != null && !remoteDb.equalsIgnoreCase("null")) ? remoteDb
+ : rdef.getDBInfo();
+ ds = ConnectionUtils.getDataSet(sql, remoteDbPrefix);
+ // if ( (remoteDbPrefix!=null) &&
+ // (!remoteDbPrefix.equals(AppConstants.DB_LOCAL))) {
+ // Globals.getRDbUtils().setDBPrefix(remoteDbPrefix);
+ // ds = RemDbUtils.executeQuery(query);
+ // }
+ // else
+ // ds = DbUtils.executeQuery(query);
+ if (ds.getRowCount() == 0)
+ request
+ .setAttribute(AppConstants.RI_FORMATTED_SQL,
+ "<br><b>Condition NOT satisfied</b> - email notification will NOT be send.<br><br>");
+ else
+ request
+ .setAttribute(AppConstants.RI_FORMATTED_SQL,
+ "<br><b>Condition satisfied</b> - email notification will be send.<br><br>");
+ } catch (Exception e) {
+ // nextPage = (new ErrorHandler()).processFatalError(request, e);
+ request.setAttribute(AppConstants.RI_FORMATTED_SQL, "<br><b>SQL ERROR</b> "
+ + e.getMessage() + "<br>Email notification will NOT be send.<br><br>");
+ }
+
+ return nextPage;
+ } // testSchedCondPopup
+
+ public String testRunSQLPopup(HttpServletRequest request, String nextPage) {
+ String sql = AppUtils.getRequestNvlValue(request, AppConstants.RI_FORMATTED_SQL);
+ if(nvl(sql).length()<=0) {
+ sql = AppUtils.getRequestNvlValue(request, "reportSQL");
+ }
+
+
+ boolean chkFormFieldSQL = AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_CHK_FIELD_SQL).equals("Y");
+ try {
+ if (!sql.trim().toUpperCase().startsWith("SELECT"))
+ throw new UserDefinedException(
+ "Invalid statement - the SQL must start with the keyword SELECT");
+
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ if (!chkFormFieldSQL) {
+ if (rdef.getFormFieldList() != null)
+ for (Iterator iter = rdef.getFormFieldList().getFormField().iterator(); iter
+ .hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ String fieldId = fft.getFieldId();
+ String fieldDisplay = rdef.getFormFieldDisplayName(fft);
+ /*
+ * if(paramValues.isParameterMultiValue(fieldId))
+ * generatedSQL = Utils.replaceInString(generatedSQL,
+ * fieldDisplay, nvl(formatListValue((String)
+ * paramValues.get(fieldId), null, false, false, null),
+ * "NULL")); else
+ */
+ sql = Utils.replaceInString(sql, fieldDisplay, "NULL");
+ } // for
+ } // if
+ DataSet ds = null;
+ String remoteDb = request.getParameter("remoteDbPrefix");
+ String remoteDbPrefix = (remoteDb != null && !remoteDb.equalsIgnoreCase("null")) ? remoteDb
+ : rdef.getDBInfo();
+ String userId = AppUtils.getUserID(request);
+ sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId);
+ String[] reqParameters = Globals.getRequestParams().split(",");
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ javax.servlet.http.HttpSession session = request.getSession();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("B4 testRunSQL " + sql));
+ if(request != null ) {
+ for (int i = 0; i < reqParameters.length; i++) {
+ if(!reqParameters[i].startsWith("ff"))
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) );
+ else
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) );
+ }
+ }
+ if(session != null ) {
+ for (int i = 0; i < sessionParameters.length; i++) {
+ //if(!sessionParameters[i].startsWith("ff"))
+ //sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i].toUpperCase()) );
+ //else {
+ logger.debug(EELFLoggerDelegate.debugLogger, (" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i])));
+ sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ //}
+ }
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, ("After testRunSQL " + sql));
+
+ ds = ConnectionUtils.getDataSet(sql, remoteDbPrefix, true);
+ // if ( (remoteDbPrefix!=null) &&
+ // (!remoteDbPrefix.equals(AppConstants.DB_LOCAL))) {
+ // Globals.getRDbUtils().setDBPrefix(remoteDbPrefix);
+ // ds = RemDbUtils.executeQuery(sql,
+ // Globals.getDefaultPageSize()+1);
+ // }
+ // else
+ // ds = DbUtils.executeQuery(sql, Globals.getDefaultPageSize()+1);
+ if (chkFormFieldSQL && ds.getRowCount() > 0) {
+ String id = ds.getString(0, "id");
+ String name = ds.getString(0, "name");
+ } // if
+
+ request.setAttribute(AppConstants.RI_DATA_SET, ds);
+ } catch (RaptorException e) {
+ request.setAttribute(AppConstants.RI_EXCEPTION, e);
+ }
+
+ return nextPage;
+ } // testRunSQLPopup
+
+ public String importSemaphorePopup(HttpServletRequest request, String nextPage) {
+ try {
+ (new WizardProcessor()).processImportSemaphorePopup(request);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // importSemaphorePopup
+
+ public String saveSemaphorePopup(HttpServletRequest request, String nextPage) {
+ try {
+ (new WizardProcessor()).processSemaphorePopup(request);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // saveSemaphorePopup
+
+ public String gotoJsp(HttpServletRequest request, String nextPage) {
+ return nextPage;
+ } // gotoJsp
+
+ public String downloadAll(HttpServletRequest request, String nextPage) throws InterruptedException, IOException, Exception {
+ String emailId = null;
+ String pdfAttachmentKey = AppUtils.getRequestValue(request, "pdfAttachmentKey");
+ boolean isFromSchedule = nvl(pdfAttachmentKey).length()>0;
+ if(!isFromSchedule)
+ emailId = AppUtils.getUserEmail(request);
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
+ java.util.Date currDate = new java.util.Date();
+ String timestamp = sdf.format(currDate);
+ String dateStr = sdf1.format(currDate);
+
+ String userId = null;
+ if(!isFromSchedule)
+ userId = AppUtils.getUserID(request);
+ else
+ userId = AppUtils.getRequestValue(request, "user_id");
+ Runtime runtime = Runtime.getRuntime();
+ ReportRuntime rr = null;
+ if(!isFromSchedule) {
+ rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ if(rr!=null) AppUtils.getUserEmail(request);
+ }
+ String scheduleId = "";
+
+ if(isFromSchedule) {
+ String reportID = null;
+ String report_email_sent_log_id = AppUtils.getRequestValue(request, "log_id");
+ /*String query = "Select user_id, rep_id from CR_REPORT_EMAIL_SENT_LOG" +
+ " where rownum = 1" +
+ " and gen_key='"+pdfAttachmentKey.trim()+"'" +
+ " and log_id ="+report_email_sent_log_id.trim() +
+ " and (sysdate - sent_date) < 1 ";*/
+
+ String query = Globals.getDownloadAllEmailSent();
+ query = query.replace("[pdfAttachmentKey.trim()]", pdfAttachmentKey.trim());
+ query = query.replace("[report_email_sent_log_id.trim()]", report_email_sent_log_id.trim());
+
+ DataSet ds = DbUtils.executeQuery(query, 1);
+ if(!ds.isEmpty()) {
+ userId = ds.getString(0,"user_id");
+ reportID = ds.getString(0, "rep_id");
+ request.setAttribute("schedule_email_userId", userId);
+ } else {
+ request.setAttribute("message", "This link has expired, please <a href=''>login</a> and regenerate the report");
+ return "raptor/message.jsp";
+ }
+
+ ReportHandler rh1 = new ReportHandler();
+
+ if(reportID !=null && nvl(pdfAttachmentKey).length()>0) {
+ rr = rh1.loadReportRuntime(request, reportID, true, 1);
+ rr.loadReportData(-1, userId, 1000 ,request, false /*download*/);
+ }
+
+ String d_sql = Globals.getDownloadAllGenKey();
+ d_sql = d_sql.replace("[pdfAttachmentKey]", pdfAttachmentKey);
+
+ //ds = DbUtils.executeQuery("select schedule_id from cr_report_email_sent_log u where U.GEN_KEY = '"+ pdfAttachmentKey + "'");
+
+ ds = DbUtils.executeQuery(d_sql);
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ scheduleId = ds.getString(i,0);
+ }
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, ("SQL2:\n"+ rr.getCachedSQL()));
+ String fileName = rr.getReportID()+"_"+userId+"_"+timestamp;
+ boolean flag = false;
+ logger.debug(EELFLoggerDelegate.debugLogger, (""+Utils.isDownloadFileExists(rr.getReportID()+"_"+userId+"_"+dateStr)));
+ // if(Utils.isDownloadFileExists(rr.getReportID()+"_"+userId+"_"+dateStr)) {
+ // flag = true;
+ // }
+
+ if(flag){
+ String strFileName = Utils.getLatestDownloadableFile(rr.getReportID()+"_"+userId+"_"+dateStr);
+ //debugLogger.debug("File Name " + strFileName);
+ StringBuffer messageBuffer = new StringBuffer("");
+ messageBuffer.append("Download data file using the following link<BR>");
+ messageBuffer.append("<a href=\"" + request.getContextPath() + "/raptor/dwnld/data/" +
+ strFileName + "\">click here</a>.</p>");
+ request.setAttribute("message", messageBuffer.toString());
+ }
+ else if(!flag) {
+ String whole_fileName = (Globals.getShellScriptDir() +AppConstants.SHELL_QUERY_DIR+ fileName+AppConstants.FT_SQL);
+ String whole_columnsfileName = (Globals.getShellScriptDir() +AppConstants.SHELL_QUERY_DIR+ fileName+AppConstants.FT_COLUMNS);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("FILENAME "+whole_fileName));
+
+ List l = rr.getAllColumns();
+ StringBuffer allColumnsBuffer = new StringBuffer();
+ DataColumnType dct = null;
+
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ dct = (DataColumnType) iter.next();
+ allColumnsBuffer.append(dct.getDisplayName());
+ if(iter.hasNext())
+ allColumnsBuffer.append("|");
+ }
+ try {
+ PrintWriter xmlOut = new PrintWriter(new BufferedWriter(new FileWriter(new File(whole_columnsfileName))));
+ xmlOut.println(allColumnsBuffer.toString());
+ xmlOut.flush();
+ xmlOut.close();
+ } catch (IOException e) {e.printStackTrace();}
+ try {
+ PrintWriter xmlOut = new PrintWriter(new BufferedWriter(new FileWriter(new File(whole_fileName))));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("**************************"));
+ logger.debug(EELFLoggerDelegate.debugLogger, (rr.getWholeSQL()));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("************************"));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("************************"));
+ logger.debug(EELFLoggerDelegate.debugLogger, (rr.parseReportSQL(rr.getWholeSQL())));
+ xmlOut.println(rr.parseReportSQL(rr.getWholeSQL()));
+ //xmlOut.println("******************");
+ //xmlOut.println(rr.getWholeSQL());
+ xmlOut.flush();
+ xmlOut.close();
+ } catch (IOException e) {e.printStackTrace();}
+
+ StringBuffer command = new StringBuffer(Globals.getShellScriptDir() + AppConstants.SHELL_SCRIPTS_DIR);
+ if(nvl(emailId).length()>0) {
+ command.append(AppConstants.SHELL_SCRIPT_NAME + " " + (fileName+AppConstants.FT_SQL));
+ command.append(" "+emailId);
+ }
+ else if (nvl(scheduleId).length()>0) {
+ command.append(AppConstants.SCHEDULE_SHELL_SCRIPT_NAME + " " + (fileName+AppConstants.FT_SQL));
+ command.append(" " + scheduleId);
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Command " + command));
+ Process downloadProcess = runtime.exec(command.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Command Executed "));
+ //Connection connection = DbUtils.getConnection();
+ Enumeration enum1 = rr.getParamKeys();
+ String value = "", key = "";
+ String paramStr = "";
+ StringBuffer paramBuffer = new StringBuffer();
+ if(enum1!=null) {
+ for (; enum1.hasMoreElements();) {
+ key = (String) enum1.nextElement();
+ value = rr.getParamValue(key);
+ paramBuffer.append(key+":"+value+" ");
+ }
+ paramStr = paramBuffer.toString();
+ }
+
+ StringBuffer retrieveUserEmailQry = null;
+ ArrayList userEmailList = new ArrayList();
+ if(nvl(scheduleId).length()>0) {
+ /*retrieveUserEmailQry = new StringBuffer();
+ retrieveUserEmailQry.append(" SELECT ");
+ retrieveUserEmailQry.append(" au.user_id ");
+ retrieveUserEmailQry.append(" FROM ");
+ retrieveUserEmailQry.append(" (SELECT rs.schedule_id, rs.rep_id FROM cr_report_schedule rs WHERE rs.enabled_yn='Y' AND rs.run_date IS NOT NULL ");
+ retrieveUserEmailQry.append(" AND rs.schedule_id = " + scheduleId + " ) x, cr_report r, app_user au ");
+ retrieveUserEmailQry.append(" WHERE ");
+ retrieveUserEmailQry.append("x.rep_id = r.rep_id ");
+ retrieveUserEmailQry.append(" AND au.user_id IN (SELECT rsu.user_id FROM cr_report_schedule_users rsu WHERE rsu.schedule_id = x.schedule_id and rsu.schedule_id = " + scheduleId );
+ retrieveUserEmailQry.append(" UNION ");
+ retrieveUserEmailQry.append(" SELECT ur.user_id FROM fn_user_role ur ");
+ retrieveUserEmailQry.append(" WHERE ur.role_id IN ");
+ retrieveUserEmailQry.append(" (SELECT rsu2.role_id FROM cr_report_schedule_users rsu2 ");
+ retrieveUserEmailQry.append(" WHERE rsu2.schedule_id = x.schedule_id and ");
+ retrieveUserEmailQry.append(" rsu2.schedule_id = "+ scheduleId + ")) ");*/
+
+ String r_sql = Globals.getDownloadAllRetrieve();
+ r_sql = r_sql.replace("[scheduleId]", scheduleId);
+
+ // DataSet ds = DbUtils.executeQuery(retrieveUserEmailQry.toString());
+ DataSet ds = DbUtils.executeQuery(r_sql);
+
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ userEmailList.add(ds.getString(i, 0));
+ }
+
+ }
+ // String insertQry = "insert into cr_report_dwnld_log (user_id,rep_id,file_name,dwnld_start_time,filter_params) values (?,?,?,?,?)";
+ String insertQry = Globals.getDownloadAllInsert();
+
+
+ Connection connection = null;
+ PreparedStatement pst = null;
+ try {
+ connection = DbUtils.getConnection();
+ pst = connection.prepareStatement(insertQry);
+ if(nvl(emailId).length()>0){
+ pst.setInt(1, Integer.parseInt(userId));
+ pst.setInt(2, Integer.parseInt(rr.getReportID()));
+ pst.setString(3, fileName+AppConstants.FT_ZIP);
+ pst.setTimestamp(4,new java.sql.Timestamp(currDate.getTime()));
+ pst.setString(5,paramStr);
+ pst.execute();
+ connection.commit();
+ } else {
+ for (int i = 0; i < userEmailList.size(); i++) {
+ pst.setInt(1, Integer.parseInt((String)userEmailList.get(i)));
+ pst.setInt(2, Integer.parseInt(rr.getReportID()));
+ pst.setString(3, fileName+AppConstants.FT_ZIP);
+ pst.setTimestamp(4,new java.sql.Timestamp(currDate.getTime()));
+ pst.setString(5,paramStr);
+ pst.execute();
+ connection.commit();
+ }
+ }
+ pst.close();
+ connection.close();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Data inserted"));
+ } catch (SQLException ex) {
+ throw new RaptorException(ex);
+ } catch (ReportSQLException ex) {
+ throw new RaptorException(ex);
+ } catch (Exception ex) {
+ throw new RaptorException (ex);
+ } finally {
+ try {
+ if(connection!=null)
+ connection.close();
+ if(pst!=null)
+ pst.close();
+ } catch (SQLException ex) {
+ throw new RaptorException(ex);
+ }
+ }
+ //DbUtils.commitTransaction(connection);
+ //DbUtils.clearConnection(connection);
+
+
+
+// debugLogger.debug("|"+downloadProcess.toString() + "|");
+// if (downloadProcess == null)
+// throw new Exception("unable to create a process for command:" +
+// command);
+// int retCode= 1;
+// try {
+// retCode= downloadProcess.waitFor();
+// } catch (InterruptedException e){
+// e.printStackTrace();
+// }
+// debugLogger.debug("retCode " + retCode);
+// Process child = rtime.exec("/bin/bash");
+// BufferedWriter outCommand = new BufferedWriter(new
+// OutputStreamWriter(child.getOutputStream()));
+// outCommand.write(Globals.getShellScriptName());
+// outCommand.flush();
+// int retCode = child.waitFor();
+// debugLogger.debug("RetCode " + retCode);
+ //request.setAttribute("message", "Shell Script is running in the background. You'll get an email once it is done");
+ }
+
+ return nextPage;
+ }
+ public String getChildDropDown(HttpServletRequest request, String nextPage) throws RaptorRuntimeException {
+
+ if(request.getParameter("firstTime") != null) { return nextPage; }
+
+ /*ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+
+ String c_master = request.getParameter("c_master");
+ java.util.HashMap valuesMap = Globals.getRequestParamtersMap(request);
+ request.setAttribute("c_master", c_master);
+
+ int idx = 0;
+ ReportFormFields rff = rr.getReportFormFields();
+ FormField ff = null;
+ for(rff.resetNext(); rff.hasNext(); idx++) {
+ ff = rff.getNext();
+
+
+ if(ff.getDependsOn() != null && ff.getDependsOn().trim() != "")
+ {
+ String val = request.getParameter(ff.getFieldName());
+ request.setAttribute(ff.getFieldName(), ff.getHtml(val, valuesMap, rr));
+ }
+
+ }
+ */
+ return nextPage;
+
+ }
+
+ private void removeVariablesFromSession(HttpServletRequest request) {
+ HttpSession session = request.getSession();
+ session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ session.removeAttribute(AppConstants.DRILLDOWN_INDEX);
+ session.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX);
+ session.removeAttribute(AppConstants.SI_BACKUP_FOR_REP_ID);
+ session.removeAttribute(AppConstants.SI_COLUMN_LOOKUP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REP_ID);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP);
+ session.removeAttribute(AppConstants.SI_DATA_SIZE_FOR_TEXTFIELD_POPUP);
+ session.removeAttribute(AppConstants.SI_MAP);
+ session.removeAttribute(AppConstants.SI_MAP_OBJECT);
+ session.removeAttribute(AppConstants.SI_REPORT_DEFINITION);
+ session.removeAttribute(AppConstants.SI_REPORT_RUNTIME);
+ session.removeAttribute(AppConstants.SI_REPORT_RUN_BACKUP);
+ session.removeAttribute(AppConstants.SI_REPORT_SCHEDULE);
+ session.removeAttribute(AppConstants.RI_REPORT_DATA);
+ session.removeAttribute(AppConstants.RI_CHART_DATA);
+ session.removeAttribute(AppConstants.SI_FORMFIELD_INFO);
+ session.removeAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO);
+ session.removeAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP);
+ session.removeAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP);
+ Enumeration<String> enum1 = session.getAttributeNames();
+ String attributeName = "";
+ while(enum1.hasMoreElements()) {
+ attributeName = enum1.nextElement();
+ if(attributeName.startsWith("parent_")) {
+ session.removeAttribute(attributeName);
+ }
+ }
+ }
+
+
+ private TreeMap getListOfReportsFromDashBoardHTML(String htmlString) {
+ //String sourcestring = "<table border=1><tr><td>[Report#123]</td><td>[Report#124]</td></tr><tr><td>[Report#125]</td><td>[Report#126]</td></tr></table>";
+ String sourcestring = htmlString;
+ //Pattern re = Pattern.compile("([a-z]+)\\[([a-z]+)([=<>]+)([a-z]+)\\]",Pattern.CASE_INSENSITIVE);
+ //Pattern re = Pattern.compile("\\[([R][e][p][o][r][t][#])[(*)]\\]");
+ Pattern re = Pattern.compile("\\[(.*?)\\]"); //\\[(.*?)\\]
+ Matcher m = re.matcher(sourcestring);
+ HashMap hashReports = new HashMap();
+ int mIdx = 0;
+ while (m.find()){
+ for( int groupIdx = 0; groupIdx < m.groupCount(); groupIdx++ ){
+ String str = m.group(groupIdx);
+ //System.out.println(str);
+ hashReports.put(new String(Integer.toString(mIdx+1)), (str.substring(1).toLowerCase().startsWith("chart")?"c":"d") + str.substring(str.indexOf("#")+1, str.length()-1));
+ }
+ mIdx++;
+ }
+ // Sorting HashMap based on Keys
+ /*List mapKeys = new ArrayList(hashReports.keySet());
+ List mapValues = new ArrayList(hashReports.values());
+ hashReports.clear();
+ hashReports = null;
+ hashReports = new HashMap();
+
+ TreeSet sortedSet = new TreeSet(mapKeys);
+ Object[] sortedArray = sortedSet.toArray();
+ int size = sortedArray.length;
+ for (int i=0; i<size; i++) {
+ hashReports.put(sortedArray[i], mapValues.get(mapKeys.indexOf(sortedArray[i])));
+ }*/
+ return new TreeMap(hashReports);
+ }
+
+ public ReportData getReportData(ReportRuntime reportRuntime, HttpServletRequest request, String sql, int maxRows) throws RaptorException {
+
+
+ // replace the request parameter specified in the drill down
+ List reportCols = reportRuntime.getAllColumns();
+ StringBuffer colNames = new StringBuffer();
+ for (Iterator<?> iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (colNames.length() > 0)
+ colNames.append(", ");
+ colNames.append(dc.getColId());
+ if (dc.isVisible()) {
+ //TODO: Drilldown URL
+ //sql = reportRuntime.parseReportSQLForDrillDownParams(sql, dc, request);
+ }
+ }
+
+ DataSet ds = null;
+ // try {
+ String dbInfo = reportRuntime.getDBInfo();
+ if(maxRows == 1)
+ sql += " limit "+ maxRows;
+ System.out.println("SQL getReportData()- " + sql);
+ ds = ConnectionUtils.getDataSet(sql, dbInfo);
+ int totalRows = 0;
+ /*if (reportRuntime.getReportDataSize() < 0) {*/
+ //String countSQL = "SELECT count(*) FROM (" + sql + ") x";
+ String dbType = "";
+
+ if (dbInfo!=null && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ try {
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ dbType = remDbInfo.getDBType(dbInfo);
+ } catch (Exception ex) {
+ throw new RaptorException(ex);
+ }
+ }
+
+ totalRows = ds.getRowCount();
+ /*}*/
+ ReportData rd = new ReportData(0, true);
+
+ if(totalRows > 0) {
+ // Already defined changed for modifying request parameters
+ //List reportCols = getAllColumns();
+ Vector visibleCols = new Vector(reportCols.size());
+ Vector formatProcessors = new Vector(reportCols.size());
+
+ // ColumnHeaderRow chr = new ColumnHeaderRow();
+ // rd.reportColumnHeaderRows.addColumnHeaderRow(chr);
+ // chr.setRowHeight("30");
+ int count =0 ;
+
+ /* ADDED */
+ ReportFormFields rff = reportRuntime.getReportFormFields();
+ ReportFormFields childReportFormFields = null;
+ String fieldDisplayName = "";
+ String fieldValue = "";
+
+ for (int c = 0; c < reportCols.size(); c++) {
+ if(reportCols.get(c)!=null) {
+ DataColumnType dct = (DataColumnType) reportCols.get(c);
+ if(nvl(dct.getDependsOnFormField()).length()>0 && nvl(dct.getDependsOnFormField()).indexOf("[")!=-1) {
+ for(int i = 0 ; i < rff.size(); i++) {
+ fieldDisplayName = "["+((FormField)rff.getFormField(i)).getFieldDisplayName()+"]";
+ fieldValue = "";
+ //if(dct.getOriginalDisplayName()==null) dct.setOriginalDisplayName(dct.getDisplayName());
+ if (dct.getDependsOnFormField().equals(fieldDisplayName)) {
+ fieldValue = nvl(request.getParameter(((FormField)rff.getFormField(i)).getFieldName()));
+
+ if (fieldValue.length()>0) {
+ if(!fieldValue.toUpperCase().equals("Y"))
+ dct.setDisplayName(fieldValue);
+ if(!dct.isVisible())
+ dct.setVisible(true);
+ } else {
+ dct.setVisible(false);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* ADDED */
+ String displayName = "";
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dc = (DataColumnType) iter.next();
+
+ formatProcessors.add(count,new FormatProcessor(
+ reportRuntime.getSemaphoreById(dc.getSemaphoreId()), dc.getColType(), dc
+ .getColFormat(), reportRuntime.getReportDefType().equals(
+ AppConstants.RD_SQL_BASED)));
+
+ /* TODO: Add Drilldown URL */
+ if (nvl(dc.getDrillDownURL()).length() > 0) {
+ childReportFormFields = reportRuntime.getChildReportFormFields(request,dc.getDrillDownURL());
+ }
+ if (dc.isVisible()) {
+ visibleCols.add(count,dc);
+ //if(dc.getColId().startsWith("group")) {
+ for (int d = 0; d < reportCols.size(); d++) {
+ if(reportCols.get(d)!=null) {
+ DataColumnType dct1 = (DataColumnType) reportCols.get(d);
+ if(dct1.getColId().equals(dc.getColId()+"_name") && ds.getRowCount()>0) {
+ displayName = ds.getString(0,dct1.getColId());
+ dc.setDisplayName(displayName);
+ }
+ }
+ }
+ //}
+
+ VisualManager visualManager = reportRuntime.getVisualManager();
+ rd.createColumn(dc.getColId(), dc.getDisplayName(), dc.getDisplayWidthInPxls(),dc.getDisplayHeaderAlignment(),
+ visualManager.isColumnVisible(dc.getColId()), visualManager
+ .getSortByColId().equals(dc.getColId()) ? visualManager
+ .getSortByAscDesc() : null, true, dc.getLevel()!=null?dc.getLevel():0, dc.getStart()!=null?dc.getStart():0, dc.getColspan()!=null?dc.getColspan():0, dc.isIsSortable()!=null?dc.isIsSortable():false);
+ // chr.addColumnHeader(new ColumnHeader(dc.getDisplayName(),
+ // (dc.getDisplayWidth()>100)?"10%":(""+dc.getDisplayWidth()+"%")));
+ } // if
+ else {
+ visibleCols.add(count,null);
+ rd.createColumn(dc.getColId(), AppConstants.HIDDEN, dc.getDisplayWidthInPxls(), dc.getDisplayHeaderAlignment(),
+ false, null,false,dc.getLevel()!=null?dc.getLevel():0, dc.getStart()!=null?dc.getStart():0, dc.getColspan()!=null?dc.getColspan():0, dc.isIsSortable()!=null?dc.isIsSortable():false);
+// formatProcessors.add(count,null);
+ }
+ count++;
+ } // for
+
+ // Utils._assert(chr.size()==ds.getColumnCount(),
+ // "[ReportRuntime.loadLinearReportData] The number of visible columns
+ // does not match the number of data columns");
+ //TODO: This should be optimized to accept -1 for flat file download
+ if(maxRows > totalRows) maxRows = totalRows;
+ ArrayList reportDataList = new ArrayList();
+ for (int r = 0; r < maxRows; r++) {
+ DataRow dr = new DataRow();
+ rd.reportDataRows.addDataRow(dr);
+
+ for (int c = 0; c < reportCols.size(); c++) {
+ if(reportCols.get(c)!=null) {
+ DataColumnType dct = (DataColumnType) reportCols.get(c);
+ //Modified since ds is null.
+ DataValue dv = new DataValue();
+
+ if(ds.getRowCount()>0){
+ if(ds.getColumnIndex(dct.getColId())!= -1) {
+ dr.addDataValue(dv);
+ dv.setDisplayValue(ds.getString(r, dct.getColId()));
+ } else {
+ continue;
+ }
+
+ } else {
+ dv.setDisplayValue("");
+ }
+ dv.setColName(dct.getColName());
+ dv.setColId(dct.getColId());
+ dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+
+ //Add Drilldown URL to dv
+ if (nvl(dct.getDrillDownURL()).length() > 0) {
+
+ if(dv.getDisplayValue().length() > 0) {
+ dv.setDrillDownURL(reportRuntime.parseDrillDownURL(r, /* c, */ds, dct, request, childReportFormFields));
+ dv.setDrillDowninPoPUp(dct.isDrillinPoPUp()!=null?dct.isDrillinPoPUp():false);
+ }
+
+ if (dv.getDisplayValue().length() == 0) {
+ //dv.setDisplayValue("[NULL]");
+ dv.setDisplayValue("");
+ }
+ } // if
+
+ StringBuffer indentation = new StringBuffer("");
+ if(dct.getIndentation()!=null && dct.getIndentation()>0) {
+ for (int indent=0; indent< dct.getIndentation(); indent++) {
+ indentation.append("\t");
+ }
+ dv.setNowrap("true");
+ }
+ dv.setIndentation(indentation.toString());
+
+ if(dct.isVisible()) {
+
+ dv.setVisible(true);
+ dv.setAlignment(dct.getDisplayAlignment());
+ dv.setDisplayTotal(dct.getDisplayTotal());
+ dv.setDisplayName(dct.getDisplayName());
+
+// if (nvl(dct.getDrillDownURL()).length() > 0) {
+
+// if(dv.getDisplayValue().length() > 0) {
+ //TODO: Below Drilldown URL
+// dv.setDrillDownURL(reportRuntime.parseDrillDownURL(r, /* c, */ds, dct,request, childReportFormFields));
+// dv.setDrillDowninPoPUp(dct.isDrillinPoPUp());
+// }
+//
+// if (dv.getDisplayValue().length() == 0) {
+// //dv.setDisplayValue("[NULL]");
+// dv.setDisplayValue("");
+// }
+// } // if
+
+ } else {
+ dv.setVisible(false);
+ dv.setHidden(true);
+ }
+ //System.out.println("in Linear report b4" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+
+ if(dr.getFormatId()!=null)
+ ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, true);
+ else
+ ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, false);
+
+ //System.out.println("in Linear report After" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+ } // if reportCols
+ } // for
+ reportDataList.add(dr);
+ } // for
+
+ rd.setReportDataList(reportDataList);
+ //Only if rownumber options is needed
+ //rd.addRowNumbers(pageNo, getPageSize());
+ DataRow colDataTotalsLinear = null;
+ if (colDataTotalsLinear == null)
+ colDataTotalsLinear = reportRuntime.generateColumnDataTotalsLinear(new ArrayList(reportCols), AppUtils.getUserID(request),
+ reportRuntime.getDbInfo(),request);
+
+ if(colDataTotalsLinear!=null)
+ rd.setColumnDataTotalsLinear(colDataTotalsLinear, "Total");
+ // Please note the below function doesn't set the visibility for dv since this is set in this function. - Sundar
+ rd.applyVisibility();
+ }
+ return rd;
+ } // loadLinearReportData
+
+ public String formFieldRun(HttpServletRequest request, String nextPage) {
+ ReportRuntime rr = null;
+ rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ if(rr!=null) {
+ ReportJSONRuntime reportJSONRuntime = rr.createFormFieldJSONRuntime(request);
+ ObjectMapper mapper = new ObjectMapper();
+ //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
+ //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String jsonInString = "";
+ try {
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(reportJSONRuntime);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+
+ }
+ return jsonInString;
+ }
+
+ return "";
+ }
+
+} // ActionHandler
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionMapping.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionMapping.java
new file mode 100644
index 00000000..93fff254
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionMapping.java
@@ -0,0 +1,34 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.HashMap;
+
+public class ActionMapping extends HashMap {
+
+ public void addAction(Action action) {
+ put(action.getAction(), action);
+ } // addAction
+
+ public Action getAction(String actionKey) {
+ return (Action) get(actionKey);
+ } // getAction
+
+} // ActionMapping
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Controller.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Controller.java
new file mode 100644
index 00000000..b2be8510
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Controller.java
@@ -0,0 +1,124 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class Controller extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(Controller.class);
+ public Controller() {
+ }
+
+ public String processRequest(HttpServletRequest request) {
+ String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), "report.run");
+
+ return processRequest(actionKey, request);
+ } // processRequest
+
+ public String processRequest(String actionKey, HttpServletRequest request) {
+ Action action = null;
+ try {
+ action = Globals.getRaptorActionMapping().getAction(actionKey);
+ if (action == null)
+ throw new RaptorRuntimeException("Action not found");
+ } catch (RaptorException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. RaptorException: " + e.getMessage()));
+// if (actionKey.equals("system_upgrade")) // System override
+
+ return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. Exception: " + e.getMessage()));
+ }
+
+ try {
+ Class[] paramTypes = new Class[2];
+ paramTypes[0] = Class.forName("javax.servlet.http.HttpServletRequest");
+ paramTypes[1] = Class.forName("java.lang.String");
+
+ Class handlerClass = Class.forName(action.getControllerClass());
+ Object handler = handlerClass.newInstance();
+ Method handlerMethod = handlerClass.getMethod(action.getControllerMethod(),
+ paramTypes);
+
+ Object[] paramValues = new Object[2];
+ paramValues[0] = request;
+ paramValues[1] = action.getJspName();
+
+ return (String) handlerMethod.invoke(handler, paramValues);
+ } catch (ClassNotFoundException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. ClassNotFoundException: " + e.getMessage()));
+ return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ } catch (IllegalAccessException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. IllegalAccessException: " + e.getMessage()));
+ return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (InstantiationException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. InstantiationException: " + e.getMessage()));
+ return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (NoSuchMethodException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. NoSuchMethodException: " + e.getMessage()));
+ return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (InvocationTargetException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. InvocationTargetException: " + e.getMessage()));
+ return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }
+ } // processRequest
+
+ public void handleRequest(HttpServletRequest request, HttpServletResponse response,
+ ServletContext servletContext) throws Exception {
+ String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));
+
+ handleRequest(actionKey, request, response, servletContext);
+ } // handleRequest
+
+ public void handleRequest(String actionKey, HttpServletRequest request,
+ HttpServletResponse response, ServletContext servletContext) throws Exception {
+ servletContext.getRequestDispatcher("/" + processRequest(actionKey, request)).forward(
+ request, response);
+ } // handleRequest
+
+} // Controller
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ErrorHandler.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ErrorHandler.java
new file mode 100644
index 00000000..bca56955
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ErrorHandler.java
@@ -0,0 +1,112 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.ArrayList;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class ErrorHandler extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ErrorHandler.class);
+
+ public ErrorHandler() {
+ }
+
+ public void processError(HttpServletRequest request, String errorMsg) {
+ //Log.write(errorMsg, 2);
+ logger.error(EELFLoggerDelegate.debugLogger, (errorMsg));
+ ArrayList error_list = (ArrayList) request.getAttribute(AppConstants.RI_ERROR_LIST);
+ if (error_list == null)
+ error_list = new ArrayList(1);
+ error_list.add(errorMsg);
+ request.setAttribute(AppConstants.RI_ERROR_LIST, error_list);
+ } // processError
+
+ public void processError(HttpServletRequest request, RaptorException e) {
+ processError(request, "Exception: " + e.getMessage());
+ } // processError
+
+ private String getSessionLog(HttpServletRequest request) {
+ String[] sessionVariablesToLog = Globals.getLogVariablesInSession().split(",");
+ StringBuffer sessionLogStrBuf = new StringBuffer("\n");
+ sessionLogStrBuf.append("***** ADDITIONAL INFORMATION ******");
+ HttpSession session = request.getSession();
+ ReportRuntime rr = (ReportRuntime) session.getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ ReportDefinition rdef = (ReportDefinition) session.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ if(rr!=null) {
+ sessionLogStrBuf.append("\nWHILE RUNNING");
+ sessionLogStrBuf.append("\nReport Id="+rr.getReportID()+";\t");
+ sessionLogStrBuf.append("Report Name="+rr.getReportName()+";\t\n");
+ } else if (rdef != null) {
+ sessionLogStrBuf.append("\nWHILE CREATING/UPDATING");
+ sessionLogStrBuf.append("\nReport Id="+rdef.getReportID()+";\t");
+ sessionLogStrBuf.append("Report Name="+rdef.getReportName()+";\t\n");
+ }
+ for (int i = 0; i < sessionVariablesToLog.length; i++) {
+ if(session.getAttribute(sessionVariablesToLog[i])!=null)
+ sessionLogStrBuf.append(sessionVariablesToLog[i]+"="+(String)session.getAttribute(sessionVariablesToLog[i])+";\t");
+ }
+ sessionLogStrBuf.append("\n***********************************");
+ sessionLogStrBuf.append("\n");
+ return sessionLogStrBuf.toString();
+ }
+ public String processFatalError(HttpServletRequest request, RaptorException e) {
+ //Log.write("Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage()), 1);
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR);
+ if (e instanceof ReportSQLException) {
+ String errorSQL = ((ReportSQLException) e).getReportSQL();
+ if (nvl(errorSQL).length() > 0)
+ request.setAttribute("c_error_sql", errorSQL);
+ } // if
+ AppUtils.processErrorNotification(request, e);
+
+ request.setAttribute(AppConstants.RI_EXCEPTION, e);
+ return AppUtils.getErrorPage();
+ } // processFatalError
+
+ public String processFatalErrorWMenu(HttpServletRequest request, RaptorException e) {
+ //Log.write("Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage()), 1);
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR);
+ if (e instanceof ReportSQLException) {
+ String errorSQL = ((ReportSQLException) e).getReportSQL();
+ if (nvl(errorSQL).length() > 0)
+ request.setAttribute("c_error_sql", errorSQL);
+ } // if
+ AppUtils.processErrorNotification(request, e);
+
+ request.setAttribute(AppConstants.RI_EXCEPTION, e);
+ return AppUtils.getErrorPageWMenu();
+ } // processFatalError
+
+} // ErrorHandler
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardProcessor.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardProcessor.java
new file mode 100644
index 00000000..a9204db1
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardProcessor.java
@@ -0,0 +1,2354 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ValidationException;
+import org.openecomp.portalsdk.analytics.model.ReportHandler;
+import org.openecomp.portalsdk.analytics.model.ReportLoader;
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.model.base.OrderBySeqComparator;
+import org.openecomp.portalsdk.analytics.model.base.OrderSeqComparator;
+import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition;
+import org.openecomp.portalsdk.analytics.model.definition.ReportSchedule;
+import org.openecomp.portalsdk.analytics.model.runtime.FormField;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.XSSFilter;
+import org.openecomp.portalsdk.analytics.xmlobj.ChartDrillFormfield;
+import org.openecomp.portalsdk.analytics.xmlobj.ColFilterType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataSourceType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormatType;
+import org.openecomp.portalsdk.analytics.xmlobj.JavascriptItemType;
+import org.openecomp.portalsdk.analytics.xmlobj.Marker;
+import org.openecomp.portalsdk.analytics.xmlobj.ObjectFactory;
+import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+/**<HR/>
+ * This class is part of <B><I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I></B><BR/>
+ * <HR/>
+ *
+ * --------------------------------------------------------------------------------------------------<BR/>
+ * <B>WizardProcessor.java</B> - This class is used to process the user input provided in the wizard.<BR/>
+ * It is called in creation as well as updation process. It builds report xml via JAXB using user<BR/>
+ * input. This is vital one, to store meta information of each report<BR/>
+ * ---------------------------------------------------------------------------------------------------<BR/>
+ *
+ *
+ * <U>Change Log</U><BR/><BR/>
+ *
+ * 31-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> For Time Series multi series property is exposed. </LI></UL>
+ * 28-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> If user login id is null, it would display user name when user is added for schedule. </LI></UL>
+ * 18-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> request Object is passed to prevent caching user/roles - Datamining/Hosting. </LI></UL>
+ * 12-Aug-2009 : Version 8.5 (Sundar); <UL><LI> For Line Charts too options are captured and rendering is customized. </LI></UL>
+ * 29-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Maximum Excel Download size would be persisted if changed. </LI></UL>
+ * 14-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Schedule feature is added to Dashboard Reports. </LI></UL>
+ * 29-Jun-2009 : Version 8.4 (Sundar); <UL><LI> Options for <I>Compare to Previous year Chart</I> are processed.</LI>
+ * <LI> In the Bar chart Last Occuring Series/Category can be plotted as Bar or Line Renderer. </LI>
+ * </UL>
+ * 22-Jun-2009 : Version 8.4 (Sundar); <UL><LI> processChart method is modified to accommodate creating
+ * Bar Charts, Time Difference Charts and adding generic chart options.</LI></UL>
+ *
+ */
+
+public class WizardProcessor extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WizardProcessor.class);
+
+ public WizardProcessor() {
+ }
+
+ private String adjustDataType(String oracleDataType) {
+ return oracleDataType.equals("VARCHAR2") ? AppConstants.CT_CHAR : oracleDataType;
+ // Probably should be expanded to convert any CHAR or VARCHAR type to
+ // CT_CHAR, number type to CT_NUMBER and date to CT_DATE
+ } // adjustDataType
+
+ public void persistReportDefinition(HttpServletRequest request, ReportDefinition rdef)
+ throws RaptorException {
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+ if (rr != null && rr.getReportID().equals(rdef.getReportID()))
+ request.getSession().removeAttribute(AppConstants.SI_REPORT_RUNTIME);
+ rdef.persistReport(request);
+ } // persistReportDefinition
+
+ public void processWizardStep(HttpServletRequest request) throws Exception {
+ String action = nvl(request.getParameter(AppConstants.RI_WIZARD_ACTION),
+ AppConstants.WA_BACK);
+
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ ReportDefinition rdef = (new ReportHandler()).loadReportDefinition(request, reportID);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+
+ String curStep = rdef.getWizardSequence().getCurrentStep();
+ String curSubStep = rdef.getWizardSequence().getCurrentSubStep();
+ if (AppUtils.getRequestNvlValue(request, "showDashboardOptions").length()<=0)
+ request.setAttribute("showDashboardOptions", "F");
+ logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^curStep " + curStep + " " + curSubStep + " " + action));
+ boolean reportUpdated = false;
+ if (!action.equals(AppConstants.WA_BACK)) {
+ if (curStep.equals(AppConstants.WS_DEFINITION)) {
+ reportUpdated = processDefinition(request);
+ } else if (curStep.equals(AppConstants.WS_SQL)) {
+ if (action.equals(AppConstants.WA_VALIDATE))
+ reportUpdated = processValidateSQL(request);
+ } else if (curStep.equals(AppConstants.WS_TABLES)) {
+ if (curSubStep.equals(AppConstants.WSS_ADD))
+ reportUpdated = processTableAdd(request);
+ else if (curSubStep.equals(AppConstants.WSS_EDIT))
+ reportUpdated = processTableEdit(request);
+ else if (action.equals(AppConstants.WA_DELETE))
+ reportUpdated = processTableDelete(request);
+ } else if (curStep.equals(AppConstants.WS_COLUMNS)) {
+ if (curSubStep.equals(AppConstants.WSS_ADD)
+ || curSubStep.equals(AppConstants.WSS_EDIT) || action.equals(AppConstants.WA_SAVE) || action.equals(AppConstants.WA_NEXT)) {
+ reportUpdated = processColumnAddEdit(request, curSubStep
+ .equals(AppConstants.WSS_EDIT) || curSubStep
+ .equals(AppConstants.WA_MODIFY));
+ //reportUpdated = processColumnAddEdit(request, true);
+ }
+ else if (curSubStep.equals(AppConstants.WSS_ADD_MULTI))
+ reportUpdated = processColumnAddMulti(request);
+ else if (curSubStep.equals(AppConstants.WSS_ORDER_ALL))
+ reportUpdated = processColumnOrderAll(request);
+ else if (action.equals(AppConstants.WA_DELETE))
+ reportUpdated = processColumnDelete(request);
+ else if (action.equals(AppConstants.WA_MOVE_UP))
+ reportUpdated = processColumnMoveUp(request);
+ else if (action.equals(AppConstants.WA_MOVE_DOWN))
+ reportUpdated = processColumnMoveDown(request);
+ } else if (curStep.equals(AppConstants.WS_FORM_FIELDS)) {
+ if (curSubStep.equals(AppConstants.WSS_ADD)
+ || curSubStep.equals(AppConstants.WSS_EDIT))
+ reportUpdated = processFormFieldAddEdit(request, curSubStep
+ .equals(AppConstants.WSS_EDIT), action);
+ else if (action.equals(AppConstants.WA_DELETE))
+ reportUpdated = processFormFieldDelete(request);
+ else if (action.equals(AppConstants.WA_MOVE_UP))
+ reportUpdated = processFormFieldMoveUp(request);
+ else if (action.equals(AppConstants.WA_MOVE_DOWN))
+ reportUpdated = processFormFieldMoveDown(request);
+ else if (action.equals(AppConstants.WSS_ADD_BLANK))
+ reportUpdated = processFormFieldBlank(request);
+ else if (action.equals(AppConstants.WSS_INFO_BAR))
+ reportUpdated = processFormFieldInfoBar(request);
+ } else if (curStep.equals(AppConstants.WS_FILTERS)) {
+ if (curSubStep.equals(AppConstants.WSS_ADD)
+ || curSubStep.equals(AppConstants.WSS_EDIT))
+ reportUpdated = processFilterAddEdit(request, curSubStep
+ .equals(AppConstants.WSS_EDIT));
+ else if (action.equals(AppConstants.WA_DELETE))
+ reportUpdated = processFilterDelete(request);
+ } else if (curStep.equals(AppConstants.WS_SORTING)) {
+ if (curSubStep.equals(AppConstants.WSS_ADD)
+ || curSubStep.equals(AppConstants.WSS_EDIT))
+ reportUpdated = processSortAddEdit(request, curSubStep
+ .equals(AppConstants.WSS_EDIT));
+ else if (curSubStep.equals(AppConstants.WSS_ORDER_ALL))
+ reportUpdated = processSortOrderAll(request);
+ else if (action.equals(AppConstants.WA_DELETE))
+ reportUpdated = processSortDelete(request);
+ else if (action.equals(AppConstants.WA_MOVE_UP))
+ reportUpdated = processSortMoveUp(request);
+ else if (action.equals(AppConstants.WA_MOVE_DOWN))
+ reportUpdated = processSortMoveDown(request);
+ } else if (curStep.equals(AppConstants.WS_JAVASCRIPT)) {
+ if (action.equals(AppConstants.WSS_ADD))
+ reportUpdated = processAddJavascriptElement(request);
+ else if (action.equals(AppConstants.WA_SAVE))
+ reportUpdated = processSaveJavascriptElement(request);
+ else if (action.equals(AppConstants.WA_DELETE))
+ reportUpdated = processDeleteJavascriptElement(request);
+ else
+ reportUpdated = processJavascript(request);
+ } else if (curStep.equals(AppConstants.WS_CHART)) {
+ reportUpdated = processChart(request, action);
+ } else if (curStep.equals(AppConstants.WS_USER_ACCESS)) {
+ reportUpdated = processUserAccess(request, action);
+ } else if (curStep.equals(AppConstants.WS_REPORT_LOG)) {
+ if (action.equals(AppConstants.WA_DELETE_USER))
+ reportUpdated = processClearLog(request);
+ } else if (curStep.equals(AppConstants.WS_SCHEDULE)) {
+ reportUpdated = processSchedule(request, action);
+ } else if(curStep.equals(AppConstants.WS_DATA_FORECASTING)) {
+ reportUpdated = processForecasting(request, action);
+ }
+ /****For Report Maps - Start*****/
+ else if (curStep.equals(AppConstants.WS_MAP)) {
+ reportUpdated = processMap(request, action);
+ }
+ /****For Report Maps - End*****/
+
+ // else
+ }
+ if (reportUpdated)
+ persistReportDefinition(request, rdef);
+ } // processWizardStep
+
+ public void processImportSemaphorePopup(HttpServletRequest request) throws RaptorException {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String importReportId = AppUtils
+ .getRequestNvlValue(request, AppConstants.RI_REPORT_ID);
+ ReportRuntime rr = (new ReportHandler()).loadReportRuntime(request, importReportId,
+ false);
+
+ ArrayList importedList = new ArrayList();
+ if (rr.getSemaphoreList() != null)
+ for (Iterator iter = rr.getSemaphoreList().getSemaphore().iterator(); iter
+ .hasNext();) {
+ SemaphoreType sem = rdef.addSemaphore(new ObjectFactory(),
+ (SemaphoreType) iter.next());
+ importedList
+ .add(new IdNameValue(sem.getSemaphoreId(), sem.getSemaphoreName()));
+ } // for
+
+ if (importedList.size() > 0) {
+ request.setAttribute(AppConstants.RI_DATA_SET, importedList);
+ persistReportDefinition(request, rdef);
+ } // if
+ } // processImportSemaphorePopup
+
+ public void processSemaphorePopup(HttpServletRequest request) throws RaptorException {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String semaphoreId = AppUtils.getRequestNvlValue(request, "semaphoreId");
+ String semaphoreName = AppUtils.getRequestNvlValue(request, "semaphoreName");
+ String semaphoreType = AppUtils.getRequestNvlValue(request, "semaphoreType");
+
+ SemaphoreType semaphore = rdef.getSemaphoreById(semaphoreId);
+ if (semaphore == null) {
+ semaphore = rdef.addSemaphoreType(new ObjectFactory(), semaphoreName,
+ semaphoreType, null);
+ semaphoreId = semaphore.getSemaphoreId();
+ request.setAttribute("semaphoreId", semaphoreId);
+ } else {
+ rdef.deleteSemaphore(semaphore);
+ semaphore.setSemaphoreName(semaphoreName);
+ semaphore.setSemaphoreType(semaphoreType);
+
+ rdef.setSemaphore(semaphore);
+ }
+
+ String[] formatId = request.getParameterValues("formatId");
+ String[] lessThanValue = request.getParameterValues("lessThanValue");
+ String[] expression = request.getParameterValues("expression");
+ String[] bold = request.getParameterValues("bold");
+ String[] italic = request.getParameterValues("italic");
+ String[] underline = request.getParameterValues("underline");
+ String[] bgColor = request.getParameterValues("bgColor");
+ String[] fontColor = request.getParameterValues("fontColor");
+ String[] fontFace = request.getParameterValues("fontFace");
+ String[] fontSize = request.getParameterValues("fontSize");
+ //String[] anyFmt = request.getParameterValues("anyFmt");
+
+ // String[] alignment = request.getParameterValues("alignment");
+
+ for (int i = 0; i < lessThanValue.length; i++)
+ if (i == 0 || nvl(lessThanValue[i]).length() > 0) {
+ FormatType fmt = null;
+ if (i == 0 || nvl(formatId[i]).length() > 0)
+ fmt = rdef.getSemaphoreFormatById(semaphore, nvl(formatId[i]));
+ if (fmt == null)
+ fmt = rdef.addEmptyFormatType(new ObjectFactory(), semaphore);
+
+ fmt.setLessThanValue(nvl(lessThanValue[i]));
+ fmt.setExpression(nvl(expression[i]));
+ fmt.setBold(bold[i].equals("Y"));
+ fmt.setItalic(italic[i].equals("Y"));
+ fmt.setUnderline(underline[i].equals("Y"));
+ fmt.setBgColor(bgColor[i]);
+ fmt.setFontColor(fontColor[i]);
+ fmt.setFontFace(fontFace[i]);
+ fmt.setFontSize(fontSize[i]);
+ //fmt.setAnyFmt((anyFmt[i]!=null)?anyFmt[i].startsWith("Y"):false);
+ // fmt.setAlignment(alignment[i]);
+ } else if (nvl(formatId[i]).length() > 0)
+ rdef.deleteFormatType(semaphore, formatId[i]);
+
+ persistReportDefinition(request, rdef);
+ } // processSemaphorePopup
+
+ private boolean processDefinition(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String reportName = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportName"));
+ String reportDescr = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportDescr"));
+ String folderId = AppUtils.getRequestNvlValue(request, "folder_id");
+ boolean isAllowSchedule = (AppUtils.getRequestNvlValue(request, "allowSchedule").length()<=0?"N":AppUtils.getRequestNvlValue(request, "allowSchedule")).startsWith("Y");
+ boolean isColumnGroup = (AppUtils.getRequestNvlValue(request, "multiGroupColumn").length()<=0?"N":AppUtils.getRequestNvlValue(request, "multiGroupColumn")).startsWith("Y");
+ boolean isTopDown = (AppUtils.getRequestNvlValue(request, "topDown").length()<=0?"N":AppUtils.getRequestNvlValue(request, "topDown")).startsWith("Y");
+ boolean isSizedByContent= (AppUtils.getRequestNvlValue(request, "sizedByContent").length()<=0?"N":AppUtils.getRequestNvlValue(request, "sizedByContent")).startsWith("Y");
+ boolean reportsInNewWindow = false;
+ boolean hideFormFieldAfterRun = false;
+
+ /*recurrance in schedule tab - Start*/
+ String isOneTimeScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isOneTimeScheduleAllowed"),"N");
+ String isHourlyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isHourlyScheduleAllowed"),"N");
+ String isDailyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isDailyScheduleAllowed"),"N");
+ String isDailyMFScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isDailyMFScheduleAllowed"),"N");
+ String isWeeklyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isWeeklyScheduleAllowed"),"N");
+ String isMonthlyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isMonthlyScheduleAllowed"),"N");
+ //System.out.println("//////////// + isOneTimeScheduleAllowed : " + isOneTimeScheduleAllowed);
+ /*recurrance in schedule tab - End*/
+
+
+ if (reportDescr.length() > 1000)
+ reportDescr = reportDescr.substring(0, 1000);
+ boolean reportUpdated;
+
+ String reportType = AppUtils.getRequestNvlValue(request, "reportType");
+
+
+
+ //rdef.setReportName(reportName);
+ //rdef.setReportDescr(reportDescr);
+ //rdef.setReportType(reportType);
+ rdef.setFolderId(folderId);
+// debugLogger.debug("setting folder ID = " + folderId);
+ if(reportType.equals(AppConstants.RT_DASHBOARD)) {
+ rdef.setReportName(reportName);
+ rdef.setReportDescr(reportDescr);
+ rdef.setReportType(reportType);
+ String dashboardLayoutHTML = AppUtils.getRequestNvlValue(request, "dashboardLayoutHTML");
+ rdef.setDashboardLayoutHTML(dashboardLayoutHTML);
+ String dataContainerHeight = nvl(AppUtils.getRequestValue(request, "heightContainer"), "auto");
+ String dataContainerWidth = nvl(AppUtils.getRequestValue(request, "widthContainer"), "auto");
+ rdef.setDataContainerHeight(dataContainerHeight);
+ rdef.setDataContainerWidth(dataContainerWidth);
+ rdef.setAllowSchedule(isAllowSchedule?"Y":"N");
+
+
+ /*
+ String numDashCols = AppUtils.getRequestNvlValue(request, "numDashCols");
+ String reports1 = AppUtils.getRequestNvlValue(request, "reports1");
+ String reports2 = AppUtils.getRequestNvlValue(request, "reports2");
+ String reports3 = AppUtils.getRequestNvlValue(request, "reports3");
+ String reports4 = AppUtils.getRequestNvlValue(request, "reports4");
+ String repBgColor1 = AppUtils.getRequestNvlValue(request, "repBgColor1");
+ String repBgColor2 = AppUtils.getRequestNvlValue(request, "repBgColor2");
+ String repBgColor3 = AppUtils.getRequestNvlValue(request, "repBgColor3");
+ String repBgColor4 = AppUtils.getRequestNvlValue(request, "repBgColor4");
+
+ //List reports = rdef.getDashBoardReports();
+ rdef.setNumDashCols(numDashCols);
+ DashboardReports reportsList = new DashboardReportsImpl();
+
+ String reports[] = new String[]{reports1, reports2, reports3, reports4};
+ String repBgColors[] = new String[]{repBgColor1, repBgColor2, repBgColor3, repBgColor4};
+ for (int i = 0; i < reports.length; i++) {
+ Reports report = new ReportsImpl();
+ report.setReportId(reports[i]);
+ report.setBgcolor(repBgColors[i]);
+ reportsList.getReportsList().add(report);
+ }
+
+
+
+ rdef.setDashBoardReports(reportsList);
+ */
+ reportUpdated = true;
+
+// reportUpdated = (!(reportName.equals(nvl(rdef.getReportName()))
+// && reportDescr.equals(nvl(rdef.getReportDescr()))
+// && reportType.equals(nvl(rdef.getReportType()))
+// && numDashCols.equals(nvl(rdef.getNumDashCols()))));
+//// && rdef.getR
+
+ if (rdef.getWizardSequence() instanceof WizardSequence)
+ rdef.generateWizardSequence(request);
+
+ } else {
+
+ if (AppUtils.getRequestNvlValue(request, "reportType").equals(AppConstants.RT_CROSSTAB) || rdef.getReportType().equals(AppConstants.RT_CROSSTAB)) {
+
+ String widthNo = AppUtils.getRequestNvlValue(request, "widthNo");
+ if(nvl(widthNo).endsWith("px"))
+ rdef.setWidthNoColumn(widthNo);
+ else
+ rdef.setWidthNoColumn(widthNo+"px");
+ }
+
+ String dataGridAlign = AppUtils.getRequestNvlValue(request, "dataGridAlign");
+ if(nvl(dataGridAlign).length()>0) {
+ rdef.setDataGridAlign(dataGridAlign);
+ } else {
+ rdef.setDataGridAlign("left");
+ }
+
+ String pdfImgLogo = AppUtils.getRequestNvlValue(request, "pdfImg");
+ if(nvl(pdfImgLogo).length()>0)
+ rdef.setPdfImg(pdfImgLogo);
+ else
+ rdef.setPdfImg(null);
+ String emptyMessage = AppUtils.getRequestNvlValue(request, "emptyMessage");
+ if(nvl(emptyMessage).length()>0)
+ rdef.setEmptyMessage(emptyMessage);
+ else
+ rdef.setEmptyMessage("");
+ String formHelp = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "formHelp"));
+ //String rDashboardType = nvl(AppUtils.getRequestValue(request, "showDashboardOptions"), "N");
+ //rdef.setDashboardType(rDashboardType.equals("Y"));
+ int excelDownloadSize = 500;
+ try {
+ excelDownloadSize = Integer.parseInt(AppUtils.getRequestValue(request, "excelDownloadSize"));
+ } catch (NumberFormatException ex) {}
+ if(AppUtils.getRequestNvlValue(request, "excelDownloadSize").length()>0)
+ rdef.setMaxRowsInExcelDownload(Integer.parseInt(AppUtils.getRequestValue(request, "excelDownloadSize")));
+ if(AppUtils.getRequestNvlValue(request, "reportInNewWindow").length()>0)
+ reportsInNewWindow = AppUtils.getRequestNvlValue(request,"reportInNewWindow").equals("Y");
+ if(AppUtils.getRequestNvlValue(request, "hideFormFieldsAfterRun").length()>0)
+ hideFormFieldAfterRun = AppUtils.getRequestNvlValue(request,"hideFormFieldsAfterRun").equals("Y");
+
+
+ if(AppUtils.getRequestNvlValue(request, "displayFolderTree").length()>0)
+ rdef.setDisplayFolderTree(AppUtils.getRequestNvlValue(request,"displayFolderTree").equals("Y"));
+ else
+ rdef.setDisplayFolderTree(false);
+ String dataSource = AppUtils.getRequestNvlValue(request, "dataSource");
+ String dbType = Globals.getDBType();
+ String schemaSql = Globals.getRemoteDbSchemaSqlWithWhereClause();
+ schemaSql = schemaSql.replace("[schema_id]", dataSource);
+ DataSet ds = null;
+ try {
+ ds = DbUtils.executeQuery(schemaSql);
+
+ String prefix = "", desc = "";
+
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ dbType = ds.getItem(i, 2);
+ }
+ }
+ catch (Exception e) {}
+
+ int pageSize = Globals.getDefaultPageSize();
+ try {
+ pageSize = Integer.parseInt(AppUtils.getRequestValue(request, "pageSize"));
+ } catch (NumberFormatException e) {
+ }
+ String rApproved = nvl(AppUtils.getRequestValue(request, "menuApproved"), "N");
+ String menuID = "";
+ String[] menuIDs = request.getParameterValues("menuID");
+ if (menuIDs != null)
+ for (int i = 0; i < menuIDs.length; i++)
+ menuID += (menuID.length() == 0 ? "" : "|") + menuIDs[i];
+
+// boolean additionalFieldsShown = AppUtils.getRequestNvlValue(request,
+// "additionalFieldsShown").equals("Y");
+ boolean rRCSDisabled = AppUtils.getRequestNvlValue(request, "runtimeColSortDisabled").equals("Y");
+ String reportDefType = AppUtils.getRequestNvlValue(request, "reportDefType");
+ String dataContainerHeight = nvl(AppUtils.getRequestValue(request, "heightContainer"), "auto");
+ String dataContainerWidth = nvl(AppUtils.getRequestValue(request, "widthContainer"), "auto");
+
+ String displayOptions = nvl(AppUtils.getRequestValue(request, "hideForm"), "N")
+ + nvl(AppUtils.getRequestValue(request, "hideChart"), "N")
+ + nvl(AppUtils.getRequestValue(request, "hideData"), "N")
+ + nvl(AppUtils.getRequestValue(request, "hideBtns"), "N")
+ + nvl(AppUtils.getRequestValue(request, "hideMap"), "N")
+ + nvl(AppUtils.getRequestValue(request, "hideExcelIcons"), "N")
+ + nvl(AppUtils.getRequestValue(request, "hidePDFIcons"), "N");
+/* StringBuffer dashboardOptions = new StringBuffer("");
+ dashboardOptions.append((nvl(AppUtils.getRequestValue(request, "hide"),"chart").equals("chart"))?"Y":"N");
+ dashboardOptions.append((nvl(AppUtils.getRequestValue(request, "hide"),"").equals("data"))?"Y":"N");
+ dashboardOptions.append((nvl(AppUtils.getRequestValue(request, "hideBtns"),"").equals("Y"))?"Y":"N");*/
+
+ String numFormCols = nvl(AppUtils.getRequestValue(request, "numFormCols"), "1");
+ String reportTitle = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportTitle"));
+ String reportSubTitle = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportSubTitle"));
+ String reportHeader = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportHeader"));
+ String reportFooter = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportFooter"));
+
+ int frozenColumns = 0;
+ try {
+ frozenColumns = Integer.parseInt(AppUtils.getRequestValue(request, "frozenColumns"));
+ } catch (NumberFormatException ex) {
+
+ }
+
+/* reportUpdated = (!(reportName.equals(nvl(rdef.getReportName()))))
+ && (!(reportDescr.equals(nvl(rdef.getReportDescr()))))
+ && (!(formHelp.equals(nvl(rdef.getFormHelpText()))))
+ && (!(reportType.equals(nvl(rdef.getReportType()))))
+ && (pageSize != rdef.getPageSize()) &&
+ // rPublic.equals(rdef.isPublic()?"Y":"N")&&
+ (!(menuID.equals(nvl(rdef.getMenuID()))))
+ && (!(rApproved.equals(rdef.isMenuApproved()))) && (additionalFieldsShown ? ((!(rRCSDisabled
+ .equals(rdef.isRuntimeColSortDisabled())))
+ && (!(displayOptions.equals(nvl(rdef.getDisplayOptions()))))
+ && (!(dashboardOptions.equals(nvl(rdef.getDashboardOptions()))))
+ && (!(numFormCols.equals(nvl(rdef.getNumFormCols()))))
+ && (!(reportTitle.equals(nvl(rdef.getReportTitle()))))
+ && (!(reportSubTitle.equals(nvl(rdef.getReportSubTitle()))))
+ && (!(reportHeader.equals(nvl(rdef.getReportHeader())))) && (!(reportFooter
+ .equals(nvl(rdef.getReportFooter()))))&& (reportsInNewWindow != rdef.isReportInNewWindow())):true);
+*/
+/* reportUpdated = rRCSDisabled ==(rdef.isRuntimeColSortDisabled()
+ && displayOptions.equals(nvl(rdef.getDisplayOptions()))
+ //&& dashboardOptions.equals(nvl(rdef.getDashboardOptions()))
+ && numFormCols.equals(nvl(rdef.getNumFormCols()))
+ && reportTitle.equals(nvl(rdef.getReportTitle()))
+ && reportSubTitle.equals(nvl(rdef.getReportSubTitle()))
+ && reportHeader.equals(nvl(rdef.getReportHeader()))
+ && reportsInNewWindow == rdef.isReportInNewWindow()
+ && reportFooter.equals(nvl(rdef.getReportFooter())))
+ ;*/
+
+
+ /*reportUpdated = (!(reportName.equals(nvl(rdef.getReportName()))
+ && reportDescr.equals(nvl(rdef.getReportDescr()))
+ && formHelp.equals(nvl(rdef.getFormHelpText()))
+ && reportType.equals(nvl(rdef.getReportType()))
+ && (pageSize == rdef.getPageSize())
+ && excelDownloadSize == rdef.getMaxRowsInExcelDownload()
+ && reportsInNewWindow == rdef.isReportInNewWindow()
+ && displayOptions.equals(rdef.getDisplayOptions())
+ && dataContainerHeight.equals(rdef.getDataContainerHeight())
+ && dataContainerWidth.equals(rdef.getDataContainerWidth())
+ && (isAllowSchedule ==(rdef.isAllowSchedule()))
+ // rPublic.equals(rdef.isPublic()?"Y":"N")&&
+ && menuID.equals(nvl(rdef.getMenuID()))
+ && rApproved.equals(rdef.isMenuApproved() ? "Y" : "N") && (rRCSDisabled
+ == ((rdef.isRuntimeColSortDisabled())
+ && displayOptions.equals(nvl(rdef.getDisplayOptions()))
+ //&& dashboardOptions.equals(nvl(rdef.getDashboardOptions()))
+ && numFormCols.equals(nvl(rdef.getNumFormCols()))
+ && reportTitle.equals(nvl(rdef.getReportTitle()))
+ && reportSubTitle.equals(nvl(rdef.getReportSubTitle()))
+ && isOneTimeScheduleAllowed.equals(nvl(rdef.getIsOneTimeScheduleAllowed()))
+ && isHourlyScheduleAllowed.equals(nvl(rdef.getIsHourlyScheduleAllowed()))
+ && isDailyScheduleAllowed.equals(nvl(rdef.getIsDailyScheduleAllowed()))
+ && isDailyMFScheduleAllowed.equals(nvl(rdef.getIsDailyMFScheduleAllowed()))
+ && isWeeklyScheduleAllowed.equals(nvl(rdef.getIsWeeklyScheduleAllowed()))
+ && isMonthlyScheduleAllowed.equals(nvl(rdef.getIsMonthlyScheduleAllowed()))
+ && reportHeader.equals(nvl(rdef.getReportHeader())) && reportFooter
+ .equals(nvl(rdef.getReportFooter()))))
+ )); */
+ rdef.setReportName(reportName);
+ rdef.setReportDescr(reportDescr);
+ rdef.setFormHelpText(formHelp);
+ rdef.setReportType(reportType);
+ rdef.setPageSize(pageSize);
+ rdef.setDBInfo(dataSource);
+ rdef.setDBType(dbType);
+ rdef.setDisplayOptions(displayOptions);
+ rdef.setDataContainerHeight(dataContainerHeight);
+ rdef.setDataContainerWidth(dataContainerWidth);
+ rdef.setAllowSchedule(isAllowSchedule?"Y":"N");
+ rdef.setMultiGroupColumn(isColumnGroup?"Y":"N");
+ rdef.setTopDown(isTopDown?"Y":"N");
+ rdef.setSizedByContent(isSizedByContent?"Y":"N");
+ // rdef.setPublic(rPublic.equals("Y"));
+ rdef.setMenuID(menuID);
+ rdef.setMenuApproved(rApproved.equals("Y"));
+ if (reportDefType.length() > 0)
+ rdef.setReportDefType(reportDefType);
+/* if(rdef.isDashboardType()) {
+ rdef.setDashboardOptions(dashboardOptions.toString());
+ }*/
+ rdef.setHideFormFieldAfterRun(hideFormFieldAfterRun);
+ rdef.setReportInNewWindow(reportsInNewWindow);
+ rdef.setRuntimeColSortDisabled(rRCSDisabled);
+ rdef.setNumFormCols(numFormCols);
+ rdef.setReportTitle(reportTitle);
+ rdef.setReportSubTitle(reportSubTitle);
+ rdef.setReportHeader(reportHeader);
+ rdef.setReportFooter(reportFooter);
+ rdef.setIsOneTimeScheduleAllowed(isOneTimeScheduleAllowed);
+ rdef.setIsHourlyScheduleAllowed(isHourlyScheduleAllowed);
+ rdef.setIsDailyScheduleAllowed(isDailyScheduleAllowed);
+ rdef.setIsDailyMFScheduleAllowed(isDailyMFScheduleAllowed);
+ rdef.setIsWeeklyScheduleAllowed(isWeeklyScheduleAllowed);
+ rdef.setIsMonthlyScheduleAllowed(isMonthlyScheduleAllowed);
+ rdef.setFrozenColumns(frozenColumns);
+
+ } // if
+
+ if (rdef.getWizardSequence() instanceof WizardSequence)
+ rdef.generateWizardSequence(request);
+
+
+ /*
+ * if(formHelp.length()>255) formHelp = formHelp.substring(0, 255);
+ */
+
+
+ // String rPublic = nvl(AppUtils.getRequestValue(request, "public"),
+ // "N");
+ // String menuID = AppUtils.getRequestNvlValue(request, "menuID");
+
+// boolean dashboardOptionsShown = AppUtils.getRequestNvlValue(request,
+// "dashboardOptionsShown").equals("Y");
+
+ reportUpdated = true;
+
+ if (rdef.getReportID().equals("-1"))
+ // Always need to persist new report - in case it is a copy
+ reportUpdated = true;
+
+ return reportUpdated;
+ } // processDefinition
+
+ private boolean processTableAdd(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String tableName = AppUtils.getRequestNvlValue(request, "tableName").toUpperCase();
+ String tableId = rdef.getUniqueTableId(tableName);
+
+ String joinTableExpr = null;
+ String joinTableId = null;
+
+ DataSourceType joinTable =
+ rdef.getTableById(AppUtils.getRequestValue(request, "joinTableName"));
+ if (joinTable != null) {
+ String joinTableName = joinTable.getTableName();
+ joinTableId = joinTable.getTableId();
+
+ String joinExpr = AppUtils.getRequestNvlValue(request, "joinExpr").toUpperCase();
+
+ joinTableExpr = joinExpr.replaceAll("\\["+tableName+"\\]", tableId);
+ joinTableExpr = joinTableExpr.replaceAll("\\["+joinTableName+"\\]", joinTableId);
+// debugLogger.debug("joinExpr : "+joinExpr+"\njoinTableExpr : "+ joinTableExpr);
+ }
+
+ rdef.addDataSourceType(new ObjectFactory(), tableId, tableName, AppUtils
+ .getRequestNvlValue(request, "tablePK"), AppUtils.getRequestNvlValue(request,
+ "displayName"), joinTableId, joinTableExpr, null);
+
+ rdef.setOuterJoin(rdef.getTableById(tableId), AppUtils.getRequestNvlValue(request,
+ "outerJoin"));
+ rdef.resetCache(true);
+
+ return true;
+ } // processTableAdd
+
+ private boolean processTableEdit(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ DataSourceType dst = rdef.getTableById(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+
+ String displayName = XSSFilter.filterRequest(AppUtils.getRequestNvlValue(request, "displayName"));
+ String outerJoin = AppUtils.getRequestNvlValue(request, "outerJoin");
+
+ String tableName = AppUtils.getRequestNvlValue(request, "tableName").toUpperCase();
+ String joinTableId = AppUtils.getRequestNvlValue(request, "joinTableName");
+
+ String joinExpr = AppUtils.getRequestNvlValue(request, "joinExpr").toUpperCase();
+
+ String joinTableExpr = null;
+ if(joinExpr.length()!=0){
+ joinTableExpr = joinExpr.replaceAll("\\["+tableName+"\\]", rdef.getTableByDBName(tableName).getTableId());
+ joinTableExpr = joinTableExpr.replaceAll("\\["+rdef.getTableById(joinTableId).getTableName().toUpperCase()+"\\]", joinTableId);
+ dst.setRefDefinition(joinTableExpr);
+ }
+ boolean reportUpdated = (!displayName.equals(nvl(dst.getDisplayName())) ||
+ !outerJoin.equals(rdef.getOuterJoinType(dst)) ||
+ !(joinExpr.length()==0));
+
+ dst.setDisplayName(displayName);
+ rdef.setOuterJoin(dst, outerJoin);
+ if (reportUpdated)
+ rdef.resetCache(true);
+
+ return true; // reportUpdated;
+ } // processTableEdit
+
+
+ private boolean processTableDelete(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.deleteDataSourceType(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processTableDelete
+
+ private boolean processColumnAddEdit(HttpServletRequest request, boolean isEdit)
+ throws Exception {
+ if(!isEdit) {
+ return true;
+ }
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ DataColumnType currColumn = null;
+
+ String tableId = null;
+ String colName = null;
+ String dataType = null;
+ if (isEdit) {
+ currColumn = rdef.getColumnById(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+
+ if(currColumn!=null) {
+ tableId = currColumn.getTableId();
+ colName = currColumn.getDbColName(); // currColumn.getColName();
+ dataType = currColumn.getDbColType();
+ }
+ } else {
+ String colData = AppUtils.getRequestNvlValue(request, "columnDetails");
+ if(nvl(colData).length()>0) {
+ tableId = colData.substring(0, colData.indexOf('|'));
+ colName = colData.substring(tableId.length() + 1,
+ colData.indexOf('|', tableId.length() + 1)).toUpperCase();
+ dataType = colData.substring(tableId.length() + colName.length() + 2);
+ }
+ } // else
+
+ String exprFormula = AppUtils.getRequestNvlValue(request, "exprFormula");
+
+ String colNameValue = null;
+ if (exprFormula.length() > 0)
+ if (exprFormula.equals("_exprText_"))
+ colNameValue = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestValue(request, "exprText"));
+ else if (exprFormula.equals("COUNT(*)"))
+ colNameValue = exprFormula;
+ else
+ colNameValue = exprFormula + " " + colName + ")";
+ else
+ colNameValue = colName;
+
+ int displayWidth = -1;
+ try {
+ displayWidth = Integer.parseInt(AppUtils.getRequestValue(request, "displayWidth"));
+ } catch (NumberFormatException e) {
+ }
+
+ String sColId = isEdit ? currColumn.getColId() : (nvl(colName).length()>0?rdef.getUniqueColumnId(colName):null);
+ String drillDownParams = AppUtils.getRequestValue(request, "drillDownParams");
+ if (drillDownParams != null) {
+ // Replacing references to [this] with [col_id]
+ while (drillDownParams.indexOf("[this]") >= 0) {
+ int startIdx = drillDownParams.indexOf("[this]");
+ StringBuffer sb = new StringBuffer();
+
+ if (startIdx > 0)
+ sb.append(drillDownParams.substring(0, startIdx));
+ sb.append("[" + sColId + "]");
+ if (startIdx + 6 < drillDownParams.length() - 1)
+ sb.append(drillDownParams.substring(startIdx + 5));
+ drillDownParams = sb.toString();
+ } // while
+ } // if
+
+ String crossTabValue = null;
+ boolean isVisible = AppUtils.getRequestFlag(request, "visible");
+ boolean isSortable = AppUtils.getRequestFlag(request, "sortable");
+ String nowrap = AppUtils.getRequestNvlValue(request, "nowrap");
+ int indentation = 0;
+ try {
+ indentation = Integer.parseInt(AppUtils.getRequestNvlValue(request, "indentation"));
+ }catch (NumberFormatException e) {
+ }
+ String dependsOnFormField = AppUtils.getRequestNvlValue(request, "dependsOnFormField");
+ boolean isGroupBreak = AppUtils.getRequestFlag(request, "groupBreak");
+ String groupByPosStr = AppUtils.nvls(AppUtils.getRequestValue(request, "groupByPos"), "0");
+ int groupByPos = Integer.parseInt(groupByPosStr);
+ currColumn.setGroupByPos(groupByPos);
+
+ if(groupByPos > 0) {
+ String subTotalCustomText = AppUtils.nvls(AppUtils.getRequestValue(request, "subTotalCustomText"), "Sub Total");
+ currColumn.setSubTotalCustomText(subTotalCustomText);
+
+ boolean hideRepeatedKey = AppUtils.getRequestFlag(request, "hideRepeatedKeys");
+ currColumn.setHideRepeatedKey(hideRepeatedKey);
+ }
+
+ String displayTotal = AppUtils.getRequestNvlValue(request, "displayTotal");
+ String widthInPxls = AppUtils.getRequestNvlValue(request, "widthInPxls");
+
+ if (rdef.getReportType().equals(AppConstants.RT_CROSSTAB)) {
+
+
+
+ crossTabValue = AppUtils.getRequestValue(request, "crossTabValue");
+ isVisible = nvl(crossTabValue).equals(AppConstants.CV_ROW)
+ || nvl(crossTabValue).equals(AppConstants.CV_COLUMN)
+ || nvl(crossTabValue).equals(AppConstants.CV_VALUE);
+ isGroupBreak = nvl(crossTabValue).equals(AppConstants.CV_ROW)
+ || nvl(crossTabValue).equals(AppConstants.CV_COLUMN);
+
+ if (nvl(crossTabValue).equals(AppConstants.CV_VALUE))
+ displayTotal += "|"
+ + AppUtils.getRequestNvlValue(request, "displayTotalPerRow");
+ else
+ displayTotal = "";
+ } // if
+
+ String displayName = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "displayName"));
+ String colType = AppUtils.getRequestNvlValue(request, "colType");
+ String displayFormat = AppUtils.getRequestNvlValue(request, "displayFormat");
+
+ //HYPERLINK
+ if(colType.equals(AppConstants.CT_HYPERLINK)) {
+ String hyperlinkURL = AppUtils.getRequestValue(request, "hyperlinkURL");
+ currColumn.setHyperlinkURL(hyperlinkURL);
+ String anchor = AppUtils.getRequestValue(request, "anchor");
+ currColumn.setHyperlinkType(anchor);
+ if(anchor.equals("IMAGE")) {
+ String actionImg = AppUtils.getRequestValue(request, "actionImg");
+ currColumn.setActionImg(actionImg);
+ }
+ }
+
+
+
+ String displayAlign = AppUtils.getRequestValue(request, "displayAlign");
+ String displayHeaderAlign = AppUtils.getRequestValue(request, "displayHeaderAlign");
+ String drillDownURL = AppUtils.getRequestValue(request, "drillDownURL");
+ String drillDownSuppress = AppUtils.getRequestValue(request, "drillDownSuppress");
+ boolean drillDownPopUp = AppUtils.getRequestFlag (request, "drillDownPopUp");
+ String semaphoreId = AppUtils.getRequestNvlValue(request, "semaphore");
+ String semaphoreType = AppUtils.getRequestNvlValue(request, "semaphoreTypeHidden");
+
+ String levelStr = AppUtils.getRequestNvlValue(request, "multiGroupColLevel");
+ String startColGroup = AppUtils.getRequestNvlValue(request, "startMultiGroup");
+ String colGroupColSpan = AppUtils.getRequestNvlValue(request, "colspan");
+ int level = 0;
+ try {
+ level = Integer.parseInt(levelStr);
+ }catch (NumberFormatException ex) {
+ level = 0;
+ }
+ int startColGroupInt = 0;
+ int colGroupColSpanInt = 0;
+ if(level > 0) {
+ try {
+ //startColGroupInt = Integer.parseInt(startColGroup);
+ colGroupColSpanInt = Integer.parseInt(colGroupColSpan);
+ } catch (NumberFormatException ex) {
+
+ }
+ }
+ currColumn.setLevel(level);
+ if(level > 0) {
+ currColumn.setStart(startColGroupInt);
+ currColumn.setColspan(colGroupColSpanInt);
+ }
+
+ String targetColumnId = (semaphoreType.indexOf("|")!= -1 ? semaphoreType.substring(semaphoreType.indexOf("|")+1):"");
+ DataColumnType targetColumn = rdef.getColumnById(targetColumnId);
+
+ SemaphoreType semaphore = rdef.getSemaphoreById(semaphoreId);
+ rdef.deleteSemaphore(semaphore);
+ if(nvl(semaphoreType).length() > 0 && semaphoreType.indexOf("|")!=-1)
+ semaphore.setSemaphoreType(semaphoreType.substring(0,semaphoreType.indexOf("|")));
+ if(semaphore!=null) {
+ semaphore.setComment(currColumn.getColId());
+ if(nvl(semaphoreType).length() > 0)
+ semaphore.setTarget(targetColumnId.length()>0? targetColumnId: "");
+ rdef.setSemaphore(semaphore);
+ }
+
+
+ if (isEdit) {
+ if(nvl(widthInPxls).length()>0) {
+ if(nvl(widthInPxls).endsWith("px"))
+ currColumn.setDisplayWidthInPxls(widthInPxls);
+ else
+ currColumn.setDisplayWidthInPxls(widthInPxls+"px");
+ } else {
+ currColumn.setDisplayWidthInPxls("");
+ }
+
+ currColumn.setCrossTabValue(crossTabValue);
+ currColumn.setDependsOnFormField(dependsOnFormField);
+ currColumn.setDisplayName(displayName);
+ //currColumn.setOriginalDisplayName(displayName);
+
+ if (displayWidth > 0)
+ currColumn.setDisplayWidth(displayWidth);
+ currColumn.setDisplayAlignment(displayAlign);
+ currColumn.setDisplayHeaderAlignment(displayHeaderAlign);
+ currColumn.setDrillDownURL(drillDownURL);
+ currColumn.setDrillDownParams(drillDownParams);
+ currColumn.setDrillDownType(drillDownSuppress);
+ currColumn.setDrillinPoPUp(drillDownPopUp);
+ //indentation
+ currColumn.setIndentation(indentation);
+ if(drillDownPopUp) {
+ rdef.setDrillDownURLInPopupPresent(true);
+ }
+ /*if(targetColumn!=null) {
+ currColumn.setSemaphoreId(null);
+ targetColumn.setSemaphoreId(semaphoreId);
+ } else */
+ currColumn.setSemaphoreId(semaphoreId);
+ currColumn.setGroupBreak(isGroupBreak);
+ logger.debug(EELFLoggerDelegate.debugLogger, (" ------------ Display Total ---------- "+ displayTotal));
+ currColumn.setDisplayTotal(displayTotal);
+ //if (currColumn.getDrillDownURL() == null || currColumn.getDrillDownURL().length() == 0)
+ currColumn.setVisible(isVisible);
+ currColumn.setIsSortable(isSortable);
+ currColumn.setNowrap(nowrap);
+ //else
+ // currColumn.setVisible(true);
+ if (rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)) {
+ if(colType!=null)
+ currColumn.setColType(colType);
+ displayFormat = AppUtils.getRequestValue(request, "colDataFormat");
+ if (displayFormat != null){
+ currColumn.setColFormat(displayFormat);
+ }
+ if(colType!=null && colType.equals(AppConstants.CT_DATE)) {
+ boolean enhancedPagination = AppUtils.getRequestFlag(request, "enhancedPagination");
+ currColumn.setEnhancedPagination(enhancedPagination);
+ }
+ }
+ if (!rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)) {
+ currColumn.setColName(colNameValue);
+ if (displayFormat != null)
+ currColumn.setColFormat(displayFormat);
+ //currColumn.setVisible(isVisible);
+ currColumn.setCalculated(exprFormula.length() > 0);
+
+ rdef.adjustColumnType(currColumn);
+ } // if
+
+ rdef.resetCache(true);
+ } else
+ currColumn = rdef.addDataColumnType(new ObjectFactory(), sColId, tableId, colName,
+ crossTabValue, colNameValue, displayName, displayWidth, displayAlign, rdef
+ .getAllColumns().size() + 1, isVisible,
+ (exprFormula.length() > 0), adjustDataType(dataType), displayFormat,
+ isGroupBreak, -1, null, displayTotal, null, -1, drillDownSuppress,
+ drillDownURL, drillDownParams, semaphoreId, null);
+
+ if (rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED))
+ rdef.setColumnNoParseDateFlag(currColumn, AppUtils.getRequestFlag(request,
+ "no_parse_date"));
+ if(nvl(displayName).length()>0)
+ return true;
+ else
+ return false;
+ } // processColumnAddEdit
+
+ private boolean processColumnAddMulti(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ List reportCols = rdef.getAllColumns();
+ int nCol = reportCols.size() + 1;
+
+ String[] addColumn = request.getParameterValues("addColumn");
+ String[] tableId = request.getParameterValues("tableId");
+ String[] columnName = request.getParameterValues("columnName");
+ String[] columnType = request.getParameterValues("columnType");
+ String[] displayName = request.getParameterValues("displayName");
+
+ for (int i = 0; i < addColumn.length; i++)
+ if (addColumn[i].equals("Y")) {
+ int j = 2;
+ String uniqueDisplayName = displayName[i];
+ boolean isUnique = true;
+ do {
+ isUnique = true;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();)
+ if (uniqueDisplayName.equals(((DataColumnType) iter.next())
+ .getDisplayName())) {
+ isUnique = false;
+ uniqueDisplayName = displayName[i] + (j++);
+ break;
+ } // if
+ } while (!isUnique);
+
+ rdef
+ .addDataColumnType(
+ new ObjectFactory(),
+ rdef.getUniqueColumnId(columnName[i]),
+ tableId[i],
+ columnName[i],
+ null,
+ columnName[i],
+ uniqueDisplayName,
+ 10,
+ "Left",
+ nCol++,
+ true,
+ false,
+ adjustDataType(columnType[i]),
+ (columnType[i].equals(AppConstants.CT_DATE) ? AppConstants.DEFAULT_DATE_FORMAT
+ : null), false, -1, null, null, null, -1, null, null,
+ null, null, null);
+ } // if
+
+ return true;
+ } // processColumnAddMulti
+
+ private boolean processColumnOrderAll(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String[] colId = request.getParameterValues("colId");
+ String[] colOrder = request.getParameterValues("colOrder");
+
+ boolean reportUpdated = false;
+ for (int i = 0; i < colId.length; i++) {
+ DataColumnType dct = rdef.getColumnById(nvl(colId[i]));
+ if (dct == null)
+ continue;
+
+ int iColOrder = 0;
+ try {
+ iColOrder = Integer.parseInt(colOrder[i]);
+ } catch (NumberFormatException e) {
+ }
+
+ if (iColOrder > 0) {
+ dct.setOrderSeq(iColOrder);
+ reportUpdated = true;
+ } // if
+ } // for
+
+ if (reportUpdated) {
+ List reportCols = rdef.getAllColumns();
+ Collections.sort(reportCols, new OrderSeqComparator());
+
+ int iOrder = 1;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ dct.setOrderSeq(iOrder++);
+ } // for
+
+ rdef.resetCache(false);
+ } // if
+
+ return reportUpdated;
+ } // processColumnOrderAll
+
+ private boolean processColumnDelete(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.deleteDataColumnType(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processColumnDelete
+
+ private boolean processColumnMoveUp(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.shiftColumnOrderUp(AppUtils
+ .getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processColumnMoveUp
+
+ private boolean processColumnMoveDown(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.shiftColumnOrderDown(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processColumnMoveDown
+
+ private boolean processFormFieldAddEdit(HttpServletRequest request, boolean isEdit,
+ String action) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String fieldName = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "fieldName"));
+ String multiSelectSize = "0";
+ String colId = AppUtils.getRequestNvlValue(request, "fieldColId");
+ if (rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)) {
+ String displayFormat = AppUtils.getRequestNvlValue(request, "displayFormat");
+ if (displayFormat.length() > 0)
+ colId += "|" + displayFormat;
+ } // if
+ String fieldType = AppUtils.getRequestNvlValue(request, "fieldType");
+ String validation = AppUtils.getRequestNvlValue(request, "validation");
+ String mandatory = nvl(AppUtils.getRequestValue(request, "mandatory"), "N");
+ String defaultValue = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "defaultValue"));
+ String fieldHelp = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "fieldHelp"));
+ String fieldSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "fieldSQL"));
+ String fieldDefaultSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "fieldDefaultSQL"));
+ String visible = nvl(AppUtils.getRequestValue(request, "visible"),"Y");
+ String dependsOn = nvl(AppUtils.getRequestValue(request, "dependsOn"),"");
+ String rangeStartDate = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeStartDate"));
+ String rangeEndDate = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeEndDate"));
+ String rangeStartDateSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeStartDateSQL"));
+ String rangeEndDateSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeEndDateSQL"));
+ boolean isGroupFormField = AppUtils.getRequestFlag(request,"isGroupFormField");
+
+ Calendar start = null;
+ Calendar end = null;
+ if (AppUtils.nvl(rangeStartDate).length()>0){
+ SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
+ start = Calendar.getInstance();
+ start.setTime(dtf.parse(rangeStartDate));
+ }
+ if (AppUtils.nvl(rangeEndDate).length()>0){
+ SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
+ end = Calendar.getInstance();
+ end.setTime(dtf.parse(rangeEndDate));
+ }/*
+ * if(fieldHelp.length()>255) fieldHelp = fieldHelp.substring(0, 255);
+ */
+
+ boolean reportUpdated = false;
+
+ FormFieldType currField = null;
+ if (isEdit) {
+ String fieldId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID);
+
+ currField = rdef.getFormFieldById(fieldId);
+ if (currField != null && nvl(fieldName).length()>0) {
+ reportUpdated = (!(fieldName.equals(nvl(currField.getFieldName()))
+ && colId.equals(nvl(currField.getColId()))
+ && fieldType.equals(nvl(currField.getFieldType()))
+ && validation.equals(nvl(currField.getValidationType()))
+ && mandatory.equals(nvl(currField.getMandatory(), "N"))
+ && defaultValue.equals(nvl(currField.getDefaultValue()))
+ && fieldSQL.equals(nvl(currField.getFieldSQL()))
+ && fieldDefaultSQL.equals(nvl(currField.getFieldDefaultSQL()))
+ && dependsOn.equals(nvl(currField.getDependsOn(), "N"))
+ && (start == null || (start != null && currField.getRangeStartDate() == null) || (start.equals(currField.getRangeStartDate())))
+ && (end == null || (end != null && currField.getRangeEndDate() == null) || (end.equals(currField.getRangeEndDate())))
+ && rangeStartDateSQL.equals(nvl(currField.getRangeStartDateSQL()))
+ && rangeEndDateSQL.equals(nvl(currField.getRangeEndDateSQL()))
+ && visible.equals(nvl(currField.getVisible(), "Y"))
+ && isGroupFormField == currField.isGroupFormField()
+ && fieldHelp.equals(nvl(currField.getComment()))));
+
+ rdef.replaceFormFieldReferences("[" + currField.getFieldName() + "]", "["
+ + fieldName + "]");
+
+ currField.setFieldName(fieldName);
+ currField.setColId(colId);
+ currField.setFieldType(fieldType);
+ currField.setValidationType(validation);
+ currField.setMandatory(mandatory);
+ currField.setDefaultValue(defaultValue);
+ currField.setFieldSQL(fieldSQL);
+ currField.setFieldDefaultSQL(fieldDefaultSQL);
+ currField.setComment(fieldHelp);
+ currField.setVisible(visible);
+ currField.setDependsOn(dependsOn);
+ try {
+ if(start!=null) {
+ currField.setRangeStartDate(DatatypeFactory.newInstance()
+ .newXMLGregorianCalendar(start.YEAR, start.MONTH, start.DAY_OF_WEEK, start.HOUR, start.MINUTE, start.SECOND, start.MILLISECOND, start.ZONE_OFFSET));
+ } else {
+ currField.setRangeStartDate(null);
+ }
+ if(end!=null) {
+ currField.setRangeEndDate(DatatypeFactory.newInstance()
+ .newXMLGregorianCalendar(end.YEAR, end.MONTH, end.DAY_OF_WEEK, end.HOUR, end.MINUTE, end.SECOND, end.MILLISECOND, end.ZONE_OFFSET));
+ } else {
+ currField.setRangeEndDate(null);
+ }
+ /*currField.setRangeEndDate(DatatypeFactory.newInstance()
+ .newXMLGregorianCalendar(end));*/
+ } catch (DatatypeConfigurationException ex) {
+
+ }
+
+ currField.setRangeStartDateSQL(rangeStartDateSQL);
+ currField.setRangeEndDateSQL(rangeEndDateSQL);
+ currField.setGroupFormField(isGroupFormField);
+ if(fieldType.equals(FormField.FFT_LIST_MULTI)) {
+ multiSelectSize = AppUtils.getRequestNvlValue(request, "multiSelectListSize");
+ currField.setMultiSelectListSize(multiSelectSize);
+ }
+
+
+ } // if
+ } else {
+ reportUpdated = true;
+
+ currField = rdef.addFormFieldType(new ObjectFactory(), fieldName, colId,
+ fieldType, validation, mandatory, defaultValue, fieldSQL, fieldHelp, start, end, rangeStartDateSQL, rangeEndDateSQL);
+
+ request.setAttribute(AppConstants.RI_DETAIL_ID, currField.getFieldId());
+ } // else
+
+ if (action.equals(AppConstants.WA_ADD_USER)) {
+ reportUpdated = true;
+ rdef.addFormFieldPredefinedValue(new ObjectFactory(), currField, XSSFilter.filterRequestOnlyScript(AppUtils
+ .getRequestNvlValue(request, "newPredefinedValue")));
+ } else if (action.equals(AppConstants.WA_DELETE_USER)) {
+ reportUpdated = true;
+ rdef.deleteFormFieldPredefinedValue(currField, AppUtils.getRequestNvlValue(
+ request, "delPredefinedValue"));
+ }
+
+ return reportUpdated;
+ } // processFormFieldAddEdit
+
+ private boolean processFormFieldDelete(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String fieldId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID);
+ rdef.deleteFormField(fieldId);
+
+ return true;
+ } // processFormFieldDelete
+
+ private boolean processFormFieldMoveUp(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.shiftFormFieldUp(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processFormFieldMoveUp
+
+ private boolean processFormFieldMoveDown(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.shiftFormFieldDown(AppUtils
+ .getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processFormFieldMoveDown
+
+ private boolean processFormFieldBlank(HttpServletRequest request) throws Exception {
+ boolean reportUpdated = false;
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ reportUpdated = true;
+ rdef.addFormFieldBlank(new ObjectFactory());
+ return true;
+ } // processFormFieldMoveDown
+
+ //processFormFieldInfoBar
+ private boolean processFormFieldInfoBar(HttpServletRequest request) throws Exception {
+ boolean reportUpdated = false;
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ reportUpdated = true;
+ rdef.addCustomizedTextForParameters(XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "blueBarField")));
+ return true;
+ } // processFormFieldMoveDown
+
+
+ private boolean processForecasting(HttpServletRequest request, String action) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ if(rdef.getDataminingOptions()==null)
+ rdef.addDataminingOptions(new ObjectFactory());
+
+ String classifiers = AppUtils.getRequestNvlValue(request, "classifiers");
+ rdef.setClassifier(classifiers);
+ String dateAttrColId = AppUtils.getRequestNvlValue(request, "timeAttribute");
+ String timeFormat = AppUtils.getRequestNvlValue(request, "timeFormat");
+ if(timeFormat.equals("Default")) timeFormat = "yyyy-MM-dd HH:mm:ss";
+ String forecastingPeriod = AppUtils.getRequestNvlValue(request, "forecastingPeriod");
+
+ String[] forecastCols = request.getParameterValues("forecastCol");
+ List reportCols = rdef.getAllColumns();
+ DataColumnType dct = null;
+ Iterator iter = null;
+
+
+
+ if(dateAttrColId != null) {
+ for(iter=reportCols.iterator(); iter.hasNext(); ) {
+ dct = (DataColumnType) iter.next();
+ if(dct.getColId().equals(dateAttrColId)) {
+ dct.setDataMiningCol(AppConstants.DM_DATE_ATTR);
+ if(timeFormat!=null) rdef.setForecastingTimeFormat(timeFormat);
+ break;
+ }
+ }
+ }
+
+ if(forecastCols != null) {
+ for (int i = 0; i < forecastCols.length; i++) {
+ for(iter=reportCols.iterator(); iter.hasNext(); ) {
+ dct = (DataColumnType) iter.next();
+ if(dct.getColId().equals(forecastCols[i])) {
+ dct.setDataMiningCol(AppConstants.DM_FORECASTING_ATTR);
+ }
+ }
+ }
+ rdef.setForecastingPeriod(forecastingPeriod);
+ }
+ boolean reportUpdated = true;
+
+ return reportUpdated;
+ } // processForecasting
+
+
+ private boolean processFilterAddEdit(HttpServletRequest request, boolean isEdit)
+ throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String colId = AppUtils.getRequestNvlValue(request, "filterColId");
+ String filterExpr = AppUtils.getRequestNvlValue(request, "filterExpr");
+ String argType = (filterExpr.equals("IS NULL") || filterExpr.equals("IS NOT NULL")) ? null
+ : AppUtils.getRequestNvlValue(request, "argType");
+ String argValue = (filterExpr.equals("IS NULL") || filterExpr.equals("IS NOT NULL")) ? null
+ : AppUtils.getRequestNvlValue(request, "argValue");
+
+ if (nvl(argType).equals(AppConstants.AT_COLUMN)) {
+ List reportCols = rdef.getAllColumns();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if (argValue.equals("[" + dct.getDisplayName() + "]")) {
+ argValue = dct.getColId();
+ break;
+ }
+ } // for
+ } // if
+
+ if (nvl(argType).equals(AppConstants.AT_VALUE)
+ && (!nvl(argValue).equals(AppConstants.FILTER_MAX_VALUE))
+ && (!nvl(argValue).equals(AppConstants.FILTER_MIN_VALUE))) {
+ // Validating the value by type
+ DataColumnType currColumn = rdef.getColumnById(colId);
+ String currColType = currColumn.getColType();
+
+ try {
+ String s_sql = Globals.getProcessFilterAddEdit();
+ s_sql = s_sql.replace("[argValue]", argValue);
+ /*DataSet ds = DbUtils.executeQuery("SELECT "
+ + (currColType.equals(AppConstants.CT_NUMBER) ? ("TO_NUMBER('"
+ + argValue + "')")
+ : (currColType.equals(AppConstants.CT_DATE) ? ("TO_DATE('"
+ + argValue
+ + "', '"
+ + nvl(currColumn.getColFormat(),
+ AppConstants.DEFAULT_DATE_FORMAT) + "')")
+ : ("'" + argValue + "'"))) + " FROM dual");*/
+
+ DataSet ds = DbUtils.executeQuery("SELECT "
+ + (currColType.equals(AppConstants.CT_NUMBER) ? ("TO_NUMBER('"
+ + argValue + "')")
+ : (currColType.equals(AppConstants.CT_DATE) ? ("TO_DATE('"
+ + argValue
+ + "', '"
+ + nvl(currColumn.getColFormat(),
+ AppConstants.DEFAULT_DATE_FORMAT) + "')")
+ : s_sql)));
+ } catch (Exception e) {
+ throw new ValidationException(
+ ""
+ + (currColType.equals(AppConstants.CT_NUMBER) ? "Invalid number"
+ : (currColType.equals(AppConstants.CT_DATE) ? ("Invalid date<br>Expected date format " + nvl(
+ currColumn.getColFormat(),
+ AppConstants.DEFAULT_DATE_FORMAT))
+ : "Invalid value<br>Possible reason: use of single quotes"))
+ + "<!--" + e.getMessage() + "--><br>Value: " + argValue);
+ }
+ } // if
+
+ if (isEdit) {
+ int filterPos = -1;
+ try {
+ filterPos = Integer.parseInt(AppUtils.getRequestValue(request, "filterPos"));
+ } catch (NumberFormatException e) {
+ }
+
+ ColFilterType currFilter = rdef.getFilterById(colId, filterPos);
+ if (currFilter != null) {
+ currFilter.setJoinCondition(AppUtils.getRequestValue(request, "filterJoin"));
+ currFilter.setOpenBrackets(AppUtils.getRequestValue(request, "openBrackets"));
+ currFilter.setExpression(filterExpr);
+ // if(argType!=null)
+ currFilter.setArgType(argType);
+ // if(argValue!=null)
+ currFilter.setArgValue(argValue);
+ currFilter
+ .setCloseBrackets(AppUtils.getRequestValue(request, "closeBrackets"));
+ } // if
+
+ rdef.resetCache(true);
+ } else {
+ rdef.addColFilterType(new ObjectFactory(), colId, AppUtils.getRequestValue(
+ request, "filterJoin"), AppUtils.getRequestValue(request, "openBrackets"),
+ filterExpr, argType, argValue, AppUtils.getRequestValue(request,
+ "closeBrackets"), null);
+ } // else
+
+ return true;
+ } // processFilterAddEdit
+
+ private boolean processFilterDelete(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String filterId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID);
+ String colId = filterId.substring(0, filterId.indexOf('|'));
+ int filterPos = -1;
+ try {
+ filterPos = Integer.parseInt(filterId.substring(colId.length() + 1));
+ } catch (NumberFormatException e) {
+ }
+
+ rdef.removeColumnFilter(colId, filterPos);
+
+ return true;
+ } // processFilterDelete
+
+ private boolean processSortAddEdit(HttpServletRequest request, boolean isEdit)
+ throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String sortAscDesc = AppUtils.getRequestNvlValue(request, "sortAscDesc");
+ if (isEdit) {
+ DataColumnType currColumn = rdef.getColumnById(AppUtils.getRequestNvlValue(
+ request, AppConstants.RI_DETAIL_ID));
+ if (currColumn != null)
+ currColumn.setOrderByAscDesc(sortAscDesc);
+ rdef.resetCache(true);
+ } else
+ rdef.addColumnSort(AppUtils.getRequestNvlValue(request, "sortColId"), sortAscDesc,
+ rdef.getNumSortColumns() + 1);
+
+ return true;
+ } // processSortAddEdit
+
+ private boolean processSortOrderAll(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String[] colId = request.getParameterValues("colId");
+ String[] sortOrder = request.getParameterValues("sortOrder");
+ String[] sortAscDesc = request.getParameterValues("sortAscDesc");
+
+ boolean reportUpdated = false;
+ for (int i = 0; i < colId.length; i++) {
+ DataColumnType dct = rdef.getColumnById(nvl(colId[i]));
+ if (dct == null)
+ continue;
+
+ int iSortOrder = 0;
+ try {
+ iSortOrder = Integer.parseInt(sortOrder[i]);
+ } catch (NumberFormatException e) {
+ }
+
+ if (iSortOrder > 0) {
+ if (dct.getOrderBySeq() > 0) {
+ // Update sort
+ if (dct.getOrderBySeq() != iSortOrder) {
+ dct.setOrderBySeq(iSortOrder);
+ reportUpdated = true;
+ } // if
+ if (!nvl(dct.getOrderByAscDesc()).equals(nvl(sortAscDesc[i]))) {
+ dct.setOrderByAscDesc(sortAscDesc[i]);
+ reportUpdated = true;
+ } // if
+ } else {
+ // Add sort
+ dct.setOrderBySeq(iSortOrder);
+ dct.setOrderByAscDesc(sortAscDesc[i]);
+ reportUpdated = true;
+ } // else
+ } else {
+ if (dct.getOrderBySeq() > 0) {
+ // Remove sort
+ dct.setOrderBySeq(0);
+ dct.setOrderByAscDesc(null);
+ reportUpdated = true;
+ } // if
+ } // else
+ } // for
+
+ if (reportUpdated) {
+ List reportCols = rdef.getAllColumns();
+ Collections.sort(reportCols, new OrderBySeqComparator());
+ int iOrder = 1;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if (dct.getOrderBySeq() > 0)
+ dct.setOrderBySeq(iOrder++);
+ } // for
+ Collections.sort(reportCols, new OrderSeqComparator());
+
+ rdef.resetCache(true);
+ } // if
+
+ return reportUpdated;
+ } // processSortOrderAll
+
+ private boolean processSortDelete(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.removeColumnSort(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processSortDelete
+
+ private boolean processSortMoveUp(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef
+ .shiftColumnSortUp(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processSortMoveUp
+
+ private boolean processSortMoveDown(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.shiftColumnSortDown(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processSortMoveDown
+
+ private boolean processJavascript (HttpServletRequest request) throws Exception {
+ processSaveJavascriptElement(request);
+ return true;
+ }
+
+ private boolean processSaveJavascriptElement (HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.setJavascriptElement(AppUtils.getRequestNvlValue(request, AppConstants.RI_JAVASCRIPT));
+ String id = AppUtils.getRequestNvlValue(request, AppConstants.RI_JAVASCRIPT_ITEM_ID);
+ String fieldId = AppUtils.getRequestNvlValue(request, "javascriptFormField-"+id);
+ if( nvl(fieldId).length()>0 && !(fieldId.startsWith("-1"))) {
+
+ String callableJavascriptText = AppUtils.getRequestNvlValue(request, "callText-"+id);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("FieldId " + fieldId + " Call Text " + callableJavascriptText+ " id " + id));
+ JavascriptItemType javaScriptType = null;
+ if(id.length()>0 && id.startsWith("-1")) {
+ javaScriptType = rdef.addJavascriptType(new ObjectFactory(), id);
+ javaScriptType.setFieldId(fieldId);
+ if(!fieldId.equals("os1") || !fieldId.equals("ol1"))
+ javaScriptType.setId(rdef.getNextIdForJavaScriptElement(new ObjectFactory(), fieldId));
+ else {
+ if(fieldId.equals("os1"))
+ javaScriptType.setId("os1|1");
+ else
+ javaScriptType.setId("ol1|1");
+ }
+ javaScriptType.setCallText(callableJavascriptText);
+ } else {
+ javaScriptType = rdef.addJavascriptType(new ObjectFactory(), id);
+ javaScriptType.setCallText(callableJavascriptText);
+ }
+ }
+ return true;
+ }
+ private boolean processAddJavascriptElement (HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ JavascriptItemType javaScriptType = rdef.addJavascriptType(new ObjectFactory(), "");
+ javaScriptType.setId("");
+ javaScriptType.setFieldId("");
+ javaScriptType.setCallText("");
+
+ return true;
+ }
+
+ private boolean processDeleteJavascriptElement (HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ String id = AppUtils.getRequestNvlValue(request, AppConstants.RI_JAVASCRIPT_ITEM_ID);
+ if(rdef.deleteJavascriptType(id))
+ return true;
+ else
+ return false;
+ }
+
+ private boolean processChart(HttpServletRequest request, String action) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ int valueColsCount = rdef.getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, null).size();
+
+ String chartType = AppUtils.getRequestNvlValue(request, "chartType");
+ String chartTypeFixed = AppUtils.getRequestValue(request, "chartTypeFixed");
+ String legendColId = AppUtils.getRequestNvlValue(request, "legendCol");
+ // String valueColId = AppUtils.getRequestNvlValue(request, "valueCol");
+ String leftAxisLabel = AppUtils.getRequestValue(request, "leftAxisLabel");
+ String rightAxisLabel = AppUtils.getRequestValue(request, "rightAxisLabel");
+ String chartWidth = XSSFilter.filterRequest(AppUtils.getRequestNvlValue(request, "chartWidth"));
+ String chartHeight = XSSFilter.filterRequest(AppUtils.getRequestNvlValue(request, "chartHeight"));
+ String chartMultiseries = AppUtils.getRequestNvlValue(request, "multiSeries");
+ String lastSeriesALineChart = AppUtils.getRequestNvlValue(request, "lastSeriesALineChart");
+ String lastSeriesABarChart = AppUtils.getRequestNvlValue(request, "lastSeriesABarChart");
+ String overLayItemLabel = "N";
+ String chartDisplay = null;
+
+ String multiplePieOrder = null;
+ String multiplePieLabelDisplay = null;
+
+ String chartOrientation = null;
+ String secondaryChartRenderer = null;
+
+ String linearRegression = null;
+
+ boolean multiplePieOrderInRunPage = false;
+ boolean multiplePieLabelDisplayInRunPage = false;
+
+ boolean chartOrientationInRunPage = false;
+ boolean secondaryChartRendererInRunPage = false;
+
+ boolean chartDisplayInRunPage = false;
+
+ String intervalFromdate = null;
+ String intervalTodate = null;
+ String intervalLabel = null;
+ boolean displayIntervalInputInRunPage = false;
+ boolean animate = false;
+
+ animate = AppUtils.getRequestNvlValue(request, "animatedOption").equals("animate");
+ if(Globals.showAnimatedChartOption())
+ rdef.setChartAnimate(animate);
+
+
+ String removeColId = "";
+ if (action.equals(AppConstants.WA_DELETE_USER)) {
+ removeColId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID);
+ if(valueColsCount == 2 && !rdef.hasSeriesColumn()) {
+ rdef.setChartLeftAxisLabel(null);
+ rdef.setChartRightAxisLabel(null);
+
+ if(chartType.equals(AppConstants.GT_TIME_SERIES) || chartType.equals(AppConstants.GT_PIE_MULTIPLE)) {
+ chartMultiseries = "N";
+ }
+ }
+ }
+
+ if(rdef.getChartAdditionalOptions()==null)
+ rdef.addChartAdditionalOptions(new ObjectFactory());
+
+ if(rdef.getChartDrillOptions()==null)
+ rdef.addChartDrillOptions(new ObjectFactory());
+
+ //clearing already added
+ if(rdef.getChartDrillOptions().getTargetFormfield()!=null)
+ rdef.getChartDrillOptions().getTargetFormfield().removeAll(rdef.getChartDrillOptions().getTargetFormfield());
+
+
+ if(chartType.equals(AppConstants.GT_PIE_MULTIPLE)) {
+ multiplePieOrder = AppUtils.getRequestNvlValue(request, "multiplePieOrder");
+ multiplePieLabelDisplay = AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay");
+ chartDisplay = AppUtils.getRequestNvlValue(request, "chartDisplay");
+ //if(AppUtils.getRequestNvlValue(request, "multiplePieOrderInRunPage").length()>0)
+ multiplePieOrderInRunPage = AppUtils.getRequestNvlValue(request,"multiplePieOrderInRunPage").equals("Y");
+ //if(AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplayInRunPage").length()>0)
+ multiplePieLabelDisplayInRunPage = AppUtils.getRequestNvlValue(request,"multiplePieLabelDisplayInRunPage").equals("Y");
+ //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0)
+ chartDisplayInRunPage = AppUtils.getRequestNvlValue(request,"chartDisplayInRunPage").equals("Y");
+ if(rdef.getChartAdditionalOptions()!=null) {
+ rdef.setChartMultiplePieOrder(multiplePieOrder+(multiplePieOrderInRunPage?"|Y":""));
+ rdef.setChartMultiplePieLabelDisplay(multiplePieLabelDisplay+(multiplePieLabelDisplayInRunPage?"|Y":""));
+ rdef.setChartDisplay(chartDisplay+(chartDisplayInRunPage?"|Y":""));
+ }
+
+ }
+
+ if(chartType.equals(AppConstants.GT_REGRESSION)) {
+ linearRegression = AppUtils.getRequestNvlValue(request, "regressionType");
+ rdef.setLinearRegressionColor(AppUtils.getRequestNvlValue(request, "valueLinearRegressionColor"));
+ rdef.setExponentialRegressionColor(AppUtils.getRequestNvlValue(request, "valueExponentialRegressionColor"));
+ rdef.setCustomizedRegressionPoint(AppUtils.getRequestNvlValue(request, "regressionPointCustomization"));
+
+ if(nvl(linearRegression).length()>0)
+ rdef.setLinearRegression(linearRegression);
+ else
+ rdef.setLinearRegression("Y");
+ }
+
+ if(chartType.equals(AppConstants.GT_BAR_3D)) {
+ chartOrientation = AppUtils.getRequestNvlValue(request, "chartOrientation");
+ secondaryChartRenderer = AppUtils.getRequestNvlValue(request, "secondaryChartRenderer");
+ chartDisplay = AppUtils.getRequestNvlValue(request, "chartDisplay");
+ //if(AppUtils.getRequestNvlValue(request, "chartOrientationInRunPage").length()>0)
+ chartOrientationInRunPage = AppUtils.getRequestNvlValue(request,"chartOrientationInRunPage").equals("Y");
+ //if(AppUtils.getRequestNvlValue(request, "secondaryChartRendererInRunPage").length()>0)
+ secondaryChartRendererInRunPage = AppUtils.getRequestNvlValue(request,"secondaryChartRendererInRunPage").equals("Y");
+ //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0)
+ chartDisplayInRunPage = AppUtils.getRequestNvlValue(request,"chartDisplayInRunPage").equals("Y");
+ rdef.setChartOrientation(chartOrientation+(chartOrientationInRunPage?"|Y":""));
+ rdef.setSecondaryChartRenderer(secondaryChartRenderer+(secondaryChartRendererInRunPage?"|Y":""));
+ rdef.setChartDisplay(chartDisplay+(chartDisplayInRunPage?"|Y":""));
+ rdef.setLastSeriesALineChart(nvl(lastSeriesALineChart, "N"));
+ }
+
+ if(chartType.equals(AppConstants.GT_LINE)) {
+ chartOrientation = AppUtils.getRequestNvlValue(request, "chartOrientation");
+ secondaryChartRenderer = AppUtils.getRequestNvlValue(request, "secondaryChartRenderer");
+ chartDisplay = AppUtils.getRequestNvlValue(request, "chartDisplay");
+ //if(AppUtils.getRequestNvlValue(request, "chartOrientationInRunPage").length()>0)
+ chartOrientationInRunPage = AppUtils.getRequestNvlValue(request,"chartOrientationInRunPage").equals("Y");
+ //if(AppUtils.getRequestNvlValue(request, "secondaryChartRendererInRunPage").length()>0)
+ secondaryChartRendererInRunPage = AppUtils.getRequestNvlValue(request,"secondaryChartRendererInRunPage").equals("Y");
+ //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0)
+ chartDisplayInRunPage = AppUtils.getRequestNvlValue(request,"chartDisplayInRunPage").equals("Y");
+ rdef.setChartOrientation(chartOrientation+(chartOrientationInRunPage?"|Y":""));
+ rdef.setSecondaryChartRenderer(secondaryChartRenderer+(secondaryChartRendererInRunPage?"|Y":""));
+ rdef.setChartDisplay(chartDisplay+(chartDisplayInRunPage?"|Y":""));
+ rdef.setLastSeriesABarChart(nvl(lastSeriesABarChart, "N"));
+ }
+ if(chartType.equals(AppConstants.GT_TIME_DIFFERENCE_CHART)) {
+ intervalFromdate = AppUtils.getRequestNvlValue(request, "intervalFromDate");
+ intervalTodate = AppUtils.getRequestNvlValue(request, "intervalToDate");
+ intervalLabel = AppUtils.getRequestNvlValue(request, "intervalLabel");
+ displayIntervalInputInRunPage = AppUtils.getRequestNvlValue(request,"intervalInputInRunPage").equals("Y");
+ rdef.setIntervalFromdate(intervalFromdate+(displayIntervalInputInRunPage?"|Y":""));
+ rdef.setIntervalTodate(intervalTodate+(displayIntervalInputInRunPage?"|Y":""));
+ rdef.setIntervalLabel(intervalLabel);
+ }
+ if(chartType.equals(AppConstants.GT_STACKED_VERT_BAR) || chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR) || chartType.equals(AppConstants.GT_STACKED_VERT_BAR_LINES)
+ || chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR_LINES)) {
+ overLayItemLabel = AppUtils.getRequestNvlValue(request, "overlayItemValue");
+ rdef.setOverlayItemValueOnStackBar(nvl(overLayItemLabel, "N"));
+ animate = AppUtils.getRequestNvlValue(request, "animatedOption").equals("animate");
+ rdef.setChartAnimate(animate);
+ }
+
+ rdef.setRangeAxisLowerLimit(AppUtils.getRequestNvlValue(request, "yAxisLowerLimit"));
+ rdef.setRangeAxisUpperLimit(AppUtils.getRequestNvlValue(request, "yAxisUpperLimit"));
+ rdef.setLegendLabelAngle(AppUtils.getRequestNvlValue(request,"labelAngle"));
+ rdef.setLegendPosition(AppUtils.getRequestNvlValue(request,"legendPosition"));
+ rdef.setMaxLabelsInDomainAxis(AppUtils.getRequestNvlValue(request,"maxLabelsInDomainAxis"));
+ String chartLegendDisplay = AppUtils.getRequestNvlValue(request,"hideLegend");
+ boolean showLegendDisplayOptionsInRunPage = false;
+ showLegendDisplayOptionsInRunPage = AppUtils.getRequestNvlValue(request,"showLegendDisplayOptionsInRunPage").equals("Y");
+ rdef.setChartLegendDisplay(chartLegendDisplay+(showLegendDisplayOptionsInRunPage?"|Y":""));
+ rdef.setChartToolTips(AppUtils.getRequestNvlValue(request,"hideTooltips"));
+ rdef.setDomainAxisValuesAsString(AppUtils.getRequestNvlValue(request,"keepAsString"));
+
+ //System.out.println("KeepAsString " + AppUtils.getRequestNvlValue(request,"keepAsString"));
+ //System.out.println("From ReportDef " + rdef.keepDomainAxisValueInChartAsString());
+ // boolean reportUpdated = (!
+ // chartType.equals(nvl(rdef.getChartType())));
+ rdef.setChartType(chartType);
+ rdef.setChartTypeFixed(nvl(chartTypeFixed, "N"));
+ if (nvl(leftAxisLabel).length()>0)
+ rdef.setChartLeftAxisLabel(leftAxisLabel);
+ else
+ rdef.setChartLeftAxisLabel(null);
+ if (nvl(rightAxisLabel).length()>0)
+ rdef.setChartRightAxisLabel(rightAxisLabel);
+ else
+ rdef.setChartRightAxisLabel(null);
+ rdef.setChartWidth(nvl(chartWidth, "" + Globals.getDefaultChartWidth()));
+ rdef.setChartHeight(nvl(chartHeight, "" + Globals.getDefaultChartHeight()));
+ if(chartType.equals(AppConstants.GT_TIME_SERIES) || chartType.equals(AppConstants.GT_PIE_MULTIPLE)) {
+ rdef.setChartMultiSeries(chartMultiseries);
+ } else {
+ rdef.setChartMultiSeries("N");
+ }
+
+ List reportCols = rdef.getAllColumns();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if (dct.getColId().equals(legendColId)) {
+ // reportUpdated = reportUpdated||(!
+ // nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND));
+ dct.setColOnChart(AppConstants.GC_LEGEND);
+ } else {
+ // reportUpdated =
+ // reportUpdated||nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND);
+ dct.setColOnChart(null);
+ }
+
+ /*
+ * if(dct.getColId().equals(valueColId)) { reportUpdated =
+ * reportUpdated||(dct.getChartSeq()<=0); dct.setChartSeq(1); }
+ * else { reportUpdated = reportUpdated||(dct.getChartSeq()>0);
+ */
+ dct.setChartSeq(-1);
+ /* } */
+ } // for
+
+ int idx = 1;
+ List columns = rdef.getAllColumns();
+ if(chartType.equals(AppConstants.GT_TIME_SERIES)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ String chartGroup = AppUtils.getRequestNvlValue(request, "chartGroup");
+ String yAxis = AppUtils.getRequestNvlValue(request, "yAxis");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+
+ String drillDownReportId = AppUtils.getRequestNvlValue(request, "drillDownReport");
+ if(!drillDownReportId.equals("-1")) {
+ ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, drillDownReportId,
+ false);
+ if (ddRr != null)
+ request.setAttribute("CHART_FORMFIELDS", ddRr.getReportFormFields());
+
+ for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) {
+ FormField ff = ddRr.getReportFormFields().getNext();
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+ String value = AppUtils.getRequestNvlValue(request, "drillDown_"+ff.getFieldName());
+ ChartDrillFormfield cdf = new ObjectFactory().createChartDrillFormfield();
+ cdf.setFormfield(value);
+ rdef.getChartDrillOptions().getTargetFormfield().add(cdf);
+ }
+ }
+ }
+
+ } else {
+ if(chartType.equals(AppConstants.GT_BAR_3D)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ String chartGroup = AppUtils.getRequestNvlValue(request, "chartGroup");
+ String yAxis = AppUtils.getRequestNvlValue(request, "yAxis");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+ String drillDownReportId = AppUtils.getRequestNvlValue(request, "drillDownReport");
+ rdef.setDrillReportIdForChart(drillDownReportId);
+ if(drillDownReportId.equals("-1")){
+ rdef.setDrillReportIdForChart("");
+ }
+
+ if(!drillDownReportId.equals("-1")) {
+ ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, drillDownReportId,
+ false);
+ if (ddRr != null)
+ request.setAttribute("CHART_FORMFIELDS", ddRr.getReportFormFields());
+
+ for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) {
+ FormField ff = ddRr.getReportFormFields().getNext();
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+ String value = AppUtils.getRequestNvlValue(request, "drillDown_"+ff.getFieldName());
+ ChartDrillFormfield cdf = new ObjectFactory().createChartDrillFormfield();
+ cdf.setFormfield(value);
+ rdef.getChartDrillOptions().getTargetFormfield().add(cdf);
+ }
+ }
+
+ String xAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownXAxisFormfield");
+ String yAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownYAxisFormfield");
+ String seriesAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownSeriesAxisFormfield");
+
+ if(!xAxisFormField.equals("-1")){
+ rdef.setDrillXAxisFormField(xAxisFormField);
+
+ if(!yAxisFormField.equals("-1"))
+ rdef.setDrillYAxisFormField(yAxisFormField);
+ if(!seriesAxisFormField.equals("-1"))
+ rdef.setDrillSeriesFormField(seriesAxisFormField);
+ } else {
+ rdef.setDrillXAxisFormField("");
+ rdef.setDrillYAxisFormField("");
+ rdef.setDrillSeriesFormField("");
+ }
+ }
+
+ } else if(chartType.equals(AppConstants.GT_SCATTER)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+
+ }else if(chartType.equals(AppConstants.GT_REGRESSION)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+ }else if(chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR) || chartType.equals(AppConstants.GT_STACKED_VERT_BAR)
+ || chartType.equals(AppConstants.GT_STACKED_VERT_BAR_LINES) || chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR_LINES)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+ }else if(chartType.equals(AppConstants.GT_LINE)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+ } else if (chartType.equals(AppConstants.GT_TIME_DIFFERENCE_CHART)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+ } else if (chartType.equals(AppConstants.GT_COMPARE_PREVYEAR_CHART)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+
+ } else {
+ if (rdef.hasSeriesColumn()) {
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ alldct.setChartSeries(false);
+ }
+ }
+
+ String drillDownReportId = AppUtils.getRequestNvlValue(request, "drillDownReport");
+ rdef.setDrillReportIdForChart(drillDownReportId);
+ if(drillDownReportId.equals("-1")){
+ rdef.setDrillReportIdForChart("");
+ }
+
+ if(!drillDownReportId.equals("-1")) {
+ ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, drillDownReportId,
+ false);
+ if (ddRr != null)
+ request.setAttribute("CHART_FORMFIELDS", ddRr.getReportFormFields());
+ for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) {
+ FormField ff = ddRr.getReportFormFields().getNext();
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+ String value = AppUtils.getRequestNvlValue(request, "drillDown_"+ff.getFieldName());
+ ChartDrillFormfield cdf = new ObjectFactory().createChartDrillFormfield();
+ cdf.setFormfield(value);
+ rdef.getChartDrillOptions().getTargetFormfield().add(cdf);
+ }
+ }
+
+ String xAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownXAxisFormfield");
+ String yAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownYAxisFormfield");
+ String seriesAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownSeriesAxisFormfield");
+
+ if(!xAxisFormField.equals("-1")){
+ rdef.setDrillXAxisFormField(xAxisFormField);
+
+ if(!yAxisFormField.equals("-1"))
+ rdef.setDrillYAxisFormField(yAxisFormField);
+ if(!seriesAxisFormField.equals("-1"))
+ rdef.setDrillSeriesFormField(seriesAxisFormField);
+ } else {
+ rdef.setDrillXAxisFormField("");
+ rdef.setDrillYAxisFormField("");
+ rdef.setDrillSeriesFormField("");
+ }
+ }
+
+ }
+ }
+
+ for (int i = 1; i < Math.max(valueColsCount, 1) + 1; i++) {
+ //debugLogger.debug("********** " + chartSeries);
+ if(i==1) {
+ /* Range Axis is resetted before adding */
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType dct = (DataColumnType) iterator.next();
+ if(!nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND)) {
+ dct.setChartSeq(-1);
+ dct.setChartColor(null);
+ dct.setColOnChart(null);
+ dct.setCreateInNewChart(false);
+ dct.setChartGroup(null);
+ dct.setYAxis(null);
+ }
+ }
+
+ }
+ String newChartColAxis = AppUtils.getRequestNvlValue(request, "newChart" + i+"Axis");
+ String valueColId = AppUtils.getRequestNvlValue(request, "valueCol" + i);
+ String valueColColor = AppUtils.getRequestNvlValue(request, "valueCol" + i
+ + "Color");
+ String valueColAxis = AppUtils
+ .getRequestNvlValue(request, "valueCol" + valueColId + "Axis");
+ String chartGroup = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "chartGroup" + valueColId + "Axis"));
+ String yAxisGroup = "";
+ yAxisGroup = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "YAxisLabel" + valueColId));
+ //debugLogger.debug("^^^^^^^^^^^^^^^^^Chart Group " + chartGroup);
+ //if(chartType.equals(AppConstants.GT_TIME_SERIES)) {
+ // debugLogger.debug("**********Outer If " + chartSeries);
+ //}
+
+ if (valueColId.length() > 0 && (!valueColId.equals(removeColId))) {
+ DataColumnType dct = rdef.getColumnById(valueColId);
+ dct.setChartSeq(idx++);
+ dct.setChartColor(valueColColor);
+ dct.setColOnChart(valueColAxis.equals("Y") ? "1" : "0");
+ if(chartType.equals(AppConstants.GT_TIME_SERIES)) {
+ dct.setCreateInNewChart(newChartColAxis.equals("Y") ? true : false);
+ } else
+ dct.setCreateInNewChart(false);
+
+ if(chartGroup!=null && chartGroup.length()>0)
+ dct.setChartGroup(chartGroup+"|"+valueColId);
+ else dct.setChartGroup("");
+ if(chartType.equals(AppConstants.GT_TIME_SERIES))
+ dct.setYAxis(nvl(yAxisGroup)+"|"+valueColId);
+ else if (chartType.equals(AppConstants.GT_BAR_3D))
+ dct.setYAxis(nvl(yAxisGroup)+"|"+valueColId);
+ else dct.setYAxis("");
+ //}
+ //else
+ //dct.setCreateInNewChart(false);
+ } else if (valueColId.length() > 0 && (valueColId.equals(removeColId))) {// if
+ DataColumnType dct = rdef.getColumnById(valueColId);
+ dct.setChartSeq(-1);
+ dct.setChartColor(null);
+ dct.setColOnChart(null);
+ dct.setCreateInNewChart(false);
+ dct.setChartGroup(null);
+ dct.setYAxis(null);
+ } else { // else
+ DataColumnType dct = rdef.getColumnById(valueColId);
+ dct.setChartSeq(-1);
+ dct.setChartColor(null);
+ dct.setColOnChart(null);
+ dct.setCreateInNewChart(false);
+ dct.setChartGroup(null);
+ dct.setYAxis(null);
+ }
+ } // for
+
+ if (action.equals(AppConstants.WA_ADD_USER)) {
+ String valueColId = AppUtils.getRequestNvlValue(request, "valueColNew");
+ String valueColColor = AppUtils.getRequestNvlValue(request, "valueColNewColor");
+ String valueColAxis = AppUtils.getRequestNvlValue(request, "valueColNewAxis");
+
+ if (valueColId.length() > 0) {
+ DataColumnType dct = rdef.getColumnById(valueColId);
+ dct.setChartSeq(idx++);
+ dct.setChartColor(valueColColor);
+ dct.setColOnChart(valueColAxis.equals("Y") ? "1" : "0");
+ } // if
+ } // for
+
+ return true; // reportUpdated;
+ } // processChart
+
+ public boolean processAdhocSchedule(HttpServletRequest request, String action)
+ throws Exception {
+ ReportSchedule reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE);
+ reportSchedule.setScheduleUserID(AppUtils.getUserID(request));
+ reportSchedule.setSchedEnabled(
+ nvl(AppUtils.getRequestValue(request, "schedEnabled"), "N"));
+ reportSchedule.setStartDate(
+ AppUtils.getRequestNvlValue(request, "schedStartDate"));
+ reportSchedule.setEndDate(
+ AppUtils.getRequestNvlValue(request, "schedEndDate"));
+ reportSchedule.setEndHour(AppUtils.getRequestNvlValue(request, "schedEndHour"));
+ reportSchedule.setEndMin(AppUtils.getRequestNvlValue(request, "schedEndMin"));
+ reportSchedule.setEndAMPM(AppUtils.getRequestNvlValue(request, "schedEndAMPM"));
+ //schedRunDate
+ reportSchedule.setRunDate(
+ AppUtils.getRequestNvlValue(request, "schedRunDate").length()>0?AppUtils.getRequestNvlValue(request, "schedRunDate"):AppUtils.getRequestNvlValue(request, "schedStartDate"));
+ reportSchedule.setRunHour(AppUtils.getRequestNvlValue(request, "schedHour"));
+ reportSchedule.setRunMin(AppUtils.getRequestNvlValue(request, "schedMin"));
+ reportSchedule.setRunAMPM(AppUtils.getRequestNvlValue(request, "schedAMPM"));
+ reportSchedule.setRecurrence(
+ AppUtils.getRequestNvlValue(request, "schedRecurrence"));
+ reportSchedule.setConditional(
+ nvl(AppUtils.getRequestValue(request, "conditional"), "N"));
+ reportSchedule.setConditionSQL(
+ AppUtils.getRequestNvlValue(request, "conditionSQL"));
+ reportSchedule.setNotify_type(
+ AppUtils.getRequestNvlValue(request, "notify_type"));
+ reportSchedule.setDownloadLimit(
+ AppUtils.getRequestNvlValue(request, "downloadLimit"));
+ reportSchedule.setFormFields(
+ AppUtils.getRequestNvlValue(request, "formFields"));
+ reportSchedule.setAttachmentMode(
+ AppUtils.getRequestNvlValue(request, "sendAttachment"));
+
+ String userId = AppUtils.getRequestNvlValue(request, "schedEmailAdd");
+ String roleId = AppUtils.getRequestNvlValue(request, "schedEmailAddRole");
+ int flag = 0;
+ if ((!(userId.length()>0 || roleId.length()>0) && (reportSchedule.getEmailToUsers().isEmpty() && reportSchedule.getEmailToRoles().isEmpty())) ) {
+ flag = 1;
+ }
+
+ if (flag == 1 || (action.equals(AppConstants.WA_ADD_USER) || action.equals(AppConstants.WA_ADD_ROLE)) ) {
+ String loggedInUserId = AppUtils.getUserID(request);
+ if (Globals.getUseLoginIdInSchedYN().equals("Y")){
+ reportSchedule.addEmailToUser(loggedInUserId, AppUtils.getUserLoginId(request));
+ } else
+ reportSchedule.addEmailToUser(loggedInUserId, (AppUtils.getUserName(loggedInUserId).length()>0?AppUtils.getUserName(loggedInUserId):(AppUtils.getUserLoginId(loggedInUserId).length()>0?AppUtils.getUserLoginId(loggedInUserId):loggedInUserId) ));
+ }
+ if (action.equals(AppConstants.WA_ADD_USER)) {
+ //String userId = AppUtils.getRequestNvlValue(request, "schedEmailAdd");
+ String userName = AppUtils.getUserName(userId);
+ if (Globals.getUseLoginIdInSchedYN().equals("Y")){
+ String userLoginId = AppUtils.getUserLoginId(userId);
+ if (userId.length() > 0 && (userLoginId != null && userLoginId.length() > 0))
+ reportSchedule.addEmailToUser(userId, userLoginId);
+ else {
+ if (userId.length() > 0 && (userName != null && userName.length() > 0) )
+ reportSchedule.addEmailToUser(userId, userName);
+ else {
+ reportSchedule.addEmailToUser(userId, userId);
+ }
+ }
+ }else{
+ if (userId.length() > 0 && (userName != null && userName.length() > 0) )
+ reportSchedule.addEmailToUser(userId, userName);
+ else {
+ reportSchedule.addEmailToUser(userId, userId);
+ }
+ }
+
+ } else if (action.equals(AppConstants.WA_DELETE_USER))
+ reportSchedule.removeEmailToUser(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ else if (action.equals(AppConstants.WA_ADD_ROLE)) {
+ //String roleId = AppUtils.getRequestNvlValue(request, "schedEmailAddRole");
+ String roleName = AppUtils.getRoleName(roleId);
+ if (roleId.length() > 0 && roleName != null)
+ reportSchedule.addEmailToRole(roleId, roleName);
+ } else if (action.equals(AppConstants.WA_DELETE_ROLE))
+ reportSchedule.removeEmailToRole(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ request.getSession().setAttribute(AppConstants.SI_REPORT_SCHEDULE, reportSchedule);
+ return true;
+ } // processAdhocSchedule
+
+ private boolean processSchedule(HttpServletRequest request, String action)
+ throws Exception {
+ // Added for form field chaining in schedule tab so that setParamValues() is called
+ request.setAttribute(AppConstants.SCHEDULE_ACTION, "Y");
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ ReportSchedule reportSchedule = rdef.getReportSchedule();
+ reportSchedule.setScheduleUserID(AppUtils.getUserID(request));
+ reportSchedule.setSchedEnabled(
+ nvl(AppUtils.getRequestValue(request, "schedEnabled"), "N"));
+ reportSchedule.setStartDate(
+ AppUtils.getRequestNvlValue(request, "schedStartDate"));
+ reportSchedule.setEndDate(
+ AppUtils.getRequestNvlValue(request, "schedEndDate"));
+ reportSchedule.setEndHour(AppUtils.getRequestNvlValue(request, "schedEndHour"));
+ reportSchedule.setEndMin(AppUtils.getRequestNvlValue(request, "schedEndMin"));
+ reportSchedule.setEndAMPM(AppUtils.getRequestNvlValue(request, "schedEndAMPM"));
+ //schedRunDate
+ reportSchedule.setRunDate(
+ AppUtils.getRequestNvlValue(request, "schedRunDate").length()>0?AppUtils.getRequestNvlValue(request, "schedRunDate"):AppUtils.getRequestNvlValue(request, "schedStartDate"));
+ reportSchedule.setRunHour(AppUtils.getRequestNvlValue(request, "schedHour"));
+ reportSchedule.setRunMin(AppUtils.getRequestNvlValue(request, "schedMin"));
+ reportSchedule.setRunAMPM(AppUtils.getRequestNvlValue(request, "schedAMPM"));
+ reportSchedule.setRecurrence(
+ AppUtils.getRequestNvlValue(request, "schedRecurrence"));
+ reportSchedule.setConditional(
+ nvl(AppUtils.getRequestValue(request, "conditional"), "N"));
+ reportSchedule.setConditionSQL(
+ AppUtils.getRequestNvlValue(request, "conditionSQL"));
+ reportSchedule.setNotify_type(
+ AppUtils.getRequestNvlValue(request, "notify_type"));
+ reportSchedule.setDownloadLimit(
+ AppUtils.getRequestNvlValue(request, "downloadLimit"));
+ reportSchedule.setFormFields(
+ AppUtils.getRequestNvlValue(request, "formFields"));
+ reportSchedule.setAttachmentMode(
+ AppUtils.getRequestNvlValue(request, "sendAttachment"));
+
+ reportSchedule.setEncryptMode(
+ AppUtils.getRequestNvlValue(request, "encryptMode"));
+ if (action.equals(AppConstants.WA_ADD_USER)) {
+ String userId = AppUtils.getRequestNvlValue(request, "schedEmailAdd");
+ String userName = AppUtils.getUserName(userId);
+ if (Globals.getUseLoginIdInSchedYN().equals("Y")){
+ String userLoginId = AppUtils.getUserLoginId(userId);
+ if (userId.length() > 0 && (userLoginId != null && userLoginId.length() > 0))
+ reportSchedule.addEmailToUser(userId, userLoginId);
+ else {
+ if (userId.length() > 0 && (userName != null && userName.length() > 0) )
+ reportSchedule.addEmailToUser(userId, userName);
+ else {
+ reportSchedule.addEmailToUser(userId, userId);
+ }
+ }
+ }else{
+ if (userId.length() > 0 && (userName != null && userName.length() > 0) )
+ reportSchedule.addEmailToUser(userId, userName);
+ else {
+ reportSchedule.addEmailToUser(userId, userId);
+ }
+ }
+ } else if (action.equals(AppConstants.WA_DELETE_USER))
+ reportSchedule.removeEmailToUser(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ else if (action.equals(AppConstants.WA_ADD_ROLE)) {
+ String roleId = AppUtils.getRequestNvlValue(request, "schedEmailAddRole");
+ String roleName = AppUtils.getRoleName(roleId);
+ if (roleId.length() > 0 && roleName != null)
+ reportSchedule.addEmailToRole(roleId, roleName);
+ } else if (action.equals(AppConstants.WA_DELETE_ROLE))
+ reportSchedule.removeEmailToRole(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+
+ return true;
+ } // processSchedule
+
+ private boolean processUserAccess(HttpServletRequest request, String action)
+ throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String ownerID = AppUtils.getRequestNvlValue(request, "reportOwner");
+ String rPublic = nvl(AppUtils.getRequestValue(request, "public"), "N");
+
+ boolean reportUpdated = (!(ownerID.equals(nvl(rdef.getOwnerID())) && rPublic
+ .equals(rdef.isPublic() ? "Y" : "N")));
+
+ rdef.getReportSecurity().setOwnerID(ownerID);
+ rdef.setPublic(rPublic.equals("Y"));
+
+ if (action.equals(AppConstants.WA_ADD_USER))
+ rdef.getReportSecurity().addUserAccess(
+ AppUtils.getRequestNvlValue(request, "newUserId"), "Y");
+ else if (action.equals(AppConstants.WA_DELETE_USER))
+ rdef.getReportSecurity().removeUserAccess(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ else if (action.equals(AppConstants.WA_GRANT_USER))
+ rdef.getReportSecurity().updateUserAccess(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID), "N");
+ else if (action.equals(AppConstants.WA_REVOKE_USER))
+ rdef.getReportSecurity().updateUserAccess(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID), "Y");
+ else if (action.equals(AppConstants.WA_ADD_ROLE))
+ rdef.getReportSecurity().addRoleAccess(
+ AppUtils.getRequestNvlValue(request, "newRoleId"), "Y");
+ else if (action.equals(AppConstants.WA_DELETE_ROLE))
+ rdef.getReportSecurity().removeRoleAccess(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ else if (action.equals(AppConstants.WA_GRANT_ROLE))
+ rdef.getReportSecurity().updateRoleAccess(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID), "N");
+ else if (action.equals(AppConstants.WA_REVOKE_ROLE))
+ rdef.getReportSecurity().updateRoleAccess(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID), "Y");
+
+ return reportUpdated;
+ } // processUserAccess
+
+ private boolean processClearLog(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ String user_id = AppUtils.getUserID(request);
+ // Modified so that only the logged in user entries are erased. - Sundar
+ ReportLoader.clearReportLogEntries(rdef.getReportID(), user_id);
+ return false;
+ } // processClearLog
+
+ private boolean processValidateSQL(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String sql = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportSQL"));
+ request.setAttribute("sqlValidated", "N");
+ rdef.parseReportSQL(sql);
+ request.setAttribute("sqlValidated", "Y");
+
+ return true;
+ } // processValidateSQL
+
+
+ /*****For Report Maps - Start******/
+ private boolean processMap(HttpServletRequest request, String action) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ org.openecomp.portalsdk.analytics.xmlobj.ReportMap repMap = rdef.getReportMap();
+ //clearing already added
+ if (repMap != null){
+ repMap.getMarkers().removeAll(repMap.getMarkers());
+ }
+ String addressColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "addressColumn0"));
+ System.out.println(" #$%#$%#$% -- address col = " + addressColumn);
+ String dataColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataColumn0"));
+ String legendColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "legendColumn"));
+ //String legendDisplayName = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataHeaderL"));
+ //if(nvl(legendDisplayName).length()<=0) legendDisplayName = legendColumn;
+ String color = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "markerColor0"));
+ String isMapAllowed = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "isMapAllowed"));
+ String useDefaultSize = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "useDefaultSize"));
+ String height = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "height"));
+ String width = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "width"));
+ System.out.println(" #$%#$%#$% -- useDefaultSize="+ useDefaultSize+" height = " + height+" width="+width);
+
+ String addAddress = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "addAddress"));
+ String latCol = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "latColumn"));
+ String longCol = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "longColumn"));
+ String colorCol = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "colorColumn"));
+ if (isMapAllowed.equals(""))
+ isMapAllowed = "N";
+ if (useDefaultSize.equals(""))
+ useDefaultSize = "N";
+ if (repMap == null)
+ rdef.setReportMap(new ObjectFactory().createReportMap());
+ repMap.setAddressColumn(addressColumn);
+ repMap.setDataColumn(dataColumn);
+ repMap.setIsMapAllowedYN(isMapAllowed);
+ repMap.setUseDefaultSize(useDefaultSize);
+ repMap.setMarkerColor(color);
+ repMap.setAddAddressInDataYN(addAddress);
+ repMap.setLatColumn(latCol);
+ repMap.setLongColumn(longCol);
+ repMap.setColorColumn(colorCol);
+ repMap.setHeight(height.trim());
+ repMap.setWidth(width.trim());
+ repMap.setLegendColumn(legendColumn);
+ //repMap.setLegendDisplayName(legendDisplayName);
+
+ Marker m = new ObjectFactory().createMarker();
+ m.setAddressColumn(addressColumn);
+ m.setDataColumn(dataColumn);
+ repMap.getMarkers().add(m);
+ String markerCountString = AppUtils.getRequestNvlValue(request, "markerCount");
+ int markerCount = 0;
+ if (markerCountString != null && markerCountString.equals("") == false){
+ markerCount = new Integer(markerCountString).intValue();
+ }
+ for (int i = 1; i < markerCount; i ++){
+ String additionalAddressColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "addressColumn" + i));
+ String additionalDataHeader = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataHeader" + i));
+ String additionalData = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataColumn" + i));
+ String additionalColor = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "markerColor" + i));
+ if (additionalAddressColumn.equals("1") == false){
+ m = new ObjectFactory().createMarker();
+ m.setAddressColumn(additionalAddressColumn);
+ m.setDataHeader(additionalDataHeader);
+ m.setDataColumn(additionalData);
+ m.setMarkerColor(additionalColor);
+ repMap.getMarkers().add(m);
+ }
+ }
+ return true;
+ } // processMap
+ /*****For Report Maps - End******/
+
+
+} // WizardProcessor
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequence.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequence.java
new file mode 100644
index 00000000..3a843873
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequence.java
@@ -0,0 +1,189 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.Vector;
+
+import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+
+public class WizardSequence extends Vector {
+ // private String currentStep = AppConstants.WS_DEFINITION;
+ private int currentStepIdx = 0;
+
+ private String currentSubStep = "";
+
+ private int nextElemIdx = 0;
+
+ public void resetNext() {
+ resetNext(0);
+ } // resetNext
+
+ public void resetNext(int toPos) {
+ nextElemIdx = toPos;
+ } // resetNext
+
+ public boolean hasNext() {
+ return (nextElemIdx < size());
+ } // hasNext
+
+ public String getNext() {
+ return hasNext() ? getStep(nextElemIdx++) : null;
+ } // getNext
+
+ // *****************************************************
+
+ public WizardSequence() {
+ add(AppConstants.WS_DEFINITION);
+ } // WizardSequence
+
+ private String getStep(int index) {
+ return (String) get(index);
+ } // getStep
+
+ private int getStepIndex(String step) {
+ for (int i = 0; i < size(); i++)
+ if (getStep(i).equals(step))
+ return i;
+
+ throw new IndexOutOfBoundsException();
+ } // getStepIndex
+
+ /*
+ * private String getInitialStep() { return getStep(0); } // getInitialStep
+ *
+ * private String getFinalStep() { return getStep(getStepCount()-1); } //
+ * getFinalStep
+ */
+ private boolean isInitialStep(int index) {
+ return (index == 0);
+ } // isInitialStep
+
+ /*
+ * private boolean isInitialStep(String step) { return
+ * isInitialStep(getStepIndex(step)); } // isInitialStep
+ */
+ private boolean isFinalStep(int index) {
+ if (index == 0)
+ return false;
+
+ return (index == (getStepCount() - 1));
+ } // isFinalStep
+
+ /*
+ * private boolean isFinalStep(String step) { return
+ * isFinalStep(getStepIndex(step)); } // isFinalStep
+ */
+
+ private int getNextStepIndex(int index) {
+ return (index == (getStepCount() - 1)) ? index : (index + 1);
+ } // getNextStep
+
+ /*
+ * private String getNextStep(String step) { return
+ * getStep(getNextStepIndex(getStepIndex(step))); } // getNextStep
+ *
+ * private String getNextStep(String step, String subStep) {
+ * if(subStep.length()>0) return step;
+ *
+ * return getNextStep(step); } // getNextStep
+ */
+ private int getPrevStepIndex(int index) {
+ return (index == 0) ? index : (index - 1);
+ } // getPrevStepIndex
+
+ /*
+ * private String getPrevStep(String step) { return
+ * getStep(getPrevStepIndex(getStepIndex(step))); } // getPrevStep
+ *
+ * private String getPrevStep(String step, String subStep) {
+ * if(subStep.length()>0) return step;
+ *
+ * return getPrevStep(step); } // getPrevStep
+ */
+ // *****************************************************
+ public int getStepCount() {
+ return size();
+ } // getStepCount
+
+ public int getCurrentStepIndex() {
+ return currentStepIdx + 1;
+ } // getCurrentStepIndex
+
+ public String getCurrentStep() {
+ return getStep(currentStepIdx);
+ } // getCurrentStep
+
+ public String getCurrentSubStep() {
+ return currentSubStep;
+ } // getCurrentSubStep
+
+ public boolean isInitialStep() {
+ return isInitialStep(currentStepIdx);
+ } // isInitialStep
+
+ public boolean isFinalStep() {
+ return isFinalStep(currentStepIdx);
+ } // isFinalStep
+
+ public void performAction(String action, ReportDefinition rdef) {
+ if (action.equals(AppConstants.WA_BACK))
+ if (currentSubStep.length() > 0)
+ currentSubStep = "";
+ else
+ currentStepIdx = getPrevStepIndex(currentStepIdx);
+ else if (action.equals(AppConstants.WA_NEXT)) {
+ if (currentSubStep.length() > 0)
+ currentSubStep = "";
+ else {
+ currentStepIdx = getNextStepIndex(currentStepIdx);
+ if (rdef != null)
+ if (!rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED))
+ if (getCurrentStep().equals(AppConstants.WS_TABLES)
+ && (rdef.getDataSourceList().getDataSource().size() == 0))
+ currentSubStep = AppConstants.WSS_ADD;
+ else if (getCurrentStep().equals(AppConstants.WS_COLUMNS)
+ && (rdef.getAllColumns().size() == 0))
+ currentSubStep = (rdef.getReportType().equals(
+ AppConstants.RT_CROSSTAB) ? AppConstants.WSS_ADD
+ : AppConstants.WSS_ADD_MULTI);
+ }
+ } else if (action.equals(AppConstants.WA_EDIT) || action.equals(AppConstants.WA_ADD)
+ || action.equals(AppConstants.WA_ADD_MULTI)
+ || action.equals(AppConstants.WA_ORDER_ALL)|| action.equals(AppConstants.WSS_ADD_BLANK) || action.equals(AppConstants.WA_MODIFY)) {
+ currentSubStep = action;
+ }
+ else if (currentSubStep.equals(AppConstants.WSS_ADD)
+ || currentSubStep.equals(AppConstants.WSS_EDIT))
+ currentSubStep = AppConstants.WSS_EDIT;
+ else
+ currentSubStep = "";
+ } // performAction
+
+ public void performGoToStep(String step) {
+ int stepIdx = getStepIndex(step);
+
+ if (stepIdx >= 0 && stepIdx < getStepCount()) {
+ currentStepIdx = stepIdx;
+ currentSubStep = "";
+ }
+ } // performGoToStep
+
+} // WizardSequence
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceCrossTab.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceCrossTab.java
new file mode 100644
index 00000000..2f16dcca
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceCrossTab.java
@@ -0,0 +1,43 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+
+public class WizardSequenceCrossTab extends WizardSequence {
+
+ public WizardSequenceCrossTab(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_TABLES);
+ add(AppConstants.WS_COLUMNS);
+ add(AppConstants.WS_FORM_FIELDS);
+ add(AppConstants.WS_FILTERS);
+ add(AppConstants.WS_JAVASCRIPT);
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceCrossTab
+
+} // WizardSequenceCrossTab
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceDashboard.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceDashboard.java
new file mode 100644
index 00000000..d883e27e
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceDashboard.java
@@ -0,0 +1,38 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+
+public class WizardSequenceDashboard extends WizardSequence {
+
+ public WizardSequenceDashboard(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceDashboard
+
+} // WizardSequenceDashboard
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceLinear.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceLinear.java
new file mode 100644
index 00000000..1ae4e8a6
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceLinear.java
@@ -0,0 +1,45 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+
+public class WizardSequenceLinear extends WizardSequence {
+
+ public WizardSequenceLinear(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_TABLES);
+ add(AppConstants.WS_COLUMNS);
+ add(AppConstants.WS_FORM_FIELDS);
+ add(AppConstants.WS_FILTERS);
+ add(AppConstants.WS_SORTING);
+ //add(AppConstants.WS_JAVASCRIPT);
+ //add(AppConstants.WS_CHART);
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceLinear
+
+} // WizardSequenceLinear
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java
new file mode 100644
index 00000000..663c30c9
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java
@@ -0,0 +1,42 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+
+public class WizardSequenceSQLBasedCrossTab extends WizardSequence {
+
+ public WizardSequenceSQLBasedCrossTab(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_SQL);
+ add(AppConstants.WS_COLUMNS);
+ add(AppConstants.WS_FORM_FIELDS);
+ add(AppConstants.WS_JAVASCRIPT);
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceSQLBasedCrossTab
+
+} // WizardSequenceSQLBasedCrossTab
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java
new file mode 100644
index 00000000..77996380
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java
@@ -0,0 +1,44 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+
+public class WizardSequenceSQLBasedHive extends WizardSequence {
+
+ public WizardSequenceSQLBasedHive(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_SQL);
+ add(AppConstants.WS_COLUMNS);
+ add(AppConstants.WS_FORM_FIELDS);
+ add(AppConstants.WS_JAVASCRIPT);
+ add(AppConstants.WS_CHART);
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_MAP);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceSQLBasedHive
+
+} // WizardSequenceSQLBasedHive
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java
new file mode 100644
index 00000000..eb90d3d6
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java
@@ -0,0 +1,45 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+
+public class WizardSequenceSQLBasedLinear extends WizardSequence {
+
+ public WizardSequenceSQLBasedLinear(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_SQL);
+ add(AppConstants.WS_COLUMNS);
+ add(AppConstants.WS_FORM_FIELDS);
+ //add(AppConstants.WS_JAVASCRIPT);
+ //if(!Globals.showAnimatedChartOnly())
+ //add(AppConstants.WS_CHART);
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_MAP);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceSQLBasedLinear
+
+} // WizardSequenceSQLBasedLinear
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java
new file mode 100644
index 00000000..e43bf288
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java
@@ -0,0 +1,44 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+
+public class WizardSequenceSQLBasedLinearDatamining extends WizardSequence {
+
+ public WizardSequenceSQLBasedLinearDatamining(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_SQL);
+ add(AppConstants.WS_COLUMNS);
+ add(AppConstants.WS_FORM_FIELDS);
+ add(AppConstants.WS_DATA_FORECASTING);
+ add(AppConstants.WS_JAVASCRIPT);
+ add(AppConstants.WS_CHART);
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceSQLBasedLinear
+
+} // WizardSequenceSQLBasedLinear
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorException.java
new file mode 100644
index 00000000..f0de41f8
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorException.java
@@ -0,0 +1,35 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.error;
+
+public class RaptorException extends Exception {
+
+ public RaptorException(String message) {
+ super(message);
+ }
+
+ public RaptorException(String message, Throwable ex) {
+ super(message, ex);
+ }
+
+ public RaptorException(Throwable ex) {
+ super(ex);
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorRuntimeException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorRuntimeException.java
new file mode 100644
index 00000000..98938f49
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorRuntimeException.java
@@ -0,0 +1,36 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.error;
+
+public class RaptorRuntimeException extends RaptorException {
+
+ public RaptorRuntimeException (String message) {
+ super(message);
+ }
+
+ public RaptorRuntimeException (String message, Throwable ex) {
+ super(message, ex);
+ }
+
+ public RaptorRuntimeException (Throwable ex) {
+ super(ex);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorSchedularException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorSchedularException.java
new file mode 100644
index 00000000..3339ba5f
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorSchedularException.java
@@ -0,0 +1,36 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.error;
+
+public class RaptorSchedularException extends RaptorException {
+
+ public RaptorSchedularException (String message) {
+ super(message);
+ }
+
+ public RaptorSchedularException (String message, Throwable ex) {
+ super(message, ex);
+ }
+
+ public RaptorSchedularException (Throwable ex) {
+ super(ex);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ReportSQLException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ReportSQLException.java
new file mode 100644
index 00000000..f78810ee
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ReportSQLException.java
@@ -0,0 +1,51 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.error;
+
+public class ReportSQLException extends RaptorException {
+ private String reportSQL = null;
+
+ public ReportSQLException(String message, String reportSQL) {
+ super(message);
+
+ this.reportSQL = reportSQL;
+ } // ReportSQLException
+
+ public ReportSQLException(String message, String reportSQL, Throwable ex) {
+ super(message, ex);
+
+ this.reportSQL = reportSQL;
+ } // ReportSQLException
+
+ public ReportSQLException(String message) {
+ super(message);
+ this.reportSQL = "";
+ } // ReportSQLException
+
+ public ReportSQLException(String message, Throwable ex) {
+ super(message, ex);
+ this.reportSQL = "";
+ } // ReportSQLException
+
+ public String getReportSQL() {
+ return reportSQL;
+ } // getReportSQL
+
+} // ReportSQLException
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserAccessException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserAccessException.java
new file mode 100644
index 00000000..ed88f5ff
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserAccessException.java
@@ -0,0 +1,34 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.error;
+
+public class UserAccessException extends RaptorRuntimeException {
+
+ public UserAccessException(Throwable ex) {
+ super(ex);
+ } // UserAccessException
+
+ public UserAccessException(String reportID, String userName, String accessType) {
+ //super("User " + userName + " does NOT have " + accessType + " permission for report "
+ // + reportID);
+ super("Access denied. Please contact Administrator");
+ } // UserAccessException
+
+} // UserAccessException
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserDefinedException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserDefinedException.java
new file mode 100644
index 00000000..31476bf6
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserDefinedException.java
@@ -0,0 +1,35 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+/**
+ *
+ */
+package org.openecomp.portalsdk.analytics.error;
+
+/**
+ * This class is exclusively used to print error messages to user.
+ *
+ */
+public class UserDefinedException extends RaptorRuntimeException {
+
+ public UserDefinedException(String message) {
+ super(message);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ValidationException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ValidationException.java
new file mode 100644
index 00000000..ee26abd0
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ValidationException.java
@@ -0,0 +1,42 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.error;
+
+public class ValidationException extends RaptorRuntimeException {
+ private String fieldID = null;
+
+ public ValidationException(String message) {
+ super(message);
+ }
+
+ public ValidationException(String message, Throwable ex) {
+ super(message, ex);
+ }
+
+ public ValidationException(String fieldID, String message) {
+ super(message);
+ this.fieldID = fieldID;
+ }
+
+ public String getFieldID() {
+ return fieldID;
+ }
+
+} // ValidationException
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/Line.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/Line.java
new file mode 100644
index 00000000..00445606
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/Line.java
@@ -0,0 +1,86 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.line;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.openecomp.portalsdk.analytics.gmap.map.NovaMap;
+
+public class Line {
+ private NovaMap map;
+ private LineCollection lineCollection;
+ private ArrayList<String> selectionList;
+ private Set<String> lineIDSet;
+
+ public Line(NovaMap map) {
+ this.map = map;
+ lineCollection = new LineCollection();
+ lineIDSet = new HashSet<String>();
+ selectionList = new ArrayList<String>();
+ }
+
+ public ArrayList<LineInfo> lineExist(Point2D screenPoint) {
+ ArrayList<LineInfo> existLineInfo = null;
+ String selectedLine = null;
+ String selectedType = null;
+ int nearest = -1;
+ int nodeSize = map.getShapeWidth();
+ nodeSize = nodeSize > 20 ? 20 : nodeSize;
+ int x0 = (int) screenPoint.getX();
+ int y0 = (int) screenPoint.getY();
+
+ ArrayList<LineInfo> lineInfos = lineCollection.getLineCollection();
+
+ for (LineInfo lineInfo : lineInfos) {
+ Point2D point1 = map.getScreenPointFromLonLat(lineInfo.geoCoordinate1.longitude, lineInfo.geoCoordinate1.latitude);
+ Point2D point2 = map.getScreenPointFromLonLat(lineInfo.geoCoordinate2.longitude, lineInfo.geoCoordinate2.latitude);
+ int x1 = (int) point1.getX();
+ int y1 = (int) point1.getY();
+ int x2 = (int) point2.getX();
+ int y2 = (int) point2.getY();
+ int diff = Math.abs((x0 - x1) * (y0 - y2) - (x0 - x2) * (y0 - y1));
+
+ if (((x1 - x0) * (x2 - x0) <= (nodeSize * 2)) && ((y1 - y0) * (y2 - y0) <= (nodeSize * 2)) &&
+ diff < (Math.abs(y1 - y2) + Math.abs(x1 - x2)) * (int) (nodeSize * .2)) {
+ if (nearest == -1) {
+ nearest = diff;
+ selectedLine = lineInfo.getLineID();
+ selectedType = lineInfo.getLineType();
+ }
+ else if (diff <= nearest) {
+ nearest = diff;
+ selectedLine = lineInfo.getLineID();
+ selectedType = lineInfo.getLineType();
+ }
+
+ if (existLineInfo == null) {
+ existLineInfo = new ArrayList<LineInfo>();
+ }
+
+ existLineInfo.add(lineInfo);
+ }
+ }
+
+ return existLineInfo;
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineCollection.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineCollection.java
new file mode 100644
index 00000000..249b277c
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineCollection.java
@@ -0,0 +1,158 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.line;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+
+public class LineCollection {
+ private Set<String> selectedLine; // all selected node
+ private String lineID; // last clicked node
+ private ArrayList<LineInfo> lineCollection;
+
+ public LineCollection() {
+ lineCollection = new ArrayList<LineInfo>(20000);
+ selectedLine = new HashSet<String>();
+ }
+
+ public void addSelectedLine(String lineID) {
+ selectedLine.add(lineID);
+ }
+
+ public void removeSelectedLine(String lineID) {
+ selectedLine.remove(lineID);
+ }
+
+ public Set<String> getSelectedLine() {
+ return selectedLine;
+ }
+
+ public boolean containSelectedLine(String lineID) {
+ return selectedLine.contains(lineID);
+ }
+
+ public void clearSelectedLine() {
+ selectedLine.clear();
+ }
+
+ public void addLine(LineInfo lineInfo) {
+ lineCollection.add(lineInfo);
+ }
+
+ public ArrayList<LineInfo> getLineCollection() {
+ return lineCollection;
+ }
+
+ public LineInfo getLine(String lineID) {
+ for (LineInfo lineInfo : lineCollection) {
+ if (lineInfo.getLineID().equalsIgnoreCase(lineID)) {
+ return lineInfo;
+ }
+ }
+
+ return null;
+ }
+
+ public LineInfo getLine(String lineID, String lineType) {
+ for (LineInfo lineInfo : lineCollection) {
+ if (lineInfo.getLineID().equalsIgnoreCase(lineID) && lineInfo.getLineType().equalsIgnoreCase(lineType)) {
+ return lineInfo;
+ }
+ }
+
+ return null;
+ }
+
+ public LineInfo getLine(String nodeID1, String nodeID2, boolean dummy) {
+ for (LineInfo lineInfo : lineCollection) {
+ if ((lineInfo.getNodeID1().equalsIgnoreCase(nodeID1) && lineInfo.getNodeID2().equalsIgnoreCase(nodeID2)) ||
+ (lineInfo.getNodeID1().equalsIgnoreCase(nodeID2) && lineInfo.getNodeID2().equalsIgnoreCase(nodeID1))) {
+ return lineInfo;
+ }
+ }
+
+ return null;
+ }
+
+ public LineInfo removeLine(String lineID) {
+ for (int i = 0; i < lineCollection.size(); i++) {
+ if (lineCollection.get(i).getLineID().equalsIgnoreCase(lineID)) {
+ return lineCollection.remove(i);
+ }
+ }
+
+ removeSelectedLine(lineID);
+ return null;
+ }
+
+ public LineInfo removeLine(String lineID, String lineType) {
+ for (int i = 0; i < lineCollection.size(); i++) {
+ if (lineCollection.get(i).getLineID().equalsIgnoreCase(lineID) &&
+ lineCollection.get(i).getLineType().equalsIgnoreCase(lineType)) {
+ return lineCollection.remove(i);
+ }
+ }
+
+ removeSelectedLine(lineID);
+ return null;
+ }
+
+ public void clearLine() {
+ lineCollection.clear();
+ selectedLine.clear();
+ }
+
+ public int getSize() {
+ return lineCollection.size();
+ }
+
+ public String getLineID() {
+ return lineID;
+ }
+
+ public void setLineID(String lineID) {
+ this.lineID = lineID;
+ }
+
+ public void clearAllCollection () {
+ clearLine();
+ clearSelectedLine();
+ this.lineID = null;
+ }
+
+ public String[] getWildCardLine(String lineID) {
+ ArrayList<String> list = new ArrayList<String>();
+
+ for (LineInfo lineInfo : lineCollection) {
+ if (lineInfo.getLineID().toLowerCase().indexOf(lineID.toLowerCase()) != -1) {
+ list.add(lineInfo.getLineID());
+ }
+ }
+
+ String[] result = new String[list.size()];
+
+ for (int i = 0; i < list.size(); i++) {
+ result[i] = list.get(i);
+ }
+
+ return result;
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineInfo.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineInfo.java
new file mode 100644
index 00000000..fd9ec94c
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineInfo.java
@@ -0,0 +1,190 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.line;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.openecomp.portalsdk.analytics.gmap.map.GeoCoordinate;
+
+public class LineInfo {
+ public GeoCoordinate geoCoordinate1;
+ public GeoCoordinate geoCoordinate2;
+
+ private String nodeID1;
+ private String nodeID2;
+
+ private String lineID;
+ private String lineType;
+ private String lineDescription;
+
+ private boolean moveable;
+ private boolean deleteable;
+
+ private int state;
+
+ private Map<String, String> lineAttributes;
+
+ public LineInfo(String nodeID1, String nodeID2) {
+ this.nodeID1 = nodeID1;
+ this.nodeID2 = nodeID2;
+ lineAttributes = new HashMap<String, String>();
+ }
+
+ public LineInfo clone() {
+ LineInfo lineInfo = new LineInfo(nodeID1, nodeID2);
+ lineInfo.geoCoordinate1.longitude = geoCoordinate1.longitude;
+ lineInfo.geoCoordinate1.latitude = geoCoordinate1.latitude;
+ lineInfo.geoCoordinate2.longitude = geoCoordinate2.longitude;
+ lineInfo.geoCoordinate2.latitude = geoCoordinate2.latitude;
+ lineInfo.setDescription(lineDescription);
+ lineInfo.setLineID(lineID);
+ lineInfo.setLineType(lineType);
+ lineInfo.setMoveable(moveable);
+ lineInfo.setDeleteable(deleteable);
+ lineInfo.setState(state);
+ lineInfo.initializeAttributes(lineAttributes);
+
+ return lineInfo;
+ }
+
+ public void setLineID(String lineID) {
+ this.lineID = lineID;
+ geoCoordinate1 = new GeoCoordinate();
+ geoCoordinate2 = new GeoCoordinate();
+ }
+
+ public String getLineID() {
+ return lineID;
+ }
+
+ public void setLineType(String lineType) {
+ this.lineType = lineType;
+ }
+
+ public String getLineType() {
+ return lineType;
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public void setState(int state) {
+ this.state = state;
+ }
+
+ public String getDescription() {
+ return lineDescription;
+ }
+
+ public void setDescription(String lineDescription) {
+ this.lineDescription = lineDescription;
+ }
+
+ public boolean isMoveable() {
+ return moveable;
+ }
+
+ public void setMoveable(boolean moveable) {
+ this.moveable = moveable;
+ }
+
+ public String getNodeID1() {
+ return nodeID1;
+ }
+
+ public void setNodeID1(String nodeID1) {
+ this.nodeID1 = nodeID1;
+ }
+
+ public String getNodeID2() {
+ return nodeID2;
+ }
+
+ public void setNodeID2(String nodeID2) {
+ this.nodeID2 = nodeID2;
+ }
+
+ public void initializeAttributes(Map<String, String> lineAttributes) {
+ this.lineAttributes.clear();
+ Set<String> keySet = lineAttributes.keySet();
+ Iterator<String> iter = keySet.iterator();
+
+ while (iter.hasNext()) {
+ String key = iter.next();
+ this.lineAttributes.put(key, lineAttributes.get(key));
+ }
+ }
+
+ public void setAttribute(String key, String value) {
+ lineAttributes.put(key, value);
+ }
+
+ public String getAttribute(String key) {
+ String value = lineAttributes.get(key);
+ return value;
+ }
+
+ public List<String> getAttributeKeys() {
+ Set<String> keySet = lineAttributes.keySet();
+ List<String> keys = new ArrayList<String>(keySet.size());
+ Iterator<String> iter = keySet.iterator();
+
+ while (iter.hasNext()) {
+ String key = iter.next();
+
+ if (key.indexOf("x_") != 0) {
+ keys.add(key);
+ }
+ }
+
+ return keys;
+ }
+
+ public List<String> getAttributeInternalKeys() {
+ Set<String> keySet = lineAttributes.keySet();
+ List<String> internalKeys = new ArrayList<String>();
+ Iterator<String> iter = keySet.iterator();
+
+ while (iter.hasNext()) {
+ String key = iter.next();
+
+ if (key.indexOf("x_") == 0) {
+ key = key.substring(2);
+ internalKeys.add(key);
+ }
+ }
+
+ return internalKeys;
+ }
+
+ public boolean isDeleteable() {
+ return deleteable;
+ }
+
+ public void setDeleteable(boolean deleteable) {
+ this.deleteable = deleteable;
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/ColorProperties.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/ColorProperties.java
new file mode 100644
index 00000000..a87af423
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/ColorProperties.java
@@ -0,0 +1,119 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.map;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ColorProperties {
+ private NovaMap map;
+
+ private Map<String, Object> colorProperties;
+ private ArrayList<String> nodeLegends;
+ private ArrayList<String> lineLegends;
+
+ public ColorProperties(NovaMap map) {
+ this.map = map;
+ colorProperties = new HashMap<String, Object>();
+ }
+
+ public void setColor(String type, String color) {
+ //colorProperties.put(type + "_COLOR", color);
+ String[] rgb = color.split(",");
+ colorProperties.put(type + "_COLOR",
+ new Color(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]),
+ Integer.parseInt(rgb[2])));
+ }
+
+// public void setColor(String type, int number, String color) {
+// Object object = colorProperties.get(type + ":" + number + "_COLOR");
+//
+// if (object != null) {
+// Color oldColor = (Color) object;
+//
+// if (!color.equals(oldColor.getRed() + "," + oldColor.getGreen() + "," + oldColor.getBlue())) {
+// String[] rgb = color.split(",");
+// colorProperties.put(type + ":" + number + "_COLOR",
+// new Color(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]),
+// Integer.parseInt(rgb[2])));
+// }
+// }
+// else {
+// String[] rgb = color.split(",");
+// colorProperties.put(type + ":" + number + "_COLOR",
+// new Color(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]),
+// Integer.parseInt(rgb[2])));
+// }
+// }
+
+// public Color getColor(String type, int number) {
+// return (Color) colorProperties.get(type + ":" + number + "_COLOR");
+// }
+
+ public Color getColor(String type) {
+ return (Color) colorProperties.get(type + "_COLOR");
+ }
+
+ public void setShape(String type, String shape) {
+ colorProperties.put(type + "_SHAPE", shape);
+ }
+
+ public void setShape(String type, int number, String shape) {
+ colorProperties.put(type + ":" + number + "_SHAPE", shape);
+ }
+
+ public String getShape(String type) {
+ return (String) colorProperties.get(type + "_SHAPE");
+ }
+
+ public String getShape(String type, int number) {
+ return (String) colorProperties.get(type + ":" + number + "_SHAPE");
+ }
+
+ public void setSize(String type, String size) {
+ colorProperties.put(type + "_SIZE", size);
+ }
+
+ public void setSize(String type, int number, String size) {
+ colorProperties.put(type + ":" + number + "_SIZE", size);
+ }
+
+ public int getSize(String type) {
+ Object object = colorProperties.get(type + "_SIZE");
+
+ if (object == null) {
+ return 0;
+ }
+
+ return Integer.parseInt(object.toString());
+ }
+
+ public int getSize(String type, int number) {
+ Object object = colorProperties.get(type + ":" + number + "_SIZE");
+
+ if (object == null) {
+ return 0;
+ }
+
+ return Integer.parseInt(object.toString());
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GMapProperties.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GMapProperties.java
new file mode 100644
index 00000000..7c66f4be
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GMapProperties.java
@@ -0,0 +1,46 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.map;
+
+import org.openecomp.portalsdk.analytics.system.Globals;
+
+public class GMapProperties {
+
+ public static String getProjectFolder() {
+ return Globals.getProjectFolder();
+ }
+
+ public static String getMarketShapefileFolder() {
+ return Globals.getMarketShapefileFolder();
+ }
+
+ public static String getTileSize() {
+ return Globals.getTileSize();
+ }
+
+ public static String getOutputFolder() {
+ return Globals.getOutputFolder();
+ }
+
+ public static String getTempFolderURL() {
+ return Globals.getTempFolderURL();
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GeoCoordinate.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GeoCoordinate.java
new file mode 100644
index 00000000..ed3fe8bd
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GeoCoordinate.java
@@ -0,0 +1,25 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.map;
+
+public class GeoCoordinate {
+ public double longitude;
+ public double latitude;
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/MapConstant.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/MapConstant.java
new file mode 100644
index 00000000..cef1f4ad
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/MapConstant.java
@@ -0,0 +1,44 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.map;
+
+public class MapConstant {
+ public static final String CURSOR = "CURSOR";
+ public static final String FILLED_TRIANGLE = "FILLED TRIANGLE";
+ public static final String FILLED_SQUARE = "FILLED SQUARE";
+ public static final String FILLED_CIRCLE = "FILLED CIRCLE";
+ public static final String FILLED_DIAMOND = "FILLED DIAMOND";
+ public static final String HOLLOW_TRIANGLE = "HOLLOW TRIANGLE";
+ public static final String HOLLOW_SQUARE = "HOLLOW SQUARE";
+ public static final String HOLLOW_CIRCLE = "HOLLOW CIRCLE";
+ public static final String HOLLOW_DIAMOND = "HOLLOW DIAMOND";
+
+ public static int NORMAL_STATE = 1;
+ public static int FORCE_STATE = 2;
+ public static int EXCLUDE_STATE = 3;
+ public static int ANY_STATE = 4;
+
+ public static int ZOOM_MIN = 1;
+ public static int ZOOM_MAX = 22;
+
+ public static final double ARROW_ANGLE_HIGH = .75;
+ public static final double ARROW_ANGLE_LOW = .45;
+ public static final double ZOOMING_INDEX = .6;
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/NovaMap.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/NovaMap.java
new file mode 100644
index 00000000..ba245064
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/NovaMap.java
@@ -0,0 +1,504 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.map;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.gmap.line.Line;
+import org.openecomp.portalsdk.analytics.gmap.line.LineInfo;
+import org.openecomp.portalsdk.analytics.gmap.map.layer.SwingLayer;
+import org.openecomp.portalsdk.analytics.gmap.node.Node;
+import org.openecomp.portalsdk.analytics.gmap.node.NodeInfo;
+
+public class NovaMap {
+ private static int[] shapeWidth;
+
+ public static final Font TEXT_FONT = new Font("sans-serif", Font.BOLD, 12);
+ public static final Font HEADER_FONT = new Font("sans-serif", Font.ITALIC+Font.BOLD, 12);
+
+ private HashSet<String> showList;
+ private ArrayList<SwingLayer> swingLayers;
+ private AffineTransform transform;
+
+ private Node node;
+ private Line line;
+ private ColorProperties colorProperties;
+
+ private Rectangle2D defaultBoundary;
+
+ private int zoomLevel;
+
+ private String currentYearMonth;
+
+ private String dataLoaded = "";
+
+ /**
+ * size in screen pixel
+ */
+ private Rectangle boundingBox;
+
+ /**
+ * size in pixel web mercator projection
+ */
+ private Rectangle2D mapArea;
+
+ /**
+ * size in longitude latitude
+ */
+ private Rectangle2D geoArea;
+
+ public static double[] meter2pixel;
+
+ private boolean showLegend = false;
+
+ static {
+ initShapeWidth();
+ initMeter2Pixel();
+ }
+
+ private static void initMeter2Pixel() {
+ meter2pixel = new double[MapConstant.ZOOM_MAX - MapConstant.ZOOM_MIN+1];
+ meter2pixel[0] = 156543.04/2;
+ for(int i=1; i<meter2pixel.length; ++i)
+ meter2pixel[i] = meter2pixel[i-1]/2;
+ }
+
+ private static void initShapeWidth() {
+ // ZOOM_MAX+1 is added to below line because of ArrayIndexOutOfException. This is Suggested by Hendra Tuty. - Sundar
+ shapeWidth = new int[MapConstant.ZOOM_MAX];
+ int width = 0;
+ for (int i = 0; i < shapeWidth.length; i++) {
+ if (i < 5) {
+
+ }
+ else if (i == 5) {
+ width = 4;
+ }
+ else if (i > 4 && i < 10) {
+ width += 2;
+ }
+ else {
+ width++;
+ }
+
+ shapeWidth[i] = width;
+ }
+ }
+
+ public NovaMap() {
+ boundingBox = new Rectangle();
+ mapArea = new Rectangle2D.Double();
+ geoArea = new Rectangle2D.Double();
+ showList = new HashSet<String>();
+ swingLayers = new ArrayList<SwingLayer>();
+ }
+
+
+
+ public int getBestZoomLevel(double Latitude1, double Longitude1,
+ double Latitude2, double Longitude2,
+ double height, double width) {
+
+ if (height==0)
+ height=700;
+ if (width==0)
+ width=1200;
+
+ double lat1 = Math.min(Latitude1, Latitude1);
+ double CosLat = Math.cos(Math.toRadians(lat1));
+ double Wmeter = getDistance(
+ lat1, Longitude1,
+ lat1, Longitude2)/CosLat;
+ double Hmeter = getDistance(
+ Latitude1, Longitude1,
+ Latitude2, Longitude1)/CosLat;
+
+ int zoom = 0;
+ if(Latitude1 == Latitude2 && Longitude1 == Longitude2)
+ zoom = 15;
+ if (zoom <= 0) {
+ for(;
+ zoom < meter2pixel.length
+ && (width*meter2pixel[zoom]) > Wmeter
+ && (height*meter2pixel[zoom]) > Hmeter;
+ ++zoom) ;
+ }
+
+// && (1200*meter2pixel[zoom]) > Wmeter
+// && (700*meter2pixel[zoom]) > Hmeter;
+
+ return zoom + MapConstant.ZOOM_MIN-1;
+ }
+
+ public static double getDistance(double Latitude1, double Longitude1,
+ double Latitude2, double Longitude2) {
+ Latitude1 = Math.toRadians(Latitude1);
+ Longitude1 = Math.toRadians(Longitude1);
+ Latitude2 = Math.toRadians(Latitude2);
+ Longitude2 = Math.toRadians(Longitude2);
+
+ final double R = 6371.0; // earth's mean radius in km
+ double dSinLat05 = Math.sin( (Latitude2 - Latitude1)/2 );
+ double dSinLong05 = Math.sin( (Longitude2 - Longitude1)/2 );
+ double a = dSinLat05 * dSinLat05 +
+ Math.cos(Latitude1) * Math.cos(Latitude2) * dSinLong05 * dSinLong05;
+ double c = (0==a || 1==a)
+ ? 0
+ : 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1.0-a));
+ return R * c * 1000.0; //in meters
+ }
+
+ public Rectangle getBoundingBox() {
+ return boundingBox;
+ }
+
+ public void setBoundingBox(int width, int height) {
+ boundingBox.setSize(width, height);
+ }
+
+ public void setNode(Node node) {
+ this.node = node;
+ }
+
+ public Node getNode() {
+ return node;
+ }
+
+ public void setLine(Line line) {
+ this.line = line;
+ }
+
+ public Line getLine() {
+ return line;
+ }
+
+ public void setColorProperties(ColorProperties colorProperties) {
+ this.colorProperties = colorProperties;
+ }
+
+ public ColorProperties getColorProperties() {
+ return colorProperties;
+ }
+
+ public void setZoomLevel(int zoomLevel) {
+ this.zoomLevel = zoomLevel;
+ }
+
+ public int getZoomLevel() {
+ return zoomLevel;
+ }
+
+ public void addShowList(String type) {
+ showList.add(type.toUpperCase());
+ }
+
+ public void addShowList(String type, int number) {
+ showList.add(type.toUpperCase() + ":" + number);
+ }
+
+ public void removeShowList(String type) {
+ showList.remove(type.toUpperCase());
+ }
+
+ public void removeShowList(String type, int number) {
+ showList.remove(type.toUpperCase() + ":" + number);
+ }
+
+ public void clearShowList() {
+ showList.clear();
+ }
+
+ public HashSet getShowList() {
+ return showList;
+ }
+
+ public boolean containsShowList(String type) {
+ return showList.contains(type.toUpperCase());
+ }
+
+ public boolean containsShowList(String type, int number) {
+ return showList.contains(type.toUpperCase() + ":" + number);
+ }
+
+ public int getShowListSize() {
+ return showList.size();
+ }
+
+ public void addSwingLayer(SwingLayer swingLayer) {
+ swingLayers.add(swingLayer);
+ }
+
+ public void removeSwingLayer(SwingLayer swingLayer) {
+ swingLayers.remove(swingLayer);
+ }
+
+ public void clearSwingLayers() {
+ swingLayers.clear();
+ }
+
+ public ArrayList<SwingLayer> getSwingLayers() {
+ return swingLayers;
+ }
+
+ public int getShapeWidth() {
+ return shapeWidth[getZoomLevel()>=22?21:(getZoomLevel()<=8 ? 8:getZoomLevel())];
+ }
+
+ public Point2D getPixelPos(double latitude, double longitude) {
+ double sinLatitude = Math.sin(Math.toRadians(latitude));
+ return new Point2D.Double(
+ ((longitude + 180.0) / 360.0) * 256.0 * (1<<zoomLevel),
+ ( 0.5 - Math.log((1.0+sinLatitude)/(1.0-sinLatitude))
+ /(4.0*Math.PI) )*256.0*(1<<zoomLevel)
+ );
+ }
+
+ private boolean checkTransform(Rectangle2D geoArea) {
+ System.out.println("%%%%%%map.checkTransform start");
+ if (!this.geoArea.equals(geoArea)) {
+ Point2D point1 = getPixelPos(geoArea.getMinY(), geoArea.getMinX());
+ Point2D point2 = getPixelPos(geoArea.getMaxY(), geoArea.getMaxX());
+ mapArea.setRect(point1.getX(), point2.getY(),
+ boundingBox.getWidth(), boundingBox.getHeight());
+ this.geoArea.setRect(geoArea);
+ resetTransform(boundingBox, mapArea);
+ System.out.println("%%%%%%map.checkTransform end 1");
+ return true;
+ }
+
+ System.out.println("%%%%%%map.checkTransform end 2");
+ return false;
+ }
+
+ private void resetTransform(Rectangle boundingBox, Rectangle2D mapArea) {
+ System.out.println("%%%%%%map.resetTransform start");
+ if (mapArea == null || boundingBox.getWidth() == 0 || boundingBox.getHeight() == 0 ) {
+ System.out.println("%%%%%%map.resetTransform end 1");
+ return;
+ }
+
+ transform = new AffineTransform(mapArea.getWidth() / boundingBox.getWidth(),
+ 0.0, 0.0, mapArea.getHeight() / boundingBox.getHeight(),
+ mapArea.getMinX(), mapArea.getMinY());
+ System.out.println("%%%%%%map.resetTransform end 2");
+ }
+
+ protected AffineTransform getTransform() {
+ if (transform != null) {
+ return new AffineTransform(transform);
+ }
+
+ return null;
+ }
+
+ public Point2D getScreenPointFromPixel(double xPixel, double yPixel) {
+ try {
+ return getTransform().inverseTransform(new Point2D.Double(xPixel, yPixel), null);
+ } catch (NoninvertibleTransformException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ public Point2D getScreenPointFromLonLat(double longitude, double latitude) {
+ Point2D point = getPixelPos(latitude, longitude);
+ return getScreenPointFromPixel(point.getX(), point.getY());
+ }
+
+ public Point2D getLonLatFromPixel(int x1, int y1) {
+ double x = (double) x1 / 256;
+ double y = (double) y1 / 256;
+ double lon = -180; // x
+ double lonWidth = 360; // width 360
+
+ //double lat = -90; // y
+ //double latHeight = 180; // height 180
+ double lat = -1;
+ double latHeight = 2;
+
+ int tilesAtThisZoom = 1 << getZoomLevel();
+ lonWidth = 360.0 / tilesAtThisZoom;
+ lon = -180 + (x * lonWidth);
+ latHeight = -2.0 / tilesAtThisZoom;
+ lat = 1 + (y * latHeight);
+
+ // convert lat and latHeight to degrees in a transverse mercator projection
+ // note that in fact the coordinates go from about -85 to +85 not -90 to 90!
+ latHeight += lat;
+ latHeight = (2 * Math.atan(Math.exp(Math.PI * latHeight))) - (Math.PI / 2);
+ latHeight *= (180 / Math.PI);
+
+ lat = (2 * Math.atan(Math.exp(Math.PI * lat))) - (Math.PI / 2);
+ lat *= (180 / Math.PI);
+
+ latHeight -= lat;
+
+ if (lonWidth < 0) {
+ lon = lon + lonWidth;
+ lonWidth = -lonWidth;
+ }
+
+ if (latHeight < 0) {
+ lat = lat + latHeight;
+ latHeight = -latHeight;
+ }
+
+ return new Point2D.Double(lon, lat + latHeight);
+ }
+
+ public ArrayList getImage(final HttpServletRequest request, Rectangle2D geoArea) {
+ Object showListArr[] = ((HashSet)getShowList()).toArray();
+ BufferedImage image = new BufferedImage(boundingBox.width, boundingBox.height, BufferedImage.TYPE_INT_ARGB);
+ final Graphics2D g2d = image.createGraphics();
+ // LEGEND INFO
+ BufferedImage legendImage = null;
+ Graphics2D g2Legend = null;
+ if(showLegend) {
+ legendImage = new BufferedImage(boundingBox.width, (int)(20*showListArr.length) + 20, BufferedImage.TYPE_INT_ARGB);
+ g2Legend = legendImage.createGraphics();
+ g2Legend.setBackground(Color.WHITE);
+ }
+
+ checkTransform(geoArea);
+
+ boolean shapefileLayerPainted = false;
+ boolean swingLayerPainted = false;
+
+ Object object = request.getAttribute("server_process_interrupted");
+ if (object != null && ((Boolean) object)) {
+ System.out.println("interrupted");
+ g2d.dispose();
+ return null;
+ }
+
+ for (SwingLayer layer : swingLayers) {
+ swingLayerPainted = swingLayerPainted || layer.paintLayer(request, g2d, boundingBox, mapArea, g2Legend);
+ }
+
+ ArrayList imageArr = new ArrayList();
+ //if(showLegend) layer.paintLegend(g2Legend);
+
+ g2d.dispose();
+ if(showLegend)
+ g2Legend.dispose();
+ object = request.getAttribute("server_process_interrupted");
+
+ if (object != null && ((Boolean) object)) {
+ System.out.println("interrupted");
+ return imageArr;
+ }
+ else if (!shapefileLayerPainted && !swingLayerPainted) {
+ System.out.println("not painted");
+ return imageArr;
+ }
+
+ imageArr.add(image);
+ if(g2Legend!=null) {
+ imageArr.add(legendImage);
+ }
+ return imageArr;
+ }
+
+ public Object singleLeftClick(double longitude, double latitude, Rectangle2D geoArea) {
+ System.out.println("%%%%%%map.singleLeftClick start");
+ System.out.println("%%%%%%map.singleLeftClick check transform start");
+ checkTransform(geoArea);
+ System.out.println("%%%%%%map.singleLeftClick check transform end");
+ Point2D screenPoint = getScreenPointFromLonLat(longitude, latitude);
+ System.out.println("%%%%%%map.singleLeftClick getting nodeExist array ");
+ ArrayList<NodeInfo> existNodeInfo = node.nodeExist(screenPoint);
+
+ if (existNodeInfo == null) {
+ ArrayList<LineInfo> existLineInfo = line.lineExist(screenPoint);
+
+ if (existLineInfo == null) {
+
+ }
+ else {
+ System.out.println("%%%%%%map.singleLeftClick end 1");
+ return existLineInfo;
+ }
+ }
+ else {
+// if (existNodeInfo.size() == 1) {
+// NodeInfo nodeInfo = existNodeInfo.get(0);
+// node.getNodeCollection().clearSelectedNode();
+// node.getNodeCollection().addSelectedNode(nodeInfo.getID(), nodeInfo.getLegendID());
+// return getSelectedImage(geoArea);
+// }
+// else {
+// return existNodeInfo;
+// }
+
+ System.out.println("%%%%%%map.singleLeftClick end 2");
+ return existNodeInfo;
+ }
+
+ System.out.println("%%%%%%map.singleLeftClick end 3");
+ return null;
+ }
+
+ public String getCurrentYearMonth() {
+ return currentYearMonth;
+ }
+
+ public void setCurrentYearMonth(String currentYearMonth) {
+ this.currentYearMonth = currentYearMonth;
+ }
+
+ public Rectangle2D getDefaultBoundary() {
+ return defaultBoundary;
+ }
+
+ public void setDefaultBoundary(Rectangle2D defaultBoundary) {
+ this.defaultBoundary = defaultBoundary;
+ }
+
+ public boolean isShowLegend() {
+ return showLegend;
+ }
+
+ public void setShowLegend(boolean showLegend) {
+ this.showLegend = showLegend;
+ }
+
+ public String getDataLoaded() {
+ return dataLoaded;
+ }
+
+ public void setDataLoaded(String dataLoaded) {
+ this.dataLoaded = dataLoaded;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/layer/SwingLayer.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/layer/SwingLayer.java
new file mode 100644
index 00000000..f5237ccf
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/layer/SwingLayer.java
@@ -0,0 +1,234 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.map.layer;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.Stroke;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.gmap.map.ColorProperties;
+import org.openecomp.portalsdk.analytics.gmap.map.MapConstant;
+import org.openecomp.portalsdk.analytics.gmap.map.NovaMap;
+import org.openecomp.portalsdk.analytics.gmap.node.Node;
+import org.openecomp.portalsdk.analytics.gmap.node.NodeInfo;
+import org.openecomp.portalsdk.analytics.system.Globals;
+
+
+public class SwingLayer {
+ private Rectangle shape;
+ private NovaMap map;
+
+ public SwingLayer(NovaMap map) {
+ this.map = map;
+ }
+
+ public boolean paintLayer(HttpServletRequest request, Graphics2D g2d, Rectangle bounds, Rectangle2D mapArea, Graphics2D g2Legend) {
+ return paintNodes(request, g2d, bounds, mapArea, g2Legend);
+ }
+
+ protected boolean paintNodes(HttpServletRequest request, Graphics2D g2d, Rectangle bounds, Rectangle2D mapArea, Graphics2D g2Legend) {
+ boolean painted = false;
+ Node node = map.getNode();
+ ColorProperties colorProperties = map.getColorProperties();
+ int legendSize = 0;
+ if(map.isShowLegend())
+ legendSize = map.getShowListSize();
+ Object showListArr[] = ((HashSet)map.getShowList()).toArray();
+ HashMap<String,NodeInfo> hashMap = node.getNodeCollection().getNodeCollection();
+ Set set = hashMap.entrySet();
+ int width = map.getShapeWidth();
+ ArrayList<String> visibleLabel = new ArrayList<String>(151);
+ Color oldColor = g2d.getColor();
+ Stroke oldStroke = g2d.getStroke();
+ int textWidth = 0;
+ int legendLength = 0;
+ for (int i = 0; i < showListArr.length; i++) {
+ legendLength = ((String)showListArr[i]).length();
+ if(legendLength > textWidth) textWidth = legendLength;
+ }
+ Point2D point = null;
+ for (Iterator iterator = set.iterator(); iterator.hasNext();) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ NodeInfo nodeInfo = (NodeInfo) entry.getValue();
+
+ String id1 = (String) request.getAttribute("server_process_id");
+ String id2 = (String) request.getSession().getAttribute("server_process_id");
+
+ if (!id1.equals(id2)) {
+ request.setAttribute("server_process_interrupted", true);
+ System.out.println("swing layer interrupted");
+ return false;
+ }
+ //System.out.println("%%%%%%%getImage. no of T1%%%%%%" + nodeInfo.getAttribute("x_sequence"));
+
+
+ point = map.getPixelPos(nodeInfo.geoCoordinate.latitude, nodeInfo.geoCoordinate.longitude);
+
+ if (!mapArea.contains(point.getX(), point.getY())) {
+ continue;
+ }
+
+ painted = true;
+
+ g2d.setColor(colorProperties.getColor(nodeInfo.getNodeType()));
+
+ Point2D xyPoint = map.getScreenPointFromPixel(point.getX(), point.getY());
+ int width2 = (colorProperties.getSize(nodeInfo.getNodeType()) * width) / 5;
+
+ if (shape == null) {
+ shape = new Rectangle((int) xyPoint.getX(), (int) xyPoint.getY(), width2, width2);
+ }
+ else {
+ shape.setRect((int) xyPoint.getX(), (int) xyPoint.getY(), width2, width2);
+ }
+
+ if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.FILLED_SQUARE)) {
+ g2d.fillRect((int) shape.getCenterX() - width2, (int) shape.getCenterY() - width2, width2, width2);
+ }
+ else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.HOLLOW_SQUARE)) {
+ g2d.drawRect((int) shape.getCenterX() - width2, (int) shape.getCenterY() - width2, width2, width2);
+ }
+ else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.FILLED_CIRCLE)) {
+ g2d.fillOval((int) shape.getCenterX() - width2, (int) shape.getCenterY() - width2, width2, width2);
+ }
+ else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.HOLLOW_CIRCLE)) {
+ g2d.drawOval((int) shape.getCenterX() - width2, (int) shape.getCenterY() - width2, width2, width2);
+ }
+ else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.FILLED_TRIANGLE)) {
+ int[] xPoints = {(int) shape.getX(), (int) shape.getX() - width2 / 2, (int) shape.getX() + width2 / 2};
+ int[] yPoints = {(int) shape.getY() + width2 / 2, (int) shape.getY() - width2 / 2, (int) shape.getY() - width2 / 2};
+ g2d.fillPolygon(xPoints, yPoints, xPoints.length);
+ }
+ else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.HOLLOW_TRIANGLE)) {
+ int[] xPoints = {(int) shape.getX(), (int) shape.getX() - width2 / 2, (int) shape.getX() + width2 / 2};
+ int[] yPoints = {(int) shape.getY() + width2 / 2, (int) shape.getY() - width2 / 2, (int) shape.getY() - width2 / 2};
+ g2d.drawPolygon(xPoints, yPoints, xPoints.length);
+ }
+ else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.FILLED_DIAMOND)) {
+ int[] xPoints = {(int) shape.getX() - width2 / 2, (int) shape.getX(), (int) shape.getX() + width2 / 2, (int) shape.getX()};
+ int[] yPoints = {(int) shape.getY() , (int) shape.getY() - width2 / 2, (int) shape.getY(), (int) shape.getY() + width2 / 2};
+ g2d.fillPolygon(xPoints, yPoints, xPoints.length);
+ }
+ else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.HOLLOW_DIAMOND)) {
+ int[] xPoints = {(int) shape.getX() - width2 / 2, (int) shape.getX(), (int) shape.getX() + width2 / 2, (int) shape.getX()};
+ int[] yPoints = {(int) shape.getY() , (int) shape.getY() - width2 / 2, (int) shape.getY(), (int) shape.getY() + width2 / 2};
+ g2d.drawPolygon(xPoints, yPoints, xPoints.length);
+ } else {
+ g2d.drawRect((int) shape.getCenterX() - width2, (int) shape.getCenterY() - width2, width2, width2);
+ }
+
+ if (nodeInfo.isMoveable()) {
+ int fontSize = width / 2;
+ fontSize = fontSize > 14 ? 14 : fontSize;
+ fontSize = (colorProperties.getSize(nodeInfo.getNodeType()) * fontSize) / 5;
+ Font font = new Font("sans-serif", Font.BOLD, fontSize);
+ g2d.setFont(font);
+ g2d.setColor(Color.BLACK);
+ g2d.drawString("M", shape.x + width2 / 2, shape.y);
+ }
+
+// if (map.containsShowLabelList(nodeInfo.getNodeType())) {
+// g2d.setColor(Color.BLACK);
+// FontMetrics metrics = g2d.getFontMetrics();
+// int x = shape.x - metrics.stringWidth(nodeInfo.getID()) / 2;
+// int y = shape.y + width2 * 4 / 3;
+// g2d.drawString(nodeInfo.getID(), x, y);
+// }
+ }
+ String legendName = "";
+ int baseY = 0;
+ baseY = (int)(20*showListArr.length) + 20;//+5;
+ int baseX = 0;
+ if(map.isShowLegend()) {
+ for (int i = showListArr.length-1; i>=0; i--) {
+
+ legendName = (String)showListArr[i];
+ //for(int i = 0; i < showListArr.length; i++ ) {
+ if(i == showListArr.length-1){
+ textWidth = (textWidth<="Legend".length())?"Legend".length():textWidth;
+ g2Legend.setColor(Color.WHITE);
+ //g2d.draw(new Rectangle2D.Double((int) bounds.getMaxX()*0.1, (int) bounds.getMaxY()*0.75*showListArr.length, (int) bounds.getMaxX()*0.75, (int) bounds.getMaxY()*0.75));
+ g2Legend.fill3DRect((int)(0), (int)(0), (int) bounds.getWidth() , (int)(baseY) , true); // (int)(bounds.getMaxX()*0.9)- (int)(bounds.getMaxX()*0.25)
+ //if(i == 0){
+ g2Legend.setColor(Color.BLACK);
+ g2Legend.setFont(NovaMap.HEADER_FONT);
+ g2Legend.drawString("Legend", (int) (10), 10);
+ }
+ int[] xPointsL = {(int) (10 - width / 2), (int) (10), (int) (10 + width/2), (int) (10)};
+ int[] yPointsL = {(int) (15*i+5+20), (int) (15*i+5+20 - width / 2), (int) (15*i+5+20), (int) (15*i+5+20 + width / 2)};
+ g2Legend.setColor(colorProperties.getColor( ((String)showListArr[i]).toUpperCase()));
+ g2Legend.fillPolygon(xPointsL, yPointsL, xPointsL.length);
+ g2Legend.setFont(NovaMap.TEXT_FONT);
+ g2Legend.setColor(Color.BLACK);
+
+ g2Legend.drawString(legendName.substring(0, legendName.indexOf("-")), (int) (10) + width+10, (int) (15*i)+10+20);
+ }
+ }
+
+/* g2d.drawString("0", (int) bounds.getMaxX()/2+20 + width+10, 0);
+ g2d.drawString("50", (int) bounds.getMaxX()/2+20 + width+10, 50);
+ g2d.drawString("100", (int) bounds.getMaxX()/2+20 + width+10, 100);
+ g2d.drawString("200", (int) bounds.getMaxX()/2+20 + width+10, 200);
+ g2d.drawString("400", (int) bounds.getMaxX()/2+20 + width+10, 400);
+ g2d.drawString("600", (int) bounds.getMaxX()/2+20 + width+10, 600);
+*/
+// g2d.setFont(NovaMap.TEXT_FONT);
+// g2d.setColor(Color.BLACK);
+ if(nvl(map.getDataLoaded()).trim().length() > 0) {
+ g2d.setColor(Color.WHITE);
+ g2d.fill3DRect(new Double(bounds.getMinX()).intValue(), new Double(bounds.getMaxY()).intValue()-30, (int) bounds.getWidth() , (int)(30) , true); // (int)(bounds.getMaxX()*0.9)- (int)(bounds.getMaxX()*0.25)
+ g2d.setColor(Color.RED);
+ g2d.setFont(NovaMap.HEADER_FONT);
+ g2d.drawString(Globals.getUserDefinedMessageForMemoryLimitReached() + " "+ map.getDataLoaded()+ " were downloaded to Map.", new Double(bounds.getMinX()).intValue()+80, new Double(bounds.getMaxY()).intValue()-15);
+ }
+
+ //g2d.drawString("Hello", new Double(bounds.getMinX()).intValue()+20, new Double(bounds.getMaxY()).intValue()-50);
+ FontMetrics metrics = g2d.getFontMetrics();
+
+ for (int i = 0; i < visibleLabel.size(); i++) {
+ String[] properties = visibleLabel.get(i).split(">>>");
+ int x = Integer.parseInt(properties[1]) - metrics.stringWidth(properties[0]) / 2;
+ int y = Integer.parseInt(properties[2]) + Integer.parseInt(properties[3]) * 4 / 3;
+ g2d.drawString(properties[0], x, y);
+ }
+
+ g2d.setColor(oldColor);
+ g2d.setStroke(oldStroke);
+
+ return painted;
+ }
+
+ private String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/Node.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/Node.java
new file mode 100644
index 00000000..a58eb458
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/Node.java
@@ -0,0 +1,178 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.node;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.openecomp.portalsdk.analytics.gmap.map.MapConstant;
+import org.openecomp.portalsdk.analytics.gmap.map.NovaMap;
+
+public class Node {
+ private Set<String> nodeIDSet;
+ private NodeCollection nodeCollection;
+ private ArrayList<String> selectionList;
+ private NovaMap map;
+
+ public Node(NovaMap map) {
+ this.map = map;
+ nodeCollection = new NodeCollection();
+ nodeIDSet = new HashSet<String>();
+ selectionList = new ArrayList<String>();
+ }
+
+ public NodeInfo addNode(double longitude, double latitude, String nodeType, String nodeID,
+ String nodeAttributes, int state, boolean moveable, boolean deleteable) {
+ NodeInfo nodeInfo = new NodeInfo(nodeID);
+ nodeInfo.geoCoordinate.longitude = longitude;
+ nodeInfo.geoCoordinate.latitude = latitude;
+ nodeInfo.setNodeType(nodeType);
+ nodeInfo.setState(state);
+ nodeInfo.setMoveable(moveable);
+ nodeInfo.setDeleteable(deleteable);
+ nodeInfo.initializeAttributes(nodeAttributes);
+
+ //if (nodeCollection.getNode(nodeInfo.getNodeID()+""+nodeInfo.getNodeType()) == null) {
+ nodeCollection.addNode(nodeInfo);
+ nodeIDSet.add(nodeID);
+/* }
+ else {
+ return nodeCollection.getNode(nodeType);
+ }
+*/
+ return nodeInfo;
+ }
+
+ /**
+ *
+ */
+/* public void updateNumberT1(String currentYearMonth) {
+ ArrayList<NodeInfo> nodeCollection = this.nodeCollection.getNodeCollection();
+
+ for (NodeInfo nodeInfo : nodeCollection) {
+ nodeInfo.setAttribute(NodeInfo.NUMBER_OF_T1_KEY, nodeInfo.getAttribute(currentYearMonth));
+ }
+ }
+*/
+/* public Set<Integer> getUniqueNumberT1(String currentYearMonth) {
+ ArrayList<NodeInfo> nodeCollection = this.nodeCollection.getNodeCollection();
+ Set<Integer> numberT1Set = new TreeSet<Integer>();
+
+ for (NodeInfo nodeInfo : nodeCollection) {
+ numberT1Set.add(Integer.parseInt(nodeInfo.getAttribute(currentYearMonth).toString()));
+ }
+
+ return numberT1Set;
+ }
+*/
+ public void updateNumberT1(String currentYearMonth) {
+ HashMap<String,NodeInfo> hashMap = this.nodeCollection.getNodeCollection();
+ Set set = hashMap.entrySet();
+
+ for (Iterator iterator = set.iterator(); iterator.hasNext();) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ NodeInfo nodeInfo = (NodeInfo) entry.getValue();
+ nodeInfo.setAttribute(NodeInfo.NUMBER_OF_T1_KEY, nodeInfo.getAttribute(currentYearMonth));
+ }
+
+ }
+
+ public Set<Integer> getUniqueNumberT1(String currentYearMonth) {
+ HashMap<String,NodeInfo> hashMap = this.nodeCollection.getNodeCollection();
+ Set set = hashMap.entrySet();
+ Set<Integer> numberT1Set = new TreeSet<Integer>();
+
+ for (Iterator iterator = set.iterator(); iterator.hasNext();) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ NodeInfo nodeInfo = (NodeInfo) entry.getValue();
+ numberT1Set.add(Integer.parseInt(nodeInfo.getAttribute(currentYearMonth).toString()));
+ }
+
+ return numberT1Set;
+ }
+
+ /**
+ *
+ * @param screenPoint
+ * @return list of NodeInfo within screenPoint. If not found, null is return
+ */
+ public ArrayList<NodeInfo> nodeExist(Point2D screenPoint) {
+ ArrayList<NodeInfo> existNodeInfo = null;
+ int nearest = 9999;
+ String selectedNode = null;
+ String selectedType = null;
+ int nodeSize = map.getShapeWidth();
+ HashMap<String,NodeInfo> hashMap = nodeCollection.getNodeCollection();
+ Set set = hashMap.entrySet();
+ //ArrayList<NodeInfo> list = nodeCollection.getNodeCollection();
+
+ for (Iterator iterator = set.iterator(); iterator.hasNext();) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ NodeInfo nodeInfo = (NodeInfo) entry.getValue();
+
+ if (!map.containsShowList(nodeInfo.getNodeType())) {
+ continue;
+ }
+
+ int width = (map.getColorProperties().getSize(nodeInfo.getNodeType()) * nodeSize) / 5;
+ int foundFactor = (int) (MapConstant.ZOOMING_INDEX * width);
+ Point2D nodePoint = map.getScreenPointFromLonLat(nodeInfo.geoCoordinate.longitude,
+ nodeInfo.geoCoordinate.latitude);
+
+ int lonDiff = (int) Math.abs(screenPoint.getX() - nodePoint.getX());
+ int latDiff = (int) Math.abs(screenPoint.getY() - nodePoint.getY());
+
+ if (lonDiff < foundFactor && latDiff < foundFactor) {
+ if (lonDiff < nearest) {
+ nearest = lonDiff;
+ selectedNode = nodeInfo.getNodeID();
+ selectedType = nodeInfo.getNodeType();
+ nodeCollection.setNodeID(selectedNode);
+ }
+
+ if (existNodeInfo == null) {
+ existNodeInfo = new ArrayList<NodeInfo>();
+ }
+
+ existNodeInfo.add(nodeInfo);
+ }
+ }
+
+ return existNodeInfo;
+ }
+
+ public NodeCollection getNodeCollection() {
+ return nodeCollection;
+ }
+
+ public void clearNodeIDSet() {
+ nodeIDSet.clear();
+ }
+
+ public void clearSelectionList() {
+ selectionList.clear();
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeCollection.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeCollection.java
new file mode 100644
index 00000000..35801a4d
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeCollection.java
@@ -0,0 +1,188 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.node;
+
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+public class NodeCollection {
+ private Set<String> selectedNode; // all selected node
+ private String nodeID; // last clicked node
+ private HashMap<String,NodeInfo> nodeCollection;
+
+ public NodeCollection() {
+ selectedNode = new HashSet<String>();
+ nodeCollection = new HashMap<String,NodeInfo>(20000);
+ }
+
+ public void addSelectedNode(String nodeID) {
+ selectedNode.add(nodeID);
+ }
+
+ public void removeSelectedNode(String nodeID) {
+ selectedNode.remove(nodeID);
+ }
+
+ public boolean containSelectedNode(String nodeID) {
+ return selectedNode.contains(nodeID);
+ }
+
+ public void addSelectedNode(String nodeID, String nodeType) {
+ selectedNode.add(nodeID + ">>" + nodeType);
+ }
+
+ public void removeSelectedNode(String nodeID, String nodeType) {
+ selectedNode.remove(nodeID + ">>" + nodeType);
+ }
+
+ public void clearSelectedNode() {
+ selectedNode.clear();
+ }
+
+ public boolean containSelectedNode(String nodeID, String nodeType) {
+ return selectedNode.contains(nodeID + ">>" + nodeType);
+ }
+
+ public Set<String> getSelectedNode() {
+ return selectedNode;
+ }
+
+ public void addNode(NodeInfo nodeInfo) {
+ if (nodeInfo == null) {
+ System.out.println("nodeInfo is null");
+ }
+ nodeCollection.put(nodeInfo.getNodeID()+""+nodeInfo.getNodeType(), nodeInfo);
+ }
+
+ public HashMap<String,NodeInfo> getNodeCollection() {
+ return nodeCollection;
+ }
+
+/* public NodeInfo getNode(String nodeID) {
+ for (NodeInfo nodeInfo : nodeCollection) {
+ if (nodeInfo.getNodeID().equalsIgnoreCase(nodeID) ) {
+ return nodeInfo;
+ }
+ }
+
+ return null;
+ }
+*/
+/* public NodeInfo getNode(String nodeID, String nodeType) {
+ for (NodeInfo nodeInfo : nodeCollection) {
+ if (nodeInfo.getNodeID().equalsIgnoreCase(nodeID) && nodeInfo.getNodeType().equalsIgnoreCase(nodeType)) {
+ return nodeInfo;
+ }
+ }
+
+ return null;
+ }
+*/
+ public NodeInfo getNode(String nodeType) {
+ return (NodeInfo)nodeCollection.get(nodeType);
+ }
+/* public ArrayList<NodeInfo> getWildCardNode(String nodeID, String nodeType) {
+ ArrayList<NodeInfo> list = new ArrayList<NodeInfo>();
+
+ for (NodeInfo nodeInfo : nodeCollection) {
+ if (nodeInfo.getNodeType().equalsIgnoreCase(nodeType) &&
+ nodeInfo.getNodeID().toLowerCase().indexOf(nodeID.toLowerCase()) != -1) {
+ list.add(nodeInfo);
+ }
+ }
+
+ return list;
+ }*/
+
+/* public NodeInfo removeNode(String nodeID) {
+ for (int i = 0; i < nodeCollection.size(); i++) {
+ if (nodeCollection.get(i).getNodeID().equalsIgnoreCase(nodeID)) {
+ return nodeCollection.remove(i);
+ }
+ }
+
+ removeSelectedNode(nodeID);
+ return null;
+ }
+
+ public NodeInfo removeNode(String nodeID, String nodeType) {
+ for (int i = 0; i < nodeCollection.size(); i++) {
+ if (nodeCollection.get(i).getNodeID().equalsIgnoreCase(nodeID) &&
+ nodeCollection.get(i).getNodeType().equalsIgnoreCase(nodeType)) {
+ return nodeCollection.remove(i);
+ }
+ }
+
+ removeSelectedNode(nodeID, nodeType);
+ return null;
+ }
+*/
+/* public void removeNode(String nodeType) {
+ nodeCollection.remove(nodeType);
+ }*/
+
+/* public ArrayList<NodeInfo> getCellsiteLocation(String location, boolean exactMatch) {
+ ArrayList<NodeInfo> list = new ArrayList<NodeInfo>();
+
+ for (NodeInfo nodeInfo : nodeCollection) {
+ if (nodeInfo.getAttribute("Location") == null) {
+ continue;
+ }
+
+ if (exactMatch) {
+ if (nodeInfo.getAttribute("Location").equalsIgnoreCase(location)) {
+ list.add(nodeInfo);
+ }
+ }
+ else {
+ if (nodeInfo.getAttribute("Location").toUpperCase().indexOf(location.toUpperCase()) != -1) {
+ list.add(nodeInfo);
+ }
+ }
+ }
+
+ return list;
+ }
+*/
+ public void clearNode() {
+ nodeCollection.clear();
+ selectedNode.clear();
+ }
+
+ public int getSize() {
+ return nodeCollection.size();
+ }
+
+ public void setNodeID(String nodeID) {
+ this.nodeID = nodeID;
+ }
+
+ public String getNodeID() {
+ return nodeID;
+ }
+
+ public void clearAllCollection() {
+ this.clearNode();
+ this.clearSelectedNode();
+ this.nodeID = "";
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeInfo.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeInfo.java
new file mode 100644
index 00000000..d1676e02
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeInfo.java
@@ -0,0 +1,210 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.node;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+
+import org.openecomp.portalsdk.analytics.gmap.map.GeoCoordinate;
+
+public class NodeInfo {
+ public static final String NUMBER_OF_T1_KEY = "x_numberOfT1";
+ public static final String SEQUENCE_KEY = "x_sequence";
+
+ public GeoCoordinate geoCoordinate;
+
+ private String nodeID;
+ private String nodeType;
+ private int state;
+ private boolean moveable;
+ private boolean deleteable;
+
+ private List<String> lineIDS;
+ private Map<String, String> nodeAttributes;
+
+ public NodeInfo(String nodeID) {
+ this.nodeID = nodeID;
+ lineIDS = new ArrayList<String>();
+ nodeAttributes = new TreeMap<String, String>();
+ geoCoordinate = new GeoCoordinate();
+ }
+
+ public NodeInfo clone() {
+ NodeInfo nodeInfo = new NodeInfo(nodeID);
+ nodeInfo.geoCoordinate.longitude = geoCoordinate.longitude;
+ nodeInfo.geoCoordinate.latitude = geoCoordinate.latitude;
+ nodeInfo.setMoveable(moveable);
+ nodeInfo.setNodeType(nodeType);
+ nodeInfo.setNodeID(nodeID);
+ nodeInfo.setState(state);
+ nodeInfo.setLineIDS(cloneLineIDS());
+ nodeInfo.setDeleteable(deleteable);
+ nodeInfo.initializeAttributes(nodeAttributes);
+
+ return nodeInfo;
+ }
+
+ public void addLineID(String lineID, String lineType) {
+ if (!lineIDS.contains(lineID + ">>" + lineType)) {
+ lineIDS.add(lineID + ">>" + lineType);
+ }
+ }
+
+ public void removeLineID(String lineID, String lineType) {
+ lineIDS.remove(lineID + ">>" + lineType);
+ }
+
+ public String getLineID(String lineID, String lineType) {
+ for (Object temp : lineIDS) {
+ if (temp.toString().equals(lineID + ">>" + lineType)) {
+ return temp.toString();
+ }
+ }
+
+ return null;
+ }
+
+ public List<String> getLineIDS() {
+ return lineIDS;
+ }
+
+ public void printLineIDS() {
+ Iterator<String> iter = lineIDS.iterator();
+
+ while (iter.hasNext()) {
+ System.out.println(iter.next());
+ }
+ }
+
+ public List<String> cloneLineIDS() {
+ List<String> lineIDS = new ArrayList<String>();
+
+ for (String lineID : this.lineIDS) {
+ lineIDS.add(lineID);
+ }
+
+ return lineIDS;
+ }
+
+ public void setLineIDS(List<String> lineIDS) {
+ this.lineIDS = lineIDS;
+ }
+
+ public void setNodeID(String nodeID) {
+ this.nodeID = nodeID;
+ }
+
+ public String getNodeID() {
+ return nodeID;
+ }
+
+ public void setNodeType(String nodeType) {
+ this.nodeType = nodeType;
+ }
+
+ public String getNodeType() {
+ return nodeType;
+ }
+
+ public void setState(int state) {
+ this.state = state;
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public void setMoveable(boolean moveable) {
+ this.moveable = moveable;
+ }
+
+ public boolean isMoveable() {
+ return moveable;
+ }
+
+ public void setDeleteable(boolean deleteable) {
+ this.deleteable = deleteable;
+ }
+
+ public boolean isDeleteable() {
+ return deleteable;
+ }
+
+ public String getAttribute(String key) {
+ String value = nodeAttributes.get(key);
+ return value;
+ }
+
+ public void initializeAttributes(Map<String, String> nodeAttributes) {
+ this.nodeAttributes.clear();
+ Set<String> keySet = nodeAttributes.keySet();
+ Iterator<String> iter = keySet.iterator();
+
+ while (iter.hasNext()) {
+ String key = iter.next();
+ this.nodeAttributes.put(key, nodeAttributes.get(key));
+ }
+ }
+
+ public void initializeAttributes(String nodeAttributes) {
+ if (nodeAttributes == null) {
+ return;
+ }
+
+ this.nodeAttributes.clear();
+ StringTokenizer tokenizer = new StringTokenizer(nodeAttributes, "|");
+
+ while (tokenizer.hasMoreTokens()) {
+ String attribute = tokenizer.nextToken();
+ StringTokenizer attributeTokenizer = new StringTokenizer(attribute, "=");
+
+ if (attributeTokenizer.countTokens() == 2) {
+ String key = attributeTokenizer.nextToken();
+ String value = attributeTokenizer.nextToken();
+ this.nodeAttributes.put(key, value);
+ }
+ }
+ }
+
+ public void setAttribute(String key, String value) {
+ nodeAttributes.put(key, value);
+ }
+
+ public List<String> getAttributeKeys() {
+ Set<String> keySet = nodeAttributes.keySet();
+ List<String> keys = new ArrayList<String>(keySet.size());
+ Iterator<String> iter = keySet.iterator();
+
+ while (iter.hasNext()) {
+ String key = iter.next();
+
+ if (key.indexOf("x_") != 0) {
+ keys.add(key);
+ }
+ }
+
+ return keys;
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/MapUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/MapUtils.java
new file mode 100644
index 00000000..d938869a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/MapUtils.java
@@ -0,0 +1,62 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.utils;
+
+import java.text.SimpleDateFormat;
+
+
+public class MapUtils {
+ public static final short PLATE_CARREE_PROJECTION = 0;
+ public static final short WEB_MERCATOR_PROJECTION = 1;
+
+
+
+ private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new java.text.SimpleDateFormat("yyyy/MM");
+
+
+
+ public static String getModifiedMarketID(String marketID) {
+ String modifiedMarketID = marketID.replaceAll("/", "_");
+ modifiedMarketID = modifiedMarketID.replaceAll(" ", "_");
+ return modifiedMarketID;
+ }
+
+ /**
+ * increment or decrement
+ * @param currentYearMonth
+ * @param value - positive value will increment, otherwise decrement
+ * @return null if not valid number (must be between 2008/01 to 2010/12)
+ */
+
+
+/* public static void saveColor(HttpServletRequest request, DomainService domainService,
+ String type, String colorValue) {
+// String userID = Integer.toString(UserUtils.getUserId(request));
+// MapColorPK colorPK = new MapColorPK();
+// MapColorVO colorVO = new MapColorVO();
+//
+// colorPK.setUserID(userID);
+// colorPK.setPrefID(type);
+// colorVO.setMapColorPK(colorPK);
+// colorVO.setColorValue(colorValue);
+//
+// domainService.saveDomainObject(colorVO);
+ } */
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/SwingWorker.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/SwingWorker.java
new file mode 100644
index 00000000..26cbb114
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/SwingWorker.java
@@ -0,0 +1,155 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.gmap.utils;
+
+import javax.swing.SwingUtilities;
+
+/**
+ * This is the 3rd version of SwingWorker (also known as
+ * SwingWorker 3), an abstract class that you subclass to
+ * perform GUI-related work in a dedicated thread. For
+ * instructions on using this class, see:
+ *
+ * http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
+ *
+ * Note that the API changed slightly in the 3rd version:
+ * You must now invoke start() on the SwingWorker after
+ * creating it.
+ */
+public abstract class SwingWorker {
+ private Object value; // see getValue(), setValue()
+ private Thread thread;
+
+ /**
+ * Class to maintain reference to current worker thread
+ * under separate synchronization control.
+ */
+ private static class ThreadVar {
+ private Thread thread;
+ ThreadVar(Thread t) { thread = t; }
+ synchronized Thread get() { return thread; }
+ synchronized void clear() { thread = null; }
+ }
+
+ private ThreadVar threadVar;
+
+ /**
+ * Get the value produced by the worker thread, or null if it
+ * hasn't been constructed yet.
+ */
+ protected synchronized Object getValue() {
+ return value;
+ }
+
+ /**
+ * Set the value produced by worker thread
+ */
+ private synchronized void setValue(Object x) {
+ value = x;
+ }
+
+ /**
+ * Compute the value to be returned by the <code>get</code> method.
+ */
+ public abstract Object construct();
+
+ /**
+ * Called on the event dispatching thread (not on the worker thread)
+ * after the <code>construct</code> method has returned.
+ */
+ public void finished() {
+ }
+
+ /**
+ * A new method that interrupts the worker thread. Call this method
+ * to force the worker to stop what it's doing.
+ */
+ public void interrupt() {
+ Thread t = threadVar.get();
+ if (t != null) {
+ t.interrupt();
+ }
+ threadVar.clear();
+ }
+
+ /**
+ * Return the value created by the <code>construct</code> method.
+ * Returns null if either the constructing thread or the current
+ * thread was interrupted before a value was produced.
+ *
+ * @return the value created by the <code>construct</code> method
+ */
+ public Object get() {
+ while (true) {
+ Thread t = threadVar.get();
+ if (t == null) {
+ return getValue();
+ }
+ try {
+ t.join();
+ }
+ catch (InterruptedException e) {
+ Thread.currentThread().interrupt(); // propagate
+ return null;
+ }
+ }
+ }
+
+
+ /**
+ * Start a thread that will call the <code>construct</code> method
+ * and then exit.
+ */
+ public SwingWorker() {
+ final Runnable doFinished = new Runnable() {
+ public void run() { finished(); }
+ };
+
+ Runnable doConstruct = new Runnable() {
+ public void run() {
+ try {
+ setValue(construct());
+ }
+ finally {
+ threadVar.clear();
+ }
+
+ SwingUtilities.invokeLater(doFinished);
+ }
+ };
+
+ Thread t = new Thread(doConstruct);
+ threadVar = new ThreadVar(t);
+ }
+
+ /**
+ * Start the worker thread.
+ */
+ public void start() {
+ Thread t = threadVar.get();
+ if (t != null) {
+ t.start();
+ }
+ }
+
+ public Thread getThread() {
+ return threadVar.get();
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/DataCache.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/DataCache.java
new file mode 100644
index 00000000..5bf4e003
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/DataCache.java
@@ -0,0 +1,524 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo;
+import org.openecomp.portalsdk.analytics.model.definition.TableJoin;
+import org.openecomp.portalsdk.analytics.model.definition.TableSource;
+import org.openecomp.portalsdk.analytics.model.runtime.LookupDBInfo;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+
+public class DataCache extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private static Vector dataViewActions = null;
+
+ private static Vector publicReportIdNames = null;
+
+ private static Vector privateReportIdNames = null;
+
+ private static Vector groupReportIdNames = null;
+
+ private static Vector reportTableSources = null;
+
+ private static Vector reportTableJoins = null;
+
+ private static HashMap reportTableDbColumns = new HashMap();
+
+ private static HashMap reportFieldDbLookups = null;
+
+ public DataCache() {
+ }
+
+ public static Vector getDataViewActions() throws RaptorException {
+ if (dataViewActions == null)
+ /* try */{
+ dataViewActions = new Vector();
+
+ //DataSet ds = DbUtils
+ // .executeQuery("SELECT ts.web_view_action FROM cr_table_source ts WHERE ts.web_view_action IS NOT NULL");
+
+ String sql = Globals.getTheDataViewActions();
+ DataSet ds = DbUtils
+ .executeQuery(sql);
+
+ for (int i = 0; i < ds.getRowCount(); i++)
+ dataViewActions.add(ds.getString(i, 0));
+ } // catch(Exception e) {}
+
+ return dataViewActions;
+ } // getDataViewActions
+
+ public static Vector getPublicReportIdNames() throws RaptorException {
+ // if(publicReportIdNames==null) => needs to be up-to-date at any time
+ /* try */{
+ publicReportIdNames = new Vector();
+
+ //DataSet ds = DbUtils
+ // .executeQuery("SELECT rep_id, title FROM cr_report WHERE public_yn = 'Y' ORDER BY title");
+
+ String sql = Globals.getThePublicReportIdNames();
+ DataSet ds = DbUtils
+ .executeQuery(sql);
+ for (int i = 0; i < ds.getRowCount(); i++)
+ publicReportIdNames
+ .add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1)));
+ } // catch(Exception e) {}
+
+ return publicReportIdNames;
+ } // getPublicReportIdNames
+
+ public static Vector getPrivateAccessibleReportIdNames(String user_id, Vector userRoles) throws RaptorException {
+ // if(publicReportIdNames==null) => needs to be up-to-date at any time
+ /* try */{
+ privateReportIdNames = new Vector();
+
+ // StringBuffer query = new StringBuffer(" SELECT cr.rep_id, cr.title FROM cr_report cr ");
+ String sql = Globals.getThePrivateAccessibleNamesA();
+ //query.append(" WHERE cr.rep_id not in (select rep_id from cr_report_access cra where user_id = '"+ user_id+"' ");
+ sql = sql.replace("[user_id]", user_id);
+ StringBuffer query = new StringBuffer(sql);
+ for (int i = 0; i < userRoles.size(); i++) {
+ if( i == 0){
+ // query.append(" OR role_id in (");
+ query.append(Globals.getThePrivateAccessibleNamesIf());
+ }
+ if(i < (userRoles.size()-1))
+ query.append((String)userRoles.get(i) + ",");
+
+ else if(i == (userRoles.size()-1))
+ query.append((String)userRoles.get(i)+")");
+
+ }
+ //query.append(" ) ");
+ //query.append(" AND public_yn = 'N' and cr.owner_id = '"+ user_id+"' order by 2 ");
+ sql = Globals.getThePrivateAccessibleNamesB();
+ sql = sql.replace("[user_id]", user_id);
+ query.append(sql);
+
+ DataSet ds = DbUtils
+ .executeQuery(query.toString() );
+
+ for (int i = 0; i < ds.getRowCount(); i++)
+ privateReportIdNames
+ .add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1)));
+ } // catch(Exception e) {}
+
+ return privateReportIdNames;
+ } // getPrivateAccessibleReportIdNames
+
+
+ public static Vector getGroupAccessibleReportIdNames(String user_id, Vector userRoles) throws RaptorException {
+ // if(publicReportIdNames==null) => needs to be up-to-date at any time
+ /* try */{
+ groupReportIdNames = new Vector();
+
+ //StringBuffer query = new StringBuffer(" SELECT cr.rep_id, cr.title FROM cr_report cr ");
+ //query.append(" WHERE cr.rep_id in (select rep_id from cr_report_access cra where user_id = '"+ user_id+"' ");
+ String sql = Globals.getTheGroupAccessibleNamesA();
+ sql = sql.replace("[user_id]", user_id);
+ StringBuffer query = new StringBuffer(sql);
+
+ for (int i = 0; i < userRoles.size(); i++) {
+ if( i == 0)
+ query.append(Globals.getThePrivateAccessibleNamesIf());
+ if(i < (userRoles.size()-1))
+ query.append((String)userRoles.get(i) + ",");
+ else if(i == (userRoles.size()-1))
+ query.append((String)userRoles.get(i)+")");
+
+ }
+ //query.append(" ) ");
+ //query.append(" AND public_yn = 'N' order by 2 ");
+
+ query.append(Globals.getTheGroupAccessibleNamesB());
+ DataSet ds = DbUtils
+ .executeQuery(query.toString() );
+
+ for (int i = 0; i < ds.getRowCount(); i++)
+ groupReportIdNames
+ .add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1)));
+ } // catch(Exception e) {}
+
+ return groupReportIdNames;
+ } // getGroupAccessibleReportIdNames
+
+
+ public static TableSource getTableSource(String tableName, String dBinfo, Vector userRoles, String userId, HttpServletRequest request) throws RaptorException {
+ try {
+ Vector tableSources = null;
+ if(Globals.getRestrictTablesByRole()) {
+ tableSources = getReportTableSources(userRoles, dBinfo, userId, request);
+ } else {
+ tableSources = getReportTableSources(dBinfo);
+ }
+ for (Iterator iter = getReportTableSources(dBinfo).iterator(); iter.hasNext();) {
+ TableSource tableSource = (TableSource) iter.next();
+ if (tableSource.getTableName().equals(tableName))
+ return tableSource;
+ } // for
+ } catch (RaptorException e) {
+ throw new RaptorException(e.getMessage(), e.getCause());
+ }
+
+ return null;
+ }
+ public static void refreshReportTableSources() {
+ reportTableSources = null;
+ }
+
+ public static Vector getReportTableSources(String dBInfo) throws RaptorException {
+ if (reportTableSources == null)
+ /* try */{
+ reportTableSources = new Vector();
+ //String query = " SELECT table_name, display_name, pk_fields, web_view_action, large_data_source_yn, filter_sql FROM cr_table_source ";
+ String query = Globals.getTheReportTableSourcesA();
+ if (dBInfo != null && !dBInfo.equals(AppConstants.DB_LOCAL)){
+ //query += " where SOURCE_DB= '" + dBInfo + "'";
+ query+=Globals.getTheReportTableSourcesWhere();
+ query = query.replace("[dBInfo]", dBInfo);
+ }
+ else {
+ //query += " where SOURCE_DB is null or SOURCE_DB = '" + AppConstants.DB_LOCAL
+ // + "'";
+ query+=Globals.getTheReportTableSourcesIf();
+ query = query.replace("[AppConstants.DB_LOCAL]", AppConstants.DB_LOCAL);
+ }
+ //query += " ORDER BY table_name ";
+ query+=Globals.getTheReportTableSourcesElse();
+ DataSet ds = DbUtils.executeQuery(query);
+ for (int i = 0; i < ds.getRowCount(); i++)
+ reportTableSources.add(new TableSource(ds.getString(i, 0), ds.getString(i, 1),
+ ds.getString(i, 2), ds.getString(i, 3), ds.getString(i, 4), ds
+ .getString(i, 5)));
+ } // catch(Exception e) {}
+
+ return reportTableSources;
+ } // getReportTableSources
+
+ public static Vector getReportTableSources(Vector userRoles, String dBInfo, String userId, HttpServletRequest request)
+ throws RaptorException {
+ if (!Globals.getRestrictTablesByRole())
+ return getReportTableSources(dBInfo);
+ Vector userTableSources = new Vector();
+ if (userRoles.size() > 0)
+ /* try */{
+ StringBuffer sb = new StringBuffer();
+ for (Iterator iter = userRoles.iterator(); iter.hasNext();) {
+ sb.append((sb.length() == 0) ? "(" : ", ");
+ sb.append(iter.next());
+ } // for
+ sb.append(")");
+ //StringBuffer query = new StringBuffer("SELECT ts.table_name, ts.display_name, ts.pk_fields, ");
+ // query.append(" ts.web_view_action, ts.large_data_source_yn, ts.filter_sql FROM cr_table_source ts ");
+ // query.append (" WHERE ");
+ StringBuffer query = new StringBuffer(Globals.grabTheReportTableA());
+ //if(!(AppUtils.isAdminUser(userId) || AppUtils.isSuperUser(userId)))
+ // query.append (" (EXISTS (SELECT 1 FROM cr_table_role tr WHERE tr.table_name=ts.table_name AND tr.role_id IN "+sb.toString()+")) and ");
+ //+ " OR (NOT EXISTS (SELECT 1 FROM cr_table_role tr WHERE tr.table_name=ts.table_name)) ";
+ if (dBInfo != null && !dBInfo.equals(AppConstants.DB_LOCAL)){
+ String d_sql = Globals.grabTheReportTableIf();
+ d_sql = d_sql.replace("[dBInfo]", dBInfo);
+ //query.append( " ts.SOURCE_DB= '" + dBInfo + "'");
+ query.append(d_sql);
+ }
+ else{
+ //query.append(" (ts.SOURCE_DB is null or ts.SOURCE_DB = '"+ AppConstants.DB_LOCAL + "')");
+ String d_sql = Globals.grabTheReportTableElse();
+ d_sql = d_sql.replace("[AppConstants.DB_LOCAL]", AppConstants.DB_LOCAL);
+ query.append(d_sql);
+ }
+ if(!(AppUtils.isAdminUser(request) || AppUtils.isSuperUser(request))) {
+ //query.append(" minus ");
+
+ // query.append(" SELECT ts.table_name, ts.display_name, ts.pk_fields, ts.web_view_action, ");
+ // query.append(" ts.large_data_source_yn, ts.filter_sql from cr_table_source ts where ");
+ // query.append(" table_name in (select table_name from cr_table_role where role_id not IN "+sb.toString()+") and ");
+ String e_sql = Globals.grabTheReportTableB();
+ e_sql = e_sql.replace("[sb.toString()]", sb.toString());
+ query.append(e_sql);
+
+ if (dBInfo != null && !dBInfo.equals(AppConstants.DB_LOCAL)){
+
+ // query.append( " ts.SOURCE_DB= '" + dBInfo + "'");
+ String d_sql = Globals.grabTheReportTableIf();
+ d_sql = d_sql.replace("[dBInfo]", dBInfo);
+ query.append(d_sql);
+ }
+ else{
+ //query.append(" (ts.SOURCE_DB is null or ts.SOURCE_DB = '"+ AppConstants.DB_LOCAL + "')");
+ String d_sql = Globals.grabTheReportTableElse();
+ d_sql = d_sql.replace("[AppConstants.DB_LOCAL]", AppConstants.DB_LOCAL);
+ query.append(d_sql);
+ }
+ }
+ //query.append(" ORDER BY 1 ");
+ query.append(Globals.grabTheReportTableC());
+ DataSet ds = DbUtils.executeQuery(query.toString());
+ for (int i = 0; i < ds.getRowCount(); i++)
+ userTableSources.add(new TableSource(ds.getString(i, 0), ds.getString(i, 1),
+ ds.getString(i, 2), ds.getString(i, 3), ds.getString(i, 4), ds
+ .getString(i, 5)));
+ } // catch(Exception e) {}
+
+ return userTableSources;
+ } // getReportTableSources
+
+ public static Vector getReportTableJoins() throws RaptorException {
+ if (reportTableJoins == null)
+ /* try */{
+ reportTableJoins = new Vector();
+
+ //DataSet ds = DbUtils
+ // .executeQuery("SELECT src_table_name, dest_table_name, join_expr FROM cr_table_join");
+ DataSet ds = DbUtils
+ .executeQuery(Globals.getTheReportTableCrJoin());
+ for (int i = 0; i < ds.getRowCount(); i++)
+ reportTableJoins.add(new TableJoin(ds.getString(i, 0), ds.getString(i, 1), ds
+ .getString(i, 2)));
+ } // catch(Exception e) {}
+
+ return reportTableJoins;
+ } // getReportTableJoins
+
+ public static Vector getReportTableJoins(Vector userRoles) throws RaptorException {
+ if (!Globals.getRestrictTablesByRole())
+ return getReportTableJoins();
+
+ Vector userTableJoins = new Vector();
+ if (userRoles.size() > 0)
+ /* try */{
+ StringBuffer sb = new StringBuffer();
+ for (Iterator iter = userRoles.iterator(); iter.hasNext();) {
+ sb.append((sb.length() == 0) ? "(" : ", ");
+ sb.append(iter.next());
+ } // for
+ sb.append(")");
+
+ /*DataSet ds = DbUtils
+ .executeQuery("SELECT tj.src_table_name, tj.dest_table_name, tj.join_expr FROM cr_table_join tj "
+ + "WHERE ((EXISTS (SELECT 1 FROM cr_table_role trs WHERE trs.table_name=tj.src_table_name AND trs.role_id IN "
+ + sb.toString()
+ + ")) "
+ + "OR (NOT EXISTS (SELECT 1 FROM cr_table_role trs WHERE trs.table_name=tj.src_table_name))) "
+ + "AND ((EXISTS (SELECT 1 FROM cr_table_role trd WHERE trd.table_name=tj.dest_table_name AND trd.role_id IN "
+ + sb.toString()
+ + ")) "
+ + "OR (NOT EXISTS (SELECT 1 FROM cr_table_role trd WHERE trd.table_name=tj.dest_table_name)))");*/
+
+
+ String f_sql = Globals.getTheReportTableJoins();
+ f_sql = f_sql.replace("[sb.toString()]", sb.toString());
+
+ DataSet ds = DbUtils
+ .executeQuery(f_sql);
+
+ for (int i = 0; i < ds.getRowCount(); i++)
+ userTableJoins.add(new TableJoin(ds.getString(i, 0), ds.getString(i, 1), ds
+ .getString(i, 2)));
+ } // catch(Exception e) {}
+
+ return userTableJoins;
+ } // getReportTableJoins
+
+ private static void processDollarFields(Vector tableDbColumns) {
+ int i = 0;
+ while (i < tableDbColumns.size()) {
+ DBColumnInfo dbci = (DBColumnInfo) tableDbColumns.get(i);
+ if (dbci.getColName().equals("DL$MONTH")) {
+ tableDbColumns.remove(i);
+ dbci.setLabel("Data Month/Year");
+ tableDbColumns.add(0, dbci);
+ i++;
+ } else if (dbci.getColName().indexOf('$') >= 0)
+ tableDbColumns.remove(i);
+ else
+ i++;
+ } // while
+ } // processDollarFields
+
+ private static String generateReportTableDbUserColumnSQL(String tableName) {
+ StringBuffer sb = new StringBuffer();
+ // sb.append("SELECT a.table_name, a.column_name, a.data_type, a.label ");
+ //sb.append(" FROM user_column_def a ");
+ // sb.append("WHERE a.table_name = '" + tableName.toUpperCase() + "' ");
+ // sb.append("ORDER BY a.column_id");
+
+ String sql = Globals.getGenerateReportTableCol();
+ sql = sql.replace("[tableName.toUpperCase()]", tableName.toUpperCase());
+ sb.append(sql);
+
+ return sb.toString();
+ }//generateReportTableDbUserColumnSQL
+ private static String generateReportTableDbColumnsSQL(String tableName, String maskSql) {
+ StringBuffer sb = new StringBuffer();
+ //sb.append("SELECT utc.table_name, utc.column_name, utc.data_type, ");
+ sb.append(Globals.getGenerateDbUserSqlA());
+ if (maskSql == null){
+ //sb.append("utc.column_name label ");
+ sb.append(Globals.getGenerateDbUserSqlIf());
+ }
+ else{
+ //sb.append("nvl(x.label, utc.column_name) label ");
+ //sb.append("FROM user_tab_columns utc ");
+ sb.append(Globals.getGenerateDbUserSqlElse());
+ }
+ if (maskSql != null) {
+ sb.append(", (");
+ sb.append(maskSql);
+ sb.append(") AS x ");
+ }
+ //sb.append("WHERE utc.table_name = '" + tableName.toUpperCase() + "' ");
+ String g_sql = Globals.getGenerateDbUserSqlB();
+ g_sql = g_sql.replace("[tableName.toUpperCase()]", tableName.toUpperCase());
+ sb.append(g_sql);
+ if (maskSql != null){
+ //sb.append(" AND utc.table_name = x.table_name AND utc.column_name = x.column_name ");
+ sb.append(Globals.getGenerateDbUserSqlC());
+ }
+ //sb.append("ORDER BY utc.column_id");
+ sb.append(Globals.getGenerateDbUserSqlD());
+ //System.out.println(sb.toString());
+ return sb.toString();
+ } // generateReportTableDbColumnsSQL
+
+ public static synchronized Vector getReportTableDbColumns(String tableName,
+ String remoteDbPrefix) throws RaptorException {
+ Vector tableDbColumns = null;
+ if(reportTableDbColumns!=null)
+ tableDbColumns = (Vector) reportTableDbColumns.get(tableName);
+ else
+ reportTableDbColumns = new HashMap();
+ if (tableDbColumns == null)
+ /* try */{
+ tableDbColumns = new Vector();
+
+ String maskSql = AppUtils.getReportDbColsMaskSQL();
+ DataSet ds = null;
+ if(Globals.getUserColDef()) {
+ try {
+ ds = ConnectionUtils.getDataSet(
+ generateReportTableDbUserColumnSQL(tableName),AppConstants.DB_LOCAL);
+ }
+ catch (ReportSQLException ex) {
+ throw new ReportSQLException("No Such Table. Please create table or make user_column_def in raptor.properties as \"false\"");
+ }
+
+ }
+ else if(maskSql!=null){
+ try {
+ ds = ConnectionUtils.getDataSet(
+ generateReportTableDbColumnsSQL(tableName, maskSql), remoteDbPrefix);
+ }
+ catch(ReportSQLException ex){
+ throw new ReportSQLException("Field related table is not present in the database. Please make \"use_field_table\"" +
+ " as \"no\" in the raptor_app_<framework>.properties");}
+ }
+ if (ds==null || ds.getRowCount() == 0) {
+ // In case there are no records in the FIELDS table
+ ds = ConnectionUtils.getDataSet(generateReportTableDbColumnsSQL(tableName,
+ null), remoteDbPrefix);
+ }
+ for (int i = 0; i < ds.getRowCount(); i++)
+ tableDbColumns.add(new DBColumnInfo(ds.getString(i, 0), ds.getString(i, 1), ds
+ .getString(i, 2), ds.getString(i, 3)));
+
+ processDollarFields(tableDbColumns);
+ reportTableDbColumns.put(tableName, tableDbColumns);
+ } // catch(Exception e) {}
+
+ return tableDbColumns;
+ } // getReportTableDbColumns
+
+ public static synchronized String getReportTableDbColumnType(String tableName,
+ String columnName, String dbInfo) throws RaptorException {
+ for (Iterator iter = getReportTableDbColumns(tableName, dbInfo).iterator(); iter
+ .hasNext();) {
+ DBColumnInfo dbCol = (DBColumnInfo) iter.next();
+ if (dbCol.getColName().equals(columnName))
+ return dbCol.getColType();
+ } // for
+
+ return null;
+ } // getReportTableDbColumnType
+
+ public static synchronized LookupDBInfo getLookupTable(String tableName, String fieldName) throws RaptorException {
+ if (reportFieldDbLookups == null)
+ try {
+ String sql = AppUtils.getReportDbLookupsSQL();
+
+ if (sql != null) {
+ DataSet ds = DbUtils.executeQuery(sql);
+ reportFieldDbLookups = new HashMap();
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ String tName = ds.getString(i, 0);
+ String fName = ds.getString(i, 1);
+ reportFieldDbLookups.put(tName + '|' + fName, new LookupDBInfo(tName,
+ fName, ds.getString(i, 2), ds.getString(i, 3), ds.getString(i,
+ 4)));
+ } // for
+ } // if
+ } catch (Exception e) { throw new RaptorException(e.getMessage(), e.getCause());
+ }
+
+ LookupDBInfo lookupDBInfo = null;
+ if (reportFieldDbLookups != null)
+ lookupDBInfo = (LookupDBInfo) reportFieldDbLookups
+ .get(tableName + '|' + fieldName);
+
+ if (lookupDBInfo == null)
+ lookupDBInfo = new LookupDBInfo(tableName, fieldName, tableName, fieldName,
+ fieldName);
+
+ return lookupDBInfo;
+ } // getLookupTable
+
+ // public static void setRemoteDBPrefix (String remoteDBPrefix) {
+ // _remoteDBPrefix = remoteDBPrefix;
+ // }
+ //
+ // public static String getRemoteDBPrefix () {
+ // return _remoteDBPrefix;
+ // }
+
+ public static void refreshAll() {
+ DataCache.dataViewActions = null;
+ DataCache.privateReportIdNames = null;
+ DataCache.publicReportIdNames = null;
+ DataCache.reportFieldDbLookups = null;
+ DataCache.reportTableDbColumns = null;
+ DataCache.reportTableJoins = null;
+ DataCache.reportTableSources = null;
+ AppUtils.resetUserCache();
+ }
+} // DataCache
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportHandler.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportHandler.java
new file mode 100644
index 00000000..c663e69c
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportHandler.java
@@ -0,0 +1,6605 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+/* ===========================================================================================
+ * This class is part of <I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I>
+ * Raptor : This tool is used to generate different kinds of reports with lot of utilities
+ * ===========================================================================================
+ *
+ * -------------------------------------------------------------------------------------------
+ * ReportHandler.java - This class is used to generate reports in Excel using POI and also to
+ * create ReportRuntime and ReportDefinition object using report id.
+ * -------------------------------------------------------------------------------------------
+ *
+ *
+ * Changes
+ * -------
+ * 18-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> request Object is passed to prevent caching user/roles - Datamining/Hosting. </LI></UL>
+ * 14-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Signature for generating excel method has been changed to add the report name as sheet name. </LI>
+ * <LI> Dashboard reports can be downloaded with each report as a separate sheet. </LI>
+ * </UL>
+ * 08-Jun-2009 : Version 8.3 (Sundar); <UL><LI> Short datatype is replaced with default integer datatype to create
+ * row as short is not expoting more than 32768 rows. </LI></UL>
+ *
+ */
+package org.openecomp.portalsdk.analytics.model;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+import java.util.Vector;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFCellStyle;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.hssf.usermodel.HSSFFont;
+import org.apache.poi.hssf.usermodel.HSSFFooter;
+import org.apache.poi.hssf.usermodel.HSSFHeader;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.hssf.util.HSSFColor;
+import org.apache.poi.hssf.util.Region;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.ss.usermodel.CreationHelper;
+import org.apache.poi.ss.usermodel.DateUtil;
+import org.apache.poi.ss.usermodel.Header;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.ss.util.CellReference;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFCellStyle;
+import org.apache.poi.xssf.usermodel.XSSFDataFormat;
+import org.apache.poi.xssf.usermodel.XSSFFont;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.openecomp.portalsdk.analytics.controller.ErrorHandler;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.ExecuteQuery;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.ExcelColorDef;
+import org.openecomp.portalsdk.analytics.util.HtmlStripper;
+import org.openecomp.portalsdk.analytics.util.Log;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.view.ColumnHeader;
+import org.openecomp.portalsdk.analytics.view.ColumnHeaderRow;
+import org.openecomp.portalsdk.analytics.view.DataRow;
+import org.openecomp.portalsdk.analytics.view.DataValue;
+import org.openecomp.portalsdk.analytics.view.HtmlFormatter;
+import org.openecomp.portalsdk.analytics.view.ReportData;
+import org.openecomp.portalsdk.analytics.view.RowHeader;
+import org.openecomp.portalsdk.analytics.view.RowHeaderCol;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataSourceType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormatList;
+import org.openecomp.portalsdk.analytics.xmlobj.FormatType;
+import org.openecomp.portalsdk.analytics.xmlobj.Reports;
+import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreList;
+import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+import com.lowagie.text.Document;
+import com.lowagie.text.Paragraph;
+import com.lowagie.text.html.simpleparser.HTMLWorker;
+import com.lowagie.text.html.simpleparser.StyleSheet;
+import com.lowagie.text.pdf.PdfPTable;
+//import javax.servlet.RequestDispatcher;
+
+public class ReportHandler extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportHandler.class);
+
+ public ReportHandler() {
+ }
+
+ private String SHEET_NAME = "";
+ private static final String XML_ENCODING = "UTF-8";
+ private static int font_size = 10;
+ private static int font_header_title_size = 12;
+ private static int font_header_descr_size = 9;
+ private static int font_footer_size = 9;
+
+
+ private HashMap loadStyles(ReportRuntime rr, HSSFWorkbook wb) {
+ HSSFCellStyle styleDefault = wb.createCellStyle();
+ //System.out.println("Load Styles");
+ // Style default will be normal with no background
+ HSSFFont fontDefault = wb.createFont();
+ // The default will be plain .
+ fontDefault.setColor((short) HSSFFont.COLOR_NORMAL);
+ fontDefault.setFontHeight((short) (font_size / 0.05));
+ fontDefault.setFontName("Tahoma");
+
+ styleDefault.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleDefault.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleDefault.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleDefault.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleDefault.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleDefault.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleDefault.setFont(fontDefault);
+
+ HSSFCellStyle styleRed = wb.createCellStyle();
+ styleRed.cloneStyleFrom(styleDefault);
+ styleRed.setFillForegroundColor((short)HSSFColor.RED.index);
+ styleRed.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
+ HSSFFont fontRed = wb.createFont();
+ fontRed.setColor((short) HSSFColor.WHITE.index);
+ fontRed.setFontHeight((short) (font_size / 0.05));
+ fontRed.setFontName("Tahoma");
+ styleRed.setFont(fontRed);
+
+ HSSFCellStyle styleYellow = wb.createCellStyle();
+ styleYellow.cloneStyleFrom(styleDefault);
+ styleYellow.setFillForegroundColor((short)HSSFColor.YELLOW.index);
+ styleYellow.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
+ HSSFFont fontYellow = wb.createFont();
+ fontYellow.setColor((short) HSSFColor.BLACK.index);
+ fontYellow.setFontHeight((short) (font_size / 0.05));
+ fontYellow.setFontName("Tahoma");
+ styleYellow.setFont(fontYellow);
+
+ HSSFCellStyle styleGreen = wb.createCellStyle();
+ styleGreen.cloneStyleFrom(styleDefault);
+ styleGreen.setFillForegroundColor((short)HSSFColor.GREEN.index);
+ styleGreen.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
+ HSSFFont fontGreen = wb.createFont();
+ fontGreen.setColor((short) HSSFColor.WHITE.index);
+ fontGreen.setFontHeight((short) (font_size / 0.05));
+ fontGreen.setFontName("Tahoma");
+ styleGreen.setFont(fontGreen);
+
+
+ ArrayList semColumnList = new ArrayList();
+ List dsList = rr.getDataSourceList().getDataSource();
+ for (Iterator iter = dsList.iterator(); iter.hasNext();) {
+ DataSourceType element = (DataSourceType) iter.next();
+ List dcList = element.getDataColumnList().getDataColumn();
+ for (Iterator iterator = dcList.iterator(); iterator.hasNext();) {
+ DataColumnType element1 = (DataColumnType) iterator.next();
+ semColumnList.add(element1.getSemaphoreId());
+
+ }
+ }
+ SemaphoreList semList = rr.getSemaphoreList();
+ HashMap hashMapStyles = new HashMap();
+ HashMap hashMapFonts = new HashMap();
+ hashMapFonts.put("default", fontDefault);
+ hashMapFonts.put("red", fontRed);
+ hashMapFonts.put("yellow", fontYellow);
+ hashMapFonts.put("green", fontGreen);
+ hashMapStyles.put("default", styleDefault);
+ hashMapStyles.put("red", styleRed);
+ hashMapStyles.put("yellow", styleYellow);
+ hashMapStyles.put("green", styleGreen);
+ HSSFCellStyle cellStyle = null;
+ if (semList == null || semList.getSemaphore() == null) {
+ return hashMapStyles;
+ } else {
+ for (Iterator iter = semList.getSemaphore().iterator(); iter.hasNext();) {
+ SemaphoreType sem = (SemaphoreType) iter.next();
+ if(!semColumnList.contains(sem.getSemaphoreId())) continue;
+ //System.out.println("SemphoreId ----> " + sem.getSemaphoreId());
+ FormatList fList = sem.getFormatList();
+ List formatList = fList.getFormat();
+ for (Iterator fIter = formatList.iterator(); fIter.hasNext();) {
+ FormatType fmt = (FormatType) fIter.next();
+ if(fmt!=null){
+ //if (fmt.getLessThanValue().length() > 0) {
+ cellStyle = wb.createCellStyle();
+ HSSFFont cellFont = wb.createFont();
+ //System.out.println("Format Id " + fmt.getFormatId());
+ if (nvl(fmt.getBgColor()).length() > 0) {
+// System.out.println("Load Styles " +
+// fmt.getFormatId()
+// + " " +fmt.getBgColor() + " " +
+// ExcelColorDef.getExcelColor(fmt.getBgColor()));
+ cellStyle.setFillForegroundColor(ExcelColorDef.getExcelColor(fmt
+ .getBgColor()));
+ cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
+ }
+ if (nvl(fmt.getFontColor()).length() > 0) {
+ cellFont.setColor(ExcelColorDef.getExcelColor(fmt.getFontColor()));
+ } else
+ cellFont.setColor((short) HSSFFont.COLOR_NORMAL);
+ if (fmt.isBold())
+ cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
+ if (fmt.isItalic())
+ cellFont.setItalic(true);
+ if (fmt.isUnderline())
+ cellFont.setUnderline(HSSFFont.U_SINGLE);
+ if(nvl(fmt.getFontFace()).length()>0)
+ cellFont.setFontName(fmt.getFontFace());
+ else
+ cellFont.setFontName("Tahoma");
+ //cellFont.setFontHeight((short) (10 / 0.05));
+
+ if(nvl(fmt.getFontSize()).length()>0) {
+ try {
+ //cellFont.setFontHeight((short) (Integer.parseInt(fmt.getFontSize()) / 0.05));
+ cellFont.setFontHeight((short) (font_size/0.05));
+ } catch(NumberFormatException e){
+ cellFont.setFontHeight((short) (font_size / 0.05));//10
+ }
+ }
+ else
+ cellFont.setFontHeight((short) (font_size / 0.05));
+ cellStyle.setFont(cellFont);
+ cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ hashMapStyles.put(fmt.getFormatId(), cellStyle);
+ } else {
+ hashMapStyles.put(fmt.getFormatId(), styleDefault);
+ hashMapStyles.put("default", styleDefault);
+ }
+ }
+
+ }
+ }
+ return hashMapStyles;
+ }
+
+ private void paintExcelParams(HSSFWorkbook wb,int rowNum,int col,ArrayList paramsList, String customizedParamInfo, HSSFSheet sheet, String reportTitle, String reportDescr) throws IOException {
+ //HSSFSheet sheet = wb.getSheet(getSheetName());
+ int cellNum = 0;
+ HSSFRow row = null;
+ short s1 = 0, s2 = (short) 1;
+ HtmlStripper strip = new HtmlStripper();
+ // Name Style
+ HSSFCellStyle styleName = wb.createCellStyle();
+ //styleName.setFillBackgroundColor(HSSFColor.GREY_80_PERCENT.index);
+ styleName.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
+ //styleName.setFillPattern(HSSFCellStyle.SPARSE_DOTS);
+ styleName.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleName.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleName.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleName.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ styleName.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleName.setDataFormat((short)0);
+ HSSFFont font = wb.createFont();
+ font.setFontHeight((short) (font_size / 0.05));
+ font.setFontName("Tahoma");
+ font.setColor(HSSFColor.BLACK.index);
+ font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
+ styleName.setFont(font);
+ //Data Style
+
+ // Create some fonts.
+ HSSFFont fontDefault = wb.createFont();
+ // Initialize the styles & fonts.
+ // The default will be plain .
+ fontDefault.setColor((short) HSSFFont.COLOR_NORMAL);
+ fontDefault.setFontHeight((short) (font_size / 0.05));
+ fontDefault.setFontName("Tahoma");
+ fontDefault.setItalic(true);
+ // Style default will be normal with no background
+ HSSFCellStyle styleValue = wb.createCellStyle();
+ styleValue.setDataFormat((short)0);
+ styleValue.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleValue.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleValue.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleValue.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleValue.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleValue.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleValue.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleValue.setFont(fontDefault);
+ HSSFCell cell = null;
+ HSSFCellStyle styleDescription = wb.createCellStyle();
+ styleDescription.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+// styleDescription.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+// styleDescription.setBorderTop(HSSFCellStyle.BORDER_THIN);
+// styleDescription.setBorderRight(HSSFCellStyle.BORDER_THIN);
+// styleDescription.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ HSSFFont fontDescr = wb.createFont();
+ fontDescr.setFontHeight((short) (font_size / 0.05)); //14
+ fontDescr.setFontName("Tahoma");
+ fontDescr.setColor(HSSFColor.BLACK.index);
+ fontDescr.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
+ styleDescription.setFont(font);
+ HSSFCell cellDescr = null;
+ int paramSeq = 0;
+ HSSFHeader header = sheet.getHeader();
+ StringBuffer strBuf = new StringBuffer();
+ if(!Globals.customizeFormFieldInfo() || customizedParamInfo.length()<=0) {
+ for (Iterator iter = paramsList.iterator(); iter.hasNext();) {
+ IdNameValue value = (IdNameValue) iter.next();
+ //System.out.println("\"" + value.getId() + " = " + value.getName() + "\"");
+ if(nvl(value.getId()).trim().length()>0 && (!nvl(value.getId()).trim().equals("BLANK"))) {
+ paramSeq += 1;
+ if(paramSeq <= 1) {
+ row = sheet.createRow(++rowNum);
+ cell = row.createCell((short) 0);
+ sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2));
+ cellDescr = row.createCell((short) 0);
+ cellDescr.setCellValue("Run-time Parameters");
+ cellDescr.setCellStyle(styleDescription);
+
+
+ strBuf.append(reportTitle+"\n");
+ //strBuf.append("Run-time Parameters\n");
+ }
+ row = sheet.createRow(++rowNum);
+ cellNum = 0;
+ //System.out.println("RowNum " + rowNum + " " + value.getId() + " " +value.getName());
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue(value.getId());
+ cell.setCellStyle(styleName);
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue(value.getName().replaceAll("~",","));
+ cell.setCellStyle(styleValue);
+
+ //strBuf.append(value.getId()+": "+ value.getName()+"\n");
+ }
+ } //for
+ } else {
+ strBuf.append(reportTitle+"\n");
+ Document document = new Document();
+ document.open();
+ HTMLWorker worker = new HTMLWorker(document);
+ StyleSheet style = new StyleSheet();
+ style.loadTagStyle("body", "leading", "16,0");
+ ArrayList p = HTMLWorker.parseToList(new StringReader(customizedParamInfo), style);
+ String name = "";
+ String token = "";
+ String value = "";
+ String s = "";
+ PdfPTable pdfTable = null;
+ for (int k = 0; k < p.size(); ++k){
+ if(p.get(k) instanceof Paragraph)
+ s = ((Paragraph)p.get(k)).toString();
+ else { /*if ((p.get(k) instanceof PdfPTable))*/
+ pdfTable = ((PdfPTable)p.get(k));
+ }
+ //todo: Logic for parsing pdfTable should be added after upgrading to iText 5.0.0
+ //s = Utils.replaceInString(s, ",", "|");
+ s = s.replaceAll(",", "|");
+ s = s.replaceAll("~", ",");
+ if(s.indexOf(":")!= -1) {
+ //System.out.println("|"+s+"|");
+ row = sheet.createRow(++rowNum);
+ cell = row.createCell((short) 0);
+ sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2));
+ cellDescr = row.createCell((short) 0);
+ cellDescr.setCellValue("Run-time Parameters");
+ cellDescr.setCellStyle(styleDescription);
+
+ //strBuf.append("Run-time Parameters\n");
+ StringTokenizer st = new StringTokenizer(s.trim(), "|");
+ while(st.hasMoreTokens()) {
+ token = st.nextToken();
+ token = token.trim();
+ if (!(token.trim().equals("|") || token.trim().equals("]]") || token.trim().equals("]") || token.trim().equals("[") )) {
+ if(token.endsWith(":")) {
+ name = token;
+ name = name.substring(0, name.length()-1);
+ if(name.startsWith("["))
+ name = name.substring(1);
+ value = st.nextToken();
+ if(nvl(value).endsWith("]"))value = nvl(value).substring(0, nvl(value).length()-1);
+ } /*else if(name != null && name.length() > 0) {
+ value = st.nextToken();
+ if(value.endsWith("]]"))value = value.substring(0, value.length()-1);
+ }*/
+ if(name!=null && name.trim().length()>0) {
+ row = sheet.createRow((short) ++rowNum);
+ cellNum = 0;
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue(name.trim());
+ cell.setCellStyle(styleName);
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue(value.trim());
+ cell.setCellStyle(styleValue);
+ //strBuf.append(name.trim()+": "+ value.trim()+"\n");
+ }
+/* if(token.endsWith(":") && (value!=null && value.trim().length()<=0) && (name!=null && name.trim().length()>0 && name.endsWith(":"))) {
+ name = name.substring(0, name.indexOf(":")+1);
+ //value = token.substring(token.indexOf(":")+1);
+ row = sheet.createRow((short) ++rowNum);
+ cellNum = 0;
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue(name.trim());
+ cell.setCellStyle(styleName);
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue(value.trim());
+ cell.setCellStyle(styleValue);
+
+ //strBuf.append(name.trim()+": "+ value.trim()+"\n");
+ value = "";
+ name = "";
+ }
+*/ }
+ int cw = 0;
+ cw = name.trim().length() + 12;
+ // if(i!=cellWidth.size()-1)
+ if(sheet.getColumnWidth((short)0)< (short) name.trim().length())
+ sheet.setColumnWidth((short)0, (short) name.trim().length());
+ if(sheet.getColumnWidth((short)1)< (short) value.trim().length())
+ sheet.setColumnWidth((short)1, (short) value.trim().length());
+ name = "";
+ value = "";
+
+ }
+
+ try {
+ SimpleDateFormat oracleDateFormat = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss");
+ Date sysdate = oracleDateFormat.parse(ReportLoader.getSystemDateTime());
+ SimpleDateFormat dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern());
+
+ row = sheet.createRow((short) ++rowNum);
+ cellNum = 0;
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue("Report Date/Time");
+ cell.setCellStyle(styleName);
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+
+ cell.setCellValue(dtimestamp.format(sysdate)+" "+Globals.getTimeZone());
+ cell.setCellStyle(styleValue);
+
+ } catch(Exception ex) {
+ //ex.printStackTrace();
+ }
+
+
+ }
+ }
+
+
+/* Iterator iter1 = paramsList.iterator();
+ s1 = 0; s2 = (short)10;
+ if(iter1.hasNext()) {
+ row = sheet.createRow((short) ++rowNum);
+ cellNum = 0;
+ cell = row.createCell((short) cellNum);
+ sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2));
+ cell.setCellValue(strip.stripHtml(customizedParamInfo));
+ }
+*/
+/* rowNum += 2;
+ row = sheet.createRow(rowNum);*/
+ } // if
+ Iterator iterCheck = paramsList.iterator();
+ if(iterCheck.hasNext()) {
+ rowNum += 2;
+ row = sheet.createRow(rowNum);
+ }
+ header.setCenter(HSSFHeader.font("Tahoma", "")+ HSSFHeader.fontSize((short) 9)+" " + strBuf.toString());
+ HSSFFooter footer = sheet.getFooter();
+ footer.setLeft(HSSFFooter.font("Tahoma", "")+ HSSFFooter.fontSize((short) 9)+ "Page " + HSSFFooter.page()
+ + " of " + HSSFFooter.numPages() );
+ footer.setCenter(HSSFFooter.font("Tahoma", "")+ HSSFFooter.fontSize((short) 9)+Globals.getFooterFirstLine()+"\n"+Globals.getFooterSecondLine());
+
+ }
+
+
+
+ private int paintExcelData(HSSFWorkbook wb, int rowNum, int col, ReportData rd,
+ HashMap styles, ReportRuntime rr, HSSFSheet sheet, String sql_whole, OutputStream sos, HttpServletRequest request) throws RaptorException {
+ int mb = 1024*1024;
+ Runtime runtime = Runtime.getRuntime();
+ int returnValue = 0;
+ // HSSFSheet sheet = wb.getSheetAt(0);
+ HSSFCellStyle styleDefault = wb.createCellStyle();
+ HSSFCellStyle styleNumber = wb.createCellStyle();
+ HSSFCellStyle styleDecimalNumber = wb.createCellStyle();
+ HSSFCellStyle styleCurrencyNumber = wb.createCellStyle();
+ HSSFCellStyle styleCurrencyDecimalNumber = wb.createCellStyle();
+ HSSFCellStyle styleDate = wb.createCellStyle();
+ HtmlStripper strip = new HtmlStripper();
+ //HSSFSheet sheet = wb.getSheet(getSheetName());
+ HSSFCellStyle styleDataHeader = wb.createCellStyle();
+ // style.setFillBackgroundColor(HSSFColor.AQUA.index);
+ styleDataHeader.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
+ styleDataHeader.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
+ styleDataHeader.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleDataHeader.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleDataHeader.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleDataHeader.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ styleDataHeader.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ HSSFFont font = wb.createFont();
+ font.setFontHeight((short) (font_size / 0.05));
+ font.setFontName("Tahoma");
+ font.setColor(HSSFColor.BLACK.index);
+ styleDataHeader.setFont(font);
+ // Column Header
+ boolean firstPass = true;
+ ArrayList cellWidth = new ArrayList();
+ java.util.HashMap dataTypeMap = new java.util.HashMap();
+ int cellNum = 0;
+ rowNum += 0;
+ ColumnHeaderRow chr = null;
+ String title = "";
+
+// System.out.println("***************** Size " + rd.reportColumnHeaderRows.size());
+// for (int i = 0; i < rd.reportColumnHeaderRows.size(); i++) {
+// for (int j = 0; j < rd.reportColumnHeaderRows.getColumnHeaderRow(i).size(); j++) {
+// System.out.println("Column Title " + rd.reportColumnHeaderRows.getColumnHeaderRow(i).getColumnHeader(j).getColumnTitle()
+// + " " + rd.reportColumnHeaderRows.getColumnHeaderRow(i).getColumnHeader(j).isVisible());
+// }
+// }
+/* List dsList = rr.getDataSourceList().getDataSource();
+ HashMap dataColumnTypeHashMap = new HashMap();
+ for (Iterator iter = dsList.iterator(); iter.hasNext();) {
+ DataSourceType element = (DataSourceType) iter.next();
+ List dcList = element.getDataColumnList().getDataColumn();
+ for (Iterator iterator = dcList.iterator(); iterator.hasNext();) {
+ DataColumnType element1 = (DataColumnType) iterator.next();
+ dataTypeMap.put(element1.getColId(), element1.getColType());
+ dataColumnTypeHashMap.put(element1.getColName(), element1);
+ }
+ }
+*/
+ int columnRows = rr.getVisibleColumnCount() - 1;
+
+ HttpSession session = request.getSession();
+ String drilldown_index = (String) session.getAttribute("drilldown_index");
+ int index = 0;
+ try {
+ index = Integer.parseInt(drilldown_index);
+ } catch (NumberFormatException ex) {
+ index = 0;
+ }
+ String header = (String) session.getAttribute("TITLE_"+index);
+ String subtitle = (String) session.getAttribute("SUBTITLE_"+index);
+ if(nvl(header).length()>0) {
+ header = Utils.replaceInString(header, "<BR/>", " ");
+ header = Utils.replaceInString(header, "<br/>", " ");
+ header = Utils.replaceInString(header, "<br>", " ");
+ header = strip.stripHtml(nvl(header).trim());
+ subtitle = Utils.replaceInString(subtitle, "<BR/>", " ");
+ subtitle = Utils.replaceInString(subtitle, "<br/>", " ");
+ subtitle = Utils.replaceInString(subtitle, "<br>", " ");
+ subtitle = strip.stripHtml(nvl(subtitle).trim());
+ HSSFRow row = sheet.createRow(rowNum);
+ cellNum = 0;
+ row.createCell((short) cellNum).setCellValue(header);
+ sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (columnRows)));
+ rowNum += 1;
+ row = sheet.createRow(rowNum);
+ cellNum = 0;
+ row.createCell((short) cellNum).setCellValue(subtitle);
+ sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (columnRows)));
+ rowNum += 1;
+ }
+
+ for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) {
+ HSSFRow row = sheet.createRow(rowNum);
+ cellNum = -1;
+ /*if(rd.reportTotalRowHeaderCols!=null) {
+ cellNum +=1;
+ row.createCell((short) cellNum).setCellValue("Total");
+ row.createCell((short) cellNum).setCellStyle(styleDataHeader);
+ //row.getCell((short) cellNum).setCellStyle(styleDataHeader);
+ }*/
+ chr = rd.reportColumnHeaderRows.getNext();
+
+ if(nvl(sql_whole).length() <= 0 || (!rr.getReportType().equals(AppConstants.RT_LINEAR))) {
+ if(rr.getReportType().equals(AppConstants.RT_CROSSTAB))
+ rd.reportRowHeaderCols.resetNext(0);
+ else
+ rd.reportRowHeaderCols.resetNext(1);
+
+ for (; rd.reportRowHeaderCols.hasNext();) {
+ cellNum += 1;
+ RowHeaderCol rhc = rd.reportRowHeaderCols.getNext();
+
+ if (firstPass) {
+ title = rhc.getColumnTitle();
+ title = Utils.replaceInString(title,"_nl_", " \n");
+ row.createCell((short) cellNum).setCellValue(title);
+ //commented after bug reported by EPAT 01/17/2015
+ //sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum+columnRows, (short) (cellNum)));
+ //System.out.println(" **************** Row Header Title " + rhc.getColumnTitle() + " " + cellNum + " " );
+ //System.out.println(cellNum + " " + cellWidth.size());
+ if (cellWidth.size() > 0 && cellWidth.size() > cellNum) {
+ if (((Integer) cellWidth.get(cellNum)).intValue() < rhc
+ .getColumnTitle().length())
+ cellWidth.set(cellNum, new Integer(title.length()));
+ } else
+ cellWidth.add(cellNum, new Integer(title.length()));
+ row.getCell((short) cellNum).setCellStyle(styleDataHeader);
+ }
+
+
+ } // for
+
+ }
+
+ firstPass = false;
+
+/* for(chr.resetNext(); chr.hasNext(); ) {
+ ColumnHeader ch = chr.getNext();
+ if(ch.isVisible()) {
+ cellNum += 1;
+ row.createCell((short) cellNum).setCellValue(ch.getColumnTitle());
+// <td align="center"<%= ch.getColumnWidthHtml() %><%= ch.getColSpanHtml() %><%= ch.getRowSpanHtml() %>>
+// <b class=rtableheader><%= ch.getColumnTitleHtml() %></b>
+// </td>
+ } // if
+ } // for
+*/
+
+ //cellNum = -1;
+
+
+// Set mapSet = dataTypeMap.entrySet();
+// Map.Entry me;
+// String element, value ;
+// for (Iterator iter = mapSet.iterator(); iter.hasNext();) {
+// me=(Map.Entry)iter.next();
+// element = (String) me.getKey();
+// value = (String) me.getValue();
+// System.out.println("DataTypeMap " + element + " " + value);
+// }
+
+ for (chr.resetNext(); chr.hasNext();) {
+ ColumnHeader ch = chr.getNext();
+ if(ch.isVisible()) {
+ cellNum += 1;
+
+ int colSpan = ch.getColSpan()-1;
+ title = ch.getColumnTitle();
+ title = Utils.replaceInString(title,"_nl_", " \n");
+ row.createCell((short) cellNum).setCellValue(title);
+ if(colSpan > 0) {
+ for ( int k = 1; k <= colSpan; k++ ) {
+ row.createCell((short) cellNum+k);
+ }
+ sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (cellNum+colSpan)));
+ }
+
+
+
+/* if (cellWidth.size() > cellNum) {
+ if (((Integer) cellWidth.get(cellNum)).intValue() < ch
+ .getColumnTitle().length())
+ cellWidth
+ .set((cellNum), new Integer(ch.getColumnTitle().length()));
+ } else
+ cellWidth.add((cellNum), new Integer(ch.getColumnTitle().length()));
+*/ row.getCell((short) (cellNum)).setCellStyle(styleDataHeader);
+ for ( int k = 1; k <= colSpan; k++ ) {
+ row.getCell((short) (cellNum+k)).setCellStyle(styleDataHeader);
+ }
+
+ if(colSpan > 0)
+ cellNum += colSpan;
+ }
+ } // for
+
+/* int cw = 0;
+ for (int i = 0; i < cellWidth.size(); i++) {
+ cw = ((Integer) cellWidth.get(i)).intValue() + 6;
+ sheet.setColumnWidth((short) (i), (short) ((cw * 8) / ((double) 1 / 20)));
+ }
+*/
+ rowNum += 1;
+ } // for
+
+
+ // Data
+ // Create some cell styles.
+ //HSSFCellStyle styleDefault = wb.createCellStyle();
+ HSSFCellStyle styleCell = null;
+
+ HSSFCellStyle styleTotal = wb.createCellStyle();
+ HSSFCellStyle styleCurrencyTotal = wb.createCellStyle();
+ HSSFCellStyle styleDefaultTotal = wb.createCellStyle();
+ HSSFCellStyle styleCurrencyDecimalNumberTotal = wb.createCellStyle();
+ HSSFCellStyle styleDecimalNumberTotal = wb.createCellStyle();
+ HSSFCellStyle styleCurrencyNumberTotal = wb.createCellStyle();
+
+
+ // Create some fonts.
+ HSSFFont fontDefault = wb.createFont();
+ HSSFFont fontBold = wb.createFont();
+ // Initialize the styles & fonts.
+ // The default will be plain .
+ fontDefault.setColor((short) HSSFFont.COLOR_NORMAL);
+ fontDefault.setFontHeight((short) (font_size / 0.05));
+ fontDefault.setFontName("Tahoma");
+
+ // The default will be bold black tachoma 10pt text.
+ fontBold.setColor((short) HSSFFont.COLOR_NORMAL);
+ fontBold.setFontHeight((short) (font_size / 0.05));
+ fontBold.setFontName("Tahoma");
+ fontBold.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
+ // Style default will be normal with no background
+ styleDefault.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleDefault.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleDefault.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleDefault.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleDefault.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleDefault.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleDefault.setFont(fontDefault);
+ styleDefault.setWrapText(true);
+ //Number
+ styleNumber.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleNumber.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleNumber.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleNumber.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleNumber.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleNumber.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleNumber.setFont(fontDefault);
+ try {
+ styleNumber.setDataFormat((short)0x26);//HSSFDataFormat.getBuiltinFormat("(#,##0_);[Red](#,##0)"));
+ } catch (Exception e) {
+
+ }
+ //Decimal Number
+ styleDecimalNumber.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleDecimalNumber.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleDecimalNumber.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleDecimalNumber.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleDecimalNumber.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleDecimalNumber.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleDecimalNumber.setFont(fontDefault);
+ styleDecimalNumber.setDataFormat((short)0x27);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)"));
+
+ //Decimal Number
+ styleDecimalNumberTotal.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleDecimalNumberTotal.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleDecimalNumberTotal.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleDecimalNumberTotal.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleDecimalNumberTotal.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleDecimalNumberTotal.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleDecimalNumberTotal.setFont(fontBold);
+ styleDecimalNumberTotal.setDataFormat((short)0x27);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)"));
+
+ //CurrencyNumber
+ styleCurrencyDecimalNumber.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleCurrencyDecimalNumber.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyDecimalNumber.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyDecimalNumber.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyDecimalNumber.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleCurrencyDecimalNumber.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleCurrencyDecimalNumber.setFont(fontDefault);
+ styleCurrencyDecimalNumber.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)"));
+
+ //currency number bold
+ styleCurrencyDecimalNumberTotal.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleCurrencyDecimalNumberTotal.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyDecimalNumberTotal.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyDecimalNumberTotal.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyDecimalNumberTotal.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleCurrencyDecimalNumberTotal.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleCurrencyDecimalNumberTotal.setFont(fontBold);
+ styleCurrencyDecimalNumberTotal.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)"));
+
+
+ //CurrencyNumber
+ styleCurrencyNumber.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleCurrencyNumber.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyNumber.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyNumber.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyNumber.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleCurrencyNumber.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleCurrencyNumber.setFont(fontDefault);
+ styleCurrencyNumber.setDataFormat((short) 6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)"));
+
+
+ //CurrencyNumber
+ styleCurrencyNumberTotal.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleCurrencyNumberTotal.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyNumberTotal.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyNumberTotal.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyNumberTotal.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleCurrencyNumberTotal.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleCurrencyNumberTotal.setFont(fontBold);
+ styleCurrencyNumberTotal.setDataFormat((short) 6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)"));
+
+ //Date
+ styleDate.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleDate.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleDate.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleDate.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleDate.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleDate.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleDate.setFont(fontDefault);
+ styleDate.setDataFormat((short)0xe);//HSSFDataFormat.getBuiltinFormat("m/d/yy"));
+
+ // Style for Total will be Bold with normal font with no background
+ styleTotal.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleTotal.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleTotal.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleTotal.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleTotal.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleTotal.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleTotal.setDataFormat((short)0x28);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)"));
+ styleTotal.setFont(fontBold);
+
+ styleCurrencyTotal.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleCurrencyTotal.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyTotal.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyTotal.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleCurrencyTotal.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleCurrencyTotal.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleCurrencyTotal.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)"));
+ styleCurrencyTotal.setFont(fontBold);
+
+ styleDefaultTotal.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleDefaultTotal.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleDefaultTotal.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleDefaultTotal.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleDefaultTotal.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleDefaultTotal.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleDefaultTotal.setDataFormat((short)0x28);
+ ////styleDefaultTotal.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)"));
+ styleDefaultTotal.setFont(fontBold);
+
+ firstPass = true;
+ // Declare a row object reference.
+ HSSFRow row = null;
+ // Declare a cell object reference.
+ HSSFCell cell = null;
+ //HSSFCell cellNumber = null;
+ //HSSFCell cellCurrencyNumber = null;
+ //HSSFCell cellDate = null;
+
+ //All the possible combinations of date format
+ SimpleDateFormat MMDDYYYYFormat = new SimpleDateFormat("MM/dd/yyyy");
+ SimpleDateFormat YYYYMMDDFormat = new SimpleDateFormat("yyyy/MM/dd");
+ SimpleDateFormat MONYYYYFormat = new SimpleDateFormat("MMM yyyy");
+ SimpleDateFormat MMYYYYFormat = new SimpleDateFormat("MM/yyyy");
+ SimpleDateFormat MMMMMDDYYYYFormat = new SimpleDateFormat("MMMMM dd, yyyy");
+ SimpleDateFormat YYYYMMDDDASHFormat = new SimpleDateFormat("yyyy-MM-dd");
+ SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ SimpleDateFormat DDMONYYYYFormat = new SimpleDateFormat("dd-MMM-yyyy");
+ SimpleDateFormat MONTHYYYYFormat = new SimpleDateFormat("MMMMM, yyyy");
+ SimpleDateFormat MMDDYYYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+ SimpleDateFormat MMDDYYYYHHMMFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");
+ SimpleDateFormat YYYYMMDDHHMMSSFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+ SimpleDateFormat YYYYMMDDHHMMFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");
+ SimpleDateFormat DDMONYYYYHHMMSSFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
+ SimpleDateFormat DDMONYYYYHHMMFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm");
+ SimpleDateFormat DDMONYYHHMMFormat = new SimpleDateFormat("dd-MMM-yy HH:mm");
+ SimpleDateFormat MMDDYYFormat = new SimpleDateFormat("MM/dd/yy");
+ SimpleDateFormat MMDDYYHHMMFormat = new SimpleDateFormat("MM/dd/yy HH:mm");
+ SimpleDateFormat MMDDYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
+ SimpleDateFormat MMDDYYYYHHMMZFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm z");
+ SimpleDateFormat MMMMMDDYYYYHHMMSS = new SimpleDateFormat("MMMMM-dd-yyyy HH:mm:ss");
+
+
+
+
+ ResultSet rs = null;
+ Connection conn = null;
+ Statement st = null;
+ ResultSetMetaData rsmd = null;
+ CreationHelper createHelper = wb.getCreationHelper();
+
+ if(nvl(sql_whole).length() >0 && rr.getReportType().equals(AppConstants.RT_LINEAR)) {
+ try {
+ conn = ConnectionUtils.getConnection(rr.getDbInfo());
+ st = conn.createStatement();
+ System.out.println("************* Map Whole SQL *************");
+ System.out.println(sql_whole);
+ System.out.println("*****************************************");
+ rs = st.executeQuery(sql_whole);
+ rsmd = rs.getMetaData();
+ int numberOfColumns = rsmd.getColumnCount();
+ HashMap colHash = new HashMap();
+ DataRow dr = null;
+ int j = 0;
+ int rowCount = 0;
+ while(rs.next()) {
+ rowCount++;
+ row = sheet.createRow(rowNum);
+ cellNum = -1;
+ colHash = new HashMap();
+ for (int i = 1; i <= numberOfColumns; i++) {
+ colHash.put(rsmd.getColumnLabel(i).toUpperCase(), strip.stripHtml(rs.getString(i)));
+ }
+ rd.reportDataRows.resetNext();
+ dr = rd.reportDataRows.getNext();
+ j = 0;
+ //if(rowCount%1000 == 0) wb.write(sos);
+
+ /*if(rd.reportTotalRowHeaderCols!=null) {
+ //cellNum = -1;
+ //for (rd.reportRowHeaderCols.resetNext(); rd.reportRowHeaderCols.hasNext();) {
+ cellNum += 1;
+ //RowHeaderCol rhc = rd.reportRowHeaderCols.getRowHeaderCol(0);
+ //if (firstPass)
+ // rhc.resetNext();
+ //RowHeader rh = rhc.getRowHeader(rowCount-1);
+ row.createCell((short) cellNum).setCellValue(rowCount);
+ row.getCell((short) cellNum).setCellStyle(styleDefault);
+ if (firstPass)
+ cellWidth.add(cellNum, new Integer((rowCount+"").length()));
+ else
+ cellWidth.set(cellNum, new Integer((rowCount+"").length()));
+
+ //} // for
+ }*/
+ firstPass = false;
+ //cellNum = -1;
+ for (dr.resetNext(); dr.hasNext();j++) {
+ //for (chr.resetNext(); chr.hasNext();) {
+ //ColumnHeader ch = chr.getNext();
+ styleCell = null;
+ DataValue dv = dr.getNext();
+ HtmlFormatter htmlFormat = dv.getCellFormatter();
+ if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null)
+ styleCell = (HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default"));
+ if (htmlFormat != null && dv.getFormatId() != null && styles != null)
+ styleCell = (HSSFCellStyle) styles.get(nvl(dv.getFormatId(),"default"));
+ String value = nvl((String)colHash.get(dv.getColId().toUpperCase()));
+
+ boolean bold = false;
+
+ if(dv.isVisible()) {
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+ //System.out.println("Stripping HTML 1");
+ //cell.setCellValue(strip.stripHtml(dv.getDisplayValue()));
+ String dataType = (String) (dataTypeMap.get(dv.getColId()));
+ //System.out.println("Value " + value + " " + (( dataType !=null && dataType.equals("DATE")) || (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date"))) );
+ if (dataType!=null && dataType.equals("NUMBER")){
+ //cellNumber = row.createCell((short) cellNum);
+ //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
+ //cellNumber.setCellValue(dv.getDisplayValue());
+ //cellCurrencyNumber = row.createCell((short) cellNum);
+ int zInt = 0;
+ if (value.equals("null")){
+ cell.setCellValue(zInt);
+ }else{
+
+ if ((value.indexOf("."))!= -1){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+
+ //if (dv.getDisplayValue().startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempDollar = dv.getDisplayValue().trim();
+ tempDollar = tempDollar.replaceAll(" ", "").substring(0);
+ tempDollar = tempDollar.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempDollar);
+ //System.out.println("Before copy Value |" + tempDollar);
+ //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1);
+ //System.out.println("After copy Value |" + tempDollar);
+ if ((tempDollar.indexOf(","))!= -1){
+ tempDollar = tempDollar.replaceAll(",", "");
+ }
+ //System.out.println("The final string 1 is "+tempDollar);
+ double tempDoubleDollar = 0.0;
+ try {
+ tempDoubleDollar = Double.parseDouble(tempDollar);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short) 8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleCurrencyDecimalNumber);
+ cell.setCellValue(tempDoubleDollar);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ //cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempDollar);
+ }
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ double tempDouble = 0.0;
+ try {
+ tempDouble = Double.parseDouble(value);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short)0x28);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDecimalNumber);
+ cell.setCellValue(tempDouble);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(value);
+ }
+
+ }
+ }else {
+ if (!(value.equals(""))){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ //if (dv.getDisplayValue().startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempInt = value.trim();
+ tempInt = tempInt.replaceAll(" ", "").substring(0);
+ tempInt = tempInt.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempInt);
+ //System.out.println("Before copy Value |" + tempInt);
+ //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1);
+ //System.out.println("After copy Value |" + tempInt);
+ if ((tempInt.indexOf(","))!= -1){
+ tempInt = tempInt.replaceAll(",", "");
+ }
+ //System.out.println("The final string INT is "+tempInt);
+ Long tempIntDollar = 0L;
+ try {
+ tempIntDollar = Long.parseLong(tempInt);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short) 6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleCurrencyNumber);
+ cell.setCellValue(tempIntDollar);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempInt);
+ }
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempStr = value.trim();
+ if ((tempStr.indexOf(","))!= -1){
+ tempStr = tempStr.replaceAll(",", "");
+ }
+ Long temp = 0L;
+
+ try {
+ temp = Long.parseLong(tempStr);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short) 0x26);//HSSFDataFormat.getBuiltinFormat("(#,##0_);[Red](#,##0)"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleNumber);
+ cell.setCellValue(temp);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempStr);
+ }
+
+
+ }
+ //int temp = Integer.parseInt(value.trim());
+ // cell.setCellValue(temp);
+ //}else{
+ // cell.setCellValue(strip.stripHtml(value));
+ //}
+ }
+ }
+ }
+
+ }else if ( ( dataType !=null && dataType.equals("DATE")) || (dv.getDisplayName()!=null && dv.getDisplayName().toLowerCase().endsWith("date")) ||
+ (dv.getColId()!=null && dv.getColId().toLowerCase().endsWith("date")) ||
+ (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date")) ) {
+ //cellDate = row.createCell((short) cellNum);
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("mm/dd/yy"));
+
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short) 0xe);//HSSFDataFormat.getBuiltinFormat("m/d/yy"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDate);
+ //String MY_DATE_FORMAT = "yyyy-MM-dd";
+ //value = nvl(value).length()<=0?nvl(dv.getDisplayValue()):value;
+ Date date = null;
+ int flag = 0;
+ date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy h:mm:ss"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yyyy h:mm:ss"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yyyy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yyyy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("yyyy/m/d"));
+ flag = 1;
+ }
+ if(date==null)
+ date = timestampFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("yyyy-m-d h:mm:ss")); //yyyy-MM-dd HH:mm:ss
+ flag = 1;
+ }
+ if(date==null)
+ date = MONYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("mmm yyyy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/yyyy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMMMMDDYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("mmm/d/yyyy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MONTHYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("mmm/yyyy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("yyyy/m/d h:mm:ss"));
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDDASHFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("yyyy-m-d"));
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("yyyy/m/d h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("d-mmm-yyyy h:mm:ss"));
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("d-mmm-yyyy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("d-mmm-yy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("d-mmm-yyyy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy h:mm:ss"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy h:mm:ss"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYHHMMZFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yyyy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMMMMDDYYYYHHMMSS.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yyyy h:mm"));
+ flag = 1;
+ }
+
+ if(date!=null) {
+ //System.out.println("ExcelDate " + HSSFDateUtil.getExcelDate(date));
+ cell.setCellValue(HSSFDateUtil.getExcelDate(date));
+ try {
+ String str = cell.getStringCellValue();
+ } catch (IllegalStateException ex) { /*cell.getCellStyle().setDataFormat((short)0);*/cell.setCellValue(value);}
+ } else {
+ /*cell.getCellStyle().setDataFormat((short)0);*/
+ cell.setCellValue(value);
+ }
+ //cellDate.setCellValue(date);
+ //cellDate.setCellValue(value); //cellDate.setCellValue(date);
+ //cellDate.setCellValue(dv.getDisplayValue());
+
+ }else if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){
+ //cellNumber = row.createCell((short) cellNum);
+ //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
+ //cellNumber.setCellValue(dv.getDisplayValue());
+ cell = row.createCell((short) cellNum);
+ int zInt = 0;
+ if (value.equals("null")){
+ cell.setCellValue(zInt);
+ }else{
+
+ if ((value.indexOf("."))!= -1){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempDollar = value.trim();
+ tempDollar = tempDollar.replaceAll(" ", "").substring(0);
+ tempDollar = tempDollar.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempDollar);
+ //System.out.println("Before copy Value |" + tempDollar);
+ //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1);
+ //System.out.println("After copy Value |" + tempDollar);
+ if ((tempDollar.indexOf(","))!= -1){
+ tempDollar = tempDollar.replaceAll(",", "");
+ }
+ //System.out.println("The final string 2IF is "+tempDollar);
+ double tempDoubleDollar = 0.0;
+ try {
+ tempDoubleDollar = Double.parseDouble(tempDollar);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short) 8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleCurrencyDecimalNumber);
+ cell.setCellValue(tempDoubleDollar);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempDollar);
+ }
+
+
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempDoubleStr = value.trim();
+ tempDoubleStr = tempDoubleStr.replaceAll(" ", "").substring(0);
+ if ((tempDoubleStr.indexOf(","))!= -1){
+ tempDoubleStr = tempDoubleStr.replaceAll(",", "");
+ }
+ double tempDouble = 0.0;
+ try {
+ tempDouble = Double.parseDouble(tempDoubleStr);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short)0x28 );//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDecimalNumber);
+ cell.setCellValue(tempDouble);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempDoubleStr);
+ }
+ }
+
+ }else {
+ if (!(value.equals(""))){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempInt = value.trim();
+ tempInt = tempInt.replaceAll(" ", "").substring(0);
+ tempInt = tempInt.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempInt);
+ //System.out.println("Before copy Value |" + tempInt);
+ //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1);
+ //System.out.println("After copy Value |" + tempInt);
+ if ((tempInt.indexOf(","))!= -1){
+ tempInt = tempInt.replaceAll(",", "");
+ }
+ //System.out.println("The final string INT 2 is "+tempInt);
+
+ Long tempIntDollar = 0L;
+
+ try {
+ tempIntDollar = Long.parseLong(tempInt);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short) 6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleCurrencyNumber);
+ cell.setCellValue(tempIntDollar);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempInt);
+ }
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempStr = value.trim();
+ if ((tempStr.indexOf(","))!= -1){
+ tempStr = tempStr.replaceAll(",", "");
+ }
+ Long temp = 0L;
+
+ try {
+ temp = Long.parseLong(tempStr);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short) 0x26);//HSSFDataFormat.getBuiltinFormat("(#,##0_);[Red](#,##0)"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleNumber);
+ cell.setCellValue(temp);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempStr);
+ }
+ }
+ //int temp = Integer.parseInt(dv.getDisplayValue().trim());
+ // cell.setCellValue(temp);
+ //}else{
+ // cell.setCellValue(strip.stripHtml(dv.getDisplayValue()));
+ //}
+ } else {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ }
+ }
+ }
+
+
+ }
+ else {
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("General"));
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(strip.stripHtml(value));
+ }
+
+ //if (!(value.equals(""))){
+ //int temp = Integer.parseInt(value.trim());
+ //cell.setCellValue(temp);
+ //}else{
+ // cell.setCellValue(strip.stripHtml(value));
+ //}
+ //HSSFCellStyle styleFormat = null;
+ //HSSFCellStyle numberStyle = null;
+ //HSSFFont formatFont = null;
+ //short fgcolor = 0;
+ //short fillpattern = 0;
+ if (cellWidth.size() > cellNum) {
+ if (((Integer) cellWidth.get(cellNum)).intValue() < dv
+ .getDisplayValue().length())
+ cellWidth.set((cellNum),
+ (value.length()<=Globals.getMaxCellWidthInExcel())?new Integer(value.length()):new Integer(Globals.getMaxCellWidthInExcel()));
+ } else
+ cellWidth.add((cellNum), (value.length()<=Globals.getMaxCellWidthInExcel())?new Integer(value.length()):new Integer(Globals.getMaxCellWidthInExcel()));
+ //System.out.println("1IF "+ (dv.isBold()) + " "+ value + " " + dv.getDisplayTotal() + " " + dv.getColName() );
+ if (dv.isBold()) {
+ if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){
+ if (value!=null && (value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ cell.setCellStyle(styleCurrencyTotal);
+ }
+ else {
+ cell.setCellStyle(styleTotal);
+ }
+ } else {
+ cell.setCellStyle(styleDefaultTotal);
+ }
+ bold = true;
+ }
+ //System.out.println("2IF "+ (dr.isRowFormat()) + " " + (dv.isCellFormat()) + " " + (styles!=null));
+ if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null) {
+ //cell.setCellStyle((HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default")));
+ continue;
+ }
+ //System.out.println("3IF "+ (htmlFormat != null) + " " + (dv.getFormatId() != null) + " " + (bold == false) + " "+ (styles != null));
+ if (htmlFormat != null && dv.getFormatId() != null && bold == false
+ && styles != null) {
+ //cell.setCellStyle((HSSFCellStyle) styles.get(nvl(dv.getFormatId(),"default")));
+ } //else if (bold == false)
+ //cell.setCellStyle(styleDefault);
+ } // dv.isVisible
+ }
+ rowNum += 1;
+
+ }
+
+ int cw = 0;
+ for (int i = 0; i < cellWidth.size(); i++) {
+ cw = ((Integer) cellWidth.get(i)).intValue() + 12;
+ // if(i!=cellWidth.size()-1)
+ sheet.setColumnWidth((short) (i), (short) ((cw * 8) / ((double) 1 / 20)));
+ // else
+ // sheet.setColumnWidth((short) (i + 1), (short) ((cw * 10) /
+ // ((double) 1 / 20)));
+ }
+
+ // To Display Total Values for Linear report
+ if(rd.reportDataTotalRow!=null) {
+ row = sheet.createRow(rowNum);
+ cellNum = -1;
+ rd.reportTotalRowHeaderCols.resetNext();
+ //for (rd.reportTotalRowHeaderCols.resetNext(); rd.reportTotalRowHeaderCols.hasNext();) {
+ cellNum += 1;
+ RowHeaderCol rhc = rd.reportTotalRowHeaderCols.getNext();
+ RowHeader rh = rhc.getRowHeader(0);
+ row.createCell((short) cellNum).setCellValue(strip.stripHtml(rh.getRowTitle()));
+ row.getCell((short) cellNum).setCellStyle(styleDefaultTotal);
+ //}
+
+ rd.reportDataTotalRow.resetNext();
+ DataRow drTotal = rd.reportDataTotalRow.getNext();
+ //cellNum = -1;
+
+ drTotal.resetNext();
+ drTotal.getNext();
+ for (; drTotal.hasNext();) {
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+ DataValue dv = drTotal.getNext();
+ String value = dv.getDisplayValue();
+ cell.setCellValue(value);
+ boolean bold = false;
+ if (dv.isBold()) {
+ if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){
+ if (value!=null && (value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ cell.setCellStyle(styleCurrencyTotal);
+ } else {
+ cell.setCellStyle(styleTotal);
+ }
+ } else {
+ cell.setCellStyle(styleDefaultTotal);
+ }
+ bold = true;
+ }
+ }
+ }
+
+ } catch (SQLException ex) {
+ ex.printStackTrace();
+ throw new RaptorException(ex);
+ } catch (ReportSQLException ex) {
+ throw new RaptorException(ex);
+ } catch (Exception ex) {
+ if(!(ex.getCause() instanceof java.net.SocketException) )
+ throw new RaptorException (ex);
+ } finally {
+ try {
+ if(conn!=null)
+ conn.close();
+ if(st!=null)
+ st.close();
+ if(rs!=null)
+ rs.close();
+ } catch (SQLException ex) {
+ throw new RaptorException(ex);
+ }
+ }
+
+ /*if(Globals.getShowDisclaimer() && !Globals.disclaimerPositionedTopInCSVExcel()) {
+ rowNum += 1;
+ row = sheet.createRow(rowNum);
+ cellNum = 0;
+ String disclaimer = Globals.getFooterFirstLine() + " " + Globals.getFooterSecondLine();
+ row.createCell((short) cellNum).setCellValue(disclaimer);
+ sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (columnRows)));
+ rowNum += 1;
+ }*/
+ } else {
+ if(rr.getReportType().equals(AppConstants.RT_LINEAR)) {
+ int rowCount = 0;
+ for (rd.reportDataRows.resetNext(); rd.reportDataRows.hasNext();) {
+ DataRow dr = rd.reportDataRows.getNext();
+ //List l = rd.getReportDataList();
+ //for (int dataRow = 0; dataRow < l.size(); dataRow++) {
+ rowCount++;
+
+
+ //DataRow dr = (DataRow) l.get(dataRow);
+ row = sheet.createRow(rowNum);
+
+ cellNum = -1;
+
+ if (rr.getReportType().equals(AppConstants.RT_LINEAR) && rd.reportTotalRowHeaderCols!=null) {
+ rd.reportRowHeaderCols.resetNext(0);
+ if(rd.reportTotalRowHeaderCols!=null) {
+ //cellNum = -1;
+ //for (rd.reportRowHeaderCols.resetNext(); rd.reportRowHeaderCols.hasNext();) {
+ //cellNum += 1;
+ //RowHeaderCol rhc = rd.reportRowHeaderCols.getRowHeaderCol(0);
+ //if (firstPass)
+ // rhc.resetNext();
+ //RowHeader rh = rhc.getRowHeader(rowCount-1);
+ //row.createCell((short) cellNum).setCellValue(rowCount);
+ //row.getCell((short) cellNum).setCellStyle(styleDefault);
+ //if (firstPass)
+ //cellWidth.add(cellNum, new Integer((rowCount+"").length()));
+ //else
+ //cellWidth.set(cellNum, new Integer((rowCount+"").length()));
+
+ //} // for
+ }
+
+ } else {
+ rd.reportRowHeaderCols.resetNext(0);
+ }
+ for (; rd.reportRowHeaderCols.hasNext();) {
+ cellNum += 1;
+ RowHeaderCol rhc = rd.reportRowHeaderCols.getNext();
+ if (firstPass)
+ rhc.resetNext();
+ RowHeader rh = rhc.getNext();
+ row.createCell((short) cellNum).setCellValue(strip.stripHtml(rh.getRowTitle()));
+ row.getCell((short) cellNum).setCellStyle(styleDefault);
+ if (cellWidth.size() > 0) {
+ if (((Integer) cellWidth.get(cellNum)).intValue() < rh.getRowTitle()
+ .length())
+ cellWidth.set(cellNum, new Integer(rh.getRowTitle().length()));
+ } else
+ cellWidth.add(cellNum, new Integer(rh.getRowTitle().length()));
+
+ } // for
+ firstPass = false;
+ //cellNum = -1;
+ int j = 0;
+
+ for (dr.resetNext(); dr.hasNext();j++) {
+ DataValue dv = dr.getNext();
+ styleCell = null;
+ boolean bold = false;
+ String value = nvl(dv.getDisplayValue());
+ value = strip.stripHtml(value);
+ HtmlFormatter htmlFormat = dv.getCellFormatter();
+ if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null)
+ styleCell = (HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default"));
+ if (htmlFormat != null && dv.getFormatId() != null && styles != null)
+ styleCell = (HSSFCellStyle) styles.get(nvl(dv.getFormatId(),"default"));
+
+ if(dv.isVisible()) {
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+ //System.out.println("Stripping HTML 1");
+ //cell.setCellValue(strip.stripHtml(value));
+ String dataType = (String) (dataTypeMap.get(dv.getColId()));
+ //System.out.println(" The Display Value is ********"+value + " " + dv.getDisplayTotal() + " " + dv.getColName());
+
+ if (dataType!=null && dataType.equals("NUMBER")){
+ //cellNumber = row.createCell((short) cellNum);
+ //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
+ //cellNumber.setCellValue(value);
+ //cellCurrencyNumber = row.createCell((short) cellNum);
+ int zInt = 0;
+ if (value.equals("null")){
+ cell.setCellValue(zInt);
+ }else{
+
+ if ((value.indexOf("."))!= -1){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempDollar = value.trim();
+ tempDollar = tempDollar.replaceAll(" ", "").substring(0);
+ tempDollar = tempDollar.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempDollar);
+ //System.out.println("Before copy Value |" + tempDollar);
+ //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1);
+ //System.out.println("After copy Value |" + tempDollar);
+ if ((tempDollar.indexOf(","))!= -1){
+ tempDollar = tempDollar.replaceAll(",", "");
+ }
+ //System.out.println("The final string 1 is "+tempDollar);
+ double tempDoubleDollar = 0.0;
+ try {
+ tempDoubleDollar = Double.parseDouble(tempDollar);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short) 8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleCurrencyDecimalNumber);
+ cell.setCellValue(tempDoubleDollar);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempDollar);
+ }
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ double tempDouble = 0.0;
+ try {
+ tempDouble = Double.parseDouble(value);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short) 0x28);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDecimalNumber);
+ cell.setCellValue(tempDouble);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(value);
+ }
+
+ }
+ }else {
+ if (!(value.equals(""))){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempInt = value.trim();
+ tempInt = tempInt.replaceAll(" ", "").substring(0);
+ tempInt = tempInt.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempInt);
+ //System.out.println("Before copy Value |" + tempInt);
+ //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1);
+ //System.out.println("After copy Value |" + tempInt);
+ if ((tempInt.indexOf(","))!= -1){
+ tempInt = tempInt.replaceAll(",", "");
+ }
+ //System.out.println("The final string INT is "+tempInt);
+ Long tempIntDollar = 0L;
+ try {
+ tempIntDollar = Long.parseLong(tempInt);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short)6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleCurrencyNumber);
+ cell.setCellValue(tempIntDollar);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempInt);
+ }
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempStr = value.trim();
+ if ((tempStr.indexOf(","))!= -1){
+ tempStr = tempStr.replaceAll(",", "");
+ }
+ Long temp = 0L;
+
+ try {
+ temp = Long.parseLong(tempStr);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short)0x26);//HSSFDataFormat.getBuiltinFormat("(#,##0_);[Red](#,##0)"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleNumber);
+ cell.setCellValue(temp);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempStr);
+ }
+
+
+ }
+ //int temp = Integer.parseInt(value.trim());
+ // cell.setCellValue(temp);
+ //}else{
+ // cell.setCellValue(strip.stripHtml(value));
+ //}
+ }
+ }
+ }
+
+ }else if ( ( dataType !=null && dataType.equals("DATE")) || (dv.getDisplayName()!=null && dv.getDisplayName().toLowerCase().endsWith("date")) ||
+ (dv.getColId()!=null && dv.getColId().toLowerCase().endsWith("date")) ||
+ (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date")) ) {
+ //cellDate = row.createCell((short) cellNum);
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("mm/dd/yy"));
+
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short)0xe); //HSSFDataFormat.getBuiltinFormat("m/d/yy"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDate);
+ //String MY_DATE_FORMAT = "yyyy-MM-dd";
+ Date date = null;
+ int flag = 0;
+ date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy h:mm:ss"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yyyy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yyyy h:mm:ss"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yyyy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("yyyy/m/d"));
+ flag = 1;
+ }
+ if(date==null)
+ date = timestampFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("yyyy-m-d h:mm:ss")); //yyyy-MM-dd HH:mm:ss
+ flag = 1;
+ }
+ if(date==null)
+ date = MONYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("mmm yyyy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/yyyy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMMMMDDYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("mmm/d/yyyy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MONTHYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("mmm/yyyy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("yyyy/m/d h:mm:ss"));
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDDASHFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("yyyy-m-d"));
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("yyyy/m/d h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("d-mmm-yyyy h:mm:ss"));
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("d-mmm-yyyy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("d-mmm-yy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("d-mmm-yyyy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy h:mm:ss"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yy h:mm:ss"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYHHMMZFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yyyy h:mm"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMMMMDDYYYYHHMMSS.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cell.getCellStyle().setDataFormat(
+ createHelper.createDataFormat().getFormat("m/d/yyyy h:mm"));
+ flag = 1;
+ }
+
+ if(date!=null) {
+ //System.out.println("ExcelDate " + HSSFDateUtil.getExcelDate(date));
+ cell.setCellValue(HSSFDateUtil.getExcelDate(date));
+ try {
+ String str = cell.getStringCellValue();
+ } catch (IllegalStateException ex) { /*cell.getCellStyle().setDataFormat((short)0);*/cell.setCellValue(value);}
+ } else {
+ /*cell.getCellStyle().setDataFormat((short)0);*/
+ cell.setCellValue(value);
+ }
+ //cellDate.setCellValue(date);
+ //cellDate.setCellValue(value);
+
+ }else if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){
+ //cellNumber = row.createCell((short) cellNum);
+ //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
+ //cellNumber.setCellValue(value);
+ cell = row.createCell((short) cellNum);
+ int zInt = 0;
+ if (value.equals("null")){
+ cell.setCellValue(zInt);
+ }else{
+
+ if ((value.indexOf("."))!= -1){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempDollar = value.trim();
+ tempDollar = tempDollar.replaceAll(" ", "").substring(0);
+ tempDollar = tempDollar.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempDollar);
+ //System.out.println("Before copy Value |" + tempDollar);
+ //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1);
+ //System.out.println("After copy Value |" + tempDollar);
+ if ((tempDollar.indexOf(","))!= -1){
+ tempDollar = tempDollar.replaceAll(",", "");
+ }
+ //System.out.println("The final string 2IF is "+tempDollar);
+ double tempDoubleDollar = 0.0;
+ try {
+ tempDoubleDollar = Double.parseDouble(tempDollar);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)"));
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleCurrencyDecimalNumber);
+ cell.setCellValue(tempDoubleDollar);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempDollar);
+ }
+
+
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempDoubleStr = value.trim();
+ tempDoubleStr = tempDoubleStr.replaceAll(" ", "").substring(0);
+ if ((tempDoubleStr.indexOf(","))!= -1){
+ tempDoubleStr = tempDoubleStr.replaceAll(",", "");
+ }
+ double tempDouble = 0.0;
+ try {
+ tempDouble = Double.parseDouble(tempDoubleStr);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short) 0x28); // for decimal
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDecimalNumber);
+ cell.setCellValue(tempDouble);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempDoubleStr);
+ }
+ }
+
+ }else {
+ if (!(value.equals(""))){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempInt = value.trim();
+ tempInt = tempInt.replaceAll(" ", "").substring(0);
+ tempInt = tempInt.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempInt);
+ //System.out.println("Before copy Value |" + tempInt);
+ //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1);
+ //System.out.println("After copy Value |" + tempInt);
+ if ((tempInt.indexOf(","))!= -1){
+ tempInt = tempInt.replaceAll(",", "");
+ }
+ //System.out.println("The final string INT 2 is "+tempInt);
+
+ Long tempIntDollar = 0L;
+
+ try {
+ tempIntDollar = Long.parseLong(tempInt);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short) 6);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleCurrencyNumber);
+ cell.setCellValue(tempIntDollar);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempInt);
+ }
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempStr = value.trim();
+ if ((tempStr.indexOf(","))!= -1){
+ tempStr = tempStr.replaceAll(",", "");
+ }
+ Long temp = 0L;
+
+ try {
+ temp = Long.parseLong(tempStr);
+ if(styleCell!=null) {
+ styleCell.setDataFormat((short) 0x26);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleNumber);
+ cell.setCellValue(temp);
+ } catch (NumberFormatException ne) {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempStr);
+ }
+ }
+ //int temp = Integer.parseInt(value.trim());
+ // cell.setCellValue(temp);
+ //}else{
+ // cell.setCellValue(strip.stripHtml(value));
+ //}
+ } else {
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ }
+ }
+ }
+
+
+ }
+ else {
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("General"));
+ if(styleCell!=null) {
+ styleCell.setWrapText(true);
+ cell.setCellStyle(styleCell);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(strip.stripHtml(value));
+ }
+
+ //if (!(value.equals(""))){
+ //int temp = Integer.parseInt(value.trim());
+ //cell.setCellValue(temp);
+ //}else{
+ // cell.setCellValue(strip.stripHtml(value));
+ //}
+ //HSSFCellStyle styleFormat = null;
+ //HSSFCellStyle numberStyle = null;
+ //HSSFFont formatFont = null;
+ //short fgcolor = 0;
+ //short fillpattern = 0;
+ if (cellWidth.size() > cellNum) {
+ if (((Integer) cellWidth.get(cellNum)).intValue() < dv
+ .getDisplayValue().length())
+ cellWidth.set((cellNum),
+ (value.length()<=Globals.getMaxCellWidthInExcel())?new Integer(value.length()):new Integer(Globals.getMaxCellWidthInExcel()));
+ } else
+ cellWidth.add((cellNum), (value.length()<=Globals.getMaxCellWidthInExcel())?new Integer(value.length()):new Integer(Globals.getMaxCellWidthInExcel()));
+ //System.out.println("1IF "+ (dv.isBold()) + " "+ value + " " + dv.getDisplayTotal() + " " + dv.getColName() );
+ if (dv.isBold()) {
+ if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){
+ if (value!=null && (value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ cell.setCellStyle(styleCurrencyTotal);
+ }
+ else {
+ cell.setCellStyle(styleTotal);
+ }
+ } else {
+ cell.setCellStyle(styleDefaultTotal);
+ }
+ bold = true;
+ }
+ //System.out.println("2IF "+ (dr.isRowFormat()) + " " + (dv.isCellFormat()) + " " + (styles!=null));
+ if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null) {
+ //cell.setCellStyle((HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default")));
+ continue;
+ }
+ //System.out.println("3IF "+ (htmlFormat != null) + " " + (dv.getFormatId() != null) + " " + (bold == false) + " "+ (styles != null));
+ if (htmlFormat != null && dv.getFormatId() != null && bold == false
+ && styles != null) {
+ // cell.setCellStyle((HSSFCellStyle) styles.get(nvl(dv.getFormatId(),"default")));
+ } //else if (bold == false)
+ //cell.setCellStyle(styleDefault);
+ } // if (dv.isVisible)
+ } // for
+
+ /*for (int tmp=0; tmp<dataTypeMap.size(); tmp++){
+ String dataTypeStr = (String)(dataTypeMap.get(tmp));
+ if(dataTypeStr.equals("NUMBER")){
+ cell.setCellStyle(styleNumber);
+ }else if (dataTypeStr.equals("VARCHAR2")){
+ cell.setCellStyle(styleDefault);
+
+ }else if (dataTypeStr.equals("DATE")){
+ cell.setCellStyle(styleDate);
+ }else{
+
+ }
+
+ }*/
+ rowNum += 1;
+ int cw = 0;
+ for (int i = 0; i < cellWidth.size(); i++) {
+ cw = ((Integer) cellWidth.get(i)).intValue() + 12;
+ // if(i!=cellWidth.size()-1)
+ sheet.setColumnWidth((short) (i), (short) ((cw * 8) / ((double) 1 / 20)));
+ // else
+ // sheet.setColumnWidth((short) (i + 1), (short) ((cw * 10) /
+ // ((double) 1 / 20)));
+ }
+
+ } // for
+
+ // To Display Total Values for Linear report
+ if(rd.reportDataTotalRow!=null) {
+ row = sheet.createRow(rowNum);
+ cellNum = -1;
+ rd.reportTotalRowHeaderCols.resetNext();
+ //for (rd.reportTotalRowHeaderCols.resetNext(); rd.reportTotalRowHeaderCols.hasNext();) {
+ cellNum += 1;
+ RowHeaderCol rhc = rd.reportTotalRowHeaderCols.getNext();
+ RowHeader rh = rhc.getRowHeader(0);
+ row.createCell((short) cellNum).setCellValue(strip.stripHtml(rh.getRowTitle()));
+ row.getCell((short) cellNum).setCellStyle(styleDefaultTotal);
+ //}
+
+ rd.reportDataTotalRow.resetNext();
+ DataRow drTotal = rd.reportDataTotalRow.getNext();
+ //cellNum = -1;
+
+ drTotal.resetNext();
+ drTotal.getNext();
+ for (; drTotal.hasNext();) {
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+ DataValue dv = drTotal.getNext();
+ String value = dv.getDisplayValue();
+ cell.setCellValue(value);
+ boolean bold = false;
+ if (dv.isBold()) {
+ if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){
+ if (value!=null && (value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ cell.setCellStyle(styleCurrencyTotal);
+ } else {
+ cell.setCellStyle(styleTotal);
+ }
+ } else {
+ cell.setCellStyle(styleDefaultTotal);
+ }
+ bold = true;
+ }
+ }
+ }
+
+ /*
+ if (rr.getReportType().equals(AppConstants.RT_LINEAR) && rd.reportTotalRowHeaderCols!=null) {
+
+ for (rd.reportDataTotalRow.resetNext(); rd.reportDataTotalRow.hasNext();) {
+ rowCount++;
+
+
+ DataRow dr = rd.reportDataTotalRow.getNext();
+ row = sheet.createRow(rowNum);
+ cellNum = -1;
+ int j = 0;
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue("Total");
+ cell.setCellStyle(styleTotal);
+
+ for (dr.resetNext(); dr.hasNext();j++) {
+ DataValue dv = dr.getNext();
+ if(j==0 || !dv.isVisible()) continue;
+ cellNum += 1;
+ styleCell = null;
+ boolean bold = true;
+ String value = nvl(dv.getDisplayValue());
+ //cellNumber = row.createCell((short) cellNum);
+ //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
+ //cellNumber.setCellValue(dv.getDisplayValue());
+ cell = row.createCell((short) cellNum);
+ int zInt = 0;
+ if (value.equals("null")){
+ cell.setCellValue(zInt);
+ }else{
+
+ if ((value.indexOf("."))!= -1){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempDollar = value.trim();
+ tempDollar = tempDollar.replaceAll(" ", "").substring(0);
+ tempDollar = tempDollar.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempDollar);
+ //System.out.println("Before copy Value |" + tempDollar);
+ //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1);
+ //System.out.println("After copy Value |" + tempDollar);
+ if ((tempDollar.indexOf(","))!= -1){
+ tempDollar = tempDollar.replaceAll(",", "");
+ }
+ //System.out.println("The final string 2IF is "+tempDollar);
+ double tempDoubleDollar = 0.0;
+ try {
+ tempDoubleDollar = Double.parseDouble(tempDollar);
+ if(styleTotal!=null) {
+ styleTotal.setDataFormat((short) 8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)"));
+ cell.setCellStyle(styleTotal);
+ } else
+ cell.setCellStyle(styleCurrencyDecimalNumberTotal);
+ cell.setCellValue(tempDoubleDollar);
+ } catch (NumberFormatException ne) {
+ if(styleTotal!=null) {
+ styleTotal.setWrapText(true);
+ cell.setCellStyle(styleTotal);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempDollar);
+ }
+
+
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempDoubleStr = value.trim();
+ tempDoubleStr = tempDoubleStr.replaceAll(" ", "").substring(0);
+ if ((tempDoubleStr.indexOf(","))!= -1){
+ tempDoubleStr = tempDoubleStr.replaceAll(",", "");
+ }
+ double tempDouble = 0.0;
+ try {
+ tempDouble = Double.parseDouble(tempDoubleStr);
+ if(styleTotal!=null) {
+ styleTotal.setDataFormat((short)0x28 );//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)"));
+ cell.setCellStyle(styleTotal);
+ } else
+ cell.setCellStyle(styleDecimalNumberTotal);
+ cell.setCellValue(tempDouble);
+ } catch (NumberFormatException ne) {
+ if(styleTotal!=null) {
+ styleTotal.setWrapText(true);
+ cell.setCellStyle(styleTotal);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempDoubleStr);
+ }
+ }
+
+ }else {
+ if (!(value.equals(""))){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempInt = value.trim();
+ tempInt = tempInt.replaceAll(" ", "").substring(0);
+ tempInt = tempInt.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempInt);
+ //System.out.println("Before copy Value |" + tempInt);
+ //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1);
+ //System.out.println("After copy Value |" + tempInt);
+ if ((tempInt.indexOf(","))!= -1){
+ tempInt = tempInt.replaceAll(",", "");
+ }
+ //System.out.println("The final string INT 2 is "+tempInt);
+
+ Long tempIntDollar = 0L;
+
+ try {
+ tempIntDollar = Long.parseLong(tempInt);
+ if(styleTotal!=null) {
+ styleTotal.setDataFormat((short) 6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)"));
+ cell.setCellStyle(styleTotal);
+ } else
+ cell.setCellStyle(styleCurrencyNumberTotal);
+ cell.setCellValue(tempIntDollar);
+ } catch (NumberFormatException ne) {
+ if(styleTotal!=null) {
+ styleTotal.setWrapText(true);
+ cell.setCellStyle(styleTotal);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempInt);
+ }
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempStr = value.trim();
+ if ((tempStr.indexOf(","))!= -1){
+ tempStr = tempStr.replaceAll(",", "");
+ }
+ Long temp = 0L;
+
+ try {
+ temp = Long.parseLong(tempStr);
+ if(styleTotal!=null) {
+ styleTotal.setDataFormat((short) 0x26);//HSSFDataFormat.getBuiltinFormat("(#,##0_);[Red](#,##0)"));
+ cell.setCellStyle(styleTotal);
+ } else
+ cell.setCellStyle(styleNumber);
+ cell.setCellValue(temp);
+ } catch (NumberFormatException ne) {
+ if(styleTotal!=null) {
+ styleTotal.setWrapText(true);
+ cell.setCellStyle(styleTotal);
+ } else
+ cell.setCellStyle(styleDefault);
+ cell.setCellValue(tempStr);
+ }
+ }
+ //int temp = Integer.parseInt(dv.getDisplayValue().trim());
+ // cell.setCellValue(temp);
+ //}else{
+ // cell.setCellValue(strip.stripHtml(dv.getDisplayValue()));
+ //}
+ } else {
+ if(styleTotal!=null) {
+ styleTotal.setWrapText(true);
+ cell.setCellStyle(styleTotal);
+ } else
+ cell.setCellStyle(styleDefault);
+ }
+ }
+ }
+
+
+
+
+ }
+ }
+ }
+ */
+
+
+
+ } else if (rr.getReportType().equals(AppConstants.RT_CROSSTAB)) { // Linear
+ int rowCount = 0;
+ List l = rd.getReportDataList();
+ boolean first = true;
+ for (int dataRow = 0; dataRow < l.size(); dataRow++) {
+
+
+ DataRow dr = (DataRow) l.get(dataRow);
+ row = sheet.createRow(rowNum);
+
+ cellNum = -1;
+ first = true;
+ Vector<DataValue> rowNames = dr.getRowValues();
+ for(dr.resetNext(); dr.hasNext(); rowCount++ ) {
+ if(first) {
+ if(rowNames!=null) {
+ for(int i=0; i<rowNames.size(); i++) {
+ DataValue dv = rowNames.get(i);
+ cellNum += 1;
+ row.createCell((short) cellNum).setCellValue(strip.stripHtml(dv.getDisplayValue()));
+ row.getCell((short) cellNum).setCellStyle(styleDefault);
+ }
+ }
+ }
+ first = false;
+
+ DataValue dv = dr.getNext();
+ if(dv.isVisible()) {
+ String value = dv.getDisplayValue();
+ if(value.indexOf("|#")!=-1)
+ value = value.substring(0,value.indexOf("|"));
+
+ if(dr.isRowFormat() || nvl(dv.getFormatId()).length()>0) {
+ cellNum += 1;
+ row.createCell((short) cellNum).setCellValue(strip.stripHtml(dv.getDisplayValue()));
+ //row.getCell((short) cellNum).setCellStyle(styleDefault);
+ if(nvl(dv.getFormatId()).length()>0)
+ row.getCell((short) cellNum).setCellStyle((HSSFCellStyle) styles.get(nvl(dv.getFormatId(),"default")));
+ else
+ row.setRowStyle((HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default")));
+ } else {
+ cellNum += 1;
+ row.createCell((short) cellNum).setCellValue(strip.stripHtml(value));
+ row.getCell((short) cellNum).setCellStyle(styleDefault);
+ } // end
+ value = dv.getDisplayValue();
+ if(value.indexOf("|#")!=-1) {
+ String color = value.substring(value.indexOf("|")+1);
+ if(color.equals("#FF0000"))
+ row.getCell((short) cellNum).setCellStyle((HSSFCellStyle) styles.get("red"));
+ else if (color.equals("#008000"))
+ row.getCell((short) cellNum).setCellStyle((HSSFCellStyle) styles.get("green"));
+ else if (color.equals("#FFFF00"))
+ row.getCell((short) cellNum).setCellStyle((HSSFCellStyle) styles.get("yellow"));
+ else {
+ row.getCell((short) cellNum).setCellStyle((HSSFCellStyle) styles.get("default"));
+ }
+
+ }
+ }
+ }
+ rowNum += 1;
+ int cw = 0;
+ for (int i = 0; i < cellWidth.size(); i++) {
+ cw = ((Integer) cellWidth.get(i)).intValue() + 12;
+ // if(i!=cellWidth.size()-1)
+ sheet.setColumnWidth((short) (i), (short) ((cw * 8) / ((double) 1 / 20)));
+ // else
+ // sheet.setColumnWidth((short) (i + 1), (short) ((cw * 10) /
+ // ((double) 1 / 20)));
+ }
+
+
+ } // for
+
+ }
+
+
+ }
+
+ String footer = (String) session.getAttribute("FOOTER_"+index);
+ if(nvl(footer).length()>0) {
+ footer = Utils.replaceInString(footer, "<BR/>", " ");
+ footer = Utils.replaceInString(footer, "<br/>", " ");
+ footer = Utils.replaceInString(footer, "<br>", " ");
+ footer = strip.stripHtml(nvl(footer).trim());
+ row = sheet.createRow(rowNum);
+ cellNum = 0;
+ row.createCell((short) cellNum).setCellValue(footer);
+ sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (columnRows)));
+ //sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum+columnRows, (short) (cellNum)));
+ rowNum += 1;
+ }
+
+ if(Globals.getShowDisclaimer() && !Globals.disclaimerPositionedTopInCSVExcel()) {
+
+ rowNum += 1;
+ row = sheet.createRow(rowNum);
+ cellNum = 0;
+ String disclaimer = Globals.getFooterFirstLine() + " " + Globals.getFooterSecondLine();
+ row.createCell((short) cellNum).setCellValue(disclaimer);
+ sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (columnRows)));
+ rowNum += 1;
+ }
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("##### Heap utilization statistics [MB] #####"));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Used Memory:"
+ + (runtime.maxMemory() - runtime.freeMemory()) / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Free Memory:"
+ + runtime.freeMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Total Memory:" + runtime.totalMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Max Memory:" + runtime.maxMemory() / mb));
+ return returnValue;
+
+ }
+
+ private void paintExcelHeader(HSSFWorkbook wb, int rowNum, int col, String reportTitle,
+ String reportDescr, HSSFSheet sheet) {
+ short s1 = 0, s2 = (short) (col-1);
+ rowNum += 1;
+ sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2));
+ HSSFRow row = null, row1 = null;
+
+ row = sheet.createRow(rowNum);
+ // Header Style
+ HSSFCellStyle styleHeader = wb.createCellStyle();
+ styleHeader.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ HSSFFont font = wb.createFont();
+ font.setFontHeight((short) (font_header_title_size / 0.05)); //14
+ font.setFontName("Tahoma");
+ font.setColor(HSSFColor.BLACK.index);
+ styleHeader.setFont(font);
+
+ HSSFCell cell = row.createCell((short) 0);
+ cell.setCellValue(reportTitle);
+ cell.setCellStyle(styleHeader);
+ HSSFHeader header = sheet.getHeader();
+ header.setCenter(HSSFHeader.font("Tahoma", "")+ HSSFHeader.fontSize((short) 9)+" " + reportTitle);
+
+ //header.setCenter(HSSFHeader.font("Tahoma", "")+ HSSFHeader.fontSize((short) 9)+reportTitle+"\n"+((Globals.getShowDescrAtRuntime() && nvl(reportDescr).length() > 0)?reportDescr:""));
+
+ // Report Description
+ if (Globals.getShowDescrAtRuntime() && nvl(reportDescr).length() > 0) {
+ rowNum += 1;
+ sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2));
+ HSSFCellStyle styleDescription = wb.createCellStyle();
+ styleDescription.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ HSSFFont fontDescr = wb.createFont();
+ fontDescr.setFontHeight((short) font_header_descr_size);
+ fontDescr.setFontName("Tahoma");
+ fontDescr.setColor(HSSFColor.BLACK.index);
+ styleDescription.setFont(fontDescr);
+ HSSFCell cellDescr = row.createCell((short) 0);
+ cellDescr.setCellValue(reportDescr);
+ cellDescr.setCellStyle(styleHeader);
+ }
+
+ if(Globals.disclaimerPositionedTopInCSVExcel()) {
+ rowNum += 1;
+ row = sheet.createRow(rowNum);
+ sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2));
+ HSSFCellStyle styleDescription = wb.createCellStyle();
+ styleDescription.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ HSSFFont fontDescr = wb.createFont();
+ fontDescr.setFontHeight((short) (font_size / 0.05)); //14
+ fontDescr.setFontName("Tahoma");
+ fontDescr.setColor(HSSFColor.BLACK.index);
+ fontDescr.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
+ styleDescription.setFont(fontDescr);
+ HSSFCell cellDescr = row.createCell((short) 0);
+ String disclaimer = Globals.getFooterFirstLine() + " " + Globals.getFooterSecondLine();
+ cellDescr.setCellValue(disclaimer);
+ cellDescr.setCellStyle(styleDescription);
+ }
+
+ rowNum += 1;
+ row = sheet.createRow(rowNum);
+ // System.out.println(" Last Row " + wb.getSheetAt(0).getLastRowNum());
+ }
+
+ private void paintExcelFooter(HSSFWorkbook wb, int rowNum, int col, HSSFSheet sheet) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("excel footer"));
+ //HSSFSheet sheet = wb.getSheet(getSheetName());
+ HSSFFooter footer = sheet.getFooter();
+ footer.setLeft(HSSFFooter.font("Tahoma", "")+ HSSFFooter.fontSize((short) font_footer_size)+ "Page " + HSSFFooter.page()
+ + " of " + HSSFFooter.numPages() );
+ footer.setCenter(HSSFFooter.font("Tahoma", "")+ HSSFFooter.fontSize((short) font_footer_size)+Globals.getFooterFirstLine()+"\n"+Globals.getFooterSecondLine());
+ //footer.setCenter(HSSFFooter.font("Tahoma", "Italic")+ HSSFFooter.fontSize((short) 16))+Globals.getFooterSecondLine());
+/* footer.font("Tahoma");
+ short s1 = 0, s2 = (short) (col-1);
+ rowNum += 1;
+ sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2));
+ HSSFRow row = null, row1 = null;
+
+ row = sheet.createRow(rowNum);
+ // Header Style
+ HSSFCellStyle styleFooter = wb.createCellStyle();
+ styleFooter.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ HSSFFont font = wb.createFont();
+ font.setFontHeight((short) (10 / 0.05));
+ font.setFontName("Tahoma");
+ font.setColor(HSSFColor.BLACK.index);
+ font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
+ styleFooter.setFont(font);
+
+ HSSFCell cell = row.createCell((short) 0);
+ debugLogger.debug(Globals.getFooterFirstLine());
+ cell.setCellValue(Globals.getFooterFirstLine());
+ cell.setCellStyle(styleFooter);
+
+ rowNum += 1;
+ sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2));
+ row = sheet.createRow(rowNum);
+ cell = row.createCell((short) 0);
+ debugLogger.debug(Globals.getFooterSecondLine());
+ cell.setCellValue(Globals.getFooterSecondLine());
+ cell.setCellStyle(styleFooter);
+*/
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Done"));
+ }
+
+ public String saveAsExcelFile(HttpServletRequest request, ReportData rd,
+ ArrayList reportParamNameValues, String reportTitle, String reportDescr) {
+ return saveAsExcelFile(request, rd, reportParamNameValues, reportTitle, reportDescr, 2); //2 denotes ReportRuntime object should be taken from session.
+ }
+ public String saveAsExcelFile(HttpServletRequest request, ReportData rd,
+ ArrayList reportParamNameValues, String reportTitle, String reportDescr, int requestFlag) {
+ setSheetName(Globals.getSheetName());
+ try {
+ ReportRuntime rr;
+ if(requestFlag == 2)
+ rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+ else
+ rr = (ReportRuntime) request.getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+ HSSFWorkbook wb = new HSSFWorkbook();
+ HashMap styles = new HashMap();
+ if (rr != null)
+ styles = loadStyles(rr, wb);
+ String xlsFName = AppUtils.generateUniqueFileName(request, rr.getReportName(), AppConstants.FT_XLS);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Xls File name " +
+ AppUtils.getTempFolderPath()
+ + xlsFName));
+ FileOutputStream xlsOut = new FileOutputStream(AppUtils.getTempFolderPath()
+ + xlsFName);
+ // BufferedWriter xlsOut = new BufferedWriter(new
+ // FileWriter(AppUtils
+ // .getTempFolderPath()
+ // + xlsFName));
+
+ int col = 0;
+ //System.out.println("Row Header Count " + rd.reportRowHeaderCols.getRowCount());
+ //System.out.println("Total Count " + rd.getTotalColumnCount());
+
+ if (!rd.reportRowHeaderCols.hasNext())
+ col = rd.getTotalColumnCount();
+ else
+ col = rd.getTotalColumnCount();
+ int rowNum = 0;
+ HSSFSheet sheet = wb.createSheet(getSheetName());
+
+ if (Globals.getPrintTitleInDownload()&& reportTitle != null ) {
+ paintExcelHeader(wb, rowNum, col, reportTitle, reportDescr, sheet);
+ rowNum = sheet.getLastRowNum();
+ } else
+ rowNum = 0;
+ if (Globals.getPrintParamsInDownload() && rr.getParamNameValuePairsforPDFExcel(request, 1) != null) {
+ paintExcelParams(wb,rowNum,col,rr.getParamNameValuePairsforPDFExcel(request, 1), rr.getFormFieldComments(request), sheet, reportTitle, reportDescr);
+ } // if
+ rowNum = sheet.getLastRowNum();
+ //System.out.println(" rowNum after Params " + rowNum);
+ paintExcelData(wb, rowNum, col, rd, styles,rr, sheet, "", xlsOut, request);
+ if (Globals.getPrintFooterInDownload() ) {
+ rowNum = sheet.getLastRowNum();
+ rowNum += 2;
+ paintExcelFooter(wb, rowNum, col, sheet);
+ }
+ //response.setContentType("application/vnd.ms-excel");
+ //response.setHeader("Content-disposition", "attachment;filename=download_all_"
+ // + user_id + ".xls");
+ wb.write(xlsOut);
+ xlsOut.flush();
+ xlsOut.close();
+ return xlsFName;
+ } catch (Exception e) {
+ e.printStackTrace();
+ (new ErrorHandler()).processError(request, "Exception saving data to EXCEL file: "
+ + e.getMessage());
+ return null;
+ }
+ } // saveAsExcelFile
+
+ public void createExcelFileContent(Writer out, ReportData rd, ReportRuntime rr, HttpServletRequest request,
+ HttpServletResponse response, String user_id, int type) throws IOException, RaptorException {
+ // Adding utility for downloading Dashboard reports.
+
+ HashMap styles = new HashMap();
+ HttpSession session = request.getSession();
+ ServletOutputStream sos = null;
+ BufferedInputStream buf = null;
+ HSSFWorkbook wb = null;
+// if(session.getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null)
+// ReportRuntime rrDashboard = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ String formattedDate = "";
+ String xlsFName = "";
+ int returnValue = 0;
+ boolean isDashboard = false;
+ if ((session.getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) && ( ((String) session.getAttribute(AppConstants.SI_DASHBOARD_REP_ID)).equals(rr.getReportID())) ) {
+ isDashboard = true;
+ }
+ if(isDashboard) {
+ try {
+ formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date());
+ xlsFName = "dashboard"+formattedDate+user_id+".xls";
+
+ FileInputStream xlsIn = null;
+ POIFSFileSystem fileSystem = null;
+ buf = null;
+ FileOutputStream xlsOut = null;
+
+
+/* try {
+ xlsIn = new FileInputStream (AppUtils.getTempFolderPath()
+ + xlsFName);
+ }
+ catch (FileNotFoundException e) {
+ System.out.println ("File not found in the specified path.");
+ e.printStackTrace ();
+ }
+ if(xlsIn != null) {
+ fileSystem = new POIFSFileSystem (xlsIn);
+ wb = new HSSFWorkbook(fileSystem);
+ } else {
+ xlsOut = new FileOutputStream(AppUtils.getTempFolderPath()
+ + xlsFName);
+ wb = new HSSFWorkbook();
+ }
+*/
+
+ Map reportRuntimeMap = null;
+ Map reportDataMap = null;
+ //Map reportDisplayTypeMap = null;
+ reportRuntimeMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP);
+ reportDataMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP);
+ //reportDisplayTypeMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI);
+ HSSFSheet sheet = null;
+ if(reportRuntimeMap!=null) {
+ //ServletOutputStream sos = response.getOutputStream();
+ Set setReportRuntime = reportRuntimeMap.entrySet();
+ Set setReportDataMap = reportDataMap.entrySet();
+ Iterator iter2 = setReportDataMap.iterator();
+ int count = 0;
+
+ for(Iterator iter = setReportRuntime.iterator(); iter.hasNext(); ) {
+ count++;
+ try {
+ xlsIn = new FileInputStream (AppUtils.getTempFolderPath()
+ + xlsFName);
+ }
+ catch (FileNotFoundException e) {
+ System.out.println ("File not found in the specified path.");
+ //e.printStackTrace ();
+ }
+ if(xlsIn != null) {
+ fileSystem = new POIFSFileSystem (xlsIn);
+ wb = new HSSFWorkbook(fileSystem);
+ xlsOut = new FileOutputStream(AppUtils.getTempFolderPath()
+ + xlsFName);
+ } else {
+ xlsOut = new FileOutputStream(AppUtils.getTempFolderPath()
+ + xlsFName);
+ wb = new HSSFWorkbook();
+ }
+
+ Map.Entry entryData = (Entry) iter2.next();
+ Map.Entry entry = (Entry) iter.next();
+ //String rep_id = (String) entry.getKey();
+ ReportRuntime rrDashRep = (ReportRuntime) entry.getValue();
+ ReportData rdDashRep = (ReportData) entryData.getValue();
+ //styles = loadStyles(rrDashRep, wb);
+ int col = 0;
+ String reportTitle = (nvl(rrDashRep.getReportTitle()).length()>0?rrDashRep.getReportTitle():rrDashRep.getReportName());
+ String reportDescr = rrDashRep.getReportDescr();
+ if (!rdDashRep.reportRowHeaderCols.hasNext())
+ col = rdDashRep.getTotalColumnCount();
+ else
+ col = rdDashRep.getTotalColumnCount();
+ if(col==0) col=10;
+ int rowNum = 0;
+ String formattedReportName = new HtmlStripper().stripSpecialCharacters(rrDashRep.getReportName());
+
+ try {
+ sheet = wb.createSheet(formattedReportName);
+ sheet.getPrintSetup().setLandscape(true);
+ styles = loadStyles(rrDashRep, wb);
+ } catch (IllegalArgumentException ex) { wb.write(xlsOut);xlsOut.flush();xlsOut.close();continue;}
+
+ if (Globals.getPrintTitleInDownload()&& reportTitle != null ) {
+ paintExcelHeader(wb, rowNum, col, reportTitle, reportDescr, sheet);
+ rowNum = sheet.getLastRowNum();
+ } else
+ rowNum = 0;
+ //getting ReportRuntime object from session
+ if (Globals.getPrintParamsInDownload() && rrDashRep.getParamNameValuePairsforPDFExcel(request, 1) != null) {
+ if(count > 1 && Globals.showParamsInAllDashboardReports())
+ paintExcelParams(wb,rowNum,col,rrDashRep.getParamNameValuePairsforPDFExcel(request, 1), rrDashRep.getFormFieldComments(request), sheet, reportTitle, reportDescr);
+ else if (count == 1)
+ paintExcelParams(wb,rowNum,col,rrDashRep.getParamNameValuePairsforPDFExcel(request, 1), rrDashRep.getFormFieldComments(request), sheet, reportTitle, reportDescr);
+ } // if
+ rowNum = sheet.getLastRowNum();
+ String sql_whole = rrDashRep.getWholeSQL();
+ returnValue = paintExcelData(wb, rowNum, col, rdDashRep, styles,rrDashRep, sheet, sql_whole, xlsOut, request);
+ if( returnValue == 0 ) {
+ if (Globals.getPrintFooterInDownload()) {
+ rowNum = sheet.getLastRowNum();
+ rowNum += 2;
+ paintExcelFooter(wb, rowNum, col, sheet);
+ }
+ //wb.write(sos);
+ wb.write(xlsOut);
+ //TODO Remove comment
+ xlsOut.flush();
+ xlsOut.close();
+ wb = null;
+ } else {
+ //xlsOut.flush();
+ //xlsOut.close();
+ //response.reset();
+ //response.setContentType("application/vnd.ms-excel");
+// RequestDispatcher dispatcher = request.getRequestDispatcher("raptor.htm?r_action=report.message");
+// request.setAttribute("message", Globals.getUserDefinedMessageForMemoryLimitReached());
+// try {
+// dispatcher.forward(request, response);
+// } catch (ServletException ex) {}
+ }
+ }
+
+ response.reset();
+ response.setContentType("application/vnd.ms-excel");
+ response.setHeader("Content-disposition", "attachment;filename="+"dashboard"+formattedDate+user_id+".xls");
+ sos = response.getOutputStream();
+ xlsIn = new FileInputStream (AppUtils.getTempFolderPath()
+ + xlsFName);
+ buf = new BufferedInputStream(xlsIn);
+ int readBytes = 0;
+ byte [] bOut = new byte [4096];
+ //read from the file; write to the ServletOutputStream
+ //while ((readBytes = buf.read()) != -1)
+ while ((readBytes = buf.read (bOut, 0, 4096))> 0) {
+ buf.available();
+ sos.write (bOut, 0, readBytes);
+ }
+
+ //sos.write(readBytes);
+ }
+ } catch (IOException ex) { ex.printStackTrace(); throw ex;}
+
+ finally {
+ if (sos != null)
+ sos.close();
+ if (buf != null)
+ buf.close();
+ }
+
+ File f = new File (AppUtils.getTempFolderPath()
+ + xlsFName);
+ if(f.exists()) f.delete();
+
+ } else {
+ wb = new HSSFWorkbook();
+ // PrintWriter xlsOut = new PrintWriter(out).;
+ setSheetName(Globals.getSheetName());
+ //ServletOutputStream sos = response.getOutputStream();
+ //PrintWriter outWriter = response.getWriter();
+ if (rr != null)
+ styles = loadStyles(rr, wb);
+ /* int col = 0;
+ if (!rd.reportRowHeaderCols.hasNext())
+ col = rd.getTotalColumnCount();
+ else
+ col = rd.getTotalColumnCount() + 1;
+ int rowNum = 0;
+ String reportTitle = rr.getReportName();
+ String reportDescr = rr.getReportDescr();
+ // if (Globals.getPrintTitleInDownload() && reportTitle != null) {
+ HSSFSheet sheet = wb.createSheet(getSheetName());
+ System.out.println(" Title " + Globals.getPrintTitleInDownload());
+
+ if (Globals.getPrintTitleInDownload()&& reportTitle != null ) {
+ paintExcelHeader(wb, rowNum, col, reportTitle, reportDescr);
+ rowNum = wb.getSheetAt(0).getLastRowNum();
+ } else
+ rowNum = 0;
+ System.out.println(" Params " + Globals.getPrintParamsInDownload());
+ if (Globals.getPrintParamsInDownload() && rr.getParamNameValuePairs() != null) {
+ paintExcelParams(wb,rowNum,col,rr.getParamNameValuePairs());
+ } // if
+ paintExcelData(wb, rowNum, col, rd, styles);
+ rowNum = wb.getSheetAt(0).getLastRowNum();
+ */
+ int col = 0;
+ //System.out.println("Row Header Count " + rd.reportRowHeaderCols.getRowCount());
+ //System.out.println("Total Count " + rd.getTotalColumnCount());
+ String reportTitle = (nvl(rr.getReportTitle()).length()>0?rr.getReportTitle():rr.getReportName());
+ String reportDescr = rr.getReportDescr();
+
+ col = getColumnCountForDownloadFile(rr,rd);
+ /*if (!rd.reportRowHeaderCols.hasNext())
+ col = rd.getTotalColumnCount();
+ else
+ col = rd.getTotalColumnCount();
+ */
+ int rowNum = 0;
+ HSSFSheet sheet = wb.createSheet(getSheetName());
+ sheet.getPrintSetup().setLandscape(true);
+
+ if (Globals.getPrintTitleInDownload()&& reportTitle != null ) {
+ paintExcelHeader(wb, rowNum, col, reportTitle, reportDescr, sheet);
+ rowNum = sheet.getLastRowNum();
+ } else
+ rowNum = 0;
+ if (Globals.getPrintParamsInDownload() && rr.getParamNameValuePairsforPDFExcel(request, 1) != null) {
+ ArrayList paramsList = rr.getParamNameValuePairsforPDFExcel(request, 1);
+ if(paramsList.size()<=0) {
+ paramsList = (ArrayList) request.getSession().getAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO);
+ }
+
+ paintExcelParams(wb,rowNum,col,paramsList, rr.getFormFieldComments(request), sheet, reportTitle, reportDescr);
+ } // if
+ rowNum = sheet.getLastRowNum();
+
+ String formattedReportName = new HtmlStripper().stripSpecialCharacters(rr.getReportName());
+ formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date());
+ response.reset();
+ response.setContentType("application/vnd.ms-excel");
+ response.setHeader("Content-disposition", "attachment;filename="+formattedReportName+formattedDate+user_id+".xls");
+ sos = response.getOutputStream();
+
+ if(type == 3 && rr.getSemaphoreList()==null && !(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) ) { //type = 3 is whole
+ //String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE);
+ String sql_whole = rr.getWholeSQL();
+ returnValue = paintExcelData(wb, rowNum, col, rd, styles,rr, sheet, sql_whole, sos, request);
+ } else if(type == 2) {
+ returnValue = paintExcelData(wb, rowNum, col, rd, styles,rr, sheet, "", sos, request);
+ } else {
+ //String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE);
+ int downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ String action = request.getParameter(AppConstants.RI_ACTION);
+ if(!(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) && !action.endsWith("session")) {
+ rd = rr.loadReportData(-1, AppUtils.getUserID(request), downloadLimit,request, false /*download*/);
+ }
+ if(rr.getSemaphoreList()!=null) {
+ if(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) {
+ returnValue = paintExcelData(wb, rowNum, col, rd, styles,rr, sheet, "", sos, request);
+ } else {
+ rd = rr.loadReportData(-1, AppUtils.getUserID(request), downloadLimit,request, true);
+ returnValue = paintExcelData(wb, rowNum, col, rd, styles,rr, sheet, "", sos, request);
+ }
+ } else {
+ returnValue = paintExcelData(wb, rowNum, col, rd, styles,rr, sheet, rr.getWholeSQL(), sos, request);
+ }
+ }
+ if( returnValue == 0 ) {
+ if (Globals.getPrintFooterInDownload()) {
+ rowNum = sheet.getLastRowNum();
+ rowNum += 2;
+ paintExcelFooter(wb, rowNum, col, sheet);
+ }
+ //Alternatively:
+ wb.setPrintArea(
+ 0, //sheet index
+ 0, //start column
+ col, //end column
+ 0, //start row
+ rowNum //end row
+ );
+ //TODO Remove comment
+ wb.write(sos);
+ sos.flush();
+ sos.close();
+ wb = null;
+ } else {
+ //sos.flush();
+ //sos.close();
+/* response.reset();
+
+ RequestDispatcher dispatcher = request.getRequestDispatcher("/raptor.htm?action=raptor&r_action=report.message");
+ request.setAttribute("message", Globals.getUserDefinedMessageForMemoryLimitReached());
+ try {
+ dispatcher.forward(request, response);
+ } catch (ServletException ex) {}
+*/
+ }
+ }
+ }
+
+
+ public void createFlatFileContent(Writer out, ReportData rd, ReportRuntime rr,
+ HttpServletRequest request, HttpServletResponse response, String user_id)
+ throws IOException, Exception {
+ ReportHandler rephandler = new ReportHandler();
+ String reportID = rr.getReportID();
+ rr = rephandler.loadReportRuntime(request, reportID);
+ String query = rr.getWholeSQL();
+ String dbInfo = rr.getDbInfo();
+ //File f = new File(request.(arg0)("/"));
+ DataSet ds = ConnectionUtils.getDataSet(query, dbInfo);
+
+ //Writing Column names to the file
+ List l = rr.getAllColumns();
+ StringBuffer allColumnsBuffer = new StringBuffer();
+ DataColumnType dct = null;
+
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ dct = (DataColumnType) iter.next();
+ allColumnsBuffer.append(dct.getDisplayName());
+ if(iter.hasNext())
+ allColumnsBuffer.append("|");
+ }
+ rd = rr.loadReportData(-1, user_id, -1,request, true);
+ //PrintWriter txtOut = new PrintWriter(out);
+ //response.setContentType("application/notepad");
+ //response.setHeader("Content-disposition", "attachment;filename=download_all_"+AppUtils.getUserID(request)+".txt");
+ ServletOutputStream sos = response.getOutputStream();
+
+ //No Report Title for flat file.
+// if (Globals.getPrintTitleInDownload() && reportTitle != null) {
+// txtOut.println();
+// txtOut.println("\"" + reportTitle + "\"");
+// txtOut.println();
+// if (Globals.getShowDescrAtRuntime() && nvl(reportDescr).length() > 0) {
+// txtOut.println("\"" + reportDescr + "\"");
+// txtOut.println();
+// }
+// } // if
+ // No Params either
+// int count = 0;
+// if (Globals.getPrintParamsInDownload() && reportParamNameValues != null) {
+// for (Iterator iter = reportParamNameValues.iterator(); iter.hasNext();) {
+// count += 1;
+// if(count == 1) txtOut.println();
+// IdNameValue value = (IdNameValue) iter.next();
+// txtOut.println(value.getId() + " = " + value.getName());
+// if(!iter.hasNext()) txtOut.println();
+// } // for
+// } // if
+
+
+
+ boolean firstPass = true;
+ for (rd.reportDataRows.resetNext(); rd.reportDataRows.hasNext();) {
+ DataRow dr = rd.reportDataRows.getNext();
+ for (rd.reportRowHeaderCols.resetNext(1); rd.reportRowHeaderCols.hasNext();) {
+ RowHeaderCol rhc = rd.reportRowHeaderCols.getNext();
+ if (firstPass)
+ rhc.resetNext();
+ RowHeader rh = rhc.getNext();
+
+ sos.print(rh.getRowTitle());
+ if(rhc.hasNext()) sos.print("|");
+ } // for
+ firstPass = false;
+
+ for (dr.resetNext(); dr.hasNext();) {
+ DataValue dv = dr.getNext();
+
+ sos.print( dv.getDisplayValue());
+ if(dr.hasNext()) sos.print("|");
+ } // for
+
+ sos.println();
+ } // for
+ //sos.flush();
+ sos.close();
+ } // createFlatFileContent
+
+
+ public void createExcel2007FileContent(Writer out, ReportData rd, ReportRuntime rr, HttpServletRequest request,
+ HttpServletResponse response, String user_id, int type)
+ throws Exception {
+
+ // to check performance
+ int mb = 1024*1024;
+ Runtime runtime = Runtime.getRuntime();
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("STARTING.EXCELX DOWNLOAD...."));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("##### Heap utilization statistics [MB] #####"));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Used Memory:"
+ + (runtime.totalMemory() - runtime.freeMemory()) / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Free Memory:"
+ + runtime.freeMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Total Memory:" + runtime.totalMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Max Memory:" + runtime.maxMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("##### END #####"));
+
+ // Adding utility for downloading Dashboard reports.
+
+ Map<String, XSSFCellStyle> styles = new HashMap<String, XSSFCellStyle>();
+ HttpSession session = request.getSession();
+ ServletOutputStream sos = null;
+ BufferedInputStream buf = null;
+ XSSFWorkbook wb = null;
+ String formattedReportName = new HtmlStripper().stripSpecialCharacters(rr.getReportName());
+ String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date());
+ //Sheet name to be filled is taken from property. How would this be called if it is Dashboard?
+ //commented out since application will create and leave it blank.
+ //setSheetName(Globals.getSheetName());
+ boolean isDashboard = false;
+ if ((session.getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) && ( ((String) session.getAttribute(AppConstants.SI_DASHBOARD_REP_ID)).equals(rr.getReportID())) ) {
+ isDashboard = true;
+ }
+ //boolean isDashboard = (session.getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null);
+ ArrayList sheetArrayList = new ArrayList();
+
+ Map reportRuntimeMap = null;
+ Map reportDataMap = null;
+
+ ArrayList reportIDList = new ArrayList();
+
+ //Map reportDisplayTypeMap = null;
+ if(isDashboard) {
+ reportRuntimeMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP);
+ reportDataMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP);
+
+ if(reportRuntimeMap!=null) {
+ Set setReportRuntime = reportRuntimeMap.entrySet();
+ for(Iterator iter = setReportRuntime.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ ReportRuntime rrDashRep = (ReportRuntime) entry.getValue();
+ reportIDList.add(rrDashRep.getReportID());
+ }
+ }
+ }
+
+
+
+
+ int col = 0;
+ String reportTitle = (nvl(rr.getReportTitle()).length()>0?rr.getReportTitle():rr.getReportName());
+ String reportDescr = rr.getReportDescr();
+
+ // Total Columns visible in excel
+ //col = getColumnCountForDownloadFile(rr, rd);
+
+ int rowNum = 0;
+
+
+ XSSFSheet sheet = null;
+ //save the template
+ String filename = "";
+ String extension = "";
+
+ String sheetRef = null;
+
+ FileOutputStream os = null; //template file
+ File templateFile = null;
+
+ if(isDashboard) {
+ if(reportRuntimeMap!=null) {
+
+ FileInputStream readTemplate = null;
+ //Load customized styles
+ int count = 0;
+
+ //If template supplied by Application
+ String templateFilename = rr.getTemplateFile();
+ extension = templateFilename.substring(templateFilename.lastIndexOf(".")+1);
+ filename = formattedReportName+formattedDate+user_id;
+
+ Set setReportRuntimeWB = reportRuntimeMap.entrySet();
+ for(Iterator iter = setReportRuntimeWB.iterator(); iter.hasNext(); ) {
+ count++;
+ Map.Entry entry = (Entry) iter.next();
+ ReportRuntime rrDashRep = (ReportRuntime) entry.getValue();
+ os = new FileOutputStream(AppUtils.getTempFolderPath()+ filename+"T."+ nvls(extension, "xlsx"));
+
+ if(count==1) {
+ if(nvl(rr.getTemplateFile()).length()>0) {
+ readTemplate = new FileInputStream(org.openecomp.portalsdk.analytics.system.AppUtils.getExcelTemplatePath()+rr.getTemplateFile());
+ wb=new XSSFWorkbook(readTemplate);
+ } else {
+ //copy the os file to new file and open new file in below line
+ wb=new XSSFWorkbook();
+ }
+ } else {
+ readTemplate = new FileInputStream(AppUtils.getTempFolderPath()+ filename+"."+ nvls(extension, "xlsx"));
+ wb=new XSSFWorkbook(readTemplate);
+ }
+ if(rrDashRep!=null)
+ styles = loadXSSFStyles(rrDashRep, wb, styles);
+ String reportSheetName = new HtmlStripper().stripSpecialCharacters(rrDashRep.getReportName());
+ if(nvl(reportSheetName).length()>28)
+ reportSheetName = reportSheetName.substring(0, 28);
+ sheet = wb.createSheet(count+"-"+reportSheetName);
+ if(!Globals.printExcelInLandscapeMode())
+ sheet.getPrintSetup().setLandscape(false);
+ else
+ sheet.getPrintSetup().setLandscape(true);
+ wb.write(os);
+ os.flush();
+ if(nvl(rr.getTemplateFile()).length()>0) {
+ readTemplate.close();
+ }
+ os.close();
+
+ FileInputStream inF = new FileInputStream(AppUtils.getTempFolderPath()+ filename+"T."+ nvls(extension, "xlsx"));
+ FileOutputStream outStream = new FileOutputStream(AppUtils.getTempFolderPath()+ filename+"."+ nvls(extension, "xlsx"));
+ copyStream(inF, outStream);
+ outStream.flush();
+ outStream.close();
+ inF.close();
+
+ }
+
+ FileInputStream xlsIn = null;
+ POIFSFileSystem fileSystem = null;
+ buf = null;
+ FileOutputStream xlsOut = null;
+ formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date());
+ String xlsFName = "dashboard"+formattedDate+user_id+".xls";
+
+ Set setReportRuntime = reportRuntimeMap.entrySet();
+ Set setReportDataMap = reportDataMap.entrySet();
+ Iterator iter2 = setReportDataMap.iterator();
+
+
+ //filename = templateFilename.substring(0, templateFilename.lastIndexOf("."))+"_"+formattedDate+user_id;
+
+ count = 0;
+ for(Iterator iter = setReportRuntime.iterator(); iter.hasNext(); ) {
+ count++;
+
+ Map.Entry entry = (Entry) iter.next();
+ Map.Entry entryData = (Entry) iter2.next();
+ ReportRuntime rrDashRep = (ReportRuntime) entry.getValue();
+ ReportData rdDashRep = (ReportData) entryData.getValue();
+
+ String reportSheetName = new HtmlStripper().stripSpecialCharacters(rrDashRep.getReportName());
+ if(nvl(reportSheetName).length()>28)
+ reportSheetName = reportSheetName.substring(0, 28);
+ sheet = wb.getSheet(count+"-"+reportSheetName);
+ sheetRef = sheet.getPackagePart().getPartName().getName();
+
+ //Step 2. Generate XML file.
+ File tmp = File.createTempFile("sheet", ".xml");
+ FileOutputStream fileOutTemp = new FileOutputStream(tmp);
+ Writer fw = new OutputStreamWriter(fileOutTemp, XML_ENCODING);
+ String sql_whole = rrDashRep.getWholeSQL();
+ SpreadsheetWriter sw = new SpreadsheetWriter(fw);
+ sw.beginSheet();
+
+
+ generate(wb, sw, styles, rdDashRep, sql_whole, rrDashRep, request, sheet);
+
+
+ sw.endSheet();
+
+ fw.flush();
+ fw.close();
+ fileOutTemp.flush();
+ fileOutTemp.close();
+
+
+ //Step 3. Substitute the template entry with the generated data
+
+ FileOutputStream outF = new FileOutputStream(AppUtils.getTempFolderPath()+ filename+"."+ nvls(extension, "xlsx"));
+ templateFile = new File(AppUtils.getTempFolderPath()+ filename+"T."+ nvls(extension, "xlsx"));
+ substitute(templateFile, tmp, sheetRef.substring(1), outF);
+ outF.flush();
+ outF.close();
+
+ FileInputStream inF = new FileInputStream(AppUtils.getTempFolderPath()+ filename+"."+ nvls(extension, "xlsx"));
+ FileOutputStream outStream = new FileOutputStream(AppUtils.getTempFolderPath()+ filename+"T."+ nvls(extension, "xlsx"));
+ copyStream(inF, outStream);
+ outStream.flush();
+ outStream.close();
+ inF.close();
+ }
+ }
+ } else {
+ //If template supplied by Application
+ if(nvl(rr.getTemplateFile()).length()>0) {
+ String templateFilename = rr.getTemplateFile();
+ extension = templateFilename.substring(templateFilename.lastIndexOf(".")+1);
+ filename = formattedReportName+formattedDate+user_id;
+ //filename = templateFilename.substring(0, templateFilename.lastIndexOf("."))+"_"+formattedDate+user_id;
+ } else
+ filename = formattedReportName+formattedDate+user_id;
+
+
+ if(nvl(rr.getTemplateFile()).length()<=0) {
+ os = new FileOutputStream(AppUtils.getTempFolderPath()+"template"+formattedDate+user_id+".xlsx");
+ wb=new XSSFWorkbook();
+ //Load customized styles
+ if (rr != null)
+ styles = loadXSSFStyles(rr, wb, styles);
+ //create data sheet
+ if(isDashboard) {
+
+ } else {
+
+ }
+ String reportSheetName = new HtmlStripper().stripSpecialCharacters(rr.getReportName());
+ if(nvl(reportSheetName).length()>28)
+ reportSheetName = reportSheetName.substring(0, 28);
+ sheet = wb.createSheet(reportSheetName);
+
+ //customized mode
+ if(!Globals.printExcelInLandscapeMode())
+ sheet.getPrintSetup().setLandscape(false);
+ else
+ sheet.getPrintSetup().setLandscape(true);
+ //get data sheet name
+ sheetRef = sheet.getPackagePart().getPartName().getName();
+ wb.write(os);
+ os.flush();
+ //wb = null;
+ os.close();
+
+ } else {
+ os = new FileOutputStream(AppUtils.getTempFolderPath()+ filename+"T."+ nvls(extension, "xlsx"));
+ FileInputStream readTemplate = new FileInputStream(org.openecomp.portalsdk.analytics.system.AppUtils.getExcelTemplatePath()+rr.getTemplateFile());
+ wb=new XSSFWorkbook(readTemplate);
+ if (rr != null)
+ styles = loadXSSFStyles(rr, wb, styles);
+ sheet = wb.getSheetAt(0);
+ if(!Globals.printExcelInLandscapeMode())
+ sheet.getPrintSetup().setLandscape(false);
+ else
+ sheet.getPrintSetup().setLandscape(true);
+ //sheet = wb.getSheet(getSheetName());
+ sheetRef = sheet.getPackagePart().getPartName().getName();
+ wb.write(os);
+ os.flush();
+ readTemplate.close();
+ //wb = null;
+ os.close();
+ }
+
+ //Step 2. Generate XML file.
+ File tmp = File.createTempFile("sheet", ".xml");
+ FileOutputStream fileOutTemp = new FileOutputStream(tmp);
+ Writer fw = new OutputStreamWriter(fileOutTemp, XML_ENCODING);
+
+ //String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE);
+ String sql_whole = "";
+ if (!rr.getReportType().equals(AppConstants.RT_HIVE))
+ sql_whole = rr.getWholeSQL();
+ else
+ sql_whole = rr.getReportSQL();
+
+ SpreadsheetWriter sw = new SpreadsheetWriter(fw);
+
+ sw.beginSheet();
+
+ if((rd.getDataRowCount() >= rr.getReportDataSize()) && !rr.getReportType().equals(AppConstants.RT_HIVE)) {
+ sql_whole="";
+ }
+
+ generate(wb, sw, styles, rd, sql_whole, rr, request, sheet);
+
+ sw.endSheet();
+
+ fw.flush();
+ fw.close();
+ fileOutTemp.flush();
+ fileOutTemp.close();
+
+
+ //Step 3. Substitute the template entry with the generated data
+
+ FileOutputStream outF = new FileOutputStream(AppUtils.getTempFolderPath()+ filename+"."+ nvls(extension, "xlsx"));
+
+ if(nvl(rr.getTemplateFile()).length()>0) {
+ templateFile = new File(AppUtils.getTempFolderPath()+ filename+"T."+ nvls(extension, "xlsx"));
+ } else
+ templateFile = new File(AppUtils.getTempFolderPath()+"template"+formattedDate+user_id+".xlsx");
+
+ substitute(templateFile, tmp, sheetRef.substring(1), outF);
+ outF.flush();
+ outF.close();
+
+ }
+ //get servlet output stream
+
+
+ response.reset();
+ sos = response.getOutputStream();
+ String mime_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+ if(extension.equals("xlsm"))
+ mime_type = "application/vnd.ms-excel.sheet.macroEnabled.12";
+ response.setContentType(mime_type);
+
+ response.setHeader("Content-disposition", "attachment;filename="+filename+"."+ nvls(extension, "xlsx"));
+
+ buf = new BufferedInputStream(new FileInputStream(AppUtils.getTempFolderPath()+filename + "."+ nvls(extension, "xlsx")));
+ int readBytes = 0;
+
+ //read from the file; write to the ServletOutputStream
+ while ((readBytes = buf.read()) != -1)
+ sos.write(readBytes);
+
+ buf.close();
+ sos.flush();
+ sos.close();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("ENDING..DOWNLOADING XLSX..."));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("##### Heap utilization statistics [MB] #####"));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Used Memory:"
+ + (runtime.totalMemory() - runtime.freeMemory()) / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Free Memory:"
+ + runtime.freeMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Total Memory:" + runtime.totalMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Max Memory:" + runtime.maxMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("##### END #####"));
+ }
+
+ /**
+ *
+ * @param zipfile the template file
+ * @param tmpfile the XML file with the sheet data
+ * @param entry the name of the sheet entry to substitute, e.g. xl/worksheets/sheet1.xml
+ * @param out the stream to write the result to
+ */
+ private static void substitute(File zipfile, File tmpfile, String entry, OutputStream out) throws IOException {
+ ZipFile zip = new ZipFile(zipfile);
+
+ ZipOutputStream zos = new ZipOutputStream(out);
+
+ @SuppressWarnings("unchecked")
+ Enumeration<ZipEntry> en = (Enumeration<ZipEntry>) zip.entries();
+ while (en.hasMoreElements()) {
+ ZipEntry ze = en.nextElement();
+ if(!ze.getName().equals(entry)){
+ zos.putNextEntry(new ZipEntry(ze.getName()));
+ InputStream is = zip.getInputStream(ze);
+ copyStream(is, zos);
+ is.close();
+ }
+ }
+ zos.putNextEntry(new ZipEntry(entry));
+ InputStream is = new FileInputStream(tmpfile);
+ copyStream(is, zos);
+ zos.flush();
+ zos.close();
+ is.close();
+ zip.close();
+ }
+
+ private static void copyStream(InputStream in, OutputStream out) throws IOException {
+ byte[] chunk = new byte[1024];
+ int count;
+ while ((count = in.read(chunk)) >=0 ) {
+ out.write(chunk,0,count);
+ }
+ }
+
+
+ public void createCSVFileContent(Writer out, ReportData rd,
+ ReportRuntime rr, HttpServletRequest request, HttpServletResponse response)
+ throws RaptorException {
+ //ArrayList reportParamNameValues = rr.getParamNameValuePairs();
+ //String reportTitle = rr.getReportName();
+ //String reportDescr = rr.getReportDescr();
+ PrintWriter csvOut = new PrintWriter(out);
+ ServletOutputStream sos = null;
+ BufferedInputStream buf = null;
+ String fileName = "";
+ String formattedReportName = new HtmlStripper().stripSpecialCharacters(rr.getReportName());
+ String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date());
+ String fName = formattedReportName+formattedDate+AppUtils.getUserID(request);
+ boolean raw = AppUtils.getRequestFlag(request, "raw");
+ String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE);
+
+
+ String csvFName = fName+".csv";
+ String zipFName = fName+".zip";
+ if(true) {
+ try {
+ fileName = AppUtils.getTempFolderPath()+""+csvFName;
+ csvOut = new PrintWriter(new BufferedWriter(
+ new OutputStreamWriter(
+ new FileOutputStream(fileName), "UTF-8")), false);
+ } catch (FileNotFoundException fex) {
+ fex.printStackTrace();
+ }
+ catch (UnsupportedEncodingException fex1) {
+ fex1.printStackTrace();
+ }
+ }
+ HtmlStripper strip = new HtmlStripper();
+ ResultSet rs = null;
+ //OracleConnection conn = null;
+ //OracleStatement st = null;
+ //Connection conO = null;
+ //Statement stO = null;
+ Connection conn = null;
+ Statement st = null;
+ ResultSetMetaData rsmd = null;
+ ColumnHeaderRow chr = null;
+ int mb = 1024*1024;
+ Runtime runtime = Runtime.getRuntime();
+ String valueName = "";
+ if(!raw) {
+ String reportTitle = (nvl(rr.getReportTitle()).length()>0?rr.getReportTitle():rr.getReportName());
+ csvOut.println();
+ csvOut.print("\"" + reportTitle + "\",");
+ csvOut.println();
+
+ if(Globals.disclaimerPositionedTopInCSVExcel()) {
+ if(Globals.getShowDisclaimer()) {
+ csvOut.println();
+ csvOut.print("\"" + Globals.getFooterFirstLine() + "\",");
+ csvOut.println();
+ csvOut.print("\"" + Globals.getFooterSecondLine() + "\",");
+ csvOut.println();
+ csvOut.println();
+ }
+ }
+ }
+ if (Globals.getPrintParamsInCSVDownload() && !raw) {
+ ArrayList paramsList = rr.getParamNameValuePairsforPDFExcel(request, 1);
+ if(paramsList.size()<=0) {
+ paramsList = (ArrayList) request.getSession().getAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO);
+ }
+ int paramSeq = 0;
+ for (Iterator iter = paramsList.iterator(); iter.hasNext();) {
+ IdNameValue value = (IdNameValue) iter.next();
+ //System.out.println("\"" + value.getId() + " = " + value.getName() + "\"");
+ if(nvl(value.getId()).trim().length()>0 && (!nvl(value.getId()).trim().equals("BLANK"))) {
+ paramSeq += 1;
+ if(paramSeq <= 1) {
+ csvOut.print("\"" + "Run-time Parameters" + "\"");
+ csvOut.println();
+ //strBuf.append("Run-time Parameters\n");
+ }
+ csvOut.print("\"" + value.getId() +":" + "\",");
+ valueName = nvl(value.getName());
+ if(valueName.indexOf("~")!= -1 && valueName.startsWith("(")) {
+ csvOut.print("\"'" + valueName.replaceAll("~",",")+ "'\",");
+ } else {
+ if(valueName.startsWith("(") && valueName.endsWith(")")) {
+ csvOut.print("\"" + valueName.replaceAll("~",",").substring(1, valueName.length()-1)+ "\",");
+ } else
+ csvOut.print("\"" + valueName.replaceAll("~",",")+ "\",");
+ }
+ csvOut.println();
+
+ //strBuf.append(value.getId()+": "+ value.getName()+"\n");
+ }
+ } //for
+ csvOut.println();
+ csvOut.println();
+ }
+
+ System.out.println("##### Heap utilization statistics [MB] #####");
+ System.out.println("Used Memory:"
+ + (runtime.maxMemory() - runtime.freeMemory()) / mb);
+ System.out.println("Free Memory:"
+ + runtime.freeMemory() / mb);
+ System.out.println("Total Memory:" + runtime.totalMemory() / mb);
+ System.out.println("Max Memory:" + runtime.maxMemory() / mb);
+ if (!rr.getReportType().equals(AppConstants.RT_HIVE))
+ sql_whole = rr.getWholeSQL();
+ else
+ sql_whole = rr.getReportSQL();
+ if(nvl(sql_whole).length()>0) {
+ try {
+ conn = ConnectionUtils.getConnection(rr.getDbInfo());
+ st = conn.createStatement();
+ //conn.setDefaultRowPrefetch(1000);
+ //st.setFetchDirection(ResultSet.TYPE_FORWARD_ONLY);
+ //st.setFetchSize(1000);
+ System.out.println("************* Map Whole SQL *************");
+ System.out.println(sql_whole);
+ System.out.println("*****************************************");
+ rs = st.executeQuery(sql_whole);
+ //st.setFetchSize(1000);
+ rsmd = rs.getMetaData();
+ int numberOfColumns = rsmd.getColumnCount();
+ HashMap colHash = new HashMap();
+ String title = "";
+
+ if(rd!=null) {
+
+ /*if(rd.reportTotalRowHeaderCols!=null) {
+ csvOut.print("\"" + "#" + "\",");
+ }*/
+
+ for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) {
+ chr = rd.reportColumnHeaderRows.getNext();
+ for (chr.resetNext(); chr.hasNext();) {
+ ColumnHeader ch = chr.getNext();
+ title = ch.getColumnTitle();
+ title = Utils.replaceInString(title,"_nl_", " \n");
+ if(ch.isVisible() && nvl(title).length()>0) {
+ csvOut.print("\"" + title + "\",");
+ for (int i = 1; i < ch.getColSpan(); i++)
+ csvOut.print(",");
+ }
+ } // for
+
+ csvOut.println();
+ } // for
+ int rowCount = 0;
+ while(rs.next()) {
+/* if(runtime.freeMemory()/mb <= ((runtime.maxMemory()/mb)*Globals.getMemoryThreshold()/100) ) {
+ csvOut.print(Globals.getUserDefinedMessageForMemoryLimitReached() + " " + rowCount +"records out of " + rr.getReportDataSize() + " were downloaded to CSV.");
+ break;
+ }
+*/ rowCount++;
+ //if(!raw) {
+ colHash = new HashMap();
+ for (int i = 1; i <= numberOfColumns; i++) {
+ colHash.put(rsmd.getColumnLabel(i).toUpperCase(), rs.getString(i));
+ }
+ /*if(rd.reportDataTotalRow!=null) {
+ csvOut.print("\"" + rowCount + "\",");
+ }*/
+ for (chr.resetNext(); chr.hasNext();) {
+ ColumnHeader ch = chr.getNext();
+ title = ch.getColumnTitle();
+ title = Utils.replaceInString(title,"_nl_", " \n");
+
+ if(ch.isVisible() && nvl(title).length()>0) {
+ csvOut.print("\"" + strip.stripCSVHtml(nvl((String)colHash.get(ch.getColId().toUpperCase()))) + "\",");
+ }
+
+ }
+ csvOut.println();
+ /*} else {
+ for (int i = 1; i <= numberOfColumns; i++) {
+ csvOut.print("\"" + strip.stripCSVHtml( rs.getString(i)) + "\",");
+ }
+ csvOut.println();
+ }*/
+
+ }
+
+ if(rd.reportDataTotalRow!=null) {
+ for (rd.reportDataTotalRow.resetNext(); rd.reportDataTotalRow.hasNext();) {
+ DataRow dr = rd.reportDataTotalRow.getNext();
+ csvOut.print("\"" + "Total" + "\",");
+ dr.resetNext();dr.getNext();
+ for (; dr.hasNext();) {
+ DataValue dv = dr.getNext();
+ if(dv.isVisible()) {
+ csvOut.print("\"" + strip.stripCSVHtml(dv.getDisplayValue()) + "\",");
+ }
+ } // for
+
+ csvOut.println();
+ }
+ }
+
+ if(rowCount == 0) {
+ csvOut.print("\"No Data Found \"");
+ }
+ } else {
+ csvOut.print("\"No Data Found \"");
+ }
+
+ } catch (SQLException ex) {
+ throw new RaptorException(ex);
+ } catch (ReportSQLException ex) {
+ throw new RaptorException(ex);
+ } catch (Exception ex) {
+ throw new RaptorException (ex);
+ } finally {
+ try {
+ if(conn!=null)
+ conn.close();
+ if(st!=null)
+ st.close();
+ if(rs!=null)
+ rs.close();
+ } catch (SQLException ex) {
+ throw new RaptorException(ex);
+ }
+ }
+
+ if(!raw) {
+ if(!Globals.disclaimerPositionedTopInCSVExcel()) {
+ if(Globals.getShowDisclaimer()) {
+ csvOut.print("\"" + Globals.getFooterFirstLine() + "\",");
+ csvOut.println();
+ csvOut.print("\"" + Globals.getFooterSecondLine() + "\",");
+ csvOut.println();
+ }
+ }
+ }
+
+ // csvOut.flush();
+ } else {
+ boolean firstPass = true;
+ if(rd!=null) {
+ if(rd.reportTotalRowHeaderCols!=null) {
+ csvOut.print("\"" + "#" + "\",");
+ }
+
+ for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) {
+ chr = rd.reportColumnHeaderRows.getNext();
+ for (rd.reportRowHeaderCols.resetNext(1); rd.reportRowHeaderCols.hasNext();) {
+ RowHeaderCol rhc = rd.reportRowHeaderCols.getNext();
+
+ if (firstPass)
+ csvOut.print("\"" + rhc.getColumnTitle() + "\"");
+ csvOut.print(",");
+ } // for
+ firstPass = false;
+
+ for (chr.resetNext(); chr.hasNext();) {
+ ColumnHeader ch = chr.getNext();
+ if(ch.isVisible()) {
+ csvOut.print("\"" + ch.getColumnTitle() + "\",");
+ for (int i = 1; i < ch.getColSpan(); i++)
+ csvOut.print(",");
+ }
+ } // for
+
+ csvOut.println();
+ } // for
+
+ firstPass = true;
+ int rowCount = 0;
+ for (rd.reportDataRows.resetNext(); rd.reportDataRows.hasNext();) {
+ if(rd.reportDataTotalRow!=null) {
+ rowCount++;
+ csvOut.print("\"" + rowCount + "\",");
+ }
+
+ DataRow dr = rd.reportDataRows.getNext();
+
+ for (rd.reportRowHeaderCols.resetNext(1); rd.reportRowHeaderCols.hasNext();) {
+ RowHeaderCol rhc = rd.reportRowHeaderCols.getNext();
+ if (firstPass)
+ rhc.resetNext();
+ RowHeader rh = rhc.getNext();
+
+ csvOut.print("\"" + strip.stripCSVHtml(rh.getRowTitle()) + "\",");
+ } // for
+ firstPass = false;
+
+ for (dr.resetNext(); dr.hasNext();) {
+ DataValue dv = dr.getNext();
+ if(dv.isVisible())
+ csvOut.print("\"" + strip.stripCSVHtml(dv.getDisplayValue()) + "\",");
+ } // for
+
+ csvOut.println();
+ } // for
+ if(rd.reportDataTotalRow!=null) {
+ for (rd.reportDataTotalRow.resetNext(); rd.reportDataTotalRow.hasNext();) {
+ DataRow dr = rd.reportDataTotalRow.getNext();
+ csvOut.print("\"" + "Total" + "\",");
+ firstPass = false;
+
+ for (dr.resetNext(); dr.hasNext();) {
+ DataValue dv = dr.getNext();
+ if(dv.isVisible())
+ csvOut.print("\"" + strip.stripCSVHtml(dv.getDisplayValue()) + "\",");
+ } // for
+
+ csvOut.println();
+ }
+ }
+
+ if(!raw) {
+ if(!Globals.disclaimerPositionedTopInCSVExcel()) {
+ if(Globals.getShowDisclaimer()) {
+ csvOut.print("\"" + Globals.getFooterFirstLine() + "\",");
+ csvOut.println();
+ csvOut.print("\"" + Globals.getFooterSecondLine() + "\",");
+ csvOut.println();
+ }
+ }
+ }
+
+ //csvOut.flush();
+ } else {
+ csvOut.print("\"No Data Found \"");
+ }
+ }
+ csvOut.flush();
+ csvOut.close();
+
+/*
+ if (Globals.getPrintTitleInDownload() && reportTitle != null) {
+ csvOut.println();
+ csvOut.println("\"" + reportTitle + "\"");
+ csvOut.println();
+ if (Globals.getShowDescrAtRuntime() && nvl(reportDescr).length() > 0) {
+ csvOut.println("\"" + reportDescr + "\"");
+ csvOut.println();
+ }
+ } // if
+
+ if (Globals.getPrintParamsInDownload() && reportParamNameValues != null) {
+ csvOut.println();
+ for (Iterator iter = reportParamNameValues.iterator(); iter.hasNext();) {
+ IdNameValue value = (IdNameValue) iter.next();
+ csvOut.println("\"" + value.getId() + " = " + value.getName() + "\"");
+ } // for
+ csvOut.println();
+ } // if
+*/
+ if(true && !raw) {
+ try {
+
+ //final int BUFFER = 2048;
+
+ //fis.read(buf,0,buf.length);
+ int size = 0;
+ byte[] buffer = new byte[1024];
+
+ //CRC32 crc = new CRC32();
+ //PrintStream fos = new PrintStream(new WriterOutputStream(out));
+ //BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER);
+ //ZipOutputStream s = new ZipOutputStream(dest);
+ ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(AppUtils.getTempFolderPath()+""+zipFName));
+ FileInputStream fis = new FileInputStream(fileName);
+
+ //s.setLevel(6);
+
+ ZipEntry entry = new ZipEntry(csvFName);
+ //crc.reset();
+ zos.putNextEntry(entry);
+
+ // read data to the end of the source file and write it to the zip
+ // output stream.
+ while ((size = fis.read(buffer, 0, buffer.length)) > 0) {
+ zos.write(buffer, 0, size);
+ }
+
+ zos.closeEntry();
+ fis.close();
+
+ // Finish zip process
+ zos.close();
+
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ response.reset();
+ java.io.File file = null;
+
+ if(true && !raw) {
+ response.setContentType("application/octet-stream");
+ response.setHeader("Content-disposition","attachment;filename="+fName+".zip");
+ file = new java.io.File(AppUtils.getTempFolderPath()+""+fName+".zip");
+ } else {
+ response.setContentType("application/csv");
+ response.setHeader("Content-disposition","attachment;filename="+fName+".csv");
+ file = new java.io.File(AppUtils.getTempFolderPath()+""+fName+".csv");
+ }
+
+
+ FileInputStream fileIn = null;
+ int c;
+ try {
+ sos = response.getOutputStream();
+ fileIn = new FileInputStream(file);
+ buf = new BufferedInputStream(fileIn);
+ byte [] bOut = new byte [4096];
+ //read from the file; write to the ServletOutputStream
+ //while ((readBytes = buf.read()) != -1)
+ int readBytes = 0;
+ while ((readBytes = buf.read (bOut, 0, 4096))> 0) {
+ buf.available();
+ sos.write (bOut, 0, readBytes);
+ }
+
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if (sos != null)
+ sos.close();
+ if (buf != null)
+ buf.close();
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ File f = new File (AppUtils.getTempFolderPath()
+ + fName);
+ if(f.exists()) f.delete();
+ System.out.println("##### Heap utilization statistics [MB] #####");
+ System.out.println("Used Memory:"
+ + (runtime.maxMemory() - runtime.freeMemory()) / mb);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Free Memory:"
+ + runtime.freeMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Total Memory:" + runtime.totalMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Max Memory:" + runtime.maxMemory() / mb));
+
+ } // createCSVFileContent
+
+/* public String saveCSVPageFile(HttpServletRequest request, ReportData rd,
+ ArrayList reportParamNameValues, String reportTitle, String reportDescr) {
+ try {
+ String formattedReportName = new HtmlStripper().stripSpecialCharacters(reportTitle);
+ String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date());
+
+ String csvFName = formattedReportName+formattedDate+AppUtils.getUserID(request)+".csv";
+ //String csvFName = AppUtils.generateFileName(request, AppConstants.FT_CSV);
+
+ BufferedWriter csvOut = new BufferedWriter(new FileWriter(AppUtils
+ .getTempFolderPath()
+ + csvFName));
+ createCSVFileContent(csvOut, rd, reportParamNameValues, reportTitle, reportDescr);
+ csvOut.close();
+
+ return csvFName;
+ } catch (Exception e) {
+ (new ErrorHandler()).processError(request, "Exception saving data to CSV file: "
+ + e.getMessage());
+ return null;
+ }
+ } // saveCSVPageFile
+*/
+
+// public String saveAsFlatFile(HttpServletRequest request, ReportData rd,
+// ReportRuntime rr, String reportTitle, String reportDescr) {
+// try {
+// String csvFName = AppUtils.generateFileName(request, AppConstants.FT_TXT);
+//
+// BufferedWriter txtOut = new BufferedWriter(new FileWriter(AppUtils
+// .getTempFolderPath()
+// + csvFName));
+// createFlatFileContent(txtOut, rd, rr, reportTitle, reportDescr);
+// txtOut.close();
+//
+// return csvFName;
+// } catch (Exception e) {
+// (new ErrorHandler()).processError(request, "Exception saving data to CSV file: "
+// + e.getMessage());
+// return null;
+// }
+// } // saveCSVPageFile
+
+ public String saveXMLFile(HttpServletRequest request, String reportName, String reportXML) {
+ try {
+ String xmlFName = AppUtils.generateUniqueFileName(request, reportName, AppConstants.FT_XML);
+
+ PrintWriter xmlOut = new PrintWriter(new BufferedWriter(new FileWriter(new File(
+ AppUtils.getTempFolderPath() + xmlFName))));
+ xmlOut.println(reportXML);
+ xmlOut.close();
+
+ //return AppUtils.getTempFolderURL()
+ // + java.net.URLEncoder.encode(java.net.URLDecoder.decode(xmlFName));
+ return java.net.URLEncoder.encode(java.net.URLDecoder.decode(xmlFName));
+
+ } catch (Exception e) {
+ (new ErrorHandler()).processError(request,
+ "Exception saving XML source to file system: " + e.getMessage());
+ return null;
+ }
+ } // saveXMLFile
+
+ public ReportRuntime loadReportRuntime(HttpServletRequest request, String reportID)
+ throws RaptorException {
+ return loadReportRuntime(request, reportID, true);
+ } // loadReportRuntime
+
+ public ReportRuntime loadReportRuntime(HttpServletRequest request, String reportID,
+ boolean prepareForExecution) throws RaptorException {
+ return loadReportRuntime(request, reportID, true, 2); // where 2 is adding to session
+ }
+ public ReportRuntime loadReportRuntime(HttpServletRequest request, String reportID,
+ boolean prepareForExecution, int requestFlag) throws RaptorException {
+ boolean refresh = nvl(request.getParameter(AppConstants.RI_REFRESH)).toUpperCase().startsWith("Y");
+ boolean rDisplayContent = AppUtils.getRequestFlag(request,
+ AppConstants.RI_DISPLAY_CONTENT)
+ || AppUtils.getRequestFlag(request, "noFormFields");
+
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+ boolean inSchedule = AppUtils.getRequestFlag(request, AppConstants.SCHEDULE_ACTION);
+ if (rr != null ) {
+ if(requestFlag == 7) { // DASH
+ String reportXML = ReportLoader.loadCustomReportXML(reportID);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Report [" + reportID + "]: XML loaded"));
+ rr = ReportRuntime.unmarshal(reportXML, reportID, request);
+ rr.setParamValues(request, false,refresh);
+ rr.setDisplayFlags(true, true); // show content even at the first time
+ return rr;
+ } else {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Load Report Runtime "+ reportID + " " +rr.getReportID() + " " + request.getParameter("refresh") ));
+ if (reportID.equals(rr.getReportID()) && (request.getParameter("refresh")==null || !request.getParameter("refresh").equals("Y"))) {
+ // The report runtime is already in the session
+ if (prepareForExecution) {
+ boolean resetParams = AppUtils.getRequestFlag(request,
+ AppConstants.RI_RESET_PARAMS);
+ rr.setParamValues(request, resetParams,refresh);
+
+ if (resetParams)
+ rr.resetVisualSettings();
+ rr.setDisplayFlags(nvl(request.getParameter(AppConstants.RI_SOURCE_PAGE))
+ .length() == 0, rDisplayContent || rr.isDisplayOptionHideForm());
+ } // if
+
+ return rr;
+ } // if
+ }
+ }
+
+ /*
+ * Cannot convert the definition => XML file not saved for preview also,
+ * commented code not maintained up to date ReportDefinition rdef =
+ * (ReportDefinition)
+ * request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ * if(rdef!=null) if(reportID.equals(rdef.getReportID())) { // The
+ * report definition is in the session => create report runtime from it
+ * rr = new ReportRuntime(rdef, request); if(prepareForExecution) {
+ * request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME,
+ * rr);
+ * rr.setDisplayFlags(request.getParameter(AppConstants.RI_SOURCE_PAGE)==null); } //
+ * if return rr; } // if
+ */
+
+ // Report is NOT in the session => load from the database
+ String reportXML = ReportLoader.loadCustomReportXML(reportID);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Report [" + reportID + "]: XML loaded"));
+
+ rr = ReportRuntime.unmarshal(reportXML, reportID, request);
+ if (prepareForExecution) {
+ String userID ;
+ int flag = 0;
+ if(request.getAttribute("schedule_email_userId") != null) {
+ userID = (String)request.getAttribute("schedule_email_userId");
+ flag = 1;
+ }
+ else
+ userID = AppUtils.getUserID(request);
+ // If it is dashboard type then report can be viewed without specific privilege to report
+ String dashboardId = AppUtils.getRequestValue(request, AppConstants.RI_DASHBOARD_ID);
+ //System.out.println("USSSSSSSSSSSSERID " + userID);
+ //System.out.println("PDF " + AppUtils.getRequestNvlValue(request, "pdfAttachmentKey") );
+ if(!rr.isDashboardType() && !(isReportAddedAsDashboard(request, dashboardId, rr.getReportID()))) {
+ if ( AppUtils.getRequestNvlValue(request, "pdfAttachmentKey").length()<=0 )
+ if(flag == 1 )rr.checkUserReadAccess(request, userID);
+ else rr.checkUserReadAccess(request);
+ }
+ // TODO ON Demand
+ //rr.setXmlFileName(saveXMLFile(request, rr.getReportName(), reportXML));
+ if (rDisplayContent) {
+ //System.out.println("In rDisplayContent ");
+ rr.setParamValues(request, false,true);
+ //if (requestFlag==2)
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr);
+ }
+ if(inSchedule) {
+ //System.out.println("In inSchedule ");
+ rr.setParamValues(request, false,false);
+ }
+ if( requestFlag == 7 ) { // DASH
+ rr.setDisplayFlags(true, true);
+ } else {
+ rr.setDisplayFlags(request.getParameter(AppConstants.RI_SOURCE_PAGE) == null,
+ rDisplayContent || rr.isDisplayOptionHideForm());
+ }
+// System.out.println("Report ID B4 Id in reportHandler "
+// + ( request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null?((ReportRuntime)request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID():"Not in session"));
+// System.out.println("requestFlag " + requestFlag);
+ if(requestFlag==2 && !rDisplayContent) {
+ //System.out.println("In Request Flag ");
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr);
+ rr.setParamValues(request, false, false);
+ }
+ else if(requestFlag==1) {
+ rr.setParamValues(request, false,refresh);
+ request.setAttribute(AppConstants.SI_REPORT_RUNTIME, rr);
+
+ }
+// System.out.println("Report ID B4 Id in reportHandler "
+// + ( request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null?((ReportRuntime)request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID():"Not in session"));
+ //request.setAttribute(AppConstants.SI_REPORT_RUNTIME, rr);
+ } // if
+
+ return rr;
+ } // loadReportRuntime
+
+ private boolean isReportAddedAsDashboard(HttpServletRequest request, String dashboardId, String reportId)throws RaptorException {
+ if(nvl(dashboardId).length() <= 0)
+ return false;
+ String reportXML = ReportLoader.loadCustomReportXML(dashboardId);
+ ReportDefinition rdef = createReportDefinition(request, dashboardId, reportXML);
+ List l = rdef.getDashBoardReports().getReportsList();
+ for (Iterator iterator = l.iterator(); iterator.hasNext();) {
+ Reports reports = (Reports) iterator.next();
+ if(reports.getReportId().equals(reportId)) return true;
+
+ }
+ return false;
+ }
+
+ public ReportDefinition createReportDefinition(HttpServletRequest request,
+ String reportID, String reportXML) throws RaptorException {
+ ReportDefinition rdef = ReportDefinition.unmarshal(reportXML, reportID, request);
+ rdef.generateWizardSequence(request);
+ return rdef;
+ } // createReportDefinition
+
+ public ReportDefinition loadReportDefinition(HttpServletRequest request, String reportID)
+ throws RaptorException {
+ //System.out.println("********* ReportID " + reportID);
+ boolean isReportIDBlank = (reportID.length() == 0 || reportID.equals("-1"));
+ String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), "");
+ String wizardActionKey = nvl(request.getParameter(AppConstants.RI_WIZARD_ACTION), "");
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ if(nvl(actionKey).equals("report.edit"))
+ rdef = null;
+ //ReportDefinition rdef = null;
+ if (rdef != null)
+ if (isReportIDBlank || reportID.equals(rdef.getReportID())) {
+ // The report definition is already in the session
+ return rdef;
+ }
+
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+ if (rr != null)
+ if (isReportIDBlank || reportID.equals(rr.getReportID())) {
+ // The report runtime is in the session => create report
+ // definition from it
+ rdef = new ReportDefinition(rr, request);
+ String userID = AppUtils.getUserID(request);
+ rdef.generateWizardSequence(request);
+ // rdef.checkUserWriteAccess(userID);
+
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+ return rdef;
+ } // if
+
+ // Report is NOT in the session => load from the database
+ if (isReportIDBlank)
+ rdef = ReportDefinition.createBlank(request);
+ else {
+ String reportXML = ReportLoader.loadCustomReportXML(reportID);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Report [" + reportID + "]: XML loaded"));
+ rdef = createReportDefinition(request, reportID, reportXML);
+ } // else
+
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+ return rdef;
+ } // loadReportDefinition
+
+ public void setSheetName( String sheet_name ) {
+ SHEET_NAME = sheet_name;
+ }
+
+ public String getSheetName() {
+ return SHEET_NAME;
+ }
+
+ /**
+ * Writes spreadsheet data in a Writer.
+ * (YK: in future it may evolve in a full-featured API for streaming data in Excel)
+ */
+ public static class SpreadsheetWriter {
+ private final Writer _out;
+ private int _rownum;
+
+ public SpreadsheetWriter(Writer out){
+ _out = out;
+ }
+
+ public void beginSheet() throws IOException {
+ _out.write("<?xml version=\"1.0\" encoding=\""+XML_ENCODING+"\"?>" +
+ "<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">" );
+ _out.write("<sheetData>\n");
+ }
+
+ public void endSheet() throws IOException {
+ _out.write("</sheetData>");
+ _out.write("</worksheet>");
+ }
+
+ /**
+ * Insert a new row
+ *
+ * @param rownum 0-based row number
+ */
+ public void insertRow(int rownum) throws IOException {
+ _out.write("<row r=\""+(rownum+1)+"\">\n");
+ this._rownum = rownum;
+ }
+
+ /**
+ * Insert row end marker
+ */
+ public void endRow() throws IOException {
+ _out.write("</row>\n");
+ }
+
+ public void createCell(int columnIndex, String value, int styleIndex) throws IOException {
+ String ref = new CellReference(_rownum, columnIndex).formatAsString();
+ _out.write("<c r=\""+ref+"\" t=\"inlineStr\"");
+ if(styleIndex != -1) _out.write(" s=\""+styleIndex+"\"");
+ _out.write(">");
+ _out.write("<is><t>"+value+"</t></is>");
+ _out.write("</c>");
+ }
+
+ public void createCell(int columnIndex, String value) throws IOException {
+ createCell(columnIndex, value, -1);
+ }
+
+ public void createCell(int columnIndex, double value, int styleIndex) throws IOException {
+ String ref = new CellReference(_rownum, columnIndex).formatAsString();
+ _out.write("<c r=\""+ref+"\" t=\"n\"");
+ if(styleIndex != -1) _out.write(" s=\""+styleIndex+"\"");
+ _out.write(">");
+ _out.write("<v>"+value+"</v>");
+ _out.write("</c>");
+ }
+
+ public void createCell(int columnIndex, double value) throws IOException {
+ createCell(columnIndex, value, -1);
+ }
+
+ public void createCell(int columnIndex, Calendar value, int styleIndex) throws IOException {
+ createCell(columnIndex, DateUtil.getExcelDate(value, false), styleIndex);
+ }
+ }
+
+ public int getColumnCountForDownloadFile(ReportRuntime rr, ReportData rd) {
+ int columnCount = 0;
+ for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) {
+ ColumnHeaderRow chr = rd.reportColumnHeaderRows.getNext();
+ for(chr.resetNext(); chr.hasNext(); ) {
+ ColumnHeader ch = chr.getNext();
+ if(ch.isVisible()) {
+ columnCount++;
+ }
+ }
+ }
+ if(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) {
+ for (rd.reportRowHeaderCols.resetNext(); rd.reportRowHeaderCols.hasNext();) {
+ RowHeaderCol rhc = rd.reportRowHeaderCols.getNext();
+ if(rhc.isVisible()) {
+ columnCount++;
+ }
+ }
+ }
+ return columnCount;
+ }
+
+
+ private Map<String, XSSFCellStyle> loadXSSFStyles(ReportRuntime rr, XSSFWorkbook wb, Map<String, XSSFCellStyle> loadedStyles) {
+ XSSFCellStyle styleDefault = wb.createCellStyle();
+ //System.out.println("Load Styles");
+ // Style default will be normal with no background
+ XSSFFont fontDefault = wb.createFont();
+
+ XSSFDataFormat xssffmt = wb.createDataFormat();
+ // The default will be plain .
+ fontDefault.setColor((short) HSSFFont.COLOR_NORMAL);
+ fontDefault.setFontHeight((short) (font_size / 0.05));
+ fontDefault.setFontName("Tahoma");
+
+ styleDefault.setAlignment(XSSFCellStyle.ALIGN_CENTER);
+ styleDefault.setBorderBottom(XSSFCellStyle.BORDER_THIN);
+ styleDefault.setBorderTop(XSSFCellStyle.BORDER_THIN);
+ styleDefault.setBorderLeft(XSSFCellStyle.BORDER_THIN);
+ styleDefault.setBorderRight(XSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleDefault.setFillPattern(XSSFCellStyle.NO_FILL);
+ styleDefault.setFont(fontDefault);
+ ArrayList semColumnList = new ArrayList();
+ List dsList = rr.getDataSourceList().getDataSource();
+ for (Iterator iter = dsList.iterator(); iter.hasNext();) {
+ DataSourceType element = (DataSourceType) iter.next();
+ List dcList = element.getDataColumnList().getDataColumn();
+ for (Iterator iterator = dcList.iterator(); iterator.hasNext();) {
+ DataColumnType element1 = (DataColumnType) iterator.next();
+ semColumnList.add(element1.getSemaphoreId());
+
+ }
+ }
+ SemaphoreList semList = rr.getSemaphoreList();
+ Map<String, XSSFCellStyle> hashMapStyles = new HashMap<String, XSSFCellStyle>();;
+ Map<String, XSSFFont> hashMapFonts = new HashMap<String, XSSFFont>();
+ hashMapFonts.put("default", fontDefault);
+ hashMapStyles.put("default", styleDefault);
+ XSSFCellStyle styleLeftDefault = wb.createCellStyle();
+ styleLeftDefault.setAlignment(XSSFCellStyle.ALIGN_LEFT);
+ styleLeftDefault.setBorderBottom(XSSFCellStyle.BORDER_THIN);
+ styleLeftDefault.setBorderTop(XSSFCellStyle.BORDER_THIN);
+ styleLeftDefault.setBorderLeft(XSSFCellStyle.BORDER_THIN);
+ styleLeftDefault.setBorderRight(XSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleLeftDefault.setFillPattern(XSSFCellStyle.NO_FILL);
+ styleLeftDefault.setFont(fontDefault);
+ hashMapStyles.put("defaultLeft", styleLeftDefault);
+
+
+ XSSFCellStyle styleDate = wb.createCellStyle();
+ styleDate.setAlignment(XSSFCellStyle.ALIGN_RIGHT);
+ styleDate.setDataFormat(xssffmt.getFormat("d-mmm-yy"));
+ styleDate.setAlignment(XSSFCellStyle.ALIGN_CENTER);
+ styleDate.setBorderBottom(XSSFCellStyle.BORDER_THIN);
+ styleDate.setBorderTop(XSSFCellStyle.BORDER_THIN);
+ styleDate.setBorderLeft(XSSFCellStyle.BORDER_THIN);
+ styleDate.setBorderRight(XSSFCellStyle.BORDER_THIN);
+ // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleDate.setFillPattern(XSSFCellStyle.NO_FILL);
+ styleDate.setFont(fontDefault);
+ hashMapStyles.put("date", styleDate);
+
+ XSSFCellStyle rowHeaderStyle = wb.createCellStyle();
+ XSSFFont headerFont = wb.createFont();
+ headerFont.setBold(true);
+ rowHeaderStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
+ rowHeaderStyle.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND);
+ rowHeaderStyle.setFont(headerFont);
+ rowHeaderStyle.setBorderTop(XSSFCellStyle.BORDER_THIN);
+ rowHeaderStyle.setBorderLeft(XSSFCellStyle.BORDER_THIN);
+ rowHeaderStyle.setBorderBottom(XSSFCellStyle.BORDER_THIN);
+ rowHeaderStyle.setBorderRight(XSSFCellStyle.BORDER_THIN);
+ hashMapStyles.put("header", rowHeaderStyle);
+
+
+ XSSFCellStyle boldStyle = wb.createCellStyle();
+ //headerFont = wb.createFont();
+ //headerFont.setBold(true);
+ boldStyle.setFont(headerFont);
+ boldStyle.setBorderTop(XSSFCellStyle.BORDER_THIN);
+ boldStyle.setBorderLeft(XSSFCellStyle.BORDER_THIN);
+ boldStyle.setBorderBottom(XSSFCellStyle.BORDER_THIN);
+ boldStyle.setBorderRight(XSSFCellStyle.BORDER_THIN);
+ boldStyle.setAlignment(HorizontalAlignment.CENTER);
+ hashMapStyles.put("title", boldStyle);
+
+ XSSFCellStyle cellStyle = null;
+ if (semList == null || semList.getSemaphore() == null) {
+ hashMapStyles.put("default", styleDefault);
+ } /*else {
+ for (Iterator iter = semList.getSemaphore().iterator(); iter.hasNext();) {
+ SemaphoreType sem = (SemaphoreType) iter.next();
+ if(!semColumnList.contains(sem.getSemaphoreId())) continue;
+ //System.out.println("SemphoreId ----> " + sem.getSemaphoreId());
+ FormatList fList = sem.getFormatList();
+ List formatList = fList.getFormat();
+ for (Iterator fIter = formatList.iterator(); fIter.hasNext();) {
+ FormatType fmt = (FormatType) fIter.next();
+ if(fmt!=null){
+ //if (fmt.getLessThanValue().length() > 0) {
+ cellStyle = wb.createCellStyle();
+ XSSFFont cellFont = wb.createFont();
+ //System.out.println("Format Id " + fmt.getFormatId());
+ if (nvl(fmt.getBgColor()).length() > 0) {
+// System.out.println("Load Styles " +
+// fmt.getFormatId()
+// + " " +fmt.getBgColor() + " " +
+// ExcelColorDef.getExcelColor(fmt.getBgColor()));
+ cellStyle.setFillForegroundColor(ExcelColorDef.getExcelColor(fmt
+ .getBgColor()));
+ cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
+ }
+ if (nvl(fmt.getFontColor()).length() > 0) {
+ cellFont.setColor(ExcelColorDef.getExcelColor(fmt.getFontColor()));
+ } else
+ cellFont.setColor((short) HSSFFont.COLOR_NORMAL);
+ if (fmt.isBold())
+ cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
+ if (fmt.isItalic())
+ cellFont.setItalic(true);
+ if (fmt.isUnderline())
+ cellFont.setUnderline(HSSFFont.U_SINGLE);
+ if(nvl(fmt.getFontFace()).length()>0)
+ cellFont.setFontName(fmt.getFontFace());
+ else
+ cellFont.setFontName("Tahoma");
+ //cellFont.setFontHeight((short) (10 / 0.05));
+
+ if(nvl(fmt.getFontSize()).length()>0) {
+ try {
+ cellFont.setFontHeight((short) (Integer.parseInt(fmt.getFontSize()) / 0.05));
+ } catch(NumberFormatException e){
+ cellFont.setFontHeight((short) (font_size / 0.05));
+ }
+ }
+ else
+ cellFont.setFontHeight((short) (font_size / 0.05));
+ cellStyle.setFont(cellFont);
+ cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ hashMapStyles.put(fmt.getFormatId(), cellStyle);
+ } else {
+ //hashMapStyles.put(fmt.getFormatId(), styleDefault);
+ hashMapStyles.put("default", styleDefault);
+ }
+ }
+
+ }
+ }*/
+ loadedStyles.putAll(hashMapStyles);
+ return loadedStyles;
+ }
+
+ private void generate(XSSFWorkbook wb, SpreadsheetWriter sw, Map<String, XSSFCellStyle> styles, ReportData rd, String sql_whole, ReportRuntime rr, HttpServletRequest request, XSSFSheet sheet) throws Exception {
+ HtmlStripper strip = new HtmlStripper();
+ XSSFCellStyle styleCell = null;
+ XSSFCellStyle styleRowCell = null;
+ XSSFCellStyle styleDefaultCell = null;
+
+ styleDefaultCell = (XSSFCellStyle) styles.get("default");
+
+
+ // to check performance
+ int mb = 1024*1024;
+ Runtime runtime = Runtime.getRuntime();
+
+ int rowNum = 0;
+ /*short s1 = 0, s2 = (short) (col-1);
+ rowNum += 1;
+ sw.insertRow(rowNum);
+ int styleIndex = styles.get("header").getIndex();
+ sw.createCell(rowNum, reportTitle, styleIndex);
+
+ //header.setCenter(HSSFHeader.font("Tahoma", "")+ HSSFHeader.fontSize((short) 9)+reportTitle+"\n"+((Globals.getShowDescrAtRuntime() && nvl(reportDescr).length() > 0)?reportDescr:""));
+
+ // Report Description
+ if (Globals.getShowDescrAtRuntime() && nvl(reportDescr).length() > 0) {
+ sw.createCell(rowNum, reportDescr, styleIndex);
+ }
+ rowNum += 2;
+ sw.insertRow(rowNum);*/
+ int cellNum = 0;
+
+
+ ColumnHeaderRow chr = null;
+ java.util.HashMap dataTypeMap = new java.util.HashMap();
+ boolean firstPass = true;
+ int columnRows = rr.getVisibleColumnCount() ;
+
+ HttpSession session = request.getSession();
+ String drilldown_index = (String) session.getAttribute("drilldown_index");
+ int index = 0;
+ try {
+ index = Integer.parseInt(drilldown_index);
+ } catch (NumberFormatException ex) {
+ index = 0;
+ }
+ String header = (String) session.getAttribute("TITLE_"+index);
+ String subtitle = (String) session.getAttribute("SUBTITLE_"+index);
+ if(nvl(header).length()>0) {
+ header = Utils.replaceInString(header, "<BR/>", " ");
+ header = Utils.replaceInString(header, "<br/>", " ");
+ header = Utils.replaceInString(header, "<br>", " ");
+ header = strip.stripHtml(nvl(header).trim());
+ subtitle = Utils.replaceInString(subtitle, "<BR/>", " ");
+ subtitle = Utils.replaceInString(subtitle, "<br/>", " ");
+ subtitle = Utils.replaceInString(subtitle, "<br>", " ");
+ subtitle = strip.stripHtml(nvl(subtitle).trim());
+ //XSSFRow row = sheet.createRow(rowNum);
+ sw.insertRow(rowNum);
+ cellNum = 0;
+ //XSSFCell cell = row.createCell(cellNum);
+ sw.createCell(cellNum, Utils.excelEncode(header));
+ for (int i = 1; i <= columnRows; i++) {
+ sw.createCell(cellNum+i, "");
+ }
+ sheet.addMergedRegion(new CellRangeAddress(rowNum+1, rowNum+1, cellNum+1, columnRows));
+ sw.endRow();
+/* cell.setCellValue(Utils.excelEncode(header));
+ cell.setCellStyle(styles.get("title"));
+*/ //sw.createCell(cellNum,Utils.excelEncode(header), styles.get("title").getIndex());
+// sheet.addMergedRegion(new CellRangeAddress(rowNum+1, rowNum+1, cellNum+1, columnRows));
+ rowNum += 1;
+// row = sheet.createRow(rowNum);
+ sw.insertRow(rowNum);
+ cellNum = 0;
+/* cell = row.createCell(cellNum);
+ cell.setCellValue(Utils.excelEncode(subtitle));
+ cell.setCellStyle(styles.get("title"));
+*/ //sw.createCell(cellNum,Utils.excelEncode(header), styles.get("title").getIndex());
+
+ sheet.addMergedRegion(new CellRangeAddress(rowNum+1, rowNum+1, cellNum+1, columnRows));
+ sw.createCell(cellNum, Utils.excelEncode(subtitle));
+ sw.endRow();
+ //sheet.addMergedRegion(new CellRangeAddress(rowNum+1, rowNum+1, cellNum+1, columnRows));
+/* sw.insertRow(rowNum);
+ cellNum = 0;
+ sw.createCell(cellNum,Utils.excelEncode(subtitle), styles.get("title").getIndex());
+ sheet.addMergedRegion(new CellRangeAddress(rowNum+1, rowNum+1, cellNum+1, columnRows));
+
+*/ rowNum += 1;
+ }
+ cellNum = 0;
+ String title = "";
+ for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) {
+ sw.insertRow(rowNum);
+ cellNum = -1;
+ /*if(rd.reportTotalRowHeaderCols!=null) {
+ cellNum +=1;
+ sw.createCell(cellNum, "No.", styles.get("header").getIndex());
+
+ //row.getCell((short) cellNum).setCellStyle(styleDataHeader);
+ }*/
+ chr = rd.reportColumnHeaderRows.getNext();
+
+ if(nvl(sql_whole).length() <= 0 || (!rr.getReportType().equals(AppConstants.RT_LINEAR))) {
+
+ for (rd.reportRowHeaderCols.resetNext(1); rd.reportRowHeaderCols.hasNext();) {
+ cellNum += 1;
+ RowHeaderCol rhc = rd.reportRowHeaderCols.getNext();
+ title = rhc.getColumnTitle();
+ title = Utils.replaceInString(title,"_nl_", " \n");
+
+ sw.createCell(cellNum,Utils.excelEncode(title), styles.get("header").getIndex());
+ //sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum+columnRows, (short) (cellNum)));
+ //System.out.println(" **************** Row Header Title " + rhc.getColumnTitle() + " " + cellNum + " " );
+ //System.out.println(cellNum + " " + cellWidth.size());
+ } // for
+
+ }
+
+ firstPass = false;
+ for (chr.resetNext(); chr.hasNext();) {
+ ColumnHeader ch = chr.getNext();
+ if(ch.isVisible()) {
+ cellNum += 1;
+ int colSpan = ch.getColSpan()-1;
+ title = ch.getColumnTitle();
+ title = Utils.replaceInString(title,"_nl_", " \n");
+ sw.createCell(cellNum, Utils.excelEncode(title), styles.get("header").getIndex());
+ if(colSpan > 0) {
+ for ( int k = 1; k <= colSpan; k++ ) {
+ sw.createCell(cellNum+k, "", styles.get("header").getIndex());
+ }
+ //sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (cellNum+colSpan)));
+ }
+ if(colSpan > 0)
+ cellNum += colSpan;
+ }
+ } // for
+ rowNum += 1;
+ } // for
+
+ sw.endRow();
+ //All the possible combinations of date format
+ CreationHelper createHelper = wb.getCreationHelper();
+ HashMap<String, Short> dateFormatMap = new HashMap<String, Short>();
+
+ SimpleDateFormat MMDDYYYYFormat = new SimpleDateFormat("MM/dd/yyyy");
+ SimpleDateFormat YYYYMMDDFormat = new SimpleDateFormat("yyyy/MM/dd");
+ SimpleDateFormat MONYYYYFormat = new SimpleDateFormat("MMM yyyy");
+ SimpleDateFormat MMYYYYFormat = new SimpleDateFormat("MM/yyyy");
+ SimpleDateFormat MMMMMDDYYYYFormat = new SimpleDateFormat("MMMMM dd, yyyy");
+ SimpleDateFormat YYYYMMDDDASHFormat = new SimpleDateFormat("yyyy-MM-dd");
+ SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ SimpleDateFormat DDMONYYYYFormat = new SimpleDateFormat("dd-MMM-yyyy");
+ SimpleDateFormat MONTHYYYYFormat = new SimpleDateFormat("MMMMM, yyyy");
+ SimpleDateFormat MMDDYYYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+ SimpleDateFormat MMDDYYYYHHMMFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");
+ SimpleDateFormat YYYYMMDDHHMMSSFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+ SimpleDateFormat YYYYMMDDHHMMFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");
+ SimpleDateFormat DDMONYYYYHHMMSSFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
+ SimpleDateFormat DDMONYYYYHHMMFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm");
+ SimpleDateFormat DDMONYYHHMMFormat = new SimpleDateFormat("dd-MMM-yy HH:mm");
+ SimpleDateFormat MMDDYYFormat = new SimpleDateFormat("MM/dd/yy");
+ SimpleDateFormat MMDDYYHHMMFormat = new SimpleDateFormat("MM/dd/yy HH:mm");
+ SimpleDateFormat MMDDYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
+ SimpleDateFormat MMDDYYYYHHMMZFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm z");
+ SimpleDateFormat MMMMMDDYYYYHHMMSS = new SimpleDateFormat("MMMMM-dd-yyyy HH:mm:ss");
+
+ short dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yyyy");
+ dateFormatMap.put("MMDDYYYY", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("yyyy/MM/dd");
+ dateFormatMap.put("YYYYMMDD", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("MMM yyyy");
+ dateFormatMap.put("MONYYYY", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("MM/yyyy");
+ dateFormatMap.put("MMYYYY", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("MMMMM dd, yyyy");
+ dateFormatMap.put("MMMMMDDYYYY", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("yyyy-MM-dd");
+ dateFormatMap.put("YYYYMMDDDASH", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("yyyy-MM-dd HH:mm:ss");
+ dateFormatMap.put("timestamp", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("dd-MMM-yyyy");
+ dateFormatMap.put("MONTHYYYY", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("MMMMM, yyyy");
+ dateFormatMap.put("MMDDYYYY", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yyyy HH:mm:ss");
+ dateFormatMap.put("MMDDYYYYHHMM", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yyyy HH:mm");
+ dateFormatMap.put("MMDDYYYY", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("yyyy/MM/dd HH:mm:ss");
+ dateFormatMap.put("YYYYMMDDHHMMSS", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("yyyy/MM/dd HH:mm");
+ dateFormatMap.put("YYYYMMDDHHMM", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("dd-MMM-yyyy HH:mm:ss");
+ dateFormatMap.put("DDMONYYYYHHMMSS", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("dd-MMM-yyyy HH:mm");
+ dateFormatMap.put("DDMONYYYYHHMM", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("dd-MMM-yy HH:mm");
+ dateFormatMap.put("DDMONYYHHMM", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("dd-MMM-yyyy");
+ dateFormatMap.put("DDMONYYYY", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yy");
+ dateFormatMap.put("MMDDYY", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yy HH:mm");
+ dateFormatMap.put("MMDDYYHHMM", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yy HH:mm:ss");
+ dateFormatMap.put("MMDDYYHHMMSS", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yyyy HH:mm z");
+ dateFormatMap.put("MMDDYYYYHHMMZ", new Short(dateFormat));
+ dateFormat = createHelper.createDataFormat().getFormat("MMMMM-dd-yyyy HH:mm:ss");
+ dateFormatMap.put("MMMMMDDYYYYHHMMSS", new Short(dateFormat));
+
+ ResultSet rs = null;
+ Connection conn = null;
+ Statement st = null;
+ ResultSetMetaData rsmd = null;
+
+
+ if(nvl(sql_whole).length() >0 && (rr.getReportType().equals(AppConstants.RT_LINEAR) || rr.getReportType().equals(AppConstants.RT_HIVE) )) {
+ try {
+ conn = ConnectionUtils.getConnection(rr.getDbInfo());
+ st = conn.createStatement();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("************* Map Whole SQL *************"));
+ logger.debug(EELFLoggerDelegate.debugLogger, (sql_whole));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("*****************************************"));
+ rs = st.executeQuery(sql_whole);
+ rsmd = rs.getMetaData();
+ int numberOfColumns = rsmd.getColumnCount();
+ HashMap colHash = new HashMap();
+ DataRow dr = null;
+ int j = 0;
+ int rowCount = 0;
+ while(rs.next()) {
+
+ rowCount++;
+
+ if(rowCount%10000 == 0) {
+ // to check performance
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Performance check for "+rowCount+" starting**************"));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("##### Heap utilization statistics [MB] #####"));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Used Memory:"
+ + (runtime.totalMemory() - runtime.freeMemory()) / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Free Memory:"
+ + runtime.freeMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Total Memory:" + runtime.totalMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Max Memory:" + runtime.maxMemory() / mb));
+ System.out.println(rowCount+"TH ROW****##### END #####");
+
+ //
+ }
+ sw.insertRow(rowNum);
+ cellNum = -1;
+ colHash = new HashMap();
+ for (int i = 1; i <= numberOfColumns; i++) {
+ colHash.put(rsmd.getColumnName(i).toUpperCase(), strip.stripHtml(rs.getString(i)));
+ }
+ rd.reportDataRows.resetNext();
+ dr = rd.reportDataRows.getNext();
+ styleRowCell = null;
+ if (dr.isRowFormat() && styles != null)
+ styleRowCell = (XSSFCellStyle) styles.get(nvl(/*dr.getFormatId(),*/"","default"));
+ j = 0;
+ //if(rowCount%1000 == 0) wb.write(sos);
+
+ /*if(rd.reportTotalRowHeaderCols!=null) {
+ //cellNum = -1;
+ //for (rd.reportRowHeaderCols.resetNext(); rd.reportRowHeaderCols.hasNext();) {
+ cellNum += 1;
+ //RowHeaderCol rhc = rd.reportRowHeaderCols.getRowHeaderCol(0);
+ //if (firstPass)
+ // rhc.resetNext();
+ //RowHeader rh = rhc.getRowHeader(rowCount-1);
+ sw.createCell(cellNum, rowCount, styleDefaultCell.getIndex());
+
+ //} // for
+ }*/
+ firstPass = false;
+ //cellNum = -1;
+ for (dr.resetNext(); dr.hasNext();j++) {
+ styleCell = null;
+ //for (chr.resetNext(); chr.hasNext();) {
+ //ColumnHeader ch = chr.getNext();
+ DataValue dv = dr.getNext();
+ HtmlFormatter htmlFormat = dv.getCellFormatter();
+
+ if (htmlFormat != null && dv.getFormatId() != null && styles != null)
+ styleCell = (XSSFCellStyle) styles.get(nvl(/*dv.getFormatId()*/"","default"));
+ String value = nvl((String)colHash.get(dv.getColId().toUpperCase()));
+
+ boolean bold = false;
+
+ if(dv.isVisible()) {
+ cellNum += 1;
+ //System.out.println("Stripping HTML 1");
+ //cell.setCellValue(strip.stripHtml(dv.getDisplayValue()));
+ String dataType = (String) (dataTypeMap.get(dv.getColId()));
+ //System.out.println("Value " + value + " " + (( dataType !=null && dataType.equals("DATE")) || (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date"))) );
+ if (dataType!=null && dataType.equals("NUMBER")){
+ //cellNumber = row.createCell((short) cellNum);
+ //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
+ //cellNumber.setCellValue(dv.getDisplayValue());
+ //cellCurrencyNumber = row.createCell((short) cellNum);
+ int zInt = 0;
+ if (value.equals("null")){
+ sw.createCell(cellNum,zInt,styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ }else{
+
+ if ((value.indexOf("."))!= -1){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+
+ //if (dv.getDisplayValue().startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempDollar = dv.getDisplayValue().trim();
+ tempDollar = tempDollar.replaceAll(" ", "").substring(0);
+ tempDollar = tempDollar.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempDollar);
+ //System.out.println("Before copy Value |" + tempDollar);
+ //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1);
+ //System.out.println("After copy Value |" + tempDollar);
+ if ((tempDollar.indexOf(","))!= -1){
+ tempDollar = tempDollar.replaceAll(",", "");
+ }
+ //System.out.println("The final string 1 is "+tempDollar);
+ double tempDoubleDollar = 0.0;
+ try {
+ tempDoubleDollar = Double.parseDouble(tempDollar);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempDoubleDollar, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempDoubleDollar, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempDoubleDollar, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(tempDollar), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ }
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ double tempDouble = 0.0;
+ try {
+ tempDouble = Double.parseDouble(value);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempDouble, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempDouble, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempDouble, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(value),styleRowCell.getIndex() );
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(value), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(value), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ }
+
+ }
+ }else {
+ if (!(value.equals(""))){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ //if (dv.getDisplayValue().startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempInt = value.trim();
+ tempInt = tempInt.replaceAll(" ", "").substring(0);
+ tempInt = tempInt.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempInt);
+ //System.out.println("Before copy Value |" + tempInt);
+ //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1);
+ //System.out.println("After copy Value |" + tempInt);
+ if ((tempInt.indexOf(","))!= -1){
+ tempInt = tempInt.replaceAll(",", "");
+ }
+ //System.out.println("The final string INT is "+tempInt);
+ Long tempIntDollar = 0L;
+ try {
+ tempIntDollar = Long.parseLong(tempInt);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempIntDollar, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempIntDollar, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempIntDollar, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempInt, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempInt, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempInt, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ }
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempStr = value.trim();
+ if ((tempStr.indexOf(","))!= -1){
+ tempStr = tempStr.replaceAll(",", "");
+ }
+ Long temp = 0L;
+
+ try {
+ temp = Long.parseLong(tempStr);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, temp, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, temp, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, temp, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempStr), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempStr), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(tempStr), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ }
+ }
+ }
+ }
+ }
+
+ } else if ( ( dataType !=null && dataType.equals("DATE")) || (dv.getDisplayName()!=null && dv.getDisplayName().toLowerCase().endsWith("date")) ||
+ (dv.getColId()!=null && dv.getColId().toLowerCase().endsWith("date")) ||
+ (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date")) ) {
+ XSSFCellStyle cellStyle = null;
+ if(styleRowCell!=null) {
+ cellStyle = styleRowCell;
+ } else if (styleCell!=null) {
+ cellStyle = styleCell;
+ } else {
+ cellStyle = styles.get(nvl(/*dv.getFormatId()*/"","date"));
+ }
+
+
+ Date date = null;
+ int flag = 0;
+ date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMDDYYHHMMSS"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMDDYYHHMM"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMDDYY"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMDDYYYYHHMMSS"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMDDYYYYHHMM"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMDDYYYY"));
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("YYYYMMDD"));
+ flag = 1;
+ }
+ if(date==null)
+ date = timestampFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("timestamp"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MONYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MONYYYY"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMYYYY"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMMMMDDYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMMMMDDYYYY"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MONTHYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MONTHYYYY"));
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("YYYYMMDDHHMMSS"));
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDDASHFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("YYYYMMDDDASH"));
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("YYYYMMDDHHMM"));
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("DDMONYYYYHHMMSS"));
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("DDMONYYYYHHMM"));
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("DDMONYYHHMM"));
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("DDMONYYYY"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMDDYYHHMMSS"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMDDYYHHMM"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMDDYY"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMDDYYHHMM"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMDDYYHHMMSS"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYHHMMZFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMDDYYYYHHMMZ"));
+ flag = 1;
+ }
+ if(date==null)
+ date = MMMMMDDYYYYHHMMSS.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ cellStyle.setDataFormat(dateFormatMap.get("MMMMMDDYYYYHHMMSS"));
+ flag = 1;
+ }
+
+ if(date!=null) {
+ //System.out.println("ExcelDate " + HSSFDateUtil.getExcelDate(date));
+ Calendar cal=Calendar.getInstance();
+ cal.setTime(date);
+ //sw.createCell(cellNum, cal,styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ //if(styleRowCell!=null)
+ sw.createCell(cellNum, cal, cellStyle.getIndex());
+ //else if (styleCell!=null)
+ //sw.createCell(cellNum, cal, cellStyle.getIndex());
+ //else
+ //sw.createCell(cellNum, cal, cellStyle.getIndex());
+ } else {
+ //cell.getCellStyle().setDataFormat((short)0);
+ //if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(value), cellStyle.getIndex());
+ //else if (styleCell!=null)
+ //sw.createCell(cellNum, Utils.excelEncode(value), cellStyle.getIndex());
+ //else
+ //sw.createCell(cellNum, Utils.excelEncode(value), cellStyle.getIndex());
+
+ }
+ //cellDate.setCellValue(date);
+ //cellDate.setCellValue(value); //cellDate.setCellValue(date);
+ //cellDate.setCellValue(dv.getDisplayValue());
+
+ } else if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){
+ //cellNumber = row.createCell((short) cellNum);
+ //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
+ //cellNumber.setCellValue(dv.getDisplayValue());
+ int zInt = 0;
+ if (value.equals("null")){
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, zInt, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, zInt, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, zInt, styleDefaultCell.getIndex());
+
+ } else {
+
+ if ((value.indexOf("."))!= -1){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempDollar = value.trim();
+ tempDollar = tempDollar.replaceAll(" ", "").substring(0);
+ tempDollar = tempDollar.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempDollar);
+ //System.out.println("Before copy Value |" + tempDollar);
+ //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1);
+ //System.out.println("After copy Value |" + tempDollar);
+ if ((tempDollar.indexOf(","))!= -1){
+ tempDollar = tempDollar.replaceAll(",", "");
+ }
+ //System.out.println("The final string 2IF is "+tempDollar);
+ double tempDoubleDollar = 0.0;
+ try {
+ tempDoubleDollar = Double.parseDouble(tempDollar);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempDoubleDollar,styleRowCell.getIndex() );
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempDoubleDollar, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempDoubleDollar, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(tempDollar), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ }
+
+
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempDoubleStr = value.trim();
+ tempDoubleStr = tempDoubleStr.replaceAll(" ", "").substring(0);
+ if ((tempDoubleStr.indexOf(","))!= -1){
+ tempDoubleStr = tempDoubleStr.replaceAll(",", "");
+ }
+ double tempDouble = 0.0;
+ try {
+ tempDouble = Double.parseDouble(tempDoubleStr);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempDouble, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempDouble, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempDouble, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempDoubleStr), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempDoubleStr), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(tempDoubleStr), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ }
+ }
+
+ }else {
+ if (!(value.equals(""))){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempInt = value.trim();
+ tempInt = tempInt.replaceAll(" ", "").substring(0);
+ tempInt = tempInt.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempInt);
+ //System.out.println("Before copy Value |" + tempInt);
+ //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1);
+ //System.out.println("After copy Value |" + tempInt);
+ if ((tempInt.indexOf(","))!= -1){
+ tempInt = tempInt.replaceAll(",", "");
+ }
+ //System.out.println("The final string INT 2 is "+tempInt);
+
+ Long tempIntDollar = 0L;
+
+ try {
+ tempIntDollar = Long.parseLong(tempInt);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempIntDollar,styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempIntDollar,styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempIntDollar,styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempInt), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempInt),styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(tempInt), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ }
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempStr = value.trim();
+ if ((tempStr.indexOf(","))!= -1){
+ tempStr = tempStr.replaceAll(",", "");
+ }
+ Long temp = 0L;
+
+ try {
+ temp = Long.parseLong(tempStr);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, temp, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, temp, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, temp, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempStr), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempStr), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(tempStr), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+
+ }
+ }
+ } else {
+ sw.createCell(cellNum, "", styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ }
+ }
+ }
+
+
+ }
+ else {
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("General"));
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styleCell.getIndex());
+ else {
+ if(nvl(value).startsWith(" "))
+ sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styles.get(nvl(/*dv.getFormatId(),*/"","defaultLeft")).getIndex());
+ else
+ sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+
+ }
+
+ }
+
+ if (dv.isBold()) {
+ if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){
+ if (value!=null && (value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ //cell.setCellStyle(styleCurrencyTotal);
+ }
+ else {
+ //cell.setCellStyle(styleTotal);
+ }
+ } else {
+ //cell.setCellStyle(styleDefaultTotal);
+ }
+ bold = true;
+ }
+ //System.out.println("2IF "+ (dr.isRowFormat()) + " " + (dv.isCellFormat()) + " " + (styles!=null));
+ if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null) {
+ //cell.setCellStyle((HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default")));
+ continue;
+ }
+ //System.out.println("3IF "+ (htmlFormat != null) + " " + (dv.getFormatId() != null) + " " + (bold == false) + " "+ (styles != null));
+ if (htmlFormat != null && dv.getFormatId() != null && bold == false
+ && styles != null) {
+ //cell.setCellStyle((HSSFCellStyle) styles.get(nvl(/*dv.getFormatId()*/"","default")));
+ } //else if (bold == false)
+ //cell.setCellStyle(styleDefault);
+ } // dv.isVisible
+
+ }
+ rowNum += 1;
+ sw.endRow();
+
+ }
+ if(rd.reportTotalRowHeaderCols!=null) {
+ rowCount++;
+ sw.insertRow(rowNum);
+ cellNum = -1;
+ rd.reportTotalRowHeaderCols.resetNext();
+ cellNum += 1;
+ RowHeaderCol rhc = rd.reportTotalRowHeaderCols.getNext();
+ RowHeader rh = rhc.getRowHeader(0);
+ if (dr.isRowFormat() && styles != null)
+ styleRowCell = (XSSFCellStyle) styles.get(nvl(/*dr.getFormatId(),*/"","default"));
+
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, strip.stripHtml(rh.getRowTitle()), styleRowCell.getIndex());
+ else
+ sw.createCell(cellNum, strip.stripHtml(rh.getRowTitle()), styleDefaultCell.getIndex());
+ rd.reportDataTotalRow.resetNext();
+ //rd.reportDataTotalRow.getNext();
+ DataRow drTotal = rd.reportDataTotalRow.getNext();
+ if(drTotal!=null) {
+ drTotal.resetNext(); drTotal.getNext();
+ for (; drTotal.hasNext();) {
+ DataValue dv = drTotal.getNext();
+ if(dv.isVisible()) {
+ cellNum += 1;
+ styleCell = null;
+ String value = dv.getDisplayValue();
+ sw.createCell(cellNum,value,styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ }
+ }
+ }
+ rowNum += 1;
+ sw.endRow();
+ }
+
+
+
+
+
+/* // To Display Total Values for Linear report
+ if(rd.reportDataTotalRow!=null) {
+ row = sheet.createRow(rowNum);
+ cellNum = -1;
+ rd.reportTotalRowHeaderCols.resetNext();
+ //for (rd.reportTotalRowHeaderCols.resetNext(); rd.reportTotalRowHeaderCols.hasNext();) {
+ cellNum += 1;
+ RowHeaderCol rhc = rd.reportTotalRowHeaderCols.getNext();
+ RowHeader rh = rhc.getRowHeader(0);
+ row.createCell((short) cellNum).setCellValue(strip.stripHtml(rh.getRowTitle()));
+ row.getCell((short) cellNum).setCellStyle(styleDefaultTotal);
+ //}
+
+ DataRow drTotal = rd.reportDataTotalRow.getNext();
+ //cellNum = -1;
+ for (drTotal.resetNext(); drTotal.hasNext();j++) {
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+ DataValue dv = drTotal.getNext();
+ String value = dv.getDisplayValue();
+ cell.setCellValue(value);
+ boolean bold = false;
+ if (dv.isBold()) {
+ if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){
+ if (value!=null && (value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ cell.setCellStyle(styleCurrencyTotal);
+ } else {
+ cell.setCellStyle(styleTotal);
+ }
+ } else {
+ cell.setCellStyle(styleDefaultTotal);
+ }
+ bold = true;
+ }
+ }
+ }*/
+
+ } catch (SQLException ex) {
+ throw new RaptorException(ex);
+ } catch (ReportSQLException ex) {
+ throw new RaptorException(ex);
+ } catch (Exception ex) {
+ if(!(ex.getCause() instanceof java.net.SocketException) )
+ throw new RaptorException (ex);
+ } finally {
+ try {
+ if(conn!=null)
+ conn.close();
+ if(st!=null)
+ st.close();
+ if(rs!=null)
+ rs.close();
+ } catch (SQLException ex) {
+ throw new RaptorException(ex);
+ }
+ }
+
+ String footer = (String) session.getAttribute("FOOTER_"+index);
+ if(nvl(footer).length()>0) {
+ footer = Utils.replaceInString(footer, "<BR/>", " ");
+ footer = Utils.replaceInString(footer, "<br/>", " ");
+ footer = Utils.replaceInString(footer, "<br>", " ");
+ footer = strip.stripHtml(nvl(footer).trim());
+ rowNum += 1;
+ sw.insertRow(rowNum);
+ cellNum = 0;
+ sw.createCell(cellNum, footer.replaceAll("&", "&amp;"), styleDefaultCell.getIndex());
+ sw.endRow();
+ rowNum += 1;
+ }
+
+ if(Globals.getShowDisclaimer()) {
+ rowNum += 1;
+ sw.insertRow(rowNum);
+ cellNum = 0;
+
+ sw.createCell(cellNum, org.openecomp.portalsdk.analytics.system.Globals.getFooterFirstLine().replaceAll("&", "&amp;"), styleDefaultCell.getIndex());
+ sw.endRow();
+ rowNum += 1;
+ sw.insertRow(rowNum);
+ cellNum = 0;
+ sw.createCell(cellNum, org.openecomp.portalsdk.analytics.system.Globals.getFooterSecondLine().replaceAll("&", "&amp;"), styleDefaultCell.getIndex());
+ sw.endRow();
+ }
+
+ } else {
+ //start data from rd
+
+ int rowCount = 0;
+ DataRow dr = null;
+ for (rd.reportDataRows.resetNext(); rd.reportDataRows.hasNext();) {
+ rowCount++;
+
+
+ dr = rd.reportDataRows.getNext();
+ sw.insertRow(rowNum);
+
+ cellNum = -1;
+
+ if (rr.getReportType().equals(AppConstants.RT_LINEAR) && rd.reportTotalRowHeaderCols!=null) {
+ rd.reportRowHeaderCols.resetNext(0);
+ if(rd.reportTotalRowHeaderCols!=null) {
+ //cellNum = -1;
+ //for (rd.reportRowHeaderCols.resetNext(); rd.reportRowHeaderCols.hasNext();) {
+ //a commented to suppress rownum
+ //a cellNum += 1;
+ //RowHeaderCol rhc = rd.reportRowHeaderCols.getRowHeaderCol(0);
+ //if (firstPass)
+ // rhc.resetNext();
+ //RowHeader rh = rhc.getRowHeader(rowCount-1);
+ //a sw.createCell(cellNum, rowCount, styleDefaultCell.getIndex());
+ //} // for
+ }
+
+ }
+ firstPass = false;
+ //cellNum = -1;
+ int j = 0;
+
+ for (dr.resetNext(); dr.hasNext();j++) {
+ DataValue dv = dr.getNext();
+ styleCell = null;
+ boolean bold = false;
+ String value = nvl(dv.getDisplayValue());
+ value = strip.stripHtml(value);
+ HtmlFormatter htmlFormat = dv.getCellFormatter();
+ if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null)
+ styleCell = (XSSFCellStyle) styles.get(nvl(/*dr.getFormatId(),*/"","default"));
+ if (htmlFormat != null && dv.getFormatId() != null && styles != null)
+ styleCell = (XSSFCellStyle) styles.get(nvl(/*dv.getFormatId(),*/"","default"));
+
+ if(dv.isVisible()) {
+ cellNum += 1;
+ //cell = row.createCell((short) cellNum);
+ //System.out.println("Stripping HTML 1");
+ //cell.setCellValue(strip.stripHtml(value));
+ String dataType = (String) (dataTypeMap.get(dv.getColId()));
+ //System.out.println(" The Display Value is ********"+value + " " + dv.getDisplayTotal() + " " + dv.getColName());
+
+ if (dataType!=null && dataType.equals("NUMBER")){
+ //cellNumber = row.createCell((short) cellNum);
+ //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
+ //cellNumber.setCellValue(value);
+ //cellCurrencyNumber = row.createCell((short) cellNum);
+ int zInt = 0;
+ if (value.equals("null")){
+ sw.createCell(cellNum,zInt,styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ }else{
+
+ if ((value.indexOf("."))!= -1){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempDollar = value.trim();
+ tempDollar = tempDollar.replaceAll(" ", "").substring(0);
+ tempDollar = tempDollar.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempDollar);
+ //System.out.println("Before copy Value |" + tempDollar);
+ //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1);
+ //System.out.println("After copy Value |" + tempDollar);
+ if ((tempDollar.indexOf(","))!= -1){
+ tempDollar = tempDollar.replaceAll(",", "");
+ }
+ //System.out.println("The final string 1 is "+tempDollar);
+ double tempDoubleDollar = 0.0;
+ try {
+ tempDoubleDollar = Double.parseDouble(tempDollar);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempDoubleDollar, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempDoubleDollar, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempDoubleDollar, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(tempDollar), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ }
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ double tempDouble = 0.0;
+ try {
+ tempDouble = Double.parseDouble(value);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempDouble, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempDouble, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempDouble, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(value),styleRowCell.getIndex() );
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(value), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(value), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ }
+
+ }
+ }else {
+ if (!(value.equals(""))){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempInt = value.trim();
+ tempInt = tempInt.replaceAll(" ", "").substring(0);
+ tempInt = tempInt.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempInt);
+ //System.out.println("Before copy Value |" + tempInt);
+ //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1);
+ //System.out.println("After copy Value |" + tempInt);
+ if ((tempInt.indexOf(","))!= -1){
+ tempInt = tempInt.replaceAll(",", "");
+ }
+ //System.out.println("The final string INT is "+tempInt);
+ Long tempIntDollar = 0L;
+ try {
+ tempIntDollar = Long.parseLong(tempInt);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempIntDollar, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempIntDollar, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempIntDollar, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempInt, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempInt, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempInt, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ }
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempStr = value.trim();
+ if ((tempStr.indexOf(","))!= -1){
+ tempStr = tempStr.replaceAll(",", "");
+ }
+ Long temp = 0L;
+
+ try {
+ temp = Long.parseLong(tempStr);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, temp, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, temp, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, temp, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempStr), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempStr), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(tempStr), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ }
+
+
+ }
+ //int temp = Integer.parseInt(value.trim());
+ // cell.setCellValue(temp);
+ //}else{
+ // cell.setCellValue(strip.stripHtml(value));
+ //}
+ }
+ }
+ }
+
+ }else if ( ( dataType !=null && dataType.equals("DATE")) || (dv.getDisplayName()!=null && dv.getDisplayName().toLowerCase().endsWith("date")) ||
+ (dv.getColId()!=null && dv.getColId().toLowerCase().endsWith("date")) ||
+ (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date")) ) {
+ Date date = null;
+ int flag = 0;
+ date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = timestampFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MONYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMMMMDDYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MONTHYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDDASHFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = YYYYMMDDHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = DDMONYYYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMDDYYYYHHMMZFormat.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+ if(date==null)
+ date = MMMMMDDYYYYHHMMSS.parse(value, new ParsePosition(0));
+ if(date != null && flag == 0) {
+ flag = 1;
+ }
+
+
+ if(date!=null) {
+ Calendar cal=Calendar.getInstance();
+ cal.setTime(date);
+ //sw.createCell(cellNum, cal,styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex());
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, cal, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, cal, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, cal, styles.get(nvl(/*dv.getFormatId()*/"","date")).getIndex());
+
+ } else {
+ /*cell.getCellStyle().setDataFormat((short)0);*/
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(value), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(value), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(value), styles.get(nvl(/*dv.getFormatId(),*/"","date")).getIndex());
+
+ }
+ //cellDate.setCellValue(date);
+ //cellDate.setCellValue(value);
+
+ }else if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){
+ //cellNumber = row.createCell((short) cellNum);
+ //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
+ //cellNumber.setCellValue(value);
+ int zInt = 0;
+ if (value.equals("null")){
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, zInt, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, zInt, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, zInt, styleDefaultCell.getIndex());
+ } else {
+
+ if ((value.indexOf("."))!= -1){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempDollar = value.trim();
+ tempDollar = tempDollar.replaceAll(" ", "").substring(0);
+ tempDollar = tempDollar.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempDollar);
+ //System.out.println("Before copy Value |" + tempDollar);
+ //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1);
+ //System.out.println("After copy Value |" + tempDollar);
+ if ((tempDollar.indexOf(","))!= -1){
+ tempDollar = tempDollar.replaceAll(",", "");
+ }
+ //System.out.println("The final string 2IF is "+tempDollar);
+ double tempDoubleDollar = 0.0;
+ try {
+ tempDoubleDollar = Double.parseDouble(tempDollar);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempDoubleDollar,styleRowCell.getIndex() );
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempDoubleDollar, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempDoubleDollar, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(tempDollar), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ }
+
+
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempDoubleStr = value.trim();
+ tempDoubleStr = tempDoubleStr.replaceAll(" ", "").substring(0);
+ if ((tempDoubleStr.indexOf(","))!= -1){
+ tempDoubleStr = tempDoubleStr.replaceAll(",", "");
+ }
+ double tempDouble = 0.0;
+ try {
+ tempDouble = Double.parseDouble(tempDoubleStr);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempDouble, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempDouble, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempDouble, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempDoubleStr), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempDoubleStr), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(tempDoubleStr), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ }
+ }
+
+ }else {
+ if (!(value.equals(""))){
+ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ //if (value.startsWith("$")){
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)"));
+ String tempInt = value.trim();
+ tempInt = tempInt.replaceAll(" ", "").substring(0);
+ tempInt = tempInt.replaceAll("\\$", "").substring(0);
+ //System.out.println("SUBSTRING |" + tempInt);
+ //System.out.println("Before copy Value |" + tempInt);
+ //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1);
+ //System.out.println("After copy Value |" + tempInt);
+ if ((tempInt.indexOf(","))!= -1){
+ tempInt = tempInt.replaceAll(",", "");
+ }
+ //System.out.println("The final string INT 2 is "+tempInt);
+
+ Long tempIntDollar = 0L;
+
+ try {
+ tempIntDollar = Long.parseLong(tempInt);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, tempIntDollar,styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, tempIntDollar,styleCell.getIndex());
+ else
+ sw.createCell(cellNum, tempIntDollar,styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempInt), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempInt),styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(tempInt), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ }
+ }else{
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
+ String tempStr = value.trim();
+ if ((tempStr.indexOf(","))!= -1){
+ tempStr = tempStr.replaceAll(",", "");
+ }
+ Long temp = 0L;
+
+ try {
+ temp = Long.parseLong(tempStr);
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, temp, styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, temp, styleCell.getIndex());
+ else
+ sw.createCell(cellNum, temp, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ } catch (NumberFormatException ne) {
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempStr), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, Utils.excelEncode(tempStr), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, Utils.excelEncode(tempStr), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ }
+ }
+ //int temp = Integer.parseInt(value.trim());
+ // cell.setCellValue(temp);
+ //}else{
+ // cell.setCellValue(strip.stripHtml(value));
+ //}
+ } else {
+ sw.createCell(cellNum, "", styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ }
+ }
+ }
+
+
+ }
+ else {
+ //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("General"));
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styleRowCell.getIndex());
+ else if (styleCell!=null)
+ sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styleCell.getIndex());
+ else
+ sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ }
+
+ //if (!(value.equals(""))){
+ //int temp = Integer.parseInt(value.trim());
+ //cell.setCellValue(temp);
+ //}else{
+ // cell.setCellValue(strip.stripHtml(value));
+ //}
+ //HSSFCellStyle styleFormat = null;
+ //HSSFCellStyle numberStyle = null;
+ //HSSFFont formatFont = null;
+ //short fgcolor = 0;
+ //short fillpattern = 0;
+ //System.out.println("1IF "+ (dv.isBold()) + " "+ value + " " + dv.getDisplayTotal() + " " + dv.getColName() );
+ if (dv.isBold()) {
+ if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){
+ if (value!=null && (value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) {
+ //cell.setCellStyle(styleCurrencyTotal);
+ }
+ else {
+ //cell.setCellStyle(styleTotal);
+ }
+ } else {
+ //cell.setCellStyle(styleDefaultTotal);
+ }
+ bold = true;
+ }
+ //System.out.println("2IF "+ (dr.isRowFormat()) + " " + (dv.isCellFormat()) + " " + (styles!=null));
+ if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null) {
+ //cell.setCellStyle((HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default")));
+ continue;
+ }
+ //System.out.println("3IF "+ (htmlFormat != null) + " " + (dv.getFormatId() != null) + " " + (bold == false) + " "+ (styles != null));
+ if (htmlFormat != null && dv.getFormatId() != null && bold == false
+ && styles != null) {
+ // cell.setCellStyle((HSSFCellStyle) styles.get(nvl(/*dv.getFormatId()*/"","default")));
+ } //else if (bold == false)
+ //cell.setCellStyle(styleDefault);
+ } // if (dv.isVisible)
+ } // for
+
+ /*for (int tmp=0; tmp<dataTypeMap.size(); tmp++){
+ String dataTypeStr = (String)(dataTypeMap.get(tmp));
+ if(dataTypeStr.equals("NUMBER")){
+ cell.setCellStyle(styleNumber);
+ }else if (dataTypeStr.equals("VARCHAR2")){
+ cell.setCellStyle(styleDefault);
+
+ }else if (dataTypeStr.equals("DATE")){
+ cell.setCellStyle(styleDate);
+ }else{
+
+ }
+
+ }*/
+ rowNum += 1;
+ sw.endRow();
+ } // for
+
+ if (rr.getReportType().equals(AppConstants.RT_LINEAR) && rd.reportTotalRowHeaderCols!=null) {
+
+ for (rd.reportDataTotalRow.resetNext(); rd.reportDataTotalRow.hasNext();) {
+ rowCount++;
+ sw.insertRow(rowNum);
+ cellNum = -1;
+ cellNum += 1;
+
+ RowHeaderCol rhc = rd.reportTotalRowHeaderCols.getNext();
+ RowHeader rh = rhc.getRowHeader(0);
+ if (dr.isRowFormat() && styles != null)
+ styleRowCell = (XSSFCellStyle) styles.get(nvl(/*dr.getFormatId(),*/"","default"));
+ if(styleRowCell!=null)
+ sw.createCell(cellNum, strip.stripHtml(rh.getRowTitle()), styleRowCell.getIndex());
+ else
+ sw.createCell(cellNum, strip.stripHtml(rh.getRowTitle()), styleDefaultCell.getIndex());
+
+ DataRow drTotal = rd.reportDataTotalRow.getNext();
+ if(drTotal!=null) {
+ drTotal.resetNext(); drTotal.getNext();
+ for (; drTotal.hasNext();) {
+ cellNum += 1;
+ styleCell = null;
+ DataValue dv = drTotal.getNext();
+ String value = dv.getDisplayValue();
+ sw.createCell(cellNum,value,styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex());
+ }
+ }
+
+ rowNum += 1;
+ sw.endRow();
+ }
+
+
+ String footer = (String) session.getAttribute("FOOTER_"+index);
+ if(nvl(footer).length()>0) {
+ footer = Utils.replaceInString(footer, "<BR/>", " ");
+ footer = Utils.replaceInString(footer, "<br/>", " ");
+ footer = Utils.replaceInString(footer, "<br>", " ");
+ footer = strip.stripHtml(nvl(footer).trim());
+ rowNum += 1;
+ sw.insertRow(rowNum);
+ cellNum = 0;
+ sw.createCell(cellNum, footer.replaceAll("&", "&amp;"), styleDefaultCell.getIndex());
+ sw.endRow();
+ rowNum += 1;
+ }
+
+
+ if(Globals.getShowDisclaimer()) {
+ rowNum += 1;
+ sw.insertRow(rowNum);
+ cellNum = 0;
+
+ sw.createCell(cellNum, org.openecomp.portalsdk.analytics.system.Globals.getFooterFirstLine().replaceAll("&", "&amp;"), styleDefaultCell.getIndex());
+ sw.endRow();
+ rowNum += 1;
+ sw.insertRow(rowNum);
+ cellNum = 0;
+ sw.createCell(cellNum, org.openecomp.portalsdk.analytics.system.Globals.getFooterSecondLine().replaceAll("&", "&amp;"), styleDefaultCell.getIndex());
+ sw.endRow();
+ }
+
+
+ }
+ // end data from rd
+ }
+
+ // System.out.println(" Last Row " + wb.getSheetAt(0).getLastRowNum());
+ }
+
+ private void paintXSSFExcelParams(XSSFWorkbook wb,int rowNum,int col,ArrayList paramsList, String customizedParamInfo, XSSFSheet sheet, String reportTitle, String reportDescr) throws IOException {
+ //HSSFSheet sheet = wb.getSheet(getSheetName());
+ int cellNum = 0;
+ XSSFRow row = null;
+ short s1 = 0, s2 = (short) 1;
+ HtmlStripper strip = new HtmlStripper();
+ // Name Style
+ XSSFCellStyle styleName = wb.createCellStyle();
+ //styleName.setFillBackgroundColor(HSSFColor.GREY_80_PERCENT.index);
+ styleName.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
+ //styleName.setFillPattern(HSSFCellStyle.SPARSE_DOTS);
+ styleName.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleName.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleName.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleName.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ styleName.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleName.setDataFormat((short)0);
+ XSSFFont font = wb.createFont();
+ font.setFontHeight((short) (font_size / 0.05));
+ font.setFontName("Tahoma");
+ font.setColor(HSSFColor.BLACK.index);
+ font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
+ styleName.setFont(font);
+ //Data Style
+
+ // Create some fonts.
+ XSSFFont fontDefault = wb.createFont();
+ // Initialize the styles & fonts.
+ // The default will be plain .
+ fontDefault.setColor((short) HSSFFont.COLOR_NORMAL);
+ fontDefault.setFontHeight((short) (font_size / 0.05));
+ fontDefault.setFontName("Tahoma");
+ fontDefault.setItalic(true);
+ // Style default will be normal with no background
+ XSSFCellStyle styleValue = wb.createCellStyle();
+ styleValue.setDataFormat((short)0);
+ styleValue.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+ styleValue.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+ styleValue.setBorderTop(HSSFCellStyle.BORDER_THIN);
+ styleValue.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ styleValue.setBorderRight(HSSFCellStyle.BORDER_THIN);
+ // styleValue.setFillForegroundColor(HSSFColor.YELLOW.index);
+ styleValue.setFillPattern(HSSFCellStyle.NO_FILL);
+ styleValue.setFont(fontDefault);
+ XSSFCell cell = null;
+ XSSFCellStyle styleDescription = wb.createCellStyle();
+ styleDescription.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+// styleDescription.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+// styleDescription.setBorderTop(HSSFCellStyle.BORDER_THIN);
+// styleDescription.setBorderRight(HSSFCellStyle.BORDER_THIN);
+// styleDescription.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+ XSSFFont fontDescr = wb.createFont();
+ fontDescr.setFontHeight((short) (font_header_descr_size / 0.05));
+ fontDescr.setFontName("Tahoma");
+ fontDescr.setColor(HSSFColor.BLACK.index);
+ fontDescr.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
+ styleDescription.setFont(font);
+ XSSFCell cellDescr = null;
+ int paramSeq = 0;
+ Header header = sheet.getHeader();
+ StringBuffer strBuf = new StringBuffer();
+ if(!Globals.customizeFormFieldInfo() || customizedParamInfo.length()<=0) {
+ for (Iterator iter = paramsList.iterator(); iter.hasNext();) {
+ IdNameValue value = (IdNameValue) iter.next();
+ //System.out.println("\"" + value.getId() + " = " + value.getName() + "\"");
+ if(nvl(value.getId()).trim().length()>0 && (!nvl(value.getId()).trim().equals("BLANK"))) {
+ paramSeq += 1;
+ if(paramSeq <= 1) {
+ row = sheet.createRow(++rowNum);
+ cell = row.createCell((short) 0);
+ sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, s1, s2));
+ cellDescr = row.createCell((short) 0);
+ cellDescr.setCellValue("Run-time Parameters");
+ cellDescr.setCellStyle(styleDescription);
+
+
+ strBuf.append(reportTitle+"\n");
+ //strBuf.append("Run-time Parameters\n");
+ }
+ row = sheet.createRow(++rowNum);
+ cellNum = 0;
+ //System.out.println("RowNum " + rowNum + " " + value.getId() + " " +value.getName());
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue(value.getId());
+ cell.setCellStyle(styleName);
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue(value.getName().replaceAll("~",","));
+ cell.setCellStyle(styleValue);
+
+ //strBuf.append(value.getId()+": "+ value.getName()+"\n");
+ }
+ } //for
+ } else {
+ strBuf.append(reportTitle+"\n");
+ Document document = new Document();
+ document.open();
+ HTMLWorker worker = new HTMLWorker(document);
+ StyleSheet style = new StyleSheet();
+ style.loadTagStyle("body", "leading", "16,0");
+ ArrayList p = HTMLWorker.parseToList(new StringReader(customizedParamInfo), style);
+ String name = "";
+ String token = "";
+ String value = "";
+ String s = "";
+ PdfPTable pdfTable = null;
+ for (int k = 0; k < p.size(); ++k){
+ if(p.get(k) instanceof Paragraph)
+ s = ((Paragraph)p.get(k)).toString();
+ else { /*if ((p.get(k) instanceof PdfPTable))*/
+ pdfTable = ((PdfPTable)p.get(k));
+ }
+ //todo: Logic for parsing pdfTable should be added after upgrading to iText 5.0.0
+ //s = Utils.replaceInString(s, ",", "|");
+ s = s.replaceAll(",", "|");
+ s = s.replaceAll("~", ",");
+ if(s.indexOf(":")!= -1) {
+ //System.out.println("|"+s+"|");
+ row = sheet.createRow(++rowNum);
+ cell = row.createCell((short) 0);
+ sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, s1, s2));
+ cellDescr = row.createCell((short) 0);
+ cellDescr.setCellValue("Run-time Parameters");
+ cellDescr.setCellStyle(styleDescription);
+
+ //strBuf.append("Run-time Parameters\n");
+ StringTokenizer st = new StringTokenizer(s.trim(), "|");
+ while(st.hasMoreTokens()) {
+ token = st.nextToken();
+ token = token.trim();
+ if (!(token.trim().equals("|") || token.trim().equals("]]") || token.trim().equals("]") || token.trim().equals("[") )) {
+ if(token.endsWith(":")) {
+ name = token;
+ name = name.substring(0, name.length()-1);
+ if(name.startsWith("["))
+ name = name.substring(1);
+ value = st.nextToken();
+ if(nvl(value).endsWith("]"))value = nvl(value).substring(0, nvl(value).length()-1);
+ } /*else if(name != null && name.length() > 0) {
+ value = st.nextToken();
+ if(value.endsWith("]]"))value = value.substring(0, value.length()-1);
+ }*/
+ if(name!=null && name.trim().length()>0) {
+ row = sheet.createRow((short) ++rowNum);
+ cellNum = 0;
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue(name.trim());
+ cell.setCellStyle(styleName);
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue(value.trim());
+ cell.setCellStyle(styleValue);
+ //strBuf.append(name.trim()+": "+ value.trim()+"\n");
+ }
+/* if(token.endsWith(":") && (value!=null && value.trim().length()<=0) && (name!=null && name.trim().length()>0 && name.endsWith(":"))) {
+ name = name.substring(0, name.indexOf(":")+1);
+ //value = token.substring(token.indexOf(":")+1);
+ row = sheet.createRow((short) ++rowNum);
+ cellNum = 0;
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue(name.trim());
+ cell.setCellStyle(styleName);
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue(value.trim());
+ cell.setCellStyle(styleValue);
+
+ //strBuf.append(name.trim()+": "+ value.trim()+"\n");
+ value = "";
+ name = "";
+ }
+*/ }
+ int cw = 0;
+ cw = name.trim().length() + 12;
+ // if(i!=cellWidth.size()-1)
+ if(sheet.getColumnWidth((short)0)< (short) name.trim().length())
+ sheet.setColumnWidth((short)0, (short) name.trim().length());
+ if(sheet.getColumnWidth((short)1)< (short) value.trim().length())
+ sheet.setColumnWidth((short)1, (short) value.trim().length());
+ name = "";
+ value = "";
+
+ }
+
+ try {
+ SimpleDateFormat oracleDateFormat = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss");
+ Date sysdate = oracleDateFormat.parse(ReportLoader.getSystemDateTime());
+ SimpleDateFormat dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern());
+
+ row = sheet.createRow((short) ++rowNum);
+ cellNum = 0;
+ cell = row.createCell((short) cellNum);
+ cell.setCellValue("Report Date/Time");
+ cell.setCellStyle(styleName);
+ cellNum += 1;
+ cell = row.createCell((short) cellNum);
+
+ cell.setCellValue(dtimestamp.format(sysdate)+" "+Globals.getTimeZone());
+ cell.setCellStyle(styleValue);
+
+ } catch(Exception ex) {
+ //ex.printStackTrace();
+ }
+
+
+ }
+ }
+
+
+/* Iterator iter1 = paramsList.iterator();
+ s1 = 0; s2 = (short)10;
+ if(iter1.hasNext()) {
+ row = sheet.createRow((short) ++rowNum);
+ cellNum = 0;
+ cell = row.createCell((short) cellNum);
+ sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2));
+ cell.setCellValue(strip.stripHtml(customizedParamInfo));
+ }
+*/
+/* rowNum += 2;
+ row = sheet.createRow(rowNum);*/
+ } // if
+ Iterator iterCheck = paramsList.iterator();
+ if(iterCheck.hasNext()) {
+ rowNum += 2;
+ row = sheet.createRow(rowNum);
+ }
+ header.setCenter(HSSFHeader.font("Tahoma", "")+ HSSFHeader.fontSize((short) font_header_title_size)+strBuf.toString());
+ }
+
+ // Trying different -->
+ public void createHTMLFileContent(Writer out, ReportData rd,
+ ReportRuntime rr, String sql_whole, HttpServletRequest request, HttpServletResponse response)
+ throws RaptorException, IOException {
+ //response.setContentType("application/vnd.ms-excel");
+ //response.setHeader("Content-disposition",
+ // "attachment; filename=" +
+ // "Example.xls" );
+ PrintWriter csvOut = response.getWriter();
+ HtmlStripper strip = new HtmlStripper();
+ ResultSet rs = null;
+ Connection conn = null;
+ Statement st = null;
+ ResultSetMetaData rsmd = null;
+ ColumnHeaderRow chr = null;
+ int mb = 1024*1024;
+ Runtime runtime = Runtime.getRuntime();
+ csvOut.println("<HTML>\n" +
+ "<HEAD><TITLE>" + rr.getReportName() + "</TITLE></HEAD>\n" +
+ "<BODY>\n" );
+ System.out.println("HTML-Excel Generation Triggered: " + new java.util.Date());
+ csvOut.print("<TABLE>");
+ if (Globals.getPrintParamsInCSVDownload()) {
+ ArrayList paramsList = rr.getParamNameValuePairsforPDFExcel(request, 1);
+ int paramSeq = 0;
+ for (Iterator iter = paramsList.iterator(); iter.hasNext();) {
+ IdNameValue value = (IdNameValue) iter.next();
+ //System.out.println("\"" + value.getId() + " = " + value.getName() + "\"");
+ if(nvl(value.getId()).trim().length()>0 && (!nvl(value.getId()).trim().equals("BLANK"))) {
+ paramSeq += 1;
+ if(paramSeq <= 1) {
+ csvOut.println("<TR><TD COLSPAN=\"2\">" + "Run-time Parameters" + "</TD></TR>");
+ //strBuf.append("Run-time Parameters\n");
+ }
+ csvOut.println("<TR><TD>" + value.getId() +"</TD>");
+ csvOut.println("<TD>" + value.getName().replaceAll("~",",")+ "</TD>");
+ csvOut.println("</TR>");
+
+ //strBuf.append(value.getId()+": "+ value.getName()+"\n");
+ }
+ } //for
+ csvOut.println("<TR><TD COLSPAN=\"2\"> &nbsp;</TD></TR>");
+ csvOut.println("<TR><TD COLSPAN=\"2\"> &nbsp;</TD></TR>");
+ System.out.println("HTML-Excel: Header Rendering complete " + new java.util.Date());
+ }
+ int rowCount = 0;
+ if(nvl(sql_whole).length()>0) {
+ try {
+ conn = ConnectionUtils.getConnection(rr.getDbInfo());
+ st = conn.createStatement();
+ Log.write("[SQL] " + sql_whole, 4);
+ int downloadLimit = Globals.getDownloadLimit();
+ Callable<ResultSet> callable = new ExecuteQuery(st, sql_whole, downloadLimit);
+ ExecutorService executor = new ScheduledThreadPoolExecutor(5);
+ System.out.println("Time Started" + new java.util.Date());
+ Future<ResultSet> future = executor.submit(callable);
+ try {
+ rs = future.get(900, TimeUnit.SECONDS);
+ } catch (TimeoutException ex) {
+ System.out.println("Cancelling Query");
+ st.cancel();
+ System.out.println("Query Cancelled");
+ throw new Exception("user requested");
+ }
+ rsmd = rs.getMetaData();
+ int numberOfColumns = rsmd.getColumnCount();
+ HashMap colHash = new HashMap();
+
+ if(rd!=null) {
+ for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) {
+ chr = rd.reportColumnHeaderRows.getNext();
+ csvOut.println("<TR>");
+ for (chr.resetNext(); chr.hasNext();) {
+ ColumnHeader ch = chr.getNext();
+ if(ch.isVisible()) {
+ csvOut.print("<TD bgColor=\"8F9381\">" + ch.getColumnTitle() + "</TD>");
+ //for (int i = 1; i < ch.getColSpan(); i++)
+ // csvOut.print(",");
+
+ }
+ } // for
+ csvOut.println("</TR>");
+ } // for
+
+
+ while(rs.next()) {
+ csvOut.println("<TR>");
+/* if(runtime.freeMemory()/mb <= ((runtime.maxMemory()/mb)*Globals.getMemoryThreshold()/100) ) {
+ csvOut.print(Globals.getUserDefinedMessageForMemoryLimitReached() + " " + rowCount +"records out of " + rr.getReportDataSize() + " were downloaded to CSV.");
+ break;
+ }
+*/ rowCount++;
+ colHash = new HashMap();
+ for (int i = 1; i <= numberOfColumns; i++) {
+ colHash.put(rsmd.getColumnName(i), rs.getString(i));
+ }
+ for (chr.resetNext(); chr.hasNext();) {
+ ColumnHeader ch = chr.getNext();
+ if(ch.isVisible()) {
+ csvOut.println("<TD>" + strip.stripCSVHtml(nvl((String)colHash.get(ch.getLinkColId().toUpperCase()))) + "</TD>");
+ }
+
+ }
+ csvOut.println("</TR>");
+ }
+ System.out.println("Downloaded Rows in HTML-Excel " + rowCount + " : "+ new java.util.Date());
+ if(rowCount == 0) {
+ csvOut.print("<TR><TD COLSPAN=\""+ numberOfColumns + "\">No Data Found</TD></TR>");
+ } else {
+ }
+ } else {
+ csvOut.println("<TR><TD COLSPAN=\""+ numberOfColumns + "\">No Data Found</TD></TR>");
+ }
+ csvOut.println("</TABLE></BODY>\n</HTML>");
+
+ } catch (SQLException ex) {
+ throw new RaptorException(ex);
+ } catch (ReportSQLException ex) {
+ throw new RaptorException(ex);
+ } catch (Exception ex) {
+ throw new RaptorException (ex);
+ } finally {
+ try {
+ if(conn!=null)
+ conn.close();
+ if(st!=null)
+ st.close();
+ if(rs!=null)
+ rs.close();
+ } catch (SQLException ex) {
+ throw new RaptorException(ex);
+ }
+ }
+ //csvOut.flush();
+ } else {
+ boolean firstPass = true;
+ int numberOfColumns = 0;
+ if(rd!=null) {
+ for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) {
+ chr = rd.reportColumnHeaderRows.getNext();
+ csvOut.println("<TR>");
+ for (rd.reportRowHeaderCols.resetNext(1); rd.reportRowHeaderCols.hasNext();) {
+ RowHeaderCol rhc = rd.reportRowHeaderCols.getNext();
+
+ if (firstPass) {
+ numberOfColumns++;
+ csvOut.print("<TD bgColor=\"8F9381\">" + rhc.getColumnTitle() + "</TD>");
+ }
+ //csvOut.print(",");
+ } // for
+
+
+ for (chr.resetNext(); chr.hasNext();) {
+ ColumnHeader ch = chr.getNext();
+ if(ch.isVisible()) {
+ if(firstPass) numberOfColumns++;
+ csvOut.print("<TD bgColor=\"8F9381\">" + ch.getColumnTitle() + "</TD>");
+ //for (int i = 1; i < ch.getColSpan(); i++)
+ //csvOut.print(",");
+ }
+ } // for
+ firstPass = false;
+ csvOut.println("</TR>");
+ } // for
+
+ firstPass = true;
+ for (rd.reportDataRows.resetNext(); rd.reportDataRows.hasNext();) {
+ DataRow dr = rd.reportDataRows.getNext();
+ csvOut.println("<TR>");
+ for (rd.reportRowHeaderCols.resetNext(1); rd.reportRowHeaderCols.hasNext();) {
+ RowHeaderCol rhc = rd.reportRowHeaderCols.getNext();
+ if (firstPass)
+ rhc.resetNext();
+ RowHeader rh = rhc.getNext();
+
+ csvOut.print("<TD bgColor=\"8F9381\">" + strip.stripCSVHtml(rh.getRowTitle()) + "</TD>");
+ } // for
+ firstPass = false;
+
+ for (dr.resetNext(); dr.hasNext();) {
+ DataValue dv = dr.getNext();
+ if(dv.isVisible())
+ csvOut.print("<TD bgColor=\"8F9381\">" + strip.stripCSVHtml(dv.getDisplayValue()) + "</TD>");
+ } // for
+
+ csvOut.println("</TR>");
+
+ } // for
+ //csvOut.flush();
+ } else {
+ csvOut.println("<TR><TD COLSPAN=\""+ numberOfColumns + "\">No Data Found</TD></TR>");
+ }
+ }
+ csvOut.println("</TABLE></BODY>\n</HTML>");
+ System.out.println("HTML-Excel Generation: Data Rendering complete " + new java.util.Date());
+ System.out.println("##### Heap utilization statistics [MB] #####");
+ System.out.println("Used Memory:"
+ + (runtime.maxMemory() - runtime.freeMemory()) / mb);
+ System.out.println("Free Memory:"
+ + runtime.freeMemory() / mb);
+ System.out.println("Total Memory:" + runtime.totalMemory() / mb);
+ System.out.println("Max Memory:" + runtime.maxMemory() / mb);
+
+ } // createCSVFileContent
+
+ /**
+ * Checking if every row and cell in merging region exists, and create those which are not
+ * @param sheet in which check is performed
+ * @param region to check
+ * @param cellStyle cell style to apply for whole region
+ */
+ private void cleanBeforeMergeOnValidCells(XSSFSheet sheet,CellRangeAddress region, XSSFCellStyle cellStyle )
+ {
+ for(int rowNum =region.getFirstRow();rowNum<=region.getLastRow();rowNum++){
+ XSSFRow row= sheet.getRow(rowNum);
+ if(row==null){
+ sheet.createRow(rowNum);
+ }
+ for(int colNum=region.getFirstColumn();colNum<=region.getLastColumn();colNum++){
+ XSSFCell currentCell = row.getCell(colNum);
+ if(currentCell==null){
+ currentCell = row.createCell(colNum);
+ }
+
+ currentCell.setCellStyle(cellStyle);
+
+ }
+ }
+
+
+ }
+} // ReportHandler
+
+
+/**
+ * Adapter for a Writer to behave like an OutputStream.
+ *
+ * Bytes are converted to chars using the platform default encoding.
+ * If this encoding is not a single-byte encoding, some data may be lost.
+ */
+ class WriterOutputStream extends OutputStream {
+
+ private final Writer writer;
+
+ public WriterOutputStream(Writer writer) {
+ this.writer = writer;
+ }
+
+ public void write(int b) throws IOException {
+ // It's tempting to use writer.write((char) b), but that may get the encoding wrong
+ // This is inefficient, but it works
+ write(new byte[] {(byte) b}, 0, 1);
+ }
+
+ public void write(byte b[], int off, int len) throws IOException {
+ writer.write(new String(b, off, len));
+ }
+
+ public void flush() throws IOException {
+ writer.flush();
+ }
+
+ public void close() throws IOException {
+ writer.close();
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportLoader.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportLoader.java
new file mode 100644
index 00000000..2197de66
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportLoader.java
@@ -0,0 +1,1061 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+/* ===========================================================================================
+ * This class is part of <I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I>
+ * Raptor : This tool is used to generate different kinds of reports with lot of utilities
+ * ===========================================================================================
+ *
+ * -------------------------------------------------------------------------------------------
+ * ReportLoader.java - This class is used to call database interaction related to reports.
+ * -------------------------------------------------------------------------------------------
+ *
+ *
+ *
+ * Changes
+ * -------
+ * 28-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> isDashboardType is made to return false, as any report can be added to Dashboard. </LI></UL>
+ * 18-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> request Object is passed to prevent caching user/roles - Datamining/Hosting. </LI></UL>
+ * 27-Jul-2009 : Version 8.4 (Sundar);<UL><LI>Admin User is given the same privilege as Super User when the property
+ * "admin_role_equiv_to_super_role" in raptor.properties is Y. A check is made in corresponding to that. </LI></UL>
+ *
+ */
+package org.openecomp.portalsdk.analytics.model;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.Writer;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.model.base.ReportWrapper;
+import org.openecomp.portalsdk.analytics.model.definition.ReportLogEntry;
+import org.openecomp.portalsdk.analytics.model.search.ReportSearchResult;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.system.fusion.domain.QuickLink;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class ReportLoader extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportLoader.class);
+
+
+ //private static Properties sqlProperty;
+
+ public static String loadCustomReportXML(String reportID) throws RaptorException {
+ Connection connection = DbUtils.getConnection();
+ try {
+ return loadCustomReportXML(connection, reportID);
+ } finally {
+ DbUtils.clearConnection(connection);
+ }
+ } // loadCustomReportXML
+
+ public static String loadCustomReportXML(Connection connection, String reportID)
+ throws RaptorException {
+
+ StringBuffer sb = new StringBuffer();
+
+ PreparedStatement stmt = null;
+
+ ResultSet rs = null;
+
+ try {
+
+ String sql = Globals.getLoadCustomReportXml();
+ stmt = connection.prepareStatement(sql);
+ stmt.setInt(1,Integer.parseInt(reportID));
+ rs = stmt.executeQuery();
+ if(Globals.isWeblogicServer()) {
+ java.sql.Clob clob= null;
+ Object obj = null;
+ if (rs.next()) {
+ clob = rs.getClob(1);
+ }
+ else
+ throw new RaptorException("Report " + reportID + " not found in the database");
+
+ int len = 0;
+ char[] buffer = new char[512];
+ Reader in = null;
+ in = new InputStreamReader(clob.getAsciiStream());
+ // if(obj instanceof oracle.sql.CLOB) {
+ // in = ((oracle.sql.CLOB) obj).getCharacterStream();
+ // } else if (obj instanceof weblogic.jdbc.wrapper.Clob) {
+ // in = ((weblogic.jdbc.base.BaseClob) obj).getCharacterStream();
+ // }
+ while ((len = in.read(buffer)) != -1)
+ sb.append(buffer, 0, len);
+ in.close();
+ } else if (Globals.isPostgreSQL() || Globals.isMySQL()) {
+ String clob= null;
+ Object obj = null;
+ if (rs.next()) {
+ sb.append(rs.getString(1));
+ }
+ else
+ throw new RaptorException("Report " + reportID + " not found in the database");
+ } else {
+ /*oracle.sql.CLOB clob = null;
+ if (rs.next())
+ clob = (oracle.sql.CLOB) rs.getObject(1);
+ else
+ throw new RaptorException("Report " + reportID + " not found in the database");
+ int len = 0;
+ char[] buffer = new char[512];
+ Reader in = clob.getCharacterStream();
+ while ((len = in.read(buffer)) != -1)
+ sb.append(buffer, 0, len);
+ in.close();*/
+ throw new RaptorException("only maria db support for this ");
+ }
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ } catch (IOException ex) {
+ throw new RaptorException (ex.getMessage(), ex.getCause());
+ } finally {
+ try {
+ if(rs!=null)
+ rs.close();
+ if(stmt!=null)
+ stmt.close();
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ }
+ }
+ return sb.toString();
+ } // loadCustomReportXML
+
+ private static void dbUpdateReportXML(Connection connection, String reportID,
+ String reportXML) throws RaptorException {
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+
+ try {
+ String sql = Globals.getDBUpdateReportXml();
+ stmt = connection.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE,
+ ResultSet.CONCUR_UPDATABLE);
+ stmt.setInt(1,Integer.parseInt(reportID));
+ rs = stmt.executeQuery();
+ Writer out = null;
+ /*if(Globals.isWeblogicServer()) {
+ java.sql.Clob clob = null;
+ if (rs.next())
+ clob = rs.getClob(1);
+ else
+ throw new RaptorException("Report " + reportID + " not found in the database");
+
+ if (clob.length() > reportXML.length())
+ clob.truncate(0);
+ //clob.trim(reportXML.length());
+ out = ((weblogic.jdbc.vendor.oracle.OracleThinClob)clob).getCharacterOutputStream();
+ } else*/
+ if (Globals.isPostgreSQL() || Globals.isMySQL()) {
+ if (rs.next()) {
+ rs.updateString("report_xml",reportXML);
+ rs.updateRow();
+ connection.commit();
+ //sb.append(rs.getString(1));
+ }
+ else
+ throw new RaptorException("Report " + reportID + " not found in the database");
+ } else {
+ /*oracle.sql.CLOB clob = null;
+ if (rs.next())
+ clob = (oracle.sql.CLOB) rs.getObject(1);
+ else
+ throw new RaptorException("Report " + reportID + " not found in the database");
+
+ if (clob.length() > reportXML.length())
+ clob.trim(reportXML.length());
+ out = clob.getCharacterOutputStream();*/
+ throw new RaptorException("only maria db support for this ");
+ }
+ if(!(Globals.isPostgreSQL() || Globals.isMySQL())) {
+ out.write(reportXML);
+ out.flush();
+ out.close();
+ }
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ } catch (IOException ex) {
+ throw new RaptorException (ex.getMessage(), ex.getCause());
+ } finally {
+ try {
+ if(rs!=null)
+ rs.close();
+ if(stmt!=null)
+ stmt.close();
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ }
+ }
+ } // dbUpdateReportXML
+
+ public static void updateCustomReportRec(Connection connection, ReportWrapper rw,
+ String reportXML) throws RaptorException {
+ /* DbUtils.executeUpdate(connection,"UPDATE cr_report SET title='"
+ + Utils.oracleSafe(rw.getReportName()) + "', descr='"
+ + Utils.oracleSafe(rw.getReportDescr()) + "', public_yn='"
+ + (rw.isPublic() ? "Y" : "N") + "', menu_id='" + rw.getMenuID()
+ + "', menu_approved_yn='" + (rw.isMenuApproved() ? "Y" : "N") + "', owner_id="
+ + rw.getOwnerID() + ", maint_id=" + rw.getUpdateID()
+ + ", maint_date=TO_DATE('" + rw.getUpdateDate() + "', '"
+ + Globals.getOracleTimeFormat() + "'), dashboard_type_yn='"+ (rw.isDashboardType()?"Y":"N")+"', dashboard_yn= '"
+ + (rw.getReportType().equals(AppConstants.RT_DASHBOARD)?"Y":"N") + "' WHERE rep_id = " + rw.getReportID());*/
+
+ String sql = Globals.getUpdateCustomReportRec();
+
+ sql = sql.replace("[Utils.oracleSafe(rw.getReportName())]", Utils.oracleSafe(rw.getReportName()));
+ sql = sql.replace("[Utils.oracleSafe(rw.getReportDescr())]", Utils.oracleSafe(rw.getReportDescr()));
+ sql = sql.replace("[(rw.isPublic()]",(rw.isPublic() ? "Y" : "N"));
+ sql = sql.replace("[rw.getMenuID()]", rw.getMenuID());
+ sql = sql.replace("[(rw.isMenuApproved()]", (rw.isMenuApproved() ? "Y" : "N"));
+ sql = sql.replace("[rw.getOwnerID()]",rw.getOwnerID());
+ sql = sql.replace("[rw.getUpdateID()]",rw.getUpdateID());
+ sql = sql.replace("[rw.getUpdateDate()]",rw.getUpdateDate());
+ sql = sql.replace("[Globals.getOracleTimeFormat()]", Globals.getOracleTimeFormat());
+ sql = sql.replace("[(rw.isDashboardType()]", (rw.isDashboardType()?"Y":"N"));
+ sql = sql.replace("[(rw.getReportType().equals(AppConstants.RT_DASHBOARD)]", (rw.getReportType().equals(AppConstants.RT_DASHBOARD)?"Y":"N"));
+ sql = sql.replace("[rw.getReportID()]", rw.getReportID());
+
+ DbUtils.executeUpdate(connection, sql);
+
+ dbUpdateReportXML(connection, rw.getReportID(), reportXML);
+ } // updateCustomReportRec
+
+ public static boolean isDashboardType ( String reportID ) throws RaptorException {
+ return false;
+/* String sql = "select dashboard_type_yn from cr_report where rep_id = ?";
+ Connection connection = DbUtils.getConnection();
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ boolean dashboardType= false;
+ try {
+ stmt = connection.prepareStatement(sql);
+ stmt.setString(1, reportID);
+ rs = stmt.executeQuery();
+ if(rs.next()) {
+ dashboardType = nvls(rs.getString(1),"N").trim().toUpperCase().startsWith("Y");
+ }
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ } finally {
+ try {
+ rs.close();
+ stmt.close();
+ DbUtils.clearConnection(connection);
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ }
+ }
+ return dashboardType;*/
+ }
+
+ public static boolean isReportsAlreadyScheduled ( String reportID ) throws RaptorException {
+ //String sql = "select rep_id from cr_report_schedule where rep_id = ?";
+ String sql = Globals.getIsReportAlreadyScheduled();
+
+ Connection connection = DbUtils.getConnection();
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ boolean isScheduled= false;
+ try {
+ stmt = connection.prepareStatement(sql);
+ stmt.setInt(1, Integer.parseInt(reportID));
+ rs = stmt.executeQuery();
+ if(rs.next()) {
+ isScheduled = true;
+ }
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ } finally {
+ try {
+ if(rs!=null)
+ rs.close();
+ if(stmt!=null)
+ stmt.close();
+ DbUtils.clearConnection(connection);
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ }
+ }
+ return isScheduled;
+}
+
+ public static void createCustomReportRec(Connection connection, ReportWrapper rw,
+ String reportXML) throws RaptorException {
+
+ /*DbUtils
+ .executeUpdate(
+ connection,
+ "INSERT INTO cr_report(rep_id, title, descr, public_yn, menu_id, menu_approved_yn, report_xml, owner_id, create_id, create_date, maint_id, maint_date, dashboard_type_yn, dashboard_yn, folder_id) VALUES("
+ + rw.getReportID()
+ + ", '"
+ + Utils.oracleSafe(rw.getReportName())
+ + "', '"
+ + Utils.oracleSafe(rw.getReportDescr())
+ + "', '"
+ + (rw.isPublic() ? "Y" : "N")
+ + "', '"
+ + rw.getMenuID()
+ + "', '"
+ + (rw.isMenuApproved() ? "Y" : "N")
+ + "', '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>', "
+ + rw.getOwnerID()
+ + ", "
+ + rw.getCreateID()
+ + ", TO_DATE('"
+ + rw.getCreateDate()
+ + "', '"
+ + Globals.getOracleTimeFormat()
+ + "'), "
+ + rw.getUpdateID()
+ + ", TO_DATE('"
+ + rw.getUpdateDate()
+ + "', '"
+ + Globals.getOracleTimeFormat()
+ + "'), '"
+ + (rw.isDashboardType()?"Y":"N")
+ + "', '"
+ + (rw.getReportType().equals(AppConstants.RT_DASHBOARD)?"Y":"N")
+ + "', "
+ + rw.getFolderId()
+ + ")");*/
+ String sql = Globals.getCreateCustomReportRec();
+
+ sql = sql.replace("[rw.getReportID()]", rw.getReportID());
+ sql = sql.replace("[Utils.oracleSafe(rw.getReportName())]", Utils.oracleSafe(rw.getReportName()));
+ sql = sql.replace("[Utils.oracleSafe(rw.getReportDescr())]", Utils.oracleSafe(rw.getReportDescr()));
+ sql = sql.replace("[rw.isPublic()]", (rw.isPublic() ? "Y" : "N"));
+ sql = sql.replace("[rw.getMenuID()]", rw.getMenuID());
+ sql = sql.replace("[rw.isMenuApproved()]", (rw.isMenuApproved() ? "Y" : "N"));
+ sql = sql.replace("[rw.getOwnerID()]", rw.getOwnerID());
+ sql = sql.replace("[rw.getCreateID()]", rw.getCreateID());
+ sql = sql.replace("[rw.getCreateDate()]", rw.getCreateDate());
+ sql = sql.replace("[Globals.getOracleTimeFormat()]", Globals.getOracleTimeFormat());
+ sql = sql.replace("[rw.getUpdateID()]", rw.getUpdateID());
+ sql = sql.replace("[rw.getUpdateDate()]", rw.getUpdateDate());
+ sql = sql.replace("[rw.isDashboardType()]", (rw.isDashboardType()?"Y":"N"));
+ sql = sql.replace("[rw.getReportType().equals(AppConstants.RT_DASHBOARD)]", (rw.getReportType().equals(AppConstants.RT_DASHBOARD)?"Y":"N"));
+ sql = sql.replace("[rw.getFolderId()]", rw.getFolderId());
+
+
+ DbUtils.executeUpdate(connection,sql);
+
+ dbUpdateReportXML(connection, rw.getReportID(), reportXML);
+ } // createCustomReportRec
+
+ public static Vector getUserReportNames(HttpServletRequest request) {
+ return getUserReportNames(AppUtils.getUserID(request));
+ } // getUserReportNames
+
+ public static Vector getUserReportNames(String userID) {
+ Vector reportIdNames = new Vector();
+
+ try {
+
+ String sql = Globals.getTheUserReportNames();
+ sql = sql.replace("[userID]", userID);
+ DataSet ds = DbUtils.executeQuery(sql);
+
+ //DataSet ds = DbUtils
+ // .executeQuery("SELECT cr.rep_id, cr.title FROM cr_report cr WHERE nvl(cr.owner_id, cr.create_id) = "
+ // + userID);
+
+ for (int i = 0; i < ds.getRowCount(); i++)
+ reportIdNames.add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1)));
+ } catch (Exception e) {
+ }
+
+ return reportIdNames;
+ } // getUserReportNames
+
+ public static String getReportOwnerID(String reportID) throws RaptorException {
+
+ // String sql = "SELECT nvl(cr.owner_id, cr.create_id) owner FROM cr_report cr WHERE rep_id = ?";
+
+ String sql = Globals.getTheReportOwnerId();
+
+ Connection connection = DbUtils.getConnection();
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ String reportOwnerID = null;
+ try {
+ stmt = connection.prepareStatement(sql);
+ stmt.setInt(1, Integer.parseInt(reportID));
+ rs = stmt.executeQuery();
+ if(rs.next()) {
+ reportOwnerID = rs.getString(1);
+ }
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ } finally {
+ try {
+ if(rs!=null)
+ rs.close();
+ if(stmt!=null)
+ stmt.close();
+ DbUtils.clearConnection(connection);
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ }
+ }
+
+ return reportOwnerID;
+ } // getReportOwnerID
+
+ public static void deleteReportRecord(String reportID) throws RaptorException {
+ Connection con = DbUtils.startTransaction();
+
+ /*try {
+ DbUtils.executeUpdate(con, "DELETE cr_report_log WHERE rep_id = " + reportID);
+ DbUtils.executeUpdate(con, "DELETE cr_report_schedule_users WHERE rep_id = "
+ + reportID);
+ DbUtils.executeUpdate(con, "DELETE cr_report_schedule WHERE rep_id = " + reportID);
+ DbUtils.executeUpdate(con, "DELETE cr_report_access WHERE rep_id = " + reportID);
+ DbUtils.executeUpdate(con, "DELETE cr_report_email_sent_log WHERE rep_id = " + reportID);
+ DbUtils.executeUpdate(con, "DELETE cr_favorite_reports WHERE rep_id = " + reportID);
+ DbUtils.executeUpdate(con, "DELETE cr_report WHERE rep_id = " + reportID);
+ DbUtils.commitTransaction(con);
+ } */
+
+ try{
+ String sql1= Globals.getDeleteReportRecordLog();
+ sql1 = sql1.replace("[reportID]", reportID);
+ String sql2= Globals.getDeleteReportRecordUsers();
+ sql2 = sql2.replace("[reportID]", reportID);
+ String sql3= Globals.getDeleteReportRecordSchedule();
+ sql3 = sql3.replace("[reportID]", reportID);
+ String sql4= Globals.getDeleteReportRecordAccess();
+ sql4 = sql4.replace("[reportID]", reportID);
+ String sql5= Globals.getDeleteReportRecordEmail();
+ sql5 = sql5.replace("[reportID]", reportID);
+ String sql6= Globals.getDeleteReportRecordFavorite();
+ sql6 = sql6.replace("[reportID]", reportID);
+ String sql7= Globals.getDeleteReportRecordReport();
+ sql7 = sql7.replace("[reportID]", reportID);
+
+ DbUtils.executeUpdate(con, sql1);
+ DbUtils.executeUpdate(con, sql2);
+ DbUtils.executeUpdate(con, sql3);
+ DbUtils.executeUpdate(con, sql4);
+ DbUtils.executeUpdate(con, sql5);
+ DbUtils.executeUpdate(con, sql6);
+ DbUtils.executeUpdate(con, sql7);
+ DbUtils.commitTransaction(con);
+
+ }
+
+
+ catch (Exception e) {
+ DbUtils.rollbackTransaction(con);
+ } finally {
+ DbUtils.clearConnection(con);
+ }
+ } // deleteReportRecord
+
+ public static ArrayList loadQuickLinks(HttpServletRequest request, String menuId, boolean b) throws RaptorException {
+ String userID = AppUtils.getUserID(request);
+ StringBuffer roleList = new StringBuffer();
+ roleList.append("-1");
+ for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();)
+ roleList.append("," + ((String) iter.next()));
+
+ // DataSet ds = DbUtils.executeQuery("SELECT cr.rep_id, cr.title FROM
+ // cr_report cr WHERE cr.public_yn = 'Y' AND cr.menu_id =
+ // '"+nvls(menuId)+"' AND cr.menu_approved_yn = 'Y' ORDER BY cr.title");
+ // Copied from SearchHandler and simplified
+ /*String query = "SELECT cr.rep_id, "
+ + "cr.title, "
+ + "cr.descr "
+ + "FROM cr_report cr, "
+ + "(SELECT rep_id, "
+ + "MIN(read_only_yn) read_only_yn "
+ + "FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = "
+ + userID
+ + ") "
+ + "UNION ALL "
+ + "(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN ("
+ + roleList.toString() + "))" + ") report_access "
+ + "GROUP BY rep_id) ra " + "WHERE INSTR('|'||cr.menu_id||'|', '|'||'"
+ + nvls(menuId) + "'||'|') > 0 AND " + "cr.menu_approved_yn = 'Y' AND "
+ + "cr.rep_id = ra.rep_id (+) AND "
+ + "(nvl(cr.owner_id, cr.create_id) = " + userID
+ + " OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL) "
+ + "ORDER BY cr.title";*/
+
+ String query = Globals.getLoadQuickLinks();
+ query = query.replace("[userID]", userID);
+ query = query.replace("[roleList.toString()]", roleList.toString());
+ query = query.replace("[nvls(menuId)]", nvls(menuId));
+
+ DataSet ds = DbUtils
+ .executeQuery(query);
+
+ ArrayList quickLinks = new ArrayList(ds.getRowCount());
+ StringBuffer link = new StringBuffer("");
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ link = new StringBuffer("");
+ link.append("<a href=\"" + AppUtils.getReportExecuteActionURL() + ds.getString(i, 0));
+ if(b) link.append("&PAGE_ID="+menuId+"&refresh=Y");
+ link.append("\">" +ds.getString(i, 1) + "</a>" + (Globals.getShowDescrAtRuntime() ? " - " + ds.getString(i, 2) : "") );
+ quickLinks.add(link.toString());
+ }
+
+ return quickLinks;
+ } // loadQuickLinks
+
+ public static ArrayList<QuickLink> getQuickLinksJSON(HttpServletRequest request, String menuId, boolean b) throws RaptorException {
+ String userID = AppUtils.getUserID(request);
+ StringBuffer roleList = new StringBuffer();
+ roleList.append("-1");
+ for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();)
+ roleList.append("," + ((String) iter.next()));
+
+ String query = Globals.getLoadQuickLinks();
+ query = query.replace("[userID]", userID);
+ query = query.replace("[roleList.toString()]", roleList.toString());
+ query = query.replace("[nvls(menuId)]", nvls(menuId));
+
+ DataSet ds = DbUtils
+ .executeQuery(query);
+
+ ArrayList<QuickLink> quickLinksArray = new ArrayList<QuickLink>(ds.getRowCount());
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ QuickLink quickLink = new QuickLink();
+ StringBuffer link = new StringBuffer("");
+ link.append(AppUtils.getReportExecuteActionURLNG() +"c_master="+ ds.getString(i, 0));
+ if(b) link.append("&PAGE_ID="+menuId+"&refresh=Y");
+ quickLink.setReportURL(link.toString());
+ quickLink.setReportName(ds.getString(i, 1));
+ quickLink.setShowDescr(Globals.getShowDescrAtRuntime());
+ quickLink.setReportDescr(ds.getString(i, 2));
+ quickLinksArray.add(quickLink);
+ }
+
+ return quickLinksArray;
+ } // loadQuickLinks
+
+ //this will retrieve all the reports within the specified folder.
+ public static ReportSearchResult loadFolderReports(HttpServletRequest request, String menuId, boolean b, String folderId, boolean isUserReport, boolean isPublicReport) throws RaptorException {
+ String HTML_FORM = "forma";
+ String userID = AppUtils.getUserID(request);
+ StringBuffer roleList = new StringBuffer();
+ roleList.append("-1");
+ String rep_title_sql = "'<a class=\"hyperref1\" href=''#'' onClick=''document."+HTML_FORM+"."+AppConstants.RI_ACTION+".value=\"report.run\";"+
+ "document."+HTML_FORM+".c_master.value=\"'|| cr.rep_id||'\";document."+HTML_FORM+".submit()''>'";
+ String PRIVATE_ICON = "<img border=0 src="
+ + AppUtils.getImgFolderURL()
+ + "accessicon.gif alt=Private width=16 height=12>&nbsp;";
+
+ for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();)
+ roleList.append("," + ((String) iter.next()));
+
+ /*String sql= "SELECT cr.rep_id, " +
+ "cr.rep_id report_id, " +
+ rep_title_sql+
+ "||DECODE(cr.public_yn, 'Y', '', '" +
+ PRIVATE_ICON +
+ "')||cr.title||'</a>' title, " +
+ "cr.descr, " +
+ "au.first_name||' '||au.last_name owner_name, " +
+ "TO_CHAR(cr.create_date, 'MM/DD/YYYY') create_date, " +
+ "DECODE(NVL(cr.owner_id, cr.create_id), " +
+ userID +
+ ", 'N', NVL(ra.read_only_yn, 'Y')) read_only_yn, " +
+ "DECODE(NVL(cr.owner_id, cr.create_id), " +
+ userID +
+ ", 'Y', 'N') user_is_owner_yn " +
+ " FROM cr_report cr, " +
+ "app_user au, " +
+ "(SELECT rep_id, MIN(read_only_yn) read_only_yn " +
+ "FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = " +
+ userID +
+ ") " +
+ "UNION ALL " +
+ "(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN " +
+ "(-1,1000,1))" + ") report_access GROUP BY rep_id) ra " +
+ "WHERE TO_CHAR(cr.rep_id) = nvl('', TO_CHAR(cr.rep_id)) AND UPPER(cr.title) LIKE UPPER('%%') " +
+ "AND nvl(cr.owner_id, cr.create_id) = au.user_id AND cr.rep_id = ra.rep_id (+) " +
+ " AND cr.folder_id= '" + folderId + "'" ;*/
+
+ /*String sql = "" +
+ "SELECT cr.rep_id, "
+ + "cr.rep_id report_id, "
+ + rep_title_sql + "||DECODE(cr.public_yn, 'Y', '', '" + PRIVATE_ICON + "')||cr.title||'</a>' title, "
+ + "cr.descr, "
+ + "au.first_name||' '||au.last_name owner_name, "
+ + "TO_CHAR(cr.create_date, 'MM/DD/YYYY') create_date, "
+ + "DECODE(NVL(cr.owner_id, cr.create_id), " + userID
+ + ", 'N', NVL(ra.read_only_yn, 'Y')) read_only_yn, "
+ + "DECODE(NVL(cr.owner_id, cr.create_id), " + userID
+ + ", 'Y', 'N') user_is_owner_yn "
+ + "FROM cr_report cr, "
+ + "app_user au, "
+ + "(SELECT rep_id, "
+ + "MIN(read_only_yn) read_only_yn "
+ + "FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = "
+ + userID
+ + ") "
+ + "UNION ALL "
+ + "(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN ("
+ + roleList.toString() + "))" + ") report_access " + "GROUP BY rep_id) ra "
+ + "WHERE " + "nvl(cr.owner_id, cr.create_id) = au.user_id "
+ + "AND cr.rep_id = ra.rep_id (+) AND cr.folder_id= '" + folderId + "'";*/
+
+ String sql = Globals.getLoadFolderReports();
+ sql = sql.replace("[userID]", userID);
+ sql = sql.replace("[PRIVATE_ICON]", PRIVATE_ICON);
+ sql = sql.replace("[rep_title_sql]", rep_title_sql);
+ sql = sql.replace("[roleList.toString()]", roleList.toString());
+ sql = sql.replace("[folderId]", folderId);
+
+
+ // String user_sql = " AND nvl(cr.owner_id, cr.create_id) = " + userID;
+ // String public_sql = " AND (nvl(cr.owner_id, cr.create_id) = " + userID
+ // + " OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL)";
+
+ String user_sql = Globals.getLoadFolderReportsUser();
+ user_sql = user_sql.replace("[userID]", userID);
+ String public_sql = Globals.getLoadFolderReportsPublicSql();
+ public_sql = public_sql.replace("[userID]", userID);
+
+ if (isUserReport)
+ // My reports - user is owner
+ sql += user_sql;
+ else if (isPublicReport)
+ // Public reports - user has read or write access to the report
+ // (user is owner or report is public or user has explicit user or
+ // role access)
+ if (!AppUtils.isSuperUser(request))
+ sql += public_sql;
+ else if (!AppUtils.isSuperUser(request))
+ // All reports
+ // If user is super user - gets unrestricted access to all reports
+ // (read_only gets overriden later)
+ // else - not super user - doesn't get access to private reports of
+ // other users (= Public reports); Admin users get edit right
+ // override later
+ sql += public_sql;
+ logger.debug(EELFLoggerDelegate.debugLogger, ("query is for folder list is : " + sql));
+
+ DataSet ds = DbUtils.executeQuery(sql);
+
+ /*Vector quickLinks = new Vector(ds.getRowCount());
+ StringBuffer link = new StringBuffer("");
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ link = new StringBuffer("");
+ link.append("<a href=\"" + AppUtils.getReportExecuteActionURL() + ds.getString(i, 0));
+ if(b) link.append("&PAGE_ID="+menuId+"&refresh=Y");
+ link.append("\">" +ds.getString(i, 2) + "</a>" + (Globals.getShowDescrAtRuntime() ? " - " + ds.getString(i, 2) : "") );
+ quickLinks.add(link.toString());
+ }
+
+ return quickLinks;*/
+ ReportSearchResult rsr = new ReportSearchResult(-1, ds.getRowCount(), 6, 7);
+ rsr.parseData(ds, request);
+ //rsr.truncateToPage(pageNo);
+
+ return rsr;
+ } // loadFolderReports
+
+ public static ArrayList loadQuickDownloadLinks(String userID, HttpServletRequest request) throws RaptorException {
+ /*String query = " SELECT a.file_name, b.title,to_char(a.dwnld_start_time, 'Dy DD-Mon-YYYY HH24:MI:SS') as time, "+
+ " a.dwnld_start_time " +
+ " FROM cr_report_dwnld_log a, cr_report b where a.user_id = "+userID +" and "+
+ " a.rep_id = b.rep_id " +
+ " and (a.dwnld_start_time) >= to_date(to_char(sysdate-24/24, 'mm/dd/yyyy'), 'mm/dd/yyyy') " +
+ " and a.record_ready_time is not null " +
+ " order by a.dwnld_start_time desc"; */
+
+ String query = Globals.getLoadQuickDownloadLinks();
+ query = query.replace("[userID]", userID);
+
+
+ DataSet ds = DbUtils
+ .executeQuery(query);
+ ArrayList quickDownloadLinks = new ArrayList(ds.getRowCount());
+ logger.debug(EELFLoggerDelegate.debugLogger, ("ROW SIZE " + ds.getRowCount()));
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ quickDownloadLinks.add("<a href=\"" + AppUtils.getRaptorActionURL()+"download.data.file&filename="
+ + ds.getString(i, 0)+"\">" + ds.getString(i, 1)+ "</a>" + "&nbsp;"+ ds.getString(i, 2));
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, ("VECTOR SIZE " + quickDownloadLinks.size()));
+
+ return quickDownloadLinks;
+ } // loadQuickLinks
+
+ public static HashMap loadReportsToSchedule (HttpServletRequest request) throws RaptorException {
+ String userID = AppUtils.getUserID(request);
+ StringBuffer roleList = new StringBuffer();
+ roleList.append("-1");
+ for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();)
+ roleList.append("," + ((String) iter.next()));
+ /*StringBuffer query = new StringBuffer("");
+ query.append("SELECT cr.rep_id, ");
+ query.append("Initcap(cr.title), ");
+ query.append("cr.descr ");
+ query.append("FROM cr_report cr, ");
+ query.append("(SELECT rep_id, ");
+ query.append("MIN(read_only_yn) read_only_yn ");
+ query.append("FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = ");
+ query.append(userID);
+ query.append(") ");
+ query.append("UNION ALL ");
+ query.append("(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN (");
+ query.append(roleList.toString() + "))" + ") report_access ");
+ query.append("GROUP BY rep_id) ra " + "WHERE ");
+ query.append("cr.rep_id = ra.rep_id (+) AND ");
+ query.append(" (cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL or cr.owner_id = " + userID +") ");
+ query.append("ORDER BY Initcap(cr.title)") ;*/
+
+ String sql = Globals.getLoadReportsToSchedule();
+ sql = sql.replace("[userID]", userID);
+ sql = sql.replace("[roleList.toString()]", roleList.toString());
+
+ // DataSet ds = DbUtils
+ // .executeQuery(query.toString());
+
+ DataSet ds = DbUtils
+ .executeQuery(sql);
+ HashMap map = new HashMap();
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ map.put(ds.getItem(i,0), ds.getItem(i,1));
+ }
+
+ return map;
+ }
+
+ public static HashMap loadReportsToAddInDashboard (HttpServletRequest request) throws RaptorException {
+ String userID = AppUtils.getUserID(request);
+ StringBuffer roleList = new StringBuffer();
+ roleList.append("-1");
+ for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();)
+ roleList.append("," + ((String) iter.next()));
+ /*StringBuffer query = new StringBuffer("");
+ query.append("SELECT cr.rep_id, ");
+ query.append("cr.title, ");
+ query.append("cr.descr ");
+ query.append("FROM cr_report cr, ");
+ query.append("(SELECT rep_id, ");
+ query.append("MIN(read_only_yn) read_only_yn ");
+ query.append("FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = ");
+ query.append(userID);
+ query.append(") ");
+ query.append("UNION ALL ");
+ query.append("(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN (");
+ query.append(roleList.toString() + "))" + ") report_access ");
+ query.append("GROUP BY rep_id) ra " + "WHERE ");
+ query.append("cr.rep_id = ra.rep_id (+) AND ");
+ query.append("(nvl(cr.owner_id, cr.create_id) = " + userID);
+ query.append(" OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL) ");
+ query.append(" AND (cr.dashboard_yn = 'N' or cr.dashboard_yn is null) ");
+ query.append("ORDER BY cr.title") ;*/
+
+ String sql = Globals.getLoadReportsToAddInDashboard();
+ sql = sql.replace("[userID]", userID);
+ sql = sql.replace("[roleList.toString()]", roleList.toString());
+
+ // DataSet ds = DbUtils
+ // .executeQuery(query.toString());
+
+ DataSet ds = DbUtils
+ .executeQuery(sql);
+
+ HashMap map = new HashMap();
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ map.put(ds.getItem(i,0), ds.getItem(i,1));
+ }
+
+ return map;
+ }
+
+ public static Vector loadMyRecentLinks(String userID, HttpServletRequest request) throws RaptorException {
+ /* StringBuffer query = new StringBuffer("");
+ query.append("select rep_id, title, descr, form_fields from ( select rownum, rep_id, title, descr, form_fields from ");
+ query.append(" (select cr.rep_id, cr.title, a.form_fields, cr.descr, a.log_time, a.user_id, a.action, a.action_value " );
+ query.append(" from cr_report_log a, cr_report cr where user_id = " + userID);
+ query.append(" and action = 'Report Execution Time' and a.rep_id = cr.rep_id order by log_time desc) x where rownum <= 6 ) y where rownum >= 1");*/
+// DataSet ds = DbUtils
+// .executeQuery(
+// " SELECT a.file_name, b.title,to_char(a.dwnld_start_time, 'Dy DD-Mon-YYYY HH24:MI:SS') as time, "+
+// " a.dwnld_start_time " +
+// " FROM cr_report_dwnld_log a, cr_report b where a.user_id = "+userID +" and "+
+// " a.rep_id = b.rep_id and (a.dwnld_start_time) >= to_date(to_char(sysdate-24/24, 'mm/dd/yyyy'), 'mm/dd/yyyy') " +
+// " and a.record_ready_time is not null " +
+// " order by a.dwnld_start_time desc");
+// DataSet ds = DbUtils
+ // .executeQuery(query.toString());
+
+
+ String sql = Globals.getLoadMyRecentLinks();
+ sql = sql.replace("[userID]", userID);
+
+ DataSet ds = DbUtils
+ .executeQuery(sql);
+
+ Vector myRecentLinks = new Vector(ds.getRowCount());
+ logger.debug(EELFLoggerDelegate.debugLogger, ("ROW SIZE " + ds.getRowCount()));
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ myRecentLinks.add("<a href=\"" + AppUtils.getRaptorActionURL()+"report.run.container&display_content=Y&fromReportLog=Y&refresh=Y&c_master="+ds.getString(i, 0)+ds.getString(i, 3)+"\">" + ds.getString(i, 1)+ "</a>");
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, ("VECTOR SIZE " + myRecentLinks.size()));
+
+ return myRecentLinks;
+ } // loadQuickLinks
+
+ public static void createReportLogEntry(Connection connection, String reportID,
+ String userID, String action, String executionTime,String form_fields) throws RaptorException {
+ if(form_fields.length()>=4000) form_fields = "";
+ //String stmt = "INSERT INTO cr_report_log (rep_id, log_time, user_id, action, action_value, form_fields) VALUES("
+ // + reportID + ", SYSDATE, " + userID + ", '" + action + "' , '" + executionTime + "', '"+ form_fields +"')";
+
+ String stmt = Globals.getCreateReportLogEntry();
+ stmt = stmt.replace("[reportID]", reportID);
+ stmt = stmt.replace("[userID]", userID);
+ stmt = stmt.replace("[action]", action);
+ stmt = stmt.replace("[executionTime]", executionTime);
+ stmt = stmt.replace("[form_fields]", form_fields);
+
+ if (Globals.getEnableReportLog())
+ if (connection == null)
+ DbUtils.executeUpdate(stmt);
+ else
+ DbUtils.executeUpdate(connection, stmt);
+ } // createReportLogEntry
+
+ public static void createReportLogEntryForExecutionTime(Connection connection, String reportID,
+ String userID, String executionTime, String action, String formFields) throws RaptorException {
+ if(formFields.length()>=4000) formFields = "";
+ //String stmt = "INSERT INTO cr_report_log (rep_id, log_time, user_id, action, action_value, form_fields) VALUES("
+ // + reportID + ", sysdate+1/(24*60*60) , " + userID + ", '" + action + "' , '" + executionTime + "', '"+ formFields +"')";
+
+ String stmt = Globals.getCreateReportLogEntryExecTime();
+ stmt = stmt.replace("[reportID]", reportID);
+ stmt = stmt.replace("[userID]", userID);
+ stmt = stmt.replace("[action]", action);
+ stmt = stmt.replace("[executionTime]", executionTime);
+ stmt = stmt.replace("[formFields]", formFields);
+
+ if (Globals.getEnableReportLog())
+ if (connection == null)
+ DbUtils.executeUpdate(stmt);
+ else
+ DbUtils.executeUpdate(connection, stmt);
+ } // createReportLogEntry
+
+ public static void clearReportLogEntries(String reportId, String userId) throws RaptorException {
+ String sql = Globals.getClearReportLogEntries();
+ Connection connection = DbUtils.getConnection();
+ PreparedStatement stmt = null;
+ String reportOwnerID = null;
+ int rowsAffected = 0;
+ try {
+ stmt = connection.prepareStatement(sql);
+ stmt.setInt(1, Integer.parseInt(reportId));
+ stmt.setInt(2, Integer.parseInt(userId));
+ rowsAffected = stmt.executeUpdate();
+ if(rowsAffected > 0) connection.commit();
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ } finally {
+ try {
+ stmt.close();
+ connection.close();
+ DbUtils.clearConnection(connection);
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ }
+ }
+ } // clearReportLogEntries
+
+ public static Vector loadReportLogEntries(String reportId) throws RaptorException {
+ /* StringBuffer query = new StringBuffer("SELECT x.log_time, x.user_id,") ;
+ query.append(" (CASE WHEN x.action = 'Report Execution Time' THEN ");
+ query.append(" '<a href=\"" + AppUtils.getRaptorActionURL() +"report.run.container&c_master='||x.rep_id||'&'||x.form_fields||'&fromReportLog=Y&display_content=Y&noFormFields=Y&refresh=Y\">'||x.action||'</a>'");
+ query.append(" ELSE x.action END) action, " );
+ query.append(" (CASE WHEN x.action = 'Report Execution Time' THEN ");
+ query.append(" action_value " );
+ query.append(" ELSE 'N/A' END) time_taken, " );
+ query.append( " (CASE WHEN x.action = 'Report Execution Time' THEN '<a href=\"" + AppUtils.getRaptorActionURL() +"report.run.container&c_master='||x.rep_id||'&'||x.form_fields||'&fromReportLog=Y&display_content=Y&noFormFields=Y&refresh=Y\"><img src=\""+AppUtils.getImgFolderURL()+ "test_run.gif\" width=\"12\" height=\"12\" border=0 alt=\"Run report\"/></a>' ELSE 'N/A' END) run_image, " );
+ query.append(" x.name FROM ");
+ query.append(" (SELECT rl.rep_id, TO_CHAR(rl.log_time, 'Month DD, YYYY HH:MI:SS AM') log_time, rl.action_value, fuser.last_name ||', '||fuser.first_name name, ");
+ query.append(" rl.user_id, rl.action, rl.form_fields FROM cr_report_log rl, fn_user fuser WHERE rl.rep_id = "+ nvls(reportId)+ " and rl.action != 'Report Run' and fuser.user_id = rl.user_id" );
+ query.append(" ORDER BY rl.log_time DESC) x WHERE ROWNUM <= 100");*/
+// DataSet ds = DbUtils
+// .executeQuery("SELECT x.log_time, x.user_id, x.action FROM (SELECT TO_CHAR(rl.log_time, 'Month DD, YYYY HH:MI:SS AM') log_time, rl.user_id, rl.action FROM cr_report_log rl WHERE rl.rep_id = "
+// + nvls(reportId) + " ORDER BY rl.log_time DESC) x WHERE ROWNUM <= 100");
+ // DataSet ds = DbUtils.executeQuery(query.toString());
+
+ String sql = Globals.getLoadReportLogEntries();
+ sql = sql.replace("[AppUtils.getRaptorActionURL()]", AppUtils.getRaptorActionURL());
+ sql = sql.replace("[AppUtils.getImgFolderURL()]", AppUtils.getImgFolderURL());
+ sql = sql.replace("[nvls(reportId)]", nvls(reportId));
+
+
+ DataSet ds = DbUtils.executeQuery(sql);
+
+ Vector logEntries = new Vector(ds.getRowCount());
+
+ for (int i = 0; i < ds.getRowCount(); i++)
+ logEntries.add(new ReportLogEntry(ds.getString(i, 0), ds
+ .getString(i, 5), ds.getString(i, 2), ds.getString(i, 3), ds.getString(i, 4)));
+
+ return logEntries;
+ } // loadReportLogEntries
+
+ public static boolean doesUserCanScheduleReport(HttpServletRequest request, String scheduleId) throws RaptorException {
+ boolean flagLimit = false;
+ boolean flagScheduleIdPresent = false;
+ String userId = AppUtils.getUserID(request);
+ if(AppUtils.isAdminUser(request))return true;
+ //String query = "select crs.sched_user_id, count(*) from cr_report_schedule crs where sched_user_id = " + userId + " group by crs.sched_user_id having count(*) >= " + Globals.getScheduleLimit();
+ String query = Globals.getDoesUserCanScheduleReport();
+ query = query.replace("[userId]", userId);
+ query = query.replace("[Globals.getScheduleLimit()]", String.valueOf(Globals.getScheduleLimit()));
+
+ DataSet ds = DbUtils.executeQuery(query);
+ logger.debug(EELFLoggerDelegate.debugLogger, (" User Schedule ds.getRowCount() " + ds.getRowCount() + " " +(ds.getRowCount()>0)));
+ if(ds.getRowCount() > 0) flagLimit = true;
+ else flagLimit = false;
+ logger.debug(EELFLoggerDelegate.debugLogger, ("scheduleId " + scheduleId));
+ if(scheduleId==null || scheduleId.trim().length()<=0) return !flagLimit;
+ //query = "select crs.schedule_id from cr_report_schedule crs where schedule_id = " + scheduleId;
+ query = Globals.getDoesUserCanSchedule();
+ query = query.replace("[scheduleId]", scheduleId);
+
+ if(ds.getRowCount() > 0) flagScheduleIdPresent = true;
+ else flagScheduleIdPresent = false;
+ if(!flagLimit) return true;
+ if(flagLimit && flagScheduleIdPresent) return true;
+ else return false;
+ }
+
+ public static String getSystemDateTime() throws RaptorException {
+ //String query = "select to_char(sysdate,'MM/dd/yyyy HH24:mi:ss') from dual";
+ String query = Globals.getTheSystemDateTime();
+
+ DataSet ds = DbUtils.executeQuery(query);
+ String timeStr = "";
+ if(ds.getRowCount() > 0) {
+ timeStr = ds.getString(0,0);
+ }
+ return timeStr;
+
+ }
+
+ public static String getNextDaySystemDateTime() throws RaptorException {
+ //String query = "select to_char(sysdate+1,'MM/dd/yyyy HH24:mi:ss') from dual";
+ String query = Globals.getTheNextDayDateTime();
+ DataSet ds = DbUtils.executeQuery(query);
+ String timeStr = "";
+ if(ds.getRowCount() > 0) {
+ timeStr = ds.getString(0,0);
+ }
+ return timeStr;
+
+ }
+
+ public static String getNext15MinutesOfSystemDateTime() throws RaptorException {
+ //String query = "select to_char(sysdate+15/(24*60),'MM/dd/yyyy HH24:mi:ss') from dual";
+ String query = Globals.getTheNextFifteenMinDateTime();
+
+ DataSet ds = DbUtils.executeQuery(query);
+ String timeStr = "";
+ if(ds.getRowCount() > 0) {
+ timeStr = ds.getString(0,0);
+ }
+ return timeStr;
+
+ }
+
+ public static String getNext30MinutesOfSystemDateTime() throws RaptorException {
+ //String query = "select to_char(sysdate+30/(24*60),'MM/dd/yyyy HH24:mi:ss') from dual";
+ String query = Globals.getTheNextThirtyMinDateTime();
+ DataSet ds = DbUtils.executeQuery(query);
+ String timeStr = "";
+ if(ds.getRowCount() > 0) {
+ timeStr = ds.getString(0,0);
+ }
+ return timeStr;
+
+ }
+
+ public static String getTemplateFile(String reportId) throws RaptorException {
+ //String query = "select template_file from cr_report_template_map where report_id = " + reportId;
+ String query = Globals.getTheTemplateFile();
+ query = query.replace("[reportId]", reportId);
+ String templateFile = "";
+ try {
+ DataSet ds = DbUtils.executeQuery(query);
+ if(ds.getRowCount() > 0) {
+ templateFile = ds.getString(0,0);
+ }
+ }catch(RaptorException ex) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("SQL Exception while trying to access cr_report_template_map "));
+ }
+ return templateFile;
+
+ }
+
+
+ public static HashMap loadPDFImgLookUp() throws RaptorException {
+ StringBuffer query = new StringBuffer("");
+ HashMap pdfImgMap = new HashMap();
+ //query.append("select image_id, image_loc from cr_raptor_pdf_img");
+ query.append(Globals.getLoadPdfImgLookup());
+ DataSet ds = DbUtils.executeQuery(query.toString());
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ pdfImgMap.put(ds.getString(i, 0), ds.getString(i,1));
+ }
+ return pdfImgMap;
+ } // loadQuickLinks
+
+ public static HashMap loadActionImgLookUp() throws RaptorException {
+ StringBuffer query = new StringBuffer("");
+ HashMap pdfImgMap = new HashMap();
+ //query.append("select image_id, image_loc from cr_raptor_action_img");
+ query.append(Globals.getLoadActionImgLookup());
+ DataSet ds = DbUtils.executeQuery(query.toString());
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ pdfImgMap.put(ds.getString(i, 0), ds.getString(i,1));
+ }
+ return pdfImgMap;
+ } // loadQuickLinks
+
+} // ReportLoader
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/SearchHandler.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/SearchHandler.java
new file mode 100644
index 00000000..428bc90a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/SearchHandler.java
@@ -0,0 +1,490 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+/* ===========================================================================================
+ * This class is part of <I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I>
+ * Raptor : This tool is used to generate different kinds of reports with lot of utilities
+ * ===========================================================================================
+ *
+ * -------------------------------------------------------------------------------------------
+ * SearchHandler.java - This class is used to search reports and sort them in different order
+ * based on preference. It can also download the list in CSV format.
+ * -------------------------------------------------------------------------------------------
+ *
+ *
+ *
+ * Changes
+ * -------
+ * 18-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> request Object is passed to prevent caching user/roles - Datamining/Hosting. </LI></UL>
+ * 13-Aug-2009 : Version 8.5 (Sundar);<UL><LI>Refresh is added while running report.</LI>
+ * </UL>
+ * 27-Jul-2009 : Version 8.4 (Sundar);<UL><LI> A new sort order PUBLIC is added.</LI>
+ * <LI> In Public reports option it brings all the reports
+ * including the one which logged in user didn't create
+ * and which is not public. This is available for Super users and "Admin equivalent Super Users".</LI>
+ * </UL>
+ *
+ */
+package org.openecomp.portalsdk.analytics.model;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.Iterator;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.controller.ErrorHandler;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.model.search.ReportSearchResult;
+import org.openecomp.portalsdk.analytics.model.search.ReportSearchResultJSON;
+import org.openecomp.portalsdk.analytics.model.search.SearchResultColumn;
+import org.openecomp.portalsdk.analytics.model.search.SearchResultField;
+import org.openecomp.portalsdk.analytics.model.search.SearchResultRow;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.HtmlStripper;
+
+public class SearchHandler extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private static final String HTML_FORM = "forma";
+ private final static String PRIVATE_ICON = "<img border=0 src="
+ + AppUtils.getImgFolderURL()
+ + "accessicon.gif alt=Private width=16 height=12>&nbsp;";
+
+ public SearchHandler() {
+ }
+
+ public void createCSVFileContent(Writer out, ReportSearchResult sr) throws IOException {
+ PrintWriter csvOut = new PrintWriter(out);
+ HtmlStripper strip = new HtmlStripper();
+
+ for (int c = 1; c < sr.getNumColumns(); c++) {
+ SearchResultColumn column = sr.getColumn(c);
+ if (column.getLinkURL() == null)
+ csvOut.print("\"" + column.getColumnTitle() + "\",");
+ } // for
+ csvOut.println();
+
+ for (int r = 0; r < sr.getNumRows(); r++) {
+ SearchResultRow row = sr.getRow(r);
+
+ int c = 1;
+ for (row.resetNext(1); row.hasNext();) {
+ SearchResultField field = row.getNext();
+ if (sr.getColumn(c++).getLinkURL() == null)
+ if (field.getDisplayValue().startsWith(PRIVATE_ICON))
+ csvOut.print("\""
+ + strip.stripHtml(field.getDisplayValue().substring(PRIVATE_ICON.length()))
+ + "\",");
+ else
+ csvOut.print("\"" + strip.stripHtml(field.getDisplayValue()) + "\",");
+ } // for
+
+ csvOut.println();
+ } // for
+ } // createCSVFileContent
+
+ public String saveCSVPageFile(HttpServletRequest request, ReportSearchResult sr) {
+ try {
+ String csvFName = AppUtils.generateFileName(request,
+ (sr.getPageNo() < 0) ? AppConstants.FT_CSV_ALL : AppConstants.FT_CSV);
+
+ BufferedWriter csvOut = new BufferedWriter(new FileWriter(AppUtils
+ .getTempFolderPath()
+ + csvFName));
+ createCSVFileContent(csvOut, sr);
+ csvOut.close();
+
+ if (sr.getPageNo() < 0)
+ sr.setCsvAllRowsFileName(csvFName);
+ else
+ sr.setCsvPageFileName(csvFName);
+
+ return csvFName;
+ } catch (Exception e) {
+ (new ErrorHandler()).processError(request, "Exception saving data to CSV file: "
+ + e.getMessage());
+ return null;
+ }
+ } // saveCSVPageFile
+
+ public ReportSearchResultJSON loadReportSearchResult(HttpServletRequest request)
+ throws RaptorException {
+ String userID = AppUtils.getUserID(request);
+ String fReportID = nvl(AppUtils.getRequestValue(request, AppConstants.RI_F_REPORT_ID));
+ String fReportName = nvl(AppUtils.getRequestValue(request,
+ AppConstants.RI_F_REPORT_NAME));
+ String sortOrder = nvl(AppUtils.getRequestValue(request, AppConstants.RI_SORT_ORDER),
+ AppConstants.RI_F_REPORT_NAME);
+
+ String menuId = nvl(AppUtils.getRequestValue(request, AppConstants.RI_LIST_CATEGORY));
+
+ boolean userOnly = AppUtils.getRequestFlag(request, AppConstants.RI_USER_REPORTS);
+ boolean publicOnly = AppUtils.getRequestFlag(request, AppConstants.RI_PUBLIC_REPORTS);
+ boolean favoriteOnly = AppUtils.getRequestFlag(request, AppConstants.RI_FAVORITE_REPORTS);
+
+ int pageNo = 0;
+ try {
+ pageNo = Integer.parseInt(request.getParameter(AppConstants.RI_NEXT_PAGE));
+ } catch (Exception e) {
+ }
+
+ StringBuffer roleList = new StringBuffer();
+ roleList.append("-1");
+ String rep_title_sql = "'<a class=\"hyperref1\" href=''#'' onClick=''document."+HTML_FORM+"."+AppConstants.RI_ACTION+".value=\"report.run\";"+
+ "document."+HTML_FORM+".c_master.value=\"'|| cr.rep_id||'\";document."+HTML_FORM+".refresh.value=\"Y\";document."+HTML_FORM+".submit();return false;''>'";
+ for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();)
+ roleList.append("," + ((String) iter.next()));
+ //<a href="#" alt="Run report" onClick="document.forma.r_action.value='report.run'; document.forma.c_master.value='1073';">
+ /*String sql = "SELECT cr.rep_id, "
+ + "cr.rep_id report_id, "
+ + rep_title_sql+
+ "||DECODE(cr.public_yn, 'Y', '', '"
+ + PRIVATE_ICON
+ + "')||cr.title||'</a>' title, "
+ + "cr.descr, "
+ + "au.first_name||' '||au.last_name owner_name, "
+ + "TO_CHAR(cr.create_date, 'MM/DD/YYYY') create_date, "
+ + "DECODE(NVL(cr.owner_id, cr.create_id), "
+ + userID
+ + ", 'N', NVL(ra.read_only_yn, 'Y')) read_only_yn, "
+ + "DECODE(NVL(cr.owner_id, cr.create_id), "
+ + userID
+ + ", 'Y', 'N') user_is_owner_yn, "
+ + "case when report_xml like '%<allowSchedule>N</allowSchedule>%' "
+ + "then 'N' "
+ + "when report_xml like '%<allowSchedule>Y</allowSchedule>%' "
+ + "or 1 = (select distinct 1 from cr_report_schedule where rep_id = cr.rep_id) "
+ + "then 'Y' "
+ + "else 'N' end "
+ + "FROM cr_report cr, "
+ + "app_user au, "
+ + "(SELECT rep_id, "
+ + "MIN(read_only_yn) read_only_yn "
+ + "FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = "
+ + userID
+ + ") "
+ + "UNION ALL "
+ + "(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN ("
+ + roleList.toString() + "))" + ") report_access " + "GROUP BY rep_id) ra "
+ + "WHERE TO_CHAR(cr.rep_id) = nvl('" + fReportID
+ + "', TO_CHAR(cr.rep_id)) AND " + "UPPER(cr.title) LIKE UPPER('%"
+ + fReportName + "%') AND " + "nvl(cr.owner_id, cr.create_id) = au.user_id "
+ + "AND cr.rep_id = ra.rep_id (+) ";*/
+
+ String sql = Globals.getLoadReportSearchResult();
+ String rep_id = "";
+ String rep_id_options = "";
+ String rep_id_sql = " AND FORMAT(cr.rep_id, 0) like coalesce('%%', FORMAT(cr.rep_id, 0)) ";
+ if(request.getParameter("rep_id")!=null) {
+ rep_id = request.getParameter("rep_id");
+ }
+ if(request.getParameter("rep_id_options")!=null) {
+ rep_id_options = request.getParameter("rep_id_options");
+ }
+
+ /*Default: AND FORMAT(cr.rep_id, 0) like coalesce('%%', FORMAT(cr.rep_id, 0)) */
+
+ /*Equal to AND cr.rep_id = 1000 0 */
+ /*Less than : AND cr.rep_id < 1000 1 */
+ /*Greater than AND cr.rep_id > 1000 2 */
+
+
+ if(AppUtils.nvl(rep_id).length()>0 ) {
+ if(AppUtils.nvl(rep_id_options).length()>0 ) {
+ switch (rep_id_options) {
+ case "0":
+ rep_id_sql = " AND cr.rep_id = "+ rep_id+" ";
+ break;
+ case "1":
+ rep_id_sql = " AND cr.rep_id < "+ rep_id+" ";
+ break;
+ case "2":
+ rep_id_sql = " AND cr.rep_id > "+ rep_id+" ";
+ break;
+ default:
+ rep_id_sql = " AND FORMAT(cr.rep_id, 0) like coalesce('%%', FORMAT(cr.rep_id, 0)) ";
+ break;
+ }
+ } else {
+ rep_id_sql = " AND cr.rep_id = "+ rep_id+" ";
+ }
+ } else {
+ rep_id_sql = " AND FORMAT(cr.rep_id, 0) like coalesce('%%', FORMAT(cr.rep_id, 0)) "; //equal is default
+ }
+
+ sql = sql.replace("[fReportID]", rep_id_sql);
+
+ String rep_name = "";
+ String rep_name_options = "";
+ String rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('%%') ";
+ if(request.getParameter("rep_name")!=null) {
+ rep_name = request.getParameter("rep_name");
+ }
+ if(request.getParameter("rep_name_options")!=null) {
+ rep_name_options = request.getParameter("rep_name_options");
+ }
+
+ /* Report name AND UPPER(cr.title) LIKE UPPER('Dash%') 0 */
+
+ /* Report name AND UPPER(cr.title) LIKE UPPER('%1') 1 */
+ /* Report name AND UPPER(cr.title) LIKE UPPER('%1%') 2 */
+
+ if(AppUtils.nvl(rep_name).length()>0 ) {
+ if(AppUtils.nvl(rep_name_options).length()>0 ) {
+ switch (rep_name_options) {
+ case "0":
+ rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('"+rep_name+"%') ";
+ break;
+ case "1":
+ rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('%"+rep_name+"') ";
+ break;
+ case "2":
+ rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('%"+rep_name+"%') ";
+ break;
+ default:
+ rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('%%') ";
+ break;
+ }
+ } else {
+ rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('%"+rep_name+"%') "; //contains is default
+ }
+ } else {
+ rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('%%') ";
+ }
+ sql = sql.replace("[fReportName]", rep_name_sql);
+
+ if (menuId.length() > 0){
+ /*sql += "AND INSTR('|'||cr.menu_id||'|', '|'||'" + menuId + "'||'|') > 0 "
+ * +"AND
+ * cr.menu_approved_yn =
+ * 'Y' "
+ ;*/
+ String sql_add = Globals.getLoadReportSearchInstr();
+ sql+= sql_add;
+ }
+
+ //String user_sql = " AND nvl(cr.owner_id, cr.create_id) = " + userID;
+ String user_sql = Globals.getLoadReportSearchResultUser();
+
+ //String public_sql = " AND (nvl(cr.owner_id, cr.create_id) = " + userID
+ // + " OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL)";
+ String public_sql = Globals.getLoadReportSearchResultPublic();
+
+ //String fav_sql = " AND cr.rep_id in (select rep_id from cr_favorite_reports where user_id = " + userID +" ) ";
+ String fav_sql = Globals.getLoadReportSearchResultFav();
+
+ if (userOnly)
+ // My reports - user is owner
+ sql += " " + user_sql;
+ else if (publicOnly) {
+ // Public reports - user has read or write access to the report
+ // (user is owner or report is public or user has explicit user or
+ // role access)
+ if (!AppUtils.isSuperUser(request))
+ sql += " " + public_sql;
+ } else if (favoriteOnly) {
+ sql += " " + public_sql;
+ sql += " " + fav_sql;
+ } else if (!AppUtils.isSuperUser(request)) {
+ // All reports
+ // If user is super user - gets unrestricted access to all reports
+ // (read_only gets overriden later)
+ // else - not super user - doesn't get access to private reports of
+ // other users (= Public reports); Admin users get edit right
+ // override later
+ //sql += public_sql;
+ sql += " " + public_sql;
+ }
+
+
+
+ if (sortOrder.equals(AppConstants.RI_F_OWNER_ID)){
+ //sql += " ORDER BY DECODE(nvl(cr.owner_id, cr.create_id), " + userID
+ //+ ", ' ', upper(au.first_name||' '||au.last_name)), upper(cr.title)";
+ String sql_sort = Globals.getLoadReportSearchResultSort();
+ sql+=" " + sql_sort;
+ }
+ else if (sortOrder.equals(AppConstants.RI_F_REPORT_ID))
+ sql += " ORDER BY cr.rep_id";
+ else if(sortOrder.equals(AppConstants.RI_F_REPORT_CREATE_DATE))
+ sql += " ORDER BY cr.create_date";
+ else if(sortOrder.equals(AppConstants.RI_F_PUBLIC))
+ sql += " ORDER BY cr.public_yn desc";
+
+ else
+ // if(sortOrder.equals(AppConstants.RI_F_REPORT_NAME))
+ sql += " ORDER BY upper(cr.title)";
+
+ sql = sql.replace("[rep_title_sql]", "cr.title");
+ sql = sql.replace("[PRIVATE_ICON]", PRIVATE_ICON);
+ sql = sql.replace("[userID]", userID);
+ sql = sql.replace("[roleList.toString()]", roleList.toString());
+
+ //System.out.println("query is for search list is : " + sql);
+ DataSet ds = DbUtils.executeQuery(sql);
+
+ ReportSearchResultJSON rsr = new ReportSearchResultJSON(0, 6, 7);
+ rsr.parseData(ds, request, 0, 20, 6, 7);
+ //saveCSVPageFile(request, rsr);
+ //rsr.truncateToPage(pageNo);
+ //saveCSVPageFile(request, rsr);
+
+ return rsr;
+ } // loadReportSearchResult
+
+ public ReportSearchResult loadFolderReportResult(HttpServletRequest request)
+ throws Exception {
+ String userID = AppUtils.getUserID(request);
+ String fReportID = nvl(AppUtils.getRequestValue(request, AppConstants.RI_F_REPORT_ID));
+ String fReportName = nvl(AppUtils.getRequestValue(request,
+ AppConstants.RI_F_REPORT_NAME));
+ String sortOrder = nvl(AppUtils.getRequestValue(request, AppConstants.RI_SORT_ORDER),
+ AppConstants.RI_F_REPORT_NAME);
+
+ String menuId = nvl(AppUtils.getRequestValue(request, AppConstants.RI_LIST_CATEGORY));
+
+ boolean userOnly = AppUtils.getRequestFlag(request, AppConstants.RI_USER_REPORTS);
+ boolean publicOnly = AppUtils.getRequestFlag(request, AppConstants.RI_PUBLIC_REPORTS);
+
+ int pageNo = 0;
+ try {
+ pageNo = Integer.parseInt(request.getParameter(AppConstants.RI_NEXT_PAGE));
+ } catch (Exception e) {
+ }
+
+ StringBuffer roleList = new StringBuffer();
+ roleList.append("-1");
+ String rep_title_sql = "'<a class=\"hyperref1\" href=''#'' onClick=''document."+HTML_FORM+"."+AppConstants.RI_ACTION+".value=\"report.run\";"+
+ "document."+HTML_FORM+".c_master.value=\"'|| cr.rep_id||'\";document."+HTML_FORM+".submit();return false;''>'";
+ for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();)
+ roleList.append("," + ((String) iter.next()));
+ //<a href="#" alt="Run report" onClick="document.forma.r_action.value='report.run'; document.forma.c_master.value='1073';">
+ /*String sql = "SELECT cr.rep_id, "
+ + "cr.rep_id report_id, "
+ + rep_title_sql+
+ "||DECODE(cr.public_yn, 'Y', '', '"
+ + PRIVATE_ICON
+ + "')||cr.title||'</a>' title, "
+ + "cr.descr, "
+ + "au.first_name||' '||au.last_name owner_name, "
+ + "TO_CHAR(cr.create_date, 'MM/DD/YYYY') create_date, "
+ + "DECODE(NVL(cr.owner_id, cr.create_id), "
+ + userID
+ + ", 'N', NVL(ra.read_only_yn, 'Y')) read_only_yn, "
+ + "DECODE(NVL(cr.owner_id, cr.create_id), "
+ + userID
+ + ", 'Y', 'N') user_is_owner_yn "
+ + "FROM cr_report cr, "
+ + "app_user au, "
+ + "(SELECT rep_id, "
+ + "MIN(read_only_yn) read_only_yn "
+ + "FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = "
+ + userID
+ + ") "
+ + "UNION ALL "
+ + "(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN ("
+ + roleList.toString() + "))" + ") report_access " + "GROUP BY rep_id) ra "
+ + "WHERE TO_CHAR(cr.rep_id) = nvl('" + fReportID
+ + "', TO_CHAR(cr.rep_id)) AND " + "UPPER(cr.title) LIKE UPPER('%"
+ + fReportName + "%') AND " + "nvl(cr.owner_id, cr.create_id) = au.user_id "
+ + "AND cr.rep_id = ra.rep_id (+) ";*/
+
+ String sql = Globals.getLoadFolderReportResult();
+ sql = sql.replace("[rep_title_sql]", rep_title_sql);
+ sql = sql.replace("[PRIVATE_ICON]", PRIVATE_ICON);
+ sql = sql.replace("[userID]", userID);
+ sql = sql.replace("[roleList.toString()]", roleList.toString());
+ sql = sql.replace("[fReportID]", fReportID);
+ sql = sql.replace("[fReportName]", fReportName);
+
+ if (menuId.length() > 0){
+ /*sql += "AND INSTR('|'||cr.menu_id||'|', '|'||'" + menuId + "'||'|') > 0 "
+ * +"AND
+ * cr.menu_approved_yn =
+ * 'Y' "
+ ;*/
+ String sql_add = Globals.getLoadReportSearchInstr();
+ sql+= sql_add;
+ }
+
+ //String user_sql = " AND nvl(cr.owner_id, cr.create_id) = " + userID;
+ String user_sql = Globals.getLoadReportSearchResultUser();
+
+ //String public_sql = " AND (nvl(cr.owner_id, cr.create_id) = " + userID
+ // + " OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL)";
+ String public_sql = Globals.getLoadReportSearchResultPublic();
+
+ if (userOnly)
+ // My reports - user is owner
+ sql += user_sql;
+ else if (publicOnly)
+ // Public reports - user has read or write access to the report
+ // (user is owner or report is public or user has explicit user or
+ // role access)
+ if (!AppUtils.isSuperUser(request))
+ sql += public_sql;
+ else if (!AppUtils.isSuperUser(request)) {
+ // All reports
+ // If user is super user - gets unrestricted access to all reports
+ // (read_only gets overriden later)
+ // else - not super user - doesn't get access to private reports of
+ // other users (= Public reports); Admin users get edit right
+ // override later
+ sql += public_sql;
+ }
+
+ if (sortOrder.equals(AppConstants.RI_F_OWNER_ID)){
+
+
+ //sql += " ORDER BY DECODE(nvl(cr.owner_id, cr.create_id), " + userID
+ // + ", ' ', au.first_name||' '||au.last_name), cr.title";
+
+ String sql_sort = Globals.getLoadFolderReportResultSort();
+ sql+=sql_sort;
+ }
+ else if (sortOrder.equals(AppConstants.RI_F_REPORT_ID))
+ sql += " ORDER BY cr.rep_id";
+ else if(sortOrder.equals(AppConstants.RI_F_REPORT_CREATE_DATE))
+ sql += " ORDER BY cr.create_date";
+ else if(sortOrder.equals(AppConstants.RI_F_PUBLIC))
+ sql += " ORDER BY cr.public_yn desc";
+ else
+ // if(sortOrder.equals(AppConstants.RI_F_REPORT_NAME))
+ sql += " ORDER BY cr.title";
+
+ //System.out.println("query is for search list is : " + sql);
+ DataSet ds = DbUtils.executeQuery(sql);
+
+ ReportSearchResult rsr = new ReportSearchResult(-1, 6, 7);
+ rsr.parseData(ds, request);
+ saveCSVPageFile(request, rsr);
+ rsr.truncateToPage(pageNo);
+ saveCSVPageFile(request, rsr);
+
+ return rsr;
+ } // loadFolderReportResult
+
+
+} // SearchHandler
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ChartSeqComparator.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ChartSeqComparator.java
new file mode 100644
index 00000000..7b15db55
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ChartSeqComparator.java
@@ -0,0 +1,49 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.base;
+
+import java.util.Comparator;
+
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+
+public class ChartSeqComparator implements Comparator {
+
+ public int compare(Object o1, Object o2) {
+ DataColumnType dct1 = (DataColumnType) o1;
+ DataColumnType dct2 = (DataColumnType) o2;
+
+ int dct1ChartSeq = (dct1.getChartSeq()!=null ? dct1.getChartSeq().intValue(): -1);
+ int dct2ChartSeq = (dct2.getChartSeq()!=null ? dct2.getChartSeq().intValue(): -1);
+
+ if (dct1ChartSeq == dct2ChartSeq)
+ return 0;
+ else if (dct1ChartSeq < 0) // Position columns
+ // with seq -1 at
+ // the end
+ return 1;
+ else if (dct2ChartSeq < 0)
+ return -1;
+ else if (dct1ChartSeq < dct2ChartSeq)
+ return -1;
+ else
+ return 1;
+ } // compare
+
+} // ChartSeqComparator
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameColLookup.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameColLookup.java
new file mode 100644
index 00000000..d7fdc33a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameColLookup.java
@@ -0,0 +1,35 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.base;
+
+public class IdNameColLookup extends IdNameLookup {
+ private String colId = null;
+
+ public IdNameColLookup(String colId, String dbTableName, String dbIdField,
+ String dbNameField, String dbSortByField) {
+ super(dbTableName, dbIdField, dbNameField, dbSortByField, false);
+ this.colId = colId;
+ } // IdNameColLookup
+
+ public String getColId() {
+ return colId;
+ }
+
+} // IdNameColLookup
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameList.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameList.java
new file mode 100644
index 00000000..dba3db03
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameList.java
@@ -0,0 +1,183 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.base;
+
+import java.util.Vector;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.system.Globals;
+
+public class IdNameList extends Vector {
+ protected int pageNo = -1;
+
+ protected int pageSize = 50;
+
+ private int nextElemIdx = 0;
+
+ private String oldSql = null;
+
+ public IdNameList() {
+ super();
+ pageSize = Globals.getFormFieldsListSize();
+ } // IdNameList
+
+ public int getPageNo() {
+ return pageNo;
+ } // getPageNo
+
+ public int getPageSize() {
+ return pageSize;
+ } // getPageSize
+
+ public int getDataSize() {
+ return size();
+ } // getDataSize
+
+ public void resetNext() {
+ resetNext(0);
+ } // resetNext
+
+ public void resetNext(int toPos) {
+ nextElemIdx = toPos;
+ } // resetNext
+
+ public boolean hasNext() {
+ return (nextElemIdx < size());
+ } // hasNext
+
+ public IdNameValue getNext() {
+ return hasNext() ? getValue(nextElemIdx++) : null;
+ } // getNext
+
+ public int getCount() {
+ return size();
+ } // getCount
+
+ public IdNameValue getValue(int idx) {
+ return (IdNameValue) get(idx);
+ } // getValue
+
+ public void addValue(IdNameValue value) {
+ add(value);
+ } // addValue
+
+ public void addValue(String id, String name, boolean defaultValue) {
+ addValue(new IdNameValue(id, name, defaultValue));
+ } // addValue
+
+ public void addValue(String id, String name, boolean defaultValue, boolean readOnly) {
+ addValue(new IdNameValue(id, name, defaultValue, readOnly));
+ } // addValue
+
+ public void addValue(String id, String name) {
+ addValue(new IdNameValue(id, name));
+ } // addValue
+
+ public void addValue(int idx, IdNameValue value) {
+ add(idx, value);
+ } // addValue
+
+ public void addValue(int idx, String id, String name) {
+ addValue(idx, new IdNameValue(id, name));
+ } // addValue
+
+ public String getNameById(String id) {
+ for (int i = 0; i < size(); i++) {
+ IdNameValue value = getValue(i);
+ if (value.getId().equals(id))
+ return value.getName();
+ } // for
+
+ return null;
+ } // getNameById
+
+ public String getIdByName(String name) {
+ for (int i = 0; i < size(); i++) {
+ IdNameValue value = getValue(i);
+ if (value.getName().equals(name))
+ return value.getId();
+ } // for
+
+ return null;
+ } // getIdByName
+
+ public boolean canUseSearchString() {
+ return true;
+ }
+
+ public String getBaseSQL() {
+ return null;
+ }
+
+ public String getOldSql() {
+ return oldSql;
+ }
+
+ public void setOldSql(String oldSql) {
+ this.oldSql = oldSql;
+ }
+ public String getBaseWholeSQL() {
+ return null;
+ }
+
+ public String getBaseWholeReadonlySQL() {
+ return null;
+ }
+
+ public String getBaseSQLForPDFExcel(boolean multiParam) {
+ return null;
+ }
+
+ public void clearData() {
+ }
+
+ public void loadData(String pageNo, String searchString, String dbInfo,String userId) throws RaptorException {}
+ public void loadUserData(String pageNo, String searchString, String dbInfo,String userId) throws RaptorException {}
+ public void loadUserData(int pageNo, String searchString, String dbInfo, String userId) throws RaptorException {}
+ public void loadUserData(String searchString, int pageNo, String dbInfo) throws RaptorException {}
+
+ public void loadData(String pageNo) throws RaptorException {}
+ public void loadData(int pageNo) throws RaptorException {}
+ public void loadData(String pageNo, String searchString, String dbInfo) throws RaptorException {}
+ private void loadData(int pageNo, String searchString, String dbInfo) throws RaptorException {}
+
+/*
+ public void loadData(int pageNo, String dbInfo) throws RaptorException {
+ }
+
+ public void loadUserData(int pageNo, String dbInfo, String userId) throws RaptorException {
+ }
+
+
+
+
+ public void loadData(String pageNo, String searchString) throws RaptorException {
+ }
+
+*/
+ protected static String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ protected static String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+} // IdNameList
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameLookup.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameLookup.java
new file mode 100644
index 00000000..e4424f62
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameLookup.java
@@ -0,0 +1,198 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.base;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+
+public class IdNameLookup extends IdNameSql {
+ private String dbTableName = null;
+
+ private String dbIdField = null;
+
+ private String dbNameField = null;
+
+ private String dbSortByField = null;
+
+ private String searchString = "";
+
+ public IdNameLookup(int pageNo, String dbTableName, String dbIdField, String dbNameField) {
+ this(dbTableName, dbIdField, dbNameField);
+
+ this.pageNo = pageNo;
+ } // IdNameLookup
+
+ public IdNameLookup(String dbTableName, String dbIdField, String dbNameField) {
+ this(dbTableName, dbIdField, dbNameField, null, "", false);
+ } // IdNameLookup
+
+/* public IdNameLookup(String dbTableName, String dbIdField, String dbNameField,
+ String dbSortByField) {
+ super();
+
+ setDbTableName(dbTableName);
+ setDbIdField(dbIdField);
+ setDbNameField(dbNameField);
+ setDbSortByField(dbSortByField);
+ updateParentSQL();
+ } // IdNameLookup
+
+ public IdNameLookup(String dbTableName, String dbIdField, String dbNameField,
+ String dbSortByField, String defaultSQL) {
+ super();
+
+ setDbTableName(dbTableName);
+ setDbIdField(dbIdField);
+ setDbNameField(dbNameField);
+ setDbSortByField(dbSortByField);
+ setDefaultSQL(defaultSQL);
+ updateParentSQL();
+ } // IdNameLookup
+*/
+ public IdNameLookup(String dbTableName, String dbIdField, String dbNameField,
+ String dbSortByField, boolean textField) {
+ super();
+ setDbTableName(dbTableName);
+ setDbIdField(dbIdField);
+ setDbNameField(dbNameField);
+ setDbSortByField(dbSortByField);
+ if(!textField)
+ updateParentSQL();
+ } // IdNameLookup
+
+ public IdNameLookup(String dbTableName, String dbIdField, String dbNameField,
+ String dbSortByField, String defaultSQL, boolean textField) {
+ super();
+
+ setDbTableName(dbTableName);
+ setDbIdField(dbIdField);
+ setDbNameField(dbNameField);
+ setDbSortByField(dbSortByField);
+ setDefaultSQL(defaultSQL);
+ if(!textField)
+ updateParentSQL();
+ } // IdNameLookup
+
+ public String getDbTableName() {
+ return dbTableName;
+ }
+
+ public String getDbIdField() {
+ return dbIdField;
+ }
+
+ public String getDbNameField() {
+ return dbNameField;
+ }
+
+ public String getDbSortByField() {
+ return dbSortByField;
+ }
+
+ public void setDbTableName(String dbTableName) {
+ this.dbTableName = dbTableName;
+ }
+
+ public void setDbIdField(String dbIdField) {
+ this.dbIdField = dbIdField;
+ }
+
+ public void setDbNameField(String dbNameField) {
+ this.dbNameField = dbNameField;
+ }
+
+
+ public void setDbSortByField(String dbSortByField) {
+ this.dbSortByField = dbSortByField;
+ }
+
+ private void updateParentSQL() {
+ String sql_start = "SELECT DISTINCT " + dbIdField + " id, " + dbNameField + " name";
+ String sql_end = " FROM " + dbTableName + " WHERE " + dbIdField + " IS NOT NULL";
+ if (searchString.length() > 0)
+ sql_end += " AND UPPER(" + dbNameField + ") LIKE UPPER('" + searchString + "')";
+
+ String sql_middle = "";
+ if (dbSortByField != null && (!dbSortByField.equals(dbNameField)) && (!dbSortByField.trim().startsWith("TO_DATE")))
+ sql_middle = ", "
+ + ((dbSortByField.indexOf(' ') > 0) ? dbSortByField.substring(0,
+ dbSortByField.indexOf(' ')) : dbSortByField) + " sort";
+
+ setSqlNoOrderBy(sql_start + sql_middle + sql_end);
+// System.out.println("SQL Start " + sql_start);
+// System.out.println("SQL Middle " + sql_middle);
+// System.out.println("SQL End " + sql_end);
+// System.out.println("DbSortByField " + dbSortByField);
+
+ setSql(sql_start + sql_middle + sql_end + " ORDER BY " + nvl(dbSortByField, "2"));
+ } // updateParentSQL
+
+ public boolean canUseSearchString() {
+ return true;
+ }
+
+ public String getBaseSQL() {
+ return "SELECT " + dbIdField + " FROM " + dbTableName;
+ } // getBaseSQL
+
+ public String getBaseWholeSQL() {
+ return "SELECT " + dbIdField + " FROM " + dbTableName;
+ } // getBaseSQL
+
+ /*
+ public void loadData(int pageNo) throws RaptorException {
+ loadData(pageNo, "");
+ } // loadData
+
+ public void loadData(String pageNo) throws RaptorException {
+ loadData(pageNo, "");
+ } // loadData
+*/
+
+ public void loadData(String pageNo, String searchString, String dbInfo) throws RaptorException {
+ int iPageNo = 0;
+
+ if (pageNo != null)
+ try {
+ iPageNo = Integer.parseInt(pageNo);
+ } catch (NumberFormatException e) {
+ }
+
+ loadData(iPageNo, searchString, dbInfo);
+ } // loadData
+
+ private void loadData(int pageNo, String searchString, String dbInfo) throws RaptorException {
+ boolean dataAlreadyLoaded = (this.pageNo == pageNo)
+ && (this.searchString.equals(searchString));
+
+ if (dataAlreadyLoaded)
+ return;
+
+ if (!this.searchString.equals(searchString)) {
+ dataSize = -1;
+ pageNo = 0;
+ } // if
+
+ this.pageNo = pageNo;
+ this.searchString = searchString;
+ updateParentSQL();
+ performLoadData(searchString,dbInfo);
+ } // loadData
+
+} // IdNameLookup
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameSql.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameSql.java
new file mode 100644
index 00000000..9928ad80
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameSql.java
@@ -0,0 +1,400 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+/* ===========================================================================================
+ * This class is part of <I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I>
+ * Raptor : This tool is used to generate different kinds of reports with lot of utilities
+ * ===========================================================================================
+ *
+ * -------------------------------------------------------------------------------------------
+ * IdNameSql.java - This class is used to generate form field items when sql is provided.
+ * -------------------------------------------------------------------------------------------
+ *
+ * Created By : Stan Pishamanov
+ * Modified By: Sundar Ramalingam
+ *
+ * Changes
+ * -------
+ * 08-Jun-2009 : Version 8.3 (RS); Rownum references is avoided for reports connnecting to Daytona
+ * Database.
+ *
+ */
+package org.openecomp.portalsdk.analytics.model.base;
+
+import java.util.HashMap;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class IdNameSql extends IdNameList {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(IdNameSql.class);
+
+
+ protected int dataSize = -1;
+
+ protected int dataSizeUsedInPopup = -1;
+
+ private String sql = null;
+
+ private String oldSql = null;
+
+ private String defaultSQL = null;
+
+ private String sqlNoOrderBy = null;
+
+ public IdNameSql(int pageNo, String sql, String defaultSQL) {
+ this(sql,defaultSQL);
+ this.pageNo = pageNo;
+ } // IdNameSql
+
+ public IdNameSql(String sql) {
+ this();
+ setSql(sql);
+ } // IdNameSql
+
+ public IdNameSql(String sql, String defaultSQL) {
+ this();
+ setDefaultSQL(defaultSQL);
+ setSql(sql);
+ } // IdNameSql
+
+ protected IdNameSql() {
+ super();
+ } // IdNameSql
+
+ public boolean canUseSearchString() {
+ return true;
+ }
+
+ public String getSql() {
+ return sql;
+ }
+
+ public String getOldSql() {
+ return oldSql;
+ }
+
+ public String getBaseSQL() {
+ return "SELECT id FROM (" + sql + ") xid";
+ }
+
+ public String getBaseWholeSQL() {
+ return "SELECT id, name FROM (" + sql + ") xid";
+ }
+
+ public String getBaseWholeReadonlySQL() {
+ return "SELECT id, name, ff_readonly FROM (" + sql + ") xid";
+ }
+
+ public String getBaseSQLForPDFExcel(boolean multiParam) {
+ if(!multiParam)
+ return "SELECT id, name FROM (" + sql + ") xid where id = '[VALUE]'";
+ else
+ return "SELECT id, name FROM (" + sql + ") xid where id in [VALUE]";
+
+ }
+
+ // public String getSqlNoOrderBy() { return sqlNoOrderBy; }
+
+ protected void setSql(String sql) {
+ this.sql = sql;
+ }
+
+ public void setOldSql(String oldSql) {
+ this.oldSql = oldSql;
+ }
+
+ protected void setSqlNoOrderBy(String sql) {
+ this.sqlNoOrderBy = sql;
+ }
+
+ public int getDataSize() {
+ return dataSize;
+ } // getDataSize
+
+ public int getDataSizeUsedinPopup() {
+ return dataSizeUsedInPopup;
+ } // getDataSizeUsedinPopup
+
+ public void setDataSizeUsedinPopup(int dataSizePop) {
+ this.dataSizeUsedInPopup = dataSizePop;
+ } // getDataSizeUsedinPopup
+
+ public void clearData() {
+ removeAllElements();
+ } // clearData
+
+/* public void loadData(String pageNo, String searchString, String dbInfo, String userId) throws RaptorException {
+ // setSql(searchString);
+ loadUserData(pageNo, searchString, dbInfo,userId);
+ } // loadData
+*/
+
+ public void loadUserData(String pageNo, String searchString, String dbInfo,String userId) throws RaptorException {
+ int iPageNo = 0;
+
+ if (pageNo != null)
+ try {
+ iPageNo = Integer.parseInt(pageNo);
+ } catch (NumberFormatException e) {
+ }
+
+ loadUserData(iPageNo, searchString, dbInfo,userId);
+ } // loadData
+
+ public void loadUserData(int pageNo, String searchString, String dbInfo, String userId) throws RaptorException {
+ if(userId!=null) {
+ String sql = Utils.replaceInString(getSql(), "[LOGGED_USERID]", userId);
+ //String defaultSQL = "";
+ if(defaultSQL!=null && (defaultSQL.trim().toLowerCase().startsWith("select")) ) {
+ defaultSQL = Utils.replaceInString(getDefaultSQL(), "[LOGGED_USERID]", userId);
+ setDefaultSQL(defaultSQL);
+ }
+ setSql(sql);
+
+ }
+ loadData(searchString,pageNo, dbInfo);
+ }
+
+ public void loadData(String searchString, int pageNo, String dbInfo) throws RaptorException {
+
+ //boolean dataAlreadyLoaded = (this.pageNo == pageNo);
+
+ //if (dataAlreadyLoaded)
+ // return;
+
+ this.pageNo = pageNo;
+
+ performLoadData(searchString, dbInfo);
+ } // loadData
+
+ protected void performLoadData(String searchString, String dbInfo) throws RaptorException {
+ long currentTime = System.currentTimeMillis();
+ int startRow = 0;
+ int endRow = dataSize;
+ String readOnlyInSql = "ff_readonly";
+ String dbType = Globals.getDBType();
+ if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ try {
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ dbType = remDbInfo.getDBType(dbInfo);
+ } catch (Exception ex) {
+ throw new RaptorException(ex);
+ }
+ }
+ if (pageNo >= 0) {
+ startRow = pageNo * pageSize;
+ endRow = startRow + pageSize;
+ } // if
+ DataSet ds = null;
+ DataSet dsDefault = null;
+ StringBuffer query = new StringBuffer("");
+ StringBuffer queryPop = new StringBuffer("");
+ String sql = getSql();
+ boolean avail_ReadOnly = (sql.toLowerCase().indexOf(readOnlyInSql)!=-1);
+
+ if (dbType.equals("DAYTONA") && getSql().trim().toUpperCase().startsWith("SELECT")) {
+ query.append(getSql());
+ } else {
+ if(avail_ReadOnly) // need to add readonlyinsql
+ if(!(Globals.isMySQL() && dbType.equals(AppConstants.MYSQL)))
+ query.append("SELECT rownum, id, name, " + readOnlyInSql +" FROM ("+ Globals.getReportSqlForFormfield() +", " + readOnlyInSql + " FROM (" + sql
+ + ") x "+ Globals.getReportSqlForFormfieldSuffix());
+ else
+ query.append("SELECT id, name, " + readOnlyInSql +" FROM ("+ Globals.getReportSqlForFormfield() +", " + readOnlyInSql + " FROM (" + sql
+ + ") x "+ Globals.getReportSqlForFormfieldSuffix());
+ else
+ query.append(Globals.getReportSqlForFormfieldPrefix()+ Globals.getReportSqlForFormfield() +" FROM (" + sql
+ + ") x " + Globals.getReportSqlForFormfieldSuffix());
+ if(pageNo!= -2 && (dbType.equals(AppConstants.ORACLE)) ) {
+ query.append(" WHERE rownum <= " + ((dataSize < 0) ? (endRow + 1) : endRow));
+ } else if(pageNo!=2 && (dbType.equals(AppConstants.POSTGRESQL))) {
+ query.append(" LIMIT " + ((dataSize < 0) ? (endRow + 1) : endRow));
+
+ } else if(pageNo!=2 && (dbType.equals(AppConstants.MYSQL))) {
+ query.append(" LIMIT " + startRow); //((dataSize < 0) ? (endRow + 1) : endRow)
+
+ }
+ if(searchString!=null && searchString.length()>0 && !searchString.equals("%")) {
+ if(pageNo == -2) query.append(" WHERE ");
+ else query.append(" and ");
+ query.append("name like '"+ searchString +"'");
+ }
+ if(dbType.equals(AppConstants.POSTGRESQL)) {
+ query.append(") xx OFFSET " + startRow);
+ } else if(dbType.equals(AppConstants.MYSQL)) {
+ query.append(" ," + ((dataSize < 0) ? (endRow + 1) : endRow) +") xx");
+ } else if(dbType.equals(AppConstants.ORACLE))
+ query.append(") xx WHERE rownum>" + startRow);
+ }
+ String defaultQuery ="";
+ boolean readOnly = true;
+ ds = ConnectionUtils.getDataSet(query.toString(), dbInfo);
+
+ // if ( (dbInfo!=null) && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ // Globals.getRDbUtils().setDBPrefix(dbInfo);
+ // ds = RemDbUtils.executeQuery(query);
+ // }
+ // else
+ // ds = DbUtils.executeQuery(query);
+ clearData();
+ if (dbType.equals("DAYTONA") && (getDefaultSQL()!=null && getDefaultSQL().trim().toUpperCase().startsWith("SELECT"))) {
+ defaultQuery = getDefaultSQL();
+ } else if (getDefaultSQL()!=null && getDefaultSQL().length()>10 && getDefaultSQL().substring(0,10).toLowerCase().startsWith("select")) {
+ defaultQuery = Globals.getReportSqlForFormfieldPrefix()+ Globals.getReportSqlForFormfield() +" FROM (" + getDefaultSQL()
+ + ") x "
+ + ") xx ";
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Default Query " +defaultQuery));
+ }
+ HashMap defaultMap = new HashMap();
+ if(!isNull(defaultQuery)) {
+ dsDefault = ConnectionUtils.getDataSet(defaultQuery, dbInfo);
+ if(dsDefault!=null && dsDefault.getRowCount()>0) {
+ for (int i = 0; i < dsDefault.getRowCount(); i++) {
+ //addValue(dsDefault.getString(i, 0), dsDefault.getString(i, 1), true);
+ defaultMap.put(dsDefault.getString(i, "id"), dsDefault.getString(i, "name"));
+ }
+ }
+ }
+
+ for (int i = 0; i < ((pageNo!=-2)?Math.min(ds.getRowCount(), pageSize):ds.getRowCount()); i++) {
+ //if(getCount()==0)
+ // addValue(ds.getString(i, 0), ds.getString(i, 1));
+ if(i==0 && avail_ReadOnly)
+ readOnly = ds.getString(i, "ff_readonly").toUpperCase().startsWith("Y")||ds.getString(i, "ff_readonly").toUpperCase().startsWith("T");
+ if(getCount()>=0) {//&& !((IdNameValue)getValue(0)).getId().equals(ds.getString(i, 0)))
+ if(defaultMap.get(ds.getString(i, "id")) == null)
+ if(avail_ReadOnly)
+ addValue(ds.getString(i, "id"), ds.getString(i, "name"), false, readOnly);
+ else
+ addValue(ds.getString(i, "id"), ds.getString(i, "name"), false);
+ else
+ if(avail_ReadOnly)
+ addValue(ds.getString(i, "id"), ds.getString(i, "name"), true, readOnly);
+ else
+ addValue(ds.getString(i, "id"), ds.getString(i, "name"), true);
+ }
+ }
+
+ if (!(dbType.equals("DAYTONA"))) {
+ if (ds.getRowCount() <= pageSize) {
+ if(dsDefault!=null && dsDefault.getRowCount()>0)
+ dataSize = ds.getRowCount()+1;
+ else
+ dataSize = ds.getRowCount();
+
+ //System.out.println("IDNAME SQL COUNT");*/
+ if(searchString!=null && searchString.length()>0 && !searchString.equals("%")) {
+ queryPop = new StringBuffer("");
+ queryPop.append("SELECT count(*) num_rows FROM ("+ Globals.getReportSqlForFormfield() +", name FROM (" + sql
+ + ") x ");
+ if(searchString!=null && searchString.length()>0 && !searchString.equals("%"))
+ queryPop.append(" where name like '"+ searchString +"'");
+ queryPop.append(") xx ");
+
+ ds = ConnectionUtils.getDataSet(queryPop.toString(), dbInfo);
+ try {
+ dataSizeUsedInPopup = Integer.parseInt(ds.getString(0, 0));
+ } catch (NumberFormatException e) {
+ }
+ } else if(dataSizeUsedInPopup == -3) {
+ queryPop = new StringBuffer("");
+ //System.out.println("IDNAME SQL COUNT");
+ //queryPop.append("SELECT count(*) num_rows FROM ("+query.toString()+") x");
+ queryPop.append("SELECT count(*) num_rows FROM ("+ Globals.getReportSqlForFormfield() +", name FROM (" + sql
+ + ") x ");
+ queryPop.append(") xx ");
+
+ ds = ConnectionUtils.getDataSet(queryPop.toString(), dbInfo);
+ // if ( (dbInfo!=null) &&
+ // (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ // Globals.getRDbUtils().setDBPrefix(dbInfo);
+ // ds = RemDbUtils.executeQuery(query);
+ // }
+ // else
+ // ds = DbUtils.executeQuery(query);
+ //
+ try {
+ dataSizeUsedInPopup = Integer.parseInt(ds.getString(0, 0));
+ } catch (NumberFormatException e) {
+ }
+
+ }
+
+ } else {
+ //pageNo = 0;
+ if(pageNo!= -2) {
+ queryPop = new StringBuffer("");
+ //System.out.println("IDNAME SQL COUNT");
+ //queryPop.append("SELECT count(*) num_rows FROM ("+query.toString()+") x");
+ queryPop.append("SELECT count(*) num_rows FROM ("+ Globals.getReportSqlForFormfield() +" FROM (" + sql
+ + ") x ");
+ queryPop.append(") xx ");
+
+ ds = ConnectionUtils.getDataSet(queryPop.toString(), dbInfo);
+ // if ( (dbInfo!=null) &&
+ // (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ // Globals.getRDbUtils().setDBPrefix(dbInfo);
+ // ds = RemDbUtils.executeQuery(query);
+ // }
+ // else
+ // ds = DbUtils.executeQuery(query);
+ //
+ try {
+ dataSize = Integer.parseInt(ds.getString(0, 0));
+ dataSizeUsedInPopup = Integer.parseInt(ds.getString(0, 0));
+ } catch (NumberFormatException e) {
+ }
+ }
+ } // else
+ } // dataSize < 0
+ long totalTime = System.currentTimeMillis() - currentTime;
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] ------->Time Taken to the above formfield Query (+ count Query if any) --- " + totalTime));
+ } // performLoadData
+
+
+ public String getDefaultSQL() {
+
+ return defaultSQL;
+ }
+
+
+ public void setDefaultSQL(String defaultSQL) {
+
+ this.defaultSQL = defaultSQL;
+ }
+
+ public void setSQL(String sql_)
+ {
+ this.sql = sql_;
+ }
+
+ public static boolean isNull(String a) {
+ if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null"))
+ return true;
+ else
+ return false;
+ }
+} // IdNameSql
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameValue.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameValue.java
new file mode 100644
index 00000000..5ac81f7b
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameValue.java
@@ -0,0 +1,100 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.base;
+
+public class IdNameValue {
+ private String id = null;
+
+ private String name = null;
+
+ private boolean defaultValue = false;
+
+ private boolean readOnly = false;
+
+ public IdNameValue() {
+ super();
+ }
+
+ public IdNameValue(String id, String name) {
+ this();
+
+ setId(id);
+ setName(name);
+ setDefaultValue(false);
+
+ } // IdNameValue
+
+ public IdNameValue(String id, String name, boolean defaultValue) {
+ this();
+
+ setId(id);
+ setName(name);
+ setDefaultValue(defaultValue);
+ } // IdNameValue
+
+ public IdNameValue(String id, String name, boolean defaultValue, boolean readOnly) {
+ this();
+
+ setId(id);
+ setName(name);
+ setDefaultValue(defaultValue);
+ setReadOnly(readOnly);
+ } // IdNameValue
+
+ public String getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(boolean defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * @return the visibility
+ */
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+ /**
+ * @param visibility the visibility to set
+ */
+ public void setReadOnly(boolean readOnly) {
+ this.readOnly = readOnly;
+ }
+
+
+} // IdNameValue
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/NameComparator.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/NameComparator.java
new file mode 100644
index 00000000..8a6f2a9e
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/NameComparator.java
@@ -0,0 +1,32 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.base;
+
+import java.util.Comparator;
+
+public class NameComparator implements Comparator {
+
+ public int compare(Object o1, Object o2) {
+ return ((IdNameValue) o1).getName()
+ .compareToIgnoreCase((((IdNameValue) o2).getName()));
+ } // compare
+
+} // NameComparator
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderBySeqComparator.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderBySeqComparator.java
new file mode 100644
index 00000000..930f508c
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderBySeqComparator.java
@@ -0,0 +1,37 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.base;
+
+import java.util.Comparator;
+
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+
+public class OrderBySeqComparator implements Comparator {
+
+ public int compare(Object o1, Object o2) {
+ if (((DataColumnType) o1).getOrderBySeq() == ((DataColumnType) o2).getOrderBySeq())
+ return 0;
+ else if (((DataColumnType) o1).getOrderBySeq() < ((DataColumnType) o2).getOrderBySeq())
+ return -1;
+ else
+ return 1;
+ } // compare
+
+} // OrderSeqComparator
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderSeqComparator.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderSeqComparator.java
new file mode 100644
index 00000000..e6c013dc
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderSeqComparator.java
@@ -0,0 +1,37 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.base;
+
+import java.util.Comparator;
+
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+
+public class OrderSeqComparator implements Comparator {
+
+ public int compare(Object o1, Object o2) {
+ if (((DataColumnType) o1).getOrderSeq() == ((DataColumnType) o2).getOrderSeq())
+ return 0;
+ else if (((DataColumnType) o1).getOrderSeq() < ((DataColumnType) o2).getOrderSeq())
+ return -1;
+ else
+ return 1;
+ } // compare
+
+} // OrderSeqComparator
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportSecurity.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportSecurity.java
new file mode 100644
index 00000000..f281ac4d
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportSecurity.java
@@ -0,0 +1,407 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.base;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.UserAccessException;
+import org.openecomp.portalsdk.analytics.model.definition.SecurityEntry;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class ReportSecurity extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportSecurity.class);
+
+
+ private String reportID = null;
+
+ private String ownerID = null;
+
+ private String createID = null;
+
+ private String createDate = null;
+
+ private String updateID = null;
+
+ private String updateDate = null;
+
+ private boolean isPublic = false;
+
+ private Hashtable reportRoles = new Hashtable();
+
+ private Hashtable reportUsers = new Hashtable();
+
+ public ReportSecurity(String reportID) {
+ this(reportID, null, null, null, null, null, false);
+ } // ReportSecurity
+
+ public ReportSecurity(String reportID, String ownerID, String createID, String createDate,
+ String updateID, String updateDate, boolean isPublic) {
+ super();
+
+ if (ownerID == null)
+ // Need to load the report record from the database
+ if (!reportID.equals("-1"))
+ try {
+ /*DataSet ds = DbUtils
+ .executeQuery("SELECT NVL(cr.owner_id, cr.create_id) owner_id, cr.create_id, TO_CHAR(cr.create_date, '"
+ + Globals.getOracleTimeFormat()
+ + "') create_date, maint_id, TO_CHAR(cr.maint_date, '"
+ + Globals.getOracleTimeFormat()
+ + "') update_date, cr.public_yn FROM cr_report cr WHERE cr.rep_id="
+ + reportID);*/
+ String sql = Globals.getReportSecurity();
+ sql = sql.replace("[rw.getReportID()]", reportID);
+ DataSet ds = DbUtils.executeQuery(sql);
+ ownerID = ds.getString(0, 0);
+ createID = ds.getString(0, 1);
+ createDate = ds.getString(0, 2);
+ updateID = ds.getString(0, 3);
+ updateDate = ds.getString(0, 4);
+ isPublic = nvl(ds.getString(0, 5)).equals("Y");
+ } catch (Exception e) {
+ String eMsg = "ReportSecurity.ReportSecurity: Unable to load report record details. Exception: "
+ + e.getMessage();
+ //Log.write(eMsg);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] "+eMsg));
+ throw new RuntimeException(eMsg);
+ }
+
+ this.reportID = reportID;
+ this.ownerID = ownerID;
+ this.createID = createID;
+ this.createDate = createDate;
+ this.updateID = updateID;
+ this.updateDate = updateDate;
+ this.isPublic = isPublic;
+
+ /*
+ * reportUsers.put(ownerID, "N"); // Owner has full access
+ * reportRoles.put(AppUtils.getSuperRoleID(), "N"); // Super role has
+ * full access for(Iterator iter=AppUtils.getAdminRoleIDs().iterator();
+ * iter.hasNext(); ) reportRoles.put((String) iter.next(), "Y"); //
+ * Admin role(s) have read-only access
+ */
+ try {
+ String reportUserAccessSql= Globals.getReportUserAccess();
+ reportUserAccessSql = reportUserAccessSql.replace("[reportID]", reportID);
+
+ DataSet ds = DbUtils
+ .executeQuery(reportUserAccessSql);
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ String roleID = nvl(ds.getString(i, 0));
+ if (roleID.length() > 0)
+ reportRoles.put(roleID, ds.getString(i, 2));
+
+ String userID = nvl(ds.getString(i, 1));
+ if (userID.length() > 0)
+ reportUsers.put(userID, ds.getString(i, 2));
+ } // for
+ } catch (Exception e) {
+ String eMsg = "ReportSecurity.ReportSecurity: Unable to load access priviledges - error "
+ + e.getMessage();
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] " + eMsg));
+ throw new RuntimeException(eMsg);
+ }
+ } // ReportSecurity
+
+ public String getOwnerID() {
+ return ownerID;
+ }
+
+ public String getCreateID() {
+ return createID;
+ }
+
+ public String getCreateDate() {
+ return createDate;
+ }
+
+ public String getUpdateID() {
+ return updateID;
+ }
+
+ public String getUpdateDate() {
+ return updateDate;
+ }
+
+ public void setOwnerID(String ownerID) {
+ this.ownerID = ownerID;
+ }
+
+ public void setPublic(boolean isPublic) {
+ this.isPublic = isPublic;
+ }
+
+ public void reportCreate(String reportID, String userID, boolean isPublic) {
+ this.reportID = reportID;
+ this.ownerID = userID;
+ this.createID = userID;
+ this.createDate = Utils.getCurrentDateTime();
+ this.updateID = userID;
+ this.updateDate = this.createDate;
+ this.isPublic = isPublic;
+ } // reportCreate
+
+ public void reportUpdate(HttpServletRequest request) throws RaptorException {
+ checkUserWriteAccess(request);
+ String userID = AppUtils.getUserID(request);
+ this.updateID = userID;
+ this.updateDate = Utils.getCurrentDateTime();
+ } // reportUpdate
+
+ /** ************************************************************* */
+
+ public Vector getReportUsers(HttpServletRequest request) throws RaptorException {
+ HttpSession session = request.getSession();
+ String query = Globals.getCustomizedScheduleQueryForUsers();
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ session.setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request));
+ String param = "";
+ for (int i = 0; i < sessionParameters.length; i++) {
+ param = (String)session.getAttribute(sessionParameters[0]);
+ query = Utils.replaceInString(query, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ }
+ boolean isAdmin = AppUtils.isAdminUser(request);
+ Vector allUsers = AppUtils.getAllUsers(query,param, isAdmin);
+ Vector rUsers = new Vector(allUsers.size());
+
+ for (Iterator iter = allUsers.iterator(); iter.hasNext();) {
+ IdNameValue user = (IdNameValue) iter.next();
+ String readOnlyAccess = (String) reportUsers.get(user.getId());
+ if (readOnlyAccess != null)
+ rUsers.add(new SecurityEntry(user.getId(), user.getName(), readOnlyAccess
+ .equals("Y")));
+ } // for
+
+ return rUsers;
+ } // getReportUsers
+
+ public Vector getReportRoles(HttpServletRequest request) throws RaptorException {
+ HttpSession session = request.getSession();
+ String query = Globals.getCustomizedScheduleQueryForRoles();
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ String param = "";
+ for (int i = 0; i < sessionParameters.length; i++) {
+ param = (String)session.getAttribute(sessionParameters[0]);
+ query = Utils.replaceInString(query, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+
+ }
+ boolean isAdmin = AppUtils.isAdminUser(request);
+ Vector allRoles = AppUtils.getAllRoles(query, param, isAdmin);
+ Vector rRoles = new Vector(allRoles.size());
+
+ for (Iterator iter = allRoles.iterator(); iter.hasNext();) {
+ IdNameValue role = (IdNameValue) iter.next();
+ String readOnlyAccess = (String) reportRoles.get(role.getId());
+ if (readOnlyAccess != null)
+ rRoles.add(new SecurityEntry(role.getId(), role.getName(), readOnlyAccess
+ .equals("Y")));
+ } // for
+
+ return rRoles;
+ } // getReportRoles
+
+ /** ************************************************************* */
+
+ private void validateReadOnlyAccess(String readOnlyAccess) throws Exception {
+ if (!(readOnlyAccess != null && (readOnlyAccess.equals("Y") || readOnlyAccess
+ .equals("N"))))
+ throw new RuntimeException(
+ "[ReportSecurity.validateReadOnlyAccess] Invalid parameter value");
+ } // validateReadOnlyAccess
+
+ public void addUserAccess(String userID, String readOnlyAccess) throws Exception {
+ validateReadOnlyAccess(readOnlyAccess);
+ reportUsers.put(userID, readOnlyAccess);
+ String addUserAccessSql= Globals.getAddUserAccess();
+ addUserAccessSql = addUserAccessSql.replace("[reportID]", reportID);
+ addUserAccessSql = addUserAccessSql.replace("[userID]", userID);
+ addUserAccessSql = addUserAccessSql.replace("[readOnlyAccess]", readOnlyAccess);
+ DbUtils
+ .executeUpdate(addUserAccessSql);
+ } // addUserAccess
+
+ public void updateUserAccess(String userID, String readOnlyAccess) throws Exception {
+ validateReadOnlyAccess(readOnlyAccess);
+ reportUsers.remove(userID);
+ reportUsers.put(userID, readOnlyAccess);
+ String updateUserAccessSql= Globals.getUpdateUserAccess();
+ updateUserAccessSql = updateUserAccessSql.replace("[reportID]", reportID);
+ updateUserAccessSql = updateUserAccessSql.replace("[userID]", userID);
+ updateUserAccessSql = updateUserAccessSql.replace("[readOnlyAccess]", readOnlyAccess);
+ DbUtils.executeUpdate(updateUserAccessSql);
+ } // updateUserAccess
+
+ public void removeUserAccess(String userID) throws Exception {
+ reportUsers.remove(userID);
+
+ String removeUserAccessSql= Globals.getRemoveUserAccess();
+ removeUserAccessSql = removeUserAccessSql.replace("[reportID]", reportID);
+ removeUserAccessSql = removeUserAccessSql.replace("[userID]", userID);
+ DbUtils.executeUpdate(removeUserAccessSql);
+ } // removeUserAccess
+
+ public void addRoleAccess(String roleID, String readOnlyAccess) throws Exception {
+ validateReadOnlyAccess(readOnlyAccess);
+ reportRoles.put(roleID, readOnlyAccess);
+ String addRoleAccessSql= Globals.getAddRoleAccess();
+ addRoleAccessSql = addRoleAccessSql.replace("[reportID]", reportID);
+ addRoleAccessSql = addRoleAccessSql.replace("[roleID]", roleID);
+ addRoleAccessSql = addRoleAccessSql.replace("[readOnlyAccess]", readOnlyAccess);
+ DbUtils
+ .executeUpdate(addRoleAccessSql);
+ } // addRoleAccess
+
+ public void updateRoleAccess(String roleID, String readOnlyAccess) throws Exception {
+ validateReadOnlyAccess(readOnlyAccess);
+ reportRoles.remove(roleID);
+ reportRoles.put(roleID, readOnlyAccess);
+ String updateRoleAccessSql= Globals.getUpdateRoleAccess();
+ updateRoleAccessSql = updateRoleAccessSql.replace("[reportID]", reportID);
+ updateRoleAccessSql = updateRoleAccessSql.replace("[roleID]", roleID);
+ updateRoleAccessSql = updateRoleAccessSql.replace("[readOnlyAccess]", readOnlyAccess);
+ DbUtils.executeUpdate(updateRoleAccessSql);
+ } // updateRoleAccess
+
+ public void removeRoleAccess(String roleID) throws Exception {
+ reportRoles.remove(roleID);
+ String removeRoleAccessSql= Globals.getRemoveRoleAccess();
+ removeRoleAccessSql = removeRoleAccessSql.replace("[reportID]", reportID);
+ removeRoleAccessSql = removeRoleAccessSql.replace("[roleID]", roleID);
+ DbUtils.executeUpdate(removeRoleAccessSql);
+ } // removeRoleAccess
+
+ /** ************************************************************* */
+
+ public void checkUserReadAccess(HttpServletRequest request, String userID) throws RaptorException {
+ if(userID == null)
+ userID = AppUtils.getUserID(request);
+ if(userID != null) {
+ //userID = AppUtils.getUserID(request);
+ if (nvl(reportID).equals("-1"))
+ return;
+
+ if (true) //todo: replace with proper check isPublic
+ return;
+
+ if (userID.equals(ownerID))
+ return;
+
+ if (reportUsers.get(userID) != null)
+ return;
+ }
+ Vector userRoles = null;
+ String userName = null;
+ if(userID == null) {
+ userRoles = AppUtils.getUserRoles(request);
+ userName = AppUtils.getUserName(request);
+ userID = AppUtils.getUserID(request);
+ } else {
+ userRoles = AppUtils.getUserRoles(userID);
+ userName = AppUtils.getUserName(userID);
+ }
+ if (nvl(reportID).equals("-1"))
+ return;
+
+ if (isPublic)
+ return;
+
+ if (userID.equals(ownerID))
+ return;
+
+ if (reportUsers.get(userID) != null)
+ return;
+
+ for (Iterator iter = userRoles.iterator(); iter.hasNext();) {
+ String userRole = (String) iter.next();
+ if (nvl(userRole).equals(AppUtils.getSuperRoleID()))
+ return;
+ }
+ for (Iterator iter = userRoles.iterator(); iter.hasNext();) {
+ String userRole = (String) iter.next();
+
+ if (nvl(userRole).equals(AppUtils.getSuperRoleID()))
+ return;
+
+ if (reportRoles.get(userRole) != null)
+ return;
+
+ for (Iterator iterA = AppUtils.getAdminRoleIDs().iterator(); iterA.hasNext();)
+ if (nvl(userRole).equals((String) iterA.next()))
+ return;
+ } // for
+
+ throw new UserAccessException(reportID, "[" + userID + "] "
+ + userName, AppConstants.UA_READ);
+ } // checkUserReadAccess
+
+ public void checkUserWriteAccess(HttpServletRequest request) throws RaptorException {
+ String userID = AppUtils.getUserID(request);
+ if (nvl(reportID).equals("-1"))
+ return;
+
+ if (userID.equals(ownerID))
+ return;
+
+ if (nvl((String) reportUsers.get(userID)).equals("N"))
+ return;
+
+ for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();) {
+ String userRole = (String) iter.next();
+
+ if (nvl(userRole).equals(AppUtils.getSuperRoleID()))
+ return;
+
+ if (nvl((String) reportRoles.get(userRole)).equals("N"))
+ return;
+
+ for (Iterator iterA = AppUtils.getAdminRoleIDs().iterator(); iterA.hasNext();)
+ if (nvl(userRole).equals((String) iterA.next()))
+ return;
+ } // for
+
+ throw new UserAccessException(reportID, "[" + userID + "] "
+ + AppUtils.getUserName(request), AppConstants.UA_WRITE);
+ } // checkUserWriteAccess
+
+ public void checkUserDeleteAccess(HttpServletRequest request) throws RaptorException {
+ String userID = AppUtils.getUserID(request);
+ if (Globals.getDeleteOnlyByOwner()) {
+ if (!userID.equals(ownerID))
+ throw new UserAccessException(reportID, "[" + userID + "] "
+ + AppUtils.getUserName(request), AppConstants.UA_DELETE);
+ } else
+ checkUserWriteAccess(request);
+ } // checkUserDeleteAccess
+
+} // ReportSecurity
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportWrapper.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportWrapper.java
new file mode 100644
index 00000000..f856318d
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportWrapper.java
@@ -0,0 +1,5719 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.base;
+
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.TreeSet;
+import java.util.Vector;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.transform.stream.StreamResult;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
+import org.openecomp.portalsdk.analytics.error.UserDefinedException;
+import org.openecomp.portalsdk.analytics.model.DataCache;
+import org.openecomp.portalsdk.analytics.model.ReportLoader;
+import org.openecomp.portalsdk.analytics.model.definition.TableSource;
+import org.openecomp.portalsdk.analytics.model.runtime.FormField;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportParamValues;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.SQLCorrector;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.xmlobj.ChartAdditionalOptions;
+import org.openecomp.portalsdk.analytics.xmlobj.ChartDrillFormfield;
+import org.openecomp.portalsdk.analytics.xmlobj.ChartDrillOptions;
+import org.openecomp.portalsdk.analytics.xmlobj.ColFilterList;
+import org.openecomp.portalsdk.analytics.xmlobj.ColFilterType;
+import org.openecomp.portalsdk.analytics.xmlobj.CustomReportType;
+import org.openecomp.portalsdk.analytics.xmlobj.DashboardEditorList;
+import org.openecomp.portalsdk.analytics.xmlobj.DashboardReports;
+import org.openecomp.portalsdk.analytics.xmlobj.DashboardReportsNew;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnList;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataSourceList;
+import org.openecomp.portalsdk.analytics.xmlobj.DataSourceType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataminingOptions;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldList;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormatList;
+import org.openecomp.portalsdk.analytics.xmlobj.FormatType;
+import org.openecomp.portalsdk.analytics.xmlobj.JavascriptItemType;
+import org.openecomp.portalsdk.analytics.xmlobj.JavascriptList;
+import org.openecomp.portalsdk.analytics.xmlobj.Marker;
+import org.openecomp.portalsdk.analytics.xmlobj.ObjectFactory;
+import org.openecomp.portalsdk.analytics.xmlobj.PDFAdditionalOptions;
+import org.openecomp.portalsdk.analytics.xmlobj.PredefinedValueList;
+import org.openecomp.portalsdk.analytics.xmlobj.ReportMap;
+import org.openecomp.portalsdk.analytics.xmlobj.Reports;
+import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreList;
+import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+/**<HR/>
+ * This class is part of <B><I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I></B><BR/>
+ * <HR/>
+ *
+ * --------------------------------------------------------------------------------------------------<BR/>
+ * <B>ReportWrapper.java</B> - This is the base class for the RAPTOR. This involves in creating,<BR/>
+ * modifying, running RAPTOR reports.<BR/>
+ * --------------------------------------------------------------------------------------------------<BR/>
+ *
+ *
+ * <U>Change Log</U><BR/><BR/>
+ *
+ * 31-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> All the elements in the meta xml is copied to the target reports. </LI></UL>
+ * 18-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> request Object is passed to prevent caching user/roles - Datamining/Hosting. </LI></UL>
+ * 27-Jul-2009 : Version 8.4 (Sundar); <UL><LI> verifySQLBasedReportAccess method checks for Admin user instead of super user. </LI></UL>
+ * 09-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Bug due to parsing and removing formfields from "and" is bulletproofed to the right "and" to which the formfield is associated. </LI></UL>
+ * 08-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Bug due to parsing and removing formfields when there is no parameter for Daytona specific database is resolved. </LI></UL>
+ * 29-Jun-2009 : Version 8.4 (Sundar); <UL><LI> isLastSeriesALineChart() and setLastSeriesALineChart(String value) method have been added for the Bar Chart enhancements. </LI></UL>
+ * 23-Jun-2009 : Version 8.4 (Sundar); <UL><LI> check for cr.getChartAdditionalOptions() for null value is added.</LI></UL>
+ * 22-Jun-2009 : Version 8.4 (Sundar); <UL><LI> Wrapper functions to call JAXB were added. These Wrapper
+ * functions are related to the Pareto chart, Time Difference Chart, Multiple Pie Chart and generic Chart Options.</LI></UL>
+ *
+ */
+
+public class ReportWrapper extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportWrapper.class);
+
+
+ protected CustomReportType cr = null;
+
+ protected Vector allColumns = null;
+
+ protected Vector allVisibleColumns = null;
+
+ protected Vector allFilters = null;
+
+ protected String generatedSQL = null;
+
+ protected String generatedChartSQL = null;
+
+ protected String wholeSQL = null; // For display purposes only
+
+
+ protected String reportID = null;
+
+ protected String menuID = "";
+
+ protected boolean menuApproved = false;
+
+ protected String reportDefType = "";
+
+ protected ReportSecurity reportSecurity = null;
+
+ protected String reportSQLWithRowNum = null;
+
+ protected String reportSQLOnlyFirstPart = null;
+
+
+ private ReportWrapper(CustomReportType cr, String reportID, ReportSecurity reportSecurity) {
+ super();
+
+ if (reportID == null)
+ reportID = "-1";
+
+ this.cr = cr;
+ this.reportID = reportID;
+
+ this.reportSecurity = reportSecurity;
+ } // ReportWrapper
+
+ public ReportWrapper(ReportWrapper rw) {
+ this(rw.getCustomReport(), // .cloneCustomReport()
+ rw.getReportID(), rw.reportSecurity);
+
+ this.menuID = rw.getMenuID();
+ this.menuApproved = rw.isMenuApproved();
+
+ this.reportDefType = rw.getReportDefType();
+ } // ReportWrapper
+
+ public ReportWrapper(CustomReportType cr, String reportID, String ownerID, String createID,
+ String createDate, String updateID, String updateDate, String menuID,
+ boolean menuApproved) throws RaptorException {
+ this(cr, reportID, null);
+
+ if (ownerID == null)
+ // Need to load the report record from the database
+ if (!reportID.equals("-1"))
+ try {
+ /*DataSet ds = DbUtils
+ .executeQuery("SELECT NVL(cr.owner_id, cr.create_id) owner_id, cr.create_id, TO_CHAR(cr.create_date, '"
+ + Globals.getOracleTimeFormat()
+ + "') create_date, maint_id, TO_CHAR(cr.maint_date, '"
+ + Globals.getOracleTimeFormat()
+ + "') update_date, cr.menu_id, cr.menu_approved_yn FROM cr_report cr WHERE cr.rep_id="
+ + reportID);*/
+
+ String r_sql = Globals.getReportWrapperFormat();
+ r_sql = r_sql.replace("[Globals.getOracleTimeFormat()]", Globals.getOracleTimeFormat());
+ r_sql = r_sql.replace("[reportID]", reportID);
+
+ DataSet ds = DbUtils
+ .executeQuery(r_sql);
+
+ ownerID = ds.getString(0, 0);
+ createID = ds.getString(0, 1);
+ createDate = ds.getString(0, 2);
+ updateID = ds.getString(0, 3);
+ updateDate = ds.getString(0, 4);
+ menuID = nvl(ds.getString(0, 5));
+ menuApproved = nvl(ds.getString(0, 6)).equals("Y");
+ } catch (Exception e) {
+ String eMsg = "ReportWrapper.ReportWrapper: Unable to load report record details. Exception: "
+ + e.getMessage();
+ //Log.write(eMsg);
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] "+ eMsg));
+ throw new RaptorRuntimeException(eMsg);
+ }
+
+ this.menuID = nvl(menuID);
+ this.menuApproved = menuApproved;
+
+ if (!reportID.equals("-1"))
+ updateReportDefType();
+
+ reportSecurity = new ReportSecurity(reportID, ownerID, createID, createDate, updateID,
+ updateDate, cr.isPublic());
+ } // ReportWrapper
+
+ public CustomReportType getCustomReport() {
+ return cr;
+ }
+
+ public String getReportID() {
+ return reportID;
+ }
+
+ public String getMenuID() {
+ return menuID;
+ }
+
+ public boolean checkMenuIDSelected(String chkMenuID) {
+ return ("|" + menuID + "|").indexOf("|" + chkMenuID + "|") >= 0;
+ }
+
+ public boolean isMenuApproved() {
+ return menuApproved;
+ }
+
+ public String getReportDefType() {
+ return reportDefType;
+ }
+
+ public void setMenuID(String menuID) {
+ this.menuID = menuID;
+ }
+
+ public void setMenuApproved(boolean menuApproved) {
+ this.menuApproved = menuApproved;
+ }
+
+ public void setReportDefType(String reportDefType) {
+ this.reportDefType = reportDefType;
+ }
+
+ public void updateReportDefType() {
+ this.reportDefType = (nvl(cr.getReportSQL()).length() > 0) ? ((cr.getDataminingOptions()!=null && nvl(cr.getDataminingOptions().getClassifier()).length()>0) ?
+ AppConstants.RD_SQL_BASED_DATAMIN:AppConstants.RD_SQL_BASED)
+ : AppConstants.RD_VISUAL;
+ }
+
+ public String getJavascriptElement() {
+ return cr.getJavascriptElement();
+ }
+
+ public int getPageSize() {
+ return cr.getPageSize()==null?50:cr.getPageSize();
+ }
+
+ public int getMaxRowsInExcelDownload() {
+ return cr.getMaxRowsInExcelDownload()==null?500:cr.getMaxRowsInExcelDownload();
+ }
+
+ public boolean isDisplayFolderTree() {
+ return cr.isDisplayFolderTree()!=null?cr.isDisplayFolderTree().booleanValue():false;
+ }
+
+ public boolean isHideFormFieldAfterRun() {
+ return cr.isHideFormFieldAfterRun()!=null?cr.isHideFormFieldAfterRun().booleanValue():false;
+ }
+
+ public void setHideFormFieldAfterRun(boolean hideFormFieldAfterRun) {
+ cr.setHideFormFieldAfterRun(hideFormFieldAfterRun);
+ }
+
+ public boolean isReportInNewWindow() {
+ return cr.isReportInNewWindow()!=null?cr.isReportInNewWindow().booleanValue():false;
+ }
+
+ public String getReportType() {
+ return cr.getReportType();
+ }
+
+ public String getReportName() {
+ return cr.getReportName();
+ }
+
+ public String getDBInfo() {
+ return cr.getDbInfo();
+ }
+
+ public String getDBType() {
+ return cr.getDbType();
+ }
+
+ public boolean isDrillDownURLInPopupPresent() {
+ return cr.isDrillURLInPoPUpPresent()!=null?cr.isDrillURLInPoPUpPresent().booleanValue():false;
+ }
+
+ public void setDrillDownURLInPopupPresent(boolean value) {
+ cr.setDrillURLInPoPUpPresent(value);
+ }
+
+ public String getReportDescr() {
+ return cr.getReportDescr();
+ }
+
+ public String getChartType() {
+ return cr.getChartType();
+ }
+
+ public boolean displayChartTitle() {
+ return cr.isShowChartTitle();
+ }
+
+ public void setShowChartTitle(boolean showTitle) {
+ cr.setShowChartTitle(showTitle);
+ }
+
+
+ public String getChartTypeFixed() {
+ return cr.getChartTypeFixed();
+ }
+
+ public boolean isChartTypeFixed() {
+ return nvl(cr.getChartTypeFixed()).length() > 0 ? cr.getChartTypeFixed().equals("Y")
+ : (!Globals.getAllowRuntimeChartSel());
+ }
+
+ public String getChartLeftAxisLabel() {
+ return cr.getChartLeftAxisLabel();
+ }
+
+ public String getChartRightAxisLabel() {
+ return cr.getChartRightAxisLabel();
+ }
+
+ public String getChartWidth() {
+ return cr.getChartWidth();
+ }
+
+ public int getChartWidthAsInt() {
+ return getIntValue(cr.getChartWidth(), Globals.getDefaultChartWidth());
+ }
+
+ public String getChartHeight() {
+ return cr.getChartHeight()==null?"500":cr.getChartHeight();
+ }
+
+ /*public boolean isChartMultiSeries() {
+ //String s = cr.getChartMultiSeries();
+ return
+ return (nvl(s).length()>0)? (s.equals("Y")||s.equals("y")||s.equalsIgnoreCase("true")?true:false):true;
+ }*/
+
+ public boolean displayPieOrderinRunPage() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartMultiplePieOrder():"";
+ if(nvl(s).indexOf("|")!= -1) {
+ s = s.substring(s.indexOf("|")+1);
+ return getFlagInBoolean(s);
+ } else return false;
+ }
+
+ public boolean isMultiplePieOrderByRow() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartMultiplePieOrder():"";
+ if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|"));
+ return (nvl(s).length()>0)? (s.equals("row")?true:false):true;
+ }
+
+ public boolean isMultiplePieOrderByColumn() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartMultiplePieOrder():"";
+ if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|"));
+ return (nvl(s).length()>0)&&(s.equals("column"))?true:false;
+ }
+
+ public boolean displayPieLabelDisplayinRunPage() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartMultiplePieLabelDisplay():"";
+ if(nvl(s).indexOf("|")!= -1) {
+ s = s.substring(s.indexOf("|")+1);
+ return getFlagInBoolean(s);
+ } else return false;
+ }
+
+ public String getMultiplePieLabelDisplay() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartMultiplePieLabelDisplay():"";
+ if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|"));
+ return s;
+ }
+
+ public boolean displayChartDisplayinRunPage() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartDisplay():"";
+ if(nvl(s).indexOf("|")!= -1) {
+ s = s.substring(s.indexOf("|")+1);
+ return getFlagInBoolean(s);
+ } else return false;
+ }
+
+ public boolean isChartDisplayIn3D() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartDisplay():"";
+ if(nvl(s).length()<=0) return true;
+ if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|"));
+ return (nvl(s).length()>0)&&(s.equals("3D"))?true:false;
+ }
+
+ public boolean displayChartOrientationInRunPage() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartOrientation():"";
+ if(nvl(s).indexOf("|")!= -1) {
+ s = s.substring(s.indexOf("|")+1);
+ return getFlagInBoolean(s);
+ } else return false;
+
+ }
+
+ public String getLinearRegression() {
+ String s = "";
+ s = nvl((cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLinearRegression():"Y");
+ return s;
+ }
+
+ public void setLinearRegression(String linear) {
+ cr.getChartAdditionalOptions().setLinearRegression(linear);
+ }
+
+ public String getLinearRegressionColor() {
+ return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLinearRegressionColor():"";
+ }
+
+ public String getCustomizedRegressionPoint() {
+ return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getMaxRegression():"";
+ }
+
+ public void setCustomizedRegressionPoint( String d) {
+ cr.getChartAdditionalOptions().setMaxRegression(d);
+ }
+
+ public void setLinearRegressionColor(String color) {
+ cr.getChartAdditionalOptions().setLinearRegressionColor(color);
+ }
+
+ public String getExponentialRegressionColor() {
+ return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getExponentialRegressionColor():"";
+ }
+
+ public void setExponentialRegressionColor(String color) {
+ cr.getChartAdditionalOptions().setExponentialRegressionColor(color);
+ }
+
+ public void setRangeAxisUpperLimit(String d) {
+ if(cr.getChartAdditionalOptions()!=null)
+ cr.getChartAdditionalOptions().setRangeAxisUpperLimit(d);
+ }
+
+ public void setRangeAxisLowerLimit(String d) {
+ if(cr.getChartAdditionalOptions()!=null)
+ cr.getChartAdditionalOptions().setRangeAxisLowerLimit(d);
+ }
+
+ public String getRangeAxisUpperLimit() {
+ return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getRangeAxisUpperLimit():"";
+ }
+
+ public String getRangeAxisLowerLimit() {
+ return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getRangeAxisLowerLimit():"";
+ }
+
+ public boolean isChartAnimate() {
+ return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isAnimate()!=null?cr.getChartAdditionalOptions().isAnimate():false):false;
+ }
+
+ public boolean isAnimateAnimatedChart() {
+ return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isAnimateAnimatedChart()!=null?cr.getChartAdditionalOptions().isAnimateAnimatedChart():false):true;
+ }
+
+ public void setAnimateAnimatedChart(boolean animate) {
+ cr.getChartAdditionalOptions().setAnimateAnimatedChart(animate);
+ }
+
+ public void setChartStacked(boolean stacked) {
+ cr.getChartAdditionalOptions().setStacked(stacked);
+ }
+
+ public boolean isChartStacked() {
+ return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isStacked()!=null?cr.getChartAdditionalOptions().isStacked():true):false;
+ }
+
+ public void setBarControls(boolean barControls) {
+ cr.getChartAdditionalOptions().setBarControls(barControls);
+ }
+
+ public boolean displayBarControls() {
+ return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isBarControls()!=null?cr.getChartAdditionalOptions().isBarControls():false):false;
+ }
+
+ public void setXAxisDateType(boolean dateType) {
+ cr.getChartAdditionalOptions().setXAxisDateType(dateType);
+ }
+
+ public boolean isXAxisDateType() {
+ return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isXAxisDateType()!=null?cr.getChartAdditionalOptions().isXAxisDateType():false):false;
+ }
+
+ public void setLessXaxisTickers(boolean lessTickers) {
+ cr.getChartAdditionalOptions().setLessXaxisTickers(lessTickers);
+ }
+
+ public boolean isLessXaxisTickers() {
+ return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isLessXaxisTickers()!=null?cr.getChartAdditionalOptions().isLessXaxisTickers():false):false;
+ }
+
+ public void setTimeAxis(boolean timeAxis) {
+ cr.getChartAdditionalOptions().setTimeAxis(timeAxis);
+ }
+
+ public boolean isTimeAxis() {
+ return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isTimeAxis()!=null?cr.getChartAdditionalOptions().isTimeAxis():true):true;
+ }
+
+ public void setLogScale(boolean logScale) {
+ cr.getChartAdditionalOptions().setLogScale(logScale);
+ }
+
+ public boolean isLogScale() {
+ return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isLogScale()!=null?cr.getChartAdditionalOptions().isLogScale():false):false;
+ }
+
+
+ public void setMultiSeries(boolean multiSeries) {
+ cr.getChartAdditionalOptions().setMultiSeries(multiSeries);
+ cr.setChartMultiSeries(multiSeries?"Y":"N");
+ }
+
+ public boolean isMultiSeries() {
+ if(AppUtils.nvl(cr.getChartMultiSeries()).equals("Y"))
+ cr.getChartAdditionalOptions().setMultiSeries(true);
+ return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isMultiSeries()!=null?cr.getChartAdditionalOptions().isMultiSeries():false):false;
+ }
+
+ public void setTimeSeriesRender(String timeSeriesRenderer) {
+ cr.getChartAdditionalOptions().setTimeSeriesRender(timeSeriesRenderer);
+ }
+
+ public String getTimeSeriesRender() {
+ return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getTimeSeriesRender():"line";
+ }
+
+ public void setShowXAxisLabel(boolean showXaxisLabel) {
+ cr.getChartAdditionalOptions().setShowXAxisLabel(showXaxisLabel);
+ }
+
+ public boolean isShowXaxisLabel() {
+ return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isShowXAxisLabel()!=null?cr.getChartAdditionalOptions().isShowXAxisLabel():false):false;
+ }
+
+ public void setAddXAxisTickers(boolean addXAxisTickers) {
+ cr.getChartAdditionalOptions().setAddXAxisTickers(addXAxisTickers);
+ }
+
+ public boolean isAddXAxisTickers() {
+ return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isAddXAxisTickers()!=null?cr.getChartAdditionalOptions().isAddXAxisTickers():false):true;
+ }
+
+ public void setZoomIn(Integer zoomIn) {
+ cr.getChartAdditionalOptions().setZoomIn(zoomIn);
+ }
+
+ public Integer getZoomIn() {
+ return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().getZoomIn()!=null?cr.getChartAdditionalOptions().getZoomIn():new Integer("25")): new Integer("25");
+ }
+
+ public void setTimeAxisType(String timeAxisType) {
+ cr.getChartAdditionalOptions().setTimeAxisType(timeAxisType);
+ }
+
+ public String getTimeAxisType() {
+ return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().getTimeAxisType()!=null?cr.getChartAdditionalOptions().getTimeAxisType():"hourly"): "hourly";
+ }
+
+ public void setTopMargin(Integer topMargin) {
+ cr.getChartAdditionalOptions().setTopMargin(topMargin);
+ }
+
+ public Integer getTopMargin() {
+ return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getTopMargin(): new Integer("30");
+ }
+
+ public void setBottomMargin(Integer bottomMargin) {
+ cr.getChartAdditionalOptions().setBottomMargin(bottomMargin);
+ }
+
+ public Integer getBottomMargin() {
+ return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getBottomMargin(): new Integer("50");
+ }
+
+ public void setRightMargin(Integer rightMargin) {
+ cr.getChartAdditionalOptions().setRightMargin(rightMargin);
+ }
+
+ public Integer getRightMargin() {
+ return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getRightMargin(): new Integer("60");
+ }
+
+ public void setLeftMargin(Integer leftMargin) {
+ cr.getChartAdditionalOptions().setLeftMargin(leftMargin);
+ }
+
+ public Integer getLeftMargin() {
+ return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLeftMargin(): new Integer("100");
+ }
+
+
+ public boolean isVerticalOrientation() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartOrientation():"";
+ if(nvl(s).length()<=0) return true;
+ if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|"));
+ return (nvl(s).length()>0)&&(s.equals("vertical"))?true:false;
+ }
+
+ public boolean isHorizontalOrientation() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartOrientation():"";
+ if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|"));
+ return (nvl(s).length()>0)&&(s.equals("horizontal"))?true:false;
+ }
+
+ public boolean displaySecondaryChartRendererInRunPage() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getSecondaryChartRenderer():"";
+ if(nvl(s).indexOf("|")!= -1) {
+ s = s.substring(s.indexOf("|")+1);
+ return getFlagInBoolean(s);
+ } else return false;
+
+ }
+
+ public String getSecondaryChartRenderer() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getSecondaryChartRenderer():"";
+ if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|"));
+ return s;
+ }
+
+ public String getOverlayItemValueOnStackBar() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getOverlayItemValueOnStackBar():"N";
+ return s;
+ }
+
+ public boolean displayIntervalInputInRunPage() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getIntervalFromdate():"";
+ if(nvl(s).indexOf("|")!= -1) {
+ s = s.substring(s.indexOf("|")+1);
+ return getFlagInBoolean(s);
+ } else return false;
+ }
+
+ public boolean showLegendDisplayOptionsInRunPage() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getHidechartLegend():"";
+ if(nvl(s).indexOf("|")!= -1) {
+ s = s.substring(s.indexOf("|")+1);
+ return getFlagInBoolean(s);
+ } else return false;
+ }
+
+ public String getIntervalFromdate() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getIntervalFromdate():"";
+ if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|"));
+ return nvl(s,"");
+ }
+
+ public String getIntervalTodate() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getIntervalTodate():"";
+ if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|"));
+ return nvl(s,"");
+ }
+
+ public String getIntervalLabel() {
+ return cr.getChartAdditionalOptions()!=null ? nvl(cr.getChartAdditionalOptions().getIntervalLabel()):"";
+ }
+
+ public String getLegendPosition() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLegendPosition():"";
+ return nvl(s,"bottom");
+ }
+
+ public String getLegendLabelAngle() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLabelAngle():"";
+ return nvl(s,"UP90");
+ }
+
+ public String getMaxLabelsInDomainAxis() {
+ String s = "";
+ s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getMaxLabelsInDomainAxis():"";
+ return nvl(s,"99");
+ }
+
+ public boolean isLastSeriesALineChart() {
+ String s = "";
+ s = nvl((cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLastSeriesALineChart():"");
+ return s.equals("Y");
+ }
+
+ public boolean isLastSeriesABarChart() {
+ String s = "";
+ s = nvl((cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLastSeriesABarChart():"");
+ return s.equals("Y");
+ }
+
+ public void setChartLegendDisplay(String value) {
+ cr.getChartAdditionalOptions().setHidechartLegend(value);
+ }
+
+ public boolean hideChartLegend() {
+ String s = "";
+ s = nvl((cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getHidechartLegend():"N");
+ if(nvl(s).length()<=0) s = "N";
+ if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|"));
+ return s.equals("Y");
+ }
+
+ public void setChartToolTips(String value) {
+ cr.getChartAdditionalOptions().setHideToolTips(value);
+ }
+
+ public void setDomainAxisValuesAsString(String value) {
+ cr.getChartAdditionalOptions().setKeepDomainAxisValueAsString(value);
+ }
+
+ public boolean hideChartToolTips() {
+ boolean s = true;
+ s = (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().getHideToolTips()!=null?
+ (cr.getChartAdditionalOptions().getHideToolTips().equals("Y")?true:false):(Globals.hideToolTipsGlobally()?true:false)):(Globals.hideToolTipsGlobally()?true:false);
+ return s;
+ }
+
+ public boolean keepDomainAxisValueInChartAsString() {
+ boolean s = true;
+ s = (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().getKeepDomainAxisValueAsString()!=null?
+ (cr.getChartAdditionalOptions().getKeepDomainAxisValueAsString().equals("Y")?true:false):false):false;
+ return s;
+ }
+
+ public int getChartHeightAsInt() {
+ return getIntValue(cr.getChartHeight(), Globals.getDefaultChartHeight());
+ }
+
+ public boolean isPublic() {
+ return cr.isPublic();
+ }
+
+ public boolean isDashboardType() throws RaptorException {
+ return cr.isDashboardType()!=null?cr.isDashboardType().booleanValue():false;
+ }
+
+ // public String getCreateId() { return cr.getCreateId(); }
+ // public Calendar getCreateDate() { return cr.getCreateDate(); }
+ public String getReportSQL() {
+ return cr.getReportSQL();
+ }
+
+ public String getReportTitle() {
+ return cr.getReportTitle();
+ }
+
+ public String getReportSubTitle() {
+ return cr.getReportSubTitle();
+ }
+
+ public String getReportHeader() {
+ return cr.getReportHeader();
+ }
+
+ public String getReportFooter() {
+ return cr.getReportFooter();
+ }
+
+ public String getNumDashCols() {
+ return cr.getNumDashCols();
+ }
+
+ public int getNumDashColsAsInt() {
+ return getIntValue(cr.getNumDashCols(), 1);
+ }
+
+ public String getNumFormCols() {
+ return cr.getNumFormCols();
+ }
+
+ public int getNumFormColsAsInt() {
+ return getIntValue(cr.getNumFormCols(), 5);
+ }
+
+ public String getDisplayOptions() {
+ return cr.getDisplayOptions();
+ }
+
+
+
+//Additional Methods
+
+ public int getJumpTo() {
+ return cr.getJumpTo()==null?1:cr.getJumpTo();
+ }
+ public void setJumpTo(int value){
+ cr.setJumpTo(value);
+ }
+
+
+ public int getSearchPageSize(){
+ return cr.getSearchPageSize()==null?20:cr.getSearchPageSize();
+ }
+ public void setSearchPageSize(int value){
+ cr.setSearchPageSize(value);
+ }
+
+
+ public boolean isToggleLayout(){
+ if(cr.isToggleLayout()!=null)
+ return cr.isToggleLayout();
+
+ else
+ return Globals.displayRuntimeOptionsAsDefault();
+
+ }
+ public void setToggleLayout(boolean value){
+ cr.setToggleLayout(value);
+ }
+
+ public boolean isShowPageSize(){
+ if(cr.isShowPageSize()!=null)
+ return cr.isShowPageSize();
+
+ else
+ return Globals.displayRuntimeOptionsAsDefault();
+
+ }
+ public void setShowPageSize(boolean value){
+ cr.setShowPageSize(value);
+ }
+
+ public boolean isShowNavPos(){
+ if(cr.isShowNavPos()!=null)
+ return cr.isShowNavPos();
+
+ else
+ return Globals.displayRuntimeOptionsAsDefault();
+
+ }
+ public void setShowNavPos(boolean value){
+ cr.setShowNavPos(value);
+ }
+
+ public boolean isShowGotoOption(){
+ if(cr.isShowGotoOption()!=null)
+ return cr.isShowGotoOption();
+
+ else
+ return Globals.displayRuntimeOptionsAsDefault();
+
+ }
+ public void setShowGotoOption(boolean value){
+ cr.setShowGotoOption(value);
+ }
+
+ public boolean isPageNav(){
+
+ if(cr.isPageNav()!=null)
+ return cr.isPageNav();
+
+ else
+ return Globals.displayRuntimeOptionsAsDefault();
+
+ }
+
+ public void setPageNav(boolean value){
+ cr.setPageNav(value);
+ }
+
+
+ public String getNavPosition(){
+ if(cr.getNavPosition()!=null)
+ return cr.getNavPosition();
+
+ else
+ return "top";
+ //return cr.getNavPosition();
+ }
+ public void setNavPosition(String value){
+ cr.setNavPosition(value);
+ }
+
+
+ public String getDashboardEditor(){
+ return getDashBoardReportsNew().getDashboardEditor();
+ }
+
+ public void setDashboardEditor(String value){
+ getDashBoardReportsNew().setDashboardEditor(value);
+ }
+
+
+ public DashboardEditorList getDashboardEditorList(){
+ return getDashBoardReportsNew().getDashboardEditorList();
+ }
+
+ public void setDashboardEditorList(DashboardEditorList value){
+ getDashBoardReportsNew().setDashboardEditorList(value);
+ }
+
+ public PDFAdditionalOptions getPDFAdditionalOptions() {
+ try {
+ if(cr.getPdfAdditionalOptions()==null)
+ addPDFAdditionalOptions(new ObjectFactory());
+ } catch(RaptorException ex) {
+ ex.printStackTrace();
+ }
+ return cr.getPdfAdditionalOptions();
+ }
+
+ public String getPDFFont(){
+ return getPDFAdditionalOptions().getPDFFont()!=null?getPDFAdditionalOptions().getPDFFont():Globals.getDataFontFamily();
+ }
+ public void setPDFFont(String value){
+ getPDFAdditionalOptions().setPDFFont(value);
+ }
+
+ public int getPDFFontSize() {
+ return getPDFAdditionalOptions().getPDFFontSize()==null?9:getPDFAdditionalOptions().getPDFFontSize();
+ }
+ public void setPDFFontSize(int value){
+ getPDFAdditionalOptions().setPDFFontSize(value);
+ }
+
+ public String getPDFOrientation(){
+ return getPDFAdditionalOptions().getPDFOrientation()!=null?"portrait":"landscape";
+ }
+ public void setPDFOrientation(String value){
+ getPDFAdditionalOptions().setPDFOrientation(value);
+ }
+
+ public String getPDFLogo1(){
+ return getPDFAdditionalOptions().getPDFLogo1();
+ }
+ public void setPDFLogo1(String value){
+ getPDFAdditionalOptions().setPDFLogo1(value);
+ }
+
+ public String getPDFLogo2(){
+ return getPDFAdditionalOptions().getPDFLogo2();
+ }
+ public void setPDFLogo2(String value){
+ getPDFAdditionalOptions().setPDFLogo2(value);
+ }
+
+ public int getPDFLogo1Size() {
+ return getPDFAdditionalOptions().getPDFLogo1Size()==null?0:getPDFAdditionalOptions().getPDFLogo1Size();
+ }
+ public void setPDFLogo1Size(int value){
+ getPDFAdditionalOptions().setPDFLogo1Size(value);
+ }
+
+ public int getPDFLogo2Size() {
+ return getPDFAdditionalOptions().getPDFLogo2Size()==null?0:getPDFAdditionalOptions().getPDFLogo2Size();
+ }
+ public void setPDFLogo2Size(int value){
+ getPDFAdditionalOptions().setPDFLogo2Size(value);
+ }
+
+ public boolean isPDFCoverPage(){
+
+ if(getPDFAdditionalOptions().isPDFCoverPage()!=null)
+ return getPDFAdditionalOptions().isPDFCoverPage();
+
+ else
+ return true;
+
+ }
+
+ public void setPDFCoverPage(boolean value){
+ getPDFAdditionalOptions().setPDFCoverPage(value);
+ }
+
+ public String getPDFFooter1(){
+ return getPDFAdditionalOptions().getPDFFooter1();
+ }
+ public void setPDFFooter1(String value){
+ getPDFAdditionalOptions().setPDFFooter1(value);
+ }
+
+ public String getPDFFooter2(){
+ return getPDFAdditionalOptions().getPDFFooter2();
+ }
+ public void setPDFFooter2(String value){
+ getPDFAdditionalOptions().setPDFFooter2(value);
+ }
+
+
+
+//End of Additional Methods
+
+ public String getDataContainerHeight() {
+ return cr.getDataContainerHeight();
+ }
+
+ public String getDataContainerWidth() {
+ return cr.getDataContainerWidth();
+ }
+
+ public boolean isAllowSchedule() {
+ String allowSchedule = getAllowSchedule();
+ return (allowSchedule !=null )? allowSchedule.startsWith("Y"):false;
+ }
+
+ public String getAllowSchedule() {
+ return cr.getAllowSchedule();
+ }
+
+ /* Multi Group */
+
+ public boolean isMultiGroupColumn() {
+ String multiGroupColumn = getMultiGroupColumn();
+ return (multiGroupColumn !=null )? multiGroupColumn.startsWith("Y"):false;
+ }
+
+ public String getMultiGroupColumn() {
+ return cr.getMultiGroupColumn();
+ }
+
+ public void setMultiGroupColumn(String value) {
+ cr.setMultiGroupColumn(value);
+ }
+
+ private int getColumnGroupLevel(String colId) throws RaptorException {
+ DataColumnType dc = getColumnById(colId);
+ return (dc == null) ? 0 : dc.getLevel();
+ } // getColumnGroupLevel
+
+ public int getMaxGroupLevel() {
+ List reportCols = getAllColumns();
+ int maxLevel = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (dc.getLevel()!=null) {
+ if(maxLevel < dc.getLevel())
+ maxLevel = dc.getLevel();
+ }
+ } // for
+ return maxLevel;
+ } // getMaxGroupLevel
+
+ private int getColumnGroupStart(String colId) throws RaptorException {
+ DataColumnType dc = getColumnById(colId);
+ return (dc == null) ? 0 : dc.getStart();
+ } // getColumnGroupStart
+
+ private int getColumnGroupColSpan(String colId) throws RaptorException {
+ DataColumnType dc = getColumnById(colId);
+ return (dc == null) ? 0 : dc.getColspan();
+ } // getColumnGroupColSpan
+
+ public void setTopDown(String value) {
+ cr.setTopDown(value);
+ }
+
+ public boolean isTopDown() {
+ String topDown = getTopDownOption();
+ return (topDown !=null )? topDown.startsWith("Y"):false;
+ }
+
+ public String getTopDownOption() {
+ return cr.getTopDown();
+ }
+
+ public void setSizedByContent(String value) {
+ cr.setSizedByContent(value);
+ }
+
+ public boolean isSizedByContent() {
+ String sizedByContent = getSizedByContentOption();
+ return (sizedByContent !=null )? sizedByContent.startsWith("Y"):false;
+ }
+
+ public String getSizedByContentOption() {
+ return cr.getSizedByContent();
+ }
+
+ public String getDashboardOptions() {
+ return cr.getDashboardOptions();
+ }
+
+ public boolean isDashboardOptionHideChart() {
+ return nvl(getDashboardOptions()).length() > 0 && (getDashboardOptions().charAt(0) == 'Y');
+ }
+
+ public boolean isDashboardOptionHideData() {
+ return nvl(getDashboardOptions()).length() > 0 && (getDashboardOptions().charAt(1) == 'Y');
+ }
+
+ public boolean isDashboardOptionHideBtns() {
+ return nvl(getDashboardOptions()).length() > 0 && (getDashboardOptions().charAt(2) == 'Y');
+ }
+
+ public boolean isDisplayOptionHideForm() {
+ return nvl(getDisplayOptions()).length() > 0 && (getDisplayOptions().charAt(0) == 'Y');
+ }
+
+ public boolean isDisplayOptionHideChart() {
+ return nvl(getDisplayOptions()).length() > 1 && (getDisplayOptions().charAt(1) == 'Y');
+ }
+
+ public boolean isDisplayOptionHideData() {
+ return nvl(getDisplayOptions()).length() > 2 && (getDisplayOptions().charAt(2) == 'Y');
+ }
+
+ public boolean isDisplayOptionHideBtns() {
+ return nvl(getDisplayOptions()).length() > 3 && (getDisplayOptions().charAt(3) == 'Y');
+ }
+
+ public boolean isDisplayOptionHideMap() {
+ return nvl(getDisplayOptions()).length() > 4 && (getDisplayOptions().charAt(4) == 'Y');
+ }
+
+ public boolean isDisplayOptionHideExcelIcons() {
+ return nvl(getDisplayOptions()).length() > 5 && (getDisplayOptions().charAt(5) == 'Y');
+ }
+
+ public boolean isDisplayOptionHidePDFIcons() {
+ return nvl(getDisplayOptions()).length() > 6 && (getDisplayOptions().charAt(6) == 'Y');
+ }
+
+ public String getComment() {
+ return cr.getComment();
+ }
+
+ public DataSourceList getDataSourceList() {
+ return cr.getDataSourceList();
+ }
+
+ public ChartAdditionalOptions getChartAdditionalOptions() {
+ return cr.getChartAdditionalOptions();
+ }
+
+ public ChartDrillOptions getChartDrillOptions() {
+ return cr.getChartDrillOptions();
+ }
+
+
+ public DataminingOptions getDataminingOptions() {
+ return cr.getDataminingOptions();
+ }
+
+ public DashboardReports getDashBoardReports() {
+ return cr.getDashBoardReports();
+ }
+
+
+ public DashboardReportsNew getDashBoardReportsNew() {
+ try {
+ if(cr.getDashBoardReportsNew()==null)
+ addDashboardReportsNew(new ObjectFactory());
+ } catch(RaptorException ex) {
+ ex.printStackTrace();
+ }
+ return cr.getDashBoardReportsNew();
+ }
+
+ public String getDashboardLayoutHTML() {
+ return cr.getDashboardLayoutHTML();
+ }
+
+ public FormFieldList getFormFieldList() {
+ return cr.getFormFieldList();
+ }
+
+ public JavascriptList getJavascriptList() {
+ return cr.getJavascriptList();
+ }
+
+ public SemaphoreList getSemaphoreList() {
+ return cr.getSemaphoreList();
+ }
+
+ public void setPageSize(int value) {
+ cr.setPageSize(value);
+ }
+
+ public void setAllowSchedule(String value) {
+ cr.setAllowSchedule(value);
+ }
+
+ public void setMaxRowsInExcelDownload(int value) {
+ cr.setMaxRowsInExcelDownload(value);
+ }
+
+ public void setReportInNewWindow (boolean value) {
+ cr.setReportInNewWindow(value);
+ }
+
+ public void setDisplayFolderTree (boolean value) {
+ cr.setDisplayFolderTree(value);
+ }
+
+ public void setReportType(String value) {
+ cr.setReportType(value);
+ }
+
+ public void setReportName(String value) {
+ cr.setReportName(value);
+ }
+
+ public void setDBInfo(String value) {
+ if (!(cr.getDbInfo() != null && cr.getDbInfo().length() > 0))
+ cr.setDbInfo(value);
+ }
+
+ public void setDBType(String value) {
+ if (!(cr.getDbType() != null && cr.getDbType().length() > 0))
+ cr.setDbType(value);
+ }
+
+ public void setReportDescr(String value) {
+ cr.setReportDescr(value);
+ }
+
+ public void setChartType(String value) {
+ cr.setChartType(value);
+ }
+
+ public void setChartMultiplePieOrder(String value) {
+ cr.getChartAdditionalOptions().setChartMultiplePieOrder(value);
+ }
+
+ public void setChartMultiplePieLabelDisplay(String value) {
+ cr.getChartAdditionalOptions().setChartMultiplePieLabelDisplay(value);
+ }
+
+ public void setChartOrientation(String value) {
+ cr.getChartAdditionalOptions().setChartOrientation(value);
+ }
+
+ public void setSecondaryChartRenderer(String value) {
+ cr.getChartAdditionalOptions().setSecondaryChartRenderer(value);
+ }
+
+ public void setOverlayItemValueOnStackBar(String value) {
+ cr.getChartAdditionalOptions().setOverlayItemValueOnStackBar(value);
+ }
+
+ public void setIntervalFromdate(String value) {
+ cr.getChartAdditionalOptions().setIntervalFromdate(value);
+ }
+
+ public void setIntervalLabel(String value) {
+ cr.getChartAdditionalOptions().setIntervalLabel(value);
+ }
+
+ public void setIntervalTodate(String value) {
+ cr.getChartAdditionalOptions().setIntervalTodate(value);
+ }
+
+ public void setLegendPosition(String value) {
+ cr.getChartAdditionalOptions().setLegendPosition(value);
+ }
+
+ public void setLegendLabelAngle(String value) {
+ cr.getChartAdditionalOptions().setLabelAngle(value);
+ }
+
+ public void setMaxLabelsInDomainAxis(String value) {
+ if(nvl(value).length()<=0) value = "99";
+ cr.getChartAdditionalOptions().setMaxLabelsInDomainAxis(value);
+ }
+
+ public void setLastSeriesALineChart(String value) {
+ cr.getChartAdditionalOptions().setLastSeriesALineChart(value);
+ }
+
+ public void setLastSeriesABarChart(String value) {
+ cr.getChartAdditionalOptions().setLastSeriesABarChart(value);
+ }
+
+ public void setChartDisplay(String value) {
+ cr.getChartAdditionalOptions().setChartDisplay(value);
+ }
+
+ public void setChartAnimate(boolean animate) {
+ if(cr.getChartAdditionalOptions()!=null)
+ cr.getChartAdditionalOptions().setAnimate(animate);
+ else {
+ try {
+ if(getChartAdditionalOptions()==null)
+ addChartAdditionalOptions(new ObjectFactory());
+ } catch(RaptorException ex) {
+ ex.printStackTrace();
+ }
+ if(cr.getChartAdditionalOptions()!=null)
+ cr.getChartAdditionalOptions().setAnimate(animate);
+
+ }
+
+ }
+
+ public void addChartAdditionalOptions(ObjectFactory objFactory) throws RaptorException {
+ ChartAdditionalOptions chartOptions = objFactory.createChartAdditionalOptions();
+ cr.setChartAdditionalOptions(chartOptions);
+ }
+
+ public void addDashboardReportsNew(ObjectFactory objFactory) throws RaptorException {
+ DashboardReportsNew dashboardReports = objFactory.createDashboardReportsNew();
+ cr.setDashBoardReportsNew(dashboardReports);
+ }
+
+ public void addPDFAdditionalOptions(ObjectFactory objFactory) throws RaptorException {
+ PDFAdditionalOptions pdfOptions = objFactory.createPDFAdditionalOptions();
+ cr.setPdfAdditionalOptions(pdfOptions);
+ }
+
+ public void setChartTypeFixed(String value) {
+ cr.setChartTypeFixed(value);
+ }
+
+ public void setChartLeftAxisLabel(String value) {
+ cr.setChartLeftAxisLabel(value);
+ }
+
+ public void setChartRightAxisLabel(String value) {
+ cr.setChartRightAxisLabel(value);
+ }
+
+ public void setChartWidth(String value) {
+ cr.setChartWidth(value);
+ }
+
+ public void setChartHeight(String value) {
+ cr.setChartHeight(value);
+ }
+
+ public void setChartMultiSeries(String value) {
+ cr.setChartMultiSeries(value);
+ }
+
+ public void setPublic(boolean value) {
+ cr.setPublic(value);
+ if (reportSecurity != null)
+ reportSecurity.setPublic(value);
+ }
+
+ // public void setCreateId(String value) { cr.setCreateId(value); }
+ // public void setCreateDate(Calendar value) { cr.setCreateDate(value); }
+ public void setReportSQL(String value) {
+ cr.setReportSQL(value);
+ }
+
+ public void setReportTitle(String value) {
+ cr.setReportTitle(value);
+ }
+
+ public void setReportSubTitle(String value) {
+ cr.setReportSubTitle(value);
+ }
+
+ public void setReportHeader(String value) {
+ cr.setReportHeader(value);
+ }
+
+ public void setReportFooter(String value) {
+ cr.setReportFooter(value);
+ }
+
+ public void setNumFormCols(String value) {
+ cr.setNumFormCols(value);
+ }
+
+ public void setNumDashCols(String value) {
+ cr.setNumDashCols(value);
+ }
+
+ public void setDisplayOptions(String value) {
+ cr.setDisplayOptions(value);
+ }
+
+ public void setDataContainerHeight(String value) {
+ cr.setDataContainerHeight(value);
+ }
+
+ public void setDataContainerWidth(String value) {
+ cr.setDataContainerWidth(value);
+ }
+
+ public void setDashboardOptions(String value) {
+ cr.setDashboardOptions(value);
+ }
+
+ public void setComment(String value) {
+ cr.setComment(value);
+ }
+
+ public void setDashboardType(boolean dashboardType) {
+ cr.setDashboardType(dashboardType);
+ }
+
+ public void setDashboardLayoutHTML(String html) {
+ cr.setDashboardLayoutHTML(html);
+ }
+
+ public void setDataSourceList(DataSourceList value) {
+ cr.setDataSourceList(value);
+ }
+
+ public void setFormFieldList(FormFieldList value) {
+ cr.setFormFieldList(value);
+ }
+
+ public void setDashBoardReports(DashboardReports value) {
+ cr.setDashBoardReports(value);
+ }
+
+ public void setSemaphoreList(SemaphoreList value) {
+ cr.setSemaphoreList(value);
+ }
+
+ public void setJavascriptList(JavascriptList value) {
+ cr.setJavascriptList(value);
+ }
+
+ public void setJavascriptElement(String javascriptElement) {
+ cr.setJavascriptElement(javascriptElement);
+ }
+
+ public void checkUserReadAccess(HttpServletRequest request) throws RaptorException {
+ reportSecurity.checkUserReadAccess(request, null);
+ }
+ public void checkUserReadAccess(HttpServletRequest request, String userID) throws RaptorException {
+ reportSecurity.checkUserReadAccess(request, userID);
+ }
+
+ public void checkUserWriteAccess(HttpServletRequest request) throws RaptorException {
+ reportSecurity.checkUserWriteAccess(request);
+ verifySQLBasedReportAccess(request);
+ }
+
+ public String getOwnerID() {
+ return reportSecurity.getOwnerID();
+ }
+
+ public String getCreateID() {
+ return reportSecurity.getCreateID();
+ }
+
+ public String getCreateDate() {
+ return reportSecurity.getCreateDate();
+ }
+
+ public String getUpdateID() {
+ return reportSecurity.getUpdateID();
+ }
+
+ public String getUpdateDate() {
+ return reportSecurity.getUpdateDate();
+ }
+
+ public ReportSecurity getReportSecurity() {
+ return reportSecurity;
+ }
+
+ /****Report Maps - Start****/
+ public ReportMap getReportMap() {
+ return cr.getReportMap();
+ }
+
+ public void setReportMap(ReportMap reportMap) {
+ cr.setReportMap(reportMap);
+ }
+ /****Report Maps - End****/
+
+ /****Report Chart Drilldown - Start****/
+ public ChartDrillOptions getReportChartDrillOptions() {
+ return cr.getChartDrillOptions();
+ }
+
+ public void setReportChartDrillOptions(ChartDrillOptions chartDrillOptions) {
+ cr.setChartDrillOptions(chartDrillOptions);
+ }
+ /****Report Maps - End****/
+
+
+ /** ************************************************************************************************* */
+
+ public String getFormHelpText() {
+ String formHelpText = nvl(getComment());
+
+ if (formHelpText.indexOf('|') >= 0)
+ formHelpText = formHelpText.substring(formHelpText.lastIndexOf('|') + 1);
+
+ return formHelpText;
+ } // getFormHelpText
+
+ public void setFormHelpText(String formHelpText) {
+ String comment = nvl(getComment());
+
+ if (comment.indexOf('|') >= 0)
+ comment = comment.substring(0, comment.lastIndexOf('|'));
+ if (comment.length() > 0)
+ comment += '|';
+
+ setComment(comment + formHelpText);
+ } // setFormHelpText
+
+ public boolean isRuntimeColSortDisabled() {
+ String comment = nvl(getComment());
+
+ if (comment.indexOf('|') < 0)
+ return false;
+
+ return comment.substring(0, comment.indexOf('|')).equals("Y");
+ } // isRuntimeColSortDisabled
+
+ public void setRuntimeColSortDisabled(boolean value) {
+ String comment = nvl(getComment());
+
+ if (comment.indexOf('|') >= 0)
+ comment = comment.substring(comment.indexOf('|') + 1);
+
+ setComment((value ? "Y" : "N") + "|" + comment);
+ } // setRuntimeColSortDisabled
+
+ /** ************************************************************************************************* */
+
+ protected void verifySQLBasedReportAccess(HttpServletRequest request) throws RaptorException {
+ String userID = AppUtils.getUserID(request);
+ if (getReportDefType().equals(AppConstants.RD_SQL_BASED)
+ && (!Globals.getAllowSQLBasedReports()) && (!AppUtils.isAdminUser(request)))
+ throw new org.openecomp.portalsdk.analytics.error.UserAccessException(reportID, "[" + userID + "] "
+ + AppUtils.getUserName(request), AppConstants.UA_WRITE);
+ } // verifySQLBasedReportAccess
+
+ /** ************************************************************************************************* */
+
+ private String getColumnNameById(String colId) throws RaptorException {
+ DataColumnType dc = getColumnById(colId);
+ return (dc == null) ? "NULL" : dc.getColName();
+ } // getColumnNameById
+
+ // Checks if drill-down URL points to individual record display (return
+ // true) or another report (return false)
+ private boolean isViewAction(String value) throws RaptorException {
+ try {
+ Vector viewActions = org.openecomp.portalsdk.analytics.model.DataCache.getDataViewActions();
+
+ for (int i = 0; i < viewActions.size(); i++)
+ if (value.equals(AppUtils.getBaseActionURL() + ((String) viewActions.get(i))))
+ return true;
+ } catch (Exception e) {
+ throw new RaptorRuntimeException("ReportWrapper.isViewAction Exception: "
+ + e.getMessage());
+ }
+
+ return false;
+ } // isViewAction
+
+ public String getSelectExpr(DataColumnType dct) {
+ // String colName =
+ // dct.isCalculated()?dct.getColName():((nvl(dct.getTableId()).length()>0)?(dct.getTableId()+"."+dct.getColName()):dct.getColName());
+ return getSelectExpr(dct, dct.getColName() /* colName */);
+ } // getSelectExpr
+
+ /*private String getSelectExpr(DataColumnType dct, String colName) {
+ String colType = dct.getColType();
+ if (colType.equals(AppConstants.CT_CHAR)
+ || ((nvl(dct.getColFormat()).length() == 0) && (!colType
+ .equals(AppConstants.CT_DATE))))
+ return colName;
+ else
+ return "TO_CHAR(" + colName + ", '"
+ + nvl(dct.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT) + "')";
+ } // getSelectExpr
+ */
+
+ private String getSelectExpr(DataColumnType dct, String colName) {
+ String colType = dct.getColType();
+ if(colType.equals(AppConstants.CT_NUMBER)) {
+ return colName;
+ } else
+ if (colType.equals(AppConstants.CT_CHAR)
+ || ((nvl(dct.getColFormat()).length() == 0) && (!colType
+ .equals(AppConstants.CT_DATE))))
+ return colName;
+
+ else
+ return "TO_CHAR(" + colName + ", '"
+ + nvl(dct.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT) + "')";
+ } // getSelectExpr
+
+
+ /** ************************************************************************************************* */
+
+ public DataSourceType getTableById(String tableId) {
+ for (Iterator iter = getDataSourceList().getDataSource().iterator(); iter.hasNext();) {
+ DataSourceType ds = (DataSourceType) iter.next();
+ if (ds.getTableId().equals(tableId))
+ return ds;
+ } // for
+
+ return null;
+ } // getTableById
+
+ public DataSourceType getTableByDBName(String tableName) {
+ for (Iterator iter = getDataSourceList().getDataSource().iterator(); iter.hasNext();) {
+ DataSourceType ds = (DataSourceType) iter.next();
+ if (ds.getTableName().equals(tableName))
+ return ds;
+ } // for
+
+ return null;
+ } // getTableByDBName
+
+ public DataSourceType getColumnTableById(String colId) {
+ return getTableById(getColumnById(colId).getTableId());
+ } // getColumnTableById
+
+ public DataColumnType getColumnById(String colId) {
+ List reportCols = getAllColumns();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (dc.getColId().toLowerCase().equals(colId.toLowerCase()))
+ return dc;
+ } // for
+
+ return null;
+ } // getColumnById
+
+ public DataColumnType getChartLegendColumn() {
+ List reportCols = getAllColumns();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))
+ return dc;
+ } // for
+ return null;
+ } // getChartLegendColumn
+
+ /*
+ * public DataColumnType getChartValueColumn() { List reportCols =
+ * getAllColumns(); for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ * DataColumnType dc = (DataColumnType) iter.next(); if(dc.getChartSeq()>0)
+ * return dc; } // for
+ *
+ * return null; } // getChartValueColumn
+ */
+
+ public List getChartValueColumnsList( int filter, HashMap formValues) { /*filter; all=0;create without new chart =1; createNewChart=2 */
+ List reportCols = getAllColumns();
+
+ ArrayList chartValueCols = new ArrayList();
+ int flag = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ flag = 0;
+ DataColumnType dc = (DataColumnType) iter.next();
+// if(filter == 2 || filter == 1) {
+ flag = getDependsOnFormFieldFlag(dc, formValues);
+
+ if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0 ) {
+ if(!AppUtils.nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND)) {
+ if(nvl(dc.getChartGroup()).length()<=0) {
+ if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue())) {
+ chartValueCols.add(dc);
+ } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) {
+ chartValueCols.add(dc);
+ }
+ else if(filter == 0) chartValueCols.add(dc);
+ } else chartValueCols.add(dc);
+ }
+ }
+// } else
+// chartValueCols.add(dc);
+ } // for
+ Collections.sort(chartValueCols, new ChartSeqComparator());
+ return chartValueCols;
+ } // getChartValueColumnsList
+
+
+ /* public ListModelList<Item> getChartValueColumnsListModelList( int filter, HashMap formValues) { / *filter; all=0;create without new chart =1; createNewChart=2 * /
+ List reportCols = getAllColumns();
+
+ ArrayList chartValueCols = new ArrayList();
+ ListModelList<Item> chartValueListModelList = new ListModelList<Item>();
+ int flag = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ flag = 0;
+ DataColumnType dc = (DataColumnType) iter.next();
+// if(filter == 2 || filter == 1) {
+ flag = getDependsOnFormFieldFlag(dc, formValues);
+
+ if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0 ) {
+ if(nvl(dc.getChartGroup()).length()<=0) {
+ if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue())) {
+ chartValueCols.add(dc);
+ } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) {
+ chartValueCols.add(dc);
+ }
+ else if(filter == 0) chartValueCols.add(dc);
+ } else chartValueCols.add(dc);
+ }
+// } else
+// chartValueCols.add(dc);
+ chartValueListModelList.add(new Item(dc.getColId(), dc.getDisplayName()));
+ } // for
+ Collections.sort(chartValueCols, new ChartSeqComparator());
+ return chartValueListModelList;
+ } // getChartValueColumnsList */
+
+
+ /** Check whether chart has series (Category) columns **/
+ public boolean hasSeriesColumn() {
+ List reportCols = getAllColumns();
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (dc.isChartSeries()!=null && dc.isChartSeries().booleanValue())
+ return true;
+ } // for
+ return false;
+ } // hasSeriesColumn
+
+
+ public List getChartDisplayNamesList( int filter, HashMap formValues) { /*filter; all=0;create without new chart =1; createNewChart=2 */
+ List reportCols = getAllColumns();
+ ArrayList chartValueColNames = new ArrayList();
+ int flag = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ flag = 0;
+ DataColumnType dc = (DataColumnType) iter.next();
+// if(filter == 2 || filter == 1) {
+ flag = getDependsOnFormFieldFlag(dc, formValues);
+
+ if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0) {
+ if(nvl(dc.getChartGroup()).length()<=0) {
+ if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue()) ) {
+ chartValueColNames.add(dc.getDisplayName());
+ } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) {
+ chartValueColNames.add(dc.getDisplayName());
+ }
+ else if(filter == 0) chartValueColNames.add(dc.getDisplayName());
+ } else if(filter == 0) chartValueColNames.add(dc.getDisplayName());
+ }
+ // } else
+ // chartValueColNames.add(dc.getDisplayName());
+
+ }
+ return chartValueColNames;
+ } // getChartDisplayNamesList
+
+
+ public List getChartColumnColorsList(int filter, HashMap formValues) { /*filter; all=0;create without new chart =1; createNewChart=2 */
+ List reportCols = getAllColumns();
+ ArrayList chartValueColColors = new ArrayList();
+ int flag = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ flag = 0;
+ DataColumnType dc = (DataColumnType) iter.next();
+// if(filter == 2 || filter == 1) {
+ flag = getDependsOnFormFieldFlag(dc, formValues);
+
+ if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0) {
+ if(nvl(dc.getChartGroup()).length()<=0) {
+ if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue()) ) {
+ chartValueColColors.add(dc.getChartColor());
+ } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) {
+ chartValueColColors.add(dc.getChartColor());
+ }
+ else if(filter == 0) chartValueColColors.add(dc.getChartColor());
+ } else if(filter == 0) chartValueColColors.add(dc.getChartColor());
+ }
+// } else
+// chartValueColColors.add(dc.getChartColor());
+ }
+ return chartValueColColors;
+ } // getChartColumnColorsList
+
+ public List getChartValueColumnAxisList( int filter, HashMap formValues) { /*filter; all=0;create without new chart =1; createNewChart=2 */
+ List reportCols = getAllColumns();
+ ArrayList chartValueColAxis = new ArrayList();
+ int flag = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ flag = 0;
+ DataColumnType dc = (DataColumnType) iter.next();
+// if(filter == 2 || filter == 1) {
+ flag = getDependsOnFormFieldFlag(dc, formValues);
+
+ if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0) {
+ if(nvl(dc.getChartGroup()).length()<=0) {
+ if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue())) {
+ chartValueColAxis.add(nvl(dc.getColOnChart(), "0"));
+ } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) {
+ chartValueColAxis.add(nvl(dc.getColOnChart(), "0"));
+ }
+ else if(filter == 0) chartValueColAxis.add(nvl(dc.getColOnChart(), "0"));
+ } else if(filter == 0) chartValueColAxis.add(nvl(dc.getColOnChart(), "0"));
+ }
+// } else
+// chartValueColAxis.add(nvl(dc.getColOnChart(), "0"));
+ }
+ return chartValueColAxis;
+ } // getChartColumnAxisList
+
+
+ public List getChartValueNewChartList() {
+ ArrayList chartValueNewChartAxis = new ArrayList();
+ for (Iterator iter = getChartValueColumnsList(2, null).iterator(); iter.hasNext();)
+ chartValueNewChartAxis.add(new Boolean(((DataColumnType) iter.next()).isCreateInNewChart()));
+ return chartValueNewChartAxis;
+ } // getChartValueNewChartList
+
+ public List getAllChartGroups() {
+ ArrayList chartGroups = new ArrayList();
+ String chartGroupName="";
+ List reportCols = getAllColumns();
+ Set groupSet = new TreeSet();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if(dc.getChartSeq()!=null && dc.getChartSeq()> 0) {
+ chartGroupName = dc.getChartGroup();
+ if(nvl(chartGroupName).length()>0)
+ groupSet.add(chartGroupName);
+ }
+ }
+ List l = new ArrayList(groupSet);
+ return l;
+ } // getAllChartGroups
+
+ public HashMap getAllChartYAxis(ReportParamValues reportParamValues) {
+ String chartYAxis="";
+ List reportCols = getAllColumns();
+ HashMap hashMap = new HashMap();
+ FormFieldList formFieldList = getFormFieldList();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if(dc.getChartSeq()!=null && dc.getChartSeq()> 0) {
+ chartYAxis = dc.getYAxis();
+ if(formFieldList!=null && reportParamValues!=null) {
+ for (Iterator iter1 = getFormFieldList().getFormField().iterator(); iter1.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter1.next();
+ String fieldDisplay = getFormFieldDisplayName(fft);
+ String fieldId = fft.getFieldId();
+ if(!fft.getFieldType().equals(FormField.FFT_BLANK) && !fft.getFieldType().equals(FormField.FFT_LIST_MULTI) && !fft.getFieldType().equals(FormField.FFT_TEXTAREA)) {
+ String paramValue = Utils.oracleSafe(nvl(reportParamValues.getParamValue(fieldId)));
+ chartYAxis = Utils.replaceInString(chartYAxis, fieldDisplay, nvl(
+ paramValue, ""));
+ }
+ }
+ }
+ if(nvl(dc.getChartGroup()).length()>0)
+ hashMap.put(dc.getChartGroup(),chartYAxis);
+ }
+ }
+ return hashMap;
+ } // getAllChartGroups
+
+ public List getChartGroupColumnAxisList( String chartGroupName, HashMap formValues ) { /*filter; all=0;create without new chart =1; createNewChart=2 */
+ List reportCols = getAllColumns();
+ ArrayList chartGroupColAxis = new ArrayList();
+ String chartGroup = chartGroupName.substring(0,chartGroupName.lastIndexOf("|"));
+ int flag = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ flag = 0;
+ DataColumnType dc = (DataColumnType) iter.next();
+// if(filter == 2 || filter == 1) {
+ flag = getDependsOnFormFieldFlag(dc, formValues);
+
+ if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0) {
+ if( nvl(dc.getChartGroup()).indexOf("|") > 0 && (nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup))) {
+ //if( nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup)) {
+ //System.out.println("$$$$$$$DC " + dc.getColId()+ " " + dc.getColOnChart());
+ chartGroupColAxis.add(dc);
+ }
+ }
+// } else
+// chartValueColAxis.add(nvl(dc.getColOnChart(), "0"));
+ }
+ Collections.sort(chartGroupColAxis, new ChartSeqComparator());
+ return chartGroupColAxis;
+ } // getChartColumnAxisList
+
+ public List getChartGroupValueColumnAxisList( String chartGroupName, HashMap formValues ) {
+ List reportCols = getAllColumns();
+ String index = chartGroupName.substring(chartGroupName.lastIndexOf("|")+1);
+ String chartGroup = chartGroupName.substring(0,chartGroupName.lastIndexOf("|"));
+ //System.out.println("$$$$INDEX " + index);
+ ArrayList chartGroupValueColAxis = new ArrayList();
+ int flag = 0;
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ flag = 0;
+ DataColumnType dc = (DataColumnType) iter.next();
+ flag = getDependsOnFormFieldFlag(dc, formValues);
+
+ if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0) {
+ //System.out.println(" Chartgroup " + dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|")));
+ if( nvl(dc.getChartGroup()).indexOf("|") > 0 && (nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup))) {
+ //if( nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup)) {
+ //System.out.println(" Added Chartgroupname " + chartGroup + " " + dc.getChartGroup() + " " + index);
+ chartGroupValueColAxis.add(dc);
+ }
+ }
+ }
+ return chartGroupValueColAxis;
+ } // getChartColumnAxisList
+
+ public List getChartGroupDisplayNamesList( String chartGroupName, HashMap formValues) {
+ List reportCols = getAllColumns();
+ ArrayList chartGroupValueColNames = new ArrayList();
+ String chartGroup = chartGroupName.substring(0,chartGroupName.lastIndexOf("|"));
+ int flag = 0;
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ flag = 0;
+ DataColumnType dc = (DataColumnType) iter.next();
+ //System.out.println("$$$$$CHART " + dc.getChartSeq()+ " " + dc.getChartGroup()+ " " + chartGroup);
+ flag = getDependsOnFormFieldFlag(dc, formValues);
+
+ if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0 ) {
+ if( nvl(dc.getChartGroup()).indexOf("|") > 0 && (nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup))) {
+ chartGroupValueColNames.add(dc.getDisplayName());
+ }
+ }
+ }
+ return chartGroupValueColNames;
+ } // getChartDisplayNamesList
+
+
+ public List getChartGroupColumnColorsList(String chartGroupName, HashMap formValues) {
+ List reportCols = getAllColumns();
+ ArrayList chartValueColColors = new ArrayList();
+ String chartGroup = chartGroupName.substring(0,chartGroupName.lastIndexOf("|"));
+ int flag = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ flag = 0;
+ DataColumnType dc = (DataColumnType) iter.next();
+ flag = getDependsOnFormFieldFlag(dc, formValues);
+
+ if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0 ) {
+ if( nvl(dc.getChartGroup()).indexOf("|") > 0 && (nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup))) {
+ //if( nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup)) {
+ chartValueColColors.add(dc.getChartColor());
+ }
+ }
+ }
+ return chartValueColColors;
+ } // getChartColumnColorsList
+
+
+ public List getCrossTabRowColumns() {
+ List reportCols = getAllColumns();
+ Vector v = new Vector(reportCols.size());
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (nvl(dc.getCrossTabValue()).equals(AppConstants.CV_ROW))
+ v.add(dc);
+ } // for
+
+ return v;
+ } // getCrossTabRowColumns
+
+ public List getCrossTabColColumns() {
+ List reportCols = getAllColumns();
+ Vector v = new Vector(reportCols.size());
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (nvl(dc.getCrossTabValue()).equals(AppConstants.CV_COLUMN))
+ v.add(dc);
+ } // for
+
+ return v;
+ } // getCrossTabColColumns
+
+ public String getCrossTabDisplayTotal(String rowColPos) {
+ DataColumnType dct = getCrossTabValueColumn();
+ if (dct == null)
+ return "";
+
+ String displayTotal = nvl(dct.getDisplayTotal());
+ if (displayTotal.indexOf('|') >= 0) {
+ String displayColTotal = displayTotal.substring(0, displayTotal.indexOf('|'));
+ String displayRowTotal = displayTotal.substring(displayTotal.indexOf('|') + 1);
+
+ if (rowColPos.equals(AppConstants.CV_COLUMN))
+ displayTotal = displayColTotal;
+ else if (rowColPos.equals(AppConstants.CV_ROW))
+ displayTotal = displayRowTotal;
+ else if (displayColTotal.equals(displayRowTotal))
+ displayTotal = displayColTotal;
+ } // if
+
+ return displayTotal;
+ } // getCrossTabDisplayTotal
+
+ public DataColumnType getCrossTabValueColumn() {
+ List reportCols = getAllColumns();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (nvl(dc.getCrossTabValue()).equals(AppConstants.CV_VALUE))
+ return dc;
+ } // for
+
+ return null;
+ } // getCrossTabValueColumn
+
+ public int getCrossTabValueColumnIndex() { // Returns the index counting
+ // only visible columns
+ List reportCols = getAllColumns();
+
+ int idx = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (nvl(dc.getCrossTabValue()).equals(AppConstants.CV_VALUE))
+ break;
+ if (dc.isVisible())
+ idx++;
+ } // for
+
+ return idx;
+ } // getCrossTabValueColumnIndex
+
+ public ColFilterType getFilterById(String colId, int filterIndex) {
+ DataColumnType dc = getColumnById(colId);
+ try {
+ return (ColFilterType) dc.getColFilterList().getColFilter().get(filterIndex);
+ } catch (Exception e) {
+ return null;
+ }
+ } // getFilterById
+
+ public boolean needFormInput() {
+ List reportCols = getAllColumns();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if (dct.getColFilterList() != null) {
+ List fList = dct.getColFilterList().getColFilter();
+ for (Iterator iterF = fList.iterator(); iterF.hasNext();) {
+ ColFilterType cft = (ColFilterType) iterF.next();
+
+ if (nvl(cft.getArgType()).equals(AppConstants.AT_FORM))
+ return true;
+ } // for
+ } // if
+ } // for
+
+ return false;
+ } // needFormInput
+
+ public int getNumSortColumns() {
+ int numSortCols = 0;
+ for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if (dct.getOrderBySeq() != null && dct.getOrderBySeq() > 0)
+ numSortCols++;
+ } // for
+
+ return numSortCols;
+ } // getNumSortColumns
+
+ public SemaphoreType getSemaphoreById(String semaphoreId) {
+ if (getSemaphoreList() != null && semaphoreId != null)
+ for (Iterator iter = getSemaphoreList().getSemaphore().iterator(); iter.hasNext();) {
+ SemaphoreType sem = (SemaphoreType) iter.next();
+ if (sem.getSemaphoreId().equals(semaphoreId))
+ return sem;
+ } // for
+
+ return null;
+ } // getSemaphoreById
+
+ public void deleteSemaphore(SemaphoreType semaphore) {
+ if (getSemaphoreList() != null) {
+ if(getSemaphoreList().getSemaphore()!= null)
+ getSemaphoreList().getSemaphore().remove((SemaphoreType) semaphore);
+ }
+ } // deleteSemaphore
+
+
+ public void setSemaphore(SemaphoreType sem) {
+ if (getSemaphoreList() != null) {
+ getSemaphoreList().getSemaphore().add(sem);
+ }
+
+ } // setSemaphore
+
+ public static FormatType getSemaphoreFormatById(SemaphoreType semaphore, String formatId) {
+ if (semaphore != null)
+ for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter
+ .hasNext();) {
+ FormatType fmt = (FormatType) iter.next();
+ if (fmt.getFormatId().equals(formatId))
+ return fmt;
+ } // for
+
+ return null;
+ } // getSemaphoreFormatById
+
+ public FormFieldType getFormFieldById(String fieldId) {
+ if (getFormFieldList() != null && fieldId != null)
+ for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ if (fft.getFieldId().equals(fieldId))
+ return fft;
+ } // for
+
+ return null;
+ } // getFormFieldById
+
+ public FormFieldType getFormFieldByDisplayValue(String fieldDisplay) {
+ // fieldDisplay expected to be [fieldName]
+ if (getFormFieldList() != null && fieldDisplay != null)
+ for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ if (fieldDisplay.equals(getFormFieldDisplayName(fft)))
+ return fft;
+ } // for
+
+ return null;
+ } // getFormFieldById
+
+ public String getFormFieldDisplayName(FormFieldType fft) {
+ return "[" + fft.getFieldName() + "]";
+ } // getFormFieldDisplayName
+
+ /** ************************************************************************************************* */
+
+ public void resetCache(boolean sqlOnly) {
+ generatedSQL = null;
+ if (!sqlOnly) {
+ allColumns = null;
+ allFilters = null;
+ }
+ } // resetCache
+
+ public String getOuterJoinType(DataSourceType curTable) {
+ String refDefinition = nvl(curTable.getRefDefinition());
+ int outerJoinIdx = refDefinition.indexOf(" (+)");
+ if (outerJoinIdx < 0)
+ // No outer join
+ return "";
+
+ int equalSignIdx = refDefinition.indexOf("=");
+ if (refDefinition.indexOf(curTable.getTableId()) < equalSignIdx)
+ // Cur. table is on the left side
+ return (outerJoinIdx < equalSignIdx) ? AppConstants.OJ_CURRENT
+ : AppConstants.OJ_JOINED;
+ else
+ // Joined table is on the left side
+ return (outerJoinIdx < equalSignIdx) ? AppConstants.OJ_JOINED
+ : AppConstants.OJ_CURRENT;
+ } // getOuterJoinType
+
+ public String getFormFieldName(ColFilterType filter) {
+ FormFieldType fft = null;
+ if (filter.getArgType().equals(AppConstants.AT_FORM))
+ fft = getFormFieldByDisplayValue(filter.getArgValue());
+
+ return (fft != null) ? fft.getFieldId() : filter.getColId() + "_f"
+ + filter.getFilterSeq();
+ } // getFormFieldName
+
+ public String getFormFieldDisplayName(DataColumnType column, ColFilterType filter) {
+ FormFieldType fft = null;
+ if (filter.getArgType().equals(AppConstants.AT_FORM))
+ fft = getFormFieldByDisplayValue(filter.getArgValue());
+
+ return (fft != null) ? fft.getFieldName() : column.getDisplayName() + "&nbsp;"
+ + filter.getExpression();
+ } // getFormFieldDisplayName
+
+ public Calendar getFormFieldRangeStart(ColFilterType filter) {
+ FormFieldType fft = null;
+ if (filter.getArgType().equals(AppConstants.AT_FORM))
+ fft = getFormFieldByDisplayValue(filter.getArgValue());
+
+ return (fft != null) ? fft.getRangeStartDate().toGregorianCalendar() : null;
+ } // getFormFieldRangeStart
+
+ public Calendar getFormFieldRangeEnd(ColFilterType filter) {
+ FormFieldType fft = null;
+ if (filter.getArgType().equals(AppConstants.AT_FORM))
+ fft = getFormFieldByDisplayValue(filter.getArgValue());
+
+ //System.out.println("as " + fft.getRangeEndDate());
+ return (fft != null) ? fft.getRangeEndDate().toGregorianCalendar() : null;
+ } // getFormFieldRangeEnd
+
+ public String getFormFieldRangeStartSQL(ColFilterType filter) {
+ FormFieldType fft = null;
+ if (filter.getArgType().equals(AppConstants.AT_FORM))
+ fft = getFormFieldByDisplayValue(filter.getArgValue());
+
+ return (fft != null) ? fft.getRangeStartDateSQL() : null;
+ } // getFormFieldRangeStart
+
+ public String getFormFieldRangeEndSQL(ColFilterType filter) {
+ FormFieldType fft = null;
+ if (filter.getArgType().equals(AppConstants.AT_FORM))
+ fft = getFormFieldByDisplayValue(filter.getArgValue());
+
+ //System.out.println("as " + fft.getRangeEndDate());
+ return (fft != null) ? fft.getRangeEndDateSQL() : null;
+ } // getFormFieldRangeEnd
+
+ public String getUniqueTableId(String tableName) {
+ String tableIdPrefix = tableName.startsWith("MSA_") ? tableName.substring(4, 6)
+ : tableName.substring(0, 2);
+ String tableId = "";
+
+ int tableIdN = getDataSourceList().getDataSource().size() + 1;
+ do {
+ tableId = tableIdPrefix.toLowerCase() + (tableIdN++);
+ } while (getTableById(tableId) != null);
+
+ return tableId;
+ } // getUniqueTableId
+
+ /** ************************************************************************************************* */
+
+ protected void deleteDataSourceType(String tableId) {
+ List dsList = getDataSourceList().getDataSource();
+ for (Iterator iter = dsList.iterator(); iter.hasNext();) {
+ DataSourceType dst = (DataSourceType) iter.next();
+ if (dst.getTableId().equals(tableId))
+ iter.remove();
+ else if (nvl(dst.getRefTableId()).equals(tableId)) {
+ dst.setRefTableId(null);
+ dst.setRefDefinition(null);
+ }
+ } // for
+
+ resetCache(false);
+ } // deleteDataSourceType
+
+ public static void adjustColumnType(DataColumnType dct) {
+ dct.setColType(dct.getDbColType());
+
+ if (dct.isCalculated())
+ if (dct.getColName().startsWith("SUM(") || dct.getColName().startsWith("COUNT(")
+ || dct.getColName().startsWith("AVG(")
+ || dct.getColName().startsWith("STDDEV(")
+ || dct.getColName().startsWith("VARIANCE("))
+ dct.setColType(AppConstants.CT_NUMBER);
+ else if (dct.getColName().startsWith("DECODE(") || dct.getColName().startsWith("coalesce("))
+ dct.setColType(AppConstants.CT_CHAR);
+ } // adjustColumnType
+
+ public static boolean getColumnNoParseDateFlag(DataColumnType dct) {
+ return (nvls(dct.getComment()).indexOf(AppConstants.CF_NO_PARSE_DATE) >= 0);
+ } // getColumnNoParseDateFlag
+
+ public static void setColumnNoParseDateFlag(DataColumnType dct, boolean noParseDateFlag) {
+ dct.setComment(noParseDateFlag ? AppConstants.CF_NO_PARSE_DATE : null);
+ } // setColumnNoParseDateFlag
+
+ /** ************************************************************************************************* */
+
+ public static String getSQLBasedFFTColTableName(String fftColId) {
+ return fftColId.substring(0, fftColId.indexOf('.'));
+ } // getSQLBasedFFTColTableName
+
+ public static String getSQLBasedFFTColColumnName(String fftColId) {
+ fftColId = (fftColId.indexOf('|') < 0) ? fftColId : fftColId.substring(0, fftColId
+ .indexOf('|'));
+ return fftColId.substring(fftColId.indexOf('.') + 1);
+ } // getSQLBasedFFTColColumnName
+
+ public static String getSQLBasedFFTColDisplayFormat(String fftColId) {
+ return (fftColId.indexOf('|') < 0) ? "" : fftColId
+ .substring(fftColId.indexOf('|') + 1);
+ } // getSQLBasedFFTColDisplayFormat
+
+ /** ************************************************************************************************* */
+
+ public List<DataColumnType> getAllColumns() {
+ if (cr == null)
+ throw new NullPointerException("CustomReport not initialized");
+
+ if (allColumns == null) {
+ allColumns = new Vector();
+
+ List dsList = getDataSourceList().getDataSource();
+ for (Iterator iter = dsList.iterator(); iter.hasNext();) {
+ DataSourceType ds = (DataSourceType) iter.next();
+
+ // allColumns.addAll(ds.getDataColumnList().getDataColumn());
+ List dcList = ds.getDataColumnList().getDataColumn();
+ for (Iterator iterC = dcList.iterator(); iterC.hasNext();) {
+ DataColumnType dc = (DataColumnType) iterC.next();
+
+ allColumns.add(dc);
+ } // for
+ } // for
+
+ Collections.sort(allColumns, new OrderSeqComparator());
+ } // if
+
+ return allColumns;
+ } // getAllColumns
+
+ public List getOnlyVisibleColumns() {
+ if (cr == null)
+ throw new NullPointerException("CustomReport not initialized");
+
+ if (allVisibleColumns == null) {
+ allVisibleColumns = new Vector();
+
+ List dsList = getDataSourceList().getDataSource();
+ for (Iterator iter = dsList.iterator(); iter.hasNext();) {
+ DataSourceType ds = (DataSourceType) iter.next();
+
+ // allColumns.addAll(ds.getDataColumnList().getDataColumn());
+ List dcList = ds.getDataColumnList().getDataColumn();
+ for (Iterator iterC = dcList.iterator(); iterC.hasNext();) {
+ DataColumnType dc = (DataColumnType) iterC.next();
+ if(dc.isVisible())
+ allVisibleColumns.add(dc);
+ } // for
+ } // for
+
+ Collections.sort(allVisibleColumns, new OrderSeqComparator());
+ } // if
+
+ return allVisibleColumns;
+ } // getOnlyVisibleColumns
+ public int getVisibleColumnCount() {
+ if (cr == null)
+ throw new NullPointerException("CustomReport not initialized");
+ int colCount = 0;
+ List dsList = getDataSourceList().getDataSource();
+ for (Iterator iter = dsList.iterator(); iter.hasNext();) {
+ DataSourceType ds = (DataSourceType) iter.next();
+
+ // allColumns.addAll(ds.getDataColumnList().getDataColumn());
+ List dcList = ds.getDataColumnList().getDataColumn();
+ for (Iterator iterC = dcList.iterator(); iterC.hasNext();) {
+ DataColumnType dc = (DataColumnType) iterC.next();
+ if(dc.isVisible()) colCount ++;
+ } // for
+ } // for
+
+ return colCount;
+ }
+
+ public List getAllFilters() {
+ if (cr == null)
+ throw new NullPointerException("CustomReport not initialized");
+
+ // if(allFilters==null) {
+ allFilters = new Vector();
+
+ List reportCols = getAllColumns();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if (dct.getColFilterList() != null) {
+ List colFilters = dct.getColFilterList().getColFilter();
+
+ for (Iterator iterF = colFilters.iterator(); iterF.hasNext();) {
+ ColFilterType cft = (ColFilterType) iterF.next();
+
+ allFilters.add(cft);
+ } // for
+ } // if
+ } // for
+
+ // Collections.sort(allFilters, ??);
+ // } // if
+
+ return allFilters;
+ } // getAllFilters
+
+ private String formatValue(String value, DataColumnType dc, boolean useDefaultDateFormat) throws RaptorException {
+ return formatValue(value, dc, useDefaultDateFormat, getColumnTableById(dc.getColId()), null);
+ } // formatValue
+
+ private String formatValue(String value, DataColumnType dc, boolean useDefaultDateFormat,
+ DataSourceType ds, FormFieldType fft) throws RaptorException {
+ String fmtValue = null;
+
+ if (nvl(value).length() == 0)
+ fmtValue = "";
+ else if (value.equals(AppConstants.FILTER_MAX_VALUE)
+ || value.equals(AppConstants.FILTER_MIN_VALUE))
+ fmtValue = "(SELECT "
+ + (value.equals(AppConstants.FILTER_MAX_VALUE) ? "MAX" : "MIN") + "("
+ + dc.getColName() + ") FROM " + ds.getTableName() + ")";
+ else if (dc.getColType().equals(AppConstants.CT_NUMBER)) {
+ try {
+ double vD = Double.parseDouble(value);
+ fmtValue = value;
+ } catch(NumberFormatException ex) {
+ throw new UserDefinedException("Expected number, Given String for the form field \"" + fft.getFieldName()+"\"");
+ }
+ }
+ else if (dc.getColType().equals(AppConstants.CT_DATE)) {
+ if (fft!=null && (fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) ) {
+ fmtValue = "TO_DATE('"
+ + value
+ + "', '"
+ + (useDefaultDateFormat ? AppConstants.DEFAULT_DATE_FORMAT : nvl(dc
+ .getColFormat(), AppConstants.DEFAULT_DATE_FORMAT));//+" HH24:MI:SS')";
+ fmtValue = fmtValue + " HH24";
+ if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC))
+ fmtValue = fmtValue + ":MI";
+ if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC))
+ fmtValue = fmtValue + " HH24:MI:SS";
+ } else {
+ fmtValue = "TO_DATE('"
+ + value
+ + "', '"
+ + (useDefaultDateFormat ? AppConstants.DEFAULT_DATE_FORMAT : nvl(dc
+ .getColFormat(), AppConstants.DEFAULT_DATE_FORMAT)) + "')";
+ if (Globals.getMonthFormatUseLastDay())
+ if (!useDefaultDateFormat)
+ if (nvl(dc.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT).equals(
+ "MM/YYYY")
+ || nvl(dc.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT)
+ .equals("MONTH, YYYY"))
+ fmtValue = "ADD_MONTHS(" + fmtValue + ", 1)-1";
+ }
+ }else {
+ fmtValue = value;
+ if (!fmtValue.startsWith("'"))
+ fmtValue = "'" + fmtValue + "'";
+ }
+
+ return fmtValue;
+ } // formatValue
+
+ private String formatListValue(String listValue, DataColumnType dc,
+ boolean useDefaultDateFormat, boolean useOnlyPipeDelimiter) throws RaptorException {
+ return formatListValue("", listValue, dc, useDefaultDateFormat, useOnlyPipeDelimiter,
+ getColumnTableById(dc.getColId()), null);
+ } // formatListValue
+
+ public String formatListValue(String fieldDisplay, String listValue, DataColumnType dc,
+ boolean useDefaultDateFormat, boolean useOnlyPipeDelimiter, DataSourceType ds,
+ String listBaseSQL) throws RaptorException {
+ StringBuffer fmtValue = new StringBuffer("");
+ //if(nvl(listValue,"").trim().length()>0) {
+ // The below statement is commented so that pipe is taken out from parsing for text area form field
+// StringTokenizer st = new StringTokenizer(listValue, useOnlyPipeDelimiter ? "|"
+ //: ",|\n\r\f");
+ StringTokenizer st = new StringTokenizer(listValue, useOnlyPipeDelimiter ? "|"
+ : ",\n\r\f");
+
+ while (st.hasMoreTokens()) {
+ if (fmtValue.length() > 0)
+ fmtValue.append(", ");
+
+ if (dc == null) {
+ // For SQL-based reports - value always string
+ String value = st.nextToken().trim();
+ if (value.startsWith("'"))
+ fmtValue.append(value);
+ else
+ fmtValue.append("'" + value + "'");
+ } else
+ fmtValue.append(formatValue(st.nextToken().trim(), dc, useDefaultDateFormat,
+ ds, null) );
+
+ } // while
+
+ if (fmtValue.length() == 0) {
+ if(nvl(fieldDisplay).length() > 0) {
+ fmtValue.append("");
+ } else {
+ fmtValue.append("(");
+ fmtValue.append(nvl(listBaseSQL, "NULL"));
+ fmtValue.append(")");
+ }
+ } else if (fmtValue.charAt(0) != '(') {
+ fmtValue.insert(0, '(');
+ fmtValue.append(')');
+ }
+ /* } else {
+ fmtValue = new StringBuffer("()");
+ }*/
+ return fmtValue.toString();
+ } // formatListValue
+
+ private String getColumnSelectStr(DataColumnType dc, ReportParamValues paramValues) {
+ String colName = dc.isCalculated() ? dc.getColName()
+ : ((nvl(dc.getTableId()).length() > 0) ? (dc.getTableId() + "." + dc
+ .getColName()) : dc.getColName());
+ String paramValue = null;
+ if (dc.isCalculated())
+ if (getFormFieldList() != null)
+ for (Iterator iter2 = getFormFieldList().getFormField().iterator(); iter2
+ .hasNext();) {
+ FormFieldType fft = (FormFieldType) iter2.next();
+ String fieldId = fft.getFieldId();
+ String fieldDisplay = getFormFieldDisplayName(fft);
+ if (!paramValues.isParameterMultiValue(fieldId)) {
+ paramValue = paramValues.getParamValue(fieldId);
+ if(paramValue!=null && paramValue.length() > 0) {
+ colName = Utils.replaceInString(colName, fieldDisplay, Utils
+ .oracleSafe(nvl(paramValue, "NULL")));
+ } else {
+ colName = Utils.replaceInString(colName, "'" + fieldDisplay + "'", nvl(
+ paramValue, "NULL"));
+ colName = Utils.replaceInString(colName, fieldDisplay, nvl(
+ paramValue, "NULL"));
+ }
+ }
+ } // for
+
+ return colName;
+ } // getColumnSelectStr
+
+ private void addExtraIdSelect(StringBuffer selectExtraIdCl, String drillDownParams,
+ boolean includeSelectExpr) {
+ // drillDownParams - example value "c_master=[bo1.RECID$]"
+ drillDownParams = drillDownParams.substring(10, drillDownParams.length() - 1); // i.e.
+ // "bo1.RECID$"
+
+ selectExtraIdCl.append(", ");
+ if (includeSelectExpr) {
+ selectExtraIdCl.append(drillDownParams);
+ selectExtraIdCl.append(" ");
+ } // if
+ selectExtraIdCl.append(drillDownParams.replace('.', '_')); // i.e.
+ // "bo1_RECID$"
+ } // addExtraIdSelect
+
+ private void addExtraDateSelect(StringBuffer selectExtraDateCl, String drillDownParams,
+ ReportParamValues paramValues, boolean includeSelectExpr) {
+ // drillDownParams - example value "ff1=[dl1]&fc2=[mo3]"
+ String colId = "";
+ while (drillDownParams.indexOf('[') >= 0) {
+ int startIdx = drillDownParams.indexOf('[');
+ int endIdx = drillDownParams.indexOf(']');
+
+ if(startIdx<=endIdx) {
+ colId = drillDownParams.substring(startIdx + 1, endIdx); // i.e.
+ } else {
+ drillDownParams = drillDownParams.substring(endIdx + 1);
+ continue;
+ }
+ // "dl1"
+
+ DataColumnType column = getColumnById(colId);
+ if (column != null)
+ if (column.getColType().equals(AppConstants.CT_DATE))
+ if (!nvl(column.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT).equals(
+ AppConstants.DEFAULT_DATE_FORMAT))
+ if (selectExtraDateCl.toString().indexOf(
+ " " + colId + AppConstants.DD_COL_EXTENSION) < 0) {
+ selectExtraDateCl.append(", ");
+ if (includeSelectExpr) {
+ selectExtraDateCl.append("TO_CHAR("
+ + getColumnSelectStr(column, paramValues) + ", '"
+ + AppConstants.DEFAULT_DATE_FORMAT + "')");
+ selectExtraDateCl.append(" ");
+ } // if
+ selectExtraDateCl.append(colId + AppConstants.DD_COL_EXTENSION); // i.e.
+ // "dl1_dde"
+ } // if
+
+ drillDownParams = drillDownParams.substring(endIdx + 1);
+ } // while
+ } // addExtraDateSelect
+
+ /*
+ * public String generateSQL() { return generateSQL(null); } // generateSQL
+ */
+ public String generateSQL(String userId, HttpServletRequest request) throws RaptorException {
+ return generateSQL(new ReportParamValues(), userId, request);
+ } // generateSQL
+
+ public String generateSQL(ReportParamValues paramValues, String userId, HttpServletRequest request) throws RaptorException {
+ return generateSQL(paramValues, null, AppConstants.SO_ASC, userId, request);
+ } // generateSQL
+
+ public String generateSQL(ReportParamValues paramValues, String overrideSortByColId,
+ String overrideSortByAscDesc, String userId, HttpServletRequest request) throws RaptorException {
+ if (cr == null)
+ throw new NullPointerException("CustomReport not initialized");
+ if(nvl(getWholeSQL()).length()>0) return getWholeSQL();
+ if (paramValues.size() > 0)
+ resetCache(true);
+ //resetCache(true);
+ if (generatedSQL == null) {
+ if (getReportDefType().equals(AppConstants.RD_SQL_BASED) || getReportDefType().equals(AppConstants.RD_SQL_BASED_DATAMIN)) {
+ generatedSQL = generateSQLSQLBased(paramValues, overrideSortByColId,
+ overrideSortByAscDesc, userId, request );
+ generatedChartSQL = generateSQLSQLBased(paramValues, null,
+ AppConstants.SO_ASC, userId, request );
+ } else if (getReportDefType().equals(AppConstants.RD_VISUAL) && !getReportType().equals(AppConstants.RT_CROSSTAB)) {
+ generatedSQL = generateSQLVisual(paramValues, overrideSortByColId,
+ overrideSortByAscDesc, userId, request);
+ generatedChartSQL = generateSQLVisual(paramValues, null,
+ AppConstants.SO_ASC, userId, request);
+ } else {
+ generatedSQL = generateSQLCrossTabVisual(paramValues, overrideSortByColId,
+ overrideSortByAscDesc, userId, request);
+ }
+
+ //debugLogger.debug("******************");
+ //debugLogger.debug("SQL Before Changing new line \n" + generatedSQL);
+ //debugLogger.debug("******************");
+ generatedSQL = replaceNewLine(generatedSQL, ""+ '\n', " "+'\n'+" " );
+ //chart sql should not be null
+ if(nvl(generatedChartSQL).trim().length()>0)
+ generatedChartSQL = replaceNewLine(generatedChartSQL, ""+ '\n', " "+'\n'+" " );
+ //(generatedSQL, "\n", " \n ");
+ //debugLogger.debug("******************");
+ //debugLogger.debug("SQL After Changing new line \n" + generatedSQL);
+ //debugLogger.debug("******************");
+ //generatedSQL = replaceNewLine(generatedSQL, "SELECT", "SELECT ");
+ //generatedSQL = replaceNewLine(generatedSQL, "select", "select ");
+ //debugLogger.debug("SQL After Changing new line \n" + generatedSQL);
+ //debugLogger.debug("[[[[[[[[[[[[[[[[[[");
+ //generatedSQL = Utils.replaceInString(generatedSQL, "\n", " ");
+ //generatedSQL = Utils.replaceInString(generatedSQL, "\t", " ");
+ } // if
+
+ return generatedSQL;
+ } // generateSQL
+
+ public String generateSQLSQLBased(ReportParamValues paramValues,
+ String overrideSortByColId, String overrideSortByAscDesc, String userId, HttpServletRequest request) throws RaptorException {
+ String sql = getReportSQL();
+ DataSet ds = null;
+ //debugLogger.debug(" generateSQLSQLBased " + sql);
+ String[] reqParameters = Globals.getRequestParams().split(",");
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ String[] scheduleSessionParameters = Globals.getSessionParamsForScheduling().split(",");
+ javax.servlet.http.HttpSession session = request.getSession();
+ String dbType = "";
+ String dbInfo = getDBInfo();
+ int fieldCount = 0;
+ // For Daytona removing all formfields which has null param value
+ Pattern re1 = null;
+ Matcher matcher = null;
+ int index = 0;
+ int posFormField = 0;
+ int posAnd = 0;
+ if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ try {
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ dbType = remDbInfo.getDBType(dbInfo);
+ } catch (Exception ex) {
+ throw new RaptorException(ex);
+ }
+ }
+
+ sql = sql + " ";
+ sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" SELECT ");
+ //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ff][Rr][Oo][Mm]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" FROM ");
+ sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" WHERE ");
+ sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Nn]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" WHEN ");
+ sql = Pattern.compile("(^[\r\n]*|([\\s]))[Aa][Nn][Dd]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" AND ");
+
+ if (getFormFieldList() != null) {
+ for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+
+ FormFieldType fft = (FormFieldType) iter.next();
+ String fieldId = fft.getFieldId();
+ String fieldDisplay = getFormFieldDisplayName(fft);
+ if(!fft.getFieldType().equals(FormField.FFT_BLANK)) {
+ if (paramValues.isParameterMultiValue(fieldId)) {
+ String replaceValue = formatListValue(fieldDisplay, Utils
+ .oracleSafe(nvl(paramValues.getParamValue(fieldId))), null, false,
+ true, null, paramValues.getParamBaseSQL(fieldId));
+ if(replaceValue.length() > 0) {
+ sql = Utils.replaceInString(sql, fieldDisplay, replaceValue);
+ } else {
+ fieldCount++;
+ if(fieldCount == 1) {
+ //sql = sql + " ";
+ //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" SELECT ");
+ //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" WHERE ");
+ //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Aa][Nn][Dd]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" AND ");
+ }
+ //sql = getReportSQL();
+ while(sql.indexOf(fieldDisplay) > 0) {
+/* sql = Utils.replaceInString(sql, "SELECT ", "select ");
+ sql = Utils.replaceInString(sql, "WHERE", "where");
+ sql = Utils.replaceInString(sql, " AND ", " and ");
+*/
+ re1 = Pattern.compile("(^[\r\n]|[\\s])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL);
+ //re1 = Pattern.compile("(^[\r\n]|[\\s])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\]", Pattern.DOTALL);
+/* posFormField = sql.indexOf(fieldDisplay);
+ posAnd = sql.lastIndexOf("and", posFormField);
+ if(posAnd < 0) posAnd = 0;
+ else if (posAnd > 2) posAnd = posAnd - 2;
+ matcher = re1.matcher(sql);
+*/
+ posFormField = sql.indexOf(fieldDisplay);
+ int posSelectField = sql.lastIndexOf("SELECT ", posFormField);
+ int andField = 0;
+ int whereField = 0, whenField = 0;
+ andField = sql.lastIndexOf(" AND ", posFormField);
+ whereField = sql.indexOf(" WHERE" , posSelectField);
+ whenField = sql.indexOf(" WHEN" , posSelectField);
+
+ if(posFormField > whereField)
+ andField = sql.lastIndexOf(" AND ", posFormField);
+ if (posFormField > andField && (andField > whereField || andField > whenField))
+ posAnd = andField;
+ else
+ posAnd = 0;
+ matcher = re1.matcher(sql);
+
+
+ if (posAnd > 0 && matcher.find(posAnd-1)) {
+ //sql = Utils.replaceInString(sql, matcher.group(), " ");
+ matcher = re1.matcher(sql);
+ index = sql!=null?sql.lastIndexOf("["+fft.getFieldName()+"]"):-1;
+
+ if(andField>0)
+ index = andField;
+ else
+ index = whereField;
+ if(index >= 0 && matcher.find(index-1)) {
+ sql = sql.replace(matcher.group(), " ");
+ }
+ } else {
+
+ //sql = sql.replace
+ re1 = Pattern.compile("(^[\r\n]|[\\s])WHERE(.*?[^\r\n]*)\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL);
+ matcher = re1.matcher(sql);
+ if(whereField != -1) {
+ if(matcher.find(whereField-1)) {
+ matcher = re1.matcher(sql);
+ index = sql!=null?sql.lastIndexOf("["+fft.getFieldName()+"]"):-1;
+ if(index >= 0 && matcher.find(index-30)) {
+ sql = sql.replace(matcher.group(), " WHERE 1=1 ");
+ }
+ //sql = Utils.replaceInString(sql, matcher.group(), " where 1=1 ");
+ } /*else {
+ replaceValue = formatListValue("", Utils
+ .oracleSafe(nvl(paramValues.getParamValue(fieldId))), null, false,
+ true, null, paramValues.getParamBaseSQL(fieldId));
+ sql = Utils.replaceInString(sql, fieldDisplay, replaceValue);
+ }*/
+ } else {
+ sql = Utils.replaceInString(sql, fieldDisplay, replaceValue);
+ }
+
+ }
+ }
+ }
+
+ //sql = Utils.replaceInString(sql, " select ", " SELECT ");
+ //sql = Utils.replaceInString(sql, " where ", " WHERE ");
+ //sql = Utils.replaceInString(sql, " and ", " AND ");
+
+ } else {
+ String paramValue = "";
+ if(paramValues.isParameterTextAreaValueAndModified(fieldId)) {
+ String value = "";
+ value = nvl(paramValues
+ .getParamValue(fieldId));
+// value = Utils.oracleSafe(nvl(value));
+// if (!(dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT"))) {
+// value = "('" + Utils.replaceInString(value, ",", "'|'") + "')";
+// value = Utils.replaceInString(value, "|", ",");
+// paramValue = XSSFilter.filterRequestOnlyScript(value);
+// } else if (nvl(value.trim()).length()>0) {
+// value = "('" + Utils.replaceInString(value, ",", "'|'") + "')";
+// value = Utils.replaceInString(value, "|", ",");
+// paramValue = XSSFilter.filterRequestOnlyScript(value);
+// }
+ paramValue = value;
+ } else
+ paramValue = Utils.oracleSafe(nvl(paramValues
+ .getParamValue(fieldId)));
+
+ if (paramValue!=null && paramValue.length() > 0) {
+ if(paramValue.toLowerCase().trim().startsWith("select ")) {
+ paramValue = Utils.replaceInString(paramValue, "[LOGGED_USERID]", userId);
+ paramValue = Utils.replaceInString(paramValue, "[USERID]", userId);
+ paramValue = Utils.replaceInString(paramValue, "[USER_ID]", userId);
+
+ paramValue = Utils.replaceInString(paramValue, "''", "'");
+ ds = ConnectionUtils.getDataSet(paramValue, dbInfo);
+ if (ds.getRowCount() > 0) paramValue = ds.getString(0, 0);
+ }
+ //debugLogger.debug("SQLSQLBASED B4^^^^^^^^^ " + sql + " " + fft.getValidationType() + " " + fft.getFieldName() + " " + fft.getFieldId());
+ if(fft!=null && (fft.getValidationType()!=null && (fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) ||fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC) ||fft.getValidationType().equals(FormField.VT_DATE) ))) {
+ //System.out.println("paramValues.getParamValue(fieldId_Hr) Inside if " + fft.getValidationType() + " " + fieldDisplay);
+ if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)) {
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue) +((nvl(paramValues
+ .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(Utils.oracleSafe(nvl(paramValues
+ .getParamValue(fieldId+"_Hr") ) ) ):""));
+ }
+ else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)) {
+/* System.out.println("paramValues.getParamValue(fieldId_Hr)" + paramValues
+ .getParamValue(fieldId+"_Hr") + " " + paramValues
+ .getParamValue(fieldId+"_Min")) ;
+*/ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue) + ((nvl(paramValues
+ .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(Utils.oracleSafe(nvl(paramValues
+ .getParamValue(fieldId+"_Hr") ) ) ):"") + ((nvl(paramValues
+ .getParamValue(fieldId+"_Min") ).length()>0)?":" + addZero(Utils.oracleSafe(nvl(paramValues
+ .getParamValue(fieldId+"_Min") ) ) ) : "") ) ;
+ }
+ else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue) + ((nvl(paramValues
+ .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(Utils.oracleSafe(nvl(paramValues
+ .getParamValue(fieldId+"_Hr") ) ) ):"") + ((nvl(paramValues
+ .getParamValue(fieldId+"_Min") ).length()>0)?":" + addZero(Utils.oracleSafe(nvl(paramValues
+ .getParamValue(fieldId+"_Min") ) ) ) : "") + ((nvl(paramValues
+ .getParamValue(fieldId+"_Sec") ).length()>0)?":"+addZero(Utils.oracleSafe(nvl(paramValues
+ .getParamValue(fieldId+"_Sec") ) ) ) : "" ) ) ;
+ } else {
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));
+ }
+
+
+ } else {
+ if(paramValue!=null && paramValue.length() > 0) {
+ if(sql.indexOf("'"+fieldDisplay+"'")!=-1 || sql.indexOf("'"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"'")!=-1
+ || sql.indexOf("'%"+fieldDisplay+"%'")!=-1 || sql.indexOf("'%"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"%'")!=-1
+ || sql.indexOf("'_"+fieldDisplay+"_'")!=-1 || sql.indexOf("'_"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"_'")!=-1
+ || sql.indexOf("'%_"+fieldDisplay+"_%'")!=-1 || sql.indexOf("^"+fieldDisplay+"^")!=-1 || sql.indexOf("'%_"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"_%'")!=-1) {
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));
+ } else {
+ if(sql.indexOf(fieldDisplay)!=-1) {
+ if(nvl(paramValue).length()>0) {
+ try {
+ double vD = Double.parseDouble(paramValue);
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));
+
+ } catch (NumberFormatException ex) {
+ if (/*dbType.equals("DAYTONA") &&*/ sql.trim().toUpperCase().startsWith("SELECT")) {
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));
+ } else
+ throw new UserDefinedException("Expected number, Given String for the form field \"" + fieldDisplay+"\"");
+ }
+ /*sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));*/
+ } else
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));
+
+ }
+ }
+ }
+ else {
+ if (dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT")) {
+ sql = sql + " ";
+ re1 = Pattern.compile("(^[\r\n]|[\\s]|[^0-9a-zA-Z])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL);
+ posFormField = sql.indexOf(fieldDisplay);
+ posAnd = sql.lastIndexOf(" AND ", posFormField);
+ if(posAnd < 0) posAnd = 0;
+ else if (posAnd > 2) posAnd = posAnd - 2;
+ matcher = re1.matcher(sql);
+ if (matcher.find(posAnd)) {
+ sql = sql.replace(matcher.group(), "");
+ }
+ } else {
+ sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl(
+ paramValue, "NULL"));
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));
+ }
+ }
+ }
+
+ }
+
+ if (dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT")) {
+ sql = sql + " ";
+ re1 = Pattern.compile("(^[\r\n]|[\\s]|[^0-9a-zA-Z])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); //+[\'\\)|\'|\\s]
+ posFormField = sql.indexOf(fieldDisplay);
+ posAnd = sql.lastIndexOf(" AND ", posFormField);
+ if(posAnd < 0) posAnd = 0;
+ else if (posAnd > 2) posAnd = posAnd - 2;
+ matcher = re1.matcher(sql);
+ if (matcher.find(posAnd)) {
+ sql = sql.replace(matcher.group(), " ");
+ }
+ } else {
+ if( fft.isGroupFormField()!=null && fft.isGroupFormField().booleanValue()) {
+ sql = Pattern.compile("[[\\s*][,]]\\["+fft.getFieldName()+"\\](.*?)[,]",Pattern.MULTILINE).matcher(sql).replaceAll(" ");
+ //sql = Pattern.compile("[,][\\s*]\\["+fft.getFieldName()+"\\][\\s]",Pattern.MULTILINE).matcher(sql).replaceAll(" ");
+ sql = Pattern.compile("(,.+?)[\\s*]\\["+fft.getFieldName()+"\\][\\s]",Pattern.MULTILINE).matcher(sql).replaceAll(" ");
+ //sql = Pattern.compile("(?:,?)[\\s*]\\["+fft.getFieldName()+"\\]",Pattern.MULTILINE).matcher(sql).replaceAll("");
+ //sql = Pattern.compile("[,][\\s*]\\["+fft.getFieldName()+"\\]",Pattern.MULTILINE).matcher(sql).replaceAll(" ");
+ //sql = Pattern.compile( "\\["+fft.getFieldName()+"\\](.*?[^\r\n]*)[,]",Pattern.DOTALL).matcher(sql).replaceAll("");
+
+ //sql = Pattern.compile("[,]|(.*?[^\r\n]*)"+fieldDisplay+"(.*?)\\s",Pattern.DOTALL).matcher(sql).replaceAll("");
+ //sql = Pattern.compile("(.*?[^\r\n]*)"+fieldDisplay+"(.*?)\\s|[,]",Pattern.DOTALL).matcher(sql).replaceAll("");
+/* sql = Utils.replaceInString(sql, "," + fieldDisplay , nvl(
+ paramValue, ""));
+ sql = Utils.replaceInString(sql, fieldDisplay + "," , nvl(
+ paramValue, ""));
+*/ } else {
+ //debugLogger.debug("ParamValue |" + paramValue + "| Sql |" + sql + "| Multi Value |" + paramValues.isParameterMultiValue(fieldId));
+ sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl(
+ paramValue, "NULL"));
+ sql = Utils.replaceInString(sql, fieldDisplay , nvl(
+ paramValue, "NULL"));
+ //debugLogger.debug("SQLSQLBASED AFTER^^^^^^^^^ " + sql);
+ }
+ }
+
+ } // else
+ } // if BLANK
+ } // for
+ if(request != null ) {
+ for (int i = 0; i < reqParameters.length; i++) {
+ if(!reqParameters[i].startsWith("ff")) {
+ if (nvl(request.getParameter(reqParameters[i].toUpperCase())).length() > 0)
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) );
+ }
+ else
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) );
+ }
+
+ for (int i = 0; i < scheduleSessionParameters.length; i++) {
+ if(nvl(request.getParameter(scheduleSessionParameters[i])).trim().length()>0 )
+ sql = Utils.replaceInString(sql, "[" + scheduleSessionParameters[i].toUpperCase()+"]", request.getParameter(scheduleSessionParameters[i]) );
+ }
+ }
+ if(session != null ) {
+ for (int i = 0; i < sessionParameters.length; i++) {
+ //if(!sessionParameters[i].startsWith("ff"))
+ // paramValue = Utils.replaceInString(paramValue, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i].toUpperCase()) );
+ // else {
+ //debugLogger.debug(" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i]));
+ sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ //}
+ }
+ }
+ } else {
+ //debugLogger.debug("BEFORE LOGGED USERID REPLACE " + sql);
+ //sql = Utils.replaceInString(sql, "'[logged_userId]'", "'"+userId+"'");
+ //debugLogger.debug("Replacing string 2 " + sql);
+ sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId);
+ sql = Utils.replaceInString(sql, "[USERID]", userId);
+ sql = Utils.replaceInString(sql, "[USER_ID]", userId);
+ //debugLogger.debug("AFTER LOGGED USERID REPLACE " + sql);
+ // Added for Simon's GM Project where they need to get page_id in their query
+ //debugLogger.debug("SQLSQLBASED no formfields " + sql);
+ if(request != null ) {
+ for (int i = 0; i < reqParameters.length; i++) {
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) );
+ }
+ }
+ if(session != null ) {
+ for (int i = 0; i < sessionParameters.length; i++) {
+ //debugLogger.debug(" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i]));
+ sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ }
+ }
+ }
+ // if it is not multiple select and ParamValue is empty this is the place it can be replaced.
+ sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId);
+ sql = Utils.replaceInString(sql, "[USERID]", userId);
+ sql = Utils.replaceInString(sql, "[USER_ID]", userId);
+ //debugLogger.debug("SQLSQLBASED no formfields after" + sql);
+ //debugLogger.debug("Replacing String 2 "+ sql);
+ //debugLogger.debug("Replaced String " + sql);
+
+ int closeBracketPos = 0;
+ if (nvl(overrideSortByColId).length() > 0) {
+ if(sql.lastIndexOf(")")!= -1) closeBracketPos = sql.lastIndexOf(")");
+ int idxOrderBy = (closeBracketPos>0)?sql.toUpperCase().indexOf("ORDER BY", closeBracketPos):sql.toUpperCase().lastIndexOf("ORDER BY");
+ DataColumnType dct = getColumnById(overrideSortByColId+"_sort");
+ if(dct!=null && dct.getColName().length()>0) {
+ overrideSortByColId = overrideSortByColId+"_sort";
+ }
+ if (idxOrderBy < 0)
+ sql += " ORDER BY " + overrideSortByColId + " " + overrideSortByAscDesc;
+ else {
+ int braketCount = 0;
+ int idxOrderByClauseEnd = 0;
+ for (idxOrderByClauseEnd = idxOrderBy; idxOrderByClauseEnd < sql.length(); idxOrderByClauseEnd++) {
+ char ch = sql.charAt(idxOrderByClauseEnd);
+
+ if (ch == '(')
+ braketCount++;
+ else if (ch == ')') {
+ if (braketCount == 0)
+ break;
+ braketCount--;
+ }
+ } // for
+
+ sql = sql.substring(0, idxOrderBy) + " ORDER BY " + overrideSortByColId + " "
+ + overrideSortByAscDesc + sql.substring(idxOrderByClauseEnd);
+ } // else
+ } // if
+ sql = Pattern.compile("([\n][\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" ");
+ return sql;
+ } // generateSQLSQLBased
+
+ public String generateSQLVisual(ReportParamValues paramValues, String overrideSortByColId,
+ String overrideSortByAscDesc, String userId, HttpServletRequest request)throws RaptorException {
+ StringBuffer selectCl = new StringBuffer();
+ StringBuffer fromCl = new StringBuffer();
+ StringBuffer whereCl = new StringBuffer();
+ StringBuffer groupByCl = new StringBuffer();
+ StringBuffer havingCl = new StringBuffer();
+ StringBuffer orderByCl = new StringBuffer();
+ StringBuffer selectExtraIdCl = new StringBuffer();
+ StringBuffer selectExtraDateCl = new StringBuffer();
+
+ int whereClBracketCount = 0;
+ int havingClBracketCount = 0;
+ int whereClCarryoverBrackets = 0;
+ int havingClCarryoverBrackets = 0;
+
+ // Identifying FROM clause tables and WHERE clause joins
+ List dsList = getDataSourceList().getDataSource();
+ for (Iterator iter = dsList.iterator(); iter.hasNext();) {
+ DataSourceType ds = (DataSourceType) iter.next();
+
+ if (fromCl.length() > 0)
+ fromCl.append(", ");
+ fromCl.append(ds.getTableName());
+ fromCl.append(" ");
+ fromCl.append(ds.getTableId());
+
+ if (nvl(ds.getRefTableId()).length() > 0) {
+ if (whereCl.length() > 0)
+ whereCl.append(" AND ");
+ whereCl.append(ds.getRefDefinition());
+ } // if
+ // Add the condition.
+ TableSource tableSource = null;
+ String dBInfo = this.cr.getDbInfo();
+ Vector userRoles = AppUtils.getUserRoles(request);
+ tableSource = DataCache.getTableSource(ds.getTableName(), dBInfo,userRoles,userId, request);
+ if (userId != null && (!AppUtils.isSuperUser(request))
+ && (!AppUtils.isAdminUser(request)) && tableSource != null
+ && nvl(tableSource.getFilterSql()).length() > 0) {
+ if (whereCl.length() > 0)
+ whereCl.append(" AND ");
+ whereCl.append(Utils.replaceInString(Utils.replaceInString(tableSource
+ .getFilterSql(), "[" + ds.getTableName() + "]", ds.getTableId()),
+ "[USER_ID]", userId));
+ } // if
+ } // for
+
+ List reportCols = getAllColumns();
+
+ boolean isGroupStmt = false;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (dc.isGroupBreak()) {
+ isGroupStmt = true;
+ break;
+ } // if
+ } // for
+
+ // Identifying SELECT and GROUP BY clause fields and WHERE and HAVING
+ // clause filters
+ // Collections.sort(reportCols, new OrderSeqComparator());
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, paramValues);
+
+ // SELECT clause fields
+ //TODO: Uncomment if it's not working -- if (dc.isVisible()) {
+ if (selectCl.length() > 0)
+ selectCl.append(", ");
+ selectCl.append(getSelectExpr(dc, colName));
+ selectCl.append(" ");
+ selectCl.append(dc.getColId());
+ //TODO } // if
+
+ // Checking for extra fields necessary for drill-down
+ if (nvl(dc.getDrillDownURL()).length() > 0)
+ if (isViewAction(dc.getDrillDownURL()))
+ addExtraIdSelect(selectExtraIdCl, nvl(dc.getDrillDownParams()), true);
+ else
+ addExtraDateSelect(selectExtraDateCl, nvl(dc.getDrillDownParams()),
+ paramValues, true);
+
+ // GROUP BY clause fields
+ if (dc.isGroupBreak()) {
+ if (groupByCl.length() > 0)
+ groupByCl.append(", ");
+ groupByCl.append(colName);
+ } // if
+
+ // WHERE/HAVING clause fields
+ //boolean isHavingCl = isGroupStmt && dc.isVisible() && (!dc.isGroupBreak());
+ boolean isHavingCl = isGroupStmt && (!dc.isGroupBreak());
+ StringBuffer filterCl = isHavingCl ? havingCl : whereCl;
+ // StringBuffer filterCl =
+ // isGroupStmt?(dc.isVisible()?(dc.isGroupBreak()?whereCl:havingCl):whereCl):whereCl;
+ if (dc.getColFilterList() != null) {
+ int fNo = 0;
+ List fList = dc.getColFilterList().getColFilter();
+ for (Iterator iterF = fList.iterator(); iterF.hasNext(); fNo++) {
+ ColFilterType cf = (ColFilterType) iterF.next();
+
+ StringBuffer curFilter = new StringBuffer();
+ if (filterCl.length() > 0)
+ curFilter.append(" " + cf.getJoinCondition() + " ");
+ if ((isHavingCl ? havingClCarryoverBrackets : whereClCarryoverBrackets) > 0)
+ for (int b = 0; b < (isHavingCl ? havingClCarryoverBrackets
+ : whereClCarryoverBrackets); b++)
+ filterCl.append('(');
+ curFilter.append(nvl(cf.getOpenBrackets()));
+ curFilter.append(colName + " ");
+ curFilter.append(cf.getExpression() + " ");
+
+ boolean applyFilter = true;
+ if ((nvl(cf.getArgValue()).length() > 0)
+ || (nvl(cf.getArgType()).equals(AppConstants.AT_FORM)))
+ if (nvl(cf.getArgType()).equals(AppConstants.AT_FORMULA))
+ curFilter.append(cf.getArgValue());
+ else if (nvl(cf.getArgType()).equals(AppConstants.AT_VALUE))
+ curFilter.append(formatValue(cf.getArgValue(), dc, false));
+ else if (nvl(cf.getArgType()).equals(AppConstants.AT_LIST))
+ curFilter.append(formatListValue(cf.getArgValue(), dc, false,
+ false));
+ else if (nvl(cf.getArgType()).equals(AppConstants.AT_COLUMN))
+ curFilter.append(getColumnNameById(cf.getArgValue()));
+ else if (nvl(cf.getArgType()).equals(AppConstants.AT_FORM)) {
+ String fieldName = getFormFieldName(cf);
+ String fieldValue = Utils.oracleSafe(paramValues
+ .getParamValue(fieldName));
+ boolean isMultiValue = paramValues
+ .isParameterMultiValue(fieldName);
+ boolean usePipeDelimiterOnly = false;
+
+ FormFieldType fft = getFormFieldByDisplayValue(cf.getArgValue());
+ if (fft == null)
+ // If not FormField => applying default value
+ fieldValue = nvl(fieldValue, Utils
+ .oracleSafe(cf.getArgValue()));
+ else
+ usePipeDelimiterOnly = fft.getFieldType().equals(
+ FormField.FFT_CHECK_BOX)
+ || fft.getFieldType().equals(FormField.FFT_LIST_MULTI);
+ //Added for TimeStamp validation
+ String fieldId = fft.getFieldId();
+ if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)||fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)||fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ fieldValue = nvl(
+ fieldValue + " " + addZero(Utils.oracleSafe(nvl(paramValues
+ .getParamValue(fieldId+"_Hr") ) ) ) ) ;
+ if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ fieldValue = fieldValue + (nvl(paramValues
+ .getParamValue(fieldId+"_Min")).length()>0 ? ":" + addZero(Utils.oracleSafe(nvl(paramValues
+ .getParamValue(fieldId+"_Min")))): "") ;
+ }
+ if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ fieldValue = fieldValue + (nvl(paramValues
+ .getParamValue(fieldId+"_Sec")).length()>0 ? ":"+ addZero(Utils.oracleSafe(nvl(paramValues
+ .getParamValue(fieldId+"_Sec")))) : "");
+ }
+ }
+
+ // End
+ if (nvl(fieldValue).length() == 0)
+ // Does not append filter with missing form
+ // field argument
+ applyFilter = false;
+ else if (isMultiValue || nvl(cf.getExpression()).equals("IN")
+ || nvl(cf.getExpression()).equals("NOT IN"))
+ curFilter.append(formatListValue(fieldValue, dc, true,
+ usePipeDelimiterOnly));
+ else
+ curFilter.append(formatValue(fieldValue, dc, true, null, fft));
+ } // else
+ curFilter.append(nvl(cf.getCloseBrackets()));
+
+ if (applyFilter) {
+ filterCl.append(curFilter.toString());
+
+ if (isHavingCl) {
+ havingClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl(
+ cf.getCloseBrackets()).length());
+ havingClCarryoverBrackets = 0;
+ } else {
+ whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl(
+ cf.getCloseBrackets()).length());
+ whereClCarryoverBrackets = 0;
+ }
+ } else if (nvl(cf.getOpenBrackets()).length() != nvl(cf.getCloseBrackets())
+ .length())
+ if (nvl(cf.getOpenBrackets()).length() > nvl(cf.getCloseBrackets())
+ .length()) {
+ // Carry over opening brackets
+ if (isHavingCl)
+ havingClCarryoverBrackets += (nvl(cf.getOpenBrackets())
+ .length() - nvl(cf.getCloseBrackets()).length());
+ else
+ whereClCarryoverBrackets += (nvl(cf.getOpenBrackets())
+ .length() - nvl(cf.getCloseBrackets()).length());
+
+ if (isHavingCl)
+ havingClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl(
+ cf.getCloseBrackets()).length());
+ else
+ whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl(
+ cf.getCloseBrackets()).length());
+ } else {
+ // Adding closing brackets
+ if (filterCl.length() > 0) {
+ for (int b = 0; b < nvl(cf.getCloseBrackets()).length()
+ - nvl(cf.getOpenBrackets()).length(); b++)
+ filterCl.append(')');
+
+ if (isHavingCl)
+ havingClBracketCount += (nvl(cf.getOpenBrackets())
+ .length() - nvl(cf.getCloseBrackets()).length());
+ else
+ whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl(
+ cf.getCloseBrackets()).length());
+ } // if
+ } // else
+ } // for
+ } // if
+ } // for
+
+ // Identifying ORDER BY clause fields
+ DataColumnType overrideSortByCol = null;
+ if (overrideSortByColId != null)
+ overrideSortByCol = getColumnById(overrideSortByColId);
+
+ if (overrideSortByCol != null) {
+ orderByCl.append(getColumnSelectStr(overrideSortByCol, paramValues));
+ orderByCl.append(" ");
+ orderByCl.append(nvl(overrideSortByAscDesc, AppConstants.SO_ASC));
+ } else if (getReportType().equals(AppConstants.RT_CROSSTAB)) {
+ /*
+ * for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ * DataColumnType dc = (DataColumnType) iter.next();
+ *
+ * if(nvl(dc.getCrossTabValue()).equals(AppConstants.CV_ROW)||nvl(dc.getCrossTabValue()).equals(AppConstants.CV_COLUMN)) {
+ * if(orderByCl.length()>0) orderByCl.append(", ");
+ * orderByCl.append(getColumnSelectStr(dc, paramValues));
+ * orderByCl.append(" ");
+ * if(dc.getColType().equals(AppConstants.CT_DATE))
+ * orderByCl.append(AppConstants.SO_DESC); else
+ * orderByCl.append(AppConstants.SO_ASC); } // if } // for
+ */
+ } else {
+ Collections.sort(reportCols, new OrderBySeqComparator());
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+
+ if (dc.getOrderBySeq() > 0) {
+ if (orderByCl.length() > 0)
+ orderByCl.append(", ");
+ orderByCl.append(getColumnSelectStr(dc, paramValues));
+ orderByCl.append(" ");
+ orderByCl.append(dc.getOrderByAscDesc());
+ } // if
+ } // for
+ Collections.sort(reportCols, new OrderSeqComparator());
+ } // else
+
+ // Adding up the actual statement
+ StringBuffer sql = new StringBuffer();
+ //sql.append("SELECT "); // Need to add PK for /*+ FIRST_ROWS */ ");
+ sql.append(Globals.getGenerateSqlVisualSelect());
+ //sql.append((selectCl.length() == 0) ? "COUNT(*) cnt" : selectCl.toString());
+ sql.append((selectCl.length() == 0) ? Globals.getGenerateSqlVisualCount() : selectCl.toString());
+ if (groupByCl.length() == 0)
+ sql.append(selectExtraIdCl.toString());
+ sql.append(selectExtraDateCl.toString());
+ // sql.append(" FROM ");
+ sql.append((fromCl.length() == 0) ? Globals.getGenerateSqlVisualDual() : "FROM "+fromCl.toString());
+ if (whereCl.length() > 0) {
+ if (whereClBracketCount > 0) {
+ for (int b = 0; b < whereClBracketCount; b++)
+ whereCl.append(')');
+ } else if (whereClBracketCount < 0) {
+ for (int b = 0; b < Math.abs(whereClBracketCount); b++)
+ whereCl.insert(0, '(');
+ } // else
+
+ sql.append(" WHERE ");
+ sql.append(whereCl.toString());
+ } // if
+ if (groupByCl.length() > 0) {
+ sql.append(" GROUP BY ");
+ sql.append(groupByCl.toString());
+
+ if (havingCl.length() > 0) {
+ if (havingClBracketCount > 0) {
+ for (int b = 0; b < havingClBracketCount; b++)
+ havingCl.append(')');
+ } else if (havingClBracketCount < 0) {
+ for (int b = 0; b < Math.abs(havingClBracketCount); b++)
+ havingCl.insert(0, '(');
+ } // else
+
+ sql.append(" HAVING ");
+ sql.append(havingCl.toString());
+ }
+ }
+ if (orderByCl.length() > 0) {
+ sql.append(" ORDER BY ");
+ sql.append(orderByCl.toString());
+ }
+ //String sqlStr = Utils.replaceInString(sql.toString(), "[LOGGED_USERID]", userId);
+ //return sqlStr;
+ return sql.toString();
+ } // generateSQLVisual
+
+ public String generateSQLCrossTabVisual(ReportParamValues paramValues, String overrideSortByColId,
+ String overrideSortByAscDesc, String userId, HttpServletRequest request) throws RaptorException {
+ StringBuffer selectCl = new StringBuffer();
+ StringBuffer fromCl = new StringBuffer();
+ StringBuffer whereCl = new StringBuffer();
+ StringBuffer groupByCl = new StringBuffer();
+ StringBuffer havingCl = new StringBuffer();
+ StringBuffer orderByCl = new StringBuffer();
+ StringBuffer selectExtraIdCl = new StringBuffer();
+ StringBuffer selectExtraDateCl = new StringBuffer();
+
+ int whereClBracketCount = 0;
+ int havingClBracketCount = 0;
+ int whereClCarryoverBrackets = 0;
+ int havingClCarryoverBrackets = 0;
+
+ // Identifying FROM clause tables and WHERE clause joins
+ List dsList = getDataSourceList().getDataSource();
+ for (Iterator iter = dsList.iterator(); iter.hasNext();) {
+ DataSourceType ds = (DataSourceType) iter.next();
+
+ if (fromCl.length() > 0)
+ fromCl.append(", ");
+ fromCl.append(ds.getTableName());
+ fromCl.append(" ");
+ fromCl.append(ds.getTableId());
+
+ if (nvl(ds.getRefTableId()).length() > 0) {
+ if (whereCl.length() > 0)
+ whereCl.append(" AND ");
+ whereCl.append(ds.getRefDefinition());
+ } // if
+ // Add the condition.
+ TableSource tableSource = null;
+ String dBInfo = this.cr.getDbInfo();
+ Vector userRoles = AppUtils.getUserRoles(request);
+ tableSource = DataCache.getTableSource(ds.getTableName(), dBInfo,userRoles,userId, request);
+ if (userId != null && (!AppUtils.isSuperUser(request))
+ && (!AppUtils.isAdminUser(request)) && tableSource != null
+ && nvl(tableSource.getFilterSql()).length() > 0) {
+ if (whereCl.length() > 0)
+ whereCl.append(" AND ");
+ whereCl.append(Utils.replaceInString(Utils.replaceInString(tableSource
+ .getFilterSql(), "[" + ds.getTableName() + "]", ds.getTableId()),
+ "[USER_ID]", userId));
+ } // if
+ } // for
+
+ List reportCols = getAllColumns();
+
+ boolean isGroupStmt = false;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (dc.isGroupBreak()) {
+ isGroupStmt = true;
+ break;
+ } // if
+ } // for
+
+ // Identifying SELECT and GROUP BY clause fields and WHERE and HAVING
+ // clause filters
+ // Collections.sort(reportCols, new OrderSeqComparator());
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, paramValues);
+
+ // SELECT clause fields
+ if (dc.isVisible()) {
+ if (selectCl.length() > 0)
+ selectCl.append(", ");
+ selectCl.append(getSelectExpr(dc, colName));
+ selectCl.append(" ");
+ selectCl.append(dc.getColId());
+ } // if
+
+ // Checking for extra fields necessary for drill-down
+ if (nvl(dc.getDrillDownURL()).length() > 0)
+ if (isViewAction(dc.getDrillDownURL()))
+ addExtraIdSelect(selectExtraIdCl, nvl(dc.getDrillDownParams()), true);
+ else
+ addExtraDateSelect(selectExtraDateCl, nvl(dc.getDrillDownParams()),
+ paramValues, true);
+
+ // GROUP BY clause fields
+ if (dc.isGroupBreak()) {
+ if (groupByCl.length() > 0)
+ groupByCl.append(", ");
+ groupByCl.append(colName);
+ } // if
+
+ // WHERE/HAVING clause fields
+ boolean isHavingCl = isGroupStmt && dc.isVisible() && (!dc.isGroupBreak());
+ //boolean isHavingCl = isGroupStmt && (!dc.isGroupBreak());
+ //StringBuffer filterCl = isHavingCl ? havingCl : whereCl;
+ StringBuffer filterCl =
+ isGroupStmt?(dc.isVisible()?(dc.isGroupBreak()?whereCl:havingCl):whereCl):whereCl;
+ if (dc.getColFilterList() != null) {
+ int fNo = 0;
+ List fList = dc.getColFilterList().getColFilter();
+ for (Iterator iterF = fList.iterator(); iterF.hasNext(); fNo++) {
+ ColFilterType cf = (ColFilterType) iterF.next();
+
+ StringBuffer curFilter = new StringBuffer();
+ if (filterCl.length() > 0)
+ curFilter.append(" " + cf.getJoinCondition() + " ");
+ if ((isHavingCl ? havingClCarryoverBrackets : whereClCarryoverBrackets) > 0)
+ for (int b = 0; b < (isHavingCl ? havingClCarryoverBrackets
+ : whereClCarryoverBrackets); b++)
+ filterCl.append('(');
+ curFilter.append(nvl(cf.getOpenBrackets()));
+ curFilter.append(colName + " ");
+ curFilter.append(cf.getExpression() + " ");
+
+ boolean applyFilter = true;
+ if ((nvl(cf.getArgValue()).length() > 0)
+ || (nvl(cf.getArgType()).equals(AppConstants.AT_FORM)))
+ if (nvl(cf.getArgType()).equals(AppConstants.AT_FORMULA))
+ curFilter.append(cf.getArgValue());
+ else if (nvl(cf.getArgType()).equals(AppConstants.AT_VALUE))
+ curFilter.append(formatValue(cf.getArgValue(), dc, false));
+ else if (nvl(cf.getArgType()).equals(AppConstants.AT_LIST))
+ curFilter.append(formatListValue(cf.getArgValue(), dc, false,
+ false));
+ else if (nvl(cf.getArgType()).equals(AppConstants.AT_COLUMN))
+ curFilter.append(getColumnNameById(cf.getArgValue()));
+ else if (nvl(cf.getArgType()).equals(AppConstants.AT_FORM)) {
+ String fieldName = getFormFieldName(cf);
+ String fieldValue = Utils.oracleSafe(paramValues
+ .getParamValue(fieldName));
+ boolean isMultiValue = paramValues
+ .isParameterMultiValue(fieldName);
+ boolean usePipeDelimiterOnly = false;
+
+ FormFieldType fft = getFormFieldByDisplayValue(cf.getArgValue());
+ if (fft == null)
+ // If not FormField => applying default value
+ fieldValue = nvl(fieldValue, Utils
+ .oracleSafe(cf.getArgValue()));
+ else
+ usePipeDelimiterOnly = fft.getFieldType().equals(
+ FormField.FFT_CHECK_BOX)
+ || fft.getFieldType().equals(FormField.FFT_LIST_MULTI);
+
+ if (nvl(fieldValue).length() == 0)
+ // Does not append filter with missing form
+ // field argument
+ applyFilter = false;
+ else if (isMultiValue || nvl(cf.getExpression()).equals("IN")
+ || nvl(cf.getExpression()).equals("NOT IN"))
+ curFilter.append(formatListValue(fieldValue, dc, true,
+ usePipeDelimiterOnly));
+ else
+ curFilter.append(formatValue(fieldValue, dc, true));
+ } // else
+ curFilter.append(nvl(cf.getCloseBrackets()));
+
+ if (applyFilter) {
+ filterCl.append(curFilter.toString());
+
+ if (isHavingCl) {
+ havingClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl(
+ cf.getCloseBrackets()).length());
+ havingClCarryoverBrackets = 0;
+ } else {
+ whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl(
+ cf.getCloseBrackets()).length());
+ whereClCarryoverBrackets = 0;
+ }
+ } else if (nvl(cf.getOpenBrackets()).length() != nvl(cf.getCloseBrackets())
+ .length())
+ if (nvl(cf.getOpenBrackets()).length() > nvl(cf.getCloseBrackets())
+ .length()) {
+ // Carry over opening brackets
+ if (isHavingCl)
+ havingClCarryoverBrackets += (nvl(cf.getOpenBrackets())
+ .length() - nvl(cf.getCloseBrackets()).length());
+ else
+ whereClCarryoverBrackets += (nvl(cf.getOpenBrackets())
+ .length() - nvl(cf.getCloseBrackets()).length());
+
+ if (isHavingCl)
+ havingClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl(
+ cf.getCloseBrackets()).length());
+ else
+ whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl(
+ cf.getCloseBrackets()).length());
+ } else {
+ // Adding closing brackets
+ if (filterCl.length() > 0) {
+ for (int b = 0; b < nvl(cf.getCloseBrackets()).length()
+ - nvl(cf.getOpenBrackets()).length(); b++)
+ filterCl.append(')');
+
+ if (isHavingCl)
+ havingClBracketCount += (nvl(cf.getOpenBrackets())
+ .length() - nvl(cf.getCloseBrackets()).length());
+ else
+ whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl(
+ cf.getCloseBrackets()).length());
+ } // if
+ } // else
+ } // for
+ } // if
+ } // for
+
+ // Identifying ORDER BY clause fields
+ DataColumnType overrideSortByCol = null;
+ if (overrideSortByColId != null)
+ overrideSortByCol = getColumnById(overrideSortByColId);
+
+ if (overrideSortByCol != null) {
+ orderByCl.append(getColumnSelectStr(overrideSortByCol, paramValues));
+ orderByCl.append(" ");
+ orderByCl.append(nvl(overrideSortByAscDesc, AppConstants.SO_ASC));
+ } else if (getReportType().equals(AppConstants.RT_CROSSTAB)) {
+ /*
+ * for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ * DataColumnType dc = (DataColumnType) iter.next();
+ *
+ * if(nvl(dc.getCrossTabValue()).equals(AppConstants.CV_ROW)||nvl(dc.getCrossTabValue()).equals(AppConstants.CV_COLUMN)) {
+ * if(orderByCl.length()>0) orderByCl.append(", ");
+ * orderByCl.append(getColumnSelectStr(dc, paramValues));
+ * orderByCl.append(" ");
+ * if(dc.getColType().equals(AppConstants.CT_DATE))
+ * orderByCl.append(AppConstants.SO_DESC); else
+ * orderByCl.append(AppConstants.SO_ASC); } // if } // for
+ */
+ } else {
+ Collections.sort(reportCols, new OrderBySeqComparator());
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+
+ if (dc.getOrderBySeq() > 0) {
+ if (orderByCl.length() > 0)
+ orderByCl.append(", ");
+ orderByCl.append(getColumnSelectStr(dc, paramValues));
+ orderByCl.append(" ");
+ orderByCl.append(dc.getOrderByAscDesc());
+ } // if
+ } // for
+ Collections.sort(reportCols, new OrderSeqComparator());
+ } // else
+
+ // Adding up the actual statement
+ StringBuffer sql = new StringBuffer();
+ //sql.append("SELECT "); // Need to add PK for /*+ FIRST_ROWS */ ");
+ sql.append(Globals.getGenerateSqlVisualSelect());
+ // sql.append((selectCl.length() == 0) ? "COUNT(*) cnt" : selectCl.toString());
+ sql.append((selectCl.length() == 0) ? Globals.getGenerateSqlVisualCount() : selectCl.toString());
+ if (groupByCl.length() == 0)
+ sql.append(selectExtraIdCl.toString());
+ sql.append(selectExtraDateCl.toString());
+ // sql.append(" FROM ");
+ sql.append((fromCl.length() == 0) ? Globals.getGenerateSqlVisualDual() : "FROM "+fromCl.toString());
+ if (whereCl.length() > 0) {
+ if (whereClBracketCount > 0) {
+ for (int b = 0; b < whereClBracketCount; b++)
+ whereCl.append(')');
+ } else if (whereClBracketCount < 0) {
+ for (int b = 0; b < Math.abs(whereClBracketCount); b++)
+ whereCl.insert(0, '(');
+ } // else
+
+ sql.append(" WHERE ");
+ sql.append(whereCl.toString());
+ } // if
+ if (groupByCl.length() > 0) {
+ sql.append(" GROUP BY ");
+ sql.append(groupByCl.toString());
+
+ if (havingCl.length() > 0) {
+ if (havingClBracketCount > 0) {
+ for (int b = 0; b < havingClBracketCount; b++)
+ havingCl.append(')');
+ } else if (havingClBracketCount < 0) {
+ for (int b = 0; b < Math.abs(havingClBracketCount); b++)
+ havingCl.insert(0, '(');
+ } // else
+
+ sql.append(" HAVING ");
+ sql.append(havingCl.toString());
+ }
+ }
+ if (orderByCl.length() > 0) {
+ sql.append(" ORDER BY ");
+ sql.append(orderByCl.toString());
+ }
+
+ System.out.println("Created SQL statement: "+sql);
+
+ //String sqlStr = Utils.replaceInString(sql.toString(), "[LOGGED_USERID]", userId);
+ //return sqlStr;
+ return sql.toString();
+ } // generateSQLCrossTabVisual
+
+
+ public String generatePagedSQL(int pageNo, String userId, HttpServletRequest request, boolean getColumnNamesFromReportSQL, ReportParamValues paramValues) throws RaptorException {
+ int counter = 0;
+ if(!Globals.isMySQL())
+ counter = 1;
+ return generateSubsetSQL(pageNo * getPageSize() + counter, ((pageNo + 1) * getPageSize())
+ + ((pageNo == 0) ? 1 : 0), userId, request, getColumnNamesFromReportSQL, paramValues);
+ } // generatePagedSQL
+
+ public String generateSubsetSQL(int startRow, int endRow, String userId, HttpServletRequest request, boolean getColumnNamesFromReportSQL, ReportParamValues paramValues) throws RaptorException {
+ //debugLogger.debug(" ******** End Row ********* " + endRow);
+ String dbInfo = getDBInfo();
+ String dbType = "";
+ if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ try {
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ dbType = remDbInfo.getDBType(dbInfo);
+ } catch (Exception ex) {
+ throw new RaptorException(ex);
+ }
+ }
+ List reportCols = getAllColumns();
+ String wholeSQL_OrderBy = getWholeSQL();
+ String reportSQL = getWholeSQL();
+ reportSQL = reportSQL.replace(";", "");
+ setWholeSQL(reportSQL);
+ if(nvl(reportSQL).length()>0)
+ reportSQL = generateSQL(userId, request);
+
+ if (reportSQL.toUpperCase().indexOf("ORDER BY ") < 0) {
+ StringBuffer sortBy = null;
+
+ if (reportSQL.toUpperCase().indexOf("GROUP BY ") < 0)
+ if (getDataSourceList().getDataSource().size() > 0) {
+ DataSourceType dst = (DataSourceType) getDataSourceList().getDataSource()
+ .get(0);
+ String tId = dst.getTableId();
+ String tPK = dst.getTablePK();
+ if (nvl(tPK).length() > 0) {
+ sortBy = new StringBuffer();
+ StringTokenizer st = new StringTokenizer(tPK, ", ");
+ while (st.hasMoreTokens()) {
+ if (sortBy.length() > 0)
+ sortBy.append(",");
+ sortBy.append(tId);
+ sortBy.append(".");
+ sortBy.append(st.nextToken());
+ } // while
+ }
+ } // if
+ if (reportSQL.trim().toUpperCase().startsWith("SELECT")) {
+ //if (!(dbType.equals("DAYTONA") && reportSQL.trim().toUpperCase().startsWith("SELECT")))
+ // reportSQL += " ORDER BY " + ((sortBy == null) ? "1" : sortBy.toString());
+ }
+ }
+
+ StringBuffer colNames = new StringBuffer();
+ StringBuffer colExtraIdNames = new StringBuffer();
+ StringBuffer colExtraDateNames = new StringBuffer();
+
+ if(getColumnNamesFromReportSQL) {
+ DataSet ds = ConnectionUtils.getDataSet(reportSQL, dbInfo);
+ List reportCols1 = getAllColumns();
+ reportCols = new Vector();
+ outer:
+ for (Iterator iter = reportCols1.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ for (int k=0; k<ds.getColumnCount(); k++) {
+ if(dct.getColId().toUpperCase().trim().equals(ds.getColumnName(k).trim())) {
+ reportCols.add(dct);
+ continue outer;
+ }
+ }
+ }
+
+ if (getFormFieldList() != null) {
+ String paramValue = "";
+ for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ if(fft.isGroupFormField()!=null && fft.isGroupFormField().booleanValue()) {
+ paramValue = Utils.oracleSafe(nvl(paramValues
+ .getParamValue(fft.getFieldId())));
+ outer:
+ for (Iterator iter1 = reportCols1.iterator(); iter1.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter1.next();
+ if(("["+fft.getFieldName()+ "]").equals(dct.getColName().trim())) {
+ dct.setDisplayName(paramValue);
+ continue outer;
+ }
+ }
+
+
+ }
+ }
+ }
+
+ }
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ //TODO: commented if (dc.isVisible()) {
+ if (colNames.length() > 0)
+ colNames.append(", ");
+ colNames.append(dc.getColId());
+ //TODO uncomment if it's not working} // if
+
+ // Checking for extra fields necessary for drill-down
+ if (nvl(dc.getDrillDownURL()).length() > 0)
+ if (isViewAction(dc.getDrillDownURL()))
+ addExtraIdSelect(colExtraIdNames, nvl(dc.getDrillDownParams()), false);
+ else
+ addExtraDateSelect(colExtraDateNames, nvl(dc.getDrillDownParams()), null,
+ false);
+ } // for
+
+ if (reportSQL.toUpperCase().indexOf("GROUP BY ") < 0)
+ colNames.append(colExtraIdNames.toString());
+ //commented to avoid coldId_dde
+ //colNames.append(colExtraDateNames.toString());
+
+ /*
+ * if(pageNo==0) if(reportSQL.toUpperCase().indexOf(" WHERE ")<0)
+ * if(reportSQL.toUpperCase().indexOf(" GROUP BY ")<0) reportSQL =
+ * reportSQL.substring(0, reportSQL.toUpperCase().indexOf(" ORDER BY
+ * "))+" WHERE ROWNUM <=
+ * "+getPageSize()+reportSQL.substring(reportSQL.toUpperCase().indexOf("
+ * ORDER BY ")); else reportSQL = "SELECT "+colNames.toString()+" FROM
+ * (SELECT ROWNUM rnum, "+colNames.toString()+" FROM ("+reportSQL+") x)
+ * y WHERE rnum <= "+getPageSize()+" ORDER BY rnum"; else reportSQL =
+ * reportSQL.substring(0, reportSQL.toUpperCase().indexOf(" WHERE "))+"
+ * WHERE ROWNUM <= "+getPageSize()+" AND
+ * "+reportSQL.substring(reportSQL.toUpperCase().indexOf(" WHERE ")+7);
+ * else reportSQL = "SELECT "+colNames.toString()+" FROM (SELECT ROWNUM
+ * rnum, "+colNames.toString()+" FROM ("+reportSQL+") x) y WHERE rnum >=
+ * "+(pageNo*getPageSize()+1)+" AND rnum <=
+ * "+((pageNo+1)*getPageSize())+" ORDER BY rnum";
+ */
+ if (dbType.equals("DAYTONA") && reportSQL.trim().toUpperCase().startsWith("SELECT")) {
+ if(endRow == -1) endRow = (getMaxRowsInExcelDownload()>0)?getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ reportSQL = reportSQL + " LIMIT TO " +(startRow==0?startRow+1:startRow)+"->"+endRow;
+ return reportSQL;
+ } else if (dbType.equals("DAYTONA")) {
+ return reportSQL;
+ }
+
+ //reportSQL = "SELECT " + colNames.toString() + " FROM (SELECT ROWNUM rnum, "
+ // + colNames.toString() + " FROM (" + reportSQL + ") x ";
+
+ String rSQL = Globals.getGenerateSubsetSql();
+ rSQL = rSQL.replace("[colNames.toString()]", colNames.toString());
+ rSQL = rSQL.replace("[reportSQL]", reportSQL);
+
+ reportSQL=rSQL;
+ //added rownum for total report where row header need to be shown
+ //reportSQLOnlyFirstPart = "SELECT rnum," + colNames.toString() + " FROM (SELECT ROWNUM rnum, "
+ //+ colNames.toString() + " FROM (" ;
+
+ reportSQLOnlyFirstPart = Globals.getReportSqlOnlyFirstPart();
+ reportSQLOnlyFirstPart = reportSQLOnlyFirstPart.replace("[colNames.toString()]", colNames.toString());
+
+
+ reportSQLWithRowNum = reportSQL;
+
+ /* if( endRow != -1)
+ reportSQL += " WHERE ROWNUM <= " + endRow;
+ reportSQL += " ) y WHERE rnum >= " + startRow + " ORDER BY rnum";
+ return reportSQL;*/
+ String parta = Globals.getReportSqlOnlySecondPartA();
+ String partb = Globals.getReportSqlOnlySecondPartB();
+
+ String partSql = "";
+ if(!AppUtils.isNotEmpty(getDBType())){
+ setDBType(Globals.getDBType());
+ }
+
+ int closeBracketPos = 0;
+ if(wholeSQL_OrderBy.lastIndexOf(")")!= -1) closeBracketPos = wholeSQL_OrderBy.lastIndexOf(")");
+ int idxOrderBy = (closeBracketPos>0)?wholeSQL_OrderBy.toUpperCase().indexOf("ORDER BY", closeBracketPos):wholeSQL_OrderBy.toUpperCase().lastIndexOf("ORDER BY");
+ String orderbyclause = "";
+ if (idxOrderBy < 0) {
+ orderbyclause = " ORDER BY 1 ";
+ partSql += " "+ orderbyclause+ " ";
+ }
+ else {
+ orderbyclause = wholeSQL_OrderBy.substring(idxOrderBy);
+ partSql += " "+ orderbyclause+ " ";
+ }
+
+ if(getDBType().equals(AppConstants.MYSQL)) {
+ partSql = "LIMIT "+ String.valueOf(startRow)+" , "+ String.valueOf(getPageSize());
+ } else if(getDBType().equals(AppConstants.ORACLE)) {
+ reportSQL = reportSQL.replace(" AS ", " ");
+ partSql = "where rownum >= "+ String.valueOf(startRow)+" and rownum <= "+(Integer.parseInt(String.valueOf(startRow)) + Integer.parseInt(String.valueOf(getPageSize())));
+ } else if(getDBType().equals(AppConstants.POSTGRESQL)) {
+ partSql = "LIMIT "+ String.valueOf(getPageSize())+" , "+ String.valueOf(startRow);//limit [pageSize] offset [startRow]
+ }
+
+ // Limit only to MYSQL or MariaDB
+ //if (reportSQL.toUpperCase().indexOf("ORDER BY ") < 0)
+ //partSql += " ORDER BY 1";
+ //else {
+
+
+
+ /*if(!Globals.isMySQL())
+ parta = parta.replace("[endRow]", String.valueOf(endRow));
+ else
+ parta = parta.replace("[startRow]", String.valueOf(startRow));
+
+ //String partb = Globals.getReportSqlOnlySecondPartB();
+ if(!Globals.isMySQL())
+ partb = partb.replace("[startRow]", String.valueOf(startRow));
+ else
+ partb = partb.replace("[pageSize]", String.valueOf(getPageSize()));
+
+ if( endRow != -1)
+ reportSQL += parta;*/
+ reportSQL += partSql;
+
+ return reportSQL;
+
+ } // generateSubsetSQL
+
+ public String generateChartSQL(ReportParamValues paramValues, String userId, HttpServletRequest request ) throws RaptorException {
+ List reportCols = getAllColumns();
+ List chartValueCols = getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, null); // parameter is 0 has this requires all columns.
+ String reportSQL = generateSQL(userId, request);
+ //if(nvl(reportSQL).length()>0) reportSQL = generatedChartSQL;
+ logger.debug(EELFLoggerDelegate.debugLogger, ("SQL " + reportSQL));
+ String legendCol = "1 a";
+ // String valueCol = "1";
+ StringBuffer groupCol = new StringBuffer();
+ StringBuffer seriesCol = new StringBuffer();
+ StringBuffer valueCols = new StringBuffer();
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, paramValues);
+ if (nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))
+ legendCol = getSelectExpr(dc, colName)+" " + dc.getColId();
+ // if(dc.getChartSeq()>0)
+ // valueCol = "NVL("+colName+", 0) "+dc.getColId();
+ if ((!nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))
+ && (dc.getChartSeq()==null || dc.getChartSeq() <= 0) && dc.isGroupBreak()) {
+ groupCol.append(", ");
+ groupCol.append(colName + " " + dc.getColId());
+ }
+ } // for
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if(dc.isChartSeries()!=null && dc.isChartSeries().booleanValue()) {
+ //System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues)));
+ seriesCol.append(", "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues))+ " " + dc.getColId());
+ }
+ }
+
+ /*for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if(!dc.isChartSeries() && !(nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
+ //System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues)));
+ seriesCol.append(", "+ formatChartColumn(getSelectExpr(dc,getColumnSelectStr(dc, paramValues)))+ " " + dc.getColId());
+ }
+ }*/
+
+ for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, paramValues);
+ //valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId());
+ seriesCol.append("," + formatChartColumn(colName) + " " + dc.getColId());
+ } // for
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, paramValues);
+ if(colName.equals(AppConstants.RI_CHART_TOTAL_COL))
+ seriesCol.append(", " + AppConstants.RI_CHART_TOTAL_COL + " " + AppConstants.RI_CHART_TOTAL_COL );
+ if (colName.equals(AppConstants.RI_CHART_COLOR))
+ seriesCol.append(", " + AppConstants.RI_CHART_COLOR + " " + AppConstants.RI_CHART_COLOR );
+ if(colName.equals(AppConstants.RI_CHART_MARKER_START))
+ seriesCol.append(", " + AppConstants.RI_CHART_MARKER_START + " " + AppConstants.RI_CHART_MARKER_START );
+ if(colName.equals(AppConstants.RI_CHART_MARKER_END))
+ seriesCol.append(", " + AppConstants.RI_CHART_MARKER_END + " " + AppConstants.RI_CHART_MARKER_END );
+ if(colName.equals(AppConstants.RI_CHART_MARKER_TEXT_LEFT))
+ seriesCol.append(", " + AppConstants.RI_CHART_MARKER_TEXT_LEFT + " " + AppConstants.RI_CHART_MARKER_TEXT_LEFT );
+ if(colName.equals(AppConstants.RI_CHART_MARKER_TEXT_RIGHT))
+ seriesCol.append(", " + AppConstants.RI_CHART_MARKER_TEXT_RIGHT + " " + AppConstants.RI_CHART_MARKER_TEXT_RIGHT );
+ if(colName.equals(AppConstants.RI_ANOMALY_TEXT))
+ seriesCol.append(", " + AppConstants.RI_ANOMALY_TEXT + " " + AppConstants.RI_ANOMALY_TEXT );
+ }
+
+ //debugLogger.debug("ReportSQL Chart " + reportSQL );
+ /*for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, paramValues);
+ //valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId());
+ valueCols.append("," + formatChartColumn(colName) + " " + dc.getColId());
+ } // for
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, paramValues);
+ //if(colName.equals(AppConstants.RI_CHART_TOTAL_COL) || colName.equals(AppConstants.RI_CHART_COLOR)) {
+ if(colName.equals(AppConstants.RI_CHART_TOTAL_COL))
+ valueCols.append(", " + AppConstants.RI_CHART_TOTAL_COL + " " + AppConstants.RI_CHART_TOTAL_COL );
+ if (colName.equals(AppConstants.RI_CHART_COLOR))
+ valueCols.append(", " + AppConstants.RI_CHART_COLOR + " " + AppConstants.RI_CHART_COLOR );
+ if (colName.equals(AppConstants.RI_CHART_INCLUDE))
+ valueCols.append(", " + AppConstants.RI_CHART_INCLUDE + " " + AppConstants.RI_CHART_INCLUDE );
+ //}
+ }*/
+ String final_sql = "";
+ reportSQL = Utils.replaceInString(reportSQL, " from ", " FROM ");
+ reportSQL = Utils.replaceInString(reportSQL, " select ", " SELECT ");
+ reportSQL = Utils.replaceInString(reportSQL, " union ", " UNION ");
+ //reportSQL = reportSQL.replaceAll("[\\s]*\\(", "(");
+// if(reportSQL.indexOf("UNION") != -1) {
+// if(reportSQL.indexOf("FROM(")!=-1)
+// final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM(") );
+// else if (reportSQL.indexOf("FROM (")!=-1)
+// final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM (") );
+// //TODO ELSE THROW ERROR
+// }
+// else {
+// final_sql += " "+reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM "));
+// }
+ int pos = 0;
+ int pos_first_select = 0;
+ int pos_dup_select = 0;
+ int pos_prev_select = 0;
+ int pos_last_select = 0;
+ if (reportSQL.indexOf("FROM", pos)!=-1) {
+ pos = reportSQL.indexOf("FROM", pos);
+ pos_dup_select = reportSQL.lastIndexOf("SELECT",pos);
+ pos_first_select = reportSQL.indexOf("SELECT");//,pos);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("pos_select " + pos_first_select + " " + pos_dup_select));
+ if(pos_dup_select > pos_first_select) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("********pos_dup_select ********" + pos_dup_select));
+ //pos_dup_select1 = pos_dup_select;
+ pos_prev_select = pos_first_select;
+ pos_last_select = pos_dup_select;
+ while (pos_last_select > pos_prev_select) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("pos_last , pos_prev " + pos_last_select + " " + pos_prev_select));
+ pos = reportSQL.indexOf("FROM", pos+2);
+ pos_prev_select = pos_last_select;
+ pos_last_select = reportSQL.lastIndexOf("SELECT",pos);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("in WHILE LOOP LAST " + pos_last_select));
+ }
+ }
+
+ }
+ final_sql += " "+reportSQL.substring(pos);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Final SQL " + final_sql));
+ String sql = "SELECT " + legendCol + ", " + legendCol+"_1" + seriesCol.toString()+ nvl(valueCols.toString(), ", 1")
+ + groupCol.toString()
+ + final_sql;
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Final sql in generateChartSQL " +sql));
+
+ return sql;
+ } // generateChartSQL
+
+ private String formatChartColumn(String colName) {
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Format Chart Column Input colName" + colName));
+ colName = colName.trim();
+ colName = Utils.replaceInString(colName, "TO_CHAR", "to_char");
+ colName = Utils.replaceInString(colName, "to_number", "TO_NUMBER");
+ //reportSQL = reportSQL.replaceAll("[\\s]*\\(", "(");
+ colName = colName.replaceAll(",[\\s]*\\(", ",(");
+ StringBuffer colNameBuf = new StringBuffer(colName);
+ int pos = 0, posFormatStart = 0, posFormatEnd = 0;
+ String format = "";
+ if(colNameBuf.indexOf("999")==-1 && colNameBuf.indexOf("990")==-1) {
+ logger.debug(EELFLoggerDelegate.debugLogger, (" return colName " + colNameBuf.toString()));
+ return colNameBuf.toString();
+ }
+ while (colNameBuf.indexOf("to_char")!=-1) {
+ if(colNameBuf.indexOf("999")!=-1 || colNameBuf.indexOf("990")!=-1) {
+ pos = colNameBuf.indexOf("to_char");
+ colNameBuf.insert(pos, " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER (");
+ pos = colNameBuf.indexOf("to_char");
+ colNameBuf.replace(pos, pos+7, "TO_CHAR");
+ //colName = Utils.replaceInString(colNameBuf.toString(), "to_char", " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER ( TO_CHAR ");
+ logger.debug(EELFLoggerDelegate.debugLogger, ("After adding to_number " + colNameBuf.toString()));
+ //posFormatStart = colNameBuf.lastIndexOf(",'")+1;
+ posFormatStart = colNameBuf.indexOf(",'", pos)+1;
+ posFormatEnd = colNameBuf.indexOf(")",posFormatStart);
+ logger.debug(EELFLoggerDelegate.debugLogger, (posFormatStart + " " + posFormatEnd + " "+ pos));
+ format = colNameBuf.substring(posFormatStart, posFormatEnd);
+ //posFormatEnd = colNameBuf.indexOf(")",posFormatEnd);
+ colNameBuf.insert(posFormatEnd+1, " ," + format + ") , "+ format + ")");
+ logger.debug(EELFLoggerDelegate.debugLogger, ("colNameBuf " + colNameBuf.toString()));
+ }
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, (" return colName " + colNameBuf.toString()));
+ return colNameBuf.toString();
+ }
+ public String generateTotalSQLLinear(ReportParamValues paramValues, String userId, HttpServletRequest request) throws RaptorException {
+ List reportCols = getAllColumns();
+ String reportSQL = generateSQL(userId,request);
+ //debugLogger.debug("After GenerateSQL " + reportSQL);
+
+ StringBuffer sbSelect = new StringBuffer();
+ StringBuffer sbTotal = new StringBuffer();
+ StringBuffer colNames = new StringBuffer();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (colNames.length() > 0)
+ colNames.append(", ");
+ colNames.append(dc.getColId());
+ }
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ //if (!dct.isVisible())
+ // continue;
+
+ String colName = getColumnSelectStr(dct, paramValues);
+
+ sbSelect.append((sbSelect.length() == 0) ? "SELECT " : ", ");
+
+ sbSelect.append(colName);
+ sbSelect.append(" ");
+ sbSelect.append(dct.getColId());
+
+
+ sbTotal.append((sbTotal.length() == 0) ? "SELECT " : ", ");
+ if (nvl(dct.getDisplayTotal()).length() > 0) {
+ // sbTotal.append(getSelectExpr(dct,
+ // dct.getDisplayTotal()+dct.getColId()+")"));
+ String displayTotal = dct.getDisplayTotal();
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < displayTotal.length(); i++) {
+ char ch = displayTotal.charAt(i);
+ if (ch == '+' || ch == '-')
+ sb.append(dct.getColId() + ")");
+ sb.append(ch);
+ } // for
+ sb.append(dct.getColId() + ")");
+
+ //debugLogger.debug("SB " + sb.toString() + "\n " + getSelectExpr(dct, sb.toString()));
+ sbTotal.append(getSelectExpr(dct, sb.toString()));
+ //debugLogger.debug("SBTOTAL " + sbTotal.toString());
+ } else
+ sbTotal.append("NULL");
+ sbTotal.append(" total_");
+ sbTotal.append(dct.getColId());
+ } // for
+
+ //debugLogger.debug(" ****** " + sbTotal.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, ("REPORTWRAPPER " + reportSQL));
+ int pos = 0;
+ int pos_first_select = 0;
+ int pos_dup_select = 0;
+ int pos_prev_select = 0;
+ int pos_last_select = 0;
+
+ //reportSQL = Utils.replaceInString(reportSQL, " from ", " FROM ");
+ //reportSQL = Utils.replaceInString(reportSQL, "select ", "SELECT ");
+ reportSQL = replaceNewLine(reportSQL, " from ", " FROM ");
+ reportSQL = replaceNewLine(reportSQL, "from ", " FROM ");
+ reportSQL = replaceNewLine(reportSQL, "FROM ", " FROM ");
+
+ reportSQL = " "+reportSQL;
+ reportSQL = replaceNewLine(reportSQL, "select ", " SELECT ");
+ reportSQL = replaceNewLine(reportSQL, "SELECT ", " SELECT ");
+ if (reportSQL.indexOf("FROM", pos)!=-1) {
+ pos = reportSQL.indexOf("FROM", pos);
+ pos_dup_select = reportSQL.lastIndexOf("SELECT",pos);
+ pos_first_select = reportSQL.indexOf("SELECT");//,pos);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("pos_select " + pos_first_select + " " + pos_dup_select));
+ if(pos_dup_select > pos_first_select) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("********pos_dup_select ********" + pos_dup_select));
+ //pos_dup_select1 = pos_dup_select;
+ pos_prev_select = pos_first_select;
+ pos_last_select = pos_dup_select;
+ while (pos_last_select > pos_prev_select) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("pos_last , pos_prev " + pos_last_select + " " + pos_prev_select));
+ pos = reportSQL.indexOf("FROM", pos+2);
+ pos_prev_select = pos_last_select;
+ pos_last_select = reportSQL.lastIndexOf("SELECT",pos);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("in WHILE LOOP LAST " + pos_last_select));
+ }
+ }
+
+ }
+
+
+ //sbSelect.append(reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM ")));
+
+ logger.debug(EELFLoggerDelegate.debugLogger, (" *************** " + pos + " " + reportSQL));
+ //sbSelect.append(" "+ reportSQL.substring(pos));
+ sbSelect.append(" "+reportSQL.substring(pos));
+ logger.debug(EELFLoggerDelegate.debugLogger, (" **************** " + sbSelect.toString()));
+ sbTotal.append(" FROM (");
+ sbTotal.append(sbSelect.toString());
+ sbTotal.append(") totalSQL");
+
+ String dbType = "";
+ String dbInfo = getDBInfo();
+ if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ try {
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ dbType = remDbInfo.getDBType(dbInfo);
+ } catch (Exception ex) {
+ throw new RaptorException(ex);
+ }
+ }
+ if (dbType.equals("DAYTONA")) {
+ sbTotal.append("("+ colNames+ ")");
+ }
+ String sql = sbTotal.toString();
+ sql = Utils.replaceInString(sql, " from ", " FROM ");
+ sql = Utils.replaceInString(sql, "select ", "SELECT ");
+ //sql = Utils.replaceInString(sql, " select ", " SELECT ");
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Before SQL Corrector " + sql));
+ String corrected_SQL = new SQLCorrector().fixSQL(new StringBuffer(sql));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("************"));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Corrected SQL " + corrected_SQL));
+ return corrected_SQL;
+ //return sbTotal.toString();
+ } // generateTotalSQLLinear
+
+ public String generateTotalSQLCrossTab(String sql, String rowColPos,
+ String userId, HttpServletRequest request, ReportParamValues paramValues) throws RaptorException {
+ List reportCols = getAllColumns();
+ String reportSQL = sql;
+
+ StringBuffer sbSelect = new StringBuffer();
+ StringBuffer sbGroup = new StringBuffer();
+ // StringBuffer sbOrder = new StringBuffer();
+ StringBuffer sbTotal = new StringBuffer();
+ StringBuffer colNames = new StringBuffer();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (colNames.length() > 0)
+ colNames.append(", ");
+ colNames.append(dc.getColId());
+ }
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if (!dct.isVisible())
+ continue;
+
+
+ String colName = getColumnSelectStr(dct, paramValues);
+ String colExpr = getSelectExpr(dct, colName);
+
+ sbSelect.append((sbSelect.length() == 0) ? "SELECT " : ", ");
+
+ if (nvl(dct.getCrossTabValue()).equals(rowColPos)) {
+ //sbSelect.append(colExpr);
+ sbSelect.append(dct.getColId());
+ sbGroup.append((sbGroup.length() == 0) ? " GROUP BY " : ", ");
+ sbGroup.append(dct.getColId());
+
+ /*
+ * sbOrder.append((sbOrder.length()==0)?" ORDER BY ":", ");
+ * sbOrder.append(dct.getColId());
+ * if(dct.getColType().equals(AppConstants.CT_DATE))
+ * sbOrder.append(" DESC");
+ */
+
+ sbTotal.append((sbTotal.length() == 0) ? "SELECT " : ", ");
+ sbTotal.append(dct.getColId());
+ } else if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_VALUE)) {
+ //sbSelect.append(colName);
+ sbSelect.append(dct.getColId());
+
+ String displayTotal = getCrossTabDisplayTotal(rowColPos);
+ if (displayTotal.length() > 0) {
+ // displayTotal += dct.getColId()+")";
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < displayTotal.length(); i++) {
+ char ch = displayTotal.charAt(i);
+ if (ch == '+' || ch == '-')
+ sb.append(dct.getColId() + ")");
+ sb.append(ch);
+ } // for
+ sb.append(dct.getColId() + ")");
+
+ displayTotal = sb.toString();
+ } else
+ displayTotal = "COUNT(*)";
+
+ sbTotal.append((sbTotal.length() == 0) ? "SELECT " : ", ");
+ sbTotal.append(getSelectExpr(dct, displayTotal));
+ sbTotal.append(" total_");
+ sbTotal.append(dct.getColId());
+ } else {
+ //sbSelect.append(colExpr);
+ sbSelect.append(dct.getColId());
+ } // if
+
+ sbSelect.append(" ");
+ sbSelect.append(dct.getColId());
+ } // for
+
+ sbSelect.append(reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM ")));
+
+ sbTotal.append(" FROM (");
+ sbTotal.append(sbSelect.toString());
+ sbTotal.append(") totalSQL");
+ sbTotal.append(sbGroup.toString());
+ String dbType = "";
+ String dbInfo = getDBInfo();
+ if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ try {
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ dbType = remDbInfo.getDBType(dbInfo);
+ } catch (Exception ex) {
+ throw new RaptorException(ex);
+ }
+ }
+ if (dbType.equals("DAYTONA")) {
+ sbTotal.append("("+ colNames+ ")");
+ }
+
+ // sbTotal.append(sbOrder.toString());
+
+ //debugLogger.debug(getReportDefType() + " " + AppConstants.RD_SQL_BASED);
+ //debugLogger.debug("SQL To Delete " + sbTotal.toString());
+ sql = "";
+ if (getReportDefType().equals(AppConstants.RD_SQL_BASED)) {
+ sql = Utils.replaceInString(sbTotal.toString(), " from ", " FROM ");
+ sql = Utils.replaceInString(sql, "select ", "SELECT ");
+ return new SQLCorrector().fixSQL(new StringBuffer(sql));
+ }
+
+ return sbTotal.toString();
+
+ } // generateTotalSQLCrossTab
+
+
+ public String generateTotalSQLCrossTab(ReportParamValues paramValues, String rowColPos,
+ String userId, HttpServletRequest request) throws RaptorException {
+ List reportCols = getAllColumns();
+ String reportSQL = generateSQL(userId, request);
+
+ StringBuffer sbSelect = new StringBuffer();
+ StringBuffer sbGroup = new StringBuffer();
+ // StringBuffer sbOrder = new StringBuffer();
+ StringBuffer sbTotal = new StringBuffer();
+ StringBuffer colNames = new StringBuffer();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (colNames.length() > 0)
+ colNames.append(", ");
+ colNames.append(dc.getColId());
+ }
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if (!dct.isVisible())
+ continue;
+
+ String colName = getColumnSelectStr(dct, paramValues);
+ String colExpr = getSelectExpr(dct, colName);
+
+ sbSelect.append((sbSelect.length() == 0) ? "SELECT " : ", ");
+
+ if (nvl(dct.getCrossTabValue()).equals(rowColPos)) {
+ sbSelect.append(colExpr);
+
+ sbGroup.append((sbGroup.length() == 0) ? " GROUP BY " : ", ");
+ sbGroup.append(dct.getColId());
+
+ /*
+ * sbOrder.append((sbOrder.length()==0)?" ORDER BY ":", ");
+ * sbOrder.append(dct.getColId());
+ * if(dct.getColType().equals(AppConstants.CT_DATE))
+ * sbOrder.append(" DESC");
+ */
+
+ sbTotal.append((sbTotal.length() == 0) ? "SELECT " : ", ");
+ sbTotal.append(dct.getColId());
+ } else if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_VALUE)) {
+ sbSelect.append(colName);
+
+ String displayTotal = getCrossTabDisplayTotal(rowColPos);
+ if (displayTotal.length() > 0) {
+ // displayTotal += dct.getColId()+")";
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < displayTotal.length(); i++) {
+ char ch = displayTotal.charAt(i);
+ if (ch == '+' || ch == '-')
+ sb.append(dct.getColId() + ")");
+ sb.append(ch);
+ } // for
+ sb.append(dct.getColId() + ")");
+
+ displayTotal = sb.toString();
+ } else
+ displayTotal = "COUNT(*)";
+
+ sbTotal.append((sbTotal.length() == 0) ? "SELECT " : ", ");
+ sbTotal.append(getSelectExpr(dct, displayTotal));
+ sbTotal.append(" total_");
+ sbTotal.append(dct.getColId());
+ } else {
+ sbSelect.append(colExpr);
+ } // if
+
+ sbSelect.append(" ");
+ sbSelect.append(dct.getColId());
+ } // for
+
+ sbSelect.append(reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM ")));
+
+ sbTotal.append(" FROM (");
+ sbTotal.append(sbSelect.toString());
+ sbTotal.append(") totalSQL");
+ sbTotal.append(sbGroup.toString());
+ String dbType = "";
+ String dbInfo = getDBInfo();
+ if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ try {
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ dbType = remDbInfo.getDBType(dbInfo);
+ } catch (Exception ex) {
+ throw new RaptorException(ex);
+ }
+ }
+ if (dbType.equals("DAYTONA")) {
+ sbTotal.append("("+ colNames+ ")");
+ }
+
+ // sbTotal.append(sbOrder.toString());
+
+ //debugLogger.debug(getReportDefType() + " " + AppConstants.RD_SQL_BASED);
+ //debugLogger.debug("SQL To Delete " + sbTotal.toString());
+ String sql = "";
+ if (getReportDefType().equals(AppConstants.RD_SQL_BASED)) {
+ sql = Utils.replaceInString(sbTotal.toString(), " from ", " FROM ");
+ sql = Utils.replaceInString(sql, "select ", "SELECT ");
+ return new SQLCorrector().fixSQL(new StringBuffer(sql));
+ }
+
+ return sbTotal.toString();
+
+ } // generateTotalSQLCrossTab
+
+ public String generateDistinctValuesSQL(ReportParamValues paramValues, DataColumnType dct,
+ String userId, HttpServletRequest request) throws RaptorException {
+ DataSourceType dst = getColumnTableById(dct.getColId());
+ String colName = getColumnSelectStr(dct, paramValues);
+ String colExpr = getSelectExpr(dct, colName);
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ StringBuffer sb = new StringBuffer();
+ sb.append("SELECT DISTINCT ");
+ if (getReportDefType().equals(AppConstants.RD_SQL_BASED)) {
+ sb.append(dct.getColId());
+ sb.append(" FROM (");
+ //paramvalues added below to filter distinct values based on formfields.
+ //sb.append(generateSQL(paramValues, userId, request));
+ sb.append(rr.getWholeSQL());
+ sb.append(") " + (Globals.isPostgreSQL() || Globals.isMySQL() ?" AS ":"") + " report_sql ORDER BY 1");
+ } else {
+ sb.append(colExpr);
+ sb.append(" ");
+ sb.append(dct.getColId());
+ if (!colExpr.equals(colName)) {
+ sb.append(", ");
+ sb.append(colName);
+ } // if
+ sb.append(" FROM ");
+ sb.append(dst.getTableName());
+ sb.append(" ");
+ sb.append(dst.getTableId());
+ sb.append(" ORDER BY ");
+ sb.append(colName);
+ if (dct.getColType().equals(AppConstants.CT_DATE))
+ sb.append(" DESC");
+ } // else
+
+ return sb.toString();
+ } // generateDistinctValuesSQL
+
+ /** ************************************************************************************************* */
+
+ public DataSourceType getTableWithoutColumns() {
+ List dsList = getDataSourceList().getDataSource();
+ for (Iterator iter = dsList.iterator(); iter.hasNext();) {
+ DataSourceType ds = (DataSourceType) iter.next();
+
+ if (ds.getDataColumnList().getDataColumn().size() == 0)
+ return ds;
+ } // for
+
+ return null;
+ } // getTableWithoutColumns
+
+ public CustomReportType cloneCustomReportClearTables() throws RaptorException {
+ ReportWrapper nrw = new ReportWrapper(cloneCustomReport(), reportID, getOwnerID(),
+ getCreateID(), getCreateDate(), getUpdateID(), getUpdateDate(), getMenuID(),
+ isMenuApproved());
+
+ DataSourceType ndst = null;
+ while ((ndst = nrw.getTableWithoutColumns()) != null)
+ nrw.deleteDataSourceType(ndst.getTableId());
+
+ return nrw.getCustomReport();
+ } // cloneCustomReportClearTables
+
+ public String marshal() throws RaptorException {
+ StringWriter sw = new StringWriter();
+ ObjectFactory objFactory = new ObjectFactory();
+
+ try {
+ JAXBContext jc = JAXBContext.newInstance("org.openecomp.portalsdk.analytics.xmlobj");
+ Marshaller m = jc.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ //JAXBElement jaxbElement = new JAXBElement(new QName("customReport"), Object.class, "");
+ //m.marshal( System.out );
+ //m.marshal(jaxbElement, new StreamResult(sw));
+ m.marshal((getTableWithoutColumns() == null) ? objFactory.createCustomReport(cr) : objFactory.createCustomReport(cloneCustomReportClearTables()),
+ new StreamResult(sw));
+ } catch (JAXBException ex) {
+ throw new RaptorException (ex.getMessage(), ex.getCause());
+ }
+ return sw.toString();
+ } // marshal
+
+ public static CustomReportType unmarshalCR(String reportXML) throws RaptorException {
+ //CustomReport cr = null;
+ try {
+ JAXBContext jc = JAXBContext.newInstance("org.openecomp.portalsdk.analytics.xmlobj");
+ Unmarshaller u = jc.createUnmarshaller();
+ javax.xml.bind.JAXBElement<CustomReportType> doc = (javax.xml.bind.JAXBElement<CustomReportType>) u.unmarshal(new java.io.StringReader(
+ reportXML));
+ return doc.getValue();
+ } catch (JAXBException ex) {
+ ex.printStackTrace();
+ throw new RaptorException (ex.getMessage(), ex.getCause());
+ }
+
+
+ } // unmarshal
+
+ protected static CustomReportType createBlankCR() throws RaptorException {
+ return createBlankCR("N/A");
+ } // createBlank
+
+ protected static CustomReportType createBlankCR(String createID) throws RaptorException {
+ ObjectFactory objFactory = new ObjectFactory();
+ CustomReportType cr = objFactory.createCustomReportType();
+ //CustomReport cr = null;
+ try {
+ //cr = (CustomReport) objFactory.createCustomReport(customReportType);
+
+ cr.setReportName("");
+ cr.setReportDescr("");
+ cr.setChartType("");
+ cr.setPublic(false);
+ cr.setCreateId(createID);
+ cr.setCreateDate(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
+ // cr.setReportSQL("");
+ cr.setReportType("");
+ cr.setPageSize(50);
+
+ DataSourceList dataSourceList = objFactory.createDataSourceList();
+ cr.setDataSourceList(dataSourceList);
+ } catch (DatatypeConfigurationException ex) {
+ throw new RaptorException (ex.getMessage(), ex.getCause());
+ }
+ return cr;
+ } // createBlank
+
+ protected void replaceCustomReportWithClone() throws RaptorException {
+ try {
+ CustomReportType clone = cloneCustomReport();
+ this.cr = clone;
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[SYSTEM ERROR] ReportWrapper.replaceCustomReportWithClone generated exception for report ["
+ + reportID + "]. Exception: " + e.getMessage()));
+ throw new RaptorException("[SYSTEM ERROR] ReportWrapper.replaceCustomReportWithClone generated exception for report ["
+ + reportID + "]. Exception: " + e.getMessage(), e.getCause());
+ }
+ } // replaceCustomReportWithClone
+
+ /** ************************************************************************************************* */
+
+ public FormatType cloneFormatType(ObjectFactory objFactory, FormatType ft)
+ throws JAXBException {
+ FormatType nft = objFactory.createFormatType();
+
+ nft.setLessThanValue(ft.getLessThanValue());
+ nft.setExpression(ft.getExpression());
+ nft.setBold(ft.isBold());
+ nft.setItalic(ft.isItalic());
+ nft.setUnderline(ft.isUnderline());
+ if (nvl(ft.getBgColor()).length() > 0)
+ nft.setBgColor(ft.getBgColor());
+ if (nvl(ft.getFontColor()).length() > 0)
+ nft.setFontColor(ft.getFontColor());
+ if (nvl(ft.getFontFace()).length() > 0)
+ nft.setFontFace(ft.getFontFace());
+ if (nvl(ft.getFontSize()).length() > 0)
+ nft.setFontSize(ft.getFontSize());
+ if (nvl(ft.getAlignment()).length() > 0)
+ nft.setAlignment(ft.getAlignment());
+ if (nvl(ft.getComment()).length() > 0)
+ nft.setComment(ft.getComment());
+
+ nft.setFormatId(ft.getFormatId());
+
+ return nft;
+ } // cloneFormatType
+
+ public SemaphoreType cloneSemaphoreType(ObjectFactory objFactory, SemaphoreType st)
+ throws JAXBException {
+ SemaphoreType nst = objFactory.createSemaphoreType();
+
+ nst.setSemaphoreName(st.getSemaphoreName());
+ nst.setSemaphoreType(st.getSemaphoreType());
+ nst.setSemaphoreId(st.getSemaphoreId());
+ if (nvl(st.getComment()).length() > 0)
+ nst.setComment(st.getComment());
+
+ if (st.getFormatList() != null) {
+ FormatList formatList = objFactory.createFormatList();
+ nst.setFormatList(formatList);
+
+ for (Iterator iter = st.getFormatList().getFormat().iterator(); iter.hasNext();)
+ formatList.getFormat().add(
+ cloneFormatType(objFactory, (FormatType) iter.next()));
+ } // if
+
+ return nst;
+ } // cloneSemaphoreType
+
+ public Reports cloneDashboardType(ObjectFactory objFactory, Reports rpt)
+ throws JAXBException {
+ Reports nrpt = objFactory.createReports();
+
+ nrpt.setReportId(rpt.getReportId());
+ nrpt.setBgcolor(rpt.getBgcolor());
+ return nrpt;
+ } // cloneDashboardType
+
+ public Marker cloneMarkerType(ObjectFactory objFactory, Marker marker)
+ throws JAXBException {
+ Marker nMarker = objFactory.createMarker();
+ nMarker.setAddressColumn(marker.getAddressColumn());
+ nMarker.setDataColumn(marker.getDataColumn());
+ nMarker.setDataHeader(marker.getDataHeader());
+ nMarker.setMarkerColor(marker.getMarkerColor());
+ return nMarker;
+ } // cloneDashboardType
+
+ public ChartDrillFormfield cloneChartDrillFormfield(ObjectFactory objFactory, ChartDrillFormfield chartDrillFormfield)
+ throws JAXBException {
+ ChartDrillFormfield nChartDrillFormfield = objFactory.createChartDrillFormfield();
+ nChartDrillFormfield.setFormfield(chartDrillFormfield.getFormfield());
+ return nChartDrillFormfield;
+ } // cloneDashboardType
+
+ public boolean isChartDrillDownContainsName(String name) {
+ for (Iterator iter = getChartDrillOptions().getTargetFormfield().iterator(); iter
+ .hasNext();) {
+ org.openecomp.portalsdk.analytics.xmlobj.ChartDrillFormfield cdf = (org.openecomp.portalsdk.analytics.xmlobj.ChartDrillFormfield) iter.next();
+ if(cdf.getFormfield().equals(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ public FormFieldType cloneFormFieldType(ObjectFactory objFactory, FormFieldType fft)
+ throws JAXBException {
+ FormFieldType nfft = objFactory.createFormFieldType();
+
+ nfft.setColId(fft.getColId());
+ nfft.setFieldName(fft.getFieldName());
+ nfft.setFieldType(fft.getFieldType());
+ if (nvl(fft.getVisible()).length() > 0)
+ nfft.setVisible(fft.getVisible());
+ if (nvl(fft.getValidationType()).length() > 0)
+ nfft.setValidationType(fft.getValidationType());
+ if (nvl(fft.getMandatory()).length() > 0)
+ nfft.setMandatory(fft.getMandatory());
+ if (nvl(fft.getDefaultValue()).length() > 0)
+ nfft.setDefaultValue(fft.getDefaultValue());
+ nfft.setOrderBySeq(fft.getOrderBySeq());
+ if (nvl(fft.getFieldSQL()).length() > 0)
+ nfft.setFieldSQL(fft.getFieldSQL());
+ if (nvl(fft.getFieldDefaultSQL()).length() > 0)
+ nfft.setFieldDefaultSQL(fft.getFieldDefaultSQL());
+ if(fft.getRangeStartDate()!=null)
+ nfft.setRangeStartDate(fft.getRangeStartDate());
+ if(fft.getRangeEndDate()!=null)
+ nfft.setRangeEndDate(fft.getRangeEndDate());
+ if(fft.getRangeStartDateSQL()!=null)
+ nfft.setRangeStartDateSQL(fft.getRangeStartDateSQL());
+ if(fft.getRangeEndDateSQL()!=null)
+ nfft.setRangeEndDateSQL(fft.getRangeEndDateSQL());
+
+ if (nvl(fft.getComment()).length() > 0)
+ nfft.setComment(fft.getComment());
+
+ if (fft.getPredefinedValueList() != null) {
+ PredefinedValueList predefinedValueList = objFactory.createPredefinedValueList();
+ nfft.setPredefinedValueList(predefinedValueList);
+
+ for (Iterator iter = fft.getPredefinedValueList().getPredefinedValue().iterator(); iter
+ .hasNext();)
+ predefinedValueList.getPredefinedValue().add(new String((String) iter.next()));
+ } // if
+ if (nvl(fft.getDependsOn()).length() > 0)
+ nfft.setDependsOn(fft.getDependsOn());
+
+ nfft.setGroupFormField((fft.isGroupFormField()!=null && fft.isGroupFormField().booleanValue())?true:false);
+ if (nvl(fft.getMultiSelectListSize()).length() > 0)
+ nfft.setMultiSelectListSize(fft.getMultiSelectListSize());
+
+ nfft.setFieldId(fft.getFieldId());
+ return nfft;
+ } // cloneFormFieldType
+
+ public JavascriptItemType cloneJavascriptType(ObjectFactory objFactory, JavascriptItemType jit)
+ throws JAXBException {
+ JavascriptItemType njit = objFactory.createJavascriptItemType();
+
+ njit.setId(jit.getId());
+ njit.setFieldId(jit.getFieldId());
+ njit.setCallText(jit.getCallText());
+ return njit;
+ } // cloneJavascriptType
+
+ public ColFilterType cloneColFilterType(ObjectFactory objFactory, ColFilterType cft)
+ throws JAXBException {
+ ColFilterType ncft = objFactory.createColFilterType();
+
+ ncft.setColId(cft.getColId());
+ ncft.setFilterSeq(cft.getFilterSeq());
+ ncft.setJoinCondition(cft.getJoinCondition());
+ if (nvl(cft.getOpenBrackets()).length() > 0)
+ ncft.setOpenBrackets(cft.getOpenBrackets());
+ ncft.setExpression(cft.getExpression());
+ if (nvl(cft.getArgType()).length() > 0)
+ ncft.setArgType(cft.getArgType());
+ if (nvl(cft.getArgValue()).length() > 0)
+ ncft.setArgValue(cft.getArgValue());
+ if (nvl(cft.getCloseBrackets()).length() > 0)
+ ncft.setCloseBrackets(cft.getCloseBrackets());
+ if (nvl(cft.getComment()).length() > 0)
+ ncft.setComment(cft.getComment());
+
+ return ncft;
+ } // cloneColFilterType
+
+ public DataColumnType cloneDataColumnType(ObjectFactory objFactory, DataColumnType dct)
+ throws JAXBException {
+ DataColumnType ndct = objFactory.createDataColumnType();
+
+ ndct.setTableId(dct.getTableId());
+ ndct.setDbColName(dct.getDbColName());
+ if (nvl(dct.getCrossTabValue()).length() > 0)
+ ndct.setCrossTabValue(dct.getCrossTabValue());
+ ndct.setColName(dct.getColName());
+ ndct.setDisplayName(dct.getDisplayName());
+ if (dct.getDisplayWidth() > 0)
+ ndct.setDisplayWidth(dct.getDisplayWidth());
+ if (nvl(dct.getDisplayWidthInPxls()).length()>0)
+ ndct.setDisplayWidthInPxls(dct.getDisplayWidthInPxls());
+ if (nvl(dct.getDisplayAlignment()).length() > 0)
+ ndct.setDisplayAlignment(dct.getDisplayAlignment());
+ if (nvl(dct.getDisplayHeaderAlignment()).length() > 0)
+ ndct.setDisplayHeaderAlignment(dct.getDisplayHeaderAlignment());
+ ndct.setOrderSeq(dct.getOrderSeq());
+ ndct.setVisible(dct.isVisible());
+ ndct.setCalculated(dct.isCalculated());
+ ndct.setColType(dct.getColType());
+ if(dct.getColType().equals(AppConstants.CT_HYPERLINK)) {
+ ndct.setHyperlinkURL(dct.getHyperlinkURL());
+ ndct.setHyperlinkType(dct.getHyperlinkType());
+ if(dct.getHyperlinkType().equals("IMAGE")) {
+ ndct.setActionImg(dct.getActionImg());
+ }
+ }
+
+ if(dct.getIndentation()!=null) {
+ ndct.setIndentation(dct.getIndentation());
+ }
+
+ if (nvl(dct.getColFormat()).length() > 0)
+ ndct.setColFormat(dct.getColFormat());
+ ndct.setGroupBreak(dct.isGroupBreak());
+ ndct.setNowrap(dct.getNowrap());
+ if (nvl(dct.getYAxis()).length() > 0)
+ ndct.setYAxis(dct.getYAxis());
+ if (dct.getOrderBySeq()!=null && dct.getOrderBySeq() > 0)
+ ndct.setOrderBySeq(dct.getOrderBySeq());
+ if (nvl(dct.getOrderByAscDesc()).length() > 0)
+ ndct.setOrderByAscDesc(dct.getOrderByAscDesc());
+ if (nvl(dct.getDisplayTotal()).length() > 0)
+ ndct.setDisplayTotal(dct.getDisplayTotal());
+ if (nvl(dct.getColOnChart()).length() > 0)
+ ndct.setColOnChart(dct.getColOnChart());
+ if (dct.getChartSeq() !=null)
+ ndct.setChartSeq(dct.getChartSeq());
+ if (nvl(dct.getChartColor()).length() > 0)
+ ndct.setChartColor(dct.getChartColor());
+ if (nvl(dct.getChartLineType()).length() > 0)
+ ndct.setChartLineType(dct.getChartLineType());
+ ndct.setChartSeries((dct.isChartSeries()!=null && dct.isChartSeries().booleanValue())?true:false);
+ ndct.setIsRangeAxisFilled((dct.isIsRangeAxisFilled()!=null && dct.isIsRangeAxisFilled().booleanValue())?true:false);
+
+ if (dct.isCreateInNewChart()!=null)
+ ndct.setCreateInNewChart(dct.isCreateInNewChart());
+ if (nvl(dct.getDrillDownType()).length() > 0)
+ ndct.setDrillDownType(dct.getDrillDownType());
+ ndct.setDrillinPoPUp(dct.isDrillinPoPUp()!=null?dct.isDrillinPoPUp():false);
+ if (nvl(dct.getDrillDownURL()).length() > 0)
+ ndct.setDrillDownURL(dct.getDrillDownURL());
+ if (nvl(dct.getDrillDownParams()).length() > 0)
+ ndct.setDrillDownParams(dct.getDrillDownParams());
+ if (nvl(dct.getComment()).length() > 0)
+ ndct.setComment(dct.getComment());
+ if (nvl(dct.getDependsOnFormField()).length() > 0)
+ ndct.setDependsOnFormField(dct.getDependsOnFormField());
+ if (dct.getColFilterList() != null) {
+ ColFilterList colFilterList = objFactory.createColFilterList();
+ ndct.setColFilterList(colFilterList);
+
+ for (Iterator iter = dct.getColFilterList().getColFilter().iterator(); iter
+ .hasNext();)
+ colFilterList.getColFilter().add(
+ cloneColFilterType(objFactory, (ColFilterType) iter.next()));
+ } // if
+
+ if (nvl(dct.getSemaphoreId()).length() > 0)
+ ndct.setSemaphoreId(dct.getSemaphoreId());
+ if (nvl(dct.getDbColType()).length() > 0)
+ ndct.setDbColType(dct.getDbColType());
+ else {
+ ndct.setDbColType(dct.getColType());
+ adjustColumnType(ndct);
+ }
+ if (nvl(dct.getChartGroup()).length() > 0)
+ ndct.setChartGroup(dct.getChartGroup());
+
+ if (nvl(dct.getYAxis()).length() > 0)
+ ndct.setYAxis(dct.getYAxis());
+
+ if (nvl(dct.getDependsOnFormField()).length() > 0)
+ ndct.setDependsOnFormField(dct.getDependsOnFormField());
+
+
+
+ if(nvl(dct.getNowrap()).length() > 0)
+ ndct.setNowrap(dct.getNowrap());
+
+ if(dct.getIndentation()!=null) {
+ ndct.setIndentation(dct.getIndentation());
+ }
+
+ ndct.setEnhancedPagination((dct.isEnhancedPagination()!=null && dct.isEnhancedPagination().booleanValue())?true:false);
+ if(nvl(dct.getDataMiningCol()).length() > 0)
+ ndct.setDataMiningCol(dct.getDataMiningCol());
+
+ ndct.setColId(dct.getColId());
+
+ // ndct.setSemaphoreId(nvl(dct.getSemaphoreId()));
+ // if(nvl(dct.getDbColType()).length()>0)
+ // ndct.setDbColType(dct.getDbColType());
+ return ndct;
+ } // cloneDataColumnType
+
+ public DataSourceType cloneDataSourceType(ObjectFactory objFactory, DataSourceType dst)
+ throws JAXBException {
+ DataSourceType ndst = objFactory.createDataSourceType();
+
+ ndst.setTableName(dst.getTableName());
+ ndst.setTablePK(dst.getTablePK());
+ ndst.setDisplayName(dst.getDisplayName());
+ if (nvl(dst.getRefTableId()).length() > 0)
+ ndst.setRefTableId(dst.getRefTableId());
+ if (nvl(dst.getRefDefinition()).length() > 0)
+ ndst.setRefDefinition(dst.getRefDefinition());
+ if (nvl(dst.getComment()).length() > 0)
+ ndst.setComment(dst.getComment());
+ DataColumnList dataColumnList = objFactory.createDataColumnList();
+ ndst.setDataColumnList(dataColumnList);
+
+ for (Iterator iter = dst.getDataColumnList().getDataColumn().iterator(); iter
+ .hasNext();)
+ dataColumnList.getDataColumn().add(
+ cloneDataColumnType(objFactory, (DataColumnType) iter.next()));
+ ndst.setTableId(dst.getTableId());
+
+
+ return ndst;
+ } // cloneDataSourceType
+
+ public CustomReportType cloneCustomReport() throws RaptorException {
+ ObjectFactory objFactory = new ObjectFactory();
+ CustomReportType ncr = objFactory.createCustomReportType();
+
+ //CustomReport ncr = null;
+ try {
+ //ncr = (CustomReport) objFactory.createCustomReport(customReportType);
+ ncr.setReportName(cr.getReportName());
+ ncr.setReportDescr(cr.getReportDescr());
+ if (nvl(cr.getNumDashCols()).length() > 0)
+ ncr.setNumDashCols(cr.getNumDashCols());
+ if (nvl(cr.getDashboardLayoutHTML()).length() > 0)
+ ncr.setDashboardLayoutHTML(cr.getDashboardLayoutHTML());
+ if (nvl(cr.getDbInfo()).length() > 0)
+ ncr.setDbInfo(cr.getDbInfo());
+ ncr.setChartType(cr.getChartType());
+ if (nvl(cr.getChartTypeFixed()).length() > 0)
+ ncr.setChartTypeFixed(cr.getChartTypeFixed());
+ if (nvl(cr.getChartMultiSeries()).length() > 0)
+ ncr.setChartMultiSeries(cr.getChartMultiSeries());
+ if (nvl(cr.getChartLeftAxisLabel()).length() > 0)
+ ncr.setChartLeftAxisLabel(cr.getChartLeftAxisLabel());
+ if (nvl(cr.getChartRightAxisLabel()).length() > 0)
+ ncr.setChartRightAxisLabel(cr.getChartRightAxisLabel());
+ if (nvl(cr.getChartWidth()).length() > 0)
+ ncr.setChartWidth(cr.getChartWidth());
+ if (nvl(cr.getChartHeight()).length() > 0)
+ ncr.setChartHeight(cr.getChartHeight());
+ ncr.setShowChartTitle(cr.isShowChartTitle());
+ ncr.setPublic(cr.isPublic());
+ ncr.setHideFormFieldAfterRun(cr.isHideFormFieldAfterRun());
+ ncr.setCreateId(cr.getCreateId());
+ ncr.setCreateDate(cr.getCreateDate());
+ if (nvl(cr.getReportSQL()).length() > 0)
+ ncr.setReportSQL(cr.getReportSQL());
+ if (nvl(cr.getReportTitle()).length() > 0)
+ ncr.setReportTitle(cr.getReportTitle());
+ if (nvl(cr.getReportSubTitle()).length() > 0)
+ ncr.setReportSubTitle(cr.getReportSubTitle());
+ if (nvl(cr.getReportHeader()).length() > 0)
+ ncr.setReportHeader(cr.getReportHeader());
+ if (cr.getFrozenColumns()!=null)
+ ncr.setFrozenColumns(cr.getFrozenColumns());
+ if (nvl(cr.getPdfImgLogo()).length()>0)
+ ncr.setPdfImgLogo(cr.getPdfImgLogo());
+ if (nvl(cr.getEmptyMessage()).length()>0)
+ ncr.setEmptyMessage(cr.getEmptyMessage());
+ if (nvl(cr.getWidthNoColumn()).length()>0)
+ ncr.setWidthNoColumn(cr.getWidthNoColumn());
+ if (nvl(cr.getDataGridAlign()).length()>0)
+ ncr.setDataGridAlign(cr.getDataGridAlign());
+
+ if (nvl(cr.getReportFooter()).length() > 0)
+ ncr.setReportFooter(cr.getReportFooter());
+ if (nvl(cr.getNumFormCols()).length() > 0)
+ ncr.setNumFormCols(cr.getNumFormCols());
+ if (nvl(cr.getDisplayOptions()).length() > 0)
+ ncr.setDisplayOptions(cr.getDisplayOptions());
+ if (nvl(cr.getDataContainerHeight()).length() > 0)
+ ncr.setDataContainerHeight(cr.getDataContainerHeight());
+ if (nvl(cr.getDataContainerWidth()).length() > 0)
+ ncr.setDataContainerWidth(cr.getDataContainerWidth());
+ if (nvl(cr.getAllowSchedule()).length() > 0)
+ ncr.setAllowSchedule(cr.getAllowSchedule());
+ if (nvl(cr.getTopDown()).length() > 0)
+ ncr.setTopDown(cr.getTopDown());
+ if (nvl(cr.getSizedByContent()).length() > 0)
+ ncr.setSizedByContent(cr.getSizedByContent());
+ if (nvl(cr.getComment()).length() > 0)
+ ncr.setComment(cr.getComment());
+ if (nvl(cr.getDashboardOptions()).length()>0)
+ ncr.setDashboardOptions(cr.getDashboardOptions());
+
+ if(cr.isDashboardType()!=null)
+ ncr.setDashboardType(cr.isDashboardType());
+ if(cr.isReportInNewWindow()!=null)
+ ncr.setReportInNewWindow(cr.isReportInNewWindow());
+ ncr.setDisplayFolderTree(cr.isDisplayFolderTree());
+ if (cr.getDashBoardReports() == null) {
+ if (cr.getMaxRowsInExcelDownload()!=null && cr.getMaxRowsInExcelDownload()>0)
+ ncr.setMaxRowsInExcelDownload(cr.getMaxRowsInExcelDownload());
+ }
+
+ if (nvl(cr.getJavascriptElement()).length()>0)
+ ncr.setJavascriptElement(cr.getJavascriptElement());
+ if (nvl(cr.getFolderId()).length()>0)
+ ncr.setFolderId(cr.getFolderId());
+ ncr.setDrillURLInPoPUpPresent((cr.isDrillURLInPoPUpPresent()!=null && cr.isDrillURLInPoPUpPresent().booleanValue())?true:false);
+
+ if (nvl(cr.getIsOneTimeScheduleAllowed()).length()>0)
+ ncr.setIsOneTimeScheduleAllowed(cr.getIsOneTimeScheduleAllowed());
+ if (nvl(cr.getIsHourlyScheduleAllowed()).length()>0)
+ ncr.setIsHourlyScheduleAllowed(cr.getIsHourlyScheduleAllowed());
+ if (nvl(cr.getIsDailyScheduleAllowed()).length()>0)
+ ncr.setIsDailyScheduleAllowed(cr.getIsDailyScheduleAllowed());
+ if (nvl(cr.getIsDailyMFScheduleAllowed()).length()>0)
+ ncr.setIsDailyMFScheduleAllowed(cr.getIsDailyMFScheduleAllowed());
+ if (nvl(cr.getIsWeeklyScheduleAllowed()).length()>0)
+ ncr.setIsWeeklyScheduleAllowed(cr.getIsWeeklyScheduleAllowed());
+ if (nvl(cr.getIsMonthlyScheduleAllowed()).length()>0)
+ ncr.setIsMonthlyScheduleAllowed(cr.getIsMonthlyScheduleAllowed());
+
+ ncr.setPageSize(cr.getPageSize());
+ ncr.setReportType(cr.getReportType());
+
+
+ DataSourceList dataSourceList = objFactory.createDataSourceList();
+ ncr.setDataSourceList(dataSourceList);
+
+ for (Iterator iter = cr.getDataSourceList().getDataSource().iterator(); iter.hasNext();) {
+ dataSourceList.getDataSource().add(
+ cloneDataSourceType(objFactory, (DataSourceType) iter.next()));
+ }
+
+ if (cr.getFormFieldList() != null) {
+ FormFieldList formFieldList = objFactory.createFormFieldList();
+ ncr.setFormFieldList(formFieldList);
+ ncr.getFormFieldList().setComment(formFieldList.getComment());
+
+ for (Iterator iter = cr.getFormFieldList().getFormField().iterator(); iter
+ .hasNext();)
+ formFieldList.getFormField().add(
+ cloneFormFieldType(objFactory, (FormFieldType) iter.next()));
+ formFieldList.setComment(cr.getFormFieldList().getComment());
+ } // if
+
+ if (cr.getJavascriptList() != null) {
+ JavascriptList javascriptList = objFactory.createJavascriptList();
+ ncr.setJavascriptList(javascriptList);
+
+ for (Iterator iter = cr.getJavascriptList().getJavascriptItem().iterator(); iter
+ .hasNext();)
+ javascriptList.getJavascriptItem().add(
+ cloneJavascriptType(objFactory, (JavascriptItemType) iter.next()));
+ } // if
+
+ if (cr.getSemaphoreList() != null) {
+ SemaphoreList semaphoreList = objFactory.createSemaphoreList();
+ ncr.setSemaphoreList(semaphoreList);
+
+ for (Iterator iter = cr.getSemaphoreList().getSemaphore().iterator(); iter
+ .hasNext();) {
+ semaphoreList.getSemaphore().add(
+ cloneSemaphoreType(objFactory, (SemaphoreType) iter.next()));
+ }
+ } // if
+
+ if (nvl(cr.getDashboardOptions()).length()>0)
+ ncr.setDashboardOptions(cr.getDashboardOptions());
+ if(cr.isDashboardType()!=null)
+ ncr.setDashboardType(cr.isDashboardType());
+ if(cr.isReportInNewWindow()!=null)
+ ncr.setReportInNewWindow(cr.isReportInNewWindow());
+ ncr.setDisplayFolderTree(cr.isDisplayFolderTree());
+ if (cr.getDashBoardReports() == null) {
+ if (cr.getMaxRowsInExcelDownload()!=null && cr.getMaxRowsInExcelDownload()>0)
+ ncr.setMaxRowsInExcelDownload(cr.getMaxRowsInExcelDownload());
+ }
+
+ if (cr.getDashBoardReports() != null) {
+ DashboardReports dashboardReports = objFactory.createDashboardReports();
+ ncr.setDashBoardReports(dashboardReports);
+
+ for (Iterator iter = cr.getDashBoardReports().getReportsList().iterator(); iter
+ .hasNext();) {
+ dashboardReports.getReportsList().add(
+ cloneDashboardType(objFactory, (Reports) iter.next()));
+ }
+ } // if
+
+ if (cr.getChartAdditionalOptions() != null) {
+ ChartAdditionalOptions chartAdditionalOptions = objFactory.createChartAdditionalOptions();
+ if(nvl(cr.getChartAdditionalOptions().getChartMultiplePieOrder()).length()>0)
+ chartAdditionalOptions.setChartMultiplePieOrder(cr.getChartAdditionalOptions().getChartMultiplePieOrder());
+ if(nvl(cr.getChartAdditionalOptions().getChartMultiplePieLabelDisplay()).length()>0)
+ chartAdditionalOptions.setChartMultiplePieLabelDisplay(cr.getChartAdditionalOptions().getChartMultiplePieLabelDisplay());
+
+ if(nvl(cr.getChartAdditionalOptions().getChartOrientation()).length()>0)
+ chartAdditionalOptions.setChartOrientation(cr.getChartAdditionalOptions().getChartOrientation());
+ if(nvl(cr.getChartAdditionalOptions().getSecondaryChartRenderer()).length()>0)
+ chartAdditionalOptions.setSecondaryChartRenderer(cr.getChartAdditionalOptions().getSecondaryChartRenderer());
+
+ if(nvl(cr.getChartAdditionalOptions().getChartDisplay()).length()>0)
+ chartAdditionalOptions.setChartDisplay(cr.getChartAdditionalOptions().getChartDisplay());
+ if(nvl(cr.getChartAdditionalOptions().getHideToolTips()).length()>0)
+ chartAdditionalOptions.setHideToolTips(cr.getChartAdditionalOptions().getHideToolTips());
+ if(nvl(cr.getChartAdditionalOptions().getHidechartLegend()).length()>0)
+ chartAdditionalOptions.setHidechartLegend(cr.getChartAdditionalOptions().getHidechartLegend());
+ if(nvl(cr.getChartAdditionalOptions().getLegendPosition()).length()>0)
+ chartAdditionalOptions.setLegendPosition(cr.getChartAdditionalOptions().getLegendPosition());
+ if(nvl(cr.getChartAdditionalOptions().getLabelAngle()).length()>0)
+ chartAdditionalOptions.setLabelAngle(cr.getChartAdditionalOptions().getLabelAngle());
+
+ if(nvl(cr.getChartAdditionalOptions().getIntervalFromdate()).length()>0)
+ chartAdditionalOptions.setIntervalFromdate(cr.getChartAdditionalOptions().getIntervalFromdate());
+ if(nvl(cr.getChartAdditionalOptions().getIntervalTodate()).length()>0)
+ chartAdditionalOptions.setIntervalTodate(cr.getChartAdditionalOptions().getIntervalTodate());
+ if(nvl(cr.getChartAdditionalOptions().getIntervalLabel()).length()>0)
+ chartAdditionalOptions.setIntervalLabel(cr.getChartAdditionalOptions().getIntervalLabel());
+
+ if(nvl(cr.getChartAdditionalOptions().getLastSeriesALineChart()).length()>0)
+ chartAdditionalOptions.setLastSeriesALineChart(cr.getChartAdditionalOptions().getLastSeriesALineChart());
+ if(nvl(cr.getChartAdditionalOptions().getLastSeriesABarChart()).length()>0)
+ chartAdditionalOptions.setLastSeriesABarChart(cr.getChartAdditionalOptions().getLastSeriesABarChart());
+
+ if(nvl(cr.getChartAdditionalOptions().getMaxLabelsInDomainAxis()).length()>0)
+ chartAdditionalOptions.setMaxLabelsInDomainAxis(cr.getChartAdditionalOptions().getMaxLabelsInDomainAxis());
+ if(nvl(cr.getChartAdditionalOptions().getLinearRegression()).length()>0)
+ chartAdditionalOptions.setLinearRegression(cr.getChartAdditionalOptions().getLinearRegression());
+ if(nvl(cr.getChartAdditionalOptions().getLinearRegressionColor()).length()>0)
+ chartAdditionalOptions.setLinearRegressionColor(cr.getChartAdditionalOptions().getLinearRegressionColor());
+ if(nvl(cr.getChartAdditionalOptions().getExponentialRegressionColor()).length()>0)
+ chartAdditionalOptions.setExponentialRegressionColor(cr.getChartAdditionalOptions().getExponentialRegressionColor());
+ if(nvl(cr.getChartAdditionalOptions().getMaxRegression()).length()>0)
+ chartAdditionalOptions.setMaxRegression(cr.getChartAdditionalOptions().getMaxRegression());
+ if(nvl(cr.getChartAdditionalOptions().getRangeAxisUpperLimit()).length()>0)
+ chartAdditionalOptions.setRangeAxisUpperLimit(cr.getChartAdditionalOptions().getRangeAxisUpperLimit());
+ if(nvl(cr.getChartAdditionalOptions().getRangeAxisLowerLimit()).length()>0)
+ chartAdditionalOptions.setRangeAxisLowerLimit(cr.getChartAdditionalOptions().getRangeAxisLowerLimit());
+ if(nvl(cr.getChartAdditionalOptions().getOverlayItemValueOnStackBar()).length()>0)
+ chartAdditionalOptions.setOverlayItemValueOnStackBar(cr.getChartAdditionalOptions().getOverlayItemValueOnStackBar());
+ chartAdditionalOptions.setAnimate((cr.getChartAdditionalOptions().isAnimate()!=null && cr.getChartAdditionalOptions().isAnimate().booleanValue())?true:false);
+
+ if(nvl(cr.getChartAdditionalOptions().getKeepDomainAxisValueAsString()).length()>0)
+ chartAdditionalOptions.setKeepDomainAxisValueAsString(cr.getChartAdditionalOptions().getKeepDomainAxisValueAsString());
+
+
+ // Animate
+ chartAdditionalOptions.setAnimateAnimatedChart((cr.getChartAdditionalOptions().isAnimateAnimatedChart()!=null && cr.getChartAdditionalOptions().isAnimateAnimatedChart().booleanValue())?true:false);
+ chartAdditionalOptions.setStacked((cr.getChartAdditionalOptions().isStacked()!=null && cr.getChartAdditionalOptions().isStacked().booleanValue())?true:false);
+ chartAdditionalOptions.setBarControls((cr.getChartAdditionalOptions().isBarControls()!=null && cr.getChartAdditionalOptions().isBarControls().booleanValue())?true:false);
+ chartAdditionalOptions.setXAxisDateType((cr.getChartAdditionalOptions().isXAxisDateType()!=null && cr.getChartAdditionalOptions().isXAxisDateType().booleanValue())?true:false);
+ chartAdditionalOptions.setLessXaxisTickers((cr.getChartAdditionalOptions().isLessXaxisTickers()!=null && cr.getChartAdditionalOptions().isLessXaxisTickers().booleanValue())?true:false);
+ chartAdditionalOptions.setTimeAxis((cr.getChartAdditionalOptions().isTimeAxis()!=null && cr.getChartAdditionalOptions().isTimeAxis().booleanValue())?true:false);
+
+ if(nvl(cr.getChartAdditionalOptions().getTimeSeriesRender()).length()>0)
+ chartAdditionalOptions.setTimeSeriesRender(cr.getChartAdditionalOptions().getTimeSeriesRender());
+
+ chartAdditionalOptions.setMultiSeries((cr.getChartAdditionalOptions().isMultiSeries()!=null && cr.getChartAdditionalOptions().isMultiSeries().booleanValue())?true:false);
+
+ chartAdditionalOptions.setTopMargin(cr.getChartAdditionalOptions().getTopMargin()!=null?cr.getChartAdditionalOptions().getTopMargin():new Integer(30));
+ chartAdditionalOptions.setBottomMargin(cr.getChartAdditionalOptions().getBottomMargin()!=null?cr.getChartAdditionalOptions().getBottomMargin():new Integer(50));
+ chartAdditionalOptions.setLeftMargin(cr.getChartAdditionalOptions().getLeftMargin()!=null?cr.getChartAdditionalOptions().getLeftMargin():new Integer(100));
+ chartAdditionalOptions.setRightMargin(cr.getChartAdditionalOptions().getRightMargin()!=null?cr.getChartAdditionalOptions().getRightMargin():new Integer(60));
+
+
+ ncr.setChartAdditionalOptions(chartAdditionalOptions);
+ } // if
+
+ if (nvl(cr.getJavascriptElement()).length()>0)
+ ncr.setJavascriptElement(cr.getJavascriptElement());
+ if (nvl(cr.getFolderId()).length()>0)
+ ncr.setFolderId(cr.getFolderId());
+
+ if (cr.getChartDrillOptions() != null) {
+ ChartDrillOptions chartDrillOptions = objFactory.createChartDrillOptions();
+
+ if(nvl(cr.getChartDrillOptions().getDrillReportId()).length()>0)
+ chartDrillOptions.setDrillReportId(cr.getChartDrillOptions().getDrillReportId());
+
+ for (Iterator iter = cr.getChartDrillOptions().getTargetFormfield().iterator(); iter
+ .hasNext();) {
+ chartDrillOptions.getTargetFormfield().add(
+ cloneChartDrillFormfield(objFactory, (ChartDrillFormfield)iter.next()));
+
+ }
+
+ if(nvl(cr.getChartDrillOptions().getDrillXAxisFormField()).length()>0)
+ chartDrillOptions.setDrillXAxisFormField(cr.getChartDrillOptions().getDrillXAxisFormField());
+ if(nvl(cr.getChartDrillOptions().getDrillYAxisFormField()).length()>0)
+ chartDrillOptions.setDrillYAxisFormField(cr.getChartDrillOptions().getDrillYAxisFormField());
+ if(nvl(cr.getChartDrillOptions().getDrillSeriesFormField()).length()>0)
+ chartDrillOptions.setDrillSeriesFormField(cr.getChartDrillOptions().getDrillSeriesFormField());
+
+
+ ncr.setChartDrillOptions(chartDrillOptions);
+ }
+
+ if (nvl(cr.getIsOneTimeScheduleAllowed()).length()>0)
+ ncr.setIsOneTimeScheduleAllowed(cr.getIsOneTimeScheduleAllowed());
+ if (nvl(cr.getIsHourlyScheduleAllowed()).length()>0)
+ ncr.setIsHourlyScheduleAllowed(cr.getIsHourlyScheduleAllowed());
+ if (nvl(cr.getIsDailyScheduleAllowed()).length()>0)
+ ncr.setIsDailyScheduleAllowed(cr.getIsDailyScheduleAllowed());
+ if (nvl(cr.getIsDailyMFScheduleAllowed()).length()>0)
+ ncr.setIsDailyMFScheduleAllowed(cr.getIsDailyMFScheduleAllowed());
+ if (nvl(cr.getIsWeeklyScheduleAllowed()).length()>0)
+ ncr.setIsWeeklyScheduleAllowed(cr.getIsWeeklyScheduleAllowed());
+ if (nvl(cr.getIsMonthlyScheduleAllowed()).length()>0)
+ ncr.setIsMonthlyScheduleAllowed(cr.getIsMonthlyScheduleAllowed());
+
+ ncr.setPageSize(cr.getPageSize());
+ ncr.setReportType(cr.getReportType());
+
+ if (cr.getReportMap() != null){
+ ReportMap repMap = objFactory.createReportMap();
+ if(nvl(cr.getReportMap().getMarkerColor()).length()>0)
+ repMap.setMarkerColor(cr.getReportMap().getMarkerColor());
+ if(nvl(cr.getReportMap().getUseDefaultSize()).length()>0)
+ repMap.setUseDefaultSize(cr.getReportMap().getUseDefaultSize());
+ if(nvl(cr.getReportMap().getHeight()).length()>0)
+ repMap.setHeight(cr.getReportMap().getHeight());
+ if(nvl(cr.getReportMap().getWidth()).length()>0)
+ repMap.setWidth(cr.getReportMap().getWidth());
+ if(nvl(cr.getReportMap().getIsMapAllowedYN()).length()>0)
+ repMap.setIsMapAllowedYN(cr.getReportMap().getIsMapAllowedYN());
+ if(nvl(cr.getReportMap().getAddAddressInDataYN()).length()>0)
+ repMap.setAddAddressInDataYN(cr.getReportMap().getAddAddressInDataYN());
+ if(nvl(cr.getReportMap().getAddressColumn()).length()>0)
+ repMap.setAddressColumn(cr.getReportMap().getAddressColumn());
+ if(nvl(cr.getReportMap().getDataColumn()).length()>0)
+ repMap.setDataColumn(cr.getReportMap().getDataColumn());
+ if(nvl(cr.getReportMap().getDefaultMapType()).length()>0)
+ repMap.setDefaultMapType(cr.getReportMap().getDefaultMapType());
+ if(nvl(cr.getReportMap().getLatColumn()).length()>0)
+ repMap.setLatColumn(cr.getReportMap().getLatColumn());
+ if(nvl(cr.getReportMap().getLongColumn()).length()>0)
+ repMap.setLongColumn(cr.getReportMap().getLongColumn());
+ if(nvl(cr.getReportMap().getColorColumn()).length()>0)
+ repMap.setColorColumn(cr.getReportMap().getColorColumn());
+ if(nvl(cr.getReportMap().getLegendColumn()).length()>0)
+ repMap.setLegendColumn(cr.getReportMap().getLegendColumn());
+
+
+ for (Iterator iter = cr.getReportMap().getMarkers().iterator(); iter
+ .hasNext();) {
+ repMap.getMarkers().add(
+ cloneMarkerType(objFactory, (Marker)iter.next()));
+
+ }
+
+ ncr.setReportMap(repMap);
+ }
+
+
+
+ } catch (JAXBException ex) { // try
+ throw new RaptorException(ex.getMessage(), ex.getCause());
+ }
+
+ return ncr;
+ } // cloneCustomReport
+
+ /** ************************************************************************************************* */
+
+ public void printFormatType(FormatType ft) {
+ System.out.println("------------------------------------------------");
+ System.out.println("Semaphore Col Format");
+ System.out.println("------------------------------------------------");
+ System.out.println("FormatId: [" + ft.getFormatId() + "]");
+ System.out.println("LessThanValue: [" + ft.getLessThanValue() + "]");
+ System.out.println("Expression: [" + ft.getExpression() + "]");
+ System.out.println("Bold: [" + ft.isBold() + "]");
+ System.out.println("Italic: [" + ft.isItalic() + "]");
+ System.out.println("Underline: [" + ft.isUnderline() + "]");
+ System.out.println("BgColor: [" + ft.getBgColor() + "]");
+ System.out.println("FontColor: [" + ft.getFontColor() + "]");
+ System.out.println("FontFace: [" + ft.getFontFace() + "]");
+ System.out.println("FontSize: [" + ft.getFontSize() + "]");
+ System.out.println("Alignment: [" + ft.getAlignment() + "]");
+ System.out.println("Comment: [" + ft.getComment() + "]");
+ System.out.println("------------------------------------------------");
+ } // printFormatType
+
+ public void printSemaphoreType(SemaphoreType st) {
+ System.out.println("------------------------------------------------");
+ System.out.println("Semaphore");
+ System.out.println("------------------------------------------------");
+ System.out.println("SemaphoreId: [" + st.getSemaphoreId() + "]");
+ System.out.println("SemaphoreName: [" + st.getSemaphoreName() + "]");
+ System.out.println("SemaphoreType: [" + st.getSemaphoreType() + "]");
+ System.out.println("Comment: [" + st.getComment() + "]");
+
+ if (st.getFormatList() != null)
+ for (Iterator iter = st.getFormatList().getFormat().iterator(); iter.hasNext();)
+ printFormatType((FormatType) iter.next());
+
+ System.out.println("------------------------------------------------");
+ } // printSemaphoreType
+
+ public void printFormFieldType(FormFieldType fft) {
+ System.out.println("------------------------------------------------");
+ System.out.println("Form Field");
+ System.out.println("------------------------------------------------");
+ System.out.println("FieldId: [" + fft.getFieldId() + "]");
+ System.out.println("ColId: [" + fft.getColId() + "]");
+ System.out.println("FieldName: [" + fft.getFieldName() + "]");
+ System.out.println("FieldType: [" + fft.getFieldType() + "]");
+ System.out.println("ValidationType: [" + fft.getValidationType() + "]");
+ System.out.println("Mandatory: [" + fft.getMandatory() + "]");
+ System.out.println("DefaultValue: [" + fft.getDefaultValue() + "]");
+ System.out.println("OrderBySeq: [" + fft.getOrderBySeq() + "]");
+ System.out.println("FieldSQL: [" + fft.getFieldSQL() + "]");
+ System.out.println("Comment: [" + fft.getComment() + "]");
+ if (fft.getPredefinedValueList() != null)
+ for (Iterator iter = fft.getPredefinedValueList().getPredefinedValue().iterator(); iter
+ .hasNext();)
+ System.out.println("PredefinedValues: [" + ((String) iter.next()) + "]");
+
+ System.out.println("------------------------------------------------");
+ } // printFormFieldType
+
+ public void printColFilterType(ColFilterType cft) {
+ System.out.println("------------------------------------------------");
+ System.out.println("Col Filter");
+ System.out.println("------------------------------------------------");
+ System.out.println("ColId: [" + cft.getColId() + "]");
+ System.out.println("FilterSeq: [" + cft.getFilterSeq() + "]");
+ System.out.println("JoinCondition: [" + cft.getJoinCondition() + "]");
+ System.out.println("OpenBrackets: [" + cft.getOpenBrackets() + "]");
+ System.out.println("Expression: [" + cft.getExpression() + "]");
+ System.out.println("ArgType: [" + cft.getArgType() + "]");
+ System.out.println("ArgValue: [" + cft.getArgValue() + "]");
+ System.out.println("CloseBrackets: [" + cft.getCloseBrackets() + "]");
+ System.out.println("Comment: [" + cft.getComment() + "]");
+ System.out.println("------------------------------------------------");
+ } // printColFilterType
+
+ public void printDataColumnType(DataColumnType dct) {
+ System.out.println("------------------------------------------------");
+ System.out.println("Data Column");
+ System.out.println("------------------------------------------------");
+ System.out.println("ColId: [" + dct.getColId() + "]");
+ System.out.println("TableId: [" + dct.getTableId() + "]");
+ System.out.println("DbColName: [" + dct.getDbColName() + "]");
+ System.out.println("CrossTabValue: [" + dct.getCrossTabValue() + "]");
+ System.out.println("ColName: [" + dct.getColName() + "]");
+ System.out.println("DisplayName: [" + dct.getDisplayName() + "]");
+ System.out.println("DisplayWidth: [" + dct.getDisplayWidth() + "]");
+ System.out.println("DisplayAlignment: [" + dct.getDisplayAlignment() + "]");
+ System.out.println("DisplayHeaderAlignment: [" + dct.getDisplayHeaderAlignment() + "]");
+ System.out.println("OrderSeq(): [" + dct.getOrderSeq() + "]");
+ System.out.println("Visible: [" + dct.isVisible() + "]");
+ System.out.println("Calculated: [" + dct.isCalculated() + "]");
+ System.out.println("ColType: [" + dct.getColType() + "]");
+ System.out.println("ColFormat: [" + dct.getColFormat() + "]");
+ System.out.println("GroupBreak: [" + dct.isGroupBreak() + "]");
+ System.out.println("OrderBySeq: [" + dct.getOrderBySeq() + "]");
+ System.out.println("OrderByAscDesc: [" + dct.getOrderByAscDesc() + "]");
+ System.out.println("DisplayTotal: [" + dct.getDisplayTotal() + "]");
+ System.out.println("ColOnChart: [" + dct.getColOnChart() + "]");
+ System.out.println("ChartSeq: [" + dct.getChartSeq() + "]");
+ System.out.println("ChartColor: [" + dct.getChartColor() + "]");
+ System.out.println("DrillDownType: [" + dct.getDrillDownType() + "]");
+ System.out.println("DrillDownURL: [" + dct.getDrillDownURL() + "]");
+ System.out.println("DrillDownParams: [" + dct.getDrillDownParams() + "]");
+ System.out.println("Comment: [" + dct.getComment() + "]");
+
+ if (dct.getColFilterList() != null)
+ for (Iterator iter = dct.getColFilterList().getColFilter().iterator(); iter
+ .hasNext();)
+ printColFilterType((ColFilterType) iter.next());
+
+ System.out.println("SemaphoreId: [" + dct.getSemaphoreId() + "]");
+ System.out.println("DbColType: [" + dct.getDbColType() + "]");
+ System.out.println("------------------------------------------------");
+ } // printDataColumnType
+
+ public void printDataSourceType(DataSourceType dst) {
+ System.out.println("------------------------------------------------");
+ System.out.println("Data Source");
+ System.out.println("------------------------------------------------");
+ System.out.println("TableId: [" + dst.getTableId() + "]");
+ System.out.println("TableName: [" + dst.getTableName() + "]");
+ System.out.println("TablePK: [" + dst.getTablePK() + "]");
+ System.out.println("DisplayName: [" + dst.getDisplayName() + "]");
+ System.out.println("RefTableId: [" + dst.getRefTableId() + "]");
+ System.out.println("RefDefinition: [" + dst.getRefDefinition() + "]");
+ System.out.println("Comment: [" + dst.getComment() + "]");
+
+ for (Iterator iter = dst.getDataColumnList().getDataColumn().iterator(); iter
+ .hasNext();)
+ printDataColumnType((DataColumnType) iter.next());
+
+ System.out.println("------------------------------------------------");
+ } // printDataSourceType
+
+ public void print() {
+ System.out.println("------------------------------------------------");
+ System.out.println("ReportWrapper object");
+ System.out.println("------------------------------------------------");
+ System.out.println("PageSize: [" + getPageSize() + "]");
+ System.out.println("ReportType: [" + getReportType() + "]");
+ System.out.println("ReportName: [" + getReportName() + "]");
+ System.out.println("ReportDescr: [" + getReportDescr() + "]");
+ System.out.println("ChartType: [" + getChartType() + "]");
+ System.out.println("ChartTypeFixed: [" + getChartTypeFixed() + "]");
+ //System.out.println("ChartLeftAxisLabel: [" + getChartLeftAxisLabel() + "]");
+ //System.out.println("ChartRightAxisLabel: [" + getChartRightAxisLabel() + "]");
+ System.out.println("ChartWidth: [" + getChartWidth() + "]");
+ System.out.println("ChartHeight: [" + getChartHeight() + "]");
+ System.out.println("Public: [" + isPublic() + "]");
+ System.out.println("CreateId: NOT USED ANYMORE[" + /* getCreateId()+ */"]");
+ System.out.println("CreateDate: NOT USED ANYMORE[" + /* getCreateDate()+ */"]");
+ System.out.println("ReportSQL: [" + getReportSQL() + "]");
+ System.out.println("ReportTitle: [" + getReportTitle() + "]");
+ System.out.println("DbInfo: [" + getDBInfo() + "]");
+ System.out.println("ReportSubTitle: [" + getReportSubTitle() + "]");
+ System.out.println("ReportHeader: [" + getReportHeader() + "]");
+ System.out.println("ReportFooter: [" + getReportFooter() + "]");
+ System.out.println("NumFormCols: [" + getNumFormCols() + "]");
+ System.out.println("DisplayOptions: [" + getDisplayOptions() + "]");
+ System.out.println("Comment: [" + getComment() + "]");
+
+ for (Iterator iter = cr.getDataSourceList().getDataSource().iterator(); iter.hasNext();)
+ printDataSourceType((DataSourceType) iter.next());
+
+ if (cr.getFormFieldList() != null)
+ for (Iterator iter = cr.getFormFieldList().getFormField().iterator(); iter
+ .hasNext();)
+ printFormFieldType((FormFieldType) iter.next());
+
+ if (cr.getSemaphoreList() != null)
+ for (Iterator iter = cr.getSemaphoreList().getSemaphore().iterator(); iter
+ .hasNext();)
+ printSemaphoreType((SemaphoreType) iter.next());
+
+ System.out.println("------------------------------------------------");
+ System.out.println("ReportWrapper object end");
+ System.out.println("------------------------------------------------");
+ } // print
+
+ private int getIntValue(String value, int defaultValue) {
+ int iValue = defaultValue;
+ try {
+ iValue = Integer.parseInt(value);
+ } catch (Exception e) {
+ }
+
+ return iValue;
+ } // getIntValue
+ public static String replaceNewLine( String strSource, String strFind, String chrReplace )
+ {
+ // buffer to hold the target string after replacement is done.
+ StringBuffer sbfTemp = new StringBuffer();
+
+ try
+ {
+ // for each occurrence of strFind in strSource, replace it with chrReplace.
+ int intIndex = strSource.indexOf( strFind, 0 );
+
+ // check if there is any instace of strFind in strSource
+ if( intIndex >= 0 )
+ {
+ // holds the index from where the search is supposed to happen.
+ int intStart = 0;
+
+ // size of the source string
+ int intTotalSize = strSource.length();
+
+ while( intStart < intTotalSize &&
+ ( ( intIndex = strSource.indexOf( strFind, intStart ) ) >= 0 ) )
+ {
+ // check if strFind is at the beginning... i.e., at index intStart
+ if( intIndex == intStart )
+ {
+ /*
+ * starts with strFind...just append chrReplace
+ * to the target
+ */
+ sbfTemp.append( chrReplace );
+ }
+ else
+ {
+ // append the sub-string...plus chrReplace
+ sbfTemp.append( strSource.substring( intStart, intIndex ) );
+ sbfTemp.append( chrReplace );
+ }
+
+ // advance string index
+ intStart = intIndex + strFind.length();
+ }
+
+ // append the last portion of the source string.
+ sbfTemp.append( strSource.substring( intStart ) );
+ }
+ else
+ {
+ // strFind not found... just copy the text as it is.
+ sbfTemp.append( strSource );
+ }
+ }
+ catch( Exception expGeneral )
+ {
+ // in case of any exception, return the source string as it is.
+ sbfTemp = new StringBuffer( strSource );
+ }
+
+ return sbfTemp.toString();
+ }
+
+ /*folder id*/
+ public String getFolderId() {
+ return nvl(cr.getFolderId()).length()>0?cr.getFolderId():"NULL";
+ }
+ public void setFolderId(String folderId ) {
+ cr.setFolderId(folderId);
+ }
+
+ public String addZero(String num) {
+ int numInt = 0;
+ try {
+ numInt = Integer.parseInt(num);
+ }catch(NumberFormatException ex){
+ numInt = 0;
+ }
+ if(numInt < 10) return "0"+numInt;
+ else return ""+numInt;
+ }
+
+ public String getIsDailyMFScheduleAllowed() {
+ return cr.getIsDailyMFScheduleAllowed();
+ }
+
+ public void setIsDailyMFScheduleAllowed(String isDailyMFScheduleAllowed) {
+ cr.setIsDailyMFScheduleAllowed(isDailyMFScheduleAllowed);
+ }
+
+ public String getIsDailyScheduleAllowed() {
+ return cr.getIsDailyScheduleAllowed();
+ }
+
+ public void setIsDailyScheduleAllowed(String isDailyScheduleAllowed) {
+ cr.setIsDailyScheduleAllowed(isDailyScheduleAllowed);
+ }
+
+ public String getIsHourlyScheduleAllowed() {
+ return cr.getIsHourlyScheduleAllowed();
+ }
+
+ public void setIsHourlyScheduleAllowed(String isHourlyScheduleAllowed) {
+ cr.setIsHourlyScheduleAllowed(isHourlyScheduleAllowed);
+ }
+
+ public String getIsMonthlyScheduleAllowed() {
+ return cr.getIsMonthlyScheduleAllowed();
+ }
+
+ public void setIsMonthlyScheduleAllowed(String isMonthlyScheduleAllowed) {
+ cr.setIsMonthlyScheduleAllowed(isMonthlyScheduleAllowed);
+ }
+
+ public String getIsOneTimeScheduleAllowed() {
+ return cr.getIsOneTimeScheduleAllowed();
+ }
+
+ public void setIsOneTimeScheduleAllowed(String isOneTimeScheduleAllowed) {
+ cr.setIsOneTimeScheduleAllowed(isOneTimeScheduleAllowed);
+ }
+
+ public String getIsWeeklyScheduleAllowed() {
+ return cr.getIsWeeklyScheduleAllowed();
+ }
+
+ public void setIsWeeklyScheduleAllowed(String isWeeklyScheduleAllowed) {
+ cr.setIsWeeklyScheduleAllowed(isWeeklyScheduleAllowed);
+
+ }
+
+ public static boolean isNull(String a) {
+ if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null"))
+ return true;
+ else
+ return false;
+ }
+
+ public int getDependsOnFormFieldFlag(DataColumnType dc, HashMap formValues) {
+ int flag = 0;
+ String fieldValue = "";
+ if(nvl(dc.getDependsOnFormField()).length()>0 && nvl(dc.getDependsOnFormField()).indexOf("[")!=-1) {
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for(Iterator iter1 = set.iterator(); iter1.hasNext(); ) {
+ Map.Entry entry = (Entry) iter1.next();
+ value = (String) entry.getValue();
+ if (dc.getDependsOnFormField().equals("["+entry.getKey()+"]")) {
+ fieldValue = nvl(value);
+
+ if (fieldValue.length()>0 && !fieldValue.equals("NULL")) {
+ flag = 0;
+ } else {
+ flag = 1;
+ }
+
+ }
+ }
+ }
+ }
+
+ return flag;
+ }
+
+ /* Datamining Getter Setter */
+
+ public String getClassifier() {
+ return (cr.getDataminingOptions()!=null?cr.getDataminingOptions().getClassifier():"");
+ }
+
+ public void setClassifier( String classifier) {
+ cr.getDataminingOptions().setClassifier(classifier);
+ }
+
+
+ public int getForecastingPeriod() {
+ return (cr.getDataminingOptions()!=null? new Integer(cr.getDataminingOptions().getForecastingUnits()).intValue():-1);
+ }
+
+ public void setForecastingPeriod( String period) {
+ cr.getDataminingOptions().setForecastingUnits(period);
+ }
+
+ public String getForecastingTimeFormat() {
+ return (cr.getDataminingOptions()!=null?cr.getDataminingOptions().getTimeformat():"");
+ }
+
+ public void setForecastingTimeFormat( String format) {
+ cr.getDataminingOptions().setTimeformat(format);
+ }
+
+ /**
+ * Get Number of Columns to Frozen in Data Grid
+ */
+
+ public int getFrozenColumns() {
+ return cr.getFrozenColumns()==null?0:cr.getFrozenColumns();
+ }
+
+ public String getFrozenColumnId() {
+ int noOfColumns = cr.getFrozenColumns()==null?0:cr.getFrozenColumns();
+ if(noOfColumns != 0) {
+ List reportCols = getOnlyVisibleColumns();
+ int colIdx = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ ++colIdx;
+ DataColumnType dc = (DataColumnType) iter.next();
+ if(colIdx == noOfColumns) {
+
+ return dc.getColId();
+ } else continue;
+ } // for
+ return "";
+ } else return "";
+
+ }
+
+ /**
+ * Set Number of Columns to Frozen in Data Grid
+ */
+
+ public void setFrozenColumns( int frozenColumns) {
+ cr.setFrozenColumns(frozenColumns);
+ }
+
+ /**
+ * @return the reportSQLWithRowNum for ZK Support
+ */
+ public String getReportSQLWithRowNum() {
+ return reportSQLWithRowNum;
+ }
+
+ /**
+ * @param reportSQLWithRowNum the reportSQLWithRowNum to set for ZK Support
+ */
+ public void setReportSQLWithRowNum(String reportSQLWithRowNum) {
+ this.reportSQLWithRowNum = reportSQLWithRowNum;
+ }
+
+ //used for Zk sort
+ public void setReportSQLOnlyFirstPart(String reportSQLOnlyFirstPart) {
+ this.reportSQLOnlyFirstPart = reportSQLOnlyFirstPart;
+ }
+
+ public String getReportSQLOnlyFirstPart() {
+ return this.reportSQLOnlyFirstPart;
+ }
+
+ public String getTemplateFile() throws RaptorException {
+ return ReportLoader.getTemplateFile(getReportID());
+ }
+
+ public String getPdfImg() {
+ return cr.getPdfImgLogo();
+ }
+
+
+ public String getEmptyMessage() {
+ String emptyMessage = cr.getEmptyMessage();
+ if(nvl(emptyMessage).length()<=0)
+ emptyMessage = Globals.getReportEmptyMessage();
+ return emptyMessage;
+ }
+
+ public void setPdfImg(String img_loc) {
+ cr.setPdfImgLogo(img_loc);
+ }
+
+ public void setEmptyMessage(String emptyMessage) {
+ cr.setEmptyMessage(emptyMessage);
+ }
+
+ public void setDrillReportIdForChart(String reportId) {
+ //(cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().setDrillReportId():"";
+ cr.getChartDrillOptions().setDrillReportId(reportId);
+ }
+
+ public String getDrillReportIdForChart() {
+ return (cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().getDrillReportId():"";
+ }
+
+ public void setDrillXAxisFormField(String formField) {
+ //(cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().setDrillReportId():"";
+ cr.getChartDrillOptions().setDrillXAxisFormField(formField);
+ }
+
+ public String getDrillXAxisFormField() {
+ return (cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().getDrillXAxisFormField():"";
+ }
+
+ public void setDrillYAxisFormField(String formField) {
+ //(cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().setDrillReportId():"";
+ cr.getChartDrillOptions().setDrillYAxisFormField(formField);
+ }
+
+ public String getDrillYAxisFormField() {
+ return (cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().getDrillYAxisFormField():"";
+ }
+
+ public void setDrillSeriesFormField(String formField) {
+ //(cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().setDrillReportId():"";
+ cr.getChartDrillOptions().setDrillSeriesFormField(formField);
+ }
+
+ public String getDrillSeriesFormField() {
+ return (cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().getDrillSeriesFormField():"";
+ }
+
+ public boolean isEnhancedPaginationNeeded() {
+ List reportCols = getAllColumns();
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (dc.isEnhancedPagination()!=null && dc.isEnhancedPagination().booleanValue())
+ return true;
+ } // for
+ return false;
+ }
+
+ public DataColumnType getColumnWhichNeedEnhancedPagination() {
+ List reportCols = getAllColumns();
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (dc.isEnhancedPagination()!=null && dc.isEnhancedPagination().booleanValue())
+ return dc;
+ } // for
+ return null;
+ }
+
+ public void setDataGridAlign(String align) {
+ cr.setDataGridAlign(align);
+ }
+
+
+ public String getDataGridAlign() {
+ return (cr.getDataGridAlign()!=null)?cr.getDataGridAlign():"left";
+ }
+
+ public void setWidthNoColumn(String width) {
+ cr.setWidthNoColumn(width);
+ }
+
+
+ public String getWidthNoColumn() {
+ return (cr.getWidthNoColumn()!=null)?cr.getWidthNoColumn():"30px";
+ }
+
+ public void setWholeSQL(String sql) {
+ wholeSQL = sql;
+ }
+ public String getWholeSQL() {
+ return wholeSQL;
+ }
+
+} // ReportWrapper
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DBColumnInfo.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DBColumnInfo.java
new file mode 100644
index 00000000..4496fdca
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DBColumnInfo.java
@@ -0,0 +1,76 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+public class DBColumnInfo extends RaptorObject {
+ private String tableName = null;
+
+ private String colName = null;
+
+ private String colType = null;
+
+ private String label = null;
+
+ // public DBColumnInfo() {}
+
+ public DBColumnInfo(String tableName, String colName, String colType, String label) {
+ super();
+
+ setTableName(tableName);
+ setColName(colName);
+ setColType(colType);
+ setLabel(label);
+ } // DBColumnInfo
+
+ public String getTableName() {
+ return tableName;
+ }
+
+ public String getColName() {
+ return colName;
+ }
+
+ public String getColType() {
+ return colType;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ private void setTableName(String tableName) {
+ this.tableName = tableName;
+ }
+
+ private void setColName(String colName) {
+ this.colName = colName;
+ }
+
+ private void setColType(String colType) {
+ this.colType = colType;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+} // DBColumnInfo
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DrillDownParamDef.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DrillDownParamDef.java
new file mode 100644
index 00000000..8972e54a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DrillDownParamDef.java
@@ -0,0 +1,111 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+public class DrillDownParamDef extends RaptorObject {
+ private String fieldName = "";
+
+ private String valType = "0";
+
+ private String valValue = "";
+
+ private String valColId = "";
+
+ private String valFieldId = "";
+
+ public DrillDownParamDef(String drillDownParamStr) {
+ super();
+
+ drillDownParamStr = nvl(drillDownParamStr).trim();
+ if (drillDownParamStr.indexOf('=') >= 0) {
+ fieldName = drillDownParamStr.substring(0, drillDownParamStr.indexOf('='));
+
+ if (drillDownParamStr.length() > drillDownParamStr.indexOf('=') + 2
+ && drillDownParamStr.charAt(drillDownParamStr.indexOf('=') + 1) == '['
+ && drillDownParamStr.charAt(drillDownParamStr.length() - 1) == ']') {
+ drillDownParamStr = drillDownParamStr.substring(
+ drillDownParamStr.indexOf('=') + 2, drillDownParamStr.length() - 1);
+
+ if (drillDownParamStr.indexOf('!') < 0)
+ valColId = drillDownParamStr;
+ else if (drillDownParamStr.indexOf('!') == 0)
+ valFieldId = drillDownParamStr.substring(1);
+ else {
+ valColId = drillDownParamStr.substring(0, drillDownParamStr.indexOf('!'));
+ valFieldId = drillDownParamStr
+ .substring(drillDownParamStr.indexOf('!') + 1);
+ } // else
+
+ if (valColId.length() > 0 && valFieldId.length() > 0)
+ valType = "4";
+ else if (valFieldId.length() > 0)
+ valType = "3";
+ else if (valColId.length() > 0)
+ valType = "2";
+ } else {
+ valType = "1";
+ valValue = drillDownParamStr.substring(drillDownParamStr.indexOf('=') + 1);
+ } // else
+ } // if
+ } // DrillDownParamDef
+
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ public String getValType() {
+ return valType;
+ }
+
+ public String getValValue() {
+ return valValue;
+ }
+
+ public String getValColId() {
+ return valColId;
+ }
+
+ public String getValFieldId() {
+ return valFieldId;
+ }
+
+ private void setFieldName(String fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ private void setValType(String valType) {
+ this.valType = valType;
+ }
+
+ private void setValValue(String valValue) {
+ this.valValue = valValue;
+ }
+
+ private void setValColId(String valColId) {
+ this.valColId = valColId;
+ }
+
+ private void setValFieldId(String valFieldId) {
+ this.valFieldId = valFieldId;
+ }
+
+} // DrillDownParamDef
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/Marker.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/Marker.java
new file mode 100644
index 00000000..a9d9be85
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/Marker.java
@@ -0,0 +1,79 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+public class Marker extends RaptorObject {
+ String markerColor = "";
+ String addressColumn = "";
+ String dataColumn = "";
+ String address = "";
+ String data = "";
+ String color = "";
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public void setColor(String color) {
+ this.color = color;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ public Marker(String markerColor, String addressColumn, String dataColumn){
+ this.setMarkerColor(markerColor);
+ this.setAddressColumn(addressColumn);
+ this.setDataColumn(dataColumn);
+ }
+
+ public String getAddressColumn() {
+ return addressColumn;
+ }
+ public void setAddressColumn(String addressColumn) {
+ this.addressColumn = addressColumn;
+ }
+ public String getDataColumn() {
+ return dataColumn;
+ }
+ public void setDataColumn(String dataColumn) {
+ this.dataColumn = dataColumn;
+ }
+ public String getMarkerColor() {
+ return markerColor;
+ }
+ public void setMarkerColor(String markerColor) {
+ this.markerColor = markerColor;
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportDefinition.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportDefinition.java
new file mode 100644
index 00000000..71ec9f87
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportDefinition.java
@@ -0,0 +1,1465 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.bind.JAXBException;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+//import javax.xml.transform.stream.*;
+
+import org.openecomp.portalsdk.analytics.controller.WizardSequence;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceCrossTab;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceDashboard;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceLinear;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceSQLBasedCrossTab;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceSQLBasedHive;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceSQLBasedLinear;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceSQLBasedLinearDatamining;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.model.DataCache;
+import org.openecomp.portalsdk.analytics.model.ReportLoader;
+import org.openecomp.portalsdk.analytics.model.base.OrderBySeqComparator;
+import org.openecomp.portalsdk.analytics.model.base.OrderSeqComparator;
+import org.openecomp.portalsdk.analytics.model.base.ReportWrapper;
+import org.openecomp.portalsdk.analytics.model.runtime.FormField;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.xmlobj.ChartAdditionalOptions;
+import org.openecomp.portalsdk.analytics.xmlobj.ChartDrillOptions;
+import org.openecomp.portalsdk.analytics.xmlobj.ColFilterType;
+import org.openecomp.portalsdk.analytics.xmlobj.CustomReportType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnList;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataSourceType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataminingOptions;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldList;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormatList;
+import org.openecomp.portalsdk.analytics.xmlobj.FormatType;
+import org.openecomp.portalsdk.analytics.xmlobj.JavascriptItemType;
+import org.openecomp.portalsdk.analytics.xmlobj.ObjectFactory;
+import org.openecomp.portalsdk.analytics.xmlobj.PredefinedValueList;
+import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType;
+import org.openecomp.portalsdk.core.controller.FavoritesController;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+/**<HR/>
+ * This class is part of <B><I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I></B><BR/>
+ * <HR/>
+ *
+ * --------------------------------------------------------------------------------------------------<BR/>
+ * <B>ReportDefinition.java</B> - This involves in creating and modifying RAPTOR reports.
+ * --------------------------------------------------------------------------------------------------<BR/>
+ *
+ *
+ * <U>Change Log</U><BR/><BR/>
+ *
+ * 18-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> request Object is passed to prevent caching user/roles - Datamining/Hosting. </LI></UL>
+ * 27-Jul-2009 : Version 8.4 (Sundar); <UL><LI>userIsAuthorizedToSeeLog is checked for Admin User instead of Super User.</LI></UL>
+ * 22-Jun-2009 : Version 8.4 (Sundar); <UL><LI>A new type ChartAdditionalOptions is introduced in RAPTOR XSD.
+ * For this type a create procedure is added to this class.</LI></UL>
+ *
+ */
+
+public class ReportDefinition extends ReportWrapper implements Serializable {
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FavoritesController.class);
+
+
+ private ReportSchedule reportSchedule = null;
+
+ private WizardSequence wizardSequence = null;
+
+
+ private boolean reportUpdateLogged = false; // Used to avoid multiple
+ // entries in the report log
+ // when persisting report on
+ // each step
+
+ private ReportDefinition(CustomReportType crType, String reportID, String ownerID,
+ String createID, String createDate, String updateID, String updateDate,
+ String menuID, boolean menuApproved, HttpServletRequest request) throws RaptorException {
+ super(crType, reportID, ownerID, createID, createDate, updateID, updateDate, menuID,
+ menuApproved);
+ if(reportID.equals("-1"))
+ reportSchedule = new ReportSchedule(getReportID(), getOwnerID(), false, request);
+ else
+ reportSchedule = new ReportSchedule(getReportID(), getOwnerID(), true, request);
+ generateWizardSequence(null);
+ } // ReportDefinition
+
+ public ReportDefinition(ReportWrapper rw, HttpServletRequest request)throws RaptorException {
+ super(rw);
+
+ reportSchedule = new ReportSchedule(reportID, rw.getOwnerID(),false, request);
+ generateWizardSequence(null);
+ } // ReportDefinition
+
+ private void setReportID(String reportID) {
+ this.reportID = reportID;
+ reportSchedule.setReportID(reportID);
+ reportSchedule.setScheduleUserID(getOwnerID());
+ } // setReportID
+
+ public ReportSchedule getReportSchedule() {
+ return reportSchedule;
+ }
+
+ public static ReportDefinition unmarshal(String reportXML, String reportID, HttpServletRequest request)
+ throws RaptorException {
+ ReportDefinition rn = null;
+ CustomReportType crType = ReportWrapper.unmarshalCR(reportXML);
+ //Log.write("Report [" + reportID + "]: XML unmarshalled", 4);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Report [" + reportID + "]: XML unmarshalled"));
+
+ rn = new ReportDefinition(crType, reportID, null, null, null, null, null, null, false, request);
+ return rn;
+ } // unmarshal
+
+ public static ReportDefinition createBlank(HttpServletRequest request) throws RaptorException {
+ String curTime = Utils.getCurrentDateTime();
+ String userID = AppUtils.getUserID(request);
+ ReportDefinition rd = new ReportDefinition(ReportWrapper.createBlankCR(userID), "-1",
+ userID, userID, curTime, userID, curTime, "", false, request);
+
+ // Necessary initialization
+
+ return rd;
+ } // ReportDefinition
+
+ public void setAsCopy(HttpServletRequest request) throws RaptorException {
+ verifySQLBasedReportAccess(request);
+
+ replaceCustomReportWithClone();
+
+ setReportID("-1");
+ setReportName("Copy: " + getReportName());
+ } // setAsCopy
+
+ public WizardSequence getWizardSequence() {
+ return wizardSequence;
+ } // getWizardSequence
+
+ public void generateWizardSequence(HttpServletRequest request) throws RaptorException {
+ boolean userIsAuthorizedToSeeLog = false;
+ String userId = null;
+ if(request!=null) {
+ userId = AppUtils.getUserID(request);
+ if (userId != null)
+ userIsAuthorizedToSeeLog = AppUtils.isAdminUser(request)
+ || AppUtils.isAdminUser(request);
+ //System.out.println("******** Report Type "+getReportType() + " userIsAuthorizedToSeeLog " + userIsAuthorizedToSeeLog);
+ }
+ if (getReportType().equals(AppConstants.RT_LINEAR)){
+ if (getReportDefType().equals(AppConstants.RD_SQL_BASED))
+ wizardSequence = new WizardSequenceSQLBasedLinear(userIsAuthorizedToSeeLog);
+ else if (getReportDefType().equals(AppConstants.RD_SQL_BASED_DATAMIN))
+ wizardSequence = new WizardSequenceSQLBasedLinearDatamining(userIsAuthorizedToSeeLog);
+ else
+ wizardSequence = new WizardSequenceLinear(userIsAuthorizedToSeeLog);
+ } else if (getReportType().equals(AppConstants.RT_CROSSTAB)) {
+ if (getReportDefType().equals(AppConstants.RD_SQL_BASED))
+ wizardSequence = new WizardSequenceSQLBasedCrossTab(userIsAuthorizedToSeeLog);
+ else
+ wizardSequence = new WizardSequenceCrossTab(userIsAuthorizedToSeeLog);
+ } else if (getReportType().equals(AppConstants.RT_DASHBOARD)) {
+ wizardSequence = new WizardSequenceDashboard(userIsAuthorizedToSeeLog);
+ } else if (getReportType().equals(AppConstants.RT_HIVE)) {
+ wizardSequence = new WizardSequenceSQLBasedHive(userIsAuthorizedToSeeLog);
+ } else
+ wizardSequence = new WizardSequence();
+ } // generateWizardSequence
+
+ private boolean canPersistDashboard() {
+ //System.out.println(" getDashBoardReports().getReportsList().size() " + getDashBoardReports().getReportsList().size());
+ /* Commented for New DashBoard
+ if (getDashBoardReports()!=null && getDashBoardReports().getReportsList()!=null && getDashBoardReports().getReportsList().size() > 0) {
+ for (Iterator iter = getDashBoardReports().getReportsList().iterator(); iter.hasNext();) {
+ Reports report = (Reports)iter.next();
+ try {
+ if(Integer.parseInt(report.getReportId())>0) return true;
+ } catch (NumberFormatException ex) {}
+ } // for
+ } //if
+ */
+
+ //if( )
+ return nvl(getDashboardLayoutHTML()).length() > 0;
+ } //canPersistDashboard
+
+ private boolean canPersistLinearReport() {
+ boolean visibleColExist = false;
+
+ if (getDataSourceList().getDataSource().size() > 0) {
+ for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if (dct.isVisible()) {
+ visibleColExist = true;
+ break;
+ }
+ } // for
+ } // if
+
+ return visibleColExist;
+ } // canPersistLinearReport
+
+ private boolean canPersistCrossTabReport() {
+ boolean rowColExist = false;
+ boolean colColExist = false;
+ boolean valColExist = false;
+
+ if (getDataSourceList().getDataSource().size() > 0) {
+ for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_ROW))
+ rowColExist = true;
+ if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_COLUMN))
+ colColExist = true;
+ if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_VALUE))
+ valColExist = true;
+ } // for
+ } // if
+
+ return rowColExist && colColExist && valColExist;
+ } // canPersistCrossTabReport
+
+ private boolean canPersistReport() {
+ return getReportType().equals(AppConstants.RT_CROSSTAB) ? canPersistCrossTabReport()
+ : (getReportType().equals(AppConstants.RT_LINEAR)? canPersistLinearReport():((getReportType().equals(AppConstants.RT_HIVE)? canPersistLinearReport():canPersistDashboard())));
+ } // canPersistReport
+
+ public void persistReport(HttpServletRequest request) throws RaptorException {
+ if (!canPersistReport())
+ return;
+
+ Connection connection = null;
+ try {
+ String userID = AppUtils.getUserID(request);
+ String reportXML = marshal();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Ocurring during Schedule "));
+ if (nvl(reportID, "-1").equals("-1")) {
+ connection = DbUtils.startTransaction();
+ // Add report
+ String sql = "";
+ if (nvl(Globals.getAdhocReportSequence()).length()> 0 && nvl(Globals.getAdhocUserRoldId()).length() > 0 && AppUtils.isUserInRole(request, Globals.getAdhocUserRoldId()) && !AppUtils.isAdminUser(request)) {
+ //sql = "SELECT "+ Globals.getAdhocReportSequence() + ".nextval FROM dual";
+ sql = Globals.getPersistReportAdhoc();
+ sql = sql.replace("[Globals.getAdhocReportSequence()]", Globals.getAdhocReportSequence());
+
+ } else{
+ //sql = "SELECT seq_cr_report.nextval FROM dual";
+ sql = Globals.getNewReportData();
+ }
+ DataSet ds = DbUtils.executeQuery(connection,sql);
+ setReportID(ds.getString(0, 0));
+
+ reportSecurity.reportCreate(reportID, userID, isPublic());
+ ReportLoader.createCustomReportRec(connection, this, reportXML);
+ ReportLoader.createReportLogEntry(connection, reportID, userID,
+ AppConstants.RLA_CREATE, "", "");
+ reportUpdateLogged = true;
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB insert report " + reportID + " succesfull"));
+ } else {
+ // Update report
+ verifySQLBasedReportAccess(request);
+ reportSecurity.reportUpdate(request);
+ connection = DbUtils.startTransaction();
+ ReportLoader.updateCustomReportRec(connection, this, reportXML);
+ if (!reportUpdateLogged) {
+ ReportLoader.createReportLogEntry(connection, reportID, userID,
+ AppConstants.RLA_UPDATE,"","");
+ reportUpdateLogged = true;
+ } // if
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB update report " + reportID + " succesfull"));
+ }
+
+ getReportSchedule().persistScheduleData(connection, request);
+
+ DbUtils.commitTransaction(connection);
+ } catch (RaptorException e) {
+ e.printStackTrace();
+ DbUtils.rollbackTransaction(connection);
+ throw e;
+ } finally {
+ DbUtils.clearConnection(connection);
+ }
+ } // persistReport
+
+ public String getCrossTabDisplayValue(String crossTabValue) {
+ return nvl(crossTabValue).equals(AppConstants.CV_ROW) ? "Row headings" : (nvl(
+ crossTabValue).equals(AppConstants.CV_COLUMN) ? "Column headings" : (nvl(
+ crossTabValue).equals(AppConstants.CV_VALUE) ? "Report values" : "Invisible/Filter"));
+ } // getCrossTabDisplayValue
+
+ public String getCrossTabDisplayValue(DataColumnType dct) {
+ return getCrossTabDisplayValue(dct.getCrossTabValue());
+ } // getCrossTabDisplayValue
+
+ public String getColumnLabel(DataColumnType dct) throws Exception {
+ String tableName = getTableById(dct.getTableId()).getTableName();
+ Vector dbColumns = null;
+ dbColumns = DataCache.getReportTableDbColumns(tableName, cr.getDbInfo());
+ if (dbColumns != null)
+ for (int i = 0; i < dbColumns.size(); i++) {
+ DBColumnInfo dbCol = (DBColumnInfo) dbColumns.get(i);
+ if (dct.getDbColName().equals(dbCol.getColName()))
+ return dbCol.getLabel();
+ } // for
+
+ return "";
+ } // getCrossTabDisplayValue
+
+ public String getFilterLabel(ColFilterType cft) {
+ StringBuffer fLabel = new StringBuffer();
+
+ fLabel.append(cft.getExpression());
+ fLabel.append(" ");
+ if (cft.getArgType() != null)
+ if (cft.getArgType().equals(AppConstants.AT_FORMULA)) {
+ fLabel.append("[" + cft.getArgValue() + "]");
+ } else if (cft.getArgType().equals(AppConstants.AT_VALUE)) {
+ fLabel.append(cft.getArgValue());
+ } else if (cft.getArgType().equals(AppConstants.AT_LIST)) {
+ fLabel.append("(" + cft.getArgValue() + ")");
+ } else if (cft.getArgType().equals(AppConstants.AT_COLUMN)) {
+ DataColumnType dctFilter = getColumnById(cft.getArgValue());
+ fLabel.append("[" + dctFilter.getDisplayName() + "]");
+ } else if (cft.getArgType().equals(AppConstants.AT_FORM)) {
+ fLabel.append("[Form Field]");
+ }
+
+ return fLabel.toString();
+ } // getFilterLabel
+
+ public Vector getReportUsers(HttpServletRequest request) throws RaptorException {
+ return reportSecurity.getReportUsers(request);
+ } // getReportUsers
+
+ public Vector getReportRoles(HttpServletRequest request) throws RaptorException {
+ return reportSecurity.getReportRoles(request);
+ } // getReportRoles
+
+ /** ************************************************************************************************* */
+
+ public void clearAllDrillDowns() {
+ List reportCols = getAllColumns();
+ for (int i = 0; i < reportCols.size(); i++) {
+ DataColumnType dct = (DataColumnType) reportCols.get(i);
+ dct.setDrillDownURL(null);
+ dct.setDrillDownParams(null);
+ dct.setDrillDownType(null);
+ } // for
+ } // clearAllDrillDowns
+
+ public void setOuterJoin(DataSourceType curTable, String joinType) {
+ String refDefinition = nvl(curTable.getRefDefinition());
+ int outerJoinIdx = refDefinition.indexOf(" (+)");
+ if (outerJoinIdx >= 0)
+ // Clear existing outer join
+ if (outerJoinIdx == (refDefinition.length() - 4))
+ refDefinition = refDefinition.substring(0, outerJoinIdx);
+ else
+ refDefinition = refDefinition.substring(0, outerJoinIdx)
+ + refDefinition.substring(outerJoinIdx + 4);
+
+ int equalSignIdx = refDefinition.indexOf("=");
+ if (equalSignIdx < 0)
+ // Ref. definition not present
+ return;
+
+ if (refDefinition.indexOf(curTable.getTableId()) < equalSignIdx) {
+ // Cur. table is on the left side
+ if (nvl(joinType).equals(AppConstants.OJ_CURRENT))
+ refDefinition = refDefinition.substring(0, equalSignIdx) + " (+)"
+ + refDefinition.substring(equalSignIdx);
+ else if (nvl(joinType).equals(AppConstants.OJ_JOINED))
+ refDefinition = refDefinition + " (+)";
+ } else {
+ // Joined table is on the left side
+ if (nvl(joinType).equals(AppConstants.OJ_CURRENT))
+ refDefinition = refDefinition + " (+)";
+ else if (nvl(joinType).equals(AppConstants.OJ_JOINED))
+ refDefinition = refDefinition.substring(0, equalSignIdx) + " (+)"
+ + refDefinition.substring(equalSignIdx);
+ }
+
+ curTable.setRefDefinition(refDefinition);
+ } // setOuterJoin
+
+ public void addDataSourceType(ObjectFactory objFactory, String tableId, String tableName,
+ String tablePK, String displayName, String refTableId, String refDefinition,
+ String comment) throws RaptorException {
+ DataSourceType dst = objFactory.createDataSourceType();
+
+ dst.setTableId(tableId);
+ dst.setTableName(tableName);
+ dst.setTablePK(tablePK);
+ dst.setDisplayName(displayName);
+ if (nvl(refTableId).length() > 0)
+ dst.setRefTableId(refTableId);
+ if (nvl(refDefinition).length() > 0)
+ dst.setRefDefinition(refDefinition);
+ if (nvl(comment).length() > 0)
+ dst.setComment(comment);
+
+ DataColumnList dataColumnList = objFactory.createDataColumnList();
+ dst.setDataColumnList(dataColumnList);
+
+ getDataSourceList().getDataSource().add(dst);
+
+ resetCache(true);
+ } // addDataSourceType
+
+ public void deleteDataSourceType(String tableId) {
+ super.deleteDataSourceType(tableId);
+ } // deleteDataSourceType
+
+ public String getUniqueColumnId(String colName) {
+ String colId = "";
+
+ int colIdN = getAllColumns().size() + 1;
+ do {
+ colId = colName.substring(0, 2).toLowerCase() + (colIdN++);
+ } while (getColumnById(colId) != null);
+
+ return colId;
+ } // getUniqueColumnId
+
+ public DataColumnType addDataColumnType(ObjectFactory objFactory, String colId,
+ String tableId, // Table to which the new column belongs
+ String dbColName, String crossTabValue, String colName, String displayName,
+ int displayWidth, String displayAlignment, int orderSeq, boolean visible,
+ boolean calculated, String colType, String colFormat, boolean groupBreak,
+ int orderBySeq, String orderByAscDesc, String displayTotal, String colOnChart,
+ int chartSeq, String drillDownType, String drillDownURL, String drillDownParams,
+ String semaphoreId, String comment) throws RaptorException {
+ DataColumnType dct = null;
+ dct = objFactory.createDataColumnType();
+
+ dct.setColId(colId);
+ dct.setTableId(tableId);
+ dct.setDbColName(dbColName);
+ if (nvl(crossTabValue).length() > 0)
+ dct.setCrossTabValue(crossTabValue);
+ dct.setColName(colName);
+ dct.setDisplayName(displayName);
+ if (displayWidth > 0)
+ dct.setDisplayWidth(displayWidth);
+ if (nvl(displayAlignment).length() > 0)
+ dct.setDisplayAlignment(displayAlignment);
+ if (orderSeq > 0)
+ dct.setOrderSeq(orderSeq);
+ else
+ dct.setOrderSeq(getAllColumns().size() + 1);
+ dct.setVisible(visible);
+ dct.setCalculated(calculated);
+ // dct.setColType(colType);
+ if (nvl(colFormat).length() > 0)
+ dct.setColFormat(colFormat);
+ dct.setGroupBreak(groupBreak);
+ if (orderBySeq > 0)
+ dct.setOrderBySeq(orderBySeq);
+ if (nvl(orderByAscDesc).length() > 0)
+ dct.setOrderByAscDesc(orderByAscDesc);
+ if (nvl(displayTotal).length() > 0)
+ dct.setDisplayTotal(displayTotal);
+ if (nvl(colOnChart).length() > 0)
+ dct.setColOnChart(colOnChart);
+ if (chartSeq > 0)
+ dct.setChartSeq(chartSeq);
+ if (nvl(drillDownType).length() > 0)
+ dct.setDrillDownType(drillDownType);
+ if (nvl(drillDownURL).length() > 0)
+ dct.setDrillDownURL(drillDownURL);
+ if (nvl(drillDownParams).length() > 0)
+ dct.setDrillDownParams(drillDownParams);
+ if (nvl(semaphoreId).length() > 0)
+ dct.setSemaphoreId(semaphoreId);
+ if (nvl(comment).length() > 0)
+ dct.setComment(comment);
+
+ dct.setDbColType(colType);
+ adjustColumnType(dct);
+
+ // ColFilterList colFilterList = objFactory.createColFilterList();
+ // dct.setColFilterList(colFilterList);
+
+ getTableById(tableId).getDataColumnList().getDataColumn().add(dct);
+
+ resetCache(false);
+
+ return dct;
+ } // addDataColumnType
+
+ public void deleteDataColumnType(String colId) {
+ int colOrder = getColumnById(colId).getOrderSeq();
+
+ List dcList = getColumnTableById(colId).getDataColumnList().getDataColumn();
+ for (Iterator iterC = dcList.iterator(); iterC.hasNext();) {
+ DataColumnType dct = (DataColumnType) iterC.next();
+
+ if (dct.getColId().equals(colId) && dct.getOrderSeq() == colOrder)
+ iterC.remove();
+ else if (dct.getOrderSeq() > colOrder)
+ dct.setOrderSeq(dct.getOrderSeq() - 1);
+ } // for
+
+ if (getFormFieldList() != null)
+ for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ if (nvl(fft.getColId()).equals(colId)) {
+ fft.setColId("");
+ fft.setFieldType(FormField.FFT_TEXT);
+ if (nvl(fft.getDefaultValue()).equals(AppConstants.FILTER_MAX_VALUE)
+ || nvl(fft.getDefaultValue())
+ .equals(AppConstants.FILTER_MIN_VALUE))
+ fft.setDefaultValue("");
+ } // if
+ } // for
+
+ resetCache(false);
+ resetColumnOrderValues();
+ } // deleteDataColumnType
+
+ public void shiftColumnOrderUp(String colId) {
+ List reportCols = getAllColumns();
+ for (int i = 0; i < reportCols.size(); i++) {
+ DataColumnType dct = (DataColumnType) reportCols.get(i);
+
+ if (dct.getColId().equals(colId) && (i > 0)) {
+ DataColumnType dctUp = (DataColumnType) reportCols.get(i - 1);
+ dctUp.setOrderSeq(dctUp.getOrderSeq() + 1);
+ dct.setOrderSeq(dct.getOrderSeq() - 1);
+ break;
+ } // if
+ } // for
+
+ Collections.sort(reportCols, new OrderSeqComparator());
+ resetCache(true);
+ resetColumnOrderValues();
+ } // shiftColumnOrderUp
+
+ public void shiftColumnOrderDown(String colId) {
+ List reportCols = getAllColumns();
+ for (int i = 0; i < reportCols.size(); i++) {
+ DataColumnType dct = (DataColumnType) reportCols.get(i);
+
+ if (dct.getColId().equals(colId) && (i < reportCols.size() - 1)) {
+ DataColumnType dctDown = (DataColumnType) reportCols.get(i + 1);
+ dctDown.setOrderSeq(dctDown.getOrderSeq() - 1);
+ dct.setOrderSeq(dct.getOrderSeq() + 1);
+ break;
+ } // if
+ } // for
+
+ Collections.sort(reportCols, new OrderSeqComparator());
+ resetCache(true);
+ resetColumnOrderValues();
+ } // shiftColumnOrderDown
+
+ public void resetColumnOrderValues() {
+ List reportCols = getAllColumns();
+
+ int colOrder = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ dct.setOrderSeq(++colOrder);
+ } // for
+
+ Collections.sort(reportCols, new OrderSeqComparator());
+ } // resetColumnOrderValues
+
+ public void addColFilterType(ObjectFactory objFactory, String colId, // Column
+ // to
+ // which
+ // the
+ // new
+ // filter
+ // belongs
+ String joinCondition, String openBrackets, String expression, String argType,
+ String argValue, String closeBrackets, String comment) throws RaptorException {
+ ColFilterType cft = objFactory.createColFilterType();
+
+ cft.setColId(colId);
+ cft.setJoinCondition(nvl(joinCondition, "AND"));
+ if (nvl(openBrackets).length() > 0)
+ cft.setOpenBrackets(openBrackets);
+ cft.setExpression(expression);
+ if (nvl(argType).length() > 0)
+ cft.setArgType(argType);
+ if (nvl(argValue).length() > 0)
+ cft.setArgValue(argValue);
+ if (nvl(closeBrackets).length() > 0)
+ cft.setCloseBrackets(closeBrackets);
+ if (nvl(comment).length() > 0)
+ cft.setComment(comment);
+
+ DataColumnType dct = getColumnById(colId);
+ if (dct != null) {
+ if (dct.getColFilterList() == null)
+ dct.setColFilterList(objFactory.createColFilterList());
+
+ cft.setFilterSeq(dct.getColFilterList().getColFilter().size());
+ dct.getColFilterList().getColFilter().add(cft);
+ } // if
+
+ resetCache(true);
+ } // addColFilterType
+
+ public void removeColumnFilter(String colId, int filterPos) {
+ DataColumnType dct = getColumnById(colId);
+
+ if (dct.getColFilterList() != null)
+ try {
+ dct.getColFilterList().getColFilter().remove(filterPos);
+ } catch (IndexOutOfBoundsException e) {
+ }
+
+ resetCache(true);
+ } // removeColumnFilter
+
+ public void addColumnSort(String colId, String ascDesc) {
+ addColumnSort(colId, ascDesc, -1);
+ } // addColumnSort
+
+ public void addColumnSort(String colId, String ascDesc, int sortOrder) {
+ if (sortOrder <= 0) {
+ sortOrder = 1;
+ List reportCols = getAllColumns();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();)
+ if (((DataColumnType) iter.next()).getOrderBySeq() > 0)
+ sortOrder++;
+ } // if
+
+ DataColumnType dct = getColumnById(colId);
+ dct.setOrderBySeq(sortOrder);
+ dct.setOrderByAscDesc(ascDesc);
+
+ resetCache(true);
+ } // addColumnSort
+
+ public void removeColumnSort(String colId) {
+ DataColumnType dct = getColumnById(colId);
+ int sortOrder = dct.getOrderBySeq();
+
+ dct.setOrderBySeq(0);
+ dct.setOrderByAscDesc(null);
+
+ if (sortOrder > 0) {
+ List reportCols = getAllColumns();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct2 = (DataColumnType) iter.next();
+
+ if (dct2.getOrderBySeq() > sortOrder)
+ dct2.setOrderBySeq(dct2.getOrderBySeq() - 1);
+ } // for
+ } // if
+
+ resetCache(true);
+ } // removeColumnSort
+
+ public void shiftColumnSortUp(String colId) {
+ List reportCols = getAllColumns();
+ Collections.sort(reportCols, new OrderBySeqComparator());
+
+ for (int i = 0; i < reportCols.size(); i++) {
+ DataColumnType dct = (DataColumnType) reportCols.get(i);
+
+ if (dct.getColId().equals(colId) && (dct.getOrderBySeq() > 0)) {
+ DataColumnType dctUp = (DataColumnType) reportCols.get(i - 1);
+ if (dctUp.getOrderBySeq() > 0)
+ dctUp.setOrderBySeq(dctUp.getOrderBySeq() + 1);
+ dct.setOrderBySeq(dct.getOrderBySeq() - 1);
+ break;
+ } // if
+ } // for
+
+ Collections.sort(reportCols, new OrderSeqComparator());
+ resetCache(true);
+ } // shiftColumnSortUp
+
+ public void shiftColumnSortDown(String colId) {
+ List reportCols = getAllColumns();
+ Collections.sort(reportCols, new OrderBySeqComparator());
+
+ for (int i = 0; i < reportCols.size(); i++) {
+ DataColumnType dct = (DataColumnType) reportCols.get(i);
+
+ if (dct.getColId().equals(colId) && (dct.getOrderBySeq() > 0)) {
+ DataColumnType dctDown = (DataColumnType) reportCols.get(i + 1);
+ if (dctDown.getOrderBySeq() > 0)
+ dctDown.setOrderBySeq(dctDown.getOrderBySeq() - 1);
+ dct.setOrderBySeq(dct.getOrderBySeq() + 1);
+ break;
+ } // if
+ } // for
+
+ Collections.sort(reportCols, new OrderSeqComparator());
+ resetCache(true);
+ } // shiftColumnSortDown
+
+ /** ************************************************************************************************* */
+
+ public String generateNewSemaphoreId() {
+ if (getSemaphoreList() == null)
+ return "sem1";
+
+ String semaphoreId = null;
+ boolean idExists = true;
+ for (int i = 1; idExists; i++) {
+ semaphoreId = "sem" + i;
+ idExists = false;
+ for (Iterator iter = getSemaphoreList().getSemaphore().iterator(); iter.hasNext();)
+ if (semaphoreId.equals(((SemaphoreType) iter.next()).getSemaphoreId())) {
+ idExists = true;
+ break;
+ }
+ } // for
+
+ return semaphoreId;
+ } // generateNewSemaphoreId
+
+ public SemaphoreType addSemaphore(ObjectFactory objFactory, SemaphoreType semaphoreType)
+ throws RaptorException {
+ SemaphoreType sem = null;
+ try {
+ if (getSemaphoreList() == null)
+ setSemaphoreList(objFactory.createSemaphoreList());
+
+ String semaphoreName = null;
+ boolean nameExists = true;
+ for (int i = 1; nameExists; i++) {
+ semaphoreName = semaphoreType.getSemaphoreName() + ((i > 1) ? (" v" + i) : "");
+ nameExists = false;
+ for (Iterator iter2 = getSemaphoreList().getSemaphore().iterator(); iter2
+ .hasNext();)
+ if (semaphoreName.equals(((SemaphoreType) iter2.next()).getSemaphoreName())) {
+ nameExists = true;
+ break;
+ }
+ } // for
+
+ sem = cloneSemaphoreType(objFactory, semaphoreType);
+ getSemaphoreList().getSemaphore().add(sem);
+
+ sem.setSemaphoreId(generateNewSemaphoreId());
+ sem.setSemaphoreName(semaphoreName);
+ } catch (JAXBException ex) {
+ throw new RaptorException(ex.getMessage(), ex.getCause());
+ }
+
+ return sem;
+ } // addSemaphore
+
+ public SemaphoreType addSemaphoreType(ObjectFactory objFactory, String semaphoreName,
+ String semaphoreType, String comment) throws RaptorException {
+ SemaphoreType sem = null;
+ if (getSemaphoreList() == null)
+ setSemaphoreList(objFactory.createSemaphoreList());
+
+ sem = objFactory.createSemaphoreType();
+ getSemaphoreList().getSemaphore().add(sem);
+
+ sem.setSemaphoreId(generateNewSemaphoreId());
+ sem.setSemaphoreName(semaphoreName);
+ sem.setSemaphoreType(nvl(semaphoreType));
+ if (nvl(comment).length() > 0)
+ sem.setComment(comment);
+
+ FormatList formatList = objFactory.createFormatList();
+ sem.setFormatList(formatList);
+ return sem;
+ } // addSemaphoreType
+
+
+ public String getNextIdForJavaScriptElement (ObjectFactory objFactory, String fieldId) throws RaptorException {
+ String id = "";
+ JavascriptItemType jit = null;
+ int incr = 0;
+ if (getJavascriptList() == null) {
+ setJavascriptList(objFactory.createJavascriptList());
+ return fieldId + "|1";
+ } else {
+ if(getJavascriptList().getJavascriptItem().iterator().hasNext()) {
+ for (Iterator iter = getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) {
+ jit = (JavascriptItemType) iter.next();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^JAVASCRIPTITEMTYPE " + jit.getFieldId() + " " + fieldId + " " + id));
+ if(nvl(jit.getFieldId()).length()>0 && jit.getFieldId().equals(fieldId)) {
+ ++incr;
+ }
+ } // for
+ return fieldId + "|"+incr;
+ } else {
+ return fieldId + "|1";
+ }
+
+ }
+ //return null;
+ }
+
+ public JavascriptItemType addJavascriptType(ObjectFactory objFactory, String id) throws RaptorException {
+ JavascriptItemType javascriptItemType = null;
+ int flag = 0; // checking whether id existing in the list
+ if (getJavascriptList() == null) {
+ setJavascriptList(objFactory.createJavascriptList());
+ javascriptItemType = objFactory.createJavascriptItemType();
+ getJavascriptList().getJavascriptItem().add(javascriptItemType);
+ return javascriptItemType;
+ } else {
+
+ for (Iterator iter = getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) {
+ javascriptItemType = (JavascriptItemType)iter.next();
+ if(javascriptItemType.getId().equals(id) && !id.startsWith("-1")) {
+ flag = 1;
+ break;
+ }
+ }
+ if(flag == 1) return javascriptItemType;
+ else {
+ javascriptItemType = objFactory.createJavascriptItemType();
+ getJavascriptList().getJavascriptItem().add(javascriptItemType);
+ return javascriptItemType;
+ }
+ }
+
+ } // addSemaphoreType
+
+ public boolean deleteJavascriptType(String id) throws RaptorException {
+ JavascriptItemType javascriptType = null;
+ if (getJavascriptList() == null)
+ return true;
+ for (Iterator iter = getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) {
+ javascriptType = (JavascriptItemType)iter.next();
+ if(javascriptType.getId().equals(id)) {
+ iter.remove();
+ return true;
+ }
+ }
+ return false;
+ } // addSemaphoreType
+
+ public static FormatType addEmptyFormatType(ObjectFactory objFactory,
+ SemaphoreType semaphore) throws RaptorException {
+ FormatType fmt = null;
+ fmt = objFactory.createFormatType();
+ semaphore.getFormatList().getFormat().add(fmt);
+
+ String formatId = null;
+ boolean idExists = true;
+ for (int i = 1; idExists; i++) {
+ formatId = semaphore.getSemaphoreId() + "_fmt" + i;
+ idExists = false;
+ for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter
+ .hasNext();)
+ if (formatId.equals(((FormatType) iter.next()).getFormatId())) {
+ idExists = true;
+ break;
+ }
+ } // for
+ fmt.setFormatId(formatId);
+ return fmt;
+ } // addEmptyFormatType
+
+ public static void deleteFormatType(SemaphoreType semaphore, String formatId) {
+ for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter.hasNext();)
+ if (formatId.equals(((FormatType) iter.next()).getFormatId())) {
+ iter.remove();
+ break;
+ } // if
+ } // deleteFormatType
+
+ public FormFieldType addFormFieldType(ObjectFactory objFactory, String fieldName,
+ String colId, String fieldType, String validationType, String mandatory,
+ String defaultValue, String fieldSQL, String comment, Calendar rangeStartDate, Calendar rangeEndDate,
+ String rangeStartDateSQL, String rangeEndDateSQL) throws RaptorException {
+ FormFieldType fft = null;
+ fft = objFactory.createFormFieldType();
+
+ fft.setFieldName(fieldName);
+ fft.setColId(colId);
+ fft.setFieldType(fieldType);
+ fft.setValidationType(validationType);
+ fft.setMandatory(nvl(mandatory, "N"));
+ fft.setDefaultValue(nvl(defaultValue));
+ fft.setOrderBySeq((getFormFieldList() == null) ? 1 : getFormFieldList().getFormField()
+ .size() + 1);
+ fft.setFieldSQL(fieldSQL);
+ //fft.setRangeStartDate(rangeStartDate);
+ //fft.setRangeEndDate(rangeEndDate);
+
+ try {
+ fft.setRangeStartDate(DatatypeFactory.newInstance()
+ .newXMLGregorianCalendar(rangeStartDate.YEAR, rangeStartDate.MONTH, rangeStartDate.DAY_OF_WEEK, rangeStartDate.HOUR, rangeStartDate.MINUTE, rangeStartDate.SECOND, rangeStartDate.MILLISECOND, rangeStartDate.ZONE_OFFSET));
+ fft.setRangeStartDate(DatatypeFactory.newInstance()
+ .newXMLGregorianCalendar(rangeEndDate.YEAR, rangeEndDate.MONTH, rangeEndDate.DAY_OF_WEEK, rangeEndDate.HOUR, rangeEndDate.MINUTE, rangeEndDate.SECOND, rangeEndDate.MILLISECOND, rangeEndDate.ZONE_OFFSET));
+ /*currField.setRangeEndDate(DatatypeFactory.newInstance()
+ .newXMLGregorianCalendar(end));*/
+ } catch (DatatypeConfigurationException ex) {
+
+ }
+
+ fft.setRangeStartDateSQL(rangeStartDateSQL);
+ fft.setRangeEndDateSQL(rangeEndDateSQL);
+ if (nvl(comment).length() > 0)
+ fft.setComment(comment);
+
+ String fieldId = null;
+ boolean idExists = true;
+ for (int i = 1; idExists; i++) {
+ fieldId = "ff" + i;
+ idExists = false;
+ if (getFormFieldList() != null)
+ for (Iterator iter = getFormFieldList().getFormField().iterator(); iter
+ .hasNext();)
+ if (fieldId.equals(((FormFieldType) iter.next()).getFieldId())) {
+ idExists = true;
+ break;
+ }
+ } // for
+ fft.setFieldId(fieldId);
+
+ if (getFormFieldList() == null) {
+ FormFieldList formFieldList = objFactory.createFormFieldList();
+ setFormFieldList(formFieldList);
+ }
+
+ getFormFieldList().getFormField().add(fft);
+ return fft;
+ } // addFormFieldType
+
+ //addCustomizedTextForParameters
+ public void addCustomizedTextForParameters(String comment) throws RaptorException {
+ getFormFieldList().setComment(comment);
+ }
+
+ public FormFieldType addFormFieldBlank(ObjectFactory objFactory) throws RaptorException {
+ FormFieldType fft = null;
+ fft = objFactory.createFormFieldType();
+
+ fft.setFieldName("BLANK");
+ fft.setColId("bk");
+ fft.setFieldType(FormField.FFT_BLANK);
+ fft.setOrderBySeq((getFormFieldList() == null) ? 1 : getFormFieldList().getFormField()
+ .size() + 1);
+ String fieldId = null;
+ boolean idExists = true;
+ for (int i = 1; idExists; i++) {
+ fieldId = "ff" + i;
+ idExists = false;
+ if (getFormFieldList() != null)
+ for (Iterator iter = getFormFieldList().getFormField().iterator(); iter
+ .hasNext();)
+ if (fieldId.equals(((FormFieldType) iter.next()).getFieldId())) {
+ idExists = true;
+ break;
+ }
+ } // for
+ fft.setFieldId(fieldId);
+
+ if (getFormFieldList() == null) {
+ FormFieldList formFieldList = objFactory.createFormFieldList();
+ setFormFieldList(formFieldList);
+ }
+
+ getFormFieldList().getFormField().add(fft);
+ return fft;
+ } // addFormFieldBlank
+
+ public void replaceFormFieldReferences(String fieldName, String replaceWith) {
+ if (fieldName.equals(replaceWith))
+ return;
+
+ for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if (dct.isCalculated() && dct.getColName().indexOf(fieldName) >= 0)
+ dct.setColName(Utils.replaceInString(dct.getColName(), fieldName, nvl(
+ replaceWith, "NULL")));
+
+ if (dct.getColFilterList() != null)
+ for (Iterator iter2 = dct.getColFilterList().getColFilter().iterator(); iter2
+ .hasNext();) {
+ ColFilterType cft = (ColFilterType) iter2.next();
+
+ if (nvl(cft.getArgType()).equals(AppConstants.AT_FORM)
+ && nvl(cft.getArgValue()).equals(fieldName))
+ cft.setArgValue(replaceWith);
+ } // for
+ } // for
+ } // replaceFormFieldReferences
+
+ public void deleteFormField(String fieldId) {
+ String fieldDisplayName = null;
+
+ int orderBySeq = Integer.MAX_VALUE;
+ if (getFormFieldList() != null)
+ for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+
+ if (fieldId.equals(fft.getFieldId())) {
+ //orderBySeq = fft.getOrderBySeq();
+ fieldDisplayName = getFormFieldDisplayName(fft);
+ iter.remove();
+ } else if (fft.getOrderBySeq()!=null && (fft.getOrderBySeq().intValue() > orderBySeq))
+ fft.setOrderBySeq(fft.getOrderBySeq() - 1);
+ } // for
+
+ if (fieldDisplayName != null)
+ replaceFormFieldReferences(fieldDisplayName, "");
+ } // deleteFormField
+
+ public void shiftFormFieldUp(String fieldId) {
+ if (getFormFieldList() == null)
+ return;
+
+ for (int i = 0; i < getFormFieldList().getFormField().size(); i++) {
+ FormFieldType fft = (FormFieldType) getFormFieldList().getFormField().get(i);
+
+ if (fft.getFieldId().equals(fieldId) && (i > 0)) {
+ FormFieldType prevFft = (FormFieldType) getFormFieldList().getFormField().get(
+ i - 1);
+ prevFft.setOrderBySeq(prevFft.getOrderBySeq() + 1);
+ fft.setOrderBySeq((fft.getOrderBySeq() == null)?0:fft.getOrderBySeq() - 1);
+
+ getFormFieldList().getFormField().remove(i);
+ getFormFieldList().getFormField().add(i - 1, fft);
+ return;
+ } // if
+ } // for
+ } // shiftFormFieldUp
+
+ public void shiftFormFieldDown(String fieldId) {
+ if (getFormFieldList() == null)
+ return;
+
+ for (int i = 0; i < getFormFieldList().getFormField().size(); i++) {
+ FormFieldType fft = (FormFieldType) getFormFieldList().getFormField().get(i);
+
+ if (fft.getFieldId().equals(fieldId)
+ && (i < getFormFieldList().getFormField().size() - 1)) {
+ FormFieldType nextFft = (FormFieldType) getFormFieldList().getFormField().get(
+ i + 1);
+ nextFft.setOrderBySeq((nextFft.getOrderBySeq() == null)?0:nextFft.getOrderBySeq() - 1);
+ fft.setOrderBySeq((fft.getOrderBySeq() == null)?0:fft.getOrderBySeq() + 1);
+
+ getFormFieldList().getFormField().remove(i + 1);
+ getFormFieldList().getFormField().add(i, nextFft);
+ return;
+ } // if
+ } // for
+ } // shiftFormFieldDown
+
+ public static void addFormFieldPredefinedValue(ObjectFactory objFactory,
+ FormFieldType formField, String predefinedValue) throws RaptorException {
+ if (formField.getPredefinedValueList() == null) {
+ PredefinedValueList predefinedValueList = objFactory.createPredefinedValueList();
+ formField.setPredefinedValueList(predefinedValueList);
+ } // if
+
+ if (predefinedValue.length() > 0) {
+ formField.getPredefinedValueList().getPredefinedValue().add(predefinedValue);
+ Collections.sort(formField.getPredefinedValueList().getPredefinedValue());
+ } // if
+ } // addFormFieldPredefinedValue
+
+ public static void deleteFormFieldPredefinedValue(FormFieldType formField,
+ String predefinedValue) {
+ if (formField != null && formField.getPredefinedValueList() != null
+ && predefinedValue.length() > 0)
+ for (Iterator iter = formField.getPredefinedValueList().getPredefinedValue()
+ .iterator(); iter.hasNext();)
+ if (predefinedValue.equals((String) iter.next())) {
+ iter.remove();
+ break;
+ } // if
+ } // deleteFormFieldPredefinedValue
+
+ /** ************************************************************************************************* */
+
+ private int curSQLParsePos = 0;
+
+ private String getNextSQLParseToken(String sql, boolean updateParsePos) {
+ int braketCount = 0;
+ boolean isInsideQuote = false;
+ StringBuffer nextToken = new StringBuffer();
+ for (int idxNext = curSQLParsePos; idxNext < sql.length(); idxNext++) {
+ char ch = sql.charAt(idxNext);
+
+ if (Character.isWhitespace(ch) || ch == ',') {
+ if (ch == ',')
+ nextToken.append(ch);
+
+ if (nextToken.length() == 0)
+ continue;
+ else if (braketCount == 0 && (!isInsideQuote)) {
+ if (updateParsePos)
+ curSQLParsePos = idxNext + ((ch == ',') ? 1 : 0);
+ break;
+ } else if (ch != ',' && nextToken.charAt(nextToken.length() - 1) != ' ')
+ nextToken.append(' ');
+ } else {
+ nextToken.append(ch);
+
+ if (ch == '(' || ch == '[')
+ braketCount++;
+ else if (ch == ')' || ch == ']')
+ braketCount--;
+ else if (ch == '\''/* ||ch=='\"' */)
+ isInsideQuote = (!isInsideQuote);
+ } // else
+ } // for
+
+ return nextToken.toString();
+ } // getNextSQLParseToken
+
+ private boolean isParseSQLColID(String token) {
+ if (nvl(token).length() == 0)
+ return false;
+
+ for (int i = 0; i < token.length(); i++) {
+ char ch = token.charAt(i);
+
+ if (i == 0 && ch == '_')
+ return false;
+
+ if (!(Character.isLetterOrDigit(ch) || ch == '_'))
+ return false;
+ } // for
+
+ return true;
+ } // isParseSQLColID
+
+ private DataColumnType getParseSQLDataColumn(String sqlExpression, String colId,
+ StringBuffer parsedSQL, Vector updatedReportCols, boolean isCYMBALScript) throws RaptorException {
+ DataColumnType dct = null;
+
+ if (colId != null) {
+ if (!isParseSQLColID(colId))
+ throw new org.openecomp.portalsdk.analytics.error.ValidationException(
+ "["
+ + colId
+ + "] must either be a valid column id consisting only of letters, numbers, and underscores, or there must be a comma in front of it.");
+
+ dct = getColumnById(colId);
+ } else {
+ // Getting unique column id
+ colId = "";
+ int colIdN = 0;
+ for (int i = 0; (i < sqlExpression.length()) && (colIdN < 2); i++)
+ if (Character.isLetter(sqlExpression.charAt(i))) {
+ colId += sqlExpression.toLowerCase().charAt(i);
+ colIdN++;
+ } // if
+
+ colIdN = getAllColumns().size() + updatedReportCols.size();
+ for (boolean idAlreadyUsed = true; idAlreadyUsed; colIdN++) {
+ String newColId = colId + colIdN;
+ idAlreadyUsed = false;
+
+ for (Iterator iter = getAllColumns().iterator(); iter.hasNext();)
+ if (newColId.equals(((DataColumnType) iter.next()).getColId())) {
+ idAlreadyUsed = true;
+ break;
+ }
+
+ if (!idAlreadyUsed)
+ for (Iterator iter = updatedReportCols.iterator(); iter.hasNext();)
+ if (newColId.equals(((DataColumnType) iter.next()).getColId())) {
+ idAlreadyUsed = true;
+ break;
+ }
+ } // for
+
+ colId += (colIdN - 1);
+ } // else
+
+ if (dct == null) {
+ dct = (new ObjectFactory()).createDataColumnType();
+ dct.setColId(colId);
+ dct.setDisplayWidth(10);
+ dct.setDisplayAlignment("Left");
+ dct.setVisible(true);
+ dct.setGroupBreak(false); // ???
+ if(!isCYMBALScript) {
+ boolean isValidIdentifier = Character.isLetterOrDigit(sqlExpression.charAt(0));
+ for (int i = 0; i < sqlExpression.length(); i++)
+ if (!(Character.isLetterOrDigit(sqlExpression.charAt(i))
+ || (sqlExpression.charAt(i) == '_') || (sqlExpression.charAt(i) == '$'))) {
+ isValidIdentifier = false;
+ break;
+ } // if
+
+ if (isValidIdentifier) {
+ dct.setDisplayName(sqlExpression);
+ } else {
+ dct.setDisplayName(colId);
+ } // else
+ } else dct.setDisplayName(colId);
+ } // if
+ if(!isCYMBALScript)
+ sqlExpression = sqlExpression.replaceAll(", '", ",'");
+ dct.setDbColName(sqlExpression);
+ dct.setColName(sqlExpression);
+ dct.setCalculated(true);
+ dct.setColType(AppConstants.CT_CHAR);
+ dct.setDbColType(AppConstants.CT_CHAR);
+ adjustColumnType(dct); // ???
+ if(!isCYMBALScript) {
+ if (parsedSQL.toString().equals("SELECT ")
+ || parsedSQL.toString().equals("SELECT DISTINCT "))
+ parsedSQL.append("\n\t");
+ else
+ parsedSQL.append(", \n\t");
+ parsedSQL.append(sqlExpression);
+ parsedSQL.append(" ");
+ parsedSQL.append(colId);
+ }
+
+ return dct;
+ } // getParseSQLDataColumn
+
+ public void parseReportSQL(String sql) throws RaptorException {
+ StringBuffer parsedSQL = new StringBuffer();
+
+ Vector updatedReportCols = new Vector();
+
+ curSQLParsePos = 0;
+ int lastParsePos = curSQLParsePos;
+ String lastToken = null;
+ String nextToken = getNextSQLParseToken(sql, true);
+
+ String dbInfo = getDBInfo();
+ boolean isCYMBALScript = false;
+ if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ try {
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ String dbType = remDbInfo.getDBType(dbInfo);
+ if (dbType.equals("DAYTONA") && !(nextToken.toUpperCase().equals("SELECT"))) {
+ isCYMBALScript = true;
+ }
+ } catch (Exception ex) {
+ throw new RaptorException(ex);
+ }
+ }
+ if ( isCYMBALScript == false ) {
+ while (nextToken.length() > 0) {
+ if (parsedSQL.length() == 0) {
+ if (nextToken.toUpperCase().equals("SELECT"))
+ parsedSQL.append("SELECT ");
+ else
+ throw new org.openecomp.portalsdk.analytics.error.ValidationException(
+ "The SQL must start with the SELECT keyword.");
+ } else if (nextToken.toUpperCase().equals("DISTINCT")
+ && parsedSQL.toString().equals("SELECT ")) {
+ parsedSQL.append("DISTINCT ");
+ } else if (nextToken.equals("*")
+ && (parsedSQL.toString().equals("SELECT ") || parsedSQL.toString().equals(
+ "SELECT DISTINCT "))) {
+ throw new org.openecomp.portalsdk.analytics.error.ValidationException(
+ "You cannot use \"SELECT *\". Please specify select columns/expressions.");
+ } else if (nextToken.toUpperCase().equals("FROM")) {
+ if (lastToken != null) {
+ updatedReportCols.add(getParseSQLDataColumn(lastToken, null, parsedSQL,
+ updatedReportCols, false));
+ lastToken = null;
+ }
+
+ parsedSQL.append(" \n");
+ while (lastParsePos < sql.length()
+ && Character.isWhitespace(sql.charAt(lastParsePos)))
+ lastParsePos++;
+ parsedSQL.append(sql.substring(lastParsePos));
+ break;
+ } else {
+ if (nextToken.charAt(nextToken.length() - 1) == ',') {
+ // The token ends with ,
+ nextToken = nextToken.substring(0, nextToken.length() - 1);
+
+ if (nextToken.length() == 0) {
+ if (lastToken != null) {
+ updatedReportCols.add(getParseSQLDataColumn(lastToken, null,
+ parsedSQL, updatedReportCols, false));
+ lastToken = null;
+ } // else just comma => ignore it
+ } else {
+ if (lastToken != null) {
+ updatedReportCols.add(getParseSQLDataColumn(lastToken, nextToken,
+ parsedSQL, updatedReportCols, false));
+ lastToken = null;
+ } else
+ updatedReportCols.add(getParseSQLDataColumn(nextToken, null,
+ parsedSQL, updatedReportCols, false));
+ }
+ } else {
+ // The token doesn't end with ,
+ if (lastToken == null)
+ lastToken = nextToken;
+ else {
+ String token = getNextSQLParseToken(sql, false);
+ if (!token.toUpperCase().equals("FROM"))
+ throw new org.openecomp.portalsdk.analytics.error.ValidationException(
+ "|FROM keyword or a comma expected after [" + nextToken
+ + "].");
+
+ updatedReportCols.add(getParseSQLDataColumn(lastToken, nextToken,
+ parsedSQL, updatedReportCols, false));
+ lastToken = null;
+ } // else
+ } // else
+ } // else
+
+ lastParsePos = curSQLParsePos;
+ nextToken = getNextSQLParseToken(sql, true);
+ } // while
+ } else { // if CYMBAL Script
+ curSQLParsePos = 0;
+ Pattern re = null;
+ Matcher matcher = null;
+ String extracted = null;
+ nextToken = getNextCYMBALSQLParseToken(sql,true);
+ while (nextToken.length() > 0) {
+ if (lastToken == null) lastToken = nextToken;
+
+ if( lastToken.toUpperCase().startsWith("DO DISPLAY")) {
+ re = Pattern.compile("each(.*)\\[.(.*?)\\]"); //\\[(.*?)\\]
+ matcher = re.matcher(nextToken);
+ if (matcher.find()) {
+ extracted = matcher.group();
+ re = Pattern.compile("\\[(.*?)\\]");
+ matcher = re.matcher(nextToken);
+ if(matcher.find()) {
+ extracted = matcher.group();
+ extracted = extracted.substring(1,extracted.length()-1);
+ StringTokenizer sToken = new StringTokenizer(extracted, ",");
+ while(sToken.hasMoreTokens()) {
+ String str1 = sToken.nextToken().trim().substring(1);
+ updatedReportCols.add(getParseSQLDataColumn("", str1,
+ new StringBuffer(""), updatedReportCols, true));
+ }
+ }
+
+ }
+
+ }
+ lastToken = nextToken;
+ nextToken = getNextCYMBALSQLParseToken(sql, true);
+ }
+
+ }
+ if (updatedReportCols.size() == 0)
+ throw new org.openecomp.portalsdk.analytics.error.ValidationException(
+ "The SQL statement must have at least one column in the SELECT clause.");
+ if (getDataSourceList().getDataSource().size() == 0)
+ addDataSourceType(new ObjectFactory(), "du0", "DUAL", "", "DUAL", null, null, null);
+ DataSourceType dst = (DataSourceType) getDataSourceList().getDataSource().get(0);
+ dst.getDataColumnList().getDataColumn().clear();
+
+ for (int i = 0; i < updatedReportCols.size(); i++) {
+ DataColumnType dct = (DataColumnType) updatedReportCols.get(i);
+ dct.setTableId(dst.getTableId());
+ dct.setOrderSeq(i + 1);
+ dst.getDataColumnList().getDataColumn().add(dct);
+ } // for
+ setReportSQL(parsedSQL.toString());
+ resetCache(false);
+ } // parseReportSQL
+
+ private String getNextCYMBALSQLParseToken(String sql, boolean updateParsePos) {
+ int braketCount = 0;
+ boolean isInsideQuote = false;
+ StringBuffer nextToken = new StringBuffer();
+ for (int idxNext = curSQLParsePos; idxNext < sql.length(); idxNext++) {
+ char ch = sql.charAt(idxNext);
+
+ if (ch!='\n') {
+ nextToken.append(ch);
+ if (updateParsePos)
+ curSQLParsePos = idxNext;
+ }
+ else {
+ curSQLParsePos = idxNext+1;
+ break;
+ }
+ } // for
+
+ return nextToken.toString();
+ } // getNextSQLParseToken
+
+ public void addChartAdditionalOptions(ObjectFactory objFactory) throws RaptorException {
+ ChartAdditionalOptions chartOptions = objFactory.createChartAdditionalOptions();
+ cr.setChartAdditionalOptions(chartOptions);
+ }
+
+ public void addChartDrillOptions(ObjectFactory objFactory) throws RaptorException {
+ ChartDrillOptions chartOptions = objFactory.createChartDrillOptions();
+ cr.setChartDrillOptions(chartOptions);
+}
+
+ public void addDataminingOptions(ObjectFactory objFactory) throws RaptorException {
+ DataminingOptions dataminingOptions = objFactory.createDataminingOptions();
+ cr.setDataminingOptions(dataminingOptions);
+ }
+ /*public void addChartAdditionalOptions(ObjectFactory objFactory, String chartType, String chartMultiplePieOrder, String chartMultiplePieLabelDisplay,
+ String chartOrientation, String secondaryChartRenderer, String chartDisplay, String legendPosition,
+ String labelAngle) throws RaptorException {
+ try {
+ ChartAdditionalOptions chartOptions = objFactory.createChartAdditionalOptions();
+
+ if (nvl(chartMultiplePieOrder).length() > 0)
+ chartOptions.setChartMultiplePieOrder(chartMultiplePieOrder);
+ if (nvl(chartMultiplePieLabelDisplay).length() > 0)
+ chartOptions.setChartMultiplePieLabelDisplay(chartMultiplePieLabelDisplay);
+ if (nvl(chartOrientation).length() > 0)
+ chartOptions.setChartOrientation(chartOrientation);
+ if (nvl(secondaryChartRenderer).length() > 0)
+ chartOptions.setSecondaryChartRenderer(secondaryChartRenderer);
+ if (nvl(chartDisplay).length() > 0)
+ chartOptions.setChartDisplay(chartDisplay);
+ if (nvl(legendPosition).length() > 0)
+ chartOptions.setLegendPosition(legendPosition);
+ if (nvl(labelAngle).length() > 0)
+ chartOptions.setLabelAngle(labelAngle);
+
+ cr.setChartAdditionalOptions(chartOptions);
+ } catch (JAXBException ex) {
+ throw new RaptorException(ex.getMessage(), ex.getCause());
+ }
+ } // addChartAdditionalOptions*/
+
+
+} // ReportDefinition
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportLogEntry.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportLogEntry.java
new file mode 100644
index 00000000..db69e9d8
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportLogEntry.java
@@ -0,0 +1,89 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+public class ReportLogEntry extends RaptorObject {
+ private String logTime = null;
+
+ private String userName = null;
+
+ private String action = null;
+
+ private String timeTaken;
+
+ private String runIcon;
+
+ public ReportLogEntry() {
+ super();
+ }
+
+ public ReportLogEntry(String logTime, String userName, String action, String timeTaken, String runIcon) {
+ this();
+
+ setLogTime(logTime);
+ setUserName(userName);
+ setAction(action);
+ setTimeTaken(timeTaken);
+ setRunIcon(runIcon);
+ } // ReportLogEntry
+
+ public String getLogTime() {
+ return logTime;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setLogTime(String logTime) {
+ this.logTime = logTime;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public String getTimeTaken() {
+ return timeTaken;
+ }
+
+ public void setTimeTaken(String timeTaken) {
+ this.timeTaken = timeTaken;
+ }
+
+ public String getRunIcon() {
+ return runIcon;
+ }
+
+ public void setRunIcon(String runIcon) {
+ this.runIcon = runIcon;
+ }
+
+} // ReportLogEntry
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportMap.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportMap.java
new file mode 100644
index 00000000..450349c7
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportMap.java
@@ -0,0 +1,82 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+public class ReportMap extends RaptorObject {
+ String markerColor = "";
+ String addressColumn = "";
+ String dataColumn = "";
+ String isMapAllowedYN = "";
+ String addAddressInDataYN = "";
+ List markers = new ArrayList();
+
+ public String getIsMapAllowedYN() {
+ return isMapAllowedYN;
+ }
+ public void setIsMapAllowedYN(String isMapAllowedYN) {
+ this.isMapAllowedYN = isMapAllowedYN;
+ }
+ public ReportMap(String markerColor, String addressColumn, String dataColumn, String isMapAllowed, String addAddressInDataYN){
+ this.setMarkerColor(markerColor);
+ this.setAddressColumn(addressColumn);
+ this.setDataColumn(dataColumn);
+ this.setIsMapAllowedYN(isMapAllowed);
+ this.setAddAddressInDataYN(addAddressInDataYN);
+ }
+ public String getAddressColumn() {
+ return addressColumn;
+ }
+ public void setAddressColumn(String addressColumn) {
+ this.addressColumn = addressColumn;
+ }
+ public String getDataColumn() {
+ return dataColumn;
+ }
+ public void setDataColumn(String dataColumn) {
+ this.dataColumn = dataColumn;
+ }
+ public String getMarkerColor() {
+ return markerColor;
+ }
+ public void setMarkerColor(String markerColor) {
+ this.markerColor = markerColor;
+ }
+ public List getMarkers() {
+ return markers;
+ }
+ public void setMarkers(List markers) {
+ this.markers = markers;
+ }
+ public String getAddAddressInDataYN() {
+ return addAddressInDataYN;
+ }
+ public void setAddAddressInDataYN(String addAddressInDataYN) {
+ this.addAddressInDataYN = addAddressInDataYN;
+ }
+
+
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportSchedule.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportSchedule.java
new file mode 100644
index 00000000..d95c91b5
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportSchedule.java
@@ -0,0 +1,1407 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.Writer;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.error.UserDefinedException;
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.model.base.NameComparator;
+import org.openecomp.portalsdk.analytics.model.runtime.FormField;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportParamValues;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class ReportSchedule extends RaptorObject {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportSchedule.class);
+
+
+ private String reportID = null;
+
+ private String scheduleUserID = null;
+
+ private String scheduleID = "";
+
+ private boolean infoUpdated = false;
+
+ private String schedEnabled = "Y";
+
+ private String startDate = "";
+
+ private String endDate = "";
+
+ private String runDate = "";
+
+ private String runHour = "12";
+
+ private String runMin = "00";
+
+ private String runAMPM = "AM";
+
+ private String endHour = "11";
+
+ private String endMin = "45";
+
+ private String endAMPM = "PM";
+
+ private String recurrence = "";
+
+ private String conditional = "N";
+
+ private String conditionSQL = "";
+
+ private String notify_type = "1"; //1 -- link, 2 -- pdf, 4 -- excel, 3 -- csv
+
+ private String encryptMode = "N"; //1 -- link, 2 -- pdf, 4 -- excel, 3 -- csv
+
+ private String attachment = "Y"; //1 -- link, 2 -- pdf, 4 -- excel, 3 -- csv
+
+ private String downloadLimit = "0";
+
+ private String formFields = "";
+
+ private Vector emailToUsers = new Vector();
+
+ private Vector emailToRoles = new Vector();
+
+ public ReportSchedule(String reportID, String scheduleUserID, boolean loadData, HttpServletRequest request) {
+ super();
+
+ setReportID(reportID);
+ setScheduleUserID(scheduleUserID);
+ if(loadData)
+ loadScheduleData(request);
+ else
+ newScheduleData();
+ } // ReportSchedule
+
+ public ReportSchedule(String reportID, String scheduleID, String scheduleUserID, HttpServletRequest request) {
+ super();
+
+ setReportID(reportID);
+ setScheduleID(scheduleID);
+ setScheduleUserID(scheduleUserID);
+ loadScheduleData(request);
+ } // ReportSchedule
+
+ void setReportID(String reportID) {
+ this.reportID = reportID;
+ }
+
+ public String getSchedEnabled() {
+ return schedEnabled;
+ }
+
+ public String getStartDate() {
+ return startDate;
+ }
+
+ public String getEndDate() {
+ return endDate;
+ }
+
+ public String getRunDate() {
+ return runDate;
+ }
+
+ public String getRunHour() {
+ return runHour;
+ }
+
+ public String getRunMin() {
+ return runMin;
+ }
+
+ public String getRunAMPM() {
+ return runAMPM;
+ }
+
+ public String getRecurrence() {
+ return recurrence;
+ }
+
+ public String getConditional() {
+ return conditional;
+ }
+
+ public String getConditionSQL() {
+ return conditionSQL;
+ }
+
+ public List getEmailToUsers() {
+ return emailToUsers;
+ }
+
+ public List getEmailToRoles() {
+ return emailToRoles;
+ }
+
+ /**
+ * @return the downloadLimit
+ */
+ public String getDownloadLimit() {
+ return downloadLimit;
+ }
+
+ /**
+ * @param downloadLimit the downloadLimit to set
+ */
+ public void setDownloadLimit(String downloadLimit) {
+ if(nvl(downloadLimit).equals(this.downloadLimit))
+ return;
+ this.downloadLimit = nvl(downloadLimit,"0");
+ infoUpdated = true;
+ }
+
+ /**
+ * @return the formFields
+ */
+ public String getFormFields() {
+ return formFields;
+ }
+
+ /**
+ * @param formFields the formFields to set
+ */
+ public void setFormFields(String formFields) {
+ if(nvl(formFields).equals(this.formFields))
+ return;
+ this.formFields = nvl(formFields);
+ infoUpdated = true;
+ }
+
+ public String getNotify_type() {
+ return notify_type;
+ }
+
+ /**
+ * @param notify_type the notify_type to set
+ * 1 -- link (default), 2 -- pdf, 4 -- excel
+ */
+ public void setNotify_type(String notify_type) {
+ if(nvl(notify_type).equals(this.notify_type))
+ return;
+ this.notify_type = nvl(notify_type,"1");
+ infoUpdated = true;
+ }
+
+ public void setSchedEnabled(String schedEnabled) {
+ if (nvl(schedEnabled).equals(this.schedEnabled))
+ return;
+ infoUpdated = true;
+ this.schedEnabled = nvl(schedEnabled, "N");
+ }
+
+ public void setStartDate(String startDate) {
+ if (nvl(startDate).equals(this.startDate))
+ return;
+ infoUpdated = true;
+ this.startDate = nvl(startDate);
+ }
+
+ public void setEndDate(String endDate) {
+ if (nvl(endDate).equals(this.endDate))
+ return;
+ infoUpdated = true;
+ this.endDate = nvl(endDate);
+ }
+
+ public void setRunDate(String runDate) {
+ if (nvl(runDate).equals(this.runDate))
+ return;
+ infoUpdated = true;
+ this.runDate = nvl(runDate);
+ }
+
+ public void setRunHour(String runHour) {
+ if (nvl(runHour).equals(this.runHour))
+ return;
+ infoUpdated = true;
+ this.runHour = nvl(runHour, "12");
+ }
+
+ public void setRunMin(String runMin) {
+ if (nvl(runMin).equals(this.runMin))
+ return;
+ infoUpdated = true;
+ this.runMin = nvl(runMin, "00");
+ }
+
+ public void setRunAMPM(String runAMPM) {
+ if (nvl(runAMPM).equals(this.runAMPM))
+ return;
+ infoUpdated = true;
+ this.runAMPM = nvl(runAMPM, "AM");
+ }
+
+ public void setRecurrence(String recurrence) {
+ if (nvl(recurrence).equals(this.recurrence))
+ return;
+ infoUpdated = true;
+ this.recurrence = nvl(recurrence);
+ }
+
+ public void setConditional(String conditional) {
+ if (nvl(conditional).equals(this.conditional))
+ return;
+ infoUpdated = true;
+ this.conditional = nvl(conditional, "N");
+ }
+
+ public void setConditionSQL(String conditionSQL) {
+ if (nvl(conditionSQL).equals(this.conditionSQL))
+ return;
+ infoUpdated = true;
+ this.conditionSQL = nvl(conditionSQL);
+ }
+
+ public void addEmailToUser(String userId, String userName) {
+ if (nvl(userId).length() == 0)
+ return;
+
+ for (int i = 0; i < emailToUsers.size(); i++) {
+ IdNameValue selUser = (IdNameValue) emailToUsers.get(i);
+ if (userId.equals(selUser.getId()))
+ return;
+ } // for
+
+ emailToUsers.add(new IdNameValue(userId, userName));
+ Collections.sort(emailToUsers, new NameComparator());
+ infoUpdated = true;
+ } // addEmailToUser
+
+
+ public void addEmailArrayToUser(ArrayList<IdNameValue> allSelectedUsers) {
+ if (allSelectedUsers==null || allSelectedUsers.size()<=0)
+ return;
+ emailToUsers.removeAllElements();
+ for (int i = 0; i < allSelectedUsers.size(); i++) {
+ emailToUsers.add(allSelectedUsers.get(i));
+ }
+ Collections.sort(emailToUsers, new NameComparator());
+ infoUpdated = true;
+ } // addEmailArrayToUser
+
+ public void removeEmailToUser(String userId) {
+ if (nvl(userId).length() == 0)
+ return;
+
+ for (int i = 0; i < emailToUsers.size(); i++) {
+ IdNameValue selUser = (IdNameValue) emailToUsers.get(i);
+ if (userId.equals(selUser.getId())) {
+ infoUpdated = true;
+ emailToUsers.remove(i);
+ return;
+ } // if
+ } // for
+ } // removeEmailToUser
+
+ public void addEmailToRole(String roleId, String roleName) {
+ if (nvl(roleId).length() == 0)
+ return;
+
+ for (int i = 0; i < emailToRoles.size(); i++) {
+ IdNameValue selRole = (IdNameValue) emailToRoles.get(i);
+ if (roleId.equals(selRole.getId()))
+ return;
+ } // for
+
+ emailToRoles.add(new IdNameValue(roleId, roleName));
+ Collections.sort(emailToRoles, new NameComparator());
+ infoUpdated = true;
+ } // addEmailToRole
+
+ public void addEmailArrayToRole(ArrayList<IdNameValue> allSelectedRoles) {
+ if (allSelectedRoles==null || allSelectedRoles.size()<=0)
+ return;
+ emailToRoles.removeAllElements();
+ for (int i = 0; i < allSelectedRoles.size(); i++) {
+ emailToRoles.add(allSelectedRoles.get(i));
+ }
+ Collections.sort(emailToRoles, new NameComparator());
+ infoUpdated = true;
+ } // addEmailArrayToRole
+
+ public void removeEmailToRole(String roleId) {
+ if (nvl(roleId).length() == 0)
+ return;
+
+ for (int i = 0; i < emailToRoles.size(); i++) {
+ IdNameValue selRole = (IdNameValue) emailToRoles.get(i);
+ if (roleId.equals(selRole.getId())) {
+ infoUpdated = true;
+ emailToRoles.remove(i);
+ return;
+ } // if
+ } // for
+ } // addEmailToRole
+
+ private void loadScheduleData(HttpServletRequest request) {
+ try {
+ StringBuffer query = new StringBuffer("");
+ //query.append("SELECT rs.enabled_yn, TO_CHAR(rs.start_date, 'MM/DD/YYYY') start_date, TO_CHAR(rs.end_date, 'MM/DD/YYYY') end_date, TO_CHAR(rs.run_date, 'MM/DD/YYYY') run_date, NVL(TO_CHAR(rs.run_date, 'HH'), '12') run_hour, NVL(TO_CHAR(rs.run_date, 'MI'), '00') run_min, NVL(TO_CHAR(rs.run_date, 'AM'), 'AM') run_ampm, rs.recurrence, rs.conditional_yn, rs.notify_type, rs.max_row, rs.initial_formfields, rs.schedule_id, NVL(TO_CHAR(rs.end_date, 'HH'), '11') end_hour, NVL(TO_CHAR(rs.end_date, 'MI'), '45') end_min, NVL(TO_CHAR(rs.end_date, 'AM'), 'PM') end_ampm, encrypt_yn, attachment_yn FROM cr_report_schedule rs WHERE rs.rep_id = "
+ // + reportID);
+ String q_sql = Globals.getLoadScheduleData();
+ q_sql = q_sql.replace("[reportID]", reportID);
+ query.append(q_sql);
+
+ if(!AppUtils.isAdminUser(request))
+ query.append(" and rs.sched_user_id = " + getScheduleUserID());
+ if(nvl(getScheduleID()).length()>0) {
+ query.append(" and rs.schedule_id = " + getScheduleID());
+ }
+ query.append(" order by rs.run_date desc ");
+
+ DataSet ds = DbUtils
+ .executeQuery(query.toString());
+
+ if (ds.getRowCount() > 0) {
+ schedEnabled = nvl(ds.getString(0, 0), "N");
+ startDate = nvl(ds.getString(0, 1));
+ endDate = nvl(ds.getString(0, 2));
+ runDate = nvl(ds.getString(0, 3));
+ runHour = nvl(ds.getString(0, 4), "12");
+ runMin = nvl(ds.getString(0, 5), "00");
+ runAMPM = nvl(ds.getString(0, 6), "AM");
+ recurrence = nvl(ds.getString(0, 7));
+ conditional = nvl(ds.getString(0, 8), "N");
+ //conditionSQL = nvl(ds.getString(0, 9));
+ notify_type = nvl(ds.getString(0, 9), "1");
+ downloadLimit = nvl(ds.getString(0, 10), "1000");
+ //if(nvl(ds.getString(0, 13).)
+ formFields = nvl(ds.getString(0, 11));
+ setScheduleID(ds.getString(0, 12));
+ endHour = nvl(ds.getString(0, 13), "11");
+ endMin = nvl(ds.getString(0, 14), "45");
+ endAMPM = nvl(ds.getString(0, 15), "PM");
+ encryptMode = nvl(ds.getString(0, "encrypt_yn"), "N");
+ attachment = nvl(ds.getString(0, "attachment_yn"), "Y");
+ conditionSQL = loadConditionalSQL(getScheduleID());
+ } else { // if
+ //DataSet dsSeq = DbUtils.executeQuery("select SEQ_CR_REPORT_SCHEDULE.nextval from dual" );
+ String n_sql = Globals.getNewScheduleData();
+ DataSet dsSeq = DbUtils.executeQuery(n_sql);
+ String schedule_id = dsSeq.getString(0,0);
+ setScheduleID(schedule_id);
+ }
+ if(getScheduleID().length() > 0) {
+ //ds = DbUtils
+ // .executeQuery("SELECT rsu.user_id, fuser.last_name||', '||fuser.first_name, fuser.login_id FROM cr_report_schedule_users rsu, fn_user fuser WHERE rsu.rep_id = "
+ // + reportID + " AND rsu.schedule_id = " + getScheduleID() + " and rsu.user_id IS NOT NULL and rsu.user_id = fuser.user_id");
+
+ String t_sql = Globals.getLoadScheduleGetId();
+ t_sql = t_sql.replace("[reportID]", reportID);
+ t_sql = t_sql.replace("[getScheduleID()]", getScheduleID());
+
+ ds = DbUtils.executeQuery(t_sql);
+
+ for (int i = 0; i < ds.getRowCount(); i++){
+ String nameToDisplay = ds.getString(i, 1);
+ if (Globals.getUseLoginIdInSchedYN()!= null && Globals.getUseLoginIdInSchedYN().equals("Y")) {
+ nameToDisplay = ds.getString(i, 2);
+ }
+ if(nameToDisplay!=null && nameToDisplay.length() > 0)
+ emailToUsers.add(new IdNameValue(ds.getString(i, 0), nameToDisplay));
+ else
+ emailToUsers.add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1)));
+ }
+ Collections.sort(emailToUsers, new NameComparator());
+
+ //ds = DbUtils
+ // .executeQuery("SELECT rsu.role_id FROM cr_report_schedule_users rsu WHERE rsu.rep_id = "
+ // + reportID + " AND rsu.schedule_id = " + getScheduleID() + " AND rsu.role_id IS NOT NULL");
+
+ String r_sql = Globals.getLoadScheduleUsers();
+ r_sql = r_sql.replace("[reportID]", reportID);
+ r_sql = r_sql.replace("[getScheduleID()]", getScheduleID());
+
+ ds = DbUtils.executeQuery(r_sql);
+
+ for (int i = 0; i < ds.getRowCount(); i++)
+ emailToRoles.add(new IdNameValue(ds.getString(i, 0), AppUtils.getRoleName(ds
+ .getString(i, 0))));
+ Collections.sort(emailToRoles, new NameComparator());
+
+ infoUpdated = false;
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(
+ "[ReportSchedule.loadScheduleData] Unable to load Report " + reportID
+ + " schedule. Error: " + e.getMessage());
+ }
+ } // loadScheduleData
+
+ private void newScheduleData() {
+ try {
+ //DataSet dsSeq = DbUtils.executeQuery("select SEQ_CR_REPORT_SCHEDULE.nextval from dual" );
+ String sql = Globals.getNewScheduleData();
+ DataSet dsSeq = DbUtils.executeQuery(sql);
+
+ String schedule_id = dsSeq.getString(0,0);
+ setScheduleID(schedule_id);
+ } catch (Exception e) {
+ throw new RuntimeException(
+ "[ReportSchedule.newScheduleData] Unable to load Report " + reportID
+ + " schedule. Error: " + e.getMessage());
+ }
+ } // newScheduleData
+
+ private String parseScheduleSQL(HttpServletRequest request, String sql) throws RaptorException {
+ DataSet ds = null;
+
+ logger.debug(EELFLoggerDelegate.debugLogger, (sql));
+ String[] reqParameters = Globals.getRequestParams().split(",");
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ String[] scheduleSessionParameters = Globals.getSessionParamsForScheduling().split(",");
+ javax.servlet.http.HttpSession session = request.getSession();
+ ReportRuntime rr = (ReportRuntime) session.getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ String userId = AppUtils.getUserID(request);
+ String dbType = "";
+ String dbInfo = rr.getDBInfo();
+ ReportParamValues paramValues = rr.getReportParamValues();
+ int fieldCount = 0;
+ // For Daytona removing all formfields which has null param value
+ Pattern re1 = null;
+ Matcher matcher = null;
+ int index = 0;
+ int posFormField = 0;
+ int posAnd = 0;
+ if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ try {
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ dbType = remDbInfo.getDBType(dbInfo);
+ } catch (Exception ex) {
+ throw new RaptorException(ex);
+ }
+ }
+
+ sql = sql + " ";
+ sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" SELECT ");
+ sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" WHERE ");
+ sql = Pattern.compile("(^[\r\n]*|([\\s]))[Aa][Nn][Dd]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" AND ");
+
+ if (rr.getFormFieldList() != null) {
+ for (Iterator iter = rr.getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+
+ FormFieldType fft = (FormFieldType) iter.next();
+ String fieldId = fft.getFieldId();
+ String fieldDisplay = rr.getFormFieldDisplayName(fft);
+ if(!fft.getFieldType().equals(FormField.FFT_BLANK)) {
+ if (paramValues.isParameterMultiValue(fieldId)) {
+ String replaceValue = rr.formatListValue(fieldDisplay, nvl(paramValues.getParamValue(fieldId)), null, false,
+ true, null, paramValues.getParamBaseSQL(fieldId));
+ if(replaceValue.length() > 0) {
+ sql = Utils.replaceInString(sql, fieldDisplay, replaceValue);
+ } else {
+ fieldCount++;
+ if(fieldCount == 1) {
+ //sql = sql + " ";
+ //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" SELECT ");
+ //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" WHERE ");
+ //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Aa][Nn][Dd]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" AND ");
+ }
+ //sql = getReportSQL();
+ while(sql.indexOf(fieldDisplay) > 0) {
+/* sql = Utils.replaceInString(sql, "SELECT ", "select ");
+ sql = Utils.replaceInString(sql, "WHERE", "where");
+ sql = Utils.replaceInString(sql, " AND ", " and ");
+*/
+ re1 = Pattern.compile("(^[\r\n]|[\\s])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL);
+ //re1 = Pattern.compile("(^[\r\n]|[\\s])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\]", Pattern.DOTALL);
+/* posFormField = sql.indexOf(fieldDisplay);
+ posAnd = sql.lastIndexOf("and", posFormField);
+ if(posAnd < 0) posAnd = 0;
+ else if (posAnd > 2) posAnd = posAnd - 2;
+ matcher = re1.matcher(sql);
+*/
+ posFormField = sql.indexOf(fieldDisplay);
+ int posSelectField = sql.lastIndexOf("SELECT ", posFormField);
+ int whereField = sql.indexOf(" WHERE" , posSelectField);
+ int andField = 0;
+ if(posFormField > whereField)
+ andField = sql.lastIndexOf(" AND ", posFormField);
+ if (posFormField > andField && andField > whereField)
+ posAnd = andField;
+ else
+ posAnd = 0;
+ matcher = re1.matcher(sql);
+
+
+ if (posAnd > 0 && matcher.find(posAnd-1)) {
+ //sql = Utils.replaceInString(sql, matcher.group(), " ");
+ matcher = re1.matcher(sql);
+ index = sql!=null?sql.lastIndexOf("["+fft.getFieldName()+"]"):-1;
+
+ if(andField>0)
+ index = andField;
+ else
+ index = whereField;
+ if(index >= 0 && matcher.find(index-1)) {
+ sql = sql.replace(matcher.group(), " ");
+ }
+ } else {
+
+ //sql = sql.replace
+ re1 = Pattern.compile("(^[\r\n]|[\\s])WHERE(.*?[^\r\n]*)\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL);
+ matcher = re1.matcher(sql);
+ if(matcher.find(whereField-1)) {
+ matcher = re1.matcher(sql);
+ index = sql!=null?sql.lastIndexOf("["+fft.getFieldName()+"]"):-1;
+ if(index >= 0 && matcher.find(index-30)) {
+ sql = sql.replace(matcher.group(), " WHERE 1=1 ");
+ }
+ //sql = Utils.replaceInString(sql, matcher.group(), " where 1=1 ");
+ } /*else {
+ replaceValue = formatListValue("", Utils
+ .oracleSafe(nvl(paramValues.getParamValue(fieldId))), null, false,
+ true, null, paramValues.getParamBaseSQL(fieldId));
+ sql = Utils.replaceInString(sql, fieldDisplay, replaceValue);
+ }*/
+
+ }
+ }
+ }
+
+ //sql = Utils.replaceInString(sql, " select ", " SELECT ");
+ //sql = Utils.replaceInString(sql, " where ", " WHERE ");
+ //sql = Utils.replaceInString(sql, " and ", " AND ");
+
+ } else {
+ String paramValue = "";
+ if(paramValues.isParameterTextAreaValueAndModified(fieldId)) {
+ String value = "";
+ value = nvl(paramValues
+ .getParamValue(fieldId));
+// value = Utils.oracleSafe(nvl(value));
+// if (!(dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT"))) {
+// value = "('" + Utils.replaceInString(value, ",", "'|'") + "')";
+// value = Utils.replaceInString(value, "|", ",");
+// paramValue = XSSFilter.filterRequestOnlyScript(value);
+// } else if (nvl(value.trim()).length()>0) {
+// value = "('" + Utils.replaceInString(value, ",", "'|'") + "')";
+// value = Utils.replaceInString(value, "|", ",");
+// paramValue = XSSFilter.filterRequestOnlyScript(value);
+// }
+ paramValue = value;
+ } else
+ paramValue = nvl(paramValues
+ .getParamValue(fieldId));
+
+ if (paramValue!=null && paramValue.length() > 0) {
+ if(paramValue.toLowerCase().trim().startsWith("select ")) {
+ paramValue = Utils.replaceInString(paramValue, "[LOGGED_USERID]", userId);
+ paramValue = Utils.replaceInString(paramValue, "[USERID]", userId);
+ paramValue = Utils.replaceInString(paramValue, "[USER_ID]", userId);
+
+ paramValue = Utils.replaceInString(paramValue, "''", "'");
+ ds = ConnectionUtils.getDataSet(paramValue, dbInfo);
+ if (ds.getRowCount() > 0) paramValue = ds.getString(0, 0);
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, ("SQLSQLBASED B4^^^^^^^^^ " + sql + " " + fft.getValidationType() + " " + fft.getFieldName() + " " + fft.getFieldId()));
+ if(fft!=null && (fft.getValidationType()!=null && (fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) ||fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC) ||fft.getValidationType().equals(FormField.VT_DATE) ))) {
+ //System.out.println("paramValues.getParamValue(fieldId_Hr) Inside if " + fft.getValidationType() + " " + fieldDisplay);
+ if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)) {
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue) +((nvl(paramValues
+ .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(nvl(paramValues
+ .getParamValue(fieldId+"_Hr") ) ):""));
+ }
+ else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)) {
+/* System.out.println("paramValues.getParamValue(fieldId_Hr)" + paramValues
+ .getParamValue(fieldId+"_Hr") + " " + paramValues
+ .getParamValue(fieldId+"_Min")) ;
+*/ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue) + ((nvl(paramValues
+ .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(nvl(paramValues
+ .getParamValue(fieldId+"_Hr") ) ):"") + ((nvl(paramValues
+ .getParamValue(fieldId+"_Min") ).length()>0)?":" + addZero(nvl(paramValues
+ .getParamValue(fieldId+"_Min") ) ) : "") ) ;
+ }
+ else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue) + ((nvl(paramValues
+ .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(nvl(paramValues
+ .getParamValue(fieldId+"_Hr") ) ):"") + ((nvl(paramValues
+ .getParamValue(fieldId+"_Min") ).length()>0)?":" + addZero(nvl(paramValues
+ .getParamValue(fieldId+"_Min") ) ) : "") + ((nvl(paramValues
+ .getParamValue(fieldId+"_Sec") ).length()>0)?":"+addZero(nvl(paramValues
+ .getParamValue(fieldId+"_Sec") ) ) : "" ) ) ;
+ } else {
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));
+ }
+
+
+ } else {
+ if(paramValue!=null && paramValue.length() > 0) {
+ if(sql.indexOf("'"+fieldDisplay+"'")!=-1 || sql.indexOf("'"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"'")!=-1
+ || sql.indexOf("'%"+fieldDisplay+"%'")!=-1 || sql.indexOf("'%"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"%'")!=-1
+ || sql.indexOf("'_"+fieldDisplay+"_'")!=-1 || sql.indexOf("'_"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"_'")!=-1
+ || sql.indexOf("'%_"+fieldDisplay+"_%'")!=-1 || sql.indexOf("^"+fieldDisplay+"^")!=-1 || sql.indexOf("'%_"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"_%'")!=-1) {
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));
+ } else {
+ if(sql.indexOf(fieldDisplay)!=-1) {
+ if(nvl(paramValue).length()>0) {
+ try {
+ double vD = Double.parseDouble(paramValue);
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));
+
+ } catch (NumberFormatException ex) {
+ if (/*dbType.equals("DAYTONA") &&*/ sql.trim().toUpperCase().startsWith("SELECT")) {
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));
+ } else
+ throw new UserDefinedException("Expected number, Given String for the form field \"" + fieldDisplay+"\"");
+ }
+ /*sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));*/
+ } else
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));
+
+ }
+ }
+ }
+ else {
+ if (dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT")) {
+ sql = sql + " ";
+ re1 = Pattern.compile("(^[\r\n]|[\\s]|[^0-9a-zA-Z])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL);
+ posFormField = sql.indexOf(fieldDisplay);
+ posAnd = sql.lastIndexOf(" AND ", posFormField);
+ if(posAnd < 0) posAnd = 0;
+ else if (posAnd > 2) posAnd = posAnd - 2;
+ matcher = re1.matcher(sql);
+ if (matcher.find(posAnd)) {
+ sql = sql.replace(matcher.group(), "");
+ }
+ } else {
+ sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl(
+ paramValue, "NULL"));
+ sql = Utils.replaceInString(sql, fieldDisplay, nvl(
+ paramValue, "NULL"));
+ }
+ }
+ }
+
+ }
+
+ if (dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT")) {
+ sql = sql + " ";
+ re1 = Pattern.compile("(^[\r\n]|[\\s]|[^0-9a-zA-Z])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); //+[\'\\)|\'|\\s]
+ posFormField = sql.indexOf(fieldDisplay);
+ posAnd = sql.lastIndexOf(" AND ", posFormField);
+ if(posAnd < 0) posAnd = 0;
+ else if (posAnd > 2) posAnd = posAnd - 2;
+ matcher = re1.matcher(sql);
+ if (matcher.find(posAnd)) {
+ sql = sql.replace(matcher.group(), " ");
+ }
+ } else {
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("ParamValue |" + paramValue + "| Sql |" + sql + "| Multi Value |" + paramValues.isParameterMultiValue(fieldId)));
+ sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl(
+ paramValue, "NULL"));
+ sql = Utils.replaceInString(sql, fieldDisplay , nvl(
+ paramValue, "NULL"));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("SQLSQLBASED AFTER^^^^^^^^^ " + sql));
+ }
+
+ } // else
+ } // if BLANK
+ } // for
+ if(request != null ) {
+ for (int i = 0; i < reqParameters.length; i++) {
+ if(!reqParameters[i].startsWith("ff")) {
+ if (nvl(request.getParameter(reqParameters[i].toUpperCase())).length() > 0)
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) );
+ }
+ else
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) );
+ }
+
+ for (int i = 0; i < scheduleSessionParameters.length; i++) {
+ if(nvl(request.getParameter(scheduleSessionParameters[i])).trim().length()>0 )
+ sql = Utils.replaceInString(sql, "[" + scheduleSessionParameters[i].toUpperCase()+"]", request.getParameter(scheduleSessionParameters[i]) );
+ }
+ }
+ if(session != null ) {
+ for (int i = 0; i < sessionParameters.length; i++) {
+ //if(!sessionParameters[i].startsWith("ff"))
+ // paramValue = Utils.replaceInString(paramValue, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i].toUpperCase()) );
+ // else {
+ logger.debug(EELFLoggerDelegate.debugLogger, (" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i])));
+ sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ //}
+ }
+ }
+ } else {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("BEFORE LOGGED USERID REPLACE " + sql));
+ //sql = Utils.replaceInString(sql, "'[logged_userId]'", "'"+userId+"'");
+ //debugLogger.debug("Replacing string 2 " + sql);
+ sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId);
+ sql = Utils.replaceInString(sql, "[USERID]", userId);
+ sql = Utils.replaceInString(sql, "[USER_ID]", userId);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("AFTER LOGGED USERID REPLACE " + sql));
+ // Added for Simon's GM Project where they need to get page_id in their query
+ logger.debug(EELFLoggerDelegate.debugLogger, ("SQLSQLBASED no formfields " + sql));
+ if(request != null ) {
+ for (int i = 0; i < reqParameters.length; i++) {
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) );
+ }
+ }
+ if(session != null ) {
+ for (int i = 0; i < sessionParameters.length; i++) {
+ logger.debug(EELFLoggerDelegate.debugLogger, (" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i])));
+ sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ }
+ }
+ }
+ // if it is not multiple select and ParamValue is empty this is the place it can be replaced.
+ sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId);
+ sql = Utils.replaceInString(sql, "[USERID]", userId);
+ sql = Utils.replaceInString(sql, "[USER_ID]", userId);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("SQLSQLBASED no formfields after" + sql));
+ //debugLogger.debug("Replacing String 2 "+ sql);
+ //debugLogger.debug("Replaced String " + sql);
+
+ sql = Pattern.compile("([\n][\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" ");
+ return sql;
+
+ }
+ public void persistScheduleData(Connection conn, HttpServletRequest request) throws RaptorException {
+ if (!infoUpdated)
+ return;
+ if (reportID.equals("-1"))
+ return;
+
+
+ try {
+ String sched_id = "";
+ StringBuffer query = new StringBuffer("");
+ query.append(" SELECT 1 FROM cr_report_schedule WHERE rep_id = " + reportID + " and schedule_id = " + getScheduleID());
+ if(!AppUtils.isAdminUser(request))
+ query.append(" and sched_user_id = " + getScheduleUserID());
+ DataSet ds = DbUtils.executeQuery(conn, query.toString());
+ if (ds.getRowCount() > 0) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("UPDATE cr_report_schedule SET enabled_yn = '");
+ sb.append(getSchedEnabled());
+ sb.append("', start_date = ");
+ if (getStartDate().length() > 0) {
+ sb.append("TO_DATE('");
+ sb.append(getStartDate());
+ sb.append("', 'MM/DD/YYYY')");
+ } else
+ sb.append("NULL");
+ sb.append(", end_date = ");
+ if (getEndDate().length() > 0) {
+ sb.append("TO_DATE('");
+ sb.append(getEndDate());
+ sb.append(" ");
+ sb.append(getEndHour());
+ sb.append(":");
+ sb.append(getEndMin());
+ sb.append(" ");
+ sb.append(getEndAMPM());
+ sb.append("', 'MM/DD/YYYY HH:MI AM')");
+ } else
+ sb.append("NULL");
+ sb.append(", run_date = ");
+ if (getRunDate().length() > 0) {
+ sb.append("TO_DATE('");
+ sb.append(getRunDate());
+ sb.append(" ");
+ sb.append(getRunHour());
+ sb.append(":");
+ sb.append(getRunMin());
+ sb.append(" ");
+ sb.append(getRunAMPM());
+ sb.append("', 'MM/DD/YYYY HH:MI AM')");
+ } else
+ sb.append("NULL");
+ sb.append(", recurrence = ");
+ if (getRecurrence().length() > 0) {
+ sb.append("'");
+ sb.append(getRecurrence());
+ sb.append("'");
+ } else
+ sb.append("NULL");
+ sb.append(", conditional_yn = '");
+ sb.append(getConditional());
+ //sb.append("', condition_sql = ");
+ sb.append("'");
+/* if (getConditionSQL().length() > 0) {
+ sb.append("'");
+ sb.append(parseScheduleSQL(request, Utils.oracleSafe(getConditionSQL())));
+ sb.append("'");
+ } else
+ sb.append("NULL");
+*/
+ sb.append(", notify_type = ");
+ sb.append(getNotify_type());
+ sb.append(", encrypt_yn = '");
+ sb.append(getEncryptMode()+"'");
+ sb.append(", attachment_yn = '");
+ sb.append(getAttachmentMode()+"'");
+ sb.append(", max_row = ");
+ sb.append(getDownloadLimit());
+ sb.append(", initial_formFields = '");
+ sb.append(getFormFields()+"'");
+ sb.append(", processed_formfields = ''");
+ sb.append(" WHERE rep_id = ");
+ sb.append(reportID + " and sched_user_id = ");
+ sb.append(getScheduleUserID());
+ sb.append(" and schedule_id = ");
+ sb.append(getScheduleID());
+
+ DbUtils.executeUpdate(conn, sb.toString());
+ } else {
+ //DataSet dsSeq = DbUtils.executeQuery("select seq_cr_report_schedule.nextval from dual " );
+ String w_sql = Globals.getNewScheduleData();
+ DataSet dsSeq = DbUtils.executeQuery(w_sql);
+ String schedule_id = dsSeq.getString(0,0);
+ setScheduleID(schedule_id);
+ StringBuffer sb = new StringBuffer();
+ sb.append("INSERT INTO cr_report_schedule (schedule_id, sched_user_id, rep_id, enabled_yn, start_date, end_date, run_date, recurrence, conditional_yn, notify_type, max_row, initial_formfields, encrypt_yn, attachment_yn) VALUES(");
+ sb.append(getScheduleID() + ", ");
+ sb.append(getScheduleUserID() + ", ");
+ sb.append(reportID);
+ sb.append(", '");
+ sb.append(getSchedEnabled());
+ sb.append("', ");
+ if (getStartDate().length() > 0) {
+ sb.append("TO_DATE('");
+ sb.append(getStartDate());
+ sb.append("', 'MM/DD/YYYY')");
+ } else
+ sb.append("NULL");
+ sb.append(", ");
+ if (getEndDate().length() > 0) {
+ sb.append("TO_DATE('");
+ sb.append(getEndDate());
+ sb.append(" ");
+ sb.append(getEndHour());
+ sb.append(":");
+ sb.append(getEndMin());
+ sb.append(" ");
+ sb.append(getEndAMPM());
+ sb.append("', 'MM/DD/YYYY HH:MI AM')");
+ } else
+ sb.append("NULL");
+ sb.append(", ");
+ if (getRunDate().length() > 0) {
+ sb.append("TO_DATE('");
+ sb.append(getRunDate());
+ sb.append(" ");
+ sb.append(getRunHour());
+ sb.append(":");
+ sb.append(getRunMin());
+ sb.append(" ");
+ sb.append(getRunAMPM());
+ sb.append("', 'MM/DD/YYYY HH:MI AM')");
+ } else
+ sb.append("NULL");
+ sb.append(", ");
+ if (getRecurrence().length() > 0) {
+ sb.append("'");
+ sb.append(getRecurrence());
+ sb.append("'");
+ } else
+ sb.append("NULL");
+ sb.append(", '");
+ sb.append(getConditional());
+ sb.append("', ");
+/* if (getConditionSQL().length() > 0) {
+ sb.append("'");
+ sb.append(parseScheduleSQL(request, Utils.oracleSafe(getConditionSQL())));
+ sb.append("'");
+ } else
+ sb.append("NULL");
+ sb.append(", ");
+*/
+ sb.append(getNotify_type());
+ sb.append(", ");
+ sb.append(getDownloadLimit());
+ sb.append(", '");
+ sb.append(getFormFields()+"'");
+ sb.append(",'");
+ sb.append(getEncryptMode()+"'");
+ sb.append(",'");
+ sb.append(getAttachmentMode()+"'");
+ sb.append(")");
+ DbUtils.executeUpdate(conn, sb.toString());
+
+ } // else
+
+
+ //DbUtils.executeUpdate(conn,
+ // "DELETE cr_report_schedule_users WHERE rep_id = " + reportID+ " and schedule_id = " + getScheduleID());
+
+ String d_sql = Globals.getExecuteUpdate();
+ d_sql = d_sql.replace("[reportID]", reportID);
+ d_sql = d_sql.replace("[getScheduleID()]", getScheduleID());
+
+ DbUtils.executeUpdate(conn, d_sql);
+
+ for (int i = 0; i < emailToUsers.size(); i++){
+ //DbUtils.executeUpdate(conn,
+ // "INSERT INTO cr_report_schedule_users (schedule_id, rep_id, user_id, role_id, order_no) VALUES("
+ // + getScheduleID() + ", "
+ // + reportID + ", "
+ // + ((IdNameValue) emailToUsers.get(i)).getId() + ", NULL, "
+ // + (i + 1) + ")");
+
+ String sql = Globals.getExecuteUpdateUsers();
+ sql = sql.replace("[getScheduleID()]", getScheduleID());
+ sql = sql.replace("[reportID]", reportID);
+ sql = sql.replace("[emailToUsers.get(i)).getId()]", ((IdNameValue) emailToUsers.get(i)).getId());
+ sql = sql.replace("[(i + 1)]", String.valueOf(i + 1));
+ DbUtils.executeUpdate(conn, sql);
+
+ }
+ for (int i = 0; i < emailToRoles.size(); i++){
+ //DbUtils.executeUpdate(conn,
+ // "INSERT INTO cr_report_schedule_users (schedule_id, rep_id, user_id, role_id, order_no) VALUES("
+ // + getScheduleID() +", "
+ // + reportID + ", NULL, "
+ // + ((IdNameValue) emailToRoles.get(i)).getId() + ", "
+ // + (emailToUsers.size() + i + 1) + ")");
+
+ String sql = Globals.getExecuteUpdateRoles();
+ sql = sql.replace("[getScheduleID()]", getScheduleID());
+ sql = sql.replace("[reportID]", reportID);
+ sql = sql.replace("[emailToRoles.get(i)).getId()]", ((IdNameValue) emailToRoles.get(i)).getId());
+ sql = sql.replace("[((emailToUsers.size() + i + 1)]", String.valueOf(emailToUsers.size() + i + 1));
+
+ DbUtils.executeUpdate(conn, sql);
+ }
+ //if (conn == null)
+ DbUtils.commitTransaction(conn);
+
+ persistConditionSql(conn, getScheduleID(), parseScheduleSQL(request, getConditionSQL()));
+
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB update report " + reportID + " - schedule data updated"));
+ //DbUtils.executeUpdate(conn,
+ // "INSERT into cr_schedule_activity_log (schedule_id, notes, run_time) values ("+getScheduleID()+",'Submitted:Schedule',TO_DATE('"+ getRunDate()+" "+ getRunHour()+":"+getRunMin()+" "+getRunAMPM()+"', 'MM/DD/YYYY HH:MI AM'))");
+ String e_sql = Globals.getExecuteUpdateActivity();
+ e_sql = e_sql.replace("[getScheduleID()]", getScheduleID());
+ e_sql = e_sql.replace("[getRunDate()]", getRunDate());
+ e_sql = e_sql.replace("[getRunHour()]", getRunHour());
+ e_sql = e_sql.replace("[getRunMin()]", getRunMin());
+ e_sql = e_sql.replace("[getRunAMPM()]", getRunAMPM());
+
+ DbUtils.executeUpdate(conn, e_sql);
+
+ infoUpdated = false;
+
+ } catch (RaptorException e) {
+ if (conn != null)
+ DbUtils.rollbackTransaction(conn);
+ throw e;
+ } // catch
+
+ } // persistScheduleData
+
+ //deleting the schedule - Start
+ public void deleteScheduleData(Connection conn) throws RaptorException {
+ if (reportID.equals("-1"))
+ return;
+
+ Connection connection = (conn != null) ? conn : DbUtils.startTransaction();
+ String sched_id = "";
+ try {
+ //DataSet ds = DbUtils.executeQuery(connection,
+ // "SELECT 1 FROM cr_report_schedule WHERE rep_id = " + reportID +" and sched_user_id = " + getScheduleUserID() + " and schedule_id = " + getScheduleID());
+ String a_sql = Globals.getDeleteScheduleData();
+ a_sql = a_sql.replace("[reportID]", reportID);
+ a_sql = a_sql.replace("[getScheduleUserID()]", getScheduleUserID());
+ a_sql = a_sql.replace("[getScheduleID()]", getScheduleID());
+ DataSet ds = DbUtils.executeQuery(connection, a_sql);
+
+ if (ds.getRowCount() > 0) {
+ //DbUtils.executeUpdate(connection,
+ // "DELETE cr_report_schedule_users WHERE rep_id = " + reportID+ " and schedule_id = " + getScheduleID());
+ String b_sql = Globals.getDeleteScheduleDataUsers();
+ b_sql = b_sql.replace("[reportID]", reportID);
+ b_sql = b_sql.replace("[getScheduleID()]", getScheduleID());
+
+ DbUtils.executeUpdate(connection, b_sql);
+
+ StringBuffer sb = new StringBuffer();
+ String c_sql = Globals.getDeleteScheduleDataId();
+ c_sql = c_sql.replace("[reportID]", reportID);
+ c_sql = c_sql.replace("[getScheduleUserID()]", getScheduleUserID());
+ c_sql = c_sql.replace("[getScheduleID()]", getScheduleID());
+
+ sb.append(c_sql);
+ //sb.append("DELETE FROM cr_report_schedule where rep_id = " + reportID +" and sched_user_id = " + getScheduleUserID() + " and schedule_id = " + getScheduleID());
+
+ DbUtils.executeUpdate(connection, sb.toString());
+ }
+ if (conn == null)
+ DbUtils.commitTransaction(connection);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB update report " + reportID + " - schedule data deleted"));
+ } catch (RaptorException e) {
+ if (conn == null)
+ DbUtils.rollbackTransaction(connection);
+ throw e;
+ } // catch
+ finally {
+ if (conn == null)
+ DbUtils.clearConnection(connection);
+ }
+ } //deleteScheduleData
+
+ public String getScheduleUserID() {
+ return scheduleUserID;
+ }
+
+ public void setScheduleUserID(String scheduleUserID) {
+ this.scheduleUserID = scheduleUserID;
+ }
+
+ public String getScheduleID() {
+ return nvl(scheduleID);
+ }
+
+ public void setScheduleID(String scheduleID) {
+ this.scheduleID = scheduleID;
+ }
+
+ public String getEndAMPM() {
+ return endAMPM;
+ }
+
+ public void setEndAMPM(String endAMPM) {
+ if (nvl(endAMPM).equals(this.endAMPM))
+ return;
+ infoUpdated = true;
+ this.endAMPM = nvl(endAMPM, "PM");
+ }
+
+ public String getEndHour() {
+ return endHour;
+ }
+
+ public void setEndHour(String endHour) {
+ if (nvl(endHour).equals(this.endHour))
+ return;
+ infoUpdated = true;
+ this.endHour = nvl(endHour, "11");
+ }
+
+ public String getEndMin() {
+ return endMin;
+ }
+
+ public void setEndMin(String endMin) {
+ if (nvl(endMin).equals(this.endMin))
+ return;
+ infoUpdated = true;
+ this.endMin = nvl(endMin, "45");
+ }
+
+ public static boolean isNull(String a) {
+ if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null"))
+ return true;
+ else
+ return false;
+ }
+
+ public String addZero(String num) {
+ int numInt = 0;
+ try {
+ numInt = Integer.parseInt(num);
+ }catch(NumberFormatException ex){
+ numInt = 0;
+ }
+ if(numInt < 10) return "0"+numInt;
+ else return ""+numInt;
+ }
+
+ public static String loadConditionalSQL(String scheduleId)
+ throws RaptorException {
+ StringBuffer sb = new StringBuffer();
+
+ PreparedStatement stmt = null;
+
+ ResultSet rs = null;
+ String condition_sql = "";
+ Connection connection = null;
+
+ try {
+ connection = DbUtils.getConnection();
+
+ //String sql = "SELECT condition_large_sql FROM cr_report_schedule WHERE schedule_id=?";
+ String sql = Globals.getLoadCondSql();
+ stmt = connection.prepareStatement(sql);
+ stmt.setString(1,scheduleId);
+ rs = stmt.executeQuery();
+ if(Globals.isWeblogicServer()) {
+ java.sql.Clob clob= null;
+ Object obj = null;
+ if (rs.next()) {
+ clob = rs.getClob(1);
+ }
+ else
+ throw new RuntimeException("Schedule ID " + scheduleId + " not found in the database");
+
+ int len = 0;
+ char[] buffer = new char[512];
+ Reader in = null;
+ in = new InputStreamReader(clob.getAsciiStream());
+ // if(obj instanceof oracle.sql.CLOB) {
+ // in = ((oracle.sql.CLOB) obj).getCharacterStream();
+ // } else if (obj instanceof weblogic.jdbc.wrapper.Clob) {
+ // in = ((weblogic.jdbc.base.BaseClob) obj).getCharacterStream();
+ // }
+ while ((len = in.read(buffer)) != -1)
+ sb.append(buffer, 0, len);
+ in.close();
+ } else if (Globals.isPostgreSQL() || Globals.isMySQL()) {
+ String clob= null;
+ Object obj = null;
+ if (rs.next()) {
+ sb.append(rs.getString(1));
+ }
+ else
+ throw new RaptorException("Schedule ID " + scheduleId + " not found in the database");
+ } else {
+ /*oracle.sql.CLOB clob = null;
+ if (rs.next())
+ clob = (oracle.sql.CLOB) rs.getObject(1);
+ else
+ throw new RuntimeException("Schedule ID " + scheduleId + " not found in the database");
+ int len = 0;
+ char[] buffer = new char[512];
+ Reader in = null;
+ if(clob!=null) {
+ in = clob.getCharacterStream();
+ while ((len = in.read(buffer)) != -1)
+ sb.append(buffer, 0, len);
+ in.close();
+ }*/
+ throw new RaptorException("only maria db support for this ");
+
+ }
+ } catch (SQLException ex) {
+ try {
+ StringBuffer query = new StringBuffer("");
+
+ query.append(" SELECT condition_sql FROM cr_report_schedule WHERE schedule_id = " + scheduleId);
+ DataSet ds = DbUtils.executeQuery(query.toString());
+ if(ds.getRowCount()>0) {
+ condition_sql = ds.getString(0,0);
+ }
+ return condition_sql;
+ //throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ } catch (RaptorException e) {
+ DbUtils.rollbackTransaction(connection);
+ throw e;
+ } // catch
+
+ finally {
+ DbUtils.clearConnection(connection);
+ }
+
+ } catch (IOException ex) {
+ throw new RaptorRuntimeException (ex.getMessage(), ex.getCause());
+ } finally {
+ try {
+ if (connection != null)
+ DbUtils.clearConnection(connection);
+ if(rs!=null)
+ rs.close();
+ if(stmt!=null)
+ stmt.close();
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ }
+ }
+ return sb.toString();
+ } // loadConditionalSQL
+
+ private static void persistConditionSql(Connection connection, String scheduleId, String conditional_sql) throws RaptorException {
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+
+ try {
+ //String sql = "update cr_report_schedule set condition_large_sql = EMPTY_CLOB() where schedule_id = " + scheduleId;
+ String sql = Globals.getPersistCondSqlUpdate();
+ sql = sql.replace("[scheduleId]", scheduleId);
+
+ DbUtils.executeUpdate(sql);
+ //sql = "SELECT condition_large_sql FROM cr_report_schedule cr WHERE schedule_id=? FOR UPDATE";
+ sql = Globals.getPersistCondSqlLarge();
+ stmt = connection.prepareStatement(sql);
+ stmt.setString(1,scheduleId);
+ rs = stmt.executeQuery();
+ Writer out = null;
+ /*if(Globals.isWeblogicServer()) {
+ java.sql.Clob clob = null;
+ if (rs.next())
+ clob = rs.getClob(1);
+ else
+ throw new RuntimeException("Schedule ID " + scheduleId + " not found in the database");
+
+ if (clob.length() > conditional_sql.length())
+ clob.truncate(0);
+ //clob.trim(reportXML.length());
+ out = ((weblogic.jdbc.vendor.oracle.OracleThinClob)clob).getCharacterOutputStream();
+ } else*/
+ if (Globals.isPostgreSQL() || Globals.isMySQL()) {
+ if (rs.next()) {
+ rs.updateString(1,conditional_sql);
+ rs.updateRow();
+ //sb.append(rs.getString(1));
+ }
+ else
+ throw new RaptorException("Schedule ID " + scheduleId + " not found in the database");
+ } else {/*
+ oracle.sql.CLOB clob = null;
+ if (rs.next())
+ clob = (oracle.sql.CLOB) rs.getObject(1);
+ else
+ throw new RuntimeException("Schedule ID " + scheduleId + " not found in the database");
+
+ if (clob.length() > conditional_sql.length())
+ clob.trim(conditional_sql.length());
+ out = clob.getCharacterOutputStream();*/
+ throw new RaptorException("only maria db support for this ");
+
+ }
+ out.write(conditional_sql);
+ out.flush();
+ out.close();
+ } catch (RaptorException ex) {
+ if(ex.getMessage().indexOf("invalid identifier")!= -1) {
+ try {
+ //String sql = "update cr_report_schedule set condition_sql = ? where schedule_id = " + scheduleId;
+ String sql = Globals.getPersistCondSqlSet();
+ sql = sql.replace("[scheduleId]", scheduleId);
+ stmt = connection.prepareStatement(sql);
+ stmt.setString(1,conditional_sql);
+ stmt.executeUpdate();
+ connection.commit();
+ } catch (SQLException ex1) {
+ try {
+ connection.rollback();
+ } catch (SQLException ex2) {}
+
+ }
+ } else {
+ try {
+ connection.rollback();
+ } catch (SQLException ex2) {
+ throw new ReportSQLException (ex2.getMessage(), ex2.getCause());
+ }
+ }
+ } catch (SQLException ex) {
+ try {
+ connection.rollback();
+ } catch (SQLException ex2) {
+ throw new ReportSQLException (ex2.getMessage(), ex2.getCause());
+ }
+ } catch (IOException ex) {
+ throw new RaptorRuntimeException (ex.getMessage(), ex.getCause());
+ } finally {
+ try {
+ if(rs!=null)
+ rs.close();
+ if(stmt!=null)
+ stmt.close();
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ }
+ }
+ } // persistConditionSql
+
+ /**
+ * Used to get encryption mode
+ * @return the encryptMode
+ */
+ public String getEncryptMode() {
+ return encryptMode;
+ }
+
+ /**
+ * Used to set encryption mode
+ * @param encryptMode the encryptMode to set
+ */
+ public void setEncryptMode(String encryptMode) {
+ this.encryptMode = encryptMode;
+ infoUpdated = true;
+ }
+
+
+ /**
+ * Used to get Attachment mode
+ * @return the attachment
+ */
+ public String getAttachmentMode() {
+ return attachment;
+ }
+
+ public boolean isAttachmentMode() {
+ return nvl(attachment).toUpperCase().startsWith("Y");
+ }
+
+ /**
+ * Used to set Attachment mode
+ * @param attachment to set
+ */
+ public void setAttachmentMode(String attachment) {
+ this.attachment = attachment;
+ infoUpdated = true;
+ }
+} // ReportSchedule
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/SecurityEntry.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/SecurityEntry.java
new file mode 100644
index 00000000..4feddd6e
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/SecurityEntry.java
@@ -0,0 +1,44 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+
+public class SecurityEntry extends IdNameValue {
+ private boolean readOnly = true;
+
+ public SecurityEntry() {
+ super();
+ }
+
+ public SecurityEntry(String id, String name, boolean readOnly) {
+ super(id, name);
+ setReadOnly(readOnly);
+ } // SecurityEntry
+
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+ public void setReadOnly(boolean readOnly) {
+ this.readOnly = readOnly;
+ }
+
+} // SecurityEntry
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableJoin.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableJoin.java
new file mode 100644
index 00000000..6022d5a1
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableJoin.java
@@ -0,0 +1,67 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+public class TableJoin extends RaptorObject {
+ private String srcTableName = null;
+
+ private String destTableName = null;
+
+ private String joinExpr = null;
+
+ public TableJoin() {
+ super();
+ }
+
+ public TableJoin(String srcTableName, String destTableName, String joinExpr) {
+ this();
+
+ setSrcTableName(srcTableName);
+ setDestTableName(destTableName);
+ setJoinExpr(joinExpr);
+ } // TableJoin
+
+ public String getSrcTableName() {
+ return srcTableName;
+ }
+
+ public String getDestTableName() {
+ return destTableName;
+ }
+
+ public String getJoinExpr() {
+ return joinExpr;
+ }
+
+ public void setSrcTableName(String srcTableName) {
+ this.srcTableName = srcTableName;
+ }
+
+ public void setDestTableName(String destTableName) {
+ this.destTableName = destTableName;
+ }
+
+ public void setJoinExpr(String joinExpr) {
+ this.joinExpr = joinExpr;
+ }
+
+} // TableJoin
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableSource.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableSource.java
new file mode 100644
index 00000000..dc5b385a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableSource.java
@@ -0,0 +1,101 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+public class TableSource extends RaptorObject {
+ private String tableName = null;
+
+ private String displayName = null;
+
+ private String pkFields = null;
+
+ private String viewAction = null;
+
+ private String isLargeData = null;
+
+ private String filterSql = null;
+
+ public TableSource() {
+ super();
+ }
+
+ public TableSource(String tableName, String displayName, String pkFields,
+ String viewAction, String isLargeData, String filterSql) {
+ this();
+
+ setTableName(tableName);
+ setDisplayName(displayName);
+ setPkFields(pkFields);
+ setViewAction(viewAction);
+ setIsLargeData(isLargeData);
+ setFilterSql(filterSql);
+ } // TableSource
+
+ public String getTableName() {
+ return tableName;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public String getPkFields() {
+ return pkFields;
+ }
+
+ public String getViewAction() {
+ return viewAction;
+ }
+
+ public String getIsLargeData() {
+ return isLargeData;
+ }
+
+ public String getFilterSql() {
+ return filterSql;
+ }
+
+ public void setTableName(String tableName) {
+ this.tableName = tableName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public void setPkFields(String pkFields) {
+ this.pkFields = pkFields;
+ }
+
+ public void setViewAction(String viewAction) {
+ this.viewAction = viewAction;
+ }
+
+ public void setIsLargeData(String isLargeData) {
+ this.isLargeData = isLargeData;
+ }
+
+ public void setFilterSql(String filterSql) {
+ this.filterSql = filterSql;
+ }
+
+} // TableSource
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PageEvent.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PageEvent.java
new file mode 100644
index 00000000..34e38062
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PageEvent.java
@@ -0,0 +1,256 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.pdf;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+
+import com.lowagie.text.BadElementException;
+import com.lowagie.text.Cell;
+import com.lowagie.text.Document;
+import com.lowagie.text.ExceptionConverter;
+import com.lowagie.text.Font;
+import com.lowagie.text.FontFactory;
+import com.lowagie.text.Image;
+import com.lowagie.text.Paragraph;
+import com.lowagie.text.Rectangle;
+import com.lowagie.text.pdf.PdfContentByte;
+import com.lowagie.text.pdf.PdfDestination;
+import com.lowagie.text.pdf.PdfOutline;
+import com.lowagie.text.pdf.PdfPCell;
+import com.lowagie.text.pdf.PdfPTable;
+import com.lowagie.text.pdf.PdfPageEventHelper;
+import com.lowagie.text.pdf.PdfWriter;
+
+class PageEvent extends PdfPageEventHelper {
+ private PdfBean pb;
+ private int pageNo = 0;
+ private int omit_page_count = 0;
+ private int DEFAULT_LOGO_SIZE = 100;
+
+ public PageEvent(PdfBean pb) {
+ this.pb = pb;
+ }
+
+ private int getWidthEntries(int howManyLogos){
+ int widthEntries = 0;
+
+ if(howManyLogos == 2)
+ widthEntries = 3;
+ else
+ if(howManyLogos == 1)
+ widthEntries = 2;
+ else
+ widthEntries = 0;
+
+ return widthEntries;
+ }
+
+ private int getHowManyLogos(){
+ int howManyLogos = 0;
+
+ if(AppUtils.isNotEmpty(pb.getLogo1Url()) && !pb.getLogo1Url().equalsIgnoreCase("<no logo>"))
+ howManyLogos ++;
+
+ if(AppUtils.isNotEmpty(pb.getLogo2Url()) && !pb.getLogo2Url().equalsIgnoreCase("<no logo>"))
+ howManyLogos ++;
+
+ return howManyLogos;
+ }
+
+ private float[] fillWidthsArray(int howManyLogos){
+ float[] widthsArray = new float[howManyLogos + 1];
+
+ //If one logo, we will need two columns in the header[left log, spacer]
+ if(howManyLogos == 1){
+ widthsArray = new float[2];
+ widthsArray[0] = 0.1f;
+ widthsArray[1] = 0.1f;
+ }
+ //If two logs, we will need three columns in the header [left log, spacer, right log]
+ else
+ if(howManyLogos == 2){
+ widthsArray = new float[3];
+ widthsArray[0] = 0.1f;
+ widthsArray[1] = 0.5f;
+ widthsArray[2] = 0.1f;
+ }
+
+ return widthsArray;
+ }
+ public void onStartPage(PdfWriter writer, Document document) {
+
+ Font font = FontFactory.getFont(Globals.getFooterFontFamily(), Globals.getFooterFontSize(), Font.NORMAL, Color.BLACK);
+ int howManyLogos = getHowManyLogos();
+
+ //No need to draw anything in the header if no logo was set in the report.
+ if(howManyLogos == 0)
+ return;
+
+ float[] widths = fillWidthsArray(howManyLogos);
+
+ PdfPTable foot = new PdfPTable(widths);
+
+ if(AppUtils.isNotEmpty(pb.getLogo1Url()) && !pb.getLogo1Url().equalsIgnoreCase("<no logo>"))
+ addLogo(foot, font, pb.getLogo1Url().substring(pb.getLogo1Url().indexOf("|") + 1).trim(), Cell.ALIGN_LEFT, pb.getLogo1Size() == null ? DEFAULT_LOGO_SIZE : pb.getLogo1Size());
+
+ PdfPCell spacingCell = new PdfPCell();
+ spacingCell.setBorderColor(Color.WHITE);
+ foot.addCell(spacingCell);
+
+ //Using logo1 size for now - use logo2 size if it is required to deal it separately.
+ if(AppUtils.isNotEmpty(pb.getLogo2Url()) && !pb.getLogo2Url().equalsIgnoreCase("<no logo>"))
+ addLogo(foot, font, pb.getLogo2Url().substring(pb.getLogo2Url().indexOf("|") + 1).trim(), Cell.ALIGN_RIGHT, pb.getLogo2Size() == null ? DEFAULT_LOGO_SIZE : pb.getLogo2Size());
+
+ foot.setTotalWidth(getPageWidth(document));
+ foot.writeSelectedRows(0, -1, 36, 600, writer.getDirectContent());
+ }
+
+ public void onEndPage(PdfWriter writer, Document document) {
+
+ Font font = FontFactory.getFont(Globals.getFooterFontFamily(), Globals.getFooterFontSize(), Font.NORMAL, Color.BLACK);
+
+ try {
+
+ // footer
+ float[] f = { 1f, 0.4f, 1f };
+ PdfPTable foot = new PdfPTable(f);
+ foot.getDefaultCell().setBorderWidth(0);
+ foot.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+ foot.getDefaultCell().setVerticalAlignment(Rectangle.ALIGN_BOTTOM);
+
+ foot.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_LEFT);
+ addLeftFooter(foot, font);
+
+ foot.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+ addPageNumber(foot, font, pb.isPageNumberAtFooter(), document.getPageNumber());
+
+ foot.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_RIGHT);
+ foot.getDefaultCell().setNoWrap(true);
+
+ foot.addCell(new Paragraph(" " + PdfReportHandler.currentTime(pb.getTimestampPattern()), font));
+
+ foot.setTotalWidth(getPageWidth(document));
+ foot.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin(), writer.getDirectContent());
+
+ // bookmark
+ pageNo++;
+ PdfContentByte cb = writer.getDirectContent();
+ PdfDestination destination = new PdfDestination(PdfDestination.FITH);
+ String bookmark = "Data Page " + (pageNo - omit_page_count);
+ if (pageNo == 1) {
+ if (pb.isCoverPageIncluded()) {
+ bookmark = "Cover Page";
+ omit_page_count++;
+ } else if (pb.isDisplayChart()) {
+ bookmark = "Chart";
+ omit_page_count++;
+ }
+ }
+ if (pageNo == 2 && pb.isCoverPageIncluded() && pb.isDisplayChart()) {
+ bookmark = "Chart";
+ omit_page_count++;
+ }
+
+ PdfOutline outline = new PdfOutline(cb.getRootOutline(), destination, bookmark);
+
+ } catch (Exception e) {
+ throw new ExceptionConverter(e);
+ }
+ }
+
+ private void addPageNumber(PdfPTable table, Font font, boolean isAdd, int pageNum) {
+ if (isAdd)
+ table.addCell(new Paragraph(Globals.getWordBeforePageNumber() + " " + pageNum + " " + Globals.getWordAfterPageNumber(), font));
+ else
+ table.addCell("");
+ }
+
+ private void addLeftFooter(PdfPTable table, Font font) {
+ Font font1 = new Font(font);
+ font1.setSize(Globals.getAttProprieraryFontSize());
+
+ if (isEmpty(pb.getLeftFooter()))
+ table.addCell(new Paragraph(" " + Globals.getAttProprietary(), font1));
+ else
+ table.addCell(new Paragraph(pb.getLeftFooter(), font));
+ }
+
+ private void addHeaderDummy(PdfPTable table, Font font) {
+ Font font1 = new Font(font);
+ font1.setSize(Globals.getAttProprieraryFontSize());
+
+ table.addCell(new Paragraph("Header row", font1));
+ }
+
+ private void addLogo(PdfPTable table, Font font, String imgSrc, int alignment, int absoluteSize) {
+
+ Image img = null;
+ try {
+ img = Image.getInstance(pb.getFullWebContextPath() + AppUtils.getImgFolderURL() + File.separator + imgSrc);
+ } catch (BadElementException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ img = null;
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ img = null;
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+
+ }
+ if(img == null){
+ //log that the input file couldnt be loaded -
+ }
+ else{
+ //img.scaleAbsolute(absoluteSize, absoluteSize);
+ img.scalePercent(absoluteSize, absoluteSize);
+ PdfPCell cell = new PdfPCell(img);
+ cell.setBorderColor(Color.WHITE);
+ cell.setHorizontalAlignment(alignment);
+ table.addCell(cell);
+ }
+
+ }
+
+ public static float getPageWidth(Document doc) {
+ return doc.getPageSize().width() - doc.leftMargin() - doc.rightMargin();
+ }
+
+ public static float getPageHeight(Document doc) {
+ return doc.getPageSize().height() - doc.topMargin() - doc.bottomMargin();
+ }
+
+ private float getHeadTopMargin(Document doc, PdfPTable table) {
+ return doc.getPageSize().height() - doc.topMargin() + table.getTotalHeight();
+ }
+
+ private boolean isEmpty(String str) {
+ return str == null || str.trim().length() == 0;
+ }
+
+} // PageEvent
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfBean.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfBean.java
new file mode 100644
index 00000000..31b26435
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfBean.java
@@ -0,0 +1,242 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.pdf;
+
+
+public class PdfBean {
+
+ public static final int NUMBER_IN_HEADER = 0;
+ public static final int NUMBER_IN_FOOTER = 1;
+ public static final int NUMBER_IN_BOTH = 2;
+
+ private boolean alternateColor;
+ private boolean isPortrait;
+ private boolean isCoverPageIncluded;
+ private boolean isDisplayChart;
+ private int currentPage;
+ private int whereToShowPageNumber;
+ private String userId;
+ private String timestampPattern;
+ private String title;
+ private String leftFooter;
+ private String pagesize;
+ private boolean isAttachmentOfEmail;
+ private String logo1Url;
+ private Integer logo1Size;
+ private String logo2Url;
+ private Integer logo2Size;
+ private String fullWebContextPath;
+
+ /**
+ * @return the leftFooter
+ */
+ public String getLeftFooter() {
+ return leftFooter;
+ }
+ /**
+ * @param leftFooter the leftFooter to set
+ */
+ public void setLeftFooter(String leftFooter) {
+ this.leftFooter = leftFooter;
+ }
+ /**
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+ /**
+ * @param title the title to set
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ /**
+ * @return the alternateColor
+ */
+ public boolean isAlternateColor() {
+ return alternateColor;
+ }
+ /**
+ * @param alternateColor the alternateColor to set
+ */
+ public void setAlternateColor(boolean alternateColor) {
+ this.alternateColor = alternateColor;
+ }
+ /**
+ * @return the currentPage
+ */
+ public int getCurrentPage() {
+ return currentPage;
+ }
+ /**
+ * @param currentPage the currentPage to set
+ */
+ public void setCurrentPage(int currentPage) {
+ this.currentPage = currentPage;
+ }
+ /**
+ * @return the isPortrait
+ */
+ public boolean isPortrait() {
+ return isPortrait;
+ }
+ /**
+ * @param isPortrait the isPortrait to set
+ */
+ public void setPortrait(boolean isPortrait) {
+ this.isPortrait = isPortrait;
+ }
+ /**
+ * @return the timestampPattern
+ */
+ public String getTimestampPattern() {
+ return timestampPattern;
+ }
+ /**
+ * @param timestampPattern the timestampPattern to set
+ */
+ public void setTimestampPattern(String timestampPattern) {
+ this.timestampPattern = timestampPattern;
+ }
+ /**
+ * @return the userId
+ */
+ public String getUserId() {
+ return userId;
+ }
+ /**
+ * @param userId the userId to set
+ */
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+ /**
+ * @return the whereToShowPageNummber
+ */
+ public int getWhereToShowPageNumber() {
+ return whereToShowPageNumber;
+ }
+ /**
+ * @param whereToShowPageNumber the whereToShowPageNumber to set
+ */
+ public void setWhereToShowPageNumber(int whereToShowPageNumber) {
+ this.whereToShowPageNumber = whereToShowPageNumber;
+ }
+
+ public boolean isPageNumberAtHeader() {
+ return getWhereToShowPageNumber()==NUMBER_IN_BOTH ||
+ getWhereToShowPageNumber()==NUMBER_IN_HEADER;
+ }
+
+ public boolean isPageNumberAtFooter() {
+ return getWhereToShowPageNumber()==NUMBER_IN_FOOTER ||
+ getWhereToShowPageNumber()==NUMBER_IN_BOTH;
+ }
+
+ /**
+ * @return the isCoverPageIncluded
+ */
+ public boolean isCoverPageIncluded() {
+ return isCoverPageIncluded;
+ }
+ /**
+ * @param isCoverPageIncluded the isCoverPageIncluded to set
+ */
+ public void setCoverPageIncluded(boolean isCoverPageIncluded) {
+ this.isCoverPageIncluded = isCoverPageIncluded;
+ }
+
+ public String toString() {
+ return getTitle()+ " " +
+ getCurrentPage() + " " +
+ getTimestampPattern() + " " +
+ getUserId()+ " " +
+ getWhereToShowPageNumber()+ " " +
+ isPortrait() + " " + isAlternateColor();
+ }
+ /**
+ * @return the isDisplayChart
+ */
+ public boolean isDisplayChart() {
+ return isDisplayChart;
+ }
+ /**
+ * @param isDisplayChart the isDisplayChart to set
+ */
+ public void setDisplayChart(boolean isDisplayChart) {
+ this.isDisplayChart = isDisplayChart;
+ }
+ /**
+ * @return the pagesize
+ */
+ public String getPagesize() {
+ return pagesize;
+ }
+ /**
+ * @param pagesize the pagesize to set
+ */
+ public void setPagesize(String pagesize) {
+ this.pagesize = pagesize;
+ }
+
+ public String getLogo1Url() {
+ return logo1Url;
+ }
+ public void setLogo1Url(String logo1Url) {
+ this.logo1Url = logo1Url;
+ }
+
+ public String getLogo2Url() {
+ return logo2Url;
+ }
+ public void setLogo2Url(String logo2Url) {
+ this.logo2Url = logo2Url;
+ }
+
+ public void setAttachmentOfEmail(boolean isAttachmentOfEmail) {
+ this.isAttachmentOfEmail = isAttachmentOfEmail;
+ }
+
+ public boolean isAttachmentOfEmail() {
+
+ return isAttachmentOfEmail;
+ }
+ public Integer getLogo1Size() {
+ return logo1Size;
+ }
+ public void setLogo1Size(Integer logo1Size) {
+ this.logo1Size = logo1Size;
+ }
+ public Integer getLogo2Size() {
+ return logo2Size;
+ }
+ public void setLogo2Size(Integer logo2Size) {
+ this.logo2Size = logo2Size;
+ }
+ public String getFullWebContextPath() {
+ return fullWebContextPath;
+ }
+ public void setFullWebContextPath(String fullWebContextPath) {
+ this.fullWebContextPath = fullWebContextPath;
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfReportHandler.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfReportHandler.java
new file mode 100644
index 00000000..deac806d
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfReportHandler.java
@@ -0,0 +1,1890 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+/* ===========================================================================================
+
+ * This class is part of <I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I>
+ * Raptor : This tool is used to generate different kinds of reports with lot of utilities
+ * ===========================================================================================
+ *
+ * -------------------------------------------------------------------------------------------
+ * PdfReportHandler.java - This class is used to generate reports in PDF using iText
+ * -------------------------------------------------------------------------------------------
+ *
+ *
+ * Changes
+ * -------
+ * 14-Jul-2009 : Version 8.4 (Sundar); <UL>
+ * <LI> Dashboard reports can be downloaded with each report occupying separate page including its charts. </LI>
+ * </UL>
+ *
+ */
+package org.openecomp.portalsdk.analytics.model.pdf;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.StringReader;
+import java.net.MalformedURLException;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TimeZone;
+import java.util.TreeMap;
+import java.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.model.ReportHandler;
+import org.openecomp.portalsdk.analytics.model.ReportLoader;
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.HtmlStripper;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.view.ColumnHeader;
+import org.openecomp.portalsdk.analytics.view.ColumnHeaderRow;
+import org.openecomp.portalsdk.analytics.view.DataRow;
+import org.openecomp.portalsdk.analytics.view.DataValue;
+import org.openecomp.portalsdk.analytics.view.HtmlFormatter;
+import org.openecomp.portalsdk.analytics.view.ReportData;
+import org.openecomp.portalsdk.analytics.view.RowHeader;
+import org.openecomp.portalsdk.analytics.view.RowHeaderCol;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+import com.lowagie.text.BadElementException;
+import com.lowagie.text.Chunk;
+import com.lowagie.text.Document;
+import com.lowagie.text.DocumentException;
+import com.lowagie.text.Element;
+import com.lowagie.text.ElementTags;
+import com.lowagie.text.Font;
+import com.lowagie.text.FontFactory;
+import com.lowagie.text.Image;
+import com.lowagie.text.PageSize;
+import com.lowagie.text.Paragraph;
+import com.lowagie.text.Phrase;
+import com.lowagie.text.Rectangle;
+import com.lowagie.text.html.simpleparser.HTMLWorker;
+import com.lowagie.text.html.simpleparser.StyleSheet;
+import com.lowagie.text.pdf.PdfPCell;
+import com.lowagie.text.pdf.PdfPTable;
+import com.lowagie.text.pdf.PdfWriter;
+
+
+public class PdfReportHandler extends org.openecomp.portalsdk.analytics.RaptorObject{
+
+ /**
+ *
+ */
+ private PdfBean pb;
+ private HtmlStripper strip = new HtmlStripper();
+ private static final int RetryCreateNewImage = 3;
+ private int retryCreateNewImageCount=0;
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PdfReportHandler.class);
+
+ private String FONT_FAMILY = "Arial";
+ private int FONT_SIZE = 9;
+
+ public PdfReportHandler() { }
+
+ public void createPdfFileContent(HttpServletRequest request, HttpServletResponse response, int type) throws IOException, RaptorException {
+
+ Document document = new Document();
+ ReportHandler rh = new ReportHandler();
+ String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date());
+ String pdfFName = "";
+ String user_id = AppUtils.getUserID(request);
+ response.reset();
+ response.setContentType("application/pdf");
+ OutputStream outStream = response.getOutputStream();
+
+ String formattedReportName = "";
+ PdfWriter writer = null;
+ ReportRuntime firstReportRuntimeObj = null;
+ int returnValue = 0;
+
+ ReportRuntime rr = null;
+ if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+
+ boolean isDashboard = false;
+ if ((request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) && ( ((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)).equals(rr.getReportID())) ) {
+ isDashboard = true;
+ }
+ if(isDashboard) {
+ try {
+ String reportID = (String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID);
+ ReportRuntime rrDash = rh.loadReportRuntime(request, reportID, true, 1);
+ pb = preparePdfBean(request,rrDash);
+
+ // Setting pb Values
+ document.setPageSize(PageSize.getRectangle(pb.getPagesize()));
+ if(!pb.isPortrait()) // get this from properties file
+ document.setPageSize(document.getPageSize().rotate());
+
+ //
+ writer = PdfWriter.getInstance(document, response.getOutputStream());
+ writer.setPageEvent(new PageEvent(pb));//header,footer,bookmark
+ document.open();
+
+ formattedReportName = new HtmlStripper().stripSpecialCharacters(rrDash.getReportName());
+ if(pb.isAttachmentOfEmail())
+ response.setHeader("Content-disposition", "inline");
+ else
+ response.setHeader("Content-disposition", "attachment;filename="+ formattedReportName+formattedDate+user_id+".pdf");
+
+ pdfFName = "dashboard"+formattedReportName+formattedDate+user_id+".pdf";
+ Map reportRuntimeMap = null;
+ Map reportDataMap = null;
+ Map reportDisplayTypeMap = null;
+
+ reportRuntimeMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP);
+ reportDataMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP);
+ reportDisplayTypeMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP);
+
+ if(reportRuntimeMap!=null) {
+ //ServletOutputStream sos = response.getOutputStream();
+ Set setReportRuntime = reportRuntimeMap.entrySet();
+ Set setReportDataMap = reportDataMap.entrySet();
+ Set setReportDisplayTypeMap = reportDisplayTypeMap.entrySet();
+
+ Iterator iter2 = setReportDataMap.iterator();
+ Iterator iter3 = setReportDisplayTypeMap.iterator();
+ int count = 0;
+ for(Iterator iter = setReportRuntime.iterator(); iter.hasNext(); ) {
+ count++;
+ Map.Entry entryData = (Entry) iter2.next();
+ Map.Entry entry = (Entry) iter.next();
+ Map.Entry entryCheckChart = (Entry) iter3.next();
+ //String rep_id = (String) entry.getKey();
+ ReportRuntime rrDashRep = (ReportRuntime) entry.getValue();
+
+ if(count == 1) {
+ firstReportRuntimeObj = (ReportRuntime) entry.getValue();
+ if(pb.isCoverPageIncluded()) {
+ document = paintDashboardCoverPage(document, rrDash, firstReportRuntimeObj, request);
+ }
+ }
+ ReportData rdDashRep = (ReportData) entryData.getValue();
+ int col = 0;
+ //pb.setDisplayChart(nvl(rr.getChartType()).trim().length()>0 && rr.getDisplayChart());
+ if( ((rrDashRep.getChartType()).trim().length()>0 && rrDashRep.getDisplayChart()) && entryCheckChart.getValue().toString().equals("c")) {
+ document.newPage();
+ pb.setTitle(nvl(rrDashRep.getReportTitle()).length()>0?rrDashRep.getReportTitle():rrDashRep.getReportName());
+ paintPdfImage(request, document,AppUtils.getTempFolderPath()+"cr_"+ pb.getUserId()+"_"+request.getSession().getId()+"_"+rrDashRep.getReportID()+".png", rrDashRep);
+ } else {
+ document.newPage();
+ pb.setTitle(nvl(rrDashRep.getReportTitle()).length()>0?rrDashRep.getReportTitle():rrDashRep.getReportName());
+ paintPdfData(request, document,rdDashRep,rrDashRep, "");
+ }
+ }
+
+ }
+ } catch (DocumentException dex) {dex.printStackTrace();}
+ catch (RaptorException rex) {rex.printStackTrace();}
+ } else {
+
+ //ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ //ReportData rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA);
+ rr = null;
+ ReportData rd = null;
+ String parent = "";
+ int parentFlag = 0;
+ if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), "");
+ if(parent.startsWith("parent_")) parentFlag = 1;
+ if(parentFlag == 1) {
+ rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr");
+ rd = (ReportData) request.getSession().getAttribute(parent+"_rd");
+ }
+ if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ if(rd==null) rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA);
+
+ pb = preparePdfBean(request,rr);
+ FONT_FAMILY = rr.getPDFFont();
+ FONT_SIZE = rr.getPDFFontSize();
+ //System.out.println(pb);
+
+ formattedReportName = new HtmlStripper().stripSpecialCharacters(rr.getReportName());
+
+
+
+ response.setContentType("application/pdf");
+ if(pb.isAttachmentOfEmail())
+ response.setHeader("Content-disposition", "inline");
+ else
+ response.setHeader("Content-disposition", "attachment;filename="+ formattedReportName+formattedDate+user_id+".pdf");
+
+ document.setPageSize(PageSize.getRectangle(pb.getPagesize()));
+
+ if(!pb.isPortrait()) // get this from properties file
+ document.setPageSize(document.getPageSize().rotate());
+
+ try {
+
+ writer = PdfWriter.getInstance(document, outStream);
+ writer.setPageEvent(new PageEvent(pb));//header,footer,bookmark
+ document.open();
+
+ //System.out.println("Document 1 " + document);
+ if(pb.isCoverPageIncluded()) {
+ document = paintCoverPage(document, rr, request);
+ }
+
+ //boolean isImageRotate = false;
+ //System.out.println("Document 2 " + document);
+
+ if(pb.isDisplayChart()) {
+ paintPdfImage(request, document,AppUtils.getTempFolderPath()+"cr_"+ pb.getUserId()+"_"+request.getSession().getId()+"_"+rr.getReportID()+".png", rr);
+ }
+ //System.out.println("Document 4" + document);
+
+ document.newPage();
+ if(type == 3 && rr.getSemaphoreList()==null && !(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) ) { //type = 3 is whole
+ String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE);
+ returnValue = paintPdfData(request, document, rd, rr, sql_whole);
+ } else if(type == 2) {
+ returnValue = paintPdfData(request, document, rd, rr, "");
+ } else {
+ //String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE);
+ int downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ String action = request.getParameter(AppConstants.RI_ACTION);
+
+ if(!(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) && !action.endsWith("session"))
+ rd = rr.loadReportData(-1, AppUtils.getUserID(request), downloadLimit,request, false /*download*/);
+ if(rr.getSemaphoreList()!=null) {
+ rd = rr.loadReportData(-1, AppUtils.getUserID(request), downloadLimit,request, true);
+ returnValue = paintPdfData(request, document, rd, rr, "");
+ } else {
+ returnValue = paintPdfData(request, document, rd, rr, rr.getWholeSQL());
+ }
+
+
+ }
+
+
+ //paintPdfData(document,rd,rr);
+
+
+ } catch (DocumentException de) {
+ de.printStackTrace();
+ //System.err.println("document: " + de.getMessage());
+ }
+
+ }
+ document.close();
+ int mb = 1024*1024;
+ Runtime runtime = Runtime.getRuntime();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("##### Heap utilization statistics [MB] #####"));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Used Memory:"
+ + (runtime.maxMemory() - runtime.freeMemory()) / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Free Memory:"
+ + runtime.freeMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Total Memory:" + runtime.totalMemory() / mb));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Max Memory:" + runtime.maxMemory() / mb));
+
+ }
+
+ private Document paintCoverPage(Document doc, ReportRuntime rr, HttpServletRequest request) throws IOException, DocumentException {
+
+ //System.out.println("PDFREPORTHANDLER STARTED ... " );
+ if(nvl(rr.getPdfImg()).length()>0) {
+ Image image1 = Image.getInstance(AppUtils.getExcelTemplatePath()+"../../"+AppUtils.getImgFolderURL()+rr.getPdfImg());
+ image1.scalePercent(20f, 20f);
+ doc.add(image1);
+ }
+ float firstColumnSize = Globals.getCoverPageFirstColumnSize();
+ float[] relativeWidths = {firstColumnSize,1f-firstColumnSize};
+ PdfPTable table = new PdfPTable(relativeWidths);
+ table.getDefaultCell().setBorderWidth(0);
+ addEmptyRows(table,6);
+ HTMLWorker worker = new HTMLWorker(doc);
+ StyleSheet style = new StyleSheet();
+ style.loadTagStyle("body", "leading", "16,0");
+ StringBuffer reportDescrBuf = new StringBuffer("");
+ ArrayList descr = HTMLWorker.parseToList(new StringReader(nvl(rr.getReportDescr())), style);
+ ArrayList paraList = null;
+ if(nvl(rr.getReportTitle()).length()>0) {
+ add2Cells(table,"Report Title : ",nvl(rr.getReportTitle()));
+ } else {
+ add2Cells(table,"Report Name : ",nvl(rr.getReportName()));
+ }
+ if((descr!=null && descr.size()>0)) {
+ paraList = (com.lowagie.text.Paragraph)descr.get(0);
+ for (int i=0 ; i<paraList.size(); i++) {
+ reportDescrBuf.append(paraList.get(i));
+ }
+
+ }
+ add2Cells(table,"Description : ",reportDescrBuf.toString());
+ if(Globals.getSessionInfoForTheCoverPage().length()>0) {
+ String nameValue[] = Globals.getSessionInfoForTheCoverPage().split(",");
+ String name=nameValue[0];
+ String value=nameValue[1];
+ add2Cells(table,name+" : ",(AppUtils.getRequestNvlValue(request, value).length()>0?AppUtils.getRequestNvlValue(request, value):nvl((String)request.getSession().getAttribute(value))));
+ }
+
+ if(Globals.isCreatedOwnerInfoNeeded()) {
+ add2Cells(table,"Created By : ",nvl(AppUtils.getUserName(rr.getCreateID())));
+ add2Cells(table,"Owner : ",nvl(AppUtils.getUserName(rr.getOwnerID())));
+ }
+ if(Globals.displayLoginIdForDownloadedBy())
+ add2Cells(table,"Downloaded by : ",nvl(AppUtils.getUserBackdoorLoginId(request)));
+ else
+ add2Cells(table,"Downloaded by : ",nvl(AppUtils.getUserName(AppUtils.getUserID(request))));
+
+ addEmptyRows(table,1);
+
+ boolean isFirstRow = true;
+ ArrayList al = rr.getParamNameValuePairsforPDFExcel(request, 1);
+ if(al.size()<=0) {
+ al = (ArrayList) request.getSession().getAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO);
+ }
+
+ Iterator it = al.iterator();
+ addEmptyRows(table,1);
+ //if(!Globals.customizeFormFieldInfo()) {
+ if(rr.getFormFieldComments(request).length()<=0) {
+ while(it.hasNext()) {
+
+ if(isFirstRow) {
+ add2Cells(table, "Run-time Criteria : ", " ");
+ isFirstRow = false;
+ }
+
+ IdNameValue value = (IdNameValue)it.next();
+ if(!value.getId().trim().equals("BLANK"))
+ //System.out.println("PDFREPORTHANDLER " + value.getId()+" : "+value.getName());
+ add2Cells(table, value.getId()+" : ",value.getName().replaceAll("~",","));
+ //add2Cells(table, rr.getFormFieldComments(request), " ");
+ }
+ addEmptyRows(table,1);
+ doc.add(table);
+
+ } else {
+ it = al.iterator();
+ if(it.hasNext()) {
+ //add2Cells(table, "Run-time Criteria : ", " ");
+ addEmptyRows(table,1);
+ doc.add(table);
+ //com.lowagie.text.html.HtmlParser.parse(doc, new StringReader(rr.getFormFieldComments(request)));
+ ArrayList p = HTMLWorker.parseToList(new StringReader(rr.getFormFieldComments(request).replaceAll("~",",")), style);
+
+ for (int k = 0; k < p.size(); ++k){
+ doc.add((com.lowagie.text.Element)p.get(k));
+ }
+ }
+ }
+
+ return doc;
+ }
+
+
+ private Document paintDashboardCoverPage(Document doc, ReportRuntime rrDashRep, ReportRuntime firstReportRuntimeObj, HttpServletRequest request) throws IOException, DocumentException {
+
+ //System.out.println("PDFREPORTHANDLER STARTED ... " );
+ float firstColumnSize = Globals.getCoverPageFirstColumnSize();
+ float[] relativeWidths = {firstColumnSize,1f-firstColumnSize};
+ PdfPTable table = new PdfPTable(relativeWidths);
+ table.getDefaultCell().setBorderWidth(0);
+ addEmptyRows(table,6);
+
+ add2Cells(table,"Report Name : ",rrDashRep.getReportName());
+ add2Cells(table,"Description : ",rrDashRep.getReportDescr());
+ if(Globals.getSessionInfoForTheCoverPage().length()>0) {
+ String nameValue[] = Globals.getSessionInfoForTheCoverPage().split(",");
+ String name=nameValue[0];
+ String value=nameValue[1];
+ add2Cells(table,name+" : ",(AppUtils.getRequestNvlValue(request, value).length()>0?AppUtils.getRequestNvlValue(request, value):nvl((String)request.getSession().getAttribute(value))));
+ }
+
+ if(Globals.isCreatedOwnerInfoNeeded()) {
+ add2Cells(table,"Created By : ",AppUtils.getUserName(rrDashRep.getCreateID()));
+ add2Cells(table,"Owner : ",AppUtils.getUserName(rrDashRep.getOwnerID()));
+ }
+ if(Globals.displayLoginIdForDownloadedBy())
+ add2Cells(table,"Downloaded by : ",AppUtils.getUserBackdoorLoginId(request));
+ else
+ add2Cells(table,"Downloaded by : ",AppUtils.getUserName(request));
+
+ addEmptyRows(table,1);
+
+ boolean isFirstRow = true;
+ ArrayList al = firstReportRuntimeObj.getParamNameValuePairsforPDFExcel(request, 2);
+ Iterator it = al.iterator();
+ addEmptyRows(table,1);
+ //if(!Globals.customizeFormFieldInfo()) {
+ if(firstReportRuntimeObj.getFormFieldComments(request).length()<=0) {
+ while(it.hasNext()) {
+
+ if(isFirstRow) {
+ add2Cells(table, "Run-time Criteria : ", " ");
+ isFirstRow = false;
+ }
+
+ IdNameValue value = (IdNameValue)it.next();
+ if(!value.getId().trim().equals("BLANK"))
+ //System.out.println("PDFREPORTHANDLER " + value.getId()+" : "+value.getName());
+ add2Cells(table, value.getId()+" : ",value.getName());
+ //add2Cells(table, rr.getFormFieldComments(request), " ");
+ }
+ addEmptyRows(table,1);
+ doc.add(table);
+
+ } else {
+ it = al.iterator();
+ if(it.hasNext()) {
+ //add2Cells(table, "Run-time Criteria : ", " ");
+ addEmptyRows(table,1);
+ doc.add(table);
+ //com.lowagie.text.html.HtmlParser.parse(doc, new StringReader(rr.getFormFieldComments(request)));
+ HTMLWorker worker = new HTMLWorker(doc);
+ StyleSheet style = new StyleSheet();
+ style.loadTagStyle("body", "leading", "16,0");
+ ArrayList p = HTMLWorker.parseToList(new StringReader(firstReportRuntimeObj.getFormFieldComments(request)), style);
+
+ for (int k = 0; k < p.size(); ++k){
+ doc.add((com.lowagie.text.Element)p.get(k));
+ }
+ }
+ }
+
+ return doc;
+ }
+
+
+ public static void addEmptyRows(PdfPTable table, int rows) throws DocumentException {
+ for (int i=0; i<rows; i++)
+ for(int j=0;j<table.getAbsoluteWidths().length;j++)
+ table.addCell(new Paragraph(" "));
+
+ }
+
+ private void add2Cells(PdfPTable table, String key, String value) {
+
+ PdfPCell cell;
+ cell = new PdfPCell(new Paragraph(key));
+ cell.setHorizontalAlignment(Rectangle.ALIGN_RIGHT);
+ cell.setBorderWidth(0f);
+ table.addCell(cell);
+
+ cell = new PdfPCell(new Paragraph(value));
+ cell.setHorizontalAlignment(Rectangle.ALIGN_LEFT);
+ cell.setBorderWidth(0f);
+ table.addCell(cell);
+ }
+
+ private void paintPdfImage(HttpServletRequest request, Document document, String fileName, ReportRuntime rr)
+ throws DocumentException
+ {
+
+ ArrayList images = getImage(request, fileName,pb.isAttachmentOfEmail()?true:false, rr);
+ //Image image = getImage(request, fileName,pb.isAttachmentOfEmail()?true:false);
+ PdfPTable table = null;
+ PdfPCell cellValue = null;
+ if(images!=null) {
+
+ for (int i = 0; i < images.size(); i++) {
+ table = new PdfPTable(1);
+ cellValue = new PdfPCell();
+ cellValue.setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+ Image image = (Image) images.get(i);
+ image.setAlignment(Image.ALIGN_CENTER);
+ //System.out.println("Document 3 " + document + " i-" + i);
+ if(i%2 ==0)
+ document.newPage();
+ //System.out.println("Document 31 " + document);
+ cellValue.setImage(image);
+ //table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+ table.addCell(cellValue);
+ //System.out.println("Document 32 " + document + "table " + table);
+ document.add(table);
+ //System.out.println("Document 33 " + document);
+ }
+ }
+ }
+
+ private ArrayList getImage(HttpServletRequest request, String fileName, boolean isGenerateNewImage, ReportRuntime rr) {
+ ArrayList images = new ArrayList();
+ if(!isGenerateNewImage) {
+ try {
+ Image image = Image.getInstance(fileName);
+ images.add(image);
+ return images;
+ }
+ catch (MalformedURLException e) {
+ isGenerateNewImage = true;
+ //e.printStackTrace();
+ }
+ catch (BadElementException e) {
+ isGenerateNewImage = true;
+ //e.printStackTrace();
+
+ } catch (FileNotFoundException e) {
+ isGenerateNewImage = true;
+ //e.printStackTrace();
+ } catch (IOException e) {
+ isGenerateNewImage = true;
+ //e.printStackTrace();
+ }
+ }
+
+ if(isGenerateNewImage && retryCreateNewImageCount<RetryCreateNewImage){
+ retryCreateNewImageCount++;
+ return generateNewImage(request, rr);
+ //return getImage(request,fileName, false);
+ }
+
+ return null;
+
+ }
+
+ private ArrayList generateNewImage(HttpServletRequest request, ReportRuntime rr) {
+ ArrayList images = new ArrayList();
+ try {
+ //ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ DataSet ds = null;
+ if(request.getSession().getAttribute(AppConstants.RI_CHART_DATA)!=null) {
+ ds = (DataSet) request.getSession().getAttribute(AppConstants.RI_CHART_DATA);
+ } else {
+ ds = rr.loadChartData(pb.getUserId(),request);
+ }
+ String downloadFileName = "";
+ HashMap additionalChartOptionsMap = new HashMap();
+ String chartType = nvl(rr.getChartType());
+ if(chartType.equals(AppConstants.GT_PIE_MULTIPLE)) {
+ additionalChartOptionsMap.put("multiplePieOrderRow", new Boolean((AppUtils.getRequestNvlValue(request, "multiplePieOrder").length()>0?AppUtils.getRequestNvlValue(request, "multiplePieOrder").equals("row"):rr.isMultiplePieOrderByRow())) );
+ additionalChartOptionsMap.put("multiplePieLabelDisplay", AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay").length()>0? AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay"):rr.getMultiplePieLabelDisplay());
+ additionalChartOptionsMap.put("chartDisplay", new Boolean(AppUtils.getRequestNvlValue(request, "chartDisplay").length()>0? AppUtils.getRequestNvlValue(request, "chartDisplay").equals("3D"):rr.isChartDisplayIn3D()));
+ } else if (chartType.equals(AppConstants.GT_BAR_3D)) {
+ additionalChartOptionsMap.put("chartOrientation", new Boolean((AppUtils.getRequestNvlValue(request, "chartOrientation").length()>0?AppUtils.getRequestNvlValue(request, "chartOrientation").equals("vertical"):rr.isVerticalOrientation())) );
+ additionalChartOptionsMap.put("secondaryChartRenderer", AppUtils.getRequestNvlValue(request, "secondaryChartRenderer").length()>0? AppUtils.getRequestNvlValue(request, "secondaryChartRenderer"):rr.getSecondaryChartRenderer());
+ additionalChartOptionsMap.put("chartDisplay", new Boolean(AppUtils.getRequestNvlValue(request, "chartDisplay").length()>0? AppUtils.getRequestNvlValue(request, "chartDisplay").equals("3D"):rr.isChartDisplayIn3D()));
+ additionalChartOptionsMap.put("lastSeriesALineChart", new Boolean(rr.isLastSeriesALineChart()));
+ } else if (chartType.equals(AppConstants.GT_LINE)) {
+ additionalChartOptionsMap.put("chartOrientation", new Boolean((AppUtils.getRequestNvlValue(request, "chartOrientation").length()>0?AppUtils.getRequestNvlValue(request, "chartOrientation").equals("vertical"):rr.isVerticalOrientation())) );
+ //additionalChartOptionsMap.put("secondaryChartRenderer", AppUtils.getRequestNvlValue(request, "secondaryChartRenderer").length()>0? AppUtils.getRequestNvlValue(request, "secondaryChartRenderer"):rr.getSecondaryChartRenderer());
+ additionalChartOptionsMap.put("chartDisplay", new Boolean(AppUtils.getRequestNvlValue(request, "chartDisplay").length()>0? AppUtils.getRequestNvlValue(request, "chartDisplay").equals("3D"):rr.isChartDisplayIn3D()));
+ additionalChartOptionsMap.put("lastSeriesABarChart", new Boolean(rr.isLastSeriesABarChart()));
+ } else if (chartType.equals(AppConstants.GT_TIME_DIFFERENCE_CHART)) {
+ additionalChartOptionsMap.put("intervalFromDate",AppUtils.getRequestNvlValue(request, "intervalFromDate").length()>0?AppUtils.getRequestNvlValue(request, "intervalFromDate"):rr.getIntervalFromdate());
+ additionalChartOptionsMap.put("intervalToDate", AppUtils.getRequestNvlValue(request, "intervalToDate").length()>0? AppUtils.getRequestNvlValue(request, "intervalToDate"):rr.getIntervalTodate());
+ additionalChartOptionsMap.put("intervalLabel", AppUtils.getRequestNvlValue(request, "intervalLabel").length()>0? AppUtils.getRequestNvlValue(request, "intervalLabel"):rr.getIntervalLabel());
+ } else if (chartType.equals(AppConstants.GT_REGRESSION)) {
+ additionalChartOptionsMap.put("regressionType",AppUtils.getRequestNvlValue(request, "regressionType").length()>0?AppUtils.getRequestNvlValue(request, "regressionType"):rr.getLinearRegression());
+ additionalChartOptionsMap.put("linearRegressionColor",nvl(rr.getLinearRegressionColor()));
+ additionalChartOptionsMap.put("expRegressionColor",nvl(rr.getExponentialRegressionColor()));
+ additionalChartOptionsMap.put("maxRegression",nvl(rr.getCustomizedRegressionPoint()));
+ } else if (chartType.equals(AppConstants.GT_STACK_BAR) ||chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR) || chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR_LINES)
+ || chartType.equals(AppConstants.GT_STACKED_VERT_BAR) || chartType.equals(AppConstants.GT_STACKED_VERT_BAR_LINES)
+ ) {
+ additionalChartOptionsMap.put("overlayItemValue",new Boolean(nvl(rr.getOverlayItemValueOnStackBar()).equals("Y")));
+ }
+ additionalChartOptionsMap.put("legendPosition", nvl(rr.getLegendPosition()));
+ additionalChartOptionsMap.put("hideToolTips", new Boolean(rr.hideChartToolTips()));
+ additionalChartOptionsMap.put("hideLegend", new Boolean(AppUtils.getRequestNvlValue(request, "hideLegend").length()>0? AppUtils.getRequestNvlValue(request, "hideLegend").equals("Y"):rr.hideChartLegend()));
+ additionalChartOptionsMap.put("labelAngle", nvl(rr.getLegendLabelAngle()));
+ additionalChartOptionsMap.put("maxLabelsInDomainAxis", nvl(rr.getMaxLabelsInDomainAxis()));
+ additionalChartOptionsMap.put("rangeAxisLowerLimit", nvl(rr.getRangeAxisLowerLimit()));
+ additionalChartOptionsMap.put("rangeAxisUpperLimit", nvl(rr.getRangeAxisUpperLimit()));
+
+
+ boolean totalOnChart = false;
+ totalOnChart = AppUtils.getRequestNvlValue(request, "totalOnChart").equals("Y");
+ String filename = null;
+ ArrayList graphURL = new ArrayList();
+ ArrayList chartNames = new ArrayList();
+ ArrayList fileNames = new ArrayList();
+ List l = rr.getAllColumns();
+ List lGroups = rr.getAllChartGroups();
+ HashMap mapYAxis = rr.getAllChartYAxis(rr.getReportParamValues());
+ String chartLeftAxisLabel = rr.getFormFieldFilled(nvl(rr.getChartLeftAxisLabel()));
+ String chartRightAxisLabel = rr.getFormFieldFilled(nvl(rr.getChartRightAxisLabel()));
+ int displayTotalOnChart = 0;
+ HashMap formValues = Globals.getRequestParamtersMap(request, false);
+
+ for (Iterator iterC = l.iterator(); iterC.hasNext();) {
+ DataColumnType dc = (DataColumnType) iterC.next();
+ if(nvl(dc.getColName()).equals(AppConstants.RI_CHART_TOTAL_COL)) {
+ displayTotalOnChart = 1;
+ }
+ }
+
+ String legendColumnName = (rr.getChartLegendColumn()!=null)?rr.getChartLegendColumn().getDisplayName():"Legend Column";
+
+
+
+ if(ds!=null)
+ {
+ if(rr.hasSeriesColumn() && chartType.equals(AppConstants.GT_TIME_SERIES) && (lGroups==null || lGroups.size() <= 0)) { /** Check whether Report has only category columns if so then all the columns will open in seperate chart - sundar**/
+ for (int i=0; i<rr.getChartValueColumnAxisList(AppConstants.CHART_ALL_COLUMNS, formValues).size();i++) {
+ String chartTitle = Globals.getDisplayChartTitle()? rr.getReportName():"";
+ chartTitle = rr.getFormFieldFilled(chartTitle);
+ downloadFileName = AppUtils.getTempFolderPath()+"cr_"+pb.getUserId()+"_"+request.getSession().getId()+"_"+rr.getReportID()+"_"+i+".png";
+ filename = null;/*(String) ChartGen.generateChart( chartType,
+ request.getSession(),
+ ds,
+ legendColumnName,
+ chartLeftAxisLabel,
+ chartRightAxisLabel,
+ rr.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues).subList(i, i+1),
+ rr.getChartColumnColorsList(AppConstants.CHART_ALL_COLUMNS, formValues).subList(i, i+1),
+ rr.getChartValueColumnAxisList(AppConstants.CHART_ALL_COLUMNS, formValues).subList(i, i+1),
+ "",
+ chartTitle,
+ null,
+ rr.getChartWidthAsInt(),
+ rr.getChartHeightAsInt(),
+ rr.getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, formValues).subList(i,i+1),
+ rr.hasSeriesColumn(),
+ //rr.isChartMultiSeries(),
+ rr.isMultiSeries(),
+ rr.getAllColumns(),
+ downloadFileName,
+ totalOnChart,
+ AppConstants.WEB_VERSION deviceType,
+ additionalChartOptionsMap,
+ true
+ );*/
+ try {
+ Image image = Image.getInstance(downloadFileName);
+ images.add(image);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ catch (BadElementException e) {
+ e.printStackTrace();
+
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ } else { /** first check the columns to be opened in new charts and loop around in ChartGen generate chart function - sundar**/
+ String tempChartGroupPrev = "";
+ String tempChartGroupCurrent = "";
+ for (int i=0; i<lGroups.size();i++) {
+ String chartGroupOrg = (String) lGroups.get(i);
+ String chartYAxis = (String) mapYAxis.get(chartGroupOrg);
+ //System.out.println("chartGroupOrg " + chartGroupOrg);
+ if(nvl(chartGroupOrg).length()>0)
+ tempChartGroupCurrent = chartGroupOrg.substring(0,chartGroupOrg.lastIndexOf("|"));
+ if(i>0) tempChartGroupPrev = ((String) lGroups.get(i-1)).substring(0,((String) lGroups.get(i-1)).lastIndexOf("|"));
+ //System.out.println("TEMPCHARTGROUP " + tempChartGroupCurrent + " " + tempChartGroupPrev);
+ if(tempChartGroupCurrent.equals(tempChartGroupPrev)) continue;
+ //System.out.println("CHARTGROUPORG " + chartGroupOrg + " " + lGroups) ;
+ //String chartGroup = chartGroupOrg.substring(0,chartGroupOrg.lastIndexOf("|"));
+ String chartGroup = chartGroupOrg;
+
+ //System.out.println("$$$$CHARTGROUP in JSP " +chartGroup+ " "+ chartGroupOrg );
+ //System.out.println(" rr.getChartGroupDisplayNamesList(chartGroup) " + rr.getChartGroupDisplayNamesList(chartGroup));
+ //System.out.println(" rr.getChartGroupColumnColorsList(chartGroup) " + rr.getChartGroupColumnColorsList(chartGroup));
+ //System.out.println(" rr.getChartGroupColumnAxisList(chartGroup) " + rr.getChartGroupColumnAxisList(chartGroup));
+ //System.out.println(" rr.getChartGroupValueColumnAxisList(chartGroupOrg) " + rr.getChartGroupValueColumnAxisList(chartGroupOrg));
+
+ downloadFileName = AppUtils.getTempFolderPath()+"cr_"+pb.getUserId()+"_"+request.getSession().getId()+"_"+rr.getReportID()+"_"+i+".png";
+ String chartTitle = (Globals.getDisplayChartTitle()? (chartGroup!=null && chartGroup.indexOf("|") > 0 ?chartGroup.substring(0,chartGroup.lastIndexOf("|")):rr.getReportName()):"");
+ chartTitle = rr.getFormFieldFilled(chartTitle);
+ String leftAxisLabel = "";
+ //if(!rr.isChartMultiSeries()) {
+ if(!rr.isMultiSeries()) {
+ leftAxisLabel = ((chartYAxis!=null && chartYAxis.indexOf("|") > 0) ? chartYAxis.substring(0,chartYAxis.lastIndexOf("|")): chartLeftAxisLabel );
+ } else {
+ leftAxisLabel = chartLeftAxisLabel;
+ }
+
+ filename = null;/*(String) ChartGen.generateChart( chartType,
+ request.getSession(),
+ ds,
+ legendColumnName,
+ leftAxisLabel,
+ chartRightAxisLabel,
+ ((chartType.indexOf("Stacked")>0 || chartType.equals(AppConstants.GT_PIE_MULTIPLE) || chartType.equals(AppConstants.GT_BAR_3D))?rr.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues):rr.getChartGroupDisplayNamesList(chartGroup, formValues)),
+ ((chartType.indexOf("Stacked")>0 || chartType.equals(AppConstants.GT_PIE_MULTIPLE) || chartType.equals(AppConstants.GT_BAR_3D))?rr.getChartColumnColorsList(AppConstants.CHART_ALL_COLUMNS, formValues):rr.getChartGroupColumnColorsList(chartGroup, formValues)),
+ ((chartType.indexOf("Stacked")>0 || chartType.equals(AppConstants.GT_PIE_MULTIPLE) || chartType.equals(AppConstants.GT_BAR_3D))?rr.getChartValueColumnAxisList(AppConstants.CHART_ALL_COLUMNS, formValues):rr.getChartGroupValueColumnAxisList(chartGroupOrg, formValues)),
+ "",
+ chartTitle,
+ null,
+ rr.getChartWidthAsInt(),
+ rr.getChartHeightAsInt(),
+ ((chartType.indexOf("Stacked")>0 || chartType.equals(AppConstants.GT_PIE_MULTIPLE))?rr.getChartValueColumnsList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues):rr.getChartGroupValueColumnAxisList(chartGroupOrg, formValues)),
+ rr.hasSeriesColumn(),
+ //rr.isChartMultiSeries(),
+ rr.isMultiSeries(),
+ rr.getAllColumns(),
+ downloadFileName,
+ totalOnChart,
+ AppConstants.WEB_VERSION deviceType,
+ additionalChartOptionsMap,
+ true
+ );*/
+ try {
+ Image image = Image.getInstance(downloadFileName);
+ images.add(image);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ catch (BadElementException e) {
+ e.printStackTrace();
+
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ if(!chartType.equals(AppConstants.GT_PIE_MULTIPLE)) {
+ for (int i=0; i<rr.getChartValueColumnAxisList(AppConstants.CHART_NEWCHART_COLUMNS, formValues).size();i++) {
+ //System.out.println(" rr.getChartDisplayNamesList(AppConstants.CHART_NEWCHART_COLUMNS).subList(i, i+1) " + rr.getChartDisplayNamesList(AppConstants.CHART_NEWCHART_COLUMNS).subList(i, i+1));
+ //System.out.println(" rr.getChartValueColumnAxisList(AppConstants.CHART_NEWCHART_COLUMNS).subList(i, i+1) " + rr.getChartValueColumnAxisList(AppConstants.CHART_NEWCHART_COLUMNS).subList(i, i+1));
+ //System.out.println(" rr.getChartValueColumnsList(AppConstants.CHART_NEWCHART_COLUMNS).subList(i,i+1) " + rr.getChartValueColumnsList(AppConstants.CHART_NEWCHART_COLUMNS).subList(i,i+1));
+
+ downloadFileName = AppUtils.getTempFolderPath()+"cr_"+ pb.getUserId()+"_"+request.getSession().getId()+"_"+rr.getReportID()+"_"+i+".png";
+ String chartTitle = Globals.getDisplayChartTitle()? rr.getReportName():"";
+ chartTitle = rr.getFormFieldFilled(chartTitle);
+
+ filename = null;/* (String) ChartGen.generateChart( chartType,
+ request.getSession(),
+ ds,
+ legendColumnName,
+ chartLeftAxisLabel,
+ chartRightAxisLabel,
+ (chartType.equals(AppConstants.GT_PIE_MULTIPLE))?rr.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues):rr.getChartDisplayNamesList(AppConstants.CHART_NEWCHART_COLUMNS, formValues).subList(i, i+1),
+ (chartType.equals(AppConstants.GT_PIE_MULTIPLE))?rr.getChartColumnColorsList(AppConstants.CHART_ALL_COLUMNS, formValues):rr.getChartColumnColorsList(AppConstants.CHART_NEWCHART_COLUMNS, formValues).subList(i, i+1),
+ (chartType.equals(AppConstants.GT_PIE_MULTIPLE))?rr.getChartValueColumnAxisList(AppConstants.CHART_ALL_COLUMNS, formValues):rr.getChartValueColumnAxisList(AppConstants.CHART_NEWCHART_COLUMNS, formValues).subList(i, i+1),
+ "",
+ chartTitle,
+ null,
+ rr.getChartWidthAsInt(),
+ rr.getChartHeightAsInt(),
+ rr.getChartValueColumnsList(AppConstants.CHART_NEWCHART_COLUMNS, formValues).subList(i,i+1),
+ rr.hasSeriesColumn(),
+ //rr.isChartMultiSeries(),
+ rr.isMultiSeries(),
+ rr.getAllColumns(),
+ downloadFileName,
+ totalOnChart,
+ AppConstants.WEB_VERSION,
+ additionalChartOptionsMap,
+ true
+ );
+*/ try {
+ Image image = Image.getInstance(downloadFileName);
+ images.add(image);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ catch (BadElementException e) {
+ e.printStackTrace();
+
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ /** second rest of the columns are merged to one single chart - sundar**/
+ // System.out.println(" rr.getChartDisplayNamesList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS) " + rr.getChartDisplayNamesList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS));
+ // System.out.println(" rr.getChartValueColumnAxisList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS) " + rr.getChartValueColumnAxisList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS));
+ // System.out.println(" rr.getChartValueColumnsList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS) " + rr.getChartValueColumnsList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS));
+
+ if((!(lGroups!=null && lGroups.size() > 0))) {
+
+ if(/*chartType.equals(AppConstants.GT_TIME_SERIES) && */rr.getChartDisplayNamesList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues)!=null && rr.getChartDisplayNamesList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues).size()>0) {
+ downloadFileName = AppUtils.getTempFolderPath()+"cr_"+ pb.getUserId()+"_"+request.getSession().getId()+"_"+rr.getReportID()+"_All.png";
+ String chartTitle = Globals.getDisplayChartTitle()? rr.getReportName():"";
+ chartTitle = rr.getFormFieldFilled(chartTitle);
+
+ filename = null;/*(String) ChartGen.generateChart( chartType,
+ request.getSession(),
+ ds,
+ legendColumnName,
+ chartLeftAxisLabel,
+ chartRightAxisLabel,
+ rr.getChartDisplayNamesList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues),
+ rr.getChartColumnColorsList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues),
+ rr.getChartValueColumnAxisList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues),
+ "",
+ chartTitle,
+ null,
+ rr.getChartWidthAsInt(),
+ rr.getChartHeightAsInt(),
+ rr.getChartValueColumnsList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues),
+ rr.hasSeriesColumn(),
+ //rr.isChartMultiSeries(),
+ rr.isMultiSeries(),
+ rr.getAllColumns(),
+ downloadFileName,
+ totalOnChart,
+ AppConstants.WEB_VERSION,
+ additionalChartOptionsMap,
+ true
+ );
+*/ try {
+ Image image = Image.getInstance(downloadFileName);
+ images.add(image);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ catch (BadElementException e) {
+ e.printStackTrace();
+
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ } // Stacked Chart Check
+ } // else no Series Column
+
+ }// if(ds!=null)
+
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+// System.out.println("Total Images " + images.size());
+ return images.size()>0?images:null;
+
+ }
+
+/*
+ private boolean isImageRotate(Document doc, Image image) {
+
+ System.out.println("image size="+image.getWidthPercentage()+ " "+ image.scaledWidth()+
+ " "+image.scaledHeight()+" "+image.getXYRatio());
+ System.out.println("page size = "+ doc.getPageSize().width() + " " +doc.getPageSize().height() +" "+
+ doc.topMargin() + " " +doc.bottomMargin() + " " + doc.leftMargin() + " " +
+ doc.rightMargin());
+ System.out.println(image.scaledWidth()/image.scaledHeight());
+ System.out.println((PageEvent.getPageWidth(doc)/PageEvent.getPageHeight(doc)));
+// System.out.println(doc.getPageSize().getRotation());
+
+ float image_w = image.scaledWidth();
+ float image_h = image.scaledHeight();
+ float image_ratio = image_w/image_h;
+
+ float page_w = PageEvent.getPageWidth(doc);
+ float page_h = PageEvent.getPageHeight(doc);
+ float page_ratio = page_w/page_h;
+
+ return (image_w > page_w && image_ratio > page_ratio) ||
+ (image_h > page_h && image_ratio < page_ratio);
+
+ }
+
+*/
+ private final int DEFAULT_PDF_DISPLAY_WIDTH = 10;
+ private int paintPdfData(HttpServletRequest request, Document document, ReportData rd, ReportRuntime rr, String sql_whole) throws DocumentException, RaptorException, IOException {
+
+ int mb = 1024*1024;
+ Runtime runtime = Runtime.getRuntime();
+ int returnValue = 0;
+ sql_whole = rr.getWholeSQL();
+ if(rd.getDataRowCount() >= rr.getReportDataSize()) {
+ sql_whole="";
+ }
+ float f[] = getRelativeWidths(rd, rr.getReportType().equals(AppConstants.RT_CROSSTAB));
+ PdfPTable table = new PdfPTable(f);
+ table.setWidthPercentage(100f);
+ table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+ table.getDefaultCell().setVerticalAlignment(Rectangle.ALIGN_BOTTOM);
+
+ ReportDefinition rdef = (new ReportHandler()).loadReportDefinition(request, rr.getReportID());
+
+ List allColumns = rdef.getAllColumns();
+
+ float[] repotWidths = new float[rdef.getVisibleColumnCount()];
+ int columnIdx = 0;
+ float pdfDisplayWidth = 0;
+ for(Iterator iter = allColumns.iterator(); iter.hasNext();){
+ DataColumnType dct = (DataColumnType) iter.next();
+ if(dct.isVisible()) {
+
+ if(dct.getPdfDisplayWidthInPxls() == null || dct.getPdfDisplayWidthInPxls().equals("") || dct.getPdfDisplayWidthInPxls().startsWith("null"))
+ pdfDisplayWidth = DEFAULT_PDF_DISPLAY_WIDTH;
+ else
+ pdfDisplayWidth = Float.parseFloat(dct.getPdfDisplayWidthInPxls());
+
+ repotWidths [columnIdx++] = pdfDisplayWidth;
+ }
+ }
+
+ table.setWidths(repotWidths);
+
+ //table.setH
+
+ //TODO: check title and subtitle
+ HttpSession session = request.getSession();
+ String drilldown_index = (String) session.getAttribute("drilldown_index");
+ int index = 0;
+ try {
+ index = Integer.parseInt(drilldown_index);
+ } catch (NumberFormatException ex) {
+ index = 0;
+ }
+ String titleRep = (String) session.getAttribute("TITLE_"+index);
+ String subtitle = (String) session.getAttribute("SUBTITLE_"+index);
+
+ if(nvl(titleRep).length()>0 && nvl(subtitle).length()>0)
+ table.setHeaderRows(3);
+ else if (nvl(titleRep).length()>0)
+ table.setHeaderRows(2);
+ else
+ table.setHeaderRows(1);
+ table = paintPdfReportHeader(request, document, table, rr, f);
+ paintPdfTableHeader(document, rd, table);
+
+ int idx = 0;
+ int fragmentsize = 30; //for memory management
+
+ ResultSet rs = null;
+ Connection conn = null;
+ Statement st = null;
+ ResultSetMetaData rsmd = null;
+ rd.reportDataRows.resetNext();
+ DataRow dr = rd.reportDataRows.getNext();
+
+ //addRowHeader(table,dr,idx,rd);
+
+ //addRowColumns(table,dr,idx);
+ if(nvl(sql_whole).length() >0 && rr.getReportType().equals(AppConstants.RT_LINEAR)) {
+ try {
+ conn = ConnectionUtils.getConnection(rr.getDbInfo());
+ st = conn.createStatement();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("************* Map Whole SQL *************"));
+ logger.debug(EELFLoggerDelegate.debugLogger, (sql_whole));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("*****************************************"));
+ rs = st.executeQuery(sql_whole);
+ rsmd = rs.getMetaData();
+ int numberOfColumns = rsmd.getColumnCount();
+ HashMap colHash = new HashMap();
+ dr = null;
+ int j = 0;
+ int rowCount = 0;
+ String title = "";
+ while(rs.next()) {
+
+/* if(runtime.freeMemory()/mb <= ((runtime.maxMemory()/mb)*Globals.getMemoryThreshold()/100) ) {
+ returnValue = 1;
+ String cellValue = Globals.getUserDefinedMessageForMemoryLimitReached() + " "+ rowCount +" records out of " + rr.getReportDataSize() + " were downloaded to PDF.";
+ Font cellFont = FontFactory.getFont(Globals.getDataFontFamily(),
+ Globals.getDataFontSize(),
+ Font.NORMAL, Color.BLACK);
+ PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont));
+ table.addCell(cell);
+ document.add(table);
+ return returnValue;
+ }
+*/ rowCount++;
+ colHash = new HashMap();
+ for (int i = 1; i <= numberOfColumns; i++) {
+ colHash.put(rsmd.getColumnName(i), rs.getString(i));
+ }
+ rd.reportDataRows.resetNext();
+
+ dr = rd.reportDataRows.getNext();
+
+ j = 0;
+ /*if(rd.reportTotalRowHeaderCols!=null) {
+
+ HtmlFormatter rfmt = dr.getRowFormatter();
+
+ Font cellFont = FontFactory.getFont(Globals.getDataFontFamily(),
+ Globals.getDataFontSize(),
+ Font.NORMAL, Color.BLACK);
+ if(rfmt != null) {
+ cellFormatterFont(rfmt,cellFont);
+ }
+
+ String cellValue = new Integer(rowCount).toString();
+ PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont));
+
+ //row background color can be overwritten by cell background color
+ cell.setBackgroundColor(getRowBackgroundColor(dr, idx));
+
+ cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+
+ if(rfmt != null) {
+ formatterCell(rfmt,cell);
+ }
+ table.addCell(cell);
+ }*/
+
+ for (dr.resetNext(); dr.hasNext();j++) {
+ DataValue dv = dr.getNext();
+ /*if(j == 0) {
+ HtmlFormatter cfmt = dv.getCellFormatter();
+ HtmlFormatter rfmt = dv.getRowFormatter();
+
+ Font cellFont = FontFactory.getFont(Globals.getDataFontFamily(),
+ Globals.getDataFontSize(),
+ Font.NORMAL, Color.BLACK);
+ if(cfmt!= null) {
+ cellFormatterFont(cfmt,cellFont);
+ }
+ else if(rfmt != null) {
+ cellFormatterFont(rfmt,cellFont);
+ }
+ else {
+ if(dv.isBold()) {
+ cellFont.setStyle(Font.BOLD);
+ }
+ }
+
+ //String cellValue = strip.stripHtml(value.trim());
+ PdfPCell cell = new PdfPCell(new Paragraph(rowCount+"",cellFont));
+
+ //row background color can be overwritten by cell background color
+ cell.setBackgroundColor(getRowBackgroundColor(dr, idx));
+
+ if(nvl(dv.getAlignment()).trim().length()>0)
+ cell.setHorizontalAlignment(ElementTags.alignmentValue(dv.getAlignment()));
+ else
+ cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+
+ if(cfmt!= null) {
+ formatterCell(cfmt,cell);
+ }
+ else if(rfmt != null) {
+ formatterCell(rfmt,cell);
+ }
+ table.addCell(cell);
+ }*/
+
+ //for (chr.resetNext(); chr.hasNext();) {
+ //ColumnHeader ch = chr.getNext();
+ String value = nvl((String)colHash.get(dv.getColId().toUpperCase()));
+ if(dv.isVisible()) {
+
+ HtmlFormatter cfmt = dv.getCellFormatter();
+ HtmlFormatter rfmt = dv.getRowFormatter();
+
+ Font cellFont = FontFactory.getFont(FONT_FAMILY,
+ FONT_SIZE,
+ Font.NORMAL, Color.BLACK);
+ if(cfmt!= null) {
+ cellFormatterFont(cfmt,cellFont);
+ }
+ else if(rfmt != null) {
+ cellFormatterFont(rfmt,cellFont);
+ }
+ else {
+ if(dv.isBold()) {
+ cellFont.setStyle(Font.BOLD);
+ }
+ }
+
+ String cellValue = strip.stripHtml(value.trim());
+ PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont));
+
+ //row background color can be overwritten by cell background color
+ cell.setBackgroundColor(getRowBackgroundColor(dr, idx));
+
+ if(nvl(dv.getAlignment()).trim().length()>0)
+ cell.setHorizontalAlignment(ElementTags.alignmentValue(dv.getAlignment()));
+ else
+ cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+
+ if(cfmt!= null) {
+ formatterCell(cfmt,cell);
+ }
+ else if(rfmt != null) {
+ formatterCell(rfmt,cell);
+ }
+
+
+
+ table.addCell(cell);
+
+ }//if isVisible()
+
+
+ }
+
+ }
+ if(rd.reportDataTotalRow!=null) {
+ for (rd.reportDataTotalRow.resetNext(); rd.reportDataTotalRow.hasNext();idx++) {
+ dr = rd.reportDataTotalRow.getNext();
+ table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+ Font rowHeaderFont = FontFactory.getFont(FONT_FAMILY,
+ FONT_SIZE,
+ Font.NORMAL, Color.BLACK);
+ rowHeaderFont.setStyle(Font.BOLD);
+ rowHeaderFont.setSize(FONT_SIZE+1f);
+ table.getDefaultCell().setBackgroundColor(getRowBackgroundColor(dr, idx));
+ table.addCell(new Paragraph("Total",rowHeaderFont));
+
+
+ addTotalRowColumns(table,dr,idx);
+ if (idx % fragmentsize == fragmentsize - 1) {
+ document.add(table);
+ table.deleteBodyRows();
+ table.setSkipFirstHeader(true);
+ }
+
+ }
+ }
+ } catch (SQLException ex) {
+ throw new RaptorException(ex);
+ } catch (ReportSQLException ex) {
+ throw new RaptorException(ex);
+ } catch (Exception ex) {
+ if(!(ex.getCause() instanceof java.net.SocketException) )
+ throw new RaptorException (ex);
+ } finally {
+ try {
+ if(conn!=null)
+ conn.close();
+ if(st!=null)
+ st.close();
+ if(rs!=null)
+ rs.close();
+ } catch (SQLException ex) {
+ throw new RaptorException(ex);
+ }
+ }
+
+
+// if (idx % fragmentsize == fragmentsize - 1) {
+// document.add(table);
+// table.deleteBodyRows();
+// table.setSkipFirstHeader(true);
+// }
+
+ //document.add(table);
+ } else {
+ if(rr.getReportType().equals(AppConstants.RT_LINEAR)) {
+ int rowCount = 0;
+ for(rd.reportDataRows.resetNext();rd.reportDataRows.hasNext();idx++)
+ {
+ rowCount++;
+
+ /*if(rd.reportTotalRowHeaderCols!=null) {
+ HtmlFormatter rfmt = dr.getRowFormatter();
+
+ Font cellFont = FontFactory.getFont(Globals.getDataFontFamily(),
+ Globals.getDataFontSize(),
+ Font.NORMAL, Color.BLACK);
+ if(rfmt != null) {
+ cellFormatterFont(rfmt,cellFont);
+ }
+
+ //String cellValue = new Integer(rowCount).toString();
+ //PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont));
+
+ //row background color can be overwritten by cell background color
+ //cell.setBackgroundColor(getRowBackgroundColor(dr, idx));
+
+ //cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+
+ //if(rfmt != null) {
+ //formatterCell(rfmt,cell);
+ //}
+ //table.addCell(cell);
+ }*/
+
+
+
+ if(runtime.freeMemory()/mb <= ((runtime.maxMemory()/mb)*Globals.getMemoryThreshold()/100) ) {
+ returnValue = 1;
+ }
+
+ dr = rd.reportDataRows.getNext();
+
+ addRowHeader(table,dr,idx,rd);
+
+ addRowColumns(table,dr,idx);
+
+ if (idx % fragmentsize == fragmentsize - 1) {
+ document.add(table);
+ table.deleteBodyRows();
+ table.setSkipFirstHeader(true);
+ }
+ }
+
+ if(rd.reportDataTotalRow!=null) {
+ for (rd.reportDataTotalRow.resetNext(); rd.reportDataTotalRow.hasNext();idx++) {
+ dr = rd.reportDataTotalRow.getNext();
+ table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+ Font rowHeaderFont = FontFactory.getFont(FONT_FAMILY,
+ FONT_SIZE,
+ Font.NORMAL, Color.BLACK);
+ rowHeaderFont.setStyle(Font.BOLD);
+ rowHeaderFont.setSize(FONT_SIZE+1f);
+ table.getDefaultCell().setBackgroundColor(getRowBackgroundColor(dr, idx));
+ table.addCell(new Paragraph("Total",rowHeaderFont));
+
+
+ addTotalRowColumns(table,dr,idx);
+ if (idx % fragmentsize == fragmentsize - 1) {
+ document.add(table);
+ table.deleteBodyRows();
+ table.setSkipFirstHeader(true);
+ }
+
+ }
+ }
+
+ } else if (rr.getReportType().equals(AppConstants.RT_CROSSTAB)) {
+ int rowCount = 0;
+ List l = rd.getReportDataList();
+ boolean first = true;
+ for (int dataRow = 0; dataRow < l.size(); dataRow++) {
+ first = true;
+ rowCount++;
+ dr = (DataRow) l.get(dataRow);
+ Vector<DataValue> rowNames = dr.getRowValues();
+ for(dr.resetNext(); dr.hasNext(); ) {
+
+ if(first) {
+ HtmlFormatter rfmt = dr.getRowFormatter();
+
+ Font cellFont = FontFactory.getFont(FONT_FAMILY,
+ FONT_SIZE,
+ Font.NORMAL, Color.BLACK);
+ if(rfmt != null) {
+ cellFormatterFont(rfmt,cellFont);
+ }
+ String cellValue = "";
+ PdfPCell cell = null;
+ //String cellValue = new Integer(rowCount).toString();
+ //PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont));
+ //row background color can be overwritten by cell background color
+ //cell.setBackgroundColor(getRowBackgroundColor(dr, idx));
+
+ //cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+
+ //if(rfmt != null) {
+ //formatterCell(rfmt,cell);
+ // }
+ //table.addCell(cell);
+ if(rowNames!=null) {
+ for(int i=0; i<rowNames.size(); i++) {
+ DataValue dv = rowNames.get(i);
+ rfmt = dr.getRowFormatter();
+
+ cellFont = FontFactory.getFont(FONT_FAMILY,
+ FONT_SIZE,
+ Font.NORMAL, Color.BLACK);
+ if(rfmt != null) {
+ cellFormatterFont(rfmt,cellFont);
+ }
+ cellValue = dv.getDisplayValue();
+ if(cellValue.indexOf("|#")!=-1)
+ cellValue = cellValue.substring(0,cellValue.indexOf("|"));
+
+ cell = new PdfPCell(new Paragraph(cellValue,cellFont));
+ //row background color can be overwritten by cell background color
+ cell.setBackgroundColor(getRowBackgroundColor(dr, idx));
+
+ cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+
+ if(rfmt != null) {
+ formatterCell(rfmt,cell);
+ }
+ table.addCell(cell);
+ }
+ }
+ }
+ first = false;
+
+ if(runtime.freeMemory()/mb <= ((runtime.maxMemory()/mb)*Globals.getMemoryThreshold()/100) ) {
+ returnValue = 1;
+ }
+
+ //addRowHeader(table,dr,idx,rd);
+
+ addRowColumns(table,dr,idx);
+
+ if (idx % fragmentsize == fragmentsize - 1) {
+ document.add(table);
+ table.deleteBodyRows();
+ table.setSkipFirstHeader(true);
+ }
+ }
+
+ }
+ }
+
+ //document.add(table);
+
+ }
+
+ document.add(table);
+ paintPdfReportFooter(request, document, rr, f);
+
+ return returnValue;
+ }
+
+ private void addRowHeader(PdfPTable table, DataRow dr, int idx, ReportData rd) {
+
+ table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+
+ for(rd.reportRowHeaderCols.resetNext();rd.reportRowHeaderCols.hasNext();) {
+ RowHeaderCol rhc = rd.reportRowHeaderCols.getNext();
+ if(idx==0)
+ rhc.resetNext();
+ RowHeader rh = rhc.getNext();
+ //System.out.println(" =============== RowHeader\n "+rh);
+
+ Font rowHeaderFont = FontFactory.getFont(FONT_FAMILY,
+ FONT_SIZE,
+ Font.NORMAL, Color.BLACK);
+ if(rh.isBold()) {
+ rowHeaderFont.setStyle(Font.BOLD);
+ rowHeaderFont.setSize(FONT_SIZE+1f);
+ }
+
+ if(rh.getColSpan()>0) {
+ table.getDefaultCell().setColspan(rh.getColSpan());
+ table.getDefaultCell().setBackgroundColor(getRowBackgroundColor(dr, idx));
+ table.addCell(new Paragraph(strip.stripHtml(rh.getRowTitle()),rowHeaderFont));
+ }
+ }
+ }
+
+ private void addRowColumns(PdfPTable table, DataRow dr, int idx) {
+
+ table.getDefaultCell().setColspan(1);
+
+ for(dr.resetNext();dr.hasNext();)
+ {
+ DataValue dv = dr.getNext();
+ //System.out.println(columnCount +" --> "+dv);
+ if(dv.isVisible()) {
+ HtmlFormatter cfmt = dv.getCellFormatter();
+ HtmlFormatter rfmt = dv.getRowFormatter();
+
+ Font cellFont = FontFactory.getFont(FONT_FAMILY,
+ FONT_SIZE,
+ Font.NORMAL, Color.BLACK);
+ if(cfmt!= null) {
+ cellFormatterFont(cfmt,cellFont);
+ }
+ else if(rfmt != null) {
+ cellFormatterFont(rfmt,cellFont);
+ }
+ else {
+ if(dv.isBold()) {
+ cellFont.setStyle(Font.BOLD);
+ }
+ }
+
+ String cellValue = strip.stripHtml(dv.getDisplayValue().trim());
+ PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont));
+
+ //row background color can be overwritten by cell background color
+ cell.setBackgroundColor(getRowBackgroundColor(dr, idx));
+
+ if(nvl(dv.getAlignment()).trim().length()>0)
+ cell.setHorizontalAlignment(ElementTags.alignmentValue(dv.getAlignment()));
+ else
+ cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+
+ if(cfmt!= null) {
+ formatterCell(cfmt,cell);
+ }
+ else if(rfmt != null) {
+ formatterCell(rfmt,cell);
+ }
+
+ table.addCell(cell);
+
+ }//if isVisible()
+ }
+ }
+
+
+ private void addTotalRowColumns(PdfPTable table, DataRow dr, int idx) {
+
+ table.getDefaultCell().setColspan(1);
+ dr.resetNext();
+ dr.getNext();
+ for(;dr.hasNext();)
+ {
+ DataValue dv = dr.getNext();
+ //System.out.println(columnCount +" --> "+dv);
+ if(dv.isVisible()) {
+ HtmlFormatter cfmt = dv.getCellFormatter();
+ HtmlFormatter rfmt = dv.getRowFormatter();
+
+ Font cellFont = FontFactory.getFont(FONT_FAMILY,
+ FONT_SIZE,
+ Font.NORMAL, Color.BLACK);
+ if(cfmt!= null) {
+ cellFormatterFont(cfmt,cellFont);
+ }
+ else if(rfmt != null) {
+ cellFormatterFont(rfmt,cellFont);
+ }
+ else {
+ if(dv.isBold()) {
+ cellFont.setStyle(Font.BOLD);
+ }
+ }
+
+ String cellValue = strip.stripHtml(dv.getDisplayValue().trim());
+ PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont));
+
+ //row background color can be overwritten by cell background color
+ cell.setBackgroundColor(getRowBackgroundColor(dr, idx));
+
+ if(nvl(dv.getAlignment()).trim().length()>0)
+ cell.setHorizontalAlignment(ElementTags.alignmentValue(dv.getAlignment()));
+ else
+ cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+
+ if(cfmt!= null) {
+ formatterCell(cfmt,cell);
+ }
+ else if(rfmt != null) {
+ formatterCell(rfmt,cell);
+ }
+
+ table.addCell(cell);
+
+ }//if isVisible()
+ }
+ }
+
+
+ private void formatterCell(HtmlFormatter fmt, PdfPCell cell) {
+
+ if(nvl(fmt.getBgColor()).trim().length()>0)
+ cell.setBackgroundColor(Color.decode(fmt.getBgColor()));
+ if(nvl(fmt.getAlignment()).trim().length()>0)
+ cell.setHorizontalAlignment(ElementTags.alignmentValue(fmt.getAlignment()));
+ }
+
+ private void cellFormatterFont(HtmlFormatter fmt, Font font) {
+
+ if(fmt.isBold())
+ font.setStyle(Font.BOLD);
+ if(fmt.isItalic())
+ font.setStyle(Font.ITALIC);
+ if(fmt.isUnderline())
+ font.setStyle(Font.UNDERLINE);
+ if(fmt.getFontColor().trim().length()>0)
+ font.setColor(Color.decode(fmt.getFontColor()));
+ if(fmt.getFontSize().trim().length()>0)
+ font.setSize(Float.parseFloat(fmt.getFontSize())-Globals.getDataFontSizeOffset());
+// if(fmt.getFontFace().trim().length()>0)
+// cellFont.setFamily()
+
+ }
+
+ private Color getRowBackgroundColor(DataRow dr, int idx) {
+
+ Color color = Color.decode(Globals.getDataDefaultBackgroundHexCode());
+
+ HtmlFormatter rhf = dr.getRowFormatter();
+ if(rhf!=null && nvl(rhf.getBgColor()).trim().length()>0)
+
+ color = Color.decode(rhf.getBgColor());
+
+ else if(pb.isAlternateColor() && idx%2==0)
+
+ color = Color.decode(Globals.getDataBackgroundAlternateHexCode());
+
+ return color;
+
+ }
+
+ private int getTotalVisbleColumns(ReportData rd) {
+
+ int totalVisbleColumn = rd.getTotalColumnCount();
+ for(rd.reportDataRows.resetNext();rd.reportDataRows.hasNext();)
+ {
+ DataRow dr = rd.reportDataRows.getNext();
+ for(dr.resetNext();dr.hasNext();) {
+ DataValue dv = dr.getNext();
+ if(!dv.isVisible()) totalVisbleColumn--;
+ }
+
+ break;
+ }
+
+ return totalVisbleColumn;
+ }
+
+ /*
+ private int getFirstRowIndex(ReportRuntime rr) {
+ return (pb.getCurrentPage()>0)?pb.getCurrentPage()*rr.getPageSize()+1 : 1;
+ }
+ */
+ private float[] getRelativeWidths(ReportData rd, boolean crosstab){
+
+ int totalColumns = getTotalVisbleColumns(rd);
+ /*if(rd.reportTotalRowHeaderCols!=null) {
+ totalColumns += 1;
+ }*/
+ if(crosstab) {
+ totalColumns += 1;
+ }
+
+ if(totalColumns == 0 )
+ totalColumns=1;
+
+ float[] relativeWidths = new float[totalColumns];
+ //initial widths are even
+ for(int i=0; i<relativeWidths.length; i++)
+ relativeWidths[i] = 10f;
+
+ int index=0;
+ boolean firstPass = true;
+
+ for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();)
+ {
+ if(firstPass) {
+ /*if(rd.reportTotalRowHeaderCols!=null) {
+ String columnWidth = "5";
+
+ if(columnWidth != null && columnWidth.trim().endsWith("%"))
+ relativeWidths[index] = Float.parseFloat(removeLastCharacter(columnWidth));
+
+ index++;
+ }*/
+
+ for(rd.reportRowHeaderCols.resetNext();rd.reportRowHeaderCols.hasNext();) {
+ String columnWidth = rd.reportRowHeaderCols.getNext().getColumnWidth();
+
+ if(columnWidth != null && columnWidth.trim().endsWith("%"))
+ relativeWidths[index] = Float.parseFloat(removeLastCharacter(columnWidth));
+
+ index++;
+ }
+ firstPass = false;
+ }
+
+ ColumnHeaderRow chr = rd.reportColumnHeaderRows.getNext();
+ for (chr.resetNext(); chr.hasNext();) {
+
+ ColumnHeader ch = chr.getNext();
+
+ if(ch.isVisible()) {
+
+ String columnWidth = ch.getColumnWidth();
+
+ if(ch.getColSpan() <= 1){
+ if(columnWidth != null && columnWidth.trim().endsWith("%"))
+ relativeWidths[index] = Float.parseFloat(removeLastCharacter(columnWidth));
+ }
+ else {
+ for(int i=0; i<ch.getColSpan(); i++) {
+ index += i;
+ if(columnWidth != null && columnWidth.trim().endsWith("%"))
+ relativeWidths[index] =
+ (Float.parseFloat(removeLastCharacter(columnWidth)))/ch.getColSpan();
+ }
+ }
+
+ index++;
+ }
+ }
+ }
+
+ return relativeWidths;
+ }
+
+ public static String removeLastCharacter(String str) {
+ return str.substring(0, str.length()-1);
+ }
+
+ private PdfPTable paintPdfReportHeader(HttpServletRequest request, Document document, PdfPTable table, ReportRuntime rr, float[] f)
+ throws DocumentException, IOException {
+
+ HttpSession session = request.getSession();
+ String drilldown_index = (String) session.getAttribute("drilldown_index");
+ int index = 0;
+ try {
+ index = Integer.parseInt(drilldown_index);
+ } catch (NumberFormatException ex) {
+ index = 0;
+ }
+ String title = (String) session.getAttribute("TITLE_"+index);
+ String subtitle = (String) session.getAttribute("SUBTITLE_"+index);
+ if(nvl(title).length()>0) {
+ //PdfPTable table = new PdfPTable(1);
+ table.setWidthPercentage(100f);
+ table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+ table.getDefaultCell().setVerticalAlignment(Rectangle.ALIGN_BOTTOM);
+
+
+ Font font = FontFactory.getFont(FONT_FAMILY,
+ FONT_SIZE-2f,
+ Font.BOLD,
+ Color.BLACK);
+
+ //addEmptyRows(table,1);
+ table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+ //table.getDefaultCell().setBackgroundColor(Color.decode(Globals.getDataTableHeaderBackgroundFontColor()));
+ title = Utils.replaceInString(title, "<BR/>", " ");
+ title = Utils.replaceInString(title, "<br/>", " ");
+ title = Utils.replaceInString(title, "<br>", " ");
+ title = strip.stripHtml(nvl(title).trim());
+ //subtitle = Utils.replaceInString(subtitle, "<BR/>", " ");
+ //subtitle = Utils.replaceInString(subtitle, "<br/>", " ");
+ //subtitle = Utils.replaceInString(subtitle, "<br>", " ");
+ //subtitle = strip.stripHtml(nvl(subtitle).trim());
+ StyleSheet styles = new StyleSheet();
+
+ HTMLWorker htmlWorker = new HTMLWorker(document);
+ ArrayList cc = new ArrayList();
+ cc = htmlWorker.parseToList(new StringReader(subtitle), styles);
+
+ Phrase p1 = new Phrase();
+ for (int i = 0; i < cc.size(); i++){
+ Element elem = (Element)cc.get(i);
+ ArrayList al = elem.getChunks();
+ for (int j = 0; j < al.size(); j++) {
+ Chunk chunk = (Chunk) al.get(j);
+ chunk.font().setSize(6.0f);
+ }
+ p1.add(elem);
+ }
+ //cell = new PdfPCell(p1);
+ StyleSheet style = new StyleSheet();
+ style.loadTagStyle("font", "font-size", "3");
+ style.loadTagStyle("font", "size", "3");
+ styles.loadStyle("pdfFont1", "size", "11px");
+ styles.loadStyle("pdfFont1", "font-size", "11px");
+ /*ArrayList p = HTMLWorker.parseToList(new StringReader(nvl(title)), style);
+ for (int k = 0; k < p.size(); ++k){
+ document.add((com.lowagie.text.Element)p.get(k));
+ }*/
+ //p1.font().setSize(3.0f);
+ PdfPCell titleCell = new PdfPCell(new Phrase(title, font));
+ titleCell.setColspan(rr.getVisibleColumnCount());
+ PdfPCell subtitleCell = new PdfPCell(p1);
+ subtitleCell.setColspan(rr.getVisibleColumnCount());
+ titleCell.setHorizontalAlignment(1);
+ subtitleCell.setHorizontalAlignment(1);
+ table.addCell(titleCell);
+ table.addCell(subtitleCell);
+ //document.add(table);
+ }
+ return table;
+ }
+
+
+ private void paintPdfReportFooter(HttpServletRequest request, Document document, ReportRuntime rr, float[] f)
+ throws DocumentException, IOException {
+
+ HttpSession session = request.getSession();
+ String drilldown_index = (String) session.getAttribute("drilldown_index");
+ int index = 0;
+ try {
+ index = Integer.parseInt(drilldown_index);
+ } catch (NumberFormatException ex) {
+ index = 0;
+ }
+
+ String title = (String) session.getAttribute("FOOTER_"+index);
+ if(nvl(title).length()>0) {
+ PdfPTable table = new PdfPTable(1);
+ table.setWidthPercentage(100f);
+ table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+ table.getDefaultCell().setVerticalAlignment(Rectangle.ALIGN_BOTTOM);
+
+ Font font = FontFactory.getFont(FONT_FAMILY,
+ FONT_SIZE-3f,
+ Font.BOLD,
+ Color.BLACK);
+
+
+ //addEmptyRows(table,1);
+ table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+ //table.getDefaultCell().setBackgroundColor(Color.decode(Globals.getDataTableHeaderBackgroundFontColor()));
+ /*title = Utils.replaceInString(title, "<BR/>", " ");
+ title = Utils.replaceInString(title, "<br/>", " ");
+ title = Utils.replaceInString(title, "<br>", " ");
+ title = strip.stripHtml(nvl(title).trim());*/
+ StyleSheet style = new StyleSheet();
+
+ HTMLWorker htmlWorker = new HTMLWorker(document);
+ ArrayList cc = new ArrayList();
+ cc = htmlWorker.parseToList(new StringReader(title), style);
+
+ Phrase p1 = new Phrase();
+ for (int i = 0; i < cc.size(); i++){
+ Element elem = (Element)cc.get(i);
+ ArrayList al = elem.getChunks();
+ for (int j = 0; j < al.size(); j++) {
+ Chunk chunk = (Chunk) al.get(j);
+ chunk.font().setSize(6.0f);
+ }
+ p1.add(elem);
+ }
+
+/*
+ HTMLWorker.parseToList(new StringReader(nvl(title)), style);*/
+ PdfPCell titleCell = new PdfPCell(p1);
+ titleCell.setHorizontalAlignment(Element.ALIGN_LEFT);
+ table.addCell(titleCell);
+ //table.
+ document.add(table);
+ }
+ //return table;
+ }
+
+
+ private void paintPdfTableHeader(Document document, ReportData rd, PdfPTable table)
+ throws DocumentException {
+
+ Font font = FontFactory.getFont(FONT_FAMILY,
+ FONT_SIZE+1f,
+ Font.BOLD,
+ Color.decode(Globals.getDataTableHeaderFontColor()));
+ //table.setHeaderRows(1);
+ table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
+ table.getDefaultCell().setBackgroundColor(Color.decode(Globals.getDataTableHeaderBackgroundFontColor()));
+ String title = "";
+
+ boolean firstPass = true;
+
+ /*if(rd.reportTotalRowHeaderCols!=null) {
+ if(firstPass) {
+ table.addCell(new Paragraph("No.", font));
+ firstPass = false;
+ }
+ }*/
+ for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();)
+ {
+ if(firstPass) {
+ for(rd.reportRowHeaderCols.resetNext();rd.reportRowHeaderCols.hasNext();) {
+ /*if(firstPass) {
+ table.addCell(new Paragraph("No.", font));
+ firstPass = false;
+ } else {*/
+ RowHeaderCol rhc = rd.reportRowHeaderCols.getNext();
+ title = rhc.getColumnTitle();
+ title = Utils.replaceInString(title,"_nl_", " \n");
+ table.addCell(new Paragraph(title,font));
+ //}
+ }
+ }
+
+ ColumnHeaderRow chr = rd.reportColumnHeaderRows.getNext();
+ for (chr.resetNext(); chr.hasNext();) {
+ ColumnHeader ch = chr.getNext();
+ //System.out.println(ch);
+ if(ch.isVisible()) {
+ title = ch.getColumnTitle();
+ title = Utils.replaceInString(title,"_nl_", " \n");
+ table.addCell(new Paragraph(title,font));
+ }
+ }
+ }
+ }
+
+ public static String currentTime(String pattern) {
+ try {
+ SimpleDateFormat oracleDateFormat = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss");
+ Date sysdate = oracleDateFormat.parse(ReportLoader.getSystemDateTime());
+ SimpleDateFormat dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern());
+ return dtimestamp.format(sysdate)+" "+Globals.getTimeZone();
+ //paramList.add(new IdNameValue("DATE", dtimestamp.format(sysdate)+" "+Globals.getTimeZone()));
+ } catch(Exception ex) {}
+
+ SimpleDateFormat s = new SimpleDateFormat(pattern);
+ s.setTimeZone(TimeZone.getTimeZone(Globals.getTimeZone()));
+ //System.out.println("^^^^^^^^^^^^^^^^^^^^ " + Calendar.getInstance().getTime());
+ //System.out.println("^^^^^^^^^^^^^^^^^^^^ " + s.format(Calendar.getInstance().getTime()));
+ return s.format(Calendar.getInstance().getTime());
+ }
+
+ private PdfBean preparePdfBean(HttpServletRequest request,ReportRuntime rr) {
+ PdfBean pb = new PdfBean();
+
+ pb.setUserId(AppUtils.getUserID(request));
+
+ pb.setWhereToShowPageNumber(Globals.getPageNumberPosition());
+ pb.setAlternateColor(Globals.isDataAlternateColor());
+ pb.setTimestampPattern(Globals.getDatePattern());
+
+ int temp = -1;
+ try {
+ temp = Integer.parseInt(request.getParameter(AppConstants.RI_NEXT_PAGE));
+ } catch (NumberFormatException e) {}
+ pb.setCurrentPage(temp);
+
+ //pb.setPortrait( trueORfalse(request.getParameter("isPortrait"),true));
+ pb.setPortrait(trueORfalse(rr.getPDFOrientation() == "portait"?"true":"false", true));
+ //pb.setCoverPageIncluded( trueORfalse(request.getParameter("isCoverPageIncluded"), true));
+ //if(Globals.isCoverPageNeeded()) {
+ pb.setCoverPageIncluded(Globals.isCoverPageNeeded()?rr.isPDFCoverPage():false);
+ //}
+ pb.setTitle(nvl(request.getParameter("title")));
+ pb.setPagesize(nvls(request.getParameter("pagesize"),"LETTER"));
+
+ pb.setLogo1Url(rr.getPDFLogo1());
+ pb.setLogo2Url(rr.getPDFLogo2());
+ pb.setLogo1Size(rr.getPDFLogo1Size());
+ pb.setLogo2Size(rr.getPDFLogo2Size());
+ pb.setFullWebContextPath(request.getSession().getServletContext().getRealPath(File.separator));
+
+
+ pb.setDisplayChart(nvl(rr.getChartType()).trim().length()>0 && rr.getDisplayChart());
+
+ String id = nvl(request.getParameter("pdfAttachmentKey")).trim();
+ String log_id = nvl(request.getParameter("log_id")).trim();
+ if(id.length()>0 && log_id.length()>0)
+ pb.setAttachmentOfEmail(true);
+
+ return pb;
+ }
+
+ private boolean trueORfalse(String str) {
+ return (str != null) && (str.equalsIgnoreCase("true"));
+ }
+
+ private boolean trueORfalse(String str,boolean b_default) {
+ return str==null ? b_default : (str.equalsIgnoreCase("true"));
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/BarChartOptions.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/BarChartOptions.java
new file mode 100644
index 00000000..7e99dc6e
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/BarChartOptions.java
@@ -0,0 +1,75 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+public class BarChartOptions {
+ private boolean verticalOrientation;
+ private boolean stackedChart;
+ private boolean displayBarControls;
+ private boolean xAxisDateType;
+ private boolean minimizeXAxisTickers;
+ private boolean timeAxis;
+ private boolean yAxisLogScale;
+
+ public boolean isVerticalOrientation() {
+ return verticalOrientation;
+ }
+ public void setVerticalOrientation(boolean verticalOrientation) {
+ this.verticalOrientation = verticalOrientation;
+ }
+ public boolean isStackedChart() {
+ return stackedChart;
+ }
+ public void setStackedChart(boolean stackedChart) {
+ this.stackedChart = stackedChart;
+ }
+ public boolean isDisplayBarControls() {
+ return displayBarControls;
+ }
+ public void setDisplayBarControls(boolean displayBarControls) {
+ this.displayBarControls = displayBarControls;
+ }
+ public boolean isxAxisDateType() {
+ return xAxisDateType;
+ }
+ public void setxAxisDateType(boolean xAxisDateType) {
+ this.xAxisDateType = xAxisDateType;
+ }
+ public boolean isMinimizeXAxisTickers() {
+ return minimizeXAxisTickers;
+ }
+ public void setMinimizeXAxisTickers(boolean minimizeXAxisTickers) {
+ this.minimizeXAxisTickers = minimizeXAxisTickers;
+ }
+ public boolean isTimeAxis() {
+ return timeAxis;
+ }
+ public void setTimeAxis(boolean timeAxis) {
+ this.timeAxis = timeAxis;
+ }
+ public boolean isyAxisLogScale() {
+ return yAxisLogScale;
+ }
+ public void setyAxisLogScale(boolean yAxisLogScale) {
+ this.yAxisLogScale = yAxisLogScale;
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CategoryAxisJSON.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CategoryAxisJSON.java
new file mode 100644
index 00000000..93fab6e9
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CategoryAxisJSON.java
@@ -0,0 +1,24 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+public class CategoryAxisJSON extends IndexValueJSON {
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartD3Helper.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartD3Helper.java
new file mode 100644
index 00000000..c46f48ac
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartD3Helper.java
@@ -0,0 +1,4064 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.lang.time.DateUtils;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.model.ReportHandler;
+import org.openecomp.portalsdk.analytics.model.base.ChartSeqComparator;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.HtmlStripper;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.view.ReportData;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+
+public class ChartD3Helper {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ChartD3Helper.class);
+
+
+ private ReportRuntime reportRuntime;
+ private String chartType;
+
+ public static final long HOUR = 3600*1000;
+ public static final long DAY = 3600*1000*24;
+ public static final long MONTH = 3600*1000*24*31;
+ public static final long YEAR = 3600*1000*24*365;
+
+
+ public ChartD3Helper() {
+
+ }
+
+ /**
+ * @return the chartType
+ */
+ public String getChartType() {
+ return chartType;
+ }
+
+ /**
+ * @param chartType the chartType to set
+ */
+ public void setChartType(String chartType) {
+ this.chartType = chartType;
+ }
+
+ public ChartD3Helper(ReportRuntime rr) {
+ this.reportRuntime = rr;
+ }
+
+ public String createVisualization(String reportID, HttpServletRequest request) throws RaptorException {
+ //From annotations chart
+ clearReportRuntimeBackup(request);
+
+ //HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
+ final Long user_id = new Long((long) UserUtils.getUserId(request));
+ //String action = request.getParameter(AppConstants.RI_ACTION);
+ //String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+
+ ReportHandler rh = new ReportHandler();
+ ReportData reportData = null;
+ HashMap<String, String> chartOptionsMap = new HashMap<String, String>();
+ try {
+ if(reportID !=null) {
+ reportRuntime = rh.loadReportRuntime(request, reportID, true, 1);
+ setChartType(reportRuntime.getChartType());
+ reportData = reportRuntime.loadReportData(0, user_id.toString(), 10000,request, false);
+ }
+
+
+
+ String rotateLabelsStr = "";
+ rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle());
+ if(rotateLabelsStr.toLowerCase().equals("standard")) {
+ rotateLabelsStr = "0";
+ } else if (rotateLabelsStr.toLowerCase().equals("up45")) {
+ rotateLabelsStr = "45";
+ } else if (rotateLabelsStr.toLowerCase().equals("down45")) {
+ rotateLabelsStr = "-45";
+ } else if (rotateLabelsStr.toLowerCase().equals("up90")) {
+ rotateLabelsStr = "90";
+ } else if (rotateLabelsStr.toLowerCase().equals("down90")) {
+ rotateLabelsStr = "-90";
+ } else
+ rotateLabelsStr = "0";
+
+ String width = (AppUtils.getRequestNvlValue(request, "width").length()>0?AppUtils.getRequestNvlValue(request, "width"):(AppUtils.nvl(reportRuntime.getChartWidth()).length()>0?reportRuntime.getChartWidth():"700"));
+ String height = (AppUtils.getRequestNvlValue(request, "height").length()>0?AppUtils.getRequestNvlValue(request, "height"):(AppUtils.nvl(reportRuntime.getChartHeight()).length()>0?reportRuntime.getChartHeight():"300"));
+ String animationStr = (AppUtils.getRequestNvlValue(request, "animation").length()>0?AppUtils.getRequestNvlValue(request, "animation"):new Boolean(reportRuntime.isAnimateAnimatedChart()).toString());
+
+ String rotateLabels = (AppUtils.getRequestNvlValue(request, "rotateLabels").length()>0?AppUtils.getRequestNvlValue(request, "rotateLabels"):(rotateLabelsStr.length()>0?rotateLabelsStr:"0"));
+ String staggerLabelsStr = (AppUtils.getRequestNvlValue(request, "staggerLabels").length()>0?AppUtils.getRequestNvlValue(request, "staggerLabels"):"false");
+ String showMaxMinStr = (AppUtils.getRequestNvlValue(request, "showMaxMin").length()>0?AppUtils.getRequestNvlValue(request, "showMaxMin"):"false");
+ String showControlsStr = (AppUtils.getRequestNvlValue(request, "showControls").length()>0?AppUtils.getRequestNvlValue(request, "showControls"):new Boolean(reportRuntime.displayBarControls()).toString());
+ String showLegendStr = (AppUtils.getRequestNvlValue(request, "showLegend").length()>0?AppUtils.getRequestNvlValue(request, "showLegend"):new Boolean(!new Boolean(reportRuntime.hideChartLegend())).toString());
+ String topMarginStr = AppUtils.getRequestNvlValue(request, "topMargin");
+ String topMargin = (AppUtils.nvl(topMarginStr).length()<=0)?(reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30"):topMarginStr;
+ String bottomMarginStr = AppUtils.getRequestNvlValue(request, "bottomMargin");
+ String bottomMargin = (AppUtils.nvl(bottomMarginStr).length()<=0)?(reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50"):bottomMarginStr;
+ String leftMarginStr = AppUtils.getRequestNvlValue(request, "leftMargin");
+ String leftMargin = (AppUtils.nvl(leftMarginStr).length()<=0)?(reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100"):leftMarginStr;
+ String rightMarginStr = AppUtils.getRequestNvlValue(request, "rightMargin");
+ String rightMargin = (AppUtils.nvl(rightMarginStr).length()<=0)?(reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160"):rightMarginStr;
+ String showTitleStr = (AppUtils.getRequestNvlValue(request, "showTitle").length()>0?AppUtils.getRequestNvlValue(request, "showTitle"):new Boolean(reportRuntime.displayChartTitle()).toString());
+ String subType = AppUtils.getRequestNvlValue(request, "subType").length()>0?AppUtils.getRequestNvlValue(request, "subType"):(AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():"");
+ String stackedStr = AppUtils.getRequestNvlValue(request, "stacked").length()>0?AppUtils.getRequestNvlValue(request, "stacked"):new Boolean(reportRuntime.isChartStacked()).toString();
+ String horizontalBar = AppUtils.getRequestNvlValue(request, "horizontalBar").length()>0?AppUtils.getRequestNvlValue(request, "horizontalBar"):new Boolean(reportRuntime.isHorizontalOrientation()).toString();
+ String barRealTimeAxis = AppUtils.getRequestNvlValue(request, "barRealTimeAxis");
+ String barReduceXAxisLabels = AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels").length()>0?AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels"):new Boolean(reportRuntime.isLessXaxisTickers()).toString();;
+ String timeAxis = AppUtils.getRequestNvlValue(request, "timeAxis").length()>0?AppUtils.getRequestNvlValue(request, "timeAxis"):new Boolean(reportRuntime.isTimeAxis()).toString();
+ String logScale = AppUtils.getRequestNvlValue(request, "logScale").length()>0?AppUtils.getRequestNvlValue(request, "logScale"):new Boolean(reportRuntime.isLogScale()).toString();
+ String precision = AppUtils.getRequestNvlValue(request, "precision").length()>0?AppUtils.getRequestNvlValue(request, "precision"):"2";
+
+
+ chartOptionsMap.put("width", width);
+ chartOptionsMap.put("height", height);
+ chartOptionsMap.put("animation", animationStr);
+ chartOptionsMap.put("rotateLabels", rotateLabels);
+ chartOptionsMap.put("staggerLabels", staggerLabelsStr);
+ chartOptionsMap.put("showMaxMin", showMaxMinStr);
+ chartOptionsMap.put("showControls", showControlsStr);
+ chartOptionsMap.put("showLegend", showLegendStr);
+ chartOptionsMap.put("topMargin", topMargin);
+ chartOptionsMap.put("bottomMargin", bottomMargin);
+ chartOptionsMap.put("leftMargin", leftMargin);
+ chartOptionsMap.put("rightMargin", rightMargin);
+ chartOptionsMap.put("showTitle", showTitleStr);
+ chartOptionsMap.put("subType", subType);
+ chartOptionsMap.put("stacked", stackedStr);
+ chartOptionsMap.put("horizontalBar", horizontalBar);
+ chartOptionsMap.put("timeAxis", timeAxis);
+ chartOptionsMap.put("barRealTimeAxis", barRealTimeAxis);
+ chartOptionsMap.put("barReduceXAxisLabels", barReduceXAxisLabels);
+
+ chartOptionsMap.put("logScale", logScale);
+ chartOptionsMap.put("precision", precision);
+
+
+ } catch (RaptorException ex) {
+ ex.printStackTrace();
+ }
+ return createVisualization(reportRuntime, chartOptionsMap, request);
+ }
+
+ public String createVisualization(ReportRuntime reportRuntime, HttpServletRequest request) throws RaptorException {
+
+ String rotateLabelsStr = "";
+ rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle());
+ if(rotateLabelsStr.toLowerCase().equals("standard")) {
+ rotateLabelsStr = "0";
+ } else if (rotateLabelsStr.toLowerCase().equals("up45")) {
+ rotateLabelsStr = "45";
+ } else if (rotateLabelsStr.toLowerCase().equals("down45")) {
+ rotateLabelsStr = "-45";
+ } else if (rotateLabelsStr.toLowerCase().equals("up90")) {
+ rotateLabelsStr = "90";
+ } else if (rotateLabelsStr.toLowerCase().equals("down90")) {
+ rotateLabelsStr = "-90";
+ } else
+ rotateLabelsStr = "0";
+
+ HashMap<String,String> chartOptionsMap = new HashMap<String, String>();
+ chartOptionsMap.put("width", reportRuntime.getChartWidth());
+ chartOptionsMap.put("height", reportRuntime.getChartHeight());
+ chartOptionsMap.put("animation", new Boolean(reportRuntime.isAnimateAnimatedChart()).toString());
+ chartOptionsMap.put("rotateLabels", rotateLabelsStr);
+ chartOptionsMap.put("staggerLabels", "false");
+ chartOptionsMap.put("showMaxMin", "false");
+ chartOptionsMap.put("showControls", new Boolean(reportRuntime.displayBarControls()).toString());
+ chartOptionsMap.put("showLegend", new Boolean(!reportRuntime.hideChartLegend()).toString());
+ chartOptionsMap.put("topMargin", reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30");
+ chartOptionsMap.put("bottomMargin", reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50");
+ chartOptionsMap.put("leftMargin", reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100");
+ chartOptionsMap.put("rightMargin", reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160");
+ chartOptionsMap.put("showTitle", new Boolean(reportRuntime.displayChartTitle()).toString());
+ chartOptionsMap.put("subType", (AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():""));
+ chartOptionsMap.put("stacked", new Boolean(reportRuntime.isChartStacked()).toString());
+ chartOptionsMap.put("horizontalBar", new Boolean(reportRuntime.isHorizontalOrientation()).toString());
+ chartOptionsMap.put("timeAxis", new Boolean(reportRuntime.isTimeAxis()).toString());
+ chartOptionsMap.put("barReduceXAxisLabels", new Boolean(reportRuntime.isLessXaxisTickers()).toString());
+
+ chartOptionsMap.put("logScale", new Boolean(reportRuntime.isLogScale()).toString());
+ chartOptionsMap.put("precision", "2");
+
+
+
+ return createVisualization(reportRuntime, chartOptionsMap, request);
+ }
+
+ public String createVisualization(ReportRuntime reportRuntime, HashMap<String,String> chartOptionsMap, HttpServletRequest request) throws RaptorException {
+
+ //String width, String height, boolean animation, String rotateLabels, boolean staggerLabels, boolean showMaxMin, boolean showLegend, boolean showControls, String topMargin, String bottomMargin, boolean showTitle, String subType
+
+ String width = chartOptionsMap.get("width");
+ String height = chartOptionsMap.get("height");
+ boolean animation = getBooleanValue(chartOptionsMap.get("animation"), true);
+ String rotateLabels = chartOptionsMap.get("rotateLabels");
+ boolean staggerLabels = getBooleanValue(chartOptionsMap.get("staggerLabels"));
+ boolean showMaxMin = getBooleanValue(chartOptionsMap.get("showMaxMin"), false);
+ boolean showLegend = getBooleanValue(chartOptionsMap.get("showLegend"), true);
+ boolean showControls = getBooleanValue(chartOptionsMap.get("showControls"), true);
+ String topMargin = chartOptionsMap.get("topMargin");
+ String bottomMargin = chartOptionsMap.get("bottomMargin");
+ String leftMargin = chartOptionsMap.get("leftMargin");
+ String rightMargin = chartOptionsMap.get("rightMargin");
+ boolean showTitle = getBooleanValue(chartOptionsMap.get("showTitle"), true);
+ String subType = chartOptionsMap.get("subType");
+ boolean stacked = getBooleanValue(chartOptionsMap.get("stacked"), false);
+ boolean horizontalBar = getBooleanValue(chartOptionsMap.get("horizontalBar"), false);
+ boolean barRealTimeAxis = getBooleanValue(chartOptionsMap.get("barRealTimeAxis"), true);
+ boolean barReduceXAxisLabels= getBooleanValue(chartOptionsMap.get("barReduceXAxisLabels"), false);
+ boolean timeAxis = getBooleanValue(chartOptionsMap.get("timeAxis"), true);
+
+
+ boolean logScale = getBooleanValue(chartOptionsMap.get("logScale"), false);
+
+ int precision = 2;
+
+ try {
+ precision = Integer.parseInt(chartOptionsMap.get("precision"));
+ } catch (NumberFormatException ex) {
+
+ }
+
+ final Long user_id = new Long((long) UserUtils.getUserId(request));
+
+ HttpSession session = null;
+ session = request.getSession();
+
+ String chartType = reportRuntime.getChartType();
+ List l = reportRuntime.getAllColumns();
+ List lGroups = reportRuntime.getAllChartGroups();
+ HashMap mapYAxis = reportRuntime.getAllChartYAxis(reportRuntime.getReportParamValues());
+ //ReportParamValues reportParamValues = reportRuntime.getReportParamValues();
+ String chartLeftAxisLabel = reportRuntime.getFormFieldFilled(nvl(reportRuntime.getChartLeftAxisLabel()));
+ String chartRightAxisLabel = reportRuntime.getFormFieldFilled(nvl(reportRuntime.getChartRightAxisLabel()));
+
+ boolean multipleSeries = reportRuntime.isMultiSeries();
+
+ java.util.HashMap formValues = null;
+ formValues = getRequestParametersMap(reportRuntime, request);
+
+
+ String legendColumnName = (reportRuntime.getChartLegendColumn()!=null)?reportRuntime.getChartLegendColumn().getDisplayName():"Legend Column";
+ boolean displayChart = (nvl(chartType).length()>0)&&reportRuntime.getDisplayChart();
+ HashMap additionalChartOptionsMap = new HashMap();
+
+ StringBuffer wholeScript = new StringBuffer("");
+
+ String title = reportRuntime.getReportTitle();
+
+ title = parseTitle(title, formValues);
+
+ if(displayChart) {
+ DataSet ds = null;
+ try {
+ if (!(chartType.equals(AppConstants.GT_HIERARCHICAL) || chartType.equals(AppConstants.GT_HIERARCHICAL_SUNBURST) || chartType.equals(AppConstants.GT_ANNOTATION_CHART))) {
+ ds = (DataSet) loadChartData(new Long(user_id).toString(), request);
+ } else if(chartType.equals(AppConstants.GT_ANNOTATION_CHART)) {
+ String reportSQL = reportRuntime.getWholeSQL();
+ String dbInfo = reportRuntime.getDBInfo();
+ ds = ConnectionUtils.getDataSet(reportSQL, dbInfo);
+ if(ds.getRowCount()<=0) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("********************************************************************************"));
+ logger.debug(EELFLoggerDelegate.debugLogger, (chartType.toUpperCase()+" - " + "Report ID : " + reportRuntime.getReportID() + " DATA IS EMPTY"));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("QUERY - " + reportSQL));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("********************************************************************************"));
+ }
+ } else if(chartType.equals(AppConstants.GT_HIERARCHICAL)||chartType.equals(AppConstants.GT_HIERARCHICAL_SUNBURST)) {
+ String reportSQL = reportRuntime.getWholeSQL();
+ String dbInfo = reportRuntime.getDBInfo();
+ ds = ConnectionUtils.getDataSet(reportSQL, dbInfo);
+ }
+ } catch (RaptorException ex) {
+ //throw new RaptorException("Error while loading chart data", ex);
+ logger.error(EELFLoggerDelegate.debugLogger, ("********************************************************************************"));
+ logger.error(EELFLoggerDelegate.debugLogger, (chartType.toUpperCase()+" - " + "Report ID : " + reportRuntime.getReportID() + " ERROR THROWN FOR GIVEN QUERY "));
+ logger.error(EELFLoggerDelegate.debugLogger, ("QUERY - " + reportRuntime.getWholeSQL()));
+ logger.error(EELFLoggerDelegate.debugLogger, ("ERROR STACK TRACE" + ex.getMessage()));
+ logger.error(EELFLoggerDelegate.debugLogger, ("********************************************************************************"));
+
+ }
+ if(ds==null) {
+ //displayChart = false;
+ if(chartType.equals(AppConstants.GT_ANNOTATION_CHART))
+ ds = new DataSet();
+ else
+ displayChart = false;
+ }
+ if(displayChart) {
+
+ if (chartType.equals(AppConstants.GT_BAR_3D)) {
+
+ // get category if not give the column name for the data column use this to develop series.
+ boolean hasCategoryAxis = reportRuntime.hasSeriesColumn();
+
+ boolean hasCustomizedChartColor = false;
+ int flag = 0;
+ flag = hasCategoryAxis?1:0;
+ Object uniqueElements [] = null;
+ ArrayList uniqueElementsList = new ArrayList();
+ Object uniqueXAxisElements[] = null;
+ ArrayList ts = new ArrayList();
+ //Set<String> ts1 = new HashSet();
+ ArrayList<String> ts1 = new ArrayList();
+ HashMap<String, String> columnMap = new HashMap();
+ String uniqueXAxisStr = "";
+ if(!timeAxis){
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ uniqueXAxisStr = ds.getString(i, 0);
+ ts1.add(uniqueXAxisStr);
+ }
+ }
+ uniqueElementsList.addAll(ts1);
+ uniqueXAxisElements = ts1.toArray();
+
+ if(flag == 1) {
+ StringBuffer catStr = new StringBuffer("");
+ String color="";
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ catStr = new StringBuffer("");
+ catStr.append(ds.getString(i, 2));
+ try {
+ if(ds.getString(i, "chart_color")!=null) {
+ color = ds.getString(i, "chart_color");
+ hasCustomizedChartColor = true;
+ catStr.append("|"+color);
+ }
+ } catch (ArrayIndexOutOfBoundsException ex) {
+ //System.out.println("No Chart Color");
+ }
+
+ if(catStr.length()>0) {
+ //duplicates are avoided
+ if(!ts.contains(catStr.toString()))
+ ts.add(catStr.toString());
+
+ }
+ /* Get Chart LeftAxis Label even from Range Axis definition. */
+ DataColumnType dct = null;
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ dct = (DataColumnType) iter.next();
+ if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
+ if(nvl(chartLeftAxisLabel).length()<=0) {
+ chartLeftAxisLabel = nvl(dct.getYAxis());
+ chartLeftAxisLabel = (chartLeftAxisLabel.indexOf("|")!=-1)?chartLeftAxisLabel.substring(0,chartLeftAxisLabel.indexOf("|")):"";
+ }
+ }
+ }
+
+ }
+ //Object uniqueElements [] = ts.toArray();
+ //SortedSet s = Collections.synchronizedSortedSet(ts);
+ uniqueElements = ts.toArray();
+ } else {
+ DataColumnType dct = null;
+ List yTextSeries = reportRuntime.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues);
+ //if(columnValuesList.size() == 1) {
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ dct = (DataColumnType) iter.next();
+
+ if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
+ if((dct.isChartSeries()!=null && dct.isChartSeries().booleanValue()) || (dct.getChartSeq()!=null && dct.getChartSeq()>0) ) {
+
+ if(nvl(dct.getChartColor()).length()>0) hasCustomizedChartColor = true;
+ if(hasCustomizedChartColor) {
+ //duplicates are avoided
+ if(!ts.contains(dct.getDisplayName()+"|"+nvl(dct.getChartColor())))
+ ts.add(dct.getDisplayName()+"|"+nvl(dct.getChartColor()));
+ } else {
+ //duplicates are avoided
+ if(!ts.contains(dct.getDisplayName()))
+ ts.add(dct.getDisplayName());
+ }
+ if(nvl(chartLeftAxisLabel).length()<=0) {
+ chartLeftAxisLabel = nvl(dct.getYAxis());
+ chartLeftAxisLabel = (chartLeftAxisLabel.indexOf("|")!=-1)?chartLeftAxisLabel.substring(0,chartLeftAxisLabel.indexOf("|")):"";
+ }
+ columnMap.put(dct.getDisplayName(), dct.getColId());
+ /*
+ ts.add(dct.getDisplayName());
+ if(nvl(chartLeftAxisLabel).length()<=0) {
+ chartLeftAxisLabel = nvl(dct.getYAxis());
+ chartLeftAxisLabel = (chartLeftAxisLabel.indexOf("|")!=-1)?chartLeftAxisLabel.substring(0,chartLeftAxisLabel.indexOf("|")):"";
+ }
+ columnMap.put(dct.getDisplayName(), dct.getColId());
+ */
+ }
+ }
+
+ }
+ //SortedSet s = Collections.synchronizedSortedSet(ts);
+ uniqueElements = ts.toArray();
+
+ }
+
+ wholeScript.append("<!DOCTYPE html>\n");
+ wholeScript.append("<html>\n");
+ wholeScript.append("<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF8\">\n");
+ wholeScript.append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n");
+ wholeScript.append("<link href=\""+ AppUtils.getBaseFolderURL() +"d3/css/nv.d3.css\" rel=\"stylesheet\" type=\"text/css\">\n");
+ //wholeScript.append("")
+ wholeScript.append("<style>\n " +
+ " body { \n" +
+ " overflow-y:scroll; \n" +
+ " } \n" +
+ " text { \n" +
+ " font: 12px sans-serif; \n" +
+ " } \n" +
+ " svg { \n" +
+ " display: block;\n" +
+ " } \n" +
+ " #chart"+reportRuntime.getReportID()+" svg { \n" +
+ " height: "+ (nvl(height).length()>0?(height.endsWith("px")?height:height+"px"):"420px") + "; \n" +
+ " width: "+ (nvl(width).length()>0?(width.endsWith("px")?width:width+"px"):"700px") + "; \n" +
+ " min-width: 100px; \n" +
+ " min-height: 100px; \n" +
+ " } \n" +
+ " tr.z-row-over > td.z-row-inner, tr.z-row-over > .z-cell {" +
+ " background-color: rgb(255, 255, 255); "+
+ "} \n");
+
+ wholeScript.append(".nodatadiv {\n");
+ wholeScript.append(" display: table-cell;\n");
+ wholeScript.append(" width: 700px;\n");
+ wholeScript.append(" height:370px;\n");
+ wholeScript.append(" text-align:center;\n");
+ wholeScript.append(" vertical-align: middle;\n");
+ wholeScript.append("}\n");
+ wholeScript.append(".nodatainner {\n");
+ wholeScript.append(" padding: 10px;\n");
+ wholeScript.append("}\n");
+
+ wholeScript.append(" </style> \n" );
+ wholeScript.append("<body> \n");
+ if(showTitle)
+ wholeScript.append("<div align=\"center\"><H3>" + title +"</H3></div>");
+
+ wholeScript.append("<div id=\"chart"+reportRuntime.getReportID()+"\"> <svg></svg> </div> \n");
+ //js files
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/d3.v3.min.js\"></script>");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/nv.d3.min.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/tooltip.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/utils.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/axis.min.js\"></script> \n");
+ //wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/discreteBar.js\"></script> \n");
+ //wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/discreteBarChart.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/multiChart.js\"></script> \n");
+ //json
+ wholeScript.append("<script> \n");
+ wholeScript.append("historicalBarChart = [ \n");
+ //wholeScript.append("{ \n");
+ // data
+ ArrayList dataSeries = new ArrayList();
+
+ String uniqueElement = "";
+ for (int i = 0; i < uniqueElements.length; i++) {
+ uniqueElement = (String)uniqueElements[i];
+ if(multipleSeries && (nvl(chartRightAxisLabel).length() > 0))
+ dataSeries.add(new StringBuffer(" { \"type\":\"bar\", \"key\": \""+ (hasCustomizedChartColor?(uniqueElement.indexOf("|")!=-1?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement):uniqueElement) +"\", \"yAxis\": \""+(i+1)+"\", "+ (hasCustomizedChartColor?("\"color\": \""+uniqueElement.substring(uniqueElement.indexOf("|")+1) + "\","):"")+"\"values\": ["));
+ else
+ dataSeries.add(new StringBuffer(" { \"type\":\"bar\", \"key\": \""+ (hasCustomizedChartColor?(uniqueElement.indexOf("|")!=-1?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement):uniqueElement) +"\", \"yAxis\": \""+(1)+"\", "+ (hasCustomizedChartColor?("\"color\": \""+uniqueElement.substring(uniqueElement.indexOf("|")+1) + "\","):"")+"\"values\": ["));
+ }
+
+ // added to load all date elements
+ HashMap<String, HashMap<String, String>> dataSeriesMap = new HashMap<String, HashMap<String, String>>();
+
+ for (int i = 0; i < uniqueElements.length; i++) {
+ if(multipleSeries && (nvl(chartRightAxisLabel).length() > 0))
+ dataSeriesMap.put((String) uniqueElements[i], new HashMap<String, String>());
+ //dataSeries.add(new StringBuffer(" { \"type\":\"bar\", \"key\": \""+ uniqueElements[i] +"\", \"yAxis\": \""+(i+1)+"\", \"values\": ["));
+ else
+ dataSeriesMap.put((String) uniqueElements[i], new HashMap<String, String>());
+
+ //dataSeries.add(new StringBuffer(" { \"type\":\"bar\", \"key\": \""+ uniqueElements[i] +"\", \"yAxis\": \""+(1)+"\", \"values\": ["));
+ }
+
+ String dateStr = null;
+ java.util.Date date = null;
+
+ final int YEARFLAG = 1;
+ final int MONTHFLAG = 2;
+ final int DAYFLAG = 3;
+ final int HOURFLAG = 4;
+ final int MINFLAG = 5;
+ final int SECFLAG = 6;
+ final int MILLISECFLAG = 7;
+ final int DAYOFTHEWEEKFLAG = 8;
+ final int FLAGDATE = 9;
+
+ int flagNoDate = 0;
+
+ int MAXNUM = 0;
+ int YAXISNUM = 0;
+ int flagNull = 0;
+
+ double YAXISDOUBLENUM = 0.0;
+ double MAXDOUBLENUM = 0.0;
+ int MAXNUMDECIMALPLACES = 0;
+
+ int formatFlag = 0;
+
+ TreeSet<String> dateStrList = new TreeSet<String>();
+ // added to store all date elements
+ SortedSet<String> sortSet = new TreeSet<String>();
+ int count = 0;
+ if(flag!= 1) {
+ HashMap dataSeriesStrMap = new HashMap();
+ HashMap dataSeriesOverAllMap = new HashMap();
+ String valueDataSeries = "";
+
+ for (int j = 0; j < uniqueElements.length; j++) {
+ dataSeriesStrMap = new HashMap();
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ flagNoDate = 0;
+ YAXISNUM = 0;
+ YAXISDOUBLENUM = 0.0;
+ flagNull= 0;
+ dateStr = ds.getString(i, 1);
+ if(timeAxis) {
+ date = getDateFromDateStr(dateStr);
+ formatFlag = getFlagFromDateStr(dateStr);
+ }
+ uniqueElement = (String)uniqueElements[j];
+ if(date==null) {
+ //continue;
+ flagNoDate = 1;
+ int pos = 0;
+ //if(!((String)uniqueElementsList.get(i)).equals(dateStr)) {
+ for (int f=0 ; f< uniqueXAxisElements.length; f++) {
+ if(uniqueXAxisElements[f].equals(dateStr)){
+ pos = f ;
+ break;
+ }
+ }
+ /*for(int f=0; f<uniqueElementsList.size() && f < pos; f++)
+ {
+ StringBuffer strBuf = ((StringBuffer)dataSeries.get(j));
+ if(strBuf.indexOf((String)uniqueElementsList.get(f)) < 0 ) {
+ dataSeriesStrMap.put((String)uniqueElementsList.get(f), value);
+ //((StringBuffer) dataSeries.get(j)).append ("{ \"x\":\"" + (String)uniqueElementsList.get(f) + "\" , \"y\": null },");
+ }
+ }*/
+ //}
+
+ dateStrList.add("'"+dateStr+"'");
+ //uniqueElement = (String)uniqueElements[j];
+ try {
+ YAXISNUM = Integer.parseInt(ds.getString(i, columnMap.get((hasCustomizedChartColor?(uniqueElement.indexOf("|")!=-1?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement):uniqueElement))));
+ //if(MAXNUM < YAXISNUM) MAXNUM = YAXISNUM;
+ if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM;
+ } catch (NumberFormatException ex) {
+ try {
+ YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, columnMap.get((hasCustomizedChartColor?(uniqueElement.indexOf("|")!=-1?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement):uniqueElement))));
+ MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM);
+ if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM;
+ } catch (NumberFormatException ex1) {
+ flagNull = 1;
+ }
+ //flagNull = 1;
+ }
+ /* For Non-date type value enclose with double quotes */
+ // ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":\"" + dateStr + "\" , \"y\":" + (flagNull==0?(YAXISDOUBLENUM>0?YAXISDOUBLENUM:YAXISNUM):null) +"}, ");
+ if(logScale) {
+ // ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":\"" + dateStr + "\" , \"y\":" + (flagNull==0?(YAXISDOUBLENUM>0?new Double(Math.log10(YAXISDOUBLENUM)).toString():(YAXISNUM>0?new Double(Math.log10(new Integer(YAXISNUM).doubleValue())).toString():null)):null) +"}, ");
+ valueDataSeries = "{ \"x\":\"" + dateStr + "\" , \"y\":" + (flagNull == 0 ? (YAXISDOUBLENUM>0?new Double(Math.log10(YAXISDOUBLENUM)).toString():new Double(Math.log10(new Double(YAXISNUM>0?YAXISNUM:1).doubleValue())).toString()): null) +"}, ";
+ dataSeriesStrMap.put(dateStr, valueDataSeries);
+ } else {
+ //((StringBuffer) dataSeries.get(j)).append ("{ \"x\":\"" + dateStr + "\" , \"y\":" + (flagNull==0?(YAXISDOUBLENUM>0?YAXISDOUBLENUM:YAXISNUM):null) +"}, ");
+ valueDataSeries = "{ \"x\":\"" + dateStr + "\" , \"y\":" + (flagNull == 0 ? (YAXISDOUBLENUM>0?YAXISDOUBLENUM:YAXISNUM): null) +"}, ";
+ dataSeriesStrMap.put(dateStr, valueDataSeries);
+
+ }
+
+ dataSeriesOverAllMap.put(uniqueElements[j], dataSeriesStrMap);
+
+ //((StringBuffer) dataSeries.get(j)).append ("{ \"x\":\"" + dateStr + "\" , \"y\":\"" + ds.getString(i, columnMap.get((String)uniqueElements[j])) +"\"}, ");
+ } else {
+
+ if(!barRealTimeAxis) { // true - non-time
+ if(!dateStrList.contains(new Long(date.getTime()).toString())) {
+ dateStrList.add(new Long(date.getTime()).toString());
+ for (int k = 0; k < uniqueElements.length; k++) {
+ //((StringBuffer) dataSeries.get(k)).append ("{ \"x\":" + date.getTime() + " , \"y\":null}, ");
+ HashMap<String, String> dataMap = dataSeriesMap.get((String) uniqueElements[k]);
+ dataMap.put(date.getTime()+"", "null");
+
+ }
+ }
+ }
+ //if(ds.getString(i, 2).equals(uniqueElements[j])) {
+ /*if(!dateStrList.contains(new Long(date.getTime()).toString())) {
+ for (int k = 0; k < uniqueElements.length; k++) {
+ ((StringBuffer) dataSeries.get(k)).append ("{ \"x\":" + date.getTime() + " , \"y\":null}, ");
+ }
+ }*/
+ //dateStrList.add(new Long(date.getTime()).toString());
+ try {
+ YAXISNUM = Integer.parseInt(ds.getString(i, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))));
+ dateStrList.add(new Long(date.getTime()).toString());
+ //if(MAXNUM < YAXISNUM) MAXNUM = YAXISNUM;
+ if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM;
+ } catch (NumberFormatException ex) {
+ try {
+ YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))));
+ MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM);
+ if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM;
+ } catch (NumberFormatException ex1) {
+ flagNull = 1;
+ }
+
+ //flagNull = 1;
+ }
+ HashMap<String, String> dataMap = dataSeriesMap.get((String) uniqueElements[j]);
+ if(logScale) {
+ dataMap.put(date.getTime()+"", (flagNull == 0 ? (YAXISDOUBLENUM>0?new Double(Math.log10(YAXISDOUBLENUM)).toString():(YAXISNUM>0?new Double(Math.log10(new Integer(YAXISNUM).doubleValue())).toString():null)): "null"));
+ } else {
+ dataMap.put(date.getTime()+"", (flagNull == 0 ? (YAXISDOUBLENUM>0?new Double(YAXISDOUBLENUM).toString():new Integer(YAXISNUM).toString()): "null"));
+ }
+
+
+ // ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + (flagNull==0?(YAXISDOUBLENUM>0?YAXISDOUBLENUM:YAXISNUM):null) +"}, ");
+
+ //((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + ds.getString(i, columnMap.get((String)uniqueElements[j])) +"}, ");
+ }
+ //}
+ }
+ }
+ for(int kI = 0; kI < uniqueElements.length; kI++) {
+ HashMap dataSeriesStrMap1 = (HashMap) dataSeriesOverAllMap.get(uniqueElements[kI]);
+ for (int kL = 0; kL < uniqueXAxisElements.length; kL++) {
+ if(dataSeriesStrMap1.containsKey(uniqueXAxisElements[kL])) {
+ ((StringBuffer) dataSeries.get(kI)).append ((String)dataSeriesStrMap1.get(uniqueXAxisElements[kL]));
+ } else {
+ ((StringBuffer) dataSeries.get(kI)).append ("{ \"x\":\"" + uniqueXAxisElements[kL] + "\" , \"y\": null }, ");
+ }
+ }
+ }
+
+ } else {
+ HashMap dataSeriesStrMap = new HashMap();
+ HashMap dataSeriesOverAllMap = new HashMap();
+ String valueDataSeries = "";
+ for (int j = 0; j < uniqueElements.length; j++) {
+ dataSeriesStrMap = new HashMap();
+
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ flagNoDate = 0;
+ YAXISNUM = 0;
+ YAXISDOUBLENUM = 0.0;
+ flagNull= 0;
+ //flagSecondNull = 0;
+ dateStr = ds.getString(i, 1);
+ if(timeAxis) {
+ date = getDateFromDateStr(dateStr);
+ formatFlag = getFlagFromDateStr(dateStr);
+ }
+ uniqueElement = (String)uniqueElements[j];
+ if(date==null) {
+ //continue;
+ flagNoDate = 1;
+ int pos = 0;
+ //if(!((String)uniqueElementsList.get(i)).equals(dateStr)) {
+ for (int f=0 ; f< uniqueXAxisElements.length; f++) {
+ if(uniqueXAxisElements[f].equals(dateStr)){
+ pos = f ;
+ break;
+ }
+ }
+ /*for(int f=0; f<uniqueElementsList.size() && f < pos; f++)
+ {
+ StringBuffer strBuf = ((StringBuffer)dataSeries.get(j));
+ if(strBuf.indexOf((String)uniqueElementsList.get(f)) < 0 ) {
+ dataSeriesStrMap.put((String)uniqueElementsList.get(f), value);
+ //((StringBuffer) dataSeries.get(j)).append ("{ \"x\":\"" + (String)uniqueElementsList.get(f) + "\" , \"y\": null },");
+ }
+ }*/
+ //}
+
+ if(ds.getString(i, 2).equals(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))) {
+ dateStrList.add("'"+dateStr+"'");
+ try {
+ YAXISNUM = Integer.parseInt(ds.getString(i, 3));
+ if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM;
+ } catch (NumberFormatException ex) {
+ try {
+ YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, 3));
+ MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM);
+ if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM;
+ } catch (NumberFormatException ex1) {
+ flagNull = 1;
+ }
+
+ //flagNull = 1;
+ }
+
+ if(logScale) {
+ if(timeAxis) {
+ //((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + dateStr + " , \"y\":" + (flagNull == 0 ? (YAXISDOUBLENUM>0?new Double(Math.log10(YAXISDOUBLENUM)).toString():new Double(Math.log10(new Double(YAXISNUM>0?YAXISNUM:1).doubleValue())).toString()): null) +"}, ");
+ valueDataSeries = "{ \"x\":" + dateStr + " , \"y\":" + (flagNull == 0 ? (YAXISDOUBLENUM>0?new Double(Math.log10(YAXISDOUBLENUM)).toString():new Double(Math.log10(new Double(YAXISNUM>0?YAXISNUM:1).doubleValue())).toString()): null) +"}, ";
+ dataSeriesStrMap.put(dateStr, valueDataSeries);
+ } else {
+ // ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":\"" + dateStr + "\" , \"y\":" + (flagNull == 0 ? (YAXISDOUBLENUM>0?new Double(Math.log10(YAXISDOUBLENUM)).toString():new Double(Math.log10(new Double(YAXISNUM>0?YAXISNUM:1).doubleValue())).toString()): null) +"}, ");
+ valueDataSeries = "{ \"x\":\"" + dateStr + "\" , \"y\":" + (flagNull == 0 ? (YAXISDOUBLENUM>0?new Double(Math.log10(YAXISDOUBLENUM)).toString():new Double(Math.log10(new Double(YAXISNUM>0?YAXISNUM:1).doubleValue())).toString()): null) +"}, ";
+ dataSeriesStrMap.put(dateStr, valueDataSeries);
+ }
+ } else {
+ if(timeAxis) {
+ //((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + dateStr + " , \"y\":" + (flagNull == 0 ? (YAXISDOUBLENUM>0?YAXISDOUBLENUM:YAXISNUM): null) +"}, ");
+ valueDataSeries = "{ \"x\":" + dateStr + " , \"y\":" + (flagNull == 0 ? (YAXISDOUBLENUM>0?YAXISDOUBLENUM:YAXISNUM): null) +"}, ";
+ dataSeriesStrMap.put(dateStr, valueDataSeries);
+
+ } else {
+ //((StringBuffer) dataSeries.get(j)).append ("{ \"x\":\"" + dateStr + "\" , \"y\":" + (flagNull == 0 ? (YAXISDOUBLENUM>0?YAXISDOUBLENUM:YAXISNUM): null) +"}, ");
+ valueDataSeries = "{ \"x\":\"" + dateStr + "\" , \"y\":" + (flagNull == 0 ? (YAXISDOUBLENUM>0?YAXISDOUBLENUM:YAXISNUM): null) +"}, ";
+ dataSeriesStrMap.put(dateStr, valueDataSeries);
+
+ }
+ }
+
+ /*if(ds.getString(i, 2).equals(uniqueElements[j])) {
+ dateStrList.add("'"+dateStr+"'");
+ ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":\"" + dateStr + "\" , \"y\":\"" + ds.getString(i, 3) +"\"}, ");
+ */
+ }
+ dataSeriesOverAllMap.put(uniqueElements[j], dataSeriesStrMap);
+ } else {
+ //date = MMDDYYYYFormat.parse(ds.getString(i, 1), new ParsePosition(0));
+ if(!barRealTimeAxis) { // true - non-time
+ if(!dateStrList.contains(new Long(date.getTime()).toString())) {
+ dateStrList.add(new Long(date.getTime()).toString());
+ for (int k = 0; k < uniqueElements.length; k++) {
+ //((StringBuffer) dataSeries.get(k)).append ("{ \"x\":" + date.getTime() + " , \"y\":null}, ");
+ HashMap<String, String> dataMap = dataSeriesMap.get((String) uniqueElements[k]);
+ dataMap.put(date.getTime()+"", "null");
+
+ }
+ }
+ }
+ if(ds.getString(i, 2).equals(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))) {
+ dateStrList.add(new Long(date.getTime()).toString());
+ try {
+ YAXISNUM = Integer.parseInt(ds.getString(i, 3));
+ if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM;
+ } catch (NumberFormatException ex) {
+ try {
+ YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, 3));
+ MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM);
+ if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM;
+ } catch (NumberFormatException ex1) {
+ flagNull = 1;
+ }
+
+ //flagNull = 1;
+ }
+
+ //if(ds.getString(i, 2).equals(uniqueElements[j])) {
+ // dateStrList.add("'"+dateStr+"'");
+ HashMap<String, String> dataMap = dataSeriesMap.get((String) uniqueElements[j]);
+ if(logScale) {
+ dataMap.put(date.getTime()+"", (flagNull == 0 ? (YAXISDOUBLENUM>0?new Double(Math.log10(YAXISDOUBLENUM)).toString():new Double(Math.log10(new Double(YAXISNUM>0?YAXISNUM:1).doubleValue())).toString()): "null"));
+ } else {
+ if(dataMap.containsKey(new String(""+date.getTime())) && dataMap.get(new String(""+date.getTime())).equals("null")) {
+ dataMap.remove(date.getTime());
+ }
+ dataMap.put(date.getTime()+"", (flagNull == 0 ? (YAXISDOUBLENUM>0?new Double(YAXISDOUBLENUM).toString():new Integer(YAXISNUM).toString()): "null"));
+ //System.out
+ // .println(dataMap + " " + dataSeriesMap);
+ //}
+ }
+ // ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + (flagNull == 0 ? (YAXISDOUBLENUM>0?YAXISDOUBLENUM:YAXISNUM): null) +"}, ");
+
+
+ //((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + ds.getString(i, 3) +"}, ");
+ } else if (AppUtils.nvl(ds.getString(i, 2)).length()<=0) {
+ dateStrList.add(new Long(date.getTime()).toString());
+ HashMap<String, String> dataMap1 = null;
+ String uniqueElement1 = "";
+ for (int j1 = 0; j1 < uniqueElements.length; j1++) {
+ uniqueElement1 = (String)uniqueElements[j];
+ if(ds.getString(i, 2).equals(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement1.lastIndexOf("|") != -1) ?uniqueElement1.substring(0, uniqueElement1.lastIndexOf("|")):uniqueElement1))) {
+ dataMap1 = dataSeriesMap.get((String) uniqueElements[j1]);
+ if(!dataMap1.containsKey(new String(""+date.getTime())))
+ dataMap1.put(date.getTime()+"", "null");
+ }
+ }
+ }
+ }
+ // dataSeriesOverAllMap.put(uniqueElements[j], dataSeriesMap);
+ }
+
+ }
+ for(int kI = 0; kI < uniqueElements.length; kI++) {
+ HashMap dataSeriesStrMap1 = (HashMap) dataSeriesOverAllMap.get(uniqueElements[kI]);
+ for (int kL = 0; kL < uniqueXAxisElements.length; kL++) {
+ if(dataSeriesStrMap1.containsKey(uniqueXAxisElements[kL])) {
+ ((StringBuffer) dataSeries.get(kI)).append ((String)dataSeriesStrMap1.get(uniqueXAxisElements[kL]));
+ } else {
+ ((StringBuffer) dataSeries.get(kI)).append ("{ \"x\":\"" + uniqueXAxisElements[kL] + "\" , \"y\": null }, ");
+ }
+ }
+ }
+ }
+
+ StringBuffer dateStrBuf = new StringBuffer("");
+ /*if(count == 1) {
+ Long initialDate = Long.parseLong((String)ds.getString(0, 0));
+ Long endDate = Long.parseLong((String) ds.getString(ds.getRowCount(), 0));
+ java.util.Date date1 = null;
+
+ while ( initialDate <= endDate) {
+ //System.out.println("********** " + df.format(initialDate));
+ date1 = new java.util.Date(initialDate.longValue() * 1000);
+ initialDate = initialDate + HOUR;
+
+ dateStrBuf.append(initialDate+",");
+ sortSet.add(""+initialDate);
+ //DateUtils.addHours(date1, 1);
+ }
+ }*/
+
+ if(dateStrList.size()>0) {
+ SortedSet<String> s = Collections.synchronizedSortedSet(dateStrList);
+ Object[] dateElements = (Object[]) s.toArray();
+
+ String element = "";
+ /* if not date value */
+ if(!timeAxis) {
+ for (int i = 0; i < dateElements.length; i++) {
+ dateStrBuf.append(dateElements[i]+",");
+ }
+ } else {
+ if(!barRealTimeAxis || (flagNoDate == 1)) { // non-time
+ for (int i = 0; i < dateElements.length; i++) {
+ dateStrBuf.append(dateElements[i]+",");
+ }
+ } else {
+ Long initialDate = Long.parseLong((String)dateElements[0]);
+ Long endDate = Long.parseLong((String) dateElements[dateElements.length-1]);
+ java.util.Date date1 = null;
+ //first value
+ date1 = new java.util.Date(initialDate.longValue());
+ /* DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss Z");
+ System.out.println(formatter.format(new java.util.Date(initialDate.longValue())));
+ */ //initialDate = initialDate + HOUR;
+
+ dateStrBuf.append(initialDate+",");
+ sortSet.add(""+initialDate);
+
+ // DateUtils.
+
+ while ( initialDate <= endDate) {
+ //System.out.println("********** " + df.format(initialDate));
+ //date1 = new java.util.Date(initialDate.longValue() * 1000);
+ date1 = new java.util.Date(initialDate.longValue());
+ if(formatFlag==HOURFLAG)
+ date1 = DateUtils.addHours(date1, 1);
+ else if (formatFlag == DAYFLAG)
+ date1 = DateUtils.addDays(date1, 1);
+ else if (formatFlag == MONTHFLAG)
+ date1 = DateUtils.addMonths(date1, 1);
+ else if (formatFlag == YEARFLAG)
+ date1 = DateUtils.addMonths(date1, 1);
+ initialDate = date1.getTime();
+
+ if(initialDate <= endDate) {
+ dateStrBuf.append(initialDate+",");
+ sortSet.add(""+initialDate);
+ }
+ //DateUtils.addHours(date1, 1);
+ }
+ //DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
+ //df.setTimeZone(TimeZone.getTimeZone("UTC"));
+ //java.util.Date date1 = new java.util.Date(initialDate.longValue() * 1000);
+ //java.util.Date d = df.
+ //for ()
+ }
+ }
+ dateStrBuf.deleteCharAt(dateStrBuf.length()-1);
+ }
+
+ if(timeAxis) {
+ //if(!barRealTimeAxis) { // false - non-time
+ Object[] dateAllElements = (Object[]) sortSet.toArray();
+
+ for (int i = 0; i < uniqueElements.length; i++) {
+ HashMap<String, String> dataMap = dataSeriesMap.get((String)uniqueElements[i]);
+ for (int j=0; j<dateAllElements.length;j++) {
+ //if(strBuf.toString().indexOf((String) dateAllElements[j]) == -1) {
+ if(!dataMap.containsKey((String) dateAllElements[j])) {
+ dataMap.put((String) dateAllElements[j], "null");
+ //((StringBuffer) dataSeries.get(i)).append ("{ \"x\":" + dateAllElements[j] + " , \"y\":null}, ");
+ }
+ }
+ }
+ //}
+ }
+ String valueStr = "";
+ for (int i = 0; i < uniqueElements.length; i++) {
+ HashMap<String, String> dataMap = dataSeriesMap.get((String)uniqueElements[i]);
+ Set<String> keySet = dataMap.keySet();
+ ArrayList<String> keySortedList = new ArrayList<String>(new TreeSet<String>(keySet));
+
+ for (int k=0; k < keySortedList.size(); k++) {
+ valueStr = dataSeriesMap.get((String)uniqueElements[i]).get(keySortedList.get(k));
+ if(valueStr.equals("null"))
+ valueStr = null;
+ else {
+ //if(logScale)
+ //valueStr = new Double(Math.log10(new Double(valueStr).doubleValue())).toString();
+ }
+ ((StringBuffer) dataSeries.get(i)).append ("{ \"x\":" + keySortedList.get(k) + " , \"y\":" + valueStr +"}, ");
+ // ((StringBuffer) dataSeries.get(i)).append ("{ \"x\":" + keySortedList.get(k) + " , \"y\":" + valueStr +"}, ");
+ }
+
+ // ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + (flagNull == 0 ? (YAXISDOUBLENUM>0?YAXISDOUBLENUM:YAXISNUM): null) +"}, ");
+ }
+
+ for (int i = 0; i < uniqueElements.length; i++) {
+ StringBuffer strBuf = ((StringBuffer) dataSeries.get(i));
+ ((StringBuffer) dataSeries.get(i)).deleteCharAt(((StringBuffer) dataSeries.get(i)).lastIndexOf(","));
+ if(i < (uniqueElements.length -1) ) {
+ ((StringBuffer) dataSeries.get(i)).append("] } , \n");
+ }
+ else {
+ ((StringBuffer) dataSeries.get(i)).append("] } \n");
+ }
+ }
+ if(ds.getRowCount() > 0) {
+ for (int i = 0; i < uniqueElements.length; i++) {
+ wholeScript.append((StringBuffer)dataSeries.get(i));
+ }
+ }
+
+
+ wholeScript.append("]; \n");
+
+ //add global variable
+ wholeScript.append("var chart; \n");
+ //javascript to create Bar Chart
+ wholeScript.append("nv.addGraph(function() { \n");
+ if(horizontalBar /*&& flagNoDate == 1*/)
+ wholeScript.append(" chart = nv.models.multiBarHorizontalChart() \n");
+ else /*if (flagNoDate == 1)*/
+ wholeScript.append(" chart = nv.models.multiBarChart() \n");
+ /*else
+ wholeScript.append(" var chart = nv.models.multiBarTimeSeriesChart() \n");*/
+
+ wholeScript.append(" .margin({top: "+ topMargin +", right: "+ rightMargin +", bottom: "+ bottomMargin +", left: " + leftMargin +"}) \n");
+ if(showLegend) {
+ wholeScript.append(" .showLegend(true) \n ");
+ } else {
+ wholeScript.append(" .showLegend(false) \n ");
+ }
+ if(!horizontalBar && barReduceXAxisLabels)
+ wholeScript.append(" .reduceXTicks(true) \n ");
+ else if (!horizontalBar) {
+ wholeScript.append(" .reduceXTicks(false) \n ");
+ //wholeScript.append(" chart.lines1.forceY(["+(nvl(reportRuntime.getRangeAxisLowerLimit()).length()<=0?"0":reportRuntime.getRangeAxisLowerLimit()) +", "+ (nvl(reportRuntime.getRangeAxisUpperLimit()).length()<=0?UPPER_RANGE:reportRuntime.getRangeAxisUpperLimit()) + "]); \n" +
+ double UPPER_RANGE = 0;
+ if(Math.ceil((MAXDOUBLENUM+(MAXDOUBLENUM*25/100))/100) * 100 >= 1) {
+ UPPER_RANGE = Math.ceil(MAXDOUBLENUM+(MAXDOUBLENUM*25/100));
+ } else UPPER_RANGE = 1;
+ wholeScript.append(" .forceY(["+(nvl(reportRuntime.getRangeAxisLowerLimit()).length()<=0?"0":reportRuntime.getRangeAxisLowerLimit()) +", "+ (nvl(reportRuntime.getRangeAxisUpperLimit()).length()<=0?UPPER_RANGE:reportRuntime.getRangeAxisUpperLimit()) + "])\n");
+ }
+ if(!animation) {
+ wholeScript.append(" .delay(0) \n ");
+ }
+ if(showControls) {
+ wholeScript.append(" .showControls(true) \n ");
+ } else if (!showControls){
+ wholeScript.append(" .showControls(false) \n ");
+ }
+ if(stacked && !logScale)
+ wholeScript.append(" .stacked(true)\n ");
+ else if(!stacked || logScale)
+ wholeScript.append(" .stacked(false)\n ");
+ if(logScale) {
+ wholeScript.append(" .logScale(true)\n ");
+ } else {
+ wholeScript.append(" .logScale(false)\n ");
+ }
+
+ if(AppUtils.nvl(reportRuntime.getLegendPosition()).length()>=0 && reportRuntime.getLegendPosition().equals("right")) {
+ wholeScript.append(" .legendPos('right')\n" );
+ } else {
+ wholeScript.append(" .legendPos('top')\n" );
+ }
+ if(uniqueElements.length <= 10) {
+ wholeScript.append(" .color(d3.scale.category10().range()); \n" +
+ " chart.xAxis\n");
+ } else if (uniqueElements.length <= 20) {
+ wholeScript.append(" .color(d3.scale.category50().range()); \n" +
+ " chart.xAxis\n");
+ } else {
+ wholeScript.append(" .color(d3.scale.category50().range()); \n" +
+ " chart.xAxis\n");
+
+ }
+
+ if(flagNoDate == 0)
+ wholeScript.append(" .tickValues(["+ dateStrBuf.toString() + "])\n ");
+ else {
+ wholeScript.append(" .tickValues(["+ dateStrBuf.toString() + "])\n ");
+ }
+ if(staggerLabels) {
+ wholeScript.append(" .staggerLabels(true) \n");
+ } else {
+ wholeScript.append(" .staggerLabels(false) \n");
+ }
+ if(!horizontalBar) {
+ if(showMaxMin) {
+ wholeScript.append(" .showMaxMin(true) \n ");
+ } else {
+ wholeScript.append(" .showMaxMin(false) \n ");
+ }
+ }
+ if(nvl(rotateLabels).length()>0) {
+ wholeScript.append(" .rotateLabels("+ rotateLabels+ ") \n ");
+ } else {
+ wholeScript.append(" .rotateLabels(\"0\") \n ");
+ }
+ //wholeScript.append(" .axisLabel('" + legendColumnName + "')");
+ if(flagNoDate == 1 || !timeAxis) {
+ wholeScript.append(";\n");
+ } else {
+ wholeScript.append("\n .tickFormat(function(d) { \n");
+ if(timeAxis) {
+ if(formatFlag==HOURFLAG)
+ wholeScript.append(" return d3.time.format('%x %H')(new Date(d)) }); \n");
+ else if(formatFlag==MINFLAG)
+ wholeScript.append(" return d3.time.format('%x %H:%M')(new Date(d)) }); \n");
+ else if(formatFlag==SECFLAG)
+ wholeScript.append(" return d3.time.format('%X')(new Date(d)) }); \n");
+ else if(formatFlag==MONTHFLAG)
+ wholeScript.append(" return d3.time.format('%b %y')(new Date(d)) }); \n");
+ else
+ wholeScript.append(" return d3.time.format('%x')(new Date(d)) }); \n");
+
+ } else {
+ wholeScript.append(" return d; }); \n");
+ }
+ }
+
+ if(nvl(chartRightAxisLabel).length() > 0) {
+ //if(flagNoDate == 1)
+ wholeScript.append(" chart.yAxis\n");
+ //else
+ // wholeScript.append(" chart.yAxis1\n");
+ if(logScale) {
+ wholeScript.append(" .logScale(true)\n ");
+ } else {
+ wholeScript.append(" .logScale(false)\n ");
+ }
+
+ wholeScript.append(" .axisLabel('" + chartLeftAxisLabel + "') \n" +
+ " .tickFormat(d3.format(',.0f')); \n");
+ /*" chart.yAxis2\n " +
+ " .axisLabel('" + chartRightAxisLabel + "') \n" +
+ " .tickFormat(d3.format(',.0f')); \n");*/
+
+
+ } else {
+ //if(flagNoDate == 1)
+ wholeScript.append(" chart.yAxis\n");
+ //else
+ // wholeScript.append(" chart.yAxis1\n");
+ if(logScale) {
+ wholeScript.append(" .logScale(true)\n ");
+ } else {
+ wholeScript.append(" .logScale(false)\n ");
+ }
+ wholeScript.append(" .axisLabel('" + chartLeftAxisLabel + "') \n");
+
+ if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) MAXNUMDECIMALPLACES = 2;
+ if( MAXNUMDECIMALPLACES >=3 ) MAXNUMDECIMALPLACES = 2;
+ if(!logScale)
+ wholeScript.append(" .tickFormat(d3.format(',."+MAXNUMDECIMALPLACES+"f')); \n");
+ else
+ wholeScript.append(" .tickFormat(d3.format(',." + precision + "f')); \n");
+ //" .tickFormat(d3.format(',.0f')); \n");
+ }
+ wholeScript.append(" d3.select('#chart"+reportRuntime.getReportID()+" svg') \n" +
+ " .datum(historicalBarChart) \n" );
+ if(animation)
+ wholeScript.append(" .transition().duration(1000) \n" );
+ else
+ wholeScript.append(" .transition().duration(0) \n" );
+ wholeScript.append(" .call(chart); \n" +
+ "nv.utils.windowResize(chart.update); \n" +
+ "return chart; \n" +
+ "}); \n");
+ wholeScript.append("function redraw() { \n");
+ //wholeScript.append(" nv.utils.windowResize(chart.update); \n");
+ wholeScript.append(" d3.select('#chart"+reportRuntime.getReportID()+" svg') \n") ;
+ wholeScript.append(" .datum(historicalBarChart) \n");
+ wholeScript.append(" .transition().duration(500) \n");
+ wholeScript.append(" .call(chart); \n");
+ wholeScript.append("} \n");
+ wholeScript.append("\n");
+ wholeScript.append(" setInterval(function () { \n");
+ wholeScript.append(" redraw(); \n");
+ wholeScript.append(" }, 1500) \n");
+
+ wholeScript.append("if(historicalBarChart.length <= 0 ) {\n");
+ wholeScript.append(" document.getElementById(\"chart"+reportRuntime.getReportID()+"\").innerHTML = \"<div id='noData'><b>No Data Available</b></div>\";\n");
+ wholeScript.append(" document.getElementById(\"chart"+reportRuntime.getReportID()+"\").className=\"nodatadiv\";\n");
+ wholeScript.append(" document.getElementById(\"nodata\").className=\"nodatainner\";\n");
+ wholeScript.append("}\n");
+ wholeScript.append("</script> </body></html> \n");
+
+ } else if (chartType.equals(AppConstants.GT_TIME_SERIES)) {
+
+ // get category if not give the column name for the data column use this to develop series.
+ boolean hasCategoryAxis = reportRuntime.hasSeriesColumn();
+
+
+ final int YEARFLAG = 1;
+ final int MONTHFLAG = 2;
+ final int DAYFLAG = 3;
+ final int HOURFLAG = 4;
+ final int MINFLAG = 5;
+ final int SECFLAG = 6;
+ final int MILLISECFLAG = 7;
+ final int DAYOFTHEWEEKFLAG = 8;
+ final int FLAGDATE = 9;
+
+ int flag = 0;
+ flag = hasCategoryAxis?1:0;
+ String uniqueElements [] = null;
+ //TreeSet ts = new TreeSet();
+ ArrayList ts = new ArrayList<String>();
+ HashMap<String, String> columnMap = new HashMap();
+ //check timeAxis
+ String dateStr = null;
+ java.util.Date date = null;
+ if( ds.getRowCount() > 0) {
+ dateStr = ds.getString(0, 1);
+ if(!timeAxis) {
+ date = getDateFromDateStr(dateStr);
+ if(date!=null) {
+ reportRuntime.setTimeAxis(true);
+ timeAxis = reportRuntime.isTimeAxis();
+
+
+ }
+ }
+ }
+
+ ArrayList<String> ts1 = new ArrayList();
+ ArrayList uniqueElementsList = new ArrayList();
+ Object uniqueXAxisElements[] = null;
+ String uniqueXAxisStr = "";
+ if(!timeAxis){
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ uniqueXAxisStr = ds.getString(i, 0);
+ ts1.add(uniqueXAxisStr);
+ }
+ }
+ uniqueElementsList.addAll(ts1);
+ uniqueXAxisElements = ts1.toArray();
+ //test start
+ /* int TOTAL = 0;
+ int VALUE = 0;
+ int flagNull = 0;
+ String KEY = "";
+ String COLOR = "";
+ TreeSet<String> colorList = new TreeSet<String>();
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ VALUE = 0;
+ try {
+ VALUE = Integer.parseInt(ds.getString(i, 2));
+ TOTAL = TOTAL+VALUE;
+ } catch (NumberFormatException ex) {
+ flagNull = 1;
+ }
+ KEY = ds.getString(i, 0);
+ try {
+ if(ds.getString(i, "chart_color")!=null) {
+ colorList.add(KEY+"|"+ds.getString(i, "chart_color"));
+ }
+ } catch (ArrayIndexOutOfBoundsException ex) {
+ System.out.println("No Chart Color");
+ }
+ wholeScript.append("{ \""+ "key" +"\":\""+ KEY+"\", \""+ "y" +"\":"+VALUE+"}, \n");
+
+ }
+ StringBuffer color = new StringBuffer("");
+ if(colorList.size()>0) {
+ SortedSet<String> s = Collections.synchronizedSortedSet(colorList);
+ Object[] colorElements = (Object[]) s.toArray();
+
+ String element = "";
+
+ for (int i = 0; i < colorElements.length; i++) {
+ element = ((String)colorElements[i]);
+ color.append("'"+element.substring(element.indexOf("|")+1)+"',");
+ }
+ color.deleteCharAt(color.length()-1);
+ }*/
+
+ //test end
+ boolean hasCustomizedChartColor = false;
+ if(flag == 1) {
+ StringBuffer catStr = new StringBuffer("");
+ String color="";
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ catStr = new StringBuffer("");
+ catStr.append(ds.getString(i, 2));
+ try {
+ if(ds.getString(i, "chart_color")!=null) {
+ color = ds.getString(i, "chart_color");
+ hasCustomizedChartColor = true;
+ catStr.append("|"+color);
+ }
+ } catch (ArrayIndexOutOfBoundsException ex) {
+ //System.out.println("No Chart Color");
+ }
+
+ if(catStr.length()>0) {
+ //duplicates are avoided
+ if(!ts.contains(catStr.toString()))
+ ts.add(catStr.toString());
+
+ }
+ }
+ //Object uniqueElements [] = ts.toArray();
+ //SortedSet s = Collections.synchronizedSortedSet(ts);
+ //uniqueElements = (String[]) ts.toArray();
+ DataColumnType dct = null;
+ List yTextSeries = reportRuntime.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues);
+ if(yTextSeries.size()==1) {
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ dct = (DataColumnType) iter.next();
+ //System.out.println(dct.getDisplayName() + " " + yText);
+ if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
+ if(nvl(chartLeftAxisLabel).length()<=0) {
+ chartLeftAxisLabel = nvl(dct.getYAxis());
+ chartLeftAxisLabel = (chartLeftAxisLabel.indexOf("|")!=-1)?chartLeftAxisLabel.substring(0,chartLeftAxisLabel.indexOf("|")):"";
+ }
+ }
+ }
+ }
+ Object tempArray[] = ts.toArray();
+ uniqueElements = Arrays.copyOf(tempArray, tempArray.length, String[].class);
+
+ } else {
+ DataColumnType dct = null;
+
+ List yTextSeries = reportRuntime.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues);
+ //if(columnValuesList.size() == 1) {
+ int dctIndex = 0;
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ dct = (DataColumnType) iter.next();
+ //System.out.println(dct.getDisplayName() + " " + yText);
+ if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
+ if(yTextSeries.contains((String)dct.getDisplayName())) {
+ if(nvl(dct.getChartColor()).length()>0) hasCustomizedChartColor = true;
+ if(hasCustomizedChartColor) {
+ //duplicates are avoided
+ if(!ts.contains(dct.getDisplayName()+"|"+nvl(dct.getChartColor())))
+ ts.add(dct.getDisplayName()+"|"+nvl(dct.getChartColor()));
+ } else {
+ //duplicates are avoided
+ if(!ts.contains(dct.getDisplayName()))
+ ts.add(dct.getDisplayName());
+ }
+ if(nvl(chartLeftAxisLabel).length()<=0) {
+ chartLeftAxisLabel = nvl(dct.getYAxis());
+ chartLeftAxisLabel = (chartLeftAxisLabel.indexOf("|")!=-1)?chartLeftAxisLabel.substring(0,chartLeftAxisLabel.indexOf("|")):"";
+ }
+ if(nvl(chartRightAxisLabel).length()>0) {
+ String dctYAxis = nvl(dct.getYAxis());
+ String yAxis = (dctYAxis.indexOf("|")!=-1)?dctYAxis.substring(0,dctYAxis.indexOf("|")):dctYAxis;
+ if(chartRightAxisLabel.equals(yAxis)) {
+ if(ts.contains(dct.getDisplayName())) {
+ if(hasCustomizedChartColor) {
+ ts.set(dctIndex, dct.getDisplayName()+"|R|"+nvl(dct.getChartColor()));
+ } else {
+ ts.set(dctIndex, dct.getDisplayName()+"|R");
+ }
+ }
+ }
+ }
+ columnMap.put(dct.getDisplayName(), dct.getColId());
+ }
+ dctIndex++;
+ }
+
+ }
+
+ //SortedSet s = Collections.synchronizedSortedSet(ts);
+ Object tempArray[] = ts.toArray();
+ uniqueElements = Arrays.copyOf(tempArray, tempArray.length, String[].class);
+ //uniqueElements = (String[]) ts.toArray();
+
+ }
+
+ wholeScript.append("<!DOCTYPE html>\n");
+ wholeScript.append("<html>\n");
+ wholeScript.append("<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF8\">\n");
+ wholeScript.append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n");
+ wholeScript.append("<link href=\""+ AppUtils.getBaseFolderURL() +"d3/css/nv.d3.css\" rel=\"stylesheet\" type=\"text/css\">\n");
+ wholeScript.append("<style>\n " +
+ " body { \n" +
+ " overflow-y:scroll; \n" +
+ " } \n" +
+ " text { \n" +
+ " font: 12px sans-serif; \n" +
+ " } \n" +
+ " svg { \n" +
+ " display: block;\n" +
+ " } \n" +
+ " #chart"+reportRuntime.getReportID()+" svg { \n" +
+ " height: "+ (nvl(height).length()>0?(height.endsWith("px")?height:height+"px"):"420px") + "; \n" +
+ " width: "+ (nvl(width).length()>0?(width.endsWith("px")?width:width+"px"):"700px") + "; \n" +
+ " min-width: 100px; \n" +
+ " min-height: 100px; \n" +
+ " } \n" +
+ " tr.z-row-over > td.z-row-inner, tr.z-row-over > .z-cell {" +
+ " background-color: rgb(255, 255, 255); "+
+ "}\n");
+ wholeScript.append(".nodatadiv {\n");
+ wholeScript.append(" display: table-cell;\n");
+ wholeScript.append(" width: 700px;\n");
+ wholeScript.append(" height:370px;\n");
+ wholeScript.append(" text-align:center;\n");
+ wholeScript.append(" vertical-align: middle;\n");
+ wholeScript.append("}\n");
+ wholeScript.append(".nodatainner {\n");
+ wholeScript.append(" padding: 10px;\n");
+ wholeScript.append("}\n");
+
+ wholeScript.append(" </style> \n" );
+
+ wholeScript.append("<body> \n");
+
+ if(showTitle)
+ wholeScript.append("<div align=\"center\"><H3>" + title +"</H3></div>");
+
+
+ wholeScript.append("<div id=\"chart"+reportRuntime.getReportID()+"\"> <svg></svg> </div> \n");
+ //js files
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/d3.v3.min.js\"></script>\n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/nv.d3.min.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/axis.min.js\"></script> \n");
+ //wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/cumulativeLineChart.js\"></script> \n");
+ //if(multipleSeries)
+ //wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/multiChart.js\"></script> \n");
+
+ //json
+ wholeScript.append("<script> \n");
+
+ wholeScript.append("historicalBarChart = [ \n");
+ //wholeScript.append("{ \n");
+ ArrayList dataSeries = new ArrayList();
+ String uniqueElement = "";
+
+ String [] uniqueRevElements = null;
+ //Added to make sure order appears same as legend
+ /*if(nvl(subType).length() > 0 && subType.equals("area")) {
+ uniqueRevElements = reverse((String[])uniqueElements);
+ } else {*/
+ uniqueRevElements = (String[])uniqueElements;
+ //}
+
+ int RIGHTAXISSERIES = 0;
+ for (int i = 0; i < uniqueRevElements.length; i++) {
+ //element.substring(element.indexOf("|")+1)
+ uniqueElement = (String)uniqueRevElements[i];
+ if(multipleSeries && (nvl(chartRightAxisLabel).length() > 0)) {
+ if(nvl(subType).length() > 0 && subType.equals("area")) {
+ if(nvl(uniqueElement).indexOf("|R") !=-1)
+ dataSeries.add(new StringBuffer(" { \"type\":\"line\", \"key\": \""+ ((uniqueElement.indexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement) +"\", \"yAxis\": \""+(2)+"\", "+ (hasCustomizedChartColor && (uniqueElement.lastIndexOf("|") != -1) ?("\"color\": \""+uniqueElement.substring(uniqueElement.lastIndexOf("|")+1) + "\","):"")+" \"values\": ["));
+ else
+ dataSeries.add(new StringBuffer(" { \"type\":\"line\", \"key\": \""+ ((uniqueElement.indexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement) +"\", \"yAxis\": \""+(1)+"\", "+ (hasCustomizedChartColor && (uniqueElement.lastIndexOf("|") != -1) ?("\"color\": \""+uniqueElement.substring(uniqueElement.lastIndexOf("|")+1) + "\","):"")+" \"values\": ["));
+ } else {
+ if(nvl(uniqueElement).indexOf("|R") !=-1)
+ dataSeries.add(new StringBuffer(" { \"type\":\"line\", \"key\": \""+ ((uniqueElement.indexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement) +"\", \"yAxis\": \""+(2)+"\","+ (hasCustomizedChartColor && (uniqueElement.lastIndexOf("|") != -1) ?("\"color\": \""+uniqueElement.substring(uniqueElement.lastIndexOf("|")+1) + "\","):"")+" \"values\": ["));
+ else
+ dataSeries.add(new StringBuffer(" { \"type\":\"line\", \"key\": \""+ ((uniqueElement.indexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement) +"\", \"yAxis\": \""+(1)+"\","+ (hasCustomizedChartColor && (uniqueElement.lastIndexOf("|") != -1) ?("\"color\": \""+uniqueElement.substring(uniqueElement.lastIndexOf("|")+1) + "\","):"")+" \"values\": ["));
+ }
+ RIGHTAXISSERIES = dataSeries.size()-1;
+ //dataSeries.add(new StringBuffer(" { \"type\":\"line\", \"key\": \""+ ((DataColumnType)columnMap.get(i)).getDisplayName() +"\", \"yAxis\": \""+(i+1)+"\", \"values\": ["));
+ }
+ else {
+ dataSeries.add(new StringBuffer(" { \"type\":\"line\", \"key\": \""+ ((uniqueElement.indexOf("|")!= -1)?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement) +"\", \"yAxis\": \""+(1)+"\","+ (hasCustomizedChartColor && (uniqueElement.lastIndexOf("|") != -1)?("\"color\": \""+uniqueElement.substring(uniqueElement.lastIndexOf("|")+1) + "\","):"")+"\"values\": ["));
+ }
+
+ }
+ /*StringBuffer dataSeries1 = new StringBuffer("");
+ dataSeries1.append(" { key: \"Series1\",values: [");
+ StringBuffer dataSeries2 = new StringBuffer("");
+ dataSeries2.append(" { key: \"Series2\", values: [");
+ StringBuffer dataSeries3 = new StringBuffer("");
+ dataSeries3.append(" { key: \"Series3\", values: [");
+ */
+
+
+ //long minTime = 1000000000000000L;
+ int MAXNUM = 0;
+ double MAXDOUBLENUM = 0.0;
+ int YAXISNUM = 0;
+ double YAXISDOUBLENUM = 0.0;
+ int MAXNUMDECIMALPLACES = 0;
+ int flagNull = 0;
+ int flagSecondNull = 0;
+ TreeSet dateList = new TreeSet();
+ int formatFlag = 0;
+ if(flag!= 1) {
+ for (int j = 0; j < uniqueRevElements.length; j++) {
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ flagNull = 0;
+ flagSecondNull=0;
+ YAXISNUM = 0;
+ YAXISDOUBLENUM = 0.0;
+ dateStr = "";
+ date = null;
+ dateStr = ds.getString(i, 1);
+ if(timeAxis) {
+ date = getDateFromDateStr(dateStr);
+ formatFlag = getFlagFromDateStr(dateStr);
+ }
+ if(date==null && timeAxis) continue;
+
+
+ //if(ds.getString(i, 2).equals(uniqueElements[j])) {
+ //if(minTime > date.getTime())
+ // minTime = date.getTime();
+ uniqueElement = (String)uniqueRevElements[j];
+ try {
+ YAXISNUM = Integer.parseInt(ds.getString(i, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))));
+ if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM;
+ } catch (NumberFormatException ex) {
+ try {
+ YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))));
+ if(RIGHTAXISSERIES!=j) {
+ MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM);
+ if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM;
+ }
+ } catch (NumberFormatException ex1) {
+ flagNull = 1;
+ }
+ }
+
+ if(date==null) {
+ dateList.add(dateStr);
+ ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":\"" + dateStr + "\" , \"y\":" + (flagNull==0?(YAXISDOUBLENUM>0?YAXISDOUBLENUM:YAXISNUM):null) +"}, ");
+ } else {
+ dateList.add(new Long(date.getTime()).toString());
+ ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + (flagNull==0?(YAXISDOUBLENUM>0?YAXISDOUBLENUM:YAXISNUM):null) +"}, ");
+ }
+
+
+
+ if(nvl(subType).length() > 0 && subType.equals("area")) {
+
+ if(flagNull!=1) {
+ if(i<ds.getRowCount()-1) {
+ try {
+ YAXISNUM = Integer.parseInt(ds.getString(i+1, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))));
+ if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM;
+ } catch (NumberFormatException ex) {
+ try {
+ YAXISDOUBLENUM = Double.parseDouble(ds.getString(i+1, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))));
+ if(RIGHTAXISSERIES!=j) {
+ MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM);
+ if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM;
+ }
+ } catch (NumberFormatException ex1) {
+ flagSecondNull = 1;
+ }
+ }
+
+ if(flagSecondNull==1 && date == null) {
+ ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":\"" + dateStr + "\" , \"y\":" + null +"}, ");
+ } else if( flagSecondNull == 1){
+ ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + null +"}, ");
+ }
+ }
+ } else {
+ if(i<ds.getRowCount()-1) {
+ dateStr = ds.getString(i+1, 1);
+
+ if(!timeAxis) {
+ ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":\"" + dateStr + "\" , \"y\":" + null +"}, ");
+ } else {
+ date = getDateFromDateStr(dateStr);
+ ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + null +"}, ");
+ }
+ //((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + null +"}, ");
+ }
+ }
+
+ }
+
+
+ //}
+ }
+ //((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + minTime + " , \"y\":" + 0 +"}, ");
+ }
+
+ } else {
+ for (int j = 0; j < uniqueRevElements.length; j++) {
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ YAXISNUM = 0;
+ YAXISDOUBLENUM = 0.0;
+ flagNull= 0;
+ flagSecondNull = 0;
+ dateStr = ds.getString(i, 1);
+ if(timeAxis) {
+ date = getDateFromDateStr(dateStr);
+ formatFlag = getFlagFromDateStr(dateStr);
+ }
+
+ if(date==null && timeAxis) continue;
+
+ uniqueElement = (String)uniqueRevElements[j];
+ //date = MMDDYYYYFormat.parse(ds.getString(i, 1), new ParsePosition(0));
+ if(ds.getString(i, 2).equals(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))) {
+ //if(minTime > date.getTime())
+ // minTime = date.getTime();
+ try {
+ YAXISNUM = Integer.parseInt(ds.getString(i, 3));
+ if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM;
+ } catch (NumberFormatException ex) {
+ try {
+ YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, 3));
+ if(RIGHTAXISSERIES!=j) {
+ MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM);
+ if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM;
+
+ }
+ } catch (NumberFormatException ex1) {
+ flagNull = 1;
+ }
+ }
+
+ if(date==null) {
+ dateList.add(dateStr);
+ ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + dateStr + " , \"y\":" + (flagNull==0?(YAXISDOUBLENUM!=0.0?YAXISDOUBLENUM:YAXISNUM):null) +"}, ");
+ } else {
+ dateList.add(new Long(date.getTime()).toString());
+ ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + (flagNull==0?(YAXISDOUBLENUM!=0.0?YAXISDOUBLENUM:YAXISNUM):null) +"}, ");
+ }
+
+
+ if(nvl(subType).length() > 0 && subType.equals("area")) {
+
+ if(flagNull!=1) {
+ if(i<ds.getRowCount()-1) {
+ for (int k = i+1; k < ds.getRowCount(); k++) {
+ if (ds.getString(k, 2).equals(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))) {
+ try {
+ YAXISNUM = Integer.parseInt(ds.getString(k, 3));
+ if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM;
+ } catch (NumberFormatException ex) {
+ try {
+ YAXISDOUBLENUM = Double.parseDouble(ds.getString(k, 3));
+ if(RIGHTAXISSERIES!=j) {
+ MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM);
+ if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM;
+ }
+ } catch (NumberFormatException ex1) {
+ flagSecondNull = 1;
+ }
+ }
+ break;
+ }
+ }
+
+ if(date==null && flagSecondNull==1){
+ ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + dateStr + " , \"y\":" + null +"}, ");
+ } else if(flagSecondNull == 1){
+ ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + null +"}, ");
+ }
+ //}
+ }
+ } else {
+ if(i<ds.getRowCount()-1) {
+ for (int k = i+1; k < ds.getRowCount(); k++) {
+ if (ds.getString(k, 2).equals(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))) {
+ dateStr = ds.getString(k, 1);
+ if(!timeAxis) {
+ ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + null +"}, ");
+ break;
+ } else {
+ date = getDateFromDateStr(dateStr);
+ ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + date.getTime() + " , \"y\":" + null +"}, ");
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+ }
+ // ((StringBuffer) dataSeries.get(j)).append ("{ \"x\":" + minTime + " , \"y\":" + 0 +"}, ");
+
+ }
+/* if(ds.getString(i, 2).equals("Series1")) {
+ dataSeries1.append("[ " + date.getTime() + " , " + ds.getString(i, 3) +"], ");
+ } else if (ds.getString(i, 2).equals("Series2")) {
+ dataSeries2.append("[ " + date.getTime() + " , " + ds.getString(i, 3) +"], ");
+ } else if (ds.getString(i, 2).equals("Series3")) {
+ dataSeries3.append("[ " + date.getTime() + " , " + ds.getString(i, 3) +"], ");
+ }
+*/ }
+
+ for (int i = 0; i < uniqueRevElements.length; i++) {
+ StringBuffer strBuf = ((StringBuffer) dataSeries.get(i));
+ ((StringBuffer) dataSeries.get(i)).deleteCharAt(((StringBuffer) dataSeries.get(i)).lastIndexOf(","));
+ if(i < (uniqueRevElements.length -1) ) {
+ ((StringBuffer) dataSeries.get(i)).append("] } , \n");
+ }
+ else {
+ ((StringBuffer) dataSeries.get(i)).append("] } \n");
+ }
+ }
+
+ for (int i = 0; i < uniqueRevElements.length; i++) {
+ wholeScript.append((StringBuffer)dataSeries.get(i));
+ }
+/* wholeScript.append(dataSeries1);
+ wholeScript.append(dataSeries2);
+ wholeScript.append(dataSeries3);
+*/ wholeScript.append("];\n");
+
+ /* Sorting is commented out.*/
+ StringBuffer dateStrBuf = new StringBuffer("");
+ if(dateList.size()>0) {
+ //SortedSet<String> s = Collections.synchronizedSortedSet(dateList);
+ Object[] dateElements = (Object[]) dateList.toArray();
+
+ String element = "";
+
+ for (int i = 0; i < dateElements.length; i++) {
+ dateStrBuf.append(dateElements[i]+",");
+ }
+ dateStrBuf.deleteCharAt(dateStrBuf.length()-1);
+ }
+
+ wholeScript.append(" var chart;\n");
+ wholeScript.append("nv.addGraph(function() { \n");
+ //" var chart = nv.models.cumulativeLineChart() \n" + nv.models.lineWithFocusChart()
+// " chart = nv.models.lineChart() \n" +
+ if(nvl(subType).length() > 0 && subType.equals("area")) {
+ wholeScript.append(" chart = nv.models.stackedAreaChart() \n");
+ if(showControls) {
+ wholeScript.append(" .showControls(true) \n ");
+ } else {
+ wholeScript.append(" .showControls(false) \n ");
+ }
+ } else {
+ wholeScript.append(" chart = nv.models.multiChart() \n");
+ if(nvl(chartRightAxisLabel).length() > 0) {
+ wholeScript.append(" .dualaxis(true) \n ");
+ } else {
+ wholeScript.append(" .dualaxis(false) \n ");
+ }
+
+ if(AppUtils.nvl(reportRuntime.getLegendPosition()).length()>=0 && reportRuntime.getLegendPosition().equals("right")) {
+ wholeScript.append(" .legendPos('right')\n" );
+ } else {
+ wholeScript.append(" .legendPos('top')\n" );
+ }
+
+
+ }
+
+ wholeScript.append(" .margin({top: "+ topMargin +", right: "+ rightMargin +", bottom: "+ bottomMargin +", left: " + leftMargin +"}) \n");
+ if(showLegend) {
+ wholeScript.append(" .showLegend(true) \n ");
+ } else {
+ wholeScript.append(" .showLegend(false) \n ");
+ }
+
+ if(nvl(subType).length() > 0 && subType.equals("area")) {
+ if( MAXNUMDECIMALPLACES >=3 ) {
+ wholeScript.append(" .yAxisTooltipFormat(d3.format(',.3f')) \n");
+ } else {
+ wholeScript.append(" .yAxisTooltipFormat(d3.format(',."+MAXNUMDECIMALPLACES+ "f')) \n");
+ }
+
+ wholeScript.append(".x (function(d) {return d.x;}) \n" +
+ ".y (function(d) {return d.y;}) \n");
+ }
+
+ //" .x(function(d) { return d[0] }) \n" +
+ //" .y(function(d) { return d[1] }) \n" +
+ //" .forceY("+(nvl(reportRuntime.getRangeAxisLowerLimit()).length()<=0?"0":reportRuntime.getRangeAxisLowerLimit()) +", "+ Math.ceil((MAXNUM+(MAXNUM*25/100))/100) * 100 + ") \n" + // reportRuntime.getRangeAxisUpperLimit()+") \n" +
+ wholeScript.append(" .color(d3.scale.category10().range()); \n");
+ if(!(nvl(subType).length() > 0 && subType.equals("area"))) {
+ double UPPER_RANGE = 0;
+ if(Math.ceil((MAXDOUBLENUM+(MAXDOUBLENUM*25/100))/100) * 100 >= 1) {
+ UPPER_RANGE = Math.ceil(MAXDOUBLENUM+(MAXDOUBLENUM*25/100));
+ } else UPPER_RANGE = 1;
+
+ wholeScript.append(" chart.lines1.forceY(["+(nvl(reportRuntime.getRangeAxisLowerLimit()).length()<=0?"0":reportRuntime.getRangeAxisLowerLimit()) +", "+ (nvl(reportRuntime.getRangeAxisUpperLimit()).length()<=0?UPPER_RANGE:reportRuntime.getRangeAxisUpperLimit()) + "]); \n" +
+ " chart.lines2.forceY([0,1]); \n");
+ }
+ wholeScript.append(" chart.xAxis\n");
+ if(reportRuntime.isShowXaxisLabel()) {
+ // X axis label is commented for time-being. This should be derived from request parameter.
+ //" .axisLabel('" + legendColumnName + "') \n" +
+ wholeScript.append(" .axisLabel('" + legendColumnName + "') \n");
+ } else {
+ wholeScript.append(" .axisLabel('') \n");
+ }
+ if(reportRuntime.isAddXAxisTickers()) {
+ wholeScript.append(" .tickValues(["+ dateStrBuf.toString()+ "])\n ");
+ } else {
+ //wholeScript.append(" .tickValues([])\n ");
+ }
+ if(staggerLabels) {
+ wholeScript.append(" .staggerLabels(true) \n");
+ } else {
+ wholeScript.append(" .staggerLabels(false) \n");
+ }
+ if(showMaxMin) {
+ wholeScript.append(" .showMaxMin(true) \n ");
+ } else {
+ wholeScript.append(" .showMaxMin(false) \n ");
+ }
+
+ if(nvl(rotateLabels).length()>0) {
+ wholeScript.append(" .rotateLabels("+ rotateLabels+ ") \n ");
+ } else {
+ wholeScript.append(" .rotateLabels(\"0\") \n ");
+ }
+
+ wholeScript.append(" .tickFormat(function(d) { \n");
+ if(formatFlag==HOURFLAG)
+ wholeScript.append(" return d3.time.format('%x %H')(new Date(d)) }); \n");
+ else if(formatFlag==MINFLAG)
+ wholeScript.append(" return d3.time.format('%x %H:%M')(new Date(d)) }); \n");
+ else if(formatFlag==SECFLAG)
+ wholeScript.append(" return d3.time.format('%x %X')(new Date(d)) }); \n");
+ else if(formatFlag==MONTHFLAG)
+ wholeScript.append(" return d3.time.format('%b %y')(new Date(d)) }); \n");
+
+ else if(timeAxis)
+ wholeScript.append(" return d3.time.format('%x')(new Date(d)) }); \n");
+ else
+ wholeScript.append(" return d; }); \n");
+ if(nvl(chartRightAxisLabel).length() > 0) {
+ if(nvl(subType).length() > 0 && subType.equals("area")) {
+ wholeScript.append(" chart.yAxis\n");
+ } else {
+ wholeScript.append(" chart.yAxis1\n");
+ }
+ wholeScript.append(" .axisLabel('" + chartLeftAxisLabel + "') \n");
+ //if(nvl(subType).length() > 0 && subType.equals("area")) {
+ if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) MAXNUMDECIMALPLACES = 2;
+ if( MAXNUMDECIMALPLACES >=3 ) MAXNUMDECIMALPLACES = 2;
+ wholeScript.append(" .tickFormat(d3.format(',."+MAXNUMDECIMALPLACES+"f')); \n");
+ /*} else {
+ wholeScript.append(" .tickFormat(d3.format(',.2f')); \n");
+ }*/
+ // " .tickFormat(function (d) {return d;} ); \n");
+ //" .tickFormat(function(d) {if (d >= 1000) return Math.round(d/1000)+\"K\"; else return d;}); \n");
+ if(!(nvl(subType).length() > 0 && subType.equals("area"))) {
+ wholeScript.append(" chart.yAxis2\n " +
+ " .axisLabel('" + chartRightAxisLabel + "') \n" +
+ " .tickFormat(d3.format(',.02f')); \n");
+ //" .tickFormat(function(d) {if (d >= 1000) return Math.round(d/1000)+\"K\"; else return d;}); \n");
+ //" .tickFormat(function(d) {if( d <= 1) return Math.round(d*100)+\"%\"; else return d;}); \n");
+ // " .tickFormat(function(d) { return d;}); \n");
+ }
+
+
+ } else {
+ if(nvl(subType).length() > 0 && subType.equals("area")) {
+ wholeScript.append(" chart.yAxis\n");
+ } else {
+ wholeScript.append(" chart.yAxis1\n");
+ }
+ wholeScript.append(" .axisLabel('" + chartLeftAxisLabel + "') \n");
+ //if(nvl(subType).length() > 0 && subType.equals("area")) {
+ if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) MAXNUMDECIMALPLACES = 2;
+ if( MAXNUMDECIMALPLACES >=3 ) {
+ MAXNUMDECIMALPLACES = 2;
+ }
+ wholeScript.append(" .tickFormat(d3.format(',."+MAXNUMDECIMALPLACES+"f')); \n");
+ /*} else {
+ wholeScript.append(" .tickFormat(d3.format(',.2f')); \n");
+ }*/
+ //" .tickFormat(function(d) {if (d >= 1000) return Math.round(d/1000)+\"K\"; else return d;}); \n");
+ }
+ wholeScript.append(" d3.select('#chart"+reportRuntime.getReportID()+" svg') \n" +
+ " .datum(historicalBarChart) \n" );
+ if(animation)
+ wholeScript.append(" .transition().duration(1000) \n" );
+ wholeScript.append(" .call(chart); \n" +
+ "nv.utils.windowResize(chart.update); \n" +
+ "return chart; \n" +
+ "}); \n");
+
+ wholeScript.append("function redraw() { \n");
+ //wholeScript.append(" nv.utils.windowResize(chart.update); \n");
+ wholeScript.append(" d3.select('#chart"+reportRuntime.getReportID()+" svg') \n") ;
+ wholeScript.append(" .datum(historicalBarChart) \n");
+ wholeScript.append(" .transition().duration(500) \n");
+ wholeScript.append(" .call(chart); \n");
+ wholeScript.append("} \n");
+ wholeScript.append("\n");
+ wholeScript.append(" setInterval(function () { \n");
+ wholeScript.append(" redraw(); \n");
+ wholeScript.append(" }, 1500) \n");
+
+ wholeScript.append("if(historicalBarChart.length <= 0 ) {\n");
+ wholeScript.append(" document.getElementById(\"chart"+reportRuntime.getReportID()+"\").innerHTML = \"<div id='noData'><b>No Data Available</b></div>\";\n");
+ wholeScript.append(" document.getElementById(\"chart"+reportRuntime.getReportID()+"\").className=\"nodatadiv\";\n");
+ wholeScript.append(" document.getElementById(\"nodata\").className=\"nodatainner\";\n");
+ wholeScript.append("}\n");
+
+ wholeScript.append("</script> </body> </html> \n");
+
+ } else if (chartType.equals(AppConstants.GT_PIE) || chartType.equals(AppConstants.GT_PIE_3D)) {
+ wholeScript.append("<!DOCTYPE html>\n");
+ wholeScript.append("<html>\n");
+ wholeScript.append("<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF8\">\n");
+ wholeScript.append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n");
+ wholeScript.append("<link href=\""+ AppUtils.getBaseFolderURL() +"d3/css/nv.d3.css\" rel=\"stylesheet\" type=\"text/css\">\n");
+ wholeScript.append("<style>\n " +
+ " body { \n" +
+ " overflow-y:scroll; \n" +
+ " } \n" +
+ " text { \n" +
+ " font: 12px sans-serif; \n" +
+ " } \n" +
+ " tr.z-row-over > td.z-row-inner, tr.z-row-over > .z-cell {" +
+ " background-color: rgb(255, 255, 255); "+
+ "} "+
+ " svg { display: block; } " +
+ " #chart"+reportRuntime.getReportID()+" svg { \n" +
+ " height: "+ (nvl(height).length()>0?(height.endsWith("px")?height:height+"px"):"420px") + "; \n" +
+ " width: "+ (nvl(width).length()>0?(width.endsWith("px")?width:width+"px"):"700px") + "; \n" +
+ " min-width: 100px; \n" +
+ " min-height: 100px; \n" +
+ " } \n" +
+ " </style> \n" );
+ wholeScript.append("<body> \n");
+
+ if(showTitle)
+ wholeScript.append("<div align=\"center\"><H3>" + title +"</H3></div>");
+
+ wholeScript.append("<div id=\"chart"+reportRuntime.getReportID()+"\"><svg></svg></div>");
+ //"<svg id=\"test2\"></svg>\n");
+ //js files
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/d3.v3.min.js\"></script>\n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/nv.d3.min.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/legend.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/pie.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/pieChart.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/utils.js\"></script> \n");
+ wholeScript.append("<script> \n");
+
+ wholeScript.append("historicalBarChart = [ \n");
+ double TOTAL = 0;
+ double VALUE = 0;
+ int flagNull = 0;
+ String KEY = "";
+ String COLOR = "";
+ TreeSet<String> colorList = new TreeSet<String>();
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ VALUE = 0;
+ try {
+ VALUE = Double.parseDouble(ds.getString(i, 2));
+ TOTAL = TOTAL+VALUE;
+ } catch (NumberFormatException ex) {
+ flagNull = 1;
+ }
+ KEY = ds.getString(i, 0);
+ try {
+ if(ds.getString(i, "chart_color")!=null) {
+ colorList.add(KEY+"|"+ds.getString(i, "chart_color"));
+ }
+ } catch (ArrayIndexOutOfBoundsException ex) {
+ //System.out.println("No Chart Color");
+ }
+ wholeScript.append("{ \""+ "key" +"\":\""+ KEY+"\", \""+ "y" +"\":"+VALUE+"}, \n");
+
+ }
+ StringBuffer color = new StringBuffer("");
+ if(colorList.size()>0) {
+ SortedSet<String> s = Collections.synchronizedSortedSet(colorList);
+ Object[] colorElements = (Object[]) s.toArray();
+
+ String element = "";
+
+ for (int i = 0; i < colorElements.length; i++) {
+ element = ((String)colorElements[i]);
+ color.append("'"+element.substring(element.lastIndexOf("|")+1)+"',");
+ }
+ color.deleteCharAt(color.length()-1);
+ }
+
+ wholeScript.append("];\n");
+
+
+ wholeScript.append("var chart; \n");
+ wholeScript.append("nv.addGraph(function() { \n" +
+ " var width1= 700, height1=720; \n" +
+ " chart = nv.models.pieChart() \n" +
+ " .margin({top: "+ topMargin +", right: "+ rightMargin +", bottom: "+ bottomMargin +", left: " + leftMargin +"}) \n" +
+
+ //" .x(function(d) { return d.key +\" \"+ Math.round(d.y/"+TOTAL+" *100) + \"%\" }) \n" +
+ " .x(function(d) { return d.key }) \n" +
+ " .y(function(d) { return d.y }) \n");
+ if(colorList.size()>0) {
+ wholeScript.append(" .color(["+ color.toString() + "] ) \n");
+ }
+ //wholeScript.append(" .values(function(d) { return d }) \n");
+ //" .color(d3.scale.category10().range()); \n" +
+ if(showLegend) {
+ wholeScript.append(" chart.showLegend(true);\n ");
+ } else {
+ wholeScript.append(" chart.showLegend(false);\n ");
+ }
+
+ //wholeScript.append("chart.showLegend(false);\n" +
+ //" .width(width1) \n" +
+ //" .height(height1); \n" +
+ wholeScript.append(" d3.select('#chart"+reportRuntime.getReportID()+" svg') \n" +
+ " .datum(historicalBarChart) \n");
+ if(animation)
+ wholeScript.append(" .transition().duration(1200) \n" );
+/* " .attr(\"width\", width1) \n" +
+ " .attr(\"height\", height1) \n" +
+*/ wholeScript.append(" .call(chart); \n" +
+ " nv.utils.windowResize(chart.update);\n"+
+ "return chart; \n" +
+ "}); \n");
+
+ wholeScript.append("function redraw() { \n");
+ //wholeScript.append(" nv.utils.windowResize(chart.update); \n");
+ wholeScript.append(" d3.select('#chart"+reportRuntime.getReportID()+" svg') \n") ;
+ wholeScript.append(" .datum(historicalBarChart) \n");
+ wholeScript.append(" .transition().duration(500) \n");
+ wholeScript.append(" .call(chart); \n");
+ wholeScript.append("} \n");
+ wholeScript.append("\n");
+ wholeScript.append(" setInterval(function () { \n");
+ wholeScript.append(" redraw(); \n");
+ wholeScript.append(" }, 1500) \n");
+
+
+
+ wholeScript.append("if(historicalBarChart.length <= 0 ) {\n");
+ wholeScript.append(" document.getElementById(\"chart"+reportRuntime.getReportID()+"\").innerHTML = \"<div id='noData'><b>No Data Available</b></div>\";\n");
+ wholeScript.append(" document.getElementById(\"chart"+reportRuntime.getReportID()+"\").className=\"nodatadiv\";\n");
+ wholeScript.append(" document.getElementById(\"nodata\").className=\"nodatainner\";\n");
+ wholeScript.append("}\n");
+
+ wholeScript.append("</script> </body> </html> \n");
+
+ } else if (chartType.equals(AppConstants.GT_ANNOTATION_CHART) || chartType.equals(AppConstants.GT_FLEX_TIME_CHARTS)) {
+
+ boolean timeCharts = chartType.equals(AppConstants.GT_FLEX_TIME_CHARTS);
+
+ String dateStr = null;
+ java.util.Date date = null;
+
+ final int YEARFLAG = 1;
+ final int MONTHFLAG = 2;
+ final int DAYFLAG = 3;
+ final int HOURFLAG = 4;
+ final int MINFLAG = 5;
+ final int SECFLAG = 6;
+ final int MILLISECFLAG = 7;
+ final int DAYOFTHEWEEKFLAG = 8;
+ final int FLAGDATE = 9;
+
+ int flagNoDate = 0;
+
+ int MAXNUM = 0;
+ int YAXISNUM = 0;
+ int flagNull = 0;
+
+ double YAXISDOUBLENUM = 0.0;
+ double MAXDOUBLENUM = 0.0;
+ int MAXNUMDECIMALPLACES = 0;
+
+ int formatFlag = 0;
+
+ TreeSet<String> dateStrList = new TreeSet<String>();
+ // added to store all date elements
+ SortedSet<String> sortSet = new TreeSet<String>();
+ int count = 0;
+
+ int flag = 0;
+ boolean hasCategoryAxis = reportRuntime.hasSeriesColumn();
+ flag = hasCategoryAxis?1:0;
+
+
+ String anomalyText = "";
+
+ StringBuffer dataStrBuf = new StringBuffer("");
+ StringBuffer annotationsStrBuf = new StringBuffer("");
+
+ String xAxisLabel = (reportRuntime.getChartLegendColumn()!=null)?reportRuntime.getChartLegendColumn().getDisplayName():"";
+
+ //finding actual string
+ String actualText = "";
+ DataColumnType dct = null;
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ dct = (DataColumnType) iter.next();
+ if((dct.getChartSeq()!=null && dct.getChartSeq() >=0) && !AppUtils.nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND)) {
+ //if(AppUtils.nvl(dct.getDisplayName()).toLowerCase().contains("actual")) {
+ actualText = dct.getDisplayName();
+ break;
+ //}
+ }
+ }
+
+ int anomalyRec = 0;
+ int columnIndex = 1;
+ ArrayList columnNames = new ArrayList();
+ ArrayList columnValues = new ArrayList();
+ Set set = null;
+ String columnName = "";
+ String columnValue = "";
+ long minDate = 0L;
+ long maxDate = 0L;
+ StringBuffer seriesBuffer = new StringBuffer("");
+
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ columnNames = new ArrayList();
+ columnValues = new ArrayList();
+ columnName = "";
+ columnValue = "";
+ columnIndex = 1;
+ anomalyText = "";
+ dateStr = ds.getString(i, 0);
+ date = getDateFromDateStr(dateStr);
+ if(date.getTime() > maxDate )
+ maxDate = date.getTime();
+
+ formatFlag = getFlagFromDateStr(dateStr);
+
+
+ for (;columnIndex<ds.getColumnCount();columnIndex++) {
+ columnName = ds.getColumnName(columnIndex);
+ if(!timeCharts && !columnName.toLowerCase().equals("anomaly_text")) {
+ columnNames.add(columnName);
+ columnValues.add(AppUtils.nvls(ds.getString(i, columnIndex), "null"));
+ } else if (timeCharts) {
+ columnNames.add(columnName);
+ columnValues.add(AppUtils.nvls(ds.getString(i, columnIndex), "null"));
+ }
+ }
+/* actual = ds.getString(i, "actual");
+ //forecast = ds.getString(i, "forecast");
+ upperBound = ds.getString(i, "upperBound");
+ lowerBound = ds.getString(i, "lowerBound");
+
+*/ if(!timeCharts)
+ anomalyText = ds.getString(i, "anomaly_text");
+ //dataStrBuf.append(" [new Date(moment(\""+dateStr+"\")),"+ actual /*+","+ forecast*/+","+ lowerBound +","+ upperBound +"],\n");
+ dataStrBuf.append(" [new Date(moment(\""+dateStr+"\"))");
+ for(int c=0; c< columnNames.size(); c++ ) {
+ columnName = (String) columnNames.get(c);
+ columnValue = (String) columnValues.get(c);
+ for (Iterator iter1 = l.iterator(); iter1.hasNext();) {
+ dct = (DataColumnType) iter1.next();
+ if((dct.getChartSeq()!=null && dct.getChartSeq() >=0) && !AppUtils.nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND)) {
+ if((!timeCharts && !AppUtils.nvl(dct.getColId()).toLowerCase().equals("anomaly_text")) && AppUtils.nvl(dct.getColId()).toLowerCase().equals(columnName.toLowerCase())) {
+ dataStrBuf.append(","+columnValue);
+ break;
+ } else if(timeCharts && AppUtils.nvl(dct.getColId()).toLowerCase().equals(columnName.toLowerCase())){
+ dataStrBuf.append(","+columnValue);
+ //break;
+ }
+ }
+ }
+ }
+
+ dataStrBuf.append("],\n");
+ if(!timeCharts) {
+ if(AppUtils.nvl(anomalyText).length()>0) {
+ ++anomalyRec;
+ annotationsStrBuf.append("anns.push( {\n");
+ annotationsStrBuf.append(" series: '"+actualText+"',\n");
+ annotationsStrBuf.append(" x: moment(\""+dateStr+"\"),\n");
+ annotationsStrBuf.append(" shortText: '"+ IntToLetter(anomalyRec).toUpperCase() +"',\n");
+ annotationsStrBuf.append(" text: '"+ anomalyText + "'\n");
+ annotationsStrBuf.append("});\n");
+ //anomalyRec++;
+ }
+
+ }
+ }
+
+ //if(!timeCharts)
+ //anomalyRec = anomalyRec - 1;
+
+ minDate = maxDate - (new Long(reportRuntime.getZoomIn()).longValue()*60*60*1000);
+ System.out.println(new java.util.Date(maxDate) + " " + new java.util.Date(minDate) + " " + reportRuntime.getZoomIn());
+ if(dataStrBuf.lastIndexOf(",")!= -1)
+ dataStrBuf.deleteCharAt(dataStrBuf.lastIndexOf(","));
+
+ wholeScript = new StringBuffer("");
+ wholeScript.append("<!DOCTYPE html>\n");
+ wholeScript.append("<html>\n");
+ wholeScript.append(" <head>\n");
+ //wholeScript.append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7; IE=EmulateIE9\">\n");
+ wholeScript.append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n");
+ wholeScript.append("<script type=\"text/javascript\" src=\""+ AppUtils.getBaseFolderURL() +"dy3/js/dygraph-combined.js\"></script>\n");
+ wholeScript.append("<script type=\"text/javascript\" src=\""+ AppUtils.getBaseFolderURL() +"dy3/js/moment.min.js\"></script>\n");
+ wholeScript.append("<script type=\"text/javascript\" src=\""+ AppUtils.getBaseFolderURL() +"dy3/js/interaction.min.js\"></script>\n");
+
+ wholeScript.append("<script type=\"text/javascript\">\n");
+ if(AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("30min")) {
+ wholeScript.append("var click=2;\n");
+ } else if (AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("hourly")) {
+ wholeScript.append("var click=3;\n");
+ } else if (AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("daily")) {
+ wholeScript.append("var click=3;\n");
+ } else
+ wholeScript.append("var click=3;\n");
+ //wholeScript.append(" var click=0;\n");
+ wholeScript.append(" function downV3(event, g, context) { \n");
+ wholeScript.append(" context.initializeMouseDown(event, g, context); \n");
+ wholeScript.append(" if (event.altKey || event.shiftKey) { \n");
+ wholeScript.append(" var minDate = g.xAxisRange()[0]; \n");
+ wholeScript.append(" var maxDate = g.xAxisRange()[1]; \n");
+ if(AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("daily")) {
+ wholeScript.append(" if(((maxDate-minDate)/(1000*60*60*24)) > 6) \n");
+ wholeScript.append(" Dygraph.startZoom(event, g, context); \n");
+ } else if(AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("hourly")) {
+ wholeScript.append(" if(((maxDate-minDate)/(1000*60*60)) > 6) \n");
+ wholeScript.append(" Dygraph.startZoom(event, g, context); \n");
+ } else if(AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("30min")) {
+ wholeScript.append(" if(((maxDate-minDate)/(1000*60*60*2)) > 6) \n");
+ wholeScript.append(" Dygraph.startZoom(event, g, context); \n");
+
+ } else {
+ wholeScript.append(" if(((maxDate-minDate)/(1000*60*60)) > 6) \n");
+ wholeScript.append(" Dygraph.startZoom(event, g, context); \n");
+ }
+ if(AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("30min")) {
+ wholeScript.append(" click=2;\n");
+ } else if (AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("hourly")) {
+ wholeScript.append(" click=3;\n");
+ } else if (AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("daily")) {
+ wholeScript.append(" click=3;\n");
+ } else
+ wholeScript.append(" click=3;\n");
+ wholeScript.append(" } else if (event.ctrlKey) {\n");
+
+
+ wholeScript.append(" click++;\n");
+ wholeScript.append(" if(click == 1)\n");
+ wholeScript.append(" zoom_custom(3600);\n");
+ wholeScript.append(" else if(click == 2)\n");
+ wholeScript.append(" zoom_custom(12*3600);\n");
+ wholeScript.append(" else if(click == 3)\n");
+ wholeScript.append(" zoom_custom(86400);\n");
+ wholeScript.append(" else if (click == 4)\n");
+ wholeScript.append(" zoom_custom(7*86400);\n");
+ wholeScript.append(" else if (click == 5)\n");
+ wholeScript.append(" zoom_custom(30*86400);\n");
+ wholeScript.append(" else if (click == 6)\n");
+ wholeScript.append(" zoom_custom(90*86400);\n");
+ wholeScript.append(" else if (click == 7)\n");
+ wholeScript.append(" zoom_custom(180*86400);\n");
+ wholeScript.append(" else if (click == 8)\n");
+ wholeScript.append(" zoom_custom(365*86400);\n");
+ wholeScript.append(" else if (click == 10)\n");
+ wholeScript.append(" zoom_custom(5*365*86400);\n");
+ wholeScript.append(" else { \n");
+ wholeScript.append(" reset();\n");
+ wholeScript.append(" }\n");
+ //wholeScript.append(" \n");
+ wholeScript.append(" } else {\n");
+ wholeScript.append(" Dygraph.startPan(event, g, context); \n");
+ wholeScript.append(" } \n");
+ wholeScript.append(" } \n");
+ wholeScript.append("</script>\n ");
+ wholeScript.append("<style type=\"text/css\">\n");
+ wholeScript.append(".annotation {\n");
+ wholeScript.append("}");
+ wholeScript.append(".dygraph-title {\n");
+ wholeScript.append("color: black;\n");
+ wholeScript.append("font-weight:bold; \n");
+ wholeScript.append("}\n");
+ wholeScript.append(".dygraph-axis-label-x { ");
+ wholeScript.append("-webkit-transform:rotate(-0deg);");
+ wholeScript.append("display:block;");
+ /*position:absolute;
+ right:-5px;
+ top:15px;*/
+ wholeScript.append("}\n");
+
+ int widthInt = 0;
+ if(nvl(width).length() > 0) {
+ try {
+ widthInt = new Integer(width).intValue();
+ } catch(Exception ex) {
+ if(width.endsWith("px")) {
+ try {
+ widthInt = new Integer(width.substring(0, width.indexOf("px")));
+ } catch (Exception ex1) {
+ widthInt = 700;
+ }
+ } else {
+ widthInt = 700;
+ }
+ }
+ } else widthInt = 700;
+
+ wholeScript.append(".dygraph-legend {\n");
+ wholeScript.append(" left: "+(widthInt-200)+"px !important;\n");
+ wholeScript.append(" top: 5px !important;\n");
+ wholeScript.append("}\n");
+
+ wholeScript.append(".nodatadiv {\n");
+ wholeScript.append(" display: table-cell;\n");
+ wholeScript.append(" width: 700px;\n");
+ wholeScript.append(" height:370px;\n");
+ wholeScript.append(" text-align:center;\n");
+ wholeScript.append(" vertical-align: middle;\n");
+ wholeScript.append("}\n");
+ wholeScript.append(".nodatainner {\n");
+ wholeScript.append(" padding: 10px;\n");
+ wholeScript.append("}\n");
+
+ wholeScript.append("canvas {\n");
+ wholeScript.append(" -webkit-touch-callout: none; \n");
+ wholeScript.append(" -webkit-user-select: none;\n");
+ wholeScript.append(" -khtml-user-select: none;\n");
+ wholeScript.append(" -moz-user-select: none;\n");
+ wholeScript.append(" user-select: none;\n");
+ wholeScript.append(" user-select: none;\n");
+ wholeScript.append(" outline: none;\n");
+ wholeScript.append(" -webkit-tap-highlight-color: rgba(255, 255, 255, 0); /* mobile webkit */\n");
+ wholeScript.append("}\n");
+ wholeScript.append("</style>\n");
+ wholeScript.append("</head>\n");
+ wholeScript.append("<body> \n");
+
+/* if(showTitle)
+ wholeScript.append(" <p align=\"center\"><b> " + (AppUtils.nvl(reportRuntime.getReportTitle()).length()>0?reportRuntime.getReportTitle():reportRuntime.getReportName()) + "</b></p>\n");
+*/
+ wholeScript.append(" <table>\n");
+ if(showTitle) {
+ wholeScript.append(" <tr> \n ");
+ wholeScript.append(" <td> \n ");
+ wholeScript.append(" <div class=\"dygraph-label dygraph-title\" align=\"center\">"+title+"</div> \n");
+ wholeScript.append(" </td> \n ");
+ }
+
+ wholeScript.append(" </tr> \n ");
+
+ wholeScript.append(" <tr> \n ");
+ wholeScript.append(" <td> \n ");
+ if(AppUtils.nvl(reportRuntime.getLegendPosition()).length()<=0 || reportRuntime.getLegendPosition().equals("top")) {
+ wholeScript.append(" <div id=\"labelDiv"+reportRuntime.getReportID()+"\"></div>\n");
+ }
+ wholeScript.append(" <div id=\"message"+reportRuntime.getReportID()+"\"></div> \n");
+ wholeScript.append(" </td> \n ");
+
+ wholeScript.append(" </tr> \n ");
+ wholeScript.append(" <tr>\n");
+ wholeScript.append(" <td>\n");
+
+ int heightInt = 0;
+ if(nvl(height).length() > 0) {
+ try {
+ heightInt = new Integer(height).intValue();
+ heightInt -= 50;
+ } catch(Exception ex) {
+ if(height.endsWith("px")) {
+ try {
+ heightInt = new Integer(height.substring(0, height.indexOf("px")));
+ heightInt -= 50;
+ } catch (Exception ex1) {
+ heightInt = 420;
+ }
+ } else {
+ heightInt = 420;
+ }
+ }
+ } else heightInt = 420;
+ if(AppUtils.nvl(reportRuntime.getLegendPosition()).length()>=0 && reportRuntime.getLegendPosition().equals("right")) {
+ wholeScript.append(" <div id=\"div_g"+reportRuntime.getReportID()+"\" style=\"width:"+ (widthInt-250)+ "px; \n" );
+ } else {
+ wholeScript.append(" <div id=\"div_g"+reportRuntime.getReportID()+"\" style=\"width:"+ (widthInt)+ "px; \n" );
+ }
+ wholeScript.append(" height:"+ heightInt +"px;\"></div> \n");
+ wholeScript.append(" </td>\n");
+ if(AppUtils.nvl(reportRuntime.getLegendPosition()).length()>=0 && reportRuntime.getLegendPosition().equals("right")) {
+ wholeScript.append(" <td valign=\"top\">\n");
+ wholeScript.append(" <div id=\"labelDiv3716\" valign=\"top\" style=\"width:250px;height:"+ heightInt +"px;\"></div>\n");
+ wholeScript.append(" </td>\n");
+ }
+ wholeScript.append(" </tr>\n");
+ if(anomalyRec > 0) {
+ wholeScript.append(" <tr>\n");
+ wholeScript.append(" <td>\n");
+ wholeScript.append(" <table>\n");
+ wholeScript.append(" <tr>\n");
+ wholeScript.append(" <td align=\"center\"><font size=\"2px\"><B><align=\"center\">Anomaly Description</align></B></font></td>\n");
+ wholeScript.append(" </tr>\n");
+ wholeScript.append(" <tr>\n");
+ wholeScript.append(" <td><div id=\"list"+reportRuntime.getReportID()+"\" style=\"width:" + widthInt + "px; height:50px;\"></div></td>\n" );
+ wholeScript.append(" </tr>\n");
+ wholeScript.append(" </table>\n");
+ wholeScript.append(" </td>\n");
+ wholeScript.append(" </tr>\n");
+ }
+ wholeScript.append(" </table>\n");
+
+ wholeScript.append(" <script type=\"text/javascript\">\n");
+ wholeScript.append(" Dygraph.addEvent(document, \"mousewheel\", function() { lastClickedGraph = null; });\n");
+ wholeScript.append(" Dygraph.addEvent(document, \"click\", function() { lastClickedGraph = null; });\n");
+ wholeScript.append(" var data = []; \n");
+ wholeScript.append(" data = [\n ");
+ wholeScript.append( dataStrBuf.toString());
+ wholeScript.append(" ];\n");
+ wholeScript.append(" if(data.length > 0 ) { \n");
+ wholeScript.append(" var orig_range = [ data[0][0].valueOf(), data[data.length - 1][0].valueOf() ];\n");
+ if(!timeCharts) {
+ wholeScript.append(" function nameAnnotation(ann) { \n");
+ wholeScript.append(" return ann.shortText; \n");
+ //wholeScript.append(" var m = moment(ann.x);\n");
+ //wholeScript.append(" return \"(\" + ann.series + \", \" + m.format(\"YYYY-MM-DD HH\"); + \")\"; \n");
+ wholeScript.append(" }\n");
+ wholeScript.append(" anns = [];\n");
+ }
+ wholeScript.append(" var graph_initialized = false;\n");
+ wholeScript.append(" if(navigator.platform == 'iPad') { ");
+ wholeScript.append(" g = new Dygraph(\n");
+ wholeScript.append(" document.getElementById(\"div_g"+reportRuntime.getReportID()+"\"),\n");
+ //data here
+ /*wholeScript.append(" [\n");
+ wholeScript.append(dataStrBuf.toString());
+ wholeScript.append(" ],\n");*/
+ wholeScript.append(" data , \n");
+ wholeScript.append(" {\n");
+
+ //Labels here
+
+ dct = null;
+ StringBuffer labelStrBuf = new StringBuffer("");
+ StringBuffer colorsStrBuf = new StringBuffer("");
+ StringBuffer visibilityStrBuf = new StringBuffer("");
+ int countChartValues = 0;
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ dct = (DataColumnType) iter.next();
+ if((dct.getChartSeq()!=null && dct.getChartSeq() >=0) || AppUtils.nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND)) {
+ if(!AppUtils.nvl(dct.getDisplayName()).toLowerCase().equals("anomaly_text")) {
+ countChartValues++;
+ labelStrBuf.append("'"+ dct.getDisplayName()+"',");
+ if(!AppUtils.nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))
+ colorsStrBuf.append("'"+ AppUtils.nvl(dct.getChartColor())+"',");
+ visibilityStrBuf.append("true,");
+ }
+ }
+ }
+ if(labelStrBuf.indexOf(",")!=-1) {
+ labelStrBuf.deleteCharAt(labelStrBuf.lastIndexOf(","));
+ visibilityStrBuf.deleteCharAt(visibilityStrBuf.lastIndexOf(","));
+ }
+ if(colorsStrBuf.indexOf(",")!=-1)
+ colorsStrBuf.deleteCharAt(colorsStrBuf.lastIndexOf(","));
+ //if(showTitle)
+ //wholeScript.append("title: '" + (AppUtils.nvl(reportRuntime.getReportTitle()).length()>0?reportRuntime.getReportTitle():reportRuntime.getReportName()) + "',\n");
+ wholeScript.append("maxNumberWidth:6,\n");
+ wholeScript.append("xAxisHeight: 70,\n");
+ wholeScript.append("yAxisLabelWidth: 70,\n");
+ wholeScript.append("xAxisLabelWidth: 45,\n");
+ wholeScript.append("axes: {\n");
+ wholeScript.append("x: {\n");
+ wholeScript.append(" axisLabelFormatter: function(d, gran) {\n");
+ wholeScript.append(" var month = d.getMonth()+1;\n");
+ wholeScript.append(" var day = d.getDate();\n");
+ wholeScript.append(" var year = d.getFullYear();\n");
+ wholeScript.append(" var hour = d.getHours();\n");
+ wholeScript.append(" var minutes = d.getMinutes();\n");
+ wholeScript.append(" var seconds = d.getSeconds();\n");
+ wholeScript.append(" var wholeString = Dygraph.zeropad(month)+'/'+Dygraph.zeropad(day);\n");
+ // wholeScript.append(" if(hour >= 0 && minutes > 0 && seconds > 0) {\n");
+ //wholeScript.append(" wholeString += ' ' + Dygraph.zeropad(hour) + ':'+Dygraph.zeropad(minutes)+':'+Dygraph.zeropad(seconds);\n");
+ //wholeScript.append(" } else if (hour >= 0 && minutes > 0 && seconds == 0) {\n");
+ if(AppUtils.nvl(reportRuntime.getTimeAxisType()).length()==0 || AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("hourly"))
+ wholeScript.append(" wholeString += ' ' + Dygraph.zeropad(hour) + ':'+Dygraph.zeropad(minutes);\n");
+ //wholeScript.append(" } else if (hour >= 0 && (minutes >= 0 && seconds > 0)) {\n");
+ //wholeScript.append(" wholeString += ' ' + Dygraph.zeropad(hour) + ':'+Dygraph.zeropad(minutes)+':'+Dygraph.zeropad(seconds);\n");
+ //wholeScript.append(" } else if (hour >= 0) { \n");
+ //wholeScript.append(" wholeString += ' ' + Dygraph.zeropad(hour); \n");
+ //wholeScript.append(" } \n");
+ wholeScript.append(" return wholeString; \n");
+ wholeScript.append(" },\n");
+ wholeScript.append(" ticker: function (a, b, pixels, opts, dygraph, vals) { \n ");
+ wholeScript.append(" if(((b-a)/(1000*60*60)) <= 6) { \n");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.THIRTY_MINUTELY, opts, dygraph); \n");
+ wholeScript.append(" } else if(((b-a)/(1000*60*60)) <= 12) { \n");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.HOURLY, opts, dygraph); \n");
+ wholeScript.append(" } else if (((b-a)/(1000*60*60)) <= 25) \n ");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.TWO_HOURLY, opts, dygraph); \n ");
+ wholeScript.append(" else if(((b-a)/(1000*60*60)) <= 78) \n ");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.SIX_HOURLY, opts, dygraph); \n ");
+ wholeScript.append(" else if(((b-a)/(1000*60*60*24)) <= 12)\n");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.DAILY, opts, dygraph); \n");
+ wholeScript.append(" else if(((b-a)/(1000*60*60*24)) <= 90) \n");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.WEEKLY, opts, dygraph); \n");
+ wholeScript.append(" else \n");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.MONTHLY, opts, dygraph); \n");
+ wholeScript.append(" }, \n");
+ wholeScript.append(" valueFormatter: function(ms) { \n");
+ wholeScript.append(" return new Date(ms).strftime(\"%m/%d/%Y %H:%M\"); \n");
+ wholeScript.append( " }\n" );
+ wholeScript.append(" }\n");
+ wholeScript.append("},\n");
+ wholeScript.append(" interactionModel : { \n");
+ wholeScript.append(" 'mousedown' : downV4,\n");
+ wholeScript.append(" touchstart : newDygraphTouchstart,\n");
+ wholeScript.append(" touchend : Dygraph.defaultInteractionModel.touchend,\n");
+ wholeScript.append(" touchmove : Dygraph.defaultInteractionModel.touchmove\n");
+ //wholeScript.append(" 'dblclick' : dblClickV3,\n");
+ //wholeScript.append(" 'mousewheel' : scrollV3\n");
+
+ /*wholeScript.append(" 'mousedown' : downV3,\n");
+ wholeScript.append(" 'mousemove' : moveV3,\n");
+ wholeScript.append(" 'mouseup' : upV3,\n");
+ wholeScript.append(" 'click' : clickV3,\n");
+ wholeScript.append(" 'dblclick' : dblClickV3,\n");
+ wholeScript.append(" 'mousewheel' : scrollV3\n");*/
+ wholeScript.append("},\n");
+ /*wholeScript.append(" zoomCallback: function(minDate, maxDate, yRanges) { \n");
+ if(AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("daily")) {
+ wholeScript.append(" if(((maxDate-minDate)/(1000*60*60*24)) < 6) { \n");
+ wholeScript.append(" maxDate = new Date(minDate).setMinutes(6*24*60);\n");
+ wholeScript.append(" g.updateOptions({\n");
+ wholeScript.append(" interactionModel: {},\n");
+ wholeScript.append(" dateWindow: [minDate, maxDate]\n");
+ wholeScript.append(" });\n");
+ } else if (AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("hourly")) {
+ wholeScript.append(" if(((maxDate-minDate)/(1000*60*60)) <= 6) { \n");
+ wholeScript.append(" maxDate = new Date(minDate).setMinutes(360);\n");
+ wholeScript.append(" g.updateOptions({\n");
+ wholeScript.append(" interactionModel: {},\n");
+ wholeScript.append(" dateWindow: [minDate, maxDate]\n");
+ wholeScript.append(" });\n");
+ } else if (AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("30min")) {
+ wholeScript.append(" if(((maxDate-minDate)/(1000*60*60)) <= 3) { \n");
+ wholeScript.append(" maxDate = new Date(minDate).setMinutes(180);\n");
+ wholeScript.append(" g.updateOptions({\n");
+ wholeScript.append(" interactionModel: {},\n");
+ wholeScript.append(" dateWindow: [minDate, maxDate]\n");
+ wholeScript.append(" });\n");
+ } else if (AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("weekly")) {
+ wholeScript.append(" if(((maxDate-minDate)/(1000*60*60*24)) < 7) { \n");
+ wholeScript.append(" maxDate = new Date(minDate).setMinutes(7*24*60);\n");
+ wholeScript.append(" g.updateOptions({\n");
+ wholeScript.append(" interactionModel: {},\n");
+ wholeScript.append(" dateWindow: [minDate, maxDate]\n");
+ wholeScript.append(" });\n");
+ }
+ wholeScript.append(" } else {\n");
+ wholeScript.append(" g.updateOptions({\n");
+ wholeScript.append(" interactionModel : {\n");
+ wholeScript.append(" 'mousedown' : downV3,\n");
+ wholeScript.append(" 'mousemove' : moveV3,\n");
+ wholeScript.append(" 'mouseup' : upV3,\n");
+ wholeScript.append(" 'click' : clickV3,\n");
+ wholeScript.append(" 'dblclick' : dblClickV3,\n");
+ wholeScript.append(" 'mousewheel' : scrollV3\n");
+ wholeScript.append(" }\n");
+ wholeScript.append(" });\n");
+ wholeScript.append(" } \n");
+ wholeScript.append(" } ,\n");*/
+ wholeScript.append("dateWindow: ["+minDate+", "+maxDate+"],\n");
+ wholeScript.append("labels: ["+ labelStrBuf +"],\n");
+ wholeScript.append("labelsDiv: \"labelDiv"+reportRuntime.getReportID()+"\",\n");
+ wholeScript.append("labelsShowZeroValues: true,\n");
+ if(AppUtils.nvl(reportRuntime.getLegendPosition()).length()>=0 && reportRuntime.getLegendPosition().equals("right")) {
+ wholeScript.append("labelsSeparateLines: true,\n");
+ }
+ wholeScript.append("labelsDivWidth: 200,\n");
+
+ wholeScript.append("animatedZooms: true,\n");
+ wholeScript.append("strokeWidth: 3.0,\n");
+ wholeScript.append("strokeBorderWidth: 2.0,\n");
+ /*wholeScript.append(" labelsDivStyles: { \n");
+ wholeScript.append(" 'backgroundColor': 'rgba(200, 200, 255, 0.75)',\n");
+ wholeScript.append(" 'padding': '4px',\n");
+ wholeScript.append(" 'border': '1px solid black',\n");
+ wholeScript.append(" 'borderRadius': '10px',\n");
+ wholeScript.append(" 'boxShadow': '4px 4px 4px #888',\n");
+ wholeScript.append(" 'width': '50px'\n");
+ wholeScript.append("}, \n");
+ */
+ wholeScript.append("visibility: ["+ visibilityStrBuf +"],\n");
+ if(colorsStrBuf.length() > 0 && colorsStrBuf.length()>=(countChartValues*3+5))
+ wholeScript.append("colors: ["+ colorsStrBuf +"],\n");
+
+ wholeScript.append(" legend: 'always', \n");
+ //Yaxis label here
+ wholeScript.append(" ylabel: '"+ chartLeftAxisLabel +"' , \n");
+
+ //Xaxis label here
+ wholeScript.append(" xlabel: '"+ xAxisLabel +"' , \n");
+
+ //draw points
+ wholeScript.append(" drawPoints: true, \n");
+
+ //stacked graph
+ wholeScript.append(" stackedGraph: false, \n");
+
+ dct = null;
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ dct = (DataColumnType) iter.next();
+ if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
+ if(!AppUtils.nvl(dct.getDisplayName()).toLowerCase().equals("anomaly_text")) {
+ if(dct.getChartSeq()!=null && dct.getChartSeq() >=0) {
+ wholeScript.append(" '"+ dct.getDisplayName() + "': {\n");
+ if(AppUtils.nvl(dct.getChartLineType()).length()>0)
+ wholeScript.append(" strokePattern: Dygraph.DASHED_LINE,\n");
+ if(dct.isIsRangeAxisFilled()!=null && dct.isIsRangeAxisFilled().booleanValue()) {
+ wholeScript.append(" fillGraph: true\n");
+ }
+ wholeScript.append(" },\n");
+ }
+ }
+ }
+ }
+
+/* //each labels
+ wholeScript.append(" 'Forecast': {\n");
+
+ //if dashed line
+ wholeScript.append(" strokePattern: Dygraph.DASHED_LINE,\n");
+
+ //if fillable
+ wholeScript.append(" fillGraph: true\n");
+
+ // close each labels
+ wholeScript.append(" }\n");
+*/
+ // callback method
+ if(anomalyRec > 0) {
+ wholeScript.append(" drawCallback: function(g, is_initial) { \n");
+ wholeScript.append(" if (is_initial) { \n");
+ wholeScript.append(" graph_initialized = true; \n");
+ wholeScript.append(" if (anns.length > 0) { \n");
+ wholeScript.append(" g.setAnnotations(anns); \n");
+ wholeScript.append(" }\n");
+ wholeScript.append(" }\n");
+
+ wholeScript.append(" var anns1 = g.annotations();\n");
+ //wholeScript.append(" var html = \"\";\n");
+ wholeScript.append(" var html = \"<select id='x' size='1' style='width: "+ widthInt +"px; font-family : courier; font-size:8pt; font-weight:bold;'>\";\n");
+ wholeScript.append(" for (var i = anns1.length-1; i >= 0 ; i--) {\n");
+ wholeScript.append(" var name = nameAnnotation(anns1[i]);\n");
+ //wholeScript.append(" html += \"<span id='\" + name + \"'>\"\n");
+ wholeScript.append(" if(i==anns1.length-1)\n");
+ wholeScript.append(" html += \"<option value='\" + name + \"' selected ><font size=1>\" \n");
+ wholeScript.append(" else \n");
+ wholeScript.append(" html += \"<option value='\" + name + \"'><font size=1>\" \n");
+ wholeScript.append(" html += name \n");
+ //wholeScript.append(" html += name + \": \" + (anns1[i].shortText || '(icon)')\n");
+ //wholeScript.append(" html += \" -> \" + anns1[i].text + \"</span><br/>\";\n");
+ wholeScript.append(" html += \"&nbsp;:&nbsp;\" + anns1[i].text + \"</font></option>\";\n");
+ wholeScript.append(" }\n");
+ wholeScript.append(" html += \"</select>\" \n");
+ wholeScript.append(" document.getElementById(\"list"+reportRuntime.getReportID()+"\").innerHTML = html;\n");
+ wholeScript.append(" }\n");
+
+
+ wholeScript.append(" }\n");
+ wholeScript.append(" )\n");
+
+ //push annotations
+ wholeScript.append(annotationsStrBuf.toString());
+
+ wholeScript.append(" if (graph_initialized) {\n");
+ wholeScript.append(" g.setAnnotations(anns);\n");
+ wholeScript.append(" } \n");
+ //upate handler script
+
+ wholeScript.append(" var saveBg = '';\n");
+ wholeScript.append(" var num = 0;\n");
+ wholeScript.append(" g.updateOptions( {\n");
+ wholeScript.append(" annotationMouseOverHandler: function(ann) { \n");
+ //wholeScript.append(" document.getElementById(nameAnnotation(ann)).style.fontWeight = 'bold';\n");
+ //wholeScript.append(" saveBg = ann.div.style.backgroundColor;\n");
+ //wholeScript.append(" ann.div.style.backgroundColor = '#ddd';\n");
+ wholeScript.append(" var selectobject = document.getElementById(\"x\");\n");
+ wholeScript.append(" for(var i=0; i<selectobject.length;i++) {\n ");
+ wholeScript.append(" if(selectobject.options[i].value == nameAnnotation(ann)) {\n ");
+ wholeScript.append(" selectobject.options[i].selected = true; \n ");
+ wholeScript.append(" } ");
+ wholeScript.append(" } ");
+
+ wholeScript.append(" },\n");
+ wholeScript.append(" annotationMouseOutHandler: function(ann) {\n");
+ wholeScript.append(" document.getElementById(nameAnnotation(ann)).style.fontWeight = 'normal';\n");
+ wholeScript.append(" ann.div.style.backgroundColor = saveBg;\n");
+ //wholeScript.append(" var selectobject = document.getElementById(\"x\");\n");
+ //wholeScript.append(" for(var i=0; i<selectobject.length;i++) {\n ");
+ //wholeScript.append(" if(selectobject.options[i].value == nameAnnotation(ann)) {\n ");
+ //wholeScript.append(" selectobject.options[i].selected = false; \n ");
+ //wholeScript.append(" } ");
+ //wholeScript.append(" } ");
+
+ wholeScript.append(" }\n");
+ }
+ wholeScript.append(" });\n");
+
+ //Other devices
+ wholeScript.append("} else { \n");
+
+ wholeScript.append(" g = new Dygraph(\n");
+ wholeScript.append(" document.getElementById(\"div_g"+reportRuntime.getReportID()+"\"),\n");
+ //data here
+ /*wholeScript.append(" [\n");
+ wholeScript.append(dataStrBuf.toString());
+ wholeScript.append(" ],\n");*/
+ wholeScript.append(" data , \n");
+ wholeScript.append(" {\n");
+
+ //Labels here
+
+ dct = null;
+ labelStrBuf = new StringBuffer("");
+ colorsStrBuf = new StringBuffer("");
+ visibilityStrBuf = new StringBuffer("");
+ countChartValues = 0;
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ dct = (DataColumnType) iter.next();
+ if((dct.getChartSeq()!=null && dct.getChartSeq() >=0) || AppUtils.nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND)) {
+ if(!AppUtils.nvl(dct.getDisplayName()).toLowerCase().equals("anomaly_text")) {
+ countChartValues++;
+ labelStrBuf.append("'"+ dct.getDisplayName()+"',");
+ if(!AppUtils.nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))
+ colorsStrBuf.append("'"+ AppUtils.nvl(dct.getChartColor())+"',");
+ visibilityStrBuf.append("true,");
+ }
+ }
+ }
+ if(labelStrBuf.indexOf(",")!=-1) {
+ labelStrBuf.deleteCharAt(labelStrBuf.lastIndexOf(","));
+ visibilityStrBuf.deleteCharAt(visibilityStrBuf.lastIndexOf(","));
+ }
+ if(colorsStrBuf.indexOf(",")!=-1)
+ colorsStrBuf.deleteCharAt(colorsStrBuf.lastIndexOf(","));
+ //if(showTitle)
+ //wholeScript.append("title: '" + (AppUtils.nvl(reportRuntime.getReportTitle()).length()>0?reportRuntime.getReportTitle():reportRuntime.getReportName()) + "',\n");
+ wholeScript.append("maxNumberWidth:6,\n");
+ wholeScript.append("xAxisHeight: 70,\n");
+ wholeScript.append("yAxisLabelWidth: 70,\n");
+ wholeScript.append("xAxisLabelWidth: 45,\n");
+ wholeScript.append("axes: {\n");
+ wholeScript.append("x: {\n");
+ wholeScript.append(" axisLabelFormatter: function(d, gran) {\n");
+ wholeScript.append(" var month = d.getMonth()+1;\n");
+ wholeScript.append(" var day = d.getDate();\n");
+ wholeScript.append(" var year = d.getFullYear();\n");
+ wholeScript.append(" var hour = d.getHours();\n");
+ wholeScript.append(" var minutes = d.getMinutes();\n");
+ wholeScript.append(" var seconds = d.getSeconds();\n");
+ wholeScript.append(" var wholeString = Dygraph.zeropad(month)+'/'+Dygraph.zeropad(day);\n");
+ // wholeScript.append(" if(hour >= 0 && minutes > 0 && seconds > 0) {\n");
+ //wholeScript.append(" wholeString += ' ' + Dygraph.zeropad(hour) + ':'+Dygraph.zeropad(minutes)+':'+Dygraph.zeropad(seconds);\n");
+ //wholeScript.append(" } else if (hour >= 0 && minutes > 0 && seconds == 0) {\n");
+ if(AppUtils.nvl(reportRuntime.getTimeAxisType()).length()==0 || AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("hourly"))
+ wholeScript.append(" wholeString += ' ' + Dygraph.zeropad(hour) + ':'+Dygraph.zeropad(minutes);\n");
+ //wholeScript.append(" } else if (hour >= 0 && (minutes >= 0 && seconds > 0)) {\n");
+ //wholeScript.append(" wholeString += ' ' + Dygraph.zeropad(hour) + ':'+Dygraph.zeropad(minutes)+':'+Dygraph.zeropad(seconds);\n");
+ //wholeScript.append(" } else if (hour >= 0) { \n");
+ //wholeScript.append(" wholeString += ' ' + Dygraph.zeropad(hour); \n");
+ //wholeScript.append(" } \n");
+ wholeScript.append(" return wholeString; \n");
+ wholeScript.append(" },\n");
+ wholeScript.append(" ticker: function (a, b, pixels, opts, dygraph, vals) { \n ");
+ wholeScript.append(" if(((b-a)/(1000*60*60)) <= 6) { \n");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.THIRTY_MINUTELY, opts, dygraph); \n");
+ wholeScript.append(" } else if(((b-a)/(1000*60*60)) <= 12) { \n");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.HOURLY, opts, dygraph); \n");
+ wholeScript.append(" } else if (((b-a)/(1000*60*60)) <= 25) \n ");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.TWO_HOURLY, opts, dygraph); \n ");
+ wholeScript.append(" else if(((b-a)/(1000*60*60)) <= 78) \n ");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.SIX_HOURLY, opts, dygraph); \n ");
+ wholeScript.append(" else if(((b-a)/(1000*60*60*24)) <= 12)\n");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.DAILY, opts, dygraph); \n");
+ wholeScript.append(" else if(((b-a)/(1000*60*60*24)) <= 90) \n");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.WEEKLY, opts, dygraph); \n");
+ wholeScript.append(" else \n");
+ wholeScript.append(" return Dygraph.getDateAxis(a, b, Dygraph.MONTHLY, opts, dygraph); \n");
+ wholeScript.append(" }, \n");
+ wholeScript.append(" valueFormatter: function(ms) { \n");
+ wholeScript.append(" return new Date(ms).strftime(\"%m/%d/%Y %H:%M\"); \n");
+ wholeScript.append( " }\n" );
+ wholeScript.append(" }\n");
+ wholeScript.append("},\n");
+ wholeScript.append(" interactionModel : { \n");
+
+ wholeScript.append(" 'mousedown' : downV3,\n");
+ wholeScript.append(" 'mousemove' : moveV3,\n");
+ wholeScript.append(" 'mouseup' : upV3,\n");
+ wholeScript.append(" 'click' : clickV3,\n");
+ wholeScript.append(" 'dblclick' : dblClickV3,\n");
+ wholeScript.append(" 'mousewheel' : scrollV3\n");
+ wholeScript.append("},\n");
+ wholeScript.append(" zoomCallback: function(minDate, maxDate, yRanges) { \n");
+ if(AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("daily")) {
+ wholeScript.append(" if(((maxDate-minDate)/(1000*60*60*24)) < 6) { \n");
+ wholeScript.append(" maxDate = new Date(minDate).setMinutes(6*24*60);\n");
+ wholeScript.append(" g.updateOptions({\n");
+ wholeScript.append(" interactionModel: {},\n");
+ wholeScript.append(" dateWindow: [minDate, maxDate]\n");
+ wholeScript.append(" });\n");
+ } else if (AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("hourly")) {
+ wholeScript.append(" if(((maxDate-minDate)/(1000*60*60)) <= 6) { \n");
+ wholeScript.append(" maxDate = new Date(minDate).setMinutes(360);\n");
+ wholeScript.append(" g.updateOptions({\n");
+ wholeScript.append(" interactionModel: {},\n");
+ wholeScript.append(" dateWindow: [minDate, maxDate]\n");
+ wholeScript.append(" });\n");
+ } else if (AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("30min")) {
+ wholeScript.append(" if(((maxDate-minDate)/(1000*60*60)) <= 3) { \n");
+ wholeScript.append(" maxDate = new Date(minDate).setMinutes(180);\n");
+ wholeScript.append(" g.updateOptions({\n");
+ wholeScript.append(" interactionModel: {},\n");
+ wholeScript.append(" dateWindow: [minDate, maxDate]\n");
+ wholeScript.append(" });\n");
+ } else if (AppUtils.nvl(reportRuntime.getTimeAxisType()).equals("weekly")) {
+ wholeScript.append(" if(((maxDate-minDate)/(1000*60*60*24)) < 7) { \n");
+ wholeScript.append(" maxDate = new Date(minDate).setMinutes(7*24*60);\n");
+ wholeScript.append(" g.updateOptions({\n");
+ wholeScript.append(" interactionModel: {},\n");
+ wholeScript.append(" dateWindow: [minDate, maxDate]\n");
+ wholeScript.append(" });\n");
+ }
+ wholeScript.append(" } else {\n");
+ wholeScript.append(" g.updateOptions({\n");
+ wholeScript.append(" interactionModel : {\n");
+ wholeScript.append(" 'mousedown' : downV3,\n");
+ wholeScript.append(" 'mousemove' : moveV3,\n");
+ wholeScript.append(" 'mouseup' : upV3,\n");
+ wholeScript.append(" 'click' : clickV3,\n");
+ wholeScript.append(" 'dblclick' : dblClickV3,\n");
+ wholeScript.append(" 'mousewheel' : scrollV3\n");
+ wholeScript.append(" }\n");
+ wholeScript.append(" });\n");
+ wholeScript.append(" } \n");
+ wholeScript.append(" } ,\n");
+ wholeScript.append("dateWindow: ["+minDate+", "+maxDate+"],\n");
+ wholeScript.append("labels: ["+ labelStrBuf +"],\n");
+ wholeScript.append("labelsDiv: \"labelDiv"+reportRuntime.getReportID()+"\",\n");
+ wholeScript.append("labelsShowZeroValues: true,\n");
+ if(AppUtils.nvl(reportRuntime.getLegendPosition()).length()>=0 && reportRuntime.getLegendPosition().equals("right")) {
+ wholeScript.append("labelsSeparateLines: true,\n");
+ }
+ wholeScript.append("labelsDivWidth: 200,\n");
+
+
+ wholeScript.append("animatedZooms: true,\n");
+ wholeScript.append("strokeWidth: 3.0,\n");
+ wholeScript.append("strokeBorderWidth: 2.0,\n");
+
+ /*wholeScript.append(" labelsDivStyles: { \n");
+ wholeScript.append(" 'backgroundColor': 'rgba(200, 200, 255, 0.75)',\n");
+ wholeScript.append(" 'padding': '4px',\n");
+ wholeScript.append(" 'border': '1px solid black',\n");
+ wholeScript.append(" 'borderRadius': '10px',\n");
+ wholeScript.append(" 'boxShadow': '4px 4px 4px #888',\n");
+ wholeScript.append(" 'width': '50px'\n");
+ wholeScript.append("}, \n");
+ */
+ wholeScript.append("visibility: ["+ visibilityStrBuf +"],\n");
+ if(colorsStrBuf.length() > 0 && colorsStrBuf.length()>=(countChartValues*3+5))
+ wholeScript.append("colors: ["+ colorsStrBuf +"],\n");
+
+ wholeScript.append(" legend: 'always', \n");
+ //Yaxis label here
+ wholeScript.append(" ylabel: '"+ chartLeftAxisLabel +"' , \n");
+
+ //Xaxis label here
+ wholeScript.append(" xlabel: '"+ xAxisLabel +"' , \n");
+
+
+ //draw points
+ wholeScript.append(" drawPoints: true, \n");
+
+ //stacked graph
+ wholeScript.append(" stackedGraph: false, \n");
+
+ dct = null;
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ dct = (DataColumnType) iter.next();
+ if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
+ if(!AppUtils.nvl(dct.getDisplayName()).toLowerCase().equals("anomaly_text")) {
+ if(dct.getChartSeq()!=null && dct.getChartSeq() >=0) {
+ wholeScript.append(" '"+ dct.getDisplayName() + "': {\n");
+ if(AppUtils.nvl(dct.getChartLineType()).length()>0)
+ wholeScript.append(" strokePattern: Dygraph.DASHED_LINE,\n");
+ if(dct.isIsRangeAxisFilled()!=null && dct.isIsRangeAxisFilled().booleanValue()) {
+ wholeScript.append(" fillGraph: true\n");
+ }
+ wholeScript.append(" },\n");
+ }
+ }
+ }
+ }
+
+/* //each labels
+ wholeScript.append(" 'Forecast': {\n");
+
+ //if dashed line
+ wholeScript.append(" strokePattern: Dygraph.DASHED_LINE,\n");
+
+ //if fillable
+ wholeScript.append(" fillGraph: true\n");
+
+ // close each labels
+ wholeScript.append(" }\n");
+*/
+ // callback method
+ if(anomalyRec > 0) {
+ wholeScript.append(" drawCallback: function(g, is_initial) { \n");
+ wholeScript.append(" if (is_initial) { \n");
+ wholeScript.append(" graph_initialized = true; \n");
+ wholeScript.append(" if (anns.length > 0) { \n");
+ wholeScript.append(" g.setAnnotations(anns); \n");
+ wholeScript.append(" }\n");
+ wholeScript.append(" }\n");
+
+ wholeScript.append(" var anns1 = g.annotations();\n");
+ //wholeScript.append(" var html = \"\";\n");
+ wholeScript.append(" var html = \"<select id='x' size='1' style='width: "+ widthInt +"px; font-family : courier; font-size:8pt; font-weight:bold;'>\";\n");
+ wholeScript.append(" for (var i = anns1.length-1; i >= 0 ; i--) {\n");
+ wholeScript.append(" var name = nameAnnotation(anns1[i]);\n");
+ //wholeScript.append(" html += \"<span id='\" + name + \"'>\"\n");
+ wholeScript.append(" if(i==anns1.length-1)\n");
+ wholeScript.append(" html += \"<option value='\" + name + \"' selected ><font size=1>\" \n");
+ wholeScript.append(" else \n");
+ wholeScript.append(" html += \"<option value='\" + name + \"'><font size=1>\" \n");
+ wholeScript.append(" html += name \n");
+ //wholeScript.append(" html += name + \": \" + (anns1[i].shortText || '(icon)')\n");
+ //wholeScript.append(" html += \" -> \" + anns1[i].text + \"</span><br/>\";\n");
+ wholeScript.append(" html += \"&nbsp;:&nbsp;\" + anns1[i].text + \"</font></option>\";\n");
+ wholeScript.append(" }\n");
+ wholeScript.append(" html += \"</select>\" \n");
+ wholeScript.append(" document.getElementById(\"list"+reportRuntime.getReportID()+"\").innerHTML = html;\n");
+ wholeScript.append(" }\n");
+
+
+ wholeScript.append(" }\n");
+ wholeScript.append(" )\n");
+
+ //push annotations
+ wholeScript.append(annotationsStrBuf.toString());
+
+ wholeScript.append(" if (graph_initialized) {\n");
+ wholeScript.append(" g.setAnnotations(anns);\n");
+ wholeScript.append(" } \n");
+ //upate handler script
+
+ wholeScript.append(" var saveBg = '';\n");
+ wholeScript.append(" var num = 0;\n");
+ wholeScript.append(" g.updateOptions( {\n");
+ wholeScript.append(" annotationMouseOverHandler: function(ann) { \n");
+ //wholeScript.append(" document.getElementById(nameAnnotation(ann)).style.fontWeight = 'bold';\n");
+ //wholeScript.append(" saveBg = ann.div.style.backgroundColor;\n");
+ //wholeScript.append(" ann.div.style.backgroundColor = '#ddd';\n");
+ wholeScript.append(" var selectobject = document.getElementById(\"x\");\n");
+ wholeScript.append(" for(var i=0; i<selectobject.length;i++) {\n ");
+ wholeScript.append(" if(selectobject.options[i].value == nameAnnotation(ann)) {\n ");
+ wholeScript.append(" selectobject.options[i].selected = true; \n ");
+ wholeScript.append(" } ");
+ wholeScript.append(" } ");
+
+ wholeScript.append(" },\n");
+ wholeScript.append(" annotationMouseOutHandler: function(ann) {\n");
+ //wholeScript.append(" document.getElementById(nameAnnotation(ann)).style.fontWeight = 'normal';\n");
+ wholeScript.append(" ann.div.style.backgroundColor = saveBg;\n");
+ //wholeScript.append(" var selectobject = document.getElementById(\"x\");\n");
+ //wholeScript.append(" for(var i=0; i<selectobject.length;i++) {\n ");
+ //wholeScript.append(" if(selectobject.options[i].value == nameAnnotation(ann)) {\n ");
+ //wholeScript.append(" selectobject.options[i].selected = false; \n ");
+ //wholeScript.append(" } ");
+ //wholeScript.append(" } ");
+
+ wholeScript.append(" }\n");
+ }
+ wholeScript.append(" });\n");
+
+
+ wholeScript.append("} \n");
+ //}
+ wholeScript.append("} else {\n");
+ wholeScript.append("document.getElementById(\"message"+ reportRuntime.getReportID()+"\").display = \"none\";\n");
+ wholeScript.append("document.getElementById(\"labelDiv"+ reportRuntime.getReportID()+"\").display=\"none\";\n");
+ wholeScript.append("document.getElementById(\"div_g"+reportRuntime.getReportID()+"\").display=\"none\";\n");
+
+ wholeScript.append("document.getElementById(\"div_g"+reportRuntime.getReportID()+"\").innerHTML = \"<div id='noData'><b>No Data Available</b></div>\";\n");
+ wholeScript.append("document.getElementById(\"div_g"+reportRuntime.getReportID()+"\").className=\"nodatadiv\";\n");
+ wholeScript.append("document.getElementById(\"nodata\").className=\"nodatainner\";\n");
+ if(!timeCharts)
+ wholeScript.append("document.getElementById(\"list"+reportRuntime.getReportID()+"\").display=\"none\";\n");
+ wholeScript.append("}\n");
+ wholeScript.append(" </script>\n");
+ wholeScript.append(" </body>\n");
+ wholeScript.append("</html>");
+
+
+ } else if (chartType.equals(AppConstants.GT_SCATTER)) {
+
+ wholeScript.append("<link href=\""+ AppUtils.getBaseFolderURL() +"d3/css/nv.d3.css\" rel=\"stylesheet\" type=\"text/css\">\n");
+ wholeScript.append("<style>\n " +
+ " body { \n" +
+ " overflow-y:scroll; \n" +
+ " } \n" +
+ " text { \n" +
+ " font: 12px sans-serif; \n" +
+ " } \n" +
+ " tr.z-row-over > td.z-row-inner, tr.z-row-over > .z-cell {" +
+ " background-color: rgb(255, 255, 255); "+
+ "} "+
+ " svg { display: block; } " +
+ " #chart1 svg { \n" +
+ " height: 420px; \n" +
+ " width: 800px; \n" +
+ " min-width: 100px; \n" +
+ " min-height: 100px; \n" +
+ " } \n" +
+
+ " </style> \n" );
+ wholeScript.append("<body> \n");
+ wholeScript.append("<div id=\"chart1\"><svg></svg></div>");
+ //js files
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/d3.v2.js\"></script>\n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/nv.d3.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/tooltip.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/utils.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/legend.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/axis.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/distribution.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/scatter.js\"></script> \n");
+ wholeScript.append("<script src=\""+ AppUtils.getBaseFolderURL() +"d3/js/models/scatterChart.js\"></script> \n");
+ wholeScript.append("<script> \n");
+ wholeScript.append("nv.addGraph(function() { \n" +
+ " var width1=900, height1=220; \n" +
+ " var chart = nv.models.scatterChart() \n" +
+ " .showDistX(true) \n" +
+ " .showDistY(true) \n" +
+ " .useVoronoi(true) \n" +
+ " .color(d3.scale.category10().range()); \n" +
+/* " .width(width1) \n" +
+ " .height(height1); \n" +
+*/ " chart.xAxis\n" +
+ " .axisLabel('" +legendColumnName + "')\n" +
+ " .tickFormat(d3.format('.02f'));\n" +
+ " chart.yAxis\n" +
+ " .axisLabel('" + chartLeftAxisLabel + "')\n" +
+ " .tickFormat(d3.format('.02f'));\n" +
+ " d3.select('#chart1 svg') \n" +
+ " .datum(getData()) \n" );
+ if(animation)
+ wholeScript.append(" .transition().duration(1200) \n" );
+/* " .attr(\"width\", width1) \n" +
+ " .attr(\"height\", height1) \n" +
+*/ wholeScript.append(" .call(chart); \n" +
+ " nv.utils.windowResize(chart.update);\n"+
+ "return chart; \n" +
+ "}); \n");
+
+ String dateStr = "";
+ Object uniqueElements [] = null;
+ TreeSet ts = new TreeSet();
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ dateStr = ds.getString(i, 2);
+ if(dateStr.length()>0)
+ ts.add(dateStr);
+ }
+ SortedSet s = Collections.synchronizedSortedSet(ts);
+ uniqueElements = s.toArray();
+
+ wholeScript.append(" function getData() { \n " +
+ " var data = [];\n ");
+ for (int i = 0; i < uniqueElements.length; i++) {
+ wholeScript.append(" data.push( {key:'"+ uniqueElements[i]+ "', values:[]})\n");
+ }
+
+
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ for (int k = 0; k < uniqueElements.length; k++) {
+ if(ds.getString(i, 2).equals(uniqueElements[k])) {
+ wholeScript.append("data["+k+"].values.push({x:"+ ds.getString(i, 1) +",y:"+ds.getString(i, 3) + ", size: Math.random() });\n");
+ }
+ }
+ }
+
+ wholeScript.append("return data; } </script></body>\n");
+ } else if (chartType.equals(AppConstants.GT_HIERARCHICAL_SUNBURST)) {
+
+ StringBuffer dataStr = new StringBuffer("");
+ StringBuffer groupBuffer = new StringBuffer("");
+ StringBuffer s = new StringBuffer("");
+ dataStr.append("{");
+ dataStr.append(" \"ss4262\":{\n");
+ String mid = "";
+ String mid_old = "";
+ String level = "-1";
+ String level_old = "-1";
+ String eid = "";
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ mid = ds.getString(i, "mid");
+ level = ds.getString(i, "level1");
+ eid = ds.getString(i, "eid");
+ if(mid.equals(mid_old)) {
+ dataStr.append("\""+ eid +"\": 9956,\n");
+ } else {
+ if(dataStr.lastIndexOf(",")!= -1)
+ dataStr.deleteCharAt(dataStr.lastIndexOf(","));
+ //if(Integer.parseInt(level_old)==Integer.parseInt(level))
+ //dataStr.append("},\n");
+ if (Integer.parseInt(level_old)<Integer.parseInt(level))
+ dataStr.append("},\n");
+ dataStr.append("\""+ mid +"\": { \n");
+ }
+
+ mid_old = mid;
+ level_old = level;
+ }
+ if(dataStr.toString().endsWith(","))
+ dataStr.deleteCharAt(dataStr.lastIndexOf(","));
+ dataStr.append("}\n");
+ dataStr.append("}\n");
+ try {
+ String formattedReportName = new HtmlStripper().stripSpecialCharacters(reportRuntime.getReportName());
+ String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new java.util.Date());
+ String filename=formattedReportName+formattedDate+user_id+".json";
+ String filenamepath = AppUtils.getExcelTemplatePath()+"../../json/"+filename;
+ System.out.println("filenamepath " + filenamepath);
+ BufferedWriter out = new BufferedWriter(new FileWriter(filenamepath));
+ out.write(dataStr.toString());
+ out.close();
+ request.getSession().setAttribute("jsonFileName", filename);
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println("Exception ");
+ }
+ } else if (chartType.equals(AppConstants.GT_HIERARCHICAL)) {
+
+ StringBuffer dataStr = new StringBuffer("");
+ StringBuffer groupBuffer = new StringBuffer("");
+ StringBuffer s = new StringBuffer("");
+ dataStr.append("{");
+ dataStr.append(" \"groups\":[");
+
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ if(ds.getString(i,"group_ind").equals("Y")) {
+ groupBuffer.append(" { \"name\": \""+ ds.getString(i,"ei1") +"\" },\n");
+ }
+
+ }
+ groupBuffer.deleteCharAt(groupBuffer.lastIndexOf(","));
+ dataStr.append(groupBuffer.toString());
+ dataStr.append("],");
+ dataStr.append("\"nodes\":[");
+ int rowCount = ds.getRowCount();
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ s.append("{ \"name\": \""+ ds.getString(i,"ei1") +"\" , \"group\":"+ ds.getString(i,"groups") +", \"level\":2 }");
+ if (i < (rowCount-1)) s.append(",");
+ dataStr.append(s);
+ s = new StringBuffer("");
+ }
+
+ dataStr.append("],");
+ dataStr.append("\"links\":[");
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ s.append("{ \"source\": "+ ds.getString(i,"source") +" , \"target\":"+ ds.getString(i,"target") +", \"value\":2 }");
+ if (i < (rowCount-1)) s.append(",");
+ dataStr.append(s);
+ s = new StringBuffer("");
+ }
+ dataStr.append("]}");
+ try {
+ String formattedReportName = new HtmlStripper().stripSpecialCharacters(reportRuntime.getReportName());
+ String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new java.util.Date());
+ String filename=formattedReportName+formattedDate+user_id+".json";
+ String filenamepath = AppUtils.getExcelTemplatePath()+"../../json/"+filename;
+ System.out.println("filenamepath " + filenamepath);
+ BufferedWriter out = new BufferedWriter(new FileWriter(filenamepath));
+ out.write(dataStr.toString());
+ out.close();
+ request.getSession().setAttribute("jsonFileName", filename);
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println("Exception ");
+ }
+ }
+
+ }
+ }
+ try {
+ BufferedWriter out = new BufferedWriter(new FileWriter("test.txt"));
+ out.write(wholeScript.toString());
+ out.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println("Exception ");
+ }
+ return wholeScript.toString();
+ }
+
+ public String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ public static String nvls(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public static String nvls(String s, String sDefault) {
+ return nvls(s).equals("") ? sDefault : s;
+ }
+
+ public boolean getFlagInBoolean(String s) {
+ return nvl(s).toUpperCase().startsWith("Y") || nvl(s).toLowerCase().equals("true");
+ }
+
+ public DataSet loadChartData(String userId, HttpServletRequest request) throws RaptorException {
+ if (nvl(getChartType()).length() == 0)
+ return null;
+ //TODO: display chart function to be added.
+ //if (!getDisplayChart())
+ // return null;
+
+ String sql = null;
+ sql = generateChartSQL(userId, request);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("SQL generated " + sql));
+ String dbInfo = reportRuntime.getDBInfo();
+ DataSet ds = ConnectionUtils.getDataSet(sql, dbInfo);
+ if(ds.getRowCount()<=0) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("********************************************************************************"));
+ logger.debug(EELFLoggerDelegate.debugLogger, (getChartType().toUpperCase()+" - " + "Report ID : " + reportRuntime.getReportID() + " DATA IS EMPTY" ));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("QUERY - " + sql));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("********************************************************************************"));
+ }
+
+ return ds;
+ } // loadChartData
+
+ public String generateChartSQL(String userId, HttpServletRequest request ) throws RaptorException {
+ List reportCols = reportRuntime.getAllColumns();
+ List chartValueCols = getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, null); // parameter is 0 has this requires all columns.
+ String reportSQL = reportRuntime.getWholeSQL();
+
+ //Add order by clause
+ Pattern re1 = Pattern.compile("(^[\r\n]*|([\\s]))[Oo][Rr][Dd][Ee][Rr](.*?[^\r\n]*)[Bb][Yy]",Pattern.DOTALL);
+ //Pattern re1 = Pattern.compile("order(.*?[^\r\n]*)by", Pattern.DOTALL);
+ Matcher matcher = re1.matcher(reportSQL);
+ //Pattern re1 = Pattern.compile("(^[\r\n]*|([\\s]))[Oo][Rr][Dd][Ee][Rr][Tt](.*?[^\r\n]*)[Bb][Yy]",Pattern.DOTALL);
+ //int startPoint = sql.length()-30;
+
+ reportSQL = reportSQL + " ";
+ reportSQL = Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(reportSQL).replaceAll(" SELECT ");
+ //reportSQL = Pattern.compile("(^[\r\n]*|([\\s]))[Ff][Rr][Oo][Mm]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(reportSQL).replaceAll(" FROM ");
+ reportSQL = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(reportSQL).replaceAll(" WHERE ");
+ reportSQL = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Nn]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(reportSQL).replaceAll(" WHEN ");
+ reportSQL = Pattern.compile("(^[\r\n]*|([\\s]))[Aa][Nn][Dd]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(reportSQL).replaceAll(" AND ");
+
+ if(!reportRuntime.getReportType().equals(AppConstants.RT_HIVE)) {
+ int startPoint = reportSQL.lastIndexOf(" FROM ");
+ if(startPoint <= 0) {
+ startPoint = reportSQL.lastIndexOf(" from ");
+ }
+ if(startPoint <= 0) {
+ startPoint = reportSQL.lastIndexOf("from ");
+ }
+ if(startPoint <= 0) {
+ startPoint = reportSQL.lastIndexOf("FROM ");
+ }
+
+ if (!matcher.find(startPoint)) {
+ reportSQL = reportSQL + " ORDER BY 1" ;
+ }
+ }
+ reportRuntime.setWholeSQL(reportSQL);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, (" *************************************************************************************** "));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("WHOLE_SQL" + reportSQL));
+ logger.debug(EELFLoggerDelegate.debugLogger, (" *************************************************************************************** "));
+
+ if (reportRuntime.getFormFieldList() != null) {
+ for (Iterator iter = reportRuntime.getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ String fieldId = fft.getFieldId();
+ String fieldDisplay = reportRuntime.getFormFieldDisplayName(fft);
+ String formfield_value = "";
+ formfield_value = AppUtils.getRequestNvlValue(request, fieldId);
+ String paramValue = nvl(formfield_value);
+ if(paramValue.length()>0) {
+ /*sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl(
+ paramValue, "NULL"));*/
+ reportSQL = Utils.replaceInString(reportSQL, fieldDisplay, nvl(
+ paramValue, "NULL"));
+ }
+ /*sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl(
+ paramValue, "NULL"));*/
+ reportSQL = Utils.replaceInString(reportSQL, "'" + fieldDisplay + "'", nvl(
+ paramValue, "NULL"));
+ reportSQL = Utils.replaceInString(reportSQL, fieldDisplay , nvl(
+ paramValue, "NULL"));
+ }
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, ("SQL " + reportSQL));
+ String legendCol = "1 a";
+ // String valueCol = "1";
+ StringBuffer groupCol = new StringBuffer();
+ StringBuffer seriesCol = new StringBuffer();
+ StringBuffer valueCols = new StringBuffer();
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, request);
+ if (nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))
+ legendCol = getSelectExpr(dc, colName)+" " + dc.getColId();
+ // if(dc.getChartSeq()>0)
+ // valueCol = "NVL("+colName+", 0) "+dc.getColId();
+ if ((!nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))
+ && (dc.getChartSeq()!=null && dc.getChartSeq().intValue() <= 0) && dc.isGroupBreak()) {
+ groupCol.append(", ");
+ groupCol.append(colName + " " + dc.getColId());
+ }
+ } // for
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if(dc.isChartSeries()!=null && dc.isChartSeries().booleanValue()) {
+ //System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues)));
+ seriesCol.append(", "+ getSelectExpr(dc,getColumnSelectStr(dc, request))+ " " + dc.getColId());
+ }
+ }
+
+ /*for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if(!dc.isChartSeries() && !(nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
+ //System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues)));
+ seriesCol.append(", "+ formatChartColumn(getSelectExpr(dc,getColumnSelectStr(dc, paramValues)))+ " " + dc.getColId());
+ }
+ }*/
+
+ for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, request);
+ String paramValue = "";
+ if(AppUtils.nvl(colName).startsWith("[")) {
+ if (reportRuntime.getFormFieldList() != null) {
+ for (Iterator iterC = reportRuntime.getFormFieldList().getFormField().iterator(); iterC.hasNext();) {
+ FormFieldType fft = (FormFieldType) iterC.next();
+ String fieldId = fft.getFieldId();
+ String fieldDisplay = reportRuntime.getFormFieldDisplayName(fft);
+ String formfield_value = "";
+ if(AppUtils.nvl(fieldDisplay).equals(colName)) {
+ formfield_value = AppUtils.getRequestNvlValue(request, fieldId);
+ paramValue = nvl(formfield_value);
+ }
+ }
+
+ }
+
+ seriesCol.append("," + (AppUtils.nvl(paramValue).length()>0? paramValue:"null") + " " + dc.getColId());
+ } else {
+ //valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId());
+ seriesCol.append("," + (AppUtils.nvl(paramValue).length()>0? paramValue:formatChartColumn(colName)) + " " + dc.getColId());
+ }
+ } // for
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = dc.getDisplayName();
+ String colValue = getColumnSelectStr(dc, request);
+ //String colName = getColumnSelectStr(dc, formGrid);
+ if(colName.equals(AppConstants.RI_CHART_TOTAL_COL))
+ seriesCol.append(", " + AppConstants.RI_CHART_TOTAL_COL + " " + AppConstants.RI_CHART_TOTAL_COL );
+ if (colName.equals(AppConstants.RI_CHART_COLOR))
+ seriesCol.append(", " + colValue + " " + AppConstants.RI_CHART_COLOR );
+ if(colName.equals(AppConstants.RI_CHART_MARKER_START))
+ seriesCol.append(", " + AppConstants.RI_CHART_MARKER_START + " " + AppConstants.RI_CHART_MARKER_START );
+ if(colName.equals(AppConstants.RI_CHART_MARKER_END))
+ seriesCol.append(", " + AppConstants.RI_CHART_MARKER_END + " " + AppConstants.RI_CHART_MARKER_END );
+ if(colName.equals(AppConstants.RI_CHART_MARKER_TEXT_LEFT))
+ seriesCol.append(", " + AppConstants.RI_CHART_MARKER_TEXT_LEFT + " " + AppConstants.RI_CHART_MARKER_TEXT_LEFT );
+ if(colName.equals(AppConstants.RI_CHART_MARKER_TEXT_RIGHT))
+ seriesCol.append(", " + AppConstants.RI_CHART_MARKER_TEXT_RIGHT + " " + AppConstants.RI_CHART_MARKER_TEXT_RIGHT );
+ //if(colName.equals(AppConstants.RI_ANOMALY_TEXT))
+ //seriesCol.append(", " + AppConstants.RI_ANOMALY_TEXT + " " + AppConstants.RI_ANOMALY_TEXT );
+ }
+
+ //debugLogger.debug("ReportSQL Chart " + reportSQL );
+ /*for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, paramValues);
+ //valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId());
+ valueCols.append("," + formatChartColumn(colName) + " " + dc.getColId());
+ } // for
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, paramValues);
+ //if(colName.equals(AppConstants.RI_CHART_TOTAL_COL) || colName.equals(AppConstants.RI_CHART_COLOR)) {
+ if(colName.equals(AppConstants.RI_CHART_TOTAL_COL))
+ valueCols.append(", " + AppConstants.RI_CHART_TOTAL_COL + " " + AppConstants.RI_CHART_TOTAL_COL );
+ if (colName.equals(AppConstants.RI_CHART_COLOR))
+ valueCols.append(", " + AppConstants.RI_CHART_COLOR + " " + AppConstants.RI_CHART_COLOR );
+ if (colName.equals(AppConstants.RI_CHART_INCLUDE))
+ valueCols.append(", " + AppConstants.RI_CHART_INCLUDE + " " + AppConstants.RI_CHART_INCLUDE );
+ //}
+ }*/
+ String final_sql = "";
+ reportSQL = Utils.replaceInString(reportSQL, " from ", " FROM ");
+ reportSQL = Utils.replaceInString(reportSQL, " From ", " FROM ");
+ reportSQL = Utils.replaceInString(reportSQL, " select ", " SELECT ");
+ reportSQL = Utils.replaceInString(reportSQL, " union ", " UNION ");
+ //reportSQL = reportSQL.replaceAll("[\\s]*\\(", "(");
+// if(reportSQL.indexOf("UNION") != -1) {
+// if(reportSQL.indexOf("FROM(")!=-1)
+// final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM(") );
+// else if (reportSQL.indexOf("FROM (")!=-1)
+// final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM (") );
+// //TODO ELSE THROW ERROR
+// }
+// else {
+// final_sql += " "+reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM "));
+// }
+ int pos = 0;
+ int pos_first_select = 0;
+ int pos_dup_select = 0;
+ int pos_prev_select = 0;
+ int pos_last_select = 0;
+ if (reportSQL.indexOf("FROM", pos)!=-1) {
+ pos = reportSQL.indexOf("FROM", pos);
+ pos_dup_select = reportSQL.lastIndexOf("SELECT",pos);
+ pos_first_select = reportSQL.indexOf("SELECT");//,pos);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("pos_select " + pos_first_select + " " + pos_dup_select));
+ if(pos_dup_select > pos_first_select) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("********pos_dup_select ********" + pos_dup_select));
+ //pos_dup_select1 = pos_dup_select;
+ pos_prev_select = pos_first_select;
+ pos_last_select = pos_dup_select;
+ while (pos_last_select > pos_prev_select) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("pos_last , pos_prev " + pos_last_select + " " + pos_prev_select));
+ pos = reportSQL.indexOf("FROM", pos+2);
+ pos_prev_select = pos_last_select;
+ pos_last_select = reportSQL.lastIndexOf("SELECT",pos);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("in WHILE LOOP LAST " + pos_last_select));
+ }
+ }
+
+ }
+ final_sql += " "+reportSQL.substring(pos);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Final SQL " + final_sql));
+ String sql = "SELECT " + legendCol + ", " + legendCol+"_1" + seriesCol.toString()+ nvl(valueCols.toString(), ", 1")
+ + groupCol.toString()
+ + final_sql;
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Final sql in generateChartSQL " +sql));
+
+ return sql;
+ } // generateChartSQL
+
+ private String getColumnSelectStr(DataColumnType dc, HttpServletRequest request) {
+ //String colName = dc.isCalculated() ? dc.getColName()
+ // : ((nvl(dc.getTableId()).length() > 0) ? (dc.getTableId() + "." + dc
+ // .getColName()) : dc.getColName());
+ String colName = dc.getColName();
+ String paramValue = null;
+ //if (dc.isCalculated()) {
+ if (reportRuntime.getFormFieldList() != null) {
+ for (Iterator iter = reportRuntime.getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ String fieldId = fft.getFieldId();
+ String fieldDisplay = reportRuntime.getFormFieldDisplayName(fft);
+ String formfield_value = "";
+ formfield_value = AppUtils.getRequestNvlValue(request, fieldId);
+ paramValue = nvl(formfield_value);
+ if(paramValue.length()>0) {
+ /*sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl(
+ paramValue, "NULL"));*/
+ colName = Utils.replaceInString(colName, "'" + fieldDisplay + "'", "'"+nvl(
+ paramValue, "NULL")+"'");
+ colName = Utils.replaceInString(colName, fieldDisplay, nvl(
+ paramValue, "NULL"));
+ }
+ }
+ return colName;
+ }
+ //}
+ return colName;
+ } // getColumnSelectStr
+
+
+
+ public String getSelectExpr(DataColumnType dct) {
+ // String colName =
+ // dct.isCalculated()?dct.getColName():((nvl(dct.getTableId()).length()>0)?(dct.getTableId()+"."+dct.getColName()):dct.getColName());
+ return getSelectExpr(dct, dct.getColName() /* colName */);
+ } // getSelectExpr
+
+ private String getSelectExpr(DataColumnType dct, String colName) {
+ String colType = dct.getColType();
+ if (colType.equals(AppConstants.CT_CHAR)
+ || ((nvl(dct.getColFormat()).length() == 0) && (!colType
+ .equals(AppConstants.CT_DATE))))
+ return colName;
+ else
+ return "DATE_FORMAT(" + colName + ", '"
+ + nvl(dct.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT) + "')";
+ } // getSelectExpr
+
+ private String formatChartColumn(String colName) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Format Chart Column Input colName " + colName));
+ colName = colName.trim();
+ colName = Utils.replaceInString(colName, "TO_CHAR", "to_char");
+ colName = Utils.replaceInString(colName, "to_number", "TO_NUMBER");
+ //reportSQL = reportSQL.replaceAll("[\\s]*\\(", "(");
+ colName = colName.replaceAll(",[\\s]*\\(", ",(");
+ StringBuffer colNameBuf = new StringBuffer(colName);
+ int pos = 0, posFormatStart = 0, posFormatEnd = 0;
+ String format = "";
+
+ if(colNameBuf.indexOf("999")==-1 && colNameBuf.indexOf("990")==-1) {
+ logger.debug(EELFLoggerDelegate.debugLogger, (" return colName " + colNameBuf.toString()));
+ return colNameBuf.toString();
+ }
+
+ while (colNameBuf.indexOf("to_char")!=-1) {
+ if(colNameBuf.indexOf("999")!=-1 || colNameBuf.indexOf("990")!=-1) {
+ pos = colNameBuf.indexOf("to_char");
+ colNameBuf.insert(pos, " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER (");
+ pos = colNameBuf.indexOf("to_char");
+ colNameBuf.replace(pos, pos+7, "TO_CHAR");
+ //colName = Utils.replaceInString(colNameBuf.toString(), "to_char", " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER ( TO_CHAR ");
+ logger.debug(EELFLoggerDelegate.debugLogger, ("After adding to_number " + colNameBuf.toString()));
+ //posFormatStart = colNameBuf.lastIndexOf(",'")+1;
+ posFormatStart = colNameBuf.indexOf(",'", pos)+1;
+ posFormatEnd = colNameBuf.indexOf(")",posFormatStart);
+ logger.debug(EELFLoggerDelegate.debugLogger, (posFormatStart + " " + posFormatEnd + " "+ pos));
+ format = colNameBuf.substring(posFormatStart, posFormatEnd);
+ //posFormatEnd = colNameBuf.indexOf(")",posFormatEnd);
+ colNameBuf.insert(posFormatEnd+1, " ," + format + ") , "+ format + ")");
+ logger.debug(EELFLoggerDelegate.debugLogger, ("colNameBuf " + colNameBuf.toString()));
+ }
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, (" return colName " + colNameBuf.toString()));
+ return colNameBuf.toString();
+ }
+
+ public List getChartValueColumnsList( int filter, HashMap formValues) { /*filter; all=0;create without new chart =1; createNewChart=2 */
+ List reportCols = reportRuntime.getAllColumns();
+
+ ArrayList chartValueCols = new ArrayList();
+ int flag = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ flag = 0;
+ DataColumnType dc = (DataColumnType) iter.next();
+// if(filter == 2 || filter == 1) {
+ flag = reportRuntime.getDependsOnFormFieldFlag(dc, formValues);
+
+ if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0 && !(nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
+ if(nvl(dc.getChartGroup()).length()<=0) {
+ if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue())) {
+ chartValueCols.add(dc);
+ } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) {
+ chartValueCols.add(dc);
+ }
+ else if(filter == 0) chartValueCols.add(dc);
+ } else chartValueCols.add(dc);
+ }
+// } else
+// chartValueCols.add(dc);
+ } // for
+ Collections.sort(chartValueCols, new ChartSeqComparator());
+ return chartValueCols;
+ } // getChartValueColumnsList
+
+ public String parseTitle(String title, HashMap formValues) {
+ Set set = formValues.entrySet();
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry<String,String>) iter.next();
+ if(title.indexOf("["+ entry.getKey() + "]")!= -1) {
+ title = Utils.replaceInString(title, "["+entry.getKey()+"]", nvl(
+ (String) entry.getValue(), ""));
+ }
+ }
+ return title;
+ }
+
+ public java.util.Date getDateFromDateStr(String dateStr) {
+ SimpleDateFormat MMDDYYYYFormat = new SimpleDateFormat("MM/dd/yyyy");
+ SimpleDateFormat EEEMMDDYYYYFormat = new SimpleDateFormat("EEE, MM/dd/yyyy"); //2012-11-01 00:00:00
+ SimpleDateFormat YYYYMMDDFormat = new SimpleDateFormat("yyyy/MM/dd");
+ SimpleDateFormat MONYYYYFormat = new SimpleDateFormat("MMM yyyy");
+ SimpleDateFormat MMYYYYFormat = new SimpleDateFormat("MM/yyyy");
+ SimpleDateFormat MMMMMDDYYYYFormat = new SimpleDateFormat("MMMMM dd, yyyy");
+ SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ SimpleDateFormat timestampHrFormat = new SimpleDateFormat("yyyy-MM-dd HH");
+ SimpleDateFormat timestampDayFormat = new SimpleDateFormat("yyyy-MM-dd");
+ SimpleDateFormat DDMONYYYYFormat = new SimpleDateFormat("dd-MMM-yyyy");
+ SimpleDateFormat MONTHYYYYFormat = new SimpleDateFormat("MMMMM, yyyy");
+ SimpleDateFormat MMDDYYYYHHFormat = new SimpleDateFormat("MM/dd/yyyy HH");
+ SimpleDateFormat MMDDYYYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+ SimpleDateFormat MMDDYYYYHHMMFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");
+ SimpleDateFormat YYYYMMDDHHMMSSFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+ SimpleDateFormat YYYYMMDDHHMMFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");
+ SimpleDateFormat DDMONYYYYHHMMSSFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
+ SimpleDateFormat DDMONYYYYHHMMFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm");
+ SimpleDateFormat MMDDYYFormat = new SimpleDateFormat("MM/dd/yy");
+ SimpleDateFormat MMDDYYHHMMFormat = new SimpleDateFormat("MM/dd/yy HH:mm");
+ SimpleDateFormat MMDDYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
+ SimpleDateFormat timestampFormat1 = new SimpleDateFormat("yyyy-M-d.HH.mm. s. S");
+ SimpleDateFormat timestamp_W_dash = new SimpleDateFormat("yyyyMMddHHmmss");
+ SimpleDateFormat MMDDYYYYHHMMZFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm z");
+ SimpleDateFormat YYYYFormat = new SimpleDateFormat("yyyy");
+ java.util.Date date = null;
+
+ int formatFlag = 0;
+
+ final int YEARFLAG = 1;
+ final int MONTHFLAG = 2;
+ final int DAYFLAG = 3;
+ final int HOURFLAG = 4;
+ final int MINFLAG = 5;
+ final int SECFLAG = 6;
+ final int MILLISECFLAG = 7;
+ final int DAYOFTHEWEEKFLAG = 8;
+ final int FLAGDATE = 9;
+ /*int yearFlag = 1;
+ int monthFlag = 2;
+ int dayFlag = 3;
+ int hourFlag = 4;
+ int minFlag = 5;
+ int secFlag = 6;
+ int milliSecFlag = 7;
+ int dayoftheweekFlag = 8;
+ int flagDate = 10;
+ */
+
+ date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ if(date==null) {
+ date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYOFTHEWEEKFLAG;
+ }
+ if(date==null) {
+ date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+ if(date==null) {
+ //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = HOURFLAG;
+ }
+ if(date==null) {
+ date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = timestampFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+ if(date==null) {
+ date = timestampHrFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = HOURFLAG;
+ }
+ if(date==null) {
+ date = timestampDayFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+
+ if(date==null) {
+ date = MONYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MONTHFLAG;
+ }
+ if(date==null) {
+ date = MMYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MONTHFLAG;
+ }
+ if(date==null) {
+ date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MONTHFLAG;
+ }
+
+ if(date==null) {
+ date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+
+ if(date==null) {
+ date = timestampFormat1.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = YYYYFormat.parse(dateStr, new ParsePosition(0));
+ /* Some random numbers should not satisfy this year format. */
+ if(dateStr.length()>4) date = null;
+ if(date!=null) formatFlag = YEARFLAG;
+ }
+ if(date==null) {
+ date = timestamp_W_dash.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+ if(date==null)
+ date = null;
+ return date;
+ }
+
+ public int getFlagFromDateStr(String dateStr) {
+ SimpleDateFormat MMDDYYYYFormat = new SimpleDateFormat("MM/dd/yyyy");
+ SimpleDateFormat EEEMMDDYYYYFormat = new SimpleDateFormat("EEE, MM/dd/yyyy"); //2012-11-01 00:00:00
+ SimpleDateFormat YYYYMMDDFormat = new SimpleDateFormat("yyyy/MM/dd");
+ SimpleDateFormat MONYYYYFormat = new SimpleDateFormat("MMM yyyy");
+ SimpleDateFormat MMYYYYFormat = new SimpleDateFormat("MM/yyyy");
+ SimpleDateFormat MMMMMDDYYYYFormat = new SimpleDateFormat("MMMMM dd, yyyy");
+ SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ SimpleDateFormat timestampHrFormat = new SimpleDateFormat("yyyy-MM-dd HH");
+ SimpleDateFormat timestampDayFormat = new SimpleDateFormat("yyyy-MM-dd");
+ SimpleDateFormat DDMONYYYYFormat = new SimpleDateFormat("dd-MMM-yyyy");
+ SimpleDateFormat MONTHYYYYFormat = new SimpleDateFormat("MMMMM, yyyy");
+ SimpleDateFormat MMDDYYYYHHFormat = new SimpleDateFormat("MM/dd/yyyy HH");
+ SimpleDateFormat MMDDYYYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+ SimpleDateFormat MMDDYYYYHHMMFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");
+ SimpleDateFormat YYYYMMDDHHMMSSFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+ SimpleDateFormat YYYYMMDDHHMMFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");
+ SimpleDateFormat DDMONYYYYHHMMSSFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
+ SimpleDateFormat DDMONYYYYHHMMFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm");
+ SimpleDateFormat MMDDYYFormat = new SimpleDateFormat("MM/dd/yy");
+ SimpleDateFormat MMDDYYHHMMFormat = new SimpleDateFormat("MM/dd/yy HH:mm");
+ SimpleDateFormat MMDDYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
+ SimpleDateFormat timestampFormat1 = new SimpleDateFormat("yyyy-M-d.HH.mm. s. S");
+ SimpleDateFormat timestamp_W_dash = new SimpleDateFormat("yyyyMMddHHmmss");
+ SimpleDateFormat MMDDYYYYHHMMZFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm z");
+ SimpleDateFormat YYYYFormat = new SimpleDateFormat("yyyy");
+ java.util.Date date = null;
+
+ int formatFlag = 0;
+
+ final int YEARFLAG = 1;
+ final int MONTHFLAG = 2;
+ final int DAYFLAG = 3;
+ final int HOURFLAG = 4;
+ final int MINFLAG = 5;
+ final int SECFLAG = 6;
+ final int MILLISECFLAG = 7;
+ final int DAYOFTHEWEEKFLAG = 8;
+ final int FLAGDATE = 9;
+ /*int yearFlag = 1;
+ int monthFlag = 2;
+ int dayFlag = 3;
+ int hourFlag = 4;
+ int minFlag = 5;
+ int secFlag = 6;
+ int milliSecFlag = 7;
+ int dayoftheweekFlag = 8;
+ int flagDate = 10;
+ */
+
+ date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ if(date==null) {
+ date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYOFTHEWEEKFLAG;
+ }
+ if(date==null) {
+ date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+ if(date==null) {
+ //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = HOURFLAG;
+ }
+ if(date==null) {
+ date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = timestampFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+ if(date==null) {
+ date = timestampHrFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = HOURFLAG;
+ }
+ if(date==null) {
+ date = timestampDayFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = MONYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MONTHFLAG;
+ }
+ if(date==null) {
+ date = MMYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MONTHFLAG;
+ }
+ if(date==null) {
+ date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MONTHFLAG;
+ }
+
+ if(date==null) {
+ date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+
+ if(date==null) {
+ date = timestampFormat1.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = YYYYFormat.parse(dateStr, new ParsePosition(0));
+ /* Some random numbers should not satisfy this year format. */
+ if(dateStr.length()>4) date = null;
+ if(date!=null) formatFlag = YEARFLAG;
+ }
+ if(date==null) {
+ date = timestamp_W_dash.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+ if(date==null)
+ date = null;
+ return formatFlag;
+ }
+
+ public static String[] reverse(String[] arr) {
+ List<String> list = Arrays.asList(arr);
+ Collections.reverse(list);
+ return (String[])list.toArray();
+ }
+
+ public int getNumberOfDecimalPlaces(double num) {
+ Double d = num;
+ String[] splitter = d.toString().split("\\.");
+ splitter[0].length(); // Before Decimal Count
+ splitter[1].length(); // After Decimal Count
+ return splitter[1].length();
+ }
+
+ public boolean getBooleanValue(String s) {
+ return getBooleanValue(s,null);
+ }
+
+ public boolean getBooleanValue(String s, Boolean defaultValue) {
+ s = nvl(s);
+ if(s.length()<=0 && defaultValue!=null) return defaultValue.booleanValue();
+ else if(s.length()<=0) return false;
+ else {
+ if(s.toUpperCase().startsWith("Y") || s.toLowerCase().equals("true"))
+ return true;
+ else
+ return false;
+ }
+ }
+
+
+ public String IntToLetter(int Int) {
+ if (Int<27){
+ return Character.toString((char)(Int+96));
+ } else {
+ if (Int%26==0) {
+ return IntToLetter((Int/26)-1)+IntToLetter((Int%26)+1);
+ } else {
+ return IntToLetter(Int/26)+IntToLetter(Int%26);
+ }
+ }
+ }
+
+
+
+
+ private void clearReportRuntimeBackup(HttpServletRequest request) {
+ //Session sess = Sessions.getCurrent(true)getCurrent();
+ //HttpSession session = (HttpSession)sess.getNativeSession();
+ HttpSession session = request.getSession();
+ session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ request.removeAttribute(AppConstants.DRILLDOWN_INDEX);
+ session.removeAttribute(AppConstants.DRILLDOWN_INDEX);
+ request.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX);
+ session.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX);
+ Enumeration<String> enum1 = session.getAttributeNames();
+ String attributeName = "";
+ while(enum1.hasMoreElements()) {
+ attributeName = enum1.nextElement();
+ if(attributeName.startsWith("parent_")) {
+ session.removeAttribute(attributeName);
+ }
+ }
+ session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ session.removeAttribute(AppConstants.SI_BACKUP_FOR_REP_ID);
+ session.removeAttribute(AppConstants.SI_COLUMN_LOOKUP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REP_ID);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP);
+ session.removeAttribute(AppConstants.SI_DATA_SIZE_FOR_TEXTFIELD_POPUP);
+ session.removeAttribute(AppConstants.SI_MAP);
+ session.removeAttribute(AppConstants.SI_MAP_OBJECT);
+ session.removeAttribute(AppConstants.SI_REPORT_DEFINITION);
+ session.removeAttribute(AppConstants.SI_REPORT_RUNTIME);
+ session.removeAttribute(AppConstants.SI_REPORT_RUN_BACKUP);
+ session.removeAttribute(AppConstants.SI_REPORT_SCHEDULE);
+ session.removeAttribute(AppConstants.RI_REPORT_DATA);
+ session.removeAttribute(AppConstants.RI_CHART_DATA);
+ session.removeAttribute(AppConstants.SI_FORMFIELD_INFO);
+ session.removeAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO);
+
+ } // clearReportRuntimeBackup
+
+
+ public static synchronized java.util.HashMap getRequestParametersMap(ReportRuntime rr, HttpServletRequest request)
+ {
+ HashMap valuesMap = new HashMap();
+
+ ReportFormFields rff = rr.getReportFormFields();
+
+ int idx = 0;
+ FormField ff = null;
+
+ Map fieldNameMap = new HashMap();
+ int countOfFields = 0 ;
+
+
+ for(rff.resetNext(); rff.hasNext(); idx++) {
+ ff = rff.getNext();
+ fieldNameMap.put(ff.getFieldName(), ff.getFieldDisplayName());
+ countOfFields++;
+ }
+
+ List formParameter = new ArrayList();
+ String formField = "";
+ for(int i = 0 ; i < rff.size(); i++) {
+ ff = ((FormField)rff.getFormField(i));
+ formField = ff.getFieldName();
+ boolean isMultiValue = false;
+ isMultiValue = ff.getFieldType().equals(FormField.FFT_CHECK_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI);
+ boolean isTextArea = (ff.getFieldType().equals(FormField.FFT_TEXTAREA) && rr.getReportDefType()
+ .equals(AppConstants.RD_SQL_BASED));
+
+ if(request.getParameterValues(formField) != null && isMultiValue ) {
+ String[] vals = request.getParameterValues(formField);
+ StringBuffer value = new StringBuffer("");
+ if(!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_ACTION)) {
+
+ if ( isMultiValue ) {
+ value.append("(");
+ }
+ for(int j = 0 ; j < vals.length; j++) {
+ if(isMultiValue) value.append("'");
+ try {
+ if(vals[j] !=null && vals[j].length() > 0) {
+ vals[j] = Utils.oracleSafe(vals[j]);
+ value.append(java.net.URLDecoder.decode(vals[j], "UTF-8"));// + ",";
+ }
+ else
+ value.append(vals[j]);
+ } catch (UnsupportedEncodingException ex) {value.append(vals[j]);}
+ catch (IllegalArgumentException ex1){value.append(vals[j]);}
+ catch (Exception ex2){
+ value.append(vals[j]);
+ }
+
+
+ if(isMultiValue) value.append("'");
+
+ if(j != vals.length -1) {
+ value.append(",");
+ }
+ }
+ if(vals.length > 0) {
+ value.append(")");
+ }
+ }
+
+ //value = value.substring(0 , value.length());
+
+ valuesMap.put(fieldNameMap.get(formField), value.toString());
+ value = new StringBuffer("");
+ } else if(request.getParameter(formField) != null) {
+ if(isTextArea) {
+ String value = "";
+ value = request.getParameter(formField);
+
+ value = Utils.oracleSafe(value);
+ value = "('" + Utils.replaceInString(value, ",", "'|'") + "')";
+ value = Utils.replaceInString(value, "|", ",");
+ valuesMap.put(fieldNameMap.get(formField), value);
+ value = "";
+ } else {
+ String value = "";
+ if(!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_ACTION))
+ value = request.getParameter(formField);
+ valuesMap.put(fieldNameMap.get(formField), Utils.oracleSafe(value));
+ }
+
+ } else {
+ valuesMap.put(fieldNameMap.get(formField), "" );
+ }
+
+ }
+
+ return valuesMap;
+
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartGen.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartGen.java
new file mode 100644
index 00000000..c395000e
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartGen.java
@@ -0,0 +1,73 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Log;
+
+public class ChartGen extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ public static String generateChart(String chartType, HttpSession session, DataSet ds,
+ String xText, String yLabelLeftAxis, String yLabelRightAxis, List yTextSeries,
+ List yTextColor, List yTextSeriesAxis, String groupText, String chartTitle,
+ PrintWriter pw,List columnValuesList, boolean hasCategoryAxis, boolean isMultiSeries,
+ List allColumnsList, String downloadFileName, boolean totalOnlyChart, int deviceType, HashMap additionalChartOptionsMap) {
+ return generateChart(chartType, session, ds, xText, yLabelLeftAxis, yLabelRightAxis,
+ yTextSeries, yTextColor, yTextSeriesAxis, groupText, chartTitle, pw, Globals
+ .getDefaultChartWidth(), Globals.getDefaultChartHeight(), columnValuesList, hasCategoryAxis, isMultiSeries, allColumnsList, downloadFileName,totalOnlyChart, deviceType, additionalChartOptionsMap);
+ } // generateChart
+
+ public static String generateChart(String chartType, HttpSession session, DataSet ds,
+ String xText, String yLabelLeftAxis, String yLabelRightAxis, List yTextSeries,
+ List yTextColor, List yTextSeriesAxis, String groupText, String chartTitle,
+ PrintWriter pw, int width, int height, List columnValuesList, boolean hasCategoryAxis, boolean isMultiSeries,
+ List allColumnsList, String downloadFileName,boolean totalOnlyChart, int deviceType, HashMap additionalChartOptionsMap) {
+ try {
+ Class chartGenClass = null;
+
+
+ Class[] argumentTypes = { String.class, HttpSession.class, DataSet.class,
+ String.class, String.class, String.class, List.class, List.class,
+ List.class, String.class, String.class, PrintWriter.class, int.class,
+ int.class, List.class, boolean.class, boolean.class, List.class,
+ String.class, boolean.class, int.class, HashMap.class };
+
+ Method method = chartGenClass.getMethod("generateChart", argumentTypes);
+ Object[] arguments = { chartType, session, ds, xText, yLabelLeftAxis,
+ yLabelRightAxis, yTextSeries, yTextColor, yTextSeriesAxis, groupText,
+ chartTitle, pw, new Integer(width), new Integer(height), columnValuesList, new Boolean(hasCategoryAxis), new Boolean(isMultiSeries), allColumnsList, downloadFileName, new Boolean(totalOnlyChart), new Integer(deviceType), additionalChartOptionsMap };
+
+ return (String) method.invoke(chartGenClass, arguments);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Log.write("ERROR [ChartGen.generateChart] " + e.getMessage());
+ return null;
+ }
+ } // generateChart
+
+} // ChartGen
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSON.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSON.java
new file mode 100644
index 00000000..85f8dc8a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSON.java
@@ -0,0 +1,448 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import java.util.ArrayList;
+
+class Row {
+ private String displayValue;
+ private String dataType;
+ private String colId;
+ //private boolean visible;
+
+
+ /*public boolean isVisible() {
+ return visible;
+ }
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }*/
+ public String getDisplayValue() {
+ return displayValue;
+ }
+ public void setDisplayValue(String displayValue) {
+ this.displayValue = displayValue;
+ }
+ public String getDataType() {
+ return dataType;
+ }
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+ public String getColId() {
+ return colId;
+ }
+ public void setColId(String colId) {
+ this.colId = colId;
+ }
+
+
+}
+class IndexValueJSON {
+ private int index;
+ private String value;
+ private String title;
+ public int getIndex() {
+ return index;
+ }
+ public void setIndex(int index) {
+ this.index = index;
+ }
+ public String getValue() {
+ return value;
+ }
+ public void setValue(String value) {
+ this.value = value;
+ }
+ public String getTitle() {
+ return title;
+ }
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+}
+
+class DomainAxisJSON extends IndexValueJSON {}
+
+class ChartColumnJSON extends IndexValueJSON {}
+
+class ChartTypeJSON extends IndexValueJSON {}
+
+class PieChartOptions {
+
+}
+
+public class ChartJSON {
+
+ private String reportID;
+ private String reportName;
+ private String reportDescr;
+ private String reportTitle;
+ private String reportSubTitle;
+ private ArrayList <FormFieldJSON> formFieldList;
+ private ArrayList <ChartColumnJSON> chartColumnJSONList;
+ private String formfield_comments;
+ private int totalRows;
+ private String chartSqlWhole;
+ private boolean chartAvailable;
+ private ChartTypeJSON chartTypeJSON;
+ private BarChartOptions barChartOptions;
+ private PieChartOptions pieChartOptions;
+ private TimeSeriesChartOptions timeSeriesChartOptions;
+ private FlexTimeSeriesChartOptions flexTimeSeriesChartOptions;
+ private CommonChartOptions commonChartOptions;
+ private String width;
+ private String height;
+ private boolean animation;
+ private String rotateLabels;
+ private boolean staggerLabels;
+ private boolean showTitle;
+ private DomainAxisJSON domainAxisJSON;
+ private CategoryAxisJSON categoryAxisJSON;
+ private boolean hasCategoryAxis;
+
+
+ public boolean isHasCategoryAxis() {
+ return hasCategoryAxis;
+ }
+ public void setHasCategoryAxis(boolean hasCategoryAxis) {
+ this.hasCategoryAxis = hasCategoryAxis;
+ }
+ private ArrayList <RangeAxisJSON> rangeAxisList;
+ private ArrayList <ArrayList<Row>> wholeList;
+
+ private String primaryAxisLabel;
+ private String secondaryAxisLabel;
+ private String minRange;
+ private String maxRange;
+ //private int topMargin;
+ //private int bottomMargin;
+ //private int leftMargin;
+ //private int rightMargin;
+
+ /*private boolean showMaxMin;
+ private boolean showLegend;
+ private boolean showControls;
+ private String topMargin;
+ private String bottomMargin;
+ private String leftMargin;
+ private String rightMargin;
+ private String subType;
+ private boolean stacked;
+ private boolean horizontalBar;
+ private boolean barRealTimeAxis;
+ private boolean barReduceXAxisLabels;
+ private boolean timeAxis;*/
+
+ public String getReportID() {
+ return reportID;
+ }
+ public void setReportID(String reportID) {
+ this.reportID = reportID;
+ }
+ public String getReportName() {
+ return reportName;
+ }
+ public void setReportName(String reportName) {
+ this.reportName = reportName;
+ }
+ public String getReportDescr() {
+ return reportDescr;
+ }
+ public void setReportDescr(String reportDescr) {
+ this.reportDescr = reportDescr;
+ }
+ public String getReportTitle() {
+ return reportTitle;
+ }
+ public void setReportTitle(String reportTitle) {
+ this.reportTitle = reportTitle;
+ }
+ public String getReportSubTitle() {
+ return reportSubTitle;
+ }
+ public void setReportSubTitle(String reportSubTitle) {
+ this.reportSubTitle = reportSubTitle;
+ }
+ public ArrayList<FormFieldJSON> getFormFieldList() {
+ return formFieldList;
+ }
+ public void setFormFieldList(ArrayList<FormFieldJSON> formFieldList) {
+ this.formFieldList = formFieldList;
+ }
+ public String getFormfield_comments() {
+ return formfield_comments;
+ }
+ public void setFormfield_comments(String formfield_comments) {
+ this.formfield_comments = formfield_comments;
+ }
+ public int getTotalRows() {
+ return totalRows;
+ }
+ public void setTotalRows(int totalRows) {
+ this.totalRows = totalRows;
+ }
+ public String getChartSqlWhole() {
+ return chartSqlWhole;
+ }
+ public void setChartSqlWhole(String chartSqlWhole) {
+ this.chartSqlWhole = chartSqlWhole;
+ }
+ public boolean isChartAvailable() {
+ return chartAvailable;
+ }
+ public void setChartAvailable(boolean chartAvailable) {
+ this.chartAvailable = chartAvailable;
+ }
+ public String getWidth() {
+ return width;
+ }
+ public void setWidth(String width) {
+ this.width = width;
+ }
+ public String getHeight() {
+ return height;
+ }
+ public void setHeight(String height) {
+ this.height = height;
+ }
+ public boolean isAnimation() {
+ return animation;
+ }
+ public void setAnimation(boolean animation) {
+ this.animation = animation;
+ }
+ public String getRotateLabels() {
+ return rotateLabels;
+ }
+ public void setRotateLabels(String rotateLabels) {
+ this.rotateLabels = rotateLabels;
+ }
+ public boolean isStaggerLabels() {
+ return staggerLabels;
+ }
+ public void setStaggerLabels(boolean staggerLabels) {
+ this.staggerLabels = staggerLabels;
+ }
+ public boolean isShowTitle() {
+ return showTitle;
+ }
+ public void setShowTitle(boolean showTitle) {
+ this.showTitle = showTitle;
+ }
+ /*public boolean isShowMaxMin() {
+ return showMaxMin;
+ }
+ public void setShowMaxMin(boolean showMaxMin) {
+ this.showMaxMin = showMaxMin;
+ }
+ public boolean isShowLegend() {
+ return showLegend;
+ }
+ public void setShowLegend(boolean showLegend) {
+ this.showLegend = showLegend;
+ }
+ public boolean isShowControls() {
+ return showControls;
+ }
+ public void setShowControls(boolean showControls) {
+ this.showControls = showControls;
+ }
+ public String getTopMargin() {
+ return topMargin;
+ }
+ public void setTopMargin(String topMargin) {
+ this.topMargin = topMargin;
+ }
+ public String getBottomMargin() {
+ return bottomMargin;
+ }
+ public void setBottomMargin(String bottomMargin) {
+ this.bottomMargin = bottomMargin;
+ }
+ public String getLeftMargin() {
+ return leftMargin;
+ }
+ public void setLeftMargin(String leftMargin) {
+ this.leftMargin = leftMargin;
+ }
+ public String getRightMargin() {
+ return rightMargin;
+ }
+ public void setRightMargin(String rightMargin) {
+ this.rightMargin = rightMargin;
+ }
+
+ public String getSubType() {
+ return subType;
+ }
+ public void setSubType(String subType) {
+ this.subType = subType;
+ }
+ public boolean isStacked() {
+ return stacked;
+ }
+ public void setStacked(boolean stacked) {
+ this.stacked = stacked;
+ }
+ public boolean isHorizontalBar() {
+ return horizontalBar;
+ }
+ public void setHorizontalBar(boolean horizontalBar) {
+ this.horizontalBar = horizontalBar;
+ }
+ public boolean isBarRealTimeAxis() {
+ return barRealTimeAxis;
+ }
+ public void setBarRealTimeAxis(boolean barRealTimeAxis) {
+ this.barRealTimeAxis = barRealTimeAxis;
+ }
+ public boolean isBarReduceXAxisLabels() {
+ return barReduceXAxisLabels;
+ }
+ public void setBarReduceXAxisLabels(boolean barReduceXAxisLabels) {
+ this.barReduceXAxisLabels = barReduceXAxisLabels;
+ }
+ public boolean isTimeAxis() {
+ return timeAxis;
+ }
+ public void setTimeAxis(boolean timeAxis) {
+ this.timeAxis = timeAxis;
+ }*/
+ public ChartTypeJSON getChartTypeJSON() {
+ return chartTypeJSON;
+ }
+ public void setChartTypeJSON(ChartTypeJSON chartTypeJSON) {
+ this.chartTypeJSON = chartTypeJSON;
+ }
+ public String getChartType() {
+ return chartTypeJSON.getValue();
+ }
+ public DomainAxisJSON getDomainAxisJSON() {
+ return domainAxisJSON;
+ }
+ public void setDomainAxisJSON(DomainAxisJSON domainAxisJSON) {
+ this.domainAxisJSON = domainAxisJSON;
+ }
+ public CategoryAxisJSON getCategoryAxisJSON() {
+ return categoryAxisJSON;
+ }
+ public void setCategoryAxisJSON(CategoryAxisJSON categoryAxisJSON) {
+ this.categoryAxisJSON = categoryAxisJSON;
+ }
+ public ArrayList<RangeAxisJSON> getRangeAxisList() {
+ return rangeAxisList;
+ }
+ public void setRangeAxisList(ArrayList<RangeAxisJSON> rangeAxisList) {
+ this.rangeAxisList = rangeAxisList;
+ }
+ public String getPrimaryAxisLabel() {
+ return primaryAxisLabel;
+ }
+ public void setPrimaryAxisLabel(String primaryAxisLabel) {
+ this.primaryAxisLabel = primaryAxisLabel;
+ }
+ public String getSecondaryAxisLabel() {
+ return secondaryAxisLabel;
+ }
+ public void setSecondaryAxisLabel(String secondaryAxisLabel) {
+ this.secondaryAxisLabel = secondaryAxisLabel;
+ }
+ public String getMinRange() {
+ return minRange;
+ }
+ public void setMinRange(String minRange) {
+ this.minRange = minRange;
+ }
+ public String getMaxRange() {
+ return maxRange;
+ }
+ public void setMaxRange(String maxRange) {
+ this.maxRange = maxRange;
+ }
+ /*public ArrayList<Row> getRowList() {
+ return rowList;
+ }
+ public void setRowList(ArrayList<Row> rowList) {
+ this.rowList = rowList;
+ }*/
+
+ public ArrayList<ArrayList<Row>> getWholeList() {
+ return wholeList;
+ }
+ public void setWholeList(ArrayList<ArrayList<Row>> wholeList) {
+ this.wholeList = wholeList;
+ }
+ //private ArrayList<ColumnHeader> reportDataColumns;
+ //private ArrayList<Map<String,Object>> reportDataRows;
+ public ArrayList<ChartColumnJSON> getChartColumnJSONList() {
+ return chartColumnJSONList;
+ }
+ public void setChartColumnJSONList(ArrayList<ChartColumnJSON> chartColumnJSONList) {
+ this.chartColumnJSONList = chartColumnJSONList;
+ }
+
+ public BarChartOptions getBarChartOptions() {
+ return barChartOptions;
+ }
+ public void setBarChartOptions(BarChartOptions barChartOptions) {
+ this.barChartOptions = barChartOptions;
+ }
+ public PieChartOptions getPieChartOptions() {
+ return pieChartOptions;
+ }
+ public void setPieChartOptions(PieChartOptions pieChartOptions) {
+ this.pieChartOptions = pieChartOptions;
+ }
+ public TimeSeriesChartOptions getTimeSeriesChartOptions() {
+ return timeSeriesChartOptions;
+ }
+ public void setTimeSeriesChartOptions(TimeSeriesChartOptions timeSeriesChartOptions) {
+ this.timeSeriesChartOptions = timeSeriesChartOptions;
+ }
+ public FlexTimeSeriesChartOptions getFlexTimeSeriesChartOptions() {
+ return flexTimeSeriesChartOptions;
+ }
+ public void setFlexTimeSeriesChartOptions(FlexTimeSeriesChartOptions flexTimeSeriesChartOptions) {
+ this.flexTimeSeriesChartOptions = flexTimeSeriesChartOptions;
+ }
+ public CommonChartOptions getCommonChartOptions() {
+ return commonChartOptions;
+ }
+ public void setCommonChartOptions(CommonChartOptions commonChartOptions) {
+ this.commonChartOptions = commonChartOptions;
+ }
+
+ public String getDomainAxis() {
+ if(getDomainAxisJSON() !=null)
+ return getDomainAxisJSON().getValue();
+ else
+ return "";
+ }
+
+ public String getCategoryAxis() {
+ if(getCategoryAxisJSON()!=null)
+ return getCategoryAxisJSON().getValue();
+ else
+ return "";
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSONHelper.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSONHelper.java
new file mode 100644
index 00000000..d08626c1
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSONHelper.java
@@ -0,0 +1,1550 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import java.io.UnsupportedEncodingException;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.model.ReportHandler;
+import org.openecomp.portalsdk.analytics.model.base.ChartSeqComparator;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+
+
+public class ChartJSONHelper {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ChartJSONHelper.class);
+
+ private ReportRuntime reportRuntime;
+ private String chartType;
+
+ public static final long HOUR = 3600*1000;
+ public static final long DAY = 3600*1000*24;
+ public static final long MONTH = 3600*1000*24*31;
+ public static final long YEAR = 3600*1000*24*365;
+
+
+ public ChartJSONHelper() {
+
+ }
+
+ /**
+ * @return the chartType
+ */
+ public String getChartType() {
+ return chartType;
+ }
+
+ /**
+ * @param chartType the chartType to set
+ */
+ public void setChartType(String chartType) {
+ this.chartType = chartType;
+ }
+
+ public ChartJSONHelper(ReportRuntime rr) {
+ this.reportRuntime = rr;
+ }
+
+ public String generateJSON(String reportID, HttpServletRequest request, boolean showData) throws RaptorException {
+ //From annotations chart
+ clearReportRuntimeBackup(request);
+
+ //HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
+ final Long user_id = new Long((long) UserUtils.getUserId(request));
+ //String action = request.getParameter(AppConstants.RI_ACTION);
+ //String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+
+ ReportHandler rh = new ReportHandler();
+ //ReportData reportData = null;
+ HashMap<String, String> chartOptionsMap = new HashMap<String, String>();
+ try {
+ if(reportID !=null) {
+ reportRuntime = rh.loadReportRuntime(request, reportID, true, 1);
+ setChartType(reportRuntime.getChartType());
+ //reportData = reportRuntime.loadReportData(0, user_id.toString(), 10000,request, false);
+ }
+
+
+
+ String rotateLabelsStr = "";
+ rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle());
+ if(rotateLabelsStr.toLowerCase().equals("standard")) {
+ rotateLabelsStr = "0";
+ } else if (rotateLabelsStr.toLowerCase().equals("up45")) {
+ rotateLabelsStr = "45";
+ } else if (rotateLabelsStr.toLowerCase().equals("down45")) {
+ rotateLabelsStr = "-45";
+ } else if (rotateLabelsStr.toLowerCase().equals("up90")) {
+ rotateLabelsStr = "90";
+ } else if (rotateLabelsStr.toLowerCase().equals("down90")) {
+ rotateLabelsStr = "-90";
+ } else
+ rotateLabelsStr = "0";
+
+ String width = (AppUtils.getRequestNvlValue(request, "width").length()>0?AppUtils.getRequestNvlValue(request, "width"):(AppUtils.nvl(reportRuntime.getChartWidth()).length()>0?reportRuntime.getChartWidth():"700"));
+ String height = (AppUtils.getRequestNvlValue(request, "height").length()>0?AppUtils.getRequestNvlValue(request, "height"):(AppUtils.nvl(reportRuntime.getChartHeight()).length()>0?reportRuntime.getChartHeight():"300"));
+ String animationStr = (AppUtils.getRequestNvlValue(request, "animation").length()>0?AppUtils.getRequestNvlValue(request, "animation"):new Boolean(reportRuntime.isAnimateAnimatedChart()).toString());
+
+ String rotateLabels = (AppUtils.getRequestNvlValue(request, "rotateLabels").length()>0?AppUtils.getRequestNvlValue(request, "rotateLabels"):(rotateLabelsStr.length()>0?rotateLabelsStr:"0"));
+ String staggerLabelsStr = (AppUtils.getRequestNvlValue(request, "staggerLabels").length()>0?AppUtils.getRequestNvlValue(request, "staggerLabels"):"false");
+ String showMaxMinStr = (AppUtils.getRequestNvlValue(request, "showMaxMin").length()>0?AppUtils.getRequestNvlValue(request, "showMaxMin"):"false");
+ String showControlsStr = (AppUtils.getRequestNvlValue(request, "showControls").length()>0?AppUtils.getRequestNvlValue(request, "showControls"):new Boolean(reportRuntime.displayBarControls()).toString());
+ String showLegendStr = (AppUtils.getRequestNvlValue(request, "showLegend").length()>0?AppUtils.getRequestNvlValue(request, "showLegend"):new Boolean(!new Boolean(reportRuntime.hideChartLegend())).toString());
+ String topMarginStr = AppUtils.getRequestNvlValue(request, "topMargin");
+ String topMargin = (AppUtils.nvl(topMarginStr).length()<=0)?(reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30"):topMarginStr;
+ String bottomMarginStr = AppUtils.getRequestNvlValue(request, "bottomMargin");
+ String bottomMargin = (AppUtils.nvl(bottomMarginStr).length()<=0)?(reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50"):bottomMarginStr;
+ String leftMarginStr = AppUtils.getRequestNvlValue(request, "leftMargin");
+ String leftMargin = (AppUtils.nvl(leftMarginStr).length()<=0)?(reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100"):leftMarginStr;
+ String rightMarginStr = AppUtils.getRequestNvlValue(request, "rightMargin");
+ String rightMargin = (AppUtils.nvl(rightMarginStr).length()<=0)?(reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160"):rightMarginStr;
+ String showTitleStr = (AppUtils.getRequestNvlValue(request, "showTitle").length()>0?AppUtils.getRequestNvlValue(request, "showTitle"):new Boolean(reportRuntime.displayChartTitle()).toString());
+ String subType = AppUtils.getRequestNvlValue(request, "subType").length()>0?AppUtils.getRequestNvlValue(request, "subType"):(AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():"");
+ String stackedStr = AppUtils.getRequestNvlValue(request, "stacked").length()>0?AppUtils.getRequestNvlValue(request, "stacked"):new Boolean(reportRuntime.isChartStacked()).toString();
+ String horizontalBar = AppUtils.getRequestNvlValue(request, "horizontalBar").length()>0?AppUtils.getRequestNvlValue(request, "horizontalBar"):new Boolean(reportRuntime.isHorizontalOrientation()).toString();
+ String barRealTimeAxis = AppUtils.getRequestNvlValue(request, "barRealTimeAxis");
+ String barReduceXAxisLabels = AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels").length()>0?AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels"):new Boolean(reportRuntime.isLessXaxisTickers()).toString();;
+ String timeAxis = AppUtils.getRequestNvlValue(request, "timeAxis").length()>0?AppUtils.getRequestNvlValue(request, "timeAxis"):new Boolean(reportRuntime.isTimeAxis()).toString();
+ String logScale = AppUtils.getRequestNvlValue(request, "logScale").length()>0?AppUtils.getRequestNvlValue(request, "logScale"):new Boolean(reportRuntime.isLogScale()).toString();
+ String precision = AppUtils.getRequestNvlValue(request, "precision").length()>0?AppUtils.getRequestNvlValue(request, "precision"):"2";
+
+
+ chartOptionsMap.put("width", width);
+ chartOptionsMap.put("height", height);
+ chartOptionsMap.put("animation", animationStr);
+ chartOptionsMap.put("rotateLabels", rotateLabels);
+ chartOptionsMap.put("staggerLabels", staggerLabelsStr);
+ chartOptionsMap.put("showMaxMin", showMaxMinStr);
+ chartOptionsMap.put("showControls", showControlsStr);
+ chartOptionsMap.put("showLegend", showLegendStr);
+ chartOptionsMap.put("topMargin", topMargin);
+ chartOptionsMap.put("bottomMargin", bottomMargin);
+ chartOptionsMap.put("leftMargin", leftMargin);
+ chartOptionsMap.put("rightMargin", rightMargin);
+ chartOptionsMap.put("showTitle", showTitleStr);
+ chartOptionsMap.put("subType", subType);
+ chartOptionsMap.put("stacked", stackedStr);
+ chartOptionsMap.put("horizontalBar", horizontalBar);
+ chartOptionsMap.put("timeAxis", timeAxis);
+ chartOptionsMap.put("barRealTimeAxis", barRealTimeAxis);
+ chartOptionsMap.put("barReduceXAxisLabels", barReduceXAxisLabels);
+
+ chartOptionsMap.put("logScale", logScale);
+ chartOptionsMap.put("precision", precision);
+
+
+ } catch (RaptorException ex) {
+ ex.printStackTrace();
+ }
+ return generateJSON(reportRuntime, chartOptionsMap, request, showData);
+ }
+
+ public String generateJSON(ReportRuntime reportRuntime, HttpServletRequest request, boolean showData) throws RaptorException {
+
+ String rotateLabelsStr = "";
+ rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle());
+ if(rotateLabelsStr.toLowerCase().equals("standard")) {
+ rotateLabelsStr = "0";
+ } else if (rotateLabelsStr.toLowerCase().equals("up45")) {
+ rotateLabelsStr = "45";
+ } else if (rotateLabelsStr.toLowerCase().equals("down45")) {
+ rotateLabelsStr = "-45";
+ } else if (rotateLabelsStr.toLowerCase().equals("up90")) {
+ rotateLabelsStr = "90";
+ } else if (rotateLabelsStr.toLowerCase().equals("down90")) {
+ rotateLabelsStr = "-90";
+ } else
+ rotateLabelsStr = "0";
+
+ HashMap<String,String> chartOptionsMap = new HashMap<String, String>();
+ chartOptionsMap.put("width", reportRuntime.getChartWidth());
+ chartOptionsMap.put("height", reportRuntime.getChartHeight());
+ chartOptionsMap.put("animation", new Boolean(reportRuntime.isAnimateAnimatedChart()).toString());
+ chartOptionsMap.put("rotateLabels", rotateLabelsStr);
+ chartOptionsMap.put("staggerLabels", "false");
+ chartOptionsMap.put("showMaxMin", "false");
+ chartOptionsMap.put("showControls", new Boolean(reportRuntime.displayBarControls()).toString());
+ chartOptionsMap.put("showLegend", new Boolean(!reportRuntime.hideChartLegend()).toString());
+ chartOptionsMap.put("topMargin", reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30");
+ chartOptionsMap.put("bottomMargin", reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50");
+ chartOptionsMap.put("leftMargin", reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100");
+ chartOptionsMap.put("rightMargin", reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160");
+ chartOptionsMap.put("showTitle", new Boolean(reportRuntime.displayChartTitle()).toString());
+ chartOptionsMap.put("subType", (AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():""));
+ chartOptionsMap.put("stacked", new Boolean(reportRuntime.isChartStacked()).toString());
+ chartOptionsMap.put("horizontalBar", new Boolean(reportRuntime.isHorizontalOrientation()).toString());
+ chartOptionsMap.put("timeAxis", new Boolean(reportRuntime.isTimeAxis()).toString());
+ chartOptionsMap.put("barReduceXAxisLabels", new Boolean(reportRuntime.isLessXaxisTickers()).toString());
+
+ chartOptionsMap.put("logScale", new Boolean(reportRuntime.isLogScale()).toString());
+ chartOptionsMap.put("precision", "2");
+
+
+
+ return generateJSON(reportRuntime, chartOptionsMap, request, showData);
+ }
+
+ public String generateJSON(ReportRuntime reportRuntime, HashMap<String,String> chartOptionsMap, HttpServletRequest request, boolean showData) throws RaptorException {
+
+ //String width, String height, boolean animation, String rotateLabels, boolean staggerLabels, boolean showMaxMin, boolean showLegend, boolean showControls, String topMargin, String bottomMargin, boolean showTitle, String subType
+ String userId = AppUtils.getUserID(request);
+ String width = chartOptionsMap.get("width");
+ String height = chartOptionsMap.get("height");
+ boolean animation = getBooleanValue(chartOptionsMap.get("animation"), true);
+ String rotateLabels = chartOptionsMap.get("rotateLabels");
+ boolean staggerLabels = getBooleanValue(chartOptionsMap.get("staggerLabels"));
+ boolean showMaxMin = getBooleanValue(chartOptionsMap.get("showMaxMin"), false);
+ boolean showLegend = getBooleanValue(chartOptionsMap.get("showLegend"), true);
+ boolean showControls = getBooleanValue(chartOptionsMap.get("showControls"), true);
+ String topMargin = chartOptionsMap.get("topMargin");
+ String bottomMargin = chartOptionsMap.get("bottomMargin");
+ String leftMargin = chartOptionsMap.get("leftMargin");
+ String rightMargin = chartOptionsMap.get("rightMargin");
+ boolean showTitle = getBooleanValue(chartOptionsMap.get("showTitle"), true);
+ String subType = chartOptionsMap.get("subType");
+ boolean stacked = getBooleanValue(chartOptionsMap.get("stacked"), false);
+ boolean horizontalBar = getBooleanValue(chartOptionsMap.get("horizontalBar"), false);
+ boolean barRealTimeAxis = getBooleanValue(chartOptionsMap.get("barRealTimeAxis"), true);
+ boolean barReduceXAxisLabels= getBooleanValue(chartOptionsMap.get("barReduceXAxisLabels"), false);
+ boolean timeAxis = getBooleanValue(chartOptionsMap.get("timeAxis"), true);
+
+
+ boolean logScale = getBooleanValue(chartOptionsMap.get("logScale"), false);
+
+ int precision = 2;
+
+ try {
+ precision = Integer.parseInt(chartOptionsMap.get("precision"));
+ } catch (NumberFormatException ex) {
+
+ }
+
+ final Long user_id = new Long((long) UserUtils.getUserId(request));
+
+ HttpSession session = null;
+ session = request.getSession();
+ String chartType = reportRuntime.getChartType();
+ List l = reportRuntime.getAllColumns();
+ List lGroups = reportRuntime.getAllChartGroups();
+ HashMap mapYAxis = reportRuntime.getAllChartYAxis(reportRuntime.getReportParamValues());
+ //ReportParamValues reportParamValues = reportRuntime.getReportParamValues();
+ String chartLeftAxisLabel = reportRuntime.getFormFieldFilled(nvl(reportRuntime.getChartLeftAxisLabel()));
+ String chartRightAxisLabel = reportRuntime.getFormFieldFilled(nvl(reportRuntime.getChartRightAxisLabel()));
+
+ boolean multipleSeries = reportRuntime.isMultiSeries();
+
+ java.util.HashMap formValues = null;
+ formValues = getRequestParametersMap(reportRuntime, request);
+
+
+ String legendColumnName = (reportRuntime.getChartLegendColumn()!=null)?reportRuntime.getChartLegendColumn().getDisplayName():"Legend Column";
+ boolean displayChart = reportRuntime.getDisplayChart();
+ HashMap additionalChartOptionsMap = new HashMap();
+
+ StringBuffer wholeScript = new StringBuffer("");
+
+ String title = reportRuntime.getReportTitle();
+
+ title = parseTitle(title, formValues);
+ ObjectMapper mapper = new ObjectMapper();
+ ChartJSON chartJSON = new ChartJSON();
+ String sql = "";
+ if(displayChart) {
+ DataSet ds = null;
+ if(showData) {
+
+ try {
+ if (!(chartType.equals(AppConstants.GT_HIERARCHICAL) || chartType.equals(AppConstants.GT_HIERARCHICAL_SUNBURST) || chartType.equals(AppConstants.GT_ANNOTATION_CHART))) {
+ sql = generateChartSQL(userId, request );
+ ds = (DataSet) loadChartData(new Long(user_id).toString(), request);
+ } else if(chartType.equals(AppConstants.GT_ANNOTATION_CHART)) {
+ sql = reportRuntime.getWholeSQL();
+ String reportSQL = reportRuntime.getWholeSQL();
+ String dbInfo = reportRuntime.getDBInfo();
+ ds = ConnectionUtils.getDataSet(reportSQL, dbInfo);
+ if(ds.getRowCount()<=0) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("********************************************************************************"));
+ logger.info(EELFLoggerDelegate.debugLogger, (chartType.toUpperCase()+" - " + "Report ID : " + reportRuntime.getReportID() + " DATA IS EMPTY" ));
+ logger.info(EELFLoggerDelegate.debugLogger, ("QUERY - " + reportSQL));
+ logger.info(EELFLoggerDelegate.debugLogger, ("********************************************************************************"));
+ }
+ } else if(chartType.equals(AppConstants.GT_HIERARCHICAL)||chartType.equals(AppConstants.GT_HIERARCHICAL_SUNBURST)) {
+ sql = reportRuntime.getWholeSQL();
+ String reportSQL = reportRuntime.getWholeSQL();
+ String dbInfo = reportRuntime.getDBInfo();
+ ds = ConnectionUtils.getDataSet(reportSQL, dbInfo);
+ }
+ } catch (RaptorException ex) {
+ //throw new RaptorException("Error while loading chart data", ex);
+ logger.error(EELFLoggerDelegate.debugLogger, ("********************************************************************************"));
+ logger.error(EELFLoggerDelegate.debugLogger, (chartType.toUpperCase()+" - " + "Report ID : " + reportRuntime.getReportID() + " ERROR THROWN FOR GIVEN QUERY "));
+ logger.error(EELFLoggerDelegate.debugLogger, ("QUERY - " + reportRuntime.getWholeSQL()));
+ logger.error(EELFLoggerDelegate.debugLogger, ("ERROR STACK TRACE" + ex.getMessage()));
+ logger.error(EELFLoggerDelegate.debugLogger, ("********************************************************************************"));
+
+ }
+ if(ds==null) {
+ //displayChart = false;
+ if(chartType.equals(AppConstants.GT_ANNOTATION_CHART))
+ ds = new DataSet();
+ else
+ displayChart = false;
+ }
+ }
+ if(displayChart) {
+
+ chartJSON.setReportID(reportRuntime.getReportID());
+ chartJSON.setReportName(reportRuntime.getReportName());
+ chartJSON.setReportDescr(reportRuntime.getReportDescr());
+ chartJSON.setReportTitle(reportRuntime.getReportTitle());
+ chartJSON.setReportSubTitle(reportRuntime.getReportSubTitle());
+
+ List<DataColumnType> dcList = reportRuntime.getOnlyVisibleColumns();
+ int countIndex = 0;
+ ArrayList<ChartColumnJSON> chartColumnJSONList = new ArrayList<ChartColumnJSON>();
+ for(Iterator iter = dcList.iterator(); iter.hasNext(); ) {
+ ChartColumnJSON ccJSON = new ChartColumnJSON();
+ DataColumnType dc = (DataColumnType) iter.next();
+ ccJSON.setIndex(countIndex);
+ ccJSON.setValue(dc.getColId());
+ ccJSON.setTitle(dc.getDisplayName());
+ countIndex++;
+ chartColumnJSONList.add(ccJSON);
+ }
+ chartJSON.setChartColumnJSONList(chartColumnJSONList);
+ /* setting formfields show only showForm got triggered*/
+ /*ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>();
+ ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<FormFieldJSON>();
+ if(reportRuntime.getReportFormFields()!=null) {
+ formFieldJSONList = new ArrayList<FormFieldJSON>(reportRuntime.getReportFormFields().size());
+ for (Iterator iter = reportRuntime.getReportFormFields().iterator(); iter.hasNext();) {
+ formFieldValues = new ArrayList<IdNameValue>();
+ FormField ff = (FormField) iter.next();
+ ff.setDbInfo(reportRuntime.getDbInfo());
+ FormFieldJSON ffJSON = new FormFieldJSON();
+ ffJSON.setFieldId(ff.getFieldName());
+ ffJSON.setFieldType(ff.getFieldType());
+ ffJSON.setFieldDisplayName(ff.getFieldDisplayName());
+ ffJSON.setHelpText(ff.getHelpText());
+ ffJSON.setValidationType(ff.getValidationType());
+ //ffJSON.setTriggerOtherFormFields(ff.getDependsOn());
+ IdNameList lookup = null;
+ lookup = ff.getLookupList();
+ String selectedValue = "";
+ String oldSQL = "";
+ IdNameList lookupList = null;
+ boolean readOnly = false;
+ if(lookup!=null) {
+ if(!ff.hasPredefinedList) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ oldSQL = lu.getSql();
+ reportRuntime.setTriggerFormFieldCheck( reportRuntime.getReportFormFields(), ff);
+ ffJSON.setTriggerOtherFormFields(ff.isTriggerOtherFormFields());
+ SQL = reportRuntime.parseAndFillReq_Session_UserValues(request, SQL, userId);
+ SQL = reportRuntime.parseAndFillWithCurrentValues(request, SQL, ff);
+ String defaultSQL = lu.getDefaultSQL();
+ defaultSQL = reportRuntime.parseAndFillReq_Session_UserValues(request, defaultSQL, userId);
+ defaultSQL = reportRuntime.parseAndFillWithCurrentValues(request, SQL, ff);
+ lookup = new IdNameSql(-1,SQL,defaultSQL);
+
+ lookupList = lookup;
+ try {
+ lookup.loadUserData(0, "", ff.getDbInfo(), ff.getUserId());
+ } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e);
+ }
+ }
+ lookup.trimToSize();
+
+ String[] requestValue = request.getParameterValues(ff.getFieldName());
+
+ if(lookup != null && lookup.size() > 0) {
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ readOnly = value.isReadOnly();
+ if(requestValue != null && Arrays.asList(requestValue).contains(value.getId())) {
+ //if(value.getId().equals(requestValue))
+ value.setDefaultValue(true);
+ }
+ if(!(ff.getFieldType().equals(FormField.FFT_CHECK_BOX) || ff.getFieldType().equals(FormField.FFT_COMBO_BOX) || ff.getFieldType().equals(FormField.FFT_LIST_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI)) && value.isDefaultValue())
+ formFieldValues.add(value);
+ else if(ff.getFieldType().equals(FormField.FFT_CHECK_BOX) || ff.getFieldType().equals(FormField.FFT_COMBO_BOX) || ff.getFieldType().equals(FormField.FFT_LIST_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI)) {
+ formFieldValues.add(value);
+ }
+ //break;
+ }
+ } else {
+ if(requestValue!=null && requestValue.length>0) {
+ IdNameValue value = new IdNameValue(requestValue[0], requestValue[0], true, false);
+ formFieldValues.add(value);
+ }
+ }
+
+ } else {
+ String[] requestValue = request.getParameterValues(ff.getFieldName());
+ if(requestValue!=null && requestValue.length>0) {
+ IdNameValue value = new IdNameValue(requestValue[0], requestValue[0], true, false);
+ formFieldValues.add(value);
+ }
+ }
+ if(!ff.hasPredefinedList) {
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ }
+
+
+
+ ffJSON.setFormFieldValues(formFieldValues);
+ formFieldJSONList.add(ffJSON);
+ } // for
+ }
+ chartJSON.setFormFieldList(formFieldJSONList);
+ chartJSON.setChartSqlWhole(sql);*/
+ chartJSON.setChartAvailable(displayChart);
+
+ ChartTypeJSON chartTypeJSON = new ChartTypeJSON();
+ chartTypeJSON.setIndex(0);
+ chartTypeJSON.setTitle("");
+ chartTypeJSON.setValue(chartType);
+ chartJSON.setChartTypeJSON(chartTypeJSON);
+ chartJSON.setWidth(width);
+ chartJSON.setHeight(height);
+ chartJSON.setAnimation(animation);
+ chartJSON.setRotateLabels(rotateLabels);
+ chartJSON.setStaggerLabels(staggerLabels);
+ chartJSON.setShowTitle(showTitle);
+ DomainAxisJSON domainAxisJSON = new DomainAxisJSON();
+ domainAxisJSON.setIndex(0);
+ if(reportRuntime.getChartLegendColumn()!=null)
+ domainAxisJSON.setTitle(reportRuntime.getChartLegendColumn().getDisplayName());
+ else
+ domainAxisJSON.setTitle("");
+ if(reportRuntime.getChartLegendColumn()!=null)
+ domainAxisJSON.setValue(reportRuntime.getChartLegendColumn().getColId());
+ else
+ domainAxisJSON.setValue("");
+ chartJSON.setDomainAxisJSON(domainAxisJSON);
+
+
+ List<DataColumnType> reportCols = reportRuntime.getAllColumns();
+ boolean hasSeriesColumn = false;
+ //ArrayList<Item>
+ for (Iterator<DataColumnType> iter = reportCols.iterator(); iter
+ .hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if(dct.isChartSeries()!=null && dct.isChartSeries().booleanValue()) {
+ chartJSON.setHasCategoryAxis(true);
+ CategoryAxisJSON categoryAxisJSON = new CategoryAxisJSON();
+ categoryAxisJSON.setIndex(0);
+ categoryAxisJSON.setTitle(dct.getDisplayName());
+ categoryAxisJSON.setValue(dct.getColId());
+ chartJSON.setCategoryAxisJSON(categoryAxisJSON);
+ }
+ //allColumns
+ //.add(new Item(dct.getColId(), dct.getDisplayName()));
+ }
+ //chartJSON.setCategoryAxis(categoryAxis);
+ //chartJSON.set
+
+ List<DataColumnType> chartValueCols = reportRuntime.getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, null);
+ DataColumnType dct_RangeAxis = null;
+ //int noChart = 0;
+ //if(chartValueCols.size()<=0) {
+ //chartValueCols.addAll(reportCols);
+ //noChart = 1;
+ //}
+ if(chartValueCols.size() <= 0) {
+ chartValueCols = reportCols;
+ }
+ ArrayList<RangeAxisJSON> rangeAxisJSONList = new ArrayList<RangeAxisJSON>();
+ for (int k = 0; k < chartValueCols.size(); k++) {
+ dct_RangeAxis = chartValueCols.get(k);
+ RangeAxisJSON rangeAxisJSON = new RangeAxisJSON();
+
+ RangeAxisLabelJSON rangeAxisLabelJSON = new RangeAxisLabelJSON();
+ rangeAxisLabelJSON.setIndex(0);
+ rangeAxisLabelJSON.setTitle(dct_RangeAxis.getDisplayName());
+ rangeAxisLabelJSON.setValue(dct_RangeAxis.getColId());
+ rangeAxisJSON.setRangeAxisLabelJSON(rangeAxisLabelJSON);
+ RangeLineTypeJSON rangeLineTypeJSON = new RangeLineTypeJSON();
+ rangeLineTypeJSON.setIndex(0);
+ rangeLineTypeJSON.setTitle("");
+ rangeLineTypeJSON.setValue(dct_RangeAxis.getChartLineType());
+ rangeAxisJSON.setRangeLineTypeJSON(rangeLineTypeJSON);
+
+ RangeColorJSON rangeColorJSON = new RangeColorJSON();
+ rangeColorJSON.setIndex(0);
+ rangeColorJSON.setTitle("");
+ rangeColorJSON.setValue(dct_RangeAxis.getChartColor());
+ rangeAxisJSON.setRangeColorJSON(rangeColorJSON);
+ String chartGroup = "";
+ chartGroup = AppUtils.nvl(dct_RangeAxis.getChartGroup());
+ if(chartGroup.indexOf("|")!=-1)
+ chartGroup = chartGroup.substring(0, chartGroup.indexOf("|"));
+
+
+ rangeAxisJSON.setRangeChartGroup(chartGroup);
+ String yAxis = "";
+ yAxis = AppUtils.nvl(dct_RangeAxis.getYAxis());
+ if(yAxis.indexOf("|")!=-1)
+ yAxis = yAxis.substring(0, yAxis.indexOf("|"));
+
+ rangeAxisJSON.setRangeYAxis(yAxis);
+ rangeAxisJSON.setShowAsArea((dct_RangeAxis.isIsRangeAxisFilled()!=null && dct_RangeAxis.isIsRangeAxisFilled().booleanValue())?true:false);
+ rangeAxisJSONList.add(rangeAxisJSON);
+ }
+ CommonChartOptions commonChartOptions = new CommonChartOptions();
+ commonChartOptions.setLegendPosition(AppUtils.nvl(reportRuntime.getLegendPosition()).length()>0?reportRuntime.getLegendPosition().toLowerCase():"top");
+ String legendLabelAngle = "";
+ legendLabelAngle = reportRuntime.getLegendLabelAngle().toLowerCase();
+ commonChartOptions.setLegendLabelAngle(AppUtils.nvl(legendLabelAngle).length()>0?legendLabelAngle:"up45");
+ commonChartOptions.setHideLegend(reportRuntime.hideChartLegend());
+ commonChartOptions.setAnimateAnimatedChart(reportRuntime.isAnimateAnimatedChart());
+ commonChartOptions.setTopMargin(reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin():new Integer("30"));
+ commonChartOptions.setBottomMargin(reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin():new Integer("50"));
+ commonChartOptions.setLeftMargin(reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin():new Integer("100"));
+ commonChartOptions.setRightMargin(reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin():new Integer("60"));
+ chartJSON.setCommonChartOptions(commonChartOptions);
+
+ if(chartType.equals(AppConstants.GT_BAR_3D)) {
+ BarChartOptions barChartOptions = new BarChartOptions();
+ barChartOptions.setDisplayBarControls(reportRuntime.displayBarControls()?true:false);
+ barChartOptions.setMinimizeXAxisTickers(reportRuntime.isLessXaxisTickers()?true:false);
+ barChartOptions.setStackedChart(reportRuntime.isChartStacked()?true:false);
+ barChartOptions.setTimeAxis(reportRuntime.isTimeAxis()?true:false);
+ barChartOptions.setVerticalOrientation(reportRuntime.isVerticalOrientation()?true:false);
+ barChartOptions.setxAxisDateType(reportRuntime.isXAxisDateType()?true:false);
+ barChartOptions.setyAxisLogScale(reportRuntime.isLogScale()?true:false);
+ chartJSON.setBarChartOptions(barChartOptions);
+ chartJSON.setTimeSeriesChartOptions(null);
+ chartJSON.setPieChartOptions(null);
+ chartJSON.setFlexTimeSeriesChartOptions(null);
+
+ } else if(chartType.equals(AppConstants.GT_TIME_SERIES)) {
+ TimeSeriesChartOptions timeSeriesChartOptions = new TimeSeriesChartOptions();
+ timeSeriesChartOptions.setAddXAxisTicker(reportRuntime.isAddXAxisTickers());
+ timeSeriesChartOptions.setLineChartRenderer(AppUtils.nvl(reportRuntime.getTimeSeriesRender()).length()>0?reportRuntime.getTimeSeriesRender():"line");
+ timeSeriesChartOptions.setMultiSeries(reportRuntime.isMultiSeries());
+ timeSeriesChartOptions.setNonTimeAxis(reportRuntime.isTimeAxis());
+ timeSeriesChartOptions.setShowXAxisLabel(reportRuntime.isShowXaxisLabel());
+ chartJSON.setBarChartOptions(null);
+ chartJSON.setTimeSeriesChartOptions(timeSeriesChartOptions);
+ chartJSON.setPieChartOptions(null);
+ chartJSON.setFlexTimeSeriesChartOptions(null);
+ } else if(chartType.equals(AppConstants.GT_ANNOTATION_CHART) || chartType.equals(AppConstants.GT_FLEX_TIME_CHARTS)) {
+ FlexTimeSeriesChartOptions flexTimeSeriesChartOptions = new FlexTimeSeriesChartOptions();
+ flexTimeSeriesChartOptions.setZoomIn(reportRuntime.getZoomIn()!=null?reportRuntime.getZoomIn():new Integer("25"));
+ String timeAxisTypeStr = "";
+ timeAxisTypeStr = reportRuntime.getTimeAxisType().toLowerCase();
+ flexTimeSeriesChartOptions.setTimeAxisType(timeAxisTypeStr);
+ chartJSON.setBarChartOptions(null);
+ chartJSON.setTimeSeriesChartOptions(null);
+ chartJSON.setPieChartOptions(null);
+ chartJSON.setFlexTimeSeriesChartOptions(flexTimeSeriesChartOptions);
+ }
+ chartJSON.setRangeAxisList(rangeAxisJSONList);
+ chartJSON.setPrimaryAxisLabel(reportRuntime.getChartLeftAxisLabel());
+ chartJSON.setSecondaryAxisLabel(reportRuntime.getChartRightAxisLabel());
+ chartJSON.setMinRange(reportRuntime.getRangeAxisLowerLimit());
+ chartJSON.setMaxRange(reportRuntime.getRangeAxisUpperLimit());
+
+ if(showData) {
+ ArrayList<ArrayList<Row>> wholeList = new ArrayList<ArrayList<Row>>();
+
+ ArrayList<Row> rowList = new ArrayList<Row>();
+ if(showData) {
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ rowList = new ArrayList<Row>();
+ for (int j = 0; j<ds.getColumnCount(); j++) {
+ Row row = new Row();
+ row.setColId(ds.getColumnName(j));
+ row.setDisplayValue(ds.getString(i, j));
+ row.setDataType(ds.getColumnType(j));
+ rowList.add(row);
+ }
+ wholeList.add(rowList);
+
+ }
+
+ chartJSON.setWholeList(wholeList);
+ }
+ }
+
+
+
+
+
+ }
+ } else {
+ // chart is not visible
+ chartJSON.setReportID(reportRuntime.getReportID());
+ chartJSON.setReportName(reportRuntime.getReportName());
+ chartJSON.setReportDescr(reportRuntime.getReportDescr());
+ chartJSON.setReportTitle(reportRuntime.getReportTitle());
+ chartJSON.setReportSubTitle(reportRuntime.getReportSubTitle());
+ chartJSON.setChartAvailable(displayChart);
+ ChartTypeJSON chartTypeJSON = new ChartTypeJSON();
+ chartTypeJSON.setIndex(0);
+ chartTypeJSON.setTitle("");
+ chartTypeJSON.setValue(chartType);
+ chartJSON.setChartTypeJSON(chartTypeJSON);
+ }
+ //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
+ //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String jsonInString = "";
+ try {
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(chartJSON);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+
+ }
+
+ return jsonInString;
+ }
+
+ public String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ public static String nvls(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public static String nvls(String s, String sDefault) {
+ return nvls(s).equals("") ? sDefault : s;
+ }
+
+ public boolean getFlagInBoolean(String s) {
+ return nvl(s).toUpperCase().startsWith("Y") || nvl(s).toLowerCase().equals("true");
+ }
+
+ public DataSet loadChartData(String userId, HttpServletRequest request) throws RaptorException {
+ if (nvl(getChartType()).length() == 0)
+ return null;
+ //TODO: display chart function to be added.
+ //if (!getDisplayChart())
+ // return null;
+
+ String sql = null;
+ sql = generateChartSQL(userId, request);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("SQL generated " + sql));
+ String dbInfo = reportRuntime.getDBInfo();
+ DataSet ds = ConnectionUtils.getDataSet(sql, dbInfo);
+ if(ds.getRowCount()<=0) {
+ logger.info(EELFLoggerDelegate.debugLogger, ("********************************************************************************"));
+ logger.info(EELFLoggerDelegate.debugLogger, (getChartType().toUpperCase()+" - " + "Report ID : " + reportRuntime.getReportID() + " DATA IS EMPTY"));
+ logger.info(EELFLoggerDelegate.debugLogger, ("QUERY - " + sql));
+ logger.info(EELFLoggerDelegate.debugLogger, ("********************************************************************************"));
+ }
+
+ return ds;
+ } // loadChartData
+
+ public String generateChartSQL(String userId, HttpServletRequest request ) throws RaptorException {
+ List reportCols = reportRuntime.getAllColumns();
+ List chartValueCols = getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, null); // parameter is 0 has this requires all columns.
+ String reportSQL = reportRuntime.getWholeSQL();
+
+ //Add order by clause
+ Pattern re1 = Pattern.compile("(^[\r\n]*|([\\s]))[Oo][Rr][Dd][Ee][Rr](.*?[^\r\n]*)[Bb][Yy]",Pattern.DOTALL);
+ //Pattern re1 = Pattern.compile("order(.*?[^\r\n]*)by", Pattern.DOTALL);
+ Matcher matcher = re1.matcher(reportSQL);
+ //Pattern re1 = Pattern.compile("(^[\r\n]*|([\\s]))[Oo][Rr][Dd][Ee][Rr][Tt](.*?[^\r\n]*)[Bb][Yy]",Pattern.DOTALL);
+ //int startPoint = sql.length()-30;
+
+ reportSQL = reportSQL + " ";
+ reportSQL = Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(reportSQL).replaceAll(" SELECT ");
+ //reportSQL = Pattern.compile("(^[\r\n]*|([\\s]))[Ff][Rr][Oo][Mm]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(reportSQL).replaceAll(" FROM ");
+ reportSQL = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(reportSQL).replaceAll(" WHERE ");
+ reportSQL = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Nn]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(reportSQL).replaceAll(" WHEN ");
+ reportSQL = Pattern.compile("(^[\r\n]*|([\\s]))[Aa][Nn][Dd]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(reportSQL).replaceAll(" AND ");
+
+ if(!reportRuntime.getReportType().equals(AppConstants.RT_HIVE)) {
+ int startPoint = reportSQL.lastIndexOf(" FROM ");
+ if(startPoint <= 0) {
+ startPoint = reportSQL.lastIndexOf(" from ");
+ }
+ if(startPoint <= 0) {
+ startPoint = reportSQL.lastIndexOf("from ");
+ }
+ if(startPoint <= 0) {
+ startPoint = reportSQL.lastIndexOf("FROM ");
+ }
+
+ if (!matcher.find(startPoint)) {
+ reportSQL = reportSQL + " ORDER BY 1" ;
+ }
+ }
+ reportRuntime.setWholeSQL(reportSQL);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, (" *************************************************************************************** "));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("WHOLE_SQL" + reportSQL));
+ logger.debug(EELFLoggerDelegate.debugLogger, (" *************************************************************************************** "));
+
+ if (reportRuntime.getFormFieldList() != null) {
+ for (Iterator iter = reportRuntime.getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ String fieldId = fft.getFieldId();
+ String fieldDisplay = reportRuntime.getFormFieldDisplayName(fft);
+ String formfield_value = "";
+ formfield_value = AppUtils.getRequestNvlValue(request, fieldId);
+ String paramValue = nvl(formfield_value);
+ if(paramValue.length()>0) {
+ /*sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl(
+ paramValue, "NULL"));*/
+ reportSQL = Utils.replaceInString(reportSQL, fieldDisplay, nvl(
+ paramValue, "NULL"));
+ }
+ /*sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl(
+ paramValue, "NULL"));*/
+ reportSQL = Utils.replaceInString(reportSQL, "'" + fieldDisplay + "'", nvl(
+ paramValue, "NULL"));
+ reportSQL = Utils.replaceInString(reportSQL, fieldDisplay , nvl(
+ paramValue, "NULL"));
+ }
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, ("SQL " + reportSQL));
+ String legendCol = "1 a";
+ // String valueCol = "1";
+ StringBuffer groupCol = new StringBuffer();
+ StringBuffer seriesCol = new StringBuffer();
+ StringBuffer valueCols = new StringBuffer();
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, request);
+ if (nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))
+ legendCol = getSelectExpr(dc, colName)+" " + dc.getColId();
+ // if(dc.getChartSeq()>0)
+ // valueCol = "NVL("+colName+", 0) "+dc.getColId();
+ if ((!nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))
+ && (dc.getChartSeq()!=null && dc.getChartSeq().intValue() <= 0) && dc.isGroupBreak()) {
+ groupCol.append(", ");
+ groupCol.append(colName + " " + dc.getColId());
+ }
+ } // for
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if(dc.isChartSeries()!=null && dc.isChartSeries().booleanValue()) {
+ //System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues)));
+ seriesCol.append(", "+ getSelectExpr(dc,getColumnSelectStr(dc, request))+ " " + dc.getColId());
+ }
+ }
+
+ /*for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ if(!dc.isChartSeries() && !(nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
+ //System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues)));
+ seriesCol.append(", "+ formatChartColumn(getSelectExpr(dc,getColumnSelectStr(dc, paramValues)))+ " " + dc.getColId());
+ }
+ }*/
+
+ for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, request);
+ String paramValue = "";
+ if(AppUtils.nvl(colName).startsWith("[")) {
+ if (reportRuntime.getFormFieldList() != null) {
+ for (Iterator iterC = reportRuntime.getFormFieldList().getFormField().iterator(); iterC.hasNext();) {
+ FormFieldType fft = (FormFieldType) iterC.next();
+ String fieldId = fft.getFieldId();
+ String fieldDisplay = reportRuntime.getFormFieldDisplayName(fft);
+ String formfield_value = "";
+ if(AppUtils.nvl(fieldDisplay).equals(colName)) {
+ formfield_value = AppUtils.getRequestNvlValue(request, fieldId);
+ paramValue = nvl(formfield_value);
+ }
+ }
+
+ }
+
+ seriesCol.append("," + (AppUtils.nvl(paramValue).length()>0? paramValue:"null") + " " + dc.getColId());
+ } else {
+ //valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId());
+ seriesCol.append("," + (AppUtils.nvl(paramValue).length()>0? paramValue:formatChartColumn(colName)) + " " + dc.getColId());
+ }
+ } // for
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = dc.getDisplayName();
+ String colValue = getColumnSelectStr(dc, request);
+ //String colName = getColumnSelectStr(dc, formGrid);
+ if(colName.equals(AppConstants.RI_CHART_TOTAL_COL))
+ seriesCol.append(", " + AppConstants.RI_CHART_TOTAL_COL + " " + AppConstants.RI_CHART_TOTAL_COL );
+ if (colName.equals(AppConstants.RI_CHART_COLOR))
+ seriesCol.append(", " + colValue + " " + AppConstants.RI_CHART_COLOR );
+ if(colName.equals(AppConstants.RI_CHART_MARKER_START))
+ seriesCol.append(", " + AppConstants.RI_CHART_MARKER_START + " " + AppConstants.RI_CHART_MARKER_START );
+ if(colName.equals(AppConstants.RI_CHART_MARKER_END))
+ seriesCol.append(", " + AppConstants.RI_CHART_MARKER_END + " " + AppConstants.RI_CHART_MARKER_END );
+ if(colName.equals(AppConstants.RI_CHART_MARKER_TEXT_LEFT))
+ seriesCol.append(", " + AppConstants.RI_CHART_MARKER_TEXT_LEFT + " " + AppConstants.RI_CHART_MARKER_TEXT_LEFT );
+ if(colName.equals(AppConstants.RI_CHART_MARKER_TEXT_RIGHT))
+ seriesCol.append(", " + AppConstants.RI_CHART_MARKER_TEXT_RIGHT + " " + AppConstants.RI_CHART_MARKER_TEXT_RIGHT );
+ //if(colName.equals(AppConstants.RI_ANOMALY_TEXT))
+ //seriesCol.append(", " + AppConstants.RI_ANOMALY_TEXT + " " + AppConstants.RI_ANOMALY_TEXT );
+ }
+
+ //debugLogger.debug("ReportSQL Chart " + reportSQL );
+ /*for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, paramValues);
+ //valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId());
+ valueCols.append("," + formatChartColumn(colName) + " " + dc.getColId());
+ } // for
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ String colName = getColumnSelectStr(dc, paramValues);
+ //if(colName.equals(AppConstants.RI_CHART_TOTAL_COL) || colName.equals(AppConstants.RI_CHART_COLOR)) {
+ if(colName.equals(AppConstants.RI_CHART_TOTAL_COL))
+ valueCols.append(", " + AppConstants.RI_CHART_TOTAL_COL + " " + AppConstants.RI_CHART_TOTAL_COL );
+ if (colName.equals(AppConstants.RI_CHART_COLOR))
+ valueCols.append(", " + AppConstants.RI_CHART_COLOR + " " + AppConstants.RI_CHART_COLOR );
+ if (colName.equals(AppConstants.RI_CHART_INCLUDE))
+ valueCols.append(", " + AppConstants.RI_CHART_INCLUDE + " " + AppConstants.RI_CHART_INCLUDE );
+ //}
+ }*/
+ String final_sql = "";
+ reportSQL = Utils.replaceInString(reportSQL, " from ", " FROM ");
+ reportSQL = Utils.replaceInString(reportSQL, " From ", " FROM ");
+ reportSQL = Utils.replaceInString(reportSQL, " select ", " SELECT ");
+ reportSQL = Utils.replaceInString(reportSQL, " union ", " UNION ");
+ //reportSQL = reportSQL.replaceAll("[\\s]*\\(", "(");
+// if(reportSQL.indexOf("UNION") != -1) {
+// if(reportSQL.indexOf("FROM(")!=-1)
+// final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM(") );
+// else if (reportSQL.indexOf("FROM (")!=-1)
+// final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM (") );
+// //TODO ELSE THROW ERROR
+// }
+// else {
+// final_sql += " "+reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM "));
+// }
+ int pos = 0;
+ int pos_first_select = 0;
+ int pos_dup_select = 0;
+ int pos_prev_select = 0;
+ int pos_last_select = 0;
+ if (reportSQL.indexOf("FROM", pos)!=-1) {
+ pos = reportSQL.indexOf("FROM", pos);
+ pos_dup_select = reportSQL.lastIndexOf("SELECT",pos);
+ pos_first_select = reportSQL.indexOf("SELECT");//,pos);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("pos_select " + pos_first_select + " " + pos_dup_select));
+ if(pos_dup_select > pos_first_select) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("********pos_dup_select ********" + pos_dup_select));
+ //pos_dup_select1 = pos_dup_select;
+ pos_prev_select = pos_first_select;
+ pos_last_select = pos_dup_select;
+ while (pos_last_select > pos_prev_select) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("pos_last , pos_prev " + pos_last_select + " " + pos_prev_select));
+ pos = reportSQL.indexOf("FROM", pos+2);
+ pos_prev_select = pos_last_select;
+ pos_last_select = reportSQL.lastIndexOf("SELECT",pos);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("in WHILE LOOP LAST " + pos_last_select));
+ }
+ }
+
+ }
+ final_sql += " "+reportSQL.substring(pos);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Final SQL " + final_sql));
+ String sql = "SELECT " + legendCol + ", " + legendCol+"_1" + seriesCol.toString()+ nvl(valueCols.toString(), ", 1")
+ + groupCol.toString()
+ + final_sql;
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Final sql in generateChartSQL " +sql));
+
+ return sql;
+ } // generateChartSQL
+
+ private String getColumnSelectStr(DataColumnType dc, HttpServletRequest request) {
+ //String colName = dc.isCalculated() ? dc.getColName()
+ // : ((nvl(dc.getTableId()).length() > 0) ? (dc.getTableId() + "." + dc
+ // .getColName()) : dc.getColName());
+ String colName = dc.getColName();
+ String paramValue = null;
+ //if (dc.isCalculated()) {
+ if (reportRuntime.getFormFieldList() != null) {
+ for (Iterator iter = reportRuntime.getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ String fieldId = fft.getFieldId();
+ String fieldDisplay = reportRuntime.getFormFieldDisplayName(fft);
+ String formfield_value = "";
+ formfield_value = AppUtils.getRequestNvlValue(request, fieldId);
+ paramValue = nvl(formfield_value);
+ if(paramValue.length()>0) {
+ /*sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl(
+ paramValue, "NULL"));*/
+ colName = Utils.replaceInString(colName, "'" + fieldDisplay + "'", "'"+nvl(
+ paramValue, "NULL")+"'");
+ colName = Utils.replaceInString(colName, fieldDisplay, nvl(
+ paramValue, "NULL"));
+ }
+ }
+ return colName;
+ }
+ //}
+ return colName;
+ } // getColumnSelectStr
+
+
+
+ public String getSelectExpr(DataColumnType dct) {
+ // String colName =
+ // dct.isCalculated()?dct.getColName():((nvl(dct.getTableId()).length()>0)?(dct.getTableId()+"."+dct.getColName()):dct.getColName());
+ return getSelectExpr(dct, dct.getColName() /* colName */);
+ } // getSelectExpr
+
+ private String getSelectExpr(DataColumnType dct, String colName) {
+ String colType = dct.getColType();
+ if (colType.equals(AppConstants.CT_CHAR)
+ || ((nvl(dct.getColFormat()).length() == 0) && (!colType
+ .equals(AppConstants.CT_DATE))))
+ return colName;
+ else
+ return "TO_CHAR(" + colName + ", '"
+ + nvl(dct.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT) + "')";
+ } // getSelectExpr
+
+ private String formatChartColumn(String colName) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Format Chart Column Input colName " + colName));
+ colName = colName.trim();
+ colName = Utils.replaceInString(colName, "TO_CHAR", "to_char");
+ colName = Utils.replaceInString(colName, "to_number", "TO_NUMBER");
+ //reportSQL = reportSQL.replaceAll("[\\s]*\\(", "(");
+ colName = colName.replaceAll(",[\\s]*\\(", ",(");
+ StringBuffer colNameBuf = new StringBuffer(colName);
+ int pos = 0, posFormatStart = 0, posFormatEnd = 0;
+ String format = "";
+
+ if(colNameBuf.indexOf("999")==-1 && colNameBuf.indexOf("990")==-1) {
+ logger.debug(EELFLoggerDelegate.debugLogger, (" return colName " + colNameBuf.toString()));
+ return colNameBuf.toString();
+ }
+
+ while (colNameBuf.indexOf("to_char")!=-1) {
+ if(colNameBuf.indexOf("999")!=-1 || colNameBuf.indexOf("990")!=-1) {
+ pos = colNameBuf.indexOf("to_char");
+ colNameBuf.insert(pos, " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER (");
+ pos = colNameBuf.indexOf("to_char");
+ colNameBuf.replace(pos, pos+7, "TO_CHAR");
+ //colName = Utils.replaceInString(colNameBuf.toString(), "to_char", " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER ( TO_CHAR ");
+ logger.debug(EELFLoggerDelegate.debugLogger, ("After adding to_number " + colNameBuf.toString()));
+ //posFormatStart = colNameBuf.lastIndexOf(",'")+1;
+ posFormatStart = colNameBuf.indexOf(",'", pos)+1;
+ posFormatEnd = colNameBuf.indexOf(")",posFormatStart);
+ logger.debug(EELFLoggerDelegate.debugLogger, (posFormatStart + " " + posFormatEnd + " "+ pos));
+ format = colNameBuf.substring(posFormatStart, posFormatEnd);
+ //posFormatEnd = colNameBuf.indexOf(")",posFormatEnd);
+ colNameBuf.insert(posFormatEnd+1, " ," + format + ") , "+ format + ")");
+ logger.debug(EELFLoggerDelegate.debugLogger, ("colNameBuf " + colNameBuf.toString()));
+ }
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, (" return colName " + colNameBuf.toString()));
+ return colNameBuf.toString();
+ }
+
+ public List getChartValueColumnsList( int filter, HashMap formValues) { /*filter; all=0;create without new chart =1; createNewChart=2 */
+ List reportCols = reportRuntime.getAllColumns();
+
+ ArrayList chartValueCols = new ArrayList();
+ int flag = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ flag = 0;
+ DataColumnType dc = (DataColumnType) iter.next();
+// if(filter == 2 || filter == 1) {
+ flag = reportRuntime.getDependsOnFormFieldFlag(dc, formValues);
+
+ if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0 && !(nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
+ if(nvl(dc.getChartGroup()).length()<=0) {
+ if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue())) {
+ chartValueCols.add(dc);
+ } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) {
+ chartValueCols.add(dc);
+ }
+ else if(filter == 0) chartValueCols.add(dc);
+ } else chartValueCols.add(dc);
+ }
+// } else
+// chartValueCols.add(dc);
+ } // for
+ Collections.sort(chartValueCols, new ChartSeqComparator());
+ return chartValueCols;
+ } // getChartValueColumnsList
+
+ public String parseTitle(String title, HashMap formValues) {
+ Set set = formValues.entrySet();
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry<String,String>) iter.next();
+ if(title.indexOf("["+ entry.getKey() + "]")!= -1) {
+ title = Utils.replaceInString(title, "["+entry.getKey()+"]", nvl(
+ (String) entry.getValue(), ""));
+ }
+ }
+ return title;
+ }
+
+ public java.util.Date getDateFromDateStr(String dateStr) {
+ SimpleDateFormat MMDDYYYYFormat = new SimpleDateFormat("MM/dd/yyyy");
+ SimpleDateFormat EEEMMDDYYYYFormat = new SimpleDateFormat("EEE, MM/dd/yyyy"); //2012-11-01 00:00:00
+ SimpleDateFormat YYYYMMDDFormat = new SimpleDateFormat("yyyy/MM/dd");
+ SimpleDateFormat MONYYYYFormat = new SimpleDateFormat("MMM yyyy");
+ SimpleDateFormat MMYYYYFormat = new SimpleDateFormat("MM/yyyy");
+ SimpleDateFormat MMMMMDDYYYYFormat = new SimpleDateFormat("MMMMM dd, yyyy");
+ SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ SimpleDateFormat timestampHrFormat = new SimpleDateFormat("yyyy-MM-dd HH");
+ SimpleDateFormat timestampDayFormat = new SimpleDateFormat("yyyy-MM-dd");
+ SimpleDateFormat DDMONYYYYFormat = new SimpleDateFormat("dd-MMM-yyyy");
+ SimpleDateFormat MONTHYYYYFormat = new SimpleDateFormat("MMMMM, yyyy");
+ SimpleDateFormat MMDDYYYYHHFormat = new SimpleDateFormat("MM/dd/yyyy HH");
+ SimpleDateFormat MMDDYYYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+ SimpleDateFormat MMDDYYYYHHMMFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");
+ SimpleDateFormat YYYYMMDDHHMMSSFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+ SimpleDateFormat YYYYMMDDHHMMFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");
+ SimpleDateFormat DDMONYYYYHHMMSSFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
+ SimpleDateFormat DDMONYYYYHHMMFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm");
+ SimpleDateFormat MMDDYYFormat = new SimpleDateFormat("MM/dd/yy");
+ SimpleDateFormat MMDDYYHHMMFormat = new SimpleDateFormat("MM/dd/yy HH:mm");
+ SimpleDateFormat MMDDYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
+ SimpleDateFormat timestampFormat1 = new SimpleDateFormat("yyyy-M-d.HH.mm. s. S");
+ SimpleDateFormat MMDDYYYYHHMMZFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm z");
+ SimpleDateFormat YYYYFormat = new SimpleDateFormat("yyyy");
+ java.util.Date date = null;
+
+ int formatFlag = 0;
+
+ final int YEARFLAG = 1;
+ final int MONTHFLAG = 2;
+ final int DAYFLAG = 3;
+ final int HOURFLAG = 4;
+ final int MINFLAG = 5;
+ final int SECFLAG = 6;
+ final int MILLISECFLAG = 7;
+ final int DAYOFTHEWEEKFLAG = 8;
+ final int FLAGDATE = 9;
+ /*int yearFlag = 1;
+ int monthFlag = 2;
+ int dayFlag = 3;
+ int hourFlag = 4;
+ int minFlag = 5;
+ int secFlag = 6;
+ int milliSecFlag = 7;
+ int dayoftheweekFlag = 8;
+ int flagDate = 10;
+ */
+
+ date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ if(date==null) {
+ date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYOFTHEWEEKFLAG;
+ }
+ if(date==null) {
+ date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+ if(date==null) {
+ //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = HOURFLAG;
+ }
+ if(date==null) {
+ date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = timestampFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+ if(date==null) {
+ date = timestampHrFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = HOURFLAG;
+ }
+ if(date==null) {
+ date = timestampDayFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+
+ if(date==null) {
+ date = MONYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MONTHFLAG;
+ }
+ if(date==null) {
+ date = MMYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MONTHFLAG;
+ }
+ if(date==null) {
+ date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MONTHFLAG;
+ }
+
+ if(date==null) {
+ date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+
+ if(date==null) {
+ date = timestampFormat1.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = YYYYFormat.parse(dateStr, new ParsePosition(0));
+ /* Some random numbers should not satisfy this year format. */
+ if(dateStr.length()>4) date = null;
+ if(date!=null) formatFlag = YEARFLAG;
+ }
+ if(date==null)
+ date = null;
+ return date;
+ }
+
+ public int getFlagFromDateStr(String dateStr) {
+ SimpleDateFormat MMDDYYYYFormat = new SimpleDateFormat("MM/dd/yyyy");
+ SimpleDateFormat EEEMMDDYYYYFormat = new SimpleDateFormat("EEE, MM/dd/yyyy"); //2012-11-01 00:00:00
+ SimpleDateFormat YYYYMMDDFormat = new SimpleDateFormat("yyyy/MM/dd");
+ SimpleDateFormat MONYYYYFormat = new SimpleDateFormat("MMM yyyy");
+ SimpleDateFormat MMYYYYFormat = new SimpleDateFormat("MM/yyyy");
+ SimpleDateFormat MMMMMDDYYYYFormat = new SimpleDateFormat("MMMMM dd, yyyy");
+ SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ SimpleDateFormat timestampHrFormat = new SimpleDateFormat("yyyy-MM-dd HH");
+ SimpleDateFormat timestampDayFormat = new SimpleDateFormat("yyyy-MM-dd");
+ SimpleDateFormat DDMONYYYYFormat = new SimpleDateFormat("dd-MMM-yyyy");
+ SimpleDateFormat MONTHYYYYFormat = new SimpleDateFormat("MMMMM, yyyy");
+ SimpleDateFormat MMDDYYYYHHFormat = new SimpleDateFormat("MM/dd/yyyy HH");
+ SimpleDateFormat MMDDYYYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+ SimpleDateFormat MMDDYYYYHHMMFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");
+ SimpleDateFormat YYYYMMDDHHMMSSFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+ SimpleDateFormat YYYYMMDDHHMMFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");
+ SimpleDateFormat DDMONYYYYHHMMSSFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
+ SimpleDateFormat DDMONYYYYHHMMFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm");
+ SimpleDateFormat MMDDYYFormat = new SimpleDateFormat("MM/dd/yy");
+ SimpleDateFormat MMDDYYHHMMFormat = new SimpleDateFormat("MM/dd/yy HH:mm");
+ SimpleDateFormat MMDDYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
+ SimpleDateFormat timestampFormat1 = new SimpleDateFormat("yyyy-M-d.HH.mm. s. S");
+ SimpleDateFormat MMDDYYYYHHMMZFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm z");
+ SimpleDateFormat YYYYFormat = new SimpleDateFormat("yyyy");
+ java.util.Date date = null;
+
+ int formatFlag = 0;
+
+ final int YEARFLAG = 1;
+ final int MONTHFLAG = 2;
+ final int DAYFLAG = 3;
+ final int HOURFLAG = 4;
+ final int MINFLAG = 5;
+ final int SECFLAG = 6;
+ final int MILLISECFLAG = 7;
+ final int DAYOFTHEWEEKFLAG = 8;
+ final int FLAGDATE = 9;
+ /*int yearFlag = 1;
+ int monthFlag = 2;
+ int dayFlag = 3;
+ int hourFlag = 4;
+ int minFlag = 5;
+ int secFlag = 6;
+ int milliSecFlag = 7;
+ int dayoftheweekFlag = 8;
+ int flagDate = 10;
+ */
+
+ date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ if(date==null) {
+ date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYOFTHEWEEKFLAG;
+ }
+ if(date==null) {
+ date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+ if(date==null) {
+ //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = HOURFLAG;
+ }
+ if(date==null) {
+ date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = timestampFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+ if(date==null) {
+ date = timestampHrFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = HOURFLAG;
+ }
+ if(date==null) {
+ date = timestampDayFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = MONYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MONTHFLAG;
+ }
+ if(date==null) {
+ date = MMYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MONTHFLAG;
+ }
+ if(date==null) {
+ date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+ if(date==null) {
+ date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MONTHFLAG;
+ }
+
+ if(date==null) {
+ date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = DAYFLAG;
+ }
+
+ if(date==null) {
+ date = timestampFormat1.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = SECFLAG;
+ }
+
+ if(date==null) {
+ date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0));
+ if(date!=null) formatFlag = MINFLAG;
+ }
+
+ if(date==null) {
+ date = YYYYFormat.parse(dateStr, new ParsePosition(0));
+ /* Some random numbers should not satisfy this year format. */
+ if(dateStr.length()>4) date = null;
+ if(date!=null) formatFlag = YEARFLAG;
+ }
+ if(date==null)
+ date = null;
+ return formatFlag;
+ }
+
+ public static String[] reverse(String[] arr) {
+ List<String> list = Arrays.asList(arr);
+ Collections.reverse(list);
+ return (String[])list.toArray();
+ }
+
+ public int getNumberOfDecimalPlaces(double num) {
+ Double d = num;
+ String[] splitter = d.toString().split("\\.");
+ splitter[0].length(); // Before Decimal Count
+ splitter[1].length(); // After Decimal Count
+ return splitter[1].length();
+ }
+
+ public boolean getBooleanValue(String s) {
+ return getBooleanValue(s,null);
+ }
+
+ public boolean getBooleanValue(String s, Boolean defaultValue) {
+ s = nvl(s);
+ if(s.length()<=0 && defaultValue!=null) return defaultValue.booleanValue();
+ else if(s.length()<=0) return false;
+ else {
+ if(s.toUpperCase().startsWith("Y") || s.toLowerCase().equals("true"))
+ return true;
+ else
+ return false;
+ }
+ }
+
+
+ public String IntToLetter(int Int) {
+ if (Int<27){
+ return Character.toString((char)(Int+96));
+ } else {
+ if (Int%26==0) {
+ return IntToLetter((Int/26)-1)+IntToLetter((Int%26)+1);
+ } else {
+ return IntToLetter(Int/26)+IntToLetter(Int%26);
+ }
+ }
+ }
+
+
+
+
+ private void clearReportRuntimeBackup(HttpServletRequest request) {
+ //Session sess = Sessions.getCurrent(true)getCurrent();
+ //HttpSession session = (HttpSession)sess.getNativeSession();
+ HttpSession session = request.getSession();
+ session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ request.removeAttribute(AppConstants.DRILLDOWN_INDEX);
+ session.removeAttribute(AppConstants.DRILLDOWN_INDEX);
+ request.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX);
+ session.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX);
+ Enumeration<String> enum1 = session.getAttributeNames();
+ String attributeName = "";
+ while(enum1.hasMoreElements()) {
+ attributeName = enum1.nextElement();
+ if(attributeName.startsWith("parent_")) {
+ session.removeAttribute(attributeName);
+ }
+ }
+ session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ session.removeAttribute(AppConstants.SI_BACKUP_FOR_REP_ID);
+ session.removeAttribute(AppConstants.SI_COLUMN_LOOKUP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REP_ID);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP);
+ session.removeAttribute(AppConstants.SI_DATA_SIZE_FOR_TEXTFIELD_POPUP);
+ session.removeAttribute(AppConstants.SI_MAP);
+ session.removeAttribute(AppConstants.SI_MAP_OBJECT);
+ session.removeAttribute(AppConstants.SI_REPORT_DEFINITION);
+ session.removeAttribute(AppConstants.SI_REPORT_RUNTIME);
+ session.removeAttribute(AppConstants.SI_REPORT_RUN_BACKUP);
+ session.removeAttribute(AppConstants.SI_REPORT_SCHEDULE);
+ session.removeAttribute(AppConstants.RI_REPORT_DATA);
+ session.removeAttribute(AppConstants.RI_CHART_DATA);
+ session.removeAttribute(AppConstants.SI_FORMFIELD_INFO);
+ session.removeAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO);
+
+ } // clearReportRuntimeBackup
+
+
+ public static synchronized java.util.HashMap getRequestParametersMap(ReportRuntime rr, HttpServletRequest request)
+ {
+ HashMap valuesMap = new HashMap();
+
+ ReportFormFields rff = rr.getReportFormFields();
+
+ int idx = 0;
+ FormField ff = null;
+
+ Map fieldNameMap = new HashMap();
+ int countOfFields = 0 ;
+
+
+ for(rff.resetNext(); rff.hasNext(); idx++) {
+ ff = rff.getNext();
+ fieldNameMap.put(ff.getFieldName(), ff.getFieldDisplayName());
+ countOfFields++;
+ }
+
+ List formParameter = new ArrayList();
+ String formField = "";
+ for(int i = 0 ; i < rff.size(); i++) {
+ ff = ((FormField)rff.getFormField(i));
+ formField = ff.getFieldName();
+ boolean isMultiValue = false;
+ isMultiValue = ff.getFieldType().equals(FormField.FFT_CHECK_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI);
+ boolean isTextArea = (ff.getFieldType().equals(FormField.FFT_TEXTAREA) && rr.getReportDefType()
+ .equals(AppConstants.RD_SQL_BASED));
+
+ if(request.getParameterValues(formField) != null && isMultiValue ) {
+ String[] vals = request.getParameterValues(formField);
+ StringBuffer value = new StringBuffer("");
+ if(!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_ACTION)) {
+
+ if ( isMultiValue ) {
+ value.append("(");
+ }
+ for(int j = 0 ; j < vals.length; j++) {
+ if(isMultiValue) value.append("'");
+ try {
+ if(vals[j] !=null && vals[j].length() > 0) {
+ vals[j] = Utils.oracleSafe(vals[j]);
+ value.append(java.net.URLDecoder.decode(vals[j], "UTF-8"));// + ",";
+ }
+ else
+ value.append(vals[j]);
+ } catch (UnsupportedEncodingException ex) {value.append(vals[j]);}
+ catch (IllegalArgumentException ex1){value.append(vals[j]);}
+ catch (Exception ex2){
+ value.append(vals[j]);
+ }
+
+
+ if(isMultiValue) value.append("'");
+
+ if(j != vals.length -1) {
+ value.append(",");
+ }
+ }
+ if(vals.length > 0) {
+ value.append(")");
+ }
+ }
+
+ //value = value.substring(0 , value.length());
+
+ valuesMap.put(fieldNameMap.get(formField), value.toString());
+ value = new StringBuffer("");
+ } else if(request.getParameter(formField) != null) {
+ if(isTextArea) {
+ String value = "";
+ value = request.getParameter(formField);
+
+ value = Utils.oracleSafe(value);
+ value = "('" + Utils.replaceInString(value, ",", "'|'") + "')";
+ value = Utils.replaceInString(value, "|", ",");
+ valuesMap.put(fieldNameMap.get(formField), value);
+ value = "";
+ } else {
+ String value = "";
+ if(!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_ACTION))
+ value = request.getParameter(formField);
+ valuesMap.put(fieldNameMap.get(formField), Utils.oracleSafe(value));
+ }
+
+ } else {
+ valuesMap.put(fieldNameMap.get(formField), "" );
+ }
+
+ }
+
+ return valuesMap;
+
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartWebRuntime.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartWebRuntime.java
new file mode 100644
index 00000000..3fb24402
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartWebRuntime.java
@@ -0,0 +1,420 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+
+
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.model.ReportHandler;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.view.ReportData;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+
+
+public class ChartWebRuntime implements Serializable {
+
+
+ // Not used - planned to use if Hibernate used as data access layer
+ private String runningDataQuery = "";
+ private String runningCountQuery = "";
+ //CONSTANTS FOR QUERY
+ public final String QRY_COUNT_REPORT = "";
+ public final String QRY_DATA_REPORT = "";
+
+ // Not used planning to use when filter is used
+ private StringBuffer whereClause = new StringBuffer("");
+ // request used to grab request parameters
+ private HttpServletRequest request;
+
+
+ public ReportRuntime reportRuntime;
+ public ReportData reportData;
+
+ //Used to pass user information
+ private final Map<String, Object> params = new HashMap<String, Object>();
+
+ //from chart generator retrieves list of charts to render
+ public ArrayList chartList;
+ public ArrayList infoList;
+
+ private String totalSql;
+
+
+ //
+ private String drilldown_index = "0";
+
+ public List getRolesCommaSeperated(HttpServletRequest request) {
+ HashMap roles = UserUtils.getRoles(request);
+ List roleList = null;
+ StringBuffer roleBuf = new StringBuffer("");
+ int count = 0;
+ if( roles != null ) {
+ roleList = Arrays.asList(roles.keySet().toArray());
+ }
+
+ return roleList;
+ }
+
+
+ public String getUserId(HttpServletRequest request) {
+ return AppUtils.getUserID(request);
+ }
+
+ public String generateChart(HttpServletRequest request) {
+ return generateChart(request, true);
+ }
+
+
+ public String generateChart(HttpServletRequest request, boolean showData) {
+ //wire variables
+ //processRecursive(this, this);
+ long currentTime = System.currentTimeMillis();
+ HttpSession session = request.getSession();
+ String action = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));
+ boolean genReportData = (!action.equals("chart.json") || action.equals("chart.data.json"));
+
+
+
+ final Long user_id = new Long((long) UserUtils.getUserId(request));
+
+
+ boolean adminUser = false;
+ try {
+ adminUser = AppUtils.isAdminUser(request) || AppUtils.isSuperUser(request);
+ } catch (RaptorException ex) {
+ ex.printStackTrace();
+ }
+ List roleList = getRolesCommaSeperated(request);
+ //final Map<String, Object> params = new HashMap<String, Object>();
+ params.put("user_id", user_id);
+ params.put("role_list", roleList);
+ //params.put("public_yn", "Y");
+
+ //String action = request.getParameter(AppConstants.RI_ACTION);
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+
+ ReportHandler rh = new ReportHandler();
+ ReportRuntime rr = null;
+ try {
+ if(reportID !=null)
+ rr = rh.loadReportRuntime(request, reportID, true, 1);
+ if(rr.getReportType().equals(AppConstants.RT_HIVE)) {
+ String sql = rr.getReportSQL();
+ rr.setWholeSQL(sql);
+ //if(genReportData)
+ //reportData = rr.loadHiveLinearReportData(rr.getWholeSQL(),user_id.toString(), 10000,request);
+ } else {
+ //if(genReportData)
+ //reportData = rr.loadReportData(0, user_id.toString(), 10000,request, false /*download*/);
+ }
+ } catch (RaptorException ex) {
+ ex.printStackTrace();
+ }
+ setReportRuntime(rr);
+ setReportData( reportData);
+
+ reportRuntime = getReportRuntime();
+ reportData = getReportData();
+
+
+ HashMap<String, String> chartOptionsMap = new HashMap<String, String>();
+
+ String rotateLabelsStr = "";
+ rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle());
+ if(rotateLabelsStr.toLowerCase().equals("standard")) {
+ rotateLabelsStr = "0";
+ } else if (rotateLabelsStr.toLowerCase().equals("up45")) {
+ rotateLabelsStr = "45";
+ } else if (rotateLabelsStr.toLowerCase().equals("down45")) {
+ rotateLabelsStr = "-45";
+ } else if (rotateLabelsStr.toLowerCase().equals("up90")) {
+ rotateLabelsStr = "90";
+ } else if (rotateLabelsStr.toLowerCase().equals("down90")) {
+ rotateLabelsStr = "-90";
+ } else
+ rotateLabelsStr = "0";
+
+ String width = (AppUtils.getRequestNvlValue(request, "width").length()>0?AppUtils.getRequestNvlValue(request, "width"):(AppUtils.nvl(reportRuntime.getChartWidth()).length()>0?reportRuntime.getChartWidth():"700"));
+ String height = (AppUtils.getRequestNvlValue(request, "height").length()>0?AppUtils.getRequestNvlValue(request, "height"):(AppUtils.nvl(reportRuntime.getChartHeight()).length()>0?reportRuntime.getChartHeight():"300"));
+ String animationStr = (AppUtils.getRequestNvlValue(request, "animation").length()>0?AppUtils.getRequestNvlValue(request, "animation"):new Boolean(reportRuntime.isAnimateAnimatedChart()).toString());
+
+ String rotateLabels = (AppUtils.getRequestNvlValue(request, "rotateLabels").length()>0?AppUtils.getRequestNvlValue(request, "rotateLabels"):(rotateLabelsStr.length()>0?rotateLabelsStr:"0"));
+ String staggerLabelsStr = (AppUtils.getRequestNvlValue(request, "staggerLabels").length()>0?AppUtils.getRequestNvlValue(request, "staggerLabels"):"false");
+ String showMaxMinStr = (AppUtils.getRequestNvlValue(request, "showMaxMin").length()>0?AppUtils.getRequestNvlValue(request, "showMaxMin"):"false");
+ String showControlsStr = (AppUtils.getRequestNvlValue(request, "showControls").length()>0?AppUtils.getRequestNvlValue(request, "showControls"):new Boolean(reportRuntime.displayBarControls()).toString());
+ String showLegendStr = (AppUtils.getRequestNvlValue(request, "showLegend").length()>0?AppUtils.getRequestNvlValue(request, "showLegend"):new Boolean(!new Boolean(reportRuntime.hideChartLegend())).toString());
+ String topMarginStr = AppUtils.getRequestNvlValue(request, "topMargin");
+ String topMargin = (AppUtils.nvl(topMarginStr).length()<=0)?(reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30"):topMarginStr;
+ String bottomMarginStr = AppUtils.getRequestNvlValue(request, "bottomMargin");
+ String bottomMargin = (AppUtils.nvl(bottomMarginStr).length()<=0)?(reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50"):bottomMarginStr;
+ String leftMarginStr = AppUtils.getRequestNvlValue(request, "leftMargin");
+ String leftMargin = (AppUtils.nvl(leftMarginStr).length()<=0)?(reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100"):leftMarginStr;
+ String rightMarginStr = AppUtils.getRequestNvlValue(request, "rightMargin");
+ String rightMargin = (AppUtils.nvl(rightMarginStr).length()<=0)?(reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160"):rightMarginStr;
+ String showTitleStr = (AppUtils.getRequestNvlValue(request, "showTitle").length()>0?AppUtils.getRequestNvlValue(request, "showTitle"):new Boolean(reportRuntime.displayChartTitle()).toString());
+ String subType = AppUtils.getRequestNvlValue(request, "subType").length()>0?AppUtils.getRequestNvlValue(request, "subType"):(AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():"");
+ String stackedStr = AppUtils.getRequestNvlValue(request, "stacked").length()>0?AppUtils.getRequestNvlValue(request, "stacked"):new Boolean(reportRuntime.isChartStacked()).toString();
+ String horizontalBar = AppUtils.getRequestNvlValue(request, "horizontalBar").length()>0?AppUtils.getRequestNvlValue(request, "horizontalBar"):new Boolean(reportRuntime.isHorizontalOrientation()).toString();
+ String barRealTimeAxis = AppUtils.getRequestNvlValue(request, "barRealTimeAxis");
+ String barReduceXAxisLabels = AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels").length()>0?AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels"):new Boolean(reportRuntime.isLessXaxisTickers()).toString();;
+ String timeAxis = AppUtils.getRequestNvlValue(request, "timeAxis").length()>0?AppUtils.getRequestNvlValue(request, "timeAxis"):new Boolean(reportRuntime.isTimeAxis()).toString();
+ String logScale = AppUtils.getRequestNvlValue(request, "logScale").length()>0?AppUtils.getRequestNvlValue(request, "logScale"):new Boolean(reportRuntime.isLogScale()).toString();
+ String precision = AppUtils.getRequestNvlValue(request, "precision").length()>0?AppUtils.getRequestNvlValue(request, "precision"):"2";
+
+ /* boolean animation = AppUtils.getRequestFlag(request, "animation");
+ boolean staggerLabels = AppUtils.getRequestFlag(request, "staggerLabels");
+ boolean showMaxMin = (showMaxMinStr.length()<=0)?false:Boolean.parseBoolean(showMaxMinStr);
+ boolean showControls = (showControlsStr.length()<=0)?true:Boolean.parseBoolean(showControlsStr);
+ boolean showLegend = (showLegendStr.length()<=0)?true:Boolean.parseBoolean(showLegendStr);
+ boolean showTitle = (showTitleStr.length()<=0)?true:Boolean.parseBoolean(showTitleStr);
+ boolean stacked = (stackedStr.length()<=0)?true:Boolean.parseBoolean(stackedStr);
+ */
+ // Add all options to Map
+ chartOptionsMap.put("width", width);
+ chartOptionsMap.put("height", height);
+ chartOptionsMap.put("animation", animationStr);
+ chartOptionsMap.put("rotateLabels", rotateLabels);
+ chartOptionsMap.put("staggerLabels", staggerLabelsStr);
+ chartOptionsMap.put("showMaxMin", showMaxMinStr);
+ chartOptionsMap.put("showControls", showControlsStr);
+ chartOptionsMap.put("showLegend", showLegendStr);
+ chartOptionsMap.put("topMargin", topMargin);
+ chartOptionsMap.put("bottomMargin", bottomMargin);
+ chartOptionsMap.put("leftMargin", leftMargin);
+ chartOptionsMap.put("rightMargin", rightMargin);
+ chartOptionsMap.put("showTitle", showTitleStr);
+ chartOptionsMap.put("subType", subType);
+ chartOptionsMap.put("stacked", stackedStr);
+ chartOptionsMap.put("horizontalBar", horizontalBar);
+ chartOptionsMap.put("timeAxis", timeAxis);
+ chartOptionsMap.put("barRealTimeAxis", barRealTimeAxis);
+ chartOptionsMap.put("barReduceXAxisLabels", barReduceXAxisLabels);
+
+ chartOptionsMap.put("logScale", logScale);
+ chartOptionsMap.put("precision", precision);
+
+
+
+ if(reportRuntime!=null) {
+ StringBuffer title = new StringBuffer("");
+ title.append(reportRuntime.getReportName());
+ }
+
+ if(! (action.equals("chart.json") || action.equals("chart.data.json"))) {
+
+
+ //Chart
+ String chartType = reportRuntime.getChartType();
+ return drawD3Charts(chartOptionsMap, request);
+ //drawD3Charts();
+ } else /*if (action.equals("chart.json"))*/ {
+ String chartType = reportRuntime.getChartType();
+ return returnChartJSON(chartOptionsMap, request, showData);
+
+
+ } /*else {
+
+ return ("Internal Error Occurred.");
+ }*/
+
+ }
+
+
+ public String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ /**
+ * @return the reportRuntime
+ */
+ public ReportRuntime getReportRuntime() {
+ return reportRuntime;
+ }
+
+ /**
+ * @param reportRuntime the reportRuntime to set
+ */
+ public void setReportRuntime(ReportRuntime reportRuntime) {
+ this.reportRuntime = reportRuntime;
+ }
+
+ /**
+ * @return the reportData
+ */
+ public ReportData getReportData() {
+ return reportData;
+ }
+
+ /**
+ * @param reportData the reportData to set
+ */
+ public void setReportData(ReportData reportData) {
+ this.reportData = reportData;
+ }
+
+ public boolean isNull(String a) {
+ if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null"))
+ return true;
+ else
+ return false;
+ }
+
+
+ protected String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ protected static String nvls(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ protected static String nvls(String s, String sDefault) {
+ return nvls(s).equals("") ? sDefault : s;
+ }
+
+ protected boolean getFlagInBoolean(String s) {
+ return nvl(s).toUpperCase().startsWith("Y") || nvl(s).toLowerCase().equals("true");
+ }
+
+
+ /**
+ * @return the chartList
+ */
+ public ArrayList getChartList() {
+ return chartList;
+ }
+
+ /**
+ * @param chartList the chartList to set
+ */
+ public void setChartList(ArrayList chartList) {
+ this.chartList = chartList;
+ }
+
+ /**
+ * @return the infoList
+ */
+ public ArrayList getInfoList() {
+ return infoList;
+ }
+
+ /**
+ * @param infoList the infoList to set
+ */
+ public void setInfoList(ArrayList infoList) {
+ this.infoList = infoList;
+ }
+
+
+
+ private void clearReportRuntimeBackup(HttpSession session, HttpServletRequest request) {
+ session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ request.removeAttribute(AppConstants.DRILLDOWN_INDEX);
+ session.removeAttribute(AppConstants.DRILLDOWN_INDEX);
+ request.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX);
+ session.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX);
+ Enumeration<String> enum1 = session.getAttributeNames();
+ String attributeName = "";
+ while(enum1.hasMoreElements()) {
+ attributeName = enum1.nextElement();
+ if(attributeName.startsWith("parent_")) {
+ session.removeAttribute(attributeName);
+ }
+ }
+ session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ session.removeAttribute(AppConstants.SI_BACKUP_FOR_REP_ID);
+ session.removeAttribute(AppConstants.SI_COLUMN_LOOKUP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REP_ID);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP);
+ session.removeAttribute(AppConstants.SI_DATA_SIZE_FOR_TEXTFIELD_POPUP);
+ session.removeAttribute(AppConstants.SI_MAP);
+ session.removeAttribute(AppConstants.SI_MAP_OBJECT);
+ session.removeAttribute(AppConstants.SI_REPORT_DEFINITION);
+ session.removeAttribute(AppConstants.SI_REPORT_RUNTIME);
+ session.removeAttribute(AppConstants.SI_REPORT_RUN_BACKUP);
+ session.removeAttribute(AppConstants.SI_REPORT_SCHEDULE);
+ session.removeAttribute(AppConstants.RI_REPORT_DATA);
+ session.removeAttribute(AppConstants.RI_CHART_DATA);
+ session.removeAttribute(AppConstants.SI_FORMFIELD_INFO);
+ session.removeAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO);
+ } // clearReportRuntimeBackup
+
+
+ public String getTotalSql() {
+ return totalSql;
+ }
+
+ public void setTotalSql(String totalSql) {
+ this.totalSql = totalSql;
+ }
+
+
+
+ /* public void drawD3Charts(HashMap<String,String> chartOptionsMap) {
+ drawD3Charts(chartOptionsMap);
+
+ }
+ */
+
+ public String drawD3Charts(HashMap<String,String> chartOptionsMap, HttpServletRequest request) {
+
+ ChartD3Helper chartHelper = new ChartD3Helper(reportRuntime);
+ chartHelper.setChartType(reportRuntime.getChartType());
+ try {
+ return chartHelper.createVisualization(reportRuntime, chartOptionsMap, request);
+ } catch(RaptorException ex) {
+ ex.printStackTrace();
+ }
+ return "";
+
+ }
+
+ public String returnChartJSON(HashMap<String,String> chartOptionsMap, HttpServletRequest request, boolean showData) {
+
+ ChartJSONHelper chartJSONHelper = new ChartJSONHelper(reportRuntime);
+ chartJSONHelper.setChartType(reportRuntime.getChartType());
+ try {
+ return chartJSONHelper.generateJSON(reportRuntime, chartOptionsMap, request, showData);
+ } catch(RaptorException ex) {
+ ex.printStackTrace();
+ }
+ return "";
+
+ }
+
+ }
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CommonChartOptions.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CommonChartOptions.java
new file mode 100644
index 00000000..e8ba2ee5
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CommonChartOptions.java
@@ -0,0 +1,81 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+public class CommonChartOptions {
+
+ private String legendPosition = "top";
+ private String legendLabelAngle = "up45";
+ private boolean hideLegend = false;
+ private boolean animateAnimatedChart = true;
+ private int topMargin = 30;
+ private int bottomMargin = 50;
+ private int leftMargin = 100;
+ private int rightMargin = 60;
+
+ public String getLegendPosition() {
+ return legendPosition;
+ }
+ public void setLegendPosition(String legendPosition) {
+ this.legendPosition = legendPosition;
+ }
+ public String getLegendLabelAngle() {
+ return legendLabelAngle;
+ }
+ public void setLegendLabelAngle(String legendLabelAngle) {
+ this.legendLabelAngle = legendLabelAngle;
+ }
+ public boolean isHideLegend() {
+ return hideLegend;
+ }
+ public void setHideLegend(boolean hideLegend) {
+ this.hideLegend = hideLegend;
+ }
+ public boolean isAnimateAnimatedChart() {
+ return animateAnimatedChart;
+ }
+ public void setAnimateAnimatedChart(boolean animateAnimatedChart) {
+ this.animateAnimatedChart = animateAnimatedChart;
+ }
+ public int getTopMargin() {
+ return topMargin;
+ }
+ public void setTopMargin(int topMargin) {
+ this.topMargin = topMargin;
+ }
+ public int getBottomMargin() {
+ return bottomMargin;
+ }
+ public void setBottomMargin(int bottomMargin) {
+ this.bottomMargin = bottomMargin;
+ }
+ public int getLeftMargin() {
+ return leftMargin;
+ }
+ public void setLeftMargin(int leftMargin) {
+ this.leftMargin = leftMargin;
+ }
+ public int getRightMargin() {
+ return rightMargin;
+ }
+ public void setRightMargin(int rightMargin) {
+ this.rightMargin = rightMargin;
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ErrorJSONRuntime.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ErrorJSONRuntime.java
new file mode 100644
index 00000000..d619c4e0
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ErrorJSONRuntime.java
@@ -0,0 +1,43 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+public class ErrorJSONRuntime {
+
+ private String errormessage;
+ private String stacktrace;
+
+ public String getErrormessage() {
+ return errormessage;
+ }
+ public void setErrormessage(String errormessage) {
+ this.errormessage = errormessage;
+ }
+ public String getStacktrace() {
+ return stacktrace;
+ }
+ public void setStacktrace(String stacktrace) {
+ this.stacktrace = stacktrace;
+ }
+
+
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FlexTimeSeriesChartOptions.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FlexTimeSeriesChartOptions.java
new file mode 100644
index 00000000..3b3060bb
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FlexTimeSeriesChartOptions.java
@@ -0,0 +1,38 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+public class FlexTimeSeriesChartOptions {
+ private int zoomIn = 25;
+ private String timeAxisType = "";
+ public int getZoomIn() {
+ return zoomIn;
+ }
+ public void setZoomIn(int zoomIn) {
+ this.zoomIn = zoomIn;
+ }
+ public String getTimeAxisType() {
+ return timeAxisType;
+ }
+ public void setTimeAxisType(String timeAxisType) {
+ this.timeAxisType = timeAxisType;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FormField.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FormField.java
new file mode 100644
index 00000000..ea215679
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FormField.java
@@ -0,0 +1,2111 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+/* ===========================================================================================
+ * This class is part of <I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I>
+ * Raptor : This tool is used to generate different kinds of reports with lot of utilities
+ * ===========================================================================================
+ *
+ * -------------------------------------------------------------------------------------------
+ * FormField.java - This class is used to generate all types of form field.
+ * -------------------------------------------------------------------------------------------
+ *
+ * Created By : Stan Pishamanov
+ * Modified & Maintained By : Sundar Ramalingam
+ *
+ * Changes
+ * -------
+ * 18-Aug-2009 : Version 8.5 (Sundar); Populating predefined formfields bug has been resolved.
+ * 13-Aug-2009 : Version 8.5 (RS); Form field chaining is supported even for hidden variables.
+ * 13-Aug-2009 : Version 8.5 (RS); Nothing changed just comment.
+ * 10-Aug-2009 : Version 9.0 (RS); required logic is added for Multiple Dropdown.
+ * 06-Aug-2009 : Version 9.0 (RS); B getAjaxHtml is added for converting form field chain from Iframe to AJAX.
+ * 08-Jun-2009 : Version 8.3 (RS); Hidden formfields now is displayed even when the sql is not provided.
+ *
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
+import org.openecomp.portalsdk.analytics.error.UserDefinedException;
+import org.openecomp.portalsdk.analytics.model.base.IdNameList;
+import org.openecomp.portalsdk.analytics.model.base.IdNameLookup;
+import org.openecomp.portalsdk.analytics.model.base.IdNameSql;
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.xmlobj.JavascriptItemType;
+
+public class FormField extends org.openecomp.portalsdk.analytics.RaptorObject implements Serializable {
+ private static final String HTML_FORM = "formd";
+
+ private String fieldName = null;
+
+ private String fieldDisplayName = null;
+
+ private String fieldType = FFT_TEXT_W_POPUP;
+
+ private String validationType = VT_NONE;
+
+ private boolean required = false;
+
+ public boolean hasPredefinedList = false;
+
+ private String defaultValue = null;
+
+ private Calendar rangeStartDate = null;
+
+ private Calendar rangeEndDate = null;
+
+ private String rangeStartDateSQL = null;
+
+ private String rangeEndDateSQL = null;
+
+ private String fieldDefaultSQL = null;
+
+ private String multiSelectListSize = null;
+
+ private String helpText = null;
+
+ private IdNameList lookupList = null;
+
+ private String dbInfo = null;
+
+ private String userId = null;
+
+ private boolean visible = true;
+
+ private String dependsOn = null;
+
+ private boolean triggerOtherFormFields = false;
+
+ private boolean triggerThisFormfield = false;
+
+ // Form field types
+ public static final String FFT_TEXT_W_POPUP = "TEXT_WITH_POPUP";
+
+ public static final String FFT_TEXT = "TEXT";
+
+ public static final String FFT_TEXTAREA = "TEXTAREA";
+
+ public static final String FFT_COMBO_BOX = "COMBO_BOX";
+
+ public static final String FFT_LIST_BOX = "LIST_BOX";
+
+ public static final String FFT_RADIO_BTN = "RADIO_BTN";
+
+ public static final String FFT_CHECK_BOX = "CHECK_BOX";
+
+ public static final String FFT_LIST_MULTI = "LIST_MULTI_SELECT";
+
+ public static final String FFT_HIDDEN = "HIDDEN";
+
+ public static final String FFT_BLANK = "BLANK";
+
+ // Validation types
+ public static final String VT_NONE = "NONE";
+
+ public static final String VT_DATE = "DATE";
+
+ public static final String VT_TIMESTAMP_HR = "TIMESTAMP_HR";
+
+ public static final String VT_TIMESTAMP_MIN = "TIMESTAMP_MIN";
+
+ public static final String VT_TIMESTAMP_SEC = "TIMESTAMP_SEC";
+
+ public static final String VT_INT = "INTEGER";
+
+ public static final String VT_INT_POSITIVE = "POSITIVE_INTEGER";
+
+ public static final String VT_INT_NON_NEGATIVE = "NON_NEGATIVE_INTEGER";
+
+ public static final String VT_FLOAT = "FLOAT";
+
+ public static final String VT_FLOAT_POSITIVE = "POSITIVE_FLOAT";
+
+ public static final String VT_FLOAT_NON_NEGATIVE = "NON_NEGATIVE_FLOAT";
+
+ private FormField(String fieldName, String fieldDisplayName, String fieldType,
+ String validationType, boolean required, String defaultValue, String helpText, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
+ String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) {
+ //super();
+ this (fieldName,fieldDisplayName,fieldType,validationType,required,defaultValue,helpText, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
+ setVisible(visible);
+ } // FormField
+
+ private FormField(String fieldName, String fieldDisplayName, String fieldType,
+ String validationType, boolean required, String defaultValue, String helpText, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
+ String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) {
+ super();
+ setFieldName(fieldName);
+ setFieldDisplayName(fieldDisplayName);
+ setFieldType(nvl(fieldType, FFT_TEXT));
+ setValidationType(validationType);
+ setRequired(required);
+ setDefaultValue(defaultValue);
+ setHelpText(helpText);
+ setDependsOn(dependsOn);
+ setRangeStartDate(rangeStartDate);
+ setRangeEndDate(rangeEndDate);
+ setRangeStartDateSQL(rangeStartDateSQL);
+ setRangeEndDateSQL(rangeEndDateSQL);
+ setMultiSelectListSize(multiSelectListSize);
+ }
+ public FormField(String fieldName, String fieldDisplayName, String fieldType,
+ String validationType, boolean required, String defaultValue, String helpText,
+ List predefinedValues, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
+ String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize) {
+ this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue,
+ helpText,visible, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
+ if (predefinedValues != null)
+ setPredefinedListLookup(predefinedValues);
+ } // FormField
+
+ public FormField(String fieldName, String fieldDisplayName, String fieldType,
+ String validationType, boolean required, String defaultValue, String helpText,
+ String lookupSql, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
+ String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) {
+ this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue,
+ helpText,visible, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
+ if (defaultValue!=null && defaultValue.length()>10 && defaultValue.substring(0,10).trim().toLowerCase().startsWith("select")) {
+ setFieldDefaultSQL(defaultValue);
+ setDefaultValue("");
+ }
+ setLookupList(new IdNameSql(lookupSql,defaultValue));
+ } // FormField
+
+ public FormField(String fieldName, String fieldDisplayName, String fieldType,
+ String validationType, boolean required, String defaultValue, String helpText,
+ String dbTableName, String dbIdField, String dbNameField, String dbSortByField, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
+ String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize) {
+ this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue,
+ helpText,dbTableName,dbIdField,dbNameField,dbSortByField, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
+ setVisible(visible);
+ }
+
+ public FormField(String fieldName, String fieldDisplayName, String fieldType,
+ String validationType, boolean required, String defaultValue, String helpText,
+ String dbTableName, String dbIdField, String dbNameField, String dbSortByField, String dependsOn,
+ Calendar rangeStartDate, Calendar rangeEndDate,
+ String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) {
+ this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue,
+ helpText,dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
+ //if(dependsOn !=null){ this.dependsOn = dependsOn; }else { this.dependsOn = ""
+ if (defaultValue!=null && defaultValue.length()>10 && defaultValue.substring(0,10).trim().toLowerCase().startsWith("select")) {
+ setFieldDefaultSQL(defaultValue);
+ setDefaultValue("");
+ if(fieldType.equals(FFT_TEXT))
+ setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField,defaultValue,true));
+ else
+ setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField,defaultValue,false));
+ }
+ else {
+ if(fieldType.equals(FFT_TEXT))
+ setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField, true));
+ else
+ setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField, false));
+ }
+
+ this.setRangeStartDate(rangeStartDate);
+ this.setRangeEndDate(rangeEndDate);
+ this.setRangeStartDateSQL(rangeStartDateSQL);
+ this.setRangeEndDateSQL(rangeEndDateSQL);
+
+ } // FormField
+
+
+ private void setPredefinedListLookup(List predefinedValues) {
+ IdNameList lookup = new IdNameList();
+ for (Iterator iter = predefinedValues.iterator(); iter.hasNext();) {
+ String value = (String) iter.next();
+ lookup.addValue(value, value);
+ } // for
+ setHasPredefinedList(true);
+ setLookupList(lookup);
+ } // setPredefinedListLookup
+
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ public String getFieldDisplayName() {
+ return fieldDisplayName;
+ }
+
+ public String getFieldType() {
+ return fieldType;
+ }
+
+ public String getValidationType() {
+ return validationType;
+ }
+
+ public boolean isRequired() {
+ return required;
+ }
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public String getHelpText() {
+ return helpText;
+ }
+
+ public IdNameList getLookupList() {
+ return lookupList;
+ }
+
+ public void setFieldName(String fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ public void setFieldDisplayName(String fieldDisplayName) {
+ this.fieldDisplayName = fieldDisplayName;
+ }
+
+ public void setFieldType(String fieldType) {
+ this.fieldType = fieldType;
+ }
+
+ public void setValidationType(String validationType) {
+ this.validationType = nvl(validationType, VT_NONE);
+ }
+
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ public void setHelpText(String helpText) {
+ this.helpText = helpText;
+ }
+
+ public void setLookupList(IdNameList lookupList) {
+ this.lookupList = lookupList;
+ }
+
+ public void setDefaultList(IdNameList lookupList) {
+ this.lookupList = lookupList;
+ }
+
+ public String getBaseSQL() {
+ return (lookupList == null) ? null : lookupList.getBaseSQL();
+ } // getBaseSQL
+
+ public String getBaseWholeSQL() {
+ return (lookupList == null) ? null : lookupList.getBaseWholeSQL();
+ } // getBaseWholeSQL
+
+ public String getBaseWholeReadonlySQL() {
+ return (lookupList == null) ? null : lookupList.getBaseWholeReadonlySQL();
+ } // getBaseWholeReadonlySQL
+
+ public String getBaseSQLForPDFExcel() {
+ return (lookupList == null) ? null : lookupList.getBaseSQLForPDFExcel(getFieldType().equals(FFT_LIST_MULTI)||getFieldType().equals(FFT_CHECK_BOX)?true:false);
+ } // getBaseSQLForPDFExcel
+
+ public String getDisplayNameHtml() {
+ if (nvl(helpText).length() > 0)
+ return "<a title=\"" + helpText + "\">" + fieldDisplayName + "</a>";
+ else
+ return fieldDisplayName;
+ } // getDisplayNameHtml
+
+ /*public String getHtml() throws RaptorRuntimeException {
+ return getHtml("" , null, null, false);
+ } // getHtml*/
+
+ public String getHtml(String fieldValue, HashMap formValues, ReportRuntime rr)throws RaptorRuntimeException {
+ return getHtml(fieldValue,formValues, rr, false);
+ }
+
+ public String getHelpLink(String fieldName) {
+ //return "<a href=\"#\" onclick=\"javascript:ShowContent('" + fieldName + "_div')\"><img src=\""+AppUtils.getBaseFolderURL()+"images/quickhelp_dk.gif\" width=\"12\" height=\"12\" alt=\"\" border=\"0\" class=\"qh-element\" /></a>";
+ return ((getHelpText()!=null && getHelpText().length()>0)? "tooltipText=\""+ getHelpText()+"\">": ">");
+ //return ((getHelpText()!=null && getHelpText().length()>0)? "<img src=\"static/fusion/raptor/images/quickhelp_lt.gif\" tooltipText=\""+ getHelpText() + "\"/>": "");
+ }
+
+
+ public String getCallableAfterChainingJavascript(String fieldName, ReportRuntime rr) {
+ JavascriptItemType javascriptItemType = null;
+ StringBuffer callJavascriptText = new StringBuffer("");
+ if(rr.getJavascriptList()!=null) {
+ for (Iterator iter = rr.getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) {
+ javascriptItemType = (JavascriptItemType)iter.next();
+ if(javascriptItemType.getFieldId().equals(fieldName)) {
+ if(nvl(javascriptItemType.getCallText()).toLowerCase().startsWith("afterchaining"))
+ callJavascriptText.append(" "+javascriptItemType.getCallText());
+ }
+ }
+ }
+ return callJavascriptText.toString()+" ";
+ }
+ public String getCallableJavascript(String fieldName, ReportRuntime rr) {
+ JavascriptItemType javascriptItemType = null;
+ StringBuffer callJavascriptText = new StringBuffer("");
+ if(rr.getJavascriptList()!=null) {
+ for (Iterator iter = rr.getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) {
+ javascriptItemType = (JavascriptItemType)iter.next();
+ if(javascriptItemType.getFieldId().equals(fieldName)) {
+ if(!nvl(javascriptItemType.getCallText()).toLowerCase().startsWith("afterchaining"))
+ callJavascriptText.append(" "+javascriptItemType.getCallText());
+ }
+ }
+ }
+ return callJavascriptText.toString()+" ";
+ }
+
+ public String getCallableOnChangeJavascript(String fieldName, ReportRuntime rr) {
+ String callText = getCallableJavascript(fieldName, rr);
+ if(callText != null && callText.trim().toLowerCase().indexOf("onchange")>=0) {
+ Pattern re1 = Pattern.compile("\\=(.*?)\\)");
+ Matcher matcher = re1.matcher(callText);
+ while (matcher.find()) {
+ callText = matcher.group();
+ if(callText!=null && callText.startsWith("=\"")) {
+ callText = callText.substring(2);
+ } else if (callText!=null)
+ callText = callText.substring(1);
+ }
+ callText = callText.replaceAll("this", "documentForm."+fieldName);
+ } else callText = null;
+ return callText;
+ }
+
+ public String getAjaxHtml(String fieldValue, HashMap formValues, ReportRuntime rr, boolean inSchedule) throws RaptorRuntimeException {
+ fieldValue = nvl(fieldValue, defaultValue);
+ String readOnly = "ff_readonly";
+ try {
+ if(fieldValue !=null && fieldValue.length() > 0)
+ fieldValue = java.net.URLDecoder.decode(fieldValue, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {}
+ catch (IllegalArgumentException ex1){}
+ catch (Exception ex2){}
+ if (fieldType.equals(FFT_COMBO_BOX)) {
+ StringBuffer sb = new StringBuffer();
+ //System.out.println("COMBO BOX " + fieldName);
+ String oldSQL = "";
+ if (!required)
+ sb.append("obj.options[obj.options.length] = new Option('-->select value<--','');");
+
+ IdNameList lookup = getLookupList();
+ try {
+ if(!hasPredefinedList) {
+ //if(dependsOn != null && dependsOn != "") {
+ //if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = "";
+ SQL = lu.getSql();
+ /*if(nvl(fieldValue,"").length()<=0)
+ SQL = lu.getSql();
+ else
+ SQL = lu.getBaseSQLForPDFExcel(false);
+ */
+ //System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql());
+ oldSQL = lu.getSql();
+ //SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue);
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ if(inSchedule) {
+ try {
+ value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+
+ }
+ }
+ if (value!=null && (value.length() <=0 || value.equals("NULL"))) {
+ value = "NULL";
+ SQL = Utils.replaceInString(SQL, "'["+entry.getKey()+"]'", value);
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
+ } else {
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
+ }
+ }
+ lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
+ }
+ //}
+ lookupList = lookup;
+
+ //}
+ try {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e);
+ }
+ }
+ lookup.trimToSize();
+
+ String selectedValue = "";
+ int count = 0;
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ if(value != null && value.getId() != null && value.getName() != null ) {
+ /*if (count == 0 && required) {
+ selectedValue = value.getId();
+ count++;
+ } else if (nvl(fieldValue).length()>0){
+ if (fieldValue != null && fieldValue.equals(value.getId())){
+ selectedValue = value.getId();
+ }
+ count++;
+ } else {
+ count++;
+ } */
+ if (count == 0) {
+ if(required){
+ selectedValue = value.getId();
+ }
+ count++;
+ }
+ sb.append("obj.options[obj.options.length] = new Option('" + Utils.singleQuoteEncode(value.getName())+"','"+Utils.singleQuoteEncode(value.getId())+"');");
+ if ((fieldValue != null && fieldValue.equals(value.getId()))){
+ sb.append("obj.options[obj.options.length-1].selected=true;");
+ selectedValue = value.getId();
+ }
+ if(value.isReadOnly())
+ sb.append("obj.disabled=true;");
+ else
+ sb.append("obj.disabled=false;");
+
+ }
+ } // for
+ if (formValues.containsKey(fieldDisplayName)){
+ formValues.remove(fieldDisplayName);
+ }
+ formValues.put(fieldDisplayName, selectedValue);
+ } catch (Exception e) {
+ //throw new RaptorRuntimeException(e);
+ }
+ if(!hasPredefinedList) {
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ }
+ //System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql());
+ if( isVisible())
+ return sb.toString();
+ else return "";
+ } else if (fieldType.equals(FFT_LIST_MULTI)) {
+ StringBuffer sb = new StringBuffer();
+ String oldSQL = "";
+
+ fieldValue = '|' + fieldValue + '|';
+ IdNameList lookup = getLookupList();
+ try {
+ if(!hasPredefinedList) {
+ //if(dependsOn != null && dependsOn != "") {
+ //if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = "";
+ SQL = lu.getSql();
+ /*if(nvl(fieldValue,"").length()<=0)
+ SQL = lu.getSql();
+ else
+ SQL = lu.getBaseSQLForPDFExcel(false);
+ SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue);
+ */
+ oldSQL = lu.getSql();
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ if(inSchedule) { //('1347')
+ try {
+ value = java.net.URLDecoder.decode(value, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+
+ }
+ }
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
+ }
+ lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
+ }
+ //}
+ lookupList = lookup;
+ //}
+
+ lookup.loadUserData(0, "", getDbInfo(),getUserId());
+ }
+
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ sb.append("obj.options[obj.options.length] = new Option('" + Utils.singleQuoteEncode(value.getName()) +"','"+Utils.singleQuoteEncode(value.getId())+"');");
+ if (fieldValue.indexOf('|' + value.getId() + '|') >= 0)
+ sb.append("obj.options[obj.options.length-1].selected=true;");
+ if(value.isReadOnly())
+ sb.append("obj.disabled=true;");
+ else
+ sb.append("obj.disabled=false;");
+
+ } // for
+
+ // lookup.clearData();
+ } catch (Exception e) {
+ //throw new RaptorRuntimeException(e);
+ }
+ if(!hasPredefinedList) {
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ }
+ if(isVisible())
+ return sb.toString();
+ else
+ return "";
+ } else if (fieldType.equals(FFT_TEXT_W_POPUP)) {
+ //System.out.println("TEXT POPUP " + fieldName);
+ String oldSQL = "";
+ IdNameValue idNamevalue = null;
+ String fieldDefValue="";
+ String fieldDefDisplay="";
+ try {
+ IdNameList lookup = getLookupList();
+ if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = getBaseWholeSQL();
+ if(SQL.toLowerCase().indexOf(readOnly) != -1) {
+ SQL = getBaseWholeReadonlySQL();
+ }
+ oldSQL = lu.getSql();
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ if(inSchedule) {
+ try {
+ value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+
+ }
+ }
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
+// if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1) {
+ if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1 || SQL.indexOf("'"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"'")!=-1
+ || SQL.indexOf("'%"+"["+entry.getKey()+"]"+"%'")!=-1 || SQL.indexOf("'%"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"%'")!=-1
+ || SQL.indexOf("'_"+"["+entry.getKey()+"]"+"_'")!=-1 || SQL.indexOf("'_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_'")!=-1
+ || SQL.indexOf("'%_"+"["+entry.getKey()+"]"+"_%'")!=-1 || SQL.indexOf("'%_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_%'")!=-1) {
+
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl(
+ value, "NULL"));
+ } else {
+ // Added to prevent SQL Injection
+ if(SQL.indexOf("["+entry.getKey()+"]")!=-1) {
+ try {
+ double vD = Double.parseDouble(value);
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl(
+ value, "NULL"));
+ } catch (NumberFormatException ex) {
+ throw new UserDefinedException("Expected number, Given String for the form field \"" + "["+entry.getKey()+"]"+"\"");
+ }
+ }
+ }
+ }
+ if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0))
+ lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
+ else
+ lookup = new IdNameSql(-1,SQL,null);
+ }
+ }
+ //lookupList = lookup;
+
+ if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0)) {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ for (lookup.resetNext(); lookup.hasNext();) {
+ idNamevalue = lookup.getNext();
+ break;
+
+ }
+ fieldDefValue = nvl(idNamevalue.getId());
+ fieldDefDisplay = nvl(idNamevalue.getName());
+ } else {
+ try {
+ // -2 indicates to run the whole sql for matching value
+ lookup.loadUserData(-2, "", getDbInfo(), getUserId());
+ lookup.trimToSize();
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ if(value != null && value.getId() != null && value.getName() != null ) {
+ fieldDefValue = nvl(value.getId());
+ if (fieldValue != null && fieldValue.equals(value.getId())) {
+ fieldDefDisplay = nvl(value.getName());
+ break;
+ }
+ else {
+ fieldDefValue = "";
+ fieldDefDisplay = "";
+ }
+ }
+ }
+ if (fieldDefDisplay == null || fieldDefDisplay.length()<=0) {
+ fieldDefDisplay = nvl(fieldDefValue);
+ }
+
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+
+ } catch (Exception e) {
+ //throw new RaptorRuntimeException(e);
+ }
+
+
+ //----- END ---//
+
+
+ if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0)) {
+ fieldDefValue = nvl((idNamevalue!=null)?idNamevalue.getId():"");
+ fieldDefDisplay = nvl((idNamevalue!=null)?idNamevalue.getName():"");
+ } else {
+ if(fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0) fieldValue="";
+ fieldDefValue = nvl(fieldDefValue);
+ fieldDefDisplay = nvl(fieldDefDisplay);
+ }
+
+ }
+ }catch(Exception e) { //throw new RaptorRuntimeException(e);
+ }
+ if(isVisible()) {
+ /* return "<input type=text class=\"text\" size=30 maxlength=50 id=\"" + fieldName +"\" name=\"" + fieldName + "\" value=\""
+ + nvl(fieldDefValue) + "\">\n" + "<a href=\"javascript:showArgPopupNew('"
+ + fieldName + "', 'document.formd." + fieldName
+ + "')\"><img border=0 src=\"" + AppUtils.getImgFolderURL()
+ + "shareicon.gif\" " + getHelpLink(fieldName);
+ */
+ return "obj.value=\""+Utils.singleQuoteEncode(nvl(fieldDefValue))+"\";";
+
+ } else
+ return "";
+ } else if (fieldType.equals(FFT_HIDDEN) || fieldType.equals(FFT_TEXT) || fieldType.equals(FFT_TEXTAREA) ) {
+ StringBuffer sb = new StringBuffer();
+ String oldSQL = "";
+ try {
+ IdNameList lookup = getLookupList();
+ //if(dependsOn != null && dependsOn != "") {
+ //if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ //System.out.println("SQL HIDDEN 1 " + SQL);
+ oldSQL = lu.getSql();
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ if(value == null || value.trim().length()<=0) {
+ value = "NULL";
+ }
+ if(inSchedule) {
+ try {
+ value = java.net.URLDecoder.decode(value, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+
+ }
+ }
+ //System.out.println("HIDDEN " + "["+entry.getKey()+"]" + "-" + value);
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
+ }
+
+ lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
+ }
+ //System.out.println("SQL HIDDEN 2 " + SQL);
+ //}
+ lookupList = lookup;
+ //}
+ if(nvl(fieldValue).length()>0 && (dependsOn == null || dependsOn.length()<=0)) {
+ sb.append((fieldValue!=null)?"obj.value=\""+nvl(fieldValue)+"\";":"");
+ } else if (lookup != null) {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ int iCnt = 0;
+ for (lookup.resetNext(); lookup.hasNext(); iCnt++) {
+ IdNameValue value = lookup.getNext();
+ //System.out.println("HIDDEN " + value.getId() + " " + value.getName());
+ sb.append((value!=null)?"obj.value=\""+nvl(value.getId())+"\";":"");
+ if(value.isReadOnly())
+ sb.append("obj.disabled=true;");
+ else
+ sb.append("obj.disabled=false;");
+ break;
+ } // for
+ if(lookup.size()<=0) {
+ sb.append("obj.value=\"\"");
+
+ }
+ } else {
+ sb.append((fieldValue!=null)?"obj.value=\""+Utils.singleQuoteEncode(nvl(fieldValue))+"\";":"");
+ }
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ // lookup.clearData();
+ } catch (Exception e) {
+ //throw new RaptorRuntimeException(e);
+ }
+ //if(isVisible())
+ return sb.toString() ;
+ } else if (fieldType.equals(FFT_LIST_BOX)) {
+ StringBuffer sb = new StringBuffer();
+ //System.out.println("COMBO BOX " + fieldName);
+ String oldSQL = "";
+ if (!required)
+ sb.append("obj.options[obj.options.length] = new Option('-->select value<--','');");
+
+ IdNameList lookup = getLookupList();
+ try {
+ if(!hasPredefinedList) {
+ //if(dependsOn != null && dependsOn != "") {
+ //if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = "";
+ SQL = lu.getSql();
+ /*if(nvl(fieldValue,"").length()<=0)
+ SQL = lu.getSql();
+ else
+ SQL = lu.getBaseSQLForPDFExcel(false);
+ */
+ //System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql());
+ oldSQL = lu.getSql();
+ //SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue);
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ if(inSchedule) {
+ try {
+ value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+
+ }
+ }
+ if (value!=null && (value.length() <=0 || value.equals("NULL"))) {
+ value = "NULL";
+ SQL = Utils.replaceInString(SQL, "'["+entry.getKey()+"]'", value);
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
+ } else {
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
+ }
+ }
+ lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
+ }
+ //}
+ lookupList = lookup;
+
+ //}
+ try {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e);
+ }
+ }
+ lookup.trimToSize();
+
+ String selectedValue = "";
+ int count = 0;
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ if(value != null && value.getId() != null && value.getName() != null ) {
+ /*if (count == 0 && required) {
+ selectedValue = value.getId();
+ count++;
+ } else if (nvl(fieldValue).length()>0){
+ if (fieldValue != null && fieldValue.equals(value.getId())){
+ selectedValue = value.getId();
+ }
+ count++;
+ } else {
+ count++;
+ } */
+ if (count == 0) {
+ if(required){
+ selectedValue = value.getId();
+ }
+ count++;
+ }
+ sb.append("obj.options[obj.options.length] = new Option('" + Utils.singleQuoteEncode(value.getName())+"','"+Utils.singleQuoteEncode(value.getId())+"');");
+ if ((fieldValue != null && fieldValue.equals(value.getId()))){
+ sb.append("obj.options[obj.options.length-1].selected=true;");
+ selectedValue = value.getId();
+ }
+ if(value.isReadOnly())
+ sb.append("obj.disabled=true;");
+ else
+ sb.append("obj.disabled=false;");
+
+ }
+ } // for
+ if (formValues.containsKey(fieldDisplayName)){
+ formValues.remove(fieldDisplayName);
+ }
+ formValues.put(fieldDisplayName, selectedValue);
+ } catch (Exception e) {
+ //throw new RaptorRuntimeException(e);
+ }
+ if(!hasPredefinedList) {
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ }
+ //System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql());
+ if( isVisible())
+ return sb.toString();
+ else return "";
+ }
+
+ return "";
+ }
+
+ public String getHtml(String fieldValue, HashMap formValues, ReportRuntime rr, boolean inSchedule) throws RaptorRuntimeException {
+ fieldValue = nvl(fieldValue, defaultValue);
+ int MILLIS_IN_DAY = 1000 * 60 * 60 * 24;
+ String readOnlyInSql = "ff_readonly";
+ boolean readOnly = false;
+ try {
+ if(fieldValue !=null && fieldValue.length() > 0)
+ fieldValue = java.net.URLDecoder.decode(fieldValue, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {}
+ catch (IllegalArgumentException ex1){}
+ catch (Exception ex2){}
+ //System.out.println(fieldName + " " + fieldType + " " + fieldValue);
+ if (fieldType.equals(FFT_TEXT_W_POPUP)) {
+ //System.out.println("TEXT POPUP " + fieldName);
+ String oldSQL = "";
+ IdNameValue idNamevalue = null;
+ String fieldDefValue="";
+ String fieldDefDisplay="";
+ IdNameList lookup = null;
+ try {
+ lookup = getLookupList();
+ if(!hasPredefinedList) {
+ if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = getBaseWholeSQL();
+ if(SQL.toLowerCase().indexOf(readOnlyInSql) != -1) {
+ SQL = getBaseWholeReadonlySQL();
+ }
+ oldSQL = lu.getSql();
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
+// if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1) {
+ if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1 || SQL.indexOf("'"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"'")!=-1
+ || SQL.indexOf("'%"+"["+entry.getKey()+"]"+"%'")!=-1 || SQL.indexOf("'%"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"%'")!=-1
+ || SQL.indexOf("'_"+"["+entry.getKey()+"]"+"_'")!=-1 || SQL.indexOf("'_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_'")!=-1
+ || SQL.indexOf("'%_"+"["+entry.getKey()+"]"+"_%'")!=-1 || SQL.indexOf("'%_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_%'")!=-1) {
+
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl(
+ value, "NULL"));
+ } else {
+ // Added to prevent SQL Injection
+ if(SQL.indexOf("["+entry.getKey()+"]")!=-1) {
+ try {
+ double vD = Double.parseDouble(value);
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl(
+ value, "NULL"));
+ } catch (NumberFormatException ex) {
+ throw new UserDefinedException("Expected number, Given String for the form field \"" + "["+entry.getKey()+"]"+"\"");
+ }
+ }
+ }
+ }
+ if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0))
+ lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
+ else
+ lookup = new IdNameSql(-1,SQL,null);
+ }
+ }
+ //lookupList = lookup;
+
+ if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0)) {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ for (lookup.resetNext(); lookup.hasNext();) {
+ idNamevalue = lookup.getNext();
+ break;
+
+ }
+ fieldDefValue = nvl(idNamevalue.getId());
+ fieldDefDisplay = nvl(idNamevalue.getName());
+ } else {
+ try {
+ // -2 indicates to run the whole sql for matching value
+ lookup.loadUserData(-2, "", getDbInfo(), getUserId());
+ } catch (Exception e) {
+ //throw new RaptorRuntimeException(e);
+ }
+
+ lookup.trimToSize();
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ if(value != null && value.getId() != null && value.getName() != null ) {
+ fieldDefValue = nvl(value.getId());
+ if (fieldValue != null && fieldValue.equals(value.getId())) {
+ fieldDefDisplay = nvl(value.getName());
+ break;
+ }
+ else {
+ fieldDefValue = "";
+ fieldDefDisplay = "";
+ }
+ }
+ }
+ if (fieldDefDisplay == null || fieldDefDisplay.length()<=0) {
+ fieldDefDisplay = nvl(fieldDefValue);
+ }
+
+
+
+ //----- END ---//
+
+
+ if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0)) {
+ fieldDefValue = nvl((idNamevalue!=null)?idNamevalue.getId():"");
+ fieldDefDisplay = nvl((idNamevalue!=null)?idNamevalue.getName():"");
+ } else {
+ if(fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0) fieldValue="";
+ fieldDefValue = nvl(fieldDefValue);
+ fieldDefDisplay = nvl(fieldDefDisplay);
+ }
+
+ }
+ } else {
+ lookup.trimToSize();
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ if(value != null && value.getId() != null && value.getName() != null ) {
+ fieldDefValue = nvl(value.getId());
+ if (fieldValue != null && fieldValue.equals(value.getId())) {
+ fieldDefDisplay = nvl(value.getName());
+ break;
+ }
+ else {
+ fieldDefValue = "";
+ fieldDefDisplay = "";
+ }
+ }
+ }
+ if (fieldDefDisplay == null || fieldDefDisplay.length()<=0) {
+ fieldDefDisplay = nvl(fieldDefValue);
+ }
+ }
+ }catch(Exception e) { //throw new RaptorRuntimeException(e);
+ }
+
+ if(!hasPredefinedList) {
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ }
+
+ if(isVisible()) {
+ /* return "<input type=text class=\"text\" size=30 maxlength=50 id=\"" + fieldName +"\" name=\"" + fieldName + "\" value=\""
+ + nvl(fieldDefValue) + "\">\n" + "<a href=\"javascript:showArgPopupNew('"
+ + fieldName + "', 'document.formd." + fieldName
+ + "')\"><img border=0 src=\"" + AppUtils.getImgFolderURL()
+ + "shareicon.gif\" " + getHelpLink(fieldName);
+ */
+ String progress = "<div id=\""+fieldName+"_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""+AppUtils.getImgFolderURL()+"progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div> ";
+
+ return progress+"<input type=\"text\" class=\"text\" name=\""+getFieldName()+"_display\" readonly=true value=\""+ fieldDefDisplay +"\""+ getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName) + " \n "
+ +"<input type=\"hidden\" name=\""+getFieldName()+"\" value=\""+nvl(fieldDefValue)+"\"/> \n &nbsp;\n"
+ + "<a href=\"javascript:showArgPopupNew('"
+ + fieldName + "', 'document.formd." + fieldName
+ + "')\"><img border=0 src=\"" + AppUtils.getImgFolderURL()
+ + "shareicon.gif\" " + getHelpLink(fieldName);
+
+ } else
+ return "";
+ } else if (fieldType.equals(FFT_TEXT)) {
+ IdNameValue value = null;
+ String strValue = "";
+ boolean avail_ReadOnly = false;
+ try {
+ IdNameList lookup = getLookupList();
+ IdNameSql lu = null;
+ String valueSQL = "";
+ String oldSQL = "";
+ if(lookup instanceof IdNameSql) {
+ lu = (IdNameSql) lookup;
+ if(lu.getSql().length() > 0) {
+ valueSQL = lu.getSql();
+ avail_ReadOnly = (valueSQL.toLowerCase().indexOf(readOnlyInSql)!=-1);
+ //System.out.println("OLD SQL TEXT" + valueSQL);
+ //oldSQL = lu.getSql();
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String value1 = "";
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ value1 = (String) entry.getValue();
+ if (value1.length() <=0) {
+ value1 = "NULL";
+ valueSQL = Utils.replaceInString(valueSQL, "'["+entry.getKey()+"]'", value1);
+ valueSQL = Utils.replaceInString(valueSQL, "["+entry.getKey()+"]", value1);
+ } else {
+ valueSQL = Utils.replaceInString(valueSQL, "["+entry.getKey()+"]", value1);
+ }
+ }
+ // should be value one.
+ //lookup = new IdNameSql(-1,valueSQL,lu.getDefaultSQL());
+ }
+ }
+ //lookupList = lookup;
+ //System.out.println("8888888 88 " + valueSQL);
+ }
+ if(valueSQL!=null && valueSQL.length()>0) {
+ DataSet ds = ConnectionUtils.getDataSet(valueSQL.toString(), dbInfo);
+ strValue = ds.getString(0,1);
+ if(avail_ReadOnly) readOnly = ds.getString(0, 2).toUpperCase().startsWith("Y")||ds.getString(0, 2).toUpperCase().startsWith("T");;
+ }
+ }catch(Exception e) { //throw new RaptorRuntimeException(e);
+ }
+ String returnString = "";
+ String timestamp ="", timestamphr = "", timestampmin = "", timestampsec = "";
+
+ returnString = "<input type=text class=\"text\" size="+(validationType.equals(VT_DATE)?"10":"30") +" maxlength=50 id=\"" + fieldName +"\" name=\""
+ + fieldName + "\" id='"+ fieldName + "' "
+ + (((validationType.equals(VT_DATE)||validationType.equals(VT_TIMESTAMP_HR) ||validationType.equals(VT_TIMESTAMP_MIN) ||validationType.equals(VT_TIMESTAMP_SEC))&& !inSchedule) ? "" : "")
+ + getCallableJavascript(getFieldName(), rr) + " " + (readOnly?" readonly ":" ") + " value=\"";
+
+
+ /*if(getFieldDefaultSQL()!=null)
+ returnString += nvl(value.getId());
+ else
+ returnString += fieldValue;
+ */
+ if(fieldValue!=null && fieldValue.length()>0 && (!(fieldValue.toUpperCase().indexOf("SELECT ")!= -1 && fieldValue.toUpperCase().indexOf("FROM")!= -1)) ) {
+ if(validationType.startsWith("TIMESTAMP")) {
+ returnString += nvl((fieldValue!=null)?fieldValue.split(" ")[0]:"");
+ if(fieldValue!=null && fieldValue.length()>0) {
+ timestamp = (fieldValue.split(" ").length > 1)?fieldValue.split(" ")[1]:"";
+ String timestampArr[] = timestamp.split(":");
+ if((timestampArr.length == 1) || (timestampArr.length == 2) || (timestampArr.length == 3))
+ timestamphr = timestampArr[0];
+ if((timestampArr.length == 2) || (timestampArr.length == 3))
+ timestampmin = timestampArr[1];
+ if(timestampArr.length == 3)
+ timestampsec = timestampArr[2];
+ }
+
+ } else returnString += fieldValue;
+
+ } else if(getFieldDefaultSQL()!=null) {
+
+ if(validationType.startsWith("TIMESTAMP")) {
+ returnString += nvl((strValue.length()>0)?strValue.split(" ")[0]:"");
+ if(strValue.length()>0) {
+ timestamp = (strValue.split(" ").length > 1)?strValue.split(" ")[1]:"";
+ String timestampArr[] = timestamp.split(":");
+ if((timestampArr.length == 1) || (timestampArr.length == 2) || (timestampArr.length == 3))
+ timestamphr = timestampArr[0];
+ if((timestampArr.length == 2) || (timestampArr.length == 3))
+ timestampmin = timestampArr[1];
+ if(timestampArr.length == 3)
+ timestampsec = timestampArr[2];
+ }
+
+ } else if (nvl(strValue).length()>0) {
+ returnString += strValue;
+ } else
+ returnString += nvl((value!=null)?value.getId():"");
+ } else if (nvl(strValue).length()>0) {
+ returnString += strValue;
+ } else
+ returnString += nvl((value!=null)?value.getId():"");
+
+
+ /*returnString += "\">"
+ + (validationType.equals(VT_DATE) ? "\n\t\t\t<a href=\"#\" onClick=\"window.dateField=document."
+ + HTML_FORM
+ + "."
+ + fieldName
+ + ";calendar=window.open('"
+ + AppUtils.getRaptorActionURL()
+ + "popup.calendar','cal','WIDTH=200,HEIGHT=250');return false;\">"
+ + "\n\t\t\t\t<img src=\""
+ + AppUtils.getImgFolderURL()
+ + "calender_icon.gif\" align=absmiddle border=0 width=20 height=20></a>"
+ : ""); */
+
+ SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
+ String stRangeText = this.getRangeStartDate() == null ? null : dtf.format(this.getRangeStartDate().getTime());
+ String endRangeText = this.getRangeEndDate() == null ? null : dtf.format(this.getRangeEndDate().getTime());
+ /////////////////////////
+
+ //get the date sqls
+
+ //System.out.println("////////////start range date before Start" + this.getRangeStartDateSQL());
+
+ if (this.getRangeStartDateSQL() != null && this.getRangeStartDateSQL().trim().toLowerCase().startsWith("select")){
+ //System.out.println("////////////start range date Starting");
+ String SQL = this.getRangeStartDateSQL();
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String v = "";
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ v = (String) entry.getValue();
+ //System.out.println("///////// key is " + entry.getKey() + " = " + v);
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", v);
+ }
+
+ }
+ //System.out.println("////////////start range date sql created" + SQL);
+ try{
+ DataSet ds = ConnectionUtils.getDataSet(SQL.toString(), dbInfo);
+ //System.out.println("////////////start range date is : " + ds.get(0));
+ dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ Calendar tStart = Calendar.getInstance();
+ tStart.setTime(dtf.parse(ds.getString(0,0)));
+ dtf = new SimpleDateFormat("MM/dd/yyyy");
+ stRangeText = dtf.format(tStart.getTime().getTime()-MILLIS_IN_DAY);
+
+ }catch(Exception e){
+ System.out.println("Exception////////// : start range date is : " + e);
+ }
+ }
+
+ if (this.getRangeEndDateSQL() != null && this.getRangeEndDateSQL().trim().toLowerCase().startsWith("select")){
+ //System.out.println("////////////end range date Starting");
+ String SQL = this.getRangeEndDateSQL();
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String v = "";
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ v = (String) entry.getValue();
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", v);
+ }
+
+ }
+ try{
+ DataSet ds = ConnectionUtils.getDataSet(SQL.toString(), dbInfo);
+ //System.out.println("////////////end range date is : " + ds.get(0));
+ dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ Calendar tStart = Calendar.getInstance();
+ tStart.setTime(dtf.parse(ds.getString(0,0)));
+ dtf = new SimpleDateFormat("MM/dd/yyyy");
+ //endRangeText = dtf.format(tStart.getTime());
+ endRangeText = dtf.format(tStart.getTime().getTime()+MILLIS_IN_DAY);
+ }catch(Exception e){
+ System.out.println("Exception////////// : end range date is : " + e);
+ }
+ }
+
+
+ //////////////////////
+ String calendarOnClickMethodCall = "";
+ String timeStampStr = "";
+ if (stRangeText == null || endRangeText == null)
+ calendarOnClickMethodCall = "'oCalendar.select(document." + HTML_FORM + "." + fieldName + ", event,\""+ Globals.getCalendarOutputDateFormat() +"\"); return false;'";
+ else
+ calendarOnClickMethodCall = "'oCalendar=new CalendarPopup(\"calendarDiv\", \"calendarFrame\");oCalendar.setCssPrefix(\"raptor\");oCalendar.addDisabledDates(null, \"" + stRangeText + "\"); oCalendar.addDisabledDates(\"" + endRangeText + "\", null); oCalendar.select(document." + HTML_FORM + "." + fieldName + ", event,\""+ Globals.getCalendarOutputDateFormat() +"\"); return false;'";
+ returnString += "\" " + getHelpLink(fieldName)
+ + (validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)
+ ? "\n\t\t\t<img src='" + AppUtils.getImgFolderURL()+ "calender_icon.gif' align=absmiddle border=0 width='20' height='20' onClick=" + calendarOnClickMethodCall + " style='cursor:hand'>"
+ : "");
+ if(validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC) ) {
+ //Add Hours/Minutes and Seconds.
+ timeStampStr = " <font class=rtabletext>Hour&nbsp;</font><select id = \""+ fieldName+ "_Hr\" name=\""+ fieldName+ "_Hr\" "+ (readOnly?"disabled":"")+" >";
+ int hour = 0;
+ int t_hr = 0;
+ try {
+ hour = Integer.parseInt(nvl(rr.getParamValue(fieldName+"_Hr"),"0"));
+ if(hour == 0) {
+ if(inSchedule) hour = Integer.parseInt(nvl(((String)formValues.get(fieldName+"_Hr")),"0"));
+ }
+// System.out.println("Hour =" + hour);
+ } catch (NumberFormatException ex) { hour = 0; }
+ try {
+ t_hr = Integer.parseInt(timestamphr);
+// System.out.println("THR =" + t_hr);
+ } catch (NumberFormatException ex) { t_hr = 0;}
+
+ if(hour <= 0) hour = t_hr;
+ // System.out.println("Form Values 887 " + formValues);
+ /*if (formValues.containsKey(fieldDisplayName+"_Hr")){
+ formValues.remove(fieldDisplayName+"_Hr");
+ formValues.put(fieldDisplayName+"_Hr", hour);
+ } else
+ formValues.put(fieldDisplayName+"_Hr", hour);
+ System.out.println("Form Values 887 " + formValues);
+ */
+
+ //int t_min = Integer.parseInt(timestampmin);
+ //int t_sec = Integer.parseInt(timestampsec);
+ for (int i = 0; i < 24; i++) {
+ if(i==0) timeStampStr += "<option value=\"" + i + "\""+ ((hour==i)?" selected":"") +">00</option>";
+ else if(i<10) timeStampStr += "<option value=\"" + i + "\""+ ((hour==i)?" selected":"") +">" + "0"+i + "</option>";
+ else timeStampStr += "<option value=\"" + i + "\""+ ((hour==i)?" selected":"") +">" + i + "</option>";
+
+ }
+ timeStampStr += "</select>";
+ }
+ //Minutes
+ if( validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC) ) {
+ int minutes = 0;
+ int t_min = 0;
+ try {
+ minutes = Integer.parseInt(nvl(rr.getParamValue(fieldName+"_Min"),"0"));
+ if(minutes == 0) {
+ if(inSchedule) minutes = Integer.parseInt(nvl(((String)formValues.get(fieldName+"_Min")),"0"));
+ }
+ } catch (NumberFormatException ex) {minutes = 0;}
+ try {
+ t_min = Integer.parseInt(timestampmin);
+ } catch (NumberFormatException ex) { t_min = 0;}
+
+ if(minutes <= 0) minutes = t_min;
+ /*if (formValues.containsKey(fieldDisplayName+"_Min")){
+ formValues.remove(fieldDisplayName+"_Min");
+ formValues.put(fieldDisplayName+"_Min", minutes);
+ } else
+ formValues.put(fieldDisplayName+"_Min", minutes);
+ */
+ timeStampStr += " <font class=rtabletext>Min&nbsp;</font><select id = \""+ fieldName+ "_Min\" name=\""+ fieldName+ "_Min\" "+ (readOnly?"disabled":"")+" >";
+ for (int i = 0; i < 60; i++) {
+ if(i==0) timeStampStr += "<option value=\"" + i + "\""+ ((minutes==i)?" selected":"") +">00</option>";
+ else if(i<10) timeStampStr += "<option value=\"" + i + "\""+ ((minutes==i)?" selected":"") +">" + "0"+i + "</option>";
+ else timeStampStr += "<option value=\"" + i + "\""+ ((minutes==i)?" selected":"") +">" + i + "</option>";
+ }
+ timeStampStr += "</select>";
+ }
+ //Seconds
+ if( validationType.equals(VT_TIMESTAMP_SEC) ) {
+ int seconds = 0;
+ int t_sec = 0;
+ try {
+ seconds = Integer.parseInt(nvl(rr.getParamValue(fieldName+"_Sec"),"0"));
+ if(seconds == 0) {
+ if(inSchedule) seconds = Integer.parseInt(nvl(((String)formValues.get(fieldName+"_Sec")),"0"));
+ }
+ } catch (NumberFormatException ex) {seconds = 0;}
+ try {
+ t_sec = Integer.parseInt(timestampsec);
+ } catch (NumberFormatException ex) { t_sec = 0;}
+
+ if(seconds <= 0) seconds = t_sec;
+ /*if (formValues.containsKey(fieldDisplayName+"_Sec")){
+ formValues.remove(fieldDisplayName+"_Sec");
+ formValues.put(fieldDisplayName+"_Sec", seconds);
+ } else
+ formValues.put(fieldDisplayName+"_Sec", seconds);
+ */
+ timeStampStr += " <font class=rtabletext>Sec&nbsp;</font><select id = \""+ fieldName+ "_Sec\" name=\""+ fieldName+ "_Sec\" "+ (readOnly?"disabled":"")+" >";
+ for (int i = 0; i < 60; i++) {
+ if(i==0) timeStampStr += "<option value=\"" + i + "\""+ ((seconds==i)?" selected":"") +">00</option>";
+ else if(i<10) timeStampStr += "<option value=\"" + i + "\""+ ((seconds==i)?" selected":"") +">" + "0"+i + "</option>";
+ else timeStampStr += "<option value=\"" + i + "\""+ ((seconds==i)?" selected":"") +">" + i + "</option>";
+ }
+ timeStampStr += "</select>";
+ }
+
+ returnString += timeStampStr;
+ String checkboxStr = "";
+ if(inSchedule && (validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)) ) {
+ if(!Globals.isScheduleDateParamAutoIncr()) {
+ checkboxStr = /*checkboxStr +" "+ */ "<input type=\"checkbox\" name=\""+getFieldName()+"_auto\" value=\"_auto\" checked/>";
+ } else {
+ checkboxStr = /*checkboxStr +" "+ */"<input type=\"hidden\" name=\""+getFieldName()+"_auto\" value=\"_auto\"/>";
+ }
+ /*if(validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)) {
+ checkboxStr = checkboxStr +" "+ "<input type=\"hidden\" name=\""+getFieldName()+"_Hr_auto\" value=\"_auto\"/>";
+ }
+ if(validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)) {
+ checkboxStr = checkboxStr +" "+ "<input type=\"hidden\" name=\""+getFieldName()+"_Min_auto\" value=\"_auto\"/>";
+ }
+ if(validationType.equals(VT_TIMESTAMP_SEC)) {
+ checkboxStr = checkboxStr +" "+ "<input type=\"hidden\" name=\""+getFieldName()+"_Sec_auto\" value=\"_auto\"/>";
+ }*/
+ }
+ if(isVisible())
+ return returnString+checkboxStr;
+ else return "";
+ } else if (fieldType.equals(FFT_TEXTAREA)) {
+
+ if(nvl(fieldValue).length()>0) {
+ fieldValue = Pattern.compile("(^[\r\n])|\\([\\']", Pattern.DOTALL).matcher(fieldValue).replaceAll("");
+ fieldValue = Pattern.compile("[\\']\\)", Pattern.DOTALL).matcher(fieldValue).replaceAll("");
+ fieldValue = fieldValue.replaceAll("','",","); // changed from "|"
+ fieldValue = fieldValue.replaceAll("' , '","\r\n");
+ }
+
+ if(isVisible())
+ return "<textarea rows=4 cols=30 id=\"" + fieldName +"\" name=\"" + fieldName + "\""+ getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName) + nvl(fieldValue)
+ + "</textarea>";
+ else
+ return "";
+ } else if (fieldType.equals(FFT_COMBO_BOX)) {
+ StringBuffer sb = new StringBuffer();
+ //System.out.println("COMBO BOX " + fieldName);
+ String oldSQL = "";
+
+ IdNameList lookup = getLookupList();
+ try {
+ if(!hasPredefinedList) {
+ //if(dependsOn != null && dependsOn != "") {
+ //if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ //System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql());
+ oldSQL = lu.getSql();
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ if (value!=null && (value.length() <=0 || value.equals("NULL"))) {
+ value = "NULL";
+ SQL = Utils.replaceInString(SQL, "'["+entry.getKey()+"]'", value);
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
+ } else {
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
+ }
+ }
+ lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
+ }
+ //}
+ lookupList = lookup;
+
+
+ //}
+ try {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e);
+ }
+ }
+ lookup.trimToSize();
+
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ readOnly = value.isReadOnly();
+ break;
+ }
+
+ String selectedValue = "";
+ int count = 0;
+ sb.append("<div id=\""+fieldName+"_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""+AppUtils.getImgFolderURL()+"progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div>");
+ sb.append("<select id=\"" + fieldName +"\" name=\"");
+ sb.append(fieldName);
+ sb.append("\" "+ (readOnly?"disabled":"")+" size=1 " + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
+ if (!required)
+ sb.append("<option value=\"\">-->select value<--");
+
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ if(value != null && value.getId() != null && value.getName() != null ) {
+ /*if (count == 0 && required) {
+ selectedValue = value.getId();
+ count++;
+ } else if (nvl(fieldValue).length()>0){
+ if (fieldValue != null && fieldValue.equals(value.getId())){
+ selectedValue = value.getId();
+ }
+ count++;
+ } else {
+ count++;
+ } */
+ if (count == 0) {
+ if(required){
+ selectedValue = value.getId();
+ }
+ count++;
+ }
+ sb.append("<option value=\"");
+ sb.append(value.getId());
+
+ if (nvl(fieldValue).length()>0) {
+ if (fieldValue.equals(value.getId())) { // || (value.isDefaultValue()))
+ sb.append("\" selected>");
+ selectedValue = value.getId();
+ }
+ else
+ sb.append("\">");
+ } else {
+ if(value!=null && value.isDefaultValue()) {
+ sb.append("\" selected>");
+ selectedValue = value.getId();
+ } else {
+ sb.append("\">");
+ }
+ }
+
+ sb.append(value.getName());
+ sb.append("</option>\n");
+ }
+ } // for
+ if (formValues.containsKey(fieldDisplayName)){
+ formValues.remove(fieldDisplayName);
+ }
+ formValues.put(fieldDisplayName, selectedValue);
+ } catch (Exception e) {
+ //throw new RaptorRuntimeException(e);
+ }
+ if(!hasPredefinedList) {
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ }
+ //System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql());
+ if(sb.length()<=0) {
+ sb.append("<div id=\""+fieldName+"_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""+AppUtils.getImgFolderURL()+"progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div>");
+ sb.append("<select id=\"" + fieldName +"\" name=\"");
+ sb.append(fieldName);
+ sb.append("\" "+ (readOnly?"disabled":"")+" size=1 " + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
+ }
+
+ sb.append("</select>");
+ if( isVisible())
+ return sb.toString();
+ else return "";
+ } else if (fieldType.equals(FFT_LIST_BOX)) {
+ StringBuffer sb = new StringBuffer();
+ String oldSQL = "";
+ IdNameList lookup = null;
+
+ lookup = getLookupList();
+ String selectedValue = "";
+ try {
+ if(!hasPredefinedList) {
+ //if(dependsOn != null && dependsOn != "") {
+ //if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ oldSQL = lu.getSql();
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
+ }
+ lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
+ }
+ //}
+ lookupList = lookup;
+ //}
+ try {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e);
+ }
+ }
+ lookup.trimToSize();
+
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ readOnly = value.isReadOnly();
+ break;
+ }
+
+ int iCnt = 0;
+ sb.append("<select id=\"" + fieldName +"\" name=\"");
+ sb.append(fieldName);
+ sb.append("\" "+ (readOnly?"disabled":"")+" size=4 " + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
+ if (!required)
+ sb.append("<option value=\"\">-->select value<--");
+
+ for (lookup.resetNext(); lookup.hasNext(); iCnt++) {
+ IdNameValue value = lookup.getNext();
+ sb.append("<option value=\"");
+ sb.append((value!=null)?value.getId():"");
+ if (nvl(fieldValue).length()>0) {
+ if (fieldValue.equals((value!=null)?value.getId():"") || (fieldValue.equals("") && required && iCnt == 0)) {
+ sb.append("\" selected>");
+ selectedValue = value.getId();
+ } else {
+ sb.append("\">");
+ }
+ } else {
+ if(value!=null && value.isDefaultValue()) {
+ sb.append("\" selected>");
+ selectedValue = value.getId();
+ } else {
+ sb.append("\">");
+ }
+ }
+ if (formValues.containsKey(fieldDisplayName)){
+ formValues.remove(fieldDisplayName);
+ }
+ formValues.put(fieldDisplayName, selectedValue);
+
+ sb.append((value!=null)?value.getName():"");
+ sb.append("</option>\n");
+ } // for
+
+ // lookup.clearData();
+ } catch (Exception e) {
+ //throw new RaptorRuntimeException(e);
+ }
+
+ if(sb.length()<=0) {
+ sb.append("<select id=\"" + fieldName +"\" name=\"");
+ sb.append(fieldName);
+ sb.append("\" "+ (readOnly?"disabled":"")+" size=4 " + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
+ }
+
+ sb.append("</select>");
+
+ if(!hasPredefinedList) {
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ }
+
+ if(isVisible())
+ return sb.toString();
+ else
+ return "";
+ } else if (fieldType.equals(FFT_HIDDEN)) {
+ StringBuffer sb = new StringBuffer();
+ String oldSQL = "";
+ String progress = "<div id=\""+fieldName+"_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""+AppUtils.getImgFolderURL()+"progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div> ";
+ sb.append(progress);
+ sb.append("<input id=\"" + fieldName +"\" name=\"");
+ sb.append(fieldName);
+ sb.append("\" type=\"hidden\"");
+ IdNameList lookup = null;
+
+ try {
+ lookup = getLookupList();
+ if(lookup != null) {
+ //if(dependsOn != null && dependsOn != "") {
+ //if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ //System.out.println("SQL HIDDEN 1 " + SQL);
+ oldSQL = lu.getSql();
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ //System.out.println("HIDDEN " + "["+entry.getKey()+"]" + "-" + value);
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
+ }
+
+ lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
+ }
+ //System.out.println("SQL HIDDEN 2 " + SQL);
+ //}
+ lookupList = lookup;
+ //}
+ if(nvl(fieldValue).length()>0 && (dependsOn == null || dependsOn.length()<=0)) {
+ sb.append(" value=\"");
+ sb.append((fieldValue!=null)?fieldValue:"");
+ sb.append("\">");
+ } else if (lookup != null) {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ int iCnt = 0;
+ for (lookup.resetNext(); lookup.hasNext(); iCnt++) {
+ IdNameValue value = lookup.getNext();
+ //System.out.println("HIDDEN " + value.getId() + " " + value.getName());
+ sb.append(" value=\"");
+ sb.append((value!=null)?value.getId():"");
+ sb.append("\">");
+ break;
+ } // for
+ if(lookup.size()<=0) {
+ sb.append(" value=\"");
+ sb.append("\">");
+
+ }
+ } else {
+ sb.append(" value=\"");
+ sb.append((fieldValue!=null)?fieldValue:"");
+ sb.append("\"/>");
+ }
+ } else {
+ sb.append(" value=\"");
+ sb.append((fieldValue!=null)?fieldValue:"");
+ sb.append("\"/>");
+ }
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ // lookup.clearData();
+ } catch (Exception e) {
+ sb.append(" value=\"\"/>");
+ //throw new RaptorRuntimeException(e);
+ }
+
+ if(!hasPredefinedList) {
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ }
+ //if(isVisible())
+ return sb.toString() ;
+ } else if (fieldType.equals(FFT_RADIO_BTN)) {
+ StringBuffer sb = new StringBuffer();
+ if (!required) {
+ sb.append("<input id=\"" + fieldName +"\" type=radio name=\"");
+ sb.append(fieldName);
+ sb.append("\" value=\"\"");
+ if (fieldValue.length() == 0)
+ sb.append(" checked");
+ //sb.append( getCallableJavascript(getFieldName(), rr) );
+ sb.append(getHelpLink(fieldName)+ " Any<br>\n");
+ }
+
+ try {
+ IdNameList lookup = getLookupList();
+ lookup.loadUserData(0, "", getDbInfo(),getUserId());
+ String selectedValue = "";
+
+ int iCnt = 0;
+ for (lookup.resetNext(); lookup.hasNext(); iCnt++) {
+ IdNameValue value = lookup.getNext();
+ sb.append("<input id=\"" + fieldName +"\" type=radio name=\"");
+ sb.append(fieldName);
+ sb.append("\" value=\"");
+ sb.append((value!=null)?value.getId():"");
+ if (nvl(fieldValue).length()>0) {
+ if (fieldValue.equals((value!=null)?value.getId():"") || (fieldValue.equals("") && required && iCnt == 0)) {
+ sb.append("\" checked>");
+ selectedValue = value.getId();
+ } else {
+ sb.append("\">");
+ }
+ } else {
+ if(value!=null && value.isDefaultValue()) {
+ sb.append("\" checked>");
+ selectedValue = value.getId();
+ } else {
+ sb.append("\">");
+ }
+ }
+ sb.append((value!=null)?value.getName():"");
+ sb.append("<br>\n");
+ } // for
+ if (formValues.containsKey(fieldDisplayName)){
+ formValues.remove(fieldDisplayName);
+ }
+ formValues.put(fieldDisplayName, selectedValue);
+
+ // lookup.clearData();
+ } catch (Exception e) {
+ throw new RaptorRuntimeException(e);
+ }
+ if(isVisible())
+ return sb.toString() ;
+ else
+ return "";
+ } else if (fieldType.equals(FFT_CHECK_BOX)) {
+ StringBuffer sb = new StringBuffer();
+
+ fieldValue = '|' + fieldValue + '|';
+ int count = 0 ;
+ try {
+ String selectedValue = "";
+ IdNameList lookup = getLookupList();
+ if(lookup != null) {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+
+ for (lookup.resetNext(); lookup.hasNext();) {
+ count++;
+ IdNameValue value = lookup.getNext();
+ sb.append("<input id=\"" + fieldName +"\" type=checkbox name=\"");
+ sb.append(fieldName);
+ sb.append("\" value=\"");
+ sb.append((value!=null)?value.getId():"");
+
+ if (!fieldValue.equals("||")) {
+ if (fieldValue.indexOf('|' + ((value!=null)?value.getId():"") + '|') >= 0) { // || (value.isDefaultValue()))
+ sb.append("\" checked " + getHelpLink(fieldName));
+ selectedValue = value.getId();
+ }
+ else
+ sb.append("\"" + getHelpLink(fieldName));
+ } else {
+ if(value!=null && value.isDefaultValue()) {
+ sb.append("\" checked " + getHelpLink(fieldName));
+ selectedValue = value.getId();
+ } else {
+ sb.append("\"" + getHelpLink(fieldName));
+ }
+ }
+
+ if(!(/*(value.getName().equals("Y")||value.getName().equals("N")) && */(!lookup.hasNext()) && count == 1))
+ sb.append((value!=null)?value.getName():"");
+ sb.append("<br>\n");
+ } // for
+
+ if (formValues.containsKey(fieldDisplayName)){
+ formValues.remove(fieldDisplayName);
+ }
+ formValues.put(fieldDisplayName, selectedValue);
+ }
+
+ // lookup.clearData();
+ } catch (Exception e) {
+ throw new RaptorRuntimeException(e);
+ }
+ if(isVisible())
+ return sb.toString();
+ else
+ return "";
+ } else if (fieldType.equals(FFT_LIST_MULTI)) {
+ StringBuffer sb = new StringBuffer();
+ String oldSQL = "";
+
+ fieldValue = '|' + fieldValue + '|';
+ IdNameList lookup = getLookupList();
+ try {
+ if(!hasPredefinedList) {
+ //if(dependsOn != null && dependsOn != "") {
+ //if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ oldSQL = lu.getSql();
+ if(formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
+ }
+ lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
+ }
+ //}
+ lookupList = lookup;
+ //}
+
+ lookup.loadUserData(0, "", getDbInfo(),getUserId());
+ }
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ readOnly = value.isReadOnly();
+ break;
+ }
+
+ sb.append("<div id=\""+fieldName+"_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""+AppUtils.getImgFolderURL()+"progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div>");
+ sb.append("<select id=\"" + fieldName +"\" name=\"");
+ sb.append(fieldName);
+ sb.append("\" "+ (readOnly?"disabled":"")+" size=\""+ multiSelectListSize +"\" multiple " + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
+
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ sb.append("<option value=\"");
+ sb.append((value!=null)?value.getId():"");
+ if (!fieldValue.equals("||")) {
+ if (fieldValue.indexOf('|' + ((value!=null)?value.getId():"") + '|') >= 0) // || (value.isDefaultValue()))
+ sb.append("\" selected>");
+ else
+ sb.append("\">");
+ } else {
+ if(value!=null && value.isDefaultValue()) {
+ sb.append("\" selected>");
+ } else {
+ sb.append("\">");
+ }
+ }
+ sb.append((value!=null)?value.getName():"");
+ sb.append("</option>\n");
+ } // for
+
+ // lookup.clearData();
+ } catch (Exception e) {
+ //throw new RaptorRuntimeException(e);
+ }
+ if(!hasPredefinedList) {
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ }
+ if(sb.length()<=0) {
+ sb.append("<div id=\""+fieldName+"_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""+AppUtils.getImgFolderURL()+"progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div>");
+ sb.append("<select id=\"" + fieldName +"\" name=\"");
+ sb.append(fieldName);
+ sb.append("\" "+ (readOnly?"disabled":"")+" size=\""+ multiSelectListSize +"\" multiple " + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
+ }
+ sb.append("</select>");
+ if(isVisible())
+ return sb.toString();
+ else
+ return "";
+ } else if (fieldType.equals(FFT_BLANK)) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("&nbsp;");
+ return sb.toString();
+ } else
+ throw new org.openecomp.portalsdk.analytics.error.RaptorRuntimeException("FormField.getHtml: Unsupported form field type");
+ } // getHtml
+
+ public String getValidateJavaScript() {
+ StringBuffer javaScript = new StringBuffer();
+
+ if (fieldType.equals(FFT_TEXT_W_POPUP) || fieldType.equals(FFT_TEXT)
+ || fieldType.equals(FFT_TEXTAREA)) {
+ if (required) {
+ javaScript.append("\n\tif(document.");
+ javaScript.append(HTML_FORM);
+ javaScript.append(".");
+ javaScript.append(fieldName);
+ javaScript.append(".value==\"\") {\n\t\talert(\"Please enter value for ");
+ javaScript.append(fieldDisplayName);
+ javaScript.append("\");\n\t\tdocument.");
+ javaScript.append(HTML_FORM);
+ javaScript.append(".");
+ javaScript.append(fieldName);
+ javaScript.append(".focus();\n\t\tdocument.");
+ javaScript.append(HTML_FORM);
+ javaScript.append(".");
+ javaScript.append(fieldName);
+ javaScript.append(".select();\n\t\treturn false;\n\t}\n");
+ } // if
+
+ if (!validationType.equals(VT_NONE)) {
+ javaScript.append("\n\tif(! ");
+ if (validationType.equals(VT_DATE)||validationType.equals(VT_TIMESTAMP_HR)||validationType.equals(VT_TIMESTAMP_MIN)||validationType.equals(VT_TIMESTAMP_SEC))
+ javaScript.append("checkDate(");
+ else if (validationType.equals(VT_INT))
+ javaScript.append("checkInteger(");
+ else if (validationType.equals(VT_INT_POSITIVE))
+ javaScript.append("checkPositiveInteger(");
+ else if (validationType.equals(VT_INT_NON_NEGATIVE))
+ javaScript.append("checkNonNegativeInteger(");
+ else if (validationType.equals(VT_FLOAT))
+ javaScript.append("checkFloat(");
+ else if (validationType.equals(VT_FLOAT_POSITIVE))
+ javaScript.append("checkPositiveFloat(");
+ else if (validationType.equals(VT_FLOAT_NON_NEGATIVE))
+ javaScript.append("checkNonNegativeFloat(");
+ javaScript.append("document.");
+ javaScript.append(HTML_FORM);
+ javaScript.append(".");
+ javaScript.append(fieldName);
+ javaScript.append(".value");
+ if (validationType.equals(VT_DATE)||validationType.equals(VT_TIMESTAMP_HR)||validationType.equals(VT_TIMESTAMP_MIN)||validationType.equals(VT_TIMESTAMP_SEC))
+ javaScript.append(", true");
+ javaScript.append(")) {\n\t\talert(\"");
+ javaScript.append(fieldDisplayName);
+ javaScript.append(" is not a valid ");
+ if (validationType.equals(VT_DATE)||validationType.equals(VT_TIMESTAMP_HR)||validationType.equals(VT_TIMESTAMP_MIN)||validationType.equals(VT_TIMESTAMP_SEC))
+ javaScript.append("date formatted "+ Globals.getCalendarOutputDateFormat());
+ else if (validationType.equals(VT_INT))
+ javaScript.append("integer");
+ else if (validationType.equals(VT_INT_POSITIVE))
+ javaScript.append("integer greater than zero");
+ else if (validationType.equals(VT_INT_NON_NEGATIVE))
+ javaScript.append("integer greater than or equal to zero");
+ else if (validationType.equals(VT_FLOAT))
+ javaScript.append("number");
+ else if (validationType.equals(VT_FLOAT_POSITIVE))
+ javaScript.append("number greater than zero");
+ else if (validationType.equals(VT_FLOAT_NON_NEGATIVE))
+ javaScript.append("number greater than or equal to zero");
+ javaScript.append(".\\nPlease enter a valid value.\");\n\t\tdocument.");
+ javaScript.append(HTML_FORM);
+ javaScript.append(".");
+ javaScript.append(fieldName);
+ javaScript.append(".focus();\n\t\tdocument.");
+ javaScript.append(HTML_FORM);
+ javaScript.append(".");
+ javaScript.append(fieldName);
+ javaScript.append(".select();\n\t\treturn false;\n\t}\n");
+ } // if
+ } // if
+ else if (fieldType.equals(FFT_CHECK_BOX)) {
+ if (required) {
+ javaScript.append("\n\tvar isChecked = false;");
+ javaScript.append("\n\tfor (var i=0; i < document.");
+ javaScript.append(HTML_FORM);
+ javaScript.append(".");
+ javaScript.append(fieldName);
+ javaScript.append(".length; i++) { ");
+ javaScript.append("\n\t\tif(document.");
+ javaScript.append(HTML_FORM);
+ javaScript.append(".");
+ javaScript.append(fieldName);
+ javaScript.append("[i].checked) {");
+ javaScript.append("\n\t\t\tisChecked = true;");
+ javaScript.append("\n\t\t\tbreak;");
+ javaScript.append("\n\t\t}");
+ javaScript.append("\n\t}");
+ javaScript.append("\n\tif(!isChecked) {");
+ javaScript.append("\n\t\talert(\"Please select at least one ");
+ javaScript.append(fieldDisplayName);
+ javaScript.append("\");\n\t\treturn false;");
+ javaScript.append("\n\t}");
+ } // if
+ } // else if FFT_CHECK_BOX
+ else if (fieldType.equals(FFT_LIST_MULTI)) {
+ if (required) {
+ javaScript.append("\n\tif(document.");
+ javaScript.append(HTML_FORM);
+ javaScript.append(".");
+ javaScript.append(fieldName);
+ javaScript.append(".selectedIndex == -1) {");
+ javaScript.append("\n\t\talert(\"Please select at least one ");
+ javaScript.append(fieldDisplayName);
+ javaScript.append("\");\n\t\treturn false;");
+ javaScript.append("\n\t}");
+ } // if
+ } // else if
+
+ return javaScript.toString();
+ } // getValidateJavaScript
+
+ public void setDbInfo(String dbInfo) {
+ this.dbInfo = dbInfo;
+ }
+
+ public String getDbInfo() {
+ return dbInfo;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+
+ public String getFieldDefaultSQL() {
+
+ return fieldDefaultSQL;
+ }
+
+
+ public void setFieldDefaultSQL(String fieldDefaultSQL) {
+
+ this.fieldDefaultSQL = fieldDefaultSQL;
+ }
+
+
+ public boolean isVisible() {
+
+ return visible;
+ }
+
+
+ public void setVisible(boolean visible) {
+
+ this.visible = visible;
+ }
+
+ public String getDependsOn() {
+ return dependsOn;
+ }
+
+ public void setDependsOn(String dependsOn) {
+ this.dependsOn = dependsOn;
+ }
+
+ public Calendar getRangeEndDate() {
+ if(rangeEndDate != null)
+ rangeEndDate.add(Calendar.DATE, 1);
+ return rangeEndDate;
+ }
+
+ public void setRangeEndDate(Calendar rangeEndDate) {
+ this.rangeEndDate = rangeEndDate;
+ }
+
+ public Calendar getRangeStartDate() {
+ if(rangeStartDate != null)
+ rangeStartDate.add(Calendar.DATE, -1);
+ return rangeStartDate;
+ }
+
+ public void setRangeStartDate(Calendar rangeStartDate) {
+ this.rangeStartDate = rangeStartDate;
+ }
+
+ public String getRangeEndDateSQL() {
+ return rangeEndDateSQL;
+ }
+
+ public void setRangeEndDateSQL(String rangeEndDateSQL) {
+ this.rangeEndDateSQL = rangeEndDateSQL;
+ }
+
+ public void setMultiSelectListSize(String multiSelectListSize) {
+ this.multiSelectListSize = multiSelectListSize;
+ }
+
+ public String getRangeStartDateSQL() {
+ return rangeStartDateSQL;
+ }
+
+ public void setRangeStartDateSQL(String rangeStartDateSQL) {
+ this.rangeStartDateSQL = rangeStartDateSQL;
+ }
+
+ public boolean isHasPredefinedList() {
+ return hasPredefinedList;
+ }
+
+ public void setHasPredefinedList(boolean hasPredefinedList) {
+ this.hasPredefinedList = hasPredefinedList;
+ }
+
+ public boolean isTriggerOtherFormFields() {
+ return triggerOtherFormFields;
+ }
+
+ public void setTriggerOtherFormFields(boolean triggerOtherFormFields) {
+ this.triggerOtherFormFields = triggerOtherFormFields;
+ }
+
+ public boolean isTriggerThisFormfield() {
+ return triggerThisFormfield;
+ }
+
+ public void setTriggerThisFormfield(boolean triggerThisFormfield) {
+ this.triggerThisFormfield = triggerThisFormfield;
+ }
+
+
+} // FormField
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FormatProcessor.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FormatProcessor.java
new file mode 100644
index 00000000..57fec736
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FormatProcessor.java
@@ -0,0 +1,375 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.view.DataRow;
+import org.openecomp.portalsdk.analytics.view.DataValue;
+import org.openecomp.portalsdk.analytics.view.HtmlFormatter;
+import org.openecomp.portalsdk.analytics.xmlobj.FormatType;
+import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType;
+
+public class FormatProcessor extends RaptorObject {
+
+
+ private SemaphoreType semaphore = null;
+
+ private String colType = null;
+
+ private String dateFormat = null;
+
+ private HtmlFormatter defaultFormatter = null;
+
+ private HashMap formatters = null;
+
+ private HashMap convertedValues = null;
+
+ private boolean attemptNumericConversion = false;
+
+ public FormatProcessor(SemaphoreType sem, String colType, String dateFormat,
+ boolean attemptNumericConversion) {
+
+ super();
+
+ if (sem == null)
+ return;
+
+ this.semaphore = sem;
+ this.colType = colType;
+ this.dateFormat = dateFormat;
+
+ this.attemptNumericConversion = attemptNumericConversion;
+ if (attemptNumericConversion)
+ for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter
+ .hasNext();) {
+ FormatType fmt = (FormatType) iter.next();
+ if (!isNumber(fmt.getLessThanValue())) {
+ this.attemptNumericConversion = false;
+ break;
+ } // if
+ } // for
+
+ formatters = new HashMap(semaphore.getFormatList().getFormat().size() * 4 / 3);
+ convertedValues = new HashMap(semaphore.getFormatList().getFormat().size() * 4 / 3);
+
+ for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter.hasNext();) {
+ FormatType fmt = (FormatType) iter.next();
+ if ((fmt.getFormatId() == null) || (fmt.getFormatId().length() <= 0)) {
+ defaultFormatter = new HtmlFormatter(fmt.isBold(), fmt.isItalic(), fmt
+ .isUnderline(), fmt.getBgColor(), fmt.getFontColor(), fmt
+ .getFontFace(), fmt.getFontSize(), fmt.getAlignment());
+ } else {
+ formatters.put(fmt.getFormatId(), new HtmlFormatter(fmt.isBold(), fmt
+ .isItalic(), fmt.isUnderline(), fmt.getBgColor(), fmt.getFontColor(),
+ fmt.getFontFace(), fmt.getFontSize(), fmt.getAlignment()));
+ convertedValues.put(fmt.getFormatId(), convertValue(fmt.getLessThanValue()));
+ }
+ } // for
+ } // FormatProcessor
+
+ private String convertValue(String origValue) {
+
+ if (colType.equals(AppConstants.CT_DATE))
+ return convertDateValue(origValue);
+ else if (colType.equals(AppConstants.CT_NUMBER))
+ return convertNumericValue(origValue);
+ else if (attemptNumericConversion)
+ return convertUnknownValue(origValue);
+ else
+ return origValue;
+ } // convertValue
+
+ private String convertDateValue(String origValue) {
+
+ // Converts to YYYY-MM-DD if possible
+ if (nvl(dateFormat).length() == 0 || nvl(origValue).length() == 0)
+ return origValue;
+
+ if (dateFormat.equals("MM/DD/YYYY") && origValue.length() == 10)
+ // Special processing for the default date format - for saving DB
+ // calls
+ return origValue.substring(6, 10) + "-" + origValue.substring(0, 2) + "-"
+ + origValue.substring(3, 5);
+
+ try {
+ // DataSet ds = DbUtils.executeQuery("SELECT TO_CHAR(TO_DATE('" + origValue + "', '"
+ // + dateFormat + "'), 'YYYY-MM-DD') val FROM DUAL");
+
+ String sql = Globals.getGenerateSqlVisualDual();
+ DataSet ds = DbUtils.executeQuery("SELECT TO_CHAR(TO_DATE('" + origValue + "', '"
+ + dateFormat + "'), 'YYYY-MM-DD') val"+sql);
+
+ if (ds.getRowCount() > 0)
+ return ds.getString(0, 0);
+ } catch (Exception e) {
+ }
+
+ return origValue;
+ } // convertDateValue
+
+ private String convertNumericValue(String origValue) {
+
+ // Converts to [20 pos.5 pos] if possible
+ if (nvl(origValue).length() == 0)
+ return origValue;
+ boolean isNegative = false;
+
+ StringBuffer integerValue = new StringBuffer();
+ StringBuffer fractionValue = new StringBuffer();
+
+ boolean beforeDecimalPoint = true;
+ for (int i = 0; i < origValue.length(); i++) {
+ char c = origValue.charAt(i);
+ if (c == '.')
+ beforeDecimalPoint = false;
+ else if (c == '-' && integerValue.length() == 0)
+ isNegative = true;
+ // else
+ // if(c=='0'||c=='1'||c=='2'||c=='3'||c=='4'||c=='5'||c=='6'||c=='7'||c=='8'||c=='9')
+ else if (Character.isDigit(c))
+ if (beforeDecimalPoint)
+ integerValue.append(c);
+ else
+ fractionValue.append(c);
+ } // for
+
+ while (integerValue.length() < 20)
+ integerValue.insert(0, '0');
+
+ while (fractionValue.length() < 5)
+ fractionValue.append('0');
+
+ integerValue.append('.');
+ integerValue.append(fractionValue);
+ integerValue.insert(0, (isNegative ? '-' : '+'));
+
+ return integerValue.toString();
+ } // convertNumericValue
+
+ private boolean isNumber(String value) { // As per Raptor def, like
+
+ // -$3,270.56
+ value = value.trim();
+ for (int i = 0; i < value.length(); i++) {
+ char c = value.charAt(i);
+ if (!(Character.isDigit(c) || c == '.' || c == '-' || c == '+' || c == ','
+ || c == '$' || c == '%'))
+ return false;
+ } // for
+
+ return true;
+ } // isNumber
+
+ private String convertUnknownValue(String origValue) {
+
+ return isNumber(origValue) ? convertNumericValue(origValue) : origValue;
+ } // convertUnknownValue
+
+ private boolean isEqual(String value1, String value2) {
+
+ return value1.trim().equals(value2.trim());
+ } // isEqual
+
+ private boolean isLessThan(String value1, String value2) {
+
+ boolean compareAsNumbers = colType.equals(AppConstants.CT_NUMBER);
+ if ((!compareAsNumbers) && attemptNumericConversion)
+ compareAsNumbers = isNumber(value1) && isNumber(value2);
+ if (compareAsNumbers && value1.length()>0 && value2.length()>0) {
+ boolean value1IsNegative = (value1.charAt(0) == '-');
+ boolean value2IsNegative = (value2.charAt(0) == '-');
+ if (value1IsNegative && (!value2IsNegative)) {
+ return true;
+ }
+ else if ((!value1IsNegative) && value2IsNegative) {
+ return false;
+ }
+ return Double.parseDouble(value1)<Double.parseDouble(value2);
+ } // if
+
+ return (value1.compareTo(value2) < 0);
+ } // isEqual
+
+ public void setHtmlFormatters(DataValue dv, DataRow dr, boolean formatModified) {
+
+ if (semaphore == null)
+ return;
+
+ HtmlFormatter formatter = defaultFormatter;
+ HtmlFormatter anyFormatter = null;
+ String sValue = convertValue(dv.getDisplayValue());
+
+ String compareColId = semaphore.getComment(); // When Column Id compare is different from formatting.
+
+ String targetColId = null;
+ if(semaphore.getTarget()!=null)
+ targetColId = semaphore.getTarget();
+
+ DataValue targetDataValue = null;
+ /* compare the column id which is in comment and assign to sValue */
+ if(nvl(compareColId).length()>0) {
+ for (dr.resetNext(); dr.hasNext();) {
+ DataValue dv1 = dr.getNext();
+ //add null check
+ if(dv1.getColId()!=null) {
+ if(dv1.getColId().equals(compareColId))
+ sValue = convertValue(dv1.getDisplayValue());
+ if(targetColId!=null) {
+ if(dv1.getColId().equals(targetColId))
+ targetDataValue = dv1;
+ }
+ }
+ }
+ }
+
+ for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter
+ .hasNext();) {
+ FormatType fmt = (FormatType) iter.next();
+ if(fmt.getLessThanValue().length() <= 0) {
+ anyFormatter = (HtmlFormatter) formatters.get(fmt.getFormatId());
+ anyFormatter.setFormatId(fmt.getFormatId());
+ break;
+ }
+ }
+
+ if( anyFormatter == null ) anyFormatter = formatter;
+ // String sValue = convertValue(dv.getDisplayValue());
+ //if (sValue.length() > 0) {
+ for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter
+ .hasNext();) {
+ FormatType fmt = (FormatType) iter.next();
+ // For Excel Download
+
+ if ((fmt.getFormatId() == null) || (fmt.getFormatId().length() <= 0)) {
+ // Default formatter
+ continue;
+ }
+
+ String formatterValue = nvl((String) convertedValues.get(fmt.getFormatId()));
+ boolean valueMatched = false;
+ if (fmt.getExpression().equals("=")) {
+ valueMatched = isEqual(sValue, formatterValue);
+ }
+
+ else if (fmt.getExpression().equals("<>"))
+ valueMatched = (!isEqual(sValue, formatterValue));
+ else if (fmt.getExpression().equals(">")) {
+ valueMatched = (!(isEqual(sValue, formatterValue) || isLessThan(sValue,
+ formatterValue)));
+ }
+ else if (fmt.getExpression().equals(">=")) {
+ valueMatched = /* isEqual(sValue, formatterValue)|| */(!isLessThan(
+ sValue, formatterValue));
+ }
+ else if (fmt.getExpression().equals("<")) {
+ valueMatched = isLessThan(sValue, formatterValue);
+ }
+ else if (fmt.getExpression().equals("<=")) {
+ valueMatched = isEqual(sValue, formatterValue)
+ || isLessThan(sValue, formatterValue);
+ }
+ //s_logger.debug("SYSOUT " + " " +sValue +" " +fmt.getBgColor() + " " + fmt.getLessThanValue()+ " " +valueMatched);
+ if (fmt.getLessThanValue().length() > 0 && valueMatched) {
+ formatter = (HtmlFormatter) formatters.get(fmt.getFormatId());
+ formatter.setFormatId(fmt.getFormatId());
+ formatModified = true;
+ //dv.setFormatId(fmt.getFormatId());
+ //dr.setFormatId(fmt.getFormatId());
+ //break;
+ } else { // if
+ if(!formatModified) formatter = anyFormatter;
+ //if(!((formatter!=null && formatter!=anyFormatter) || (defaultFormatter!=null && formatter!=defaultFormatter)))
+ // formatter = anyFormatter;
+ //formatter.setFormatId(anyFormatter.getFormatId());
+ }
+ /*else if ((fmt.getLessThanValue().length() <= 0)
+ && (fmt.getFormatId().length() > 0)) {
+ formatter = (HtmlFormatter) formatters.get(fmt.getFormatId());
+ System.out.println("---------------lesser "+ fmt.getFormatId()+ " " + fmt.getBgColor());
+ dv.setFormatId(fmt.getFormatId());
+ dr.setFormatId(fmt.getFormatId());
+ // break;
+ } // else if*/
+ } // for
+ /*} else {
+ for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter
+ .hasNext();) {
+ FormatType fmt = (FormatType) iter.next();
+ if(fmt.getLessThanValue().length()<=0 && fmt.getExpression().length()<=0 && !fmt.isBold() && !fmt.isItalic() && !fmt.isUnderline() && fmt.getFontSize().equals("11")) {
+ formatter = defaultFormatter;
+ } else
+ formatter = anyFormatter;
+ }
+
+ //formatter.setFormatId(anyFormatter.getFormatId());
+ } */
+ if(formatter != null) {
+ if (semaphore.getSemaphoreType().equals(AppConstants.ST_ROW)) {
+
+ if (dr.getRowFormatter() == null || formatter != defaultFormatter) {
+ // Making sure the default formatter doesn't overwrite
+ // valid row formatter set from another column
+ dr.setRowFormatter(formatter);
+ dr.setFormatId(formatter.getFormatId());
+ // This is added for excel download
+ //if (!formatter.equals(defaultFormatter)) {
+ dr.setRowFormat(true);
+ //}
+
+ }
+ } else {
+ if(nvl(targetColId).length()>0) {
+ if(targetDataValue!=null) {
+ targetDataValue.setCellFormatter(formatter);
+ targetDataValue.setFormatId(formatter.getFormatId());
+ //if (!formatter.equals(defaultFormatter)) {
+ targetDataValue.setCellFormat(true);
+ int count = 0;
+ for (dr.resetNext(); dr.hasNext();) {
+ DataValue dv1 = dr.getNext();
+ //add null check
+ if(targetColId!=null) {
+ if(dv1.getColId().equals(targetColId))
+ dr.setDataValue(count, targetDataValue);
+ }
+ count++;
+ }
+ }
+ //}
+
+ } else {
+ dv.setCellFormatter(formatter);
+ dv.setFormatId(formatter.getFormatId());
+ //if (!formatter.equals(defaultFormatter)) {
+ dv.setCellFormat(true);
+ //}
+ }
+ }// else
+ }
+ } // setHtmlFormatters
+
+} // FormatProcessor
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/Item.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/Item.java
new file mode 100644
index 00000000..1bc3bbba
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/Item.java
@@ -0,0 +1,54 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+public class Item {
+ private String _id;
+ private String _name;
+
+ public Item() {
+ }
+
+ public Item(String id, String name) {
+ this._id = id;
+ this._name = name;
+ }
+
+ public String getId() {
+ return _id;
+ }
+
+ public void setId(String id) {
+ this._id = id;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ this._name = name;
+ }
+
+ public String toString() {
+ return _name;
+ }
+}
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/LookupDBInfo.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/LookupDBInfo.java
new file mode 100644
index 00000000..118356a7
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/LookupDBInfo.java
@@ -0,0 +1,89 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+public class LookupDBInfo extends RaptorObject {
+ private String tableName = null;
+
+ private String fieldName = null;
+
+ private String lookupTable = null;
+
+ private String lookupIdField = null;
+
+ private String lookupNameField = null;
+
+ public LookupDBInfo() {
+ }
+
+ public LookupDBInfo(String tableName, String fieldName, String lookupTable,
+ String lookupIdField, String lookupNameField) {
+ this();
+
+ setTableName(tableName);
+ setFieldName(fieldName);
+ setLookupTable(lookupTable);
+ setLookupIdField(lookupIdField);
+ setLookupNameField(lookupNameField);
+ } // LookupDBInfo
+
+ public String getTableName() {
+ return tableName;
+ }
+
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ public String getLookupTable() {
+ return lookupTable;
+ }
+
+ public String getLookupIdField() {
+ return lookupIdField;
+ }
+
+ public String getLookupNameField() {
+ return lookupNameField;
+ }
+
+ public void setTableName(String tableName) {
+ this.tableName = tableName;
+ }
+
+ public void setFieldName(String fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ public void setLookupTable(String lookupTable) {
+ this.lookupTable = lookupTable;
+ }
+
+ public void setLookupIdField(String lookupIdField) {
+ this.lookupIdField = lookupIdField;
+ }
+
+ public void setLookupNameField(String lookupNameField) {
+ this.lookupNameField = lookupNameField;
+ }
+
+} // LookupDBInfo
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/RangeAxisJSON.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/RangeAxisJSON.java
new file mode 100644
index 00000000..d9e93f55
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/RangeAxisJSON.java
@@ -0,0 +1,93 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+class RangeColorJSON extends IndexValueJSON {}
+class RangeAxisLabelJSON extends IndexValueJSON {}
+class RangeLineTypeJSON extends IndexValueJSON {}
+
+public class RangeAxisJSON {
+
+ private RangeAxisLabelJSON rangeAxisLabelJSON;
+ private RangeColorJSON rangeColorJSON;
+ private RangeLineTypeJSON rangeLineTypeJSON;
+ private String rangeChartGroup;
+ private String rangeYAxis;
+ private boolean showAsArea;
+
+ public RangeAxisLabelJSON getRangeAxisLabelJSON() {
+ return rangeAxisLabelJSON;
+ }
+ public void setRangeAxisLabelJSON(RangeAxisLabelJSON rangeAxisLabelJSON) {
+ this.rangeAxisLabelJSON = rangeAxisLabelJSON;
+ }
+ public RangeColorJSON getRangeColorJSON() {
+ return rangeColorJSON;
+ }
+ public void setRangeColorJSON(RangeColorJSON rangeColorJSON) {
+ this.rangeColorJSON = rangeColorJSON;
+ }
+ public RangeLineTypeJSON getRangeLineTypeJSON() {
+ return rangeLineTypeJSON;
+ }
+ public void setRangeLineTypeJSON(RangeLineTypeJSON rangeLineTypeJSON) {
+ this.rangeLineTypeJSON = rangeLineTypeJSON;
+ }
+ public String getRangeChartGroup() {
+ return rangeChartGroup;
+ }
+ public void setRangeChartGroup(String rangeChartGroup) {
+ this.rangeChartGroup = rangeChartGroup;
+ }
+ public String getRangeYAxis() {
+ return rangeYAxis;
+ }
+ public void setRangeYAxis(String rangeYAxis) {
+ this.rangeYAxis = rangeYAxis;
+ }
+ public boolean isShowAsArea() {
+ return showAsArea;
+ }
+ public void setShowAsArea(boolean showAsArea) {
+ this.showAsArea = showAsArea;
+ }
+
+ public String getRangeAxis() {
+ if(getRangeAxisLabelJSON()!=null)
+ return getRangeAxisLabelJSON().getValue();
+ else
+ return "";
+ }
+
+ public String getRangeColor(){
+ if(getRangeColorJSON()!=null)
+ return getRangeColorJSON().getValue();
+ else
+ return "";
+ }
+
+ public String getRangeLineType(){
+ if(getRangeLineTypeJSON()!=null)
+ return getRangeLineTypeJSON().getValue();
+ else
+ return "";
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportFormFields.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportFormFields.java
new file mode 100644
index 00000000..7e185618
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportFormFields.java
@@ -0,0 +1,366 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.model.DataCache;
+import org.openecomp.portalsdk.analytics.model.base.ReportWrapper;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.xmlobj.ColFilterType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType;
+
+public class ReportFormFields extends Vector {
+ private int nextElemIdx = 0;
+
+ public ReportFormFields(ReportWrapper rw, HttpServletRequest request) throws RaptorException {
+ super();
+
+ if (rw.getFormFieldList() != null)
+ for (Iterator iter = rw.getFormFieldList().getFormField().iterator(); iter
+ .hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+
+ String fieldName = fft.getFieldId();
+ String fieldDisplayName = fft.getFieldName();
+ String fieldType = fft.getFieldType();
+ String validationType = fft.getValidationType();
+ String mandatory = nvl(fft.getMandatory(), "N");
+ String defaultValue = fft.getDefaultValue();
+ String fieldSQL = fft.getFieldSQL();
+ String fieldDefaultSQL = fft.getFieldDefaultSQL();
+ String[] reqParameters = Globals.getRequestParams().split(",");
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ String[] scheduleSessionParameters = Globals.getSessionParamsForScheduling().split(",");
+ javax.servlet.http.HttpSession session = request.getSession();
+ String visible = nvl(fft.getVisible(),"Y");
+ String dependsOn = nvl(fft.getDependsOn(), "");
+ Calendar rangeStartDate = (fft.getRangeStartDate()==null)?null:fft.getRangeStartDate().toGregorianCalendar();
+ Calendar rangeEndDate = (fft.getRangeEndDate()==null)?null:fft.getRangeEndDate().toGregorianCalendar();
+ //Calendar rangeEndDate = fft.getRangeEndDate().toGregorianCalendar();
+ String rangeStartDateSQL = fft.getRangeStartDateSQL();
+ String rangeEndDateSQL = fft.getRangeEndDateSQL();
+ String user_id = AppUtils.getUserID(request);
+ String multiSelectListSize = fft.getMultiSelectListSize();
+
+ //s_logger.debug("ranges are : " + fft.getRangeStartDate() + fft.getRangeEndDate());
+ //s_logger.debug("fieldSQL B4" + fieldSQL);
+ if(fieldSQL!=null) {
+ for (int i = 0; i < reqParameters.length; i++) {
+ if(!reqParameters[i].startsWith("ff") && (request.getParameter(reqParameters[i].toUpperCase())!=null && request.getParameter(reqParameters[i].toUpperCase()).length() > 0))
+ fieldSQL = Utils.replaceInString(fieldSQL, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) );
+ else if (request.getParameter(reqParameters[i])!=null && request.getParameter(reqParameters[i]).length() > 0)
+ fieldSQL = Utils.replaceInString(fieldSQL, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) );
+ }
+
+ for (int i = 0; i < scheduleSessionParameters.length; i++) {
+ //s_logger.debug(" Session " + " scheduleSessionParameters[i] " + scheduleSessionParameters[i].toUpperCase() + " " + request.getParameter(scheduleSessionParameters[i]));
+ if(request.getParameter(scheduleSessionParameters[i])!=null && request.getParameter(scheduleSessionParameters[i]).trim().length()>0 )
+ fieldSQL = Utils.replaceInString(fieldSQL, "[" + scheduleSessionParameters[i].toUpperCase()+"]", request.getParameter(scheduleSessionParameters[i]) );
+ if(request.getAttribute(scheduleSessionParameters[i])!=null && ((String)request.getAttribute(scheduleSessionParameters[i])).trim().length()>0 )
+ fieldSQL = Utils.replaceInString(fieldSQL, "[" + scheduleSessionParameters[i].toUpperCase()+"]", (String) request.getAttribute(scheduleSessionParameters[i]) );
+
+ }
+
+ for (int i = 0; i < sessionParameters.length; i++) {
+ //if(!sessionParameters[i].startsWith("ff"))
+ //fieldSQL = Utils.replaceInString(fieldSQL, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i].toUpperCase()) );
+ //else {
+ if (session.getAttribute(sessionParameters[i])!=null && ((String)session.getAttribute(sessionParameters[i])).length() > 0) {
+ //s_logger.debug(" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i]));
+ fieldSQL = Utils.replaceInString(fieldSQL, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ }
+ // }
+ }
+ fieldSQL = Utils.replaceInString(fieldSQL, "[USERID]", user_id);
+ fieldSQL = Utils.replaceInString(fieldSQL, "[USER_ID]", user_id);
+ fieldSQL = Utils.replaceInString(fieldSQL, "[LOGGED_USERID]", user_id);
+
+ }
+
+ if(fieldDefaultSQL!=null) {
+ for (int i = 0; i < reqParameters.length; i++) {
+ if(!reqParameters[i].startsWith("ff") && (request.getParameter(reqParameters[i].toUpperCase())!=null && request.getParameter(reqParameters[i].toUpperCase()).length() > 0))
+ fieldDefaultSQL = Utils.replaceInString(fieldDefaultSQL, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) );
+ else if (request.getParameter(reqParameters[i])!=null && request.getParameter(reqParameters[i]).length() > 0)
+ fieldDefaultSQL = Utils.replaceInString(fieldDefaultSQL, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) );
+ }
+ for (int i = 0; i < scheduleSessionParameters.length; i++) {
+ //s_logger.debug(" Session " + " scheduleSessionParameters[i] " + scheduleSessionParameters[i].toUpperCase() + " " + request.getParameter(scheduleSessionParameters[i]));
+ if(request.getParameter(scheduleSessionParameters[i])!=null && request.getParameter(scheduleSessionParameters[i]).trim().length()>0 )
+ fieldDefaultSQL = Utils.replaceInString(fieldDefaultSQL, "[" + scheduleSessionParameters[i].toUpperCase()+"]", request.getParameter(scheduleSessionParameters[i]) );
+ if(request.getAttribute(scheduleSessionParameters[i])!=null && ((String)request.getAttribute(scheduleSessionParameters[i])).trim().length()>0 )
+ fieldDefaultSQL = Utils.replaceInString(fieldDefaultSQL, "[" + scheduleSessionParameters[i].toUpperCase()+"]", (String) request.getAttribute(scheduleSessionParameters[i]) );
+
+ }
+
+ for (int i = 0; i < sessionParameters.length; i++) {
+ //if(!sessionParameters[i].startsWith("ff"))
+ //fieldDefaultSQL = Utils.replaceInString(fieldDefaultSQL, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i].toUpperCase()) );
+ //else
+ if (session.getAttribute(sessionParameters[i])!=null && ((String)session.getAttribute(sessionParameters[i])).length() > 0)
+ fieldDefaultSQL = Utils.replaceInString(fieldDefaultSQL, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ }
+
+ fieldDefaultSQL = Utils.replaceInString(fieldDefaultSQL, "[USERID]", user_id);
+ fieldDefaultSQL = Utils.replaceInString(fieldDefaultSQL, "[USER_ID]", user_id);
+ fieldDefaultSQL = Utils.replaceInString(fieldDefaultSQL, "[LOGGED_USERID]", user_id);
+ }
+ //s_logger.debug("fieldSQL After" + fieldSQL);
+ if(rangeStartDateSQL!=null) {
+ for (int i = 0; i < reqParameters.length; i++) {
+ if(!reqParameters[i].startsWith("ff") && (request.getParameter(reqParameters[i].toUpperCase())!=null && request.getParameter(reqParameters[i].toUpperCase()).length() > 0))
+ rangeStartDateSQL = Utils.replaceInString(rangeStartDateSQL, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) );
+ else if (request.getParameter(reqParameters[i])!=null && request.getParameter(reqParameters[i]).length() > 0)
+ rangeStartDateSQL = Utils.replaceInString(rangeStartDateSQL, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) );
+ }
+ for (int i = 0; i < sessionParameters.length; i++) {
+ if (session.getAttribute(sessionParameters[i])!=null && ((String)session.getAttribute(sessionParameters[i])).length() > 0)
+ rangeStartDateSQL = Utils.replaceInString(rangeStartDateSQL, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ }
+ }
+ if(rangeEndDateSQL!=null) {
+ for (int i = 0; i < reqParameters.length; i++) {
+ if(!reqParameters[i].startsWith("ff")&& (request.getParameter(reqParameters[i].toUpperCase())!=null && request.getParameter(reqParameters[i].toUpperCase()).length() > 0))
+ rangeEndDateSQL = Utils.replaceInString(rangeEndDateSQL, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) );
+ else if (request.getParameter(reqParameters[i])!=null && request.getParameter(reqParameters[i]).length() > 0)
+ rangeEndDateSQL = Utils.replaceInString(rangeEndDateSQL, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) );
+ }
+ for (int i = 0; i < sessionParameters.length; i++) {
+ if (session.getAttribute(sessionParameters[i])!=null && ((String)session.getAttribute(sessionParameters[i])).length() > 0)
+ rangeEndDateSQL = Utils.replaceInString(rangeEndDateSQL, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ }
+ }
+ String helpText = fft.getComment();
+
+ List predefinedValues = null;
+ if (fft.getPredefinedValueList() != null) {
+ predefinedValues = fft.getPredefinedValueList().getPredefinedValue();
+ if (predefinedValues.size() == 0)
+ predefinedValues = null;
+ } // if
+
+ DataColumnType dct = rw.getColumnById(nvl(fft.getColId()));
+
+ boolean basedOnColumn = false;
+ if (rw.getReportDefType().equals(AppConstants.RD_SQL_BASED))
+ basedOnColumn = (nvl(fft.getColId()).indexOf('.') > 0);
+ else
+ basedOnColumn = (dct != null);
+
+ if (((!basedOnColumn) && (nvl(fieldSQL).length() == 0))
+ || predefinedValues != null) {
+ if (predefinedValues != null)
+ if (nvl(defaultValue).equals(AppConstants.FILTER_MAX_VALUE))
+ defaultValue = (String) Collections.max(predefinedValues);
+ else if (nvl(defaultValue).equals(AppConstants.FILTER_MIN_VALUE))
+ defaultValue = (String) Collections.min(predefinedValues);
+ add(new FormField(fieldName, fieldDisplayName, fieldType, validationType,
+ mandatory.equals("Y"), defaultValue, helpText, predefinedValues,visible.equals("Y"), dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize));
+ } else if (nvl(fieldSQL).length() > 0) {
+ add(new FormField(fieldName, fieldDisplayName, fieldType, validationType,
+ mandatory.equals("Y"), fieldDefaultSQL, helpText, fieldSQL,visible.equals("Y"), dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize));
+ } else {
+ String lTableName = null;
+ String lColumnName = null;
+ String lColumnType = null;
+ String lColFormat = null;
+ if (rw.getReportDefType().equals(AppConstants.RD_SQL_BASED)) {
+ String colId = nvl(fft.getColId());
+ lTableName = ReportWrapper.getSQLBasedFFTColTableName(colId); // colId.substring(0,
+ // colId.indexOf('.'));
+ lColumnName = ReportWrapper.getSQLBasedFFTColColumnName(colId); // colId.substring(colId.lastIndexOf('.')+1);
+ lColumnType = AppConstants.CT_CHAR;
+ try {
+ lColumnType = nvl(DataCache.getReportTableDbColumnType(lTableName,
+ lColumnName, rw.getDBInfo()), AppConstants.CT_CHAR);
+ } catch (Exception e) {
+ }
+ lColFormat = lColumnType.equals(AppConstants.CT_DATE) ? nvl(
+ ReportWrapper.getSQLBasedFFTColDisplayFormat(colId),
+ AppConstants.DEFAULT_DATE_FORMAT) : "";
+ } else {
+ lTableName = rw.getColumnTableById(dct.getColId()).getTableName(); // should
+ // be
+ // same
+ // as
+ // rw.getTableById(dct.getTableId()).getTableName()
+ lColumnName = dct.getColName();
+ lColumnType = dct.getColType();
+ lColFormat = nvl(dct.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT);
+ } // else
+
+ if (nvl(defaultValue).equals(AppConstants.FILTER_MAX_VALUE)
+ || nvl(defaultValue).equals(AppConstants.FILTER_MIN_VALUE))
+ try {
+ String selectVal = (defaultValue
+ .equals(AppConstants.FILTER_MAX_VALUE) ? "MAX" : "MIN")
+ + "(" + lColumnName + ")";
+ if (lColumnType.equals(AppConstants.CT_DATE))
+ selectVal = "TO_CHAR(" + selectVal + ", '"
+ + AppConstants.DEFAULT_DATE_FORMAT + "')";
+ // DataSet ds = DbUtils.executeQuery("SELECT
+ // "+selectVal+" FROM "+lTableName);
+ DataSet ds = ConnectionUtils.getDataSet("SELECT " + selectVal
+ + " FROM " + lTableName, rw.getDBInfo());
+ if (ds.getRowCount() > 0)
+ defaultValue = ds.getString(0, 0);
+ } catch (Exception e) {
+ }
+
+ LookupDBInfo lookupDBInfo = DataCache.getLookupTable(lTableName,
+ lColumnName);
+ String lookupTable = lookupDBInfo.getLookupTable();
+ String lookupIdField = lookupDBInfo.getLookupIdField();
+ String lookupNameField = lookupDBInfo.getLookupNameField();
+ String lookupSortByField = lookupDBInfo.getLookupNameField();
+ if (lColumnType.equals(AppConstants.CT_DATE)) {
+ // Expects lookup on DATE fields will have both Id and
+ // Name fields with DATE format; if not the case will
+ // generate an error
+ lookupIdField = "TO_CHAR(" + lookupIdField + ", '"
+ + AppConstants.DEFAULT_DATE_FORMAT + "')";
+ lookupSortByField = " TO_DATE(TO_CHAR("+ lookupNameField +", '" + AppConstants.DEFAULT_DATE_FORMAT+ "'),'" + AppConstants.DEFAULT_DATE_FORMAT+ "') ";
+ lookupNameField = "TO_CHAR(" + lookupNameField + ", '" + lColFormat
+ + "')";
+ lookupSortByField += " DESC";
+ } // if
+ if (fieldDefaultSQL!=null && fieldDefaultSQL.length()>0 && (fieldDefaultSQL.trim().length()>10) && fieldDefaultSQL.substring(0,10).toLowerCase().startsWith("select")) {
+ add(new FormField(fieldName, fieldDisplayName, fieldType, validationType,
+ mandatory.equals("Y"), fieldDefaultSQL, helpText, lookupTable,
+ lookupIdField, lookupNameField, lookupSortByField,visible.equals("Y"),dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize));
+
+ } else {
+ add(new FormField(fieldName, fieldDisplayName, fieldType, validationType,
+ mandatory.equals("Y"), defaultValue, helpText, lookupTable,
+ lookupIdField, lookupNameField, lookupSortByField,visible.equals("Y"), dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize));
+ }
+ } // else
+ } // for
+
+ List reportCols = rw.getAllColumns();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if (dct.getColFilterList() != null) {
+ int fNo = 0;
+ List fList = dct.getColFilterList().getColFilter();
+ for (Iterator iterF = fList.iterator(); iterF.hasNext(); fNo++) {
+ ColFilterType cft = (ColFilterType) iterF.next();
+
+ if (nvl(cft.getArgType()).equals(AppConstants.AT_FORM)
+ && rw.getFormFieldByDisplayValue(cft.getArgValue()) == null) {
+ String fieldName = rw.getFormFieldName(cft);
+ String fieldDisplayName = rw.getFormFieldDisplayName(dct, cft);
+
+ LookupDBInfo lookupDBInfo = DataCache.getLookupTable(rw
+ .getColumnTableById(dct.getColId()).getTableName(), dct
+ .getColName());
+ String lookupTable = lookupDBInfo.getLookupTable();
+ String lookupIdField = lookupDBInfo.getLookupIdField();
+ String lookupNameField = lookupDBInfo.getLookupNameField();
+ String lookupSortByField = lookupDBInfo.getLookupNameField();
+ Calendar lookupRangeStartDate = rw.getFormFieldRangeStart(cft);
+ Calendar lookupRangeEndDate = rw.getFormFieldRangeEnd(cft);
+ String lookupRangeStartDateSQL = rw.getFormFieldRangeStartSQL(cft);
+ String lookupRangeEndDateSQL = rw.getFormFieldRangeEndSQL(cft);
+ if (dct.getColType().equals(AppConstants.CT_DATE)) {
+ // Expects lookup on DATE fields will have both Id
+ // and Name fields with DATE format; if not the case
+ // will generate an error
+ lookupIdField = "TO_CHAR("
+ + lookupIdField
+ + ", '"
+ + nvl(dct.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT)
+ + "')";
+ lookupNameField = "TO_CHAR("
+ + lookupNameField
+ + ", '"
+ + nvl(dct.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT)
+ + "')";
+ lookupSortByField += " DESC";
+ } // if
+ add(new FormField(fieldName, fieldDisplayName,
+ FormField.FFT_TEXT_W_POPUP, null, false, null, null,
+ lookupTable, lookupIdField, lookupNameField, lookupSortByField,null, lookupRangeStartDate, lookupRangeEndDate, lookupRangeStartDateSQL, lookupRangeEndDateSQL, "0"));
+ } // if
+ } // for
+ } // if
+ } // for
+ } // ReportFormFields
+
+ public int getFieldCount() {
+ return size();
+ } // getFieldCount
+
+ public FormField getFormField(int fieldIdx) {
+ return (FormField) get(fieldIdx);
+ } // getFormField
+
+ public FormField getFormField(String fieldName) {
+ for (int i = 0; i < getFieldCount(); i++) {
+ FormField ff = (FormField) get(i);
+ if (ff.getFieldName().equals(fieldName))
+ return ff;
+ } // for
+
+ return null;
+ } // getFormField
+
+ public void resetNext() {
+ resetNext(0);
+ } // resetNext
+
+ public void resetNext(int toPos) {
+ nextElemIdx = toPos;
+ } // resetNext
+
+ public boolean hasNext() {
+ return (nextElemIdx < size());
+ } // hasNext
+
+ public FormField getNext() {
+ return hasNext() ? getFormField(nextElemIdx++) : null;
+ } // getNext
+
+ /** ************************************************************************************************* */
+
+ private String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ private String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+} // ReportFormFields
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportJSONRuntime.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportJSONRuntime.java
new file mode 100644
index 00000000..7556a310
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportJSONRuntime.java
@@ -0,0 +1,694 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Map;
+
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.view.ColumnHeader;
+
+/*class MetaColumn {
+ private String tableId;
+ private String dbColName;
+ private String crossTabValue;
+ private String colName;
+ private String displayName;
+ private Integer displayWidth;
+ private String displayWidthInPxls;
+ private String pdfDisplayWidthInPxls;
+ private String displayAlignment;
+ private String displayHeaderAlignment;
+ private int orderSeq;
+ private boolean visible;
+ private boolean calculated;
+ private String colType;
+ private String hyperlinkURL;
+ private String hyperlinkType;
+ private String actionImg;
+ private Integer groupByPos;
+ private String subTotalCustomText;
+ private Boolean hideRepeatedKey;
+ private String colFormat;
+ private boolean groupBreak;
+ private Integer orderBySeq;
+ private String orderByAscDesc;
+ private String displayTotal;
+ private String colOnChart;
+ private Integer chartSeq;
+ private String chartColor;
+ private String chartLineType;
+ private Boolean chartSeries;
+ private Boolean isRangeAxisFilled;
+ private Boolean createInNewChart;
+ private String drillDownType;
+ private Boolean drillinPoPUp;
+ private String drillDownURL;
+ private String drillDownParams;
+ private String comment;
+ private ColFilterList colFilterList;
+ private String semaphoreId;
+ private String dbColType;
+ private String chartGroup;
+ private String yAxis;
+ private String dependsOnFormField;
+ private String nowrap;
+ private Integer indentation;
+ private Boolean enhancedPagination;
+ private Integer level;
+ private Integer start;
+ private Integer colspan;
+ private String dataMiningCol;
+ private String colId;
+
+ public String getTableId() {
+ return tableId;
+ }
+ public void setTableId(String tableId) {
+ this.tableId = tableId;
+ }
+ public String getDbColName() {
+ return dbColName;
+ }
+ public void setDbColName(String dbColName) {
+ this.dbColName = dbColName;
+ }
+ public String getCrossTabValue() {
+ return crossTabValue;
+ }
+ public void setCrossTabValue(String crossTabValue) {
+ this.crossTabValue = crossTabValue;
+ }
+ public String getColName() {
+ return colName;
+ }
+ public void setColName(String colName) {
+ this.colName = colName;
+ }
+ public String getDisplayName() {
+ return displayName;
+ }
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+ public Integer getDisplayWidth() {
+ return displayWidth;
+ }
+ public void setDisplayWidth(Integer displayWidth) {
+ this.displayWidth = displayWidth;
+ }
+ public String getDisplayWidthInPxls() {
+ return displayWidthInPxls;
+ }
+ public void setDisplayWidthInPxls(String displayWidthInPxls) {
+ this.displayWidthInPxls = displayWidthInPxls;
+ }
+ public String getPdfDisplayWidthInPxls() {
+ return pdfDisplayWidthInPxls;
+ }
+ public void setPdfDisplayWidthInPxls(String pdfDisplayWidthInPxls) {
+ this.pdfDisplayWidthInPxls = pdfDisplayWidthInPxls;
+ }
+ public String getDisplayAlignment() {
+ return displayAlignment;
+ }
+ public void setDisplayAlignment(String displayAlignment) {
+ this.displayAlignment = displayAlignment;
+ }
+ public String getDisplayHeaderAlignment() {
+ return displayHeaderAlignment;
+ }
+ public void setDisplayHeaderAlignment(String displayHeaderAlignment) {
+ this.displayHeaderAlignment = displayHeaderAlignment;
+ }
+ public int getOrderSeq() {
+ return orderSeq;
+ }
+ public void setOrderSeq(int orderSeq) {
+ this.orderSeq = orderSeq;
+ }
+ public boolean isVisible() {
+ return visible;
+ }
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+ public boolean isCalculated() {
+ return calculated;
+ }
+ public void setCalculated(boolean calculated) {
+ this.calculated = calculated;
+ }
+ public String getColType() {
+ return colType;
+ }
+ public void setColType(String colType) {
+ this.colType = colType;
+ }
+ public String getHyperlinkURL() {
+ return hyperlinkURL;
+ }
+ public void setHyperlinkURL(String hyperlinkURL) {
+ this.hyperlinkURL = hyperlinkURL;
+ }
+ public String getHyperlinkType() {
+ return hyperlinkType;
+ }
+ public void setHyperlinkType(String hyperlinkType) {
+ this.hyperlinkType = hyperlinkType;
+ }
+ public String getActionImg() {
+ return actionImg;
+ }
+ public void setActionImg(String actionImg) {
+ this.actionImg = actionImg;
+ }
+ public Integer getGroupByPos() {
+ return groupByPos;
+ }
+ public void setGroupByPos(Integer groupByPos) {
+ this.groupByPos = groupByPos;
+ }
+ public String getSubTotalCustomText() {
+ return subTotalCustomText;
+ }
+ public void setSubTotalCustomText(String subTotalCustomText) {
+ this.subTotalCustomText = subTotalCustomText;
+ }
+ public Boolean getHideRepeatedKey() {
+ return hideRepeatedKey;
+ }
+ public void setHideRepeatedKey(Boolean hideRepeatedKey) {
+ this.hideRepeatedKey = hideRepeatedKey;
+ }
+ public String getColFormat() {
+ return colFormat;
+ }
+ public void setColFormat(String colFormat) {
+ this.colFormat = colFormat;
+ }
+ public boolean isGroupBreak() {
+ return groupBreak;
+ }
+ public void setGroupBreak(boolean groupBreak) {
+ this.groupBreak = groupBreak;
+ }
+ public Integer getOrderBySeq() {
+ return orderBySeq;
+ }
+ public void setOrderBySeq(Integer orderBySeq) {
+ this.orderBySeq = orderBySeq;
+ }
+ public String getOrderByAscDesc() {
+ return orderByAscDesc;
+ }
+ public void setOrderByAscDesc(String orderByAscDesc) {
+ this.orderByAscDesc = orderByAscDesc;
+ }
+ public String getDisplayTotal() {
+ return displayTotal;
+ }
+ public void setDisplayTotal(String displayTotal) {
+ this.displayTotal = displayTotal;
+ }
+ public String getColOnChart() {
+ return colOnChart;
+ }
+ public void setColOnChart(String colOnChart) {
+ this.colOnChart = colOnChart;
+ }
+ public Integer getChartSeq() {
+ return chartSeq;
+ }
+ public void setChartSeq(Integer chartSeq) {
+ this.chartSeq = chartSeq;
+ }
+ public String getChartColor() {
+ return chartColor;
+ }
+ public void setChartColor(String chartColor) {
+ this.chartColor = chartColor;
+ }
+ public String getChartLineType() {
+ return chartLineType;
+ }
+ public void setChartLineType(String chartLineType) {
+ this.chartLineType = chartLineType;
+ }
+ public Boolean getChartSeries() {
+ return chartSeries;
+ }
+ public void setChartSeries(Boolean chartSeries) {
+ this.chartSeries = chartSeries;
+ }
+ public Boolean getIsRangeAxisFilled() {
+ return isRangeAxisFilled;
+ }
+ public void setIsRangeAxisFilled(Boolean isRangeAxisFilled) {
+ this.isRangeAxisFilled = isRangeAxisFilled;
+ }
+ public Boolean getCreateInNewChart() {
+ return createInNewChart;
+ }
+ public void setCreateInNewChart(Boolean createInNewChart) {
+ this.createInNewChart = createInNewChart;
+ }
+ public String getDrillDownType() {
+ return drillDownType;
+ }
+ public void setDrillDownType(String drillDownType) {
+ this.drillDownType = drillDownType;
+ }
+ public Boolean getDrillinPoPUp() {
+ return drillinPoPUp;
+ }
+ public void setDrillinPoPUp(Boolean drillinPoPUp) {
+ this.drillinPoPUp = drillinPoPUp;
+ }
+ public String getDrillDownURL() {
+ return drillDownURL;
+ }
+ public void setDrillDownURL(String drillDownURL) {
+ this.drillDownURL = drillDownURL;
+ }
+ public String getDrillDownParams() {
+ return drillDownParams;
+ }
+ public void setDrillDownParams(String drillDownParams) {
+ this.drillDownParams = drillDownParams;
+ }
+ public String getComment() {
+ return comment;
+ }
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+ public ColFilterList getColFilterList() {
+ return colFilterList;
+ }
+ public void setColFilterList(ColFilterList colFilterList) {
+ this.colFilterList = colFilterList;
+ }
+ public String getSemaphoreId() {
+ return semaphoreId;
+ }
+ public void setSemaphoreId(String semaphoreId) {
+ this.semaphoreId = semaphoreId;
+ }
+ public String getDbColType() {
+ return dbColType;
+ }
+ public void setDbColType(String dbColType) {
+ this.dbColType = dbColType;
+ }
+ public String getChartGroup() {
+ return chartGroup;
+ }
+ public void setChartGroup(String chartGroup) {
+ this.chartGroup = chartGroup;
+ }
+ public String getyAxis() {
+ return yAxis;
+ }
+ public void setyAxis(String yAxis) {
+ this.yAxis = yAxis;
+ }
+ public String getDependsOnFormField() {
+ return dependsOnFormField;
+ }
+ public void setDependsOnFormField(String dependsOnFormField) {
+ this.dependsOnFormField = dependsOnFormField;
+ }
+ public String getNowrap() {
+ return nowrap;
+ }
+ public void setNowrap(String nowrap) {
+ this.nowrap = nowrap;
+ }
+ public Integer getIndentation() {
+ return indentation;
+ }
+ public void setIndentation(Integer indentation) {
+ this.indentation = indentation;
+ }
+ public Boolean getEnhancedPagination() {
+ return enhancedPagination;
+ }
+ public void setEnhancedPagination(Boolean enhancedPagination) {
+ this.enhancedPagination = enhancedPagination;
+ }
+ public Integer getLevel() {
+ return level;
+ }
+ public void setLevel(Integer level) {
+ this.level = level;
+ }
+ public Integer getStart() {
+ return start;
+ }
+ public void setStart(Integer start) {
+ this.start = start;
+ }
+ public Integer getColspan() {
+ return colspan;
+ }
+ public void setColspan(Integer colspan) {
+ this.colspan = colspan;
+ }
+ public String getDataMiningCol() {
+ return dataMiningCol;
+ }
+ public void setDataMiningCol(String dataMiningCol) {
+ this.dataMiningCol = dataMiningCol;
+ }
+ public String getColId() {
+ return colId;
+ }
+ public void setColId(String colId) {
+ this.colId = colId;
+ }
+
+}*/
+
+/*class Row {
+ private String displayValue;
+ private String dataType;
+ private String colId;
+ private boolean visible;
+
+
+ public boolean isVisible() {
+ return visible;
+ }
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+ public String getDisplayValue() {
+ return displayValue;
+ }
+ public void setDisplayValue(String displayValue) {
+ this.displayValue = displayValue;
+ }
+ public String getDataType() {
+ return dataType;
+ }
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+ public String getColId() {
+ return colId;
+ }
+ public void setColId(String colId) {
+ this.colId = colId;
+ }
+
+
+}*/
+class FormFieldJSON {
+ private String fieldId;
+ private String fieldDisplayName;
+ private String fieldType;
+ private String validationType;
+ private boolean required;
+ //private String defaultValue;
+
+ private Calendar rangeStartDate;
+ private Calendar rangeEndDate;
+ private String multiSelectListSize;
+ private String helpText;
+ private boolean visible;
+ private boolean triggerOtherFormFields;
+ private ArrayList<IdNameValue> formFieldValues;
+
+ public String getFieldId() {
+ return fieldId;
+ }
+ public void setFieldId(String fieldId) {
+ this.fieldId = fieldId;
+ }
+ public String getFieldDisplayName() {
+ return fieldDisplayName;
+ }
+ public void setFieldDisplayName(String fieldDisplayName) {
+ this.fieldDisplayName = fieldDisplayName;
+ }
+ public String getFieldType() {
+ return fieldType;
+ }
+ public void setFieldType(String fieldType) {
+ this.fieldType = fieldType;
+ }
+ public String getValidationType() {
+ return validationType;
+ }
+ public void setValidationType(String validationType) {
+ this.validationType = validationType;
+ }
+ public boolean isRequired() {
+ return required;
+ }
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+ public Calendar getRangeStartDate() {
+ return rangeStartDate;
+ }
+ public void setRangeStartDate(Calendar rangeStartDate) {
+ this.rangeStartDate = rangeStartDate;
+ }
+ public Calendar getRangeEndDate() {
+ return rangeEndDate;
+ }
+ public void setRangeEndDate(Calendar rangeEndDate) {
+ this.rangeEndDate = rangeEndDate;
+ }
+ public String getMultiSelectListSize() {
+ return multiSelectListSize;
+ }
+ public void setMultiSelectListSize(String multiSelectListSize) {
+ this.multiSelectListSize = multiSelectListSize;
+ }
+ public String getHelpText() {
+ return helpText;
+ }
+ public void setHelpText(String helpText) {
+ this.helpText = helpText;
+ }
+ public boolean isVisible() {
+ return visible;
+ }
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+ public boolean isTriggerOtherFormFields() {
+ return triggerOtherFormFields;
+ }
+ public void setTriggerOtherFormFields(boolean triggerOtherFormFields) {
+ this.triggerOtherFormFields = triggerOtherFormFields;
+ }
+ public ArrayList<IdNameValue> getFormFieldValues() {
+ return formFieldValues;
+ }
+ public void setFormFieldValues(ArrayList<IdNameValue> formFieldValues) {
+ this.formFieldValues = formFieldValues;
+ }
+
+
+}
+public class ReportJSONRuntime {
+
+ private String reportID;
+ private String reportName;
+ private String reportDescr;
+ private String reportTitle;
+ private String reportSubTitle;
+ private boolean allowSchedule;
+ private boolean allowEdit;
+ private ArrayList <FormFieldJSON> formFieldList;
+ private String formfield_comments;
+ private ArrayList<ColumnHeader> reportDataColumns;
+ private ArrayList<Map<String,Object>> reportDataRows;
+ private int totalRows;
+ private int pageSize;
+ private String sqlWhole;
+ private boolean chartAvailable;
+ private boolean chartWizardAvailable;
+ private boolean displayData;
+ private boolean displayForm;
+ private boolean displayExcel;
+ private boolean displayPDF;
+ private String backBtnURL;
+ private String colIdxTobeFreezed;
+ private int numFormCols;
+ private String message;
+
+
+ public boolean isChartAvailable() {
+ return chartAvailable;
+ }
+ public void setChartAvailable(boolean chartAvailable) {
+ this.chartAvailable = chartAvailable;
+ }
+ public ArrayList<Map<String,Object>> getReportDataRows() {
+ return reportDataRows;
+ }
+ public void setReportDataRows(ArrayList<Map<String,Object>> reportDataRows) {
+ this.reportDataRows = reportDataRows;
+ }
+ public String getReportID() {
+ return reportID;
+ }
+ public void setReportID(String reportID) {
+ this.reportID = reportID;
+ }
+ public String getReportName() {
+ return reportName;
+ }
+ public void setReportName(String reportName) {
+ this.reportName = reportName;
+ }
+ public String getReportDescr() {
+ return reportDescr;
+ }
+ public void setReportDescr(String reportDescr) {
+ this.reportDescr = reportDescr;
+ }
+ public String getReportTitle() {
+ return reportTitle;
+ }
+ public void setReportTitle(String reportTitle) {
+ this.reportTitle = reportTitle;
+ }
+ public String getReportSubTitle() {
+ return reportSubTitle;
+ }
+ public void setReportSubTitle(String reportSubTitle) {
+ this.reportSubTitle = reportSubTitle;
+ }
+ public boolean isAllowSchedule() {
+ return allowSchedule;
+ }
+ public void setAllowSchedule(boolean allowSchedule) {
+ this.allowSchedule = allowSchedule;
+ }
+ public ArrayList getFormFieldList() {
+ return formFieldList;
+ }
+ public void setFormFieldList(ArrayList formFieldList) {
+ this.formFieldList = formFieldList;
+ }
+ public String getFormfield_comments() {
+ return formfield_comments;
+ }
+ public void setFormfield_comments(String formfield_comments) {
+ this.formfield_comments = formfield_comments;
+ }
+ public ArrayList<ColumnHeader> getReportDataColumns() {
+ return reportDataColumns;
+ }
+ public void setReportDataColumns(ArrayList<ColumnHeader> reportDataColumns) {
+ this.reportDataColumns = reportDataColumns;
+ }
+
+ public int getTotalRows() {
+ return totalRows;
+ }
+ public void setTotalRows(int totalRows) {
+ this.totalRows = totalRows;
+ }
+ public int getPageSize() {
+ return pageSize;
+ }
+ public void setPageSize(int pageSize) {
+ this.pageSize = pageSize;
+ }
+ public String getSqlWhole() {
+ return sqlWhole;
+ }
+ public void setSqlWhole(String sqlWhole) {
+ this.sqlWhole = sqlWhole;
+ }
+
+ public boolean isAllowEdit() {
+ return allowEdit;
+ }
+ public void setAllowEdit(boolean allowEdit) {
+ this.allowEdit = allowEdit;
+ }
+ public String getBackBtnURL() {
+ return backBtnURL;
+ }
+ public void setBackBtnURL(String backBtnURL) {
+ this.backBtnURL = backBtnURL;
+ }
+ public String getColIdxTobeFreezed() {
+ return colIdxTobeFreezed;
+ }
+ public void setColIdxTobeFreezed(String colIdxTobeFreezed) {
+ this.colIdxTobeFreezed = colIdxTobeFreezed;
+ }
+ public int getNumFormCols() {
+ return numFormCols;
+ }
+ public void setNumFormCols(int numFormCols) {
+ this.numFormCols = numFormCols;
+ }
+ public boolean isDisplayData() {
+ return displayData;
+ }
+ public void setDisplayData(boolean displayData) {
+ this.displayData = displayData;
+ }
+ public boolean isDisplayForm() {
+ return displayForm;
+ }
+ public void setDisplayForm(boolean displayForm) {
+ this.displayForm = displayForm;
+ }
+ public boolean isDisplayExcel() {
+ return displayExcel;
+ }
+ public void setDisplayExcel(boolean displayExcel) {
+ this.displayExcel = displayExcel;
+ }
+ public boolean isDisplayPDF() {
+ return displayPDF;
+ }
+ public void setDisplayPDF(boolean displayPDF) {
+ this.displayPDF = displayPDF;
+ }
+ public String getMessage() {
+ return message;
+ }
+ public void setMessage(String message) {
+ this.message = message;
+ }
+ public boolean isChartWizardAvailable() {
+ return chartWizardAvailable;
+ }
+ public void setChartWizardAvailable(boolean chartWizardAvilable) {
+ this.chartWizardAvailable = chartWizardAvilable;
+ }
+
+
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamDateValueParser.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamDateValueParser.java
new file mode 100644
index 00000000..e3bbe4d0
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamDateValueParser.java
@@ -0,0 +1,194 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.Utils;
+
+public class ReportParamDateValueParser {
+
+ /*public static final SimpleDateFormat[] dateFormats;
+
+ static {
+ dateFormats = new SimpleDateFormat[5];
+ (dateFormats[0] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MONTHYYYY))
+ .setLenient(true);
+ (dateFormats[1] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MONTHDDYYYY))
+ .setLenient(true);
+ (dateFormats[2] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MMDDYYYY))
+ .setLenient(true);
+ (dateFormats[3] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MMYYYY))
+ .setLenient(true);
+ (dateFormats[4] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_DDMONYYYY))
+ .setLenient(true);
+ }*/
+
+ public static boolean isDateHrParam(String param) {
+ SimpleDateFormat[] dateFormats = new SimpleDateFormat[2];
+ (dateFormats[0] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MMDDYYYY_HR))
+ .setLenient(true);
+ (dateFormats[1] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_DDMONYYYY_HR))
+ .setLenient(true);
+ for (int i = 0; i < dateFormats.length; i++) {
+ try {
+ if (dateFormats[i].parse(param) != null) {
+ return true;
+ }
+ } catch (ParseException pe) {
+ // do nothing, continue to check param against other dates
+ }
+ catch (NumberFormatException pe) {
+ // do nothing, continue to check param against other dates
+ }
+ }
+ return false;
+ }
+ public static boolean isDateParam(String param) {
+ SimpleDateFormat[] dateFormats = new SimpleDateFormat[5];
+ (dateFormats[0] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MONTHYYYY))
+ .setLenient(true);
+ (dateFormats[1] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MONTHDDYYYY))
+ .setLenient(true);
+ (dateFormats[2] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MMDDYYYY))
+ .setLenient(true);
+ (dateFormats[3] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MMYYYY))
+ .setLenient(true);
+ (dateFormats[4] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_DDMONYYYY))
+ .setLenient(true);
+
+ for (int i = 0; i < dateFormats.length; i++) {
+ try {
+ if (dateFormats[i].parse(param) != null) {
+ return true;
+ }
+ } catch (ParseException pe) {
+ // do nothing, continue to check param against other dates
+ }
+ catch (NumberFormatException pe) {
+ // do nothing, continue to check param against other dates
+ }
+ }
+ return false;
+ }
+
+ public static String formatDateParamValue(String param) {
+ return ReportParamDateValueParser.formatDateParamValue(param, null);
+ }
+
+ public static String formatDateHrParamValue(String param) {
+ return ReportParamDateValueParser.formatDateHrParamValue(param, null);
+ }
+
+ public static String formatDateHrParamValue(String param, String dateHrFormatPattern) {
+ String formattedDate = null;
+ Date parsedDate = null;
+
+ dateHrFormatPattern = (dateHrFormatPattern != null) ? dateHrFormatPattern
+ : "HH";
+
+ SimpleDateFormat[] dateFormats = new SimpleDateFormat[2];
+ (dateFormats[0] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MMDDYYYY_HR))
+ .setLenient(true);
+ (dateFormats[1] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_DDMONYYYY_HR))
+ .setLenient(true);
+
+ for (int i = 0; i < dateFormats.length; i++) {
+ try {
+ if (dateFormats[i].parse(param) != null) {
+ SimpleDateFormat newDateFormat = new SimpleDateFormat(dateHrFormatPattern);
+ parsedDate = dateFormats[i].parse(param);
+ formattedDate = newDateFormat.format(parsedDate);
+
+
+ return formattedDate;
+ }
+ } catch (ParseException pe) {
+ // do nothing, continue to check param against other dates and
+ // format accordingly
+ }
+ catch (NumberFormatException pe) {
+ // do nothing, continue to check param against other dates
+ }
+ }
+ return param;
+ }
+
+
+ public static String formatDateParamValue(String param, String dateFormatPattern) {
+ String formattedDate = null;
+ Date parsedDate = null;
+
+ dateFormatPattern = (dateFormatPattern != null) ? dateFormatPattern
+ : AppConstants.JAVA_DATE_FORMAT_MMDDYYYY;
+
+ SimpleDateFormat[] dateFormats = new SimpleDateFormat[5];
+ (dateFormats[0] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MONTHYYYY))
+ .setLenient(true);
+ (dateFormats[1] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MONTHDDYYYY))
+ .setLenient(true);
+ (dateFormats[2] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MMDDYYYY))
+ .setLenient(true);
+ (dateFormats[3] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MMYYYY))
+ .setLenient(true);
+ (dateFormats[4] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_DDMONYYYY))
+ .setLenient(true);
+
+ for (int i = 0; i < dateFormats.length; i++) {
+ try {
+ if (dateFormats[i].parse(param) != null) {
+ SimpleDateFormat newDateFormat = new SimpleDateFormat(dateFormatPattern);
+ parsedDate = dateFormats[i].parse(param);
+ formattedDate = newDateFormat.format(parsedDate);
+
+ if (Globals.getMonthFormatUseLastDay()
+ && (dateFormats[i].toPattern().equals(
+ AppConstants.JAVA_DATE_FORMAT_MMYYYY) || dateFormats[i]
+ .toPattern().equals(
+ AppConstants.JAVA_DATE_FORMAT_MONTHYYYY))) {
+
+ GregorianCalendar gc = new GregorianCalendar();
+ gc.setTime(parsedDate);
+ int day = gc.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
+ formattedDate = Utils.replaceInString(formattedDate, "/01/", "/"
+ + String.valueOf(day) + "/");
+
+ }
+
+ return formattedDate;
+ }
+ } catch (ParseException pe) {
+ // do nothing, continue to check param against other dates and
+ // format accordingly
+ }
+ catch (NumberFormatException pe) {
+ // do nothing, continue to check param against other dates
+ }
+ }
+ return param;
+ }
+
+} // ReportParamValues
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamValues.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamValues.java
new file mode 100644
index 00000000..66b5f517
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamValues.java
@@ -0,0 +1,370 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.util.XSSFilter;
+import org.openecomp.portalsdk.core.controller.FavoritesController;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class ReportParamValues extends Hashtable {
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FavoritesController.class);
+
+ private Hashtable paramIsMultiValue = null;
+ private Hashtable paramIsTextAreaValue = null;
+ private Hashtable paramIsTextAreaDrilldownValue = null;
+ private Hashtable paramIsTextAreaValueModified = null;
+ private ReportFormFields rff = null;
+
+ private Hashtable multiValueBaseSQL = null;
+ private Hashtable textAreaValueBaseSQL = null;
+
+ public ReportParamValues() {
+ super();
+ paramIsMultiValue = new Hashtable();
+ multiValueBaseSQL = new Hashtable();
+ paramIsTextAreaValue = new Hashtable();
+ paramIsTextAreaDrilldownValue = new Hashtable();
+ paramIsTextAreaValueModified = new Hashtable();
+ } // ReportParamValues
+
+ public ReportParamValues(ReportFormFields rff, String reportDefType) {
+ this();
+ this.rff = rff;
+ for (Iterator iter = rff.iterator(); iter.hasNext();) {
+ FormField ff = (FormField) iter.next();
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ put(ff.getFieldName(), nvl(ff.getDefaultValue()));
+ put(ff.getFieldName()+"_Hr", nvl(ff.getDefaultValue()));
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ put(ff.getFieldName()+"_Min", nvl(ff.getDefaultValue()));
+ }
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ put(ff.getFieldName()+"_Sec", nvl(ff.getDefaultValue()));
+ }
+ } else
+ put(ff.getFieldName(), nvl(ff.getDefaultValue()));
+
+ boolean isMultiValue = ff.getFieldType().equals(FormField.FFT_CHECK_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI);
+ boolean isTextAreaValue = ff.getFieldType().equals(FormField.FFT_TEXTAREA) && reportDefType
+ .equals(AppConstants.RD_SQL_BASED);
+
+ paramIsMultiValue.put(ff.getFieldName(), new Boolean(isMultiValue));
+ paramIsTextAreaValue.put(ff.getFieldName(), new Boolean(isTextAreaValue));
+
+ if ((isMultiValue || isTextAreaValue) && ff.getBaseSQL() != null)
+ multiValueBaseSQL.put(ff.getFieldName(), ff.getBaseSQL());
+
+
+ } // for
+ } // ReportParamValues
+
+ /*
+ * public ReportParamValues(ReportFormFields rff, HttpServletRequest
+ * request) { this(rff);
+ *
+ * setParamValues(request); } // ReportParamValues
+ */
+ public boolean isParameterMultiValue(String fieldName) {
+ Boolean b = (Boolean) paramIsMultiValue.get(fieldName);
+ return (b != null) ? b.booleanValue() : false;
+ } // isParameterMultiValue
+
+ public boolean isParameterTextAreaValue(String fieldName) {
+ Boolean b = (Boolean) paramIsTextAreaValue.get(fieldName);
+ return (b != null) ? b.booleanValue() : false;
+ } // isParameterMultiValue
+
+ public boolean isParameterTextAreaValueAndModified(String fieldName) {
+ Boolean b = (Boolean) paramIsTextAreaValueModified.get(fieldName);
+ return (b != null) ? b.booleanValue() : false;
+ } // isParameterMultiValue
+
+ public boolean setParamValues(HttpServletRequest request, boolean refresh) {
+ long currentTime = System.currentTimeMillis();
+ //System.out.println("ReportParamValues setParamValues called " + refresh);
+ boolean paramUpdated = false;
+ if(refresh) clearValues();
+ for (Enumeration enKeys = keys(); enKeys.hasMoreElements();) {
+ String key = (String) enKeys.nextElement();
+ String oldValue = XSSFilter.filterRequestOnlyScript(getParamValue(key));
+ String newValue = null;
+ if (isParameterMultiValue(key)) {
+ String[] values = request.getParameterValues(key);
+
+ if (values != null) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < values.length; i++) {
+ if (sb.length() > 0)
+ sb.append('|');
+ sb.append(values[i]);
+ } // for
+
+ newValue = XSSFilter.filterRequestOnlyScript(sb.toString());
+ } // if
+ } else if (isParameterTextAreaValue(key)) {
+/* String[] values = request.getParameterValues(key);
+
+ if (values != null) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < values.length; i++) {
+ if (sb.length() > 0)
+ sb.append('|');
+ sb.append(values[i]);
+ } // for
+*/
+ String value = "";
+ value = request.getParameter(key);
+ value = Utils.oracleSafe(nvl(value));
+ paramIsTextAreaDrilldownValue.put(key, value);
+ value = value.replaceAll(",", "|");
+ value = "('" + Utils.replaceInString(value, "|", "','") + "')";
+ //value = Utils.replaceInString(value, "|", ",");
+ newValue = XSSFilter.filterRequestOnlyScript(value);
+ paramIsTextAreaValueModified.put(key, new Boolean(true));
+ //} // if
+
+ } else
+ // newValue = nvl(request.getParameter(key));
+ newValue = XSSFilter.filterRequestOnlyScript(request.getParameter(key));
+ //debugLogger.debug("IN REPORTPARAM ^NEW VALUE " + newValue + " OLD VALUE " + oldValue + " KEY " + key + " isParameterMultiValue(key) " + isParameterMultiValue(key));
+ if(!isParameterMultiValue(key) && !isParameterTextAreaValue(key)) {
+ if(refresh && nvl(newValue).length()<=0) {
+ put(key, oldValue);
+ } else if ( ((newValue != null && newValue.trim().length()>0) && (oldValue!=null && oldValue.trim().length()>0) && !newValue.equals(oldValue)) ||
+ ((newValue != null && newValue.trim().length()>0) && (oldValue == null || oldValue.trim().length() <= 0)) ) {
+ paramUpdated = true;
+ //System.out.println("paramupdated1 " +paramUpdated+ " " + newValue + " " + oldValue);
+ // if(newValue.startsWith("[") && newValue.endsWith("]")) {
+ // newValue = getDateAsString(newValue);
+ // }
+ put(key, newValue);
+ } else if (((newValue == null || newValue.trim().length()<=0)) && (oldValue!=null && oldValue.trim().length()>0)) {
+ paramUpdated = true;
+ put(key, newValue);
+ } else if (nvl(newValue).equals(nvl(oldValue)) ) {
+ put(key, newValue);
+ } else {
+ put(key, "");
+ }
+ } else {
+ if (((newValue != null && newValue.trim().length()>0) && (oldValue!=null && oldValue.trim().length()>0) && !newValue.equals(oldValue)) ||
+ ((newValue != null && newValue.trim().length()>0) && (oldValue == null || oldValue.trim().length() <= 0)) && (isParameterMultiValue(key)||isParameterTextAreaValue(key))) {
+ if(isParameterTextAreaValue(key)) {
+ newValue = getParamValueforTextAreaDrilldown(key);
+ if(newValue.length() > 0 && !newValue.equals(oldValue)) {
+ paramUpdated = true;
+ put (key, newValue);
+ }
+ } else {
+ paramUpdated = true;
+ put (key, newValue);
+ }
+
+ } else if (((newValue == null || newValue.trim().length()<=0)) && (oldValue!=null && oldValue.trim().length()>0) && (isParameterMultiValue(key)||isParameterTextAreaValue(key))) {
+ paramUpdated = true;
+ //System.out.println("paramupdated3 " +paramUpdated+ " N" + newValue + " O" + oldValue);
+ put(key, "");
+ }
+ }
+ } // for
+ //printValues();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] ------->Time Taken for Adding/Clearing Param Values for Search Field Display " + (System.currentTimeMillis() - currentTime)));
+ return paramUpdated;
+ } // setParamValues
+
+ public String getParamValueforTextAreaDrilldown(String key) {
+ return (String) paramIsTextAreaDrilldownValue.get(key);
+ }
+
+ public String getParamValue(String key) {
+ //This logic below is added to avoid BLANK formfield to pass through logic - Sundar
+ if (key!=null) {
+ if(isParameterTextAreaValueAndModified(key)) {
+ String value = "";
+ value = (String) get(key);
+ value = Utils.oracleSafe(nvl(value));
+ value = value.replaceAll(",","|");
+ if(nvl(value).length()>0) {
+ if(value.indexOf("|")!= -1) { // Need option to support "|"
+ value = Utils.replaceInString(value,"\r\n","~");
+ }
+ value = Utils.replaceInString(value, "~", "' , '");
+ value = "('" + Utils.replaceInString(value, "|", "','") + "')"; // changed from "|"
+ //value = Utils.replaceInString(value, "|", ",");
+ value = XSSFilter.filterRequestOnlyScript(value);
+ return value;
+ } else return "";
+
+// if(nvl(value).length()>0) {
+// value = Utils.replaceInString(value, ",", "|");
+// value = value.indexOf("('")!=-1? value.substring(2, value.length()-2):value;
+// value = Utils.replaceInString(value, "'|'", ",");
+// }
+// return value;
+
+ } else
+ return (String) get(key);
+ }
+ else
+ return "";
+ } // getParamValue
+
+ public String getParamDisplayValue(String key) {
+ String value = getParamValue(key);
+ if (isParameterMultiValue(key))
+ value = "(" + Utils.replaceInString(value, "|", ",") + ")";
+ return value;
+ } // getParamValue
+
+ public String getParamBaseSQL(String key) {
+ return (String) multiValueBaseSQL.get(key);
+ } // getParamBaseSQL
+
+ /** ************************************************************************************************* */
+
+ private String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ private String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ private boolean isNull(String a) {
+ if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null"))
+ return true;
+ else
+ return false;
+ }
+
+ private void clearValues() {
+ FormField ff = null;
+ String defaultValue = "";
+ String defaultSQL = "";
+ String defaultQuery = "";
+ DataSet dsDefault = null;
+ if (rff!= null) {
+ for (Enumeration enKeys = keys(); enKeys.hasMoreElements();) {
+ String key = (String) enKeys.nextElement();
+ for(rff.resetNext(); rff.hasNext(); ) {
+ ff = rff.getNext();
+ if(ff.getFieldName().equals(key)) {
+ // Add default Value
+ defaultValue = ff.getDefaultValue();
+ defaultSQL = ff.getFieldDefaultSQL();
+ if(nvl(defaultValue).length()>0) {
+ put(key,ff.getDefaultValue());
+ } else if(nvl(defaultSQL).length() > 0) {
+ //defaultSQL = Utils.replaceInString(defaultSQL, "[LOGGED_USERID]", userId);
+ if(!(isParameterMultiValue(key) || isParameterTextAreaValue(key))) {
+ defaultQuery = "SELECT id, name FROM (SELECT rownum r, id, name FROM (" + defaultSQL
+ + ") x "
+ + ") xx ";
+ try {
+ dsDefault = ConnectionUtils.getDataSet(defaultQuery, ff.getDbInfo());
+ if(dsDefault!=null && dsDefault.getRowCount()>0) {
+ for (int i = 0; i < dsDefault.getRowCount(); i++) {
+ put(key, dsDefault.getString(i, 0));
+ }
+ }
+ } catch (RaptorException ex) {}
+ } else put(key, "");
+
+ } else put(key,"");
+ break;
+ }
+ }
+ }
+ }
+
+/* for (Enumeration enKeys = keys(); enKeys.hasMoreElements();) {
+ String key = (String) enKeys.nextElement();
+ put(key,"");
+ }
+*/
+ }
+
+
+ public void printValues() {
+ for (Enumeration enKeys = keys(); enKeys.hasMoreElements();) {
+ String key = (String) enKeys.nextElement();
+ String value = (String) get(key);
+ System.out.println("ReportParamValues " + key + " "+ value);
+ }
+ }
+
+ private String getDateAsString (String keyword) {
+ String sql = "";
+ if (keyword.equals("[PROCESSING_DATE]")) {
+ //sql = "select to_char(trunc(sysdate,'dd'), 'mm/dd/yyyy') as dateStr from dual";
+ sql = "select to_char(trunc(sysdate,'dd'), 'mm/dd/yyyy') as dateStr" + Globals.getGenerateSqlVisualDual();
+ } else if (keyword.equals("[PROCESSING_NEXT_DATE]")) {
+ //sql = "select to_char(trunc(sysdate+1,'dd'), 'mm/dd/yyyy') as dateStr from dual";
+ sql = "select to_char(trunc(sysdate+1,'dd'), 'mm/dd/yyyy') as dateStr" + Globals.getGenerateSqlVisualDual();
+ } else if (keyword.equals("[PROCESSING_DAY_BEFORE_DATE]")) {
+ //sql = "select to_char(trunc(sysdate-1,'dd'), 'mm/dd/yyyy') as dateStr from dual";
+ sql = "select to_char(trunc(sysdate-1,'dd'), 'mm/dd/yyyy') as dateStr"+ Globals.getGenerateSqlVisualDual();
+ } else if (keyword.equals("[PROCESSING_MONTH_START_DATE]")) {
+ //sql = "select to_char(trunc(sysdate,'MM'), 'mm/dd/yyyy') as dateStr from dual";
+ sql = "select to_char(trunc(sysdate,'MM'), 'mm/dd/yyyy') as dateStr"+ Globals.getGenerateSqlVisualDual();
+ } else if (keyword.equals("[PROCESSING_MONTH_END_DATE]")) {
+ //sql = "select to_char(last_day(sysdate), 'mm/dd/yyyy') as dateStr from dual";
+ sql = "select to_char(last_day(sysdate), 'mm/dd/yyyy') as dateStr" + Globals.getGenerateSqlVisualDual();
+ } else if (keyword.equals("[CURRENT_HOUR]")) {
+ //sql = "select to_char(trunc(sysdate,'HH24'),'mm/dd/yyyy HH24') as dateStr from dual";
+ sql = "select to_char(trunc(sysdate,'HH24'),'mm/dd/yyyy HH24') as dateStr"+ Globals.getGenerateSqlVisualDual();
+ } else if (keyword.equals("[PREVIOUS_HOUR]")) {
+ //sql = "select to_char(trunc(sysdate-1/24, 'HH24'),'mm/dd/yyyy HH24') as dateStr from dual";
+ sql = "select to_char(trunc(sysdate-1/24, 'HH24'),'mm/dd/yyyy HH24') as dateStr" + Globals.getGenerateSqlVisualDual();
+ } else if (keyword.equals("[NEXT_HOUR]")) {
+ //sql = "select to_char(trunc(sysdate+1/24, 'HH24'),'mm/dd/yyyy HH24') as dateStr from dual";
+ sql = "select to_char(trunc(sysdate+1/24, 'HH24'),'mm/dd/yyyy HH24') as dateStr" + Globals.getGenerateSqlVisualDual();
+ }
+ DataSet ds = null;
+
+ try {
+ if(sql.length()>0) {
+ ds = DbUtils.executeQuery(sql);
+ return ds.getString(0,0);
+ }
+ else
+ return "";
+ } catch (RaptorException ex) {
+ ex.printStackTrace();
+ //throw ex;
+ }
+ return "";
+ }
+} // ReportParamValues
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamValuesForPDFExcel.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamValuesForPDFExcel.java
new file mode 100644
index 00000000..f4bb9800
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamValuesForPDFExcel.java
@@ -0,0 +1,419 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class ReportParamValuesForPDFExcel extends Hashtable {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportParamValuesForPDFExcel.class);
+
+ private Hashtable paramIsMultiValue = null;
+ private Hashtable paramIsTextAreaValue = null;
+ private ReportFormFields rff = null;
+
+ private Hashtable multiValueBaseSQL = null;
+
+ public ReportParamValuesForPDFExcel() {
+ super();
+ paramIsMultiValue = new Hashtable();
+ paramIsTextAreaValue = new Hashtable();
+ multiValueBaseSQL = new Hashtable();
+ } // ReportParamValues
+
+ public ReportParamValuesForPDFExcel(ReportFormFields rff, String reportDefType) {
+ this();
+ this.rff = rff;
+ for (Iterator iter = rff.iterator(); iter.hasNext();) {
+ FormField ff = (FormField) iter.next();
+
+ put(ff.getFieldName(), nvl(ff.getDefaultValue()));
+
+ boolean isMultiValue = ff.getFieldType().equals(FormField.FFT_CHECK_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI);
+ boolean isTextAreaValue = ff.getFieldType().equals(FormField.FFT_TEXTAREA) && reportDefType
+ .equals(AppConstants.RD_SQL_BASED);
+ paramIsMultiValue.put(ff.getFieldName(), new Boolean(isMultiValue));
+ paramIsTextAreaValue.put(ff.getFieldName(), new Boolean(isTextAreaValue));
+ if (isMultiValue && ff.getBaseSQL() != null)
+ multiValueBaseSQL.put(ff.getFieldName(), ff.getBaseSQL());
+ } // for
+ } // ReportParamValues
+
+ /*
+ * public ReportParamValues(ReportFormFields rff, HttpServletRequest
+ * request) { this(rff);
+ *
+ * setParamValues(request); } // ReportParamValues
+ */
+ public boolean isParameterMultiValue(String fieldName) {
+ Boolean b = (Boolean) paramIsMultiValue.get(fieldName);
+ return (b != null) ? b.booleanValue() : false;
+ } // isParameterMultiValue
+
+ public boolean isParameterTextAreaValue(String fieldName) {
+ Boolean b = (Boolean) paramIsTextAreaValue.get(fieldName);
+ return (b != null) ? b.booleanValue() : false;
+ } // isParameterMultiValue
+
+ public boolean setParamValues(HttpServletRequest request, boolean refresh) {
+ //debugLogger.debug("ReportParamValues for PDF Excel setParamValues called " + refresh);
+ long currentTime = System.currentTimeMillis();
+ boolean paramUpdated = false;
+ if(refresh) clearValues();
+ String name = null;
+ String value = null;
+ String value1 = "";
+ String sql = "";
+ FormField ff = null;
+ String dbInfo = null;
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ if(rr!=null && rr.getReportType().equals(AppConstants.RT_DASHBOARD)) {
+ rr = (ReportRuntime) request.getSession().getAttribute("FirstDashReport");
+ if(rr!=null)
+ rff = rr.getReportFormFields();
+ } else if (rr == null) {
+ rr = (ReportRuntime) request.getSession().getAttribute("FirstDashReport");
+ if(rr!=null)
+ rff = rr.getReportFormFields();
+ } else {
+ rff = rr.getReportFormFields();
+ }
+
+ if(rr!=null) {
+ dbInfo = rr.getDBInfo();
+ if (Utils.isNull(dbInfo)) {
+ dbInfo = (String) request.getSession().getAttribute("remoteDB");
+ }
+ if(!Utils.isNull(dbInfo)){
+ for (Iterator iter = rff.iterator(); iter.hasNext();) {
+ name=""; //just added
+ ff = (FormField) iter.next();
+ //debugLogger.debug("ff.getFieldName " + ff.getFieldName() + " " + ff.getFieldDisplayName() + " " + ff.getFieldType()+ " " +ff.getBaseSQLForPDFExcel()+ " "+ rr.getParamValue(ff.getFieldName()));
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+ sql = ff.getBaseSQLForPDFExcel();
+ if(sql!=null && sql.trim().length()>0)
+ sql = Utils.replaceInString(sql, "[LOGGED_USERID]", AppUtils.getUserID(request));
+ if(ff.getFieldType().equals(FormField.FFT_COMBO_BOX) || ff.getFieldType().equals(FormField.FFT_LIST_BOX) || ff.getFieldType().equals(FormField.FFT_TEXT_W_POPUP) || ff.getFieldType().equals(FormField.FFT_HIDDEN)) {
+ for (Enumeration enum1 = rr.getParamKeys(); enum1.hasMoreElements();) {
+ name = (String) enum1.nextElement();
+ value = rr.getParamValue(name);
+ value = getParamValueForSQL(name, value);
+ if(name.startsWith("ff")) {
+ for (Iterator iter1 = rff.iterator(); iter1.hasNext();) {
+ FormField ff1 = (FormField) iter1.next();
+
+ if(sql!=null && sql.trim().length()>0){
+ if(name.equals(ff.getFieldName())){
+ sql = Utils.replaceInString(sql, "[VALUE]", value);
+ }
+ if(name.equals(ff1.getFieldName())){
+ sql = Utils.replaceInString(sql, "["+ff1.getFieldDisplayName()+"]", value);
+
+ } else continue;
+ }
+ }
+ }
+ }
+ } else if (ff.getFieldType().equals(ff.FFT_LIST_MULTI)||ff.getFieldType().equals(ff.FFT_CHECK_BOX)) {
+ for (Enumeration enum1 = rr.getParamKeys(); enum1.hasMoreElements();) {
+ name = (String) enum1.nextElement();
+ value = rr.getParamValue(name);
+ value = getParamValueForSQL(name, value);
+ if(name.startsWith("ff")) {
+ for (Iterator iter1 = rff.iterator(); iter1.hasNext();) {
+ FormField ff1 = (FormField) iter1.next();
+
+ if(sql!=null && sql.trim().length()>0){
+ if(name.equals(ff.getFieldName())){
+ sql = Utils.replaceInString(sql, "[VALUE]", value);
+ }
+ if(name.equals(ff1.getFieldName())){
+ sql = Utils.replaceInString(sql, "["+ff1.getFieldDisplayName()+"]", value);
+
+ } else continue;
+ }
+ }
+ }
+ }
+ } else {
+ if(nvl(ff.getFieldDefaultSQL()).length()<=0)
+ sql = "";
+ }
+ if(sql!=null && sql.trim().length()>0){
+ name = "";
+ if(name.length()<=0) name = ff.getFieldName();
+ value = rr.getParamValue(name);
+ //debugLogger.debug("Name "+ name+ " value:" + value);
+ String paramValue = getParamValueForSQL(name, value);
+ //debugLogger.debug("PDFEXCEL " + name+ " " + ff.getFieldName()+ " " + value + " " + sql +" "+ paramValue);
+ if(name!=null && name.equals(ff.getFieldName()))
+ sql = Utils.replaceInString(sql, "[VALUE]", paramValue);
+ if(paramValue == null) {
+ if(sql.lastIndexOf("where id = ''")>0)
+ sql = sql.substring(0, sql.lastIndexOf("where id = ''"));
+ }
+ //debugLogger.debug("SQL Modified " + sql);
+ FormField ff2 = null;
+ for (Iterator iter1 = rff.iterator(); iter1.hasNext();) {
+ ff2 = (FormField)iter1.next();
+ sql = Utils.replaceInString(sql, "[" + ff2.getFieldDisplayName() +"]", getParamValue(ff2.getFieldName()));
+ }
+ //debugLogger.debug("SQL Modified after replacing formfield" + sql);
+ try {
+ String[] reqParameters = Globals.getRequestParams().split(",");
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ String[] scheduleSessionParameters = Globals.getSessionParamsForScheduling().split(",");
+ javax.servlet.http.HttpSession session = request.getSession();
+ //debugLogger.debug("B4 Session " + sql);
+ if(session != null ) {
+ for (int i = 0; i < sessionParameters.length; i++) {
+ sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ }
+ }
+ //debugLogger.debug("B4 request " + sql);
+ if(request != null ) {
+ for (int i = 0; i < scheduleSessionParameters.length; i++) {
+ sql = Utils.replaceInString(sql, "[" + scheduleSessionParameters[i].toUpperCase()+"]", request.getParameter(scheduleSessionParameters[i]) );
+ }
+ for (int i = 0; i < reqParameters.length; i++) {
+ if(!reqParameters[i].startsWith("ff")) {
+ if (request.getParameter(reqParameters[i])!=null) {
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i]+"]", request.getParameter(reqParameters[i]) );
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) );
+ }
+ else {
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i]+"]", request.getParameter(reqParameters[i].toUpperCase()) );
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) );
+ }
+ }
+ else
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) );
+ }
+ }
+ //debugLogger.debug("After request " + sql);
+ DataSet ds = null;
+ try {
+ ds = ConnectionUtils.getDataSet(sql, dbInfo);
+ } catch (ReportSQLException ex) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("sql not complete" + sql));
+ }
+ if(ff.getFieldType().equals(FormField.FFT_LIST_MULTI) || ff.getFieldType().equals(FormField.FFT_CHECK_BOX)) {
+ StringBuffer multiValue = new StringBuffer("");
+ if(ds!=null) {
+ for(int i = 0; i < ds.getRowCount(); i++) {
+ //if(i==0) multiValue.append("(");
+ multiValue.append(ds.getString(i,1));
+ if(i<ds.getRowCount()-1)
+ multiValue.append("|");
+ //else multiValue.append(")");
+
+ }
+ }
+ put(ff.getFieldName(), nvl(multiValue.toString()));
+ } else {
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC) ) {
+ value1 = nvl(rr.getParamValue(ff.getFieldName())) + " "+addZero(Utils.oracleSafe(nvl(rr
+ .getParamValue(ff.getFieldName()+"_Hr"))));
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC) ) {
+ value1 = value1 + (nvl(rr
+ .getParamValue(ff.getFieldName()+"_Min")).length() > 0 ? ":" + addZero(Utils.oracleSafe(nvl(rr
+ .getParamValue(ff.getFieldName()+"_Min")))) : "");
+ }
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC) ) {
+ value1 = value1 + (nvl(rr
+ .getParamValue(ff.getFieldName()+"_Sec")).length() > 0 ? ":"+ addZero(Utils.oracleSafe(nvl(rr
+ .getParamValue(ff.getFieldName()+"_Sec")))) : "");
+ }
+ //debugLogger.debug("77777777777777 " + value1);
+ put(ff.getFieldName(), nvl(value1));
+ } else {
+
+ if(ds!=null && ds.getRowCount()>0) put(ff.getFieldName(), nvl(ds.getString(0,1)));
+ else put(ff.getFieldName(), nvl(value));
+ }
+ }
+
+ paramUpdated = true;
+ } catch (ReportSQLException ex) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("sql not complete" + sql));
+ }
+ catch (Exception ex) {}
+
+ //debugLogger.debug("66666666666666666 " + ff.getValidationType());
+
+ //Added for TimeStamp validation
+
+ } else {
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+ //Added for TimeStamp validation
+ //debugLogger.debug("666666666666 " + ff.getValidationType());
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC) ) {
+ value1 = nvl(rr.getParamValue(ff.getFieldName())) + " "+addZero(Utils.oracleSafe(nvl(rr
+ .getParamValue(ff.getFieldName()+"_Hr"))));
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC) ) {
+ value1 = value1 + (nvl(rr
+ .getParamValue(ff.getFieldName()+"_Min")).length() > 0 ? ":" + addZero(Utils.oracleSafe(nvl(rr
+ .getParamValue(ff.getFieldName()+"_Min")))) : "");
+ }
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC) ) {
+ value1 = value1 + (nvl(rr
+ .getParamValue(ff.getFieldName()+"_Sec")).length() > 0 ? ":"+ addZero(Utils.oracleSafe(nvl(rr
+ .getParamValue(ff.getFieldName()+"_Sec")))) : "");
+ }
+ //debugLogger.debug("77777777777777 " + value1);
+ } else
+ value1 = nvl(rr.getParamValue(ff.getFieldName()));
+ if(value1.length()<=0) value1 = nvl(ff.getDefaultValue());
+ put(ff.getFieldName(), nvl(value1));
+
+ }
+ paramUpdated = true;
+ }
+
+ } // BLANK
+ } // for
+ } // dbInfo
+ } // !=null
+
+ //printValues();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] ------->Time Taken for Adding/Clearing Param Values for FormField Info Bar " + (System.currentTimeMillis() - currentTime)));
+ return paramUpdated;
+ } // setParamValues
+
+ public String getParamValue(String key) {
+ if (key!=null)
+ return (String) get(key);
+ else
+ return "NULL";
+ } // getParamValue
+
+ public String getParamValueForSQL(String key, String value) {
+ value = Utils.oracleSafe(value);
+ if (isParameterMultiValue(key))
+ value = "('" + Utils.replaceInString(value, "|", "','") + "')";
+ return value;
+ } // getParamValue
+
+ public String getParamDisplayValue(String key) {
+ //debugLogger.debug("Key is " + key +" Value is " + getParamValue(key));
+ String value = getParamValue(key);
+ if (isParameterMultiValue(key))
+ value = "(" + Utils.replaceInString(value, "|", ",") + ")";
+ return value;
+ } // getParamValue
+
+ public String getParamBaseSQL(String key) {
+ return (String) multiValueBaseSQL.get(key);
+ } // getParamBaseSQL
+
+ /** ************************************************************************************************* */
+
+ private String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ private String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ private boolean isNull(String a) {
+ if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null"))
+ return true;
+ else
+ return false;
+ }
+
+ private void clearValues() {
+ FormField ff = null;
+ String defaultValue = "";
+ String defaultSQL = "";
+ String defaultQuery = "";
+ DataSet dsDefault = null;
+ if (rff!= null) {
+ for (Enumeration enKeys = keys(); enKeys.hasMoreElements();) {
+ String key = (String) enKeys.nextElement();
+ for(rff.resetNext(); rff.hasNext(); ) {
+ ff = rff.getNext();
+ if(ff.getFieldName().equals(key)) {
+ // Add default Value
+ defaultValue = ff.getDefaultValue();
+ defaultSQL = ff.getFieldDefaultSQL();
+ if(nvl(defaultValue).length()>0) {
+ put(key,ff.getDefaultValue());
+ } else if(nvl(defaultSQL).length() > 0) {
+ //defaultSQL = Utils.replaceInString(defaultSQL, "[LOGGED_USERID]", userId);
+ if(!(isParameterMultiValue(key) || isParameterTextAreaValue(key))) {
+ defaultQuery = "SELECT id, name FROM (SELECT rownum r, id, name FROM (" + defaultSQL
+ + ") x "
+ + ") xx ";
+ try {
+ dsDefault = ConnectionUtils.getDataSet(defaultQuery, ff.getDbInfo());
+ if(dsDefault!=null && dsDefault.getRowCount()>0) {
+ for (int i = 0; i < dsDefault.getRowCount(); i++) {
+ put(key, dsDefault.getString(i, 1));
+ }
+ }
+ } catch (RaptorException ex) {}
+ } else put(key, "");
+
+ } else put(key,"");
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ public void printValues() {
+ for (Enumeration enKeys = keys(); enKeys.hasMoreElements();) {
+ String key = (String) enKeys.nextElement();
+ String value = (String) get(key);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("ReportParamValuesForPDFEXCEL " + key + " "+ value));
+ }
+ }
+ public String addZero(String num) {
+ int numInt = 0;
+ try {
+ numInt = Integer.parseInt(num);
+ }catch(NumberFormatException ex){
+ numInt = 0;
+ }
+ if(numInt < 10) return "0"+numInt;
+ else return ""+numInt;
+ }
+
+} // ReportParamValues
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportRuntime.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportRuntime.java
new file mode 100644
index 00000000..fd8fadcb
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportRuntime.java
@@ -0,0 +1,3618 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.model.DataCache;
+import org.openecomp.portalsdk.analytics.model.ReportHandler;
+import org.openecomp.portalsdk.analytics.model.ReportLoader;
+import org.openecomp.portalsdk.analytics.model.base.IdNameList;
+import org.openecomp.portalsdk.analytics.model.base.IdNameSql;
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.model.base.ReportWrapper;
+import org.openecomp.portalsdk.analytics.model.definition.Marker;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.view.ColumnHeader;
+import org.openecomp.portalsdk.analytics.view.ColumnHeaderRow;
+import org.openecomp.portalsdk.analytics.view.CrossTabOrderManager;
+import org.openecomp.portalsdk.analytics.view.CrossTabTotalValue;
+import org.openecomp.portalsdk.analytics.view.DataRow;
+import org.openecomp.portalsdk.analytics.view.DataValue;
+import org.openecomp.portalsdk.analytics.view.ReportData;
+import org.openecomp.portalsdk.analytics.view.RowHeaderCol;
+import org.openecomp.portalsdk.analytics.xmlobj.CustomReportType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType;
+import org.openecomp.portalsdk.analytics.xmlobj.ObjectFactory;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+/**<HR/>
+ * This class is part of <B><I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I></B><BR/>
+ * <HR/>
+ *
+ * --------------------------------------------------------------------------------------------------<BR/>
+ * <B>ReportRuntime.java</B> - This class involves in running, downloading RAPTOR reports.
+ * --------------------------------------------------------------------------------------------------<BR/>
+ *
+ *
+ * <U>Change Log</U><BR/><BR/>
+ *
+ * 27-Aug-2009 : Version 8.5 (Sundar); <UL><LI>Order by logic is restored for DAYTONA.</LI></UL>
+ * 13-Aug-2009 : Version 8.5 (Sundar); <UL><LI>Removing order by logic is rollbacked.</LI></UL>
+ * 22-Jun-2009 : Version 8.4 (Sundar); <UL><LI>Bug while parsing SQL for text download is fixed.</LI></UL>
+ *
+ */
+
+public class ReportRuntime extends ReportWrapper implements Cloneable, Serializable {
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportRuntime.class);
+
+
+ //TODO DELETE IF PARSE SQL is not working
+ private int curSQLParsePos = 0;
+
+ private String xmlFileURL = null;
+
+ private String xmlFileName = null;
+
+ private String flatFileName = null;
+
+ private String excelPageFileName = null;
+
+ private int reportDataSize = -1;
+
+ private boolean displayChart = true;
+
+ private boolean displayForm = true;
+
+ private boolean displayContent = true;
+
+ private boolean reportRunLogged = false; // Used to avoid multiple
+ // entries in the report log
+ // when executing with different
+ // params or going to next page
+
+ private DataSet chartDataCache = null;
+
+ private ReportData pageDataCache = null;
+
+ private int cachedPageNo = -1;
+
+ private String cachedSQL = null; // For display purposes only
+
+ private String wholeSQL = null; // For display purposes only
+
+ private String totalSql = null; // For display purposes only
+
+ private ReportParamValues reportParamValues = null;
+
+ private ReportParamValuesForPDFExcel reportParamValuesFPE = null;
+
+ private ReportFormFields reportFormFields = null;
+
+ private VisualManager visualManager = null;
+
+ private CrossTabOrderManager crossTabOrderManager = null;
+
+ private boolean displayColTotals = false;
+
+ private boolean displayRowTotals = false;
+
+ private DataRow colDataTotalsLinear = null;
+
+ private Vector colDataTotalsCrosstab = null;
+
+ private Vector rowDataTotalsCrosstab = null;
+
+ private String grandTotalCrosstab = null;
+
+ public static int DISPLAY_DATA_ONLY = 1;
+ public static int DISPLAY_CHART_ONLY = 2;
+ public static int DISPLAY_CHART_AND_DATA = 3;
+
+ public static final int DATE_OPTION_MONTHLY = 1;
+ public static final int DATE_OPTION_YEARLY = 2;
+ public static final int DATE_OPTION_DAILY = 3;
+
+
+ private int DISPLAY_MODE = 0;
+
+ private int DATE_OPTION = -1;
+
+ /*
+ * private ReportRuntime(CustomReport cr, String reportID,
+ * HttpServletRequest request) { super(cr, reportID);
+ *
+ * reportParamValues = new ReportParamValues(this); reportFormFields = new
+ * ReportFormFields(this);
+ *
+ * if(request!=null) setParamValues(request); } // ReportRuntime
+ */
+ private ReportRuntime(CustomReportType crType, String reportID, HttpServletRequest request,
+ String ownerID, String createID, String createDate, String updateID,
+ String updateDate, String menuID, boolean menuApproved) throws RaptorException {
+ super(crType, reportID, ownerID, createID, createDate, updateID, updateDate, menuID,
+ menuApproved);
+ initializeReportRuntime(request);
+ } // ReportRuntime
+
+ public ReportRuntime(ReportWrapper rw) throws RaptorException {
+ this(rw, null);
+ } // ReportRuntime
+
+ public ReportRuntime(ReportWrapper rw, HttpServletRequest request)throws RaptorException {
+ super(rw);
+ initializeReportRuntime(request);
+ } // ReportRuntime
+
+ private void initializeReportRuntime(HttpServletRequest request) throws RaptorException {
+ reportFormFields = new ReportFormFields(this, request);
+ setParamValues(request, true, true);
+
+ visualManager = new VisualManager();
+ } // initializeReportRuntime
+
+// public void setReportFormFields(HttpServletRequest request) {
+// reportFormFields = new ReportFormFields(this, request);
+// setParamValues(request, true, true);
+// }
+
+ public static ReportRuntime unmarshal(String reportXML, String reportID)
+ throws RaptorException {
+ return unmarshal(reportXML, reportID, null);
+ } // unmarshal
+
+ public static ReportRuntime unmarshal(String reportXML, String reportID,
+ HttpServletRequest request) throws RaptorException {
+ CustomReportType crType = ReportWrapper.unmarshalCR(reportXML);
+ ObjectFactory objFactory = new ObjectFactory();
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Report [" + reportID + "]: XML unmarshalled"));
+
+ return new ReportRuntime(crType, reportID, request, null, null, null, null, null, null,
+ false);
+
+ } // unmarshal
+
+ public String getXmlFileURL() {
+ return xmlFileURL;
+ }
+
+ public String getXmlFileName() {
+ return xmlFileName;
+ }
+
+ public String getFlatFileName() {
+ return flatFileName;
+ }
+
+ public String getExcelPageFileName() {
+ return excelPageFileName;
+ }
+
+ public int getReportDataSize() {
+ return reportDataSize;
+ }
+
+ public boolean getDisplayChart() {
+ return displayChart;
+ }
+
+ public boolean getDisplayForm() {
+ return displayForm;
+ }
+
+ public boolean getDisplayContent() {
+ return displayContent;
+ }
+
+ public int getCachedPageNo() {
+ return cachedPageNo;
+ }
+
+ public String getCachedSQL() {
+ return cachedSQL;
+ }
+
+ public boolean isDashboardType() throws RaptorException {
+ return ReportLoader.isDashboardType(getReportID());
+ }
+
+
+ public void setXmlFileURL(String xmlFileURL) {
+ this.xmlFileURL = xmlFileURL;
+ }
+
+ public void setXmlFileName(String xmlFileName) {
+ this.xmlFileName = xmlFileName;
+ }
+
+ public void setFlatFileName(String flatFileName) {
+ this.flatFileName = flatFileName;
+ }
+
+ public void setExcelPageFileName(String excelPageFileName) {
+ this.excelPageFileName = excelPageFileName;
+ }
+
+ /*private*/ public void setReportDataSize(int reportDataSize) {
+ this.reportDataSize = reportDataSize;
+ }
+
+ private void setDisplayForm(boolean displayForm) {
+ this.displayForm = displayForm;
+ }
+
+ private void setDisplayContent(boolean displayContent) {
+ this.displayContent = displayContent;
+ }
+
+ public void setDisplayFlags(boolean isFirstAccess, boolean forceDisplayContent) {
+ if (isFirstAccess) {
+ setDisplayForm(true);
+
+ if (forceDisplayContent)
+ setDisplayContent(true);
+ else if (Globals.getDisplayFormBeforeRun())
+ if (needFormInput())
+ setDisplayContent(false);
+ else
+ setDisplayContent(true);
+ else
+ setDisplayContent(true);
+ } else {
+ setDisplayContent(true);
+
+ if (Globals.getIncludeFormWithData())
+ setDisplayForm(true);
+ else if (Globals.getDisplayFormBeforeRun())
+ setDisplayForm(false);
+ else
+ setDisplayForm(true);
+ } // else
+ } // setDisplayFlags
+
+ public void logReportRun(String userID, String executionTime, String formFields) throws RaptorException {
+ if (reportRunLogged)
+ return;
+
+ ReportLoader.createReportLogEntry(null, reportID, userID, AppConstants.RLA_RUN,executionTime,formFields );
+ reportRunLogged = true;
+ } // logReportRun
+
+ public void logReportExecutionTime(String userId, String executionTime, String action, String formFields) throws RaptorException {
+ ReportLoader.createReportLogEntryForExecutionTime(null, reportID, userId,executionTime , action, formFields);
+ }
+
+ public void logReportExecutionTimeFromLogList (String userId, String executionTime, String formFields) throws RaptorException {
+ ReportLoader.createReportLogEntryForExecutionTime(null, reportID, userId,executionTime , AppConstants.RLA_FROM_LOG, formFields);
+ }
+
+ public void resetVisualSettings() {
+ boolean haveToResetCachedData = (visualManager.getSortByColId().length() > 0);
+ visualManager = new VisualManager();
+
+ if (haveToResetCachedData)
+ pageDataCache = null;
+
+ if (pageDataCache != null)
+ pageDataCache.resetVisualSettings();
+ } // resetVisualSettings
+
+ /** ************** ReportParamValues processing *************** */
+
+ public boolean setParamValues(HttpServletRequest request, boolean resetParams, boolean refresh) throws RaptorException {
+ boolean paramsUpdated = false;
+ if (resetParams) {
+ reportFormFields = new ReportFormFields(this, request);
+ reportParamValues = new ReportParamValues(reportFormFields, getReportDefType());
+ // This is called even in the wizard page. Hence this condition.
+ if((ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null)
+ reportParamValuesFPE = new ReportParamValuesForPDFExcel(reportFormFields, getReportDefType());
+ paramsUpdated = true;
+
+ reportRunLogged = false;
+ } else if (request != null) {
+ paramsUpdated = reportParamValues.setParamValues(request,refresh);
+ }
+ // This is called even in the wizard page. Hence this condition.
+ if((ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null) {
+ if(reportParamValuesFPE!=null) reportParamValuesFPE.setParamValues(request,refresh);
+ else {
+ reportParamValuesFPE = new ReportParamValuesForPDFExcel(reportFormFields, getReportDefType());
+ reportParamValuesFPE.setParamValues(request,refresh);
+ }
+ } else {
+ reportFormFields = new ReportFormFields(this, request);
+ //added below two lines for dashboard default value
+ reportParamValues = new ReportParamValues(reportFormFields, getReportDefType());
+ reportParamValues.setParamValues(request,refresh);
+ //End
+ reportParamValuesFPE = new ReportParamValuesForPDFExcel(reportFormFields, getReportDefType());
+ reportParamValuesFPE.setParamValues(request,refresh);
+
+ }
+// }
+ if (paramsUpdated) {
+ setReportDataSize(-1);
+ chartDataCache = null;
+ pageDataCache = null;
+ cachedPageNo = -1;
+
+ crossTabOrderManager = null;
+
+ colDataTotalsLinear = null;
+ colDataTotalsCrosstab = null;
+ rowDataTotalsCrosstab = null;
+ grandTotalCrosstab = null;
+ if(!refresh)
+ resetVisualSettings();
+ } // if
+
+ displayChart = (request.getParameter(AppConstants.RI_DISPLAY_CHART) == null) ? !isDisplayOptionHideChart() : request.getParameter("display_chart")
+ .equals("Y");
+
+ return paramsUpdated;
+ } // setParamValues
+
+ public String getParamValue(String key) {
+ //reportParamValues.printValues();
+ return reportParamValues.getParamValue(key);
+ } // getParamValue
+
+ public String getParamDisplayValue(String key) {
+ //reportParamValues.printValues();
+ return reportParamValues.getParamDisplayValue(key);
+ } // getParamValue
+
+ public Enumeration getParamKeys() {
+ return reportParamValues.keys();
+ } // getParamKeys
+
+ public Enumeration getParamKeysForPDFExcel() {
+ return reportParamValuesFPE.keys();
+ } // getParamKeys
+
+ public String getParamValueForPDFExcel(String key) {
+ return reportParamValuesFPE.getParamValue(key);
+ } // getParamValue
+
+ public ArrayList getParamNameValuePairs() {
+ ArrayList paramList = new ArrayList(getReportFormFields().size());
+ for (Iterator iter = getReportFormFields().iterator(); iter.hasNext();) {
+ FormField ff = (FormField) iter.next();
+ paramList.add(new IdNameValue(ff.getFieldDisplayName(), reportParamValues
+ .getParamDisplayValue(ff.getFieldName())));
+ } // for
+ return paramList;
+ } // getParamNameValuePairs
+
+ public ArrayList getParamNameValuePairsforPDFExcel(HttpServletRequest request, int type /*excel =1; pdf=2*/) {
+ javax.servlet.http.HttpSession session = request.getSession();
+ ArrayList paramList = new ArrayList(getReportFormFields().size());
+ if(session.getAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO)!=null) {
+ paramList = (ArrayList) session.getAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO);
+ if(paramList!=null && paramList.size()>0)
+ return paramList;
+ }
+ //System.out.println(" getParamNamePairs type " + type + " " + Globals.customizeFormFieldInfo());
+ if ( reportParamValuesFPE == null) {
+ reportParamValuesFPE = new ReportParamValuesForPDFExcel(reportFormFields, getReportDefType());
+ reportParamValuesFPE.setParamValues(request,true);
+ }
+
+ String valueString = "";
+ for (Iterator iter = getReportFormFields().iterator(); iter.hasNext();) {
+ FormField ff = (FormField) iter.next();
+ if(ff.isVisible() && /*!ff.getFieldType().equals(FormField.FFT_HIDDEN) &&*/ type == 1){
+ valueString = reportParamValuesFPE.getParamDisplayValue(ff.getFieldName());
+ } else if(ff.isVisible() && type != 1) {
+ valueString = reportParamValuesFPE.getParamDisplayValue(ff.getFieldName());
+ }
+ if(valueString.equalsIgnoreCase("NULL"))
+ valueString="";
+ paramList.add(new IdNameValue(ff.getFieldDisplayName(), valueString));
+// }
+ } // for
+
+ String pdfAttachmentKey = AppUtils.getRequestValue(request, "pdfAttachmentKey");
+ boolean isSchedule = false;
+ if(pdfAttachmentKey != null)
+ isSchedule = true;
+ if(Globals.customizeFormFieldInfo() && type == 2) {
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+
+ if(session != null && !isSchedule ) {
+ session.setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request));
+ for (int i = 0; i < sessionParameters.length; i++) {
+ if(session.getAttribute(sessionParameters[i])!=null)
+ paramList.add(new IdNameValue(sessionParameters[i].toUpperCase(), (String)session.getAttribute(sessionParameters[i])));
+ }
+ }
+
+ if(isSchedule) {
+ //debugLogger.debug("Globals " + Globals.getSessionParamsForScheduling());
+ String[] scheduleSessionParam = Globals.getSessionParamsForScheduling().split(",");
+ for (int i = 0; i < scheduleSessionParam.length; i++) {
+ //debugLogger.debug(" scheduleSessionParam[i] " + scheduleSessionParam[i] + " " + request.getParameter(scheduleSessionParam[i]) );
+ if(request.getParameter(scheduleSessionParam[i])!=null)
+ paramList.add(new IdNameValue(scheduleSessionParam[i].toUpperCase(), request.getParameter(scheduleSessionParam[i])));
+ }
+ }
+
+ try {
+ SimpleDateFormat oracleDateFormat = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss");
+ Date sysdate = oracleDateFormat.parse(ReportLoader.getSystemDateTime());
+ SimpleDateFormat dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern());
+ paramList.add(new IdNameValue("DATE", dtimestamp.format(sysdate)+" "+Globals.getTimeZone()));
+ } catch(Exception ex) {}
+
+ } else {
+ //System.out.println(" In Else getParamNamePairs type " + type);
+ String[] sessionDisplayParameters = Globals.getDisplaySessionParamInPDFEXCEL().split(",");
+ if(session != null && !isSchedule ) {
+ session.setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request));
+ for (int i = 0; i < sessionDisplayParameters.length; i++) {
+ String sessionDispParam = sessionDisplayParameters[i];
+ if(nvl(sessionDispParam).length()>0) {
+ String sessionDispParamArr[] = sessionDispParam.split(";");
+ //System.out.println("Session " + sessionDispParamArr[1] + " " + (String)session.getAttribute(sessionDispParamArr[0]));
+ paramList.add(new IdNameValue(sessionDispParamArr[1], nvl((String)session.getAttribute(sessionDispParamArr[0]),"")));
+ }
+ }
+ }
+ if(isSchedule) {
+ String[] scheduleSessionParam = Globals.getDisplayScheduleSessionParamInPDFEXCEL().split(",");
+ for (int i = 0; i < scheduleSessionParam.length; i++) {
+ String scheduleSessionDispParam = scheduleSessionParam[i];
+ if(nvl(scheduleSessionDispParam).length()>0) {
+ String scheduleSessionDispParamArr[] = scheduleSessionDispParam.split(";");
+ paramList.add(new IdNameValue(scheduleSessionDispParamArr[1], nvl(request.getParameter(scheduleSessionDispParamArr[0]),"")));
+ }
+ }
+ }
+ try {
+ SimpleDateFormat oracleDateFormat = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss");
+ Date sysdate = oracleDateFormat.parse(ReportLoader.getSystemDateTime());
+ SimpleDateFormat dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern());
+ paramList.add(new IdNameValue("Report Date/Time", dtimestamp.format(sysdate)+" "+Globals.getTimeZone()));
+ } catch(Exception ex) {}
+
+ }
+
+ for (int i = 0; i < paramList.size(); i++) {
+ IdNameValue value = (IdNameValue) paramList.get(i);
+ String name = value.getName().replaceAll(",","~");
+ value.setName(name);
+ }
+ //request.getSession().setAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO, paramList);
+ return paramList;
+ } // getParamNameValuePairs
+
+ /** ************** ReportFormFields processing *************** */
+
+ public String getFormFieldComments(HttpServletRequest request) {
+ String comment = "";
+ StringBuffer st = new StringBuffer("");
+ if(getFormFieldList()!=null){
+ comment = nvl(getFormFieldList().getComment());
+ ArrayList al = null;
+ if(comment.length()>0) {
+ al = getParamNameValuePairsforPDFExcel(request, 2);
+ if(al!=null) {
+ //st = new StringBuffer(comment);
+ for (int i=0; i < al.size(); i++) {
+ IdNameValue idNameValue = (IdNameValue)al.get(i);
+ if(nvl(idNameValue.getId()).equals("DATE"))
+ st.append("<b>Date/Time Report Run:</b>"+ idNameValue.getName() +"<br></br>");
+ }
+
+ for (int i=0; i < al.size(); i++) {
+ IdNameValue idNameValue = (IdNameValue)al.get(i);
+ comment = Utils.replaceInString(comment, "["+ idNameValue.getId()+"]", idNameValue.getName());
+ }
+ st.append(comment);
+
+ }
+ }
+ }
+ return st.toString();
+ }
+
+ public boolean needFormInput() {
+ return reportFormFields.getFieldCount() > 0;
+ } // needFormInput
+
+ public FormField getFormField(String fieldName) {
+ return reportFormFields.getFormField(fieldName);
+ } // getFormField
+
+ public ReportFormFields getReportFormFields() {
+ return reportFormFields;
+ } // getReportFormFields
+
+ /** ************** Report Data processing *************** */
+ public DataSet loadChartData(String userId, HttpServletRequest request) throws RaptorException {
+ if (nvl(getChartType()).length() == 0)
+ return null;
+ if (!getDisplayChart())
+ return null;
+
+ DataSet ds = chartDataCache;
+ String sql = null;
+ if (ds == null) {
+ sql = generateChartSQL(reportParamValues, userId, request);
+ String dbInfo = getDBInfo();
+ ds = ConnectionUtils.getDataSet(sql, dbInfo);
+ if (Globals.getCacheChartData())
+ chartDataCache = ds;
+ } // if
+
+ return ds;
+ } // loadChartData
+
+ public String getReportDataSQL(String userId, int downloadLimit, HttpServletRequest request) throws RaptorException {
+ //String reportSQL = generateSQL(reportParamValues, userId, request);
+ String reportSQL = "";
+ if(doesReportContainsGroupFormField()) {
+ reportSQL = generateSubsetSQL(0, downloadLimit,userId, request, true, reportParamValues);
+ } else
+ reportSQL = generateSubsetSQL(0, downloadLimit,userId, request, false, reportParamValues);
+ return reportSQL;
+ }
+
+ public ReportData loadReportData(int pageNo, String userId, int downloadLimit, HttpServletRequest request, boolean download) throws RaptorException {
+ ReportData rd = null;
+ boolean isGoBackAction = AppUtils.getRequestFlag(request, AppConstants.RI_GO_BACK);
+ if (pageNo >= 0)
+ if (pageNo == cachedPageNo && pageDataCache != null)
+ rd = pageDataCache;
+
+ if(isGoBackAction && rd!=null) return rd;
+ if (rd == null) { // Commented So that Data is refreshed from DB again
+ if (getReportDataSize() < 0)
+ //if (pageNo > 0)
+ //pageNo = 0;
+
+ if (getReportType().equals(AppConstants.RT_CROSSTAB))
+ rd = loadCrossTabReportData(pageNo, userId, downloadLimit, request, download);
+ else if (getReportType().equals(AppConstants.RT_LINEAR))
+ rd = loadLinearReportData(pageNo, userId, downloadLimit, request, download);
+ else
+ throw new RuntimeException(
+ "[ReportRuntime.loadReportData] Invalid report type");
+
+ if (pageNo >= 0)
+ if (Globals.getCacheCurPageData()) {
+ pageDataCache = rd;
+ cachedPageNo = pageNo;
+ }
+ } // if // Commented So that Data is refreshed from DB again
+
+ return rd;
+ } // loadReportData
+
+ private ReportData loadCrossTabReportData(int pageNo, String userId, int downloadLimit, HttpServletRequest request, boolean download) throws RaptorException {
+ String reportSQL = generateSQL(reportParamValues, userId, request);
+ setWholeSQL(reportSQL);
+ //if(getReportDefType().equals(AppConstants.RD_SQL_BASED))
+ // reportSQL = new SQLCorrector().fixCrosstabSQL(new StringBuffer(reportSQL));
+ cachedSQL = reportSQL;
+ wholeSQL = reportSQL;
+ //if (crossTabOrderManager == null
+ ///*&& (!getReportDefType().equals(AppConstants.RD_SQL_BASED))*/)
+ //crossTabOrderManager = new CrossTabOrderManager(this, userId,request);
+/* boolean isGoBackAction = AppUtils.getRequestFlag(request, AppConstants.RI_GO_BACK);
+ if(isGoBackAction) {
+ crossTabOrderManager = null;
+ crossTabOrderManager = new CrossTabOrderManager(this, userId,request);
+ }
+*/
+ List reportCols = getAllColumns();
+ // replace the request parameter specified in the drill down
+ DataColumnType dataColumnRequest = getCrossTabValueColumn();
+ reportSQL = parseReportSQLForDrillDownParams(reportSQL, dataColumnRequest, request);
+
+
+ DataSet ds = null;
+ // try {
+ String dbInfo = getDBInfo();
+ StringBuffer colNames = new StringBuffer();
+ StringBuffer colExtraIdNames = new StringBuffer();
+ StringBuffer colExtraDateNames = new StringBuffer();
+
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dc = (DataColumnType) iter.next();
+ //TODO: commented if (dc.isVisible()) {
+ if (colNames.length() > 0)
+ colNames.append(", ");
+ colNames.append(dc.getColId());
+ //TODO uncomment if it's not working} // if
+
+ // Checking for extra fields necessary for drill-down
+ if (nvl(dc.getDrillDownURL()).length() > 0) {
+ System.out.println("Drilldown URL " + dc.getDrillDownURL());
+
+ }
+ } // for
+
+ if (reportSQL.toUpperCase().indexOf("GROUP BY ") < 0)
+ colNames.append(colExtraIdNames.toString());
+ colNames.append(colExtraDateNames.toString());
+ //reportSQL = " SELECT ROWNUM rnum, "
+ // + colNames.toString() + " FROM (" + reportSQL + ") ";
+
+ String rSQL = Globals.getLoadCrosstabReportData();
+ rSQL = rSQL.replace("[colNames.toString()]", colNames.toString());
+ rSQL = rSQL.replace("[reportSQL]", reportSQL);
+ reportSQL = rSQL;
+ setWholeSQL(reportSQL);
+ if (crossTabOrderManager == null)
+ crossTabOrderManager = new CrossTabOrderManager(this, userId,request);
+ ds = ConnectionUtils.getDataSet(reportSQL, dbInfo);
+ // if ( (remDbInfo!=null) && (!remDbInfo.equals(AppConstants.DB_LOCAL)))
+ // ds = RemDbUtils.executeQuery(reportSQL);
+ // else
+ // ds = DbUtils.executeQuery(reportSQL);
+ /*
+ * } catch(SQLException e) { throw new
+ * ReportSQLException("[ReportRuntime.loadCrossTabReportData]
+ * "+e.getMessage(), reportSQL); }
+ */
+
+ ReportData rd = new ReportData(pageNo, false);
+ ReportFormFields childReportFormFields = null;
+ if(doesReportContainsGroupFormField()) {
+ List reportCols1 = getAllColumns();
+ reportCols = new Vector();
+ outer:
+ for (Iterator iter = reportCols1.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ for (int k=0; k<ds.getColumnCount(); k++) {
+ if(dct.getColId().toUpperCase().trim().equals(ds.getColumnName(k).trim())) {
+ reportCols.add(dct);
+ continue outer;
+ }
+ }
+ }
+
+ if (getFormFieldList() != null) {
+ String paramValue = "";
+ for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ if(fft.isGroupFormField()!=null && fft.isGroupFormField().booleanValue()) {
+ paramValue = Utils.oracleSafe(nvl(reportParamValues
+ .getParamValue(fft.getFieldId())));
+ outer:
+ for (Iterator iter1 = reportCols1.iterator(); iter1.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter1.next();
+ if(("["+fft.getFieldName()+ "]").equals(dct.getColName().trim())) {
+ dct.setDisplayName(paramValue);
+ continue outer;
+ }
+ }
+
+
+ }
+ }
+ }
+ }
+
+ int dataColumnIdx = (rd.reportRowHeaderCols.size() + rd.reportColumnHeaderRows.size())-1;
+ DataColumnType dataColumn = getCrossTabValueColumn();
+
+ String columnValue = "";
+
+
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if (nvl(dct.getDrillDownURL()).length() > 0) {
+ childReportFormFields = getChildReportFormFields(request,dct.getDrillDownURL());
+ }
+
+ if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_ROW)) {
+ RowHeaderCol rhc = new RowHeaderCol();
+ rhc.setColumnTitle(dct.getDisplayName());
+ // rhc.setColumnWidth("10%");
+ //rhc.setColumnWidth(dct.getDisplayWidth() + "%");
+ if(nvl(dct.getDisplayWidthInPxls()).length()<=0) {
+ dct.setDisplayWidthInPxls("100px");
+ }
+ if(dct.getDisplayWidthInPxls().endsWith("px"))
+ rhc.setColumnWidth(dct.getDisplayWidthInPxls());
+ else
+ rhc.setColumnWidth(dct.getDisplayWidthInPxls()+"px");
+
+ rhc.setAlignment(dct.getDisplayAlignment());
+ rhc.setDisplayHeaderAlignment(dct.getDisplayHeaderAlignment());
+ rhc.setNowrap(nvl(dataColumn.getNowrap(),"null").equals("false")?"null":nvl(dataColumn.getNowrap(),"null"));
+ rd.reportRowHeaderCols.addRowHeaderCol(rhc);
+ } else if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_COLUMN)) {
+ ColumnHeaderRow chr = new ColumnHeaderRow();
+ chr.setAlignment(dct.getDisplayHeaderAlignment());
+ chr.setRowHeight("15");
+ if(nvl(dct.getDisplayWidthInPxls()).length()<=0) {
+ dct.setDisplayWidthInPxls("80px");
+ }
+ if(dct.getDisplayWidthInPxls().endsWith("px"))
+ chr.setDisplayWidth(dct.getDisplayWidthInPxls());
+ else
+ chr.setDisplayWidth(dct.getDisplayWidthInPxls()+"px");
+
+ rd.reportColumnHeaderRows.addColumnHeaderRow(chr);
+ } else if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_VALUE)) {
+ columnValue = dct.getColId();
+ } else {
+ if(!dct.getColId().toLowerCase().endsWith("_sort")) {
+ RowHeaderCol rhc = new RowHeaderCol();
+ rhc.setVisible(false);
+ rd.reportRowHeaderCols.addRowHeaderCol(rhc);
+ }
+ }
+ } // for
+
+ //int dataColumnIdx = getCrossTabValueColumnIndex();
+ FormatProcessor formatProcessor = new FormatProcessor(getSemaphoreById(dataColumn
+ .getSemaphoreId()),
+ getReportDefType().equals(AppConstants.RD_SQL_BASED) ? AppConstants.CT_NUMBER
+ : dataColumn.getColType(), dataColumn.getColFormat(), false);
+ List dataList = new ArrayList();
+ /* //fillup all rows based on rowheaders
+ Vector rowHeaders = crossTabOrderManager.getRowHeaderValues();
+ CrossTabColumnValues crossTabRowValues;
+ int size = 0;
+ for (int i = 0; i < rowHeaders.size(); i++) {
+ if((i+1)==rowHeaders.size()) {
+ crossTabRowValues = (CrossTabColumnValues) rowHeaders.get(i);
+ size = crossTabRowValues.getValuesCount();
+ }
+ }
+
+ for (int i = 0; i < size; i++) {
+ dataList.add(new DataRow());
+ }*/
+
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ Vector rValues = new Vector();
+ Vector cValues = new Vector();
+ Vector cValuesSort = new Vector();
+
+ int colIdx = 0;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ try {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_ROW))
+ rValues.add(addDataValue(dct, ds.getString(i, dct.getColId())));
+ if (nvl(dct.getCrossTabValue()).trim().length()<=0 && !dct.getColId().toLowerCase().endsWith("_sort"))
+ rValues.add(addDataValue(dct, ds.getString(i, dct.getColId())));
+ if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_COLUMN)) {
+ cValues.add(addDataValue(dct, ds.getString(i, dct.getColId())));
+ if(getColumnById(dct.getColId().toLowerCase()+"_sort")!=null)
+ cValuesSort.add(addDataValue(dct, new Integer(ds.getString(i, dct.getColId()+"_sort")).toString()));
+ }
+ if (dct.isVisible())
+ colIdx++;
+ } catch (ArrayIndexOutOfBoundsException ex ) {continue;}
+ catch (NumberFormatException ex1) {
+ ex1.printStackTrace();
+ continue;
+ }
+ } // for
+
+ DataValue dv = new DataValue();
+ dv.setDisplayValue(ds.getString(i, columnValue));
+ if (nvl(dataColumn.getCrossTabValue()).trim().length()<=0)
+ dv.setVisible(false);
+ dv.setAlignment(dataColumn.getDisplayAlignment());
+ dv.setDisplayTotal(dataColumn.getDisplayTotal());
+ dv.setColName(dataColumn.getColName());
+ dv.setDisplayName(dataColumn.getDisplayName());
+ dv.setColId(dataColumn.getColId());
+ dv.setNowrap(nvl(dataColumn.getNowrap(),"null").equals("false")?"null":nvl(dataColumn.getNowrap(),"null"));
+ /*StringBuffer indentation = new StringBuffer("");
+ if(dataColumn.getIndentation()!=null && dataColumn.getIndentation().intValue()>0) {
+ for (int indent=0; indent < dataColumn.getIndentation(); indent++) {
+ indentation.append("\t");
+ }
+ dv.setNowrap("true");
+ }
+ dv.setIndentation(indentation.toString());*/
+
+ if (nvl(dataColumn.getDrillDownURL()).length() > 0) {
+ if(dv.getDisplayValue().length() > 0) {
+ dv.setDrillDownURL(parseDrillDownURL(i, /* dataColumnIdx, */ds, dataColumn,request, childReportFormFields));
+ dv.setDrillDowninPoPUp(dataColumn.isDrillinPoPUp()!=null?dataColumn.isDrillinPoPUp():false);
+ }
+ if (dv.getDisplayValue().length() == 0) {
+ //dv.setDisplayValue("[NULL]");
+ dv.setDisplayValue("");
+ }
+ } // if
+
+ rd.setDataValue(rValues, cValues, cValuesSort.size()==0?null:cValuesSort, dv, formatProcessor, crossTabOrderManager, dataList);
+ } // for
+ rd.setReportDataList(dataList);
+ /*if (getReportDataSize() < 0)
+ setReportDataSize(rd.getDataRowCount());*/
+
+ /*if (pageNo >= 0)
+ rd.truncateData(pageNo * getPageSize(), (pageNo + 1) * getPageSize() - 1);
+ else {
+ if( downloadLimit != -1)
+ rd.truncateData(0, downloadLimit - 1);
+ else
+ rd.truncateData(0, -1);
+ }*/
+
+ if (colDataTotalsCrosstab == null)
+ colDataTotalsCrosstab = generateDataTotalsCrossTab(AppConstants.CV_COLUMN, userId,request);
+ if (displayColTotals && colDataTotalsCrosstab != null)
+ rd.setColumnDataTotalsCrossTab(colDataTotalsCrosstab, dataColumn
+ .getDisplayAlignment(), getCrossTabDisplayTotal(AppConstants.CV_COLUMN),
+ crossTabOrderManager, dataList);
+
+ if (rowDataTotalsCrosstab == null)
+ rowDataTotalsCrosstab = generateDataTotalsCrossTab(AppConstants.CV_ROW, userId, request);
+ if (displayRowTotals && rowDataTotalsCrosstab != null)
+ rd.setRowDataTotalsCrossTab(rowDataTotalsCrosstab, dataColumn
+ .getDisplayAlignment(), getCrossTabDisplayTotal(AppConstants.CV_ROW),
+ crossTabOrderManager, dataList);
+
+ if (displayColTotals
+ && displayRowTotals
+ && getCrossTabDisplayTotal(AppConstants.CV_COLUMN).equals(
+ getCrossTabDisplayTotal(AppConstants.CV_ROW))) {
+ // Display grand total
+ if (grandTotalCrosstab == null)
+ grandTotalCrosstab = ((CrossTabTotalValue) generateDataTotalsCrossTab("",
+ userId,request).get(0)).getTotalValue();
+ if (grandTotalCrosstab != null)
+ rd.setGrandTotalCrossTab(Utils.truncateTotalDecimals(grandTotalCrosstab),
+ dataColumn.getDisplayAlignment(),
+ getCrossTabDisplayTotal(AppConstants.CV_COLUMN), dataList);
+ } // if
+
+ rd.consolidateColumnHeaders(visualManager);
+ //if (Globals.getMergeCrosstabRowHeadings())
+ // rd.consolidateRowHeaders();
+ //rd.addRowNumbers(pageNo, dataList);
+
+ if (displayColTotals && colDataTotalsCrosstab != null) {
+ String totalLabel = "Total";
+ String colDisplayTotal = getCrossTabDisplayTotal(AppConstants.CV_COLUMN);
+ if (colDisplayTotal.length() > 0
+ && (!colDisplayTotal.equals(AppConstants.TOTAL_SUM_ID)))
+ totalLabel = nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(colDisplayTotal));
+ if (getReportDataSize() > getPageSize())
+ totalLabel += "_nl_(for all pages)";
+
+ //rd.setCrossTabColumnTotalLabel(totalLabel);
+ } // if
+
+ //rd.applyVisibility();
+ //Collections.sort((List)dataList, new DataRowComparable());
+ DataRow drInFor1 = null;
+ Vector<DataValue> v1= null, v2 = null;
+ ArrayList<String> temp = new ArrayList<String>();
+ if (Globals.getMergeCrosstabRowHeadings()) {
+ for (int i = 0; i < dataList.size(); i++) {
+ drInFor1 = (DataRow)dataList.get(i);
+ drInFor1.setRowNum(i+1);
+ v1 = drInFor1.getRowValues();
+ if(i<dataList.size()-1) {
+ v2 = ((DataRow)dataList.get(i+1)).getRowValues();
+ } /*else {
+ v2 = ((DataRow)dataList.get(i-1)).getRowValues();
+ }*/
+ for (int j = 0; j < v1.size(); j++) {
+ if(j==0) {
+ if(v1.get(j).getDisplayValue().length()>0) { // another ArrayList
+ temp = new ArrayList();
+ temp.add(v1.get(j).getDisplayValue());
+ }
+ if(v2!=null && temp.get(j).equals(v2.get(j).getDisplayValue())) {
+ v2.get(j).setDisplayValue("");
+ }
+ }
+ }
+ }
+ }
+ rd.setReportDataList(dataList);
+ if (getReportDataSize() < 0) {
+ //setReportDataSize(rd.getDataRowCount());
+ setReportDataSize(rd.getReportDataList().size());
+ }
+
+ return rd;
+ } // loadCrossTabReportData
+
+
+ public DataValue addDataValue(DataColumnType dataColumn, String columnValue) {
+ DataValue dv = new DataValue();
+ dv.setDisplayValue(columnValue);
+ if (nvl(dataColumn.getCrossTabValue()).trim().length()<=0)
+ dv.setVisible(false);
+ dv.setAlignment(dataColumn.getDisplayAlignment());
+ dv.setDisplayTotal(dataColumn.getDisplayTotal());
+ dv.setColName(dataColumn.getColName());
+ dv.setDisplayName(dataColumn.getDisplayName());
+ dv.setColId(dataColumn.getColId());
+ dv.setNowrap(nvl(dataColumn.getNowrap(),"null").equals("false")?"null":nvl(dataColumn.getNowrap(),"null"));
+ return dv;
+
+ }
+
+ /*private*/ public boolean doesReportContainsGroupFormField() {
+ int flag = 0;
+ if(getFormFieldList()!=null) {
+ for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ if(fft.isGroupFormField()!=null && fft.isGroupFormField().booleanValue()) {
+ flag = 1;
+ break;
+ }
+ }
+ }
+ return (flag ==1);
+ }
+
+ private ReportData loadLinearReportData(int pageNo, String userId, int downloadLimit, HttpServletRequest request, boolean download) throws RaptorException {
+ String action = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));;
+
+ String reportSQL = "";
+
+ if(action.endsWith("session")) {
+ reportSQL = getWholeSQL();
+ wholeSQL = reportSQL;
+ } else {
+ reportSQL = generateSQL(reportParamValues, visualManager.getSortByColId(),
+ visualManager.getSortByAscDesc(), userId, request);
+ wholeSQL = reportSQL;
+ setWholeSQL(wholeSQL);
+ }
+ DataSet ds = null;
+ String dbInfo = getDBInfo();
+ ds = ConnectionUtils.getDataSet(wholeSQL, dbInfo);
+ setReportDataSize(ds.getRowCount());
+ //wholeSQL = reportSQL;
+ HttpSession session = request.getSession();
+ //debugLogger.debug(" ******** Download Limit ********* " + downloadLimit + " %%%%%%%%%%PAGE " + pageNo );
+ List reportCols = null;
+ StringBuffer colNames = new StringBuffer();
+
+ if(download && action.endsWith("session")) {
+ reportCols = getAllColumns();
+ colNames = new StringBuffer();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (colNames.length() > 0)
+ colNames.append(", ");
+ colNames.append(dc.getColId());
+ }
+
+ }
+ else {
+ String pagedSQL = null; // reportSQL;
+ if (pageNo >= 0)
+ pagedSQL = generatePagedSQL(pageNo, userId, request, false, null);
+ else
+ pagedSQL = generateSubsetSQL(0, downloadLimit, userId, request, false, null);
+ // replace the request parameter specified in the drill down
+ reportCols = getAllColumns();
+ colNames = new StringBuffer();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (colNames.length() > 0)
+ colNames.append(", ");
+ colNames.append(dc.getColId());
+ if (dc.isVisible()) {
+ reportSQL = parseReportSQLForDrillDownParams(reportSQL, dc, request);
+ pagedSQL = parseReportSQLForDrillDownParams(pagedSQL, dc, request);
+ }
+ }
+
+ cachedSQL = pagedSQL;
+
+
+ // try {
+ if(doesReportContainsGroupFormField()) {
+ if (pageNo >= 0)
+ pagedSQL = generatePagedSQL(pageNo, userId, request, true, reportParamValues);
+ else
+ pagedSQL = generateSubsetSQL(0, downloadLimit, userId, request, true, reportParamValues);
+ }
+ //check for Group formfield
+ //if groupformfield get columns from sql
+
+ ds = ConnectionUtils.getDataSet(pagedSQL, dbInfo);
+
+ if(doesReportContainsGroupFormField()) {
+ List reportCols1 = getAllColumns();
+ reportCols = new Vector();
+ outer:
+ for (Iterator iter = reportCols1.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ for (int k=0; k<ds.getColumnCount(); k++) {
+ if(dct.getColId().toUpperCase().trim().equals(ds.getColumnName(k).trim())) {
+ reportCols.add(dct);
+ continue outer;
+ }
+ }
+ }
+
+ if (getFormFieldList() != null) {
+ String paramValue = "";
+ for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ if(fft.isGroupFormField()!=null && fft.isGroupFormField().booleanValue()) {
+ paramValue = Utils.oracleSafe(nvl(reportParamValues
+ .getParamValue(fft.getFieldId())));
+ outer:
+ for (Iterator iter1 = reportCols1.iterator(); iter1.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter1.next();
+ if(("["+fft.getFieldName()+ "]").equals(dct.getColName().trim())) {
+ dct.setDisplayName(paramValue);
+ continue outer;
+ }
+ }
+
+
+ }
+ }
+ }
+ }
+
+
+ // if ( (remDbInfo!=null) && (!remDbInfo.equals(AppConstants.DB_LOCAL)))
+ // {
+ // Globals.getRDbUtils().setDBPrefix(remDbInfo);
+ // ds = RemDbUtils.executeQuery(pagedSQL);
+ // }
+ // else
+ // ds = DbUtils.executeQuery(pagedSQL);
+ /*
+ * } catch(SQLException e) { throw new
+ * ReportSQLException("[ReportRuntime.loadLinearReportData]
+ * "+e.getMessage(), pagedSQL); }
+ */
+
+ if (getReportDataSize() < 0)
+ if (pageNo < 0)
+ setReportDataSize(ds.getRowCount());
+ else if (ds.getRowCount() <= getPageSize())
+ setReportDataSize(ds.getRowCount());
+ else {
+
+ /*Pattern re1 = Pattern.compile("[Oo][Rr][Dd][Ee][Rr](.*?[^\r\n]*)[Bb][Yy]", Pattern.DOTALL);
+ Pattern re2 = Pattern.compile("[Oo][Rr][Dd][Ee][Rr](.*?[^\r\n]*)[Bb][Yy]((.*?[^\r\n]*)|[\\s]|[^0-9a-zA-Z])\\)", Pattern.DOTALL);
+ Matcher matcher = re1.matcher(reportSQL);
+ Matcher matcher2 = null;
+ int startPoint = reportSQL.length()-30;
+ String startReportSQL = "";
+ String endReportSQL = "";
+ while(reportSQL.indexOf("xid", startPoint)!=-1)startPoint++;
+ if (matcher.find(startPoint)) {
+ startReportSQL = reportSQL.substring(0, reportSQL.indexOf(matcher.group()));
+ endReportSQL = reportSQL.substring(reportSQL.indexOf(matcher.group()));
+ matcher2 = re2.matcher(endReportSQL);
+ if(matcher2.find())
+ endReportSQL = endReportSQL.substring(matcher.group().length()-1);
+ else
+ endReportSQL = "";
+ reportSQL = startReportSQL + endReportSQL;
+ }*/
+ String countSQL = "SELECT count(*) FROM (" + reportSQL + ")"+ (Globals.isPostgreSQL() || Globals.isMySQL()?" AS ":"") +" x ";
+ String dbType = "";
+
+ if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ try {
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ dbType = remDbInfo.getDBType(dbInfo);
+ if (dbType.equals("DAYTONA") && reportSQL.trim().toUpperCase().startsWith("SELECT")) {
+ Pattern re1 = Pattern.compile("order(.*?[^\r\n]*)by", Pattern.DOTALL);
+ Matcher matcher = re1.matcher(reportSQL);
+ int startPoint = reportSQL.length()-30;
+ while(reportSQL.indexOf("xid", startPoint)!=-1)startPoint++;
+ if (matcher.find(startPoint)) {
+ reportSQL = reportSQL.substring(0, reportSQL.indexOf(matcher.group()));
+ }
+ countSQL = "SELECT count(*) FROM (" + reportSQL + ")"+ (Globals.isPostgreSQL() || Globals.isMySQL()?" AS ":"") +" x";
+ countSQL = countSQL + " ("+ colNames+ ")";
+ } else if (dbType.equals("DAYTONA")) {
+ setReportDataSize(50);
+ }
+ } catch (Exception ex) {
+ throw new RaptorException(ex);
+ }
+ }
+
+ DataSet ds2 = null;
+ // try {
+ if(reportSQL.trim().toUpperCase().startsWith("SELECT")) {
+ ds2 = ConnectionUtils.getDataSet(countSQL, dbInfo);
+ if (ds2.getRowCount() > 0)
+ setReportDataSize(ds2.getInt(0, 0));
+ else
+ throw new RuntimeException(
+ "[ReportRuntime.loadLinearReportData] Unable to load report data size");
+ } else
+ setReportDataSize(50);
+ // if ( (remDbInfo!=null) &&
+ // (!remDbInfo.equals(AppConstants.DB_LOCAL))){
+ // Globals.getRDbUtils().setDBPrefix(remDbInfo);
+ // ds2 = RemDbUtils.executeQuery(countSQL);
+ // }
+ // else
+ // ds2 = DbUtils.executeQuery(countSQL);
+ /*
+ * } catch(SQLException e) { throw new
+ * ReportSQLException("[ReportRuntime.loadLinearReportData size]
+ * "+e.getMessage(), countSQL); }
+ */
+
+
+ } // else
+ }
+ ReportData rd = new ReportData(pageNo, true);
+
+ // Already defined changed for modifying request parameters
+ //List reportCols = getAllColumns();
+ Vector visibleCols = new Vector(reportCols.size());
+ Vector formatProcessors = new Vector(reportCols.size());
+
+ // ColumnHeaderRow chr = new ColumnHeaderRow();
+ // rd.reportColumnHeaderRows.addColumnHeaderRow(chr);
+ // chr.setRowHeight("30");
+ int count =0 ;
+
+ /* ADDED */
+ ReportFormFields rff = getReportFormFields();
+ ReportFormFields childReportFormFields = null;
+ String fieldDisplayName = "";
+ String fieldValue = "";
+
+ for (int c = 0; c < reportCols.size(); c++) {
+ if(reportCols.get(c)!=null) {
+ DataColumnType dct = (DataColumnType) reportCols.get(c);
+ if(nvl(dct.getDependsOnFormField()).length()>0 && nvl(dct.getDependsOnFormField()).indexOf("[")!=-1) {
+ for(int i = 0 ; i < rff.size(); i++) {
+ fieldDisplayName = "["+((FormField)rff.getFormField(i)).getFieldDisplayName()+"]";
+ fieldValue = "";
+ //if(dct.getOriginalDisplayName()==null) dct.setOriginalDisplayName(dct.getDisplayName());
+ if (dct.getDependsOnFormField().equals(fieldDisplayName)) {
+ fieldValue = nvl(request.getParameter(((FormField)rff.getFormField(i)).getFieldName()));
+
+ if (fieldValue.length()>0) {
+ if(!fieldValue.toUpperCase().equals("Y"))
+ dct.setDisplayName(fieldValue);
+ if(!dct.isVisible())
+ dct.setVisible(true);
+ } else {
+ dct.setVisible(false);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* ADDED */
+ String displayName = "";
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dc = (DataColumnType) iter.next();
+
+ formatProcessors.add(count,new FormatProcessor(
+ getSemaphoreById(dc.getSemaphoreId()), dc.getColType(), dc
+ .getColFormat(), getReportDefType().equals(
+ AppConstants.RD_SQL_BASED)));
+
+ if (nvl(dc.getDrillDownURL()).length() > 0) {
+ childReportFormFields = getChildReportFormFields(request,AppUtils.getDrillActionURL()+""+dc.getDrillDownURL());
+ }
+ if (dc.isVisible()) {
+ visibleCols.add(count,dc);
+ //if(dc.getColId().startsWith("group")) {
+ for (int d = 0; d < reportCols.size(); d++) {
+ if(reportCols.get(d)!=null) {
+ DataColumnType dct1 = (DataColumnType) reportCols.get(d);
+ if(dct1.getColId().equals(dc.getColId()+"_name") && ds.getRowCount()>0) {
+ displayName = ds.getString(0,dct1.getColId());
+ dc.setDisplayName(displayName);
+ }
+ }
+ }
+ //}
+
+ String widthInPxls = dc.getDisplayWidthInPxls();
+
+ if(nvl(widthInPxls).endsWith("px"))
+ dc.setDisplayWidthInPxls(widthInPxls);
+ else {
+ widthInPxls = widthInPxls+"px";
+ dc.setDisplayWidthInPxls(widthInPxls+"px");
+ }
+
+ rd.createColumn(dc.getColId(), dc.getDisplayName(), dc.getDisplayWidthInPxls(), dc.getDisplayHeaderAlignment(),
+ visualManager.isColumnVisible(dc.getColId()), visualManager
+ .getSortByColId().equals(dc.getColId()) ? visualManager
+ .getSortByAscDesc() : null, isRuntimeColSortDisabled(), dc.getLevel()!=null?dc.getLevel():0, dc.getStart()!=null?dc.getStart():0, dc.getColspan()!=null?dc.getColspan():0, dc.isIsSortable()!=null?dc.isIsSortable():false);
+ // chr.addColumnHeader(new ColumnHeader(dc.getDisplayName(),
+ // (dc.getDisplayWidth()>100)?"10%":(""+dc.getDisplayWidth()+"%")));
+ } // if
+ else {
+ visibleCols.add(count,null);
+ rd.createColumn(dc.getColId(), AppConstants.HIDDEN, dc.getDisplayWidthInPxls(), dc.getDisplayHeaderAlignment(),
+ false, null,false, dc.getLevel()!=null?dc.getLevel():0, dc.getStart()!=null?dc.getStart():0, dc.getColspan()!=null?dc.getColspan():0, dc.isIsSortable()!=null?dc.isIsSortable():false);
+// formatProcessors.add(count,null);
+ }
+ count++;
+ } // for
+
+ if(getReportDefType().equals(AppConstants.RD_SQL_BASED_DATAMIN) && pageNo ==0) {
+ /*Vector v = null;
+ try {
+ v = addForecastData(reportSQL);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ throw new RaptorException (ex);
+ }
+ session.setAttribute("FORECASTED_DATA", v);
+ DataSet dsWhole = ConnectionUtils.getDataSet(wholeSQL, dbInfo);
+ dsWhole.addAll(v);
+ session.setAttribute(AppConstants.RI_CHART_FORECAST_DATA, dsWhole);
+ }
+
+ if(getReportDefType().equals(AppConstants.RD_SQL_BASED_DATAMIN) && session.getAttribute("FORECASTED_DATA")!=null) {
+ Vector vForecastedData = (Vector)session.getAttribute("FORECASTED_DATA");
+ if(vForecastedData.size() > 0)
+ ds.addAll(vForecastedData);*/
+ }
+
+
+ // Utils._assert(chr.size()==ds.getColumnCount(),
+ // "[ReportRuntime.loadLinearReportData] The number of visible columns
+ // does not match the number of data columns");
+ //TODO: This should be optimized to accept -1 for flat file download
+ for (int r = 0; r < Math.min(ds.getRowCount(), ((pageNo < 0) ? (downloadLimit == -1?Globals.getFlatFileUpperLimit():Globals.getDownloadLimit() ) : getPageSize())); r++) {
+ DataRow dr = new DataRow();
+ rd.reportDataRows.addDataRow(dr);
+
+ for (int c = 0; c < reportCols.size(); c++) {
+ if(reportCols.get(c)!=null) {
+ DataColumnType dct = (DataColumnType) reportCols.get(c);
+ DataValue dv = new DataValue();
+ dr.addDataValue(dv);
+ dv.setDisplayValue(ds.getString(r, c));
+ dv.setColName(dct.getColName());
+ dv.setColId(dct.getColId());
+ dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+ StringBuffer indentation = new StringBuffer("");
+ if(dct.getIndentation()!=null && dct.getIndentation()>0) {
+ for (int indent=0; indent< dct.getIndentation(); indent++) {
+ indentation.append("\t");
+ }
+ dv.setNowrap("true");
+ }
+ dv.setIndentation(indentation.toString());
+ if(dct.isVisible()) {
+
+ dv.setVisible(true);
+ dv.setAlignment(dct.getDisplayAlignment());
+ dv.setDisplayTotal(dct.getDisplayTotal());
+ dv.setDisplayName(dct.getDisplayName());
+
+ if (nvl(dct.getDrillDownURL()).length() > 0) {
+
+ if(dv.getDisplayValue().length() > 0) {
+ dv.setDrillDownURL(parseDrillDownURL(r, /* c, */ds, dct,request, childReportFormFields));
+ dv.setDrillDowninPoPUp(dct.isDrillinPoPUp()!=null?dct.isDrillinPoPUp():false);
+ }
+
+ if (dv.getDisplayValue().length() == 0) {
+ //dv.setDisplayValue("[NULL]");
+ dv.setDisplayValue("");
+ }
+ } // if
+
+ } else {
+ dv.setVisible(false);
+ dv.setHidden(true);
+ }
+ //System.out.println("in Linear report b4" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+
+ if(dr.getFormatId()!=null)
+ ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, true);
+ else
+ ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, false);
+
+ //System.out.println("in Linear report After" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+ } // if reportCols
+ } // for
+ } // for
+
+ //Only if rownumber options is needed
+ //rd.addRowNumbers(pageNo, getPageSize());
+
+ if (colDataTotalsLinear == null) {
+ if(!download && !action.endsWith("session"))
+ colDataTotalsLinear = generateColumnDataTotalsLinear(new ArrayList(reportCols), userId,
+ getDbInfo(),request);
+ if(download && action.endsWith("session"))
+ colDataTotalsLinear = generateColumnDataTotalsLinear(new ArrayList(reportCols), userId,
+ getDbInfo(), getTotalSql());
+ }
+ if (displayColTotals && colDataTotalsLinear != null) {
+ String totalLabel = "Total";
+ if (getReportDataSize() > getPageSize())
+ totalLabel += "<br><font size=1>(for all pages)</font>";
+
+ rd.setColumnDataTotalsLinear(colDataTotalsLinear, totalLabel);
+ } // if
+ // Please note the below function doesn't set the visibility for dv since this is set in this function. - Sundar
+ rd.applyVisibility();
+
+ return rd;
+ } // loadLinearReportData
+
+
+
+ public DataRow generateColumnDataTotalsLinear(ArrayList reportCols, String userId,
+ String dbInfo, String reportSQL) throws RaptorException {
+ DataRow dr = null;
+
+ boolean displayColTotals = false;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dct = (DataColumnType) iter.next();
+ if( dct != null ) {
+ if (nvl(dct.getDisplayTotal()).length() > 0) {
+ displayColTotals = true;
+ break;
+ } // if
+ } // if checking dct
+ } // for
+
+ DataSet ds = null;
+ if (displayColTotals) {
+ dr = new DataRow();
+ // ds =
+ // DbUtils.executeQuery(generateTotalSQLLinear(reportParamValues,
+ // userId));
+ ds = ConnectionUtils.getDataSet(reportSQL,
+ dbInfo);
+
+ for (int c = 0; c < reportCols.size(); c++) {
+ DataColumnType dct = (DataColumnType) reportCols.get(c);
+ if ( dct != null ) {
+ DataValue dv = new DataValue();
+
+ String totalValue = "";
+ if (ds != null)
+ totalValue = ds.getString(0, c);
+ if (nvl(dct.getDisplayTotal()).length() > 0
+ && (!dct.getDisplayTotal().equals(AppConstants.TOTAL_SUM_ID)))
+ totalValue = nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(dct
+ .getDisplayTotal()))
+ + ": " + totalValue;
+ dv.setDisplayValue(Utils.truncateTotalDecimals(totalValue));
+
+ dv.setAlignment(dct.getDisplayAlignment());
+ dv.setColName(dct.getColName());
+ dv.setDisplayName(dct.getDisplayName());
+ dv.setColId(dct.getColId());
+ dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+ StringBuffer indentation = new StringBuffer("");
+ if(dct.getIndentation()!=null && dct.getIndentation()>0) {
+ for (int indent=0; indent< dct.getIndentation(); indent++) {
+ indentation.append("\t");
+ }
+ dv.setNowrap("true");
+ }
+ dv.setIndentation(indentation.toString());
+ dv.setDisplayTotal(dct.getDisplayTotal());
+ dv.setBold(true);
+ dv.setVisible(dct.isVisible());
+ if(dv.isVisible())
+ dr.addDataValue(dv);
+ } // dct check
+ } // for
+ }
+
+ return dr;
+ } // generateColumnDataTotalsLinear
+
+
+ public ReportData loadHiveLinearReportData(String reportSQL, String userId, int downloadLimit, HttpServletRequest request) throws RaptorException {
+ wholeSQL = reportSQL;
+ int countRows = getHiveReportCount(wholeSQL);
+ setReportDataSize(countRows);
+ if(countRows < 1001)
+ wholeSQL += " limit "+ countRows;
+ else
+ wholeSQL += " limit "+ downloadLimit;
+ HttpSession session = request.getSession();
+
+ DataSet ds = null;
+ // try {
+ String dbInfo = getDBInfo();
+
+ List reportCols = getAllColumns();
+ StringBuffer colNames = new StringBuffer();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (colNames.length() > 0)
+ colNames.append(", ");
+ colNames.append(dc.getColId());
+ }
+
+ ds = ConnectionUtils.getDataSet(wholeSQL, dbInfo);
+
+ ReportData rd = new ReportData(0, true);
+
+ // Already defined changed for modifying request parameters
+ //List reportCols = getAllColumns();
+ Vector visibleCols = new Vector(reportCols.size());
+ Vector formatProcessors = new Vector(reportCols.size());
+
+ // ColumnHeaderRow chr = new ColumnHeaderRow();
+ // rd.reportColumnHeaderRows.addColumnHeaderRow(chr);
+ // chr.setRowHeight("30");
+ int count =0 ;
+
+ /* ADDED */
+ ReportFormFields rff = getReportFormFields();
+ ReportFormFields childReportFormFields = null;
+ String fieldDisplayName = "";
+ String fieldValue = "";
+
+ for (int c = 0; c < reportCols.size(); c++) {
+ if(reportCols.get(c)!=null) {
+ DataColumnType dct = (DataColumnType) reportCols.get(c);
+ if(nvl(dct.getDependsOnFormField()).length()>0 && nvl(dct.getDependsOnFormField()).indexOf("[")!=-1) {
+ for(int i = 0 ; i < rff.size(); i++) {
+ fieldDisplayName = "["+((FormField)rff.getFormField(i)).getFieldDisplayName()+"]";
+ fieldValue = "";
+ //if(dct.getOriginalDisplayName()==null) dct.setOriginalDisplayName(dct.getDisplayName());
+ if (dct.getDependsOnFormField().equals(fieldDisplayName)) {
+ fieldValue = nvl(request.getParameter(((FormField)rff.getFormField(i)).getFieldName()));
+
+ if (fieldValue.length()>0) {
+ if(!fieldValue.toUpperCase().equals("Y"))
+ dct.setDisplayName(fieldValue);
+ if(!dct.isVisible())
+ dct.setVisible(true);
+ } else {
+ dct.setVisible(false);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* ADDED */
+ String displayName = "";
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dc = (DataColumnType) iter.next();
+
+ formatProcessors.add(count,new FormatProcessor(
+ getSemaphoreById(dc.getSemaphoreId()), dc.getColType(), dc
+ .getColFormat(), getReportDefType().equals(
+ AppConstants.RD_SQL_BASED)));
+
+ if (nvl(dc.getDrillDownURL()).length() > 0) {
+ childReportFormFields = getChildReportFormFields(request,dc.getDrillDownURL());
+ }
+ if (dc.isVisible()) {
+ visibleCols.add(count,dc);
+ //if(dc.getColId().startsWith("group")) {
+ for (int d = 0; d < reportCols.size(); d++) {
+ if(reportCols.get(d)!=null) {
+ DataColumnType dct1 = (DataColumnType) reportCols.get(d);
+ if(dct1.getColId().equals(dc.getColId()+"_name") && ds.getRowCount()>0) {
+ displayName = ds.getString(0,dct1.getColId());
+ dc.setDisplayName(displayName);
+ }
+ }
+ }
+ //}
+
+ String widthInPxls = dc.getDisplayWidthInPxls();
+
+ if(nvl(widthInPxls).endsWith("px"))
+ dc.setDisplayWidthInPxls(widthInPxls);
+ else {
+ widthInPxls = widthInPxls+"px";
+ dc.setDisplayWidthInPxls(widthInPxls+"px");
+ }
+
+ rd.createColumn(dc.getColId(), dc.getDisplayName(), dc.getDisplayWidthInPxls(), dc.getDisplayHeaderAlignment(),
+ visualManager.isColumnVisible(dc.getColId()), visualManager
+ .getSortByColId().equals(dc.getColId()) ? visualManager
+ .getSortByAscDesc() : null, isRuntimeColSortDisabled(), dc.getLevel()!=null?dc.getLevel():0, dc.getStart()!=null?dc.getStart():0, dc.getColspan()!=null?dc.getColspan():0, dc.isIsSortable()!=null?dc.isIsSortable():false);
+ // chr.addColumnHeader(new ColumnHeader(dc.getDisplayName(),
+ // (dc.getDisplayWidth()>100)?"10%":(""+dc.getDisplayWidth()+"%")));
+ } // if
+ else {
+ visibleCols.add(count,null);
+ rd.createColumn(dc.getColId(), AppConstants.HIDDEN, dc.getDisplayWidthInPxls(), dc.getDisplayHeaderAlignment(),
+ false, null,false, dc.getLevel()!=null?dc.getLevel():0, dc.getStart()!=null?dc.getStart():0, dc.getColspan()!=null?dc.getColspan():0, dc.isIsSortable()!=null?dc.isIsSortable():false);
+// formatProcessors.add(count,null);
+ }
+ count++;
+ } // for
+
+ ArrayList reportDataList = new ArrayList();
+ for (int r = 0; r < ds.getRowCount(); r++) {
+ DataRow dr = new DataRow();
+ rd.reportDataRows.addDataRow(dr);
+
+ for (int c = 0; c < reportCols.size(); c++) {
+ if(reportCols.get(c)!=null) {
+ DataColumnType dct = (DataColumnType) reportCols.get(c);
+ DataValue dv = new DataValue();
+ dr.addDataValue(dv);
+ dv.setDisplayValue(ds.getString(r, c));
+ dv.setColName(dct.getColName());
+ dv.setColId(dct.getColId());
+ dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+ StringBuffer indentation = new StringBuffer("");
+ if(dct.getIndentation()!=null && dct.getIndentation()>0) {
+ for (int indent=0; indent< dct.getIndentation(); indent++) {
+ indentation.append("\t");
+ }
+ dv.setNowrap("true");
+ }
+ dv.setIndentation(indentation.toString());
+ if(dct.isVisible()) {
+
+ dv.setVisible(true);
+ dv.setAlignment(dct.getDisplayAlignment());
+ dv.setDisplayTotal(dct.getDisplayTotal());
+ dv.setDisplayName(dct.getDisplayName());
+
+ if (nvl(dct.getDrillDownURL()).length() > 0) {
+
+ if(dv.getDisplayValue().length() > 0) {
+ dv.setDrillDownURL(parseDrillDownURL(r, /* c, */ds, dct,request, childReportFormFields));
+ dv.setDrillDowninPoPUp(dct.isDrillinPoPUp()!=null?dct.isDrillinPoPUp():false);
+ }
+
+ if (dv.getDisplayValue().length() == 0) {
+ //dv.setDisplayValue("[NULL]");
+ dv.setDisplayValue("");
+ }
+ } // if
+
+ } else {
+ dv.setVisible(false);
+ dv.setHidden(true);
+ }
+ //System.out.println("in Linear report b4" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+
+ if(dr.getFormatId()!=null)
+ ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, true);
+ else
+ ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, false);
+
+ //System.out.println("in Linear report After" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+ } // if reportCols
+ } // for
+ reportDataList.add(dr);
+ } // for
+ rd.setReportDataList(reportDataList);
+ //Only if rownumber options is needed
+ //rd.addRowNumbers(pageNo, getPageSize());
+
+ if (colDataTotalsLinear == null)
+ colDataTotalsLinear = generateColumnDataTotalsLinear(new ArrayList(reportCols), userId,
+ getDbInfo(),request);
+ if (displayColTotals && colDataTotalsLinear != null) {
+ String totalLabel = "Total";
+ if (getReportDataSize() > getPageSize())
+ totalLabel += "<br><font size=1>(for all pages)</font>";
+
+ rd.setColumnDataTotalsLinear(colDataTotalsLinear, totalLabel);
+ } // if
+ // Please note the below function doesn't set the visibility for dv since this is set in this function. - Sundar
+ rd.applyVisibility();
+
+ return rd;
+ } // loadHiveLinearReportData
+
+ //For Hive reports
+ public int getHiveReportCount(String sql) throws RaptorException {
+ //select t from (select count(*) t from (select * from program)x)x1;
+ int count = 0;
+ String countSql = "select t from (select count(*) t from ("+ sql + ")" + (Globals.isPostgreSQL() || Globals.isMySQL() ?" AS ":"") + " x) AS x1";
+
+ DataSet ds = null;
+ // try {
+ String dbInfo = getDBInfo();
+ System.out.println("SQL getReportCount()- " + countSql);
+ try {
+ ds = ConnectionUtils.getDataSet(countSql, dbInfo);
+ int totalRows = 0;
+ String dbType = "";
+ if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ try {
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ dbType = remDbInfo.getDBType(dbInfo);
+ } catch (Exception ex) {
+ throw new RaptorException(ex);
+ }
+ }
+ if( ds.getRowCount()>0) {
+ count = Integer.parseInt(ds.getString(0,0));
+ }
+ } catch (NumberFormatException ex) {}
+ return count;
+
+ } // getReportCount
+
+
+ /*private*/ public ReportFormFields getChildReportFormFields( HttpServletRequest request, String URL ) throws RaptorException {
+ String childReportID = getReportID(URL);
+
+ ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, childReportID,
+ false, 1);
+
+ ReportFormFields ddReportFormFields = ddRr.getReportFormFields();
+ return ddReportFormFields;
+ }
+
+ private String getReportID(String URL) {
+ URL = nvl(URL);
+ int pos = URL.toLowerCase().indexOf("c_master=")+9;
+ String reportID = "";
+ if(URL.toLowerCase().indexOf("&", pos)!=-1)
+ reportID = URL.substring(pos, URL.toLowerCase().indexOf("&", pos));
+ else
+ reportID = URL.substring(pos);
+ return reportID;
+
+ }
+ /*private*/ public String parseDrillDownURL(int rowIdx, /* int colIdx, */DataSet ds, DataColumnType dct, HttpServletRequest request, ReportFormFields ddReportFormFields)
+ throws RaptorException {
+ Vector viewActions = DataCache.getDataViewActions();
+ javax.servlet.http.HttpSession session = request.getSession();
+
+ StringBuffer dUrl = new StringBuffer();
+
+ //String childReportID = getReportID(dct.getDrillDownURL());
+
+ //ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, childReportID,
+ // false, 1);
+
+ //ReportFormFields ddReportFormFields = ddRr.getReportFormFields();
+
+ boolean isViewAction = false;
+ int flag = 0;
+ String requestParam ="";
+ for (int k = 0; k < viewActions.size(); k++)
+ if (dct.getDrillDownURL().equals(
+ AppUtils.getBaseActionURL() + ((String) viewActions.get(k))))
+ isViewAction = true;
+ if (isViewAction) {
+ // Drill-down to record details
+ String param = nvl(dct.getDrillDownParams()); // i.e.
+ // "c_master=[bo1.RECID$]"
+ param = param.substring(AppUtils.getBaseActionParam().length() + 1,
+ param.length() - 1); // i.e. "bo1.RECID$"
+ param = param.replace('.', '_'); // i.e. "bo1.RECID$"
+
+ dUrl.append(AppUtils.getBaseActionParam());
+ dUrl.append(java.net.URLEncoder.encode(ds.getString(rowIdx, param.toLowerCase())));
+ } else {
+ // Drill-down to another report
+ // Replacing col ids with values
+ String param = nvl(dct.getDrillDownParams());
+ while (param.indexOf('[') >= 0) {
+ int startIdx = param.indexOf('[');
+ int endIdx = param.indexOf(']');
+ StringBuffer sb = new StringBuffer();
+ if(startIdx>endIdx) {
+ if (endIdx < param.length() - 1)
+ sb.append(param.substring(endIdx + 1));
+ param = sb.toString();
+ continue;
+ }
+ if (startIdx > 0)
+ sb.append(param.substring(0, startIdx));
+
+ if (param.charAt(startIdx + 1) == '!') {
+ // Parameter is a form field value
+ String fieldId = param.substring(startIdx + 2, endIdx);
+ String fieldValue = (String) reportParamValues.get(fieldId);
+
+ sb.append(java.net.URLEncoder.encode(nvl(fieldValue)));
+ //TODO Add a else if condition to check whether the param is from request Param
+ //TODO make a unique symbol like #
+ }else if (param.charAt(startIdx + 1) == '#') {
+ flag = 1;
+ String fieldId = param.substring(startIdx + 2, endIdx);
+ String fieldValue = request.getParameter(fieldId);
+ sb.append(java.net.URLEncoder.encode(nvl(fieldValue)));
+
+ }else {
+ // Parameter is a column value
+ String fieldValue = "";
+ String colValue = null;
+ String colId = null;
+ if (param.indexOf('!') < 0 || param.indexOf('!') > endIdx)
+ colId = param.substring(startIdx + 1, endIdx);
+ else {
+ // Need to use NVL(column, form field)
+ colId = param.substring(startIdx + 1, param.indexOf('!'));
+
+ String fieldId = param.substring(param.indexOf('!') + 1, endIdx);
+ FormField ff = getFormField(fieldId);
+ if (ff.getFieldType().equals(FormField.FFT_TEXTAREA)) {
+ fieldValue = reportParamValues.getParamValueforTextAreaDrilldown(fieldId);
+ } else
+ fieldValue = (String) reportParamValues.get(fieldId);
+ } // else
+
+ DataColumnType column = getColumnById(colId);
+ String columnName = "";
+ int groupColumn = 0;
+ int groupMatch = 0;
+ if(column.getColName().startsWith("[")) {
+ groupColumn = 1;
+ columnName = column.getDisplayName();
+ for(ddReportFormFields.resetNext(); ddReportFormFields.hasNext(); ) {
+ FormField ff = ddReportFormFields.getNext();
+ if(ff.getFieldDisplayName().toLowerCase().equals(columnName.toLowerCase())) {
+ groupMatch = 1;
+ sb.delete(sb.lastIndexOf("&")+1, sb.length());
+ sb.append(ff.getFieldName()+"=");
+ }
+ }
+ }
+ if (groupColumn == 0 || (groupColumn == 1 && groupMatch == 1)) {
+ String dependsOn = column.getDependsOnFormField();
+ if(nvl(dependsOn).length()>0)
+ System.out.println("DependsOn " + dependsOn);
+ if (column != null) {
+ // if (column.getColType().equals(AppConstants.CT_DATE))
+ //if (!nvl(column.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT)
+ // .equals(AppConstants.DEFAULT_DATE_FORMAT))
+ // Use extra column instead
+ //commented out below line usually for Visual
+ //colId += AppConstants.DD_COL_EXTENSION;
+ colValue = ds.getString(rowIdx, colId.toLowerCase());
+ // if SQL-Based and drill-down param is a date, decode
+ // it to the expected Oracle format **/
+ if (getReportDefType().equals(AppConstants.RD_SQL_BASED))
+ if (!getColumnNoParseDateFlag(column))
+ if (ReportParamDateValueParser.isDateParam(colValue))
+ colValue = ReportParamDateValueParser
+ .formatDateParamValue(colValue);
+ } // if
+
+ String suppressValues = "|" + nvl(dct.getDrillDownType()) + "|";
+ if (suppressValues.length() > 2
+ && suppressValues.indexOf("|" + colValue + "|") >= 0)
+ // Parameter value is suppressed and not passed to the
+ // drill-down report
+ colValue = null;
+
+ sb.append(java.net.URLEncoder.encode(nvl(colValue, fieldValue)));
+ } else {
+ sb.delete(sb.lastIndexOf("&")+1, sb.length());
+ }
+ } // else
+
+ if (endIdx < param.length() - 1)
+ sb.append(param.substring(endIdx + 1));
+ param = sb.toString();
+ } // while
+ if(Globals.getPassRequestParamInDrilldown()) {
+ if(param.indexOf('#') < 0) {
+ String[] reqParameters = Globals.getRequestParams().split(",");
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ for (int i = 0; i < reqParameters.length; i++) {
+ if(request.getParameter(reqParameters[i])!=null) {
+ if(!reqParameters[i].toUpperCase().startsWith("FF")){
+ if(param.length()>0) {
+ param += "&" + reqParameters[i]+"="
+ + request.getParameter(reqParameters[i]);
+ } else {
+ param += "&" + reqParameters[i]+"="
+ + request.getParameter(reqParameters[i]);
+
+ }
+ }
+ }
+ }
+ for (int i = 0; i < sessionParameters.length; i++) {
+ if(session.getAttribute(sessionParameters[i].toUpperCase())!=null) {
+ if(!sessionParameters[i].toUpperCase().startsWith("FF")){
+ if(param.length()>0) {
+ param += "&" + sessionParameters[i].toUpperCase()+"="
+ + (String)session.getAttribute(sessionParameters[i].toUpperCase());
+ } else {
+ param += "&" + sessionParameters[i].toUpperCase()+"="
+ + (String)session.getAttribute(sessionParameters[i].toUpperCase());
+
+ }
+ }
+ } else {
+ param += "&" + sessionParameters[i].toUpperCase()+"="
+ + (String)session.getAttribute(sessionParameters[i]);
+
+ }
+ }
+
+ }
+ }
+
+ dUrl.append(param.toString());
+ dUrl.append("&");
+ dUrl.append(AppConstants.RI_DISPLAY_CONTENT);
+ dUrl.append("=Y");
+ dUrl.append("&");
+ if(dct.isDrillinPoPUp()==null || (!dct.isDrillinPoPUp().booleanValue())) {
+ dUrl.append(AppConstants.RI_SHOW_BACK_BTN);
+ dUrl.append("=Y");
+ dUrl.append("&");
+ }
+ dUrl.append(AppConstants.DRILLDOWN_INDEX);
+ int index = Integer.parseInt(nvl(AppUtils.getRequestValue(request, AppConstants.DRILLDOWN_INDEX), "0"));
+ /*
+ int form_index = Integer.parseInt(nvl(AppUtils.getRequestValue(request, AppConstants.FORM_DRILLDOWN_INDEX), "0"));
+ index = index>0 ? --index : 0;
+ form_index = form_index>0 ? --form_index : 0;*/
+ request.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index));
+ /*session.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index));
+ request.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index));
+ session.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index));*/
+
+ dUrl.append("=" + AppUtils.getRequestNvlValue(request, AppConstants.DRILLDOWN_INDEX));
+
+ //TODO Add a if condition to check whether the param is request Param
+ } // if
+
+ if (dUrl.length() > 0)
+ dUrl.insert(0, ((dct.getDrillDownURL()).indexOf('&') > 0) ? '&' : '&');
+ dUrl.insert(0, AppUtils.getDrillActionURL()+dct.getDrillDownURL());
+
+ //debugLogger.debug(" [[[[[[[[[[[[[[[[ " + dUrl);
+
+ return dUrl.toString();
+ } // parseDrillDownURL
+
+ /** *********************************************************************************** */
+
+ public DataRow generateColumnDataTotalsLinear(ArrayList reportCols, String userId,
+ String dbInfo, HttpServletRequest request) throws RaptorException {
+ DataRow dr = null;
+
+ displayColTotals = false;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dct = (DataColumnType) iter.next();
+ if( dct != null ) {
+ if (nvl(dct.getDisplayTotal()).length() > 0) {
+ displayColTotals = true;
+ break;
+ } // if
+ } // if checking dct
+ } // for
+
+ DataSet ds = null;
+ if (displayColTotals) {
+ dr = new DataRow();
+ // ds =
+ // DbUtils.executeQuery(generateTotalSQLLinear(reportParamValues,
+ // userId));
+ ds = ConnectionUtils.getDataSet(generateTotalSQLLinear(reportParamValues, userId,request),
+ dbInfo);
+
+ for (int c = 0; c < reportCols.size(); c++) {
+ DataColumnType dct = (DataColumnType) reportCols.get(c);
+ if ( dct != null ) {
+ DataValue dv = new DataValue();
+ if(dv.isVisible())
+ dr.addDataValue(dv);
+
+ String totalValue = "";
+ if (ds != null)
+ totalValue = ds.getString(0, c);
+ if (nvl(dct.getDisplayTotal()).length() > 0
+ && (!dct.getDisplayTotal().equals(AppConstants.TOTAL_SUM_ID)))
+ totalValue = nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(dct
+ .getDisplayTotal()))
+ + ": " + totalValue;
+ dv.setDisplayValue(Utils.truncateTotalDecimals(totalValue));
+
+ dv.setAlignment(dct.getDisplayAlignment());
+ dv.setColName(dct.getColName());
+ dv.setDisplayName(dct.getDisplayName());
+ dv.setColId(dct.getColId());
+ dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+ StringBuffer indentation = new StringBuffer("");
+ if(dct.getIndentation()!=null && dct.getIndentation()>0) {
+ for (int indent=0; indent< dct.getIndentation(); indent++) {
+ indentation.append("\t");
+ }
+ dv.setNowrap("true");
+ }
+ dv.setIndentation(indentation.toString());
+ dv.setDisplayTotal(dct.getDisplayTotal());
+ dv.setBold(true);
+ } // dct check
+ } // for
+ }
+
+ return dr;
+ } // generateColumnDataTotalsLinear
+
+ private Vector generateDataTotalsCrossTab(String rowColPos, String userId, HttpServletRequest request)
+ throws RaptorException {
+ String sql = getWholeSQL();
+ Vector dataTotals = new Vector();
+
+ boolean displayTotals = ((rowColPos.length() == 0) || (getCrossTabDisplayTotal(
+ rowColPos).length() > 0));
+ if (rowColPos.equals(AppConstants.CV_COLUMN))
+ displayColTotals = displayTotals;
+ else if (rowColPos.equals(AppConstants.CV_ROW))
+ displayRowTotals = displayTotals;
+
+ if (displayTotals) {
+ // DataSet ds =
+ // DbUtils.executeQuery(generateTotalSQLCrossTab(reportParamValues,
+ // rowColPos, userId));
+ String executeSql = generateTotalSQLCrossTab(
+ sql, rowColPos, userId, request, reportParamValues);
+ DataSet ds = ConnectionUtils.getDataSet(executeSql, getDbInfo());
+
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ Vector headerValues = new Vector();
+ String totalValue = null;
+
+ int cPos = 0;
+ for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if (rowColPos.length() > 0
+ && nvl(dct.getCrossTabValue()).equals(rowColPos)) {
+ DataValue dataValue = new DataValue();
+ dataValue.setBold(true);
+ dataValue.setAlignment("center");
+ dataValue.setDisplayValue(ds.getString(i, cPos++));
+ headerValues.add(dataValue);
+
+ //headerValues.add(ds.getString(i, cPos++));
+ }
+ else if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_VALUE))
+ totalValue = ds.getString(i, cPos++);
+ } // for
+
+ dataTotals.add(new CrossTabTotalValue(headerValues, Utils
+ .truncateTotalDecimals(totalValue)));
+ } // for
+ } // if
+
+ return dataTotals;
+ } // generateDataTotalsCrossTab
+
+ /** *********************************************************************************** */
+
+ public void hideColVisual(String colId) {
+ visualManager.hideColumn(colId);
+ if (pageDataCache != null)
+ pageDataCache.columnVisualShowHide(colId, false);
+ } // hideColVisual
+
+ public void showColVisual(String colId) {
+ visualManager.showColumn(colId);
+ if (pageDataCache != null)
+ pageDataCache.columnVisualShowHide(colId, true);
+ } // showColVisual
+
+ public void sortColVisual(String colId) {
+ visualManager.setSortByColumn(colId);
+ resetCache(true);
+
+ pageDataCache = null;
+ cachedPageNo = -1;
+ } // sortColVisual
+
+ /** *********************************************************************************** */
+
+ public String generateDistinctValuesSQL(DataColumnType dct, String userId, HttpServletRequest request) throws RaptorException {
+ return super.generateDistinctValuesSQL(reportParamValues, dct, userId, request);
+ } // generateDistinctValuesSQL
+
+ public String getDbInfo() {
+ return this.cr.getDbInfo();
+ }
+
+ private String fixSQL(StringBuffer sql) {
+ int pos = 0;
+ int pos_f_format = 0;
+ int pos_t_format = 0;
+ int pos_alias = 0;
+ String format = "";
+ String alias = null;
+ if(sql.indexOf("SELECT", 7)!= -1) {
+ pos = sql.indexOf("SELECT", 7);
+ if(sql.indexOf("TO_CHAR", pos)!= -1){
+ pos = sql.indexOf("TO_CHAR", pos);
+ if(sql.indexOf("999",pos)!= -1) {
+ pos = sql.indexOf("999",pos);
+ pos_f_format = sql.lastIndexOf(", '", pos);
+ if(pos_f_format == -1 || (pos - pos_f_format > 10)) {
+ pos_f_format = sql.lastIndexOf(",'", pos);
+ pos_f_format -= 1;
+ }
+ pos = pos_f_format;
+ if(sql.indexOf("')", pos)!= -1) {
+ pos_t_format = sql.indexOf("')", pos);
+ //debugLogger.debug("pos_t - " + pos_t_format + " " + pos);
+ if(pos_t_format == -1 || (pos_t_format - pos > 20)) {
+ pos_t_format = sql.indexOf("' )", pos);
+ pos_t_format += 3;
+ }
+ else if (pos_t_format != -1)
+ pos_t_format += 2;
+ format = sql.substring(pos_f_format+3, pos_t_format);
+ //alias = sql.substring(pos_t_format+3, pos_t_format+6);
+ pos_alias = sql.indexOf(" ", pos_t_format);
+ alias = sql.substring(pos_alias+1, pos_alias+4);
+ }
+ }
+ }
+
+ if(sql.indexOf(alias)!=-1) {
+ pos = sql.indexOf(alias);
+ //debugLogger.debug(pos + " " + alias.length()+1 + "\n" + sql);
+ sql.delete(pos,pos+4);
+ sql.insert(pos, "TO_NUMBER("+alias+", '"+format+"')),'"+ format + "')");
+ pos = sql.lastIndexOf("SUM", pos);
+ if(pos==-1)
+ pos = sql.lastIndexOf("AVG", pos);
+ else if (pos==-1)
+ pos = sql.lastIndexOf("COUNT", pos);
+ else if (pos == -1)
+ pos = sql.lastIndexOf("STDDEV", pos);
+ else if (pos == -1)
+ pos = sql.lastIndexOf("VARIANCE", pos);
+ sql.insert(pos, "TO_CHAR (");
+ }
+
+ }
+
+ //debugLogger.debug("Alias|" + alias + "| Format " + format);
+ //debugLogger.debug(sql.toString());
+ return sql.toString();
+ } // FixSQL
+
+ public String parseReportSQL(String sql) throws RaptorException {
+ StringBuffer parsedSQL = new StringBuffer();
+
+ Vector updatedReportCols = new Vector();
+
+ curSQLParsePos = 0;
+ int lastParsePos = curSQLParsePos;
+ String lastToken = null;
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Flat File parseReportSQL ******* SQL " + sql));
+ sql = sql.replaceAll("([\\s]*\\() (?!FROM)", "(");
+ sql = sql.replaceAll("[\\s]*\\)", ")");
+ //sql = sql.replaceAll("[dD][eE][cC][oO][dD][eE] ", "decode");
+ //sql = sql.replaceAll("[\\s]*\\(", "(");
+ //sql = replaceNewLine(sql, "decode ", "decode");
+ //sql = replaceNewLine(sql, "DECODE ", "decode");
+ //sql = replaceNewLine(sql, "Decode ", "decode");
+
+ String nextToken = getNextSQLParseToken(sql, true);
+ String dbInfo = getDbInfo();
+ boolean isCYMBALScript = false;
+ if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ try {
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ String dbType = remDbInfo.getDBType(dbInfo);
+ if (dbType.equals("DAYTONA") && !(nextToken.toUpperCase().equals("SELECT"))) {
+ isCYMBALScript = true;
+ }
+ } catch (Exception ex) {
+ throw new RaptorException(ex);
+ }
+ }
+ if ( isCYMBALScript == false ) {
+ while (nextToken.length() > 0) {
+ //System.out.println("LastToken " + lastToken + " NextToken " + nextToken);
+
+
+ if (parsedSQL.length() == 0) {
+ if (nextToken.toUpperCase().equals("SELECT"))
+ parsedSQL.append("SELECT ");
+ else
+ throw new org.openecomp.portalsdk.analytics.error.ValidationException(
+ "The SQL must start with the SELECT keyword.");
+ } else if (nextToken.toUpperCase().equals("DISTINCT")
+ && parsedSQL.toString().equals("SELECT ")) {
+ parsedSQL.append("DISTINCT ");
+ } else if (nextToken.equals("*")
+ && (parsedSQL.toString().equals("SELECT ") || parsedSQL.toString().equals(
+ "SELECT DISTINCT "))) {
+ throw new org.openecomp.portalsdk.analytics.error.ValidationException(
+ "You cannot use \"SELECT *\". Please specify select columns/expressions.");
+ } else if (nextToken.toUpperCase().equals("FROM")) {
+ if (lastToken != null) {
+ updatedReportCols.add(getParseSQLDataColumn(lastToken, null, parsedSQL,
+ updatedReportCols, false));
+ lastToken = null;
+ }
+
+ parsedSQL.append(" \n");
+ while (lastParsePos < sql.length()
+ && Character.isWhitespace(sql.charAt(lastParsePos)))
+ lastParsePos++;
+ parsedSQL.append(sql.substring(lastParsePos));
+ break;
+ } else {
+ //System.out.println("Next Token " + nextToken);
+ if (nextToken.charAt(nextToken.length() - 1) == ',') {
+ // The token ends with ,
+ nextToken = nextToken.substring(0, nextToken.length() - 1);
+
+ if (nextToken.length() == 0) {
+ if (lastToken != null) {
+ updatedReportCols.add(getParseSQLDataColumn(lastToken, null,
+ parsedSQL, updatedReportCols, false));
+ lastToken = null;
+ } // else just comma => ignore it
+ } else {
+ //System.out.println("Next Token " + nextToken + " is Here" + " Last Token " + lastToken);
+ if (lastToken != null) {
+ updatedReportCols.add(getParseSQLDataColumn(lastToken, nextToken,
+ parsedSQL, updatedReportCols, false));
+ lastToken = null;
+ } else
+ updatedReportCols.add(getParseSQLDataColumn(nextToken, null,
+ parsedSQL, updatedReportCols, false));
+ }
+ } else {
+ // The token doesn't end with ,
+ if (lastToken == null)
+ lastToken = nextToken;
+ else {
+ String token = getNextSQLParseToken(sql, false);
+ //System.out.println(" ********** " + token + " " + lastToken);
+ if (!token.toUpperCase().equals("FROM"))
+ throw new org.openecomp.portalsdk.analytics.error.ValidationException(
+ "|FROM keyword or a comma expected after [" + nextToken
+ + "].");
+ //System.out.println("Next Token " + nextToken);
+ updatedReportCols.add(getParseSQLDataColumn(lastToken, nextToken,
+ parsedSQL, updatedReportCols, false));
+ lastToken = null;
+ } // else
+ } // else
+ } // else
+
+ lastParsePos = curSQLParsePos;
+ nextToken = getNextSQLParseToken(sql, true);
+ } // while
+ } else { // if CYMBAL Script
+ nextToken = getNextCYMBALSQLParseToken(sql, true);
+ Pattern re = null;
+ Matcher matcher = null;
+ String extracted = null;
+ while (nextToken.length() > 0) {
+ if (lastToken == null) lastToken = nextToken;
+
+ if( lastToken.toUpperCase().equals("DO DISPLAY")) {
+ re = Pattern.compile("each(.*)\\[.(.*?)\\]"); //\\[(.*?)\\]
+ matcher = re.matcher(nextToken);
+ if (matcher.find()) {
+ extracted = matcher.group();
+ re = Pattern.compile("\\[(.*?)\\]");
+ matcher = re.matcher(nextToken);
+ if(matcher.find()) {
+ extracted = matcher.group();
+ extracted = extracted.substring(1,extracted.length()-2);
+ StringTokenizer sToken = new StringTokenizer(extracted);
+ while(sToken.hasMoreTokens()) {
+ updatedReportCols.add(getParseSQLDataColumn("", sToken.nextToken(),
+ new StringBuffer(""), updatedReportCols, true));
+ }
+ }
+
+ }
+
+ }
+ lastToken = nextToken;
+ nextToken = getNextCYMBALSQLParseToken(sql, true);
+ }
+ }
+
+ if (updatedReportCols.size() == 0)
+ throw new org.openecomp.portalsdk.analytics.error.ValidationException(
+ "The SQL statement must have at least one column in the SELECT clause.");
+
+
+ return parsedSQL.toString();
+
+ } // parseReportSQL
+
+ private String getNextCYMBALSQLParseToken(String sql, boolean updateParsePos) {
+ int braketCount = 0;
+ boolean isInsideQuote = false;
+ StringBuffer nextToken = new StringBuffer();
+ for (int idxNext = curSQLParsePos; idxNext < sql.length(); idxNext++) {
+ char ch = sql.charAt(idxNext);
+
+ if (ch!='\n')
+ nextToken.append(ch);
+ else break;
+ } // for
+
+ return nextToken.toString();
+ } // getNextSQLParseToken
+
+ private String getNextSQLParseToken(String sql, boolean updateParsePos) {
+ int braketCount = 0;
+ boolean isInsideQuote = false;
+ StringBuffer nextToken = new StringBuffer();
+ for (int idxNext = curSQLParsePos; idxNext < sql.length(); idxNext++) {
+ char ch = sql.charAt(idxNext);
+
+ if (Character.isWhitespace(ch) || ch == ',') {
+ if (ch == ',')
+ nextToken.append(ch);
+
+ if (nextToken.length() == 0)
+ continue;
+ else if (braketCount == 0 && (!isInsideQuote)) {
+ if (updateParsePos)
+ curSQLParsePos = idxNext + ((ch == ',') ? 1 : 0);
+ break;
+ } else if (ch != ',' && nextToken.charAt(nextToken.length() - 1) != ' ')
+ nextToken.append(' ');
+ } else {
+ nextToken.append(ch);
+
+ if (ch == '(' || ch == '[')
+ braketCount++;
+ else if (ch == ')' || ch == ']')
+ braketCount--;
+ else if (ch == '\''/* ||ch=='\"' */)
+ isInsideQuote = (!isInsideQuote);
+ } // else
+ } // for
+
+ return nextToken.toString();
+ } // getNextSQLParseToken
+
+ private DataColumnType getParseSQLDataColumn(String sqlExpression, String colId,
+ StringBuffer parsedSQL, Vector updatedReportCols, boolean isCYMBALScript) throws RaptorException {
+ DataColumnType dct = null;
+
+ if (colId != null) {
+ if (!isParseSQLColID(colId))
+ throw new org.openecomp.portalsdk.analytics.error.ValidationException(
+ "["
+ + colId
+ + "] must either be a valid column id consisting only of letters, numbers, and underscores, or there must be a comma in front of it.");
+
+ dct = getColumnById(colId);
+ } else {
+ // Getting unique column id
+ colId = "";
+ int colIdN = 0;
+ for (int i = 0; (i < sqlExpression.length()) && (colIdN < 2); i++)
+ if (Character.isLetter(sqlExpression.charAt(i))) {
+ colId += sqlExpression.toLowerCase().charAt(i);
+ colIdN++;
+ } // if
+
+ colIdN = getAllColumns().size() + updatedReportCols.size();
+ for (boolean idAlreadyUsed = true; idAlreadyUsed; colIdN++) {
+ String newColId = colId + colIdN;
+ idAlreadyUsed = false;
+
+ for (Iterator iter = getAllColumns().iterator(); iter.hasNext();)
+ if (newColId.equals(((DataColumnType) iter.next()).getColId())) {
+ idAlreadyUsed = true;
+ break;
+ }
+
+ if (!idAlreadyUsed)
+ for (Iterator iter = updatedReportCols.iterator(); iter.hasNext();)
+ if (newColId.equals(((DataColumnType) iter.next()).getColId())) {
+ idAlreadyUsed = true;
+ break;
+ }
+ } // for
+
+ colId += (colIdN - 1);
+ } // else
+
+ if (dct == null) {
+ dct = (new ObjectFactory()).createDataColumnType();
+ dct.setColId(colId);
+ dct.setDisplayWidth(10);
+ dct.setDisplayAlignment("Left");
+ dct.setVisible(true);
+ dct.setGroupBreak(false); // ???
+
+ boolean isValidIdentifier = Character.isLetterOrDigit(sqlExpression.charAt(0));
+ for (int i = 0; i < sqlExpression.length(); i++)
+ if (!(Character.isLetterOrDigit(sqlExpression.charAt(i))
+ || (sqlExpression.charAt(i) == '_') || (sqlExpression.charAt(i) == '$'))) {
+ isValidIdentifier = false;
+ break;
+ } // if
+
+ if (isValidIdentifier) {
+ dct.setDisplayName(sqlExpression);
+ } else {
+ dct.setDisplayName(colId);
+ } // else
+ } // if
+ if(!isCYMBALScript)
+ sqlExpression = sqlExpression.replaceAll(", '", ",'");
+ dct.setDbColName(sqlExpression);
+ dct.setColName(sqlExpression);
+ dct.setCalculated(true);
+ dct.setColType(AppConstants.CT_CHAR);
+ dct.setDbColType(AppConstants.CT_CHAR);
+ adjustColumnType(dct); // ???
+
+ if(!isCYMBALScript) {
+ if (parsedSQL.toString().equals("SELECT ")
+ || parsedSQL.toString().equals("SELECT DISTINCT "))
+ parsedSQL.append("\n\t");
+ else
+ parsedSQL.append(", \n\t");
+ parsedSQL.append(sqlExpression);
+ parsedSQL.append(" ");
+ parsedSQL.append(colId);
+ }
+
+ return dct;
+ } // getParseSQLDataColumn
+
+ private boolean isParseSQLColID(String token) {
+ if (nvl(token).length() == 0)
+ return false;
+
+ for (int i = 0; i < token.length(); i++) {
+ char ch = token.charAt(i);
+
+ if (i == 0 && ch == '_')
+ return false;
+
+ if (!(Character.isLetterOrDigit(ch) || ch == '_'))
+ return false;
+ } // for
+
+ return true;
+ } // isParseSQLColID
+
+ /*private*/ public String parseReportSQLForDrillDownParams(String reportSQL, DataColumnType dataColumnRequest, HttpServletRequest request){
+ String param = nvl(dataColumnRequest.getDrillDownParams());
+ String sql = reportSQL;
+ int pos = 0;
+ while (param.indexOf('[', pos) >= 0) {
+ int startIdx = param.indexOf('[',pos);
+ int endIdx = param.indexOf(']',startIdx+1);
+ pos = startIdx+1;
+ StringBuffer sb = new StringBuffer();
+ if (startIdx > 0)
+ sb.append(param.substring(0, startIdx));
+ else break;
+
+ if (param.charAt(startIdx + 1) == '#') {
+ // Parameter is a form field value
+ String fieldId = param.substring(startIdx + 2, endIdx);
+ String fieldValue = request.getParameter(fieldId);
+ sql = Utils.replaceInString(sql, "[" + fieldId.toUpperCase()+"]", fieldValue );
+ }
+ }
+ return sql;
+ }
+
+public List getMapMarkers(ReportData rd, org.openecomp.portalsdk.analytics.xmlobj.ReportMap xmlmap){
+
+ ArrayList markers = new ArrayList();
+ int rNum = 0;
+ HashMap colHash = new HashMap();
+
+ for(rd.reportDataRows.resetNext(); rd.reportDataRows.hasNext(); rNum++) {
+ DataRow dr = rd.reportDataRows.getNext();
+ for(dr.resetNext(); dr.hasNext(); ) {
+ DataValue dv = dr.getNext();
+ colHash.put(dv.getColId(), dv.getDisplayValueLinkHtml());
+ }
+
+ for (int i = 0; i < xmlmap.getMarkers().size(); i ++){
+ Marker marker = new Marker("", "", "");
+ org.openecomp.portalsdk.analytics.xmlobj.Marker m = (org.openecomp.portalsdk.analytics.xmlobj.Marker) xmlmap.getMarkers().get(i);
+ String address = (String) colHash.get(m.getAddressColumn());
+ String data = (String) colHash.get(m.getDataColumn());
+ marker.setAddress(address);
+ if (xmlmap.getAddAddressInDataYN() != null && xmlmap.getAddAddressInDataYN().equals("Y")){
+ marker.setData(address + "<br/>" + data);
+ }
+ else{
+ marker.setData(data);
+ }
+ marker.setColor(m.getMarkerColor());
+ markers.add(marker);
+ System.out.println("%%%%%%%%%%%% marker is : " + address + data);
+ }
+
+ }
+
+ return markers;
+ }
+
+
+
+ public ReportParamValues getReportParamValues() {
+ return reportParamValues;
+ }
+
+ public String getFormFieldFilled(String title) {
+ if( getFormFieldList()!=null && reportParamValues!=null && nvl(title).length()>0) {
+ for (Iterator iter1 = getFormFieldList().getFormField().iterator(); iter1.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter1.next();
+ String fieldDisplay = getFormFieldDisplayName(fft);
+ String fieldId = fft.getFieldId();
+ if(!fft.getFieldType().equals(FormField.FFT_BLANK) && !fft.getFieldType().equals(FormField.FFT_LIST_MULTI) && !fft.getFieldType().equals(FormField.FFT_TEXTAREA)) {
+ String paramValue = Utils.oracleSafe(nvl(reportParamValues.getParamValue(fieldId)));
+ title = Utils.replaceInString(title, fieldDisplay, nvl(
+ paramValue, ""));
+ }
+ }
+ }
+ return title;
+ }
+// public static void main (String args[])throws Exception {
+// ReportRuntime rr = new ReportRuntime();
+// String sql= " SELECT NULL TOTAL_AC20, NULL TOTAL_AC21, NULL TOTAL_AC22, NULL TOTAL_CO1, NULL TOTAL_BR2, NULL TOTAL_CO3, NULL TOTAL_CO4, NULL TOTAL_HO20, NULL TOTAL_DU9, NULL TOTAL_HO19, NULL TOTAL_CU10, NULL TOTAL_AC11,TO_CHAR (SUM(TO_NUMBER (SE29,'$9,999,999,990.99')),'$9,999,999,990.99') TOTAL_SE29,TO_CHAR (SUM(TO_NUMBER (BR6,'$9,999,999,990.99')),'$9,999,999,990.99') TOTAL_BR6,TO_CHAR (SUM(TO_NUMBER (TR7,'$9,999,999,990.99')),'$9,999,999,990.99') TOTAL_TR7,TO_CHAR (SUM(TO_NUMBER (FE8,'$9,999,999,990.99')),'$9,999,999,990.99') TOTAL_FE8,TO_CHAR (SUM(TO_NUMBER (TA12,'$9,999,999,990.99')),'$9,999,999,990.99') TOTAL_TA12,TO_CHAR (SUM(TO_NUMBER (UN13,'$9,999,999,990.99')),'$9,999,999,990.99') TOTAL_UN13,TO_CHAR (SUM(TO_NUMBER (TA27,'$9,999,999,990.99')),'$9,999,999,990.99') TOTAL_TA27,TO_CHAR (SUM(TO_NUMBER (TA28,'$9,999,999,990.99')),'$9,999,999,990.99') TOTAL_TA28, NULL TOTAL_CU20, NULL TOTAL_MG23, NULL TOTAL_CU27, NULL TOTAL_CU24, NULL TOTAL_CU28, NULL TOTAL_AC24, NULL TOTAL_CU21, NULL TOTAL_RE25, NULL TOTAL_BI29 FROM (SELECT substr(ACCT_ID,1,3) ac20, substr(ACCT_ID,5,5) ac21, substr(ACCT_ID,11,25) ac22, ci1.CONF_ID co1, ci1.BRIDGE_ID br2, ci1.CONF_RESERVE_DATE co3, ci1.CONF_RESERVE_TIME co4, ci1.HOST_PARTICIPANT_NUMBER ho20, to_number(duration_in_minutes) du9, ci1.HOST_PARTICIPANT_NAME ho19, ci1.CUSTOMER_CONF_ID cu10, ci1.ACCESS_METHOD ac11, TO_CHAR(ci1.SETUP_CHARGES,'$9,999,999,990.99') se29, TO_CHAR(ci1.BRIDGE_CHARGES,'$9,999,999,990.99') br6, TO_CHAR(ci1.TRANSPORT_CHARGES,'$9,999,999,990.99') tr7, TO_CHAR(ci1.FEATURES_CHARGES,'$9,999,999,990.99') fe8, TO_CHAR(ci1.TAXES,'$9,999,999,990.99') ta12, TO_CHAR(Univ_connect_charges+admin_exp_fee+nvl(property_tax_allotment,0)+nvl(federal_regulatory_fee,0),'$9,999,999,990.99') un13, TO_CHAR(setup_charges+Bridge_charges + transport_charges + features_charges-discount,'$9,999,999,990.99') ta27, TO_CHAR(setup_charges + bridge_charges + transport_charges + features_charges + taxes + univ_connect_charges+admin_exp_fee+nvl(property_tax_allotment,0)+nvl(federal_regulatory_fee,0)-discount,'$9,999,999,990.99') ta28, ci1.CUST_ID cu20, ci2.MGD_SVC_FEE mg23, NULL cu27, to_char( DURATION_IN_MINUTES * mgd_svc_fee ,'$9,990.99') cu24, NULL cu28, ci2.ACCESS_DESCRIPTION ac24, decode ( cust_id , '0011681500002' , '00002' , decode ( cust_id , '0011681500092' , '00092' , decode ( cust_id , '0011681500093' , '00093' , substr(cust_id,9,5) ))) cu21, ci1.RECORD_TYPE re25, ci1.BILL_MONTH bi29 FROM CIS_AUDIO ci1, CIS_MGD_SVC_FEE ci2 WHERE ci2.ACCESS_METHOD (+)=ci1.ACCESS_METHOD AND substr(ACCT_ID,1,3) = '215' AND decode ( cust_id , '0011681500002' , '00002' , decode ( cust_id , '0011681500092' , '00092' , decode ( cust_id , '0011681500093' , '00093' , substr(cust_id,9,5) ))) IN ('00002') AND ci1.BILL_MONTH = 'NOV 2006' ORDER BY ci1.ACCESS_METHOD ASC) totalSQL";
+// rr.parseReportSQL(sql);
+// }
+
+ public synchronized Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ // this shouldn't happen, since we are Cloneable
+ throw new InternalError("Cloning throws error.");
+ }
+ }
+
+ /* private Vector addForecastData(String sql) throws Exception {
+ InstanceQuery instTrainQuery = new InstanceQuery();
+ //instTrainQuery.setDatabaseURL("jdbc:idb:=experiments.prp");
+ instTrainQuery.setUsername("fusionapp");
+ instTrainQuery.setPassword("i64eq4aunp");
+ Instances data = instTrainQuery.retrieveInstances(sql);
+
+ ArrayList<String> forecastArray = new ArrayList<String>();
+
+ List reportCols = getAllColumns();
+ DataColumnType dct = null;
+ Iterator iter = null;
+
+ String dateAttribute = "";
+
+ for(iter=reportCols.iterator(); iter.hasNext(); ) {
+ dct = (DataColumnType) iter.next();
+ if(nvl(dct.getDataMiningCol()).equals(AppConstants.DM_FORECASTING_ATTR))
+ forecastArray.add(dct.getColId().toUpperCase());
+ }
+
+ for(iter=reportCols.iterator(); iter.hasNext(); ) {
+ dct = (DataColumnType) iter.next();
+ if(nvl(dct.getDataMiningCol()).equals(AppConstants.DM_DATE_ATTR))
+ dateAttribute = dct.getColId().toUpperCase();
+ }
+
+
+ int forecastUnits = getForecastingPeriod();
+ // new forecaster
+ WekaForecaster forecaster = new WekaForecaster();
+
+ // set the targets we want to forecast. This method calls
+ // setFieldsToLag() on the lag maker object for us
+ StringBuffer forecastAttribute = new StringBuffer("");
+ for (int i=0; i < forecastArray.size(); i++) {
+ forecastAttribute.append(forecastArray.get(i));
+ if(i<forecastArray.size()-1) forecastAttribute.append(",");
+ }
+ forecaster.setFieldsToForecast(forecastAttribute.toString());
+
+ // default underlying classifier is SMOreg (SVM) - we'll use
+ // gaussian processes for regression instead
+ if(getClassifier().equals(AppConstants.DM_GAUSSIAN_CLASSIFIER))
+ forecaster.setBaseForecaster(new GaussianProcesses());
+ else if (getClassifier().equals(AppConstants.DM_SVM_CLASSIFIER))
+ forecaster.setBaseForecaster(new weka.classifiers.functions.SMOreg());
+
+ forecaster.getTSLagMaker().setTimeStampField(dateAttribute); // date time stamp
+ forecaster.getTSLagMaker().setMinLag(1);
+ forecaster.getTSLagMaker().setMaxLag(12); // monthly data
+
+ // add a month of the year indicator field
+ forecaster.getTSLagMaker().setAddMonthOfYear(true);
+
+ // add a quarter of the year indicator field
+ forecaster.getTSLagMaker().setAddQuarterOfYear(true);
+
+ // build the model
+ forecaster.buildForecaster(data, System.out);
+
+ // prime the forecaster with enough recent historical data
+ // to cover up to the maximum lag. In our case, we could just supply
+ // the 12 most recent historical instances, as this covers our maximum
+ // lag period
+ forecaster.primeForecaster(data);
+
+ // forecast for 12 units (months) beyond the end of the
+ // training data
+ List<List<NumericPrediction>> forecast = forecaster.forecast(getForecastingPeriod(), System.out);
+
+ String dateFormat = "";
+ if(nvl(getForecastingTimeFormat()).length()>0)
+ dateFormat = getForecastingTimeFormat();
+ java.text.SimpleDateFormat sdf = null;
+ java.text.SimpleDateFormat sdf1 = null;
+ java.text.SimpleDateFormat sdf2 = null;
+ if(dateFormat.equals("Default")) {
+ sdf = new SimpleDateFormat("yyyy-MM-dd\'T\'HH:mm:ss");
+ sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ } else {
+ sdf = new SimpleDateFormat("yyyy-MM-dd\'T\'HH:mm:ss");
+ sdf1 = new SimpleDateFormat(dateFormat);
+ sdf2 = new SimpleDateFormat("MM/yyyy");
+ }
+ // output the predictions. Outer list is over the steps; inner list is over
+ // the targets
+ int k = 0;
+ int flag = 0;
+ Enumeration<Attribute> enum1 = data.lastInstance().enumerateAttributes();
+ Attribute attrib = null;
+
+ HashMap<String, Object> predictedHashMap = new HashMap<String, Object>();
+
+ while(enum1.hasMoreElements()) {
+ attrib = enum1.nextElement();
+ System.out.println(attrib.name() + " " + attrib.index());
+ }
+ Vector<Vector> forecastedDataSet = new Vector<Vector>();
+ Vector forecastedData = new Vector();
+ Date d = null;
+ Date forecastedDate = null;
+ Calendar c1 = Calendar.getInstance();
+ for (int i = 0; i < forecastUnits; i++) {
+ TSLagMaker ts = forecaster.getTSLagMaker();
+ //java.sql.Timestamp ts1 = new java.sql.Timestamp(new Long(ts.getCurrentTimeStampValue()).longValue());
+ //System.out.println(data.lastInstance().dataset().attribute(0).getDateFormat());//parseDate("yyyy-MM-dd\'T\'HH:mm:ss")
+ //System.out.println(data.lastInstance().dataset().lastInstance().stringValue(0) + " " + sdf.parse(data.lastInstance().dataset().lastInstance().stringValue(0)));
+ d = sdf.parse(data.lastInstance().dataset().lastInstance().stringValue(0));
+ c1.setTime(d);
+ c1.add(Calendar.MONTH, i+1);
+ forecastedDate = c1.getTime();
+ List<NumericPrediction> predsAtStep = forecast.get(i);
+ predictedHashMap.put(dateAttribute, sdf1.format(forecastedDate));
+ predictedHashMap.put(dateAttribute+"_FORMAT", sdf2.format(forecastedDate));
+
+ for (int j = 0; j < forecastArray.size(); j++) {
+ NumericPrediction predForTarget = predsAtStep.get(j);
+ predictedHashMap.put(forecastArray.get(j), new Integer(new Double(predForTarget.predicted()).intValue()).toString());
+ //System.out.print(forecastArray.get(j)+" " + predForTarget.predicted());
+ }
+
+ enum1 = data.lastInstance().enumerateAttributes();
+ while(enum1.hasMoreElements()) {
+ attrib = enum1.nextElement();
+ if((!attrib.name().equals(dateAttribute)) && (!attrib.name().equals(dateAttribute+"_FORMAT"))){
+ for (int h=0; h < forecastArray.size(); h++) {
+ if(attrib.name().equals(forecastArray.get(h))) {
+ forecastedData.add(predictedHashMap.get(attrib.name()));
+ flag = 1;
+ }
+
+ }
+ } else if(attrib.name().equals(dateAttribute+"_FORMAT")) {
+ forecastedData.add(predictedHashMap.get(dateAttribute+"_FORMAT"));
+ flag = 1;
+ } else if(attrib.name().equals(dateAttribute)) {
+ forecastedData.add(predictedHashMap.get(dateAttribute));
+ flag = 1;
+ }
+ if(flag == 0) {
+ forecastedData.add("");
+ } / *else {
+ forecastedData.add(predictedHashMap.get(dateAttribute));
+ forecastedData.add(predictedHashMap.get(dateAttribute+"_format"));
+ }* /
+ //System.out.println(attrib.name() + " " + attrib.index());
+
+
+
+
+
+ flag = 0;
+
+ }
+ forecastedDataSet.add(forecastedData);
+ predictedHashMap = new HashMap<String, Object>();
+ forecastedData = new Vector();
+ enum1 = data.lastInstance().enumerateAttributes();
+ }
+ setReportDataSize(getReportDataSize()+getForecastingPeriod());
+ return forecastedDataSet;
+ } */
+
+ public VisualManager getVisualManager() {
+ return visualManager;
+ }
+
+ public String getReportSQLWithRowNum(String _orderBy, boolean asc) {
+ String sql = getWholeSQL();
+ int closeBracketPos = 0;
+ /*if (nvl(_orderBy).length() > 0) {
+ if(sql.lastIndexOf(")")!= -1) closeBracketPos = sql.lastIndexOf(")");
+ int idxOrderBy = (closeBracketPos>0)?sql.toUpperCase().indexOf("ORDER BY", closeBracketPos):sql.toUpperCase().lastIndexOf("ORDER BY");
+ DataColumnType dct = getColumnById(_orderBy+"_sort");
+ if(dct!=null && dct.getColName().length()>0) {
+ _orderBy = _orderBy+"_sort";
+ }
+ if (idxOrderBy < 0)
+ sql += " ORDER BY " + _orderBy + " " + (asc ? "ASC" : "DESC");
+ else {
+ int braketCount = 0;
+ int idxOrderByClauseEnd = 0;
+ for (idxOrderByClauseEnd = idxOrderBy; idxOrderByClauseEnd < sql.length(); idxOrderByClauseEnd++) {
+ char ch = sql.charAt(idxOrderByClauseEnd);
+
+ if (ch == '(')
+ braketCount++;
+ else if (ch == ')') {
+ if (braketCount == 0)
+ break;
+ braketCount--;
+ }
+ } // for
+
+ sql = sql.substring(0, idxOrderBy) + " ORDER BY " + _orderBy + " "
+ + (asc ? "ASC" : "DESC") + sql.substring(idxOrderByClauseEnd);
+ } // else
+ } // if*/
+
+ // Added reportSQLOnlyFirstPart which has Column information with Rownum
+ return nvl(getReportSQLOnlyFirstPart()) + " " + sql + ") x ";
+
+ }
+
+ public int getDisplayMode() {
+ return DISPLAY_MODE;
+ }
+
+ public void setDisplayMode(int mode) {
+ DISPLAY_MODE = mode;
+ }
+
+ public int getDateOption() {
+ return DATE_OPTION;
+ }
+
+ public void setDateOption(int dateOption) {
+ DATE_OPTION = dateOption;
+ }
+
+ public boolean isDisplayColTotals() {
+ return displayColTotals;
+ }
+
+ public void setDisplayColTotals(boolean displayColTotals) {
+ this.displayColTotals = displayColTotals;
+ }
+
+ public boolean isDisplayRowTotals() {
+ return displayRowTotals;
+ }
+
+ public void setDisplayRowTotals(boolean displayRowTotals) {
+ this.displayRowTotals = displayRowTotals;
+ }
+
+
+ private boolean canPersistLinearReport() {
+ boolean visibleColExist = false;
+
+ if (getDataSourceList().getDataSource().size() > 0) {
+ for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if (dct.isVisible()) {
+ visibleColExist = true;
+ break;
+ }
+ } // for
+ } // if
+
+ return visibleColExist;
+ } // canPersistLinearReport
+
+ public void persistLinearReport(HttpServletRequest request)
+ throws RaptorException {
+ if (!canPersistLinearReport())
+ return;
+
+ Connection connection = null;
+ try {
+ String userID = AppUtils.getUserID(request);
+ String reportXML = marshal();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Report " + reportID
+ + " XML marshalled succesfully"));
+
+ // Update report
+ verifySQLBasedReportAccess(request);
+ reportSecurity.reportUpdate(request);
+ connection = DbUtils.startTransaction();
+ ReportLoader.updateCustomReportRec(connection, this, reportXML);
+ ReportLoader.createReportLogEntry(connection, reportID, userID,
+ AppConstants.RLA_UPDATE, "", "");
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB update report "
+ + reportID + " succesfull"));
+ DbUtils.commitTransaction(connection);
+ } catch (RaptorException e) {
+ e.printStackTrace();
+ DbUtils.rollbackTransaction(connection);
+ throw e;
+ } finally {
+ DbUtils.clearConnection(connection);
+ }
+ } // persistLinearReport
+
+ public void persistDashboardReport(HttpServletRequest request)
+ throws RaptorException {
+
+ Connection connection = null;
+ try {
+ String userID = AppUtils.getUserID(request);
+ String reportXML = marshal();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Report " + reportID
+ + " XML marshalled succesfully"));
+
+ // Update report
+ verifySQLBasedReportAccess(request);
+ reportSecurity.reportUpdate(request);
+ connection = DbUtils.startTransaction();
+ ReportLoader.updateCustomReportRec(connection, this, reportXML);
+ ReportLoader.createReportLogEntry(connection, reportID, userID,
+ AppConstants.RLA_UPDATE, "", "");
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB update report "
+ + reportID + " succesfull"));
+ DbUtils.commitTransaction(connection);
+ } catch (RaptorException e) {
+ e.printStackTrace();
+ DbUtils.rollbackTransaction(connection);
+ throw e;
+ } finally {
+ DbUtils.clearConnection(connection);
+ }
+ } // persistDashboardReport
+ public String getTotalSql() {
+ return totalSql;
+ }
+
+ public void setTotalSql(String totalSql) {
+ this.totalSql = totalSql;
+ }
+
+ public void setTriggerFormFieldCheck( ReportFormFields FormFieldList, FormField selectedFormField) {
+
+ for (Iterator iter = getReportFormFields().iterator(); iter.hasNext();) {
+ FormField ff = (FormField) iter.next();
+ if(!ff.getFieldName().equals(selectedFormField.getFieldName())) {
+ if(nvl(ff.getBaseSQL()).length()>0 && ff.getBaseSQL().indexOf("["+selectedFormField.getFieldDisplayName() +"]")!= -1) {
+ selectedFormField.setTriggerOtherFormFields(true);
+ }
+
+ }
+ }
+
+ }
+
+ public void setTriggerThisFormFieldCheck( ReportFormFields FormFieldList, FormField selectedFormField) {
+
+ String sql = nvl(selectedFormField.getBaseSQL()).length()>0 ? selectedFormField.getBaseSQL():"";
+ for (Iterator iter = getReportFormFields().iterator(); iter.hasNext();) {
+ FormField ff = (FormField) iter.next();
+ if(!ff.getFieldName().equals(selectedFormField.getFieldName())) {
+ if(sql.indexOf("["+ff.getFieldDisplayName() +"]")!= -1) {
+ selectedFormField.setTriggerThisFormfield(true);
+ break;
+ }
+
+ }
+ }
+
+ }
+
+ private boolean isAllowEdit(HttpServletRequest request) {
+ boolean allowEdit = false;
+ try {
+ if( AppUtils.isAdminUser(request) || AppUtils.isSuperUser(request) ) {
+ allowEdit = true;
+ }
+ } catch (RaptorException ex) {
+ allowEdit = false;
+ }
+ return allowEdit;
+ }
+ public ReportJSONRuntime createReportJSONRuntime(HttpServletRequest request, ReportData rd) {
+ String userId = AppUtils.getUserID(request);
+ ObjectMapper mapper = new ObjectMapper();
+ ReportJSONRuntime reportJSONRuntime = new ReportJSONRuntime();
+ reportJSONRuntime.setReportTitle(getReportTitle());
+ reportJSONRuntime.setReportID(getReportID());
+ reportJSONRuntime.setReportDescr(getReportDescr());
+ reportJSONRuntime.setReportName(getReportName());
+ reportJSONRuntime.setReportSubTitle(getReportSubTitle());
+ reportJSONRuntime.setAllowSchedule(isAllowSchedule());
+ reportJSONRuntime.setAllowEdit(isAllowEdit(request));
+ reportJSONRuntime.setColIdxTobeFreezed(getFrozenColumnId());
+ reportJSONRuntime.setNumFormCols(getNumFormColsAsInt());
+ //back button url
+ reportJSONRuntime.setBackBtnURL("");
+ String chartType = getChartType();
+ boolean displayChart = (nvl(chartType).length()>0)&&getDisplayChart();
+ boolean displayChartWizard = getDisplayChart();
+ reportJSONRuntime.setChartAvailable(displayChart);
+ reportJSONRuntime.setChartWizardAvailable(displayChartWizard);
+ reportJSONRuntime.setDisplayData(!isDisplayOptionHideData());
+ reportJSONRuntime.setDisplayForm(!isDisplayOptionHideForm());
+ reportJSONRuntime.setDisplayExcel(!isDisplayOptionHideExcelIcons());
+ reportJSONRuntime.setDisplayPDF(!isDisplayOptionHidePDFIcons());
+ ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>();
+ ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<FormFieldJSON>();
+ if(getReportFormFields()!=null) {
+ formFieldJSONList = new ArrayList<FormFieldJSON>(getReportFormFields().size());
+ for (Iterator iter = getReportFormFields().iterator(); iter.hasNext();) {
+ formFieldValues = new ArrayList<IdNameValue>();
+ FormField ff = (FormField) iter.next();
+ ff.setDbInfo(getDbInfo());
+ FormFieldJSON ffJSON = new FormFieldJSON();
+ ffJSON.setFieldId(ff.getFieldName());
+ ffJSON.setFieldType(ff.getFieldType());
+ ffJSON.setFieldDisplayName(ff.getFieldDisplayName());
+ ffJSON.setHelpText(ff.getHelpText());
+ ffJSON.setValidationType(ff.getValidationType());
+ ffJSON.setVisible(ff.isVisible());
+ //ffJSON.setTriggerOtherFormFields(ff.getDependsOn());
+ IdNameList lookup = null;
+ lookup = ff.getLookupList();
+ String selectedValue = "";
+ String oldSQL = "";
+ IdNameList lookupList = null;
+ boolean readOnly = false;
+ if(lookup!=null) {
+ if(!ff.hasPredefinedList) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ oldSQL = lu.getSql();
+ setTriggerFormFieldCheck( getReportFormFields(), ff);
+ ffJSON.setTriggerOtherFormFields(ff.isTriggerOtherFormFields());
+ SQL = parseAndFillReq_Session_UserValues(request, SQL, userId);
+ SQL = parseAndFillWithCurrentValues(request, SQL, ff);
+ String defaultSQL = lu.getDefaultSQL();
+ defaultSQL = parseAndFillReq_Session_UserValues(request, defaultSQL, userId);
+ defaultSQL = parseAndFillWithCurrentValues(request, defaultSQL, ff);
+ lookup = new IdNameSql(-1,SQL,defaultSQL);
+
+ lookupList = lookup;
+ try {
+ lookup.loadUserData(0, "", ff.getDbInfo(), ff.getUserId());
+ } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e);
+ }
+ }
+ lookup.trimToSize();
+
+ String[] requestValue = request.getParameterValues(ff.getFieldName());
+
+ if(lookup != null && lookup.size() > 0) {
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ readOnly = value.isReadOnly();
+ if(requestValue != null && Arrays.asList(requestValue).contains(value.getId())) {
+ //if(value.getId().equals(requestValue))
+ value.setDefaultValue(true);
+ } else if (AppUtils.nvl(ff.getDefaultValue()).length()>0) {
+ if(ff.getDefaultValue().equals(value.getId())) {
+ value.setDefaultValue(true);
+ }
+ }
+ if(!(ff.getFieldType().equals(FormField.FFT_CHECK_BOX) || ff.getFieldType().equals(FormField.FFT_COMBO_BOX) || ff.getFieldType().equals(FormField.FFT_LIST_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI)) && value.isDefaultValue())
+ formFieldValues.add(value);
+ else if(ff.getFieldType().equals(FormField.FFT_CHECK_BOX) || ff.getFieldType().equals(FormField.FFT_COMBO_BOX) || ff.getFieldType().equals(FormField.FFT_LIST_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI)) {
+ formFieldValues.add(value);
+ }
+ //break;
+ }
+ } else {
+ if(requestValue!=null && requestValue.length>0) {
+ IdNameValue value = new IdNameValue(requestValue[0], requestValue[0], true, false);
+ formFieldValues.add(value);
+ }
+ }
+
+ } else {
+ setTriggerFormFieldCheck( getReportFormFields(), ff);
+ ffJSON.setTriggerOtherFormFields(ff.isTriggerOtherFormFields());
+ String[] requestValue = request.getParameterValues(ff.getFieldName());
+ if(requestValue!=null && requestValue.length>0) {
+ IdNameValue value = new IdNameValue(requestValue[0], requestValue[0], true, false);
+ formFieldValues.add(value);
+ } else if (AppUtils.nvl(ff.getDefaultValue()).length()>0) {
+ IdNameValue value = new IdNameValue(ff.getDefaultValue(), ff.getDefaultValue(), true, false);
+ formFieldValues.add(value);
+ }
+ }
+ if(!ff.hasPredefinedList) {
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ }
+
+
+
+ ffJSON.setFormFieldValues(formFieldValues);
+ formFieldJSONList.add(ffJSON);
+ } // for
+ }
+ reportJSONRuntime.setFormFieldList(formFieldJSONList);
+ //reportJSONRuntime.setReportDataColumns(get);
+ int count = 0;
+ Map<String,Object> dvJSON = null;
+ if(rd!=null) {
+ count = 0;
+ reportJSONRuntime.setTotalRows(getReportDataSize());
+ ArrayList<ColumnHeader> colList = new ArrayList<ColumnHeader>();
+ ArrayList<Map<String,Object>> reportDataRows = new ArrayList<Map<String,Object>>();
+ for(rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext(); ) {
+ count++;
+ ColumnHeaderRow chr = rd.reportColumnHeaderRows.getNext();
+ for(chr.resetNext(); chr.hasNext(); ) {
+ colList.add(chr.getNext());
+ }
+ }
+ if(getReportDataSize() > 0) {
+ count = 0;
+ for(rd.reportDataRows.resetNext(); rd.reportDataRows.hasNext(); count++) {
+ dvJSON = new HashMap<String,Object>();
+ DataRow dr = rd.reportDataRows.getNext();
+ for(dr.resetNext(); dr.hasNext(); ) {
+ DataValue dv = dr.getNext();
+ try {
+ dvJSON.put(dv.getColId(), dv);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+
+ }
+ }
+ reportDataRows.add(dvJSON);
+ }
+ }
+ reportJSONRuntime.setReportDataColumns(colList);
+ reportJSONRuntime.setReportDataRows(reportDataRows);
+ //reportJSONRuntime.setSqlWhole(getWholeSQL());
+ reportJSONRuntime.setPageSize(getPageSize());
+
+ }
+
+ if(getReportDataSize() <= 0) {
+ reportJSONRuntime.setMessage(getEmptyMessage());
+ }
+ reportJSONRuntime.setSqlWhole(getWholeSQL());
+ return reportJSONRuntime;
+
+ }
+
+ public ReportJSONRuntime createFormFieldJSONRuntime(HttpServletRequest request) {
+ String userId = AppUtils.getUserID(request);
+ ObjectMapper mapper = new ObjectMapper();
+ ReportJSONRuntime reportJSONRuntime = new ReportJSONRuntime();
+ reportJSONRuntime.setReportTitle(getReportTitle());
+ reportJSONRuntime.setReportID(getReportID());
+ reportJSONRuntime.setReportName(getReportName());
+ reportJSONRuntime.setReportSubTitle(getReportSubTitle());
+ reportJSONRuntime.setNumFormCols(getNumFormColsAsInt());
+ ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>();
+ ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<FormFieldJSON>();
+ if(reportFormFields!=null) {
+ formFieldJSONList = new ArrayList<FormFieldJSON>(reportFormFields.size());
+ for (Iterator iter = reportFormFields.iterator(); iter.hasNext();) {
+ formFieldValues = new ArrayList<IdNameValue>();
+ FormField ff = (FormField) iter.next();
+ FormFieldJSON ffJSON = new FormFieldJSON();
+ ffJSON.setFieldId(ff.getFieldName());
+ ffJSON.setFieldType(ff.getFieldType());
+ ffJSON.setFieldDisplayName(ff.getFieldDisplayName());
+ ffJSON.setHelpText(ff.getHelpText());
+ ffJSON.setValidationType(ff.getValidationType());
+ ffJSON.setFormFieldValues(formFieldValues);
+ ffJSON.setVisible(ff.isVisible());
+ formFieldJSONList.add(ffJSON);
+ }
+ for (Iterator iter = reportFormFields.iterator(); iter.hasNext();) {
+ formFieldValues = new ArrayList<IdNameValue>();
+ FormField ff = (FormField) iter.next();
+ ff.setDbInfo(getDbInfo());
+ for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) {
+ FormFieldJSON ffJSON = (FormFieldJSON) iter1.next();
+ if(ffJSON.getFieldId().equals(ff.getFieldName())) {
+ IdNameList lookup = null;
+ lookup = ff.getLookupList();
+ String selectedValue = "";
+ String oldSQL = "";
+ IdNameList lookupList = null;
+ boolean readOnly = false;
+ if(lookup!=null) {
+ if(!ff.hasPredefinedList) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ oldSQL = lu.getSql();
+ setTriggerFormFieldCheck( getReportFormFields(), ff);
+ ffJSON.setTriggerOtherFormFields(ff.isTriggerOtherFormFields());
+ setTriggerThisFormFieldCheck(getReportFormFields(), ff);
+ SQL = parseAndFillReq_Session_UserValues(request, SQL, userId);
+ SQL = parseAndFillOtherFormfieldValues(request, SQL, userId, formFieldJSONList);
+ //SQL = parseAndFillWithCurrentValues(formGrid,SQL, ff);
+ String defaultSQL = lu.getDefaultSQL();
+ defaultSQL = parseAndFillReq_Session_UserValues(request, defaultSQL, userId);
+ //defaultSQL = parseAndFillWithCurrentValues(formGrid,defaultSQL, ff);
+ lookup = new IdNameSql(-1,SQL,defaultSQL);
+
+ lookupList = lookup;
+ try {
+ lookup.loadUserData(0, "", ff.getDbInfo(), ff.getUserId());
+ } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e);
+ }
+ }
+ lookup.trimToSize();
+
+ String requestValue = request.getParameter(ff.getFieldName());
+ ArrayList<String> requestValueList = new ArrayList<String>();
+ requestValueList.add(requestValue);
+
+ /*if(ff.isTriggerThisFormfield()) {
+ refreshFormFieldsWithLatestValue(request, userId, ff, formFieldJSONList);
+ }*/
+
+
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ readOnly = value.isReadOnly();
+ if(nvl(requestValue).length()>0) {
+ if(value.getId().equals(requestValue))
+ value.setDefaultValue(true);
+ }
+ formFieldValues.add(value);
+ //break;
+ }
+
+ } else {
+ setTriggerFormFieldCheck( getReportFormFields(), ff);
+ ffJSON.setTriggerOtherFormFields(ff.isTriggerOtherFormFields());
+ String[] requestValue = request.getParameterValues(ff.getFieldName());
+ if(requestValue!=null && requestValue.length>0) {
+ IdNameValue value = new IdNameValue(requestValue[0], requestValue[0], true, false);
+ formFieldValues.add(value);
+ } else if (AppUtils.nvl(ff.getDefaultValue()).length()>0) {
+ IdNameValue value = new IdNameValue(ff.getDefaultValue(), ff.getDefaultValue(), true, false);
+ formFieldValues.add(value);
+ }
+ }
+ if(!ff.hasPredefinedList) {
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ }
+
+
+ //if(!ff.isTriggerThisFormfield()) {
+ ffJSON.setFormFieldValues(formFieldValues);
+ //}
+
+ break;
+
+ } //if
+ } //for
+ }//for
+ }//if
+
+ reportJSONRuntime.setFormFieldList(formFieldJSONList);
+ //reportJSONRuntime.setReportDataColumns(get);
+
+ return reportJSONRuntime;
+
+ }
+
+
+ private String parseAndFillOtherFormfieldValues(HttpServletRequest request, String SQL, String userId, ArrayList<FormFieldJSON> formFieldJSONList) {
+ ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>();
+ String selectedValue = "";
+ String displayName = "";
+ for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) {
+ FormFieldJSON ffJSON = (FormFieldJSON) iter1.next();
+ displayName = ffJSON.getFieldDisplayName();
+ ArrayList<IdNameValue> formfieldvalues = ffJSON.getFormFieldValues();
+ for (int i = 0; i< formfieldvalues.size(); i++) {
+ IdNameValue formfieldItem = formfieldvalues.get(i);
+ if(formfieldItem.isDefaultValue()) {
+ selectedValue = formfieldItem.getId();
+ }
+ }
+ SQL = Utils.replaceInString(SQL, "["+displayName+"]", selectedValue);
+ }
+ return SQL;
+
+ }
+
+ private void refreshFormFieldsWithLatestValue(HttpServletRequest request, String userId, FormField ff_src, ArrayList<FormFieldJSON> formFieldJSONList) {
+ ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>();
+ //ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<FormFieldJSON>();
+ List<String> requestValueList = null;
+ IdNameList lookup = null;
+ lookup = ff_src.getLookupList();
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = "" ;
+ String oldSQL = "";
+ String oldDefaultSQL = "";
+ String defaultSQL = "";
+ IdNameList lookupList = null;
+ if(lu != null) {
+ SQL = lu.getSql();
+ oldSQL = lu.getSql();
+ oldDefaultSQL = lu.getDefaultSQL();
+ defaultSQL = lu.getDefaultSQL();
+ }
+ boolean readOnly = false;
+ for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) {
+ FormFieldJSON ffJSON = (FormFieldJSON) iter1.next();
+ if((ffJSON.getFieldId().equals(ff_src.getFieldName())) && ffJSON.isVisible()) {
+ for (Iterator iter = reportFormFields.iterator(); iter.hasNext();) {
+ formFieldValues = new ArrayList<IdNameValue>();
+ FormField ff = (FormField) iter.next();
+ if(!ff.getFieldName().equals(ff_src.getFieldName())) {
+ //IdNameList lookup = null;
+ //lookup = ff.getLookupList();
+ String selectedValue = "";
+
+
+
+ String [] requestParam = request.getParameterValues(ff.getFieldName());
+ if(requestParam != null) {
+ requestValueList = Arrays.asList(request.getParameterValues(ff.getFieldName()));
+
+ } else {
+ requestValueList = new ArrayList<String>();
+ }
+
+
+ if(nvl(ff_src.getBaseSQL()).length()>0 && ff_src.getBaseSQL().indexOf("["+ff.getFieldDisplayName() +"]")!= -1) {
+ if(lookup!=null) {
+ try {
+ if(!ff_src.hasPredefinedList) {
+ String formatSelected = null;
+ if(ff_src.getFieldType().equals(FormField.FFT_LIST_MULTI) || ff_src.getFieldType().equals(FormField.FFT_CHECK_BOX)) {
+ formatSelected = formatSelectedItems(requestValueList, ff_src.getFieldType());
+ } else
+ formatSelected = requestValueList.size()>0?requestValueList.get(0):"";
+ SQL = Utils.replaceInString(SQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected);
+ defaultSQL = Utils.replaceInString(defaultSQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected);
+ defaultSQL = parseAndFillWithCurrentValues(request, defaultSQL, ff_src);
+ defaultSQL = parseAndFillReq_Session_UserValues(request, defaultSQL, userId);
+ SQL = parseAndFillReq_Session_UserValues(request, SQL, userId);
+ SQL = parseAndFillWithCurrentValues(request, SQL, ff_src);
+
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ }
+
+ }
+ }
+ }
+
+ if(nvl(ff_src.getBaseSQL()).length()>0) {
+ lookup = new IdNameSql(-1,SQL,defaultSQL);
+ lookupList = lookup;
+ try {
+ lookup.loadUserData(0, "", ff_src.getDbInfo(), ff_src.getUserId());
+ } catch (Exception e ){
+ e.printStackTrace(); //throw new RaptorRuntimeException(e);
+ }
+ if(!ff_src.hasPredefinedList) {
+ lookup.trimToSize();
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ readOnly = value.isReadOnly();
+ formFieldValues.add(value);
+ }
+ }
+ ffJSON.setFormFieldValues(formFieldValues);
+ }
+ if(!ff_src.hasPredefinedList) {
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ if(oldDefaultSQL != null && !oldDefaultSQL.equals("")) {
+ ((IdNameSql)lookup).setDefaultSQL(oldDefaultSQL);
+ }
+ }
+
+ }
+ }
+
+ }
+
+
+ private void triggerOtherFormFieldsWithThisValue(HttpServletRequest request, String userId, FormField ff_src, ArrayList<String> requestValueList, ArrayList<FormFieldJSON> formFieldJSONList) {
+ ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>();
+ //ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<FormFieldJSON>();
+ for (Iterator iter = reportFormFields.iterator(); iter.hasNext();) {
+ formFieldValues = new ArrayList<IdNameValue>();
+ FormField ff = (FormField) iter.next();
+ if(!ff_src.getFieldName().equals(ff.getFieldName())) {
+ for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) {
+ FormFieldJSON ffJSON = (FormFieldJSON) iter1.next();
+ if(ffJSON.getFieldId().equals(ff.getFieldName()) && ffJSON.isVisible()) {
+ if(nvl(ff.getBaseSQL()).length()>0 && ff.getBaseSQL().indexOf("["+ff_src.getFieldDisplayName() +"]")!= -1) {
+ IdNameList lookup = null;
+ lookup = ff.getLookupList();
+ String selectedValue = "";
+ String oldSQL = "";
+ String oldDefaultSQL = "";
+ IdNameList lookupList = null;
+ boolean readOnly = false;
+ if(lookup!=null) {
+ try {
+ if(!ff.hasPredefinedList) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ oldSQL = lu.getSql();
+ oldDefaultSQL = lu.getDefaultSQL();
+ String defaultSQL = lu.getDefaultSQL();
+ String formatSelected = null;
+ if(ff_src.getFieldType().equals(FormField.FFT_LIST_MULTI) || ff_src.getFieldType().equals(FormField.FFT_CHECK_BOX)) {
+ formatSelected = formatSelectedItems(requestValueList, ff.getFieldType());
+ }
+ else
+ formatSelected = requestValueList.size()>0?requestValueList.get(0):"";
+ SQL = Utils.replaceInString(SQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected);
+ defaultSQL = Utils.replaceInString(defaultSQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected);
+ defaultSQL = parseAndFillWithCurrentValues(request, defaultSQL, ff_src);
+ defaultSQL = parseAndFillReq_Session_UserValues(request, defaultSQL, userId);
+ SQL = parseAndFillReq_Session_UserValues(request, SQL, userId);
+ SQL = parseAndFillWithCurrentValues(request, SQL, ff_src);
+ lookup = new IdNameSql(-1,SQL,defaultSQL);
+ lookupList = lookup;
+ try {
+ lookup.loadUserData(0, "", ff.getDbInfo(), ff.getUserId());
+ } catch (Exception e ){
+ e.printStackTrace(); //throw new RaptorRuntimeException(e);
+ }
+ }
+ lookup.trimToSize();
+
+
+
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ readOnly = value.isReadOnly();
+// if(nvl(requestValue).length()>0) {
+// if(value.getId().equals(requestValue))
+// value.setDefaultValue(true);
+// }
+ formFieldValues.add(value);
+ //break;
+ }
+
+ ffJSON.setFormFieldValues(formFieldValues);
+
+ if(!ff.hasPredefinedList) {
+ if(oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql)lookup).setSQL(oldSQL);
+ }
+ if(oldDefaultSQL != null && !oldDefaultSQL.equals("")) {
+ ((IdNameSql)lookup).setDefaultSQL(oldDefaultSQL);
+ }
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ } //ff baseSQL
+ }
+ }
+ }
+ }
+
+ }
+
+ public String formatSelectedItems(List selectedItems, String type) {
+ StringBuffer value = new StringBuffer("");
+ int count = 0;
+ boolean multiple = false;
+ if(type.equals("LIST_MULTI_SELECT"))
+ multiple = true;
+ //multiple = (selectedItems.size()>1);
+ for(Iterator iter = selectedItems.iterator(); iter.hasNext(); ) {
+ count++;
+ String entry = (String) iter.next();
+ if(count == 1 && multiple)
+ value.append("(");
+ //if(type.equals(FormField.FFT_CHECK_BOX))
+ /*if(type.equals(FormField.FFT_CHECK_BOX))
+ value.append("'"+Utils.oracleSafe(entry)+"'");
+ else*/ if (type.equals(FormField.FFT_LIST_MULTI))
+ value.append("'"+Utils.oracleSafe(entry)+"'");
+ else if(type.equals(FormField.FFT_LIST_BOX))
+ value.append(Utils.oracleSafe(entry));
+ else
+ value.append("'"+Utils.oracleSafe(entry)+"'");
+ if((count < selectedItems.size()) && multiple)
+ value.append(",");
+ if((count == selectedItems.size()) && multiple)
+ value.append(")");
+ }
+
+ if(value.length()>0)
+ return value.toString();
+ else
+ return null;
+ }
+
+public String parseAndFillWithCurrentValues(HttpServletRequest request, String sql, FormField source_Formfield) {
+
+ if (getFormFieldList() != null) {
+ for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ String fieldId = fft.getFieldId();
+ String fieldDisplay = getFormFieldDisplayName(fft);
+ String formfield_value = "";
+ List<String> selectedItems = new ArrayList<String>();
+ //Added so that Combo Box in old RAPTOR definition is translated to List box
+ if(fft.getFieldType().equals(FormField.FFT_COMBO_BOX)) {
+ fft.setFieldType(FormField.FFT_LIST_BOX);
+ }
+ if(!fft.getFieldType().equals(FormField.FFT_BLANK)) {
+ //if(source_Formfield==null || (source_Formfield!=null && !fft.getFieldId().equals(source_Formfield.getFieldName()))) {
+ // Add oracle safe
+ // Add param base sql
+ if(fft.getFieldType().equals(FormField.FFT_LIST_MULTI) || fft.getFieldType().equals(FormField.FFT_CHECK_BOX)) {
+ if(request.getParameterValues(fieldId)!=null && request.getParameterValues(fieldId).length > 0) {
+
+ selectedItems = Arrays.asList(request.getParameterValues(fieldId));
+ formfield_value = formatSelectedItems(selectedItems, fft.getFieldType());
+ } else {
+ formfield_value = "";
+ }
+ } else if(fft.getFieldType().equals(FormField.FFT_RADIO_BTN)) {
+ if(request.getParameter(fieldId)!=null) {
+ formfield_value = request.getParameter(fieldId);
+ } else {
+ formfield_value = "";
+ }
+ } else if (fft.getFieldType().equals(FormField.FFT_HIDDEN)) {
+ if(request.getParameter(fieldId)!=null) {
+ formfield_value = request.getParameter(fieldId);
+ } else {
+ formfield_value = "";
+ }
+ } else if((fft.getFieldType().equals(FormField.FFT_TEXT) || fft.getFieldType().equals(FormField.FFT_TEXTAREA)) &&
+ (!fft.getValidationType().equals(FormField.VT_DATE) && !fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)&&
+ !fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) && !fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) ) {
+ if(request.getParameter(fieldId)!=null) {
+ formfield_value = request.getParameter(fieldId);
+ } else {
+ formfield_value = "";
+ }
+ } else if (fft.getValidationType().equals(FormField.VT_DATE) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)||
+ fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ /*if(formGrid.hasFellow(fieldId, true)) {
+ Datebox tb = (Datebox) formGrid.getFellowIfAny(fieldId, true);
+ try {
+ formfield_value = tb.getText();
+ } catch (WrongValueException ex) {
+ formfield_value = "";
+ }
+ if(AppUtils.nvl(formfield_value).length() > 0) {
+ if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)) {
+ if(formGrid.hasFellow(fieldId+"_Hr", true)) {
+ Label hiddenLbHr = (Label) formGrid.getFellowIfAny(fieldId+"_Hr", true);
+ formfield_value = formfield_value + " " + hiddenLbHr.getValue();
+ }
+ } else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)) {
+ if(formGrid.hasFellow(fieldId+"_Min", true)) {
+ Label hiddenLbHr = (Label) formGrid.getFellowIfAny(fieldId+"_Hr", true);
+ //formfield_value = formfield_value + " " + hiddenLbHr.getValue();
+ Label hiddenLbMin = (Label) formGrid.getFellowIfAny(fieldId+"_Min", true);
+ formfield_value = formfield_value + " " + hiddenLbHr.getValue() + ":" +hiddenLbMin.getValue();
+
+ }
+ } else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ if(formGrid.hasFellow(fieldId+"_Sec", true)) {
+ Label hiddenLbHr = (Label) formGrid.getFellowIfAny(fieldId+"_Hr", true);
+ //formfield_value = formfield_value + " " + hiddenLbHr.getValue();
+ Label hiddenLbMin = (Label) formGrid.getFellowIfAny(fieldId+"_Min", true);
+ //formfield_value = formfield_value + " " + hiddenLbHr.getValue() + ":" +hiddenLbMin.getValue();
+ Label hiddenLbSec = (Label) formGrid.getFellowIfAny(fieldId+"_Sec", true);
+ formfield_value = formfield_value + " " + hiddenLbHr.getValue() + ":" +hiddenLbMin.getValue()+ ":" +hiddenLbSec.getValue();
+
+ }
+ }
+ }
+
+ } else {
+ formfield_value = "";
+ }*/
+ } else if ((fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)||
+ fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC))) {
+ /*if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)||
+ fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)) {
+ if(formGrid.hasFellow(fieldId+"_Hr", true)) {
+ Label hiddenLbHr = (Label) formGrid.getFellowIfAny(fieldId+"_Hr", true);
+ formfield_value = formfield_value + " " + hiddenLbHr.getValue();
+ }
+ } else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)) {
+ if(formGrid.hasFellow(fieldId+"_Min", true)) {
+ Label hiddenLbHr = (Label) formGrid.getFellowIfAny(fieldId+"_Hr", true);
+ //formfield_value = formfield_value + " " + hiddenLbHr.getValue();
+ Label hiddenLbMin = (Label) formGrid.getFellowIfAny(fieldId+"_Min", true);
+ formfield_value = formfield_value + " " + hiddenLbHr.getValue() + ":" +hiddenLbMin.getValue();
+
+ }
+ } else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ if(formGrid.hasFellow(fieldId+"_Sec", true)) {
+ Label hiddenLbHr = (Label) formGrid.getFellowIfAny(fieldId+"_Hr", true);
+ //formfield_value = formfield_value + " " + hiddenLbHr.getValue();
+ Label hiddenLbMin = (Label) formGrid.getFellowIfAny(fieldId+"_Min", true);
+ //formfield_value = formfield_value + " " + hiddenLbHr.getValue() + ":" +hiddenLbMin.getValue();
+ Label hiddenLbSec = (Label) formGrid.getFellowIfAny(fieldId+"_Sec", true);
+ formfield_value = formfield_value + " " + hiddenLbHr.getValue() + ":" +hiddenLbMin.getValue()+ ":" +hiddenLbSec.getValue();
+
+ }
+ }
+
+ } */
+ } else if (fft.getFieldType().equals(FormField.FFT_TEXT_W_POPUP)) {
+ if(request.getParameter(fieldId)!=null) {
+ formfield_value = request.getParameter(fieldId);
+ } else {
+ formfield_value = "";
+ }
+ } else if (fft.getFieldType().equals(FormField.FFT_LIST_BOX)) {
+ if(request.getParameter(fieldId)!=null) {
+ formfield_value = request.getParameter(fieldId);
+ } else {
+ formfield_value = "";
+ }
+ //}
+ }
+ if(nvl(formfield_value).length()>0) {
+ sql = Utils.replaceInString(sql, fieldDisplay, formfield_value);
+ } else {
+ sql = Utils.replaceInString(sql, "'"+fieldDisplay+"'", "null");
+ sql = Utils.replaceInString(sql, fieldDisplay, "null");
+ //sql = Utils.replaceInString(sql, fieldDisplay, "''");
+ }
+ } // for
+ }
+ }
+ return sql;
+ }
+ public String parseAndFillReq_Session_UserValues(HttpServletRequest request, String sql, String user_id) {
+ HttpSession session = request.getSession();
+
+ String[] reqParameters = Globals.getRequestParams().split(",");
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ String[] scheduleSessionParameters = Globals.getSessionParamsForScheduling().split(",");
+
+
+ if(AppUtils.nvl(sql).length()>0) {
+ for (int i = 0; i < reqParameters.length; i++) {
+ if(!reqParameters[i].startsWith("ff") && (request.getParameter(reqParameters[i].toUpperCase())!=null && request.getParameter(reqParameters[i].toUpperCase()).length() > 0))
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) );
+ else if (request.getParameter(reqParameters[i])!=null && request.getParameter(reqParameters[i]).length() > 0)
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) );
+ }
+
+ for (int i = 0; i < scheduleSessionParameters.length; i++) {
+ //debugLogger.debug(" Session " + " scheduleSessionParameters[i] " + scheduleSessionParameters[i].toUpperCase() + " " + request.getParameter(scheduleSessionParameters[i]));
+ if(request.getParameter(scheduleSessionParameters[i])!=null && request.getParameter(scheduleSessionParameters[i]).trim().length()>0 )
+ sql = Utils.replaceInString(sql, "[" + scheduleSessionParameters[i].toUpperCase()+"]", request.getParameter(scheduleSessionParameters[i]) );
+ if(request.getAttribute(scheduleSessionParameters[i])!=null && ((String)request.getAttribute(scheduleSessionParameters[i])).trim().length()>0 )
+ sql = Utils.replaceInString(sql, "[" + scheduleSessionParameters[i].toUpperCase()+"]", (String) request.getAttribute(scheduleSessionParameters[i]) );
+
+ }
+
+ for (int i = 0; i < sessionParameters.length; i++) {
+ //if(!sessionParameters[i].startsWith("ff"))
+ //fieldSQL = Utils.replaceInString(fieldSQL, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i].toUpperCase()) );
+ //else {
+ if (session.getAttribute(sessionParameters[i])!=null && ((String)session.getAttribute(sessionParameters[i])).length() > 0) {
+ //debugLogger.debug(" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i]));
+ sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ }
+ // }
+ }
+ sql = Utils.replaceInString(sql, "[USERID]", user_id);
+ sql = Utils.replaceInString(sql, "[USER_ID]", user_id);
+ sql = Utils.replaceInString(sql, "[LOGGED_USERID]", user_id);
+
+ }
+ return sql;
+ }
+
+} // ReportRuntime
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/TimeSeriesChartOptions.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/TimeSeriesChartOptions.java
new file mode 100644
index 00000000..9e6f657f
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/TimeSeriesChartOptions.java
@@ -0,0 +1,62 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+public class TimeSeriesChartOptions {
+ private String lineChartRenderer;
+ private boolean multiSeries;
+ private boolean nonTimeAxis;
+ private boolean showXAxisLabel;
+ private boolean addXAxisTicker;
+
+ public String getLineChartRenderer() {
+ return lineChartRenderer;
+ }
+ public void setLineChartRenderer(String lineChartRenderer) {
+ this.lineChartRenderer = lineChartRenderer;
+ }
+ public boolean isMultiSeries() {
+ return multiSeries;
+ }
+ public void setMultiSeries(boolean multiSeries) {
+ this.multiSeries = multiSeries;
+ }
+ public boolean isNonTimeAxis() {
+ return nonTimeAxis;
+ }
+ public void setNonTimeAxis(boolean nonTimeAxis) {
+ this.nonTimeAxis = nonTimeAxis;
+ }
+ public boolean isShowXAxisLabel() {
+ return showXAxisLabel;
+ }
+ public void setShowXAxisLabel(boolean showXAxisLabel) {
+ this.showXAxisLabel = showXAxisLabel;
+ }
+ public boolean isAddXAxisTicker() {
+ return addXAxisTicker;
+ }
+ public void setAddXAxisTicker(boolean addXAxisTicker) {
+ this.addXAxisTicker = addXAxisTicker;
+ }
+
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/VisualManager.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/VisualManager.java
new file mode 100644
index 00000000..9587de53
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/VisualManager.java
@@ -0,0 +1,68 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.runtime;
+
+import java.util.HashMap;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+
+public class VisualManager extends RaptorObject {
+ private HashMap hiddenCols = new HashMap();
+
+ private String sortByColId = "";
+
+ private String sortByAscDesc = AppConstants.SO_ASC;
+
+ public VisualManager() {
+ super();
+ }
+
+ public void hideColumn(String colId) {
+ hiddenCols.put(colId, "Y");
+ } // hideColumn
+
+ public void showColumn(String colId) {
+ hiddenCols.put(colId, "N");
+ } // showColumn
+
+ public boolean isColumnVisible(String colId) {
+ return nvl((String) hiddenCols.get(colId), "N").equals("N");
+ } // isColumnVisible
+
+ public void setSortByColumn(String colId) {
+ if (sortByColId.equals(colId))
+ sortByAscDesc = sortByAscDesc.equals(AppConstants.SO_ASC) ? AppConstants.SO_DESC
+ : AppConstants.SO_ASC;
+ else {
+ sortByColId = colId;
+ sortByAscDesc = AppConstants.SO_ASC;
+ }
+ } // setSortByColumn
+
+ public String getSortByColId() {
+ return sortByColId;
+ }
+
+ public String getSortByAscDesc() {
+ return sortByAscDesc;
+ }
+
+} // VisualManager
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResult.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResult.java
new file mode 100644
index 00000000..ec7999e0
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResult.java
@@ -0,0 +1,84 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.search;
+
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+
+public class ReportSearchResult extends SearchResult {
+ private static final String HTML_FORM = "forma";
+
+ public ReportSearchResult(int pageNo) {
+ this(pageNo, Globals.getDefaultPageSize(), -1, -1);
+ } // ReportSearchResult
+
+ public ReportSearchResult(int pageNo, int writeAccessColIndex, int ownerIndicatorColIndex) {
+ this(pageNo, Globals.getDefaultPageSize(), writeAccessColIndex, ownerIndicatorColIndex);
+ } // ReportSearchResult
+
+ public ReportSearchResult(int pageNo, int pageSize, int writeAccessColIndex,
+ int ownerIndicatorColIndex) {
+ super(pageNo, pageSize, writeAccessColIndex, ownerIndicatorColIndex);
+
+ addColumn(new SearchResultColumn("no","No", "5%", "Center"));
+ addColumn(new SearchResultColumn("rep_id","Report ID", "5%", "Center"));
+ addColumn(new SearchResultColumn("rep_name","Report Name", "25%", "Left"));
+ addColumn(new SearchResultColumn("descr","Description", "30%", "Left"));
+ addColumn(new SearchResultColumn("owner","Report Owner", "10%", "Center"));
+ addColumn(new SearchResultColumn("create_date","Create Date", "10%", "Center"));
+ addColumn(new SearchResultColumn("copy","&nbsp;&nbsp;Copy&nbsp;&nbsp;", "5%", "Center",
+ "document." + HTML_FORM + "." + AppConstants.RI_ACTION
+ + ".value='report.copy';", "Copy report", HTML_FORM,
+ "Are you sure you want to create a copy of this report?", AppUtils
+ .getImgFolderURL()
+ + "modify_icon.gif", "13", "12", true, false, false));
+ /*addColumn(new SearchResultColumn("&nbsp;&nbsp;Schedule&nbsp;&nbsp;", "5%", "Center",
+ "document." + HTML_FORM + "." + AppConstants.RI_ACTION
+ + ".value='report.schedule_only';", "Schedule report", HTML_FORM,
+ null, AppUtils
+ .getImgFolderURL()
+ + "calendar_icon.gif", "13", "12", true, false, false));
+ */
+
+ addColumn(new SearchResultColumn("edit","&nbsp;&nbsp;Edit&nbsp;&nbsp;", "5%", "Center",
+ "document." + HTML_FORM + "." + AppConstants.RI_ACTION
+ + ".value='report.edit';", "Edit report", HTML_FORM, null, AppUtils
+ .getImgFolderURL()
+ + "pen_paper.gif", "12", "12", false, true, false));
+ addColumn(new SearchResultColumn("delete","Delete", "5%", "Center", "document." + HTML_FORM
+ + "." + AppConstants.RI_ACTION + ".value='report.delete';", "Delete report",
+ HTML_FORM, "Are you sure you want to delete this report?", AppUtils
+ .getImgFolderURL()
+ + "deleteicon.gif", "12", "12", false, false, true));
+ addColumn(new SearchResultColumn("schedule","Schedule", "5%", "Center", "document." + HTML_FORM
+ + "." + AppConstants.RI_ACTION + ".value='report.schedule.report.submit_wmenu';", "Schedule report",
+ HTML_FORM, null, AppUtils
+ .getImgFolderURL()
+ + "calendar_icon.gif", "20", "20", false, false, false, true));
+ addColumn(new SearchResultColumn("run","&nbsp;&nbsp;Run&nbsp;&nbsp;", "5%", "Center",
+ "document." + HTML_FORM + "." + AppConstants.RI_ACTION
+ + ".value='report.run';", "Run report", HTML_FORM, null, AppUtils
+ .getImgFolderURL()
+ + "test_run.gif", "12", "12"));
+ } // ReportSearchResult
+
+} // ReportSearchResult
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResultJSON.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResultJSON.java
new file mode 100644
index 00000000..fda50d54
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResultJSON.java
@@ -0,0 +1,251 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.search;
+
+import java.util.ArrayList;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+class MetaReport {
+ private boolean pagination = true;
+ private int pageSize;
+ private int totalSize;
+ private int pageNo;
+ public boolean isPagination() {
+ return pagination;
+ }
+ public void setPagination(boolean pagination) {
+ this.pagination = pagination;
+ }
+ public int getPageSize() {
+ return pageSize;
+ }
+ public void setPageSize(int pageSize) {
+ this.pageSize = pageSize;
+ }
+ public int getTotalSize() {
+ return totalSize;
+ }
+ public void setTotalSize(int totalSize) {
+ this.totalSize = totalSize;
+ }
+ public int getPageNo() {
+ return pageNo;
+ }
+ public void setPageNo(int pageNo) {
+ this.pageNo = pageNo;
+ }
+
+
+}
+class SearchReport {
+ private MetaReport metaReport;
+ public MetaReport getMetaReport() {
+ return metaReport;
+ }
+ public void setMetaReport(MetaReport metaReport) {
+ this.metaReport = metaReport;
+ }
+ private ArrayList<ArrayList<SearchResultColumn>> columns = new ArrayList<ArrayList<SearchResultColumn>>();
+ private ArrayList<ArrayList<SearchResultRow>> rows = new ArrayList<ArrayList<SearchResultRow>>();
+ public ArrayList<ArrayList<SearchResultColumn>> getColumns() {
+ return columns;
+ }
+ public void setColumns(ArrayList<ArrayList<SearchResultColumn>> columns) {
+ this.columns = columns;
+ }
+ public ArrayList<ArrayList<SearchResultRow>> getRows() {
+ return rows;
+ }
+ public void setRows(ArrayList<ArrayList<SearchResultRow>> rows) {
+ this.rows = rows;
+ }
+
+}
+
+public class ReportSearchResultJSON extends SearchResultJSON {
+ private static final String HTML_FORM = "forma";
+ private String JSONString= "";
+ private SearchReport searchReport;
+ //private ArrayList<ArrayList<SearchResultColumn>> columns = new ArrayList<ArrayList<SearchResultColumn>>();
+ //private ArrayList<ArrayList<SearchResultRow>> rows = new ArrayList<ArrayList<SearchResultRow>>();
+
+
+ public ReportSearchResultJSON(int pageNo) {
+ this(pageNo, Globals.getDefaultPageSize(), -1, -1);
+ } // ReportSearchResult
+
+ public ReportSearchResultJSON(int pageNo, int writeAccessColIndex, int ownerIndicatorColIndex) {
+ this(pageNo, Globals.getDefaultPageSize(), writeAccessColIndex, ownerIndicatorColIndex);
+ } // ReportSearchResult
+
+ public ReportSearchResultJSON(int pageNo, int pageSize, int writeAccessColIndex,
+ int ownerIndicatorColIndex) {
+
+ searchReport = new SearchReport();
+ MetaReport metaReport = new MetaReport();
+ //if(searchReport.getMetaReport()!=null)
+ searchReport.setMetaReport(metaReport);
+ metaReport.setPageNo(pageNo);
+ metaReport.setPageSize(pageSize);
+ metaReport.setPagination(true);
+ addColumn(new SearchResultColumn("no", "No", "5%", "Center"));
+ addColumn(new SearchResultColumn("rep_id", "Report ID", "5%", "Center"));
+ addColumn(new SearchResultColumn("rep_name", "Report Name", "25%", "Left"));
+ addColumn(new SearchResultColumn("descr", "Description", "30%", "Left"));
+ addColumn(new SearchResultColumn("owner", "Report Owner", "10%", "Center"));
+ addColumn(new SearchResultColumn("create_date", "Create Date", "10%", "Center"));
+ addColumn(new SearchResultColumn("copy", "Copy", "5%", "Center",
+ "document." + HTML_FORM + "." + AppConstants.RI_ACTION
+ + ".value='report.copy';", "Copy report", HTML_FORM,
+ "Are you sure you want to create a copy of this report?", AppUtils
+ .getImgFolderURL()
+ + "modify_icon.gif", "13", "12", true, false, false));
+ /*addColumn(new SearchResultColumn("&nbsp;&nbsp;Schedule&nbsp;&nbsp;", "5%", "Center",
+ "document." + HTML_FORM + "." + AppConstants.RI_ACTION
+ + ".value='report.schedule_only';", "Schedule report", HTML_FORM,
+ null, AppUtils
+ .getImgFolderURL()
+ + "calendar_icon.gif", "13", "12", true, false, false));
+ */
+
+ addColumn(new SearchResultColumn("edit", "Edit", "5%", "Center",
+ "document." + HTML_FORM + "." + AppConstants.RI_ACTION
+ + ".value='report.edit';", "Edit report", HTML_FORM, null, AppUtils
+ .getImgFolderURL()
+ + "pen_paper.gif", "12", "12", false, true, false));
+ addColumn(new SearchResultColumn("delete", "Delete", "5%", "Center", "document." + HTML_FORM
+ + "." + AppConstants.RI_ACTION + ".value='report.delete';", "Delete report",
+ HTML_FORM, "Are you sure you want to delete this report?", AppUtils
+ .getImgFolderURL()
+ + "deleteicon.gif", "12", "12", false, false, true));
+ addColumn(new SearchResultColumn("schedule", "Schedule", "5%", "Center", "document." + HTML_FORM
+ + "." + AppConstants.RI_ACTION + ".value='report.schedule.report.submit_wmenu';", "Schedule report",
+ HTML_FORM, null, AppUtils
+ .getImgFolderURL()
+ + "calendar_icon.gif", "20", "20", false, false, false, true));
+ addColumn(new SearchResultColumn("run", "Run", "5%", "Center",
+ "document." + HTML_FORM + "." + AppConstants.RI_ACTION
+ + ".value='report.run';", "Run report", HTML_FORM, null, AppUtils
+ .getImgFolderURL()
+ + "test_run.gif", "12", "12"));
+ searchReport.getColumns().add(searchResultColumns);
+ } // ReportSearchResult
+
+ public void parseData(DataSet ds, HttpServletRequest request, int pageNo, int pageSize, int writeAccessColIndex, int ownerIndicatorColIndex) throws RaptorException {
+ // Presumes single ID field in the first column of the DataSet and row
+ // number in the first SearchResultColumn
+
+ pageNo = AppUtils.getRequestNvlValue(request, "r_page").length()>0?Integer.parseInt(AppUtils.getRequestNvlValue(request, "r_page")):0;
+ String userID = AppUtils.getUserID(request);
+ int dataSize = ds.getRowCount();
+ //pageSize = 0;
+
+ if(searchReport.getMetaReport()!=null) {
+ searchReport.getMetaReport().setPageNo(pageNo);
+ //searchReport.getMetaReport().setPageSize(pageSize);
+ pageSize = searchReport.getMetaReport().getPageSize();
+ searchReport.getMetaReport().setTotalSize(dataSize);
+ }
+ int startRow = (pageNo >= 0) ? (pageNo * pageSize) : 0;
+ int endRow = (pageNo >= 0) ? Math.min(startRow + pageSize, ds.getRowCount()) : ds
+ .getRowCount();
+ for (int r = startRow; r < endRow; r++) {
+ SearchResultRow row = new SearchResultRow();
+ searchResultRows.add(row);
+
+ String idValue = ds.getString(r, 0);
+
+ boolean bCanEdit = true;
+ if (writeAccessColIndex >= 0) {
+ String isReadOnlyValue = nvl(ds.getString(r, writeAccessColIndex), "Y");
+ bCanEdit = AppUtils.isSuperUser(request) || AppUtils.isAdminUser(request)
+ || isReadOnlyValue.equals("N");
+ }
+
+ boolean bCanDelete = bCanEdit;
+ if (Globals.getDeleteOnlyByOwner() && ownerIndicatorColIndex >= 0) {
+ String isOwnedByUserRecord = nvl(ds.getString(r, ownerIndicatorColIndex), "N");
+ bCanDelete = AppUtils.isSuperUser(request) || isOwnedByUserRecord.equals("Y");
+ }
+
+ boolean bCanSchedule = ds.getString(r, getNumColumns()-3).equals("Y");
+
+ row.addColumnContent(new ColumnContent(getColumn(0).getColumnId(), new SearchResultField("" + (r + 1), idValue,
+ getColumn(0), true)));
+ boolean isAuthorized = true;
+ for (int c = 1; c < getNumColumns(); c++) {
+ SearchResultColumn column = getColumn(c);
+ isAuthorized = true;
+
+ if(column.isCopyLink())
+ isAuthorized = Globals.getCanCopyOnReadOnly()? true:bCanEdit;
+ else if (column.isDeleteLink())
+ isAuthorized = bCanDelete;
+ else if (column.isEditLink())
+ isAuthorized = bCanEdit;
+ else if (column.isScheduleLink())
+ isAuthorized = bCanSchedule;
+ row.addColumnContent(new ColumnContent(column.getColumnId(), new SearchResultField(
+ (column.getLinkURL() == null) ? ds.getString(r, c) : column
+ .getLinkTitle(), idValue, column, isAuthorized
+ )));
+ } // for
+ } // for
+ searchReport.getRows().add(searchResultRows);
+ ObjectMapper mapper = new ObjectMapper();
+ String jsonInString = "";
+ try {
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(searchReport);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+
+ }
+ System.out.println(jsonInString);
+ this.JSONString = jsonInString;
+ } // parseData
+
+ private String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ private String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ public String getJSONString() {
+ return JSONString;
+ }
+
+ public void setJSONString(String jSONString) {
+ JSONString = jSONString;
+ }
+
+
+} // ReportSearchResult
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResult.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResult.java
new file mode 100644
index 00000000..5ab75590
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResult.java
@@ -0,0 +1,213 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.search;
+
+import java.util.ArrayList;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+
+public class SearchResult{
+ private int pageNo = -1;
+
+ private int pageSize = 50;
+
+ private int dataSize = -1;
+
+ private int writeAccessColIndex = -1;
+
+ private int ownerIndicatorColIndex = -1;
+
+ private String csvPageFileName = null;
+
+
+
+ private String csvAllRowsFileName = null;
+
+ private String excelAllRowsFileName = null;
+
+ public ArrayList searchResultColumns = new ArrayList();
+
+ public ArrayList searchResultRows = new ArrayList();
+
+ public SearchResult(int pageNo) {
+ this(pageNo, Globals.getDefaultPageSize());
+ } // SearchResult
+
+ public SearchResult(int pageNo, int pageSize) {
+ this(pageNo, pageSize, -1, -1);
+ } // SearchResult
+
+ public SearchResult(int pageNo, int pageSize, int writeAccessColIndex,
+ int ownerIndicatorColIndex) {
+ super();
+
+ this.pageNo = pageNo;
+ this.pageSize = pageSize;
+
+ this.writeAccessColIndex = writeAccessColIndex;
+ this.ownerIndicatorColIndex = ownerIndicatorColIndex;
+ } // SearchResult
+
+ public int getPageNo() {
+ return pageNo;
+ }
+
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ public int getDataSize() {
+ return dataSize;
+ }
+
+ public String getCsvPageFileName() {
+ return csvPageFileName;
+ }
+
+ public String getCsvAllRowsFileName() {
+ return csvAllRowsFileName;
+ }
+
+ public String getExcelAllRowsFileName() {
+ return excelAllRowsFileName;
+ }
+
+ private void setDataSize(int dataSize) {
+ this.dataSize = dataSize;
+ }
+
+ public void setCsvPageFileName(String csvPageFileName) {
+ this.csvPageFileName = csvPageFileName;
+ }
+
+
+
+ public void setCsvAllRowsFileName(String csvAllRowsFileName) {
+ this.csvAllRowsFileName = csvAllRowsFileName;
+ }
+
+
+
+ public void addColumn(SearchResultColumn column) {
+ searchResultColumns.add(column);
+ } // addColumn
+
+ public SearchResultColumn getColumn(int index) {
+ return (SearchResultColumn) searchResultColumns.get(index);
+ } // getColumn
+
+ public int getNumColumns() {
+ return searchResultColumns.size();
+ } // getNumColumns
+
+ public int getNumRows() {
+ return searchResultRows.size();
+ } // getNumRows
+
+ public SearchResultRow getRow(int index) {
+ return (SearchResultRow) searchResultRows.get(index);
+ } // getRow
+
+ public void parseData(DataSet ds, HttpServletRequest request) throws RaptorException {
+ // Presumes single ID field in the first column of the DataSet and row
+ // number in the first SearchResultColumn
+ String userID = AppUtils.getUserID(request);
+ setDataSize(ds.getRowCount());
+
+ int startRow = (pageNo >= 0) ? (pageNo * pageSize) : 0;
+ int endRow = (pageNo >= 0) ? Math.min(startRow + pageSize, ds.getRowCount()) : ds
+ .getRowCount();
+ for (int r = startRow; r < endRow; r++) {
+ SearchResultRow row = new SearchResultRow();
+ searchResultRows.add(row);
+
+ String idValue = ds.getString(r, 0);
+
+ boolean bCanEdit = true;
+ if (writeAccessColIndex >= 0) {
+ String isReadOnlyValue = nvl(ds.getString(r, writeAccessColIndex), "Y");
+ bCanEdit = AppUtils.isSuperUser(request) || AppUtils.isAdminUser(request)
+ || isReadOnlyValue.equals("N");
+ }
+
+ boolean bCanDelete = bCanEdit;
+ if (Globals.getDeleteOnlyByOwner() && ownerIndicatorColIndex >= 0) {
+ String isOwnedByUserRecord = nvl(ds.getString(r, ownerIndicatorColIndex), "N");
+ bCanDelete = AppUtils.isSuperUser(request) || isOwnedByUserRecord.equals("Y");
+ }
+
+ boolean bCanSchedule = ds.getString(r, getNumColumns()-3).equals("Y");
+
+ row.addSearchResultField(new SearchResultField("" + (r + 1), idValue,
+ getColumn(0), true));
+ boolean isAuthorized = true;
+ for (int c = 1; c < getNumColumns(); c++) {
+ SearchResultColumn column = getColumn(c);
+ isAuthorized = true;
+
+ if(column.isCopyLink())
+ isAuthorized = Globals.getCanCopyOnReadOnly()? true:bCanEdit;
+ else if (column.isDeleteLink())
+ isAuthorized = bCanDelete;
+ else if (column.isEditLink())
+ isAuthorized = bCanEdit;
+ else if (column.isScheduleLink())
+ isAuthorized = bCanSchedule;
+
+ row.addSearchResultField(new SearchResultField(
+ (column.getLinkURL() == null) ? ds.getString(r, c) : column
+ .getLinkTitle(), idValue, column, isAuthorized
+ ));
+ } // for
+ } // for
+ } // parseData
+
+ public void truncateToPage(int pageNo) {
+ if (this.pageNo >= 0 || pageNo < 0)
+ return;
+
+ this.pageNo = pageNo;
+
+ int startRow = pageNo * pageSize;
+ int endRow = Math.min(startRow + pageSize, dataSize);
+
+ for (int r = getNumRows() - 1; r >= endRow; r--)
+ searchResultRows.remove(r);
+
+ for (int r = startRow - 1; r >= 0; r--)
+ searchResultRows.remove(r);
+ } // truncateToPage
+
+ /** *********************************************************************** */
+
+ private String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ private String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+} // SearchResult
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultColumn.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultColumn.java
new file mode 100644
index 00000000..bca1f4cf
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultColumn.java
@@ -0,0 +1,254 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.search;
+
+public class SearchResultColumn extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private String columnId = "";
+ private String columnTitle = "";
+
+ private String columnWidth = "";
+
+ private String alignment = "Left";
+
+ private String linkURL = null; // if not null => display link instead of
+ // text
+
+ private String linkTitle = null; // if img => hint, otherwise link
+ // display text
+
+ private String linkForm = null; // if not null => displays input submit
+ // instead of link
+
+ private String linkConfirmMsg = null; // if not null => display conf. box
+ // on link click
+
+ private String linkImg = null; // if not null => link shows image, not text
+
+ private String linkImgWidth = null; // optional
+
+ private String linkImgHeight = null; // optional
+
+ private boolean copyLink = false; // optional
+
+ private boolean editLink = false; // optional
+
+ private boolean deleteLink = false; // optional
+
+ private boolean scheduleLink = false; // optional
+
+ public SearchResultColumn(String columnId, String columnTitle) {
+ super();
+ setColumnId(columnId);
+ setColumnTitle(columnTitle);
+ } // SearchResultColumn
+
+ public SearchResultColumn(String columnId, String columnTitle, String columnWidth, String alignment) {
+ super();
+ setColumnId(columnId);
+ setColumnTitle(columnTitle);
+ setColumnWidth(columnWidth);
+ setAlignment(alignment);
+ } // SearchResultColumn
+
+ public SearchResultColumn(String columnId, String columnTitle, String columnWidth, String alignment,
+ String linkURL, String linkTitle, String linkForm, String linkConfirmMsg,
+ String linkImg) {
+ super();
+ setColumnId(columnId);
+ setColumnTitle(columnTitle);
+ setColumnWidth(columnWidth);
+ setAlignment(alignment);
+ setLinkURL(linkURL);
+ setLinkTitle(linkTitle);
+ setLinkForm(linkForm);
+ setLinkConfirmMsg(linkConfirmMsg);
+ setLinkImg(linkImg);
+ } // SearchResultColumn
+
+ public SearchResultColumn(String columnId, String columnTitle, String columnWidth, String alignment,
+ String linkURL, String linkTitle, String linkForm, String linkConfirmMsg,
+ String linkImg, String linkImgWidth, String linkImgHeight) {
+ this(columnId, columnTitle, columnWidth, alignment, linkURL, linkTitle, linkForm,
+ linkConfirmMsg, linkImg);
+
+ setLinkWidth(linkImgWidth);
+ setLinkHeight(linkImgHeight);
+ } // SearchResultColumn
+
+ public SearchResultColumn(String columnId, String columnTitle, String columnWidth, String alignment,
+ String linkURL, String linkTitle, String linkForm, String linkConfirmMsg,
+ String linkImg, String linkImgWidth, String linkImgHeight, boolean copyLink,
+ boolean editLink, boolean deleteLink) {
+ this(columnId, columnTitle, columnWidth, alignment, linkURL, linkTitle, linkForm,
+ linkConfirmMsg, linkImg, linkImgWidth, linkImgHeight);
+
+ setCopyLink(copyLink);
+ setEditLink(editLink);
+ setDeleteLink(deleteLink);
+ } // SearchResultColumn
+
+ public SearchResultColumn(String columnId, String columnTitle, String columnWidth, String alignment,
+ String linkURL, String linkTitle, String linkForm, String linkConfirmMsg,
+ String linkImg, String linkImgWidth, String linkImgHeight, boolean copyLink,
+ boolean editLink, boolean deleteLink, boolean scheduleLink) {
+ this(columnId, columnTitle, columnWidth, alignment, linkURL, linkTitle, linkForm,
+ linkConfirmMsg, linkImg, linkImgWidth, linkImgHeight);
+
+ setCopyLink(copyLink);
+ setEditLink(editLink);
+ setDeleteLink(deleteLink);
+ setScheduleLink(scheduleLink);
+ } // SearchResultColumn
+
+ public String getColumnTitle() {
+ return columnTitle;
+ }
+
+ public String getColumnWidth() {
+ return columnWidth;
+ }
+
+ public String getAlignment() {
+ return alignment;
+ }
+
+ public String getLinkURL() {
+ return linkURL;
+ }
+
+ public String getLinkTitle() {
+ return linkTitle;
+ }
+
+ public String getLinkForm() {
+ return linkForm;
+ }
+
+ public String getLinkConfirmMsg() {
+ return linkConfirmMsg;
+ }
+
+ public String getLinkImg() {
+ return linkImg;
+ }
+
+ public String getLinkImgWidth() {
+ return linkImgWidth;
+ }
+
+ public String getLinkImgHeight() {
+ return linkImgHeight;
+ }
+
+ public boolean isCopyLink() {
+ return copyLink;
+ }
+
+ public boolean isEditLink() {
+ return editLink;
+ }
+
+ public boolean isDeleteLink() {
+ return deleteLink;
+ }
+
+ public void setColumnTitle(String columnTitle) {
+ this.columnTitle = nvl(columnTitle);
+ }
+
+ public void setColumnWidth(String columnWidth) {
+ this.columnWidth = nvl(columnWidth);
+ }
+
+ public void setAlignment(String alignment) {
+ this.alignment = alignment;
+ }
+
+ public void setLinkURL(String linkURL) {
+ this.linkURL = linkURL;
+ }
+
+ public void setLinkTitle(String linkTitle) {
+ this.linkTitle = linkTitle;
+ }
+
+ public void setLinkForm(String linkForm) {
+ this.linkForm = linkForm;
+ }
+
+ public void setLinkConfirmMsg(String linkConfirmMsg) {
+ this.linkConfirmMsg = linkConfirmMsg;
+ }
+
+ public void setLinkImg(String linkImg) {
+ this.linkImg = linkImg;
+ }
+
+ public void setLinkWidth(String linkImgWidth) {
+ this.linkImgWidth = linkImgWidth;
+ }
+
+ public void setLinkHeight(String linkImgHeight) {
+ this.linkImgHeight = linkImgHeight;
+ }
+
+ public void setCopyLink(boolean copyLink) {
+ this.copyLink = copyLink;
+ }
+
+ public void setEditLink(boolean editLink) {
+ this.editLink = editLink;
+ }
+
+ public void setDeleteLink(boolean deleteLink) {
+ this.deleteLink = deleteLink;
+ }
+
+ public String getColumnTitleHtml() {
+ return (columnTitle.length() == 0) ? "&nbsp;" : columnTitle;
+ }
+
+ public String getColumnWidthHtml() {
+ return (columnWidth.length() == 0) ? "" : (" width=" + columnWidth);
+ }
+
+ public String getLinkImgSizeHtml() {
+ return ((nvl(linkImgWidth).length() > 0) ? " width=\"" + linkImgWidth + "\"" : "")
+ + ((nvl(linkImgHeight).length() > 0) ? " height=\"" + linkImgHeight + "\""
+ : "");
+ }
+
+ public boolean isScheduleLink() {
+ return scheduleLink;
+ }
+
+ public void setScheduleLink(boolean scheduleLink) {
+ this.scheduleLink = scheduleLink;
+ }
+
+ public String getColumnId() {
+ return columnId;
+ }
+
+ public void setColumnId(String columnId) {
+ this.columnId = columnId;
+ }
+
+} // SearchResultColumn
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultField.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultField.java
new file mode 100644
index 00000000..a0621553
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultField.java
@@ -0,0 +1,212 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.search;
+
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+
+public class SearchResultField extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private String columnId;
+ private String displayValue = "";
+
+ private String alignment = "Left";
+
+ private String drillDownLink = null;
+
+ private String drillDownImage = null;
+
+ private String confirmationText = null;
+
+
+
+ public String getConfirmationText() {
+ return confirmationText;
+ }
+
+ public void setConfirmationText(String confirmationText) {
+ this.confirmationText = confirmationText;
+ }
+
+ public String getDrillDownImage() {
+ return drillDownImage;
+ }
+
+ public void setDrillDownImage(String drillDownImage) {
+ this.drillDownImage = drillDownImage;
+ }
+
+ public SearchResultField() {
+ }
+
+ public SearchResultField(String displayValue, String linkIdValue,
+ SearchResultColumn column, boolean isAuthorized) {
+ super();
+
+ if (!isAuthorized)
+ return;
+
+ setColumnId(column.getColumnId());
+ setDisplayValue(displayValue);
+ setAlignment(column.getAlignment());
+ if(column.getColumnId().equals("edit")) {
+ setDrillDownLink("report_wizard.htm?action=report.edit&c_master="+linkIdValue);
+ setDrillDownImage(column.getLinkImg());
+ setConfirmationText(null);
+ } else if(column.getColumnId().equals("copy")) {
+ setDrillDownLink("report_wizard.htm?action=report.copy&c_master="+linkIdValue);
+ setDrillDownImage(column.getLinkImg());
+ setConfirmationText(column.getLinkConfirmMsg());
+ } else if(column.getColumnId().equals("delete")) {
+ setDrillDownLink("raptor.htm?action=report.delete&c_master="+linkIdValue);
+ setDrillDownImage(column.getLinkImg());
+ setConfirmationText(column.getLinkConfirmMsg());
+ } else if(column.getColumnId().equals("schedule")) {
+ setDrillDownLink("report_wizard.htm?action=report.schedule.report.submit_wmenu&c_master="+linkIdValue+"&refresh=Y");
+ setDrillDownImage(column.getLinkImg());
+ setConfirmationText(null);
+ } else if(column.getColumnId().equals("run")) {
+ setDrillDownLink("raptor.htm?action=report.run.container&c_master="+linkIdValue+"&refresh=Y");
+ setDrillDownImage(column.getLinkImg());
+ setConfirmationText(null);
+ } else {
+ if (column.getLinkURL() != null) {
+ StringBuffer sb = new StringBuffer();
+
+ if (column.getLinkForm() == null) {
+ sb.append("<a href=\"");
+ sb.append(column.getLinkURL());
+ sb.append(nvl(linkIdValue));
+ if (column.getLinkConfirmMsg() != null) {
+ sb.append(" onClick=\"return confirm('");
+ sb.append(column.getLinkConfirmMsg());
+ sb.append("');\"");
+ }
+ sb.append("\">");
+ if (column.getLinkImg() != null) {
+ sb.append("<img src=\"");
+ sb.append(column.getLinkImg());
+ sb.append("\"");
+ sb.append(column.getLinkImgSizeHtml());
+ sb.append(" border=\"0\"");
+ sb.append(column.getLinkTitle() != null ? " alt=\""
+ + column.getLinkTitle()/*
+ * +(column.isDeleteLink()?"
+ * "+linkIdValue:"")
+ */
+ + "\"" : "");
+ sb.append(">");
+ } else
+ sb.append(column.getLinkTitle());
+ sb.append("</a>");
+ } else {
+ sb.append("<input type=\"");
+ if (column.getLinkImg() != null) {
+ sb.append("image\" src=\"");
+ sb.append(column.getLinkImg());
+ sb.append("\"");
+ sb.append(column.getLinkImgSizeHtml());
+ sb.append(" border=\"0\"");
+ sb.append(column.getLinkTitle() != null ? " alt=\""
+ + column.getLinkTitle()/*
+ * +(column.isDeleteLink()?"
+ * "+linkIdValue:"")
+ */
+ + "\"" : "");
+ } else {
+ sb.append("submit\" value=\"");
+ sb.append(column.getLinkTitle());
+ sb.append("\"");
+ }
+ sb.append(" onClick=\"");
+ if (column.getLinkConfirmMsg() != null) {
+ sb.append("if(! confirm('");
+ sb.append(column.getLinkConfirmMsg());
+ sb.append("')) return false; ");
+ }
+ sb.append(column.getLinkURL());
+ sb.append(" document.");
+ sb.append(column.getLinkForm());
+ sb.append(".");
+ sb.append(AppConstants.RI_REPORT_ID);
+ sb.append(".value='");
+ sb.append(nvl(linkIdValue));
+ sb.append("';");
+ sb.append(" document.");
+ sb.append(column.getLinkForm());
+ sb.append(".");
+ sb.append("refresh");
+ sb.append(".value='");
+ sb.append("Y");
+ sb.append("';\">");
+ } // else
+
+ setDrillDownLink(sb.toString());
+ } // if
+ }
+ } // SearchResultField
+
+ public String getDisplayValue() {
+ return displayValue;
+ }
+
+ public String getAlignment() {
+ return alignment;
+ }
+
+ public String getDrillDownLink() {
+ return drillDownLink;
+ }
+
+ public void setDisplayValue(String displayValue) {
+ this.displayValue = nvl(displayValue);
+ }
+
+ public void setAlignment(String alignment) {
+ this.alignment = alignment;
+ }
+
+ public void setDrillDownLink(String drillDownLink) {
+ this.drillDownLink = drillDownLink;
+ }
+
+ public String getTooltipValue() {
+ return (displayValue.length() == 0) ? "&nbsp;" : displayValue;
+ }
+
+ /*public String getAlignmentHtml() {
+ return (alignment.length() == 0) ? "" : (" align=" + alignment);
+ }*/
+
+ /*public String getDisplayValueLinkHtml() {
+ if (nvl(drillDownLink).length() == 0)
+ return getDisplayValueHtml();
+ else
+ return getDrillDownLink();
+ } // getDisplayValueLinkHtml*/
+
+ public String getColumnId() {
+ return columnId;
+ }
+
+ public void setColumnId(String columnId) {
+ this.columnId = columnId;
+ }
+
+
+} // SearchResultField
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultJSON.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultJSON.java
new file mode 100644
index 00000000..00e18f12
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultJSON.java
@@ -0,0 +1,80 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.search;
+
+import java.util.ArrayList;
+
+public class SearchResultJSON{
+
+ public ArrayList<SearchResultColumn> searchResultColumns = new ArrayList<SearchResultColumn>();
+
+ public ArrayList<SearchResultRow> searchResultRows = new ArrayList<SearchResultRow>();
+
+
+
+
+
+
+ public ArrayList<SearchResultColumn> getSearchResultColumns() {
+ return searchResultColumns;
+ }
+
+ public void setSearchResultColumns(ArrayList<SearchResultColumn> searchResultColumns) {
+ this.searchResultColumns = searchResultColumns;
+ }
+
+ public ArrayList<SearchResultRow> getSearchResultRows() {
+ return searchResultRows;
+ }
+
+ public void setSearchResultRows(ArrayList<SearchResultRow> searchResultRows) {
+ this.searchResultRows = searchResultRows;
+ }
+
+ public void addColumn(SearchResultColumn column) {
+ searchResultColumns.add(column);
+ } // addColumn
+
+ public SearchResultColumn getColumn(int index) {
+ return (SearchResultColumn) searchResultColumns.get(index);
+ } // getColumn
+
+ public int getNumColumns() {
+ return searchResultColumns.size();
+ } // getNumColumns
+
+ public int getNumRows() {
+ return searchResultRows.size();
+ } // getNumRows
+
+ public SearchResultRow getRow(int index) {
+ return (SearchResultRow) searchResultRows.get(index);
+ } // getRow
+
+
+ private String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ private String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+} // SearchResultJSON
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultRow.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultRow.java
new file mode 100644
index 00000000..21fb0254
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultRow.java
@@ -0,0 +1,92 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.search;
+
+import java.util.ArrayList;
+
+class ColumnContent {
+ String columnId;
+ SearchResultField searchresultField;
+
+ public ColumnContent(String columnId, SearchResultField searchresultField) {
+ this.columnId = columnId;
+ this.searchresultField = searchresultField;
+ }
+ public String getColumnId() {
+ return columnId;
+ }
+ public void setColumnId(String columnId) {
+ this.columnId = columnId;
+ }
+ public SearchResultField getSearchresultField() {
+ return searchresultField;
+ }
+ public void setSearchresultField(SearchResultField searchresultField) {
+ this.searchresultField = searchresultField;
+ }
+
+
+
+}
+public class SearchResultRow extends ArrayList {
+
+
+ //private SearchResultField searchresultField;
+ private int nextElemIdx = 0;
+
+ public void resetNext() {
+ resetNext(0);
+ } // resetNext
+
+ public void resetNext(int toPos) {
+ nextElemIdx = toPos;
+ } // resetNext
+
+ public boolean hasNext() {
+ return (nextElemIdx < size());
+ } // hasNext
+
+ public SearchResultField getNext() {
+ return hasNext() ? getSearchResultField(nextElemIdx++) : null;
+ } // getNext
+
+ public SearchResultField getSearchResultField(int idx) {
+ return (SearchResultField) get(idx);
+ } // getRowHeader
+
+ public void addSearchResultField(SearchResultField searchResultField) {
+ add(searchResultField);
+ } // addSearchResultField
+
+ public void addSearchResultField(int idx, SearchResultField searchResultField) {
+ add(idx, searchResultField);
+ } // addSearchResultField
+
+ public void addColumnContent(ColumnContent cc ) {
+
+ add(cc);
+ } // addSearchResultField
+
+ public void addColumnContent(int idx, ColumnContent cc) {
+ add(idx, cc);
+ } // addSearchResultField
+
+
+} // SearchResultRow
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SchedulerUtil.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SchedulerUtil.java
new file mode 100644
index 00000000..d5162cc1
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SchedulerUtil.java
@@ -0,0 +1,369 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.scheduler;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Types;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+
+
+
+
+public class SchedulerUtil {
+
+ private Connection conn = null;
+
+ protected Connection getConnection() {
+ return conn;
+ }
+
+ protected void setConnection(Connection _conn) {
+ conn = _conn;
+ }
+
+ protected Connection init() throws SQLException, ReportSQLException{
+ if(conn != null)
+ return conn;
+ conn = DbUtils.getConnection();
+ return conn;
+ }
+
+ protected void closeConnection() throws SQLException {
+ if(conn != null) conn.close();
+ }
+
+ public void insertOrUpdate(String sql) throws SQLException, ReportSQLException {
+
+ Statement stat = null;
+ try{
+ //conn = getConnection();
+ stat = conn.createStatement();
+ stat.executeUpdate(sql);
+
+ } finally{
+ stat.close();
+ //conn.close();
+ }
+ }
+
+ public void updateBinaryStream(String sql, BigDecimal id, InputStream is, int size) throws SQLException, ReportSQLException, IOException {
+
+ // cludge hack for oracle databases
+ if(conn.getMetaData().getDatabaseProductName().toLowerCase().contains("oracle")) {
+/* updateBlob(sql,id,is,size);
+*/ throw new ReportSQLException("only maria db support for this ");
+
+ }
+
+ PreparedStatement stat = null;
+ try {
+ stat = conn.prepareStatement(sql);
+ stat.setBigDecimal(2, id);
+ stat.setBinaryStream(1, is, size);
+ stat.executeUpdate();
+
+ } finally{
+ stat.close();
+ }
+
+ }
+
+ /*public void updateBlob(String sql, BigDecimal id, InputStream is, int size) throws SQLException, ReportSQLException, IOException {
+ PreparedStatement stat = null;
+ OutputStream out = null;
+ BLOB blob = null;
+ try {
+ stat = conn.prepareStatement(sql);
+ blob = BLOB.createTemporary(conn,false, BLOB.DURATION_SESSION);
+ out = blob.getBinaryOutputStream();
+
+ int read;
+ while((read = is.read()) != -1) {
+ out.write(read);
+ }
+ out.flush();
+
+ stat.setBigDecimal(2, id);
+ stat.setBlob(1, blob);
+ stat.executeUpdate();
+
+ }
+ catch (SQLException sqL) {
+ sqL.printStackTrace();
+ }
+ finally{
+ out.close();
+ stat.close();
+ }
+
+ }*/
+
+
+ public void insertOrUpdateWithPrepared(String sql, List<Object> params, List<Integer> types) throws SQLException, ReportSQLException {
+
+ PreparedStatement stat = null;
+ try{
+ //conn = getConnection();
+ stat = conn.prepareStatement(sql);
+ conn.getMetaData();
+ int i2;
+ int paramLength = params.size();
+ for(int i = 0 ; i< paramLength ; i++) {
+ i2 = i+1;
+ Object param = params.get(i);
+ int type = types.get(i);
+
+ if(param.equals("NULL")) {
+ stat.setNull(i2, type);
+ }
+ else if(type == Types.VARCHAR) {
+ stat.setString(i2, (String)param);
+ }
+ else if(type == Types.INTEGER) {
+ stat.setInt(i2, (Integer)param);
+ }
+ else if(type == Types.NUMERIC) {
+ stat.setLong(i2, (Long)param);
+ }
+ else if(type == Types.DOUBLE) {
+ stat.setDouble(i2, (Double)param);
+ }
+ else if(type == Types.DATE) {
+ stat.setDate(i2, (java.sql.Date)param);
+ }
+ else if(type == Types.TIMESTAMP) {
+ stat.setTimestamp(i2, (java.sql.Timestamp)param);
+ }
+ else if(type == Types.BIGINT) {
+ stat.setBigDecimal(i2, (BigDecimal)param);
+ }
+ else
+ throw new SQLException("Unidentified Object; Please contact admin and have this method updated with the current object type");
+
+ }
+
+ stat.executeUpdate();
+
+ } finally{
+ stat.close();
+ //conn.close();
+ }
+ }
+
+
+ public Object getSingleResult(String sql, String fieldname) throws SQLException, ReportSQLException{
+
+ Statement stat = null;
+ ResultSet rs = null;
+ Object o=null;
+ try{
+ //conn = getConnection();
+ stat = conn.createStatement();
+ rs = stat.executeQuery(sql);
+
+ while (rs.next()) {
+ o = rs.getObject(fieldname);
+ }
+ }
+ catch(SQLException sqlE){
+ sqlE.printStackTrace();
+ }
+
+ finally{
+ if(rs!=null)
+ rs.close();
+ if(stat!=null)
+ stat.close();
+ //conn.close();
+ }
+ return o;
+ }
+
+ public InputStream getDBStream(String sql, String fieldname) throws SQLException, ReportSQLException, IOException{
+
+ // cludge hack for oracle databases
+ if(conn.getMetaData().getDatabaseProductName().toLowerCase().contains("oracle")) {
+ /*return getDBBlob(sql,fieldname);*/
+ throw new ReportSQLException("only maria db support for this ");
+
+ }
+
+
+ Statement stat = null;
+ ResultSet rs = null;
+ InputStream o=null;
+ try{
+ //conn = getConnection();
+ stat = conn.createStatement();
+ rs = stat.executeQuery(sql);
+
+ while (rs.next()) {
+ o = rs.getBinaryStream(fieldname);
+ }
+ }
+ catch(SQLException sqlE){
+ sqlE.printStackTrace();
+ }
+
+ finally{
+ if(rs!=null)
+ rs.close();
+ if(stat!=null)
+ stat.close();
+ //conn.close();
+ }
+ return o;
+ }
+
+ /*public InputStream getDBBlob(String sql, String fieldname) throws SQLException, ReportSQLException, IOException{
+
+
+ Statement stat = null;
+ ResultSet rs = null;
+ BLOB blob=null;
+ ByteArrayInputStream in = null;
+ try{
+ stat = conn.createStatement();
+ rs = stat.executeQuery(sql);
+
+ if (rs.next()) {
+ blob = ((OracleResultSet) rs).getBLOB(fieldname);
+ in = new ByteArrayInputStream(blob.getBytes(1,(int)blob.length()));
+
+ }
+ }
+ catch(SQLException sqlE){
+ sqlE.printStackTrace();
+ }
+
+ finally{
+ if(rs!=null)
+ rs.close();
+ if(stat!=null)
+ stat.close();
+ //conn.close();
+ }
+ return in;
+ }
+ */
+
+ public void getAndExecute(String sql, Executor executor) throws SQLException, ReportSQLException{
+ //Connection conn = getConnection();
+ Statement stat = conn.createStatement();
+ ResultSet rs = stat.executeQuery(sql);
+
+
+ while (rs.next()) {
+ executor.execute(rs);
+ }
+
+ if(rs!=null)
+ rs.close();
+ if(stat!=null)
+ stat.close();
+ //conn.close();
+ }
+
+ interface Executor{
+ public void execute(ResultSet rs) throws SQLException;
+ }
+
+
+
+
+
+
+ public static Date trunc_hour(Date v_date) {
+
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(v_date);
+ calendar.set(Calendar.MILLISECOND, 0);
+ calendar.set(Calendar.SECOND, 0);
+ calendar.set(Calendar.MINUTE, 0);
+ return calendar.getTime();
+ }
+
+ public static Date add_hours(Date v_date, int i) {
+
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(v_date);
+ cal.add(Calendar.HOUR, i);
+ return cal.getTime();
+ }
+
+ public static Date add_months(Date v_date, int i) {
+
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(v_date);
+ cal.add(Calendar.MONTH, i);
+ return cal.getTime();
+ }
+
+ public static Date add_days(Date v_date, int i) {
+
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(v_date);
+ cal.add(Calendar.DATE, i);
+ return cal.getTime();
+ }
+
+ public static Date to_date(String input, String format) {
+
+ Date date = null;
+ try {
+ date = new SimpleDateFormat(format, Locale.ENGLISH).parse(input);
+ } catch (Exception e) {
+ }
+ return date;
+ }
+
+ public static String to_date_str(Date input, String format) {
+
+ String date = null;
+ try {
+ date = new SimpleDateFormat(format, Locale.ENGLISH).format(input);
+ } catch (Exception e) {
+ }
+ return date;
+ }
+
+ public static String[] cr_dissecturl(String formfields, String delimiter){
+ if(formfields == null || formfields.isEmpty())
+ return new String[]{};
+ return formfields.split("&");
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SendEmail.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SendEmail.java
new file mode 100644
index 00000000..6f51cee4
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SendEmail.java
@@ -0,0 +1,415 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.scheduler;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.scheduler.SchedulerUtil.Executor;
+import org.openecomp.portalsdk.analytics.system.Globals;
+
+
+
+public class SendEmail {
+
+SchedulerUtil schedulerUtil;
+
+ public SendEmail() {
+
+ }
+
+
+ public void sendEmail( String p_mail_server, String p_sender, String p_subject, String p_mail_text, String p_url, int p_file_type, int p_schedule_id, int p_time_interval, boolean p_send_attachment, int connectionTimeout) throws SQLException, ReportSQLException{
+
+ String allEmailAddr = "";
+ final List<String> emailArr = new ArrayList<String>();
+ //int count1 = 0;
+ String schedular_email;
+
+
+ schedular_email = (String) schedulerUtil.getSingleResult("select email from fn_user au, cr_report_schedule crs where CRS.SCHED_USER_ID = AU.USER_ID and CRS.SCHEDULE_ID = "+ p_schedule_id, "email");
+
+
+ String sql=Globals.getSchedulerUserEmails().replace("[p_schedule_id]", p_schedule_id+"");
+ schedulerUtil.getAndExecute(sql, new Executor() {
+
+ @Override
+ public void execute(ResultSet rs) throws SQLException {
+
+ emailArr.add(rs.getString("email"));
+ // count1 = count1 + 1
+ }
+
+ });
+
+ if (!p_send_attachment) {
+ http_to_blob(p_url, p_file_type, p_schedule_id, connectionTimeout);
+ }
+
+ int i = 0;
+ for (String email : emailArr) {
+ /* If the email address is invalid ignore that email address */
+ if (email.contains("@")) {
+
+ if (i == 0)
+ allEmailAddr = email;
+ else
+ allEmailAddr += ',' + email;
+
+ i++;
+ }
+ }
+
+ /*List<MailAttachment> mailAttachments = null;
+
+ if (p_file_type > 1 && p_send_attachment) {
+ mailAttachments = add_attachment(p_url, p_file_type, p_schedule_id, connectionTimeout);
+ }
+ AppUtils.notifyWithAttachments(p_mail_text, emailArr.toArray(new String[emailArr.size()]), p_sender, p_subject, new String[] { schedular_email }, null, mailAttachments, true);
+ */
+ }
+
+ class HistRec {
+
+ String file_blob;
+ BigDecimal rep_id;
+ BigDecimal hist_id;
+ String file_name;
+ int sched_user_id;
+ String recurrence;
+ int file_size = 0;
+ String raptor_url;
+ int schedule_id;
+ int file_type_id;
+ int user_id;
+ String deleted_yn;
+ }
+
+
+ private HistRec http_to_blob(String p_url, int v_file_type, int p_schedule_id, int connectionTimeout) throws SQLException , ReportSQLException{
+
+
+ final HistRec v_hist_rec = initializeVHistoryRecord(p_url, v_file_type, p_schedule_id);
+ HttpURLConnection con = null;
+ try {
+ URL url = new URL(p_url);
+ con = (HttpURLConnection) url.openConnection();
+ con.setConnectTimeout(connectionTimeout*1000);
+ con.setRequestMethod("GET");
+ schedulerUtil.insertOrUpdate("INSERT INTO cr_filehist_log (SCHEDULE_ID, url, notes, run_time) VALUES ("+ p_schedule_id +",'" + p_url+ "','http_to_blob: Initiated HTTP request', " + Globals.getCurrentDateString() + " )");
+ int responseCode = con.getResponseCode();
+ String outputFolder = Globals.getProjectFolder() + java.io.File.separator + Globals.getOutputFolder();
+ String fileName = v_hist_rec.file_name;
+ createFile(con, outputFolder, fileName);
+
+ File readFile = new File(outputFolder + java.io.File.separator + fileName);
+ // need to revist this conversion; may not be safe for large file sizes
+ v_hist_rec.file_size = (int)readFile.length();
+
+ schedulerUtil.insertOrUpdate("insert into cr_schedule_activity_log (SCHEDULE_ID, url, notes, run_time) values (" + p_schedule_id + ",'" + p_url +"', 'http_to_blob: http response recieved. Code " + responseCode + "', " + Globals.getCurrentDateString() + " )");
+
+ //v_hist_rec.file_blob = response.toString();
+ //v_hist_rec.file_size = v_hist_rec.file_blob.length();
+
+ List<Object> params = new ArrayList<Object>();
+ List<Integer> types = new ArrayList<Integer>();
+ prepareHisRecUpdate(v_hist_rec, params, types);
+
+ schedulerUtil
+ .insertOrUpdateWithPrepared("INSERT INTO cr_report_file_history(HIST_ID, SCHED_USER_ID, SCHEDULE_ID, USER_ID, REP_ID, RUN_DATE, RECURRENCE, FILE_TYPE_ID, FILE_NAME, FILE_SIZE, RAPTOR_URL, ERROR_YN, ERROR_CODE, DELETED_YN, DELETED_BY)"
+ + " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
+ params, types
+ );
+
+ FileInputStream fileStream = new FileInputStream(readFile);
+ schedulerUtil.updateBinaryStream("update cr_report_file_history set file_blob = ? where hist_id = ?", v_hist_rec.hist_id, fileStream, v_hist_rec.file_size);
+ fileStream.close();
+
+ String userAddRecSql =
+ Globals.getSchedulerUserEmails().replace("[p_schedule_id]", p_schedule_id+"");
+
+ schedulerUtil.getAndExecute(userAddRecSql, new Executor() {
+
+ @Override
+ public void execute(ResultSet rs) throws SQLException {
+
+ try {
+ schedulerUtil.insertOrUpdate("INSERT INTO CR_HIST_USER_MAP (HIST_ID, USER_ID) values ( " + v_hist_rec.hist_id + "," + rs.getInt("user_id") + ")");
+ } catch (ReportSQLException e) {
+ throw new SQLException(e.getMessage());
+ }
+ }
+
+ });
+
+ schedulerUtil.insertOrUpdate("insert into cr_schedule_activity_log (SCHEDULE_ID, url, notes, run_time) values (" + p_schedule_id + ",'" + p_url + "','Success: http_to_blob', " + Globals.getCurrentDateString() + " )");
+
+
+ } catch (Exception e) {
+ schedulerUtil.insertOrUpdate("insert into cr_schedule_activity_log (SCHEDULE_ID, url, notes, run_time) values (" + p_schedule_id + ",'" + p_url + "', 'Failure: http_to_blob : Exception" + e.getMessage() +"', " + Globals.getCurrentDateString() + " )");
+ e.printStackTrace();
+ } finally {
+ if(con != null)
+ con.disconnect();
+ }
+ return v_hist_rec;
+
+ }
+
+
+ protected void prepareHisRecUpdate(final HistRec v_hist_rec, List<Object> params,
+ List<Integer> types) {
+ params.add( v_hist_rec.hist_id);
+ types.add(Types.BIGINT);
+ params.add( v_hist_rec.sched_user_id);
+ types.add(Types.INTEGER);
+ params.add( v_hist_rec.schedule_id);
+ types.add(Types.INTEGER);
+ params.add( v_hist_rec.user_id);
+ types.add(Types.INTEGER);
+ params.add( v_hist_rec.rep_id);
+ types.add(Types.BIGINT);
+ params.add( new java.sql.Date(Calendar.getInstance().getTime().getTime()));
+ types.add(Types.DATE);
+ params.add( v_hist_rec.recurrence);
+ types.add(Types.VARCHAR);
+ params.add( v_hist_rec.file_type_id);
+ types.add(Types.INTEGER);
+ params.add( v_hist_rec.file_name);
+ types.add(Types.VARCHAR);
+ params.add( v_hist_rec.file_size);
+ types.add(Types.INTEGER);
+ params.add( v_hist_rec.raptor_url);
+ types.add(Types.VARCHAR);
+ params.add( "N");
+ types.add(Types.VARCHAR);
+ params.add( "NULL");
+ types.add(Types.INTEGER);
+ params.add( v_hist_rec.deleted_yn);
+ types.add(Types.VARCHAR);
+ params.add(v_hist_rec.sched_user_id );
+ types.add(Types.INTEGER);
+ }
+
+
+ protected HistRec initializeVHistoryRecord(String p_url, int v_file_type,
+ int p_schedule_id) throws SQLException,
+ ReportSQLException {
+
+ final HistRec v_hist_rec = new HistRec();
+
+ v_hist_rec.rep_id = (BigDecimal) schedulerUtil.getSingleResult("SELECT rep_id FROM cr_report_schedule WHERE schedule_id =" + p_schedule_id, "rep_id");
+
+ Object sequenceId = schedulerUtil.getSingleResult(Globals.getSequenceNextVal().replace("[sequenceName]", "seq_cr_report_file_history"),"ID");
+
+ if(sequenceId instanceof Long)
+ v_hist_rec.hist_id = new BigDecimal((Long)sequenceId);
+ else if(sequenceId instanceof BigDecimal)
+ v_hist_rec.hist_id = (BigDecimal)sequenceId;
+
+ v_hist_rec.file_name = (String) schedulerUtil.getSingleResult("select translate(title||to_char( "+ Globals.getCurrentDateString() + ",'MM-dd-yyyyHH24:mm:ss'), "
+ + "'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'||'():;.-`~^\\|'||chr(34)||chr(39)||chr(9)||' ', "
+ + "'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')|| "+ v_hist_rec.hist_id +" as title FROM cr_report WHERE rep_id = "+v_hist_rec.rep_id, "title");
+
+
+ class File {
+
+ String file_name;
+ String file_ext;
+ }
+ final File file = new File();
+ schedulerUtil.getAndExecute("select template_file from cr_report_template_map where report_id = " + v_hist_rec.rep_id, new Executor() {
+
+ @Override
+ public void execute(ResultSet rs) throws SQLException {
+
+ file.file_name = rs.getString("template_file");
+ file.file_ext = file.file_name.substring(file.file_name.indexOf('.'));
+
+ }
+ });
+
+ if (v_file_type == 2) {
+ v_hist_rec.file_name = v_hist_rec.file_name + ".pdf";
+
+ } else if (v_file_type == 4) {
+ v_hist_rec.file_name = v_hist_rec.file_name + ".xls";
+
+ } else if (v_file_type == 5) {
+ if (file.file_name != null && file.file_ext.length() > 0) {
+ v_hist_rec.file_name = v_hist_rec.file_name + file.file_ext;
+ } else {
+ v_hist_rec.file_name = v_hist_rec.file_name + ".xlsx";
+ }
+ } else if (v_file_type == 3) {
+ v_hist_rec.file_name = v_hist_rec.file_name + ".csv";
+
+ }
+
+
+ schedulerUtil.getAndExecute("select sched_user_id, rep_id, recurrence from cr_report_schedule where schedule_id="+p_schedule_id, new Executor() {
+
+ @Override
+ public void execute(ResultSet rs) throws SQLException {
+ v_hist_rec.sched_user_id = rs.getInt("sched_user_id");
+ v_hist_rec.rep_id = rs.getBigDecimal("rep_id");
+ v_hist_rec.recurrence = rs.getString("recurrence");
+ }
+ });
+
+
+ v_hist_rec.file_size = 0;
+ v_hist_rec.raptor_url = p_url;
+ v_hist_rec.schedule_id = p_schedule_id;
+ v_hist_rec.file_type_id = v_file_type;
+ v_hist_rec.user_id = v_hist_rec.sched_user_id;
+ v_hist_rec.deleted_yn = "N";
+
+ return v_hist_rec;
+ }
+
+
+
+ /*private List<MailAttachment> add_attachment(String p_url, int v_file_type, int p_schedule_id, int connectionTimeout) throws SQLException,ReportSQLException{
+
+
+ List<MailAttachment> mailAttachmentList = new ArrayList<MailAttachment>();
+ final HistRec vHistRec = initializeVHistoryRecord(p_url, v_file_type, p_schedule_id);
+
+ /*
+ refer to http_to_blob for more details
+
+ String v_content_type;
+ String v_content_disposition;
+ int transfer_timeout_limit = 1800;
+ String v_title;
+
+ if (v_file_type == 2) {
+ v_content_type = "application/pdf";
+ v_content_disposition ="inline; filename=\""+v_title+".pdf\"";
+
+ }else if(v_file_type == 4){
+ v_content_type = "application/excel";
+ v_content_disposition ="inline; filename=\""+v_title+".xls\"";
+
+ }else if(v_file_type == 5){
+ v_content_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+
+ if (file.file_ext != null && file.file_ext.length() > 0) {
+ v_content_disposition ="inline; filename=\""+v_title+ file.file_ext+"\"";
+ if (".xlsm".equals(file.file_ext)) {
+ v_content_type = "application/vnd.ms-excel.sheet.macroEnabled.12";
+ }
+ } else {
+ v_content_disposition ="inline; filename=\""+v_title+".xlsx\"";
+ };
+ }else if(v_file_type == 3){
+ v_content_type = "application/csv";
+ v_content_disposition ="inline; filename=\""+v_title+".csv\"";
+
+ }
+ * ... /
+ HttpURLConnection con = null;
+ try {
+ URL url = new URL(p_url);
+ con = (HttpURLConnection) url.openConnection();
+ con.setConnectTimeout(connectionTimeout*1000);
+ con.setRequestMethod("GET");
+ schedulerUtil.insertOrUpdate("insert into cr_schedule_activity_log (SCHEDULE_ID, url, notes, run_time) values (" + p_schedule_id + ",'"+ p_url +"', 'Success: http request began.', " + Globals.getCurrentDateString() + " )");
+ int responseCode = con.getResponseCode();
+
+ String outputFolder = Globals.getProjectFolder() + java.io.File.separator + Globals.getOutputFolder();
+ String fileName = vHistRec.file_name;
+ createFile(con, outputFolder, fileName);
+
+ MailAttachment mailAttachment = new MailAttachment();
+ mailAttachment.setAttachmentType(MailAttachment.FILE_ATTACHMENT);
+ mailAttachment.setFilePathName(outputFolder);
+ mailAttachment.setFileName(fileName);
+ mailAttachmentList.add(mailAttachment);
+
+ schedulerUtil.insertOrUpdate("insert into cr_schedule_activity_log (SCHEDULE_ID, url, notes, run_time) values (" + p_schedule_id + ",'" + p_url +"', 'Success: http response recieved. Code " + responseCode + "', " + Globals.getCurrentDateString() + " )");
+
+ schedulerUtil.insertOrUpdate("insert into cr_schedule_activity_log (SCHEDULE_ID, url, notes, run_time) values (" + p_schedule_id + ",'" + p_url + "','Success: added attachment', " + Globals.getCurrentDateString() + " )");
+
+ } catch (Exception e) {
+ schedulerUtil.insertOrUpdate("insert into cr_schedule_activity_log (SCHEDULE_ID, url, notes, run_time) values (" + p_schedule_id + ",'" + p_url + "', 'Failure: adding attachment : Exception" + e.getMessage() +"', " + Globals.getCurrentDateString() + " )");
+ e.printStackTrace();
+ } finally {
+ if(con != null)
+ con.disconnect();
+ }
+
+
+ return mailAttachmentList;
+ }*/
+
+
+ void createFile(HttpURLConnection con, String outputFolder, String fileName)
+ throws IOException, FileNotFoundException {
+ //BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
+ InputStream in = con.getInputStream();
+
+ try {
+
+ FileOutputStream out = new FileOutputStream(outputFolder + java.io.File.separator + fileName );
+ try {
+ int inputLine;
+
+ while ((inputLine = in.read()) != -1) {
+ out.write(inputLine);
+ }
+ out.flush();
+ }
+ finally {
+ out.close();
+ }
+
+ }
+ finally {
+ in.close();
+ }
+ }
+
+
+ public SchedulerUtil getSchedulerUtil() {
+ return schedulerUtil;
+ }
+
+
+ public void setSchedulerUtil(SchedulerUtil schedulerUtil) {
+ this.schedulerUtil = schedulerUtil;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SendNotifications.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SendNotifications.java
new file mode 100644
index 00000000..40adbee4
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SendNotifications.java
@@ -0,0 +1,460 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.scheduler;
+
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.UUID;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.scheduler.SchedulerUtil.Executor;
+import org.openecomp.portalsdk.analytics.system.Globals;
+
+public class SendNotifications {
+
+ SchedulerUtil schedulerUtil;
+ public SendEmail sendEmail;
+
+ public SendNotifications() throws Exception {
+ schedulerUtil = new SchedulerUtil();
+ sendEmail = new SendEmail();
+ sendEmail.setSchedulerUtil(schedulerUtil);
+ init();
+ }
+
+
+ public void deInit() throws SQLException {
+ schedulerUtil.closeConnection();
+ }
+
+ public void init() throws SQLException, ReportSQLException {
+ schedulerUtil.init();
+ }
+
+ public void send_notification(String p_mail_server, String p_sender, String p_system_name, String p_system_url, int connectionTimeout) throws RaptorException, Exception {
+
+ System.out.println(p_mail_server + " " + p_sender + " " + p_system_name + " " + p_system_url);
+ int p_time_interval = Globals.getSchedulerInterval();
+ int v_num_recs = 0;
+ String v_gen_key;
+ BigDecimal v_id = null;
+ String v_url;
+ String v_r_action = "report.download.pdf";
+ String v_email_msg;
+ String v_formfields;
+ // String error_m;
+ // int transfer_timeout_limit = 1800;
+ // boolean v_attach_email_yn = true;
+ int v_schedule_id;
+ Date v_touch_date;
+ // Exception for_rec;
+
+ Connection conn = schedulerUtil.getConnection();
+ Statement stat = conn.createStatement();
+
+ String CNotificationsql =
+ /*
+ "SELECT x.rep_id, x.schedule_id, x.conditional_yn, x.condition_large_sql, x.notify_type, x.max_row, x.initial_formfields, x.processed_formfields, r.title, x.user_id "
+ + "FROM ("
+ + "SELECT rs.rep_id, rs.schedule_id, rs.sched_user_id user_id, rs.conditional_yn, rs.condition_large_sql, "
+ + "rs.notify_type, rs.max_row, rs.initial_formfields, rs.processed_formfields "
+ + "FROM cr_report_schedule rs "
+ + "WHERE rs.enabled_yn='Y' "
+ + "AND rs.start_"
+ + "date <= sysdate "
+ + "AND (rs.end_date >= sysdate or rs.end_date is null ) "
+ + "AND rs.run_date IS NOT NULL "
+ + ") x, cr_report r "
+ + "WHERE x.rep_id = r.rep_id ";
+ */
+
+ Globals.getAvailableSchedules().replace("[currentDate]", Globals.getCurrentDateString());
+
+
+ ResultSet rs = stat.executeQuery(CNotificationsql);
+
+ while (rs.next()) {
+
+ v_schedule_id = rs.getInt("schedule_id");
+ int offset = get_report_sched_offset(rs.getInt("rep_id"), v_schedule_id);
+
+ if(offset >= p_time_interval) continue;
+
+
+ v_touch_date = (Date) schedulerUtil.getSingleResult("select touch_date from cr_report_email_sent_log where schedule_id = " + v_schedule_id + " and log_id = (select max(log_id) from cr_report_email_sent_log where schedule_id = " + v_schedule_id + ")", "touch_date");
+ if (v_touch_date != null) {
+ if (Math.abs(System.currentTimeMillis() - v_touch_date.getTime()) /1000 < (p_time_interval - 1)) {
+ return;
+ }
+ }
+
+ if ("Y".equals(rs.getString("conditional_yn"))) {
+
+ v_num_recs = (Integer) schedulerUtil.getSingleResult("select count(*) count from (" + rs.getString("condition_large_sql") + " )", "count");
+ }
+
+ if (v_num_recs > 0 || "N".equals(rs.getString("conditional_yn"))) {
+
+ v_gen_key = ("Z" + UUID.randomUUID()).toString().substring(0,24); // 25 character string
+ Object sequenceId = schedulerUtil.getSingleResult(Globals.getSequenceNextVal().replace("[sequenceName]", "seq_email_sent_log_id"), "id");
+
+ if(sequenceId instanceof Long)
+ v_id = new BigDecimal((Long)sequenceId);
+ else if(sequenceId instanceof BigDecimal)
+ v_id = (BigDecimal)sequenceId;
+
+ schedulerUtil.insertOrUpdate("insert into cr_report_email_sent_log (log_id, gen_key, schedule_id, rep_id, user_id, touch_date) values (" + v_id + ",'" + v_gen_key + "'," + rs.getInt("schedule_id") + "," + rs.getInt("rep_id") + "," + rs.getInt("user_id") + ", " + Globals.getCurrentDateString() + " )");
+
+ int notify_type = rs.getInt("notify_type");
+ if (notify_type == 4)
+ v_r_action = "report.download";
+ else if (notify_type == 2)
+ v_r_action = "report.download.pdf";
+ else if (notify_type == 3)
+ v_r_action = "report.csv.download";
+ else if (notify_type == 5)
+ v_r_action = "report.download.excel2007";
+ else if (notify_type == 6)
+ v_r_action = "download.all";
+
+ if (rs.getObject("processed_formfields") != null)
+ v_formfields = modify_formfields(v_schedule_id, rs.getString("processed_formFields"));
+ else
+ v_formfields = strip_formfields(v_schedule_id, rs.getString("initial_formfields"));
+
+ v_url = p_system_url + "&r_action=" + v_r_action + "&log_id=" + v_id + "&user_id=" + rs.getString("user_id") + "&pdfAttachmentKey=" + v_gen_key + "&download_limit=" + rs.getInt("max_row") + v_formfields;
+
+ boolean v_attach_email_yn = shouldSendAttachmentInEmail(v_schedule_id);
+
+ v_email_msg = "<html><body><p><b><u><i>" + p_system_name + " System Notification</i></u></b></p>" + "<p>Report <b>" + rs.getString("title") + "</b> is available for viewing.</p><p>You can view the report if it is attached. </br>"
+ + "If it is not attached, or you have problem to open it, you can log into Business Direct and run the report.</p>" + "</body></html>";
+
+ if (rs.getInt("notify_type") != 6) {
+
+ sendEmail.sendEmail(p_mail_server, p_sender, p_system_name + " System Notification: Report " + rs.getString("title") + " generated", v_email_msg, v_url, rs.getInt("notify_type"), v_schedule_id, p_time_interval, v_attach_email_yn,connectionTimeout);
+
+ } else {
+
+ // may not necessary
+ schedulerUtil.insertOrUpdate("insert into cr_schedule_activity_log (SCHEDULE_ID, url, notes, run_time) values (" + v_schedule_id + ",'" + v_url + "'," + "'Success: http request began.', " + Globals.getCurrentDateString() + " )");
+ schedulerUtil.insertOrUpdate("insert into cr_schedule_activity_log (SCHEDULE_ID, url, notes, run_time) values (" + v_schedule_id + ",'" + v_url + "'," + "'Success: http response recieved. Code resp.status_code '' desc '' resp.reason_phrase', " + Globals.getCurrentDateString() + " )");
+
+ }
+
+ schedulerUtil.insertOrUpdate("update cr_report_schedule set run_date = " + Globals.getCurrentDateString() +" where schedule_id=" + v_schedule_id);
+
+ schedulerUtil.insertOrUpdate("update cr_report_email_sent_log set sent_date= " + Globals.getCurrentDateString() +" , access_flag='N' where log_id=" + v_id);
+ schedulerUtil.insertOrUpdate("insert into cr_schedule_activity_log (SCHEDULE_ID, url, notes, run_time) values (" + v_schedule_id + ",'" + v_url + "','Success: Email Sent', " + Globals.getCurrentDateString() + " )");
+
+ }
+
+ }
+
+ if(rs!=null)
+ rs.close();
+ if(stat!=null)
+ stat.close();
+ //conn.close();
+
+ }
+
+ private boolean shouldSendAttachmentInEmail(int v_schedule_id) throws SQLException, ReportSQLException {
+
+ String l_boolean = (String) schedulerUtil.getSingleResult("SELECT ATTACHMENT_YN from cr_report_schedule where schedule_id = " + v_schedule_id, "ATTACHMENT_YN");
+ if ("Y".equals(l_boolean))
+ return true;
+ return false;
+ }
+
+ private String strip_formfields(int v_schedule_id, String p_formfields) throws SQLException, ReportSQLException {
+
+ String v_formfields_insert = "";
+ String v_formfields_generate = "";
+ String v_name = "";
+ String v_value = "";
+
+
+ String[] column_values = schedulerUtil.cr_dissecturl(p_formfields, "&");
+
+ for(String column_value : column_values){
+ if(column_value == null || column_value.isEmpty())
+ continue;
+
+ v_name = column_value.substring(0, column_value.indexOf('='));
+ v_formfields_insert += column_value + "&";
+ v_value = column_value.substring(column_value.indexOf('=') + 1);
+ if (column_value.indexOf("_auto") > 0) {
+ v_formfields_generate = v_formfields_generate + v_name.substring(0, v_name.indexOf("_auto")) + "=" + v_value + "&";
+ } else {
+ v_formfields_generate = v_formfields_generate + column_value + "&";
+ }
+ }
+
+ schedulerUtil.insertOrUpdate("update CR_REPORT_SCHEDULE set processed_formfields ='" + v_formfields_insert + "' where schedule_id = " + v_schedule_id);
+
+ return v_formfields_generate.substring(0, v_formfields_generate.length());
+
+ }
+
+ private String modify_formfields(int v_schedule_id, String p_formfields) throws SQLException, ReportSQLException {
+
+ class Result {
+
+ String v_formfields_insert = "";
+ String v_formfields_generate = "";
+ String v_name = "";
+ String v_value = "";
+ Date v_date;
+ String v_hour = "";
+ String v_hour_value = "";
+ }
+
+ final Result result = new Result();
+
+ final String v_recurrence = (String) schedulerUtil.getSingleResult("select recurrence from cr_report_schedule where schedule_id = " + v_schedule_id, "recurrence");
+
+ String[] column_values = schedulerUtil.cr_dissecturl(p_formfields, "&");
+
+ for(String column_value : column_values){
+ if (column_value == null)
+ column_value = "";
+
+ if ("MONTHLY".equals(v_recurrence)) {
+ if (column_value.indexOf("_auto") > 0) {
+ result.v_name = column_value.substring(0, column_value.indexOf('='));
+ result.v_date = schedulerUtil.to_date(column_value.substring(column_value.indexOf('=') + 1), "mm/dd/yyyy");
+ result.v_value = schedulerUtil.add_months(result.v_date, 1).toString();
+
+ if (result.v_name.length() > 0) {
+ result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value + "&";
+ result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value + "&";
+ }
+ } else {
+ result.v_formfields_insert = result.v_formfields_insert + column_value + "&";
+ result.v_formfields_generate = result.v_formfields_generate + column_value + "&";
+ }
+
+ } else if ("DAILY".equals(v_recurrence)) {
+ if (column_value.indexOf("_auto") > 0) {
+ result.v_name = column_value.substring(0, column_value.indexOf('='));
+ result.v_date = schedulerUtil.to_date(column_value.substring(column_value.indexOf('=') + 1), "mm/dd/yyyy");
+ result.v_value = schedulerUtil.add_months(result.v_date, 1).toString();
+
+ if (result.v_name.length() > 0) {
+ result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value + "&";
+ result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value + "&";
+ }
+ } else {
+ result.v_formfields_insert = result.v_formfields_insert + column_value + "&";
+ result.v_formfields_generate = result.v_formfields_generate + column_value + "&";
+ }
+
+ } else if ("DAILY_MO_FR".equals(v_recurrence)) {
+ if (column_value.indexOf("_auto") > 0) {
+ result.v_name = column_value.substring(0, column_value.indexOf('='));
+ result.v_date = schedulerUtil.to_date(column_value.substring(column_value.indexOf('=') + 1), "mm/dd/yyyy");
+ SimpleDateFormat sdf = new SimpleDateFormat("EEE");
+ sdf.format(result.v_date);
+ if ("FRI".equals(result.v_date.toString())) {
+ result.v_date = schedulerUtil.add_days(result.v_date, 3);
+ } else if ("SAT".equals(result.v_date.toString())) {
+ result.v_date = schedulerUtil.add_days(result.v_date, 2);
+ } else {
+ result.v_date = schedulerUtil.add_days(result.v_date, 1);
+ }
+ result.v_value = result.v_date.toString();
+ if (result.v_name.length() > 0) {
+ result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value + "&";
+ result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value + "&";
+ }
+
+ } else {
+ result.v_formfields_insert = result.v_formfields_insert + column_value + "&";
+ result.v_formfields_generate = result.v_formfields_generate + column_value + "&";
+ }
+
+ } else if ("HOURLY".equals(v_recurrence)) {
+
+ result.v_name = column_value.indexOf('=')>0?column_value.substring(0, column_value.indexOf('=')) : "";
+ if (column_value.indexOf("_auto") > 0) {
+
+
+ String[] column_values2 = schedulerUtil.cr_dissecturl(p_formfields, "&");
+
+ for(String column_value2 : column_values2){
+
+ String key = column_value2.substring(0, column_value2.indexOf("="));
+ if(key.equals(result.v_name.substring(0, result.v_name.indexOf("_auto"))) || key.equals(result.v_name.substring(0, result.v_name.indexOf("_Hr")))){
+ result.v_hour = column_value2;
+ }
+ }
+
+// schedulerUtil.getAndExecute("select c.column_value from table(CR_DISSECTURL(p_formfields)) c where substr(c.column_value, 1, instr(c.column_value, '=')-1) = substr(" + result.v_name + ",1,instr(" + result.v_name + ",'_auto')-1)||'_Hr'", new Executor() {
+//
+// @Override
+// public void execute(ResultSet rs) throws SQLException {
+//
+// result.v_hour = rs.getString("column_value");
+// }
+//
+// });
+
+ if (result.v_hour.length() > 0) {
+ result.v_hour_value = result.v_hour.substring(result.v_hour.indexOf('=') + 1);
+ }
+
+ result.v_date = schedulerUtil.to_date(column_value.substring(column_value.indexOf('=') + 1) + " " + result.v_hour_value, "mm/dd/yyyy HH24:MI:SS");
+
+ result.v_value = schedulerUtil.to_date_str(schedulerUtil.add_hours(result.v_date, 1), "mm/dd/yyyy HH24");
+
+ if (result.v_name.length() > 0) {
+ if (result.v_hour.length() > 0) {
+
+ result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value.substring(0, 10) + "&" + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "_Hr=" + result.v_value.substring(11, 13);
+ result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value.substring(0, 10) + "&" + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "_Hr="
+ + result.v_value.substring(11, 13) + "&";
+
+ } else {
+ result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value + "&";
+ result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value + "&";
+ }
+ }
+ }
+ if (column_value.indexOf("_Hr") <= 0) {
+ result.v_formfields_insert = result.v_formfields_insert + column_value + "&";
+ result.v_formfields_generate = result.v_formfields_generate + column_value + "&";
+ }
+ } else if ("WEEKLY".equals(v_recurrence)) {
+
+ if (column_value.indexOf("_auto") > 0) {
+ result.v_name = column_value.substring(0, column_value.indexOf('='));
+ result.v_date = schedulerUtil.to_date(column_value.substring(column_value.indexOf('=') + 1), "mm/dd/yyyy");
+ result.v_value = schedulerUtil.add_days(result.v_date, 7).toString();
+
+ if (result.v_name.length() > 0) {
+ result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value + "&";
+ result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value + "&";
+ }
+
+ } else {
+ result.v_formfields_insert = result.v_formfields_insert + column_value + "&";
+ result.v_formfields_generate = result.v_formfields_generate + column_value + "&";
+ }
+
+ } else {
+ if (column_value.indexOf("_auto") > 0) {
+ result.v_name = column_value.substring(0, column_value.indexOf('='));
+ result.v_date = schedulerUtil.to_date(column_value.substring(column_value.indexOf('=') + 1), "mm/dd/yyyy");
+ result.v_value = schedulerUtil.add_days(result.v_date, 7).toString();
+ if (result.v_name.length() > 0) {
+ result.v_formfields_insert = result.v_formfields_insert + result.v_name + "=" + result.v_value + "&";
+ result.v_formfields_generate = result.v_formfields_generate + result.v_name.substring(0, result.v_name.indexOf("_auto")) + "=" + result.v_value + "&";
+ }
+
+ } else {
+ result.v_formfields_insert = result.v_formfields_insert + column_value + "&";
+ result.v_formfields_generate = result.v_formfields_generate + column_value + "&";
+ }
+ }
+ }
+
+ schedulerUtil.insertOrUpdate("update CR_REPORT_SCHEDULE set processed_formfields ='" + result.v_formfields_insert + "' where schedule_id =" + v_schedule_id);
+ return "&" + result.v_formfields_generate.substring(0, result.v_formfields_generate.length());
+ }
+
+ private int get_report_sched_offset(int p_rep_id, int p_schedule_id) throws SQLException, ReportSQLException {
+
+ class CrReportSchedule {
+
+ Date run_date;
+ String recurrence;
+ }
+ Date v_last_date = null;
+ Date v_sysdate = new Date();
+
+ final CrReportSchedule v_report_schedule_rec = new CrReportSchedule();
+
+ schedulerUtil.getAndExecute("SELECT * FROM cr_report_schedule WHERE rep_id = " + p_rep_id + " and schedule_id = " + p_schedule_id, new Executor() {
+
+ @Override
+ public void execute(ResultSet rs) throws SQLException {
+
+ v_report_schedule_rec.recurrence = rs.getString("recurrence");
+ java.sql.Timestamp runDate = rs.getTimestamp("run_date");
+ v_report_schedule_rec.run_date = new Date(runDate.getTime()) ;
+ }
+
+ });
+
+ if (v_report_schedule_rec.run_date == null || v_report_schedule_rec.run_date.compareTo(v_sysdate) > 0) {
+ return Integer.MAX_VALUE;
+ }
+
+ Date v_next_date = v_report_schedule_rec.run_date;
+
+ while (v_next_date.compareTo(v_sysdate) < 0) {
+
+ if ("HOURLY".equals(v_report_schedule_rec.recurrence)) {
+ v_next_date = SchedulerUtil.add_hours(v_next_date, 1);
+ } else if ("DAILY".equals(v_report_schedule_rec.recurrence)) {
+ v_next_date = SchedulerUtil.add_days(v_next_date, 1);
+ } else if ("DAILY_MO_FR".equals(v_report_schedule_rec.recurrence)) {
+ SimpleDateFormat sdf = new SimpleDateFormat("EEE");
+ sdf.format(v_next_date);
+ if ("FRI".equals(v_next_date.toString())) {
+ v_next_date = SchedulerUtil.add_days(v_next_date, 3);
+ } else if ("SAT".equals(v_next_date.toString())) {
+ v_next_date = SchedulerUtil.add_days(v_next_date, 2);
+ } else {
+ v_next_date = SchedulerUtil.add_days(v_next_date, 1);
+ }
+ } else if ("WEEKLY".equals(v_report_schedule_rec.recurrence)) {
+ v_next_date = SchedulerUtil.add_days(v_next_date, 7);
+ } else if ("MONTHLY".equals(v_report_schedule_rec.recurrence)) {
+ v_next_date = SchedulerUtil.add_months(v_next_date, 1);
+ } else {
+ break;
+ }
+ v_last_date = v_next_date;
+ }
+
+ if (SchedulerUtil.trunc_hour(v_last_date).compareTo(SchedulerUtil.trunc_hour(v_sysdate)) == 0) {
+ return (int)(Math.abs (v_sysdate.getTime() - v_last_date.getTime()) / 1000);
+ } else {
+ // More than an hour
+ return 3601;
+ }
+ }
+
+ public SchedulerUtil getSchedulerUtil() {
+ return schedulerUtil;
+ }
+
+ public void setSchedulerUtil(SchedulerUtil schedulerUtil) {
+ this.schedulerUtil = schedulerUtil;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/AppUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/AppUtils.java
new file mode 100644
index 00000000..ce070c3a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/AppUtils.java
@@ -0,0 +1,333 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.HtmlStripper;
+
+public class AppUtils /* implements IAppUtils */{
+ private static String baseURL = null;
+
+ private AppUtils() {
+ }
+
+ /** ******************************************************** */
+
+ public static String generateFileName(HttpServletRequest request, String fileTypeExtension) {
+ return AppConstants.FILE_PREFIX + getUserID(request) + fileTypeExtension;
+ } // generateFileName
+
+ public static String generateUniqueFileName(HttpServletRequest request, String reportName, String fileTypeExtension) {
+ String formattedReportName = new HtmlStripper().stripSpecialCharacters(reportName);
+ String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date());
+ return formattedReportName+formattedDate+getUserID(request)+fileTypeExtension;
+ } // generateFileName
+
+ public static String getRequestValue(HttpServletRequest request, String valueID) {
+ String value = (String) request.getAttribute(valueID);
+ if (value == null)
+ value = request.getParameter(valueID);
+ return value;
+ } // getRequestValue
+
+ public static String getRequestNvlValue(HttpServletRequest request, String valueID) {
+ String value = getRequestValue(request, valueID);
+ return (value == null) ? "" : value;
+ } // getRequestValue
+
+ public static boolean getRequestFlag(HttpServletRequest request, String valueID) {
+ String value = getRequestNvlValue(request, valueID);
+ return value.toLowerCase().equals("true") || value.toUpperCase().startsWith("Y");
+ } // getRequestFlag
+
+ /** ******************************************************** */
+
+ public static String getUserID(HttpServletRequest request) {
+ return Globals.getAppUtils().getUserID(request);
+ } // getUserID
+
+ public static String getUserName(HttpServletRequest request) {
+ return Globals.getAppUtils().getUserName(request);
+ } // getUserName
+
+ public static String getUserName(String userId) {
+ return Globals.getAppUtils().getUserName(userId);
+ } // getUserName
+
+ public static String getUserEmail(String userId) {
+ return Globals.getAppUtils().getUserEmail(userId);
+ } // getUserEmail
+
+ public static String getUserEmail(HttpServletRequest request) {
+ return Globals.getAppUtils().getUserEmail(request);
+ } // getUserEmail
+
+ public static String getUserLoginId(HttpServletRequest request) {
+ return Globals.getAppUtils().getUserLoginId(request);
+ } // getUserLoginId
+
+ public static String getUserLoginId(String userId) {
+ return Globals.getAppUtils().getUserLoginId(userId);
+ } // getUserLoginId
+
+ public static String getUserBackdoorLoginId(HttpServletRequest request) {
+ return Globals.getAppUtils().getUserBackdoorLoginId(request);
+ } // getUserBackdoorLoginId
+
+ public static Vector getAllUsers(String customizedQuery, String param, boolean isAdmin) {
+ return Globals.getAppUtils().getAllUsers(customizedQuery, param, isAdmin);
+ } // getAllUsers
+
+ public static String getRoleName(String roleId) {
+ return Globals.getAppUtils().getRoleName(roleId);
+ } // getRoleName
+
+ public static Vector getAllRoles(String customizedQuery, String param, boolean isAdmin) {
+ return Globals.getAppUtils().getAllRoles(customizedQuery, param, isAdmin);
+ } // getAllRoles
+
+ public static boolean isUserInRole(HttpServletRequest request, String roleId) throws RaptorException {
+ return Globals.getAppUtils().isUserInRole(request,roleId);
+ } // isUserInRole
+
+// public static boolean isUserInRole(String userId, String roleId) throws RaptorException {
+// return Globals.getAppUtils().isUserInRole(userId, roleId);
+// } // isUserInRole
+
+ public static Vector getUserRoles(HttpServletRequest request) throws RaptorException {
+ return Globals.getAppUtils().getUserRoles(request);
+ } // getUserRoles
+
+ public static Vector getUserRoles(String userID) throws RaptorException {
+ return Globals.getAppUtils().getUserRoles(userID);
+ } // getUserRoles
+
+// public static Vector getUserRoles(HttpServletRequest request) throws RaptorException {
+// return Globals.getAppUtils().getUserRoles(request);
+// } // getUserRoles
+
+ public static void resetUserCache() {
+ Globals.getAppUtils().resetUserCache();
+ } // resetUserCache
+
+ public static String getSuperRoleID() {
+ return Globals.getAppUtils().getSuperRoleID();
+ } // getSuperRoleID
+
+ public static Vector getAdminRoleIDs() {
+ return Globals.getAppUtils().getAdminRoleIDs();
+ } // getAdminRoleIDs
+
+ // This is changed to check for Admin User as admin user also need super user privilege if explicitly specified in properties file.
+ public static boolean isSuperUser(HttpServletRequest request)throws RaptorException {
+ if(Globals.isAdminRoleEquivalenttoSuperRole()) return isAdminUser(request);
+ else return isUserInRole(request, getSuperRoleID());
+ } // isSuperUser
+
+ /*public static boolean isSuperUser(String userId) throws RaptorException {
+ if(Globals.isAdminRoleEquivalenttoSuperRole()) return isAdminUser(userId);
+ else return isUserInRole(userId, getSuperRoleID());
+ } // isSuperUser
+ */
+
+ public static boolean isAdminUser(HttpServletRequest request) throws RaptorException {
+ if (isSuperUser(request))
+ return true;
+ for (int i = 0; i < getAdminRoleIDs().size(); i++)
+ if (isUserInRole(request, (String) getAdminRoleIDs().get(i)))
+ return true;
+
+ return false;
+ } // isAdminUser
+
+ /*public static boolean isAdminUser(String userId) throws RaptorException {
+ if (isSuperUser(userId))
+ return true;
+
+ for (int i = 0; i < getAdminRoleIDs().size(); i++)
+ if (isUserInRole(userId, (String) getAdminRoleIDs().get(i)))
+ return true;
+
+ return false;
+ } // isAdminUser
+ */
+
+ public static String getTempFolderPath() {
+ String path = Globals.getAppUtils().getTempFolderPath();
+ if (path.endsWith(File.separator) || path.endsWith("/")){
+ return path;
+ } else {
+ path = path + File.separator;
+ return path;
+ }
+ } // getTempFolderPath
+
+ public static String getUploadFolderPath() {
+ String path = Globals.getAppUtils().getUploadFolderPath();
+ if (path.endsWith(File.separator)){
+ return path;
+ } else {
+ path = path + File.separator;
+ return path;
+ }
+ } // getUploadFolderPath
+
+ public static String getTempFolderURL() {
+ return Globals.getAppUtils().getTempFolderURL();
+ } // getTempFolderURL
+
+ public static String getUploadFolderURL() {
+ return Globals.getAppUtils().getUploadFolderURL();
+ } // getUploadFolderURL
+
+ public static String getSMTPServer()throws Exception {
+ return Globals.getAppUtils().getSMTPServer();
+ } // getSMTPServer
+
+ public static String getDefaultEmailSender() throws RaptorException {
+ return Globals.getAppUtils().getDefaultEmailSender();
+ } // getDefaultEmailSender
+
+ public static String getErrorPage() {
+ return getJspContextPath() + Globals.getAppUtils().getErrorPage();
+ } // getErrorPage
+
+ public static String getErrorPageWMenu() {
+ return getJspContextPath() + Globals.getAppUtils().getErrorPageWMenu();
+ } // getErrorPage
+
+ public static String getJspContextPath() {
+ return Globals.getAppUtils().getJspContextPath();
+ } // getJspContextPath
+
+ public static String getImgFolderURL() {
+ return Globals.getAppUtils().getImgFolderURL();
+ } // getImgFolderURL
+
+ public static String getBaseFolderURL() {
+ return Globals.getAppUtils().getBaseFolderURL();
+ } // getBaseFolderURL
+
+ /*
+ * public static String getReportExecuteActionURL() { return
+ * Globals.getAppUtils().getReportExecuteActionURL(); } //
+ * getReportExecuteActionURL
+ *
+ * public static String getDataViewActionURL() { return
+ * Globals.getAppUtils().getDataViewActionURL(); } // getDataViewActionURL
+ *
+ * public static String getDataViewActionParam() { return
+ * Globals.getAppUtils().getDataViewActionParam(); } //
+ * getDataViewActionParam
+ */
+ public static String getDirectAccessURL() {
+ return Globals.getAppUtils().getDirectAccessURL();
+ } // getDirectAccessURL
+
+ public static String getBaseURL() {
+ if (baseURL == null) {
+ baseURL = getBaseActionURL();
+ if (baseURL.indexOf("?") > 0)
+ baseURL = baseURL.substring(0, baseURL.indexOf("?"));
+ } // if
+
+ return baseURL;
+ } // getBaseURL
+
+ public static String getBaseActionURL() {
+ return Globals.getAppUtils().getBaseActionURL();
+ } // getBaseActionURL
+
+ public static String getDrillActionURL() {
+ return Globals.getAppUtils().getDrillActionURL();
+ } // getBaseActionURL
+
+ public static String getRaptorActionURL() {
+ return Globals.getAppUtils().getBaseActionURL() + "raptor&" + AppConstants.RI_ACTION
+ + "=";
+ } // getRaptorActionURL
+
+ public static String getRaptorActionURLNG() {
+ return Globals.getAppUtils().getBaseActionURLNG();
+ } // getRaptorActionURL
+
+ public static String getReportExecuteActionURL() {
+ return getRaptorActionURL() + "report.run.container&" + AppConstants.RI_REPORT_ID + "="; // getBaseActionParam();
+ } // getReportExecuteActionURL
+
+ public static String getReportExecuteActionURLNG() {
+ return getRaptorActionURLNG() + "report_run/"; // getBaseActionParam();
+ } // getReportExecuteActionURL
+
+ public static String getBaseActionParam() {
+ return Globals.getAppUtils().getBaseActionParam();
+ } // getBaseActionParam
+
+ public static Vector getQuickLinksMenuIDs() {
+ return Globals.getAppUtils().getQuickLinksMenuIDs();
+ } // getQuickLinksMenuIDs
+
+ public static String getMenuLabel(String menuId) {
+ return Globals.getAppUtils().getMenuLabel(menuId);
+ } // getMenuLabel
+
+ public static String getReportDbColsMaskSQL() {
+ return Globals.getAppUtils().getReportDbColsMaskSQL();
+ } // getReportDbColsMaskSQL
+
+ public static String getReportDbLookupsSQL() {
+ return Globals.getAppUtils().getReportDbLookupsSQL();
+ } // getReportDbLookupsSQL
+
+ public static void processErrorNotification(HttpServletRequest request, RaptorException e) {
+ Globals.getAppUtils().processErrorNotification(request, e);
+ } // processErrorNotification
+
+ public static String getExcelTemplatePath() {
+ String path = Globals.getAppUtils().getExcelTemplatePath();
+ if (path.endsWith(File.separator)){
+ return path;
+ } else {
+ path = path + File.separator;
+ return path;
+ }
+ } // getTempFolderPath
+
+ public static String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public static boolean isNotEmpty(String s) {
+ return nvl(s).length()>0;
+ }
+ public static String nvls(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+} // AppUtils
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ConnectionUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ConnectionUtils.java
new file mode 100644
index 00000000..58fb3f25
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ConnectionUtils.java
@@ -0,0 +1,69 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system;
+
+import java.sql.Connection;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+
+public class ConnectionUtils {
+
+ public static DataSet getDataSet(String sql, String remoteDbPrefix)
+ throws RaptorException {
+ return getDataSet(sql, remoteDbPrefix, false);
+ }
+
+ public static Connection getConnection(String remoteDbPrefix) throws ReportSQLException {
+ if (!isNull(remoteDbPrefix) && (!remoteDbPrefix.equals(AppConstants.DB_LOCAL)) && !Globals.getSystemType().equals(Globals.ST_GENERIC) ) {
+ return RemDbUtils.getConnection(remoteDbPrefix);
+ } else {
+ return DbUtils.getConnection();
+ }
+ }
+
+ public static DataSet getDataSet(String sql, String remoteDbPrefix,
+ boolean pagesize) throws ReportSQLException {
+ DataSet ds = null;
+ if (!isNull(remoteDbPrefix) && (!remoteDbPrefix.equals(AppConstants.DB_LOCAL)) && !Globals.getSystemType().equals(Globals.ST_GENERIC) ) {
+ if (pagesize == false)
+ ds = RemDbUtils.executeQuery(sql,remoteDbPrefix);
+ else
+ ds = RemDbUtils.executeQuery(sql, Globals.getDefaultPageSize() + 1,remoteDbPrefix);
+ } else {
+ if (pagesize == false)
+ ds = DbUtils.executeQuery(sql);
+ else
+ ds = DbUtils.executeQuery(sql, Globals.getDefaultPageSize() + 1);
+ }
+ return ds;
+ }
+
+ public static boolean isNull(String a) {
+ if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null"))
+ return true;
+ else
+ return false;
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/DbUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/DbUtils.java
new file mode 100644
index 00000000..859931f9
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/DbUtils.java
@@ -0,0 +1,1298 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system;
+
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Types;
+
+import javax.sql.DataSource;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.web.support.AppUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class DbUtils /* implements IDbUtils */{
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(DbUtils.class);
+
+
+
+ private static DataSource dataSource;
+
+
+ public DbUtils() {
+ }
+
+ public static Connection getConnection() throws ReportSQLException {
+ try {
+ return AppUtils.getDatasource().getConnection();
+ } catch(SQLException ex) {
+ ex.printStackTrace();
+ }
+ return null;
+ //return Globals.getDbUtils().getConnection();
+ } // getConnection
+
+ public static void clearConnection(Connection con) throws ReportSQLException {
+ try {
+ if ((con != null) && !con.isClosed())
+ Globals.getDbUtils().clearConnection(con);
+ } catch (SQLException ex) {
+ throw new ReportSQLException(ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new ReportSQLException (ex2.getMessage(), ex2.getCause());
+ }
+ } // clearConnection
+
+ public static Connection startTransaction() throws ReportSQLException {
+ Connection con = null;
+ try {
+ con = getConnection();
+ con.setAutoCommit(false);
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new ReportSQLException (ex2.getMessage(), ex2.getCause());
+ }
+ return con;
+ } // startTransaction
+
+ public static void commitTransaction(Connection con) throws ReportSQLException {
+ try {
+ con.commit();
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new ReportSQLException (ex2.getMessage(), ex2.getCause());
+ }
+
+ //clearConnection(con);
+ } // commitTransaction
+
+ public static void rollbackTransaction(Connection con) throws ReportSQLException {
+ try {
+ con.rollback();
+ clearConnection(con);
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new ReportSQLException (ex2.getMessage(), ex2.getCause());
+ }
+ } // rollbackTransaction
+
+ public static String executeCall(Connection con, String sql, boolean expectResult)
+ throws ReportSQLException {
+ String result = null;
+
+ try {
+ if(con.isClosed()) con = getConnection();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[SQL CALL FROM RAPTOR] [SQL Call] " + sql));
+ CallableStatement stmt = con.prepareCall(sql);
+ if (expectResult)
+ stmt.registerOutParameter(1, Types.CHAR);
+ stmt.executeUpdate();
+ if (expectResult)
+ result = stmt.getString(1);
+ stmt.close();
+ con.commit();
+ } catch (SQLException e) {
+ throw new ReportSQLException(e.getMessage(), sql);
+ } finally {
+ clearConnection(con);
+ }
+
+ return result;
+ } // executeCall
+
+ public static String executeCall(String sql, boolean expectResult)
+ throws RaptorException {
+ Connection con = null;
+ con = getConnection();
+ String result = executeCall(con, sql, expectResult);
+ //con.commit();
+ return result;
+ } // executeCall
+
+ public static int executeUpdate(Connection con, String sql) throws ReportSQLException {
+ int rcode = -1;
+ try {
+ Statement stmt = con.createStatement();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[SQL CALL FROM RAPTOR] [SQL Update] " + sql));
+ rcode = stmt.executeUpdate(sql);
+ stmt.close();
+ //con.commit();
+ } catch (SQLException e) {
+ //e.printStackTrace();
+ throw new ReportSQLException(e.getMessage(), sql);
+ }
+ return rcode;
+ } // executeUpdate
+
+ /* public static int batchUpdate(Connection con, String sql) throws ReportSQLException, Exception {
+ int rcode = -1;
+ try {
+ Statement stmt = con.createStatement();
+ debugLogger.debug("[SQL CALL FROM RAPTOR] [SQL Update] " + sql, 4);
+ rcode = stmt.executeUpdate(sql);
+ stmt.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ throw new ReportSQLException(e.getMessage(), sql);
+ }
+ return rcode;
+ } // batchUpdate
+*/
+
+ public static int executeUpdate(String sql) throws ReportSQLException {
+ Connection con = null;
+ try {
+ con = getConnection();
+ int rcode = executeUpdate(con, sql);
+ if(Globals.getDBType().equals("oracle"))
+ con.commit();
+
+ return rcode;
+ } catch (SQLException e) {
+ throw new ReportSQLException(e.getMessage(), sql);
+ } finally {
+ clearConnection(con);
+ }
+ } // executeUpdate
+
+ public static DataSet executeQuery(Connection con, String sql) throws ReportSQLException {
+ return executeQuery(con, sql, Integer.MAX_VALUE);
+ } // executeQuery
+
+ public static DataSet executeQuery(Connection con, String sql, int maxRowLimit)
+ throws ReportSQLException {
+ try {
+ if(con.isClosed()) con = getConnection();
+ //con.
+ Statement stmt = con.createStatement();
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[SQL CALL FROM RAPTOR] [SQL] " + sql));
+ ResultSet rs = stmt.executeQuery(sql);
+ DataSet ds = new DataSet(rs, maxRowLimit);
+
+ if(rs!=null)
+ rs.close();
+ if(stmt!=null)
+ stmt.close();
+
+ return ds;
+ } catch (SQLException e) {
+ throw new ReportSQLException(e.getMessage(), sql);
+ }
+ } // executeQuery
+
+ public static DataSet executeQuery(String sql) throws ReportSQLException {
+ return executeQuery(sql, Integer.MAX_VALUE);
+ } // executeQuery
+
+ public static DataSet executeQuery(String sql, int maxRowLimit) throws ReportSQLException {
+ Connection con = null;
+ try {
+ con = getConnection();
+ return executeQuery(con, sql, maxRowLimit);
+ }catch (ReportSQLException ex) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("Error " + sql));
+ throw new ReportSQLException(ex.getMessage(), ex);
+ }catch(Exception ex1) {
+ throw new ReportSQLException(ex1.getMessage(), ex1.getCause());
+ } finally {
+ clearConnection(con);
+ }
+ } // executeQuery
+
+ //For ZK Support
+
+ public static int executeQuery(ReportRuntime rr, int dateOption) {
+ Connection con = null;
+ int rowCount = 0;
+ try {
+ con = ConnectionUtils.getConnection(rr.getDBInfo());
+ String wholeSql = rr.getWholeSQL();
+
+ DataColumnType dc = rr.getColumnWhichNeedEnhancedPagination();
+ String date_ColId = dc.getColId();
+ String dataFormat = dc.getColFormat();
+ if(dataFormat!=null && dataFormat.length()>0)
+ date_ColId = "to_date("+date_ColId+", '"+ dataFormat +"')";
+ String sql = "";
+ if(dateOption == 1)
+ sql = "select count(distinct to_char("+date_ColId+", 'YYYY/MM')) from ("+wholeSql+")";
+ else if (dateOption == 3)
+ sql = "select count(distinct to_char("+date_ColId+", 'YYYY/MM/DD')) from ("+wholeSql+")";
+ else if (dateOption == 2)
+ sql = "select count(distinct to_char("+date_ColId+", 'YYYY')) from ("+wholeSql+")";
+ DataSet ds = executeQuery(con, sql.toString());
+ rowCount = ds.getInt(0,0);
+ } catch (ReportSQLException ex) {
+ ex.printStackTrace();
+ }catch(Exception ex1) {
+ ex1.printStackTrace();
+ } finally {
+ try {
+ clearConnection(con);
+ } catch (ReportSQLException ex2) {
+ ex2.printStackTrace();
+ }
+ }
+ return rowCount;
+ }
+
+// public static List executeQuery(ReportRuntime rr, String filterClause, int itemStartNumber, int itemEndNumber, boolean topDown, String _orderBy, boolean asc, RaptorRunHandler raptorRunHandler) {
+// Connection con = null;
+// List rowList = new ArrayList();
+// String totalSql = raptorRunHandler.getTotalSql();
+// ReportData rd = null;
+// boolean totalAvailable = false;
+// if(nvls(totalSql).length()>0) totalAvailable = true;
+// /*if(totalAvailable) {
+// if(itemStartNumber > 0) itemStartNumber--;
+// itemEndNumber--;
+// //if(itemEndNumber > 2) itemEndNumber = itemEndNumber - 2;
+// }*/
+// try {
+//
+//
+//
+// con = ConnectionUtils.getConnection(rr.getDBInfo());
+// //if client side sorting is needed we could disable the comment line below for quicker development
+// // until we do it in "client" end.
+// //StringBuffer sql = new StringBuffer(rr.getReportSQLWithRowNum());
+// StringBuffer sql = new StringBuffer("");
+// String dbType = raptorRunHandler.getDbType();
+// if(rr.getDateOption() == -1) {
+// if (!dbType.equals("DAYTONA")) {
+// sql = new StringBuffer(rr.getReportSQLWithRowNum(_orderBy, asc));
+// //if( /*itemEndNumber > 1 &&*/ itemEndNumber > itemStartNumber)
+// if(topDown) {
+// sql.append(")"+ (Globals.isPostgreSQL()?" AS ":"") +" y");
+//
+// if(Globals.getDBType().equals("postgresql"))
+// sql.append(" WHERE RNUM < " + (itemEndNumber));
+// else
+// sql.append(" WHERE ROWNUM < " + (itemEndNumber));
+// }
+// else {
+// //sql.append(" WHERE ROWNUM <= " + (itemEndNumber));
+// String a_sql = Globals.getReportSqlOnlySecondPartA();
+// a_sql = a_sql.replace("[endRow]", String.valueOf(itemEndNumber));
+// String b_sql = Globals.getReportSqlOnlySecondPartBNoOrderBy();
+// b_sql = b_sql.replace("[startRow]", String.valueOf(itemStartNumber));
+// sql.append(") "+ (Globals.isPostgreSQL()?" AS ":"") +" a ");
+// sql.append(a_sql);
+// sql.append(b_sql);
+//
+// }
+// // sql.append(" ) y WHERE rnum >= " + (topDown?itemStartNumber:(itemStartNumber+1)));
+// if(nvls(_orderBy).length()>0)
+// sql.append(" ORDER BY "+ _orderBy + " "+ (asc ? "ASC" : "DESC"));
+// else
+// sql.append(" ORDER BY rnum");
+// // sql = String.format(sql, _orderBy, asc ? "ASC" : "DESC");
+// } else {
+// sql = new StringBuffer(rr.getWholeSQL());
+// if( sql.toString().trim().toUpperCase().startsWith("SELECT")) {
+// sql.append(" LIMIT TO "+ (itemStartNumber+1)+"->"+itemEndNumber);
+// }
+// //return sql;
+// }
+// System.out.println("ZK RAPTOR RUN " + sql);
+// } else {
+// String wholeSql = rr.getWholeSQL();
+// DataColumnType dc = rr.getColumnWhichNeedEnhancedPagination();
+// String date_ColId = dc.getColId();
+// String dataFormat = dc.getColFormat();
+// if(dataFormat!=null && dataFormat.length()>0)
+// date_ColId = "to_date("+date_ColId+", '"+ dataFormat +"')";
+// StringBuffer dateSql = new StringBuffer(" select y.rownum1, y.datetime from (select rownum rownum1, datetime from ");
+// if(rr.getDateOption() == 1) {
+// dateSql.append( "(select distinct to_char("+date_ColId+", 'YYYY/MM') datetime from ( " + wholeSql + ") order by 1 desc");
+// } else if (rr.getDateOption() == 2) {
+// dateSql.append( "(select distinct to_char("+date_ColId+", 'YYYY') datetime from ( " + wholeSql + ") order by 1 desc");
+// } else if (rr.getDateOption() == 3) {
+// dateSql.append( "(select distinct to_char("+date_ColId+", 'YYYY/MM/DD') datetime from ( " + wholeSql + ") order by 1 desc");
+// }
+// dateSql.append(")) y where y.rownum1 = "+ (itemStartNumber+1));
+// DataSet ds = executeQuery(con, dateSql.toString());
+// String dateStr = "";
+// if(ds.getRowCount() > 0)
+// dateStr = ds.getString(0,1);
+//
+// sql = new StringBuffer(rr.getReportSQLWithRowNum(_orderBy, asc));
+// if(rr.getDateOption() == 1) {
+// sql.append(" WHERE to_char("+ date_ColId + ", 'YYYY/MM') = '"+ dateStr +"')");
+// } else if (rr.getDateOption() == 2) {
+// sql.append(" WHERE to_char("+ date_ColId + ", 'YYYY') = '"+ dateStr +"')");
+// } else if (rr.getDateOption() == 3) {
+// sql.append(" WHERE to_char("+ date_ColId + ", 'YYYY/MM/DD') = '"+ dateStr +"')");
+// }
+// if(nvls(_orderBy).length()>0)
+// sql.append(" ORDER BY "+ _orderBy + " "+ (asc ? "ASC" : "DESC"));
+// else
+// sql.append(" ORDER BY rnum");
+// System.out.println("ZK RAPTOR RUN MONTHLY " + sql);
+// }
+//
+// debugLogger.error(" ************** just a test **************** ");
+// debugLogger.error(" SQL " + sql);
+// debugLogger.error(" ******************************************* ");
+//
+// DataSet ds = ConnectionUtils.getDataSet(sql.toString(), rr.getDBInfo());
+// DataSet ds1 = null;
+// //DataSet ds = executeQuery(sql.toString());
+// List reportCols = rr.getAllColumns();
+// Vector formatProcessors = new Vector(reportCols.size());
+//
+// String oldValue = "";
+// String value = "";
+// String groupByColValue = "";
+// int subTotalFlag = -1;
+// //String newValue = "";
+// for (int r = 0; r < ds.getRowCount(); r++) {
+// DataRow dr = new DataRow();
+// //rd.reportDataRows.addDataRow(dr);
+// //rd = raptorRunHandler.getReportData();
+// //RowHeaderCol rhc = new RowHeaderCol();
+// //reportRowHeaderCols.addRowHeaderCol(0, rhc);
+// //rhc.setColumnWidth("5%");
+// int formatCount = -1; //added for auxillary head check
+// String drillDownURL = "";
+//
+// int changedFlag = 0;
+// for (int c = 0; c < reportCols.size(); c++) {
+// if(reportCols.get(c)!=null) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// else formatCount++;
+// //
+// formatProcessors.add(formatCount,new FormatProcessor(
+// rr.getSemaphoreById(dct.getSemaphoreId()), dct.getColType(), dct
+// .getColFormat(), rr.getReportDefType().equals(
+// AppConstants.RD_SQL_BASED)));
+// //
+// if(!(dct.getColName().startsWith("[") && dct.getDisplayName() == null)) {
+// value = "";
+//
+// if(ds.getColumnIndex(dct.getColId())!= -1) {
+// value = ds.getString(r, dct.getColId());
+// if(dct.getGroupByPos()!=null && dct.getGroupByPos()>0) {
+// groupByColValue = ds.getString(r, dct.getColId());
+// if(oldValue.length()> 0 && !oldValue.equals(groupByColValue)) {
+// //newValue = value;
+// if(subTotalFlag > 0) {
+// changedFlag = -1;
+// oldValue = groupByColValue;
+// subTotalFlag = 0;
+// } else {
+// changedFlag = 1;
+// //oldValue = groupByColValue;
+// r--;
+// }
+// } else if (oldValue.length()<=0) {
+// oldValue = groupByColValue;
+// changedFlag = -1;
+// } else if (oldValue.equals(groupByColValue)) {
+// //oldValue = value;
+// changedFlag = 0;
+// }
+// }
+// }
+//
+// if(changedFlag > 0) {
+// StringBuffer subTotalSql = new StringBuffer(" select ");
+// StringBuffer whereClause = new StringBuffer("");
+// //get all colids
+// for (int d = 0; d < reportCols.size(); d++) {
+// if(reportCols.get(d)!=null) {
+// DataColumnType dct1 = (DataColumnType) reportCols.get(d);
+// if(dct1.getGroupByPos()!=null && dct1.getGroupByPos()>0){
+// subTotalSql.append(dct1.getColId() + " " );
+// whereClause.append(" where "+ dct1.getColId() + " = '" + oldValue + "' " + " group by "+ dct1.getColId() );
+// }
+// if(dct1.getDisplayTotal()!=null && dct1.getDisplayTotal().length() > 0) {
+// subTotalSql.append(", sum("+dct1.getColId()+")");
+// }
+// }
+// }
+//
+// subTotalSql.append(" from (");
+// subTotalSql.append(rr.getWholeSQL());
+// subTotalSql.append (")");
+// subTotalSql.append(whereClause);
+// ds1 = ConnectionUtils.getDataSet(subTotalSql.toString(),rr.getDbInfo());
+// dr = new DataRow();
+// DataValue dv = new DataValue();
+// int count = 0;
+// //dv.setColName("#");
+// for (int c1 = 0; c1 < reportCols.size(); c1++) {
+// dct = (DataColumnType) reportCols.get(c1);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// if ( dct != null && dct.isVisible()) {
+// count++;
+//
+// dv = new DataValue();
+// //if(count==1) {
+// if(dct.getGroupByPos()!=null && dct.getGroupByPos()>0) {
+// dr.addDataValue(dv);
+// if(AppUtils.nvl(dct.getSubTotalCustomText()).length()>0) {
+// dv.setDisplayValue(dct.getSubTotalCustomText());
+// } else {
+// dv.setDisplayValue("Sub Total");
+// }
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setBold(true);
+// } else {
+// if(dct.getDisplayTotal()!=null && dct.getDisplayTotal().length() > 0) {
+// dr.addDataValue(dv);
+// String subtotalValue = "";
+// if (ds1 != null) {
+// subtotalValue = ds1.getString(0, "sum("+dct.getColId()+")");
+// dv.setDisplayValue(Utils.truncateTotalDecimals(subtotalValue));
+// } else {
+// dv.setDisplayValue("");
+// }
+// } else {
+// if(dv.isVisible())
+// dr.addDataValue(dv);
+// dv.setDisplayValue("");
+// }
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setBold(true);
+// }
+// } // dct check
+// } // for
+// //if(!topDown) {
+// //rowList.add(dr);
+// //}
+// //oldValue = value;
+// if(changedFlag == 1) changedFlag = 0;
+// subTotalFlag = 1;
+// } else {
+//
+// if(nvls(value).length()>0 && !nvls(value).equals("'")) {
+// DataValue dv = new DataValue();
+// dr.addDataValue(dv);
+// if(dct.getGroupByPos()!=null && dct.getGroupByPos()>0) {
+// if(changedFlag == 0) {
+// dv.setDisplayValue("");
+// } else {
+// dv.setDisplayValue(nvls(value));
+// }
+// } else {
+// dv.setDisplayValue(nvls(value));
+// }
+// dv.setColName(dct.getColName());
+// dv.setColId(dct.getColId());
+// if(dct.getColType().equals(AppConstants.CT_HYPERLINK)) {
+// dv.setHyperlinkURL(dct.getHyperlinkURL());
+// dv.setDisplayType(dct.getHyperlinkType());
+// if(dct.getHyperlinkType().equals("IMAGE"))
+// dv.setActionImg(dct.getActionImg());
+// }
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// //dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// if(dct.isVisible()) {
+//
+// dv.setVisible(true);
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// //Add Drilldown URL to dv
+// if (nvls(dct.getDrillDownURL()).length() > 0) {
+//
+// if(dv.getDisplayValue().length() > 0) {
+// dv.setDrillDownURL(raptorRunHandler.parseDrillDownURL(r, /* c, */ds, dct,null));
+// dv.setDrillDowninPoPUp(dct.isDrillinPoPUp()!=null?dct.isDrillinPoPUp():false);
+// }
+//
+// if (dv.getDisplayValue().length() == 0) {
+// //dv.setDisplayValue("[NULL]");
+// dv.setDisplayValue("");
+// }
+// } // if
+//
+// } else {
+// dv.setVisible(false);
+// dv.setHidden(true);
+// }
+// //System.out.println("in Linear report b4" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+//
+// /* if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, false);
+// */
+//
+// //System.out.println("in Linear report After" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+//
+// if(topDown) {
+// if(!dv.getColId().endsWith("_calc") && dv.isVisible())
+// rowList.add(dv);
+// for (int cInner = 0; cInner < reportCols.size(); cInner++) {
+// if(reportCols.get(cInner)!=null) {
+// DataColumnType dctInner = (DataColumnType) reportCols.get(cInner);
+// if((dv.getColId()+"_calc").equals(dctInner.getColId())) {
+// /* DataValue dvInner = new DataValue();
+// dvInner.setDisplayValue(ds.getString(r, c));
+// dvInner.setColName(dct.getColName());
+// dvInner.setColId(dct.getColId());
+// rowList.add(dvInner);
+// */ dv.setDisplayCalculatedValue(ds.getString(r, dctInner.getColId()));
+// }
+// }
+// }
+// }
+// } else { //dv value check
+// DataValue dv = new DataValue();
+// dr.addDataValue(dv);
+// dv.setDisplayValue(nvls(value));
+// dv.setColName(dct.getColName());
+// dv.setColId(dct.getColId());
+// if(dct.isVisible())
+// dv.setVisible(true);
+// else
+// dv.setVisible(false);
+// /* if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, false);
+// */
+//
+// if(topDown) {
+// if(!dv.getColId().endsWith("_calc") && dv.isVisible())
+// rowList.add(dv);
+// for (int cInner = 0; cInner < reportCols.size(); cInner++) {
+// if(reportCols.get(cInner)!=null) {
+// DataColumnType dctInner = (DataColumnType) reportCols.get(cInner);
+// if((dv.getColId()+"_calc").equals(dctInner.getColId())) {
+// dv.setDisplayCalculatedValue(ds.getString(r, cInner));
+// }
+// }
+// }
+// }
+// }
+// } //changedFlag > 1
+// }
+// } // if reportCols
+//
+//
+// } // for
+//
+// //format
+//
+// for (int c = 0; c < reportCols.size(); c++) {
+// if(reportCols.get(c)!=null) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// //Modified since ds is null.
+// DataValue dv = new DataValue();
+// dv = dr.getDataValue(c);
+// if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, false);
+// }
+// }
+// //add dr to rowList after all column is done.
+// if(!topDown) {
+// rowList.add(dr);
+// }
+// } // for
+//
+///* //rd.addRowNumbers(pageNo, getPageSize());
+// rd = raptorRunHandler.getReportData();
+// RowHeaderCol rhc = new RowHeaderCol();
+// rd.reportRowHeaderCols.addRowHeaderCol(0, rhc);
+// rhc.setColumnWidth("5%");
+// rhc.add(new RowHeader(""#, "15"));
+//*/
+//
+// //String totalSql = raptorRunHandler.getTotalSql();
+//
+// if(subTotalFlag >=0) {
+// StringBuffer subTotalSql = new StringBuffer(" select ");
+// StringBuffer whereClause = new StringBuffer("");
+// //get all colids
+// for (int d = 0; d < reportCols.size(); d++) {
+// if(reportCols.get(d)!=null) {
+// DataColumnType dct1 = (DataColumnType) reportCols.get(d);
+// if(dct1.getGroupByPos()!=null && dct1.getGroupByPos()>0){
+// subTotalSql.append(dct1.getColId() + " " );
+// whereClause.append(" where "+ dct1.getColId() + " = '" + oldValue + "' " + " group by "+ dct1.getColId() );
+// }
+// if(dct1.getDisplayTotal()!=null && dct1.getDisplayTotal().length() > 0) {
+// subTotalSql.append(", sum("+dct1.getColId()+")");
+// }
+// }
+// }
+//
+// subTotalSql.append(" from (");
+// subTotalSql.append(rr.getWholeSQL());
+// subTotalSql.append (")");
+// subTotalSql.append(whereClause);
+// ds1 = ConnectionUtils.getDataSet(subTotalSql.toString(),rr.getDbInfo());
+// DataRow dr = new DataRow();
+// DataValue dv = new DataValue();
+// int count = 0;
+// //dv.setColName("#");
+// DataColumnType dct = null;
+// for (int c1 = 0; c1 < reportCols.size(); c1++) {
+// dct = (DataColumnType) reportCols.get(c1);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// if ( dct != null && dct.isVisible()) {
+// count++;
+//
+// dv = new DataValue();
+// //if(count==1) {
+// if(dct.getGroupByPos()!=null && dct.getGroupByPos()>0) {
+// dr.addDataValue(dv);
+// if(AppUtils.nvl(dct.getSubTotalCustomText()).length()>0) {
+// dv.setDisplayValue(dct.getSubTotalCustomText());
+// } else {
+// dv.setDisplayValue("Sub Total");
+// }
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setBold(true);
+// } else {
+// if(dct.getDisplayTotal()!=null && dct.getDisplayTotal().length() > 0) {
+// dr.addDataValue(dv);
+// String subtotalValue = "";
+// if (ds1 != null) {
+// subtotalValue = ds1.getString(0, "sum("+dct.getColId()+")");
+// dv.setDisplayValue(Utils.truncateTotalDecimals(subtotalValue));
+// } else {
+// dv.setDisplayValue("");
+// }
+// } else {
+// if(dv.isVisible())
+// dr.addDataValue(dv);
+// dv.setDisplayValue("");
+// }
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setBold(true);
+// }
+// } // dct check
+// } // for
+// if(!topDown) {
+// rowList.add(dr);
+// }
+// }
+// if(nvls(totalSql).length()>0) {
+// ds = ConnectionUtils.getDataSet(totalSql,rr.getDbInfo());
+// DataRow dr = new DataRow();
+// DataValue dv = new DataValue();
+// int count = 0;
+// //dv.setColName("#");
+// for (int c = 0; c < reportCols.size(); c++) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// if ( dct != null && dct.isVisible()) {
+// count++;
+//
+// dv = new DataValue();
+// if(count==1) {
+// dr.addDataValue(dv);
+// dv.setDisplayValue("Total (for all Records)");
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setBold(true);
+// } else {
+// if(dv.isVisible())
+// dr.addDataValue(dv);
+//
+// String totalValue = "";
+// if (ds != null)
+// totalValue = ds.getString(0, "TOTAL_"+dct.getColId());
+// if (nvls(dct.getDisplayTotal()).length() > 0
+// && (!dct.getDisplayTotal().equals(AppConstants.TOTAL_SUM_ID)))
+// totalValue = nvls(AppConstants.TOTAL_FUNCTIONS.getNameById(dct
+// .getDisplayTotal()))
+// + ": " + totalValue;
+// dv.setDisplayValue(Utils.truncateTotalDecimals(totalValue));
+//
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// /*StringBuffer indentation = new StringBuffer("");
+// if(dct.getIndentation()!=null && dct.getIndentation()>0) {
+// for (int indent=0; indent< dct.getIndentation(); indent++) {
+// indentation.append("\t");
+// }
+// dv.setNowrap("true");
+// }
+// dv.setIndentation(indentation.toString());*/
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setBold(true);
+// }
+// } // dct check
+// } // for
+// if(!topDown) {
+// rowList.add(dr);
+// }
+//
+// }
+//
+//
+//
+// } catch (ReportSQLException ex) {
+// ex.printStackTrace();
+// }catch(Exception ex1) {
+// ex1.printStackTrace();
+// } finally {
+// try {
+// clearConnection(con);
+// } catch (ReportSQLException ex2) {
+// ex2.printStackTrace();
+// }
+// }
+// return rowList;
+// }
+
+
+ //For ZK Support
+
+// public static List executeQuery(ReportRuntime rr, String filterClause, int itemStartNumber, int itemEndNumber, boolean topDown, String _orderBy, boolean asc, DashboardReportRunHandler dashboardReportRunHandler) {
+// Connection con = null;
+// List rowList = new ArrayList();
+// String totalSql = rr.getTotalSql();
+// boolean totalAvailable = false;
+// if(nvls(totalSql).length()>0) totalAvailable = true;
+// if(totalAvailable) {
+// itemStartNumber--;
+// itemEndNumber--;
+// }
+// try {
+// con = ConnectionUtils.getConnection(rr.getDBInfo());
+// //if client side sorting is needed we could disable the comment line below for quicker development
+// // until we do it in "client" end.
+// //StringBuffer sql = new StringBuffer(rr.getReportSQLWithRowNum());
+// StringBuffer sql = new StringBuffer("");
+// if (!rr.getReportType().equals(AppConstants.RT_HIVE)) {
+// sql = new StringBuffer(rr.getReportSQLWithRowNum(_orderBy, asc));
+// //if( /*itemEndNumber > 1 &&*/ itemEndNumber > itemStartNumber)
+//
+// if(topDown) {
+// sql.append(") "+ (Globals.isPostgreSQL()?" AS ":"") +" y");
+// if(Globals.getDBType().equals("postgresql"))
+// sql.append(" WHERE RNUM < " + (itemEndNumber));
+// else
+// sql.append(" WHERE ROWNUM < " + (itemEndNumber));
+// }
+// else {
+// //sql.append(" WHERE ROWNUM <= " + (itemEndNumber));
+// String a_sql = Globals.getReportSqlOnlySecondPartA();
+// a_sql = a_sql.replace("[endRow]", String.valueOf(itemEndNumber));
+// String b_sql = Globals.getReportSqlOnlySecondPartBNoOrderBy();
+// b_sql = b_sql.replace("[startRow]", String.valueOf(itemStartNumber));
+// sql.append(") "+ (Globals.isPostgreSQL()?" AS ":"") +" a ");
+// sql.append(a_sql);
+// sql.append(b_sql);
+// }
+//
+// // sql.append(" ) y WHERE rnum >= " + (topDown?itemStartNumber:(itemStartNumber+1)));
+// if(nvls(_orderBy).length()>0)
+// sql.append(" ORDER BY "+ _orderBy + " "+ (asc ? "ASC" : "DESC"));
+// else
+// sql.append(" ORDER BY rnum");
+// // sql = String.format(sql, _orderBy, asc ? "ASC" : "DESC");
+//
+// /*//sql.append(" WHERE ROWNUM <= " + (topDown?itemEndNumber:(itemEndNumber)));
+// sql.append(" ) y WHERE rnum >= " + (topDown?itemStartNumber:(itemStartNumber+1)));
+// if(nvls(_orderBy).length()>0)
+// sql.append(" ORDER BY "+ _orderBy + " "+ (asc ? "ASC" : "DESC"));
+// else
+// sql.append(" ORDER BY rnum");
+// // sql = String.format(sql, _orderBy, asc ? "ASC" : "DESC");*/
+// itemStartNumber = 0;
+// } else {
+// sql.append(rr.getWholeSQL());
+// int count = rr.getReportDataSize();
+// System.out.println("Count "+ count+ " " + itemEndNumber);
+// if(count < itemEndNumber)
+// sql.append(" " + "limit "+ count);
+// else
+// sql.append(" " + "limit "+ itemEndNumber);
+// }
+// System.out.println("ZK RAPTOR RUN " + sql);
+// DataSet ds = null;
+// if (!rr.getReportType().equals(AppConstants.RT_HIVE)) {
+// ds = executeQuery(con, sql.toString());
+// } else {
+// String dbInfo = rr.getDBInfo();
+// ds = ConnectionUtils.getDataSet(sql.toString(), dbInfo);
+// }
+// List reportCols = rr.getAllColumns();
+// Vector formatProcessors = new Vector(reportCols.size());
+//
+// for (int r = itemStartNumber; r < ds.getRowCount(); r++) {
+// DataRow dr = new DataRow();
+// //rd.reportDataRows.addDataRow(dr);
+//
+// int formatCount = -1; //added for auxillary head check
+// for (int c = 0; c < reportCols.size(); c++) {
+// if(reportCols.get(c)!=null) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// else formatCount++;
+// //
+// formatProcessors.add(formatCount,new FormatProcessor(
+// rr.getSemaphoreById(dct.getSemaphoreId()), dct.getColType(), dct
+// .getColFormat(), rr.getReportDefType().equals(
+// AppConstants.RD_SQL_BASED)));
+// //
+// if(!(dct.getColName().startsWith("[") && dct.getDisplayName() == null)) {
+// String value = "";
+// if(ds.getColumnIndex(dct.getColId())!= -1) {
+// value = ds.getString(r, dct.getColId());
+// }
+// if(nvls(value).length()>0 && !nvls(value).equals("'")) {
+// DataValue dv = new DataValue();
+// dr.addDataValue(dv);
+// dv.setDisplayValue(nvls(value));
+// dv.setColName(dct.getColName());
+// dv.setColId(dct.getColId());
+// if(dct.getColType().equals(AppConstants.CT_HYPERLINK)) {
+// dv.setHyperlinkURL(dct.getHyperlinkURL());
+// dv.setDisplayType(dct.getHyperlinkType());
+// if(dct.getHyperlinkType().equals("IMAGE"))
+// dv.setActionImg(dct.getActionImg());
+// }
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// //dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// if(dct.isVisible()) {
+//
+// dv.setVisible(true);
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setDisplayName(dct.getDisplayName());
+//
+// //Add Drilldown URL to dv
+// if (nvls(dct.getDrillDownURL()).length() > 0) {
+//
+// if(dv.getDisplayValue().length() > 0) {
+// dv.setDrillDownURL(dashboardReportRunHandler.parseDrillDownURL(r, /* c, */ds, dct,null,rr));
+// dv.setDrillDowninPoPUp(dct.isDrillinPoPUp()!=null?dct.isDrillinPoPUp():false);
+// }
+//
+// if (dv.getDisplayValue().length() == 0) {
+// //dv.setDisplayValue("[NULL]");
+// dv.setDisplayValue("");
+// }
+// } // if
+//
+// } else {
+// dv.setVisible(false);
+// dv.setHidden(true);
+// }
+// //System.out.println("in Linear report b4" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+//
+// /* if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, false);*/
+//
+// //System.out.println("in Linear report After" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+//
+// if(topDown) {
+// if(!dv.getColId().endsWith("_calc") && dv.isVisible())
+// rowList.add(dv);
+// for (int cInner = 0; cInner < reportCols.size(); cInner++) {
+// if(reportCols.get(cInner)!=null) {
+// DataColumnType dctInner = (DataColumnType) reportCols.get(cInner);
+// if((dv.getColId()+"_calc").equals(dctInner.getColId())) {
+// /* DataValue dvInner = new DataValue();
+// dvInner.setDisplayValue(ds.getString(r, c));
+// dvInner.setColName(dct.getColName());
+// dvInner.setColId(dct.getColId());
+// rowList.add(dvInner);
+// */ dv.setDisplayCalculatedValue(ds.getString(r, dctInner.getColId()));
+// }
+// }
+// }
+// }
+// } else { //dv value check
+// DataValue dv = new DataValue();
+// dr.addDataValue(dv);
+// dv.setDisplayValue(nvls(value));
+// dv.setColName(dct.getColName());
+// dv.setColId(dct.getColId());
+// if(dct.isVisible())
+// dv.setVisible(true);
+// else
+// dv.setVisible(false);
+// /*if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, false);*/
+//
+// if(topDown) {
+// if(!dv.getColId().endsWith("_calc") && dv.isVisible())
+// rowList.add(dv);
+// for (int cInner = 0; cInner < reportCols.size(); cInner++) {
+// if(reportCols.get(cInner)!=null) {
+// DataColumnType dctInner = (DataColumnType) reportCols.get(cInner);
+// if((dv.getColId()+"_calc").equals(dctInner.getColId())) {
+// dv.setDisplayCalculatedValue(ds.getString(r, dctInner.getColId()));
+// }
+// }
+// }
+// }
+// }
+// }
+// } // if reportCols
+//
+//
+// } // for
+// for (int c = 0; c < reportCols.size(); c++) {
+// if(reportCols.get(c)!=null) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// //Modified since ds is null.
+// DataValue dv = new DataValue();
+// dv = dr.getDataValue(c);
+// if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, false);
+// }
+// }
+// //add dr to rowList after all column is done.
+// if(!topDown) {
+// rowList.add(dr);
+// }
+// } // for
+//
+// //String totalSql = raptorRunHandler.getTotalSql();
+// if(nvls(totalSql).length()>0) {
+// ds = ConnectionUtils.getDataSet(totalSql,rr.getDbInfo());
+// DataRow dr = new DataRow();
+// DataValue dv = new DataValue();
+//
+// //dv.setColName("#");
+// int count = 0;
+// for (int c = 0; c < reportCols.size(); c++) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// if ( dct != null && dct.isVisible()) {
+// count++;
+//
+// dv = new DataValue();
+// dv.setVisible(dct.isVisible());
+//
+// if(count==1) {
+// dr.addDataValue(dv);
+// dv.setDisplayValue("Total (for all Records)");
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setBold(true);
+// } else {
+// if(dv.isVisible())
+// dr.addDataValue(dv);
+//
+// String totalValue = "";
+// if (ds != null)
+// totalValue = ds.getString(0, "TOTAL_"+dct.getColId());
+// if (nvls(dct.getDisplayTotal()).length() > 0
+// && (!dct.getDisplayTotal().equals(AppConstants.TOTAL_SUM_ID)))
+// totalValue = nvls(AppConstants.TOTAL_FUNCTIONS.getNameById(dct
+// .getDisplayTotal()))
+// + ": " + totalValue;
+// dv.setDisplayValue(Utils.truncateTotalDecimals(totalValue));
+//
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// /*StringBuffer indentation = new StringBuffer("");
+// if(dct.getIndentation()!=null && dct.getIndentation()>0) {
+// for (int indent=0; indent< dct.getIndentation(); indent++) {
+// indentation.append("\t");
+// }
+// dv.setNowrap("true");
+// }
+// dv.setIndentation(indentation.toString());*/
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setBold(true) ;
+// }
+// } // dct check
+// } // for
+// if(!topDown) {
+// rowList.add(dr);
+// }
+//
+// }
+//
+//
+// } catch (ReportSQLException ex) {
+// ex.printStackTrace();
+// }catch(Exception ex1) {
+// ex1.printStackTrace();
+// } finally {
+// try {
+// clearConnection(con);
+// } catch (ReportSQLException ex2) {
+// ex2.printStackTrace();
+// }
+// }
+// return rowList;
+// }
+
+ public String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public static String nvls(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public static String nvl(String s, String sDefault) {
+ return nvls(s).equals("") ? sDefault : s;
+ }
+
+
+
+ public static DataSource getDataSource() {
+ return dataSource;
+ }
+
+ @Autowired
+ public void setDataSource(DataSource dataSource) {
+ dataSource = dataSource;
+ }
+
+
+// public static List executeQuery(ReportRuntime rr, String filterClause, int itemStartNumber, int itemEndNumber, boolean topDown, String _orderBy, boolean asc, RaptorHiveRunHandler raptorHiveRunHandler) {
+// Connection con = null;
+// List rowList = new ArrayList();
+// ReportData rd = null;
+//
+// try {
+//
+//
+//
+// con = ConnectionUtils.getConnection(rr.getDBInfo());
+// //if client side sorting is needed we could disable the comment line below for quicker development
+// // until we do it in "client" end.
+// //StringBuffer sql = new StringBuffer(rr.getReportSQLWithRowNum());
+// StringBuffer sql = new StringBuffer("");
+// sql.append(rr.getWholeSQL());
+// int count = rr.getReportDataSize();
+// System.out.println("Count "+ count+ " " + itemEndNumber);
+// if(count < itemEndNumber)
+// sql.append(" " + "limit "+ count);
+// else
+// sql.append(" " + "limit "+ itemEndNumber);
+// //sql = new StringBuffer(raptorHiveRunHandler.getReportSQLWithRowNum(_orderBy, asc));
+// //if( /*itemEndNumber > 1 &&*/ itemEndNumber > itemStartNumber)
+// //sql.append(" WHERE ROWNUM <= " + (topDown?itemEndNumber:(itemEndNumber+1)));
+// //sql.append(" ) y WHERE rnum >= " + (topDown?itemStartNumber:(itemStartNumber+1)));
+// //if(nvls(_orderBy).length()>0)
+// //sql.append(" ORDER BY "+ _orderBy + " "+ (asc ? "ASC" : "DESC"));
+// //else
+// //sql.append(" ORDER BY rnum");
+// // sql = String.format(sql, _orderBy, asc ? "ASC" : "DESC");
+//
+// System.out.println("ZK RAPTOR RUN " + sql);
+//
+// String dbInfo = rr.getDBInfo();
+// DataSet ds = null;
+// ds = ConnectionUtils.getDataSet(sql.toString(), dbInfo);
+// List reportCols = rr.getAllColumns();
+// Vector formatProcessors = new Vector(reportCols.size());
+//
+// for (int r = itemStartNumber; r < ds.getRowCount(); r++) {
+// DataRow dr = new DataRow();
+// //rd.reportDataRows.addDataRow(dr);
+// //rd = raptorRunHandler.getReportData();
+// //RowHeaderCol rhc = new RowHeaderCol();
+// //reportRowHeaderCols.addRowHeaderCol(0, rhc);
+// //rhc.setColumnWidth("5%");
+//
+// int formatCount = -1; //added for auxillary head check
+// for (int c = 0; c < reportCols.size(); c++) {
+// if(reportCols.get(c)!=null) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// else formatCount++;
+// //
+// formatProcessors.add(formatCount,new FormatProcessor(
+// rr.getSemaphoreById(dct.getSemaphoreId()), dct.getColType(), dct
+// .getColFormat(), rr.getReportDefType().equals(
+// AppConstants.RD_SQL_BASED)));
+// //
+// if(!(dct.getColName().startsWith("[") && dct.getDisplayName() == null)) {
+// String value = "";
+// if(ds.getColumnIndex(dct.getColId())!= -1) {
+// value = ds.getString(r, dct.getColId());
+// }
+// if(nvls(value).length()>0 && !nvls(value).equals("'")) {
+// DataValue dv = new DataValue();
+// dr.addDataValue(dv);
+// dv.setDisplayValue(nvls(value));
+// dv.setColName(dct.getColName());
+// dv.setColId(dct.getColId());
+// if(dct.getColType().equals(AppConstants.CT_HYPERLINK)) {
+// dv.setHyperlinkURL(dct.getHyperlinkURL());
+// dv.setDisplayType(dct.getHyperlinkType());
+// if(dct.getHyperlinkType().equals("IMAGE"))
+// dv.setActionImg(dct.getActionImg());
+// }
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// //dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// if(dct.isVisible()) {
+//
+// dv.setVisible(true);
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setDisplayName(dct.getDisplayName());
+//
+// //Add Drilldown URL to dv
+// if (nvls(dct.getDrillDownURL()).length() > 0) {
+//
+// if(dv.getDisplayValue().length() > 0) {
+// dv.setDrillDownURL(raptorHiveRunHandler.parseDrillDownURL(r, /* c, */ds, dct,null));
+// dv.setDrillDowninPoPUp(dct.isDrillinPoPUp()!=null?dct.isDrillinPoPUp():false);
+// }
+//
+// if (dv.getDisplayValue().length() == 0) {
+// //dv.setDisplayValue("[NULL]");
+// dv.setDisplayValue("");
+// }
+// } // if
+//
+// } else {
+// dv.setVisible(false);
+// dv.setHidden(true);
+// }
+// //System.out.println("in Linear report b4" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+//
+// if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, false);
+//
+// //System.out.println("in Linear report After" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+//
+// if(topDown) {
+// if(!dv.getColId().endsWith("_calc") && dv.isVisible())
+// rowList.add(dv);
+// for (int cInner = 0; cInner < reportCols.size(); cInner++) {
+// if(reportCols.get(cInner)!=null) {
+// DataColumnType dctInner = (DataColumnType) reportCols.get(cInner);
+// if((dv.getColId()+"_calc").equals(dctInner.getColId())) {
+// /* DataValue dvInner = new DataValue();
+// dvInner.setDisplayValue(ds.getString(r, c));
+// dvInner.setColName(dct.getColName());
+// dvInner.setColId(dct.getColId());
+// rowList.add(dvInner);
+// */ dv.setDisplayCalculatedValue(ds.getString(r, dctInner.getColId()));
+// }
+// }
+// }
+// }
+// } else { //dv value check
+// DataValue dv = new DataValue();
+// dr.addDataValue(dv);
+// dv.setDisplayValue(nvls(value));
+// dv.setColName(dct.getColName());
+// dv.setColId(dct.getColId());
+// if(dct.isVisible())
+// dv.setVisible(true);
+// else
+// dv.setVisible(false);
+// if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, false);
+//
+// if(topDown) {
+// if(!dv.getColId().endsWith("_calc") && dv.isVisible())
+// rowList.add(dv);
+// for (int cInner = 0; cInner < reportCols.size(); cInner++) {
+// if(reportCols.get(cInner)!=null) {
+// DataColumnType dctInner = (DataColumnType) reportCols.get(cInner);
+// if((dv.getColId()+"_calc").equals(dctInner.getColId())) {
+// dv.setDisplayCalculatedValue(ds.getString(r, cInner));
+// }
+// }
+// }
+// }
+// }
+// }
+// } // if reportCols
+//
+//
+// } // for
+// //add dr to rowList after all column is done.
+// if(!topDown) {
+// rowList.add(dr);
+// }
+// } // for
+// } catch (ReportSQLException ex) {
+// ex.printStackTrace();
+// }catch(Exception ex1) {
+// ex1.printStackTrace();
+// } finally {
+// try {
+// clearConnection(con);
+// } catch (ReportSQLException ex2) {
+// ex2.printStackTrace();
+// }
+// }
+// return rowList;
+// }
+
+
+} // DbUtils
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ExecuteQuery.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ExecuteQuery.java
new file mode 100644
index 00000000..8d769d4f
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ExecuteQuery.java
@@ -0,0 +1,60 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.concurrent.Callable;
+
+public class ExecuteQuery implements Callable<ResultSet>{
+
+ private Statement stmt;
+ private String sql = "";
+ private int maxRowLimit;
+ private ResultSet resultSet;
+
+ public ResultSet getResultSet() {
+ return resultSet;
+ }
+ public void setResultSet(ResultSet resultSet) {
+ this.resultSet = resultSet;
+ }
+
+ public ExecuteQuery(Statement stmt, String sql, int maxRowLimit) {
+ super();
+ this.stmt = stmt;
+ this.sql = sql;
+ this.maxRowLimit = maxRowLimit;
+ }
+
+ public ResultSet call() throws SQLException {
+ try {
+ System.out.println("Query Started" + new java.util.Date());
+ resultSet = stmt.executeQuery(sql);
+ System.out.println("Query End" + new java.util.Date());
+ } catch (SQLException ex) {
+ System.out.println("Query Exception" + new java.util.Date());
+ ex.printStackTrace();
+ throw ex;
+ }
+ return resultSet;
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/Globals.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/Globals.java
new file mode 100644
index 00000000..f02600eb
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/Globals.java
@@ -0,0 +1,2282 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+
+/* ===========================================================================================
+ * This class is part of <I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I>
+ * Raptor : This tool is used to generate different kinds of reports with lot of utilities
+ * ===========================================================================================
+ *
+ * -------------------------------------------------------------------------------------------
+ * Globals.java - This class is used to read properties file and call the common methods
+ * existing among all the frameworks.
+
+ * -------------------------------------------------------------------------------------------
+ *
+ *
+ * Changes
+ * -------
+ * 31-Jul-2009 : Version 8.4 (Sundar); <UL><LI> getRequestparametersMap method iterates form field collections. </LI>
+ * </UL>
+ * 27-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Added property "admin_role_equiv_to_super_role" to specify Admin User equivalent to Super User.</LI>
+ * </UL>
+ * 14-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Added property to showing/hiding params displayed in dashboard reports.</LI>
+ * </UL>
+ *
+ */
+package org.openecomp.portalsdk.analytics.system;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.config.ConfigLoader;
+import org.openecomp.portalsdk.analytics.controller.ActionMapping;
+import org.openecomp.portalsdk.analytics.model.runtime.FormField;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportFormFields;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.ExcelColorDef;
+import org.openecomp.portalsdk.analytics.util.Scheduler;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class Globals extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(Globals.class);
+
+
+ private static boolean systemInitialized = false;
+
+ private static ActionMapping raptorActionMapping = null;
+
+ private static Scheduler scheduler = null;
+
+ // System type constants
+ public final static String ST_FUSION = "fusion";
+
+ public final static String ST_GENERIC = "generic";
+
+ public final static String ST_PRISMS = "prisms";
+
+ private static String systemType = ST_PRISMS; // default
+
+ private static IAppUtils appUtils = null;
+
+ private static IDbUtils dbUtils = null;
+
+ private static RDbUtils rdbUtils = null;
+
+ private static int debugLevel = 5;
+
+ private static int downloadLimit = 65000; // max number rows for download
+ // csv file
+
+ private static int defaultPageSize = 50;
+
+ private static int formFieldsListSize = 50;
+
+ private static int schedulerInterval = 0;
+
+ private static String systemName = "MSA Databank";
+
+ private static String baseTitle = "ANALYSIS";
+
+ private static String sheet_name = "Raptor Reports";
+
+ private static boolean allowSQLBasedReports = true; // whether to allow
+ // SQL-based report
+ // definition (security
+ // risk); super users
+ // are always allowed to
+ // create SQL-based
+ // reports
+
+ private static boolean showDisclaimer = true; // whether to include
+ // disclaimer page at the
+ // bottom of each screen
+
+ private static boolean displayFormBeforeRun = true; // whether to display
+ // the form page as a
+ // separate page before
+ // running the report
+
+ private static boolean includeFormWithData = true; // whether to include
+ // the form page on the
+ // report data page
+
+ private static boolean cacheChartData = true; // whether to cache chart
+ // data in the session =>
+ // faster re-display if the
+ // data volume does not get
+ // too large
+
+ private static boolean cacheCurPageData = true; // whether to cache report
+ // data for the currently
+ // displayed page in the
+ // session => faster
+ // re-display if the data
+ // volume does not get too
+ // large
+
+ private static boolean deleteOnlyByOwner = true; // whether to permit
+ // report deletion only
+ // by report owner or by
+ // everyone with "write"
+ // access
+
+ private static boolean enableReportLog = true; // whether to log each
+ // report execution and
+ // update time and user ID
+
+ private static boolean cacheUserRoles = true; // whether to cache user
+ // roles info in memory
+ // (saves many DB reads, but
+ // does not account for
+ // roles assigned after the
+ // cache was loaded)
+
+ private static boolean monthFormatUseLastDay = true; // whether to
+ // convert month
+ // formats (e.g.
+ // MM/YYYY) to the
+ // last day of the
+ // month (true) or
+ // first day (false)
+ // - like 12/2003 is
+ // converted to
+ // either 12/31/2003
+ // or 12/01/2003
+
+ private static boolean printTitleInDownload = false; // whether to print
+ // the report title
+ // in the download
+ // files
+
+ private static boolean showDescrAtRuntime = false; // whether to show
+ // report description
+ // when the report is
+ // run and in the quick
+ // links
+
+ // private static boolean skipChartLabelsToFit = false; // whether to skip
+ // labels on the Line chart axis when they overlap
+ private static boolean showNonstandardCharts = false; // whether to show
+ // chart types that
+ // are purpose
+ // and/or data
+ // specific
+
+ private static boolean allowRuntimeChartSel = true; // whether to allow the
+ // user to change the
+ // chart type at runtime
+
+ private static boolean displayChartTitle = false; // whether to display
+ // the report title as
+ // chart title as well
+
+ private static boolean mergeCrosstabRowHeadings = true; // whether to
+ // merge/blank
+ // multi-level row
+ // headings in
+ // cross-tab report
+
+ private static boolean displayChartByDefault = true; // whether to
+ // display chart
+ // when displaying
+ // the report at
+ // first or just a
+ // "Show Chart"
+ // button
+
+ private static boolean printParamsInDownload = false; // whether to print
+ // the form field
+ // values in the
+ // download files
+
+ // private static boolean chartLinesAlwaysSolid = true; // whether
+ // multi-lines chart uses solid line for all series or dashed/dotted/etc for
+ // each
+ // private static boolean chartLinesAlwaysSmooth = true; // whether line
+ // charts display smooth lines or with marked points on them for each value
+ private static int maxDecimalsOnTotals = 2; // Maximum number of decimals
+ // displayed in totals; decimal
+ // digits beyond that number
+ // will be truncated; if
+ // negative => display all
+ // decimal digits
+
+ private static int defaultChartWidth = 700;
+
+ private static int defaultChartHeight = 420;
+
+ private static int skipChartLabelsLimit = 30;
+
+ private static boolean canCopyOnReadOnly = true; // whether to users with
+ // read-only rights for
+ // a report can copy it
+
+ // Currently not loaded from a property file
+ private static boolean restrictTablesByRole = true; // whether to restrict
+ // DB tables
+ // accessibility by user
+ // role; defaults to
+ // false if table
+ // CR_TABLE_ROLE is
+ // empty, otherwise true
+
+ private static String javaTimeFormat = "MM/dd/yyyy h:m:s a";
+
+ private static String oracleTimeFormat = "%m/%d/%Y %h:%i:%s %p"; // must
+ // correspond
+ // to
+ // the
+ // java
+ // format
+ // modifier
+
+ private static String raptorVersion = "10.5.1";
+
+ private static int flatFileLowerLimit = 0;
+
+ private static int flatFileUpperLimit = 0;
+
+ private static String shellScriptDir = "";
+
+ private static String queryFolder = "";
+
+ private static String requestParams = "";
+
+ private static String sessionParams = "";
+
+ private static boolean displayAllUsers = true;
+
+ private static boolean user_col_def = true;
+
+ private static boolean printFooterInDownload = true;
+
+ private static String footerFirstLine = "";
+
+ private static String footerSecondLine = "";
+
+ private static boolean reportsInPoPUpWindow = false;
+
+ private static boolean poPUpInNewWindow = false;
+
+ private static boolean passRequestParamInDrilldown = false;
+
+ private static Properties raptorPdfProperties;
+
+ private static Properties raptorProperties;
+
+ private static Properties sqlProperty;
+
+ private static boolean showPDFDownloadIcon = false;
+
+
+
+ private Globals() {
+ }
+
+ public static synchronized void initializeSystem(ServletContext servletContext) {
+ if (systemInitialized)
+ return;
+ AppConstants.initializeAppConstants();
+ ExcelColorDef.initializeExcelColorDef();
+
+ //DB Agnostic Addition
+ try{
+ Properties sqlProperty = ConfigLoader.getProperties(servletContext, ConfigLoader.SQL_PROPERTIES);
+ Globals.sqlProperty = sqlProperty;
+ }
+
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ try {
+ Properties raptorProperties = ConfigLoader.getProperties(servletContext,
+ ConfigLoader.RAPTOR_PROPERTIES);
+ initializeRaptorProperties(raptorProperties);
+
+
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Globals: Unable to load properties ["
+ + ConfigLoader.RAPTOR_PROPERTIES + "]. Exception: " + e.getMessage()));
+ // throw new RuntimeException(e.getMessage());
+ }
+
+ systemInitialized = true;
+
+ try {
+ appUtils = (IAppUtils) Class.forName(
+ "org.openecomp.portalsdk.analytics.system." + systemType.toLowerCase() + ".AppUtils")
+ .newInstance();
+ appUtils.initializeAppUtils(servletContext);
+
+ dbUtils = (IDbUtils) Class.forName(
+ "org.openecomp.portalsdk.analytics.system." + systemType.toLowerCase() + ".DbUtils")
+ .newInstance();
+ dbUtils.initializeDbUtils(servletContext);
+
+ if(!Globals.getSystemType().equals(Globals.ST_GENERIC)) {
+ rdbUtils = (RDbUtils) Class.forName(
+ "org.openecomp.portalsdk.analytics.system." + systemType.toLowerCase() + ".RemoteDbUtils")
+ .newInstance();
+ rdbUtils.initializeDbUtils(servletContext);
+ }
+ } catch (Exception e) {
+ String eMsg = "[SYSTEM ERROR] Globals: Unable to instantiate system classes. Exception: "
+ + e.getMessage();
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] " + eMsg));
+ systemInitialized = false;
+ throw new RuntimeException(eMsg);
+ }
+
+ try {
+ raptorActionMapping = ConfigLoader.loadRaptorActionMapping(servletContext);
+ } catch (Exception e) {
+ String eMsg = "[SYSTEM ERROR] Globals: Unable to load Raptor action mapping. Exception: "
+ + e.getMessage();
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] " + eMsg));
+ systemInitialized = false;
+ throw new RuntimeException(eMsg);
+ } // catch
+
+ /*try {
+ //DataSet ds = DbUtils
+ // .executeQuery("SELECT 1 FROM dual WHERE EXISTS (SELECT 1 FROM cr_table_role)");
+
+ String p_sql = Globals.getInitializeRoles();
+ DataSet ds = DbUtils.executeQuery(p_sql);
+
+ restrictTablesByRole = (ds.getRowCount() > 0);
+ } catch (Exception e) {
+ String eMsg = "[SYSTEM ERROR] Globals: Unable to load Raptor version. Exception: "
+ + e.getMessage();
+ debugLogger.error("[EXCEPTION ENCOUNTERED IN RAPTOR] " + eMsg, e);
+ } // catch
+ */
+ /*try {
+ //DataSet ds = DbUtils.executeQuery("SELECT cr_raptor.get_version FROM dual");
+
+ //String n_sql = Globals.getInitializeVersion();
+ //DataSet ds = DbUtils.executeQuery(n_sql);
+ //raptorVersion = Globals.get
+ // if(ds.getRowCount()>0)
+ // raptorVersion = " v"+ds.getString(0, 0);
+ } catch (Exception e) {
+ String eMsg = "[SYSTEM ERROR] Globals: Unable to load Raptor version. Exception: "
+ + e.getMessage();
+ debugLogger.error("[EXCEPTION ENCOUNTERED IN RAPTOR] " + eMsg, e);
+ } // catch*/
+
+
+ //initiate pdf global config
+ try {
+ raptorPdfProperties = ConfigLoader.getProperties(servletContext, ConfigLoader.RAPTOR_PDF_PROPERTIES);
+ }
+ catch (Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Globals: Unable to load properties ["
+ + ConfigLoader.RAPTOR_PDF_PROPERTIES + "]. Exception: " + e.getMessage()));
+
+ }
+
+ scheduler = new Scheduler(schedulerInterval);
+
+ } // initializeSystem
+
+ public static void initializeRaptorProperties(Properties raptorProperties) {
+ Globals.raptorProperties = raptorProperties;
+ systemType = raptorProperties.getProperty("system");
+
+ try {
+ debugLevel = Integer.parseInt(nvls(raptorProperties
+ .getProperty("debug_level")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ downloadLimit = Integer.parseInt(nvls(raptorProperties
+ .getProperty("download_limit")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ defaultPageSize = Integer.parseInt(nvls(raptorProperties
+ .getProperty("default_page_size")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ formFieldsListSize = Integer.parseInt(nvls(raptorProperties
+ .getProperty("form_fields_list_size")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ schedulerInterval = Integer.parseInt(nvls(raptorProperties
+ .getProperty("scheduler_interval")).trim());
+ } catch (NumberFormatException nfe) {
+ System.out.println("NUMBERFORMATEXCEPTION Schedular " + raptorProperties
+ .getProperty("scheduler_interval"));
+ schedulerInterval = 0;
+ }
+
+ try {
+ maxDecimalsOnTotals = Integer.parseInt(nvls(raptorProperties
+ .getProperty("max_decimals_on_totals")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ defaultChartWidth = Integer.parseInt(nvls(raptorProperties
+ .getProperty("default_chart_width")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ defaultChartHeight = Integer.parseInt(nvls(raptorProperties
+ .getProperty("default_chart_height")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ skipChartLabelsLimit = Integer.parseInt(nvls(raptorProperties
+ .getProperty("skip_chart_labels_limit")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ systemName = nvls(raptorProperties.getProperty("system_name"), "MSA Databank");
+ baseTitle = nvls(raptorProperties.getProperty("base_title"), "ANALYSIS");
+
+
+ allowSQLBasedReports = nvls(
+ raptorProperties.getProperty("allow_sql_based_reports"), "yes")
+ .toUpperCase().startsWith("Y");
+ showDisclaimer = nvls(raptorProperties.getProperty("show_disclaimer"), "yes")
+ .toUpperCase().startsWith("Y");
+ displayFormBeforeRun = nvls(
+ raptorProperties.getProperty("display_form_before_run"), "yes")
+ .toUpperCase().startsWith("Y");
+ includeFormWithData = nvls(raptorProperties.getProperty("include_form_with_data"),
+ "yes").toUpperCase().startsWith("Y");
+ cacheChartData = nvls(raptorProperties.getProperty("cache_chart_data"), "yes")
+ .toUpperCase().startsWith("Y");
+ cacheCurPageData = nvls(raptorProperties.getProperty("cache_cur_page_data"), "yes")
+ .toUpperCase().startsWith("Y");
+ deleteOnlyByOwner = nvls(raptorProperties.getProperty("delete_only_by_owner"),
+ "yes").toUpperCase().startsWith("Y");
+ enableReportLog = nvls(raptorProperties.getProperty("enable_report_log"), "yes")
+ .toUpperCase().startsWith("Y");
+ cacheUserRoles = nvls(raptorProperties.getProperty("cache_user_roles"), "yes")
+ .toUpperCase().startsWith("Y");
+ monthFormatUseLastDay = nvls(
+ raptorProperties.getProperty("month_format_use_last_day"), "yes")
+ .toUpperCase().startsWith("Y");
+ printTitleInDownload = nvls(
+ raptorProperties.getProperty("print_title_in_download"), "no")
+ .toUpperCase().startsWith("Y");
+ showDescrAtRuntime = nvls(raptorProperties.getProperty("show_descr_at_runtime"),
+ "no").toUpperCase().startsWith("Y");
+ // skipChartLabelsToFit =
+ // nvls(raptorProperties.getProperty("skip_chart_labels_to_fit"),
+ // "no" ).toUpperCase().startsWith("Y");
+ showNonstandardCharts = nvls(
+ raptorProperties.getProperty("show_nonstandard_charts"), "no")
+ .toUpperCase().startsWith("Y");
+ allowRuntimeChartSel = nvls(
+ raptorProperties.getProperty("allow_runtime_chart_sel"), "yes")
+ .toUpperCase().startsWith("Y");
+ displayChartTitle = nvls(raptorProperties.getProperty("display_chart_title"), "no")
+ .toUpperCase().startsWith("Y");
+ mergeCrosstabRowHeadings = nvls(
+ raptorProperties.getProperty("merge_crosstab_row_headings"), "yes")
+ .toUpperCase().startsWith("Y");
+ displayChartByDefault = nvls(
+ raptorProperties.getProperty("display_chart_by_default"), "yes")
+ .toUpperCase().startsWith("Y");
+ //System.out.println("Params Globals " + raptorProperties.getProperty("print_params_in_download"));
+
+ printParamsInDownload = nvls(
+ raptorProperties.getProperty("print_params_in_download"), "no")
+ .toUpperCase().startsWith("Y");
+ //System.out.println("printParamsInDownload " + printParamsInDownload);
+
+ canCopyOnReadOnly = nvls(raptorProperties.getProperty("can_copy_on_read_only"),
+ "yes").toUpperCase().startsWith("Y");
+ // chartLinesAlwaysSolid =
+ // nvls(raptorProperties.getProperty("chart_lines_always_solid"),
+ // "yes").toUpperCase().startsWith("Y");
+ // chartLinesAlwaysSmooth =
+ // nvls(raptorProperties.getProperty("chart_lines_always_smooth"),
+ // "yes").toUpperCase().startsWith("Y");
+ displayAllUsers = nvls(
+ raptorProperties.getProperty("display_all_users"), "yes")
+ .toUpperCase().startsWith("Y");
+ requestParams = nvls(
+ raptorProperties.getProperty("request_get_params"), "");
+ sessionParams = nvls(
+ raptorProperties.getProperty("session_params"), "");
+ user_col_def = nvls(
+ raptorProperties.getProperty("user_col_def"), "no")
+ .toUpperCase().startsWith("Y");
+ sheet_name = nvls(raptorProperties.getProperty("sheet_name"), "Raptor Reports");
+ try {
+ flatFileLowerLimit = Integer.parseInt(raptorProperties
+ .getProperty("flat_file_lower_limit"));
+ } catch (NumberFormatException nfe) {
+ }
+ try {
+ flatFileUpperLimit = Integer.parseInt(raptorProperties
+ .getProperty("flat_file_upper_limit"));
+ } catch (NumberFormatException nfe) {
+ }
+ shellScriptDir = nvls(raptorProperties.getProperty("shell_script_dir"), "");
+ //queryFolder = nvls(raptorProperties.getProperty("download_query_folder"), AppUtils.getTempFolderPath()+"../raptor/dwnld/query/");
+ queryFolder = nvls(raptorProperties.getProperty("download_query_folder"),"../raptor/dwnld/query/");
+
+
+ printFooterInDownload = nvls(
+ raptorProperties.getProperty("print_footer_in_download"), "no")
+ .toUpperCase().startsWith("Y");
+ footerFirstLine = nvls(raptorProperties.getProperty("footer_first_line"), "");
+ footerSecondLine = nvls(raptorProperties.getProperty("footer_second_line"), "Use Pursuant to Company Instructions");
+ reportsInPoPUpWindow = nvls(
+ raptorProperties.getProperty("report_in_popup_window"), "no")
+ .toUpperCase().startsWith("Y");
+ poPUpInNewWindow = nvls(
+ raptorProperties.getProperty("popup_in_new_window"), "no")
+ .toUpperCase().startsWith("Y") && reportsInPoPUpWindow;
+
+ passRequestParamInDrilldown = nvls(
+ raptorProperties.getProperty("pass_request_param_in_drilldown"), "yes")
+ .toUpperCase().startsWith("Y");
+ showPDFDownloadIcon = nvls(
+ raptorProperties.getProperty("show_pdf_download"), "no")
+ .toUpperCase().startsWith("Y");
+ }
+
+ /** *********************************************************************** */
+
+ public static ActionMapping getRaptorActionMapping() {
+ if (!systemInitialized)
+ throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+
+ return raptorActionMapping;
+ } // getRaptorActionMapping
+
+ public static String getSystemType() {
+ if (!systemInitialized)
+ throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+
+ return systemType;
+ } // getSystemType
+
+ public static IAppUtils getAppUtils() {
+ if (!systemInitialized)
+ throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+
+ return appUtils;
+ } // getAppUtils
+
+ public static IDbUtils getDbUtils() {
+ if (!systemInitialized)
+ throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+
+ return dbUtils;
+ } // getDbUtils
+
+ public static RDbUtils getRDbUtils() {
+ if (!systemInitialized)
+ throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+ return rdbUtils;
+ } // getDbUtils
+
+ /** *********************************************************************** */
+
+ public static int getDebugLevel() {
+ return debugLevel;
+ }
+
+ public static int getDownloadLimit() {
+ return downloadLimit;
+ }
+
+ public static int getCSVDownloadLimit() {
+ return Integer.parseInt(nvls(raptorProperties.getProperty("csv_download_limit"), new Integer(getDownloadLimit()).toString()).trim());
+ }
+
+ public static String getDownloadLimitAsText() {
+ return java.text.NumberFormat.getNumberInstance(java.util.Locale.US).format(
+ downloadLimit);
+ }
+
+ public static int getDefaultPageSize() {
+ return defaultPageSize;
+ }
+
+ public static int getFormFieldsListSize() {
+ return formFieldsListSize;
+ }
+
+ public static int getSchedulerInterval() {
+ return schedulerInterval;
+ }
+
+ public static String getBaseTitle() {
+ return baseTitle;
+ }
+
+ public static String getSystemName() {
+ return systemName;
+ }
+
+ public static boolean getAllowSQLBasedReports() {
+ return allowSQLBasedReports;
+ }
+
+ public static boolean getShowDisclaimer() {
+ return showDisclaimer;
+ }
+
+ public static boolean getDisplayFormBeforeRun() {
+ return displayFormBeforeRun;
+ }
+
+ public static boolean getIncludeFormWithData() {
+ return includeFormWithData;
+ }
+
+ public static boolean getCacheChartData() {
+ return cacheChartData;
+ }
+
+ public static boolean getCacheCurPageData() {
+ return cacheCurPageData;
+ }
+
+ public static boolean getDeleteOnlyByOwner() {
+ return deleteOnlyByOwner;
+ }
+
+ public static boolean getEnableReportLog() {
+ return enableReportLog;
+ }
+
+ public static boolean getCacheUserRoles() {
+ return cacheUserRoles;
+ }
+
+ public static boolean getMonthFormatUseLastDay() {
+ return monthFormatUseLastDay;
+ }
+
+ public static boolean getPrintTitleInDownload() {
+ return printTitleInDownload;
+ }
+
+ public static boolean getShowDescrAtRuntime() {
+ return showDescrAtRuntime;
+ }
+
+ // public static boolean getSkipChartLabelsToFit() { return
+ // skipChartLabelsToFit; }
+ public static boolean getShowNonstandardCharts() {
+ return showNonstandardCharts;
+ }
+
+ public static boolean getAllowRuntimeChartSel() {
+ return allowRuntimeChartSel;
+ }
+
+ public static boolean getDisplayChartTitle() {
+ return displayChartTitle;
+ }
+
+ public static boolean getMergeCrosstabRowHeadings() {
+ return mergeCrosstabRowHeadings;
+ }
+
+ public static boolean getDisplayChartByDefault() {
+ return displayChartByDefault;
+ }
+
+ public static boolean getPrintParamsInDownload() {
+ return printParamsInDownload;
+ }
+
+ public static boolean getCanCopyOnReadOnly() {
+ return canCopyOnReadOnly;
+ }
+
+ // public static boolean getChartLinesAlwaysSolid() { return
+ // chartLinesAlwaysSolid; }
+ // public static boolean getChartLinesAlwaysSmooth() { return
+ // chartLinesAlwaysSmooth; }
+ public static int getMaxDecimalsOnTotals() {
+ return maxDecimalsOnTotals;
+ }
+
+ public static int getDefaultChartWidth() {
+ return defaultChartWidth;
+ }
+
+ public static int getDefaultChartHeight() {
+ return defaultChartHeight;
+ }
+
+ public static int getSkipChartLabelsLimit() {
+ return skipChartLabelsLimit;
+ }
+
+ public static boolean getRestrictTablesByRole() {
+ return restrictTablesByRole;
+ }
+
+ public static String getJavaTimeFormat() {
+ return javaTimeFormat;
+ }
+
+ public static String getOracleTimeFormat() {
+ return oracleTimeFormat;
+ }
+
+ public static String getRaptorVersion() {
+ return raptorVersion;
+ }
+
+ public static boolean getDisplayAllUsers() {
+ return displayAllUsers;
+ }
+
+ public static boolean getUserColDef() {
+ return user_col_def;
+ }
+
+ public static String getSheetName() {
+ return sheet_name;
+ }
+
+ public static int getFlatFileLowerLimit() {
+ return flatFileLowerLimit;
+ }
+
+ public static int getFlatFileUpperLimit() {
+ return flatFileUpperLimit;
+ }
+
+
+ public static String getShellScriptDir() {
+ return shellScriptDir;
+ }
+
+ public static String getQueryFolder() {
+ return AppUtils.getTempFolderPath()+queryFolder;
+ }
+
+ public static String getRequestParams() {
+ return requestParams;
+ }
+
+ public static String getSessionParams() {
+ return sessionParams;
+ }
+
+ public static boolean getPrintFooterInDownload() {
+ return printFooterInDownload;
+ }
+
+ public static String getFooterFirstLine() {
+ return footerFirstLine;
+ }
+
+ public static String getFooterSecondLine() {
+ return footerSecondLine;
+ }
+
+ public static boolean getReportsInPoPUpWindow() {
+ return reportsInPoPUpWindow;
+ }
+
+ public static boolean getPoPUpInNewWindow() {
+ return poPUpInNewWindow;
+ }
+
+ public static boolean getPassRequestParamInDrilldown() {
+ return passRequestParamInDrilldown;
+ }
+
+
+ //pdf specific properties
+ public static float getDataFontSize() {
+ float size = 10f;
+
+ try {
+ size = Float.parseFloat(nvls(raptorPdfProperties.getProperty("pdf_data_font_size")).trim());
+ } catch (Exception ex) {
+
+ }
+ return size;
+ }
+
+ public static float getDataFontSizeOffset() {
+ float size = 9f;
+
+ try {
+ size = Float.parseFloat(nvls(raptorPdfProperties.getProperty("pdf_data_font_size_offset")).trim());
+ } catch (Exception ex) {
+
+ }
+ return size;
+ }
+
+ public static float getFooterFontSize() {
+ float size = 9f;
+
+ try {
+ size = Float.parseFloat(nvls(raptorPdfProperties.getProperty("pdf_footer_font_size")).trim());
+ } catch (Exception ex) {
+
+ }
+ return size;
+ }
+
+ public static int getPageNumberPosition() {
+ int size = 1;
+
+ try {
+ size = Integer.parseInt(nvls(raptorPdfProperties.getProperty("pdf_page_number_position")).trim());
+ } catch (Exception ex) {
+
+ }
+ return size;
+ }
+
+ public static String getDataFontFamily() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_data_font_family"),"Arial").trim();
+ }
+
+ public static String getFooterFontFamily() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_footer_font_family"),"Arial").trim();
+ }
+
+ public static boolean isCoverPageNeeded() {
+
+ return nvls(raptorPdfProperties.getProperty("display_cover_page"),"true").trim().equalsIgnoreCase("true");
+ }
+
+ public static boolean isDataAlternateColor() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_data_alternate_color"),"true").trim().equalsIgnoreCase("true");
+ }
+
+ public static String getAttProprietary() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_att_proprietary"));
+ }
+
+ public static boolean isCreatedOwnerInfoNeeded() {
+ return nvls(raptorPdfProperties.getProperty("display_create_owner_info"),"true").trim().equalsIgnoreCase("true");
+ }
+
+ // Selected Form field section in the run page
+ public static boolean displayFormFieldInfo() {
+ return nvls(raptorProperties.getProperty("display_formfield_info"),"no").trim().toUpperCase().startsWith("Y");
+ }
+
+ // Customize Form field section in the run page
+ public static boolean customizeFormFieldInfo() {
+ return nvls(raptorProperties.getProperty("customize_formfield_info"),"no").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean displayLoginIdForDownloadedBy() {
+ return nvls(raptorPdfProperties.getProperty("display_loginid_for_downloaded_by"),"false").trim().equalsIgnoreCase("true");
+ }
+
+ public static boolean isDefaultOrientationPortrait() {
+ return nvls(raptorPdfProperties.getProperty("is_default_orientation_portrait"),"true").trim().equalsIgnoreCase("true");
+ }
+
+ public static String getSessionInfoForTheCoverPage() {
+ return nvls(raptorPdfProperties.getProperty("session_info"));
+ }
+
+ public static String getDatePattern() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_date_pattern"),"MM/dd/yyyy hh:mm:ss a");
+ }
+
+ public static String getTimeZone() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_date_timezone"),"EST");
+ }
+
+ public static String getWordBeforePageNumber() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_word_before_page_number"));
+ }
+
+ public static String getWordAfterPageNumber() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_word_after_page_number"));
+ }
+
+ public static float getAttProprieraryFontSize() {
+ float size = 7f;
+
+ try {
+ size = Float.parseFloat(nvls(raptorPdfProperties.getProperty("pdf_att_proprierary_font_size")).trim());
+ } catch (Exception ex) {
+
+ }
+ return size;
+ }
+
+ public static String getDataBackgroundAlternateHexCode() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_data_background_alternate_hex_code"),"#FFFFFF");
+ }
+
+ public static String getDataDefaultBackgroundHexCode() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_data_default_background_hex_code"),"#FFFFFF");
+ }
+
+ public static String getDataTableHeaderFontColor() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_data_table_header_font_hex_code"),"#FFFFFF");
+ }
+
+ public static String getDataTableHeaderBackgroundFontColor() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_data_table_header_background_hex_code"),"#8A9BB3");
+ }
+
+ public static boolean isFolderTreeAllowed() {
+ return nvls(raptorProperties.getProperty("show_folder_tree"),"yes").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean isFolderDefaultMinimized() {
+ return nvls(raptorProperties.getProperty("folder_tree_minimized"),"no").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean isFolderTreeAllowedOnlyForAdminUsers() {
+ return nvls(raptorProperties.getProperty("show_folder_tree_only_to_admin_users"),"yes").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static float getCoverPageFirstColumnSize() {
+ float size = 0.3f;
+
+ try {
+ size = Float.parseFloat(nvls(raptorPdfProperties.getProperty("pdf_coverpage_firstcolumn_size")).trim());
+ } catch (Exception ex) {
+
+ }
+ return size;
+ }
+
+ public static boolean isImageAutoRotate() {
+ return nvls(raptorPdfProperties.getProperty("pdf_image_auto_rotate"),"false").trim().equalsIgnoreCase("true");
+ }
+
+
+ public static boolean isShowPDFDownloadIcon() {
+ return showPDFDownloadIcon;
+ }
+
+
+ public static void setShowPDFDownloadIcon(boolean showPDFDownloadIcon) {
+ Globals.showPDFDownloadIcon = showPDFDownloadIcon;
+ }
+
+ public static int getScheduleLimit() {
+ int limit = 1000;
+ try {
+ limit = Integer.parseInt(nvls(raptorProperties.getProperty("schedule_limit")).trim());
+ } catch (Exception ex) {
+
+ }
+ return limit;
+ }
+
+// public static String getWhereConditionForUserRole() {
+// return nvls(raptorProperties.getProperty("schedule_where_condition"),"").trim();
+// }
+ public static String getCustomizedScheduleQueryForUsers() {
+ return nvls(raptorProperties.getProperty("schedule_custom_query_for_users"),"").trim();
+ }
+
+ public static String getCustomizedScheduleQueryForRoles() {
+ return nvls(raptorProperties.getProperty("schedule_custom_query_for_roles"),"").trim();
+ }
+
+ public static String getScheduleDatePattern() {
+ return nvls(raptorProperties.getProperty("schedule_date_pattern"),"MM/dd/yyyy hh:mm:ss a");
+ }
+
+ public static String getChartYearlyPattern() {
+ return nvls(raptorProperties.getProperty("chart_yearly_format"),"yyyy");
+ }
+
+ public static String getChartMonthlyPattern() {
+ return nvls(raptorProperties.getProperty("chart_monthly_format"),"MMM-yyyy");
+ }
+
+ public static String getChartDailyPattern() {
+ return nvls(raptorProperties.getProperty("chart_daily_format"),"MM-dd-yyyy");
+ }
+
+ public static String getChartWeeklyPattern() {
+ return nvls(raptorProperties.getProperty("chart_weekly_format"),"MM-dd-yyyy");
+ }
+
+ public static String getChartHourlyPattern() {
+ return nvls(raptorProperties.getProperty("chart_hourly_format"),"HH");
+ }
+
+ public static String getChartMinutePattern() {
+ return nvls(raptorProperties.getProperty("chart_minute_format"),"HH:mm");
+ }
+
+ public static String getChartSecPattern() {
+ return nvls(raptorProperties.getProperty("chart_second_format"),"HH:mm:ss");
+ }
+
+ public static String getChartMilliSecPattern() {
+ return nvls(raptorProperties.getProperty("chart_millisecond_format"),"HH:mm:ss.S");
+ }
+
+ public static String getSessionParamsForScheduling() {
+ return nvls(raptorProperties.getProperty("session_params_for_scheduling"),"");
+ }
+
+ public static String getDisplaySessionParamInPDFEXCEL() {
+ return nvls(raptorProperties.getProperty("display_session_param_pdfexcel"),"");
+ }
+
+ public static String getDisplayScheduleSessionParamInPDFEXCEL() {
+ return nvls(raptorProperties.getProperty("session_params_for_displaying_in_scheduling"),"");
+ }
+
+ public static boolean isScheduleDateParamAutoIncr() {
+ return nvls(raptorProperties.getProperty("session_date_formfield_auto_incr"),"yes").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static int getMaxCellWidthInExcel() {
+ int cellWidth = 40;
+ try {
+ cellWidth = Integer.parseInt(nvls(raptorProperties.getProperty("max_cell_width_in_excel")).trim());
+ } catch (Exception ex) {
+
+ }
+ return cellWidth;
+ }
+
+ public static synchronized int getFormFieldsCount(HttpServletRequest request)
+ {
+ if(request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME) == null )
+ {
+ return 0;
+ }
+
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+
+ ReportFormFields rff = rr.getReportFormFields();
+
+ int idx = 0;
+ FormField ff = null;
+ Map fieldNameMap = new HashMap();
+ int countOfFields = 0 ;
+ for(rff.resetNext(); rff.hasNext(); idx++) {
+ ff = rff.getNext();
+ fieldNameMap.put(ff.getFieldName(), ff.getFieldDisplayName());
+ countOfFields++;
+ }
+ return countOfFields;
+
+ }
+
+ public static synchronized java.util.HashMap getRequestParametersMap(HttpServletRequest request, HashMap paramsMap) {
+ HashMap valuesMap = new HashMap();
+ if(paramsMap.size() <= 0) {
+ return valuesMap;
+ }
+
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+ if(rr.getReportType().equals(AppConstants.RT_DASHBOARD)) {
+ rr = (ReportRuntime) request.getSession().getAttribute("FirstDashReport");
+ }
+ ReportFormFields rff = rr.getReportFormFields();
+
+ int idx = 0;
+ FormField ff = null;
+
+ Map fieldNameMap = new HashMap();
+ int countOfFields = 0 ;
+
+
+ for(rff.resetNext(); rff.hasNext(); idx++) {
+ ff = rff.getNext();
+ fieldNameMap.put(ff.getFieldName(), ff.getFieldDisplayName());
+ countOfFields++;
+ }
+
+ List formParameter = new ArrayList();
+ String formField = "";
+
+ for(int i = 0 ; i < rff.size(); i++) {
+ ff = ((FormField)rff.getFormField(i));
+ formField = ff.getFieldName();
+
+ if(paramsMap.containsKey(formField) ) {
+ String vals = (String) paramsMap.get(formField);
+ StringBuffer value = new StringBuffer("");
+ boolean isMultiValue = false;
+ isMultiValue = ff.getFieldType().equals(FormField.FFT_CHECK_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI);
+ boolean isTextArea = (ff.getFieldType().equals(FormField.FFT_TEXTAREA) && rr.getReportDefType()
+ .equals(AppConstants.RD_SQL_BASED));
+
+ if(isMultiValue) {
+ value.append("(");
+ }
+ StringTokenizer st = new StringTokenizer(vals, "|");
+ if(st.countTokens()>0) {
+ while(st.hasMoreTokens()) {
+ if(isMultiValue) value.append("'");
+ String token = st.nextToken();
+ try {
+ if(token !=null && token.length() > 0)
+ token = java.net.URLDecoder.decode(token, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {}
+ catch (IllegalArgumentException ex1){}
+ catch (Exception ex2){}
+ value.append(token);
+ if(isMultiValue) value.append("'");
+ if(st.hasMoreTokens()) {
+ value.append(",");
+ }
+ }
+ } else {
+ String valueStr = "";
+ valueStr = request.getParameter(formField);
+ valueStr = Utils.oracleSafe(valueStr);
+ valueStr = "('" + Utils.replaceInString(valueStr, ",", "'|'") + "')";
+ valueStr = Utils.replaceInString(valueStr, "|", ",");
+ valuesMap.put(fieldNameMap.get(formField), valueStr);
+ valueStr = "";
+ }
+ if(isMultiValue) value.append(")");
+
+ valuesMap.put(fieldNameMap.get(formField), value.toString());
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ String valueStr = "";
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR)) {
+ valueStr = (String) paramsMap.get(formField +"_Hr");
+ valuesMap.put(formField+"_Hr", valueStr);
+ valueStr = "";
+ } else if (ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)) {
+ valueStr =(String) paramsMap.get(formField +"_Hr");
+ valuesMap.put(formField+"_Hr", valueStr);
+ valueStr = "";
+ valueStr = (String) paramsMap.get(formField +"_Min");
+ valuesMap.put(formField+"_Min", valueStr);
+ valueStr = "";
+ } else if (ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ valueStr = (String) paramsMap.get(formField +"_Hr");
+ valuesMap.put(formField+"_Hr", valueStr);
+ valueStr = "";
+ valueStr =(String) paramsMap.get(formField +"_Min");
+ valuesMap.put(formField+"_Min", valueStr);
+ valueStr = "";
+ valueStr = (String) paramsMap.get(formField +"_Sec");
+ valuesMap.put(formField+"_Sec", valueStr);
+ valueStr = "";
+ }
+ }
+
+ value = new StringBuffer("");
+
+ } else if (paramsMap.containsKey(formField +"_auto")) {
+ String vals = (String) paramsMap.get(formField +"_auto");
+ StringBuffer value = new StringBuffer("");
+ boolean isMultiValue = false;
+ isMultiValue = ff.getFieldType().equals(FormField.FFT_CHECK_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI);
+ boolean isTextArea = (ff.getFieldType().equals(FormField.FFT_TEXTAREA) && rr.getReportDefType()
+ .equals(AppConstants.RD_SQL_BASED));
+
+ if(isMultiValue) {
+ value.append("(");
+ }
+ StringTokenizer st = new StringTokenizer(vals, "|");
+ if(st.countTokens()>0) {
+ while(st.hasMoreTokens()) {
+ if(isMultiValue) value.append("'");
+ String token = st.nextToken();
+ try {
+ if(token !=null && token.length() > 0)
+ token = java.net.URLDecoder.decode(Utils.oracleSafe(token), "UTF-8");
+ } catch (UnsupportedEncodingException ex) {}
+ catch (IllegalArgumentException ex1){}
+ catch (Exception ex2){}
+ value.append(token);
+ if(isMultiValue) value.append("'");
+ if(st.hasMoreTokens()) {
+ value.append(",");
+ }
+ }
+ } else {
+ String valueStr = "";
+ valueStr = request.getParameter(formField +"_auto");
+ valueStr = "('" + Utils.replaceInString(valueStr, ",", "'|'") + "')";
+ valueStr = Utils.replaceInString(valueStr, "|", ",");
+ valuesMap.put(fieldNameMap.get(formField), valueStr);
+ valueStr = "";
+ }
+ if(isMultiValue) value.append(")");
+
+ valuesMap.put(fieldNameMap.get(formField), value.toString());
+
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ String valueStr = "";
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR)) {
+ valueStr = (String) paramsMap.get(formField +"_Hr");
+ valuesMap.put(formField+"_Hr", valueStr);
+ valueStr = "";
+ } else if (ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)) {
+ valueStr = (String) paramsMap.get(formField +"_Hr");
+ valuesMap.put(formField+"_Hr", valueStr);
+ valueStr = "";
+ valueStr = (String) paramsMap.get(formField +"_Min");
+ valuesMap.put(formField+"_Min", valueStr);
+ valueStr = "";
+ } else if (ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ valueStr = (String) paramsMap.get(formField +"_Hr");
+ valuesMap.put(formField+"_Hr", valueStr);
+ valueStr = "";
+ valueStr = (String) paramsMap.get(formField +"_Min");
+ valuesMap.put(formField+"_Min", valueStr);
+ valueStr = "";
+ valueStr = (String) paramsMap.get(formField +"_Sec");
+ valuesMap.put(formField+"_Sec", valueStr);
+ valueStr = "";
+ }
+ }
+ value = new StringBuffer("");
+
+
+ } else
+ valuesMap.put(fieldNameMap.get(formField), "" );
+ }
+ return valuesMap;
+ }
+
+ public static synchronized java.util.HashMap getRequestParamtersMap(HttpServletRequest request) {
+ return getRequestParamtersMap(request, false);
+ }
+
+ public static synchronized java.util.HashMap getRequestParamtersMap(HttpServletRequest request, boolean isFromChild)
+ {
+ HashMap valuesMap = new HashMap();
+ ReportRuntime rr = null;
+ if(request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME) == null )
+ {
+ rr = (ReportRuntime) request.getSession().getAttribute("FirstDashReport");
+ if(rr==null)
+ return valuesMap;
+ }
+
+ rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+ if(rr!=null && rr.getReportType().equals(AppConstants.RT_DASHBOARD)) {
+ rr = (ReportRuntime) request.getSession().getAttribute("FirstDashReport");
+ }
+
+ ReportFormFields rff = rr.getReportFormFields();
+
+ int idx = 0;
+ FormField ff = null;
+
+ Map fieldNameMap = new HashMap();
+ int countOfFields = 0 ;
+
+
+ for(rff.resetNext(); rff.hasNext(); idx++) {
+ ff = rff.getNext();
+ fieldNameMap.put(ff.getFieldName(), ff.getFieldDisplayName());
+ countOfFields++;
+ }
+ if(isFromChild) {
+ Hashtable ht = rr.getReportParamValues();
+ Set set = ht.entrySet();
+ HashMap hashMap = new HashMap();
+ Iterator itr = set.iterator();
+ while(itr.hasNext()){
+ Map.Entry entry = (Map.Entry)itr.next();
+ Object key = entry.getKey();
+ Object val = entry.getValue();
+ if(key==null){
+ key = ""; // Or whatever you want
+ }
+ if(val==null){
+ val = ""; // Or whatever you want
+ }
+ hashMap.put(fieldNameMap.get((String)key),val);
+ }
+ return hashMap;
+
+ } else {
+ List formParameter = new ArrayList();
+ String formField = "";
+
+// for(int i = 1 ; i < (countOfFields+1); i++)
+// {
+// formField ="ff"+i;
+//
+// if(request.getParameterValues(formField) != null && request.getParameterValues(formField).length > 1 )
+// {
+// String[] vals = request.getParameterValues(formField);
+// boolean isMultiValue = false;
+// StringBuffer value = new StringBuffer("");
+// if(vals.length > 1) {
+// isMultiValue = true;
+// value.append("(");
+// }
+// for(int j = 0 ; j < vals.length; j++)
+// {
+// if(isMultiValue) value.append("'");
+// try {
+// if(vals[j] !=null && vals[j].length() > 0)
+// value.append(java.net.URLDecoder.decode(vals[j], "UTF-8"));// + ",";
+// else
+// value.append(vals[j]);
+// } catch (UnsupportedEncodingException ex) {value.append(vals[j]);}
+// catch (IllegalArgumentException ex1){value.append(vals[j]);}
+// catch (Exception ex2){value.append(vals[j]);}
+//
+//
+// if(isMultiValue) value.append("'");
+//
+// if(j != vals.length -1) {
+// value.append(",");
+// }
+// }
+// if(vals.length > 1) {
+// value.append(")");
+// }
+//
+// //value = value.substring(0 , value.length());
+//
+// valuesMap.put(fieldNameMap.get(formField), value.toString());
+// value = new StringBuffer("");
+//
+// }
+// else if(request.getParameter(formField) != null)
+// {
+// String value = "";
+// value = request.getParameter(formField);
+// try {
+// if(value !=null && value.length() > 0)
+// value = java.net.URLDecoder.decode(request.getParameter(formField), "UTF-8");
+// } catch (UnsupportedEncodingException ex) {}
+// catch (IllegalArgumentException ex1){}
+// catch (Exception ex2){}
+// valuesMap.put(fieldNameMap.get(formField), value);
+//
+// }else
+// {
+// valuesMap.put(fieldNameMap.get(formField), "NULL" );
+// }
+// }
+ for(int i = 0 ; i < rff.size(); i++) {
+ ff = ((FormField)rff.getFormField(i));
+ formField = ff.getFieldName();
+ boolean isMultiValue = false;
+ isMultiValue = ff.getFieldType().equals(FormField.FFT_CHECK_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI);
+ boolean isTextArea = (ff.getFieldType().equals(FormField.FFT_TEXTAREA) && rr.getReportDefType()
+ .equals(AppConstants.RD_SQL_BASED));
+
+ if(request.getParameterValues(formField) != null && isMultiValue ) {
+ String[] vals = request.getParameterValues(formField);
+ StringBuffer value = new StringBuffer("");
+ if(!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_ACTION)) {
+
+ if ( isMultiValue ) {
+ value.append("(");
+ }
+ for(int j = 0 ; j < vals.length; j++) {
+ if(isMultiValue) value.append("'");
+ try {
+ if(vals[j] !=null && vals[j].length() > 0) {
+ vals[j] = Utils.oracleSafe(vals[j]);
+ value.append(java.net.URLDecoder.decode(vals[j], "UTF-8"));// + ",";
+ }
+ else
+ value.append(vals[j]);
+ } catch (UnsupportedEncodingException ex) {value.append(vals[j]);}
+ catch (IllegalArgumentException ex1){value.append(vals[j]);}
+ catch (Exception ex2){
+ value.append(vals[j]);
+ }
+
+
+ if(isMultiValue) value.append("'");
+
+ if(j != vals.length -1) {
+ value.append(",");
+ }
+ }
+ if(vals.length > 0) {
+ value.append(")");
+ }
+ }
+
+ //value = value.substring(0 , value.length());
+
+ valuesMap.put(fieldNameMap.get(formField), value.toString());
+ value = new StringBuffer("");
+ } else if(request.getParameter(formField) != null) {
+ if(isTextArea) {
+ String value = "";
+ value = request.getParameter(formField);
+/* try {
+ value = java.net.URLDecoder.decode(value, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {}
+ catch (IllegalArgumentException ex1){}
+ catch (Exception ex2){}
+*/
+ value = Utils.oracleSafe(value);
+ value = "('" + Utils.replaceInString(value, ",", "'|'") + "')";
+ value = Utils.replaceInString(value, "|", ",");
+ valuesMap.put(fieldNameMap.get(formField), value);
+ value = "";
+ } else {
+ String value = "";
+ if(!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_ACTION))
+ value = request.getParameter(formField);
+ /*try {
+ value = java.net.URLDecoder.decode(value, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {}
+ catch (IllegalArgumentException ex1){}
+ catch (Exception ex2){}
+*/
+ valuesMap.put(fieldNameMap.get(formField), Utils.oracleSafe(value));
+ }
+
+ } else {
+ valuesMap.put(fieldNameMap.get(formField), "" );
+ }
+
+ }
+
+ return valuesMap;
+ }
+ }
+
+ //new method added to get the help message for schedule tab
+ public static String getScheduleHelpMessage() {
+ return nvls(raptorProperties.getProperty("schedule_help_text"),"").trim();
+ }
+
+ //new method added to get the help message for schedule tab
+ public static String getUseLoginIdInSchedYN() {
+ return nvls(raptorProperties.getProperty("use_loginid_in_schedYN"),"N").trim();
+ }
+
+ //new method to check if map is allowed or not
+ public static String getMapAllowedYN() {
+ return nvls(raptorProperties.getProperty("map_allowed"),"").trim();
+ }
+
+ //new method added to get gmap key
+ public static String getGmapKey() {
+ return nvls(raptorProperties.getProperty("gmap_key"),"").trim();
+ }
+
+// new method added to get gmap
+ public static String getProjectFolder() {
+ return nvls(raptorProperties.getProperty("PROJECT-FOLDER"),"").trim();
+ }
+
+
+ //new method added to get gmap
+ public static String getMarketShapefileFolder() {
+ return nvls(raptorProperties.getProperty("MARKET-SHAPEFILE-FOLDER"),"").trim();
+ }
+
+ //new method added to get gmap
+ public static String getTileSize() {
+ return nvls(raptorProperties.getProperty("TILE-SIZE"),"").trim();
+ }
+
+ // new method added to get gmap
+ public static String getOutputFolder() {
+ return nvls(raptorProperties.getProperty("OUTPUT-FOLDER"),"").trim();
+ }
+
+ //getting server details
+ public static boolean isWeblogicServer() {
+ return nvls(raptorProperties.getProperty("application_server"),"tomcat").trim().toUpperCase().startsWith("WEBLOGIC");
+ }
+
+ public static String getTempFolderURL() {
+ return nvls(AppUtils.getTempFolderURL(),"").trim();
+ }
+
+ public static int getMaxDrillDownLevel() {
+ int drillDownLevel = 1;
+ try {
+ drillDownLevel = Integer.parseInt(nvls(raptorProperties.getProperty("max_drilldown_level")).trim());
+ } catch (Exception ex) {
+
+ }
+ return drillDownLevel;
+ }
+
+ public static int getMemoryThreshold() {
+ int threshold = Integer.parseInt(nvls(raptorProperties.getProperty("memory_threshold_percentage"),"0").trim());
+ if(threshold <= 0) threshold = 0;
+ return threshold;
+ }
+
+ public static boolean showParamsInAllDashboardReports() {
+ return nvls(raptorProperties.getProperty("show_params_in_all_dashboard_reports"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean isAdminRoleEquivalenttoSuperRole() {
+ return nvls(raptorProperties.getProperty("admin_role_equiv_to_super_role"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean showLoadingMsgDuringFormFieldChain() {
+ return nvls(raptorProperties.getProperty("show_loading_during_formfield_chain"),"Y").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean showPrintIcon() {
+ return nvls(raptorProperties.getProperty("show_print_icon"),"Y").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean IsGlobalNoWrap() {
+ return nvls(raptorProperties.getProperty("globally_nowrap"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static String getCalendarOutputDateFormat() {
+ return nvls(raptorProperties.getProperty("calendar_output_date_format"),"MM/dd/yyyy");
+ }
+
+ public static String getUserDefinedMessageForMemoryLimitReached() {
+ return nvls(raptorProperties.getProperty("user_defined_message_memory_limit"),"Please note: Due to limited computing resource at this time,");
+ }
+
+ public static String getAdhocUserRoldId() {
+ return nvls(raptorProperties.getProperty("adhoc_user_roleId"),"");
+ }
+
+ public static String getAdhocReportSequence() {
+ return nvls(raptorProperties.getProperty("adhoc_report_sequence"),"");
+ }
+
+ public static boolean hideToolTipsGlobally() {
+ return nvls(raptorProperties.getProperty("hide_tooltips_in_chart"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean showScheduleIconBeforeRun() {
+ return nvls(raptorProperties.getProperty("show_schedule_icon_before_run"),"Y").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean hideRaptorFooter() {
+ return nvls(raptorProperties.getProperty("hide_raptor_footer"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean getPrintParamsInCSVDownload() {
+ return nvls(raptorProperties.getProperty("print_params_in_csv_download"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static String getLogVariablesInSession() {
+ return nvls(raptorProperties.getProperty("log_variable_in_session"), "");
+ }
+
+ public static boolean hideTitleInDashboard() {
+ return nvls(raptorProperties.getProperty("notitle_in_dashboard"), "N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static String getEncryptedSMTPServer() {
+ return nvls(raptorProperties.getProperty("secure_smtp_server"), "");
+ }
+
+ public static boolean generateSchedReportsInFileSystem() {
+ return nvls(raptorProperties.getProperty("generate_store_sched_reports"), "N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean showExcel2007DownloadIcon() {
+ return nvls(raptorProperties.getProperty("show_excel_2007_download"), "N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean printExcelInLandscapeMode() {
+ return nvls(raptorProperties.getProperty("print_excel_in_landscape"), "").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static String getAppDefinedMessageForSendingSchedAsAttachment() {
+ return nvls(raptorProperties.getProperty("app_defined_message_schedule_attachment"),"Send as Attachment");
+ }
+
+ public static String getReportEmptyMessage() {
+ return nvls(raptorProperties.getProperty("no_rows_found"),"Your Search didn't yield any results.");
+ }
+
+ public static boolean showAnimatedChartOption() {
+ return nvls(raptorProperties.getProperty("show_animated_chart_option"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean showAnimatedChartOnly() {
+ return nvls(raptorProperties.getProperty("show_animated_chart_only"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean adjustContentBasedOnHeight() {
+ return nvls(raptorProperties.getProperty("adjust_content_based_on_height"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean disclaimerPositionedTopInCSVExcel() {
+ return nvls(raptorProperties.getProperty("disclaimer_positioned_top_in_csvexcel"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static String customizedSubmitButtonText() {
+ return nvls(raptorProperties.getProperty("custom_submit_button_text"),"submit");
+ }
+
+ public static String customizedResetButtonText() {
+ return nvls(raptorProperties.getProperty("custom_reset_button_text"),"reset");
+ }
+ public static boolean customizeFormFieldLayout() {
+ return nvls(raptorProperties.getProperty("customize_formfield_layout"),"N").trim().toUpperCase().startsWith("Y");
+ }
+ public static String getRaptorTheme() {
+ return nvls(raptorProperties.getProperty("raptor_theme"),"default");
+ }
+
+ public static String getFormfieldAlignment() {
+ return nvls(raptorProperties.getProperty("formfield_alignment"),"left");
+ }
+
+ public static boolean displayExcelOptionInDashboard() {
+ return nvls(raptorProperties.getProperty("display_excel_option_in_dashboard"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean displayRuntimeOptionsAsDefault() {
+ return nvls(raptorProperties.getProperty("display_runtime_options_as_default"),"Y").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean displayHiddenFormfieldinExcel() {
+ return nvls(raptorProperties.getProperty("display_hidden_field_in_excel"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ //ReportLoader.java
+ public static String getLoadCustomReportXml(){
+ return nvls(sqlProperty.getProperty("load.custom.report.xml"));
+ }
+
+ public static String getDBUpdateReportXml(){
+ return nvls(sqlProperty.getProperty("db.update.report.xml"));
+ }
+
+ public static String getUpdateCustomReportRec(){
+ return nvls(sqlProperty.getProperty("update.custom.report.rec"));
+ }
+
+ public static String getIsReportAlreadyScheduled(){
+ return nvls(sqlProperty.getProperty("is.report.already.scheduled"));
+ }
+
+ public static String getCreateCustomReportRec(){
+ return nvls(sqlProperty.getProperty("create.custom.report.rec"));
+ }
+
+ public static String getTheUserReportNames(){
+ return nvls(sqlProperty.getProperty("get.user.report.names"));
+ }
+
+ public static String getTheReportOwnerId(){
+ return nvls(sqlProperty.getProperty("get.report.owner.id"));
+ }
+
+ public static String getReportSecurity(){
+ return nvls(sqlProperty.getProperty("report.security.create"));
+ }
+
+ public static String getDeleteReportRecordLog(){
+ return nvls(sqlProperty.getProperty("delete.report.record.log"));
+ }
+
+ public static String getDeleteReportRecordUsers(){
+ return nvls(sqlProperty.getProperty("delete.report.record.users"));
+ }
+
+ public static String getDeleteReportRecordSchedule(){
+ return nvls(sqlProperty.getProperty("delete.report.record.schedule"));
+ }
+
+ public static String getDeleteReportRecordAccess(){
+ return nvls(sqlProperty.getProperty("delete.report.record.access"));
+ }
+
+ public static String getDeleteReportRecordEmail(){
+ return nvls(sqlProperty.getProperty("delete.report.record.email"));
+ }
+
+ public static String getDeleteReportRecordFavorite(){
+ return nvls(sqlProperty.getProperty("delete.report.record.favorite"));
+ }
+
+ public static String getDeleteReportRecordReport(){
+ return nvls(sqlProperty.getProperty("delete.report.record.report"));
+ }
+
+ public static String getLoadQuickLinks(){
+ return nvls(sqlProperty.getProperty("load.quick.links"));
+ }
+
+ public static String getLoadFolderReports(){
+ return nvls(sqlProperty.getProperty("load.folder.reports"));
+ }
+
+ public static String getLoadFolderReportsUser(){
+ return nvls(sqlProperty.getProperty("load.folder.reports.user"));
+ }
+
+ public static String getLoadFolderReportsPublicSql(){
+ return nvls(sqlProperty.getProperty("load.folder.reports.publicsql"));
+ }
+
+ public static String getLoadQuickDownloadLinks(){
+ return nvls(sqlProperty.getProperty("load.quick.download.links"));
+ }
+
+ public static String getLoadReportsToSchedule(){
+ return nvls(sqlProperty.getProperty("load.reports.to.schedule"));
+ }
+
+ public static String getLoadReportsToAddInDashboard(){
+ return nvls(sqlProperty.getProperty("load.reports.to.add.in.dashboard"));
+ }
+
+ public static String getLoadMyRecentLinks(){
+ return nvls(sqlProperty.getProperty("load.my.recent.links"));
+ }
+
+ public static String getCreateReportLogEntry(){
+ return nvls(sqlProperty.getProperty("create.report.log.entry"));
+ }
+
+ public static String getCreateReportLogEntryExecTime(){
+ return nvls(sqlProperty.getProperty("create.report.log.entry.exec.time"));
+ }
+
+ public static String getClearReportLogEntries(){
+ return nvls(sqlProperty.getProperty("clear.report.log.entries"));
+ }
+
+ public static String getLoadReportLogEntries(){
+ return nvls(sqlProperty.getProperty("load.report.log.entries"));
+ }
+
+ public static String getDoesUserCanScheduleReport(){
+ return nvls(sqlProperty.getProperty("does.user.can.schedule.report"));
+ }
+
+ public static String getDoesUserCanSchedule(){
+ return nvls(sqlProperty.getProperty("does.user.can.schedule"));
+ }
+
+ public static String getTheSystemDateTime(){
+ return nvls(sqlProperty.getProperty("get.system.date.time"));
+ }
+
+ public static String getTheNextDayDateTime(){
+ return nvls(sqlProperty.getProperty("get.next.day.date.time"));
+ }
+
+ public static String getTheNextFifteenMinDateTime(){
+ return nvls(sqlProperty.getProperty("get.next.fifteen.minutes.date.time"));
+ }
+
+ public static String getTheNextThirtyMinDateTime(){
+ return nvls(sqlProperty.getProperty("get.next.thirty.minutes.date.time"));
+ }
+
+ public static String getTheTemplateFile(){
+ return nvls(sqlProperty.getProperty("get.template.file"));
+ }
+
+ public static String getLoadPdfImgLookup(){
+ return nvls(sqlProperty.getProperty("load.pdf.img.lookup"));
+ }
+
+ public static String getLoadActionImgLookup(){
+ return nvls(sqlProperty.getProperty("load.action.img.lookup"));
+ }
+
+ //ActionHandler.java
+
+ public static String getReportValuesMapDefA(){
+ return nvls(sqlProperty.getProperty("report.values.map.def.a"));
+ }
+ public static String getReportValuesMapDefB(){
+ return nvls(sqlProperty.getProperty("report.values.map.def.b"));
+ }
+ public static String getReportValuesMapDefC(){
+ return nvls(sqlProperty.getProperty("report.values.map.def.c"));
+ }
+ public static String getReportValuesMapDefD(){
+ return nvls(sqlProperty.getProperty("report.values.map.def.d"));
+ }
+
+ public static String getTestSchedCondPopup(){
+ return nvls(sqlProperty.getProperty("test.sched.cond.popup"));
+ }
+
+ public static String getDownloadAllEmailSent(){
+ return nvls(sqlProperty.getProperty("download.all.email.sent"));
+ }
+
+ public static String getDownloadAllGenKey(){
+ return nvls(sqlProperty.getProperty("download.all.gen.key"));
+ }
+
+ public static String getDownloadAllRetrieve(){
+ return nvls(sqlProperty.getProperty("download.all.retrieve"));
+ }
+
+ public static String getDownloadAllInsert(){
+ return nvls(sqlProperty.getProperty("download.all.insert"));
+ }
+
+ //ReportWrapper.java
+
+ public static String getReportWrapperFormat(){
+ return nvls(sqlProperty.getProperty("report.wrapper.format"));
+ }
+
+ public static String getGenerateSubsetSql(){
+ return nvls(sqlProperty.getProperty("generate.subset.sql"));
+ }
+
+ public static String getReportSqlForFormfield(){
+ return nvls(sqlProperty.getProperty("formfield.id.name.sql"));
+ }
+
+ public static String getReportSqlForFormfieldPrefix(){
+ return nvls(sqlProperty.getProperty("formfield.id.name.sql.prefix"));
+ }
+
+ public static String getReportSqlForFormfieldSuffix(){
+ return nvls(sqlProperty.getProperty("formfield.id.name.sql.suffix"));
+ }
+
+ public static String getReportSqlOnlyFirstPart(){
+ return nvls(sqlProperty.getProperty("report.sql.only.first.part"));
+ }
+
+ public static String getReportSqlOnlySecondPartA(){
+ return nvls(sqlProperty.getProperty("report.sql.only.second.part.a"));
+ }
+
+ public static String getReportSqlOnlySecondPartB(){
+ return nvls(sqlProperty.getProperty("report.sql.only.second.part.b"));
+ }
+
+ public static String getReportSqlOnlySecondPartBNoOrderBy(){
+ return nvls(sqlProperty.getProperty("report.sql.only.second.part.b.noorderby"));
+ }
+
+ public static String getGenerateSqlVisualSelect(){
+ return nvls(sqlProperty.getProperty("generate.sql.visual.select"));
+ }
+
+ public static String getGenerateSqlVisualCount(){
+ return nvls(sqlProperty.getProperty("generate.sql.visual.count"));
+ }
+
+ public static String getGenerateSqlVisualDual(){
+ return nvls(sqlProperty.getProperty("generate.sql.visual.select"));
+ }
+
+ //ReportRuntime.java
+
+ public static String getLoadCrosstabReportData(){
+ return nvls(sqlProperty.getProperty("load.crosstab.report.data"));
+ }
+
+ //ReportRunHandler.java
+
+ public static String getGenerateSqlHandler(){
+ return nvls(sqlProperty.getProperty("generate.sql.handler"));
+ }
+
+ public static String getGenerateSqlSelect(){
+ return nvls(sqlProperty.getProperty("generate.sql.select"));
+ }
+
+ public static String getRemoteDbSchemaSql() {
+ return nvls(sqlProperty.getProperty("load.remoteDB.schema"));
+ }
+
+ public static String getRemoteDbSchemaSqlWithWhereClause() {
+ return nvls(sqlProperty.getProperty("load.remoteDB.schema.where"));
+ }
+
+ //ReportSchedule.java
+
+ public static String getLoadScheduleData(){
+ return nvls(sqlProperty.getProperty("load.schedule.data"));
+ }
+
+ public static String getLoadScheduleGetId(){
+ return nvls(sqlProperty.getProperty("load.schedule.getid"));
+ }
+
+ public static String getLoadScheduleUsers(){
+ return nvls(sqlProperty.getProperty("load.schedule.users"));
+ }
+
+ public static String getNewScheduleData(){
+ return nvls(sqlProperty.getProperty("new.schedule.data"));
+ }
+
+ public static String getNewReportData(){
+ return nvls(sqlProperty.getProperty("new.report.data"));
+ }
+
+ public static String getExecuteUpdate(){
+ return nvls(sqlProperty.getProperty("execute.update"));
+ }
+
+ public static String getExecuteUpdateUsers(){
+ return nvls(sqlProperty.getProperty("execute.update.users"));
+ }
+
+ public static String getExecuteUpdateRoles(){
+ return nvls(sqlProperty.getProperty("execute.update.roles"));
+ }
+
+ public static String getExecuteUpdateActivity(){
+ return nvls(sqlProperty.getProperty("execute.update.activity"));
+ }
+
+ public static String getDeleteScheduleData(){
+ return nvls(sqlProperty.getProperty("delete.schedule.data"));
+ }
+
+ public static String getDeleteScheduleDataUsers(){
+ return nvls(sqlProperty.getProperty("delete.schedule.data.users"));
+ }
+
+ public static String getDeleteScheduleDataId(){
+ return nvls(sqlProperty.getProperty("delete.schedule.data.id"));
+ }
+
+ public static String getLoadCondSql(){
+ return nvls(sqlProperty.getProperty("load.cond.sql"));
+ }
+
+ public static String getLoadCondSqlSelect(){
+ return nvls(sqlProperty.getProperty("load.cond.sql.select"));
+ }
+
+ public static String getPersistCondSqlUpdate(){
+ return nvls(sqlProperty.getProperty("persist.cond.sql.update"));
+ }
+
+ public static String getPersistCondSqlLarge(){
+ return nvls(sqlProperty.getProperty("persist.cond.sql.large"));
+ }
+
+ public static String getPersistCondSqlSet(){
+ return nvls(sqlProperty.getProperty("persist.cond.sql.set"));
+ }
+
+ //DataCache.java
+
+ public static String getTheDataViewActions(){
+ return nvls(sqlProperty.getProperty("get.data.view.actions"));
+ }
+
+ public static String getThePublicReportIdNames(){
+ return nvls(sqlProperty.getProperty("get.public.report.id.names"));
+ }
+
+ public static String getThePrivateAccessibleNamesA(){
+ return nvls(sqlProperty.getProperty("get.private.accessible.names.a"));
+ }
+ public static String getThePrivateAccessibleNamesIf(){
+ return nvls(sqlProperty.getProperty("get.private.accessible.names.if"));
+ }
+ public static String getThePrivateAccessibleNamesB(){
+ return nvls(sqlProperty.getProperty("get.private.accessible.names.b"));
+ }
+
+ public static String getTheGroupAccessibleNamesA(){
+ return nvls(sqlProperty.getProperty("get.group.accessible.names.a"));
+ }
+
+ public static String getTheGroupAccessibleNamesB(){
+ return nvls(sqlProperty.getProperty("get.group.accessible.names.b"));
+ }
+
+ public static String getTheReportTableSourcesA(){
+ return nvls(sqlProperty.getProperty("get.report.table.sources.a"));
+ }
+
+ public static String getTheReportTableSourcesWhere(){
+ return nvls(sqlProperty.getProperty("get.report.table.sources.where"));
+ }
+
+ public static String getTheReportTableSourcesIf(){
+ return nvls(sqlProperty.getProperty("get.report.table.sources.if"));
+ }
+
+ public static String getTheReportTableSourcesElse(){
+ return nvls(sqlProperty.getProperty("get.report.table.sources.else"));
+ }
+
+ public static String grabTheReportTableA(){
+ return nvls(sqlProperty.getProperty("grab.report.table.a"));
+ }
+
+ public static String grabTheReportTableIf(){
+ return nvls(sqlProperty.getProperty("grab.report.table.if"));
+ }
+
+ public static String grabTheReportTableElse(){
+ return nvls(sqlProperty.getProperty("grab.report.table.else"));
+ }
+
+ public static String grabTheReportTableB(){
+ return nvls(sqlProperty.getProperty("grab.report.table.b"));
+ }
+
+ public static String grabTheReportTableC(){
+ return nvls(sqlProperty.getProperty("grab.report.table.c"));
+ }
+
+ public static String getTheReportTableCrJoin(){
+ return nvls(sqlProperty.getProperty("get.report.table.crjoin"));
+ }
+
+ public static String getTheReportTableJoins(){
+ return nvls(sqlProperty.getProperty("get.report.table.joins"));
+ }
+
+ public static String getGenerateReportTableCol(){
+ return nvls(sqlProperty.getProperty("generate.report.table.col"));
+ }
+
+
+ public static String getGenerateDbUserSqlA(){
+ return nvls(sqlProperty.getProperty("generate.db.user.sql.a"));
+ }
+
+ public static String getGenerateDbUserSqlIf(){
+ return nvls(sqlProperty.getProperty("generate.db.user.sql.if"));
+ }
+
+ public static String getGenerateDbUserSqlElse(){
+ return nvls(sqlProperty.getProperty("generate.db.user.sql.else"));
+ }
+
+ public static String getGenerateDbUserSqlB(){
+ return nvls(sqlProperty.getProperty("generate.db.user.sql.b"));
+ }
+
+ public static String getGenerateDbUserSqlC(){
+ return nvls(sqlProperty.getProperty("generate.db.user.sql.c"));
+ }
+
+ public static String getGenerateDbUserSqlD(){
+ return nvls(sqlProperty.getProperty("generate.db.user.sql.d"));
+ }
+
+ //SearchHandler.java
+
+ public static String getLoadReportSearchResult(){
+ return nvls(sqlProperty.getProperty("load.report.search.result"));
+ }
+
+ public static String getLoadReportSearchInstr(){
+ return nvls(sqlProperty.getProperty("load.report.search.instr"));
+ }
+
+ public static String getLoadReportSearchResultUser(){
+ return nvls(sqlProperty.getProperty("load.report.search.result.user"));
+ }
+
+ public static String getLoadReportSearchResultPublic(){
+ return nvls(sqlProperty.getProperty("load.report.search.result.public"));
+ }
+
+ public static String getLoadReportSearchResultFav(){
+ return nvls(sqlProperty.getProperty("load.report.search.result.fav"));
+ }
+
+ public static String getLoadReportSearchResultSort(){
+ return nvls(sqlProperty.getProperty("load.report.search.result.sort"));
+ }
+
+ public static String getLoadFolderReportResult(){
+ return nvls(sqlProperty.getProperty("load.folder.report.result"));
+ }
+
+ public static String getLoadFolderReportResultSort(){
+ return nvls(sqlProperty.getProperty("load.folder.report..result.sort"));
+ }
+
+ //WizardProcessor.java
+
+ public static String getProcessFilterAddEdit(){
+ return nvls(sqlProperty.getProperty("process.filter.add.edit"));
+ }
+
+ //ReportDefinition.java
+
+ public static String getPersistReportAdhoc(){
+ return nvls(sqlProperty.getProperty("persist.report.adhoc"));
+ }
+
+ //Globals.java
+ public static String getInitializeRoles(){
+ return nvls(sqlProperty.getProperty("initialize.roles"));
+ }
+
+ public static String getInitializeVersion(){
+ return nvls(sqlProperty.getProperty("initialize.version"));
+ }
+
+ public static String getDBType(){
+ return nvls(raptorProperties.getProperty("db_type"), "oracle");
+ }
+
+ public static boolean isPostgreSQL(){
+ return getDBType().equals("postgresql");
+ }
+ public static boolean isMySQL(){
+ return getDBType().equals("mysql");
+ }
+ public static boolean isOracle(){
+ return getDBType().equals("oracle");
+ }
+
+ //scheduler
+ public static String getAvailableSchedules(){
+ return nvls(sqlProperty.getProperty("scheduler.available.schedules"));
+ }
+
+ public static String getCurrentDateString(){
+ return nvls(sqlProperty.getProperty("current.date.string"));
+ }
+
+ public static String getSchedulerUserEmails(){
+ return nvls(sqlProperty.getProperty("scheduler.user.emails"));
+ }
+
+ public static String getSqlConvertToRaw(){
+ return nvls(sqlProperty.getProperty("convert.to.raw"));
+ }
+
+ public static Properties getRaptorPdfProperties() {
+ return raptorPdfProperties;
+ }
+
+ public static void setRaptorPdfProperties(Properties raptorPdfProperties) {
+ Globals.raptorPdfProperties = raptorPdfProperties;
+ }
+
+ public static Properties getRaptorProperties() {
+ return raptorProperties;
+ }
+
+ public static void setRaptorProperties(Properties raptorProperties) {
+ Globals.raptorProperties = raptorProperties;
+ }
+
+ public static Properties getSqlProperty() {
+ return sqlProperty;
+ }
+
+ public static void setSqlProperty(Properties sqlProperty) {
+ Globals.sqlProperty = sqlProperty;
+ }
+
+ public static String getSequenceNextVal() {
+ return nvls(sqlProperty.getProperty("seq.next.val"));
+ }
+
+ public static String getRandomString() {
+ return nvls(sqlProperty.getProperty("seq.next.val"));
+ }
+
+ public static String getReportUserAccess(){
+ return nvls(sqlProperty.getProperty("report.user.access"));
+ }
+
+ public static String getAddUserAccess(){
+ return nvls(sqlProperty.getProperty("add.user.access"));
+ }
+
+ public static String getUpdateUserAccess(){
+ return nvls(sqlProperty.getProperty("update.user.access"));
+ }
+
+ public static String getRemoveUserAccess(){
+ return nvls(sqlProperty.getProperty("remove.user.access"));
+ }
+
+ public static String getAddRoleAccess(){
+ return nvls(sqlProperty.getProperty("add.role.access"));
+ }
+
+ public static String getUpdateRoleAccess(){
+ return nvls(sqlProperty.getProperty("update.role.access"));
+ }
+
+ public static String getRemoveRoleAccess(){
+ return nvls(sqlProperty.getProperty("remove.role.access"));
+ }
+
+ public static boolean isSystemInitialized() {
+ return systemInitialized;
+ }
+} // Globals
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IAppUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IAppUtils.java
new file mode 100644
index 00000000..e239a3f9
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IAppUtils.java
@@ -0,0 +1,175 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system;
+
+import java.util.Vector;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+
+public interface IAppUtils {
+ void initializeAppUtils(ServletContext servletContext);
+
+ /** Returns ID of the user currently logged in */
+ String getUserID(HttpServletRequest request);
+
+ /** Obtains user name by ID */
+ String getUserName(HttpServletRequest request);
+ String getUserName(String userId);
+
+ /** Obtains user email by ID */
+ String getUserEmail(HttpServletRequest request);
+ String getUserEmail(String userId);
+
+ /** Obtains user login ID */
+ String getUserLoginId(HttpServletRequest request);
+ String getUserLoginId(String userId);
+
+ /** Obtains user back door log id */
+ String getUserBackdoorLoginId(HttpServletRequest request);
+
+ /** Obtains list of all users (in IdNameValue objects) */
+ Vector getAllUsers(String customizedQuery, String param, boolean isAdmin);
+
+ /** Obtains role name by ID */
+ String getRoleName(String roleId);
+
+ /** Obtains list of all roles (in IdNameValue objects) */
+ Vector getAllRoles(String customizedQuery, String param, boolean isAdmin);
+
+ /** Checks whether the user currently logged in has the specified role */
+ // boolean isUserInRole(HttpServletRequest request, String roleId);
+ /** Checks whether the specified user has the specified role */
+ boolean isUserInRole(HttpServletRequest request, String roleId) throws RaptorException ;
+
+ /**
+ * Returns Vector containing the IDs of all the roles to which the user
+ * currently logged in belongs
+ */
+ // Vector getUserRoles(HttpServletRequest request);
+ /**
+ * Returns Vector containing the IDs of all the roles to which the specified
+ * user belongs
+ */
+ Vector getUserRoles(HttpServletRequest request)throws RaptorException;
+
+ Vector getUserRoles(String userID)throws RaptorException;
+ /** Empties cached lists of app users and roles */
+ void resetUserCache();
+
+ /** Returns the ID of the super role (all powerful) */
+ String getSuperRoleID();
+
+ /** Returns Vector containing the IDs of all Admin roles */
+ Vector getAdminRoleIDs();
+
+ /** Returns Temp folder file path */
+ String getTempFolderPath();
+
+ /** Returns Upload folder file path */
+ String getUploadFolderPath();
+
+ /** Returns Temp folder web URL */
+ String getTempFolderURL();
+
+ /** Returns Upload folder web URL */
+ String getUploadFolderURL();
+
+ /** Returns SMTP server to be used for notifications */
+ String getSMTPServer()throws RaptorException ;
+
+ /** Returns Encrypted SMTP server to be used for notifications */
+ String getEncryptedSMTPServer()throws RaptorException ;
+
+ /**
+ * Returns email address used for the "From" field in the system
+ * notifications
+ */
+ String getDefaultEmailSender() throws RaptorException;
+
+ /** Returns the application error page */
+ String getErrorPage();
+
+ /** Returns the application error page with menu for fusion*/
+ String getErrorPageWMenu();
+
+ /** Returns path to the folder containing JSP pages */
+ String getJspContextPath();
+
+ /** Returns web URL of the folder containing the images */
+ String getImgFolderURL();
+
+ /** Returns web URL to the base raptor folder */
+ String getBaseFolderURL();
+
+ /** Returns the URL used for executing a report - system specific */
+ // String getReportExecuteActionURL();
+ /** Returns the URL used for displaying data record - system specific */
+ // String getDataViewActionURL();
+ /**
+ * Returns the parameter name of the ID value used for displaying data
+ * record - system specific
+ */
+ // String getDataViewActionParam();
+ /** Returns full web URL for direct access to execute a report */
+ String getDirectAccessURL();
+
+ /** Returns the URL of the controller servlet - system specific */
+ String getBaseActionURL();
+
+ /** Returns the base URL of the NG report - system specific */
+ String getBaseActionURLNG();
+
+ /** Returns the URL of the Report Run specifc to AngularJS */
+ String getDrillActionURL();
+
+ /** Returns the primary parameter name - system specific */
+ String getBaseActionParam();
+
+ /** Returns Vector containing menu IDs for quick links */
+ Vector getQuickLinksMenuIDs();
+
+ /** Obtains menu label by ID */
+ String getMenuLabel(String menuId);
+
+ /**
+ * SQL for loading the screen labels and restricting to active cols only for
+ * report columns; can return null => use straight data dictionary For
+ * PRISMS - based on "useFieldTable" config parameter
+ */
+ String getReportDbColsMaskSQL();
+
+ /**
+ * SQL for replacing lookup tables with id and name values; can return null =>
+ * do NOT replace lookups Returns SQL with columns - Table_name, Field_name,
+ * New_Lookup_Table_name, New_Lookup_Id_Field_name,
+ * New_Lookup_Name_Field_name For PRISMS - based on "useFieldTable" config
+ * parameter
+ */
+ String getReportDbLookupsSQL();
+
+ /** Obtains menu label by ID */
+ void processErrorNotification(HttpServletRequest request, RaptorException e);
+
+ /** Returns Excel template PATH web URL */
+ String getExcelTemplatePath();
+} // IAppUtils
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IDbUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IDbUtils.java
new file mode 100644
index 00000000..5ee42719
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IDbUtils.java
@@ -0,0 +1,35 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system;
+
+import java.sql.Connection;
+
+import javax.servlet.ServletContext;
+
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+
+public interface IDbUtils {
+ void initializeDbUtils(ServletContext servletContext);
+
+ Connection getConnection() throws ReportSQLException ;
+
+ void clearConnection(Connection con) throws ReportSQLException ;
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RDbUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RDbUtils.java
new file mode 100644
index 00000000..b9753a51
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RDbUtils.java
@@ -0,0 +1,36 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system;
+
+import java.sql.Connection;
+
+import javax.servlet.ServletContext;
+
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+
+public interface RDbUtils {
+
+ void initializeDbUtils(ServletContext servletContext);
+
+ Connection getRemoteConnection(String dbKey)throws ReportSQLException;
+
+ void clearConnection(Connection con)throws ReportSQLException;
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RemDbUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RemDbUtils.java
new file mode 100644
index 00000000..733a0a38
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RemDbUtils.java
@@ -0,0 +1,200 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class RemDbUtils /* implements IDbUtils */{
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RemDbUtils.class);
+
+
+
+ public RemDbUtils() {
+ }
+
+ public static Connection getConnection(String dbKey) throws ReportSQLException {
+ return Globals.getRDbUtils().getRemoteConnection(dbKey);
+ } // getConnection
+
+ public static void clearConnection(Connection con) throws ReportSQLException {
+ try {
+ if ((con != null) && !con.isClosed())
+ Globals.getRDbUtils().clearConnection(con);
+ } catch (SQLException ex) { throw new ReportSQLException(ex.getMessage()); }
+
+ } // clearConnection
+
+ public static Connection startTransaction(String dbKey) throws RaptorException {
+ Connection con = null;
+ try {
+ con = getConnection(dbKey);
+ con.setAutoCommit(false);
+ } catch (SQLException ex) {
+ throw new RaptorRuntimeException (ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new RaptorException (ex2.getMessage(), ex2.getCause());
+ }
+ return con;
+ } // startTransaction
+
+ public static void commitTransaction(Connection con) throws RaptorException {
+ try {
+ con.commit();
+ } catch (SQLException ex) {
+ throw new RaptorRuntimeException (ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new RaptorException (ex2.getMessage(), ex2.getCause());
+ }
+ //clearConnection(con);
+ } // commitTransaction
+
+ public static void rollbackTransaction(Connection con) throws RaptorException {
+ try {
+ con.rollback();
+ clearConnection(con);
+ } catch (SQLException ex) {
+ throw new RaptorRuntimeException (ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new RaptorException (ex2.getMessage(), ex2.getCause());
+ }
+ } // rollbackTransaction
+
+// public static String executeCall(Connection con, String sql, boolean expectResult)
+// throws ReportSQLException, Exception {
+// String result = null;
+//
+// try {
+// if(con.isClosed()) con = getConnection();
+// Log.write("[SQL Call] " + sql, 4);
+// CallableStatement stmt = con.prepareCall(sql);
+// if (expectResult)
+// stmt.registerOutParameter(1, Types.CHAR);
+// stmt.executeUpdate();
+// if (expectResult)
+// result = stmt.getString(1);
+// stmt.close();
+// con.commit();
+// } catch (SQLException e) {
+// throw new ReportSQLException(e.getMessage(), sql);
+// } finally {
+// clearConnection(con);
+// }
+//
+// return result;
+// } // executeCall
+//
+// public static String executeCall(String sql, boolean expectResult)
+// throws ReportSQLException, Exception {
+// Connection con = null;
+// try {
+// con = getConnection();
+// String result = executeCall(con, sql, expectResult);
+// return result;
+// } catch (SQLException e) {
+// throw new ReportSQLException(e.getMessage(), sql);
+// }
+// } // executeCall
+//
+// public static int executeUpdate(Connection con, String sql) throws ReportSQLException, Exception {
+// try {
+// if(con.isClosed()) con = getConnection();
+// Statement stmt = con.createStatement();
+//
+// int rcode = -1;
+// try {
+// Log.write("[SQL Update] " + sql, 4);
+// rcode = stmt.executeUpdate(sql);
+// stmt.close();
+// con.commit();
+// } finally {
+// clearConnection(con);
+// }
+//
+// return rcode;
+// } catch (SQLException e) {
+// throw new ReportSQLException(e.getMessage(), sql);
+// } finally {
+// clearConnection(con);
+// }
+// } // executeUpdate
+//
+// public static int executeUpdate(String sql) throws ReportSQLException, Exception {
+// Connection con = null;
+// try {
+// con = getConnection();
+// int rcode = executeUpdate(con, sql);
+// return rcode;
+// } catch (SQLException e) {
+// throw new ReportSQLException(e.getMessage(), sql);
+// }
+// } // executeUpdate
+
+ public static DataSet executeQuery(Connection con, String sql, String dbKey) throws ReportSQLException, Exception {
+ return executeQuery(con, sql, Integer.MAX_VALUE,dbKey);
+ } // executeQuery
+
+ public static DataSet executeQuery(Connection con, String sql, int maxRowLimit, String dbKey)
+ throws ReportSQLException {
+ try {
+ if (con==null || con.isClosed()) con = getConnection(dbKey);
+ if(con==null) throw new ReportSQLException("Remote Connection not configured for "+ dbKey);
+ Statement stmt = con.createStatement();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[SQL CALL FROM RAPTOR] [SQL] " + sql));
+ ResultSet rs = stmt.executeQuery(sql);
+ DataSet ds = new DataSet(rs, maxRowLimit);
+ if(rs!=null)
+ rs.close();
+ if(stmt!=null)
+ stmt.close();
+
+ return ds;
+ } catch (SQLException e) {
+ throw new ReportSQLException(e.getMessage(), sql, e.getCause());
+ }
+ } // executeQuery
+
+ public static DataSet executeQuery(String sql,String dbKey) throws ReportSQLException {
+ return executeQuery(sql, Integer.MAX_VALUE, dbKey);
+ } // executeQuery
+
+ public static DataSet executeQuery(String sql, int maxRowLimit, String dbKey) throws ReportSQLException{
+ Connection con = null;
+ try {
+ con = getConnection(dbKey);
+ return executeQuery(con, sql, maxRowLimit,dbKey);
+ } catch (ReportSQLException e) {
+ throw new ReportSQLException(e.getMessage(), sql, e.getCause());
+ } finally {
+ clearConnection(con);
+ }
+ } // executeQuery
+
+} // DbUtils
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AntBuild.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AntBuild.java
new file mode 100644
index 00000000..724a07d3
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AntBuild.java
@@ -0,0 +1,66 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+/**
+ * This class is used to get version and Build information when
+ * user run "java -jar raptor_fusion.jar" command.
+ */
+public class AntBuild {
+
+ public static void main(String[] args) {
+ System.out.println("Jar (raptor_fusion.jar) Information: ");
+ readManifest();
+ }
+
+ public static void readManifest() {
+ try {
+ JarFile jar = new JarFile("./raptor_fusion.jar");
+ Manifest manifest = jar.getManifest();
+
+ Attributes attribs = manifest.getMainAttributes();
+ Iterator it = attribs.entrySet().iterator();
+ while(it.hasNext()) {
+ Map.Entry entry = (Map.Entry) it.next();
+ Attributes.Name attributeName = (Attributes.Name) entry.getKey();
+ String attributeValue = (String) entry.getValue();
+ if (attributeName.toString().equals("Created-By"))
+ System.out.println("JDK Version " + " : " + attributeValue);
+ else if (attributeName.toString().equals("Ant-Version"))
+ System.out.println(attributeName.toString() + " : " + attributeValue);
+ else {
+ if(attributeName.toString().startsWith("Raptor"))
+ System.out.println(attributeName.toString() + " : " + attributeValue);
+ }
+ }
+
+ } catch (IOException e) {
+ System.err.println("Cannot read jar-file manifest: "
+ + e.getMessage());
+ }
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AppUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AppUtils.java
new file mode 100644
index 00000000..008a1d8c
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AppUtils.java
@@ -0,0 +1,363 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.config.ConfigLoader;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.system.IAppUtils;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.RaptorAdapter;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;;
+
+public class AppUtils extends org.openecomp.portalsdk.analytics.RaptorObject implements IAppUtils {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppUtils.class);
+
+
+ private static String tempFolderPath = "/artemis/PROJECT1/MSA/databank/WEB-INF/temp/";
+ private static String uploadFolderPath = "/artemis/PROJECT1/MSA/databank/WEB-INF/upload/";
+ private static String tempFolderURL = "temp/";
+ private static String uploadFolderURL = "upload/";
+ private static String SMTPServer = "todo.smtp.server.com";
+ private static String defaultEmailSender = "todo.email.sender.com";
+ private static String errorPage = "error_page";
+ private static String errorPageWMenu = "error_page_wmenu";
+ private static String jspContextPath = "raptor/";
+ private static String imgFolderURL = "raptor/images/";
+ private static String baseFolderURL = "raptor/";
+ //private static String reportExecuteActionURL = "dispatcher?action=raptor&r_action=report.run&c_master=";
+ //private static String dataViewActionURL = "dispatcher?action="; // dispatcher?action=ACTION_ID&c_master=REC_ID
+ //private static String dataViewActionParam = "c_master=";
+ private static String directAccessURL = "http://localhost:8082/databank/dispatcher?direct.access=raptor&r_action=report.run&show=";
+ private static String baseActionURL = "dispatcher?action="; // dispatcher?action=ACTION_ID&c_master=REC_ID or dispatcher?action=raptor&r_action=RAPTOR_ACTION_ID&c_master=REC_ID
+ private static String baseActionURLNG = "report#/"; // dispatcher?action=ACTION_ID&c_master=REC_ID or dispatcher?action=raptor&r_action=RAPTOR_ACTION_ID&c_master=REC_ID
+ private static String drillActionURL = "dispatcher?action="; // dispatcher?action=ACTION_ID&c_master=REC_ID or dispatcher?action=raptor&r_action=RAPTOR_ACTION_ID&c_master=REC_ID
+ private static String baseActionParam = "c_master=";
+ private static String superRoleID = "1";
+ private static Vector adminRoleIDs = new Vector();
+ private static Vector quickLinksMenuIDs = new Vector();
+
+ private static Properties raptorAppProperties;
+
+ private static String encryptedSMTPServer = "";
+ public AppUtils() {}
+
+ public void initializeAppUtils(ServletContext servletContext) {
+ try {
+ Properties appProperties = ConfigLoader.getProperties(servletContext, ConfigLoader.APP_PROPERTIES, Globals.getSystemType());
+ raptorAppProperties = appProperties;
+ tempFolderPath = appProperties.getProperty("temp_folder_path");
+ uploadFolderPath = appProperties.getProperty("upload_folder_path");
+ tempFolderURL = appProperties.getProperty("temp_folder_url");
+ uploadFolderURL = appProperties.getProperty("upload_folder_url");
+ SMTPServer = appProperties.getProperty("smtp_server");
+ encryptedSMTPServer = appProperties.getProperty("encrypted_smtp_server");
+ defaultEmailSender = appProperties.getProperty("default_email_sender");
+ errorPage = appProperties.getProperty("error_page");
+ jspContextPath = appProperties.getProperty("jsp_context_path");
+ imgFolderURL = appProperties.getProperty("img_folder_url");
+ baseFolderURL = appProperties.getProperty("base_folder_url");
+/* reportExecuteActionURL = appProperties.getProperty("report_execute_action_url");
+ dataViewActionURL = appProperties.getProperty("data_view_action_url");
+ dataViewActionParam = appProperties.getProperty("data_view_action_param");*/
+ directAccessURL = appProperties.getProperty("direct_access_url");
+ baseActionURL = appProperties.getProperty("base_action_url");
+ baseActionURLNG = appProperties.getProperty("base_action_url_ng");
+ drillActionURL = appProperties.getProperty("drill_action_url");
+ baseActionParam = appProperties.getProperty("base_action_param");
+ superRoleID = appProperties.getProperty("super_role_id");
+
+ adminRoleIDs.removeAllElements();
+ StringTokenizer st = new StringTokenizer(appProperties.getProperty("admin_role_ids"), ",");
+ while(st.hasMoreTokens())
+ adminRoleIDs.add(st.nextToken());
+
+ quickLinksMenuIDs.removeAllElements();
+ st = new StringTokenizer(appProperties.getProperty("quick_links_menu_ids"), ",");
+ while(st.hasMoreTokens())
+ quickLinksMenuIDs.add(st.nextToken());
+ } catch(Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] AppUtils.initializeAppUtils: Unable to load properties ["+Globals.getSystemType()+"_"+ConfigLoader.APP_PROPERTIES+"]. Exception: "+e.getMessage()));
+ //throw new RuntimeException(e.getMessage());
+ }
+ } // initializeAppUtils
+
+ public static void getFullURL(HttpServletRequest req) {
+ String applicationBase = "";
+ if (applicationBase == null) {
+ applicationBase = req.getScheme() + "://" + req.getServerName() +
+ getPort(req) + req.getContextPath();
+ }
+ }
+
+ private static String getPort(HttpServletRequest req) {
+ if ("http".equalsIgnoreCase(req.getScheme()) && req.getServerPort() != 80 ||
+ "https".equalsIgnoreCase(req.getScheme()) && req.getServerPort() != 443 ) {
+ return (":" + req.getServerPort());
+ } else {
+ return "";
+ }
+ }
+ public String getUserID(HttpServletRequest request) {
+ String pdfAttachmentKey = org.openecomp.portalsdk.analytics.system.AppUtils.getRequestValue(request, "pdfAttachmentKey");
+ String report_email_sent_log_id = org.openecomp.portalsdk.analytics.system.AppUtils.getRequestValue(request, "log_id");
+ boolean isEmailAttachment = false;
+ if(pdfAttachmentKey != null && report_email_sent_log_id !=null)
+ isEmailAttachment = true;
+ if(isEmailAttachment) {
+ return RaptorAdapter.getUserID(org.openecomp.portalsdk.analytics.system.AppUtils.getRequestValue(request, "user_id"));
+ } else
+ return RaptorAdapter.getUserID(request);
+ } // getUserID
+
+ public Vector getAllUsers(String customizedQuery, String param, boolean isAdmin) {
+ Map map = RaptorAdapter.getAllUsers(customizedQuery, param, isAdmin);
+
+ Vector vector = new Vector(map.size());
+ for(Iterator iter=map.keySet().iterator(); iter.hasNext(); ) {
+ Long key = (Long) iter.next();
+ vector.add(new IdNameValue(""+key, (String) map.get(key)));
+ } // for
+
+ return vector;
+ } // getAllUsers
+
+ public String getRoleName(String roleId) {
+ return RaptorAdapter.getRoleName(roleId);
+ } // getRoleName
+
+ public Vector getAllRoles(String customizedQuery, String param, boolean isAdmin) {
+ Map map = RaptorAdapter.getAllRolesUsingCustomizedQuery(customizedQuery, param, isAdmin);
+
+ Vector vector = new Vector(map.size());
+ for(Iterator iter=map.keySet().iterator(); iter.hasNext(); ) {
+ Long key = (Long) iter.next();
+ vector.add(new IdNameValue(""+key, (String) map.get(key)));
+ } // for
+
+ return vector;
+ } // getAllRoles
+
+ public String getUserName(HttpServletRequest request) {
+ return RaptorAdapter.getUserName(request);
+ } // getUserName
+
+ public String getUserName(String userId) {
+ return RaptorAdapter.getUserName(userId);
+ } // getUserName
+
+ public String getUserEmail(String userId) {
+ return RaptorAdapter.getUserEmail(userId);
+ } // getUserEmail
+
+ public String getUserEmail(HttpServletRequest request) {
+ return RaptorAdapter.getUserEmail(request);
+ } // getUserEmail
+
+ public String getUserLoginId(HttpServletRequest request) {
+ return RaptorAdapter.getUserLoginId(request);
+ } // getUserLoginId
+
+ public String getUserLoginId(String userId) {
+ return RaptorAdapter.getUserLoginId(userId);
+ } // getUserLoginId
+
+ public String getUserBackdoorLoginId(HttpServletRequest request) {
+ String pdfAttachmentKey = org.openecomp.portalsdk.analytics.system.AppUtils.getRequestValue(request, "pdfAttachmentKey");
+ String report_email_sent_log_id = org.openecomp.portalsdk.analytics.system.AppUtils.getRequestValue(request, "log_id");
+ boolean isEmailAttachment = false;
+ if(pdfAttachmentKey != null && report_email_sent_log_id !=null)
+ isEmailAttachment = true;
+ if(isEmailAttachment) {
+ return RaptorAdapter.getUserBackdoorLoginId(org.openecomp.portalsdk.analytics.system.AppUtils.getRequestValue(request, "user_id"));
+ } else
+ return RaptorAdapter.getUserBackdoorLoginId(request);
+ } // getUserBackdoorLoginId
+
+ public boolean isUserInRole(HttpServletRequest request, String roleId) {
+ return RaptorAdapter.isCurrentUserInRole(request, roleId);
+ } // isUserInRole
+
+ public Vector getUserRoles(HttpServletRequest request) {
+// Map map = RaptorAdapter.getAllRoles(userId);
+ Set set = RaptorAdapter.getUserRoles(request);
+
+ Vector vector = new Vector(set.size());
+ for(Iterator iter=set.iterator(); iter.hasNext(); ) {
+ Long key = (Long) iter.next();
+ vector.add(""+key);
+ //vector.add(new IdNameValue(""+key, (String) map.get(key)));
+ } // for
+
+ return vector;
+ } // getUserRoles
+
+ public Vector getUserRoles(String userId) {
+ Set set = RaptorAdapter.getUserRoles(userId);
+
+ Vector vector = new Vector(set.size());
+ for(Iterator iter=set.iterator(); iter.hasNext(); ) {
+ Long key = (Long) iter.next();
+ vector.add(""+key);
+ //vector.add(new IdNameValue(""+key, (String) map.get(key)));
+ } // for
+
+ return vector;
+ //return null;
+ } // getUserRoles
+
+ public void resetUserCache() {
+ //org.openecomp.portalsdk.core.web.support.AppUtils.removeObjectFromCache(RaptorAdapter.KEY_USER_ROLES_CACHE);
+ } // resetUserCache
+
+ public String getSuperRoleID(){
+ return superRoleID;
+ } // getSuperRoleID
+
+ public Vector getAdminRoleIDs(){
+ return adminRoleIDs;
+ } // getAdminRoleIDs
+
+
+ public String getTempFolderPath() {
+ return tempFolderPath;
+ } // getTempFolderPath
+
+ public String getUploadFolderPath() {
+ return uploadFolderPath;
+ } // getUploadFolderPath
+
+ public String getTempFolderURL() {
+ return tempFolderURL;
+ } // getTempFolderURL
+
+ public String getUploadFolderURL() {
+ return uploadFolderURL;
+ } // getUploadFolderURL
+
+ public String getSMTPServer() {
+ return SMTPServer;
+ } // getSMTPServer
+
+ public String getDefaultEmailSender() {
+ return defaultEmailSender;
+ } // getDefaultEmailSender
+
+ public String getErrorPage() {
+ return errorPage;
+ } // getErrorPage
+
+ public String getJspContextPath() {
+ return jspContextPath;
+ } // getJspContextPath
+
+ public String getImgFolderURL() {
+ return imgFolderURL;
+ } // getImgFolderURL
+
+ public String getBaseFolderURL() {
+ return baseFolderURL;
+ } // getBaseFolderURL
+
+/* public String getReportExecuteActionURL() {
+ return reportExecuteActionURL;
+ } // getReportExecuteActionURL
+
+ public String getDataViewActionURL() {
+ return dataViewActionURL;
+ } // getDataViewActionURL
+
+ public String getDataViewActionParam() {
+ return dataViewActionParam;
+ } // getDataViewActionParam
+*/
+ public String getDirectAccessURL() {
+ return directAccessURL.trim();
+ } // getDirectAccessURL
+
+ public String getBaseActionURL() {
+ return baseActionURL;
+ } // getBaseActionURL
+
+ public String getBaseActionURLNG() {
+ return baseActionURLNG;
+ } // getBaseActionURLNG
+
+ public String getDrillActionURL() {
+ return drillActionURL;
+ } // getBaseActionURL
+
+ public String getBaseActionParam() {
+ return baseActionParam;
+ } // getBaseActionParam
+
+ public Vector getQuickLinksMenuIDs(){
+ return quickLinksMenuIDs;
+ } // getQuickLinksMenuIDs
+
+ public String getMenuLabel(String menuId) {
+ //return menuId.substring(0, 1).toUpperCase()+menuId.substring(1).toLowerCase();
+ return menuId;
+ } // getMenuLabel
+
+ public String getReportDbColsMaskSQL() {
+ return null;
+/* Example:
+ return "SELECT f.table_name, UPPER(f.column_name) column_name, f.label "+
+ "FROM fields f WHERE f.active_yn = 'Y'"; */
+ } // getReportDbColsMaskSQL
+
+ public String getReportDbLookupsSQL() {
+ return null;
+/* Example:
+ return "SELECT DISTINCT f.table_name, UPPER(f.column_name) column_name, f.lookup_table, f.lookup_id_field, f.lookup_name_field "+
+ "FROM fields f WHERE f.active_yn = 'Y'"; */
+ } // getReportDbLookupsSQL
+
+ public void processErrorNotification(HttpServletRequest request, RaptorException e) {
+ //RaptorAdapter.processErrorNotification(request, e);
+} // processErrorNotification
+
+ public String getErrorPageWMenu() {
+ return errorPageWMenu;
+ }
+
+ public String getExcelTemplatePath() {
+ return nvls(raptorAppProperties.getProperty("excel_template_path"), "");
+ }
+ /**
+ * @return the encryptedSMTPServer
+ */
+ public String getEncryptedSMTPServer() {
+ return encryptedSMTPServer;
+ }
+
+} // AppUtils
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/DbUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/DbUtils.java
new file mode 100644
index 00000000..4638f3e3
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/DbUtils.java
@@ -0,0 +1,75 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion;
+
+import java.sql.Connection;
+
+import javax.servlet.ServletContext;
+
+import org.openecomp.portalsdk.analytics.system.IDbUtils;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.FusionAdapter;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.RaptorAdapter;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.SpringContext;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+
+public class DbUtils implements IDbUtils {
+
+ @Autowired
+ public RaptorAdapter raptorAdapter;
+ @Autowired
+ public FusionAdapter fusionAdapter;
+
+ public DbUtils() {}
+
+ public void initializeDbUtils(ServletContext servletContext) {
+ raptorAdapter = (RaptorAdapter)SpringContext.getApplicationContext().getBean("raptorAdapter");
+ } // initializeDbUtils
+
+ public Connection getConnection() {
+ return raptorAdapter.getConnection();
+ } // getConnection
+
+ public void clearConnection(Connection con) {
+ raptorAdapter.releaseConnection(con);
+ } // clearConnection
+
+ public RaptorAdapter getRaptorAdapter() {
+ return raptorAdapter;
+ }
+
+ public void setRaptorAdapter(RaptorAdapter raptorAdapter) {
+ this.raptorAdapter = raptorAdapter;
+ }
+
+ public FusionAdapter getFusionAdapter() {
+ return fusionAdapter;
+ }
+
+ public void setFusionAdapter(FusionAdapter fusionAdapter) {
+ this.fusionAdapter = fusionAdapter;
+ }
+
+
+
+
+
+} // DbUtils
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/RemoteDbUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/RemoteDbUtils.java
new file mode 100644
index 00000000..4f8f7427
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/RemoteDbUtils.java
@@ -0,0 +1,50 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion;
+
+import java.sql.Connection;
+
+import javax.servlet.ServletContext;
+
+import org.openecomp.portalsdk.analytics.system.RDbUtils;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.RaptorAdapter;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.SpringContext;
+
+
+
+public class RemoteDbUtils implements RDbUtils{
+
+ private RaptorAdapter raptorAdapter;
+
+
+ public void initializeDbUtils(ServletContext servletContext) {
+ raptorAdapter = (RaptorAdapter)SpringContext.getApplicationContext().getBean("raptorAdapter");
+ } // initializeDbUtils
+
+
+ public Connection getRemoteConnection(String dbKey) {
+ return raptorAdapter.getConnection(dbKey);
+ }
+
+ public void clearConnection(Connection conn) {
+ raptorAdapter.releaseConnection(conn);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/AdapterSessionFactoryContainer.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/AdapterSessionFactoryContainer.java
new file mode 100644
index 00000000..1e2de464
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/AdapterSessionFactoryContainer.java
@@ -0,0 +1,39 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.adapter;
+
+import java.util.LinkedHashMap;
+
+public class AdapterSessionFactoryContainer {
+
+ private LinkedHashMap sessionFactories;
+
+ public AdapterSessionFactoryContainer() {
+ }
+
+ public LinkedHashMap getSessionFactories() {
+ return sessionFactories;
+ }
+
+ public void setSessionFactories(LinkedHashMap sessionFactories) {
+ this.sessionFactories = sessionFactories;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/DateUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/DateUtils.java
new file mode 100644
index 00000000..a9ea0979
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/DateUtils.java
@@ -0,0 +1,287 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.adapter;
+
+
+import java.io.Serializable;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.TimeZone;
+
+import org.openecomp.portalsdk.core.FusionObject;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.AppUtils;
+
+
+public class DateUtils implements Serializable, FusionObject{
+
+ public static final String US_PACIFIC = "US/Pacific";
+ public static final String US_MOUNTAIN = "US/Mountain";
+ public static final String US_CENTRAL = "US/Central";
+ public static final String US_EASTERN = "US/Eastern";
+ public static final String US_HAWAII = "US/Hawaii";
+ public static final String US_ALASKA = "US/Alaska";
+
+ //Arizona State has Mountain Time with no Daylight Savings
+ public static final String US_ARIZONA = "America/Phoenix";
+
+ private static final String DB_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
+ private static final String GET_CURRENT_DATE = "getCurrentDate";
+
+ private static DataAccessService dataAccessService;
+
+ public static DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ /**
+ * Parses a date value with given pattern,
+ * to return a Date Object
+ *
+ * @param dateValue
+ * @param inPattern
+ * @return Date Object
+ * @throws Exception
+ *
+ */
+ public static Date parseDate(String dateValue,String inPattern) throws Exception{
+ return parseDate(dateValue,inPattern,null);
+ }
+
+ /**
+ * Parses a date value with the given pattern for the specific TimeZone,
+ * to return a Date Object
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param currentTimeZone
+ * @return Date Object
+ * @throws Exception
+ *
+ */
+ public static Date parseDate(String dateValue,String inPattern,
+ String currentTimeZone) throws Exception{
+ DateFormat df = new SimpleDateFormat(inPattern);
+ if(currentTimeZone !=null && !(currentTimeZone.trim().equals(""))){
+ df.setTimeZone(TimeZone.getTimeZone(currentTimeZone));
+ }
+ Date date = df.parse(dateValue);
+ return date;
+ }
+
+ /**
+ * Parses a date value with the given pattern for the specific User(in User TimeZone),
+ * to return a Date Object
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param userId
+ * @return Date Object
+ * @throws Exception
+ *
+ */
+ public static Date parseUserDate(String dateValue, String inPattern, Long userId) throws Exception{
+ User user = (User)getDataAccessService().getDomainObject(User.class, userId, null);
+
+ String userTimeZone = null;
+ Long timezoneId = user.getTimeZoneId();
+
+ if (timezoneId != null) {
+ userTimeZone = AppUtils.getLookupValueByLabel(timezoneId.toString(), "fn_lu_timezone", "timezone_id", "timezone_value");
+ }
+
+ return parseDate(dateValue,inPattern,userTimeZone);
+ }
+
+ /**
+ * Formats a given date object to the desired pattern
+ *
+ * @param date
+ * @param outPattern
+ * @return Formatted date value
+ * @throws Exception
+ */
+ public static String formatDate(Date date,String outPattern)throws Exception{
+ return formatDate(date,outPattern,null);
+ }
+
+ /**
+ * Formats a date value with the given pattern into a date value with the desired pattern
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param outPattern
+ * @return Formatted date value
+ * @throws Exception
+ *
+ */
+ public static String formatDate(String dateValue,String inPattern,
+ String outPattern) throws Exception{
+ return formatDate(dateValue,inPattern,null,outPattern,null);
+ }
+
+ /**
+ * Formats a given date object to the desired pattern for the TimeZone provided
+ * @param date
+ * @param outPattern
+ * @param requiredTimeZone
+ * @return Formatted date value
+ * @throws Exception
+ */
+ public static String formatDate(Date date,String outPattern,
+ String requiredTimeZone) throws Exception{
+ DateFormat df = new SimpleDateFormat(outPattern);
+ if(requiredTimeZone != null && !requiredTimeZone.trim().equals("")){
+ df.setTimeZone(TimeZone.getTimeZone(requiredTimeZone));
+ }
+ return df.format(date);
+ }
+
+ /**
+ * Formats a date value with the given pattern
+ * into a date value with the desired pattern for the TimeZone provided
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param outPattern
+ * @param requiredTimeZone
+ * @return Formatted date value
+ * @throws Exception
+ *
+ */
+ public static String formatDate(String dateValue,String inPattern,
+ String outPattern,String requiredTimeZone) throws Exception{
+ return formatDate(dateValue,inPattern,null,outPattern,requiredTimeZone);
+ }
+
+ /**
+ * Formats a date value with the given pattern for a specific TimeZone,
+ * into a date value with the desired pattern for the TimeZone provided
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param currentTimeZone
+ * @param outPattern
+ * @param requiredTimeZone
+ * @return Formatted date value
+ * @throws Exception
+ *
+ */
+ public static String formatDate(String dateValue,String inPattern,String currentTimeZone,
+ String outPattern,String requiredTimeZone) throws Exception{
+ Date date = parseDate(dateValue,inPattern,currentTimeZone);
+ return formatDate(date,outPattern,requiredTimeZone);
+ }
+
+ /**
+ * Formats a date value with the given pattern, for a specific User(in User TimeZone),
+ * into a date value with the desired pattern for the TimeZone provided
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param userId
+ * @param outPattern
+ * @param requiredTimeZone
+ * @return Formatted date value
+ * @throws Exception
+ *
+ */
+ public static String formatUserDate(String dateValue,String inPattern, Long userId,String outPattern,String requiredTimeZone) throws Exception{
+ User user = (User)getDataAccessService().getDomainObject(User.class, userId, null);
+
+ String userTimeZone = null;
+ Long timezoneId = user.getTimeZoneId();
+
+ if (timezoneId != null) {
+ userTimeZone = AppUtils.getLookupValueByLabel(timezoneId.toString(), "fn_lu_timezone", "timezone_id", "timezone_value");
+ }
+
+ return formatDate(dateValue,inPattern,userTimeZone,outPattern,requiredTimeZone);
+ }
+
+ /**
+ * Formats a date value with a given pattern for a specific User(User TimeZone),
+ * into a date value with the desired pattern for Database TimeZone
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param userId
+ * @param outPattern
+ * @return Formatted date value
+ * @throws Exception
+ *
+ */
+ public static String formatUserDateForDBTimeZone(String dateValue,String inPattern, Long userId,String outPattern) throws Exception{
+ User user = (User)getDataAccessService().getDomainObject(User.class, userId, null);
+
+ String userTimeZone = null;
+ Long timezoneId = user.getTimeZoneId();
+
+ /*if (timezoneId != null) {
+ userTimeZone = AppUtils.getLookupValueByLabel(timezoneId.toString(), "fn_lu_timezone", "timezone_id", "timezone_value");
+ }*/
+
+ String dbTimeZone = SystemProperties.getProperty(SystemProperties.DATABASE_TIME_ZONE);
+
+ return formatDate(dateValue,inPattern,userTimeZone,outPattern,dbTimeZone);
+ }
+
+ /**
+ * Get the current database Date/Time
+ * @return Date object
+ */
+ public static Date getCurrentDBDate()throws Exception{
+ String dbTimeZone = SystemProperties.getProperty(SystemProperties.DATABASE_TIME_ZONE);
+ List results = (List)getDataAccessService().executeNamedQuery(GET_CURRENT_DATE, null, null);
+ return parseDate(((Object[])results.get(0))[0]+" "+((Object[])results.get(0))[1],DB_DATE_FORMAT,dbTimeZone);
+ }
+
+ /**
+ * Get the current date value formatted for the User's TimeZone in the desired pattern
+ *
+ * @param outPattern
+ * @param userId
+ * @return Date value
+ * @throws Exception
+ */
+ public static String getCurrentDBDateForUser(String outPattern,Long userId)throws Exception{
+ User user = (User)getDataAccessService().getDomainObject(User.class, userId, null);
+
+ String userTimeZone = null;
+ Long timezoneId = user.getTimeZoneId();
+
+ /*if (timezoneId != null) {
+ userTimeZone = AppUtils.getLookupValueByLabel(timezoneId.toString(), "fn_lu_timezone", "timezone_id", "timezone_value");
+ }*/
+
+ Date dbDate = getCurrentDBDate();
+
+ return formatDate(dbDate,outPattern,userTimeZone);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java
new file mode 100644
index 00000000..33b6ec2d
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java
@@ -0,0 +1,135 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.adapter;
+
+import java.sql.Connection;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+
+import org.openecomp.portalsdk.core.FusionObject;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.mchange.v2.c3p0.ComboPooledDataSource;
+
+public class FusionAdapter implements FusionObject {
+
+ public static final String LOCAL_SESSION_FACTORY_KEY = "local";
+
+
+ private ComboPooledDataSource dataSource;
+ private Map<String,ComboPooledDataSource> dataSourceMap;
+
+ //private SessionFactory sessionFactory;
+ private ServletContext servletContext;
+
+ // private static Connection connection = null;
+
+ //private static AdapterSessionFactoryContainer sessionFactoryContainer;
+
+
+ public FusionAdapter() {
+ }
+
+
+ public ServletContext getServletContext() {
+ return servletContext;
+ }
+
+ public void setServletContext(ServletContext servletContext) {
+ this.servletContext = servletContext;
+ }
+
+ // public static AdapterSessionFactoryContainer getSessionFactoryContainer() {
+ // return sessionFactoryContainer;
+ // }
+
+ //public static LinkedHashMap getSessionFactories() {
+ // return getSessionFactoryContainer().getSessionFactories();
+ //}
+
+
+ //public void setSessionFactoryContainer(AdapterSessionFactoryContainer sessionFactoryContainer) {
+ // this.sessionFactoryContainer = sessionFactoryContainer;
+ //}
+
+
+ /** Gets connection to the database **/
+ public Connection getConnection() {
+ //Session session = sessionFactory.getCurrentSession();
+ Connection connection = null;
+ try {
+ connection = getDataSource().getConnection();
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return connection;
+ }
+
+
+ /** Gets connection to the database indicated via the session factory key **/
+ public synchronized Connection getConnection(String schemaId) {
+ Connection connection = null;
+ try {
+ connection = getDataSourceMap().get(schemaId).getConnection();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return connection;
+ }
+
+
+ /** Releases connection to the database **/
+ public void releaseConnection(Connection conn) {
+ try {
+ conn.close();
+ //logger.debug("releasing connection from adapter...");
+ }
+ catch (Exception e) {
+ //logger.error("Error while closing the connection.");
+ e.printStackTrace();
+ }
+ }
+
+
+ public ComboPooledDataSource getDataSource() {
+ return dataSource;
+ }
+
+
+ @Autowired
+ public void setDataSource(ComboPooledDataSource dataSource) {
+ this.dataSource = dataSource;
+ }
+
+ public Map<String,ComboPooledDataSource> getDataSourceMap() {
+ if(dataSourceMap==null)
+ dataSourceMap = (Map<String,ComboPooledDataSource>)SpringContext.getApplicationContext().getBean("dataSourceMap");
+
+ return dataSourceMap;
+ }
+
+ public void setdataSourceMap(Map<String,ComboPooledDataSource> dataSourceMap) {
+ this.dataSourceMap = dataSourceMap;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/IdName.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/IdName.java
new file mode 100644
index 00000000..5b4af3f9
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/IdName.java
@@ -0,0 +1,59 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.adapter;
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+/**
+ * <p>IdName.java</p>
+ * <p>Represents a id/name data object.</p>
+*/
+public class IdName extends DomainVo {
+
+ private String name;
+ private Long id;
+
+ public IdName() {}
+
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int compareTo(Object obj){
+ String c1 = getName();
+ String c2 = ((IdName)obj).getName();
+
+ return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Item.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Item.java
new file mode 100644
index 00000000..71663bc2
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Item.java
@@ -0,0 +1,55 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.adapter;
+
+
+public class Item {
+ private String _id;
+ private String _name;
+
+ public Item() {
+ }
+
+ public Item(String id, String name) {
+ this._id = id;
+ this._name = name;
+ }
+
+ public String getId() {
+ return _id;
+ }
+
+ public void setId(String id) {
+ this._id = id;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ this._name = name;
+ }
+
+ public String toString() {
+ return _name;
+ }
+}
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Lookup.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Lookup.java
new file mode 100644
index 00000000..ac6cd16c
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Lookup.java
@@ -0,0 +1,85 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.adapter;
+
+
+import java.io.Serializable;
+
+import org.openecomp.portalsdk.core.domain.FusionVo;
+import org.openecomp.portalsdk.core.domain.support.NameValueId;
+
+
+
+public class Lookup extends FusionVo implements Serializable {
+
+ private NameValueId nameValueId = new NameValueId();
+
+ public Lookup() {}
+
+ public Lookup(String label, String value) {
+ this();
+ setLabel(label);
+ setValue(value);
+ }
+
+ public String getValue() {
+ return getNameValueId().getVal();
+ }
+
+ public String getLabel() {
+ return getNameValueId().getLab();
+ }
+
+ public void setValue(String value) {
+ getNameValueId().setVal(value);
+ }
+
+ public void setLabel(String label) {
+ getNameValueId().setLab(label);
+ }
+
+ public NameValueId getNameValueId() {
+ return nameValueId;
+ }
+
+ public void setNameValueId(NameValueId nameValueId) {
+ this.nameValueId = nameValueId;
+ }
+
+ // required by ZK for to set the selectedItems of Listboxes (used heavily for <select>-style drop-downs)
+ public int hashCode() {
+ int hash = getValue().hashCode();
+ hash = hash + getLabel().hashCode();
+
+ return hash;
+ }
+
+ public boolean equals( Object obj ) {
+ boolean equivalent = false;
+
+ Lookup lookup = (Lookup)obj;
+ if( lookup.getValue().equals(getValue()) && lookup.getLabel().equals(getLabel())) {
+ equivalent = true;
+ }
+
+ return equivalent;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java
new file mode 100644
index 00000000..99cc0272
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java
@@ -0,0 +1,368 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.adapter;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.core.domain.Menu;
+import org.openecomp.portalsdk.core.domain.MenuData;
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.domain.RoleFunction;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+@Service("raptorAdapter")
+public class RaptorAdapter extends FusionAdapter {
+
+ @Autowired
+ private static DataAccessService dataAccessService;
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RaptorAdapter.class);
+
+
+ public static final int RAPTOR_USER_ID = 20000; // RAPTOR system user id (for auditing purposes)
+ public static final String RAPTOR_CONTROLLER_CLASSNAME = "org.openecomp.portalsdk.analytics.controller.Controller";
+ public static final String KEY_USER_ROLES_CACHE = "userRoles";
+
+ public void initializeRaptor() {
+ org.openecomp.portalsdk.analytics.config.ConfigLoader.setConfigFilesPath(SystemProperties.getProperty(SystemProperties.RAPTOR_CONFIG_FILE_PATH));
+ org.openecomp.portalsdk.analytics.system.Globals.initializeSystem(getServletContext());
+ }
+
+
+ /** Returns ID of the user currently logged in */
+ public static String getUserID(HttpServletRequest request) {
+ return String.valueOf(UserUtils.getUserId(request));
+ //return null;
+ }
+
+ public static String getUserID(String user_id) {
+ return user_id;
+ }
+
+
+ public static String getUserBackdoorLoginId(HttpServletRequest request) {
+ if(AppUtils.getRequestNvlValue(request, "login_id").length()>0) return AppUtils.getRequestNvlValue(request, "login_id");
+ return String.valueOf(UserUtils.getUserSession(request).getLoginId());
+ }
+
+ public static String getUserBackdoorLoginId(String user_id) {
+ return getUserLoginId(user_id);
+ }
+
+ /** Obtains user name by ID */
+ public static String getUserName(String userId) {
+ Map<String, Long> params = new HashMap<String, Long>();
+ params.put("user_id", new Long(userId));
+
+ List list = getDataAccessService().executeNamedQuery("getUserNameById", params, null);
+
+ String firstName = "";
+ String lastName = "";
+
+ if (list != null) {
+ if (!list.isEmpty()) {
+ Object[] user = (Object[]) list.get(0);
+ firstName = (String) user[0]; // firstName scalar
+ lastName = (String) user[1]; // lastName scalar
+ }
+ }
+
+ return lastName + ", " + firstName;
+ }
+
+ public static String getUserName(HttpServletRequest request) {
+ User user = UserUtils.getUserSession(request);
+ return user.getLastName() + ", " + user.getFirstName();
+ }
+
+ public static String getUserEmail(String userId) {
+ Map<String, Long> params = new HashMap<String, Long>();
+ params.put("user_id", new Long(userId));
+ List list = getDataAccessService().executeNamedQuery("getUserEmail", params, null);
+ String email = "";
+ if (list != null && !list.isEmpty())
+ email = (String) list.get(0);
+ return email;
+ }
+
+ public static String getUserEmail(HttpServletRequest request) {
+ User user = UserUtils.getUserSession(request);
+ return user.getEmail();
+ }
+
+ public static String getUserLoginId(String userId) {
+
+ String loginId = "";
+ try{
+ List list = getDataAccessService().getList(User.class, " where user_id = " + userId, null, null);
+ if (list != null) {
+ if (!list.isEmpty()) {
+ User user = (User)list.get(0);
+ loginId = user.getLoginId(); // firstName scalar
+ }
+ }
+ }catch(Exception e){
+ logger.error(EELFLoggerDelegate.debugLogger, ("error while getting login id : Exception" + e.getMessage()));
+ }
+ return loginId;
+ }
+
+
+ public static String getUserLoginId(HttpServletRequest request) {
+ User user = UserUtils.getUserSession(request);
+ return user.getLoginId();
+ }
+
+ /** Obtains list of all users (in IdNameValue objects) */
+ public static Map<Long, String> getAllUsers(String customizedQuery, String param, boolean isAdmin) {
+ List users = null;
+ Map<Long, String> map = new LinkedHashMap<Long, String>();
+
+ if(customizedQuery.length()>0 && !isAdmin) {
+
+ users = getDataAccessService().executeSQLQuery(customizedQuery, IdName.class, null);
+
+ if (users != null) {
+ Iterator i = users.iterator();
+ while (i.hasNext()) {
+ IdName item = (IdName)i.next();
+ map.put(item.getId(), item.getName());
+ }
+ }
+
+ } else {
+ users = getDataAccessService().executeNamedQuery("getAllUsers", null, null);
+ if (users != null) {
+ Iterator i = users.iterator();
+ while (i.hasNext()) {
+ Object[] user = (Object[])i.next();
+ Long id = (Long)user[0]; // id scalar
+ String firstName = (String)user[1]; // firstName scalar
+ String lastName = (String)user[2]; // lastName scalar
+ map.put(id, lastName + ", " + firstName);
+ }
+ }
+ }
+ return map;
+ }
+
+ /** Obtains role name by ID */
+ public static String getRoleName(String roleId) {
+ Map<String, Long> params = new HashMap<String, Long>();
+ params.put("role_id", new Long(roleId));
+
+ List list = getDataAccessService().executeNamedQuery("getRoleNameById", params, null);
+
+ String roleName = "";
+
+ if (list != null) {
+ if (!list.isEmpty()) {
+ roleName = (String) list.get(0); // name scalar
+ }
+ }
+
+ return roleName;
+ }
+
+ /** Obtains list of all roles (in IdNameValue objects) */
+ public static Map<Long, String> getAllRolesUsingCustomizedQuery(String customizedQuery, String param, boolean isAdmin) {
+ List roles = null;
+
+ Map<Long, String> map = new LinkedHashMap<Long, String>();
+
+ if(customizedQuery.length()>0 && !isAdmin) {
+
+ roles = getDataAccessService().executeSQLQuery(customizedQuery, IdName.class, null);
+
+ if (roles != null) {
+ Iterator i = roles.iterator();
+ while (i.hasNext()) {
+ IdName item = (IdName)i.next();
+ map.put(item.getId(), item.getName());
+ }
+ }
+ } else {
+
+ roles = getDataAccessService().executeNamedQuery("getAllRoles", null, null);
+
+ if (roles != null) {
+ Iterator i = roles.iterator();
+ while (i.hasNext()) {
+ Object[] role = (Object[])i.next();
+ Long id = (Long)role[0]; // id scalar
+ String name = (String)role[1]; // firstName scalar
+ map.put(id, name);
+ }
+ }
+ }
+
+ return map;
+ }
+
+ public static Set getUserRoles(HttpServletRequest request) {
+ return UserUtils.getRoles(request).keySet();
+ }
+
+ public static Set getUserRoles(String userId) {
+ Set userRoles = new HashSet<Long>();
+// Map usersRolesMap = new LinkedHashMap<Long, Set>();
+// Map<String, Long> params = new HashMap<String, Long>();
+//
+// params.put("user_id", new Long(userId));
+//
+// List usersRolesList = getDataAccessService().executeNamedQuery("getAllUsersRoles", params, null);
+// Iterator i = usersRolesList.iterator();
+// while (i.hasNext()) {
+// Object[] userRole = (Object[]) i.next();
+//
+// Long roleId = (Long) userRole[1]; // role id scalar
+// userRoles.add(roleId);
+//
+// }
+ userRoles = getActiveUsersRoleIds(new Long(userId));
+
+
+ return userRoles;
+ }
+
+ /** this is used to get role for the current user. **/
+ public static synchronized boolean isCurrentUserInRole(HttpServletRequest request, String roleId) {
+ HttpSession session = request.getSession(false);
+ if(session!=null && session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME))!=null)
+ return UserUtils.hasRole(request, roleId);
+ else
+ return false;
+ }
+
+ // public static void processErrorNotification(HttpServletRequest request, Exception e) {
+ //org.openecomp.portalsdk.core.web.support.AppUtils.processError(e, logger, request);
+ //}
+
+ /** Obtains menu label by ID */
+ public static String getMenuLabel(String menuId) {
+ return ((Menu) getDataAccessService().getDomainObject(MenuData.class, new Long(menuId), null)).getLabel();
+ }
+
+ public static String formatUserDateForDBTimeZone(String dateValue,String inPattern,
+ Long userId, String outPattern)throws Exception{
+ return DateUtils.formatUserDateForDBTimeZone(dateValue,inPattern,userId,outPattern);
+ }
+
+ public static String getCurrentDBDateForUser(String inPattern,Long userId)throws Exception{
+ return DateUtils.getCurrentDBDateForUser(inPattern, userId);
+ }
+
+ public static Set<Long> getActiveUsersRoleIds(Long userId) {
+ Set<Role> allActiveUserRoles = getActiveUserRoles(userId);
+ Iterator<Role> allActiveUserRolesIterator = allActiveUserRoles.iterator();
+ Set<Long> allActiveUserRoleIds = new TreeSet<Long>();
+ while(allActiveUserRolesIterator.hasNext()){
+ Role role = allActiveUserRolesIterator.next();
+ allActiveUserRoleIds.add(role.getId());
+ }
+
+ return allActiveUserRoleIds;
+ }
+
+ public static Set<Long> getActiveUserRoleIds(Long userId) {
+ Set<Role> allActiveUserRoles = getActiveUserRoles(userId);
+ Iterator<Role> allActiveUserRolesIterator = allActiveUserRoles.iterator();
+ Set<Long> allActiveUserRoleIds = new TreeSet<Long>();
+ while(allActiveUserRolesIterator.hasNext()){
+ Role role = allActiveUserRolesIterator.next();
+ allActiveUserRoleIds.add(role.getId());
+ }
+
+ return allActiveUserRoleIds;
+ }
+
+ public static Set<RoleFunction> getActiveRoleFunctions(Long userId) {
+ Set<Role> allActiveUserRoles = getActiveUserRoles(userId);
+ Iterator<Role> allActiveUserRolesIterator = allActiveUserRoles.iterator();
+ Set<RoleFunction> allActiveRoleFunctions = new TreeSet<RoleFunction>();
+ while(allActiveUserRolesIterator.hasNext()){
+ Role role = allActiveUserRolesIterator.next();
+ allActiveRoleFunctions.addAll(role.getRoleFunctions());
+ }
+
+ return allActiveRoleFunctions;
+ }
+
+ public static Set<Role> getActiveUserRoles(Long userId) {
+ User user = (User)getDataAccessService().getDomainObject(User.class,userId,null);
+ Set<Role> allActiveUserRoles = new TreeSet<Role>();
+ allActiveUserRoles.addAll(user.getRoles());
+ Iterator<Role> userRolesIterator = user.getRoles().iterator();
+ while(userRolesIterator.hasNext()){
+ getAllChildRoles( userRolesIterator.next(),allActiveUserRoles);
+ }
+
+ Iterator<Role> allActiveUserRolesIterator = allActiveUserRoles.iterator();
+ while(allActiveUserRolesIterator.hasNext()){
+ Role role = allActiveUserRolesIterator.next();
+ if(!role.getActive()){
+ allActiveUserRolesIterator.remove();
+ }
+ }
+
+ return allActiveUserRoles;
+ }
+
+ public static Set<Role> getAllChildRoles(Role role, Set<Role> allchildRoles) {
+ Set<Role> childRoles = role.getChildRoles();
+ allchildRoles.addAll(childRoles);
+ Iterator<Role> childRolesIterator = childRoles.iterator();
+ while (childRolesIterator.hasNext()) {
+ getAllChildRoles(childRolesIterator.next(),allchildRoles);
+ }
+ return allchildRoles;
+ }
+
+
+ public static DataAccessService getDataAccessService() {
+ return org.openecomp.portalsdk.core.web.support.AppUtils.getDataAccessService();
+ }
+
+
+ public static void setDataAccessService(DataAccessService dataAccessService) {
+ dataAccessService = dataAccessService;
+ }
+
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/SpringContext.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/SpringContext.java
new file mode 100644
index 00000000..1d46290a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/SpringContext.java
@@ -0,0 +1,37 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.adapter;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+@Component("springContext")
+public class SpringContext implements ApplicationContextAware {
+ private static ApplicationContext context;
+
+ public void setApplicationContext(ApplicationContext context) throws BeansException {
+ this.context = context;
+ }
+ public static ApplicationContext getApplicationContext() {
+ return context;
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/controller/FileServletController.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/controller/FileServletController.java
new file mode 100644
index 00000000..203ee9cc
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/controller/FileServletController.java
@@ -0,0 +1,206 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.controller;
+/**
+ * Raptor Blob Extract Servlet
+ *
+ */
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.sql.Blob;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.springframework.web.servlet.ModelAndView;;
+
+
+public class FileServletController {
+
+ private DataAccessService dataAccessService;
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FileServletController.class);
+
+
+ public ModelAndView handleRequestInternal(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("FileServletController:: f=" + request.getParameter("f")));
+
+ String fname = request.getParameter("f");
+
+ try {
+ Map params = new HashMap();
+ params.put("fname", fname);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("executing query: select file_blob from cr_report_file_history where file_name = :"
+ + fname));
+
+ List<Object> fileFromDB = (List<Object>) getDataAccessService().executeNamedQuery("getFileWithName", params, null);
+
+ byte[] allBytesInBlob = null;
+
+ if (fileFromDB != null && fileFromDB.size() > 0) {
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("reading file blob from DB..."));
+ try {
+
+ /*for weblogic setup
+ * if(Globals.isWeblogicServer()) {
+ weblogic.jdbc.vendor.oracle.OracleThinBlob aBlob = (weblogic.jdbc.vendor.oracle.OracleThinBlob) ((org.hibernate.lob.SerializableBlob) fileFromDB
+ .get(0)).getWrappedBlob();
+ InputStream inBlob = ((java.sql.Blob) aBlob).getBinaryStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] buf = new byte[1024];
+ int n = 0;
+ while ((n=inBlob.read(buf))>=0) {
+ baos.write(buf, 0, n);
+ }
+ inBlob.close();
+ allBytesInBlob = baos.toByteArray();
+ } else { */
+ /* works in Hinernate3 [ oracle.sql.BLOB aBlob = (oracle.sql.BLOB) ((org.hibernate.lob.SerializableBlob) fileFromDB
+ .get(0)).getWrappedBlob();
+ allBytesInBlob = aBlob.getBytes(1, (int) aBlob.length()); ] */
+ // }
+
+ Object fileFromDBType = fileFromDB.get(0);
+ if(fileFromDBType instanceof byte[] ) // postgres
+ allBytesInBlob = (byte[]) fileFromDB.get(0);
+ else if (fileFromDBType instanceof Blob ) // oracle
+ allBytesInBlob = ((Blob) fileFromDB.get(0)).getBytes(1, (int) ((Blob) fileFromDB.get(0)).length());
+
+
+
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("An exception has occurred: " + e.getMessage()));
+ throw (e);
+ }
+
+ } else {
+ logger.error(EELFLoggerDelegate.debugLogger, ("ERROR: No BLOB returned from DB..."));
+ throw (new Exception("ERROR: No BLOB returned from DB..."));
+ }
+
+ serveFile(response, allBytesInBlob, fname);
+ return null;
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("Exception occurred..." + e.getMessage()));
+ Map<String, Object> errView = new HashMap<String, Object>();
+ errView.put("error", "The requested resource was not found.");
+ //return new ModelAndView(getExceptionView(), "model", errView);
+ return null;
+ }
+
+ }
+
+ private void serveFile(HttpServletResponse response, File inFile)
+ throws Exception {
+ OutputStream os = null;
+ InputStream is = null;
+ try {
+ response.reset();
+ is = new BufferedInputStream(new FileInputStream(inFile));
+ os = new BufferedOutputStream(response.getOutputStream());
+ response.setContentLength((int) inFile.length());
+ response.setContentType("application/octet-stream");
+ response.setHeader("Content-disposition", "attachment; filename=\""
+ + inFile.getName() + "\"");
+ copyStream(is, os);
+ os.flush();
+ } catch (Exception ex) {
+ if (os == null)
+ throw new Exception("Could not open output stream for file ");
+ if (is == null)
+ throw new Exception("Could not open input stream for file ");
+ } finally {
+ if (os != null) {
+ os.close();
+ }
+ if (is != null)
+ is.close();
+ }
+ }
+
+ private void serveFile(HttpServletResponse response, byte[] outStream,
+ String name) throws Exception {
+ OutputStream os = null;
+ InputStream is = null;
+ try {
+ response.reset();
+ response.setContentLength((int) outStream.length);
+ response.setContentType("application/octet-stream");
+ response.setHeader("Content-disposition", "attachment; filename=\""
+ + name + "\"");
+ copyStream(response, outStream);
+ } catch (Exception ex) {
+ if (os == null)
+ throw new Exception("Could not open output stream for file ");
+ if (is == null)
+ throw new Exception("Could not open input stream for file ");
+ } finally {
+ if (os != null) {
+ os.close();
+ }
+ if (is != null)
+ is.close();
+ }
+ }
+
+ private int copyStream(InputStream in, OutputStream out) throws IOException {
+ int bytes, totalBytes = 0;
+
+ byte[] b = new byte[4096];
+
+ while ((bytes = in.read(b, 0, b.length)) != -1) {
+ totalBytes += bytes;
+ out.write(b, 0, bytes);
+ }
+ return totalBytes;
+ }
+
+ private int copyStream(HttpServletResponse response, byte[] outStream)
+ throws IOException {
+
+ OutputStream os = new BufferedOutputStream(response.getOutputStream());
+ os.write(outStream);
+ os.flush();
+ return outStream.length;
+ }
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/CR_Report.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/CR_Report.java
new file mode 100644
index 00000000..9f6ed7d6
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/CR_Report.java
@@ -0,0 +1,306 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.domain;
+
+
+import java.util.Date;
+
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.domain.support.DomainVo;;
+
+/**
+ * <p>CR_Report.java</p>
+ * <p>Represents a RAPTOR report data object.</p>
+ *
+ * @version 1.0
+ */
+public class CR_Report extends DomainVo {
+
+ private String title;
+ private String descr;
+ private String public_yn;
+ //private String report_xml;
+ private Date createDate;
+ private Date maintDate;
+ private String menuId;
+ private String menuApproved_YN;
+ private User ownerId;
+ private Long folderId;
+ private String dashboard_type_YN;
+ private String dashboard_yn;
+ private User createId;
+ private User maintId;
+
+/*
+ //New Buttons
+ private String copyImagePath = "/static/fusion/raptor/img/cross-small.png" ;
+ private String editImagePath = "/static/fusion/raptor/img/pencil-small.png" ;
+ private String deleteImagePath = "/static/fusion/raptor/img/DeleteCross-16x16.png" ;
+ private String scheduleImagePath = "/static/fusion/raptor/img/Calendar-16x16.png" ;
+ private String runImagePath = "/static/fusion/raptor/img/tick-small.png" ;
+
+*/
+ //private Set reportAccess = new TreeSet();
+
+ public CR_Report() {}
+
+
+
+ /**
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+
+
+ /**
+ * @param title the title to set
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+
+
+ /**
+ * @return the descr
+ */
+ public String getDescr() {
+ return descr;
+ }
+
+
+
+ /**
+ * @param descr the descr to set
+ */
+ public void setDescr(String descr) {
+ this.descr = descr;
+ }
+
+
+
+ /**
+ * @return the public_yn
+ */
+ public String getPublic_yn() {
+ return public_yn;
+ }
+
+
+
+ /**
+ * @param public_yn the public_yn to set
+ */
+ public void setPublic_yn(String public_yn) {
+ this.public_yn = public_yn;
+ }
+
+
+ /**
+ * @return the createDate
+ */
+ public Date getCreateDate() {
+ return createDate;
+ }
+
+
+
+ /**
+ * @param createDate the createDate to set
+ */
+ public void setCreateDate(Date createDate) {
+ this.createDate = createDate;
+ }
+
+
+ /**
+ * @return the maintDate
+ */
+ public Date getMaintDate() {
+ return maintDate;
+ }
+
+
+
+ /**
+ * @param maintDate the maintDate to set
+ */
+ public void setMaintDate(Date maintDate) {
+ this.maintDate = maintDate;
+ }
+
+
+
+ /**
+ * @return the menuId
+ */
+ public String getMenuId() {
+ return menuId;
+ }
+
+
+
+ /**
+ * @param menuId the menuId to set
+ */
+ public void setMenuId(String menuId) {
+ this.menuId = menuId;
+ }
+
+
+
+ /**
+ * @return the menuApproved_YN
+ */
+ public String getMenuApproved_YN() {
+ return menuApproved_YN;
+ }
+
+
+
+ /**
+ * @param menuApproved_YN the menuApproved_YN to set
+ */
+ public void setMenuApproved_YN(String menuApproved_YN) {
+ this.menuApproved_YN = menuApproved_YN;
+ }
+
+
+
+
+ /**
+ * @return the folderId
+ */
+ public Long getFolderId() {
+ return folderId;
+ }
+
+
+
+ /**
+ * @param folderId the folderId to set
+ */
+ public void setFolderId(Long folderId) {
+ this.folderId = folderId;
+ }
+
+
+
+ /**
+ * @return the dashboard_type_YN
+ */
+ public String getDashboard_type_YN() {
+ return dashboard_type_YN;
+ }
+
+
+
+ /**
+ * @param dashboard_type_YN the dashboard_type_YN to set
+ */
+ public void setDashboard_type_YN(String dashboard_type_YN) {
+ this.dashboard_type_YN = dashboard_type_YN;
+ }
+
+
+
+ /**
+ * @return the dashboard_yn
+ */
+ public String getDashboard_yn() {
+ return dashboard_yn;
+ }
+
+
+
+ /**
+ * @param dashboard_yn the dashboard_yn to set
+ */
+ public void setDashboard_yn(String dashboard_yn) {
+ this.dashboard_yn = dashboard_yn;
+ }
+
+
+
+ /**
+ * @return the ownerId
+ */
+ public User getOwnerId() {
+ return ownerId;
+ }
+
+
+
+ /**
+ * @param ownerId the ownerId to set
+ */
+ public void setOwnerId(User ownerId) {
+ this.ownerId = ownerId;
+ }
+
+
+
+ /**
+ * @return the createId
+ */
+ public User getCreateId() {
+ return createId;
+ }
+
+
+
+ /**
+ * @param createId the createId to set
+ */
+ public void setCreateId(User createId) {
+ this.createId = createId;
+ }
+
+
+
+ /**
+ * @return the maintId
+ */
+ public User getMaintId() {
+ return maintId;
+ }
+
+
+
+ /**
+ * @param maintId the maintId to set
+ */
+ public void setMaintId(User maintId) {
+ this.maintId = maintId;
+ }
+
+
+
+ public int compareTo(Object obj){
+ String c1 = getTitle();
+ String c2 = ((CR_Report)obj).getTitle();
+
+ return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/QuickLink.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/QuickLink.java
new file mode 100644
index 00000000..75b2d119
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/QuickLink.java
@@ -0,0 +1,61 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.domain;
+
+public class QuickLink {
+
+ private String reportURL;
+ private String reportName;
+ private String reportDescr;
+ private Boolean showDescr;
+
+ public String getReportURL() {
+ return reportURL;
+ }
+
+ public void setReportURL(String reportURL) {
+ this.reportURL = reportURL;
+ }
+
+ public String getReportName() {
+ return reportName;
+ }
+
+ public void setReportName(String reportName) {
+ this.reportName = reportName;
+ }
+
+ public String getReportDescr() {
+ return reportDescr;
+ }
+
+ public void setReportDescr(String reportDescr) {
+ this.reportDescr = reportDescr;
+ }
+
+ public Boolean getShowDescr() {
+ return showDescr;
+ }
+
+ public void setShowDescr(Boolean showDescr) {
+ this.showDescr = showDescr;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/RaptorSearch.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/RaptorSearch.java
new file mode 100644
index 00000000..cb85f368
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/RaptorSearch.java
@@ -0,0 +1,188 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.domain;
+
+import java.util.Date;
+
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.core.domain.support.DomainVo;;
+
+public class RaptorSearch extends DomainVo {
+
+ private Long repId;
+ private String title;
+ private String descr;
+ private String ownerName;
+ private Date createDate;
+ private String canEdit;
+ private String readOnly;
+ private String schedule;
+ // private Long countRows;
+
+ /**
+ * @return the repId
+ */
+ public Long getRepId() {
+ return repId;
+ }
+
+ /**
+ * @param repId
+ * the repId to set
+ */
+ public void setRepId(Long repId) {
+ this.repId = repId;
+ }
+
+ /**
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * @param title
+ * the title to set
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * @return the descr
+ */
+ public String getDescr() {
+ return descr;
+ }
+
+ /**
+ * @param descr
+ * the descr to set
+ */
+ public void setDescr(String descr) {
+ this.descr = descr;
+ }
+
+ /**
+ * @return the createDate
+ */
+ public Date getCreateDate() {
+ return createDate;
+ }
+
+ /**
+ * @param createDate
+ * the createDate to set
+ */
+ public void setCreateDate(Date createDate) {
+ this.createDate = createDate;
+ }
+
+ /**
+ * @return the ownerName
+ */
+ public String getOwnerName() {
+ return ownerName;
+ }
+
+ /**
+ * @param ownerName
+ * the ownerName to set
+ */
+ public void setOwnerName(String ownerName) {
+ this.ownerName = ownerName;
+ }
+
+ /**
+ * @return the schedule
+ */
+ public String getSchedule() {
+ return schedule;
+ }
+
+ /**
+ * @param schedule
+ * the schedule to set
+ */
+ public void setSchedule(String schedule) {
+ this.schedule = schedule;
+ }
+
+ /**
+ * @return the canEdit
+ */
+ public String getCanEdit() {
+ return canEdit;
+ }
+
+ /**
+ * @param canEdit
+ * the canEdit to set
+ */
+ public void setCanEdit(String canEdit) {
+ this.canEdit = canEdit;
+ }
+
+ /**
+ * @return the canDelete
+ */
+ public boolean canDelete() {
+ String s = getCanEdit();
+ if (s != null && s.length() > 0 && s.equals("Y")) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @return the canCopy
+ */
+ public boolean canCopy() {
+ String s = getReadOnly();
+ if (returnTrueOrFalse(s)) {
+ return Globals.getCanCopyOnReadOnly() ? true : returnTrueOrFalse(getCanEdit());
+ }
+ return true;
+ }
+
+ /**
+ * @return the readOnly
+ */
+ public String getReadOnly() {
+ return readOnly;
+ }
+
+ /**
+ * @param readOnly
+ * the readOnly to set
+ */
+ public void setReadOnly(String readOnly) {
+ this.readOnly = readOnly;
+ }
+
+ private boolean returnTrueOrFalse(String s) {
+ if (s != null && s.length() > 0 && s.equals("Y")) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/ReportInfo.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/ReportInfo.java
new file mode 100644
index 00000000..e11f3bcb
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/ReportInfo.java
@@ -0,0 +1,159 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.domain;
+
+import java.util.Date;
+
+public class ReportInfo {
+
+ private Long repId;
+ private String title;
+ private String createUser;
+ private String ownerName;
+ private Date createDate;
+ private Long lastAccessed = -1L;
+ private Long lastWeekAccess;
+ private Long lastMonthAccess;
+ private Long lastYearAccess;
+ private Long userAccessCount;
+ /**
+ * @return the repId
+ */
+ public Long getRepId() {
+ return repId;
+ }
+ /**
+ * @param repId the repId to set
+ */
+ public void setRepId(Long repId) {
+ this.repId = repId;
+ }
+ /**
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+ /**
+ * @param title the title to set
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ /**
+ * @return the createUser
+ */
+ public String getCreateUser() {
+ return createUser;
+ }
+ /**
+ * @param createUser the createUser to set
+ */
+ public void setCreateUser(String createUser) {
+ this.createUser = createUser;
+ }
+ /**
+ * @return the ownerName
+ */
+ public String getOwnerName() {
+ return ownerName;
+ }
+ /**
+ * @param ownerName the ownerName to set
+ */
+ public void setOwnerName(String ownerName) {
+ this.ownerName = ownerName;
+ }
+ /**
+ * @return the createDate
+ */
+ public Date getCreateDate() {
+ return createDate;
+ }
+ /**
+ * @param createDate the createDate to set
+ */
+ public void setCreateDate(Date createDate) {
+ this.createDate = createDate;
+ }
+ /**
+ * @return the lastAccessed
+ */
+ public Long getLastAccessed() {
+ return lastAccessed;
+ }
+ /**
+ * @param lastAccessed the lastAccessed to set
+ */
+ public void setLastAccessed(Long lastAccessed) {
+ this.lastAccessed = lastAccessed;
+ }
+ /**
+ * @return the lastWeekAccess
+ */
+ public Long getLastWeekAccess() {
+ return lastWeekAccess;
+ }
+ /**
+ * @param lastWeekAccess the lastWeekAccess to set
+ */
+ public void setLastWeekAccess(Long lastWeekAccess) {
+ this.lastWeekAccess = lastWeekAccess;
+ }
+ /**
+ * @return the lastMonthAccess
+ */
+ public Long getLastMonthAccess() {
+ return lastMonthAccess;
+ }
+ /**
+ * @param lastMonthAccess the lastMonthAccess to set
+ */
+ public void setLastMonthAccess(Long lastMonthAccess) {
+ this.lastMonthAccess = lastMonthAccess;
+ }
+ /**
+ * @return the lastYearAccess
+ */
+ public Long getLastYearAccess() {
+ return lastYearAccess;
+ }
+ /**
+ * @param lastYearAccess the lastYearAccess to set
+ */
+ public void setLastYearAccess(Long lastYearAccess) {
+ this.lastYearAccess = lastYearAccess;
+ }
+ /**
+ * @return the userAccessCount
+ */
+ public Long getUserAccessCount() {
+ return userAccessCount;
+ }
+ /**
+ * @param userAccessCount the userAccessCount to set
+ */
+ public void setUserAccessCount(Long userAccessCount) {
+ this.userAccessCount = userAccessCount;
+ }
+
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorService.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorService.java
new file mode 100644
index 00000000..26276579
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorService.java
@@ -0,0 +1,36 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.service;
+
+import java.util.List;
+import java.util.Map;
+
+
+
+public interface RaptorService {
+ public void deleteReport(Long reportId);
+ public List getReportInfo(Map params);
+ public int getTotalSize();
+ public int executeCountQuery(Class entity, String query, Map params, String whereClause);
+ public List executeGridQuery(String query, Map params, Integer fromIndex, Integer toIndex);
+ public List executeGridQueryOrderByWithLimit(Class entity, String query, Map params, String _orderBy, boolean _asc, Integer fromIndex, Integer toIndex);
+ public List executeGridQuery(Class entity, String query, String whereClause, Map params, Integer fromIndex, Integer toIndex);
+ public List executeGridQueryOrderByWithLimit(Class entity, String query, String whereClause, Map params, String _orderBy, boolean _asc, Integer fromIndex, Integer toIndex);
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorServiceImpl.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorServiceImpl.java
new file mode 100644
index 00000000..e8e0cf31
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorServiceImpl.java
@@ -0,0 +1,163 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.service;
+
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.portalsdk.analytics.system.fusion.domain.CR_Report;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.service.support.FusionService;
+import org.springframework.context.ApplicationContext;
+
+public class RaptorServiceImpl extends FusionService implements RaptorService {
+
+ private DataAccessService dataAccessService;
+
+ private int totalSize;
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ private ApplicationContext applicationContext;
+
+ //raptorSearchAllReportsCount
+
+ public int executeCountQuery(Class entity, String query, Map params, String whereClause) {
+ List l = getDataAccessService().executeNamedCountQuery(entity, query, whereClause, params);
+ //List l = getDataAccessService().executeNamedQuery(query, params, null);
+ int searchCount = 0;
+ if(l != null) {
+ if (!l.isEmpty()) {
+ searchCount = (((Long) l.get(0))).intValue();
+ }
+ }
+ totalSize = searchCount;
+ return totalSize;
+ }
+
+ //raptorSearchAllReports
+ public List executeGridQuery(String query, Map params, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQuery(query, params, fromIndex, toIndex, null);
+ }
+
+ public List executeGridQueryOrderByWithLimit(Class entity, String query, Map params, String _orderBy, boolean asc, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQueryWithOrderBy(entity, query, params, _orderBy, asc, fromIndex, toIndex, null);
+ }
+
+ //with where clause
+ public List executeGridQuery(Class entity, String query, String whereClause, Map params, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQuery(entity, query, whereClause, params, fromIndex, toIndex, null);
+ }
+
+ public List executeGridQueryOrderByWithLimit(Class entity, String query, String whereClause, Map params, String _orderBy, boolean asc, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQueryWithOrderBy(entity, query, whereClause, params, _orderBy, asc, fromIndex, toIndex, null);
+ }
+
+ /*
+ public int getUserReportsCount(Map params) {
+ List l = getDataAccessService().executeNamedQuery("raptorSearchUserReportsCount", params, null);
+ int count = 0;
+ if(l != null) {
+ if (!l.isEmpty()) {
+ Object[] result = (Object[]) l.get(0);
+ count = ((Long)result[0]).intValue();
+ }
+ }
+ totalSize = count;
+ return totalSize;
+ }
+
+ public List getUserReports(Map params, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQuery("raptorSearchUserReports", params, fromIndex, toIndex, null);
+ }
+
+ public int getPublicReportsCount(Map params) {
+ List l = getDataAccessService().executeNamedQuery("raptorPublicUserReportsCount", params, null);
+ int count = 0;
+ if(l != null) {
+ if (!l.isEmpty()) {
+ Object[] result = (Object[]) l.get(0);
+ count = ((Long)result[0]).intValue();
+ }
+ }
+ totalSize = count;
+ return totalSize;
+ }
+
+ public List getPublicReports(Map params, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQuery("raptorPublicUserReports", params, fromIndex, toIndex, null);
+ }
+
+ public int getFavReportsCount(Map params) {
+ List l = getDataAccessService().executeNamedQuery("raptorSearchFavReportsCount", params, null);
+ int count = 0;
+ if(l != null) {
+ if (!l.isEmpty()) {
+ Object[] result = (Object[]) l.get(0);
+ count = ((Long)result[0]).intValue();
+ }
+ }
+ totalSize = count;
+ return totalSize;
+ }
+
+ public List getFavReports(Map params, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQuery("raptorSearchFavReports", params, fromIndex, toIndex, null);
+ }
+ */
+ public int getTotalSize() {
+ return totalSize;
+ }
+
+ public void deleteReport(Long reportId) {
+ getDataAccessService().deleteDomainObject(getDataAccessService().getDomainObject(CR_Report.class, reportId, null), null);
+ }
+
+ public List getReportInfo(Map params) {
+ return getDataAccessService().executeNamedQuery("raptorInfoQuery", params, null);
+ }
+
+/* public List executeGridQueryWithOrderBy(String query, Map params, String _orderBy, boolean asc, Integer fromIndex, Integer toIndex) {
+ query = String.format(query, _orderBy, asc ? "ASC" : "DESC", fromIndex, toIndex);
+ DataSource ds = (DataSource)getApplicationContext().getBean(searchBean.getDatasourceName());
+ NamedParameterJdbcTemplate jdbcTemplate = new NamedParameterJdbcTemplate(ds);
+ }*/
+
+ /**
+ * @return the applicationContext
+ */
+ public ApplicationContext getApplicationContext() {
+ return applicationContext;
+ }
+
+ /**
+ * @param applicationContext the applicationContext to set
+ */
+ public void setApplicationContext(ApplicationContext applicationContext) {
+ this.applicationContext = applicationContext;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorController.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorController.java
new file mode 100644
index 00000000..417a8e19
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorController.java
@@ -0,0 +1,191 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.web;
+
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.portalsdk.analytics.controller.Action;
+import org.openecomp.portalsdk.analytics.controller.ErrorHandler;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+@RequestMapping("/")
+public class RaptorController extends RestrictedBaseController{
+ String viewName;
+ //static org.apache.log4j.Logger s_logger = org.apache.log4j.Logger.getLogger(RaptorController.class.getName());
+
+ @RequestMapping(value = {"/report" }, method = RequestMethod.GET)
+ public ModelAndView report(HttpServletRequest request) {
+ request.getSession().setAttribute("isEmbedded", false);
+ viewName = "report";
+ return new ModelAndView(getViewName());
+ }
+
+ @RequestMapping(value = {"/report_embedded" }, method = RequestMethod.GET)
+ public ModelAndView embededReport(HttpServletRequest request) {
+ request.getSession().setAttribute("isEmbedded", true);
+ viewName = "report_embedded";
+ return new ModelAndView(getViewName());
+ }
+
+ @RequestMapping(value = {"/report_sample" }, method = RequestMethod.GET)
+ public ModelAndView reportSample(HttpServletRequest request) {
+ viewName = "report_sample";
+ return new ModelAndView(getViewName());
+ }
+
+ @RequestMapping(value = {"/report_import.htm" }, method = RequestMethod.GET)
+
+ public ModelAndView RaptorWizard1(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ viewName = "report_import";
+ Action action = null;
+ String actionKey = "report.import";
+ ServletContext servletContext = request.getSession().getServletContext();
+ if( !Globals.isSystemInitialized()) {
+ Globals.initializeSystem(servletContext);
+ }
+ try {
+ action = Globals.getRaptorActionMapping().getAction(actionKey);
+ if (action == null)
+ throw new RaptorRuntimeException("Action not found");
+ } catch (RaptorException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. RaptorException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. Exception: " + e.getMessage()));
+ }
+ return new ModelAndView(getViewName(), "model", null);
+ }
+
+
+ @RequestMapping(value = {"/report_wizard.htm" }, method = {RequestMethod.POST, RequestMethod.GET})
+ public ModelAndView RaptorWizard(HttpServletRequest request, HttpServletResponse response) throws IOException {
+
+
+ viewName = "";
+ String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));
+ actionKey = nvl(actionKey, "report.run");
+ Action action = null;
+ ServletContext servletContext = request.getSession().getServletContext();
+ if( !Globals.isSystemInitialized()) {
+ Globals.initializeSystem(servletContext);
+ }
+ try {
+ action = Globals.getRaptorActionMapping().getAction(actionKey);
+ if (action == null)
+ throw new RaptorRuntimeException("Action not found");
+ } catch (RaptorException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. RaptorException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. Exception: " + e.getMessage()));
+ }
+
+ try {
+ Class[] paramTypes = new Class[2];
+ paramTypes[0] = Class.forName("javax.servlet.http.HttpServletRequest");
+ paramTypes[1] = Class.forName("java.lang.String");
+
+ Class handlerClass = Class.forName(action.getControllerClass());
+ Object handler = handlerClass.newInstance();
+ Method handlerMethod = handlerClass.getMethod(action.getControllerMethod(),
+ paramTypes);
+
+ Object[] paramValues = new Object[2];
+ paramValues[0] = request;
+ paramValues[1] = action.getJspName();;
+
+ viewName = (String) handlerMethod.invoke(handler, paramValues);
+ //ObjectMapper mapper = new ObjectMapper();
+ //response.setContentType("application/json");
+ //PrintWriter out = response.getWriter();
+ //out.write(viewName);
+
+ } catch (ClassNotFoundException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. ClassNotFoundException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ } catch (IllegalAccessException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. IllegalAccessException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (InstantiationException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Ocurring during Schedule "));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (NoSuchMethodException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. NoSuchMethodException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (InvocationTargetException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. InvocationTargetException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }
+ return new ModelAndView(getViewName(), "model", null);
+ }
+
+ public String getViewName() {
+ return viewName;
+ }
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+ public String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RaptorController.class);
+
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
new file mode 100644
index 00000000..bd3fdce3
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
@@ -0,0 +1,410 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.web;
+
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.controller.Action;
+import org.openecomp.portalsdk.analytics.controller.ErrorHandler;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
+import org.openecomp.portalsdk.analytics.model.ReportHandler;
+import org.openecomp.portalsdk.analytics.model.pdf.PdfReportHandler;
+import org.openecomp.portalsdk.analytics.model.runtime.CategoryAxisJSON;
+import org.openecomp.portalsdk.analytics.model.runtime.ChartJSON;
+import org.openecomp.portalsdk.analytics.model.runtime.RangeAxisJSON;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.view.ReportData;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.core.controller.UnRestrictedBaseController;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+@Controller
+@RequestMapping("/")
+public class RaptorControllerAsync extends UnRestrictedBaseController{
+ String viewName;
+
+ @RequestMapping(value = {"/raptor.htm" }, method = RequestMethod.GET)
+ public void RaptorSearch(HttpServletRequest request, HttpServletResponse response) throws IOException {
+
+ /* List items = null;
+ int reportId = ServletRequestUtils.getIntParameter(request, "report_id", 0);
+ //String task = ServletRequestUtils.getStringParameter(request, "task", TASK_GET);
+
+ HashMap additionalParams = new HashMap();
+ additionalParams.put(Parameters.PARAM_HTTP_REQUEST, request);
+
+ return new ModelAndView(getViewName(), "model", null);
+
+ //return new ModelAndView(getViewName(), "model", null);
+ //System.out.println("Fill with proper code");
+ //return null;*/
+ viewName = "";
+ String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));
+ actionKey = nvl(actionKey, "report.run");
+
+ HttpSession session = request.getSession();
+ User user = UserUtils.getUserSession(request);
+
+ if(actionKey.equals("report.download.excel2007.session") || actionKey.equals("report.download.csv.session") || actionKey.equals("report.download.excel.session") || actionKey.equals("report.download.pdf.session") ) {
+ if(session!=null && user!=null){
+ ServletContext servletContext = request.getSession().getServletContext();
+ if( !Globals.isSystemInitialized()) {
+ Globals.initializeSystem(servletContext);
+ }
+ ReportRuntime rr = null;
+ ReportData rd = null;
+ String parent = "";
+ int parentFlag = 0;
+ if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), "");
+ if(parent.startsWith("parent_")) parentFlag = 1;
+ if(parentFlag == 1) {
+ rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr");
+ rd = (ReportData) request.getSession().getAttribute(parent+"_rd");
+ }
+
+ boolean isEmbedded = false;
+ Object temp = request.getSession().getAttribute("isEmbedded");
+ if(temp!=null){
+ isEmbedded = (boolean)temp;
+ }
+ if(isEmbedded){
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ if(rr==null) rr = (ReportRuntime) ((HashMap)request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP)).get(reportID);
+ if(rd==null) rd = (ReportData) ((HashMap)request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP)).get(reportID);
+ } else {
+ if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ if(rd==null) rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA);
+ }
+ String user_id = AppUtils.getUserID(request);
+ try {
+ OutputStreamWriter out = new OutputStreamWriter(response.getOutputStream());
+
+ if(actionKey.equals("report.download.pdf.session")) {
+ new PdfReportHandler().createPdfFileContent(request,response, 3);
+ } else if (actionKey.equals("report.download.csv.session")) {
+ (new ReportHandler()).createCSVFileContent(out, rd, rr, request, response);
+ } else if (actionKey.equals("report.download.excel.session")) {
+ new ReportHandler().createExcelFileContent(out, rd, rr, request, response, user_id, 3); //3 whole
+ } else {
+
+ new ReportHandler().createExcel2007FileContent(out, rd, rr, request, response, user_id, 3); //3 whole
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ //Log.write("Fatal error [report_download_xlsx.jsp]: "+e.getMessage());
+ }
+ } else {
+ response.sendRedirect("login.htm");
+ }
+ } else {
+ if(session!=null && user!=null){
+ Action action = null;
+ ServletContext servletContext = request.getSession().getServletContext();
+ if( !Globals.isSystemInitialized()) {
+ Globals.initializeSystem(servletContext);
+ }
+ try {
+ action = Globals.getRaptorActionMapping().getAction(actionKey);
+ if (action == null)
+ throw new RaptorRuntimeException("Action not found");
+ } catch (RaptorException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. RaptorException: " + e.getMessage()));
+
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. Exception: " + e.getMessage()));
+ }
+
+ try {
+ Class[] paramTypes = new Class[2];
+ paramTypes[0] = Class.forName("javax.servlet.http.HttpServletRequest");
+ paramTypes[1] = Class.forName("java.lang.String");
+
+ Class handlerClass = Class.forName(action.getControllerClass());
+ Object handler = handlerClass.newInstance();
+ Method handlerMethod = handlerClass.getMethod(action.getControllerMethod(),
+ paramTypes);
+
+ Object[] paramValues = new Object[2];
+ paramValues[0] = request;
+ paramValues[1] = action.getJspName();;
+
+ viewName = (String) handlerMethod.invoke(handler, paramValues);
+ //ObjectMapper mapper = new ObjectMapper();
+ if(!actionKey.equals("chart.run"))
+ response.setContentType("application/json");
+ else
+ response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
+ out.write(viewName);
+
+ } catch (ClassNotFoundException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. ClassNotFoundException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ } catch (IllegalAccessException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. IllegalAccessException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (InstantiationException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. InstantiationException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (NoSuchMethodException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. NoSuchMethodException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (InvocationTargetException e) {
+ e.printStackTrace();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. InvocationTargetException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }
+ //return new ModelAndView(getViewName(), "model", null);
+ } else {
+ PrintWriter out = response.getWriter();
+ out.write("session has timed out for user");
+ }
+
+ }
+ }
+
+ @RequestMapping(value = "save_chart", method = RequestMethod.POST)
+ public void reportChartReceive(@RequestBody ChartJSON chartJSON, HttpServletRequest request, HttpServletResponse response) throws IOException {
+ ReportRuntime reportRuntime;
+ System.out.println("*****Hit RaptorChart******");
+ reportRuntime = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); //changing session to request
+ String reportID = request.getParameter("c_master");
+ if (reportRuntime == null && AppUtils.nvl(reportID).length() > 0) {
+ try {
+ ReportHandler rh = new ReportHandler();
+ reportRuntime = rh.loadReportRuntime(request, reportID);
+ } catch (RaptorException ex) {
+ ex.printStackTrace();
+
+ }
+ }
+
+ if (reportRuntime != null) {
+ String chartType = chartJSON.getChartType();
+ reportRuntime.setChartType(chartJSON.getChartType());
+ reportRuntime.setChartAnimate(chartJSON.isAnimation());
+ reportRuntime.setChartWidth(chartJSON.getWidth());
+ reportRuntime.setChartHeight(chartJSON.getHeight());
+ reportRuntime.setShowChartTitle(chartJSON.isShowTitle());
+
+
+ String domainAxis = null;
+ domainAxis = chartJSON.getDomainAxis();
+
+ List < DataColumnType > reportCols = reportRuntime.getAllColumns();
+
+ for (Iterator < DataColumnType > iter = reportCols.iterator(); iter
+ .hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if (dct.getColId().equals(domainAxis)) {
+ dct.setColOnChart(AppConstants.GC_LEGEND);
+ } else {
+ dct.setColOnChart(null);
+ }
+ }
+
+ CategoryAxisJSON categoryAxisJSON = chartJSON.getCategoryAxisJSON();
+ String categoryAxis = null;
+
+ categoryAxis = (categoryAxisJSON!=null?categoryAxisJSON.getValue():"");
+
+ reportCols = reportRuntime.getAllColumns();
+
+ for (Iterator < DataColumnType > iter = reportCols.iterator(); iter
+ .hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if (dct.getColId().equals(categoryAxis)) {
+ dct.setChartSeries(true);
+ } else {
+ dct.setChartSeries(false);
+ }
+ }
+
+
+ ArrayList < RangeAxisJSON > rangeAxisList = chartJSON.getRangeAxisList();
+ int r = 0;
+ for (int i = 0; i < rangeAxisList.size(); i++) {
+ RangeAxisJSON rangeAxisJSON = rangeAxisList.get(i);
+ String rangeAxis = rangeAxisJSON.getRangeAxis();
+ String rangeYAxis = AppUtils.nvl(rangeAxisJSON.getRangeYAxis());
+ String rangeChartGroup = AppUtils.nvl(rangeAxisJSON.getRangeChartGroup());
+ String rangeColor = AppUtils.nvl(rangeAxisJSON.getRangeColor());
+ String rangeLineType = AppUtils.nvl(rangeAxisJSON.getRangeLineType());
+
+ rangefor:
+ for (Iterator < DataColumnType > iterator = reportCols.iterator(); iterator.hasNext();) {
+ DataColumnType dct = (DataColumnType) iterator.next();
+ if (dct.getColId().equals(rangeAxis)) {
+ dct.setChartSeq(++r);
+ dct.setColOnChart("0");
+ dct.setYAxis(rangeYAxis); //+"|"+dct.getColId());
+ dct.setChartGroup(rangeChartGroup); //+"|"+dct.getColId());
+ dct.setChartColor(rangeColor);
+ dct.setChartLineType(rangeLineType);
+
+ if (chartType.equals(AppConstants.GT_ANNOTATION_CHART) || chartType.equals(AppConstants.GT_FLEX_TIME_CHARTS)) {
+ if (rangeAxisJSON.isShowAsArea()) {
+ dct.setIsRangeAxisFilled(true);
+ } else {
+ dct.setIsRangeAxisFilled(false);
+ }
+ }
+ break rangefor;
+ }
+ }
+
+ }
+
+
+ reportRuntime.setChartLeftAxisLabel(chartJSON.getPrimaryAxisLabel());
+ reportRuntime.setChartRightAxisLabel(chartJSON.getSecondaryAxisLabel());
+
+ reportRuntime.setRangeAxisLowerLimit(chartJSON.getMinRange());
+ reportRuntime.setRangeAxisUpperLimit(chartJSON.getMaxRange());
+
+
+
+ if (chartType.equals(AppConstants.GT_ANNOTATION_CHART) || chartType.equals(AppConstants.GT_FLEX_TIME_CHARTS)) {
+ if (chartJSON.getFlexTimeSeriesChartOptions() != null) {
+ reportRuntime.setZoomIn(chartJSON.getFlexTimeSeriesChartOptions().getZoomIn());
+ reportRuntime.setTimeAxisType(chartJSON.getFlexTimeSeriesChartOptions().getTimeAxisType());
+ }
+
+ }
+
+ if (chartType.equals(AppConstants.GT_TIME_SERIES)) {
+ if (chartJSON.getTimeSeriesChartOptions() != null) {
+ reportRuntime.setTimeSeriesRender(chartJSON.getTimeSeriesChartOptions().getLineChartRenderer());
+ reportRuntime.setShowXAxisLabel(chartJSON.getTimeSeriesChartOptions().isShowXAxisLabel());
+ reportRuntime.setAddXAxisTickers(chartJSON.getTimeSeriesChartOptions().isAddXAxisTicker());
+ reportRuntime.setTimeAxis(chartJSON.getTimeSeriesChartOptions().isNonTimeAxis());
+ reportRuntime.setMultiSeries(chartJSON.getTimeSeriesChartOptions().isMultiSeries());
+ }
+
+ }
+
+ if (chartType.equals(AppConstants.GT_BAR_3D)) {
+ if (chartJSON.getBarChartOptions() != null) {
+ reportRuntime.setChartOrientation(chartJSON.getBarChartOptions().isVerticalOrientation() ? "vertical" : "horizontal");
+ reportRuntime.setChartStacked(chartJSON.getBarChartOptions().isStackedChart());
+ reportRuntime.setBarControls(chartJSON.getBarChartOptions().isDisplayBarControls());
+ reportRuntime.setXAxisDateType(chartJSON.getBarChartOptions().isxAxisDateType());
+ reportRuntime.setLessXaxisTickers(chartJSON.getBarChartOptions().isMinimizeXAxisTickers());
+ reportRuntime.setTimeAxis(chartJSON.getBarChartOptions().isTimeAxis());
+ reportRuntime.setLogScale(chartJSON.getBarChartOptions().isyAxisLogScale());
+ }
+ }
+
+
+ reportRuntime.setLegendLabelAngle(chartJSON.getCommonChartOptions().getLegendLabelAngle());
+ reportRuntime.setChartLegendDisplay(chartJSON.getCommonChartOptions().isHideLegend() ? "Y" : "N");
+ reportRuntime.setAnimateAnimatedChart(chartJSON.getCommonChartOptions().isAnimateAnimatedChart());
+
+ reportRuntime.setTopMargin(chartJSON.getCommonChartOptions().getTopMargin());
+ reportRuntime.setBottomMargin(chartJSON.getCommonChartOptions().getBottomMargin());
+ reportRuntime.setLeftMargin(chartJSON.getCommonChartOptions().getLeftMargin());
+ reportRuntime.setRightMargin(chartJSON.getCommonChartOptions().getRightMargin());
+
+
+
+ for (Iterator < DataColumnType > iterator = reportCols.iterator(); iterator.hasNext();) {
+ DataColumnType dct = (DataColumnType) iterator.next();
+ if (!(AppUtils.nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND) || (dct.getChartSeq()!=null && dct.getChartSeq()>0) || dct.isChartSeries()) ) {
+ dct.setChartSeq(-1);
+ dct.setChartColor(null);
+ dct.setColOnChart(null);
+ dct.setCreateInNewChart(false);
+ dct.setChartGroup(null);
+ dct.setYAxis(null);
+ }
+ }
+
+
+ try {
+ reportRuntime.persistLinearReport(request);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ logger.error("While SAVING CHART", ex);
+ }
+ }
+
+ }
+
+ public String getViewName() {
+ return viewName;
+ }
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+ public String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RaptorControllerAsync.class);
+
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/ReportsSearchListController.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/ReportsSearchListController.java
new file mode 100644
index 00000000..b5df482b
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/ReportsSearchListController.java
@@ -0,0 +1,74 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.system.fusion.web;
+
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.portalsdk.analytics.system.fusion.service.RaptorService;
+import org.springframework.web.servlet.ModelAndView;
+
+
+public class ReportsSearchListController {
+
+ private RaptorService raptorService = null;
+
+ /**
+ * @return the raptorService
+ */
+ public RaptorService getRaptorService() {
+ return raptorService;
+ }
+
+ /**
+ * @param raptorService the raptorService to set
+ */
+ public void setRaptorService(RaptorService raptorService) {
+ this.raptorService = raptorService;
+ }
+
+ public ModelAndView handleRequestInternal(HttpServletRequest request,
+ HttpServletResponse response) {
+
+ /*List items = null;
+ int reportId = ServletRequestUtils.getIntParameter(request, "report_id", 0);
+ String task = ServletRequestUtils.getStringParameter(request, "task", TASK_GET);
+
+ HashMap additionalParams = new HashMap();
+ additionalParams.put(Parameters.PARAM_HTTP_REQUEST, request);
+
+ if (reportId != 0 && task.equals(TASK_DELETE)) { // delete the selected record
+ getRaptorService().deleteReport(new Long(reportId));
+ }
+
+ items = getRaptorService().getReports();
+
+ Map model = new HashMap();
+ model.put("items", items);
+
+ return new ModelAndView(getViewName(), "model", model);
+ */
+ //return new ModelAndView(getViewName(), "model", null);
+ System.out.println("Fill with proper code");
+ return null;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/AppConstants.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/AppConstants.java
new file mode 100644
index 00000000..3ec5c5e8
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/AppConstants.java
@@ -0,0 +1,658 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.util;
+
+import org.openecomp.portalsdk.analytics.model.base.IdNameList;
+
+/**<HR/>
+ * This class is part of <B><I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I></B><BR/>
+ * <HR/>
+ *
+ * --------------------------------------------------------------------------------------------------<BR/>
+ * <B>AppConstants.java</B> - This class holds almost all shareable constants for RAPTOR.
+ * --------------------------------------------------------------------------------------------------<BR/>
+ *
+ *
+ * <U>Change Log</U><BR/><BR/>
+ *
+ * 27-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Added PUBLIC constant for SearchHandler</LI></UL>
+ * 14-Jul-2009 : Version 8.4 (Sundar); <UL><LI> New constants related to Dashboard is added.</LI></UL>
+ * 29-Jun-2009 : Version 8.4 (Sundar); <UL><LI> New constants related to Compare To Prev Year Chart is added.</LI></UL>
+ * 22-Jun-2009 : Version 8.4 (Sundar); <UL><LI> 3 new constants related to Pareto Chart, Multiple Time
+ * Series and Time difference Chart.</LI></UL>
+ *
+ */
+
+public class AppConstants {
+ // Session attribute IDs
+ public final static String SI_BACKUP_FOR_REP_ID = "backup_for_report_id";
+ public final static String SI_DASHBOARD_REP_ID = "dashboard_report_id";
+ public final static String SI_DASHBOARD_REPORTRUNTIME_MAP = "dashboardReportRuntimeMap";
+ public final static String SI_DASHBOARD_REPORTDATA_MAP = "dashboardReportDataMap";
+ public final static String SI_DASHBOARD_CHARTDATA_MAP = "dashboardChartDataMap";
+ public final static String SI_DASHBOARD_DISPLAYTYPE_MAP = "dashboardDisplayTypeMap";
+ public final static String SI_DASHBOARD_REPORTRUNTIME = "dashboardRuntime";
+ public final static String EMBEDDED_REPORTRUNTIME_MAP = "embeddedReportRuntimeMap";
+ public final static String EMBEDDED_REPORTDATA_MAP = "embeddedReportDataMap";
+
+ public final static String DRILLDOWN_INDEX = "drilldown_index";
+ public final static String FORM_DRILLDOWN_INDEX = "form_drilldown_index";
+
+ public final static String DRILLDOWN_REPORTS_LIST = "drilldownReportsList";
+
+ public final static String SI_REPORT_RUN_BACKUP = "report_runtime_backup";
+
+ public final static String SI_REPORT_RUNTIME = "report_runtime";
+
+ public final static String SI_FORMFIELD_INFO = "formfield_info";
+
+ public final static String SI_FORMFIELD_DOWNLOAD_INFO = "formfield_download_info";
+
+ public final static String SI_REPORT_DEFINITION = "report_definition";
+
+ public final static String SI_DATA_SIZE_FOR_TEXTFIELD_POPUP = "dataSizeForPopUp";
+
+ public final static String SI_MAP_OBJECT = "novamap";
+
+ public final static String SI_MAP = "raptorMap";
+
+ // Added for Adhoc Scheduling
+ public final static String SI_REPORT_SCHEDULE = "report_schedule";
+
+ public final static String SI_COLUMN_LOOKUP = "column_lookup";
+
+ // Request attribute IDs
+ public final static String RI_ACTION = "r_action";
+
+ public final static String RI_JAVASCRIPT_ITEM_ID = "javascriptItemId";
+
+ // added for form field chaining in schedule tab
+ public final static String SCHEDULE_ACTION = "N";
+
+ public final static String RI_REFRESH = "refresh";
+
+ public final static String RI_EXCEPTION = "c_exception";
+
+ public final static String RI_ERROR_LIST = "c_error_list";
+
+ public final static String RI_REPORT_ID = "c_master"; // should be
+ // reportID not
+ // c_master
+ public final static String RI_DASHBOARD_ID = "c_dashboard";
+
+ public final static String RI_DETAIL_ID = "c_detail"; // should be
+ // detailID not
+ // c_detail
+
+ public final static String RI_REPORT_DATA = "report_data";
+
+ public final static String RI_REPORT_DATA_WHOLE = "report_data_whole";
+
+ public final static String RI_REPORT_SQL_WHOLE = "report_sql_whole";
+
+ public final static String RI_CHART_DATA = "chart_data";
+
+ public final static String RI_CHART_FORECAST_DATA = "chart_forecast_data";
+
+ public final static String RI_CHART_TOTAL_COL = "chart_total"; // to show sub-totals
+
+ public final static String RI_CHART_COLOR = "chart_color"; // to specify colors
+
+ public final static String RI_CHART_INCLUDE = "chart_include"; //
+
+ public final static String RI_CHART_MARKER_START = "chart_marker_start"; //marker line
+
+ public final static String RI_CHART_MARKER_END = "chart_marker_end"; //marker line
+
+ public final static String RI_CHART_MARKER_TEXT_LEFT = "chart_marker_text_left"; //marker line
+
+ public final static String RI_CHART_MARKER_TEXT_RIGHT = "chart_marker_text_right"; //marker line
+
+ public final static String RI_ANOMALY_TEXT = "anomaly_text"; //marker line
+
+ public final static String RI_JAVASCRIPT = "javascriptElement";
+
+ public final static String RI_PAGE_TITLE = "title";
+
+ public final static String RI_PAGE_SUBTITLE = "subtitle";
+
+ public final static String RI_NEXT_PAGE = "r_page";
+
+ public final static String RI_PAGE_SIZE = "r_page_size";
+
+ public final static String RI_RECORD_NO = "r_record";
+
+ public final static String RI_NEXT_PAGE_SET = "r_page_set";
+
+ public final static String RI_DATA_SIZE = "r_data_size";
+
+ public final static String RI_SORT_ORDER = "sort_order";
+
+ public final static String RI_USER_REPORTS = "user_reports";
+
+ public final static String RI_PUBLIC_REPORTS = "public_reports";
+
+ public final static String RI_FAVORITE_REPORTS = "favorite_reports";
+
+ public final static String RI_F_REPORT_ID = "f_report_id";
+
+ public final static String RI_F_REPORT_NAME = "f_report_name";
+
+ public final static String RI_F_REPORT_CREATE_DATE = "f_report_create_date";
+
+ public final static String RI_F_PUBLIC = "f_public";
+
+ public final static String RI_F_OWNER_ID = "f_owner_id";
+
+ public final static String RI_SEARCH_RESULT = "search_result";
+
+ public final static String RI_JS_TARGET_FIELD = "js_target_field";
+
+ public final static String RI_FIELD_NAME = "field_name";
+
+ public final static String RI_COLUMN_ID = "column_id";
+
+ public final static String RI_ARG_TYPE = "arg_type";
+
+ public final static String RI_VIEW_ACTION = "view_action";
+
+ public final static String RI_SOURCE_PAGE = "source_page";
+
+ public final static String RI_GO_TO_STEP = "go_to_step";
+
+ public final static String RI_WIZARD_ACTION = "wizard_action";
+
+ public final static String RI_FORMATTED_SQL = "formatted_sql";
+
+ public final static String RI_DATA_SET = "data_set";
+
+ public final static String RI_FORM_FIELDS = "form_fields";
+
+ public final static String RI_DISPLAY_CONTENT = "display_content";
+
+ public final static String RI_SHOW_BACK_BTN = "show_back_btn";
+
+ public final static String RI_GO_BACK = "go_back";
+
+ public final static String RI_RESET_PARAMS = "reset_params";
+
+ public final static String RI_RESET_ACTION = "reset_action";
+
+ public final static String RI_VISUAL_ACTION = "v_action";
+
+ public final static String RI_SEARCH_STRING = "search_string";
+
+ public final static String RI_CONTAIN_FLAG = "contain_flag";
+
+ public final static String RI_TABLE_NAME = "table_name";
+
+ public final static String RI_DISPLAY_CHART = "display_chart";
+
+ public final static String RI_CHK_FIELD_SQL = "check_field_sql";
+
+ public final static String RI_EDIT_LINK = "edit_link";
+
+ public final static String RI_SCHEDULE_LINK = "schedule_link";
+
+ public final static String RI_LIST_CATEGORY = "raptor_list_category";
+
+ public final static String RI_SCHEDULE_ID = "c_schedule"; // should be
+ // reportID not
+ // c_master
+ public final static String RI_TEXTFIELD_POP = "forTextFieldPopUp"; // should be
+
+
+ // Visualization actions
+ public final static String VA_SHOW = "Show";
+
+ public final static String VA_HIDE = "Hide";
+
+ public final static String VA_SORT = "Sort";
+
+ public final static String HIDDEN = "Hidden";
+
+ // Wizard steps
+ public final static String WS_DEFINITION = "Definition";
+
+ public final static String WS_TABLES = "Tables";
+
+ public final static String WS_SQL = "SQL";
+
+ public final static String WS_COLUMNS = "Columns";
+
+ public final static String WS_FORM_FIELDS = "Form Fields";
+
+ public final static String WS_FILTERS = "Filters";
+
+ public final static String WS_JAVASCRIPT = "Javascript";
+
+ public final static String WS_SORTING = "Sorting";
+
+ public final static String WS_CHART = "Chart";
+
+ public final static String WS_USER_ACCESS = "Security";
+
+ public final static String WS_DATA_FORECASTING = "Forecasting";
+
+ public final static String WS_SCHEDULE = "Schedule";
+
+ public final static String WS_REPORT_LOG = "Log";
+
+ public final static String WS_RUN = "Run";
+
+ /*****for report map******/
+ public final static String WS_MAP = "Map";
+
+
+
+ // Wizard sub-steps
+ public final static String WSS_ADD = "Add";
+
+ public final static String WSS_ADD_MULTI = "Add Multiple";
+
+ public final static String WSS_ORDER_ALL = "Re-order All";
+
+ public final static String WSS_EDIT = "Edit";
+
+ public final static String WSS_DELETE = "Delete";
+
+ public final static String WSS_ADD_BLANK = "Add Blank";
+
+ public final static String WSS_INFO_BAR = "Display parameters";
+
+ // Wizard actions
+ public final static String WA_NEXT = "Next";
+
+ public final static String WA_BACK = "Back";
+
+ public final static String WA_ADD = "Add";
+
+ public final static String WA_ADD_MULTI = "Add Multiple";
+
+ public final static String WA_ORDER_ALL = "Re-order All";
+
+ public final static String WA_EDIT = "Edit";
+
+ public final static String WA_MODIFY = "Modify";
+
+ public final static String WA_DELETE = "Delete";
+
+ public final static String WA_SAVE = "Save";
+
+ public final static String WA_MOVE_UP = "Move Up";
+
+ public final static String WA_MOVE_DOWN = "Move Down";
+
+ public final static String WA_ADD_USER = "Add User";
+
+ public final static String WA_DELETE_USER = "Delete User";
+
+ public final static String WA_GRANT_USER = "Grant User Access";
+
+ public final static String WA_REVOKE_USER = "Revoke User Access";
+
+ public final static String WA_ADD_ROLE = "Add Role";
+
+ public final static String WA_DELETE_ROLE = "Delete Role";
+
+ public final static String WA_GRANT_ROLE = "Grant Role Access";
+
+ public final static String WA_REVOKE_ROLE = "Revoke Role Access";
+
+ public final static String WA_VALIDATE = "Validate";
+
+ // File types
+ public final static String FT_ZIP = ".zip";
+ public final static String FT_TXT = ".txt";
+ public final static String FT_DAT = ".dat";
+ public final static String FT_CSV = ".csv";
+ public final static String FT_XLS = ".xls";
+ public final static String FT_XLS_ALL = "_all.xls";
+
+ public final static String FT_CSV_ALL = "_all.csv";
+
+
+ public final static String FT_XML = ".xml";
+
+ public final static String FT_SQL = ".sql";
+ public final static String FT_COLUMNS = ".head";
+
+ public final static String FILE_PREFIX = "cr_";
+
+ // Chart types
+ public final static String GT_BAR_3D = "BarChart3D";
+
+ public final static String GT_HORIZ_BAR = "HorizontalBarChart";
+
+ public final static String GT_STACKED_HORIZ_BAR = "HorizontalStackedBarChart";
+
+ public final static String GT_STACKED_VERT_BAR = "VerticalStackedBarChart";
+
+ public final static String GT_STACKED_HORIZ_BAR_LINES = "HorizontalStackedBarLinesChart";
+
+ public final static String GT_STACKED_VERT_BAR_LINES = "VerticalStackedBarLinesChart";
+
+ public final static String GT_VERT_BAR = "VerticalBarChart";
+
+ public final static String GT_TOTAL_BAR = "TotalBarChart";
+
+ public final static String GT_PIE_3D = "Pie3DChart";
+
+ public final static String GT_PIE = "PieChart";
+
+ public final static String GT_PIE_MULTIPLE = "MultiplePieChart";
+
+ public final static String GT_TIME_SERIES = "TimeSeriesChart";
+
+ public final static String GT_LINE = "LineChart";
+
+ public final static String GT_SCATTER = "ScatterPlotChart";
+
+ public final static String GT_HIERARCHICAL = "HierarchicalChart";
+
+ public final static String GT_HIERARCHICAL_SUNBURST = "HierarchicalSunBurstChart";
+
+ public final static String GT_REGRESSION = "RegressionPlotChart";
+
+ public final static String GT_BAR_LINES = "BarLinesChart";
+
+ public final static String GT_MULTI_SERIES_CHART = "MultiSeriesChart";
+
+ public final static String GT_PARETO_CHART = "ParetoChart";
+
+ public final static String GT_MULTIPLE_TIMESERIES_CHART = "MultipleTimeSeriesChart";
+
+ public final static String GT_TIME_DIFFERENCE_CHART = "TimeDifferenceChart";
+
+ public final static String GT_COMPARE_PREVYEAR_CHART = "CompareToPrevYear";
+
+ public final static String GT_ANNOTATION_CHART = "AnnotationChart";
+
+ public final static String GT_FLEX_TIME_CHARTS = "FlexTimeChart";
+
+ // Non-standard chart types
+ public final static String GT_MTD_BAR = "MTDBarChart";
+
+ public final static String GT_METER = "MeterChart";
+
+ public final static String GT_STACK_BAR = "StackedBarChart";
+
+
+ // chart filter
+ public final static int CHART_ALL_COLUMNS = 0;
+ public final static int CHART_WITHOUT_NEWCHART_COLUMNS = 1;
+ public final static int CHART_NEWCHART_COLUMNS = 2;
+
+
+
+ // Chart columns
+ public final static String GC_LEGEND = "LEGEND";
+
+ /* Datamining Constants */
+ public final static String DM_DATE_ATTR = "DM_DATE_ATTR";
+ public final static String DM_FORECASTING_ATTR = "DM_FORECAST_ATTR";
+ public final static String DM_GAUSSIAN_CLASSIFIER = "GAUSSIAN";
+ public final static String DM_SVM_CLASSIFIER = "SVM";
+
+ // Schedule recurrence
+
+ public final static String SR_ONETIME = "ONE_TIME";
+ public final static String SR_HOURLY = "HOURLY";
+
+ public final static String SR_DAILY = "DAILY";
+
+ public final static String SR_DAILY_MO_FR = "DAILY_MO_FR";
+
+ public final static String SR_WEEKLY = "WEEKLY";
+
+ public final static String SR_MONTHLY = "MONTHLY";
+
+ // User access type
+ public final static String UA_READ = "read";
+
+ public final static String UA_WRITE = "write";
+
+ public final static String UA_DELETE = "delete";
+
+ // Semaphore Type
+ public static final String ST_ROW = "ROW";
+
+ public static final String ST_CELL = "CELL";
+
+ // Sort Order
+ public static final String SO_ASC = "ASC";
+
+ public static final String SO_DESC = "DESC";
+
+ // Report Log Action
+ public static final String RLA_CREATE = "Report Created";
+
+ public static final String RLA_UPDATE = "Report Updated";
+
+ public static final String RLA_DELETE = "Report Deleted"; // Not used
+
+ public static final String RLA_RUN = "Report Run";
+
+ public static final String RLA_EXECUTION_TIME = "Report Execution Time";
+
+ public static final String RLA_SCHEDULED_DOWNLOAD_EXCEL = "Scheduled and Generated in Excel";
+
+ public static final String RLA_SCHEDULED_DOWNLOAD_PDF = "Scheduled and Generated in PDF";
+
+ public static final String RLA_DOWNLOAD_EXCEL = "Generated in Excel";
+
+ public static final String RLA_DOWNLOAD_PAGE_EXCEL = "Generated in Excel for the current Page";
+
+ public static final String RLA_DOWNLOAD_EXCELX = "Generated in Excel 2007";
+
+ public static final String RLA_SCHEDULED_DOWNLOAD_EXCELX = "Scheduled and Generated in Excel 2007";
+
+ public static final String RLA_DOWNLOAD_PDF = "Generated in PDF";
+
+ public static final String RLA_DOWNLOAD_CSV = "Generated in CSV";
+
+ public static final String RLA_DOWNLOAD_TEXT = "Generated in TEXT";
+
+ public static final String RLA_ERROR = "Error Occurred";
+
+ public static final String RLA_FROM_LOG = "From Log List";
+
+ // Drill-down extra date columns extension
+ public static final String DD_COL_EXTENSION = "_dde";
+
+ // Column "don't attempt to parse as date" flag - currently placed in the
+ // comment
+ public static final String CF_NO_PARSE_DATE = "NO_PARSE_DATE";
+
+ /**
+ * *************** Transferred from CustomReportWrapper
+ * *********************
+ */
+
+ // Default Oracle date format
+ public static final String DEFAULT_DATE_FORMAT = "%m/%d/%Y";
+
+ // Java date formats
+ public static final String JAVA_DATE_FORMAT_MMDDYYYY = "MM/dd/yyyy";
+
+ public static final String JAVA_DATE_FORMAT_MMDDYYYY_HR = "MM/dd/yyyy hh aaa" ; //01-SEP-2013 00 AM
+
+ public static final String JAVA_DATE_FORMAT_MMYYYY = "MM/yyyy";
+
+ public static final String JAVA_DATE_FORMAT_DDMONYYYY = "dd-MMM-yyyy";
+
+ public static final String JAVA_DATE_FORMAT_DDMONYYYY_HR = "dd-MMM-yyyy hh aaa" ; //01-SEP-2013 00 AM
+
+ public static final String JAVA_DATE_FORMAT_MONTHDDYYYY = "MMMMMMMM dd, yyyy";
+
+ public static final String JAVA_DATE_FORMAT_MONTHYYYY = "MMMMMMMM, yyyy";
+
+ // Filter predefined values
+ public static final String FILTER_MAX_VALUE = "[MAX_VALUE]"; // Max value
+ // in that
+ // database
+ // column
+
+ public static final String FILTER_MIN_VALUE = "[MIN_VALUE]"; // Min value
+ // in that
+ // database
+ // column
+
+ // Column type constants
+ public static final String CT_CHAR = "VARCHAR2";
+
+ public static final String CT_NUMBER = "NUMBER";
+
+ public static final String CT_DATE = "DATE";
+
+ public static final String CT_HYPERLINK = "HYPERLINK";
+
+ public static final String CT_TIMESTAMP = "TIMESTAMP";
+
+ // Filter argument type constants
+ public static final String AT_FORMULA = "FORMULA"; // Exact expression -
+ // can be anything as
+ // long as fits in the
+ // SQL statement
+
+ public static final String AT_VALUE = "VALUE"; // Constant value - example
+ // 35 or Amsterdam or
+ // 11/25/2004
+
+ public static final String AT_LIST = "LIST"; // List of constant value -
+ // must include formatting -
+ // like 'a','b' or
+ // TO_DATE('11/11/2001','MM/DD/YYYY'),TO_DATE('02/11/2001','MM/DD/YYYY')
+
+ public static final String AT_COLUMN = "COLUMN"; // Column id of one of
+ // the columns in the
+ // report
+
+ public static final String AT_FORM = "FORM"; // To be inserted in a form
+ // before running the report
+
+ // Report type constants
+ public static final String RT_LINEAR = "Linear";
+
+ public static final String RT_CROSSTAB = "Cross-Tab";
+
+ public static final String RT_DASHBOARD = "Dashboard";
+ public static final String RT_HIVE = "Hive";
+
+ // Report definition type constants
+ public static final String RD_VISUAL = "Visual";
+
+ public static final String RD_SQL_BASED = "SQL-based";
+
+ public static final String RD_SQL_BASED_DATAMIN = "SQL-based_Datamining";
+
+ // Column cross-tab position
+ public static final String CV_ROW = "ROW";
+
+ public static final String CV_COLUMN = "COLUMN";
+
+ public static final String CV_VALUE = "VALUE";
+
+ // Outer join type constants
+ public static final String OJ_CURRENT = "CURRENT"; // cur_table (+) =
+ // join_table
+
+ public static final String OJ_JOINED = "JOINED"; // cur_table =
+ // join_table (+)
+
+
+
+ // List of Available Total Functions
+ public static final String TOTAL_SUM_ID = "SUM(";
+
+ public static IdNameList TOTAL_FUNCTIONS = new IdNameList();
+
+ public static final String DB_LOCAL = "local";
+
+ public static final String DB_DEV = "dev";
+
+ public static final String DB_PROD = "prod";
+
+ public static final String SHELL_SCRIPT_NAME = "dwnldflatfile.sh";
+
+ public static final String SCHEDULE_SHELL_SCRIPT_NAME = "dwnldflatfileschedule.sh";
+
+ public static final String SHELL_QUERY_DIR = "query/";
+
+ public static final String SHELL_SCRIPTS_DIR = "scripts/";
+
+ public static final String SHELL_DATA_DIR = "data/";
+
+ public static final int WEB_VERSION = 0;
+
+ public static final int IPHONE_VERSION = 1;
+
+ public static final String MYSQL = "mysql";
+ public static final String ORACLE = "oracle";
+ public static final String POSTGRESQL = "postgresql";
+
+ // COLORS to be used in Excel
+ public static String Aqua = "#00FFFF";
+ public static String Black = "#000000";
+ public static String Blue = "#0000FF";
+ public static String Fuchsia = "#FF00FF";
+ public static String Gray = "#808080";
+ public static String Green = "#008000";
+ public static String Lime = "#00FF00";
+ public static String Maroon = "#800000";
+ public static String Navy = "#000080";
+ public static String Olive = "#808000";
+ public static String Orange = "#FF9900";
+ public static String Purple = "#800080";
+ public static String Red = "#FF0000";
+ public static String Silver = "#C0C0C0";
+ public static String Teal = "#008080";
+ public static String White = "#FFFFFF";
+ public static String Yellow = "#FFFF00";
+ // End
+ public static void initializeAppConstants() {
+ // Initialize TOTAL_FUNCTIONS
+ if (TOTAL_FUNCTIONS.getCount() == 0) {
+ TOTAL_FUNCTIONS.addValue(TOTAL_SUM_ID, "Sum");
+ TOTAL_FUNCTIONS.addValue("MAX(", "Max");
+ TOTAL_FUNCTIONS.addValue("MIN(", "Min");
+ TOTAL_FUNCTIONS.addValue("COUNT(ALL ", "Count All");
+ TOTAL_FUNCTIONS.addValue("COUNT(DISTINCT ", "Count Distinct");
+ TOTAL_FUNCTIONS.addValue("AVG(ALL ", "Average All");
+ TOTAL_FUNCTIONS.addValue("AVG(DISTINCT ", "Average Distinct");
+ TOTAL_FUNCTIONS.addValue("VARIANCE(ALL ", "Variance All");
+ TOTAL_FUNCTIONS.addValue("VARIANCE(DISTINCT ", "Variance Distinct");
+ TOTAL_FUNCTIONS.addValue("STDDEV(ALL ", "Standard Deviation All");
+ TOTAL_FUNCTIONS.addValue("STDDEV(DISTINCT ", "Standard Deviation Distinct");
+ TOTAL_FUNCTIONS.addValue("AVG(ALL +STDDEV(ALL ",
+ "Average + Standard Deviation All");
+ TOTAL_FUNCTIONS.addValue("AVG(ALL +2*STDDEV(ALL ",
+ "Average + 2 * Standard Deviation All");
+ TOTAL_FUNCTIONS.addValue("AVG(ALL -STDDEV(ALL ",
+ "Average - Standard Deviation All");
+ TOTAL_FUNCTIONS.addValue("AVG(ALL -2*STDDEV(ALL ",
+ "Average - 2 * Standard Deviation All");
+ } // if
+
+ // ...
+ } // initializeAppConstants
+
+} // AppConstants
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/DataSet.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/DataSet.java
new file mode 100644
index 00000000..e70a2ed2
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/DataSet.java
@@ -0,0 +1,177 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.util;
+
+import java.io.Serializable;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.Vector;
+
+public class DataSet extends Vector implements Serializable {
+ private Vector columnNames = null;
+
+ private Vector columnTypes = null;
+
+ public DataSet(ResultSet rs) throws SQLException {
+ this(rs, Integer.MAX_VALUE);
+ } // DataSet
+
+ public DataSet(ResultSet rs, int maxRowLimit) throws SQLException {
+ ResultSetMetaData rsmd = rs.getMetaData();
+ int mb = 1024*1024;
+ Runtime runtime = Runtime.getRuntime();
+
+ int colCount = rsmd.getColumnCount();
+ columnNames = new Vector(colCount);
+ columnTypes = new Vector(colCount);
+ for (int i = 1; i <= colCount; i++) {
+ columnNames.add(rsmd.getColumnLabel(i)); // getColumnLabel ??
+ columnTypes.add(rsmd.getColumnTypeName(i));
+ } // for
+
+ while (rs.next() && size() < maxRowLimit) {
+// if(runtime.freeMemory()/mb <= ((runtime.maxMemory()/mb)*(Globals.getMemoryThreshold()*2)/100) ) {
+// System.out.println("freeMemory " + runtime.freeMemory());
+// System.out.println("Max Memory " + runtime.maxMemory());
+// System.out.println("If Logic " + (runtime.freeMemory()/mb <= ((runtime.maxMemory()/mb)*(Globals.getMemoryThreshold()*2)/100)));
+// break;
+// }
+
+ Vector v = new Vector(colCount);
+ for (int i = 1; i <= colCount; i++)
+ v.add(rs.getString(i));
+ add(v);
+ } // while
+
+ if(rs!=null)
+ rs.close();
+ } // DataSet
+
+ public DataSet() {
+ columnNames = new Vector();
+ columnTypes = new Vector();
+ } // DataSet
+
+ public void insertRow(int rowIdx) {
+ if (rowIdx > size())
+ rowIdx = size();
+
+ Vector v = new Vector(columnNames.size());
+ for (int i = 0; i < columnNames.size(); i++)
+ v.add("");
+ add(rowIdx, v);
+ } // insertRow
+
+ public void insertColumn(int colIdx, String colName) {
+ insertColumn(colIdx, colName, "VARCHAR2");
+ } // insertColumn
+
+ public void insertColumn(int colIdx, String colName, String colType) {
+ if (colIdx > columnNames.size())
+ colIdx = columnNames.size();
+
+ columnNames.add(colIdx, colName);
+ columnTypes.add(colIdx, colType);
+
+ for (int i = 0; i < size(); i++)
+ ((Vector) get(i)).add(colIdx, "");
+ } // insertColumn
+
+ public void setValue(int rowIdx, int colIdx, String value) {
+ ((Vector) get(rowIdx)).set(colIdx, value);
+ } // setValue
+
+ public void setValue(int rowIdx, String colName, String value) {
+ ((Vector) get(rowIdx)).set(getColumnIndex(colName), value);
+ } // setValue
+
+ public void setString(int rowIdx, int colIdx, String value) {
+ setValue(rowIdx, colIdx, value);
+ } // setString
+
+ public void setString(int rowIdx, String colName, String value) {
+ setValue(rowIdx, colName, value);
+ } // setString
+
+ public int getRowCount() {
+ return size();
+ } // getRowCount()
+
+ public int getColumnCount() {
+ return columnNames.size();
+ } // getColumnCount
+
+ public String getColumnName(int colIdx) {
+ return ((String) columnNames.get(colIdx));
+ } // getColumnName
+
+ public String getColumnType(int colIdx) {
+ return ((String) columnTypes.get(colIdx));
+ } // getColumnType
+
+ public String getColumnType(String colName) {
+ return getColumnType(getColumnIndex(colName));
+ } // getColumnType
+
+ public int getColumnIndex(String colName) {
+ for (int i = 0; i < columnNames.size(); i++)
+ if (colName.equalsIgnoreCase((String) columnNames.get(i)))
+ return i;
+
+ return -1;
+ } // getColumnIndex
+
+ public String getString(int rowIdx, int colIdx) {
+ return nvl((String) ((Vector) get(rowIdx)).get(colIdx));
+ } // getString
+
+ public String getString(int rowIdx, String colName) {
+ return getString(rowIdx, getColumnIndex(colName));
+ } // getString
+
+ public int getInt(int rowIdx, int colIdx) {
+ return Integer.parseInt(getString(rowIdx, colIdx));
+ } // getString
+
+ public int getInt(int rowIdx, String colName) {
+ return getInt(rowIdx, getColumnIndex(colName));
+ } // getString
+
+ public String getItem(int rowIdx, int colIdx) {
+ return getString(rowIdx, colIdx);
+ } // getItem
+
+ public String getItem(int rowIdx, String colName) {
+ return getString(rowIdx, colName);
+ } // getItem
+
+ /** *********************************************************************** */
+
+ private String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ private String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+} // DataSet
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/ExcelColorDef.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/ExcelColorDef.java
new file mode 100644
index 00000000..6a03354e
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/ExcelColorDef.java
@@ -0,0 +1,68 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.util;
+
+
+import java.util.HashMap;
+
+import org.apache.poi.hssf.util.HSSFColor;
+
+public class ExcelColorDef {
+
+ /**
+ * @param args
+ */
+ public static HashMap colors = new HashMap();
+
+ public static void initializeExcelColorDef() {
+ colors.put("#00FFFF",new Short(HSSFColor.AQUA.index));
+ colors.put("#000000",new Short(HSSFColor.BLACK.index));
+ colors.put("#0000FF",new Short(HSSFColor.BLUE.index));
+ colors.put("#FF00FF",new Short(HSSFColor.PINK.index));
+ colors.put("#808080",new Short(HSSFColor.GREY_40_PERCENT.index));
+ colors.put("#008000",new Short(HSSFColor.BRIGHT_GREEN.index));
+ colors.put("#00FF00",new Short(HSSFColor.LIME.index));
+ colors.put("#800000",new Short(HSSFColor.MAROON.index));
+ colors.put("#000080",new Short(HSSFColor.ROYAL_BLUE.index));
+ colors.put("#808000",new Short(HSSFColor.OLIVE_GREEN.index));
+ colors.put("#FF9900",new Short(HSSFColor.ORANGE.index));
+ colors.put("#800080",new Short(HSSFColor.VIOLET.index));
+ colors.put("#FF0000",new Short(HSSFColor.RED.index));
+ colors.put("#C0C0C0",new Short(HSSFColor.CORAL.index));
+ colors.put("#008080",new Short(HSSFColor.TEAL.index));
+ colors.put("#FFFFFF",new Short(HSSFColor.WHITE.index));
+ colors.put("#FFFF00",new Short(HSSFColor.YELLOW.index));
+
+ }
+
+ public static short getExcelColor( String color) {
+ if ((colors != null) && (colors.containsKey(color))) {
+ return ((Short) colors.get(color)).shortValue();
+ }
+
+ return new Short(HSSFColor.WHITE.index).shortValue();
+ }
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/HtmlStripper.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/HtmlStripper.java
new file mode 100644
index 00000000..c1ffa70f
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/HtmlStripper.java
@@ -0,0 +1,155 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.util;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+public class HtmlStripper extends RaptorObject// this function can be accessed publicly
+{
+
+ String filename;
+ final char TXT_END_TAG = '>';
+ final char TXT_START_TAG = '<';
+
+ public String stripSpecialCharacters (String s) {
+ s = nvl(s);
+ StringBuffer sbuf = new StringBuffer();
+ int c;
+ int prev_char = 0;
+ boolean inText = true;
+ for (int i = 0; i < s.length(); i++) {
+ // while c is not last character
+ c = s.charAt(i);
+ //System.out.println("444 Character " + (char)c + " int " + c);
+ if ((char) c == TXT_END_TAG) {
+ // if char == '>' text following
+ // it and not HTML tag
+ inText = true;
+ } else if ((char) c == TXT_START_TAG) {
+ // if char == '<' tag is
+ // following not text
+ inText = false;
+ } /*else if ((char)c == '\n') {
+ System.out.println("new line " + (char)c + " int " + c);
+ inText = false;
+ }*/ /*else if ((char) c == '&') {
+ // if char == '&' chars following
+ // are not text
+ inText = false;
+ }*/
+ else if (inText) {
+ // if text write char to "text.txt"
+ //System.out.println("444444 Adding " + (char)c + " int " + c);
+ if (c >= 32 && c <= 122) {
+ if(c==32 || (c>32 && c<=47) || ( c>=58 && c<=64 )) {
+ if (c == 45) {
+ prev_char = 0;
+ sbuf.append((char) 45);
+ }
+ else if(prev_char != 95) {
+ prev_char = 95;
+ sbuf.append((char) 95);
+ }
+ }
+ else {
+ prev_char=0;
+ sbuf.append((char) c);
+ }
+ }
+ }
+ }
+ //System.out.println("\n\nFinished processing: " + s + "\n\n");
+ //System.out.println("\n\nThe processed String : " + sbuf.toString() + "\n\n");
+ return sbuf.toString();
+ }
+
+ public String stripHtml(String s) {
+
+ //System.out.println("Starting to process: " + s + "\n\n"); // prints
+ s = nvl(s);
+ StringBuffer sbuf = new StringBuffer();
+ int c;
+ boolean inText = true;
+ for (int i = 0; i < s.length(); i++) {
+ // while c is not last character
+ c = s.charAt(i);
+ if ((char) c == TXT_END_TAG) {
+ // if char == '>' text following
+ // it and not HTML tag
+ inText = true;
+ } else if ((char) c == TXT_START_TAG) {
+ // if char == '<' tag is
+ // following not text
+ inText = false;
+ } /*else if ((char)c == '\n') {
+ System.out.println("new line " + (char)c + " int " + c);
+ inText = false;
+ }*/ /*else if ((char) c == '&') {
+ // if char == '&' chars following
+ // are not text
+ inText = false;
+ }*/
+ else if (inText) {
+ // if text write char to "text.txt"
+ if (c >= 32 && c <= 122) {
+ sbuf.append((char) c);
+ }
+ }
+ }
+ //System.out.println("\n\nFinished processing: " + s + "\n\n");
+ //System.out.println("\n\nThe processed String : " + sbuf.toString() + "\n\n");
+ int pos = 0 ;
+ while(sbuf.indexOf("&nbsp;")!=-1) {
+ pos = sbuf.indexOf("&nbsp;");
+ sbuf.replace(pos, pos+6, " ");
+ }
+
+ return sbuf.toString();
+ }
+
+
+ public String stripCSVHtml (String s) {
+ String s1 = stripHtml(s);
+ //s1 = Utils.replaceInString(s1, "\"", "\"\"");
+ s1 = s1.replaceAll("\"", "\"\"");
+ return s1;
+ }
+
+ public static void main(String[] args) {
+
+ String st = " Import: report name hello $ # " ;
+ System.out.println("hello " + new HtmlStripper().stripSpecialCharacters(st));
+ StringBuffer strBuf = new StringBuffer("");
+ strBuf.append("<table class=\"mTAB\" border=\"0\" width=\"60%\">\n<tr class=\"rowalt1\">\n");
+ strBuf.append(" <td>Charge To Account</td> <td>ABBZ2</td>\n");
+ strBuf.append("</tr>\n");
+ strBuf.append("<tr class=\"rowalt2\">");
+ strBuf.append("<td>dateMonth</td> <td> 04/30/2008 </td>");
+ strBuf.append("</tr>");
+ strBuf.append("<tr class=\"rowalt1\">");
+ strBuf.append("<td>Generated Date/Time</td> <td> 05/30/2008 06:15:16 PM GMT </td>");
+ strBuf.append("</tr>");
+ strBuf.append("<tr class=\"rowalt2\">");
+ strBuf.append("<td>Login Id:</td> <td> sundar </td>");
+ strBuf.append("</tr>");
+ strBuf.append("</table>");
+ new HtmlStripper().stripHtml(strBuf.toString());
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Log.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Log.java
new file mode 100644
index 00000000..3220eeb2
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Log.java
@@ -0,0 +1,40 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.util;
+
+public class Log {
+
+ public Log() {
+ }
+
+ public static void write(String info) {
+ System.out.println(info);
+ } // write
+
+ public static void write(String info, int debugLevel) {
+ if (debugLevel <= org.openecomp.portalsdk.analytics.system.Globals.getDebugLevel())
+ write(info);
+ } // write
+
+ public static void writeError(String info) {
+ System.err.println(info);
+ } // writeError
+
+} // Log
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/RemDbInfo.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/RemDbInfo.java
new file mode 100644
index 00000000..2d9bef42
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/RemDbInfo.java
@@ -0,0 +1,93 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.util;
+
+import java.util.HashMap;
+
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+
+public class RemDbInfo {
+ private HashMap remDbMap = null;
+ private HashMap remDbTypeMap = null;
+
+ public RemDbInfo() throws Exception {
+ if (remDbMap == null) {
+ load();
+ }
+ }
+
+ public void load() throws Exception {
+ remDbMap = new HashMap();
+ remDbTypeMap = new HashMap();
+ try {
+ //String query = " SELECT a.SCHEMA_ID, a.SCHEMA_DESC, DATASOURCE_TYPE, rownum id FROM SCHEMA_INFO a " +
+ // " where schema_id = 'local' union " +
+ // " SELECT a.SCHEMA_ID, a.SCHEMA_DESC, DATASOURCE_TYPE, (rownum+1) id FROM SCHEMA_INFO a " +
+ // " where schema_id <> 'local' order by id ";
+ String query = Globals.getRemoteDbSchemaSql();
+ DataSet ds = null;
+ Globals.getDbUtils();
+ ds = DbUtils.executeQuery(query);
+
+ String prefix = "", desc = "", dbType = "";
+
+ if(ds.getRowCount() > 0) {
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ prefix = ds.getItem(i, 0);
+ desc = ds.getItem(i, 1);
+ dbType = ds.getItem(i, 2);
+
+ remDbMap.put(prefix, desc);
+ remDbTypeMap.put(prefix, dbType);
+ }
+ } else {
+ remDbMap.put("local", "local");
+ remDbTypeMap.put("local", Globals.getDBType());
+ }
+ }
+ catch (Exception e) {}
+
+ }
+
+ public String getDesc(String prefix) {
+ if ((remDbMap != null) && (remDbMap.containsKey(prefix))) {
+ return (String) remDbMap.get(prefix);
+ }
+
+ return "";
+ }
+
+ public String getDBType(String prefix) {
+ if ((remDbTypeMap != null) && (remDbTypeMap.containsKey(prefix))) {
+ return (String) remDbTypeMap.get(prefix);
+ }
+
+ return "";
+ }
+
+ public HashMap getDbHash() {
+ return remDbMap;
+ }
+
+ public HashMap getDbTypeHash() {
+ return remDbTypeMap;
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/SQLCorrector.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/SQLCorrector.java
new file mode 100644
index 00000000..15b4042a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/SQLCorrector.java
@@ -0,0 +1,343 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.util;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class SQLCorrector {
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SQLCorrector.class);
+
+
+ public String fixSQL(StringBuffer sql) {
+
+ int pos = 0;
+ //int pos_f_select_from = 0;
+ int pos_f_select_to = 0;
+ int pos_s_select_from = 0;
+ int pos_s_select_to = 0;
+ int pos_dup_select = 0;
+ int pos_dup_select1 = 0;
+ int pos_f_format = 0;
+ int pos_t_format = 0;
+ int pos_alias_format = 0;
+ int pos_alias = 0;
+ String format = "";
+ String alias = null;
+ String sql2 = Utils.replaceInString(sql.toString(), "\n", " ");
+ sql2 = Utils.replaceInString(sql2, "\t", " ");
+ sql = new StringBuffer(sql2);
+ if (sql.indexOf("FROM", 2) != -1) {
+ pos = sql.indexOf("FROM", 2);
+ pos_f_select_to = sql.indexOf("FROM", 2);
+ if (sql.indexOf("SELECT", pos)!=-1) {
+ pos = sql.indexOf("SELECT", pos);
+ pos_s_select_from = pos;
+ pos_dup_select1 = pos;
+ //System.out.println(pos);
+ if (sql.indexOf("FROM", pos)!=-1) {
+ pos = sql.indexOf("FROM", pos);
+ pos_dup_select = sql.lastIndexOf("SELECT",pos);
+ while(pos_dup_select > pos_dup_select1) {
+ pos_dup_select1 = pos_dup_select;
+ pos = sql.indexOf("FROM", pos + 2);
+ pos_dup_select = sql.lastIndexOf("SELECT",pos);
+ }
+ pos_s_select_to = pos;
+
+ }
+ }
+ }
+
+ String o_sql = sql.substring(0, pos_f_select_to-1);
+ String i_sql = sql.substring(pos_s_select_from, pos_s_select_to-1);
+ o_sql = o_sql.toUpperCase();
+ i_sql = i_sql.toUpperCase();
+ String outer_sql = o_sql.substring(o_sql.indexOf("SELECT")+7);
+ String inner_sql = i_sql.substring(i_sql.indexOf("SELECT")+7);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("|"+inner_sql+"|"));
+ String outer_cols[] = outer_sql.split(",");
+ //inner_sql = inner_sql.replaceAll(", '", ",'");
+
+ String inner_cols[] = inner_sql.split(", ");
+ inner_cols = removeExtraSpace(inner_cols);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("*******OuterCols ********"));
+ printArray(outer_cols);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("\n*******InnerCols********"));
+ printArray(inner_cols);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("\n********Replacing Elements*****"));
+ ArrayList elements = findSum(outer_cols);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("In Fix SQL " + elements.size()));
+ printArrayList(elements);
+ HashMap elementFormatMap = matchAndGetFormatInInnerCol(elements, inner_cols);
+ ArrayList outerReplacedCols = replaceOuterCols(elementFormatMap, outer_cols);
+ String finalSql = generateSQL(outerReplacedCols, sql.toString());
+ return finalSql;
+ }
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+
+ SQLCorrector s = new SQLCorrector();
+ StringBuffer strBuf = new StringBuffer();
+ strBuf.append("SELECT NULL TOTAL_BILLMONTH, NULL TOTAL_ACCOUNTNUMBER, NULL TOTAL_SECTORCODE, NULL TOTAL_BUSINESS_UNIT_CODE, NULL TOTAL_BILLINGSITEID, NULL TOTAL_SITEADDRESS, NULL TOTAL_SITECITY, NULL TOTAL_SITESTATE, NULL TOTAL_VENDORNAME, NULL TOTAL_INVOICENUMBER, NULL TOTAL_INVOICEDATE, NULL TOTAL_SERVICEDESCRIPTION, SUM(INVOICEAMOUNT) TOTAL_INVOICEAMOUNT FROM (SELECT '2006/09/16 - 2006/10/15' BillMonth, account_number AccountNumber, (select distinct sector_code FROM billing_site where business_unit_code = BU) SectorCode, BU||' - '||(select distinct business_unit_name FROM billing_site where business_unit_code = BU) Business_Unit_Code, Site_ID BillingSiteID, site_address1 SiteAddress, site_city SiteCity, site_state SiteState, Vendor_Site_Name VendorName, invoice_number InvoiceNumber, to_char(invoice_date,'YYYY/MM/DD') InvoiceDate, billing_service_description ServiceDescription, to_char(payment_amount,'9,999,999.99') InvoiceAmount");
+ strBuf.append(" FROM cis_gm_passthrough ");
+ strBuf.append(" where ");
+ strBuf.append(" BU = decode(upper('ALL'), 'ALL', BU, substr('ALL', 1, 3)) ");
+ strBuf.append(" and BU in (SELECT distinct business_unit_code FROM billing_site where ");
+ strBuf.append(" sector_code = decode('ALL', 'ALL', sector_code, 'ALL') ");
+ strBuf.append(" and CHECK_USER_SECURITY(10, 'BUSINESS_UNIT_CODE', business_unit_code)='Y') ");
+ strBuf.append(" and to_char(bill_cycle_start_date, 'YYYY/MM/DD') = substr('2006/09/16 - 2006/10/15', 1, 10) ");
+ strBuf.append(" and to_char(bill_cycle_end_date, 'YYYY/MM/DD') = substr('2006/09/16 - 2006/10/15', 14, 10)");
+ strBuf.append(" order by business_unit_code, sitecity, sitestate, invoicedate, servicedescription ) totalSQL ");
+ String sql = strBuf.toString();
+ String fix_sql = s.fixSQL(new StringBuffer(sql.toUpperCase()));
+ logger.debug(EELFLoggerDelegate.debugLogger, (fix_sql));
+ // TODO Auto-generated method stub
+
+ }
+
+ private String[] removeExtraSpace (String[] inner_cols) {
+ String [] fixed_cols = new String[inner_cols.length];
+ for (int i = 0; i < inner_cols.length; i++) {
+ fixed_cols[i] = inner_cols[i].replaceAll(", '", ",'");
+ }
+ return fixed_cols;
+ }
+
+ private void printArray (String[] arr) {
+ logger.debug(EELFLoggerDelegate.debugLogger, (""));
+ for (int i = 0; i < arr.length; i++) {
+ System.out.print(arr[i].trim());
+ if(i<arr.length-1)
+ logger.debug(EELFLoggerDelegate.debugLogger, (","));
+ }
+ }
+
+ private void printArrayList (ArrayList arrList) {
+ logger.debug(EELFLoggerDelegate.debugLogger, (" ArrayList "));
+ for (int i = 0; i < arrList.size(); i++) {
+ System.out.print(arrList.get(i));
+ if(i<arrList.size()-1)
+ logger.debug(EELFLoggerDelegate.debugLogger, (","));
+ }
+ }
+
+ private ArrayList findSum (String[] arr ) {
+ CharSequence inputString = null;
+ Pattern pattern = null;
+ Matcher matcher = null;
+ ArrayList elements = new ArrayList();
+ boolean b = false;
+ for (int i = 0; i < arr.length; i++) {
+ //System.out.print(arr[i].trim());
+ inputString = arr[i].trim();
+ //debugLogger.debug(inputString);
+ //String keyPattern = "/SUM(|AVG|COUNT|STDDEV/";
+ String keyPattern = "SUM\\(|AVG\\(|COUNT\\(|STDDEV\\(|VARIANCE\\(|SUM \\(|AVG \\(|COUNT \\(|STDDEV \\(|VARIANCE \\(";
+ pattern = Pattern.compile(keyPattern);
+ matcher = pattern.matcher(inputString);
+ b = matcher.find();
+ //debugLogger.debug(b);
+ if(b) {
+ elements.add(arr[i].trim());
+ }
+ }
+ //debugLogger.debug("In Find Sum " + elements.size());
+ return elements;
+
+ }
+
+
+ private HashMap matchAndGetFormatInInnerCol(ArrayList arrList, String[] inner_cols) {
+ HashMap elementFormat = new HashMap();
+ String totalElement = null;
+ String extractedElement = null;
+ String format = null;
+ int pos = 0;
+ //debugLogger.debug("arrList.size() " + arrList.size());
+ for (int i = 0; i < arrList.size(); i++) {
+ totalElement = (String) arrList.get(i);
+ //debugLogger.debug("\nTotalElement " + totalElement);
+ extractedElement = totalElement.substring(totalElement.indexOf("(")+1, totalElement.indexOf(")") );
+ for (int j = 0; j < inner_cols.length; j++) {
+ //debugLogger.debug("Format " + inner_cols[j] + " " + extractedElement);
+ if(inner_cols[j].lastIndexOf(extractedElement)!=-1) {
+ if(inner_cols[j].indexOf("999")!=-1 && inner_cols[j].indexOf("TO_CHAR")!=-1) {
+ pos = inner_cols[j].indexOf("TO_CHAR");
+ pos = inner_cols[j].lastIndexOf(",'");
+ if(pos == -1)
+ pos = inner_cols[j].lastIndexOf(", '");
+ //debugLogger.debug("Format before " + inner_cols[j] + "\n*** " + pos+ " " + (inner_cols[j].substring(pos+2, inner_cols[j].indexOf("'", pos+2))));
+ format = inner_cols[j].substring(pos+2, inner_cols[j].indexOf("'", pos+2));
+ }
+ }
+ }
+ if(format!=null) {
+ //debugLogger.debug("Match and Get Format In Inner " + totalElement + " " + format);
+ elementFormat.put(totalElement, format);
+
+ }
+ format = null;
+ }
+
+ return elementFormat;
+ }
+
+ private ArrayList replaceOuterCols (HashMap hashMap, String[] outer_cols) {
+ Set mapSet = hashMap.entrySet();
+ String element = "", value = "";
+ ArrayList finalElements = new ArrayList();
+ Map.Entry me;
+ int flag=0;
+ for (int i = 0; i < outer_cols.length; i++) {
+ flag = 0;
+ for (Iterator iter = mapSet.iterator(); iter.hasNext();) {
+ me=(Map.Entry)iter.next();
+ element = (String) me.getKey();
+ value = (String) me.getValue();
+ //debugLogger.debug("Replace Map entry " + element + " " + value);
+ //debugLogger.debug("Replace " + outer_cols[i] + " " + element);
+ if(outer_cols[i].trim().equals(element.trim())) {
+ flag = 1;
+ //debugLogger.debug("I am here " + element + " " + value );
+ finalElements.add(addFormat(element,value));
+ }
+ }
+ if(flag == 0)
+ finalElements.add(outer_cols[i]);
+ }
+ return finalElements;
+ }
+
+ private String addFormat (String element, String value) {
+ StringBuffer elementBuf = new StringBuffer (element);
+ StringBuffer finalElement = new StringBuffer("");
+ String extractedElement = elementBuf.substring(elementBuf.indexOf("(")+1,elementBuf.indexOf(")"));
+ String alias = elementBuf.substring(elementBuf.lastIndexOf(" ")+1);
+ String operation = elementBuf.substring(0,elementBuf.indexOf("("));
+ //debugLogger.debug("Add Format " + alias + " "+ extractedElement);
+ finalElement.append("TO_CHAR (")
+ .append(operation)
+ .append("(TO_NUMBER (")
+ .append(extractedElement)
+ .append(",'" + value +"'")
+ .append(")),'"+value + "') ")
+ .append(alias);
+/* elementBuf.insert(0, "TO_CHAR (");
+ elementBuf.insert(elementBuf.lastIndexOf(")")+1,value+"')");
+ debugLogger.debug("FORMAT " + element);
+ debugLogger.debug("FORMAT BUF " + elementBuf.toString());
+ debugLogger.debug("Format " + finalElement.toString());
+*/
+ //debugLogger.debug("Final Element " + finalElement.toString());
+ return finalElement.toString();
+ }
+
+ private String generateSQL( ArrayList outerSql, String sql) {
+
+ StringBuffer finalSql = new StringBuffer("SELECT ") ;
+
+ for (int i = 0; i < outerSql.size(); i++) {
+ finalSql.append(outerSql.get(i));
+ if ( i < outerSql.size()-1 )
+ finalSql.append(",");
+ }
+ finalSql.append(" "+sql.substring(sql.indexOf("FROM")));
+ logger.debug(EELFLoggerDelegate.debugLogger, (" ---" + finalSql.toString()));
+ return finalSql.toString();
+ }
+
+
+/* public String fixCrosstabSQL1(StringBuffer sql) {
+ int pos = 0;
+ int pos_f_format = 0;
+ int pos_t_format = 0;
+ int pos_alias = 0;
+ String format = "";
+ String alias = null;
+ if(sql.indexOf("SELECT", 7)!= -1) {
+ pos = sql.indexOf("SELECT", 7);
+ if(sql.indexOf("TO_CHAR", pos)!= -1){
+ pos = sql.indexOf("TO_CHAR", pos);
+ debugLogger.debug("pos" + pos);
+ if(sql.indexOf("999",pos)!= -1) {
+ pos = sql.indexOf("999",pos);
+ pos_f_format = sql.lastIndexOf(", '", pos);
+ debugLogger.debug("pos_f_format" + pos_f_format);
+ if(pos_f_format == -1 || (pos - pos_f_format > 10)) {
+ pos_f_format = sql.lastIndexOf(",'", pos);
+ pos_f_format -= 1;
+ }
+ pos = pos_f_format;
+ if(sql.indexOf("')", pos)!= -1) {
+ pos_t_format = sql.indexOf("')", pos);
+ debugLogger.debug("pos_t - " + pos_t_format + " " + pos);
+ if(pos_t_format == -1 || (pos_t_format - pos > 20)) {
+ pos_t_format = sql.indexOf("' )", pos);
+ pos_t_format += 3;
+ }
+ else if (pos_t_format != -1)
+ pos_t_format += 2;
+ format = sql.substring(pos_f_format+3, pos_t_format);
+ //alias = sql.substring(pos_t_format+3, pos_t_format+6);
+ pos_alias = sql.indexOf(" ", pos_t_format);
+ alias = sql.substring(pos_alias+1, pos_alias+4);
+ }
+ }
+ }
+
+ if(sql.indexOf(alias)!=-1) {
+ pos = sql.indexOf(alias);
+ debugLogger.debug(pos + " " + alias.length()+1 + "\n" + sql);
+ sql.delete(pos,pos+4);
+ sql.insert(pos, "TO_NUMBER("+alias+", '"+format+"')),'"+ format + "')");
+ pos = sql.lastIndexOf("SUM", pos);
+ if(pos==-1)
+ pos = sql.lastIndexOf("AVG", pos);
+ else if (pos==-1)
+ pos = sql.lastIndexOf("COUNT", pos);
+ else if (pos == -1)
+ pos = sql.lastIndexOf("STDDEV", pos);
+ else if (pos == -1)
+ pos = sql.lastIndexOf("VARIANCE", pos);
+ sql.insert(pos, "TO_CHAR (");
+ }
+
+ }
+
+ debugLogger.debug("Alias|" + alias + "| Format " + format);
+ debugLogger.debug(sql.toString());
+ return sql.toString();
+ } // FixSQL
+*/
+
+
+}
+
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Scheduler.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Scheduler.java
new file mode 100644
index 00000000..731a50ee
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Scheduler.java
@@ -0,0 +1,91 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.util;
+
+import java.sql.SQLException;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.openecomp.portalsdk.analytics.scheduler.SendNotifications;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+
+public class Scheduler extends TimerTask {
+ private Timer timer = new Timer(true);
+
+ private int timeInterval = 0;
+
+ public Scheduler(int timeInterval) {
+ super();
+
+ this.timeInterval = timeInterval;
+ start();
+ } // Scheduler
+
+ public void start() {
+ if (timeInterval > 0)
+ timer.schedule(this, 0, timeInterval * 1000);
+ }
+
+ public void stop() {
+ timer.cancel();
+ }
+
+ public void run() {
+
+ SendNotifications sendNotifications = null;
+
+ try {
+ Log.write("[Scheduler.run " + (new java.util.Date()).toString()
+ + "] Sending notifications...", 4);
+ //System.out.println("SMTP Server " + AppUtils.getSMTPServer());
+ //System.out.println("System Name " + Globals.getSystemName());
+ //System.out.println("DefaultEmailSender " + AppUtils.getDefaultEmailSender());
+ //System.out.println("DirectAccessURL " + AppUtils.getDirectAccessURL());
+ //System.out.println("timeInterval " + timeInterval);
+ /*
+ DbUtils.executeCall(
+ "BEGIN cr_raptor.send_notifications(" +
+ "'" + AppUtils.getSMTPServer() + "', " +
+ "'" + AppUtils.getDefaultEmailSender() + "', " +
+ "'" + Globals.getSystemName() + "', " +
+ "'" + AppUtils.getDirectAccessURL() + "', " +
+ timeInterval +
+ "); END;", false);
+ */
+ sendNotifications = new SendNotifications();
+ sendNotifications.send_notification(AppUtils.getSMTPServer(), AppUtils.getSMTPServer(), Globals.getSystemName() ,
+ AppUtils.getDirectAccessURL(), timeInterval);
+
+ } catch (Exception e) {
+ Log.write("[SYSTEM ERROR Scheduler.run] Exception: " + e.getMessage());
+ //e.printStackTrace();
+ }
+ finally {
+
+ try {
+ sendNotifications.deInit();
+ } catch (SQLException e) {
+ Log.write("[SYSTEM ERROR Scheduler.run] Could not close connection: " + e.getMessage());
+ }
+ }
+ } // run
+
+} // Scheduler
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Utils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Utils.java
new file mode 100644
index 00000000..1995c567
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Utils.java
@@ -0,0 +1,378 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.util;
+
+import java.io.File;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.Item;
+
+
+public class Utils extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ public Utils() {
+ }
+
+ public static String getCurrentDateTime() {
+ return (new SimpleDateFormat(Globals.getJavaTimeFormat())).format(new Date());
+ } // getCurrentDateTime
+
+ public static String truncateDecimals(String value, int maxDecimals) {
+ return (maxDecimals < 0 || value == null || value.indexOf('.') < 0
+ || (value.indexOf('.') == value.length() - 1) || value.substring(
+ value.indexOf('.')).length() - 1 <= maxDecimals) ? value : value.substring(0,
+ value.indexOf('.') + maxDecimals + 1);
+ } // truncateDecimals
+
+ public static String truncateTotalDecimals(String value) {
+ return truncateDecimals(value, Globals.getMaxDecimalsOnTotals());
+ } // truncateTotalDecimals
+
+ public static String replaceInString(String replaceInStr, String replaceStr,
+ String replaceWithStr) {
+ if (replaceStr.equals(replaceWithStr))
+ return replaceInStr;
+
+ while (replaceInStr!=null && replaceInStr.indexOf(replaceStr) >= 0) {
+ int startIdx = replaceInStr.indexOf(replaceStr);
+ int endIdx = startIdx + replaceStr.length();
+
+ StringBuffer sb = new StringBuffer();
+ if (startIdx > 0)
+ sb.append(replaceInStr.substring(0, startIdx));
+ sb.append(nvls(replaceWithStr));
+ if (endIdx < replaceInStr.length())
+ sb.append(replaceInStr.substring(endIdx));
+ replaceInStr = sb.toString();
+ } // while
+
+ return replaceInStr;
+ } // replaceInString
+
+ public static String singleQuoteEncode(String value) {
+ value = value!=null?value:"";
+ value = Pattern.compile("[\']",Pattern.DOTALL).matcher(value).replaceAll("\\\\\\'");
+ return value;
+ }
+
+ public static String htmlEncode(String value) {
+ return replaceInString(replaceInString(value, "<", "&lt;"), ">", "&gt;");
+ } // htmlEncode
+
+ public static String excelEncode(String value) {
+ String replaceStr = replaceInString(replaceInString(value, "<", "&lt;"), ">", "&gt;");
+ String reg = "&(?!&#)";
+ Pattern p = Pattern.compile(reg);
+ String replaceStrAmpersand = p.matcher(replaceStr).replaceAll("&amp;");
+ return replaceStrAmpersand;
+ } // htmlEncode
+
+
+ public static String oracleSafe(String s) {
+ if (s == null)
+ return null;
+
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < s.length(); i++) {
+ char ch = s.charAt(i);
+ if (ch == '\''/* &&(i>=s.length()-1||s.charAt(i+1)!='\'') */)
+ sb.append('\'');
+ sb.append(ch);
+ } // for
+
+ return sb.toString();
+ } // oracleSafe
+
+
+ public static String javaSafe(String s) {
+ if (s == null)
+ return null;
+
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < s.length(); i++) {
+ char ch = s.charAt(i);
+ if (ch == '"')
+ sb.append('\\');
+ sb.append(ch);
+ } // for
+
+ return sb.toString();
+ } // javaSafe
+
+ public static Vector getUsersNotInList(List excludeValues, HttpServletRequest request)throws RaptorException {
+ HttpSession session = request.getSession();
+// String[] whereConditionAndSess = Globals.getWhereConditionForUserRole().split(",");
+// String whereCondition = "";
+// String conditionalValue = "";
+// for (int i = 0; i < whereConditionAndSess.length; i++) {
+// whereCondition = whereConditionAndSess[0];
+// }
+// for (int i = 1; i < whereConditionAndSess.length; i++) {
+// conditionalValue = whereConditionAndSess[1];
+// }
+// whereCondition = " where "+ whereCondition + "'" + (String)session.getAttribute(conditionalValue) + "'";
+
+// Vector allUsers = AppUtils.getAllUsers(whereCondition);
+ String query = Globals.getCustomizedScheduleQueryForUsers();
+ session.setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request));
+ String userId = AppUtils.getUserID(request);
+ session.setAttribute("LOGGED_USERID", userId);
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ String param = "";
+ for (int i = 0; i < sessionParameters.length; i++) {
+ param = (String)session.getAttribute(sessionParameters[0]);
+ query = Utils.replaceInString(query, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ }
+ boolean isAdmin = AppUtils.isAdminUser(request);
+ Vector allUsers = AppUtils.getAllUsers(query,param, isAdmin);
+ Vector result = new Vector(allUsers.size());
+
+ for (Iterator iter = allUsers.iterator(); iter.hasNext();) {
+ IdNameValue value = (IdNameValue) iter.next();
+
+ boolean exclude = false;
+ for (Iterator iterE = excludeValues.iterator(); iterE.hasNext();)
+ if (((IdNameValue) iterE.next()).getId().equals(value.getId())) {
+ exclude = true;
+ break;
+ } // if
+
+ if (!exclude)
+ result.add(value);
+ } // for
+
+ return result;
+ } // getUsersNotInList
+
+ public static Vector getRolesNotInList(List excludeValues, HttpServletRequest request) throws RaptorException {
+ HttpSession session = request.getSession();
+ String query = Globals.getCustomizedScheduleQueryForRoles();
+ session.setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request));
+ String userId = AppUtils.getUserID(request);
+ session.setAttribute("LOGGED_USERID", userId);
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ String param = "";
+ for (int i = 0; i < sessionParameters.length; i++) {
+ param = (String)session.getAttribute(sessionParameters[0]);
+ query = Utils.replaceInString(query, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ }
+ boolean isAdmin = AppUtils.isAdminUser(request);
+ Vector allRoles = AppUtils.getAllRoles(query, param, isAdmin);
+ Vector result = new Vector(allRoles.size());
+
+ for (Iterator iter = allRoles.iterator(); iter.hasNext();) {
+ IdNameValue value = (IdNameValue) iter.next();
+
+ boolean exclude = false;
+ for (Iterator iterE = excludeValues.iterator(); iterE.hasNext();)
+ if (((IdNameValue) iterE.next()).getId().equals(value.getId())) {
+ exclude = true;
+ break;
+ } // if
+
+ // Exclude the super role
+ if (value.getId().equals(AppUtils.getSuperRoleID()))
+ exclude = true;
+
+ if (!exclude)
+ result.add(value);
+ } // for
+
+ return result;
+ } // getRolesNotInList
+
+ public static List<Item> getUsersNotInListLatest(List excludeValues, HttpServletRequest request)throws RaptorException {
+ HttpSession session = request.getSession();
+ String query = Globals.getCustomizedScheduleQueryForUsers();
+ session.setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request));
+ String userId = AppUtils.getUserID(request);
+ session.setAttribute("LOGGED_USERID", userId);
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ String param = "";
+ for (int i = 0; i < sessionParameters.length; i++) {
+ param = (String)session.getAttribute(sessionParameters[i]);
+ query = Utils.replaceInString(query, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ }
+ boolean isAdmin = AppUtils.isAdminUser(request);
+ Vector allUsers = AppUtils.getAllUsers(query,param, isAdmin);
+ Vector result = new Vector(allUsers.size());
+
+ List<Item> resultLatest = new ArrayList<Item>();
+
+ for (Iterator iter = allUsers.iterator(); iter.hasNext();) {
+ IdNameValue value = (IdNameValue) iter.next();
+
+ boolean exclude = false;
+ for (Iterator iterE = excludeValues.iterator(); iterE.hasNext();)
+ if (((IdNameValue) iterE.next()).getId().equals(value.getId())) {
+ exclude = true;
+ break;
+ } // if
+
+ if (!exclude)
+ resultLatest.add(new Item(value.getId(), value.getName()));
+ } // for
+
+ return resultLatest;
+ } // getUsersNotInListLatest
+
+
+ public static List<Item> getRolesNotInListLatest(List excludeValues, HttpServletRequest request) throws RaptorException {
+ HttpSession session = request.getSession();
+ String query = Globals.getCustomizedScheduleQueryForRoles();
+ session.setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request));
+ String userId = AppUtils.getUserID(request);
+ session.setAttribute("LOGGED_USERID", userId);
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ String param = "";
+ for (int i = 0; i < sessionParameters.length; i++) {
+ param = (String)session.getAttribute(sessionParameters[i]);
+ query = Utils.replaceInString(query, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ }
+ boolean isAdmin = AppUtils.isAdminUser(request);
+ Vector allRoles = AppUtils.getAllRoles(query, param, isAdmin);
+ Vector result = new Vector(allRoles.size());
+
+ List<Item> resultLatest = new ArrayList<Item>();
+
+ for (Iterator iter = allRoles.iterator(); iter.hasNext();) {
+ IdNameValue value = (IdNameValue) iter.next();
+
+ boolean exclude = false;
+ for (Iterator iterE = excludeValues.iterator(); iterE.hasNext();)
+ if (((IdNameValue) iterE.next()).getId().equals(value.getId())) {
+ exclude = true;
+ break;
+ } // if
+
+ // Exclude the super role
+ if (value.getId().equals(AppUtils.getSuperRoleID()))
+ exclude = true;
+
+ if (!exclude)
+ resultLatest.add(new Item(value.getId(), value.getName()));
+ } // for
+
+ return resultLatest;
+ } // getRolesNotInList
+ /*
+ * public static String nvl(String s) { return (s==null)?"":s; } // nvl
+ *
+ * public static String nvl(String s, String sDefault) { return
+ * nvl(s).equals("")?sDefault:s; } // nvl
+ */
+
+ public static void _assert(boolean condition, String errMsg) {
+ if (org.openecomp.portalsdk.analytics.system.Globals.getDebugLevel() > 0)
+ if (!condition)
+ throw new RuntimeException(errMsg);
+ } // _assert
+
+ public static boolean isNull(String a) {
+ if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null"))
+ return true;
+ else
+ return false;
+ }
+
+
+ public static boolean isDownloadFileExists(String fileNamePrefix) {
+ File f = new File (Globals.getShellScriptDir()+AppConstants.SHELL_DATA_DIR);
+ String[] fileNames = f.list();
+ //System.out.println("Util.boolean Prefix" + fileNamePrefix);
+ if(fileNames!=null) {
+ for (int i = 0; i < fileNames.length; i++) {
+ //System.out.println("Util.boolean " + fileNames[i]);
+ if(fileNames[i].startsWith(fileNamePrefix)) {
+ return true;
+ }
+ }
+ }
+ return false;
+
+ }
+
+ public static String getLatestDownloadableFile(String fileNamePrefix) {
+ File f = new File (Globals.getShellScriptDir()+AppConstants.SHELL_DATA_DIR);
+ String[] fileNames = f.list();
+ ArrayList matchingFiles = new ArrayList();
+ //System.out.println("Util.download Prefix" + fileNamePrefix);
+ for (int i = 0; i < fileNames.length; i++) {
+ //System.out.println("Util.download " + fileNames[i]);
+ if(fileNames[i].startsWith(fileNamePrefix)) {
+ matchingFiles.add(fileNames[i]);
+ }
+ }
+ //System.out.println("SIZE 1 " + matchingFiles.size());
+ String tmpFileName = "";
+ int numberOfTimesLooped = 0;
+ boolean isSorted = false;
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ Date date1 = null, date2 = null;
+ Date currDate = new Date();
+ Object[] matchingfileNamesArr = matchingFiles.toArray();
+ //System.out.println("SIZE " + matchingFiles.size());
+ String fileName1 = "", fileName2 ="";
+ do {
+ isSorted = true;
+ for (int j = 1; j < matchingfileNamesArr.length - numberOfTimesLooped++; j++) {
+ fileName1 = (String) matchingfileNamesArr[j];
+ fileName2 = (String) matchingfileNamesArr[j-1];
+ try{
+ date1 = sdf.parse(fileName1.substring(fileName1.lastIndexOf("_")+1,fileName1.lastIndexOf(".")));
+ date2 = sdf.parse(fileName2.substring(fileName2.lastIndexOf("_")+1,fileName2.lastIndexOf(".")));
+ }
+ catch(ParseException ex) {
+ return null;
+ }
+
+ if ( (currDate.getTime()-date1.getTime()) < (currDate.getTime()-date2.getTime())) {
+ tmpFileName = fileName1;
+ matchingfileNamesArr[j] = fileName2;
+ matchingfileNamesArr[j-1] = tmpFileName;
+ isSorted = false;
+ }
+
+ }
+ } while (!isSorted);
+ if(matchingfileNamesArr.length>0)
+ return (String)matchingfileNamesArr[0];
+ else
+ return null;
+
+ }
+
+
+} // Utils
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/XSSFilter.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/XSSFilter.java
new file mode 100644
index 00000000..e6d01994
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/XSSFilter.java
@@ -0,0 +1,90 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.util;
+
+ /**
+ *
+ * This class is used to filter javascript tags to avoid XSS attacks.
+ */
+public class XSSFilter {
+
+ // private static String[] filterChars = { "<", ">", "<", ">", "\"", "\\", "0x" };
+// private static String[] replacementChars = { " ", " ", " ", " ", "'", "/", "0 x" };
+
+/* public static synchronized String filterRequest(String param) {
+ String value = param;
+
+ if (param != null) {
+
+ for (int i = 0; i < filterChars.length; i++) {
+ value = filterCharacters(filterChars[i], replacementChars[i],
+ value);
+ }
+
+ }
+
+ return value;
+
+ }
+*/
+
+ public static synchronized String filterRequestOnlyScript(String param) {
+ String value = "";
+ value = nvl(param);
+ value = value.replaceAll("<[\\s]*[sS][\\s]*[cC][\\s]*[rR][\\s]*[iI][\\s]*[pP][\\s]*[tT][\\s]*>", "");
+ value = value.replaceAll("</[\\s]*[sS][\\s]*[cC][\\s]*[rR][\\s]*[iI][\\s]*[pP][\\s]*[tT][\\s]*>", "");
+ value = value.replaceAll("[\\s]*[jJ][\\s]*[aA][\\s]*[vV][\\s]*[aA][\\s]*[sS][\\s]*[cC][\\s]*[rR][\\s]*[iI][\\s]*[pP][\\s]*[tT][\\s]*", "");
+ return value;
+ }
+ public static synchronized String filterRequest (String param) {
+ String value = "";
+ value = nvl(param);
+ value = value.replaceAll("<[\\s]*[sS][\\s]*[cC][\\s]*[rR][\\s]*[iI][\\s]*[pP][\\s]*[tT][\\s]*>", "");
+ value = value.replaceAll("</[\\s]*[sS][\\s]*[cC][\\s]*[rR][\\s]*[iI][\\s]*[pP][\\s]*[tT][\\s]*>", "");
+ value = value.replaceAll("[\\s]*[jJ][\\s]*[aA][\\s]*[vV][\\s]*[aA][\\s]*[sS][\\s]*[cC][\\s]*[rR][\\s]*[iI][\\s]*[pP][\\s]*[tT][\\s]*", "");
+ value = value.replaceAll("[\\s]*<", "");
+ value = value.replaceAll("[\\s]*>", "");
+
+ return value;
+ }
+
+// private static synchronized String filterCharacters(String originalChar, String newChar,
+// String param) {
+// StringBuffer sb = new StringBuffer(param);
+//
+// for (int position = param.toLowerCase().indexOf(originalChar); position >= 0;) {
+// sb.replace(position, position + originalChar.length(), newChar);
+// param = sb.toString();
+// position = param.toLowerCase().indexOf(originalChar);
+// }
+//
+// return sb.toString();
+// }
+
+ public static void main (String args[]) {
+ String value = XSSFilter.filterRequest("<s\nC\nr\nI\np\nT\n>\na\nl\ne\nr\nt\n('sundar');</SCRIPT>javascript:alert('Sundar');");
+ int i = Integer.parseInt("8989");
+ System.out.println(value);
+ }
+
+ private static String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/upgrade/SystemUpgrade.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/upgrade/SystemUpgrade.java
new file mode 100644
index 00000000..3c1f0dd4
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/upgrade/SystemUpgrade.java
@@ -0,0 +1,125 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.util.upgrade;
+
+import java.sql.Connection;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.model.ReportLoader;
+import org.openecomp.portalsdk.analytics.model.base.ReportWrapper;
+import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+
+public class SystemUpgrade extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private static final String upgradeFromVersion = "1.x";
+ private static final String upgradeToVersion = "2.0";
+
+/* This script upgrades the Raptor database to a newer version
+ Make sure you execute the "upgrade_v0_to_v1_0_before_java.sql" before running this
+ and "upgrade_v0_to_v1_0_after_java.sql" afterwards
+
+ URL example: http://localhost:8082/databank/dispatcher?action=raptor&r_action=system_upgrade
+*/
+ public static String upgradeDB(HttpServletRequest request) {
+ request.setAttribute("system_message", "System upgrade disabled");
+ return "raptor/blank.jsp";
+
+/* try {
+ if(upgradeFromVersion.equals("1.x")&&upgradeToVersion.equals("2.0"))
+ upgrateFromV1ToV2_0(request);
+ else
+ throw new RuntimeException("Invalid version");
+
+ return "raptor/blank.jsp";
+ } catch(Exception e) {
+ return (new ErrorHandler()).processFatalError(request, e);
+ }*/
+ } // upgradeDB
+
+ private static void upgrateFromV1ToV2_0(HttpServletRequest request) throws Exception {
+ StringBuffer log = new StringBuffer();
+ log.append("Starting upgrade...<br>\n");
+
+ DataSet ds = DbUtils.executeQuery("SELECT cr.rep_id, cr.sched_mailto_user_ids FROM cr_report cr");
+ for(int i=0; i<ds.getRowCount(); i++) {
+ String repId = ds.getString(i, 0);
+ log.append("<li>Processing report ["+repId+"]: ");
+
+ Connection connection = DbUtils.startTransaction();
+ String emailIds = nvls(ds.getString(i, 1));
+ if(emailIds.length()>0)
+ try {
+ log.append("Converting emails ");
+ StringTokenizer st = new StringTokenizer(emailIds, ",");
+ while(st.hasMoreTokens()) {
+ String userId = nvls(st.nextToken());
+ log.append(userId);
+ if(userId.length()>0)
+ DbUtils.executeUpdate(connection, "INSERT INTO cr_report_schedule_users (rep_id, user_id) VALUES ("+repId+", "+userId+")");
+ log.append("-success, ");
+ } // while
+ log.append(" <font color=green>COMPLETED</font>; ");
+ } catch(Exception e) {
+ log.append("-<font color=red>FAILED</font>; ");
+ }
+
+ String reportXML = ReportLoader.loadCustomReportXML(repId);
+ ReportDefinition rdef = ReportDefinition.unmarshal(reportXML, repId, request);
+ ReportWrapper rw = new ReportWrapper(rdef.cloneCustomReport(), repId, null, null, null, null, null, null, false);
+
+ for(Iterator iter=rw.getAllColumns().iterator(); iter.hasNext(); ) {
+ DataColumnType col = (DataColumnType) iter.next();
+ String drillDownURL = nvls(col.getDrillDownURL());
+ if(drillDownURL.startsWith("dispatcher?action=custrep.run&c_master=")) {
+ drillDownURL = AppUtils.getReportExecuteActionURL()+drillDownURL.substring("dispatcher?action=custrep.run&c_master=".length());
+ log.append("Drill-down processed; ");
+ col.setDrillDownURL(drillDownURL);
+ }
+ } // for
+
+ reportXML = rw.marshal();
+
+ /*PrintWriter xmlOut = new PrintWriter(new BufferedWriter(new FileWriter(new File(AppUtils.getTempFolderPath()+AppUtils.getUserID(request)))));
+ xmlOut.println(reportXML);
+ xmlOut.close();*/
+
+ try {
+ ReportLoader.updateCustomReportRec(connection, rw, reportXML);
+ DbUtils.commitTransaction(connection);
+ log.append("<font color=green>REPORT UPDATED</font></li>\n");
+ } catch(Exception e) {
+ log.append("<font color=red>REPORT UPDATE FAILED</font></li>\n");
+ DbUtils.rollbackTransaction(connection);
+ } finally {
+ DbUtils.clearConnection(connection);
+ }
+ } // for
+
+ log.append("<br>\nSystem upgrade successfully completed...<br>\n");
+ request.setAttribute("system_message", log.toString());
+ } // upgrateFromV1ToV2_0
+
+} // SystemUpgrade
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeader.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeader.java
new file mode 100644
index 00000000..c52125e5
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeader.java
@@ -0,0 +1,239 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+public class ColumnHeader extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private String columnTitle = "";
+
+ private String columnWidth = "";
+
+ private String alignment = "center";
+
+ private int rowSpan = 1;
+
+ private int actualColSpan = 1;
+
+ private int visibleColSpan = 1;
+
+ private String linkColId = null;
+
+ private int columnSort = 0;
+
+ private String colId = "";
+
+ private int groupLevel =0;
+
+ private int startGroup = 0;
+
+ private int colSpanGroup = 0;
+
+ private boolean sortable = false;
+
+
+ public ColumnHeader() {
+ super();
+ }
+
+ public ColumnHeader(String columnTitle) {
+ this();
+ setColumnTitle(columnTitle);
+ } // ColumnHeader
+
+ public ColumnHeader(String columnTitle, Integer columnSort) {
+ this();
+ setColumnTitle(columnTitle);
+ setColumnSort(columnSort.intValue());
+ } // ColumnHeader
+
+ public ColumnHeader(String columnTitle, String columnWidth) {
+ this(columnTitle);
+ setColumnWidth(columnWidth);
+ } // ColumnHeader
+
+ public ColumnHeader(String columnTitle, String columnWidth, int colSpan) {
+ this(columnTitle, columnWidth);
+ setColSpan(colSpan);
+ } // ColumnHeader
+
+ //public ColumnHeader(String columnTitle, String columnWidth, int colSpan, String linkColId) {
+ //this(columnTitle, columnWidth, colSpan);
+ //setLinkColId(linkColId);
+ //} // ColumnHeader
+
+ public ColumnHeader(String columnTitle, String columnWidth, String alignment, int colSpan, String linkColId) {
+ this(columnTitle, columnWidth, colSpan);
+ setAlignment(alignment);
+ setLinkColId(linkColId);
+ } // ColumnHeader
+
+ public ColumnHeader(String columnTitle, String columnWidth, int colSpan, int rowSpan) {
+ this(columnTitle, columnWidth, colSpan);
+ setRowSpan(rowSpan);
+ } // ColumnHeader
+
+ public String getColumnTitle() {
+ return columnTitle;
+ }
+
+ public String getColumnWidth() {
+ return columnWidth;
+ }
+
+ public int getRowSpan() {
+ return rowSpan;
+ }
+
+ public int getColSpan() {
+ return actualColSpan;
+ }
+
+ public boolean isVisible() {
+ return (visibleColSpan > 0) && (rowSpan > 0);
+ }
+
+ public String getLinkColId() {
+ return linkColId;
+ }
+
+ public void setColumnTitle(String columnTitle) {
+ this.columnTitle = nvl(columnTitle);
+ }
+
+ public void setColumnWidth(String columnWidth) {
+ this.columnWidth = columnWidth;
+ }
+
+ public void setLinkColId(String linkColId) {
+ this.linkColId = linkColId;
+ }
+
+ public void setRowSpan(int rowSpan) {
+ this.rowSpan = rowSpan;
+ }
+
+ public void setColSpan(int colSpan) {
+ this.visibleColSpan = colSpan;
+ this.actualColSpan = colSpan;
+ }
+
+ public void setVisible(boolean visible) {
+ if (visible) {
+ if (visibleColSpan < actualColSpan)
+ visibleColSpan++;
+ } else {
+ if (visibleColSpan > 0)
+ visibleColSpan--;
+ }
+ } // setVisible
+
+ public String getColumnWidthHtml() {
+ return (columnWidth.length() == 0) ? "" : (" width=" + columnWidth);
+ }
+
+ public String getRowSpanHtml() {
+ return (rowSpan == 1) ? "" : (" rowspan=" + rowSpan);
+ }
+
+ public String getColSpanHtml() {
+ return (visibleColSpan == 1) ? "" : (" colspan=" + visibleColSpan);
+ }
+
+ public String getColumnTitleHtml() {
+ if (linkColId == null)
+ return (columnTitle.length() == 0) ? "&nbsp;" : columnTitle;
+ else
+ return "<a href=\"javascript:performSortBy('" + linkColId
+ + "')\" title=\"Sort by column " + columnTitle + "\" class=rcolheader>"
+ + ((columnTitle.length() == 0) ? "[NULL]" : columnTitle) + "</a>";
+ } // getColumnTitleHtml
+
+ /**
+ * @return the columnSort
+ */
+ public int getColumnSort() {
+ return columnSort;
+ }
+
+ /**
+ * @param columnSort the columnSort to set
+ */
+ public void setColumnSort(int columnSort) {
+ this.columnSort = columnSort;
+ }
+
+ /**
+ * @return the colId
+ */
+ public String getColId() {
+ return colId;
+ }
+
+ /**
+ * @param colId the colId to set
+ */
+ public void setColId(String colId) {
+ this.colId = colId;
+ }
+
+ public String getAlignment() {
+ return alignment;
+ }
+
+ public void setAlignment(String alignment) {
+ if(nvl(alignment).length()>0)
+ this.alignment = alignment;
+ }
+
+ public int getGroupLevel() {
+ return groupLevel;
+ }
+
+ public void setGroupLevel(int groupLevel) {
+ this.groupLevel = groupLevel;
+ }
+
+ public int getStartGroup() {
+ return startGroup;
+ }
+
+ public void setStartGroup(int startGroup) {
+ this.startGroup = startGroup;
+ }
+
+ public int getColSpanGroup() {
+ return colSpanGroup;
+ }
+
+ public void setColSpanGroup(int colSpanGroup) {
+ this.colSpanGroup = colSpanGroup;
+ }
+
+ public boolean isSortable() {
+ return sortable;
+ }
+
+ public void setSortable(boolean sortable) {
+ this.sortable = sortable;
+ }
+
+
+
+} // ColumnHeader
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeaderRow.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeaderRow.java
new file mode 100644
index 00000000..b1f581ed
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeaderRow.java
@@ -0,0 +1,100 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+import java.util.Vector;
+
+public class ColumnHeaderRow extends Vector {
+ private String rowHeight = "";
+
+ private String displayWidth = "";
+
+ private String alignment = "center";
+
+ private int nextElemIdx = 0;
+
+ public void resetNext() {
+ resetNext(0);
+ } // resetNext
+
+ public void resetNext(int toPos) {
+ nextElemIdx = toPos;
+ } // resetNext
+
+ public boolean hasNext() {
+ return (nextElemIdx < size());
+ } // hasNext
+
+ public ColumnHeader getNext() {
+ return hasNext() ? getColumnHeader(nextElemIdx++) : null;
+ } // getNext
+
+ public ColumnHeader getColumnHeader(int idx) {
+ return (ColumnHeader) get(idx);
+ } // getColumnHeader
+
+ public void addColumnHeader(ColumnHeader columnHeader) {
+ add(columnHeader);
+ } // addColumnHeader
+
+ public void addColumnHeader(int idx, ColumnHeader columnHeader) {
+ add(idx, columnHeader);
+ } // addColumnHeader
+
+ public String getRowHeightHtml() {
+ return (rowHeight.length() == 0) ? "" : (" height=" + rowHeight);
+ }
+
+ public String getRowHeight() {
+ return rowHeight;
+ }
+
+ public void setRowHeight(String rowHeight) {
+ this.rowHeight = nvl(rowHeight);
+ }
+
+ public void setDisplayWidth(String displayWidth) {
+ this.displayWidth = nvl(displayWidth);
+ }
+
+ public String getDisplayWidth() {
+ return this.displayWidth;
+ }
+ /** ************************************************************************************************* */
+
+ private String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ private String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ public String getAlignment() {
+ return alignment;
+ }
+
+ public void setAlignment(String alignment) {
+ if(nvl(alignment).length()>0)
+ this.alignment = alignment;
+ }
+
+} // ColumnHeaderRow
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnVisual.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnVisual.java
new file mode 100644
index 00000000..5045cd58
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnVisual.java
@@ -0,0 +1,74 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+public class ColumnVisual extends RaptorObject {
+ private String colId = null;
+
+ private String colDisplay = null;
+
+ private boolean visible = true;
+
+ private String sortType = null;
+
+ public ColumnVisual(String colId, String colDisplay, boolean visible, String sortType) {
+ super();
+
+ setColId(colId);
+ setColDisplay(colDisplay);
+ setVisible(visible);
+ setSortType(sortType);
+ } // ColumnVisual
+
+ public String getColId() {
+ return colId;
+ }
+
+ public String getColDisplay() {
+ return colDisplay;
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public String getSortType() {
+ return sortType;
+ }
+
+ public void setColId(String colId) {
+ this.colId = colId;
+ }
+
+ public void setColDisplay(String colDisplay) {
+ this.colDisplay = colDisplay;
+ }
+
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+
+ public void setSortType(String sortType) {
+ this.sortType = sortType;
+ }
+
+} // ColumnVisual
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabColumnValues.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabColumnValues.java
new file mode 100644
index 00000000..34cc10d3
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabColumnValues.java
@@ -0,0 +1,75 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+import java.util.Vector;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+
+public class CrossTabColumnValues extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private String colId = null;
+
+ private Vector columnValues = null;
+
+ public CrossTabColumnValues(String colId, String loadValuesSQL, String dbInfo)
+ throws RaptorException {
+ this.colId = colId;
+ DataSet ds = ConnectionUtils.getDataSet(loadValuesSQL, dbInfo);
+ // DataSet ds = DbUtils.executeQuery(loadValuesSQL);
+ columnValues = new Vector(ds.getRowCount());
+ for (int i = 0; i < ds.getRowCount(); i++)
+ columnValues.add(ds.getString(i, 0));
+ } // CrossTabColumnValues
+
+ public String getColId() {
+ return colId;
+ }
+
+ public Vector getColumnValues() {
+ return columnValues;
+ }
+
+ public int getValuesCount() {
+ return columnValues.size();
+ }
+
+ public String getValueAt(int idx) {
+ return (String) columnValues.get(idx);
+ }
+
+ public int getIndexOf(String value) {
+ for (int i = 0; i < getValuesCount(); i++)
+ if (value.equals(getValueAt(i)))
+ return i;
+
+ return -1;
+ } // getIndexOf
+
+ public int getIndexOf(int value) {
+ for (int i = 0; i < getValuesCount(); i++)
+ if (value == new Integer(getValueAt(i)).intValue())
+ return i;
+
+ return -1;
+ } // getIndexOf
+
+} // CrossTabColumnValues
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabOrderManager.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabOrderManager.java
new file mode 100644
index 00000000..55c2c757
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabOrderManager.java
@@ -0,0 +1,98 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+
+public class CrossTabOrderManager extends RaptorObject {
+ private Vector colHeaderValues = null;
+
+ private Vector rowHeaderValues = null;
+
+
+ public CrossTabOrderManager(ReportRuntime rr, String userId,HttpServletRequest request) throws RaptorException {
+ colHeaderValues = new Vector();
+ rowHeaderValues = new Vector();
+
+ for (Iterator iter = rr.getAllColumns().iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_COLUMN)) {
+ if(rr.getColumnById(dct.getColId()+"_sort")!=null) {
+ dct = rr.getColumnById(dct.getColId()+"_sort");
+ colHeaderValues.add(new CrossTabColumnValues(dct.getColId(), rr
+ .generateDistinctValuesSQL(dct, userId,request), rr.getDbInfo()));
+ } else
+ colHeaderValues.add(new CrossTabColumnValues(dct.getColId(), rr
+ .generateDistinctValuesSQL(dct, userId,request), rr.getDbInfo()));
+ }
+ else if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_ROW))
+ rowHeaderValues.add(new CrossTabColumnValues(dct.getColId(), rr
+ .generateDistinctValuesSQL(dct, userId,request), rr.getDbInfo()));
+ else if (nvl(dct.getCrossTabValue()).trim().length()<=0)
+ rowHeaderValues.add(new CrossTabColumnValues(dct.getColId(), rr
+ .generateDistinctValuesSQL(dct, userId,request), rr.getDbInfo()));
+ } // for
+ } // CrossTabOrderManager
+
+ public int getIndexOfColHeaderValue(int colIdx, String value) {
+ return ((CrossTabColumnValues) colHeaderValues.get(colIdx)).getIndexOf(value);
+ } // getIndexOfColHeaderValue
+
+ public int getIndexOfColHeaderValue(int colIdx, int value) {
+ return ((CrossTabColumnValues) colHeaderValues.get(colIdx)).getIndexOf(value);
+ } // getIndexOfColHeaderValue
+
+ public boolean isAfterColHeaderValue(int colIdx, String curValue, String newValue) {
+ return (getIndexOfColHeaderValue(colIdx, curValue) > getIndexOfColHeaderValue(colIdx,
+ newValue));
+ } // isBeforeColHeaderValue
+
+ public boolean isAfterColHeaderValue(int colIdx, int curValue, Integer newValue) {
+ return (getIndexOfColHeaderValue(colIdx, curValue) > getIndexOfColHeaderValue(colIdx,
+ newValue.intValue()));
+ } // isBeforeColHeaderValue
+
+ public int getIndexOfRowHeaderValue(int rowIdx, String value) {
+ return ((CrossTabColumnValues) rowHeaderValues.get(rowIdx)).getIndexOf(value);
+ } // getIndexOfRowHeaderValue
+
+ public boolean isAfterRowHeaderValue(int rowIdx, String curValue, String newValue) {
+ return (getIndexOfRowHeaderValue(rowIdx, curValue) > getIndexOfRowHeaderValue(rowIdx,
+ newValue));
+ } // isBeforeRowHeaderValue
+
+ public Vector getRowHeaderValues() {
+ return rowHeaderValues;
+ }
+
+ public void setRowHeaderValues(Vector rowHeaderValues) {
+ this.rowHeaderValues = rowHeaderValues;
+ }
+
+} // CrossTabOrderManager
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabTotalValue.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabTotalValue.java
new file mode 100644
index 00000000..bb5e9dc6
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabTotalValue.java
@@ -0,0 +1,56 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+import java.util.Vector;
+
+public class CrossTabTotalValue extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private Vector headerValues = null;
+
+ private String totalValue = null;
+
+ public CrossTabTotalValue() {
+ super();
+ }
+
+ public CrossTabTotalValue(Vector headerValues, String totalValue) {
+ this();
+
+ setHeaderValues(headerValues);
+ setTotalValue(totalValue);
+ } // CrossTabTotalValue
+
+ public Vector getHeaderValues() {
+ return headerValues;
+ }
+
+ public String getTotalValue() {
+ return totalValue;
+ }
+
+ public void setHeaderValues(Vector headerValues) {
+ this.headerValues = headerValues;
+ }
+
+ public void setTotalValue(String totalValue) {
+ this.totalValue = totalValue;
+ }
+
+} // CrossTabTotalValue
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataRow.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataRow.java
new file mode 100644
index 00000000..aa53be1d
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataRow.java
@@ -0,0 +1,169 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+import java.util.ArrayList;
+import java.util.Vector;
+
+public class DataRow/* extends Vector*/ {
+
+ private ArrayList dataValueList = new ArrayList();
+ private HtmlFormatter rowFormatter = null;
+
+ private int nextElemIdx = 0;
+
+ private boolean rowFormat = false;
+
+ private String formatId = null;
+
+ private int rowNum = -1;
+
+ private Vector<DataValue> rowValues;
+
+ /**
+ * @return the rowNum
+ */
+ public int getRowNum() {
+ return rowNum;
+ }
+
+
+ /**
+ * @param rowNum the rowNum to set
+ * Used for crosstab
+ */
+ public void setRowNum(int rowNum) {
+ this.rowNum = rowNum;
+ }
+
+
+ public String getFormatId() {
+ return formatId;
+ }
+
+
+ public void setFormatId(String formatId) {
+ this.formatId = formatId;
+ }
+
+
+ public void resetNext() {
+ resetNext(0);
+ } // resetNext
+
+ public void resetNext(int toPos) {
+ nextElemIdx = toPos;
+ } // resetNext
+
+ public boolean hasNext() {
+ return (nextElemIdx < dataValueList.size());
+ } // hasNext
+
+ public DataValue getNext() {
+ return hasNext() ? getDataValue(nextElemIdx++) : null;
+ } // getNext
+
+ public DataValue getDataValue(int idx) {
+ return (DataValue) dataValueList.get(idx);
+ } // getRowHeader
+
+ public void addDataValue(DataValue dataValue) {
+ if (rowFormatter != null)
+ dataValue.setRowFormatter(rowFormatter);
+ dataValueList.add(dataValue);
+ } // addDataValue
+
+ public void addDataValue(int idx, DataValue dataValue) {
+ if (rowFormatter != null)
+ dataValue.setRowFormatter(rowFormatter);
+ dataValueList.add(idx, dataValue);
+ } // addDataValue
+
+ public void setDataValue(int idx, DataValue dataValue) {
+ if (rowFormatter != null)
+ dataValue.setRowFormatter(rowFormatter);
+ dataValueList.set(idx, dataValue);
+ } // addDataValue
+
+ public HtmlFormatter getRowFormatter() {
+ return rowFormatter;
+ }
+
+ public void setRowFormat(boolean b) {
+ rowFormat = b;
+ }
+ public boolean isRowFormat() {
+ return rowFormat;
+ }
+
+ public void setRowFormatter(HtmlFormatter rowFormatter) {
+ this.rowFormatter = rowFormatter;
+
+ for (int i = 0; i < dataValueList.size(); i++)
+ ((DataValue) dataValueList.get(i)).setRowFormatter(rowFormatter);
+ } // setRowFormatter
+
+ public String getBgColorHtml() {
+ if (rowFormatter != null && rowFormatter.getBgColor().length() > 0)
+ return " bgcolor=" + rowFormatter.getBgColor();
+ else
+ return "";
+ } // getBgColorHtml
+
+ public String getDataValue(String colId) {
+ String v_ColId = "";
+ for (int i = 0; i < dataValueList.size(); i++) {
+ v_ColId = ((DataValue) dataValueList.get(i)).getColId();
+ if(v_ColId.equals(colId)) {
+ return ((DataValue) dataValueList.get(i)).getDisplayValue();
+ }
+ }
+ return null;
+
+ }
+
+
+ /**
+ * @return the dataValueList
+ */
+ public ArrayList getDataValueList() {
+ return dataValueList;
+ }
+
+
+ /**
+ * @param dataValueList the dataValueList to set
+ */
+ public void setDataValueList(ArrayList dataValueList) {
+ this.dataValueList = dataValueList;
+ }
+
+
+ public Vector<DataValue> getRowValues() {
+ return rowValues;
+ }
+
+
+ public void setRowValues(Vector<DataValue> rowValues) {
+ this.rowValues = rowValues;
+ }
+
+} // DataRow
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataValue.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataValue.java
new file mode 100644
index 00000000..605cb226
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataValue.java
@@ -0,0 +1,359 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+public class DataValue extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private String displayValue = "";
+
+ private String displayCalculatedValue = "";
+
+ private String drillDownURL = null;
+
+ private boolean drillDowninPoPUp = false;
+
+ private String indentation = "";
+
+ private String alignment = "Left";
+
+ private boolean visible = true;
+
+ private boolean hidden = false;
+
+ private boolean bold = false;
+
+ private HtmlFormatter cellFormatter = null;
+
+ private HtmlFormatter rowFormatter = null;
+
+ private String formatId = null;
+
+ private boolean cellFormat = false;
+
+ private String colId = null;
+
+ private String displayTotal = null;
+
+ private String colName = null;
+
+ private String displayName = null;
+
+ private String nowrap = "False";
+
+ private String hyperlinkURL = "";
+
+ private String displayType = "";
+
+ private String actionImg = "";
+
+
+ public String getColName() {
+
+ return colName;
+ }
+
+
+ public void setColName(String colName) {
+
+ this.colName = colName;
+ }
+
+ public DataValue() {
+ super();
+ }
+
+ public String getFormatId() {
+ return formatId;
+ }
+
+
+ public void setFormatId(String formatId) {
+ this.formatId = formatId;
+ }
+
+ public void setCellFormat(boolean b) {
+ cellFormat = b;
+ }
+ public boolean isCellFormat() {
+ return cellFormat;
+ }
+
+ public String getDisplayValue() {
+ return displayValue;
+ }
+
+ public String getDrillDownURL() {
+ return drillDownURL;
+ }
+
+ public String getAlignment() {
+ return alignment;
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public boolean isBold() {
+ return bold;
+ }
+
+ public HtmlFormatter getCellFormatter() {
+ return cellFormatter;
+ }
+
+ public HtmlFormatter getRowFormatter() {
+ return rowFormatter;
+ }
+
+ public void setDisplayValue(String displayValue) {
+ this.displayValue = nvl(displayValue);
+ }
+
+ public void setDrillDownURL(String drillDownURL) {
+ this.drillDownURL = drillDownURL;
+ }
+
+ public void setAlignment(String alignment) {
+ this.alignment = alignment;
+ }
+
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+
+ public void setBold(boolean bold) {
+ this.bold = bold;
+ }
+
+ public void setCellFormatter(HtmlFormatter cellFormatter) {
+ this.cellFormatter = cellFormatter;
+ }
+
+ public void setRowFormatter(HtmlFormatter rowFormatter) {
+ this.rowFormatter = rowFormatter;
+ }
+
+ private String getFormattedValue(String value) {
+ value = nvl(value.trim()).length()<=0 ? "&nbsp":value;
+ if (cellFormatter != null)
+ return cellFormatter.formatValue(value);
+ else if (rowFormatter != null)
+ return rowFormatter.formatValue(value);
+ else
+ return value;
+ } // getFormattedValue
+
+ private String getFormattedLink(String value) {
+ if (cellFormatter != null)
+ return cellFormatter.formatLink(value, drillDownURL, isDrillDowninPoPUp());
+ else if (rowFormatter != null)
+ return rowFormatter.formatLink(value, drillDownURL, isDrillDowninPoPUp());
+ else {
+ if(!isDrillDowninPoPUp()) {
+ return "<a href=\"" + drillDownURL + "\">" + value + "</a>";
+ } else {
+ return "<a href=\"#\" onClick=\"showDrillDownInPopup('" + drillDownURL + "&noFormFields=Y&isEmbedded=Y&show_back_btn=N"+ "')\">" + value + "</a>";
+ }
+
+ }
+ } // getFormattedValue
+
+ private String getValueHtml() {
+ return (nvl(displayValue).trim().length() == 0) ? "&nbsp;" : displayValue;
+ }
+
+ public String getDisplayValueHtml() {
+ return getFormattedValue(getValueHtml());
+ }
+
+ public String getDisplayValueLinkHtml() {
+ if (nvl(drillDownURL).length() == 0)
+ return getDisplayValueHtml();
+ else
+ return getFormattedLink(getValueHtml());
+ // return getFormattedValue("<a
+ // href=\""+drillDownURL+"\">"+getValueHtml()+"</a>");
+ } // getDisplayValueLinkHtml
+
+ public String getAlignmentHtml() {
+ if (cellFormatter != null && cellFormatter.getAlignment().length() > 0)
+ return " align=" + cellFormatter.getAlignment();
+ else if (rowFormatter != null && rowFormatter.getAlignment().length() > 0)
+ return " align=" + rowFormatter.getAlignment();
+ else
+ return (alignment.length() == 0) ? "" : (" align=" + alignment);
+ } // getAlignmentHtml
+
+ public String getBgColorHtml() {
+ if (cellFormatter != null && cellFormatter.getBgColor().length() > 0)
+ return " bgcolor=" + cellFormatter.getBgColor();
+ else if (rowFormatter != null && rowFormatter.getBgColor().length() > 0)
+ return " bgcolor=" + rowFormatter.getBgColor();
+ else
+ return "";
+ } // getBgColorHtml
+
+
+ public String getColId() {
+
+ return colId;
+ }
+
+
+ public void setColId(String colId) {
+
+ this.colId = colId;
+ }
+
+
+ public String getDisplayTotal() {
+
+ return displayTotal;
+ }
+
+
+ public void setDisplayTotal(String displayTotal) {
+
+ this.displayTotal = displayTotal;
+ }
+
+
+
+ public String getDisplayName() {
+
+ return displayName;
+ }
+
+
+
+ public void setDisplayName(String displayName) {
+
+ this.displayName = displayName;
+ }
+
+
+ public boolean isHidden() {
+ return hidden;
+ }
+
+
+ public void setHidden(boolean hidden) {
+ this.hidden = hidden;
+ }
+
+ public String getNowrap() {
+ return nowrap;
+ }
+
+
+ public void setNowrap(String nowrap) {
+ this.nowrap = nowrap;
+ }
+
+ public boolean isDrillDowninPoPUp() {
+ return drillDowninPoPUp;
+ }
+
+
+ public void setDrillDowninPoPUp(boolean drillDowninPoPUp) {
+ this.drillDowninPoPUp = drillDowninPoPUp;
+ }
+
+
+ /**
+ * @return the displayCalculatedValue
+ */
+ public String getDisplayCalculatedValue() {
+ return displayCalculatedValue;
+ }
+
+
+ /**
+ * @param displayCalculatedValue the displayCalculatedValue to set
+ */
+ public void setDisplayCalculatedValue(String displayCalculatedValue) {
+ this.displayCalculatedValue = displayCalculatedValue;
+ }
+
+
+ /**
+ * @return the indentation
+ */
+ public String getIndentation() {
+ return indentation;
+ }
+
+
+ /**
+ * @param indentation the indentation to set
+ */
+ public void setIndentation(String indentation) {
+ this.indentation = indentation;
+ }
+
+
+ /**
+ * @return the hyperlinkURL
+ */
+ public String getHyperlinkURL() {
+ return hyperlinkURL;
+ }
+
+
+ /**
+ * @param hyperlinkURL the hyperlinkURL to set
+ */
+ public void setHyperlinkURL(String hyperlinkURL) {
+ this.hyperlinkURL = hyperlinkURL;
+ }
+
+
+ /**
+ * @return the displayType
+ */
+ public String getDisplayType() {
+ return displayType;
+ }
+
+
+ /**
+ * @param displayType the displayType to set
+ */
+ public void setDisplayType(String displayType) {
+ this.displayType = displayType;
+ }
+
+
+ /**
+ * @return the actionImg
+ */
+ public String getActionImg() {
+ return actionImg;
+ }
+
+
+ /**
+ * @param actionImg the actionImg to set
+ */
+ public void setActionImg(String actionImg) {
+ this.actionImg = actionImg;
+ }
+
+} // DataValue
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/HtmlFormatter.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/HtmlFormatter.java
new file mode 100644
index 00000000..fa54a1d9
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/HtmlFormatter.java
@@ -0,0 +1,205 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+public class HtmlFormatter extends RaptorObject {
+ private boolean bold = false;
+
+ private boolean italic = false;
+
+ private boolean underline = false;
+
+ private String bgColor = "";
+
+ private String fontColor = "";
+
+ private String fontFace = "";
+
+ private String fontSize = "";
+
+ private String alignment = "";
+
+ private String formatId = "";
+
+ public HtmlFormatter() {
+ super();
+ }
+
+ public HtmlFormatter(boolean bold, boolean italic, boolean underline, String bgColor,
+ String fontColor, String fontFace, String fontSize) {
+ this();
+
+ setBold(bold);
+ setItalic(italic);
+ setUnderline(underline);
+ setBgColor(bgColor);
+ setFontColor(fontColor);
+ setFontFace(fontFace);
+ setFontSize(fontSize);
+ } // HtmlFormatter
+
+ public HtmlFormatter(boolean bold, boolean italic, boolean underline, String bgColor,
+ String fontColor, String fontFace, String fontSize, String alignment) {
+ this(bold, italic, underline, bgColor, fontColor, fontFace, fontSize);
+ setAlignment(alignment);
+ } // HtmlFormatter
+
+ public boolean isBold() {
+ return bold;
+ }
+
+ public boolean isItalic() {
+ return italic;
+ }
+
+ public boolean isUnderline() {
+ return underline;
+ }
+
+ public String getBgColor() {
+ return bgColor;
+ }
+
+ public String getFontColor() {
+ return fontColor;
+ }
+
+ public String getFontFace() {
+ return fontFace;
+ }
+
+ public String getFontSize() {
+ return fontSize;
+ }
+
+ public String getAlignment() {
+ return alignment;
+ }
+
+ public void setBold(boolean bold) {
+ this.bold = bold;
+ }
+
+ public void setItalic(boolean italic) {
+ this.italic = italic;
+ }
+
+ public void setUnderline(boolean underline) {
+ this.underline = underline;
+ }
+
+ public void setBgColor(String bgColor) {
+ this.bgColor = nvl(bgColor);
+ }
+
+ public void setFontColor(String fontColor) {
+ this.fontColor = nvl(fontColor);
+ }
+
+ public void setFontFace(String fontFace) {
+ this.fontFace = nvl(fontFace);
+ }
+
+ public void setFontSize(String fontSize) {
+ this.fontSize = nvl(fontSize);
+ }
+
+ public void setAlignment(String alignment) {
+ this.alignment = nvl(alignment);
+ }
+
+ private String generateStyleHtml() {
+ StringBuffer sb = new StringBuffer();
+
+ if (isBold())
+ sb.append("font-weight:bold;");
+ if (isItalic())
+ sb.append("font-style:italic;");
+ if (isUnderline())
+ sb.append("text-decoration:underline;");
+ // if(getBgColor().length()>0)
+ // sb.append("background-color:"+getBgColor()+";");
+ if (getFontColor().length() > 0)
+ sb.append("color:" + getFontColor() + ";");
+ if (getFontFace().length() > 0)
+ sb.append("font-family:" + getFontFace() + ";");
+ if (getFontSize().length() > 0)
+ sb.append("font-size:" + getFontSize() + "px;");
+ if (getAlignment().length() > 0)
+ sb.append("text-align:" + getAlignment() + ";");
+
+ if (sb.length() > 0) {
+ sb.insert(0, " style=\"");
+ sb.append("\"");
+ } // if
+
+ return sb.toString();
+ } // generateStyleHtml
+
+ public String generateStyleForZK() {
+ StringBuffer sb = new StringBuffer();
+
+ if (isBold())
+ sb.append("font-weight:bold;");
+ if (isItalic())
+ sb.append("font-style:italic;");
+ if (isUnderline())
+ sb.append("text-decoration:underline;");
+ // if(getBgColor().length()>0)
+ // sb.append("background-color:"+getBgColor()+";");
+ if (getFontColor().length() > 0)
+ sb.append("color:" + getFontColor() + ";");
+ if (getFontFace().length() > 0)
+ sb.append("font-family:" + getFontFace() + ";");
+ if (getFontSize().length() > 0)
+ sb.append("font-size:" + getFontSize() + "px;");
+ if (getAlignment().length() > 0)
+ sb.append("text-align:" + getAlignment() + ";");
+
+ return sb.toString();
+ } // generateStyleHtml
+
+ public String formatValue(String value) {
+ String style = generateStyleHtml();
+ if (style.length() > 0)
+ return "<font" + style + ">" + value + "</font>";
+ else
+ return value;
+ } // formatValue
+
+ public String formatLink(String value, String url, boolean drillDowninPoPUp) {
+ if(!drillDowninPoPUp) {
+ return "<a href=\"" + url + "\"" + generateStyleHtml() + ">" + value + "</a>";
+ } else {
+ return "<a href=\"#\" onClick=\"showDrillDownInPopup('" + url + "&noFormFields=Y&isEmbedded=Y&show_back_btn=N"+ "')\"" + generateStyleHtml() + ">" + value + "</a>";
+ }
+ } // formatLink
+
+ public String getFormatId() {
+ return formatId;
+ }
+
+ public void setFormatId(String formatId) {
+ this.formatId = formatId;
+ }
+
+} // HtmlFormatter
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportColumnHeaderRows.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportColumnHeaderRows.java
new file mode 100644
index 00000000..6bbe0127
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportColumnHeaderRows.java
@@ -0,0 +1,71 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+import java.util.Vector;
+
+public class ReportColumnHeaderRows extends Vector {
+ private int nextElemIdx = 0;
+
+ public void resetNext() {
+ resetNext(0);
+ } // resetNext
+
+ public void resetNext(int toPos) {
+ nextElemIdx = toPos;
+ } // resetNext
+
+ public boolean hasNext() {
+ return (nextElemIdx < size());
+ } // hasNext
+
+ public ColumnHeaderRow getNext() {
+ return hasNext() ? getColumnHeaderRow(nextElemIdx++) : null;
+ } // getNext
+
+ public ColumnHeader getColumnHeader(int rowIdx, int colIdx) {
+ return getColumnHeaderRow(rowIdx).getColumnHeader(colIdx);
+ } // getColumnHeader
+
+ public ColumnHeaderRow getColumnHeaderRow(int idx) {
+ return (ColumnHeaderRow) get(idx);
+ } // getColumnHeaderRow
+
+ public void addColumnHeaderRow(ColumnHeaderRow columnHeaderRow) {
+ add(columnHeaderRow);
+ } // addColumnHeaderRow
+
+ public void addColumnHeaderRow(int idx, ColumnHeaderRow columnHeaderRow) {
+ add(idx, columnHeaderRow);
+ } // addColumnHeaderRow
+
+ public int getRowCount() {
+ return size();
+ } // getRowCount
+
+ public int getColumnCount() {
+ int cSize = 0;
+ if (getRowCount() > 0)
+ cSize = getColumnHeaderRow(getRowCount() - 1).size();
+
+ return cSize;
+ } // getColumnCount
+
+} // ReportColumnHeaderRows
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportData.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportData.java
new file mode 100644
index 00000000..5ef15dc4
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportData.java
@@ -0,0 +1,812 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.openecomp.portalsdk.analytics.model.runtime.FormatProcessor;
+import org.openecomp.portalsdk.analytics.model.runtime.VisualManager;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.Utils;
+
+public class ReportData extends org.openecomp.portalsdk.analytics.RaptorObject implements Serializable {
+ // private static final boolean sortData = true; // sort cross-tab data by
+ // row/col name while being added
+ private static final int MAX_NUM_COLS = 150; // -1 => no restriction
+
+ private int pageNo = -1;
+
+ private int pageSetNo = -1;
+
+ public ReportColumnHeaderRows reportColumnHeaderRows = null;
+
+ public ReportRowHeaderCols reportRowHeaderCols = null;
+
+ public ReportDataRows reportDataRows = null;
+
+ public ReportDataRows reportDataTotalRow = null;
+
+ public ReportRowHeaderCols reportTotalRowHeaderCols = null;
+
+ public List reportDataList = null;
+
+ private boolean canSortAtRuntime = false;
+
+ private Vector columnVisuals = null; // Contains actual column Ids for
+ // linear or last header col values
+ // for cross-tab
+
+ public ReportData(int pageNo, boolean canSortAtRuntime) {
+ super();
+
+ this.pageNo = pageNo;
+ this.canSortAtRuntime = canSortAtRuntime;
+
+ reportColumnHeaderRows = new ReportColumnHeaderRows();
+ reportRowHeaderCols = new ReportRowHeaderCols();
+ reportDataRows = new ReportDataRows();
+
+ columnVisuals = new Vector();
+ } // ReportData
+
+ public int getPageNo() {
+ return pageNo;
+ } // pageNo
+
+ public int getPageSetNo() {
+ return pageSetNo;
+ } // pageSetNo
+
+ public int getHeaderRowCount() {
+ return reportColumnHeaderRows.getRowCount();
+ } // getHeaderRowCount
+
+ public int getDataRowCount() {
+ if(reportDataRows!=null && reportDataRows.getRowCount()>0)
+ return reportDataRows.getRowCount();
+ else if(getReportDataList()!=null)
+ return getReportDataList().size();
+ else
+ return 0;
+ } // getDataRowCount
+
+ public int getTotalRowCount() {
+ return getHeaderRowCount() + getDataRowCount();
+ } // getTotalRowCount
+
+ public int getHeaderColumnCount() {
+ return reportRowHeaderCols.getColumnCount();
+ } // getHeaderColumnCount
+
+ public int getDataColumnCount() {
+ int cCount = reportDataRows.getColumnCount();
+ if (cCount == 0)
+ cCount = reportColumnHeaderRows.getColumnCount();
+
+ return cCount;
+ } // getDataColumnCount
+
+ public int getTotalColumnCount() {
+ return getHeaderColumnCount() + getDataColumnCount();
+ } // getTotalColumnCount
+
+ // Cross-tab data section
+ private void insertColumn(int colIdx, Vector colNameValues, Vector colNameSortValues, List dataList, String alignment) {
+ int r = 0;
+ for (reportColumnHeaderRows.resetNext(); reportColumnHeaderRows.hasNext();) {
+ ColumnHeaderRow chr = reportColumnHeaderRows.getNext();
+ if(colNameSortValues!=null) {
+ ColumnHeader ch = new ColumnHeader(((DataValue) colNameValues.get(r)).getDisplayValue(), Integer.valueOf(((DataValue)colNameSortValues.get(r)).getDisplayValue()) );
+ ch.setColumnWidth(chr.getDisplayWidth());
+ ch.setAlignment(alignment);
+ chr.addColumnHeader(colIdx, ch);
+ }
+ else {
+ ColumnHeader ch = new ColumnHeader(((DataValue) colNameValues.get(r)).getDisplayValue());
+ ch.setColumnWidth(chr.getDisplayWidth());
+ ch.setAlignment(alignment);
+ chr.addColumnHeader(colIdx, ch);
+ }
+ r++;
+ } // for
+
+/* for (reportDataRows.resetNext(); reportDataRows.hasNext();) {
+ DataRow dr = reportDataRows.getNext();
+ dr.addDataValue(colIdx, new DataValue());
+ } // for
+ */
+ for(int j = 0; j < dataList.size(); j++) {
+ DataRow dr = (DataRow) dataList.get(j);
+ dr.addDataValue(colIdx, new DataValue());
+ }
+ } // insertColumn
+
+ private boolean prevColNamesChanged(int colIdx, Vector prevColNames) {
+ for (int k = 0; k < prevColNames.size(); k++)
+ if (!nvl((String) prevColNames.get(k)).equals(
+ reportColumnHeaderRows.getColumnHeader(k, colIdx).getColumnTitle()))
+ return true;
+
+ return false;
+ } // prevColNamesChanged
+
+ private int findColumnIdx(Vector colNameValues, Vector colNameSortValues, CrossTabOrderManager crossTabOrderManager,
+ boolean createIfMissing, List dataList) {
+ int colIdx = 0;
+ try {
+
+ boolean nameFound = false;
+ // String prevColName = null;
+ Vector prevColNames = new Vector();
+ int columnSort = -1;
+ for (int r = 0; r < colNameValues.size(); r++) {
+ //String colName = (String) colNameValues.get(r);
+ String colName = ((DataValue) colNameValues.get(r)).getDisplayValue();
+ Integer colSortName = null;
+ if(colNameSortValues!=null)
+ colSortName = Integer.valueOf(((DataValue)colNameSortValues.get(r)).getDisplayValue());
+ ColumnHeaderRow chr = reportColumnHeaderRows.getColumnHeaderRow(r);
+
+ chr.resetNext(colIdx);
+ nameFound = false;
+ boolean posFound = false;
+ while ((!nameFound) && (!posFound) && chr.hasNext()) {
+ ColumnHeader ch = chr.getNext();
+ columnSort = ch.getColumnSort();
+ if (colName.equals(ch.getColumnTitle())) {
+ if (prevColNamesChanged(colIdx, prevColNames))
+ posFound = true;
+ else
+ nameFound = true;
+ } else if (crossTabOrderManager != null) {
+ if( colNameSortValues!=null && crossTabOrderManager.isAfterColHeaderValue(r, columnSort,
+ colSortName))
+ posFound = true;
+ else if (colNameSortValues == null && crossTabOrderManager.isAfterColHeaderValue(r, ch.getColumnTitle(),
+ colName)) {
+ posFound = true;
+ }
+ }
+ else if (crossTabOrderManager == null) {
+ if( colNameSortValues!=null && colSortName.compareTo(ch.getColumnSort()) < 0)
+ posFound = true;
+ else if (colNameSortValues==null && colName.compareTo(ch.getColumnTitle()) < 0)
+ posFound = true;
+ }
+ else // if(prevColName!=null&&(!
+ // prevColName.equals(reportColumnHeaderRows.getColumnHeader(r-1,
+ // colIdx).getColumnTitle())))
+ if (prevColNamesChanged(colIdx, prevColNames))
+ posFound = true;
+
+ if ((!nameFound) && (!posFound))
+ colIdx++;
+ } // while
+
+ if (!nameFound)
+ if (createIfMissing && (MAX_NUM_COLS >= 0) && (colIdx <= MAX_NUM_COLS)) {
+ insertColumn(colIdx, colNameValues, colNameSortValues, dataList, chr.getAlignment());
+ return colIdx;
+ } else
+ return -1;
+
+ prevColNames.add(r, colName);
+ } // for
+ if (!nameFound)
+ if (createIfMissing && (MAX_NUM_COLS >= 0) && (colIdx <= MAX_NUM_COLS))
+ insertColumn(colIdx, colNameValues, colNameSortValues, dataList, "center");
+ else
+ return -1;
+ } catch (Exception ex) {ex.printStackTrace();}
+
+ return colIdx;
+ } // findColumnIdx
+
+ private void insertRow(int rowIdx, Vector rowNameValues, List dataList, CrossTabOrderManager crossTabOrderManager) {
+ int c = 0;
+ DataRow dr = new DataRow();
+ int dataRowIdx = 0;
+ for (reportRowHeaderCols.resetNext(); reportRowHeaderCols.hasNext();) {
+ if((c+1)==reportRowHeaderCols.size()) {
+ dataRowIdx = crossTabOrderManager.getIndexOfRowHeaderValue(c, ((DataValue) rowNameValues.get(c)).getDisplayValue());
+ }
+ RowHeaderCol rhc = reportRowHeaderCols.getNext();
+ rhc.addRowHeader(rowIdx, new RowHeader(((DataValue) rowNameValues.get(c)).getDisplayValue()));
+ c++;
+ } // for
+
+ dr.setRowNum(dataRowIdx);
+ for (c = 0; c < getDataColumnCount(); c++) {
+ dr.addDataValue(new DataValue());
+ }
+
+ //reportDataRows.addDataRow(rowIdx, dr);
+ //dr.setRowNum(dataList.size()==0?1:dataList.size());
+ dataList.add(rowIdx, dr);
+
+ } // insertRow
+
+ private boolean prevRowNamesChanged(int rowIdx, Vector prevRowNames) {
+ for (int k = 0; k < prevRowNames.size(); k++)
+ if (!nvl((String) prevRowNames.get(k)).equals(
+ reportRowHeaderCols.getRowHeader(k, rowIdx).getRowTitle()))
+ return true;
+
+ return false;
+ } // prevRowNamesChanged
+
+ private int findRowIdx(Vector rowNameValues, CrossTabOrderManager crossTabOrderManager,
+ boolean createIfMissing, List dataList) {
+ int rowIdx = 0;
+ boolean nameFound = false;
+ Vector prevRowNames = new Vector();
+ for (int c = 0; c < rowNameValues.size(); c++) {
+ //String rowName = (String) rowNameValues.get(c);
+ String rowName = ((DataValue) rowNameValues.get(c)).getDisplayValue();
+
+ RowHeaderCol rhc = reportRowHeaderCols.getRowHeaderCol(c);
+
+ rhc.resetNext(rowIdx);
+ nameFound = false;
+ boolean posFound = false;
+ while ((!nameFound) && (!posFound) && rhc.hasNext()) {
+ RowHeader rh = rhc.getNext();
+ if (rowName.equals(rh.getRowTitle())) {
+ if (prevRowNamesChanged(rowIdx, prevRowNames))
+ posFound = true;
+ else
+ nameFound = true;
+ } else if (crossTabOrderManager != null
+ && crossTabOrderManager.isAfterRowHeaderValue(c, rh.getRowTitle(),
+ rowName))
+ posFound = true;
+ else if (crossTabOrderManager == null
+ && rowName.compareTo(rh.getRowTitle()) < 0)
+ posFound = true;
+ else if (prevRowNamesChanged(rowIdx, prevRowNames))
+ posFound = true;
+
+ if ((!nameFound) && (!posFound))
+ rowIdx++;
+ } // while
+
+ if (!nameFound)
+ if (createIfMissing) {
+ insertRow(rowIdx, rowNameValues, dataList, crossTabOrderManager);
+ return rowIdx;
+ } else
+ return -1;
+
+ prevRowNames.add(c, rowName);
+ } // for
+ if (!nameFound)
+ if (createIfMissing)
+ insertRow(rowIdx, rowNameValues, dataList, crossTabOrderManager);
+ else
+ return -1;
+
+ return rowIdx;
+ } // findRowIdx
+
+ public void setDataValue(Vector rowNameValues, Vector colNameValues, Vector colNameSortValues, DataValue value,
+ FormatProcessor formatProcessor, CrossTabOrderManager crossTabOrderManager, List dataList) {
+ int rowIdx = findRowIdx(rowNameValues, crossTabOrderManager, true, dataList);
+ int colIdx = findColumnIdx(colNameValues, colNameSortValues, crossTabOrderManager, true, dataList);
+
+ if ((rowIdx >= 0) && (colIdx >= 0)) {
+ //DataRow dr = reportDataRows.getDataRow(rowIdx);
+ DataRow dr = (DataRow)dataList.get(rowIdx);
+ dr.setRowValues(rowNameValues);
+ dr.setDataValue(colIdx, value);
+ formatProcessor.setHtmlFormatters(value, dr, false);
+ } // if
+ } // setDataValue
+
+ public void consolidateColumnHeaders(VisualManager visualManager) {
+ // Setting column visuals
+ for (int i = 0; i < reportColumnHeaderRows.getColumnHeaderRow(
+ reportColumnHeaderRows.getRowCount() - 1).size(); i++) {
+ StringBuffer sb = new StringBuffer();
+
+ for (int ir = 0; ir < reportColumnHeaderRows.getRowCount(); ir++) {
+ ColumnHeader ch = reportColumnHeaderRows.getColumnHeaderRow(ir)
+ .getColumnHeader(i);
+ if (sb.length() > 0)
+ sb.append('|');
+ sb.append(Utils.replaceInString(ch.getColumnTitle(), "|", " "));
+ } // for
+
+ String colValue = sb.toString();
+ columnVisuals.add(new ColumnVisual(colValue, colValue, visualManager
+ .isColumnVisible(colValue), /* visualManager.getSortByColId().equals(colValue)?visualManager.getSortByAscDesc(): */
+ null));
+ } // for
+
+ // Consolidating column headers
+ for (int r = reportColumnHeaderRows.getRowCount() - 1; r >= 0; r--) {
+ ColumnHeaderRow chr = reportColumnHeaderRows.getColumnHeaderRow(r);
+
+ if (chr.size() > 0) {
+ ColumnHeader baseCH = chr.getColumnHeader(0);
+ int c = 1;
+ int c_shift = 0;
+ while (c < chr.size()) {
+ ColumnHeader ch = chr.getColumnHeader(c);
+
+ boolean performMerge = true;
+ for (int ir = r; ir >= 0; ir--) {
+ ColumnHeaderRow ichr = reportColumnHeaderRows.getColumnHeaderRow(ir);
+ ColumnHeader ch0 = ichr.getColumnHeader(c + ((ir == r) ? 0 : c_shift));
+ ColumnHeader ch1 = ichr.getColumnHeader(c + ((ir == r) ? 0 : c_shift)
+ - 1);
+ if (!ch0.getColumnTitle().equals(ch1.getColumnTitle()))
+ performMerge = false;
+ } // for
+
+ if (performMerge) {
+ c_shift++;
+ baseCH.setColSpan(baseCH.getColSpan() + 1);
+ chr.remove(c);
+ } else {
+ baseCH = ch;
+ c++;
+ }
+ } // while
+ } // if
+ } // for
+ } // consolidateColumnHeaders
+
+ public void consolidateRowHeaders() {
+ for (int c = reportRowHeaderCols.getColumnCount() - 1; c >= 0; c--) {
+ RowHeaderCol rhc = reportRowHeaderCols.getRowHeaderCol(c);
+
+ if (rhc.size() > 0) {
+ RowHeader baseRH = rhc.getRowHeader(0);
+ int r = 1;
+ while (r < rhc.size()) {
+ RowHeader rh = rhc.getRowHeader(r);
+
+ boolean performMerge = rh.getRowTitle().equals(baseRH.getRowTitle());
+ for (int ic = c - 1; ic >= 0; ic--) {
+ RowHeaderCol irhc = reportRowHeaderCols.getRowHeaderCol(ic);
+ RowHeader rh0 = irhc.getRowHeader(r);
+ RowHeader rh1 = irhc.getRowHeader(r - 1);
+ if (!rh0.getRowTitle().equals(rh1.getRowTitle()))
+ performMerge = false;
+ } // for
+
+ if (performMerge)
+ rh.setRowTitle(null);
+ else
+ baseRH = rh;
+
+ r++;
+ } // while
+ } // if
+ } // for
+ } // consolidateRowHeaders
+
+ public void addRowNumbers(int pageNo, List dataList) {
+ pageNo = 0;
+ //int startRowNum = ((pageNo < 0) ? 0 : pageNo) * pageSize + 1;
+ int startRowNum = 0;
+ RowHeaderCol rhc = new RowHeaderCol();
+ reportRowHeaderCols.addRowHeaderCol(0, rhc);
+ //rhc.setColumnWidth("5%");
+ for (int r = 0; r < dataList.size(); r++) {
+ rhc.add(new RowHeader(startRowNum + r+""));
+ ((DataRow)dataList.get(r)).setRowNum(r);
+ }
+ } // addRowNumbers
+
+ private void removeRow(int rowIdx) {
+ for (reportRowHeaderCols.resetNext(); reportRowHeaderCols.hasNext();) {
+ RowHeaderCol rhc = reportRowHeaderCols.getNext();
+ rhc.remove(rowIdx);
+ } // for
+
+ reportDataRows.remove(rowIdx);
+ } // removeRow
+
+ public void truncateData(int startRow, int endRow) {
+ if( endRow != -1){
+ for (int r = getDataRowCount() - 1; r > endRow; r--)
+ removeRow(r);
+ }
+
+ for (int r = startRow - 1; r >= 0; r--)
+ removeRow(r);
+ } // truncateData
+
+ /** *********************************************************************************** */
+
+ public void createColumn(String colId, String displayName, String displayWidthInPxls, String alignment,
+ boolean currentlyVisible, String currentSort, boolean isRuntimeColSortDisabled, int level, int start, int colspan, boolean sortable) {
+ ColumnHeaderRow chr = null;
+ if (getHeaderRowCount() > 0)
+ chr = reportColumnHeaderRows.getColumnHeaderRow(0);
+ else {
+ chr = new ColumnHeaderRow();
+ reportColumnHeaderRows.addColumnHeaderRow(chr);
+ chr.setRowHeight("30");
+ } // if
+ /*ColumnHeader ch = new ColumnHeader(displayName, (displayWidth > 100) ? "10%" : (""
+ + displayWidth + "%"), alignment, 1, isRuntimeColSortDisabled ? null : colId);
+ */
+ ColumnHeader ch = new ColumnHeader(displayName, displayWidthInPxls, alignment, 1, isRuntimeColSortDisabled ? null : colId);
+ ch.setGroupLevel(level);
+ ch.setStartGroup(start);
+ ch.setColSpanGroup(colspan);
+ ch.setColId(colId);
+ ch.setSortable(sortable);
+ //chr.addColumnHeader(new ColumnHeader(displayName, (displayWidth > 100) ? "10%" : (""
+ // + displayWidth + "%"), 1, isRuntimeColSortDisabled ? null : colId));
+ chr.addColumnHeader(ch);
+ columnVisuals.add(new ColumnVisual(colId, displayName, currentlyVisible, currentSort));
+ } // createColumn
+
+ public void columnVisualShowHide(String colId, boolean newVisible) {
+ for (int i = 0; i < columnVisuals.size(); i++) {
+ ColumnVisual col = (ColumnVisual) columnVisuals.get(i);
+ if (col.getColId().equals(colId)) {
+ col.setVisible(newVisible);
+ applyColumnVisibility(i, newVisible);
+ break;
+ } // if
+ } // for
+ } // columnVisualShowHide
+
+ private void applyColumnVisibility(int colIdx, boolean newVisible) {
+ boolean isLast = true;
+ for (int r = reportColumnHeaderRows.getRowCount() - 1; r >= 0; r--) {
+ ColumnHeaderRow chr = reportColumnHeaderRows.getColumnHeaderRow(r);
+
+ if (isLast) {
+ chr.getColumnHeader(colIdx).setVisible(newVisible);
+ isLast = false;
+ } else {
+ int curStartIdx = 0;
+ for (chr.resetNext(); chr.hasNext();) {
+ ColumnHeader ch = chr.getNext();
+ if (colIdx >= curStartIdx && colIdx <= curStartIdx + ch.getColSpan() - 1) {
+ ch.setVisible(newVisible);
+ break;
+ } else
+ curStartIdx += ch.getColSpan();
+ } // for
+ } // else
+ } // for
+ int row = 0;
+ for (reportDataRows.resetNext(); reportDataRows.hasNext();) {
+ //reportDataRows.getNext().getDataValue(colIdx).setVisible(newVisible);
+ DataRow dr = reportDataRows.getNext();
+ if(colIdx < dr.getDataValueList().size()) {
+ DataValue dv = dr.getDataValue(colIdx);
+ dr.getDataValueList().remove(colIdx);
+ if(!dv.isHidden())
+ dv.setVisible(newVisible);
+ else
+ dv.setVisible(false);
+ dr.addDataValue(colIdx, dv);
+ }
+ reportDataRows.removeElementAt(row);
+ reportDataRows.addDataRow(row, dr);
+ row++;
+ }
+ } // applyColumnVisibility
+
+ public void applyVisibility() {
+ for (int i = 0; i < columnVisuals.size(); i++)
+ applyColumnVisibility(i, ((ColumnVisual) columnVisuals.get(i)).isVisible());
+ } // applyVisibility
+
+ public void resetVisualSettings() {
+ // No need to reset sort - if sort exists, the report data is reloaded
+ for (int i = 0; i < columnVisuals.size(); i++)
+ ((ColumnVisual) columnVisuals.get(i)).setVisible(true);
+
+ applyVisibility();
+ } // resetVisualSettings
+
+ /** *********************************************************************************** */
+
+ private int nextVisualIdx = 0;
+
+ public void resetNextVisual() {
+ resetNextVisual(0);
+ } // resetNext
+
+ public void resetNextVisual(int toPos) {
+ nextVisualIdx = toPos;
+ } // resetNext
+
+ public boolean hasNextVisual() {
+ return (nextVisualIdx < columnVisuals.size());
+ } // hasNext
+
+ public String getNextHiddenColLinks(int toPos) {
+ resetNextVisual(toPos);
+ return getNextHiddenColLinks();
+ } // getNextHiddenColLinks
+
+ public String getNextHiddenColLinks() {
+ if (!hasNextVisual())
+ return "";
+
+ StringBuffer sb = new StringBuffer();
+ ColumnVisual col = (ColumnVisual) columnVisuals.get(nextVisualIdx);
+
+ while (!col.isVisible()) {
+ if(!col.getColDisplay().equals(AppConstants.HIDDEN)) {
+ sb.append("<input type=image border=0 src='");
+ sb.append(AppUtils.getImgFolderURL());
+ sb.append("plus.gif' alt=\"Show column ");
+ sb.append(col.getColDisplay());
+ sb.append("\" width=11 height=11 onClick=\"document.formd.");
+ sb.append(AppConstants.RI_VISUAL_ACTION);
+ sb.append(".value='");
+ sb.append(AppConstants.VA_SHOW);
+ sb.append("';document.formd.");
+ sb.append(AppConstants.RI_DETAIL_ID);
+ sb.append(".value='");
+ sb.append(col.getColId());
+ sb.append("';document.formd.submit();\">");
+ }
+
+ if (!(nextVisualIdx + 1 < columnVisuals.size()))
+ break;
+ col = (ColumnVisual) columnVisuals.get(++nextVisualIdx);
+ } // while
+
+ return sb.toString();
+ } // getNextHiddenColLinks
+
+ public String getNextVisual() {
+ if (!hasNextVisual())
+ return null;
+
+ ColumnVisual col = (ColumnVisual) columnVisuals.get(nextVisualIdx++);
+
+ StringBuffer sb = new StringBuffer();
+
+ if (!col.isVisible() || col.getColDisplay().equals(AppConstants.HIDDEN))
+ return null;
+
+ sb.append("\n\t\t\t<table width=100% border=0 cellspacing=0 cellpadding=0><tr>\n");
+ sb
+ .append("\t\t\t\t<td style=\"background:#ffffff;\" align=left valign=middle nowrap><input type=image border=0 src='");
+ sb.append(AppUtils.getImgFolderURL());
+ sb.append("minus.gif' alt=\"Hide column ");
+ sb.append(col.getColDisplay());
+ sb.append("\" width=11 height=11 onClick=\"document.formd.");
+ sb.append(AppConstants.RI_VISUAL_ACTION);
+ sb.append(".value='");
+ sb.append(AppConstants.VA_HIDE);
+ sb.append("';document.formd.");
+ sb.append(AppConstants.RI_DETAIL_ID);
+ sb.append(".value='");
+ sb.append(col.getColId());
+ sb.append("';document.formd.submit();");
+ sb.append("\"></td>\n");
+ sb.append("\t\t\t\t<td style=\"background:#ffffff;\" align=center valign=middle width=95% nowrap>");
+ if (col.getSortType() != null) {
+ sb.append("<img border=0 src='");
+ sb.append(AppUtils.getImgFolderURL());
+ if (col.getSortType().equals(AppConstants.SO_ASC))
+ sb.append("grnarrowdn.gif");
+ else
+ sb.append("grnarrowup.gif");
+ sb.append("' alt=\"Sorted by column ");
+ sb.append(col.getColDisplay());
+ if (col.getSortType().equals(AppConstants.SO_ASC))
+ sb.append(" ascending");
+ else
+ sb.append(" descending");
+ sb.append("\" width=13 height=11>");
+ }
+ sb.append("</td>\n");
+ sb.append("\t\t\t\t<td style=\"background:#ffffff;\" align=right valign=middle nowrap>");
+ sb.append(getNextHiddenColLinks());
+ sb.append("</td>\n");
+ sb.append("\t\t\t</tr></table>\n\t\t");
+
+ return sb.toString();
+ } // getNext
+
+ /** *********************************************************************************** */
+
+ public void setColumnDataTotalsLinear(DataRow colDataTotals, String colTotalLabel) {
+ //commented so that we could differentiate data rows with total rows
+ //reportDataRows.addDataRow(colDataTotals);
+ RowHeader rh = new RowHeader(colTotalLabel, "45", 1, reportRowHeaderCols.getColumnCount(),true);
+ if(reportRowHeaderCols.size()>0)
+ reportRowHeaderCols.getRowHeaderCol(0).add(rh);
+
+ reportDataTotalRow = new ReportDataRows();
+ reportDataTotalRow.addDataRow(colDataTotals);
+ RowHeaderCol rhc = new RowHeaderCol();
+ rhc.add(rh);
+ reportTotalRowHeaderCols = new ReportRowHeaderCols();
+ reportTotalRowHeaderCols.addRowHeaderCol(0, rhc);
+ } // setColumnDataTotalsLinear
+
+ public void setCrossTabColumnTotalLabel(String colTotalLabel) {
+ reportRowHeaderCols.getRowHeaderCol(0).getRowHeader(getDataRowCount() - 1)
+ .setRowTitle("");
+ reportRowHeaderCols.getRowHeaderCol(0).getRowHeader(getDataRowCount() - 1).setColSpan(
+ 0);
+ reportRowHeaderCols.getRowHeaderCol(1).set(
+ getDataRowCount() - 1,
+ new RowHeader(colTotalLabel, "45", 1, reportRowHeaderCols.getColumnCount(),
+ true));
+ } // setCrossTabColumnTotalLabel
+
+ public void setCrossTabColumnTotalLabel(int reportDataSize, String colTotalLabel) {
+
+ reportRowHeaderCols.getRowHeaderCol(0).getRowHeader(getDataRowCount() - 1)
+ .setRowTitle("");
+ reportRowHeaderCols.getRowHeaderCol(0).getRowHeader(getDataRowCount() - 1).setColSpan(
+ 0);
+ reportRowHeaderCols.getRowHeaderCol(1).set(
+ getDataRowCount() - 1,
+ new RowHeader(colTotalLabel, "45", 1, reportRowHeaderCols.getColumnCount(),
+ true));
+ } // setCrossTabColumnTotalLabel
+
+ public void setColumnDataTotalsCrossTab(Vector colDataTotals, String totalsAlignment,
+ String colDisplayTotal, CrossTabOrderManager crossTabOrderManager, List dataList) {
+ DataRow totalsDataRow = new DataRow();
+ for (int c = 0; c < getDataColumnCount(); c++)
+ totalsDataRow.addDataValue(new DataValue());
+
+ for (Iterator iter = colDataTotals.iterator(); iter.hasNext();) {
+ CrossTabTotalValue tVal = (CrossTabTotalValue) iter.next();
+
+ int colIdx = findColumnIdx(tVal.getHeaderValues(), null, crossTabOrderManager, false, dataList);
+ if (colIdx >= 0) {
+ DataValue dataValue = new DataValue();
+
+ String totalValue = tVal.getTotalValue();
+ // if(colDisplayTotal.length()>0&&(!
+ // colDisplayTotal.equals(AppConstants.TOTAL_SUM_ID)))
+ // totalValue =
+ // nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(colDisplayTotal))+":
+ // "+totalValue;
+ dataValue.setDisplayValue(totalValue);
+ //added below statement for displaying in excel as number
+ dataValue.setDisplayTotal("SUM(");
+ dataValue.setAlignment(totalsAlignment);
+ dataValue.setBold(true);
+ totalsDataRow.setDataValue(colIdx, dataValue);
+
+ //totalsDataRow.addDataValue(dataValue);
+
+ } // if
+ } // for
+
+ //reportDataRows.addDataRow(totalsDataRow);
+ //dr.setRowValues(rowNameValues);
+ Vector rowNameValues = new Vector();
+ for (int i=0; i < reportRowHeaderCols.size(); i++) {
+ if(i==0) {
+ DataValue dataValue = new DataValue();
+ dataValue.setBold(true);
+ dataValue.setAlignment("center");
+ dataValue.setDisplayValue("Total");
+ rowNameValues.add(dataValue);
+ //rowNameValues.add("Total");
+ } else {
+ //rowNameValues.add("");
+ DataValue dataValue = new DataValue();
+ dataValue.setDisplayValue("");
+ rowNameValues.add(dataValue);
+
+ }
+ }
+ totalsDataRow.setRowValues(rowNameValues);
+ totalsDataRow.setRowNum(dataList.size());
+ dataList.add(totalsDataRow);
+ //reportRowHeaderCols.getNext().addRowHeader(new RowHeader("", "30", 1, 0));
+ } // setColumnDataTotalsCrossTab
+
+ public void setRowDataTotalsCrossTab(Vector rowDataTotals, String totalsAlignment,
+ String rowDisplayTotal, CrossTabOrderManager crossTabOrderManager, List dataList) {
+ int colIdx = getDataColumnCount();
+
+ boolean isFirst = true;
+ for (reportColumnHeaderRows.resetNext(); reportColumnHeaderRows.hasNext();) {
+ ColumnHeaderRow chr = reportColumnHeaderRows.getNext();
+ if (isFirst) {
+ String totalLabel = "Total";
+ if (rowDisplayTotal.length() > 0
+ && (!rowDisplayTotal.equals(AppConstants.TOTAL_SUM_ID)))
+ totalLabel = nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(rowDisplayTotal));
+ chr.addColumnHeader(colIdx, new ColumnHeader(totalLabel, "", 1,
+ reportColumnHeaderRows.getRowCount()));
+ isFirst = false;
+ } else
+ chr.addColumnHeader(colIdx, new ColumnHeader("", "", 1, 0));
+ } // for
+
+ for (reportDataRows.resetNext(); reportDataRows.hasNext();) {
+ DataRow dr = reportDataRows.getNext();
+ dr.addDataValue(colIdx, new DataValue());
+ } // for
+
+ for (Iterator iter = rowDataTotals.iterator(); iter.hasNext();) {
+ CrossTabTotalValue tVal = (CrossTabTotalValue) iter.next();
+
+ int rowIdx = findRowIdx(tVal.getHeaderValues(), crossTabOrderManager, false, dataList);
+ if (rowIdx >= 0) {
+ DataValue dataValue = new DataValue();
+
+ String totalValue = tVal.getTotalValue();
+ // if(rowDisplayTotal.length()>0&&(!
+ // rowDisplayTotal.equals(AppConstants.TOTAL_SUM_ID)))
+ // totalValue =
+ // nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(rowDisplayTotal))+":
+ // "+totalValue;
+ dataValue.setDisplayValue(totalValue);
+ //added below statement for displaying in excel as number
+ dataValue.setDisplayTotal("SUM(");
+ dataValue.setAlignment(totalsAlignment);
+ dataValue.setBold(true);
+
+ //reportDataRows.getDataRow(rowIdx).getDataValueList().add(colIdx, dataValue);
+ ((DataRow)dataList.get(rowIdx)).addDataValue(colIdx, dataValue);
+ } // if
+ } // for
+ } // setRowDataTotalsCrossTab
+
+ public void setGrandTotalCrossTab(String totalValue, String totalAlignment,
+ String displayTotal, List dataList) {
+ DataValue dataValue = new DataValue();
+
+ // if(displayTotal.length()>0&&(!
+ // displayTotal.equals(AppConstants.TOTAL_SUM_ID)))
+ // totalValue =
+ // nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(displayTotal))+":
+ // "+totalValue;
+ dataValue.setDisplayValue(totalValue);
+ //added below statement for displaying in excel as number
+ dataValue.setDisplayTotal("SUM(");
+ dataValue.setAlignment(totalAlignment);
+ dataValue.setBold(true);
+
+ //int colIdx = getDataColumnCount() - 1;
+ int rowIdx = getDataRowCount() - 1;
+ //reportDataRows.getDataRow(rowIdx).getDataValueList().add(colIdx, dataValue);
+ DataRow dr = (DataRow)dataList.get(rowIdx);
+ dr.addDataValue(dr.getDataValueList().size(), dataValue);
+ } // setGrandTotalCrossTab
+
+ public List getReportDataList() {
+ return reportDataList;
+ }
+
+ public void setReportDataList(List reportDataList) {
+ this.reportDataList = reportDataList;
+ }
+
+} // ReportData
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportDataRows.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportDataRows.java
new file mode 100644
index 00000000..e2c9a6e5
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportDataRows.java
@@ -0,0 +1,72 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+import java.util.Vector;
+
+public class ReportDataRows extends Vector {
+ private int nextElemIdx = 0;
+
+ public void resetNext() {
+ resetNext(0);
+ } // resetNext
+
+ public void resetNext(int toPos) {
+ nextElemIdx = toPos;
+ } // resetNext
+
+ public boolean hasNext() {
+ return (nextElemIdx < size());
+ } // hasNext
+
+ public DataRow getNext() {
+ return hasNext() ? getDataRow(nextElemIdx++) : null;
+ } // getNext
+
+ public DataValue getDataValue(int rowIdx, int colIdx) {
+ return getDataRow(rowIdx).getDataValue(colIdx);
+ } // getDataValue
+
+ public DataRow getDataRow(int idx) {
+ return (DataRow) get(idx);
+ } // getDataRow
+
+ public void addDataRow(DataRow dataRow) {
+ add(dataRow);
+ } // addDataRow
+
+ public void addDataRow(int idx, DataRow dataRow) {
+ add(idx, dataRow);
+ } // addDataRow
+
+ public int getRowCount() {
+ return size();
+ } // getRowCount
+
+ public int getColumnCount() {
+ int cSize = 0;
+ if (getRowCount() > 0)
+ cSize = getDataRow(0).getDataValueList().size();
+
+ return cSize;
+ } // getColumnCount
+
+} // ReportDataRows
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportRowHeaderCols.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportRowHeaderCols.java
new file mode 100644
index 00000000..e3e4f817
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportRowHeaderCols.java
@@ -0,0 +1,71 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+import java.util.Vector;
+
+public class ReportRowHeaderCols extends Vector {
+ private int nextElemIdx = 0;
+
+ public void resetNext() {
+ resetNext(0);
+ } // resetNext
+
+ public void resetNext(int toPos) {
+ nextElemIdx = toPos;
+ } // resetNext
+
+ public boolean hasNext() {
+ return (nextElemIdx < size());
+ } // hasNext
+
+ public RowHeaderCol getNext() {
+ return hasNext() ? getRowHeaderCol(nextElemIdx++) : null;
+ } // getNext
+
+ public RowHeader getRowHeader(int colIdx, int rowIdx) {
+ return getRowHeaderCol(colIdx).getRowHeader(rowIdx);
+ } // getRowHeader
+
+ public RowHeaderCol getRowHeaderCol(int idx) {
+ return (RowHeaderCol) get(idx);
+ } // getRowHeaderCol
+
+ public void addRowHeaderCol(RowHeaderCol rowHeaderCol) {
+ add(rowHeaderCol);
+ } // addRowHeaderCol
+
+ public void addRowHeaderCol(int idx, RowHeaderCol rowHeaderCol) {
+ add(idx, rowHeaderCol);
+ } // addRowHeaderCol
+
+ public int getRowCount() {
+ int cSize = 0;
+ if (getColumnCount() > 0)
+ cSize = getRowHeaderCol(0).size();
+
+ return cSize;
+ } // getRowCount
+
+ public int getColumnCount() {
+ return size();
+ } // getColumnCount
+
+} // ReportRowHeaderCols
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeader.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeader.java
new file mode 100644
index 00000000..c4c6b1be
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeader.java
@@ -0,0 +1,119 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+public class RowHeader extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private String rowTitle = "";
+
+ private String rowHeight = "";
+
+ private int rowSpan = 1;
+
+ private int colSpan = 1;
+
+ private boolean bold = false;
+
+ public RowHeader() {
+ super();
+ }
+
+ public RowHeader(String rowTitle) {
+ this();
+ setRowTitle(rowTitle);
+ } // RowHeader
+
+ public RowHeader(String rowTitle, String rowHeight) {
+ this(rowTitle);
+ setRowHeight(rowHeight);
+ } // RowHeader
+
+ public RowHeader(String rowTitle, String rowHeight, int rowSpan) {
+ this(rowTitle, rowHeight);
+ setRowSpan(rowSpan);
+ } // RowHeader
+
+ public RowHeader(String rowTitle, String rowHeight, int rowSpan, int colSpan) {
+ this(rowTitle, rowHeight, rowSpan);
+ setColSpan(colSpan);
+ } // RowHeader
+
+ public RowHeader(String rowTitle, String rowHeight, int rowSpan, int colSpan, boolean bold) {
+ this(rowTitle, rowHeight, rowSpan, colSpan);
+ setBold(bold);
+ } // RowHeader
+
+ public String getRowTitle() {
+ return rowTitle;
+ }
+
+ public String getRowHeight() {
+ return rowHeight;
+ }
+
+ public int getRowSpan() {
+ return rowSpan;
+ }
+
+ public int getColSpan() {
+ return colSpan;
+ }
+
+ public boolean isBold() {
+ return bold;
+ }
+
+ public void setRowTitle(String rowTitle) {
+ this.rowTitle = nvl(rowTitle);
+ }
+
+ public void setRowHeight(String rowHeight) {
+ this.rowHeight = rowHeight;
+ }
+
+ public void setRowSpan(int rowSpan) {
+ this.rowSpan = rowSpan;
+ }
+
+ public void setColSpan(int colSpan) {
+ this.colSpan = colSpan;
+ }
+
+ public void setBold(boolean bold) {
+ this.bold = bold;
+ }
+
+ public String getRowTitleHtml() {
+ return (rowTitle.length() == 0) ? "&nbsp;" : rowTitle;
+ }
+
+ public String getRowHeightHtml() {
+ return (rowHeight.length() == 0) ? "" : (" height=" + rowHeight);
+ }
+
+ public String getRowSpanHtml() {
+ return (rowSpan == 1) ? "" : (" rowspan=" + rowSpan);
+ }
+
+ public String getColSpanHtml() {
+ return (colSpan == 1) ? "" : (" colspan=" + colSpan);
+ }
+
+} // RowHeader
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeaderCol.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeaderCol.java
new file mode 100644
index 00000000..2b405e84
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeaderCol.java
@@ -0,0 +1,156 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.view;
+
+import java.util.Vector;
+
+public class RowHeaderCol extends Vector {
+ private String columnWidth = "";
+
+ private String columnTitle = "";
+
+ private String alignment = "";
+
+ private String displayHeaderAlignment = "";
+
+ private int nextElemIdx = 0;
+
+ private boolean visible = true;
+
+ private String colId = "";
+
+ private String nowrap = "False";
+
+ public void resetNext() {
+ resetNext(0);
+ } // resetNext
+
+ public void resetNext(int toPos) {
+ nextElemIdx = toPos;
+ } // resetNext
+
+ public boolean hasNext() {
+ return (nextElemIdx < size());
+ } // hasNext
+
+ public RowHeader getNext() {
+ return hasNext() ? getRowHeader(nextElemIdx++) : null;
+ } // getNext
+
+ public RowHeader getRowHeader(int idx) {
+ return (RowHeader) get(idx);
+ } // getRowHeader
+
+ public void addRowHeader(RowHeader rowHeader) {
+ add(rowHeader);
+ } // addRowHeader
+
+ public void addRowHeader(int idx, RowHeader rowHeader) {
+ add(idx, rowHeader);
+ } // addRowHeader
+
+ public String getColumnTitle() {
+ return columnTitle;
+ }
+
+ public String getColumnWidth() {
+ return columnWidth;
+ }
+
+ public String getAlignment() {
+ return alignment;
+ }
+
+ public void setColumnTitle(String columnTitle) {
+ this.columnTitle = nvl(columnTitle);
+ }
+
+ public void setColumnWidth(String columnWidth) {
+ this.columnWidth = nvl(columnWidth);
+ }
+
+ public void setAlignment(String alignment) {
+ this.alignment = alignment;
+ }
+
+ public String getColumnTitleHtml() {
+ return (columnTitle.length() == 0) ? "&nbsp;" : columnTitle;
+ }
+
+ public String getColumnWidthHtml() {
+ return (columnWidth.length() == 0) ? "" : (" width=" + columnWidth);
+ }
+
+ public String getAlignmentHtml() {
+ return " align=" + nvl(alignment, "center");
+ }
+
+ /** ************************************************************************************************* */
+
+ private String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ private String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ public String getNowrap() {
+ return nowrap;
+ }
+
+ public void setNowrap(String nowrap) {
+ this.nowrap = nowrap;
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+
+ /**
+ * @return the colId
+ */
+ public String getColId() {
+ return colId;
+ }
+
+ /**
+ * @param colId the colId to set
+ */
+ public void setColId(String colId) {
+ this.colId = colId;
+ }
+
+ public String getDisplayHeaderAlignment() {
+ return displayHeaderAlignment;
+ }
+
+ public void setDisplayHeaderAlignment(String displayHeaderAlignment) {
+ this.displayHeaderAlignment = displayHeaderAlignment;
+ }
+
+
+
+} // RowHeaderCol
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartAdditionalOptions.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartAdditionalOptions.java
new file mode 100644
index 00000000..48ae70a8
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartAdditionalOptions.java
@@ -0,0 +1,1178 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for ChartAdditionalOptions complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="ChartAdditionalOptions">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="chartMultiplePieOrder" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="chartMultiplePieLabelDisplay" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="chartOrientation" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="secondaryChartRenderer" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="chartDisplay" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="hideToolTips" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="hidechartLegend" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="legendPosition" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="labelAngle" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="intervalFromdate" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="intervalTodate" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="intervalLabel" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="lastSeriesALineChart" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="lastSeriesABarChart" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="maxLabelsInDomainAxis" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="linearRegression" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="linearRegressionColor" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="exponentialRegressionColor" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="maxRegression" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="rangeAxisUpperLimit" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="rangeAxisLowerLimit" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="overlayItemValueOnStackBar" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="animate" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="animateAnimatedChart" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="keepDomainAxisValueAsString" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="stacked" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="barControls" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="xAxisDateType" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="lessXaxisTickers" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="timeAxis" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="timeSeriesRender" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="multiSeries" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="showXAxisLabel" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="addXAxisTickers" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="zoomIn" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="timeAxisType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="logScale" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="topMargin" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="bottomMargin" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="rightMargin" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="leftMargin" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ChartAdditionalOptions", propOrder = {
+ "chartMultiplePieOrder",
+ "chartMultiplePieLabelDisplay",
+ "chartOrientation",
+ "secondaryChartRenderer",
+ "chartDisplay",
+ "hideToolTips",
+ "hidechartLegend",
+ "legendPosition",
+ "labelAngle",
+ "intervalFromdate",
+ "intervalTodate",
+ "intervalLabel",
+ "lastSeriesALineChart",
+ "lastSeriesABarChart",
+ "maxLabelsInDomainAxis",
+ "linearRegression",
+ "linearRegressionColor",
+ "exponentialRegressionColor",
+ "maxRegression",
+ "rangeAxisUpperLimit",
+ "rangeAxisLowerLimit",
+ "overlayItemValueOnStackBar",
+ "animate",
+ "animateAnimatedChart",
+ "keepDomainAxisValueAsString",
+ "stacked",
+ "barControls",
+ "xAxisDateType",
+ "lessXaxisTickers",
+ "timeAxis",
+ "timeSeriesRender",
+ "multiSeries",
+ "showXAxisLabel",
+ "addXAxisTickers",
+ "zoomIn",
+ "timeAxisType",
+ "logScale",
+ "topMargin",
+ "bottomMargin",
+ "rightMargin",
+ "leftMargin"
+})
+public class ChartAdditionalOptions {
+
+ protected String chartMultiplePieOrder;
+ protected String chartMultiplePieLabelDisplay;
+ protected String chartOrientation;
+ protected String secondaryChartRenderer;
+ protected String chartDisplay;
+ protected String hideToolTips;
+ protected String hidechartLegend;
+ protected String legendPosition;
+ protected String labelAngle;
+ protected String intervalFromdate;
+ protected String intervalTodate;
+ protected String intervalLabel;
+ protected String lastSeriesALineChart;
+ protected String lastSeriesABarChart;
+ protected String maxLabelsInDomainAxis;
+ protected String linearRegression;
+ protected String linearRegressionColor;
+ protected String exponentialRegressionColor;
+ protected String maxRegression;
+ protected String rangeAxisUpperLimit;
+ protected String rangeAxisLowerLimit;
+ protected String overlayItemValueOnStackBar;
+ @XmlElement(defaultValue = "false")
+ protected Boolean animate;
+ @XmlElement(defaultValue = "true")
+ protected Boolean animateAnimatedChart;
+ protected String keepDomainAxisValueAsString;
+ @XmlElement(defaultValue = "false")
+ protected Boolean stacked;
+ @XmlElement(defaultValue = "false")
+ protected Boolean barControls;
+ @XmlElement(defaultValue = "false")
+ protected Boolean xAxisDateType;
+ @XmlElement(defaultValue = "false")
+ protected Boolean lessXaxisTickers;
+ @XmlElement(defaultValue = "true")
+ protected Boolean timeAxis;
+ protected String timeSeriesRender;
+ @XmlElement(defaultValue = "false")
+ protected Boolean multiSeries;
+ @XmlElement(defaultValue = "false")
+ protected Boolean showXAxisLabel;
+ @XmlElement(defaultValue = "false")
+ protected Boolean addXAxisTickers;
+ protected Integer zoomIn;
+ protected String timeAxisType;
+ @XmlElement(defaultValue = "false")
+ protected Boolean logScale;
+ protected Integer topMargin;
+ protected Integer bottomMargin;
+ protected Integer rightMargin;
+ protected Integer leftMargin;
+
+ /**
+ * Gets the value of the chartMultiplePieOrder property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartMultiplePieOrder() {
+ return chartMultiplePieOrder;
+ }
+
+ /**
+ * Sets the value of the chartMultiplePieOrder property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartMultiplePieOrder(String value) {
+ this.chartMultiplePieOrder = value;
+ }
+
+ /**
+ * Gets the value of the chartMultiplePieLabelDisplay property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartMultiplePieLabelDisplay() {
+ return chartMultiplePieLabelDisplay;
+ }
+
+ /**
+ * Sets the value of the chartMultiplePieLabelDisplay property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartMultiplePieLabelDisplay(String value) {
+ this.chartMultiplePieLabelDisplay = value;
+ }
+
+ /**
+ * Gets the value of the chartOrientation property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartOrientation() {
+ return chartOrientation;
+ }
+
+ /**
+ * Sets the value of the chartOrientation property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartOrientation(String value) {
+ this.chartOrientation = value;
+ }
+
+ /**
+ * Gets the value of the secondaryChartRenderer property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSecondaryChartRenderer() {
+ return secondaryChartRenderer;
+ }
+
+ /**
+ * Sets the value of the secondaryChartRenderer property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSecondaryChartRenderer(String value) {
+ this.secondaryChartRenderer = value;
+ }
+
+ /**
+ * Gets the value of the chartDisplay property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartDisplay() {
+ return chartDisplay;
+ }
+
+ /**
+ * Sets the value of the chartDisplay property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartDisplay(String value) {
+ this.chartDisplay = value;
+ }
+
+ /**
+ * Gets the value of the hideToolTips property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getHideToolTips() {
+ return hideToolTips;
+ }
+
+ /**
+ * Sets the value of the hideToolTips property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setHideToolTips(String value) {
+ this.hideToolTips = value;
+ }
+
+ /**
+ * Gets the value of the hidechartLegend property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getHidechartLegend() {
+ return hidechartLegend;
+ }
+
+ /**
+ * Sets the value of the hidechartLegend property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setHidechartLegend(String value) {
+ this.hidechartLegend = value;
+ }
+
+ /**
+ * Gets the value of the legendPosition property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLegendPosition() {
+ return legendPosition;
+ }
+
+ /**
+ * Sets the value of the legendPosition property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLegendPosition(String value) {
+ this.legendPosition = value;
+ }
+
+ /**
+ * Gets the value of the labelAngle property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLabelAngle() {
+ return labelAngle;
+ }
+
+ /**
+ * Sets the value of the labelAngle property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLabelAngle(String value) {
+ this.labelAngle = value;
+ }
+
+ /**
+ * Gets the value of the intervalFromdate property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIntervalFromdate() {
+ return intervalFromdate;
+ }
+
+ /**
+ * Sets the value of the intervalFromdate property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIntervalFromdate(String value) {
+ this.intervalFromdate = value;
+ }
+
+ /**
+ * Gets the value of the intervalTodate property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIntervalTodate() {
+ return intervalTodate;
+ }
+
+ /**
+ * Sets the value of the intervalTodate property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIntervalTodate(String value) {
+ this.intervalTodate = value;
+ }
+
+ /**
+ * Gets the value of the intervalLabel property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIntervalLabel() {
+ return intervalLabel;
+ }
+
+ /**
+ * Sets the value of the intervalLabel property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIntervalLabel(String value) {
+ this.intervalLabel = value;
+ }
+
+ /**
+ * Gets the value of the lastSeriesALineChart property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLastSeriesALineChart() {
+ return lastSeriesALineChart;
+ }
+
+ /**
+ * Sets the value of the lastSeriesALineChart property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLastSeriesALineChart(String value) {
+ this.lastSeriesALineChart = value;
+ }
+
+ /**
+ * Gets the value of the lastSeriesABarChart property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLastSeriesABarChart() {
+ return lastSeriesABarChart;
+ }
+
+ /**
+ * Sets the value of the lastSeriesABarChart property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLastSeriesABarChart(String value) {
+ this.lastSeriesABarChart = value;
+ }
+
+ /**
+ * Gets the value of the maxLabelsInDomainAxis property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMaxLabelsInDomainAxis() {
+ return maxLabelsInDomainAxis;
+ }
+
+ /**
+ * Sets the value of the maxLabelsInDomainAxis property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMaxLabelsInDomainAxis(String value) {
+ this.maxLabelsInDomainAxis = value;
+ }
+
+ /**
+ * Gets the value of the linearRegression property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLinearRegression() {
+ return linearRegression;
+ }
+
+ /**
+ * Sets the value of the linearRegression property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLinearRegression(String value) {
+ this.linearRegression = value;
+ }
+
+ /**
+ * Gets the value of the linearRegressionColor property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLinearRegressionColor() {
+ return linearRegressionColor;
+ }
+
+ /**
+ * Sets the value of the linearRegressionColor property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLinearRegressionColor(String value) {
+ this.linearRegressionColor = value;
+ }
+
+ /**
+ * Gets the value of the exponentialRegressionColor property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getExponentialRegressionColor() {
+ return exponentialRegressionColor;
+ }
+
+ /**
+ * Sets the value of the exponentialRegressionColor property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setExponentialRegressionColor(String value) {
+ this.exponentialRegressionColor = value;
+ }
+
+ /**
+ * Gets the value of the maxRegression property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMaxRegression() {
+ return maxRegression;
+ }
+
+ /**
+ * Sets the value of the maxRegression property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMaxRegression(String value) {
+ this.maxRegression = value;
+ }
+
+ /**
+ * Gets the value of the rangeAxisUpperLimit property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRangeAxisUpperLimit() {
+ return rangeAxisUpperLimit;
+ }
+
+ /**
+ * Sets the value of the rangeAxisUpperLimit property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRangeAxisUpperLimit(String value) {
+ this.rangeAxisUpperLimit = value;
+ }
+
+ /**
+ * Gets the value of the rangeAxisLowerLimit property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRangeAxisLowerLimit() {
+ return rangeAxisLowerLimit;
+ }
+
+ /**
+ * Sets the value of the rangeAxisLowerLimit property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRangeAxisLowerLimit(String value) {
+ this.rangeAxisLowerLimit = value;
+ }
+
+ /**
+ * Gets the value of the overlayItemValueOnStackBar property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getOverlayItemValueOnStackBar() {
+ return overlayItemValueOnStackBar;
+ }
+
+ /**
+ * Sets the value of the overlayItemValueOnStackBar property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setOverlayItemValueOnStackBar(String value) {
+ this.overlayItemValueOnStackBar = value;
+ }
+
+ /**
+ * Gets the value of the animate property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isAnimate() {
+ return animate;
+ }
+
+ /**
+ * Sets the value of the animate property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setAnimate(Boolean value) {
+ this.animate = value;
+ }
+
+ /**
+ * Gets the value of the animateAnimatedChart property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isAnimateAnimatedChart() {
+ return animateAnimatedChart;
+ }
+
+ /**
+ * Sets the value of the animateAnimatedChart property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setAnimateAnimatedChart(Boolean value) {
+ this.animateAnimatedChart = value;
+ }
+
+ /**
+ * Gets the value of the keepDomainAxisValueAsString property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getKeepDomainAxisValueAsString() {
+ return keepDomainAxisValueAsString;
+ }
+
+ /**
+ * Sets the value of the keepDomainAxisValueAsString property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setKeepDomainAxisValueAsString(String value) {
+ this.keepDomainAxisValueAsString = value;
+ }
+
+ /**
+ * Gets the value of the stacked property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isStacked() {
+ return stacked;
+ }
+
+ /**
+ * Sets the value of the stacked property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setStacked(Boolean value) {
+ this.stacked = value;
+ }
+
+ /**
+ * Gets the value of the barControls property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isBarControls() {
+ return barControls;
+ }
+
+ /**
+ * Sets the value of the barControls property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setBarControls(Boolean value) {
+ this.barControls = value;
+ }
+
+ /**
+ * Gets the value of the xAxisDateType property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isXAxisDateType() {
+ return xAxisDateType;
+ }
+
+ /**
+ * Sets the value of the xAxisDateType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setXAxisDateType(Boolean value) {
+ this.xAxisDateType = value;
+ }
+
+ /**
+ * Gets the value of the lessXaxisTickers property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isLessXaxisTickers() {
+ return lessXaxisTickers;
+ }
+
+ /**
+ * Sets the value of the lessXaxisTickers property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setLessXaxisTickers(Boolean value) {
+ this.lessXaxisTickers = value;
+ }
+
+ /**
+ * Gets the value of the timeAxis property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isTimeAxis() {
+ return timeAxis;
+ }
+
+ /**
+ * Sets the value of the timeAxis property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setTimeAxis(Boolean value) {
+ this.timeAxis = value;
+ }
+
+ /**
+ * Gets the value of the timeSeriesRender property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTimeSeriesRender() {
+ return timeSeriesRender;
+ }
+
+ /**
+ * Sets the value of the timeSeriesRender property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTimeSeriesRender(String value) {
+ this.timeSeriesRender = value;
+ }
+
+ /**
+ * Gets the value of the multiSeries property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isMultiSeries() {
+ return multiSeries;
+ }
+
+ /**
+ * Sets the value of the multiSeries property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setMultiSeries(Boolean value) {
+ this.multiSeries = value;
+ }
+
+ /**
+ * Gets the value of the showXAxisLabel property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isShowXAxisLabel() {
+ return showXAxisLabel;
+ }
+
+ /**
+ * Sets the value of the showXAxisLabel property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setShowXAxisLabel(Boolean value) {
+ this.showXAxisLabel = value;
+ }
+
+ /**
+ * Gets the value of the addXAxisTickers property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isAddXAxisTickers() {
+ return addXAxisTickers;
+ }
+
+ /**
+ * Sets the value of the addXAxisTickers property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setAddXAxisTickers(Boolean value) {
+ this.addXAxisTickers = value;
+ }
+
+ /**
+ * Gets the value of the zoomIn property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getZoomIn() {
+ return zoomIn;
+ }
+
+ /**
+ * Sets the value of the zoomIn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setZoomIn(Integer value) {
+ this.zoomIn = value;
+ }
+
+ /**
+ * Gets the value of the timeAxisType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTimeAxisType() {
+ return timeAxisType;
+ }
+
+ /**
+ * Sets the value of the timeAxisType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTimeAxisType(String value) {
+ this.timeAxisType = value;
+ }
+
+ /**
+ * Gets the value of the logScale property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isLogScale() {
+ return logScale;
+ }
+
+ /**
+ * Sets the value of the logScale property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setLogScale(Boolean value) {
+ this.logScale = value;
+ }
+
+ /**
+ * Gets the value of the topMargin property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getTopMargin() {
+ return topMargin;
+ }
+
+ /**
+ * Sets the value of the topMargin property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setTopMargin(Integer value) {
+ this.topMargin = value;
+ }
+
+ /**
+ * Gets the value of the bottomMargin property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getBottomMargin() {
+ return bottomMargin;
+ }
+
+ /**
+ * Sets the value of the bottomMargin property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setBottomMargin(Integer value) {
+ this.bottomMargin = value;
+ }
+
+ /**
+ * Gets the value of the rightMargin property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getRightMargin() {
+ return rightMargin;
+ }
+
+ /**
+ * Sets the value of the rightMargin property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setRightMargin(Integer value) {
+ this.rightMargin = value;
+ }
+
+ /**
+ * Gets the value of the leftMargin property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getLeftMargin() {
+ return leftMargin;
+ }
+
+ /**
+ * Sets the value of the leftMargin property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setLeftMargin(Integer value) {
+ this.leftMargin = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartDrillFormfield.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartDrillFormfield.java
new file mode 100644
index 00000000..f097f3fa
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartDrillFormfield.java
@@ -0,0 +1,86 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for ChartDrillFormfield complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="ChartDrillFormfield">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="formfield" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ChartDrillFormfield", propOrder = {
+ "formfield"
+})
+public class ChartDrillFormfield {
+
+ protected String formfield;
+
+ /**
+ * Gets the value of the formfield property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFormfield() {
+ return formfield;
+ }
+
+ /**
+ * Sets the value of the formfield property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFormfield(String value) {
+ this.formfield = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartDrillOptions.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartDrillOptions.java
new file mode 100644
index 00000000..3fc3eec3
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartDrillOptions.java
@@ -0,0 +1,207 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for ChartDrillOptions complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="ChartDrillOptions">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="drill_reportId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="drill_xAxis_FormField" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="drill_yAxis_FormField" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="drill_series_FormField" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="targetFormfield" type="{}ChartDrillFormfield" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ChartDrillOptions", propOrder = {
+ "drillReportId",
+ "drillXAxisFormField",
+ "drillYAxisFormField",
+ "drillSeriesFormField",
+ "targetFormfield"
+})
+public class ChartDrillOptions {
+
+ @XmlElement(name = "drill_reportId")
+ protected String drillReportId;
+ @XmlElement(name = "drill_xAxis_FormField")
+ protected String drillXAxisFormField;
+ @XmlElement(name = "drill_yAxis_FormField")
+ protected String drillYAxisFormField;
+ @XmlElement(name = "drill_series_FormField")
+ protected String drillSeriesFormField;
+ protected List<ChartDrillFormfield> targetFormfield;
+
+ /**
+ * Gets the value of the drillReportId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDrillReportId() {
+ return drillReportId;
+ }
+
+ /**
+ * Sets the value of the drillReportId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDrillReportId(String value) {
+ this.drillReportId = value;
+ }
+
+ /**
+ * Gets the value of the drillXAxisFormField property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDrillXAxisFormField() {
+ return drillXAxisFormField;
+ }
+
+ /**
+ * Sets the value of the drillXAxisFormField property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDrillXAxisFormField(String value) {
+ this.drillXAxisFormField = value;
+ }
+
+ /**
+ * Gets the value of the drillYAxisFormField property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDrillYAxisFormField() {
+ return drillYAxisFormField;
+ }
+
+ /**
+ * Sets the value of the drillYAxisFormField property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDrillYAxisFormField(String value) {
+ this.drillYAxisFormField = value;
+ }
+
+ /**
+ * Gets the value of the drillSeriesFormField property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDrillSeriesFormField() {
+ return drillSeriesFormField;
+ }
+
+ /**
+ * Sets the value of the drillSeriesFormField property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDrillSeriesFormField(String value) {
+ this.drillSeriesFormField = value;
+ }
+
+ /**
+ * Gets the value of the targetFormfield property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the targetFormfield property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getTargetFormfield().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link ChartDrillFormfield }
+ *
+ *
+ */
+ public List<ChartDrillFormfield> getTargetFormfield() {
+ if (targetFormfield == null) {
+ targetFormfield = new ArrayList<ChartDrillFormfield>();
+ }
+ return this.targetFormfield;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ColFilterList.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ColFilterList.java
new file mode 100644
index 00000000..a429ae99
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ColFilterList.java
@@ -0,0 +1,94 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for ColFilterList complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="ColFilterList">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="colFilter" type="{}ColFilterType" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ColFilterList", propOrder = {
+ "colFilter"
+})
+public class ColFilterList {
+
+ protected List<ColFilterType> colFilter;
+
+ /**
+ * Gets the value of the colFilter property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the colFilter property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getColFilter().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link ColFilterType }
+ *
+ *
+ */
+ public List<ColFilterType> getColFilter() {
+ if (colFilter == null) {
+ colFilter = new ArrayList<ColFilterType>();
+ }
+ return this.colFilter;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ColFilterType.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ColFilterType.java
new file mode 100644
index 00000000..4ba660ed
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ColFilterType.java
@@ -0,0 +1,298 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for ColFilterType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="ColFilterType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="colId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="filterSeq" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ * &lt;element name="joinCondition" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="openBrackets" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="expression" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="argType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="argValue" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="closeBrackets" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element ref="{}comment" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ColFilterType", propOrder = {
+ "colId",
+ "filterSeq",
+ "joinCondition",
+ "openBrackets",
+ "expression",
+ "argType",
+ "argValue",
+ "closeBrackets",
+ "comment"
+})
+public class ColFilterType {
+
+ @XmlElement(required = true)
+ protected String colId;
+ protected int filterSeq;
+ @XmlElement(required = true)
+ protected String joinCondition;
+ protected String openBrackets;
+ @XmlElement(required = true)
+ protected String expression;
+ protected String argType;
+ protected String argValue;
+ protected String closeBrackets;
+ protected String comment;
+
+ /**
+ * Gets the value of the colId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getColId() {
+ return colId;
+ }
+
+ /**
+ * Sets the value of the colId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setColId(String value) {
+ this.colId = value;
+ }
+
+ /**
+ * Gets the value of the filterSeq property.
+ *
+ */
+ public int getFilterSeq() {
+ return filterSeq;
+ }
+
+ /**
+ * Sets the value of the filterSeq property.
+ *
+ */
+ public void setFilterSeq(int value) {
+ this.filterSeq = value;
+ }
+
+ /**
+ * Gets the value of the joinCondition property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getJoinCondition() {
+ return joinCondition;
+ }
+
+ /**
+ * Sets the value of the joinCondition property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setJoinCondition(String value) {
+ this.joinCondition = value;
+ }
+
+ /**
+ * Gets the value of the openBrackets property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getOpenBrackets() {
+ return openBrackets;
+ }
+
+ /**
+ * Sets the value of the openBrackets property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setOpenBrackets(String value) {
+ this.openBrackets = value;
+ }
+
+ /**
+ * Gets the value of the expression property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getExpression() {
+ return expression;
+ }
+
+ /**
+ * Sets the value of the expression property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setExpression(String value) {
+ this.expression = value;
+ }
+
+ /**
+ * Gets the value of the argType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getArgType() {
+ return argType;
+ }
+
+ /**
+ * Sets the value of the argType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setArgType(String value) {
+ this.argType = value;
+ }
+
+ /**
+ * Gets the value of the argValue property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getArgValue() {
+ return argValue;
+ }
+
+ /**
+ * Sets the value of the argValue property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setArgValue(String value) {
+ this.argValue = value;
+ }
+
+ /**
+ * Gets the value of the closeBrackets property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCloseBrackets() {
+ return closeBrackets;
+ }
+
+ /**
+ * Sets the value of the closeBrackets property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCloseBrackets(String value) {
+ this.closeBrackets = value;
+ }
+
+ /**
+ * Gets the value of the comment property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ /**
+ * Sets the value of the comment property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setComment(String value) {
+ this.comment = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/CustomReportType.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/CustomReportType.java
new file mode 100644
index 00000000..58c7e30d
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/CustomReportType.java
@@ -0,0 +1,2011 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+
+/**
+ * <p>Java class for CustomReportType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="CustomReportType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="reportName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="reportDescr" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="numDashCols" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="dashboardLayoutHTML" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="dbInfo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="dbType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="chartType" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="chartTypeFixed" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="chartMultiSeries" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="chartLeftAxisLabel" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="chartRightAxisLabel" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="chartWidth" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="chartHeight" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="showChartTitle" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="public" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="hideFormFieldAfterRun" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="createId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="createDate" type="{http://www.w3.org/2001/XMLSchema}date"/>
+ * &lt;element name="reportSQL" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="reportTitle" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="reportSubTitle" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="reportHeader" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="frozenColumns" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="pdfImgLogo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="emptyMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="widthNoColumn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="dataGridAlign" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="reportFooter" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="numFormCols" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="displayOptions" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="jumpTo" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="searchPageSize" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="navPosition" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="toggleLayout" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="pageNav" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="showPageSize" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="showNavPos" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="showGotoOption" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="dataContainerHeight" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="dataContainerWidth" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="allowSchedule" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="multiGroupColumn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="topDown" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="sizedByContent" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element ref="{}comment" minOccurs="0"/>
+ * &lt;element name="dataSourceList" type="{}DataSourceList" minOccurs="0"/>
+ * &lt;element name="formFieldList" type="{}FormFieldList" minOccurs="0"/>
+ * &lt;element name="javascriptList" type="{}JavascriptList" minOccurs="0"/>
+ * &lt;element name="semaphoreList" type="{}SemaphoreList" minOccurs="0"/>
+ * &lt;element name="dashboardOptions" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="dashboardType" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="reportInNewWindow" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="displayFolderTree" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="maxRowsInExcelDownload" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="dashBoardReports" type="{}DashboardReports" minOccurs="0"/>
+ * &lt;element name="dashBoardReportsNew" type="{}DashboardReportsNew" minOccurs="0"/>
+ * &lt;element name="chartAdditionalOptions" type="{}ChartAdditionalOptions" minOccurs="0"/>
+ * &lt;element name="pdfAdditionalOptions" type="{}PDFAdditionalOptions" minOccurs="0"/>
+ * &lt;element name="chartDrillOptions" type="{}ChartDrillOptions" minOccurs="0"/>
+ * &lt;element name="dataminingOptions" type="{}DataminingOptions" minOccurs="0"/>
+ * &lt;element name="javascriptElement" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="folderId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="drillURLInPoPUpPresent" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="isOneTimeScheduleAllowed" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="isHourlyScheduleAllowed" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="isDailyScheduleAllowed" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="isDailyMFScheduleAllowed" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="isWeeklyScheduleAllowed" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="isMonthlyScheduleAllowed" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="reportMap" type="{}ReportMap" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;attribute name="pageSize" type="{http://www.w3.org/2001/XMLSchema}int" />
+ * &lt;attribute name="reportType" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "CustomReportType", propOrder = {
+ "reportName",
+ "reportDescr",
+ "numDashCols",
+ "dashboardLayoutHTML",
+ "dbInfo",
+ "dbType",
+ "chartType",
+ "chartTypeFixed",
+ "chartMultiSeries",
+ "chartLeftAxisLabel",
+ "chartRightAxisLabel",
+ "chartWidth",
+ "chartHeight",
+ "showChartTitle",
+ "_public",
+ "hideFormFieldAfterRun",
+ "createId",
+ "createDate",
+ "reportSQL",
+ "reportTitle",
+ "reportSubTitle",
+ "reportHeader",
+ "frozenColumns",
+ "pdfImgLogo",
+ "emptyMessage",
+ "widthNoColumn",
+ "dataGridAlign",
+ "reportFooter",
+ "numFormCols",
+ "displayOptions",
+ "jumpTo",
+ "searchPageSize",
+ "navPosition",
+ "toggleLayout",
+ "pageNav",
+ "showPageSize",
+ "showNavPos",
+ "showGotoOption",
+ "dataContainerHeight",
+ "dataContainerWidth",
+ "allowSchedule",
+ "multiGroupColumn",
+ "topDown",
+ "sizedByContent",
+ "comment",
+ "dataSourceList",
+ "formFieldList",
+ "javascriptList",
+ "semaphoreList",
+ "dashboardOptions",
+ "dashboardType",
+ "reportInNewWindow",
+ "displayFolderTree",
+ "maxRowsInExcelDownload",
+ "dashBoardReports",
+ "dashBoardReportsNew",
+ "chartAdditionalOptions",
+ "pdfAdditionalOptions",
+ "chartDrillOptions",
+ "dataminingOptions",
+ "javascriptElement",
+ "folderId",
+ "drillURLInPoPUpPresent",
+ "isOneTimeScheduleAllowed",
+ "isHourlyScheduleAllowed",
+ "isDailyScheduleAllowed",
+ "isDailyMFScheduleAllowed",
+ "isWeeklyScheduleAllowed",
+ "isMonthlyScheduleAllowed",
+ "reportMap"
+})
+public class CustomReportType {
+
+ @XmlElement(required = true)
+ protected String reportName;
+ @XmlElement(required = true)
+ protected String reportDescr;
+ protected String numDashCols;
+ protected String dashboardLayoutHTML;
+ protected String dbInfo;
+ protected String dbType;
+ @XmlElement(required = true)
+ protected String chartType;
+ protected String chartTypeFixed;
+ protected String chartMultiSeries;
+ protected String chartLeftAxisLabel;
+ protected String chartRightAxisLabel;
+ protected String chartWidth;
+ protected String chartHeight;
+ @XmlElement(defaultValue = "false")
+ protected boolean showChartTitle;
+ @XmlElement(name = "public", defaultValue = "false")
+ protected boolean _public;
+ @XmlElement(defaultValue = "false")
+ protected Boolean hideFormFieldAfterRun;
+ @XmlElement(required = true)
+ protected String createId;
+ @XmlElement(required = true)
+ @XmlSchemaType(name = "date")
+ protected XMLGregorianCalendar createDate;
+ protected String reportSQL;
+ protected String reportTitle;
+ protected String reportSubTitle;
+ protected String reportHeader;
+ @XmlElement(defaultValue = "0")
+ protected Integer frozenColumns;
+ protected String pdfImgLogo;
+ protected String emptyMessage;
+ protected String widthNoColumn;
+ protected String dataGridAlign;
+ protected String reportFooter;
+ protected String numFormCols;
+ protected String displayOptions;
+ protected Integer jumpTo;
+ protected Integer searchPageSize;
+ protected String navPosition;
+ @XmlElement(defaultValue = "true")
+ protected Boolean toggleLayout;
+ @XmlElement(defaultValue = "true")
+ protected Boolean pageNav;
+ @XmlElement(defaultValue = "true")
+ protected Boolean showPageSize;
+ @XmlElement(defaultValue = "true")
+ protected Boolean showNavPos;
+ @XmlElement(defaultValue = "true")
+ protected Boolean showGotoOption;
+ protected String dataContainerHeight;
+ protected String dataContainerWidth;
+ protected String allowSchedule;
+ protected String multiGroupColumn;
+ protected String topDown;
+ protected String sizedByContent;
+ protected String comment;
+ protected DataSourceList dataSourceList;
+ protected FormFieldList formFieldList;
+ protected JavascriptList javascriptList;
+ protected SemaphoreList semaphoreList;
+ protected String dashboardOptions;
+ @XmlElement(defaultValue = "false")
+ protected Boolean dashboardType;
+ @XmlElement(defaultValue = "false")
+ protected Boolean reportInNewWindow;
+ @XmlElement(defaultValue = "false")
+ protected Boolean displayFolderTree;
+ protected Integer maxRowsInExcelDownload;
+ protected DashboardReports dashBoardReports;
+ protected DashboardReportsNew dashBoardReportsNew;
+ protected ChartAdditionalOptions chartAdditionalOptions;
+ protected PDFAdditionalOptions pdfAdditionalOptions;
+ protected ChartDrillOptions chartDrillOptions;
+ protected DataminingOptions dataminingOptions;
+ protected String javascriptElement;
+ @XmlElement(defaultValue = "0")
+ protected String folderId;
+ @XmlElement(defaultValue = "false")
+ protected Boolean drillURLInPoPUpPresent;
+ protected String isOneTimeScheduleAllowed;
+ protected String isHourlyScheduleAllowed;
+ protected String isDailyScheduleAllowed;
+ protected String isDailyMFScheduleAllowed;
+ protected String isWeeklyScheduleAllowed;
+ protected String isMonthlyScheduleAllowed;
+ protected ReportMap reportMap;
+ @XmlAttribute(name = "pageSize")
+ protected Integer pageSize;
+ @XmlAttribute(name = "reportType")
+ protected String reportType;
+
+ /**
+ * Gets the value of the reportName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getReportName() {
+ return reportName;
+ }
+
+ /**
+ * Sets the value of the reportName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setReportName(String value) {
+ this.reportName = value;
+ }
+
+ /**
+ * Gets the value of the reportDescr property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getReportDescr() {
+ return reportDescr;
+ }
+
+ /**
+ * Sets the value of the reportDescr property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setReportDescr(String value) {
+ this.reportDescr = value;
+ }
+
+ /**
+ * Gets the value of the numDashCols property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getNumDashCols() {
+ return numDashCols;
+ }
+
+ /**
+ * Sets the value of the numDashCols property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setNumDashCols(String value) {
+ this.numDashCols = value;
+ }
+
+ /**
+ * Gets the value of the dashboardLayoutHTML property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDashboardLayoutHTML() {
+ return dashboardLayoutHTML;
+ }
+
+ /**
+ * Sets the value of the dashboardLayoutHTML property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDashboardLayoutHTML(String value) {
+ this.dashboardLayoutHTML = value;
+ }
+
+ /**
+ * Gets the value of the dbInfo property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDbInfo() {
+ return dbInfo;
+ }
+
+ /**
+ * Sets the value of the dbInfo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDbInfo(String value) {
+ this.dbInfo = value;
+ }
+
+ /**
+ * Gets the value of the dbType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDbType() {
+ return dbType;
+ }
+
+ /**
+ * Sets the value of the dbType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDbType(String value) {
+ this.dbType = value;
+ }
+
+ /**
+ * Gets the value of the chartType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartType() {
+ return chartType;
+ }
+
+ /**
+ * Sets the value of the chartType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartType(String value) {
+ this.chartType = value;
+ }
+
+ /**
+ * Gets the value of the chartTypeFixed property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartTypeFixed() {
+ return chartTypeFixed;
+ }
+
+ /**
+ * Sets the value of the chartTypeFixed property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartTypeFixed(String value) {
+ this.chartTypeFixed = value;
+ }
+
+ /**
+ * Gets the value of the chartMultiSeries property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartMultiSeries() {
+ return chartMultiSeries;
+ }
+
+ /**
+ * Sets the value of the chartMultiSeries property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartMultiSeries(String value) {
+ this.chartMultiSeries = value;
+ }
+
+ /**
+ * Gets the value of the chartLeftAxisLabel property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartLeftAxisLabel() {
+ return chartLeftAxisLabel;
+ }
+
+ /**
+ * Sets the value of the chartLeftAxisLabel property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartLeftAxisLabel(String value) {
+ this.chartLeftAxisLabel = value;
+ }
+
+ /**
+ * Gets the value of the chartRightAxisLabel property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartRightAxisLabel() {
+ return chartRightAxisLabel;
+ }
+
+ /**
+ * Sets the value of the chartRightAxisLabel property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartRightAxisLabel(String value) {
+ this.chartRightAxisLabel = value;
+ }
+
+ /**
+ * Gets the value of the chartWidth property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartWidth() {
+ return chartWidth;
+ }
+
+ /**
+ * Sets the value of the chartWidth property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartWidth(String value) {
+ this.chartWidth = value;
+ }
+
+ /**
+ * Gets the value of the chartHeight property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartHeight() {
+ return chartHeight;
+ }
+
+ /**
+ * Sets the value of the chartHeight property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartHeight(String value) {
+ this.chartHeight = value;
+ }
+
+ /**
+ * Gets the value of the showChartTitle property.
+ *
+ */
+ public boolean isShowChartTitle() {
+ return showChartTitle;
+ }
+
+ /**
+ * Sets the value of the showChartTitle property.
+ *
+ */
+ public void setShowChartTitle(boolean value) {
+ this.showChartTitle = value;
+ }
+
+ /**
+ * Gets the value of the public property.
+ *
+ */
+ public boolean isPublic() {
+ return _public;
+ }
+
+ /**
+ * Sets the value of the public property.
+ *
+ */
+ public void setPublic(boolean value) {
+ this._public = value;
+ }
+
+ /**
+ * Gets the value of the hideFormFieldAfterRun property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isHideFormFieldAfterRun() {
+ return hideFormFieldAfterRun;
+ }
+
+ /**
+ * Sets the value of the hideFormFieldAfterRun property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setHideFormFieldAfterRun(Boolean value) {
+ this.hideFormFieldAfterRun = value;
+ }
+
+ /**
+ * Gets the value of the createId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCreateId() {
+ return createId;
+ }
+
+ /**
+ * Sets the value of the createId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCreateId(String value) {
+ this.createId = value;
+ }
+
+ /**
+ * Gets the value of the createDate property.
+ *
+ * @return
+ * possible object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public XMLGregorianCalendar getCreateDate() {
+ return createDate;
+ }
+
+ /**
+ * Sets the value of the createDate property.
+ *
+ * @param value
+ * allowed object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public void setCreateDate(XMLGregorianCalendar value) {
+ this.createDate = value;
+ }
+
+ /**
+ * Gets the value of the reportSQL property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getReportSQL() {
+ return reportSQL;
+ }
+
+ /**
+ * Sets the value of the reportSQL property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setReportSQL(String value) {
+ this.reportSQL = value;
+ }
+
+ /**
+ * Gets the value of the reportTitle property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getReportTitle() {
+ return reportTitle;
+ }
+
+ /**
+ * Sets the value of the reportTitle property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setReportTitle(String value) {
+ this.reportTitle = value;
+ }
+
+ /**
+ * Gets the value of the reportSubTitle property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getReportSubTitle() {
+ return reportSubTitle;
+ }
+
+ /**
+ * Sets the value of the reportSubTitle property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setReportSubTitle(String value) {
+ this.reportSubTitle = value;
+ }
+
+ /**
+ * Gets the value of the reportHeader property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getReportHeader() {
+ return reportHeader;
+ }
+
+ /**
+ * Sets the value of the reportHeader property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setReportHeader(String value) {
+ this.reportHeader = value;
+ }
+
+ /**
+ * Gets the value of the frozenColumns property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getFrozenColumns() {
+ return frozenColumns;
+ }
+
+ /**
+ * Sets the value of the frozenColumns property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setFrozenColumns(Integer value) {
+ this.frozenColumns = value;
+ }
+
+ /**
+ * Gets the value of the pdfImgLogo property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPdfImgLogo() {
+ return pdfImgLogo;
+ }
+
+ /**
+ * Sets the value of the pdfImgLogo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPdfImgLogo(String value) {
+ this.pdfImgLogo = value;
+ }
+
+ /**
+ * Gets the value of the emptyMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getEmptyMessage() {
+ return emptyMessage;
+ }
+
+ /**
+ * Sets the value of the emptyMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setEmptyMessage(String value) {
+ this.emptyMessage = value;
+ }
+
+ /**
+ * Gets the value of the widthNoColumn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getWidthNoColumn() {
+ return widthNoColumn;
+ }
+
+ /**
+ * Sets the value of the widthNoColumn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setWidthNoColumn(String value) {
+ this.widthNoColumn = value;
+ }
+
+ /**
+ * Gets the value of the dataGridAlign property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDataGridAlign() {
+ return dataGridAlign;
+ }
+
+ /**
+ * Sets the value of the dataGridAlign property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDataGridAlign(String value) {
+ this.dataGridAlign = value;
+ }
+
+ /**
+ * Gets the value of the reportFooter property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getReportFooter() {
+ return reportFooter;
+ }
+
+ /**
+ * Sets the value of the reportFooter property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setReportFooter(String value) {
+ this.reportFooter = value;
+ }
+
+ /**
+ * Gets the value of the numFormCols property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getNumFormCols() {
+ return numFormCols;
+ }
+
+ /**
+ * Sets the value of the numFormCols property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setNumFormCols(String value) {
+ this.numFormCols = value;
+ }
+
+ /**
+ * Gets the value of the displayOptions property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDisplayOptions() {
+ return displayOptions;
+ }
+
+ /**
+ * Sets the value of the displayOptions property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDisplayOptions(String value) {
+ this.displayOptions = value;
+ }
+
+ /**
+ * Gets the value of the jumpTo property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getJumpTo() {
+ return jumpTo;
+ }
+
+ /**
+ * Sets the value of the jumpTo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setJumpTo(Integer value) {
+ this.jumpTo = value;
+ }
+
+ /**
+ * Gets the value of the searchPageSize property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getSearchPageSize() {
+ return searchPageSize;
+ }
+
+ /**
+ * Sets the value of the searchPageSize property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setSearchPageSize(Integer value) {
+ this.searchPageSize = value;
+ }
+
+ /**
+ * Gets the value of the navPosition property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getNavPosition() {
+ return navPosition;
+ }
+
+ /**
+ * Sets the value of the navPosition property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setNavPosition(String value) {
+ this.navPosition = value;
+ }
+
+ /**
+ * Gets the value of the toggleLayout property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isToggleLayout() {
+ return toggleLayout;
+ }
+
+ /**
+ * Sets the value of the toggleLayout property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setToggleLayout(Boolean value) {
+ this.toggleLayout = value;
+ }
+
+ /**
+ * Gets the value of the pageNav property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isPageNav() {
+ return pageNav;
+ }
+
+ /**
+ * Sets the value of the pageNav property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setPageNav(Boolean value) {
+ this.pageNav = value;
+ }
+
+ /**
+ * Gets the value of the showPageSize property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isShowPageSize() {
+ return showPageSize;
+ }
+
+ /**
+ * Sets the value of the showPageSize property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setShowPageSize(Boolean value) {
+ this.showPageSize = value;
+ }
+
+ /**
+ * Gets the value of the showNavPos property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isShowNavPos() {
+ return showNavPos;
+ }
+
+ /**
+ * Sets the value of the showNavPos property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setShowNavPos(Boolean value) {
+ this.showNavPos = value;
+ }
+
+ /**
+ * Gets the value of the showGotoOption property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isShowGotoOption() {
+ return showGotoOption;
+ }
+
+ /**
+ * Sets the value of the showGotoOption property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setShowGotoOption(Boolean value) {
+ this.showGotoOption = value;
+ }
+
+ /**
+ * Gets the value of the dataContainerHeight property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDataContainerHeight() {
+ return dataContainerHeight;
+ }
+
+ /**
+ * Sets the value of the dataContainerHeight property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDataContainerHeight(String value) {
+ this.dataContainerHeight = value;
+ }
+
+ /**
+ * Gets the value of the dataContainerWidth property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDataContainerWidth() {
+ return dataContainerWidth;
+ }
+
+ /**
+ * Sets the value of the dataContainerWidth property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDataContainerWidth(String value) {
+ this.dataContainerWidth = value;
+ }
+
+ /**
+ * Gets the value of the allowSchedule property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAllowSchedule() {
+ return allowSchedule;
+ }
+
+ /**
+ * Sets the value of the allowSchedule property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAllowSchedule(String value) {
+ this.allowSchedule = value;
+ }
+
+ /**
+ * Gets the value of the multiGroupColumn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMultiGroupColumn() {
+ return multiGroupColumn;
+ }
+
+ /**
+ * Sets the value of the multiGroupColumn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMultiGroupColumn(String value) {
+ this.multiGroupColumn = value;
+ }
+
+ /**
+ * Gets the value of the topDown property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTopDown() {
+ return topDown;
+ }
+
+ /**
+ * Sets the value of the topDown property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTopDown(String value) {
+ this.topDown = value;
+ }
+
+ /**
+ * Gets the value of the sizedByContent property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSizedByContent() {
+ return sizedByContent;
+ }
+
+ /**
+ * Sets the value of the sizedByContent property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSizedByContent(String value) {
+ this.sizedByContent = value;
+ }
+
+ /**
+ * Gets the value of the comment property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ /**
+ * Sets the value of the comment property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setComment(String value) {
+ this.comment = value;
+ }
+
+ /**
+ * Gets the value of the dataSourceList property.
+ *
+ * @return
+ * possible object is
+ * {@link DataSourceList }
+ *
+ */
+ public DataSourceList getDataSourceList() {
+ return dataSourceList;
+ }
+
+ /**
+ * Sets the value of the dataSourceList property.
+ *
+ * @param value
+ * allowed object is
+ * {@link DataSourceList }
+ *
+ */
+ public void setDataSourceList(DataSourceList value) {
+ this.dataSourceList = value;
+ }
+
+ /**
+ * Gets the value of the formFieldList property.
+ *
+ * @return
+ * possible object is
+ * {@link FormFieldList }
+ *
+ */
+ public FormFieldList getFormFieldList() {
+ return formFieldList;
+ }
+
+ /**
+ * Sets the value of the formFieldList property.
+ *
+ * @param value
+ * allowed object is
+ * {@link FormFieldList }
+ *
+ */
+ public void setFormFieldList(FormFieldList value) {
+ this.formFieldList = value;
+ }
+
+ /**
+ * Gets the value of the javascriptList property.
+ *
+ * @return
+ * possible object is
+ * {@link JavascriptList }
+ *
+ */
+ public JavascriptList getJavascriptList() {
+ return javascriptList;
+ }
+
+ /**
+ * Sets the value of the javascriptList property.
+ *
+ * @param value
+ * allowed object is
+ * {@link JavascriptList }
+ *
+ */
+ public void setJavascriptList(JavascriptList value) {
+ this.javascriptList = value;
+ }
+
+ /**
+ * Gets the value of the semaphoreList property.
+ *
+ * @return
+ * possible object is
+ * {@link SemaphoreList }
+ *
+ */
+ public SemaphoreList getSemaphoreList() {
+ return semaphoreList;
+ }
+
+ /**
+ * Sets the value of the semaphoreList property.
+ *
+ * @param value
+ * allowed object is
+ * {@link SemaphoreList }
+ *
+ */
+ public void setSemaphoreList(SemaphoreList value) {
+ this.semaphoreList = value;
+ }
+
+ /**
+ * Gets the value of the dashboardOptions property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDashboardOptions() {
+ return dashboardOptions;
+ }
+
+ /**
+ * Sets the value of the dashboardOptions property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDashboardOptions(String value) {
+ this.dashboardOptions = value;
+ }
+
+ /**
+ * Gets the value of the dashboardType property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isDashboardType() {
+ return dashboardType;
+ }
+
+ /**
+ * Sets the value of the dashboardType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setDashboardType(Boolean value) {
+ this.dashboardType = value;
+ }
+
+ /**
+ * Gets the value of the reportInNewWindow property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isReportInNewWindow() {
+ return reportInNewWindow;
+ }
+
+ /**
+ * Sets the value of the reportInNewWindow property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setReportInNewWindow(Boolean value) {
+ this.reportInNewWindow = value;
+ }
+
+ /**
+ * Gets the value of the displayFolderTree property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isDisplayFolderTree() {
+ return displayFolderTree;
+ }
+
+ /**
+ * Sets the value of the displayFolderTree property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setDisplayFolderTree(Boolean value) {
+ this.displayFolderTree = value;
+ }
+
+ /**
+ * Gets the value of the maxRowsInExcelDownload property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getMaxRowsInExcelDownload() {
+ return maxRowsInExcelDownload;
+ }
+
+ /**
+ * Sets the value of the maxRowsInExcelDownload property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setMaxRowsInExcelDownload(Integer value) {
+ this.maxRowsInExcelDownload = value;
+ }
+
+ /**
+ * Gets the value of the dashBoardReports property.
+ *
+ * @return
+ * possible object is
+ * {@link DashboardReports }
+ *
+ */
+ public DashboardReports getDashBoardReports() {
+ return dashBoardReports;
+ }
+
+ /**
+ * Sets the value of the dashBoardReports property.
+ *
+ * @param value
+ * allowed object is
+ * {@link DashboardReports }
+ *
+ */
+ public void setDashBoardReports(DashboardReports value) {
+ this.dashBoardReports = value;
+ }
+
+ /**
+ * Gets the value of the dashBoardReportsNew property.
+ *
+ * @return
+ * possible object is
+ * {@link DashboardReportsNew }
+ *
+ */
+ public DashboardReportsNew getDashBoardReportsNew() {
+ return dashBoardReportsNew;
+ }
+
+ /**
+ * Sets the value of the dashBoardReportsNew property.
+ *
+ * @param value
+ * allowed object is
+ * {@link DashboardReportsNew }
+ *
+ */
+ public void setDashBoardReportsNew(DashboardReportsNew value) {
+ this.dashBoardReportsNew = value;
+ }
+
+ /**
+ * Gets the value of the chartAdditionalOptions property.
+ *
+ * @return
+ * possible object is
+ * {@link ChartAdditionalOptions }
+ *
+ */
+ public ChartAdditionalOptions getChartAdditionalOptions() {
+ return chartAdditionalOptions;
+ }
+
+ /**
+ * Sets the value of the chartAdditionalOptions property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ChartAdditionalOptions }
+ *
+ */
+ public void setChartAdditionalOptions(ChartAdditionalOptions value) {
+ this.chartAdditionalOptions = value;
+ }
+
+ /**
+ * Gets the value of the pdfAdditionalOptions property.
+ *
+ * @return
+ * possible object is
+ * {@link PDFAdditionalOptions }
+ *
+ */
+ public PDFAdditionalOptions getPdfAdditionalOptions() {
+ return pdfAdditionalOptions;
+ }
+
+ /**
+ * Sets the value of the pdfAdditionalOptions property.
+ *
+ * @param value
+ * allowed object is
+ * {@link PDFAdditionalOptions }
+ *
+ */
+ public void setPdfAdditionalOptions(PDFAdditionalOptions value) {
+ this.pdfAdditionalOptions = value;
+ }
+
+ /**
+ * Gets the value of the chartDrillOptions property.
+ *
+ * @return
+ * possible object is
+ * {@link ChartDrillOptions }
+ *
+ */
+ public ChartDrillOptions getChartDrillOptions() {
+ return chartDrillOptions;
+ }
+
+ /**
+ * Sets the value of the chartDrillOptions property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ChartDrillOptions }
+ *
+ */
+ public void setChartDrillOptions(ChartDrillOptions value) {
+ this.chartDrillOptions = value;
+ }
+
+ /**
+ * Gets the value of the dataminingOptions property.
+ *
+ * @return
+ * possible object is
+ * {@link DataminingOptions }
+ *
+ */
+ public DataminingOptions getDataminingOptions() {
+ return dataminingOptions;
+ }
+
+ /**
+ * Sets the value of the dataminingOptions property.
+ *
+ * @param value
+ * allowed object is
+ * {@link DataminingOptions }
+ *
+ */
+ public void setDataminingOptions(DataminingOptions value) {
+ this.dataminingOptions = value;
+ }
+
+ /**
+ * Gets the value of the javascriptElement property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getJavascriptElement() {
+ return javascriptElement;
+ }
+
+ /**
+ * Sets the value of the javascriptElement property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setJavascriptElement(String value) {
+ this.javascriptElement = value;
+ }
+
+ /**
+ * Gets the value of the folderId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFolderId() {
+ return folderId;
+ }
+
+ /**
+ * Sets the value of the folderId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFolderId(String value) {
+ this.folderId = value;
+ }
+
+ /**
+ * Gets the value of the drillURLInPoPUpPresent property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isDrillURLInPoPUpPresent() {
+ return drillURLInPoPUpPresent;
+ }
+
+ /**
+ * Sets the value of the drillURLInPoPUpPresent property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setDrillURLInPoPUpPresent(Boolean value) {
+ this.drillURLInPoPUpPresent = value;
+ }
+
+ /**
+ * Gets the value of the isOneTimeScheduleAllowed property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIsOneTimeScheduleAllowed() {
+ return isOneTimeScheduleAllowed;
+ }
+
+ /**
+ * Sets the value of the isOneTimeScheduleAllowed property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIsOneTimeScheduleAllowed(String value) {
+ this.isOneTimeScheduleAllowed = value;
+ }
+
+ /**
+ * Gets the value of the isHourlyScheduleAllowed property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIsHourlyScheduleAllowed() {
+ return isHourlyScheduleAllowed;
+ }
+
+ /**
+ * Sets the value of the isHourlyScheduleAllowed property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIsHourlyScheduleAllowed(String value) {
+ this.isHourlyScheduleAllowed = value;
+ }
+
+ /**
+ * Gets the value of the isDailyScheduleAllowed property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIsDailyScheduleAllowed() {
+ return isDailyScheduleAllowed;
+ }
+
+ /**
+ * Sets the value of the isDailyScheduleAllowed property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIsDailyScheduleAllowed(String value) {
+ this.isDailyScheduleAllowed = value;
+ }
+
+ /**
+ * Gets the value of the isDailyMFScheduleAllowed property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIsDailyMFScheduleAllowed() {
+ return isDailyMFScheduleAllowed;
+ }
+
+ /**
+ * Sets the value of the isDailyMFScheduleAllowed property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIsDailyMFScheduleAllowed(String value) {
+ this.isDailyMFScheduleAllowed = value;
+ }
+
+ /**
+ * Gets the value of the isWeeklyScheduleAllowed property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIsWeeklyScheduleAllowed() {
+ return isWeeklyScheduleAllowed;
+ }
+
+ /**
+ * Sets the value of the isWeeklyScheduleAllowed property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIsWeeklyScheduleAllowed(String value) {
+ this.isWeeklyScheduleAllowed = value;
+ }
+
+ /**
+ * Gets the value of the isMonthlyScheduleAllowed property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIsMonthlyScheduleAllowed() {
+ return isMonthlyScheduleAllowed;
+ }
+
+ /**
+ * Sets the value of the isMonthlyScheduleAllowed property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIsMonthlyScheduleAllowed(String value) {
+ this.isMonthlyScheduleAllowed = value;
+ }
+
+ /**
+ * Gets the value of the reportMap property.
+ *
+ * @return
+ * possible object is
+ * {@link ReportMap }
+ *
+ */
+ public ReportMap getReportMap() {
+ return reportMap;
+ }
+
+ /**
+ * Sets the value of the reportMap property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ReportMap }
+ *
+ */
+ public void setReportMap(ReportMap value) {
+ this.reportMap = value;
+ }
+
+ /**
+ * Gets the value of the pageSize property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getPageSize() {
+ return pageSize;
+ }
+
+ /**
+ * Sets the value of the pageSize property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setPageSize(Integer value) {
+ this.pageSize = value;
+ }
+
+ /**
+ * Gets the value of the reportType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getReportType() {
+ return reportType;
+ }
+
+ /**
+ * Sets the value of the reportType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setReportType(String value) {
+ this.reportType = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardEditorList.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardEditorList.java
new file mode 100644
index 00000000..4c3b483b
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardEditorList.java
@@ -0,0 +1,94 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for DashboardEditorList complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="DashboardEditorList">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="editorList" type="{}DashboardEditorReport" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "DashboardEditorList", propOrder = {
+ "editorList"
+})
+public class DashboardEditorList {
+
+ protected List<DashboardEditorReport> editorList;
+
+ /**
+ * Gets the value of the editorList property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the editorList property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getEditorList().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link DashboardEditorReport }
+ *
+ *
+ */
+ public List<DashboardEditorReport> getEditorList() {
+ if (editorList == null) {
+ editorList = new ArrayList<DashboardEditorReport>();
+ }
+ return this.editorList;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardEditorReport.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardEditorReport.java
new file mode 100644
index 00000000..c6d17485
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardEditorReport.java
@@ -0,0 +1,172 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for DashboardEditorReport complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="DashboardEditorReport">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="reportId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="reportName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="dataType" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="position" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "DashboardEditorReport", propOrder = {
+ "reportId",
+ "reportName",
+ "dataType",
+ "position"
+})
+public class DashboardEditorReport {
+
+ @XmlElement(required = true)
+ protected String reportId;
+ @XmlElement(required = true)
+ protected String reportName;
+ @XmlElement(required = true)
+ protected String dataType;
+ @XmlElement(required = true)
+ protected String position;
+
+ /**
+ * Gets the value of the reportId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getReportId() {
+ return reportId;
+ }
+
+ /**
+ * Sets the value of the reportId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setReportId(String value) {
+ this.reportId = value;
+ }
+
+ /**
+ * Gets the value of the reportName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getReportName() {
+ return reportName;
+ }
+
+ /**
+ * Sets the value of the reportName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setReportName(String value) {
+ this.reportName = value;
+ }
+
+ /**
+ * Gets the value of the dataType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDataType() {
+ return dataType;
+ }
+
+ /**
+ * Sets the value of the dataType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDataType(String value) {
+ this.dataType = value;
+ }
+
+ /**
+ * Gets the value of the position property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPosition() {
+ return position;
+ }
+
+ /**
+ * Sets the value of the position property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPosition(String value) {
+ this.position = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardReports.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardReports.java
new file mode 100644
index 00000000..8e44cfe1
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardReports.java
@@ -0,0 +1,94 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for DashboardReports complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="DashboardReports">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="reportsList" type="{}Reports" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "DashboardReports", propOrder = {
+ "reportsList"
+})
+public class DashboardReports {
+
+ protected List<Reports> reportsList;
+
+ /**
+ * Gets the value of the reportsList property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the reportsList property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getReportsList().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Reports }
+ *
+ *
+ */
+ public List<Reports> getReportsList() {
+ if (reportsList == null) {
+ reportsList = new ArrayList<Reports>();
+ }
+ return this.reportsList;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardReportsNew.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardReportsNew.java
new file mode 100644
index 00000000..1755e70e
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardReportsNew.java
@@ -0,0 +1,148 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for DashboardReportsNew complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="DashboardReportsNew">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="reportsList" type="{}Reports" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;element name="dashboardEditor" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="dashboardEditorList" type="{}DashboardEditorList" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "DashboardReportsNew", propOrder = {
+ "reportsList",
+ "dashboardEditor",
+ "dashboardEditorList"
+})
+public class DashboardReportsNew {
+
+ protected List<Reports> reportsList;
+ protected String dashboardEditor;
+ protected DashboardEditorList dashboardEditorList;
+
+ /**
+ * Gets the value of the reportsList property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the reportsList property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getReportsList().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Reports }
+ *
+ *
+ */
+ public List<Reports> getReportsList() {
+ if (reportsList == null) {
+ reportsList = new ArrayList<Reports>();
+ }
+ return this.reportsList;
+ }
+
+ /**
+ * Gets the value of the dashboardEditor property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDashboardEditor() {
+ return dashboardEditor;
+ }
+
+ /**
+ * Sets the value of the dashboardEditor property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDashboardEditor(String value) {
+ this.dashboardEditor = value;
+ }
+
+ /**
+ * Gets the value of the dashboardEditorList property.
+ *
+ * @return
+ * possible object is
+ * {@link DashboardEditorList }
+ *
+ */
+ public DashboardEditorList getDashboardEditorList() {
+ return dashboardEditorList;
+ }
+
+ /**
+ * Sets the value of the dashboardEditorList property.
+ *
+ * @param value
+ * allowed object is
+ * {@link DashboardEditorList }
+ *
+ */
+ public void setDashboardEditorList(DashboardEditorList value) {
+ this.dashboardEditorList = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataColumnList.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataColumnList.java
new file mode 100644
index 00000000..79e6e0b2
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataColumnList.java
@@ -0,0 +1,96 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for DataColumnList complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="DataColumnList">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="dataColumn" type="{}DataColumnType" maxOccurs="unbounded"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "DataColumnList", propOrder = {
+ "dataColumn"
+})
+public class DataColumnList {
+
+ @XmlElement(required = true)
+ protected List<DataColumnType> dataColumn;
+
+ /**
+ * Gets the value of the dataColumn property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the dataColumn property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getDataColumn().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link DataColumnType }
+ *
+ *
+ */
+ public List<DataColumnType> getDataColumn() {
+ if (dataColumn == null) {
+ dataColumn = new ArrayList<DataColumnType>();
+ }
+ return this.dataColumn;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataColumnType.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataColumnType.java
new file mode 100644
index 00000000..c710a1ea
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataColumnType.java
@@ -0,0 +1,1455 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for DataColumnType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="DataColumnType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="tableId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="dbColName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="crossTabValue" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="colName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="displayName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="displayWidth" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="displayWidthInPxls" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="pdfDisplayWidthInPxls" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="displayAlignment" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="displayHeaderAlignment" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="orderSeq" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ * &lt;element name="visible" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="calculated" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="colType" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="hyperlinkURL" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="hyperlinkType" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="actionImg" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="groupByPos" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="subTotalCustomText" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="hideRepeatedKey" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="colFormat" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="groupBreak" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="orderBySeq" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="orderByAscDesc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="displayTotal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="colOnChart" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="chartSeq" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="chartColor" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="chartLineType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="chartSeries" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="isRangeAxisFilled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="isSortable" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="createInNewChart" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="drillDownType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="drillinPoPUp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="drillDownURL" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="drillDownParams" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element ref="{}comment" minOccurs="0"/>
+ * &lt;element name="colFilterList" type="{}ColFilterList" minOccurs="0"/>
+ * &lt;element name="semaphoreId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="dbColType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="chartGroup" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="yAxis" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="dependsOnFormField" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="nowrap" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="indentation" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="enhancedPagination" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="level" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="start" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="colspan" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="dataMiningCol" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;attribute name="colId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "DataColumnType", propOrder = {
+ "tableId",
+ "dbColName",
+ "crossTabValue",
+ "colName",
+ "displayName",
+ "displayWidth",
+ "displayWidthInPxls",
+ "pdfDisplayWidthInPxls",
+ "displayAlignment",
+ "displayHeaderAlignment",
+ "orderSeq",
+ "visible",
+ "calculated",
+ "colType",
+ "hyperlinkURL",
+ "hyperlinkType",
+ "actionImg",
+ "groupByPos",
+ "subTotalCustomText",
+ "hideRepeatedKey",
+ "colFormat",
+ "groupBreak",
+ "orderBySeq",
+ "orderByAscDesc",
+ "displayTotal",
+ "colOnChart",
+ "chartSeq",
+ "chartColor",
+ "chartLineType",
+ "chartSeries",
+ "isRangeAxisFilled",
+ "isSortable",
+ "createInNewChart",
+ "drillDownType",
+ "drillinPoPUp",
+ "drillDownURL",
+ "drillDownParams",
+ "comment",
+ "colFilterList",
+ "semaphoreId",
+ "dbColType",
+ "chartGroup",
+ "yAxis",
+ "dependsOnFormField",
+ "nowrap",
+ "indentation",
+ "enhancedPagination",
+ "level",
+ "start",
+ "colspan",
+ "dataMiningCol"
+})
+public class DataColumnType {
+
+ @XmlElement(required = true)
+ protected String tableId;
+ @XmlElement(required = true)
+ protected String dbColName;
+ protected String crossTabValue;
+ @XmlElement(required = true)
+ protected String colName;
+ @XmlElement(required = true)
+ protected String displayName;
+ protected Integer displayWidth;
+ protected String displayWidthInPxls;
+ protected String pdfDisplayWidthInPxls;
+ protected String displayAlignment;
+ protected String displayHeaderAlignment;
+ protected int orderSeq;
+ @XmlElement(defaultValue = "true")
+ protected boolean visible;
+ @XmlElement(defaultValue = "false")
+ protected boolean calculated;
+ @XmlElement(required = true)
+ protected String colType;
+ @XmlElement(required = true)
+ protected String hyperlinkURL;
+ @XmlElement(required = true)
+ protected String hyperlinkType;
+ @XmlElement(required = true)
+ protected String actionImg;
+ protected Integer groupByPos;
+ protected String subTotalCustomText;
+ @XmlElement(defaultValue = "false")
+ protected Boolean hideRepeatedKey;
+ protected String colFormat;
+ @XmlElement(defaultValue = "false")
+ protected boolean groupBreak;
+ protected Integer orderBySeq;
+ protected String orderByAscDesc;
+ protected String displayTotal;
+ protected String colOnChart;
+ protected Integer chartSeq;
+ protected String chartColor;
+ protected String chartLineType;
+ @XmlElement(defaultValue = "false")
+ protected Boolean chartSeries;
+ @XmlElement(defaultValue = "false")
+ protected Boolean isRangeAxisFilled;
+ @XmlElement(defaultValue = "false")
+ protected Boolean isSortable;
+ @XmlElement(defaultValue = "false")
+ protected Boolean createInNewChart;
+ protected String drillDownType;
+ @XmlElement(defaultValue = "false")
+ protected Boolean drillinPoPUp;
+ protected String drillDownURL;
+ protected String drillDownParams;
+ protected String comment;
+ protected ColFilterList colFilterList;
+ protected String semaphoreId;
+ protected String dbColType;
+ protected String chartGroup;
+ protected String yAxis;
+ protected String dependsOnFormField;
+ protected String nowrap;
+ @XmlElement(defaultValue = "0")
+ protected Integer indentation;
+ @XmlElement(defaultValue = "false")
+ protected Boolean enhancedPagination;
+ @XmlElement(defaultValue = "0")
+ protected Integer level;
+ @XmlElement(defaultValue = "0")
+ protected Integer start;
+ @XmlElement(defaultValue = "0")
+ protected Integer colspan;
+ protected String dataMiningCol;
+ @XmlAttribute(name = "colId")
+ protected String colId;
+
+ /**
+ * Gets the value of the tableId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTableId() {
+ return tableId;
+ }
+
+ /**
+ * Sets the value of the tableId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTableId(String value) {
+ this.tableId = value;
+ }
+
+ /**
+ * Gets the value of the dbColName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDbColName() {
+ return dbColName;
+ }
+
+ /**
+ * Sets the value of the dbColName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDbColName(String value) {
+ this.dbColName = value;
+ }
+
+ /**
+ * Gets the value of the crossTabValue property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCrossTabValue() {
+ return crossTabValue;
+ }
+
+ /**
+ * Sets the value of the crossTabValue property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCrossTabValue(String value) {
+ this.crossTabValue = value;
+ }
+
+ /**
+ * Gets the value of the colName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getColName() {
+ return colName;
+ }
+
+ /**
+ * Sets the value of the colName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setColName(String value) {
+ this.colName = value;
+ }
+
+ /**
+ * Gets the value of the displayName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ /**
+ * Sets the value of the displayName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDisplayName(String value) {
+ this.displayName = value;
+ }
+
+ /**
+ * Gets the value of the displayWidth property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getDisplayWidth() {
+ return displayWidth;
+ }
+
+ /**
+ * Sets the value of the displayWidth property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setDisplayWidth(Integer value) {
+ this.displayWidth = value;
+ }
+
+ /**
+ * Gets the value of the displayWidthInPxls property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDisplayWidthInPxls() {
+ return displayWidthInPxls;
+ }
+
+ /**
+ * Sets the value of the displayWidthInPxls property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDisplayWidthInPxls(String value) {
+ this.displayWidthInPxls = value;
+ }
+
+ /**
+ * Gets the value of the pdfDisplayWidthInPxls property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPdfDisplayWidthInPxls() {
+ return pdfDisplayWidthInPxls;
+ }
+
+ /**
+ * Sets the value of the pdfDisplayWidthInPxls property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPdfDisplayWidthInPxls(String value) {
+ this.pdfDisplayWidthInPxls = value;
+ }
+
+ /**
+ * Gets the value of the displayAlignment property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDisplayAlignment() {
+ return displayAlignment;
+ }
+
+ /**
+ * Sets the value of the displayAlignment property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDisplayAlignment(String value) {
+ this.displayAlignment = value;
+ }
+
+ /**
+ * Gets the value of the displayHeaderAlignment property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDisplayHeaderAlignment() {
+ return displayHeaderAlignment;
+ }
+
+ /**
+ * Sets the value of the displayHeaderAlignment property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDisplayHeaderAlignment(String value) {
+ this.displayHeaderAlignment = value;
+ }
+
+ /**
+ * Gets the value of the orderSeq property.
+ *
+ */
+ public int getOrderSeq() {
+ return orderSeq;
+ }
+
+ /**
+ * Sets the value of the orderSeq property.
+ *
+ */
+ public void setOrderSeq(int value) {
+ this.orderSeq = value;
+ }
+
+ /**
+ * Gets the value of the visible property.
+ *
+ */
+ public boolean isVisible() {
+ return visible;
+ }
+
+ /**
+ * Sets the value of the visible property.
+ *
+ */
+ public void setVisible(boolean value) {
+ this.visible = value;
+ }
+
+ /**
+ * Gets the value of the calculated property.
+ *
+ */
+ public boolean isCalculated() {
+ return calculated;
+ }
+
+ /**
+ * Sets the value of the calculated property.
+ *
+ */
+ public void setCalculated(boolean value) {
+ this.calculated = value;
+ }
+
+ /**
+ * Gets the value of the colType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getColType() {
+ return colType;
+ }
+
+ /**
+ * Sets the value of the colType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setColType(String value) {
+ this.colType = value;
+ }
+
+ /**
+ * Gets the value of the hyperlinkURL property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getHyperlinkURL() {
+ return hyperlinkURL;
+ }
+
+ /**
+ * Sets the value of the hyperlinkURL property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setHyperlinkURL(String value) {
+ this.hyperlinkURL = value;
+ }
+
+ /**
+ * Gets the value of the hyperlinkType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getHyperlinkType() {
+ return hyperlinkType;
+ }
+
+ /**
+ * Sets the value of the hyperlinkType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setHyperlinkType(String value) {
+ this.hyperlinkType = value;
+ }
+
+ /**
+ * Gets the value of the actionImg property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getActionImg() {
+ return actionImg;
+ }
+
+ /**
+ * Sets the value of the actionImg property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setActionImg(String value) {
+ this.actionImg = value;
+ }
+
+ /**
+ * Gets the value of the groupByPos property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getGroupByPos() {
+ return groupByPos;
+ }
+
+ /**
+ * Sets the value of the groupByPos property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setGroupByPos(Integer value) {
+ this.groupByPos = value;
+ }
+
+ /**
+ * Gets the value of the subTotalCustomText property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSubTotalCustomText() {
+ return subTotalCustomText;
+ }
+
+ /**
+ * Sets the value of the subTotalCustomText property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSubTotalCustomText(String value) {
+ this.subTotalCustomText = value;
+ }
+
+ /**
+ * Gets the value of the hideRepeatedKey property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isHideRepeatedKey() {
+ return hideRepeatedKey;
+ }
+
+ /**
+ * Sets the value of the hideRepeatedKey property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setHideRepeatedKey(Boolean value) {
+ this.hideRepeatedKey = value;
+ }
+
+ /**
+ * Gets the value of the colFormat property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getColFormat() {
+ return colFormat;
+ }
+
+ /**
+ * Sets the value of the colFormat property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setColFormat(String value) {
+ this.colFormat = value;
+ }
+
+ /**
+ * Gets the value of the groupBreak property.
+ *
+ */
+ public boolean isGroupBreak() {
+ return groupBreak;
+ }
+
+ /**
+ * Sets the value of the groupBreak property.
+ *
+ */
+ public void setGroupBreak(boolean value) {
+ this.groupBreak = value;
+ }
+
+ /**
+ * Gets the value of the orderBySeq property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getOrderBySeq() {
+ return orderBySeq;
+ }
+
+ /**
+ * Sets the value of the orderBySeq property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setOrderBySeq(Integer value) {
+ this.orderBySeq = value;
+ }
+
+ /**
+ * Gets the value of the orderByAscDesc property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getOrderByAscDesc() {
+ return orderByAscDesc;
+ }
+
+ /**
+ * Sets the value of the orderByAscDesc property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setOrderByAscDesc(String value) {
+ this.orderByAscDesc = value;
+ }
+
+ /**
+ * Gets the value of the displayTotal property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDisplayTotal() {
+ return displayTotal;
+ }
+
+ /**
+ * Sets the value of the displayTotal property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDisplayTotal(String value) {
+ this.displayTotal = value;
+ }
+
+ /**
+ * Gets the value of the colOnChart property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getColOnChart() {
+ return colOnChart;
+ }
+
+ /**
+ * Sets the value of the colOnChart property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setColOnChart(String value) {
+ this.colOnChart = value;
+ }
+
+ /**
+ * Gets the value of the chartSeq property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getChartSeq() {
+ return chartSeq;
+ }
+
+ /**
+ * Sets the value of the chartSeq property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setChartSeq(Integer value) {
+ this.chartSeq = value;
+ }
+
+ /**
+ * Gets the value of the chartColor property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartColor() {
+ return chartColor;
+ }
+
+ /**
+ * Sets the value of the chartColor property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartColor(String value) {
+ this.chartColor = value;
+ }
+
+ /**
+ * Gets the value of the chartLineType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartLineType() {
+ return chartLineType;
+ }
+
+ /**
+ * Sets the value of the chartLineType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartLineType(String value) {
+ this.chartLineType = value;
+ }
+
+ /**
+ * Gets the value of the chartSeries property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isChartSeries() {
+ return chartSeries;
+ }
+
+ /**
+ * Sets the value of the chartSeries property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setChartSeries(Boolean value) {
+ this.chartSeries = value;
+ }
+
+ /**
+ * Gets the value of the isRangeAxisFilled property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isIsRangeAxisFilled() {
+ return isRangeAxisFilled;
+ }
+
+ /**
+ * Sets the value of the isRangeAxisFilled property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setIsRangeAxisFilled(Boolean value) {
+ this.isRangeAxisFilled = value;
+ }
+
+ /**
+ * Gets the value of the isSortable property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isIsSortable() {
+ return isSortable;
+ }
+
+ /**
+ * Sets the value of the isSortable property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setIsSortable(Boolean value) {
+ this.isSortable = value;
+ }
+
+ /**
+ * Gets the value of the createInNewChart property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isCreateInNewChart() {
+ return createInNewChart;
+ }
+
+ /**
+ * Sets the value of the createInNewChart property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setCreateInNewChart(Boolean value) {
+ this.createInNewChart = value;
+ }
+
+ /**
+ * Gets the value of the drillDownType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDrillDownType() {
+ return drillDownType;
+ }
+
+ /**
+ * Sets the value of the drillDownType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDrillDownType(String value) {
+ this.drillDownType = value;
+ }
+
+ /**
+ * Gets the value of the drillinPoPUp property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isDrillinPoPUp() {
+ return drillinPoPUp;
+ }
+
+ /**
+ * Sets the value of the drillinPoPUp property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setDrillinPoPUp(Boolean value) {
+ this.drillinPoPUp = value;
+ }
+
+ /**
+ * Gets the value of the drillDownURL property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDrillDownURL() {
+ return drillDownURL;
+ }
+
+ /**
+ * Sets the value of the drillDownURL property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDrillDownURL(String value) {
+ this.drillDownURL = value;
+ }
+
+ /**
+ * Gets the value of the drillDownParams property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDrillDownParams() {
+ return drillDownParams;
+ }
+
+ /**
+ * Sets the value of the drillDownParams property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDrillDownParams(String value) {
+ this.drillDownParams = value;
+ }
+
+ /**
+ * Gets the value of the comment property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ /**
+ * Sets the value of the comment property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setComment(String value) {
+ this.comment = value;
+ }
+
+ /**
+ * Gets the value of the colFilterList property.
+ *
+ * @return
+ * possible object is
+ * {@link ColFilterList }
+ *
+ */
+ public ColFilterList getColFilterList() {
+ return colFilterList;
+ }
+
+ /**
+ * Sets the value of the colFilterList property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ColFilterList }
+ *
+ */
+ public void setColFilterList(ColFilterList value) {
+ this.colFilterList = value;
+ }
+
+ /**
+ * Gets the value of the semaphoreId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSemaphoreId() {
+ return semaphoreId;
+ }
+
+ /**
+ * Sets the value of the semaphoreId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSemaphoreId(String value) {
+ this.semaphoreId = value;
+ }
+
+ /**
+ * Gets the value of the dbColType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDbColType() {
+ return dbColType;
+ }
+
+ /**
+ * Sets the value of the dbColType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDbColType(String value) {
+ this.dbColType = value;
+ }
+
+ /**
+ * Gets the value of the chartGroup property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getChartGroup() {
+ return chartGroup;
+ }
+
+ /**
+ * Sets the value of the chartGroup property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setChartGroup(String value) {
+ this.chartGroup = value;
+ }
+
+ /**
+ * Gets the value of the yAxis property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getYAxis() {
+ return yAxis;
+ }
+
+ /**
+ * Sets the value of the yAxis property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setYAxis(String value) {
+ this.yAxis = value;
+ }
+
+ /**
+ * Gets the value of the dependsOnFormField property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDependsOnFormField() {
+ return dependsOnFormField;
+ }
+
+ /**
+ * Sets the value of the dependsOnFormField property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDependsOnFormField(String value) {
+ this.dependsOnFormField = value;
+ }
+
+ /**
+ * Gets the value of the nowrap property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getNowrap() {
+ return nowrap;
+ }
+
+ /**
+ * Sets the value of the nowrap property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setNowrap(String value) {
+ this.nowrap = value;
+ }
+
+ /**
+ * Gets the value of the indentation property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getIndentation() {
+ return indentation;
+ }
+
+ /**
+ * Sets the value of the indentation property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setIndentation(Integer value) {
+ this.indentation = value;
+ }
+
+ /**
+ * Gets the value of the enhancedPagination property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isEnhancedPagination() {
+ return enhancedPagination;
+ }
+
+ /**
+ * Sets the value of the enhancedPagination property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setEnhancedPagination(Boolean value) {
+ this.enhancedPagination = value;
+ }
+
+ /**
+ * Gets the value of the level property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getLevel() {
+ return level;
+ }
+
+ /**
+ * Sets the value of the level property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setLevel(Integer value) {
+ this.level = value;
+ }
+
+ /**
+ * Gets the value of the start property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getStart() {
+ return start;
+ }
+
+ /**
+ * Sets the value of the start property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setStart(Integer value) {
+ this.start = value;
+ }
+
+ /**
+ * Gets the value of the colspan property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getColspan() {
+ return colspan;
+ }
+
+ /**
+ * Sets the value of the colspan property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setColspan(Integer value) {
+ this.colspan = value;
+ }
+
+ /**
+ * Gets the value of the dataMiningCol property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDataMiningCol() {
+ return dataMiningCol;
+ }
+
+ /**
+ * Sets the value of the dataMiningCol property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDataMiningCol(String value) {
+ this.dataMiningCol = value;
+ }
+
+ /**
+ * Gets the value of the colId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getColId() {
+ return colId;
+ }
+
+ /**
+ * Sets the value of the colId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setColId(String value) {
+ this.colId = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataSourceList.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataSourceList.java
new file mode 100644
index 00000000..1e39348a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataSourceList.java
@@ -0,0 +1,94 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for DataSourceList complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="DataSourceList">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="dataSource" type="{}DataSourceType" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "DataSourceList", propOrder = {
+ "dataSource"
+})
+public class DataSourceList {
+
+ protected List<DataSourceType> dataSource;
+
+ /**
+ * Gets the value of the dataSource property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the dataSource property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getDataSource().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link DataSourceType }
+ *
+ *
+ */
+ public List<DataSourceType> getDataSource() {
+ if (dataSource == null) {
+ dataSource = new ArrayList<DataSourceType>();
+ }
+ return this.dataSource;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataSourceType.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataSourceType.java
new file mode 100644
index 00000000..08b066c8
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataSourceType.java
@@ -0,0 +1,281 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for DataSourceType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="DataSourceType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="tableName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="tablePK" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="displayName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="refTableId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="refDefinition" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element ref="{}comment" minOccurs="0"/>
+ * &lt;element name="dataColumnList" type="{}DataColumnList"/>
+ * &lt;/sequence>
+ * &lt;attribute name="tableId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "DataSourceType", propOrder = {
+ "tableName",
+ "tablePK",
+ "displayName",
+ "refTableId",
+ "refDefinition",
+ "comment",
+ "dataColumnList"
+})
+public class DataSourceType {
+
+ @XmlElement(required = true)
+ protected String tableName;
+ @XmlElement(required = true)
+ protected String tablePK;
+ @XmlElement(required = true)
+ protected String displayName;
+ protected String refTableId;
+ protected String refDefinition;
+ protected String comment;
+ @XmlElement(required = true)
+ protected DataColumnList dataColumnList;
+ @XmlAttribute(name = "tableId")
+ protected String tableId;
+
+ /**
+ * Gets the value of the tableName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTableName() {
+ return tableName;
+ }
+
+ /**
+ * Sets the value of the tableName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTableName(String value) {
+ this.tableName = value;
+ }
+
+ /**
+ * Gets the value of the tablePK property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTablePK() {
+ return tablePK;
+ }
+
+ /**
+ * Sets the value of the tablePK property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTablePK(String value) {
+ this.tablePK = value;
+ }
+
+ /**
+ * Gets the value of the displayName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ /**
+ * Sets the value of the displayName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDisplayName(String value) {
+ this.displayName = value;
+ }
+
+ /**
+ * Gets the value of the refTableId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRefTableId() {
+ return refTableId;
+ }
+
+ /**
+ * Sets the value of the refTableId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRefTableId(String value) {
+ this.refTableId = value;
+ }
+
+ /**
+ * Gets the value of the refDefinition property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRefDefinition() {
+ return refDefinition;
+ }
+
+ /**
+ * Sets the value of the refDefinition property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRefDefinition(String value) {
+ this.refDefinition = value;
+ }
+
+ /**
+ * Gets the value of the comment property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ /**
+ * Sets the value of the comment property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setComment(String value) {
+ this.comment = value;
+ }
+
+ /**
+ * Gets the value of the dataColumnList property.
+ *
+ * @return
+ * possible object is
+ * {@link DataColumnList }
+ *
+ */
+ public DataColumnList getDataColumnList() {
+ return dataColumnList;
+ }
+
+ /**
+ * Sets the value of the dataColumnList property.
+ *
+ * @param value
+ * allowed object is
+ * {@link DataColumnList }
+ *
+ */
+ public void setDataColumnList(DataColumnList value) {
+ this.dataColumnList = value;
+ }
+
+ /**
+ * Gets the value of the tableId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTableId() {
+ return tableId;
+ }
+
+ /**
+ * Sets the value of the tableId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTableId(String value) {
+ this.tableId = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataminingOptions.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataminingOptions.java
new file mode 100644
index 00000000..c26bce7c
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataminingOptions.java
@@ -0,0 +1,167 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for DataminingOptions complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="DataminingOptions">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="classifier" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="timeAttribute" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="timeformat" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="forecastingUnits" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "DataminingOptions", propOrder = {
+ "classifier",
+ "timeAttribute",
+ "timeformat",
+ "forecastingUnits"
+})
+public class DataminingOptions {
+
+ protected String classifier;
+ protected String timeAttribute;
+ protected String timeformat;
+ protected String forecastingUnits;
+
+ /**
+ * Gets the value of the classifier property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getClassifier() {
+ return classifier;
+ }
+
+ /**
+ * Sets the value of the classifier property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setClassifier(String value) {
+ this.classifier = value;
+ }
+
+ /**
+ * Gets the value of the timeAttribute property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTimeAttribute() {
+ return timeAttribute;
+ }
+
+ /**
+ * Sets the value of the timeAttribute property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTimeAttribute(String value) {
+ this.timeAttribute = value;
+ }
+
+ /**
+ * Gets the value of the timeformat property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTimeformat() {
+ return timeformat;
+ }
+
+ /**
+ * Sets the value of the timeformat property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTimeformat(String value) {
+ this.timeformat = value;
+ }
+
+ /**
+ * Gets the value of the forecastingUnits property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getForecastingUnits() {
+ return forecastingUnits;
+ }
+
+ /**
+ * Sets the value of the forecastingUnits property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setForecastingUnits(String value) {
+ this.forecastingUnits = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormFieldList.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormFieldList.java
new file mode 100644
index 00000000..104ee1c1
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormFieldList.java
@@ -0,0 +1,121 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for FormFieldList complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="FormFieldList">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="formField" type="{}FormFieldType" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;element ref="{}comment" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "FormFieldList", propOrder = {
+ "formField",
+ "comment"
+})
+public class FormFieldList {
+
+ protected List<FormFieldType> formField;
+ protected String comment;
+
+ /**
+ * Gets the value of the formField property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the formField property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getFormField().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link FormFieldType }
+ *
+ *
+ */
+ public List<FormFieldType> getFormField() {
+ if (formField == null) {
+ formField = new ArrayList<FormFieldType>();
+ }
+ return this.formField;
+ }
+
+ /**
+ * Gets the value of the comment property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ /**
+ * Sets the value of the comment property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setComment(String value) {
+ this.comment = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormFieldType.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormFieldType.java
new file mode 100644
index 00000000..77922c7a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormFieldType.java
@@ -0,0 +1,610 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+
+/**
+ * <p>Java class for FormFieldType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="FormFieldType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="colId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="fieldName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="fieldType" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="visible" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="validationType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="mandatory" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="defaultValue" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="orderBySeq" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="fieldSQL" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="fieldDefaultSQL" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="rangeStartDate" type="{http://www.w3.org/2001/XMLSchema}date" minOccurs="0"/>
+ * &lt;element name="rangeEndDate" type="{http://www.w3.org/2001/XMLSchema}date" minOccurs="0"/>
+ * &lt;element name="rangeStartDateSQL" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="rangeEndDateSQL" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element ref="{}comment" minOccurs="0"/>
+ * &lt;element name="predefinedValueList" type="{}PredefinedValueList" minOccurs="0"/>
+ * &lt;element name="dependsOn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="groupFormField" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="multiSelectListSize" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;attribute name="fieldId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "FormFieldType", propOrder = {
+ "colId",
+ "fieldName",
+ "fieldType",
+ "visible",
+ "validationType",
+ "mandatory",
+ "defaultValue",
+ "orderBySeq",
+ "fieldSQL",
+ "fieldDefaultSQL",
+ "rangeStartDate",
+ "rangeEndDate",
+ "rangeStartDateSQL",
+ "rangeEndDateSQL",
+ "comment",
+ "predefinedValueList",
+ "dependsOn",
+ "groupFormField",
+ "multiSelectListSize"
+})
+public class FormFieldType {
+
+ @XmlElement(required = true)
+ protected String colId;
+ @XmlElement(required = true)
+ protected String fieldName;
+ @XmlElement(required = true)
+ protected String fieldType;
+ protected String visible;
+ protected String validationType;
+ protected String mandatory;
+ protected String defaultValue;
+ protected Integer orderBySeq;
+ protected String fieldSQL;
+ protected String fieldDefaultSQL;
+ @XmlSchemaType(name = "date")
+ protected XMLGregorianCalendar rangeStartDate;
+ @XmlSchemaType(name = "date")
+ protected XMLGregorianCalendar rangeEndDate;
+ protected String rangeStartDateSQL;
+ protected String rangeEndDateSQL;
+ protected String comment;
+ protected PredefinedValueList predefinedValueList;
+ protected String dependsOn;
+ @XmlElement(defaultValue = "false")
+ protected Boolean groupFormField;
+ @XmlElement(defaultValue = "4")
+ protected String multiSelectListSize;
+ @XmlAttribute(name = "fieldId")
+ protected String fieldId;
+
+ /**
+ * Gets the value of the colId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getColId() {
+ return colId;
+ }
+
+ /**
+ * Sets the value of the colId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setColId(String value) {
+ this.colId = value;
+ }
+
+ /**
+ * Gets the value of the fieldName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ /**
+ * Sets the value of the fieldName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFieldName(String value) {
+ this.fieldName = value;
+ }
+
+ /**
+ * Gets the value of the fieldType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFieldType() {
+ return fieldType;
+ }
+
+ /**
+ * Sets the value of the fieldType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFieldType(String value) {
+ this.fieldType = value;
+ }
+
+ /**
+ * Gets the value of the visible property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVisible() {
+ return visible;
+ }
+
+ /**
+ * Sets the value of the visible property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVisible(String value) {
+ this.visible = value;
+ }
+
+ /**
+ * Gets the value of the validationType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValidationType() {
+ return validationType;
+ }
+
+ /**
+ * Sets the value of the validationType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValidationType(String value) {
+ this.validationType = value;
+ }
+
+ /**
+ * Gets the value of the mandatory property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMandatory() {
+ return mandatory;
+ }
+
+ /**
+ * Sets the value of the mandatory property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMandatory(String value) {
+ this.mandatory = value;
+ }
+
+ /**
+ * Gets the value of the defaultValue property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ /**
+ * Sets the value of the defaultValue property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDefaultValue(String value) {
+ this.defaultValue = value;
+ }
+
+ /**
+ * Gets the value of the orderBySeq property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getOrderBySeq() {
+ return orderBySeq;
+ }
+
+ /**
+ * Sets the value of the orderBySeq property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setOrderBySeq(Integer value) {
+ this.orderBySeq = value;
+ }
+
+ /**
+ * Gets the value of the fieldSQL property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFieldSQL() {
+ return fieldSQL;
+ }
+
+ /**
+ * Sets the value of the fieldSQL property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFieldSQL(String value) {
+ this.fieldSQL = value;
+ }
+
+ /**
+ * Gets the value of the fieldDefaultSQL property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFieldDefaultSQL() {
+ return fieldDefaultSQL;
+ }
+
+ /**
+ * Sets the value of the fieldDefaultSQL property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFieldDefaultSQL(String value) {
+ this.fieldDefaultSQL = value;
+ }
+
+ /**
+ * Gets the value of the rangeStartDate property.
+ *
+ * @return
+ * possible object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public XMLGregorianCalendar getRangeStartDate() {
+ return rangeStartDate;
+ }
+
+ /**
+ * Sets the value of the rangeStartDate property.
+ *
+ * @param value
+ * allowed object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public void setRangeStartDate(XMLGregorianCalendar value) {
+ this.rangeStartDate = value;
+ }
+
+ /**
+ * Gets the value of the rangeEndDate property.
+ *
+ * @return
+ * possible object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public XMLGregorianCalendar getRangeEndDate() {
+ return rangeEndDate;
+ }
+
+ /**
+ * Sets the value of the rangeEndDate property.
+ *
+ * @param value
+ * allowed object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public void setRangeEndDate(XMLGregorianCalendar value) {
+ this.rangeEndDate = value;
+ }
+
+ /**
+ * Gets the value of the rangeStartDateSQL property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRangeStartDateSQL() {
+ return rangeStartDateSQL;
+ }
+
+ /**
+ * Sets the value of the rangeStartDateSQL property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRangeStartDateSQL(String value) {
+ this.rangeStartDateSQL = value;
+ }
+
+ /**
+ * Gets the value of the rangeEndDateSQL property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRangeEndDateSQL() {
+ return rangeEndDateSQL;
+ }
+
+ /**
+ * Sets the value of the rangeEndDateSQL property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRangeEndDateSQL(String value) {
+ this.rangeEndDateSQL = value;
+ }
+
+ /**
+ * Gets the value of the comment property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ /**
+ * Sets the value of the comment property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setComment(String value) {
+ this.comment = value;
+ }
+
+ /**
+ * Gets the value of the predefinedValueList property.
+ *
+ * @return
+ * possible object is
+ * {@link PredefinedValueList }
+ *
+ */
+ public PredefinedValueList getPredefinedValueList() {
+ return predefinedValueList;
+ }
+
+ /**
+ * Sets the value of the predefinedValueList property.
+ *
+ * @param value
+ * allowed object is
+ * {@link PredefinedValueList }
+ *
+ */
+ public void setPredefinedValueList(PredefinedValueList value) {
+ this.predefinedValueList = value;
+ }
+
+ /**
+ * Gets the value of the dependsOn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDependsOn() {
+ return dependsOn;
+ }
+
+ /**
+ * Sets the value of the dependsOn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDependsOn(String value) {
+ this.dependsOn = value;
+ }
+
+ /**
+ * Gets the value of the groupFormField property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isGroupFormField() {
+ return groupFormField;
+ }
+
+ /**
+ * Sets the value of the groupFormField property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setGroupFormField(Boolean value) {
+ this.groupFormField = value;
+ }
+
+ /**
+ * Gets the value of the multiSelectListSize property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMultiSelectListSize() {
+ return multiSelectListSize;
+ }
+
+ /**
+ * Sets the value of the multiSelectListSize property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMultiSelectListSize(String value) {
+ this.multiSelectListSize = value;
+ }
+
+ /**
+ * Gets the value of the fieldId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFieldId() {
+ return fieldId;
+ }
+
+ /**
+ * Sets the value of the fieldId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFieldId(String value) {
+ this.fieldId = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormatList.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormatList.java
new file mode 100644
index 00000000..aa49a81c
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormatList.java
@@ -0,0 +1,96 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for FormatList complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="FormatList">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="format" type="{}FormatType" maxOccurs="unbounded"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "FormatList", propOrder = {
+ "format"
+})
+public class FormatList {
+
+ @XmlElement(required = true)
+ protected List<FormatType> format;
+
+ /**
+ * Gets the value of the format property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the format property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getFormat().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link FormatType }
+ *
+ *
+ */
+ public List<FormatType> getFormat() {
+ if (format == null) {
+ format = new ArrayList<FormatType>();
+ }
+ return this.format;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormatType.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormatType.java
new file mode 100644
index 00000000..5c0abf8a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormatType.java
@@ -0,0 +1,366 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for FormatType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="FormatType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="lessThanValue" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="expression" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="bold" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="italic" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="underline" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="bgColor" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="fontColor" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="fontFace" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="fontSize" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="alignment" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element ref="{}comment" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;attribute name="formatId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "FormatType", propOrder = {
+ "lessThanValue",
+ "expression",
+ "bold",
+ "italic",
+ "underline",
+ "bgColor",
+ "fontColor",
+ "fontFace",
+ "fontSize",
+ "alignment",
+ "comment"
+})
+public class FormatType {
+
+ @XmlElement(required = true)
+ protected String lessThanValue;
+ @XmlElement(required = true)
+ protected String expression;
+ @XmlElement(defaultValue = "false")
+ protected boolean bold;
+ @XmlElement(defaultValue = "false")
+ protected boolean italic;
+ @XmlElement(defaultValue = "false")
+ protected boolean underline;
+ protected String bgColor;
+ protected String fontColor;
+ protected String fontFace;
+ protected String fontSize;
+ protected String alignment;
+ protected String comment;
+ @XmlAttribute(name = "formatId")
+ protected String formatId;
+
+ /**
+ * Gets the value of the lessThanValue property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLessThanValue() {
+ return lessThanValue;
+ }
+
+ /**
+ * Sets the value of the lessThanValue property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLessThanValue(String value) {
+ this.lessThanValue = value;
+ }
+
+ /**
+ * Gets the value of the expression property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getExpression() {
+ return expression;
+ }
+
+ /**
+ * Sets the value of the expression property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setExpression(String value) {
+ this.expression = value;
+ }
+
+ /**
+ * Gets the value of the bold property.
+ *
+ */
+ public boolean isBold() {
+ return bold;
+ }
+
+ /**
+ * Sets the value of the bold property.
+ *
+ */
+ public void setBold(boolean value) {
+ this.bold = value;
+ }
+
+ /**
+ * Gets the value of the italic property.
+ *
+ */
+ public boolean isItalic() {
+ return italic;
+ }
+
+ /**
+ * Sets the value of the italic property.
+ *
+ */
+ public void setItalic(boolean value) {
+ this.italic = value;
+ }
+
+ /**
+ * Gets the value of the underline property.
+ *
+ */
+ public boolean isUnderline() {
+ return underline;
+ }
+
+ /**
+ * Sets the value of the underline property.
+ *
+ */
+ public void setUnderline(boolean value) {
+ this.underline = value;
+ }
+
+ /**
+ * Gets the value of the bgColor property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getBgColor() {
+ return bgColor;
+ }
+
+ /**
+ * Sets the value of the bgColor property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setBgColor(String value) {
+ this.bgColor = value;
+ }
+
+ /**
+ * Gets the value of the fontColor property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFontColor() {
+ return fontColor;
+ }
+
+ /**
+ * Sets the value of the fontColor property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFontColor(String value) {
+ this.fontColor = value;
+ }
+
+ /**
+ * Gets the value of the fontFace property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFontFace() {
+ return fontFace;
+ }
+
+ /**
+ * Sets the value of the fontFace property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFontFace(String value) {
+ this.fontFace = value;
+ }
+
+ /**
+ * Gets the value of the fontSize property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFontSize() {
+ return fontSize;
+ }
+
+ /**
+ * Sets the value of the fontSize property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFontSize(String value) {
+ this.fontSize = value;
+ }
+
+ /**
+ * Gets the value of the alignment property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAlignment() {
+ return alignment;
+ }
+
+ /**
+ * Sets the value of the alignment property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAlignment(String value) {
+ this.alignment = value;
+ }
+
+ /**
+ * Gets the value of the comment property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ /**
+ * Sets the value of the comment property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setComment(String value) {
+ this.comment = value;
+ }
+
+ /**
+ * Gets the value of the formatId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFormatId() {
+ return formatId;
+ }
+
+ /**
+ * Sets the value of the formatId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFormatId(String value) {
+ this.formatId = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/JavascriptItemType.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/JavascriptItemType.java
new file mode 100644
index 00000000..102e3fc5
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/JavascriptItemType.java
@@ -0,0 +1,144 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for JavascriptItemType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="JavascriptItemType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="fieldId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="callText" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "JavascriptItemType", propOrder = {
+ "id",
+ "fieldId",
+ "callText"
+})
+public class JavascriptItemType {
+
+ @XmlElement(required = true)
+ protected String id;
+ @XmlElement(required = true)
+ protected String fieldId;
+ @XmlElement(required = true)
+ protected String callText;
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets the value of the fieldId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFieldId() {
+ return fieldId;
+ }
+
+ /**
+ * Sets the value of the fieldId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFieldId(String value) {
+ this.fieldId = value;
+ }
+
+ /**
+ * Gets the value of the callText property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCallText() {
+ return callText;
+ }
+
+ /**
+ * Sets the value of the callText property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCallText(String value) {
+ this.callText = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/JavascriptList.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/JavascriptList.java
new file mode 100644
index 00000000..9c8cea79
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/JavascriptList.java
@@ -0,0 +1,94 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for JavascriptList complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="JavascriptList">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="javascriptItem" type="{}JavascriptItemType" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "JavascriptList", propOrder = {
+ "javascriptItem"
+})
+public class JavascriptList {
+
+ protected List<JavascriptItemType> javascriptItem;
+
+ /**
+ * Gets the value of the javascriptItem property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the javascriptItem property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getJavascriptItem().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link JavascriptItemType }
+ *
+ *
+ */
+ public List<JavascriptItemType> getJavascriptItem() {
+ if (javascriptItem == null) {
+ javascriptItem = new ArrayList<JavascriptItemType>();
+ }
+ return this.javascriptItem;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/Marker.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/Marker.java
new file mode 100644
index 00000000..7c4d784a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/Marker.java
@@ -0,0 +1,167 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for Marker complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="Marker">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="markerColor" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="dataHeader" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="addressColumn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="dataColumn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "Marker", propOrder = {
+ "markerColor",
+ "dataHeader",
+ "addressColumn",
+ "dataColumn"
+})
+public class Marker {
+
+ protected String markerColor;
+ protected String dataHeader;
+ protected String addressColumn;
+ protected String dataColumn;
+
+ /**
+ * Gets the value of the markerColor property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMarkerColor() {
+ return markerColor;
+ }
+
+ /**
+ * Sets the value of the markerColor property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMarkerColor(String value) {
+ this.markerColor = value;
+ }
+
+ /**
+ * Gets the value of the dataHeader property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDataHeader() {
+ return dataHeader;
+ }
+
+ /**
+ * Sets the value of the dataHeader property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDataHeader(String value) {
+ this.dataHeader = value;
+ }
+
+ /**
+ * Gets the value of the addressColumn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAddressColumn() {
+ return addressColumn;
+ }
+
+ /**
+ * Sets the value of the addressColumn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAddressColumn(String value) {
+ this.addressColumn = value;
+ }
+
+ /**
+ * Gets the value of the dataColumn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDataColumn() {
+ return dataColumn;
+ }
+
+ /**
+ * Sets the value of the dataColumn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDataColumn(String value) {
+ this.dataColumn = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ObjectFactory.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ObjectFactory.java
new file mode 100644
index 00000000..5515cd23
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ObjectFactory.java
@@ -0,0 +1,305 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.openecomp.portalsdk.analytics.xmlobj package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _CustomReport_QNAME = new QName("", "customReport");
+ private final static QName _Comment_QNAME = new QName("", "comment");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.portalsdk.analytics.xmlobj
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link CustomReportType }
+ *
+ */
+ public CustomReportType createCustomReportType() {
+ return new CustomReportType();
+ }
+
+ /**
+ * Create an instance of {@link ChartAdditionalOptions }
+ *
+ */
+ public ChartAdditionalOptions createChartAdditionalOptions() {
+ return new ChartAdditionalOptions();
+ }
+
+ /**
+ * Create an instance of {@link DataminingOptions }
+ *
+ */
+ public DataminingOptions createDataminingOptions() {
+ return new DataminingOptions();
+ }
+
+ /**
+ * Create an instance of {@link FormFieldType }
+ *
+ */
+ public FormFieldType createFormFieldType() {
+ return new FormFieldType();
+ }
+
+ /**
+ * Create an instance of {@link PredefinedValueList }
+ *
+ */
+ public PredefinedValueList createPredefinedValueList() {
+ return new PredefinedValueList();
+ }
+
+ /**
+ * Create an instance of {@link DashboardEditorReport }
+ *
+ */
+ public DashboardEditorReport createDashboardEditorReport() {
+ return new DashboardEditorReport();
+ }
+
+ /**
+ * Create an instance of {@link DataSourceList }
+ *
+ */
+ public DataSourceList createDataSourceList() {
+ return new DataSourceList();
+ }
+
+ /**
+ * Create an instance of {@link DashboardReports }
+ *
+ */
+ public DashboardReports createDashboardReports() {
+ return new DashboardReports();
+ }
+
+ /**
+ * Create an instance of {@link ReportMap }
+ *
+ */
+ public ReportMap createReportMap() {
+ return new ReportMap();
+ }
+
+ /**
+ * Create an instance of {@link FormatList }
+ *
+ */
+ public FormatList createFormatList() {
+ return new FormatList();
+ }
+
+ /**
+ * Create an instance of {@link JavascriptList }
+ *
+ */
+ public JavascriptList createJavascriptList() {
+ return new JavascriptList();
+ }
+
+ /**
+ * Create an instance of {@link JavascriptItemType }
+ *
+ */
+ public JavascriptItemType createJavascriptItemType() {
+ return new JavascriptItemType();
+ }
+
+ /**
+ * Create an instance of {@link DataColumnType }
+ *
+ */
+ public DataColumnType createDataColumnType() {
+ return new DataColumnType();
+ }
+
+ /**
+ * Create an instance of {@link DataSourceType }
+ *
+ */
+ public DataSourceType createDataSourceType() {
+ return new DataSourceType();
+ }
+
+ /**
+ * Create an instance of {@link DashboardEditorList }
+ *
+ */
+ public DashboardEditorList createDashboardEditorList() {
+ return new DashboardEditorList();
+ }
+
+ /**
+ * Create an instance of {@link SemaphoreList }
+ *
+ */
+ public SemaphoreList createSemaphoreList() {
+ return new SemaphoreList();
+ }
+
+ /**
+ * Create an instance of {@link ColFilterType }
+ *
+ */
+ public ColFilterType createColFilterType() {
+ return new ColFilterType();
+ }
+
+ /**
+ * Create an instance of {@link ChartDrillOptions }
+ *
+ */
+ public ChartDrillOptions createChartDrillOptions() {
+ return new ChartDrillOptions();
+ }
+
+ /**
+ * Create an instance of {@link DashboardReportsNew }
+ *
+ */
+ public DashboardReportsNew createDashboardReportsNew() {
+ return new DashboardReportsNew();
+ }
+
+ /**
+ * Create an instance of {@link ChartDrillFormfield }
+ *
+ */
+ public ChartDrillFormfield createChartDrillFormfield() {
+ return new ChartDrillFormfield();
+ }
+
+ /**
+ * Create an instance of {@link PDFAdditionalOptions }
+ *
+ */
+ public PDFAdditionalOptions createPDFAdditionalOptions() {
+ return new PDFAdditionalOptions();
+ }
+
+ /**
+ * Create an instance of {@link Reports }
+ *
+ */
+ public Reports createReports() {
+ return new Reports();
+ }
+
+ /**
+ * Create an instance of {@link Marker }
+ *
+ */
+ public Marker createMarker() {
+ return new Marker();
+ }
+
+ /**
+ * Create an instance of {@link FormatType }
+ *
+ */
+ public FormatType createFormatType() {
+ return new FormatType();
+ }
+
+ /**
+ * Create an instance of {@link DataColumnList }
+ *
+ */
+ public DataColumnList createDataColumnList() {
+ return new DataColumnList();
+ }
+
+ /**
+ * Create an instance of {@link FormFieldList }
+ *
+ */
+ public FormFieldList createFormFieldList() {
+ return new FormFieldList();
+ }
+
+ /**
+ * Create an instance of {@link SemaphoreType }
+ *
+ */
+ public SemaphoreType createSemaphoreType() {
+ return new SemaphoreType();
+ }
+
+ /**
+ * Create an instance of {@link ColFilterList }
+ *
+ */
+ public ColFilterList createColFilterList() {
+ return new ColFilterList();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link CustomReportType }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "", name = "customReport")
+ public JAXBElement<CustomReportType> createCustomReport(CustomReportType value) {
+ return new JAXBElement<CustomReportType>(_CustomReport_QNAME, CustomReportType.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "", name = "comment")
+ public JAXBElement<String> createComment(String value) {
+ return new JAXBElement<String>(_Comment_QNAME, String.class, null, value);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/PDFAdditionalOptions.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/PDFAdditionalOptions.java
new file mode 100644
index 00000000..78d727c2
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/PDFAdditionalOptions.java
@@ -0,0 +1,340 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for PDFAdditionalOptions complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="PDFAdditionalOptions">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="PDF_font" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="PDF_fontSize" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="PDF_orientation" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="PDF_logo1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="PDF_logo2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="PDF_logo1Size" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="PDF_logo2Size" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="PDF_coverPage" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="PDF_footer1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="PDF_footer2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "PDFAdditionalOptions", propOrder = {
+ "pdfFont",
+ "pdfFontSize",
+ "pdfOrientation",
+ "pdfLogo1",
+ "pdfLogo2",
+ "pdfLogo1Size",
+ "pdfLogo2Size",
+ "pdfCoverPage",
+ "pdfFooter1",
+ "pdfFooter2"
+})
+public class PDFAdditionalOptions {
+
+ @XmlElement(name = "PDF_font")
+ protected String pdfFont;
+ @XmlElement(name = "PDF_fontSize")
+ protected Integer pdfFontSize;
+ @XmlElement(name = "PDF_orientation")
+ protected String pdfOrientation;
+ @XmlElement(name = "PDF_logo1")
+ protected String pdfLogo1;
+ @XmlElement(name = "PDF_logo2")
+ protected String pdfLogo2;
+ @XmlElement(name = "PDF_logo1Size")
+ protected Integer pdfLogo1Size;
+ @XmlElement(name = "PDF_logo2Size")
+ protected Integer pdfLogo2Size;
+ @XmlElement(name = "PDF_coverPage", defaultValue = "false")
+ protected Boolean pdfCoverPage;
+ @XmlElement(name = "PDF_footer1")
+ protected String pdfFooter1;
+ @XmlElement(name = "PDF_footer2")
+ protected String pdfFooter2;
+
+ /**
+ * Gets the value of the pdfFont property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPDFFont() {
+ return pdfFont;
+ }
+
+ /**
+ * Sets the value of the pdfFont property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPDFFont(String value) {
+ this.pdfFont = value;
+ }
+
+ /**
+ * Gets the value of the pdfFontSize property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getPDFFontSize() {
+ return pdfFontSize;
+ }
+
+ /**
+ * Sets the value of the pdfFontSize property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setPDFFontSize(Integer value) {
+ this.pdfFontSize = value;
+ }
+
+ /**
+ * Gets the value of the pdfOrientation property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPDFOrientation() {
+ return pdfOrientation;
+ }
+
+ /**
+ * Sets the value of the pdfOrientation property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPDFOrientation(String value) {
+ this.pdfOrientation = value;
+ }
+
+ /**
+ * Gets the value of the pdfLogo1 property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPDFLogo1() {
+ return pdfLogo1;
+ }
+
+ /**
+ * Sets the value of the pdfLogo1 property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPDFLogo1(String value) {
+ this.pdfLogo1 = value;
+ }
+
+ /**
+ * Gets the value of the pdfLogo2 property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPDFLogo2() {
+ return pdfLogo2;
+ }
+
+ /**
+ * Sets the value of the pdfLogo2 property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPDFLogo2(String value) {
+ this.pdfLogo2 = value;
+ }
+
+ /**
+ * Gets the value of the pdfLogo1Size property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getPDFLogo1Size() {
+ return pdfLogo1Size;
+ }
+
+ /**
+ * Sets the value of the pdfLogo1Size property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setPDFLogo1Size(Integer value) {
+ this.pdfLogo1Size = value;
+ }
+
+ /**
+ * Gets the value of the pdfLogo2Size property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getPDFLogo2Size() {
+ return pdfLogo2Size;
+ }
+
+ /**
+ * Sets the value of the pdfLogo2Size property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setPDFLogo2Size(Integer value) {
+ this.pdfLogo2Size = value;
+ }
+
+ /**
+ * Gets the value of the pdfCoverPage property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isPDFCoverPage() {
+ return pdfCoverPage;
+ }
+
+ /**
+ * Sets the value of the pdfCoverPage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setPDFCoverPage(Boolean value) {
+ this.pdfCoverPage = value;
+ }
+
+ /**
+ * Gets the value of the pdfFooter1 property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPDFFooter1() {
+ return pdfFooter1;
+ }
+
+ /**
+ * Sets the value of the pdfFooter1 property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPDFFooter1(String value) {
+ this.pdfFooter1 = value;
+ }
+
+ /**
+ * Gets the value of the pdfFooter2 property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPDFFooter2() {
+ return pdfFooter2;
+ }
+
+ /**
+ * Sets the value of the pdfFooter2 property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPDFFooter2(String value) {
+ this.pdfFooter2 = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/PredefinedValueList.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/PredefinedValueList.java
new file mode 100644
index 00000000..b008d566
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/PredefinedValueList.java
@@ -0,0 +1,94 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for PredefinedValueList complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="PredefinedValueList">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="predefinedValue" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "PredefinedValueList", propOrder = {
+ "predefinedValue"
+})
+public class PredefinedValueList {
+
+ protected List<String> predefinedValue;
+
+ /**
+ * Gets the value of the predefinedValue property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the predefinedValue property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getPredefinedValue().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getPredefinedValue() {
+ if (predefinedValue == null) {
+ predefinedValue = new ArrayList<String>();
+ }
+ return this.predefinedValue;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ReportMap.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ReportMap.java
new file mode 100644
index 00000000..c57ab581
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ReportMap.java
@@ -0,0 +1,445 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for ReportMap complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="ReportMap">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="markerColor" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="useDefaultSize" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="height" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="width" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="isMapAllowedYN" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="addAddressInDataYN" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="addressColumn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="dataColumn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="defaultMapType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="latColumn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="longColumn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="colorColumn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="legendColumn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="markers" type="{}Marker" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ReportMap", propOrder = {
+ "markerColor",
+ "useDefaultSize",
+ "height",
+ "width",
+ "isMapAllowedYN",
+ "addAddressInDataYN",
+ "addressColumn",
+ "dataColumn",
+ "defaultMapType",
+ "latColumn",
+ "longColumn",
+ "colorColumn",
+ "legendColumn",
+ "markers"
+})
+public class ReportMap {
+
+ protected String markerColor;
+ protected String useDefaultSize;
+ protected String height;
+ protected String width;
+ protected String isMapAllowedYN;
+ protected String addAddressInDataYN;
+ protected String addressColumn;
+ protected String dataColumn;
+ protected String defaultMapType;
+ protected String latColumn;
+ protected String longColumn;
+ protected String colorColumn;
+ protected String legendColumn;
+ protected List<Marker> markers;
+
+ /**
+ * Gets the value of the markerColor property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMarkerColor() {
+ return markerColor;
+ }
+
+ /**
+ * Sets the value of the markerColor property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMarkerColor(String value) {
+ this.markerColor = value;
+ }
+
+ /**
+ * Gets the value of the useDefaultSize property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getUseDefaultSize() {
+ return useDefaultSize;
+ }
+
+ /**
+ * Sets the value of the useDefaultSize property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setUseDefaultSize(String value) {
+ this.useDefaultSize = value;
+ }
+
+ /**
+ * Gets the value of the height property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getHeight() {
+ return height;
+ }
+
+ /**
+ * Sets the value of the height property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setHeight(String value) {
+ this.height = value;
+ }
+
+ /**
+ * Gets the value of the width property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getWidth() {
+ return width;
+ }
+
+ /**
+ * Sets the value of the width property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setWidth(String value) {
+ this.width = value;
+ }
+
+ /**
+ * Gets the value of the isMapAllowedYN property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIsMapAllowedYN() {
+ return isMapAllowedYN;
+ }
+
+ /**
+ * Sets the value of the isMapAllowedYN property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIsMapAllowedYN(String value) {
+ this.isMapAllowedYN = value;
+ }
+
+ /**
+ * Gets the value of the addAddressInDataYN property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAddAddressInDataYN() {
+ return addAddressInDataYN;
+ }
+
+ /**
+ * Sets the value of the addAddressInDataYN property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAddAddressInDataYN(String value) {
+ this.addAddressInDataYN = value;
+ }
+
+ /**
+ * Gets the value of the addressColumn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAddressColumn() {
+ return addressColumn;
+ }
+
+ /**
+ * Sets the value of the addressColumn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAddressColumn(String value) {
+ this.addressColumn = value;
+ }
+
+ /**
+ * Gets the value of the dataColumn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDataColumn() {
+ return dataColumn;
+ }
+
+ /**
+ * Sets the value of the dataColumn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDataColumn(String value) {
+ this.dataColumn = value;
+ }
+
+ /**
+ * Gets the value of the defaultMapType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDefaultMapType() {
+ return defaultMapType;
+ }
+
+ /**
+ * Sets the value of the defaultMapType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDefaultMapType(String value) {
+ this.defaultMapType = value;
+ }
+
+ /**
+ * Gets the value of the latColumn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLatColumn() {
+ return latColumn;
+ }
+
+ /**
+ * Sets the value of the latColumn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLatColumn(String value) {
+ this.latColumn = value;
+ }
+
+ /**
+ * Gets the value of the longColumn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLongColumn() {
+ return longColumn;
+ }
+
+ /**
+ * Sets the value of the longColumn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLongColumn(String value) {
+ this.longColumn = value;
+ }
+
+ /**
+ * Gets the value of the colorColumn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getColorColumn() {
+ return colorColumn;
+ }
+
+ /**
+ * Sets the value of the colorColumn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setColorColumn(String value) {
+ this.colorColumn = value;
+ }
+
+ /**
+ * Gets the value of the legendColumn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLegendColumn() {
+ return legendColumn;
+ }
+
+ /**
+ * Sets the value of the legendColumn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLegendColumn(String value) {
+ this.legendColumn = value;
+ }
+
+ /**
+ * Gets the value of the markers property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the markers property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getMarkers().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Marker }
+ *
+ *
+ */
+ public List<Marker> getMarkers() {
+ if (markers == null) {
+ markers = new ArrayList<Marker>();
+ }
+ return this.markers;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/Reports.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/Reports.java
new file mode 100644
index 00000000..fdb833d0
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/Reports.java
@@ -0,0 +1,113 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for Reports complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="Reports">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="reportId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="bgcolor" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "Reports", propOrder = {
+ "reportId",
+ "bgcolor"
+})
+public class Reports {
+
+ protected String reportId;
+ protected String bgcolor;
+
+ /**
+ * Gets the value of the reportId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getReportId() {
+ return reportId;
+ }
+
+ /**
+ * Sets the value of the reportId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setReportId(String value) {
+ this.reportId = value;
+ }
+
+ /**
+ * Gets the value of the bgcolor property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getBgcolor() {
+ return bgcolor;
+ }
+
+ /**
+ * Sets the value of the bgcolor property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setBgcolor(String value) {
+ this.bgcolor = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/SemaphoreList.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/SemaphoreList.java
new file mode 100644
index 00000000..12c426d4
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/SemaphoreList.java
@@ -0,0 +1,94 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for SemaphoreList complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="SemaphoreList">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="semaphore" type="{}SemaphoreType" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "SemaphoreList", propOrder = {
+ "semaphore"
+})
+public class SemaphoreList {
+
+ protected List<SemaphoreType> semaphore;
+
+ /**
+ * Gets the value of the semaphore property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the semaphore property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getSemaphore().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link SemaphoreType }
+ *
+ *
+ */
+ public List<SemaphoreType> getSemaphore() {
+ if (semaphore == null) {
+ semaphore = new ArrayList<SemaphoreType>();
+ }
+ return this.semaphore;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/SemaphoreType.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/SemaphoreType.java
new file mode 100644
index 00000000..61323a58
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/SemaphoreType.java
@@ -0,0 +1,227 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.06.07 at 02:07:29 PM EDT
+//
+
+
+package org.openecomp.portalsdk.analytics.xmlobj;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for SemaphoreType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="SemaphoreType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="semaphoreName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="semaphoreType" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element ref="{}comment" minOccurs="0"/>
+ * &lt;element name="target" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="formatList" type="{}FormatList"/>
+ * &lt;/sequence>
+ * &lt;attribute name="semaphoreId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "SemaphoreType", propOrder = {
+ "semaphoreName",
+ "semaphoreType",
+ "comment",
+ "target",
+ "formatList"
+})
+public class SemaphoreType {
+
+ @XmlElement(required = true)
+ protected String semaphoreName;
+ @XmlElement(required = true)
+ protected String semaphoreType;
+ protected String comment;
+ @XmlElement(required = true)
+ protected String target;
+ @XmlElement(required = true)
+ protected FormatList formatList;
+ @XmlAttribute(name = "semaphoreId")
+ protected String semaphoreId;
+
+ /**
+ * Gets the value of the semaphoreName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSemaphoreName() {
+ return semaphoreName;
+ }
+
+ /**
+ * Sets the value of the semaphoreName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSemaphoreName(String value) {
+ this.semaphoreName = value;
+ }
+
+ /**
+ * Gets the value of the semaphoreType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSemaphoreType() {
+ return semaphoreType;
+ }
+
+ /**
+ * Sets the value of the semaphoreType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSemaphoreType(String value) {
+ this.semaphoreType = value;
+ }
+
+ /**
+ * Gets the value of the comment property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ /**
+ * Sets the value of the comment property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setComment(String value) {
+ this.comment = value;
+ }
+
+ /**
+ * Gets the value of the target property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTarget() {
+ return target;
+ }
+
+ /**
+ * Sets the value of the target property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTarget(String value) {
+ this.target = value;
+ }
+
+ /**
+ * Gets the value of the formatList property.
+ *
+ * @return
+ * possible object is
+ * {@link FormatList }
+ *
+ */
+ public FormatList getFormatList() {
+ return formatList;
+ }
+
+ /**
+ * Sets the value of the formatList property.
+ *
+ * @param value
+ * allowed object is
+ * {@link FormatList }
+ *
+ */
+ public void setFormatList(FormatList value) {
+ this.formatList = value;
+ }
+
+ /**
+ * Gets the value of the semaphoreId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSemaphoreId() {
+ return semaphoreId;
+ }
+
+ /**
+ * Sets the value of the semaphoreId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSemaphoreId(String value) {
+ this.semaphoreId = value;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/.gitignore b/ecomp-sdk/sdk-app/.gitignore
new file mode 100644
index 00000000..b83d2226
--- /dev/null
+++ b/ecomp-sdk/sdk-app/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/ecomp-sdk/sdk-app/README.md b/ecomp-sdk/sdk-app/README.md
new file mode 100644
index 00000000..bdaf8a42
--- /dev/null
+++ b/ecomp-sdk/sdk-app/README.md
@@ -0,0 +1,14 @@
+Ecomp SDK Web App
+=================
+
+This is the ECOMP SDK web application. It includes java source files,
+as well as CSS, JavaScript, JSP and HTML files. The java code depends
+on the following ECOMP SDK libraries that are developed by the ECOMP
+Portal:
+
+* ECOMP SDK Framework library
+* ECOMP SDK Core library
+* ECOMP SDK Analytics library
+* ECOMP SDK Workflow library
+
+Use Apache Maven to build and package this webapp.
diff --git a/ecomp-sdk/sdk-app/db-scripts/EcompSdkDDLMySql_1610_Complete_OS.sql b/ecomp-sdk/sdk-app/db-scripts/EcompSdkDDLMySql_1610_Complete_OS.sql
new file mode 100644
index 00000000..a792b735
--- /dev/null
+++ b/ecomp-sdk/sdk-app/db-scripts/EcompSdkDDLMySql_1610_Complete_OS.sql
@@ -0,0 +1,1402 @@
+
+-- ---------------------------------------------------------------------------------------------------------------
+-- This is for the 1610 Version of SDK database called ecomp_sdk for Open Source
+
+-- Note to : Database Admin, set the MySQL system variable called lower_case_table_names
+
+-- It can be set 3 different ways:
+-- command-line options (Cmd-line),
+-- options valid in configuration files (Option file), or
+-- server system variables (System Var).
+
+-- It needs to be set to 1, then table names are stored in lowercase on disk and comparisons are not case sensitive.
+
+-- MySql/MariaDB Version compatibility information
+-- $ mysql --version
+-- mysql Ver 15.1 Distrib 5.5.35-MariaDB, for Linux (x86_64) using readline 5.1
+
+-- bash-4.2$ mysql --version – cluster version
+-- mysql Ver 15.1 Distrib 10.1.17-MariaDB, for Linux (x86_64) using readline 5.1
+
+-- All versions newer or older than these DO NOT necessarily mean they are compatible.
+-- ------------------------------------------------------------------------------------------------------------------
+
+SET FOREIGN_KEY_CHECKS=1;
+
+CREATE DATABASE ecomp_sdk_os;
+
+USE ecomp_sdk_os;
+
+-- ---------- create table SECTION
+--
+-- NAME: CR_FAVORITE_REPORTS; TYPE: TABLE
+--
+create table cr_favorite_reports (
+ USER_ID INTEGER NOT NULL,
+ REP_ID INTEGER NOT NULL
+);
+
+--
+-- NAME: CR_FILEHIST_LOG; TYPE: TABLE
+--
+create table cr_filehist_log (
+ SCHEDULE_ID NUMERIC(11,0) NOT NULL,
+ URL CHARACTER VARYING(4000),
+ NOTES CHARACTER VARYING(3500),
+ RUN_TIME TIMESTAMP
+);
+
+--
+-- NAME: CR_FOLDER; TYPE: TABLE
+--
+create table cr_folder (
+ FOLDER_ID INTEGER NOT NULL,
+ FOLDER_NAME CHARACTER VARYING(50) NOT NULL,
+ DESCR CHARACTER VARYING(500),
+ CREATE_ID INTEGER NOT NULL,
+ CREATE_DATE TIMESTAMP NOT NULL,
+ PARENT_FOLDER_ID INTEGER,
+ PUBLIC_YN CHARACTER VARYING(1) DEFAULT 'N' NOT NULL
+);
+
+--
+-- NAME: CR_FOLDER_ACCESS; TYPE: TABLE
+--
+create table cr_folder_access (
+ FOLDER_ACCESS_ID NUMERIC(11,0) NOT NULL,
+ FOLDER_ID NUMERIC(11,0) NOT NULL,
+ ORDER_NO NUMERIC(11,0) NOT NULL,
+ ROLE_ID NUMERIC(11,0),
+ USER_ID NUMERIC(11,0),
+ READ_ONLY_YN CHARACTER VARYING(1) DEFAULT 'N' NOT NULL
+);
+
+--
+-- NAME: CR_HIST_USER_MAP; TYPE: TABLE
+--
+create table cr_hist_user_map (
+ HIST_ID INT(11) NOT NULL,
+ USER_ID INT(11) NOT NULL
+);
+
+--
+-- NAME: CR_LU_FILE_TYPE; TYPE: TABLE
+--
+create table cr_lu_file_type (
+ LOOKUP_ID NUMERIC(2,0) NOT NULL,
+ LOOKUP_DESCR CHARACTER VARYING(255) NOT NULL,
+ ACTIVE_YN CHARACTER(1) DEFAULT 'Y',
+ ERROR_CODE NUMERIC(11,0)
+);
+
+--
+-- NAME: CR_RAPTOR_ACTION_IMG; TYPE: TABLE
+--
+create table cr_raptor_action_img (
+ IMAGE_ID CHARACTER VARYING(100) NOT NULL,
+ IMAGE_LOC CHARACTER VARYING(400)
+);
+
+--
+-- NAME: CR_RAPTOR_PDF_IMG; TYPE: TABLE
+--
+create table cr_raptor_pdf_img (
+ IMAGE_ID CHARACTER VARYING(100) NOT NULL,
+ IMAGE_LOC CHARACTER VARYING(400)
+);
+
+--
+-- NAME: CR_REMOTE_SCHEMA_INFO; TYPE: TABLE
+--
+create table cr_remote_schema_info (
+ SCHEMA_PREFIX CHARACTER VARYING(5) NOT NULL,
+ SCHEMA_DESC CHARACTER VARYING(75) NOT NULL,
+ DATASOURCE_TYPE CHARACTER VARYING(100)
+);
+
+--
+-- NAME: CR_REPORT; TYPE: TABLE
+--
+create table cr_report (
+ REP_ID NUMERIC(11,0) NOT NULL,
+ TITLE CHARACTER VARYING(100) NOT NULL,
+ DESCR CHARACTER VARYING(255),
+ PUBLIC_YN CHARACTER VARYING(1) DEFAULT 'N' NOT NULL,
+ REPORT_XML TEXT,
+ CREATE_ID NUMERIC(11,0),
+ CREATE_DATE TIMESTAMP default now(),
+ MAINT_ID NUMERIC(11,0),
+ MAINT_DATE TIMESTAMP DEFAULT NOW(),
+ MENU_ID CHARACTER VARYING(500),
+ MENU_APPROVED_YN CHARACTER VARYING(1) DEFAULT 'N' NOT NULL,
+ OWNER_ID NUMERIC(11,0),
+ FOLDER_ID INTEGER DEFAULT 0,
+ DASHBOARD_TYPE_YN CHARACTER VARYING(1) DEFAULT 'N',
+ DASHBOARD_YN CHARACTER VARYING(1) DEFAULT 'N'
+);
+
+--
+-- NAME: CR_REPORT_ACCESS; TYPE: TABLE
+--
+create table cr_report_access (
+ REP_ID NUMERIC(11,0) NOT NULL,
+ ORDER_NO NUMERIC(11,0) NOT NULL,
+ ROLE_ID NUMERIC(11,0),
+ USER_ID NUMERIC(11,0),
+ READ_ONLY_YN CHARACTER VARYING(1) DEFAULT 'N' NOT NULL
+);
+
+--
+-- NAME: CR_REPORT_DWNLD_LOG; TYPE: TABLE
+--
+create table cr_report_dwnld_log (
+ USER_ID NUMERIC(11,0) NOT NULL,
+ REP_ID INTEGER NOT NULL,
+ FILE_NAME CHARACTER VARYING(100) NOT NULL,
+ DWNLD_START_TIME TIMESTAMP DEFAULT NOW() NOT NULL,
+ RECORD_READY_TIME TIMESTAMP DEFAULT NOW(),
+ FILTER_PARAMS CHARACTER VARYING(2000)
+);
+
+--
+-- NAME: CR_REPORT_EMAIL_SENT_LOG; TYPE: TABLE
+--
+create table cr_report_email_sent_log (
+ LOG_ID INTEGER NOT NULL,
+ SCHEDULE_ID NUMERIC(11,0),
+ GEN_KEY CHARACTER VARYING(25) NOT NULL,
+ REP_ID NUMERIC(11,0) NOT NULL,
+ USER_ID NUMERIC(11,0),
+ SENT_DATE TIMESTAMP DEFAULT NOW(),
+ ACCESS_FLAG CHARACTER VARYING(1) DEFAULT 'Y' NOT NULL,
+ TOUCH_DATE TIMESTAMP DEFAULT NOW()
+);
+
+--
+-- NAME: CR_REPORT_FILE_HISTORY; TYPE: TABLE
+--
+create table cr_report_file_history (
+ HIST_ID INT(11) NOT NULL,
+ SCHED_USER_ID NUMERIC(11,0) NOT NULL,
+ SCHEDULE_ID NUMERIC(11,0) NOT NULL,
+ USER_ID NUMERIC(11,0) NOT NULL,
+ REP_ID NUMERIC(11,0),
+ RUN_DATE TIMESTAMP,
+ RECURRENCE CHARACTER VARYING(50),
+ FILE_TYPE_ID NUMERIC(2,0),
+ FILE_NAME CHARACTER VARYING(80),
+ FILE_BLOB BLOB,
+ FILE_SIZE NUMERIC(11,0),
+ RAPTOR_URL CHARACTER VARYING(4000),
+ ERROR_YN CHARACTER(1) DEFAULT 'N',
+ ERROR_CODE NUMERIC(11,0),
+ DELETED_YN CHARACTER(1) DEFAULT 'N',
+ DELETED_BY NUMERIC(38,0)
+);
+
+--
+-- NAME: CR_REPORT_LOG; TYPE: TABLE
+--
+create table cr_report_log (
+ REP_ID NUMERIC(11,0) NOT NULL,
+ LOG_TIME TIMESTAMP NOT NULL,
+ USER_ID NUMERIC(11,0) NOT NULL,
+ ACTION CHARACTER VARYING(2000) NOT NULL,
+ ACTION_VALUE CHARACTER VARYING(50),
+ FORM_FIELDS CHARACTER VARYING(4000)
+);
+
+--
+-- NAME: CR_REPORT_SCHEDULE; TYPE: TABLE
+--
+create table cr_report_schedule (
+ SCHEDULE_ID NUMERIC(11,0) NOT NULL,
+ SCHED_USER_ID NUMERIC(11,0) NOT NULL,
+ REP_ID NUMERIC(11,0) NOT NULL,
+ ENABLED_YN CHARACTER VARYING(1) NOT NULL,
+ START_DATE TIMESTAMP DEFAULT NOW(),
+ END_DATE TIMESTAMP DEFAULT NOW(),
+ RUN_DATE TIMESTAMP DEFAULT NOW(),
+ RECURRENCE CHARACTER VARYING(50),
+ CONDITIONAL_YN CHARACTER VARYING(1) NOT NULL,
+ CONDITION_SQL CHARACTER VARYING(4000),
+ NOTIFY_TYPE INTEGER DEFAULT 0,
+ MAX_ROW INTEGER DEFAULT 1000,
+ INITIAL_FORMFIELDS CHARACTER VARYING(3500),
+ PROCESSED_FORMFIELDS CHARACTER VARYING(3500),
+ FORMFIELDS CHARACTER VARYING(3500),
+ CONDITION_LARGE_SQL TEXT,
+ ENCRYPT_YN CHARACTER(1) DEFAULT 'N',
+ ATTACHMENT_YN CHARACTER(1) DEFAULT 'Y'
+);
+
+--
+-- NAME: CR_REPORT_SCHEDULE_USERS; TYPE: TABLE
+--
+create table cr_report_schedule_users (
+ SCHEDULE_ID NUMERIC(11,0) NOT NULL,
+ REP_ID NUMERIC(11,0) NOT NULL,
+ USER_ID NUMERIC(11,0) NOT NULL,
+ ROLE_ID NUMERIC(11,0),
+ ORDER_NO NUMERIC(11,0) NOT NULL
+);
+
+--
+-- NAME: CR_REPORT_TEMPLATE_MAP; TYPE: TABLE
+--
+create table cr_report_template_map (
+ REPORT_ID INTEGER NOT NULL,
+ TEMPLATE_FILE CHARACTER VARYING(200)
+);
+
+--
+-- NAME: CR_SCHEDULE_ACTIVITY_LOG; TYPE: TABLE
+--
+create table cr_schedule_activity_log (
+ SCHEDULE_ID NUMERIC(11,0) NOT NULL,
+ URL CHARACTER VARYING(4000),
+ NOTES CHARACTER VARYING(2000),
+ RUN_TIME TIMESTAMP
+);
+
+--
+-- NAME: CR_TABLE_JOIN; TYPE: TABLE
+--
+create table cr_table_join (
+ SRC_TABLE_NAME CHARACTER VARYING(30) NOT NULL,
+ DEST_TABLE_NAME CHARACTER VARYING(30) NOT NULL,
+ JOIN_EXPR CHARACTER VARYING(500) NOT NULL
+);
+
+--
+-- NAME: CR_TABLE_ROLE; TYPE: TABLE
+--
+create table cr_table_role (
+ TABLE_NAME CHARACTER VARYING(30) NOT NULL,
+ ROLE_ID NUMERIC(11,0) NOT NULL
+);
+
+--
+-- NAME: CR_TABLE_SOURCE; TYPE: TABLE
+--
+create table cr_table_source (
+ TABLE_NAME CHARACTER VARYING(30) NOT NULL,
+ DISPLAY_NAME CHARACTER VARYING(30) NOT NULL,
+ PK_FIELDS CHARACTER VARYING(200),
+ WEB_VIEW_ACTION CHARACTER VARYING(50),
+ LARGE_DATA_SOURCE_YN CHARACTER VARYING(1) DEFAULT 'N' NOT NULL,
+ FILTER_SQL CHARACTER VARYING(4000),
+ SOURCE_DB CHARACTER VARYING(50)
+);
+
+--
+-- NAME: FN_LU_TIMEZONE; TYPE: TABLE
+--
+create table fn_lu_timezone (
+ TIMEZONE_ID INT(11) NOT NULL,
+ TIMEZONE_NAME CHARACTER VARYING(100) NOT NULL,
+ TIMEZONE_VALUE CHARACTER VARYING(100) NOT NULL
+);
+
+create table fn_user (
+ USER_ID INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ ORG_ID INT(11),
+ MANAGER_ID INT(11),
+ FIRST_NAME CHARACTER VARYING(25),
+ MIDDLE_NAME CHARACTER VARYING(25),
+ LAST_NAME CHARACTER VARYING(25),
+ PHONE CHARACTER VARYING(25),
+ FAX CHARACTER VARYING(25),
+ CELLULAR CHARACTER VARYING(25),
+ EMAIL CHARACTER VARYING(50),
+ ADDRESS_ID NUMERIC(11,0),
+ ALERT_METHOD_CD CHARACTER VARYING(10),
+ HRID CHARACTER VARYING(20),
+ ORG_USER_ID CHARACTER VARYING(20),
+ ORG_CODE CHARACTER VARYING(30),
+ LOGIN_ID CHARACTER VARYING(25),
+ LOGIN_PWD CHARACTER VARYING(25),
+ LAST_LOGIN_DATE TIMESTAMP,
+ ACTIVE_YN CHARACTER VARYING(1) DEFAULT 'Y' NOT NULL,
+ CREATED_ID INT(11),
+ CREATED_DATE TIMESTAMP DEFAULT NOW(),
+ MODIFIED_ID INT(11),
+ MODIFIED_DATE TIMESTAMP default now(),
+ IS_INTERNAL_YN CHARACTER(1) DEFAULT 'N' NOT NULL,
+ ADDRESS_LINE_1 CHARACTER VARYING(100),
+ ADDRESS_LINE_2 CHARACTER VARYING(100),
+ CITY CHARACTER VARYING(50),
+ STATE_CD CHARACTER VARYING(3),
+ ZIP_CODE CHARACTER VARYING(11),
+ COUNTRY_CD CHARACTER VARYING(3),
+ LOCATION_CLLI CHARACTER VARYING(8),
+ ORG_MANAGER_USERID CHARACTER VARYING(20),
+ COMPANY CHARACTER VARYING(100),
+ DEPARTMENT_NAME CHARACTER VARYING(100),
+ JOB_TITLE CHARACTER VARYING(100),
+ TIMEZONE INT(11),
+ DEPARTMENT CHARACTER VARYING(25),
+ BUSINESS_UNIT CHARACTER VARYING(25),
+ BUSINESS_UNIT_NAME CHARACTER VARYING(100),
+ COST_CENTER CHARACTER VARYING(25),
+ FIN_LOC_CODE CHARACTER VARYING(10),
+ SILO_STATUS CHARACTER VARYING(10)
+);
+
+--
+-- NAME: FN_ROLE; TYPE: TABLE
+--
+create table fn_role (
+ ROLE_ID INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ ROLE_NAME CHARACTER VARYING(50) NOT NULL,
+ ACTIVE_YN CHARACTER VARYING(1) DEFAULT 'Y' NOT NULL,
+ PRIORITY NUMERIC(4,0)
+);
+
+--
+-- NAME: FN_AUDIT_ACTION; TYPE: TABLE
+--
+create table fn_audit_action (
+ AUDIT_ACTION_ID INTEGER NOT NULL,
+ CLASS_NAME CHARACTER VARYING(500) NOT NULL,
+ METHOD_NAME CHARACTER VARYING(50) NOT NULL,
+ AUDIT_ACTION_CD CHARACTER VARYING(20) NOT NULL,
+ AUDIT_ACTION_DESC CHARACTER VARYING(200),
+ ACTIVE_YN CHARACTER VARYING(1)
+);
+
+--
+-- NAME: FN_AUDIT_ACTION_LOG; TYPE: TABLE
+--
+create table fn_audit_action_log (
+ AUDIT_LOG_ID INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ AUDIT_ACTION_CD CHARACTER VARYING(200),
+ ACTION_TIME TIMESTAMP,
+ USER_ID NUMERIC(11,0),
+ CLASS_NAME CHARACTER VARYING(100),
+ METHOD_NAME CHARACTER VARYING(50),
+ SUCCESS_MSG CHARACTER VARYING(20),
+ ERROR_MSG CHARACTER VARYING(500)
+);
+
+--
+-- NAME: FN_LU_ACTIVITY; TYPE: TABLE
+--
+create table fn_lu_activity (
+ ACTIVITY_CD CHARACTER VARYING(50) NOT NULL PRIMARY KEY,
+ ACTIVITY CHARACTER VARYING(50) NOT NULL
+);
+
+--
+-- NAME: FN_AUDIT_LOG; TYPE: TABLE
+--
+create table fn_audit_log (
+ LOG_ID INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ USER_ID INT(11) NOT NULL,
+ ACTIVITY_CD CHARACTER VARYING(50) NOT NULL,
+ AUDIT_DATE TIMESTAMP DEFAULT NOW() NOT NULL,
+ COMMENTS CHARACTER VARYING(1000),
+ AFFECTED_RECORD_ID_BK CHARACTER VARYING(500),
+ AFFECTED_RECORD_ID CHARACTER VARYING(4000),
+ CONSTRAINT FK_FN_AUDIT_REF_209_FN_USER FOREIGN KEY (USER_ID) REFERENCES FN_USER(USER_ID)
+);
+
+--
+-- NAME: FN_BROADCAST_MESSAGE; TYPE: TABLE
+--
+create table fn_broadcast_message (
+ MESSAGE_ID INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ MESSAGE_TEXT CHARACTER VARYING(1000) NOT NULL,
+ MESSAGE_LOCATION_ID NUMERIC(11,0) NOT NULL,
+ BROADCAST_START_DATE TIMESTAMP NOT NULL DEFAULT NOW(),
+ BROADCAST_END_DATE TIMESTAMP NOT NULL DEFAULT NOW(),
+ ACTIVE_YN CHARACTER(1) DEFAULT 'Y' NOT NULL,
+ SORT_ORDER NUMERIC(4,0) NOT NULL,
+ BROADCAST_SITE_CD CHARACTER VARYING(50)
+);
+
+--
+-- NAME: FN_CHAT_LOGS; TYPE: TABLE
+--
+create table fn_chat_logs (
+ CHAT_LOG_ID INTEGER NOT NULL,
+ CHAT_ROOM_ID INTEGER,
+ USER_ID INTEGER,
+ MESSAGE CHARACTER VARYING(1000),
+ MESSAGE_DATE_TIME TIMESTAMP
+);
+
+--
+-- NAME: FN_CHAT_ROOM; TYPE: TABLE
+--
+create table fn_chat_room (
+ CHAT_ROOM_ID INTEGER NOT NULL,
+ NAME CHARACTER VARYING(50) NOT NULL,
+ DESCRIPTION CHARACTER VARYING(500),
+ OWNER_ID INTEGER,
+ CREATED_DATE TIMESTAMP DEFAULT NOW(),
+ UPDATED_DATE TIMESTAMP DEFAULT NOW()
+);
+
+--
+-- NAME: FN_CHAT_USERS; TYPE: TABLE
+--
+create table fn_chat_users (
+ CHAT_ROOM_ID INTEGER,
+ USER_ID INTEGER,
+ LAST_ACTIVITY_DATE_TIME TIMESTAMP,
+ CHAT_STATUS CHARACTER VARYING(20),
+ ID INTEGER NOT NULL
+);
+
+--
+-- NAME: FN_DATASOURCE; TYPE: TABLE
+--
+create table fn_datasource (
+ ID INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ NAME CHARACTER VARYING(50),
+ DRIVER_NAME CHARACTER VARYING(256),
+ SERVER CHARACTER VARYING(256),
+ PORT INTEGER,
+ USER_NAME CHARACTER VARYING(256),
+ PASSWORD CHARACTER VARYING(256),
+ URL CHARACTER VARYING(256),
+ MIN_POOL_SIZE INTEGER,
+ MAX_POOL_SIZE INTEGER,
+ ADAPTER_ID INTEGER,
+ DS_TYPE CHARACTER VARYING(20)
+);
+
+--
+-- NAME: FN_FUNCTION; TYPE: TABLE
+--
+create table fn_function (
+ FUNCTION_CD CHARACTER VARYING(30) NOT NULL PRIMARY KEY,
+ FUNCTION_NAME CHARACTER VARYING(50) NOT NULL
+);
+
+--
+-- NAME: FN_LU_ALERT_METHOD; TYPE: TABLE
+--
+create table fn_lu_alert_method (
+ ALERT_METHOD_CD CHARACTER VARYING(10) NOT NULL,
+ ALERT_METHOD CHARACTER VARYING(50) NOT NULL
+);
+
+--
+-- NAME: FN_LU_BROADCAST_SITE; TYPE: TABLE
+--
+create table fn_lu_broadcast_site (
+ BROADCAST_SITE_CD CHARACTER VARYING(50) NOT NULL,
+ BROADCAST_SITE_DESCR CHARACTER VARYING(100)
+);
+--
+-- NAME: FN_LU_MENU_SET; TYPE: TABLE
+--
+create table fn_lu_menu_set (
+ MENU_SET_CD CHARACTER VARYING(10) NOT NULL PRIMARY KEY,
+ MENU_SET_NAME CHARACTER VARYING(50) NOT NULL
+);
+
+--
+-- NAME: FN_LU_PRIORITY; TYPE: TABLE
+--
+create table fn_lu_priority (
+ PRIORITY_ID NUMERIC(11,0) NOT NULL,
+ PRIORITY CHARACTER VARYING(50) NOT NULL,
+ ACTIVE_YN CHARACTER(1) NOT NULL,
+ SORT_ORDER NUMERIC(5,0)
+);
+
+--
+-- NAME: FN_LU_ROLE_TYPE; TYPE: TABLE
+--
+create table fn_lu_role_type (
+ ROLE_TYPE_ID NUMERIC(11,0) NOT NULL,
+ ROLE_TYPE CHARACTER VARYING(50) NOT NULL
+);
+--
+-- NAME: FN_LU_TAB_SET; TYPE: TABLE
+--
+create table fn_lu_tab_set (
+ TAB_SET_CD CHARACTER VARYING(30) NOT NULL,
+ TAB_SET_NAME CHARACTER VARYING(50) NOT NULL
+);
+
+--
+-- NAME: FN_MENU; TYPE: TABLE
+--
+create table fn_menu (
+ MENU_ID INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ LABEL CHARACTER VARYING(100),
+ PARENT_ID INT(11),
+ SORT_ORDER NUMERIC(4,0),
+ ACTION CHARACTER VARYING(200),
+ FUNCTION_CD CHARACTER VARYING(30),
+ ACTIVE_YN CHARACTER VARYING(1) DEFAULT 'Y' NOT NULL,
+ SERVLET CHARACTER VARYING(50),
+ QUERY_STRING CHARACTER VARYING(200),
+ EXTERNAL_URL CHARACTER VARYING(200),
+ TARGET CHARACTER VARYING(25),
+ MENU_SET_CD CHARACTER VARYING(10) DEFAULT 'APP',
+ SEPARATOR_YN CHARACTER(1) DEFAULT 'N',
+ IMAGE_SRC CHARACTER VARYING(100),
+ CONSTRAINT FK_FN_MENU_REF_196_FN_MENU FOREIGN KEY (PARENT_ID) REFERENCES FN_MENU(MENU_ID),
+ CONSTRAINT FK_FN_MENU_MENU_SET_CD FOREIGN KEY (MENU_SET_CD) REFERENCES FN_LU_MENU_SET(MENU_SET_CD),
+ CONSTRAINT FK_FN_MENU_REF_223_FN_FUNCT FOREIGN KEY (FUNCTION_CD) REFERENCES FN_FUNCTION(FUNCTION_CD)
+);
+
+--
+-- NAME: FN_ORG; TYPE: TABLE
+--
+create table fn_org (
+ ORG_ID INT(11) NOT NULL,
+ ORG_NAME CHARACTER VARYING(50) NOT NULL,
+ ACCESS_CD CHARACTER VARYING(10)
+);
+
+--
+-- NAME: FN_RESTRICTED_URL; TYPE: TABLE
+--
+create table fn_restricted_url (
+ RESTRICTED_URL CHARACTER VARYING(250) NOT NULL,
+ FUNCTION_CD CHARACTER VARYING(30) NOT NULL
+);
+
+--
+-- NAME: FN_ROLE_COMPOSITE; TYPE: TABLE
+--
+create table fn_role_composite (
+ PARENT_ROLE_ID INT(11) NOT NULL,
+ CHILD_ROLE_ID INT(11) NOT NULL,
+ CONSTRAINT FK_FN_ROLE_COMPOSITE_CHILD FOREIGN KEY (CHILD_ROLE_ID) REFERENCES FN_ROLE(ROLE_ID),
+ CONSTRAINT FK_FN_ROLE_COMPOSITE_PARENT FOREIGN KEY (PARENT_ROLE_ID) REFERENCES FN_ROLE(ROLE_ID)
+);
+
+--
+-- NAME: FN_ROLE_FUNCTION; TYPE: TABLE
+--
+create table fn_role_function (
+ ROLE_ID INT(11) NOT NULL,
+ FUNCTION_CD CHARACTER VARYING(30) NOT NULL,
+ CONSTRAINT FK_FN_ROLE__REF_198_FN_ROLE FOREIGN KEY (ROLE_ID) REFERENCES FN_ROLE(ROLE_ID)
+);
+
+--
+-- NAME: FN_TAB; TYPE: TABLE
+--
+create table fn_tab (
+ TAB_CD CHARACTER VARYING(30) NOT NULL,
+ TAB_NAME CHARACTER VARYING(50) NOT NULL,
+ TAB_DESCR CHARACTER VARYING(100),
+ ACTION CHARACTER VARYING(100) NOT NULL,
+ FUNCTION_CD CHARACTER VARYING(30) NOT NULL,
+ ACTIVE_YN CHARACTER(1) NOT NULL,
+ SORT_ORDER NUMERIC(11,0) NOT NULL,
+ PARENT_TAB_CD CHARACTER VARYING(30),
+ TAB_SET_CD CHARACTER VARYING(30)
+);
+
+--
+-- NAME: FN_TAB_SELECTED; TYPE: TABLE
+--
+create table fn_tab_selected (
+ SELECTED_TAB_CD CHARACTER VARYING(30) NOT NULL,
+ TAB_URI CHARACTER VARYING(40) NOT NULL
+);
+
+--
+-- NAME: FN_USER_PSEUDO_ROLE; TYPE: TABLE
+--
+create table fn_user_pseudo_role (
+ PSEUDO_ROLE_ID INT(11) NOT NULL,
+ USER_ID INT(11) NOT NULL
+);
+
+--
+-- NAME: FN_USER_ROLE; TYPE: TABLE
+--
+create table fn_user_role (
+ USER_ID INT(10) NOT NULL,
+ ROLE_ID INT(10) NOT NULL,
+ PRIORITY NUMERIC(4,0),
+ APP_ID INT(11) DEFAULT 1,
+ CONSTRAINT FK_FN_USER__REF_172_FN_USER FOREIGN KEY (USER_ID) REFERENCES FN_USER(USER_ID),
+ CONSTRAINT FK_FN_USER__REF_175_FN_ROLE FOREIGN KEY (ROLE_ID) REFERENCES FN_ROLE(ROLE_ID)
+);
+--
+-- NAME: SCHEMA_INFO; TYPE: TABLE
+--
+create table schema_info (
+ SCHEMA_ID CHARACTER VARYING(25) NOT NULL,
+ SCHEMA_DESC CHARACTER VARYING(75) NOT NULL,
+ DATASOURCE_TYPE CHARACTER VARYING(100),
+ CONNECTION_URL VARCHAR(200) NOT NULL,
+ USER_NAME VARCHAR(45) NOT NULL,
+ PASSWORD VARCHAR(45) NULL DEFAULT NULL,
+ DRIVER_CLASS VARCHAR(100) NOT NULL,
+ MIN_POOL_SIZE INT NOT NULL,
+ MAX_POOL_SIZE INT NOT NULL,
+ IDLE_CONNECTION_TEST_PERIOD INT NOT NULL
+
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_APP; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_app (
+ APP_ID int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
+ APP_NAME varchar(100) NOT NULL DEFAULT '?',
+ APP_IMAGE_URL varchar(256) DEFAULT NULL,
+ APP_DESCRIPTION varchar(512) DEFAULT NULL,
+ APP_NOTES varchar(4096) DEFAULT NULL,
+ APP_URL varchar(256) DEFAULT NULL,
+ APP_ALTERNATE_URL varchar(256) DEFAULT NULL,
+ APP_REST_ENDPOINT varchar(2000) DEFAULT NULL,
+ ML_APP_NAME varchar(50) NOT NULL DEFAULT '?',
+ ML_APP_ADMIN_ID varchar(7) NOT NULL DEFAULT '?',
+ MOTS_ID int(11) DEFAULT NULL,
+ APP_PASSWORD varchar(256) NOT NULL DEFAULT '?',
+ OPEN char(1) DEFAULT 'N',
+ ENABLED char(1) DEFAULT 'Y',
+ THUMBNAIL mediumblob,
+ APP_USERNAME varchar(50),
+ UEB_KEY VARCHAR(256) DEFAULT NULL,
+ UEB_SECRET VARCHAR(256) DEFAULT NULL,
+ UEB_TOPIC_NAME VARCHAR(256) DEFAULT NULL
+
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_FN_WORKFLOW; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_workflow (
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
+ name varchar(20) NOT NULL,
+ description varchar(500) DEFAULT NULL,
+ run_link varchar(300) DEFAULT NULL,
+ suspend_link varchar(300) DEFAULT NULL,
+ modified_link varchar(300) DEFAULT NULL,
+ active_yn varchar(300) DEFAULT NULL,
+ created varchar(300) DEFAULT NULL,
+ created_by int(11) DEFAULT NULL,
+ modified varchar(300) DEFAULT NULL,
+ modified_by int(11) DEFAULT NULL,
+ workflow_key varchar(50) DEFAULT NULL,
+ PRIMARY KEY (id),
+ UNIQUE KEY name (name)
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_SCHEDULE_WORKFLOWS; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_schedule_workflows (
+ id_schedule_workflows bigint(25) PRIMARY KEY NOT NULL AUTO_INCREMENT,
+ workflow_server_url varchar(45) DEFAULT NULL,
+ workflow_key varchar(45) NOT NULL,
+ workflow_arguments varchar(45) DEFAULT NULL,
+ startDateTimeCron varchar(45) DEFAULT NULL,
+ endDateTime TIMESTAMP DEFAULT NOW(),
+ start_date_time TIMESTAMP DEFAULT NOW(),
+ recurrence varchar(45) DEFAULT NULL
+ );
+
+-- For demo reporting application add : demo_bar_chart, demo_bar_chart_inter, demo_line_chart, demo_pie_chart and demo_util_chart
+-- demo_scatter_chart, demo_scatter_plot
+-- ----------------------------------------------------------
+-- NAME: DEMO_BAR_CHART; TYPE: TABLE
+-- ----------------------------------------------------------
+create table demo_bar_chart (
+ label varchar(20),
+ value numeric(25,15)
+ );
+
+-- ----------------------------------------------------------
+-- NAME: DEMO_BAR_CHART_INTER; TYPE: TABLE
+-- ----------------------------------------------------------
+create table demo_bar_chart_inter (
+ spam_date date,
+ num_rpt_sources numeric(10,0),
+ num_det_sources numeric(10,0)
+ );
+
+-- ----------------------------------------------------------
+-- NAME: DEMO_LINE_CHART; TYPE: TABLE
+-- ----------------------------------------------------------
+create table demo_line_chart (
+ series varchar(20),
+ log_date date,
+ data_value numeric(10,5)
+ );
+
+-- ----------------------------------------------------------
+-- NAME: DEMO_PIE_CHART; TYPE: TABLE
+-- ----------------------------------------------------------
+create table demo_pie_chart (
+ legend varchar(20),
+ data_value numeric(10,5)
+ );
+
+-- ----------------------------------------------------------
+-- NAME: DEMO_UTIL_CHART; TYPE: TABLE
+-- ----------------------------------------------------------
+create table demo_util_chart (
+ traffic_date date,
+ util_perc numeric(10,5)
+ );
+
+-- ----------------------------------------------------------
+-- NAME: DEMO_SCATTER_CHART; TYPE: TABLE
+-- ----------------------------------------------------------
+create table demo_scatter_chart (
+ rainfall numeric(10,2),
+ key_value varchar(20),
+ measurements numeric(10,2)
+);
+
+-- ----------------------------------------------------------
+-- NAME: DEMO_SCATTER_PLOT; TYPE: TABLE
+-- ----------------------------------------------------------
+create table demo_scatter_plot
+(
+ SERIES VARCHAR(20),
+ VALUEX numeric(25,15),
+ VALUEY numeric(25,15)
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_QZ_JOB_DETAILS; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_qz_job_details (
+SCHED_NAME VARCHAR(120) NOT NULL,
+JOB_NAME VARCHAR(200) NOT NULL,
+JOB_GROUP VARCHAR(200) NOT NULL,
+DESCRIPTION VARCHAR(250) NULL,
+JOB_CLASS_NAME VARCHAR(250) NOT NULL,
+IS_DURABLE VARCHAR(1) NOT NULL,
+IS_NONCONCURRENT VARCHAR(1) NOT NULL,
+IS_UPDATE_DATA VARCHAR(1) NOT NULL,
+REQUESTS_RECOVERY VARCHAR(1) NOT NULL,
+JOB_DATA BLOB NULL,
+PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_QZ_TRIGGERS; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_qz_triggers (
+SCHED_NAME VARCHAR(120) NOT NULL,
+TRIGGER_NAME VARCHAR(200) NOT NULL,
+TRIGGER_GROUP VARCHAR(200) NOT NULL,
+JOB_NAME VARCHAR(200) NOT NULL,
+JOB_GROUP VARCHAR(200) NOT NULL,
+DESCRIPTION VARCHAR(250) NULL,
+NEXT_FIRE_TIME BIGINT(13) NULL,
+PREV_FIRE_TIME BIGINT(13) NULL,
+PRIORITY INTEGER NULL,
+TRIGGER_STATE VARCHAR(16) NOT NULL,
+TRIGGER_TYPE VARCHAR(8) NOT NULL,
+START_TIME BIGINT(13) NOT NULL,
+END_TIME BIGINT(13) NULL,
+CALENDAR_NAME VARCHAR(200) NULL,
+MISFIRE_INSTR SMALLINT(2) NULL,
+JOB_DATA BLOB NULL,
+PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
+FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
+REFERENCES FN_QZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_QZ_SIMPLE_TRIGGERS; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_qz_simple_triggers (
+SCHED_NAME VARCHAR(120) NOT NULL,
+TRIGGER_NAME VARCHAR(200) NOT NULL,
+TRIGGER_GROUP VARCHAR(200) NOT NULL,
+REPEAT_COUNT BIGINT(7) NOT NULL,
+REPEAT_INTERVAL BIGINT(12) NOT NULL,
+TIMES_TRIGGERED BIGINT(10) NOT NULL,
+PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
+FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+REFERENCES FN_QZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_QZ_CRON_TRIGGERS; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_qz_cron_triggers (
+SCHED_NAME VARCHAR(120) NOT NULL,
+TRIGGER_NAME VARCHAR(200) NOT NULL,
+TRIGGER_GROUP VARCHAR(200) NOT NULL,
+CRON_EXPRESSION VARCHAR(120) NOT NULL,
+TIME_ZONE_ID VARCHAR(80),
+PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
+FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+REFERENCES FN_QZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_QZ_SIMPROP_TRIGGERS; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_qz_simprop_triggers
+ (
+ SCHED_NAME VARCHAR(120) NOT NULL,
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ STR_PROP_1 VARCHAR(512) NULL,
+ STR_PROP_2 VARCHAR(512) NULL,
+ STR_PROP_3 VARCHAR(512) NULL,
+ INT_PROP_1 INT NULL,
+ INT_PROP_2 INT NULL,
+ LONG_PROP_1 BIGINT NULL,
+ LONG_PROP_2 BIGINT NULL,
+ DEC_PROP_1 NUMERIC(13,4) NULL,
+ DEC_PROP_2 NUMERIC(13,4) NULL,
+ BOOL_PROP_1 VARCHAR(1) NULL,
+ BOOL_PROP_2 VARCHAR(1) NULL,
+ PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES FN_QZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_QZ_BLOB_TRIGGERS; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_qz_blob_triggers (
+SCHED_NAME VARCHAR(120) NOT NULL,
+TRIGGER_NAME VARCHAR(200) NOT NULL,
+TRIGGER_GROUP VARCHAR(200) NOT NULL,
+BLOB_DATA BLOB NULL,
+PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
+INDEX (SCHED_NAME,TRIGGER_NAME, TRIGGER_GROUP),
+FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+REFERENCES FN_QZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_QZ_CALENDARS; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_qz_calendars (
+SCHED_NAME VARCHAR(120) NOT NULL,
+CALENDAR_NAME VARCHAR(200) NOT NULL,
+CALENDAR BLOB NOT NULL,
+PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_QZ_PAUSED_TRIGGER_GRPS; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_qz_paused_trigger_grps (
+SCHED_NAME VARCHAR(120) NOT NULL,
+TRIGGER_GROUP VARCHAR(200) NOT NULL,
+PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_QZ_FIRED_TRIGGERS; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_qz_fired_triggers (
+SCHED_NAME VARCHAR(120) NOT NULL,
+ENTRY_ID VARCHAR(95) NOT NULL,
+TRIGGER_NAME VARCHAR(200) NOT NULL,
+TRIGGER_GROUP VARCHAR(200) NOT NULL,
+INSTANCE_NAME VARCHAR(200) NOT NULL,
+FIRED_TIME BIGINT(13) NOT NULL,
+SCHED_TIME BIGINT(13) NOT NULL,
+PRIORITY INTEGER NOT NULL,
+STATE VARCHAR(16) NOT NULL,
+JOB_NAME VARCHAR(200) NULL,
+JOB_GROUP VARCHAR(200) NULL,
+IS_NONCONCURRENT VARCHAR(1) NULL,
+REQUESTS_RECOVERY VARCHAR(1) NULL,
+PRIMARY KEY (SCHED_NAME,ENTRY_ID)
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_QZ_SCHEDULER_STATE; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_qz_scheduler_state (
+SCHED_NAME VARCHAR(120) NOT NULL,
+INSTANCE_NAME VARCHAR(200) NOT NULL,
+LAST_CHECKIN_TIME BIGINT(13) NOT NULL,
+CHECKIN_INTERVAL BIGINT(13) NOT NULL,
+PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)
+);
+
+-- ----------------------------------------------------------
+-- NAME: FN_QZ_LOCKS; TYPE: TABLE
+-- ----------------------------------------------------------
+create table fn_qz_locks (
+SCHED_NAME VARCHAR(120) NOT NULL,
+LOCK_NAME VARCHAR(40) NOT NULL,
+PRIMARY KEY (SCHED_NAME,LOCK_NAME)
+);
+
+--
+-- name: rcloudinvocation; type: table
+--
+create table rcloudinvocation (
+ id varchar(128) not null primary key,
+ created timestamp not null,
+ userinfo varchar(2048) not null,
+ notebookid varchar(128) not null,
+ parameters varchar(2048) default null,
+ tokenreaddate timestamp null
+);
+
+--
+-- name: rcloudnotebook; type: table
+--
+create table rcloudnotebook (
+ notebookname varchar(128) not null primary key,
+ notebookid varchar(128) not null
+);
+
+--
+-- Name: fn_lu_message_location; Type: TABLE
+--
+
+CREATE TABLE fn_lu_message_location (
+ message_location_id numeric(11,0) NOT NULL,
+ message_location_descr character varying(30) NOT NULL
+);
+
+-- ------------------ CREATE VIEW SECTION
+--
+-- NAME: V_URL_ACCESS; TYPE: VIEW
+--
+CREATE VIEW v_url_access AS
+ SELECT DISTINCT M.ACTION AS URL,
+ M.FUNCTION_CD
+ FROM FN_MENU M
+ WHERE (M.ACTION IS NOT NULL)
+UNION
+ SELECT DISTINCT T.ACTION AS URL,
+ T.FUNCTION_CD
+ FROM FN_TAB T
+ WHERE (T.ACTION IS NOT NULL)
+UNION
+ SELECT R.RESTRICTED_URL AS URL,
+ R.FUNCTION_CD
+ FROM FN_RESTRICTED_URL R;
+
+-- ------------------ ALTER TABLE ADD CONSTRAINT PRIMARY KEY SECTION
+--
+-- NAME: CR_FAVORITE_REPORTS_USER_IDREP_ID; TYPE: CONSTRAINT
+--
+alter table cr_favorite_reports
+ add constraint cr_favorite_reports_user_idrep_id primary key (user_id, rep_id);
+--
+-- NAME: CR_FOLDER_FOLDER_ID; TYPE: CONSTRAINT
+--
+alter table cr_folder
+ add constraint cr_folder_folder_id primary key (folder_id);
+--
+-- NAME: CR_FOLDER_ACCESS_FOLDER_ACCESS_ID; TYPE: CONSTRAINT
+--
+alter table cr_folder_access
+ add constraint cr_folder_access_folder_access_id primary key (folder_access_id);
+--
+-- NAME: CR_HIST_USER_MAP_HIST_IDUSER_ID; TYPE: CONSTRAINT
+--
+alter table cr_hist_user_map
+ add constraint cr_hist_user_map_hist_iduser_id primary key (hist_id, user_id);
+--
+-- NAME: CR_LU_FILE_TYPE_LOOKUP_ID; TYPE: CONSTRAINT
+--
+alter table cr_lu_file_type
+ add constraint cr_lu_file_type_lookup_id primary key (lookup_id);
+--
+-- NAME: CR_RAPTOR_ACTION_IMG_IMAGE_ID; TYPE: CONSTRAINT
+--
+alter table cr_raptor_action_img
+ add constraint cr_raptor_action_img_image_id primary key (image_id);
+--
+-- NAME: CR_RAPTOR_PDF_IMG_IMAGE_ID; TYPE: CONSTRAINT
+--
+alter table cr_raptor_pdf_img
+ add constraint cr_raptor_pdf_img_image_id primary key (image_id);
+--
+-- NAME: CR_REMOTE_SCHEMA_INFO_SCHEMA_PREFIX; TYPE: CONSTRAINT
+--
+alter table cr_remote_schema_info
+ add constraint cr_remote_schema_info_schema_prefix primary key (schema_prefix);
+--
+-- NAME: CR_REPORT_REP_ID; TYPE: CONSTRAINT
+--
+alter table cr_report
+ add constraint cr_report_rep_id primary key (rep_id);
+--
+-- NAME: CR_REPORT_ACCESS_REP_IDORDER_NO; TYPE: CONSTRAINT
+--
+alter table cr_report_access
+ add constraint cr_report_access_rep_idorder_no primary key (rep_id, order_no);
+--
+-- NAME: CR_REPORT_EMAIL_SENT_LOG_LOG_ID; TYPE: CONSTRAINT
+--
+alter table cr_report_email_sent_log
+ add constraint cr_report_email_sent_log_log_id primary key (log_id);
+--
+-- NAME: CR_REPORT_FILE_HISTORY_HIST_ID; TYPE: CONSTRAINT
+--
+alter table cr_report_file_history
+ add constraint cr_report_file_history_hist_id primary key (hist_id);
+--
+-- NAME: CR_REPORT_SCHEDULE_SCHEDULE_ID; TYPE: CONSTRAINT
+--
+alter table cr_report_schedule
+ add constraint cr_report_schedule_schedule_id primary key (schedule_id);
+--
+-- NAME: CR_REPORT_SCHEDULE_USERS_SCHEDULE_IDREP_IDUSER_IDORDER_NO; TYPE: CONSTRAINT
+--
+alter table cr_report_schedule_users
+ add constraint cr_report_schedule_users_schedule_idrep_iduser_idorder_no primary key (schedule_id, rep_id, user_id, order_no);
+--
+-- NAME: CR_REPORT_TEMPLATE_MAP_REPORT_ID; TYPE: CONSTRAINT
+--
+alter table cr_report_template_map
+ add constraint cr_report_template_map_report_id primary key (report_id);
+--
+-- NAME: CR_TABLE_ROLE_TABLE_NAMEROLE_ID; TYPE: CONSTRAINT
+--
+alter table cr_table_role
+ add constraint cr_table_role_table_namerole_id primary key (table_name, role_id);
+--
+-- NAME: CR_TABLE_SOURCE_TABLE_NAME; TYPE: CONSTRAINT
+--
+alter table cr_table_source
+ add constraint cr_table_source_table_name primary key (table_name);
+--
+-- NAME: FN_AUDIT_ACTION_AUDIT_ACTION_ID; TYPE: CONSTRAINT
+--
+alter table fn_audit_action
+ add constraint fn_audit_action_audit_action_id primary key (audit_action_id);
+--
+-- NAME: FN_CHAT_LOGS_CHAT_LOG_ID; TYPE: CONSTRAINT
+--
+alter table fn_chat_logs
+ add constraint fn_chat_logs_chat_log_id primary key (chat_log_id);
+--
+-- NAME: FN_CHAT_ROOM_CHAT_ROOM_ID; TYPE: CONSTRAINT
+--
+alter table fn_chat_room
+ add constraint fn_chat_room_chat_room_id primary key (chat_room_id);
+--
+-- NAME: FN_CHAT_USERS_ID; TYPE: CONSTRAINT
+--
+alter table fn_chat_users
+ add constraint fn_chat_users_id primary key (id);
+--
+-- NAME: FN_LU_ALERT_METHOD_ALERT_METHOD_CD; TYPE: CONSTRAINT
+--
+alter table fn_lu_alert_method
+ add constraint fn_lu_alert_method_alert_method_cd primary key (alert_method_cd);
+--
+-- NAME: FN_LU_BROADCAST_SITE_BROADCAST_SITE_CD; TYPE: CONSTRAINT
+--
+alter table fn_lu_broadcast_site
+ add constraint fn_lu_broadcast_site_broadcast_site_cd primary key (broadcast_site_cd);
+--
+-- NAME: FN_LU_PRIORITY_PRIORITY_ID; TYPE: CONSTRAINT
+--
+alter table fn_lu_priority
+ add constraint fn_lu_priority_priority_id primary key (priority_id);
+--
+-- NAME: FN_LU_ROLE_TYPE_ROLE_TYPE_ID; TYPE: CONSTRAINT
+--
+alter table fn_lu_role_type
+ add constraint fn_lu_role_type_role_type_id primary key (role_type_id);
+--
+-- NAME: FN_LU_TAB_SET_TAB_SET_CD; TYPE: CONSTRAINT
+--
+alter table fn_lu_tab_set
+ add constraint fn_lu_tab_set_tab_set_cd primary key (tab_set_cd);
+--
+-- NAME: FN_LU_TIMEZONE_TIMEZONE_ID; TYPE: CONSTRAINT
+--
+alter table fn_lu_timezone
+ add constraint fn_lu_timezone_timezone_id primary key (timezone_id);
+--
+-- NAME: FN_ORG_ORG_ID; TYPE: CONSTRAINT
+--
+alter table fn_org
+ add constraint fn_org_org_id primary key (org_id);
+--
+-- NAME: FN_RESTRICTED_URL_RESTRICTED_URLFUNCTION_CD; TYPE: CONSTRAINT
+--
+alter table fn_restricted_url
+ add constraint fn_restricted_url_restricted_urlfunction_cd primary key (restricted_url, function_cd);
+--
+-- NAME: FN_ROLE_COMPOSITE_PARENT_ROLE_IDCHILD_ROLE_ID; TYPE: CONSTRAINT
+--
+alter table fn_role_composite
+ add constraint fn_role_composite_parent_role_idchild_role_id primary key (parent_role_id, child_role_id);
+--
+-- NAME: FN_ROLE_FUNCTION_ROLE_IDFUNCTION_CD; TYPE: CONSTRAINT
+--
+alter table fn_role_function
+ add constraint fn_role_function_role_idfunction_cd primary key (role_id, function_cd);
+--
+-- NAME: FN_TAB_TAB_CD; TYPE: CONSTRAINT
+--
+alter table fn_tab
+ add constraint fn_tab_tab_cd primary key (tab_cd);
+--
+-- NAME: FN_TAB_SELECTED_SELECTED_TAB_CDTAB_URI; TYPE: CONSTRAINT
+--
+alter table fn_tab_selected
+ add constraint fn_tab_selected_selected_tab_cdtab_uri primary key (selected_tab_cd, tab_uri);
+--
+-- NAME: FN_USER_PSEUDO_ROLE_PSEUDO_ROLE_IDUSER_ID; TYPE: CONSTRAINT
+--
+alter table fn_user_pseudo_role
+ add constraint fn_user_pseudo_role_pseudo_role_iduser_id primary key (pseudo_role_id, user_id);
+--
+-- NAME: FN_USER_ROLE_USER_IDROLE_ID; TYPE: CONSTRAINT
+--
+alter table fn_user_role
+ add constraint fn_user_role_user_idrole_id primary key (user_id, role_id, app_id);
+--
+-- Name: fn_lu_message_location_MESSAGE_LOCATION_ID; Type: CONSTRAINT
+--
+
+ALTER TABLE fn_lu_message_location
+ ADD CONSTRAINT fn_lu_message_location_MESSAGE_LOCATION_ID PRIMARY KEY (message_location_id);
+
+-- ------------------ CREATE INDEX SECTION
+--
+-- NAME: CR_REPORT_CREATE_IDPUBLIC_YNTITLE; TYPE: INDEX
+--
+create index cr_report_create_idpublic_yntitle using btree on cr_report (create_id, public_yn, title);
+--
+-- NAME: CR_TABLE_JOIN_DEST_TABLE_NAME; TYPE: INDEX
+--
+create index cr_table_join_dest_table_name using btree on cr_table_join (dest_table_name);
+--
+-- NAME: CR_TABLE_JOIN_SRC_TABLE_NAME; TYPE: INDEX
+--
+create index cr_table_join_src_table_name using btree on cr_table_join (src_table_name);
+--
+-- NAME: FN_AUDIT_LOG_ACTIVITY_CD; TYPE: INDEX
+--
+create index fn_audit_log_activity_cd using btree on fn_audit_log (activity_cd);
+--
+-- NAME: FN_AUDIT_LOG_USER_ID; TYPE: INDEX
+--
+create index fn_audit_log_user_id using btree on fn_audit_log (user_id);
+--
+-- NAME: FN_MENU_FUNCTION_CD; TYPE: INDEX
+--
+create index fn_menu_function_cd using btree on fn_menu (function_cd);
+--
+-- NAME: FN_ORG_ACCESS_CD; TYPE: INDEX
+--
+create index fn_org_access_cd using btree on fn_org (access_cd);
+--
+-- NAME: FN_ROLE_FUNCTION_FUNCTION_CD; TYPE: INDEX
+--
+create index fn_role_function_function_cd using btree on fn_role_function (function_cd);
+--
+-- NAME: FN_ROLE_FUNCTION_ROLE_ID; TYPE: INDEX
+--
+create index fn_role_function_role_id using btree on fn_role_function (role_id);
+--
+-- NAME: FN_USER_ADDRESS_ID; TYPE: INDEX
+--
+create index fn_user_address_id using btree on fn_user (address_id);
+--
+-- NAME: FN_USER_ALERT_METHOD_CD; TYPE: INDEX
+--
+create index fn_user_alert_method_cd using btree on fn_user (alert_method_cd);
+--
+-- NAME: FN_USER_HRID; TYPE: INDEX
+--
+create unique index fn_user_hrid using btree on fn_user (hrid);
+--
+-- NAME: FN_USER_LOGIN_ID; TYPE: INDEX
+--
+create unique index fn_user_login_id using btree on fn_user (login_id);
+--
+-- NAME: FN_USER_ORG_ID; TYPE: INDEX
+--
+create index fn_user_org_id using btree on fn_user (org_id);
+--
+-- NAME: FN_USER_ROLE_ROLE_ID; TYPE: INDEX
+--
+create index fn_user_role_role_id using btree on fn_user_role (role_id);
+--
+-- NAME: FN_USER_ROLE_USER_ID; TYPE: INDEX
+--
+create index fn_user_role_user_id using btree on fn_user_role (user_id);
+--
+-- NAME: FK_FN_USER__REF_178_FN_APP_idx; TYPE: INDEX
+--
+create index fk_fn_user__ref_178_fn_app_IDX on fn_user_role (app_id);
+
+-- ----------------------------------------------------------
+-- NAME: QUARTZ TYPE: INDEXES
+-- ----------------------------------------------------------
+create index idx_fn_qz_j_req_recovery on fn_qz_job_details(sched_name,requests_recovery);
+create index idx_fn_qz_j_grp on fn_qz_job_details(sched_name,job_group);
+create index idx_fn_qz_t_j on fn_qz_triggers(sched_name,job_name,job_group);
+create index idx_fn_qz_t_jg on fn_qz_triggers(sched_name,job_group);
+create index idx_fn_qz_t_c on fn_qz_triggers(sched_name,calendar_name);
+create index idx_fn_qz_t_g on fn_qz_triggers(sched_name,trigger_group);
+create index idx_fn_qz_t_state on fn_qz_triggers(sched_name,trigger_state);
+create index idx_fn_qz_t_n_state on fn_qz_triggers(sched_name,trigger_name,trigger_group,trigger_state);
+create index idx_fn_qz_t_n_g_state on fn_qz_triggers(sched_name,trigger_group,trigger_state);
+create index idx_fn_qz_t_next_fire_time on fn_qz_triggers(sched_name,next_fire_time);
+create index idx_fn_qz_t_nft_st on fn_qz_triggers(sched_name,trigger_state,next_fire_time);
+create index idx_fn_qz_t_nft_misfire on fn_qz_triggers(sched_name,misfire_instr,next_fire_time);
+create index idx_fn_qz_t_nft_st_misfire on fn_qz_triggers(sched_name,misfire_instr,next_fire_time,trigger_state);
+create index idx_fn_qz_t_nft_st_misfire_grp on fn_qz_triggers(sched_name,misfire_instr,next_fire_time,trigger_group,trigger_state);
+create index idx_fn_qz_ft_trig_inst_name on fn_qz_fired_triggers(sched_name,instance_name);
+create index idx_fn_qz_ft_inst_job_req_rcvry on fn_qz_fired_triggers(sched_name,instance_name,requests_recovery);
+create index idx_fn_qz_ft_j_g on fn_qz_fired_triggers(sched_name,job_name,job_group);
+create index idx_fn_qz_ft_jg on fn_qz_fired_triggers(sched_name,job_group);
+create index idx_fn_qz_ft_t_g on fn_qz_fired_triggers(sched_name,trigger_name,trigger_group);
+create index idx_fn_qz_ft_tg on fn_qz_fired_triggers(sched_name,trigger_group);
+
+-- ------------------ ALTER TABLE ADD CONSTRAINT FOREIGN KEY SECTION
+--
+-- NAME: FK_FN_AUDIT_REF_205_FN_LU_AC; TYPE: CONSTRAINT
+--
+alter table fn_audit_log
+ add constraint fk_fn_audit_ref_205_fn_lu_ac foreign key (activity_cd) references fn_lu_activity(activity_cd);
+--
+-- NAME: FK_FN_ROLE__REF_201_FN_FUNCT; TYPE: CONSTRAINT
+--
+alter table fn_role_function
+ add constraint fk_fn_role__ref_201_fn_funct foreign key (function_cd) references fn_function(function_cd);
+--
+-- NAME: FK_FN_USER__REF_178_FN_APP; TYPE: FK CONSTRAINT
+--
+alter table fn_user_role
+ add constraint fk_fn_user__ref_178_fn_app foreign key (app_id) references fn_app(app_id);
+--
+-- NAME: FK_CR_REPOR_REF_14707_CR_REPOR; TYPE: FK CONSTRAINT
+--
+alter table cr_report_schedule
+ add constraint fk_cr_repor_ref_14707_cr_repor foreign key (rep_id) references cr_report(rep_id);
+--
+-- NAME: FK_CR_REPOR_REF_14716_CR_REPOR; TYPE: FK CONSTRAINT
+--
+alter table cr_report_schedule_users
+ add constraint fk_cr_repor_ref_14716_cr_repor foreign key (schedule_id) references cr_report_schedule(schedule_id);
+--
+-- NAME: FK_CR_REPOR_REF_17645_CR_REPOR; TYPE: FK CONSTRAINT
+--
+alter table cr_report_log
+ add constraint fk_cr_repor_ref_17645_cr_repor foreign key (rep_id) references cr_report(rep_id);
+--
+-- NAME: FK_CR_REPOR_REF_8550_CR_REPOR; TYPE: FK CONSTRAINT
+--
+alter table cr_report_access
+ add constraint fk_cr_repor_ref_8550_cr_repor foreign key (rep_id) references cr_report(rep_id);
+--
+-- NAME: FK_CR_REPORT_REP_ID; TYPE: FK CONSTRAINT
+--
+alter table cr_report_email_sent_log
+ add constraint fk_cr_report_rep_id foreign key (rep_id) references cr_report(rep_id);
+--
+-- NAME: FK_CR_TABLE_REF_311_CR_TAB; TYPE: FK CONSTRAINT
+--
+alter table cr_table_join
+ add constraint fk_cr_table_ref_311_cr_tab foreign key (src_table_name) references cr_table_source(table_name);
+--
+-- NAME: FK_CR_TABLE_REF_315_CR_TAB; TYPE: FK CONSTRAINT
+--
+alter table cr_table_join
+ add constraint fk_cr_table_ref_315_cr_tab foreign key (dest_table_name) references cr_table_source(table_name);
+--
+-- NAME: FK_CR_TABLE_REF_32384_CR_TABLE; TYPE: FK CONSTRAINT
+--
+alter table cr_table_role
+ add constraint fk_cr_table_ref_32384_cr_table foreign key (table_name) references cr_table_source(table_name);
+--
+-- NAME: FK_FN_TAB_FUNCTION_CD; TYPE: FK CONSTRAINT
+--
+alter table fn_tab
+ add constraint fk_fn_tab_function_cd foreign key (function_cd) references fn_function(function_cd);
+--
+-- NAME: FK_FN_TAB_SELECTED_TAB_CD; TYPE: FK CONSTRAINT
+--
+alter table fn_tab_selected
+ add constraint fk_fn_tab_selected_tab_cd foreign key (selected_tab_cd) references fn_tab(tab_cd);
+--
+-- NAME: FK_FN_TAB_SET_CD; TYPE: FK CONSTRAINT
+--
+alter table fn_tab
+ add constraint fk_fn_tab_set_cd foreign key (tab_set_cd) references fn_lu_tab_set(tab_set_cd);
+--
+-- NAME: FK_FN_USER_REF_110_FN_ORG; TYPE: FK CONSTRAINT
+--
+alter table fn_user
+ add constraint fk_fn_user_ref_110_fn_org foreign key (org_id) references fn_org(org_id);
+--
+-- NAME: FK_FN_USER_REF_123_FN_LU_AL; TYPE: FK CONSTRAINT
+--
+alter table fn_user
+ add constraint fk_fn_user_ref_123_fn_lu_al foreign key (alert_method_cd) references fn_lu_alert_method(alert_method_cd);
+--
+-- NAME: FK_FN_USER_REF_197_FN_USER; TYPE: FK CONSTRAINT
+--
+alter table fn_user
+ add constraint fk_fn_user_ref_197_fn_user foreign key (manager_id) references fn_user(user_id);
+--
+-- NAME: FK_FN_USER_REF_198_FN_USER; TYPE: FK CONSTRAINT
+--
+alter table fn_user
+ add constraint fk_fn_user_ref_198_fn_user foreign key (created_id) references fn_user(user_id);
+--
+-- NAME: FK_FN_USER_REF_199_FN_USER; TYPE: FK CONSTRAINT
+--
+alter table fn_user
+ add constraint fk_fn_user_ref_199_fn_user foreign key (modified_id) references fn_user(user_id);
+--
+-- NAME: FK_PARENT_KEY_CR_FOLDER; TYPE: FK CONSTRAINT
+--
+alter table cr_folder
+ add constraint fk_parent_key_cr_folder foreign key (parent_folder_id) references cr_folder(folder_id);
+--
+-- NAME: FK_PSEUDO_ROLE_PSEUDO_ROLE_ID; TYPE: FK CONSTRAINT
+--
+alter table fn_user_pseudo_role
+ add constraint fk_pseudo_role_pseudo_role_id foreign key (pseudo_role_id) references fn_role(role_id);
+--
+-- NAME: FK_PSEUDO_ROLE_USER_ID; TYPE: FK CONSTRAINT
+--
+alter table fn_user_pseudo_role
+ add constraint fk_pseudo_role_user_id foreign key (user_id) references fn_user(user_id);
+--
+-- NAME: FK_RESTRICTED_URL_FUNCTION_CD; TYPE: FK CONSTRAINT
+--
+alter table fn_restricted_url
+ add constraint fk_restricted_url_function_cd foreign key (function_cd) references fn_function(function_cd);
+--
+-- NAME: FK_TIMEZONE; TYPE: FK CONSTRAINT
+--
+alter table fn_user
+ add constraint fk_timezone foreign key (timezone) references fn_lu_timezone(timezone_id);
+--
+-- NAME: SYS_C0014614; TYPE: FK CONSTRAINT
+--
+alter table cr_report_file_history
+ add constraint sys_c0014614 foreign key (file_type_id) references cr_lu_file_type(lookup_id);
+--
+-- NAME: SYS_C0014615; TYPE: FK CONSTRAINT
+--
+alter table cr_report_file_history
+ add constraint sys_c0014615 foreign key (rep_id) references cr_report(rep_id);
+--
+-- NAME: SYS_C0014616; TYPE: FK CONSTRAINT
+--
+alter table cr_hist_user_map
+ add constraint sys_c0014616 foreign key (hist_id) references cr_report_file_history(hist_id);
+--
+-- NAME: SYS_C0014617; TYPE: FK CONSTRAINT
+--
+alter table cr_hist_user_map
+ add constraint sys_c0014617 foreign key (user_id) references fn_user(user_id);
+
+commit;
diff --git a/ecomp-sdk/sdk-app/db-scripts/EcompSdkDMLMySql_1610_Complete_OS.sql b/ecomp-sdk/sdk-app/db-scripts/EcompSdkDMLMySql_1610_Complete_OS.sql
new file mode 100644
index 00000000..64c94516
--- /dev/null
+++ b/ecomp-sdk/sdk-app/db-scripts/EcompSdkDMLMySql_1610_Complete_OS.sql
@@ -0,0 +1,2891 @@
+-- ---------------------------------------------------------------------------------------------------------------
+-- This is for the default data for 1610 Version of SDK database for Open Source called ecomp_sdk
+
+USE ecomp_sdk_os;
+
+set foreign_key_checks=1;
+
+-- fn_function
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_process','Process List');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('1','test role function');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_job','Job Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_job_create','Job Create');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_job_designer','Process in Designer view');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_task','Task Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_task_search','Task Search');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_map','Map Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_sample','Sample Pages Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_test','Test Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('login','Login');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_home','Home Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_customer','Customer Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_reports','Reports Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_profile','Profile Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_admin','Admin Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_feedback','Feedback Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_help','Help Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_logout','Logout Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_doclib','Document Library Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('doclib','Document Library');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('doclib_admin','Document Library Admin');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_notes','Notes Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_ajax','Ajax Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_customer_create','Customer Create');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_profile_create','Profile Create');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_profile_import','Profile Import');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_tab','Sample Tab Menu');
+-- Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_concept','CoNCEPT');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_itracker','iTracker Menu');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('view_reports','View Raptor reports');
+Insert into fn_function (FUNCTION_CD,FUNCTION_NAME) values ('menu_itracker_admin','Itracker Admin/Support menu');
+
+-- fn_lu_activity
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('add_role','add_role');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('remove_role','remove_role');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('add_user_role','add_user_role');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('remove_user_role','remove_user_role');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('add_role_function','add_role_function');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('remove_role_function','remove_role_function');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('add_child_role','add_child_role');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('remove_child_role','remove_child_role');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('mobile_login','Mobile Login');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('mobile_logout','Mobile Logout');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('login','Login');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('logout','Logout');
+
+-- fn_lu_alert_method
+Insert into fn_lu_alert_method (ALERT_METHOD_CD,ALERT_METHOD) values ('PHONE','Phone');
+Insert into fn_lu_alert_method (ALERT_METHOD_CD,ALERT_METHOD) values ('FAX','Fax');
+Insert into fn_lu_alert_method (ALERT_METHOD_CD,ALERT_METHOD) values ('PAGER','Pager');
+Insert into fn_lu_alert_method (ALERT_METHOD_CD,ALERT_METHOD) values ('EMAIL','Email');
+Insert into fn_lu_alert_method (ALERT_METHOD_CD,ALERT_METHOD) values ('SMS','SMS');
+
+-- fn_lu_menu_set
+Insert into fn_lu_menu_set (MENU_SET_CD,MENU_SET_NAME) values ('APP','Application Menu');
+
+-- fn_lu_priority
+Insert into fn_lu_priority (PRIORITY_ID,PRIORITY,ACTIVE_YN,SORT_ORDER) values (10,'Low','Y',10);
+Insert into fn_lu_priority (PRIORITY_ID,PRIORITY,ACTIVE_YN,SORT_ORDER) values (20,'Normal','Y',20);
+Insert into fn_lu_priority (PRIORITY_ID,PRIORITY,ACTIVE_YN,SORT_ORDER) values (30,'High','Y',30);
+Insert into fn_lu_priority (PRIORITY_ID,PRIORITY,ACTIVE_YN,SORT_ORDER) values (40,'Urgent','Y',40);
+Insert into fn_lu_priority (PRIORITY_ID,PRIORITY,ACTIVE_YN,SORT_ORDER) values (50,'Fatal','Y',50);
+
+-- fn_lu_tab_set
+Insert into fn_lu_tab_set (TAB_SET_CD,TAB_SET_NAME) values ('APP','Application Tabs');
+
+-- fn_lu_timezone
+Insert into fn_lu_timezone (TIMEZONE_ID,TIMEZONE_NAME,TIMEZONE_VALUE) values (10,'US/Eastern','US/Eastern');
+Insert into fn_lu_timezone (TIMEZONE_ID,TIMEZONE_NAME,TIMEZONE_VALUE) values (20,'US/Central','US/Central');
+Insert into fn_lu_timezone (TIMEZONE_ID,TIMEZONE_NAME,TIMEZONE_VALUE) values (30,'US/Mountain','US/Mountain');
+Insert into fn_lu_timezone (TIMEZONE_ID,TIMEZONE_NAME,TIMEZONE_VALUE) values (40,'US/Arizona','America/Phoenix');
+Insert into fn_lu_timezone (TIMEZONE_ID,TIMEZONE_NAME,TIMEZONE_VALUE) values (50,'US/Pacific','US/Pacific');
+Insert into fn_lu_timezone (TIMEZONE_ID,TIMEZONE_NAME,TIMEZONE_VALUE) values (60,'US/Alaska','US/Alaska');
+Insert into fn_lu_timezone (TIMEZONE_ID,TIMEZONE_NAME,TIMEZONE_VALUE) values (70,'US/Hawaii','US/Hawaii');
+
+-- fn_menu
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (1, 'Root', NULL, 10, NULL, 'menu_home', 'N', NULL, NULL, NULL, NULL, 'APP', 'N', NULL); -- we need even though it's inactive
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (5000, 'Sample Pages', 1, 30, 'sample.htm', 'menu_sample', 'N', NULL, NULL, NULL, NULL, 'APP', 'N', 'ion-android-apps');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (2, 'Home', 1, 10, 'welcome.htm', 'menu_home', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'ion-home');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (8, 'Reports', 1, 40, 'report.htm', 'menu_reports', 'N', NULL, NULL, NULL, NULL, 'APP', 'N', 'ion-ios-paper');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (9, 'Profile', 1, 90, 'userProfile', 'menu_profile', 'N', NULL, NULL, NULL, NULL, 'APP', 'N', 'ion-person');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (10, 'Admin', 1, 110, 'role_list.htm', 'menu_admin', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'ion-gear-a');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (13, 'Application Logout', 1, 130, 'app_logout.htm', 'menu_logout', 'N', NULL, NULL, NULL, NULL, 'APP', 'N', 'ion-android-exit');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (84, 'All Reports', 8, 50, 'report', 'menu_reports', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) values (87, 'Create Reports', 8, 120, 'report_wizard.htm?r_action=report.create', 'menu_reports', 'Y', NULL, 'r_action=report.create', NULL, NULL, 'APP', 'N', NULL);
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) values (88, 'Sample Dashboard', 8, 130, 'report_sample', 'menu_reports', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', NULL);
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (92, 'Import User', 9, 30, 'userProfile#/post_search', 'menu_profile_import', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', NULL);
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (94, 'Self', 9, 40, 'userProfile#/self_profile', 'menu_profile', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/profile.png');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (101, 'Roles', 10, 20, 'admin', 'menu_admin', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/users.png');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (102, 'Role Functions', 10, 30, 'admin#/role_function_list', 'menu_admin', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', NULL);
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (103, 'Broadcast Messages', 10, 50, 'admin#/broadcast_list', 'menu_admin', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/bubble.png');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (105, 'Cache Admin', 10, 40, 'admin#/jcs_admin', 'menu_admin', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/cache.png');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (108, 'Usage', 10, 80, 'admin#/usage_list', 'menu_admin', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/users.png');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (121, 'Collaboration', 5000, 100, 'collaborate_list.htm', 'menu_sample', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/bubble.png');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (930, 'Search', 9, 15, 'userProfile', 'menu_admin', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/search_profile.png');
+INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (150038,'Notebook',5000,135,'notebook.htm','menu_sample','Y',NULL,NULL,NULL,NULL,'APP','N',NULL);
+
+-- fn_restricted_url
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('attachment.htm','menu_admin');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('broadcast.htm','menu_admin');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('file_upload.htm','menu_admin');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('job.htm','menu_admin');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('role.htm','menu_admin');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('role_function.htm','menu_admin');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('test.htm','menu_admin');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('async_test.htm','menu_home');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('chatWindow.htm','menu_home');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('contact_list.htm','menu_home');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('customer_dynamic_list.htm','menu_home');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('event.htm','menu_home');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('event_list.htm','menu_home');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('mobile_welcome.htm','menu_home');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('sample_map.htm','menu_home');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('template.jsp','menu_home');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('zkau','menu_home');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('itracker_assign.htm','menu_itracker');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('itracker_byassignee.htm','menu_itracker');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('itracker_create.htm','menu_itracker');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('itracker_update.htm','menu_itracker');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('manage_license.htm','menu_itracker');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('support_ticket.htm','menu_itracker');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('jbpm_designer.htm','menu_job_create'); -- check
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('jbpm_drools.htm','menu_job_create'); -- check
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('process_job.htm','menu_job_create');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('profile.htm','menu_profile_create');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('raptor.htm','menu_reports');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('raptor2.htm','menu_reports');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('raptor_blob_extract.htm','menu_reports');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('raptor_email_attachment.htm','menu_reports');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('raptor_search.htm','menu_reports');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report_list.htm','menu_reports');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('gauge.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('gmap_controller.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('gmap_frame.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('map.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('map_download.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('map_grid_search.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('sample_animated_map.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('sample_map_2.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('sample_map_3.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('tab2_sub1.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('tab2_sub2_link1.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('tab2_sub2_link2.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('tab2_sub3.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('tab3.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('tab4.htm','menu_tab');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('raptor.htm','view_reports');
+INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('raptor_blob_extract.htm','view_reports');
+
+-- fn_role
+Insert into fn_role (ROLE_ID,ROLE_NAME,ACTIVE_YN,PRIORITY) values (16,'Standard User','Y',5);
+Insert into fn_role (ROLE_ID,ROLE_NAME,ACTIVE_YN,PRIORITY) values (1,'System Administrator','Y',1);
+
+-- fn_role_composite
+Insert into fn_role_composite (PARENT_ROLE_ID,CHILD_ROLE_ID) values (1,16);
+
+-- fn_role_function
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'doclib');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'doclib_admin');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'login');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_admin');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_ajax');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_customer');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_customer_create');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_feedback');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_help');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_home');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_itracker');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_itracker_admin');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_job');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_job_create');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_logout');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_notes');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_process');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_profile');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_profile_create');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_profile_import');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_reports');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_sample');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_tab');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (1,'menu_test');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (16,'login');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (16,'menu_ajax');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (16,'menu_customer');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (16,'menu_customer_create');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (16,'menu_home');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (16,'menu_itracker');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (16,'menu_logout');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (16,'menu_map');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (16,'menu_profile');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (16,'menu_reports');
+Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (16,'menu_tab');
+
+-- fn_tab
+Insert into fn_tab (TAB_CD,TAB_NAME,TAB_DESCR,ACTION,FUNCTION_CD,ACTIVE_YN,SORT_ORDER,PARENT_TAB_CD,TAB_SET_CD) values ('TAB2_SUB1_S1','Left Tab 1','Sub - Sub Tab 1 Information','tab2_sub1.htm','menu_tab','Y',10,'TAB2_SUB1','APP');
+Insert into fn_tab (TAB_CD,TAB_NAME,TAB_DESCR,ACTION,FUNCTION_CD,ACTIVE_YN,SORT_ORDER,PARENT_TAB_CD,TAB_SET_CD) values ('TAB1','Tab 1','Tab 1 Information','tab1.htm','menu_tab','Y',10,null,'APP');
+Insert into fn_tab (TAB_CD,TAB_NAME,TAB_DESCR,ACTION,FUNCTION_CD,ACTIVE_YN,SORT_ORDER,PARENT_TAB_CD,TAB_SET_CD) values ('TAB2','Tab 2','Tab 2 Information','tab2_sub1.htm','menu_tab','Y',20,null,'APP');
+Insert into fn_tab (TAB_CD,TAB_NAME,TAB_DESCR,ACTION,FUNCTION_CD,ACTIVE_YN,SORT_ORDER,PARENT_TAB_CD,TAB_SET_CD) values ('TAB3','Tab 3','Tab 3 Information','tab3.htm','menu_tab','Y',30,null,'APP');
+Insert into fn_tab (TAB_CD,TAB_NAME,TAB_DESCR,ACTION,FUNCTION_CD,ACTIVE_YN,SORT_ORDER,PARENT_TAB_CD,TAB_SET_CD) values ('TAB4','Tab 4','Tab 4 Information','tab4.htm','menu_tab','Y',40,null,'APP');
+Insert into fn_tab (TAB_CD,TAB_NAME,TAB_DESCR,ACTION,FUNCTION_CD,ACTIVE_YN,SORT_ORDER,PARENT_TAB_CD,TAB_SET_CD) values ('TAB2_SUB1','Sub Tab 1','Sub Tab 1 Information','tab2_sub1.htm','menu_tab','Y',10,'TAB2','APP');
+Insert into fn_tab (TAB_CD,TAB_NAME,TAB_DESCR,ACTION,FUNCTION_CD,ACTIVE_YN,SORT_ORDER,PARENT_TAB_CD,TAB_SET_CD) values ('TAB2_SUB2','Sub Tab 2','Sub Tab 2 Information','tab2_sub2.htm','menu_tab','Y',20,'TAB2','APP');
+Insert into fn_tab (TAB_CD,TAB_NAME,TAB_DESCR,ACTION,FUNCTION_CD,ACTIVE_YN,SORT_ORDER,PARENT_TAB_CD,TAB_SET_CD) values ('TAB2_SUB3','Sub Tab 3','Sub Tab 3 Information','tab2_sub3.htm','menu_tab','Y',30,'TAB2','APP');
+
+-- fn_tab_selected
+Insert into fn_tab_selected (SELECTED_TAB_CD,TAB_URI) values ('TAB1','tab1');
+Insert into fn_tab_selected (SELECTED_TAB_CD,TAB_URI) values ('TAB2','tab2_sub1');
+Insert into fn_tab_selected (SELECTED_TAB_CD,TAB_URI) values ('TAB2','tab2_sub2');
+Insert into fn_tab_selected (SELECTED_TAB_CD,TAB_URI) values ('TAB2','tab2_sub3');
+Insert into fn_tab_selected (SELECTED_TAB_CD,TAB_URI) values ('TAB2_SUB1','tab2_sub1');
+Insert into fn_tab_selected (SELECTED_TAB_CD,TAB_URI) values ('TAB2_SUB1_S1','tab2_sub1');
+Insert into fn_tab_selected (SELECTED_TAB_CD,TAB_URI) values ('TAB2_SUB2','tab2_sub2');
+Insert into fn_tab_selected (SELECTED_TAB_CD,TAB_URI) values ('TAB2_SUB3','tab2_sub3');
+Insert into fn_tab_selected (SELECTED_TAB_CD,TAB_URI) values ('TAB3','tab3');
+Insert into fn_tab_selected (SELECTED_TAB_CD,TAB_URI) values ('TAB4','tab4');
+
+-- fn_user
+Insert into fn_user (USER_ID,ORG_ID,MANAGER_ID,FIRST_NAME,MIDDLE_NAME,LAST_NAME,PHONE,FAX,CELLULAR,EMAIL,ADDRESS_ID,ALERT_METHOD_CD,HRID,ORG_USER_ID,ORG_CODE,LOGIN_ID,LOGIN_PWD,LAST_LOGIN_DATE,ACTIVE_YN,CREATED_ID,CREATED_DATE,MODIFIED_ID,MODIFIED_DATE,IS_INTERNAL_YN,ADDRESS_LINE_1,ADDRESS_LINE_2,CITY,STATE_CD,ZIP_CODE,COUNTRY_CD,LOCATION_CLLI,ORG_MANAGER_USERID,COMPANY,DEPARTMENT_NAME,JOB_TITLE,TIMEZONE,DEPARTMENT,BUSINESS_UNIT,BUSINESS_UNIT_NAME,COST_CENTER,FIN_LOC_CODE,SILO_STATUS) values (1,null,null,'Demo',null,'User',null,null,null,'demo@email.com',null,null,null,'demo',null,'demo','Kp8bJ4SXszM0WXlhak3eHlcse',str_to_date('24-OCT-16','%d-%M-%Y'),'Y',null,str_to_date('17-OCT-16','%d-%M-%Y'),1,str_to_date('24-OCT-16','%d-%M-%Y'),'N',null,null,null,'NJ',null,'US',null,null,null,null,null,10,null,null,null,null,null,null);
+
+-- cr_raptor_action_img
+Insert into cr_raptor_action_img (IMAGE_ID, IMAGE_LOC) Values ('DELETE', '/static/fusion/raptor/img/deleteicon.gif');
+Insert into cr_raptor_action_img (IMAGE_ID, IMAGE_LOC) Values ('CALENDAR', '/static/fusion/raptor/img/Calendar-16x16.png');
+
+-- fn_app
+Insert into fn_app (APP_ID,APP_NAME,APP_IMAGE_URL,APP_DESCRIPTION,APP_NOTES,APP_URL,APP_ALTERNATE_URL,APP_REST_ENDPOINT,ML_APP_NAME,ML_APP_ADMIN_ID,MOTS_ID,APP_PASSWORD,OPEN,ENABLED,THUMBNAIL,APP_USERNAME,UEB_KEY,UEB_SECRET,UEB_TOPIC_NAME) VALUES (1,'Default',null,'Some Default Description','Some Default Note',null,null,null,'ECPP','?','1','okYTaDrhzibcbGVq5mjkVQ==','N','N',null,'Default',null,null,'ECOMP-PORTAL-INBOX');
+
+-- fn_user_role
+Insert into fn_user_role (USER_ID,ROLE_ID,PRIORITY,APP_ID) values (1,1,null,1);
+
+-- DEMO_BAR_CHART
+Insert into demo_bar_chart (label, value) values ('A', 29.765957771107);
+Insert into demo_bar_chart (label, value) values ('B', 0);
+Insert into demo_bar_chart (label, value) values ('C', 32.807804682612);
+Insert into demo_bar_chart (label, value) values ('D', 196.45946739256);
+Insert into demo_bar_chart (label, value) values ('E', 0.19434030906893);
+Insert into demo_bar_chart (label, value) values ('F', 98.079782601442);
+Insert into demo_bar_chart (label, value) values ('G', 13.925743130903);
+Insert into demo_bar_chart (label, value) values ('H', 5.1387322875705);
+
+-- DEMO_BAR_CHART_INTER
+Insert into demo_bar_chart_inter (spam_date, num_rpt_sources, num_det_sources) values (STR_TO_DATE('6-Mar-13','%e-%b-%y'), 198, 220);
+Insert into demo_bar_chart_inter (spam_date, num_rpt_sources, num_det_sources) values (STR_TO_DATE('5-Mar-13','%e-%b-%y'), 198, 220);
+Insert into demo_bar_chart_inter (spam_date, num_rpt_sources, num_det_sources) values (STR_TO_DATE('4-Mar-13','%e-%b-%y'), 238, 235);
+Insert into demo_bar_chart_inter (spam_date, num_rpt_sources, num_det_sources) values (STR_TO_DATE('3-Mar-13','%e-%b-%y'), 238, 235);
+Insert into demo_bar_chart_inter (spam_date, num_rpt_sources, num_det_sources) values (STR_TO_DATE('2-Mar-13','%e-%b-%y'), 256, 275);
+Insert into demo_bar_chart_inter (spam_date, num_rpt_sources, num_det_sources) values (STR_TO_DATE('1-Mar-13','%e-%b-%y'), 239, 260);
+Insert into demo_bar_chart_inter (spam_date, num_rpt_sources, num_det_sources) values (STR_TO_DATE('28-Feb-13','%e-%b-%y'), 247, 255);
+Insert into demo_bar_chart_inter (spam_date, num_rpt_sources, num_det_sources) values (STR_TO_DATE('27-Feb-13','%e-%b-%y'), 252, 265);
+Insert into demo_bar_chart_inter (spam_date, num_rpt_sources, num_det_sources) values (STR_TO_DATE('26-Feb-13','%e-%b-%y'), 198, 220);
+
+-- DEMO_LINE_CHART
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('1-May-12','%e-%b-%y'),582.13);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Apr-12','%e-%b-%y'),583.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('27-Apr-12','%e-%b-%y'),603);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Apr-12','%e-%b-%y'),607.7);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('25-Apr-12','%e-%b-%y'),610);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Apr-12','%e-%b-%y'),560.28);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Apr-12','%e-%b-%y'),571.7);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Apr-12','%e-%b-%y'),572.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('19-Apr-12','%e-%b-%y'),587.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Apr-12','%e-%b-%y'),608.34);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('17-Apr-12','%e-%b-%y'),609.7);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Apr-12','%e-%b-%y'),580.13);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('13-Apr-12','%e-%b-%y'),605.23);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Apr-12','%e-%b-%y'),622.77);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('11-Apr-12','%e-%b-%y'),626.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Apr-12','%e-%b-%y'),628.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('9-Apr-12','%e-%b-%y'),636.23);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Apr-12','%e-%b-%y'),633.68);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('4-Apr-12','%e-%b-%y'),624.31);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Apr-12','%e-%b-%y'),629.32);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('2-Apr-12','%e-%b-%y'),618.63);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Mar-12','%e-%b-%y'),599.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-Mar-12','%e-%b-%y'),609.86);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Mar-12','%e-%b-%y'),617.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Mar-12','%e-%b-%y'),614.48);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Mar-12','%e-%b-%y'),606.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('23-Mar-12','%e-%b-%y'),596.05);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Mar-12','%e-%b-%y'),599.34);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('21-Mar-12','%e-%b-%y'),602.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Mar-12','%e-%b-%y'),605.96);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('19-Mar-12','%e-%b-%y'),601.1);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Mar-12','%e-%b-%y'),585.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('15-Mar-12','%e-%b-%y'),585.56);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Mar-12','%e-%b-%y'),589.58);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('13-Mar-12','%e-%b-%y'),568.1);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Mar-12','%e-%b-%y'),552);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('9-Mar-12','%e-%b-%y'),545.17);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Mar-12','%e-%b-%y'),541.99);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('7-Mar-12','%e-%b-%y'),530.69);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Mar-12','%e-%b-%y'),530.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('5-Mar-12','%e-%b-%y'),533.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Mar-12','%e-%b-%y'),545.18);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('1-Mar-12','%e-%b-%y'),544.47);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Feb-12','%e-%b-%y'),542.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('28-Feb-12','%e-%b-%y'),535.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Feb-12','%e-%b-%y'),525.76);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-Feb-12','%e-%b-%y'),522.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Feb-12','%e-%b-%y'),516.39);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Feb-12','%e-%b-%y'),513.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Feb-12','%e-%b-%y'),514.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('17-Feb-12','%e-%b-%y'),502.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Feb-12','%e-%b-%y'),502.21);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Feb-12','%e-%b-%y'),497.67);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Feb-12','%e-%b-%y'),509.46);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('13-Feb-12','%e-%b-%y'),502.6);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Feb-12','%e-%b-%y'),493.42);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('9-Feb-12','%e-%b-%y'),493.17);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Feb-12','%e-%b-%y'),476.68);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Feb-12','%e-%b-%y'),468.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Feb-12','%e-%b-%y'),463.97);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Feb-12','%e-%b-%y'),459.68);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Feb-12','%e-%b-%y'),455.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('1-Feb-12','%e-%b-%y'),456.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-Jan-12','%e-%b-%y'),456.48);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-Jan-12','%e-%b-%y'),453.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Jan-12','%e-%b-%y'),447.28);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-Jan-12','%e-%b-%y'),444.63);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Jan-12','%e-%b-%y'),446.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('24-Jan-12','%e-%b-%y'),420.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Jan-12','%e-%b-%y'),427.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-Jan-12','%e-%b-%y'),420.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Jan-12','%e-%b-%y'),427.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-Jan-12','%e-%b-%y'),429.11);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Jan-12','%e-%b-%y'),424.7);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('13-Jan-12','%e-%b-%y'),419.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Jan-12','%e-%b-%y'),421.39);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Jan-12','%e-%b-%y'),422.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Jan-12','%e-%b-%y'),423.24);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('9-Jan-12','%e-%b-%y'),421.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Jan-12','%e-%b-%y'),422.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('5-Jan-12','%e-%b-%y'),418.03);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Jan-12','%e-%b-%y'),413.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Jan-12','%e-%b-%y'),411.23);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Dec-11','%e-%b-%y'),405);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-Dec-11','%e-%b-%y'),405.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Dec-11','%e-%b-%y'),402.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('27-Dec-11','%e-%b-%y'),406.53);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Dec-11','%e-%b-%y'),403.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Dec-11','%e-%b-%y'),398.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Dec-11','%e-%b-%y'),396.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-Dec-11','%e-%b-%y'),395.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Dec-11','%e-%b-%y'),382.21);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('16-Dec-11','%e-%b-%y'),381.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Dec-11','%e-%b-%y'),378.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Dec-11','%e-%b-%y'),380.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Dec-11','%e-%b-%y'),388.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Dec-11','%e-%b-%y'),391.84);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Dec-11','%e-%b-%y'),393.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('8-Dec-11','%e-%b-%y'),390.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Dec-11','%e-%b-%y'),389.09);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Dec-11','%e-%b-%y'),390.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Dec-11','%e-%b-%y'),393.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Dec-11','%e-%b-%y'),389.7);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Dec-11','%e-%b-%y'),387.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('30-Nov-11','%e-%b-%y'),382.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Nov-11','%e-%b-%y'),373.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('28-Nov-11','%e-%b-%y'),376.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Nov-11','%e-%b-%y'),363.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Nov-11','%e-%b-%y'),366.99);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Nov-11','%e-%b-%y'),376.51);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('21-Nov-11','%e-%b-%y'),369.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Nov-11','%e-%b-%y'),374.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('17-Nov-11','%e-%b-%y'),377.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Nov-11','%e-%b-%y'),384.77);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Nov-11','%e-%b-%y'),388.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Nov-11','%e-%b-%y'),379.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('11-Nov-11','%e-%b-%y'),384.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Nov-11','%e-%b-%y'),385.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('9-Nov-11','%e-%b-%y'),395.28);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Nov-11','%e-%b-%y'),406.23);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Nov-11','%e-%b-%y'),399.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Nov-11','%e-%b-%y'),400.24);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('3-Nov-11','%e-%b-%y'),403.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Nov-11','%e-%b-%y'),397.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('1-Nov-11','%e-%b-%y'),396.51);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-Oct-11','%e-%b-%y'),404.78);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('28-Oct-11','%e-%b-%y'),404.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Oct-11','%e-%b-%y'),404.69);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('26-Oct-11','%e-%b-%y'),400.6);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Oct-11','%e-%b-%y'),397.77);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-Oct-11','%e-%b-%y'),405.77);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Oct-11','%e-%b-%y'),392.87);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-Oct-11','%e-%b-%y'),395.31);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Oct-11','%e-%b-%y'),398.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('18-Oct-11','%e-%b-%y'),422.24);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Oct-11','%e-%b-%y'),419.99);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Oct-11','%e-%b-%y'),422);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Oct-11','%e-%b-%y'),408.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Oct-11','%e-%b-%y'),402.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Oct-11','%e-%b-%y'),400.29);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('10-Oct-11','%e-%b-%y'),388.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Oct-11','%e-%b-%y'),369.8);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Oct-11','%e-%b-%y'),377.37);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Oct-11','%e-%b-%y'),378.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('4-Oct-11','%e-%b-%y'),372.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Oct-11','%e-%b-%y'),374.6);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('30-Sep-11','%e-%b-%y'),381.32);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Sep-11','%e-%b-%y'),390.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('28-Sep-11','%e-%b-%y'),397.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Sep-11','%e-%b-%y'),399.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-Sep-11','%e-%b-%y'),403.17);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Sep-11','%e-%b-%y'),404.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('22-Sep-11','%e-%b-%y'),401.82);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Sep-11','%e-%b-%y'),412.14);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-Sep-11','%e-%b-%y'),413.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Sep-11','%e-%b-%y'),411.63);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Sep-11','%e-%b-%y'),400.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Sep-11','%e-%b-%y'),392.96);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('14-Sep-11','%e-%b-%y'),389.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Sep-11','%e-%b-%y'),384.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Sep-11','%e-%b-%y'),379.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Sep-11','%e-%b-%y'),377.48);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Sep-11','%e-%b-%y'),384.14);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Sep-11','%e-%b-%y'),383.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('6-Sep-11','%e-%b-%y'),379.74);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Sep-11','%e-%b-%y'),374.05);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('1-Sep-11','%e-%b-%y'),381.03);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-Aug-11','%e-%b-%y'),384.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-Aug-11','%e-%b-%y'),389.99);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Aug-11','%e-%b-%y'),389.97);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('26-Aug-11','%e-%b-%y'),383.58);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Aug-11','%e-%b-%y'),373.72);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-Aug-11','%e-%b-%y'),376.18);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Aug-11','%e-%b-%y'),373.6);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Aug-11','%e-%b-%y'),356.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Aug-11','%e-%b-%y'),356.03);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('18-Aug-11','%e-%b-%y'),366.05);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Aug-11','%e-%b-%y'),380.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Aug-11','%e-%b-%y'),380.48);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Aug-11','%e-%b-%y'),383.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Aug-11','%e-%b-%y'),376.99);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Aug-11','%e-%b-%y'),373.7);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('10-Aug-11','%e-%b-%y'),363.69);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Aug-11','%e-%b-%y'),374.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Aug-11','%e-%b-%y'),353.21);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Aug-11','%e-%b-%y'),373.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('4-Aug-11','%e-%b-%y'),377.37);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Aug-11','%e-%b-%y'),392.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('2-Aug-11','%e-%b-%y'),388.91);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Aug-11','%e-%b-%y'),396.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-Jul-11','%e-%b-%y'),390.48);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Jul-11','%e-%b-%y'),391.82);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Jul-11','%e-%b-%y'),392.59);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Jul-11','%e-%b-%y'),403.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('25-Jul-11','%e-%b-%y'),398.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Jul-11','%e-%b-%y'),393.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('21-Jul-11','%e-%b-%y'),387.29);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Jul-11','%e-%b-%y'),386.9);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('19-Jul-11','%e-%b-%y'),376.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Jul-11','%e-%b-%y'),373.8);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('15-Jul-11','%e-%b-%y'),364.92);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Jul-11','%e-%b-%y'),357.77);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('13-Jul-11','%e-%b-%y'),358.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Jul-11','%e-%b-%y'),353.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Jul-11','%e-%b-%y'),354);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Jul-11','%e-%b-%y'),359.71);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('7-Jul-11','%e-%b-%y'),357.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Jul-11','%e-%b-%y'),351.76);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('5-Jul-11','%e-%b-%y'),349.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Jul-11','%e-%b-%y'),343.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-Jun-11','%e-%b-%y'),335.67);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Jun-11','%e-%b-%y'),334.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('28-Jun-11','%e-%b-%y'),335.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Jun-11','%e-%b-%y'),332.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-Jun-11','%e-%b-%y'),326.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Jun-11','%e-%b-%y'),331.23);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Jun-11','%e-%b-%y'),322.61);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Jun-11','%e-%b-%y'),325.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('20-Jun-11','%e-%b-%y'),315.32);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Jun-11','%e-%b-%y'),320.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Jun-11','%e-%b-%y'),325.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Jun-11','%e-%b-%y'),326.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Jun-11','%e-%b-%y'),332.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Jun-11','%e-%b-%y'),326.6);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('10-Jun-11','%e-%b-%y'),325.9);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Jun-11','%e-%b-%y'),331.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Jun-11','%e-%b-%y'),332.24);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Jun-11','%e-%b-%y'),332.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Jun-11','%e-%b-%y'),338.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Jun-11','%e-%b-%y'),343.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('2-Jun-11','%e-%b-%y'),346.1);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Jun-11','%e-%b-%y'),345.51);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('31-May-11','%e-%b-%y'),347.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-May-11','%e-%b-%y'),337.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-May-11','%e-%b-%y'),335);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-May-11','%e-%b-%y'),336.78);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('24-May-11','%e-%b-%y'),332.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-May-11','%e-%b-%y'),334.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-May-11','%e-%b-%y'),335.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-May-11','%e-%b-%y'),340.53);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-May-11','%e-%b-%y'),339.87);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-May-11','%e-%b-%y'),336.14);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('16-May-11','%e-%b-%y'),333.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-May-11','%e-%b-%y'),340.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-May-11','%e-%b-%y'),346.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-May-11','%e-%b-%y'),347.23);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('10-May-11','%e-%b-%y'),349.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-May-11','%e-%b-%y'),347.6);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('6-May-11','%e-%b-%y'),346.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-May-11','%e-%b-%y'),346.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('4-May-11','%e-%b-%y'),349.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-May-11','%e-%b-%y'),348.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-May-11','%e-%b-%y'),346.28);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Apr-11','%e-%b-%y'),350.13);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('28-Apr-11','%e-%b-%y'),346.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Apr-11','%e-%b-%y'),350.15);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-Apr-11','%e-%b-%y'),350.42);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Apr-11','%e-%b-%y'),353.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('21-Apr-11','%e-%b-%y'),350.7);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Apr-11','%e-%b-%y'),342.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('19-Apr-11','%e-%b-%y'),337.86);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Apr-11','%e-%b-%y'),331.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Apr-11','%e-%b-%y'),327.46);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Apr-11','%e-%b-%y'),332.42);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('13-Apr-11','%e-%b-%y'),336.13);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Apr-11','%e-%b-%y'),332.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('11-Apr-11','%e-%b-%y'),330.8);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Apr-11','%e-%b-%y'),335.06);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Apr-11','%e-%b-%y'),338.08);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Apr-11','%e-%b-%y'),338.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('5-Apr-11','%e-%b-%y'),338.89);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Apr-11','%e-%b-%y'),341.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('1-Apr-11','%e-%b-%y'),344.56);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-Mar-11','%e-%b-%y'),348.51);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-Mar-11','%e-%b-%y'),348.63);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Mar-11','%e-%b-%y'),350.96);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('28-Mar-11','%e-%b-%y'),350.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Mar-11','%e-%b-%y'),351.54);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('24-Mar-11','%e-%b-%y'),344.97);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Mar-11','%e-%b-%y'),339.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Mar-11','%e-%b-%y'),341.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Mar-11','%e-%b-%y'),339.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-Mar-11','%e-%b-%y'),330.67);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Mar-11','%e-%b-%y'),334.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('16-Mar-11','%e-%b-%y'),330.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Mar-11','%e-%b-%y'),345.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Mar-11','%e-%b-%y'),353.56);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Mar-11','%e-%b-%y'),351.99);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('10-Mar-11','%e-%b-%y'),346.67);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Mar-11','%e-%b-%y'),352.47);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('8-Mar-11','%e-%b-%y'),355.76);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Mar-11','%e-%b-%y'),355.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('4-Mar-11','%e-%b-%y'),360);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Mar-11','%e-%b-%y'),359.56);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Mar-11','%e-%b-%y'),352.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Mar-11','%e-%b-%y'),349.31);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('28-Feb-11','%e-%b-%y'),353.21);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Feb-11','%e-%b-%y'),348.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-Feb-11','%e-%b-%y'),342.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Feb-11','%e-%b-%y'),342.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Feb-11','%e-%b-%y'),338.61);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Feb-11','%e-%b-%y'),350.56);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('17-Feb-11','%e-%b-%y'),358.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Feb-11','%e-%b-%y'),363.13);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Feb-11','%e-%b-%y'),359.9);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Feb-11','%e-%b-%y'),359.18);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Feb-11','%e-%b-%y'),356.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Feb-11','%e-%b-%y'),354.54);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('9-Feb-11','%e-%b-%y'),358.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Feb-11','%e-%b-%y'),355.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Feb-11','%e-%b-%y'),351.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Feb-11','%e-%b-%y'),346.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Feb-11','%e-%b-%y'),343.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Feb-11','%e-%b-%y'),344.32);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('1-Feb-11','%e-%b-%y'),345.03);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-Jan-11','%e-%b-%y'),339.32);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('28-Jan-11','%e-%b-%y'),336.1);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Jan-11','%e-%b-%y'),343.21);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-Jan-11','%e-%b-%y'),343.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Jan-11','%e-%b-%y'),341.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('24-Jan-11','%e-%b-%y'),337.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Jan-11','%e-%b-%y'),326.72);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-Jan-11','%e-%b-%y'),332.68);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Jan-11','%e-%b-%y'),338.84);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-Jan-11','%e-%b-%y'),340.65);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Jan-11','%e-%b-%y'),348.48);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('13-Jan-11','%e-%b-%y'),345.68);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Jan-11','%e-%b-%y'),344.42);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Jan-11','%e-%b-%y'),341.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Jan-11','%e-%b-%y'),342.46);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Jan-11','%e-%b-%y'),336.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Jan-11','%e-%b-%y'),333.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('5-Jan-11','%e-%b-%y'),334);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Jan-11','%e-%b-%y'),331.29);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Jan-11','%e-%b-%y'),329.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-Dec-10','%e-%b-%y'),322.56);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-Dec-10','%e-%b-%y'),323.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Dec-10','%e-%b-%y'),325.29);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('28-Dec-10','%e-%b-%y'),325.47);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Dec-10','%e-%b-%y'),324.68);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Dec-10','%e-%b-%y'),323.6);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Dec-10','%e-%b-%y'),325.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('21-Dec-10','%e-%b-%y'),324.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Dec-10','%e-%b-%y'),322.21);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('17-Dec-10','%e-%b-%y'),320.61);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Dec-10','%e-%b-%y'),321.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Dec-10','%e-%b-%y'),320.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Dec-10','%e-%b-%y'),320.29);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('13-Dec-10','%e-%b-%y'),321.67);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Dec-10','%e-%b-%y'),320.56);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('9-Dec-10','%e-%b-%y'),319.76);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Dec-10','%e-%b-%y'),321.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Dec-10','%e-%b-%y'),318.21);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Dec-10','%e-%b-%y'),320.15);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Dec-10','%e-%b-%y'),317.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Dec-10','%e-%b-%y'),318.15);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('1-Dec-10','%e-%b-%y'),316.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Nov-10','%e-%b-%y'),311.15);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-Nov-10','%e-%b-%y'),316.87);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Nov-10','%e-%b-%y'),315);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-Nov-10','%e-%b-%y'),314.8);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Nov-10','%e-%b-%y'),308.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('22-Nov-10','%e-%b-%y'),313.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Nov-10','%e-%b-%y'),306.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-Nov-10','%e-%b-%y'),308.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Nov-10','%e-%b-%y'),300.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Nov-10','%e-%b-%y'),301.59);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Nov-10','%e-%b-%y'),307.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('12-Nov-10','%e-%b-%y'),308.03);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Nov-10','%e-%b-%y'),316.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('10-Nov-10','%e-%b-%y'),318.03);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Nov-10','%e-%b-%y'),316.08);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Nov-10','%e-%b-%y'),318.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Nov-10','%e-%b-%y'),317.13);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('4-Nov-10','%e-%b-%y'),318.27);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Nov-10','%e-%b-%y'),312.8);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Nov-10','%e-%b-%y'),309.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Nov-10','%e-%b-%y'),304.18);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-Oct-10','%e-%b-%y'),300.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Oct-10','%e-%b-%y'),305.24);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('27-Oct-10','%e-%b-%y'),307.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Oct-10','%e-%b-%y'),308.05);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('25-Oct-10','%e-%b-%y'),308.84);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Oct-10','%e-%b-%y'),307.47);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('21-Oct-10','%e-%b-%y'),309.52);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Oct-10','%e-%b-%y'),310.53);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('19-Oct-10','%e-%b-%y'),309.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Oct-10','%e-%b-%y'),318);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Oct-10','%e-%b-%y'),314.74);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Oct-10','%e-%b-%y'),302.31);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('13-Oct-10','%e-%b-%y'),300.14);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Oct-10','%e-%b-%y'),298.54);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('11-Oct-10','%e-%b-%y'),295.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Oct-10','%e-%b-%y'),294.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Oct-10','%e-%b-%y'),289.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Oct-10','%e-%b-%y'),289.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('5-Oct-10','%e-%b-%y'),288.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Oct-10','%e-%b-%y'),278.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('1-Oct-10','%e-%b-%y'),282.52);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Sep-10','%e-%b-%y'),283.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-Sep-10','%e-%b-%y'),287.37);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Sep-10','%e-%b-%y'),286.86);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Sep-10','%e-%b-%y'),291.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Sep-10','%e-%b-%y'),292.32);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('23-Sep-10','%e-%b-%y'),288.92);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Sep-10','%e-%b-%y'),287.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('21-Sep-10','%e-%b-%y'),283.77);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Sep-10','%e-%b-%y'),283.23);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('17-Sep-10','%e-%b-%y'),275.37);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Sep-10','%e-%b-%y'),276.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('15-Sep-10','%e-%b-%y'),270.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Sep-10','%e-%b-%y'),268.06);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('13-Sep-10','%e-%b-%y'),267.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Sep-10','%e-%b-%y'),263.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('9-Sep-10','%e-%b-%y'),263.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Sep-10','%e-%b-%y'),262.92);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('7-Sep-10','%e-%b-%y'),257.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Sep-10','%e-%b-%y'),258.77);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Sep-10','%e-%b-%y'),258.77);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Sep-10','%e-%b-%y'),252.17);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('1-Sep-10','%e-%b-%y'),250.33);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-Aug-10','%e-%b-%y'),243.1);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('30-Aug-10','%e-%b-%y'),242.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Aug-10','%e-%b-%y'),241.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-Aug-10','%e-%b-%y'),240.28);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Aug-10','%e-%b-%y'),242.89);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-Aug-10','%e-%b-%y'),239.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Aug-10','%e-%b-%y'),245.8);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('20-Aug-10','%e-%b-%y'),249.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Aug-10','%e-%b-%y'),249.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-Aug-10','%e-%b-%y'),253.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Aug-10','%e-%b-%y'),251.97);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Aug-10','%e-%b-%y'),247.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Aug-10','%e-%b-%y'),249.1);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('12-Aug-10','%e-%b-%y'),251.79);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Aug-10','%e-%b-%y'),250.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('10-Aug-10','%e-%b-%y'),259.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Aug-10','%e-%b-%y'),261.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Aug-10','%e-%b-%y'),260.09);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Aug-10','%e-%b-%y'),261.7);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('4-Aug-10','%e-%b-%y'),262.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Aug-10','%e-%b-%y'),261.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Aug-10','%e-%b-%y'),261.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Jul-10','%e-%b-%y'),257.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-Jul-10','%e-%b-%y'),258.11);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Jul-10','%e-%b-%y'),260.96);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('27-Jul-10','%e-%b-%y'),264.08);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Jul-10','%e-%b-%y'),259.28);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Jul-10','%e-%b-%y'),259.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Jul-10','%e-%b-%y'),259.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('21-Jul-10','%e-%b-%y'),254.24);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Jul-10','%e-%b-%y'),251.89);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('19-Jul-10','%e-%b-%y'),245.58);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Jul-10','%e-%b-%y'),249.9);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Jul-10','%e-%b-%y'),251.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Jul-10','%e-%b-%y'),252.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('13-Jul-10','%e-%b-%y'),251.8);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Jul-10','%e-%b-%y'),257.28);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('9-Jul-10','%e-%b-%y'),259.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Jul-10','%e-%b-%y'),258.09);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Jul-10','%e-%b-%y'),258.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Jul-10','%e-%b-%y'),248.63);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('5-Jul-10','%e-%b-%y'),246.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Jul-10','%e-%b-%y'),246.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('1-Jul-10','%e-%b-%y'),248.48);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Jun-10','%e-%b-%y'),251.53);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-Jun-10','%e-%b-%y'),256.17);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Jun-10','%e-%b-%y'),268.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('25-Jun-10','%e-%b-%y'),266.7);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Jun-10','%e-%b-%y'),269);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('23-Jun-10','%e-%b-%y'),270.97);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Jun-10','%e-%b-%y'),273.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('21-Jun-10','%e-%b-%y'),270.17);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Jun-10','%e-%b-%y'),274.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('17-Jun-10','%e-%b-%y'),271.87);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Jun-10','%e-%b-%y'),267.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('15-Jun-10','%e-%b-%y'),259.69);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Jun-10','%e-%b-%y'),254.28);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Jun-10','%e-%b-%y'),253.51);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Jun-10','%e-%b-%y'),250.51);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('9-Jun-10','%e-%b-%y'),243.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Jun-10','%e-%b-%y'),249.33);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('7-Jun-10','%e-%b-%y'),250.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Jun-10','%e-%b-%y'),255.96);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Jun-10','%e-%b-%y'),263.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Jun-10','%e-%b-%y'),263.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('1-Jun-10','%e-%b-%y'),260.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-May-10','%e-%b-%y'),256.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('28-May-10','%e-%b-%y'),256.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-May-10','%e-%b-%y'),253.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-May-10','%e-%b-%y'),244.11);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-May-10','%e-%b-%y'),245.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-May-10','%e-%b-%y'),246.76);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-May-10','%e-%b-%y'),242.32);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('20-May-10','%e-%b-%y'),237.76);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-May-10','%e-%b-%y'),248.34);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-May-10','%e-%b-%y'),252.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-May-10','%e-%b-%y'),254.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-May-10','%e-%b-%y'),253.82);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-May-10','%e-%b-%y'),258.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('12-May-10','%e-%b-%y'),262.09);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-May-10','%e-%b-%y'),256.52);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('10-May-10','%e-%b-%y'),253.99);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-May-10','%e-%b-%y'),235.86);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-May-10','%e-%b-%y'),246.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-May-10','%e-%b-%y'),255.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('4-May-10','%e-%b-%y'),258.68);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-May-10','%e-%b-%y'),266.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-Apr-10','%e-%b-%y'),261.09);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Apr-10','%e-%b-%y'),268.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('28-Apr-10','%e-%b-%y'),261.6);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Apr-10','%e-%b-%y'),262.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('26-Apr-10','%e-%b-%y'),269.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Apr-10','%e-%b-%y'),270.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Apr-10','%e-%b-%y'),266.47);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Apr-10','%e-%b-%y'),259.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-Apr-10','%e-%b-%y'),244.59);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Apr-10','%e-%b-%y'),247.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('16-Apr-10','%e-%b-%y'),247.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Apr-10','%e-%b-%y'),248.92);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Apr-10','%e-%b-%y'),245.69);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Apr-10','%e-%b-%y'),242.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Apr-10','%e-%b-%y'),242.29);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Apr-10','%e-%b-%y'),241.79);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('8-Apr-10','%e-%b-%y'),239.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Apr-10','%e-%b-%y'),240.6);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Apr-10','%e-%b-%y'),239.54);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Apr-10','%e-%b-%y'),238.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Apr-10','%e-%b-%y'),235.97);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Apr-10','%e-%b-%y'),235.97);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('31-Mar-10','%e-%b-%y'),235);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Mar-10','%e-%b-%y'),235.84);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-Mar-10','%e-%b-%y'),232.39);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Mar-10','%e-%b-%y'),230.9);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('25-Mar-10','%e-%b-%y'),226.65);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Mar-10','%e-%b-%y'),229.37);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('23-Mar-10','%e-%b-%y'),228.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Mar-10','%e-%b-%y'),224.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('19-Mar-10','%e-%b-%y'),222.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Mar-10','%e-%b-%y'),224.65);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('17-Mar-10','%e-%b-%y'),224.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Mar-10','%e-%b-%y'),224.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('15-Mar-10','%e-%b-%y'),223.84);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Mar-10','%e-%b-%y'),226.6);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Mar-10','%e-%b-%y'),225.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Mar-10','%e-%b-%y'),224.84);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('9-Mar-10','%e-%b-%y'),223.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Mar-10','%e-%b-%y'),219.08);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('5-Mar-10','%e-%b-%y'),218.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Mar-10','%e-%b-%y'),210.71);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Mar-10','%e-%b-%y'),209.33);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Mar-10','%e-%b-%y'),208.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('1-Mar-10','%e-%b-%y'),208.99);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Feb-10','%e-%b-%y'),204.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('25-Feb-10','%e-%b-%y'),202);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Feb-10','%e-%b-%y'),200.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Feb-10','%e-%b-%y'),197.06);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Feb-10','%e-%b-%y'),200.42);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('19-Feb-10','%e-%b-%y'),201.67);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Feb-10','%e-%b-%y'),202.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('17-Feb-10','%e-%b-%y'),202.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Feb-10','%e-%b-%y'),203.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Feb-10','%e-%b-%y'),200.38);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Feb-10','%e-%b-%y'),200.38);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Feb-10','%e-%b-%y'),198.67);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Feb-10','%e-%b-%y'),195.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('9-Feb-10','%e-%b-%y'),196.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Feb-10','%e-%b-%y'),194.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('5-Feb-10','%e-%b-%y'),195.46);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Feb-10','%e-%b-%y'),192.05);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Feb-10','%e-%b-%y'),199.23);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Feb-10','%e-%b-%y'),195.86);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('1-Feb-10','%e-%b-%y'),194.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Jan-10','%e-%b-%y'),192.06);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('28-Jan-10','%e-%b-%y'),199.29);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Jan-10','%e-%b-%y'),207.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-Jan-10','%e-%b-%y'),205.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Jan-10','%e-%b-%y'),203.08);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('22-Jan-10','%e-%b-%y'),197.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Jan-10','%e-%b-%y'),208.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-Jan-10','%e-%b-%y'),211.72);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Jan-10','%e-%b-%y'),215.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-Jan-10','%e-%b-%y'),205.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Jan-10','%e-%b-%y'),205.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('14-Jan-10','%e-%b-%y'),209.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Jan-10','%e-%b-%y'),210.65);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Jan-10','%e-%b-%y'),207.72);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Jan-10','%e-%b-%y'),210.11);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Jan-10','%e-%b-%y'),211.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Jan-10','%e-%b-%y'),210.58);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('6-Jan-10','%e-%b-%y'),210.97);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Jan-10','%e-%b-%y'),214.38);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('4-Jan-10','%e-%b-%y'),214.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Jan-10','%e-%b-%y'),210.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('31-Dec-09','%e-%b-%y'),210.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Dec-09','%e-%b-%y'),211.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('29-Dec-09','%e-%b-%y'),209.1);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Dec-09','%e-%b-%y'),211.61);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('25-Dec-09','%e-%b-%y'),209.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Dec-09','%e-%b-%y'),209.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Dec-09','%e-%b-%y'),202.1);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Dec-09','%e-%b-%y'),200.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('21-Dec-09','%e-%b-%y'),198.23);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Dec-09','%e-%b-%y'),195.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('17-Dec-09','%e-%b-%y'),191.86);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Dec-09','%e-%b-%y'),195.03);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Dec-09','%e-%b-%y'),194.17);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Dec-09','%e-%b-%y'),196.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('11-Dec-09','%e-%b-%y'),194.67);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Dec-09','%e-%b-%y'),196.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('9-Dec-09','%e-%b-%y'),197.8);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Dec-09','%e-%b-%y'),189.87);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Dec-09','%e-%b-%y'),188.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Dec-09','%e-%b-%y'),193.32);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('3-Dec-09','%e-%b-%y'),196.48);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Dec-09','%e-%b-%y'),196.23);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('1-Dec-09','%e-%b-%y'),196.97);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Nov-09','%e-%b-%y'),199.91);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Nov-09','%e-%b-%y'),200.59);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Nov-09','%e-%b-%y'),204.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('25-Nov-09','%e-%b-%y'),204.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Nov-09','%e-%b-%y'),204.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Nov-09','%e-%b-%y'),205.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Nov-09','%e-%b-%y'),199.92);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('19-Nov-09','%e-%b-%y'),200.51);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Nov-09','%e-%b-%y'),205.96);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('17-Nov-09','%e-%b-%y'),207);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Nov-09','%e-%b-%y'),206.63);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('13-Nov-09','%e-%b-%y'),204.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Nov-09','%e-%b-%y'),201.99);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Nov-09','%e-%b-%y'),203.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Nov-09','%e-%b-%y'),202.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('9-Nov-09','%e-%b-%y'),201.46);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Nov-09','%e-%b-%y'),194.34);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('5-Nov-09','%e-%b-%y'),194.03);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Nov-09','%e-%b-%y'),190.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Nov-09','%e-%b-%y'),188.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Nov-09','%e-%b-%y'),189.31);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('30-Oct-09','%e-%b-%y'),188.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Oct-09','%e-%b-%y'),196.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('28-Oct-09','%e-%b-%y'),192.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Oct-09','%e-%b-%y'),197.37);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-Oct-09','%e-%b-%y'),202.48);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Oct-09','%e-%b-%y'),203.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('22-Oct-09','%e-%b-%y'),205.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Oct-09','%e-%b-%y'),204.92);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-Oct-09','%e-%b-%y'),198.76);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Oct-09','%e-%b-%y'),189.86);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Oct-09','%e-%b-%y'),188.05);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Oct-09','%e-%b-%y'),190.56);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('14-Oct-09','%e-%b-%y'),191.29);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Oct-09','%e-%b-%y'),190.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Oct-09','%e-%b-%y'),190.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Oct-09','%e-%b-%y'),190.47);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Oct-09','%e-%b-%y'),189.27);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Oct-09','%e-%b-%y'),190.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('6-Oct-09','%e-%b-%y'),190.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Oct-09','%e-%b-%y'),186.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Oct-09','%e-%b-%y'),184.9);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Oct-09','%e-%b-%y'),180.86);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-Sep-09','%e-%b-%y'),185.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Sep-09','%e-%b-%y'),185.38);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('28-Sep-09','%e-%b-%y'),186.15);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Sep-09','%e-%b-%y'),182.37);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-Sep-09','%e-%b-%y'),183.82);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Sep-09','%e-%b-%y'),185.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Sep-09','%e-%b-%y'),184.48);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Sep-09','%e-%b-%y'),184.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('18-Sep-09','%e-%b-%y'),185.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Sep-09','%e-%b-%y'),184.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Sep-09','%e-%b-%y'),181.87);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Sep-09','%e-%b-%y'),175.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Sep-09','%e-%b-%y'),173.72);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Sep-09','%e-%b-%y'),172.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('10-Sep-09','%e-%b-%y'),172.56);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Sep-09','%e-%b-%y'),171.14);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Sep-09','%e-%b-%y'),172.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Sep-09','%e-%b-%y'),170.31);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Sep-09','%e-%b-%y'),166.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Sep-09','%e-%b-%y'),165.18);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('1-Sep-09','%e-%b-%y'),165.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-Aug-09','%e-%b-%y'),168.21);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('28-Aug-09','%e-%b-%y'),170.05);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Aug-09','%e-%b-%y'),169.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-Aug-09','%e-%b-%y'),167.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Aug-09','%e-%b-%y'),169.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('24-Aug-09','%e-%b-%y'),169.06);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Aug-09','%e-%b-%y'),169.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-Aug-09','%e-%b-%y'),166.33);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Aug-09','%e-%b-%y'),164.6);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-Aug-09','%e-%b-%y'),164);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Aug-09','%e-%b-%y'),159.59);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('14-Aug-09','%e-%b-%y'),166.78);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Aug-09','%e-%b-%y'),168.42);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Aug-09','%e-%b-%y'),165.31);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Aug-09','%e-%b-%y'),164.72);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Aug-09','%e-%b-%y'),165.51);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Aug-09','%e-%b-%y'),163.91);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('5-Aug-09','%e-%b-%y'),165.11);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Aug-09','%e-%b-%y'),165.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Aug-09','%e-%b-%y'),166.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-Jul-09','%e-%b-%y'),163.39);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-Jul-09','%e-%b-%y'),162.79);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Jul-09','%e-%b-%y'),160.03);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('28-Jul-09','%e-%b-%y'),160);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Jul-09','%e-%b-%y'),160.1);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-Jul-09','%e-%b-%y'),159.99);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Jul-09','%e-%b-%y'),157.82);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Jul-09','%e-%b-%y'),156.74);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Jul-09','%e-%b-%y'),151.51);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('20-Jul-09','%e-%b-%y'),152.91);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Jul-09','%e-%b-%y'),151.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Jul-09','%e-%b-%y'),147.52);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Jul-09','%e-%b-%y'),146.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Jul-09','%e-%b-%y'),142.27);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Jul-09','%e-%b-%y'),142.34);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('10-Jul-09','%e-%b-%y'),138.52);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Jul-09','%e-%b-%y'),136.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Jul-09','%e-%b-%y'),137.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Jul-09','%e-%b-%y'),135.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Jul-09','%e-%b-%y'),138.61);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Jul-09','%e-%b-%y'),140.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('2-Jul-09','%e-%b-%y'),140.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Jul-09','%e-%b-%y'),142.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-Jun-09','%e-%b-%y'),142.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Jun-09','%e-%b-%y'),141.97);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-Jun-09','%e-%b-%y'),142.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Jun-09','%e-%b-%y'),139.86);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('24-Jun-09','%e-%b-%y'),136.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Jun-09','%e-%b-%y'),134.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Jun-09','%e-%b-%y'),137.37);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Jun-09','%e-%b-%y'),139.48);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-Jun-09','%e-%b-%y'),135.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Jun-09','%e-%b-%y'),135.58);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('16-Jun-09','%e-%b-%y'),136.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Jun-09','%e-%b-%y'),136.09);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Jun-09','%e-%b-%y'),136.97);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Jun-09','%e-%b-%y'),139.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('10-Jun-09','%e-%b-%y'),140.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Jun-09','%e-%b-%y'),142.72);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('8-Jun-09','%e-%b-%y'),143.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Jun-09','%e-%b-%y'),144.67);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('4-Jun-09','%e-%b-%y'),143.74);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Jun-09','%e-%b-%y'),140.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Jun-09','%e-%b-%y'),139.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Jun-09','%e-%b-%y'),139.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('29-May-09','%e-%b-%y'),135.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-May-09','%e-%b-%y'),135.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-May-09','%e-%b-%y'),133.05);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-May-09','%e-%b-%y'),130.78);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-May-09','%e-%b-%y'),122.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-May-09','%e-%b-%y'),124.18);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('20-May-09','%e-%b-%y'),125.87);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-May-09','%e-%b-%y'),127.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-May-09','%e-%b-%y'),126.65);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-May-09','%e-%b-%y'),122.42);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-May-09','%e-%b-%y'),122.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-May-09','%e-%b-%y'),119.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('12-May-09','%e-%b-%y'),124.42);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-May-09','%e-%b-%y'),129.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-May-09','%e-%b-%y'),129.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-May-09','%e-%b-%y'),129.06);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-May-09','%e-%b-%y'),132.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-May-09','%e-%b-%y'),132.71);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('4-May-09','%e-%b-%y'),132.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-May-09','%e-%b-%y'),127.24);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-Apr-09','%e-%b-%y'),125.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Apr-09','%e-%b-%y'),125.14);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('28-Apr-09','%e-%b-%y'),123.9);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Apr-09','%e-%b-%y'),124.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('24-Apr-09','%e-%b-%y'),123.9);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Apr-09','%e-%b-%y'),125.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Apr-09','%e-%b-%y'),121.51);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Apr-09','%e-%b-%y'),121.76);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-Apr-09','%e-%b-%y'),120.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Apr-09','%e-%b-%y'),123.42);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('16-Apr-09','%e-%b-%y'),121.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Apr-09','%e-%b-%y'),117.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Apr-09','%e-%b-%y'),118.31);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Apr-09','%e-%b-%y'),120.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('10-Apr-09','%e-%b-%y'),119.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Apr-09','%e-%b-%y'),119.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('8-Apr-09','%e-%b-%y'),116.32);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Apr-09','%e-%b-%y'),115);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Apr-09','%e-%b-%y'),118.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Apr-09','%e-%b-%y'),115.99);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Apr-09','%e-%b-%y'),112.71);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Apr-09','%e-%b-%y'),108.69);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('31-Mar-09','%e-%b-%y'),105.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Mar-09','%e-%b-%y'),104.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Mar-09','%e-%b-%y'),106.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Mar-09','%e-%b-%y'),109.87);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('25-Mar-09','%e-%b-%y'),106.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Mar-09','%e-%b-%y'),106.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('23-Mar-09','%e-%b-%y'),107.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Mar-09','%e-%b-%y'),101.59);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('19-Mar-09','%e-%b-%y'),101.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Mar-09','%e-%b-%y'),101.52);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('17-Mar-09','%e-%b-%y'),99.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Mar-09','%e-%b-%y'),95.42);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('13-Mar-09','%e-%b-%y'),95.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Mar-09','%e-%b-%y'),96.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Mar-09','%e-%b-%y'),92.68);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Mar-09','%e-%b-%y'),88.63);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('9-Mar-09','%e-%b-%y'),83.11);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Mar-09','%e-%b-%y'),85.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('5-Mar-09','%e-%b-%y'),88.84);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Mar-09','%e-%b-%y'),91.17);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Mar-09','%e-%b-%y'),88.37);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Mar-09','%e-%b-%y'),87.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Feb-09','%e-%b-%y'),89.31);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Feb-09','%e-%b-%y'),89.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('25-Feb-09','%e-%b-%y'),91.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Feb-09','%e-%b-%y'),90.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Feb-09','%e-%b-%y'),86.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Feb-09','%e-%b-%y'),91.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('19-Feb-09','%e-%b-%y'),90.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Feb-09','%e-%b-%y'),94.37);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('17-Feb-09','%e-%b-%y'),94.53);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Feb-09','%e-%b-%y'),99.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Feb-09','%e-%b-%y'),99.27);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Feb-09','%e-%b-%y'),96.82);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('10-Feb-09','%e-%b-%y'),97.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Feb-09','%e-%b-%y'),102.51);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('6-Feb-09','%e-%b-%y'),99.72);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Feb-09','%e-%b-%y'),96.46);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('4-Feb-09','%e-%b-%y'),93.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Feb-09','%e-%b-%y'),92.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Feb-09','%e-%b-%y'),91.51);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Jan-09','%e-%b-%y'),90.13);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('29-Jan-09','%e-%b-%y'),93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Jan-09','%e-%b-%y'),94.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Jan-09','%e-%b-%y'),90.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Jan-09','%e-%b-%y'),89.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Jan-09','%e-%b-%y'),88.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Jan-09','%e-%b-%y'),88.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('21-Jan-09','%e-%b-%y'),82.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Jan-09','%e-%b-%y'),78.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Jan-09','%e-%b-%y'),82.33);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Jan-09','%e-%b-%y'),83.38);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Jan-09','%e-%b-%y'),85.33);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Jan-09','%e-%b-%y'),87.71);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('12-Jan-09','%e-%b-%y'),88.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Jan-09','%e-%b-%y'),90.58);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Jan-09','%e-%b-%y'),92.7);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Jan-09','%e-%b-%y'),91.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Jan-09','%e-%b-%y'),93.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Jan-09','%e-%b-%y'),94.58);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('2-Jan-09','%e-%b-%y'),90.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Jan-09','%e-%b-%y'),85.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('31-Dec-08','%e-%b-%y'),85.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Dec-08','%e-%b-%y'),86.29);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-Dec-08','%e-%b-%y'),86.61);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Dec-08','%e-%b-%y'),85.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('25-Dec-08','%e-%b-%y'),85.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Dec-08','%e-%b-%y'),85.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Dec-08','%e-%b-%y'),86.38);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Dec-08','%e-%b-%y'),85.74);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('19-Dec-08','%e-%b-%y'),90);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Dec-08','%e-%b-%y'),89.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('17-Dec-08','%e-%b-%y'),89.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Dec-08','%e-%b-%y'),95.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Dec-08','%e-%b-%y'),94.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Dec-08','%e-%b-%y'),98.27);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Dec-08','%e-%b-%y'),95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Dec-08','%e-%b-%y'),98.21);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('9-Dec-08','%e-%b-%y'),100.06);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Dec-08','%e-%b-%y'),99.72);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('5-Dec-08','%e-%b-%y'),94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Dec-08','%e-%b-%y'),91.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Dec-08','%e-%b-%y'),95.9);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Dec-08','%e-%b-%y'),92.47);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('1-Dec-08','%e-%b-%y'),88.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Nov-08','%e-%b-%y'),92.67);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Nov-08','%e-%b-%y'),95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Nov-08','%e-%b-%y'),95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('25-Nov-08','%e-%b-%y'),90.8);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Nov-08','%e-%b-%y'),92.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('21-Nov-08','%e-%b-%y'),82.58);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Nov-08','%e-%b-%y'),80.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('19-Nov-08','%e-%b-%y'),86.29);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Nov-08','%e-%b-%y'),89.91);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('17-Nov-08','%e-%b-%y'),88.14);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Nov-08','%e-%b-%y'),90.24);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('13-Nov-08','%e-%b-%y'),96.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Nov-08','%e-%b-%y'),90.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Nov-08','%e-%b-%y'),94.77);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Nov-08','%e-%b-%y'),95.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Nov-08','%e-%b-%y'),98.24);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Nov-08','%e-%b-%y'),99.1);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('5-Nov-08','%e-%b-%y'),103.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Nov-08','%e-%b-%y'),110.99);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Nov-08','%e-%b-%y'),106.96);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-Oct-08','%e-%b-%y'),107.59);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-Oct-08','%e-%b-%y'),111.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Oct-08','%e-%b-%y'),104.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('28-Oct-08','%e-%b-%y'),99.91);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Oct-08','%e-%b-%y'),92.09);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-Oct-08','%e-%b-%y'),96.38);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Oct-08','%e-%b-%y'),98.23);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Oct-08','%e-%b-%y'),96.87);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Oct-08','%e-%b-%y'),91.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('20-Oct-08','%e-%b-%y'),98.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Oct-08','%e-%b-%y'),97.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Oct-08','%e-%b-%y'),101.89);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Oct-08','%e-%b-%y'),97.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Oct-08','%e-%b-%y'),104.08);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Oct-08','%e-%b-%y'),110.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('10-Oct-08','%e-%b-%y'),96.8);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Oct-08','%e-%b-%y'),88.74);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Oct-08','%e-%b-%y'),89.79);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Oct-08','%e-%b-%y'),89.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Oct-08','%e-%b-%y'),98.14);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Oct-08','%e-%b-%y'),97.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('2-Oct-08','%e-%b-%y'),100.1);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Oct-08','%e-%b-%y'),109.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-Sep-08','%e-%b-%y'),113.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Sep-08','%e-%b-%y'),105.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-Sep-08','%e-%b-%y'),128.24);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Sep-08','%e-%b-%y'),131.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('24-Sep-08','%e-%b-%y'),128.71);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Sep-08','%e-%b-%y'),126.84);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Sep-08','%e-%b-%y'),131.05);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Sep-08','%e-%b-%y'),140.91);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-Sep-08','%e-%b-%y'),134.09);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Sep-08','%e-%b-%y'),127.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('16-Sep-08','%e-%b-%y'),139.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Sep-08','%e-%b-%y'),140.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Sep-08','%e-%b-%y'),148.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Sep-08','%e-%b-%y'),152.65);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('10-Sep-08','%e-%b-%y'),151.61);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Sep-08','%e-%b-%y'),151.68);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('8-Sep-08','%e-%b-%y'),157.92);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Sep-08','%e-%b-%y'),160.18);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('4-Sep-08','%e-%b-%y'),161.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Sep-08','%e-%b-%y'),166.96);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Sep-08','%e-%b-%y'),166.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Aug-08','%e-%b-%y'),169.53);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('28-Aug-08','%e-%b-%y'),173.74);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Aug-08','%e-%b-%y'),174.67);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-Aug-08','%e-%b-%y'),173.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Aug-08','%e-%b-%y'),172.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-Aug-08','%e-%b-%y'),176.79);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Aug-08','%e-%b-%y'),174.29);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('20-Aug-08','%e-%b-%y'),175.84);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Aug-08','%e-%b-%y'),173.53);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-Aug-08','%e-%b-%y'),175.39);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Aug-08','%e-%b-%y'),175.74);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Aug-08','%e-%b-%y'),179.32);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Aug-08','%e-%b-%y'),179.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('12-Aug-08','%e-%b-%y'),176.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Aug-08','%e-%b-%y'),173.56);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Aug-08','%e-%b-%y'),169.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Aug-08','%e-%b-%y'),163.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Aug-08','%e-%b-%y'),164.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Aug-08','%e-%b-%y'),160.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('4-Aug-08','%e-%b-%y'),153.23);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Aug-08','%e-%b-%y'),156.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('31-Jul-08','%e-%b-%y'),158.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Jul-08','%e-%b-%y'),159.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-Jul-08','%e-%b-%y'),157.08);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Jul-08','%e-%b-%y'),154.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('25-Jul-08','%e-%b-%y'),162.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Jul-08','%e-%b-%y'),159.03);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Jul-08','%e-%b-%y'),166.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Jul-08','%e-%b-%y'),162.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('21-Jul-08','%e-%b-%y'),166.29);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Jul-08','%e-%b-%y'),165.15);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('17-Jul-08','%e-%b-%y'),171.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Jul-08','%e-%b-%y'),172.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Jul-08','%e-%b-%y'),169.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Jul-08','%e-%b-%y'),173.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Jul-08','%e-%b-%y'),172.58);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Jul-08','%e-%b-%y'),176.63);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('9-Jul-08','%e-%b-%y'),174.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Jul-08','%e-%b-%y'),179.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Jul-08','%e-%b-%y'),175.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Jul-08','%e-%b-%y'),170.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Jul-08','%e-%b-%y'),168.18);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Jul-08','%e-%b-%y'),174.68);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('30-Jun-08','%e-%b-%y'),167.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Jun-08','%e-%b-%y'),170.09);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-Jun-08','%e-%b-%y'),168.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Jun-08','%e-%b-%y'),177.39);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-Jun-08','%e-%b-%y'),173.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Jun-08','%e-%b-%y'),173.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('20-Jun-08','%e-%b-%y'),175.27);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Jun-08','%e-%b-%y'),180.9);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-Jun-08','%e-%b-%y'),178.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Jun-08','%e-%b-%y'),181.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Jun-08','%e-%b-%y'),176.84);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Jun-08','%e-%b-%y'),172.37);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('12-Jun-08','%e-%b-%y'),173.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Jun-08','%e-%b-%y'),180.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('10-Jun-08','%e-%b-%y'),185.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Jun-08','%e-%b-%y'),181.61);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Jun-08','%e-%b-%y'),185.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Jun-08','%e-%b-%y'),189.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('4-Jun-08','%e-%b-%y'),185.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Jun-08','%e-%b-%y'),185.37);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Jun-08','%e-%b-%y'),186.1);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-May-08','%e-%b-%y'),188.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-May-08','%e-%b-%y'),186.69);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-May-08','%e-%b-%y'),187.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('27-May-08','%e-%b-%y'),186.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-May-08','%e-%b-%y'),181.17);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('22-May-08','%e-%b-%y'),177.05);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-May-08','%e-%b-%y'),178.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-May-08','%e-%b-%y'),185.9);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-May-08','%e-%b-%y'),183.6);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('16-May-08','%e-%b-%y'),187.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-May-08','%e-%b-%y'),189.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-May-08','%e-%b-%y'),186.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-May-08','%e-%b-%y'),189.96);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-May-08','%e-%b-%y'),188.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-May-08','%e-%b-%y'),183.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('8-May-08','%e-%b-%y'),185.06);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-May-08','%e-%b-%y'),182.59);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-May-08','%e-%b-%y'),186.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-May-08','%e-%b-%y'),184.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-May-08','%e-%b-%y'),180.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-May-08','%e-%b-%y'),180);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('30-Apr-08','%e-%b-%y'),173.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-Apr-08','%e-%b-%y'),175.05);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('28-Apr-08','%e-%b-%y'),172.24);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Apr-08','%e-%b-%y'),169.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-Apr-08','%e-%b-%y'),168.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Apr-08','%e-%b-%y'),162.89);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('22-Apr-08','%e-%b-%y'),160.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Apr-08','%e-%b-%y'),168.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-Apr-08','%e-%b-%y'),161.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Apr-08','%e-%b-%y'),154.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Apr-08','%e-%b-%y'),153.7);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Apr-08','%e-%b-%y'),148.38);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('14-Apr-08','%e-%b-%y'),147.78);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Apr-08','%e-%b-%y'),147.14);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('10-Apr-08','%e-%b-%y'),154.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Apr-08','%e-%b-%y'),151.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Apr-08','%e-%b-%y'),152.84);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Apr-08','%e-%b-%y'),155.89);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('4-Apr-08','%e-%b-%y'),153.08);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Apr-08','%e-%b-%y'),151.61);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Apr-08','%e-%b-%y'),147.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Apr-08','%e-%b-%y'),149.53);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('31-Mar-08','%e-%b-%y'),143.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Mar-08','%e-%b-%y'),143.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('27-Mar-08','%e-%b-%y'),140.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Mar-08','%e-%b-%y'),145.06);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('25-Mar-08','%e-%b-%y'),140.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Mar-08','%e-%b-%y'),139.53);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-Mar-08','%e-%b-%y'),133.27);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Mar-08','%e-%b-%y'),129.67);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('18-Mar-08','%e-%b-%y'),132.82);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Mar-08','%e-%b-%y'),126.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Mar-08','%e-%b-%y'),126.61);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Mar-08','%e-%b-%y'),127.94);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Mar-08','%e-%b-%y'),126.03);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Mar-08','%e-%b-%y'),127.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('10-Mar-08','%e-%b-%y'),119.69);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Mar-08','%e-%b-%y'),122.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Mar-08','%e-%b-%y'),120.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Mar-08','%e-%b-%y'),124.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('4-Mar-08','%e-%b-%y'),124.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Mar-08','%e-%b-%y'),121.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('29-Feb-08','%e-%b-%y'),125.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Feb-08','%e-%b-%y'),129.91);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Feb-08','%e-%b-%y'),122.96);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Feb-08','%e-%b-%y'),119.15);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('25-Feb-08','%e-%b-%y'),119.74);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Feb-08','%e-%b-%y'),119.46);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('21-Feb-08','%e-%b-%y'),121.54);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Feb-08','%e-%b-%y'),123.82);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('19-Feb-08','%e-%b-%y'),122.18);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Feb-08','%e-%b-%y'),124.63);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Feb-08','%e-%b-%y'),127.46);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Feb-08','%e-%b-%y'),129.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('12-Feb-08','%e-%b-%y'),124.86);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Feb-08','%e-%b-%y'),129.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Feb-08','%e-%b-%y'),125.48);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Feb-08','%e-%b-%y'),121.24);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Feb-08','%e-%b-%y'),122);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Feb-08','%e-%b-%y'),129.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('4-Feb-08','%e-%b-%y'),131.65);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Feb-08','%e-%b-%y'),133.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('31-Jan-08','%e-%b-%y'),135.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Jan-08','%e-%b-%y'),132.18);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-Jan-08','%e-%b-%y'),131.54);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Jan-08','%e-%b-%y'),130.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('25-Jan-08','%e-%b-%y'),130.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Jan-08','%e-%b-%y'),135.6);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Jan-08','%e-%b-%y'),139.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Jan-08','%e-%b-%y'),155.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('18-Jan-08','%e-%b-%y'),161.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Jan-08','%e-%b-%y'),160.89);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('16-Jan-08','%e-%b-%y'),159.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Jan-08','%e-%b-%y'),169.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('14-Jan-08','%e-%b-%y'),178.78);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Jan-08','%e-%b-%y'),172.69);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('10-Jan-08','%e-%b-%y'),178.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Jan-08','%e-%b-%y'),179.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('8-Jan-08','%e-%b-%y'),171.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Jan-08','%e-%b-%y'),177.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('4-Jan-08','%e-%b-%y'),180.05);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('3-Jan-08','%e-%b-%y'),194.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Jan-08','%e-%b-%y'),194.84);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-Dec-07','%e-%b-%y'),198.08);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('28-Dec-07','%e-%b-%y'),199.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Dec-07','%e-%b-%y'),198.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('26-Dec-07','%e-%b-%y'),198.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Dec-07','%e-%b-%y'),198.8);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('21-Dec-07','%e-%b-%y'),193.91);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Dec-07','%e-%b-%y'),187.21);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('19-Dec-07','%e-%b-%y'),183.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Dec-07','%e-%b-%y'),182.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('17-Dec-07','%e-%b-%y'),184.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Dec-07','%e-%b-%y'),190.39);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('13-Dec-07','%e-%b-%y'),191.83);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Dec-07','%e-%b-%y'),190.86);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('11-Dec-07','%e-%b-%y'),188.54);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Dec-07','%e-%b-%y'),194.21);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Dec-07','%e-%b-%y'),194.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Dec-07','%e-%b-%y'),189.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('5-Dec-07','%e-%b-%y'),185.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Dec-07','%e-%b-%y'),179.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('3-Dec-07','%e-%b-%y'),178.86);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Nov-07','%e-%b-%y'),182.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('29-Nov-07','%e-%b-%y'),184.29);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Nov-07','%e-%b-%y'),180.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Nov-07','%e-%b-%y'),174.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Nov-07','%e-%b-%y'),172.54);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('23-Nov-07','%e-%b-%y'),171.54);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('21-Nov-07','%e-%b-%y'),168.46);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-Nov-07','%e-%b-%y'),168.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Nov-07','%e-%b-%y'),163.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Nov-07','%e-%b-%y'),166.39);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('15-Nov-07','%e-%b-%y'),164.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('14-Nov-07','%e-%b-%y'),166.11);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Nov-07','%e-%b-%y'),169.96);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Nov-07','%e-%b-%y'),153.76);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Nov-07','%e-%b-%y'),165.37);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('8-Nov-07','%e-%b-%y'),175.47);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('7-Nov-07','%e-%b-%y'),186.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('6-Nov-07','%e-%b-%y'),191.79);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Nov-07','%e-%b-%y'),186.18);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('2-Nov-07','%e-%b-%y'),187.87);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('1-Nov-07','%e-%b-%y'),187.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('31-Oct-07','%e-%b-%y'),189.95);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Oct-07','%e-%b-%y'),187);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('29-Oct-07','%e-%b-%y'),185.09);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Oct-07','%e-%b-%y'),184.7);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('25-Oct-07','%e-%b-%y'),182.78);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Oct-07','%e-%b-%y'),185.93);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Oct-07','%e-%b-%y'),186.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Oct-07','%e-%b-%y'),174.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('19-Oct-07','%e-%b-%y'),170.42);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Oct-07','%e-%b-%y'),173.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('17-Oct-07','%e-%b-%y'),172.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Oct-07','%e-%b-%y'),169.58);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Oct-07','%e-%b-%y'),166.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Oct-07','%e-%b-%y'),167.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('11-Oct-07','%e-%b-%y'),162.23);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Oct-07','%e-%b-%y'),166.79);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('9-Oct-07','%e-%b-%y'),167.86);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Oct-07','%e-%b-%y'),167.91);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('5-Oct-07','%e-%b-%y'),161.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Oct-07','%e-%b-%y'),156.24);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('3-Oct-07','%e-%b-%y'),157.92);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Oct-07','%e-%b-%y'),158.45);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('1-Oct-07','%e-%b-%y'),156.34);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Sep-07','%e-%b-%y'),153.47);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Sep-07','%e-%b-%y'),154.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Sep-07','%e-%b-%y'),152.77);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('25-Sep-07','%e-%b-%y'),153.18);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Sep-07','%e-%b-%y'),148.28);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('21-Sep-07','%e-%b-%y'),144.15);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Sep-07','%e-%b-%y'),140.31);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('19-Sep-07','%e-%b-%y'),140.77);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Sep-07','%e-%b-%y'),140.92);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('17-Sep-07','%e-%b-%y'),138.41);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Sep-07','%e-%b-%y'),138.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('13-Sep-07','%e-%b-%y'),137.2);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Sep-07','%e-%b-%y'),136.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Sep-07','%e-%b-%y'),135.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Sep-07','%e-%b-%y'),136.71);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('7-Sep-07','%e-%b-%y'),131.77);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Sep-07','%e-%b-%y'),135.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('5-Sep-07','%e-%b-%y'),136.76);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Sep-07','%e-%b-%y'),144.16);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('31-Aug-07','%e-%b-%y'),138.48);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Aug-07','%e-%b-%y'),136.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('29-Aug-07','%e-%b-%y'),134.08);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Aug-07','%e-%b-%y'),126.82);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Aug-07','%e-%b-%y'),132.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Aug-07','%e-%b-%y'),135.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-Aug-07','%e-%b-%y'),131.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Aug-07','%e-%b-%y'),132.51);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('21-Aug-07','%e-%b-%y'),127.57);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Aug-07','%e-%b-%y'),122.22);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('17-Aug-07','%e-%b-%y'),122.06);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-Aug-07','%e-%b-%y'),117.05);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Aug-07','%e-%b-%y'),119.9);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Aug-07','%e-%b-%y'),124.03);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('13-Aug-07','%e-%b-%y'),127.79);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-Aug-07','%e-%b-%y'),125);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('9-Aug-07','%e-%b-%y'),126.39);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Aug-07','%e-%b-%y'),134.01);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Aug-07','%e-%b-%y'),135.03);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Aug-07','%e-%b-%y'),135.25);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('3-Aug-07','%e-%b-%y'),131.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Aug-07','%e-%b-%y'),136.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('1-Aug-07','%e-%b-%y'),135);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-Jul-07','%e-%b-%y'),131.76);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-Jul-07','%e-%b-%y'),141.43);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('27-Jul-07','%e-%b-%y'),143.85);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('26-Jul-07','%e-%b-%y'),146);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('25-Jul-07','%e-%b-%y'),137.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('24-Jul-07','%e-%b-%y'),134.89);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('23-Jul-07','%e-%b-%y'),143.7);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('20-Jul-07','%e-%b-%y'),143.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('19-Jul-07','%e-%b-%y'),140);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('18-Jul-07','%e-%b-%y'),138.12);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('17-Jul-07','%e-%b-%y'),138.91);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('16-Jul-07','%e-%b-%y'),138.1);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('13-Jul-07','%e-%b-%y'),137.73);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('12-Jul-07','%e-%b-%y'),134.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('11-Jul-07','%e-%b-%y'),132.39);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('10-Jul-07','%e-%b-%y'),132.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('9-Jul-07','%e-%b-%y'),130.33);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('6-Jul-07','%e-%b-%y'),132.3);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('5-Jul-07','%e-%b-%y'),132.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-Jul-07','%e-%b-%y'),127.17);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-Jul-07','%e-%b-%y'),121.26);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('29-Jun-07','%e-%b-%y'),122.04);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('28-Jun-07','%e-%b-%y'),120.56);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Jun-07','%e-%b-%y'),121.89);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Jun-07','%e-%b-%y'),119.65);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('25-Jun-07','%e-%b-%y'),122.34);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-Jun-07','%e-%b-%y'),123);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('21-Jun-07','%e-%b-%y'),123.9);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('20-Jun-07','%e-%b-%y'),121.55);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('19-Jun-07','%e-%b-%y'),123.66);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-Jun-07','%e-%b-%y'),125.09);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-Jun-07','%e-%b-%y'),120.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-Jun-07','%e-%b-%y'),118.75);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('13-Jun-07','%e-%b-%y'),117.5);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('12-Jun-07','%e-%b-%y'),120.38);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-Jun-07','%e-%b-%y'),120.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-Jun-07','%e-%b-%y'),124.49);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-Jun-07','%e-%b-%y'),124.07);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('6-Jun-07','%e-%b-%y'),123.64);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('5-Jun-07','%e-%b-%y'),122.67);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-Jun-07','%e-%b-%y'),121.33);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('1-Jun-07','%e-%b-%y'),118.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('31-May-07','%e-%b-%y'),121.19);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('30-May-07','%e-%b-%y'),118.77);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('29-May-07','%e-%b-%y'),114.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('25-May-07','%e-%b-%y'),113.62);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-May-07','%e-%b-%y'),110.69);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('23-May-07','%e-%b-%y'),112.89);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('22-May-07','%e-%b-%y'),113.54);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('21-May-07','%e-%b-%y'),111.98);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('18-May-07','%e-%b-%y'),110.02);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('17-May-07','%e-%b-%y'),109.44);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('16-May-07','%e-%b-%y'),107.34);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('15-May-07','%e-%b-%y'),107.52);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('14-May-07','%e-%b-%y'),109.36);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('11-May-07','%e-%b-%y'),108.74);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('10-May-07','%e-%b-%y'),107.34);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('9-May-07','%e-%b-%y'),106.88);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('8-May-07','%e-%b-%y'),105.06);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('7-May-07','%e-%b-%y'),103.92);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('4-May-07','%e-%b-%y'),100.81);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('3-May-07','%e-%b-%y'),100.4);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('2-May-07','%e-%b-%y'),100.39);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series3',STR_TO_DATE('1-May-07','%e-%b-%y'),99.47);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('30-Apr-07','%e-%b-%y'),99.8);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('27-Apr-07','%e-%b-%y'),99.92);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('26-Apr-07','%e-%b-%y'),98.84);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series2',STR_TO_DATE('25-Apr-07','%e-%b-%y'),95.35);
+Insert into demo_line_chart (series, log_date, data_value) values ('Series1',STR_TO_DATE('24-Apr-07','%e-%b-%y'),93.24);
+
+-- DEMO_PIE_CHART
+Insert into demo_pie_chart (legend, data_value) values ('One', 5);
+Insert into demo_pie_chart (legend, data_value) values ('Two', 2);
+Insert into demo_pie_chart (legend, data_value) values ('Three', 9);
+Insert into demo_pie_chart (legend, data_value) values ('Four', 7);
+Insert into demo_pie_chart (legend, data_value) values ('Five', 4);
+Insert into demo_pie_chart (legend, data_value) values ('Six', 3);
+Insert into demo_pie_chart (legend, data_value) values ('Seven', .5);
+
+
+-- DEMO_SCATTER_CHART
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (4.1, 'Particulate', 122);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (4.3, 'Particulate', 117);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (5.7, 'Particulate', 112);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (5.4, 'Particulate', 114);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (5.9, 'Particulate', 110);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (5.0, 'Particulate', 114);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (3.6, 'Particulate', 128);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (1.9, 'Particulate', 137);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (7.3, 'Particulate', 104);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (6.9, 'Humidity', 119);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (7.9, 'Humidity', 118);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (9.8, 'Humidity', 103);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (4.9, 'Humidity', 137);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (6.8, 'Humidity', 102);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (4.7, 'Humidity', 89);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (2.7, 'Humidity', 98);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (3.7, 'Humidity', 145);
+Insert into demo_scatter_chart (rainfall, key_value, measurements) values (7.4, 'Humidity', 118);
+
+-- DEMO_SCATTER_PLOT
+
+-- SET DEFINE OFF;
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -46.5901128883449, -464.477370615131);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -85.0293361247543, -362.252178232471);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 70.9700275365898, 402.214363675566);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -50.1110580054506, -310.108907443154);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 85.043005750476, 813.481841353449);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -14.2356123424179, -134.200903707809);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -66.7014933188071, -445.754374526706);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -79.941582021797, -694.089097548454);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -64.4665101305822, -431.660620986243);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 13.718818366452, 100.010719918027);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 35.457456199233, 223.254643848734);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 55.2326402548387, 268.940835852805);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -32.9989160276248, -237.280626944034);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -0.464911506111831, -2.65656324666862);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -59.0205101710777, -498.895652307826);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 28.0939970575828, 117.200615553207);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 31.7305239061572, 186.662624012256);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 50.9035126419798, 440.937283203403);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 58.3875046571053, 547.879249694999);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 76.7846997917459, 525.020578968308);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 1.73485745801611, 7.28149474936192);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 15.304841061276, 71.2374666595537);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 75.1342455000693, 381.145932349436);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -58.2087417684623, -573.630956069476);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 76.7977837302114, 624.733726327778);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 56.3295585433654, 309.697529902676);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -9.27601440680639, -49.5126219388194);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 98.3002030040236, 765.653589829535);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -25.0987502451517, -174.651201240269);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 39.9215299020147, 337.889176256456);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 77.9225832868337, 356.183903852096);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 75.4311841137638, 14.5258766665983);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 58.9445375968278, 376.359576288564);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', 46.9521897141796, 3.5679984193934);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -49.0378307695689, -230.816092788509);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -96.2461776340861, -863.765255159092);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -96.3388912796447, -538.147283544646);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -21.4684477767032, -200.140077054848);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -30.3532837083366, -226.462637188158);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample0', -17.5055590488884, -118.709622452841);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 56.6394671790491, 385.48951169801);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 70.4622912302344, 356.986529538635);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 58.2647422222769, 489.418744916999);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -92.16093253903, -425.576081634713);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -2.64574970943097, -26.190027661226);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -16.7568654181289, -117.460886096034);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 68.215377945908, 606.917788617984);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 53.7387814434413, 367.53491797949);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -51.8861573715238, -289.998186955562);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -15.9721784074351, -75.335027134323);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 63.2540648905791, 602.546517566905);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -53.376167960458, -470.921238684285);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 40.8307443439851, 276.112653117961);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -13.0540977188468, -127.648158921993);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -43.7358336047599, -435.080470107322);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -74.5673321340732, -617.960236798371);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -6.47907144443936, -55.654651151187);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 68.1915507628225, 352.320728639801);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -23.5393521654339, -137.714557244391);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 28.3621412621467, 141.103859877604);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -99.5615230664525, -974.857161307048);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -77.7132553058204, -736.182131225006);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 95.9321864873013, 478.286112499176);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 97.7451855292708, 940.301427763062);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -10.2483179758141, -70.1145330070458);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -24.0750124187893, -113.523998470537);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -5.5721118558967, -43.8516395203455);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -55.5378338160537, -368.506951528332);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 52.6669516338013, 38.2926120131942);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -74.1981412067658, -436.990411988621);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -8.70511941690364, -71.3277811558721);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 63.2921735621378, 534.825008407329);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 97.9066635843841, 678.994971737474);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -83.1613916743288, -494.53303650568);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 23.4730547863992, 223.031148353333);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 40.6105099506845, 199.937366405274);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 35.4473225526307, 331.61786915261);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 27.2050975460142, 146.277993239147);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', -1.54684302938646, -12.6706471561247);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample1', 45.8386162291745, 401.780882699918);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 43.4241956158593, 228.71488367607);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -23.4517134254585, -165.958577325218);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -98.8954664030229, -829.964553125469);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 48.0527046113198, 451.527720751234);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -77.8912947988124, -416.867729852279);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 23.8325471824168, 206.907438743452);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 83.2787398847467, 814.01250022556);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 49.1572992549647, 451.03037365466);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -11.1351768833872, -57.3863334655361);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 71.1980242104626, 572.745863967841);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 15.0952976022392, 103.30274980367);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 75.0300005037414, 406.581640027236);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -82.0092720309019, -690.340287049552);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 40.2433497232209, 363.579616486762);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 26.8157962678174, 262.150124949525);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -83.9563210001448, -432.739081022174);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -20.6480437627346, -161.330015497217);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 37.1388896882226, 161.352404658606);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 20.2126667486174, 168.833789818416);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 58.3723632769494, 293.206814023827);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -20.2876832456236, -88.0090685884954);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 72.9768050433371, 691.684023528398);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -21.6612128833675, -130.834158714088);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 97.4870524045038, 806.47904449193);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 60.6688063197852, 255.749289305775);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -44.235772358471, -336.262226570567);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -47.39573087854, -321.133647936626);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -24.7522484346097, -204.548308435727);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -42.903238078129, -239.651563752902);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 20.4656734934697, 172.700213789797);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 56.0665747085147, 365.360390019834);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 31.9979219049038, 237.490140339893);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -29.9884426739069, -203.821484170813);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 13.5011085362703, 79.4784314297668);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 41.8402945507358, 297.04934398378);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -84.9323678979223, -345.2331996232);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', -42.2469964847455, -361.468816319656);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 98.1057699772752, 445.181262282444);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 95.5327901766563, 522.663100406047);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample2', 35.0916611161316, 246.796980313209);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 99.3987950082867, 401.97428571655);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -3.0419413965969, -14.5325761725203);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -79.388026451666, -701.817589967372);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -88.451242397524, -668.370526000304);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 34.3131838963851, 254.418322223563);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -61.518208630511, -347.521623572776);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 45.6124480237487, 356.33565541369);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -1.0716036518037, -7.80544934354423);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 31.7371714687412, 283.925868763573);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -76.771029786315, -626.268489584739);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -67.913690110843, -614.736930677921);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 34.9311671860034, 171.384205820777);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 94.3264454603021, 914.267819214392);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 76.7493996267558, 705.649611960615);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -87.795202856922, -749.505178721718);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 2.10914716736019, 15.4036733330536);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -50.456669557937, -318.410608422062);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -94.646644883092, -734.660992935541);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 34.9170862075359, 347.583881438806);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 44.3524585090071, 294.615219199443);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -67.191016143335, -609.956472872497);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -78.826443879164, -369.129912603377);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -50.427554400015, -418.144241602024);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -70.371769526721, -307.02193189609);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 16.3220947890044, 97.0997346831135);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -47.067245718878, -398.27032236792);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 5.91206661301702, 24.7239863780181);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -99.621681801868, -843.593457399484);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 87.4503492670535, 695.345037859433);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -91.176921118057, -683.305064255346);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -0.6632900001386, -5.34157539224209);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 2.98188785882178, 12.1181973600389);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 30.6008700087597, 205.922863867274);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 7.90348761612496, 65.5271597329641);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 40.3565229854156, 268.058138389501);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 37.6892733312091, 247.519083233639);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 16.4759733864001, 107.72661087278);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -53.578492311122, -369.768816039059);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', 77.1292326560541, 765.262108306778);
+Insert into demo_scatter_plot
+ (SERIES, VALUEX, VALUEY)
+ Values
+ ('Sample3', -79.566811593352, -677.545127214159);
+
+-- DEMO_UTIL_CHART
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-04-17','%Y-%m-%d'),53.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-10','%Y-%m-%d'),62.95747);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-04-21','%Y-%m-%d'),48.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-04-22','%Y-%m-%d'),51.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-11','%Y-%m-%d'),56.13373);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-04-23','%Y-%m-%d'),53.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-12','%Y-%m-%d'),57.05287);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-04-24','%Y-%m-%d'),51.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-13','%Y-%m-%d'),55.78947);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-04-25','%Y-%m-%d'),54.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-14','%Y-%m-%d'),63.34907);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-04-26','%Y-%m-%d'),50.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-15','%Y-%m-%d'),52.21327);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-04-27','%Y-%m-%d'),48.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-16','%Y-%m-%d'),51.32080);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-04-28','%Y-%m-%d'),50.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-17','%Y-%m-%d'),58.35720);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-04-29','%Y-%m-%d'),51.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-18','%Y-%m-%d'),57.62293);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-04-30','%Y-%m-%d'),67.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-19','%Y-%m-%d'),55.25000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-01','%Y-%m-%d'),59.89393);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-20','%Y-%m-%d'),58.79573);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-02','%Y-%m-%d'),61.20753);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-21','%Y-%m-%d'),54.09720);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-03','%Y-%m-%d'),58.98340);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-22','%Y-%m-%d'),59.95813);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-04','%Y-%m-%d'),59.55873);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-23','%Y-%m-%d'),62.03067);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-05','%Y-%m-%d'),58.73680);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-24','%Y-%m-%d'),61.97620);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-06','%Y-%m-%d'),59.89967);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-25','%Y-%m-%d'),58.00207);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-07','%Y-%m-%d'),60.67973);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-26','%Y-%m-%d'),59.95440);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-08','%Y-%m-%d'),60.85913);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-27','%Y-%m-%d'),55.43747);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-09','%Y-%m-%d'),60.62460);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-28','%Y-%m-%d'),52.53933);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-10','%Y-%m-%d'),59.51887);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-29','%Y-%m-%d'),57.46260);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-11','%Y-%m-%d'),61.57187);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-30','%Y-%m-%d'),60.04787);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-12','%Y-%m-%d'),60.70000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-31','%Y-%m-%d'),58.79480);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-13','%Y-%m-%d'),69.85133);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-01','%Y-%m-%d'),54.40107);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-14','%Y-%m-%d'),68.99620);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-02','%Y-%m-%d'),62.26007);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-15','%Y-%m-%d'),67.64080);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-03','%Y-%m-%d'),60.72360);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-16','%Y-%m-%d'),59.71433);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-04','%Y-%m-%d'),60.95847);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-17','%Y-%m-%d'),59.99667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-05','%Y-%m-%d'),59.45920);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-18','%Y-%m-%d'),63.27207);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-06','%Y-%m-%d'),60.58620);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-19','%Y-%m-%d'),60.32080);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-07','%Y-%m-%d'),61.94207);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-20','%Y-%m-%d'),57.32907);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-08','%Y-%m-%d'),59.03327);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-21','%Y-%m-%d'),59.76933);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-09','%Y-%m-%d'),62.83087);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-22','%Y-%m-%d'),59.12453);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-10','%Y-%m-%d'),59.36840);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-23','%Y-%m-%d'),57.10167);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-11','%Y-%m-%d'),56.11480);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-24','%Y-%m-%d'),58.45820);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-12','%Y-%m-%d'),62.23393);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-25','%Y-%m-%d'),59.45440);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-13','%Y-%m-%d'),59.72313);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-26','%Y-%m-%d'),60.12807);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-14','%Y-%m-%d'),53.37093);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-27','%Y-%m-%d'),59.11760);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-15','%Y-%m-%d'),52.99233);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-28','%Y-%m-%d'),57.32020);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-16','%Y-%m-%d'),55.99080);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-29','%Y-%m-%d'),59.80360);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-17','%Y-%m-%d'),53.93853);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-30','%Y-%m-%d'),66.73280);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-18','%Y-%m-%d'),55.99313);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-05-31','%Y-%m-%d'),58.78673);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-19','%Y-%m-%d'),68.23393);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-01','%Y-%m-%d'),58.82773);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-20','%Y-%m-%d'),61.86213);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-02','%Y-%m-%d'),63.12100);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-21','%Y-%m-%d'),61.20307);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-03','%Y-%m-%d'),59.70467);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-22','%Y-%m-%d'),61.05900);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-04','%Y-%m-%d'),58.85173);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-23','%Y-%m-%d'),58.41040);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-05','%Y-%m-%d'),61.21880);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-24','%Y-%m-%d'),59.15967);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-06','%Y-%m-%d'),58.99920);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-25','%Y-%m-%d'),56.42153);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-07','%Y-%m-%d'),59.94693);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-26','%Y-%m-%d'),60.46580);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-08','%Y-%m-%d'),66.27293);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-27','%Y-%m-%d'),57.44333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-09','%Y-%m-%d'),61.46773);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-28','%Y-%m-%d'),56.88887);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-10','%Y-%m-%d'),59.70467);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-29','%Y-%m-%d'),61.85773);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-11','%Y-%m-%d'),60.16000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-09-30','%Y-%m-%d'),61.96400);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-12','%Y-%m-%d'),61.20300);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-01','%Y-%m-%d'),65.88833);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-13','%Y-%m-%d'),60.95673);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-02','%Y-%m-%d'),62.67920);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-14','%Y-%m-%d'),60.70207);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-03','%Y-%m-%d'),63.52047);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-15','%Y-%m-%d'),61.02520);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-04','%Y-%m-%d'),58.60280);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-16','%Y-%m-%d'),60.33953);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-05','%Y-%m-%d'),63.74487);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-17','%Y-%m-%d'),61.20300);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-06','%Y-%m-%d'),59.94880);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-18','%Y-%m-%d'),63.12100);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-07','%Y-%m-%d'),59.44380);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-23','%Y-%m-%d'),61.09153);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-08','%Y-%m-%d'),59.16320);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-24','%Y-%m-%d'),61.28867);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-09','%Y-%m-%d'),60.84593);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-25','%Y-%m-%d'),60.95673);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-10','%Y-%m-%d'),58.84113);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-26','%Y-%m-%d'),60.61100);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-11','%Y-%m-%d'),62.59827);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-27','%Y-%m-%d'),61.22913);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-12','%Y-%m-%d'),60.94660);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-28','%Y-%m-%d'),58.88507);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-13','%Y-%m-%d'),59.37593);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-29','%Y-%m-%d'),59.73693);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-14','%Y-%m-%d'),67.21840);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-06-30','%Y-%m-%d'),62.45307);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-15','%Y-%m-%d'),68.56020);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-01','%Y-%m-%d'),61.30167);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-16','%Y-%m-%d'),57.56493);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-02','%Y-%m-%d'),62.92727);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-17','%Y-%m-%d'),57.02280);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-03','%Y-%m-%d'),60.05887);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-18','%Y-%m-%d'),56.20947);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-06','%Y-%m-%d'),61.20100);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-19','%Y-%m-%d'),55.69353);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-07','%Y-%m-%d'),60.66120);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-20','%Y-%m-%d'),57.17640);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-08','%Y-%m-%d'),59.78180);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-21','%Y-%m-%d'),57.50867);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-09','%Y-%m-%d'),58.74653);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-22','%Y-%m-%d'),61.67860);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-10','%Y-%m-%d'),59.77893);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-23','%Y-%m-%d'),57.34867);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-11','%Y-%m-%d'),67.34500);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-24','%Y-%m-%d'),61.68080);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-12','%Y-%m-%d'),57.07293);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-25','%Y-%m-%d'),55.55793);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-13','%Y-%m-%d'),57.37567);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-26','%Y-%m-%d'),55.81013);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-14','%Y-%m-%d'),63.97820);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-27','%Y-%m-%d'),59.85540);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-15','%Y-%m-%d'),56.06647);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-28','%Y-%m-%d'),61.05073);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-16','%Y-%m-%d'),53.66347);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-29','%Y-%m-%d'),59.81253);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-23','%Y-%m-%d'),56.50813);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-30','%Y-%m-%d'),61.02047);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-24','%Y-%m-%d'),53.19667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-10-31','%Y-%m-%d'),60.60413);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-25','%Y-%m-%d'),51.57133);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-01','%Y-%m-%d'),57.43067);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-26','%Y-%m-%d'),45.98160);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-02','%Y-%m-%d'),58.63027);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-27','%Y-%m-%d'),49.21113);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-03','%Y-%m-%d'),59.08127);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-28','%Y-%m-%d'),49.67213);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-04','%Y-%m-%d'),59.37373);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-29','%Y-%m-%d'),52.94053);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-05','%Y-%m-%d'),58.13413);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-30','%Y-%m-%d'),57.55727);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-06','%Y-%m-%d'),57.18893);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-07-31','%Y-%m-%d'),61.76900);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-07','%Y-%m-%d'),56.72853);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-01','%Y-%m-%d'),56.51953);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-08','%Y-%m-%d'),56.47340);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-02','%Y-%m-%d'),61.04853);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-09','%Y-%m-%d'),62.02333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-03','%Y-%m-%d'),70.06067);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-10','%Y-%m-%d'),61.21787);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-04','%Y-%m-%d'),60.97787);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-11','%Y-%m-%d'),62.01087);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-05','%Y-%m-%d'),59.25967);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-12','%Y-%m-%d'),62.67573);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-06','%Y-%m-%d'),56.12287);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-13','%Y-%m-%d'),59.23993);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-07','%Y-%m-%d'),63.99913);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-14','%Y-%m-%d'),67.34973);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-08','%Y-%m-%d'),58.71127);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-15','%Y-%m-%d'),60.93753);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-08-09','%Y-%m-%d'),64.01913);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-16','%Y-%m-%d'),54.52607);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-17','%Y-%m-%d'),57.81127);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-18','%Y-%m-%d'),63.53027);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-19','%Y-%m-%d'),58.13000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-20','%Y-%m-%d'),58.46827);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-21','%Y-%m-%d'),65.27807);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-22','%Y-%m-%d'),53.74513);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-23','%Y-%m-%d'),60.99107);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-24','%Y-%m-%d'),60.45427);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-25','%Y-%m-%d'),56.16847);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-26','%Y-%m-%d'),59.04040);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-27','%Y-%m-%d'),54.62040);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-28','%Y-%m-%d'),56.34687);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-29','%Y-%m-%d'),54.81560);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-11-30','%Y-%m-%d'),60.22753);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-01','%Y-%m-%d'),59.07307);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-02','%Y-%m-%d'),59.73553);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-03','%Y-%m-%d'),68.69447);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-04','%Y-%m-%d'),68.91767);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-05','%Y-%m-%d'),67.86460);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-06','%Y-%m-%d'),64.43120);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-01','%Y-%m-%d'),61.22507);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-07','%Y-%m-%d'),60.67793);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-02','%Y-%m-%d'),63.27533);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-08','%Y-%m-%d'),62.47060);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-03','%Y-%m-%d'),69.88087);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-09','%Y-%m-%d'),58.26053);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-04','%Y-%m-%d'),66.84920);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-10','%Y-%m-%d'),61.03340);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-05','%Y-%m-%d'),61.57367);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-11','%Y-%m-%d'),57.32620);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-06','%Y-%m-%d'),60.52293);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-12','%Y-%m-%d'),63.10353);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-07','%Y-%m-%d'),62.21027);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-13','%Y-%m-%d'),61.73167);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-08','%Y-%m-%d'),63.20380);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-14','%Y-%m-%d'),65.31080);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-09','%Y-%m-%d'),62.72427);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-15','%Y-%m-%d'),64.67620);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-10','%Y-%m-%d'),61.59373);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-16','%Y-%m-%d'),62.87287);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-11','%Y-%m-%d'),61.21280);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-17','%Y-%m-%d'),60.14680);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-12','%Y-%m-%d'),60.79787);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-18','%Y-%m-%d'),63.01007);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-13','%Y-%m-%d'),60.00080);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-19','%Y-%m-%d'),57.82680);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-14','%Y-%m-%d'),60.82333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-20','%Y-%m-%d'),62.59173);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-15','%Y-%m-%d'),59.62020);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-21','%Y-%m-%d'),61.65607);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-16','%Y-%m-%d'),60.27420);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-23','%Y-%m-%d'),61.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-17','%Y-%m-%d'),60.06200);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-24','%Y-%m-%d'),59.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-18','%Y-%m-%d'),60.88900);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-25','%Y-%m-%d'),50.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-19','%Y-%m-%d'),59.92547);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-26','%Y-%m-%d'),60.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-20','%Y-%m-%d'),59.99853);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-27','%Y-%m-%d'),62.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-21','%Y-%m-%d'),58.65873);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-28','%Y-%m-%d'),61.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-22','%Y-%m-%d'),60.61000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-29','%Y-%m-%d'),61.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-23','%Y-%m-%d'),59.92280);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-30','%Y-%m-%d'),61.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-24','%Y-%m-%d'),59.52427);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2014-12-31','%Y-%m-%d'),62.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-25','%Y-%m-%d'),59.44887);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-01','%Y-%m-%d'),60.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-26','%Y-%m-%d'),60.23540);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-02','%Y-%m-%d'),62.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-27','%Y-%m-%d'),61.18333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-03','%Y-%m-%d'),62.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-28','%Y-%m-%d'),60.88133);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-04','%Y-%m-%d'),60.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-29','%Y-%m-%d'),61.74160);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-06','%Y-%m-%d'),62.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-30','%Y-%m-%d'),60.25647);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-08','%Y-%m-%d'),61.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-03-31','%Y-%m-%d'),60.41220);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-09','%Y-%m-%d'),63.20000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-01','%Y-%m-%d'),59.21053);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-10','%Y-%m-%d'),61.82227);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-02','%Y-%m-%d'),55.04713);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-11','%Y-%m-%d'),61.89553);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-03','%Y-%m-%d'),56.08473);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-12','%Y-%m-%d'),60.90127);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-04','%Y-%m-%d'),64.51107);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-13','%Y-%m-%d'),62.23660);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-05','%Y-%m-%d'),56.75193);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-14','%Y-%m-%d'),61.76947);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-06','%Y-%m-%d'),61.64240);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-15','%Y-%m-%d'),63.08853);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-07','%Y-%m-%d'),61.33653);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-16','%Y-%m-%d'),60.12627);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-08','%Y-%m-%d'),69.28867);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-17','%Y-%m-%d'),60.60020);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-09','%Y-%m-%d'),60.87507);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-18','%Y-%m-%d'),60.43440);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-10','%Y-%m-%d'),68.08707);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-19','%Y-%m-%d'),65.02820);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-11','%Y-%m-%d'),60.57680);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-20','%Y-%m-%d'),62.95593);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-12','%Y-%m-%d'),61.52467);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-21','%Y-%m-%d'),61.23967);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-13','%Y-%m-%d'),58.06567);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-22','%Y-%m-%d'),62.61853);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-14','%Y-%m-%d'),59.80807);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-23','%Y-%m-%d'),63.64227);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-15','%Y-%m-%d'),79.90007);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-24','%Y-%m-%d'),63.42147);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-16','%Y-%m-%d'),54.75020);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-25','%Y-%m-%d'),60.82687);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-17','%Y-%m-%d'),65.69500);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-26','%Y-%m-%d'),60.66260);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-18','%Y-%m-%d'),68.56247);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-27','%Y-%m-%d'),60.12767);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-19','%Y-%m-%d'),72.67153);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-28','%Y-%m-%d'),60.51513);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-20','%Y-%m-%d'),71.30720);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-29','%Y-%m-%d'),61.71520);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-21','%Y-%m-%d'),57.75233);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-30','%Y-%m-%d'),60.89553);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-22','%Y-%m-%d'),59.04200);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-01-31','%Y-%m-%d'),63.50540);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-23','%Y-%m-%d'),62.30153);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-01','%Y-%m-%d'),62.37533);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-24','%Y-%m-%d'),67.68287);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-02','%Y-%m-%d'),60.31400);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-25','%Y-%m-%d'),69.21800);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-03','%Y-%m-%d'),63.43920);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-26','%Y-%m-%d'),69.75993);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-04','%Y-%m-%d'),61.20487);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-27','%Y-%m-%d'),64.64113);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-05','%Y-%m-%d'),62.11167);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-28','%Y-%m-%d'),60.10053);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-06','%Y-%m-%d'),59.96140);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-29','%Y-%m-%d'),58.67653);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-07','%Y-%m-%d'),62.60727);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-04-30','%Y-%m-%d'),58.29180);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-08','%Y-%m-%d'),61.95493);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-01','%Y-%m-%d'),60.56173);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-09','%Y-%m-%d'),58.89653);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-02','%Y-%m-%d'),57.15840);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-10','%Y-%m-%d'),66.20167);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-03','%Y-%m-%d'),54.49167);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-11','%Y-%m-%d'),64.76873);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-04','%Y-%m-%d'),61.54087);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-12','%Y-%m-%d'),69.90680);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-05','%Y-%m-%d'),63.86073);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-13','%Y-%m-%d'),68.49253);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-06','%Y-%m-%d'),64.13460);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-14','%Y-%m-%d'),63.19360);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-07','%Y-%m-%d'),65.30087);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-15','%Y-%m-%d'),63.35453);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-08','%Y-%m-%d'),64.46353);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-16','%Y-%m-%d'),59.78020);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-09','%Y-%m-%d'),62.81193);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-17','%Y-%m-%d'),60.70760);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-10','%Y-%m-%d'),56.14480);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-18','%Y-%m-%d'),58.05167);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-11','%Y-%m-%d'),61.47853);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-19','%Y-%m-%d'),57.12700);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-12','%Y-%m-%d'),63.39287);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-20','%Y-%m-%d'),59.49013);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-13','%Y-%m-%d'),64.30640);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-21','%Y-%m-%d'),59.18607);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-14','%Y-%m-%d'),64.29447);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-22','%Y-%m-%d'),60.94680);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-15','%Y-%m-%d'),65.63307);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-23','%Y-%m-%d'),59.85807);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-16','%Y-%m-%d'),62.32887);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-24','%Y-%m-%d'),60.06767);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-17','%Y-%m-%d'),56.52853);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-25','%Y-%m-%d'),61.60267);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-18','%Y-%m-%d'),70.26520);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-26','%Y-%m-%d'),60.94220);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-19','%Y-%m-%d'),64.38267);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-27','%Y-%m-%d'),59.99040);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-20','%Y-%m-%d'),63.01447);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-02-28','%Y-%m-%d'),63.05567);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-21','%Y-%m-%d'),61.89200);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-22','%Y-%m-%d'),62.06920);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-23','%Y-%m-%d'),68.49253);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-24','%Y-%m-%d'),69.98867);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-25','%Y-%m-%d'),60.26940);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-26','%Y-%m-%d'),62.91493);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-09','%Y-%m-%d'),62.28433);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-27','%Y-%m-%d'),62.36827);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-10','%Y-%m-%d'),64.38787);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-11','%Y-%m-%d'),61.17093);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-28','%Y-%m-%d'),60.33887);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-12','%Y-%m-%d'),57.17713);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-29','%Y-%m-%d'),83.89220);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-13','%Y-%m-%d'),57.69653);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-30','%Y-%m-%d'),60.96747);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-14','%Y-%m-%d'),55.97980);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-05-31','%Y-%m-%d'),57.80627);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-15','%Y-%m-%d'),62.08940);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-01','%Y-%m-%d'),61.60173);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-16','%Y-%m-%d'),83.81047);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-02','%Y-%m-%d'),63.23627);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-17','%Y-%m-%d'),61.32540);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-03','%Y-%m-%d'),58.39987);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-18','%Y-%m-%d'),61.08900);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-04','%Y-%m-%d'),69.51947);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-19','%Y-%m-%d'),67.26267);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-05','%Y-%m-%d'),69.67787);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-20','%Y-%m-%d'),58.71120);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-06','%Y-%m-%d'),62.40513);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-21','%Y-%m-%d'),55.77320);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-07','%Y-%m-%d'),61.01893);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-22','%Y-%m-%d'),59.99420);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-08','%Y-%m-%d'),61.34813);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-23','%Y-%m-%d'),60.83867);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-24','%Y-%m-%d'),59.57020);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-25','%Y-%m-%d'),63.20393);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-17','%Y-%m-%d'),67.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-26','%Y-%m-%d'),58.30480);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-18','%Y-%m-%d'),64.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-27','%Y-%m-%d'),58.79667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-19','%Y-%m-%d'),60.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-28','%Y-%m-%d'),54.04967);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-20','%Y-%m-%d'),57.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-29','%Y-%m-%d'),57.88313);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-21','%Y-%m-%d'),58.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-06-30','%Y-%m-%d'),56.94940);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-22','%Y-%m-%d'),59.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-01','%Y-%m-%d'),65.01080);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-23','%Y-%m-%d'),59.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-02','%Y-%m-%d'),64.97013);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-24','%Y-%m-%d'),59.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-03','%Y-%m-%d'),65.06647);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-25','%Y-%m-%d'),59.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-04','%Y-%m-%d'),64.08287);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-26','%Y-%m-%d'),76.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-05','%Y-%m-%d'),65.40367);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-27','%Y-%m-%d'),59.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-06','%Y-%m-%d'),72.61373);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-28','%Y-%m-%d'),59.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-07','%Y-%m-%d'),72.53120);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-29','%Y-%m-%d'),58.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-08','%Y-%m-%d'),72.54133);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-26','%Y-%m-%d'),58.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-30','%Y-%m-%d'),54.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-01','%Y-%m-%d'),58.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-02','%Y-%m-%d'),59.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-03','%Y-%m-%d'),58.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-04','%Y-%m-%d'),60.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-05','%Y-%m-%d'),101.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-06','%Y-%m-%d'),58.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-07','%Y-%m-%d'),59.53333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-08','%Y-%m-%d'),56.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-09','%Y-%m-%d'),57.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-10','%Y-%m-%d'),65.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-11','%Y-%m-%d'),56.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-12','%Y-%m-%d'),54.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-13','%Y-%m-%d'),68.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-14','%Y-%m-%d'),69.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-15','%Y-%m-%d'),66.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-16','%Y-%m-%d'),58.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-17','%Y-%m-%d'),60.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-18','%Y-%m-%d'),58.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-19','%Y-%m-%d'),55.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-20','%Y-%m-%d'),55.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-21','%Y-%m-%d'),57.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-22','%Y-%m-%d'),57.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-23','%Y-%m-%d'),58.20000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-24','%Y-%m-%d'),57.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-25','%Y-%m-%d'),58.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-26','%Y-%m-%d'),61.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-27','%Y-%m-%d'),57.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-28','%Y-%m-%d'),58.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-29','%Y-%m-%d'),59.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-30','%Y-%m-%d'),55.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-10-31','%Y-%m-%d'),53.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-01','%Y-%m-%d'),56.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-02','%Y-%m-%d'),57.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-03','%Y-%m-%d'),55.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-04','%Y-%m-%d'),57.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-05','%Y-%m-%d'),65.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-06','%Y-%m-%d'),55.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-07','%Y-%m-%d'),57.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-08','%Y-%m-%d'),59.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-09','%Y-%m-%d'),60.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-10','%Y-%m-%d'),58.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-11','%Y-%m-%d'),58.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-12','%Y-%m-%d'),57.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-13','%Y-%m-%d'),57.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-14','%Y-%m-%d'),55.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-15','%Y-%m-%d'),55.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-16','%Y-%m-%d'),58.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-17','%Y-%m-%d'),58.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-18','%Y-%m-%d'),64.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-19','%Y-%m-%d'),59.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-20','%Y-%m-%d'),57.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-21','%Y-%m-%d'),57.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-22','%Y-%m-%d'),59.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-23','%Y-%m-%d'),56.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-24','%Y-%m-%d'),58.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-25','%Y-%m-%d'),57.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-26','%Y-%m-%d'),57.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-27','%Y-%m-%d'),53.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-28','%Y-%m-%d'),58.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-29','%Y-%m-%d'),56.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-11-30','%Y-%m-%d'),58.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-01','%Y-%m-%d'),60.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-02','%Y-%m-%d'),59.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-03','%Y-%m-%d'),58.53333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-04','%Y-%m-%d'),77.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-05','%Y-%m-%d'),56.53333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-06','%Y-%m-%d'),55.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-07','%Y-%m-%d'),57.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-08','%Y-%m-%d'),57.20000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-09','%Y-%m-%d'),71.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-10','%Y-%m-%d'),62.53333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-11','%Y-%m-%d'),59.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-12','%Y-%m-%d'),59.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-13','%Y-%m-%d'),62.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-14','%Y-%m-%d'),59.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-15','%Y-%m-%d'),59.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-16','%Y-%m-%d'),62.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-17','%Y-%m-%d'),66.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-18','%Y-%m-%d'),59.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-19','%Y-%m-%d'),60.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-20','%Y-%m-%d'),57.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-21','%Y-%m-%d'),60.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-22','%Y-%m-%d'),59.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-23','%Y-%m-%d'),61.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-24','%Y-%m-%d'),57.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-25','%Y-%m-%d'),52.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-09','%Y-%m-%d'),70.77980);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-10','%Y-%m-%d'),70.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-11','%Y-%m-%d'),60.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-12','%Y-%m-%d'),58.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-13','%Y-%m-%d'),58.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-14','%Y-%m-%d'),58.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-15','%Y-%m-%d'),68.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-16','%Y-%m-%d'),84.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-17','%Y-%m-%d'),61.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-18','%Y-%m-%d'),64.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-19','%Y-%m-%d'),59.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-20','%Y-%m-%d'),77.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-21','%Y-%m-%d'),60.53333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-22','%Y-%m-%d'),65.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-23','%Y-%m-%d'),68.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-24','%Y-%m-%d'),58.53333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-25','%Y-%m-%d'),56.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-26','%Y-%m-%d'),58.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-27','%Y-%m-%d'),59.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-28','%Y-%m-%d'),59.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-29','%Y-%m-%d'),58.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-30','%Y-%m-%d'),59.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-27','%Y-%m-%d'),59.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-07-31','%Y-%m-%d'),57.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-28','%Y-%m-%d'),305.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-01','%Y-%m-%d'),59.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-29','%Y-%m-%d'),62.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-02','%Y-%m-%d'),61.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-30','%Y-%m-%d'),60.53333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-03','%Y-%m-%d'),59.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-12-31','%Y-%m-%d'),60.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-04','%Y-%m-%d'),83.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-01','%Y-%m-%d'),55.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-05','%Y-%m-%d'),59.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-02','%Y-%m-%d'),61.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-06','%Y-%m-%d'),58.53333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-03','%Y-%m-%d'),61.20000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-07','%Y-%m-%d'),59.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-04','%Y-%m-%d'),62.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-08','%Y-%m-%d'),57.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-05','%Y-%m-%d'),61.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-09','%Y-%m-%d'),58.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-06','%Y-%m-%d'),61.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-10','%Y-%m-%d'),59.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-07','%Y-%m-%d'),62.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-11','%Y-%m-%d'),58.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-08','%Y-%m-%d'),100.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-12','%Y-%m-%d'),57.20000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-09','%Y-%m-%d'),62.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-13','%Y-%m-%d'),61.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-10','%Y-%m-%d'),66.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-14','%Y-%m-%d'),58.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-11','%Y-%m-%d'),61.20000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-15','%Y-%m-%d'),59.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-12','%Y-%m-%d'),60.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-16','%Y-%m-%d'),61.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-13','%Y-%m-%d'),61.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-17','%Y-%m-%d'),59.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-14','%Y-%m-%d'),60.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-18','%Y-%m-%d'),59.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-15','%Y-%m-%d'),61.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-19','%Y-%m-%d'),59.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-16','%Y-%m-%d'),61.53333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-20','%Y-%m-%d'),60.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-17','%Y-%m-%d'),70.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-21','%Y-%m-%d'),63.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-18','%Y-%m-%d'),61.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-22','%Y-%m-%d'),58.53333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-19','%Y-%m-%d'),61.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-23','%Y-%m-%d'),59.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-20','%Y-%m-%d'),61.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-24','%Y-%m-%d'),59.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-21','%Y-%m-%d'),61.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-25','%Y-%m-%d'),63.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-22','%Y-%m-%d'),60.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-26','%Y-%m-%d'),61.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-23','%Y-%m-%d'),61.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-27','%Y-%m-%d'),60.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-24','%Y-%m-%d'),60.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-28','%Y-%m-%d'),57.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-25','%Y-%m-%d'),61.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-29','%Y-%m-%d'),59.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-26','%Y-%m-%d'),61.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-30','%Y-%m-%d'),57.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-27','%Y-%m-%d'),61.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-08-31','%Y-%m-%d'),59.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-28','%Y-%m-%d'),61.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-01','%Y-%m-%d'),58.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-29','%Y-%m-%d'),61.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-02','%Y-%m-%d'),61.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-30','%Y-%m-%d'),61.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-03','%Y-%m-%d'),59.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-01-31','%Y-%m-%d'),59.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-04','%Y-%m-%d'),59.53333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-01','%Y-%m-%d'),60.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-05','%Y-%m-%d'),59.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-02','%Y-%m-%d'),60.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-06','%Y-%m-%d'),61.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-03','%Y-%m-%d'),60.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-07','%Y-%m-%d'),59.20000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-04','%Y-%m-%d'),61.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-08','%Y-%m-%d'),61.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-05','%Y-%m-%d'),60.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-09','%Y-%m-%d'),61.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-06','%Y-%m-%d'),60.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-10','%Y-%m-%d'),60.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-07','%Y-%m-%d'),60.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-11','%Y-%m-%d'),58.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-08','%Y-%m-%d'),61.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-12','%Y-%m-%d'),58.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-09','%Y-%m-%d'),61.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-13','%Y-%m-%d'),58.53333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-10','%Y-%m-%d'),60.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-14','%Y-%m-%d'),60.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-11','%Y-%m-%d'),60.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-15','%Y-%m-%d'),62.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-12','%Y-%m-%d'),59.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2015-09-16','%Y-%m-%d'),65.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-13','%Y-%m-%d'),61.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-14','%Y-%m-%d'),69.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-15','%Y-%m-%d'),59.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-16','%Y-%m-%d'),59.80000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-17','%Y-%m-%d'),60.46667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-18','%Y-%m-%d'),61.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-19','%Y-%m-%d'),62.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-20','%Y-%m-%d'),60.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-21','%Y-%m-%d'),59.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-22','%Y-%m-%d'),61.40000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-23','%Y-%m-%d'),60.93333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-24','%Y-%m-%d'),64.13333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-25','%Y-%m-%d'),61.53333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-26','%Y-%m-%d'),59.06667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-27','%Y-%m-%d'),61.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-28','%Y-%m-%d'),60.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-02-29','%Y-%m-%d'),61.00000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-03-01','%Y-%m-%d'),61.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-03-02','%Y-%m-%d'),61.66667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-03-03','%Y-%m-%d'),60.73333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-03-04','%Y-%m-%d'),61.26667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-03-05','%Y-%m-%d'),61.60000);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-03-06','%Y-%m-%d'),61.33333);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-03-07','%Y-%m-%d'),61.86667);
+INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-03-08','%Y-%m-%d'),62.00000);
+
+commit; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/distribution.xml b/ecomp-sdk/sdk-app/distribution.xml
new file mode 100644
index 00000000..d5c20cd7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/distribution.xml
@@ -0,0 +1,21 @@
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>os-distribution</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>${basedir}</directory>
+ <outputDirectory />
+ <excludes>
+ <exclude>target/</exclude>
+ <exclude>.settings/</exclude>
+ <exclude>distribution.xml</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+</assembly> \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/pom.xml b/ecomp-sdk/sdk-app/pom.xml
new file mode 100644
index 00000000..518c208f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/pom.xml
@@ -0,0 +1,351 @@
+<?xml version="1.0"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- This is the Maven project object model (POM) file for a web application
+ based on the ECOMP SDK distribution. This file stands alone; it does not
+ inherit from a parent maven module. -->
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>ep-sdk-app</artifactId>
+ <!-- This version number is appended to the distribution (war and zip).
+ There is an implicit mapping between this string and the epsdk.version. -->
+ <version>1.0.0</version>
+ <packaging>war</packaging>
+ <name>Ecomp SDK Webapp</name>
+ <description>Ecomp SDK Webapp based on the Ecomp SDK</description>
+ <scm>
+ <connection>scm:git:https://todourl/</connection>
+ </scm>
+
+ <properties>
+ <encoding>UTF-8</encoding>
+ <epsdk.version>1.0.0</epsdk.version>
+ <springframework.version>4.2.0.RELEASE</springframework.version>
+ <hibernate.version>4.3.11.Final</hibernate.version>
+ <!-- Skip assembling the zip by default; turn on like this: mvn -Dskipassembly=false
+ package -->
+ <skipassembly>true</skipassembly>
+ <!-- Tests usually require some setup that maven cannot do, so skip. -->
+ <skiptests>true</skiptests>
+ <sonar.exclusions>**.js</sonar.exclusions>
+ </properties>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.10.4</version>
+ <configuration>
+ <failOnError>false</failOnError>
+ <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
+ <docletArtifact>
+ <groupId>org.umlgraph</groupId>
+ <artifactId>umlgraph</artifactId>
+ <version>5.6</version>
+ </docletArtifact>
+ <additionalparam>-views</additionalparam>
+ <useStandardDocletOptions>true</useStandardDocletOptions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ <distributionManagement>
+ <site>
+ <id>nexus</id>
+ <url>dav:https://ecomp-nexus:8443/repository/portalsdkapp-javadoc/${epsdk.version}</url>
+ </site>
+ </distributionManagement>
+ <repositories>
+ <repository>
+ <!-- Snapshots repository has ECOMP snapshot artifacts -->
+ <id>nexus-snapshots</id>
+ <name>Nexus Maven Central - Snapshots</name>
+ <url>https://ecomp-nexus:8443/repository/maven-snapshots/</url>
+ </repository>
+ <repository>
+ <!-- Releases repository has ECOMP release artifacts -->
+ <id>nexus</id>
+ <name>Nexus Maven Central - Releases</name>
+ <url>https://ecomp-nexus:8443/repository/maven-releases/</url>
+ </repository>
+ <repository>
+ <!-- Snapshots repository has ECOMP snapshot artifacts -->
+ <id>oss-snapshots</id>
+ <name>oss Central - Snapshots</name>
+ <url>https://oss.sonatype.org/service/local/repositories/releases/content/</url>
+ </repository>
+
+ </repositories>
+
+ <profiles>
+ <!-- disable doclint, a new feature in Java 8, when generating javadoc -->
+ <profile>
+ <id>doclint-java8-disable</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.10.4</version>
+ <configuration>
+ <additionalparam>-Xdoclint:none</additionalparam>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.6</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav-jackrabbit</artifactId>
+ <version>2.10</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>sonar-maven-plugin</artifactId>
+ <version>3.2</version>
+ </plugin>
+ <!-- Compile to Java 1.8 class output format -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.19.1</version>
+ <configuration>
+ <skipTests>${skiptests}</skipTests>
+ <includes>
+ <include>**/Test*.java</include>
+ <include>**/*Test.java</include>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <additionalClasspathElements>
+ <additionalClasspathElement>${basedir}/war</additionalClasspathElement>
+ </additionalClasspathElements>
+ <systemPropertyVariables>
+ <container.classpath>classpath:</container.classpath>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+
+ <!-- Fetch SCM info as variable buildNumber -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <version>1.4</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <!-- don't complain about modified files -->
+ <doCheck>false</doCheck>
+ <!-- don't push anything to git -->
+ <doUpdate>false</doUpdate>
+ </configuration>
+ </plugin>
+
+ <!-- Add build and SCM info to manifest -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ <manifestEntries>
+ <Build-Time>${maven.build.timestamp}</Build-Time>
+ <SCM-Branch>${scmBranch}</SCM-Branch>
+ <SCM-Commit>${buildNumber}</SCM-Commit>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <skipAssembly>${skipassembly}</skipAssembly>
+ <descriptors>
+ <descriptor>${basedir}/distribution.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <!-- SDK components -->
+
+ <dependency>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>ecompSDK-core</artifactId>
+ <version>${epsdk.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>ecompSDK-analytics</artifactId>
+ <version>${epsdk.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.oracle</groupId>
+ <artifactId>ojdbc6</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>ecompSDK-workflow</artifactId>
+ <version>${epsdk.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ <version>0.0.1</version>
+ </dependency>
+ <!-- Mapper -->
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.mchange</groupId>
+ <artifactId>c3p0</artifactId>
+ <version>0.9.5.2</version>
+ </dependency>
+ <dependency>
+ <groupId>io.searchbox</groupId>
+ <artifactId>jest</artifactId>
+ <version>2.0.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ </dependency>
+ <!-- Elastic Search -->
+ <dependency>
+ <groupId>org.elasticsearch</groupId>
+ <artifactId>elasticsearch</artifactId>
+ <version>2.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>20160212</version>
+ </dependency>
+ <dependency>
+ <groupId>org.quartz-scheduler</groupId>
+ <artifactId>quartz</artifactId>
+ <version>2.2.1</version>
+ <exclusions>
+ <!-- exclude 0.9.1.1 to avoid dupe of com.mchange:c3p0:0.9.2.1 -->
+ <exclusion>
+ <groupId>c3p0</groupId>
+ <artifactId>c3p0</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- bridge to implement commons-logging using slf4j -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>1.7.12</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${springframework.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java
new file mode 100644
index 00000000..ff9f0f1a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java
@@ -0,0 +1,188 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.conf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.portalapp.scheduler.RegistryAdapter;
+import org.openecomp.portalapp.uebhandler.InitUebHandler;
+import org.openecomp.portalapp.uebhandler.MainUebHandler;
+import org.openecomp.portalapp.uebhandler.WidgetNotificationHandler;
+import org.openecomp.portalsdk.core.conf.AppConfig;
+import org.openecomp.portalsdk.core.conf.Configurable;
+import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.util.CacheManager;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+import org.springframework.context.annotation.Profile;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+import org.springframework.web.servlet.ViewResolver;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+
+/**
+ * Configures Spring features in the ECOMP Portal SDK sample application.
+ * Subclasses the ECOMP Portal SDK core AppConfig class to reuse interceptors,
+ * view resolvers and other features defined there.
+ */
+@Configuration
+@EnableWebMvc
+@ComponentScan(basePackages = "org.openecomp")
+@PropertySource(value = { "${container.classpath:}/WEB-INF/conf/app/test.properties" }, ignoreResourceNotFound = true)
+@Profile("src")
+@EnableAsync
+@EnableScheduling
+public class ExternalAppConfig extends AppConfig implements Configurable {
+
+ private RegistryAdapter schedulerRegistryAdapter;
+
+ @Configuration
+ @Import(SystemProperties.class)
+ static class InnerConfiguration {
+ }
+
+ /**
+ * @see org.openecomp.portalsdk.core.conf.AppConfig#viewResolver()
+ */
+ public ViewResolver viewResolver() {
+ return super.viewResolver();
+ }
+
+ /**
+ * @see org.openecomp.portalsdk.core.conf.AppConfig#addResourceHandlers(ResourceHandlerRegistry)
+ *
+ * @param registry
+ */
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ super.addResourceHandlers(registry);
+ }
+
+ /**
+ * @see org.openecomp.portalsdk.core.conf.AppConfig#dataAccessService()
+ */
+ public DataAccessService dataAccessService() {
+ return super.dataAccessService();
+ }
+
+ /**
+ * Creates a new list with a single entry that is the external app
+ * definitions.xml path.
+ *
+ * @return List of String, size 1
+ */
+ public List<String> addTileDefinitions() {
+ List<String> definitions = new ArrayList<String>();
+ definitions.add("/WEB-INF/defs/definitions.xml");
+ return definitions;
+ }
+
+ /**
+ * Adds request interceptors to the specified registry by calling
+ * {@link AppConfig#addInterceptors(InterceptorRegistry)}, but excludes
+ * certain paths from the session timeout interceptor.
+ */
+ @Override
+ public void addInterceptors(InterceptorRegistry registry) {
+ super.setExcludeUrlPathsForSessionTimeout("/login_external", "*/login_external.htm", "login", "/login.htm",
+ "/api*","/single_signon.htm","/single_signon");
+ super.addInterceptors(registry);
+ }
+
+ /**
+ * Creates and returns a new instance of a {@link CacheManager} class.
+ *
+ * @return New instance of {@link CacheManager}
+ */
+ @Bean
+ public AbstractCacheManager cacheManager() {
+ return new CacheManager();
+ }
+
+ /**
+ * Creates and returns a new instance of a {@link MainUebHandler}.
+ *
+ * @return New instance of {@link MainUebHandler}.
+ */
+ @Bean
+ public MainUebHandler mainUebHandler() {
+
+ return new MainUebHandler();
+ }
+
+ /**
+ * Creates and returns a new instance of a {@link InitUebHandler}.
+ *
+ * @return New instance of {@link InitUebHandler}.
+ */
+ @Bean
+ public InitUebHandler initUebHandler() {
+
+ return new InitUebHandler();
+ }
+
+ /**
+ * Creates and returns a new instance of a {@link WidgetNotificationHandler}
+ * .
+ *
+ * @return New instance of {@link WidgetNotificationHandler}.
+ */
+ @Bean
+ public WidgetNotificationHandler widgetNotificationHandler() {
+ return new WidgetNotificationHandler();
+ }
+
+ /**
+ * Creates and returns a new instance of a {@link SchedulerFactoryBean} and
+ * populates it with triggers.
+ *
+ * @return New instance of {@link SchedulerFactoryBean}
+ * @throws Exception
+ */
+ // @Bean // ANNOTATION COMMENTED OUT
+ // APPLICATIONS REQUIRING QUARTZ SHOULD RESTORE ANNOTATION
+ public SchedulerFactoryBean schedulerFactoryBean() throws Exception {
+ SchedulerFactoryBean scheduler = new SchedulerFactoryBean();
+ scheduler.setTriggers(schedulerRegistryAdapter.getTriggers());
+ scheduler.setConfigLocation(appApplicationContext.getResource("WEB-INF/conf/quartz.properties"));
+ scheduler.setDataSource(dataSource());
+ return scheduler;
+ }
+
+
+ /**
+ * Sets the scheduler registry adapter.
+ *
+ * @param schedulerRegistryAdapter
+ */
+ @Autowired
+ public void setSchedulerRegistryAdapter(final RegistryAdapter schedulerRegistryAdapter) {
+ this.schedulerRegistryAdapter = schedulerRegistryAdapter;
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java
new file mode 100644
index 00000000..dfdfcade
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java
@@ -0,0 +1,60 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.conf;
+
+import java.util.Arrays;
+
+import org.openecomp.portalsdk.core.conf.AppInitializer;
+
+public class ExternalAppInitializer extends AppInitializer{
+
+
+ @Override
+ protected Class<?>[] getRootConfigClasses() {
+ return super.getRootConfigClasses();
+ }
+
+ @Override
+ protected Class<?>[] getServletConfigClasses() {
+// Class<?>[] configClasses = super.getServletConfigClasses();
+// Class<?>[] additionalConfigClasses = Arrays.copyOf(configClasses, configClasses.length);
+// addConfigClass(additionalConfigClasses, ExternalAppConfig.class);
+// return additionalConfigClasses;
+//
+ return new Class[] {ExternalAppConfig.class};
+ }
+
+ static Class<?>[] addConfigClass(Class<?>[] a, Class<?> e) {
+ a = Arrays.copyOf(a, a.length + 1);
+ a[a.length - 1] = e;
+ return a;
+ }
+
+ /*
+ * URL request will direct to the Spring dispatcher for processing
+ */
+ @Override
+ protected String[] getServletMappings() {
+ return super.getServletMappings();
+ }
+
+}
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java
new file mode 100644
index 00000000..3e1d89d2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java
@@ -0,0 +1,37 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.conf;
+
+import org.openecomp.portalsdk.core.conf.HibernateMappingLocatable;
+import org.springframework.context.annotation.Profile;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+import org.springframework.stereotype.Component;
+
+@Component
+@Profile("src")
+public class HibernateMappingLocations implements HibernateMappingLocatable {
+
+ public Resource[] getMappingLocations() {
+ return new Resource[]{new ClassPathResource("../fusion/orm/Fusion.hbm.xml"), new ClassPathResource("../fusion/orm/Workflow.hbm.xml"), new ClassPathResource("../fusion/orm/RNoteBookIntegration.hbm.xml")};
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/AngularSinglePageController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/AngularSinglePageController.java
new file mode 100644
index 00000000..e654a51c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/AngularSinglePageController.java
@@ -0,0 +1,48 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.controller;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+/**
+ * Controller for a single-page application sample. The view is restricted to
+ * authenticated users. The named view resolves to page singlePageSample.html,
+ * which uses Angular.
+ */
+@Controller
+@RequestMapping("/")
+public class AngularSinglePageController extends RestrictedBaseController {
+
+ @RequestMapping(value = { "/singlePageSample" }, method = RequestMethod.GET)
+ public ModelAndView view(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ return new ModelAndView("single_page_sample", "model", model);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/CallflowController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/CallflowController.java
new file mode 100644
index 00000000..a3d1be5f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/CallflowController.java
@@ -0,0 +1,44 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.controller;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+/**
+ * Controller for a message sequence chart view. The view is restricted to
+ * authenticated users. The view name defaults to the request name with no
+ * suffix, "callflow", which resolves to page details.jsp. That page is an
+ * iframe around page details.html.
+ */
+@Controller
+@RequestMapping("/")
+public class CallflowController extends RestrictedBaseController {
+
+ @RequestMapping(value = { "/callflow" }, method = RequestMethod.GET)
+ public ModelAndView plot() {
+ final String defaultViewName = null;
+ return new ModelAndView(defaultViewName);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/ElasticSearchController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/ElasticSearchController.java
new file mode 100644
index 00000000..69ff63db
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/ElasticSearchController.java
@@ -0,0 +1,128 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.controller;
+
+import java.io.IOException;
+
+import org.json.JSONObject;
+import org.openecomp.portalapp.model.Result;
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import io.searchbox.client.JestClient;
+import io.searchbox.client.JestClientFactory;
+import io.searchbox.client.config.HttpClientConfig;
+import io.searchbox.core.Search;
+import io.searchbox.core.SearchResult;
+import io.searchbox.core.Suggest;
+import io.searchbox.core.SuggestResult;
+import io.searchbox.params.Parameters;
+
+/**
+ * Controller for views that demonstrate Elastic Search features.
+ */
+@RestController
+public class ElasticSearchController extends RestrictedBaseController{
+
+ @RequestMapping(value = {"/es_search_demo" }, method = RequestMethod.GET)
+ public ModelAndView search() {
+ return new ModelAndView("es_search_demo");
+ }
+
+ @RequestMapping(value = {"/es_suggest_demo" }, method = RequestMethod.GET)
+ public ModelAndView suggest() {
+ return new ModelAndView("es_suggest_demo");
+ }
+
+ @RequestMapping(value="/es_suggest/{task}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Result> doSuggest(@PathVariable("task") String task) throws IOException {
+ JSONObject obj = new JSONObject(task);
+ String searchTerm = obj.getString("data");
+ String searchSize = obj.getString("size");
+ String searchFuzzy = obj.getString("fuzzy");
+ String resultName = obj.getString("resultname");
+
+ JestClientFactory factory = new JestClientFactory();
+ factory.setHttpClientConfig(new HttpClientConfig
+ .Builder("http://todo_elastic_search_server")
+ .multiThreaded(true)
+ .build());
+ JestClient client = factory.getObject();
+
+
+ Suggest suggest = new Suggest.Builder("{\n"
+ +"\"" + resultName +"\" : {\n"
+ +"\"text\" : \""+ searchTerm +"\",\n"
+ +"\"completion\" : {\n"
+ +"\"field\" : \"suggest\",\n"
+ +"\"size\" : " + searchSize + ",\n"
+ +"\"fuzzy\" : \"" + searchFuzzy + "\"\n"
+ +"}\n"
+ +"}\n"
+ +"}").addIndex("customer").build();
+
+ SuggestResult result = client.execute(suggest);
+ System.err.println(result.getJsonObject().toString());
+ return new ResponseEntity<Result>(new Result(result.getJsonObject().toString()),HttpStatus.OK);
+ }
+
+ @RequestMapping(value="/es_search/{task}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Result> doSearch(@PathVariable("task") String task) throws IOException {
+ JSONObject obj = new JSONObject(task);
+ String searchTerm = obj.getString("data");
+ String searchSize = obj.getString("size");
+ // String searchFuzzy = obj.getString("fuzzy");
+
+ JestClientFactory factory = new JestClientFactory();
+ factory.setHttpClientConfig(new HttpClientConfig
+ .Builder("http://todo_elastic_search_server")
+ .multiThreaded(true)
+ .build());
+ JestClient client = factory.getObject();
+
+ Search search = new Search.Builder("{\n"
+ +"\"query\" : {\n"
+ +"\"query_string\" : {\n"
+ +"\"query\" : \"name:"+ searchTerm +"\"\n"
+ +"}\n"
+ +"}\n"
+ +"}").addIndex("customer").setParameter(Parameters.SIZE,Integer.valueOf(searchSize)).build();
+
+ SearchResult result = client.execute(search);
+ System.err.println(result.getJsonObject().toString());
+ return new ResponseEntity<Result>(new Result(result.getJsonObject().toString()),HttpStatus.OK);
+ }
+
+ public ResponseEntity<Result> sendResult(Result result) {
+ return new ResponseEntity<Result>(result, HttpStatus.OK);
+ }
+
+ @Override
+ public boolean isRESTfulCall() {
+ return true;
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/LeafletMapContoller.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/LeafletMapContoller.java
new file mode 100644
index 00000000..4c603fe1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/LeafletMapContoller.java
@@ -0,0 +1,43 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.controller;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+/**
+ * Controller for geographic map view. The view is restricted to authenticated
+ * users. The view name defaults to the request name with no suffix,
+ * "leafletMap", which resolves to page leafletMap.jsp.
+ */
+@Controller
+@RequestMapping("/")
+public class LeafletMapContoller extends RestrictedBaseController {
+
+ @RequestMapping(value = { "/leafletMap" }, method = RequestMethod.GET)
+ public ModelAndView plot() {
+ final String defaultViewName = null;
+ return new ModelAndView(defaultViewName);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/PostDroolsController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/PostDroolsController.java
new file mode 100644
index 00000000..2729e873
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/PostDroolsController.java
@@ -0,0 +1,138 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.controller;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.command.PostDroolsBean;
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.service.PostDroolsService;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+@RequestMapping("/")
+public class PostDroolsController extends RestrictedBaseController{
+
+ @Autowired
+ private PostDroolsService postDroolsService;
+
+ @RequestMapping(value = {"/drools" }, method = RequestMethod.GET)
+ public ModelAndView drools(HttpServletRequest request) {
+
+ return new ModelAndView(getViewName());
+ }
+
+
+ @RequestMapping(value = {"/getDrools" }, method = RequestMethod.GET)
+ public void getDrools(HttpServletRequest request, HttpServletResponse response) {
+ // Map<String, Object> model = new HashMap<String, Object>();
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ List<PostDroolsBean> beanList = postDroolsService.fetchDroolBeans();
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(beanList));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @RequestMapping(value = {"/getDroolDetails" }, method = RequestMethod.GET)
+ public void getDroolDetails(HttpServletRequest request, HttpServletResponse response) {
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+
+ PostDroolsBean postDroolsBean = new PostDroolsBean();
+ String selectedFile = request.getParameter("selectedFile");
+ postDroolsBean.setDroolsFile(selectedFile);//sample populated
+ //postDroolsBean.setSelectedRules("[\"NJ\",\"NY\",\"KY\"]");
+ postDroolsBean.setClassName(postDroolsService.retrieveClass(selectedFile));
+
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(postDroolsBean));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @RequestMapping(value = {"/post_drools/execute" }, method = RequestMethod.POST)
+ public ModelAndView search(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ PostDroolsBean postDroolsBean = mapper.readValue(root.get("postDroolsBean").toString(), PostDroolsBean.class);
+
+ String resultsString = postDroolsService.execute(postDroolsBean.getDroolsFile(), postDroolsBean.getClassName(), postDroolsBean.getSelectedRules());
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+ //String responseString = mapper.writeValueAsString(resultsString);
+ JSONObject j = new JSONObject("{resultsString: "+resultsString+"}");
+
+ out.write(j.toString());
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/UserProfileController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/UserProfileController.java
new file mode 100644
index 00000000..2f4ea93d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/UserProfileController.java
@@ -0,0 +1,72 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.controller;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.domain.Profile;
+import org.openecomp.portalsdk.core.service.ProfileService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * Controller for user profile view. The view is restricted to authenticated
+ * users. The view name resolves to page user_profile.jsp which uses Angular.
+ */
+
+@Controller
+@RequestMapping("/")
+public class UserProfileController extends RestrictedBaseController {
+
+ @Autowired
+ ProfileService service;
+
+ @RequestMapping(value = { "/user_profile" }, method = RequestMethod.GET)
+ public ModelAndView ProfileSearch(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ ObjectMapper mapper = new ObjectMapper();
+ List<Profile> profileList = service.findAll();
+ try {
+ model.put("customerInfo", mapper.writeValueAsString(profileList));
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return new ModelAndView("user_profile", "model", model);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/WelcomeController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/WelcomeController.java
new file mode 100644
index 00000000..06853f0e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/WelcomeController.java
@@ -0,0 +1,43 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.controller;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+/**
+ * Controller for welcome view. The view is restricted to authenticated users.
+ * The view name defaults to the request name with no suffix, "welcome", which
+ * resolves to page welcome.jsp.
+ */
+@Controller
+@RequestMapping("/")
+public class WelcomeController extends RestrictedBaseController {
+ @RequestMapping(value = { "/welcome" }, method = RequestMethod.GET)
+ public ModelAndView welcome(HttpServletRequest request) {
+ final String defaultViewName = null;
+ return new ModelAndView(defaultViewName);
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/model/Result.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/model/Result.java
new file mode 100644
index 00000000..5e09cb2c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/model/Result.java
@@ -0,0 +1,37 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.model;
+
+public class Result {
+ private String result;
+
+ public Result(String result) {
+ this.result = result;
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java
new file mode 100644
index 00000000..b308efbb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java
@@ -0,0 +1,47 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.scheduler;
+
+import org.openecomp.portalapp.conf.ExternalAppConfig;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.quartz.DisallowConcurrentExecution;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.quartz.PersistJobDataAfterExecution;
+import org.springframework.scheduling.quartz.QuartzJobBean;
+
+@PersistJobDataAfterExecution
+@DisallowConcurrentExecution
+public class LogJob extends QuartzJobBean {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExternalAppConfig.class);
+
+
+ @Override
+ protected void executeInternal(JobExecutionContext ctx)
+ throws JobExecutionException {
+ // JobDataMap dataMap = ctx.getJobDetail().getJobDataMap();
+ //int cnt = dataMap.getInt("");
+ // JobKey jobKey = ctx.getJobDetail().getKey();
+ logger.info(EELFLoggerDelegate.debugLogger, (Runtime.getRuntime().maxMemory() + " " + Runtime.getRuntime().maxMemory()));
+
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java
new file mode 100644
index 00000000..dce9e26b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java
@@ -0,0 +1,57 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.scheduler;
+
+import java.text.ParseException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.portalsdk.core.scheduler.CronRegistry;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
+import org.springframework.scheduling.quartz.JobDetailFactoryBean;
+import org.springframework.stereotype.Component;
+
+@Component
+@DependsOn({ "systemProperties" })
+public class LogRegistry extends CronRegistry {
+
+ private static final String groupName = "AppGroup";
+ private static final String jobName = "LogJob";
+ private static final String triggerName = "LogTrigger";
+
+ // @Autowired
+ // private SystemProperties systemProperties;
+
+ // @Bean
+ public JobDetailFactoryBean jobDetailFactoryBean() {
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("units", "bytes");
+ return jobDetailFactoryBean(groupName, jobName, LogJob.class, map);
+ }
+
+ // @Bean
+ public CronTriggerFactoryBean cronTriggerFactoryBean() throws ParseException {
+ // "0 * * * * ? *
+ return cronTriggerFactoryBean(groupName, triggerName, SystemProperties.getProperty(SystemProperties.LOG_CRON));
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/Register.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/Register.java
new file mode 100644
index 00000000..3a29520e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/Register.java
@@ -0,0 +1,82 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.scheduler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.scheduler.Registerable;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.quartz.Trigger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.stereotype.Component;
+
+@Component
+@DependsOn({"logRegistry", "systemProperties"})
+public class Register implements Registerable {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(Register.class);
+
+
+ private List<Trigger> scheduleTriggers = new ArrayList<Trigger>();
+ Trigger trigger[] = new Trigger[1];
+
+
+ @Autowired
+ private LogRegistry logRegistry;
+
+
+
+ @Override
+ public Trigger[] getTriggers() {
+ return getScheduleTriggers().toArray(trigger);
+ }
+
+ @Override
+ public void registerTriggers() {
+ // if the property value is not available; the cron will not be added and can be ignored. its safe to ignore the exceptions
+ try {
+ if(SystemProperties.getProperty(SystemProperties.LOG_CRON) != null)
+ getScheduleTriggers().add(logRegistry.getTrigger());
+
+ } catch(IllegalStateException ies) {
+ logger.info(EELFLoggerDelegate.debugLogger, ("Log Cron not available"));
+ }
+
+
+ }
+
+
+ public List<Trigger> getScheduleTriggers() {
+ return scheduleTriggers;
+ }
+
+ public void setScheduleTriggers(List<Trigger> scheduleTriggers) {
+ this.scheduleTriggers = scheduleTriggers;
+ }
+
+
+
+
+
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java
new file mode 100644
index 00000000..1bc43fee
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java
@@ -0,0 +1,108 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.scheduler;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.openecomp.portalsdk.core.scheduler.Registerable;
+import org.openecomp.portalsdk.workflow.services.WorkflowScheduleService;
+import org.quartz.Trigger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+import org.springframework.stereotype.Component;
+
+/**
+ * TODO REFACTOR
+ * moved from org.openecomp.portalsdk.core.scheduler
+ * to org.openecomp.portalapp.scheduler
+ *
+ */
+@Component
+public class RegistryAdapter {
+
+ @Autowired
+ private Registerable registry;
+
+ @Autowired
+ private WorkflowScheduleService workflowScheduleService;
+
+ private SchedulerFactoryBean schedulerBean;
+
+ Trigger trigger[] = new Trigger[1];
+
+ public Trigger[] getTriggers() {
+
+ registry.registerTriggers();
+
+ List<Trigger> allTriggers = new ArrayList<Trigger>();
+
+ List<Trigger> coreTriggers = addCoreTriggers();
+ final Trigger[] extTriggerArray = registry.getTriggers();
+
+ allTriggers.addAll(Arrays.asList(extTriggerArray));
+ allTriggers.addAll(coreTriggers);
+
+ return allTriggers.toArray(trigger);
+
+
+ }
+
+
+ public List<Trigger> addCoreTriggers() {
+ //On startup of the application after crash recovery, invoke workflow schedule trigger
+ List<Trigger> triggers = getWorkflowScheduleService().triggerWorkflowScheduling();
+ return triggers;
+ }
+
+
+ public void setSchedulerBean(SchedulerFactoryBean _schedulerBean) {
+ schedulerBean = _schedulerBean;
+
+ }
+
+ public SchedulerFactoryBean getSchedulerBean() {
+ return schedulerBean;
+
+ }
+
+
+ public Registerable getRegistry() {
+ return registry;
+ }
+
+
+ public void setRegistry(Registerable registry) {
+ this.registry = registry;
+ }
+
+
+ public WorkflowScheduleService getWorkflowScheduleService() {
+ return workflowScheduleService;
+ }
+
+
+ public void setWorkflowScheduleService(
+ WorkflowScheduleService workflowScheduleService) {
+ this.workflowScheduleService = workflowScheduleService;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java
new file mode 100644
index 00000000..c4a36c61
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java
@@ -0,0 +1,34 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.service;
+
+import org.openecomp.portalsdk.core.domain.User;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service("adminAuthExtension")
+@Transactional
+public class AdminAuthExtension {
+
+ public void saveUserExtension(User user){
+ //app's developer implement their own logic here, like updating app's related tables
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java
new file mode 100644
index 00000000..c052187a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java
@@ -0,0 +1,73 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.uebhandler;
+
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import javax.annotation.PostConstruct;
+
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
+import org.openecomp.portalsdk.core.onboarding.ueb.UebManager;
+import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+
+//
+// Adding this class for the sole purpose of insuring that the MainUebHandler really
+// honors @Async and kicks off a thread. For more info google @Async and read about
+// @Async only working if called from different class.
+//
+@Configuration
+public class InitUebHandler {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(InitUebHandler.class);
+
+
+ @Autowired
+ MainUebHandler mainUebHandler;
+
+ public InitUebHandler() {
+
+ }
+
+ @PostConstruct
+ public void initUeb() {
+
+ try {
+ String enableListenerThread = PortalApiProperties.getProperty(PortalApiConstants.UEB_LISTENERS_ENABLE);
+ if (enableListenerThread.equalsIgnoreCase("true")) {
+ ConcurrentLinkedQueue<UebMsg> inboxQueue = new ConcurrentLinkedQueue<UebMsg>();
+ UebManager.getInstance().initListener(inboxQueue);
+ mainUebHandler.runHandler(inboxQueue);
+ logger.info(EELFLoggerDelegate.debugLogger, ("Returned from initiating mainUebHandler..."));
+ }
+ else {
+ logger.info(EELFLoggerDelegate.debugLogger, ("Not starting UEB listening thread because ueb_listeners_enable is not set to true in the properties file."));
+ }
+ }
+ catch (Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("Not starting UEB listening thread because property could not be read " + PortalApiConstants.UEB_LISTENERS_ENABLE),AlarmSeverityEnum.MAJOR);
+ }
+
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java
new file mode 100644
index 00000000..7ff07dd4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java
@@ -0,0 +1,104 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.uebhandler;
+
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg;
+import org.openecomp.portalsdk.core.onboarding.ueb.UebMsgTypes;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+
+//-------------------------------------------------------------------------
+// Listens for received UEB messages and handles the messages
+//
+// Note: To implement a synchronous reply call getMsgId on the request
+// and putMsgId on the reply (echoing the request MsgId).
+//
+//-------------------------------------------------------------------------
+@Component("MainUebHandler")
+public class MainUebHandler {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MainUebHandler.class);
+
+
+ ConcurrentLinkedQueue<UebMsg> inboxQueue = null;
+
+ @Autowired
+ WidgetNotificationHandler widgetNotificationHandler;
+
+ @Async
+ public void runHandler(ConcurrentLinkedQueue<UebMsg> queue) {
+ inboxQueue = queue;
+
+ logger.info(EELFLoggerDelegate.debugLogger, ("==> MainUebHandler started"));
+
+ while (true) {
+ UebMsg msg = null;
+ while ((msg = inboxQueue.poll()) != null) {
+ if (msg.getMsgType() != null) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("<== Received UEB message : " + msg.toString()));
+
+ switch (msg.getMsgType()) {
+ /*
+ * Add your own defined handler objects, use @Component for
+ * the class. See WidgetNotificationHandler as an example.
+ *
+ * Use @Async on methods for performance
+ *
+ * For syncronous replies use UebManager publishReply and
+ * echo back the msgId in your response ie
+ * msg.putMsgId(requestMsg.getMsgId())
+ *
+ * case UebMsgTypes.UEB_MSG_TYPE_XYZ: {
+ * XYZHandler.handleMsg(msg); break; }
+ */
+ case UebMsgTypes.UEB_MSG_TYPE_WIDGET_NOTIFICATION: {
+ widgetNotificationHandler.handleWidgetNotification(msg);
+ break;
+ }
+ default: {
+
+ logger.info(EELFLoggerDelegate.debugLogger, ("Unknown message type [" + msg.getMsgType() + "] from " + msg.getSourceTopicName()));
+
+ break;
+ }
+ }
+ }
+ }
+
+ if (Thread.interrupted()) {
+
+ logger.info(EELFLoggerDelegate.debugLogger, ("==> UebMainHandler exiting"));
+
+ break;
+ }
+
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) {
+ logger.info(EELFLoggerDelegate.debugLogger, ("UebMainHandler interrupted during sleep" + e.getMessage()));
+
+ }
+ }
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java
new file mode 100644
index 00000000..dd2213da
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java
@@ -0,0 +1,46 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.uebhandler;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+
+@Component
+public class WidgetNotificationHandler {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetNotificationHandler.class);
+
+
+ public WidgetNotificationHandler() {
+ }
+
+ @Async
+ public void handleWidgetNotification(UebMsg requestMsg) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("handleWidgetNotification received notification: " + requestMsg.toString()));
+ /*
+ * Here the notification msg can be handled
+ *
+ * requestMsg.getPayload() - returns string that contains the
+ * Application defined content
+ */
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java
new file mode 100644
index 00000000..48c51195
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java
@@ -0,0 +1,54 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalapp.util;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.filter.Filter;
+import ch.qos.logback.core.spi.FilterReply;
+
+/**
+ * Custom Filter class bind with logback.xml
+ * configuration file to strip out certain log messages
+ * coming out of special packages or classes.
+ *
+ */
+public class CustomLoggingFilter extends Filter<ILoggingEvent> {
+
+ /**
+ * Custom Filter is added to strip out the continuous U-EB logging messages
+ * But make sure we log the ERROR & WARNING Level messages.
+ */
+ @Override
+ public FilterReply decide(ILoggingEvent event) {
+ try {
+ if ((event.getLevel() != Level.ERROR || event.getLevel() != Level.WARN) &&
+ (event.getThreadName().equalsIgnoreCase("UEBConsumerThread")) &&
+ (event.getLoggerName().contains("org.openecomp.nsa") || event.getLoggerName().contains("org.apache.http"))
+ ) {
+ return FilterReply.DENY;
+ } else {
+ return FilterReply.NEUTRAL;
+ }
+ } catch(Exception e) {
+ return FilterReply.NEUTRAL;
+ }
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/resources/att-rules.drl b/ecomp-sdk/sdk-app/src/main/resources/att-rules.drl
new file mode 100644
index 00000000..e15c3fb1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/resources/att-rules.drl
@@ -0,0 +1,16 @@
+package org.openecomp.portalsdk.core.drools;
+
+
+rule "Drools NJ"
+when
+$droolsRuleService : DroolsRuleServiceImpl( state == "NJ" )
+then
+$droolsRuleService.setResultsString("NJ state :" + " Garden State");
+end
+
+rule "Drools NY"
+when
+$droolsRuleService : DroolsRuleServiceImpl( state == "NY" )
+then
+$droolsRuleService.setResultsString("NY state :" + " Empire State");
+end
diff --git a/ecomp-sdk/sdk-app/src/main/resources/cache.ccf b/ecomp-sdk/sdk-app/src/main/resources/cache.ccf
new file mode 100644
index 00000000..d21404b0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/resources/cache.ccf
@@ -0,0 +1,30 @@
+# DEFAULT CACHE REGION
+jcs.default=DC
+jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.default.cacheattributes.MaxObjects=1000
+jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
+jcs.default.elementattributes.IsEternal=true
+jcs.default.elementattributes.IsSpool=true
+
+
+# MEMORY SHRINKING CONFIGURATION (Commented)
+#jcs.default.cacheattributes.UseMemoryShrinker=true
+#jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600
+#jcs.default.cacheattributes.ShrinkerIntervalSeconds=60
+#jcs.default.cacheattributes.MaxSpoolPerRun=500
+#jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
+#jcs.default.elementattributes.IsEternal=false
+
+
+# AUXILLARY CACHE CONFIGURATION
+jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
+jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
+jcs.auxiliary.DC.attributes.DiskPath=/tmp
+
+
+# PRE-DEFINED REGION FOR LOOKUP DATA
+jcs.region.lookUpObjectCache=DC
+jcs.region.lookUpObjectCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.region.lookUpObjectCache.cacheattributes.MaxObjects=4000
+jcs.region.lookUpObjectCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
diff --git a/ecomp-sdk/sdk-app/src/main/resources/logback.xml b/ecomp-sdk/sdk-app/src/main/resources/logback.xml
new file mode 100644
index 00000000..4f773ee2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/resources/logback.xml
@@ -0,0 +1,370 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<configuration scan="true" scanPeriod="3 seconds" debug="true">
+ <!--
+ Logback files for the ECOMP SDK Application "ecomp_app"
+ are created in directory ${catalina.base}/logs/ecomp_app;
+ e.g., apache-tomcat-8.0.35/logs/ecomp_app/application.log
+ -->
+ <!--<jmxConfigurator /> -->
+
+ <!-- specify the component name -->
+ <property name="componentName" value="ep_sdk_app"></property>
+
+ <!-- specify the base path of the log directory -->
+ <property name="logDirPrefix" value="${catalina.base}/logs"></property>
+
+ <!-- The directories where logs are written -->
+ <property name="logDirectory" value="${logDirPrefix}/${componentName}" />
+ <!-- Can easily relocate debug logs by modifying this path. -->
+ <property name="debugLogDirectory" value="${logDirPrefix}/${componentName}" />
+
+ <!-- log file names -->
+ <property name="generalLogName" value="application" />
+ <property name="errorLogName" value="error" />
+ <property name="metricsLogName" value="metrics" />
+ <property name="auditLogName" value="audit" />
+ <property name="debugLogName" value="debug" />
+ <!--
+ These loggers are not used in code (yet).
+ <property name="securityLogName" value="security" />
+ <property name="policyLogName" value="policy" />
+ <property name="performanceLogName" value="performance" />
+ <property name="serverLogName" value="server" />
+ -->
+
+ <!-- 1610 Logging Fields Format Revisions -->
+ <property name="auditLoggerPattern"
+ value="%X{AuditLogBeginTimestamp}|%X{AuditLogEndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{ClientIPAddress}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}| %msg%n" />
+
+ <property name="metricsLoggerPattern"
+ value="%X{MetricsLogBeginTimestamp}|%X{MetricsLogEndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{ClientIPAddress}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{TargetVisualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}| %msg%n" />
+
+ <property name="errorLoggerPattern"
+ value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{ClassName}|%X{AlertSeverity}|%X{ErrorCode}|%X{ErrorDescription}| %msg%n" />
+
+ <property name="defaultLoggerPattern"
+ value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{ClassName}| %msg%n" />
+
+ <!-- use %class so library logging calls yield their class name -->
+ <property name="applicationLoggerPattern"
+ value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%class{36}| %msg%n" />
+
+ <!-- Example evaluator filter applied against console appender -->
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>${defaultLoggerPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- ============================================================================ -->
+ <!-- EELF Appenders -->
+ <!-- ============================================================================ -->
+
+ <!-- The EELFAppender is used to record events to the general application
+ log -->
+
+
+ <appender name="EELF"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${generalLogName}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <!-- daily rollover -->
+ <fileNamePattern>${logDirectory}/${generalLogName}.%d{yyyy-MM-dd}.log.zip</fileNamePattern>
+
+ <!-- keep 30 days' worth of history capped at 3GB total size -->
+ <maxHistory>30</maxHistory>
+ <totalSizeCap>3GB</totalSizeCap>
+
+ </rollingPolicy>
+ <encoder>
+ <pattern>${applicationLoggerPattern}</pattern>
+ </encoder>
+ <filter class="org.openecomp.portalapp.util.CustomLoggingFilter" />
+ </appender>
+
+ <appender name="asyncEELF" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <!-- Class name is part of caller data -->
+ <includeCallerData>true</includeCallerData>
+ <appender-ref ref="EELF" />
+ </appender>
+
+ <!-- EELF Security Appender. This appender is used to record security events
+ to the security log file. Security events are separate from other loggers
+ in EELF so that security log records can be captured and managed in a secure
+ way separate from the other logs. This appender is set to never discard any
+ events. -->
+ <!--
+ <appender name="EELFSecurity"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${securityLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/${securityLogName}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncEELFSecurity" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <discardingThreshold>0</discardingThreshold>
+ <appender-ref ref="EELFSecurity" />
+ </appender>
+ -->
+
+ <!-- EELF Performance Appender. This appender is used to record performance
+ records. -->
+ <!--
+ <appender name="EELFPerformance"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${performanceLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/${performanceLogName}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <outputPatternAsHeader>true</outputPatternAsHeader>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncEELFPerformance" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFPerformance" />
+ </appender>
+ -->
+
+ <!-- EELF Server Appender. This appender is used to record Server related
+ logging events. The Server logger and appender are specializations of the
+ EELF application root logger and appender. This can be used to segregate Server
+ events from other components, or it can be eliminated to record these events
+ as part of the application root log. -->
+ <!--
+ <appender name="EELFServer"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${serverLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/${serverLogName}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncEELFServer" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFServer" />
+ </appender>
+ -->
+
+ <!-- EELF Policy Appender. This appender is used to record Policy engine
+ related logging events. The Policy logger and appender are specializations
+ of the EELF application root logger and appender. This can be used to segregate
+ Policy engine events from other components, or it can be eliminated to record
+ these events as part of the application root log. -->
+ <!--
+ <appender name="EELFPolicy"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${policyLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/${policyLogName}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncEELFPolicy" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFPolicy" />
+ </appender>
+ -->
+
+ <!-- EELF Audit Appender. This appender is used to record audit engine
+ related logging events. The audit logger and appender are specializations
+ of the EELF application root logger and appender. This can be used to segregate
+ Policy engine events from other components, or it can be eliminated to record
+ these events as part of the application root log. -->
+
+ <appender name="EELFAudit"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${auditLogName}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <!-- daily rollover -->
+ <fileNamePattern>${logDirectory}/${auditLogName}.%d{yyyy-MM-dd}.log.zip</fileNamePattern>
+
+ <!-- keep 30 days' worth of history capped at 3GB total size -->
+ <maxHistory>30</maxHistory>
+ <totalSizeCap>3GB</totalSizeCap>
+
+ </rollingPolicy>
+ <encoder>
+ <pattern>${auditLoggerPattern}</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncEELFAudit" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFAudit" />
+ </appender>
+
+ <appender name="EELFMetrics"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${metricsLogName}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <!-- daily rollover -->
+ <fileNamePattern>${logDirectory}/${metricsLogName}.%d{yyyy-MM-dd}.log.zip</fileNamePattern>
+
+ <!-- keep 30 days' worth of history capped at 3GB total size -->
+ <maxHistory>30</maxHistory>
+ <totalSizeCap>3GB</totalSizeCap>
+
+ </rollingPolicy>
+ <encoder>
+ <pattern>${metricsLoggerPattern}</pattern>
+ </encoder>
+ </appender>
+
+
+ <appender name="asyncEELFMetrics" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFMetrics"/>
+ </appender>
+
+ <appender name="EELFError"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${errorLogName}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <!-- daily rollover -->
+ <fileNamePattern>${logDirectory}/${errorLogName}.%d{yyyy-MM-dd}.log.zip</fileNamePattern>
+
+ <!-- keep 30 days' worth of history capped at 3GB total size -->
+ <maxHistory>30</maxHistory>
+ <totalSizeCap>3GB</totalSizeCap>
+
+ </rollingPolicy>
+ <encoder>
+ <pattern>${errorLoggerPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncEELFError" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFError"/>
+ </appender>
+
+ <appender name="EELFDebug"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${debugLogDirectory}/${debugLogName}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <!-- daily rollover -->
+ <fileNamePattern>${logDirectory}/${debugLogName}.%d{yyyy-MM-dd}.log.zip</fileNamePattern>
+
+ <!-- keep 30 days' worth of history capped at 3GB total size -->
+ <maxHistory>30</maxHistory>
+ <totalSizeCap>3GB</totalSizeCap>
+
+ </rollingPolicy>
+ <encoder>
+ <pattern>${defaultLoggerPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncEELFDebug" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFDebug" />
+ </appender>
+
+
+ <!-- ============================================================================ -->
+ <!-- EELF loggers -->
+ <!-- ============================================================================ -->
+ <logger name="com.att.eelf" level="debug" additivity="false">
+ <appender-ref ref="asyncEELF" />
+ </logger>
+
+ <!--
+ <logger name="com.att.eelf.security" level="info" additivity="false">
+ <appender-ref ref="asyncEELFSecurity" />
+ </logger>
+ <logger name="com.att.eelf.perf" level="info" additivity="false">
+ <appender-ref ref="asyncEELFPerformance" />
+ </logger>
+ <logger name="com.att.eelf.server" level="info" additivity="false">
+ <appender-ref ref="asyncEELFServer" />
+ </logger>
+ <logger name="com.att.eelf.policy" level="info" additivity="false">
+ <appender-ref ref="asyncEELFPolicy" />
+ </logger>
+ -->
+
+ <logger name="com.att.eelf.audit" level="info" additivity="false">
+ <appender-ref ref="asyncEELFAudit" />
+ </logger>
+
+ <logger name="com.att.eelf.metrics" level="info" additivity="false">
+ <appender-ref ref="asyncEELFMetrics" />
+ </logger>
+
+ <logger name="com.att.eelf.error" level="info" additivity="false">
+ <appender-ref ref="asyncEELFError" />
+ </logger>
+
+ <logger name="com.att.eelf.debug" level="debug" additivity="false">
+ <appender-ref ref="asyncEELFDebug" />
+ </logger>
+
+
+ <root level="DEBUG">
+ <appender-ref ref="asyncEELF" />
+ </root>
+
+</configuration>
diff --git a/ecomp-sdk/sdk-app/src/main/resources/mchange-log.properties b/ecomp-sdk/sdk-app/src/main/resources/mchange-log.properties
new file mode 100644
index 00000000..77e260bb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/resources/mchange-log.properties
@@ -0,0 +1,23 @@
+###
+# ================================================================================
+# eCOMP Portal SDK
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ================================================================================
+###
+# Direct the proprietary logger used by com.mchange.c3p0 to use slf4j
+
+com.mchange.v2.log.MLog=com.mchange.v2.log.FallbackMLog
+com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL=OFF
diff --git a/ecomp-sdk/sdk-app/src/main/resources/portal.properties b/ecomp-sdk/sdk-app/src/main/resources/portal.properties
new file mode 100644
index 00000000..fb59dfbb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/resources/portal.properties
@@ -0,0 +1,69 @@
+###
+# ================================================================================
+# eCOMP Portal SDK
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ================================================================================
+###
+# Properties read by ECOMP Framework library, ecompFW.jar
+
+##########################################################################
+# The following properties should NOT be changed by partner applications.
+##########################################################################
+
+portal.api.prefix = /api
+max.idle.time = 5
+user.attribute.name = user_attribute
+
+testing=testing
+
+#Use REST API instead of UEB to fetch the functional menu data
+use_rest_for_functional_menu=true
+
+##########################################################################
+# The following properties MUST be changed by partner applications.
+##########################################################################
+
+# Name of java class that implements the OnBoardingApiService interface.
+portal.api.impl.class = org.openecomp.portalsdk.core.onboarding.client.OnBoardingApiServiceImpl
+
+# CSP Global Log On for single sign on
+ecomp_redirect_url = http://todo_enter_portal_hostname:8080/ecompportal/login.htm
+
+# URL of the ECOMP Portal REST API
+
+ecomp_rest_url = TODO_Portal_URL
+
+# Applications do not need to run a UEB listener in 1610.
+ueb_listeners_enable = false
+
+# UEB Configuration
+# In release 1607, all 6 entries below were required.
+# In release 1610, if key ueb_listeners_enable is set to false,
+# then only the ueb_app_key is required.
+# UEB servers
+ueb_url_list = todo_ueb_url_list
+# ECOMP Portal listens on this UEB topic
+ecomp_portal_inbox_name = ECOMP-PORTAL-INBOX-TEST-DEMETER
+# Replace these 3 default values with the ones for your specific App,
+# as shown on the on-boarding page on the ECOMP Portal web application.
+ueb_app_key = ZOicEniw7BWDL1pM
+ueb_app_secret = PJIsBErHfo2RGKzuu03CZKgV
+ueb_app_mailbox_name = ECOMP-PORTAL-OUTBOX-TEST-32756
+# Consumer group name for UEB topic.
+# Use the special tag '{UUID}' to generate a unique one for each sdk-app server.
+ueb_app_consumer_group_name = {UUID}
+
+decryption_key = AGLDdG4D04BKm2IxIWEr8o==
diff --git a/ecomp-sdk/sdk-app/src/main/resources/state-rules.drl b/ecomp-sdk/sdk-app/src/main/resources/state-rules.drl
new file mode 100644
index 00000000..586ae6b7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/resources/state-rules.drl
@@ -0,0 +1,38 @@
+package org.openecomp.portalsdk.core.drools;
+global String age
+
+rule "Default"
+when
+$droolsRuleService : DroolsRuleServiceImpl( state != null )
+then
+System.out.println($droolsRuleService.accessLabel() +" "+ $droolsRuleService.getState() +" state legal age is " + getDefaultIfNull(age));
+$droolsRuleService.setResultsString($droolsRuleService.getState()+" state legal age is " + getDefaultIfNull(age));
+end
+
+rule "Drools NJ"
+when
+$droolsRuleService : DroolsRuleServiceImpl( state == "NJ" )
+then
+System.out.println($droolsRuleService.accessLabel() +" "+ "NJ state legal age is " + getDefaultIfNull(age));
+$droolsRuleService.setResultsString("NJ state legal age is " + getDefaultIfNull(age));
+end
+
+rule "Drools KY"
+when
+$droolsRuleService : DroolsRuleServiceImpl( state == "KY" )
+then
+System.out.println($droolsRuleService.accessLabel() +" "+ "KY state legal age is " + getDefaultIfNull("20"));
+$droolsRuleService.setResultsString("KY state legal age is " + getDefaultIfNull("20"));
+end
+
+rule "Drools NY"
+when
+$droolsRuleService : DroolsRuleServiceImpl( state == "NY" )
+then
+System.out.println($droolsRuleService.accessLabel() +" "+ "NY state legal age is " + getDefaultIfNull("21"));
+$droolsRuleService.setResultsString("NY state legal age is " + getDefaultIfNull("21"));
+end
+
+function String getDefaultIfNull(String age) {
+return age == null ? "18" : age;
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/quartz.properties b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/quartz.properties
new file mode 100644
index 00000000..23340ddc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/quartz.properties
@@ -0,0 +1,30 @@
+#################################################################################
+# Quartz configurations for Quantum Work Flow #
+#################################################################################
+
+org.quartz.scheduler.instanceId = AUTO
+
+#################################################################################
+# Main configurations
+org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
+org.quartz.threadPool.threadCount = 30
+
+============================================================================
+# Configure JobStore
+#============================================================================
+
+org.quartz.jobStore.misfireThreshold = 60000
+
+org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
+org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
+org.quartz.jobStore.useProperties = false
+#org.quartz.jobStore.dataSource = myDS
+org.quartz.jobStore.tablePrefix = FN_QZ_
+
+org.quartz.jobStore.isClustered = true
+org.quartz.jobStore.clusterCheckinInterval = 20000
+
+#============================================================================
+# Configure Datasources
+#============================================================================
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor.properties b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor.properties
new file mode 100644
index 00000000..68b1f707
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor.properties
@@ -0,0 +1,187 @@
+###
+# ================================================================================
+# eCOMP Portal SDK
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ================================================================================
+###
+##C## Mention the name of the framework. At present RAPTOR supports FUSION
+system=fusion
+##C## Determines the priority for the debug message.
+debug_level=5
+##C## Determines the number of records can be downloaded in excel when you select "download all" option.
+download_limit=65000
+csv_download_limit=10
+##C## Determines the number of records to be displayed in a single page.
+default_page_size=50
+##C## Determines the list size in the form field.
+form_fields_list_size=99000
+##C## Determines the scheduler interval
+#scheduler_interval=0 => disabled
+scheduler_interval=0
+##C## System Name
+system_name=RAPTOR
+##C## This is used for Bread crumbs.
+base_title=ANALYSIS
+##C## whether to allow SQL-based report definition (security risk); super users are always allowed to create SQL-based reports
+allow_sql_based_reports=yes
+##C## Determines whether to include disclaimer page at the bottom of each screen
+show_disclaimer=yes
+disclaimer_positioned_top_in_csvexcel=yes
+##C## Determines whether to display the form page as a separate page before running the report
+display_form_before_run=yes
+##C## Determines whether to include the form page on the report data page
+include_form_with_data=yes
+##C## Determines whether to cache chart data in the session => faster re-display if the data volume does not get too large
+cache_chart_data=yes
+##C## Determines whether to cache report data for the currently displayed page in the session => faster re-display
+ ##C## if the data volume does not get too large
+cache_cur_page_data=yes
+##C## Determines Chart width
+default_chart_width=700
+##C## Determines Chart height
+default_chart_height=420
+##C## Determines whether to permit report deletion only by report owner or by everyone with "write" access
+delete_only_by_owner=no
+##C## Determines whether to log each report execution and update time and user ID
+enable_report_log=yes
+##C## Determines whether to cache user roles info in memory (saves many DB reads, but does not account for roles
+ ##C## assigned after the cache was loaded)
+cache_user_roles=yes
+##C## Determines whether to convert month formats (e.g. MM/YYYY) to the last day of the month (true) or
+ ##C## first day (false) - like 12/2003 is converted to either 12/31/2003 or 12/01/2003
+month_format_use_last_day=no
+##C## Determines whether to print the report title in the download files
+print_title_in_download=yes
+##C## Determines whether to show report description when the report is run and in the quick links
+show_descr_at_runtime=no
+##C## Determines whether to skip labels on the Line chart axis when they overlap
+#DEPRECATED skip_chart_labels_to_fit=no
+##C## Determines whether to show chart types that are purpose and/or data specific
+show_nonstandard_charts=yes
+##C## Determines whether to allow the user to change the chart type at runtime
+allow_runtime_chart_sel=yes
+##C## Determines whether to display the report title as chart title as well
+display_chart_title=yes
+##C## Determines whether to merge/blank multi-level row headings in cross-tab report
+merge_crosstab_row_headings=yes
+##C## Determines whether to display chart when displaying the report at first or just a "Show Chart" button
+display_chart_by_default=yes
+##C## Determines whether to print the form field values in the download files
+print_params_in_download=yes
+##C## Determines the limitation to the characters in chart label.
+skip_chart_labels_limit=30
+##C## Determines whether to users with read-only rights for a report can copy it
+can_copy_on_read_only=yes
+##C## Determines the no of decimals to be displayed in Totals column
+#max_decimals_on_totals=-1 => don't truncate, display all decimal digits
+max_decimals_on_totals=2
+##C## Determines which JFreeChart to use.
+jfree_version=latest
+#jfree_version=0.9.11
+# Added this restriction so that heavily used system which contain
+# more than 1000 users can enable this feature not to display whole
+# users in the drop down menu
+display_all_users=yes
+##Sheet name
+sheet_name=raptor
+#shell_script_name=/home/sundar/test.sh
+#download_query_folder=/titan/PROJECT3/RAPTOR/raptor/dwnld/query/
+## this directory is mentioned if the flat file is downloaded using shell script
+shell_script_dir=/titan/PROJECT3/RAPTOR/raptor/dwnld/
+flat_file_lower_limit=1
+flat_file_upper_limit=200000
+## whatever request mentioned here would be parsed in sql and request parameter would be filled
+request_get_params=isEmbedded
+print_footer_in_download=yes
+## footer mentioned here appears in downloaded excel
+footer_first_line=TODO footer first line
+footer_second_line=Use Pursuant to Company Instructions
+## to run report in popup window
+report_in_popup_window=yes
+## to run each report in new popup window if the above is selected
+popup_in_new_window=yes
+## "Yes" allows the request param to be passed to the drill down report
+pass_request_param_in_drilldown=yes
+## Show PDF download icon
+show_pdf_download=yes
+# Show Folder Tree
+show_folder_tree=no
+#Show folder tree only for Admin Users
+show_folder_tree_only_to_admin_users=no
+#folder tree should be minimized
+folder_tree_minimized=yes
+## whatever session mentioned here would be parsed in sql and session parameter would be filled
+session_params=login_id
+display_formfield_info=yes
+customize_formfield_info=yes
+#schedule limit for end users
+schedule_limit=10
+# customized query if you need any restrictions for schedule and security tab for fusion
+#schedule_custom_query_for_users=getAllUsersByCustomer
+#schedule_custom_query_for_roles=getAllRolesByCustomer
+# customized query if you need any restrictions for schedule and security tab for prisms example
+#schedule_custom_query_for_users=SELECT au.user_id, au.first_name||' '||au.last_name user_name FROM app_user au order by 2
+schedule_custom_query_for_users=SELECT au.user_id id, au.first_name||' '||au.last_name name FROM app_user au where user_id = 1 order by 2
+#schedule_custom_query_for_roles=SELECT ar.role_id, ar.descr role_name FROM app_role ar order by 2
+schedule_date_pattern=MM/dd/yyyy hh:mm:ss a
+## This is used to display in right format in chart timestamp axis as we give in the sql
+#chart_yearly_format=yyyy
+#chart_monthly_format=MMM-yyyy
+#chart_daily_format=MM-dd-yyyy
+chart_hourly_format=MM/dd HH
+#chart_minute_format=HH:mm
+chart_minute_format=MM-dd-yyyy-HH:mm
+#chart_second_format=HH:mm:ss
+chart_second_format=MM-dd-yyyy
+#chart_millisecond_format=HH:mm:ss.S
+schedule_help_text=This form is used to schedule a specific Reporting Platform report to be delivered to one or more email addresses associated with your Company's Business Direct user logins. Note that report output delivered via email does not include the capability to drill down/back up to additional data levels. So, select the appropriate data level report for the scheduled report. View the status of scheduled report requests in the My Schedules menu item.
+use_loginid_in_schedYN=Y
+session_params_for_scheduling=login_id
+session_date_formfield_auto_incr=yes
+display_session_param_pdfexcel=login_id;Login Id
+session_params_for_displaying_in_scheduling=login_id;Login Id
+application_server=tomcat
+#gmap properties
+gmap_key=ABQIAAAAToJSSetKBMjBJx8MiRw4ghQiU0SbbKnm8C5eu25cpyLwgkLzyRShrQTbgZtqnKAqZU9JwcSq1bKwiA
+PROJECT-FOLDER=/Users/sundar/git/st_quantum/quantum/target/quantum-1.0
+#
+MARKET-SHAPEFILE-FOLDER=resources/files
+# output folder for files generated on server side
+OUTPUT-FOLDER=resources/temp
+# tile size in pixel
+TILE-SIZE=256
+#check if map is disabled or not
+map_allowed=Y
+max_drilldown_level=2
+admin_role_equiv_to_super_role=N
+show_loading_during_formfield_chain=Y
+show_print_icon=N
+globally_nowrap=N
+calendar_output_date_format=MM/dd/yyyy
+memory_threshold_percentage=99
+print_params_in_csv_download=yes
+notitle_in_dashboard=yes
+generate_store_sched_reports=yes
+show_excel_2007_download=yes
+print_excel_in_landscape=yes
+show_animated_chart_option=yes
+show_animated_chart_only=no
+adjust_content_based_on_height=yes
+custom_submit_button_text=Run Button
+customize_formfield_layout=yes
+#db_type=postgresql
+#db_type=oracle
+db_type=mysql
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_app_fusion.properties b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_app_fusion.properties
new file mode 100644
index 00000000..ce9d57c3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_app_fusion.properties
@@ -0,0 +1,39 @@
+###
+# ================================================================================
+# eCOMP Portal SDK
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ================================================================================
+###
+temp_folder_path=/demeter/WebApps/dev/ECOMP_PORTAL/temp/
+upload_folder_path=/demeter/WebApps/dev/ECOMP_PORTAL/files/
+excel_template_path=/demeter/WebApps/dev/ECOMP_PORTAL/files/raptor_template/
+temp_folder_url=temp/
+upload_folder_url=upload/
+smtp_server=todo.smtp.com
+default_email_sender=email-name@email.com
+error_page=error_page.jsp
+jsp_context_path=raptor/
+img_folder_url=static/fusion/raptor/images/
+base_folder_url=static/fusion/raptor/
+direct_access_url=http://localhost:8080/quantum/raptor_email_attachment.htm?action=raptor&source_page=report_run&display_content=y
+#base_action_url=report.htm#/report_run/
+drill_action_url=report.htm#/report_run/c_master=
+base_action_url=report_wizard.htm?action=
+base_action_url_ng=report#/
+base_action_param=c_master=
+super_role_id=1
+admin_role_ids=1
+quick_links_menu_ids=HOME,CUSTOMER,REPORTS
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_db_fusion.properties b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_db_fusion.properties
new file mode 100644
index 00000000..8b987068
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_db_fusion.properties
@@ -0,0 +1,19 @@
+###
+# ================================================================================
+# eCOMP Portal SDK
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ================================================================================
+###
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_pdf.properties b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_pdf.properties
new file mode 100644
index 00000000..d98a47cd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_pdf.properties
@@ -0,0 +1,49 @@
+###
+# ================================================================================
+# eCOMP Portal SDK
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ================================================================================
+###
+## pdf file specific properties
+pdf_data_font_size=9
+pdf_data_font_family=Arial
+#reduce the font size from html config
+pdf_data_font_size_offset=2
+pdf_data_alternate_color=true
+#data row background(white), alternate(light light blue/gray)
+pdf_data_background_alternate_hex_code=#EDEDED
+pdf_data_default_background_hex_code=#FFFFFF
+#header font (white) background (gray)
+pdf_data_table_header_font_hex_code=#FFFFFF
+pdf_data_table_header_background_hex_code=#8A9BB3
+#footer header
+pdf_footer_font_size=9
+pdf_footer_font_family=Arial
+pdf_att_proprietary=Proprietary\nUse Pursuant to Company Instructions
+pdf_att_proprierary_font_size=7
+pdf_date_timezone=GMT
+pdf_date_pattern=MM/dd/yyyy hh:mm:ss a
+##page number position at 1 - footer middle, 0 -- header right, 2 - both
+pdf_page_number_position=1
+pdf_word_before_page_number=Page
+pdf_word_after_page_number=
+pdf_coverpage_firstcolumn_size=0.3
+pdf_image_auto_rotate=false
+display_create_owner_info=true
+#session_info=customer,customerId
+display_loginid_for_downloaded_by=false
+# please use false if you want landscape to be default.
+is_default_orientation_portrait=true
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/sql.properties b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/sql.properties
new file mode 100644
index 00000000..ac52f3c9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/sql.properties
@@ -0,0 +1,322 @@
+###
+# ================================================================================
+# eCOMP Portal SDK
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ================================================================================
+###
+#SQL Statements for PostgreSQL
+
+#ReportLoader.java
+
+load.custom.report.xml = SELECT cr.report_xml FROM cr_report cr WHERE rep_id=?
+
+# need to copy to oracle
+load.remoteDB.schema = SELECT 'local' SCHEMA_ID, 'local' SCHEMA_DESC, null DATASOURCE_TYPE FROM dual union SELECT a.SCHEMA_ID, a.SCHEMA_DESC, DATASOURCE_TYPE FROM SCHEMA_INFO a where schema_id <> 'local' order by schema_id
+load.remoteDB.schema.where = SELECT a.SCHEMA_ID, a.SCHEMA_DESC, DATASOURCE_TYPE FROM SCHEMA_INFO a where schema_id = '[schema_id]'
+#formfield rendering
+
+formfield.id.name.sql.prefix=SELECT id, name FROM (
+formfield.id.name.sql=SELECT id, name
+
+formfield.id.name.sql.suffix=
+
+report.security.create= SELECT coalesce(cr.owner_id, cr.create_id) AS owner_id, cr.create_id, DATE_FORMAT(cr.create_date, '%m/%d/%Y') create_date, maint_id, DATE_FORMAT(cr.maint_date, '%m/%d/%Y') update_date, cr.public_yn FROM cr_report cr WHERE cr.rep_id = [rw.getReportID()]
+
+db.update.report.xml = SELECT cr.rep_id, cr.report_xml FROM cr_report cr WHERE rep_id=? FOR UPDATE
+
+update.custom.report.rec = UPDATE cr_report SET title='[Utils.oracleSafe(rw.getReportName())]', descr='[Utils.oracleSafe(rw.getReportDescr())]', public_yn='[(rw.isPublic()]', menu_id='[rw.getMenuID()]', menu_approved_yn='[(rw.isMenuApproved()]', owner_id=[rw.getOwnerID()], maint_id=[rw.getUpdateID()], maint_date=STR_TO_DATE('[rw.getUpdateDate()]', '[Globals.getOracleTimeFormat()]'), dashboard_type_yn='[(rw.isDashboardType()]', dashboard_yn= '[(rw.getReportType().equals(AppConstants.RT_DASHBOARD)]' WHERE rep_id = [rw.getReportID()]
+
+is.report.already.scheduled = select rep_id from cr_report_schedule where rep_id = ?
+
+create.custom.report.rec = INSERT INTO cr_report(rep_id, title, descr, public_yn, menu_id, menu_approved_yn, report_xml, owner_id, create_id, create_date, maint_id, maint_date, dashboard_type_yn, dashboard_yn, folder_id) VALUES([rw.getReportID()], '[Utils.oracleSafe(rw.getReportName())]', '[Utils.oracleSafe(rw.getReportDescr())]', '[rw.isPublic()]', '[rw.getMenuID()]', '[rw.isMenuApproved()]', '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>', [rw.getOwnerID()], [rw.getCreateID()], STR_TO_DATE('[rw.getCreateDate()]', '[Globals.getOracleTimeFormat()]'), [rw.getUpdateID()], STR_TO_DATE('[rw.getUpdateDate()]', '[Globals.getOracleTimeFormat()]'), '[rw.isDashboardType()]', '[rw.getReportType().equals(AppConstants.RT_DASHBOARD)]',[rw.getFolderId()])
+
+get.user.report.names = SELECT cr.rep_id, cr.title FROM cr_report cr WHERE coalesce(cr.owner_id, cr.create_id) = [userID]
+
+get.report.owner.id = SELECT coalesce(cr.owner_id, cr.create_id) AS owner FROM cr_report cr WHERE rep_id = ?
+
+delete.report.record.log = DELETE FROM cr_report_log WHERE rep_id = [reportID]
+
+delete.report.record.users = DELETE FROM cr_report_schedule_users WHERE rep_id = [reportID]
+
+delete.report.record.schedule = DELETE FROM cr_report_schedule WHERE rep_id = [reportID]
+
+delete.report.record.access = DELETE FROM cr_report_access WHERE rep_id = [reportID]
+
+delete.report.record.email = DELETE FROM cr_report_email_sent_log WHERE rep_id = [reportID]
+
+delete.report.record.favorite = DELETE FROM cr_favorite_reports WHERE rep_id = [reportID]
+
+delete.report.record.report = DELETE FROM cr_report WHERE rep_id = [reportID]
+
+load.quick.links = select finalcr.rep_id, finalcr.title, finalcr.descr from (SELECT cr.rep_id, cr.title, cr.descr FROM (SELECT rep_id, MIN(read_only_yn) read_only_yn FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = [userID]) UNION ALL (SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN ([roleList.toString()]))) report_access GROUP BY rep_id) ra LEFT JOIN cr_report cr ON cr.rep_id = ra.rep_id WHERE cr.menu_id LIKE '%[nvls(menuId)]%' AND cr.menu_approved_yn = 'Y' AND (coalesce(cr.owner_id, cr.create_id) = [userID] OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL) UNION SELECT cr.rep_id, cr.title, cr.descr FROM cr_report cr WHERE cr.menu_id LIKE '%[nvls(menuId)]%' AND (coalesce(cr.owner_id, cr.create_id) = [userID] OR cr.public_yn = 'Y' or EXISTS (select * from fn_user_role where user_id=[userID] and role_id in (1)))) finalcr ORDER BY finalcr.title
+
+load.folder.reports = SELECT cr.rep_id, cr.rep_id report_id, concat([rep_title_sql] , (CASE WHEN cr.public_yn = 'Y' THEN '' ELSE '[PRIVATE_ICON]' END),cr.title,'</a>') title, cr.descr, concat(au.first_name,' ',au.last_name) owner_name, DATE_FORMAT(cr.create_date, '%m/%d/%Y') create_date, CASE WHEN coalesce(cr.owner_id, cr.create_id) = [userID] THEN 'N' ELSE coalesce(ra.read_only_yn, 'Y') END read_only_yn, CASE WHEN coalesce(cr.owner_id, cr.create_id) = [userID] THEN 'Y' ELSE 'N' END user_is_owner_yn FROM cr_report cr JOIN app_user au ON coalesce(cr.owner_id, cr.create_id) = au.user_id AND cr.folder_id= '[folderId]' LEFT JOIN (SELECT rep_id, MIN(read_only_yn) read_only_yn FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = [userID]) UNION ALL(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN ([roleList.toString()]))) report_access GROUP BY rep_id) ra ON cr.rep_id = ra.rep_id
+#If roleList.toString() is '' PostgreSQL returns an error - needs to be null instead of empty
+
+load.folder.reports.user = AND coalesce(cr.owner_id, cr.create_id) = [userID]
+
+load.folder.reports.publicsql = AND (coalesce(cr.owner_id, cr.create_id) = [userID] OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL)
+
+load.quick.download.links = SELECT a.file_name, b.title,DATE_FORMAT(a.dwnld_start_time, '%W %d-%m-%Y %H:%i:%s') as time, a.dwnld_start_time FROM cr_report_dwnld_log a, cr_report b where a.user_id = [userID] and a.rep_id = b.rep_id and (a.dwnld_start_time) >= STR_TO_DATE(DATE_FORMAT(now() - INTERVAL 1 DAY, '%m/%d/%Y'), '%m/%d/%Y') and a.record_ready_time is not null order by a.dwnld_start_time
+
+load.reports.to.schedule = SELECT cr.rep_id, Initcap(cr.title), cr.descr FROM cr_report cr LEFT OUTER JOIN (SELECT rep_id, MIN(read_only_yn) read_only_yn FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = [userID]) UNION ALL (SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN ([roleList.toString()]))) report_access GROUP BY rep_id) ra ON cr.rep_id = ra.rep_id AND (cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL or cr.owner_id = [userID] )ORDER BY Initcap(cr.title)
+
+load.reports.to.add.in.dashboard = SELECT cr.rep_id, cr.title, cr.descr FROM cr_report cr LEFT OUTER JOIN (SELECT rep_id, MIN(read_only_yn) read_only_yn FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = [userID]) UNION ALL (SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN ([roleList.toString()]))) report_access GROUP BY rep_id) ra ON cr.rep_id = ra.rep_id AND (coalesce(cr.owner_id, cr.create_id) = [userID] OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL) AND (cr.dashboard_yn = 'N' or cr.dashboard_yn is null) ORDER BY cr.title
+
+load.my.recent.links = select rep_id, title, descr, form_fields from ( select rep_id, title, descr, form_fields from (select cr.rep_id, cr.title, a.form_fields, cr.descr, a.log_time, a.user_id, a.action, a.action_value from cr_report_log a, cr_report cr where user_id = [userID] AND action = 'Report Execution Time' and a.rep_id = cr.rep_id order by log_time desc) AS x) AS y where LIMIT 1, 6
+
+create.report.log.entry = INSERT INTO cr_report_log (rep_id, log_time, user_id, action, action_value, form_fields) VALUES([reportID], now(), [userID], '[action]' , '[executionTime]', '[form_fields]')
+
+create.report.log.entry.exec.time = INSERT INTO cr_report_log (rep_id, log_time, user_id, action, action_value, form_fields) VALUES([reportID], NOW() + INTERVAL 1 SECOND, [userID], '[action]' , '[executionTime]', '[formFields]')
+
+clear.report.log.entries = DELETE FROM cr_report_log WHERE rep_id = ? and user_id = ?
+
+load.report.log.entries = SELECT x.log_time, x.user_id, (CASE WHEN x.action = 'Report Execution Time' THEN concat('<a href=\"[AppUtils.getRaptorActionURL()]report.run.container&c_master=',x.rep_id,'&',x.form_fields,'&fromReportLog=Y&display_content=Y&noFormFields=Y&refresh=Y\">',x.action,'</a>') ELSE x.action END) action, (CASE WHEN x.action = 'Report Execution Time' THEN action_value ELSE 'N/A' END) time_taken, (CASE WHEN x.action = 'Report Execution Time' THEN concat('<a href=\"[AppUtils.getRaptorActionURL()]report.run.container&c_master=',x.rep_id,'&',x.form_fields,'&fromReportLog=Y&display_content=Y&noFormFields=Y&refresh=Y\"><img src=\"[AppUtils.getImgFolderURL()]test_run.gif" width=\"12\" height=\"12\" border=0 alt=\"Run report\"/></a>') ELSE 'N/A' END) run_image, x.name FROM (SELECT rl.rep_id, DATE_FORMAT(rl.log_time, '%m/%d/%Y %h:%i:%s %p') log_time, rl.action_value, concat(fuser.last_name ,', ',fuser.first_name) name, rl.user_id, rl.action, rl.form_fields FROM cr_report_log rl, fn_user fuser WHERE rl.rep_id = [nvls(reportId)] and rl.action != 'Report Run' and fuser.user_id = rl.user_id ORDER BY rl.log_time DESC) x LIMIT 100
+
+does.user.can.schedule.report = select crs.sched_user_id, count(*) from cr_report_schedule crs where sched_user_id = [userId] group by crs.sched_user_id having count(*) >= [Globals.getScheduleLimit()]
+
+does.user.can.schedule = select crs.schedule_id from cr_report_schedule crs where schedule_id = [scheduleId]
+
+get.system.date.time = select DATE_FORMAT(now(),'%m/%d/%Y %H:%i:%s')
+
+get.next.day.date.time = select DATE_FORMAT(NOW() + INTERVAL 1 DAY,'%m/%d/%Y %H:%i:%s')
+
+get.next.fifteen.minutes.date.time = select DATE_FORMAT(NOW() + INTERVAL 15 MINUTES,'%m/%d/%Y %H:%i:%s')
+
+get.next.thirty.minutes.date.time = select DATE_FORMAT(NOW() + INTERVAL 30 MINUTES,'%m/%d/%Y %H:%i:%s')
+
+get.template.file = select template_file from cr_report_template_map where report_id = [reportId]
+
+load.pdf.img.lookup = select image_id, image_loc from cr_raptor_pdf_img
+
+load.action.img.lookup = select image_id, image_loc from cr_raptor_action_img
+
+
+#ActionHandler.java
+
+report.values.map.def.a = SELECT x FROM (SELECT DISTINCT
+
+report.values.map.def.b = TO_CHAR([colName], '[nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT)]')
+
+report.values.map.def.c = [colName]
+
+report.values.map.def.d = x FROM [rdef.getTableById(tableId).getTableName()] WHERE [colName] IS NOT NULL ORDER BY 1) xx LIMIT <= [Globals.getDefaultPageSize()]
+
+test.sched.cond.popup = SELECT 1 WHERE EXISTS ([sql])
+
+download.all.email.sent = Select user_id, rep_id from CR_REPORT_EMAIL_SENT_LOG where gen_key='[pdfAttachmentKey.trim()]' and log_id =[report_email_sent_log_id.trim()] and (now() - sent_date) < '1 day' limit 1
+
+download.all.gen.key = select schedule_id from cr_report_email_sent_log u where U.GEN_KEY = '[pdfAttachmentKey]'
+
+download.all.retrieve = SELECT au.user_id FROM (SELECT rs.schedule_id, rs.rep_id FROM cr_report_schedule rs WHERE rs.enabled_yn='Y' AND rs.run_date IS NOT NULL AND rs.schedule_id = [scheduleId]) x, cr_report r, app_user au WHERE x.rep_id = r.rep_id AND au.user_id IN (SELECT rsu.user_id FROM cr_report_schedule_users rsu WHERE rsu.schedule_id = x.schedule_id and rsu.schedule_id = [scheduleId] UNION SELECT ur.user_id FROM fn_user_role ur WHERE ur.role_id IN (SELECT rsu2.role_id FROM cr_report_schedule_users rsu2 WHERE rsu2.schedule_id = x.schedule_id and rsu2.schedule_id = [scheduleId]))
+
+download.all.insert = insert into cr_report_dwnld_log (user_id,rep_id,file_name,dwnld_start_time,filter_params) values (?,?,?,?,?)
+
+#ReportWrapper.java
+
+report.wrapper.format = SELECT coalesce(cr.owner_id, cr.create_id) owner_id, cr.create_id, DATE_FORMAT(cr.create_date, '[Globals.getOracleTimeFormat()]') create_date, maint_id, DATE_FORMAT(cr.maint_date, '[Globals.getOracleTimeFormat()]') update_date, cr.menu_id, cr.menu_approved_yn FROM cr_report cr WHERE cr.rep_id= [reportID]
+
+generate.subset.sql = SELECT [colNames.toString()] FROM (SELECT [colNames.toString()] FROM ([reportSQL]) AS x ) AS y
+
+report.sql.only.first.part = SELECT [colNames.toString()] FROM (SELECT [colNames.toString()] FROM (
+
+report.sql.only.second.part.a = [startRow]
+
+report.sql.only.second.part.b = [pageSize]
+#MYSQL: LIMIT [startRow], [pageSize]
+#ORacle: rownum >= [startRow] and rownum <= ([startRow]+[pageSize])
+#Postgre: limit [pageSize] offset [startRow]
+
+report.sql.only.second.part.b.noorderby = LIMIT [startRow]
+
+generate.sql.visual.select = SELECT
+
+generate.sql.visual.count = COUNT(*) cnt
+
+generate.sql.visual.dual =
+#No DUAL table in PostgreSQL so this is blank
+
+#ReportRuntime.java
+
+load.crosstab.report.data = SELECT [colNames.toString()] FROM ( [reportSQL]
+
+#RaptorRunHandler.java
+
+generate.sql.handler = SELECT x.* from ([sql]) AS x LIMIT 2
+
+generate.sql.select = SELECT [colNames.toString()] FROM (SELECT [colNames.toString()] FROM ([sql]) AS y) AS x
+
+#ReportSchedule.java
+
+load.schedule.data = SELECT rs.enabled_yn, DATE_FORMAT(rs.start_date, '%m/%d/%Y') start_date, DATE_FORMAT(rs.end_date, '%m/%d/%Y') end_date, DATE_FORMAT(rs.run_date, '%m/%d/%Y') run_date, coalesce(DATE_FORMAT(rs.run_date, '%h'), '12') run_hour, coalesce(DATE_FORMAT(rs.run_date, '%i'), '00') run_min, coalesce(DATE_FORMAT(rs.run_date, '%p'), 'AM') run_ampm, rs.recurrence, rs.conditional_yn, rs.notify_type, rs.max_row, rs.initial_formfields, rs.schedule_id, coalesce(DATE_FORMAT(rs.end_date, '%h'), '11') end_hour, coalesce(DATE_FORMAT(rs.end_date, '%i'), '45') end_min, coalesce(DATE_FORMAT(rs.end_date, '%p'), 'PM') end_ampm, encrypt_yn, attachment_yn FROM cr_report_schedule rs WHERE rs.rep_id = [reportID]
+
+load.schedule.getid = SELECT rsu.user_id, concat(fuser.last_name,', ',fuser.first_name), fuser.login_id FROM cr_report_schedule_users rsu, fn_user fuser WHERE rsu.rep_id = [reportID] AND rsu.schedule_id = [getScheduleID()] and rsu.user_id IS NOT NULL and rsu.user_id = fuser.user_id
+
+load.schedule.users = SELECT rsu.role_id FROM cr_report_schedule_users rsu WHERE rsu.rep_id = [reportID] AND rsu.schedule_id = [getScheduleID()] AND rsu.role_id IS NOT NULL
+
+new.schedule.data = select coalesce(max(schedule_id),0)+1 AS sequence from cr_report_schedule
+
+new.report.data = select coalesce(max(rep_id),0)+1 AS rep_id from cr_report
+
+execute.update = DELETE FROM cr_report_schedule_users WHERE rep_id = [reportID] and schedule_id = [getScheduleID()]
+
+execute.update.users = INSERT INTO cr_report_schedule_users (schedule_id, rep_id, user_id, role_id, order_no) VALUES([getScheduleID()], [reportID], [emailToUsers.get(i)).getId()], NULL, [(i + 1)])
+
+execute.update.roles = INSERT INTO cr_report_schedule_users (schedule_id, rep_id, user_id, role_id, order_no) VALUES([getScheduleID()], [reportID], NULL, [emailToRoles.get(i)).getId()], [((emailToUsers.size() + i + 1)])
+
+execute.update.activity = INSERT into cr_schedule_activity_log (schedule_id, notes, run_time) values ([getScheduleID()],'Submitted:Schedule',TO_DATE('[getRunDate()] [getRunHour()]:[getRunMin()] [getRunAMPM()]', 'MM/DD/YYYY HH:MI AM'))
+
+delete.schedule.data = SELECT 1 FROM cr_report_schedule WHERE rep_id = [reportID] and sched_user_id = [getScheduleUserID()] and schedule_id = [getScheduleID()]
+
+delete.schedule.data.users = DELETE FROM cr_report_schedule_users WHERE rep_id = [reportID] and schedule_id = [getScheduleID()]
+
+delete.schedule.data.id = DELETE FROM cr_report_schedule where rep_id = [reportID] and sched_user_id = [getScheduleUserID()] and schedule_id = [getScheduleID()]
+
+load.cond.sql = SELECT condition_large_sql FROM cr_report_schedule WHERE schedule_id=?
+
+load.cond.sql.select = SELECT condition_sql FROM cr_report_schedule WHERE schedule_id = [scheduleId]
+
+persist.cond.sql.update = update cr_report_schedule set condition_large_sql = '' where schedule_id = [scheduleId]
+#EMPTY CLOB() changed to ''
+
+persist.cond.sql.large = SELECT condition_large_sql FROM cr_report_schedule cr WHERE schedule_id=? FOR UPDATE
+
+persist.cond.sql.set = update cr_report_schedule set condition_sql = ? where schedule_id = [scheduleId]
+
+#DataCache.java
+
+get.data.view.actions = SELECT ts.web_view_action FROM cr_table_source ts WHERE ts.web_view_action IS NOT NULL
+
+get.public.report.id.names = SELECT rep_id, title FROM cr_report WHERE public_yn = 'Y' ORDER BY title
+
+get.private.accessible.names.a = SELECT cr.rep_id, cr.title FROM cr_report cr WHERE cr.rep_id not in (select rep_id from cr_report_access cra where user_id = '[user_id]'
+
+get.private.accessible.names.if = OR role_id in (
+
+get.private.accessible.names.b = ) AND public_yn = 'N' and cr.owner_id = '[user_id]' order by 2
+
+get.group.accessible.names.a = SELECT cr.rep_id, cr.title FROM cr_report cr WHERE cr.rep_id in (select rep_id from cr_report_access cra where user_id = '[user_id]'
+
+get.group.accessible.names.b = ) AND public_yn = 'N' order by 2
+
+get.report.table.sources.a = SELECT table_name, display_name, pk_fields, web_view_action, large_data_source_yn, filter_sql FROM cr_table_source
+
+get.report.table.sources.where = where SOURCE_DB= '[dBInfo]'
+
+get.report.table.sources.if = where SOURCE_DB is null or SOURCE_DB = '[AppConstants.DB_LOCAL]'
+
+get.report.table.sources.else = ORDER BY table_name
+
+grab.report.table.a = SELECT ts.table_name, ts.display_name, ts.pk_fields, ts.web_view_action, ts.large_data_source_yn, ts.filter_sql FROM cr_table_source ts WHERE
+
+grab.report.table.if = ts.SOURCE_DB= '[dBInfo]'
+
+grab.report.table.else = (ts.SOURCE_DB is null or ts.SOURCE_DB = '[AppConstants.DB_LOCAL]')
+
+grab.report.table.b = except SELECT ts.table_name, ts.display_name, ts.pk_fields, ts.web_view_action, ts.large_data_source_yn, ts.filter_sql from cr_table_source ts where table_name in (select table_name from cr_table_role where role_id not IN [sb.toString()]) and
+
+grab.report.table.c = ORDER BY 1
+
+get.report.table.crjoin = SELECT src_table_name, dest_table_name, join_expr FROM cr_table_join
+
+get.report.table.joins = SELECT tj.src_table_name, tj.dest_table_name, tj.join_expr FROM cr_table_join tj WHERE ((EXISTS (SELECT 1 FROM cr_table_role trs WHERE trs.table_name=tj.src_table_name AND trs.role_id IN [sb.toString()])) OR (NOT EXISTS (SELECT 1 FROM cr_table_role trs WHERE trs.table_name=tj.src_table_name))) AND ((EXISTS (SELECT 1 FROM cr_table_role trd WHERE trd.table_name=tj.dest_table_name AND trd.role_id IN [sb.toString()])) OR (NOT EXISTS (SELECT 1 FROM cr_table_role trd WHERE trd.table_name=tj.dest_table_name)))
+
+generate.report.table.col = SELECT a.table_name, a.column_name, a.data_type, a.label FROM user_column_def a WHERE a.table_name = '[tableName.toUpperCase()]' ORDER BY a.column_id
+
+generate.db.user.sql.a = SELECT utc.table_name, utc.column_name, utc.data_type,
+
+generate.db.user.sql.if = utc.column_name FROM user_tab_columns utc
+
+generate.db.user.sql.else = coalesce(x.label, utc.column_name) FROM user_tab_columns utc
+
+generate.db.user.sql.b = WHERE utc.table_name = '[tableName.toUpperCase()]'
+
+generate.db.user.sql.c = AND utc.table_name = x.table_name AND utc.column_name = x.column_name
+
+generate.db.user.sql.d = ORDER BY utc.column_id
+
+#SearchHandler.java
+
+load.report.search.result = SELECT cr.rep_id, cr.rep_id report_id, [rep_title_sql] title, cr.descr, concat(au.first_name,' ',au.last_name) owner_name, DATE_FORMAT(cr.create_date, '%m/%d/%Y') create_date, CASE WHEN coalesce(cr.owner_id, cr.create_id) = [userID] THEN 'N' ELSE coalesce(ra.read_only_yn, 'Y') END read_only_yn, CASE WHEN coalesce(cr.owner_id, cr.create_id) = [userID] THEN 'Y' ELSE 'N' END user_is_owner_yn, case when report_xml like '%<allowSchedule>N</allowSchedule>%' then 'N' when report_xml like '%<allowSchedule>Y</allowSchedule>%' or 1 = (select distinct 1 from cr_report_schedule where rep_id = cr.rep_id) then 'Y' else 'N' end FROM cr_report cr JOIN fn_user au ON coalesce (cr.owner_id, cr.create_id) = au.user_id [fReportID] [fReportName] LEFT JOIN(SELECT rep_id, MIN(read_only_yn) read_only_yn FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = [userID]) UNION ALL (SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN ([roleList.toString()]))) report_access GROUP BY rep_id) ra ON ra.rep_id = cr.rep_id
+
+load.report.search.instr = WHERE cr.menu_id LIKE '%[menuId]%'
+
+load.report.search.result.user = WHERE coalesce(cr.owner_id, cr.create_id) = [userID]
+
+load.report.search.result.public = WHERE (coalesce(cr.owner_id, cr.create_id) = [userID] OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL)
+
+load.report.search.result.fav = WHERE cr.rep_id in (select rep_id from cr_favorite_reports where user_id = [userID]
+
+load.report.search.result.sort = ORDER BY CASE coalesce(cr.owner_id, cr.create_id) WHEN [userID] THEN ' ' WHEN 'upper(concat(au.first_name,' ',au.last_name))' ELSE 'upper(cr.title)' END
+
+load.folder.report.result = SELECT cr.rep_id, cr.rep_id report_id, concat([rep_title_sql] , (CASE WHEN cr.public_yn = 'Y' THEN '' ELSE '[PRIVATE_ICON]' END),cr.title,'</a>') title, cr.descr, concat(au.first_name,' ',au.last_name) owner_name, TO_CHAR(cr.create_date, 'MM/DD/YYYY') create_date, CASE WHEN coalesce(cr.owner_id, cr.create_id) = [userID] THEN 'N' ELSE coalesce(ra.read_only_yn, 'Y') END read_only_yn, CASE WHEN coalesce(cr.owner_id, cr.create_id) = [userID] THEN 'Y' ELSE 'N' END user_is_owner_yn FROM cr_report cr JOIN fn_user au ON coalesce (cr.owner_id, cr.create_id) = au.user_id AND TO_CHAR(cr.rep_id, 'FM99999999') like coalesce('%[fReportID]%', TO_CHAR(cr.rep_id, 'FM99999999')) AND UPPER(cr.title) LIKE UPPER('%[fReportName]%') LEFT JOIN(SELECT rep_id, MIN(read_only_yn) read_only_yn FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = [userID]) UNION ALL (SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN ([roleList.toString()]))) report_access GROUP BY rep_id) ra ON ra.rep_id = cr.rep_id
+
+load.folder.report.result.sort = ORDER BY CASE coalesce(cr.owner_id, cr.create_id) WHEN [userID] THEN ' ' WHEN '(concat(au.first_name,' ',au.last_name))' ELSE 'cr.title' END
+
+#WizardProcessor.java
+
+process.filter.add.edit = '[argValue]'
+
+#ReportDefinition.java
+
+persist.report.adhoc = SELECT nextval('[Globals.getAdhocReportSequence()]') AS sequence
+
+#Globals.java
+
+initialize.roles = SELECT 1 WHERE EXISTS (SELECT 1 FROM cr_table_role)
+
+initialize.version = SELECT cr_raptor.get_version
+
+# scheduler
+
+
+scheduler.available.schedules = SELECT x.rep_id, x.schedule_id, x.conditional_yn, x.condition_large_sql, x.notify_type, x.max_row, x.initial_formfields, x.processed_formfields, r.title, x.user_id FROM ( SELECT rs.rep_id, rs.schedule_id, rs.sched_user_id user_id, rs.conditional_yn, rs.condition_large_sql, rs.notify_type, rs.max_row, rs.initial_formfields, rs.processed_formfields FROM cr_report_schedule rs WHERE rs.enabled_yn='Y' AND rs.start_date <= [currentDate] AND (rs.end_date >= [currentDate] or rs.end_date is null ) AND rs.run_date IS NOT NULL ) x, cr_report r WHERE x.rep_id = r.rep_id
+
+random.string = select ( concat('Z' , round(random() * 1000000000000) ) )
+
+
+scheduler.user.emails = SELECT au.user_id FROM (SELECT rs.schedule_id, rs.rep_id FROM cr_report_schedule rs WHERE rs.enabled_yn='Y' AND rs.start_date <= now() AND rs.end_date >= now() AND rs.run_date IS NOT NULL AND rs.schedule_id = [p_schedule_id] ) x, cr_report r, fn_user au WHERE x.rep_id = r.rep_id AND au.user_id IN (SELECT rsu.user_id FROM cr_report_schedule_users rsu WHERE rsu.schedule_id = x.schedule_id and rsu.schedule_id = [p_schedule_id] UNION SELECT ur.user_id FROM fn_user_role ur WHERE ur.role_id IN (SELECT rsu2.role_id FROM cr_report_schedule_users rsu2 WHERE rsu2.schedule_id = x.schedule_id and rsu2.schedule_id = [p_schedule_id]))
+
+
+# my logins
+
+app.query = SELECT APP_ID, ML_APP_NAME, MOTS_ID from fn_app
+
+user.log.query = SELECT DISTINCT IFNULL(SBCID, '') CUID, '' AWID, CONCAT('"',IFNULL(SBCID, ''),'"') APPLICATIONUSERID, CONCAT('"',IFNULL(FIRST_NAME, ''),'"') FIRST_NAME, CONCAT('"',substr(IFNULL(MIDDLE_NAME, ''), 0, 1),'"') MIDDLE_INITIAL, CONCAT('"',IFNULL(LAST_NAME, ''),'"') LAST_NAME, IFNULL(DATE_FORMAT(LAST_LOGIN_DATE, '%Y/%m/%d'), '') LAST_LOGON_DATE, DATE_FORMAT(CREATED_DATE, '%Y/%m/%d') ACCOUNT_ACTIVATION_DATE, IFNULL(DATE_FORMAT(MODIFIED_DATE, '%Y/%m/%d'), '') LAST_DATE_ACCOUNT_MODIFIED, '' LAST_PASSWORD_CHANGE_DATE, CONCAT('"',IFNULL(FIRST_NAME, ''),' ',IFNULL(MIDDLE_NAME, ''),' ',IFNULL(LAST_NAME, ''),'"') FULL_USER_NAME, '' NT_ID, IFNULL(EMAIL, '') EMAIL FROM FN_USER FU, FN_USER_ROLE FUR WHERE FU.USER_ID \= FUR.USER_ID and FUR.app_id \= ? and ACTIVE_YN \= 'Y' and sbcid is not null order by 1
+
+profile.log.query = SELECT DISTINCT CONCAT('"' , ROLE_NAME , '"') PROFILE_NAME, '""' SECURITY_SETTINGS FROM FN_ROLE FR, FN_USER_ROLE FUR WHERE FUR.ROLE_ID \= FR.ROLE_ID and FR.ACTIVE_YN \= 'Y' and ((FUR.APP_ID \= 1 and FR.ROLE_NAME <> 'Standard User') or (FUR.APP_ID \= ? and FUR.APP_ID <> 1)) ORDER BY 1
+
+user.profile.log.query = SELECT DISTINCT IFNULL(SBCID, '') CUID, '' AWID, CONCAT('"' , IFNULL(SBCID, '') , '"') APPLICATIONUSERID , CONCAT('"' , ROLE_NAME , '"') PROFILE_NAME FROM FN_USER A, FN_USER_ROLE B, FN_ROLE C WHERE A.USER_ID \= B.USER_ID AND B.ROLE_ID \= C.ROLE_ID AND A.ACTIVE_YN \= 'Y' AND C.ACTIVE_YN \= 'Y' AND a.sbcid is not null AND ((B.APP_ID \= 1 and C.ROLE_NAME <> 'Standard User') or (B.APP_ID \= ? and B.APP_ID <> 1)) ORDER BY 1
+
+all.accounts.log.query = SELECT DISTINCT IFNULL(SBCID, '') CUID, (case when A.ACTIVE_YN\='Y' then 'ACTIVE' else 'INACTIVE' end) ACTIVE_YN, CONCAT('"' , IFNULL(SBCID, '') , '"') APPLICATIONUSERID , IFNULL(DATE_FORMAT(LAST_LOGIN_DATE, '%Y/%m/%d'), '') LAST_LOGON_DATE, '' LAST_PASSWORD_CHANGE_DATE, CONCAT('"' , ROLE_NAME , '"') PROFILE_NAME FROM FN_USER A, FN_USER_ROLE B, FN_ROLE C WHERE A.USER_ID \= B.USER_ID AND B.ROLE_ID \= C.ROLE_ID AND a.sbcid is not null AND ((B.APP_ID \= 1 and C.ROLE_NAME <> 'Standard User') or (B.APP_ID \= ? and B.APP_ID <> 1)) ORDER BY 1
+
+# basic sql
+
+seq.next.val = SELECT nextval('[sequenceName]') AS id
+
+current.date = now()
+
+nvl = IFNULL
+
+# report security
+report.user.access = SELECT ra.role_id, ra.user_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.rep_id = [reportID]
+add.user.access = INSERT INTO cr_report_access (rep_id, order_no, role_id, user_id, read_only_yn) VALUES([reportID], IFNULL((select order_no from (SELECT MAX(order_no) AS order_no FROM cr_report_access WHERE rep_id=[reportID]) AS temp), 0)+1, NULL, [userID], '[readOnlyAccess]')
+update.user.access = UPDATE cr_report_access SET read_only_yn='[readOnlyAccess]' WHERE rep_id=[reportID] AND user_id=[userID]
+remove.user.access = DELETE FROM cr_report_access WHERE rep_id=[reportID] AND user_id=[userID]
+add.role.access = INSERT INTO cr_report_access (rep_id, order_no, role_id, user_id, read_only_yn) VALUES([reportID], IFNULL((select order_no from (SELECT MAX(order_no) AS order_no FROM cr_report_access WHERE rep_id=[reportID]) AS temp), 0)+1, [roleID], NULL, '[readOnlyAccess]')
+update.role.access = UPDATE cr_report_access SET read_only_yn='[readOnlyAccess]' WHERE rep_id=[reportID] AND role_id=[roleID]
+remove.role.access = DELETE FROM cr_report_access WHERE rep_id=[reportID] AND role_id=[roleID]
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/system.properties b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/system.properties
new file mode 100644
index 00000000..84e641b7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/system.properties
@@ -0,0 +1,86 @@
+###
+# ================================================================================
+# eCOMP Portal SDK
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ================================================================================
+###
+# Properties read by ECOMP Core library, ecompSDK-core.jar
+
+##########################################################################
+# The following properties should NOT be changed by partner applications.
+##########################################################################
+
+application_user_id = 30000
+post_default_role_id = 16
+clustered = true
+
+#Enable Fusion Mobile capabilities for the application
+mobile_enable = false
+
+# Cache config file is needed on the classpath
+cache_config_file_path = /WEB-INF/classes/cache.ccf
+cache_switch = 199
+cache_load_on_startup = false
+
+user_name = fullName
+decryption_key = AGLDdG4D04BKm2IxIWEr8o==
+
+##########################################################################
+# The following properties MAY require changes by partner applications.
+##########################################################################
+
+#Mysql
+db.driver = com.mysql.jdbc.Driver
+db.connectionURL = jdbc:mysql://localhost:3306/ecomp_sdk_os
+db.userName = xxxx
+db.password = xxxxxxxx
+db.min_pool_size = 5
+db.max_pool_size = 10
+hb.dialect = org.hibernate.dialect.MySQLDialect
+# SQL statements are logged to stdout
+hb.show_sql = true
+hb.idle_connection_test_period = 3600
+
+app_display_name = Demo App
+files_path = /tmp
+
+#element map files
+element_map_file_path = /tmp
+element_map_icon_path = app/fusionapp/icons/
+
+#Cron Schedules
+log_cron = 0 0/1 * * * ?;
+mylogins_feed_cron = 0 0/60 * * * ?;
+#sessiontimeout_feed_cron = 0 * * * * ? *
+my_login_feed_output_dir = /tmp/MyLogins
+
+# ECOMP Portal Shared Context REST API URL
+ecomp_shared_context_rest_url= http://todo_enter_be_hostname:9000/ecompportal/context
+# Link shown in Help menu
+contact_us_link = https://todo_contact_us_link.com
+
+# An Unique 128-bit value defined to identify a specific version
+# of an application deployed on a specific virtual machine.
+# This value must be generated and updated by the application
+# which is using the ECOMP SDK at the time of its deployment.
+# Online Unique UUID generator - https://www.uuidgenerator.net/
+instance_uuid=8da691c9-987d-43ed-a358-00ac2f35685d
+
+# R Cloud feature - configure this property to enable notebook feature - for more details on RCloud please visit https://rcloud.social/index.html
+guard_notebook_url=
+
+#authenticate user server
+authenticate_user_server=http://todo_enter_auth_server_hostname:8383/openid-connect-server-webapp/allUsers
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/defs/definitions.xml b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/defs/definitions.xml
new file mode 100644
index 00000000..6c582777
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/defs/definitions.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE tiles-definitions PUBLIC
+ "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
+ "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
+
+<!-- This tiles definitions file is defs/definitions.xml. It maps
+ tokens used by example SDK-app controllers to JSP file paths.
+ Applications that use JSP pages should modify this file. -->
+
+<tiles-definitions>
+
+ <definition extends="ebz_template" name="leafletMap">
+ <put-attribute name="body" value="/WEB-INF/jsp/leafletMap.jsp"></put-attribute>
+ </definition>
+
+ <definition name="drools"
+ template="/app/fusionapp/drools/view-models/droolsSinglePage.html" />
+
+ <definition name="single_page_sample"
+ template="/app/fusionapp/scripts/view-models/singlePageSample.html" />
+
+</tiles-definitions>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/conf/fusion.properties b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/conf/fusion.properties
new file mode 100644
index 00000000..b2cef9f8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/conf/fusion.properties
@@ -0,0 +1,61 @@
+###
+# ================================================================================
+# eCOMP Portal SDK
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ================================================================================
+###
+
+
+# validator settings
+#default_error_message = Default error message
+
+#login message
+login.error.hrid.empty = Login failed, please contact system administrator.
+login.error.hrid.not-found = User not found, please contact system administrator.
+login.error.user.inactive = Account is disabled, please contact system administrator.
+
+authentication_mechanism = BOTH
+
+user_attribute_name = user
+
+# User Session settings
+#user_attribute_name = user
+roles_attribute_name = roles
+role_functions_attribute_name = role_functions
+#client_device_attribute_name = client_device
+#client_device_emulation = false
+
+
+# menu settings
+menu_query_name = menuData
+#menu_properties_file_location = /WEB-INF/fusion/menu/
+application_menu_set_name = APP
+application_menu_attribute_name = applicationMenuData
+#application_menu_properties_name = menu.properties
+business_direct_menu_set_name = BD
+#business_direct_menu_properties_name = bd.menu.properties
+business_direct_menu_attribute_name = businessDirectMenuData
+
+# RAPTOR config settings
+#raptor_config_file_path = /WEB-INF/conf/
+
+# Role settings
+sys_admin_role_id = 1
+#sys_admin_role_function_delete_from_ui = true
+
+# Profile Search settings
+#profile_search_report_id=181
+#callable_profile_search_report_id=386
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/defs/definitions.xml b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/defs/definitions.xml
new file mode 100644
index 00000000..fb18cb79
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/defs/definitions.xml
@@ -0,0 +1,240 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE tiles-definitions PUBLIC
+ "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
+ "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
+
+<!-- This tiles definitions file is fusion/defs/definitions.xml. It maps
+ tokens used by SDK-core controllers to JSP file paths. To minimize upgrade
+ effort, this file should not be changed by on-boarding applications. -->
+
+<tiles-definitions>
+
+ <definition name="ebz_template" template="/WEB-INF/fusion/jsp/ebz_template.jsp">
+ <put-attribute name="title" value=""></put-attribute>
+ <put-attribute name="header"
+ value="/WEB-INF/fusion/jsp/ebz/ebz_header.jsp"></put-attribute>
+ <put-attribute name="body" value=""></put-attribute>
+ <put-attribute name="footer"
+ value="/WEB-INF/fusion/jsp/ebz/ebz_footer.jsp"></put-attribute>
+ </definition>
+
+ <definition name="ebz_template_noheader_nofooter"
+ template="/WEB-INF/fusion/jsp/ebz_template_noheader_nofooter.jsp">
+ <put-attribute name="body" value=""></put-attribute>
+ </definition>
+
+ <definition name="ebz_template_report_embedded"
+ template="/WEB-INF/fusion/jsp/ebz_template_report_embedded.jsp">
+ <put-attribute name="body" value=""></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="es_search_demo">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/es_search_demo.jsp"></put-attribute>
+ <put-attribute name="viewName" value="elastic_search"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="es_suggest_demo">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/es_suggest_demo.jsp"></put-attribute>
+ <put-attribute name="viewName" value="elastic_search"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="user_profile">
+ <put-attribute name="body" value="/WEB-INF/jsp/user_profile.jsp"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="profile_search">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/profile_search.jsp"></put-attribute>
+ <put-attribute name="viewName" value="profile_search"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="profile">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/profile.jsp"></put-attribute>
+ <put-attribute name="viewName" value="profile"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="menu">
+ <put-attribute name="body" value="/WEB-INF/jsp/menu.jsp"></put-attribute>
+ <put-attribute name="viewName" value="menu"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="welcome">
+ <put-attribute name="body" value="/WEB-INF/jsp/welcome.jsp"></put-attribute>
+ <put-attribute name="viewName" value="welcome"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="role_list">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/role_list.jsp"></put-attribute>
+ <put-attribute name="viewName" value="role_list"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="role">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/role.jsp"></put-attribute>
+ <put-attribute name="viewName" value="role"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="role_function_list">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/role_function_list.jsp"></put-attribute>
+ <put-attribute name="viewName" value="role_function_list"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="post_search">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/post_search.jsp"></put-attribute>
+ <put-attribute name="viewName" value="post_search"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="error">
+ <put-attribute name="body" value="/WEB-INF/jsp/error.jsp"></put-attribute>
+ <put-attribute name="viewName" value="error"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="collaborate_list">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/collaborateList.jsp"></put-attribute>
+ </definition>
+
+ <!-- <definition extends="ebz_template" name="notebook">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/notebook.jsp"></put-attribute>
+ </definition> -->
+
+ <definition name="notebook"
+ template="app/fusion/notebook-integration/scripts/view-models/notebook.htm" />
+
+
+ <definition name="nbooktest"
+ template="app/fusion/notebook-integration/scripts/view-models/notebook-frame.html"/>
+
+
+ <definition extends="ebz_template" name="jcs_admin">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/jcs_admin.jsp"></put-attribute>
+ <put-attribute name="viewName" value="jcs_admin"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="usage_list">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/usage_list.jsp"></put-attribute>
+ <put-attribute name="viewName" value="usage_list"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="broadcast_list">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/broadcast_list.jsp"></put-attribute>
+ <put-attribute name="viewName" value="broadcast_list"></put-attribute>
+ </definition>
+ <definition extends="ebz_template" name="broadcast">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/broadcast.jsp"></put-attribute>
+ <put-attribute name="viewName" value="broadcast"></put-attribute>
+ </definition>
+
+
+ <definition extends="ebz_template" name="chart_wizard">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/chart_wizard.jsp"></put-attribute>
+ <put-attribute name="viewName" value="chart_wizard"></put-attribute>
+ </definition>
+
+ <!-- <definition extends="ebz_template_noheader_nofooter" name="collaboration">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/webrtc/collaboration.jsp"></put-attribute>
+ </definition> -->
+ <definition name="collaboration"
+ template="/WEB-INF/fusion/jsp/webrtc/collaboration.jsp" />
+ <definition name="user_profile_list"
+ template="/app/fusion/scripts/view-models/admin-page/profile.html" />
+ <definition name="admin"
+ template="/app/fusion/scripts/view-models/admin-page/admin.html" />
+ <definition name="workflows"
+ template="/app/fusion/scripts/view-models/workflows/workflow-landing.html" />
+
+ <definition extends="ebz_template" name="report_wizard">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/report_wizard.jsp"></put-attribute>
+ <put-attribute name="viewName" value="report_wizard"></put-attribute>
+ </definition>
+ <definition extends="ebz_template" name="wizard_schedule_only">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/wizard_schedule_only.jsp"></put-attribute>
+ <put-attribute name="viewName" value="wizard_schedule_only"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="report_import">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/report_import.jsp"></put-attribute>
+ <put-attribute name="viewName" value="report_import"></put-attribute>
+ </definition>
+
+
+ <definition extends="ebz_template" name="report">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/report_ebz.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_report_embedded" name="report_embedded">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/report_ebz.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template" name="report_sample">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/report_sample.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="test_run_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/test_run_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="date_start_field_run_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/date_start_field_run_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="date_end_field_run_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/date_end_field_run_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="test_field_run_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/test_field_run_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="default_field_run_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/default_field_run_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="popup_testrun_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/popup_testrun_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="popup_semaphore">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/popup_semaphore.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="popup_import_semaphore">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/popup_import_semaphore.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="popup_table_cols">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/popup_table_cols.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="popup_drill_down_report">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/popup_drill_down_report.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="popup_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/popup_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template" name="error_page">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/error_page.jsp"></put-attribute>
+ </definition>
+ <definition name="data_out" template="/WEB-INF/fusion/jsp/data_out.jsp" />
+
+ <definition extends="ebz_template" name="frame_insert">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/frame_insert.jsp"></put-attribute>
+ </definition>
+
+ <!-- <definition name="test_field_run_sql" template="/WEB-INF/fusion/raptor/test_field_run_sql.jsp"/>
+ <definition name="popup_testrun_sql" template="/WEB-INF/fusion/raptor/popup_testrun_sql.jsp"/> -->
+
+</tiles-definitions>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/.gitignore b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/.gitignore
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/broadcast.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/broadcast.jsp
new file mode 100644
index 00000000..d4e7810c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/broadcast.jsp
@@ -0,0 +1,137 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.core.web.support.UserUtils" %>
+<%@ page import="org.openecomp.portalsdk.core.web.support.ControllerProperties" %>
+<%@ page import="org.openecomp.portalsdk.core.util.SystemProperties" %>
+
+<%-- <%@ include file="/WEB-INF/fusion/jsp/include.jsp" %> --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+<link rel="stylesheet" type="text/css" href="static/fusion/css/jquery-ui.css">
+
+ <c:set var="clustered" value="<%=(\"true\".equals(SystemProperties.getProperty(SystemProperties.CLUSTERED)))%>"/>
+
+ <script src="static/fusion/js/moment.min.js"></script>
+
+ <div class="pageTitle">
+ <h3>
+ <c:choose>
+ <c:when test="${!empty param.message_id}">
+ <h1 class="heading1" style="margin-top:20px;">Broadcast Message Edit</h1>
+ </c:when>
+ <c:otherwise>
+ <h1 class="heading1" style="margin-top:20px;">Broadcast Message Create</h1>
+ </c:otherwise>
+ </c:choose>
+ </h3>
+ </div>
+
+<div ng-controller="broadcastController" >
+ Please edit the broadcast message details below:&nbsp;<br><br>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Message Text:</label><BR>
+ <textarea name="comment" ng-model="broadcastMessage.messageText" rows="5" cols="200" style="height:100px"></textarea>
+ </div>
+ <br>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Start Date:</label><BR>
+ <input style="display:none" name="startDateHidden" ng-model="broadcastMessage.startDate">
+ <input type="text" class="fn-ebz-text" id="startDatepicker" />
+ </div>
+
+ <div class="fn-ebz-container" style="margin-left:3em" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>End Date:</label><BR>
+ <input style="display:none" name="endDateHidden" ng-model="broadcastMessage.endDate">
+ <input type="text" class="fn-ebz-text" id="endDatepicker" />
+ </div>
+
+ <div class="fn-ebz-container" style="margin-left:3em" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Sort Order:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="broadcastMessage.sortOrder"
+ maxlength="30" />
+ </div>
+
+ <c:if test="${clustered}">
+ <div class="fn-ebz-container" style="margin-left:1em" >
+ <label class="fn-ebz-text-label">Server:</label><BR>
+ <div class="form-field" att-select="broadcastSites" ng-model="broadcastMessage.siteCd"></div>
+ </div>
+ </c:if>
+ <br>
+ <div align="left" >
+ <button type="submit" ng-click="save();" att-button
+ btn-type="primary" size="small">Save</button>
+ </div>
+</div>
+<script>
+app.controller('broadcastController', function ($scope, modalService, $modal){
+ $scope.broadcastMessage=${broadcastMessage};
+ $scope.broadcastSites=${broadcastSites};
+ console.log($scope.broadcastMessage);
+
+ $scope.save = function() {
+ var uuu = "broadcast/save";
+ var postData={broadcastMessage: $scope.broadcastMessage};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ //console.log(data);
+ window.location.href = "broadcast_list";
+ },
+ error : function(data){
+ alert("Error while saving.");
+ }
+ });
+ };
+
+ $(function() {
+ $( "#startDatepicker" ).datepicker();
+ $( "#endDatepicker" ).datepicker();
+
+ var startDateLong = $scope.broadcastMessage.startDate;
+ var tempStartDate = new Date(startDateLong);
+ tempStartDate = moment(tempStartDate).format('MM/DD/YY');//03 Jun 2013 04:15PM EDT
+ console.log(tempStartDate.toString());
+ $( "#startDatepicker" ).val(tempStartDate.toString());
+
+ var endDateLong = $scope.broadcastMessage.endDate;
+ var tempendDate = new Date(endDateLong);
+ tempendDate = moment(tempendDate).format('MM/DD/YY');//03 Jun 2013 04:15PM EDT
+ console.log(tempendDate.toString());
+ $( "#endDatepicker" ).val(tempendDate.toString());
+
+ $( "#startDatepicker" ).change(function() {
+ var tempStartDate = moment($( "#startDatepicker" ).val()).format('YYYY-MM-DD hh:mm:ss.S');
+ $scope.broadcastMessage.startDate = new Date(tempStartDate.toString());
+ });
+ $( "#endDatepicker" ).change(function() {
+ var tempEndDate = moment($( "#endDatepicker" ).val()).format('YYYY-MM-DD hh:mm:ss.S');
+ $scope.broadcastMessage.endDate = new Date(tempEndDate.toString());
+ });
+ });
+});
+
+
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/broadcast_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/broadcast_list.jsp
new file mode 100644
index 00000000..2f6c68b5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/broadcast_list.jsp
@@ -0,0 +1,201 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+<%@ page import="com.fasterxml.jackson.databind.ObjectMapper" %>
+<%@ page import="org.json.JSONObject" %>
+<%@ page import="java.io.StringWriter" %>
+<%@ page import="org.openecomp.portalsdk.core.web.support.ControllerProperties" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+
+ <script src="static/fusion/raptor/dy3/js/moment.min.js"></script>
+ <script>
+ function editMessage(messageLocationId, messageLocation, messageId) {
+ window.location='broadcast.htm?message_location_id='+messageLocationId + '&message_location=' + messageLocation + ((messageId != null) ? '&message_id=' + messageId : '');
+ }
+ </script>
+
+ <div class="pageTitle">
+ <h3>
+ Broadcast Messages
+ </h3>
+ </div>
+
+ <%-- Display a table for the broadcast messages of each message location --%>
+<div ng-controller="broadcastListController" >
+
+ <div ng-repeat="location in messageLocations" >
+ {{location.label}} Messages
+ <div title="{{location.label}} Messages" >
+
+ <table att-table table-data="location.messages" current-page="1">
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" width="10%">No.</th>
+ <th att-table-header sortable="false" width="30%">Message Text</th>
+ <th att-table-header sortable="false" width="10%">Start Date</th>
+ <th att-table-header sortable="false" width="10%">End Date</th>
+ <th att-table-header sortable="false" width="10%">Sort Order</th>
+ <th att-table-header sortable="false" width="10%">Server</th>
+ <th att-table-header sortable="false" width="10%">Active?</th>
+ <th att-table-header sortable="false" width="10%">Delete?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="message in location.messages" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr>
+ {{message.id}}
+ <td width="10%"><a href="javascript:editMessage({{location.value}},'{{location.label}}',{{message.id}});">{{$index+1}}</a></td>
+ <td width="30%">{{message.messageText}}</td>
+ <td width="10%">
+ {{message.displayStartDate}}
+ </td>
+ <td width="10%">{{message.displayEndDate}}</td>
+ <td width="10%">{{message.sortOrder}}</td>
+ <td width="10%">{{message.siteCd}}</td>
+ <td width="10%">
+ <div ng-click="toggleActive(message);">
+ <input type="checkbox" ng-model="message.active" att-toggle-main>
+ </div>
+ </td>
+ <td att-table-body width="10%">
+ <div ng-click="remove(message);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+ </div>
+ <input att-button btn-type="primary" size="small" class="button" type="button" value="Add" ng-click="editMessage(location);"/>
+ <br/><br/><br/>
+ </div>
+</div>
+
+<script>
+app.controller('broadcastListController', function ($scope){
+ //$scope.model.messagesList=${model.messagesList};
+ var messagesMap = {};
+ <%
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap hmMessages = new HashMap();
+
+ HashMap objModel = (HashMap)request.getAttribute("model");
+
+ Object objMessages = objModel.get("messagesList");
+ //System.out.println("messagesList: "+objMessages);
+ if((objMessages!=null) && (objMessages instanceof HashMap))
+ {
+ hmMessages= (HashMap)objMessages;
+ Iterator it = hmMessages.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry pair = (Map.Entry)it.next();
+ //System.out.println(pair.getKey() + " = " + pair.getValue());
+ String pairValue = mapper.writeValueAsString(pair.getValue());
+ //System.out.println(pairValue);
+ %>
+ messagesMap['<%=pair.getKey()%>'] = '<%=pairValue%>'
+ <%
+ }
+ }
+
+ Object messageLocationsObject = objModel.get("messageLocations");
+ //System.out.println("messageLocations: "+messageLocationsObject);
+ String messageLocationsString = mapper.writeValueAsString(messageLocationsObject);
+ //System.out.println(messageLocationsString);
+ %>
+ $scope.messagesList=messagesMap;
+ $scope.messageLocations=<%=messageLocationsString%>;
+ console.log($scope.messageLocations);
+
+ $.each($scope.messageLocations, function(i, a){
+ //var result = [];
+ angular.forEach($scope.messagesList, function(value, key) {
+ if (key+'' === a.value+'') {
+ var objsJSON = JSON.parse(value);
+
+ $.each(objsJSON, function(i, a){
+ var startDateLong = a.startDate;
+ var tempStartDate = new Date(startDateLong);
+ tempStartDate = moment(tempStartDate).format('DD MMM YYYY');//03 Jun 2013 04:15PM EDT - 'DD MMM YYYY hh:mmA zz'
+ a.displayStartDate=tempStartDate.toString();
+
+ var endDateLong = a.endDate;
+ var tempEndDate = new Date(endDateLong);
+ tempEndDate = moment(tempEndDate).format('DD MMM YYYY');//03 Jun 2013 04:15PM EDT
+ a.displayEndDate=tempEndDate.toString();
+ });
+ a.messages = objsJSON;
+ }
+ });
+ console.log(a.messages);
+ });
+ ;
+
+ $scope.editMessage = function(location) {
+ editMessage(location.value, location.label);
+ };
+
+ $scope.toggleActive = function(broadcastMessage) {
+
+ //alert('deleted'+role.name);
+ var uuu = "broadcast_list/toggleActive";
+ var postData={broadcastMessage:broadcastMessage};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ //window.location.reload();
+ },
+ error : function(data){
+ console.log(data);
+ alert("Error while toggling: "+ data.responseText);
+ }
+ });
+
+
+ };
+
+ $scope.remove = function(broadcastMessage) {
+
+ //alert('deleted'+role.name);
+ var uuu = "broadcast_list/remove";
+ var postData={broadcastMessage:broadcastMessage};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ window.location.reload();
+ },
+ error : function(data){
+ console.log(data);
+ alert("Error while deleting: "+ data.responseText);
+ }
+ });
+
+
+ };
+});
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/collaborateList.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/collaborateList.jsp
new file mode 100644
index 00000000..b1fbfab1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/collaborateList.jsp
@@ -0,0 +1,146 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
+<div>
+<a href="JavaScript:void(0);" style= "color:#00547A" onClick="downloadScreenCaptureExtenstion()" id="install-button">
+ Please download the extension for ScreenCapture and refresh page</a>
+ </div>
+<div ng-controller="collaborateListController" id="collaborate_ctrl">
+ <div>
+ <h1 class="heading1" style="margin-top:20px;">User List</h1>
+ <div style="margin-top:30px">
+ <table att-table table-data="tableData" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header key="id">User ID</th>
+ <th att-table-header key="lastName">Last Name</th>
+ <th att-table-header key="firstName">First Name</th>
+ <th att-table-header key="email">Email</th>
+ <th att-table-header key="orgUserId">UserId</th>
+ <th att-table-header key="online" default-sort="d">Online/Offline</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="rowData in tableData">
+ <tr>
+ <td att-table-body ng-bind="rowData['id']"></td>
+ <td att-table-body ng-bind="rowData['lastName']"></td>
+ <td att-table-body ng-bind="rowData['firstName']"></td>
+ <td att-table-body ng-bind="rowData['email']"></td>
+ <td att-table-body ng-bind="rowData['orgUserId']"></td>
+ <td att-table-body >
+ <tag-badges ng-hide="rowData.online" style-type="color" class="lred" ng-click="rowData.isActive=true;openCollaboration(rowData.chatId)">Offline</tag-badges>
+ <tag-badges ng-show="rowData.online" style-type="color" class="lgreen" ng-click="rowData.isActive=false;openCollaboration(rowData.chatId)">Online</tag-badges>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <div class="fn-ebz-container">
+ Rows Per Page:
+ <input class="fn-ebz-text" type="text" ng-model="viewPerPage" size="5" style="width: 47px;">
+ </div>
+ <div class="fn-ebz-container">
+ Current Page:
+ <input class="fn-ebz-text" type="text" ng-model="currentPage" size="5" style="width: 47px;">
+ </div>
+ <div class="fn-ebz-container">
+ Total Page(s):
+ <input class="fn-ebz-text" type="text" ng-model="totalPage" size="5" readonly="true" style="width: 47px;">
+ </div>
+
+
+</div>
+
+
+<!-- handling websocket peer broadcast session -->
+ <script type="text/javascript" src="app/fusion/scripts/socket/peerBroadcast.js"></script>
+ <script type="text/javascript" src="app/fusion/external/utils/js/browserCheck.js"></script>
+ <script>
+
+ var initialPageVisit = "${sessionScope.initialPageVisit}";
+ var userId = "${sessionScope.user.orgUserId}";
+ socketSetup(initialPageVisit, userId, null, "socketSend");
+
+
+ </script>
+
+<script>
+var popupModalService;
+app.controller("collaborateListController", function ($scope,$http,modalService, $modal) {
+ // Table Data
+ $scope.tableData=${model.profileList};
+ $scope.viewPerPage = 20;
+ $scope.scrollViewsPerPage = 2;
+ $scope.currentPage = 1;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+ popupModalService = modalService;
+ setPopupService(modalService);
+ /* modalService.showSuccess('','Modal Sample') ; */
+ for(x in $scope.tableData){
+ if($scope.tableData[x].active_yn=='Y')
+ $scope.tableData[x].active_yn=true;
+ else
+ $scope.tableData[x].active_yn=false;
+ }
+ $scope.openCollaboration = function(chatId){
+ openInNewTab('collaboration?chat_id=' + chatId);
+
+ }
+
+ $scope.toggleProfileActive = function(profileId) {
+ if (confirm("You are about to change user's active status. Do you want to continue?")) {
+ $http.get("profile/toggleProfileActive?profile_id="+profileId).success(function(){});
+ }
+ };
+
+});
+
+function openInNewTab(url) {
+
+ //popupModalService.popupConfirmWin("Confirm","");
+ var win = window.open(url, '_blank');
+ win.popupService = popupModalService;
+ win.focus();
+};
+
+function downloadScreenCaptureExtenstion() {
+
+ var chromeURL = 'https://chrome.google.com/webstore/detail/icgmlogfeajbfdffajhoebcfbibfhaen';
+ var firefoxURL = 'https://addons.mozilla.org/en-US/firefox/addon/screen-capturing-capability';
+ var url;
+
+ if(isChrome)
+ url = chromeURL;
+ else if(isFirefox)
+ url = firefoxURL;
+
+ var win = window.open(url);
+ win.focus();
+};
+
+</script>
+
+
+
+ <div id="peerBroadcastSection"> </div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/data_out.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/data_out.jsp
new file mode 100644
index 00000000..f3fb7a74
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/data_out.jsp
@@ -0,0 +1,20 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+${model.output_string}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_footer.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_footer.jsp
new file mode 100644
index 00000000..5a33314f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_footer.jsp
@@ -0,0 +1,46 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+<script src="app/fusion/external/ebz/js/footer.js"></script>
+<link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/footer.css" >
+
+
+
+<div class="footerContainer" id="footerContainer">
+ <div class="footerWrapper" id="footerWrapper">
+
+ <div class="footerItem">
+
+ </div>
+ <div class="attFooterInfo">
+ <div class="footerLastSection">
+ <div id="attFooterLogo" class="attLogo" tabindex='0'></div>
+
+ <br>
+ <div class="privacyPolicy">
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp
new file mode 100644
index 00000000..05c07f0d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp
@@ -0,0 +1,799 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
+<%@ page isELIgnored="false"%>
+<%@ page import="org.openecomp.portalsdk.core.util.SystemProperties"%>
+<%@ page import="org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties"%>
+<%@ page import="org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants"%>
+<%@ page import="org.openecomp.portalsdk.core.domain.MenuData"%>
+<link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/header.css">
+<link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/portal_ebz_header.css">
+<link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css" >
+
+<!-- Icons -->
+<link rel="stylesheet" type="text/css" href="app/fusion/external/ionicons-2.0.1/css/ionicons.css" />
+<script src= "app/fusion/external/ebz/angular_js/angular.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/angular-route.min.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/angular-sanitize.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/angular-cookies.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/app.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/gestures.js"></script>
+<script src="static/js/jquery-1.10.2.js"></script>
+<script src="app/fusion/scripts/modalService.js"></script>
+<script src="static/js/jquery.mask.min.js" type="text/javascript"></script>
+<script src="static/js/jquery-ui.js" type="text/javascript"></script>
+<script src="app/fusion/external/ebz/sandbox/att-abs-tpls.js" type="text/javascript"></script>
+<script src="static/fusion/js/att_angular_gridster/ui-gridster-tpls.js"></script>
+<script src="static/fusion/js/att_angular_gridster/angular-gridster.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/checklist-model.js"></script>
+<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/0.10.0/lodash.min.js"></script>
+<script src="app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js"></script>
+<script src="app/fusion/scripts/services/userInfoService.js"></script>
+<script src="app/fusion/scripts/services/leftMenuService.js"></script>
+
+
+<jsp:include page="/WEB-INF/fusion/jsp/ebz/loginSnippet.html" ></jsp:include>
+
+<c:set var="UserName" value="<%= session.getAttribute(\"fullName\")%>" />
+<c:set var="UserFirstName" value="<%= session.getAttribute(\"first_name\")%>" />
+
+<%
+ String contactUsLink = SystemProperties.getProperty(SystemProperties.CONTACT_US_LINK);
+ String redirectUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL);
+ String portalUrl = redirectUrl.substring(0, redirectUrl.lastIndexOf('/')) + "/processSingleSignOn";
+ String getAccessLink = redirectUrl.substring(0, redirectUrl.lastIndexOf('/')) + "/get_access";
+%>
+<c:set var="returnPortalUrl" value="<%=portalUrl%>" />
+<c:set var="contactUsLink" value="<%=contactUsLink%>" />
+<c:set var="getAccessLink" value="<%=getAccessLink%>" />
+<style>
+.att-drawer{
+ z-index:997 !important;
+}
+
+.secondaryMenuContainer{
+ z-index:1000;
+}
+.megamenu-tabs .megamenu__item {
+ padding: 0 0;
+}
+.megamenu-tabs .megamenu__item span {
+ font-size: 18px;
+}
+
+.submenu-tabs {
+ line-height:50px;
+}
+.submenu-tabs .sub__menu{
+ top:54px;
+}
+
+.top-megamenu .megamenu-tabs ul{
+ width:98%;
+ list-style: none;
+}
+
+</style>
+<%@include file="/WEB-INF/fusion/jsp/ebz/loginSnippet.html" %>
+
+<div style="position: relative; z-index: 999;">
+ <div ng-controller="headerController">
+
+ <div class="headerContainer" id="headerContainer" ng-cloak ng-show="{{showHeader}}">
+ <div id="megaMenuContainer" class="megaMenuContainer" style="margin-top: 0; overflow: visible;">
+ <div>
+ <!--for mega Menu-->
+ <!-- Mega Menu parent-tab directive with three models menu-items, active-sub-menu, active-menu -->
+ <div id="topMenu" class="top-megamenu" ng-mouseleave="activeClickSubMenu.x.active=false; activeClickMenu.x.active=false">
+ <div style="float:left;width:100%;"parent-tab menu-items="megaMenuDataObject" active-sub-menu='activeClickSubMenu.x' active-menu='activeClickMenu.x'>
+ <div parentmenu-tabs mega-menu="true" menu-items="megaMenuDataObject" style="height:55px;">
+ <div style="float:left">
+ <li class="megamenu__item" style="line-height:55px;" onclick="returnToPortal()">
+
+<!-- <a id='returnPortal' class="primaryMenuOptionLink" style="font-weight: 400 !important; font-family: Arial !important; font-size: 18px;">ECOMP</a>
+ --> <strong style="font-weight: 400 !important; font-family: Arial !important; font-size: 18px;" id='returnPortal' >ECOMP Portal</strong>
+ </li>
+ <div menu-tabs mega-menu="true" tab-name="item.text" menu-item="item" active-menu="activeClickMenu.x"
+ ng-repeat="item in megaMenuDataObject" style="font-size: 18px;" ng-mousedown="loadFavorites()" >
+ <div parentmenu-tabs sub-menu="true" ng-show="activeClickMenu.x.active && item.active" menu-items="activeClickMenu.x.children">
+ <!-- Second level menu -->
+ <div>
+ <div menu-tabs sub-menu="true" tab-name="subItem.text"
+ tab-url="subItem.url" menu-item="subItem"
+ ng-repeat="subItem in activeClickMenu.x.children | orderBy : 'column'" active-menu="activeClickSubMenu.x"
+ sub-item-active="{{subItem.active}}" style="float:left;" aria-label="{{subItem.text}}"
+ ng-mouseenter="submenuLevelAction(subItem.text,subItem.column)"
+ ng-mouseleave="submenuLevelAction(subItem.text,subItem.column)"
+ ng-click="submenuLevelAction(subItem.text,subItem.column)" >
+ <i ng-if="subItem.text=='Favorites'" id="favorite-star"
+ class="icon-star favorites-icon-active">
+ </i>
+ </div>
+
+ <div class="sub__menu" ng-mouseleave="activeClickSubMenu.x.active=false" >
+ <ul ng-show="activeClickSubMenu.x.active" role="menubar" class="columns">
+ <!-- Third level menu -->
+ <div menu-tabs menu-item="subItem"
+ class="columns-div"
+ ng-repeat="subItem in activeClickSubMenu.x.children | orderBy : 'column'"
+ ng-show="activeClickSubMenu.x.active">
+
+ <i id="favorite-selector-third-level"
+ ng-show="isUrlFavorite(subItem.menuId)==false"
+ class="icon-star favorites-icon-inactive"
+ ng-if="subItem.url.length > 1">
+ </i>
+ <i id="favorite-selector-third-level"
+ ng-show="isUrlFavorite(subItem.menuId)"
+ class="icon-star favorites-icon-active"
+ ng-if="subItem.url.length > 1">
+ </i>
+ <span class="title" aria-label="{{subItem.text}}"
+ ng-click="goToUrl(subItem)">{{subItem.text}}</span>
+ <!-- Fourth level menus -->
+ <div att-links-list="">
+ <i id="favorite-selector-fourth-level"
+ class="icon-star favorites-icon-inactive"
+ ng-show="isUrlFavorite(tabValue.menuId)==false"
+ ng-if="tabValue.url.length > 1">
+
+ </i>
+ <i id="favorite-selector-fourth-level"
+ class="icon-star favorites-icon-active"
+ ng-show="isUrlFavorite(tabValue.menuId)"
+ ng-if="tabValue.url.length > 1">
+
+ </i>
+ <span role="menuitem" att-links-list-item=""
+ ng-repeat="tabValue in subItem.children"
+ ng-click="goToUrl(tabValue)"
+ att-accessibility-click="13,32"
+ ng-class="{'disabled': tabValue.disabled}">{{tabValue.text}}</span>
+ </div>
+ <hr ng-show="!$last"/>
+
+ </div>
+ </ul>
+ <!-- Favorites level menu -->
+ <div class="favorites-window" ng-show='favoritesWindow' ng-mouseleave="hideFavoritesWindow()">
+ <div id="favorites-menu-items" ng-show="showFavorites">
+ <div ng-repeat="subItem in favoritesMenuItems" att-links-list="" style='display: inline'>
+ <i id="favorite-selector-favorites-list" class="icon-star favorites-icon-active">
+ </i>
+ <a id="favorites-list" aria-label="{{subItem.text}}"
+ ng-click="goToUrl(subItem)"
+ style="margin-left: 3px; margin-right: 20px; text-decoration: none; color: #666666;">
+ {{subItem.text}}
+ </a>
+ </div>
+ <div>
+ <br>
+ <p style='font-weight: 400; font-family: Arial !important;
+ font-size: 18px; text-align: center; background-color: lightgray;
+ width: 400px; margin-left: 25%; margin-right: 25%;'>
+ Manage favorites on ECOMP Portal.
+ </p>
+ </div>
+ </div>
+ <!-- Favorites when empty -->
+ <div id="favorites-empty" ng-show='favoritesWindow' ng-show="emptyFavorites">
+ <div id="favorites-empty" ng-show="emptyFavorites" class="favorites-window-empty">
+ <div>
+ <img src="app/fusion/external/ebz/images/no_favorites_star.png">
+ <p class='favoritesLargeText'>No Favorites</p>
+ <p class='favoritesNormalText'>Manage favorites on ECOMP Portal.</p>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ </div>
+ </div >
+ <li class="megamenu__item" style="line-height:55px;" ng-if="loadMenufail">
+ <strong style="font-weight: 400 !important; font-family: Arial !important; font-size: 18px;" >Unable to load menus</strong>
+ </li>
+<!-- <li class="megamenu__item" style="width: 20%;">&nbsp;</li>
+ --> </div>
+ <!-- Login Snippet-->
+ <div style="float:right">
+ <li id="bcLoginSnippet" class="megamenu__item" style="width: 140px;" >
+ <div popover="loginSnippet.html" aria-label="Login Snippet" referby="loginSnippet" att-accessibility-click="13,32" popover-style="\" popover-placement="below" style="width: 200px;">
+ <div class="ion-android-person login-snippet-icon" style="display:inline-block"></div>
+ <div class="login-snippet-text" style="display: inline-block; font-size:12px; margin-left:5px;overflow: hidden; max-height: 31px; max-width:120px; padding-top: 0px; margin-top: 0px; white-space: nowrap;" ng-bind="userProfile.firstName"></div>
+ </div>
+ </li>
+ <li class="megamenu__item" style="width:120px;">&nbsp;</li>
+ </div>
+
+ </div>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div style="position: relative; color: black; top: 70px;">
+ <div ng-cloak>
+ <span ng-style="adjustHLeftMenu('burgerIcon')" style="z-index:998; position:fixed; left:0%; font-size:35px; margin-left:10px;text-decoration:none;">
+ <a ng-click="toggleDrawer();isOpen = !isOpen" href="javascript:void(0);" class="arrow-icon-left" >
+ <span class="ion-navicon-round"></span></a>
+ <span ng-init="isOpen = true" ng-show="isOpen" style="font-size:16px; position:relative; top:-8px; left:-15px;">&nbsp&nbsp&nbsp {{app_name}}</span>
+ </span>
+ <div att-drawer drawer-slide="left" drawer-custom-top="{{drawer_custom_top}}px" drawer-size="200px" drawer-open="drawerOpen" drawer-custom-height="100%" >
+ <div ng-style="adjustHLeftMenu('leftMenu')">
+ <div class="attDrawer" style="margin-top:{{drawer_margin_top}}px;">
+ <div style="margin-left:10px; margin-right:10px;">
+ <accordion close-others="true" css="att-accordion--no-box">
+ <accordion-group ng-repeat="parent in menuItems" heading="{{parent.parentLabel}}" child="{{parent.parentAction}}" parent-link="{{parent.parentAction}}" image-source="{{parent.parentImageSrc}}" child-length="{{parent.childItemList.length}}" is-open="parent.open">
+ <div ng-repeat="subMenu in parent.childItemList" style="font-size:12px; margin-left:10px;">
+ <a href="{{subMenu.action}}" style="font-size:12px; color:#666666;" >{{subMenu.label}}</a>
+ </div>
+ </accordion-group>
+ </accordion>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+<script>
+ function returnToPortal(){
+ window.location.href = "<c:out value='${returnPortalUrl}'/>";
+ }
+ detectScrollEvent = function() {
+ var footerOff = $('#footerContainer').offset().top;
+ var headOff = $('#headerContainer').offset().top;
+ var winHeight = $(window).height();
+ if ((footerOff - headOff) <= winHeight) {
+ $('.att-drawer').css({
+ "height" : footerOff - headOff - 55
+ });
+ } else {
+ $('.att-drawer').css({
+ "height" : "94vh"
+ });
+ }
+ }
+ $(window).scroll(function() {
+ if ($('.att-drawer').is(':visible')) {
+ detectScrollEvent();
+ }
+ });
+ app.controller("headerController", function($scope, $timeout, $log, $http, UserInfoService, $window, $cookies,LeftMenuService) {
+ $log.debug('HeaderController started');
+ $scope.jsonMenuData = [];
+ $scope.loadMenufail=false;
+ $scope.app_name = "";
+ $scope.app_name_full = "";
+ $scope.megaMenuDataObject =[];
+ $scope.activeClickSubMenu = {
+ x: ''
+ };
+ $scope.activeClickMenu = {
+ x: ''
+ };
+ $scope.favoritesMenuItems = [];
+ $scope.favoriteItemsCount = 0;
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = false;
+ $scope.favoritesWindow = false;
+ $scope.userProfile={
+ firstName:'',
+ lastName:'',
+ fullName:'',
+ email:''
+ }
+ /*Put user info into fields*/
+ $scope.inputUserInfo = function(userInfo){
+ if (typeof(userInfo) != "undefined" && userInfo!=null && userInfo!=''){
+ if (typeof(userInfo.USER_FIRST_NAME) != "undefined" && userInfo.USER_FIRST_NAME!=null && userInfo.USER_FIRST_NAME!='')
+ $scope.userProfile.firstName = userInfo.USER_FIRST_NAME;
+ if (typeof(userInfo.USER_LAST_NAME) != "undefined" && userInfo.USER_LAST_NAME!=null && userInfo.USER_LAST_NAME!='')
+ $scope.userProfile.lastName = userInfo.USER_LAST_NAME;
+ if (typeof(userInfo.USER_EMAIL) != "undefined" && userInfo.USER_EMAIL!=null && userInfo.USER_EMAIL!='')
+ $scope.userProfile.email = userInfo.USER_EMAIL;
+ }
+ }
+ /*getting user info from session*/
+ $scope.getUserNameFromSession = function(){
+ UserInfoService.getFunctionalMenuStaticDetailSession()
+ .then(function (res) {
+ $scope.userProfile.firstName = res.firstName;
+ $scope.redirectUrl = res.portalUrl;
+ });
+ }
+ $scope.getTopMenuStaticInfo=function() {
+ var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext();
+ promise.then(
+ function(res) {
+ if(res==null || res==''){
+ $log.info('failed getting static User information');
+ $scope.getUserNameFromSession();
+ }else{
+ $log.info('Received static User information');
+ var resData = res;
+ $scope.inputUserInfo(resData);
+ $scope.userProfile.fullName = $scope.userProfile.firstName+ ' '+ $scope.userProfile.lastName;
+ }
+ },
+ function(err) {
+ $log.info('failed getting static User information');
+ }
+ );
+ }
+
+ var unflatten = function( array, parent, tree ){
+ tree = typeof tree !== 'undefined' ? tree : [];
+ parent = typeof parent !== 'undefined' ? parent : { menuId: null };
+ var children = _.filter( array, function(child){ return child.parentMenuId == parent.menuId; });
+
+ if( !_.isEmpty( children ) ){
+ if( parent.menuId === null ){
+ tree = children;
+ }else{
+ parent['children'] = children
+ }
+ _.each( children, function( child ){ unflatten( array, child ) } );
+ }
+
+ return tree;
+ }
+
+ var menuStructureConvert = function(menuItems) {
+ var megaMenuDataObjectTemp = [
+ {
+ text: "ECOMP",
+ children:menuItems
+ },
+ {
+ text: "Help",
+ children: [{
+ text:"Contact Us",
+ url:"<c:out value='${contactUsLink}'/>"
+ },
+ {
+ text:"Get Access",
+ url:"<c:out value='${getAccessLink}'/>"
+ }]
+ }
+ ];
+ return megaMenuDataObjectTemp;
+ };
+
+
+ /*Left Menu*/
+ LeftMenuService.getAppName().then(function(response){
+ var j = response;
+ try{
+ if(j && j !== "null" && j!== "undefined"){
+ console.log("app name is " + $scope.app_name);
+ $scope.app_name_full = j.data;
+ var processed_app_name = j.data;
+ var n = processed_app_name.length;
+ if (n > 15) {
+ n = 15;
+ }
+ $scope.app_name = processed_app_name.substr(0, n);
+ }else{
+ throw "Get app_name respsone is not an object/is empty";
+ }
+ }catch (e) {
+ console.log("error happened while trying to get app name "+e);
+ return;
+ }
+ },function(error){
+ console.log("error happened while calling getAppName "+error);
+ });
+
+ $scope.getTopMenuStaticInfo();
+ $scope.getMenu=function() {
+
+ $http({
+ method: "GET",
+ url: 'get_functional_menu',
+// TIMEOUT USED FOR LOCAL TESTING ONLY
+// timeout: 100
+ }).success(function (response) {
+ if(response == '101: Timeout') {
+ $log.error('Timeout attempting to get_functional_menu');
+ // TIMEOUT USED FOR LOCAL TESTING ONLY
+// $scope.createErrorMenu();
+ $scope.megaMenuDataObject = menuStructureConvert('');
+ }else {
+ $log.debug('get_functional_menu success: ' + response);
+ if(typeof response != 'undefined' && response.length!=0 && typeof response[0] != 'undefined' && typeof response[0].error!="undefined"){
+// createErrorMenu() USED FOR LOCAL TESTING ONLY
+// $scope.createErrorMenu();
+ $scope.megaMenuDataObject = menuStructureConvert('');
+ // $scope.loadMenufail=true;
+ }else{
+ $scope.jsonMenuData = unflatten( response );
+ $scope.megaMenuDataObject = menuStructureConvert($scope.jsonMenuData);
+ }
+ }
+ }).error(function (response){
+// createErrorMenu() USED FOR LOCAL TESTING ONLY
+// $scope.createErrorMenu();
+
+ //$scope.loadMenufail=true;
+ $scope.megaMenuDataObject = menuStructureConvert('');
+ $log.debug('REST API failed get_functional_menu...'+ response);
+ });
+ }
+ $scope.adjustHLeftMenu = function (type){
+ $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
+
+ if($scope.showHeader == true) {
+ $scope.drawer_margin_top = 60;
+ $scope.drawer_custom_top = 54;
+ $scope.toggle_drawer_top = 55;
+ }
+ else {
+
+ $scope.drawer_margin_top = 50;
+ $scope.drawer_custom_top = 0;
+ $scope.toggle_drawer_top = 10;
+ }
+ if(type=='burgerIcon'){
+ return { "top": $scope.toggle_drawer_top+"px"};
+ }else if(type=='leftMenu'){
+ return { "margin-top": $scope.drawer_margin_top+"px"};
+ }else
+ return;
+ }
+ $scope.adjustHeader=function() {
+ $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
+
+ if($scope.showHeader == true) {
+ $scope.drawer_margin_top = 50;
+ $scope.drawer_custom_top = 54;
+ $scope.toggle_drawer_top = 55;
+ }
+ else {
+
+ $scope.drawer_margin_top = 40;
+ $scope.drawer_custom_top = 0;
+ $scope.toggle_drawer_top = 10;
+ }
+
+
+ }
+
+
+ //$scope.getMenu();
+ $scope.adjustHeader();
+
+
+ /* **************************************************************************/
+ /* Logic for the favorite menus is here */
+
+ $scope.loadFavorites = function () {
+ $log.debug('loadFavorites has happened.');
+ if ($scope.favoritesMenuItems == '') {
+ $scope.generateFavoriteItems();
+ $log.debug('loadFavorites is calling generateFavoriteItems()');
+ } else {
+ $log.debug('loadFavorites is NOT calling generateFavoriteItems()');
+ }
+ }
+
+ $scope.goToUrl = function (item) {
+ $log.info("goToUrl called")
+ $log.info(item);
+
+ var url = item.url;
+ var restrictedApp = item.restrictedApp;
+ $log.debug('Restricted app status is: ' + restrictedApp);
+ if (!url) {
+ $log.info('No url found for this application, doing nothing..');
+ return;
+ }
+ if (restrictedApp) {
+ $window.open(url, '_blank');
+ } else {
+ $window.open(url, '_self');
+ }
+
+ }
+
+ $scope.submenuLevelAction = function(index, column) {
+ if ($scope.favoritesMenuItems == '') {
+ $scope.generateFavoriteItems();
+ $log.debug('submenuLevelAction is calling generateFavoriteItems()');
+ }
+ $log.debug('item hovered/clicked: ' + index + '; column = ' + column);
+ if (column == 2) { // 2 is Design
+ $scope.favoritesWindow = false;
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = false;
+ }
+ if (index=='Favorites' && $scope.favoriteItemsCount != 0) {
+ $log.debug('Showing Favorites window');
+ $scope.favoritesWindow = true;
+ $scope.showFavorites = true;
+ $scope.emptyFavorites = false;
+ }
+ if (index=='Favorites' && $scope.favoriteItemsCount == 0) {
+ $log.debug('Hiding Favorites window in favor of No Favorites Window');
+ $scope.favoritesWindow = true;
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = true;
+ }
+ if (column > 2) {
+ $scope.favoritesWindow = false;
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = false;
+ }
+ };
+
+ $scope.hideFavoritesWindow = function() {
+ $log.debug('$scope.hideFavoritesWindow has been called');
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = false;
+ }
+
+ $scope.isUrlFavorite = function (menuId) {
+// $log.debug('array objects in menu favorites = ' + $scope.favoriteItemsCount + '; menuId=' + menuId);
+ var jsonMenu = JSON.stringify($scope.favoritesMenuItems);
+ var isMenuFavorite = jsonMenu.indexOf('menuId\":' + menuId);
+ if (isMenuFavorite==-1) {
+ return false;
+ } else {
+ return true;
+ }
+
+ }
+
+ $scope.generateFavoriteItems = function() {
+ $http({
+ method: "GET",
+ url: 'get_favorites',
+ // TIMEOUT USED FOR LOCAL TESTING ONLY
+// timeout: 100
+ }).success(function (response) {
+ if (response == '101: Timeout') {
+ $log.error('Timeout attempting to get_favorites_menu');
+ } else {
+ if(typeof response != 'undefined' && response.length!=0 && typeof response[0] != 'undefined' && typeof response[0].error!="undefined"){
+ $log.error('REST API failed get_favorites' + response);
+ }else{
+ $log.debug('get_favorites = ' + JSON.stringify(response));
+ $scope.favoritesMenuItems = response;
+ $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length;
+ $log.info('number of favorite menus: ' + $scope.favoriteItemsCount);
+ }
+ }
+ }).error(function (response){
+ $log.error('REST API failed get_favorites' + response);
+
+ });
+ }
+
+ $scope.createFavoriteErrorMenu=function() {
+ $scope.favoritesMenuItems = [
+
+ ];
+ $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length;
+ $log.info('number of favorite menus: ' + $scope.favoriteItemsCount);
+ }
+
+ /* end of Favorite Menu code */
+ /* **************************************************************************/
+
+
+ /* **************************************************************************/
+ // THIS IS USED FOR LOCAL TESTING ONLY
+ /* **************************************************************************/
+
+ $scope.createErrorMenu=function() {
+ $scope.jsonMenuData = [
+ {
+ "menuId": 1,
+ "column": 2,
+ "text": "Design",
+ "parentMenuId": null,
+ "url": ""
+ },
+ {
+ "menuId": 2,
+ "column": 3,
+ "text": "Infrastructure Ordering",
+ "parentMenuId": null,
+ "url": ""
+ },
+ {
+ "menuId": 3,
+ "column": 4,
+ "text": "Service Creation",
+ "parentMenuId": null,
+ "url": ""
+ },
+ {
+ "menuId": 4,
+ "column": 5,
+ "text": "Service Mgmt",
+ "parentMenuId": null,
+ "url": ""
+ },
+ {
+ "menuId": 90,
+ "column": 1,
+ "text": "Google",
+ "parentMenuId": 1,
+ "url": "http://google.com"
+ },
+ {
+ "menuId": 91,
+ "column": 1,
+ "text": "Mike Little's Coffee Cup",
+ "parentMenuId": 2,
+ "url": "http://coffee.com"
+ },
+ {
+ "menuId": 92,
+ "column": 2,
+ "text": "Andy and his Astrophotgraphy",
+ "parentMenuId": 3,
+ "url": "http://nightskypix.com"
+ },
+ {
+ "menuId": 93,
+ "column": 1,
+ "text": "JSONLint",
+ "parentMenuId": 4,
+ "url": "http://http://jsonlint.com"
+ },
+ {
+ "menuId": 94,
+ "column": 2,
+ "text": "HROneStop",
+ "parentMenuId": 4,
+ "url": ""
+ },
+ {
+ "menuId": 95,
+ "column": 2,
+ "text": "4th Level App4a R16",
+ "parentMenuId": 4,
+ "url": ""
+ },
+ {
+ "menuId": 96,
+ "column": 3,
+ "text": "3rd Level App1c R200",
+ "parentMenuId": 4,
+ "url": "http://app1c.com"
+ },
+ {
+ "menuId": 97,
+ "column": 1,
+ "text": "3rd Level App4b R16",
+ "parentMenuId": 5,
+ "url": "http://app4b.com"
+ },
+ {
+ "menuId": 98,
+ "column": 2,
+ "text": "3rd Level App2b R16",
+ "parentMenuId": 5,
+ "url": "http://app2b.com"
+ },
+ {
+ "menuId": 99,
+ "column": 1,
+ "text": "Favorites",
+ "parentMenuId": null,
+ "url": ""
+ }
+ ];
+ $scope.jsonMenuData = unflatten( $scope.jsonMenuData );
+ $scope.megaMenuDataObject = menuStructureConvert($scope.jsonMenuData);
+// $log.debug(JSON.stringify($scope.jsonMenuData));
+ }
+ var childItemList="";
+ var parentList = "";
+ try{
+ childItemList = ${menu.childItemList};
+ parentList = ${menu.parentList};
+ }catch(err){
+ console.log("error while getting left menu");
+ }
+
+ var pageUrl = window.location.href.split('/')[window.location.href.split('/').length-1];
+
+ $scope.menuItems = [];
+ for (var i = 0; i < parentList.length; i++) {
+ $scope.openCurrentMenu = false;
+ if(pageUrl==parentList[i].action)
+ $scope.openCurrentMenu = true;
+ $scope.childItemList = childItemList[i];
+ for(chIndex in $scope.childItemList){
+ if($scope.childItemList.length>0)
+ if($scope.childItemList[chIndex].action!=null){
+ if($scope.childItemList[chIndex].action==pageUrl)
+ $scope.openCurrentMenu = true;
+ }
+ }
+ $scope.item = {
+ parentLabel : parentList[i].label,
+ parentAction : parentList[i].action,
+ parentImageSrc : parentList[i].imageSrc,
+ open:$scope.openCurrentMenu,
+ childItemList : $scope.childItemList
+ }
+ $scope.menuItems.push($scope.item);
+ }
+ $scope.arrowShow = true;
+ $scope.drawerOpen = false;
+ $scope.subMenuContent = false;
+ $scope.toggleSubMenu = function() {
+ $scope.subMenuContent = !$scope.subMenuContent;
+ };
+
+ var drawerOpen = 'open';
+ if (drawerOpen == 'open') {
+ $scope.drawerOpen = true;
+ $scope.arrowShow = true;
+ } else {
+ $scope.arrowShow = false;
+ }
+ $scope.arrowShow = true;
+ $scope.drawerOpen = false;
+ $scope.toggleDrawer = function() {
+ $scope.drawerOpen = !($scope.drawerOpen);
+ if ($scope.drawerOpen) {
+ $scope.arrowShow = true;
+ if (document.getElementById('mContent')!=null)
+ document.getElementById('mContent').style.marginLeft = "210px";
+ } else {
+ $scope.arrowShow = false;
+ if (document.getElementById('mContent')!=null)
+ document.getElementById('mContent').style.marginLeft = "50px";
+ }
+ };
+ //var drawerOpen = getCookie('drawerOpen');
+ if (drawerOpen == 'open') {
+ $scope.drawerOpen = true;
+ $scope.arrowShow = true;
+ } else {
+ $scope.arrowShow = false;
+ }
+ $timeout(function() {
+ detectScrollEvent();
+ }, 800);
+
+ });
+
+ app.filter("ellipsis", function(){
+ return function(text, length){
+ if (text) {
+ var ellipsis = text.length > length ? "..." : "";
+ return text.slice(0, length) + ellipsis;
+ };
+ return text;
+ }
+ });
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/loginSnippet.html b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/loginSnippet.html
new file mode 100644
index 00000000..0f29ee77
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/loginSnippet.html
@@ -0,0 +1,120 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<script type="text/ng-template" id="loginSnippet.html">
+ <div style="line-height: normal; right: 167px; min-height: 200px; height: auto; width: auto; " ng-controller="loginSnippetCtrl" >
+ <div id="reg-header-snippet">
+ <div class="reg-profilePicture" style="min-height: 215px; width: auto; " id="reg-profile-links">
+ <div id="reg-profileImage">
+ <div style="clear: both; height: 80px; position: relative; width: 80px;">
+
+ <span style=" background-position: -1px -1px; height: 81px;left: 0;position: absolute;top: 0;width: 81px;">&nbsp;</span>
+ </div>
+ </div>
+ <div id="reg-logout-div">
+ <a class="reg-logout-btn" href="logout.htm">Log Out</a>
+ </div>
+ </div>
+ <div tabindex="0" class="reg-profileDetails" id="reg-profiledetails-id">
+ <ul class="reg-Details-table" style="list-style: none;">
+ <li><div class="reg-userName-table"><div id="reg-userName-table-row"><div id="reg-userName-table-cell"><h3 class="att-global-fonts" id="reg-userName" ng-bind="userProfile.fullName"></h3><span class="visuallyhidden">.</span></div></div></div></li>
+ <li><div class="reg-userEmail-label"><span class="reg-userEmail-label-spn">EMAIL<span class="visuallyhidden">:</span></span></div></li>
+ <li><div class="reg-userEmail-value"><span class="reg-userEmail-value-spn" ng-bind="userProfile.email"><span class="visuallyhidden">.</span></span></div></li>
+ <li><div class="reg-userRole-label"><span class="reg-userRole-label-spn">User ID<span class="visuallyhidden">:</span></span></div></li>
+ <li><div class="reg-userRole-value"><span class="reg-userRole-value-spn" ng-bind="userProfile.orgUserId"><span class="visuallyhidden"></span></span></div></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="chat_box.html">
+
+ <div style="width: auto;">
+
+ <div style="font-size: 24px; font-family: omnes_attregular;line-height: 26px;color: #444444;text-align: center;">
+ <span>Live Chat</span>
+ </div>
+ <div style="line-height:15px; padding-left:20px; padding-right:20px;">
+ Chat is currently unavailable.<br><br>
+
+ </div>
+ </div>
+ </script>
+
+<script>
+var loginSnippetCtrl = function ($scope,$http, $log,UserInfoService){
+ /*Define fields*/
+ $scope.userProfile={
+ firstName:'',
+ lastName:'',
+ fullName:'',
+ email:''
+ }
+ /*Put user info into fields*/
+ $scope.inputUserInfo = function(userInfo){
+ if (typeof(userInfo) != "undefined" && userInfo!=null && userInfo!=''){
+ if (typeof(userInfo.USER_FIRST_NAME) != "undefined" && userInfo.USER_FIRST_NAME!=null && userInfo.USER_FIRST_NAME!='')
+ $scope.userProfile.firstName = userInfo.USER_FIRST_NAME;
+ if (typeof(userInfo.USER_LAST_NAME) != "undefined" && userInfo.USER_LAST_NAME!=null && userInfo.USER_LAST_NAME!='')
+ $scope.userProfile.lastName = userInfo.USER_LAST_NAME;
+ if (typeof(userInfo.USER_EMAIL) != "undefined" && userInfo.USER_EMAIL!=null && userInfo.USER_EMAIL!='')
+ $scope.userProfile.email = userInfo.USER_EMAIL;
+ if (typeof(userInfo.USER_ORGUSERID) != "undefined" && userInfo.USER_ORGUSERID!=null && userInfo.USER_ORGUSERID!='')
+ $scope.userProfile.orgUserId = userInfo.USER_ORGUSERID;
+ }
+ }
+ /*getting user info from session*/
+ $scope.getUserNameFromSession = function(){
+ UserInfoService.getFunctionalMenuStaticDetailSession()
+ .then(function (response) {
+ var j = response;
+ console.log(response);
+ $scope.userProfile.fullName = response.userName;
+ $scope.userProfile.orgUserId = response.orgUserId;
+ $scope.userProfile.email = response.email;
+ });
+ }
+ /*getting user info from shared context*/
+ $scope.getUserName=function() {
+ var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext();
+ promise.then(
+ function(res) {
+ if(res==null || res==''){
+ $log.info('Getting User information from session');
+ $scope.getUserNameFromSession();
+ }else{
+ $log.info('Received User information from shared context',res);
+ var resData = res;
+ $scope.inputUserInfo(resData);
+ $scope.userProfile.fullName = $scope.userProfile.firstName+ ' '+ $scope.userProfile.lastName;
+ }
+ },
+ function(err) {
+ console.log('error');
+ }
+ );
+ };
+ /*call the get user info function*/
+ try{
+ $scope.getUserName();
+ }catch(err){
+ $log.info('Error while getting User information',err);
+ }
+}
+ </script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template.jsp
new file mode 100644
index 00000000..59b61d19
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template.jsp
@@ -0,0 +1,45 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
+
+<!DOCTYPE html>
+<html ng-app="abs">
+ <head>
+ <%@ include file="/WEB-INF/fusion/jsp/meta.jsp" %>
+ <script src="static/js/jquery-1.10.2.js" type="text/javascript"></script>
+ </head>
+ <body class="templatebody" style="opacity: 1; background-color: rgb(242, 242, 242); padding: 0px;">
+ <div class="applicationWindow">
+ <div>
+ <tiles:insertAttribute name="header" />
+ </div>
+ <br>
+ <div class="content" id="mContent">
+ <div class="body-content-jsp">
+ <tiles:insertAttribute name="body" />
+ </div>
+ </div>
+ <br>
+ <div>
+ <tiles:insertAttribute name="footer" />
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_noheader_nofooter.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_noheader_nofooter.jsp
new file mode 100644
index 00000000..98dccb4c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_noheader_nofooter.jsp
@@ -0,0 +1,35 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
+<!DOCTYPE html>
+<html>
+ <%@ include file="/WEB-INF/fusion/jsp/meta.jsp" %>
+ <body class="templatebody" style="opacity: 1; background-color: rgb(242, 242, 242); padding: 0px;">
+ <div class="applicationWindow">
+
+ <div class="content" style="margin-left:100px; margin-right:100px;">
+ <div>
+ <tiles:insertAttribute name="body" />
+ </div>
+ </div>
+
+ </div>
+ </body>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_report_embedded.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_report_embedded.jsp
new file mode 100644
index 00000000..4281a063
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_report_embedded.jsp
@@ -0,0 +1,48 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
+<!DOCTYPE html>
+<html ng-app="abs">
+ <%@ include file="/WEB-INF/fusion/jsp/meta.jsp" %>
+ <script src="static/js/jquery-1.10.2.js" type="text/javascript"></script>
+<script src= "app/fusion/external/ebz/angular_js/angular.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/angular-route.min.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/angular-sanitize.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/app.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/gestures.js"></script>
+<script src="static/js/jquery-1.10.2.js"></script>
+<script src="static/js/modalService.js"></script>
+<script src="static/js/jquery.mask.min.js" type="text/javascript"></script>
+<script src="static/js/jquery-ui.js" type="text/javascript"></script>
+<script src="app/fusion/external/ebz/sandbox/att-abs-tpls.js" type="text/javascript"></script>
+<script src="static/fusion/js/att_angular_gridster/ui-gridster-tpls.js"></script>
+<script src="static/fusion/js/att_angular_gridster/angular-gridster.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/checklist-model.js"></script>
+<script src="app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js"></script>
+
+
+ <body class="templatebody" style="opacity: 1; background-color: rgb(242, 242, 242); padding: 0px;">
+ <div class="applicationWindow">
+ <div class="content">
+ <tiles:insertAttribute name="body" />
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_search_demo.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_search_demo.jsp
new file mode 100644
index 00000000..eae5324b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_search_demo.jsp
@@ -0,0 +1,97 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<!-- <link rel="stylesheet" type="text/css" href="app/fusion/elasticsearch/styles/styles.css" > -->
+<script>
+app.controller('elasticSearchController',['$scope','$http',function ($scope,$http) {
+ $scope.submenuId = "";
+ $scope.isNew="";
+ $scope.viewPerPage = 20;
+ $scope.currentPage = 2;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+ $scope.tableData=[];
+ $scope.searchText='';
+ $scope.flagCount=0;
+ function escapeRegExp(str) {
+ return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|\&]/g, " ");
+ }
+ $scope.test = function(){
+ $scope.searchText=$scope.searchText;
+ var sendData ={
+ "data" : escapeRegExp($scope.searchText),
+ "size" : "100",
+ "fuzzy" : "true",
+ "resultname" : "custsuggest"
+ };
+
+ if($scope.flagCount<3 || $scope.searchText.length==0){
+ $scope.flagCount++;
+ $http.get('es_search/' + encodeURIComponent(JSON.stringify(sendData))).
+ then(function(response){
+ var data = JSON.parse(response.data.result);
+ $scope.tableData = data.hits.hits;
+ })
+ .catch(function(data,status){
+ console.log("Error: " + status + " : " + data);
+ })
+ .finally(function() {
+ $scope.flagCount--;
+ });
+ }
+ }
+ $scope.searchText='';
+}]);
+</script>
+
+<div style="margin-left:20px;" ng-app="eSearchApp">
+ <div style="margin-top:20px; margin-bottom:20px;"><span class="heading1">Elastic Search - </span><span class="heading2">Corporate Location Data System</span></div>
+ <div class="demoElas" ng-controller="elasticSearchController">
+ <div class="form-field" align="center">
+ <input type="text" placeholder="What are you looking for?" class="search__large-iconform" ng-model="searchText" ng-change="test()">
+ <i class="ion-search">&nbsp;</i>
+ </div>
+
+ <table att-table table-data="tableData" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header>Customer Name</th>
+ <th att-table-header>Phone</th>
+ <th att-table-header>Street</th>
+ <th att-table-header>City</th>
+ <th att-table-header>State</th>
+ <th att-table-header>ZIP</th>
+ <th att-table-header>CLLI</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="options in tableData">
+ <tr>
+ <td att-table-body >{{options._source.name}}</td>
+ <td att-table-body >{{options._source.suggest.payload.tn}}</td>
+ <td att-table-body >{{options._source.suggest.payload.addr}}</td>
+ <td att-table-body >{{options._source.suggest.payload.city}}</td>
+ <td att-table-body >{{options._source.suggest.payload.st}}</td>
+ <td att-table-body >{{options._source.suggest.payload.zip}}</td>
+ <td att-table-body >{{options._source.suggest.payload.clli}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_suggest_demo.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_suggest_demo.jsp
new file mode 100644
index 00000000..05cfaf55
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_suggest_demo.jsp
@@ -0,0 +1,97 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<!-- <link rel="stylesheet" type="text/css" href="app/fusion/elasticsearch/styles/styles.css" > -->
+<script>
+app.controller('elasticSearchController',['$scope','$http',function ($scope,$http) {
+ $scope.submenuId = "";
+ $scope.isNew="";
+ $scope.viewPerPage = 20;
+ $scope.currentPage = 2;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+ $scope.tableData=[];
+ $scope.searchText='';
+ $scope.flagCount=0;
+ function escapeRegExp(str) {
+ return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|\&]/g, " ");
+ }
+ $scope.test = function(){
+ $scope.searchText=$scope.searchText;
+ var sendData ={
+ "data" : escapeRegExp($scope.searchText),
+ "size" : "20",
+ "fuzzy" : "true",
+ "resultname" : "custsuggest"
+ };
+
+ if($scope.flagCount<3 || $scope.searchText.length==0){
+ $scope.flagCount++;
+ $http.get('es_suggest/' + encodeURIComponent(JSON.stringify(sendData))).
+ then(function(response){
+ var data = JSON.parse(response.data.result);
+ $scope.tableData = data.custsuggest[0].options;
+ })
+ .catch(function(data,status){
+ console.log("Error: " + status + " : " + data);
+ })
+ .finally(function() {
+ $scope.flagCount--;
+ });
+ }
+ }
+ $scope.searchText='';
+}]);
+</script>
+
+<div style="margin-left:20px;" ng-app="eSearchApp">
+ <div style="margin-top:20px; margin-bottom:20px;"><span class="heading1">Elastic Search - </span><span class="heading2">Corporate Location Data System</span></div>
+ <div class="demoElas" ng-controller="elasticSearchController">
+ <div class="form-field" align="center">
+ <input type="text" placeholder="What are you looking for?" class="search__large-iconform" ng-model="searchText" ng-change="test()">
+ <i class="icon-search">&nbsp;</i>
+ </div>
+
+ <table att-table table-data="tableData" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header>Customer Name</th>
+ <th att-table-header>Phone</th>
+ <th att-table-header>Street</th>
+ <th att-table-header>City</th>
+ <th att-table-header>State</th>
+ <th att-table-header>ZIP</th>
+ <th att-table-header>CLLI</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="options in tableData">
+ <tr>
+ <td att-table-body >{{options.text}}</td>
+ <td att-table-body >{{options.payload.tn}}</td>
+ <td att-table-body >{{options.payload.addr}}</td>
+ <td att-table-body >{{options.payload.city}}</td>
+ <td att-table-body >{{options.payload.st}}</td>
+ <td att-table-body >{{options.payload.zip}}</td>
+ <td att-table-body >{{options.payload.clli}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/frame_insert.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/frame_insert.jsp
new file mode 100644
index 00000000..5f550c68
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/frame_insert.jsp
@@ -0,0 +1,44 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<iframe id="frame_insert" src="${frame_int}"></iframe>
+
+<script type="text/javascript">
+
+ var frameId = "#frame_insert";
+
+ $(frameId).load(function(){
+ iframeLoaded()
+
+ });
+
+
+ function iframeLoaded() {
+ var iFrameRef = $(frameId);
+ if(iFrameRef) {
+
+ var height = iFrameRef.contents().find("input[name='inner_height']");
+ var width = iFrameRef.contents().find("input[name='inner_width']");
+
+ iFrameRef.css('height', (height.val() != undefined ? height.val():"500px"));
+ iFrameRef.css('width', (width.val() != undefined ? width.val():"500px"));
+ iFrameRef.css('border','none');
+ }
+ }
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/include.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/include.jsp
new file mode 100644
index 00000000..cd6a5e09
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/include.jsp
@@ -0,0 +1,30 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.core.util.SystemProperties" %>
+<%@ page import="org.openecomp.portalsdk.core.web.support.AppUtils" %>
+
+<%@ page import="java.util.LinkedHashMap" %>
+
+
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+
+<c:set var="request" value="<%=request%>"/>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/jcs_admin.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/jcs_admin.jsp
new file mode 100644
index 00000000..845beac2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/jcs_admin.jsp
@@ -0,0 +1,144 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%-- <%@ include file="/WEB-INF/fusion/jsp/include.jsp"%> --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
+
+<div align="left" ng-controller="cacheAdminController">
+ <div class="pageTitle"><h3>Cache Regions</h3></div>
+ These are the regions which are currently defined in the cache. 'Items' and 'Bytes' refer to the elements currently in memory (not spooled).
+ You can clear all items for a region by clicking on the Clear icon next to the desired region below. You can also <a href="#" ng-click="clearAll();">clear all regions</a> which
+ empties the entire cache. <br /><br />
+
+ <div style="width: 97%; border-top: 1px solid #c4c4c4; margin-top: 0px; background-color: #fff; padding: 10px 0; color: #646464s">
+ <div style="margin: 0 20px 10px 0px; font-size: 80%; float: left; width: 97%;">
+ <div class="col-md-4"><b>Cache Name</b></div>
+ <div class="col-md-2"><b># of Items</b></div>
+ <div class="col-md-2"><b>Bytes</b></div>
+ <div class="col-md-2"><b>Status</b></div>
+ <div class="col-md-3"><b>Memory Hits</b></div>
+ <div class="col-md-3"><b>Aux Hits</b></div>
+ <div class="col-md-3"><b>Not Found Misses</b></div>
+ <div class="col-md-3"><b>Expired Misses</b></div>
+ <div class="col-md-1"><b>Clear?</b></div>
+ <div class="col-md-1"><b>Items</b></div>
+ </div>
+ <div ng-repeat="region in regions">
+ <div style="margin: 0 20px 10px 0px; font-size: 80%; float: left; width: 97%;">
+ <div class="col-md-4"><a href="#" tooltip="Click to Show Region Details" ng-click="showRegionDetails(region.cacheName);">{{region.cacheName}}</a></div>
+ <div class="col-md-2">{{region.size}}</div>
+ <div class="col-md-2">{{region.byteCount}}</div>
+ <div class="col-md-2">{{region.status}}</div>
+ <div class="col-md-3">{{region.hitCountRam}}</div>
+ <div class="col-md-3">{{region.hitCountAux}}</div>
+ <div class="col-md-3">{{region.missCountNotFound}}</div>
+ <div class="col-md-3">{{region.missCountExpired}}</div>
+ <div class="col-md-1">
+ <div ng-click="clearRegion(region.cacheName);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </div>
+ <div class="col-md-1"><span class="att--tree__plus col-md-1" ng-class="{minus: bling$index}" ng-click="bling$index = !bling$index" style="display: block;"></span></div>
+ </div>
+ <div style="margin: 0px 20px 0px 30px; font-size: 80%; float: left; width: 95%; border-top: 1px solid #e4e4e4; padding-top: 10px"
+ ng-show="bling$index">
+ <span class="att--tree__arrow" style="height: 20px; width: 20px; display: inline-block; float: left"></span>
+ <div class="col-md-12"><b>Key</b></div>
+ <div class="col-md-2"><b>Eternal?</b></div>
+ <div class="col-md-4"><b>Created</b></div>
+ <div class="col-md-2"><b>Max Life</b></div>
+ <div class="col-md-2"><b>Expires</b></div>
+ <div class="col-md-1"><b>Clear?</b></div>
+ </div>
+ <div ng-repeat="item in region.items">
+ <div style="margin: 0px 20px 0px 30px; font-size: 80%; float: left; width: 95%;" ng-show="bling$index">
+ <span class="att--tree__arrow" style="height: 20px; width: 20px; display: inline-block; float: left"></span>
+ <div class="col-md-12"><a href="#" tooltip="Click to Show Item Details" ng-click="showItemDetails(region.cacheName,item.key);">{{item.key}}</a></div>
+ <div class="col-md-2">{{item.eternal}}</div>
+ <div class="col-md-4">{{item.createTime}}</div>
+ <div class="col-md-2">{{item.maxLifeSeconds}}</div>
+ <div class="col-md-2">{{item.expiresInSeconds}}</div>
+ <div class="col-md-1">
+ <div ng-click="clearItem(region.cacheName,item.key);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </div>
+ </div>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ </div>
+</div>
+
+<script>
+app.controller('cacheAdminController', function ($scope,$interval,$http,$modal,modalService){
+ $scope.regions=${model};
+
+ $scope.clearAll = function() {
+ modalService.popupConfirmWin("Confirm",'You are about to clear all of the items for all cache regions. Do you want to continue?',
+ function(){
+ $http.get("jcs_admin/clearAll").success(function(response){$scope.regions=response;});
+
+ })
+ };
+
+ $scope.clearRegion = function(cacheName) {
+ modalService.popupConfirmWin("Confirm",'You are about to clear all of the items in the cache region "' + cacheName + '". Do you want to continue?',
+ function(){
+ $http.get("jcs_admin/clearRegion?cacheName="+cacheName).success(function(response){$scope.regions=response;});
+
+ })
+ };
+
+ $scope.clearItem = function(cacheName,key) {
+ modalService.popupConfirmWin("Confirm",'You are about to clear this item from the cache region "' + cacheName + '". Do you want to continue?',
+ function(){
+ $http.get("jcs_admin/clearItem?keyName="+key+"&cacheName="+cacheName).success(function(response){$scope.regions=response;});
+
+ })
+ };
+
+ $scope.showRegionDetails = function(cacheName) {
+ $http.get("jcs_admin/showRegionDetails?cacheName="+cacheName).success(function(response){modalService.showSuccess('',response);});
+ };
+
+ $scope.showItemDetails = function(cacheName,key) {
+ $http.get("jcs_admin/showItemDetails?keyName="+key+"&cacheName="+cacheName).success(function(response){
+ var message = "CacheName: "+ response.cacheName
+ +"\nkey: "+response.key
+ +"\nIS_SPOOL: "+response.attr.IS_SPOOL
+ +"\nIS_LATERAL: "+response.attr.IS_LATERAL
+ +"\nIS_REMOTE: "+response.attr.IS_REMOTE
+ +"\nIS_ETERNAL: "+response.attr.IS_ETERNAL
+ +"\nversion: "+response.attr.version
+ +"\nmaxLifeSeconds: "+response.attr.maxLifeSeconds
+ +"\nmaxIdleTimeSeconds: "+response.attr.maxIdleTimeSeconds
+ +"\nsize: "+response.attr.size
+ +"\ncreateTime: "+response.attr.createTime
+ +"\nlastAccessTime: "+response.attr.lastAccessTime
+ +"\nidleTime: "+response.attr.idleTime
+ +"\ntimeToLiveSeconds: "+response.attr.timeToLiveSeconds
+ +"\nisSpool: "+response.attr.isSpool
+ +"\nisLateral: "+response.attr.isLateral
+ +"\nisRemote: "+response.attr.isRemote
+ +"\nisEternal: "+response.attr.isEternal;
+ modalService.showSuccess('',message);});
+ };
+});
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/meta.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/meta.jsp
new file mode 100644
index 00000000..3c4ff52a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/meta.jsp
@@ -0,0 +1,36 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/fn-ebz.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/demo.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/base.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/btn.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/dtpk.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/frms.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/sldr.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/tbs.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/portal_ebz_header.css">
+
+</head>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal.html b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal.html
new file mode 100644
index 00000000..0766cecd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal.html
@@ -0,0 +1,324 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<script type="text/ng-template" id="modal_informative.html">
+ <div class="modal__informative font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Success!</h2>
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content" style="white-space: pre-wrap;">{{message.text}}</div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Dismiss</button>
+ </div>
+ </div>
+ </script>
+
+ <script type="text/ng-template" id="modal_message.html">
+ <div class="modal__informative font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Attention!</h2>
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content" style="white-space: pre-wrap;">{{message.text}}</div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Dismiss</button>
+ </div>
+ </div>
+ </script>
+
+ <script type="text/ng-template" id="delete_informative.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are you sure you want to delete the profile?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="email_report_informative.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Mailing your report...</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ The report will be sent to your email soon!
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Ok</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="delete_authCode.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are you sure you want to delete the Authorization Code(s)?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="delete_Schedule.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete This Schedule(s) ?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="alternate_number.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete This Number ?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="manage_device.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete This Line Port ?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="delete_virtualOnNet.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete this Virtual On-Net User?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="delete_user_meet_me_conference.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete this Conference?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="confirmation_informative.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">{{message.title}}</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content" style="white-space: pre-wrap;">{{message.text}}<br/></div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+
+ <script type="text/ng-template" id="confirmation_for_delete.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name"> <h2 class="font-showcase-font-name">Are You Sure You Want to Delete This {{message.title}}?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">Deletions are not reversible. {{message.text}}<br/></div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+
+ <script type="text/ng-template" id="modal_warning.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Unable to process your request!</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content" style="white-space: pre-wrap;">Unable to process your request. <br/>{{message.text}}<br/>
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Dismiss</button>
+ </div>
+ </div>
+ </script>
+
+ <script type="text/ng-template" id="modal_warning_message.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Warning</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content" style="white-space: pre-wrap;">{{message.text}}<br/>
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Dismiss</button>
+ </div>
+ </div>
+ </script>
+
+
+
+ <script type="text/ng-template" id="modal_prompt.html">
+ <div class="modal__warning font-showcase">
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Unable to process your request. </h2>
+ <i class="icon-circle-action-close close-modal modal__header--close" ng-click="$dismiss()"></i>
+
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Unable to process your request. <br/> {{message.text}}
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="delete_device.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete This Device?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="delete_multiple_device.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete The Device(s)?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+
+<script>
+
+//.controller('modalpopupController', function ($scope, $modalInstance){
+var modalpopupController = function ($scope, $modalInstance, message){
+
+ $scope.message = message;
+
+
+ $scope.hello = function () {
+ $modalInstance.close($scope.digitPattern);
+ };
+ $modalInstance.ok = function() {
+ //add the ok functionality
+ alert("Logout");
+ };
+ $modalInstance.cancel = function() {
+ //add the cancel functionality
+ alert("Keep Log in");
+ };
+ $modalInstance.cancelbutton = function() {
+ //add the cancel functionality
+ alert("Modal Waring popup close event");
+ };
+}
+
+
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_role.html b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_role.html
new file mode 100644
index 00000000..c163002d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_role.html
@@ -0,0 +1,274 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<script type="text/ng-template" id="role_functions_popup.html">
+ <div class="modal__informative font-showcase" style="width:700px;height:500px;overflow:scroll">
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name" style="width: 500px;">Select Role Functions</h2>
+ </div>
+ <button align="right" class="button button--primary button--small" herf="javascript:void(0)" ng-click="close()">Close</button>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ <table table-data="availableRoleFunctions" att-table>
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" width="10%"> </th>
+ <th att-table-header sortable="false" width="90%">Role Function</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="availableRoleFunction in availableRoleFunctions" style="max-height: 980px;" >
+ <tr>
+
+ <td width="10%">
+ <div ng-click="toggleRoleFunction(availableRoleFunction.selected,availableRoleFunction);">
+ <input type="checkbox" ng-model="availableRoleFunction.selected" att-toggle-main>
+ </div>
+ </td>
+ <td width="90%">{{ availableRoleFunction.name }}</td>
+
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+</script>
+
+
+<script type="text/ng-template" id="child_roles_popup.html">
+ <div class="modal__informative font-showcase" style="width:700px;height:500px;overflow:scroll">
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name" style="width: 500px;">Select Child Roles</h2>
+ </div>
+ <button align="right" class="button button--primary button--small" herf="javascript:void(0)" ng-click="close()">Close</button>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ <table table-data="availableRoles" att-table>
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" width="10%"> </th>
+ <th att-table-header sortable="false" width="90%">Role</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="availableRole in availableRoles" style="max-height: 980px;" >
+ <tr>
+ <td att-table-body width="10%">
+ <div ng-click="toggleChildRole(availableRole.selected,availableRole);">
+ <input type="checkbox" ng-model="availableRole.selected" att-toggle-main>
+ </div>
+ </td>
+ <td att-table-body width="90%">{{ availableRole.name }}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+</script>
+
+<script>
+
+var rolepopupController = function ($scope, $modalInstance, role,modalService){
+ $scope.role = role;
+
+ if($scope.role.childRoles==null){
+ $scope.role.childRoles=[];
+ }
+
+ $scope.ociavailableRoles=${availableRoles};
+ console.log($scope.ociavailableRoles);
+ $scope.availableRoles=[];
+ if($scope.ociavailableRoles)
+ $.each($scope.ociavailableRoles, function(i, a){
+ var availableRole = a;
+ availableRole.selected = false;
+ if($scope.role.childRoles){
+ $.each($scope.role.childRoles, function(j, b){
+ if(a.id === b.id) {
+ availableRole.selected = true;
+ }
+ });
+ };
+ $scope.availableRoles.push(availableRole);
+ });
+ ;
+
+ $scope.ociavailableRoleFunctions=${availableRoleFunctions};
+
+ $scope.availableRoleFunctions = [];
+ if($scope.ociavailableRoleFunctions)
+ $.each($scope.ociavailableRoleFunctions, function(i, a){
+ var availableRoleFunction = a;
+ availableRoleFunction.selected = false;
+ $.each($scope.role.roleFunctions, function(j, b){
+ if(a.code === b.code) {
+ availableRoleFunction.selected = true;
+ }
+ });
+ $scope.availableRoleFunctions.push(availableRoleFunction);
+ });
+ ;
+
+ $scope.toggleRoleFunction = function(selected,availableRoleFunction) {
+ //alert('toggleRole: '+selected);
+
+ if(!selected) {
+ //remove role function
+ if(role.id==null){
+ var index = $scope.role.roleFunctions.indexOf(availableRoleFunction);
+ if(index>=0)
+ $scope.role.roleFunctions.splice(index, 1);
+ return;
+ }
+ var uuu = "role/removeRoleFunction.htm?role_id=${param.role_id}";
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to remove the role function "+availableRoleFunction.name+" from the role for "+$scope.role.name+". Do you want to continue?",
+ function(){
+ var postData={roleFunction:availableRoleFunction};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.role=data.role;});
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ },
+ function(){
+ availableRoleFunction.selected=!availableRoleFunction.selected;
+ })
+
+ } else {
+ //add role function
+ if(role.id==null){
+ $scope.role.roleFunctions.push(availableRoleFunction);
+ return;
+ }
+ var uuu = "role/addRoleFunction.htm?role_id=${param.role_id}";
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to add the role function "+availableRoleFunction.name+" to the role for "+$scope.role.name+". Do you want to continue?",
+ function(){
+ var postData={roleFunction:availableRoleFunction};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.role=data.role;});
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ },
+ function(){
+ availableRoleFunction.selected=!availableRoleFunction.selected;
+ })
+
+ }
+
+
+ };
+
+ $scope.toggleChildRole = function(selected,availableRole) {
+ //alert('toggleRole: '+selected);
+
+ if(!selected) {
+ //remove role
+ if(role.id==null){
+ var index = $scope.role.childRoles.indexOf(availableRole);
+ if(index>=0)
+ $scope.role.childRoles.splice(index, 1);
+ return;
+ }
+ var uuu = "role/removeChildRole.htm?role_id=${param.role_id}";
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to remove the child role "+availableRole.name+" from the role for "+$scope.role.name+". Do you want to continue?",
+ function(){
+ var postData={childRole:availableRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ console.log('role',data.role);
+ $scope.$apply(function(){$scope.role=data.role;});
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ },
+ function(){
+ availableRole.selected=true;
+ })
+
+ } else {
+ //add role
+ if(role.id==null){
+ $scope.role.childRoles.push(availableRole);
+ return;
+ }
+ var uuu = "role/addChildRole.htm?role_id=${param.role_id}";
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to add the child role "+availableRole.name+" to the role for "+$scope.role.name+". Do you want to continue?",
+ function(){
+ var postData={childRole:availableRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.role=data.role;});
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ },
+ function(){
+ availableRole.selected=false;
+ })
+
+
+ }
+
+
+ };
+
+
+ $scope.close = function() {
+ console.log('role', $scope.role);
+ $modalInstance.close({role:$scope.role});
+ };
+
+}
+
+
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_rolefunction.html b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_rolefunction.html
new file mode 100644
index 00000000..ee0b5121
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_rolefunction.html
@@ -0,0 +1,87 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<script type="text/ng-template" id="edit_role_function_popup.html">
+ <div class="modal__informative font-showcase" style="width:400px;">
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name" style="width: 500px;">{{label}}</h2>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Name:</label><br>
+ <input type="text" class="fn-ebz-text" ng-model="editRoleFunction.name"
+ maxlength="30" />
+ </div>
+ <br/>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Code:</label><br>
+ <input type="text" class="fn-ebz-text" ng-model="editRoleFunction.code" ng-disabled="disableCd"
+ maxlength="30" />
+ </div>
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="saveRoleFunction(editRoleFunction);">Save</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="close()">Close</button>
+ </div>
+ </div>
+</script>
+
+<script>
+
+var rolefunctionpopupController = function ($scope, $modalInstance, message){
+ if(message.availableRoleFunction==null)
+ $scope.label='Add Role Function'
+ else{
+ $scope.label='Edit Role Function'
+ $scope.disableCd=true;
+ }
+ $scope.editRoleFunction = message.availableRoleFunction;
+
+ $scope.saveRoleFunction = function(availableRoleFunction) {
+ var uuu = "role_function_list/saveRoleFunction.htm";
+ var postData={availableRoleFunction: availableRoleFunction};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ //$scope.availableRoleFunctions=[];$scope.$apply();
+ $scope.availableRoleFunctions=data.availableRoleFunctions;});
+ //alert("Update Successful.") ;
+ console.log($scope.availableRoleFunctions);
+
+ //$scope.editRoleFunction = null;
+ $modalInstance.close({availableRoleFunctions:$scope.availableRoleFunctions});
+ },
+ error : function(data){
+ alert("Error while saving.");
+ }
+ });
+ };
+
+ $scope.close = function() {
+ $modalInstance.close();
+ };
+}
+
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/post_search.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/post_search.jsp
new file mode 100644
index 00000000..94d4b0bf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/post_search.jsp
@@ -0,0 +1,356 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+<%@ page import="com.fasterxml.jackson.databind.ObjectMapper" %>
+<%@ page import="org.json.JSONObject" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal_rolefunction.html" %>
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal_role.html" %>
+<link rel="stylesheet" type="text/css" href="static/fusion/css/jquery-ui.css">
+
+<div ng-controller="postSearchController" >
+
+<h1 class="heading1" style="margin-top:20px;">WEBPHONE Search</h1>
+ <br>
+ Please enter search criteria below:<br/>
+
+ <div class="fn-ebz-container">
+ Last Name:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postSearchBean.lastName" value="" size="25">
+ </div>
+
+ <div class="fn-ebz-container">
+ First Name:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postSearchBean.firstName" value="" size="25">
+ </div>
+
+ <div class="fn-ebz-container">
+ UserId:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postSearchBean.orgUserId" value="" size="25">
+ </div>
+
+ <div class="fn-ebz-container">
+ Manager OrgUserId:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postSearchBean.orgManagerUserId" value="" size="25">
+ </div>
+ <br>
+ <div class="fn-ebz-container">
+ Organization:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postSearchBean.orgCode" value="" size="25">
+ </div>
+
+ <div class="fn-ebz-container">
+ Email:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postSearchBean.email" value="" size="25">
+ </div>
+ <br>
+<!-- Sort By: <br/>
+ <div class="fn-ebz-container" >
+
+ <div class="fn-ebz-container">
+ <div class="form-field" att-select="sortByList" ng-model="postSearchBean.sortBy1"></div>
+ </div>
+ </div>
+
+
+
+
+ <div class="fn-ebz-container" >
+ <br/>
+ &nbsp;
+
+ <div class="fn-ebz-container">
+ <div class="form-field" att-select="sortByList" ng-model="postSearchBean.sortBy2"></div>
+ </div>
+ </div>
+
+
+ <div class="fn-ebz-container" >
+ <br/> &nbsp;
+
+ <div class="fn-ebz-container">
+ <div class="form-field" att-select="sortByList" ng-model="postSearchBean.sortBy3"></div>
+ </div>
+ </div> -->
+ <div>
+ <input att-button btn-type="primary" size="small" class="button" type="submit" value="Search" ng-click="search(postSearchBean);" />
+
+ <input att-button btn-type="primary" size="small" class="button" type="submit" value="Reset" ng-click="reset();"/>
+ </div>
+ <br>
+ {{noResultsString}}
+ <div ng-if="profileList.length != 0">
+ <table att-table table-data="profileList" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+ <thead att-table-row type="header" >
+ <tr>
+ <th att-table-header width="5%" align="left">No</th>
+ <th att-table-header width="30%" key="lastName" align="left">Name</th>
+ <th att-table-header width="5%" key="orgUserId" align="left">OrgUserId</th>
+ <th att-table-header width="10%" key="orgCode" align="left">Organization</th>
+ <th att-table-header width="20%" align="left">Phone</th>
+ <th att-table-header width="20%" key="email" align="left">Email</th>
+ <th att-table-header width="10%" align="left">Import?</th>
+ </tr>
+ </thead>
+
+ <tbody att-table-row type="body" row-repeat="profile in profileList" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr >
+ <td att-table-body width="5%" align="left">
+ {{$index + 1}}
+ </td>
+ <td att-table-body width="30%" align="left">
+ <div ng-if="ngexistingUsers[profile.orgUserId] == null">
+ {{profile.lastName}},&nbsp;{{profile.firstName}}
+ </div>
+ <div ng-if="ngexistingUsers[profile.orgUserId] != null">
+ <a href="profile.htm?profile_id={{ngexistingUsers[profile.orgUserId]}}" alt="View/Edit Profile">
+ {{profile.lastName}},&nbsp;{{profile.firstName}}
+ </a>
+ </div>
+
+ </td>
+ <td att-table-body width="5%" align="left">
+ {{profile.orgUserId}}
+ </td>
+ <td att-table-body width="10%" align="left">
+ {{profile.orgCode}}
+ </td>
+ <td att-table-body width="20%" align="left">
+ {{profile.phone}}
+ </td>
+ <td att-table-body width="20%" align="left">
+ {{profile.email}}
+ </td>
+
+ <td att-table-body width="10%" align="left">
+ <div ng-if="ngexistingUsers[profile.orgUserId] == null">
+ <div ng-click="toggleSelection(profile);">
+ <input name="selected" type="checkbox" ng-model="profile.selected" att-checkbox/>
+ </div>
+ </div>
+ <div ng-if="ngexistingUsers[profile.orgUserId] != null">
+ Exists
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <div class="fn-ebz-container">
+ Rows Per Page:
+ <input class="fn-ebz-text" type="text" ng-model="viewPerPage" size="5" style="width: 47px;">
+ </div>
+ <div class="fn-ebz-container">
+ Current Page:
+ <input class="fn-ebz-text" type="text" ng-model="currentPage" size="5" style="width: 47px;">
+ </div>
+ <div class="fn-ebz-container">
+ Total Page(s):
+ <input class="fn-ebz-text" type="text" ng-model="totalPage" size="5" readonly="true" style="width: 47px;">
+ </div>
+
+ <div ng-if="profileList.length != 0">
+ <input att-button btn-type="primary" size="small" class="button" type="submit" value="Import" ng-click="process();"/>
+ </div>
+
+ </div>
+
+
+
+
+</div>
+<script>
+ app.controller('postSearchController', function ($scope,modalService){
+
+ $scope.viewPerPage = 200;
+ $scope.currentPage = 1;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+
+ $scope.noResultsString = "";
+
+ $scope.postSearchBean=${postSearchBean};
+ $scope.profileList=${profileList};
+ //console.log($scope.postSearchBean);
+
+ $scope.ngexistingUsers=${existingUsers};
+ console.log($scope.ngexistingUsers);
+
+ $scope.ocisortByList=${sortByList};
+ $scope.sortByList = [];
+ if($scope.ocisortByList)
+ $.each($scope.ocisortByList, function(i, a){
+ var sortBy = {"index":i, "value":a.value, "title":a.label};
+ $scope.sortByList.push(sortBy);
+ });
+ ;
+
+ $scope.search = function(postSearchBean) {
+ console.log(postSearchBean);
+ var uuu = "post_search/search";
+ var postData={postSearchBean:postSearchBean};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.profileList=data.postSearchBean.searchResult;
+ //$scope.postSearchBean={};
+ console.log($scope.profileList);
+ if($scope.profileList.length == 0)
+ $scope.noResultsString = "There is currently no one in WEBPHONE matching your search criteria.";
+ else
+ $scope.noResultsString = "";
+ });
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while searching: "+ data.responseText);
+ }
+ });
+
+ };
+
+ $scope.reset = function() {
+ $scope.postSearchBean={};
+ $scope.profileList=[];
+ $scope.noResultsString = "";
+ //console.log($scope.postSearchBean);
+ };
+
+ $scope.process = function() {
+ $scope.prepareProfileSelection();
+ var uuu = "post_search/process";
+ var postData={postSearchBean:$scope.postSearchBean};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.profileList=data.postSearchBean.searchResult;
+ //$scope.postSearchBean={};
+ $scope.ngexistingUsers=data.existingUsers;
+ $scope.postSearchBean.selected=null;
+ });
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while searching: "+ data.responseText);
+ }
+ });
+
+ };
+ $scope.importProfileList=[];
+ $scope.toggleSelection = function(profile) {
+ if(profile.selected)
+ $scope.importProfileList.push(profile);
+ else{
+ var index = $scope.importProfileList.indexOf(profile);
+ if(index>=0)
+ $scope.importProfileList.splice(index, 1);
+ }
+ };
+
+ $scope.prepareProfileSelection = function() {
+ if($scope.importProfileList)
+ $.each($scope.importProfileList, function(i, profile){
+ $scope.preparePostSearchBean(profile);
+ });
+ ;
+ }
+
+ $scope.preparePostSearchBean = function(profile) {
+ //console.log('Importing: '+profile.orgUserId);
+ //console.log('ngexistinguser:'+$scope.ngexistingUsers[profile.orgUserId])
+ if($scope.postSearchBean.selected==null){
+ $scope.postSearchBean.selected=[];
+ $scope.postSearchBean.postOrgUserId=[];
+ $scope.postSearchBean.postHrid=[];
+ $scope.postSearchBean.postFirstName=[];
+ $scope.postSearchBean.postLastName=[];
+ $scope.postSearchBean.postOrgCode=[];
+ $scope.postSearchBean.postPhone=[];
+ $scope.postSearchBean.postEmail=[];
+ $scope.postSearchBean.postAddress1=[];
+ $scope.postSearchBean.postAddress2=[];
+ $scope.postSearchBean.postCity=[];
+ $scope.postSearchBean.postState=[];
+ $scope.postSearchBean.postZipCode=[];
+ $scope.postSearchBean.postLocationClli=[];
+ $scope.postSearchBean.postBusinessCountryCode=[];
+ $scope.postSearchBean.postBusinessCountryName=[];
+ $scope.postSearchBean.postDepartment=[];
+ $scope.postSearchBean.postDepartmentName=[];
+ $scope.postSearchBean.postBusinessUnit=[];
+ $scope.postSearchBean.postBusinessUnitName=[];
+ $scope.postSearchBean.postJobTitle=[];
+ $scope.postSearchBean.postOrgManagerUserId=[];
+ $scope.postSearchBean.postCommandChain=[];
+ $scope.postSearchBean.postCompanyCode=[];
+ $scope.postSearchBean.postCompany=[];
+ $scope.postSearchBean.postCostCenter=[];
+ $scope.postSearchBean.postSiloStatus=[];
+ $scope.postSearchBean.postFinancialLocCode=[];
+ }
+
+ $scope.postSearchBean.selected.push(profile.orgUserId);
+ $scope.postSearchBean.postOrgUserId.push(profile.orgUserId);
+ $scope.postSearchBean.postHrid.push(profile.hrid);
+ $scope.postSearchBean.postFirstName.push(profile.firstName);
+ $scope.postSearchBean.postLastName.push(profile.lastName);
+ $scope.postSearchBean.postOrgCode.push(profile.orgCode);
+ $scope.postSearchBean.postPhone.push(profile.phone);
+ $scope.postSearchBean.postEmail.push(profile.email);
+ $scope.postSearchBean.postAddress1.push(profile.address1);
+ $scope.postSearchBean.postAddress2.push(profile.address2);
+ $scope.postSearchBean.postCity.push(profile.city);
+ $scope.postSearchBean.postState.push(profile.state);
+ if(profile.zipCodeSuffix==null)
+ $scope.postSearchBean.postZipCode.push(profile.zipCode);
+ else
+ $scope.postSearchBean.postZipCode.push(profile.zipCode+'-'+profile.zipCodeSuffix);
+ $scope.postSearchBean.postLocationClli.push(profile.locationClli);
+ $scope.postSearchBean.postBusinessCountryCode.push(profile.businessCountryCode);
+ $scope.postSearchBean.postBusinessCountryName.push(profile.businessCountryName);
+ $scope.postSearchBean.postDepartment.push(profile.department);
+ $scope.postSearchBean.postDepartmentName.push(profile.departmentName);
+ $scope.postSearchBean.postBusinessUnit.push(profile.businessUnit);
+ $scope.postSearchBean.postBusinessUnitName.push(profile.businessUnitName);
+ $scope.postSearchBean.postJobTitle.push(profile.jobTitle);
+ $scope.postSearchBean.postOrgManagerUserId.push(profile.orgManagerUserId);
+ $scope.postSearchBean.postCommandChain.push(profile.commandChain);
+ $scope.postSearchBean.postCompanyCode.push(profile.companyCode);
+ $scope.postSearchBean.postCompany.push(profile.company);
+ $scope.postSearchBean.postCostCenter.push(profile.costCenter);
+ $scope.postSearchBean.postSiloStatus.push(profile.siloStatus);
+ $scope.postSearchBean.postFinancialLocCode.push(profile.financialLocCode);
+ };
+
+ });
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile.jsp
new file mode 100644
index 00000000..b01fa6b8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile.jsp
@@ -0,0 +1,442 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.core.domain.User"%>
+<%@ page import="org.openecomp.portalsdk.core.web.support.UserUtils"%>
+
+<%@page import="org.openecomp.portalsdk.core.web.support.ControllerProperties"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+
+<link rel="stylesheet" type="text/css" href="static/fusion/css/jquery-ui.css">
+<link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/fn-ebz.css" >
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
+
+<%@ include file="/WEB-INF/fusion/jsp/include.jsp"%>
+
+<div class="pageTitle">
+ <h3>
+ <c:choose>
+ <c:when test="${!empty profileId}">
+ <h1 class="heading1" style="margin-top:20px;">Profile Edit</h1>
+ </c:when>
+ <c:otherwise>
+ <h1 class="heading1" style="margin-top:20px;">Profile Edit</h1>
+ </c:otherwise>
+ </c:choose>
+ </h3>
+</div>
+
+<div ng-controller="profileController" >
+
+ Please edit the profile details below:&nbsp;<br><br>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>First Name:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.firstName"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Last Name:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.lastName"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">OrgUserId:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.orgUserId"
+ maxlength="30" style="margin-right:0px;"/>
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Manager OrgUserId:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.orgManagerUserId"
+ maxlength="30" style="margin-right:0px;"/>
+ </div>
+<BR>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Login Id:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.loginId"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" style="margin-right:20px">
+ <label class="fn-ebz-text-label">Password:</label><BR>
+ <input type="password" ng-model="profile.loginPwd"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Phone:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.phone"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Fax:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.fax"
+ maxlength="30" />
+ </div>
+<BR>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Cellular:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.cellular"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Email:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.email"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Address 1:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.address1"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Address 2:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.address2"
+ maxlength="30" />
+ </div>
+<BR>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">City:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.city"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">State:</label><BR>
+ <div class="form-field" att-select="stateList.options" ng-model="stateList.selected"></div>
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Zip Code:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.zipCode"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Country:</label><BR>
+ <div class="form-field" att-select="countries" ng-model="selectedCountry"></div>
+ </div>
+ <BR>
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Time Zone:</label><BR>
+ <div class="form-field" att-select="timeZones" ng-model="selectedTimeZone"></div>
+ </div>
+
+ <div align="left" >
+ <button type="submit" ng-click="saveProfile();" att-button
+ btn-type="primary" size="small">Save</button>
+ </div>
+
+<br>
+ <div class="pageTitle">
+ <label>Roles</label>
+ <a ng-click="addNewRolePopup();" class="ion-plus-round" size="small"></a>
+
+ </div>
+
+ <table att-table table-data="profile.roles" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+<!-- <table border="1" class="hovertable_1"> -->
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" align="left" width="90%">Name</th>
+ <th att-table-header sortable="false" width="10%">Remove?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="role in profile.roles" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+<!-- <tr ng-repeat="role in profile.roles track by role.id"> -->
+ <tr>
+ <td att-table-body width="90%" >{{ role.name }}</td>
+ <td att-table-body width="10%">
+ <a ng-click="removeRole(role);" ><img src="static/fusion/images/deleteicon.gif"></a>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div id="dialog" style="overflow:scroll" class="modal__informative font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name" style="color:#157BB2">Select Roles</h2>
+ </div>
+ <button align="right" class="button button--primary button--small" herf="javascript:void(0)" ng-click="close()">Close</button>
+ <div class="divider-container"><hr></div>
+ <div class="modal__content">
+ <table table-data="availableRoles" att-table >
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" width="10%"> </th>
+ <th att-table-header sortable="false" width="90%">Role</th>
+ </tr>
+ </thead>
+
+ <tbody att-table-row type="body" row-repeat="availableRole in availableRoles" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr>
+ <td att-table-body width="10%">
+ <div ng-click="toggleRole(availableRole.selected,availableRole);">
+ <input type="checkbox" ng-model="availableRole.selected" att-toggle-main>
+ </div>
+ </td>
+ <td att-table-body width="90%">{{ availableRole.name }}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+
+</div>
+
+
+
+<script>
+app.controller('profileController', function ($scope,modalService){
+
+ $scope.profile=${model.profile};
+ $scope.profileId = $scope.profile.id;
+ $scope.orgUserId=$scope.profile.orgUserId;
+ $scope.orgManagerUserId=$scope.profile.orgManagerUserId;
+
+ $scope.viewPerPage = 2;
+ $scope.currentPage = 1;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+
+ $( "#dialog" ).hide();
+
+ $scope.ociavailableRoles=${model.availableRoles};
+ //modalService.showFailure('Error','') ;
+ $scope.availableRoles = [];
+ if($scope.ociavailableRoles)
+ $.each($scope.ociavailableRoles, function(i, a){
+ var availableRole = a;
+ availableRole.selected = false;
+ $.each($scope.profile.roles, function(j, b){
+ if(a.id === b.id) {
+ availableRole.selected = true;
+ }
+ });
+ $scope.availableRoles.push(availableRole);
+ });
+ ;
+
+ $scope.ociTimeZones = ${model.timeZones};
+ $scope.timeZones = [];
+ $scope.selectedTimeZone = null;
+ if($scope.ociTimeZones){
+ $.each($scope.ociTimeZones, function(i, a){
+ var timeZone = {"index":i, "value":a.value, "title":a.label};
+ $scope.timeZones.push(timeZone);
+ if($scope.profile.timeZoneId !== null && a.value === $scope.profile.timeZoneId.toString()){
+ $scope.selectedTimeZone = timeZone;
+ }
+ });
+ };
+
+ $scope.ociCountries = ${model.countries};
+ $scope.countries = [];
+ $scope.selectedCountry = null;
+ //alert($scope.ociCountries[0].label);
+ if($scope.ociCountries)
+ $.each($scope.ociCountries, function(i, a){
+ var country = {"index":i, "value":a.value, "title":a.label};
+ $scope.countries.push(country);
+ if(a.value === $scope.profile.country){
+ $scope.selectedCountry = country;
+ }
+ });
+ ;
+
+ var stateList=${model.stateList};
+ //alert(stateList[0].label);
+ stateList = stateList== null? []: stateList;
+ var selectedState= $scope.profile.state ? $scope.profile.state:"";
+ $scope.stateList = initDropdownWithLookUp(stateList,selectedState );
+
+ $scope.saveProfile = function() {
+ var uuu = "profile/saveProfile?profile_id="+$scope.profileId;
+ var postData={profile: $scope.profile,
+ selectedCountry:$scope.selectedCountry!=null?$scope.selectedCountry.value:"",
+ selectedState:$scope.stateList.selected!=null?$scope.stateList.selected.value:"",
+ selectedTimeZone:$scope.selectedTimeZone!=null?$scope.selectedTimeZone.value:""
+ };
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ modalService.showSuccess("Success","Update Successful.");
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+ };
+
+ $scope.addNewRolePopup = function(role) {
+ $( "#dialog" ).dialog({
+ modal: true,
+ width: 500,
+ height:600
+ });
+ $(".ui-dialog-titlebar").hide();
+ };
+
+ $scope.toggleRole = function(selected,availableRole) {
+ //alert('toggleRole: '+selected);
+ if(!selected) {
+ //remove role
+ var uuu = "profile/removeRole?profile_id=" + $scope.profileId;
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to remove the role "+availableRole.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?",
+ function(){
+ var postData={role:availableRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.profile=data;});
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+ },
+ function(){
+ availableRole.selected=!availableRole.selected;
+ });
+
+ } else {
+ //add role
+ var uuu = "profile/addNewRole?profile_id=" + $scope.profileId;
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to add the role "+availableRole.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?",
+ function(){
+ var postData={role:availableRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.profile=data;});
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ },function(){
+ availableRole.selected=!availableRole.selected;
+ })
+ }
+
+
+ };
+
+ $scope.removeRole = function(role) {
+ modalService.popupConfirmWin("Confirm","You are about to remove the role "+role.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?",
+ function(){
+ var uuu = "profile/removeRole?profile_id=" + $scope.profileId;
+ var postData={role:role};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.profile=data;
+ $.each($scope.availableRoles, function(k, c){
+ if(c.id === role.id) {
+ c.selected = false;
+ }
+ });
+ });
+
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ })
+
+ };
+
+ function initDropdownWithLookUp(arr,selectedValue){
+ var dropdownArray=[];
+ var selected = null;
+ if(arr){
+ for(var i = 0,l = arr.length; i < l; i++) {
+ var option = {
+ "index" : i ,
+ "value" : arr[i].value,
+ "title" : arr[i].label
+ };
+ dropdownArray.push(option);
+ if(arr[i].value === selectedValue){
+ selected = option;
+ }
+ }
+ }
+ var dropDown={};
+ dropDown.options = dropdownArray;
+ dropDown.selected = selected;
+ return dropDown;
+ };
+
+ $scope.doRolePopup = function() {
+ var modalInstance = $modal.open({
+ templateUrl: 'roles_popup.html',
+ controller: 'rolepopupController',
+ resolve: {
+ message: function () {
+ var message ={
+ availableRoles: $scope.availableRoles
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function (opts) {
+ if(opts!=null){
+ $scope.profile=opts.profile;
+ }
+ });
+ }
+
+ $scope.close = function(){
+ $('#dialog').dialog('close');
+ }
+
+
+});
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile_search.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile_search.jsp
new file mode 100644
index 00000000..295faf03
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile_search.jsp
@@ -0,0 +1,104 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
+<div ng-controller="profileSearchController">
+ <div>
+ <h1 class="heading1" style="margin-top:20px;">Profile Search</h1>
+ <div style="margin-top:30px">
+ <table att-table table-data="tableData" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header key="id">User ID</th>
+ <th att-table-header key="last_name">Last Name</th>
+ <th att-table-header key="first_name">First Name</th>
+ <th att-table-header key="email">Email</th>
+ <th att-table-header key="orgUserId">OrgUserId</th>
+ <th att-table-header key="org_manager_userid">Manager OrgUserId</th>
+ <th att-table-header >Edit</th>
+ <th att-table-header key="active">Active?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="rowData in tableData">
+ <tr>
+ <td att-table-body >{{rowData.id}}</td>
+ <td att-table-body >{{rowData.lastName}}</td>
+ <td att-table-body >{{rowData.firstName}}</td>
+ <td att-table-body >{{rowData.email}}</td>
+ <td att-table-body >{{rowData.orgUserId}}</td>
+ <td att-table-body >{{rowData.managerId}}</td>
+ <td att-table-body ><a href="" ng-click="editRow(rowData.id)" class="ion-edit" style="color: #888;font-size:20px;"></a></td>
+ <td att-table-body >
+ <div ng-click="toggleProfileActive(rowData)">
+ <input type="checkbox" ng-model="rowData.active" att-toggle-main>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <div class="fn-ebz-container">
+ Rows Per Page:
+ <input class="fn-ebz-text" type="text" ng-model="viewPerPage" size="5" style="width: 47px;">
+ </div>
+ <div class="fn-ebz-container">
+ Current Page:
+ <input class="fn-ebz-text" type="text" ng-model="currentPage" size="5" style="width: 47px;">
+ </div>
+ <div class="fn-ebz-container">
+ Total Page(s):
+ <input class="fn-ebz-text" type="text" ng-model="totalPage" size="5" readonly="true" style="width: 47px;">
+ </div>
+</div>
+
+<script>
+app.controller("profileSearchController", function ($scope,$http,modalService, $modal) {
+ // Table Data
+ $scope.tableData=${model.profileList};
+ $scope.viewPerPage = 20;
+ $scope.scrollViewsPerPage = 2;
+ $scope.currentPage = 1;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+ // modalService.showSuccess('','Modal Sample') ;
+ for(x in $scope.tableData){
+ if($scope.tableData[x].active_yn=='Y')
+ $scope.tableData[x].active_yn=true;
+ else
+ $scope.tableData[x].active_yn=false;
+ }
+ $scope.editRow = function(profileId){
+ window.location = 'profile?profile_id=' + profileId;
+ }
+
+ $scope.toggleProfileActive = function(rowData) {
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to change user's active status. Do you want to continue?",
+ function(){
+ $http.get("profile/toggleProfileActive?profile_id="+rowData.id).success(function(){});
+ },
+ function(){
+ rowData.active=!rowData.active;
+ })
+ };
+
+});
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role.jsp
new file mode 100644
index 00000000..d8e2a01b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role.jsp
@@ -0,0 +1,286 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal_rolefunction.html" %>
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal_role.html" %>
+<style type="text/css">
+ .bc-style{
+ margin: 20px;
+ align: left;
+ }
+</style>
+<div class="bc-style">
+ <ul class="breadcrumb" >
+ <li><a href="welcome">Home</a></li>
+ <li><a href="role_list">Roles</a></li>
+ <li class="active">Role</li>
+ </ul>
+</div>
+<div class="pageTitle">
+<h3>
+ <c:choose>
+ <c:when test="${!empty param.role_id}">
+ <h1 class="heading1" style="margin-top:20px;">Role Edit</h1>
+ </c:when>
+ <c:otherwise>
+ <h1 class="heading1" style="margin-top:20px;">Role Create</h1>
+ </c:otherwise>
+ </c:choose>
+ </h3>
+</div>
+
+<div ng-controller="roleController" >
+
+ <br>
+ Please edit the role details below:&nbsp;<br>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Name:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="role.name"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Priority:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="role.priority"
+ maxlength="30" />
+ </div>
+
+ <div align="left" >
+ <button type="submit" ng-click="saveRole();" att-button
+ btn-type="primary" size="small">Save</button>
+ </div>
+
+ <br>
+ <div class="pageTitle">
+ <label>Role Functions</label>
+ <a ng-click="addNewRoleFunctionModalPopup();" class="ion-plus-round" size="small"></a>
+ </div>
+
+ <table table-data="role.roleFunctions" att-table >
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" align="left" width="90%">Name</th>
+ <th att-table-header sortable="false" width="10%">Remove?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="roleFunction in role.roleFunctions" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr>
+ <td att-table-body width="90%" >{{ roleFunction.name }}</td>
+ <td att-table-body width="10%">
+ <div ng-click="removeRoleFunction(roleFunction);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <a href="role_function_list.htm">Manage Role Functions</a><br><br>
+
+ <div class="pageTitle">
+ <label>Child Roles</label>
+ <a ng-click="addNewChildRoleModalPopup();" class="ion-plus-round" size="small"></a>
+ </div>
+
+ <table table-data="role.childRoles" att-table >
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" align="left" width="90%">Name</th>
+ <th att-table-header sortable="false" width="10%">Remove?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="role in role.childRoles" style="max-height: 980px;" >
+ <tr>
+ <td att-table-body width="90%" >{{ role.name }}</td>
+ <td att-table-body width="10%">
+ <div ng-click="removeChildRole(role);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div id="dialogChildRole" title="Select Child Roles">
+ <table table-data="availableRoles" att-table>
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" width="10%"> </th>
+ <th att-table-header sortable="false" width="90%">Role</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="availableRole in availableRoles" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr>
+ <td att-table-body width="10%">
+ <div ng-click="toggleChildRole(availableRole.selected,availableRole);">
+ <input type="checkbox" ng-model="availableRole.selected" att-toggle-main>
+ </div>
+ </td>
+ <td att-table-body width="90%">{{ availableRole.name }}</td>
+
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</div>
+
+
+
+<script>
+app.controller('roleController', function ($scope, modalService, $modal){
+ $scope.role=${role};
+ console.log($scope.role.roleFunctions);
+
+ $( "#dialogRoleFunction" ).hide();
+ $( "#dialogChildRole" ).hide();
+
+ $scope.ociavailableRoleFunctions=${availableRoleFunctions};
+
+ $scope.availableRoleFunctions = [];
+ if($scope.ociavailableRoleFunctions)
+ $.each($scope.ociavailableRoleFunctions, function(i, a){
+ var availableRoleFunction = a;
+ availableRoleFunction.selected = false;
+ $.each($scope.role.roleFunctions, function(j, b){
+ if(a.code === b.code) {
+ availableRoleFunction.selected = true;
+ }
+ });
+ $scope.availableRoleFunctions.push(availableRoleFunction);
+ });
+ ;
+
+ $scope.saveRole = function() {
+ var uuu = "role/saveRole.htm?role_id=${param.role_id}";
+ var postData={role: $scope.role, childRoles: $scope.role.childRoles, roleFunctions : $scope.role.roleFunctions};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ modalService.showSuccess("Success","Update Successful.");
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+ };
+
+ $scope.addNewRoleFunctionModalPopup = function() {
+ var modalInstance = $modal.open({
+ templateUrl: 'role_functions_popup.html',
+ controller: 'rolepopupController',
+ backdrop: 'static',
+ resolve: {
+ role: function () {
+ return $scope.role;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ console.log('response', response);
+ $scope.role=response.role;
+ });
+ };
+
+ $scope.addNewChildRoleModalPopup = function() {
+ var modalInstance = $modal.open({
+ templateUrl: 'child_roles_popup.html',
+ controller: 'rolepopupController',
+ backdrop: 'static',
+ resolve: {
+ role: function () {
+ return $scope.role;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ console.log('response', response);
+ $scope.role=response.role;
+ });
+ };
+
+
+
+ $scope.removeRoleFunction = function(roleFunction) {
+ modalService.popupConfirmWin("Confirm","You are about to remove the role function "+roleFunction.name+" from the role for "+$scope.role.name+". Do you want to continue?",
+ function(){
+ var uuu = "role/removeRoleFunction.htm?role_id=${param.role_id}";
+ var postData={roleFunction:roleFunction};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.role=data.role;
+ $.each($scope.availableRoleFunctions, function(k, c){
+ if(c.code === roleFunction.code) {
+ c.selected = false;
+ }
+ });
+ });
+
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ })
+
+ };
+
+ $scope.removeChildRole = function(childRole) {
+ modalService.popupConfirmWin("Confirm","You are about to remove the child role "+childRole.name+" from the role for "+$scope.role.name+". Do you want to continue?",
+ function(){
+ var uuu = "role/removeChildRole.htm?role_id=${param.role_id}";
+ var postData={childRole:childRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.role=data.role;
+ $.each($scope.availableRoles, function(k, c){
+ if(c.id === childRole.id) {
+ c.selected = false;
+ }
+ });
+ });
+
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ })
+ };
+});
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_function_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_function_list.jsp
new file mode 100644
index 00000000..b957337c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_function_list.jsp
@@ -0,0 +1,213 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+
+<%-- <%@ include file="/WEB-INF/fusion/jsp/include.jsp" %> --%>
+
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal_rolefunction.html" %>
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
+<div ng-controller="roleFunctionListController" >
+ <div class="pageTitle">
+
+ <h1 class="heading1" style="margin-top:20px;">Role Functions</h1>
+
+ <a ng-click="addNewRoleFunctionModalPopup();" class="ion-plus-round" size="small" ></a>
+ <br><br>
+
+ </div>
+
+ <br>
+ Click on the edit icon to update a role function, the plus icon to add additional role functions, or the delete icon to remove them.
+ <br>
+ <div id="rolesTable" title="Role Functions">
+ <table att-table table-data="availableRoleFunctions" current-page="1">
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header width="70%">Name</th>
+ <th att-table-header width="10%">Code</th>
+ <th att-table-header width="10%">Edit?</th>
+ <th att-table-header width="10%">Delete?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="availableRoleFunction in availableRoleFunctions" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr>
+ <td att-table-body width="70%">{{ availableRoleFunction.name }}</td>
+ <td att-table-body width="10%">{{ availableRoleFunction.code }}</td>
+ <td att-table-body width="10%">
+ <!-- <a ng-click="editRoleFunctionPopup(availableRoleFunction);" >
+ <img src="static/fusion/images/editicon.gif">
+ </a> -->
+ <div ng-click="editRoleFunctionModalPopup(availableRoleFunction);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-edit"></a></div>
+ </td>
+ <td att-table-body width="10%">
+ <!-- <a ng-click="removeRole(availableRoleFunction);" ><img src="static/fusion/images/deleteicon.gif"></a> -->
+ <div ng-click="removeRole(availableRoleFunction);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+<!-- <div align="left" style="marin-bottom: 50px;"> -->
+<!-- <button type="submit" onClick="window.location='role_function.htm';" att-button -->
+<!-- btn-type="primary" size="small">Create</button> -->
+<!-- </div> -->
+
+ <div id="dialog" title="Add Role Function">
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Name:</label><br>
+ <input type="text" class="fn-ebz-text" ng-model="editRoleFunction.name"
+ maxlength="30" />
+ </div>
+ <br/>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Code:</label><br>
+ <input type="text" class="fn-ebz-text" ng-model="editRoleFunction.code" ng-disabled="editRoleFunction.code!=null"
+ maxlength="30" />
+ </div>
+ <br/>
+ <button type="submit" ng-click="saveRoleFunction(editRoleFunction);" att-button
+ btn-type="primary" size="small">Save</button>
+
+ </div>
+
+</div>
+
+
+
+
+<script>
+app.controller('roleFunctionListController', function ($scope, modalService, $modal){
+ $( "#dialog" ).hide();
+ $scope.availableRoleFunctions=${availableRoleFunctions};
+
+
+ $scope.editRoleFunction = null;
+ var dialog = null;
+ $scope.editRoleFunctionPopup = function(availableRoleFunction) {
+ $scope.editRoleFunction = availableRoleFunction;
+ $( "#dialog" ).dialog({
+ modal: true
+ });
+ };
+
+ $scope.editRoleFunctionModalPopup = function(availableRoleFunction) {
+ $scope.editRoleFunction = availableRoleFunction;
+ var modalInstance = $modal.open({
+ templateUrl: 'edit_role_function_popup.html',
+ controller: 'rolefunctionpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ availableRoleFunction: $scope.editRoleFunction
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ console.log('response', response);
+ $scope.availableRoleFunctions=response.availableRoleFunctions;
+ });
+ };
+
+ $scope.addNewRoleFunctionModalPopup = function(availableRoleFunction) {
+ $scope.editRoleFunction = null;
+ var modalInstance = $modal.open({
+ templateUrl: 'edit_role_function_popup.html',
+ controller: 'rolefunctionpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ availableRoleFunction: $scope.editRoleFunction
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ console.log('response', response);
+ $scope.availableRoleFunctions=response.availableRoleFunctions;
+ });
+ };
+
+ $scope.addNewRoleFunctionPopup = function() {
+ $scope.editRoleFunction = null;
+ $( "#dialog" ).dialog({
+ modal: true
+ });
+ };
+
+ $scope.saveRoleFunction = function(availableRoleFunction) {
+ var uuu = "role_function_list/saveRoleFunction.htm";
+ var postData={availableRoleFunction: availableRoleFunction};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.availableRoleFunctions=[];$scope.$apply();
+ $scope.availableRoleFunctions=data.availableRoleFunctions;});
+ //alert("Update Successful.") ;
+ console.log($scope.availableRoleFunctions);
+
+ $scope.editRoleFunction = null;
+ $( "#dialog" ).dialog("close");
+ },
+ error : function(data){
+ alert("Error while saving.");
+ }
+ });
+ };
+
+
+ $scope.removeRole = function(availableRoleFunction) {
+ modalService.popupConfirmWin("Confirm","You are about to delete the role function "+availableRoleFunction.name+". Do you want to continue?",
+ function(){
+ var uuu = "role_function_list/removeRoleFunction.htm";
+ var postData={availableRoleFunction: availableRoleFunction};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.availableRoleFunctions=data.availableRoleFunctions;});
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while deleting: "+ data.responseText);
+ }
+ });
+
+ })
+ };
+
+
+});
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_list.jsp
new file mode 100644
index 00000000..c27c360b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_list.jsp
@@ -0,0 +1,139 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+
+<%-- <%@ include file="/WEB-INF/fusion/jsp/include.jsp" %> --%>
+
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
+
+<div class="pageTitle">
+ <h1 class="heading1" style="margin-top:20px;">Roles</h1>
+</div>
+<br>
+Click on a Role to view its details.
+
+<div ng-controller="roleListController" >
+ <div id="dialog" title="Roles">
+ <table att-table table-data="availableRoles" current-page="1">
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header width="70%">Name</th>
+ <th att-table-header width="10%">Priority</th>
+ <th att-table-header width="10%">Active?</th>
+ <th att-table-header width="10%">Delete?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="availableRole in availableRoles" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+<!-- <tr ng-repeat="availableRole in availableRoles track by availableRole.id"> -->
+ <tr>
+ <td width="70%"><a href="role.htm?role_id={{availableRole.id}}">{{ availableRole.name }}</a></td>
+ <td width="10%">{{ availableRole.priority }}</td>
+ <td width="10%">
+ <div ng-click="toggleRole(availableRole.active,availableRole);">
+ <input type="checkbox" ng-model="availableRole.active" att-toggle-main>
+ </div>
+ </td>
+ <td att-table-body width="10%">
+ <div ng-click="removeRole(availableRole);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <div align="left" style="marin-bottom: 50px;">
+ <button type="submit" onClick="window.location='role.htm';" att-button
+ btn-type="primary" size="small">Create</button>
+ </div>
+
+</div>
+
+
+
+
+<script>
+app.controller('roleListController', function ($scope,modalService){
+
+ $scope.availableRoles=${availableRoles};
+ //console.log($scope.availableRoles);
+ $scope.toggleRole = function(selected,availableRole) {
+ //alert('toggleRole: '+selected);
+ var toggleType = null;
+ if(selected) {
+ toggleType = "activate";
+ } else {
+ toggleType = "inactivate";
+ }
+
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to "+toggleType+" the test role "+availableRole.name+". Do you want to continue?",
+ function(){
+ var uuu = "role_list/toggleRole";
+
+ var postData={role:availableRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ console.log(data);
+ $scope.$apply(function(){$scope.availableRoles=data.availableRoles;});
+ console.log($scope.availableRoles);
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ },
+ function(){
+ availableRole.active=!availableRole.active;
+ })
+
+ };
+
+ $scope.removeRole = function(role) {
+ modalService.popupConfirmWin("Confirm","You are about to delete the role "+role.name+". Do you want to continue?",
+ function(){
+ var uuu = "role_list/removeRole";
+ var postData={role:role};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.availableRoles=data.availableRoles;});
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while deleting: "+ data.responseText);
+ }
+ });
+
+ })
+ };
+});
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/usage_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/usage_list.jsp
new file mode 100644
index 00000000..699c1ce6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/usage_list.jsp
@@ -0,0 +1,87 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+
+<%-- <%@ include file="/WEB-INF/fusion/jsp/include.jsp" %> --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
+
+<div ng-controller="usageListController" >
+ <div class="pageTitle">
+ <h3>
+ Usage
+ </h3>
+ </div>
+ <br/>
+ The following shows all users currently logged into the application. Click the icon to expel a user from the application.
+
+ <div title="Current User Sessions">
+ <table att-table table-data="users" current-page="1">
+
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" width="10%" align="left">Current User Sessions</th>
+ <th att-table-header sortable="false" width="10%" align="center"></th>
+ <th att-table-header sortable="false" width="10%" align="center"></th>
+ <th att-table-header sortable="false" width="10%" align="center"></th>
+ <th att-table-header sortable="false" width="10%" align="center"></th>
+ <th att-table-header sortable="false" width="10%" align="center"></th>
+ </tr>
+ <tr>
+ <th att-table-header sortable="false" width="10%" align="center">User Id</th>
+ <th att-table-header sortable="false" width="10%" align="center">User Name</th>
+ <th att-table-header sortable="false" width="10%" align="center">Email</th>
+ <th att-table-header sortable="false" width="10%" align="center">Last Access Time (minutes)</th>
+ <th att-table-header sortable="false" width="10%" align="center">Time Remaining (minutes)</th>
+ <th att-table-header sortable="false" width="10%" align="center">Expel?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="user in users" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr>
+ <td att-table-body width="10%">{{user.id}}</td>
+ <td att-table-body width="10%">{{user.lastName}}</td>
+ <td att-table-body width="10%">{{user.email}}</td>
+ <td att-table-body width="10%">{{user.lastAccess}}</td>
+ <td att-table-body width="10%">{{user.remaining}}</td>
+ <td att-table-body width="10%"><div ng-hide="user.delete=='yes'">Current Session</div>
+ <div ng-click="removeSession(user.sessionId);" ng-hide="user.delete=='no'" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</div>
+
+
+
+
+<script>
+app.controller('usageListController', function ($scope,$interval,$http,$modal,modalService){
+
+ $scope.users=${model};console.log($scope.users);
+ $scope.removeSession = function(sessionId) {
+ modalService.popupConfirmWin("Confirm","You are about to expel this user from the application. All of their unsaved data will be lost. Do you want to continue?",
+ function(){
+ $http.get("usage_list/removeSession?deleteSessionId="+sessionId).success(function(response){$scope.users=response;});
+ });
+ }
+});
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/webrtc/collaboration.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/webrtc/collaboration.jsp
new file mode 100644
index 00000000..ff6c985e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/webrtc/collaboration.jsp
@@ -0,0 +1,492 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+
+
+<!DOCTYPE html>
+
+<html xmlns="http://www.w3.org/1999/xhtml" ng-app="abs">
+<head>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <link type="text/css" rel="stylesheet" href="app/fusion/styles/layout/layout-default-latest.css" />
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/btn.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/fn-ebz.css" >
+ <style type="text/css">
+ /*
+ * NOTE: All CSS is purely cosmetic - it does not affect functionality
+ * http://layout.jquery-dev.com/demos.cfm
+ */
+
+ /* customize borders to avoid double-borders around inner-layouts */
+ .ui-layout-pane {
+ border: 0; /* override layout-default-latest.css */
+ border-top: 1px solid #BBB;
+ border-bottom: 1px solid #BBB;
+ }
+ .ui-layout-pane-north ,
+ .ui-layout-pane-south {
+ border: 1px solid #BBB;
+ overflow: auto;
+ }
+ .ui-layout-pane-west ,
+ .ui-layout-pane-east {
+ }
+ .ui-layout-pane-center {
+ border-left: 0;
+ border-right: 0;
+ }
+ .inner-center {
+ border: 1px solid #BBB;
+ }
+
+ /* add shading to outer sidebar-panes */
+ .outer-west ,
+ .outer-east {
+ background-color: #EEE;
+ }
+ .middle-west ,
+ .middle-east {
+ background-color: #F8F8F8;
+ }
+
+ /* remove padding & scrolling from panes that are 'containers' for nested layouts */
+ .outer-center ,
+ .middle-center {
+ border: 0; /* cosmetic */
+ padding: 0;
+ overflow: auto;
+ }
+
+ /*
+ * customize borders on panes/resizers to make pretty
+ */
+ .ui-layout-pane-west { border-right: 0; }
+ .ui-layout-resizer-west { border-left: 1px solid #BBB; }
+ .ui-layout-pane-east { border-left: 0; }
+ .ui-layout-resizer-east { border-right: 1px solid #BBB; }
+ .ui-layout-pane-north { border-bottom: 0; }
+ .ui-layout-resizer-north { border-top: 1px solid #BBB; }
+ .ui-layout-pane-south { border-top: 0; }
+ .ui-layout-resizer-south { border-bottom: 1px solid #BBB; }
+ /*
+ * add borders to resizers when pane is 'closed'
+ *
+ *.ui-layout-resizer-closed { border: 1px solid #BBB; }
+ */
+ /*
+ * show both borders when the resizer is 'dragging'
+ */
+ .ui-layout-resizer-west-dragging ,
+ .ui-layout-resizer-east-dragging {
+ border-left: 1px solid #BBB;
+ border-right: 1px solid #BBB;
+ }
+ .ui-layout-resizer-north-dragging ,
+ .ui-layout-resizer-south-dragging {
+ border-top: 1px solid #BBB;
+ border-bottom: 1px solid #BBB;
+ }
+
+
+ /*
+ layout toggler background image
+ */
+ .ui-layout-toggler-west, .ui-layout-toggler-east {
+ border-width: 1px 0;
+ background-image: url("static/fusion/images/layout/panel-e-w-toggle.png");
+ background-size: 10px 10px;
+ background-repeat: no-repeat;
+ background-position: center;
+ }
+
+ .ui-layout-toggler-north, .ui-layout-toggler-south {
+ border-width: 0 1px;
+ background-image: url("static/fusion/images/layout/panel-n-s-toggle.png");
+ background-size: 10px 10px;
+ background-repeat: no-repeat;
+ background-position: center;
+ }
+
+ body{background-color:#fff;font-size:14px;font-size:.875rem;margin:0;padding:0px 0 20px;position:relative}
+
+ </style>
+
+
+ <!-- LAYOUT v 1.3.0 -->
+ <script type="text/javascript" src="app/fusion/scripts/layout/jquery-latest.js"></script>
+ <script type="text/javascript" src="app/fusion/scripts/layout/jquery-ui-latest.js"></script>
+ <script type="text/javascript" src="app/fusion/scripts/layout/jquery.layout-latest.js"></script>
+ <script type="text/javascript" src="app/fusion/scripts/webrtc/RTCMultiConnection.js"></script>
+ <script type="text/javascript" src="app/fusion/scripts/socket/peerBroadcast.js"></script>
+ <script type="text/javascript" src="app/fusion/scripts/layout/debug.js"></script>
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/fn-ebz.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css" >
+
+ <script src= "app/fusion/external/ebz/angular_js/angular.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/angular-route.min.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/angular-sanitize.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/app.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/gestures.js"></script>
+
+ <%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
+ <script src="app/fusion/scripts/modalService.js"></script>
+ <script src="app/fusion/external/ebz/sandbox/att-abs-tpls.js" type="text/javascript"></script>
+ <script src="app/fusion/scripts/att_angular_gridster/ui-gridster-tpls.js"></script>
+ <script src="app/fusion/scripts/att_angular_gridster/angular-gridster.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/checklist-model.js"></script>
+ <style>
+ body{background-color:#fff;font-size:14px;font-size:.875rem;margin:0;padding:0px 0 20px;position:relative}
+ </style>
+
+ <script type="text/javascript">
+
+
+ var popupModalService;
+
+ app.controller("collaborationController", function ($scope,$http,modalService, $modal) {
+ popupModalService = modalService;
+
+ });
+
+
+ $(document).ready(function () {
+
+ // OUTER-LAYOUT
+ panelLayout = $('body').layout({
+ center__paneSelector: ".outer-center"
+ , west__paneSelector: ".outer-west"
+ , east__paneSelector: ".outer-east"
+ //, west__size: 800
+ //, east__size: 125
+ , spacing_open: 8 // ALL panes
+ , spacing_closed: 12 // ALL panes
+
+ , center__childOptions: {
+ center__paneSelector: ".inner-center"
+ , west__paneSelector: ".inner-west"
+ , east__paneSelector: ".inner-east"
+ , west__size: 75
+ , east__size: 75
+ , spacing_open: 8 // ALL panes
+ , spacing_closed: 8 // ALL panes
+ , west__spacing_closed: 12
+ , east__spacing_closed: 12
+ }
+
+
+
+
+ });
+
+
+ function initializeConnections() {
+
+ var channelId = null;
+ channelId = location.href.replace(/\/|:|#|%|\.|\[|\]/g, '');
+ var videoChannelId = channelId.concat("video");
+ var screenChannelId = channelId.concat("screen");
+
+ videoConnection = new RTCMultiConnection(videoChannelId);
+ screenConnection = new RTCMultiConnection(screenChannelId);
+
+ configConnection(videoConnection,true,true,false,true,false);
+ configConnection(screenConnection,false,false,true,false,true);
+
+ };
+
+ function configConnection(_connection, _audio, _video, _screen, _data, _oneway) {
+ _connection.session = {
+ audio: _audio, // by default, it is true
+ video: _video, // by default, it is true
+ screen: _screen,
+ data: _data,
+ oneway: _oneway,
+ broadcast: false
+ };
+
+ _connection.direction = "one-to-one";
+
+ if( _data == true ) {
+ _connection.onmessage = function(e) {
+ appendDIV(e.data);
+
+ console.debug(e.userid, 'posted', e.data);
+ console.log('latency:', e.latency, 'ms');
+ };
+ }
+
+
+ };
+
+ function assignStreamToDom() {
+
+
+ screenConnection.screenbody = document.querySelector('.screenContainer1');
+ screenConnection.videobody = document.querySelector('.videoContainer2');
+
+ videoConnection.screenbody = document.querySelector('.screenContainer2');
+ videoConnection.videobody = document.querySelector('.videoContainer1');
+ };
+
+ function maximizeLayout() {
+
+ // open the panes and maximize the window.
+ top.window.resizeTo(screen.availWidth,screen.availHeight);
+ panelLayout.open('west');
+ // panelLayout.open('south'); is not working due to state initialization problem; debug to find out. so replacing the call with work around below - hack.
+ $(".ui-layout-toggler-south-closed").first().click();
+
+ };
+
+ function minimizeLayout() {
+
+ // close the panes and minimize the window.
+ top.window.resizeTo(screen.availWidth - 2*screen.availWidth/3, screen.availHeight - screen.availHeight/2);
+ panelLayout.close('west');
+ // panelLayout.close('south'); is not working due to state initialization problem; debug to find out. so replacing the call with work around below - hack.
+ $(".ui-layout-toggler-south-opened").first().click();
+ };
+
+ function emptyContainers() {
+ $('.screenContainer1').empty();
+ $('.videoContainer2').empty();
+
+ $('.screenContainer2').empty();
+ $('.videoContainer1').empty();
+ };
+
+ function appendDIV(div, parent) {
+ if (typeof div === 'string') {
+ var content = div;
+ div = document.createElement('div');
+ div.innerHTML = content;
+ };
+
+ var chatOutput = document.getElementById('chat-output'),
+ fileProgress = document.getElementById('file-progress');
+
+ if (!parent) chatOutput.insertBefore(div, chatOutput.firstChild);
+ else fileProgress.insertBefore(div, fileProgress.firstChild);
+
+ div.tabIndex = 0;
+ $('#chat-input').focus();
+ };
+
+ function confirmClose() {
+ var message = "Are you sure you want to close the session?";
+
+ if(popupModalService != undefined) {
+ popupModalService.popupConfirmWin("Confirm", message, function(){ location.reload();});
+ }
+
+ else if (confirm(message) == true) {
+ location.reload();
+ //window.opener.location.reload(); // go to the parent window
+ //close();
+ } else {
+ // do nothing
+ }
+
+ };
+
+ function notifyOthers() {
+
+ // var websocket = localStorage.getItem('notifySocket');
+ //if( websocket != null) {
+ // handling websocket peer broadcast session
+ var currentUser = "${sessionScope.user.orgUserId}";
+ var initialPageVisit = "${sessionScope.initialPageVisit}";
+ var remoteUser = '';
+
+ var userList = location.search.split('chat_id=')[1].split('-');
+ for(var i=0;i<userList.length;i++) {
+ if(userList[i] !== currentUser) {
+ remoteUser = userList[i];
+ break;
+ }
+ }
+
+ socketSetup(initialPageVisit, currentUser, remoteUser,"socketSend");
+
+
+
+
+
+
+ };
+
+ function makeChatVisible() {
+
+ $('#chat-input').css("visibility", 'visible');
+ };
+
+
+
+ /* on click button enabled*/
+ document.getElementById('share-screen').onclick = function() {
+
+ emptyContainers();
+ videoConnection.close();
+ screenConnection.close();
+
+ maximizeLayout();
+ emptyContainers();
+ makeChatVisible();
+
+ videoConnection.open();
+ screenConnection.open();
+
+
+ notifyOthers();
+
+
+
+ };
+
+ document.getElementById('stop-share-screen').onclick = function() {
+
+ emptyContainers();
+
+ videoConnection.close();
+ screenConnection.close();
+
+ confirmClose();
+
+ };
+
+ document.getElementById('view-screen').onclick = function() {
+
+ maximizeLayout();
+ emptyContainers();
+ makeChatVisible();
+
+ // timeout is required for the sharing to properly work
+ setTimeout(function() {
+ screenConnection.connect();
+ },2000);
+ setTimeout(function() {
+ videoConnection.connect();
+ },1000);
+
+
+ };
+
+ document.getElementById('chat-input').onkeypress = function(e) {
+ if (e.keyCode !== 13 || !this.value) return;
+ var message = "<b>${model.name}</b>: " + this.value;
+ appendDIV(message);
+
+ // sending text message
+ videoConnection.send(message);
+
+ this.value = '';
+ };
+
+ /*
+ document.getElementById('file').onchange = function() {
+ videoConnection.send(this.files[0]);
+ };
+ */
+
+
+ //document.querySelector('.screenContainerPane').appenChild(document.querySelector('.screenContainer'));
+ //document.querySelector('.videoContainerPane').appendChild(document.querySelector('.videoContainer'));
+
+ //panelLayout.bindButton($('#share-screen'), 'open', 'outer-west');
+ //panelLayout.bindButton($('#stop-share-screen'), 'close', 'outer-west');
+ var videoConnection = null, screenConnection = null;
+ initializeConnections();
+ assignStreamToDom();
+
+ // start the share
+ //document.getElementById('share-screen').click();
+ //
+ });
+
+
+</script>
+
+
+</head>
+
+<body>
+<!--
+ <button id="share-screen" hidden="true" style="display: none;" class="setup">Share Your Screen</button>
+ <button id="stop-share-screen" hidden="true" style="display: none;" class="setup">Stop Share Your Screen</button>
+ <button id="view-screen" hidden="true" style="display: none;" class="setup">View My Screen</button>
+
+ -->
+
+<div class="outer-center" style="position: absolute; left: 12px; right: 0px; top: 0px;bottom: 0px;">
+ <div class="inner-center">
+
+ <!-- <jsp:include page="/WEB-INF/fusion/zul/chatOne.zul" /> -->
+
+
+
+ <table style="width: 100%;">
+ <tbody><tr>
+ <td>
+ <button id="share-screen" class="button button--primary button--small setup">Start Session</button>
+ <button id="stop-share-screen" class="button button--primary button--small setup">Stop Session</button>
+ <button id="view-screen" class="button button--primary button--small setup">View</button>
+
+ </td>
+
+ </tr>
+ </tbody>
+
+ <tbody><tr>
+ <td>
+ <input type="text" id="chat-input" style="font-size: 1.2em;visibility:collapse;" placeholder="type here.."/>
+ <div id="chat-output"></div>
+ </td>
+ <!--
+ <td style="background: white;">
+ <input type="file" id="file">
+ <div id="file-progress"></div>
+ </td>
+ -->
+ </tr>
+ </tbody>
+ </table>
+
+
+ </div>
+ <div id="inner-south" class="ui-layout-south">
+ <div class="videoContainer1"></div>
+ <div class="videoContainer2"></div>
+
+ </div>
+</div>
+
+<div class="outer-west">
+ <div class="screenContainer1"></div>
+ <div class="screenContainer2"></div>
+ <div ng-controller="collaborationController">
+ </div>
+</div>
+
+
+
+
+
+</body>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml
new file mode 100644
index 00000000..28060a7c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml
@@ -0,0 +1,352 @@
+<?xml version="1.0"?>
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.openecomp.portalsdk.core.domain">
+
+ <!-- User class mapping details -->
+ <class name="User" table="FN_USER">
+ <id name="id" column="user_id" >
+ <generator class="native">
+ <param name="sequence">seq_fn_user</param>
+ </generator>
+ </id>
+
+ <property name="orgId" column="org_id"/>
+ <property name="managerId" column="manager_id"/>
+ <property name="firstName" column="first_name"/>
+ <property name="middleInitial" column="middle_name"/>
+ <property name="lastName" column="last_name"/>
+ <property name="phone" column="phone"/>
+ <property name="fax" column="fax"/>
+ <property name="cellular" column="cellular"/>
+ <property name="email" column="email"/>
+ <property name="addressId" column="address_id"/>
+ <property name="alertMethodCd" column="alert_method_cd"/>
+
+ <property name="address1" column="address_line_1"/>
+ <property name="address2" column="address_line_2"/>
+ <property name="city" column="city"/>
+ <property name="state" column="state_cd"/>
+ <property name="zipCode" column="zip_code"/>
+ <property name="country" column="country_cd"/>
+
+ <property name="hrid" column="hrid"/>
+ <property name="orgUserId" column="org_user_id"/>
+ <property name="orgCode" column="org_code"/>
+ <property name="loginId" column="login_id"/>
+ <property name="loginPwd" column="login_pwd"/>
+ <property name="lastLoginDate" column="last_login_date" type="timestamp"/>
+
+ <property name="locationClli" column="location_clli" />
+ <property name="orgManagerUserId" column="org_manager_userid" />
+ <property name="company" column="company" />
+ <property name="department" column="department" />
+ <property name="departmentName" column="department_name" />
+ <property name="businessUnit" column="business_unit" />
+ <property name="businessUnitName" column="business_unit_name" />
+ <property name="jobTitle" column="job_title" />
+ <property name="siloStatus" column="silo_status" />
+ <property name="financialLocCode" column="fin_loc_code" />
+
+ <property name="active" column="active_yn" type="yes_no"/>
+ <property name="internal" column="is_internal_yn" type="yes_no"/>
+
+ <property name="created" type="timestamp" column="created_date" />
+ <property name="modified" type="timestamp" column="modified_date" />
+
+ <property name="createdId" column="created_id" />
+ <property name="modifiedId" column="modified_id" />
+ <property name="timeZoneId" column="timezone" />
+
+ <set name="userApps" table="FN_USER_ROLE" lazy="false" sort="natural" inverse="true" cascade="all-delete-orphan">
+ <key column="user_id"/>
+ <one-to-many class="org.openecomp.portalsdk.core.domain.UserApp" />
+ </set>
+
+ <set name="pseudoRoles" table="FN_USER_PSEUDO_ROLE" lazy="false" sort="natural">
+ <key column="user_id"/>
+ <many-to-many column="pseudo_role_id" class="org.openecomp.portalsdk.core.domain.Role" />
+ </set>
+ </class>
+
+ <!-- Profile class mapping details;
+ dupe of User class, but fewer fields -->
+ <class name="Profile" table="FN_USER">
+ <id name="id" column="user_id" >
+ <generator class="increment"/>
+ </id>
+ <property name="first_name" column="first_name"/>
+ <property name="last_name" column="last_name"/>
+ <property name="email" column="email"/>
+ <property name="orgManagerUserId" column="org_manager_userid" />
+ <property name="active_yn" column="active_yn"/>
+ <property name="orgUserId" column="org_user_id"/>
+ </class>
+
+ <class name="UserApp" table="fn_user_role">
+ <composite-id>
+ <key-property name="userId" type="long">
+ <column name="user_id" precision="11" scale="0" />
+ </key-property>
+ <key-many-to-one name="app" class="org.openecomp.portalsdk.core.domain.App" column="app_id" />
+ <key-many-to-one name="role" class="org.openecomp.portalsdk.core.domain.Role" column="role_id" />
+ </composite-id>
+ <property name="priority" type="java.lang.Short">
+ <column name="priority" precision="4" scale="0" />
+ </property>
+ </class>
+
+ <!-- App class mapping details -->
+ <class name="App" table="fn_app">
+ <id name="id" column="app_id"/>
+ <property name="name" column="app_name"/>
+ <property name="appPassword" column="app_password"/>
+ <property name="username" column="app_username"/>
+ <property name="imageUrl" column="app_image_url"/>
+ <property name="description" column="app_description"/>
+ <property name="notes" column="app_notes"/>
+ <property name="url" column="app_url"/>
+ <property name="alternateUrl" column="app_alternate_url"/>
+ <property name="restEndpoint" column="app_rest_endpoint"/>
+ <property name="mlAppName" column="ml_app_name"/>
+ <property name="mlAppAdminId" column="ml_app_admin_id"/>
+ <property name="motsId" column="mots_id"/>
+ <property name="open" column="open"/>
+ <property name="enabled" column="enabled"/>
+ <property name="thumbnail" column="thumbnail" type="blob"/>
+ <property name="uebKey" column="ueb_key"/>
+ <property name="uebSecret" column="ueb_secret"/>
+ <property name="uebTopicName" column="ueb_topic_name"/>
+ </class>
+
+
+ <!-- Audit Log class mapping details -->
+ <class name="AuditLog" table="fn_audit_log">
+ <id name="id" column="log_id">
+ <!-- <generator class="sequence">
+ <param name="sequence">seq_fn_audit_log</param>
+ </generator> -->
+ <generator class="native">
+ <param name="sequence">seq_fn_audit_log</param>
+ </generator>
+ </id>
+ <property name="activityCode" column="activity_cd"/>
+ <property name="affectedRecordId" column="affected_record_id" />
+ <property name="comments" column="comments" />
+ <property name="createdId" column="user_id" />
+ </class>
+
+ <!-- User Role class mapping details -->
+ <class name="Role" table="FN_ROLE">
+ <id name="id" column="role_id">
+ <generator class="native">
+ <param name="sequence">seq_fn_role</param>
+ </generator>
+ </id>
+
+ <property name="name" column="role_name"/>
+ <property name="priority" column="priority" />
+ <property name="active" column="active_yn" type="yes_no"/>
+
+ <set name="roleFunctions" table="FN_ROLE_FUNCTION" lazy="false" sort="natural">
+ <key column="role_id"/>
+ <many-to-many column="function_cd" class="org.openecomp.portalsdk.core.domain.RoleFunction"/>
+ </set>
+
+ <set name="childRoles" table="FN_ROLE_COMPOSITE" lazy="false" sort="natural">
+ <key column="parent_role_id"/>
+ <many-to-many column="child_role_id" class="org.openecomp.portalsdk.core.domain.Role"/>
+ </set>
+
+ <set name="parentRoles" table="FN_ROLE_COMPOSITE" lazy="false" sort="natural">
+ <key column="child_role_id"/>
+ <many-to-many column="parent_role_id" class="org.openecomp.portalsdk.core.domain.Role"/>
+ </set>
+
+ </class>
+
+
+
+ <!-- User Role Function class mapping details -->
+ <class name="RoleFunction" table="FN_FUNCTION">
+ <id name="code" column="function_cd" />
+ <property name="name" column="function_name" />
+ </class>
+
+ <!-- Menu class mapping details -->
+ <class name="Menu" table="FN_MENU">
+ <id name="id" column="menu_id">
+ <generator class="native">
+ <param name="sequence">seq_fn_menu</param>
+ </generator>
+ </id>
+
+ <!-- <property name="menuLevel" column="level-1"/> -->
+ <property name="label" column="label"/>
+ <property name="parentId" column="parent_id"/>
+ <property name="action" column="action"/>
+ <property name="functionCd" column="function_cd"/>
+ <property name="sortOrder" column="sort_order"/>
+ <property name="servlet" column="servlet"/>
+ <property name="queryString" column="query_string"/>
+ <property name="externalUrl" column="external_url"/>
+ <property name="target" column="target"/>
+ <property name="menuSetCode" column="menu_set_cd"/>
+ <property name="active" column="active_yn" type="yes_no"/>
+ <property name="separator" column="separator_yn" type="yes_no"/>
+ <property name="imageSrc" column="image_src" />
+ </class>
+
+ <class name="MenuData" table="FN_MENU">
+ <!-- <id name="id" column="menu_id"/> -->
+ <id name="id" column="menu_id">
+ <generator class="native">
+ <param name="sequence">seq_fn_menu</param>
+ </generator>
+ </id>
+ <property name="label" column="label"/>
+ <property name="action" column="action"/>
+ <property name="functionCd" column="function_cd"/>
+ <property name="sortOrder" column="sort_order"/>
+ <property name="servlet" column="servlet"/>
+ <property name="queryString" column="query_string"/>
+ <property name="externalUrl" column="external_url"/>
+ <property name="target" column="target"/>
+ <property name="active" column="active_yn" type="yes_no"/>
+ <property name="separator" column="separator_yn" type="yes_no"/>
+ <property name="imageSrc" column="image_src" />
+ <property name="menuSetCode" column="menu_set_cd" />
+
+ <many-to-one name="parentMenu" column="parent_id" class="MenuData"/>
+
+ <set name="childMenus" lazy="false" sort="natural" inverse="true" where="active_yn = 'Y'">
+ <key column="parent_id"/>
+ <one-to-many class="MenuData"/>
+ </set>
+ </class>
+
+ <!-- Broadcast Message class mapping details -->
+ <class name="BroadcastMessage" table="fn_broadcast_message">
+ <id name="id" column="message_id">
+ <generator class="native">
+ <param name="sequence">seq_fn_broadcast_message</param>
+ </generator>
+ </id>
+ <property name="messageText" column="message_text"/>
+ <property name="locationId" column="message_location_id"/>
+
+ <property name="startDate" column="broadcast_start_date" type="timestamp"/>
+ <property name="endDate" column="broadcast_end_date" type="timestamp"/>
+
+ <property name="sortOrder" column="sort_order"/>
+ <property name="active" column="active_yn" type="yes_no"/>
+
+ <property name="siteCd" column="broadcast_site_cd" />
+ </class>
+
+ <!-- State Lookup class mapping details -->
+ <class name="LuState" table="FN_LU_STATE">
+ <id name="abbr" column="state_cd" />
+ <property name="state" />
+ </class>
+
+ <!-- Country Lookup class mapping details -->
+ <class name="LuCountry" table="FN_LU_COUNTRY">
+ <id name="abbr" column="country_cd" />
+ <property name="country" />
+ <property name="fullName" column="full_name" />
+ <property name="webphoneCountryLabel" column="fullwebphone_country_label_name" />
+ </class>
+
+ <class name="LuTimeZone" table="FN_LU_TIMEZONE">
+ <id name="timezoneId" column="timezone_id" />
+ <property name="name" column="timezone_name" />
+ <property name="value" column="timezone_value" />
+ </class>
+
+
+ <!-- Lookup (id/value bean) class mapping details -->
+ <class name="Lookup">
+ <composite-id name="nameValueId" class="org.openecomp.portalsdk.core.domain.support.NameValueId">
+ <key-property name="val"/>
+ <key-property name="lab" />
+ </composite-id>
+ </class>
+
+ <class name="UrlsAccessible" table="V_URL_ACCESS">
+ <composite-id name="urlsAccessibleKey" class="org.openecomp.portalsdk.core.domain.UrlsAccessibleKey">
+ <key-property name="url" column="url"/>
+ <key-property name="functionCd" column="function_cd"/>
+ </composite-id>
+ </class>
+
+
+ <query name="ParentIdForLabelList">
+ select distinct md.parentMenu.id from MenuData as md where md.label = :paramLabel and md.label is not null
+ </query>
+
+ <query name="IdForLabelList">
+ select distinct md.id from MenuData as md where md.label = :paramLabel
+ </query>
+
+ <query name="parentList">
+ select distinct md.id, md.label, md.parentMenu.id from MenuData as md where md.label is not null
+ </query>
+
+ <query name="functionCDlistOld">
+ select distinct functionCd from MenuData
+ </query>
+
+ <query name="functionCDlist">
+ select distinct code from RoleFunction
+ </query>
+
+ <query name="menuData">
+ from MenuData where menuSetCode = :menu_set_cd and parentMenu is null
+ </query>
+ <query name="restrictedUrls">
+ FROM UrlsAccessible A where upper(A.urlsAccessibleKey.url) = upper(:current_url)
+ </query>
+
+ <query name="getUserNameById">
+ select firstName, lastName from User where id = :user_id
+ </query>
+
+ <query name="getUserEmail">
+ select email from User where id = :user_id
+ </query>
+
+ <query name="getAllUsers">
+ select id, firstName, lastName from User where active = true order by lastName, firstName
+ </query>
+
+ <query name="getRoleNameById">
+ select name from Role where id = :role_id
+ </query>
+
+ <query name="getAllRoles">
+ select id, name from Role order by name
+ </query>
+</hibernate-mapping>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/RNoteBookIntegration.hbm.xml b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/RNoteBookIntegration.hbm.xml
new file mode 100644
index 00000000..6638b4bc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/RNoteBookIntegration.hbm.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.openecomp.portalsdk.rnotebookintegration.domain">
+
+
+ <!-- RNotebookIntegration mapping details -->
+ <class name="RNoteBookCredentials" table="rcloudinvocation">
+ <id name="token" column="ID">
+
+ </id>
+ <property name="createdDate" column="created"/>
+ <property name="userString" column="userInfo"/>
+ <property name="notebookID" column="notebookID"/>
+ <property name="parametersString" column="parameters"/>
+ <property name="tokenReadDate" column="tokenreaddate"/>
+
+ </class>
+
+
+
+</hibernate-mapping>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Workflow.hbm.xml b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Workflow.hbm.xml
new file mode 100644
index 00000000..3d8852cb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Workflow.hbm.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.openecomp.portalsdk.workflow.domain">
+
+
+ <!-- WorkflowSchedule mapping details -->
+ <class name="WorkflowSchedule" table="fn_schedule_workflows">
+ <id name="id" column="id_schedule_workflows">
+ <generator class="native">
+ </generator>
+ </id>
+
+ <property name="serverUrl" column="workflow_server_url"/>
+ <property name="workflowKey" column="workflow_key"/>
+ <property name="arguments" column="workflow_arguments"/>
+ <property name="cronDetails" column="startDateTimeCron"/>
+ <property name="startDateTime" column="start_date_time"/>
+ <property name="endDateTime" column="endDateTime"/>
+ <property name="recurrence" column="recurrence"/>
+
+ </class>
+
+
+
+</hibernate-mapping>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_header_include.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_header_include.jsp
new file mode 100644
index 00000000..0bd373b7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_header_include.jsp
@@ -0,0 +1,135 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+
+<%@ page import="java.net.*" %>
+
+
+<script src='dwr/engine.js'></script>
+<script src='dwr/util.js'></script>
+<script src='dwr/interface/fusionAjax.js'></script>
+
+<%@ include file="/WEB-INF/fusion/jsp/include.jsp" %>
+
+<%
+ String url = request.getParameter("returnUrl");
+
+ if (url != null) {
+ request.setAttribute("returnUrl", URLDecoder.decode(url, "UTF-8"));
+ }
+
+%>
+
+<BODY height="100%">
+<form name="listForm" action="<%=request.getAttribute("returnUrl")%>" method="POST" target="_parent">
+ <input type="hidden" name="selected" value=""/>
+</form>
+
+
+<!-- Submit record action functionality -->
+<script type="text/javascript">
+ function submitAction(actionUrl, task, actionUrlParameters) {
+
+ var formFieldParameters = "";
+ var actionUrlHtml = actionUrl;
+
+ <!-- Keep track of form field params to ensure the refreshed list matches -->
+ <c:if test="${(param['reset_action'] ne 'Y') && (param['reset_action'] ne 'y')}">
+ <c:forEach items="${param}" var="request_param">
+ <c:if test="${fn:startsWith(request_param.key,\"ff\")}">
+ <c:if test="${!empty request_param.value}">
+ formFieldParameters += "&${request_param.key}=${v:decodeUrl(request_param.value)}";
+ </c:if>
+ </c:if>
+ </c:forEach>
+ </c:if>
+
+ if (task != null) {
+ actionUrlHtml += "?task=" + task;
+ }
+
+ if (actionUrlParameters != null) {
+ actionUrlHtml += "&" + actionUrlParameters;
+ }
+
+
+ document.listForm.action = actionUrlHtml + formFieldParameters;
+ document.listForm.submit();
+ }
+</script>
+
+<!-- Select Profile functionality -->
+<script type="text/javascript">
+ function submitSelection() {
+ var selectedProfiles = document.listForm.selected;
+ var allProfiles = document.formd.selected;
+ var numRows = null;
+
+ if (allProfiles) {
+ numRows = allProfiles.length;
+
+ if (numRows) {
+ for (i=0; i < numRows; i++) {
+ if (allProfiles[i].checked) {
+ selectedProfiles.value += allProfiles[i].value + ",";
+ }
+ }
+
+ if (selectedProfiles.value != '') {
+ selectedProfiles.value = selectedProfiles.value.substring(0, selectedProfiles.value.length-1);
+ }
+ }
+ else {
+ if (allProfiles.checked) {
+ selectedProfiles.value += allProfiles.value;
+ }
+ }
+ }
+
+ //alert(selectedProfiles.value);
+ document.listForm.submit();
+ }
+</script>
+
+
+<!-- Profile Search activation/deactivation functionality -->
+<script type="text/javascript">
+ function toggleUserActive(element, userId) {
+ var user_id = "'"+${user.id}+"'";
+ if(user_id.length == 0) user_id = 1;
+ else
+ fusionAjax.toggleUserActive(${user.id}, userId, toggleUserActiveCB);
+ return false;
+ }
+
+ function toggleUserActiveCB(data) {
+ var element = document.getElementById('user_active_' + data);
+ if(element.alt == "Activate") {
+ element.src = "static/fusion/images/active.gif";
+ element.alt = "Inactivate";
+ }
+ else {
+ element.src = "static/fusion/images/inactive.gif";
+ element.alt = "Activate";
+ }
+ }
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_js_include.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_js_include.jsp
new file mode 100644
index 00000000..5abbb5ad
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_js_include.jsp
@@ -0,0 +1,31 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%-- <!--<script>
+ function getSessionTime() {
+ var session_Time = '<%=session.getMaxInactiveInterval()%>';
+ if (session_Time.length <=0) {
+ session_Time = '1800';
+ }
+ return eval(session_Time);
+ }
+</script>-->
+
+<script type='text/javascript' src="static/inc/SessionWarningTimer.js"></script>
+--%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_end_field_run_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_end_field_run_sql.jsp
new file mode 100644
index 00000000..fd2f9c36
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_end_field_run_sql.jsp
@@ -0,0 +1,38 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+
+<script language="JavaScript">
+ function postSQL() {
+ document.formb.<%= AppConstants.RI_FORMATTED_SQL %>.value=window.opener.forma.rangeEndDateSQL.value;
+ window.opener.setDefaultVerifyFlag();
+ document.formb.submit();
+ }
+
+</script>
+<body onLoad="postSQL()">
+<form name="formb" action="<%= AppUtils.getBaseURL() %>" method="post">
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="r_action" value="report.popup.testrun.sql">
+ <input type="hidden" name="<%= AppConstants.RI_FORMATTED_SQL %>" value="">
+</form>
+</body>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_start_field_run_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_start_field_run_sql.jsp
new file mode 100644
index 00000000..69827262
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_start_field_run_sql.jsp
@@ -0,0 +1,39 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+
+<script language="JavaScript">
+
+ function postSQL() {
+ document.formb.<%= AppConstants.RI_FORMATTED_SQL %>.value=window.opener.forma.rangeStartDateSQL.value;
+ window.opener.setDefaultVerifyFlag();
+ document.formb.submit();
+ }
+
+</script>
+<body onLoad="postSQL()">
+<form name="formb" action="<%= AppUtils.getBaseURL() %>" method="post">
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="r_action" value="report.popup.testrun.sql">
+ <input type="hidden" name="<%= AppConstants.RI_FORMATTED_SQL %>" value="">
+</form>
+</body>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/default_field_run_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/default_field_run_sql.jsp
new file mode 100644
index 00000000..95c99f37
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/default_field_run_sql.jsp
@@ -0,0 +1,39 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+
+<script language="JavaScript">
+
+ function postSQL() {
+ document.formb.<%= AppConstants.RI_FORMATTED_SQL %>.value=window.opener.forma.fieldDefaultSQL.value;
+ window.opener.setDefaultVerifyFlag();
+ document.formb.submit();
+ }
+
+</script>
+<body onLoad="postSQL()">
+<form name="formb" action="<%= AppUtils.getBaseURL() %>" method="post">
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="r_action" value="report.popup.testrun.sql">
+ <input type="hidden" name="<%= AppConstants.RI_FORMATTED_SQL %>" value="">
+</form>
+</body>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/disclaimer.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/disclaimer.jsp
new file mode 100644
index 00000000..d5d25249
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/disclaimer.jsp
@@ -0,0 +1,38 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<% if(org.openecomp.portalsdk.analytics.system.Globals.getShowDisclaimer()) { %>
+
+ <table width="100%" align="left" border="0" cellspacing="0" cellpadding="0">
+ <tr><td>&nbsp;</td></tr>
+ <%if(!org.openecomp.portalsdk.analytics.system.Globals.hideRaptorFooter()) { %>
+ <tr>
+ <td>&nbsp;&nbsp;&nbsp;</td>
+
+ </tr>
+ <% } %>
+ <tr>
+ <td>&nbsp;&nbsp;&nbsp;</td>
+
+ </tr>
+ <tr><td>&nbsp;</td></tr>
+ </table>
+
+<% } %>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_include.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_include.jsp
new file mode 100644
index 00000000..8158e604
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_include.jsp
@@ -0,0 +1,58 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+
+<% ArrayList alErrorList = (ArrayList) request.getAttribute(AppConstants.RI_ERROR_LIST);
+ if((alErrorList!=null)&&(alErrorList.size()>0)) { %>
+<br>
+<table width="94%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align="center">
+ <tr class=rbg7>
+ <td class=rtabletext colspan=2 align=center>
+ <b class=rerrortext>Validation Errors Found</b><br>
+ Following errors need to be corrected to continue:
+ </td>
+ </tr>
+<% for(int i=0; i<alErrorList.size(); i++) {
+ String sErrorMsg = (String) alErrorList.get(i);
+ if(sErrorMsg!=null&&sErrorMsg.indexOf("|")>=0)
+ sErrorMsg = sErrorMsg.substring(sErrorMsg.indexOf("|")+1);
+ if((i%2)==0) { %>
+ <tr class=rbg6>
+<% } %>
+ <td class=rtabletext width=50%>
+ <font class=rerrortextsm><li class=rerrortextsm><%= sErrorMsg %></font>
+ </td>
+<% if((i%2)==1) { %>
+ </tr>
+<% }
+ } // for
+%>
+<% if((alErrorList.size()%2)==1) { %>
+ <tr>
+ <td class=rtabletext width=50%>
+ <font class=rerrortextsm>&nbsp;</font>
+ </td>
+ </tr>
+<% } %>
+</table>
+<% } // if
+%>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_page.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_page.jsp
new file mode 100644
index 00000000..8ee73be0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_page.jsp
@@ -0,0 +1,229 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.io.*" %>
+<%@ page import="java.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.error.UserAccessException"%>
+<%@ page import="org.openecomp.portalsdk.analytics.error.RaptorException"%>
+<%@ page import="org.openecomp.portalsdk.analytics.error.UserDefinedException"%>
+<%@ page isErrorPage="true" %>
+
+
+<% java.lang.Exception ex = (Exception) request.getAttribute(AppConstants.RI_EXCEPTION); %>
+<% boolean showEditLink = false;
+ if(AppUtils.getRequestNvlValue(request, "r_action").equals("report.run")) {
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ if(rr!=null)
+ try {
+ rr.checkUserWriteAccess(request);
+ showEditLink = true;
+ } catch(Exception e) {}
+ } // if
+%>
+
+
+
+<html>
+
+<head>
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+ <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
+ <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/ral.css">
+ <title>Application Error</title>
+ </head>
+
+<body bgcolor="#FFFFFF">
+<%-- jsp:include page="custom_header_include.jsp" flush="true" /--%>
+
+<form name="forma" action="raptor.htm" method="post">
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="r_action" value="report.edit">
+ <input type="hidden" name="c_master" value="<%= AppUtils.getRequestNvlValue(request, "c_master") %>">
+ <input type="hidden" name="source_page" value="report_run">
+
+<br>
+<table class="mTAB" width="94%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr class=rbg1>
+ <td width="90%" class=rtext2 nowrap>
+<% if(showEditLink) { %>
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>pen_paper.gif" alt="Edit report" width="12" height="12">
+<% } %>
+ <b class=rtableheader>Error/User-Alert Message:</b>
+ </td>
+ </tr>
+<% if(ex!=null) { %>
+ <% if(ex instanceof org.openecomp.portalsdk.analytics.error.RaptorSchedularException) { %>
+ <% if(AppUtils.isAdminUser(request)) { %>
+ <tr class=rowalt1>
+ <td width="90%" class=rtext2 nowrap>
+ <font class=rtabletext><b>Exception Class: </b><%= (ex!=null && ex instanceof org.openecomp.portalsdk.analytics.error.RaptorSchedularException)?ex.getClass().toString():"" %></font>
+ </td>
+ </tr>
+ <% } %>
+ <tr class=rowalt2>
+ <td width="90%" class=rtext2 nowrap><font class=rtabletext><b>Message:</b>&nbsp;<%= (ex!=null && ex instanceof org.openecomp.portalsdk.analytics.error.RaptorSchedularException)?ex.getMessage():"" %></font>
+ </td>
+ </tr>
+ <% } %>
+ <% if(ex!=null) ex.printStackTrace(); %>
+ <% if(AppUtils.isAdminUser(request)) {
+ if ((ex instanceof org.openecomp.portalsdk.analytics.error.ReportSQLException)||
+ (request.getAttribute("c_error_sql")!=null && !((String) request.getAttribute("c_error_sql")).trim().equals(""))) {
+ String sql = "";
+ if(ex instanceof org.openecomp.portalsdk.analytics.error.ReportSQLException)
+ sql = ((org.openecomp.portalsdk.analytics.error.ReportSQLException) ex).getReportSQL();
+ else
+ sql = (String) request.getAttribute("c_error_sql"); %>
+ <% if (sql!=null && sql.length() > 0) { %>
+ <tr class=rowalt1>
+ <td width="90%">
+ <b class=rtabletext>SQL Execution Error:</b>
+ </td>
+ </tr>
+ <tr class=rowalt2>
+ <td width="90%">
+ <font class=rtabletext><%= sql %></font>
+ </td>
+ </tr>
+ <% request.setAttribute("c_error_sql", sql);
+ %>
+ <% } %>
+ <tr class=rowalt1>
+ <td width="90%">
+ <b class=rtabletext>Error Message:</b><br>
+ <font class=rtabletext><%= AppUtils.getRequestNvlValue(request, "error_extra_msg") %><%= ex.getMessage() %></font>
+ </td>
+ </tr>
+ <% if(request.getAttribute("c_error_url")!=null && !((String) request.getAttribute("c_error_url")).trim().equals("")) { %>
+ <tr class=rowalt1>
+ <td width="90%">
+ <font class=rtabletext>Please <a href="<%= (String) request.getAttribute("c_error_url") %>">click here</a> to edit report definition.</font>
+ </td>
+ </tr>
+ <% } // if %>
+ <% } else { // reportSQLException
+ if (ex instanceof RaptorException) { %>
+ <tr class=rowalt1>
+ <td width="90%">
+ <b class=rtabletext>Error Message:</b><br>
+ <font class=rtabletext><%= AppUtils.getRequestNvlValue(request, "error_extra_msg") %><%= ex.getMessage() %></font>
+ </td>
+ </tr>
+ <%} %>
+ <% } %>
+ <% } else {
+ if (ex instanceof UserAccessException) { %>
+ <tr class=rowalt1>
+ <td width="90%">
+ <b class=rtabletext>Error Message:</b><br>
+ <font class=rtabletext><%= AppUtils.getRequestNvlValue(request, "error_extra_msg") %><%= ex.getMessage() %></font>
+ </td>
+ </tr>
+ <% } else if (ex instanceof UserDefinedException) { %>
+ <tr class=rowalt1>
+ <td width="90%">
+ <b class=rtabletext>Error Message:</b><br>
+ <font class=rtabletext><%= AppUtils.getRequestNvlValue(request, "error_extra_msg") %><%= ex.getMessage() %></font>
+ </td>
+ </tr>
+ <% }
+ } %>
+ <tr class=rowalt2>
+ <td width="90%">
+ <font class=rtabletext>** The system administrator has been notified for this error.</font>
+ </td>
+ </tr>
+<% } else { %>
+<% if(exception instanceof org.openecomp.portalsdk.analytics.error.RaptorSchedularException) { %>
+ <% if(AppUtils.isAdminUser(request)) { %>
+ <tr class=rowalt1>
+ <td width="90%" class=rtext2 nowrap>
+ <font class=rtabletext><b>Exception Class: </b><%= (exception!=null && exception instanceof org.openecomp.portalsdk.analytics.error.RaptorSchedularException)?exception.getClass().toString():"" %></font>
+ </td>
+</tr>
+ <% } %>
+<tr class=rowalt2>
+ <td width="90%" class=rtext2 nowrap><font class=rtabletext><b>Message:</b>&nbsp;<%= (exception!=null && exception instanceof org.openecomp.portalsdk.analytics.error.RaptorSchedularException)?exception.getMessage():"" %></font>
+ </td>
+ <% if(exception!=null) exception.printStackTrace(); %>
+ </tr>
+<% } %>
+<% if(AppUtils.isAdminUser(request)) {
+ if ((exception instanceof org.openecomp.portalsdk.analytics.error.ReportSQLException)||
+ (request.getAttribute("c_error_sql")!=null && !((String) request.getAttribute("c_error_sql")).trim().equals(""))) {
+ String sql = "";
+ if(exception instanceof org.openecomp.portalsdk.analytics.error.ReportSQLException)
+ sql = ((org.openecomp.portalsdk.analytics.error.ReportSQLException) ex).getReportSQL();
+ else
+ sql = (String) request.getAttribute("c_error_sql"); %>
+ <% if (sql!=null && sql.length() > 0) { %>
+ <tr class=rowalt1>
+ <td width="90%">
+ <b class=rtabletext>SQL Execution Error:</b>
+ </td>
+ </tr>
+ <tr class=rowalt2>
+ <td width="90%">
+ <font class=rtabletext><%= sql %></font>
+ </td>
+ </tr>
+<% request.setAttribute("c_error_sql", sql);
+ %>
+ <% } %>
+ <tr class=rowalt1>
+ <td width="90%">
+ <b class=rtabletext>Error Message:</b><br>
+ <font class=rtabletext><%= AppUtils.getRequestNvlValue(request, "error_extra_msg") %><%= ex.getMessage() %></font>
+ </td>
+ </tr>
+<% if(request.getAttribute("c_error_url")!=null && !((String) request.getAttribute("c_error_url")).trim().equals("")) { %>
+ <tr class=rowalt1>
+ <td width="90%">
+ <font class=rtabletext>Please <a href="<%= (String) request.getAttribute("c_error_url") %>">click here</a> to edit report definition.</font>
+ </td>
+ </tr>
+<% } %>
+<% } %>
+<% } %>
+ <tr class=rowalt2>
+ <td width="90%">
+ <font class=rtabletext>** The system administrator has been notified for this error.</font>
+ </td>
+ </tr>
+<% if(AppUtils.isAdminUser(request)) { %>
+<!-------------------------------------------------------
+EXCEPTION [<%= ex!=null? ex.getMessage():"" %>]
+<% if(ex!=null) ex.printStackTrace(new PrintWriter(out)); %>
+-------------------------------------------------------->
+<% } %>
+<% if(exception!=null) exception.printStackTrace(); %>
+
+<% } // else
+%>
+</table>
+
+</form>
+
+</body>
+</html>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/footer.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/footer.jsp
new file mode 100644
index 00000000..c4fbe9e8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/footer.jsp
@@ -0,0 +1,25 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+ <jsp:include page="disclaimer.jsp" flush="true" />
+
+ </body>
+</html>
+
+<%--<jsp:include page="prisms/footer.jsp" flush="true" />--%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_drill_down_report.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_drill_down_report.jsp
new file mode 100644
index 00000000..53959482
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_drill_down_report.jsp
@@ -0,0 +1,601 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+
+<% ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ List reportCols = rdef.getAllColumns();
+ List rFormFields = null;
+ if(rdef.getFormFieldList()!=null&&rdef.getFormFieldList().getFormField().size()>0)
+ rFormFields = rdef.getFormFieldList().getFormField();
+
+ ReportFormFields ddReportFormFields = (ReportFormFields) request.getAttribute(AppConstants.RI_FORM_FIELDS);
+
+ String drillDownSuppress = AppUtils.getRequestNvlValue(request, "drillDownSuppress");
+ String drillDownParams = AppUtils.getRequestNvlValue(request, "drillDownParams");
+ String drillDownRequest = AppUtils.getRequestNvlValue(request, "drillDownRequest");
+
+ Hashtable paramDefinitions = new Hashtable();
+ StringTokenizer st = new StringTokenizer(drillDownParams, "&");
+ //Added for passing request parameters in Drill Down
+ String[] reqParameters = Globals.getRequestParams().split(",");
+ int icnt=0;
+ //
+ while(st.hasMoreTokens()) {
+ String param = st.nextToken();
+ DrillDownParamDef paramDef = new DrillDownParamDef(param);
+ if(paramDef.getFieldName().length()>0)
+ paramDefinitions.put(paramDef.getFieldName(), paramDef);
+ } // while
+%>
+
+<html>
+<head>
+ <title>Drill-down Parameters Configuration</title>
+ <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
+
+<script language="JavaScript">
+<!--
+ var bCloseWindow = false;
+
+ function setParams(newParams) {
+ var suppressValue = document.dataform.v_suppress.value;
+ var showInPopup;
+ if(document.dataform.showInPopup.checked)
+ showInPopup = "true";
+ window.opener.document.forma.drillDownPopUp.value = showInPopup;
+ window.opener.setDrillDownValuesSuppress(newParams, suppressValue);
+ window.close();
+ } // setParams
+
+ function resetDrillDown() {
+ window.opener.document.forma.drillDownCtl.selectedIndex = 0;
+ window.opener.document.forma.drillDownURL.value = "";
+ window.opener.document.forma.drillDownParams.value = "";
+ window.opener.document.forma.drillDownSuppress.value = "";
+ window.opener.document.forma.drillDownPopUp.value = "";
+ } // setParams
+
+
+//-->
+</script>
+
+</head>
+<body onLoad="if(bCloseWindow) setParams('');">
+
+<form name="dataform" onSubmit="return false;">
+<table class="mTAB" width="94%" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan="2">
+ <b class=rtableheader>DRILL-DOWN PARAMETERS CONFIGURATION</b>
+ </td>
+ </tr>
+
+<% if(ddReportFormFields!=null)
+ for(ddReportFormFields.resetNext(); ddReportFormFields.hasNext(); ) {
+ FormField ff = ddReportFormFields.getNext();
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+
+ DrillDownParamDef paramDef = (DrillDownParamDef) paramDefinitions.get(ff.getFieldName());
+ if(paramDef==null)
+ paramDef = new DrillDownParamDef(""); %>
+
+ <% if (ff!=null && (ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) ) {
+ %>
+ <tr>
+ <td class=rbg1 colspan="2" height="30" align="left"><b class=rtableheader>
+ &nbsp;<%= ff.getFieldDisplayName() %>
+ <input type="hidden" name="paramName" value="<%= ff.getFieldName() %>"></b></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" width="33%" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>" value="None"<%= paramDef.getValType().equals("0")?" checked":"" %>>No value </font>
+ </td>
+ <td class=rbg3 align="left" width="67%" nowrap>
+ <font class=rtabletext>Accept default</font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>" value="Fixed"<%= paramDef.getValType().equals("1")?" checked":"" %>>Fixed value </font>
+ </td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <input type="text" size="30" maxlength="100" name="v_<%= ff.getFieldName() %>" value="<%= java.net.URLDecoder.decode(paramDef.getValValue(),"UTF8") %>" onChange="document.dataform.r_<%= ff.getFieldName() %>[1].click();"></font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>" value="Column"<%= paramDef.getValType().equals("2")?" checked":"" %>>Value of column </font>
+ </td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <select name="c_<%= ff.getFieldName() %>" onChange="document.dataform.r_<%= ff.getFieldName() %>[2].click();">
+ <option value="this">--- Current drill-down column ---
+<% for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ //if(dct.isVisible()) {
+ %>
+ <option value="<%= dct.getColId() %>"<%= paramDef.getValColId().equals(dct.getColId())?" selected":"" %>><%= dct.getDisplayName() %>
+<% //}
+%>
+<% } %>
+ </select></font>
+ </td>
+ </tr>
+<% if(rFormFields!=null) { %>
+ <tr>
+ <td class=rbg2 align="left" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>" value="FormField"<%= paramDef.getValType().equals("3")?" checked":"" %>>Value of form field </font>
+ </td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <select name="f_<%= ff.getFieldName() %>" onChange="document.dataform.r_<%= ff.getFieldName() %>[3].click();">
+<% for(Iterator iter=rFormFields.iterator(); iter.hasNext(); ) {
+ FormFieldType fft = (FormFieldType) iter.next(); %>
+ <option value="<%= fft.getFieldId() %>"<%= paramDef.getValFieldId().equals(fft.getFieldId())?" selected":"" %>><%= fft.getFieldName() %>
+<% } %>
+ </select></font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>" value="ColFormSet"<%= paramDef.getValType().equals("4")?" checked":"" %>>Value set </font>
+ </td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ Pass the value of the selected column if not empty,<br>
+ otherwise pass the value of the selected form field</font>
+ </td>
+ </tr>
+<% } // if
+
+%>
+<!-- END -->
+ <%
+ paramDef = (DrillDownParamDef) paramDefinitions.get(ff.getFieldName()+"_Hr");
+ if(paramDef==null)
+ paramDef = new DrillDownParamDef("");
+ %>
+ <tr>
+ <td class=rbg1 colspan="2" height="30" align="left"><b class=rtableheader>
+ &nbsp;<%= ff.getFieldDisplayName() %> (Hour)
+ <input type="hidden" name="paramName" value="<%= ff.getFieldName() %>_Hr"></b></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" width="33%" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>_Hr" value="None"<%= paramDef.getValType().equals("0")?" checked":"" %>>No value </font>
+ </td>
+ <td class=rbg3 align="left" width="67%" nowrap>
+ <font class=rtabletext>Accept default</font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>_Hr" value="Column" <%= paramDef.getValType().equals("2")?" checked":"" %> >Value of column </font>
+ </td>
+ <td class=rbg3 align="left" nowrap>
+ <font class=rtabletext>
+ <select name="c_<%= ff.getFieldName() %>_Hr" onChange="document.dataform.r_<%= ff.getFieldName() %>_Hr[1].click();">
+ <option value="this">--- Current drill-down column ---
+ <% for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ //if(dct.isVisible()) {
+ %>
+ <option value="<%= dct.getColId() %>"<%= paramDef.getValColId().equals(dct.getColId())?" selected":"" %>><%= dct.getDisplayName() %>
+ <% //}
+ %>
+<% } %>
+ </select>
+ </font>
+ </td>
+ </tr>
+<%
+ if (ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+%>
+ <%
+ paramDef = (DrillDownParamDef) paramDefinitions.get(ff.getFieldName()+"_Min");
+ if(paramDef==null)
+ paramDef = new DrillDownParamDef("");
+ %>
+ <tr>
+ <td class=rbg1 colspan="2" height="30" align="left"><b class=rtableheader>
+ &nbsp;<%= ff.getFieldDisplayName() %> (Minutes)
+ <input type="hidden" name="paramName" value="<%= ff.getFieldName() %>_Min"></b></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" width="33%" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>_Min" value="None"<%= paramDef.getValType().equals("0")?" checked":"" %>>No value </font>
+ </td>
+ <td class=rbg3 align="left" width="67%" nowrap>
+ <font class=rtabletext>Accept default</font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>_Min" value="Column" <%= paramDef.getValType().equals("2")?" checked":"" %>>Value of column </font>
+ </td>
+ <td class=rbg3 align="left" nowrap>
+ <font class=rtabletext>
+ <select name="c_<%= ff.getFieldName() %>_Min" onChange="document.dataform.r_<%= ff.getFieldName() %>_Min[1].click();">
+ <option value="this">--- Current drill-down column ---
+ <% for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ //if(dct.isVisible()) {
+ %>
+ <option value="<%= dct.getColId() %>"<%= paramDef.getValColId().equals(dct.getColId())?" selected":"" %>><%= dct.getDisplayName() %>
+ <% //}
+ %>
+<% } %>
+ </select>
+ </font>
+ </td>
+ </tr>
+<%
+ }
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+%>
+ <%
+ paramDef = (DrillDownParamDef) paramDefinitions.get(ff.getFieldName()+"_Sec");
+ if(paramDef==null)
+ paramDef = new DrillDownParamDef("");
+ %>
+ <tr>
+ <td class=rbg1 colspan="2" height="30" align="left"><b class=rtableheader>
+ &nbsp;<%= ff.getFieldDisplayName() %> (Seconds)
+ <input type="hidden" name="paramName" value="<%= ff.getFieldName() %>_Sec"></b></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" width="33%" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>_Sec" value="None"<%= paramDef.getValType().equals("0")?" checked":"" %>>No value </font>
+ </td>
+ <td class=rbg3 align="left" width="67%" nowrap>
+ <font class=rtabletext>Accept default</font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>_Sec" value="Column" <%= paramDef.getValType().equals("2")?" checked":"" %>>Value of column </font>
+ </td>
+ <td class=rbg3 align="left" nowrap>
+ <font class=rtabletext>
+ <select name="c_<%= ff.getFieldName() %>_Sec" onChange="document.dataform.r_<%= ff.getFieldName() %>_Sec[1].click();">
+ <option value="this">--- Current drill-down column ---
+ <% for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ //if(dct.isVisible()) {
+ %>
+ <option value="<%= dct.getColId() %>"<%= paramDef.getValColId().equals(dct.getColId())?" selected":"" %>><%= dct.getDisplayName() %>
+ <% //}
+ %>
+<% } %>
+ </select>
+ </font>
+ </td>
+ </tr>
+<%
+
+ }
+
+ } else {
+%>
+ <tr>
+ <td class=rbg1 colspan="2" height="30" align="left"><b class=rtableheader>
+ &nbsp;<%= ff.getFieldDisplayName() %>
+ <input type="hidden" name="paramName" value="<%= ff.getFieldName() %>"></b></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" width="33%" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>" value="None"<%= paramDef.getValType().equals("0")?" checked":"" %>>No value </font>
+ </td>
+ <td class=rbg3 align="left" width="67%" nowrap>
+ <font class=rtabletext>Accept default</font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>" value="Fixed"<%= paramDef.getValType().equals("1")?" checked":"" %>>Fixed value </font>
+ </td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <input type="text" size="30" maxlength="100" name="v_<%= ff.getFieldName() %>" value="<%= java.net.URLDecoder.decode(paramDef.getValValue(),"UTF8") %>" onChange="document.dataform.r_<%= ff.getFieldName() %>[1].click();"></font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>" value="Column"<%= paramDef.getValType().equals("2")?" checked":"" %>>Value of column </font>
+ </td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <select name="c_<%= ff.getFieldName() %>" onChange="document.dataform.r_<%= ff.getFieldName() %>[2].click();">
+ <option value="this">--- Current drill-down column ---
+<% for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ //if(dct.isVisible()) {
+ %>
+ <option value="<%= dct.getColId() %>"<%= paramDef.getValColId().equals(dct.getColId())?" selected":"" %>><%= dct.getDisplayName() %>
+<% //}
+%>
+<% } %>
+ </select></font>
+ </td>
+ </tr>
+<% if(rFormFields!=null) { %>
+ <tr>
+ <td class=rbg2 align="left" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>" value="FormField"<%= paramDef.getValType().equals("3")?" checked":"" %>>Value of form field </font>
+ </td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <select name="f_<%= ff.getFieldName() %>" onChange="document.dataform.r_<%= ff.getFieldName() %>[3].click();">
+<% for(Iterator iter=rFormFields.iterator(); iter.hasNext(); ) {
+ FormFieldType fft = (FormFieldType) iter.next(); %>
+ <option value="<%= fft.getFieldId() %>"<%= paramDef.getValFieldId().equals(fft.getFieldId())?" selected":"" %>><%= fft.getFieldName() %>
+<% } %>
+ </select></font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="radio" name="r_<%= ff.getFieldName() %>" value="ColFormSet"<%= paramDef.getValType().equals("4")?" checked":"" %>>Value set </font>
+ </td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ Pass the value of the selected column if not empty,<br>
+ otherwise pass the value of the selected form field</font>
+ </td>
+ </tr>
+<% } // if
+ } // else
+ } // if BLANK
+ } // for
+%>
+
+<script language="JavaScript">
+<!--
+<% if(ddReportFormFields==null||ddReportFormFields.getFieldCount()==0) { %>
+ bCloseWindow = true;
+<% } %>
+ function replaceSC(strValue) {
+ var newValue = "";
+
+ for(var i=0; i<strValue.length; i++) {
+ var ch = strValue.charAt(i);
+
+ if(ch=='@')
+ newValue += "%40";
+ else if(ch=='+')
+ newValue += "%2B";
+ else if(ch=='/')
+ newValue += "%2F";
+ else
+ newValue += ch;
+ } // for
+
+ return newValue;
+ } // replaceSC
+
+ function collectValues() {
+ var newParams = "";
+ newParams += setCheckBoxValues();
+<% if(ddReportFormFields!=null) {
+ for(ddReportFormFields.resetNext(); ddReportFormFields.hasNext(); ) {
+ FormField ff = ddReportFormFields.getNext();
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+ String fieldName = ff.getFieldName();
+
+ if (ff!=null && !(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) ) {
+%>
+ if(document.dataform.r_<%= fieldName %>[1].checked||document.dataform.r_<%= fieldName %>[2].checked<%= (rFormFields!=null)?"||document.dataform.r_"+fieldName+"[3].checked||document.dataform.r_"+fieldName+"[4].checked":"" %>) {
+ if(newParams!="")
+ newParams += "&";
+ newParams += "<%= fieldName %>=";
+ if(document.dataform.r_<%= fieldName %>[1].checked) {
+ newParams += replaceSC(escape(document.dataform.v_<%= fieldName %>.value));
+ } else if(document.dataform.r_<%= fieldName %>[2].checked) {
+ newParams += "["+escape(document.dataform.c_<%= fieldName %>.options[document.dataform.c_<%= fieldName %>.selectedIndex].value)+"]";
+ <% if(rFormFields!=null) { %>
+ } else if(document.dataform.r_<%= fieldName %>[3].checked) {
+ newParams += "[!"+escape(document.dataform.f_<%= fieldName %>.options[document.dataform.f_<%= fieldName %>.selectedIndex].value)+"]";
+ } else if(document.dataform.r_<%= fieldName %>[4].checked) {
+ newParams += "["+escape(document.dataform.c_<%= fieldName %>.options[document.dataform.c_<%= fieldName %>.selectedIndex].value)+"!"+escape(document.dataform.f_<%= fieldName %>.options[document.dataform.f_<%= fieldName %>.selectedIndex].value)+"]";
+ <% } %>
+ }
+ } // if
+<%
+ } //if non-timestamp
+ if (ff!=null && (ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) ) {
+
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+%>
+ if(document.dataform.r_<%= fieldName %>[1].checked||document.dataform.r_<%= fieldName %>[2].checked<%= (rFormFields!=null)?"||document.dataform.r_"+fieldName+"[3].checked||document.dataform.r_"+fieldName+"[4].checked":"" %>) {
+ if(newParams!="")
+ newParams += "&";
+ newParams += "<%= fieldName %>=";
+ if(document.dataform.r_<%= fieldName %>[1].checked) {
+ newParams += replaceSC(escape(document.dataform.v_<%= fieldName %>.value));
+ } else if(document.dataform.r_<%= fieldName %>[2].checked) {
+ newParams += "["+escape(document.dataform.c_<%= fieldName %>.options[document.dataform.c_<%= fieldName %>.selectedIndex].value)+"]";
+ <% if(rFormFields!=null) { %>
+ } else if(document.dataform.r_<%= fieldName %>[3].checked) {
+ newParams += "[!"+escape(document.dataform.f_<%= fieldName %>.options[document.dataform.f_<%= fieldName %>.selectedIndex].value)+"]";
+ } else if(document.dataform.r_<%= fieldName %>[4].checked) {
+ newParams += "["+escape(document.dataform.c_<%= fieldName %>.options[document.dataform.c_<%= fieldName %>.selectedIndex].value)+"!"+escape(document.dataform.f_<%= fieldName %>.options[document.dataform.f_<%= fieldName %>.selectedIndex].value)+"]";
+ <% } %>
+ }
+ } // if
+
+ if(document.dataform.r_<%= fieldName %>_Hr[1].checked) {
+ if(newParams!="")
+ newParams += "&";
+ newParams += "<%= fieldName %>_Hr=";
+ if(document.dataform.r_<%= fieldName %>_Hr[1].checked) {
+ newParams += "["+escape(document.dataform.c_<%= fieldName %>_Hr.options[document.dataform.c_<%= fieldName %>_Hr.selectedIndex].value)+"]";
+ }
+ } // if
+<%
+ }//hour
+%>
+<%
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+%>
+ if(document.dataform.r_<%= fieldName %>_Min[1].checked) {
+ if(newParams!="")
+ newParams += "&";
+ newParams += "<%= fieldName %>_Min=";
+ if(document.dataform.r_<%= fieldName %>_Min[1].checked) {
+ newParams += "["+escape(document.dataform.c_<%= fieldName %>_Min.options[document.dataform.c_<%= fieldName %>_Min.selectedIndex].value)+"]";
+ }
+ } // if
+ <%
+ } // min
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+%>
+ if(document.dataform.r_<%= fieldName %>_Sec[1].checked) {
+ if(newParams!="")
+ newParams += "&";
+ newParams += "<%= fieldName %>_Sec=";
+ if(document.dataform.r_<%= fieldName %>_Sec[1].checked) {
+ newParams += "["+escape(document.dataform.c_<%= fieldName %>_Sec.options[document.dataform.c_<%= fieldName %>_Sec.selectedIndex].value)+"]";
+ }
+ } // if
+<%
+ } // sec
+ }
+ } // BLANK
+ } // for
+ }
+%>
+ //alert(newParams);
+ setParams(newParams);
+ } // collectValues
+
+ function setCheckBoxValues() {
+ var newValues ="";
+<%
+ icnt=0;
+ if(reqParameters.length>0) {
+%>
+ if(document.dataform.requestParam) {
+ for (i=0;i<document.dataform.requestParam.length;i++) {
+ <% icnt++;%>
+ if(document.dataform.requestParam[i].checked) {
+ newValues += escape("<%=reqParameters[icnt-1]%>")+"="+"[#"+escape("<%=reqParameters[icnt-1]%>")+"]";
+ }
+ }
+ }
+<% } %>
+ return newValues;
+ }
+
+//-->
+</script>
+
+ <tr>
+ <td colspan="2">&nbsp;</td>
+ </tr>
+ <tr>
+ <td class=rbg1 colspan="2" height="30" align="left"><b class=rtableheader>
+ &nbsp;Parameter values not to be passed to the drill-down report</b></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="left" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ Suppress values </font>
+ </td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <input type="text" size="30" maxlength="100" name="v_suppress" value="<%= drillDownSuppress %>">
+ <br>separate by | if multiple values</font>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">&nbsp;</td>
+ </tr>
+ <% if(!Globals.getPassRequestParamInDrilldown() && (!(reqParameters.length==1 && reqParameters[0].length()<=0))) {
+ %>
+ <tr>
+ <td class=rbg1 colspan="2" height="30" align="left"><b class=rtableheader>
+ &nbsp;Request Parameter values to be passed to the drill-down report</b></td>
+ </tr>
+ <!-- <tr>
+ <td class=rbg2 align="left" height="30" nowrap>
+ <font class=rtabletext>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ Request values </font>
+ </td>
+ </tr>
+ -->
+ <%
+ icnt=0;
+
+ for (int i = 0; i < reqParameters.length; i++) {
+ icnt++;
+
+ %>
+ <tr<%= (icnt%2==0)?" class=rowalt1":" class=rowalt2" %>>
+ <!--<td align="center" height="30"><font class=rtabletext><%= icnt %></font></td>-->
+ <td><font class=rtabletext><%= reqParameters[i]%></font></td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <input type="checkbox" name="requestParam" <%= ((drillDownRequest!=null)&&(drillDownRequest.indexOf(reqParameters[i])!=-1))?"checked":""%>>
+ </td>
+ </tr>
+ <%
+ } //for
+ %>
+ <input type="hidden" name="requestParam">
+ <%
+ } // if requestParam
+ %>
+ <tr>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ Show Drilled Down Report In Popup Window: <input type="checkbox" name="showInPopup">
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="3" align="center"><input type="Button" class=button value="Complete" onClick="collectValues()"></td>
+ </tr>
+</table>
+</form>
+ <br><br>
+ <script>
+ if(window.opener.document.forma.drillDownPopUp.value == 'true')
+ document.dataform.showInPopup.checked = true;
+
+ </script>
+</body>
+</html>
+
+<%! private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_import_semaphore.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_import_semaphore.jsp
new file mode 100644
index 00000000..d73a7fe2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_import_semaphore.jsp
@@ -0,0 +1,80 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+
+<% ArrayList importedList = (ArrayList) request.getAttribute(AppConstants.RI_DATA_SET); %>
+
+<html>
+<head>
+ <title>Advanced Display Formatting</title>
+ <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
+
+<script language=JavaScript>
+<!--
+ function updateOpenerList() {
+<% if(importedList!=null&&importedList.size()>0)
+ for(Iterator iter=importedList.iterator(); iter.hasNext(); ) {
+ IdNameValue value = (IdNameValue) iter.next(); %>
+ window.opener.updateSemaphoreList("<%= value.getId() %>", "<%= value.getName() %>");
+<% } %>
+ } // updateOpenerList
+//-->
+</script>
+
+</head>
+<body onLoad="updateOpenerList()">
+<br>
+
+<table width=94% class="tableBorder" border=0 cellspacing=1 align=center>
+ <tr class=rbg1>
+ <td valign="middle" height="24"><b class=rtableheader>&nbsp;Advanced Display Formatting Import</b></td>
+ </tr>
+ <tr>
+ <td class=rbg3 align="center" valign="middle" height="100"><font class=rtabletext>
+<% if(importedList!=null&&importedList.size()>0) { %>
+ <%= importedList.size() %> Advanced Display Formattings successfully imported.
+<% } else { %>
+ The selected report does not have Advanced Display Formattings <br>
+ defined. No Advanced Display Formattings were imported.
+<% } %>
+ </font></td>
+ </tr>
+ <tr>
+ <td colspan="10" align="center">
+ <br>
+ <input type="Button" class=button value="Close" onClick="window.close();">
+ </td>
+ </tr>
+</table>
+
+</form>
+
+</body>
+</html>
+
+<%! private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_semaphore.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_semaphore.jsp
new file mode 100644
index 00000000..39eafb24
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_semaphore.jsp
@@ -0,0 +1,419 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+
+<% ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+
+ String semaphoreId = AppUtils.getRequestNvlValue(request, "semaphoreId");
+ String semaphoreType = AppUtils.getRequestNvlValue(request, "semaphoreType");
+ SemaphoreType semaphore = rdef.getSemaphoreById(semaphoreId);
+ String semaphoreName = null;
+ List listColumns = rdef.getAllColumns();
+ if(semaphore!=null)
+ semaphoreName = semaphore.getSemaphoreName();
+ else
+ if(rdef.getSemaphoreList()!=null)
+ semaphoreName = "Display Formatting "+(rdef.getSemaphoreList().getSemaphore().size()+1);
+ else
+ semaphoreName = "Display Formatting 1";
+
+ String submitBtn = AppUtils.getRequestNvlValue(request, "submit_btn"); %>
+
+<html>
+<head>
+ <title>Advanced Display Formatting</title>
+ <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
+
+<% if(submitBtn.startsWith("Save")) { %>
+<script language=JavaScript>
+<!--
+ function updateOpenerList() { // Returns the position of the current semaphore in the list
+ return window.opener.updateSemaphoreList("<%= semaphoreId %>", "<%= semaphoreName %>");
+ } // updateOpenerList
+
+ function saveAndClose() {
+ var idx = 0;
+ idx = updateOpenerList();
+ window.opener.document.forma.semaphore.selectedIndex = idx;
+ window.opener.document.forma.semaphoreTypeHidden.value='<%=semaphoreType%>';
+ window.close();
+ } // saveAndClose
+//-->
+</script>
+<% } %>
+
+<% if(submitBtn.equals("Save")) { %>
+</head>
+<body onLoad="saveAndClose()">
+ <b class=rerrortext>Please wait...</b>
+<% } else { %>
+
+<script language=JavaScript>
+<!--
+ function setBold(iCount) {
+ var flag = document.dataform.boldChk[iCount].checked;
+ document.dataform.bold[iCount].value = (flag?"Y":"N");
+ document.getElementById("preview"+iCount).style.fontWeight = (flag?"bold":"normal");
+ } // setBold
+
+ function setItalic(iCount) {
+ var flag = document.dataform.italicChk[iCount].checked;
+ document.dataform.italic[iCount].value = (flag?"Y":"N");
+ document.getElementById("preview"+iCount).style.fontStyle = (flag?"italic":"normal");
+ } // setItalic
+
+ function setUnderline(iCount) {
+ var flag = document.dataform.underlineChk[iCount].checked;
+ document.dataform.underline[iCount].value = (flag?"Y":"N");
+ document.getElementById("preview"+iCount).style.textDecorationUnderline = flag;
+ } // setUnderline
+
+ function setBgColor(iCount) {
+ var value = document.dataform.bgColor[iCount].options[document.dataform.bgColor[iCount].selectedIndex].value;
+ document.getElementById("preview"+iCount).style.backgroundColor = value;
+ } // setBgColor
+
+ function setFontColor(iCount) {
+ var value = document.dataform.fontColor[iCount].options[document.dataform.fontColor[iCount].selectedIndex].value;
+ document.getElementById("preview"+iCount).style.color = value;
+ } // setFontColor
+
+ function setFontFace(iCount) {
+ var value = document.dataform.fontFace[iCount].options[document.dataform.fontFace[iCount].selectedIndex].value;
+ document.getElementById("preview"+iCount).style.fontFamily = value;
+ } // setFontFace
+
+ function setFontSize(iCount) {
+ var value = document.dataform.fontSize[iCount].options[document.dataform.fontSize[iCount].selectedIndex].value;
+ document.getElementById("preview"+iCount).style.fontSize = value+"px";
+ } // setFontSize
+
+/* function setAlignment(iCount) {
+ var value = document.dataform.alignment[iCount].options[document.dataform.alignment[iCount].selectedIndex].value;
+ document.getElementById("preview"+iCount).style.textAlign = value;
+ } // setAlignment
+*/
+ var semaphoreIds = new Array(<%= 2+((rdef.getSemaphoreList()==null)?0:rdef.getSemaphoreList().getSemaphore().size()) %>);
+ var semaphoreNames = new Array(<%= 2+((rdef.getSemaphoreList()==null)?0:rdef.getSemaphoreList().getSemaphore().size()) %>);
+ <% int iCount = 0;
+ if(rdef.getSemaphoreList()!=null)
+ for(Iterator iter=rdef.getSemaphoreList().getSemaphore().iterator(); iter.hasNext(); iCount++) {
+ SemaphoreType sem = (SemaphoreType) iter.next(); %>
+ semaphoreIds[<%= iCount %>] = "<%= sem.getSemaphoreId() %>";
+ semaphoreNames[<%= iCount %>] = "<%= sem.getSemaphoreName() %>";
+ <% } // for
+ %>
+ semaphoreIds[<%= iCount %>] = "-";
+ semaphoreNames[<%= iCount++ %>] = "-";
+ semaphoreIds[<%= iCount %>] = "-";
+ semaphoreNames[<%= iCount++ %>] = "-";
+
+ function dataValidate() {
+ if(document.dataform.semaphoreName.value=="") {
+ alert("Please enter Display Name");
+ document.forma.semaphoreName.focus();
+ document.forma.semaphoreName.select();
+
+ return false;
+ } // if
+
+ for(var i=0; i<semaphoreIds.length; i++)
+ if((document.dataform.semaphoreName.value==semaphoreNames[i])&&(semaphoreIds[i]!="<%= semaphoreId %>")) {
+ alert("Advanced Formatting with that name already exists.\nPlease select another name");
+ document.dataform.semaphoreName.focus();
+ document.dataform.semaphoreName.select();
+
+ return false;
+ } // if
+
+ for(var i=0; i<document.dataform.lessThanValue.length; i++)
+ for(var j=i+1; j<document.dataform.lessThanValue.length; j++)
+ if( document.dataform.lessThanValue[i].value!=""&&
+ document.dataform.lessThanValue[j].value!=""&&
+ document.dataform.lessThanValue[i].value==document.dataform.lessThanValue[j].value) {
+ alert("You cannot have duplicate values in the list.\nPlease change one of the values ["+document.dataform.lessThanValue[j].value+"]");
+ document.dataform.lessThanValue[j].focus();
+ document.dataform.lessThanValue[j].select();
+
+ return false;
+ } // if
+
+ return true;
+ } // dataValidate
+
+ function doInit() {
+ <% if(submitBtn.startsWith("Save")) { %>
+ updateOpenerList();
+ <% } %>
+
+<% for(int i = 0; i<3+((semaphore==null)?2:semaphore.getFormatList().getFormat().size()); i++) {
+ FormatType ft = null;
+ if(semaphore!=null&&i<semaphore.getFormatList().getFormat().size())
+ ft = (FormatType) semaphore.getFormatList().getFormat().get(i);
+ if(ft!=null) { %>
+ setBold(<%= i %>);
+ setItalic(<%= i %>);
+ setUnderline(<%= i %>);
+ setBgColor(<%= i %>);
+ setFontColor(<%= i %>);
+ setFontFace(<%= i %>);
+ setFontSize(<%= i %>);
+ //setAlignment(<%= i %>);
+ <% } // if
+ } // for
+%>
+ } // doInit
+//-->
+</script>
+
+</head>
+<body onLoad="doInit()">
+
+<form name="dataform" action="<%= AppUtils.getBaseURL() %>" method="post" onSubmit="return dataValidate()">
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="<%= AppConstants.RI_ACTION %>" value="report.popup.semaphore.save">
+
+<table class="mTAB" width=94% border=0 cellspacing=1 align=center>
+ <tr class=rbg1>
+ <td valign="middle" colspan="10" height="24"><b class=rtableheader>&nbsp;Advanced Display Formatting Definition</b></td>
+ </tr>
+ <tr>
+ <td class=rbg2 colspan="4" align="right" height="30" style="background-image:url(<%= AppUtils.getImgFolderURL() %>required.gif); background-position:top right; background-repeat:no-repeat;"><font class=rtabletext>Display Name: </font></td>
+ <td class=rbg3 colspan="6" align="left"><font class=rtabletext>
+ <input type="hidden" name="semaphoreId" value="<%= semaphoreId %>">
+ <input type="text" size="30" maxlength="30" name="semaphoreName" value="<%= semaphoreName %>"></font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 colspan="4" align="right" height="30"><font class=rtabletext>Apply Formatting To: </font></td>
+ <td class=rbg3 colspan="6" align="left"><font class=rtabletext>
+ <% String sValue = AppConstants.ST_CELL;
+ if(semaphore!=null)
+ sValue = nvl(semaphore.getSemaphoreType(), AppConstants.ST_CELL); %>
+ <select name="semaphoreType">
+ <%
+ for (Iterator iterC = listColumns.iterator(); iterC.hasNext();) {
+ DataColumnType dc = (DataColumnType) iterC.next();
+ if(dc.isVisible()) {
+ %>
+ <option value="<%= AppConstants.ST_CELL+"|"+dc.getColId() %>"<%= sValue.equals(AppConstants.ST_CELL+"|"+dc.getColId() )?" selected":"" %>><%=dc.getColName() %>
+ <%
+ }
+ }
+ %>
+ <option value="<%= AppConstants.ST_CELL %>"<%= sValue.equals(AppConstants.ST_CELL)?" selected":"" %>>Current Value Only
+ <option value="<%= AppConstants.ST_ROW %>"<%= sValue.equals(AppConstants.ST_ROW) ?" selected":"" %>>The Entire Row
+ </select></font></td>
+ </tr>
+ <tr>
+ <td colspan="10">&nbsp;</td>
+ </tr>
+ <tr class=rbg1>
+ <td align="center" valign="middle" colspan=2 height="30"><b class=rtableheader>Column Value Is</b></td>
+ <td align="center" valign="middle"><b class=rtableheader>Bold?</b></td>
+ <td align="center" valign="middle"><b class=rtableheader>Italic?</b></td>
+ <td align="center" valign="middle"><b class=rtableheader>Under-<br>line?</b></td>
+ <td align="center" valign="middle"><b class=rtableheader>Background Color</b></td>
+ <td align="center" valign="middle"><b class=rtableheader>Font Color</b></td>
+ <td align="center" valign="middle"><b class=rtableheader>Font Face</b></td>
+ <td align="center" valign="middle"><b class=rtableheader>Font Size</b></td>
+ <!--td align="center" valign="middle"><b class=rtableheader>Alignment</b></td-->
+ <td align="center" valign="middle"><b class=rtableheader>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Preview&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
+ </tr>
+<% for(int i = 0; i<3+((semaphore==null)?2:semaphore.getFormatList().getFormat().size()); i++) {
+ FormatType ft = null;
+ if(semaphore!=null&&i<semaphore.getFormatList().getFormat().size())
+ ft = (FormatType) semaphore.getFormatList().getFormat().get(i); %>
+ <tr<%= (i%2==0)?" class=rowalt1":" class=rowalt2" %>>
+ <% if(i==0) { %>
+ <td align="center" valign="middle" colspan=2 height="30">
+ <font class=rtabletext>Any Other</font>
+ <input type="hidden" name="formatId" value="<%= (ft==null)?"":ft.getFormatId() %>">
+ <input type="hidden" name="expression" value="">
+ <input type="hidden" name="lessThanValue" value="">
+ <!-- <input type="hidden" name="anyFmt" value="Y"> -->
+ </td>
+ <% } else { %>
+ <!-- <input type="hidden" name="anyFmt" value="N"> -->
+ <td align="center" valign="middle" height="30">
+ <input type="hidden" name="formatId" value="<%= (ft==null)?"":ft.getFormatId() %>">
+ <% sValue = "=";
+ if(ft!=null)
+ sValue = nvl(ft.getExpression(), "="); %>
+ <select name="expression">
+ <option value="="<%= sValue.equals("=") ?" selected":"" %>>=
+ <option value="&lt;&gt;"<%= sValue.equals("<>")?" selected":"" %>>&lt;&gt;
+ <option value="&gt;"<%= sValue.equals(">") ?" selected":"" %>>&gt;
+ <option value="&gt;="<%= sValue.equals(">=")?" selected":"" %>>&gt;=
+ <option value="&lt;"<%= sValue.equals("<") ?" selected":"" %>>&lt;
+ <option value="&lt;="<%= sValue.equals("<=")?" selected":"" %>>&lt;=
+ </select>
+ </td>
+ <td align="center" valign="middle">
+ <input type="text" size="10" name="lessThanValue" value="<%= (ft==null)?"":ft.getLessThanValue() %>">
+ </td>
+ <% } %>
+ <td align="center" valign="middle">
+ <% boolean bValue = false;
+ if(ft!=null)
+ bValue = ft.isBold(); %>
+ <input type="hidden" name="bold" value="<%= bValue?"Y":"N" %>">
+ <input type="checkbox" name="boldChk" value="Y"<%= bValue?" checked":"" %> onClick="setBold(<%= i %>)">
+ </td>
+ <td align="center" valign="middle">
+ <% bValue = false;
+ if(ft!=null)
+ bValue = ft.isItalic(); %>
+ <input type="hidden" name="italic" value="<%= bValue?"Y":"N" %>">
+ <input type="checkbox" name="italicChk" value="Y"<%= bValue?" checked":"" %> onClick="setItalic(<%= i %>)">
+ </td>
+ <td align="center" valign="middle">
+ <% bValue = false;
+ if(ft!=null)
+ bValue = ft.isUnderline(); %>
+ <input type="hidden" name="underline" value="<%= bValue?"Y":"N" %>">
+ <input type="checkbox" name="underlineChk" value="Y"<%= bValue?" checked":"" %> onClick="setUnderline(<%= i %>)">
+ </td>
+ <td align="center" valign="middle">
+ <% sValue = "";
+ if(ft!=null)
+ sValue = nvl(ft.getBgColor()); %>
+ <select name="bgColor" onChange="setBgColor(<%= i %>)">
+ <option value=""<%= sValue.equals("") ?" selected":"" %>>
+ <option value="#00FFFF"<%= sValue.equals("#00FFFF")?" selected":"" %>>Aqua
+ <option value="#000000"<%= sValue.equals("#000000")?" selected":"" %>>Black
+ <option value="#0000FF"<%= sValue.equals("#0000FF")?" selected":"" %>>Blue
+ <option value="#FF00FF"<%= sValue.equals("#FF00FF")?" selected":"" %>>Fuchsia
+ <option value="#808080"<%= sValue.equals("#808080")?" selected":"" %>>Gray
+ <option value="#008000"<%= sValue.equals("#008000")?" selected":"" %>>Green
+ <option value="#00FF00"<%= sValue.equals("#00FF00")?" selected":"" %>>Lime
+ <option value="#800000"<%= sValue.equals("#800000")?" selected":"" %>>Maroon
+ <option value="#000080"<%= sValue.equals("#000080")?" selected":"" %>>Navy
+ <option value="#808000"<%= sValue.equals("#808000")?" selected":"" %>>Olive
+ <option value="#FF9900"<%= sValue.equals("#FF9900")?" selected":"" %>>Orange
+ <option value="#800080"<%= sValue.equals("#800080")?" selected":"" %>>Purple
+ <option value="#FF0000"<%= sValue.equals("#FF0000")?" selected":"" %>>Red
+ <option value="#C0C0C0"<%= sValue.equals("#C0C0C0")?" selected":"" %>>Silver
+ <option value="#008080"<%= sValue.equals("#008080")?" selected":"" %>>Teal
+ <option value="#FFFFFF"<%= sValue.equals("#FFFFFF")?" selected":"" %>>White
+ <option value="#FFFF00"<%= sValue.equals("#FFFF00")?" selected":"" %>>Yellow
+ </select>
+ </td>
+ <td align="center" valign="middle">
+ <% sValue = "";
+ if(ft!=null)
+ sValue = nvl(ft.getFontColor()); %>
+ <select name="fontColor" onChange="setFontColor(<%= i %>)">
+ <option value=""<%= sValue.equals("") ?" selected":"" %>>
+ <option value="#00FFFF"<%= sValue.equals("#00FFFF")?" selected":"" %>>Aqua
+ <option value="#000000"<%= sValue.equals("#000000")?" selected":"" %>>Black
+ <option value="#0000FF"<%= sValue.equals("#0000FF")?" selected":"" %>>Blue
+ <option value="#FF00FF"<%= sValue.equals("#FF00FF")?" selected":"" %>>Fuchsia
+ <option value="#808080"<%= sValue.equals("#808080")?" selected":"" %>>Gray
+ <option value="#008000"<%= sValue.equals("#008000")?" selected":"" %>>Green
+ <option value="#00FF00"<%= sValue.equals("#00FF00")?" selected":"" %>>Lime
+ <option value="#800000"<%= sValue.equals("#800000")?" selected":"" %>>Maroon
+ <option value="#000080"<%= sValue.equals("#000080")?" selected":"" %>>Navy
+ <option value="#808000"<%= sValue.equals("#808000")?" selected":"" %>>Olive
+ <option value="#FF9900"<%= sValue.equals("#FF9900")?" selected":"" %>>Orange
+ <option value="#800080"<%= sValue.equals("#800080")?" selected":"" %>>Purple
+ <option value="#FF0000"<%= sValue.equals("#FF0000")?" selected":"" %>>Red
+ <option value="#C0C0C0"<%= sValue.equals("#C0C0C0")?" selected":"" %>>Silver
+ <option value="#008080"<%= sValue.equals("#008080")?" selected":"" %>>Teal
+ <option value="#FFFFFF"<%= sValue.equals("#FFFFFF")?" selected":"" %>>White
+ <option value="#FFFF00"<%= sValue.equals("#FFFF00")?" selected":"" %>>Yellow
+ </select>
+ </td>
+ <td align="center" valign="middle">
+ <% sValue = "";
+ if(ft!=null)
+ sValue = nvl(ft.getFontFace()); %>
+ <select name="fontFace" onChange="setFontFace(<%= i %>)">
+ <option value=""<%= sValue.equals("") ?" selected":"" %>>--- Default ---
+ <option value="Arial,Helvetica,sans-serif"<%= sValue.equals("Arial,Helvetica,sans-serif") ?" selected":"" %>>Arial
+ <option value="Courier New,Courier,mono"<%= sValue.equals("Courier New,Courier,mono") ?" selected":"" %>>Courier New
+ <option value="Geneva,Arial,Helvetica,sans-serif"<%= sValue.equals("Geneva,Arial,Helvetica,sans-serif") ?" selected":"" %>>Geneva
+ <option value="Georgia,Times New Roman,Times,serif"<%= sValue.equals("Georgia,Times New Roman,Times,serif")?" selected":"" %>>Georgia
+ <option value="Times New Roman,Times,serif"<%= sValue.equals("Times New Roman,Times,serif") ?" selected":"" %>>Times New Roman
+ <option value="Verdana,Arial,Helvetica,sans-serif"<%= sValue.equals("Verdana,Arial,Helvetica,sans-serif") ?" selected":"" %>>Verdana
+ </select>
+ </td>
+ <td align="center" valign="middle">
+ <% sValue = "11";
+ if(ft!=null)
+ sValue = nvl(ft.getFontSize(), "11"); %>
+ <select name="fontSize" onChange="setFontSize(<%= i %>)">
+ <option value="6"<%= sValue.equals("6") ?" selected":"" %>>6
+ <option value="8"<%= sValue.equals("8") ?" selected":"" %>>8
+ <option value="9"<%= sValue.equals("9") ?" selected":"" %>>9
+ <option value="10"<%= sValue.equals("10")?" selected":"" %>>10
+ <option value="11"<%= sValue.equals("11")?" selected":"" %>>11
+ <option value="12"<%= sValue.equals("12")?" selected":"" %>>12
+ <option value="14"<%= sValue.equals("14")?" selected":"" %>>14
+ <option value="16"<%= sValue.equals("16")?" selected":"" %>>16
+ <option value="18"<%= sValue.equals("18")?" selected":"" %>>18
+ <option value="24"<%= sValue.equals("24")?" selected":"" %>>24
+ <option value="36"<%= sValue.equals("36")?" selected":"" %>>36
+ <option value="48"<%= sValue.equals("48")?" selected":"" %>>48
+ <option value="72"<%= sValue.equals("72")?" selected":"" %>>72
+ </select>
+ </td>
+ <!--td align="center" valign="middle">
+ < % sValue = "left";
+ if(ft!=null)
+ sValue = nvl(ft.getAlignment(), "left"); % >
+ <select name="alignment" onChange="setAlignment(< %= i % >)">
+ <option value="left" < %= sValue.equals("left") ?" selected":"" % >>Left
+ <option value="center"< %= sValue.equals("center")?" selected":"" % >>Center
+ <option value="right" < %= sValue.equals("right") ?" selected":"" % >>Right
+ </select>
+ </td-->
+ <td valign="middle">
+ <span id="preview<%= i %>" style="font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#000000;width:100">Sample</span>
+ </td>
+ </tr>
+<% } // for
+%>
+ <tr>
+ <td colspan="10" align="center">
+ <br>
+ <input type="Submit" class=button name="submit_btn" value="Save">
+ <input type="Submit" class=button name="submit_btn" value="Save & More Rows">
+ <input type="Button" class=button value="Cancel" onClick="window.close();">
+ </td>
+ </tr>
+</table>
+
+</form>
+
+<% } // if(submitBtn.equals("Save")) { ... } else {
+%>
+
+</body>
+</html>
+
+<%! private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_sql.jsp
new file mode 100644
index 00000000..c685bb13
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_sql.jsp
@@ -0,0 +1,55 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+
+<html>
+<head>
+ <title><%= nvl((String) request.getAttribute(AppConstants.RI_PAGE_TITLE)) %></title>
+ <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
+</head>
+<body>
+<table width="94%" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 width="100%" valign="Middle">
+ <b class=rtableheader><%= nvl((String) request.getAttribute(AppConstants.RI_PAGE_SUBTITLE), nvl((String) request.getAttribute(AppConstants.RI_PAGE_TITLE))) %></b>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2<%= nvl((String) request.getAttribute("msg_align")) %>>
+ <font class=rtabletext><%= nvl((String) request.getAttribute(AppConstants.RI_FORMATTED_SQL)) %></font>
+ </td>
+ </tr>
+ <tr>
+ <td align="center">
+ <br>
+ <input type="Submit" class=rsmallbutton value="Close" onClick="window.close();">
+ </td>
+ </tr>
+</table>
+<br>
+</body>
+</html>
+
+<%! private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_table_cols.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_table_cols.jsp
new file mode 100644
index 00000000..9dec6a53
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_table_cols.jsp
@@ -0,0 +1,171 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+
+<% String tableName = AppUtils.getRequestValue(request, AppConstants.RI_TABLE_NAME);
+ String remoteDbPrefix = (String) session.getAttribute("remoteDB");
+ Vector tableSources = null;
+ Vector dbColumns = null;
+ if(tableName==null) {
+ tableSources = DataCache.getReportTableSources(remoteDbPrefix);
+ if(tableSources.size()>0)
+ tableName = ((TableSource) DataCache.getReportTableSources(remoteDbPrefix).get(0)).getTableName();
+ }
+ if(tableName!=null)
+ dbColumns = DataCache.getReportTableDbColumns(tableName.toUpperCase(),remoteDbPrefix);
+
+
+ boolean isSingleValueChoice = AppUtils.getRequestFlag(request, "single_value");
+ boolean includeTableNameInResult = AppUtils.getRequestFlag(request, "return_table_name");
+ boolean includeColTypeInResult = AppUtils.getRequestFlag(request, "return_col_type"); %>
+
+<html>
+<head>
+ <title>Table Columns</title>
+ <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
+ <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/ral.css">
+
+<script language=JavaScript>
+<!--
+ function setValue(newValue) {
+ window.opener.addText(newValue);
+ window.close();
+ } // setValue
+
+ function clearValue() {
+ window.opener.clearText();
+ window.close();
+ } // clearValue
+//-->
+</script>
+
+</head>
+<body>
+
+<% if(! isSingleValueChoice) { %>
+<script language=JavaScript>
+<!--
+ function getSelection() {
+ var selList = "";
+ <% if(dbColumns!=null) { %>
+ for(var i=0; i<<%= dbColumns.size() %>; i++)
+ if(document.dataform.dataChk[i].checked)
+ selList += ((selList=="")?"":", ")+document.dataform.dataChk[i].value;
+ <% } %>
+
+ setValue(selList);
+
+ return false;
+ } // getSelection
+//-->
+</script>
+<% } // if
+%>
+
+
+<form name="dataform" action="<%= AppUtils.getBaseURL() %>" method="post">
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="<%= AppConstants.RI_ACTION %>" value="report.popup.table.cols">
+<% if(isSingleValueChoice) { %>
+ <input type="hidden" name="single_value" value="Y">
+<% } %>
+<% if(includeTableNameInResult) { %>
+ <input type="hidden" name="return_table_name" value="Y">
+<% } %>
+<% if(includeColTypeInResult) { %>
+ <input type="hidden" name="return_col_type" value="Y">
+<% } %>
+
+<table class="mTAB" width=94% border=0 cellspacing=1 align=center>
+ <tr class=rbg1>
+ <td align="center" valign="middle" height="30">&nbsp;
+ <% if(! isSingleValueChoice) { %>
+ <input type=image src='<%= AppUtils.getImgFolderURL() %>downloadicon.gif' alt='Store selection' width=12 height=12 border=0 onClick="return getSelection()">&nbsp;
+ <% } %>
+ </td>
+ <td colspan="2" valign="middle" nowrap>
+ <select name="<%= AppConstants.RI_TABLE_NAME %>" onChange="document.dataform.submit()">
+ <% for(Iterator iter=DataCache.getReportTableSources(remoteDbPrefix).iterator(); iter.hasNext(); ) {
+ String iTableName = ((TableSource) iter.next()).getTableName(); %>
+ <option value="<%= iTableName %>"<%= iTableName.equals(tableName)?" selected":"" %>><%= iTableName %>
+ <% } // for
+ %>
+ </select>
+ <b class=rtableheader> DB Table Columns</b>
+ </td>
+ </tr>
+ <% int rNum = 0;
+ if(dbColumns!=null)
+ for(rNum=0; rNum<dbColumns.size(); rNum++) {
+ DBColumnInfo dbCol = (DBColumnInfo) dbColumns.get(rNum);
+ String sValue = (includeTableNameInResult?(tableName+"."):"")+dbCol.getColName()+(includeColTypeInResult?("|"+dbCol.getColType()):"");
+ String sDisplay = "["+tableName+"]."+dbCol.getColName(); %>
+ <tr<%= (rNum%2==0)?" class=rowalt1":" class=rowalt2" %>>
+ <td align="center" height="30"><font class=rtabletext><%= (rNum+1) %></font></td>
+ <% if(isSingleValueChoice) { %>
+ <td colspan="2"><font class=rtabletext><a href="javascript:setValue('<%= sValue %>')"><%= sDisplay %></a></font></td>
+ <% } else { %>
+ <td align="center" valign="middle">
+ <input type="checkbox" name="dataChk" value="<%= sValue %>">
+ </td>
+ <td><font class=rtabletext><%= sDisplay %></font></td>
+ <% } // else
+ %>
+ </tr>
+ <% } // for
+ if(rNum==0) { %>
+ <tr class=rbg3>
+ <td align="center" height="30" colspan="3"><font class=rtabletext>No columns found for table [<%= tableName %>]</font></td>
+ </tr>
+ <% } else { // if
+ %>
+ <tr class=rbg3>
+ <td colspan="3"><font class=rtabletext><a href="javascript:clearValue()"><%= "CLEAR VALUE" %></a></font></td>
+ </tr>
+ <%
+ }
+ %>
+ <tr class=rbg1>
+ <td align="center" valign="middle" height="30">&nbsp;
+ <% if(! isSingleValueChoice) { %>
+ <input type=image src='<%= AppUtils.getImgFolderURL() %>downloadicon.gif' alt='Store selection' width=12 height=12 border=0 onClick="return getSelection()">&nbsp;
+ <% } %>
+ </td>
+ <td colspan="2">&nbsp;</td>
+ </tr>
+</table>
+
+ <input type="hidden" name="dataChk" value="">
+ <input type="hidden" name="dataChk" value="">
+</form>
+
+</body>
+</html>
+
+<%! private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_testrun_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_testrun_sql.jsp
new file mode 100644
index 00000000..a5dbd502
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_testrun_sql.jsp
@@ -0,0 +1,103 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.io.*" %>
+<%@ page import="java.util.*" %>
+
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+
+<% Exception ex = (Exception) request.getAttribute(AppConstants.RI_EXCEPTION);
+ DataSet ds = (DataSet) request.getAttribute(AppConstants.RI_DATA_SET); %>
+
+<html>
+<head>
+<title>SQL Statement Test Run</title>
+<link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
+<script language="JavaScript">
+<!--
+function setOpenerConfirm() {
+<% if(AppUtils.getRequestNvlValue(request, AppConstants.RI_CHK_FIELD_SQL).equals("Y")&&ex==null) { %>
+ window.opener.setVerifyFlag();
+<% } %>
+} // setOpenerConfirm
+//-->
+</script>
+</head>
+<body onLoad="setOpenerConfirm()">
+<table class="mTAB" width="94%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 width="100%" valign="Middle"<%= (ds==null)?"":(" colspan="+(ds.getColumnCount()+1)) %>>
+ <b class=rtableheader>SQL Execution <%= (ex==null)?"Result - Success":"Generated Exception" %></b>
+ </td>
+ </tr>
+<% if(ex!=null) { %>
+ <tr>
+ <td class=rbg2>
+ <br>
+ <font class=rtabletext><%= nvl(ex.getMessage(), "&nbsp;") %></font>
+ <br><br>
+<!-------------------------------------------------------
+EXCEPTION [<%= ex.getMessage() %>]
+<% ex.printStackTrace(new PrintWriter(out)); %>
+-------------------------------------------------------->
+ </td>
+ </tr>
+<% } else if(ds!=null) { %>
+ <tr class=rbg1>
+ <td>&nbsp;</td>
+ <% for(int c=0; c<ds.getColumnCount(); c++) { %>
+ <td align="center" valign="Middle"><b class=rtabletext><%= ds.getColumnName(c) %></b></td>
+ <% } %>
+ </tr>
+ <% for(int r=0; r<Math.min(ds.getRowCount(), Globals.getDefaultPageSize()); r++) { %>
+ <tr<%= (r%2==0)?" class=rowalt1":" class=rowalt2" %>>
+ <td align="center" valign="Middle"><font class=rtabletext><%= (r+1) %></font></td>
+ <% for(int c=0; c<ds.getColumnCount(); c++) { %>
+ <td valign="Middle"><font class=rtabletext><%= nvl(ds.getString(r, c), "&nbsp;") %></font></td>
+ <% } %>
+ </tr>
+ <% } // for r
+ if(ds.getRowCount()>Globals.getDefaultPageSize()) { %>
+ <tr<%= (Globals.getDefaultPageSize()%2==0)?" class=rowalt1":" class=rowalt2" %>>
+ <td align="center" valign="Middle"><font class=rtabletext><%= (Globals.getDefaultPageSize()+1) %></font></td>
+ <td align="left" valign="Middle" colspan="<%= ds.getColumnCount() %>"><font class=rtabletext>...</font></td>
+ </tr>
+ <% } else if(ds.getRowCount()==0) { %>
+ <tr class=rbg3>
+ <td align="center" valign="Middle" colspan="<%= ds.getColumnCount()+1 %>"><font class=rtabletext>No data found</font></td>
+ </tr>
+ <% } // else if
+ } // else if
+%>
+ <tr>
+ <td align="center"<%= (ds==null)?"":(" colspan="+(ds.getColumnCount()+1)) %>>
+ <br>
+ <input type="Submit" class=button value="Close" onClick="window.close();">
+ </td>
+ </tr>
+</table>
+<br>
+</body>
+</html>
+
+<%! private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_csv.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_csv.jsp
new file mode 100644
index 00000000..81158047
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_csv.jsp
@@ -0,0 +1,89 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page trimDirectiveWhitespaces="true" %>
+<%@ page import="java.util.*" %><%@ page import="java.text.*" %><%@ page import="java.io.*" %><%@ page import="org.openecomp.portalsdk.analytics.model.*" %><%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %><%@ page import="org.openecomp.portalsdk.analytics.view.*" %><%@ page import="org.openecomp.portalsdk.analytics.system.*" %><%@ page import="org.openecomp.portalsdk.analytics.util.*" %><%
+ ReportRuntime rr = null;
+ ReportData rd = null;
+ String parent = "";
+ int parentFlag = 0;
+ if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), "");
+ if(parent.startsWith("parent_")) parentFlag = 1;
+ if(parentFlag == 1) {
+ rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr");
+ rd = (ReportData) request.getSession().getAttribute(parent+"_rd");
+ }
+ if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ if(rd==null) rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA);
+ String formattedReportName = new HtmlStripper().stripSpecialCharacters(rr.getReportName());
+ String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date());
+ String fName = formattedReportName+formattedDate+AppUtils.getUserID(request);
+ boolean raw = AppUtils.getRequestFlag(request, "raw");
+ if(true && !raw)
+ response.setContentType("application/octet-stream");
+ else
+ response.setContentType("application/csv");
+ String fileName = fName+".csv";
+ String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE);
+ if(true && !raw)
+ response.setHeader("Content-disposition","attachment;filename="+fName+".zip");
+ else
+ response.setHeader("Content-disposition","attachment;filename="+fName+".csv");
+ try {(new ReportHandler()).createCSVFileContent(out, rd, rr, sql_whole, request,fName);
+ //out.flush();
+ //out.close();
+ if(true) {
+ // response.reset();
+ ServletOutputStream outS = response.getOutputStream();
+ java.io.File file = null;
+ if(true && !raw) {
+ response.setContentType("application/octet-stream");
+ response.setHeader("Content-disposition","attachment;filename="+fName+".zip");
+ file = new java.io.File(AppUtils.getTempFolderPath()+""+fName+".zip");
+ } else {
+ response.setContentType("application/csv");
+ response.setHeader("Content-disposition","attachment;filename="+fName+".csv");
+ file = new java.io.File(AppUtils.getTempFolderPath()+""+fName+".csv");
+ }
+ FileInputStream fileIn = new FileInputStream(file);
+ int c;
+ while((c=fileIn.read()) != -1){
+ outS.write(c);
+ }
+ outS.flush();
+ outS.close();
+ fileIn.close();
+
+
+ /*byte[] outputByte = new byte[4096];
+ //copy binary contect to output stream
+ while(fileIn.read(outputByte, 0, 4096) != -1) {
+ outS.write(outputByte, 0, 4096);
+ }
+ fileIn.close();
+ outS.flush();
+ outS.close();*/
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ Log.write("Fatal error [report_download_csv.jsp]: "+e.getMessage());
+ }
+%>
+<%! private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_pdf.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_pdf.jsp
new file mode 100644
index 00000000..e5ae9dde
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_pdf.jsp
@@ -0,0 +1,40 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page trimDirectiveWhitespaces="true" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.pdf.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.view.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+<%
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ ReportData rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA);
+ try {
+ new PdfReportHandler().createPdfFileContent(request,response, 3);
+ } catch(Exception e) {
+ Log.write("Fatal error [report_download_pdf.jsp]: "+e.getMessage());
+ e.printStackTrace();
+ }
+ out.clear();
+ out = pageContext.pushBody();
+%>
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_xls.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_xls.jsp
new file mode 100644
index 00000000..a82470d8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_xls.jsp
@@ -0,0 +1,64 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.model.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.view.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+<%
+ReportRuntime rr = null;
+ReportData rd = null;
+String parent = "";
+int parentFlag = 0;
+if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), "");
+if(parent.startsWith("parent_")) parentFlag = 1;
+if(parentFlag == 1) {
+ rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr");
+ rd = (ReportData) request.getSession().getAttribute(parent+"_rd");
+}
+if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+if(rd==null) rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA);
+
+ if(rr != null && rr.getReportType().equals(AppConstants.RT_DASHBOARD)) {
+ //rr = (ReportRuntime) request.getSession().getAttribute("FirstDashReport");
+ } else if (rr == null)
+ rr = (ReportRuntime) request.getSession().getAttribute("FirstDashReport");
+ //rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA);
+
+ //response.setContentType("application/vnd.ms-excel");
+ //response.setHeader("Content-disposition","attachment;filename=download_all_"+AppUtils.getUserID(request)+".xls");
+ String user_id = AppUtils.getUserID(request);
+ try {
+/* if (rr.getReportType().equals(AppConstants.RT_CROSSTAB)) {
+ int downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ rd = rr.loadReportData(-1, AppUtils.getUserID(request), downloadLimit,request);
+ }
+*/
+ new ReportHandler().createExcelFileContent(out, rd, rr, request, response, user_id, 3); //3 whole
+ } catch(Exception e) {
+ e.printStackTrace();
+ Log.write("Fatal error [report_download_xls.jsp]: "+e.getMessage());
+ }
+ out.clear();
+ out = pageContext.pushBody();
+%>
+<%! private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_ebz.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_ebz.jsp
new file mode 100644
index 00000000..8d42b65b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_ebz.jsp
@@ -0,0 +1,179 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/header.css">
+<link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/portal_ebz_header.css">
+<link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css" >
+
+
+<script src= "app/fusion/external/ebz/angular_js/angular.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/angular-route.min.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/angular-sanitize.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/angular-cookies.js"></script>
+<script src="app/fusion/external/ebz/angular_js/angular-touch.js"></script>
+<script src="app/fusion/external/ebz/angular_js/angular-animate.js"></script>
+
+<script src= "app/fusion/external/ebz/angular_js/gestures.js"></script>
+<script src="static/js/jquery-1.10.2.js"></script>
+<script src="app/fusion/scripts/modalService.js"></script>
+<script src="static/js/jquery.mask.min.js" type="text/javascript"></script>
+<script src="static/js/jquery-ui.js" type="text/javascript"></script>
+<script src="app/fusion/external/ebz/sandbox/att-abs-tpls.js" type="text/javascript"></script>
+<script src="static/fusion/js/att_angular_gridster/ui-gridster-tpls.js"></script>
+<script src="static/fusion/js/att_angular_gridster/angular-gridster.js"></script>
+<script src= "app/fusion/external/ebz/angular_js/checklist-model.js"></script>
+<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/0.10.0/lodash.min.js"></script>
+<script src="app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js"></script>
+<script src="app/fusion/scripts/services/userInfoService.js"></script>
+<script src="app/fusion/scripts/services/leftMenuService.js"></script>
+
+
+<script src="static/fusion/raptor/ebz/dynamicform.js"></script>
+<script src="static/fusion/raptor/ebz/multiselect.js"></script>
+<script src="static/fusion/raptor/ebz/report_search.js"></script>
+<script src="static/fusion/raptor/ebz/report_run.js"></script>
+<script src="static/fusion/raptor/ebz/quick_links.js"></script>
+
+<script src="static/fusion/raptor/uigrid/vfs_fonts.js"></script>
+<script src="static/fusion/raptor/uigrid/ui-grid.js"></script>
+
+<script src="static/fusion/raptor/ebz/report_chart_wizard.js"></script>
+
+
+<script src="app/fusion/scripts/controllers/modelpopupController.js"></script>
+
+<script src="static/fusion/raptor/ebz/date_time_picker.js"></script>
+<script src="static/fusion/raptor/ebz/moment.js"></script>
+<link rel="stylesheet" href="static/fusion/raptor/ebz/date_time_picker.css"/>
+
+
+<link rel="stylesheet" href="static/fusion/raptor/uigrid/ui-grid.css" type="text/css">
+
+<div ng-controller="reportMainController">
+ <div ng-if='isViewRendering || isDataLoading' style="font-size:50px;color:#2ca02c">Loading...</div>
+ <div ng-view style="min-height: 400px;"></div>
+</div>
+<div ng-include src="app/fusion/scripts/view-models/profile-page/popup_modal.html"></div>
+
+<style>
+#accBar .att-accordion__heading span{
+ font-weight:bold;
+ position:relative;
+ margin:-10px;
+}
+#accTimeChart .att-accordion__heading span{
+ font-weight:bold;
+ position:relative;
+ margin:-10px;
+}
+#accFlexTimeChart .att-accordion__heading span{
+ font-weight:bold;
+ position:relative;
+ margin:-10px;
+}
+#accCommonOptions .att-accordion__heading span{
+ font-weight:bold;
+ position:relative;
+ margin:-10px;
+}
+
+#additionalOptions .att-accordion__heading span{
+ font-weight:bold;
+ position:relative;
+ margin:-10px;
+}
+
+
+
+</style>
+<script>
+angular.module('abs').requires.push('quantum', 'ngAnimate', 'ngTouch', 'ngRoute', 'ui.grid',
+ 'ui.grid.pagination','ui.grid.resizeColumns',
+ 'ui.grid.pinning');
+app.config(['$routeProvider',
+ function($routeProvider) {
+ $routeProvider.
+ when('/report_search', {
+ templateUrl: 'static/fusion/raptor/ebz/report_search.html',
+ controller: 'reportSearchController'
+ }).
+ when('/report_run/:reportUrlParams*', {
+ templateUrl: 'static/fusion/raptor/ebz/report_run.html',
+ controller: 'reportRunController'
+ }).
+ when('/report_chart_wizard/:reportId', {
+ templateUrl: 'static/fusion/raptor/ebz/report_chart_wizard.html',
+ controller: 'ChartController'
+ }).
+ otherwise({
+ redirectTo: '/report_search'
+ });
+ }]);
+
+app.factory('redirectInterceptor',['$q','$location','$window','$rootScope', function($q,$location,$window,$rootScope){
+ return {
+ 'request':function(config){
+ $rootScope.isDataLoading = true;
+ return config;
+ },
+ 'response':function(response,config){
+ if(typeof response.data === 'string' && response.data=="session has timed out for user") {
+ $window.location.href = 'login.htm';
+ return $q.reject(response);
+ }else{
+ //console.log('Inside response else ');
+ $rootScope.isDataLoading = false;
+ return response;
+ }
+ }
+ }
+}]);
+
+app.config(['$httpProvider',function($httpProvider) {
+ $httpProvider.interceptors.push('redirectInterceptor');
+}]);
+
+app.controller("reportMainController", [ '$scope', '$rootScope', '$parse', 'Grid', function($scope,$rootScope,$parse,Grid) {
+ $rootScope.isViewRendering = true;
+ $rootScope.$on('$routeChangeStart', function() {
+ $rootScope.isViewRendering = true;
+ });
+
+ Grid.prototype.getCellValue = function getCellValue(row, col){
+ if(col.field.indexOf('==')>-1){
+ var customField = col.field.split('==');
+ var obj = row.entity.filter(function(d){if(d.columnId==customField[0]) return true; });
+ if(obj.length>0){
+ return obj[0].searchresultField[customField[1]];
+ }
+ }
+ if ( typeof(row.entity[ '$$' + col.uid ]) !== 'undefined' ) {
+ return row.entity[ '$$' + col.uid].rendered;
+ } else if (this.options.flatEntityAccess && typeof(col.field) !== 'undefined' ){
+ return row.entity[col.field];
+ } else {
+ if (!col.cellValueGetterCache) {
+ col.cellValueGetterCache = $parse(row.getEntityQualifiedColField(col));
+ }
+ return col.cellValueGetterCache(row);
+ }
+ };
+
+}]);
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_import.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_import.jsp
new file mode 100644
index 00000000..014f98ac
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_import.jsp
@@ -0,0 +1,69 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+
+<html>
+<head>
+ <title>Import</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
+
+
+<br><br>
+
+<form name="forma" action="<%= AppUtils.getBaseURL() %>" method="post">
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="<%= AppConstants.RI_ACTION %>" value="report.import.save">
+
+<table width=94% class="tableBorder" border=0 cellspacing=1 cellpadding=3 align=center>
+ <tr class=rbg1>
+ <td>
+ <b class=rtableheader><%= Globals.getBaseTitle() %> > IMPORT REPORT XML</b>
+ </td>
+ </tr>
+ <tr class=rbg3>
+ <td align="center">
+ <font class=rtabletext>
+ <textarea name="reportXML" cols="62" rows="16"></textarea>
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td align="center">
+ <br>
+ <input type="Submit" class=button value="Import" onClick="if(document.forma.reportXML.value=='') { alert('Please provide report XML.'); return false; }">
+ </td>
+ </tr>
+</table>
+
+
+
+</form>
+
+<jsp:include page="disclaimer.jsp" flush="true" />
+
+</body>
+</html>
+
+<%! private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_sample.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_sample.jsp
new file mode 100644
index 00000000..cfbfad14
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_sample.jsp
@@ -0,0 +1,40 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<h1 class="heading1" style="margin-bottom:20px">Customizable Analytics Dashboard</h1>
+ <iframe src="report_embedded#/report_run/c_master=3356&refresh=Y&hideGrid=true&width=550&height=400&leftMargin=0"
+ width="500" height="470"
+ scrolling="no" style="border: none; background-color: #f2f2f2; opacity: 1;"></iframe>
+
+ <iframe src="report_embedded#/report_run/c_master=3321&refresh=Y&hideGrid=true&width=550&height=300"
+ width="450" height="450"
+ scrolling="no" style="border: none; background-color: #f2f2f2; opacity: 1;"></iframe>
+
+<!-- <iframe src="report_embedded#/report_run/c_master=3323&refresh=Y&hideFormFields=true&ff1=2&ff1=4&ff1=5&ff1=6&ff1=7&ff1=8&display_content=Y&r_page=0"
+ width="625" height="250"
+ scrolling="no" style="border: none; background-color: #f2f2f2; opacity: 1;"></iframe>
+ -->
+ <iframe src="report_embedded#/report_run/c_master=3324&refresh=Y&hideFormFields=true&ff1=12/10/2015&display_content=Y&r_page=0"
+ width="625" height="425"
+ scrolling="no" style="border: none; background-color: #f2f2f2; opacity: 1;"></iframe>
+
+<!-- <iframe src="report_embedded#/report_run/c_master=3327&refresh=Y&hideFormFields=true&ff1=6&ff2=1&display_content=Y&r_page=0"
+ width="625" height="250"
+ scrolling="no" style="border: none; background-color: #f2f2f2; opacity: 1;"></iframe>
+ -->
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_search.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_search.jsp
new file mode 100644
index 00000000..480bdbcb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_search.jsp
@@ -0,0 +1,2432 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-touch.js"></script>
+<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-animate.js"></script>
+<script src="http://ui-grid.info/release/ui-grid.js"></script>
+<link rel="stylesheet" href="http://ui-grid.info/release/ui-grid.css" type="text/css">
+
+<style></style>
+
+<div ng-controller="reportSearchController">
+ <div id="grid1" ui-grid="gridOptions" ui-grid-pagination ui-grid-selection ui-grid-exporter class="grid"></div>
+</div>
+
+<script>
+angular.module('abs').requires.push('ngAnimate', 'ngTouch', 'ui.grid','ui.grid.pagination','ui.grid.selection', 'ui.grid.exporter');
+app.controller("reportSearchController", function ($scope,$http,$parse,uiGridConstants,Grid) {
+ $scope.searchdData = {
+ "metaReport" : {
+ "pagination" : true,
+ "pageSize" : 20,
+ "totalSize" : 9,
+ "pageNo" : -1
+ },
+ "columns" : [ [ {
+ "columnId" : "no",
+ "columnTitle" : "No",
+ "columnWidth" : "5%",
+ "alignment" : "Center",
+ "linkURL" : null,
+ "linkTitle" : null,
+ "linkForm" : null,
+ "linkConfirmMsg" : null,
+ "linkImg" : null,
+ "linkImgWidth" : null,
+ "linkImgHeight" : null,
+ "copyLink" : false,
+ "editLink" : false,
+ "deleteLink" : false,
+ "scheduleLink" : false,
+ "columnTitleHtml" : "No",
+ "columnWidthHtml" : " width=5%",
+ "linkImgSizeHtml" : ""
+ }, {
+ "columnId" : "rep_id",
+ "columnTitle" : "Report ID",
+ "columnWidth" : "5%",
+ "alignment" : "Center",
+ "linkURL" : null,
+ "linkTitle" : null,
+ "linkForm" : null,
+ "linkConfirmMsg" : null,
+ "linkImg" : null,
+ "linkImgWidth" : null,
+ "linkImgHeight" : null,
+ "copyLink" : false,
+ "editLink" : false,
+ "deleteLink" : false,
+ "scheduleLink" : false,
+ "columnTitleHtml" : "Report ID",
+ "columnWidthHtml" : " width=5%",
+ "linkImgSizeHtml" : ""
+ }, {
+ "columnId" : "rep_name",
+ "columnTitle" : "Report Name",
+ "columnWidth" : "25%",
+ "alignment" : "Left",
+ "linkURL" : null,
+ "linkTitle" : null,
+ "linkForm" : null,
+ "linkConfirmMsg" : null,
+ "linkImg" : null,
+ "linkImgWidth" : null,
+ "linkImgHeight" : null,
+ "copyLink" : false,
+ "editLink" : false,
+ "deleteLink" : false,
+ "scheduleLink" : false,
+ "columnTitleHtml" : "Report Name",
+ "columnWidthHtml" : " width=25%",
+ "linkImgSizeHtml" : ""
+ }, {
+ "columnId" : "descr",
+ "columnTitle" : "Description",
+ "columnWidth" : "30%",
+ "alignment" : "Left",
+ "linkURL" : null,
+ "linkTitle" : null,
+ "linkForm" : null,
+ "linkConfirmMsg" : null,
+ "linkImg" : null,
+ "linkImgWidth" : null,
+ "linkImgHeight" : null,
+ "copyLink" : false,
+ "editLink" : false,
+ "deleteLink" : false,
+ "scheduleLink" : false,
+ "columnTitleHtml" : "Description",
+ "columnWidthHtml" : " width=30%",
+ "linkImgSizeHtml" : ""
+ }, {
+ "columnId" : "owner",
+ "columnTitle" : "Report Owner",
+ "columnWidth" : "10%",
+ "alignment" : "Center",
+ "linkURL" : null,
+ "linkTitle" : null,
+ "linkForm" : null,
+ "linkConfirmMsg" : null,
+ "linkImg" : null,
+ "linkImgWidth" : null,
+ "linkImgHeight" : null,
+ "copyLink" : false,
+ "editLink" : false,
+ "deleteLink" : false,
+ "scheduleLink" : false,
+ "columnTitleHtml" : "Report Owner",
+ "columnWidthHtml" : " width=10%",
+ "linkImgSizeHtml" : ""
+ }, {
+ "columnId" : "create_date",
+ "columnTitle" : "Create Date",
+ "columnWidth" : "10%",
+ "alignment" : "Center",
+ "linkURL" : null,
+ "linkTitle" : null,
+ "linkForm" : null,
+ "linkConfirmMsg" : null,
+ "linkImg" : null,
+ "linkImgWidth" : null,
+ "linkImgHeight" : null,
+ "copyLink" : false,
+ "editLink" : false,
+ "deleteLink" : false,
+ "scheduleLink" : false,
+ "columnTitleHtml" : "Create Date",
+ "columnWidthHtml" : " width=10%",
+ "linkImgSizeHtml" : ""
+ }, {
+ "columnId" : "copy",
+ "columnTitle" : "&nbsp;&nbsp;Copy&nbsp;&nbsp;",
+ "columnWidth" : "5%",
+ "alignment" : "Center",
+ "linkURL" : "document.forma.r_action.value='report.copy';",
+ "linkTitle" : "Copy report",
+ "linkForm" : "forma",
+ "linkConfirmMsg" : "Are you sure you want to create a copy of this report?",
+ "linkImg" : "static/fusion/raptor/images/modify_icon.gif",
+ "linkImgWidth" : "13",
+ "linkImgHeight" : "12",
+ "copyLink" : true,
+ "editLink" : false,
+ "deleteLink" : false,
+ "scheduleLink" : false,
+ "columnTitleHtml" : "&nbsp;&nbsp;Copy&nbsp;&nbsp;",
+ "columnWidthHtml" : " width=5%",
+ "linkImgSizeHtml" : " width=\"13\" height=\"12\""
+ }, {
+ "columnId" : "edit",
+ "columnTitle" : "&nbsp;&nbsp;Edit&nbsp;&nbsp;",
+ "columnWidth" : "5%",
+ "alignment" : "Center",
+ "linkURL" : "document.forma.r_action.value='report.edit';",
+ "linkTitle" : "Edit report",
+ "linkForm" : "forma",
+ "linkConfirmMsg" : null,
+ "linkImg" : "static/fusion/raptor/images/pen_paper.gif",
+ "linkImgWidth" : "12",
+ "linkImgHeight" : "12",
+ "copyLink" : false,
+ "editLink" : true,
+ "deleteLink" : false,
+ "scheduleLink" : false,
+ "columnTitleHtml" : "&nbsp;&nbsp;Edit&nbsp;&nbsp;",
+ "columnWidthHtml" : " width=5%",
+ "linkImgSizeHtml" : " width=\"12\" height=\"12\""
+ }, {
+ "columnId" : "delete",
+ "columnTitle" : "Delete",
+ "columnWidth" : "5%",
+ "alignment" : "Center",
+ "linkURL" : "document.forma.r_action.value='report.delete';",
+ "linkTitle" : "Delete report",
+ "linkForm" : "forma",
+ "linkConfirmMsg" : "Are you sure you want to delete this report?",
+ "linkImg" : "static/fusion/raptor/images/deleteicon.gif",
+ "linkImgWidth" : "12",
+ "linkImgHeight" : "12",
+ "copyLink" : false,
+ "editLink" : false,
+ "deleteLink" : true,
+ "scheduleLink" : false,
+ "columnTitleHtml" : "Delete",
+ "columnWidthHtml" : " width=5%",
+ "linkImgSizeHtml" : " width=\"12\" height=\"12\""
+ }, {
+ "columnId" : "schedule",
+ "columnTitle" : "Schedule",
+ "columnWidth" : "5%",
+ "alignment" : "Center",
+ "linkURL" : "document.forma.r_action.value='report.schedule.report.submit_wmenu';",
+ "linkTitle" : "Schedule report",
+ "linkForm" : "forma",
+ "linkConfirmMsg" : null,
+ "linkImg" : "static/fusion/raptor/images/calendar_icon.gif",
+ "linkImgWidth" : "20",
+ "linkImgHeight" : "20",
+ "copyLink" : false,
+ "editLink" : false,
+ "deleteLink" : false,
+ "scheduleLink" : true,
+ "columnTitleHtml" : "Schedule",
+ "columnWidthHtml" : " width=5%",
+ "linkImgSizeHtml" : " width=\"20\" height=\"20\""
+ }, {
+ "columnId" : "run",
+ "columnTitle" : "&nbsp;&nbsp;Run&nbsp;&nbsp;",
+ "columnWidth" : "5%",
+ "alignment" : "Center",
+ "linkURL" : "document.forma.r_action.value='report.run';",
+ "linkTitle" : "Run report",
+ "linkForm" : "forma",
+ "linkConfirmMsg" : null,
+ "linkImg" : "static/fusion/raptor/images/test_run.gif",
+ "linkImgWidth" : "12",
+ "linkImgHeight" : "12",
+ "copyLink" : false,
+ "editLink" : false,
+ "deleteLink" : false,
+ "scheduleLink" : false,
+ "columnTitleHtml" : "&nbsp;&nbsp;Run&nbsp;&nbsp;",
+ "columnWidthHtml" : " width=5%",
+ "linkImgSizeHtml" : " width=\"12\" height=\"12\""
+ } ] ],
+ "rows" : [ [ [ {
+ "columnId" : "no",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "1",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "1",
+ "displayValueHtml" : "1",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "610",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "610",
+ "displayValueHtml" : "610",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "610",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "610",
+ "displayValueHtml" : "610",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"610\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 1</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"610\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 1</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"610\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 1</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"610\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 1</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"610\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 1</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"610\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 1</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "03/02/2009",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "03/02/2009",
+ "displayValueHtml" : "03/02/2009",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "03/02/2009",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "03/02/2009",
+ "displayValueHtml" : "03/02/2009",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='610'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='610'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='610'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='610'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Schedule report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/calendar_icon.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"Schedule report\" onClick=\"document.forma.r_action.value='report.schedule.report.submit_wmenu'; document.forma.c_master.value='610'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/calendar_icon.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"Schedule report\" onClick=\"document.forma.r_action.value='report.schedule.report.submit_wmenu'; document.forma.c_master.value='610'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Schedule report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Schedule report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/calendar_icon.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"Schedule report\" onClick=\"document.forma.r_action.value='report.schedule.report.submit_wmenu'; document.forma.c_master.value='610'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/calendar_icon.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"Schedule report\" onClick=\"document.forma.r_action.value='report.schedule.report.submit_wmenu'; document.forma.c_master.value='610'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Schedule report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='610'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='610'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='610'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='610'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ } ], [ {
+ "columnId" : "no",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "2",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "2",
+ "displayValueHtml" : "2",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "630",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "630",
+ "displayValueHtml" : "630",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "630",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "630",
+ "displayValueHtml" : "630",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"630\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 2</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"630\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 2</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"630\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 2</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"630\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 2</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"630\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 2</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"630\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 2</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "03/03/2009",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "03/03/2009",
+ "displayValueHtml" : "03/03/2009",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "03/03/2009",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "03/03/2009",
+ "displayValueHtml" : "03/03/2009",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='630'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='630'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='630'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='630'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='630'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='630'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='630'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='630'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ } ], [ {
+ "columnId" : "no",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "3",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "3",
+ "displayValueHtml" : "3",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "637",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "637",
+ "displayValueHtml" : "637",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "637",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "637",
+ "displayValueHtml" : "637",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"637\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 3 </a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"637\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 3 </a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"637\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 3 </a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"637\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 3 </a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"637\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 3 </a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"637\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Dashboard Type: Report 3 </a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "03/04/2009",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "03/04/2009",
+ "displayValueHtml" : "03/04/2009",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "03/04/2009",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "03/04/2009",
+ "displayValueHtml" : "03/04/2009",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='637'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='637'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='637'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='637'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Schedule report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/calendar_icon.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"Schedule report\" onClick=\"document.forma.r_action.value='report.schedule.report.submit_wmenu'; document.forma.c_master.value='637'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/calendar_icon.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"Schedule report\" onClick=\"document.forma.r_action.value='report.schedule.report.submit_wmenu'; document.forma.c_master.value='637'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Schedule report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Schedule report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/calendar_icon.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"Schedule report\" onClick=\"document.forma.r_action.value='report.schedule.report.submit_wmenu'; document.forma.c_master.value='637'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/calendar_icon.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"Schedule report\" onClick=\"document.forma.r_action.value='report.schedule.report.submit_wmenu'; document.forma.c_master.value='637'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Schedule report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='637'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='637'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='637'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='637'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ } ], [ {
+ "columnId" : "no",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "4",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "4",
+ "displayValueHtml" : "4",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "3321",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "3321",
+ "displayValueHtml" : "3321",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "3321",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "3321",
+ "displayValueHtml" : "3321",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3321\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_BAR_CHART_INTERACTIVE</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3321\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_BAR_CHART_INTERACTIVE</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3321\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_BAR_CHART_INTERACTIVE</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3321\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_BAR_CHART_INTERACTIVE</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3321\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_BAR_CHART_INTERACTIVE</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3321\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_BAR_CHART_INTERACTIVE</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "03/06/2013",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "03/06/2013",
+ "displayValueHtml" : "03/06/2013",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "03/06/2013",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "03/06/2013",
+ "displayValueHtml" : "03/06/2013",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='3321'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='3321'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='3321'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='3321'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='3321'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='3321'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='3321'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='3321'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ } ], [ {
+ "columnId" : "no",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "5",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "5",
+ "displayValueHtml" : "5",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "1012",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "1012",
+ "displayValueHtml" : "1012",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "1012",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "1012",
+ "displayValueHtml" : "1012",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"1012\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Demo: Dashboard - 2</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"1012\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Demo: Dashboard - 2</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"1012\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Demo: Dashboard - 2</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"1012\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Demo: Dashboard - 2</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"1012\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Demo: Dashboard - 2</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"1012\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Demo: Dashboard - 2</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "05/06/2009",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "05/06/2009",
+ "displayValueHtml" : "05/06/2009",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "05/06/2009",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "05/06/2009",
+ "displayValueHtml" : "05/06/2009",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='1012'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='1012'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='1012'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='1012'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Schedule report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/calendar_icon.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"Schedule report\" onClick=\"document.forma.r_action.value='report.schedule.report.submit_wmenu'; document.forma.c_master.value='1012'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/calendar_icon.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"Schedule report\" onClick=\"document.forma.r_action.value='report.schedule.report.submit_wmenu'; document.forma.c_master.value='1012'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Schedule report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Schedule report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/calendar_icon.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"Schedule report\" onClick=\"document.forma.r_action.value='report.schedule.report.submit_wmenu'; document.forma.c_master.value='1012'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/calendar_icon.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"Schedule report\" onClick=\"document.forma.r_action.value='report.schedule.report.submit_wmenu'; document.forma.c_master.value='1012'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Schedule report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='1012'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='1012'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='1012'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='1012'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ } ], [ {
+ "columnId" : "no",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "6",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "6",
+ "displayValueHtml" : "6",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "3322",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "3322",
+ "displayValueHtml" : "3322",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "3322",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "3322",
+ "displayValueHtml" : "3322",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3322\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_LINE_CHART_INTERACTIVE</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3322\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_LINE_CHART_INTERACTIVE</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3322\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_LINE_CHART_INTERACTIVE</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3322\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_LINE_CHART_INTERACTIVE</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3322\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_LINE_CHART_INTERACTIVE</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3322\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_LINE_CHART_INTERACTIVE</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "03/06/2013",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "03/06/2013",
+ "displayValueHtml" : "03/06/2013",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "03/06/2013",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "03/06/2013",
+ "displayValueHtml" : "03/06/2013",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='3322'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='3322'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='3322'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='3322'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='3322'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='3322'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='3322'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='3322'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ } ], [ {
+ "columnId" : "no",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "7",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "7",
+ "displayValueHtml" : "7",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "3304",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "3304",
+ "displayValueHtml" : "3304",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "3304",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "3304",
+ "displayValueHtml" : "3304",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3304\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_PIE_CHART</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3304\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_PIE_CHART</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3304\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_PIE_CHART</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3304\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_PIE_CHART</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3304\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_PIE_CHART</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"3304\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>DEMO_PIE_CHART</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "12/11/2012",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "12/11/2012",
+ "displayValueHtml" : "12/11/2012",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "12/11/2012",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "12/11/2012",
+ "displayValueHtml" : "12/11/2012",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='3304'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='3304'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='3304'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='3304'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='3304'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='3304'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='3304'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='3304'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ } ], [ {
+ "columnId" : "no",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "8",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "8",
+ "displayValueHtml" : "8",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "526",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "526",
+ "displayValueHtml" : "526",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "526",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "526",
+ "displayValueHtml" : "526",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"526\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>RS Report CrossTab 3</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"526\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>RS Report CrossTab 3</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"526\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>RS Report CrossTab 3</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"526\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>RS Report CrossTab 3</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"526\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>RS Report CrossTab 3</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"526\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>RS Report CrossTab 3</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "CrossTab ",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "CrossTab ",
+ "displayValueHtml" : "CrossTab ",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "CrossTab ",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "CrossTab ",
+ "displayValueHtml" : "CrossTab ",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "01/29/2009",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "01/29/2009",
+ "displayValueHtml" : "01/29/2009",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "01/29/2009",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "01/29/2009",
+ "displayValueHtml" : "01/29/2009",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='526'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='526'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='526'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='526'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='526'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='526'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='526'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='526'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ } ], [ {
+ "columnId" : "no",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "9",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "9",
+ "displayValueHtml" : "9",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "2671",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "2671",
+ "displayValueHtml" : "2671",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_id",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "2671",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "2671",
+ "displayValueHtml" : "2671",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"2671\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Test: CROSSTAB</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"2671\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Test: CROSSTAB</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"2671\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Test: CROSSTAB</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "rep_name",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"2671\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Test: CROSSTAB</a>",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"2671\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Test: CROSSTAB</a>",
+ "displayValueHtml" : "<a class=\"hyperref1\" href='#' onClick='document.forma.r_action.value=\"report.run\";document.forma.c_master.value=\"2671\";document.forma.refresh.value=\"Y\";document.forma.submit();return false;'>Test: CROSSTAB</a>",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "descr",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "owner",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Super User",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "Super User",
+ "displayValueHtml" : "Super User",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "09/22/2010",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "09/22/2010",
+ "displayValueHtml" : "09/22/2010",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "create_date",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "09/22/2010",
+ "alignment" : "Center",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "09/22/2010",
+ "displayValueHtml" : "09/22/2010",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='2671'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='2671'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "copy",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Copy report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='2671'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/modify_icon.gif\" width=\"13\" height=\"12\" border=\"0\" alt=\"Copy report\" onClick=\"if(! confirm('Are you sure you want to create a copy of this report?')) return false; document.forma.r_action.value='report.copy'; document.forma.c_master.value='2671'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Copy report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "edit",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "delete",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "schedule",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "",
+ "alignment" : "Left",
+ "drillDownLink" : null,
+ "displayValueLinkHtml" : "&nbsp;",
+ "displayValueHtml" : "&nbsp;",
+ "alignmentHtml" : " align=Left"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='2671'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='2671'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ }, {
+ "columnId" : "run",
+ "searchresultField" : {
+ "columnId" : null,
+ "displayValue" : "Run report",
+ "alignment" : "Center",
+ "drillDownLink" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='2671'; document.forma.refresh.value='Y';\">",
+ "displayValueLinkHtml" : "<input type=\"image\" src=\"static/fusion/raptor/images/test_run.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Run report\" onClick=\"document.forma.r_action.value='report.run'; document.forma.c_master.value='2671'; document.forma.refresh.value='Y';\">",
+ "displayValueHtml" : "Run report",
+ "alignmentHtml" : " align=Center"
+ }
+ } ] ] ]
+ };
+ var getByColumnId = function(input, id) {
+ var i=0, len=input.length;
+ for (; i<len; i++) {
+ if (+input[i].columnId == +id) {
+ return input[i];
+ }
+ }
+ return null;
+ };
+
+
+ var paginationOptions = {
+ pageNumber: 1,
+ pageSize: 25,
+ sort: null
+ };
+ Grid.prototype.getCellValue = function getCellValue(row, col){
+ if(col.field.indexOf('==')>-1){
+ var obj = row.entity.filter(function(d){if(d.columnId==col.field.substring(2)) return true; });
+ if(obj.length>0){
+ return obj[0].searchresultField.displayValue;
+ }
+ }
+ if ( typeof(row.entity[ '$$' + col.uid ]) !== 'undefined' ) {
+ return row.entity[ '$$' + col.uid].rendered;
+ } else if (this.options.flatEntityAccess && typeof(col.field) !== 'undefined' ){
+ return row.entity[col.field];
+ } else {
+
+ if (!col.cellValueGetterCache) {
+ col.cellValueGetterCache = $parse(row.getEntityQualifiedColField(col));
+ }
+ return col.cellValueGetterCache(row);
+ }
+ };
+
+ $scope.gridOptions = {
+ paginationPageSizes: [25, 50, 75],
+ paginationPageSize: 25,
+ enableGridMenu: true,
+ enableSelectAll: true,
+ exporterCsvFilename: 'myFile.csv',
+ exporterPdfDefaultStyle: {fontSize: 9},
+ exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
+ exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
+ exporterPdfHeader: { text: "My Header", style: 'headerStyle' },
+ exporterPdfFooter: function ( currentPage, pageCount ) {
+ return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
+ },
+ exporterPdfCustomFormatter: function ( docDefinition ) {
+ docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
+ docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
+ return docDefinition;
+ },
+ exporterPdfOrientation: 'portrait',
+ exporterPdfPageSize: 'LETTER',
+ exporterPdfMaxGridWidth: 500,
+ exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
+ onRegisterApi: function(gridApi){
+ $scope.gridApi = gridApi;
+ },
+ useExternalPagination: true,
+ useExternalSorting: true,
+ columnDefs: [ ],
+ onRegisterApi: function(gridApi) {
+ $scope.gridApi = gridApi;
+ $scope.gridApi.core.on.sortChanged($scope, function(grid, sortColumns) {
+ if (sortColumns.length == 0) {
+ paginationOptions.sort = null;
+ } else {
+ paginationOptions.sort = sortColumns[0].sort.direction;
+ }
+ getPage();
+ });
+ gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
+ paginationOptions.pageNumber = newPage;
+ paginationOptions.pageSize = pageSize;
+ getPage();
+ });
+ }
+ };
+
+ //$scope.getCellValue = function() {
+ // $scope.gridOptions.data = $scope.searchdData.rows[0];
+ // console.log($scope.gridOptions.data[1][0].displayValue);
+ // };
+
+
+
+ var getPage = function() {
+ };
+ $scope.searchdData.columns[0].forEach(function(entry) {
+ $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: '=='+entry.columnId});
+ });
+ $scope.gridOptions.data = $scope.searchdData.rows[0].splice(1,8);
+
+ getPage();
+
+});
+
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_wizard.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_wizard.jsp
new file mode 100644
index 00000000..cdfe943a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_wizard.jsp
@@ -0,0 +1,309 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%--
+ Name: report_wizard.jsp
+ Use : Master JSP which navigates to specific JSP when different tab is selected. Default it navigates to the wizard_definition.jsp
+
+ Change Log
+ ==========
+
+ 22-Jun-2009 : Version 8.4 (Sundar);
+
+ <UL>
+ <LI> Save button is suppressed from showing when wizard is in the last page (Run page).</LI>
+ <LI> width of the content_iframe is changed back to default one when navigated from >100% report's run page.</LI>
+ </UL>
+--%>
+<%@ page import="java.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+
+<%@ page errorPage="error_page.jsp" %>
+<html>
+ <body>
+<script language="Javascript" src="<%= AppUtils.getBaseFolderURL() %>js/form-field-tooltip.js"></script>
+<script language="Javascript" src="<%= AppUtils.getBaseFolderURL() %>js/other_scripts.js"></script>
+<style>
+td, th {
+ padding: 0px;
+}
+</style>
+<script>
+ <%
+ String paramString = "";
+ Enumeration en = request.getParameterNames();
+ if (en != null) {
+ while (en.hasMoreElements()) {
+ String name = (String) en.nextElement();
+ String values[] = request.getParameterValues(name);
+ if (name.equals(AppConstants.RI_ACTION) == false
+ && name.equals("c_master") == false && name.equals("action") == false
+ && values != null) {
+ for (int i = 0; i < values.length; i++) {
+ //values[i] = values[i].replaceAll("=", "%3d");
+ //values[i] = values[i].replaceAll("\\?", "%3f");
+ //values[i] = values[i].replaceAll("&", "%26");
+ //System.out.println(name + " (" + i + "): [" + values[i] + "]");
+ paramString = paramString + "&" + name + "=" + java.net.URLEncoder.encode(values[i],"UTF8");
+ }
+ }
+ }
+ }
+
+ %>
+ if (window.parent.document.getElementById('content_Iframe') || window.document.getElementById('content_Iframe')){
+ }else{
+ //window.location="<%= AppUtils.getRaptorActionURL() %>report.create.container&c_master=<%=request.getParameter("c_master")%><%=paramString%>";
+ }
+</script>
+<% ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+
+ String reportID = rdef.getReportID();
+ WizardSequence ws = rdef.getWizardSequence();
+
+ String curStep = ws.getCurrentStep();
+ String curSubStep = ws.getCurrentSubStep();
+
+ String dbInfo = null;
+ dbInfo = rdef.getDBInfo();
+ int sessionflag = 0;
+ if(dbInfo == null || dbInfo.length() == 0) {
+ dbInfo = (String) session.getAttribute("remoteDB");
+ sessionflag = 1;
+ }
+ session.setAttribute("remoteDB", dbInfo);
+ if((dbInfo == null) && (request.getParameter("dataSource")!=null))
+ session.setAttribute("remoteDB", request.getParameter("dataSource"));
+
+ String title = (reportID.equals("-1")?"Create Report":"Edit Report");
+ String navTitle = Globals.getBaseTitle()+" > " + title;
+
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
+%>
+<!-- Set All variable to request, to enable included jsp to access it -->
+<%
+ request.setAttribute(AppConstants.SI_REPORT_DEFINITION,rdef);
+%>
+
+ <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
+ <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/ral.css">
+
+
+<script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/raptor.js"></script>
+
+<jsp:include page="error_include.jsp" flush="true" />
+
+<table width="100%" >
+<tr><td id="folderTreeContainer" width="1%" height='300' valign='top' ><table>
+ <!--<jsp:include page="tree/folderNav.jsp" flush="true" >
+ <jsp:param name="doCollapseTree" value="Y" />
+ </jsp:include>-->
+ </table>
+</td>
+<td id="searchContentContainer" valign='top' >
+<div id="contentDiv" style="position:absoulte;overflow:auto;">
+<jsp:include page="custom_js_include.jsp" flush="true" />
+<form id="forma" name="forma" action="<%= AppUtils.getBaseURL() %>" method="post">
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="<%= AppConstants.RI_ACTION %>" value="report.wizard">
+ <input type="hidden" name="<%= AppConstants.RI_REPORT_ID %>" value="<%= reportID %>">
+ <input type="hidden" name="<%= AppConstants.RI_DETAIL_ID %>" id="<%= AppConstants.RI_DETAIL_ID %>" value="<%= AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID) %>">
+ <input type="hidden" id="<%= AppConstants.RI_GO_TO_STEP %>" name="<%= AppConstants.RI_GO_TO_STEP %>" value="">
+ <input type="hidden" id="<%= AppConstants.RI_WIZARD_ACTION %>" name="<%= AppConstants.RI_WIZARD_ACTION %>" value="<%= AppConstants.WA_BACK %>">
+ <input type="hidden" name="<%= AppConstants.RI_JAVASCRIPT_ITEM_ID %>" value="">
+
+<table width="94%" border="0" cellspacing="0" cellpadding="0" align=center>
+<tr><td>
+ <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin: 0px;">
+ <tr>
+<% for(ws.resetNext(); ws.hasNext(); ) {
+ String sTab = ws.getNext(); %>
+ <td width="9" align="right"><img border="0" src="<%= AppUtils.getImgFolderURL() %><%= sTab.equals(curStep)?"tab_left_sel.gif":"tab_left.gif" %>" width="9" height="24"></td>
+ <td class=<%= sTab.equals(curStep)?"rbg1":"rbg1d" %> align="center" valign="middle">
+ <% if(sTab.equals(curStep)) { %>
+ &nbsp;<a href="javascript:document.forma.submit()" class=rtabselected onClick="document.getElementById('<%= AppConstants.RI_GO_TO_STEP %>').value='<%= sTab %>';"><%= clearSpaces(sTab) %></a>&nbsp;
+ <% } else if(reportID.equals("-1")) { %>
+ &nbsp;<b class=rtabtext><%= clearSpaces(sTab) %></b>&nbsp;
+ <% } else { %>
+ &nbsp;<a href="javascript:document.forma.submit()" class=rtabtext onClick="document.getElementById('<%= AppConstants.RI_GO_TO_STEP %>').value='<%= sTab %>';"><%= clearSpaces(sTab) %></a>&nbsp;
+ <% } %>
+ </td>
+ <td width="9" align="left"><img border="0" src="<%= AppUtils.getImgFolderURL() %><%= sTab.equals(curStep)?"tab_right_sel.gif":"tab_right.gif" %>" width="9" height="24"></td>
+<% } // for
+%>
+ <td width="80%">&nbsp;</td>
+ </tr>
+ </table>
+</td></tr><tr><td>
+ <table width="100%" border="0" cellspacing="0" cellpadding="3" style="margin: 0px;">
+ <tr class=rbg1>
+ <td valign="Middle"><b class=rtableheader><%= navTitle %></b></td>
+ </tr>
+ </table>
+</td></tr><tr><td><% if(curStep.equals(AppConstants.WS_DEFINITION)) { %>
+ <% if(sessionflag == 1) dbInfo = ""; %>
+ <jsp:include page="wizard_definition.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_SQL)) { %>
+ <jsp:include page="wizard_sql_def.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_TABLES)&&curSubStep.equals("")) { %>
+ <jsp:include page="wizard_tables_list.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_TABLES)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT))) { %>
+ <jsp:include page="wizard_tables_edit.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_COLUMNS)&&curSubStep.equals("")) { %>
+ <jsp:include page="wizard_columns_list.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_COLUMNS)&&curSubStep.equals(AppConstants.WSS_ADD_MULTI)) { %>
+ <jsp:include page="wizard_columns_add_multi.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_COLUMNS)&&curSubStep.equals(AppConstants.WSS_ORDER_ALL)) { %>
+ <jsp:include page="wizard_columns_order_all.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_COLUMNS)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT) ||curSubStep.equals(AppConstants.WA_MODIFY))) { %>
+ <jsp:include page="wizard_columns_edit.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_FORM_FIELDS)&&curSubStep.equals("")||curSubStep.equals(AppConstants.WSS_ADD_BLANK)) { %>
+ <jsp:include page="wizard_form_fields_list.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_FORM_FIELDS)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT))) { %>
+ <jsp:include page="wizard_form_fields_edit.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_FILTERS)&&curSubStep.equals("")) { %>
+ <jsp:include page="wizard_filters_list.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_FILTERS)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT))) { %>
+ <jsp:include page="wizard_filters_edit.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_SORTING)&&curSubStep.equals("")) { %>
+ <jsp:include page="wizard_sorting_list.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_SORTING)&&curSubStep.equals(AppConstants.WSS_ORDER_ALL)) { %>
+ <jsp:include page="wizard_sorting_order_all.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_SORTING)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT))) { %>
+ <jsp:include page="wizard_sorting_edit.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_JAVASCRIPT)) { %>
+ <jsp:include page="wizard_javascript.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_CHART)) { %>
+ <jsp:include page="wizard_chart.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_USER_ACCESS)) { %>
+ <jsp:include page="wizard_user_access.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_SCHEDULE)) { %>
+ <jsp:include page="wizard_schedule.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_REPORT_LOG)) { %>
+ <jsp:include page="wizard_log.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_MAP)) { %>
+ <jsp:include page="wizard_map.jsp"/>
+<% } else if(curStep.equals(AppConstants.WS_DATA_FORECASTING)) { %>
+ <jsp:include page="wizard_data_forecasting.jsp"/>
+<% } else { %>
+ <jsp:include page="wizard_run.jsp"/>
+<% } %>
+
+</td></tr><tr><td>
+ <table width="100%" border="0" cellspacing="1" cellpadding="3">
+ <tr>
+ <td width="10%" align="right">
+ &nbsp;
+ </td>
+ <td align=center>
+ <% if(! ws.isInitialStep()) { %>
+ <button type="submit" onClick="document.getElementById('<%= AppConstants.RI_WIZARD_ACTION %>').value='<%= AppConstants.WA_BACK %>';document.forma.submit();" att-button btn-type="primary" size="small" title='Back'>Back</button>
+ <% } %>
+
+ <% if(! ws.isFinalStep()) { %>
+ <button type="submit" onClick="if(! dataValidate()) return false; document.getElementById('<%= AppConstants.RI_WIZARD_ACTION %>').value='<%= AppConstants.WA_SAVE %>';document.forma.submit();" att-button btn-type="primary" size="small" title='Save'>Save</button>
+ <button type="submit" onClick="if(! dataValidate()) return false; document.getElementById('<%= AppConstants.RI_WIZARD_ACTION %>').value='<%= AppConstants.WA_NEXT %>';document.forma.submit();" att-button btn-type="primary" size="small" title='Next'>Next</button>
+ <% } %>
+ </td>
+ </tr>
+ </table>
+</td></tr>
+</table>
+
+</form>
+
+<script type="text/javascript">
+ document.title += ' <%=title%>';
+</script>
+
+ <jsp:include page="footer.jsp" flush="true" />
+
+</div>
+</td>
+</tr>
+</table>
+<%--<jsp:include page="disclaimer.jsp" flush="true" />--%>
+<script>
+ //document.getElementById('loadingMessageDiv').style.display='none';
+ //adding the bread crumb on the folder tree
+ if (window.parent && window.parent.addBreadCrumb)
+ window.parent.addBreadCrumb(true, "000<%=rdef.getReportID()%>");
+ //displayTree("000<%=rdef.getReportID()%>");
+ <%
+ String isTreeHidden = "true";
+ if(request.getSession().getAttribute("isTreeHidden") != null && ((String)request.getSession().getAttribute("isTreeHidden")).equals("true")){
+ isTreeHidden = "true";
+ }else{
+ isTreeHidden = "false";
+ }
+ %>
+ //if ("<%=isTreeHidden%>" == "true"){
+ // hideTree();
+ //}
+ //document.getElementById('contentDiv').style.height=document.body.offsetHeight - 210;
+ function resizeDivScrollbar(){
+ var parentBody = window.parent.document.body;
+ var parentMenu = window.parent.document.getElementById("application");
+ var searchTD = document.getElementById("contentDiv");
+ var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //parentBody.style.width = window.screen.size;
+ //searchTD.style.width = parentBody.clientWidth - 200;
+ //parentMenu.style.width = 1263;
+ //javascript:resizeTo(screen.availWidth,screen.availHeight);
+ if(parentMenu) parentMenu.style.width = screen.availWidth - 150;
+ if(contentIframe) contentIframe.style.width = screen.availWidth - 30;
+ }
+ resizeDivScrollbar();
+</script>
+<%! private String HTMLEncode(String value) {
+ StringBuffer sb = new StringBuffer(value);
+
+ for(int i=0; i<sb.length(); i++)
+ if(sb.charAt(i)=='<')
+ sb.replace(i, i+1, "&lt;");
+ else if(sb.charAt(i)=='>')
+ sb.replace(i, i+1, "&gt;");
+ else if(sb.charAt(i)=='"')
+ sb.replace(i, i+1, "&quot;");
+
+ return sb.toString();
+ } // HTMLEncode
+
+ private String clearSpaces(String value) {
+ StringBuffer sb = new StringBuffer(value);
+
+ for(int i=0; i<sb.length(); i++)
+ if(sb.charAt(i)==' ')
+ sb.replace(i, i+1, "&nbsp;");
+
+ return sb.toString();
+ } // clearSpaces
+
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_field_run_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_field_run_sql.jsp
new file mode 100644
index 00000000..2fdcee46
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_field_run_sql.jsp
@@ -0,0 +1,39 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+
+<script language="JavaScript">
+
+ function postSQL() {
+ document.formb.<%= AppConstants.RI_FORMATTED_SQL %>.value=window.opener.forma.fieldSQL.value;
+ window.opener.setVerifyFlag();
+ document.formb.submit();
+ }
+
+</script>
+<body onLoad="postSQL()">
+<form name="formb" action="<%= AppUtils.getBaseURL() %>" method="post">
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="r_action" value="report.popup.testrun.sql">
+ <input type="hidden" name="<%= AppConstants.RI_FORMATTED_SQL %>" value="">
+</form>
+</body>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_run_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_run_sql.jsp
new file mode 100644
index 00000000..1c30437b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_run_sql.jsp
@@ -0,0 +1,38 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+
+<script language="JavaScript">
+
+ function postSQL() {
+ document.formb.<%= AppConstants.RI_FORMATTED_SQL %>.value=window.opener.forma.reportSQL.value;
+ document.formb.submit();
+ }
+
+</script>
+<body onLoad="postSQL()">
+<form name="formb" action="<%= AppUtils.getBaseURL() %>" method="post">
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="r_action" value="report.popup.testrun.sql">
+ <input type="hidden" name="<%= AppConstants.RI_FORMATTED_SQL %>" value="">
+</form>
+</body>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_adhoc_schedule.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_adhoc_schedule.jsp
new file mode 100644
index 00000000..76fe7a58
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_adhoc_schedule.jsp
@@ -0,0 +1,733 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%--
+ Name: wizard_adhoc_schedule.jsp
+ Use : This JSP is used for accepting user parameters for scheduling the report.
+
+ Change Log
+ ==========
+
+ 28-Aug-2009 : Version 8.4 (Sundar); initFormFields function is removed as it is handled in back end.
+ 23-Jun-2009 : Version 8.4 (Sundar);
+
+ <UL>
+ <LI> Bug related to creating startDate variable (in Javascript) for the Validation purpose is fixed.</LI>
+ </UL>
+
+
+--%>
+
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="java.util.List" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportSchedule" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
+
+<%
+ ReportSchedule reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE);
+ ReportDefinition rdefRecurrance = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ session.setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request));
+ if(reportSchedule==null) reportSchedule = (ReportSchedule) request.getAttribute(AppConstants.SI_REPORT_SCHEDULE);
+ String remoteDbPrefix = (String) session.getAttribute("remoteDB");
+ boolean isSQLAllowed = Globals.getAllowSQLBasedReports();
+%>
+<%@page import="java.util.Calendar"%>
+<%@page import="java.text.DateFormat"%>
+<%@page import="java.text.SimpleDateFormat"%>
+<%@page import="java.util.TimeZone"%>
+<%@page import="java.util.Date"%>
+<%@page import="org.openecomp.portalsdk.analytics.model.ReportLoader"%>
+<script language="JavaScript">
+<!--
+function showTestConditionPopup() {
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.test.cond&remoteDbPrefix=<%=remoteDbPrefix%>&<%= AppConstants.RI_FORMATTED_SQL %>="+escape(""+document.forma.conditionSQL.value), "testCondSQLPopup", "width=450,height=180,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showTestConditionPopup
+
+function exclusiveCheckBox(which) {
+ var size = 2;
+ for (i=0; i<size; i++) {
+ if(document.getElementById("notify" + i) != which) {
+ document.getElementById("notify" + i).checked = false;
+ }
+ }
+ //alert("exclusive " + which.form.notify_type.value);
+}
+//-->
+</script>
+<script language="javascript" src="<%= AppUtils.getBaseFolderURL() %>js/other_scripts.js"></script>
+<script type="text/javascript" src="<%= AppUtils.getBaseFolderURL() %>js/CalendarPopup.js"></script>
+<script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/rounded-corners.js"></script>
+<script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/form-field-tooltip.js"></script>
+<link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/calendar.css">
+
+ <script type="text/javascript">
+var stat;
+var delay=0;//delay in milliseconds
+function show(){
+
+
+var oIfr = document.getElementById('calendarFrame');
+var oCal = document.getElementById('calendarDiv');
+oIfr.style.display=(oCal.style.display=='block')?'none':'block';
+oIfr.style.top=findPosY()
+oIfr.style.left=findPosX()-5
+
+}
+function hide(){
+
+// added to show Iframe behind calender
+var oIfr = document.getElementById('calendarFrame');
+var oCal = document.getElementById('calendarDiv');
+oIfr.style.display=(oCal.style.display=='none')?'block':'none';
+}
+
+ function findPosX()
+ {
+ var obj= oCalendar
+ var curleft = 0;
+ if(obj.offsetParent)
+ while(1)
+ {
+ curleft += obj.offsetLeft;
+ if(!obj.offsetParent)
+ break;
+ obj = obj.offsetParent;
+ }
+ else if(obj.x)
+ curleft += obj.x;
+ return curleft;
+
+ }
+
+ function findPosY()
+ {
+
+ var obj= oCalendar
+ var curtop = 0;
+ if(obj.offsetParent)
+ while(1)
+ {
+ curtop += obj.offsetTop;
+ if(!obj.offsetParent)
+ break;
+ obj = obj.offsetParent;
+ }
+ else if(obj.y)
+ curtop += obj.y;
+ //alert(curtop)
+ return curtop;
+ }
+
+ //frameborder="0"
+ </SCRIPT>
+
+<iframe id="calendarFrame" class="nav" z-index:199; scrolling="no" frameborder="0" width=165px height=165px src="" style="position:absolute; display:none;">
+</iframe>
+
+ <div id="calendarDiv" name="calendarDiv" style="position:absolute; z-index:200; visibility:none; background-color:white;layer-background-color:white;"></div>
+ <%
+ Calendar startCalendarDate = Calendar.getInstance();
+ startCalendarDate.add(Calendar.DAY_OF_MONTH, - 540);
+ Calendar endCalendarDate = Calendar.getInstance();
+ endCalendarDate.add(Calendar.DAY_OF_MONTH, 540);
+ SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
+ SimpleDateFormat oracleDateFormat = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss");
+ Date sysdate = oracleDateFormat.parse(ReportLoader.getSystemDateTime());
+ SimpleDateFormat dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern());
+ Calendar systemCalendar = Calendar.getInstance();
+ systemCalendar.setTime(sysdate);
+ Date sysNext15date = oracleDateFormat.parse(ReportLoader.getNext15MinutesOfSystemDateTime());
+ //dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern());
+ Calendar systemNext15Calendar = Calendar.getInstance();
+ systemNext15Calendar.setTime(sysNext15date);
+ Date sysNext30date = oracleDateFormat.parse(ReportLoader.getNext30MinutesOfSystemDateTime());
+ //dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern());
+ Calendar systemNext30Calendar = Calendar.getInstance();
+ systemNext30Calendar.setTime(sysNext30date);
+
+ System.out.println(" systemNext15Calendar " + systemNext15Calendar);
+ System.out.println(" systemNext30Calendar " + systemNext30Calendar);
+
+ //dtimestamp.setTimeZone(TimeZone.getTimeZone(Globals.getTimeZone()));
+
+%>
+
+
+
+
+ <SCRIPT LANGUAGE="JavaScript">
+ var oCalendar = new CalendarPopup("calendarDiv", "calendarFrame");
+
+ oCalendar.addDisabledDates(null, "<%=dtf.format(startCalendarDate.getTime())%>");
+ oCalendar.addDisabledDates("<%=dtf.format(endCalendarDate.getTime())%>", null);
+
+
+ oCalendar.setCssPrefix("raptor");
+
+ function fillStartEndDate(varSelect) {
+ var flag = 0;
+ <% if(!(nvl(reportSchedule.getStartDate()).length() > 0)) { %>
+ a:
+ for (var i = 0; i < varSelect.options.length; i++) {
+ if (varSelect.options[ i ].selected) {
+ if(!(varSelect.options[i].value.length > 0)) {
+ var d = new Date();
+ //alert(d.getMonth() + " " + d.getDate() + " " + d.getYear());
+ //alert(d.getMonth()+1+"/"+d.getDate()+"/"+d.getYear());
+ document.forma.schedStartDate.value = addZero(d.getMonth()+1)+"/"+addZero(d.getDate())+"/"+addZero(d.getYear());
+ document.forma.schedEndDate.value = addZero(d.getMonth()+1)+"/"+addZero(d.getDate())+"/"+addZero(d.getYear());
+ //alert(document.forma.schedStartDate.value);
+ flag = 1;
+ break a;
+ }
+ }
+ }
+ if(flag == 0) {
+ //alert("Here");
+ document.forma.schedStartDate.value = "";
+ document.forma.schedEndDate.value = "";
+ }
+ <% } %>
+ }
+
+ function initStartEndDate() {
+ var flag = 0;
+ var varSelect = document.forma.schedRecurrence;
+ var d = new Date();
+ var d_end = null;
+ d.setFullYear(<%=systemCalendar.get(Calendar.YEAR)%>, <%=systemCalendar.get(Calendar.MONTH)%>,<%=systemCalendar.get(Calendar.DAY_OF_MONTH)%>);
+ d.setHours(<%=systemCalendar.get(Calendar.HOUR_OF_DAY)%>);
+ d.setMinutes(<%=systemCalendar.get(Calendar.MINUTE)%>);
+ d.setSeconds(<%=systemCalendar.get(Calendar.SECOND)%>);
+ d_end = new Date();
+ d_end.setFullYear(<%=systemNext15Calendar.get(Calendar.YEAR)%>, <%=systemNext15Calendar.get(Calendar.MONTH)%>,<%=systemNext15Calendar.get(Calendar.DAY_OF_MONTH)%>);
+ d_end.setHours(<%=23%>);
+ d_end.setMinutes(<%=45%>);
+ d_end.setSeconds(<%=systemNext15Calendar.get(Calendar.SECOND)%>);
+
+ if(d.getHours() == 23 && d.getMinutes()>=30) {
+ d_end.setFullYear(<%=systemNext30Calendar.get(Calendar.YEAR)%>, <%=systemNext30Calendar.get(Calendar.MONTH)%>,<%=systemNext30Calendar.get(Calendar.DAY_OF_MONTH)%>);
+ d_end.setHours(<%=23%>);
+ d_end.setMinutes(<%=45%>);
+ d_end.setSeconds(<%=systemNext30Calendar.get(Calendar.SECOND)%>);
+ document.forma.schedEndDate.value = addZero(d_end.getMonth()+1)+"/"+addZero(d_end.getDate())+"/"+addZero(d_end.getYear());
+ var obj = document.forma.schedEndHour;
+ var hr = d_end.getHours();
+ //alert("end hr " + hr);
+ //if(d_end.getMinutes()>=45)
+ // hr = hr + 1;
+ if(hr > 12) hr = hr - 12;
+ if(hr == 0) hr = 12;
+ for (var i=0; i<obj.options.length; i++) {
+ if (eval(obj.options[i].value) == hr) {
+ obj.options[i].selected = true;
+ break;
+ }
+ }
+ var obj1 = document.forma.schedEndMin;
+ for (var i=0; i<obj1.options.length; i++) {
+ if (d_end.getMinutes() <= eval(obj1.options[i].value)) {
+ obj1.options[i].selected = true;
+ break;
+ }
+ }
+ var obj2 = document.forma.schedEndAMPM;
+
+ for (var i=0; i<obj2.options.length; i++) {
+ if (d_end.getHours() < 12 && obj2.options[i].value == 'AM') {
+ obj2.options[i].selected = true;
+ } else if (d_end.getHours() >= 12 && obj2.options[i].value == 'PM')
+ obj2.options[i].selected = true;
+ }
+
+ }
+
+
+ <% if(!(nvl(reportSchedule.getStartDate()).length() > 0)) { %>
+
+ //alert(d.getMonth() + " " + d.getDate() + " " + d.getYear());
+ //alert(d.getMonth()+1+"/"+d.getDate()+"/"+d.getYear());
+ //alert(d.getHours());
+ <%-- System.out.println(reportSchedule.getStartDate());
+ if(!(nvl(reportSchedule.getStartDate()).length() > 0)) { --%>
+ if(d.getHours() == 23 && d.getMinutes() > 45) {
+ //d.setDate(d.getDate() + 1);
+ document.forma.schedStartDate.value = addZero(d.getMonth()+1)+"/"+addZero(d.getDate()+1)+"/"+addZero(d.getYear());
+ }
+ else
+ document.forma.schedStartDate.value = addZero(d.getMonth()+1)+"/"+addZero(d.getDate())+"/"+addZero(d.getYear());
+ //document.forma.schedEndDate.value = addZero(d.getMonth()+1)+"/"+addZero(d.getDate())+"/"+addZero(d.getYear());
+ document.forma.schedEndDate.value = addZero(d_end.getMonth()+1)+"/"+addZero(d_end.getDate())+"/"+addZero(d_end.getYear());
+
+ var obj = document.forma.schedHour;
+ var hr = d.getHours();
+ if(d.getMinutes()>=45)
+ hr = hr + 1;
+ if(hr > 12) hr = hr - 12;
+ if(hr == 0) hr = 12;
+ for (var i=0; i<obj.options.length; i++) {
+ if (eval(obj.options[i].value) == hr) {
+ obj.options[i].selected = true;
+ break;
+ }
+ }
+ var obj1 = document.forma.schedMin;
+ for (var i=0; i<obj1.options.length; i++) {
+ if (d.getMinutes() <= eval(obj1.options[i].value)) {
+ obj1.options[i].selected = true;
+ break;
+ }
+ }
+ var obj2 = document.forma.schedAMPM;
+
+ for (var i=0; i<obj2.options.length; i++) {
+ //alert(d.getHours() + " " + d.getMinutes());
+ if(d.getHours() == 23 && d.getMinutes() >= 45) {
+ if(obj2.options[i].value == 'AM') {
+ //alert("hello");
+ obj2.options[i].selected = true;
+ }
+ } else {
+ //alert("hello2");
+ if ((d.getHours() < 12) && obj2.options[i].value == 'AM') {
+ obj2.options[i].selected = true;
+ } else if ((d.getHours() >= 12) && obj2.options[i].value == 'PM') {
+ obj2.options[i].selected = true;
+ }
+ }
+ }
+
+
+
+ <% } %>
+ }
+
+ function addZero(num) {
+ var numInt = 0;
+ numInt = num;
+ if(numInt < 10) {
+ return "0"+numInt;
+ }
+ else return ""+numInt;
+ }
+ </SCRIPT>
+<table width="100%" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr class="rbg1">
+ <td class=rbg1 colspan="2" align="left">
+ <%if(nvl(Globals.getScheduleHelpMessage()).trim().length()>0) { %>
+ <a href="javascript:uitmpl_qh('sch_help_text'); if(typeof window.parent.resizeWindow == 'function') window.parent.resizeWindow();" class="qh-link" style="position:fixed;"></a>
+ <% } %>
+ <b class=rtableheader>Please enter Time in <%= Globals.getTimeZone()%>. The Current System Time is <%=dtimestamp.format(sysdate)%>&nbsp;<%=Globals.getTimeZone()%></b>
+ </td>
+
+ </tr>
+
+ <%if(nvl(Globals.getScheduleHelpMessage()).length()>0) { %>
+ <tr>
+ <td colspan="2" class="nopad"><!-- quick help text -->
+ <div id="sch_help_text" class="mQH">
+ <p><span class="label">Report Desc:</span>
+ <%= Globals.getScheduleHelpMessage() %></p>
+ </div>
+ <!-- /quick help text --></td>
+ </tr>
+ <% } %>
+
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Schedule Emails: </font></td>
+ <td class=rbg3 align="left" width="50%" valign="middle" nowrap><font class=rtabletext>
+ <input type='radio' name='schedEnabled' id='schedEnabled' value='Y' <%= reportSchedule.getSchedEnabled().equals("Y")?" checked":"" %> toolTipText="This is used for the enabling or disabling the scheduling feature for this report."/>Yes
+ &nbsp;
+ <input type='radio' name='schedEnabled' id='schedEnabled' value='N' <%= reportSchedule.getSchedEnabled().equals("N")?" checked":"" %> toolTipText="This is used for the enabling or disabling the scheduling feature for this report."/>No
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Email Attachment:</font></td>
+ <td class=rbg3 align="left" width="50%" valign="middle" nowrap>
+ <font class=rtabletext>
+ <%if(!rdefRecurrance.getReportType().equals(AppConstants.RT_HIVE)) {%>
+ <input type='radio' name='notify' id='notify' value='2' <%= reportSchedule.getNotify_type().equals("2")?" checked":(reportSchedule.getNotify_type().length()<=0)?" checked":(!reportSchedule.getNotify_type().equals("4"))? " checked " :"" %> toolTipText="Provides the capability to attach reports as PDF format to the email."/>PDF Attachment
+ &nbsp;&nbsp;
+ <input type='radio' name='notify' id='notify' value='4' <%= reportSchedule.getNotify_type().equals("4")?" checked":"" %> toolTipText="Provides the capability to attach reports as Excel format to the email."/>Excel Attachment
+ &nbsp;&nbsp;
+ <% } %>
+ <input type='radio' name='notify' id='notify' value='5' <%= reportSchedule.getNotify_type().equals("5")?" checked":"" %> toolTipText="Provides the capability to attach reports as Excel format to the email."/>Excelx Attachment
+ &nbsp;&nbsp;
+ <input type='radio' name='notify' id='notify' value='3' <%= reportSchedule.getNotify_type().equals("3")?" checked":"" %> toolTipText="Provides the capability to attach reports as CSV format to the email."/>CSV Attachment
+ <%if(!rdefRecurrance.getReportType().equals(AppConstants.RT_HIVE)) {%>
+ <% if(nvl(Globals.getShellScriptDir()).length()>1) { %>
+ <input type='radio' name='notify' id='notify' value='6' <%= reportSchedule.getNotify_type().equals("6")?" checked":"" %> toolTipText="Provides the capability to send only links to the generated report in the email."/>Link to Generated report
+ <% } %>
+ <% } %>
+ <input type='hidden' name='notify_type' value='1'/>
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Recurrence: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <select name="schedRecurrence" toolTipText="This is used to select recurrence frequency.">
+ <%if (rdefRecurrance.getIsOneTimeScheduleAllowed() == null || rdefRecurrance.getIsOneTimeScheduleAllowed().equals("Y")){ %><option value="" <%= reportSchedule.getRecurrence().equals("" )?" selected":"" %>>One Time<%} %>
+ <%if (rdefRecurrance.getIsHourlyScheduleAllowed() == null || rdefRecurrance.getIsHourlyScheduleAllowed().equals("Y")){ %><option value="<%= AppConstants.SR_HOURLY %>"<%= reportSchedule.getRecurrence().equals(AppConstants.SR_HOURLY )?" selected":"" %>>Hourly<%} %>
+ <%if (rdefRecurrance.getIsDailyScheduleAllowed() == null || rdefRecurrance.getIsDailyScheduleAllowed().equals("Y")){ %><option value="<%= AppConstants.SR_DAILY %>"<%= reportSchedule.getRecurrence().equals(AppConstants.SR_DAILY )?" selected":"" %>>Daily<%} %>
+ <%if (rdefRecurrance.getIsDailyMFScheduleAllowed() == null || rdefRecurrance.getIsDailyMFScheduleAllowed().equals("Y")){ %><option value="<%= AppConstants.SR_DAILY_MO_FR %>"<%= reportSchedule.getRecurrence().equals(AppConstants.SR_DAILY_MO_FR)?" selected":"" %>>Daily Mo-Fr<%} %>
+ <%if (rdefRecurrance.getIsWeeklyScheduleAllowed() == null || rdefRecurrance.getIsWeeklyScheduleAllowed().equals("Y")){ %><option value="<%= AppConstants.SR_WEEKLY %>"<%= reportSchedule.getRecurrence().equals(AppConstants.SR_WEEKLY )?" selected":"" %>>Weekly<%} %>
+ <%if (rdefRecurrance.getIsMonthlyScheduleAllowed() == null || rdefRecurrance.getIsMonthlyScheduleAllowed().equals("Y")){ %><option value="<%= AppConstants.SR_MONTHLY %>"<%= reportSchedule.getRecurrence().equals(AppConstants.SR_MONTHLY )?" selected":"" %>>Monthly<%} %>
+ </select></font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>First Schedule Date: </font></td>
+ <td class=rbg3 align="left" width="50%" nowrap><font class=rtabletext>
+ <input type="text" size="10" maxlength="10" name="schedStartDate" value="<%= reportSchedule.getStartDate() %>" toolTipText="Enter the date and time scheduling is to start.">
+ <!--<a href="#" onClick="window.dateField = document.forma.schedStartDate;calendar = window.open('<%= AppUtils.getRaptorActionURL() %>popup.calendar','cal','WIDTH=200,HEIGHT=250');return false;">
+ <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20">
+ </a>-->
+ <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20" onClick="oCalendar = new CalendarPopup('calendarDiv', 'calendarFrame');oCalendar.addDisabledDates(null, '<%=dtf.format(startCalendarDate.getTime())%>');oCalendar.addDisabledDates('<%=dtf.format(endCalendarDate.getTime())%>', null);oCalendar.setCssPrefix('raptor');oCalendar.select(document.getElementById('schedStartDate'),event,'MM/dd/yyyy'); return false;" style="cursor:hand">
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <select name="schedHour">
+ <option value="01"<%= reportSchedule.getRunHour().equals("01")?" selected":"" %>>1
+ <option value="02"<%= reportSchedule.getRunHour().equals("02")?" selected":"" %>>2
+ <option value="03"<%= reportSchedule.getRunHour().equals("03")?" selected":"" %>>3
+ <option value="04"<%= reportSchedule.getRunHour().equals("04")?" selected":"" %>>4
+ <option value="05"<%= reportSchedule.getRunHour().equals("05")?" selected":"" %>>5
+ <option value="06"<%= reportSchedule.getRunHour().equals("06")?" selected":"" %>>6
+ <option value="07"<%= reportSchedule.getRunHour().equals("07")?" selected":"" %>>7
+ <option value="08"<%= reportSchedule.getRunHour().equals("08")?" selected":"" %>>8
+ <option value="09"<%= reportSchedule.getRunHour().equals("09")?" selected":"" %>>9
+ <option value="10"<%= reportSchedule.getRunHour().equals("10")?" selected":"" %>>10
+ <option value="11"<%= reportSchedule.getRunHour().equals("11")?" selected":"" %>>11
+ <option value="12"<%= reportSchedule.getRunHour().equals("12")?" selected":"" %>>12
+ </select>
+ <select name="schedMin">
+ <option value="00"<%= reportSchedule.getRunMin().equals("00")?" selected":"" %>>00
+ <option value="15"<%= reportSchedule.getRunMin().equals("15")?" selected":"" %>>15
+ <option value="30"<%= reportSchedule.getRunMin().equals("30")?" selected":"" %>>30
+ <option value="45"<%= reportSchedule.getRunMin().equals("45")?" selected":"" %>>45
+ </select>
+ <select name="schedAMPM">
+ <option value="AM"<%= reportSchedule.getRunAMPM().equals("AM")?" selected":"" %>>AM
+ <option value="PM"<%= reportSchedule.getRunAMPM().equals("PM")?" selected":"" %>>PM
+ </select>
+ <%= Globals.getTimeZone()%>
+
+ </font>
+ </td>
+ </tr>
+<!-- /quick help text -->
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Last Schedule Date: </font></td>
+ <td class=rbg3 align="left" width="50%" nowrap><font class=rtabletext>
+ <input type="text" size="10" maxlength="10" name="schedEndDate" value="<%= reportSchedule.getEndDate() %>" toolTipText="Enter the date scheduling is to end. This is mandatory for recurring reports.">
+ <!--<a href="#" onClick="window.dateField = document.forma.schedEndDate;calendar = window.open('<%= AppUtils.getRaptorActionURL() %>popup.calendar','cal','WIDTH=200,HEIGHT=250');return false;">
+ <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20">
+ </a>-->
+ <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20" onClick="oCalendar = new CalendarPopup('calendarDiv', 'calendarFrame');oCalendar.addDisabledDates(null, '<%=dtf.format(startCalendarDate.getTime())%>');oCalendar.addDisabledDates('<%=dtf.format(endCalendarDate.getTime())%>', null);oCalendar.setCssPrefix('raptor');oCalendar.select(document.getElementById('schedEndDate'),event,'MM/dd/yyyy'); return false;" style="cursor:hand">
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <select name="schedEndHour">
+ <option value="01"<%= reportSchedule.getEndHour().equals("01")?" selected":"" %>>1
+ <option value="02"<%= reportSchedule.getEndHour().equals("02")?" selected":"" %>>2
+ <option value="03"<%= reportSchedule.getEndHour().equals("03")?" selected":"" %>>3
+ <option value="04"<%= reportSchedule.getEndHour().equals("04")?" selected":"" %>>4
+ <option value="05"<%= reportSchedule.getEndHour().equals("05")?" selected":"" %>>5
+ <option value="06"<%= reportSchedule.getEndHour().equals("06")?" selected":"" %>>6
+ <option value="07"<%= reportSchedule.getEndHour().equals("07")?" selected":"" %>>7
+ <option value="08"<%= reportSchedule.getEndHour().equals("08")?" selected":"" %>>8
+ <option value="09"<%= reportSchedule.getEndHour().equals("09")?" selected":"" %>>9
+ <option value="10"<%= reportSchedule.getEndHour().equals("10")?" selected":"" %>>10
+ <option value="11"<%= reportSchedule.getEndHour().equals("11")?" selected":"" %>>11
+ <option value="12"<%= reportSchedule.getEndHour().equals("12")?" selected":"" %>>12
+ </select>
+ <select name="schedEndMin">
+ <option value="00"<%= reportSchedule.getEndMin().equals("00")?" selected":"" %>>00
+ <option value="15"<%= reportSchedule.getEndMin().equals("15")?" selected":"" %>>15
+ <option value="30"<%= reportSchedule.getEndMin().equals("30")?" selected":"" %>>30
+ <option value="45"<%= reportSchedule.getEndMin().equals("45")?" selected":"" %>>45
+ </select>
+ <select name="schedEndAMPM">
+ <option value="AM"<%= reportSchedule.getEndAMPM().equals("AM")?" selected":"" %>>AM
+ <option value="PM"<%= reportSchedule.getEndAMPM().equals("PM")?" selected":"" %>>PM
+ </select>
+ <%= Globals.getTimeZone()%>
+
+ </font>
+ </td>
+ </tr>
+
+ <script type="text/javascript">initStartEndDate();</script>
+
+ <% if(AppUtils.isAdminUser(request) || isSQLAllowed ) { %>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Use Condition:</font></td>
+ <td class=rbg3 align="left" width="50%" valign="middle" nowrap><font class=rtabletext>
+ <input type="checkbox" name="conditional" value="Y"<%= reportSchedule.getConditional().equals("Y")?" checked":"" %>> Send Emails Only When Condition Is Met
+ </font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Condition SQL:</font></td>
+ <td class=rbg3 align="left" width="50%" valign="middle" nowrap>
+ <textarea name="conditionSQL" cols="40" rows="3"><%= nvl(reportSchedule.getConditionSQL()) %></textarea>
+ <input type="Button" class=button value="Test" onClick="showTestConditionPopup()">
+ &nbsp;
+ </font></td>
+ </tr>
+ <% } %>
+
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Max rows in attachment:</font></td>
+ <td class=rbg3 align="left" width="50%" valign="middle" nowrap>
+ <input type='text' name='downloadLimit' value="<%=Integer.parseInt(reportSchedule.getDownloadLimit())>0?reportSchedule.getDownloadLimit(): Integer.toString(rdefRecurrance.getMaxRowsInExcelDownload())%>" size='4' toolTipText="Specify the maximum number of rows that can be sent in an attachment."/>
+ </font>
+ </td>
+ </tr>
+ <tr class="rbg1">
+ <td class=rbg1 colspan="2" align="left">
+ <b class=rtableheader>Form Fields</b>
+ </td>
+
+ </tr>
+ <jsp:include page="wizard_schedule_formfield_include.jsp" flush="true" />
+ <tr>
+ <td colspan=4><hr></hr></td>
+ </tr>
+ <input type="hidden" name="toListUpdated" value="false" />
+
+<% List emailToUsers = reportSchedule.getEmailToUsers();
+ for(int i=0; i<emailToUsers.size(); i++) {
+ IdNameValue userValue = (IdNameValue) emailToUsers.get(i); %>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext><%= (i==0)?"Email To: ":"&nbsp;" %></font></td>
+ <td class=rbg3 align="left" width="50%" nowrap><font class=rtabletext>
+ <%= userValue.getName() %>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! dataValidate()) {return false;} else if(! confirm('Are you sure?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_USER %>'; document.all.toListUpdated.value='true'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= userValue.getId() %>'; }">
+ </font></td>
+ </tr>
+<% } // for
+ List emailToRoles = reportSchedule.getEmailToRoles();
+ for(int i=0; i<emailToRoles.size(); i++) {
+ IdNameValue roleValue = (IdNameValue) emailToRoles.get(i); %>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext><%= (emailToUsers.size()==0&&i==0)?"Email To: ":"&nbsp;" %></font></td>
+ <td class=rbg3 align="left" width="50%" nowrap><font class=rtabletext>Everyone With Role:&nbsp;
+ <%= roleValue.getName() %>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! dataValidate()) {return false;} else if(! confirm('Are you sure?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_ROLE %>'; document.all.toListUpdated.value='true'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= roleValue.getId() %>'; }">
+ </font></td>
+ </tr>
+<% } // for
+
+ Vector remainingUsers = Utils.getUsersNotInList(emailToUsers,request);
+ Vector remainingRoles = Utils.getRolesNotInList(emailToRoles,request);
+ if((emailToUsers.size()+emailToRoles.size()==0)||(remainingUsers.size()>0)||(remainingRoles.size()>0)) { %>
+ <tr>
+ <td colspan="2" align="center">
+ <table width="100%" cellspacing="1" cellpadding="3" align="center" border="0"> <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext><%= (emailToUsers.size()+emailToRoles.size()==0)?"Email To: ":"&nbsp;" %></font></td>
+ <td class=rbg3 align="left" width="50%" nowrap><font class=rtabletext>
+<% if(remainingUsers.size()>0) { %>
+ <select name="schedEmailAdd" onChange="if(! dataValidate()) {selectedIndex=0;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_USER %>'; document.all.toListUpdated.value='true'; document.forma.submit();}" toolTipText="Select users and/or roles the report should be sent to">
+ <option value="" selected>--- Select User ---
+<% for(int i=0; i<remainingUsers.size(); i++) {
+ IdNameValue userValue = (IdNameValue) remainingUsers.get(i); %>
+ <option value="<%= userValue.getId() %>"><%= userValue.getName() %>
+<% } // for %>
+ </select>
+<% } else { %>
+ No user emails available
+<% } %>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<% if(remainingRoles.size()>0) { %>
+ <select name="schedEmailAddRole" onChange="if(! dataValidate()) {selectedIndex=0;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_ROLE %>'; document.all.toListUpdated.value='true'; document.forma.submit();}" toolTipText="Select users and/or roles the report should be sent to">
+ <option value="" selected>--- Select Role ---
+<% for(int i=0; i<remainingRoles.size(); i++) {
+ IdNameValue roleValue = (IdNameValue) remainingRoles.get(i); %>
+ <option value="<%= roleValue.getId() %>"><%= roleValue.getName() %>
+<% } // for %>
+ </select>
+<% } else { %>
+ No roles available
+<% } %>
+ </font>
+ </td>
+ <% if ( nvl(Globals.getEncryptedSMTPServer(),"").length() > 0 ) { %>
+ <td align="right" width="27%"><font class=rtabletext>Encrypt Attachment</font>
+ <input type='radio' name='encryptMode' id='encryptMode' value='Y' <%= reportSchedule.getEncryptMode().equals("Y")?"":" checked" %> toolTipText="Choose the encryption mode."/>Yes
+ &nbsp;&nbsp;
+ <input type='radio' name='encryptMode' id='encryptMode' value='N' <%= reportSchedule.getEncryptMode().equals("N")?"":(reportSchedule.getEncryptMode().length()<=0)?" checked":(!reportSchedule.getEncryptMode().equals("N"))? " " :" checked " %> toolTipText="Choose the encryption mode."/>No
+ </td>
+ <% } %>
+ <% if (Globals.generateSchedReportsInFileSystem()) { %>
+ <td align="right" width="27%"><font class=rtabletext>Send as Attachment</font>
+ <input type='radio' name='sendAttachment' id='sendAttachment' value='Y' <%= reportSchedule.isAttachmentMode()?" checked ":""%> toolTipText="Send As Attachment"/>Yes
+ &nbsp;&nbsp;
+ <input type='radio' name='sendAttachment' id='sendAttachment' value='N' <%= !reportSchedule.isAttachmentMode()?" checked":"" %> toolTipText="Store it in file system."/>No
+ </td>
+ <% } %>
+ </tr>
+ </table>
+ </td>
+ </tr>
+<% } // if
+%>
+</table>
+
+
+<br>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+ //alert("dataValidate called");
+ var startDate = new Date(document.forma.schedStartDate.value);
+ var startHour = eval(document.forma.schedHour.value);
+ if(document.forma.schedAMPM.value == 'PM') {
+ if (startHour != 12) startHour = startHour + 12;
+ } else {
+ if (startHour == 12) startHour = startHour - 12;
+ }
+ startDate.setHours(startHour);
+ startDate.setMinutes(eval(document.forma.schedMin.value));
+
+ var endDate = new Date(document.forma.schedEndDate.value);
+ var endHour = eval(document.forma.schedEndHour.value);
+ if(document.forma.schedEndAMPM.value == 'PM') {
+ if (endHour != 12) endHour = endHour + 12;
+ } else {
+ if (endHour == 12) endHour = endHour - 12;
+ }
+ endDate.setHours(endHour);
+ endDate.setMinutes(eval(document.forma.schedEndMin.value));
+
+ //alert ("System Calendar " + "<%=systemCalendar.get(Calendar.YEAR)+ " " + (systemCalendar.get(Calendar.MONTH)+1)+ " " + systemCalendar.get(Calendar.DAY_OF_MONTH) + " " + systemCalendar.get(Calendar.HOUR_OF_DAY) + " " + systemCalendar.get(Calendar.MINUTE) + " " + systemCalendar.get(Calendar.SECOND)%>");
+ var currDate = new Date();
+ var curr1Date = new Date();
+ currDate.setFullYear(<%=systemCalendar.get(Calendar.YEAR)%>, <%=systemCalendar.get(Calendar.MONTH)%>,<%=systemCalendar.get(Calendar.DAY_OF_MONTH)%>);
+ currDate.setHours(<%=systemCalendar.get(Calendar.HOUR_OF_DAY)%>);
+ currDate.setMinutes(<%=systemCalendar.get(Calendar.MINUTE)%>);
+ currDate.setSeconds(<%=systemCalendar.get(Calendar.SECOND)%>);
+
+ //alert(startDate+ " " + currDate + " " + (startDate-currDate) + " " + (startDate.toString()==currDate.toString()));
+
+
+ if(! checkDate(document.forma.schedStartDate.value, false)) {
+ alert("Invalid Start Date. The date format should be MM/DD/YYYY");
+ document.forma.schedStartDate.focus();
+ document.forma.schedStartDate.select();
+ return false;
+ }
+ if(! checkDate(document.forma.schedEndDate.value, false)) {
+ alert("Invalid End Date. The date format should be MM/DD/YYYY");
+ document.forma.schedEndDate.focus();
+ document.forma.schedEndDate.select();
+ return false;
+ }
+ if (startDate >= endDate){
+ alert("Start Date has to be less than the End Date.");
+ return false;
+ }
+
+ if (startDate - currDate < 0){
+ if(startDate.toString()!=currDate.toString()) {
+ var m_names = new Array("January", "February", "March",
+ "April", "May", "June", "July", "August", "September",
+ "October", "November", "December");
+ var curr_min = currDate.getMinutes();
+ curr_min = curr_min + "";
+ if (curr_min.length == 1) {
+ curr_min = "0" + curr_min;
+ }
+ alert("Start Date/Time has to be greater or equal to the System Date/Time ("+m_names[currDate.getMonth()]+" "+ currDate.getDate() + ", " + currDate.getYear() + " " + currDate.getHours()+ ":" + curr_min+ ").");
+ return false;
+ }
+ }
+ /*if(! checkDate(document.forma.schedRunDate.value, true)) {
+ alert("Invalid Execution Date. The date format should be MM/DD/YYYY");
+ document.forma.schedRunDate.focus();
+ document.forma.schedRunDate.select();
+ return false;
+ }*/
+<% if (AppUtils.isAdminUser(request) || isSQLAllowed){ %>
+ if(document.forma.conditional.checked&&document.forma.conditionSQL.value=="") {
+ alert("Please provide Condition SQL");
+ document.forma.conditionSQL.focus();
+ document.forma.conditionSQL.select();
+ return false;
+ }
+<% } %>
+ if(! checkNonNegativeInteger(document.forma.downloadLimit.value)) {
+ alert("Max row in attachment is not a valid integer.\nPlease enter a valid value.");
+ document.forma.downloadLimit.focus();
+ document.forma.downloadLimit.select();
+ return false;
+ }
+ else
+ {
+ if((document.forma.downloadLimit.value) > <%=Globals.getDownloadLimit()%>) {
+ alert("Max row you can download should not be more than <%=Globals.getDownloadLimit()%> rows.\nPlease enter a valid value.");
+ document.forma.downloadLimit.focus();
+ document.forma.downloadLimit.select();
+ return false;
+ }
+
+ }
+ for (var i=0; i < document.forma.notify.length; i++) {
+ if (document.forma.notify[i].checked) {
+ document.forma.notify_type.value = document.forma.notify[i].value;
+ }
+ }
+ return validateForm();
+
+ return true;
+} // dataValidate
+//-->
+</script>
+
+<script type="text/javascript">
+var tooltipObj = new DHTMLgoodies_formTooltip();
+tooltipObj.setTooltipPosition('right');
+tooltipObj.setPageBgColor('#EEEEEE');
+//tooltipObj.setPageBgColor('#FFFFFF');
+tooltipObj.setTooltipCornerSize(15);
+tooltipObj.setTooltipBgColor("#99CCFF");
+tooltipObj.initFormFieldTooltip();
+</script>
+
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_chart.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_chart.jsp
new file mode 100644
index 00000000..959adc23
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_chart.jsp
@@ -0,0 +1,1335 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%--
+ Name: wizard_chart.jsp
+ Use : This JSP is invoked when chart tab is selected. This is used for creating chart configuration for the report.
+
+ Change Log
+ ==========
+
+ 12-Aug-2009 : Version 8.5 (Sundar);
+ <UL>
+ <LI> For Line Chart Category can be configured. For this UI is added.</LI>
+ <LI> Line Chart can be displayed as 3D or 2D.</LI>
+ </UL>
+ 29-Jun-2009 : Version 8.4 (Sundar);
+ <UL>
+ <LI> For Bar Chart Last Series/Category can be configured as Line Chart or Bar Chart. For this UI is added.</LI>
+ <LI> UI options for compare to prev year chart has been added. </LI>
+ </UL>
+
+ 23-Jun-2009 : Version 8.4 (Sundar);
+ <UL>
+ <LI> Hiding/ Unhiding parameters based on chart type is checked throughly and missing elements were added.</LI>
+ <LI> Table width is made 100% for special input parameters </LI>
+ </UL>
+
+ 22-Jun-2009 : Version 8.4 (Sundar);
+
+ <UL>
+ <LI> Calendar JS and CSS were added to this page as it is used in customizable input parameters for Time Difference Chart. </LI>
+ <LI> JS method and configurable input parameters were added for Multiple Pie Chart, Bar Chart 3D, Pareto, Time Difference Chart and Multiple
+ Time Series Chart. </LI>
+ </UL>
+--%>
+<%@page import="org.openecomp.portalsdk.analytics.model.runtime.FormField"%>
+<%@page import="org.openecomp.portalsdk.analytics.model.runtime.ReportFormFields"%>
+<%@page import="org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime"%>
+<%@page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue"%>
+<%@page import="org.openecomp.portalsdk.analytics.model.DataCache"%>
+<%@page import="org.openecomp.portalsdk.analytics.model.ReportHandler"%>
+<%@page import="java.util.Vector"%>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.ArrayList" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.Reports"%>
+
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED) || rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED_DATAMIN);
+
+ String legendColId = null;
+ String valueColId = null;
+
+ //String firstColId = null;
+ //String firstNumColId = null;
+
+ List reportCols = rdef.getAllColumns();
+ List chartValueCols = rdef.getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, null);
+
+ ArrayList unusedNumCols = new ArrayList(reportCols.size());
+ int numColsCount = 0;
+ for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))
+ legendColId = dct.getColId();
+
+ if(isSQLBased||nvl(dct.getColType()).equals(AppConstants.CT_NUMBER)) {
+ numColsCount++;
+ if(nvl(dct.getColOnChart()).length()==0) //dct.getChartSeq()<0)
+ unusedNumCols.add(dct);
+ } // if
+
+/* if(dct.getChartSeq()>0)
+ valueColId = dct.getColId();
+
+ if(firstColId==null)
+ firstColId = dct.getColId();
+ if(firstNumColId==null)
+ if(isSQLBased)
+ firstNumColId = dct.getColId();
+ else
+ if(nvl(dct.getColType()).equals(AppConstants.CT_NUMBER))
+ firstNumColId = dct.getColId();*/
+ } // for
+
+ String chartType = nvl(rdef.getChartType()); %>
+
+<script type="text/javascript" src="<%= AppUtils.getBaseFolderURL() %>js/CalendarPopup.js"></script>
+<link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/calendar.css">
+
+<script language="javascript">
+
+
+
+function refreshWizard() {
+ var selectBox = document.forma.chartType;
+ var selectedString = selectBox.options[selectBox.selectedIndex].value;
+
+ if(selectedString == '<%=AppConstants.GT_TIME_SERIES%>'){
+ document.getElementById("seriesDiv").style.display='block';
+ var selObj = document.getElementById('chartSeries');
+ if(selObj) {
+ var selIndex = selObj.selectedIndex;
+ var value = selObj.options[selIndex].value;
+ var value = <%=chartValueCols.size()%>;
+ if(value > 1) {
+ document.getElementById("multiseriesDiv").style.display='block';
+
+ } else {
+ document.getElementById("multiseriesDiv").style.display='none';
+ document.getElementById("multiSeries").value='N';
+ }
+ }
+ <% int col1Idx = 1; %>
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ if (document.getElementById("animatedDiv")) document.getElementById("animatedDiv").style.display="block";
+ if (document.getElementById("chartOptions")) document.getElementById("chartOptions").style.display="block";
+ if (document.getElementById("drillDownOptions")) document.getElementById("drillDownOptions").style.display="block";
+ if (document.getElementById("seriesDiv")) document.getElementById("seriesDiv").style.display="block";
+ if (document.getElementById("lastSeriesAsLineChartDiv")) document.getElementById("lastSeriesAsLineChartDiv").style.display='none';
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='none';
+ if (document.getElementById("multiplePieChartOptions")) document.getElementById("multiplePieChartOptions").style.display="none";
+ if (document.getElementById("barChartOptions")) document.getElementById("barChartOptions").style.display="none";
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="none";
+ if (document.getElementById("AddRangeAxisDiv")) document.getElementById("AddRangeAxisDiv").style.display="block";
+ if (document.getElementById("TimeDifferenceChartOptions")) document.getElementById("TimeDifferenceChartOptions").style.display='none';
+ if (document.getElementById("BarLineChartOptions")) document.getElementById("BarLineChartOptions").style.display='none';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='block';
+ if (document.getElementById("LabelAngleForOtherCharts")) document.getElementById("LabelAngleForOtherCharts").style.display='none';
+ if (document.getElementById("LabelAngleForTimeSeriesCharts")) document.getElementById("LabelAngleForTimeSeriesCharts").style.display='block';
+ if (document.getElementById("maxLabelsInDomainAxisForOtherCharts")) document.getElementById("maxLabelsInDomainAxisForOtherCharts").style.display='none';
+ if (document.getElementById("keepAsString")) document.getElementById("keepAsString").style.display='none';
+
+
+
+ } else {
+ <%
+ col1Idx = 1;
+ for(int i=1; i<chartValueCols.size(); i++) {
+ col1Idx++;
+ %>
+ document.getElementById("newChartDiv<%=col1Idx%>").style.visibility='hidden';
+ //document.getElementById("chartGroupDiv<%=col1Idx%>").style.visibility='hidden';
+ document.getElementById("seriesDiv").style.display='none';
+ document.getElementById("multiseriesDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsLineChartDiv")) document.getElementById("lastSeriesAsLineChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='none';
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='none';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='none';
+
+
+ <%
+ }
+ %>
+
+ if(selectedString == "<%=AppConstants.GT_PIE_MULTIPLE%>") {
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ if (document.getElementById("animatedDiv")) document.getElementById("animatedDiv").style.display="block";
+ if (document.getElementById("multiplePieChartOptions")) document.getElementById("multiplePieChartOptions").style.display="block";
+ if (document.getElementById("chartOptions")) document.getElementById("chartOptions").style.display="block";
+ if (document.getElementById("drillDownOptions")) document.getElementById("drillDownOptions").style.display="none";
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='none';
+ if (document.getElementById("seriesDiv")) document.getElementById("seriesDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsLineChartDiv")) document.getElementById("lastSeriesAsLineChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='none';
+ if (document.getElementById("barChartOptions")) document.getElementById("barChartOptions").style.display="none";
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="none";
+ if (document.getElementById("AddRangeAxisDiv")) document.getElementById("AddRangeAxisDiv").style.display="block";
+ if (document.getElementById("TimeDifferenceChartOptions")) document.getElementById("TimeDifferenceChartOptions").style.display='none';
+ if (document.getElementById("BarLineChartOptions")) document.getElementById("BarLineChartOptions").style.display='none';
+ if (document.getElementById("LabelAngleForOtherCharts")) document.getElementById("LabelAngleForOtherCharts").style.display='block';
+ if (document.getElementById("LabelAngleForTimeSeriesCharts")) document.getElementById("LabelAngleForTimeSeriesCharts").style.display='none';
+ if (document.getElementById("maxLabelsInDomainAxisForOtherCharts")) document.getElementById("maxLabelsInDomainAxisForOtherCharts").style.display='block';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='none';
+ if (document.getElementById("keepAsString")) document.getElementById("keepAsString").style.display='none';
+
+ } else if(selectedString == "<%=AppConstants.GT_SCATTER%>") {
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ if (document.getElementById("animatedDiv")) document.getElementById("animatedDiv").style.display="none";
+ if (document.getElementById("multiplePieChartOptions")) document.getElementById("multiplePieChartOptions").style.display="none";
+ if (document.getElementById("chartOptions")) document.getElementById("chartOptions").style.display="block";
+ if (document.getElementById("drillDownOptions")) document.getElementById("drillDownOptions").style.display="none";
+ if (document.getElementById("seriesDiv")) document.getElementById("seriesDiv").style.display='block';
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsLineChartDiv")) document.getElementById("lastSeriesAsLineChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='none';
+ if (document.getElementById("barChartOptions")) document.getElementById("barChartOptions").style.display="none";
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="none";
+ if (document.getElementById("AddRangeAxisDiv")) document.getElementById("AddRangeAxisDiv").style.display="block";
+ if (document.getElementById("TimeDifferenceChartOptions")) document.getElementById("TimeDifferenceChartOptions").style.display='none';
+ if (document.getElementById("BarLineChartOptions")) document.getElementById("BarLineChartOptions").style.display='none';
+ if (document.getElementById("LabelAngleForOtherCharts")) document.getElementById("LabelAngleForOtherCharts").style.display='block';
+ if (document.getElementById("LabelAngleForTimeSeriesCharts")) document.getElementById("LabelAngleForTimeSeriesCharts").style.display='none';
+ if (document.getElementById("maxLabelsInDomainAxisForOtherCharts")) document.getElementById("maxLabelsInDomainAxisForOtherCharts").style.display='block';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='none';
+ if (document.getElementById("keepAsString")) document.getElementById("keepAsString").style.display='none';
+
+
+ } else if(selectedString == "<%=AppConstants.GT_REGRESSION%>") {
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ if (document.getElementById("animatedDiv")) document.getElementById("animatedDiv").style.display="none";
+ if (document.getElementById("multiplePieChartOptions")) document.getElementById("multiplePieChartOptions").style.display="none";
+ if (document.getElementById("chartOptions")) document.getElementById("chartOptions").style.display="block";
+ if (document.getElementById("drillDownOptions")) document.getElementById("drillDownOptions").style.display="none";
+ if (document.getElementById("seriesDiv")) document.getElementById("seriesDiv").style.display='block';
+ if (document.getElementById("multiseriesDiv")) document.getElementById("multiseriesDiv").style.display='none';
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='block';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='block';
+ if (document.getElementById("lastSeriesAsLineChartDiv")) document.getElementById("lastSeriesAsLineChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='none';
+ if (document.getElementById("barChartOptions")) document.getElementById("barChartOptions").style.display="none";
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="none";
+ if (document.getElementById("AddRangeAxisDiv")) document.getElementById("AddRangeAxisDiv").style.display="none";
+ if (document.getElementById("TimeDifferenceChartOptions")) document.getElementById("TimeDifferenceChartOptions").style.display='none';
+ if (document.getElementById("BarLineChartOptions")) document.getElementById("BarLineChartOptions").style.display='none';
+ if (document.getElementById("LabelAngleForOtherCharts")) document.getElementById("LabelAngleForOtherCharts").style.display='block';
+ if (document.getElementById("LabelAngleForTimeSeriesCharts")) document.getElementById("LabelAngleForTimeSeriesCharts").style.display='none';
+ if (document.getElementById("maxLabelsInDomainAxisForOtherCharts")) document.getElementById("maxLabelsInDomainAxisForOtherCharts").style.display='block';
+ if (document.getElementById("keepAsString")) document.getElementById("keepAsString").style.display='none';
+
+
+ } else if(selectedString == "<%=AppConstants.GT_STACKED_VERT_BAR%>" || selectedString == "<%=AppConstants.GT_STACKED_HORIZ_BAR%>" || selectedString == "<%=AppConstants.GT_STACKED_VERT_BAR_LINES%>"
+ || selectedString == "<%=AppConstants.GT_STACKED_HORIZ_BAR_LINES%>") {
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ if (document.getElementById("animatedDiv")) document.getElementById("animatedDiv").style.display="none";
+ if (document.getElementById("multiplePieChartOptions")) document.getElementById("multiplePieChartOptions").style.display="none";
+ if (document.getElementById("chartOptions")) document.getElementById("chartOptions").style.display="block";
+ if (document.getElementById("drillDownOptions")) document.getElementById("drillDownOptions").style.display="none";
+ if (document.getElementById("seriesDiv")) document.getElementById("seriesDiv").style.display='block';
+ if (document.getElementById("multiseriesDiv")) document.getElementById("multiseriesDiv").style.display='none';
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='none';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='block';
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="block";
+ if (document.getElementById("lastSeriesAsLineChartDiv")) document.getElementById("lastSeriesAsLineChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='none';
+ if (document.getElementById("barChartOptions")) document.getElementById("barChartOptions").style.display="none";
+ if (document.getElementById("AddRangeAxisDiv")) document.getElementById("AddRangeAxisDiv").style.display="block";
+ if (document.getElementById("TimeDifferenceChartOptions")) document.getElementById("TimeDifferenceChartOptions").style.display='none';
+ if (document.getElementById("BarLineChartOptions")) document.getElementById("BarLineChartOptions").style.display='none';
+ if (document.getElementById("LabelAngleForOtherCharts")) document.getElementById("LabelAngleForOtherCharts").style.display='block';
+ if (document.getElementById("LabelAngleForTimeSeriesCharts")) document.getElementById("LabelAngleForTimeSeriesCharts").style.display='none';
+ if (document.getElementById("maxLabelsInDomainAxisForOtherCharts")) document.getElementById("maxLabelsInDomainAxisForOtherCharts").style.display='block';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='block';
+ if (document.getElementById("keepAsString")) document.getElementById("keepAsString").style.display='none';
+
+ } else if(selectedString == "<%=AppConstants.GT_BAR_3D%>") {
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ if (document.getElementById("animatedDiv")) document.getElementById("animatedDiv").style.display="block";
+ if (document.getElementById("BarChartOptions")) document.getElementById("BarChartOptions").style.display='block';
+ if (document.getElementById("drillDownOptions")) document.getElementById("drillDownOptions").style.display='block';
+ if (document.getElementById("seriesDiv")) document.getElementById("seriesDiv").style.display='block';
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="none";
+ if (document.getElementById("multiseriesDiv")) document.getElementById("multiseriesDiv").style.display='none';
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsLineChartDiv")) document.getElementById("lastSeriesAsLineChartDiv").style.display='block';
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='none';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='block';
+ if (document.getElementById("chartOptions")) document.getElementById("chartOptions").style.display="block";
+ if (document.getElementById("multiplePieChartOptions")) document.getElementById("multiplePieChartOptions").style.display="none";
+ if (document.getElementById("AddRangeAxisDiv")) document.getElementById("AddRangeAxisDiv").style.display="block";
+ if (document.getElementById("TimeDifferenceChartOptions")) document.getElementById("TimeDifferenceChartOptions").style.display='none';
+ if (document.getElementById("BarLineChartOptions")) document.getElementById("BarLineChartOptions").style.display='block';
+ if (document.getElementById("LabelAngleForOtherCharts")) document.getElementById("LabelAngleForOtherCharts").style.display='block';
+ if (document.getElementById("LabelAngleForTimeSeriesCharts")) document.getElementById("LabelAngleForTimeSeriesCharts").style.display='none';
+ if (document.getElementById("maxLabelsInDomainAxisForOtherCharts")) document.getElementById("maxLabelsInDomainAxisForOtherCharts").style.display='block';
+ if (document.getElementById("keepAsString")) document.getElementById("keepAsString").style.display='none';
+
+ } else if(selectedString == "<%=AppConstants.GT_LINE%>") {
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ if (document.getElementById("animatedDiv")) document.getElementById("animatedDiv").style.display="none";
+ if (document.getElementById("barChartOptions")) document.getElementById("barChartOptions").style.display="none";
+ if (document.getElementById("drillDownOptions")) document.getElementById("drillDownOptions").style.display="none";
+ if (document.getElementById("seriesDiv")) document.getElementById("seriesDiv").style.display='block';
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="none";
+ if (document.getElementById("multiseriesDiv")) document.getElementById("multiseriesDiv").style.display='none';
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsLineChartDiv")) document.getElementById("lastSeriesAsLineChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='block';
+ if (document.getElementById("chartOptions")) document.getElementById("chartOptions").style.display="block";
+ if (document.getElementById("multiplePieChartOptions")) document.getElementById("multiplePieChartOptions").style.display="none";
+ if (document.getElementById("AddRangeAxisDiv")) document.getElementById("AddRangeAxisDiv").style.display="block";
+ if (document.getElementById("TimeDifferenceChartOptions")) document.getElementById("TimeDifferenceChartOptions").style.display='none';
+ if (document.getElementById("BarLineChartOptions")) document.getElementById("BarLineChartOptions").style.display='block';
+ if (document.getElementById("LabelAngleForOtherCharts")) document.getElementById("LabelAngleForOtherCharts").style.display='block';
+ if (document.getElementById("LabelAngleForTimeSeriesCharts")) document.getElementById("LabelAngleForTimeSeriesCharts").style.display='none';
+ if (document.getElementById("maxLabelsInDomainAxisForOtherCharts")) document.getElementById("maxLabelsInDomainAxisForOtherCharts").style.display='block';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='block';
+ if (document.getElementById("keepAsString")) document.getElementById("keepAsString").style.display='block';
+
+ } else if (selectedString == "<%=AppConstants.GT_PARETO_CHART%>") {
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ if (document.getElementById("animatedDiv")) document.getElementById("animatedDiv").style.display="none";
+ if (document.getElementById("chartOptions")) document.getElementById("chartOptions").style.display="block";
+ if (document.getElementById("drillDownOptions")) document.getElementById("drillDownOptions").style.display="none";
+ if (document.getElementById("seriesDiv")) document.getElementById("seriesDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsLineChartDiv")) document.getElementById("lastSeriesAsLineChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='none';
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='none';
+ if (document.getElementById("multiseriesDiv")) document.getElementById("multiseriesDiv").style.display='none';
+ if (document.getElementById("multiplePieChartOptions")) document.getElementById("multiplePieChartOptions").style.display="none";
+ if (document.getElementById("barChartOptions")) document.getElementById("barChartOptions").style.display="none";
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="none";
+ if (document.getElementById("AddRangeAxisDiv")) document.getElementById("AddRangeAxisDiv").style.display="none";
+ if (document.getElementById("TimeDifferenceChartOptions")) document.getElementById("TimeDifferenceChartOptions").style.display='none';
+ if (document.getElementById("BarLineChartOptions")) document.getElementById("BarLineChartOptions").style.display='none';
+ if (document.getElementById("LabelAngleForOtherCharts")) document.getElementById("LabelAngleForOtherCharts").style.display='block';
+ if (document.getElementById("LabelAngleForTimeSeriesCharts")) document.getElementById("LabelAngleForTimeSeriesCharts").style.display='none';
+ if (document.getElementById("maxLabelsInDomainAxisForOtherCharts")) document.getElementById("maxLabelsInDomainAxisForOtherCharts").style.display='block';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='none';
+ if (document.getElementById("keepAsString")) document.getElementById("keepAsString").style.display='none';
+
+ } else if (selectedString == "<%=AppConstants.GT_TIME_DIFFERENCE_CHART%>") {
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ if (document.getElementById("animatedDiv")) document.getElementById("animatedDiv").style.display="none";
+ if (document.getElementById("chartOptions")) document.getElementById("chartOptions").style.display="block";
+ if (document.getElementById("drillDownOptions")) document.getElementById("drillDownOptions").style.display="none";
+ if (document.getElementById("seriesDiv")) document.getElementById("seriesDiv").style.display='block';
+ if (document.getElementById("lastSeriesAsLineChartDiv")) document.getElementById("lastSeriesAsLineChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='none';
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='none';
+ if (document.getElementById("multiseriesDiv")) document.getElementById("multiseriesDiv").style.display='none';
+ if (document.getElementById("multiplePieChartOptions")) document.getElementById("multiplePieChartOptions").style.display="none";
+ if (document.getElementById("barChartOptions")) document.getElementById("barChartOptions").style.display="none";
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="none";
+ if (document.getElementById("AddRangeAxisDiv")) document.getElementById("AddRangeAxisDiv").style.display="none";
+ if (document.getElementById("TimeDifferenceChartOptions")) document.getElementById("TimeDifferenceChartOptions").style.display='block';
+ if (document.getElementById("BarLineChartOptions")) document.getElementById("BarLineChartOptions").style.display='none';
+ if (document.getElementById("LabelAngleForTimeSeriesCharts")) document.getElementById("LabelAngleForTimeSeriesCharts").style.display='block';
+ if (document.getElementById("LabelAngleForOtherCharts")) document.getElementById("LabelAngleForOtherCharts").style.display='none';
+ if (document.getElementById("maxLabelsInDomainAxisForOtherCharts")) document.getElementById("maxLabelsInDomainAxisForOtherCharts").style.display='none';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='none';
+ if (document.getElementById("keepAsString")) document.getElementById("keepAsString").style.display='none';
+
+ } else if (selectedString == "<%=AppConstants.GT_COMPARE_PREVYEAR_CHART%>") {
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ if (document.getElementById("animatedDiv")) document.getElementById("animatedDiv").style.display="none";
+ if (document.getElementById("chartOptions")) document.getElementById("chartOptions").style.display="block";
+ if (document.getElementById("drillDownOptions")) document.getElementById("drillDownOptions").style.display="none";
+ if (document.getElementById("seriesDiv")) document.getElementById("seriesDiv").style.display='block';
+ if (document.getElementById("lastSeriesAsLineChartDiv")) document.getElementById("lastSeriesAsLineChartDiv").style.display='none';
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='none';
+ if (document.getElementById("multiseriesDiv")) document.getElementById("multiseriesDiv").style.display='none';
+ if (document.getElementById("multiplePieChartOptions")) document.getElementById("multiplePieChartOptions").style.display="none";
+ if (document.getElementById("barChartOptions")) document.getElementById("barChartOptions").style.display="none";
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="none";
+ if (document.getElementById("AddRangeAxisDiv")) document.getElementById("AddRangeAxisDiv").style.display="none";
+ if (document.getElementById("BarLineChartOptions")) document.getElementById("BarLineChartOptions").style.display='none';
+ if (document.getElementById("TimeDifferenceChartOptions")) document.getElementById("TimeDifferenceChartOptions").style.display='none';
+ if (document.getElementById("LabelAngleForTimeSeriesCharts")) document.getElementById("LabelAngleForTimeSeriesCharts").style.display='block';
+ if (document.getElementById("LabelAngleForOtherCharts")) document.getElementById("LabelAngleForOtherCharts").style.display='none';
+ if (document.getElementById("maxLabelsInDomainAxisForOtherCharts")) document.getElementById("maxLabelsInDomainAxisForOtherCharts").style.display='none';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='none';
+ if (document.getElementById("keepAsString")) document.getElementById("keepAsString").style.display='none';
+
+ }else if (selectedString != "<%=AppConstants.GT_TIME_SERIES%>") {
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ if (document.getElementById("animatedDiv")) document.getElementById("animatedDiv").style.display="block";
+ if (document.getElementById("chartOptions")) document.getElementById("chartOptions").style.display="block";
+ if (document.getElementById("drillDownOptions")) document.getElementById("drillDownOptions").style.display="block";
+ if (document.getElementById("seriesDiv")) document.getElementById("seriesDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsLineChartDiv")) document.getElementById("lastSeriesAsLineChartDiv").style.display='none';
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='none';
+ //if (document.getElementById("multiseriesDiv")) document.getElementById("multiseriesDiv").style.display='none';
+ if (document.getElementById("multiplePieChartOptions")) document.getElementById("multiplePieChartOptions").style.display="none";
+ if (document.getElementById("barChartOptions")) document.getElementById("barChartOptions").style.display="none";
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="none";
+ if (document.getElementById("AddRangeAxisDiv")) document.getElementById("AddRangeAxisDiv").style.display="block";
+ if (document.getElementById("TimeDifferenceChartOptions")) document.getElementById("TimeDifferenceChartOptions").style.display='none';
+ if (document.getElementById("BarLineChartOptions")) document.getElementById("BarLineChartOptions").style.display='none';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='block';
+ if (document.getElementById("keepAsString")) document.getElementById("keepAsString").style.display='none';
+
+ } else if (selectedString == "<%=AppConstants.GT_MULTIPLE_TIMESERIES_CHART%>") {
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ if (document.getElementById("animatedDiv")) document.getElementById("animatedDiv").style.display="none";
+ if (document.getElementById("LabelAngleForOtherCharts")) document.getElementById("LabelAngleForOtherCharts").style.display='none';
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='none';
+ if (document.getElementById("drillDownOptions")) document.getElementById("drillDownOptions").style.display="none";
+ if (document.getElementById("LabelAngleForTimeSeriesCharts")) document.getElementById("LabelAngleForTimeSeriesCharts").style.display='block';
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="none";
+ if (document.getElementById("chartOptions")) document.getElementById("chartOptions").style.display="block";
+ if (document.getElementById("seriesDiv")) document.getElementById("seriesDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsLineChartDiv")) document.getElementById("lastSeriesAsLineChartDiv").style.display='none';
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='none';
+ if (document.getElementById("multiseriesDiv")) document.getElementById("multiseriesDiv").style.display='none';
+ if (document.getElementById("multiplePieChartOptions")) document.getElementById("multiplePieChartOptions").style.display="none";
+ if (document.getElementById("barChartOptions")) document.getElementById("barChartOptions").style.display="none";
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="none";
+ if (document.getElementById("AddRangeAxisDiv")) document.getElementById("AddRangeAxisDiv").style.display="block";
+ if (document.getElementById("TimeDifferenceChartOptions")) document.getElementById("TimeDifferenceChartOptions").style.display='none';
+ if (document.getElementById("BarLineChartOptions")) document.getElementById("BarLineChartOptions").style.display='none';
+ if (document.getElementById("keepAsString")) document.getElementById("keepAsString").style.display='none';
+
+ } else {
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ if (document.getElementById("animatedDiv")) document.getElementById("animatedDiv").style.display="none";
+ if (document.getElementById("regressionChartDiv")) document.getElementById("regressionChartDiv").style.display='none';
+ if (document.getElementById("LabelAngleForOtherCharts")) document.getElementById("LabelAngleForOtherCharts").style.display='block';
+ if (document.getElementById("LabelAngleForTimeSeriesCharts")) document.getElementById("LabelAngleForTimeSeriesCharts").style.display='none';
+ if (document.getElementById("maxLabelsInDomainAxisForOtherCharts")) document.getElementById("maxLabelsInDomainAxisForOtherCharts").style.display='none';
+ if (document.getElementById("CustomizingYAxisDiv")) document.getElementById("CustomizingYAxisDiv").style.display='none';
+ if (document.getElementById("drillDownOptions")) document.getElementById("drillDownOptions").style.display="none";
+ if (document.getElementById("lastSeriesAsBarChartDiv")) document.getElementById("lastSeriesAsBarChartDiv").style.display='none';
+ if (document.getElementById("seriesDiv")) document.getElementById("seriesDiv").style.display='none';
+ if (document.getElementById("multiseriesDiv")) document.getElementById("multiseriesDiv").style.display='none';
+ if (document.getElementById("multiplePieChartOptions")) document.getElementById("multiplePieChartOptions").style.display="none";
+ if (document.getElementById("barChartOptions")) document.getElementById("barChartOptions").style.display="none";
+ if (document.getElementById("stackBarChartOptions")) document.getElementById("stackBarChartOptions").style.display="none";
+ if (document.getElementById("AddRangeAxisDiv")) document.getElementById("AddRangeAxisDiv").style.display="none";
+ if (document.getElementById("TimeDifferenceChartOptions")) document.getElementById("TimeDifferenceChartOptions").style.display='none';
+ if (document.getElementById("BarLineChartOptions")) document.getElementById("BarLineChartOptions").style.display='none';
+ if (document.getElementById("keepAsString")) document.getElementById("keepAsString").style.display='none';
+ }
+ }
+ }
+
+
+</script>
+
+<iframe id="calendarFrame" class="nav" z-index:199; scrolling="no" frameborder="0" width=165px height=165px src="" style="position:absolute; display:none;">
+</iframe>
+
+ <div id="calendarDiv" name="calendarDiv" style="position:absolute; z-index:200; visibility:none; background-color:white;layer-background-color:white;"></div>
+
+
+<table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=5 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+<% if(numColsCount==0) { %>
+ <tr>
+ <td class=rbg2 colspan=5 align="center" height="30"><font class=rtabletext>No numeric columns found - chart not available</font></td>
+ </tr>
+ <input type="hidden" name="chartType" value="">
+ <input type="hidden" name="chartWidth" value="">
+ <input type="hidden" name="chartHeight" value="">
+
+<% } else { %>
+
+ <tr>
+ <td colspan="4">
+ <table><tr>
+ <td class=rbg2 align="right" width="50%" height="30"><font class=rtabletext>Chart Type: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="chartType" onChange="showAlertForTimeSeries()">
+ <option value="" <%= chartType.equals("" )?" selected":"" %>>--- Do Not Include Chart ---
+ <option value="<%= AppConstants.GT_BAR_3D %>"<%= chartType.equals(AppConstants.GT_BAR_3D ) || chartType.equals(AppConstants.GT_HORIZ_BAR ) || chartType.equals(AppConstants.GT_VERT_BAR ) || chartType.equals(AppConstants.GT_BAR_LINES)?" selected":"" %>>Bar Chart
+ <option value="<%= AppConstants.GT_TOTAL_BAR %>"<%= chartType.equals(AppConstants.GT_TOTAL_BAR)?" selected":"" %>>Bar Chart With Running Total
+ <% if(!Globals.getJFreeVersion().equals(AppConstants.JFV_0911)) { %>
+ <option value="<%= AppConstants.GT_STACKED_VERT_BAR %>"<%= chartType.equals(AppConstants.GT_STACKED_VERT_BAR)?" selected":"" %>>Vertical Stacked Bar
+ <option value="<%= AppConstants.GT_STACKED_HORIZ_BAR %>"<%= chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR)?" selected":"" %>>Horizontal Stacked Bar
+ <option value="<%= AppConstants.GT_STACKED_VERT_BAR_LINES %>"<%= chartType.equals(AppConstants.GT_STACKED_VERT_BAR_LINES)?" selected":"" %>>Vertical Stacked Bar With Lines Chart
+ <option value="<%= AppConstants.GT_STACKED_HORIZ_BAR_LINES %>"<%= chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR_LINES)?" selected":"" %>>Horizontal Stacked Bar With Lines Chart
+ <% } %>
+ <option value="<%= AppConstants.GT_LINE %>"<%= chartType.equals(AppConstants.GT_LINE )?" selected":"" %>>Line Chart
+ <option value="<%= AppConstants.GT_PIE_3D %>"<%= chartType.equals(AppConstants.GT_PIE_3D )?" selected":"" %>>Pie Chart 3D
+ <option value="<%= AppConstants.GT_PIE %>"<%= chartType.equals(AppConstants.GT_PIE )?" selected":"" %>>Pie Chart
+ <option value="<%= AppConstants.GT_PIE_MULTIPLE %>"<%= chartType.equals(AppConstants.GT_PIE_MULTIPLE )?" selected":"" %>>Multiple Pie Chart
+ <option value="<%= AppConstants.GT_PARETO_CHART %>"<%= chartType.equals(AppConstants.GT_PARETO_CHART )?" selected":"" %>>Pareto Chart
+ <option value="<%= AppConstants.GT_MULTIPLE_TIMESERIES_CHART %>"<%= chartType.equals(AppConstants.GT_MULTIPLE_TIMESERIES_CHART )?" selected":"" %>>Multiple TimeSeries Chart
+ <option value="<%= AppConstants.GT_TIME_DIFFERENCE_CHART %>"<%= chartType.equals(AppConstants.GT_TIME_DIFFERENCE_CHART )?" selected":"" %>>Time Difference Chart
+ <option value="<%= AppConstants.GT_COMPARE_PREVYEAR_CHART %>"<%= chartType.equals(AppConstants.GT_COMPARE_PREVYEAR_CHART )?" selected":"" %>>Compare Previous Year Chart
+ <option value="<%= AppConstants.GT_SCATTER %>"<%= chartType.equals(AppConstants.GT_SCATTER )?" selected":"" %>>Scatter Plot Chart
+ <option value="<%= AppConstants.GT_REGRESSION %>"<%= chartType.equals(AppConstants.GT_REGRESSION )?" selected":"" %>>Regression Chart
+ <option value="<%= AppConstants.GT_HIERARCHICAL %>"<%= chartType.equals(AppConstants.GT_HIERARCHICAL )?" selected":"" %>>Hierarchical (HTML5) Chart
+ <option value="<%= AppConstants.GT_HIERARCHICAL_SUNBURST %>"<%= chartType.equals(AppConstants.GT_HIERARCHICAL_SUNBURST )?" selected":"" %>>Hierarchical (HTML5) Sun Burst Chart
+
+<% if(!Globals.getJFreeVersion().equals(AppConstants.JFV_0911)) { %>
+ <option value="<%= AppConstants.GT_TIME_SERIES%>"<%= chartType.equals(AppConstants.GT_TIME_SERIES )?" selected":"" %>>Time Series Chart
+<% } //It is supported only when chart library is above 0911 %>
+<% if(Globals.getShowNonstandardCharts()) { %>
+ <option value="<%= AppConstants.GT_MTD_BAR %>"<%= chartType.equals(AppConstants.GT_MTD_BAR )?" selected":"" %>>Month To Date Bar Chart
+<% } // if(Globals.getShowNonstandardCharts
+%>
+ </select></font></td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <input type="checkbox" name="chartTypeFixed" value="Y"<%= rdef.isChartTypeFixed()?" checked":"" %>>
+ &nbsp;Do NOT allow user to change chart type at runtime
+ </td>
+ <td id="animatedDiv" style ="display:none;">
+ <select name="animatedOption">
+ <option value="static" <%=!rdef.isChartAnimate()?" selected":""%>> Static </option>
+ <option value="animate" <%=rdef.isChartAnimate()?" selected":""%>> Animate </option>
+ </select>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Chart Width (px): </font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type="text" name="chartWidth" value="<%= ""+rdef.getChartWidthAsInt() %>" size="10" maxlength="4"></font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Chart Height (px): </font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type="text" name="chartHeight" value="<%= ""+rdef.getChartHeightAsInt() %>" size="10" maxlength="4"></font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Domain Axis: </font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <select name="legendCol">
+ <% for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dct = (DataColumnType) iter.next(); %>
+ <option value="<%= dct.getColId() %>"<%= nvl(legendColId /*, firstColId*/).equals(dct.getColId())?" selected":"" %>><%= dct.getDisplayName() %>
+ <% } %>
+ </select></font></td>
+ </tr>
+ <tr id="seriesDiv">
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Category:</font></td>
+ <td class=rbg3 colspan=4 align="left" ><font class=rtabletext>
+ <select name="chartSeries" onChange="refreshWizard()">
+ <% int isThereChartSeries = 0;
+ if(rdef.hasSeriesColumn()) isThereChartSeries = 1;
+ if(isThereChartSeries == 0) {
+ %>
+ <option value="-1" selected> -->select series <-- </option>
+ <%
+ } else {
+ %>
+ <option value="-1"> -->select series <-- </option>
+ <%
+ } // else
+ for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if(dct.isChartSeries()!=null && dct.isChartSeries().booleanValue()) {
+ %>
+ <option value="<%= dct.getColId() %>" selected><%= dct.getDisplayName() %>
+ <%
+ } else {
+
+ %>
+ <option value="<%= dct.getColId() %>"><%= dct.getDisplayName() %>
+ <%
+ } // else Chart Series
+ } // for
+
+ %>
+ </select></font></td>
+ </tr>
+ <tr id = "lastSeriesAsLineChartDiv">
+ <td> last Category display As Line Chart
+ </td>
+ <td class=rbg3 colspan=3 align="left" nowrap><font class=rtabletext>
+ <input type="checkbox" name="lastSeriesALineChart" value="Y"<%= rdef.isLastSeriesALineChart()?" checked":"" %>>
+ </td>
+ </tr>
+
+ <tr id = "lastSeriesAsBarChartDiv">
+ <td> last Category display As Bar Chart
+ </td>
+ <td class=rbg3 colspan=3 align="left" nowrap><font class=rtabletext>
+ <input type="checkbox" name="lastSeriesABarChart" value="Y"<%= rdef.isLastSeriesABarChart()?" checked":"" %>>
+ </td>
+ </tr>
+
+ <tr id = "multiseriesDiv">
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Multi Series</font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%">
+ <input type=radio name="multiSeries" value="Y" <%= (AppUtils.getRequestNvlValue(request, "multiSeries").trim().length()>0? (AppUtils.getRequestNvlValue(request, "multiSeries").equals("Y")? " checked ":""): (rdef.isMultiSeries() ? " checked ":" checked ")) %>><font class=rtabletext>Yes</font>
+ <input type=radio name="multiSeries" value="N" <%= (AppUtils.getRequestNvlValue(request, "multiSeries").trim().length()>0? (AppUtils.getRequestNvlValue(request, "multiSeries").equals("N")? " checked ":""): (!rdef.isMultiSeries() ? " checked":"")) %>><font class=rtabletext>No</font>
+ </tr>
+
+<% if(chartValueCols.size()==0) { %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Range Axis:</font></td>
+ <td class=rbg3 colspan=3 align="left" width="50%"><font class=rtabletext>
+ <select name="valueCol1">
+ <% for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if(isSQLBased||nvl(dct.getColType()).equals(AppConstants.CT_NUMBER)) {%>
+ <option value="<%= dct.getColId() %>"><%= dct.getDisplayName() %>
+ <% } // if
+ } // for
+ %>
+ </select></font></td>
+ <td class=rbg3 align="center" nowrap><font class=rtabletext>
+ <% String sValue = ""; %>
+ <select name="valueCol1Color">
+ <option value=""<%= sValue.equals("") ?" selected":"" %>>Color: Default
+ <option value="#00FFFF"<%= sValue.equals("#00FFFF")?" selected":"" %>>Aqua
+ <option value="#000000"<%= sValue.equals("#000000")?" selected":"" %>>Black
+ <option value="#0000FF"<%= sValue.equals("#0000FF")?" selected":"" %>>Blue
+ <option value="#FF00FF"<%= sValue.equals("#FF00FF")?" selected":"" %>>Fuchsia
+ <option value="#808080"<%= sValue.equals("#808080")?" selected":"" %>>Gray
+ <option value="#008000"<%= sValue.equals("#008000")?" selected":"" %>>Green
+ <option value="#00FF00"<%= sValue.equals("#00FF00")?" selected":"" %>>Lime
+ <option value="#800000"<%= sValue.equals("#800000")?" selected":"" %>>Maroon
+ <option value="#000080"<%= sValue.equals("#000080")?" selected":"" %>>Navy
+ <option value="#808000"<%= sValue.equals("#808000")?" selected":"" %>>Olive
+ <option value="#FF9900"<%= sValue.equals("#FF9900")?" selected":"" %>>Orange
+ <option value="#800080"<%= sValue.equals("#800080")?" selected":"" %>>Purple
+ <option value="#FF0000"<%= sValue.equals("#FF0000")?" selected":"" %>>Red
+ <option value="#C0C0C0"<%= sValue.equals("#C0C0C0")?" selected":"" %>>Silver
+ <option value="#008080"<%= sValue.equals("#008080")?" selected":"" %>>Teal
+ <option value="#FFFFFF"<%= sValue.equals("#FFFFFF")?" selected":"" %>>White
+ <option value="#FFFF00"<%= sValue.equals("#FFFF00")?" selected":"" %>>Yellow
+ </select>
+ </font></td>
+ </tr>
+<% } else {
+ int count = 1;
+ String colIdx = "";
+ for(Iterator iterV=chartValueCols.iterator(); iterV.hasNext(); count++) {
+ colIdx = "";
+ DataColumnType dctV = (DataColumnType) iterV.next();
+ colIdx = dctV.getColId();
+ int colAxisIdx = 0;
+ boolean newChart = false;
+ try {
+ colAxisIdx = Integer.parseInt(dctV.getColOnChart());
+ } catch(Exception e) {}
+ newChart = (dctV.isCreateInNewChart()!=null)?dctV.isCreateInNewChart().booleanValue():false;
+ %>
+
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Range Axis <%= count %>:</font></td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <select name="valueCol<%= count %>">
+ <% for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if(isSQLBased||nvl(dct.getColType()).equals(AppConstants.CT_NUMBER)) {%>
+ <option value="<%= dct.getColId() %>"<%= dct.getColId().equals(dctV.getColId())?" selected":"" %>><%= dct.getDisplayName() %>
+ <% } // if
+ } // for
+ %>
+ </select>
+ <% if(count>1) { %>
+ &nbsp;
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_USER %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dctV.getColId() %>';">
+ <% } %>
+ &nbsp;
+ </font></td>
+ <td class=rbg3 align="center" nowrap>
+ <%
+ String chartGroupOrg = dctV.getChartGroup();
+ String yAxisGroup = dctV.getYAxis();
+ String chartGroup = (chartGroupOrg!=null && chartGroupOrg.length()>0 && chartGroupOrg.indexOf("|")!= -1)?chartGroupOrg.substring(0,chartGroupOrg.lastIndexOf("|")):"";
+ String yAxis = (yAxisGroup!=null && yAxisGroup.length()>0 && yAxisGroup.indexOf("|")!= -1)?yAxisGroup.substring(0,yAxisGroup.lastIndexOf("|")):"";
+ %>
+ <div id="chartGroupDiv<%=colIdx%>">
+ <font class=rtabletext>Chart Title:</font><input type="text" name="chartGroup<%= colIdx%>Axis" value="<%=nvl(chartGroup).length()>0?chartGroup:""%>"/>
+ <font class=rtabletext>YAxis:</font><input type="text" name="YAxisLabel<%= colIdx%>" value="<%=nvl(yAxis).length()>0?yAxis:""%>"/>
+ </div>
+
+ </td>
+ <td class=rbg3 align="center" nowrap><font class=rtabletext>
+ <% String sValue = nvl(dctV.getChartColor()); %>
+ <select name="valueCol<%= count %>Color">
+ <option value=""<%= sValue.equals("") ?" selected":"" %>>Color: Default
+ <option value="#00FFFF"<%= sValue.equals("#00FFFF")?" selected":"" %>>Aqua
+ <option value="#000000"<%= sValue.equals("#000000")?" selected":"" %>>Black
+ <option value="#0000FF"<%= sValue.equals("#0000FF")?" selected":"" %>>Blue
+ <option value="#FF00FF"<%= sValue.equals("#FF00FF")?" selected":"" %>>Fuchsia
+ <option value="#808080"<%= sValue.equals("#808080")?" selected":"" %>>Gray
+ <option value="#008000"<%= sValue.equals("#008000")?" selected":"" %>>Green
+ <option value="#00FF00"<%= sValue.equals("#00FF00")?" selected":"" %>>Lime
+ <option value="#800000"<%= sValue.equals("#800000")?" selected":"" %>>Maroon
+ <option value="#000080"<%= sValue.equals("#000080")?" selected":"" %>>Navy
+ <option value="#808000"<%= sValue.equals("#808000")?" selected":"" %>>Olive
+ <option value="#FF9900"<%= sValue.equals("#FF9900")?" selected":"" %>>Orange
+ <option value="#800080"<%= sValue.equals("#800080")?" selected":"" %>>Purple
+ <option value="#FF0000"<%= sValue.equals("#FF0000")?" selected":"" %>>Red
+ <option value="#C0C0C0"<%= sValue.equals("#C0C0C0")?" selected":"" %>>Silver
+ <option value="#008080"<%= sValue.equals("#008080")?" selected":"" %>>Teal
+ <option value="#FFFFFF"<%= sValue.equals("#FFFFFF")?" selected":"" %>>White
+ <option value="#FFFF00"<%= sValue.equals("#FFFF00")?" selected":"" %>>Yellow
+ </select>
+ </font></td>
+ <td class=rbg3 align="left" nowrap valign="middle"><font class=rtabletext>
+ <% if(count>1) { %>
+ <div id="newChartDiv<%=count%>">
+ <input type="checkbox" name="newChart<%= count %>Axis" value="Y"<%= (newChart)?" checked":"" %>>
+ &nbsp;Create in New Chart
+ </div>
+ <input type="checkbox" name="valueCol<%= count %>Axis" value="Y"<%= (colAxisIdx>0)?" checked":"" %>>
+ &nbsp;Use secondary axis (Line chart only)
+ <% } %>
+ &nbsp;</font></td>
+ </tr>
+<% } // for
+ } // else (chartValueCols.size()==0)
+ if(unusedNumCols.size()>0) { %>
+ <tr id="AddRangeAxisDiv">
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Add Values Column:</font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="valueColNew" onChange="if(! checkValueColNew()) return; document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_USER %>'; document.forma.submit();">
+ <option value="" selected>--- Select Column ---
+ <% for(Iterator iter=unusedNumCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if(isSQLBased||nvl(dct.getColType()).equals(AppConstants.CT_NUMBER)) {%>
+ <option value="<%= dct.getColId() %>"><%= dct.getDisplayName() %>
+ <% } // if
+ } // for
+ %>
+ </select>
+ </font></td>
+ <td class=rbg3 align="center" nowrap><font class=rtabletext>
+ <% String sValue = ""; %>
+ <select name="valueColNewColor">
+ <option value=""<%= sValue.equals("") ?" selected":"" %>>Color: Default
+ <option value="#00FFFF"<%= sValue.equals("#00FFFF")?" selected":"" %>>Aqua
+ <option value="#000000"<%= sValue.equals("#000000")?" selected":"" %>>Black
+ <option value="#0000FF"<%= sValue.equals("#0000FF")?" selected":"" %>>Blue
+ <option value="#FF00FF"<%= sValue.equals("#FF00FF")?" selected":"" %>>Fuchsia
+ <option value="#808080"<%= sValue.equals("#808080")?" selected":"" %>>Gray
+ <option value="#008000"<%= sValue.equals("#008000")?" selected":"" %>>Green
+ <option value="#00FF00"<%= sValue.equals("#00FF00")?" selected":"" %>>Lime
+ <option value="#800000"<%= sValue.equals("#800000")?" selected":"" %>>Maroon
+ <option value="#000080"<%= sValue.equals("#000080")?" selected":"" %>>Navy
+ <option value="#808000"<%= sValue.equals("#808000")?" selected":"" %>>Olive
+ <option value="#FF9900"<%= sValue.equals("#FF9900")?" selected":"" %>>Orange
+ <option value="#800080"<%= sValue.equals("#800080")?" selected":"" %>>Purple
+ <option value="#FF0000"<%= sValue.equals("#FF0000")?" selected":"" %>>Red
+ <option value="#C0C0C0"<%= sValue.equals("#C0C0C0")?" selected":"" %>>Silver
+ <option value="#008080"<%= sValue.equals("#008080")?" selected":"" %>>Teal
+ <option value="#FFFFFF"<%= sValue.equals("#FFFFFF")?" selected":"" %>>White
+ <option value="#FFFF00"<%= sValue.equals("#FFFF00")?" selected":"" %>>Yellow
+ </select>
+ </font></td>
+ <td colspan="2" class=rbg3 align="left" nowrap><font class=rtabletext>
+ <input type="checkbox" name="valueColNewAxis" value="Y">
+ &nbsp;Use secondary axis (Line chart only)
+ </font></td>
+ </tr>
+<% } // if(unusedNumCols.size()==0)
+ if(chartValueCols.size()>1 || rdef.hasSeriesColumn()) { %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Primary Axis Label:</font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type="text" name="leftAxisLabel" class=rtabletext value="<%= nvl(rdef.getChartLeftAxisLabel()) %>" size="40">
+ &nbsp;(Multi-series Chart Only)</font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Secondary Axis Label:</font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type="text" name="rightAxisLabel" class=rtabletext value="<%= nvl(rdef.getChartRightAxisLabel()) %>" size="40">
+ &nbsp;(Multi-series Chart Only)</font></td>
+ </tr>
+<% } // if(chartValueCols.size()>1)
+%>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>&nbsp;</font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ Note: Some chart types (like Pie) will only display Series 1 Values.</font></td>
+ </tr>
+ <tr>
+ <td colspan=5>
+
+ <div id="multiplePieChartOptions" style="display:none;">
+ <table width="100%">
+ <tr>
+ <td colspan="3"><font class=rtabletext>Additional Multiple Pie Charts options:</font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Order by </font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type=radio name="multiplePieOrder" value="row" <%= AppUtils.getRequestNvlValue(request, "multiplePieOrder").equals("row")?" checked": ((AppUtils.getRequestNvlValue(request, "multiplePieOrder").length()<=0)? (rdef.isMultiplePieOrderByRow() ?" checked": (rdef.isMultiplePieOrderByColumn()?"":" checked")):"") %>>Table By Row
+ <input type=radio name="multiplePieOrder" value="column" <%= AppUtils.getRequestNvlValue(request, "multiplePieOrder").equals("column") ? " checked":((AppUtils.getRequestNvlValue(request, "multiplePieOrder").length()<=0)? (rdef.isMultiplePieOrderByColumn() ?" checked": (rdef.isMultiplePieOrderByRow()?"":" checked")):"") %>>Table By Column
+ </font></td>
+ <td>
+ <input type="checkbox" name="multiplePieOrderInRunPage" value="Y"<%= AppUtils.getRequestNvlValue(request, "multiplePieOrderInRunPage").equals("Y")? " checked":((AppUtils.getRequestNvlValue(request, "multiplePieOrderInRunPage").length()<=0)?(rdef.displayPieOrderinRunPage()?" checked":""):"") %>> Display in run page
+ </td>
+
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Label Options</font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type=radio name="multiplePieLabelDisplay" value="percentage"
+ <%= AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay").equals("percentage")?" checked": ((AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay").length()<=0)? (nvl(rdef.getMultiplePieLabelDisplay()).length() > 0 ? (rdef.getMultiplePieLabelDisplay().equals("percentage")?" checked":""):" checked"):"") %>>Display Percentage
+ <input type=radio name="multiplePieLabelDisplay" value="value"
+ <%= AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay").equals("value")?" checked": ((AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay").length()<=0)? (nvl(rdef.getMultiplePieLabelDisplay()).length() > 0 ? (rdef.getMultiplePieLabelDisplay().equals("value")?" checked":""):""):"") %>>Display Value
+ <input type=radio name="multiplePieLabelDisplay" value="novalue"
+ <%= AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay").equals("novalue")?" checked": ((AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay").length()<=0)? (nvl(rdef.getMultiplePieLabelDisplay()).length() > 0 ? (rdef.getMultiplePieLabelDisplay().equals("novalue")?" checked":""):" checked"):"") %>>Blank
+ </font>
+ </td>
+ <td>
+ <input type="checkbox" name="multiplePieLabelDisplayInRunPage" value="Y"<%= AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplayInRunPage").equals("Y")? " checked":((AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplayInRunPage").length()<=0)?(rdef.displayPieLabelDisplayinRunPage()?" checked":""):"") %>> Display in run page
+ </td>
+
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Display Options</font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type=radio name="chartDisplay" value="3D" <%= AppUtils.getRequestNvlValue(request, "chartDisplay").equals("3D")?" checked": ((AppUtils.getRequestNvlValue(request, "chartDisplay").length()<=0)? (rdef.isChartDisplayIn3D()?" checked":""):"") %>>Display in 3D
+ <input type=radio name="chartDisplay" value="normal" <%= AppUtils.getRequestNvlValue(request, "chartDisplay").equals("normal")?" checked": ((AppUtils.getRequestNvlValue(request, "chartDisplay").length()<=0)? (!rdef.isChartDisplayIn3D()?" checked":""):"") %>>Display in 2D
+ </font></td>
+ <td>
+ <input type="checkbox" name="chartDisplayInRunPage" value="Y"<%= AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").equals("Y")? " checked":((AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()<=0)?(rdef.displayChartDisplayinRunPage()?" checked":""):"") %>> Display in run page
+ </td>
+
+ </tr>
+ </table>
+ </div>
+
+ <div id="regressionChartDiv" style="display:none;">
+ <table width="100%" id = "regressionDiv">
+ <tr>
+ <td class=rbg2 align="right" width="20%" height="30"><font class=rtabletext>Regression Type </font></td>
+ <td class=rbg3 colspan=4 align="left" width="80%"><font class=rtabletext>
+ <input type=checkbox name="LinearRegressionType" value="Y" <%= (AppUtils.getRequestNvlValue(request, "regressionType").trim().length()>0? (AppUtils.getRequestNvlValue(request, "regressionType").charAt(0) == 'Y'? " checked ":""): (nvl(rdef.getLinearRegression()).length()>0 && rdef.getLinearRegression().charAt(0) == 'Y' ? " checked ":" checked ")) %>><font class=rtabletext>Linear</font>
+ <input type=checkbox name="ExpRegressionType" value="Y" <%= (AppUtils.getRequestNvlValue(request, "regressionType").trim().length()>1? (AppUtils.getRequestNvlValue(request, "regressionType").charAt(1) == 'Y'? " checked ":""): (nvl(rdef.getLinearRegression()).length()>1 && rdef.getLinearRegression().charAt(1) == 'Y' ? " checked ":" ")) %>><font class=rtabletext>Exponential</font>
+ <input type="hidden" name="regressionType" value=""/>
+ </font> </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="20%" height="30"><font class=rtabletext>Linear Regression Color </font></td>
+ <td class=rbg3 align="left" colspan=4 width=80% nowrap><font class=rtabletext>
+ <% String linearColor = nvl(rdef.getLinearRegressionColor()); %>
+ <select name="valueLinearRegressionColor">
+ <option value=""<%= linearColor.equals("") ?" selected":"" %>>Color: Default
+ <option value="#00FFFF"<%= linearColor.equals("#00FFFF")?" selected":"" %>>Aqua
+ <option value="#000000"<%= linearColor.equals("#000000")?" selected":"" %>>Black
+ <option value="#0000FF"<%= linearColor.equals("#0000FF")?" selected":"" %>>Blue
+ <option value="#FF00FF"<%= linearColor.equals("#FF00FF")?" selected":"" %>>Fuchsia
+ <option value="#808080"<%= linearColor.equals("#808080")?" selected":"" %>>Gray
+ <option value="#008000"<%= linearColor.equals("#008000")?" selected":"" %>>Green
+ <option value="#00FF00"<%= linearColor.equals("#00FF00")?" selected":"" %>>Lime
+ <option value="#800000"<%= linearColor.equals("#800000")?" selected":"" %>>Maroon
+ <option value="#000080"<%= linearColor.equals("#000080")?" selected":"" %>>Navy
+ <option value="#808000"<%= linearColor.equals("#808000")?" selected":"" %>>Olive
+ <option value="#FF9900"<%= linearColor.equals("#FF9900")?" selected":"" %>>Orange
+ <option value="#800080"<%= linearColor.equals("#800080")?" selected":"" %>>Purple
+ <option value="#FF0000"<%= linearColor.equals("#FF0000")?" selected":"" %>>Red
+ <option value="#C0C0C0"<%= linearColor.equals("#C0C0C0")?" selected":"" %>>Silver
+ <option value="#008080"<%= linearColor.equals("#008080")?" selected":"" %>>Teal
+ <option value="#FFFFFF"<%= linearColor.equals("#FFFFFF")?" selected":"" %>>White
+ <option value="#FFFF00"<%= linearColor.equals("#FFFF00")?" selected":"" %>>Yellow
+ </select>
+ </font></td>
+
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="20%" height="30"><font class=rtabletext>Exponential Regression Color </font></td>
+ <td class=rbg3 align="left" colspan=4 width=80% nowrap><font class=rtabletext>
+ <% String expColor = nvl(rdef.getExponentialRegressionColor()); %>
+ <select name="valueExponentialRegressionColor">
+ <option value=""<%= expColor.equals("") ?" selected":"" %>>Color: Default
+ <option value="#00FFFF"<%= expColor.equals("#00FFFF")?" selected":"" %>>Aqua
+ <option value="#000000"<%= expColor.equals("#000000")?" selected":"" %>>Black
+ <option value="#0000FF"<%= expColor.equals("#0000FF")?" selected":"" %>>Blue
+ <option value="#FF00FF"<%= expColor.equals("#FF00FF")?" selected":"" %>>Fuchsia
+ <option value="#808080"<%= expColor.equals("#808080")?" selected":"" %>>Gray
+ <option value="#008000"<%= expColor.equals("#008000")?" selected":"" %>>Green
+ <option value="#00FF00"<%= expColor.equals("#00FF00")?" selected":"" %>>Lime
+ <option value="#800000"<%= expColor.equals("#800000")?" selected":"" %>>Maroon
+ <option value="#000080"<%= expColor.equals("#000080")?" selected":"" %>>Navy
+ <option value="#808000"<%= expColor.equals("#808000")?" selected":"" %>>Olive
+ <option value="#FF9900"<%= expColor.equals("#FF9900")?" selected":"" %>>Orange
+ <option value="#800080"<%= expColor.equals("#800080")?" selected":"" %>>Purple
+ <option value="#FF0000"<%= expColor.equals("#FF0000")?" selected":"" %>>Red
+ <option value="#C0C0C0"<%= expColor.equals("#C0C0C0")?" selected":"" %>>Silver
+ <option value="#008080"<%= expColor.equals("#008080")?" selected":"" %>>Teal
+ <option value="#FFFFFF"<%= expColor.equals("#FFFFFF")?" selected":"" %>>White
+ <option value="#FFFF00"<%= expColor.equals("#FFFF00")?" selected":"" %>>Yellow
+ </select>
+ </font></td>
+
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="20%" height="30"><font class=rtabletext>Regression Point customization (in Numbers)</font></td>
+ <td class=rbg3 colspan=4 align="left" width="80%"><font class=rtabletext>
+ <input type=text name="regressionPointCustomization" value="<%=nvl(rdef.getCustomizedRegressionPoint(),"")%>">
+ </font></td>
+
+ </table>
+
+ </div>
+
+ <div id="CustomizingYAxisDiv" style="display:none;">
+ <table width="100%">
+ <tr>
+ <td class=rbg2 align="right" width="20%" height="30"><font class=rtabletext>Range Axis (Minimum Range)</font></td>
+ <td class=rbg3 colspan=4 align="left" width="80%"><font class=rtabletext>
+ <input type=text name="yAxisLowerLimit" value="<%=nvl(rdef.getRangeAxisLowerLimit(),"")%>">
+ </font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="20%" height="30"><font class=rtabletext>Range Axis (Maximum Range)</font></td>
+ <td class=rbg3 colspan=4 align="left" width="80%"><font class=rtabletext>
+ <input type=text name="yAxisUpperLimit" value="<%=nvl(rdef.getRangeAxisUpperLimit(),"")%>">
+ </font></td>
+ </tr>
+ </table>
+ </div>
+
+
+ <div id="BarLineChartOptions" style="display:none;">
+ <table width="100%">
+ <tr>
+ <td colspan="3"><font class=rtabletext>Additional Bar/Line Chart options:</font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Orientation </font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type=radio name="chartOrientation" value="vertical" <%= AppUtils.getRequestNvlValue(request, "chartOrientation").equals("vertical")?" checked": ((AppUtils.getRequestNvlValue(request, "chartOrientation").length()<=0)? (rdef.isVerticalOrientation() ?" checked": (rdef.isVerticalOrientation()?" checked":"")):"") %>>Vertical
+ <input type=radio name="chartOrientation" value="horizontal" <%= AppUtils.getRequestNvlValue(request, "chartOrientation").equals("horizontal") ? " checked":((AppUtils.getRequestNvlValue(request, "chartOrientation").length()<=0)? (rdef.isHorizontalOrientation() ?" checked": (rdef.isHorizontalOrientation()?" checked":"")):"") %>>Horizontal
+ </font></td>
+ <td>
+ <input type="checkbox" name="chartOrientationInRunPage" value="Y"<%= AppUtils.getRequestNvlValue(request, "chartOrientationInRunPage").equals("Y")? " checked":((AppUtils.getRequestNvlValue(request, "chartOrientationInRunPage").length()<=0)?(rdef.displayChartOrientationInRunPage()?" checked":""):"") %>> Display in run page
+ </td>
+
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Display Options</font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type=radio name="chartDisplay" value="3D" <%= AppUtils.getRequestNvlValue(request, "chartDisplay").equals("3D")?" checked": ((AppUtils.getRequestNvlValue(request, "chartDisplay").length()<=0)? (rdef.isChartDisplayIn3D()?" checked":""):"") %>>Display in 3D
+ <input type=radio name="chartDisplay" value="normal" <%= AppUtils.getRequestNvlValue(request, "chartDisplay").equals("normal")?" checked": ((AppUtils.getRequestNvlValue(request, "chartDisplay").length()<=0)? (!rdef.isChartDisplayIn3D()?" checked":""):"") %>>Display in 2D
+ </font></td>
+ <td>
+ <input type="checkbox" name="chartDisplayInRunPage" value="Y"<%= AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").equals("Y")? " checked":((AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()<=0)?(rdef.displayChartDisplayinRunPage()?" checked":""):"") %>> Display in run page
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="BarChartOptions" style="display:none;">
+ <table width="100%">
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Renderer for Secondary Axis</font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type=radio name="secondaryChartRenderer" value="line"
+ <%= AppUtils.getRequestNvlValue(request, "secondaryChartRenderer").equals("line")?" checked": ((AppUtils.getRequestNvlValue(request, "secondaryChartRenderer").length()<=0)? ((nvl(rdef.getSecondaryChartRenderer()).length() > 0) ? (rdef.getSecondaryChartRenderer().equals("line")?" checked":""):" checked"):"") %>>Line chart Renderer
+ <input type=radio name="secondaryChartRenderer" value="level"
+ <%= AppUtils.getRequestNvlValue(request, "secondaryChartRenderer").equals("level")?" checked": ((AppUtils.getRequestNvlValue(request, "secondaryChartRenderer").length()<=0)? ((nvl(rdef.getSecondaryChartRenderer()).length() > 0) ? (rdef.getSecondaryChartRenderer().equals("level")?" checked":""):""):"") %>>Level chart Renderer
+ </font>
+ </td>
+ <td>
+ <input type="checkbox" name="secondaryChartRendererInRunPage" value="Y"<%= AppUtils.getRequestNvlValue(request, "secondaryChartRendererInRunPage").equals("Y")? " checked":((AppUtils.getRequestNvlValue(request, "secondaryChartRendererInRunPage").length()<=0)?(rdef.displaySecondaryChartRendererInRunPage()?" checked":""):"") %>> Display in run page
+ </td>
+
+ </tr>
+ </table>
+ </div>
+
+ <div id="stackBarChartOptions" style="display:none;">
+ <table width="100%">
+ <tr>
+ <td colspan="3"><font class=rtabletext>Additional Bar Chart options:</font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Overlay Item Value:</font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type=radio name="overlayItemValue" value="Y"
+ <%= AppUtils.getRequestNvlValue(request, "overlayItemValue").equals("Y")?" checked": ((AppUtils.getRequestNvlValue(request, "overlayItemValue").length()<=0)? ((nvl(rdef.getOverlayItemValueOnStackBar()).length() > 0) ? (rdef.getOverlayItemValueOnStackBar().equals("Y")?" checked":""):" checked"):"") %>>Yes
+ <input type=radio name="overlayItemValue" value="N"
+ <%= AppUtils.getRequestNvlValue(request, "overlayItemValue").equals("N")?" checked": ((AppUtils.getRequestNvlValue(request, "overlayItemValue").length()<=0)? ((nvl(rdef.getOverlayItemValueOnStackBar()).length() > 0) ? (rdef.getOverlayItemValueOnStackBar().equals("N")?" checked":""):""):"") %>>No
+ </font>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+
+ <div id="TimeDifferenceChartOptions" style="display:none;">
+ <table width="100%">
+ <tr>
+ <td colspan="3"><font class=rtabletext>Additional Time Difference Chart options:</font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="15%" height="30"><font class=rtabletext>Interval Marker </font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type="text" size="10" maxlength="10" name="intervalFromDate" value="<%=rdef.getIntervalFromdate()%>" toolTipText="Enter the starting interval date">
+ <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20" onClick="oCalendar = new CalendarPopup('calendarDiv', 'calendarFrame');oCalendar.setCssPrefix('raptor');oCalendar.select(document.getElementById('intervalFromDate'),event,'MM/dd/yyyy'); return false;" style="cursor:hand">
+ <input type="text" size="10" maxlength="10" name="intervalToDate" value="<%=rdef.getIntervalTodate()%>" toolTipText="Enter the Ending interval date">
+ <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20" onClick="oCalendar = new CalendarPopup('calendarDiv', 'calendarFrame');oCalendar.setCssPrefix('raptor');oCalendar.select(document.getElementById('intervalToDate'),event,'MM/dd/yyyy'); return false;" style="cursor:hand">
+ <input type="text" size="50" maxlength="100" name="intervalLabel" value="<%=rdef.getIntervalLabel()%>" toolTipText="Enter the interval Label">
+ </font></td>
+ <td>
+ <input type="checkbox" name="intervalInputInRunPage" value="Y"<%= AppUtils.getRequestNvlValue(request, "intervalInputInRunPage").equals("Y")? " checked":((AppUtils.getRequestNvlValue(request, "intervalInputInRunPage").length()<=0)?(rdef.displayIntervalInputInRunPage()?" checked":""):"") %>> Display in run page
+ </td>
+
+ </tr>
+ </table>
+ </div>
+
+ <div id="chartOptions" style="display:none;">
+ <table width="100%">
+ <tr>
+ <td colspan="3"><font class=rtabletext>Additional chart options:</font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Legend Position</font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type=radio name="legendPosition" value="bottom" <%= AppUtils.getRequestNvlValue(request, "legendPosition").equals("bottom")?" checked": ((AppUtils.getRequestNvlValue(request, "legendPosition").length()<=0)? (nvl(rdef.getLegendPosition()).length()>0 ? (rdef.getLegendPosition().equals("bottom")?" checked":""):" checked"):"") %>>Bottom
+ <input type=radio name="legendPosition" value="top" <%= AppUtils.getRequestNvlValue(request, "legendPosition").equals("top")?" checked": ((AppUtils.getRequestNvlValue(request, "legendPosition").length()<=0)? (nvl(rdef.getLegendPosition()).length()>0 ? (rdef.getLegendPosition().equals("top")?" checked":""):""):"") %>>Top
+ <input type=radio name="legendPosition" value="left" <%= AppUtils.getRequestNvlValue(request, "legendPosition").equals("left")?" checked": ((AppUtils.getRequestNvlValue(request, "legendPosition").length()<=0)? (nvl(rdef.getLegendPosition()).length()>0 ? (rdef.getLegendPosition().equals("left")?" checked":""):""):"") %>>Left
+ <input type=radio name="legendPosition" value="right" <%= AppUtils.getRequestNvlValue(request, "legendPosition").equals("right")?" checked": ((AppUtils.getRequestNvlValue(request, "legendPosition").length()<=0)? (nvl(rdef.getLegendPosition()).length()>0 ? (rdef.getLegendPosition().equals("right")?" checked":""):""):"") %>>Right
+ </font></td>
+ <td>
+ &nbsp;
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Hide Tooltips</font></td>
+ <td>
+ <input type="checkbox" name="hideTooltips" value="Y"<%= AppUtils.getRequestNvlValue(request, "hideToolTips").equals("Y")? " checked":((AppUtils.getRequestNvlValue(request, "hideToolTips").length()<=0)?(rdef.hideChartToolTips()?" checked":""):"") %>> &nbsp;
+ </td>
+ <td> &nbsp;</td>
+ </tr>
+ <tr id="keepAsString">
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Keep Domain Axis Value As String</font></td>
+ <td>
+ <input type="checkbox" name="keepAsString" value="Y"<%= AppUtils.getRequestNvlValue(request, "keepAsString").equals("Y")? " checked":((AppUtils.getRequestNvlValue(request, "keepAsString").length()<=0)?(rdef.keepDomainAxisValueInChartAsString()?" checked":""):"") %>> &nbsp;
+ </td>
+ <td> &nbsp;</td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Hide Legend</font></td>
+ <td>
+ <input type="checkbox" name="hideLegend" value="Y"<%= AppUtils.getRequestNvlValue(request, "hideLegend").equals("Y")? " checked":((AppUtils.getRequestNvlValue(request, "hideLegend").length()<=0)?(rdef.hideChartLegend()?" checked":""):"") %>> &nbsp;
+ </td>
+ <td>
+ <input type="checkbox" name="showLegendDisplayOptionsInRunPage" value="Y"<%= AppUtils.getRequestNvlValue(request, "showLegendDisplayOptionsInRunPage").equals("Y")? " checked":((AppUtils.getRequestNvlValue(request, "showLegendDisplayOptionsInRunPage").length()<=0)?(rdef.showLegendDisplayOptionsInRunPage()?" checked":""):"") %>> Display in run page
+ </td>
+ </tr>
+ <tr id ="maxLabelsInDomainAxisForOtherCharts">
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Maximum Number of Labels in Domain Axis:</font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type=text name="maxLabelsInDomainAxis" class=rtabletext value="<%= AppUtils.getRequestNvlValue(request, "maxLabelsInDomainAxis").trim().length()>0?
+ AppUtils.getRequestNvlValue(request, "maxLabelsInDomainAxis"):
+ ((AppUtils.getRequestNvlValue(request, "maxLabelsInDomainAxis").length()<=0)?
+ (nvl(rdef.getMaxLabelsInDomainAxis()).length()>0 ? rdef.getMaxLabelsInDomainAxis():"1"):"1")%>" maxlength="2" size="2">
+ </font>
+ </td>
+ </tr>
+ <tr id ="LabelAngleForTimeSeriesCharts">
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Legend Label Angle</font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type=radio name="labelAngle" value="UP45" <%= AppUtils.getRequestNvlValue(request, "labelAngle").equals("UP45")?" checked": ((AppUtils.getRequestNvlValue(request, "labelAngle").length()<=0)? (nvl(rdef.getLegendLabelAngle()).length()>0 ? (rdef.getLegendLabelAngle().equals("UP45")?" checked":""):" checked"):"") %>>Standard
+ <input type=radio name="labelAngle" value="UP90" <%= AppUtils.getRequestNvlValue(request, "labelAngle").equals("UP90")?" checked": ((AppUtils.getRequestNvlValue(request, "labelAngle").length()<=0)? (nvl(rdef.getLegendLabelAngle()).length()>0 ? (rdef.getLegendLabelAngle().equals("UP90")?" checked":""):" checked"):"") %>>90 &deg;
+ </font></td>
+ <td>
+ &nbsp;
+ </td>
+ </tr>
+ <tr id ="LabelAngleForOtherCharts">
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Legend Label Angle</font></td>
+ <td class=rbg3 colspan=4 align="left" width="50%"><font class=rtabletext>
+ <input type=radio name="labelAngle" value="UP45" <%= AppUtils.getRequestNvlValue(request, "labelAngle").equals("UP45")?" checked": ((AppUtils.getRequestNvlValue(request, "labelAngle").length()<=0)? (nvl(rdef.getLegendLabelAngle()).length()>0 ? (rdef.getLegendLabelAngle().equals("UP45")?" checked":""):" checked"):"") %>>Up 45 &deg;
+ <input type=radio name="labelAngle" value="UP90" <%= AppUtils.getRequestNvlValue(request, "labelAngle").equals("UP90")?" checked":
+ ((AppUtils.getRequestNvlValue(request, "labelAngle").length()<=0)?
+ (nvl(rdef.getLegendLabelAngle()).length()>0 ?
+ (rdef.getLegendLabelAngle().equals("UP90")?" checked":""):""):"") %>>Up 90 &deg;
+ <input type=radio name="labelAngle" value="DOWN45" <%= AppUtils.getRequestNvlValue(request, "labelAngle").equals("DOWN45")?" checked": ((AppUtils.getRequestNvlValue(request, "labelAngle").length()<=0)? (nvl(rdef.getLegendLabelAngle()).length()>0 ? (rdef.getLegendLabelAngle().equals("DOWN45")?" checked":""):" checked"):"") %>>Down 45 &deg;
+ <input type=radio name="labelAngle" value="DOWN90" <%= AppUtils.getRequestNvlValue(request, "labelAngle").equals("DOWN90")?" checked": ((AppUtils.getRequestNvlValue(request, "labelAngle").length()<=0)? (nvl(rdef.getLegendLabelAngle()).length()>0 ? (rdef.getLegendLabelAngle().equals("DOWN90")?" checked":""):" checked"):"") %>>Down 90 &deg;
+ <input type=radio name="labelAngle" value="STANDARD" <%= AppUtils.getRequestNvlValue(request, "labelAngle").equals("STANDARD")?" checked": ((AppUtils.getRequestNvlValue(request, "labelAngle").length()<=0)? (nvl(rdef.getLegendLabelAngle()).length()>0 ? (rdef.getLegendLabelAngle().equals("STANDARD")?" checked":""):" checked"):"") %>>Standard
+ </font></td>
+ <td>
+ &nbsp;
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div id="drillDownOptions" style="display:none;">
+ <table width="100%">
+ <tr>
+ <td colspan="2"><font class=rtabletext>Drilldown options:</font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Drilldown report:</font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <select name="drillDownReport" onChange="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='GET_DRILLDOWN_FORMFIELDS'; document.forma.submit();">
+ <option value="-1">Please Select</option>
+ <%
+ Vector publicReportIdNames = DataCache.getPublicReportIdNames();
+ for(int i=0; i<publicReportIdNames.size(); i++) {
+ IdNameValue reportIdName = (IdNameValue) publicReportIdNames.get(i); %>
+ <option value="<%= reportIdName.getId() %>"<%= (nvl(rdef.getDrillReportIdForChart()).equals(reportIdName.getId()))?" selected":"" %>>Public Report: <%= reportIdName.getName() %></option>
+ <% } %>
+ <%
+ Vector groupReportIdNames = DataCache.getGroupAccessibleReportIdNames(AppUtils.getUserID(request),AppUtils.getUserRoles(request));
+ for(int j=0; j<groupReportIdNames.size(); j++) {
+ IdNameValue reportIdName = (IdNameValue) groupReportIdNames.get(j); %>
+ <option value="<%= reportIdName.getId() %>"<%= (nvl(rdef.getDrillReportIdForChart()).equals(reportIdName.getId()))?" selected":"" %>>Group Report: <%= reportIdName.getName() %></option>
+ <% } %>
+ <%
+ Vector privateReportIdNames = DataCache.getPrivateAccessibleReportIdNames(AppUtils.getUserID(request),AppUtils.getUserRoles(request));
+ for(int j=0; j<privateReportIdNames.size(); j++) {
+ IdNameValue reportIdName = (IdNameValue) privateReportIdNames.get(j); %>
+ <option value="<%= reportIdName.getId() %>"<%= (nvl(rdef.getDrillReportIdForChart()).equals(reportIdName.getId()))?" selected":"" %>>Private Report: <%= reportIdName.getName() %></option>
+ <% } %>
+
+ </select>
+ </font></td></tr>
+ <%
+ if(nvl(rdef.getDrillReportIdForChart()).length()>0) {
+ ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, rdef.getDrillReportIdForChart(),
+ false);
+ if (ddRr != null)
+ request.setAttribute("CHART_FORMFIELDS", ddRr.getReportFormFields());
+ }
+ %>
+
+
+ <% if(request.getAttribute("CHART_FORMFIELDS")!=null) { %>
+ <% ReportFormFields ddReportFormFields = (ReportFormFields) request.getAttribute("CHART_FORMFIELDS");
+ if(ddReportFormFields!=null) {
+ for(ddReportFormFields.resetNext(); ddReportFormFields.hasNext(); ) {
+ FormField ff = ddReportFormFields.getNext();
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+
+ %>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext><%=ff.getFieldDisplayName()%>:</font></td>
+ <td class=rbg3 align="left" width="50%">
+ <font class=rtabletext>
+ <select name="drillDown_<%=ff.getFieldName()%>">
+ <option value="<%= ff.getFieldName() %>_xaxis" <%= rdef.isChartDrillDownContainsName(ff.getFieldName()+"_xaxis")?" selected":""%>> X Axis </option>
+ <option value="<%= ff.getFieldName() %>_yaxis" <%= rdef.isChartDrillDownContainsName(ff.getFieldName()+"_yaxis")?" selected":"" %>> Y Axis </option>
+ <option value="<%= ff.getFieldName() %>_series" <%= rdef.isChartDrillDownContainsName(ff.getFieldName()+"_series")?" selected":"" %>> Series </option>
+ </select>
+ </font>
+ </td>
+ </tr>
+ <% }
+ }
+ }
+ }
+ %>
+
+
+ </div>
+
+ </td>
+ </tr>
+
+
+<% } // else (numColsCount==0)
+%>
+</table>
+<br>
+
+ <script language="javascript">
+ refreshWizard();
+ </script>
+
+<script language="JavaScript">
+<!--
+<% if(numColsCount>0) { %>
+function checkValueColNew() {
+ if(document.forma.valueColNew.selectedIndex==0)
+ return false;
+
+ var newColId = "";
+ newColId = document.forma.valueColNew.options[document.forma.valueColNew.selectedIndex].value;
+<% for(int idx=1; idx<Math.max(chartValueCols.size(), 1)+1; idx++) { %>
+ if(newColId==document.forma.valueCol<%= idx %>.options[document.forma.valueCol<%= idx %>.selectedIndex].value) {
+ alert("A column cannot be used as Chart Values Column more than once.");
+ document.forma.valueColNew.focus();
+ return false;
+ } // if
+<% } // for
+%>
+
+ return true;
+} // checkValueColNew
+<% } %>
+
+
+function showAlertForTimeSeries() {
+ var selectBox = document.forma.chartType;
+ var selectedString = selectBox.options[selectBox.selectedIndex].value;
+ refreshWizard();
+ if(selectedString == "<%=AppConstants.GT_PIE_MULTIPLE%>") {
+ //var contentIframe = window.parent.document.getElementById("content_Iframe");
+ //contentIframe.style.height = contentIframe.clientHeight + 120;
+ document.getElementById("multiplePieChartOptions").style.display="block";
+ }
+ else {
+ document.getElementById("multiplePieChartOptions").style.display="none";
+ }
+ if(selectedString == "<%=AppConstants.GT_TIME_SERIES%>"){
+ document.getElementById("animatedDiv").style.display="block";
+ return confirm("WARNING: Please make sure that the Domain Axis contains only\nDATE type of values, otherwise it will throw error.\nPress Ok to continue, or Cancel to re-examine the selection.");
+ } else if (selectedString == "<%=AppConstants.GT_BAR_3D%>"){
+ document.getElementById("animatedDiv").style.display="block";
+ } else if (selectedString == "<%=AppConstants.GT_PIE%>"){
+ document.getElementById("animatedDiv").style.display="block";
+ } else if (selectedString == "<%=AppConstants.GT_PIE_3D%>"){
+ document.getElementById("animatedDiv").style.display="block";
+ } else if (selectedString == "<%=AppConstants.GT_SCATTER%>"){
+ document.getElementById("animatedDiv").style.display="block";
+ } else
+ document.getElementById("animatedDiv").style.display="none";
+ return true;
+}
+function dataValidate() {
+ if(document.forma.maxLabelsInDomainAxis!="") {
+ var iVal = 0;
+ iVal = parseInt(document.forma.maxLabelsInDomainAxis.value);
+ if(isNaN(iVal)||iVal>100||iVal<=0) {
+ alert("Maximum Labels in Domain Axis must be a valid integer between 1 and 100 (or blank).\nPlease correct.");
+ document.forma.maxLabelsInDomainAxis.select();
+ document.forma.maxLabelsInDomainAxis.focus();
+ return;
+ } // if
+ document.forma.maxLabelsInDomainAxis.value = ""+iVal;
+ }
+
+ if(document.forma.chartWidth.value!="") {
+ var iVal = 0;
+ iVal = parseInt(document.forma.chartWidth.value);
+ if(isNaN(iVal)||iVal<100||iVal>1600) {
+ alert("Chart Width must be a valid integer between 100 and 1600 (or blank).\nPlease correct the Chart Width.");
+ document.forma.chartWidth.select();
+ document.forma.chartWidth.focus();
+ return;
+ } // if
+ document.forma.chartWidth.value = ""+iVal;
+ } // if
+ if(document.forma.chartHeight.value!="") {
+ var iVal = 0;
+ iVal = parseInt(document.forma.chartHeight.value);
+ if(isNaN(iVal)||iVal<100||iVal>1600) {
+ alert("Chart Height must be a valid integer between 100 and 1600 (or blank).\nPlease correct the Chart Height.");
+ document.forma.chartHeight.select();
+ document.forma.chartHeight.focus();
+ return;
+ } // if
+ document.forma.chartHeight.value = ""+iVal;
+ } // if
+<% if(chartValueCols.size()>1)
+ for(int ci=1; ci<chartValueCols.size(); ci++) {
+ for(int idx=ci+1; idx<chartValueCols.size()+1; idx++) { %>
+ if(document.forma.valueCol<%= ci %>.options[document.forma.valueCol<%= ci %>.selectedIndex].value==document.forma.valueCol<%= idx %>.options[document.forma.valueCol<%= idx %>.selectedIndex].value) {
+ alert("A column cannot be used as Chart Values Column more than once.");
+ document.forma.valueCol<%= idx %>.focus();
+ return false;
+ } // if
+<% } // for
+ }
+ if(isSQLBased) { %>
+ var selectBox = document.forma.chartType;
+ var selectedString = selectBox.options[selectBox.selectedIndex].value;
+ if(document.forma.chartType.selectedIndex>0) {
+ if(selectedString == "<%=AppConstants.GT_SCATTER%>" || selectedString == "<%=AppConstants.GT_REGRESSION%>") {
+ if(document.forma.chartSeries.selectedIndex<=0) {
+ alert (" Please choose category for this Chart Type." );
+ return false;
+ }
+ if (selectedString == "<%=AppConstants.GT_REGRESSION%>") {
+ if(document.forma && document.forma.LinearRegressionType) {
+ document.forma.regressionType.value = (document.forma.LinearRegressionType.checked?"Y":"N")+(document.forma.ExpRegressionType.checked?"Y":"N");
+ if (!checkNonNegativeFloat(document.forma.regressionPointCustomization.value)) {
+ alert("Please enter positive number for Customizing regression Point");
+ return false;
+ }
+
+ }
+ }
+ }
+
+ /* if (selectedString == "<%=AppConstants.GT_STACKED_VERT_BAR%>" || selectedString == "<%=AppConstants.GT_STACKED_HORIZ_BAR%>" || selectedString == "<%=AppConstants.GT_STACKED_VERT_BAR_LINES%>"
+ || selectedString == "<%=AppConstants.GT_STACKED_HORIZ_BAR_LINES%>") {
+ var selectSeries = document.forma.chartSeries;
+ var selectedSeriesString = selectSeries.options[selectSeries.selectedIndex].value;
+ if(selectedSeriesString == -1) {
+ alert("Please select category for Stacked Chart. This is Mandatory.");
+ return false;
+ }
+
+ } */
+
+ }
+
+ if (!checkNonNegativeFloat(document.forma.yAxisLowerLimit.value)) {
+ alert("Please enter positive number for Range Axis (Minimum Range) ");
+ return false;
+ }
+
+ if (!checkNonNegativeFloat(document.forma.yAxisUpperLimit.value)) {
+ alert("Please enter positive number for Range Axis (Maximum Range) ");
+ return false;
+ }
+
+ if(document.forma.chartType.selectedIndex>0)
+ return confirm("WARNING: Please make sure that the Values column contains only\nnumeric values, otherwise your chart will not be properly displayed.\nPress Ok to continue, or Cancel to re-examine the selection.");
+ <% } %>
+
+
+
+ return true;
+} // dataValidate
+//-->
+</script>
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_add_multi.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_add_multi.jsp
new file mode 100644
index 00000000..ab67b802
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_add_multi.jsp
@@ -0,0 +1,96 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
+<%@ page errorPage="error_page.jsp" %>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+%>
+<table class="mTAB" width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=3 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %> - <%= curSubStep %></b></td>
+ </tr>
+ <tr class=rbg1>
+ <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>&nbsp;&nbsp;No&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="79%"><b class=rtableheader>Column</b></td>
+ <td align="center" valign="Middle" width="14%">
+ <b class=rtableheader>Add To Report?</b>
+ <br>
+ <input type=checkbox name="selectAll" value="Y" onClick="setAllChk(this.checked);">
+ </td>
+ </tr>
+<% int icnt = 0;
+ String remoteDbPrefix = (String) session.getAttribute("remoteDB");
+ for(Iterator iter=rdef.getDataSourceList().getDataSource().iterator(); iter.hasNext(); ) {
+ DataSourceType dst = (DataSourceType) iter.next();
+
+ Vector dbColumns = DataCache.getReportTableDbColumns(dst.getTableName().toUpperCase(),remoteDbPrefix);
+ if(dbColumns!=null)
+ for(int i=0; i<dbColumns.size(); i++) {
+ DBColumnInfo dbCol = (DBColumnInfo) dbColumns.get(i);
+ icnt++; %>
+ <tr<%= (icnt%2==0)?" class=rowalt1":" class=rowalt2" %>>
+ <td align="center" height="30"><font class=rtabletext><%= icnt %></font></td>
+ <td><font class=rtabletext>[<%= dst.getDisplayName() %>].<%= dbCol.getLabel() %></font></td>
+ <td align="center" valign="middle">
+ <input type="checkbox" name="dataChk" onClick="document.forma.addColumn[<%= icnt-1 %>].value=(this.checked?'Y':'');">
+ <input type="hidden" name="addColumn" value="">
+ <input type="hidden" name="tableId" value="<%= dst.getTableId() %>">
+ <input type="hidden" name="columnName" value="<%= dbCol.getColName() %>">
+ <input type="hidden" name="columnType" value="<%= dbCol.getColType() %>">
+ <input type="hidden" name="displayName" value="<%= dbCol.getLabel() %>">
+ </td>
+ </tr>
+<% } // for i
+ } // for
+%>
+</table>
+ <input type="hidden" name="dataChk" value="">
+ <input type="hidden" name="dataChk" value="">
+ <input type="hidden" name="addColumn" value="">
+ <input type="hidden" name="addColumn" value="">
+<br>
+
+<script language="JavaScript">
+<!--
+function setAllChk(toSelected) {
+ for(var i=0; i<document.forma.addColumn.length-2; i++) {
+ document.forma.addColumn[i].value = (toSelected?"Y":"");
+ document.forma.dataChk[i].checked = toSelected;
+ } // for
+} // setAllChk
+
+function dataValidate() {
+ return true;
+} // dataValidate
+//-->
+</script>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_edit.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_edit.jsp
new file mode 100644
index 00000000..cc6b68b0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_edit.jsp
@@ -0,0 +1,1127 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@page import="java.util.Map"%>
+<%@page import="java.util.HashMap"%>
+<%@page import="org.openecomp.portalsdk.analytics.model.ReportLoader"%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="java.util.List" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
+ String dbInfo = null;
+ dbInfo = rdef.getDBInfo();
+ boolean isEdit = curSubStep.equals(AppConstants.WSS_EDIT) || curSubStep.equals(AppConstants.WA_MODIFY);
+ DataColumnType currColumn = null;
+ if(isEdit)
+ currColumn = rdef.getColumnById(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ Vector reportTableSources = DataCache.getReportTableSources((String) session.getAttribute("remoteDB"));
+
+ List reportCols = rdef.getAllColumns();
+
+ HashMap actionImgMap = ReportLoader.loadActionImgLookUp();
+
+ String[] numberFormats = { "9999999990", "9,999,999,990", "9999999990.99", "9,999,999,990.99", "$9,999,999,990.99", "$9,999,999,990.999" };
+ String[] dateFormats = { "MM/DD/YYYY", "MM/YYYY", "DD-MON-YYYY", "Month DD, YYYY", "Month, YYYY", "MM/DD/YYYY HH24:MI:SS", "YYYY" };
+ String[] charFormats = { "N/A" };
+
+ String dispName = "";
+ String dbColType = "";
+ String colType = "";
+ if(isEdit) {
+ dbColType = currColumn.getDbColType();
+ colType = currColumn.getColType();
+ }
+
+ String dependsOnFormField = currColumn.getDependsOnFormField();
+ %>
+<script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/editabledropdown.js"></script>
+<script language="JavaScript">
+<!--
+var tableDrillDownCount = 0;
+
+function verifyCrossTabDrillDown() {
+<% if(isCrossTab) { %>
+ if( (document.forma.crossTabValue.options[document.forma.crossTabValue.selectedIndex].value!="<%= AppConstants.CV_VALUE %>")
+ &&(document.forma.drillDownCtl.selectedIndex!=0)) {
+ alert("You cannot assign drill-down to this column unless the Column Usage in Cross-Tab is Report values.");
+ document.forma.drillDownURL.value = "";
+ document.forma.drillDownParams.value = "";
+ document.forma.drillDownSuppress.value = "";
+ document.forma.drillDownRequest.value = "";
+ document.forma.drillDownCtl.selectedIndex = 0;
+ return false;
+ }
+<% } %>
+ return true;
+} // verifyCrossTabDrillDown
+
+function showDrillDownPopup(resetParams) {
+ if(! verifyCrossTabDrillDown())
+ return;
+
+ if(resetParams) {
+ document.forma.drillDownParams.value = "";
+ document.forma.drillDownSuppress.value = "";
+ document.forma.drillDownRequest.value = "";
+ }
+
+ if(document.forma.drillDownCtl.selectedIndex==0) {
+ document.forma.drillDownURL.value = "";
+ return;
+ }
+
+ var ddValue = "";
+ ddValue = document.forma.drillDownCtl.options[document.forma.drillDownCtl.selectedIndex].value;
+
+ var url = "";
+ if(document.forma.drillDownCtl.selectedIndex<=tableDrillDownCount) {
+ document.forma.drillDownURL.value = ddValue;
+ url = "<%= AppUtils.getRaptorActionURL() %>report.popup.drilldown.table&<%= AppConstants.RI_VIEW_ACTION %>="+ddValue;
+ } else {
+ document.forma.drillDownURL.value = ddValue;
+ url = "<%= AppUtils.getRaptorActionURL() %>report.popup.drilldown.report&<%= AppConstants.RI_REPORT_ID %>="+ddValue+"&drillDownParams="+escape(document.forma.drillDownParams.value)+"&drillDownSuppress="+escape(document.forma.drillDownSuppress.value)+"&drillDownRequest="+escape(document.forma.drillDownRequest.value);
+ }
+ var w = window.open(url, "drillDownPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showArgPopup
+
+function setDrillDownValuesSuppress(newParams, newSuppress) {
+ document.forma.drillDownParams.value = newParams;
+ document.forma.drillDownSuppress.value = newSuppress;
+} // setDrillDownValuesSuppress
+
+function setDrillDownValues(newParams) {
+ setDrillDownValuesSuppress(newParams, "")
+} // setDrillDownValues
+
+function setTotalDropDownValues(canHaveTotal) {
+<% if(! isSQLBased) { %>
+ if(canHaveTotal) {
+ if(document.forma.displayTotal.options.length>1)
+ return;
+ } else {
+ if(document.forma.displayTotal.options.length==1)
+ return;
+ }
+
+ document.forma.displayTotal.options.length = 0;
+ document.forma.displayTotal.options[0] = new Option("--- Do Not Display (Faster Report Execution) ---", "");
+<% if(isCrossTab) { %>
+ document.forma.displayTotalPerRow.options.length = 0;
+ document.forma.displayTotalPerRow.options[0] = new Option("--- Do Not Display (Faster Report Execution) ---", "");
+<% } %>
+
+ if(canHaveTotal) {
+ <% for(int i=0; i<AppConstants.TOTAL_FUNCTIONS.getCount(); i++) {
+ IdNameValue tValue = AppConstants.TOTAL_FUNCTIONS.getValue(i); %>
+ document.forma.displayTotal.options[<%= (i+1) %>] = new Option("<%= tValue.getName() %>", "<%= tValue.getId() %>");
+ <% if(isCrossTab) { %>
+ document.forma.displayTotalPerRow.options[<%= (i+1) %>] = new Option("<%= tValue.getName() %>", "<%= tValue.getId() %>");
+ <% } %>
+ <% } // for
+ %>
+ } // if
+
+ document.forma.displayTotal.selectedIndex = 0;
+<% if(isCrossTab) { %>
+ document.forma.displayTotalPerRow.selectedIndex = 0;
+ if(document.layers)
+ history.go(0);
+<% } %>
+<% } // if(! isSQLBased)
+%>
+} // setTotalDropDownValues
+
+<% if(! isSQLBased) { %>
+<%--
+function showFormatPopup() {
+ if((document.forma.colType.value!="< %= AppConstants.CT_NUMBER % >")&&(document.forma.colType.value!="< %= AppConstants.CT_DATE % >")) {
+ alert("Display Format is not applicable to this column");
+ return;
+ }
+
+ var w = window.open("", "formatHint", "width=200,height=300,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+ w.document.writeln("<html><head>");
+ w.document.writeln("<title>Display Formats</title>");
+ //w.document.writeln("<link rel=stylesheet type=text/css href='< %= AppUtils.getBaseFolderURL() % >css/raptor.css'>");
+ w.document.writeln("<script language=JavaScript>");
+ w.document.writeln("function setValue(newValue) {");
+ w.document.writeln(" window.opener.document.forma.displayFormat.value=newValue;");
+ w.document.writeln(" window.close();");
+ w.document.writeln("} // setValue");
+ w.document.writeln("</"+"script>");
+ w.document.writeln("</head><body>");
+ if(document.forma.colType.value=="< %= AppConstants.CT_NUMBER % >") {
+ w.document.writeln("<font face='Arial, Helvetica, sans-serif' size=2><b>Number formats:</b></font><ul>");
+ w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('9999999990.99')\">9999999990.99</a></b></font></li>");
+ w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('9,999,999,990.99')\">9,999,999,990.99</a></b></font></li>");
+ w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('$9,999,999,990.99')\">$9,999,999,990.99</a></b></font></li>");
+ w.document.writeln("</ul>");
+ } else if(document.forma.colType.value=="< %= AppConstants.CT_DATE % >") {
+ w.document.writeln("<font face='Arial, Helvetica, sans-serif' size=2><b>Date formats:</b></font><ul>");
+ w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('MM/DD/YYYY')\">MM/DD/YYYY</a></b></font></li>");
+ w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('MM/YYYY')\">MM/YYYY</a></b></font></li>");
+ w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('DD-MON-YYYY')\">DD-MON-YYYY</a></b></font></li>");
+ w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('MONTH DD, YYYY')\">MONTH DD, YYYY</a></b></font></li>");
+ w.document.writeln("</ul>");
+ }
+ w.document.writeln("</body></html>");
+ w.document.close();
+} // showFormatPopup
+--%>
+
+function showFormFieldPopup() {
+ var w = window.open("", "fieldPopup", "width=400,height=400,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+
+ w.document.writeln("<html><head>");
+ w.document.writeln("<title>Form Fields</title>");
+ w.document.writeln("<link rel=stylesheet type=text/css href='<%= AppUtils.getBaseFolderURL() %>css/raptor.css'>");
+ w.document.writeln("<script language=JavaScript>");
+ w.document.writeln("function setValue(newValue) {");
+ w.document.writeln(" window.opener.document.forma.exprFormula.selectedIndex = 12;");
+ w.document.writeln(" window.opener.exprFormulaChange(true);");
+ w.document.writeln(" window.opener.document.forma.exprText.value += newValue;");
+ w.document.writeln(" window.close();");
+ w.document.writeln("} // setValue");
+ w.document.writeln("</"+"script>");
+ w.document.writeln("</head><body>");
+
+ w.document.writeln("<table width=94% border=0 cellspacing=1 align=center>");
+ w.document.writeln(" <tr class=rbg1>");
+ w.document.writeln(" <td height=30>&nbsp;</td>");
+ w.document.writeln(" <td><b class=rtableheader>Report Form Fields</b></td>");
+ w.document.writeln(" </tr>");
+<% int iCnt = 0;
+ if(rdef.getFormFieldList()!=null)
+ for(Iterator iter=rdef.getFormFieldList().getFormField().iterator(); iter.hasNext(); iCnt++) {
+ FormFieldType fft = (FormFieldType) iter.next(); %>
+ w.document.writeln(" <tr<%= (iCnt%2==0)?" class=rbg8":"" %>>");
+ w.document.writeln(" <td align=center valign=middle height=30><font class=rtabletext><%= (iCnt+1) %></font></td>");
+ w.document.writeln(" <td valign=middle>");
+ w.document.writeln(" <b class=rtabletext><a href=\"javascript:setValue('[<%= fft.getFieldName() %>]')\"><%= fft.getFieldName() %></a></b>");
+ w.document.writeln(" </td>");
+ w.document.writeln(" </tr>");
+<% } // for
+ if(iCnt==0) { %>
+ w.document.writeln(" <tr class=rbg3 height=30>");
+ w.document.writeln(" <td colspan=2 align=center valign=middle><b class=rtabletext>There are no form fields defined</b></td>");
+ w.document.writeln(" </tr>");
+ w.document.writeln(" <tr>");
+ w.document.writeln(" <td colspan=2 align=center><br><input type=Submit class=button value=Close onClick=\"window.close();\"></td>");
+ w.document.writeln(" </tr>");
+<% } else { %>
+ w.document.writeln(" <tr class=rbg1 height=30>");
+ w.document.writeln(" <td>&nbsp;</td>");
+ w.document.writeln(" <td>&nbsp;</td>");
+ w.document.writeln(" </tr>");
+<% } // if
+%>
+ w.document.writeln("</table>");
+
+ w.document.writeln("</body></html>");
+ w.document.close();
+} // showFormFieldPopup
+
+function exprFormulaChange(handleText) {
+ var exprValue = "";
+ exprValue = document.forma.exprFormula.options[document.forma.exprFormula.selectedIndex].value;
+
+ if(handleText)
+ if(exprValue!='_exprText_') {
+ document.forma.exprText.value = '';
+ document.forma.exprText.disabled = true;
+ } else
+ document.forma.exprText.disabled = false;
+
+ var oldColType = "";
+ oldColType = document.forma.colType.value;
+
+ if((exprValue=="")||(exprValue=="MAX(")||(exprValue=="MIN(")||(exprValue=="_exprText_"))
+ document.forma.colType.value = document.forma.dbColType.value;
+ else
+ document.forma.colType.value = "<%= AppConstants.CT_NUMBER %>";
+
+ if(document.forma.colType.value!=oldColType) {
+ // Updating displayFormat select list
+ document.forma.displayFormat.options.length = 0;
+
+ if(document.forma.colType.value=="<%= AppConstants.CT_NUMBER %>") {
+ <% for(int i=0; i<numberFormats.length; i++) { %>
+ document.forma.displayFormat.options[<%= i %>] = new Option("<%= numberFormats[i] %>", "<%= numberFormats[i] %>");
+ <% } %>
+ } else if(document.forma.colType.value=="<%= AppConstants.CT_DATE %>") {
+ <% for(int i=0; i<dateFormats.length; i++) { %>
+ document.forma.displayFormat.options[<%= i %>] = new Option("<%= dateFormats[i] %>", "<%= dateFormats[i] %>");
+ <% } %>
+ } else {
+ <% for(int i=0; i<charFormats.length; i++) { %>
+ document.forma.displayFormat.options[<%= i %>] = new Option("<%= charFormats[i] %>", "<%= charFormats[i].equals("N/A")?"":charFormats[i] %>");
+ <% } %>
+ } // else
+
+ document.forma.displayFormat.selectedIndex = 0;
+<% if(! isCrossTab) { %>
+ setTotalDropDownValues(document.forma.colType.value=="<%= AppConstants.CT_NUMBER %>");
+<% } %>
+ if(document.layers)
+ history.go(0);
+ } // if
+} // exprFormulaChange
+
+<% if(! isEdit) { %>
+function columnDetailsChange() {
+ var selText = "";
+ selText = document.forma.columnDetails.options[document.forma.columnDetails.selectedIndex].text;
+ document.forma.displayName.value = selText.substr(selText.indexOf('.')+1);
+
+ var selValue = "";
+ selValue = document.forma.columnDetails.options[document.forma.columnDetails.selectedIndex].value;
+ document.forma.dbColType.value = selValue.substr(selValue.lastIndexOf('|')+1);
+
+ exprFormulaChange(false);
+
+ document.forma.displayFormat.selectedIndex = 0;
+} // columnDetailsChange
+<% } %>
+
+function showMapPopup() {
+ var colType = document.forma.colType.value;
+ var displayName = document.forma.displayName.value;
+ var displayFormat = document.forma.displayFormat.options[document.forma.displayFormat.selectedIndex].value;
+<% if(isEdit) { %>
+ var colName = "<%= currColumn.getDbColName() %>";
+ var tableId = "<%= rdef.getColumnTableById(currColumn.getColId()).getTableId() %>";
+<% } else { %>
+ var selValue = "";
+ selValue = document.forma.columnDetails.options[document.forma.columnDetails.selectedIndex].value;
+ var colName = selValue.substr(selValue.indexOf('|')+1, selValue.lastIndexOf('|')-selValue.indexOf('|')-1);
+ var tableId = selValue.substr(0, selValue.indexOf('|'));
+<% } %>
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.map&colName="+colName+"&colType="+colType+"&displayName="+escape(displayName)+"&displayFormat="+escape(displayFormat)+"&tableId="+tableId, "mapPopup", "width=400,height=400,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showMapPopup
+<% } // if(! isSQLBased)
+%>
+
+function verifyCrossTabSemaphore() {
+<% if(isCrossTab) { %>
+ if( (document.forma.crossTabValue.options[document.forma.crossTabValue.selectedIndex].value!="<%= AppConstants.CV_VALUE %>")
+ &&(document.forma.semaphore.selectedIndex!=0)) {
+ alert("You cannot assign Advanced Formatting to this column unless the Column Usage in Cross-Tab is Report values.");
+ document.forma.semaphore.selectedIndex = 0;
+ return false;
+ }
+<% } %>
+ return true;
+} // verifyCrossTabSemaphore
+
+function showSemaphorePopup() {
+ var semaphoreId = "";
+ semaphoreId = document.forma.semaphore.options[document.forma.semaphore.selectedIndex].value;
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.semaphore&semaphoreId="+semaphoreId, "semaphorePopup", "width=720,height=400,location=no,menubar=no,toolbar=no,status=yes,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showSemaphorePopup
+
+function updateSemaphoreList(semId, semName) { // Returns the position of the current semaphore in the list
+ var lSize = 0;
+ var selIdx = 0;
+ lSize = document.forma.semaphore.options.length;
+ selIdx = document.forma.semaphore.selectedIndex;
+ for(var i=0; i<lSize; i++)
+ if(document.forma.semaphore.options[i].value==semId) {
+ if(document.forma.semaphore.options[i].text!=semName) {
+ document.forma.semaphore.options[i] = new Option(semName, semId);
+ document.forma.semaphore.selectedIndex = selIdx;
+ } // if
+
+ return i;
+ } // if
+
+ document.forma.semaphore.options[lSize] = new Option(semName, semId);
+ return lSize;
+} // updateSemaphoreList
+
+function showSemaphoreImportPopup() {
+ if(document.forma.drillDownCtl.selectedIndex==0||document.forma.drillDownCtl.selectedIndex<=tableDrillDownCount) {
+ alert("You need to select a report from the list, and then click this button\n"+
+ "to import all the Advanced Display Formattings from selected report into\n"+
+ "this report. No Advanced Display Formattings have been imported.");
+ return;
+ } // if
+
+ var ddValue = "";
+ ddValue = document.forma.drillDownCtl.options[document.forma.drillDownCtl.selectedIndex].value;
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.import.semaphore&<%= AppConstants.RI_REPORT_ID %>="+ddValue, "semaphoreImportPopup", "width=400,height=250,location=no,menubar=no,toolbar=no,status=yes,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showSemaphoreImportPopup
+
+function showImageOptions() {
+ var selectionType= document.forma.anchor.options[document.forma.anchor.selectedIndex].value;
+ if (selectionType == "IMAGE") {
+ //document.getElementById("imageSelectionDiv").style.display='block';
+ } else {
+ document.getElementById("imageSelectionDiv").style.display='none';
+ }
+}
+
+function showDisplayFormats() {
+
+ var colType= document.forma.colType.options[document.forma.colType.selectedIndex].value;
+ if (colType == "<%=AppConstants.CT_HYPERLINK%>") {
+ document.getElementById("dataFormatDiv").style.display='none';
+ //document.getElementById("hyperlinkDiv").style.display='block';
+ } else {
+ document.getElementById("hyperlinkDiv").style.display='none';
+ //document.getElementById("dataFormatDiv").style.display='block';
+ }
+ var dataFormat = document.forma.colDataFormat;
+ dataFormat.options.length = 0;
+
+ dataFormat.options[dataFormat.options.length] = new Option('Select', -1);
+ if (colType == "<%=AppConstants.CT_NUMBER%>") {
+ dataFormat.options[dataFormat.options.length] = new Option('9999999990','9999999990');
+ dataFormat.options[dataFormat.options.length] = new Option('9,999,999,990','9,999,999,990');
+ dataFormat.options[dataFormat.options.length] = new Option('9999999990.99','9999999990.99');
+ dataFormat.options[dataFormat.options.length] = new Option('9,999,999,990.99','9,999,999,990.99');
+ dataFormat.options[dataFormat.options.length] = new Option('$9,999,999,990.99','$9,999,999,990.99');
+ dataFormat.options[dataFormat.options.length] = new Option('$9,999,999,990.999','$9,999,999,990.999');
+ var lSize = dataFormat.options.length;
+ for(var i=0; i<lSize; i++) {
+ if(dataFormat.options[i].value=="<%=currColumn.getColFormat()%>") {
+ dataFormat.options[i].selected = true;
+ }
+ }
+ if(document.getElementById("filterDateColumn")) document.getElementById("filterDateColumn").style.display = "none";
+
+ }
+ if (colType == "<%=AppConstants.CT_DATE%>") {
+ dataFormat.options[dataFormat.options.length] = new Option('MM/DD/YYYY','MM/DD/YYYY');
+ dataFormat.options[dataFormat.options.length] = new Option('MM/YYYY','MM/YYYY');
+ dataFormat.options[dataFormat.options.length] = new Option('DD-MON-YYYY','DD-MON-YYYY');
+ dataFormat.options[dataFormat.options.length] = new Option('Month DD, YYYY','Month DD, YYYY');
+ dataFormat.options[dataFormat.options.length] = new Option('Month, YYYY','Month, YYYY');
+ dataFormat.options[dataFormat.options.length] = new Option('MM/DD/YYYY HH24:MI:SS','MM/DD/YYYY HH24:MI:SS');
+ dataFormat.options[dataFormat.options.length] = new Option('YYYY/MM/DD HH24:MI:SS','YYYY/MM/DD HH24:MI:SS');
+ dataFormat.options[dataFormat.options.length] = new Option('YYYY','YYYY');
+ var lSize = dataFormat.options.length;
+ for(var i=0; i<lSize; i++) {
+ if(dataFormat.options[i].value=="<%=currColumn.getColFormat()%>") {
+ dataFormat.options[i].selected = true;
+ }
+ }
+ //if(document.getElementById("filterDateColumn")) document.getElementById("filterDateColumn").style.display = "block";
+
+ }
+ if (colType == "<%=AppConstants.CT_CHAR%>") {
+ dataFormat.options[dataFormat.options.length] = new Option('N/A','N/A');
+ if(document.getElementById("filterDateColumn")) document.getElementById("filterDateColumn").style.display = "none";
+ }
+
+
+}
+//-->
+</script>
+
+<table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %> - <%= curSubStep %></b></td>
+ </tr>
+<% if(isSQLBased) { %>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30" style="background-image:url(<%= AppUtils.getImgFolderURL() %>required.gif); background-position:top right; background-repeat:no-repeat;"><font class=rtabletext>Column ID: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <%= currColumn.getColId() %>
+ </font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30" style="background-position:top right; background-repeat:no-repeat;"><font class=rtabletext>Depends on formfield: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <input type="text" style="width: 200px;" name="dependsOnFormField" value="<%= nvl(dependsOnFormField,"")%>"></input> </tr>
+<% } // if(! isSQLBased)
+%>
+<% if(isCrossTab) { %>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30" style="background-image:url(<%= AppUtils.getImgFolderURL() %>required.gif); background-position:top right; background-repeat:no-repeat;"><font class=rtabletext>Column Usage in Cross-Tab: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <select name="crossTabValue"onChange="setTotalDropDownValues(this.options[this.selectedIndex].value=='<%= AppConstants.CV_VALUE %>')">
+ <option value="<%= AppConstants.CV_ROW %>"<%= isEdit?(nvl(currColumn.getCrossTabValue()).equals(AppConstants.CV_ROW)?" selected":""):" selected" %>><%= rdef.getCrossTabDisplayValue(AppConstants.CV_ROW) %>
+ <option value="<%= AppConstants.CV_COLUMN %>"<%= (isEdit&&nvl(currColumn.getCrossTabValue()).equals(AppConstants.CV_COLUMN))?" selected":"" %>><%= rdef.getCrossTabDisplayValue(AppConstants.CV_COLUMN) %>
+ <option value="<%= AppConstants.CV_VALUE %>"<%= (isEdit&&nvl(currColumn.getCrossTabValue()).equals(AppConstants.CV_VALUE))?" selected":"" %>><%= rdef.getCrossTabDisplayValue(AppConstants.CV_VALUE) %>
+ <option value=""<%= (isEdit&&(nvl(currColumn.getCrossTabValue()).length()==0))?" selected":"" %>>Invisible/Filter
+ </select></font></td>
+ </tr>
+<% } %>
+<% if(! isSQLBased) { %>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30" style="background-image:url(<%= AppUtils.getImgFolderURL() %>required.gif); background-position:top right; background-repeat:no-repeat;"><font class=rtabletext>Table Column: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <% if(isEdit) { %>
+ <%= nvl(rdef.getColumnLabel(currColumn), currColumn.getDbColName()) /*currColumn.getColName()*/ %>
+ <% } else { %>
+ <select name="columnDetails" onChange="columnDetailsChange();">
+<% int icnt = 0;
+ String remoteDbPrefix = dbInfo;
+ for(Iterator iter=rdef.getDataSourceList().getDataSource().iterator(); iter.hasNext(); ) {
+ DataSourceType dst = (DataSourceType) iter.next();
+
+ Vector dbColumns = DataCache.getReportTableDbColumns(dst.getTableName().toUpperCase(),remoteDbPrefix);
+ if(dbColumns!=null)
+ for(int i=0; i<dbColumns.size(); i++) {
+ DBColumnInfo dbCol = (DBColumnInfo) dbColumns.get(i);
+ //if(dst.getTableName().toUpperCase().equals(dbCol.getTableName())) {
+%>
+ <option value="<%= dst.getTableId() %>|<%= dbCol.getColName() %>|<%= dbCol.getColType() %>"<%= (icnt==0)?" selected":"" %>>[<%= dst.getDisplayName() %>].<%= dbCol.getLabel() %>
+<% if(icnt==0) {
+ dispName = dbCol.getLabel();
+ dbColType = dbCol.getColType();
+ colType = dbColType;
+ }
+ icnt++;
+ //} // if
+ } // for
+ } // for
+%>
+ </select>
+ <% } %>
+ <input type="hidden" name="dbColType" value="<%= dbColType %>">
+ <input type="hidden" name="colType" value="<%= colType %>">
+ </font></td>
+ </tr>
+<% } // if(! isSQLBased)
+%>
+
+<% if(isSQLBased) { %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Datatype: </font></td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <select name="colType" style="width: 100px;" onChange="showDisplayFormats();">
+ <option value="0"> Select</option>
+ <option value="<%=AppConstants.CT_NUMBER%>" <%=currColumn.getColType().equals(AppConstants.CT_NUMBER)?" selected": ""%>> Number </option>
+ <option value="<%=AppConstants.CT_DATE%>" <%=currColumn.getColType().equals(AppConstants.CT_DATE)?" selected": ""%>> Date</option>
+ <option value="<%=AppConstants.CT_CHAR%>" <%=currColumn.getColType().equals(AppConstants.CT_CHAR)?" selected": ""%>> Character</option>
+ <option value="<%=AppConstants.CT_HYPERLINK%>" <%=currColumn.getColType().equals(AppConstants.CT_HYPERLINK)?" selected": ""%>> Hyperlink</option>
+ </select>
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Group By Pos: </font></td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <select name="groupByPos" style="width: 100px;">
+ <option value="0"> Select</option>
+ <option value="1" <%=(currColumn.getGroupByPos()!=null && currColumn.getGroupByPos()==1)?" selected": ""%>> 1 </option>
+ </select>
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Custom Text for Sub-Total: </font></td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <font class=rtabletext>
+ <input type="text" size="30" maxlength="500" style="width: 100px;" class=rtabletext name="subTotalCustomText" value="<%= isEdit?(currColumn.getSubTotalCustomText()!=null?currColumn.getSubTotalCustomText():"Sub Total"):"Sub Total" %>"/>
+ </font>
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Hide Repeated Values : </font></td>
+ <td class=rbg3 width="50%" align="left" nowrap><font class=rtabletext>
+ <input type="checkbox" name="hideRepeatedKeys" value="Y" <%=(currColumn.isHideRepeatedKey()!=null && currColumn.isHideRepeatedKey().booleanValue())?" checked":"" %>>
+ </font>
+ </td>
+ </tr>
+
+
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Multi group Column Level: </font></td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <select name="multiGroupColLevel" style="width: 100px;">
+ <option value="0"> Select</option>
+ <option value="-1" <%=(currColumn.getLevel()!=null && currColumn.getLevel()==-1)?" selected": ""%>> AUXILIARY-COLUMN </option>
+ <option value="1" <%=(currColumn.getLevel()!=null && currColumn.getLevel()==1)?" selected": ""%>> 1 </option>
+ <option value="2" <%=(currColumn.getLevel()!=null && currColumn.getLevel()==2)?" selected": ""%>> 2 </option>
+ <option value="3" <%=(currColumn.getLevel()!=null && currColumn.getLevel()==3)?" selected": ""%>> 3 </option>
+ <option value="4" <%=(currColumn.getLevel()!=null && currColumn.getLevel()==4)?" selected": ""%>> 4 </option>
+ </select>
+ </font>
+ </td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Multi group Column Range : </font>
+ <font class=rtabletext>Colspan : </font>
+ </td>
+ <td class=rbg3 align="left" nowrap>
+ <font class=rtabletext>
+ <input type="text" size="30" style="width: 100px;" maxlength="500" class=rtabletext name="colspan" value="<%= isEdit?(currColumn.getColspan()!=null?currColumn.getColspan():""):"" %>"/>
+
+ </font>
+ </td>
+ </tr>
+
+ <tr id ="dataFormatDiv">
+ <td colspan="2" class=rbg2>
+ <table width="100%" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg2 width="25%" align="right" height="30"><font class=rtabletext>Dataformat: </font></td>
+ <td class=rbg3 width="50%" align="left" nowrap><font class=rtabletext>
+ <select name="colDataFormat" style="width: 100px;">
+ </select>
+ </font>
+ </td>
+ </tr>
+ <% if(!isCrossTab) { %>
+ <tr id="filterDateColumn">
+ <td class=rbg2 width="25%" align="right" height="30"><font class=rtabletext>Enhanced Pagination: </font></td>
+ <td class=rbg3 width="50%" align="left" nowrap><font class=rtabletext>
+ <input type="checkbox" name="enhancedPagination" value="Y" <%=(currColumn.isEnhancedPagination()!=null && currColumn.isEnhancedPagination().booleanValue())?" checked":"" %> />
+ </font>
+ </td>
+ </tr>
+ <%} %>
+
+ </table>
+ </td>
+ </tr>
+ <tr id ="hyperlinkDiv">
+ <td colspan="2">
+ <table width="100%" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg2 width="25%" align="right" height="30"><font class=rtabletext>URL: </font></td>
+ <td class=rbg3 width="50%" align="left" nowrap><font class=rtabletext>
+ <input type="text" size="30" maxlength="500" class=rtabletext name="hyperlinkURL" value="<%= isEdit?currColumn.getHyperlinkURL():"" %>"/>
+ </font>
+ </td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 width="25%" align="right" height="30"><font class=rtabletext>Anchor: </font></td>
+ <td class=rbg3 width="50%" align="left" nowrap><font class=rtabletext>
+ <select name="anchor" onChange="showImageOptions()">
+ <option value="0"> Select</option>
+ <option value="VALUE" <%=nvl(currColumn.getHyperlinkType()).equals("VALUE")?" selected": ""%>> Value Of the Column </option>
+ <option value="IMAGE" <%=nvl(currColumn.getHyperlinkType()).equals("IMAGE")?" selected": ""%>> IMAGE</option>
+ </select>
+ </font>
+ </td>
+ </tr>
+ <tr id="imageSelectionDiv" style="display:none;">
+ <td class=rbg2 width="25%" height="30" align="right">
+ <font class=rtabletext>Select Image for anchor: </font>
+ </td>
+ <td width="50%" align="left">
+ <font class=rtabletext>
+ <select id = "actionImg" name="actionImg" >
+ <option value=''> <!-- SELECT --></option>
+ <%
+ if(!actionImgMap.isEmpty()) {
+ for( Iterator itr=actionImgMap.entrySet().iterator(); itr.hasNext(); ) {
+ Map.Entry e = (Map.Entry)itr.next();
+ String image_id = (String)e.getKey();
+ String image_loc = (String)e.getValue();
+ %>
+ <%
+ if (nvl(AppUtils.getRequestNvlValue(request, "actionImg")).length()>0 && !(AppUtils.getRequestNvlValue(request, "pdfImg").equals(currColumn.getActionImg())) ) {
+ if(image_loc .equals (AppUtils.getRequestNvlValue(request, "actionImg"))) {
+ %>
+
+ <option value='<%= image_loc %>' selected> <%=image_id %></option>
+ <%
+ } else {
+ %>
+ <option value='<%= image_loc %>'> <%=image_id %></option>
+ <%
+ }
+ } else {
+ if(image_loc .equals (currColumn.getActionImg())) {
+ %>
+
+ <option value='<%= image_loc %>' selected> <%=image_id %> </option>
+ <%
+
+ } else {
+ %>
+ <option value='<%= image_loc %>'> <%=image_id %></option>
+ <%
+ }
+ }
+ %>
+
+ <% }
+ }
+ %>
+ </select>
+ </font>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+<% } %>
+ <tr>
+ <td class=rbg2 align="right" height="30" style="background-image:url(<%= AppUtils.getImgFolderURL() %>required.gif); background-position:top right; background-repeat:no-repeat;"><font class=rtabletext>Display Name: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <input type="text" style="width: 100px;" size="30" maxlength="60" class=rtabletext name="displayName" value="<%= isEdit?currColumn.getDisplayName():dispName %>"></font></td>
+ </tr>
+<% if(! isSQLBased) { %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Display Format: </font></td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <!--input type="text" size="20" maxlength="30" name="displayFormat" value="< %= isEdit?nvl(currColumn.getColFormat()):"" % >" onFocus="blur();"></font>
+ <a href="javascript:showFormatPopup()"><img border="0" src="<%= AppUtils.getImgFolderURL() %>shareicon.gif" alt="Select from list" width="12" height="12"></a-->
+ <select name="displayFormat" style="width: 100px;" >
+ <% String[] fmt;
+ if(colType.equals(AppConstants.CT_NUMBER))
+ fmt = numberFormats;
+ else if(colType.equals(AppConstants.CT_DATE))
+ fmt = dateFormats;
+ else
+ fmt = charFormats;
+ for(int i=0; i<fmt.length; i++) { %>
+ <option value="<%= fmt[i].equals("N/A")?"":(fmt[i].startsWith("Month")?("fm"+fmt[i]):fmt[i]) %>"<%= (isEdit&&(nvl(currColumn.getColFormat()).toUpperCase().equals(fmt[i].toUpperCase())||("fm"+nvl(currColumn.getColFormat())).toUpperCase().equals(fmt[i].toUpperCase())))?" selected":"" %>><%= fmt[i] %>
+ <% } %>
+ </select></font></td>
+ </tr>
+<% } // if(! isSQLBased)
+%>
+
+<% if (false) { %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Display Width: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <% if (currColumn.getDisplayWidth()<=0) { currColumn.setDisplayWidth(10); } %>
+ <select name="displayWidth" style="width: 100px;" onKeyDown="fnKeyDownHandler(this, event);" onKeyUp="fnKeyUpHandler_A(this, event); return false;" onKeyPress = "return fnKeyPressHandler_A(this, event);" onChange="fnChangeHandler_A(this, event);">
+ <option value="" style="COLOR:#ff0000;BACKGROUND-COLOR:#ffff00;">Custom</option> <!-- This is the Editable Option -->
+ <option value="10"<%= (isEdit&&(currColumn.getDisplayWidth()<=0 || currColumn.getDisplayWidth()==10))?"":" selected" %>>10%
+ <option value="20"<%= (isEdit&&(currColumn.getDisplayWidth()==20))?" selected":"" %>>20%
+ <option value="30"<%= (isEdit&&(currColumn.getDisplayWidth()==30))?" selected":"" %>>30%
+ <option value="40"<%= (isEdit&&(currColumn.getDisplayWidth()==40))?" selected":"" %>>40%
+ <option value="50"<%= (isEdit&&(currColumn.getDisplayWidth()==50))?" selected":"" %>>50%
+ <option value="60"<%= (isEdit&&(currColumn.getDisplayWidth()==60))?" selected":"" %>>60%
+ <option value="70"<%= (isEdit&&(currColumn.getDisplayWidth()==70))?" selected":"" %>>70%
+ <option value="80"<%= (isEdit&&(currColumn.getDisplayWidth()==80))?" selected":"" %>>80%
+ <option value="90"<%= (isEdit&&(currColumn.getDisplayWidth()==90))?" selected":"" %>>90%
+ <option value="100"<%= (isEdit&&(currColumn.getDisplayWidth()==100))?" selected":"" %>>100%
+ <% if(!((currColumn.getDisplayWidth()%10 == 0) && (currColumn.getDisplayWidth() > 100)) ) {
+ %>
+ <option value="<%=currColumn.getDisplayWidth()%>" selected><%=currColumn.getDisplayWidth()%>%</option>
+ <%
+ }
+ %>
+
+ </select></font></td>
+ </tr>
+ <% } %>
+ <% System.out.println("WidthInPxls " + currColumn.getDisplayWidthInPxls()); %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Display Width (In Pxls): </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <input type="text" style="width: 100px;" class="rtabletext" size="40" maxlength="100" id="widthInPxls" name="widthInPxls" value="<%= (nvl(AppUtils.getRequestNvlValue(request, "widthInPxls")).length() > 0)?
+ (!(AppUtils.getRequestNvlValue(request, "widthInPxls").equals(currColumn.getDisplayWidthInPxls()))?
+ AppUtils.getRequestNvlValue(request, "widthInPxls"):currColumn.getDisplayWidthInPxls()):
+ currColumn.getDisplayWidthInPxls() %>">
+
+</font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>No Wrap ? </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="nowrap" style="width: 100px;" >
+ <option value="Y"<%= isEdit?(nvl(currColumn.getNowrap(),"N").startsWith("Y")?" selected":(!nvl(currColumn.getNowrap(),"False").startsWith("N") && org.openecomp.portalsdk.analytics.system.Globals.IsGlobalNoWrap()?" selected": "")):"" %>>Yes
+ <option value="N"<%= (isEdit&&(nvl(currColumn.getNowrap(),"False").startsWith("N")))?" selected":"" %>>No
+ </select></font></td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 height="30" align="right"><font class=rtabletext>Indent Parameter to display value </font>
+ </td>
+ <td class=rbg3 align="left">
+ <select name="indentation" style="width: 100px;" >
+ <option value="0"> Select</option>
+ <option value="1" <%= AppUtils.getRequestNvlValue(request, "indentation").equals("1") ? " selected":((AppUtils.getRequestNvlValue(request, "indentation").length()<=0)?(currColumn.getIndentation()!=null && currColumn.getIndentation().intValue()==1?" selected":""):"") %>> 1 </option>
+ <option value="2" <%= AppUtils.getRequestNvlValue(request, "indentation").equals("2") ? " selected":((AppUtils.getRequestNvlValue(request, "indentation").length()<=0)?(currColumn.getIndentation()!=null && currColumn.getIndentation().intValue()==2?" selected":""):"") %>> 2 </option>
+ <option value="3" <%= AppUtils.getRequestNvlValue(request, "indentation").equals("3") ? " selected":((AppUtils.getRequestNvlValue(request, "indentation").length()<=0)?(currColumn.getIndentation()!=null && currColumn.getIndentation().intValue()==3?" selected":""):"") %>> 3 </option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Display Alignment: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="displayAlign" style="width: 100px;" >
+ <option value="Left"<%= isEdit?(nvl(currColumn.getDisplayAlignment(), "Left").equals("Left")?" selected":""):" selected" %>>Left
+ <option value="Center"<%= (isEdit&&nvl(currColumn.getDisplayAlignment()).equals("Center"))?" selected":"" %>>Center
+ <option value="Right"<%= (isEdit&&nvl(currColumn.getDisplayAlignment()).equals("Right"))?" selected":"" %>>Right
+ </select></font></td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Display (Header) Alignment: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="displayHeaderAlign" style="width: 100px;" >
+ <option value="Left"<%= isEdit?(nvl(currColumn.getDisplayHeaderAlignment(), "Left").equals("Left")?" selected":""):" selected" %>>Left
+ <option value="Center"<%= (isEdit&&nvl(currColumn.getDisplayHeaderAlignment()).equals("Center"))?" selected":"" %>>Center
+ <option value="Right"<%= (isEdit&&nvl(currColumn.getDisplayHeaderAlignment()).equals("Right"))?" selected":"" %>>Right
+ </select></font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Sortable? </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="sortable" style="width: 100px;" >
+ <option value="N"<%= isEdit?((currColumn.isIsSortable()!=null && !currColumn.isIsSortable())?" selected":""):" selected" %>>No
+ <option value="Y"<%= (isEdit&&currColumn.isIsSortable()!=null && currColumn.isIsSortable())?" selected":"" %>>Yes
+ </select></font></td>
+ </tr>
+
+
+ <% if(! isCrossTab) { %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Visible? </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="visible" style="width: 100px;" >
+ <option value="Y"<%= isEdit?(currColumn.isVisible()?" selected":""):" selected" %>>Yes
+ <option value="N"<%= (isEdit&&(! currColumn.isVisible()))?" selected":"" %>>No
+ </select></font></td>
+ </tr>
+ <% if(! isSQLBased) { %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Group By? </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="groupBreak" style="width: 100px;" >
+ <option value="Y"<%= (isEdit&&currColumn.isGroupBreak())?" selected":"" %>>Yes
+ <option value="N"<%= isEdit?(currColumn.isGroupBreak()?"":" selected"):" selected" %>>No
+ </select></font></td>
+ </tr>
+ <% } %>
+ <% } %>
+ <!--tr class=rbg2>
+ <td class=rbg2 height="30" align="right" width="25%"><font face="Arial, Helvetica, sans-serif" size="1" class=rtabletext>Column Type </font></td>
+ <td align="left" width="50%" class=rbg3><font face="Arial, Helvetica, sans-serif" size="1" class=rtabletext>
+ <select name="calculated">
+ <option value="N"< %= (isEdit&&currColumn.isCalculated())?"":" selected" % >>Table Column
+ <option value="Y"< %= (isEdit&&currColumn.isCalculated())?" selected":"" % >>Expression
+ </select></font></td>
+ </tr-->
+ <% if(! isSQLBased) { %>
+<%
+boolean isOtherExpr = isEdit&&currColumn.isCalculated()&&
+ (! nvl(currColumn.getColName()).startsWith("SUM( "))&&
+ (! nvl(currColumn.getColName()).startsWith("MAX( "))&&
+ (! nvl(currColumn.getColName()).startsWith("MIN( "))&&
+ (! nvl(currColumn.getColName()).startsWith("COUNT(*)"))&&
+ (! nvl(currColumn.getColName()).startsWith("COUNT(ALL "))&&
+ (! nvl(currColumn.getColName()).startsWith("COUNT(DISTINCT "))&&
+ (! nvl(currColumn.getColName()).startsWith("AVG(ALL "))&&
+ (! nvl(currColumn.getColName()).startsWith("AVG(DISTINCT "))&&
+ (! nvl(currColumn.getColName()).startsWith("STDDEV(ALL "))&&
+ (! nvl(currColumn.getColName()).startsWith("STDDEV(DISTINCT "))&&
+ (! nvl(currColumn.getColName()).startsWith("VARIANCE(ALL "))&&
+ (! nvl(currColumn.getColName()).startsWith("VARIANCE(DISTINCT "));
+%>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Expression: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="exprFormula" onChange="exprFormulaChange(true);" style="width: 100px;" >
+ <option value=""<%= (isEdit&&currColumn.isCalculated())?"":" selected" %>>
+ <option value="SUM("<%= (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("SUM( "))?" selected":"" %>>Sum
+ <option value="MAX("<%= (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("MAX( "))?" selected":"" %>>Max
+ <option value="MIN("<%= (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("MIN( "))?" selected":"" %>>Min
+ <option value="COUNT(*)"<%= (isEdit&&currColumn.isCalculated()&&(nvl(currColumn.getColName()).startsWith("COUNT(*)")||nvl(currColumn.getColName()).startsWith("COUNT(ALL ")))?" selected":"" %>>Count All
+ <option value="COUNT(DISTINCT"<%= (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("COUNT(DISTINCT "))?" selected":"" %>>Count Distinct
+ <option value="AVG(ALL"<%= (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("AVG(ALL "))?" selected":"" %>>Average All
+ <option value="AVG(DISTINCT"<%= (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("AVG(DISTINCT "))?" selected":"" %>>Average Distinct
+ <option value="STDDEV(ALL"<%= (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("STDDEV(ALL "))?" selected":"" %>>Standard Deviation All
+ <option value="STDDEV(DISTINCT"<%= (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("STDDEV(DISTINCT "))?" selected":"" %>>Standard Deviation Distinct
+ <option value="VARIANCE(ALL"<%= (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("VARIANCE(ALL "))?" selected":"" %>>Variance All
+ <option value="VARIANCE(DISTINCT"<%= (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("VARIANCE(DISTINCT "))?" selected":"" %>>Variance Distinct
+ <option value="_exprText_"<%= isOtherExpr?" selected":"" %>>---------- Other ----------
+ </select></font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Expression Other: </font></td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <input type="text" size="30" name="exprText"<%= isOtherExpr?" value=\""+nvl(currColumn.getColName())+"\"":" value=\"\" disabled" %> onFocus="if(document.forma.exprFormula.options[document.forma.exprFormula.selectedIndex].value!='_exprText_') blur();"></font>
+ <a href="javascript:showMapPopup()"><img border="0" src="<%= AppUtils.getImgFolderURL() %>shareicon.gif" alt="Define custom values mapping" width="12" height="12"></a>&nbsp;
+ <a href="javascript:showFormFieldPopup()"><font class=rtabletext>Form Fields</font></a>
+ </td>
+ </tr>
+<% } // if(! isSQLBased)
+%>
+<%-- if(! isCrossTab) { --%>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Drill-down Link: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <input type="hidden" name="drillDownURL" value="<%= isEdit?nvl(currColumn.getDrillDownURL()):"" %>">
+ <input type="hidden" name="drillDownParams" value="<%= isEdit?nvl(currColumn.getDrillDownParams()):"" %>">
+ <input type="hidden" name="drillDownSuppress" value="<%= isEdit?nvl(currColumn.getDrillDownType()):"" %>">
+ <input type="hidden" name="drillDownRequest" value="<%= isEdit?getRequestParam(currColumn.getDrillDownParams()):"" %>">
+ <input type="hidden" name="drillDownPopUp" value="<%= isEdit?(currColumn.isDrillinPoPUp()!=null?currColumn.isDrillinPoPUp():""):"" %>">
+ <select name="drillDownCtl" onChange="showDrillDownPopup(true)" style="width: 300px;" >
+ <option value=""<%= (isEdit&&nvl(currColumn.getDrillDownURL()).length()>0)?"":" selected" %>>----- No Drill-down -----
+ <% int tableDrillDownCount = 0;
+ if(! isCrossTab)
+ for(int i=0; i<reportTableSources.size(); i++) {
+ TableSource tableSource = (TableSource) reportTableSources.get(i);
+ if(nvl(tableSource.getViewAction()).length()>0&&rdef.getTableByDBName(tableSource.getTableName())!=null) {
+ tableDrillDownCount++; %>
+ <option value="<%= tableSource.getViewAction() %>"<%= (isEdit&&nvl(currColumn.getDrillDownURL()).equals(AppUtils.getBaseActionURL()+tableSource.getViewAction()))?" selected":"" %>><%= tableSource.getDisplayName() %> Record Details
+ <% } // if
+ } // for
+
+ Vector publicReportIdNames = DataCache.getPublicReportIdNames();
+ for(int i=0; i<publicReportIdNames.size(); i++) {
+ IdNameValue reportIdName = (IdNameValue) publicReportIdNames.get(i); %>
+ <option value="<%= reportIdName.getId() %>"<%= (isEdit&&nvl(currColumn.getDrillDownURL()).equals(reportIdName.getId()))?" selected":"" %>>Public Report: <%= reportIdName.getName() %>
+ <% } %>:
+
+ <%
+ //if(!AppUtils.isSuperUser(request)) {
+ Vector groupReportIdNames = DataCache.getGroupAccessibleReportIdNames(AppUtils.getUserID(request),AppUtils.getUserRoles(request));
+ for(int j=0; j<groupReportIdNames.size(); j++) {
+ IdNameValue reportIdName = (IdNameValue) groupReportIdNames.get(j); %>
+ <option value="<%= reportIdName.getId() %>"<%= (isEdit&&nvl(currColumn.getDrillDownURL()).equals(reportIdName.getId()))?" selected":"" %>>Group Report: <%= reportIdName.getName() %>
+ <% } %>
+ <%// }
+ %>
+ <%
+ //if(!AppUtils.isSuperUser(request)) {
+ Vector privateReportIdNames = DataCache.getPrivateAccessibleReportIdNames(AppUtils.getUserID(request),AppUtils.getUserRoles(request));
+ for(int j=0; j<privateReportIdNames.size(); j++) {
+ IdNameValue reportIdName = (IdNameValue) privateReportIdNames.get(j); %>
+ <option value="<%= reportIdName.getId() %>"<%= (isEdit&&nvl(currColumn.getDrillDownURL()).equals(reportIdName.getId()))?" selected":"" %>>Private Report: <%= reportIdName.getName() %>
+ <% } %>
+ <% // }
+%>
+ </select></font>
+ <a href="javascript:showDrillDownPopup(false)"><img border="0" src="<%= AppUtils.getImgFolderURL() %>shareicon.gif" alt="Set new parameters configuration" width="12" height="12"></a>
+ &nbsp;&nbsp;
+ <a href="javascript:showSemaphoreImportPopup()"><img border="0" src="<%= AppUtils.getImgFolderURL() %>lookup_arrow.gif" alt="Import advanced formatting from selected report" width="17" height="17"></a>
+ </td>
+ </tr>
+<script language="JavaScript">
+<!--
+ tableDrillDownCount = <%= tableDrillDownCount %>;
+//-->
+</script>
+ <% String curSemId = "";
+ if(isEdit)
+ curSemId = nvl(currColumn.getSemaphoreId()); %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Advanced Display Formatting: </font></td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <select name="semaphore"" onChange="verifyCrossTabSemaphore()" style="width: 300px;" >
+ <option value=""<%= (curSemId.length()==0)?" selected":"" %>>----- Do Not Use Advanced Formatting -----
+ <% if(rdef.getSemaphoreList()!=null)
+ for(Iterator iter=rdef.getSemaphoreList().getSemaphore().iterator(); iter.hasNext(); ) {
+ SemaphoreType semaphore = (SemaphoreType) iter.next(); %>
+ <option value="<%= semaphore.getSemaphoreId() %>"<%= curSemId.equals(semaphore.getSemaphoreId())?" selected":"" %>><%= semaphore.getSemaphoreName() %>
+ <% } // for
+ %>
+ </select></font>
+ <input type="hidden" name="semaphoreTypeHidden" value=""/>
+ <a href="javascript:showSemaphorePopup()"><img border="0" src="<%= AppUtils.getImgFolderURL() %>shareicon.gif" alt="Define advanced formatting" width="12" height="12"></a>
+ </td>
+ </tr>
+<%-- } --%>
+
+<% boolean canHaveTotal = false;
+ if(isSQLBased) {
+ //canHaveTotal = (! isCrossTab);
+ canHaveTotal = (!isCrossTab)||(isEdit&&nvl(currColumn.getCrossTabValue()).equals(AppConstants.CV_VALUE));
+ } else {
+ if(isCrossTab)
+ canHaveTotal = (isEdit&&nvl(currColumn.getCrossTabValue()).equals(AppConstants.CV_VALUE));
+ else
+ canHaveTotal = colType.equals(AppConstants.CT_NUMBER);
+ }
+
+ String colTotalRow = "";
+ String colTotal = isEdit?nvl(currColumn.getDisplayTotal()):"";
+ if(isCrossTab&&colTotal.indexOf('|')>=0) {
+ colTotalRow = colTotal.substring(colTotal.indexOf('|')+1);
+ colTotal = colTotal.substring(0, colTotal.indexOf('|'));
+ } %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Total for <%= isCrossTab?"each":"the" %> column: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="displayTotal" style="width: 300px;" >
+ <option value=""<%= (colTotal.length()>0)?"":" selected" %>>--- Do Not Display (Faster Report Execution) ---
+ <% if(canHaveTotal) {
+ for(int i=0; i<AppConstants.TOTAL_FUNCTIONS.getCount(); i++) {
+ IdNameValue tValue = AppConstants.TOTAL_FUNCTIONS.getValue(i); %>
+ <option value="<%= tValue.getId() %>"<%= (colTotal.startsWith(tValue.getId()))?" selected":"" %>><%= tValue.getName() %>
+ <% } // for
+ } // if
+ %>
+ </select></font></td>
+ </tr>
+<% if(isCrossTab) { %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Total for each row </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="displayTotalPerRow">
+ <option value=""<%= (colTotalRow.length()>0)?"":" selected" %>>--- Do Not Display (Faster Report Execution) ---
+ <% if(canHaveTotal) {
+ for(int i=0; i<AppConstants.TOTAL_FUNCTIONS.getCount(); i++) {
+ IdNameValue tValue = AppConstants.TOTAL_FUNCTIONS.getValue(i); %>
+ <option value="<%= tValue.getId() %>"<%= (colTotalRow.startsWith(tValue.getId()))?" selected":"" %>><%= tValue.getName() %>
+ <% } // for
+ } // if
+ %>
+ </select></font></td>
+ </tr>
+<% } // if(isCrossTab)
+%>
+<% if(isSQLBased) { %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>&nbsp; </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <input type="Checkbox" name="no_parse_date" value="Y"<%= (isEdit&&rdef.getColumnNoParseDateFlag(currColumn))?" checked":"" %>>
+ Do not attempt to parse values as date</font></td>
+ </tr>
+<% } %>
+</table>
+<br>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+<% if(isCrossTab) {
+ /*if(rdef.getCrossTabColColumns().size()>0) {
+ // Col headings column already defined
+ }*/ %>
+
+ if(document.forma.crossTabValue.options[document.forma.crossTabValue.selectedIndex].value=="<%= AppConstants.CV_VALUE %>") {
+<% DataColumnType valueCol = rdef.getCrossTabValueColumn();
+ if((valueCol!=null)&&((currColumn==null)||(! currColumn.getColId().equals(valueCol.getColId())))) {
+ // Report data column already defined
+%>
+ alert("There is a column already designated for the report values.\nYou cannot have more than one column for that purpose.\nPlease change the Column Usage in Cross-Tab.");
+ document.forma.crossTabValue.focus();
+
+ return false;
+<% } else if(! isSQLBased) { %>
+ if(document.forma.exprFormula.selectedIndex==0) {
+ alert("The column designated for the report values must be an expression.\nPlease change the Column Type and select Expression.");
+ document.forma.exprFormula.focus();
+
+ return false;
+ }
+<% } %>
+ } else {
+ verifyCrossTabDrillDown();
+ verifyCrossTabSemaphore();
+ }
+<% } %>
+
+if(document.forma.displayWidth!=null && document.forma.displayWidth.options.selectedIndex == 0) {
+ if(!checkNonNegativeInteger(document.forma.displayWidth.options[document.forma.displayWidth.options.selectedIndex].text)) {
+ alert("Please enter positive number greater than 1% in \"Display Width\". No Characters are allowed.");
+ return false;
+ } else {
+/* if(eval(document.forma.displayWidth.options[document.forma.displayWidth.options.selectedIndex].text) < 10) {
+ alert("Please enter positive number less than 10% in \"Desired Container Height\". No Characters are allowed.");
+ return false;
+ }
+*/
+ if(eval(document.forma.displayWidth.options[document.forma.displayWidth.options.selectedIndex].text) > 100) {
+ alert("Please enter positive number less than 100% in \"Display Width\". No Characters are allowed.");
+ return false;
+ }
+ document.forma.displayWidth.options[document.forma.displayWidth.options.selectedIndex].value=document.forma.displayWidth.options[document.forma.displayWidth.options.selectedIndex].text;
+ }
+}
+
+ if(document.forma.displayName.value=="")
+ <% if(isEdit) { %>
+ document.forma.displayName.value = "<%= currColumn.getDisplayName() %>";
+ <% } else { %>
+ document.forma.displayName.value = document.forma.tableName.options[document.forma.tableName.selectedIndex].text.substr(document.forma.tableName.options[document.forma.tableName.selectedIndex].text.indexOf('.')+1);
+ <% } %>
+
+<% if(reportCols.size()>0) { %>
+ if(false
+<% for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dc = (DataColumnType) iter.next();
+
+ if(! (isEdit&&dc.getColId().equals(currColumn.getColId()))) { %>
+ ||(document.forma.displayName.value=="<%= dc.getDisplayName() %>")
+<% }
+ } %>
+ ) {
+ alert("A column with display name "+document.forma.displayName.value+" already exists.\nPlease select another name.");
+ document.forma.displayName.focus();
+ document.forma.displayName.select();
+
+ return false;
+ }
+<% } %>
+
+ return true;
+} // dataValidate
+//-->
+showDisplayFormats();
+showImageOptions();
+</script>
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+ private String getRequestParam(String s) {
+ if(nvl(s).equals("")) return s;
+ else {
+ String requestParam="";
+ int pos = 0;
+ int iCnt = 0;
+ while(s.indexOf("#",pos)!=-1) {
+ iCnt++;
+ if(iCnt>1) requestParam += "|";
+ pos = s.indexOf("#",pos)+1;
+ requestParam += s.substring(s.indexOf("#")+1,s.indexOf("]",pos));
+ }
+ return requestParam;
+ }
+
+ }
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_list.jsp
new file mode 100644
index 00000000..454cf7d5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_list.jsp
@@ -0,0 +1,157 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
+%>
+<table class=mTAB width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=<%= isSQLBased?"5":"7" %> valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+ <tr class=rbg1>
+ <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>&nbsp;&nbsp;No&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="58%"><b class=rtableheader>Column</b></td>
+<% if(isSQLBased) { %>
+ <td align="center" valign="Middle" width="7%"><b class=rtableheader>ID</b></td>
+ <% if(isCrossTab) { %>
+ <td align="center" valign="Middle" width="14%"><b class=rtableheader>Cross-Tab Usage</b></td>
+ <% } %>
+ <td align="center" valign="Middle" width="7%"<%= isCrossTab?"":" colspan=2" %>><b class=rtableheader>Edit</b></td>
+<% } else { %>
+ <% if(isCrossTab) { %>
+ <td align="center" valign="Middle" width="14%" colspan=2><b class=rtableheader>Cross-Tab Usage</b></td>
+ <% } else { %>
+ <td align="center" valign="Middle" width="7%"><b class=rtableheader>Group By</b></td>
+ <td align="center" valign="Middle" width="7%"><b class=rtableheader>Visible</b></td>
+ <% } %>
+ <td align="center" valign="Middle" width="7%"><b class=rtableheader>Re-order</b></td>
+ <td align="center" valign="Middle" width="14%" colspan=2 nowrap>
+ <% if(isCrossTab) { %>
+ <input type="button" class=button value="Add" border="0" width="104" height="28" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD %>';document.forma.submit();">
+ <% } else { %>
+ <table border="0" cellspacing="0" cellpadding="0"><tr>
+ <td height="28"><input type="button" class=button value="Add One" border="0" width="104" height="28" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD %>';document.forma.submit()"></td>
+ </tr><tr>
+ <td height="28"><input type="button" class=button value="Add Multiple" border="0" width="104" height="28" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_MULTI %>';document.forma.submit()"></td>
+ </tr><tr>
+ <td height="28"><input type="button" class=button value="Re-order All" border="0" width="104" height="28" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ORDER_ALL %>';document.forma.submit()"></td>
+ </tr></table>
+ <% } %>
+ </td>
+<% } %>
+ </tr>
+<% int iCount = 0;
+ boolean visibleColExist = false;
+ boolean rowColExist = false;
+ boolean colColExist = false;
+ boolean valColExist = false;
+ List reportCols = rdef.getAllColumns();
+ for(Iterator iter=reportCols.iterator(); iter.hasNext(); iCount++) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if(dct.isVisible())
+ visibleColExist = true;
+ if(nvl(dct.getCrossTabValue()).equals(AppConstants.CV_ROW))
+ rowColExist = true;
+ if(nvl(dct.getCrossTabValue()).equals(AppConstants.CV_COLUMN))
+ colColExist = true;
+ if(nvl(dct.getCrossTabValue()).equals(AppConstants.CV_VALUE))
+ valColExist = true; %>
+ <tr class=<%=(iCount % 2 == 0)?"rowalt1":"rowalt2"%>>
+ <td align="center" height="30"><font class=rtabletext><%= iCount+1 %><!--dct.getOrderSeq(): <%= dct.getOrderSeq() %>--></font></td>
+ <td><font class=rtabletext><%= dct.getDisplayName() %></font></td>
+<% if(isSQLBased) { %>
+ <td align="center"><font class=rtabletext><%= dct.getColId() %></font></td>
+ <% if(isCrossTab) { %>
+ <td align="center"><font class=rtabletext><%= nvl(rdef.getCrossTabDisplayValue(dct), "&nbsp;") %></font></td>
+ <% } %>
+ <td align="center"<%= isCrossTab?"":" colspan=2" %>><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>pen_paper.gif" alt="Edit" width="12" height="12" onClick="document.getElementById('<%= AppConstants.RI_WIZARD_ACTION %>').value='<%= AppConstants.WA_MODIFY %>'; document.getElementById('<%= AppConstants.RI_DETAIL_ID %>').value='<%= dct.getColId() %>'; document.forma.submit();"></td>
+<% } else { %>
+ <% if(isCrossTab) { %>
+ <td align="center" colspan=2><font class=rtabletext><%= nvl(rdef.getCrossTabDisplayValue(dct), "&nbsp;") %></font></td>
+ <% } else { %>
+ <td align="center"><font class=rtabletext><%= dct.isGroupBreak()?"Yes":"&nbsp;" %></font></td>
+ <td align="center"><font class=rtabletext><%= dct.isVisible()?"Yes":"No" %></font></td>
+ <% } %>
+ <td align="center" nowrap>
+ <% if(iCount==0) { %>
+ <img border="0" src="<%= AppUtils.getImgFolderURL() %>columnblankdown.gif" width="25" height="7">
+ <% } else { %>
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>columnup.gif" width="25" height="7" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_MOVE_UP %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dct.getColId() %>';">
+ <% } %>
+ <% if(iCount==reportCols.size()-1) { %>
+ <img border="0" src="<%= AppUtils.getImgFolderURL() %>columnblankup.gif" width="25" height="7">
+ <% } else { %>
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>columndown.gif" width="25" height="7" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_MOVE_DOWN %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dct.getColId() %>';">
+ <% } %>
+ </td>
+ <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>pen_paper.gif" alt="Edit" width="12" height="12" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_EDIT %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dct.getColId() %>'; document.forma.submit();"></td>
+ <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! confirm('Are you sure you want to remove column <%= dct.getDisplayName() %>?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dct.getColId() %>'; document.forma.submit();}"></td>
+<% } %>
+ </tr>
+<% } %>
+<% if(iCount==0) { %>
+ <tr class=rbg2>
+ <td colspan=<%= isSQLBased?"5":"7" %> align="center" height="30"><font class=rtabletext>No columns defined</font></td>
+ </tr>
+<% } %>
+</table>
+<br>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+<% if(isCrossTab) {
+ if(! rowColExist) { %>
+ alert("You must have at least one column used for cross-tab row headings in the report.\nPlease add a column.");
+ return false;
+ <% } else if(! colColExist) { %>
+ alert("You must have at least one column used for cross-tab column headings in the report.\nPlease add a column.");
+ return false;
+ <% } else if(! valColExist) { %>
+ alert("You must have at least one column used for cross-tab report values in the report.\nPlease add a column.");
+ return false;
+ <% } else { %>
+ return true;
+ <% }
+ } else {
+ if(visibleColExist) { %>
+ return true;
+ <% } else { %>
+ alert("You must have at least one visible column in the report.\nPlease add a column.");
+ return false;
+ <% }
+ } %>
+} // dataValidate
+//-->
+</script>
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_order_all.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_order_all.jsp
new file mode 100644
index 00000000..fc1870c6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_order_all.jsp
@@ -0,0 +1,88 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
+%>
+
+<table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=4 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %> - <%= curSubStep %></b></td>
+ </tr>
+ <tr class=rbg1>
+ <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>&nbsp;&nbsp;No&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="65%"><b class=rtableheader>Column</b></td>
+ <td align="center" valign="Middle" width="14%"><b class=rtableheader>Re-order To<br>Position</b></td>
+ </tr>
+<% int icnt = 0;
+ for(Iterator iter=rdef.getAllColumns().iterator(); iter.hasNext(); icnt++) {
+ DataColumnType dct = (DataColumnType) iter.next(); %>
+ <tr<%= (icnt%2==0)?" class=rbg8":"" %>>
+ <td align="center" height="30"><font class=rtabletext><%= icnt+1 %></font></td>
+ <td><font class=rtabletext><%= dct.getDisplayName() %></font></td>
+ <td align="center" valign="middle">
+ <input type="hidden" name="colId" value="<%= dct.getColId() %>">
+ <input type="text" size="5" maxlength="5" name="colOrder" value="<%= dct.getOrderSeq() %>">
+ </td>
+ </tr>
+<% } // for
+%>
+</table>
+ <input type="hidden" name="colOrder" value="">
+ <input type="hidden" name="colOrder" value="">
+<br>
+
+<script language="JavaScript">
+<!--
+var colNames = new Array(<%= rdef.getAllColumns().size() %>);
+<% for(int i=0; i<rdef.getAllColumns().size(); i++) {
+ DataColumnType dct = (DataColumnType) rdef.getAllColumns().get(i); %>
+colNames[<%= i %>] = "<%= dct.getDisplayName() %>";
+<% } %>
+
+function dataValidate() {
+ var val = "";
+ for(var i=0; i<document.forma.colOrder.length; i++) {
+ val = document.forma.colOrder[i].value;
+ if(val!="")
+ if(! checkPositiveInteger(val)) {
+ alert("Order Position for column "+colNames[i]+" should be a positive integer.\nPlease enter a valid value.");
+ document.forma.colOrder[i].focus();
+ document.forma.colOrder[i].select();
+
+ return false;
+ } // if
+ } // for
+
+ return true;
+} // dataValidate
+//-->
+</script>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_data_forecasting.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_data_forecasting.jsp
new file mode 100644
index 00000000..33cabe7e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_data_forecasting.jsp
@@ -0,0 +1,184 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.ArrayList" %>
+<%@ page import="java.util.HashMap" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.ReportWrapper" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %>
+<%@ page import="java.text.SimpleDateFormat"%>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+ String reportID = rdef.getReportID();
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ //boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
+ String dependsOnHelp = "Custom SQL can be defined";
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED_DATAMIN);
+
+ String classifiers = nvl(rdef.getClassifier());
+ System.out.println(classifiers);
+ List reportCols = rdef.getAllColumns();
+
+ String dateAttrColId = null;
+ DataColumnType dct = null;
+
+ HashMap<String, DataColumnType> unusedNumColsMap = new HashMap<String,DataColumnType>();
+ int numColsCount = 0;
+ Iterator iter = null;
+
+ for(iter=reportCols.iterator(); iter.hasNext(); ) {
+ dct = (DataColumnType) iter.next();
+
+ if(nvl(dct.getDataMiningCol()).equals(AppConstants.DM_DATE_ATTR))
+ dateAttrColId = dct.getColId();
+
+ if(isSQLBased||nvl(dct.getColType()).equals(AppConstants.CT_NUMBER)) {
+ numColsCount++;
+ if(nvl(dct.getDataMiningCol()).length()==0)
+ unusedNumColsMap.put(dct.getColId(), dct);
+ } // if
+ }
+
+ String[] fmt = { "Default", "MM/DD/YYYY", "MM/YYYY", "DD-MON-YYYY", "Month DD, YYYY", "Month, YYYY" };
+%>
+
+<table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 align="right" width="10%" height="30"><font class=rtabletext>Classifiers: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="classifiers">
+ <option value="" <%= classifiers.equals("")?" selected":"" %>>--- Choose Classifiers ---
+ <option value="<%= AppConstants.DM_SVM_CLASSIFIER%>" <%= classifiers.equals(AppConstants.DM_SVM_CLASSIFIER)?" selected":"" %>>SMOreg
+ <option value="<%= AppConstants.DM_GAUSSIAN_CLASSIFIER%>" <%= classifiers.equals(AppConstants.DM_GAUSSIAN_CLASSIFIER)?" selected":"" %>>Gaussian Process
+ </select></font>
+ </td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Date Attribute: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <select name="timeAttribute">
+ <% for(iter=reportCols.iterator(); iter.hasNext(); ) {
+ dct = (DataColumnType) iter.next(); %>
+ <option value="<%= dct.getColId() %>"<%= nvl(dateAttrColId /*, firstColId*/).equals(dct.getColId())?" selected":"" %>><%= dct.getDisplayName() %>
+ <% } %>
+ </select></font></td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Date Format: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <select name="timeFormat">
+ <% for(int i=0; i<fmt.length; i++) { %>
+ <option value="<%= fmt[i].equals("N/A")?"":fmt[i] %>"<%= (nvl(rdef.getForecastingTimeFormat()).equals(fmt[i].toUpperCase()))?" selected":"" %>><%= fmt[i] %>
+ <% } %>
+ </select>
+ </font></td>
+ </tr>
+
+
+ <tr>
+ <td class=rbg2 align="center" colspan="2" height="30"><font class=rtabletext>Forecasting Column:</font></td>
+ </tr>
+
+ <% for(iter=reportCols.iterator(); iter.hasNext(); ) {
+ dct = (DataColumnType) iter.next();
+ if(!nvl(dct.getDataMiningCol()).equals(AppConstants.DM_DATE_ATTR) ) {
+
+ %>
+ <tr>
+ <td class=rbg3 align="right" width="50%"><font class=rtabletext>
+
+ <% if (! unusedNumColsMap.containsKey(dct.getColId()) ) { %>
+ <% if (!dct.getDataMiningCol().equals(AppConstants.DM_DATE_ATTR)) %>
+ <input name="forecastCol" type="checkbox" value="<%=dct.getColId() %>" checked></font></td><td class=rbg3 align="left"> <%=dct.getColName() %> </td>
+ <% } else if(isSQLBased||nvl(dct.getColType()).equals(AppConstants.CT_NUMBER)) { %>
+ <input name="forecastCol" type="checkbox" value="<%=dct.getColId() %>"></font></td> <td class=rbg3 align="left"> <%=dct.getColName() %> </td>
+ <% } %>
+
+
+
+ </tr>
+ <% } %>
+ <% } %>
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Forecasting Period: </font>
+ </td>
+ <td class=rbg3 align="left">
+ <select name="forecastingPeriod" onKeyDown="fnKeyDownHandler(this, event);" onKeyUp="fnKeyUpHandler_A(this, event); return false;" onKeyPress = "return fnKeyPressHandler_A(this, event);" onChange="fnChangeHandler_A(this, event);">
+ <option value="-1" style="COLOR:#ff0000;BACKGROUND-COLOR:#ffff00;">Custom</option> <!-- This is the Editable Option -->
+ <option value="2"<%= (rdef.getForecastingPeriod()==2 )?" selected":"" %>>2
+ <option value="4"<%= (rdef.getForecastingPeriod()==4 )?" selected":"" %>>4
+ <option value="6"<%= (rdef.getForecastingPeriod()==6 )?" selected":"" %>>6
+ <option value="8"<%= (rdef.getForecastingPeriod()==8)?" selected":"" %>>8
+ <option value="10"<%= (rdef.getForecastingPeriod()==10)?" selected":"" %>>10
+ <option value="20"<%= (rdef.getForecastingPeriod()==20)?" selected":"" %>>20
+ <option value="25"<%= (rdef.getForecastingPeriod()==25)?" selected":"" %>>25
+ <option value="30"<%= (rdef.getForecastingPeriod()==30)?" selected":"" %>>30
+ </select>
+ </td>
+ </tr>
+
+</table>
+
+<script language="JavaScript">
+ function dataValidate() {
+ return true;
+ } // dataValidate
+</script>
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+ private boolean isNumber(String value) { // As per Raptor def, like
+
+ // -$3,270.56
+ value = value.trim();
+ if(value.length()>2) return false;
+ for (int i = 0; i < value.length(); i++) {
+ char c = value.charAt(i);
+ if (!(Character.isDigit(c) || c == '.' || c == '-' || c == '+' || c == ','
+ || c == '$' || c == '%'))
+ return false;
+ } // for
+
+ return true;
+ } // isNumber
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_definition.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_definition.jsp
new file mode 100644
index 00000000..ec61e3fd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_definition.jsp
@@ -0,0 +1,1122 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%--
+ Name: wizard_definition.jsp
+ Use : Shows edit page of the meta information of the report.
+
+ Change Log
+ ==========
+
+ 14-Jul-2009 : Version 8.4 (Sundar);
+
+ <UL>
+ <LI> Schedule functionality is available for Dashboard.</LI>
+ </UL>
+--%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="java.util.HashMap" %>
+<%@ page import="java.util.Map" %>
+<%@ page import="java.util.Set" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.Reports"%>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+ String reportID = rdef.getReportID();
+ String dbInfo = null;
+ dbInfo = rdef.getDBInfo();
+ HashMap hashMap = ReportLoader.loadReportsToAddInDashboard(request);
+ Set mapSet = hashMap.entrySet();
+ Map.Entry me;
+
+ HashMap pdfImgMap = ReportLoader.loadPDFImgLookUp();
+%>
+<% /*boolean displayAdditionalFields = AppUtils.getRequestNvlValue(request, "showAdditionalFields").equals("Y")||
+ AppUtils.getRequestNvlValue(request, "additionalFieldsShown").equals("Y")||
+ rdef.isRuntimeColSortDisabled()||
+ rdef.isDisplayOptionHideForm()||
+ rdef.isDisplayOptionHideChart()||
+ rdef.isDisplayOptionHideData()||
+ rdef.isDisplayOptionHideBtns()||
+ (rdef.getNumFormColsAsInt()>1)||
+ (nvl(rdef.getReportTitle()).length()>0)||
+ (nvl(rdef.getReportSubTitle()).length()>0)||
+ (nvl(rdef.getReportHeader()).length()>0)||
+ (nvl(rdef.getReportFooter()).length()>0); */%>
+
+
+<%
+ boolean displayDashboard = false;
+ /*displayDashboard = AppUtils.getRequestNvlValue(request, "showDashboardOptions").equals("Y")||
+ AppUtils.getRequestNvlValue(request, "dashboardOptionsShown").equals("Y")||
+ rdef.isDashboardOptionHideBtns()||
+ rdef.isDashboardOptionHideChart()||
+ rdef.isDashboardOptionHideData();
+ */
+ //displayDashboard = AppUtils.getRequestNvlValue(request, "showDashboardOptions").equals("Y");
+ boolean dashboard = rdef.isDashboardType();
+ //if(AppUtils.getRequestNvlValue(request, "showDashboardOptions").length()>0) dashboard=displayDashboard;
+%>
+<script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/script.js"></script>
+<script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/raptor.js"></script>
+<script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/editabledropdown.js"></script>
+
+<script type="text/javascript" language="JavaScript">
+<!-- Copyright 2006,2007 Bontrager Connection, LLC
+// http://bontragerconnection.com/ and http://willmaster.com/
+// Version: July 28, 2007
+var cX = 0; var cY = 0; var rX = 0; var rY = 0;
+function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
+function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
+if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
+else { document.onmousemove = UpdateCursorPosition; }
+function AssignPosition(d) {
+if(self.pageYOffset) {
+ rX = self.pageXOffset;
+ rY = self.pageYOffset;
+ }
+else if(document.documentElement && document.documentElement.scrollTop) {
+ rX = document.documentElement.scrollLeft;
+ rY = document.documentElement.scrollTop;
+ }
+else if(document.body) {
+ rX = document.body.scrollLeft;
+ rY = document.body.scrollTop;
+ }
+if(document.all) {
+ cX += rX;
+ cY += rY;
+ }
+d.style.left = (cX+10) + "px";
+d.style.top = (cY+10) + "px";
+}
+function HideContent(d) {
+if(d.length < 1) { return; }
+document.getElementById(d).style.display = "none";
+}
+function HideAllContent() {
+ var uniquearrays = new Array();
+ uniquearrays[0] = "uniquename1";
+ uniquearrays[1] = "uniquename2";
+ uniquearrays[2] = "uniquename3";
+ uniquearrays[3] = "uniquename4";
+
+ for (i=0;i<uniquearrays.length;i++) {
+ document.getElementById(uniquearrays[i]).style.display = "none";
+ }
+}
+function ShowContent(d) {
+ var uniquearrays = new Array();
+ uniquearrays[0] = "uniquename1";
+ uniquearrays[1] = "uniquename2";
+ uniquearrays[2] = "uniquename3";
+ uniquearrays[3] = "uniquename4";
+
+ for (i=0;i<uniquearrays.length;i++) {
+ //if(uniquearrays[i]==d) {
+ document.getElementById(uniquearrays[i]).style.display = "none";
+ //}
+ }
+if(d.length < 1) { return; }
+var dd = document.getElementById(d);
+AssignPosition(dd);
+dd.style.display = "block";
+}
+function ShowContentWAssign(d) {
+if(d.length < 1) { return; }
+var dd = document.getElementById(d);
+dd.style.display = "block";
+}
+function ReverseContentDisplay(d) {
+if(d.length < 1) { return; }
+var dd = document.getElementById(d);
+AssignPosition(dd);
+if(dd.style.display == "none") { dd.style.display = "block"; }
+else { dd.style.display = "none"; }
+}
+//var popupwin ;
+function showPreview(src)
+{
+ try{
+
+ //if(popupwin != null){popupwin.focus();popupwin.close();}
+ /*
+ var ww = 300, hh = 300;
+ var LeftPosition = (screen.width) ? (screen.width-ww)/2 : 0;
+ var TopPosition = (screen.height) ? (screen.height-hh)/2 : 0;
+ var popupwin = window.open ('about:blank',"fusionPopupWindow","menubar=0,resizable=0,height="+hh+",width="+ww+",top="+TopPosition+",left="+LeftPosition+",scrollbars=yes");
+
+
+ popupwin.document.write('<html><body align=center>');
+ popupwin.document.write('<style>table{border-width:thin; border-color:black}');
+ popupwin.document.write('</style>');
+
+ popupwin.document.write($('dashboardPreview').value);
+ popupwin.document.write('</body></html>');
+
+ popupwin.document.title = 'Preview';
+ popupwin.focus();
+ */
+
+ if($('PreviewButton').value == 'Preview')
+ {
+ $('tempHidden').innerHTML = $('editingArea').innerHTML;
+
+ $('editingArea').innerHTML = $('dashboardPreview').value;
+
+ $('PreviewButton').value = 'Edit';
+ }else if($('PreviewButton').value == 'Edit')
+ {
+ $('editingArea').innerHTML = $('tempHidden').innerHTML;
+ $('PreviewButton').value = 'Preview';
+
+ }
+ }catch(e){alert(e.message);}
+ return false;
+
+}
+
+function insertAtCursor(myField, myValue) {
+ //IE support
+ if (document.selection) {
+ myField.focus();
+ sel = document.selection.createRange();
+ sel.text = myValue;
+ }
+ //MOZILLA/NETSCAPE support
+ else if (myField.selectionStart || myField.selectionStart == '0') {
+ var startPos = myField.selectionStart;
+ var endPos = myField.selectionEnd;
+ myField.value = myField.value.substring(0, startPos)
+ + myValue
+ + myField.value.substring(endPos, myField.value.length);
+ } else {
+ myField.value += myValue;
+ }
+ }
+
+
+function udpateTemplate(val)
+{
+ $('dashboardPreview').value = layoutTemplates[val];
+}
+function addType(type)
+{
+ try{
+
+ //alert($('dashboardTemplateReports').selectedIndex);
+
+ if($('dashboardTemplateReports').selectedIndex == 0){ return; }
+
+ insertAtCursor($('dashboardPreview'),'['+type+'#'+$('dashboardTemplateReports').value+']');
+
+ }catch(e){alert(e.message);}
+ return false;
+}
+var layoutTemplates = {
+ "empty": " ",
+ "2x2": "<table border=1 width='100%' height='100%'><tr><td>[Report]</td><td>[Report]</td></tr><tr><td>[Report]</td><td>[Report]</td></tr></table>",
+ "2x1": "<table border=1 width='100%' height='100%'><tr><td>[Report]</td></tr><tr><td>[Report]</td></tr></table>",
+ "1x2": "<table border=1 width='100%' height='100%'><tr><td>[Report]</td><td>[Report]</td></tr></table>",
+ "3x1": "<table border=1 width='100%' height='100%'><tr><td>[Report]</td></tr><tr><td>[Report]</td></tr><tr><td>[Report]</td></tr></table>",
+ "custom1": "<table border=1 width='100%' height='100%'><tr><td colspan='2'>[Report]</td></tr><tr><td>[Report]</td><td>[Report]</td></tr></table>",
+ "custom2": "<table border=1 width='100%' height='100%'><tr rowspan='2'><td>[Report]</td></tr><tr><td>[Report]</td><td>[Report]</td></tr></table>",
+ "custom3": "<table border=1 width='100%' height='100%'><tr><td>[Report]</td></tr><tr><td>[Report]</td></tr></table>"
+}
+//-->
+</script>
+<script type="text/javascript">
+ function show(object,val) {
+ document.getElementById(object).style.visibility = val;
+ }
+</script>
+<table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+ <% if(nvl(rdef.getReportID()).length()>0 && (! rdef.getReportID().equals("-1"))) { %>
+ <tr>
+ <td class=rbg2 height="30" align="right" width="35%">
+ <font class=rtabletext>Report ID: </font>
+ </td>
+ <td align="left" width="65%" class=rbg3>
+ <font class=rtabletext><%= rdef.getReportID() %></font>
+ </td>
+ </tr>
+ <% } %>
+ <tr>
+ <td class=rbg2 height="30" align="right" width="35%" style="background-image:url(<%= AppUtils.getImgFolderURL() %>required.gif); background-position:top right; background-repeat:no-repeat;">
+ <font class=rtabletext>Report Name: </font>
+ </td>
+ <td align="left" width="65%" class=rbg3>
+ <input type="text" class="rtabletext" size="40" style="width: 200px;" maxlength="100" id="reportName" name="reportName" value="<%= (nvl(AppUtils.getRequestNvlValue(request, "reportName")).length() > 0)?
+ (!(AppUtils.getRequestNvlValue(request, "reportName").equals(rdef.getReportName()))?
+ AppUtils.getRequestNvlValue(request, "reportName"):rdef.getReportName()):
+ rdef.getReportName() %>">
+ </td>
+ </tr>
+ <input type="hidden" name="folder_id"
+ value="<%= (nvl(AppUtils.getRequestNvlValue(request, "folder_id")).length() > 0)?
+ (!(AppUtils.getRequestNvlValue(request, "folder_id").equals(rdef.getFolderId()))?
+ AppUtils.getRequestNvlValue(request, "folder_id"):rdef.getFolderId()):
+ rdef.getFolderId() %>">
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Report Description: </font>
+ </td>
+ <td class=rbg3 align="left">
+ <textarea name="reportDescr" class="rtabletext" style="width: 200px;" cols="40" rows="3"><%= (nvl(AppUtils.getRequestNvlValue(request, "reportDescr")).length() > 0)?
+ (!(AppUtils.getRequestNvlValue(request, "reportDescr").equals(rdef.getReportDescr()))?
+ AppUtils.getRequestNvlValue(request, "reportDescr"):rdef.getReportDescr()):
+ rdef.getReportDescr() %></textarea>
+ </td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Report Type </font>
+ </td>
+ <td class=rbg3 align="left">
+ <% if(nvl(rdef.getReportType()).length()>0) { %>
+ <font class=rtabletext><%= rdef.getReportType().equals(AppConstants.RT_LINEAR)?"Linear":(rdef.getReportType().equals(AppConstants.RT_CROSSTAB)?"Cross-tab":(rdef.getReportType().equals(AppConstants.RT_DASHBOARD)?"Dashboard":rdef.getReportType())) %></font>
+ <input type="hidden" id="reportType" name="reportType" value="<%= rdef.getReportType() %>">
+ <% } else { %>
+ <select id="reportType" name="reportType" style="width: 200px;" onChange="document.forma.<%= AppConstants.RI_GO_TO_STEP %>.value='<%= rdef.getWizardSequence().getCurrentStep() %>'; document.forma.submit();">
+ <option value="-1"> Select Type </option>
+ <option value="<%= AppConstants.RT_LINEAR %>" <%= AppUtils.getRequestNvlValue(request, "reportType").equals(AppConstants.RT_LINEAR) ? " selected":"selected" %>> Linear </option>
+<!-- <option value="<%= AppConstants.RT_CROSSTAB %>"<%= AppUtils.getRequestNvlValue(request, "reportType").equals(AppConstants.RT_CROSSTAB) ? " selected":"" %>> Cross-tab </option>
+ <option value="<%= AppConstants.RT_DASHBOARD %>"<%= AppUtils.getRequestNvlValue(request, "reportType").equals(AppConstants.RT_DASHBOARD) ? " selected":"" %>> Dashboard </option>
+ <option value="<%= AppConstants.RT_HIVE %>"<%= AppUtils.getRequestNvlValue(request, "reportType").equals(AppConstants.RT_HIVE) ? " selected":"" %>> Hive Based Report </option>
+ -->
+ </select>
+ <% } %>
+ </td>
+ </tr>
+ <% if((AppUtils.getRequestNvlValue(request, "reportType").length() > 0) || (rdef.getReportType().length() > 0)) { %>
+ <!-- Dashboard Begin -->
+ <% if (AppUtils.getRequestNvlValue(request, "reportType").equals(AppConstants.RT_DASHBOARD) || rdef.getReportType().equals(AppConstants.RT_DASHBOARD)) { %>
+ <tr>
+ <td class=rbg2 height="30" align="right"><font class=rtabletext>Select HTML Template:</font></td>
+ <td><select id="dashboardTemplate" style="width: 200px;" name="dashboardTemplate" onchange="return udpateTemplate(this.value);">
+ <option value="empty">-- select --</option>
+ <option value="2x2">2 Rows x 2 Columns</option>
+ <option value="2x1">2 Rows x 1 Column</option>
+ <option value="1x2">1 Row x 2 Columns</option>
+ <option value="3x1">3 Rows x 1 Column</option>
+ <option value="custom1">2 Rows with 1st Row with 1 column and 2nd Row with 2 Columns</option>
+ <option value="custom2">2 Rows with 1st Column expanded to 2 rows</option>
+ <option value="custom3">Hybrid Layout</option>
+ </select></td>
+ </tr>
+ <tr>
+ <td class=rbg2 height="30" align="right"><font class=rtabletext>Dashboard HTML:</font></td>
+
+ <td>
+ <div id='editingArea' style="width: 600px; height: 200px; overflow: none">
+ <textarea id='dashboardPreview' name="dashboardLayoutHTML" style="width: 200px; height: 100%">
+ <% if(rdef != null && nvl(rdef.getDashboardLayoutHTML()).length()>0 ) {%><%= rdef.getDashboardLayoutHTML().trim() %><%} %>
+ </textarea></div>
+ <div id='tempHidden' style="display: none;"></div>
+ <br/><select name="dashboardTemplateReports">
+ <option value="-1" selected>-->select report <--</option>
+ <%
+ for (Iterator iter = mapSet.iterator(); iter.hasNext();) {
+ me = (Map.Entry) iter.next();
+ %>
+ <%
+ if (rdef != null && rdef.getDashBoardReports() != null && (rdef.getDashBoardReports().getReportsList().get(0) != null)
+ && (((Reports) rdef.getDashBoardReports().getReportsList().get(0)).getReportId().equals((String) me.getKey()))) {
+ %>
+ <option value="<%=(String) me.getKey()%>" selected><%=(String) me.getValue()%></option>
+ <%
+ } else {
+ %>
+ <option value="<%=(String) me.getKey()%>"><%=(String) me.getValue()%></option>
+ <%
+ }
+ %>
+ <%
+ }
+ %>
+ </select>
+ &nbsp;<input type="button" class='button' onclick="return addType();" value='Insert Report Id' />
+ &nbsp;<input id='PreviewButton' style="width: 100px" type='button' class='button' value="Preview" onclick="return showPreview(this);" />
+ <br />
+ </td>
+ </tr>
+
+
+ <!-- Dashboard Ends -->
+ <% } else { %>
+
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Data Source:</font>
+ </td>
+ <td align="left" class=rbg3>
+ <%
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ HashMap remDbMap = remDbInfo.getDbHash();
+
+ %>
+ <% if (dbInfo != null && dbInfo.length()>0 && !dbInfo.equalsIgnoreCase("null") && !remDbMap.isEmpty()) { %>
+ <font class=rtabletext><%= (AppUtils.nvl(remDbInfo.getDesc(dbInfo)).length()>0)?remDbInfo.getDesc(dbInfo):" No Desc " %></font>
+ <%
+ }
+ else {
+ %>
+ <%-- dbInfo.equals(AppConstants.DB_PROD)? "selected":"" --%>
+ <select id = "selectDS" name="dataSource" style="width: 200px;">
+ <%
+ if(!remDbMap.isEmpty()) {
+ for( Iterator itr=remDbMap.entrySet().iterator(); itr.hasNext(); ) {
+ Map.Entry e = (Map.Entry)itr.next();
+ String prefix = (String)e.getKey();
+ String desc = (String)e.getValue();
+ %>
+ <option value='<%= prefix %>'
+ <% if(prefix.equals(nvl(AppUtils.getRequestNvlValue(request, "dataSource")))) { %>
+ <%=(nvl(AppUtils.getRequestNvlValue(request, "dataSource")).length()>0?
+ (
+ prefix.equals(nvl(AppUtils.getRequestNvlValue(request, "dataSource")))?"selected ":
+ (prefix.equals(AppConstants.DB_LOCAL)?"selected ":"")
+ )
+ :prefix.equals(AppConstants.DB_LOCAL)?"selected ":"")%>
+ <% } %>
+ ><%= desc%>
+ <%
+ }
+
+ %>
+ <% } else { %>
+ <option value='<%= AppConstants.DB_LOCAL%>' selected>Default
+ <% } %>
+
+ </select>
+ <% if(!remDbMap.isEmpty() && nvl(AppUtils.getRequestNvlValue(request, "dataSource")).length() <= 0){ %>
+ <script language="Javascript">
+ var selectDS = document.getElementById("selectDS");
+ var flag = 0;
+ for (i = selectDS.length - 1; i>=0; i--) {
+ if (selectDS.options[i].selected) {
+ flag = 2;
+ break;
+ }
+ }
+ if(flag==2) {
+ for (i = selectDS.length - 1; i>=0; i--) {
+ if(selectDS.options[i].value == '<%= AppConstants.DB_LOCAL%>' ){
+ selectDS.options[i].selected = true;
+ }
+ }
+ }
+ </script>
+
+ <% } %>
+
+ <% } %>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Form Help Text: </font>
+ </td>
+ <td class=rbg3 align="left">
+ <textarea name="formHelp" style="width: 200px;" cols="40" rows="3"><%=rdef.getFormHelpText()%></textarea>
+ </td>
+ </tr>
+
+ <% if(Globals.getAllowSQLBasedReports()||AppUtils.isAdminUser(request)) { %>
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Report Definition: </font>
+ </td>
+ <td class=rbg3 align="left">
+ <font class=rtabletext>
+ <% if(rdef.getReportDefType().length()>0) { %>
+ <%= rdef.getReportDefType().equals(AppConstants.RD_VISUAL)?"Visual":(rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)?"SQL-based":rdef.getReportDefType()) %>
+ <% } else { %>
+ <!-- <input type=radio name="reportDefType" value="<%= AppConstants.RD_VISUAL %>" <%= AppUtils.getRequestNvlValue(request, "reportDefType").equals(AppConstants.RD_VISUAL)?" checked": ((AppUtils.getRequestNvlValue(request, "reportDefType").length()<=0)?" checked":"") %>>Visual -->
+ <input type=radio name="reportDefType" checked value="<%= AppConstants.RD_SQL_BASED %>" <%= AppUtils.getRequestNvlValue(request, "reportDefType").equals(AppConstants.RD_SQL_BASED) ? " checked":"" %>>SQL-based
+ <!-- <input type=radio name="reportDefType" value="<%= AppConstants.RD_SQL_BASED_DATAMIN %>" <%= AppUtils.getRequestNvlValue(request, "reportDefType").equals(AppConstants.RD_SQL_BASED_DATAMIN) ? " checked":"" %>>Data Forecasting -->
+ <% } %>
+ </font>
+ </td>
+ </tr>
+ <% } // if
+ %>
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Page Size: </font>
+ </td>
+ <td class=rbg3 align="left">
+ <select name="pageSize" style="width: 200px;" onKeyDown="fnKeyDownHandler(this, event);" onKeyUp="fnKeyUpHandler_A(this, event); return false;" onKeyPress = "return fnKeyPressHandler_A(this, event);" onChange="fnChangeHandler_A(this, event);">
+ <option value="" style="COLOR:#ff0000;BACKGROUND-COLOR:#ffff00;">Custom</option> <!-- This is the Editable Option -->
+ <option value="10"<%= (rdef.getPageSize()==10 )?" selected":"" %>>10
+ <option value="25"<%= (rdef.getPageSize()==25 )?" selected":"" %>>25
+ <option value="50"<%= (rdef.getPageSize()==50 )?" selected":"" %>>50
+ <option value="100"<%= (rdef.getPageSize()==100)?" selected":"" %>>100
+ <option value="500"<%= (rdef.getPageSize()==500)?" selected":"" %>>500
+ <% if(rdef.getPageSize()!=10 && rdef.getPageSize()!=20 && rdef.getPageSize()!=50
+ && rdef.getPageSize()!=100 && rdef.getPageSize()!=500) {
+ %>
+ <option value="<%=rdef.getPageSize()%>" selected><%=rdef.getPageSize()%></option> <!-- This is the Editable Option -->
+ <%
+ }
+ %>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Display Area: </font>
+ </td>
+ <td class=rbg3 align="left" valign="top" nowrap>
+ <select name="menuID" size="3" multiple style="width: 100px;">
+ <!-- need one more blank to deselect since approval checkbox is taken out -->
+ <option value="">
+ <% for(int i=0; i<AppUtils.getQuickLinksMenuIDs().size(); i++) {
+ String qMenu = (String) AppUtils.getQuickLinksMenuIDs().get(i); %>
+ <option value="<%= qMenu %>"<%= rdef.checkMenuIDSelected(qMenu)?" selected":"" %>><%= AppUtils.getMenuLabel(qMenu) %>
+ <% } // for
+ %>
+ </select>
+<%-- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="checkbox" name="menuApproved" value="Y"<%= rdef.isMenuApproved()?" checked":"" %><%= AppUtils.isAdminUser(request)?"":" disabled onClick='checked="+(rdef.isMenuApproved()?"true":"false")+"';" %>>
+ <font class=rtabletext>Approved?</font> --%>
+ </td>
+ </tr>
+<%-- <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Generate report in a New Window?</font>
+ </td>
+ <td class=rbg3 align="left" nowrap>
+ <input type="checkbox" name="reportInNewWindow" value="Y"
+ <%= rdef.isReportInNewWindow()? " checked " : "" %>>
+ </td>
+ </tr> --%>
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Hide Form fields after run?</font>
+ </td>
+ <td class=rbg3 align="left" nowrap>
+ <input type="checkbox" name="hideFormFieldsAfterRun" value="Y"
+ <%= rdef.isHideFormFieldAfterRun()? " checked " : "" %>>
+ </td>
+ </tr>
+
+<%-- <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Display Folder Tree?</font>
+ </td>
+ <td class=rbg3 align="left" nowrap>
+ <input type="checkbox" name="displayFolderTree" value="Y"
+ <%= rdef.isDisplayFolderTree()? " checked " : "" %>
+ >
+ </td>
+ </tr> --%>
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext> Max Rows in Excel/CSV Download </font>
+ </td>
+ <td class=rbg3 align="left">
+ <select name="excelDownloadSize" style="width: 80px;">
+ <option value="500"<%= (rdef.getMaxRowsInExcelDownload()==500 )?" selected":"" %>>500
+ <option value="1000"<%= (rdef.getMaxRowsInExcelDownload()==1000 )?" selected":"" %>>1000
+ <option value="2000"<%= (rdef.getMaxRowsInExcelDownload()==2000 )?" selected":"" %>>2000
+ <option value="3000"<%= (rdef.getMaxRowsInExcelDownload()==3000 )?" selected":"" %>>3000
+ <option value="4000"<%= (rdef.getMaxRowsInExcelDownload()==4000 )?" selected":"" %>>4000
+ <option value="5000"<%= (rdef.getMaxRowsInExcelDownload()==5000 )?" selected":"" %>>5000
+ <option value="10000"<%= (rdef.getMaxRowsInExcelDownload()==10000 )?" selected":"" %>>10000
+ <option value="15000"<%= (rdef.getMaxRowsInExcelDownload()==15000 )?" selected":"" %>>15000
+ <option value="20000"<%= (rdef.getMaxRowsInExcelDownload()==20000 )?" selected":"" %>>20000
+ <option value="25000"<%= (rdef.getMaxRowsInExcelDownload()==25000 )?" selected":"" %>>25000
+ <option value="30000"<%= (rdef.getMaxRowsInExcelDownload()==30000 )?" selected":"" %>>30000
+ <option value="35000"<%= (rdef.getMaxRowsInExcelDownload()==35000 )?" selected":"" %>>35000
+ <option value="40000"<%= (rdef.getMaxRowsInExcelDownload()==40000)?" selected":"" %>>40000
+ <option value="45000"<%= (rdef.getMaxRowsInExcelDownload()==45000 )?" selected":"" %>>45000
+ <option value="50000"<%= (rdef.getMaxRowsInExcelDownload()==50000)?" selected":"" %>>50000
+ <option value="65000"<%= (rdef.getMaxRowsInExcelDownload()==65000)?" selected":"" %>>65000
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Columns to be Frozen: </font>
+ </td>
+ <td class=rbg3 align="left">
+ <select name="frozenColumns" style="width: 50px;" onKeyDown="fnKeyDownHandler(this, event);" onKeyUp="fnKeyUpHandler_A(this, event); return false;" onKeyPress = "return fnKeyPressHandler_A(this, event);" onChange="fnChangeHandler_A(this, event);">
+ <option value="" style="COLOR:#ff0000;BACKGROUND-COLOR:#ffff00;">Custom</option> <!-- This is the Editable Option -->
+ <option value="0"<%= (rdef.getFrozenColumns()==0 )?" selected":"" %>>0
+ <option value="1"<%= (rdef.getFrozenColumns()==1 )?" selected":"" %>>1
+ <option value="2"<%= (rdef.getFrozenColumns()==2 )?" selected":"" %>>2
+ <option value="3"<%= (rdef.getFrozenColumns()==3)?" selected":"" %>>3
+ <option value="4"<%= (rdef.getFrozenColumns()==4)?" selected":"" %>>4
+ <% if(rdef.getFrozenColumns()!=0 && rdef.getFrozenColumns()!=1 && rdef.getFrozenColumns()!=2
+ && rdef.getFrozenColumns()!=3 && rdef.getFrozenColumns()!=4) {
+ %>
+ <option value="<%=rdef.getFrozenColumns()%>" selected><%=rdef.getFrozenColumns()%></option> <!-- This is the Editable Option -->
+ <%
+ }
+ %>
+ </select>
+ </td>
+ </tr>
+
+ <% if(rdef.getReportType().equals(AppConstants.RT_CROSSTAB)) { %>
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Record # column width: </font>
+ </td>
+ <td class=rbg3 align="left">
+ <input type="text" class="rtabletext" style="width: 100px;" size="40" maxlength="100" id="widthNo" name="widthNo" value="<%= (nvl(AppUtils.getRequestNvlValue(request, "widthNo")).length() > 0)?
+ (!(AppUtils.getRequestNvlValue(request, "widthNo").equals(rdef.getWidthNoColumn()))?
+ AppUtils.getRequestNvlValue(request, "widthNo"):rdef.getWidthNoColumn()):
+ rdef.getWidthNoColumn() %>">
+ </td>
+ </tr>
+
+
+
+ <% } %>
+
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Data Grid Align: </font>
+ </td>
+ <td class=rbg3 align="left">
+ <select name="dataGridAlign" style="width: 100px;">
+ <option value="left"<%= (nvl(rdef.getDataGridAlign()).length()>0 ? (rdef.getDataGridAlign().equals("left") ? " selected": ""):" selected ")%>> Left
+ <option value="right"<%= (nvl(rdef.getDataGridAlign()).length()>0 ? (rdef.getDataGridAlign().equals("right") ? " selected": ""):"")%>> Right
+ <option value="center"<%= (nvl(rdef.getDataGridAlign()).length()>0 ? (rdef.getDataGridAlign().equals("center") ? " selected": ""):"")%>> Center
+
+ </select>
+ </td>
+ </tr>
+
+ <%
+ if(pdfImgMap.size() > 0) {
+ %>
+
+ <%-- dbInfo.equals(AppConstants.DB_PROD)? "selected":"" --%>
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Select logo for PDF download: </font>
+ </td>
+ <td>
+ <select id = "pdfImg" name="pdfImg" style="width: 100px;">
+ <option value=''> <!-- SELECT --></option>
+ <%
+ if(!pdfImgMap.isEmpty()) {
+ for( Iterator itr=pdfImgMap.entrySet().iterator(); itr.hasNext(); ) {
+ Map.Entry e = (Map.Entry)itr.next();
+ String image_id = (String)e.getKey();
+ String image_loc = (String)e.getValue();
+ %>
+ <%
+ if (nvl(AppUtils.getRequestNvlValue(request, "pdfImg")).length()>0 && !(AppUtils.getRequestNvlValue(request, "pdfImg").equals(rdef.getPdfImg())) ) {
+ if(image_loc .equals (AppUtils.getRequestNvlValue(request, "pdfImg"))) {
+ %>
+
+ <option value='<%= image_loc %>' selected> <%=image_id %></option>
+ <%
+ } else {
+ %>
+ <option value='<%= image_loc %>'> <%=image_id %></option>
+ <%
+ }
+ } else {
+ if(image_loc .equals (rdef.getPdfImg())) {
+ %>
+
+ <option value='<%= image_loc %>' selected> <%=image_id %> </option>
+ <%
+
+ } else {
+ %>
+ <option value='<%= image_loc %>'> <%=image_id %></option>
+ <%
+ }
+ }
+ %>
+ </select>
+ </td>
+ <% }
+ }
+ %>
+ </tr>
+ <%
+ }
+%>
+
+ <tr>
+ <td class=rbg2 height="30" align="right" width="35%">
+ <font class=rtabletext>Empty message: </font>
+ </td>
+ <td align="left" width="65%" class=rbg3>
+ <input type="text" class="rtabletext" style="width: 200px;" size="40" maxlength="100" id="emptyMessage" name="emptyMessage" value="<%= (nvl(AppUtils.getRequestNvlValue(request, "emptyMessage")).length() > 0)?
+ (!(AppUtils.getRequestNvlValue(request, "emptyMessage").equals(rdef.getEmptyMessage()))?
+ AppUtils.getRequestNvlValue(request, "emptyMessage"):rdef.getEmptyMessage()):
+ rdef.getEmptyMessage() %>">
+ </td>
+ </tr>
+
+ <% } %>
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext> Height of the Data Container </font>
+ </td>
+ <td class=rbg3 align="left">
+ <% if (nvl(rdef.getDataContainerHeight(), "100").equals ("auto") || nvl(rdef.getDataContainerHeight(), "100").equals ("100")) { rdef.setDataContainerHeight("100"); } %>
+ <select name="heightContainer" style="width: 70px;" onKeyDown="fnKeyDownHandler(this, event);" onKeyUp="fnKeyUpHandler_A(this, event); return false;" onKeyPress = "return fnKeyPressHandler_A(this, event);" onChange="fnChangeHandler_A(this, event);">
+ <option value="" style="COLOR:#ff0000;BACKGROUND-COLOR:#ffff00;">Custom</option> <!-- This is the Editable Option -->
+ <option value="200" <%= (nvl(rdef.getDataContainerHeight(),"200").equals("200"))?" selected":"" %>>200%</option>
+ <option value="190" <%= (nvl(rdef.getDataContainerHeight(),"190").equals("190"))?" selected":"" %>>190%</option>
+ <option value="180" <%= (nvl(rdef.getDataContainerHeight(),"180").equals("180"))?" selected":"" %>>180%</option>
+ <option value="170" <%= (nvl(rdef.getDataContainerHeight(),"170").equals("170"))?" selected":"" %>>170%</option>
+ <option value="160" <%= (nvl(rdef.getDataContainerHeight(),"160").equals("160"))?" selected":"" %>>160%</option>
+ <option value="150" <%= (nvl(rdef.getDataContainerHeight(),"150").equals("150"))?" selected":"" %>>150%</option>
+ <option value="140" <%= (nvl(rdef.getDataContainerHeight(),"140").equals("140"))?" selected":"" %>>140%</option>
+ <option value="130" <%= (nvl(rdef.getDataContainerHeight(),"130").equals("130"))?" selected":"" %>>130%</option>
+ <option value="120" <%= (nvl(rdef.getDataContainerHeight(),"120").equals("120"))?" selected":"" %>>120%</option>
+ <option value="110" <%= (nvl(rdef.getDataContainerHeight(),"110").equals("110"))?" selected":"" %>>110%</option>
+ <option value="100" <%= (nvl(rdef.getDataContainerHeight(),"100").equals("100"))?" selected":"" %>>100%</option>
+ <option value="90" <%= (nvl(rdef.getDataContainerHeight(),"90").equals("90"))?" selected":"" %>>90%</option>
+ <option value="80" <%= (nvl(rdef.getDataContainerHeight(),"80").equals("80"))?" selected":"" %>>80%</option>
+ <option value="70" <%= (nvl(rdef.getDataContainerHeight(),"70").equals("70"))?" selected":"" %>>70%</option>
+ <option value="60" <%= (nvl(rdef.getDataContainerHeight(),"60").equals("60"))?" selected":"" %>>60%</option>
+ <option value="50" <%= (nvl(rdef.getDataContainerHeight(),"50").equals("50"))?" selected":"" %>>50%</option>
+ <option value="40" <%= (nvl(rdef.getDataContainerHeight(),"40").equals("40"))?" selected":"" %>>40%</option>
+ <option value="30" <%= (nvl(rdef.getDataContainerHeight(),"30").equals("30"))?" selected":"" %>>30%</option>
+ <option value="20" <%= (nvl(rdef.getDataContainerHeight(),"20").equals("20"))?" selected":"" %>>20%</option>
+ <option value="10" <%= (nvl(rdef.getDataContainerHeight(),"10").equals("10"))?" selected":"" %>>10%</option>
+
+
+ <% if(!((new Integer(nvl(rdef.getDataContainerHeight(), "100")).intValue()%10 == 0) && (new Integer(nvl(rdef.getDataContainerHeight(), "100")).intValue() <= 200)) ) {
+ %>
+ <option value="<%=rdef.getDataContainerHeight()%>" selected><%=rdef.getDataContainerHeight()%>%</option>
+ <%
+ }
+ %>
+ </td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext> Width of the Data Container </font>
+ </td>
+ <td class=rbg3 align="left">
+ <% if (nvl(rdef.getDataContainerWidth(), "100").equals ("auto") || nvl(rdef.getDataContainerWidth(), "100").equals ("100")) { rdef.setDataContainerWidth("100"); } %>
+ <select name="widthContainer" style="width: 70px;" onKeyDown="fnKeyDownHandler(this, event);" onKeyUp="fnKeyUpHandler_A(this, event); return false;" onKeyPress = "return fnKeyPressHandler_A(this, event);" onChange="fnChangeHandler_A(this, event);">
+ <option value="" style="COLOR:#ff0000;BACKGROUND-COLOR:#ffff00;">Custom</option> <!-- This is the Editable Option -->
+ <option value="200" <%= (nvl(rdef.getDataContainerWidth(),"200").equals("200"))?" selected":"" %>>200%</option>
+ <option value="190" <%= (nvl(rdef.getDataContainerWidth(),"190").equals("190"))?" selected":"" %>>190%</option>
+ <option value="180" <%= (nvl(rdef.getDataContainerWidth(),"180").equals("180"))?" selected":"" %>>180%</option>
+ <option value="170" <%= (nvl(rdef.getDataContainerWidth(),"170").equals("170"))?" selected":"" %>>170%</option>
+ <option value="160" <%= (nvl(rdef.getDataContainerWidth(),"160").equals("160"))?" selected":"" %>>160%</option>
+ <option value="150" <%= (nvl(rdef.getDataContainerWidth(),"150").equals("150"))?" selected":"" %>>150%</option>
+ <option value="140" <%= (nvl(rdef.getDataContainerWidth(),"140").equals("140"))?" selected":"" %>>140%</option>
+ <option value="130" <%= (nvl(rdef.getDataContainerWidth(),"130").equals("130"))?" selected":"" %>>130%</option>
+ <option value="120" <%= (nvl(rdef.getDataContainerWidth(),"120").equals("120"))?" selected":"" %>>120%</option>
+ <option value="110" <%= (nvl(rdef.getDataContainerWidth(),"110").equals("110"))?" selected":"" %>>110%</option>
+ <option value="100" <%= (nvl(rdef.getDataContainerWidth(),"100").equals("100"))?" selected":"" %>>100%</option>
+ <option value="90" <%= (nvl(rdef.getDataContainerWidth(),"90").equals("90"))?" selected":"" %>>90%</option>
+ <option value="80" <%= (nvl(rdef.getDataContainerWidth(),"80").equals("80"))?" selected":"" %>>80%</option>
+ <option value="70" <%= (nvl(rdef.getDataContainerWidth(),"70").equals("70"))?" selected":"" %>>70%</option>
+ <option value="60" <%= (nvl(rdef.getDataContainerWidth(),"60").equals("60"))?" selected":"" %>>60%</option>
+ <option value="50" <%= (nvl(rdef.getDataContainerWidth(),"50").equals("50"))?" selected":"" %>>50%</option>
+ <option value="40" <%= (nvl(rdef.getDataContainerWidth(),"40").equals("40"))?" selected":"" %>>40%</option>
+ <option value="30" <%= (nvl(rdef.getDataContainerWidth(),"30").equals("30"))?" selected":"" %>>30%</option>
+ <option value="20" <%= (nvl(rdef.getDataContainerWidth(),"20").equals("20"))?" selected":"" %>>20%</option>
+ <option value="10" <%= (nvl(rdef.getDataContainerWidth(),"10").equals("10"))?" selected":"" %>>10%</option>
+
+
+ <% if(!((new Integer(nvl(rdef.getDataContainerWidth(), "100")).intValue()%10 == 0) && (new Integer(nvl(rdef.getDataContainerWidth(), "100")).intValue() <= 200)) ) {
+ %>
+ <option value="<%=rdef.getDataContainerWidth()%>" selected><%=rdef.getDataContainerWidth()%>%</option>
+ <%
+ }
+ %>
+ </td>
+ </tr>
+
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext> Allow Schedule? </font>
+ </td>
+ <td class=rbg3 align="left">
+ <input type="checkbox" class ="rtabletext" size="4" name="allowSchedule" value="Y" <%=((rdef.getAllowSchedule()!=null)?(rdef.getAllowSchedule().toUpperCase().charAt(0)== 'Y' ?" checked":""): (ReportLoader.isReportsAlreadyScheduled(rdef.getReportID())?" checked":"")) %>/>
+ </td>
+ </tr>
+
+<%-- <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext> Column Multi Group? </font>
+ </td>
+ <td class=rbg3 align="left">
+ <input type="checkbox" class ="rtabletext" size="4" name="multiGroupColumn" value="Y" <%=(rdef.getMultiGroupColumn()!=null)?(rdef.getMultiGroupColumn().toUpperCase().charAt(0)== 'Y' ?" checked":""): "" %>/>
+ </td>
+ </tr> --%>
+ </tr>
+
+ <% if (!(AppUtils.getRequestNvlValue(request, "reportType").equals(AppConstants.RT_DASHBOARD) || rdef.getReportType().equals(AppConstants.RT_DASHBOARD))) { %>
+
+<%-- <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext> Render Top - Down </font>
+ </td>
+ <td class=rbg3 align="left">
+ <input type="checkbox" class ="rtabletext" size="4" name="topDown" value="Y" <%=(rdef.getTopDownOption()!=null)?(rdef.getTopDownOption().toUpperCase().charAt(0)== 'Y' ?" checked":""):(AppUtils.getRequestNvlValue(request, "topDown").equals("Y")?" checked":"") %>/>
+ </td>
+ </tr> --%>
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext> Sized By Content </font>
+ </td>
+ <td class=rbg3 align="left">
+ <input type="checkbox" class ="rtabletext" size="4" name="sizedByContent" value="Y" <%=(rdef.getSizedByContentOption()!=null)?(rdef.getSizedByContentOption().toUpperCase().charAt(0)== 'Y' ?" checked":""):(AppUtils.getRequestNvlValue(request, "sizedByContent").equals("Y")?" checked":"") %>/>
+ </td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Display Options: </font>
+ </td>
+ <td class=rbg3 align="left" nowrap>
+ <input type="checkbox" name="hideForm" value="Y"<%= rdef.isDisplayOptionHideForm()?" checked":"" %>>
+ <font class=rtabletext>Hide Form Fields</font>
+ <input type="checkbox" name="hideChart" value="Y"<%= rdef.isDisplayOptionHideChart()?" checked":"" %>>
+ <font class=rtabletext>Hide Chart</font>
+ <input type="checkbox" name="hideData" value="Y"<%= rdef.isDisplayOptionHideData()?" checked":"" %>>
+ <font class=rtabletext>Hide Report Data</font>
+ <input type="checkbox" name="hideBtns" value="Y"<%= rdef.isDisplayOptionHideBtns()?" checked":"" %>>
+ <font class=rtabletext>Hide Download Buttons</font>
+ <input type="checkbox" name="hideMap" value="Y"<%= rdef.isDisplayOptionHideMap()?" checked":"" %>>
+ <font class=rtabletext>Hide Map</font>
+ <input type="checkbox" name="hideExcelIcons" value="Y"<%= rdef.isDisplayOptionHideExcelIcons()?" checked":"" %>>
+ <font class=rtabletext>Hide Excel Icons</font>
+ <input type="checkbox" name="hidePDFIcons" value="Y"<%= rdef.isDisplayOptionHidePDFIcons()?" checked":"" %>>
+ <font class=rtabletext>Hide PDF Icons</font>
+ </td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>&nbsp; </font>
+ </td>
+ <td class=rbg3 align="left" nowrap>
+ <input type="checkbox" name="runtimeColSortDisabled" value="Y"<%= rdef.isRuntimeColSortDisabled()?" checked":"" %>>
+ <font class=rtabletext>Disable column sort at runtime?</font>
+ </td>
+ </tr>
+
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Run-time Form Number Columns: </font>
+ </td>
+ <td class=rbg3 align="left">
+ <select name="numFormCols" style="width: 70px;">
+ <option value="1"<%= (rdef.getNumFormColsAsInt()==1)?" selected":"" %>>1
+ <option value="2"<%= (rdef.getNumFormColsAsInt()==2)?" selected":"" %>>2
+ <option value="3"<%= (rdef.getNumFormColsAsInt()==3)?" selected":"" %>>3
+ <option value="4"<%= (rdef.getNumFormColsAsInt()==4)?" selected":"" %>>4
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Report Title<br>(if blank, the Report Name will be displayed): </font>
+ </td>
+ <td class=rbg3 align="left">
+ <textarea name="reportTitle" style="width: 200px;" cols="40" rows="3"><%= nvl(rdef.getReportTitle()) %></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Report Sub-Title: </font>
+ </td>
+ <td class=rbg3 align="left">
+ <textarea name="reportSubTitle" style="width: 200px;" cols="40" rows="3"><%= nvl(rdef.getReportSubTitle()) %></textarea>
+ </td>
+ </tr>
+<%-- <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Page Header (HTML): </font>
+ </td>
+ <td class=rbg3 align="left">
+ <textarea name="reportHeader" style="width: 200px;" cols="40" rows="3"><%= Utils.htmlEncode(nvl(rdef.getReportHeader())) %></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Page Footer (HTML): </font>
+ </td>
+ <td class=rbg3 align="left">
+ <textarea name="reportFooter" style="width: 200px;" cols="40" rows="3"><%= Utils.htmlEncode(nvl(rdef.getReportFooter())) %></textarea>
+ </td>
+ </tr> --%>
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Allowed Recurrance in Schedule: </font>
+ </td>
+ <td class=rbg3 align="left">
+ <input type="checkbox" name="isOneTimeScheduleAllowed" value="Y" <%if (rdef.getIsOneTimeScheduleAllowed() == null || rdef.getIsOneTimeScheduleAllowed().equals("Y")){ %>checked <%} %>>One Time<br>
+ <input type="checkbox" name="isHourlyScheduleAllowed" value="Y" <%if (rdef.getIsHourlyScheduleAllowed() == null || rdef.getIsHourlyScheduleAllowed().equals("Y")){ %>checked<%} %> >Hourly<br>
+ <input type="checkbox" name="isDailyScheduleAllowed" value="Y" <%if (rdef.getIsDailyScheduleAllowed() == null || rdef.getIsDailyScheduleAllowed().equals("Y")){ %>checked<%} %> >Daily<br>
+ <input type="checkbox" name="isDailyMFScheduleAllowed" value="Y" <%if (rdef.getIsDailyMFScheduleAllowed() == null || rdef.getIsDailyMFScheduleAllowed().equals("Y")){ %>checked<%} %> >Daily Monday - Friday<br>
+ <input type="checkbox" name="isWeeklyScheduleAllowed" value="Y" <%if (rdef.getIsWeeklyScheduleAllowed() == null || rdef.getIsWeeklyScheduleAllowed().equals("Y")){ %>checked<%} %> >Weekly<br>
+ <input type="checkbox" name="isMonthlyScheduleAllowed" value="Y" <%if (rdef.getIsMonthlyScheduleAllowed() == null || rdef.getIsMonthlyScheduleAllowed().equals("Y")){ %>checked<%} %> >Monthly<br>
+ </td>
+ </tr>
+ <input type="hidden" name="additionalFieldsShown" value="Y">
+<% } // else
+%>
+
+<% } // if report type is empty %>
+
+</table>
+<br>
+
+ <script language="JavaScript">
+ <!--
+ <%
+ Vector reportIdNames = ReportLoader.getUserReportNames(request); %>
+ var reportIds = new Array(<%= reportIdNames.size() %>);
+ var reportNames = new Array(<%= reportIdNames.size() %>);
+ <% for(int i=0; i<reportIdNames.size(); i++) {
+ IdNameValue value = (IdNameValue) reportIdNames.get(i); %>
+ reportIds[<%= i %>] = "<%= value.getId() %>";
+ reportNames[<%= i %>] = "<%= Utils.javaSafe(value.getName()) %>";
+ <% } %>
+
+ var dashboardReports = new Array ('reports1', 'reports2', 'reports3', 'reports4');
+ function dataValidate() {
+ if(document.getElementById('reportType').value=="-1") {
+ alert("Please enter Report Type");
+ document.getElementById('reportType').focus();
+ document.getElementById('reportType').select();
+ return false;
+ }
+
+
+ if(document.getElementById('reportName').value=="") {
+ alert("Please enter Report Name");
+ document.forma.reportName.focus();
+ document.forma.reportName.select();
+ return false;
+ } // if
+
+ if(document.forma.pageSize!=null && document.forma.pageSize.options.selectedIndex == 0) {
+ if(!checkNonNegativeInteger(document.forma.pageSize.options[document.forma.pageSize.options.selectedIndex].text)) {
+ alert("Please enter number in pageSize. No Characters are allowed.");
+ return false;
+ } else {
+ document.forma.pageSize.options[document.forma.pageSize.options.selectedIndex].value=document.forma.pageSize.options[document.forma.pageSize.options.selectedIndex].text;
+ }
+ }
+
+ if(document.forma.frozenColumns!=null && document.forma.frozenColumns.options.selectedIndex == 0) {
+ if(!checkNonNegativeInteger(document.forma.frozenColumns.options[document.forma.frozenColumns.options.selectedIndex].text)) {
+ alert("Please enter number in frozenColumns. No Characters are allowed.");
+ return false;
+ } else {
+ document.forma.frozenColumns.options[document.forma.frozenColumns.options.selectedIndex].value=document.forma.frozenColumns.options[document.forma.frozenColumns.options.selectedIndex].text;
+ }
+ }
+
+ if(document.forma.heightContainer!=null && document.forma.heightContainer.options.selectedIndex == 0) {
+ if(!checkNonNegativeInteger(document.forma.heightContainer.options[document.forma.heightContainer.options.selectedIndex].text)) {
+ alert("Please enter positive number greater than 10% in \"Desired Container Height\". No Characters are allowed.");
+ return false;
+ } else {
+ if(eval(document.forma.heightContainer.options[document.forma.heightContainer.options.selectedIndex].text) < 10) {
+ alert("Please enter positive number less than 10% in \"Desired Container Height\". No Characters are allowed.");
+ return false;
+ }
+ if(eval(document.forma.heightContainer.options[document.forma.heightContainer.options.selectedIndex].text) > 300) {
+ alert("Please enter positive number greater than 300% in \"Desired Container Height\". No Characters are allowed.");
+ return false;
+ }
+ document.forma.heightContainer.options[document.forma.heightContainer.options.selectedIndex].value=document.forma.heightContainer.options[document.forma.heightContainer.options.selectedIndex].text;
+ }
+ }
+
+ if(document.forma.widthContainer!=null && document.forma.widthContainer.options.selectedIndex == 0) {
+ if(!checkNonNegativeInteger(document.forma.widthContainer.options[document.forma.widthContainer.options.selectedIndex].text)) {
+ alert("Please enter positive number greater than 10% in \"Desired Container Width\". No Characters are allowed.");
+ return false;
+ } else {
+ if(eval(document.forma.widthContainer.options[document.forma.widthContainer.options.selectedIndex].text) < 10) {
+ alert("Please enter positive number less than 10% in \"Desired Container Width\". No Characters are allowed.");
+ return false;
+ }
+ if(eval(document.forma.widthContainer.options[document.forma.widthContainer.options.selectedIndex].text) > 300) {
+ alert("Please enter positive number greater than 300% in \"Desired Container Width\". No Characters are allowed.");
+ return false;
+ }
+ document.forma.widthContainer.options[document.forma.widthContainer.options.selectedIndex].value=document.forma.widthContainer.options[document.forma.widthContainer.options.selectedIndex].text;
+ }
+ }
+
+ for(var i=0; i<reportIds.length; i++)
+ if((document.getElementById('reportName').value==reportNames[i])&&(reportIds[i]!="<%= reportID %>")) {
+ alert("Report with that name created by you already exists.\nPlease select another name");
+ document.forma.reportName.focus();
+ document.forma.reportName.select();
+ return false;
+ } // if
+ return true;
+ } // dataValidate
+ //-->
+ </script>
+<!-- Start Floating Layer -->
+<div
+ id="uniquename1"
+ style="display:none;
+ position:absolute;
+ border-style: solid;
+ background-color: white;
+ padding: 5px;">
+ <!-- place your HTML content here-->
+ <h3>Background color selector</h3>
+ <% if (rdef !=null && rdef.getDashBoardReports()!=null && (rdef.getDashBoardReports().getReportsList().get(0)!=null) && (((Reports)rdef.getDashBoardReports().getReportsList().get(0)).getBgcolor()!=null) &&(((Reports)rdef.getDashBoardReports().getReportsList().get(0)).getBgcolor().length()>0)) {%>
+ <input id="hashCode1" style="position: absolute; right: 15px; top: 239px;" size="8" class="color" value="<%=((Reports)rdef.getDashBoardReports().getReportsList().get(0)).getBgcolor()%>" type="text" />
+ <%} else { %>
+ <input id="hashCode1" style="position: absolute; right: 15px; top: 239px;" size="8" class="color" value="#FFFFFF" type="text" />
+ <% } %>
+ <input type="button" value="Submit & Close" onClick="document.forma.repBgColor1.value=document.getElementById('hashCode1').value; document.forma.repBgColor1.style.backgroundColor = document.getElementById('hashCode1').value; HideContent('uniquename1');"/>
+
+
+ <!-- End of content area -->
+
+</div>
+<div
+ id="uniquename2"
+ style="display:none;
+ position:absolute;
+ border-style: solid;
+ background-color: white;
+ padding: 5px;">
+ <!-- place your HTML content here-->
+ <h3>Background color selector</h3>
+ <% if (rdef !=null && rdef.getDashBoardReports()!=null && (rdef.getDashBoardReports().getReportsList().get(1)!=null) && (((Reports)rdef.getDashBoardReports().getReportsList().get(1)).getBgcolor()!=null) && (((Reports)rdef.getDashBoardReports().getReportsList().get(1)).getBgcolor().length()>0)) {%>
+ <input id="hashCode2" style="position: absolute; right: 15px; top: 239px;" size="8" class="color" value="<%=((Reports)rdef.getDashBoardReports().getReportsList().get(1)).getBgcolor()%>" type="text" />
+ <%} else { %>
+ <input id="hashCode2" style="position: absolute; right: 15px; top: 239px;" size="8" class="color" value="#FFFFFF" type="text" />
+ <% } %>
+ <input type="button" value="Submit & Close" onClick="document.forma.repBgColor2.value=document.getElementById('hashCode2').value; document.forma.repBgColor2.style.backgroundColor = document.getElementById('hashCode2').value;HideContent('uniquename2');"/>
+
+
+ <!-- End of content area -->
+
+</div>
+<div
+ id="uniquename3"
+ style="display:none;
+ position:absolute;
+ border-style: solid;
+ background-color: white;
+ padding: 5px;">
+ <!-- place your HTML content here-->
+ <h3>Background color selector</h3>
+ <% if (rdef !=null && rdef.getDashBoardReports()!=null && (rdef.getDashBoardReports().getReportsList().get(2)!=null) && (((Reports)rdef.getDashBoardReports().getReportsList().get(2)).getBgcolor()!=null) && (((Reports)rdef.getDashBoardReports().getReportsList().get(2)).getBgcolor().length()>0)) {%>
+ <input id="hashCode3" style="position: absolute; right: 15px; top: 239px;" size="8" class="color" value="<%=((Reports)rdef.getDashBoardReports().getReportsList().get(2)).getBgcolor()%>" type="text" />
+ <%} else { %>
+ <input id="hashCode3" style="position: absolute; right: 15px; top: 239px;" size="8" class="color" value="#FFFFFF" type="text" />
+ <% } %>
+ <input type="button" value="Submit & Close" onClick="document.forma.repBgColor3.value=document.getElementById('hashCode3').value; document.forma.repBgColor3.style.backgroundColor = document.getElementById('hashCode3').value; HideContent('uniquename3');"/>
+
+
+ <!-- End of content area -->
+
+</div>
+<div
+ id="uniquename4"
+ style="display:none;
+ position:absolute;
+ border-style: solid;
+ background-color: white;
+ padding: 5px;">
+ <!-- place your HTML content here-->
+ <h3>Background color selector</h3>
+ <% if (rdef !=null && rdef.getDashBoardReports()!=null && (rdef.getDashBoardReports().getReportsList().get(3)!=null) && (((Reports)rdef.getDashBoardReports().getReportsList().get(3)).getBgcolor()!=null) && (((Reports)rdef.getDashBoardReports().getReportsList().get(3)).getBgcolor().length()>0)) {%>
+ <input id="hashCode4" style="position: absolute; right: 15px; top: 239px;" size="8" class="color" value="<%=((Reports)rdef.getDashBoardReports().getReportsList().get(3)).getBgcolor()%>" type="text" />
+ <%} else { %>
+ <input id="hashCode4" style="position: absolute; right: 15px; top: 239px;" size="8" class="color" value="#FFFFFF" type="text" />
+ <% } %>
+ <input type="button" value="Submit & Close" onClick="document.forma.repBgColor4.value=document.getElementById('hashCode4').value; document.forma.repBgColor4.style.backgroundColor = document.getElementById('hashCode4').value; HideContent('uniquename4');"/>
+
+
+ <!-- End of content area -->
+
+</div>
+
+<div id="FloatingLayer" style="position:absolute;width:250px;left:100;top:100;visibility:hidden">
+ <table border="0" width="250" bgcolor="#FF6600" cellspacing="0" cellpadding="5">
+ <tr>
+ <td width="100%"> <table border="0" width="100%" cellspacing="0" cellpadding="0" height="36">
+ <tr>
+ <td id="titleBar" style="cursor:move" width="100%"> <ilayer width="100%" onSelectStart="return false">
+ <layer width="100%" onMouseover="isActive=true;if (isN4) MoveN4(FloatingLayer)" onMouseout="isActive=false">
+ <font face="Arial" color="#FFFFFF">Layer Title</font></layer>
+ </ilayer></td>
+ <td style="cursor:hand" valign="top"> <a href="#" onClick="ToggleFloatingLayer('FloatingLayer',0);return false"><font color="#ffffff" size="2" face="arial" style="text-decoration:none">X</font></a>
+ </td>
+ </tr>
+ <tr>
+ <td width="100%" bgcolor="#FFFFFF" style="padding:4px" colspan="2">
+ <!-- place your HTML content here-->
+ <h3>Background color selector</h3>
+ <input id="hashCode" style="position: absolute; right: 15px; top: 239px;" size="8" class="color" value="#FF0000" type="text" />
+ <input type="button" value="Submit & Close" onClick="document.forma.dashBgColor1.value=document.getElementById('hashCode').value; javascript:ToggleFloatingLayer('FloatingLayer',0);"/>
+
+
+ <!-- End of content area -->
+ </td>
+ </tr>
+ </table></td>
+ </tr>
+ </table>
+</div>
+<!-- End Floating layer -->
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_filters_edit.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_filters_edit.jsp
new file mode 100644
index 00000000..7589f73f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_filters_edit.jsp
@@ -0,0 +1,320 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.ColFilterType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %>
+<%@ page errorPage="error_page.jsp" %>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+ String reportID = rdef.getReportID();
+
+ boolean isEdit = curSubStep.equals(AppConstants.WSS_EDIT);
+
+ String filterId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID);
+ String colId = isEdit?filterId.substring(0, filterId.indexOf('|')):null;
+ int filterPos = -1;
+ if(isEdit)
+ try {
+ filterPos = Integer.parseInt(filterId.substring(colId.length()+1));
+ } catch(NumberFormatException e) {}
+
+ DataColumnType currColumn = isEdit?rdef.getColumnById(colId):null;
+ ColFilterType currFilter = isEdit?rdef.getFilterById(colId, filterPos):null;
+
+ String arg = null; %>
+
+<script language="JavaScript">
+<!--
+function showFormFieldPopup() {
+ var w = window.open("", "filterPopup", "width=400,height=400,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+
+ w.document.writeln("<html><head>");
+ w.document.writeln("<title>Form Fields</title>");
+ w.document.writeln("<link rel=stylesheet type=text/css href='<%= AppUtils.getBaseFolderURL() %>css/raptor.css'>");
+ w.document.writeln("<script language=JavaScript>");
+ w.document.writeln("function setValue(newValue, fieldType) {");
+ w.document.writeln(" window.opener.document.forma.argValue.value = newValue;");
+ w.document.writeln(" window.opener.document.forma.formFieldType.value = fieldType;");
+ w.document.writeln(" window.close();");
+ w.document.writeln("} // setValue");
+ w.document.writeln("</"+"script>");
+ w.document.writeln("</head><body>");
+
+ w.document.writeln("<table width=94% border=0 cellspacing=1 align=center>");
+ w.document.writeln(" <tr class=rbg1>");
+ w.document.writeln(" <td height=30>&nbsp;</td>");
+ w.document.writeln(" <td><b class=rtableheader>Report Form Fields</b></td>");
+ w.document.writeln(" </tr>");
+<% int iCnt = 0;
+ if(rdef.getFormFieldList()!=null)
+ for(Iterator iter=rdef.getFormFieldList().getFormField().iterator(); iter.hasNext(); iCnt++) {
+ FormFieldType fft = (FormFieldType) iter.next(); %>
+ w.document.writeln(" <tr<%= (iCnt%2==0)?" class=rbg8":"" %>>");
+ w.document.writeln(" <td align=center valign=middle height=30><font class=rtabletext><%= (iCnt+1) %></font></td>");
+ w.document.writeln(" <td valign=middle>");
+ w.document.writeln(" <b class=rtabletext><a href=\"javascript:setValue('[<%= fft.getFieldName() %>]', '<%= fft.getFieldType() %>')\"><%= fft.getFieldName() %></a></b>");
+ w.document.writeln(" </td>");
+ w.document.writeln(" </tr>");
+<% } // for
+ if(iCnt==0) { %>
+ w.document.writeln(" <tr class=rbg3 height=30>");
+ w.document.writeln(" <td colspan=2 align=center valign=middle><b class=rtabletext>There are no form fields defined</b></td>");
+ w.document.writeln(" </tr>");
+ w.document.writeln(" <tr>");
+ w.document.writeln(" <td colspan=2 align=center><br><input type=Submit class=Button value=Close onClick=\"window.close();\"></td>");
+ w.document.writeln(" </tr>");
+<% } else { %>
+ w.document.writeln(" <tr class=rbg1 height=30>");
+ w.document.writeln(" <td>&nbsp;</td>");
+ w.document.writeln(" <td>&nbsp;</td>");
+ w.document.writeln(" </tr>");
+<% } // if
+%>
+ w.document.writeln("</table>");
+
+ w.document.writeln("</body></html>");
+ w.document.close();
+} // showFormFieldPopup
+
+function showArgPopup() {
+ var argType = document.forma.argType.options[document.forma.argType.selectedIndex].value;
+ if(argType=="<%= AppConstants.AT_FORMULA %>") {
+ alert("Please select Argument Type to be one of the following:\n - Simple Value\n - Another Column\n - List of Values\n - Run-time Form Field");
+ document.forma.argType.focus();
+ return;
+ }
+
+ if(argType=="<%= AppConstants.AT_FORM %>") {
+ showFormFieldPopup();
+ return;
+ }
+
+<% if(isEdit) { %>
+ var colId = "<%= colId %>";
+<% } else { %>
+ var colId = document.forma.filterColId.options[document.forma.filterColId.selectedIndex].value;
+<% } %>
+
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.filter."+((argType=="<%= AppConstants.AT_COLUMN %>")?"col":"data&<%= AppConstants.RI_ARG_TYPE %>="+argType+"&<%= AppConstants.RI_COLUMN_ID %>="+colId)+"&<%= AppConstants.RI_JS_TARGET_FIELD %>=document.forma.argValue&<%= AppConstants.RI_RESET_PARAMS %>=Y", "filterPopup", "width=440,height=400,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showArgPopup
+//-->
+</script>
+
+
+<table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %> - <%= curSubStep %></b></td>
+ </tr>
+<% if((isEdit?filterPos:rdef.getAllFilters().size())==0) { %>
+ <input type="hidden" name="filterJoin" value="AND">
+<% } else { %>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Join Condition: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <% arg = (request.getParameter("filterJoin")!=null)?request.getParameter("filterJoin"):(isEdit?currFilter.getJoinCondition():""); %>
+ <select name="filterJoin">
+ <option value="AND"<%= arg.equals("AND")?" selected":"" %>>AND
+ <option value="OR"<%= arg.equals("OR") ?" selected":"" %>>OR
+ </select></font></td>
+ </tr>
+<% } %>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Opening Brackets: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <% arg = (request.getParameter("openBrackets")!=null)?request.getParameter("openBrackets"):(isEdit?nvl(currFilter.getOpenBrackets()):""); %>
+ <select name="openBrackets">
+ <option value=""<%= arg.equals("") ?" selected":"" %>>
+ <option value="("<%= arg.equals("(") ?" selected":"" %>>(
+ <option value="(("<%= arg.equals("((") ?" selected":"" %>>((
+ <option value="((("<%= arg.equals("(((") ?" selected":"" %>>(((
+ <option value="(((("<%= arg.equals("((((") ?" selected":"" %>>((((
+ <option value="((((("<%= arg.equals("(((((")?" selected":"" %>>(((((
+ </select></font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30" style="background-image:url(<%= AppUtils.getImgFolderURL() %>required.gif); background-position:top right; background-repeat:no-repeat;"><font class=rtabletext>Filter By Column: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <% if(isEdit) { %>
+ <%= currColumn.getDisplayName() %>
+ <input type="hidden" name="filterColId" value="<%= colId %>">
+ <input type="hidden" name="filterPos" value="<%= filterPos %>">
+ <% } else { %>
+ <select name="filterColId">
+<% int iCount = 0;
+ List reportCols = rdef.getAllColumns();
+ for(Iterator iter=reportCols.iterator(); iter.hasNext(); iCount++) {
+ DataColumnType dct = (DataColumnType) iter.next(); %>
+ <option value="<%= dct.getColId() %>"<%= ((request.getParameter("filterColId")==null)?(iCount==0):dct.getColId().equals(request.getParameter("filterColId")))?" selected":"" %>><%= dct.getDisplayName() %>
+<% } // for
+%>
+ </select>
+ <% } %>
+ </font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Expression: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <% arg = (request.getParameter("filterExpr")!=null)?request.getParameter("filterExpr"):(isEdit?currFilter.getExpression():""); %>
+ <select name="filterExpr">
+ <option value="="<%= arg.equals("=") ?" selected":"" %>>=
+ <option value="&lt;&gt;"<%= arg.equals("<>") ?" selected":"" %>>&lt;&gt;
+ <option value="&gt;"<%= arg.equals(">") ?" selected":"" %>>&gt;
+ <option value="&gt;="<%= arg.equals(">=") ?" selected":"" %>>&gt;=
+ <option value="&lt;"<%= arg.equals("<") ?" selected":"" %>>&lt;
+ <option value="&lt;="<%= arg.equals("<=") ?" selected":"" %>>&lt;=
+ <option value="LIKE"<%= arg.equals("LIKE") ?" selected":"" %>>LIKE
+ <option value="IS NULL"<%= arg.equals("IS NULL") ?" selected":"" %>>IS NULL
+ <option value="IS NOT NULL"<%= arg.equals("IS NOT NULL")?" selected":"" %>>IS NOT NULL
+ <option value="IN"<%= arg.equals("IN") ?" selected":"" %>>IN (list)
+ <option value="NOT IN"<%= arg.equals("NOT IN") ?" selected":"" %>>NOT IN (list)
+ </select></font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Argument Type: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <% arg = (request.getParameter("argType")!=null)?request.getParameter("argType"):(isEdit?nvl(currFilter.getArgType()):""); %>
+ <select name="argType" onChange="document.forma.formFieldType.value=''; if(options[selectedIndex].value=='<%= AppConstants.AT_COLUMN %>') document.forma.argValue.value='';">
+ <option value="<%= AppConstants.AT_VALUE %>"<%= arg.equals(AppConstants.AT_VALUE) ?" selected":"" %>>Simple Value
+ <option value="<%= AppConstants.AT_COLUMN %>"<%= arg.equals(AppConstants.AT_COLUMN) ?" selected":"" %>>Another Column
+ <option value="<%= AppConstants.AT_FORMULA %>"<%= arg.equals(AppConstants.AT_FORMULA)?" selected":"" %>>Expression
+ <option value="<%= AppConstants.AT_LIST %>"<%= arg.equals(AppConstants.AT_LIST) ?" selected":"" %>>List of Values
+ <option value="<%= AppConstants.AT_FORM %>"<%= arg.equals(AppConstants.AT_FORM) ?" selected":"" %>>Run-time Form Field
+ </select></font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Argument Value: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <% String argValue = nvl(request.getParameter("argValue"), isEdit?(nvl(currFilter.getArgType()).equals(AppConstants.AT_COLUMN)?"["+rdef.getColumnById(currFilter.getArgValue()).getDisplayName()+"]":nvl(currFilter.getArgValue())):"");
+ String formFieldType = "";
+ if(arg.equals(AppConstants.AT_FORM)&&rdef.getFormFieldList()!=null)
+ for(Iterator iter=rdef.getFormFieldList().getFormField().iterator(); iter.hasNext(); iCnt++) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ if(argValue.equals("["+fft.getFieldName()+"]")) {
+ formFieldType = fft.getFieldType();
+ break;
+ } // if
+ } // for
+ %>
+ <input type="hidden" name="formFieldType" value="<%= formFieldType %>">
+ <input type="text" size="30" name="argValue" class=rtabletext value="<%= argValue %>"
+ onFocus="if(document.forma.argType.options[document.forma.argType.selectedIndex].value=='<%= AppConstants.AT_COLUMN %>') blur();" onChange="document.forma.formFieldType.value='';"></font>
+ <a href="javascript:showArgPopup()"><img border="0" src="<%= AppUtils.getImgFolderURL() %>shareicon.gif" alt="Select from list" width="12" height="12"></a>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Closing Brackets: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <% arg = (request.getParameter("closeBrackets")!=null)?request.getParameter("closeBrackets"):(isEdit?nvl(currFilter.getCloseBrackets()):""); %>
+ <select name="closeBrackets">
+ <option value=""<%= arg.equals("") ?" selected":"" %>>
+ <option value=")"<%= arg.equals(")") ?" selected":"" %>>)
+ <option value="))"<%= arg.equals("))") ?" selected":"" %>>))
+ <option value=")))"<%= arg.equals(")))") ?" selected":"" %>>)))
+ <option value="))))"<%= arg.equals("))))") ?" selected":"" %>>))))
+ <option value=")))))"<%= arg.equals(")))))")?" selected":"" %>>)))))
+ </select></font></td>
+ </tr>
+</table>
+<br>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+ var selExpr = "";
+ selExpr = document.forma.filterExpr.options[document.forma.filterExpr.selectedIndex].value;
+ var selArgType = "";
+ selArgType = document.forma.argType.options[document.forma.argType.selectedIndex].value;
+
+ var isListArgument = false;
+ if(selArgType=="<%= AppConstants.AT_LIST %>")
+ isListArgument = true;
+
+ var isFormSingleValueArgument = false; // text with popup, drop-down, list-box and radio-buttons are always single value
+ var isFormMultiValueArgument = false; // check boxes and multi-select list box are always multi-value; text box and text area can be either
+ var isFormArgument = false; // text box and text area can be used for both single-value and multi-value
+ if(selArgType=="<%= AppConstants.AT_FORM %>") {
+ isFormArgument = true;
+
+ if( document.forma.formFieldType.value=="<%= FormField.FFT_TEXT_W_POPUP %>"||
+ document.forma.formFieldType.value=="<%= FormField.FFT_COMBO_BOX %>"||
+ document.forma.formFieldType.value=="<%= FormField.FFT_LIST_BOX %>"||
+ document.forma.formFieldType.value=="<%= FormField.FFT_RADIO_BTN %>")
+ isFormSingleValueArgument = true;
+
+ if( document.forma.formFieldType.value=="<%= FormField.FFT_CHECK_BOX %>"||
+ document.forma.formFieldType.value=="<%= FormField.FFT_LIST_MULTI %>")
+ isFormMultiValueArgument = true;
+ } // if
+
+ if((selExpr!="IS NULL")&&(selExpr!="IS NOT NULL")) {
+ if((selExpr=="IN")||(selExpr=="NOT IN")) {
+ if(! (isListArgument||(isFormArgument&&(! isFormSingleValueArgument)))) {
+ alert("This expression requires argument which is List of Values.\nPlease either select the argument type List of Values or\nselect argument type Run-time Form Field and then select Form Field which is Text Box, Text Area, Check Boxes or Multi-select List Box.");
+ document.forma.argValue.focus();
+ document.forma.argValue.select();
+
+ return false;
+ }
+ } else
+ if(isListArgument||(isFormArgument&&isFormMultiValueArgument)) {
+ alert("This expression cannot have argument type List of Values.\nPlease select another argument type.\n\nNote: Form Field which is Check Boxes or Multi-select List Box is also considered to be List of Values.");
+ document.forma.argValue.focus();
+ document.forma.argValue.select();
+
+ return false;
+ }
+
+ if(selArgType!="<%= AppConstants.AT_FORM %>")
+ if(document.forma.argValue.value=="") {
+ alert("Please provide argument value");
+ document.forma.argValue.focus();
+ document.forma.argValue.select();
+
+ return false;
+ }
+ } // if
+
+ return true;
+} // dataValidate
+//-->
+</script>
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_filters_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_filters_list.jsp
new file mode 100644
index 00000000..71898b35
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_filters_list.jsp
@@ -0,0 +1,115 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.ColFilterType" %>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+ String reportID = rdef.getReportID();
+%>
+<table class="mTAB" width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=8 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+ <tr class=rbg1>
+ <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>&nbsp;&nbsp;No&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="10%"><b class=rtableheader>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="5%"><b class=rtableheader>&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="33%"><b class=rtableheader>Column</b></td>
+ <td align="center" valign="Middle" width="26%"><b class=rtableheader>Filter</b></td>
+ <td align="center" valign="Middle" width="5%"><b class=rtableheader>&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="14%" colspan=2><input type="button" class=button value="Add" border="0" width="71" height="28" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD %>';document.forma.submit()"></td>
+ </tr>
+<% int iCount = 0;
+ int iPos = 0;
+ int nOpenBrackets = 0;
+ int nCloseBrackets = 0;
+ String colId = "";
+ List reportFilters = rdef.getAllFilters();
+ for(Iterator iter=reportFilters.iterator(); iter.hasNext(); iCount++, iPos++) {
+ ColFilterType cft = (ColFilterType) iter.next();
+
+ nOpenBrackets += nvl(cft.getOpenBrackets()).length();
+ nCloseBrackets += nvl(cft.getCloseBrackets()).length();
+
+ if(! colId.equals(cft.getColId()))
+ iPos = 0;
+ colId = cft.getColId(); %>
+ <tr class=<%=(iCount % 2 == 0)?"rowalt1":"rowalt2"%>>
+ <td align="center" height="30"><font class=rtabletext><%= iCount+1 %></font></td>
+ <td align="center"><font class=rtabletext><%= iCount>0?cft.getJoinCondition():"&nbsp;" %></font></td>
+ <td align="center"><font class=rtabletext><%= nvl(cft.getOpenBrackets(), "&nbsp;") %></font></td>
+ <td><font class=rtabletext><%= rdef.getColumnById(colId).getDisplayName() %></font></td>
+ <td><font class=rtabletext><%= HTMLEncode(rdef.getFilterLabel(cft)) %></font></td>
+ <td align="center"><font class=rtabletext><%= nvl(cft.getCloseBrackets(), "&nbsp;") %></font></td>
+ <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>pen_paper.gif" alt="Edit" width="12" height="12" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_EDIT %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= colId+"|"+iPos %>';"></td>
+ <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! confirm('Are you sure you want to remove this filter?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= colId+"|"+iPos %>'; }"></td>
+ </tr>
+<% } // for
+ if(iCount==0) { %>
+ <tr class=rbg2>
+ <td colspan=8 align="center" height="30"><font class=rtabletext>No filters defined</font></td>
+ </tr>
+<% } %>
+</table>
+<br>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+<% if(nOpenBrackets!=nCloseBrackets) { %>
+ alert("The number of opening brackets (<%= nOpenBrackets %>) must be equal to the number of closing brackets (<%= nCloseBrackets %>).");
+ return false;
+<% } %>
+ return true;
+} // dataValidate
+//-->
+</script>
+
+<%!
+ private String HTMLEncode(String value) {
+ StringBuffer sb = new StringBuffer(value);
+
+ for(int i=0; i<sb.length(); i++)
+ if(sb.charAt(i)=='<')
+ sb.replace(i, i+1, "&lt;");
+ else if(sb.charAt(i)=='>')
+ sb.replace(i, i+1, "&gt;");
+ else if(sb.charAt(i)=='"')
+ sb.replace(i, i+1, "&quot;");
+
+ return sb.toString();
+ } // HTMLEncode
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_form_fields_edit.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_form_fields_edit.jsp
new file mode 100644
index 00000000..185f65c1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_form_fields_edit.jsp
@@ -0,0 +1,771 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.ReportWrapper" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %>
+<%@ page import="java.text.SimpleDateFormat"%>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+ String reportID = rdef.getReportID();
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
+ String dependsOnHelp = "Custom SQL can be defined";
+%>
+
+<% String[] dateFormats = { "MM/DD/YYYY", "MM/YYYY", "DD-MON-YYYY", "Month DD, YYYY", "Month, YYYY" };
+ String[] charFormats = { "N/A" };
+
+ boolean isEdit = curSubStep.equals(AppConstants.WSS_EDIT);
+ FormFieldType currField = null;
+ if(isEdit)
+ currField = rdef.getFormFieldById(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+
+ String currColId = (currField!=null)?nvl(currField.getColId()):"";
+ String remoteDbPrefix = (String) session.getAttribute("remoteDB");
+
+ String colTableName = null;
+ String colColumnName = null;
+ String colDisplayFormat = null;
+ String colDisplayName = null;
+ if(isSQLBased)
+ if(currColId.length()>0) {
+ colTableName = ReportWrapper.getSQLBasedFFTColTableName(currColId);
+ colColumnName = ReportWrapper.getSQLBasedFFTColColumnName(currColId);
+ colDisplayFormat = ReportWrapper.getSQLBasedFFTColDisplayFormat(currColId);
+
+ if(currColId.indexOf("|")>=0)
+ currColId = currColId.substring(0, currColId.indexOf('|'));
+ colDisplayName = colColumnName;
+ //colDisplayName = currColId.substring(currColId.indexOf('.')+1);
+ } %>
+
+<script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/editabledropdown.js"></script>
+<script language="JavaScript">
+
+<!--
+var fieldColName = "";
+
+ function toggleDiv(isChecked) {
+ if(isChecked) {
+ if(document.getElementById('showDefaultSql'))
+ document.getElementById('showDefaultSql').style.display="";
+ if(document.getElementById('showDefaultValue'))
+ document.getElementById('showDefaultValue').style.display="none";
+ if(document.forma.defaultValue)
+ document.forma.defaultValue.value="";
+ } else {
+ if(document.getElementById('showDefaultSql'))
+ document.getElementById('showDefaultSql').style.display="none";
+ if(document.getElementById('showDefaultValue'))
+ document.getElementById('showDefaultValue').style.display="";
+ if(document.getElementById('showDefaultSql') && document.forma.fieldDefaultSQL)
+ document.forma.fieldDefaultSQL.value="";
+ }
+
+ }
+
+ function toggleFieldTypeSelection() {
+ var selectBox = document.forma.fieldType;
+ var selectedString = "";
+ if(selectBox)
+ selectedString = selectBox.options[selectBox.selectedIndex].value;
+ else {
+ <% if(currField!=null) { %>
+ selectString = '<%=currField.getFieldType()%>';
+ <% } %>
+ }
+
+ if(selectedString == '<%= FormField.FFT_LIST_MULTI %>'){
+ document.getElementById('multiSelectListSizeDiv').style.display="block";
+ } else {
+ document.getElementById('multiSelectListSizeDiv').style.display="none";
+ document.getElementById('multiSelectListSize').value="4";
+ }
+ }
+
+<% if(isSQLBased) { %>
+function showTableColsPopup() {
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.table.cols&single_value=Y&return_table_name=Y&return_col_type=Y&remoteDbPrefix=<%=remoteDbPrefix%>", "tableColsPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showTableColsPopup
+
+function setDisplayTypeValues(dbType) {
+ if(document.forma.colType.value!=dbType) {
+ document.forma.colType.value = dbType;
+
+ document.forma.displayFormat.options.length = 0;
+
+ if(document.forma.colType.value=="<%= AppConstants.CT_DATE %>") {
+ <% for(int i=0; i<dateFormats.length; i++) { %>
+ document.forma.displayFormat.options[<%= i %>] = new Option("<%= dateFormats[i] %>", "<%= dateFormats[i] %>");
+ <% } %>
+ } else {
+ <% for(int i=0; i<charFormats.length; i++) { %>
+ document.forma.displayFormat.options[<%= i %>] = new Option("<%= charFormats[i] %>", "<%= charFormats[i].equals("N/A")?"":charFormats[i] %>");
+ <% } %>
+ } // else
+
+ document.forma.displayFormat.selectedIndex = 0;
+
+ if(document.layers)
+ history.go(0);
+ } // if
+} // setDisplayTypeValues
+
+function addText(newValue) {
+ var newText = "";
+ if(newValue.indexOf("|")<0)
+ newText = newValue;
+ else {
+ setDisplayTypeValues(newValue.substring(newValue.lastIndexOf("|")+1));
+ newText = newValue.substring(0, newValue.lastIndexOf("|"));
+ } // else
+
+ document.getElementById('fieldColId').value = newText;
+
+ var newFieldColName = "";
+ newFieldColName = newText.substring(newText.lastIndexOf(".")+1);
+
+ if(document.getElementById('fieldName').value==""||document.getElementById('fieldName').value==fieldColName)
+ document.getElementById('fieldName').value = newFieldColName;
+ fieldColName = newFieldColName;
+} // addText
+
+function clearText() {
+ document.getElementById('fieldColId').value = "";
+} // clearText
+
+<% } else { %>
+function changeColId() {
+ var newFieldColName = document.getElementById('fieldColId').options[document.getElementById('fieldColId').selectedIndex].text;
+ if(document.getElementById('fieldColId').selectedIndex>0&&(document.getElementById('fieldName').value==""||document.getElementById('fieldName').value==fieldColName))
+ document.getElementById('fieldName').value = newFieldColName;
+ fieldColName = newFieldColName;
+} // changeColId
+
+function showDefaultValuePopup() {
+ if(document.getElementById('fieldColId').selectedIndex==0) {
+ alert("The assistance is available only if this field is based on a column.\nYou can select a column from the list or just type a default value.");
+ document.getElementById('fieldColId').focus();
+ return;
+ } // if
+
+ var colId = document.getElementById('fieldColId').options[document.getElementById('fieldColId').selectedIndex].value;
+
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.filter.data&<%= AppConstants.RI_ARG_TYPE %>=<%= AppConstants.AT_VALUE %>&<%= AppConstants.RI_COLUMN_ID %>="+colId+"&<%= AppConstants.RI_JS_TARGET_FIELD %>=document.forma.defaultValue&<%= AppConstants.RI_RESET_PARAMS %>=Y", "defaultValuePopup", "width=440,height=400,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showDefaultValuePopup
+<% } // else if(isSQLBased)
+%>
+
+function showTestRunSQLPopup() {
+ //var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.testrun.sql&<%= AppConstants.RI_FORMATTED_SQL %>="+escape(""+document.getElementById('fieldSQL').value)+"&<%= AppConstants.RI_CHK_FIELD_SQL %>=Y", "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.field.testrun.jsp", "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showTestRunSQLPopup
+
+function showTestRunDefaultSQLPopup() {
+ //var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.testrun.sql&<%= AppConstants.RI_FORMATTED_SQL %>="+escape(""+document.getElementById('fieldSQL').value)+"&<%= AppConstants.RI_CHK_FIELD_SQL %>=Y", "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.field.default.testrun.jsp", "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showTestRunDefaultSQLPopup
+
+function showStartDatetRunSQLPopup( ) {
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.field.date.start.testrun.jsp", "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showTestRunRangeSQLPopup
+
+function showEndDateRunSQLPopup( ) {
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.field.date.end.testrun.jsp", "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+}
+function setDefaultVerifyFlag() {
+ document.forma.fieldDefaultSQLOrig.value = document.forma.fieldDefaultSQL.value;
+} // setDefaultVerifyFlag
+
+function setVerifyFlag() {
+ document.forma.fieldSQLOrig.value = document.getElementById('fieldSQL').value;
+} // setVerifyFlag
+
+function showSQLInstructions() {
+ var w = window.open("", "instrPopup", "width=400,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+
+ w.document.writeln("<html><head>");
+ w.document.writeln("<title>Form Field SQL Instructions</title>");
+ w.document.writeln("<link rel=stylesheet type=text/css href='<%= AppUtils.getBaseFolderURL() %>css/raptor.css'>");
+ w.document.writeln("</head><body>");
+
+ w.document.writeln("<table width=94% border=0 cellspacing=1 cellpadding=3 align=center>");
+ w.document.writeln(" <tr class=rbg1 height=30>");
+ w.document.writeln(" <td><b class=rtableheader>Form Field SQL Instructions</b></td>");
+ w.document.writeln(" </tr>");
+ w.document.writeln(" <tr class=rbg3 align=center valign=middle>");
+ w.document.writeln(" <td align=left valign=middle><font class=rtabletext>");
+ w.document.writeln(" The SQL result set must have a column <b>id</b> and a column <b>name</b>. ");
+ w.document.writeln(" If selecting date values in visual report, the <b>id</b> must be formatted <b>MM/DD/YYYY</b>; the <b>name</b> can use any display format. ");
+ w.document.writeln(" Example:<br><br><b>SELECT DISTINCT</b><br> ");
+ w.document.writeln(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TO_CHAR(t.start_date, 'MM/DD/YYYY') <b>id</b>,<br> ");
+ w.document.writeln(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TO_CHAR(t.start_date, 'Month YYYY') <b>name</b><br> ");
+ w.document.writeln(" &nbsp;&nbsp;&nbsp;&nbsp;<b>FROM</b><br> ");
+ w.document.writeln(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;my_table t<br> ");
+ w.document.writeln(" &nbsp;&nbsp;&nbsp;&nbsp;<b>WHERE</b><br> ");
+ w.document.writeln(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t.start_date IS NOT NULL<br> ");
+ w.document.writeln(" &nbsp;&nbsp;&nbsp;&nbsp;<b>ORDER BY</b><br> ");
+ w.document.writeln(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t.start_date DESC");
+ w.document.writeln(" </font></td>");
+ w.document.writeln(" </tr>");
+ w.document.writeln(" <tr class=rbg1 height=30>");
+ w.document.writeln(" <td>&nbsp;</td>");
+ w.document.writeln(" </tr>");
+ w.document.writeln(" <tr>");
+ w.document.writeln(" <td align=center><br><input type=Submit class=Button value=Close onClick=\"window.close();\"></td>");
+ w.document.writeln(" </tr>");
+ w.document.writeln("</table>");
+
+ w.document.writeln("</body></html>");
+ w.document.close();
+} // showSQLInstructions
+
+function showRangeSQLInstructions() {
+ var w = window.open("", "instrPopup", "width=400,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+
+ w.document.writeln("<html><head>");
+ w.document.writeln("<title>Form Field Range SQL Instructions</title>");
+ w.document.writeln("<link rel=stylesheet type=text/css href='<%= AppUtils.getBaseFolderURL() %>css/raptor.css'>");
+ w.document.writeln("</head><body>");
+
+ w.document.writeln("<table width=94% border=0 cellspacing=1 cellpadding=3 align=center>");
+ w.document.writeln(" <tr class=rbg1 height=30>");
+ w.document.writeln(" <td><b class=rtableheader>Form Field Range SQL Instructions</b></td>");
+ w.document.writeln(" </tr>");
+ w.document.writeln(" <tr class=rbg3 align=center valign=middle>");
+ w.document.writeln(" <td align=left valign=middle><font class=rtabletext>");
+ w.document.writeln(" The SQL should ALWAYS return a valid Oralce date. If the return is not a valid date, the range will not be set.<br>");
+ w.document.writeln(" The SQL will always get precedence over the static values.<br>");
+ w.document.writeln(" ");
+ w.document.writeln(" Example:<br><br><b>SELECT</b> SYSDATE<br> ");
+ w.document.writeln(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>FROM</b> DUAL");
+ w.document.writeln(" </font></td>");
+ w.document.writeln(" </tr>");
+ w.document.writeln(" <tr class=rbg1 height=30>");
+ w.document.writeln(" <td>&nbsp;</td>");
+ w.document.writeln(" </tr>");
+ w.document.writeln(" <tr>");
+ w.document.writeln(" <td align=center><br><input type=Submit class=Button value=Close onClick=\"window.close();\"></td>");
+ w.document.writeln(" </tr>");
+ w.document.writeln("</table>");
+
+ w.document.writeln("</body></html>");
+ w.document.close();
+} // showRangeSQLInstructions
+//-->
+</script>
+
+
+<table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %> - <%= curSubStep %></b></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30" style="background-image:url(<%= AppUtils.getImgFolderURL() %>required.gif); background-position:top right; background-repeat:no-repeat;"><font class=rtabletext>Field Name: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <input type="text" style="width: 100px;" class="rtabletext" size="30" maxlength="30" id="fieldName" name="fieldName" value="<%= isEdit?currField.getFieldName():"" %>"></font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Based On Column: </font></td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+<% if(isSQLBased) { %>
+ <input type=text style="width: 100px;" class="rtabletext" size=50 id="fieldColId" name="fieldColId" value="<%= currColId %>" onFocus="blur()">
+ <a href="javascript:showTableColsPopup()"><img border=0 src="<%= AppUtils.getImgFolderURL() %>shareicon.gif" alt="Select database column" width=12 height=12></a>
+<% } else { %>
+ <select name="fieldColId" class="rtabletext" onChange="changeColId()" style="width: 100px;" >
+ <option value=""<%= currColId.equals("")?" selected":"" %>>--- None ---
+<% int iCount = 0;
+ List reportCols = rdef.getAllColumns();
+ for(Iterator iter=reportCols.iterator(); iter.hasNext(); iCount++) {
+ DataColumnType dct = (DataColumnType) iter.next(); %>
+ <option value="<%= dct.getColId() %>"<%= currColId.equals(dct.getColId())?" selected":"" %>><%= dct.getDisplayName() %>
+<% if(currColId.equals(dct.getColId()))
+ colDisplayName = dct.getDisplayName();
+ } // for
+%>
+ </select>
+<% } // else if(isSQLBased)
+ if(colDisplayName!=null) { %>
+<script language="JavaScript">
+<!--
+fieldColName = "<%= colDisplayName %>";
+//-->
+</script>
+<% } // if
+%>
+ </font>
+ </td>
+ </tr>
+<% if(isSQLBased) {
+ String colType = AppConstants.CT_CHAR;
+ if(colTableName!=null&&colColumnName!=null)
+ try {
+ colType = nvl(DataCache.getReportTableDbColumnType(colTableName, colColumnName,((String) session.getAttribute("remoteDB"))), AppConstants.CT_CHAR);
+ } catch(Exception e) {}
+
+ String[] fmt;
+ if(colType.equals(AppConstants.CT_DATE))
+ fmt = dateFormats;
+ else
+ fmt = charFormats; %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Display Format: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="displayFormat" style="width: 100px;" >
+ <% for(int i=0; i<fmt.length; i++) { %>
+ <option value="<%= fmt[i].equals("N/A")?"":fmt[i] %>"<%= (nvl(colDisplayFormat).toUpperCase().equals(fmt[i].toUpperCase()))?" selected":"" %>><%= fmt[i] %>
+ <% } %>
+ </select>
+ <input type="hidden" name="colType" value="<%= colType %>">
+ </font></td>
+ </tr>
+<% } // if
+%>
+
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Visible? </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="visible" style="width: 100px;" >
+ <option value="Y"<%= isEdit?(nvl(currField.getVisible(),"Y").startsWith("Y")?" selected":""):" selected" %>>Yes
+ <option value="N"<%= (isEdit&&(! nvl(currField.getVisible(),"Y").startsWith("Y")))?" selected":"" %>>No
+ </select></font></td>
+ </tr>
+ <% if(Globals.getAllowSQLBasedReports() || AppUtils.isAdminUser(request)) { %>
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Is used in Group By Clause?</font>
+ </td>
+ <td class=rbg3 align="left" nowrap>
+ <input type="checkbox" name="isGroupFormField" value="Y" <%=(currField!=null && (currField.isGroupFormField()!=null && currField.isGroupFormField().booleanValue()))?" checked":"" %>>
+ </td>
+ </tr>
+ <% } %>
+
+
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Field Type: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <% String curValue = nvl((currField!=null)?currField.getFieldType():"", FormField.FFT_TEXT_W_POPUP); %>
+ <select name="fieldType" onChange="toggleFieldTypeSelection()" style="width: 100px;" >
+ <%--<option value="<%= FormField.FFT_TEXT_W_POPUP %>"<%= curValue.equals(FormField.FFT_TEXT_W_POPUP)?" selected":"" %>>Text Box with Popup --%>
+ <option value="<%= FormField.FFT_TEXT %>"<%= curValue.equals(FormField.FFT_TEXT )?" selected":"" %>>Text Box
+ <%--<option value="<%= FormField.FFT_TEXTAREA %>"<%= curValue.equals(FormField.FFT_TEXTAREA )?" selected":"" %>>Text Area--%>
+ <%--<option value="<%= FormField.FFT_COMBO_BOX %>"<%= curValue.equals(FormField.FFT_COMBO_BOX )?" selected":"" %>>Drop-Down List--%>
+ <option value="<%= FormField.FFT_LIST_BOX %>"<%= curValue.equals(FormField.FFT_LIST_BOX )?" selected":"" %>>List Box
+ <%--<option value="<%= FormField.FFT_RADIO_BTN %>"<%= curValue.equals(FormField.FFT_RADIO_BTN )?" selected":"" %>>Radio Buttons
+ <option value="<%= FormField.FFT_CHECK_BOX %>"<%= curValue.equals(FormField.FFT_CHECK_BOX )?" selected":"" %>>Check Boxes --%>
+ <option value="<%= FormField.FFT_LIST_MULTI %>"<%= curValue.equals(FormField.FFT_LIST_MULTI )?" selected":"" %>>Multi-select List Box
+ <option value="<%= FormField.FFT_HIDDEN %>"<%= curValue.equals(FormField.FFT_HIDDEN )?" selected":"" %>>Hidden
+ </select>
+ </font></td>
+ </tr>
+
+ <tr id="multiSelectListSizeDiv">
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Visible Size: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select id="multiSelectListSize" name="multiSelectListSize" onKeyDown="fnKeyDownHandler(this, event);" onKeyUp="fnKeyUpHandler_A(this, event); return false;" onKeyPress = "return fnKeyPressHandler_A(this, event);" onChange="fnChangeHandler_A(this, event);">
+ <option value="1"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("1")?" selected":"" )%>>1
+ <option value="2"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("2")?" selected":"" )%>>2
+ <option value="3"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("3")?" selected":"" )%>>3
+ <option value="4"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("4")?" selected":"" )%>>4
+ <option value="5"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("5")?" selected":"" )%>>5
+ <option value="6"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("6")?" selected":"" )%>>6
+ <option value="7"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("7")?" selected":"" )%>>7
+ <option value="8"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("8")?" selected":"" )%>>8
+ <option value="9"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("9")?" selected":"" )%>>9
+ <option value="10"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("10")?" selected":"" )%>>10
+ <option value="" style="COLOR:#ff0000;BACKGROUND-COLOR:#ffff00;">Custom</option> <!-- This is the Editable Option -->
+ <% if(currField!=null && isNumber(nvl(currField.getMultiSelectListSize())) && new Integer(nvl(currField.getMultiSelectListSize(), "0")).intValue() <= 20) {
+ %>
+ <option value="<%=nvl(currField.getMultiSelectListSize())%>" selected><%=nvl(currField.getMultiSelectListSize())%></option> <!-- This is the Editable Option -->
+ <%
+ }
+ %>
+ </select>
+ </font></td>
+ </tr>
+
+ <%if(! isSQLBased) { %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Default Value: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <input type="text" class="rtabletext" size="20" maxlength="50" name="defaultValue" value="<%= isEdit?nvl(currField.getDefaultValue()):"" %>"></font>
+ <a href="javascript:showDefaultValuePopup()"><img border="0" src="<%= AppUtils.getImgFolderURL() %>shareicon.gif" alt="Select from list" width="12" height="12"></a>
+ </td></tr>
+ <% } else { %>
+ <% if(Globals.getAllowSQLBasedReports() || AppUtils.isAdminUser(request)) { %>
+
+ <tr>
+ <td class=rbg2 height="30" align="right">
+ <font class=rtabletext>Is Default Value should be SQL</font>
+ </td>
+ <td class=rbg3 align="left" nowrap>
+ <input type="checkbox" id="isDefaultSQL" name="isDefaultSQL" value="N" <%=currField!=null && currField.getFieldDefaultSQL()!=null && currField.getFieldDefaultSQL().length()>0?" checked":"" %> onClick="toggleDiv(this.checked)">
+ </td>
+ </tr>
+
+
+ <tbody id="showDefaultSql" style="display:none;">
+ <tr>
+ <td class=rbg2 height="30" align="right">Default SQL: </td>
+ <td class=rbg3>
+ <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top" rowspan="2">
+ <input type="hidden" name="fieldDefaultSQLOrig" value="<%= (currField!=null)?nvl(currField.getFieldDefaultSQL()):"" %>">
+ <textarea class="buttonLabelField" name="fieldDefaultSQL" cols="40" rows="3"><%= (currField!=null)?nvl(currField.getFieldDefaultSQL()):"" %></textarea>
+ </td>
+ <td align="center" valign="top">&nbsp;<input type="Button" att-button btn-type="primary" size="small" class=button value="Verify SQL" onClick="if(document.forma.fieldDefaultSQL.value=='') {alert('Please provide SQL.'); return false; } showTestRunDefaultSQLPopup();">&nbsp;</td>
+ <td rowspan="2" width="60%">&nbsp;</td></tr><tr>
+ <td align="center" valign="middle">&nbsp;<a href="javascript:showSQLInstructions()" class=rtabletext>Instructions</a>&nbsp;</td>
+ </tr></table>
+ </td>
+ </tr>
+ </tbody>
+ <% if(Globals.getAllowSQLBasedReports() || AppUtils.isAdminUser(request)) { %>
+ <script language="Javascript">
+ toggleDiv(document.getElementById('isDefaultSQL').checked);
+ </script>
+ <% } %>
+ <% } // if admin user %>
+ <tbody id="showDefaultValue">
+ <tr>
+ <td class=rbg2 height="30" align="right"> Default Value: </td>
+ <td class=rbg3>
+ <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top" rowspan="2">
+ <input type="text" style="width:200px" class="rtabletext" size="20" maxlength="50" name="defaultValue" value="<%= isEdit?nvl(currField.getDefaultValue()):"" %>"></font>
+ </td>
+ </tr></table>
+ </td>
+ </tr>
+ </tbody>
+ <% if(Globals.getAllowSQLBasedReports() || AppUtils.isAdminUser(request)) { %>
+ <script language="Javascript">
+ toggleDiv(document.getElementById('isDefaultSQL').checked);
+ </script>
+ <% } %>
+ <% } //else %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Verify Field Value As: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <% curValue = nvl((currField!=null)?currField.getValidationType():"", FormField.VT_NONE); %>
+ <select name="validation" onChange="if (this.value =='<%= FormField.VT_DATE%>') ; else dateRangeRow.style.display='none'" style="width: 200px;" >
+ <option value="<%= FormField.VT_NONE %>"<%= curValue.equals(FormField.VT_NONE )?" selected":"" %>>--- Do Not Perform Validation ---
+ <option value="<%= FormField.VT_DATE %>"<%= curValue.equals(FormField.VT_DATE )?" selected":"" %>>Date
+ <option value="<%= FormField.VT_TIMESTAMP_HR %>"<%= curValue.equals(FormField.VT_TIMESTAMP_HR )?" selected":"" %>>TimeStamp (Hour)
+ <option value="<%= FormField.VT_TIMESTAMP_MIN %>"<%= curValue.equals(FormField.VT_TIMESTAMP_MIN )?" selected":"" %>>TimeStamp (Hour, Min)
+ <option value="<%= FormField.VT_TIMESTAMP_SEC %>"<%= curValue.equals(FormField.VT_TIMESTAMP_SEC )?" selected":"" %>>TimeStamp (Hour, Min, Sec)
+ <option value="<%= FormField.VT_INT %>"<%= curValue.equals(FormField.VT_INT )?" selected":"" %>>Integer
+ <option value="<%= FormField.VT_INT_NON_NEGATIVE %>"<%= curValue.equals(FormField.VT_INT_NON_NEGATIVE )?" selected":"" %>>Positive Integer
+ <option value="<%= FormField.VT_INT_POSITIVE %>"<%= curValue.equals(FormField.VT_INT_POSITIVE )?" selected":"" %>>Positive Integer, Cannot Be Zero
+ <option value="<%= FormField.VT_FLOAT %>"<%= curValue.equals(FormField.VT_FLOAT )?" selected":"" %>>Any Number
+ <option value="<%= FormField.VT_FLOAT_NON_NEGATIVE %>"<%= curValue.equals(FormField.VT_FLOAT_NON_NEGATIVE)?" selected":"" %>>Positive Number
+ <option value="<%= FormField.VT_FLOAT_POSITIVE %>"<%= curValue.equals(FormField.VT_FLOAT_POSITIVE )?" selected":"" %>>Positive Number, Cannot Be Zero
+ </select></font>
+ </td>
+ </tr>
+ <tr id="dateRangeRow" <%if(curValue.equals(FormField.VT_DATE) || curValue.equals(FormField.VT_TIMESTAMP_HR) || curValue.equals(FormField.VT_TIMESTAMP_MIN) || curValue.equals(FormField.VT_TIMESTAMP_SEC)){%><%}else{%>style="display:none"<%}%>>
+ <td colspan="2" class=rbg2>
+ <table width="100%">
+ <tr>
+ <td class=rbg2 align="right" width="33%" height="30"><font class=rtabletext>Valid Date Range: </font></td>
+ <td width="15%" align="left">
+ <font class=rtabletext >From </font>
+ </td>
+ <td align="left">
+ <font class=rtabletext >To </font>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <a href="javascript:showRangeSQLInstructions()" class=rtabletext>Instructions</a>&nbsp;
+ </td>
+
+ </tr>
+ <tr>
+ <td class=rbg2 align="right"></td>
+ </td>
+ <td width="15%" align="left">
+ <input type="hidden" name="rangeStartDateSQLOrig" value="<%= (currField!=null)?nvl(currField.getRangeStartDateSQL()):"" %>">
+ <textarea name="rangeStartDateSQL" class="rtabletext" style="width: 200px;height: 100px" cols="20" rows="3"><%= (currField!=null)?nvl(currField.getRangeStartDateSQL()):"" %></textarea>
+
+ </td>
+ <td align="left">
+ <input type="hidden" name="rangeEndDateSQLOrig" value="<%= (currField!=null)?nvl(currField.getRangeEndDateSQL()):"" %>">
+ <textarea name="rangeEndDateSQL" class="rtabletext" style="width: 200px;height: 100px" cols="20" rows="3"><%= (currField!=null)?nvl(currField.getRangeEndDateSQL()):"" %></textarea>
+
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right"></td>
+ </td>
+ <td width="15%" align="left">
+ <input type="Button" class=button att-button btn-type="primary" size="small" value="Verify SQL" onClick="if(document.forma.rangeStartDateSQL.value=='') {alert('Please provide SQL.'); return false; } showStartDatetRunSQLPopup();">&nbsp;</td>
+ </td>
+ <td align="left">
+ <input type="Button" class=button att-button btn-type="primary" size="small" value="Verify SQL" onClick="if(document.forma.rangeEndDateSQL.value=='') {alert('Please provide SQL.'); return false; } showEndDateRunSQLPopup();">&nbsp;</td>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right"></td>
+ <td class=rbg3 align="left">
+ <% String stDate = "";
+ String endDate = "";
+ if (currField!= null
+ && currField.getRangeStartDate() != null && currField.getRangeStartDate().equals("") == false
+ && currField.getRangeEndDate() != null && currField.getRangeEndDate().equals("") == false){
+ SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
+ stDate = dtf.format(currField.getRangeStartDate().toGregorianCalendar().getTime());
+ endDate = dtf.format(currField.getRangeEndDate().toGregorianCalendar().getTime());
+ }
+ %>
+ <input type="text" class="rtabletext" size="10" maxlength="10" style="width: 100px;" name="rangeStartDate" id="rangeStartDate" value="<%=stDate%>">
+ <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20" onClick="oCalendar.select(document.getElementById('rangeStartDate'),event,'MM/dd/yyyy'); return false;" style="cursor:hand">
+
+
+ </td>
+ <td>
+ <input type="text" class="rtabletext" size="10" maxlength="10" style="width: 100px;" name="rangeEndDate" id="rangeEndDate" value="<%=endDate%>">
+ <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20" onClick="oCalendar.select(document.getElementById('rangeEndDate'),event,'MM/dd/yyyy'); return false;" style="cursor:hand">
+ </td>
+ </tr>
+
+ </table>
+ </td>
+
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>&nbsp; </font></td>
+ <td class=rbg3 align="left">
+ <% curValue = nvl((currField!=null)?currField.getMandatory():"", "N"); %>
+ <input type="Checkbox" class="checkbox" name="mandatory" value="Y"<%= curValue.equals("Y")?" checked":"" %>>
+ <font class=rtabletext>User must provide value for this field</font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Field Help Text: </font></td>
+ <td class=rbg3 align="left">
+ <textarea name="fieldHelp" style="width: 100px;" class="rtabletext" cols="40" rows="3"><%= (currField!=null)?nvl(currField.getComment()):"" %></textarea>
+ </td>
+ </tr>
+<% if(Globals.getAllowSQLBasedReports()||AppUtils.isAdminUser(request)) { %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>SQL Generating Custom List of Values: <br>(overrides default list) </font></td>
+ <td class=rbg3 align="left">
+ <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top" rowspan="2">
+ <input type="hidden" name="fieldSQLOrig" value="<%= (currField!=null)?nvl(currField.getFieldSQL()):"" %>">
+ <textarea id="fieldSQL" name="fieldSQL" class="rtabletext" cols="40" rows="3"><%= (currField!=null)?nvl(currField.getFieldSQL()):"" %></textarea>
+ </td>
+ <td align="center" valign="top">&nbsp;<input type="Button" class=button att-button btn-type="primary" size="small" value="Verify SQL" onClick="if(document.getElementById('fieldSQL').value=='') {alert('Please provide SQL.'); return false; } showTestRunSQLPopup();">&nbsp;</td>
+ <td rowspan="2" width="60%">&nbsp;</td></tr><tr>
+ <td align="center" valign="middle">&nbsp;<a href="javascript:showSQLInstructions()" class=rtabletext>Instructions</a>&nbsp;</td>
+ </tr></table>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"></td>
+ <td class=rbg3 align="left">
+ <% curValue = nvl((currField!=null)?currField.getDependsOn():"", "N"); %>
+ <font class=rtabletext><input id='dependsOn' type="checkbox" name="dependsOn" value="Y"<%= curValue.equals("Y") ? "checked":"" %>>
+ <label title="<%=dependsOnHelp%>" style="cursor: pointer;" for="dependsOn">Depends on another Form Field.</label>
+ </td>
+ </tr>
+<% } else { %>
+ <input type="hidden" id="fieldSQL" name="fieldSQL" value="<%= (currField!=null)?nvl(currField.getFieldSQL()):"" %>">
+<% } %>
+<% List predefinedValues = (currField!=null&&currField.getPredefinedValueList()!=null)?currField.getPredefinedValueList().getPredefinedValue():null; %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Provide Predefined List of Values:</font></td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <% if(predefinedValues==null||predefinedValues.size()==0) { %>
+ Do not use Predefined list - Generate list from database
+ <% } else {
+ String value = (String) predefinedValues.get(0); %>
+ <%= value %>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! dataValidate()) {return false;} else if(! confirm('Are you sure?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_USER %>'; document.forma.delPredefinedValue.value='<%= value %>'; }">
+ <% } %>
+ </font></td>
+ </tr>
+<% if(predefinedValues!=null&&predefinedValues.size()>1)
+ for(int i=1; i<predefinedValues.size(); i++) {
+ String value = (String) predefinedValues.get(i); %>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>&nbsp;</font></td>
+ <td class=rbg3 align="left" nowrap><font class=rtabletext>
+ <%= value %>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! dataValidate()) {return false;} else if(! confirm('Are you sure?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_USER %>'; document.forma.delPredefinedValue.value='<%= value %>'; }">
+ </font></td>
+ </tr>
+<% } // for
+%>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>&nbsp; </font></td>
+ <td class=rbg3 align="left" valign="middle" nowrap><font class=rtabletext>
+ <input type="hidden" name="delPredefinedValue" value="">
+ <input type="text" style="width: 200px;" size="20" maxlength="50" name="newPredefinedValue" value="">
+ <input type="Submit" att-button btn-type="primary" size="small" class=button value="Add To List" onClick="if(document.forma.newPredefinedValue.value=='') {alert('Value cannot be empty.'); return false; } if(! stepDataValidate(false)) return false; <%= (predefinedValues==null||predefinedValues.size()==0)?"if(! confirm('If you create a list of predefined values, it will be displayed instead of the list selected from the database.\\nAre you sure you want to do that?')) return false; ":"" %>document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_USER %>';">
+ </font></td>
+ </tr>
+</table>
+<br>
+
+<script language="JavaScript">
+<!--
+function stepDataValidate(checkCol) {
+ if(document.getElementById('fieldName').value=="") {
+ alert("Please enter Field Name");
+ document.getElementById('fieldName').focus();
+ document.getElementById('fieldName').select();
+
+ return false;
+ } // if
+
+<% if(rdef.getFormFieldList()!=null) { %>
+ if(false
+<% for(Iterator iter=rdef.getFormFieldList().getFormField().iterator(); iter.hasNext(); ) {
+ FormFieldType fft = (FormFieldType) iter.next();
+
+ if(! (isEdit&&fft.getFieldId().equals(currField.getFieldId()))) { %>
+ ||(document.getElementById('fieldName').value=="<%= fft.getFieldName() %>")
+<% }
+ } %>
+ ) {
+ alert("Form field with name "+document.getElementById('fieldName').value+" already exists.\nPlease select another name.");
+ document.getElementById('fieldName').focus();
+ document.getElementById('fieldName').select();
+
+ return false;
+ }
+<% } %>
+
+<% if(predefinedValues==null||predefinedValues.size()==0) { %>
+ if(checkCol)
+ if(document.getElementById('fieldColId').selectedIndex==0)
+ if(document.forma.fieldType.selectedIndex!=1&&document.forma.fieldType.selectedIndex!=2) {
+ alert("Field Type can be only Text Box or Text Area if this field is not based on a column.\nPlease change the Field Type or select a column from the list.");
+ document.forma.fieldType.focus();
+
+ return false;
+ } // if
+<% } %>
+
+<% if((Globals.getAllowSQLBasedReports()||AppUtils.isAdminUser(request)) && (rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED))) { %>
+ if(document.forma.fieldSQL.value!=""&&document.forma.fieldSQL.value!=document.forma.fieldSQLOrig.value) {
+ alert("You must verify the SQL.");
+ document.forma.fieldSQL.focus();
+ document.forma.fieldSQL.select();
+
+ return false;
+ } // if
+ if(document.forma.fieldDefaultSQL.value!=""&&document.forma.fieldDefaultSQL.value!=document.forma.fieldDefaultSQLOrig.value) {
+ alert("You must verify the Default SQL.");
+ document.forma.fieldDefaultSQL.focus();
+ document.forma.fieldDefaultSQL.select();
+
+ return false;
+ } // if
+ if(document.forma.fieldSQL.value.length<=0 && document.forma.fieldDefaultSQL.value.length > 1 ) {
+ alert("SQL Field cannot be empty when Default sql has value.");
+ return false;
+ }
+<% } %>
+
+if(document.getElementById('multiSelectListSize') && document.getElementById('multiSelectListSize').options.selectedIndex == 0) {
+ if(!checkNonNegativeInteger(document.forma.multiSelectListSize.options[document.forma.multiSelectListSize.options.selectedIndex].text)) {
+ alert("Please enter number in Multi Select List Size. No Characters are allowed.");
+ return false;
+ } else {
+ if(document.getElementById('multiSelectListSize').options[document.getElementById('multiSelectListSize').options.selectedIndex].text>20) {
+ alert("Please not only 20 items are allowed in Multi-Select form field.");
+ return false;
+ }
+ document.getElementById('multiSelectListSize').options[document.getElementById('multiSelectListSize').options.selectedIndex].value=document.getElementById('multiSelectListSize').options[document.getElementById('multiSelectListSize').options.selectedIndex].text;
+ }
+}
+
+ return true;
+} // dataValidate
+
+function dataValidate() {
+ return stepDataValidate(true);
+} // dataValidate
+
+toggleFieldTypeSelection();
+//-->
+</script>
+
+<script type="text/javascript" src="<%= AppUtils.getBaseFolderURL() %>js/CalendarPopup.js"></script>
+<link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/calendar.css">
+<iframe id="calendarFrame" class="nav" z-index:199; scrolling="no" frameborder="0" width=165px height=165px src="" style="position:absolute; display:none;">
+</iframe>
+<div id="calendarDiv" name="calendarDiv" style="position:absolute; z-index:20000; visibility:hidden; background-color:white;layer-background-color:white;"></div>
+
+ <SCRIPT LANGUAGE="JavaScript">
+ var oCalendar = new CalendarPopup("calendarDiv", "calendarFrame");
+ oCalendar.setCssPrefix("raptor");
+ </SCRIPT>
+
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+ private boolean isNumber(String value) { // As per Raptor def, like
+
+ // -$3,270.56
+ value = value.trim();
+ if(value.length()>2) return false;
+ for (int i = 0; i < value.length(); i++) {
+ char c = value.charAt(i);
+ if (!(Character.isDigit(c) || c == '.' || c == '-' || c == '+' || c == ','
+ || c == '$' || c == '%'))
+ return false;
+ } // for
+
+ return true;
+ } // isNumber
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_form_fields_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_form_fields_list.jsp
new file mode 100644
index 00000000..8470dbbc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_form_fields_list.jsp
@@ -0,0 +1,107 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%@page import="org.openecomp.portalsdk.analytics.model.runtime.FormField"%>
+<%@page import="org.openecomp.portalsdk.analytics.system.Globals"%>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+
+%>
+
+<table class=mTAB width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=5 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+ <tr class=rbg1>
+ <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>&nbsp;&nbsp;No&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="72%"><b class=rtableheader>Field Name</b></td>
+ <td align="center" valign="Middle" width="7%"><b class=rtableheader>Re-order</b></td>
+ <td align="center" valign="Middle" width="14%" colspan=2>
+ <button type="submit" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD %>';document.forma.submit()" border="0" width="40" height="28" att-button btn-type="primary" size="small" title='Add'>Add</button>
+ <button type="submit" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WSS_ADD_BLANK %>';document.forma.submit()" border="0" width="40" height="28" att-button btn-type="primary" size="small" title='Add Blank'>Add Blank</button>
+ </td>
+ </tr>
+<% int iCount = 0;
+ if(rdef.getFormFieldList()!=null)
+ for(Iterator iter=rdef.getFormFieldList().getFormField().iterator(); iter.hasNext(); iCount++) {
+ FormFieldType fft = (FormFieldType) iter.next(); %>
+ <tr class=<%=(iCount % 2 == 0)?"rowalt1":"rowalt2"%>>
+ <td align="center" height="30"><font class=rtabletext><%= iCount+1 %><!--fft.getOrderBySeq(): <%= fft.getOrderBySeq() %>--></font></td>
+ <td><font class=rtabletext><%= fft.getFieldName() %>&nbsp;[<%= fft.getFieldId()%>]</font></td>
+ <td align="center" nowrap>
+<% if(iCount==0) { %>
+ <img border="0" src="<%= AppUtils.getImgFolderURL() %>columnblankdown.gif" width="25" height="7">
+<% } else { %>
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>columnup.gif" width="25" height="7" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_MOVE_UP %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= fft.getFieldId() %>';">
+<% } %>
+<% if(iCount==rdef.getFormFieldList().getFormField().size()-1) { %>
+ <img border="0" src="<%= AppUtils.getImgFolderURL() %>columnblankup.gif" width="25" height="7">
+<% } else { %>
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>columndown.gif" width="25" height="7" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_MOVE_DOWN %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= fft.getFieldId() %>';">
+<% } %>
+ </td>
+
+ <td align="center">
+ <%if(!fft.getFieldType().equals(FormField.FFT_BLANK)) { %>
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>pen_paper.gif" alt="Edit" width="12" height="12" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_EDIT %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= fft.getFieldId() %>';">
+ <% } else { %> &nbsp;
+ <% } %>
+ </td>
+ <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! confirm('Are you sure you want to delete form field <%= fft.getFieldName() %> from the report?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= fft.getFieldId() %>'; }"></td>
+ </tr>
+<% } // for
+ if(iCount==0) { %>
+ <tr class=rbg2>
+ <td colspan=5 align="center" height="30"><font class=rtabletext>No form fields defined</font></td>
+ </tr>
+<% } %>
+</table>
+<% if(Globals.customizeFormFieldInfo()) { %>
+<% if(rdef.getFormFieldList()!=null) { %>
+<table class=mTAB width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr><td class=rbg1 valign="middle"><b class=rtableheader> Defining the Information Bar </b></td></tr>
+ <tr><td align="center">
+ <textarea name="blueBarField" id="blueBarField" rows="20" cols="200" style="width: 200px"><%= nvl(rdef.getFormFieldList().getComment()).length()>0?rdef.getFormFieldList().getComment():""%></textarea>
+ </td></tr>
+ <tr><td align="center">
+ <button type="submit" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WSS_INFO_BAR %>';document.forma.submit()" att-button btn-type="primary" size="small" title='Submit'>Submit</button>
+ </td></tr>
+ </table>
+<% } %>
+<% } %>
+<br>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+ return true;
+} // dataValidate
+//-->
+</script>
+
+<%! private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_javascript.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_javascript.jsp
new file mode 100644
index 00000000..d225cb56
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_javascript.jsp
@@ -0,0 +1,167 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants"%>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence"%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType"%>
+<%@ page import="java.util.Iterator"%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.JavascriptItemType"%>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils"%>
+
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ FormFieldType fft = null;
+ boolean isFormfieldPresent = (rdef.getFormFieldList()!=null && rdef.getFormFieldList().getFormField().size()<=0);
+%>
+
+<table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 valign="top"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - <%= ws.getCurrentStep() %> Wizard <%= isFormfieldPresent?" <a href=\"javascript:uitmpl_qh('javascript_text'); if(typeof window.parent.resizeWindow == 'function') window.parent.resizeWindow();\" class=\"qh-link\" style=\"position:fixed;\"></a>":""%></b></td>
+ </tr>
+ <% if(isFormfieldPresent) { %>
+ <tr>
+ <td class="nopad"><!-- quick help text -->
+ <div id="javascript_text" class="mQH">
+ <p><span class="label">Form Field Information:<BR></span>
+ <table>
+ <%
+
+ for(Iterator iter1=rdef.getFormFieldList().getFormField().iterator(); iter1.hasNext();) {
+ fft = (FormFieldType) iter1.next();
+ %>
+
+ <%= "<TR><TD align=\"right\">" + fft.getFieldName() +":</TD><TD>&nbsp;</TD><TD>document.formd." + fft.getFieldId()+"</TD></TR>" %>
+ <% }
+ %>
+ </table>
+ </p>
+ </div>
+ <!-- /quick help text --></td>
+ </tr>
+ <% } %>
+ <tr>
+ <td width="65%" class=rbg3 align="center">
+ <textarea name="<%= AppConstants.RI_JAVASCRIPT%>" cols="100" rows="30"><%= (rdef.getJavascriptElement()!=null)?rdef.getJavascriptElement():"" %></textarea>
+ </td>
+ </tr>
+ <tr>
+ <table class=mTAB width="100%" class="tableBorder" border="3" cellspacing="1" cellpadding="3" align=center>
+ <tr class=rbg1>
+ <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>&nbsp;&nbsp;No&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="7%"><b class=rtableheader>Form Field</b></td>
+ <td align="center" valign="Middle" width="72%"><b class=rtableheader>Calling Javascript</b></td>
+ <td align="center" valign="Middle" width="14%">
+ &nbsp;
+ </td>
+ </tr>
+ <%
+ int iCount = 0;
+ String javascriptFieldId = "";
+ String id = "";
+ String callText = "";
+
+ int count = 0;
+ if(rdef.getJavascriptList()!=null ) {
+ for(Iterator iter=rdef.getJavascriptList().getJavascriptItem().iterator(); iter.hasNext(); ) {
+ count++;
+ JavascriptItemType javascriptItem = (JavascriptItemType) iter.next();
+ id = javascriptItem.getId();
+ javascriptFieldId = javascriptItem.getFieldId();
+ callText = javascriptItem.getCallText();
+ %>
+ <tr class=<%=(count%2==0)?"rowalt2":"rowalt1"%>>
+ <td align="center" height="30"><font class=rtabletext><%= ++iCount %></font></td>
+ <td align="center" >
+ <select name="javascriptFormField-<%=id %>" style="width: 100px">
+ <option value="-1"> <-- SELECT --> </option>
+ <option value="ol1" <%= ("ol1".equals(javascriptFieldId))?" selected":""%>>OnLoad</option>
+ <option value="os1" <%= ("os1".equals(javascriptFieldId))?" selected":""%>>OnSubmit</option>
+
+
+ <%
+ if(rdef.getFormFieldList()!=null){
+ for(Iterator iter1=rdef.getFormFieldList().getFormField().iterator(); iter1.hasNext();) {
+ fft = (FormFieldType) iter1.next();
+ %>
+ <option value="<%=fft.getFieldId() %>" <%= (fft.getFieldId().equals(javascriptFieldId))?" selected":""%>><%=fft.getFieldName() %></option>
+ <%
+ }
+ }
+ %>
+
+ </select>
+ </td>
+ <td align="center">
+ <textarea name="callText-<%=id %>" rows="3" cols="100"><%=callText %></textarea>
+ </td>
+ <td width="30%">
+ <button type="submit" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_SAVE %>'; document.forma.<%=AppConstants.RI_JAVASCRIPT_ITEM_ID %>.value='<%= id %>'; document.forma.submit();" width="12" height="12" att-button btn-type="primary" size="small" title='Save'>Save</button>
+ <button type="submit" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE %>'; document.forma.<%=AppConstants.RI_JAVASCRIPT_ITEM_ID %>.value='<%= id %>'; document.forma.submit();" width="12" height="12" att-button btn-type="primary" size="small" title='Delete'>Delete</button>
+ </td>
+ </tr>
+ <% } %>
+ <% }
+
+ id = "-1";
+ %>
+ <tr class=rowalt1>
+ <td align="center" height="30"><font class=rtabletext><%= ++iCount %></font></td>
+ <td align="center">
+ <select name="javascriptFormField-<%=id %>" style="width: 100px">
+ <option value="-1"> <-- SELECT --> </option>
+ <option value="ol1">OnLoad</option>
+ <option value="os1">OnSubmit</option>
+
+ <%
+ if(rdef.getFormFieldList()!=null){
+ for(Iterator iter1=rdef.getFormFieldList().getFormField().iterator(); iter1.hasNext();) {
+ fft = (FormFieldType) iter1.next();
+ %>
+ <option value="<%=fft.getFieldId() %>"><%=fft.getFieldName() %></option>
+ <%
+ }
+ }
+ %>
+ </select>
+ </td>
+ <td align="center">
+ <textarea name="callText-<%=id %>" rows="3" cols="100"></textarea>
+ </td>
+ <td width="40%">
+ <button type="submit" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_SAVE %>'; document.forma.<%=AppConstants.RI_JAVASCRIPT_ITEM_ID %>.value='<%= id %>'; document.forma.submit();" width="12" height="12" att-button btn-type="primary" size="small" title='Save'>Save</button>
+ <button type="submit" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE %>'; document.forma.<%=AppConstants.RI_JAVASCRIPT_ITEM_ID %>.value='<%= id %>'; document.forma.submit();" width="12" height="12" att-button btn-type="primary" size="small" title='Delete'>Delete</button>
+ </td>
+ </tr>
+ </table>
+ </tr>
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+ return true;
+} // dataValidate
+//-->
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_log.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_log.jsp
new file mode 100644
index 00000000..2b170385
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_log.jsp
@@ -0,0 +1,109 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.ReportWrapper" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.Log" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportLogEntry" %>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+ String reportID = rdef.getReportID();
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
+
+%>
+
+<% String errorMsg = null;
+ Vector reportLogEntries = null;
+ try {
+ reportLogEntries = ReportLoader.loadReportLogEntries(reportID);
+ } catch(Exception e) {
+ Log.write("ERROR [wizard_log.jsp] Unable to load report log entries. Exception: "+e.getMessage());
+ errorMsg = "<b>ERROR: </b>Unable to load report log entries from the database <!--Exception: "+e.getMessage()+"-->";
+ } %>
+
+<table class="mTAB" width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=6 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+ <tr class=rbg1>
+ <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>&nbsp;&nbsp;No&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="31%"><b class=rtableheader>Date/Time</b></td>
+ <td align="center" valign="Middle" width="31%"><b class=rtableheader>User Name</b></td>
+ <td align="center" valign="Middle" width="31%"><b class=rtableheader>Action</b></td>
+ <td align="center" valign="Middle" width="31%"><b class=rtableheader>Execution Time</b></td>
+ <td align="center" valign="Middle" width="31%"><b class=rtableheader>Run</b></td>
+ </tr>
+<% int iCount = 0;
+ if(reportLogEntries!=null)
+ for(Iterator iter=reportLogEntries.iterator(); iter.hasNext(); iCount++) {
+ ReportLogEntry logEntry = (ReportLogEntry) iter.next(); %>
+ <tr <%= (iCount%2==0)?" class=rowalt1":" class=rowalt2" %>>
+ <td align="center" height="30" class="tdborder"><font class=rtabletext><%= iCount+1 %></font></td>
+ <td align="center" class="tdborder"><font class=rtabletext><%= logEntry.getLogTime() %></font></td>
+ <td class="tdborder"><font class=rtabletext><%= logEntry.getUserName() %></font></td>
+ <td class="tdborder"><font class=rtabletext><%= logEntry.getAction() %></font></td>
+ <td class="tdborder"><font class=rtabletext><%= logEntry.getTimeTaken() %></font></td>
+ <td class="tdborder"><font class=rtabletext><%= logEntry.getRunIcon() %></font></td>
+
+ </tr>
+<% } // for
+ if(errorMsg!=null) { %>
+ <tr class=rbg6>
+ <td colspan=6 align="center" height="30"><font class=rerrortextsm><%= errorMsg %></font></td>
+ </tr>
+<% } else if(iCount==0) { %>
+ <tr class=rbg2>
+ <td colspan=6 align="center" height="30"><font class=rtabletext>No log entries found</font></td>
+ </tr>
+<% } else { %>
+ <tr class=rbg1>
+ <td colspan=6 align="left" valign="Middle" height="30">
+ <input type="Submit" class=button value="Clear Log" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_USER %>';">
+ </td>
+ </tr>
+<% } // if
+%>
+</table>
+<br>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+ return true;
+} // dataValidate
+//-->
+</script>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_map.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_map.jsp
new file mode 100644
index 00000000..50fe1da6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_map.jsp
@@ -0,0 +1,424 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%@page import="org.openecomp.portalsdk.analytics.xmlobj.ReportMap"%>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
+ ReportMap repMap = rdef.getReportMap();
+ String addressColumn = "";
+ String latColumn = "";
+ String longColumn = "";
+ String legendColumn = "";
+ String colorColumn = "";
+ String dataColumn = "";
+ String isMapAllowed = "";
+ String addAddress = "N";
+ String useDefaultSize = "";
+ String width = "";
+ String height = "";
+
+ int reportMapSize = 0;
+ if (repMap != null){
+ if (repMap.getAddressColumn() != null)
+ addressColumn = repMap.getAddressColumn();
+
+ if (repMap.getDataColumn() != null)
+ dataColumn = repMap.getDataColumn();
+ if (repMap.getIsMapAllowedYN() != null)
+ isMapAllowed = repMap.getIsMapAllowedYN();
+ if (repMap.getAddAddressInDataYN() != null)
+ addAddress = repMap.getAddAddressInDataYN();
+ if (repMap.getLatColumn() != null)
+ latColumn = repMap.getLatColumn();
+ if (repMap.getLongColumn() != null)
+ longColumn = repMap.getLongColumn();
+ if (repMap.getColorColumn() != null)
+ colorColumn = repMap.getColorColumn();
+ if (repMap.getLegendColumn() != null)
+ legendColumn = repMap.getLegendColumn();
+ if (repMap.getUseDefaultSize() != null)
+ useDefaultSize = repMap.getUseDefaultSize();
+ if (repMap.getHeight() != null)
+ height = repMap.getHeight();
+ if (repMap.getWidth() != null)
+ width = repMap.getWidth();
+
+ reportMapSize = repMap.getMarkers().size();
+ }
+
+%>
+<%@page import="org.openecomp.portalsdk.analytics.xmlobj.Marker"%>
+
+<script>
+function enable_text(status)
+{
+//status=!status;
+document.forma.height.disabled = status;
+document.forma.width.disabled = status;
+}
+
+function isNumberKey(evt)
+{
+
+ if (document.forma.useDefaultSize.checked==true)
+ {
+ document.forma.height.disabled = status;
+ document.forma.width.disabled = status;
+ return false;
+ }
+
+ var charCode = (evt.which) ? evt.which : event.keyCode
+ if (charCode > 31 && (charCode < 48 || charCode > 57))
+ return false;
+
+ return true;
+}
+
+
+function checkValue()
+{
+
+ if (document.forma.isMapAllowed.checked==false)
+ {
+ return true;
+ }
+ if (document.forma.useDefaultSize.checked==true)
+ {
+ return true;
+ }
+ if ((document.forma.height.value < 1) )
+ {
+ alert(document.forma.height.name + ' can not be zero');
+ document.forma.height.focus(); return false;
+ }
+ if ((document.forma.width.value < 1) )
+ {
+ alert(document.forma.width.name + ' can not be zero');
+ document.forma.width.focus(); return false;
+ }
+ return true;
+}
+
+</script>
+<table class=mTAB width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=8 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+ <tr class=rbg1>
+
+ </tr>
+ <tr>
+ <td align="left" width="10%">Map Enabled ?</td>
+ <td colspan=8>
+ <input id = "isMapAllowed" name="isMapAllowed" type="checkbox" value="Y" <%if(isMapAllowed != null && isMapAllowed.equals("Y")){ %> checked <%} %>/>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="left" width="10%">Default Size ?</td>
+ <td width="15%">
+ <input id = "useDefaultSize" name="useDefaultSize" type="checkbox"
+ onclick="enable_text(this.checked)"
+ value="Y" <%if(useDefaultSize != null && useDefaultSize.equals("Y")){ %> checked <%} %>/>
+ </td>
+
+ <td align="left" width="10%">Height </td>
+ <td width="15%">
+ <input id = "height" name="height" onkeypress="return isNumberKey(event)" type="textbox" value="<%=height%> " />
+ <!--
+ <input id = "dummy" name=""dummy" type="textbox" visible="false" />
+ -->
+ <input type="hidden" name="checkbox" value="checked">
+ </td>
+
+ <td align="left" width="10%">Width </td>
+ <td width="15%">
+ <input id = "width" name="width" onkeypress="return isNumberKey(event)" type="textbox" value="<%=width%> " />
+ </td>
+ <td colspan="2">&nbsp;</td>
+ </tr>
+
+
+ <tr>
+ <td align="left" width="10%">Lat Column</td>
+ <td width="15%">
+ <select name="latColumn">
+ <option value=""> --Select-- </option>
+<%
+ int iCount = 0;
+ List reportCols = rdef.getAllColumns();
+ Iterator iter = reportCols.iterator();
+ for(; iter.hasNext(); iCount++) {
+ DataColumnType dct = (DataColumnType) iter.next();
+%>
+ <option value="<%= dct.getColId() %>" <%if(latColumn.equals(dct.getColId())){ %> selected <%}%> ><%= dct.getDisplayName() %></option>
+<%
+ }
+%>
+ </select>
+
+
+ </td>
+
+ <td align="left" width="10%">Long Column</td>
+ <td width="15%">
+ <select name="longColumn">
+ <option value=""> --Select-- </option>
+<%
+ iCount = 0;
+ iter = reportCols.iterator();
+ for(; iter.hasNext(); iCount++) {
+ DataColumnType dct = (DataColumnType) iter.next();
+%>
+ <option value="<%= dct.getColId() %>" <%if(longColumn.equals(dct.getColId())){ %> selected <%}%> ><%= dct.getDisplayName() %></option>
+<%
+ }
+%>
+ </select>
+
+
+ </td>
+ <td align="left" width="10%">Color Column</td>
+ <td width="15%">
+ <select name="colorColumn">
+ <option value=""> --Select-- </option>
+<%
+ iCount = 0;
+ iter = reportCols.iterator();
+ for(; iter.hasNext(); iCount++) {
+ DataColumnType dct = (DataColumnType) iter.next();
+%>
+ <option value="<%= dct.getColId() %>" <%if(colorColumn.equals(dct.getColId())){ %> selected <%}%> ><%= dct.getDisplayName() %></option>
+<%
+ }
+%>
+ </select>
+
+
+ </td>
+ <td align="left" width="10%">Legend Column</td>
+ <td width="15%">
+ <select name="legendColumn">
+ <option value=""> --Select-- </option>
+<%
+ iCount = 0;
+ iter = reportCols.iterator();
+ for(; iter.hasNext(); iCount++) {
+ DataColumnType dct = (DataColumnType) iter.next();
+%>
+ <option value="<%= dct.getColId() %>" <%if(legendColumn.equals(dct.getColId())){ %> selected <%}%> ><%= dct.getDisplayName() %></option>
+<%
+ }
+%>
+ </select>
+
+
+ </td>
+
+ </tr>
+ <tr>
+ <td align="left" width="10%">&nbsp;</td>
+ <td colspan=7>
+ <input type="button" value="Add Marker Details" onclick="javascript:createClicked();"/>
+ </td>
+ </tr>
+ <input type="hidden" name="markerCount" id="markerCount" value="<%=reportMapSize%>" />
+ <tr style="display:none;" id="cloneableRow">
+
+ <td align="left" width="10%">Data Header </td>
+ <td width="15%">
+ <input type="text" name="dataHeader" value="" />
+
+ </td>
+ <td align="left" width="10%">Display Column</td>
+ <td width="15%">
+ <select name="dataColumn">
+ <option value=""> --Select-- </option>
+<%
+ iCount = 0;
+ iter = reportCols.iterator();
+ for(; iter.hasNext(); iCount++) {
+ DataColumnType dct = (DataColumnType) iter.next();
+%>
+ <option value="<%= dct.getColId() %>" <%if(dataColumn.equals(dct.getColId())){ %> selected <%}%> ><%= dct.getDisplayName() %></option>
+<%
+ }
+%>
+ </select>
+
+
+ </td>
+ <td width="5%">
+ <img onclick="javascript:deleteRow(this);" height="12" alt="Remove" width="12" src="<%=AppUtils.getImgFolderURL()%>deleteicon.gif" border="0" value="" />
+ </td>
+ <td colspan="3">&nbsp;</td>
+ </tr>
+
+
+<% for (int i = 1; repMap != null && i < repMap.getMarkers().size(); i ++){
+ Marker marker = (Marker) repMap.getMarkers().get(i);
+%>
+ <tr>
+ <td align="left" width="10%">Data Header</td>
+ <td width="15%">
+ <input type="text" name="dataHeader<%=i%>" value="<%=marker.getDataHeader()%>" />
+ </td>
+
+ <td align="left" width="10%">Display Column</td>
+ <td width="15%">
+ <select name="dataColumn<%=i%>">
+ <option value=""> --Select-- </option>
+<%
+ iCount = 0;
+ iter = reportCols.iterator();
+ for(; iter.hasNext(); iCount++) {
+ DataColumnType dct = (DataColumnType) iter.next();
+%>
+ <option value="<%= dct.getColId() %>" <%if(marker.getDataColumn().equals(dct.getColId())){ %> selected <%}%> ><%= dct.getDisplayName() %></option>
+<%
+ }
+%>
+ </select>
+
+
+ </td>
+ <td width="5%">
+ <img onclick="javascript:deleteRow(this);" height="12" alt="Remove" width="12" src="<%=AppUtils.getImgFolderURL()%>deleteicon.gif" border="0" value="" />
+ </td>
+ <td colspan="3">&nbsp;</td>
+ </tr>
+ <%}%>
+
+
+
+</table>
+<br>
+
+<script >
+
+function createClicked() {
+ var alreadyEditable = "New";
+
+ var row = document.getElementById('cloneableRow');
+ var newR = duplicateRowByIndex(row, 0);
+ var tbl = getParentTable(newR);
+ var editIndex = 0;
+ if (document.all.markerCount != null || document.all.markerCount.value != ""){
+ editIndex = document.all.markerCount.value;
+ }
+ if (tbl.rows.length%2 == 0){
+ newR.className="alternateRow";
+ }
+ for (var xx = 0; xx < newR.cells.length; xx ++){
+ for (var yy=0; yy < newR.cells[xx].childNodes.length; yy++){
+ if (newR.cells[xx].childNodes[yy] != null
+ && newR.cells[xx].childNodes[yy].name){
+ newR.cells[xx].childNodes[yy].name = "" + newR.cells[xx].childNodes[yy].name + editIndex;
+ newR.cells[xx].childNodes[yy].id = newR.cells[xx].childNodes[yy].name ;
+ }
+ }
+ }
+ editIndex = parseInt(editIndex) + parseInt(1);
+ document.all.markerCount.value = editIndex;
+ newR.style.display = "block";
+ //document.getElementById('scrollableTable').scrollTop =0;
+ return false;
+}
+
+function deleteRow(item){
+ var row = getParentRow(item);
+ var tab = getParentTable(row);
+ tab.deleteRow(row.rowIndex);
+
+}
+
+duplicateRowByIndex = function()
+{
+ if(arguments.length == 0 ) { return };
+ pRow = arguments[0];
+ var tbl = getParentTable(pRow);
+ var newRowIndex = 1 ;
+ if(arguments[1] && parseInt(arguments[1]) != NaN )
+ {
+ newRowIndex = parseInt(arguments[1]);
+ if(newRowIndex == 0 ){ newRowIndex = tbl.rows.length - 1 ; }
+ }
+
+ if(pRow == null) { return ; }
+ var oldRow = pRow;
+ var newRow = oldRow.cloneNode(true);
+ if (arguments[1] == 0){
+ oldRow.parentNode.insertBefore(newRow, oldRow.nextSibling);
+ }
+ else{
+ oldRow.parentNode.insertBefore(newRow, tbl.rows[newRowIndex]);
+ }
+ newRow.id = "";
+ return newRow;
+}
+
+function getParentRow(cell)
+{
+ var pNode = cell.parentNode;
+ for( var xx = 0 ; xx < 10 ; xx++)
+ {
+ if(pNode.cells) { return pNode;}
+ else { pNode = pNode.parentNode; }
+ }
+ alert("Unable to find parent row"); return false;
+}
+
+function getParentTable(row)
+{
+ var pNode = row.parentNode;
+ for( var xx = 0 ; xx < 10 ; xx++)
+ {
+
+ if(pNode.rows && (pNode.tagName == "TABLE" || pNode.tagName == "table")) {return pNode;}
+ else { pNode = pNode.parentNode; }
+ }
+ alert("Unable to find parent table"); return false;
+}
+
+
+
+function dataValidate() {
+ return checkValue();
+ //return true;
+}
+
+</script>
+
+
+
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_run.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_run.jsp
new file mode 100644
index 00000000..688e7ff7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_run.jsp
@@ -0,0 +1,74 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+%>
+<script language="JavaScript">
+<!--
+function showSQLPopup() {
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.sql", "showSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showSQLPopup
+//-->
+</script>
+
+<table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+ <tr>
+ <td class=rbg2>
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td align="right" valign="middle" height="20" width="100%" nowrap>
+ <b class=rtabletext>
+ <a href="javascript:showSQLPopup()">SQL&nbsp;<img border="0" src="<%= AppUtils.getImgFolderURL() %>txt_icon.gif" alt="Click here to view the generated SQL" width="12" height="12"></a>&nbsp;
+ </b>
+ </td>
+ </tr>
+ <tr>
+ <td align="center" valign="middle" height="60" width="100%">
+ <font class=rtabletext>
+ <b>Report definition successfully completed.</b><br>
+ <br>
+ <input type="hidden" name="<%= AppConstants.RI_RESET_PARAMS %>" value="Y">
+ <input type="hidden" name="<%= AppConstants.RI_REFRESH %>" value="Y">
+ <a att-button btn-type="primary" size="small" href="report.htm#/report_run/c_master=<%=rdef.getReportID()%>&refresh=Y">Run</a>
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td height="20">&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+<br>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule.jsp
new file mode 100644
index 00000000..b8d1ad1c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule.jsp
@@ -0,0 +1,376 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="java.util.List" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportSchedule" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
+
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ ReportSchedule reportSchedule = rdef.getReportSchedule();
+ String remoteDbPrefix = (String) session.getAttribute("remoteDB");
+ boolean isSQLAllowed = Globals.getAllowSQLBasedReports();
+
+%>
+<%@page import="java.util.Calendar"%>
+<%@page import="java.text.DateFormat"%>
+<%@page import="java.text.SimpleDateFormat"%>
+<%@page import="java.util.TimeZone"%>
+<%@page import="java.util.Date"%>
+<%@page import="org.openecomp.portalsdk.analytics.model.ReportLoader"%>
+<script language="JavaScript">
+<!--
+function showTestConditionPopup() {
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.test.cond&remoteDbPrefix=<%=remoteDbPrefix%>&<%= AppConstants.RI_FORMATTED_SQL %>="+escape(""+document.forma.conditionSQL.value), "testCondSQLPopup", "width=450,height=180,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showTestConditionPopup
+
+function exclusiveCheckBox(which) {
+ var size = 2;
+ for (i=0; i<size; i++) {
+ if(document.getElementById("notify" + i) != which) {
+ document.getElementById("notify" + i).checked = false;
+ }
+ }
+ //alert("exclusive " + which.form.notify_type.value);
+}
+function initFormFields() {
+
+ var requestStr = "<%=reportSchedule.getFormFields()%>";
+ //alert(requestStr);
+ if(requestStr.length > 0) {
+ SplitName = requestStr.substring(1,requestStr.length).split("&");
+ for (num = 0; num < SplitName.length; num++) {
+ keyValue = SplitName[num].split("=");
+ //alert(keyValue[0]+ " " + keyValue[1]);
+ var obj = eval("document.forma."+keyValue[0]);
+ if(obj) {
+ if(obj.tagName == "SELECT") {
+ //var opt = document.getElementsByName(keyValue[0]);
+ var selString = "";
+ for (var intLoop=0; intLoop < obj.length; intLoop++) {
+ if (obj[intLoop].value == keyValue[1]) {
+ obj[intLoop].selected=true;
+ break;
+ }
+ }
+
+ } else
+ document.getElementsByName(keyValue[0])[0].value = unescape(keyValue[1]);
+ }
+ }
+}
+}
+//-->
+</script>
+<script language="javascript" src="<%= AppUtils.getBaseFolderURL() %>js/other_scripts.js"></script>
+<script type="text/javascript" src="<%= AppUtils.getBaseFolderURL() %>js/CalendarPopup.js"></script>
+<link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/calendar.css">
+ <iframe id="calendarFrame" class="nav" z-index:199; scrolling="no" frameborder="0" width=165px height=165px src="" style="position:absolute; display:none;">
+</iframe>
+ <div id="calendarDiv" name="calendarDiv" style="position:absolute; z-index:20000; visibility:hidden; background-color:white;layer-background-color:white;"></div>
+ <%
+ Calendar startCalendarDate = Calendar.getInstance();
+ startCalendarDate.add(Calendar.DAY_OF_MONTH, - 540);
+ Calendar endCalendarDate = Calendar.getInstance();
+ endCalendarDate.add(Calendar.DAY_OF_MONTH, 540);
+ SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
+ SimpleDateFormat oracleDateFormat = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss");
+ Date sysdate = oracleDateFormat.parse(ReportLoader.getSystemDateTime());
+ SimpleDateFormat dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern());
+ //dtimestamp.setTimeZone(TimeZone.getTimeZone(Globals.getTimeZone()));
+
+
+
+
+ %>
+
+ <SCRIPT LANGUAGE="JavaScript">
+ var oCalendar = new CalendarPopup("calendarDiv");
+
+ oCalendar.addDisabledDates(null, "<%=dtf.format(startCalendarDate.getTime())%>");
+ oCalendar.addDisabledDates("<%=dtf.format(endCalendarDate.getTime())%>", null);
+
+
+ oCalendar.setCssPrefix("raptor");
+ </SCRIPT>
+<table class=mSDL width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <% if(request.getAttribute("schedule_only")!=null) { %>
+ <tr>
+ <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+ <% } %>
+ <tr>
+ <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader><a href="javascript:uitmpl_qh('schedule_help')" class="qh-link"></a>Please enter Time in <%= Globals.getTimeZone()%>. The Current System Time is <%=dtimestamp.format(sysdate)%>&nbsp;<%=Globals.getTimeZone()%></b></td>
+ </tr>
+ <tr>
+ <td colspan=2 class="nopad"><!-- quick help text -->
+ <div id="schedule_help" class="mQH">
+ <p><span class="label">Quick Help:</span>
+ </p>
+ </div>
+ <!-- /quick help text --></td>
+ </tr>
+
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Schedule Emails: </font></td>
+ <td class=rbg3 align="left" width="50%" valign="middle" nowrap><font class=rtabletext>
+ <input type='radio' name='schedEnabled' id='schedEnabled' value='Y' <%= reportSchedule.getSchedEnabled().equals("Y")?" checked":"" %> />Yes
+ &nbsp;
+ <input type='radio' name='schedEnabled' id='schedEnabled' value='N' <%= reportSchedule.getSchedEnabled().equals("N")?" checked":"" %> />No
+ </font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Email Attachment:</font></td>
+ <td class=rbg3 align="left" width="50%" valign="middle" nowrap>
+ <font class=rtabletext>
+ <input type='radio' name='notify' id='notify' value='2' <%= reportSchedule.getNotify_type().equals("2")?" checked":(reportSchedule.getNotify_type().length()<=0)?" checked":(!reportSchedule.getNotify_type().equals("4"))? " checked " :"" %> />PDF Attachment
+ &nbsp;&nbsp;
+ <input type='radio' name='notify' id='notify' value='4' <%= reportSchedule.getNotify_type().equals("4")?" checked":"" %> />Excel Attachment
+ <input type='hidden' name='notify_type' value='1'/>
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Recurrence: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <select name="schedRecurrence">
+ <option value="" <%= reportSchedule.getRecurrence().equals("" )?" selected":"" %>>One Time
+ <option value="<%= AppConstants.SR_HOURLY %>"<%= reportSchedule.getRecurrence().equals(AppConstants.SR_HOURLY )?" selected":"" %>>Hourly
+ <option value="<%= AppConstants.SR_DAILY %>"<%= reportSchedule.getRecurrence().equals(AppConstants.SR_DAILY )?" selected":"" %>>Daily
+ <option value="<%= AppConstants.SR_DAILY_MO_FR %>"<%= reportSchedule.getRecurrence().equals(AppConstants.SR_DAILY_MO_FR)?" selected":"" %>>Daily Mo-Fr
+ <option value="<%= AppConstants.SR_WEEKLY %>"<%= reportSchedule.getRecurrence().equals(AppConstants.SR_WEEKLY )?" selected":"" %>>Weekly
+ <option value="<%= AppConstants.SR_MONTHLY %>"<%= reportSchedule.getRecurrence().equals(AppConstants.SR_MONTHLY )?" selected":"" %>>Monthly
+ </select></font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Start Date: </font></td>
+ <td class=rbg3 align="left" width="50%" nowrap><font class=rtabletext>
+ <input type="text" size="10" maxlength="10" name="schedStartDate" value="<%= reportSchedule.getStartDate() %>">
+ <!--<a href="#" onClick="window.dateField = document.forma.schedStartDate;calendar = window.open('<%= AppUtils.getRaptorActionURL() %>popup.calendar','cal','WIDTH=200,HEIGHT=250');return false;">
+ <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20">
+ </a>-->
+ <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20" onClick="oCalendar.select(document.getElementById('schedStartDate'),event,'MM/dd/yyyy'); return false;" style="cursor:hand">
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <select name="schedHour">
+ <option value="01"<%= reportSchedule.getRunHour().equals("01")?" selected":"" %>>1
+ <option value="02"<%= reportSchedule.getRunHour().equals("02")?" selected":"" %>>2
+ <option value="03"<%= reportSchedule.getRunHour().equals("03")?" selected":"" %>>3
+ <option value="04"<%= reportSchedule.getRunHour().equals("04")?" selected":"" %>>4
+ <option value="05"<%= reportSchedule.getRunHour().equals("05")?" selected":"" %>>5
+ <option value="06"<%= reportSchedule.getRunHour().equals("06")?" selected":"" %>>6
+ <option value="07"<%= reportSchedule.getRunHour().equals("07")?" selected":"" %>>7
+ <option value="08"<%= reportSchedule.getRunHour().equals("08")?" selected":"" %>>8
+ <option value="09"<%= reportSchedule.getRunHour().equals("09")?" selected":"" %>>9
+ <option value="10"<%= reportSchedule.getRunHour().equals("10")?" selected":"" %>>10
+ <option value="11"<%= reportSchedule.getRunHour().equals("11")?" selected":"" %>>11
+ <option value="12"<%= reportSchedule.getRunHour().equals("12")?" selected":"" %>>12
+ </select>
+ <select name="schedMin">
+ <option value="00"<%= reportSchedule.getRunMin().equals("00")?" selected":"" %>>00
+ <option value="15"<%= reportSchedule.getRunMin().equals("15")?" selected":"" %>>15
+ <option value="30"<%= reportSchedule.getRunMin().equals("30")?" selected":"" %>>30
+ <option value="45"<%= reportSchedule.getRunMin().equals("45")?" selected":"" %>>45
+ </select>
+ <select name="schedAMPM">
+ <option value="AM"<%= reportSchedule.getRunAMPM().equals("AM")?" selected":"" %>>AM
+ <option value="PM"<%= reportSchedule.getRunAMPM().equals("PM")?" selected":"" %>>PM
+ </select>
+
+ </font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>End Date: </font></td>
+ <td class=rbg3 align="left" width="50%" nowrap><font class=rtabletext>
+ <input type="text" size="10" maxlength="10" name="schedEndDate" value="<%= reportSchedule.getEndDate() %>">
+ <!--<a href="#" onClick="window.dateField = document.forma.schedEndDate;calendar = window.open('<%= AppUtils.getRaptorActionURL() %>popup.calendar','cal','WIDTH=200,HEIGHT=250');return false;">
+ <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20">
+ </a>-->
+ <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20" onClick="oCalendar.select(document.getElementById('schedEndDate'),event,'MM/dd/yyyy'); return false;" style="cursor:hand">
+ </font></td>
+ </tr>
+
+ <% if(AppUtils.isAdminUser(request) || isSQLAllowed ) { %>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Use Condition:</font></td>
+ <td class=rbg3 align="left" width="50%" valign="middle" nowrap><font class=rtabletext>
+ <input type="checkbox" name="conditional" value="Y"<%= reportSchedule.getConditional().equals("Y")?" checked":"" %>> Send Emails Only When Condition Is Met
+ </font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Condition SQL:</font></td>
+ <td class=rbg3 align="left" width="50%" valign="middle" nowrap><font class=rtabletext>SELECT 1 FROM DUAL WHERE EXISTS (<br>
+ <textarea name="conditionSQL" cols="40" rows="3"><%= nvl(reportSchedule.getConditionSQL()) %></textarea>
+ )
+ &nbsp;&nbsp;&nbsp;&nbsp;
+ <input type="Button" class=button value="Test" onClick="showTestConditionPopup()">
+ &nbsp;
+ </font></td>
+ </tr>
+ <% } %>
+
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Max rows in attachment:</font></td>
+ <td class=rbg3 align="left" width="50%" valign="middle" nowrap>
+ <input type='text' name='downloadLimit' value="<%=reportSchedule.getDownloadLimit()%>" size='4'/>
+ </td>
+ </tr>
+
+ <jsp:include page="wizard_schedule_formfield_include.jsp" flush="true" />
+ <script type="text/javascript">initFormFields();</script>
+
+<% List emailToUsers = reportSchedule.getEmailToUsers();
+ for(int i=0; i<emailToUsers.size(); i++) {
+ IdNameValue userValue = (IdNameValue) emailToUsers.get(i); %>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext><%= (i==0)?"Email To: ":"&nbsp;" %></font></td>
+ <td class=rbg3 align="left" width="50%" nowrap><font class=rtabletext>
+ <%= userValue.getName() %>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! dataValidate()) {return false;} else if(! confirm('Are you sure?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_USER %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= userValue.getId() %>'; }">
+ </font></td>
+ </tr>
+<% } // for
+ List emailToRoles = reportSchedule.getEmailToRoles();
+ for(int i=0; i<emailToRoles.size(); i++) {
+ IdNameValue roleValue = (IdNameValue) emailToRoles.get(i); %>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext><%= (emailToUsers.size()==0&&i==0)?"Email To: ":"&nbsp;" %></font></td>
+ <td class=rbg3 align="left" width="50%" nowrap><font class=rtabletext>Everyone With Role:&nbsp;
+ <%= roleValue.getName() %>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! dataValidate()) {return false;} else if(! confirm('Are you sure?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_ROLE %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= roleValue.getId() %>'; }">
+ </font></td>
+ </tr>
+<% } // for
+
+ Vector remainingUsers = Utils.getUsersNotInList(emailToUsers,request);
+ Vector remainingRoles = Utils.getRolesNotInList(emailToRoles,request);
+ if((emailToUsers.size()+emailToRoles.size()==0)||(remainingUsers.size()>0)||(remainingRoles.size()>0)) { %>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext><%= (emailToUsers.size()+emailToRoles.size()==0)?"Email To: ":"&nbsp;" %></font></td>
+ <td class=rbg3 align="left" width="50%" nowrap><font class=rtabletext>
+<% if(remainingUsers.size()>0) { %>
+ <select name="schedEmailAdd" onChange="if(! dataValidate()) {selectedIndex=0;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_USER %>'; document.forma.submit();}">
+ <option value="" selected>--- Select User ---
+<% for(int i=0; i<remainingUsers.size(); i++) {
+ IdNameValue userValue = (IdNameValue) remainingUsers.get(i); %>
+ <option value="<%= userValue.getId() %>"><%= userValue.getName() %>
+<% } // for %>
+ </select>
+<% } else { %>
+ No user emails available
+<% } %>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<% if(remainingRoles.size()>0) { %>
+ <select name="schedEmailAddRole" onChange="if(! dataValidate()) {selectedIndex=0;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_ROLE %>'; document.forma.submit();}">
+ <option value="" selected>--- Select Role ---
+<% for(int i=0; i<remainingRoles.size(); i++) {
+ IdNameValue roleValue = (IdNameValue) remainingRoles.get(i); %>
+ <option value="<%= roleValue.getId() %>"><%= roleValue.getName() %>
+<% } // for %>
+ </select>
+<% } else { %>
+ No roles available
+<% } %>
+ </font></td>
+ </tr>
+<% } // if
+%>
+</table>
+<br>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+ if(! checkDate(document.forma.schedStartDate.value, true)) {
+ alert("Invalid Start Date. The date format should be MM/DD/YYYY");
+ document.forma.schedStartDate.focus();
+ document.forma.schedStartDate.select();
+ return false;
+ }
+ if(! checkDate(document.forma.schedEndDate.value, true)) {
+ alert("Invalid End Date. The date format should be MM/DD/YYYY");
+ document.forma.schedEndDate.focus();
+ document.forma.schedEndDate.select();
+ return false;
+ }
+ /*if(! checkDate(document.forma.schedRunDate.value, true)) {
+ alert("Invalid Execution Date. The date format should be MM/DD/YYYY");
+ document.forma.schedRunDate.focus();
+ document.forma.schedRunDate.select();
+ return false;
+ }*/
+<% if (AppUtils.isAdminUser(request) || isSQLAllowed){ %>
+ if(document.forma.conditional.checked&&document.forma.conditionSQL.value=="") {
+ alert("Please provide Condition SQL");
+ document.forma.conditionSQL.focus();
+ document.forma.conditionSQL.select();
+ return false;
+ }
+ <% } %>
+ if(! checkNonNegativeInteger(document.forma.downloadLimit.value)) {
+ alert("Max row in attachment is not a valid integer.\nPlease enter a valid value.");
+ document.forma.downloadLimit.focus();
+ document.forma.downloadLimit.select();
+ return false;
+ }
+ else
+ {
+ if((document.forma.downloadLimit.value) > <%=Globals.getDownloadLimit()%>) {
+ alert("Max row you can download should not be more than <%=Globals.getDownloadLimit()%> rows.\nPlease enter a valid value.");
+ document.forma.downloadLimit.focus();
+ document.forma.downloadLimit.select();
+ return false;
+ }
+
+ }
+ for (var i=0; i < document.forma.notify.length; i++) {
+ if (document.forma.notify[i].checked) {
+ document.forma.notify_type.value = document.forma.notify[i].value;
+ }
+ }
+ return validateForm();
+
+ return true;
+} // dataValidate
+//-->
+</script>
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_formfield_include.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_formfield_include.jsp
new file mode 100644
index 00000000..206e23de
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_formfield_include.jsp
@@ -0,0 +1,754 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%--
+ Name: wizard_schedule_formfield_include.jsp
+ Use : Shows formfield of the report in the schedule page.
+
+ Change Log
+ ==========
+
+ 28-Aug-2009 : Version 8.5.1 (Sundar); Checkbox and Radio button are also handled.
+ 18-Aug-2009 : Version 8.5.1 (Sundar);
+
+ a) ajax.js is loaded in startup for AJAX functionality.
+ b) showArgPopupNew is modified as per report_form.jsp
+ c) Ajax function is added very similiar to report_form.jsp
+ d) "auto" bug is resolved.
+
+14-Jul-2009 : Version 8.4 (Sundar);
+
+ <UL>
+ <LI> Shows the form field of the first Dashboard report in schedule page if the report is dashboard.</LI>
+ </UL>
+--%>
+<%@ page import="java.io.*" %>
+<%@ page import="java.util.*" %>
+<%@ page import="java.text.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.ReportHandler" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.JavascriptItemType"%>
+<%@ page import="java.util.regex.*"%>
+<%@ page import="javax.servlet.http.*"%>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportSchedule" %>
+
+
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ ReportHandler rh = new ReportHandler();
+ ReportRuntime rr = rh.loadReportRuntime(request, rdef.getReportID());
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr);
+ boolean isDashboard = rr.isDashboardType();
+ ReportFormFields rff = rr.getReportFormFields();
+ ReportFormFields rff1 = (ReportFormFields) rff.clone();
+ ReportFormFields rff2 = (ReportFormFields) rff.clone();
+ ReportFormFields rff5 = (ReportFormFields) rff.clone();
+ boolean isFirstTime = nvl(request.getParameter("refresh")).toUpperCase().startsWith("Y");
+ ReportSchedule reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE);
+
+ int dashboardFlag = 0;
+ ReportRuntime rr1 = null;
+ java.text.SimpleDateFormat sdf = null;
+
+%>
+
+<script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/raptor.js"></script>
+<script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/ajax.js"></script>
+<%--=(rr.getJavascriptElement()!=null && rr.getJavascriptElement().length()>0)?rr.getJavascriptElement().replaceAll("formd","forma"):""--%>
+<script language="JavaScript">
+<!--
+function showArgPopup(fieldName, jsTargetField) {
+ var url = "<%= AppUtils.getRaptorActionURL() %>report.popup.field&<%= AppConstants.RI_FIELD_NAME %>="
+ + fieldName+ "&<%= AppConstants.RI_JS_TARGET_FIELD %>="+jsTargetField;
+ var w = window.open(url, "formLookup", "width=440,height=400,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showArgPopup
+
+function showArgPopupNew(fld, targetField) {
+ var newElementCreated = true;
+
+ var oldTarget = null;
+ var oldRAction = null;
+ var frm = document.forma;
+ var w = window.open("<%= AppUtils.getBaseFolderURL() %>loading.jsp", "formLookup", "width=440,height=400,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+
+ oldTarget = frm.target ;
+ oldRAction = frm.r_action.value ;
+ frm.target = "formLookup";
+ frm.r_action.value = "report.popup.field";
+ if(document.getElementById("<%= AppConstants.RI_FIELD_NAME %>")) {
+ frm.removeChild(document.getElementById("<%= AppConstants.RI_FIELD_NAME %>"));
+ frm.removeChild(document.getElementById("<%= AppConstants.RI_JS_TARGET_FIELD %>"));
+ }
+ var fld1 = document.createElement("input");
+ fld1.setAttribute("type", "hidden");
+ fld1.setAttribute("name", "<%= AppConstants.RI_FIELD_NAME %>");
+ fld1.setAttribute("id", "<%= AppConstants.RI_FIELD_NAME %>");
+ fld1.setAttribute("value", fld);
+
+ var fld2 = document.createElement("input");
+ fld2.setAttribute("type", "hidden");
+ fld2.setAttribute("name", "<%= AppConstants.RI_JS_TARGET_FIELD %>");
+ fld2.setAttribute("id", "<%= AppConstants.RI_JS_TARGET_FIELD %>");
+ fld2.setAttribute("value", targetField);
+
+ frm.appendChild(fld1);
+ frm.appendChild(fld2);
+ frm.submit();
+ w.focus();
+ w.opener = this;
+
+ frm.target = oldTarget ;
+ frm.r_action.value = oldRAction ;
+
+
+} // showArgPopupNew
+
+function validateForm() {
+ //if(document.getElementById("schedEnabled").checked && document.getElementById("schedEnabled").value == 'Y') {
+ <%for(rff.resetNext(); rff.hasNext(); ) { %>
+ <%= rff.getNext().getValidateJavaScript().replaceAll("formd","forma") %>
+ <%}%>
+
+ var formfields_value="";
+
+ for(i=0; i<document.forma.elements.length;i++) {
+ if((document.forma.elements[i].name).substring(0,2)=='ff') {
+ //alert("i-" + i+ " "+ document.forma.elements[i].name + " " + document.forma.elements[i].type + " " + document.forma.elements[i].value);
+ var obj = document.forma.elements[i];
+ if ((document.forma.elements[i].tagName == "SELECT") /*&& !(obj.name.match('_Hr') || obj.name.match('_Min') || obj.name.match('_Sec'))*/ ){
+ var selString = "";
+ for (var intLoop=0; intLoop < obj.length; intLoop++) {
+ if (obj[intLoop].selected) {
+ formfields_value += "&"+document.forma.elements[i].name+"=" + escape(obj[intLoop].value);
+
+ }
+ }
+ }
+ else{
+ if(escape(document.forma.elements[i].value).charAt(0) == '[' ) {
+ var nameObj = document.forma.elements[i].name;
+ if(nameObj.indexOf("_")!=-1 && (nameObj.match('_Hr') || nameObj.match('_Min') || nameObj.match('_Sec')) ) {
+ } else {
+ formfields_value += "&"+document.forma.elements[i].name+"="+escape(document.forma.elements[i].value);
+ }
+ } else {
+ var opt = document.forma.elements[i].name;
+ var optValue = "";
+ //alert('not in select' + opt);
+ var auto_incr = '<%=Boolean.toString(Globals.isScheduleDateParamAutoIncr())%>';
+ //alert(auto_incr);
+ //alert(document.getElementById(opt+"_auto") + " " + (opt+"_auto"));
+ if(document.getElementById(opt+"_auto")/* || opt.lastIndexOf("_auto")>= 0 */) {
+ for(k=0; k<document.forma.elements.length;k++) {
+ if(document.forma.elements[k].name == opt) {
+ optValue = document.forma.elements[k].value;
+ }
+ }
+ //alert('opt info ' +opt + " "+ optValue);
+
+ if(auto_incr == 'true') {
+ formfields_value += "&"+document.forma.elements[i].name+"_auto="+escape(optValue);
+ } else if (document.getElementById(opt).checked) {
+ formfields_value += "&"+document.forma.elements[i].name+"_auto="+escape(optValue);
+ } /*else
+ formfields_value += "&"+document.forma.elements[i].name+"="+escape(document.forma.elements[i].value);*/
+ } else if (opt.lastIndexOf("_auto") < 0){
+ if(document.forma.elements[i].type == 'checkbox' || document.forma.elements[i].type == 'radio') {
+ if (document.forma.elements[i].checked)
+ formfields_value += "&"+document.forma.elements[i].name+"="+escape(document.forma.elements[i].value);
+ } else {
+ formfields_value += "&"+document.forma.elements[i].name+"="+escape(document.forma.elements[i].value);
+ }
+ }
+ }
+ }
+ }
+ }
+ <%
+ String sessionParams[] = Globals.getSessionParamsForScheduling().split(",");
+ String formfields = "";
+ for (int i=0; i<sessionParams.length; i++) {
+ if(sessionParams[i].equals("login_id"))
+ formfields += "&"+java.net.URLEncoder.encode("login_id","UTF-8")+"="+ java.net.URLEncoder.encode(AppUtils.getUserBackdoorLoginId(request),"UTF-8");
+ else {
+ if(session.getAttribute(sessionParams[i])!=null)
+ formfields += "&"+ java.net.URLEncoder.encode(sessionParams[i], "UTF-8") + "="+ java.net.URLEncoder.encode((String)session.getAttribute(sessionParams[i]),"UTF-8");
+ }
+ }
+ %>
+ formfields_value += '&<%= AppConstants.RI_NEXT_PAGE %>=-1';
+ formfields_value += '<%=formfields%>';
+ //alert(formfields_value);
+ document.getElementById("formFields").value = formfields_value;
+ var javascriptText = "<%=getCallableJavascriptForSubmit(rr)%>";
+ javascriptText = javascriptText.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
+ if(javascriptText.length > 0) {
+ if(<%=(getCallableJavascriptForSubmit(rr).trim().length())>0?getCallableJavascriptForSubmit(rr).replaceAll("formd","forma"):"false"%>)
+ return true;
+ else
+ return false;
+ }
+ // }
+ return true;
+} // validateForm
+function systemDateTime() {
+ <%
+ sdf = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss z");
+ sdf.setTimeZone(TimeZone.getTimeZone(Globals.getTimeZone()));
+ String sysDateTime = sdf.format(new java.util.Date());
+ %>
+ var sysdate = "<%=sysDateTime%>";
+ return sysdate;
+}
+
+function systemDate() {
+ <%
+ sdf = new java.text.SimpleDateFormat("MM/dd/yyyy");
+ sdf.setTimeZone(TimeZone.getTimeZone(Globals.getTimeZone()));
+ String sysDate = sdf.format(new java.util.Date());
+ %>
+ var sysdate = "<%=sysDate%>";
+ return sysdate;
+}
+//-->
+</script>
+ <%
+ if(rr.getReportType().equals(AppConstants.RT_DASHBOARD)) {
+ dashboardFlag = 1;
+ String strHTML = rr.getDashboardLayoutHTML(); //getdashboardLayoutHTML();
+ String rep_id = parseAndGetFirstReportID(strHTML);
+ ReportHandler rh1 = new ReportHandler();
+ rr1 = null;
+ int requestFlag = 1;
+ try {
+ rr1 = rh1.loadReportRuntime(request, rep_id, true, requestFlag);
+ } catch(Exception e) {
+ }
+ rff = rr1.getReportFormFields();
+ }
+ %>
+ <%if((dashboardFlag == 0 && rr.needFormInput()) || (dashboardFlag == 1 && rr1.needFormInput())) { %>
+ <tr>
+
+ <td class=rbg3 align="center" width="50%" valign="middle" colspan=2><font class=rtabletext>
+ Please input values into the Form Fields for email attachment. Note those fields user must provide value can not leave as blank.
+ </font>
+ <table width="94%" border="0" cellspacing="1" cellpadding="3" align=center>
+ <%
+ int colidx = 0;
+ java.util.HashMap paramsMap = Globals.getRequestParamtersMap(request, false);
+ java.util.HashMap getScheduleMap = getFormFieldsHashMap (request, reportSchedule.getFormFields());
+ java.util.HashMap paramsScheduleMap = Globals.getRequestParametersMap(request, getScheduleMap);
+ for (int i = 0; i < rff.size(); i ++){
+ FormField ff = (FormField) rff.get(i);
+ ff.setDbInfo(rr.getDbInfo());
+ ff.setUserId(AppUtils.getUserID(request));
+ if(ff.getFieldType().equals(FormField.FFT_HIDDEN)) {
+ %>
+ <%
+ if(nvl(reportSchedule.getFormFields()).length() <= 0)
+ out.println(ff.getHtml(rr.getParamValue(ff.getFieldName()), paramsMap, rr, true));
+ else
+ out.println(ff.getHtml(getParameterString(request, ff.getFieldName(), getScheduleMap), paramsScheduleMap, rr, true).replaceAll("formd","forma"));
+
+
+ %>
+ <% }
+ if(!ff.getFieldType().equals(FormField.FFT_HIDDEN) && ff.isVisible()) {
+
+ %>
+ <%if (colidx == 0){%><tr><%}%>
+ <td class=rbg3 width="10%" align="right" nowrap='yes'>
+ <font class=rtabletext>
+ <%if (!ff.getFieldType().equals(FormField.FFT_BLANK)){%>
+ <%= ff.getDisplayNameHtml() %>:
+ <%}%>
+ </font>
+ </td>
+ <td class=rbg3 width="15%" align="left" nowrap='yes'>
+ <%-- ff.getHtml(rr.getParamValue(ff.getFieldName()), paramsMap,rr, true).replaceAll("formd","forma") --%>
+ <%
+ if(nvl(reportSchedule.getFormFields()).length() <= 0)
+ out.println(ff.getHtml(rr.getParamValue(ff.getFieldName()), paramsMap, rr, true).replaceAll("formd","forma"));
+ else
+ out.println(ff.getHtml(getParameterString(request, ff.getFieldName(), getScheduleMap), paramsScheduleMap, rr, true).replaceAll("formd","forma"));
+ %>
+ </td>
+ <td ></td>
+ <%colidx++;%>
+ <%if (colidx == rr.getNumFormColsAsInt()){%></tr><%colidx=0;}%>
+ <% }
+ } //for %>
+ </table>
+ </td>
+ </tr>
+<% } //if(rr.needFormInput()) %>
+
+<input type='hidden' name='formFields' value=''/>
+
+<script>
+<% if(!isDashboard) { %>
+var map = new Object();
+var defaultValues = new Object();
+<% rff = rr.getReportFormFields();
+int idx = 0;
+int row = 0;
+
+java.util.Map fNameMap = new java.util.HashMap();
+for(rff.resetNext(); rff.hasNext(); idx++) {
+ FormField ff = rff.getNext();
+ fNameMap.put(ff.getFieldName(), ff.getFieldDisplayName());
+}
+
+
+idx = 0;
+row = 0;
+
+for(rff.resetNext(); rff.hasNext(); idx++) {
+ FormField ff = rff.getNext();
+ if(!(ff.getFieldType().equals(FormField.FFT_BLANK))
+ && ff.isVisible() && !(ff.getFieldType().equals(FormField.FFT_TEXT_W_POPUP))) {
+ %>
+
+
+ <%
+
+ if( ff.getDependsOn() != null && ff.getDependsOn().trim().length()>0 ) {
+ %> // <%=ff.getFieldName()%> <%=ff.getDependsOn()%>
+ if(document.forma.<%=ff.getFieldName()%>) {
+ document.forma.<%=ff.getFieldName()%>.onchange = updateDropDown;
+ }
+ map['<%=ff.getDependsOn()%>'] = '<%=ff.getFieldName()%>';
+ // Made double quotes as it conflicts with query.
+ defaultValues['<%=ff.getFieldName()%>'] = "<%=rr.getParamValue(ff.getFieldName())%>" ;
+ <%
+ }
+ }
+}
+%>
+
+var oldTarget = null;
+var oldr_action = null;
+ var ajax = new Array();
+
+ function getOpts(oSelect) {
+ var opt, i = 0, selVals = new Array();
+ //alert(oSelect.length + " " + oSelect.options);
+ if(oSelect && oSelect.options) {
+ while (opt = oSelect[i++]) {
+ if (opt.selected) {
+ selVals[selVals.length] = encodeURIComponent(opt.value);
+ //alert(opt.value)
+ }
+ }
+ //return selVals;
+ } else {
+ if(oSelect && oSelect.value)
+ selVals[0] = encodeURIComponent(oSelect.value);
+ //return selVals;
+ }
+ return selVals;
+ }
+
+ function trim(str) {
+ return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
+ }
+
+ function updateDropDown(srcElem_) {
+
+ var srcElem = null;
+ if(srcElem_ == null) {
+ if (event != null)
+ srcElem = event.srcElement;
+ } else {
+ srcElem = srcElem_;
+ }
+ //alert(srcElem.name);
+ //var parentFormField = srcElem.options[srcElem.selectedIndex].value;
+ if(srcElem !=null) {
+ var parentFormField = getOpts(srcElem);
+ var parentFieldName = srcElem.name;
+
+ //alert(parentFormField);
+ var parentFieldValue = "";
+ for (i=0;i<=parentFormField.length-1;i++) {
+ if(parentFormField[i] != 'undefined')
+ parentFieldValue = parentFieldValue+srcElem.name+'='+parentFormField[i];
+ if(i<parentFormField.length-1)
+ parentFieldValue = parentFieldValue + "&";
+ }
+ //alert("ParentFieldValue " + parentFieldValue + " srcElem.name " + srcElem.name);
+
+ if(srcElem != null && srcElem.name!=null) {
+ <%
+ FormField ff = null;
+ String javaScriptText = "";
+ String javaScriptAfterChainingText = "";
+ %>
+ <%
+ for(rff5.resetNext(); rff5.hasNext();idx++) {
+ ff = rff5.getNext();
+ %>
+ if(srcElem && srcElem.name && srcElem.name == "<%=ff.getFieldName()%>") {
+ <% javaScriptText = nvl(ff.getCallableOnChangeJavascript(ff.getFieldName(), rr));
+ javaScriptAfterChainingText = nvl(ff.getCallableAfterChainingJavascript(ff.getFieldName(), rr));
+ if(javaScriptText.length() > 0 ) { %>
+ <%=javaScriptText+";"%>
+ //document.forma.<%--=ff.getFieldName()--%>//.onchange =
+ <% } %>
+ }
+ <% } %>
+ <% for(rff5.resetNext(); rff5.hasNext();idx++) {
+ %>
+ <%
+ ff = rff5.getNext();
+ %>
+ //alert (" In For " + "<%=ff.getFieldName()%> <%=rff.hasNext()%>");
+ <%
+ if(!(ff.getFieldType().equals(FormField.FFT_BLANK))) {
+ /*&& ff.isVisible()*/ /*&& !(ff.getFieldType().equals(FormField.FFT_TEXT_W_POPUP))*/
+ %>
+ <% if( ff.getDependsOn() != null && !ff.getDependsOn().equals("") ) {
+ if(!(ff.getFieldType().equals(FormField.FFT_TEXT_W_POPUP))) { %>
+ <% if(!ff.getFieldType().equals(FormField.FFT_HIDDEN)) { %>
+ if(srcElem && srcElem.name && srcElem.name == "<%=ff.getFieldName()%>") {
+ parentFieldValue = parentFieldValue + '&parentFieldName=<%=ff.getFieldName()%>';
+ //if(document.forma.<%=ff.getFieldName()%> && document.forma.<%=ff.getFieldName()%>.style) document.forma.<%=ff.getFieldName()%>.style.display='none';
+ //if(document.forma.<%=ff.getFieldName()%> && document.forma.<%=ff.getFieldName()%>.style) document.forma.<%=ff.getFieldName()%>.style.display='none';
+ if(document.getElementById("<%=ff.getFieldName()%>_content") && document.getElementById("<%=ff.getFieldName()%>_content").style ) document.getElementById('<%=ff.getFieldName()+"_content"%>').style.display='block';
+ }
+
+ <% } %>
+ <% } %>
+ var otherFieldValue = "";
+
+ <%
+ for(rff1.resetNext(); rff1.hasNext();) {
+ FormField ff1 = rff1.getNext();
+ if( ff1.getDependsOn() != null && !ff1.getDependsOn().equals("") ) { %>
+ //alert (srcElem.name + " <%=ff1.getFieldName()%>");
+ if(srcElem && srcElem.name && srcElem.name != '<%=ff1.getFieldName()%>') {
+ var otherFormFields = getOpts(document.forma.<%=ff1.getFieldName()%>);
+ for (i=0;i<=otherFormFields.length-1;i++) {
+ if(otherFormFields[i] != 'undefined')
+ otherFieldValue = otherFieldValue+'<%=ff1.getFieldName()%>'+'='+escape(otherFormFields[i])+'&';
+ if(i<otherFormFields.length-1)
+ otherFieldValue = otherFieldValue + "&";
+ }
+
+ }
+ <% }
+ }
+ %>
+ //alert("IF OPTIONS 0 AFTER <%=ff.getFieldName()%>" + parentFormField);
+
+ //if(parentFormField.length>0) {
+ //if(srcElem.name == "<%=ff.getFieldName()%>") {
+ if(document.forma.<%=ff.getFieldName()%> && document.forma.<%=ff.getFieldName()%>.options)
+ document.forma.<%=ff.getFieldName()%>.options.length = 0;
+ try {
+ var index = ajax.length;
+ ajax[index] = new sack("raptor.htm");
+ //alert("P" + parentFieldValue);
+ //alert("O" + otherFieldValue);
+ ajax[index].method='POST';
+ //alert('raptor.htm?action=raptor&r_action=report.childDropDown&parentFieldName='+srcElem.name+'&fieldName=<%=ff.getFieldName()%>&'+parentFieldValue+'&'+otherFieldValue);
+ ajax[index].setVar("action","raptor");
+ ajax[index].setVar("r_action","report.childDropDown");
+ ajax[index].setVar("fieldName","<%=ff.getFieldName()%>");
+ ajax[index].setVar("inSchedule","Y");
+ //alert("parentFieldValue " + parentFieldValue);
+ var parentFieldTokens = parentFieldValue.split( "&" );
+ var parentNameValuePair = "";
+ var nameValuePairTokens;
+ for (var i = 0; i < parentFieldTokens.length; i++) {
+ parentNameValuePair = parentFieldTokens[i];
+ parentNameValuePairTokens = parentNameValuePair.split("=");
+ if (parentNameValuePairTokens.length>0) {
+ //alert("ParentNameValuePairTokens " + parentNameValuePairTokens[0]+ " " + decodeURIComponent(parentNameValuePairTokens[1]));
+ ajax[index].setVar(parentNameValuePairTokens[0], decodeURIComponent(parentNameValuePairTokens[1]), i);
+ }
+ }
+ //alert("otherFieldValue " + otherFieldValue + " " );
+ if(otherFieldValue && otherFieldValue.length>0) {
+ if (otherFieldValue.substr(otherFieldValue.length-1) == '&')
+ otherFieldValue = otherFieldValue.substr(0,otherFieldValue.length-1);
+ }
+ //alert("otherFieldValue1 " + otherFieldValue + " " );
+
+ var otherFieldTokens = otherFieldValue.split( "&" );
+ var otherNameValuePair = "";
+ var otherNameValuePairTokens;
+ for (var k = 0; k < otherFieldTokens.length; k++) {
+ otherNameValuePair = otherFieldTokens[k];
+ otherNameValuePairTokens = otherNameValuePair.split("=");
+ if (otherNameValuePairTokens.length>0) {
+ //alert("otherNameValuePairTokens " + otherNameValuePairTokens[0]+ " " + decodeURIComponent(otherNameValuePairTokens[1]));
+ ajax[index].setVar(otherNameValuePairTokens[0], decodeURIComponent(otherNameValuePairTokens[1]), k);
+ }
+ }
+ //ajax[index].requestFile = 'raptor.htm?action=raptor&r_action=report.childDropDown&fieldName=<%=ff.getFieldName()%>&'+parentFieldValue+'&'+otherFieldValue; // Specifying which file to get
+ ajax[index].onCompletion = function(){ createChildFormField(index, document.forma.<%=ff.getFieldName()%>) }; // Specify function that will be executed after file has been found
+ ajax[index].onError = function() {bringBacktoNormal(index, document.forma.<%=ff.getFieldName()%>);}
+ ajax[index].onFail = function() {bringBacktoNormal(index, document.forma.<%=ff.getFieldName()%>);}
+ //ajax[index].onCompletion = function(){ var obj = null; obj = document.forma.<%=ff.getFieldName()%>;eval(ajax[index].response);document.getElementById(obj.name+"_content").style.display='none';obj.style.display='block'; }; // Specify function that will be executed after file has been found
+ ajax[index].runAJAX(null,false,100); // Execute AJAX function
+ //alert(ajax[index].readyState);
+ //while (ajax[index].xmlhttp.readyState == 4 || ajax[index].xmlhttp.readyState == "complete" ) {
+ //}
+ //while(ajax[index].xmlhttp.readyState ==4){
+ // alert("ready State " + ajax[index].xmlhttp.readyState);
+ //}
+ //setTimeout("Func1()", 5000);
+ } catch (err) {
+ if(err=="session_exp") {
+ document.write("session has been expired.");
+ }
+ }
+
+ //} else {
+ <% if(!ff.getFieldType().equals(FormField.FFT_HIDDEN)) { %>
+ if(document.getElementById("<%=ff.getFieldName()%>_content") && document.getElementById("<%=ff.getFieldName()%>_content").style ) document.getElementById("<%=ff.getFieldName()%>_content").style.display='none';
+ //if(document.forma.<%=ff.getFieldName()%> && document.forma.<%=ff.getFieldName()%>.style) document.forma.<%=ff.getFieldName()%>.style.display='block';
+ <% } else {%>
+ if(document.getElementById("<%=ff.getFieldName()%>_content") && document.getElementById("<%=ff.getFieldName()%>_content").style ) document.getElementById("<%=ff.getFieldName()%>_content").style.display='none';
+ //if(document.forma.<%=ff.getFieldName()%> && document.forma.<%=ff.getFieldName()%>.style) document.forma.<%=ff.getFieldName()%>.style.display='none';
+ <% } %>
+ //}
+ //} // if src.Elem
+ <% } %>
+ <% } %>
+
+ <% } %>
+ <%
+ for(rff.resetNext(); rff.hasNext();idx++) {
+ ff = rff.getNext();
+ %>
+ if(srcElem && srcElem.name && srcElem.name == "<%=ff.getFieldName()%>") {
+ <%
+ javaScriptAfterChainingText = nvl(ff.getCallableAfterChainingJavascript(ff.getFieldName(), rr));
+ %>
+ <%
+ if(javaScriptAfterChainingText.length()>0 && javaScriptAfterChainingText.trim().startsWith("afterchaining")) {
+ javaScriptAfterChainingText = Utils.replaceInString(javaScriptAfterChainingText,"afterchaining","");
+ javaScriptAfterChainingText = Utils.replaceInString(javaScriptAfterChainingText,"\"","");
+ javaScriptAfterChainingText = Utils.replaceInString(javaScriptAfterChainingText,"=","");
+ %>
+ <%
+ %>
+ <%=javaScriptAfterChainingText%>
+ <%
+ }
+ %>
+ }
+ <% } %>
+
+
+ }
+ }
+ }
+
+ function dummyFunction(){
+ //alert("Server operation timed out");
+ }
+
+ function bringBacktoNormal(index, obj) {
+ if(obj) {
+ //alert('bringing to normal');
+ var field_name = obj.name;
+ //alert("'"+field_name+"_content"+"'");
+ if(document.getElementById(field_name+"_content") && document.getElementById(field_name+"_content").style ) document.getElementById(field_name+"_content").style.display='none';
+ //if(obj.style) obj.style.display='block';
+ }
+ }
+ function createChildFormField(index, obj) {
+ //alert('create Cities');
+ //var obj = document.getElementById('dhtmlgoodies_city');
+ var obj = obj;
+ var resp = trim(ajax[index].response);
+ //alert(index + " " + ajax[index]);
+ //alert('response ' + ajax[index].response);
+ if(resp.length > 0 && resp.indexOf("<script type=")!=-1) {
+ document.write(resp);
+ if(obj) {
+ //alert('obj.name ' + obj.name);
+ var field_name = obj.name;
+ //alert("'"+field_name+"_content"+"'");
+ if(document.getElementById(field_name+"_content") && document.getElementById(field_name+"_content").style ) document.getElementById(field_name+"_content").style.display='none';
+ //if(obj.style) obj.style.display='block';
+ }
+ throw "session_exp";
+ }
+ if(obj) {
+ if(resp.length > 0)
+ eval(resp); // Executing the response from Ajax as Javascript code
+ //alert('obj.name ' + obj.name);
+ var field_name = obj.name;
+ //alert("'"+field_name+"_content"+"'");
+ if(document.getElementById(field_name+"_content") && document.getElementById(field_name+"_content").style ) document.getElementById(field_name+"_content").style.display='none';
+ //if(obj.style) obj.style.display='block';
+ }
+ }
+function changeCombo(data){
+ var list = data;
+ for (var i = 0; i < list.length; i ++){
+ var fieldName = list[i].substr(0, list[i].indexOf(":"));
+ var selectVal = list[i].substr(list[i].indexOf(":") + 1, list[i].length);
+
+ var elem = document.getElementsByName(fieldName);
+ var j = 0;
+ while (elem[j].tagName == 'INPUT' && elem[j].type=='hidden'){
+ j ++;
+ }
+
+ var oldVal = elem[j].value
+ elem[j].parentNode.innerHTML = selectVal;
+ elem[j].value=oldVal;
+ elem[j].onchange = updateDropDown;
+ }
+ document.getElementById('childFieldpopup').style.display='none';
+
+
+
+
+}
+<% } %>
+/*
+
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="source_page" value="report_run">
+ <input type="hidden" name="r_action" value="report.download.pdf">
+
+*/
+</script>
+<% /* if(request.getAttribute(AppConstants.RI_REPORT_DATA) == null){ */ %>
+<script>
+ if(<%=isFirstTime%>) {
+
+ <%
+ if(!isDashboard) {
+ outFor:
+ for(rff2.resetNext(); rff2.hasNext();) {
+ FormField ff1 = rff2.getNext();
+ if( ff1.getDependsOn() != null && !ff1.getDependsOn().equals("") ) { %>
+ <% if (!ff1.getFieldType().equals(FormField.FFT_HIDDEN)) { %>
+ //alert("in First Time <%=ff1.getFieldName()%>");
+ if(document.forma.<%=ff1.getFieldName()%>)
+ updateDropDown(document.forma.<%=ff1.getFieldName()%>);
+ <% } %>
+ <% break outFor;
+ }
+ }
+ }
+ %>
+ }
+</script>
+
+<%! private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+ private String getCallableJavascriptForSubmit(ReportRuntime rr) {
+ JavascriptItemType javascriptItemType = null;
+ StringBuffer callJavascriptText = new StringBuffer("");
+ if(rr.getJavascriptList()!=null) {
+ for (Iterator iter = rr.getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) {
+ javascriptItemType = (JavascriptItemType)iter.next();
+ if(javascriptItemType.getFieldId().equals("os1")) {
+ callJavascriptText.append(" "+javascriptItemType.getCallText());
+ break;
+ }
+ }
+ }
+ return callJavascriptText.toString();
+ }
+
+ private HashMap getFormFieldsHashMap (HttpServletRequest request, String formFieldsString) {
+ String splitName[] = null;
+ ArrayList keyValue = new ArrayList();
+ HashMap keyValueMap = new HashMap();
+ String newValue = "";
+ //System.out.println("Request Str "+ formFieldsString);
+ StringTokenizer st = null;
+ StringTokenizer st2 = null;
+ String key1 = "";
+ String value = "";
+
+ if(formFieldsString.length() > 0) {
+ st = new StringTokenizer(formFieldsString, "&");
+ while (st.hasMoreTokens()) {
+ keyValue.add(st.nextToken());
+ }
+ if(keyValue.size() > 0) {
+
+ for (int num = 0; num < keyValue.size(); num++) {
+ st2 = new StringTokenizer((String) keyValue.get(num), "=");
+ while(st2.hasMoreTokens()) {
+ key1 = ""; value = "";
+ key1 = st2.nextToken();
+ key1 = Utils.replaceInString(key1, "_auto", "");
+ try {
+ value = st2.nextToken();
+ }catch (NoSuchElementException ex) { value = "";}
+ if(!keyValueMap.containsKey(key1))
+ keyValueMap.put(key1,value);
+ else {
+ String value1 = (String) keyValueMap.get(key1);
+ value = value+"|"+value1;
+ keyValueMap.put(key1,value);
+ }
+ }
+ }
+
+ }
+ }
+ return keyValueMap;
+ }
+
+ private String getParameterString (HttpServletRequest request, String key, HashMap keyValueMap) {
+ String newValue = "";
+ if(keyValueMap.containsKey(key)) {
+ //System.out.println("VALUE IN MAP IS " +key+ " "+ (String) keyValueMap.get(key));
+ newValue = XSSFilter.filterRequestOnlyScript((String) keyValueMap.get(key));
+ if(nvl(newValue).length()<=0) {
+ newValue = XSSFilter.filterRequestOnlyScript((String) keyValueMap.get(key+"_auto"));
+ }
+ }
+ return newValue;
+ }
+ private String parseAndGetFirstReportID(String strHTML) {
+ String sourcestring = strHTML;
+ //System.out.println("String HTML1 " + strHTML);
+ Pattern re = Pattern.compile("\\[(.*?)\\]"); //\\[(.*?)\\]
+ Matcher m = re.matcher(sourcestring);
+ int mIdx = 0;
+ while (m.find()){
+ for( int groupIdx = 0; groupIdx < m.groupCount(); groupIdx++ ){
+ String str = m.group(groupIdx);
+ //System.out.println("REP ID1 " + str.substring(str.indexOf("#")+1, str.length()-1)) ;
+ return str.substring(str.indexOf("#")+1, str.length()-1);
+ }
+ mIdx++;
+
+ }return "";
+ }
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_multiple.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_multiple.jsp
new file mode 100644
index 00000000..70c9812a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_multiple.jsp
@@ -0,0 +1,157 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+
+<%@ page errorPage="error_page.jsp" %>
+<%!
+class ValueComparator implements Comparator {
+ public int compare(Object o1, Object o2) {
+ Map.Entry e1 = (Map.Entry) o1;
+ Map.Entry e2 = (Map.Entry) o2;
+ Comparable c1 = (Comparable)e1.getValue();
+ Comparable c2 = (Comparable)e2.getValue();
+ return c1.compareTo(c2);
+ }
+}
+%>
+<%
+HashMap hashMap = ReportLoader.loadReportsToSchedule(request);
+ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+if(rdef ==null) rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+Set mapSet = hashMap.entrySet();
+List entrylist = new ArrayList(mapSet);
+Collections.sort(entrylist, new ValueComparator());
+Map.Entry me;
+session.removeAttribute(AppConstants.SI_REPORT_SCHEDULE);
+session.removeAttribute(AppConstants.SI_REPORT_DEFINITION);
+ReportSchedule reportSchedule = (ReportSchedule) session.getAttribute(AppConstants.SI_REPORT_SCHEDULE);
+%>
+ <jsp:include page="header.jsp" flush="true" />
+ <!-- <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">-->
+<script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/raptor.js"></script>
+
+
+<jsp:include page="error_include.jsp" flush="true" />
+<br/><br/><br/>
+<% if (rdef == null || request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE) == null) {%>
+
+<form name="formb" action="<%= AppUtils.getBaseURL() %>" method="post">
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="<%= AppConstants.RI_ACTION %>" value="report.schedule.multiple">
+
+
+<table width="94%" class="tableBorder" border="0" cellspacing="0" cellpadding="0" align=center valign="center">
+<tr><td colspan="2">
+ <table width="100%" border="0" cellspacing="0" cellpadding="3">
+
+ <tr class=rbg1>
+ <td valign="Middle"><b class=rtableheader><%= "Scheduling Report" %></b></td>
+ </tr>
+ <% if(request.getAttribute("message")!=null) { %>
+ <tr class=rbg1>
+ <td valign="Middle"><b class=rtableheader><%= (String) request.getAttribute("message") %></b></td>
+ </tr>
+ <% } %>
+ </table>
+</td></tr>
+<tr> <td> <font class=rtabletext> Reports: </font></td><td height="30" align="center">
+ <% if (rdef !=null && request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE) != null ) {%>
+ <font class=rtabletext><%= rdef.getReportName()%></font>
+ <% } else { %>
+ <select name="schedule_reports" onChange="document.formb.<%= AppConstants.RI_ACTION %>.value='report.schedule.report.submit'; document.formb.submit();">
+ <option value="-1" selected> -->select report <-- </option>
+ <% for (Iterator iter = entrylist.iterator(); iter.hasNext();) {
+ me=(Map.Entry)iter.next();
+ %>
+ <% if (rdef !=null && rdef.getReportID().equals((String)me.getKey())) {%>
+ <option value="<%=(String) me.getKey()%>" selected> <%=(String) me.getValue()%> </option>
+ <% } else { %>
+ <option value="<%=(String) me.getKey()%>"> <%=(String) me.getValue()%> </option>
+ <% } %>
+ <% } %>
+ </select>
+ <% } %>
+
+</td> </tr>
+
+</table>
+</form>
+<% } %>
+<% if(reportSchedule!=null) { %>
+ <jsp:include page="wizard_schedule_only.jsp" flush="true"/>
+<% } %>
+ <jsp:include page="footer.jsp" flush="true" />
+</div>
+</td>
+</tr>
+</table>
+<%--<jsp:include page="disclaimer.jsp" flush="true" />--%>
+<script>
+ //document.getElementById('loadingMessageDiv').style.display='none';
+ //adding the bread crumb on the folder tree
+ <%
+ String isTreeHidden = "true";
+ if(request.getSession().getAttribute("isTreeHidden") != null && ((String)request.getSession().getAttribute("isTreeHidden")).equals("true")){
+ isTreeHidden = "true";
+ }else{
+ isTreeHidden = "false";
+ }
+ %>
+ //if ("<%=isTreeHidden%>" == "true"){
+ // hideTree();
+ //}
+ //document.getElementById('contentDiv').style.height=document.body.offsetHeight - 50;
+</script>
+<%! private String HTMLEncode(String value) {
+ StringBuffer sb = new StringBuffer(value);
+
+ for(int i=0; i<sb.length(); i++)
+ if(sb.charAt(i)=='<')
+ sb.replace(i, i+1, "&lt;");
+ else if(sb.charAt(i)=='>')
+ sb.replace(i, i+1, "&gt;");
+ else if(sb.charAt(i)=='"')
+ sb.replace(i, i+1, "&quot;");
+
+ return sb.toString();
+ } // HTMLEncode
+
+ private String clearSpaces(String value) {
+ StringBuffer sb = new StringBuffer(value);
+
+ for(int i=0; i<sb.length(); i++)
+ if(sb.charAt(i)==' ')
+ sb.replace(i, i+1, "&nbsp;");
+
+ return sb.toString();
+ } // clearSpaces
+
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only.jsp
new file mode 100644
index 00000000..ad3c612e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only.jsp
@@ -0,0 +1,172 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+
+<%@ page errorPage="error_page.jsp" %>
+
+
+
+<% ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+
+ String reportID = rdef.getReportID();
+
+
+
+ String dbInfo = null;
+ dbInfo = rdef.getDBInfo();
+ int sessionflag = 0;
+ if(dbInfo == null || dbInfo.length() == 0) {
+ dbInfo = (String) session.getAttribute("remoteDB");
+ sessionflag = 1;
+ }
+ session.setAttribute("remoteDB", dbInfo);
+ if((dbInfo == null) && (request.getParameter("dataSource")!=null))
+ session.setAttribute("remoteDB", request.getParameter("dataSource"));
+
+ StringBuffer title = new StringBuffer("");
+ title.append(Globals.getBaseTitle()+" > "+(reportID.equals("-1")?"Create Report":"Schedule Report"));
+ title.append(" > "+rdef.getReportName());
+
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
+%>
+<!-- Set All variable to request, to enable included jsp to access it -->
+<%
+ request.setAttribute(AppConstants.SI_REPORT_DEFINITION,rdef);
+%>
+
+ <jsp:include page="header.jsp" flush="true" />
+ <!-- <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">-->
+<script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/raptor.js"></script>
+
+
+<jsp:include page="error_include.jsp" flush="true" />
+
+<table width="100%" >
+<tr><td id="folderTreeContainer" width="1%" height='300' valign='top' ><table>
+ <!--<jsp:include page="tree/folderNav.jsp" flush="true" >
+ <jsp:param name="doCollapseTree" value="Y" />
+ </jsp:include>-->
+ </table>
+</td>
+<td id="searchContentContainer" valign='top' >
+<div id="contentDiv" style="position:relative;overflow:auto;">
+<form name="forma" action="<%= AppUtils.getBaseURL() %>" method="post">
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="<%= AppConstants.RI_ACTION %>" value="report.schedule.submit">
+ <input type="hidden" name="<%= AppConstants.RI_REPORT_ID %>" value="<%= reportID %>">
+ <input type="hidden" name="<%= AppConstants.RI_DETAIL_ID %>" value="<%= AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID) %>">
+ <input type="hidden" name="<%= AppConstants.RI_GO_TO_STEP %>" value="">
+ <input type="hidden" name="<%= AppConstants.RI_WIZARD_ACTION %>" value="<%= AppConstants.WA_BACK %>">
+ <input type="hidden" name="<%= AppConstants.RI_SCHEDULE_ID %>" value="<%= AppUtils.getRequestNvlValue(request, AppConstants.RI_SCHEDULE_ID) %>">
+
+
+<table width="94%" class="tableBorder" border="0" cellspacing="0" cellpadding="0" align=center>
+<tr><td>
+ <table width="100%" border="0" cellspacing="0" cellpadding="3">
+ <tr class=rbg1>
+ <td valign="Middle"><b class=rtableheader><%= title.toString() %></b></td>
+ </tr>
+ <% if(request.getAttribute("message")!=null) { %>
+ <tr class=rbg1>
+ <td valign="Middle"><b class=rtableheader><%= (String) request.getAttribute("message") %></b></td>
+ </tr>
+ <% } %>
+ </table>
+</td></tr><tr><td>
+ <jsp:include page="wizard_adhoc_schedule.jsp"/>
+</td></tr><tr><td>
+ <table width="100%" border="0" cellspacing="1" cellpadding="3">
+ <tr>
+ <td width="10%" align="right">
+ &nbsp;
+ </td>
+ <td align=center>
+ <input type=submit class="button" border="0" value="Submit" width="71" height="28" onClick="if(! dataValidate()) return false; document.forma.<%= AppConstants.RI_ACTION %>.value='report.schedule.submit';">
+ <%--<input type=submit class="button" border="0" value="Report Search Page" width="71" height="28" onClick="document.forma.<%= AppConstants.RI_ACTION %>.value='report.search.public.container';">--%>
+
+ </td>
+ </tr>
+ </table>
+</td></tr>
+</table>
+</form>
+
+ <jsp:include page="footer.jsp" flush="true" />
+</div>
+</td>
+</tr>
+</table>
+<%--<jsp:include page="disclaimer.jsp" flush="true" />--%>
+<script>
+ //document.getElementById('loadingMessageDiv').style.display='none';
+ //adding the bread crumb on the folder tree
+ if (window.parent && window.parent.addBreadCrumb)
+ window.parent.addBreadCrumb(true, "000<%=rdef.getReportID()%>");
+ //displayTree("000<%=rdef.getReportID()%>");
+ <%
+ String isTreeHidden = "true";
+ if(request.getSession().getAttribute("isTreeHidden") != null && ((String)request.getSession().getAttribute("isTreeHidden")).equals("true")){
+ isTreeHidden = "true";
+ }else{
+ isTreeHidden = "false";
+ }
+ %>
+ //if ("<%=isTreeHidden%>" == "true"){
+ // hideTree();
+ //}
+ //document.getElementById('contentDiv').style.height=document.body.offsetHeight - 50;
+</script>
+<%! private String HTMLEncode(String value) {
+ StringBuffer sb = new StringBuffer(value);
+
+ for(int i=0; i<sb.length(); i++)
+ if(sb.charAt(i)=='<')
+ sb.replace(i, i+1, "&lt;");
+ else if(sb.charAt(i)=='>')
+ sb.replace(i, i+1, "&gt;");
+ else if(sb.charAt(i)=='"')
+ sb.replace(i, i+1, "&quot;");
+
+ return sb.toString();
+ } // HTMLEncode
+
+ private String clearSpaces(String value) {
+ StringBuffer sb = new StringBuffer(value);
+
+ for(int i=0; i<sb.length(); i++)
+ if(sb.charAt(i)==' ')
+ sb.replace(i, i+1, "&nbsp;");
+
+ return sb.toString();
+ } // clearSpaces
+
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only_from_search.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only_from_search.jsp
new file mode 100644
index 00000000..af951cc2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only_from_search.jsp
@@ -0,0 +1,173 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="java.util.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
+
+<%@ page errorPage="error_page.jsp" %>
+
+
+
+<% ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+
+ String reportID = rdef.getReportID();
+
+
+
+ String dbInfo = null;
+ dbInfo = rdef.getDBInfo();
+ int sessionflag = 0;
+ if(dbInfo == null || dbInfo.length() == 0) {
+ dbInfo = (String) session.getAttribute("remoteDB");
+ sessionflag = 1;
+ }
+ session.setAttribute("remoteDB", dbInfo);
+ if((dbInfo == null) && (request.getParameter("dataSource")!=null))
+ session.setAttribute("remoteDB", request.getParameter("dataSource"));
+
+ StringBuffer title = new StringBuffer("");
+ title.append(Globals.getBaseTitle()+" > "+(reportID.equals("-1")?"Create Report":"Schedule Report"));
+ title.append(" > "+rdef.getReportName());
+
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
+%>
+<!-- Set All variable to request, to enable included jsp to access it -->
+<%
+ request.setAttribute(AppConstants.SI_REPORT_DEFINITION,rdef);
+%>
+
+ <jsp:include page="header.jsp" flush="true" />
+ <!-- <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">-->
+<script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/raptor.js"></script>
+
+
+<jsp:include page="error_include.jsp" flush="true" />
+
+<table width="100%" >
+<tr><td id="folderTreeContainer" width="1%" height='300' valign='top' ><table>
+ <!--<jsp:include page="tree/folderNav.jsp" flush="true" >
+ <jsp:param name="doCollapseTree" value="Y" />
+ </jsp:include>-->
+ </table>
+</td>
+<td id="searchContentContainer" valign='top' >
+<div id="contentDiv" style="position:relative;overflow:auto;">
+<form name="forma" action="<%= AppUtils.getBaseURL() %>" method="post">
+ <input type="hidden" name="action" value="raptor">
+ <input type="hidden" name="<%= AppConstants.RI_ACTION %>" value="report.schedule.submit_from_search">
+ <input type="hidden" name="<%= AppConstants.RI_REPORT_ID %>" value="<%= reportID %>">
+ <input type="hidden" name="<%= AppConstants.RI_DETAIL_ID %>" value="<%= AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID) %>">
+ <input type="hidden" name="<%= AppConstants.RI_GO_TO_STEP %>" value="">
+ <input type="hidden" name="<%= AppConstants.RI_WIZARD_ACTION %>" value="<%= AppConstants.WA_BACK %>">
+ <input type="hidden" name="<%= AppConstants.RI_SCHEDULE_ID %>" value="<%= AppUtils.getRequestNvlValue(request, AppConstants.RI_SCHEDULE_ID) %>">
+
+
+<table width="94%" class="tableBorder" cellspacing="0" cellpadding="0" align=center>
+<tr><td>
+ <table width="100%" border="0" cellspacing="0" cellpadding="3">
+ <% if(request.getAttribute("message")!=null) { %>
+ <tr >
+ <td valign="Middle"><b class=rerrortext><%= (String) request.getAttribute("message") %></b></td>
+ </tr>
+ <% } %>
+ <tr class=rbg1>
+ <td valign="Middle"><b class=rtableheader><%= title.toString() %></b></td>
+ </tr>
+
+ </table>
+</td></tr><tr><td>
+ <jsp:include page="wizard_adhoc_schedule.jsp"/>
+</td></tr><tr><td>
+ <table width="100%" border="0" cellspacing="1" cellpadding="3">
+ <tr>
+ <td width="10%" align="right">
+ &nbsp;
+ </td>
+ <td align=center>
+ <input type=submit class="button" border="0" value="Submit" width="71" height="28" onClick="if(! dataValidate()) return false; document.forma.<%= AppConstants.RI_ACTION %>.value='report.schedule.submit_from_search';">
+ <%--<input type=submit class="button" border="0" value="Report Search Page" width="71" height="28" onClick="document.forma.<%= AppConstants.RI_ACTION %>.value='report.search.public.container';">--%>
+
+ </td>
+ </tr>
+ </table>
+</td></tr>
+</table>
+</form>
+
+ <jsp:include page="footer.jsp" flush="true" />
+</div>
+</td>
+</tr>
+</table>
+<%--<jsp:include page="disclaimer.jsp" flush="true" />--%>
+<script>
+ //document.getElementById('loadingMessageDiv').style.display='none';
+ //adding the bread crumb on the folder tree
+ if (window.parent && window.parent.addBreadCrumb)
+ window.parent.addBreadCrumb(true, "000<%=rdef.getReportID()%>");
+ //displayTree("000<%=rdef.getReportID()%>");
+ <%
+ String isTreeHidden = "true";
+ if(request.getSession().getAttribute("isTreeHidden") != null && ((String)request.getSession().getAttribute("isTreeHidden")).equals("true")){
+ isTreeHidden = "true";
+ }else{
+ isTreeHidden = "false";
+ }
+ %>
+ //if ("<%=isTreeHidden%>" == "true"){
+ // hideTree();
+ //}
+ //document.getElementById('contentDiv').style.height=document.body.offsetHeight - 50;
+</script>
+<%! private String HTMLEncode(String value) {
+ StringBuffer sb = new StringBuffer(value);
+
+ for(int i=0; i<sb.length(); i++)
+ if(sb.charAt(i)=='<')
+ sb.replace(i, i+1, "&lt;");
+ else if(sb.charAt(i)=='>')
+ sb.replace(i, i+1, "&gt;");
+ else if(sb.charAt(i)=='"')
+ sb.replace(i, i+1, "&quot;");
+
+ return sb.toString();
+ } // HTMLEncode
+
+ private String clearSpaces(String value) {
+ StringBuffer sb = new StringBuffer(value);
+
+ for(int i=0; i<sb.length(); i++)
+ if(sb.charAt(i)==' ')
+ sb.replace(i, i+1, "&nbsp;");
+
+ return sb.toString();
+ } // clearSpaces
+
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_edit.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_edit.jsp
new file mode 100644
index 00000000..18c450ba
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_edit.jsp
@@ -0,0 +1,86 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+ boolean isEdit = curSubStep.equals(AppConstants.WSS_EDIT);
+ DataColumnType currColumn = null;
+ if(isEdit)
+ currColumn = rdef.getColumnById(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); %>
+
+<table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %><%= curSubStep.equals(AppConstants.WSS_EDIT)?"Edit Sorting":(curSubStep.equals(AppConstants.WSS_ADD)?"Add Sorting":"") %></b></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30" style="background-image:url(<%= AppUtils.getImgFolderURL() %>required.gif); background-position:top right; background-repeat:no-repeat;">
+ <font class=rtabletext>Sort By Column: </font>
+ </td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <% if(isEdit) { %>
+ <%= currColumn.getDisplayName() %>
+ <% } else { %>
+ <select name="sortColId">
+ <% int iCount = 0;
+ List reportCols = rdef.getAllColumns();
+ for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if(dct.getOrderBySeq()<=0) { %>
+ <option value="<%= dct.getColId() %>"<%= ((iCount++)==0)?" selected":"" %>><%= dct.getDisplayName() %>
+ <% } // if
+ } // for
+ %>
+ </select>
+ <% } // else
+ %>
+ </font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Sort Type: </font></td>
+ <td class=rbg3 align="left" width="50%"><font class=rtabletext>
+ <select name="sortAscDesc">
+ <option value="<%= AppConstants.SO_ASC %>" <%= (isEdit&&nvl(currColumn.getOrderByAscDesc(), AppConstants.SO_ASC).equals(AppConstants.SO_DESC))?"":" selected" %>>Ascending
+ <option value="<%= AppConstants.SO_DESC %>"<%= (isEdit&&nvl(currColumn.getOrderByAscDesc(), AppConstants.SO_ASC).equals(AppConstants.SO_DESC))?" selected":"" %>>Descending
+ </select>
+ </font></td>
+ </tr>
+</table>
+<br>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+ return true;
+} // dataValidate
+//-->
+</script>
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_list.jsp
new file mode 100644
index 00000000..63bf9cd3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_list.jsp
@@ -0,0 +1,116 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.ReportWrapper" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %>
+<%@ page import="java.util.Collections" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.OrderSeqComparator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.OrderBySeqComparator" %>
+
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+ String reportID = rdef.getReportID();
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
+ List reportCols = rdef.getAllColumns();
+ Collections.sort(reportCols, new OrderSeqComparator());
+ int numSortCols = rdef.getNumSortColumns(); %>
+<table class="mTAB" width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=6 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+ <tr class=rbg1>
+ <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>Sort Order</b></td>
+ <td align="center" valign="Middle" width="65%"><b class=rtableheader>Sort By Column</b></td>
+ <td align="center" valign="Middle" width="7%"><b class=rtableheader>Sort Type</b></td>
+ <td align="center" valign="Middle" width="7%" nowrap><b class=rtableheader>Re-order</b></td>
+ <td align="center" valign="Middle" width="14%" colspan=2>
+ <% if(numSortCols<reportCols.size()) { %>
+ <table border="0" cellspacing="0" cellpadding="0"><tr>
+ <td height="28"><input type="button" class=button value="Add One" border="0" width="104" height="28" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD %>';document.forma.submit();"></td>
+ </tr><tr><td height="28">
+ <% } %>
+ <input type="button" class=button value="Re-order All" border="0" width="104" height="28" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ORDER_ALL %>';document.forma.submit();">
+ <% if(numSortCols<reportCols.size()) { %>
+ </td></tr></table>
+ <% } %>
+ </td>
+ </tr>
+<% int iCount = 0;
+ Collections.sort(reportCols,new OrderBySeqComparator());
+ for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if(dct.getOrderBySeq()>0) { %>
+ <tr class=<%=(iCount % 2 == 0)?"rowalt1":"rowalt2"%>>
+ <td align="center" height="30"><font class=rtabletext><%= iCount+1 %><!--dct.getOrderBySeq(): <%= dct.getOrderBySeq() %>--></font></td>
+ <td><font class=rtabletext><%= dct.getDisplayName() %></font></td>
+ <td align="center"><font class=rtabletext><%= dct.getOrderByAscDesc().equals(AppConstants.SO_ASC)?"Ascending":"Descending" %></font></td>
+ <td align="center" nowrap>
+<% if(iCount==0) { %>
+ <img border="0" src="<%= AppUtils.getImgFolderURL() %>columnblankdown.gif" width="25" height="7">
+<% } else { %>
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>columnup.gif" width="25" height="7" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_MOVE_UP %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dct.getColId() %>';">
+<% } %>
+<% if(iCount==numSortCols-1) { %>
+ <img border="0" src="<%= AppUtils.getImgFolderURL() %>columnblankup.gif" width="25" height="7">
+<% } else { %>
+ <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>columndown.gif" width="25" height="7" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_MOVE_DOWN %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dct.getColId() %>';">
+<% } %>
+ </td>
+ <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>pen_paper.gif" alt="Edit" width="12" height="12" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_EDIT %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dct.getColId() %>';"></td>
+ <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! confirm('Are you sure you want to remove sort on column <%= dct.getDisplayName() %>?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dct.getColId() %>'; }"></td>
+ </tr>
+<%
+ iCount++;
+ } // if
+ } // for
+ Collections.sort(reportCols, new OrderSeqComparator());
+%>
+<% if(numSortCols==0) { %>
+ <tr class=rbg2>
+ <td colspan=6 align="center" height="30"><font class=rtabletext>No sorting defined</font></td>
+ </tr>
+<% } %>
+</table>
+<br>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+ return true;
+} // dataValidate
+//-->
+</script>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_order_all.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_order_all.jsp
new file mode 100644
index 00000000..9e04f2b8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_order_all.jsp
@@ -0,0 +1,112 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.ReportWrapper" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.OrderBySeqComparator" %>
+<%@ page import="java.util.Collections" %>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+ String reportID = rdef.getReportID();
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
+
+%>
+<table class="mTAB" width="100%" class="tableBorder" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=4 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %> - <%= curSubStep %></b></td>
+ </tr>
+ <tr class=rbg1>
+ <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>&nbsp;&nbsp;No&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="65%"><b class=rtableheader>Column</b></td>
+ <td align="center" valign="Middle" width="14%"><b class=rtableheader>Sort Order</b></td>
+ <td align="center" valign="Middle" width="14%"><b class=rtableheader>Sort Type</b></td>
+ </tr>
+<% int icnt = 0;
+ for(Iterator iter=rdef.getAllColumns().iterator(); iter.hasNext(); icnt++) {
+ DataColumnType dct = (DataColumnType) iter.next(); %>
+ <tr<%= (icnt%2==0)?" class=rowalt1":" class=rowalt2" %>>
+ <td align="center" height="30"><font class=rtabletext><%= icnt+1 %></font></td>
+ <td><font class=rtabletext><%= dct.getDisplayName() %></font></td>
+ <td align="center" valign="middle">
+ <input type="hidden" name="colId" value="<%= dct.getColId() %>">
+ <input type="text" size="5" maxlength="5" name="sortOrder" value="<%= (dct.getOrderBySeq()>0)?(""+dct.getOrderBySeq()):"" %>">
+ </td>
+ <td align="left" valign="middle">
+ <select name="sortAscDesc">
+ <option value="<%= AppConstants.SO_ASC %>" <%= nvl(dct.getOrderByAscDesc(), AppConstants.SO_ASC).equals(AppConstants.SO_DESC)?"":" selected" %>>Ascending
+ <option value="<%= AppConstants.SO_DESC %>"<%= nvl(dct.getOrderByAscDesc(), AppConstants.SO_ASC).equals(AppConstants.SO_DESC)?" selected":"" %>>Descending
+ </select>
+ </td>
+ </tr>
+<% } // for
+%>
+</table>
+ <input type="hidden" name="sortOrder" value="">
+ <input type="hidden" name="sortOrder" value="">
+<br>
+
+<script language="JavaScript">
+<!--
+var colNames = new Array(<%= rdef.getAllColumns().size() %>);
+<% for(int i=0; i<rdef.getAllColumns().size(); i++) {
+ DataColumnType dct = (DataColumnType) rdef.getAllColumns().get(i); %>
+colNames[<%= i %>] = "<%= dct.getDisplayName() %>";
+<% } %>
+
+function dataValidate() {
+ var val = "";
+ for(var i=0; i<document.forma.sortOrder.length; i++) {
+ val = document.forma.sortOrder[i].value;
+ if(val!="")
+ if(! checkPositiveInteger(val)) {
+ alert("Sort Order for column "+colNames[i]+" should be a positive integer.\nPlease enter valid Sort Order value.");
+ document.forma.sortOrder[i].focus();
+ document.forma.sortOrder[i].select();
+
+ return false;
+ } // if
+ } // for
+
+ return true;
+} // dataValidate
+//-->
+</script>
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sql_def.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sql_def.jsp
new file mode 100644
index 00000000..d8152c05
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sql_def.jsp
@@ -0,0 +1,226 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.ReportWrapper" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.OrderBySeqComparator" %>
+<%@ page import="java.util.Collections" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %>
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+ String reportID = rdef.getReportID();
+ boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
+ boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
+
+%>
+<script language="JavaScript">
+<!--
+function addText(newText) {
+ document.forma.reportSQL.value += (""+newText+" ");
+ document.forma.sqlValidated.value = "N";
+} // addText
+
+function getSelectedTableName() {
+ var tableName = "";
+ tableName = document.forma.dbTables.options[document.forma.dbTables.selectedIndex].value;
+ return tableName;
+} // getSelectedTableName
+
+function addTable() {
+ addText(getSelectedTableName());
+} // addTable
+
+function showTableColsPopup() {
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.table.cols&<%= AppConstants.RI_TABLE_NAME %>="+getSelectedTableName(), "tableColsPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showTableColsPopup
+
+function showTestRunSQLPopup() {
+ //var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.testrun.sql&<%= AppConstants.RI_FORMATTED_SQL %>="+escape(""+document.forma.reportSQL.value), "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.test.jsp", "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+} // showTestRunSQLPopup
+
+function showFormFieldPopup() {
+ var w = window.open("", "fieldPopup", "width=400,height=400,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
+ w.focus();
+ w.opener = this;
+
+ w.document.writeln("<html><head>");
+ w.document.writeln("<title>Form Fields</title>");
+ w.document.writeln("<link rel=stylesheet type=text/css href='<%= AppUtils.getBaseFolderURL() %>css/raptor.css'>");
+ w.document.writeln("<script language=JavaScript>");
+ w.document.writeln("function setValue(newValue) {");
+ w.document.writeln(" window.opener.addText(newValue);");
+ w.document.writeln(" window.close();");
+ w.document.writeln("} // setValue");
+ w.document.writeln("</"+"script>");
+ w.document.writeln("</head><body>");
+
+ w.document.writeln("<table width=94% border=0 cellspacing=1 align=center>");
+ w.document.writeln(" <tr class=rbg1>");
+ w.document.writeln(" <td height=30>&nbsp;</td>");
+ w.document.writeln(" <td><b class=rtableheader>Report Form Fields</b></td>");
+ w.document.writeln(" </tr>");
+<% int iCnt = 0;
+ if(rdef.getFormFieldList()!=null)
+ for(Iterator iter=rdef.getFormFieldList().getFormField().iterator(); iter.hasNext(); iCnt++) {
+ FormFieldType fft = (FormFieldType) iter.next(); %>
+ w.document.writeln(" <tr<%= (iCnt%2==0)?" class=rbg8":"" %>>");
+ w.document.writeln(" <td align=center valign=middle height=30><font class=rtabletext><%= (iCnt+1) %></font></td>");
+ w.document.writeln(" <td valign=middle>");
+ w.document.writeln(" <b class=rtabletext><a href=\"javascript:setValue('[<%= fft.getFieldName() %>]')\"><%= fft.getFieldName() %></a></b>");
+ w.document.writeln(" </td>");
+ w.document.writeln(" </tr>");
+<% } // for
+ if(iCnt==0) { %>
+ w.document.writeln(" <tr class=rbg8 height=30>");
+ w.document.writeln(" <td colspan=2 align=center valign=middle><b class=rtabletext>There are no form fields defined</b></td>");
+ w.document.writeln(" </tr>");
+ w.document.writeln(" <tr>");
+ w.document.writeln(" <td colspan=2 align=center><br><button type='submit' onClick=\"window.close();\" att-button btn-type=\"primary\" size=\"small\" title='Save'>Close</button></td>");
+ w.document.writeln(" </tr>");
+<% } else { %>
+ w.document.writeln(" <tr class=rbg1 height=30>");
+ w.document.writeln(" <td>&nbsp;</td>");
+ w.document.writeln(" <td>&nbsp;</td>");
+ w.document.writeln(" </tr>");
+<% } // if
+%>
+ w.document.writeln("</table>");
+
+ w.document.writeln("</body></html>");
+ w.document.close();
+} // showFormFieldPopup
+//-->
+</script>
+
+<table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+ <tr>
+ <td class=rbg3 width="60%" align="left" valign="top">
+ &nbsp;<font class=rtabletext>Report SQL: </font><br>
+ <% boolean sqlValidated = (nvl(AppUtils.getRequestValue(request, "sqlValidated"), nvl(rdef.getReportSQL())).length()>0);
+ if(request.getAttribute(AppConstants.RI_ERROR_LIST)!=null)
+ sqlValidated = false;
+
+ String sql = nvl(rdef.getReportSQL(), "SELECT ");
+ if(! sqlValidated)
+ sql = nvl(AppUtils.getRequestValue(request, "reportSQL"), sql); %>
+ <input type="hidden" id="sqlValidated" name="sqlValidated" value="<%= sqlValidated?"Y":"N" %>">
+ &nbsp;<textarea name="reportSQL" cols="155" rows="32" onChange="document.getElementById('sqlValidated').value='N';" style="height: 400px;"><%= sql %></textarea>
+ </td>
+ <td class=rbg2 width="40%" align="left" valign="top" nowrap>
+ &nbsp;<font class=rtabletext>Keyword Assistance </font><br>
+ <b class=rtabletext>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('SELECT')">SELECT</a>&nbsp;&nbsp;<a href="javascript:addText('DISTINCT')">DISTINCT</a>&nbsp;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('FROM')">FROM</a>&nbsp;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('WHERE')">WHERE</a>&nbsp;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('GROUP BY')">GROUP BY</a>&nbsp;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('HAVING')">HAVING</a>&nbsp;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('ORDER BY')">ORDER BY</a>&nbsp;&nbsp;<a href="javascript:addText('ASC')">ASC</a>&nbsp;&nbsp;<a href="javascript:addText('DESC')">DESC</a>&nbsp;<br>
+ <br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('UNION')">UNION</a>&nbsp;&nbsp;<a href="javascript:addText('ALL')">ALL</a>&nbsp;&nbsp;<a href="javascript:addText('INTERSECT')">INTERSECT</a>&nbsp;&nbsp;<a href="javascript:addText('MINUS')">MINUS</a>&nbsp;<br>
+ <br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('AND')">AND</a>&nbsp;&nbsp;<a href="javascript:addText('OR')">OR</a>&nbsp;&nbsp;<a href="javascript:addText('NOT')">NOT</a>&nbsp;&nbsp;<a href="javascript:addText('EXISTS')">EXISTS</a>&nbsp;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('IS')">IS</a>&nbsp;&nbsp;<a href="javascript:addText('NULL')">NULL</a>&nbsp;&nbsp;<a href="javascript:addText('IN')">IN</a>&nbsp;&nbsp;<a href="javascript:addText('BETWEEN')">BETWEEN</a>&nbsp;<br>
+ <br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('COUNT(')">COUNT(</a>&nbsp;&nbsp;<a href="javascript:addText('SUM(')">SUM(</a>&nbsp;&nbsp;<a href="javascript:addText('AVG(')">AVG(</a>&nbsp;&nbsp;<a href="javascript:addText('MAX(')">MAX(</a>&nbsp;&nbsp;<a href="javascript:addText('MIN(')">MIN(</a>&nbsp;<br>
+ <br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('NVL(')">NVL(</a>&nbsp;&nbsp;<a href="javascript:addText('DECODE(')">DECODE(</a>&nbsp;&nbsp;<a href="javascript:addText('SYSDATE')">SYSDATE</a>&nbsp;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('TO_CHAR(')">TO_CHAR(</a>&nbsp;&nbsp;<a href="javascript:addText('TO_NUMBER(')">TO_NUMBER(</a>&nbsp;&nbsp;<a href="javascript:addText('TO_DATE(')">TO_DATE(</a>&nbsp;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('TRUNC(')">TRUNC(</a>&nbsp;&nbsp;<a href="javascript:addText('ROUND(')">ROUND(</a>&nbsp;&nbsp;<a href="javascript:addText('ABS(')">ABS(</a>&nbsp;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('SUBSTR(')">SUBSTR(</a>&nbsp;&nbsp;<a href="javascript:addText('REPLACE(')">REPLACE(</a>&nbsp;&nbsp;<a href="javascript:addText('LOWER(')">LOWER(</a>&nbsp;&nbsp;<a href="javascript:addText('UPPER(')">UPPER(</a>&nbsp;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:addText('LTRIM(')">LTRIM(</a>&nbsp;&nbsp;<a href="javascript:addText('RTRIM(')">RTRIM(</a>&nbsp;&nbsp;<a href="javascript:addText('LPAD(')">LPAD(</a>&nbsp;&nbsp;<a href="javascript:addText('RPAD(')">RPAD(</a>&nbsp;<br>
+ </b>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg2 height="40" align="left" valign="Middle" nowrap>
+ <font class=rtabletext style="display: none">
+ &nbsp;Tables:
+ <select name="dbTables" style="width: 200px">
+ <% Vector reportTableSources = DataCache.getReportTableSources((String) session.getAttribute("remoteDB"));
+ for(int i=0; i<reportTableSources.size(); i++) {
+ TableSource tableSource = (TableSource) reportTableSources.get(i); %>
+ <option value="<%= tableSource.getTableName() %>"><%= tableSource.getTableName() %>
+ <% } %>
+ </select>
+ <button type="submit" onClick="addTable()" att-button btn-type="primary" size="small" title='Add Table'>Add Table</button>
+ <button type="submit" onClick="showTableColsPopup()" att-button btn-type="primary" size="small" title='Columns'>Columns</button>
+ <button type="submit" onClick="showFormFieldPopup()" att-button btn-type="primary" size="small" title='Form Fields'>Form Fields</button>
+ &nbsp;
+ </font>
+ </td>
+ <td class=rbg2 align="left" valign="Middle" nowrap>
+ <font class=rtabletext>&nbsp;
+ <button type="submit" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_VALIDATE %>';" att-button btn-type="primary" size="small" title='Validate SQL'>Validate SQL</button>
+ &nbsp;
+ <button type="Button" onClick="showTestRunSQLPopup()" att-button btn-type="primary" size="small" title='Test Run SQL'>Test Run SQL</button>
+ &nbsp;
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td class=rbg1 colspan=2 height="30" align="center" valign="Middle"><b class=rtableheader>You need to click the &quot;Validate SQL&quot; button in order to store the SQL before going forward</b></td>
+ </tr>
+</table>
+<br>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+ if(document.getElementById("sqlValidated") && document.getElementById("sqlValidated").value!="Y") {
+ <% if(nvl(rdef.getReportSQL()).length()>0) { %>
+ return confirm("The changes made to the SQL have not been validated.\nYou need to click the \"Validate SQL\" button in order to do that.\nDo you want to continue now and lose the changes made to the SQL after the last validation?");
+ <% } else { %>
+ alert("The SQL has not been validated.\nPlease click the \"Validate SQL\" button in order to do that.\nYou cannot go forward without SQL validation.");
+ return false;
+ <% } %>
+ } // if
+
+ return true;
+} // dataValidate
+//-->
+</script>
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_edit.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_edit.jsp
new file mode 100644
index 00000000..88ecda31
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_edit.jsp
@@ -0,0 +1,369 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="java.util.List" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableJoin" %>
+<%@ page import="org.openecomp.portalsdk.analytics.error.UserDefinedException"%>
+
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+ boolean isEdit = curSubStep.equals(AppConstants.WSS_EDIT);
+ DataSourceType currTable = null;
+ if(isEdit)
+ currTable = rdef.getTableById(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ Vector reportTableSources = (isEdit)?DataCache.getReportTableSources((String) session.getAttribute("remoteDB")):DataCache.getReportTableSources(AppUtils.getUserRoles(request),((String) session.getAttribute("remoteDB")), AppUtils.getUserID(request), request);
+ if(reportTableSources.size()<=0) {
+ request.setAttribute(AppConstants.RI_EXCEPTION, new Exception("Please add table name to the raptor table for generating report"));
+ throw new UserDefinedException("Please add table name to the raptor table for generating report");
+ }
+ Vector reportTableJoins = (isEdit)?DataCache.getReportTableJoins():DataCache.getReportTableJoins(AppUtils.getUserRoles(request)); %>
+
+<% if(! isEdit) { %>
+<script language="JavaScript">
+<!--
+ var tablesExist = false;
+ <% if(rdef.getDataSourceList().getDataSource().size()>0) { %>
+ tablesExist = true;
+
+ function setJoinTableName(tableId) {
+ var selIndex = 0;
+ for(var i=1; i<document.forma.joinTableName.options.length; i++)
+ if(tableId==document.forma.joinTableName.options[i].value)
+ selIndex = i;
+
+ document.forma.joinTableName.selectedIndex = selIndex;
+ } // setJoinTableName
+ <% } %>
+
+ function tableNameChange() {
+ var newTableName = "";
+ newTableName = document.forma.tableName.options[document.forma.tableName.selectedIndex].value;
+
+ document.forma.displayName.value=document.forma.tableName.options[document.forma.tableName.selectedIndex].text;
+
+ // Setting the PK values
+ if(false) {}
+
+ <% for(int i=0; i<reportTableSources.size(); i++) {
+ TableSource tableSource = (TableSource) reportTableSources.get(i); %>
+ else if(newTableName=="<%= tableSource.getTableName() %>")
+ document.forma.tablePK.value = "<%= tableSource.getPkFields() %>";
+ <% } %>
+
+ <% if(rdef.getDataSourceList().getDataSource().size()>0) {
+ for(Iterator iter=rdef.getDataSourceList().getDataSource().iterator(); iter.hasNext(); ) {
+ DataSourceType dst = (DataSourceType) iter.next();
+
+ for(int i=0; i<reportTableJoins.size(); i++) {
+ TableJoin tableJoin = (TableJoin) reportTableJoins.get(i);
+ if(dst.getTableName().equals(tableJoin.getSrcTableName())) { %>
+ if(newTableName=="<%= tableJoin.getDestTableName() %>")
+ setJoinTableName("<%= dst.getTableId() %>");
+ else
+ <% } else if(dst.getTableName().equals(tableJoin.getDestTableName())) { %>
+ if(newTableName=="<%= tableJoin.getSrcTableName() %>")
+ setJoinTableName("<%= dst.getTableId() %>");
+ else
+ <% } // if
+ } // for
+ } %>
+ setJoinTableName("");
+ <% } %>
+ listJoinExpr(document.forma.tableName.options[document.forma.tableName.selectedIndex].value,
+ document.forma.joinTableName.options[document.forma.joinTableName.selectedIndex].value);
+ } // tableNameChange
+
+
+//-->
+</script >
+<% } %>
+
+<script language="JavaScript">
+<!--
+ //load table join info to an array of objects
+ function table_join(src_table, dest_table, join_expr) {
+ this.src_table = src_table;
+ this.dest_table = dest_table;
+ this.join_expr = join_expr;
+ }
+
+ var table_joins = new Array();
+
+ <% for(int i=0; i<reportTableJoins.size(); i++) {
+ TableJoin tableJoin = (TableJoin) reportTableJoins.get(i); %>
+ table_joins[table_joins.length] =
+ new table_join("<%=tableJoin.getSrcTableName()%>","<%=tableJoin.getDestTableName()%>","<%=tableJoin.getJoinExpr()%>");
+ <% } %>
+
+ function table_id_name_mapping(table_id, table_name) {
+ this.table_id = table_id;
+ this.table_name = table_name;
+ }
+
+ var table_id_name_mappings = new Array();
+
+ <% for(Iterator iter=rdef.getDataSourceList().getDataSource().iterator(); iter.hasNext(); ) {
+ DataSourceType dst = (DataSourceType) iter.next(); %>
+ table_id_name_mappings["<%= dst.getTableId()%>"] = "<%= dst.getTableName()%>";
+ table_id_name_mappings["<%= dst.getTableName()%>"] = "<%= dst.getTableId()%>";
+ <% } %>
+
+ function listJoinExpr(tableName, joinTableId) {
+
+ removeAllOptions(document.forma.joinExpr);
+ var isJoinExprFound = false;
+
+ <%if(isEdit) {%>
+ addOption(document.forma.joinExpr, "" ,"No Change");
+ <%}%>
+
+ for ( var i=0; i<table_joins.length; i++) {
+ if( (table_joins[i].src_table==tableName && table_joins[i].dest_table==table_id_name_mappings[joinTableId])
+ ||
+ (table_joins[i].dest_table==tableName && table_joins[i].src_table==table_id_name_mappings[joinTableId])
+ )
+ {
+ addOption(document.forma.joinExpr, table_joins[i].join_expr ,table_joins[i].join_expr );
+ isJoinExprFound = true;
+ }
+ }
+
+ if(!isJoinExprFound)
+ {
+ removeAllOptions(document.forma.joinExpr);
+ addOption(document.forma.joinExpr, "" ,"No Join Condition Defined");
+ }
+ }
+
+ function removeAllOptions(selectbox)
+ {
+ var i;
+ for(i=selectbox.options.length-1;i>=0;i--)
+ {
+ selectbox.remove(i);
+ }
+ }
+
+ function addOption(selectbox, value, text )
+ {
+ var optn = document.createElement("OPTION");
+ optn.text = text;
+ optn.value = value;
+
+ selectbox.options.add(optn);
+ }
+-->
+</script>
+
+<table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %> - <%= curSubStep %></b></td>
+ </tr>
+ <tr>
+ <td align="right" width="25%" class=rbg2 height="30" style="background-image:url(<%= AppUtils.getImgFolderURL() %>required.gif); background-position:top right; background-repeat:no-repeat;"><font class=rtabletext>Table Name </font></td>
+ <td align="left" width="50%" class=rbg3><font class=rtabletext>
+ <% if(isEdit) {
+ String tName = null;
+ for(int i=0; i<reportTableSources.size(); i++) {
+ TableSource tableSource = (TableSource) reportTableSources.get(i);
+ if(currTable.getTableName().equals(tableSource.getTableName())) {
+ tName = tableSource.getDisplayName();
+ break;
+ } // if
+ } %>
+ <%= nvl(tName, currTable.getTableName()) %>
+ <input type="hidden" name="tableName" value="<%=currTable.getTableName()%>">
+ <% } else { %>
+ <select name="tableName" class="rtabletext" onChange="tableNameChange()">
+ <% for(int i=0; i<reportTableSources.size(); i++) {
+ TableSource tableSource = (TableSource) reportTableSources.get(i); %>
+ <option value="<%= tableSource.getTableName() %>"<%= (i==0)?" selected":"" %>><%= tableSource.getDisplayName() %>
+ <% } %>
+ </select>
+ <% } %>
+ <input type="hidden" name="tablePK" value="<%= ((TableSource) reportTableSources.get(0)).getPkFields() %>">
+ </font></td>
+ </tr>
+ <tr>
+ <td align="right" width="25%" class=rbg2 height="30"><font class=rtabletext>Display Name </font></td>
+ <td align="left" width="50%" class=rbg3><font class=rtabletext>
+ <input type="text" class="rtabletext" size="30" maxlength="30" name="displayName" value="<%= isEdit?currTable.getDisplayName():((TableSource) reportTableSources.get(0)).getDisplayName() %>"></font></td>
+ </tr>
+<% if(rdef.getDataSourceList().getDataSource().size()>(isEdit?1:0)) {
+ String outerJoinType = (isEdit?rdef.getOuterJoinType(currTable):""); %>
+ <tr>
+ <td align="right" width="25%" class=rbg2 height="30"><font class=rtabletext>Join To Table </font></td>
+ <td align="left" width="50%" class=rbg3><font class=rtabletext>
+ <% if(isEdit) { %>
+ <% if(currTable.getRefTableId()==null){%>
+ --- Table Not Joined ---
+ <%} else { %>
+ <%=rdef.getTableById(currTable.getRefTableId()).getDisplayName() %>
+ </br>on :&nbsp;<%=currTable.getRefDefinition() %>
+ <%} %>
+ <input type="hidden" name="joinTableName" value="<%=currTable.getRefTableId()%>">
+
+ <% } else { %>
+ <select name="joinTableName" onChange="listJoinExpr();">
+ <option value="" selected>--- Tables Not Joined ---
+ <% for(Iterator iter=rdef.getDataSourceList().getDataSource().iterator(); iter.hasNext(); ) {
+ DataSourceType dst = (DataSourceType) iter.next(); %>
+ <option value="<%= dst.getTableId() %>"><%= dst.getDisplayName() %>
+ <% } %>
+ </select>
+ <% } %>
+ </font></td>
+ </tr>
+
+ <tr>
+ <td align="right" width="25%" class=rbg2 height="30"><font class=rtabletext>All availabe Join Options </font></td>
+ <td align="left" width="50%" class=rbg3><font class=rtabletext>
+ <select name="joinExpr">
+ <option value="" selected>No Join Condition</option>
+ </select>
+ </font></td>
+ </tr>
+ <% if(isEdit) { %>
+ <script language="JavaScript">
+ listJoinExpr("<%=currTable.getTableName()%>","<%=currTable.getRefTableId()%>");
+ </script>
+ <%} %>
+
+ <tr>
+ <td align="right" width="25%" class=rbg2 height="30"><font class=rtabletext>Join Type </font></td>
+ <td align="left" width="50%" class=rbg3><font class=rtabletext>
+ <select name="outerJoin">
+ <option value=""<%= (outerJoinType.length()==0)?" selected":"" %>>Include only records present in both tables
+ <option value="<%= AppConstants.OJ_CURRENT %>"<%= outerJoinType.equals(AppConstants.OJ_CURRENT)?" selected":"" %>>Include join table records without match in this table
+ <option value="<%= AppConstants.OJ_JOINED %>"<%= outerJoinType.equals(AppConstants.OJ_JOINED)?" selected":"" %>>Include records from this table without match in the join table
+ </select>
+ </font></td>
+ </tr>
+<% } %>
+</table>
+<br>
+
+<script language="JavaScript">
+<!--
+function checkNotJoined() {
+<% if(rdef.getDataSourceList().getDataSource().size()>(isEdit?1:0)) { %>
+ if(document.forma.outerJoin.selectedIndex==0) {
+ <% if(isEdit) { %>
+ var selTable = "<%= currTable.getTableName() %>";
+ var selDisplayName = "<%= currTable.getDisplayName() %>";
+ <% } else { %>
+ var selTable = document.forma.tableName.options[document.forma.tableName.selectedIndex].value;
+ var selDisplayName = document.forma.tableName.options[document.forma.tableName.selectedIndex].text;
+ <% } %>
+
+ if(false
+ <% for(int i=0; i<reportTableSources.size(); i++) {
+ TableSource tableSource = (TableSource) reportTableSources.get(i);
+ if(tableSource.getIsLargeData().equals("Y")) { %>
+ ||selTable=="<%= tableSource.getTableName() %>"
+ <% } // if
+ } // for
+ %>
+ ) {
+ alert("Table "+selDisplayName+" contains large amount of data\nand cannot be added unless it is joined to another table.\nPlease select a Join To Table from the list.");
+ document.forma.outerJoin.focus();
+
+ return false;
+ } // if
+ }
+<% if(! isEdit) { %>
+ else { // if(document.forma.outerJoin.selectedIndex>0)
+ var selTable = document.forma.tableName.options[document.forma.tableName.selectedIndex].value;
+ var selJoinTblId = document.forma.outerJoin.options[document.forma.outerJoin.selectedIndex].value;
+ var selJoinTable = "";
+ <% for(Iterator iter=rdef.getDataSourceList().getDataSource().iterator(); iter.hasNext(); ) {
+ DataSourceType dst = (DataSourceType) iter.next(); %>
+ if(selJoinTblId=="<%= dst.getTableId() %>")
+ selJoinTable = "<%= dst.getTableName() %>";
+ <% } // for
+ for(Iterator iter=reportTableJoins.iterator(); iter.hasNext(); ) {
+ TableJoin tableJoin = (TableJoin) iter.next(); %>
+ if((selTable=="<%= tableJoin.getSrcTableName() %>"&&selJoinTable=="<%= tableJoin.getDestTableName() %>")||
+ (selTable=="<%= tableJoin.getDestTableName() %>"&&selJoinTable=="<%= tableJoin.getSrcTableName() %>"))
+ return true;
+ <% } %>
+
+ alert("Table "+document.forma.tableName.options[document.forma.tableName.selectedIndex].text+
+ " cannot be joined to table "+document.forma.outerJoin.options[document.forma.outerJoin.selectedIndex].text+
+ ".\nPlease select a different join.");
+ return false;
+ } // if
+<% } // if(! isEdit)
+ } %>
+
+ return true;
+} // checkNotJoined
+
+function dataValidate() {
+ if(document.forma.displayName.value=="")
+ <% if(isEdit) { %>
+ document.forma.displayName.value = "<%= currTable.getDisplayName() %>";
+ <% } else { %>
+ document.forma.displayName.value = document.forma.tableName.options[selectedIndex].text;
+ <% } %>
+
+ if(false
+ <% for(Iterator iter=rdef.getDataSourceList().getDataSource().iterator(); iter.hasNext(); ) {
+ DataSourceType dst = (DataSourceType) iter.next();
+
+ if(! (isEdit&&dst.getTableId().equals(currTable.getTableId()))) { %>
+ ||document.forma.displayName.value=="<%= dst.getDisplayName() %>"
+ <% }
+ } %>
+ ) {
+ alert("Table with display name "+document.forma.displayName.value+" already exists.\nPlease select another name.");
+ document.forma.displayName.focus();
+ document.forma.displayName.select();
+
+ return false;
+ }
+
+ if(! checkNotJoined())
+ return false;
+
+ return true;
+} // dataValidate
+//-->
+</script>
+
+<%!
+ private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_list.jsp
new file mode 100644
index 00000000..47fd435f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_list.jsp
@@ -0,0 +1,85 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="java.util.List" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableJoin" %>
+
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+%>
+<table class="mTAB" width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=4 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+ <tr class=rbg1>
+ <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>&nbsp;&nbsp;No&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="79%"><b class=rtableheader>Table</b></td>
+ <td align="center" valign="Middle" width="14%" colspan=2><input type="button" class=button border="0" value="Add" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD %>';document.forma.submit();"></td>
+ </tr>
+<% int iCount = 0;
+ for(Iterator iter=rdef.getDataSourceList().getDataSource().iterator(); iter.hasNext(); iCount++) {
+ DataSourceType dst = (DataSourceType) iter.next(); %>
+ <tr class=<%=(iCount % 2 == 0)?"rowalt1":"rowalt2"%>>
+ <td align="center" height="30"><font class=rtabletext><%= iCount+1 %></font></td>
+ <td><font class=rtabletext><%= nvl(dst.getDisplayName()).length()>0?dst.getDisplayName():dst.getTableName()%></font></td>
+ <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>pen_paper.gif" alt="Edit" width="12" height="12" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_EDIT %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dst.getTableId() %>';"></td>
+ <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! confirm('Are you sure you want to remove the <%= dst.getDisplayName() %> table\nalong with all its columns from the report?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dst.getTableId() %>'; }"></td>
+ </tr>
+<% } %>
+<% if(iCount==0) { %>
+ <tr class=rbg3>
+ <td colspan=4 align="center" height="30"><font class=rtabletext>No tables defined</font></td>
+ </tr>
+<% } %>
+</table>
+<br>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+<% if(rdef.getDataSourceList().getDataSource().size()>0) { %>
+ return true;
+<% } else { %>
+ alert("You must have at least one table in the report.\nPlease add a table.");
+ return false;
+<% } %>
+} // dataValidate
+//-->
+</script>
+
+<%! private String nvl(String s) { return (s==null)?"":s; }
+ private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
+%>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_user_access.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_user_access.jsp
new file mode 100644
index 00000000..b5c68045
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_user_access.jsp
@@ -0,0 +1,184 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
+<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
+<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
+<%@ page import="java.util.Vector" %>
+<%@ page import="java.util.List" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableJoin" %>
+<%@ page import="org.openecomp.portalsdk.analytics.model.definition.SecurityEntry" %>
+<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
+
+<%
+ ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ String curSubStep = ws.getCurrentSubStep();
+%>
+<table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=4 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" width="16%" height="30"><font class=rtabletext>Created By: </font></td>
+ <td class=rbg3 align="left" width="34%" valign="middle" nowrap><font class=rtabletext><%= AppUtils.getUserName(rdef.getCreateID()) %></font></td>
+ <td class=rbg2 align="right" width="16%"><font class=rtabletext>Created Date: </font></td>
+ <td class=rbg3 align="left" width="34%" valign="middle" nowrap><font class=rtabletext><%= rdef.getCreateDate() %></font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Last Updated By: </font></td>
+ <td class=rbg3 align="left" valign="middle" nowrap><font class=rtabletext><%= AppUtils.getUserName(rdef.getUpdateID()) %></font></td>
+ <td class=rbg2 align="right"><font class=rtabletext>Last Updated: </font></td>
+ <td class=rbg3 align="left" valign="middle" nowrap><font class=rtabletext><%= rdef.getUpdateDate() %></font></td>
+ </tr>
+ <tr>
+ <td class=rbg2 align="right" height="30"><font class=rtabletext>Report Owner: </font></td>
+ <td class=rbg3 align="left"><font class=rtabletext>
+ <select name="reportOwner">
+<% Vector allUsers = Utils.getUsersNotInList(new java.util.ArrayList(),request);
+ for(int i=0; i<allUsers.size(); i++) {
+ IdNameValue user = (IdNameValue) allUsers.get(i); %>
+ <option value="<%= user.getId() %>"<%= user.getId().equals(rdef.getOwnerID())?" selected":"" %>><%= user.getName() %>
+<% } // for
+%>
+ </select></font>
+ </td>
+ <td class=rbg2 align="right"><font class=rtabletext>Public? (All users can run the report)</font></td>
+ <td class=rbg3 align="left">
+ <select name="public" >
+ <option value="Y"<%= rdef.isPublic()?" selected":"" %>>Yes
+ <option value="N"<%= rdef.isPublic()?"":" selected" %>>No
+ </select>
+ </td>
+ </tr>
+</table>
+<br>
+
+<table class="mTAB" width="100%" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=5 valign="Middle"><b class=rtableheader>Report Users</b></td>
+ </tr>
+ <tr class=rbg1>
+ <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>&nbsp;&nbsp;No&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="59%"><b class=rtableheader>User Name</b></td>
+ <td align="center" valign="Middle" width="10%"><b class=rtableheader>Run Access</b></td>
+ <td align="center" valign="Middle" width="10%"><b class=rtableheader>Edit Access</b></td>
+ <td align="center" valign="Middle" width="14%"><b class=rtableheader>Remove</b></td>
+ </tr>
+<% int iCount = 0;
+ Vector reportUsers = rdef.getReportUsers(request);
+ for(Iterator iter=reportUsers.iterator(); iter.hasNext(); iCount++) {
+ SecurityEntry rUser = (SecurityEntry) iter.next(); %>
+ <tr class="<%=((iCount % 2 == 0)?"rowalt1":"rowalt2")%>">
+ <td align="center" height="30"><font class=rtabletext><%= iCount+1 %></font></td>
+ <td><font class=rtabletext><%= rUser.getName() %></font></td>
+ <td align="center" valign="Middle"><img src="<%= AppUtils.getImgFolderURL() %>active.gif" width="16" height="16" border="0"></td>
+ <td align="center" valign="Middle"><input type="image" src="<%= AppUtils.getImgFolderURL() %><%= rUser.isReadOnly()?"inactive.gif":"active.gif" %>" alt="<%= rUser.isReadOnly()?"Grant":"Revoke" %> edit access" width="16" height="16" border="0" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= rUser.isReadOnly()?AppConstants.WA_GRANT_USER:AppConstants.WA_REVOKE_USER %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= rUser.getId() %>';"></td>
+ <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! confirm('Are you sure you want to remove user <%= rUser.getName() %>?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_USER %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= rUser.getId() %>'; }"></td>
+ </tr>
+<% } // for
+// if(iCount==0) { %>
+ <!--tr class=rbg2>
+ <td colspan=5 align="center" height="30"><font class=rtabletext>No user access defined</font></td>
+ </tr-->
+<% //}
+ Vector remainingUsers = Utils.getUsersNotInList(reportUsers,request);
+ if(remainingUsers.size()>0) { %>
+ <tr>
+ <td class=rbg1 colspan=5 valign="Middle" nowrap><b class=rtableheader>Grant Access To&nbsp;
+ <select name="newUserId" onChange="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_USER %>'; document.forma.submit();">
+ <option value="" selected>--- Select User ---
+<% for(int i=0; i<remainingUsers.size(); i++) {
+ IdNameValue user = (IdNameValue) remainingUsers.get(i); %>
+ <option value="<%= user.getId() %>"><%= user.getName() %>
+<% } // for
+%>
+ </select></b>
+ </td>
+<% } // if
+%>
+ </tr>
+</table>
+<br>
+
+<table class="mTAB" width="100%" border="0" cellspacing="1" cellpadding="3" align=center>
+ <tr>
+ <td class=rbg1 colspan=5 valign="Middle"><b class=rtableheader>Report Roles</b></td>
+ </tr>
+ <tr class=rbg1>
+ <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>&nbsp;&nbsp;No&nbsp;&nbsp;</b></td>
+ <td align="center" valign="Middle" width="59%"><b class=rtableheader>Role Name</b></td>
+ <td align="center" valign="Middle" width="10%"><b class=rtableheader>Run Access</b></td>
+ <td align="center" valign="Middle" width="10%"><b class=rtableheader>Edit Access</b></td>
+ <td align="center" valign="Middle" width="14%"><b class=rtableheader>Remove</b></td>
+ </tr>
+<% iCount = 0;
+ Vector reportRoles = rdef.getReportRoles(request);
+ for(Iterator iter=reportRoles.iterator(); iter.hasNext(); iCount++) {
+ SecurityEntry rRole = (SecurityEntry) iter.next(); %>
+ <tr class="<%=((iCount % 2 == 0)?"rowalt1":"rowalt2")%>">
+ <td align="center" height="30"><font class=rtabletext><%= iCount+1 %></font></td>
+ <td><font class=rtabletext><%= rRole.getName() %></font></td>
+ <td align="center" valign="Middle"><img src="<%= AppUtils.getImgFolderURL() %>active.gif" width="16" height="16" border="0"></td>
+ <td align="center" valign="Middle"><input type="image" src="<%= AppUtils.getImgFolderURL() %><%= rRole.isReadOnly()?"inactive.gif":"active.gif" %>" alt="<%= rRole.isReadOnly()?"Grant":"Revoke" %> edit access" width="16" height="16" border="0" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= rRole.isReadOnly()?AppConstants.WA_GRANT_ROLE:AppConstants.WA_REVOKE_ROLE %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= rRole.getId() %>';"></td>
+ <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! confirm('Are you sure you want to remove role <%= rRole.getName() %>?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_ROLE %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= rRole.getId() %>'; }"></td>
+ </tr>
+<% } // for
+// if(iCount==0) { %>
+ <!--tr class=rbg2>
+ <td colspan=5 align="center" height="30"><font class=rtabletext>No role access defined</font></td>
+ </tr-->
+<% //}
+ Vector remainingRoles = Utils.getRolesNotInList(reportRoles,request);
+ if(remainingRoles.size()>0) { %>
+ <tr>
+ <td class=rbg1 colspan=5 valign="Middle" nowrap><b class=rtableheader>Grant Access To&nbsp;
+ <select name="newRoleId" onChange="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_ROLE %>'; document.forma.submit();">
+ <option value="" selected>--- Select Role ---
+<% for(int i=0; i<remainingRoles.size(); i++) {
+ IdNameValue role = (IdNameValue) remainingRoles.get(i); %>
+ <option value="<%= role.getId() %>"><%= role.getName() %>
+<% } // for
+%>
+ </select></b>
+ </td>
+<% } // if
+%>
+ </tr>
+</table>
+<br>
+
+<script language="JavaScript">
+<!--
+function dataValidate() {
+ return true;
+} // dataValidate
+//-->
+</script>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/error.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/error.jsp
new file mode 100644
index 00000000..2a48507c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/error.jsp
@@ -0,0 +1,20 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+${errMsg}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/leafletMap.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/leafletMap.jsp
new file mode 100644
index 00000000..77981f73
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/leafletMap.jsp
@@ -0,0 +1,288 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<!DOCTYPE html>
+
+<html>
+<head>
+
+ <meta charset="UTF-8">
+
+ <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
+ <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
+
+ <style>
+ #map {
+ height: 450px;
+ width: 800px;
+ }
+ .animateOff {
+ color: red;
+ }
+ .animateOn {
+ color: green;
+ }
+ </style>
+
+ <script>
+
+ var siteData = [
+ {"id": "cb1ma", "name": "Cambridge, MA", "title": "100G", "lat": 42.3736, "lon": -71.11},
+ {"id": "st6wa", "name": "Seattle, WA", "title": "40G", "lat": 47.6097, "lon": -122.33},
+ {"id": "cgcil", "name": "Chicago, IL", "title": "310G", "lat": 41.8819, "lon": -87.627},
+ {"id": "n54ny", "name": "New York, NY", "title": "160G", "lat": 40.7127, "lon": -74.005},
+ {"id": "cl2oh", "name": "Columbus, OH", "title": "300G", "lat": 39.9833, "lon": -82.983},
+ {"id": "phlpa", "name": "Philadelphia, PA", "title": "210G", "lat": 39.95, "lon": -75.166},
+ {"id": "ptdor", "name": "Portland, OR", "title": "90G", "lat": 45.52, "lon": -122.68},
+ {"id": "dvmco", "name": "Denver, CO", "title": "170G", "lat": 39.7391, "lon": -104.98},
+ {"id": "kc9mo", "name": "Kansas City, MO", "title": "100G", "lat": 39.0997, "lon": -94.578},
+ {"id": "sffca", "name": "San Fransisco, CA", "title": "130G", "lat": 37.7833, "lon": -122.41},
+ {"id": "sl9mo", "name": "St Louis, MO", "title": "330G", "lat": 38.6272, "lon": -90.197},
+ {"id": "wswdc", "name": "Washington, DC", "title": "210G", "lat": 38.8951, "lon": -77.036},
+ {"id": "sc1ca", "name": "Sacramento, CA", "title": "250G", "lat": 38.5555, "lon": -121.46},
+ {"id": "slkut", "name": "Salt Lake City, UT", "title": "250G", "lat": 40.75, "lon": -111.88},
+ {"id": "rlgnc", "name": "Raleigh, NC", "title": "180G", "lat": 35.8188, "lon": -78.644},
+ {"id": "nsvtn", "name": "Nashville, TN", "title": "210G", "lat": 36.1666, "lon": -86.783},
+ {"id": "la2ca", "name": "Los Angeles, CA", "title": "180G", "lat": 34.05, "lon": -118.25},
+ {"id": "dlstx", "name": "Dallas, TX", "title": "330G", "lat": 32.7758, "lon": -96.796},
+ {"id": "attga", "name": "Atlanta, GA", "title": "280G", "lat": 33.755, "lon": -84.39},
+ {"id": "nwrla", "name": "New Orleans, LA", "title": "180G", "lat": 29.9647, "lon": -90.07},
+ {"id": "sd2ca", "name": "San Diego, CA", "title": "150G", "lat": 32.715, "lon": -117.16},
+ {"id": "phmaz", "name": "Phoenix, AZ", "title": "210G", "lat": 33.45, "lon": -112.06},
+ {"id": "santx", "name": "San Antonio, TX", "title": "220G", "lat": 29.4166, "lon": -98.5},
+ {"id": "hs1tx", "name": "Houston, TX", "title": "290G", "lat": 29.7627, "lon": -95.383},
+ {"id": "ormfl", "name": "Orlando, FL", "title": "130G", "lat": 28.4158, "lon": -81.298},
+ ];
+
+ var pipeData = [
+ {"id_a": "st6wa", "id_z": "ptdor", "name": "Seattle, WA to Portland, OR", "title": "60G", "lat_a": 47.6097, "lon_a": -122.33, "lat_z": 45.52, "lon_z": -122.68},
+ {"id_a": "sc1ca", "id_z": "slkut", "name": "Sacramento, CA to Salt Lake City, UT", "title": "200G", "lat_a": 38.5555, "lon_a": -121.46, "lat_z": 40.75, "lon_z": -111.88},
+ {"id_a": "hs1tx", "id_z": "ormfl", "name": "Houston, TX to Orlando, FL", "title": "130G", "lat_a": 29.7627, "lon_a": -95.383, "lat_z": 28.4158, "lon_z": -81.298},
+ {"id_a": "nwrla", "id_z": "ormfl", "name": "New Orleans, LA to Orlando, FL", "title": "90G", "lat_a": 29.9647, "lon_a": -90.07, "lat_z": 28.4158, "lon_z": -81.298},
+ {"id_a": "n54ny", "id_z": "phlpa", "name": "New York, NY to Philadelphia, PA", "title": "240G", "lat_a": 40.7127, "lon_a": -74.005, "lat_z": 39.95, "lon_z": -75.166},
+ {"id_a": "n54ny", "id_z": "wswdc", "name": "New York, NY to Washington, DC", "title": "380G", "lat_a": 40.7127, "lon_a": -74.005, "lat_z": 38.8951, "lon_z": -77.036},
+ {"id_a": "rlgnc", "id_z": "attga", "name": "Raleigh, NC to Atlanta, GA", "title": "160G", "lat_a": 35.8188, "lon_a": -78.644, "lat_z": 33.755, "lon_z": -84.39},
+// {"id_a": "st6wa", "id_z": "sffca", "name": "Seattle, WA to San Fransisco, CA", "title": "40G", "lat_a": 47.6097, "lon_a": -122.33, "lat_z": 37.7833, "lon_z": -122.41},
+ {"id_a": "la2ca", "id_z": "sd2ca", "name": "Los Angeles, CA to San Diego, CA", "title": "160G", "lat_a": 34.05, "lon_a": -118.25, "lat_z": 32.715, "lon_z": -117.16},
+ {"id_a": "sd2ca", "id_z": "phmaz", "name": "San Diego, CA to Phoenix, AZ", "title": "200G", "lat_a": 32.715, "lon_a": -117.16, "lat_z": 33.45, "lon_z": -112.06},
+ {"id_a": "ptdor", "id_z": "sffca", "name": "Portland, OR to San Fransisco, CA", "title": "70G", "lat_a": 45.52, "lon_a": -122.68, "lat_z": 37.7833, "lon_z": -122.41},
+ {"id_a": "sffca", "id_z": "sc1ca", "name": "San Fransisco, CA to Sacramento, CA", "title": "80G", "lat_a": 37.7833, "lon_a": -122.41, "lat_z": 38.5555, "lon_z": -121.46},
+ {"id_a": "la2ca", "id_z": "slkut", "name": "Los Angeles, CA to Salt Lake City, UT", "title": "200G", "lat_a": 34.05, "lon_a": -118.25, "lat_z": 40.75, "lon_z": -111.88},
+ {"id_a": "cgcil", "id_z": "cl2oh", "name": "Chicago, IL to Columbus, OH", "title": "200G", "lat_a": 41.8819, "lon_a": -87.627, "lat_z": 39.9833, "lon_z": -82.983},
+ {"id_a": "cl2oh", "id_z": "phlpa", "name": "Columbus, OH to Philadelphia, PA", "title": "240G", "lat_a": 39.9833, "lon_a": -82.983, "lat_z": 39.95, "lon_z": -75.166},
+ {"id_a": "phlpa", "id_z": "wswdc", "name": "Philadelphia, PA to Washington, DC", "title": "240G", "lat_a": 39.95, "lon_a": -75.166, "lat_z": 38.8951, "lon_z": -77.036},
+ {"id_a": "sffca", "id_z": "la2ca", "name": "San Fransisco, CA to Los Angeles, CA", "title": "280G", "lat_a": 37.7833, "lon_a": -122.41, "lat_z": 34.05, "lon_z": -118.25},
+ {"id_a": "dvmco", "id_z": "cgcil", "name": "Denver, CO to Chicago, IL", "title": "200G", "lat_a": 39.7391, "lon_a": -104.98, "lat_z": 41.8819, "lon_z": -87.627},
+ {"id_a": "dlstx", "id_z": "hs1tx", "name": "Dallas, TX to Houston, TX", "title": "360G", "lat_a": 32.7758, "lon_a": -96.796, "lat_z": 29.7627, "lon_z": -95.383},
+ {"id_a": "nsvtn", "id_z": "cl2oh", "name": "Nashville, TN to Columbus, OH", "title": "200G", "lat_a": 36.1666, "lon_a": -86.783, "lat_z": 39.9833, "lon_z": -82.983},
+ {"id_a": "cb1ma", "id_z": "phlpa", "name": "Cambridge, MA to Philadelphia, PA", "title": "110G", "lat_a": 42.3736, "lon_a": -71.11, "lat_z": 39.95, "lon_z": -75.166},
+// {"id_a": "sffca", "id_z": "cgcil", "name": "San Fransisco, CA to Chicago, IL", "title": "170G", "lat_a": 37.7833, "lon_a": -122.41, "lat_z": 41.8819, "lon_z": -87.627},
+ {"id_a": "sffca", "id_z": "dvmco", "name": "San Fransisco, CA to Denver, CO", "title": "90G", "lat_a": 37.7833, "lon_a": -122.41, "lat_z": 39.7391, "lon_z": -104.98},
+ {"id_a": "sffca", "id_z": "sl9mo", "name": "San Fransisco, CA to St Louis, MO", "title": "80G", "lat_a": 37.7833, "lon_a": -122.41, "lat_z": 38.6272, "lon_z": -90.197},
+ {"id_a": "santx", "id_z": "dlstx", "name": "San Antonio, TX to Dallas, TX", "title": "180G", "lat_a": 29.4166, "lon_a": -98.5, "lat_z": 32.7758, "lon_z": -96.796},
+ {"id_a": "santx", "id_z": "hs1tx", "name": "San Antonio, TX to Houston, TX", "title": "240G", "lat_a": 29.4166, "lon_a": -98.5, "lat_z": 29.7627, "lon_z": -95.383},
+ {"id_a": "sl9mo", "id_z": "wswdc", "name": "St Louis, MO to Washington, DC", "title": "280G", "lat_a": 38.6272, "lon_a": -90.197, "lat_z": 38.8951, "lon_z": -77.036},
+ {"id_a": "nwrla", "id_z": "attga", "name": "New Orleans, LA to Atlanta, GA", "title": "200G", "lat_a": 29.9647, "lon_a": -90.07, "lat_z": 33.755, "lon_z": -84.39},
+ {"id_a": "la2ca", "id_z": "dlstx", "name": "Los Angeles, CA to Dallas, TX", "title": "280G", "lat_a": 34.05, "lon_a": -118.25, "lat_z": 32.7758, "lon_z": -96.796},
+ {"id_a": "slkut", "id_z": "dvmco", "name": "Salt Lake City, UT to Denver, CO", "title": "200G", "lat_a": 40.75, "lon_a": -111.88, "lat_z": 39.7391, "lon_z": -104.98},
+ {"id_a": "dvmco", "id_z": "dlstx", "name": "Denver, CO to Dallas, TX", "title": "200G", "lat_a": 39.7391, "lon_a": -104.98, "lat_z": 32.7758, "lon_z": -96.796},
+ {"id_a": "kc9mo", "id_z": "sl9mo", "name": "Kansas City, MO to St Louis, MO", "title": "280G", "lat_a": 39.0997, "lon_a": -94.578, "lat_z": 38.6272, "lon_z": -90.197},
+ {"id_a": "kc9mo", "id_z": "dlstx", "name": "Kansas City, MO to Dallas, TX", "title": "280G", "lat_a": 39.0997, "lon_a": -94.578, "lat_z": 32.7758, "lon_z": -96.796},
+ {"id_a": "cgcil", "id_z": "wswdc", "name": "Chicago, IL to Washington, DC", "title": "200G", "lat_a": 41.8819, "lon_a": -87.627, "lat_z": 38.8951, "lon_z": -77.036},
+ {"id_a": "cgcil", "id_z": "sl9mo", "name": "Chicago, IL to St Louis, MO", "title": "370G", "lat_a": 41.8819, "lon_a": -87.627, "lat_z": 38.6272, "lon_z": -90.197},
+ {"id_a": "n54ny", "id_z": "cb1ma", "name": "New York, NY to Cambridge, MA", "title": "80G", "lat_a": 40.7127, "lon_a": -74.005, "lat_z": 42.3736, "lon_z": -71.11},
+ {"id_a": "st6wa", "id_z": "dvmco", "name": "Seattle, WA to Denver, CO", "title": "40G", "lat_a": 47.6097, "lon_a": -122.33, "lat_z": 39.7391, "lon_z": -104.98},
+ {"id_a": "la2ca", "id_z": "phmaz", "name": "Los Angeles, CA to Phoenix, AZ", "title": "260G", "lat_a": 34.05, "lon_a": -118.25, "lat_z": 33.45, "lon_z": -112.06},
+ {"id_a": "phmaz", "id_z": "santx", "name": "Phoenix, AZ to San Antonio, TX", "title": "160G", "lat_a": 33.45, "lon_a": -112.06, "lat_z": 29.4166, "lon_z": -98.5},
+ {"id_a": "sl9mo", "id_z": "dlstx", "name": "St Louis, MO to Dallas, TX", "title": "200G", "lat_a": 38.6272, "lon_a": -90.197, "lat_z": 32.7758, "lon_z": -96.796},
+ {"id_a": "dlstx", "id_z": "nsvtn", "name": "Dallas, TX to Nashville, TN", "title": "160G", "lat_a": 32.7758, "lon_a": -96.796, "lat_z": 36.1666, "lon_z": -86.783},
+ {"id_a": "wswdc", "id_z": "attga", "name": "Washington, DC to Atlanta, GA", "title": "380G", "lat_a": 38.8951, "lon_a": -77.036, "lat_z": 33.755, "lon_z": -84.39},
+ {"id_a": "st6wa", "id_z": "cgcil", "name": "Seattle, WA to Chicago, IL", "title": "70G", "lat_a": 47.6097, "lon_a": -122.33, "lat_z": 41.8819, "lon_z": -87.627},
+ {"id_a": "dvmco", "id_z": "kc9mo", "name": "Denver, CO to Kansas City, MO", "title": "100G", "lat_a": 39.7391, "lon_a": -104.98, "lat_z": 39.0997, "lon_z": -94.578},
+ {"id_a": "phmaz", "id_z": "dlstx", "name": "Phoenix, AZ to Dallas, TX", "title": "210G", "lat_a": 33.45, "lon_a": -112.06, "lat_z": 32.7758, "lon_z": -96.796},
+ {"id_a": "cgcil", "id_z": "n54ny", "name": "Chicago, IL to New York, NY", "title": "280G", "lat_a": 41.8819, "lon_a": -87.627, "lat_z": 40.7127, "lon_z": -74.005},
+ {"id_a": "sl9mo", "id_z": "nsvtn", "name": "St Louis, MO to Nashville, TN", "title": "170G", "lat_a": 38.6272, "lon_a": -90.197, "lat_z": 36.1666, "lon_z": -86.783},
+ {"id_a": "dlstx", "id_z": "attga", "name": "Dallas, TX to Atlanta, GA", "title": "240G", "lat_a": 32.7758, "lon_a": -96.796, "lat_z": 33.755, "lon_z": -84.39},
+ {"id_a": "hs1tx", "id_z": "nwrla", "name": "Houston, TX to New Orleans, LA", "title": "170G", "lat_a": 29.7627, "lon_a": -95.383, "lat_z": 29.9647, "lon_z": -90.07},
+ {"id_a": "ormfl", "id_z": "attga", "name": "Orlando, FL to Atlanta, GA", "title": "210G", "lat_a": 28.4158, "lon_a": -81.298, "lat_z": 33.755, "lon_z": -84.39},
+ {"id_a": "nsvtn", "id_z": "attga", "name": "Nashville, TN to Atlanta, GA", "title": "240G", "lat_a": 36.1666, "lon_a": -86.783, "lat_z": 33.755, "lon_z": -84.39},
+ {"id_a": "wswdc", "id_z": "rlgnc", "name": "Washington, DC to Raleigh, NC", "title": "200G", "lat_a": 38.8951, "lon_a": -77.036, "lat_z": 35.8188, "lon_z": -78.644}
+ ];
+ </script>
+
+
+</head>
+<body>
+ <div id="map"></div>
+ <button id="forwardButton" onclick="stepForward();">Step Forward</button>
+ <button id="playPause" onclick="playPause();">Play</button>
+ <div>
+ <table att-table table-data="tableData" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header key="id">Site</th>
+ <th att-table-header key="lastName">Usage</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" id="topTenSites">
+ </tbody>
+ </table>
+ <table att-table table-data="tableData" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header key="id">Link</th>
+ <th att-table-header key="lastName">Usage</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" id="topTenLinks">
+ </tbody>
+ </table>
+ </div>
+
+ <script>
+ var map = L.map('map').setView([40, -96], 4);
+ L.tileLayer('', {maxZoom:18}).addTo(map); //TODO configure
+
+ var dataLayer = addDataLayers(map, null);
+
+ function addDataLayers(map, dataLayer) {
+ if (dataLayer!=null) {
+ map.removeLayer(dataLayer);
+ }
+
+ dataLayer = L.layerGroup();
+
+ var siteInfo = [];
+
+ var pipeLayer = L.layerGroup();
+ for (var i=0; i<pipeData.length; i++) {
+ var pipe = pipeData[i];
+
+ var usage = pipe.usage;
+ if (!usage || Math.random()<0.05) {
+ //console.log("Rerolling " + pipe.name);
+ usage = Math.floor(Math.random()*33 + Math.random()*33 + Math.random()*34);
+ } else {
+ //console.log("Adjusting " + pipe.name);
+ usage = Math.floor(usage + Math.random()*15 - Math.random()*15);
+ }
+ if (usage<0) usage = 0;
+ while (usage>100) usage -= Math.floor(20*Math.random());
+ if (usage>90) usage -= Math.floor(20*Math.random());
+
+ pipe.usage = usage;
+
+ var color = "black";
+ if (usage>60) color = "yellow";
+ if (usage>70) color = "orange";
+ if (usage>80) color = "red";
+ pipeLayer.addLayer(L.polyline([[pipe.lat_a, pipe.lon_a], [pipe.lat_z, pipe.lon_z]], {"color": color, "title": pipe.name}).bindPopup(pipe.name + "<br/>" + pipe.title + "<br/>" + usage + "% usage"));
+
+ var siteA = siteInfo[pipe.id_a];
+ if (siteA) {
+ siteA.usage += usage;
+ siteA.maxUsage += 100;
+ //console.log("Site a id = " + pipe.id_a + ", object existed = " + siteA + ", usage = " + siteA.usage + ", max = " + siteA.maxUsage);
+ } else {
+ siteA = {};
+ siteA.usage = usage;
+ siteA.maxUsage = 100;
+ siteInfo[pipe.id_a] = siteA;
+ //console.log("Site a id = " + pipe.id_a + ", object is new = " + siteA + ", usage = " + siteA.usage + ", max = " + siteA.maxUsage);
+ }
+
+ var siteZ = siteInfo[pipe.id_z];
+ if (siteZ) {
+ siteZ.usage += usage;
+ siteZ.maxUsage += 100;
+ //console.log("Site z id = " + pipe.id_z + ", object existed = " + siteZ + ", usage = " + siteZ.usage + ", max = " + siteZ.maxUsage);
+ } else {
+ siteZ = {};
+ siteZ.usage = usage;
+ siteZ.maxUsage = 100;
+ siteInfo[pipe.id_z] = siteZ;
+ //console.log("Site z id = " + pipe.id_z + ", object is new = " + siteZ + ", usage = " + siteZ.usage + ", max = " + siteZ.maxUsage);
+ }
+ }
+ dataLayer.addLayer(pipeLayer);
+
+ var dataCenterLayer = L.layerGroup();
+ for (var i=0; i<siteData.length; i++) {
+ var site = siteData[i];
+// {"id": "slkut", "name": "Salt Lake City, UT", "title": "250G", "lat": 40.75, "lon": -111.88},
+ var info = siteInfo[site.id];
+ var color = "black";
+ if (info.usage/info.maxUsage>.6) color = "yellow";
+ if (info.usage/info.maxUsage>.7) color = "orange";
+ if (info.usage/info.maxUsage>.8) color = "red";
+ var pct = Math.floor(100*info.usage/info.maxUsage);
+ site.usage = pct;
+// dataCenterLayer.addLayer(L.marker([site.lat, site.lon], {"title": site.name}).bindPopup(site.name + "<br/>" + pipe.title + "<br/>" + info.usage + "/" + info.maxUsage));
+ dataCenterLayer.addLayer(L.circleMarker([site.lat, site.lon], {"color": color, "title": site.name, "fillOpacity": .5}).bindPopup(site.name + "<br/>" + pipe.title + "<br/>" + pct + "%"));
+ }
+ dataLayer.addLayer(dataCenterLayer);
+
+ dataLayer.addTo(map);
+
+ siteData.sort(function(a,b){return b.usage-a.usage});
+ var topTenHtml = "";
+ for (var i=0; i<10; i++) {
+ topTenHtml = topTenHtml + "<tr><td att-table-body>" + siteData[i].name + "</td><td att-table-body>" + siteData[i].usage + "%</td></tr>";
+ }
+ document.getElementById("topTenSites").innerHTML = topTenHtml;
+
+ pipeData.sort(function(a,b){return b.usage-a.usage});
+ topTenHtml = "";
+ for (var i=0; i<10; i++) {
+ topTenHtml = topTenHtml + "<tr><td att-table-body>" + pipeData[i].name + "</td><td att-table-body>" + pipeData[i].usage + "%</td></tr>";
+ }
+ document.getElementById("topTenLinks").innerHTML = topTenHtml;
+
+ return dataLayer;
+ }
+
+ function stepForward() {
+ dataLayer = addDataLayers(map, dataLayer);
+ }
+
+ var intervalObj = null;
+ function playPause() {
+ if (intervalObj==null) {
+ document.getElementById('playPause').innerHTML = "Pause";
+ document.getElementById('forwardButton').disabled = true;
+ intervalObj = window.setInterval(function(){dataLayer = addDataLayers(map, dataLayer);},1500);
+ } else {
+ document.getElementById('playPause').innerHTML = "Play";
+ document.getElementById('forwardButton').disabled = false;
+ clearInterval(intervalObj);
+ intervalObj = null;
+ }
+ }
+
+ function onMapClick(e) {
+ //alert("You clicked the map at " + e.latlng);
+ dataLayer = addDataLayers(map, dataLayer);
+ }
+
+ map.on('click', onMapClick);
+ </script>
+
+</body>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/login_external.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/login_external.jsp
new file mode 100644
index 00000000..b4e3c093
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/login_external.jsp
@@ -0,0 +1,154 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ page import="org.openecomp.portalsdk.core.util.SystemProperties" %>
+<c:set var="title" value="Login" />
+<c:set var="isMobileEnabled"
+ value="<%=(SystemProperties.getProperty(SystemProperties.MOBILE_ENABLE)!= null && SystemProperties.getProperty(SystemProperties.MOBILE_ENABLE).trim().equals(\"true\"))%>" />
+
+<!DOCTYPE html>
+<html ng-app="abs">
+ <head>
+
+ <title>
+ Login
+ </title>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/fn-ebz.css" >
+ <link rel="stylesheet" type="text/css" href="static/fusion/css/jquery-ui.css">
+ <script src="static/js/jquery-1.10.2.js" type="text/javascript"></script>
+ <script src= "app/fusion/external/ebz/angular_js/angular.js"></script>
+ <script src="app/fusion/external/ebz/angular_js/angular-route.min.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/angular-sanitize.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/angular-cookies.js"></script>
+ <script src= "app/fusion/external/ebz/sandbox/att-abs-tpls.js" type="text/javascript"></script>
+ <script src="static/fusion/js/att_angular_gridster/ui-gridster-tpls.js"></script>
+ <script src="static/fusion/js/att_angular_gridster/angular-gridster.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/checklist-model.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/app.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/gestures.js"></script>
+ <script src="static/js/modalService.js"></script>
+ <script src="app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js"></script>
+
+ <style>
+ .terms {
+ font-family: Verdana,Arial,Helvetica, sans-serif;
+ font-size: 9px;
+ }
+
+ </style>
+ </head>
+ <body style="padding-top: 15px;">
+ <div ng-controller="externalLoginController">
+ <div class="centered style="-webkit-transform: translateZ(0);background:white, z-index:0;">
+ <div align="center" id="errorInfo" style="display:none;float:left;font-size:12px;margin-left:5px"><span style="color:red">Invaild username or password, Please try again</span></div>
+ <br/>
+ <div align="center" style="margin-left:auto;margin-right:auto;width:40%;padding:6px;opacity:0.7;background-color:white">
+ <img src="static/fusion/images/ecomp_trans.png"/>
+ <h2> ECOMP Portal </h2>
+ <label>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label class="form-field__label">Login ID:</label>
+ </label>
+ <input type="text" class="fn-ebz-text" ng-model="loginId" style="width: 140px;height:25px;border-radius:7px;font-size:18px;padding-left:5px;"
+ maxlength="30" />
+ <br/>
+ <br/>
+ <label >&nbsp;Password:</label>
+ <input type="password" class="span3" ng-model="password" style="width: 140px;height:25px;border-radius:7px;font-size:18px;padding-left:5px;"
+ maxlength="30" onkeydown="if (event.keyCode == 13) document.getElementById('loginBtn').click()"/>
+ <br />
+ <br />
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <input id="loginBtn" type="image" ng-click="loginExternal();" src="static/fusion/images/login_button.gif" alt="Login" />
+ <br>
+ </div>
+ </div>
+ <br/><br/><br/><br/><br/><br/><br/>
+ <div id="footer">
+ </div>
+ </div>
+ </body>
+<script>
+app.controller("externalLoginController", function ($scope) {
+ // Table Data
+
+ $scope.viewPerPage = 200;
+ $scope.currentPage = 2;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+ $scope.loginId="";
+ $scope.password="";
+ $scope.loginError=true;
+ $scope.viewPerPage = 200;
+ $scope.currentPage = 2;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+ $scope.loginId="";
+ $scope.password="";
+
+
+ $scope.loginExternal = function() {
+
+ $.ajax({
+ url: "login_external/login?"+"loginId="+$scope.loginId+"&password="+$scope.password,
+ type : "POST",
+ success:function (response){
+ if(response=="success"){
+ window.location.href = 'welcome.htm';
+ }else{
+ $("#errorInfo").show();
+ }
+ },
+ error:function( jqXHR, status,error ){
+ $("#errorInfo").show();
+ }
+
+ });
+
+ };
+
+
+ /**
+ $scope.loginExternal = function() {
+
+
+ var redirectUrl = "login_external/login";
+ var form = $('<form action="' + redirectUrl + '" method="post">' +
+ '<input type="hidden" name="loginId" value='+$scope.loginId+' />' +
+ '<input type="hidden" name="password" value='+$scope.password+' />' +
+ '</form>');
+
+ $('body').append(form);
+ $(form).submit();
+
+
+ };
+ */
+
+});
+</script>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/net_map.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/net_map.jsp
new file mode 100644
index 00000000..2a341467
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/net_map.jsp
@@ -0,0 +1,38 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<!DOCTYPE html>
+<html>
+<head>
+ <link rel="import" href="app/fusion/elementmap/element-map-import.html">
+</head>
+
+<body>
+
+
+<div data-ng-app="elementMapModule">
+ <element-map contentfilename='NetworkMap_topology_composition' layoutfilename='network_map_layout' callflowfilename='call_flow_sip_digest' callflowstep='Step_1'></element-map>
+</div>
+
+<input type="hidden" name="inner_width" value="1500px">
+<input type="hidden" name="inner_height" value="800px">
+
+</body>
+
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/user_profile.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/user_profile.jsp
new file mode 100644
index 00000000..cb5c4e3b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/user_profile.jsp
@@ -0,0 +1,84 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
+<div ng-controller="userProfileSampleController">
+ <div>
+ <h1 class="heading1" style="margin-top:20px;">Profile Search</h1>
+ <div style="margin-top:30px">
+ <table att-table table-data="tableData" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header key="id">User ID</th>
+ <th att-table-header key="last_name">Last Name</th>
+ <th att-table-header key="first_name">First Name</th>
+ <th att-table-header key="email">Email</th>
+ <th att-table-header key="org_user_id">OrgUserId</th>
+ <th att-table-header key="org_manager_userid">Manager OrgUserId</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="rowData in tableData">
+ <tr>
+ <td att-table-body >{{rowData.id}}</td>
+ <td att-table-body >{{rowData.last_name}}</td>
+ <td att-table-body >{{rowData.first_name}}</td>
+ <td att-table-body >{{rowData.email}}</td>
+ <td att-table-body >{{rowData.orgUserId}}</td>
+ <td att-table-body >{{rowData.org_manager_userid}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <div class="fn-ebz-container">
+ Rows Per Page:
+ <input class="fn-ebz-text" type="text" ng-model="viewPerPage" size="5" style="width: 47px;">
+ </div>
+ <div class="fn-ebz-container">
+ Current Page:
+ <input class="fn-ebz-text" type="text" ng-model="currentPage" size="5" style="width: 47px;">
+ </div>
+ <div class="fn-ebz-container">
+ Total Page(s):
+ <input class="fn-ebz-text" type="text" ng-model="totalPage" size="5" readonly="true" style="width: 47px;">
+ </div>
+</div>
+
+<script>
+app.controller("userProfileSampleController", function ($scope,$http,modalService, $modal) {
+ // Table Data
+ $scope.tableData=${model.customerInfo};
+ console.log($scope.tableData);
+ $scope.viewPerPage = 20;
+ $scope.scrollViewsPerPage = 2;
+ $scope.currentPage = 1;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+ // modalService.showSuccess('','Modal Sample') ;
+ for(x in $scope.tableData){
+ if($scope.tableData[x].active_yn=='Y')
+ $scope.tableData[x].active_yn=true;
+ else
+ $scope.tableData[x].active_yn=false;
+ }
+
+});
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/welcome.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/welcome.jsp
new file mode 100644
index 00000000..a6096215
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/welcome.jsp
@@ -0,0 +1,630 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+
+<link rel="stylesheet" type="text/css" href="static/fusion/sample/css/scribble.css" />
+
+<link rel="stylesheet" type="text/css" href="static/fusion/sample/css/welcome.css" />
+
+<script src="static/js/jquery-1.10.2.js"></script>
+<script src="app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js"></script>
+
+<!-- <script src="static/fusion/js/jquery.resize.js"></script> -->
+<link rel="stylesheet" href="static/fusion/css/att_angular_gridster/ui-gridster.css"/>
+<link rel="stylesheet" href="static/fusion/css/att_angular_gridster/sandbox-gridster.css"/>
+<script src="static/fusion/js/att_angular_gridster/ui-gridster-tpls.js"></script>
+<script src="static/fusion/js/att_angular_gridster/angular-gridster.js"></script>
+<script src="app/fusion/external/ebz/sandbox/att-abs-tpls.js" type="text/javascript"></script>
+
+<!--for line Chart and Area Chart-->
+<script src="static/fusion/d3/js/d3.v3.min.js"></script>
+<script src="static/fusion/d3/js/nv.d3.min.js"></script>
+<script src="static/fusion/d3/js/models/axis.min.js"></script>
+
+<!-- Style for line Chart and area chart -->
+<link rel="stylesheet" type="text/css" href="static/fusion/d3/css/nv.d3.css">
+
+
+<script type="text/javascript" src="static/fusion/sample/js/FusionCharts.js"></script> <!-- Charts -->
+<script type="text/javascript" src="static/fusion/sample/js/charts.js"></script> <!-- Charts -->
+<script type="text/javascript" src="static/fusion/sample/js/scribble.js"></script> <!-- Scribble -->
+
+<!-- Data for Line and Area Charts -->
+<script>
+historicalBarChart=[{"type":"line","key":"AP_CPU","yAxis":"1","values":[{"x":1388552400000,"y":2.13},{"x":1388552400000,"y":5.0},{"x":1388552400000,"y":2.36},{"x":1388552400000,"y":10.0},{"x":1391230800000,"y":3.15},{"x":1391230800000,"y":2.88},{"x":1391230800000,"y":3.0},{"x":1391230800000,"y":4.0},{"x":1393650000000,"y":8.0},{"x":1393650000000,"y":3.93},{"x":1393650000000,"y":4.27},{"x":1393650000000,"y":4.0},{"x":1396324800000,"y":4.25},{"x":1396324800000,"y":5.35},{"x":1396324800000,"y":5.92},{"x":1396324800000,"y":12.0},{"x":1398916800000,"y":5.55},{"x":1398916800000,"y":4.89},{"x":1398916800000,"y":5.01},{"x":1398916800000,"y":3.27},{"x":1401595200000,"y":6.27},{"x":1401595200000,"y":9.17},{"x":1401595200000,"y":9.31},{"x":1401595200000,"y":6.07},{"x":1404187200000,"y":8.37},{"x":1404187200000,"y":8.11},{"x":1404187200000,"y":8.84},{"x":1404187200000,"y":8.93},{"x":1406865600000,"y":11.79},{"x":1406865600000,"y":12.22},{"x":1406865600000,"y":12.6},{"x":1406865600000,"y":11.61},{"x":1409544000000,"y":15.27},{"x":1409544000000,"y":19.09},{"x":1409544000000,"y":16.09},{"x":1409544000000,"y":18.66},{"x":1412136000000,"y":18.4},{"x":1412136000000,"y":22.05},{"x":1412136000000,"y":21.66},{"x":1412136000000,"y":19.04},{"x":1414814400000,"y":19.13},{"x":1414814400000,"y":19.61},{"x":1414814400000,"y":17.61},{"x":1414814400000,"y":17.5},{"x":1417410000000,"y":19.0},{"x":1417410000000,"y":15.73},{"x":1420088400000,"y":9.67},{"x":1420088400000,"y":15.19},{"x":1420088400000,"y":15.02},{"x":1420088400000,"y":9.62333333333333},{"x":1422766800000,"y":16.95},{"x":1422766800000,"y":14.29},{"x":1425186000000,"y":12.9},{"x":1425186000000,"y":16.1166666666667}]},{"type":"line","key":"ROUTER_CPU","yAxis":"1","values":[{"x":1388552400000,"y":3.0},{"x":1388552400000,"y":4.0},{"x":1388552400000,"y":4.89},{"x":1388552400000,"y":7.0},{"x":1391230800000,"y":4.57},{"x":1391230800000,"y":4.0},{"x":1391230800000,"y":4.0},{"x":1391230800000,"y":7.0},{"x":1393650000000,"y":7.0},{"x":1393650000000,"y":4.18},{"x":1393650000000,"y":5.0},{"x":1393650000000,"y":5.0},{"x":1396324800000,"y":5.0},{"x":1396324800000,"y":5.0},{"x":1396324800000,"y":5.06},{"x":1396324800000,"y":6.0},{"x":1398916800000,"y":5.0},{"x":1398916800000,"y":5.0},{"x":1398916800000,"y":5.0},{"x":1398916800000,"y":5.0},{"x":1401595200000,"y":6.0},{"x":1401595200000,"y":6.09},{"x":1401595200000,"y":6.0},{"x":1401595200000,"y":6.0},{"x":1404187200000,"y":6.36},{"x":1404187200000,"y":7.0},{"x":1404187200000,"y":7.0},{"x":1404187200000,"y":7.0},{"x":1406865600000,"y":7.0},{"x":1406865600000,"y":7.02},{"x":1406865600000,"y":7.24},{"x":1406865600000,"y":7.0},{"x":1409544000000,"y":8.23},{"x":1409544000000,"y":8.11},{"x":1409544000000,"y":8.12},{"x":1409544000000,"y":8.03},{"x":1412136000000,"y":9.0},{"x":1412136000000,"y":8.93},{"x":1412136000000,"y":8.57},{"x":1412136000000,"y":9.0},{"x":1414814400000,"y":5.97},{"x":1414814400000,"y":6.0},{"x":1414814400000,"y":9.0},{"x":1414814400000,"y":9.0},{"x":1417410000000,"y":9.0},{"x":1417410000000,"y":8.78},{"x":1420088400000,"y":3.0},{"x":1420088400000,"y":2.01},{"x":1420088400000,"y":3.0},{"x":1420088400000,"y":3.01},{"x":1422766800000,"y":2.67},{"x":1422766800000,"y":2.0},{"x":1425186000000,"y":2.8},{"x":1425186000000,"y":3.63333333333333}]},{"type":"line","key":"SCTP_CPU","yAxis":"1","values":[{"x":1388552400000,"y":7.0},{"x":1388552400000,"y":10.0},{"x":1388552400000,"y":8.27},{"x":1388552400000,"y":8.0},{"x":1391230800000,"y":10.02},{"x":1391230800000,"y":8.04},{"x":1391230800000,"y":9.0},{"x":1391230800000,"y":10.0},{"x":1393650000000,"y":12.0},{"x":1393650000000,"y":10.04},{"x":1393650000000,"y":11.16},{"x":1393650000000,"y":10.0},{"x":1396324800000,"y":10.7},{"x":1396324800000,"y":13.31},{"x":1396324800000,"y":12.73},{"x":1396324800000,"y":9.0},{"x":1398916800000,"y":12.41},{"x":1398916800000,"y":11.95},{"x":1398916800000,"y":12.82},{"x":1398916800000,"y":9.58},{"x":1401595200000,"y":11.28},{"x":1401595200000,"y":14.01},{"x":1401595200000,"y":14.63},{"x":1401595200000,"y":11.83},{"x":1404187200000,"y":14.06},{"x":1404187200000,"y":13.96},{"x":1404187200000,"y":14.66},{"x":1404187200000,"y":14.36},{"x":1406865600000,"y":16.6},{"x":1406865600000,"y":16.95},{"x":1406865600000,"y":17.11},{"x":1406865600000,"y":15.94},{"x":1409544000000,"y":19.86},{"x":1409544000000,"y":22.97},{"x":1409544000000,"y":21.56},{"x":1409544000000,"y":24.55},{"x":1412136000000,"y":22.66},{"x":1412136000000,"y":26.79},{"x":1412136000000,"y":26.54},{"x":1412136000000,"y":25.35},{"x":1414814400000,"y":21.0},{"x":1414814400000,"y":20.35},{"x":1414814400000,"y":21.93},{"x":1414814400000,"y":23.63},{"x":1417410000000,"y":24.0},{"x":1417410000000,"y":21.43},{"x":1420088400000,"y":12.63},{"x":1420088400000,"y":25.14},{"x":1420088400000,"y":21.85},{"x":1420088400000,"y":12.5766666666667},{"x":1422766800000,"y":26.3},{"x":1422766800000,"y":24.4},{"x":1425186000000,"y":23.3833333333333},{"x":1425186000000,"y":24.5833333333333}]},{"type":"line","key":"DP_CPU","yAxis":"1","values":[{"x":1388552400000,"y":2.0},{"x":1388552400000,"y":5.0},{"x":1388552400000,"y":2.17},{"x":1388552400000,"y":2.0},{"x":1391230800000,"y":3.01},{"x":1391230800000,"y":2.56},{"x":1391230800000,"y":3.0},{"x":1391230800000,"y":9.0},{"x":1393650000000,"y":10.0},{"x":1393650000000,"y":3.64},{"x":1393650000000,"y":4.06},{"x":1393650000000,"y":4.0},{"x":1396324800000,"y":4.04},{"x":1396324800000,"y":5.11},{"x":1396324800000,"y":5.9},{"x":1396324800000,"y":8.0},{"x":1398916800000,"y":5.08},{"x":1398916800000,"y":4.65},{"x":1398916800000,"y":4.74},{"x":1398916800000,"y":2.98},{"x":1401595200000,"y":6.13},{"x":1401595200000,"y":8.98},{"x":1401595200000,"y":9.22},{"x":1401595200000,"y":5.84},{"x":1404187200000,"y":8.12},{"x":1404187200000,"y":7.89},{"x":1404187200000,"y":8.41},{"x":1404187200000,"y":8.47},{"x":1406865600000,"y":11.06},{"x":1406865600000,"y":11.84},{"x":1406865600000,"y":11.92},{"x":1406865600000,"y":10.8},{"x":1409544000000,"y":14.58},{"x":1409544000000,"y":18.39},{"x":1409544000000,"y":15.5},{"x":1409544000000,"y":18.33},{"x":1412136000000,"y":18.01},{"x":1412136000000,"y":21.3},{"x":1412136000000,"y":21.11},{"x":1412136000000,"y":18.37},{"x":1414814400000,"y":18.59},{"x":1414814400000,"y":18.81},{"x":1414814400000,"y":17.13},{"x":1414814400000,"y":16.92},{"x":1417410000000,"y":18.0},{"x":1417410000000,"y":15.18},{"x":1420088400000,"y":9.16},{"x":1420088400000,"y":12.13},{"x":1420088400000,"y":11.76},{"x":1420088400000,"y":9.31},{"x":1422766800000,"y":13.47},{"x":1422766800000,"y":13.41},{"x":1425186000000,"y":12.2333333333333},{"x":1425186000000,"y":12.4}]}];
+</script>
+
+ <script>
+ $(function(){
+
+
+ /* area chart and line chart titles */
+ d3.select("#areaChart svg").append("text").attr("x", 200).attr("y", 15)
+ .attr("text-anchor", "middle").style("font-size", "16px").text(
+ "Data Usage in NJ Locations");
+
+ d3.select("#lineChart svg").append("text").attr("x", 200).attr("y", 15)
+ .attr("text-anchor", "middle").style("font-size", "16px").text(
+ "Data Usage in NJ Locations");
+ });
+</script>
+
+<div ng-controller="welcomeController">
+ <fmt:message key="general.home" var="title" />
+ <div>
+ <span style="font-weight:bold;font-size:11pt;">Welcome ${sessionScope.user.firstName} ${sessionScope.user.lastName}</span>&nbsp;
+ (Last Login:&nbsp;<fmt:formatDate value="${sessionScope.user.lastLoginDate}" type="date" pattern="dd MMM yyyy hh:mma zzz" var="lastLogin" /> ${lastLogin})
+ </div>
+
+ <div id="gridDiv" class="center">
+ <div class="gridster-container">
+ <div att-gridster att-gridster-options='gridsterOpts'>
+ <div att-gridster-item='item' ng-repeat="item in standardItems">
+ <div att-gridster-item-header
+ header-text={{item.headerText}}
+ sub-header-text={{item.subHeaderText}}>
+ <!--ICON BUTTONS PLACEHOLDER START-->
+ <div class="tileMinMaxBtn" ng-click="toggleMinMax($index,'')">
+ <span class="tileMinMaxIcon">
+ <i class="ion-chevron-up" style="color:gray" ng-show="item.max"></i>
+ <i class="ion-chevron-down" style="color:gray" ng-hide="item.max"></i>
+ </span>
+ </div>
+ <!--ICON BUTTONS PLACEHOLDER END-->
+ </div>
+ <div att-gridster-item-body >
+ <!--ACTUAL BODY CONTENT START-->
+ <div align="center" style="margin-top:10px;">
+ <div align="left" ng-if="item.headerText=='Dashboard' && item.max">
+ <label>&nbsp; Sample Charts</label><BR>
+ <iframe scrolling="no" frameBorder="0" style="width: 430px; height: 360px;" src="static/fusion/sample/html/wordcloud.html"></iframe>
+ </div>
+ <div ng-if="item.headerText=='Donut Chart' && item.max">
+ <iframe scrolling="no" frameBorder="0" style="width: 310px; height: 210px;" src="static/fusion/sample/html/donut_d3.html"></iframe>
+ </div>
+ <!-- <div ng-if="item.headerText=='Area Chart' && item.max">
+ <div id="areaChart">
+ <div> <svg></svg> </div>
+ <script src="static/fusion/sample/html/js/area_chart.min.js"></script>
+ </div>
+ <iframe scrolling="no" frameBorder="0" style="width: 310px; height: 210px;" src="static/fusion/sample/html/area_chart.html"></iframe>
+ </div> -->
+ <div ng-if="item.headerText=='Pie Chart' && item.max">
+ <iframe scrolling="no" frameBorder="0" style="width: 310px; height: 210px;" src="static/fusion/sample/html/pie_chart.html"></iframe>
+ </div>
+ <!-- <div ng-if="item.headerText=='Line Chart' && item.max">
+ <div id="lineChart">
+ <div> <svg></svg> </div>
+ <script src="static/fusion/sample/html/js/line_chart.min.js"></script>
+ </div>
+
+ <iframe scrolling="no" frameBorder="0" style="width: 310px; height: 210px;" src="static/fusion/sample/html/line_chart.html"></iframe>
+ </div> -->
+ <div ng-if="item.headerText=='Gauges' && item.max">
+ <iframe scrolling="no" frameBorder="0" style="width: 310pxx; height: 210px;" src="static/fusion/sample/html/d3_gauges_demo.html"></iframe>
+ </div>
+
+ <div align="left" ng-if="item.headerText=='Traffic distribution by day of week' && item.max">
+ <div id = "selectedTrafficDay">
+ <ul>
+ <li ng-repeat="Daytab in selectedTrafficDay"
+ ng-class="{active1:isActiveTab1(Daytab.url)}"
+ ng-click="onClickTab1(Daytab)">{{Daytab.title}}</li>
+ </ul>
+ <div id = "SelectedTrafficeDayView">
+ <div ng-include="currentSelectedDayTab"></div>
+ </div>
+ <script type="text/ng-template" id="#Monday">
+ <div id="Monday" align="centers"><img src="static/fusion/sample/images/tunnels/1_mon.png" width=100% height=100% alt="Monday"></div>
+ </script>
+ <script type="text/ng-template" id="#Tuesday">
+ <div id="Tuesday" align="center"><img src="static/fusion/sample/images/tunnels/2_tue.png" width=100% height=100% alt="Tuesday"></div>
+ </script>
+ <script type="text/ng-template" id="#Wednesday">
+ <div id="Wednesday" align="center"><img src="static/fusion/sample/images/tunnels/3_wed.png" width=100% height=100% alt="Wednesday"></div>
+ </script>
+ <script type="text/ng-template" id="#Thursday">
+ <div id="Thursday" align="center"><img src="static/fusion/sample/images/tunnels/4_thu.png" width=100% height=100% alt="Thursday"></div>
+ </script>
+ <script type="text/ng-template" id="#Friday">
+ <div id="Friday" align="center"><img src="static/fusion/sample/images/tunnels/5_fri.png" width=100% height=100% alt="Friday"></div>
+ </script>
+ <script type="text/ng-template" id="#Saturday">
+ <div id="Saturday" align="center"><img src="static/fusion/sample/images/tunnels/6_sat.png" width=100% height=100% alt="Saturday"></div>
+ </script>
+ <script type="text/ng-template" id="#Sunday">
+ <div id="Sunday" align="center"><img src="static/fusion/sample/images/tunnels/7_sun.png" width=100% height=100% alt="Sunday"></div>
+ </script>
+ </div>
+ </div>
+
+ <div align="left" ng-if="item.headerText=='Busy hour traffic analysis by day of week' && item.max">
+ <div id = "BusyHourTraffic">
+ <ul>
+ <li ng-repeat="TrafficTab in BusyHourTraffic"
+ ng-class="{active2:isActiveTab2(TrafficTab.url)}"
+ ng-click="onClickTab2(TrafficTab)">{{TrafficTab.title}}</li>
+ </ul>
+ <div id = "BusyHourTrafficView">
+ <div ng-include="currentSelectedBusyHourTraffic"></div>
+ </div>
+ <script type="text/ng-template" id="#Incoming">
+ <div id="Incoming" align="left"><img src="static/fusion/sample/images/tunnels/BH_DLSTX_IN.png" width=100% height=100%></div>
+ </script>
+ <script type="text/ng-template" id="#Outgoing">
+ <div id="Outgoing" align="center"><img src="static/fusion/sample/images/tunnels/BH_DLSTX_OUT.png" width=100% height=100%></div>
+ </script>
+ <script type="text/ng-template" id="#Default">
+ <div id="Default" align="center"><img src="static/fusion/sample/images/tunnels/BH_Nat_Def.png" width=100% height=100%></div>
+ </script>
+ <script type="text/ng-template" id="#Priority">
+ <div id="Priority" align="center"><img src="static/fusion/sample/images/tunnels/BH_Nat_Priority.png" width=100% height=100%></div>
+ </script>
+ <script type="text/ng-template" id="#BHNational">
+ <div id="BHNational" align="center"><img src="static/fusion/sample/images/tunnels/BH_Nat.png" width=100% height=100%></div>
+ </script>
+ </div>
+ </div>
+
+ <div align="left" ng-if="item.headerText=='Additional Samples' && item.max">
+ <label>&nbsp;Quick Links</label>
+ <table att-table>
+
+
+ <tr>
+ <td att-table-body width="90%" ><a href="http://jquery.com" target="_blank">JQuery</a></td>
+ <td att-table-body width="10%">
+ <a ng-click="removeRole();" ><img src="static/fusion/sample/images/deleteicon.gif"></a>
+ </td>
+ </tr>
+
+ <!-- <tr>
+ <td att-table-body width="90%" ><a href="sample_heat_map.htm" target="">Heat Map</a></td>
+ <td att-table-body width="10%">
+ <a ng-click="removeRole();" ><img src="static/fusion/sample/images/deleteicon.gif"></a>
+ </td>
+ </tr> -->
+ <tr>
+ <td att-table-body width="90%" ><a href="leafletMap.htm" target="">Animated Map</a></td>
+ <td att-table-body width="10%">
+ <a ng-click="removeRole();" ><img src="static/fusion/sample/images/deleteicon.gif"></a>
+ </td>
+ </tr>
+ <tr>
+ <td att-table-body width="90%" ><a href="collaborate_list.htm">Chat Session</a></td>
+ <td att-table-body width="10%">
+ <a ng-click="removeRole();" ><img src="static/fusion/sample/images/deleteicon.gif"></a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div ng-if="item.headerText=='Sticky Notes' && item.max">
+ <div style="width:100%; height:400px" id="scribble-pad"><pre id="scribble" contenteditable="true" onkeyup="storeUserScribble(this.id);"></pre></div>
+ </div>
+
+ <div ng-if="item.headerText=='Service Configuration' && item.max">
+ <accordion close-others="true" css="att-accordion">
+ <accordion-group heading="Service Configuration" is-open="group11.open">
+ <iframe style="overflow:auto" frameBorder="0" align="center" width="100%" height="400px" src="static/fusion/sample/org_chart/example.html" ></iframe>
+ </accordion-group>
+ <accordion-group heading="VSP Service Configuration" is-open="group12.open">
+ <iframe style="overflow:auto" frameBorder="0" align="center" width="100%" height="400px" src="static/fusion/sample/org_chart/example_vsp.html" ></iframe>
+ </accordion-group>
+ </accordion>
+
+ </div>
+
+ </div>
+
+ <!--ACTUAL BODY CONTENT END-->
+ </div>
+
+ </div>
+ </div>
+ </div>
+ </div> <!-- End gridDiv -->
+
+</div>
+
+<script>
+ $(document).ready(function() {
+ $("#rightIcon").hide();
+ $("#leftIcon").show();
+ });
+
+ app.controller('welcomeController',function($scope, modalService, $modal) {
+
+ $scope.gridsterOpts = {
+ columns : 3, // the width of the grid, in columns
+ pushing : true, // whether to push other items out of the way on move or resize
+ floating : true, // whether to automatically float items up so they stack (you can temporarily disable if you are adding unsorted items with ng-repeat)
+ width : 'auto', // can be an integer or 'auto'. 'auto' scales gridster to be the full width of its containing element
+ colWidth : 'auto', // can be an integer or 'auto'. 'auto' uses the pixel width of the element divided by 'columns'
+ rowHeight : 60, // can be an integer or 'match'. Match uses the colWidth, giving you square widgets.
+ margins : [ 10, 10 ], // the pixel distance between each widget
+ outerMargin : true, // whether margins apply to outer edges of the grid
+ swapping : true,
+ draggable : {
+ enabled : true, // whether dragging items is supported
+ stop: function(event, uiWidget, $element) {$scope.setCookie();} // optional callback fired when item is finished dragging
+ }
+
+ };
+
+ /* $scope.gridsterOpts = {
+ columns: 6,
+ width: 'auto',
+ colWidth: '230',
+ rowHeight: '120',
+ margins: [10, 10],
+ outerMargin: true,
+ pushing: true,
+ floating: true,
+ swapping: true
+ }; */
+
+ $scope.toggleMinMax = function(index, tileName) {
+ if (tileName == '') {
+ $scope.standardItems[index].max = !$scope.standardItems[index].max;
+ if ($scope.standardItems[index].max)
+ $scope.standardItems[index].sizeY = $scope.standardItems[index].maxHeight;
+ else
+ $scope.standardItems[index].sizeY = 0;
+ } else {
+ $scope.tileTemp = $scope.$eval(tileName);
+ var tileMax = $parse(tileName + '.max');
+ tileMax.assign($scope,!$scope.$eval(tileName).max);
+ var tileSizeY = $parse(tileName + '.sizeY');
+ if ($scope.tileTemp.max)
+ tileSizeY.assign($scope,$scope.tileTemp.maxHeight);
+ else
+ tileSizeY.assign($scope, 0);
+ }
+ };
+
+
+
+ // These map directly to gridsterItem options
+ // IMPORTANT: Items should be placed in the grid in the order in which
+ // they should appear.
+ // In most cases the sorting should be by row ASC, col ASC
+ $scope.standardItems = [{
+ sizeX : 1,
+ sizeY : 8,
+ maxHeight : 8,
+ row : 0,
+ col : 0,
+ headerText : 'Dashboard',
+ max : false
+
+ },
+ {
+ sizeX : 1,
+ sizeY : 5,
+ maxHeight : 5,
+ row : 0,
+ col : 1,
+ headerText : 'Donut Chart',
+ max : false
+
+ },
+ /* {
+ sizeX : 1,
+ sizeY : 5,
+ maxHeight : 5,
+ row : 0,
+ col : 2,
+ headerText : 'Area Chart',
+ max : false
+ }, */
+ {
+ sizeX : 1,
+ sizeY : 5,
+ maxHeight : 5,
+ row : 8,
+ col : 0,
+ headerText : 'Pie Chart',
+ max : false
+ },
+ /* {
+ sizeX : 1,
+ sizeY : 5,
+ maxHeight : 5,
+ row : 8,
+ col : 1,
+ headerText : 'Line Chart',
+ max : false
+ }, */
+ {
+ sizeX : 1,
+ sizeY : 5,
+ maxHeight : 5,
+ row : 8,
+ col : 2,
+ headerText : 'Gauges',
+ max : false
+ },
+ {
+ sizeX : 1,
+ sizeY : 8,
+ maxHeight : 8,
+ row : 16,
+ col : 0,
+ headerText : 'Traffic distribution by day of week',
+ max : false
+ },
+ {
+ sizeX : 1,
+ sizeY : 8,
+ maxHeight : 8,
+ row : 16,
+ col : 1,
+ headerText : 'Busy hour traffic analysis by day of week',
+ max : false
+ },
+ {
+ sizeX : 1,
+ sizeY : 6,
+ maxHeight : 6,
+ row : 24,
+ col : 0,
+ headerText : 'Additional Samples',
+ max : false
+ },
+ {
+ sizeX : 1,
+ sizeY : 8,
+ maxHeight : 8,
+ row : 24,
+ col : 1,
+ headerText : 'Sticky Notes',
+ max : false
+ },
+ {
+ sizeX : 3,
+ sizeY : 10,
+ maxHeight : 10,
+ row : 32,
+ col : 0,
+ headerText : 'Service Configuration',
+ max : false
+ } ];
+
+ $.each($scope.standardItems, function(i, a) {
+ $scope.toggleMinMax(i, '');
+ });
+ $scope.activeTabId = 'Monday';
+ //for generic tabs
+
+ $scope.selectedTrafficDay = [{
+ title : 'Mon',
+ url : '#Monday'
+ }, {
+ title : 'Tue',
+ url : '#Tuesday'
+ }, {
+ title : 'Wed',
+ url : '#Wednesday'
+ }, {
+ title : 'Thu',
+ url : '#Thursday'
+ }, {
+ title : 'Fri',
+ url : '#Friday'
+ }, {
+ title : 'Sat',
+ url : '#Saturday'
+ }, {
+ title : 'Sun',
+ url : '#Sunday'
+ }];
+
+ $scope.currentSelectedDayTab = '#Monday';
+
+ $scope.onClickTab1 = function (Daytab) {
+ $scope.currentSelectedDayTab = Daytab.url;
+ }
+
+ $scope.isActiveTab1 = function(tabUrl) {
+ return tabUrl == $scope.currentSelectedDayTab;
+ }
+
+
+ $scope.gTabs = [ {
+ title : 'Monday',
+ id : 'Monday',
+ url : '#Monday',
+ selected : true
+ }, {
+ title : 'Tuesday',
+ id : 'Tuesday',
+ url : '#Tuesday'
+ }, {
+ title : 'Wednesday',
+ id : 'Wednesday',
+ url : '#Wednesday'
+ }, {
+ title : 'Thursday',
+ id : 'Thursday',
+ url : '#Thursday'
+ }, {
+ title : 'Friday',
+ id : 'Friday',
+ url : '#Friday'
+ }, {
+ title : 'Saturday',
+ id : 'Saturday',
+ url : '#Saturday'
+ }, {
+ title : 'Sunday',
+ id : 'Sunday',
+ url : '#Sunday'
+ }
+ ];
+
+
+
+
+
+ $scope.BusyHourTraffic = [ {
+ title : 'BH SNRC DLSTX - Incoming',
+ url : '#Incoming'
+ }, {
+ title : 'BH SNRC DLSTX - Outgoing',
+ url : '#Outgoing'
+ }, {
+ title : 'BH National - Default',
+ url : '#Default'
+ }, {
+ title : 'BH National - Priority',
+ url : '#Priority'
+ }, {
+ title : 'BH National',
+ url : '#BHNational'
+ }
+
+ ];
+
+ $scope.currentSelectedBusyHourTraffic = '#Incoming';
+
+ $scope.onClickTab2 = function (TrafficTab) {
+ $scope.currentSelectedBusyHourTraffic = TrafficTab.url;
+ }
+
+ $scope.isActiveTab2 = function(tabUrl) {
+ return tabUrl == $scope.currentSelectedBusyHourTraffic;
+ }
+
+
+ $scope.activeTabId2 = 'Incoming';
+ //for generic tabs
+ $scope.gTabs2 = [ {
+ title : 'BH SNRC DLSTX - Incoming',
+ id : 'Incoming',
+ url : '#Incoming',
+ selected : true
+ }, {
+ title : 'BH SNRC DLSTX - Outgoing',
+ id : 'Outgoing',
+ url : '#Outgoing'
+ }, {
+ title : 'BH National - Default',
+ id : 'Default',
+ url : '#Default'
+ }, {
+ title : 'BH National - Priority',
+ id : 'Priority',
+ url : '#Priority'
+ }, {
+ title : 'BH National',
+ id : 'BHNational',
+ url : '#BHNational'
+ }
+ ];
+
+ $scope.activeTabId3 = 'Incoming';
+ //for generic tabs
+ $scope.gTabs3 = [ {
+ title : 'BH SNRC DLSTX - Incoming',
+ id: 'Incoming',
+ url : '#Incoming',
+ selected : true
+ }, {
+ title : 'BH SNRC DLSTX - Outgoing',
+ id : 'Outgoing',
+ url : '#Outgoing'
+ }, {
+ title : 'BH National - Default',
+ id : 'Default',
+ url : '#Default'
+ }, {
+ title : 'BH National - Priority',
+ id : 'Priority',
+ url : '#Priority'
+ }, {
+ title : 'BH National',
+ id : 'BHNational',
+ url : '#BHNational'
+ }
+ ];
+
+ /* $scope.$watch('activeTabId', function(newVal) {
+ alert(newval);
+ $('#'+newval).show();
+ }, true); */
+
+ $scope.toggleEastToWest = function() {
+ $("#toggle").toggle('slide');
+ if ($("#leftIcon").is(":visible")) {
+ $("#rightIcon").show();
+ $("#leftIcon").hide();
+ }
+ else if ($("#rightIcon").is(":visible")) {
+ $("#rightIcon").hide();
+ $("#leftIcon").show();
+ }
+ };
+
+ $scope.group1 = {
+ open : true
+ };
+ $scope.group2 = {
+ open : true
+ };
+ $scope.group3 = {
+ open : true
+ };
+ $scope.group4 = {
+ open : true
+ };
+ $scope.group5 = {
+ open : true
+ };
+ $scope.group6 = {
+ open : true
+ };
+ $scope.group7 = {
+ open : true
+ };
+ $scope.group71 = {
+ open : true
+ };
+ $scope.group8 = {
+ open : true
+ };
+ $scope.group9 = {
+ open : true
+ };
+ $scope.group10 = {
+ open : true
+ };
+ $scope.group11 = {
+ open : true
+ };
+ $scope.group12 = {
+ open : false
+ };
+ });
+</script>
+
+<!-- Select the Slider control by default -->
+ <script>$('input[name=viewer]:eq(1)').click();</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/web.xml b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 00000000..fcbe8407
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
+ version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee">
+
+ <display-name>ecomp-sdk-app</display-name>
+
+ <!-- The app can function on a HA cluster -->
+ <distributable />
+
+ <session-config>
+ <session-timeout>7</session-timeout>
+ <tracking-mode>COOKIE</tracking-mode>
+ </session-config>
+
+</web-app>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.js
new file mode 100644
index 00000000..2778fc56
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.js
@@ -0,0 +1,4121 @@
+/**
+ * @license AngularJS v1.5.0
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+/* jshint ignore:start */
+var noop = angular.noop;
+var copy = angular.copy;
+var extend = angular.extend;
+var jqLite = angular.element;
+var forEach = angular.forEach;
+var isArray = angular.isArray;
+var isString = angular.isString;
+var isObject = angular.isObject;
+var isUndefined = angular.isUndefined;
+var isDefined = angular.isDefined;
+var isFunction = angular.isFunction;
+var isElement = angular.isElement;
+
+var ELEMENT_NODE = 1;
+var COMMENT_NODE = 8;
+
+var ADD_CLASS_SUFFIX = '-add';
+var REMOVE_CLASS_SUFFIX = '-remove';
+var EVENT_CLASS_PREFIX = 'ng-';
+var ACTIVE_CLASS_SUFFIX = '-active';
+var PREPARE_CLASS_SUFFIX = '-prepare';
+
+var NG_ANIMATE_CLASSNAME = 'ng-animate';
+var NG_ANIMATE_CHILDREN_DATA = '$$ngAnimateChildren';
+
+// Detect proper transitionend/animationend event names.
+var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT;
+
+// If unprefixed events are not supported but webkit-prefixed are, use the latter.
+// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.
+// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`
+// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.
+// Register both events in case `window.onanimationend` is not supported because of that,
+// do the same for `transitionend` as Safari is likely to exhibit similar behavior.
+// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit
+// therefore there is no reason to test anymore for other vendor prefixes:
+// http://caniuse.com/#search=transition
+if (isUndefined(window.ontransitionend) && isDefined(window.onwebkittransitionend)) {
+ CSS_PREFIX = '-webkit-';
+ TRANSITION_PROP = 'WebkitTransition';
+ TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';
+} else {
+ TRANSITION_PROP = 'transition';
+ TRANSITIONEND_EVENT = 'transitionend';
+}
+
+if (isUndefined(window.onanimationend) && isDefined(window.onwebkitanimationend)) {
+ CSS_PREFIX = '-webkit-';
+ ANIMATION_PROP = 'WebkitAnimation';
+ ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend';
+} else {
+ ANIMATION_PROP = 'animation';
+ ANIMATIONEND_EVENT = 'animationend';
+}
+
+var DURATION_KEY = 'Duration';
+var PROPERTY_KEY = 'Property';
+var DELAY_KEY = 'Delay';
+var TIMING_KEY = 'TimingFunction';
+var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount';
+var ANIMATION_PLAYSTATE_KEY = 'PlayState';
+var SAFE_FAST_FORWARD_DURATION_VALUE = 9999;
+
+var ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY;
+var ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY;
+var TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY;
+var TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;
+
+var isPromiseLike = function(p) {
+ return p && p.then ? true : false;
+};
+
+var ngMinErr = angular.$$minErr('ng');
+function assertArg(arg, name, reason) {
+ if (!arg) {
+ throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
+ }
+ return arg;
+}
+
+function mergeClasses(a,b) {
+ if (!a && !b) return '';
+ if (!a) return b;
+ if (!b) return a;
+ if (isArray(a)) a = a.join(' ');
+ if (isArray(b)) b = b.join(' ');
+ return a + ' ' + b;
+}
+
+function packageStyles(options) {
+ var styles = {};
+ if (options && (options.to || options.from)) {
+ styles.to = options.to;
+ styles.from = options.from;
+ }
+ return styles;
+}
+
+function pendClasses(classes, fix, isPrefix) {
+ var className = '';
+ classes = isArray(classes)
+ ? classes
+ : classes && isString(classes) && classes.length
+ ? classes.split(/\s+/)
+ : [];
+ forEach(classes, function(klass, i) {
+ if (klass && klass.length > 0) {
+ className += (i > 0) ? ' ' : '';
+ className += isPrefix ? fix + klass
+ : klass + fix;
+ }
+ });
+ return className;
+}
+
+function removeFromArray(arr, val) {
+ var index = arr.indexOf(val);
+ if (val >= 0) {
+ arr.splice(index, 1);
+ }
+}
+
+function stripCommentsFromElement(element) {
+ if (element instanceof jqLite) {
+ switch (element.length) {
+ case 0:
+ return [];
+ break;
+
+ case 1:
+ // there is no point of stripping anything if the element
+ // is the only element within the jqLite wrapper.
+ // (it's important that we retain the element instance.)
+ if (element[0].nodeType === ELEMENT_NODE) {
+ return element;
+ }
+ break;
+
+ default:
+ return jqLite(extractElementNode(element));
+ break;
+ }
+ }
+
+ if (element.nodeType === ELEMENT_NODE) {
+ return jqLite(element);
+ }
+}
+
+function extractElementNode(element) {
+ if (!element[0]) return element;
+ for (var i = 0; i < element.length; i++) {
+ var elm = element[i];
+ if (elm.nodeType == ELEMENT_NODE) {
+ return elm;
+ }
+ }
+}
+
+function $$addClass($$jqLite, element, className) {
+ forEach(element, function(elm) {
+ $$jqLite.addClass(elm, className);
+ });
+}
+
+function $$removeClass($$jqLite, element, className) {
+ forEach(element, function(elm) {
+ $$jqLite.removeClass(elm, className);
+ });
+}
+
+function applyAnimationClassesFactory($$jqLite) {
+ return function(element, options) {
+ if (options.addClass) {
+ $$addClass($$jqLite, element, options.addClass);
+ options.addClass = null;
+ }
+ if (options.removeClass) {
+ $$removeClass($$jqLite, element, options.removeClass);
+ options.removeClass = null;
+ }
+ }
+}
+
+function prepareAnimationOptions(options) {
+ options = options || {};
+ if (!options.$$prepared) {
+ var domOperation = options.domOperation || noop;
+ options.domOperation = function() {
+ options.$$domOperationFired = true;
+ domOperation();
+ domOperation = noop;
+ };
+ options.$$prepared = true;
+ }
+ return options;
+}
+
+function applyAnimationStyles(element, options) {
+ applyAnimationFromStyles(element, options);
+ applyAnimationToStyles(element, options);
+}
+
+function applyAnimationFromStyles(element, options) {
+ if (options.from) {
+ element.css(options.from);
+ options.from = null;
+ }
+}
+
+function applyAnimationToStyles(element, options) {
+ if (options.to) {
+ element.css(options.to);
+ options.to = null;
+ }
+}
+
+function mergeAnimationDetails(element, oldAnimation, newAnimation) {
+ var target = oldAnimation.options || {};
+ var newOptions = newAnimation.options || {};
+
+ var toAdd = (target.addClass || '') + ' ' + (newOptions.addClass || '');
+ var toRemove = (target.removeClass || '') + ' ' + (newOptions.removeClass || '');
+ var classes = resolveElementClasses(element.attr('class'), toAdd, toRemove);
+
+ if (newOptions.preparationClasses) {
+ target.preparationClasses = concatWithSpace(newOptions.preparationClasses, target.preparationClasses);
+ delete newOptions.preparationClasses;
+ }
+
+ // noop is basically when there is no callback; otherwise something has been set
+ var realDomOperation = target.domOperation !== noop ? target.domOperation : null;
+
+ extend(target, newOptions);
+
+ // TODO(matsko or sreeramu): proper fix is to maintain all animation callback in array and call at last,but now only leave has the callback so no issue with this.
+ if (realDomOperation) {
+ target.domOperation = realDomOperation;
+ }
+
+ if (classes.addClass) {
+ target.addClass = classes.addClass;
+ } else {
+ target.addClass = null;
+ }
+
+ if (classes.removeClass) {
+ target.removeClass = classes.removeClass;
+ } else {
+ target.removeClass = null;
+ }
+
+ oldAnimation.addClass = target.addClass;
+ oldAnimation.removeClass = target.removeClass;
+
+ return target;
+}
+
+function resolveElementClasses(existing, toAdd, toRemove) {
+ var ADD_CLASS = 1;
+ var REMOVE_CLASS = -1;
+
+ var flags = {};
+ existing = splitClassesToLookup(existing);
+
+ toAdd = splitClassesToLookup(toAdd);
+ forEach(toAdd, function(value, key) {
+ flags[key] = ADD_CLASS;
+ });
+
+ toRemove = splitClassesToLookup(toRemove);
+ forEach(toRemove, function(value, key) {
+ flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS;
+ });
+
+ var classes = {
+ addClass: '',
+ removeClass: ''
+ };
+
+ forEach(flags, function(val, klass) {
+ var prop, allow;
+ if (val === ADD_CLASS) {
+ prop = 'addClass';
+ allow = !existing[klass];
+ } else if (val === REMOVE_CLASS) {
+ prop = 'removeClass';
+ allow = existing[klass];
+ }
+ if (allow) {
+ if (classes[prop].length) {
+ classes[prop] += ' ';
+ }
+ classes[prop] += klass;
+ }
+ });
+
+ function splitClassesToLookup(classes) {
+ if (isString(classes)) {
+ classes = classes.split(' ');
+ }
+
+ var obj = {};
+ forEach(classes, function(klass) {
+ // sometimes the split leaves empty string values
+ // incase extra spaces were applied to the options
+ if (klass.length) {
+ obj[klass] = true;
+ }
+ });
+ return obj;
+ }
+
+ return classes;
+}
+
+function getDomNode(element) {
+ return (element instanceof angular.element) ? element[0] : element;
+}
+
+function applyGeneratedPreparationClasses(element, event, options) {
+ var classes = '';
+ if (event) {
+ classes = pendClasses(event, EVENT_CLASS_PREFIX, true);
+ }
+ if (options.addClass) {
+ classes = concatWithSpace(classes, pendClasses(options.addClass, ADD_CLASS_SUFFIX));
+ }
+ if (options.removeClass) {
+ classes = concatWithSpace(classes, pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX));
+ }
+ if (classes.length) {
+ options.preparationClasses = classes;
+ element.addClass(classes);
+ }
+}
+
+function clearGeneratedClasses(element, options) {
+ if (options.preparationClasses) {
+ element.removeClass(options.preparationClasses);
+ options.preparationClasses = null;
+ }
+ if (options.activeClasses) {
+ element.removeClass(options.activeClasses);
+ options.activeClasses = null;
+ }
+}
+
+function blockTransitions(node, duration) {
+ // we use a negative delay value since it performs blocking
+ // yet it doesn't kill any existing transitions running on the
+ // same element which makes this safe for class-based animations
+ var value = duration ? '-' + duration + 's' : '';
+ applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]);
+ return [TRANSITION_DELAY_PROP, value];
+}
+
+function blockKeyframeAnimations(node, applyBlock) {
+ var value = applyBlock ? 'paused' : '';
+ var key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY;
+ applyInlineStyle(node, [key, value]);
+ return [key, value];
+}
+
+function applyInlineStyle(node, styleTuple) {
+ var prop = styleTuple[0];
+ var value = styleTuple[1];
+ node.style[prop] = value;
+}
+
+function concatWithSpace(a,b) {
+ if (!a) return b;
+ if (!b) return a;
+ return a + ' ' + b;
+}
+
+var $$rAFSchedulerFactory = ['$$rAF', function($$rAF) {
+ var queue, cancelFn;
+
+ function scheduler(tasks) {
+ // we make a copy since RAFScheduler mutates the state
+ // of the passed in array variable and this would be difficult
+ // to track down on the outside code
+ queue = queue.concat(tasks);
+ nextTick();
+ }
+
+ queue = scheduler.queue = [];
+
+ /* waitUntilQuiet does two things:
+ * 1. It will run the FINAL `fn` value only when an uncanceled RAF has passed through
+ * 2. It will delay the next wave of tasks from running until the quiet `fn` has run.
+ *
+ * The motivation here is that animation code can request more time from the scheduler
+ * before the next wave runs. This allows for certain DOM properties such as classes to
+ * be resolved in time for the next animation to run.
+ */
+ scheduler.waitUntilQuiet = function(fn) {
+ if (cancelFn) cancelFn();
+
+ cancelFn = $$rAF(function() {
+ cancelFn = null;
+ fn();
+ nextTick();
+ });
+ };
+
+ return scheduler;
+
+ function nextTick() {
+ if (!queue.length) return;
+
+ var items = queue.shift();
+ for (var i = 0; i < items.length; i++) {
+ items[i]();
+ }
+
+ if (!cancelFn) {
+ $$rAF(function() {
+ if (!cancelFn) nextTick();
+ });
+ }
+ }
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngAnimateChildren
+ * @restrict AE
+ * @element ANY
+ *
+ * @description
+ *
+ * ngAnimateChildren allows you to specify that children of this element should animate even if any
+ * of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move`
+ * (structural) animation, child elements that also have an active structural animation are not animated.
+ *
+ * Note that even if `ngAnimteChildren` is set, no child animations will run when the parent element is removed from the DOM (`leave` animation).
+ *
+ *
+ * @param {string} ngAnimateChildren If the value is empty, `true` or `on`,
+ * then child animations are allowed. If the value is `false`, child animations are not allowed.
+ *
+ * @example
+ * <example module="ngAnimateChildren" name="ngAnimateChildren" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <div ng-controller="mainController as main">
+ <label>Show container? <input type="checkbox" ng-model="main.enterElement" /></label>
+ <label>Animate children? <input type="checkbox" ng-model="main.animateChildren" /></label>
+ <hr>
+ <div ng-animate-children="{{main.animateChildren}}">
+ <div ng-if="main.enterElement" class="container">
+ List of items:
+ <div ng-repeat="item in [0, 1, 2, 3]" class="item">Item {{item}}</div>
+ </div>
+ </div>
+ </div>
+ </file>
+ <file name="animations.css">
+
+ .container.ng-enter,
+ .container.ng-leave {
+ transition: all ease 1.5s;
+ }
+
+ .container.ng-enter,
+ .container.ng-leave-active {
+ opacity: 0;
+ }
+
+ .container.ng-leave,
+ .container.ng-enter-active {
+ opacity: 1;
+ }
+
+ .item {
+ background: firebrick;
+ color: #FFF;
+ margin-bottom: 10px;
+ }
+
+ .item.ng-enter,
+ .item.ng-leave {
+ transition: transform 1.5s ease;
+ }
+
+ .item.ng-enter {
+ transform: translateX(50px);
+ }
+
+ .item.ng-enter-active {
+ transform: translateX(0);
+ }
+ </file>
+ <file name="script.js">
+ angular.module('ngAnimateChildren', ['ngAnimate'])
+ .controller('mainController', function() {
+ this.animateChildren = false;
+ this.enterElement = false;
+ });
+ </file>
+ </example>
+ */
+var $$AnimateChildrenDirective = ['$interpolate', function($interpolate) {
+ return {
+ link: function(scope, element, attrs) {
+ var val = attrs.ngAnimateChildren;
+ if (angular.isString(val) && val.length === 0) { //empty attribute
+ element.data(NG_ANIMATE_CHILDREN_DATA, true);
+ } else {
+ // Interpolate and set the value, so that it is available to
+ // animations that run right after compilation
+ setData($interpolate(val)(scope));
+ attrs.$observe('ngAnimateChildren', setData);
+ }
+
+ function setData(value) {
+ value = value === 'on' || value === 'true';
+ element.data(NG_ANIMATE_CHILDREN_DATA, value);
+ }
+ }
+ };
+}];
+
+var ANIMATE_TIMER_KEY = '$$animateCss';
+
+/**
+ * @ngdoc service
+ * @name $animateCss
+ * @kind object
+ *
+ * @description
+ * The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes
+ * from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT
+ * to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or
+ * directives to create more complex animations that can be purely driven using CSS code.
+ *
+ * Note that only browsers that support CSS transitions and/or keyframe animations are capable of
+ * rendering animations triggered via `$animateCss` (bad news for IE9 and lower).
+ *
+ * ## Usage
+ * Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that
+ * is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however,
+ * any automatic control over cancelling animations and/or preventing animations from being run on
+ * child elements will not be handled by Angular. For this to work as expected, please use `$animate` to
+ * trigger the animation and then setup a JavaScript animation that injects `$animateCss` to trigger
+ * the CSS animation.
+ *
+ * The example below shows how we can create a folding animation on an element using `ng-if`:
+ *
+ * ```html
+ * <!-- notice the `fold-animation` CSS class -->
+ * <div ng-if="onOff" class="fold-animation">
+ * This element will go BOOM
+ * </div>
+ * <button ng-click="onOff=true">Fold In</button>
+ * ```
+ *
+ * Now we create the **JavaScript animation** that will trigger the CSS transition:
+ *
+ * ```js
+ * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {
+ * return {
+ * enter: function(element, doneFn) {
+ * var height = element[0].offsetHeight;
+ * return $animateCss(element, {
+ * from: { height:'0px' },
+ * to: { height:height + 'px' },
+ * duration: 1 // one second
+ * });
+ * }
+ * }
+ * }]);
+ * ```
+ *
+ * ## More Advanced Uses
+ *
+ * `$animateCss` is the underlying code that ngAnimate uses to power **CSS-based animations** behind the scenes. Therefore CSS hooks
+ * like `.ng-EVENT`, `.ng-EVENT-active`, `.ng-EVENT-stagger` are all features that can be triggered using `$animateCss` via JavaScript code.
+ *
+ * This also means that just about any combination of adding classes, removing classes, setting styles, dynamically setting a keyframe animation,
+ * applying a hardcoded duration or delay value, changing the animation easing or applying a stagger animation are all options that work with
+ * `$animateCss`. The service itself is smart enough to figure out the combination of options and examine the element styling properties in order
+ * to provide a working animation that will run in CSS.
+ *
+ * The example below showcases a more advanced version of the `.fold-animation` from the example above:
+ *
+ * ```js
+ * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {
+ * return {
+ * enter: function(element, doneFn) {
+ * var height = element[0].offsetHeight;
+ * return $animateCss(element, {
+ * addClass: 'red large-text pulse-twice',
+ * easing: 'ease-out',
+ * from: { height:'0px' },
+ * to: { height:height + 'px' },
+ * duration: 1 // one second
+ * });
+ * }
+ * }
+ * }]);
+ * ```
+ *
+ * Since we're adding/removing CSS classes then the CSS transition will also pick those up:
+ *
+ * ```css
+ * /&#42; since a hardcoded duration value of 1 was provided in the JavaScript animation code,
+ * the CSS classes below will be transitioned despite them being defined as regular CSS classes &#42;/
+ * .red { background:red; }
+ * .large-text { font-size:20px; }
+ *
+ * /&#42; we can also use a keyframe animation and $animateCss will make it work alongside the transition &#42;/
+ * .pulse-twice {
+ * animation: 0.5s pulse linear 2;
+ * -webkit-animation: 0.5s pulse linear 2;
+ * }
+ *
+ * @keyframes pulse {
+ * from { transform: scale(0.5); }
+ * to { transform: scale(1.5); }
+ * }
+ *
+ * @-webkit-keyframes pulse {
+ * from { -webkit-transform: scale(0.5); }
+ * to { -webkit-transform: scale(1.5); }
+ * }
+ * ```
+ *
+ * Given this complex combination of CSS classes, styles and options, `$animateCss` will figure everything out and make the animation happen.
+ *
+ * ## How the Options are handled
+ *
+ * `$animateCss` is very versatile and intelligent when it comes to figuring out what configurations to apply to the element to ensure the animation
+ * works with the options provided. Say for example we were adding a class that contained a keyframe value and we wanted to also animate some inline
+ * styles using the `from` and `to` properties.
+ *
+ * ```js
+ * var animator = $animateCss(element, {
+ * from: { background:'red' },
+ * to: { background:'blue' }
+ * });
+ * animator.start();
+ * ```
+ *
+ * ```css
+ * .rotating-animation {
+ * animation:0.5s rotate linear;
+ * -webkit-animation:0.5s rotate linear;
+ * }
+ *
+ * @keyframes rotate {
+ * from { transform: rotate(0deg); }
+ * to { transform: rotate(360deg); }
+ * }
+ *
+ * @-webkit-keyframes rotate {
+ * from { -webkit-transform: rotate(0deg); }
+ * to { -webkit-transform: rotate(360deg); }
+ * }
+ * ```
+ *
+ * The missing pieces here are that we do not have a transition set (within the CSS code nor within the `$animateCss` options) and the duration of the animation is
+ * going to be detected from what the keyframe styles on the CSS class are. In this event, `$animateCss` will automatically create an inline transition
+ * style matching the duration detected from the keyframe style (which is present in the CSS class that is being added) and then prepare both the transition
+ * and keyframe animations to run in parallel on the element. Then when the animation is underway the provided `from` and `to` CSS styles will be applied
+ * and spread across the transition and keyframe animation.
+ *
+ * ## What is returned
+ *
+ * `$animateCss` works in two stages: a preparation phase and an animation phase. Therefore when `$animateCss` is first called it will NOT actually
+ * start the animation. All that is going on here is that the element is being prepared for the animation (which means that the generated CSS classes are
+ * added and removed on the element). Once `$animateCss` is called it will return an object with the following properties:
+ *
+ * ```js
+ * var animator = $animateCss(element, { ... });
+ * ```
+ *
+ * Now what do the contents of our `animator` variable look like:
+ *
+ * ```js
+ * {
+ * // starts the animation
+ * start: Function,
+ *
+ * // ends (aborts) the animation
+ * end: Function
+ * }
+ * ```
+ *
+ * To actually start the animation we need to run `animation.start()` which will then return a promise that we can hook into to detect when the animation ends.
+ * If we choose not to run the animation then we MUST run `animation.end()` to perform a cleanup on the element (since some CSS classes and styles may have been
+ * applied to the element during the preparation phase). Note that all other properties such as duration, delay, transitions and keyframes are just properties
+ * and that changing them will not reconfigure the parameters of the animation.
+ *
+ * ### runner.done() vs runner.then()
+ * It is documented that `animation.start()` will return a promise object and this is true, however, there is also an additional method available on the
+ * runner called `.done(callbackFn)`. The done method works the same as `.finally(callbackFn)`, however, it does **not trigger a digest to occur**.
+ * Therefore, for performance reasons, it's always best to use `runner.done(callback)` instead of `runner.then()`, `runner.catch()` or `runner.finally()`
+ * unless you really need a digest to kick off afterwards.
+ *
+ * Keep in mind that, to make this easier, ngAnimate has tweaked the JS animations API to recognize when a runner instance is returned from $animateCss
+ * (so there is no need to call `runner.done(doneFn)` inside of your JavaScript animation code).
+ * Check the {@link ngAnimate.$animateCss#usage animation code above} to see how this works.
+ *
+ * @param {DOMElement} element the element that will be animated
+ * @param {object} options the animation-related options that will be applied during the animation
+ *
+ * * `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied
+ * to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.)
+ * * `structural` - Indicates that the `ng-` prefix will be added to the event class. Setting to `false` or omitting will turn `ng-EVENT` and
+ * `ng-EVENT-active` in `EVENT` and `EVENT-active`. Unused if `event` is omitted.
+ * * `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both).
+ * * `transitionStyle` - The raw CSS transition style that will be used (e.g. `1s linear all`).
+ * * `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`).
+ * * `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation.
+ * * `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition.
+ * * `addClass` - A space separated list of CSS classes that will be added to the element and spread across the animation.
+ * * `removeClass` - A space separated list of CSS classes that will be removed from the element and spread across the animation.
+ * * `duration` - A number value representing the total duration of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `0`
+ * is provided then the animation will be skipped entirely.
+ * * `delay` - A number value representing the total delay of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `true` is
+ * used then whatever delay value is detected from the CSS classes will be mirrored on the elements styles (e.g. by setting delay true then the style value
+ * of the element will be `transition-delay: DETECTED_VALUE`). Using `true` is useful when you want the CSS classes and inline styles to all share the same
+ * CSS delay value.
+ * * `stagger` - A numeric time value representing the delay between successively animated elements
+ * ({@link ngAnimate#css-staggering-animations Click here to learn how CSS-based staggering works in ngAnimate.})
+ * * `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a
+ * `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`)
+ * * `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occurring on the classes being added and removed.)
+ * * `cleanupStyles` - Whether or not the provided `from` and `to` styles will be removed once
+ * the animation is closed. This is useful for when the styles are used purely for the sake of
+ * the animation and do not have a lasting visual effect on the element (e.g. a collapse and open animation).
+ * By default this value is set to `false`.
+ *
+ * @return {object} an object with start and end methods and details about the animation.
+ *
+ * * `start` - The method to start the animation. This will return a `Promise` when called.
+ * * `end` - This method will cancel the animation and remove all applied CSS classes and styles.
+ */
+var ONE_SECOND = 1000;
+var BASE_TEN = 10;
+
+var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;
+var CLOSING_TIME_BUFFER = 1.5;
+
+var DETECT_CSS_PROPERTIES = {
+ transitionDuration: TRANSITION_DURATION_PROP,
+ transitionDelay: TRANSITION_DELAY_PROP,
+ transitionProperty: TRANSITION_PROP + PROPERTY_KEY,
+ animationDuration: ANIMATION_DURATION_PROP,
+ animationDelay: ANIMATION_DELAY_PROP,
+ animationIterationCount: ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY
+};
+
+var DETECT_STAGGER_CSS_PROPERTIES = {
+ transitionDuration: TRANSITION_DURATION_PROP,
+ transitionDelay: TRANSITION_DELAY_PROP,
+ animationDuration: ANIMATION_DURATION_PROP,
+ animationDelay: ANIMATION_DELAY_PROP
+};
+
+function getCssKeyframeDurationStyle(duration) {
+ return [ANIMATION_DURATION_PROP, duration + 's'];
+}
+
+function getCssDelayStyle(delay, isKeyframeAnimation) {
+ var prop = isKeyframeAnimation ? ANIMATION_DELAY_PROP : TRANSITION_DELAY_PROP;
+ return [prop, delay + 's'];
+}
+
+function computeCssStyles($window, element, properties) {
+ var styles = Object.create(null);
+ var detectedStyles = $window.getComputedStyle(element) || {};
+ forEach(properties, function(formalStyleName, actualStyleName) {
+ var val = detectedStyles[formalStyleName];
+ if (val) {
+ var c = val.charAt(0);
+
+ // only numerical-based values have a negative sign or digit as the first value
+ if (c === '-' || c === '+' || c >= 0) {
+ val = parseMaxTime(val);
+ }
+
+ // by setting this to null in the event that the delay is not set or is set directly as 0
+ // then we can still allow for negative values to be used later on and not mistake this
+ // value for being greater than any other negative value.
+ if (val === 0) {
+ val = null;
+ }
+ styles[actualStyleName] = val;
+ }
+ });
+
+ return styles;
+}
+
+function parseMaxTime(str) {
+ var maxValue = 0;
+ var values = str.split(/\s*,\s*/);
+ forEach(values, function(value) {
+ // it's always safe to consider only second values and omit `ms` values since
+ // getComputedStyle will always handle the conversion for us
+ if (value.charAt(value.length - 1) == 's') {
+ value = value.substring(0, value.length - 1);
+ }
+ value = parseFloat(value) || 0;
+ maxValue = maxValue ? Math.max(value, maxValue) : value;
+ });
+ return maxValue;
+}
+
+function truthyTimingValue(val) {
+ return val === 0 || val != null;
+}
+
+function getCssTransitionDurationStyle(duration, applyOnlyDuration) {
+ var style = TRANSITION_PROP;
+ var value = duration + 's';
+ if (applyOnlyDuration) {
+ style += DURATION_KEY;
+ } else {
+ value += ' linear all';
+ }
+ return [style, value];
+}
+
+function createLocalCacheLookup() {
+ var cache = Object.create(null);
+ return {
+ flush: function() {
+ cache = Object.create(null);
+ },
+
+ count: function(key) {
+ var entry = cache[key];
+ return entry ? entry.total : 0;
+ },
+
+ get: function(key) {
+ var entry = cache[key];
+ return entry && entry.value;
+ },
+
+ put: function(key, value) {
+ if (!cache[key]) {
+ cache[key] = { total: 1, value: value };
+ } else {
+ cache[key].total++;
+ }
+ }
+ };
+}
+
+// we do not reassign an already present style value since
+// if we detect the style property value again we may be
+// detecting styles that were added via the `from` styles.
+// We make use of `isDefined` here since an empty string
+// or null value (which is what getPropertyValue will return
+// for a non-existing style) will still be marked as a valid
+// value for the style (a falsy value implies that the style
+// is to be removed at the end of the animation). If we had a simple
+// "OR" statement then it would not be enough to catch that.
+function registerRestorableStyles(backup, node, properties) {
+ forEach(properties, function(prop) {
+ backup[prop] = isDefined(backup[prop])
+ ? backup[prop]
+ : node.style.getPropertyValue(prop);
+ });
+}
+
+var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
+ var gcsLookup = createLocalCacheLookup();
+ var gcsStaggerLookup = createLocalCacheLookup();
+
+ this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout',
+ '$$forceReflow', '$sniffer', '$$rAFScheduler', '$$animateQueue',
+ function($window, $$jqLite, $$AnimateRunner, $timeout,
+ $$forceReflow, $sniffer, $$rAFScheduler, $$animateQueue) {
+
+ var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+
+ var parentCounter = 0;
+ function gcsHashFn(node, extraClasses) {
+ var KEY = "$$ngAnimateParentKey";
+ var parentNode = node.parentNode;
+ var parentID = parentNode[KEY] || (parentNode[KEY] = ++parentCounter);
+ return parentID + '-' + node.getAttribute('class') + '-' + extraClasses;
+ }
+
+ function computeCachedCssStyles(node, className, cacheKey, properties) {
+ var timings = gcsLookup.get(cacheKey);
+
+ if (!timings) {
+ timings = computeCssStyles($window, node, properties);
+ if (timings.animationIterationCount === 'infinite') {
+ timings.animationIterationCount = 1;
+ }
+ }
+
+ // we keep putting this in multiple times even though the value and the cacheKey are the same
+ // because we're keeping an internal tally of how many duplicate animations are detected.
+ gcsLookup.put(cacheKey, timings);
+ return timings;
+ }
+
+ function computeCachedCssStaggerStyles(node, className, cacheKey, properties) {
+ var stagger;
+
+ // if we have one or more existing matches of matching elements
+ // containing the same parent + CSS styles (which is how cacheKey works)
+ // then staggering is possible
+ if (gcsLookup.count(cacheKey) > 0) {
+ stagger = gcsStaggerLookup.get(cacheKey);
+
+ if (!stagger) {
+ var staggerClassName = pendClasses(className, '-stagger');
+
+ $$jqLite.addClass(node, staggerClassName);
+
+ stagger = computeCssStyles($window, node, properties);
+
+ // force the conversion of a null value to zero incase not set
+ stagger.animationDuration = Math.max(stagger.animationDuration, 0);
+ stagger.transitionDuration = Math.max(stagger.transitionDuration, 0);
+
+ $$jqLite.removeClass(node, staggerClassName);
+
+ gcsStaggerLookup.put(cacheKey, stagger);
+ }
+ }
+
+ return stagger || {};
+ }
+
+ var cancelLastRAFRequest;
+ var rafWaitQueue = [];
+ function waitUntilQuiet(callback) {
+ rafWaitQueue.push(callback);
+ $$rAFScheduler.waitUntilQuiet(function() {
+ gcsLookup.flush();
+ gcsStaggerLookup.flush();
+
+ // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable.
+ // PLEASE EXAMINE THE `$$forceReflow` service to understand why.
+ var pageWidth = $$forceReflow();
+
+ // we use a for loop to ensure that if the queue is changed
+ // during this looping then it will consider new requests
+ for (var i = 0; i < rafWaitQueue.length; i++) {
+ rafWaitQueue[i](pageWidth);
+ }
+ rafWaitQueue.length = 0;
+ });
+ }
+
+ function computeTimings(node, className, cacheKey) {
+ var timings = computeCachedCssStyles(node, className, cacheKey, DETECT_CSS_PROPERTIES);
+ var aD = timings.animationDelay;
+ var tD = timings.transitionDelay;
+ timings.maxDelay = aD && tD
+ ? Math.max(aD, tD)
+ : (aD || tD);
+ timings.maxDuration = Math.max(
+ timings.animationDuration * timings.animationIterationCount,
+ timings.transitionDuration);
+
+ return timings;
+ }
+
+ return function init(element, initialOptions) {
+ // all of the animation functions should create
+ // a copy of the options data, however, if a
+ // parent service has already created a copy then
+ // we should stick to using that
+ var options = initialOptions || {};
+ if (!options.$$prepared) {
+ options = prepareAnimationOptions(copy(options));
+ }
+
+ var restoreStyles = {};
+ var node = getDomNode(element);
+ if (!node
+ || !node.parentNode
+ || !$$animateQueue.enabled()) {
+ return closeAndReturnNoopAnimator();
+ }
+
+ var temporaryStyles = [];
+ var classes = element.attr('class');
+ var styles = packageStyles(options);
+ var animationClosed;
+ var animationPaused;
+ var animationCompleted;
+ var runner;
+ var runnerHost;
+ var maxDelay;
+ var maxDelayTime;
+ var maxDuration;
+ var maxDurationTime;
+ var startTime;
+ var events = [];
+
+ if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) {
+ return closeAndReturnNoopAnimator();
+ }
+
+ var method = options.event && isArray(options.event)
+ ? options.event.join(' ')
+ : options.event;
+
+ var isStructural = method && options.structural;
+ var structuralClassName = '';
+ var addRemoveClassName = '';
+
+ if (isStructural) {
+ structuralClassName = pendClasses(method, EVENT_CLASS_PREFIX, true);
+ } else if (method) {
+ structuralClassName = method;
+ }
+
+ if (options.addClass) {
+ addRemoveClassName += pendClasses(options.addClass, ADD_CLASS_SUFFIX);
+ }
+
+ if (options.removeClass) {
+ if (addRemoveClassName.length) {
+ addRemoveClassName += ' ';
+ }
+ addRemoveClassName += pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX);
+ }
+
+ // there may be a situation where a structural animation is combined together
+ // with CSS classes that need to resolve before the animation is computed.
+ // However this means that there is no explicit CSS code to block the animation
+ // from happening (by setting 0s none in the class name). If this is the case
+ // we need to apply the classes before the first rAF so we know to continue if
+ // there actually is a detected transition or keyframe animation
+ if (options.applyClassesEarly && addRemoveClassName.length) {
+ applyAnimationClasses(element, options);
+ }
+
+ var preparationClasses = [structuralClassName, addRemoveClassName].join(' ').trim();
+ var fullClassName = classes + ' ' + preparationClasses;
+ var activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX);
+ var hasToStyles = styles.to && Object.keys(styles.to).length > 0;
+ var containsKeyframeAnimation = (options.keyframeStyle || '').length > 0;
+
+ // there is no way we can trigger an animation if no styles and
+ // no classes are being applied which would then trigger a transition,
+ // unless there a is raw keyframe value that is applied to the element.
+ if (!containsKeyframeAnimation
+ && !hasToStyles
+ && !preparationClasses) {
+ return closeAndReturnNoopAnimator();
+ }
+
+ var cacheKey, stagger;
+ if (options.stagger > 0) {
+ var staggerVal = parseFloat(options.stagger);
+ stagger = {
+ transitionDelay: staggerVal,
+ animationDelay: staggerVal,
+ transitionDuration: 0,
+ animationDuration: 0
+ };
+ } else {
+ cacheKey = gcsHashFn(node, fullClassName);
+ stagger = computeCachedCssStaggerStyles(node, preparationClasses, cacheKey, DETECT_STAGGER_CSS_PROPERTIES);
+ }
+
+ if (!options.$$skipPreparationClasses) {
+ $$jqLite.addClass(element, preparationClasses);
+ }
+
+ var applyOnlyDuration;
+
+ if (options.transitionStyle) {
+ var transitionStyle = [TRANSITION_PROP, options.transitionStyle];
+ applyInlineStyle(node, transitionStyle);
+ temporaryStyles.push(transitionStyle);
+ }
+
+ if (options.duration >= 0) {
+ applyOnlyDuration = node.style[TRANSITION_PROP].length > 0;
+ var durationStyle = getCssTransitionDurationStyle(options.duration, applyOnlyDuration);
+
+ // we set the duration so that it will be picked up by getComputedStyle later
+ applyInlineStyle(node, durationStyle);
+ temporaryStyles.push(durationStyle);
+ }
+
+ if (options.keyframeStyle) {
+ var keyframeStyle = [ANIMATION_PROP, options.keyframeStyle];
+ applyInlineStyle(node, keyframeStyle);
+ temporaryStyles.push(keyframeStyle);
+ }
+
+ var itemIndex = stagger
+ ? options.staggerIndex >= 0
+ ? options.staggerIndex
+ : gcsLookup.count(cacheKey)
+ : 0;
+
+ var isFirst = itemIndex === 0;
+
+ // this is a pre-emptive way of forcing the setup classes to be added and applied INSTANTLY
+ // without causing any combination of transitions to kick in. By adding a negative delay value
+ // it forces the setup class' transition to end immediately. We later then remove the negative
+ // transition delay to allow for the transition to naturally do it's thing. The beauty here is
+ // that if there is no transition defined then nothing will happen and this will also allow
+ // other transitions to be stacked on top of each other without any chopping them out.
+ if (isFirst && !options.skipBlocking) {
+ blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE);
+ }
+
+ var timings = computeTimings(node, fullClassName, cacheKey);
+ var relativeDelay = timings.maxDelay;
+ maxDelay = Math.max(relativeDelay, 0);
+ maxDuration = timings.maxDuration;
+
+ var flags = {};
+ flags.hasTransitions = timings.transitionDuration > 0;
+ flags.hasAnimations = timings.animationDuration > 0;
+ flags.hasTransitionAll = flags.hasTransitions && timings.transitionProperty == 'all';
+ flags.applyTransitionDuration = hasToStyles && (
+ (flags.hasTransitions && !flags.hasTransitionAll)
+ || (flags.hasAnimations && !flags.hasTransitions));
+ flags.applyAnimationDuration = options.duration && flags.hasAnimations;
+ flags.applyTransitionDelay = truthyTimingValue(options.delay) && (flags.applyTransitionDuration || flags.hasTransitions);
+ flags.applyAnimationDelay = truthyTimingValue(options.delay) && flags.hasAnimations;
+ flags.recalculateTimingStyles = addRemoveClassName.length > 0;
+
+ if (flags.applyTransitionDuration || flags.applyAnimationDuration) {
+ maxDuration = options.duration ? parseFloat(options.duration) : maxDuration;
+
+ if (flags.applyTransitionDuration) {
+ flags.hasTransitions = true;
+ timings.transitionDuration = maxDuration;
+ applyOnlyDuration = node.style[TRANSITION_PROP + PROPERTY_KEY].length > 0;
+ temporaryStyles.push(getCssTransitionDurationStyle(maxDuration, applyOnlyDuration));
+ }
+
+ if (flags.applyAnimationDuration) {
+ flags.hasAnimations = true;
+ timings.animationDuration = maxDuration;
+ temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration));
+ }
+ }
+
+ if (maxDuration === 0 && !flags.recalculateTimingStyles) {
+ return closeAndReturnNoopAnimator();
+ }
+
+ if (options.delay != null) {
+ var delayStyle;
+ if (typeof options.delay !== "boolean") {
+ delayStyle = parseFloat(options.delay);
+ // number in options.delay means we have to recalculate the delay for the closing timeout
+ maxDelay = Math.max(delayStyle, 0);
+ }
+
+ if (flags.applyTransitionDelay) {
+ temporaryStyles.push(getCssDelayStyle(delayStyle));
+ }
+
+ if (flags.applyAnimationDelay) {
+ temporaryStyles.push(getCssDelayStyle(delayStyle, true));
+ }
+ }
+
+ // we need to recalculate the delay value since we used a pre-emptive negative
+ // delay value and the delay value is required for the final event checking. This
+ // property will ensure that this will happen after the RAF phase has passed.
+ if (options.duration == null && timings.transitionDuration > 0) {
+ flags.recalculateTimingStyles = flags.recalculateTimingStyles || isFirst;
+ }
+
+ maxDelayTime = maxDelay * ONE_SECOND;
+ maxDurationTime = maxDuration * ONE_SECOND;
+ if (!options.skipBlocking) {
+ flags.blockTransition = timings.transitionDuration > 0;
+ flags.blockKeyframeAnimation = timings.animationDuration > 0 &&
+ stagger.animationDelay > 0 &&
+ stagger.animationDuration === 0;
+ }
+
+ if (options.from) {
+ if (options.cleanupStyles) {
+ registerRestorableStyles(restoreStyles, node, Object.keys(options.from));
+ }
+ applyAnimationFromStyles(element, options);
+ }
+
+ if (flags.blockTransition || flags.blockKeyframeAnimation) {
+ applyBlocking(maxDuration);
+ } else if (!options.skipBlocking) {
+ blockTransitions(node, false);
+ }
+
+ // TODO(matsko): for 1.5 change this code to have an animator object for better debugging
+ return {
+ $$willAnimate: true,
+ end: endFn,
+ start: function() {
+ if (animationClosed) return;
+
+ runnerHost = {
+ end: endFn,
+ cancel: cancelFn,
+ resume: null, //this will be set during the start() phase
+ pause: null
+ };
+
+ runner = new $$AnimateRunner(runnerHost);
+
+ waitUntilQuiet(start);
+
+ // we don't have access to pause/resume the animation
+ // since it hasn't run yet. AnimateRunner will therefore
+ // set noop functions for resume and pause and they will
+ // later be overridden once the animation is triggered
+ return runner;
+ }
+ };
+
+ function endFn() {
+ close();
+ }
+
+ function cancelFn() {
+ close(true);
+ }
+
+ function close(rejected) { // jshint ignore:line
+ // if the promise has been called already then we shouldn't close
+ // the animation again
+ if (animationClosed || (animationCompleted && animationPaused)) return;
+ animationClosed = true;
+ animationPaused = false;
+
+ if (!options.$$skipPreparationClasses) {
+ $$jqLite.removeClass(element, preparationClasses);
+ }
+ $$jqLite.removeClass(element, activeClasses);
+
+ blockKeyframeAnimations(node, false);
+ blockTransitions(node, false);
+
+ forEach(temporaryStyles, function(entry) {
+ // There is only one way to remove inline style properties entirely from elements.
+ // By using `removeProperty` this works, but we need to convert camel-cased CSS
+ // styles down to hyphenated values.
+ node.style[entry[0]] = '';
+ });
+
+ applyAnimationClasses(element, options);
+ applyAnimationStyles(element, options);
+
+ if (Object.keys(restoreStyles).length) {
+ forEach(restoreStyles, function(value, prop) {
+ value ? node.style.setProperty(prop, value)
+ : node.style.removeProperty(prop);
+ });
+ }
+
+ // the reason why we have this option is to allow a synchronous closing callback
+ // that is fired as SOON as the animation ends (when the CSS is removed) or if
+ // the animation never takes off at all. A good example is a leave animation since
+ // the element must be removed just after the animation is over or else the element
+ // will appear on screen for one animation frame causing an overbearing flicker.
+ if (options.onDone) {
+ options.onDone();
+ }
+
+ if (events && events.length) {
+ // Remove the transitionend / animationend listener(s)
+ element.off(events.join(' '), onAnimationProgress);
+ }
+
+ //Cancel the fallback closing timeout and remove the timer data
+ var animationTimerData = element.data(ANIMATE_TIMER_KEY);
+ if (animationTimerData) {
+ $timeout.cancel(animationTimerData[0].timer);
+ element.removeData(ANIMATE_TIMER_KEY);
+ }
+
+ // if the preparation function fails then the promise is not setup
+ if (runner) {
+ runner.complete(!rejected);
+ }
+ }
+
+ function applyBlocking(duration) {
+ if (flags.blockTransition) {
+ blockTransitions(node, duration);
+ }
+
+ if (flags.blockKeyframeAnimation) {
+ blockKeyframeAnimations(node, !!duration);
+ }
+ }
+
+ function closeAndReturnNoopAnimator() {
+ runner = new $$AnimateRunner({
+ end: endFn,
+ cancel: cancelFn
+ });
+
+ // should flush the cache animation
+ waitUntilQuiet(noop);
+ close();
+
+ return {
+ $$willAnimate: false,
+ start: function() {
+ return runner;
+ },
+ end: endFn
+ };
+ }
+
+ function onAnimationProgress(event) {
+ event.stopPropagation();
+ var ev = event.originalEvent || event;
+
+ // we now always use `Date.now()` due to the recent changes with
+ // event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info)
+ var timeStamp = ev.$manualTimeStamp || Date.now();
+
+ /* Firefox (or possibly just Gecko) likes to not round values up
+ * when a ms measurement is used for the animation */
+ var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));
+
+ /* $manualTimeStamp is a mocked timeStamp value which is set
+ * within browserTrigger(). This is only here so that tests can
+ * mock animations properly. Real events fallback to event.timeStamp,
+ * or, if they don't, then a timeStamp is automatically created for them.
+ * We're checking to see if the timeStamp surpasses the expected delay,
+ * but we're using elapsedTime instead of the timeStamp on the 2nd
+ * pre-condition since animationPauseds sometimes close off early */
+ if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) {
+ // we set this flag to ensure that if the transition is paused then, when resumed,
+ // the animation will automatically close itself since transitions cannot be paused.
+ animationCompleted = true;
+ close();
+ }
+ }
+
+ function start() {
+ if (animationClosed) return;
+ if (!node.parentNode) {
+ close();
+ return;
+ }
+
+ // even though we only pause keyframe animations here the pause flag
+ // will still happen when transitions are used. Only the transition will
+ // not be paused since that is not possible. If the animation ends when
+ // paused then it will not complete until unpaused or cancelled.
+ var playPause = function(playAnimation) {
+ if (!animationCompleted) {
+ animationPaused = !playAnimation;
+ if (timings.animationDuration) {
+ var value = blockKeyframeAnimations(node, animationPaused);
+ animationPaused
+ ? temporaryStyles.push(value)
+ : removeFromArray(temporaryStyles, value);
+ }
+ } else if (animationPaused && playAnimation) {
+ animationPaused = false;
+ close();
+ }
+ };
+
+ // checking the stagger duration prevents an accidentally cascade of the CSS delay style
+ // being inherited from the parent. If the transition duration is zero then we can safely
+ // rely that the delay value is an intentional stagger delay style.
+ var maxStagger = itemIndex > 0
+ && ((timings.transitionDuration && stagger.transitionDuration === 0) ||
+ (timings.animationDuration && stagger.animationDuration === 0))
+ && Math.max(stagger.animationDelay, stagger.transitionDelay);
+ if (maxStagger) {
+ $timeout(triggerAnimationStart,
+ Math.floor(maxStagger * itemIndex * ONE_SECOND),
+ false);
+ } else {
+ triggerAnimationStart();
+ }
+
+ // this will decorate the existing promise runner with pause/resume methods
+ runnerHost.resume = function() {
+ playPause(true);
+ };
+
+ runnerHost.pause = function() {
+ playPause(false);
+ };
+
+ function triggerAnimationStart() {
+ // just incase a stagger animation kicks in when the animation
+ // itself was cancelled entirely
+ if (animationClosed) return;
+
+ applyBlocking(false);
+
+ forEach(temporaryStyles, function(entry) {
+ var key = entry[0];
+ var value = entry[1];
+ node.style[key] = value;
+ });
+
+ applyAnimationClasses(element, options);
+ $$jqLite.addClass(element, activeClasses);
+
+ if (flags.recalculateTimingStyles) {
+ fullClassName = node.className + ' ' + preparationClasses;
+ cacheKey = gcsHashFn(node, fullClassName);
+
+ timings = computeTimings(node, fullClassName, cacheKey);
+ relativeDelay = timings.maxDelay;
+ maxDelay = Math.max(relativeDelay, 0);
+ maxDuration = timings.maxDuration;
+
+ if (maxDuration === 0) {
+ close();
+ return;
+ }
+
+ flags.hasTransitions = timings.transitionDuration > 0;
+ flags.hasAnimations = timings.animationDuration > 0;
+ }
+
+ if (flags.applyAnimationDelay) {
+ relativeDelay = typeof options.delay !== "boolean" && truthyTimingValue(options.delay)
+ ? parseFloat(options.delay)
+ : relativeDelay;
+
+ maxDelay = Math.max(relativeDelay, 0);
+ timings.animationDelay = relativeDelay;
+ delayStyle = getCssDelayStyle(relativeDelay, true);
+ temporaryStyles.push(delayStyle);
+ node.style[delayStyle[0]] = delayStyle[1];
+ }
+
+ maxDelayTime = maxDelay * ONE_SECOND;
+ maxDurationTime = maxDuration * ONE_SECOND;
+
+ if (options.easing) {
+ var easeProp, easeVal = options.easing;
+ if (flags.hasTransitions) {
+ easeProp = TRANSITION_PROP + TIMING_KEY;
+ temporaryStyles.push([easeProp, easeVal]);
+ node.style[easeProp] = easeVal;
+ }
+ if (flags.hasAnimations) {
+ easeProp = ANIMATION_PROP + TIMING_KEY;
+ temporaryStyles.push([easeProp, easeVal]);
+ node.style[easeProp] = easeVal;
+ }
+ }
+
+ if (timings.transitionDuration) {
+ events.push(TRANSITIONEND_EVENT);
+ }
+
+ if (timings.animationDuration) {
+ events.push(ANIMATIONEND_EVENT);
+ }
+
+ startTime = Date.now();
+ var timerTime = maxDelayTime + CLOSING_TIME_BUFFER * maxDurationTime;
+ var endTime = startTime + timerTime;
+
+ var animationsData = element.data(ANIMATE_TIMER_KEY) || [];
+ var setupFallbackTimer = true;
+ if (animationsData.length) {
+ var currentTimerData = animationsData[0];
+ setupFallbackTimer = endTime > currentTimerData.expectedEndTime;
+ if (setupFallbackTimer) {
+ $timeout.cancel(currentTimerData.timer);
+ } else {
+ animationsData.push(close);
+ }
+ }
+
+ if (setupFallbackTimer) {
+ var timer = $timeout(onAnimationExpired, timerTime, false);
+ animationsData[0] = {
+ timer: timer,
+ expectedEndTime: endTime
+ };
+ animationsData.push(close);
+ element.data(ANIMATE_TIMER_KEY, animationsData);
+ }
+
+ if (events.length) {
+ element.on(events.join(' '), onAnimationProgress);
+ }
+
+ if (options.to) {
+ if (options.cleanupStyles) {
+ registerRestorableStyles(restoreStyles, node, Object.keys(options.to));
+ }
+ applyAnimationToStyles(element, options);
+ }
+ }
+
+ function onAnimationExpired() {
+ var animationsData = element.data(ANIMATE_TIMER_KEY);
+
+ // this will be false in the event that the element was
+ // removed from the DOM (via a leave animation or something
+ // similar)
+ if (animationsData) {
+ for (var i = 1; i < animationsData.length; i++) {
+ animationsData[i]();
+ }
+ element.removeData(ANIMATE_TIMER_KEY);
+ }
+ }
+ }
+ };
+ }];
+}];
+
+var $$AnimateCssDriverProvider = ['$$animationProvider', function($$animationProvider) {
+ $$animationProvider.drivers.push('$$animateCssDriver');
+
+ var NG_ANIMATE_SHIM_CLASS_NAME = 'ng-animate-shim';
+ var NG_ANIMATE_ANCHOR_CLASS_NAME = 'ng-anchor';
+
+ var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out';
+ var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in';
+
+ function isDocumentFragment(node) {
+ return node.parentNode && node.parentNode.nodeType === 11;
+ }
+
+ this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$sniffer', '$$jqLite', '$document',
+ function($animateCss, $rootScope, $$AnimateRunner, $rootElement, $sniffer, $$jqLite, $document) {
+
+ // only browsers that support these properties can render animations
+ if (!$sniffer.animations && !$sniffer.transitions) return noop;
+
+ var bodyNode = $document[0].body;
+ var rootNode = getDomNode($rootElement);
+
+ var rootBodyElement = jqLite(
+ // this is to avoid using something that exists outside of the body
+ // we also special case the doc fragment case because our unit test code
+ // appends the $rootElement to the body after the app has been bootstrapped
+ isDocumentFragment(rootNode) || bodyNode.contains(rootNode) ? rootNode : bodyNode
+ );
+
+ var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+
+ return function initDriverFn(animationDetails) {
+ return animationDetails.from && animationDetails.to
+ ? prepareFromToAnchorAnimation(animationDetails.from,
+ animationDetails.to,
+ animationDetails.classes,
+ animationDetails.anchors)
+ : prepareRegularAnimation(animationDetails);
+ };
+
+ function filterCssClasses(classes) {
+ //remove all the `ng-` stuff
+ return classes.replace(/\bng-\S+\b/g, '');
+ }
+
+ function getUniqueValues(a, b) {
+ if (isString(a)) a = a.split(' ');
+ if (isString(b)) b = b.split(' ');
+ return a.filter(function(val) {
+ return b.indexOf(val) === -1;
+ }).join(' ');
+ }
+
+ function prepareAnchoredAnimation(classes, outAnchor, inAnchor) {
+ var clone = jqLite(getDomNode(outAnchor).cloneNode(true));
+ var startingClasses = filterCssClasses(getClassVal(clone));
+
+ outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);
+ inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);
+
+ clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME);
+
+ rootBodyElement.append(clone);
+
+ var animatorIn, animatorOut = prepareOutAnimation();
+
+ // the user may not end up using the `out` animation and
+ // only making use of the `in` animation or vice-versa.
+ // In either case we should allow this and not assume the
+ // animation is over unless both animations are not used.
+ if (!animatorOut) {
+ animatorIn = prepareInAnimation();
+ if (!animatorIn) {
+ return end();
+ }
+ }
+
+ var startingAnimator = animatorOut || animatorIn;
+
+ return {
+ start: function() {
+ var runner;
+
+ var currentAnimation = startingAnimator.start();
+ currentAnimation.done(function() {
+ currentAnimation = null;
+ if (!animatorIn) {
+ animatorIn = prepareInAnimation();
+ if (animatorIn) {
+ currentAnimation = animatorIn.start();
+ currentAnimation.done(function() {
+ currentAnimation = null;
+ end();
+ runner.complete();
+ });
+ return currentAnimation;
+ }
+ }
+ // in the event that there is no `in` animation
+ end();
+ runner.complete();
+ });
+
+ runner = new $$AnimateRunner({
+ end: endFn,
+ cancel: endFn
+ });
+
+ return runner;
+
+ function endFn() {
+ if (currentAnimation) {
+ currentAnimation.end();
+ }
+ }
+ }
+ };
+
+ function calculateAnchorStyles(anchor) {
+ var styles = {};
+
+ var coords = getDomNode(anchor).getBoundingClientRect();
+
+ // we iterate directly since safari messes up and doesn't return
+ // all the keys for the coords object when iterated
+ forEach(['width','height','top','left'], function(key) {
+ var value = coords[key];
+ switch (key) {
+ case 'top':
+ value += bodyNode.scrollTop;
+ break;
+ case 'left':
+ value += bodyNode.scrollLeft;
+ break;
+ }
+ styles[key] = Math.floor(value) + 'px';
+ });
+ return styles;
+ }
+
+ function prepareOutAnimation() {
+ var animator = $animateCss(clone, {
+ addClass: NG_OUT_ANCHOR_CLASS_NAME,
+ delay: true,
+ from: calculateAnchorStyles(outAnchor)
+ });
+
+ // read the comment within `prepareRegularAnimation` to understand
+ // why this check is necessary
+ return animator.$$willAnimate ? animator : null;
+ }
+
+ function getClassVal(element) {
+ return element.attr('class') || '';
+ }
+
+ function prepareInAnimation() {
+ var endingClasses = filterCssClasses(getClassVal(inAnchor));
+ var toAdd = getUniqueValues(endingClasses, startingClasses);
+ var toRemove = getUniqueValues(startingClasses, endingClasses);
+
+ var animator = $animateCss(clone, {
+ to: calculateAnchorStyles(inAnchor),
+ addClass: NG_IN_ANCHOR_CLASS_NAME + ' ' + toAdd,
+ removeClass: NG_OUT_ANCHOR_CLASS_NAME + ' ' + toRemove,
+ delay: true
+ });
+
+ // read the comment within `prepareRegularAnimation` to understand
+ // why this check is necessary
+ return animator.$$willAnimate ? animator : null;
+ }
+
+ function end() {
+ clone.remove();
+ outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);
+ inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);
+ }
+ }
+
+ function prepareFromToAnchorAnimation(from, to, classes, anchors) {
+ var fromAnimation = prepareRegularAnimation(from, noop);
+ var toAnimation = prepareRegularAnimation(to, noop);
+
+ var anchorAnimations = [];
+ forEach(anchors, function(anchor) {
+ var outElement = anchor['out'];
+ var inElement = anchor['in'];
+ var animator = prepareAnchoredAnimation(classes, outElement, inElement);
+ if (animator) {
+ anchorAnimations.push(animator);
+ }
+ });
+
+ // no point in doing anything when there are no elements to animate
+ if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return;
+
+ return {
+ start: function() {
+ var animationRunners = [];
+
+ if (fromAnimation) {
+ animationRunners.push(fromAnimation.start());
+ }
+
+ if (toAnimation) {
+ animationRunners.push(toAnimation.start());
+ }
+
+ forEach(anchorAnimations, function(animation) {
+ animationRunners.push(animation.start());
+ });
+
+ var runner = new $$AnimateRunner({
+ end: endFn,
+ cancel: endFn // CSS-driven animations cannot be cancelled, only ended
+ });
+
+ $$AnimateRunner.all(animationRunners, function(status) {
+ runner.complete(status);
+ });
+
+ return runner;
+
+ function endFn() {
+ forEach(animationRunners, function(runner) {
+ runner.end();
+ });
+ }
+ }
+ };
+ }
+
+ function prepareRegularAnimation(animationDetails) {
+ var element = animationDetails.element;
+ var options = animationDetails.options || {};
+
+ if (animationDetails.structural) {
+ options.event = animationDetails.event;
+ options.structural = true;
+ options.applyClassesEarly = true;
+
+ // we special case the leave animation since we want to ensure that
+ // the element is removed as soon as the animation is over. Otherwise
+ // a flicker might appear or the element may not be removed at all
+ if (animationDetails.event === 'leave') {
+ options.onDone = options.domOperation;
+ }
+ }
+
+ // We assign the preparationClasses as the actual animation event since
+ // the internals of $animateCss will just suffix the event token values
+ // with `-active` to trigger the animation.
+ if (options.preparationClasses) {
+ options.event = concatWithSpace(options.event, options.preparationClasses);
+ }
+
+ var animator = $animateCss(element, options);
+
+ // the driver lookup code inside of $$animation attempts to spawn a
+ // driver one by one until a driver returns a.$$willAnimate animator object.
+ // $animateCss will always return an object, however, it will pass in
+ // a flag as a hint as to whether an animation was detected or not
+ return animator.$$willAnimate ? animator : null;
+ }
+ }];
+}];
+
+// TODO(matsko): use caching here to speed things up for detection
+// TODO(matsko): add documentation
+// by the time...
+
+var $$AnimateJsProvider = ['$animateProvider', function($animateProvider) {
+ this.$get = ['$injector', '$$AnimateRunner', '$$jqLite',
+ function($injector, $$AnimateRunner, $$jqLite) {
+
+ var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+ // $animateJs(element, 'enter');
+ return function(element, event, classes, options) {
+ var animationClosed = false;
+
+ // the `classes` argument is optional and if it is not used
+ // then the classes will be resolved from the element's className
+ // property as well as options.addClass/options.removeClass.
+ if (arguments.length === 3 && isObject(classes)) {
+ options = classes;
+ classes = null;
+ }
+
+ options = prepareAnimationOptions(options);
+ if (!classes) {
+ classes = element.attr('class') || '';
+ if (options.addClass) {
+ classes += ' ' + options.addClass;
+ }
+ if (options.removeClass) {
+ classes += ' ' + options.removeClass;
+ }
+ }
+
+ var classesToAdd = options.addClass;
+ var classesToRemove = options.removeClass;
+
+ // the lookupAnimations function returns a series of animation objects that are
+ // matched up with one or more of the CSS classes. These animation objects are
+ // defined via the module.animation factory function. If nothing is detected then
+ // we don't return anything which then makes $animation query the next driver.
+ var animations = lookupAnimations(classes);
+ var before, after;
+ if (animations.length) {
+ var afterFn, beforeFn;
+ if (event == 'leave') {
+ beforeFn = 'leave';
+ afterFn = 'afterLeave'; // TODO(matsko): get rid of this
+ } else {
+ beforeFn = 'before' + event.charAt(0).toUpperCase() + event.substr(1);
+ afterFn = event;
+ }
+
+ if (event !== 'enter' && event !== 'move') {
+ before = packageAnimations(element, event, options, animations, beforeFn);
+ }
+ after = packageAnimations(element, event, options, animations, afterFn);
+ }
+
+ // no matching animations
+ if (!before && !after) return;
+
+ function applyOptions() {
+ options.domOperation();
+ applyAnimationClasses(element, options);
+ }
+
+ function close() {
+ animationClosed = true;
+ applyOptions();
+ applyAnimationStyles(element, options);
+ }
+
+ var runner;
+
+ return {
+ $$willAnimate: true,
+ end: function() {
+ if (runner) {
+ runner.end();
+ } else {
+ close();
+ runner = new $$AnimateRunner();
+ runner.complete(true);
+ }
+ return runner;
+ },
+ start: function() {
+ if (runner) {
+ return runner;
+ }
+
+ runner = new $$AnimateRunner();
+ var closeActiveAnimations;
+ var chain = [];
+
+ if (before) {
+ chain.push(function(fn) {
+ closeActiveAnimations = before(fn);
+ });
+ }
+
+ if (chain.length) {
+ chain.push(function(fn) {
+ applyOptions();
+ fn(true);
+ });
+ } else {
+ applyOptions();
+ }
+
+ if (after) {
+ chain.push(function(fn) {
+ closeActiveAnimations = after(fn);
+ });
+ }
+
+ runner.setHost({
+ end: function() {
+ endAnimations();
+ },
+ cancel: function() {
+ endAnimations(true);
+ }
+ });
+
+ $$AnimateRunner.chain(chain, onComplete);
+ return runner;
+
+ function onComplete(success) {
+ close(success);
+ runner.complete(success);
+ }
+
+ function endAnimations(cancelled) {
+ if (!animationClosed) {
+ (closeActiveAnimations || noop)(cancelled);
+ onComplete(cancelled);
+ }
+ }
+ }
+ };
+
+ function executeAnimationFn(fn, element, event, options, onDone) {
+ var args;
+ switch (event) {
+ case 'animate':
+ args = [element, options.from, options.to, onDone];
+ break;
+
+ case 'setClass':
+ args = [element, classesToAdd, classesToRemove, onDone];
+ break;
+
+ case 'addClass':
+ args = [element, classesToAdd, onDone];
+ break;
+
+ case 'removeClass':
+ args = [element, classesToRemove, onDone];
+ break;
+
+ default:
+ args = [element, onDone];
+ break;
+ }
+
+ args.push(options);
+
+ var value = fn.apply(fn, args);
+ if (value) {
+ if (isFunction(value.start)) {
+ value = value.start();
+ }
+
+ if (value instanceof $$AnimateRunner) {
+ value.done(onDone);
+ } else if (isFunction(value)) {
+ // optional onEnd / onCancel callback
+ return value;
+ }
+ }
+
+ return noop;
+ }
+
+ function groupEventedAnimations(element, event, options, animations, fnName) {
+ var operations = [];
+ forEach(animations, function(ani) {
+ var animation = ani[fnName];
+ if (!animation) return;
+
+ // note that all of these animations will run in parallel
+ operations.push(function() {
+ var runner;
+ var endProgressCb;
+
+ var resolved = false;
+ var onAnimationComplete = function(rejected) {
+ if (!resolved) {
+ resolved = true;
+ (endProgressCb || noop)(rejected);
+ runner.complete(!rejected);
+ }
+ };
+
+ runner = new $$AnimateRunner({
+ end: function() {
+ onAnimationComplete();
+ },
+ cancel: function() {
+ onAnimationComplete(true);
+ }
+ });
+
+ endProgressCb = executeAnimationFn(animation, element, event, options, function(result) {
+ var cancelled = result === false;
+ onAnimationComplete(cancelled);
+ });
+
+ return runner;
+ });
+ });
+
+ return operations;
+ }
+
+ function packageAnimations(element, event, options, animations, fnName) {
+ var operations = groupEventedAnimations(element, event, options, animations, fnName);
+ if (operations.length === 0) {
+ var a,b;
+ if (fnName === 'beforeSetClass') {
+ a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass');
+ b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass');
+ } else if (fnName === 'setClass') {
+ a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass');
+ b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass');
+ }
+
+ if (a) {
+ operations = operations.concat(a);
+ }
+ if (b) {
+ operations = operations.concat(b);
+ }
+ }
+
+ if (operations.length === 0) return;
+
+ // TODO(matsko): add documentation
+ return function startAnimation(callback) {
+ var runners = [];
+ if (operations.length) {
+ forEach(operations, function(animateFn) {
+ runners.push(animateFn());
+ });
+ }
+
+ runners.length ? $$AnimateRunner.all(runners, callback) : callback();
+
+ return function endFn(reject) {
+ forEach(runners, function(runner) {
+ reject ? runner.cancel() : runner.end();
+ });
+ };
+ };
+ }
+ };
+
+ function lookupAnimations(classes) {
+ classes = isArray(classes) ? classes : classes.split(' ');
+ var matches = [], flagMap = {};
+ for (var i=0; i < classes.length; i++) {
+ var klass = classes[i],
+ animationFactory = $animateProvider.$$registeredAnimations[klass];
+ if (animationFactory && !flagMap[klass]) {
+ matches.push($injector.get(animationFactory));
+ flagMap[klass] = true;
+ }
+ }
+ return matches;
+ }
+ }];
+}];
+
+var $$AnimateJsDriverProvider = ['$$animationProvider', function($$animationProvider) {
+ $$animationProvider.drivers.push('$$animateJsDriver');
+ this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) {
+ return function initDriverFn(animationDetails) {
+ if (animationDetails.from && animationDetails.to) {
+ var fromAnimation = prepareAnimation(animationDetails.from);
+ var toAnimation = prepareAnimation(animationDetails.to);
+ if (!fromAnimation && !toAnimation) return;
+
+ return {
+ start: function() {
+ var animationRunners = [];
+
+ if (fromAnimation) {
+ animationRunners.push(fromAnimation.start());
+ }
+
+ if (toAnimation) {
+ animationRunners.push(toAnimation.start());
+ }
+
+ $$AnimateRunner.all(animationRunners, done);
+
+ var runner = new $$AnimateRunner({
+ end: endFnFactory(),
+ cancel: endFnFactory()
+ });
+
+ return runner;
+
+ function endFnFactory() {
+ return function() {
+ forEach(animationRunners, function(runner) {
+ // at this point we cannot cancel animations for groups just yet. 1.5+
+ runner.end();
+ });
+ };
+ }
+
+ function done(status) {
+ runner.complete(status);
+ }
+ }
+ };
+ } else {
+ return prepareAnimation(animationDetails);
+ }
+ };
+
+ function prepareAnimation(animationDetails) {
+ // TODO(matsko): make sure to check for grouped animations and delegate down to normal animations
+ var element = animationDetails.element;
+ var event = animationDetails.event;
+ var options = animationDetails.options;
+ var classes = animationDetails.classes;
+ return $$animateJs(element, event, classes, options);
+ }
+ }];
+}];
+
+var NG_ANIMATE_ATTR_NAME = 'data-ng-animate';
+var NG_ANIMATE_PIN_DATA = '$ngAnimatePin';
+var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
+ var PRE_DIGEST_STATE = 1;
+ var RUNNING_STATE = 2;
+ var ONE_SPACE = ' ';
+
+ var rules = this.rules = {
+ skip: [],
+ cancel: [],
+ join: []
+ };
+
+ function makeTruthyCssClassMap(classString) {
+ if (!classString) {
+ return null;
+ }
+
+ var keys = classString.split(ONE_SPACE);
+ var map = Object.create(null);
+
+ forEach(keys, function(key) {
+ map[key] = true;
+ });
+ return map;
+ }
+
+ function hasMatchingClasses(newClassString, currentClassString) {
+ if (newClassString && currentClassString) {
+ var currentClassMap = makeTruthyCssClassMap(currentClassString);
+ return newClassString.split(ONE_SPACE).some(function(className) {
+ return currentClassMap[className];
+ });
+ }
+ }
+
+ function isAllowed(ruleType, element, currentAnimation, previousAnimation) {
+ return rules[ruleType].some(function(fn) {
+ return fn(element, currentAnimation, previousAnimation);
+ });
+ }
+
+ function hasAnimationClasses(animation, and) {
+ var a = (animation.addClass || '').length > 0;
+ var b = (animation.removeClass || '').length > 0;
+ return and ? a && b : a || b;
+ }
+
+ rules.join.push(function(element, newAnimation, currentAnimation) {
+ // if the new animation is class-based then we can just tack that on
+ return !newAnimation.structural && hasAnimationClasses(newAnimation);
+ });
+
+ rules.skip.push(function(element, newAnimation, currentAnimation) {
+ // there is no need to animate anything if no classes are being added and
+ // there is no structural animation that will be triggered
+ return !newAnimation.structural && !hasAnimationClasses(newAnimation);
+ });
+
+ rules.skip.push(function(element, newAnimation, currentAnimation) {
+ // why should we trigger a new structural animation if the element will
+ // be removed from the DOM anyway?
+ return currentAnimation.event == 'leave' && newAnimation.structural;
+ });
+
+ rules.skip.push(function(element, newAnimation, currentAnimation) {
+ // if there is an ongoing current animation then don't even bother running the class-based animation
+ return currentAnimation.structural && currentAnimation.state === RUNNING_STATE && !newAnimation.structural;
+ });
+
+ rules.cancel.push(function(element, newAnimation, currentAnimation) {
+ // there can never be two structural animations running at the same time
+ return currentAnimation.structural && newAnimation.structural;
+ });
+
+ rules.cancel.push(function(element, newAnimation, currentAnimation) {
+ // if the previous animation is already running, but the new animation will
+ // be triggered, but the new animation is structural
+ return currentAnimation.state === RUNNING_STATE && newAnimation.structural;
+ });
+
+ rules.cancel.push(function(element, newAnimation, currentAnimation) {
+ var nA = newAnimation.addClass;
+ var nR = newAnimation.removeClass;
+ var cA = currentAnimation.addClass;
+ var cR = currentAnimation.removeClass;
+
+ // early detection to save the global CPU shortage :)
+ if ((isUndefined(nA) && isUndefined(nR)) || (isUndefined(cA) && isUndefined(cR))) {
+ return false;
+ }
+
+ return hasMatchingClasses(nA, cR) || hasMatchingClasses(nR, cA);
+ });
+
+ this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$HashMap',
+ '$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite', '$$forceReflow',
+ function($$rAF, $rootScope, $rootElement, $document, $$HashMap,
+ $$animation, $$AnimateRunner, $templateRequest, $$jqLite, $$forceReflow) {
+
+ var activeAnimationsLookup = new $$HashMap();
+ var disabledElementsLookup = new $$HashMap();
+ var animationsEnabled = null;
+
+ function postDigestTaskFactory() {
+ var postDigestCalled = false;
+ return function(fn) {
+ // we only issue a call to postDigest before
+ // it has first passed. This prevents any callbacks
+ // from not firing once the animation has completed
+ // since it will be out of the digest cycle.
+ if (postDigestCalled) {
+ fn();
+ } else {
+ $rootScope.$$postDigest(function() {
+ postDigestCalled = true;
+ fn();
+ });
+ }
+ };
+ }
+
+ // Wait until all directive and route-related templates are downloaded and
+ // compiled. The $templateRequest.totalPendingRequests variable keeps track of
+ // all of the remote templates being currently downloaded. If there are no
+ // templates currently downloading then the watcher will still fire anyway.
+ var deregisterWatch = $rootScope.$watch(
+ function() { return $templateRequest.totalPendingRequests === 0; },
+ function(isEmpty) {
+ if (!isEmpty) return;
+ deregisterWatch();
+
+ // Now that all templates have been downloaded, $animate will wait until
+ // the post digest queue is empty before enabling animations. By having two
+ // calls to $postDigest calls we can ensure that the flag is enabled at the
+ // very end of the post digest queue. Since all of the animations in $animate
+ // use $postDigest, it's important that the code below executes at the end.
+ // This basically means that the page is fully downloaded and compiled before
+ // any animations are triggered.
+ $rootScope.$$postDigest(function() {
+ $rootScope.$$postDigest(function() {
+ // we check for null directly in the event that the application already called
+ // .enabled() with whatever arguments that it provided it with
+ if (animationsEnabled === null) {
+ animationsEnabled = true;
+ }
+ });
+ });
+ }
+ );
+
+ var callbackRegistry = {};
+
+ // remember that the classNameFilter is set during the provider/config
+ // stage therefore we can optimize here and setup a helper function
+ var classNameFilter = $animateProvider.classNameFilter();
+ var isAnimatableClassName = !classNameFilter
+ ? function() { return true; }
+ : function(className) {
+ return classNameFilter.test(className);
+ };
+
+ var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+
+ function normalizeAnimationDetails(element, animation) {
+ return mergeAnimationDetails(element, animation, {});
+ }
+
+ // IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.
+ var contains = Node.prototype.contains || function(arg) {
+ // jshint bitwise: false
+ return this === arg || !!(this.compareDocumentPosition(arg) & 16);
+ // jshint bitwise: true
+ };
+
+ function findCallbacks(parent, element, event) {
+ var targetNode = getDomNode(element);
+ var targetParentNode = getDomNode(parent);
+
+ var matches = [];
+ var entries = callbackRegistry[event];
+ if (entries) {
+ forEach(entries, function(entry) {
+ if (contains.call(entry.node, targetNode)) {
+ matches.push(entry.callback);
+ } else if (event === 'leave' && contains.call(entry.node, targetParentNode)) {
+ matches.push(entry.callback);
+ }
+ });
+ }
+
+ return matches;
+ }
+
+ return {
+ on: function(event, container, callback) {
+ var node = extractElementNode(container);
+ callbackRegistry[event] = callbackRegistry[event] || [];
+ callbackRegistry[event].push({
+ node: node,
+ callback: callback
+ });
+ },
+
+ off: function(event, container, callback) {
+ var entries = callbackRegistry[event];
+ if (!entries) return;
+
+ callbackRegistry[event] = arguments.length === 1
+ ? null
+ : filterFromRegistry(entries, container, callback);
+
+ function filterFromRegistry(list, matchContainer, matchCallback) {
+ var containerNode = extractElementNode(matchContainer);
+ return list.filter(function(entry) {
+ var isMatch = entry.node === containerNode &&
+ (!matchCallback || entry.callback === matchCallback);
+ return !isMatch;
+ });
+ }
+ },
+
+ pin: function(element, parentElement) {
+ assertArg(isElement(element), 'element', 'not an element');
+ assertArg(isElement(parentElement), 'parentElement', 'not an element');
+ element.data(NG_ANIMATE_PIN_DATA, parentElement);
+ },
+
+ push: function(element, event, options, domOperation) {
+ options = options || {};
+ options.domOperation = domOperation;
+ return queueAnimation(element, event, options);
+ },
+
+ // this method has four signatures:
+ // () - global getter
+ // (bool) - global setter
+ // (element) - element getter
+ // (element, bool) - element setter<F37>
+ enabled: function(element, bool) {
+ var argCount = arguments.length;
+
+ if (argCount === 0) {
+ // () - Global getter
+ bool = !!animationsEnabled;
+ } else {
+ var hasElement = isElement(element);
+
+ if (!hasElement) {
+ // (bool) - Global setter
+ bool = animationsEnabled = !!element;
+ } else {
+ var node = getDomNode(element);
+ var recordExists = disabledElementsLookup.get(node);
+
+ if (argCount === 1) {
+ // (element) - Element getter
+ bool = !recordExists;
+ } else {
+ // (element, bool) - Element setter
+ disabledElementsLookup.put(node, !bool);
+ }
+ }
+ }
+
+ return bool;
+ }
+ };
+
+ function queueAnimation(element, event, initialOptions) {
+ // we always make a copy of the options since
+ // there should never be any side effects on
+ // the input data when running `$animateCss`.
+ var options = copy(initialOptions);
+
+ var node, parent;
+ element = stripCommentsFromElement(element);
+ if (element) {
+ node = getDomNode(element);
+ parent = element.parent();
+ }
+
+ options = prepareAnimationOptions(options);
+
+ // we create a fake runner with a working promise.
+ // These methods will become available after the digest has passed
+ var runner = new $$AnimateRunner();
+
+ // this is used to trigger callbacks in postDigest mode
+ var runInNextPostDigestOrNow = postDigestTaskFactory();
+
+ if (isArray(options.addClass)) {
+ options.addClass = options.addClass.join(' ');
+ }
+
+ if (options.addClass && !isString(options.addClass)) {
+ options.addClass = null;
+ }
+
+ if (isArray(options.removeClass)) {
+ options.removeClass = options.removeClass.join(' ');
+ }
+
+ if (options.removeClass && !isString(options.removeClass)) {
+ options.removeClass = null;
+ }
+
+ if (options.from && !isObject(options.from)) {
+ options.from = null;
+ }
+
+ if (options.to && !isObject(options.to)) {
+ options.to = null;
+ }
+
+ // there are situations where a directive issues an animation for
+ // a jqLite wrapper that contains only comment nodes... If this
+ // happens then there is no way we can perform an animation
+ if (!node) {
+ close();
+ return runner;
+ }
+
+ var className = [node.className, options.addClass, options.removeClass].join(' ');
+ if (!isAnimatableClassName(className)) {
+ close();
+ return runner;
+ }
+
+ var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0;
+
+ // this is a hard disable of all animations for the application or on
+ // the element itself, therefore there is no need to continue further
+ // past this point if not enabled
+ // Animations are also disabled if the document is currently hidden (page is not visible
+ // to the user), because browsers slow down or do not flush calls to requestAnimationFrame
+ var skipAnimations = !animationsEnabled || $document[0].hidden || disabledElementsLookup.get(node);
+ var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {};
+ var hasExistingAnimation = !!existingAnimation.state;
+
+ // there is no point in traversing the same collection of parent ancestors if a followup
+ // animation will be run on the same element that already did all that checking work
+ if (!skipAnimations && (!hasExistingAnimation || existingAnimation.state != PRE_DIGEST_STATE)) {
+ skipAnimations = !areAnimationsAllowed(element, parent, event);
+ }
+
+ if (skipAnimations) {
+ close();
+ return runner;
+ }
+
+ if (isStructural) {
+ closeChildAnimations(element);
+ }
+
+ var newAnimation = {
+ structural: isStructural,
+ element: element,
+ event: event,
+ addClass: options.addClass,
+ removeClass: options.removeClass,
+ close: close,
+ options: options,
+ runner: runner
+ };
+
+ if (hasExistingAnimation) {
+ var skipAnimationFlag = isAllowed('skip', element, newAnimation, existingAnimation);
+ if (skipAnimationFlag) {
+ if (existingAnimation.state === RUNNING_STATE) {
+ close();
+ return runner;
+ } else {
+ mergeAnimationDetails(element, existingAnimation, newAnimation);
+ return existingAnimation.runner;
+ }
+ }
+ var cancelAnimationFlag = isAllowed('cancel', element, newAnimation, existingAnimation);
+ if (cancelAnimationFlag) {
+ if (existingAnimation.state === RUNNING_STATE) {
+ // this will end the animation right away and it is safe
+ // to do so since the animation is already running and the
+ // runner callback code will run in async
+ existingAnimation.runner.end();
+ } else if (existingAnimation.structural) {
+ // this means that the animation is queued into a digest, but
+ // hasn't started yet. Therefore it is safe to run the close
+ // method which will call the runner methods in async.
+ existingAnimation.close();
+ } else {
+ // this will merge the new animation options into existing animation options
+ mergeAnimationDetails(element, existingAnimation, newAnimation);
+
+ return existingAnimation.runner;
+ }
+ } else {
+ // a joined animation means that this animation will take over the existing one
+ // so an example would involve a leave animation taking over an enter. Then when
+ // the postDigest kicks in the enter will be ignored.
+ var joinAnimationFlag = isAllowed('join', element, newAnimation, existingAnimation);
+ if (joinAnimationFlag) {
+ if (existingAnimation.state === RUNNING_STATE) {
+ normalizeAnimationDetails(element, newAnimation);
+ } else {
+ applyGeneratedPreparationClasses(element, isStructural ? event : null, options);
+
+ event = newAnimation.event = existingAnimation.event;
+ options = mergeAnimationDetails(element, existingAnimation, newAnimation);
+
+ //we return the same runner since only the option values of this animation will
+ //be fed into the `existingAnimation`.
+ return existingAnimation.runner;
+ }
+ }
+ }
+ } else {
+ // normalization in this case means that it removes redundant CSS classes that
+ // already exist (addClass) or do not exist (removeClass) on the element
+ normalizeAnimationDetails(element, newAnimation);
+ }
+
+ // when the options are merged and cleaned up we may end up not having to do
+ // an animation at all, therefore we should check this before issuing a post
+ // digest callback. Structural animations will always run no matter what.
+ var isValidAnimation = newAnimation.structural;
+ if (!isValidAnimation) {
+ // animate (from/to) can be quickly checked first, otherwise we check if any classes are present
+ isValidAnimation = (newAnimation.event === 'animate' && Object.keys(newAnimation.options.to || {}).length > 0)
+ || hasAnimationClasses(newAnimation);
+ }
+
+ if (!isValidAnimation) {
+ close();
+ clearElementAnimationState(element);
+ return runner;
+ }
+
+ // the counter keeps track of cancelled animations
+ var counter = (existingAnimation.counter || 0) + 1;
+ newAnimation.counter = counter;
+
+ markElementAnimationState(element, PRE_DIGEST_STATE, newAnimation);
+
+ $rootScope.$$postDigest(function() {
+ var animationDetails = activeAnimationsLookup.get(node);
+ var animationCancelled = !animationDetails;
+ animationDetails = animationDetails || {};
+
+ // if addClass/removeClass is called before something like enter then the
+ // registered parent element may not be present. The code below will ensure
+ // that a final value for parent element is obtained
+ var parentElement = element.parent() || [];
+
+ // animate/structural/class-based animations all have requirements. Otherwise there
+ // is no point in performing an animation. The parent node must also be set.
+ var isValidAnimation = parentElement.length > 0
+ && (animationDetails.event === 'animate'
+ || animationDetails.structural
+ || hasAnimationClasses(animationDetails));
+
+ // this means that the previous animation was cancelled
+ // even if the follow-up animation is the same event
+ if (animationCancelled || animationDetails.counter !== counter || !isValidAnimation) {
+ // if another animation did not take over then we need
+ // to make sure that the domOperation and options are
+ // handled accordingly
+ if (animationCancelled) {
+ applyAnimationClasses(element, options);
+ applyAnimationStyles(element, options);
+ }
+
+ // if the event changed from something like enter to leave then we do
+ // it, otherwise if it's the same then the end result will be the same too
+ if (animationCancelled || (isStructural && animationDetails.event !== event)) {
+ options.domOperation();
+ runner.end();
+ }
+
+ // in the event that the element animation was not cancelled or a follow-up animation
+ // isn't allowed to animate from here then we need to clear the state of the element
+ // so that any future animations won't read the expired animation data.
+ if (!isValidAnimation) {
+ clearElementAnimationState(element);
+ }
+
+ return;
+ }
+
+ // this combined multiple class to addClass / removeClass into a setClass event
+ // so long as a structural event did not take over the animation
+ event = !animationDetails.structural && hasAnimationClasses(animationDetails, true)
+ ? 'setClass'
+ : animationDetails.event;
+
+ markElementAnimationState(element, RUNNING_STATE);
+ var realRunner = $$animation(element, event, animationDetails.options);
+
+ realRunner.done(function(status) {
+ close(!status);
+ var animationDetails = activeAnimationsLookup.get(node);
+ if (animationDetails && animationDetails.counter === counter) {
+ clearElementAnimationState(getDomNode(element));
+ }
+ notifyProgress(runner, event, 'close', {});
+ });
+
+ // this will update the runner's flow-control events based on
+ // the `realRunner` object.
+ runner.setHost(realRunner);
+ notifyProgress(runner, event, 'start', {});
+ });
+
+ return runner;
+
+ function notifyProgress(runner, event, phase, data) {
+ runInNextPostDigestOrNow(function() {
+ var callbacks = findCallbacks(parent, element, event);
+ if (callbacks.length) {
+ // do not optimize this call here to RAF because
+ // we don't know how heavy the callback code here will
+ // be and if this code is buffered then this can
+ // lead to a performance regression.
+ $$rAF(function() {
+ forEach(callbacks, function(callback) {
+ callback(element, phase, data);
+ });
+ });
+ }
+ });
+ runner.progress(event, phase, data);
+ }
+
+ function close(reject) { // jshint ignore:line
+ clearGeneratedClasses(element, options);
+ applyAnimationClasses(element, options);
+ applyAnimationStyles(element, options);
+ options.domOperation();
+ runner.complete(!reject);
+ }
+ }
+
+ function closeChildAnimations(element) {
+ var node = getDomNode(element);
+ var children = node.querySelectorAll('[' + NG_ANIMATE_ATTR_NAME + ']');
+ forEach(children, function(child) {
+ var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME));
+ var animationDetails = activeAnimationsLookup.get(child);
+ if (animationDetails) {
+ switch (state) {
+ case RUNNING_STATE:
+ animationDetails.runner.end();
+ /* falls through */
+ case PRE_DIGEST_STATE:
+ activeAnimationsLookup.remove(child);
+ break;
+ }
+ }
+ });
+ }
+
+ function clearElementAnimationState(element) {
+ var node = getDomNode(element);
+ node.removeAttribute(NG_ANIMATE_ATTR_NAME);
+ activeAnimationsLookup.remove(node);
+ }
+
+ function isMatchingElement(nodeOrElmA, nodeOrElmB) {
+ return getDomNode(nodeOrElmA) === getDomNode(nodeOrElmB);
+ }
+
+ /**
+ * This fn returns false if any of the following is true:
+ * a) animations on any parent element are disabled, and animations on the element aren't explicitly allowed
+ * b) a parent element has an ongoing structural animation, and animateChildren is false
+ * c) the element is not a child of the body
+ * d) the element is not a child of the $rootElement
+ */
+ function areAnimationsAllowed(element, parentElement, event) {
+ var bodyElement = jqLite($document[0].body);
+ var bodyElementDetected = isMatchingElement(element, bodyElement) || element[0].nodeName === 'HTML';
+ var rootElementDetected = isMatchingElement(element, $rootElement);
+ var parentAnimationDetected = false;
+ var animateChildren;
+ var elementDisabled = disabledElementsLookup.get(getDomNode(element));
+
+ var parentHost = element.data(NG_ANIMATE_PIN_DATA);
+ if (parentHost) {
+ parentElement = parentHost;
+ }
+
+ while (parentElement && parentElement.length) {
+ if (!rootElementDetected) {
+ // angular doesn't want to attempt to animate elements outside of the application
+ // therefore we need to ensure that the rootElement is an ancestor of the current element
+ rootElementDetected = isMatchingElement(parentElement, $rootElement);
+ }
+
+ var parentNode = parentElement[0];
+ if (parentNode.nodeType !== ELEMENT_NODE) {
+ // no point in inspecting the #document element
+ break;
+ }
+
+ var details = activeAnimationsLookup.get(parentNode) || {};
+ // either an enter, leave or move animation will commence
+ // therefore we can't allow any animations to take place
+ // but if a parent animation is class-based then that's ok
+ if (!parentAnimationDetected) {
+ var parentElementDisabled = disabledElementsLookup.get(parentNode);
+
+ if (parentElementDisabled === true && elementDisabled !== false) {
+ // disable animations if the user hasn't explicitly enabled animations on the
+ // current element
+ elementDisabled = true;
+ // element is disabled via parent element, no need to check anything else
+ break;
+ } else if (parentElementDisabled === false) {
+ elementDisabled = false;
+ }
+ parentAnimationDetected = details.structural;
+ }
+
+ if (isUndefined(animateChildren) || animateChildren === true) {
+ var value = parentElement.data(NG_ANIMATE_CHILDREN_DATA);
+ if (isDefined(value)) {
+ animateChildren = value;
+ }
+ }
+
+ // there is no need to continue traversing at this point
+ if (parentAnimationDetected && animateChildren === false) break;
+
+ if (!bodyElementDetected) {
+ // we also need to ensure that the element is or will be a part of the body element
+ // otherwise it is pointless to even issue an animation to be rendered
+ bodyElementDetected = isMatchingElement(parentElement, bodyElement);
+ }
+
+ if (bodyElementDetected && rootElementDetected) {
+ // If both body and root have been found, any other checks are pointless,
+ // as no animation data should live outside the application
+ break;
+ }
+
+ if (!rootElementDetected) {
+ // If no rootElement is detected, check if the parentElement is pinned to another element
+ parentHost = parentElement.data(NG_ANIMATE_PIN_DATA);
+ if (parentHost) {
+ // The pin target element becomes the next parent element
+ parentElement = parentHost;
+ continue;
+ }
+ }
+
+ parentElement = parentElement.parent();
+ }
+
+ var allowAnimation = (!parentAnimationDetected || animateChildren) && elementDisabled !== true;
+ return allowAnimation && rootElementDetected && bodyElementDetected;
+ }
+
+ function markElementAnimationState(element, state, details) {
+ details = details || {};
+ details.state = state;
+
+ var node = getDomNode(element);
+ node.setAttribute(NG_ANIMATE_ATTR_NAME, state);
+
+ var oldValue = activeAnimationsLookup.get(node);
+ var newValue = oldValue
+ ? extend(oldValue, details)
+ : details;
+ activeAnimationsLookup.put(node, newValue);
+ }
+ }];
+}];
+
+var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
+ var NG_ANIMATE_REF_ATTR = 'ng-animate-ref';
+
+ var drivers = this.drivers = [];
+
+ var RUNNER_STORAGE_KEY = '$$animationRunner';
+
+ function setRunner(element, runner) {
+ element.data(RUNNER_STORAGE_KEY, runner);
+ }
+
+ function removeRunner(element) {
+ element.removeData(RUNNER_STORAGE_KEY);
+ }
+
+ function getRunner(element) {
+ return element.data(RUNNER_STORAGE_KEY);
+ }
+
+ this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner', '$$HashMap', '$$rAFScheduler',
+ function($$jqLite, $rootScope, $injector, $$AnimateRunner, $$HashMap, $$rAFScheduler) {
+
+ var animationQueue = [];
+ var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+
+ function sortAnimations(animations) {
+ var tree = { children: [] };
+ var i, lookup = new $$HashMap();
+
+ // this is done first beforehand so that the hashmap
+ // is filled with a list of the elements that will be animated
+ for (i = 0; i < animations.length; i++) {
+ var animation = animations[i];
+ lookup.put(animation.domNode, animations[i] = {
+ domNode: animation.domNode,
+ fn: animation.fn,
+ children: []
+ });
+ }
+
+ for (i = 0; i < animations.length; i++) {
+ processNode(animations[i]);
+ }
+
+ return flatten(tree);
+
+ function processNode(entry) {
+ if (entry.processed) return entry;
+ entry.processed = true;
+
+ var elementNode = entry.domNode;
+ var parentNode = elementNode.parentNode;
+ lookup.put(elementNode, entry);
+
+ var parentEntry;
+ while (parentNode) {
+ parentEntry = lookup.get(parentNode);
+ if (parentEntry) {
+ if (!parentEntry.processed) {
+ parentEntry = processNode(parentEntry);
+ }
+ break;
+ }
+ parentNode = parentNode.parentNode;
+ }
+
+ (parentEntry || tree).children.push(entry);
+ return entry;
+ }
+
+ function flatten(tree) {
+ var result = [];
+ var queue = [];
+ var i;
+
+ for (i = 0; i < tree.children.length; i++) {
+ queue.push(tree.children[i]);
+ }
+
+ var remainingLevelEntries = queue.length;
+ var nextLevelEntries = 0;
+ var row = [];
+
+ for (i = 0; i < queue.length; i++) {
+ var entry = queue[i];
+ if (remainingLevelEntries <= 0) {
+ remainingLevelEntries = nextLevelEntries;
+ nextLevelEntries = 0;
+ result.push(row);
+ row = [];
+ }
+ row.push(entry.fn);
+ entry.children.forEach(function(childEntry) {
+ nextLevelEntries++;
+ queue.push(childEntry);
+ });
+ remainingLevelEntries--;
+ }
+
+ if (row.length) {
+ result.push(row);
+ }
+
+ return result;
+ }
+ }
+
+ // TODO(matsko): document the signature in a better way
+ return function(element, event, options) {
+ options = prepareAnimationOptions(options);
+ var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0;
+
+ // there is no animation at the current moment, however
+ // these runner methods will get later updated with the
+ // methods leading into the driver's end/cancel methods
+ // for now they just stop the animation from starting
+ var runner = new $$AnimateRunner({
+ end: function() { close(); },
+ cancel: function() { close(true); }
+ });
+
+ if (!drivers.length) {
+ close();
+ return runner;
+ }
+
+ setRunner(element, runner);
+
+ var classes = mergeClasses(element.attr('class'), mergeClasses(options.addClass, options.removeClass));
+ var tempClasses = options.tempClasses;
+ if (tempClasses) {
+ classes += ' ' + tempClasses;
+ options.tempClasses = null;
+ }
+
+ var prepareClassName;
+ if (isStructural) {
+ prepareClassName = 'ng-' + event + PREPARE_CLASS_SUFFIX;
+ $$jqLite.addClass(element, prepareClassName);
+ }
+
+ animationQueue.push({
+ // this data is used by the postDigest code and passed into
+ // the driver step function
+ element: element,
+ classes: classes,
+ event: event,
+ structural: isStructural,
+ options: options,
+ beforeStart: beforeStart,
+ close: close
+ });
+
+ element.on('$destroy', handleDestroyedElement);
+
+ // we only want there to be one function called within the post digest
+ // block. This way we can group animations for all the animations that
+ // were apart of the same postDigest flush call.
+ if (animationQueue.length > 1) return runner;
+
+ $rootScope.$$postDigest(function() {
+ var animations = [];
+ forEach(animationQueue, function(entry) {
+ // the element was destroyed early on which removed the runner
+ // form its storage. This means we can't animate this element
+ // at all and it already has been closed due to destruction.
+ if (getRunner(entry.element)) {
+ animations.push(entry);
+ } else {
+ entry.close();
+ }
+ });
+
+ // now any future animations will be in another postDigest
+ animationQueue.length = 0;
+
+ var groupedAnimations = groupAnimations(animations);
+ var toBeSortedAnimations = [];
+
+ forEach(groupedAnimations, function(animationEntry) {
+ toBeSortedAnimations.push({
+ domNode: getDomNode(animationEntry.from ? animationEntry.from.element : animationEntry.element),
+ fn: function triggerAnimationStart() {
+ // it's important that we apply the `ng-animate` CSS class and the
+ // temporary classes before we do any driver invoking since these
+ // CSS classes may be required for proper CSS detection.
+ animationEntry.beforeStart();
+
+ var startAnimationFn, closeFn = animationEntry.close;
+
+ // in the event that the element was removed before the digest runs or
+ // during the RAF sequencing then we should not trigger the animation.
+ var targetElement = animationEntry.anchors
+ ? (animationEntry.from.element || animationEntry.to.element)
+ : animationEntry.element;
+
+ if (getRunner(targetElement)) {
+ var operation = invokeFirstDriver(animationEntry);
+ if (operation) {
+ startAnimationFn = operation.start;
+ }
+ }
+
+ if (!startAnimationFn) {
+ closeFn();
+ } else {
+ var animationRunner = startAnimationFn();
+ animationRunner.done(function(status) {
+ closeFn(!status);
+ });
+ updateAnimationRunners(animationEntry, animationRunner);
+ }
+ }
+ });
+ });
+
+ // we need to sort each of the animations in order of parent to child
+ // relationships. This ensures that the child classes are applied at the
+ // right time.
+ $$rAFScheduler(sortAnimations(toBeSortedAnimations));
+ });
+
+ return runner;
+
+ // TODO(matsko): change to reference nodes
+ function getAnchorNodes(node) {
+ var SELECTOR = '[' + NG_ANIMATE_REF_ATTR + ']';
+ var items = node.hasAttribute(NG_ANIMATE_REF_ATTR)
+ ? [node]
+ : node.querySelectorAll(SELECTOR);
+ var anchors = [];
+ forEach(items, function(node) {
+ var attr = node.getAttribute(NG_ANIMATE_REF_ATTR);
+ if (attr && attr.length) {
+ anchors.push(node);
+ }
+ });
+ return anchors;
+ }
+
+ function groupAnimations(animations) {
+ var preparedAnimations = [];
+ var refLookup = {};
+ forEach(animations, function(animation, index) {
+ var element = animation.element;
+ var node = getDomNode(element);
+ var event = animation.event;
+ var enterOrMove = ['enter', 'move'].indexOf(event) >= 0;
+ var anchorNodes = animation.structural ? getAnchorNodes(node) : [];
+
+ if (anchorNodes.length) {
+ var direction = enterOrMove ? 'to' : 'from';
+
+ forEach(anchorNodes, function(anchor) {
+ var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR);
+ refLookup[key] = refLookup[key] || {};
+ refLookup[key][direction] = {
+ animationID: index,
+ element: jqLite(anchor)
+ };
+ });
+ } else {
+ preparedAnimations.push(animation);
+ }
+ });
+
+ var usedIndicesLookup = {};
+ var anchorGroups = {};
+ forEach(refLookup, function(operations, key) {
+ var from = operations.from;
+ var to = operations.to;
+
+ if (!from || !to) {
+ // only one of these is set therefore we can't have an
+ // anchor animation since all three pieces are required
+ var index = from ? from.animationID : to.animationID;
+ var indexKey = index.toString();
+ if (!usedIndicesLookup[indexKey]) {
+ usedIndicesLookup[indexKey] = true;
+ preparedAnimations.push(animations[index]);
+ }
+ return;
+ }
+
+ var fromAnimation = animations[from.animationID];
+ var toAnimation = animations[to.animationID];
+ var lookupKey = from.animationID.toString();
+ if (!anchorGroups[lookupKey]) {
+ var group = anchorGroups[lookupKey] = {
+ structural: true,
+ beforeStart: function() {
+ fromAnimation.beforeStart();
+ toAnimation.beforeStart();
+ },
+ close: function() {
+ fromAnimation.close();
+ toAnimation.close();
+ },
+ classes: cssClassesIntersection(fromAnimation.classes, toAnimation.classes),
+ from: fromAnimation,
+ to: toAnimation,
+ anchors: [] // TODO(matsko): change to reference nodes
+ };
+
+ // the anchor animations require that the from and to elements both have at least
+ // one shared CSS class which effectively marries the two elements together to use
+ // the same animation driver and to properly sequence the anchor animation.
+ if (group.classes.length) {
+ preparedAnimations.push(group);
+ } else {
+ preparedAnimations.push(fromAnimation);
+ preparedAnimations.push(toAnimation);
+ }
+ }
+
+ anchorGroups[lookupKey].anchors.push({
+ 'out': from.element, 'in': to.element
+ });
+ });
+
+ return preparedAnimations;
+ }
+
+ function cssClassesIntersection(a,b) {
+ a = a.split(' ');
+ b = b.split(' ');
+ var matches = [];
+
+ for (var i = 0; i < a.length; i++) {
+ var aa = a[i];
+ if (aa.substring(0,3) === 'ng-') continue;
+
+ for (var j = 0; j < b.length; j++) {
+ if (aa === b[j]) {
+ matches.push(aa);
+ break;
+ }
+ }
+ }
+
+ return matches.join(' ');
+ }
+
+ function invokeFirstDriver(animationDetails) {
+ // we loop in reverse order since the more general drivers (like CSS and JS)
+ // may attempt more elements, but custom drivers are more particular
+ for (var i = drivers.length - 1; i >= 0; i--) {
+ var driverName = drivers[i];
+ if (!$injector.has(driverName)) continue; // TODO(matsko): remove this check
+
+ var factory = $injector.get(driverName);
+ var driver = factory(animationDetails);
+ if (driver) {
+ return driver;
+ }
+ }
+ }
+
+ function beforeStart() {
+ element.addClass(NG_ANIMATE_CLASSNAME);
+ if (tempClasses) {
+ $$jqLite.addClass(element, tempClasses);
+ }
+ if (prepareClassName) {
+ $$jqLite.removeClass(element, prepareClassName);
+ prepareClassName = null;
+ }
+ }
+
+ function updateAnimationRunners(animation, newRunner) {
+ if (animation.from && animation.to) {
+ update(animation.from.element);
+ update(animation.to.element);
+ } else {
+ update(animation.element);
+ }
+
+ function update(element) {
+ getRunner(element).setHost(newRunner);
+ }
+ }
+
+ function handleDestroyedElement() {
+ var runner = getRunner(element);
+ if (runner && (event !== 'leave' || !options.$$domOperationFired)) {
+ runner.end();
+ }
+ }
+
+ function close(rejected) { // jshint ignore:line
+ element.off('$destroy', handleDestroyedElement);
+ removeRunner(element);
+
+ applyAnimationClasses(element, options);
+ applyAnimationStyles(element, options);
+ options.domOperation();
+
+ if (tempClasses) {
+ $$jqLite.removeClass(element, tempClasses);
+ }
+
+ element.removeClass(NG_ANIMATE_CLASSNAME);
+ runner.complete(!rejected);
+ }
+ };
+ }];
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngAnimateSwap
+ * @restrict A
+ * @scope
+ *
+ * @description
+ *
+ * ngAnimateSwap is a animation-oriented directive that allows for the container to
+ * be removed and entered in whenever the associated expression changes. A
+ * common usecase for this directive is a rotating banner component which
+ * contains one image being present at a time. When the active image changes
+ * then the old image will perform a `leave` animation and the new element
+ * will be inserted via an `enter` animation.
+ *
+ * @example
+ * <example name="ngAnimateSwap-directive" module="ngAnimateSwapExample"
+ * deps="angular-animate.js"
+ * animations="true" fixBase="true">
+ * <file name="index.html">
+ * <div class="container" ng-controller="AppCtrl">
+ * <div ng-animate-swap="number" class="cell swap-animation" ng-class="colorClass(number)">
+ * {{ number }}
+ * </div>
+ * </div>
+ * </file>
+ * <file name="script.js">
+ * angular.module('ngAnimateSwapExample', ['ngAnimate'])
+ * .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) {
+ * $scope.number = 0;
+ * $interval(function() {
+ * $scope.number++;
+ * }, 1000);
+ *
+ * var colors = ['red','blue','green','yellow','orange'];
+ * $scope.colorClass = function(number) {
+ * return colors[number % colors.length];
+ * };
+ * }]);
+ * </file>
+ * <file name="animations.css">
+ * .container {
+ * height:250px;
+ * width:250px;
+ * position:relative;
+ * overflow:hidden;
+ * border:2px solid black;
+ * }
+ * .container .cell {
+ * font-size:150px;
+ * text-align:center;
+ * line-height:250px;
+ * position:absolute;
+ * top:0;
+ * left:0;
+ * right:0;
+ * border-bottom:2px solid black;
+ * }
+ * .swap-animation.ng-enter, .swap-animation.ng-leave {
+ * transition:0.5s linear all;
+ * }
+ * .swap-animation.ng-enter {
+ * top:-250px;
+ * }
+ * .swap-animation.ng-enter-active {
+ * top:0px;
+ * }
+ * .swap-animation.ng-leave {
+ * top:0px;
+ * }
+ * .swap-animation.ng-leave-active {
+ * top:250px;
+ * }
+ * .red { background:red; }
+ * .green { background:green; }
+ * .blue { background:blue; }
+ * .yellow { background:yellow; }
+ * .orange { background:orange; }
+ * </file>
+ * </example>
+ */
+var ngAnimateSwapDirective = ['$animate', '$rootScope', function($animate, $rootScope) {
+ return {
+ restrict: 'A',
+ transclude: 'element',
+ terminal: true,
+ priority: 600, // we use 600 here to ensure that the directive is caught before others
+ link: function(scope, $element, attrs, ctrl, $transclude) {
+ var previousElement, previousScope;
+ scope.$watchCollection(attrs.ngAnimateSwap || attrs['for'], function(value) {
+ if (previousElement) {
+ $animate.leave(previousElement);
+ }
+ if (previousScope) {
+ previousScope.$destroy();
+ previousScope = null;
+ }
+ if (value || value === 0) {
+ previousScope = scope.$new();
+ $transclude(previousScope, function(element) {
+ previousElement = element;
+ $animate.enter(element, null, $element);
+ });
+ }
+ });
+ }
+ };
+}];
+
+/* global angularAnimateModule: true,
+
+ ngAnimateSwapDirective,
+ $$AnimateAsyncRunFactory,
+ $$rAFSchedulerFactory,
+ $$AnimateChildrenDirective,
+ $$AnimateQueueProvider,
+ $$AnimationProvider,
+ $AnimateCssProvider,
+ $$AnimateCssDriverProvider,
+ $$AnimateJsProvider,
+ $$AnimateJsDriverProvider,
+*/
+
+/**
+ * @ngdoc module
+ * @name ngAnimate
+ * @description
+ *
+ * The `ngAnimate` module provides support for CSS-based animations (keyframes and transitions) as well as JavaScript-based animations via
+ * callback hooks. Animations are not enabled by default, however, by including `ngAnimate` the animation hooks are enabled for an Angular app.
+ *
+ * <div doc-module-components="ngAnimate"></div>
+ *
+ * # Usage
+ * Simply put, there are two ways to make use of animations when ngAnimate is used: by using **CSS** and **JavaScript**. The former works purely based
+ * using CSS (by using matching CSS selectors/styles) and the latter triggers animations that are registered via `module.animation()`. For
+ * both CSS and JS animations the sole requirement is to have a matching `CSS class` that exists both in the registered animation and within
+ * the HTML element that the animation will be triggered on.
+ *
+ * ## Directive Support
+ * The following directives are "animation aware":
+ *
+ * | Directive | Supported Animations |
+ * |----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
+ * | {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave and move |
+ * | {@link ngRoute.directive:ngView#animations ngView} | enter and leave |
+ * | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave |
+ * | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave |
+ * | {@link ng.directive:ngIf#animations ngIf} | enter and leave |
+ * | {@link ng.directive:ngClass#animations ngClass} | add and remove (the CSS class(es) present) |
+ * | {@link ng.directive:ngShow#animations ngShow} & {@link ng.directive:ngHide#animations ngHide} | add and remove (the ng-hide class value) |
+ * | {@link ng.directive:form#animation-hooks form} & {@link ng.directive:ngModel#animation-hooks ngModel} | add and remove (dirty, pristine, valid, invalid & all other validations) |
+ * | {@link module:ngMessages#animations ngMessages} | add and remove (ng-active & ng-inactive) |
+ * | {@link module:ngMessages#animations ngMessage} | enter and leave |
+ *
+ * (More information can be found by visiting each the documentation associated with each directive.)
+ *
+ * ## CSS-based Animations
+ *
+ * CSS-based animations with ngAnimate are unique since they require no JavaScript code at all. By using a CSS class that we reference between our HTML
+ * and CSS code we can create an animation that will be picked up by Angular when an the underlying directive performs an operation.
+ *
+ * The example below shows how an `enter` animation can be made possible on an element using `ng-if`:
+ *
+ * ```html
+ * <div ng-if="bool" class="fade">
+ * Fade me in out
+ * </div>
+ * <button ng-click="bool=true">Fade In!</button>
+ * <button ng-click="bool=false">Fade Out!</button>
+ * ```
+ *
+ * Notice the CSS class **fade**? We can now create the CSS transition code that references this class:
+ *
+ * ```css
+ * /&#42; The starting CSS styles for the enter animation &#42;/
+ * .fade.ng-enter {
+ * transition:0.5s linear all;
+ * opacity:0;
+ * }
+ *
+ * /&#42; The finishing CSS styles for the enter animation &#42;/
+ * .fade.ng-enter.ng-enter-active {
+ * opacity:1;
+ * }
+ * ```
+ *
+ * The key thing to remember here is that, depending on the animation event (which each of the directives above trigger depending on what's going on) two
+ * generated CSS classes will be applied to the element; in the example above we have `.ng-enter` and `.ng-enter-active`. For CSS transitions, the transition
+ * code **must** be defined within the starting CSS class (in this case `.ng-enter`). The destination class is what the transition will animate towards.
+ *
+ * If for example we wanted to create animations for `leave` and `move` (ngRepeat triggers move) then we can do so using the same CSS naming conventions:
+ *
+ * ```css
+ * /&#42; now the element will fade out before it is removed from the DOM &#42;/
+ * .fade.ng-leave {
+ * transition:0.5s linear all;
+ * opacity:1;
+ * }
+ * .fade.ng-leave.ng-leave-active {
+ * opacity:0;
+ * }
+ * ```
+ *
+ * We can also make use of **CSS Keyframes** by referencing the keyframe animation within the starting CSS class:
+ *
+ * ```css
+ * /&#42; there is no need to define anything inside of the destination
+ * CSS class since the keyframe will take charge of the animation &#42;/
+ * .fade.ng-leave {
+ * animation: my_fade_animation 0.5s linear;
+ * -webkit-animation: my_fade_animation 0.5s linear;
+ * }
+ *
+ * @keyframes my_fade_animation {
+ * from { opacity:1; }
+ * to { opacity:0; }
+ * }
+ *
+ * @-webkit-keyframes my_fade_animation {
+ * from { opacity:1; }
+ * to { opacity:0; }
+ * }
+ * ```
+ *
+ * Feel free also mix transitions and keyframes together as well as any other CSS classes on the same element.
+ *
+ * ### CSS Class-based Animations
+ *
+ * Class-based animations (animations that are triggered via `ngClass`, `ngShow`, `ngHide` and some other directives) have a slightly different
+ * naming convention. Class-based animations are basic enough that a standard transition or keyframe can be referenced on the class being added
+ * and removed.
+ *
+ * For example if we wanted to do a CSS animation for `ngHide` then we place an animation on the `.ng-hide` CSS class:
+ *
+ * ```html
+ * <div ng-show="bool" class="fade">
+ * Show and hide me
+ * </div>
+ * <button ng-click="bool=true">Toggle</button>
+ *
+ * <style>
+ * .fade.ng-hide {
+ * transition:0.5s linear all;
+ * opacity:0;
+ * }
+ * </style>
+ * ```
+ *
+ * All that is going on here with ngShow/ngHide behind the scenes is the `.ng-hide` class is added/removed (when the hidden state is valid). Since
+ * ngShow and ngHide are animation aware then we can match up a transition and ngAnimate handles the rest.
+ *
+ * In addition the addition and removal of the CSS class, ngAnimate also provides two helper methods that we can use to further decorate the animation
+ * with CSS styles.
+ *
+ * ```html
+ * <div ng-class="{on:onOff}" class="highlight">
+ * Highlight this box
+ * </div>
+ * <button ng-click="onOff=!onOff">Toggle</button>
+ *
+ * <style>
+ * .highlight {
+ * transition:0.5s linear all;
+ * }
+ * .highlight.on-add {
+ * background:white;
+ * }
+ * .highlight.on {
+ * background:yellow;
+ * }
+ * .highlight.on-remove {
+ * background:black;
+ * }
+ * </style>
+ * ```
+ *
+ * We can also make use of CSS keyframes by placing them within the CSS classes.
+ *
+ *
+ * ### CSS Staggering Animations
+ * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a
+ * curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be
+ * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for
+ * the animation. The style property expected within the stagger class can either be a **transition-delay** or an
+ * **animation-delay** property (or both if your animation contains both transitions and keyframe animations).
+ *
+ * ```css
+ * .my-animation.ng-enter {
+ * /&#42; standard transition code &#42;/
+ * transition: 1s linear all;
+ * opacity:0;
+ * }
+ * .my-animation.ng-enter-stagger {
+ * /&#42; this will have a 100ms delay between each successive leave animation &#42;/
+ * transition-delay: 0.1s;
+ *
+ * /&#42; As of 1.4.4, this must always be set: it signals ngAnimate
+ * to not accidentally inherit a delay property from another CSS class &#42;/
+ * transition-duration: 0s;
+ * }
+ * .my-animation.ng-enter.ng-enter-active {
+ * /&#42; standard transition styles &#42;/
+ * opacity:1;
+ * }
+ * ```
+ *
+ * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations
+ * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this
+ * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation
+ * will also be reset if one or more animation frames have passed since the multiple calls to `$animate` were fired.
+ *
+ * The following code will issue the **ng-leave-stagger** event on the element provided:
+ *
+ * ```js
+ * var kids = parent.children();
+ *
+ * $animate.leave(kids[0]); //stagger index=0
+ * $animate.leave(kids[1]); //stagger index=1
+ * $animate.leave(kids[2]); //stagger index=2
+ * $animate.leave(kids[3]); //stagger index=3
+ * $animate.leave(kids[4]); //stagger index=4
+ *
+ * window.requestAnimationFrame(function() {
+ * //stagger has reset itself
+ * $animate.leave(kids[5]); //stagger index=0
+ * $animate.leave(kids[6]); //stagger index=1
+ *
+ * $scope.$digest();
+ * });
+ * ```
+ *
+ * Stagger animations are currently only supported within CSS-defined animations.
+ *
+ * ### The `ng-animate` CSS class
+ *
+ * When ngAnimate is animating an element it will apply the `ng-animate` CSS class to the element for the duration of the animation.
+ * This is a temporary CSS class and it will be removed once the animation is over (for both JavaScript and CSS-based animations).
+ *
+ * Therefore, animations can be applied to an element using this temporary class directly via CSS.
+ *
+ * ```css
+ * .zipper.ng-animate {
+ * transition:0.5s linear all;
+ * }
+ * .zipper.ng-enter {
+ * opacity:0;
+ * }
+ * .zipper.ng-enter.ng-enter-active {
+ * opacity:1;
+ * }
+ * .zipper.ng-leave {
+ * opacity:1;
+ * }
+ * .zipper.ng-leave.ng-leave-active {
+ * opacity:0;
+ * }
+ * ```
+ *
+ * (Note that the `ng-animate` CSS class is reserved and it cannot be applied on an element directly since ngAnimate will always remove
+ * the CSS class once an animation has completed.)
+ *
+ *
+ * ### The `ng-[event]-prepare` class
+ *
+ * This is a special class that can be used to prevent unwanted flickering / flash of content before
+ * the actual animation starts. The class is added as soon as an animation is initialized, but removed
+ * before the actual animation starts (after waiting for a $digest).
+ * It is also only added for *structural* animations (`enter`, `move`, and `leave`).
+ *
+ * In practice, flickering can appear when nesting elements with structural animations such as `ngIf`
+ * into elements that have class-based animations such as `ngClass`.
+ *
+ * ```html
+ * <div ng-class="{red: myProp}">
+ * <div ng-class="{blue: myProp}">
+ * <div class="message" ng-if="myProp"></div>
+ * </div>
+ * </div>
+ * ```
+ *
+ * It is possible that during the `enter` animation, the `.message` div will be briefly visible before it starts animating.
+ * In that case, you can add styles to the CSS that make sure the element stays hidden before the animation starts:
+ *
+ * ```css
+ * .message.ng-enter-prepare {
+ * opacity: 0;
+ * }
+ *
+ * ```
+ *
+ * ## JavaScript-based Animations
+ *
+ * ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared
+ * CSS class that is referenced in our HTML code) but in addition we need to register the JavaScript animation on the module. By making use of the
+ * `module.animation()` module function we can register the animation.
+ *
+ * Let's see an example of a enter/leave animation using `ngRepeat`:
+ *
+ * ```html
+ * <div ng-repeat="item in items" class="slide">
+ * {{ item }}
+ * </div>
+ * ```
+ *
+ * See the **slide** CSS class? Let's use that class to define an animation that we'll structure in our module code by using `module.animation`:
+ *
+ * ```js
+ * myModule.animation('.slide', [function() {
+ * return {
+ * // make note that other events (like addClass/removeClass)
+ * // have different function input parameters
+ * enter: function(element, doneFn) {
+ * jQuery(element).fadeIn(1000, doneFn);
+ *
+ * // remember to call doneFn so that angular
+ * // knows that the animation has concluded
+ * },
+ *
+ * move: function(element, doneFn) {
+ * jQuery(element).fadeIn(1000, doneFn);
+ * },
+ *
+ * leave: function(element, doneFn) {
+ * jQuery(element).fadeOut(1000, doneFn);
+ * }
+ * }
+ * }]);
+ * ```
+ *
+ * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as
+ * greensock.js and velocity.js.
+ *
+ * If our animation code class-based (meaning that something like `ngClass`, `ngHide` and `ngShow` triggers it) then we can still define
+ * our animations inside of the same registered animation, however, the function input arguments are a bit different:
+ *
+ * ```html
+ * <div ng-class="color" class="colorful">
+ * this box is moody
+ * </div>
+ * <button ng-click="color='red'">Change to red</button>
+ * <button ng-click="color='blue'">Change to blue</button>
+ * <button ng-click="color='green'">Change to green</button>
+ * ```
+ *
+ * ```js
+ * myModule.animation('.colorful', [function() {
+ * return {
+ * addClass: function(element, className, doneFn) {
+ * // do some cool animation and call the doneFn
+ * },
+ * removeClass: function(element, className, doneFn) {
+ * // do some cool animation and call the doneFn
+ * },
+ * setClass: function(element, addedClass, removedClass, doneFn) {
+ * // do some cool animation and call the doneFn
+ * }
+ * }
+ * }]);
+ * ```
+ *
+ * ## CSS + JS Animations Together
+ *
+ * AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of Angular,
+ * defining CSS and JS animations to work off of the same CSS class will not work anymore. Therefore the example below will only result in **JS animations taking
+ * charge of the animation**:
+ *
+ * ```html
+ * <div ng-if="bool" class="slide">
+ * Slide in and out
+ * </div>
+ * ```
+ *
+ * ```js
+ * myModule.animation('.slide', [function() {
+ * return {
+ * enter: function(element, doneFn) {
+ * jQuery(element).slideIn(1000, doneFn);
+ * }
+ * }
+ * }]);
+ * ```
+ *
+ * ```css
+ * .slide.ng-enter {
+ * transition:0.5s linear all;
+ * transform:translateY(-100px);
+ * }
+ * .slide.ng-enter.ng-enter-active {
+ * transform:translateY(0);
+ * }
+ * ```
+ *
+ * Does this mean that CSS and JS animations cannot be used together? Do JS-based animations always have higher priority? We can make up for the
+ * lack of CSS animations by using the `$animateCss` service to trigger our own tweaked-out, CSS-based animations directly from
+ * our own JS-based animation code:
+ *
+ * ```js
+ * myModule.animation('.slide', ['$animateCss', function($animateCss) {
+ * return {
+ * enter: function(element) {
+* // this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`.
+ * return $animateCss(element, {
+ * event: 'enter',
+ * structural: true
+ * });
+ * }
+ * }
+ * }]);
+ * ```
+ *
+ * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework.
+ *
+ * The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or
+ * keyframe animation. For example if we wanted to animate the height of an element while adding and removing classes then we can do so by providing that
+ * data into `$animateCss` directly:
+ *
+ * ```js
+ * myModule.animation('.slide', ['$animateCss', function($animateCss) {
+ * return {
+ * enter: function(element) {
+ * return $animateCss(element, {
+ * event: 'enter',
+ * structural: true,
+ * addClass: 'maroon-setting',
+ * from: { height:0 },
+ * to: { height: 200 }
+ * });
+ * }
+ * }
+ * }]);
+ * ```
+ *
+ * Now we can fill in the rest via our transition CSS code:
+ *
+ * ```css
+ * /&#42; the transition tells ngAnimate to make the animation happen &#42;/
+ * .slide.ng-enter { transition:0.5s linear all; }
+ *
+ * /&#42; this extra CSS class will be absorbed into the transition
+ * since the $animateCss code is adding the class &#42;/
+ * .maroon-setting { background:red; }
+ * ```
+ *
+ * And `$animateCss` will figure out the rest. Just make sure to have the `done()` callback fire the `doneFn` function to signal when the animation is over.
+ *
+ * To learn more about what's possible be sure to visit the {@link ngAnimate.$animateCss $animateCss service}.
+ *
+ * ## Animation Anchoring (via `ng-animate-ref`)
+ *
+ * ngAnimate in AngularJS 1.4 comes packed with the ability to cross-animate elements between
+ * structural areas of an application (like views) by pairing up elements using an attribute
+ * called `ng-animate-ref`.
+ *
+ * Let's say for example we have two views that are managed by `ng-view` and we want to show
+ * that there is a relationship between two components situated in within these views. By using the
+ * `ng-animate-ref` attribute we can identify that the two components are paired together and we
+ * can then attach an animation, which is triggered when the view changes.
+ *
+ * Say for example we have the following template code:
+ *
+ * ```html
+ * <!-- index.html -->
+ * <div ng-view class="view-animation">
+ * </div>
+ *
+ * <!-- home.html -->
+ * <a href="#/banner-page">
+ * <img src="./banner.jpg" class="banner" ng-animate-ref="banner">
+ * </a>
+ *
+ * <!-- banner-page.html -->
+ * <img src="./banner.jpg" class="banner" ng-animate-ref="banner">
+ * ```
+ *
+ * Now, when the view changes (once the link is clicked), ngAnimate will examine the
+ * HTML contents to see if there is a match reference between any components in the view
+ * that is leaving and the view that is entering. It will scan both the view which is being
+ * removed (leave) and inserted (enter) to see if there are any paired DOM elements that
+ * contain a matching ref value.
+ *
+ * The two images match since they share the same ref value. ngAnimate will now create a
+ * transport element (which is a clone of the first image element) and it will then attempt
+ * to animate to the position of the second image element in the next view. For the animation to
+ * work a special CSS class called `ng-anchor` will be added to the transported element.
+ *
+ * We can now attach a transition onto the `.banner.ng-anchor` CSS class and then
+ * ngAnimate will handle the entire transition for us as well as the addition and removal of
+ * any changes of CSS classes between the elements:
+ *
+ * ```css
+ * .banner.ng-anchor {
+ * /&#42; this animation will last for 1 second since there are
+ * two phases to the animation (an `in` and an `out` phase) &#42;/
+ * transition:0.5s linear all;
+ * }
+ * ```
+ *
+ * We also **must** include animations for the views that are being entered and removed
+ * (otherwise anchoring wouldn't be possible since the new view would be inserted right away).
+ *
+ * ```css
+ * .view-animation.ng-enter, .view-animation.ng-leave {
+ * transition:0.5s linear all;
+ * position:fixed;
+ * left:0;
+ * top:0;
+ * width:100%;
+ * }
+ * .view-animation.ng-enter {
+ * transform:translateX(100%);
+ * }
+ * .view-animation.ng-leave,
+ * .view-animation.ng-enter.ng-enter-active {
+ * transform:translateX(0%);
+ * }
+ * .view-animation.ng-leave.ng-leave-active {
+ * transform:translateX(-100%);
+ * }
+ * ```
+ *
+ * Now we can jump back to the anchor animation. When the animation happens, there are two stages that occur:
+ * an `out` and an `in` stage. The `out` stage happens first and that is when the element is animated away
+ * from its origin. Once that animation is over then the `in` stage occurs which animates the
+ * element to its destination. The reason why there are two animations is to give enough time
+ * for the enter animation on the new element to be ready.
+ *
+ * The example above sets up a transition for both the in and out phases, but we can also target the out or
+ * in phases directly via `ng-anchor-out` and `ng-anchor-in`.
+ *
+ * ```css
+ * .banner.ng-anchor-out {
+ * transition: 0.5s linear all;
+ *
+ * /&#42; the scale will be applied during the out animation,
+ * but will be animated away when the in animation runs &#42;/
+ * transform: scale(1.2);
+ * }
+ *
+ * .banner.ng-anchor-in {
+ * transition: 1s linear all;
+ * }
+ * ```
+ *
+ *
+ *
+ *
+ * ### Anchoring Demo
+ *
+ <example module="anchoringExample"
+ name="anchoringExample"
+ id="anchoringExample"
+ deps="angular-animate.js;angular-route.js"
+ animations="true">
+ <file name="index.html">
+ <a href="#/">Home</a>
+ <hr />
+ <div class="view-container">
+ <div ng-view class="view"></div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('anchoringExample', ['ngAnimate', 'ngRoute'])
+ .config(['$routeProvider', function($routeProvider) {
+ $routeProvider.when('/', {
+ templateUrl: 'home.html',
+ controller: 'HomeController as home'
+ });
+ $routeProvider.when('/profile/:id', {
+ templateUrl: 'profile.html',
+ controller: 'ProfileController as profile'
+ });
+ }])
+ .run(['$rootScope', function($rootScope) {
+ $rootScope.records = [
+ { id:1, title: "Miss Beulah Roob" },
+ { id:2, title: "Trent Morissette" },
+ { id:3, title: "Miss Ava Pouros" },
+ { id:4, title: "Rod Pouros" },
+ { id:5, title: "Abdul Rice" },
+ { id:6, title: "Laurie Rutherford Sr." },
+ { id:7, title: "Nakia McLaughlin" },
+ { id:8, title: "Jordon Blanda DVM" },
+ { id:9, title: "Rhoda Hand" },
+ { id:10, title: "Alexandrea Sauer" }
+ ];
+ }])
+ .controller('HomeController', [function() {
+ //empty
+ }])
+ .controller('ProfileController', ['$rootScope', '$routeParams', function($rootScope, $routeParams) {
+ var index = parseInt($routeParams.id, 10);
+ var record = $rootScope.records[index - 1];
+
+ this.title = record.title;
+ this.id = record.id;
+ }]);
+ </file>
+ <file name="home.html">
+ <h2>Welcome to the home page</h1>
+ <p>Please click on an element</p>
+ <a class="record"
+ ng-href="#/profile/{{ record.id }}"
+ ng-animate-ref="{{ record.id }}"
+ ng-repeat="record in records">
+ {{ record.title }}
+ </a>
+ </file>
+ <file name="profile.html">
+ <div class="profile record" ng-animate-ref="{{ profile.id }}">
+ {{ profile.title }}
+ </div>
+ </file>
+ <file name="animations.css">
+ .record {
+ display:block;
+ font-size:20px;
+ }
+ .profile {
+ background:black;
+ color:white;
+ font-size:100px;
+ }
+ .view-container {
+ position:relative;
+ }
+ .view-container > .view.ng-animate {
+ position:absolute;
+ top:0;
+ left:0;
+ width:100%;
+ min-height:500px;
+ }
+ .view.ng-enter, .view.ng-leave,
+ .record.ng-anchor {
+ transition:0.5s linear all;
+ }
+ .view.ng-enter {
+ transform:translateX(100%);
+ }
+ .view.ng-enter.ng-enter-active, .view.ng-leave {
+ transform:translateX(0%);
+ }
+ .view.ng-leave.ng-leave-active {
+ transform:translateX(-100%);
+ }
+ .record.ng-anchor-out {
+ background:red;
+ }
+ </file>
+ </example>
+ *
+ * ### How is the element transported?
+ *
+ * When an anchor animation occurs, ngAnimate will clone the starting element and position it exactly where the starting
+ * element is located on screen via absolute positioning. The cloned element will be placed inside of the root element
+ * of the application (where ng-app was defined) and all of the CSS classes of the starting element will be applied. The
+ * element will then animate into the `out` and `in` animations and will eventually reach the coordinates and match
+ * the dimensions of the destination element. During the entire animation a CSS class of `.ng-animate-shim` will be applied
+ * to both the starting and destination elements in order to hide them from being visible (the CSS styling for the class
+ * is: `visibility:hidden`). Once the anchor reaches its destination then it will be removed and the destination element
+ * will become visible since the shim class will be removed.
+ *
+ * ### How is the morphing handled?
+ *
+ * CSS Anchoring relies on transitions and keyframes and the internal code is intelligent enough to figure out
+ * what CSS classes differ between the starting element and the destination element. These different CSS classes
+ * will be added/removed on the anchor element and a transition will be applied (the transition that is provided
+ * in the anchor class). Long story short, ngAnimate will figure out what classes to add and remove which will
+ * make the transition of the element as smooth and automatic as possible. Be sure to use simple CSS classes that
+ * do not rely on DOM nesting structure so that the anchor element appears the same as the starting element (since
+ * the cloned element is placed inside of root element which is likely close to the body element).
+ *
+ * Note that if the root element is on the `<html>` element then the cloned node will be placed inside of body.
+ *
+ *
+ * ## Using $animate in your directive code
+ *
+ * So far we've explored how to feed in animations into an Angular application, but how do we trigger animations within our own directives in our application?
+ * By injecting the `$animate` service into our directive code, we can trigger structural and class-based hooks which can then be consumed by animations. Let's
+ * imagine we have a greeting box that shows and hides itself when the data changes
+ *
+ * ```html
+ * <greeting-box active="onOrOff">Hi there</greeting-box>
+ * ```
+ *
+ * ```js
+ * ngModule.directive('greetingBox', ['$animate', function($animate) {
+ * return function(scope, element, attrs) {
+ * attrs.$observe('active', function(value) {
+ * value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on');
+ * });
+ * });
+ * }]);
+ * ```
+ *
+ * Now the `on` CSS class is added and removed on the greeting box component. Now if we add a CSS class on top of the greeting box element
+ * in our HTML code then we can trigger a CSS or JS animation to happen.
+ *
+ * ```css
+ * /&#42; normally we would create a CSS class to reference on the element &#42;/
+ * greeting-box.on { transition:0.5s linear all; background:green; color:white; }
+ * ```
+ *
+ * The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's
+ * possible be sure to visit the {@link ng.$animate $animate service API page}.
+ *
+ *
+ * ### Preventing Collisions With Third Party Libraries
+ *
+ * Some third-party frameworks place animation duration defaults across many element or className
+ * selectors in order to make their code small and reuseable. This can lead to issues with ngAnimate, which
+ * is expecting actual animations on these elements and has to wait for their completion.
+ *
+ * You can prevent this unwanted behavior by using a prefix on all your animation classes:
+ *
+ * ```css
+ * /&#42; prefixed with animate- &#42;/
+ * .animate-fade-add.animate-fade-add-active {
+ * transition:1s linear all;
+ * opacity:0;
+ * }
+ * ```
+ *
+ * You then configure `$animate` to enforce this prefix:
+ *
+ * ```js
+ * $animateProvider.classNameFilter(/animate-/);
+ * ```
+ *
+ * This also may provide your application with a speed boost since only specific elements containing CSS class prefix
+ * will be evaluated for animation when any DOM changes occur in the application.
+ *
+ * ## Callbacks and Promises
+ *
+ * When `$animate` is called it returns a promise that can be used to capture when the animation has ended. Therefore if we were to trigger
+ * an animation (within our directive code) then we can continue performing directive and scope related activities after the animation has
+ * ended by chaining onto the returned promise that animation method returns.
+ *
+ * ```js
+ * // somewhere within the depths of the directive
+ * $animate.enter(element, parent).then(function() {
+ * //the animation has completed
+ * });
+ * ```
+ *
+ * (Note that earlier versions of Angular prior to v1.4 required the promise code to be wrapped using `$scope.$apply(...)`. This is not the case
+ * anymore.)
+ *
+ * In addition to the animation promise, we can also make use of animation-related callbacks within our directives and controller code by registering
+ * an event listener using the `$animate` service. Let's say for example that an animation was triggered on our view
+ * routing controller to hook into that:
+ *
+ * ```js
+ * ngModule.controller('HomePageController', ['$animate', function($animate) {
+ * $animate.on('enter', ngViewElement, function(element) {
+ * // the animation for this route has completed
+ * }]);
+ * }])
+ * ```
+ *
+ * (Note that you will need to trigger a digest within the callback to get angular to notice any scope-related changes.)
+ */
+
+/**
+ * @ngdoc service
+ * @name $animate
+ * @kind object
+ *
+ * @description
+ * The ngAnimate `$animate` service documentation is the same for the core `$animate` service.
+ *
+ * Click here {@link ng.$animate to learn more about animations with `$animate`}.
+ */
+angular.module('ngAnimate', [])
+ .directive('ngAnimateSwap', ngAnimateSwapDirective)
+
+ .directive('ngAnimateChildren', $$AnimateChildrenDirective)
+ .factory('$$rAFScheduler', $$rAFSchedulerFactory)
+
+ .provider('$$animateQueue', $$AnimateQueueProvider)
+ .provider('$$animation', $$AnimationProvider)
+
+ .provider('$animateCss', $AnimateCssProvider)
+ .provider('$$animateCssDriver', $$AnimateCssDriverProvider)
+
+ .provider('$$animateJs', $$AnimateJsProvider)
+ .provider('$$animateJsDriver', $$AnimateJsDriverProvider);
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.min.js
new file mode 100644
index 00000000..8e8e41df
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.min.js
@@ -0,0 +1,56 @@
+/*
+ AngularJS v1.5.0
+ (c) 2010-2016 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(D,r,Va){'use strict';function ya(a,b,c){if(!a)throw Ka("areq",b||"?",c||"required");return a}function za(a,b){if(!a&&!b)return"";if(!a)return b;if(!b)return a;ba(a)&&(a=a.join(" "));ba(b)&&(b=b.join(" "));return a+" "+b}function La(a){var b={};a&&(a.to||a.from)&&(b.to=a.to,b.from=a.from);return b}function X(a,b,c){var d="";a=ba(a)?a:a&&R(a)&&a.length?a.split(/\s+/):[];s(a,function(a,g){a&&0<a.length&&(d+=0<g?" ":"",d+=c?b+a:a+b)});return d}function Ma(a){if(a instanceof I)switch(a.length){case 0:return[];
+case 1:if(1===a[0].nodeType)return a;break;default:return I(oa(a))}if(1===a.nodeType)return I(a)}function oa(a){if(!a[0])return a;for(var b=0;b<a.length;b++){var c=a[b];if(1==c.nodeType)return c}}function Na(a,b,c){s(b,function(b){a.addClass(b,c)})}function Oa(a,b,c){s(b,function(b){a.removeClass(b,c)})}function U(a){return function(b,c){c.addClass&&(Na(a,b,c.addClass),c.addClass=null);c.removeClass&&(Oa(a,b,c.removeClass),c.removeClass=null)}}function ka(a){a=a||{};if(!a.$$prepared){var b=a.domOperation||
+Q;a.domOperation=function(){a.$$domOperationFired=!0;b();b=Q};a.$$prepared=!0}return a}function fa(a,b){Aa(a,b);Ba(a,b)}function Aa(a,b){b.from&&(a.css(b.from),b.from=null)}function Ba(a,b){b.to&&(a.css(b.to),b.to=null)}function V(a,b,c){var d=b.options||{};c=c.options||{};var e=(d.addClass||"")+" "+(c.addClass||""),g=(d.removeClass||"")+" "+(c.removeClass||"");a=Pa(a.attr("class"),e,g);c.preparationClasses&&(d.preparationClasses=ca(c.preparationClasses,d.preparationClasses),delete c.preparationClasses);
+e=d.domOperation!==Q?d.domOperation:null;Ca(d,c);e&&(d.domOperation=e);d.addClass=a.addClass?a.addClass:null;d.removeClass=a.removeClass?a.removeClass:null;b.addClass=d.addClass;b.removeClass=d.removeClass;return d}function Pa(a,b,c){function d(a){R(a)&&(a=a.split(" "));var b={};s(a,function(a){a.length&&(b[a]=!0)});return b}var e={};a=d(a);b=d(b);s(b,function(a,b){e[b]=1});c=d(c);s(c,function(a,b){e[b]=1===e[b]?null:-1});var g={addClass:"",removeClass:""};s(e,function(b,c){var d,e;1===b?(d="addClass",
+e=!a[c]):-1===b&&(d="removeClass",e=a[c]);e&&(g[d].length&&(g[d]+=" "),g[d]+=c)});return g}function G(a){return a instanceof r.element?a[0]:a}function Qa(a,b,c){var d="";b&&(d=X(b,"ng-",!0));c.addClass&&(d=ca(d,X(c.addClass,"-add")));c.removeClass&&(d=ca(d,X(c.removeClass,"-remove")));d.length&&(c.preparationClasses=d,a.addClass(d))}function la(a,b){var c=b?"-"+b+"s":"";ha(a,[ia,c]);return[ia,c]}function pa(a,b){var c=b?"paused":"",d=Y+"PlayState";ha(a,[d,c]);return[d,c]}function ha(a,b){a.style[b[0]]=
+b[1]}function ca(a,b){return a?b?a+" "+b:a:b}function Da(a,b,c){var d=Object.create(null),e=a.getComputedStyle(b)||{};s(c,function(a,b){var c=e[a];if(c){var C=c.charAt(0);if("-"===C||"+"===C||0<=C)c=Ra(c);0===c&&(c=null);d[b]=c}});return d}function Ra(a){var b=0;a=a.split(/\s*,\s*/);s(a,function(a){"s"==a.charAt(a.length-1)&&(a=a.substring(0,a.length-1));a=parseFloat(a)||0;b=b?Math.max(a,b):a});return b}function qa(a){return 0===a||null!=a}function Ea(a,b){var c=S,d=a+"s";b?c+="Duration":d+=" linear all";
+return[c,d]}function Fa(){var a=Object.create(null);return{flush:function(){a=Object.create(null)},count:function(b){return(b=a[b])?b.total:0},get:function(b){return(b=a[b])&&b.value},put:function(b,c){a[b]?a[b].total++:a[b]={total:1,value:c}}}}function Ga(a,b,c){s(c,function(c){a[c]=Z(a[c])?a[c]:b.style.getPropertyValue(c)})}var Q=r.noop,Ha=r.copy,Ca=r.extend,I=r.element,s=r.forEach,ba=r.isArray,R=r.isString,ra=r.isObject,P=r.isUndefined,Z=r.isDefined,Ia=r.isFunction,sa=r.isElement,S,ta,Y,ua;P(D.ontransitionend)&&
+Z(D.onwebkittransitionend)?(S="WebkitTransition",ta="webkitTransitionEnd transitionend"):(S="transition",ta="transitionend");P(D.onanimationend)&&Z(D.onwebkitanimationend)?(Y="WebkitAnimation",ua="webkitAnimationEnd animationend"):(Y="animation",ua="animationend");var ma=Y+"Delay",va=Y+"Duration",ia=S+"Delay";D=S+"Duration";var Ka=r.$$minErr("ng"),Sa={transitionDuration:D,transitionDelay:ia,transitionProperty:S+"Property",animationDuration:va,animationDelay:ma,animationIterationCount:Y+"IterationCount"},
+Ta={transitionDuration:D,transitionDelay:ia,animationDuration:va,animationDelay:ma};r.module("ngAnimate",[]).directive("ngAnimateSwap",["$animate","$rootScope",function(a,b){return{restrict:"A",transclude:"element",terminal:!0,priority:600,link:function(b,d,e,g,H){var A,C;b.$watchCollection(e.ngAnimateSwap||e["for"],function(e){A&&a.leave(A);C&&(C.$destroy(),C=null);if(e||0===e)C=b.$new(),H(C,function(b){A=b;a.enter(b,null,d)})})}}}]).directive("ngAnimateChildren",["$interpolate",function(a){return{link:function(b,
+c,d){function e(a){c.data("$$ngAnimateChildren","on"===a||"true"===a)}var g=d.ngAnimateChildren;r.isString(g)&&0===g.length?c.data("$$ngAnimateChildren",!0):(e(a(g)(b)),d.$observe("ngAnimateChildren",e))}}}]).factory("$$rAFScheduler",["$$rAF",function(a){function b(a){d=d.concat(a);c()}function c(){if(d.length){for(var b=d.shift(),H=0;H<b.length;H++)b[H]();e||a(function(){e||c()})}}var d,e;d=b.queue=[];b.waitUntilQuiet=function(b){e&&e();e=a(function(){e=null;b();c()})};return b}]).provider("$$animateQueue",
+["$animateProvider",function(a){function b(a){if(!a)return null;a=a.split(" ");var b=Object.create(null);s(a,function(a){b[a]=!0});return b}function c(a,c){if(a&&c){var d=b(c);return a.split(" ").some(function(a){return d[a]})}}function d(a,b,c,d){return g[a].some(function(a){return a(b,c,d)})}function e(a,b){var c=0<(a.addClass||"").length,d=0<(a.removeClass||"").length;return b?c&&d:c||d}var g=this.rules={skip:[],cancel:[],join:[]};g.join.push(function(a,b,c){return!b.structural&&e(b)});g.skip.push(function(a,
+b,c){return!b.structural&&!e(b)});g.skip.push(function(a,b,c){return"leave"==c.event&&b.structural});g.skip.push(function(a,b,c){return c.structural&&2===c.state&&!b.structural});g.cancel.push(function(a,b,c){return c.structural&&b.structural});g.cancel.push(function(a,b,c){return 2===c.state&&b.structural});g.cancel.push(function(a,b,d){a=b.addClass;b=b.removeClass;var e=d.addClass;d=d.removeClass;return P(a)&&P(b)||P(e)&&P(d)?!1:c(a,d)||c(b,e)});this.$get=["$$rAF","$rootScope","$rootElement","$document",
+"$$HashMap","$$animation","$$AnimateRunner","$templateRequest","$$jqLite","$$forceReflow",function(b,c,g,m,M,r,u,na,v,z){function K(){var a=!1;return function(b){a?b():c.$$postDigest(function(){a=!0;b()})}}function J(a,b,c){var f=G(b),d=G(a),h=[];(a=x[c])&&s(a,function(a){y.call(a.node,f)?h.push(a.callback):"leave"===c&&y.call(a.node,d)&&h.push(a.callback)});return h}function h(a,f,h){function l(c,f,d,h){g(function(){var c=J(y,a,f);c.length&&b(function(){s(c,function(b){b(a,d,h)})})});c.progress(f,
+d,h)}function x(b){var c=a,f=n;f.preparationClasses&&(c.removeClass(f.preparationClasses),f.preparationClasses=null);f.activeClasses&&(c.removeClass(f.activeClasses),f.activeClasses=null);Ja(a,n);fa(a,n);n.domOperation();k.complete(!b)}var n=Ha(h),z,y;if(a=Ma(a))z=G(a),y=a.parent();var n=ka(n),k=new u,g=K();ba(n.addClass)&&(n.addClass=n.addClass.join(" "));n.addClass&&!R(n.addClass)&&(n.addClass=null);ba(n.removeClass)&&(n.removeClass=n.removeClass.join(" "));n.removeClass&&!R(n.removeClass)&&(n.removeClass=
+null);n.from&&!ra(n.from)&&(n.from=null);n.to&&!ra(n.to)&&(n.to=null);if(!z)return x(),k;h=[z.className,n.addClass,n.removeClass].join(" ");if(!Ua(h))return x(),k;var C=0<=["enter","move","leave"].indexOf(f),w=!L||m[0].hidden||E.get(z);h=!w&&B.get(z)||{};var v=!!h.state;w||v&&1==h.state||(w=!q(a,y,f));if(w)return x(),k;C&&xa(a);w={structural:C,element:a,event:f,addClass:n.addClass,removeClass:n.removeClass,close:x,options:n,runner:k};if(v){if(d("skip",a,w,h)){if(2===h.state)return x(),k;V(a,h,w);
+return h.runner}if(d("cancel",a,w,h))if(2===h.state)h.runner.end();else if(h.structural)h.close();else return V(a,h,w),h.runner;else if(d("join",a,w,h))if(2===h.state)V(a,w,{});else return Qa(a,C?f:null,n),f=w.event=h.event,n=V(a,h,w),h.runner}else V(a,w,{});(v=w.structural)||(v="animate"===w.event&&0<Object.keys(w.options.to||{}).length||e(w));if(!v)return x(),N(a),k;var M=(h.counter||0)+1;w.counter=M;t(a,1,w);c.$$postDigest(function(){var b=B.get(z),c=!b,b=b||{},d=0<(a.parent()||[]).length&&("animate"===
+b.event||b.structural||e(b));if(c||b.counter!==M||!d){c&&(Ja(a,n),fa(a,n));if(c||C&&b.event!==f)n.domOperation(),k.end();d||N(a)}else f=!b.structural&&e(b,!0)?"setClass":b.event,t(a,2),b=r(a,f,b.options),b.done(function(b){x(!b);(b=B.get(z))&&b.counter===M&&N(G(a));l(k,f,"close",{})}),k.setHost(b),l(k,f,"start",{})});return k}function xa(a){a=G(a).querySelectorAll("[data-ng-animate]");s(a,function(a){var b=parseInt(a.getAttribute("data-ng-animate")),c=B.get(a);if(c)switch(b){case 2:c.runner.end();
+case 1:B.remove(a)}})}function N(a){a=G(a);a.removeAttribute("data-ng-animate");B.remove(a)}function k(a,b){return G(a)===G(b)}function q(a,b,c){c=I(m[0].body);var f=k(a,c)||"HTML"===a[0].nodeName,d=k(a,g),h=!1,l,e=E.get(G(a));for((a=a.data("$ngAnimatePin"))&&(b=a);b&&b.length;){d||(d=k(b,g));var x=b[0];if(1!==x.nodeType)break;a=B.get(x)||{};if(!h){x=E.get(x);if(!0===x&&!1!==e){e=!0;break}else!1===x&&(e=!1);h=a.structural}if(P(l)||!0===l)a=b.data("$$ngAnimateChildren"),Z(a)&&(l=a);if(h&&!1===l)break;
+f||(f=k(b,c));if(f&&d)break;if(!d&&(a=b.data("$ngAnimatePin"))){b=a;continue}b=b.parent()}return(!h||l)&&!0!==e&&d&&f}function t(a,b,c){c=c||{};c.state=b;a=G(a);a.setAttribute("data-ng-animate",b);c=(b=B.get(a))?Ca(b,c):c;B.put(a,c)}var B=new M,E=new M,L=null,f=c.$watch(function(){return 0===na.totalPendingRequests},function(a){a&&(f(),c.$$postDigest(function(){c.$$postDigest(function(){null===L&&(L=!0)})}))}),x={},l=a.classNameFilter(),Ua=l?function(a){return l.test(a)}:function(){return!0},Ja=U(v),
+y=Node.prototype.contains||function(a){return this===a||!!(this.compareDocumentPosition(a)&16)};return{on:function(a,b,c){b=oa(b);x[a]=x[a]||[];x[a].push({node:b,callback:c})},off:function(a,b,c){function f(a,b,c){var d=oa(b);return a.filter(function(a){return!(a.node===d&&(!c||a.callback===c))})}var d=x[a];d&&(x[a]=1===arguments.length?null:f(d,b,c))},pin:function(a,b){ya(sa(a),"element","not an element");ya(sa(b),"parentElement","not an element");a.data("$ngAnimatePin",b)},push:function(a,b,c,f){c=
+c||{};c.domOperation=f;return h(a,b,c)},enabled:function(a,b){var c=arguments.length;if(0===c)b=!!L;else if(sa(a)){var f=G(a),d=E.get(f);1===c?b=!d:E.put(f,!b)}else b=L=!!a;return b}}}]}]).provider("$$animation",["$animateProvider",function(a){function b(a){return a.data("$$animationRunner")}var c=this.drivers=[];this.$get=["$$jqLite","$rootScope","$injector","$$AnimateRunner","$$HashMap","$$rAFScheduler",function(a,e,g,H,A,C){function m(a){function b(a){if(a.processed)return a;a.processed=!0;var d=
+a.domNode,N=d.parentNode;e.put(d,a);for(var k;N;){if(k=e.get(N)){k.processed||(k=b(k));break}N=N.parentNode}(k||c).children.push(a);return a}var c={children:[]},d,e=new A;for(d=0;d<a.length;d++){var g=a[d];e.put(g.domNode,a[d]={domNode:g.domNode,fn:g.fn,children:[]})}for(d=0;d<a.length;d++)b(a[d]);return function(a){var b=[],c=[],d;for(d=0;d<a.children.length;d++)c.push(a.children[d]);a=c.length;var e=0,t=[];for(d=0;d<c.length;d++){var g=c[d];0>=a&&(a=e,e=0,b.push(t),t=[]);t.push(g.fn);g.children.forEach(function(a){e++;
+c.push(a)});a--}t.length&&b.push(t);return b}(c)}var M=[],r=U(a);return function(u,A,v){function z(a){a=a.hasAttribute("ng-animate-ref")?[a]:a.querySelectorAll("[ng-animate-ref]");var b=[];s(a,function(a){var c=a.getAttribute("ng-animate-ref");c&&c.length&&b.push(a)});return b}function K(a){var b=[],c={};s(a,function(a,f){var d=G(a.element),h=0<=["enter","move"].indexOf(a.event),d=a.structural?z(d):[];if(d.length){var e=h?"to":"from";s(d,function(a){var b=a.getAttribute("ng-animate-ref");c[b]=c[b]||
+{};c[b][e]={animationID:f,element:I(a)}})}else b.push(a)});var d={},h={};s(c,function(c,e){var l=c.from,t=c.to;if(l&&t){var g=a[l.animationID],E=a[t.animationID],k=l.animationID.toString();if(!h[k]){var z=h[k]={structural:!0,beforeStart:function(){g.beforeStart();E.beforeStart()},close:function(){g.close();E.close()},classes:J(g.classes,E.classes),from:g,to:E,anchors:[]};z.classes.length?b.push(z):(b.push(g),b.push(E))}h[k].anchors.push({out:l.element,"in":t.element})}else l=l?l.animationID:t.animationID,
+t=l.toString(),d[t]||(d[t]=!0,b.push(a[l]))});return b}function J(a,b){a=a.split(" ");b=b.split(" ");for(var c=[],d=0;d<a.length;d++){var h=a[d];if("ng-"!==h.substring(0,3))for(var e=0;e<b.length;e++)if(h===b[e]){c.push(h);break}}return c.join(" ")}function h(a){for(var b=c.length-1;0<=b;b--){var d=c[b];if(g.has(d)&&(d=g.get(d)(a)))return d}}function xa(a,c){a.from&&a.to?(b(a.from.element).setHost(c),b(a.to.element).setHost(c)):b(a.element).setHost(c)}function N(){var a=b(u);!a||"leave"===A&&v.$$domOperationFired||
+a.end()}function k(b){u.off("$destroy",N);u.removeData("$$animationRunner");r(u,v);fa(u,v);v.domOperation();E&&a.removeClass(u,E);u.removeClass("ng-animate");t.complete(!b)}v=ka(v);var q=0<=["enter","move","leave"].indexOf(A),t=new H({end:function(){k()},cancel:function(){k(!0)}});if(!c.length)return k(),t;u.data("$$animationRunner",t);var B=za(u.attr("class"),za(v.addClass,v.removeClass)),E=v.tempClasses;E&&(B+=" "+E,v.tempClasses=null);var L;q&&(L="ng-"+A+"-prepare",a.addClass(u,L));M.push({element:u,
+classes:B,event:A,structural:q,options:v,beforeStart:function(){u.addClass("ng-animate");E&&a.addClass(u,E);L&&(a.removeClass(u,L),L=null)},close:k});u.on("$destroy",N);if(1<M.length)return t;e.$$postDigest(function(){var a=[];s(M,function(c){b(c.element)?a.push(c):c.close()});M.length=0;var c=K(a),d=[];s(c,function(a){d.push({domNode:G(a.from?a.from.element:a.element),fn:function(){a.beforeStart();var c,d=a.close;if(b(a.anchors?a.from.element||a.to.element:a.element)){var f=h(a);f&&(c=f.start)}c?
+(c=c(),c.done(function(a){d(!a)}),xa(a,c)):d()}})});C(m(d))});return t}}]}]).provider("$animateCss",["$animateProvider",function(a){var b=Fa(),c=Fa();this.$get=["$window","$$jqLite","$$AnimateRunner","$timeout","$$forceReflow","$sniffer","$$rAFScheduler","$$animateQueue",function(a,e,g,H,A,C,m,M){function r(a,b){var c=a.parentNode;return(c.$$ngAnimateParentKey||(c.$$ngAnimateParentKey=++K))+"-"+a.getAttribute("class")+"-"+b}function u(h,g,z,k){var q;0<b.count(z)&&(q=c.get(z),q||(g=X(g,"-stagger"),
+e.addClass(h,g),q=Da(a,h,k),q.animationDuration=Math.max(q.animationDuration,0),q.transitionDuration=Math.max(q.transitionDuration,0),e.removeClass(h,g),c.put(z,q)));return q||{}}function na(a){J.push(a);m.waitUntilQuiet(function(){b.flush();c.flush();for(var a=A(),d=0;d<J.length;d++)J[d](a);J.length=0})}function v(c,e,g){e=b.get(g);e||(e=Da(a,c,Sa),"infinite"===e.animationIterationCount&&(e.animationIterationCount=1));b.put(g,e);c=e;g=c.animationDelay;e=c.transitionDelay;c.maxDelay=g&&e?Math.max(g,
+e):g||e;c.maxDuration=Math.max(c.animationDuration*c.animationIterationCount,c.transitionDuration);return c}var z=U(e),K=0,J=[];return function(a,c){function d(){q()}function k(){q(!0)}function q(b){if(!(A||wa&&K)){A=!0;K=!1;f.$$skipPreparationClasses||e.removeClass(a,da);e.removeClass(a,ca);pa(l,!1);la(l,!1);s(m,function(a){l.style[a[0]]=""});z(a,f);fa(a,f);Object.keys(x).length&&s(x,function(a,b){a?l.style.setProperty(b,a):l.style.removeProperty(b)});if(f.onDone)f.onDone();ea&&ea.length&&a.off(ea.join(" "),
+E);var c=a.data("$$animateCss");c&&(H.cancel(c[0].timer),a.removeData("$$animateCss"));D&&D.complete(!b)}}function t(a){p.blockTransition&&la(l,a);p.blockKeyframeAnimation&&pa(l,!!a)}function B(){D=new g({end:d,cancel:k});na(Q);q();return{$$willAnimate:!1,start:function(){return D},end:d}}function E(a){a.stopPropagation();var b=a.originalEvent||a;a=b.$manualTimeStamp||Date.now();b=parseFloat(b.elapsedTime.toFixed(3));Math.max(a-U,0)>=P&&b>=O&&(wa=!0,q())}function L(){function b(){if(!A){t(!1);s(m,
+function(a){l.style[a[0]]=a[1]});z(a,f);e.addClass(a,ca);if(p.recalculateTimingStyles){ja=l.className+" "+da;ga=r(l,ja);F=v(l,ja,ga);$=F.maxDelay;n=Math.max($,0);O=F.maxDuration;if(0===O){q();return}p.hasTransitions=0<F.transitionDuration;p.hasAnimations=0<F.animationDuration}p.applyAnimationDelay&&($="boolean"!==typeof f.delay&&qa(f.delay)?parseFloat(f.delay):$,n=Math.max($,0),F.animationDelay=$,aa=[ma,$+"s"],m.push(aa),l.style[aa[0]]=aa[1]);P=1E3*n;R=1E3*O;if(f.easing){var d,g=f.easing;p.hasTransitions&&
+(d=S+"TimingFunction",m.push([d,g]),l.style[d]=g);p.hasAnimations&&(d=Y+"TimingFunction",m.push([d,g]),l.style[d]=g)}F.transitionDuration&&ea.push(ta);F.animationDuration&&ea.push(ua);U=Date.now();var k=P+1.5*R;d=U+k;var g=a.data("$$animateCss")||[],L=!0;if(g.length){var B=g[0];(L=d>B.expectedEndTime)?H.cancel(B.timer):g.push(q)}L&&(k=H(c,k,!1),g[0]={timer:k,expectedEndTime:d},g.push(q),a.data("$$animateCss",g));if(ea.length)a.on(ea.join(" "),E);f.to&&(f.cleanupStyles&&Ga(x,l,Object.keys(f.to)),Ba(a,
+f))}}function c(){var b=a.data("$$animateCss");if(b){for(var d=1;d<b.length;d++)b[d]();a.removeData("$$animateCss")}}if(!A)if(l.parentNode){var d=function(a){if(wa)K&&a&&(K=!1,q());else if(K=!a,F.animationDuration)if(a=pa(l,K),K)m.push(a);else{var b=m,c=b.indexOf(a);0<=a&&b.splice(c,1)}},g=0<Z&&(F.transitionDuration&&0===W.transitionDuration||F.animationDuration&&0===W.animationDuration)&&Math.max(W.animationDelay,W.transitionDelay);g?H(b,Math.floor(g*Z*1E3),!1):b();I.resume=function(){d(!0)};I.pause=
+function(){d(!1)}}else q()}var f=c||{};f.$$prepared||(f=ka(Ha(f)));var x={},l=G(a);if(!l||!l.parentNode||!M.enabled())return B();var m=[],J=a.attr("class"),y=La(f),A,K,wa,D,I,n,P,O,R,U,ea=[];if(0===f.duration||!C.animations&&!C.transitions)return B();var w=f.event&&ba(f.event)?f.event.join(" "):f.event,V="",T="";w&&f.structural?V=X(w,"ng-",!0):w&&(V=w);f.addClass&&(T+=X(f.addClass,"-add"));f.removeClass&&(T.length&&(T+=" "),T+=X(f.removeClass,"-remove"));f.applyClassesEarly&&T.length&&z(a,f);var da=
+[V,T].join(" ").trim(),ja=J+" "+da,ca=X(da,"-active"),J=y.to&&0<Object.keys(y.to).length;if(!(0<(f.keyframeStyle||"").length||J||da))return B();var ga,W;0<f.stagger?(y=parseFloat(f.stagger),W={transitionDelay:y,animationDelay:y,transitionDuration:0,animationDuration:0}):(ga=r(l,ja),W=u(l,da,ga,Ta));f.$$skipPreparationClasses||e.addClass(a,da);f.transitionStyle&&(y=[S,f.transitionStyle],ha(l,y),m.push(y));0<=f.duration&&(y=0<l.style[S].length,y=Ea(f.duration,y),ha(l,y),m.push(y));f.keyframeStyle&&
+(y=[Y,f.keyframeStyle],ha(l,y),m.push(y));var Z=W?0<=f.staggerIndex?f.staggerIndex:b.count(ga):0;(w=0===Z)&&!f.skipBlocking&&la(l,9999);var F=v(l,ja,ga),$=F.maxDelay;n=Math.max($,0);O=F.maxDuration;var p={};p.hasTransitions=0<F.transitionDuration;p.hasAnimations=0<F.animationDuration;p.hasTransitionAll=p.hasTransitions&&"all"==F.transitionProperty;p.applyTransitionDuration=J&&(p.hasTransitions&&!p.hasTransitionAll||p.hasAnimations&&!p.hasTransitions);p.applyAnimationDuration=f.duration&&p.hasAnimations;
+p.applyTransitionDelay=qa(f.delay)&&(p.applyTransitionDuration||p.hasTransitions);p.applyAnimationDelay=qa(f.delay)&&p.hasAnimations;p.recalculateTimingStyles=0<T.length;if(p.applyTransitionDuration||p.applyAnimationDuration)O=f.duration?parseFloat(f.duration):O,p.applyTransitionDuration&&(p.hasTransitions=!0,F.transitionDuration=O,y=0<l.style[S+"Property"].length,m.push(Ea(O,y))),p.applyAnimationDuration&&(p.hasAnimations=!0,F.animationDuration=O,m.push([va,O+"s"]));if(0===O&&!p.recalculateTimingStyles)return B();
+if(null!=f.delay){var aa;"boolean"!==typeof f.delay&&(aa=parseFloat(f.delay),n=Math.max(aa,0));p.applyTransitionDelay&&m.push([ia,aa+"s"]);p.applyAnimationDelay&&m.push([ma,aa+"s"])}null==f.duration&&0<F.transitionDuration&&(p.recalculateTimingStyles=p.recalculateTimingStyles||w);P=1E3*n;R=1E3*O;f.skipBlocking||(p.blockTransition=0<F.transitionDuration,p.blockKeyframeAnimation=0<F.animationDuration&&0<W.animationDelay&&0===W.animationDuration);f.from&&(f.cleanupStyles&&Ga(x,l,Object.keys(f.from)),
+Aa(a,f));p.blockTransition||p.blockKeyframeAnimation?t(O):f.skipBlocking||la(l,!1);return{$$willAnimate:!0,end:d,start:function(){if(!A)return I={end:d,cancel:k,resume:null,pause:null},D=new g(I),na(L),D}}}}]}]).provider("$$animateCssDriver",["$$animationProvider",function(a){a.drivers.push("$$animateCssDriver");this.$get=["$animateCss","$rootScope","$$AnimateRunner","$rootElement","$sniffer","$$jqLite","$document",function(a,c,d,e,g,H,A){function C(a){return a.replace(/\bng-\S+\b/g,"")}function m(a,
+b){R(a)&&(a=a.split(" "));R(b)&&(b=b.split(" "));return a.filter(function(a){return-1===b.indexOf(a)}).join(" ")}function M(c,e,g){function h(a){var b={},c=G(a).getBoundingClientRect();s(["width","height","top","left"],function(a){var d=c[a];switch(a){case "top":d+=D.scrollTop;break;case "left":d+=D.scrollLeft}b[a]=Math.floor(d)+"px"});return b}function A(){var c=C(g.attr("class")||""),d=m(c,q),c=m(q,c),d=a(k,{to:h(g),addClass:"ng-anchor-in "+d,removeClass:"ng-anchor-out "+c,delay:!0});return d.$$willAnimate?
+d:null}function H(){k.remove();e.removeClass("ng-animate-shim");g.removeClass("ng-animate-shim")}var k=I(G(e).cloneNode(!0)),q=C(k.attr("class")||"");e.addClass("ng-animate-shim");g.addClass("ng-animate-shim");k.addClass("ng-anchor");v.append(k);var t;c=function(){var c=a(k,{addClass:"ng-anchor-out",delay:!0,from:h(e)});return c.$$willAnimate?c:null}();if(!c&&(t=A(),!t))return H();var B=c||t;return{start:function(){function a(){c&&c.end()}var b,c=B.start();c.done(function(){c=null;if(!t&&(t=A()))return c=
+t.start(),c.done(function(){c=null;H();b.complete()}),c;H();b.complete()});return b=new d({end:a,cancel:a})}}}function r(a,b,c,e){var g=u(a,Q),m=u(b,Q),k=[];s(e,function(a){(a=M(c,a.out,a["in"]))&&k.push(a)});if(g||m||0!==k.length)return{start:function(){function a(){s(b,function(a){a.end()})}var b=[];g&&b.push(g.start());m&&b.push(m.start());s(k,function(a){b.push(a.start())});var c=new d({end:a,cancel:a});d.all(b,function(a){c.complete(a)});return c}}}function u(c){var d=c.element,e=c.options||
+{};c.structural&&(e.event=c.event,e.structural=!0,e.applyClassesEarly=!0,"leave"===c.event&&(e.onDone=e.domOperation));e.preparationClasses&&(e.event=ca(e.event,e.preparationClasses));c=a(d,e);return c.$$willAnimate?c:null}if(!g.animations&&!g.transitions)return Q;var D=A[0].body;c=G(e);var v=I(c.parentNode&&11===c.parentNode.nodeType||D.contains(c)?c:D);U(H);return function(a){return a.from&&a.to?r(a.from,a.to,a.classes,a.anchors):u(a)}}]}]).provider("$$animateJs",["$animateProvider",function(a){this.$get=
+["$injector","$$AnimateRunner","$$jqLite",function(b,c,d){function e(c){c=ba(c)?c:c.split(" ");for(var d=[],e={},g=0;g<c.length;g++){var s=c[g],r=a.$$registeredAnimations[s];r&&!e[s]&&(d.push(b.get(r)),e[s]=!0)}return d}var g=U(d);return function(a,b,d,m){function r(){m.domOperation();g(a,m)}function D(a,b,d,e,f){switch(d){case "animate":b=[b,e.from,e.to,f];break;case "setClass":b=[b,z,K,f];break;case "addClass":b=[b,z,f];break;case "removeClass":b=[b,K,f];break;default:b=[b,f]}b.push(e);if(a=a.apply(a,
+b))if(Ia(a.start)&&(a=a.start()),a instanceof c)a.done(f);else if(Ia(a))return a;return Q}function u(a,b,d,e,f){var g=[];s(e,function(e){var h=e[f];h&&g.push(function(){var e,f,g=!1,k=function(a){g||(g=!0,(f||Q)(a),e.complete(!a))};e=new c({end:function(){k()},cancel:function(){k(!0)}});f=D(h,a,b,d,function(a){k(!1===a)});return e})});return g}function G(a,b,d,e,f){var g=u(a,b,d,e,f);if(0===g.length){var h,k;"beforeSetClass"===f?(h=u(a,"removeClass",d,e,"beforeRemoveClass"),k=u(a,"addClass",d,e,"beforeAddClass")):
+"setClass"===f&&(h=u(a,"removeClass",d,e,"removeClass"),k=u(a,"addClass",d,e,"addClass"));h&&(g=g.concat(h));k&&(g=g.concat(k))}if(0!==g.length)return function(a){var b=[];g.length&&s(g,function(a){b.push(a())});b.length?c.all(b,a):a();return function(a){s(b,function(b){a?b.cancel():b.end()})}}}var v=!1;3===arguments.length&&ra(d)&&(m=d,d=null);m=ka(m);d||(d=a.attr("class")||"",m.addClass&&(d+=" "+m.addClass),m.removeClass&&(d+=" "+m.removeClass));var z=m.addClass,K=m.removeClass,J=e(d),h,I;if(J.length){var N,
+k;"leave"==b?(k="leave",N="afterLeave"):(k="before"+b.charAt(0).toUpperCase()+b.substr(1),N=b);"enter"!==b&&"move"!==b&&(h=G(a,b,m,J,k));I=G(a,b,m,J,N)}if(h||I){var q;return{$$willAnimate:!0,end:function(){q?q.end():(v=!0,r(),fa(a,m),q=new c,q.complete(!0));return q},start:function(){function b(c){v=!0;r();fa(a,m);q.complete(c)}if(q)return q;q=new c;var d,e=[];h&&e.push(function(a){d=h(a)});e.length?e.push(function(a){r();a(!0)}):r();I&&e.push(function(a){d=I(a)});q.setHost({end:function(){v||((d||
+Q)(void 0),b(void 0))},cancel:function(){v||((d||Q)(!0),b(!0))}});c.chain(e,b);return q}}}}}]}]).provider("$$animateJsDriver",["$$animationProvider",function(a){a.drivers.push("$$animateJsDriver");this.$get=["$$animateJs","$$AnimateRunner",function(a,c){function d(c){return a(c.element,c.event,c.classes,c.options)}return function(a){if(a.from&&a.to){var b=d(a.from),r=d(a.to);if(b||r)return{start:function(){function a(){return function(){s(d,function(a){a.end()})}}var d=[];b&&d.push(b.start());r&&
+d.push(r.start());c.all(d,function(a){e.complete(a)});var e=new c({end:a(),cancel:a()});return e}}}else return d(a)}}]}])})(window,window.angular);
+//# sourceMappingURL=angular-animate.min.js.map
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.min.js.map
new file mode 100644
index 00000000..1d4f7a68
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.min.js.map
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"angular-animate.min.js",
+"lineCount":55,
+"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,EAAlB,CAA6B,CA4EtCC,QAASA,GAAS,CAACC,CAAD,CAAMC,CAAN,CAAYC,CAAZ,CAAoB,CACpC,GAAKF,CAAAA,CAAL,CACE,KAAMG,GAAA,CAAS,MAAT,CAA2CF,CAA3C,EAAmD,GAAnD,CAA0DC,CAA1D,EAAoE,UAApE,CAAN,CAEF,MAAOF,EAJ6B,CAOtCI,QAASA,GAAY,CAACC,CAAD,CAAGC,CAAH,CAAM,CACzB,GAAKD,CAAAA,CAAL,EAAWC,CAAAA,CAAX,CAAc,MAAO,EACrB,IAAKD,CAAAA,CAAL,CAAQ,MAAOC,EACf,IAAKA,CAAAA,CAAL,CAAQ,MAAOD,EACXE,GAAA,CAAQF,CAAR,CAAJ,GAAgBA,CAAhB,CAAoBA,CAAAG,KAAA,CAAO,GAAP,CAApB,CACID,GAAA,CAAQD,CAAR,CAAJ,GAAgBA,CAAhB,CAAoBA,CAAAE,KAAA,CAAO,GAAP,CAApB,CACA,OAAOH,EAAP,CAAW,GAAX,CAAiBC,CANQ,CAS3BG,QAASA,GAAa,CAACC,CAAD,CAAU,CAC9B,IAAIC,EAAS,EACTD,EAAJ,GAAgBA,CAAAE,GAAhB,EAA8BF,CAAAG,KAA9B,IACEF,CAAAC,GACA,CADYF,CAAAE,GACZ,CAAAD,CAAAE,KAAA,CAAcH,CAAAG,KAFhB,CAIA,OAAOF,EANuB,CAShCG,QAASA,EAAW,CAACC,CAAD,CAAUC,CAAV,CAAeC,CAAf,CAAyB,CAC3C,IAAIC,EAAY,EAChBH,EAAA,CAAUR,EAAA,CAAQQ,CAAR,CAAA,CACJA,CADI,CAEJA,CAAA,EAAWI,CAAA,CAASJ,CAAT,CAAX,EAAgCA,CAAAK,OAAhC,CACIL,CAAAM,MAAA,CAAc,KAAd,CADJ,CAEI,EACVC,EAAA,CAAQP,CAAR,CAAiB,QAAQ,CAACQ,CAAD,CAAQC,CAAR,CAAW,CAC9BD,CAAJ,EAA4B,CAA5B,CAAaA,CAAAH,OAAb,GACEF,CACA,EADkB,CAAL,CAACM,CAAD,CAAU,GAAV,CAAgB,EAC7B,CAAAN,CAAA,EAAaD,CAAA,CAAWD,CAAX,CAAiBO,CAAjB,CACWA,CADX,CACmBP,CAHlC,CADkC,CAApC,CAOA,OAAOE,EAdoC,CAwB7CO,QAASA,GAAwB,CAACC,CAAD,CAAU,CACzC,GAAIA,CAAJ,WAAuBC,EAAvB,CACE,OAAQD,CAAAN,OAAR,EACE,KAAK,CAAL,CACE,MAAO,EAGT;KAAK,CAAL,CAIE,GAxHWQ,CAwHX,GAAIF,CAAA,CAAQ,CAAR,CAAAG,SAAJ,CACE,MAAOH,EAET,MAEF,SACE,MAAOC,EAAA,CAAOG,EAAA,CAAmBJ,CAAnB,CAAP,CAfX,CAoBF,GAnIiBE,CAmIjB,GAAIF,CAAAG,SAAJ,CACE,MAAOF,EAAA,CAAOD,CAAP,CAvBgC,CA2B3CI,QAASA,GAAkB,CAACJ,CAAD,CAAU,CACnC,GAAK,CAAAA,CAAA,CAAQ,CAAR,CAAL,CAAiB,MAAOA,EACxB,KAAS,IAAAF,EAAI,CAAb,CAAgBA,CAAhB,CAAoBE,CAAAN,OAApB,CAAoCI,CAAA,EAApC,CAAyC,CACvC,IAAIO,EAAML,CAAA,CAAQF,CAAR,CACV,IA5IeI,CA4If,EAAIG,CAAAF,SAAJ,CACE,MAAOE,EAH8B,CAFN,CAUrCC,QAASA,GAAU,CAACC,CAAD,CAAWP,CAAX,CAAoBR,CAApB,CAA+B,CAChDI,CAAA,CAAQI,CAAR,CAAiB,QAAQ,CAACK,CAAD,CAAM,CAC7BE,CAAAC,SAAA,CAAkBH,CAAlB,CAAuBb,CAAvB,CAD6B,CAA/B,CADgD,CAMlDiB,QAASA,GAAa,CAACF,CAAD,CAAWP,CAAX,CAAoBR,CAApB,CAA+B,CACnDI,CAAA,CAAQI,CAAR,CAAiB,QAAQ,CAACK,CAAD,CAAM,CAC7BE,CAAAG,YAAA,CAAqBL,CAArB,CAA0Bb,CAA1B,CAD6B,CAA/B,CADmD,CAMrDmB,QAASA,EAA4B,CAACJ,CAAD,CAAW,CAC9C,MAAO,SAAQ,CAACP,CAAD,CAAUhB,CAAV,CAAmB,CAC5BA,CAAAwB,SAAJ,GACEF,EAAA,CAAWC,CAAX,CAAqBP,CAArB,CAA8BhB,CAAAwB,SAA9B,CACA,CAAAxB,CAAAwB,SAAA,CAAmB,IAFrB,CAIIxB,EAAA0B,YAAJ,GACED,EAAA,CAAcF,CAAd,CAAwBP,CAAxB,CAAiChB,CAAA0B,YAAjC,CACA,CAAA1B,CAAA0B,YAAA,CAAsB,IAFxB,CALgC,CADY,CAahDE,QAASA,GAAuB,CAAC5B,CAAD,CAAU,CACxCA,CAAA,CAAUA,CAAV,EAAqB,EACrB,IAAK6B,CAAA7B,CAAA6B,WAAL,CAAyB,CACvB,IAAIC,EAAe9B,CAAA8B,aAAfA;AAAuCC,CAC3C/B,EAAA8B,aAAA,CAAuBE,QAAQ,EAAG,CAChChC,CAAAiC,oBAAA,CAA8B,CAAA,CAC9BH,EAAA,EACAA,EAAA,CAAeC,CAHiB,CAKlC/B,EAAA6B,WAAA,CAAqB,CAAA,CAPE,CASzB,MAAO7B,EAXiC,CAc1CkC,QAASA,GAAoB,CAAClB,CAAD,CAAUhB,CAAV,CAAmB,CAC9CmC,EAAA,CAAyBnB,CAAzB,CAAkChB,CAAlC,CACAoC,GAAA,CAAuBpB,CAAvB,CAAgChB,CAAhC,CAF8C,CAKhDmC,QAASA,GAAwB,CAACnB,CAAD,CAAUhB,CAAV,CAAmB,CAC9CA,CAAAG,KAAJ,GACEa,CAAAqB,IAAA,CAAYrC,CAAAG,KAAZ,CACA,CAAAH,CAAAG,KAAA,CAAe,IAFjB,CADkD,CAOpDiC,QAASA,GAAsB,CAACpB,CAAD,CAAUhB,CAAV,CAAmB,CAC5CA,CAAAE,GAAJ,GACEc,CAAAqB,IAAA,CAAYrC,CAAAE,GAAZ,CACA,CAAAF,CAAAE,GAAA,CAAa,IAFf,CADgD,CAOlDoC,QAASA,EAAqB,CAACtB,CAAD,CAAUuB,CAAV,CAAwBC,CAAxB,CAAsC,CAClE,IAAIC,EAASF,CAAAvC,QAATyC,EAAiC,EACjCC,EAAAA,CAAaF,CAAAxC,QAAb0C,EAAqC,EAEzC,KAAIC,GAASF,CAAAjB,SAATmB,EAA4B,EAA5BA,EAAkC,GAAlCA,EAAyCD,CAAAlB,SAAzCmB,EAAgE,EAAhEA,CAAJ,CACIC,GAAYH,CAAAf,YAAZkB,EAAkC,EAAlCA,EAAwC,GAAxCA,EAA+CF,CAAAhB,YAA/CkB,EAAyE,EAAzEA,CACAvC,EAAAA,CAAUwC,EAAA,CAAsB7B,CAAA8B,KAAA,CAAa,OAAb,CAAtB,CAA6CH,CAA7C,CAAoDC,CAApD,CAEVF,EAAAK,mBAAJ,GACEN,CAAAM,mBACA,CAD4BC,EAAA,CAAgBN,CAAAK,mBAAhB,CAA+CN,CAAAM,mBAA/C,CAC5B,CAAA,OAAOL,CAAAK,mBAFT,CAMIE;CAAAA,CAAmBR,CAAAX,aAAA,GAAwBC,CAAxB,CAA+BU,CAAAX,aAA/B,CAAqD,IAE5EoB,GAAA,CAAOT,CAAP,CAAeC,CAAf,CAGIO,EAAJ,GACER,CAAAX,aADF,CACwBmB,CADxB,CAKER,EAAAjB,SAAA,CADEnB,CAAAmB,SAAJ,CACoBnB,CAAAmB,SADpB,CAGoB,IAIlBiB,EAAAf,YAAA,CADErB,CAAAqB,YAAJ,CACuBrB,CAAAqB,YADvB,CAGuB,IAGvBa,EAAAf,SAAA,CAAwBiB,CAAAjB,SACxBe,EAAAb,YAAA,CAA2Be,CAAAf,YAE3B,OAAOe,EAtC2D,CAyCpEI,QAASA,GAAqB,CAACM,CAAD,CAAWR,CAAX,CAAkBC,CAAlB,CAA4B,CAuCxDQ,QAASA,EAAoB,CAAC/C,CAAD,CAAU,CACjCI,CAAA,CAASJ,CAAT,CAAJ,GACEA,CADF,CACYA,CAAAM,MAAA,CAAc,GAAd,CADZ,CAIA,KAAI0C,EAAM,EACVzC,EAAA,CAAQP,CAAR,CAAiB,QAAQ,CAACQ,CAAD,CAAQ,CAG3BA,CAAAH,OAAJ,GACE2C,CAAA,CAAIxC,CAAJ,CADF,CACe,CAAA,CADf,CAH+B,CAAjC,CAOA,OAAOwC,EAb8B,CAnCvC,IAAIC,EAAQ,EACZH,EAAA,CAAWC,CAAA,CAAqBD,CAArB,CAEXR,EAAA,CAAQS,CAAA,CAAqBT,CAArB,CACR/B,EAAA,CAAQ+B,CAAR,CAAe,QAAQ,CAACY,CAAD,CAAQC,CAAR,CAAa,CAClCF,CAAA,CAAME,CAAN,CAAA,CARcC,CAOoB,CAApC,CAIAb,EAAA,CAAWQ,CAAA,CAAqBR,CAArB,CACXhC,EAAA,CAAQgC,CAAR,CAAkB,QAAQ,CAACW,CAAD,CAAQC,CAAR,CAAa,CACrCF,CAAA,CAAME,CAAN,CAAA,CAbcC,CAaD,GAAAH,CAAA,CAAME,CAAN,CAAA,CAA2B,IAA3B,CAZKE,EAWmB,CAAvC,CAIA,KAAIrD,EAAU,CACZmB,SAAU,EADE,CAEZE,YAAa,EAFD,CAKdd,EAAA,CAAQ0C,CAAR,CAAe,QAAQ,CAACK,CAAD,CAAM9C,CAAN,CAAa,CAAA,IAC9B+C,CAD8B,CACxBC,CAtBIJ,EAuBd,GAAIE,CAAJ,EACEC,CACA,CADO,UACP;AAAAC,CAAA,CAAQ,CAACV,CAAA,CAAStC,CAAT,CAFX,EAtBkB6C,EAsBlB,GAGWC,CAHX,GAIEC,CACA,CADO,aACP,CAAAC,CAAA,CAAQV,CAAA,CAAStC,CAAT,CALV,CAOIgD,EAAJ,GACMxD,CAAA,CAAQuD,CAAR,CAAAlD,OAGJ,GAFEL,CAAA,CAAQuD,CAAR,CAEF,EAFmB,GAEnB,EAAAvD,CAAA,CAAQuD,CAAR,CAAA,EAAiB/C,CAJnB,CATkC,CAApC,CAiCA,OAAOR,EAvDiD,CA0D1DyD,QAASA,EAAU,CAAC9C,CAAD,CAAU,CAC3B,MAAQA,EAAD,WAAoB7B,EAAA6B,QAApB,CAAuCA,CAAA,CAAQ,CAAR,CAAvC,CAAoDA,CADhC,CAI7B+C,QAASA,GAAgC,CAAC/C,CAAD,CAAUgD,CAAV,CAAiBhE,CAAjB,CAA0B,CACjE,IAAIK,EAAU,EACV2D,EAAJ,GACE3D,CADF,CACYD,CAAA,CAAY4D,CAAZ,CAjTWC,KAiTX,CAAuC,CAAA,CAAvC,CADZ,CAGIjE,EAAAwB,SAAJ,GACEnB,CADF,CACY2C,EAAA,CAAgB3C,CAAhB,CAAyBD,CAAA,CAAYJ,CAAAwB,SAAZ,CAtThB0C,MAsTgB,CAAzB,CADZ,CAGIlE,EAAA0B,YAAJ,GACErB,CADF,CACY2C,EAAA,CAAgB3C,CAAhB,CAAyBD,CAAA,CAAYJ,CAAA0B,YAAZ,CAxTbyC,SAwTa,CAAzB,CADZ,CAGI9D,EAAAK,OAAJ,GACEV,CAAA+C,mBACA,CAD6B1C,CAC7B,CAAAW,CAAAQ,SAAA,CAAiBnB,CAAjB,CAFF,CAXiE,CA4BnE+D,QAASA,GAAgB,CAACC,CAAD,CAAOC,CAAP,CAAiB,CAIxC,IAAIf,EAAQe,CAAA,CAAW,GAAX,CAAiBA,CAAjB,CAA4B,GAA5B,CAAkC,EAC9CC,GAAA,CAAiBF,CAAjB,CAAuB,CAACG,EAAD,CAAwBjB,CAAxB,CAAvB,CACA,OAAO,CAACiB,EAAD,CAAwBjB,CAAxB,CANiC,CAS1CkB,QAASA,GAAuB,CAACJ,CAAD,CAAOK,CAAP,CAAmB,CACjD,IAAInB,EAAQmB,CAAA,CAAa,QAAb,CAAwB,EAApC,CACIlB,EAAMmB,CAANnB,CA3SwBoB,WA4S5BL,GAAA,CAAiBF,CAAjB,CAAuB,CAACb,CAAD,CAAMD,CAAN,CAAvB,CACA,OAAO,CAACC,CAAD,CAAMD,CAAN,CAJ0C,CAOnDgB,QAASA,GAAgB,CAACF,CAAD,CAAOQ,CAAP,CAAmB,CAG1CR,CAAAS,MAAA,CAFWD,CAAAjB,CAAW,CAAXA,CAEX,CAAA;AADYiB,CAAAtB,CAAW,CAAXA,CAF8B,CAM5CP,QAASA,GAAe,CAACrD,CAAD,CAAGC,CAAH,CAAM,CAC5B,MAAKD,EAAL,CACKC,CAAL,CACOD,CADP,CACW,GADX,CACiBC,CADjB,CAAeD,CADf,CAAeC,CADa,CAiZ9BmF,QAASA,GAAgB,CAACC,CAAD,CAAUhE,CAAV,CAAmBiE,CAAnB,CAA+B,CACtD,IAAIhF,EAASiF,MAAAC,OAAA,CAAc,IAAd,CAAb,CACIC,EAAiBJ,CAAAK,iBAAA,CAAyBrE,CAAzB,CAAjBoE,EAAsD,EAC1DxE,EAAA,CAAQqE,CAAR,CAAoB,QAAQ,CAACK,CAAD,CAAkBC,CAAlB,CAAmC,CAC7D,IAAI5B,EAAMyB,CAAA,CAAeE,CAAf,CACV,IAAI3B,CAAJ,CAAS,CACP,IAAI6B,EAAI7B,CAAA8B,OAAA,CAAW,CAAX,CAGR,IAAU,GAAV,GAAID,CAAJ,EAAuB,GAAvB,GAAiBA,CAAjB,EAAmC,CAAnC,EAA8BA,CAA9B,CACE7B,CAAA,CAAM+B,EAAA,CAAa/B,CAAb,CAMI,EAAZ,GAAIA,CAAJ,GACEA,CADF,CACQ,IADR,CAGA1D,EAAA,CAAOsF,CAAP,CAAA,CAA0B5B,CAdnB,CAFoD,CAA/D,CAoBA,OAAO1D,EAvB+C,CA0BxDyF,QAASA,GAAY,CAACC,CAAD,CAAM,CACzB,IAAIC,EAAW,CACXC,EAAAA,CAASF,CAAAhF,MAAA,CAAU,SAAV,CACbC,EAAA,CAAQiF,CAAR,CAAgB,QAAQ,CAACtC,CAAD,CAAQ,CAGQ,GAAtC,EAAIA,CAAAkC,OAAA,CAAalC,CAAA7C,OAAb,CAA4B,CAA5B,CAAJ,GACE6C,CADF,CACUA,CAAAuC,UAAA,CAAgB,CAAhB,CAAmBvC,CAAA7C,OAAnB,CAAkC,CAAlC,CADV,CAGA6C,EAAA,CAAQwC,UAAA,CAAWxC,CAAX,CAAR,EAA6B,CAC7BqC,EAAA,CAAWA,CAAA,CAAWI,IAAAC,IAAA,CAAS1C,CAAT,CAAgBqC,CAAhB,CAAX,CAAuCrC,CAPpB,CAAhC,CASA,OAAOqC,EAZkB,CAe3BM,QAASA,GAAiB,CAACvC,CAAD,CAAM,CAC9B,MAAe,EAAf,GAAOA,CAAP,EAA2B,IAA3B,EAAoBA,CADU,CAIhCwC,QAASA,GAA6B,CAAC7B,CAAD,CAAW8B,CAAX,CAA8B,CAClE,IAAItB,EAAQuB,CAAZ,CACI9C,EAAQe,CAARf,CAAmB,GACnB6C,EAAJ,CACEtB,CADF,EA5vBiBwB,UA4vBjB,CAGE/C,CAHF,EAGW,aAEX;MAAO,CAACuB,CAAD,CAAQvB,CAAR,CAR2D,CAWpEgD,QAASA,GAAsB,EAAG,CAChC,IAAIC,EAAQtB,MAAAC,OAAA,CAAc,IAAd,CACZ,OAAO,CACLsB,MAAOA,QAAQ,EAAG,CAChBD,CAAA,CAAQtB,MAAAC,OAAA,CAAc,IAAd,CADQ,CADb,CAKLuB,MAAOA,QAAQ,CAAClD,CAAD,CAAM,CAEnB,MAAO,CADHmD,CACG,CADKH,CAAA,CAAMhD,CAAN,CACL,EAAQmD,CAAAC,MAAR,CAAsB,CAFV,CALhB,CAULC,IAAKA,QAAQ,CAACrD,CAAD,CAAM,CAEjB,OADImD,CACJ,CADYH,CAAA,CAAMhD,CAAN,CACZ,GAAgBmD,CAAApD,MAFC,CAVd,CAeLuD,IAAKA,QAAQ,CAACtD,CAAD,CAAMD,CAAN,CAAa,CACnBiD,CAAA,CAAMhD,CAAN,CAAL,CAGEgD,CAAA,CAAMhD,CAAN,CAAAoD,MAAA,EAHF,CACEJ,CAAA,CAAMhD,CAAN,CADF,CACe,CAAEoD,MAAO,CAAT,CAAYrD,MAAOA,CAAnB,CAFS,CAfrB,CAFyB,CAoClCwD,QAASA,GAAwB,CAACC,CAAD,CAAS3C,CAAT,CAAeY,CAAf,CAA2B,CAC1DrE,CAAA,CAAQqE,CAAR,CAAoB,QAAQ,CAACrB,CAAD,CAAO,CACjCoD,CAAA,CAAOpD,CAAP,CAAA,CAAeqD,CAAA,CAAUD,CAAA,CAAOpD,CAAP,CAAV,CAAA,CACToD,CAAA,CAAOpD,CAAP,CADS,CAETS,CAAAS,MAAAoC,iBAAA,CAA4BtD,CAA5B,CAH2B,CAAnC,CAD0D,CA/1B5D,IAAI7B,EAAc5C,CAAA4C,KAAlB,CACIoF,GAAchI,CAAAgI,KADlB,CAEIjE,GAAc/D,CAAA+D,OAFlB,CAGIjC,EAAc9B,CAAA6B,QAHlB,CAIIJ,EAAczB,CAAAyB,QAJlB,CAKIf,GAAcV,CAAAU,QALlB,CAMIY,EAActB,CAAAsB,SANlB,CAOI2G,GAAcjI,CAAAiI,SAPlB,CAQIC,EAAclI,CAAAkI,YARlB,CASIJ,EAAc9H,CAAA8H,UATlB,CAUIK,GAAcnI,CAAAmI,WAVlB,CAWIC,GAAcpI,CAAAoI,UAXlB,CA0BqBlB,CA1BrB,CA0BsCmB,EA1BtC,CA0B2D7C,CA1B3D,CA0B2E8C,EAWvEJ,EAAA,CAAYnI,CAAAwI,gBAAZ,CAAJ;AAA2CT,CAAA,CAAU/H,CAAAyI,sBAAV,CAA3C,EAEEtB,CACA,CADkB,kBAClB,CAAAmB,EAAA,CAAsB,mCAHxB,GAKEnB,CACA,CADkB,YAClB,CAAAmB,EAAA,CAAsB,eANxB,CASIH,EAAA,CAAYnI,CAAA0I,eAAZ,CAAJ,EAA0CX,CAAA,CAAU/H,CAAA2I,qBAAV,CAA1C,EAEElD,CACA,CADiB,iBACjB,CAAA8C,EAAA,CAAqB,iCAHvB,GAKE9C,CACA,CADiB,WACjB,CAAA8C,EAAA,CAAqB,cANvB,CAiBA,KAAIK,GAAuBnD,CAAvBmD,CANYC,OAMhB,CACIC,GAA0BrD,CAA1BqD,CATe1B,UAQnB,CAEI9B,GAAwB6B,CAAxB7B,CARYuD,OASZE,EAAAA,CAA2B5B,CAA3B4B,CAXe3B,UAiBnB,KAAI7G,GAAWN,CAAA+I,SAAA,CAAiB,IAAjB,CAAf,CAkqBIC,GAAwB,CAC1BC,mBAAyBH,CADC,CAE1BI,gBAAyB7D,EAFC,CAG1B8D,mBAAyBjC,CAAzBiC,CArrBiBC,UAkrBS,CAI1BC,kBAAyBR,EAJC,CAK1BS,eAAyBX,EALC,CAM1BY,wBAAyB/D,CAAzB+D,CArrBkCC,gBA+qBR,CAlqB5B;AA2qBIC,GAAgC,CAClCR,mBAAyBH,CADS,CAElCI,gBAAyB7D,EAFS,CAGlCgE,kBAAyBR,EAHS,CAIlCS,eAAyBX,EAJS,CA6wGpC3I,EAAA0J,OAAA,CAAe,WAAf,CAA4B,EAA5B,CAAAC,UAAA,CACa,eADb,CAzxB6BC,CAAC,UAADA,CAAa,YAAbA,CAA2B,QAAQ,CAACC,CAAD,CAAWC,CAAX,CAAuB,CACrF,MAAO,CACLC,SAAU,GADL,CAELC,WAAY,SAFP,CAGLC,SAAU,CAAA,CAHL,CAILC,SAAU,GAJL,CAKLC,KAAMA,QAAQ,CAACC,CAAD,CAAQC,CAAR,CAAkBC,CAAlB,CAAyBC,CAAzB,CAA+BC,CAA/B,CAA4C,CAAA,IACpDC,CADoD,CACnCC,CACrBN,EAAAO,iBAAA,CAAuBL,CAAAM,cAAvB,EAA8CN,CAAA,CAAM,KAAN,CAA9C,CAA4D,QAAQ,CAAClG,CAAD,CAAQ,CACtEqG,CAAJ,EACEZ,CAAAgB,MAAA,CAAeJ,CAAf,CAEEC,EAAJ,GACEA,CAAAI,SAAA,EACA,CAAAJ,CAAA,CAAgB,IAFlB,CAIA,IAAItG,CAAJ,EAAuB,CAAvB,GAAaA,CAAb,CACEsG,CACA,CADgBN,CAAAW,KAAA,EAChB,CAAAP,CAAA,CAAYE,CAAZ,CAA2B,QAAQ,CAAC7I,CAAD,CAAU,CAC3C4I,CAAA,CAAkB5I,CAClBgI,EAAAmB,MAAA,CAAenJ,CAAf,CAAwB,IAAxB,CAA8BwI,CAA9B,CAF2C,CAA7C,CAVwE,CAA5E,CAFwD,CALrD,CAD8E,CAA1DT,CAyxB7B,CAAAD,UAAA,CAGa,mBAHb,CAzgHiCsB,CAAC,cAADA,CAAiB,QAAQ,CAACC,CAAD,CAAe,CACvE,MAAO,CACLf,KAAMA,QAAQ,CAACC,CAAD;AAAQvI,CAAR,CAAiByI,CAAjB,CAAwB,CAWpCa,QAASA,EAAO,CAAC/G,CAAD,CAAQ,CAEtBvC,CAAAuJ,KAAA,CA/euBC,qBA+evB,CADkB,IAClB,GADQjH,CACR,EADoC,MACpC,GAD0BA,CAC1B,CAFsB,CAVxB,IAAII,EAAM8F,CAAAgB,kBACNtL,EAAAsB,SAAA,CAAiBkD,CAAjB,CAAJ,EAA4C,CAA5C,GAA6BA,CAAAjD,OAA7B,CACEM,CAAAuJ,KAAA,CAreuBC,qBAqevB,CAAuC,CAAA,CAAvC,CADF,EAKEF,CAAA,CAAQD,CAAA,CAAa1G,CAAb,CAAA,CAAkB4F,CAAlB,CAAR,CACA,CAAAE,CAAAiB,SAAA,CAAe,mBAAf,CAAoCJ,CAApC,CANF,CAFoC,CADjC,CADgE,CAAxCF,CAygHjC,CAAAO,QAAA,CAIW,gBAJX,CAxoH4BC,CAAC,OAADA,CAAU,QAAQ,CAACC,CAAD,CAAQ,CAGpDC,QAASA,EAAS,CAACC,CAAD,CAAQ,CAIxBC,CAAA,CAAQA,CAAAC,OAAA,CAAaF,CAAb,CACRG,EAAA,EALwB,CA8B1BA,QAASA,EAAQ,EAAG,CAClB,GAAKF,CAAAtK,OAAL,CAAA,CAGA,IADA,IAAIyK,EAAQH,CAAAI,MAAA,EAAZ,CACStK,EAAI,CAAb,CAAgBA,CAAhB,CAAoBqK,CAAAzK,OAApB,CAAkCI,CAAA,EAAlC,CACEqK,CAAA,CAAMrK,CAAN,CAAA,EAGGuK,EAAL,EACER,CAAA,CAAM,QAAQ,EAAG,CACVQ,CAAL,EAAeH,CAAA,EADA,CAAjB,CARF,CADkB,CAjCgC,IAChDF,CADgD,CACzCK,CAUXL,EAAA,CAAQF,CAAAE,MAAR,CAA0B,EAU1BF,EAAAQ,eAAA,CAA2BC,QAAQ,CAACC,CAAD,CAAK,CAClCH,CAAJ,EAAcA,CAAA,EAEdA,EAAA,CAAWR,CAAA,CAAM,QAAQ,EAAG,CAC1BQ,CAAA,CAAW,IACXG,EAAA,EACAN,EAAA,EAH0B,CAAjB,CAH2B,CAUxC,OAAOJ,EA/B6C,CAA1BF,CAwoH5B,CAAAa,SAAA,CAMY,gBANZ;AAr6D6BC,CAAC,kBAADA,CAAqB,QAAQ,CAACC,CAAD,CAAmB,CAW3EC,QAASA,EAAqB,CAACC,CAAD,CAAc,CAC1C,GAAKA,CAAAA,CAAL,CACE,MAAO,KAGLC,EAAAA,CAAOD,CAAAlL,MAAA,CAbGoL,GAaH,CACX,KAAIC,EAAM9G,MAAAC,OAAA,CAAc,IAAd,CAEVvE,EAAA,CAAQkL,CAAR,CAAc,QAAQ,CAACtI,CAAD,CAAM,CAC1BwI,CAAA,CAAIxI,CAAJ,CAAA,CAAW,CAAA,CADe,CAA5B,CAGA,OAAOwI,EAXmC,CAc5CC,QAASA,EAAkB,CAACC,CAAD,CAAiBC,CAAjB,CAAqC,CAC9D,GAAID,CAAJ,EAAsBC,CAAtB,CAA0C,CACxC,IAAIC,EAAkBR,CAAA,CAAsBO,CAAtB,CACtB,OAAOD,EAAAvL,MAAA,CAzBKoL,GAyBL,CAAAM,KAAA,CAAqC,QAAQ,CAAC7L,CAAD,CAAY,CAC9D,MAAO4L,EAAA,CAAgB5L,CAAhB,CADuD,CAAzD,CAFiC,CADoB,CAShE8L,QAASA,EAAS,CAACC,CAAD,CAAWvL,CAAX,CAAoBwL,CAApB,CAAsCC,CAAtC,CAAyD,CACzE,MAAOC,EAAA,CAAMH,CAAN,CAAAF,KAAA,CAAqB,QAAQ,CAACb,CAAD,CAAK,CACvC,MAAOA,EAAA,CAAGxK,CAAH,CAAYwL,CAAZ,CAA8BC,CAA9B,CADgC,CAAlC,CADkE,CAM3EE,QAASA,EAAmB,CAACC,CAAD,CAAYC,CAAZ,CAAiB,CAC3C,IAAIlN,EAAwC,CAAxCA,CAAIe,CAACkM,CAAApL,SAADd,EAAuB,EAAvBA,QAAR,CACId,EAA2C,CAA3CA,CAAIc,CAACkM,CAAAlL,YAADhB,EAA0B,EAA1BA,QACR,OAAOmM,EAAA,CAAMlN,CAAN,EAAWC,CAAX,CAAeD,CAAf,EAAoBC,CAHgB,CAnC7C,IAAI8M,EAAQ,IAAAA,MAARA,CAAqB,CACvBI,KAAM,EADiB,CAEvBC,OAAQ,EAFe,CAGvBjN,KAAM,EAHiB,CAyCzB4M,EAAA5M,KAAAkN,KAAA,CAAgB,QAAQ,CAAChM,CAAD,CAAUwB,CAAV,CAAwBgK,CAAxB,CAA0C,CAEhE,MAAO,CAAChK,CAAAyK,WAAR,EAAmCN,CAAA,CAAoBnK,CAApB,CAF6B,CAAlE,CAKAkK,EAAAI,KAAAE,KAAA,CAAgB,QAAQ,CAAChM,CAAD;AAAUwB,CAAV,CAAwBgK,CAAxB,CAA0C,CAGhE,MAAO,CAAChK,CAAAyK,WAAR,EAAmC,CAACN,CAAA,CAAoBnK,CAApB,CAH4B,CAAlE,CAMAkK,EAAAI,KAAAE,KAAA,CAAgB,QAAQ,CAAChM,CAAD,CAAUwB,CAAV,CAAwBgK,CAAxB,CAA0C,CAGhE,MAAiC,OAAjC,EAAOA,CAAAxI,MAAP,EAA4CxB,CAAAyK,WAHoB,CAAlE,CAMAP,EAAAI,KAAAE,KAAA,CAAgB,QAAQ,CAAChM,CAAD,CAAUwB,CAAV,CAAwBgK,CAAxB,CAA0C,CAEhE,MAAOA,EAAAS,WAAP,EA/DkBC,CA+DlB,GAAsCV,CAAAW,MAAtC,EAAkF,CAAC3K,CAAAyK,WAFnB,CAAlE,CAKAP,EAAAK,OAAAC,KAAA,CAAkB,QAAQ,CAAChM,CAAD,CAAUwB,CAAV,CAAwBgK,CAAxB,CAA0C,CAElE,MAAOA,EAAAS,WAAP,EAAsCzK,CAAAyK,WAF4B,CAApE,CAKAP,EAAAK,OAAAC,KAAA,CAAkB,QAAQ,CAAChM,CAAD,CAAUwB,CAAV,CAAwBgK,CAAxB,CAA0C,CAGlE,MA1EkBU,EA0ElB,GAAOV,CAAAW,MAAP,EAAmD3K,CAAAyK,WAHe,CAApE,CAMAP,EAAAK,OAAAC,KAAA,CAAkB,QAAQ,CAAChM,CAAD,CAAUwB,CAAV,CAAwBgK,CAAxB,CAA0C,CAC9DY,CAAAA,CAAK5K,CAAAhB,SACL6L,EAAAA,CAAK7K,CAAAd,YACT,KAAI4L,EAAKd,CAAAhL,SACL+L,EAAAA,CAAKf,CAAA9K,YAGT,OAAK2F,EAAA,CAAY+F,CAAZ,CAAL,EAAwB/F,CAAA,CAAYgG,CAAZ,CAAxB,EAA6ChG,CAAA,CAAYiG,CAAZ,CAA7C,EAAgEjG,CAAA,CAAYkG,CAAZ,CAAhE,CACS,CAAA,CADT,CAIOtB,CAAA,CAAmBmB,CAAnB,CAAuBG,CAAvB,CAJP,EAIqCtB,CAAA,CAAmBoB,CAAnB,CAAuBC,CAAvB,CAX6B,CAApE,CAcA,KAAAE,KAAA,CAAY,CAAC,OAAD,CAAU,YAAV,CAAwB,cAAxB,CAAwC,WAAxC;AAAqD,WAArD,CACC,aADD,CACgB,iBADhB,CACmC,kBADnC,CACuD,UADvD,CACmE,eADnE,CAEP,QAAQ,CAAC3C,CAAD,CAAU5B,CAAV,CAAwBwE,CAAxB,CAAwCC,CAAxC,CAAqDC,CAArD,CACCC,CADD,CACgBC,CADhB,CACmCC,EADnC,CACuDvM,CADvD,CACmEwM,CADnE,CACkF,CAM7FC,QAASA,EAAqB,EAAG,CAC/B,IAAIC,EAAmB,CAAA,CACvB,OAAO,SAAQ,CAACzC,CAAD,CAAK,CAKdyC,CAAJ,CACEzC,CAAA,EADF,CAGEvC,CAAAiF,aAAA,CAAwB,QAAQ,EAAG,CACjCD,CAAA,CAAmB,CAAA,CACnBzC,EAAA,EAFiC,CAAnC,CARgB,CAFW,CAuEjC2C,QAASA,EAAa,CAACC,CAAD,CAASpN,CAAT,CAAkBgD,CAAlB,CAAyB,CAC7C,IAAIqK,EAAavK,CAAA,CAAW9C,CAAX,CAAjB,CACIsN,EAAmBxK,CAAA,CAAWsK,CAAX,CADvB,CAGIG,EAAU,EAEd,EADIC,CACJ,CADcC,CAAA,CAAiBzK,CAAjB,CACd,GACEpD,CAAA,CAAQ4N,CAAR,CAAiB,QAAQ,CAAC7H,CAAD,CAAQ,CAC3B+H,CAAAC,KAAA,CAAchI,CAAAtC,KAAd,CAA0BgK,CAA1B,CAAJ,CACEE,CAAAvB,KAAA,CAAarG,CAAAiI,SAAb,CADF,CAEqB,OAFrB,GAEW5K,CAFX,EAEgC0K,CAAAC,KAAA,CAAchI,CAAAtC,KAAd,CAA0BiK,CAA1B,CAFhC,EAGEC,CAAAvB,KAAA,CAAarG,CAAAiI,SAAb,CAJ6B,CAAjC,CASF,OAAOL,EAhBsC,CA8F/CM,QAASA,EAAc,CAAC7N,CAAD,CAAUgD,CAAV,CAAiB8K,CAAjB,CAAiC,CAqPtDC,QAASA,EAAc,CAACC,CAAD,CAAShL,CAAT,CAAgBiL,CAAhB,CAAuB1E,CAAvB,CAA6B,CAClD2E,CAAA,CAAyB,QAAQ,EAAG,CAClC,IAAIC,EAAYhB,CAAA,CAAcC,CAAd,CAAsBpN,CAAtB,CAA+BgD,CAA/B,CACZmL,EAAAzO,OAAJ,EAKEmK,CAAA,CAAM,QAAQ,EAAG,CACfjK,CAAA,CAAQuO,CAAR,CAAmB,QAAQ,CAACP,CAAD,CAAW,CACpCA,CAAA,CAAS5N,CAAT,CAAkBiO,CAAlB,CAAyB1E,CAAzB,CADoC,CAAtC,CADe,CAAjB,CAPgC,CAApC,CAcAyE,EAAAI,SAAA,CAAgBpL,CAAhB;AAAuBiL,CAAvB,CAA8B1E,CAA9B,CAfkD,CAkBpD8E,QAASA,EAAK,CAACC,CAAD,CAAS,CACCtO,IAAAA,EAAAA,CAAAA,CAAShB,EAAAA,CA5xEjCA,EAAA+C,mBAAJ,GACE/B,CAAAU,YAAA,CAAoB1B,CAAA+C,mBAApB,CACA,CAAA/C,CAAA+C,mBAAA,CAA6B,IAF/B,CAII/C,EAAAuP,cAAJ,GACEvO,CAAAU,YAAA,CAAoB1B,CAAAuP,cAApB,CACA,CAAAvP,CAAAuP,cAAA,CAAwB,IAF1B,CAyxEMC,GAAA,CAAsBxO,CAAtB,CAA+BhB,CAA/B,CACAkC,GAAA,CAAqBlB,CAArB,CAA8BhB,CAA9B,CACAA,EAAA8B,aAAA,EACAkN,EAAAS,SAAA,CAAgB,CAACH,CAAjB,CALqB,CAnQvB,IAAItP,EAAUmH,EAAA,CAAK2H,CAAL,CAAd,CAEIzK,CAFJ,CAEU+J,CAEV,IADApN,CACA,CADUD,EAAA,CAAyBC,CAAzB,CACV,CACEqD,CACA,CADOP,CAAA,CAAW9C,CAAX,CACP,CAAAoN,CAAA,CAASpN,CAAAoN,OAAA,EAGX,KAAApO,EAAU4B,EAAA,CAAwB5B,CAAxB,CAAV,CAIIgP,EAAS,IAAInB,CAJjB,CAOIqB,EAA2BlB,CAAA,EAE3BnO,GAAA,CAAQG,CAAAwB,SAAR,CAAJ,GACExB,CAAAwB,SADF,CACqBxB,CAAAwB,SAAA1B,KAAA,CAAsB,GAAtB,CADrB,CAIIE,EAAAwB,SAAJ,EAAyB,CAAAf,CAAA,CAAST,CAAAwB,SAAT,CAAzB,GACExB,CAAAwB,SADF,CACqB,IADrB,CAII3B,GAAA,CAAQG,CAAA0B,YAAR,CAAJ,GACE1B,CAAA0B,YADF,CACwB1B,CAAA0B,YAAA5B,KAAA,CAAyB,GAAzB,CADxB,CAIIE,EAAA0B,YAAJ,EAA4B,CAAAjB,CAAA,CAAST,CAAA0B,YAAT,CAA5B,GACE1B,CAAA0B,YADF;AACwB,IADxB,CAII1B,EAAAG,KAAJ,EAAqB,CAAAiH,EAAA,CAASpH,CAAAG,KAAT,CAArB,GACEH,CAAAG,KADF,CACiB,IADjB,CAIIH,EAAAE,GAAJ,EAAmB,CAAAkH,EAAA,CAASpH,CAAAE,GAAT,CAAnB,GACEF,CAAAE,GADF,CACe,IADf,CAOA,IAAKmE,CAAAA,CAAL,CAEE,MADAgL,EAAA,EACOL,CAAAA,CAGLxO,EAAAA,CAAY,CAAC6D,CAAA7D,UAAD,CAAiBR,CAAAwB,SAAjB,CAAmCxB,CAAA0B,YAAnC,CAAA5B,KAAA,CAA6D,GAA7D,CAChB,IAAK,CAAA4P,EAAA,CAAsBlP,CAAtB,CAAL,CAEE,MADA6O,EAAA,EACOL,CAAAA,CAGT,KAAIW,EAA4D,CAA5DA,EAAe,CAAC,OAAD,CAAU,MAAV,CAAkB,OAAlB,CAAAC,QAAA,CAAmC5L,CAAnC,CAAnB,CAOI6L,EAAiB,CAACC,CAAlBD,EAAuCnC,CAAA,CAAU,CAAV,CAAAqC,OAAvCF,EAA8DG,CAAAnJ,IAAA,CAA2BxC,CAA3B,CAC9D4L,EAAAA,CAAqB,CAACJ,CAAtBI,EAAwCC,CAAArJ,IAAA,CAA2BxC,CAA3B,CAAxC4L,EAA6E,EACjF,KAAIE,EAAuB,CAAEhD,CAAA8C,CAAA9C,MAIxB0C,EAAL,EAAyBM,CAAzB,EAnVmBC,CAmVnB,EAAiDH,CAAA9C,MAAjD,GACE0C,CADF,CACmB,CAACQ,CAAA,CAAqBrP,CAArB,CAA8BoN,CAA9B,CAAsCpK,CAAtC,CADpB,CAIA,IAAI6L,CAAJ,CAEE,MADAR,EAAA,EACOL,CAAAA,CAGLW,EAAJ,EACEW,EAAA,CAAqBtP,CAArB,CAGEwB,EAAAA,CAAe,CACjByK,WAAY0C,CADK,CAEjB3O,QAASA,CAFQ,CAGjBgD,MAAOA,CAHU,CAIjBxC,SAAUxB,CAAAwB,SAJO,CAKjBE,YAAa1B,CAAA0B,YALI,CAMjB2N,MAAOA,CANU,CAOjBrP,QAASA,CAPQ,CAQjBgP,OAAQA,CARS,CAWnB,IAAImB,CAAJ,CAA0B,CAExB,GADwB7D,CAAAiE,CAAU,MAAVA,CAAkBvP,CAAlBuP,CAA2B/N,CAA3B+N,CAAyCN,CAAzCM,CACxB,CAAuB,CACrB,GA7WYrD,CA6WZ,GAAI+C,CAAA9C,MAAJ,CAEE,MADAkC,EAAA,EACOL,CAAAA,CAEP1M,EAAA,CAAsBtB,CAAtB,CAA+BiP,CAA/B,CAAkDzN,CAAlD,CACA;MAAOyN,EAAAjB,OANY,CAUvB,GAD0B1C,CAAAkE,CAAU,QAAVA,CAAoBxP,CAApBwP,CAA6BhO,CAA7BgO,CAA2CP,CAA3CO,CAC1B,CACE,GAvXYtD,CAuXZ,GAAI+C,CAAA9C,MAAJ,CAIE8C,CAAAjB,OAAAyB,IAAA,EAJF,KAKO,IAAIR,CAAAhD,WAAJ,CAILgD,CAAAZ,MAAA,EAJK,KASL,OAFA/M,EAAA,CAAsBtB,CAAtB,CAA+BiP,CAA/B,CAAkDzN,CAAlD,CAEOwM,CAAAiB,CAAAjB,OAfX,KAsBE,IADwB1C,CAAAoE,CAAU,MAAVA,CAAkB1P,CAAlB0P,CAA2BlO,CAA3BkO,CAAyCT,CAAzCS,CACxB,CACE,GA7YUxD,CA6YV,GAAI+C,CAAA9C,MAAJ,CA5OC7K,CAAA,CA6O2BtB,CA7O3B,CA6OoCwB,CA7OpC,CAA0C,EAA1C,CA4OD,KAUE,OAPAuB,GAAA,CAAiC/C,CAAjC,CAA0C2O,CAAA,CAAe3L,CAAf,CAAuB,IAAjE,CAAuEhE,CAAvE,CAOOgP,CALPhL,CAKOgL,CALCxM,CAAAwB,MAKDgL,CALsBiB,CAAAjM,MAKtBgL,CAJPhP,CAIOgP,CAJG1M,CAAA,CAAsBtB,CAAtB,CAA+BiP,CAA/B,CAAkDzN,CAAlD,CAIHwM,CAAAiB,CAAAjB,OA7CW,CAA1B,IAzMO1M,EAAA,CA6PqBtB,CA7PrB,CA6P8BwB,CA7P9B,CAA0C,EAA1C,CAoQP,EADImO,CACJ,CADuBnO,CAAAyK,WACvB,IAEE0D,CAFF,CAE6C,SAF7C,GAEsBnO,CAAAwB,MAFtB,EAE8G,CAF9G,CAE0DkB,MAAA4G,KAAA,CAAYtJ,CAAAxC,QAAAE,GAAZ,EAAuC,EAAvC,CAAAQ,OAF1D,EAGyBiM,CAAA,CAAoBnK,CAApB,CAHzB,CAMA,IAAKmO,CAAAA,CAAL,CAGE,MAFAtB,EAAA,EAEOL,CADP4B,CAAA,CAA2B5P,CAA3B,CACOgO,CAAAA,CAIT,KAAI6B,GAAWZ,CAAAY,QAAXA,EAAwC,CAAxCA,EAA6C,CACjDrO,EAAAqO,QAAA,CAAuBA,CAEvBC,EAAA,CAA0B9P,CAA1B,CAtbmBoP,CAsbnB,CAAqD5N,CAArD,CAEAyG,EAAAiF,aAAA,CAAwB,QAAQ,EAAG,CACjC,IAAI6C,EAAmBb,CAAArJ,IAAA,CAA2BxC,CAA3B,CAAvB,CACI2M,EAAqB,CAACD,CAD1B,CAEAA,EAAmBA,CAAnBA,EAAuC,EAFvC,CAWIJ,EAA0C,CAA1CA,CAAmBjQ,CAJHM,CAAAoN,OAAA,EAIG1N,EAJiB,EAIjBA,QAAnBiQ,GACmD,SADnDA;AACwBI,CAAA/M,MADxB2M,EAE2BI,CAAA9D,WAF3B0D,EAG2BhE,CAAA,CAAoBoE,CAApB,CAH3BJ,CAOJ,IAAIK,CAAJ,EAA0BD,CAAAF,QAA1B,GAAuDA,CAAvD,EAAmEF,CAAAA,CAAnE,CAAqF,CAI/EK,CAAJ,GACExB,EAAA,CAAsBxO,CAAtB,CAA+BhB,CAA/B,CACA,CAAAkC,EAAA,CAAqBlB,CAArB,CAA8BhB,CAA9B,CAFF,CAOA,IAAIgR,CAAJ,EAA2BrB,CAA3B,EAA2CoB,CAAA/M,MAA3C,GAAsEA,CAAtE,CACEhE,CAAA8B,aAAA,EACA,CAAAkN,CAAAyB,IAAA,EAMGE,EAAL,EACEC,CAAA,CAA2B5P,CAA3B,CApBiF,CAArF,IA4BAgD,EAmBA,CAnBSiJ,CAAA8D,CAAA9D,WAAD,EAAgCN,CAAA,CAAoBoE,CAApB,CAAsC,CAAA,CAAtC,CAAhC,CACF,UADE,CAEFA,CAAA/M,MAiBN,CAfA8M,CAAA,CAA0B9P,CAA1B,CA1eckM,CA0ed,CAeA,CAdI+D,CAcJ,CAdiBrD,CAAA,CAAY5M,CAAZ,CAAqBgD,CAArB,CAA4B+M,CAAA/Q,QAA5B,CAcjB,CAZAiR,CAAAC,KAAA,CAAgB,QAAQ,CAACC,CAAD,CAAS,CAC/B9B,CAAA,CAAM,CAAC8B,CAAP,CAEA,EADIJ,CACJ,CADuBb,CAAArJ,IAAA,CAA2BxC,CAA3B,CACvB,GAAwB0M,CAAAF,QAAxB,GAAqDA,CAArD,EACED,CAAA,CAA2B9M,CAAA,CAAW9C,CAAX,CAA3B,CAEF+N,EAAA,CAAeC,CAAf,CAAuBhL,CAAvB,CAA8B,OAA9B,CAAuC,EAAvC,CAN+B,CAAjC,CAYA,CADAgL,CAAAoC,QAAA,CAAeH,CAAf,CACA,CAAAlC,CAAA,CAAeC,CAAf,CAAuBhL,CAAvB,CAA8B,OAA9B,CAAuC,EAAvC,CAlEiC,CAAnC,CAqEA,OAAOgL,EAnP+C,CAgRxDsB,QAASA,GAAoB,CAACtP,CAAD,CAAU,CAEjCqQ,CAAAA,CADOvN,CAAAO,CAAWrD,CAAXqD,CACIiN,iBAAA,CAAsB,mBAAtB,CACf1Q,EAAA,CAAQyQ,CAAR,CAAkB,QAAQ,CAACE,CAAD,CAAQ,CAChC,IAAIpE,EAAQqE,QAAA,CAASD,CAAAE,aAAA,CAjiBFC,iBAiiBE,CAAT,CAAZ,CACIX,EAAmBb,CAAArJ,IAAA,CAA2B0K,CAA3B,CACvB,IAAIR,CAAJ,CACE,OAAQ5D,CAAR,EACE,KAjiBUD,CAiiBV,CACE6D,CAAA/B,OAAAyB,IAAA,EAEF;KAriBaL,CAqiBb,CACEF,CAAAyB,OAAA,CAA8BJ,CAA9B,CALJ,CAJ8B,CAAlC,CAHqC,CAmBvCX,QAASA,EAA0B,CAAC5P,CAAD,CAAU,CACvCqD,CAAAA,CAAOP,CAAA,CAAW9C,CAAX,CACXqD,EAAAuN,gBAAA,CAljBqBF,iBAkjBrB,CACAxB,EAAAyB,OAAA,CAA8BtN,CAA9B,CAH2C,CAM7CwN,QAASA,EAAiB,CAACC,CAAD,CAAaC,CAAb,CAAyB,CACjD,MAAOjO,EAAA,CAAWgO,CAAX,CAAP,GAAkChO,CAAA,CAAWiO,CAAX,CADe,CAWnD1B,QAASA,EAAoB,CAACrP,CAAD,CAAUgR,CAAV,CAAyBhO,CAAzB,CAAgC,CACvDiO,CAAAA,CAAchR,CAAA,CAAOyM,CAAA,CAAU,CAAV,CAAAwE,KAAP,CAClB,KAAIC,EAAsBN,CAAA,CAAkB7Q,CAAlB,CAA2BiR,CAA3B,CAAtBE,EAAyF,MAAzFA,GAAiEnR,CAAA,CAAQ,CAAR,CAAAoR,SAArE,CACIC,EAAsBR,CAAA,CAAkB7Q,CAAlB,CAA2ByM,CAA3B,CAD1B,CAEI6E,EAA0B,CAAA,CAF9B,CAGIC,CAHJ,CAIIC,EAAkBxC,CAAAnJ,IAAA,CAA2B/C,CAAA,CAAW9C,CAAX,CAA3B,CAOtB,MALIyR,CAKJ,CALiBzR,CAAAuJ,KAAA,CAxkBGmI,eAwkBH,CAKjB,IAHEV,CAGF,CAHkBS,CAGlB,EAAOT,CAAP,EAAwBA,CAAAtR,OAAxB,CAAA,CAA8C,CACvC2R,CAAL,GAGEA,CAHF,CAGwBR,CAAA,CAAkBG,CAAlB,CAAiCvE,CAAjC,CAHxB,CAMA,KAAIkF,EAAaX,CAAA,CAAc,CAAd,CACjB,IAlqFW9Q,CAkqFX,GAAIyR,CAAAxR,SAAJ,CAEE,KAGEyR,EAAAA,CAAU1C,CAAArJ,IAAA,CAA2B8L,CAA3B,CAAVC,EAAoD,EAIxD,IAAKN,CAAAA,CAAL,CAA8B,CACxBO,CAAAA,CAAwB7C,CAAAnJ,IAAA,CAA2B8L,CAA3B,CAE5B,IAA8B,CAAA,CAA9B,GAAIE,CAAJ,EAA0D,CAAA,CAA1D,GAAsCL,CAAtC,CAAiE,CAG/DA,CAAA,CAAkB,CAAA,CAElB,MAL+D,CAAjE,IAMqC,CAAA,CAA9B,GAAIK,CAAJ,GACLL,CADK,CACa,CAAA,CADb,CAGPF,EAAA,CAA0BM,CAAA3F,WAZE,CAe9B,GAAI5F,CAAA,CAAYkL,CAAZ,CAAJ,EAAwD,CAAA,CAAxD,GAAoCA,CAApC,CACMhP,CACJ,CADYyO,CAAAzH,KAAA,CAjrFSC,qBAirFT,CACZ,CAAIvD,CAAA,CAAU1D,CAAV,CAAJ,GACEgP,CADF,CACoBhP,CADpB,CAMF,IAAI+O,CAAJ,EAAmD,CAAA,CAAnD,GAA+BC,CAA/B,CAA0D,KAErDJ;CAAL,GAGEA,CAHF,CAGwBN,CAAA,CAAkBG,CAAlB,CAAiCC,CAAjC,CAHxB,CAMA,IAAIE,CAAJ,EAA2BE,CAA3B,CAGE,KAGF,IAAKA,CAAAA,CAAL,GAEEI,CAFF,CAEeT,CAAAzH,KAAA,CAroBGmI,eAqoBH,CAFf,EAGkB,CAEdV,CAAA,CAAgBS,CAChB,SAHc,CAOlBT,CAAA,CAAgBA,CAAA5D,OAAA,EAhE4B,CAoE9C,OADsB,CAACkE,CACvB,EADkDC,CAClD,GAD0F,CAAA,CAC1F,GADsEC,CACtE,EAAyBH,CAAzB,EAAgDF,CAjFW,CAoF7DrB,QAASA,EAAyB,CAAC9P,CAAD,CAAUmM,CAAV,CAAiByF,CAAjB,CAA0B,CAC1DA,CAAA,CAAUA,CAAV,EAAqB,EACrBA,EAAAzF,MAAA,CAAgBA,CAEZ9I,EAAAA,CAAOP,CAAA,CAAW9C,CAAX,CACXqD,EAAAyO,aAAA,CA1pBqBpB,iBA0pBrB,CAAwCvE,CAAxC,CAGI4F,EAAAA,CAAW,CADXC,CACW,CADA9C,CAAArJ,IAAA,CAA2BxC,CAA3B,CACA,EACTnB,EAAA,CAAO8P,CAAP,CAAiBJ,CAAjB,CADS,CAETA,CACN1C,EAAApJ,IAAA,CAA2BzC,CAA3B,CAAiC0O,CAAjC,CAX0D,CAjjB5D,IAAI7C,EAAyB,IAAIvC,CAAjC,CACIqC,EAAyB,IAAIrC,CADjC,CAEImC,EAAoB,IAFxB,CA0BImD,EAAkBhK,CAAAiK,OAAA,CACpB,QAAQ,EAAG,CAAE,MAAiD,EAAjD,GAAOpF,EAAAqF,qBAAT,CADS,CAEpB,QAAQ,CAACC,CAAD,CAAU,CACXA,CAAL,GACAH,CAAA,EASA,CAAAhK,CAAAiF,aAAA,CAAwB,QAAQ,EAAG,CACjCjF,CAAAiF,aAAA,CAAwB,QAAQ,EAAG,CAGP,IAA1B,GAAI4B,CAAJ,GACEA,CADF,CACsB,CAAA,CADtB,CAHiC,CAAnC,CADiC,CAAnC,CAVA,CADgB,CAFE,CA1BtB,CAmDIrB,EAAmB,EAnDvB,CAuDI4E,EAAkB1H,CAAA0H,gBAAA,EAvDtB,CAwDI3D,GAAyB2D,CAAD,CAEhB,QAAQ,CAAC7S,CAAD,CAAY,CACpB,MAAO6S,EAAAC,KAAA,CAAqB9S,CAArB,CADa,CAFJ,CAChB,QAAQ,EAAG,CAAE,MAAO,CAAA,CAAT,CAzDvB,CA8DIgP,GAAwB7N,CAAA,CAA6BJ,CAA7B,CA9D5B;AAqEImN,EAAW6E,IAAAC,UAAA9E,SAAXA,EAAsC,QAAQ,CAACpP,CAAD,CAAM,CAEtD,MAAO,KAAP,GAAgBA,CAAhB,EAAuB,CAAG,EAAA,IAAAmU,wBAAA,CAA6BnU,CAA7B,CAAA,CAAoC,EAApC,CAF4B,CAyBxD,OAAO,CACLoU,GAAIA,QAAQ,CAAC1P,CAAD,CAAQ2P,CAAR,CAAmB/E,CAAnB,CAA6B,CACnCvK,CAAAA,CAAOjD,EAAA,CAAmBuS,CAAnB,CACXlF,EAAA,CAAiBzK,CAAjB,CAAA,CAA0ByK,CAAA,CAAiBzK,CAAjB,CAA1B,EAAqD,EACrDyK,EAAA,CAAiBzK,CAAjB,CAAAgJ,KAAA,CAA6B,CAC3B3I,KAAMA,CADqB,CAE3BuK,SAAUA,CAFiB,CAA7B,CAHuC,CADpC,CAULgF,IAAKA,QAAQ,CAAC5P,CAAD,CAAQ2P,CAAR,CAAmB/E,CAAnB,CAA6B,CAQxCiF,QAASA,EAAkB,CAACC,CAAD,CAAOC,CAAP,CAAuBC,CAAvB,CAAsC,CAC/D,IAAIC,EAAgB7S,EAAA,CAAmB2S,CAAnB,CACpB,OAAOD,EAAAI,OAAA,CAAY,QAAQ,CAACvN,CAAD,CAAQ,CAGjC,MAAO,EAFOA,CAAAtC,KAEP,GAFsB4P,CAEtB,GADWD,CAAAA,CACX,EAD4BrN,CAAAiI,SAC5B,GAD+CoF,CAC/C,EAH0B,CAA5B,CAFwD,CAPjE,IAAIxF,EAAUC,CAAA,CAAiBzK,CAAjB,CACTwK,EAAL,GAEAC,CAAA,CAAiBzK,CAAjB,CAFA,CAE+C,CAArB,GAAAmQ,SAAAzT,OAAA,CACpB,IADoB,CAEpBmT,CAAA,CAAmBrF,CAAnB,CAA4BmF,CAA5B,CAAuC/E,CAAvC,CAJN,CAFwC,CAVrC,CA4BLwF,IAAKA,QAAQ,CAACpT,CAAD,CAAUgR,CAAV,CAAyB,CACpC3S,EAAA,CAAUkI,EAAA,CAAUvG,CAAV,CAAV,CAA8B,SAA9B,CAAyC,gBAAzC,CACA3B,GAAA,CAAUkI,EAAA,CAAUyK,CAAV,CAAV,CAAoC,eAApC,CAAqD,gBAArD,CACAhR,EAAAuJ,KAAA,CAhOkBmI,eAgOlB,CAAkCV,CAAlC,CAHoC,CA5BjC,CAkCLhF,KAAMA,QAAQ,CAAChM,CAAD,CAAUgD,CAAV,CAAiBhE,CAAjB,CAA0B8B,CAA1B,CAAwC,CACpD9B,CAAA;AAAUA,CAAV,EAAqB,EACrBA,EAAA8B,aAAA,CAAuBA,CACvB,OAAO+M,EAAA,CAAe7N,CAAf,CAAwBgD,CAAxB,CAA+BhE,CAA/B,CAH6C,CAlCjD,CA6CLqU,QAASA,QAAQ,CAACrT,CAAD,CAAUsT,CAAV,CAAgB,CAC/B,IAAIC,EAAWJ,SAAAzT,OAEf,IAAiB,CAAjB,GAAI6T,CAAJ,CAEED,CAAA,CAAO,CAAExE,CAAAA,CAFX,KAME,IAFiBvI,EAAAiN,CAAUxT,CAAVwT,CAEjB,CAGO,CACL,IAAInQ,EAAOP,CAAA,CAAW9C,CAAX,CAAX,CACIyT,EAAezE,CAAAnJ,IAAA,CAA2BxC,CAA3B,CAEF,EAAjB,GAAIkQ,CAAJ,CAEED,CAFF,CAES,CAACG,CAFV,CAKEzE,CAAAlJ,IAAA,CAA2BzC,CAA3B,CAAiC,CAACiQ,CAAlC,CATG,CAHP,IAEEA,EAAA,CAAOxE,CAAP,CAA2B,CAAE9O,CAAAA,CAejC,OAAOsT,EA1BwB,CA7C5B,CAhGsF,CAHnF,CA7F+D,CAAhD5I,CAq6D7B,CAAAD,SAAA,CAOY,aAPZ,CAlwC0BiJ,CAAC,kBAADA,CAAqB,QAAQ,CAAC/I,CAAD,CAAmB,CAexEgJ,QAASA,EAAS,CAAC3T,CAAD,CAAU,CAC1B,MAAOA,EAAAuJ,KAAA,CAXgBqK,mBAWhB,CADmB,CAZ5B,IAAIC,EAAU,IAAAA,QAAVA,CAAyB,EAgB7B,KAAArH,KAAA,CAAY,CAAC,UAAD,CAAa,YAAb,CAA2B,WAA3B,CAAwC,iBAAxC,CAA2D,WAA3D,CAAwE,gBAAxE,CACP,QAAQ,CAACjM,CAAD,CAAa0H,CAAb,CAA2B6L,CAA3B,CAAwCjH,CAAxC,CAA2DF,CAA3D,CAAwEoH,CAAxE,CAAwF,CAKnGC,QAASA,EAAc,CAACC,CAAD,CAAa,CAqBlCC,QAASA,EAAW,CAACvO,CAAD,CAAQ,CAC1B,GAAIA,CAAAwO,UAAJ,CAAqB,MAAOxO,EAC5BA,EAAAwO,UAAA,CAAkB,CAAA,CAElB,KAAIC;AAAczO,CAAA0O,QAAlB,CACI1C,EAAayC,CAAAzC,WACjB2C,EAAAxO,IAAA,CAAWsO,CAAX,CAAwBzO,CAAxB,CAGA,KADA,IAAI4O,CACJ,CAAO5C,CAAP,CAAA,CAAmB,CAEjB,GADA4C,CACA,CADcD,CAAAzO,IAAA,CAAW8L,CAAX,CACd,CAAiB,CACV4C,CAAAJ,UAAL,GACEI,CADF,CACgBL,CAAA,CAAYK,CAAZ,CADhB,CAGA,MAJe,CAMjB5C,CAAA,CAAaA,CAAAA,WARI,CAWnBtB,CAACkE,CAADlE,EAAgBmE,CAAhBnE,UAAArE,KAAA,CAAoCrG,CAApC,CACA,OAAOA,EArBmB,CApB5B,IAAI6O,EAAO,CAAEnE,SAAU,EAAZ,CAAX,CACIvQ,CADJ,CACOwU,EAAS,IAAI3H,CAIpB,KAAK7M,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgBmU,CAAAvU,OAAhB,CAAmCI,CAAA,EAAnC,CAAwC,CACtC,IAAI8L,EAAYqI,CAAA,CAAWnU,CAAX,CAChBwU,EAAAxO,IAAA,CAAW8F,CAAAyI,QAAX,CAA8BJ,CAAA,CAAWnU,CAAX,CAA9B,CAA8C,CAC5CuU,QAASzI,CAAAyI,QADmC,CAE5C7J,GAAIoB,CAAApB,GAFwC,CAG5C6F,SAAU,EAHkC,CAA9C,CAFsC,CASxC,IAAKvQ,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgBmU,CAAAvU,OAAhB,CAAmCI,CAAA,EAAnC,CACEoU,CAAA,CAAYD,CAAA,CAAWnU,CAAX,CAAZ,CAGF,OA0BA2U,SAAgB,CAACD,CAAD,CAAO,CACrB,IAAIE,EAAS,EAAb,CACI1K,EAAQ,EADZ,CAEIlK,CAEJ,KAAKA,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgB0U,CAAAnE,SAAA3Q,OAAhB,CAAsCI,CAAA,EAAtC,CACEkK,CAAAgC,KAAA,CAAWwI,CAAAnE,SAAA,CAAcvQ,CAAd,CAAX,CAGE6U,EAAAA,CAAwB3K,CAAAtK,OAC5B,KAAIkV,EAAmB,CAAvB,CACIC,EAAM,EAEV,KAAK/U,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgBkK,CAAAtK,OAAhB,CAA8BI,CAAA,EAA9B,CAAmC,CACjC,IAAI6F,EAAQqE,CAAA,CAAMlK,CAAN,CACiB,EAA7B,EAAI6U,CAAJ,GACEA,CAGA,CAHwBC,CAGxB,CAFAA,CAEA,CAFmB,CAEnB,CADAF,CAAA1I,KAAA,CAAY6I,CAAZ,CACA,CAAAA,CAAA,CAAM,EAJR,CAMAA,EAAA7I,KAAA,CAASrG,CAAA6E,GAAT,CACA7E,EAAA0K,SAAAzQ,QAAA,CAAuB,QAAQ,CAACkV,CAAD,CAAa,CAC1CF,CAAA,EACA5K;CAAAgC,KAAA,CAAW8I,CAAX,CAF0C,CAA5C,CAIAH,EAAA,EAbiC,CAgB/BE,CAAAnV,OAAJ,EACEgV,CAAA1I,KAAA,CAAY6I,CAAZ,CAGF,OAAOH,EAjCc,CA1BhB,CAAQF,CAAR,CAnB2B,CAHpC,IAAIO,EAAiB,EAArB,CACIvG,EAAwB7N,CAAA,CAA6BJ,CAA7B,CAqF5B,OAAO,SAAQ,CAACP,CAAD,CAAUgD,CAAV,CAAiBhE,CAAjB,CAA0B,CAqHvCgW,QAASA,EAAc,CAAC3R,CAAD,CAAO,CAExB8G,CAAAA,CAAQ9G,CAAA4R,aAAA,CAlOQC,gBAkOR,CAAA,CACJ,CAAC7R,CAAD,CADI,CAEJA,CAAAiN,iBAAA,CAHO6E,kBAGP,CACR,KAAIC,EAAU,EACdxV,EAAA,CAAQuK,CAAR,CAAe,QAAQ,CAAC9G,CAAD,CAAO,CAC5B,IAAIvB,EAAOuB,CAAAoN,aAAA,CAvOOyE,gBAuOP,CACPpT,EAAJ,EAAYA,CAAApC,OAAZ,EACE0V,CAAApJ,KAAA,CAAa3I,CAAb,CAH0B,CAA9B,CAMA,OAAO+R,EAZqB,CAe9BC,QAASA,EAAe,CAACpB,CAAD,CAAa,CACnC,IAAIqB,EAAqB,EAAzB,CACIC,EAAY,EAChB3V,EAAA,CAAQqU,CAAR,CAAoB,QAAQ,CAACrI,CAAD,CAAY4J,CAAZ,CAAmB,CAE7C,IAAInS,EAAOP,CAAA,CADG8I,CAAA5L,QACH,CAAX,CAEIyV,EAAkD,CAAlDA,EAAc,CAAC,OAAD,CAAU,MAAV,CAAA7G,QAAA,CADNhD,CAAA5I,MACM,CAFlB,CAGI0S,EAAc9J,CAAAK,WAAA,CAAuB+I,CAAA,CAAe3R,CAAf,CAAvB,CAA8C,EAEhE,IAAIqS,CAAAhW,OAAJ,CAAwB,CACtB,IAAIiW,EAAYF,CAAA,CAAc,IAAd,CAAqB,MAErC7V,EAAA,CAAQ8V,CAAR,CAAqB,QAAQ,CAACE,CAAD,CAAS,CACpC,IAAIpT,EAAMoT,CAAAnF,aAAA,CA7PIyE,gBA6PJ,CACVK,EAAA,CAAU/S,CAAV,CAAA,CAAiB+S,CAAA,CAAU/S,CAAV,CAAjB;AAAmC,EACnC+S,EAAA,CAAU/S,CAAV,CAAA,CAAemT,CAAf,CAAA,CAA4B,CAC1BE,YAAaL,CADa,CAE1BxV,QAASC,CAAA,CAAO2V,CAAP,CAFiB,CAHQ,CAAtC,CAHsB,CAAxB,IAYEN,EAAAtJ,KAAA,CAAwBJ,CAAxB,CAnB2C,CAA/C,CAuBA,KAAIkK,EAAoB,EAAxB,CACIC,EAAe,EACnBnW,EAAA,CAAQ2V,CAAR,CAAmB,QAAQ,CAACS,CAAD,CAAaxT,CAAb,CAAkB,CAC3C,IAAIrD,EAAO6W,CAAA7W,KAAX,CACID,EAAK8W,CAAA9W,GAET,IAAKC,CAAL,EAAcD,CAAd,CAAA,CAYA,IAAI+W,EAAgBhC,CAAA,CAAW9U,CAAA0W,YAAX,CAApB,CACIK,EAAcjC,CAAA,CAAW/U,CAAA2W,YAAX,CADlB,CAEIM,EAAYhX,CAAA0W,YAAAO,SAAA,EAChB,IAAK,CAAAL,CAAA,CAAaI,CAAb,CAAL,CAA8B,CAC5B,IAAIE,EAAQN,CAAA,CAAaI,CAAb,CAARE,CAAkC,CACpCpK,WAAY,CAAA,CADwB,CAEpCqK,YAAaA,QAAQ,EAAG,CACtBL,CAAAK,YAAA,EACAJ,EAAAI,YAAA,EAFsB,CAFY,CAMpCjI,MAAOA,QAAQ,EAAG,CAChB4H,CAAA5H,MAAA,EACA6H,EAAA7H,MAAA,EAFgB,CANkB,CAUpChP,QAASkX,CAAA,CAAuBN,CAAA5W,QAAvB,CAA8C6W,CAAA7W,QAA9C,CAV2B,CAWpCF,KAAM8W,CAX8B,CAYpC/W,GAAIgX,CAZgC,CAapCd,QAAS,EAb2B,CAmBlCiB,EAAAhX,QAAAK,OAAJ,CACE4V,CAAAtJ,KAAA,CAAwBqK,CAAxB,CADF,EAGEf,CAAAtJ,KAAA,CAAwBiK,CAAxB,CACA,CAAAX,CAAAtJ,KAAA,CAAwBkK,CAAxB,CAJF,CApB4B,CA4B9BH,CAAA,CAAaI,CAAb,CAAAf,QAAApJ,KAAA,CAAqC,CACnC,IAAO7M,CAAAa,QAD4B,CACd,KAAMd,CAAAc,QADQ,CAArC,CA3CA,CAAA,IAGMwV,EAEJ,CAFYrW,CAAA,CAAOA,CAAA0W,YAAP,CAA0B3W,CAAA2W,YAEtC;AADIW,CACJ,CADehB,CAAAY,SAAA,EACf,CAAKN,CAAA,CAAkBU,CAAlB,CAAL,GACEV,CAAA,CAAkBU,CAAlB,CACA,CAD8B,CAAA,CAC9B,CAAAlB,CAAAtJ,KAAA,CAAwBiI,CAAA,CAAWuB,CAAX,CAAxB,CAFF,CATyC,CAA7C,CAoDA,OAAOF,EAhF4B,CAmFrCiB,QAASA,EAAsB,CAAC5X,CAAD,CAAGC,CAAH,CAAM,CACnCD,CAAA,CAAIA,CAAAgB,MAAA,CAAQ,GAAR,CACJf,EAAA,CAAIA,CAAAe,MAAA,CAAQ,GAAR,CAGJ,KAFA,IAAI4N,EAAU,EAAd,CAESzN,EAAI,CAAb,CAAgBA,CAAhB,CAAoBnB,CAAAe,OAApB,CAA8BI,CAAA,EAA9B,CAAmC,CACjC,IAAI2W,EAAK9X,CAAA,CAAEmB,CAAF,CACT,IAA0B,KAA1B,GAAI2W,CAAA3R,UAAA,CAAa,CAAb,CAAe,CAAf,CAAJ,CAEA,IAAS,IAAA4R,EAAI,CAAb,CAAgBA,CAAhB,CAAoB9X,CAAAc,OAApB,CAA8BgX,CAAA,EAA9B,CACE,GAAID,CAAJ,GAAW7X,CAAA,CAAE8X,CAAF,CAAX,CAAiB,CACfnJ,CAAAvB,KAAA,CAAayK,CAAb,CACA,MAFe,CALc,CAYnC,MAAOlJ,EAAAzO,KAAA,CAAa,GAAb,CAjB4B,CAoBrC6X,QAASA,EAAiB,CAAC5G,CAAD,CAAmB,CAG3C,IAAS,IAAAjQ,EAAI+T,CAAAnU,OAAJI,CAAqB,CAA9B,CAAsC,CAAtC,EAAiCA,CAAjC,CAAyCA,CAAA,EAAzC,CAA8C,CAC5C,IAAI8W,EAAa/C,CAAA,CAAQ/T,CAAR,CACjB,IAAKgU,CAAA+C,IAAA,CAAcD,CAAd,CAAL,GAGIE,CAHJ,CAEchD,CAAAjO,IAAA8D,CAAciN,CAAdjN,CACD,CAAQoG,CAAR,CAHb,EAKE,MAAO+G,EAPmC,CAHH,CA0B7CC,QAASA,GAAsB,CAACnL,CAAD,CAAYoL,CAAZ,CAAuB,CAChDpL,CAAAzM,KAAJ,EAAsByM,CAAA1M,GAAtB,EAQEyU,CAAA,CAPO/H,CAAAzM,KAAAa,QAOP,CAAAoQ,QAAA,CAA2B4G,CAA3B,CAAA,CAAArD,CAAA,CANO/H,CAAA1M,GAAAc,QAMP,CAAAoQ,QAAA,CAA2B4G,CAA3B,CARF,EAQErD,CAAA,CAJO/H,CAAA5L,QAIP,CAAAoQ,QAAA,CAA2B4G,CAA3B,CATkD,CAatDC,QAASA,EAAsB,EAAG,CAChC,IAAIjJ,EAAS2F,CAAA,CAAU3T,CAAV,CACTgO,EAAAA,CAAJ,EAAyB,OAAzB,GAAehL,CAAf,EAAqChE,CAAAiC,oBAArC;AACE+M,CAAAyB,IAAA,EAH8B,CAOlCpB,QAASA,EAAK,CAAC6I,CAAD,CAAW,CACvBlX,CAAA4S,IAAA,CAAY,UAAZ,CAAwBqE,CAAxB,CACajX,EA3XjBmX,WAAA,CAPuBvD,mBAOvB,CA6XIpF,EAAA,CAAsBxO,CAAtB,CAA+BhB,CAA/B,CACAkC,GAAA,CAAqBlB,CAArB,CAA8BhB,CAA9B,CACAA,EAAA8B,aAAA,EAEIsW,EAAJ,EACE7W,CAAAG,YAAA,CAAqBV,CAArB,CAA8BoX,CAA9B,CAGFpX,EAAAU,YAAA,CAznGmB2W,YAynGnB,CACArJ,EAAAS,SAAA,CAAgB,CAACyI,CAAjB,CAbuB,CAxRzBlY,CAAA,CAAU4B,EAAA,CAAwB5B,CAAxB,CACV,KAAI2P,EAA4D,CAA5DA,EAAe,CAAC,OAAD,CAAU,MAAV,CAAkB,OAAlB,CAAAC,QAAA,CAAmC5L,CAAnC,CAAnB,CAMIgL,EAAS,IAAInB,CAAJ,CAAoB,CAC/B4C,IAAKA,QAAQ,EAAG,CAAEpB,CAAA,EAAF,CADe,CAE/BtC,OAAQA,QAAQ,EAAG,CAAEsC,CAAA,CAAM,CAAA,CAAN,CAAF,CAFY,CAApB,CAKb,IAAK3O,CAAAmU,CAAAnU,OAAL,CAEE,MADA2O,EAAA,EACOL,CAAAA,CAGChO,EAtHZuJ,KAAA,CAHuBqK,mBAGvB,CAsHqB5F,CAtHrB,CAwHE,KAAI3O,EAAUX,EAAA,CAAasB,CAAA8B,KAAA,CAAa,OAAb,CAAb,CAAoCpD,EAAA,CAAaM,CAAAwB,SAAb,CAA+BxB,CAAA0B,YAA/B,CAApC,CAAd,CACI0W,EAAcpY,CAAAoY,YACdA,EAAJ,GACE/X,CACA,EADW,GACX,CADiB+X,CACjB,CAAApY,CAAAoY,YAAA,CAAsB,IAFxB,CAKA,KAAIE,CACA3I,EAAJ,GACE2I,CACA,CADmB,KACnB,CAD2BtU,CAC3B,CAp3FmBuU,UAo3FnB,CAAAhX,CAAAC,SAAA,CAAkBR,CAAlB,CAA2BsX,CAA3B,CAFF,CAKAvC,EAAA/I,KAAA,CAAoB,CAGlBhM,QAASA,CAHS;AAIlBX,QAASA,CAJS,CAKlB2D,MAAOA,CALW,CAMlBiJ,WAAY0C,CANM,CAOlB3P,QAASA,CAPS,CAQlBsX,YAiNFA,QAAoB,EAAG,CACrBtW,CAAAQ,SAAA,CA/kGmB6W,YA+kGnB,CACID,EAAJ,EACE7W,CAAAC,SAAA,CAAkBR,CAAlB,CAA2BoX,CAA3B,CAEEE,EAAJ,GACE/W,CAAAG,YAAA,CAAqBV,CAArB,CAA8BsX,CAA9B,CACA,CAAAA,CAAA,CAAmB,IAFrB,CALqB,CAzNH,CASlBjJ,MAAOA,CATW,CAApB,CAYArO,EAAA0S,GAAA,CAAW,UAAX,CAAuBuE,CAAvB,CAKA,IAA4B,CAA5B,CAAIlC,CAAArV,OAAJ,CAA+B,MAAOsO,EAEtC/F,EAAAiF,aAAA,CAAwB,QAAQ,EAAG,CACjC,IAAI+G,EAAa,EACjBrU,EAAA,CAAQmV,CAAR,CAAwB,QAAQ,CAACpP,CAAD,CAAQ,CAIlCgO,CAAA,CAAUhO,CAAA3F,QAAV,CAAJ,CACEiU,CAAAjI,KAAA,CAAgBrG,CAAhB,CADF,CAGEA,CAAA0I,MAAA,EAPoC,CAAxC,CAYA0G,EAAArV,OAAA,CAAwB,CAExB,KAAI8X,EAAoBnC,CAAA,CAAgBpB,CAAhB,CAAxB,CACIwD,EAAuB,EAE3B7X,EAAA,CAAQ4X,CAAR,CAA2B,QAAQ,CAACE,CAAD,CAAiB,CAClDD,CAAAzL,KAAA,CAA0B,CACxBqI,QAASvR,CAAA,CAAW4U,CAAAvY,KAAA,CAAsBuY,CAAAvY,KAAAa,QAAtB,CAAoD0X,CAAA1X,QAA/D,CADe,CAExBwK,GAAImN,QAA8B,EAAG,CAInCD,CAAApB,YAAA,EAJmC,KAM/BsB,CAN+B,CAMbC,EAAUH,CAAArJ,MAQhC,IAAIsF,CAAA,CAJgB+D,CAAAtC,QAAA0C,CACbJ,CAAAvY,KAAAa,QADa8X,EACkBJ,CAAAxY,GAAAc,QADlB8X,CAEdJ,CAAA1X,QAEF,CAAJ,CAA8B,CAC5B,IAAI+X,EAAYpB,CAAA,CAAkBe,CAAlB,CACZK,EAAJ,GACEH,CADF,CACqBG,CAAAC,MADrB,CAF4B,CAOzBJ,CAAL;CAGMK,CAIJ,CAJsBL,CAAA,EAItB,CAHAK,CAAA/H,KAAA,CAAqB,QAAQ,CAACC,CAAD,CAAS,CACpC0H,CAAA,CAAQ,CAAC1H,CAAT,CADoC,CAAtC,CAGA,CAAA4G,EAAA,CAAuBW,CAAvB,CAAuCO,CAAvC,CAPF,EACEJ,CAAA,EAtBiC,CAFb,CAA1B,CADkD,CAApD,CAwCA9D,EAAA,CAAeC,CAAA,CAAeyD,CAAf,CAAf,CA3DiC,CAAnC,CA8DA,OAAOzJ,EAlHgC,CAxF0D,CADzF,CAnB4D,CAAhD0F,CAkwC1B,CAAAjJ,SAAA,CASY,aATZ,CAzpG0ByN,CAAC,kBAADA,CAAqB,QAAQ,CAACvN,CAAD,CAAmB,CACxE,IAAIwN,EAAY5S,EAAA,EAAhB,CACI6S,EAAmB7S,EAAA,EAEvB,KAAAiH,KAAA,CAAY,CAAC,SAAD,CAAY,UAAZ,CAAwB,iBAAxB,CAA2C,UAA3C,CACC,eADD,CACkB,UADlB,CAC8B,gBAD9B,CACgD,gBADhD,CAEP,QAAQ,CAACxI,CAAD,CAAYzD,CAAZ,CAAwBsM,CAAxB,CAA2CwL,CAA3C,CACCtL,CADD,CACkBuL,CADlB,CAC8BvE,CAD9B,CAC8CwE,CAD9C,CAC8D,CAKzEC,QAASA,EAAS,CAACnV,CAAD,CAAOoV,CAAP,CAAqB,CAErC,IAAI9G,EAAatO,CAAAsO,WAEjB,QADeA,CAAA,qBACf,GADmCA,CAAA,qBACnC,CADqD,EAAE+G,CACvD,GAAkB,GAAlB,CAAwBrV,CAAAoN,aAAA,CAAkB,OAAlB,CAAxB,CAAqD,GAArD,CAA2DgI,CAJtB,CAuBvCE,QAASA,EAA6B,CAACtV,CAAD,CAAO7D,CAAP,CAAkBoZ,CAAlB,CAA4B3U,CAA5B,CAAwC,CAC5E,IAAI4U,CAK4B,EAAhC,CAAIV,CAAAzS,MAAA,CAAgBkT,CAAhB,CAAJ,GACEC,CAEA,CAFUT,CAAAvS,IAAA,CAAqB+S,CAArB,CAEV,CAAKC,CAAL,GACMC,CAYJ,CAZuB1Z,CAAA,CAAYI,CAAZ,CAAuB,UAAvB,CAYvB;AAVAe,CAAAC,SAAA,CAAkB6C,CAAlB,CAAwByV,CAAxB,CAUA,CARAD,CAQA,CARU9U,EAAA,CAAiBC,CAAjB,CAA0BX,CAA1B,CAAgCY,CAAhC,CAQV,CALA4U,CAAArR,kBAKA,CAL4BxC,IAAAC,IAAA,CAAS4T,CAAArR,kBAAT,CAAoC,CAApC,CAK5B,CAJAqR,CAAAzR,mBAIA,CAJ6BpC,IAAAC,IAAA,CAAS4T,CAAAzR,mBAAT,CAAqC,CAArC,CAI7B,CAFA7G,CAAAG,YAAA,CAAqB2C,CAArB,CAA2ByV,CAA3B,CAEA,CAAAV,CAAAtS,IAAA,CAAqB8S,CAArB,CAA+BC,CAA/B,CAbF,CAHF,CAoBA,OAAOA,EAAP,EAAkB,EA1B0D,CA+B9EvO,QAASA,GAAc,CAACsD,CAAD,CAAW,CAChCmL,CAAA/M,KAAA,CAAkB4B,CAAlB,CACAmG,EAAAzJ,eAAA,CAA8B,QAAQ,EAAG,CACvC6N,CAAA1S,MAAA,EACA2S,EAAA3S,MAAA,EAQA,KAJA,IAAIuT,EAAYjM,CAAA,EAAhB,CAISjN,EAAI,CAAb,CAAgBA,CAAhB,CAAoBiZ,CAAArZ,OAApB,CAAyCI,CAAA,EAAzC,CACEiZ,CAAA,CAAajZ,CAAb,CAAA,CAAgBkZ,CAAhB,CAEFD,EAAArZ,OAAA,CAAsB,CAbiB,CAAzC,CAFgC,CAmBlCuZ,QAASA,EAAc,CAAC5V,CAAD,CAAO7D,CAAP,CAAkBoZ,CAAlB,CAA4B,CAjE7CM,CAAAA,CAAUf,CAAAtS,IAAA,CAkEwC+S,CAlExC,CAETM,EAAL,GACEA,CACA,CADUnV,EAAA,CAAiBC,CAAjB,CA+DyBX,CA/DzB,CA+DoD8D,EA/DpD,CACV,CAAwC,UAAxC,GAAI+R,CAAAxR,wBAAJ,GACEwR,CAAAxR,wBADF,CACoC,CADpC,CAFF,CASAyQ,EAAArS,IAAA,CAuDsD8S,CAvDtD,CAAwBM,CAAxB,CACA,EAAA,CAAOA,CAuDHC,EAAAA,CAAKD,CAAAzR,eACL2R,EAAAA,CAAKF,CAAA7R,gBACT6R,EAAAG,SAAA,CAAmBF,CAAA,EAAMC,CAAN,CACbpU,IAAAC,IAAA,CAASkU,CAAT;AAAaC,CAAb,CADa,CAEZD,CAFY,EAENC,CACbF,EAAAI,YAAA,CAAsBtU,IAAAC,IAAA,CAClBiU,CAAA1R,kBADkB,CACU0R,CAAAxR,wBADV,CAElBwR,CAAA9R,mBAFkB,CAItB,OAAO8R,EAX0C,CA5EnD,IAAI1K,EAAwB7N,CAAA,CAA6BJ,CAA7B,CAA5B,CAEImY,EAAgB,CAFpB,CAwDIK,EAAe,EAkCnB,OAAOQ,SAAa,CAACvZ,CAAD,CAAU8N,CAAV,CAA0B,CAgQ5C0L,QAASA,EAAK,EAAG,CACfnL,CAAA,EADe,CAIjBhE,QAASA,EAAQ,EAAG,CAClBgE,CAAA,CAAM,CAAA,CAAN,CADkB,CAIpBA,QAASA,EAAK,CAAC6I,CAAD,CAAW,CAGvB,GAAI,EAAAuC,CAAA,EAAoBC,EAApB,EAA0CC,CAA1C,CAAJ,CAAA,CACAF,CAAA,CAAkB,CAAA,CAClBE,EAAA,CAAkB,CAAA,CAEb3a,EAAA4a,yBAAL,EACErZ,CAAAG,YAAA,CAAqBV,CAArB,CAA8B+B,EAA9B,CAEFxB,EAAAG,YAAA,CAAqBV,CAArB,CAA8BuO,EAA9B,CAEA9K,GAAA,CAAwBJ,CAAxB,CAA8B,CAAA,CAA9B,CACAD,GAAA,CAAiBC,CAAjB,CAAuB,CAAA,CAAvB,CAEAzD,EAAA,CAAQia,CAAR,CAAyB,QAAQ,CAAClU,CAAD,CAAQ,CAIvCtC,CAAAS,MAAA,CAAW6B,CAAA,CAAM,CAAN,CAAX,CAAA,CAAuB,EAJgB,CAAzC,CAOA6I,EAAA,CAAsBxO,CAAtB,CAA+BhB,CAA/B,CACAkC,GAAA,CAAqBlB,CAArB,CAA8BhB,CAA9B,CAEIkF,OAAA4G,KAAA,CAAYgP,CAAZ,CAAApa,OAAJ,EACEE,CAAA,CAAQka,CAAR,CAAuB,QAAQ,CAACvX,CAAD,CAAQK,CAAR,CAAc,CAC3CL,CAAA,CAAQc,CAAAS,MAAAiW,YAAA,CAAuBnX,CAAvB,CAA6BL,CAA7B,CAAR,CACQc,CAAAS,MAAAkW,eAAA,CAA0BpX,CAA1B,CAFmC,CAA7C,CAWF,IAAI5D,CAAAib,OAAJ,CACEjb,CAAAib,OAAA,EAGEC,GAAJ,EAAcA,EAAAxa,OAAd,EAEEM,CAAA4S,IAAA,CAAYsH,EAAApb,KAAA,CAAY,GAAZ,CAAZ;AAA8Bqb,CAA9B,CAIF,KAAIC,EAAqBpa,CAAAuJ,KAAA,CArvBT8Q,cAqvBS,CACrBD,EAAJ,GACE/B,CAAAtM,OAAA,CAAgBqO,CAAA,CAAmB,CAAnB,CAAAE,MAAhB,CACA,CAAAta,CAAAmX,WAAA,CAxvBckD,cAwvBd,CAFF,CAMIrM,EAAJ,EACEA,CAAAS,SAAA,CAAgB,CAACyI,CAAjB,CApDF,CAHuB,CA2DzBqD,QAASA,EAAa,CAACjX,CAAD,CAAW,CAC3BhB,CAAAkY,gBAAJ,EACEpX,EAAA,CAAiBC,CAAjB,CAAuBC,CAAvB,CAGEhB,EAAAmY,uBAAJ,EACEhX,EAAA,CAAwBJ,CAAxB,CAA8B,CAAEC,CAAAA,CAAhC,CAN6B,CAUjCoX,QAASA,EAA0B,EAAG,CACpC1M,CAAA,CAAS,IAAInB,CAAJ,CAAoB,CAC3B4C,IAAK+J,CADsB,CAE3BzN,OAAQ1B,CAFmB,CAApB,CAMTC,GAAA,CAAevJ,CAAf,CACAsN,EAAA,EAEA,OAAO,CACLsM,cAAe,CAAA,CADV,CAEL3C,MAAOA,QAAQ,EAAG,CAChB,MAAOhK,EADS,CAFb,CAKLyB,IAAK+J,CALA,CAV6B,CAmBtCW,QAASA,EAAmB,CAACnX,CAAD,CAAQ,CAClCA,CAAA4X,gBAAA,EACA,KAAIC,EAAK7X,CAAA8X,cAALD,EAA4B7X,CAI5B+X,EAAAA,CAAYF,CAAAG,iBAAZD,EAAmCE,IAAAC,IAAA,EAInCC,EAAAA,CAAcpW,UAAA,CAAW8V,CAAAM,YAAAC,QAAA,CA7kBCC,CA6kBD,CAAX,CASdrW,KAAAC,IAAA,CAAS8V,CAAT,CAAqBO,CAArB,CAAgC,CAAhC,CAAJ,EAA0CC,CAA1C,EAA0DJ,CAA1D,EAAyE7B,CAAzE,GAGEI,EACA,CADqB,CAAA,CACrB,CAAArL,CAAA,EAJF,CAnBkC,CA2BpC2J,QAASA,EAAK,EAAG,CAkDfL,QAASA,EAAqB,EAAG,CAG/B,GAAI8B,CAAAA,CAAJ,CAAA,CAEAc,CAAA,CAAc,CAAA,CAAd,CAEA3a,EAAA,CAAQia,CAAR;AAAyB,QAAQ,CAAClU,CAAD,CAAQ,CAGvCtC,CAAAS,MAAA,CAFU6B,CAAAnD,CAAM,CAANA,CAEV,CAAA,CADYmD,CAAApD,CAAM,CAANA,CAF2B,CAAzC,CAMAiM,EAAA,CAAsBxO,CAAtB,CAA+BhB,CAA/B,CACAuB,EAAAC,SAAA,CAAkBR,CAAlB,CAA2BuO,EAA3B,CAEA,IAAIjM,CAAAkZ,wBAAJ,CAAmC,CACjCC,EAAA,CAAgBpY,CAAA7D,UAAhB,CAAiC,GAAjC,CAAuCuC,EACvC6W,GAAA,CAAWJ,CAAA,CAAUnV,CAAV,CAAgBoY,EAAhB,CAEXvC,EAAA,CAAUD,CAAA,CAAe5V,CAAf,CAAqBoY,EAArB,CAAoC7C,EAApC,CACV8C,EAAA,CAAgBxC,CAAAG,SAChBA,EAAA,CAAWrU,IAAAC,IAAA,CAASyW,CAAT,CAAwB,CAAxB,CACXpC,EAAA,CAAcJ,CAAAI,YAEd,IAAoB,CAApB,GAAIA,CAAJ,CAAuB,CACrBjL,CAAA,EACA,OAFqB,CAKvB/L,CAAAqZ,eAAA,CAAoD,CAApD,CAAuBzC,CAAA9R,mBACvB9E,EAAAsZ,cAAA,CAAkD,CAAlD,CAAsB1C,CAAA1R,kBAfW,CAkB/BlF,CAAAuZ,oBAAJ,GACEH,CAQA,CARyC,SAAzB,GAAA,MAAO1c,EAAA8c,MAAP,EAAsC5W,EAAA,CAAkBlG,CAAA8c,MAAlB,CAAtC,CACR/W,UAAA,CAAW/F,CAAA8c,MAAX,CADQ,CAERJ,CAMR,CAJArC,CAIA,CAJWrU,IAAAC,IAAA,CAASyW,CAAT,CAAwB,CAAxB,CAIX,CAHAxC,CAAAzR,eAGA,CAHyBiU,CAGzB,CAFAK,EAEA,CAlqBH,CAD0BjV,EAC1B,CAgqBiC4U,CAhqBjC,CAAe,GAAf,CAkqBG,CADA7B,CAAA7N,KAAA,CAAqB+P,EAArB,CACA,CAAA1Y,CAAAS,MAAA,CAAWiY,EAAA,CAAW,CAAX,CAAX,CAAA,CAA4BA,EAAA,CAAW,CAAX,CAT9B,CAYAR,EAAA,CAjsBOS,GAisBP,CAAe3C,CACf4C,EAAA,CAlsBOD,GAksBP,CAAkB1C,CAElB,IAAIta,CAAAkd,OAAJ,CAAoB,CAAA,IACdC,CADc,CACJC,EAAUpd,CAAAkd,OACpB5Z,EAAAqZ,eAAJ;CACEQ,CAEA,CAFW9W,CAEX,CAn3CGgX,gBAm3CH,CADAxC,CAAA7N,KAAA,CAAqB,CAACmQ,CAAD,CAAWC,CAAX,CAArB,CACA,CAAA/Y,CAAAS,MAAA,CAAWqY,CAAX,CAAA,CAAuBC,CAHzB,CAKI9Z,EAAAsZ,cAAJ,GACEO,CAEA,CAFWxY,CAEX,CAx3CG0Y,gBAw3CH,CADAxC,CAAA7N,KAAA,CAAqB,CAACmQ,CAAD,CAAWC,CAAX,CAArB,CACA,CAAA/Y,CAAAS,MAAA,CAAWqY,CAAX,CAAA,CAAuBC,CAHzB,CAPkB,CAchBlD,CAAA9R,mBAAJ,EACE8S,EAAAlO,KAAA,CAAYxF,EAAZ,CAGE0S,EAAA1R,kBAAJ,EACE0S,EAAAlO,KAAA,CAAYvF,EAAZ,CAGF6U,EAAA,CAAYL,IAAAC,IAAA,EACZ,KAAIoB,EAAYf,CAAZe,CAvtBYC,GAutBZD,CAAiDL,CACjDO,EAAAA,CAAUlB,CAAVkB,CAAsBF,CAEtBG,KAAAA,EAAiBzc,CAAAuJ,KAAA,CAt7BP8Q,cAs7BO,CAAjBoC,EAAoD,EAApDA,CACAC,EAAqB,CAAA,CACzB,IAAID,CAAA/c,OAAJ,CAA2B,CACzB,IAAIid,EAAmBF,CAAA,CAAe,CAAf,CAEvB,EADAC,CACA,CADqBF,CACrB,CAD+BG,CAAAC,gBAC/B,EACEvE,CAAAtM,OAAA,CAAgB4Q,CAAArC,MAAhB,CADF,CAGEmC,CAAAzQ,KAAA,CAAoBqC,CAApB,CANuB,CAUvBqO,CAAJ,GACMpC,CAMJ,CANYjC,CAAA,CAASwE,CAAT,CAA6BP,CAA7B,CAAwC,CAAA,CAAxC,CAMZ,CALAG,CAAA,CAAe,CAAf,CAKA,CALoB,CAClBnC,MAAOA,CADW,CAElBsC,gBAAiBJ,CAFC,CAKpB,CADAC,CAAAzQ,KAAA,CAAoBqC,CAApB,CACA,CAAArO,CAAAuJ,KAAA,CAz8BY8Q,cAy8BZ,CAAgCoC,CAAhC,CAPF,CAUA,IAAIvC,EAAAxa,OAAJ,CACEM,CAAA0S,GAAA,CAAWwH,EAAApb,KAAA,CAAY,GAAZ,CAAX,CAA6Bqb,CAA7B,CAGEnb,EAAAE,GAAJ,GACMF,CAAA8d,cAGJ,EAFE/W,EAAA,CAAyB+T,CAAzB,CAAwCzW,CAAxC,CAA8Ca,MAAA4G,KAAA,CAAY9L,CAAAE,GAAZ,CAA9C,CAEF,CAAAkC,EAAA,CAAuBpB,CAAvB;AAAgChB,CAAhC,CAJF,CAlGA,CAH+B,CA6GjC6d,QAASA,EAAkB,EAAG,CAC5B,IAAIJ,EAAiBzc,CAAAuJ,KAAA,CAz9BP8Q,cAy9BO,CAKrB,IAAIoC,CAAJ,CAAoB,CAClB,IAAS,IAAA3c,EAAI,CAAb,CAAgBA,CAAhB,CAAoB2c,CAAA/c,OAApB,CAA2CI,CAAA,EAA3C,CACE2c,CAAA,CAAe3c,CAAf,CAAA,EAEFE,EAAAmX,WAAA,CAl+BYkD,cAk+BZ,CAJkB,CANQ,CA9J9B,GAAIZ,CAAAA,CAAJ,CACA,GAAKpW,CAAAsO,WAAL,CAAA,CASA,IAAIoL,EAAYA,QAAQ,CAACC,CAAD,CAAgB,CACtC,GAAKtD,EAAL,CAQWC,CAAJ,EAAuBqD,CAAvB,GACLrD,CACA,CADkB,CAAA,CAClB,CAAAtL,CAAA,EAFK,CARP,KAEE,IADAsL,CACInS,CADc,CAACwV,CACfxV,CAAA0R,CAAA1R,kBAAJ,CAEE,GADIjF,CACJoX,CADYlW,EAAA,CAAwBJ,CAAxB,CAA8BsW,CAA9B,CACZA,CAAAA,CAAA,CACME,CAAA7N,KAAA,CAAqBzJ,CAArB,CADN,KAAA,CAEsBsX,IAAAA,EAAAA,CAAAA,CAnuC9BrE,EAAQyH,CAAArO,QAAA,CAmuCuCrM,CAnuCvC,CACD,EAAX,EAkuCmDA,CAluCnD,EACE0a,CAAAC,OAAA,CAAW1H,CAAX,CAAkB,CAAlB,CA+tCU,CALkC,CAAxC,CAkBI2H,EAAyB,CAAzBA,CAAaC,CAAbD,GACkBjE,CAAA9R,mBADlB+V,EAC+E,CAD/EA,GACgDtE,CAAAzR,mBADhD+V,EAEiBjE,CAAA1R,kBAFjB2V,EAE4E,CAF5EA,GAE8CtE,CAAArR,kBAF9C2V,GAGgBnY,IAAAC,IAAA,CAAS4T,CAAApR,eAAT,CAAiCoR,CAAAxR,gBAAjC,CAChB8V,EAAJ,CACE9E,CAAA,CAASV,CAAT,CACS3S,IAAAqY,MAAA,CAAWF,CAAX,CAAwBC,CAAxB,CApoBFpB,GAooBE,CADT,CAES,CAAA,CAFT,CADF,CAKErE,CAAA,EAIF2F,EAAAC,OAAA,CAAoBC,QAAQ,EAAG,CAC7BT,CAAA,CAAU,CAAA,CAAV,CAD6B,CAI/BO,EAAAG,MAAA;AAAmBC,QAAQ,EAAG,CAC5BX,CAAA,CAAU,CAAA,CAAV,CAD4B,CA5C9B,CAAA,IACE1O,EAAA,EAHa,CAtXjB,IAAIrP,EAAU8O,CAAV9O,EAA4B,EAC3BA,EAAA6B,WAAL,GACE7B,CADF,CACY4B,EAAA,CAAwBuF,EAAA,CAAKnH,CAAL,CAAxB,CADZ,CAIA,KAAI8a,EAAgB,EAApB,CACIzW,EAAOP,CAAA,CAAW9C,CAAX,CACX,IAAKqD,CAAAA,CAAL,EACQsO,CAAAtO,CAAAsO,WADR,EAEQ,CAAA4G,CAAAlF,QAAA,EAFR,CAGE,MAAOqH,EAAA,EAGT,KAAIb,EAAkB,EAAtB,CACIxa,EAAUW,CAAA8B,KAAA,CAAa,OAAb,CADd,CAEI7C,EAASF,EAAA,CAAcC,CAAd,CAFb,CAGIya,CAHJ,CAIIE,CAJJ,CAKID,EALJ,CAMI1L,CANJ,CAOIsP,CAPJ,CAQIjE,CARJ,CASIkC,CATJ,CAUIjC,CAVJ,CAWI2C,CAXJ,CAYIX,CAZJ,CAaIpB,GAAS,EAEb,IAAyB,CAAzB,GAAIlb,CAAAsE,SAAJ,EAAgC2Q,CAAAqE,CAAArE,WAAhC,EAAwD0J,CAAArF,CAAAqF,YAAxD,CACE,MAAOjD,EAAA,EAGT,KAAIkD,EAAS5e,CAAAgE,MAAA,EAAiBnE,EAAA,CAAQG,CAAAgE,MAAR,CAAjB,CACLhE,CAAAgE,MAAAlE,KAAA,CAAmB,GAAnB,CADK,CAELE,CAAAgE,MAFR,CAKI6a,EAAsB,EAL1B,CAMIC,EAAqB,EAFNF,EAInB,EAJ6B5e,CAAAiN,WAI7B,CACE4R,CADF,CACwBze,CAAA,CAAYwe,CAAZ,CAt+BL3a,KAs+BK,CAAwC,CAAA,CAAxC,CADxB,CAEW2a,CAFX,GAGEC,CAHF,CAGwBD,CAHxB,CAMI5e,EAAAwB,SAAJ,GACEsd,CADF,EACwB1e,CAAA,CAAYJ,CAAAwB,SAAZ,CA9+BP0C,MA8+BO,CADxB,CAIIlE,EAAA0B,YAAJ,GACMod,CAAApe,OAGJ,GAFEoe,CAEF,EAFwB,GAExB,EAAAA,CAAA,EAAsB1e,CAAA,CAAYJ,CAAA0B,YAAZ,CAp/BJyC,SAo/BI,CAJxB,CAaInE,EAAA+e,kBAAJ,EAAiCD,CAAApe,OAAjC,EACE8O,CAAA,CAAsBxO,CAAtB,CAA+BhB,CAA/B,CAGF,KAAI+C;AAAqB,CAAC8b,CAAD,CAAsBC,CAAtB,CAAAhf,KAAA,CAA+C,GAA/C,CAAAkf,KAAA,EAAzB,CACIvC,GAAgBpc,CAAhBoc,CAA0B,GAA1BA,CAAgC1Z,EADpC,CAEIwM,GAAgBnP,CAAA,CAAY2C,EAAZ,CAjgCAkc,SAigCA,CAFpB,CAGIC,EAAcjf,CAAAC,GAAdgf,EAA2D,CAA3DA,CAA2Bha,MAAA4G,KAAA,CAAY7L,CAAAC,GAAZ,CAAAQ,OAM/B,IAAI,EALmE,CAKnE,CAL4BA,CAACV,CAAAmf,cAADze,EAA0B,EAA1BA,QAK5B,EACKwe,CADL,EAEKnc,EAFL,CAAJ,CAGE,MAAO2Y,EAAA,EApFmC,KAuFxC9B,EAvFwC,CAuF9BC,CACQ,EAAtB,CAAI7Z,CAAA6Z,QAAJ,EACMuF,CACJ,CADiBrZ,UAAA,CAAW/F,CAAA6Z,QAAX,CACjB,CAAAA,CAAA,CAAU,CACRxR,gBAAiB+W,CADT,CAER3W,eAAgB2W,CAFR,CAGRhX,mBAAoB,CAHZ,CAIRI,kBAAmB,CAJX,CAFZ,GASEoR,EACA,CADWJ,CAAA,CAAUnV,CAAV,CAAgBoY,EAAhB,CACX,CAAA5C,CAAA,CAAUF,CAAA,CAA8BtV,CAA9B,CAAoCtB,EAApC,CAAwD6W,EAAxD,CAAkEhR,EAAlE,CAVZ,CAaK5I,EAAA4a,yBAAL,EACErZ,CAAAC,SAAA,CAAkBR,CAAlB,CAA2B+B,EAA3B,CAKE/C,EAAAqf,gBAAJ,GACMA,CAEJ,CAFsB,CAAChZ,CAAD,CAAkBrG,CAAAqf,gBAAlB,CAEtB,CADA9a,EAAA,CAAiBF,CAAjB,CAAuBgb,CAAvB,CACA,CAAAxE,CAAA7N,KAAA,CAAqBqS,CAArB,CAHF,CAMwB,EAAxB,EAAIrf,CAAAsE,SAAJ,GACE8B,CAKA,CALyD,CAKzD,CALoB/B,CAAAS,MAAA,CAAWuB,CAAX,CAAA3F,OAKpB,CAJI4e,CAIJ,CAJoBnZ,EAAA,CAA8BnG,CAAAsE,SAA9B,CAAgD8B,CAAhD,CAIpB,CADA7B,EAAA,CAAiBF,CAAjB,CAAuBib,CAAvB,CACA,CAAAzE,CAAA7N,KAAA,CAAqBsS,CAArB,CANF,CASItf,EAAAmf,cAAJ;CACMA,CAEJ,CAFoB,CAACxa,CAAD,CAAiB3E,CAAAmf,cAAjB,CAEpB,CADA5a,EAAA,CAAiBF,CAAjB,CAAuB8a,CAAvB,CACA,CAAAtE,CAAA7N,KAAA,CAAqBmS,CAArB,CAHF,CAMA,KAAIf,EAAYvE,CAAA,CACc,CAAxB,EAAA7Z,CAAAuf,aAAA,CACIvf,CAAAuf,aADJ,CAEIpG,CAAAzS,MAAA,CAAgBkT,EAAhB,CAHM,CAIV,CAUN,EARI4F,CAQJ,CAR4B,CAQ5B,GARcpB,CAQd,GAAgBqB,CAAAzf,CAAAyf,aAAhB,EACErb,EAAA,CAAiBC,CAAjB,CA5hC+Bqb,IA4hC/B,CAGF,KAAIxF,EAAUD,CAAA,CAAe5V,CAAf,CAAqBoY,EAArB,CAAoC7C,EAApC,CAAd,CACI8C,EAAgBxC,CAAAG,SACpBA,EAAA,CAAWrU,IAAAC,IAAA,CAASyW,CAAT,CAAwB,CAAxB,CACXpC,EAAA,CAAcJ,CAAAI,YAEd,KAAIhX,EAAQ,EACZA,EAAAqZ,eAAA,CAA6D,CAA7D,CAAgCzC,CAAA9R,mBAChC9E,EAAAsZ,cAAA,CAA4D,CAA5D,CAAgC1C,CAAA1R,kBAChClF,EAAAqc,iBAAA,CAAgCrc,CAAAqZ,eAAhC,EAAsF,KAAtF,EAAwDzC,CAAA5R,mBACxDhF,EAAAsc,wBAAA,CAAgCV,CAAhC,GACmC5b,CAAAqZ,eADnC,EAC2D,CAACrZ,CAAAqc,iBAD5D,EAEuCrc,CAAAsZ,cAFvC,EAE8D,CAACtZ,CAAAqZ,eAF/D,CAGArZ,EAAAuc,uBAAA,CAAgC7f,CAAAsE,SAAhC,EAAoDhB,CAAAsZ,cACpDtZ;CAAAwc,qBAAA,CAAgC5Z,EAAA,CAAkBlG,CAAA8c,MAAlB,CAAhC,GAAqExZ,CAAAsc,wBAArE,EAAsGtc,CAAAqZ,eAAtG,CACArZ,EAAAuZ,oBAAA,CAAgC3W,EAAA,CAAkBlG,CAAA8c,MAAlB,CAAhC,EAAoExZ,CAAAsZ,cACpEtZ,EAAAkZ,wBAAA,CAA4D,CAA5D,CAAgCsC,CAAApe,OAEhC,IAAI4C,CAAAsc,wBAAJ,EAAqCtc,CAAAuc,uBAArC,CACEvF,CASA,CATcta,CAAAsE,SAAA,CAAmByB,UAAA,CAAW/F,CAAAsE,SAAX,CAAnB,CAAkDgW,CAShE,CAPIhX,CAAAsc,wBAOJ,GANEtc,CAAAqZ,eAGA,CAHuB,CAAA,CAGvB,CAFAzC,CAAA9R,mBAEA,CAF6BkS,CAE7B,CADAlU,CACA,CADwE,CACxE,CADoB/B,CAAAS,MAAA,CAAWuB,CAAX,CA3jCXkC,UA2jCW,CAAA7H,OACpB,CAAAma,CAAA7N,KAAA,CAAqB7G,EAAA,CAA8BmU,CAA9B,CAA2ClU,CAA3C,CAArB,CAGF,EAAI9C,CAAAuc,uBAAJ,GACEvc,CAAAsZ,cAEA,CAFsB,CAAA,CAEtB,CADA1C,CAAA1R,kBACA,CAD4B8R,CAC5B,CAAAO,CAAA7N,KAAA,CA/XD,CAAChF,EAAD,CA+XkDsS,CA/XlD,CAAqC,GAArC,CA+XC,CAHF,CAOF,IAAoB,CAApB,GAAIA,CAAJ,EAA0BkC,CAAAlZ,CAAAkZ,wBAA1B,CACE,MAAOd,EAAA,EAGT;GAAqB,IAArB,EAAI1b,CAAA8c,MAAJ,CAA2B,CACzB,IAAIC,EACyB,UAA7B,GAAI,MAAO/c,EAAA8c,MAAX,GACEC,EAEA,CAFahX,UAAA,CAAW/F,CAAA8c,MAAX,CAEb,CAAAzC,CAAA,CAAWrU,IAAAC,IAAA,CAAS8W,EAAT,CAAqB,CAArB,CAHb,CAMIzZ,EAAAwc,qBAAJ,EACEjF,CAAA7N,KAAA,CA3YD,CADiDxI,EACjD,CA2YuCuY,EA3YvC,CAAe,GAAf,CA2YC,CAGEzZ,EAAAuZ,oBAAJ,EACEhC,CAAA7N,KAAA,CA/YD,CAD0BlF,EAC1B,CA+YuCiV,EA/YvC,CAAe,GAAf,CA+YC,CAbuB,CAoBH,IAAxB,EAAI/c,CAAAsE,SAAJ,EAA6D,CAA7D,CAAgC4V,CAAA9R,mBAAhC,GACE9E,CAAAkZ,wBADF,CACkClZ,CAAAkZ,wBADlC,EACmEgD,CADnE,CAIAjD,EAAA,CAtbWS,GAsbX,CAAe3C,CACf4C,EAAA,CAvbWD,GAubX,CAAkB1C,CACbta,EAAAyf,aAAL,GACEnc,CAAAkY,gBACA,CADqD,CACrD,CADwBtB,CAAA9R,mBACxB,CAAA9E,CAAAmY,uBAAA,CAA2D,CAA3D,CAA+BvB,CAAA1R,kBAA/B,EACwD,CADxD,CAC+BqR,CAAApR,eAD/B,EAE6D,CAF7D,GAE+BoR,CAAArR,kBAJjC,CAOIxI,EAAAG,KAAJ,GACMH,CAAA8d,cAGJ,EAFE/W,EAAA,CAAyB+T,CAAzB,CAAwCzW,CAAxC,CAA8Ca,MAAA4G,KAAA,CAAY9L,CAAAG,KAAZ,CAA9C,CAEF;AAAAgC,EAAA,CAAyBnB,CAAzB,CAAkChB,CAAlC,CAJF,CAOIsD,EAAAkY,gBAAJ,EAA6BlY,CAAAmY,uBAA7B,CACEF,CAAA,CAAcjB,CAAd,CADF,CAEYta,CAAAyf,aAFZ,EAGErb,EAAA,CAAiBC,CAAjB,CAAuB,CAAA,CAAvB,CAIF,OAAO,CACLsX,cAAe,CAAA,CADV,CAELlL,IAAK+J,CAFA,CAGLxB,MAAOA,QAAQ,EAAG,CAChB,GAAIyB,CAAAA,CAAJ,CAiBA,MAfA6D,EAeOtP,CAfM,CACXyB,IAAK+J,CADM,CAEXzN,OAAQ1B,CAFG,CAGXkT,OAAQ,IAHG,CAIXE,MAAO,IAJI,CAeNzP,CARPA,CAQOA,CARE,IAAInB,CAAJ,CAAoByQ,CAApB,CAQFtP,CANP1D,EAAA,CAAe0N,CAAf,CAMOhK,CAAAA,CAlBS,CAHb,CAvOqC,CA5F2B,CAH/D,CAJ4D,CAAhDkK,CAypG1B,CAAAzN,SAAA,CAUY,oBAVZ,CA1gFiCsU,CAAC,qBAADA,CAAwB,QAAQ,CAACC,CAAD,CAAsB,CACrFA,CAAAnL,QAAA7H,KAAA,CAAiC,oBAAjC,CAYA,KAAAQ,KAAA,CAAY,CAAC,aAAD,CAAgB,YAAhB,CAA8B,iBAA9B,CAAiD,cAAjD,CAAiE,UAAjE,CAA6E,UAA7E,CAAyF,WAAzF,CACP,QAAQ,CAACyS,CAAD,CAAgBhX,CAAhB,CAA8B4E,CAA9B,CAAiDJ,CAAjD,CAAiE6L,CAAjE,CAA6E/X,CAA7E,CAAyFmM,CAAzF,CAAoG,CA0B/GwS,QAASA,EAAgB,CAAC7f,CAAD,CAAU,CAEjC,MAAOA,EAAA8f,QAAA,CAAgB,aAAhB,CAA+B,EAA/B,CAF0B,CAKnCC,QAASA,EAAe,CAACzgB,CAAD;AAAIC,CAAJ,CAAO,CACzBa,CAAA,CAASd,CAAT,CAAJ,GAAiBA,CAAjB,CAAqBA,CAAAgB,MAAA,CAAQ,GAAR,CAArB,CACIF,EAAA,CAASb,CAAT,CAAJ,GAAiBA,CAAjB,CAAqBA,CAAAe,MAAA,CAAQ,GAAR,CAArB,CACA,OAAOhB,EAAAuU,OAAA,CAAS,QAAQ,CAACvQ,CAAD,CAAM,CAC5B,MAA2B,EAA3B,GAAO/D,CAAAgQ,QAAA,CAAUjM,CAAV,CADqB,CAAvB,CAAA7D,KAAA,CAEC,GAFD,CAHsB,CAQ/BugB,QAASA,EAAwB,CAAChgB,CAAD,CAAUigB,CAAV,CAAqBC,CAArB,CAA+B,CAiE9DC,QAASA,EAAqB,CAAC5J,CAAD,CAAS,CACrC,IAAI3W,EAAS,EAAb,CAEIwgB,EAAS3c,CAAA,CAAW8S,CAAX,CAAA8J,sBAAA,EAIb9f,EAAA,CAAQ,CAAC,OAAD,CAAS,QAAT,CAAkB,KAAlB,CAAwB,MAAxB,CAAR,CAAyC,QAAQ,CAAC4C,CAAD,CAAM,CACrD,IAAID,EAAQkd,CAAA,CAAOjd,CAAP,CACZ,QAAQA,CAAR,EACE,KAAK,KAAL,CACED,CAAA,EAASod,CAAAC,UACT,MACF,MAAK,MAAL,CACErd,CAAA,EAASod,CAAAE,WALb,CAQA5gB,CAAA,CAAOuD,CAAP,CAAA,CAAcwC,IAAAqY,MAAA,CAAW9a,CAAX,CAAd,CAAkC,IAVmB,CAAvD,CAYA,OAAOtD,EAnB8B,CAsCvC6gB,QAASA,EAAkB,EAAG,CAC5B,IAAIC,EAAgBb,CAAA,CAA6BK,CAJ1Czd,KAAA,CAAa,OAAb,CAIa,EAJY,EAIZ,CAApB,CACIH,EAAQyd,CAAA,CAAgBW,CAAhB,CAA+BC,CAA/B,CADZ,CAEIpe,EAAWwd,CAAA,CAAgBY,CAAhB,CAAiCD,CAAjC,CAFf,CAIIE,EAAWhB,CAAA,CAAYiB,CAAZ,CAAmB,CAChChhB,GAAIsgB,CAAA,CAAsBD,CAAtB,CAD4B,CAEhC/e,SAAU,eAAVA,CAA0CmB,CAFV,CAGhCjB,YAAa,gBAAbA,CAA8CkB,CAHd,CAIhCka,MAAO,CAAA,CAJyB,CAAnB,CASf,OAAOmE,EAAAtF,cAAA;AAAyBsF,CAAzB,CAAoC,IAdf,CAiB9BxQ,QAASA,EAAG,EAAG,CACbyQ,CAAAvP,OAAA,EACA2O,EAAA5e,YAAA,CA5K2Byf,iBA4K3B,CACAZ,EAAA7e,YAAA,CA7K2Byf,iBA6K3B,CAHa,CAvHf,IAAID,EAAQjgB,CAAA,CAAO6C,CAAA,CAAWwc,CAAX,CAAAc,UAAA,CAAgC,CAAA,CAAhC,CAAP,CAAZ,CACIJ,EAAkBd,CAAA,CAA6BgB,CAkG1Cpe,KAAA,CAAa,OAAb,CAlGa,EAkGY,EAlGZ,CAEtBwd,EAAA9e,SAAA,CAtD6B2f,iBAsD7B,CACAZ,EAAA/e,SAAA,CAvD6B2f,iBAuD7B,CAEAD,EAAA1f,SAAA,CAxD+B6f,WAwD/B,CAEAC,EAAAC,OAAA,CAAuBL,CAAvB,CAT8D,KAW1DM,CAAYC,EAAAA,CA4EhBC,QAA4B,EAAG,CAC7B,IAAIT,EAAWhB,CAAA,CAAYiB,CAAZ,CAAmB,CAChC1f,SAxIuBmgB,eAuIS,CAEhC7E,MAAO,CAAA,CAFyB,CAGhC3c,KAAMqgB,CAAA,CAAsBF,CAAtB,CAH0B,CAAnB,CAQf,OAAOW,EAAAtF,cAAA,CAAyBsF,CAAzB,CAAoC,IATd,CA5ED,EAM9B,IAAKQ,CAAAA,CAAL,GACED,CACKA,CADQV,CAAA,EACRU,CAAAA,CAAAA,CAFP,EAGI,MAAO/Q,EAAA,EAIX,KAAImR,EAAmBH,CAAnBG,EAAkCJ,CAEtC,OAAO,CACLxI,MAAOA,QAAQ,EAAG,CA8BhBwB,QAASA,EAAK,EAAG,CACXhO,CAAJ,EACEA,CAAAiE,IAAA,EAFa,CA7BjB,IAAIzB,CAAJ,CAEIxC,EAAmBoV,CAAA5I,MAAA,EACvBxM,EAAA0E,KAAA,CAAsB,QAAQ,EAAG,CAC/B1E,CAAA,CAAmB,IACnB,IAAKgV,CAAAA,CAAL,GACEA,CADF,CACeV,CAAA,EADf,EASI,MANAtU,EAMOA;AANYgV,CAAAxI,MAAA,EAMZxM,CALPA,CAAA0E,KAAA,CAAsB,QAAQ,EAAG,CAC/B1E,CAAA,CAAmB,IACnBiE,EAAA,EACAzB,EAAAS,SAAA,EAH+B,CAAjC,CAKOjD,CAAAA,CAIXiE,EAAA,EACAzB,EAAAS,SAAA,EAhB+B,CAAjC,CAwBA,OALAT,EAKA,CALS,IAAInB,CAAJ,CAAoB,CAC3B4C,IAAK+J,CADsB,CAE3BzN,OAAQyN,CAFmB,CAApB,CAvBO,CADb,CA1BuD,CA+HhEqH,QAASA,EAA4B,CAAC1hB,CAAD,CAAOD,CAAP,CAAWG,CAAX,CAAoB+V,CAApB,CAA6B,CAChE,IAAIa,EAAgB6K,CAAA,CAAwB3hB,CAAxB,CAA8B4B,CAA9B,CAApB,CACImV,EAAc4K,CAAA,CAAwB5hB,CAAxB,CAA4B6B,CAA5B,CADlB,CAGIggB,EAAmB,EACvBnhB,EAAA,CAAQwV,CAAR,CAAiB,QAAQ,CAACQ,CAAD,CAAS,CAIhC,CADIqK,CACJ,CADeZ,CAAA,CAAyBhgB,CAAzB,CAFEuW,CAAAoL,IAEF,CADCpL,CAAAqL,CAAO,IAAPA,CACD,CACf,GACEF,CAAA/U,KAAA,CAAsBiU,CAAtB,CAL8B,CAAlC,CAUA,IAAKhK,CAAL,EAAuBC,CAAvB,EAAkE,CAAlE,GAAsC6K,CAAArhB,OAAtC,CAEA,MAAO,CACLsY,MAAOA,QAAQ,EAAG,CA0BhBwB,QAASA,EAAK,EAAG,CACf5Z,CAAA,CAAQshB,CAAR,CAA0B,QAAQ,CAAClT,CAAD,CAAS,CACzCA,CAAAyB,IAAA,EADyC,CAA3C,CADe,CAzBjB,IAAIyR,EAAmB,EAEnBjL,EAAJ,EACEiL,CAAAlV,KAAA,CAAsBiK,CAAA+B,MAAA,EAAtB,CAGE9B,EAAJ,EACEgL,CAAAlV,KAAA,CAAsBkK,CAAA8B,MAAA,EAAtB,CAGFpY,EAAA,CAAQmhB,CAAR,CAA0B,QAAQ,CAACnV,CAAD,CAAY,CAC5CsV,CAAAlV,KAAA,CAAsBJ,CAAAoM,MAAA,EAAtB,CAD4C,CAA9C,CAIA,KAAIhK,EAAS,IAAInB,CAAJ,CAAoB,CAC/B4C,IAAK+J,CAD0B,CAE/BzN,OAAQyN,CAFuB,CAApB,CAKb3M,EAAAsU,IAAA,CAAoBD,CAApB,CAAsC,QAAQ,CAAC/Q,CAAD,CAAS,CACrDnC,CAAAS,SAAA,CAAgB0B,CAAhB,CADqD,CAAvD,CAIA,OAAOnC,EAxBS,CADb,CAjByD,CAqDlE8S,QAASA,EAAuB,CAAC/Q,CAAD,CAAmB,CACjD,IAAI/P,EAAU+P,CAAA/P,QAAd,CACIhB,EAAU+Q,CAAA/Q,QAAVA;AAAsC,EAEtC+Q,EAAA9D,WAAJ,GACEjN,CAAAgE,MAOA,CAPgB+M,CAAA/M,MAOhB,CANAhE,CAAAiN,WAMA,CANqB,CAAA,CAMrB,CALAjN,CAAA+e,kBAKA,CAL4B,CAAA,CAK5B,CAA+B,OAA/B,GAAIhO,CAAA/M,MAAJ,GACEhE,CAAAib,OADF,CACmBjb,CAAA8B,aADnB,CARF,CAgBI9B,EAAA+C,mBAAJ,GACE/C,CAAAgE,MADF,CACkBhB,EAAA,CAAgBhD,CAAAgE,MAAhB,CAA+BhE,CAAA+C,mBAA/B,CADlB,CAIIke,EAAAA,CAAWhB,CAAA,CAAYjf,CAAZ,CAAqBhB,CAArB,CAMf,OAAOihB,EAAAtF,cAAA,CAAyBsF,CAAzB,CAAoC,IA9BM,CAxNnD,GAAKhM,CAAAqE,CAAArE,WAAL,EAA6B0J,CAAArF,CAAAqF,YAA7B,CAAmD,MAAO5c,EAE1D,KAAI4e,EAAWjT,CAAA,CAAU,CAAV,CAAAwE,KACXkQ,EAAAA,CAAWte,CAAA,CAAW2J,CAAX,CAEf,KAAI6T,EAAkBrgB,CAAA,CAIDmhB,CAhBdzP,WAgBL,EAhBqD,EAgBrD,GAAmByP,CAhBKzP,WAAAxR,SAgBxB,EAAgCwf,CAAAjS,SAAA,CAAkB0T,CAAlB,CAAhC,CAA8DA,CAA9D,CAAyEzB,CAJrD,CAOMhf,EAAA,CAA6BJ,CAA7B,CAE5B,OAAO8gB,SAAqB,CAACtR,CAAD,CAAmB,CAC7C,MAAOA,EAAA5Q,KAAA,EAAyB4Q,CAAA7Q,GAAzB,CACD2hB,CAAA,CAA6B9Q,CAAA5Q,KAA7B,CAC6B4Q,CAAA7Q,GAD7B,CAE6B6Q,CAAA1Q,QAF7B,CAG6B0Q,CAAAqF,QAH7B,CADC,CAKD0L,CAAA,CAAwB/Q,CAAxB,CANuC,CAjBgE,CADrG,CAbyE,CAAtDgP,CA0gFjC,CAAAtU,SAAA,CAYY,aAZZ,CA1vE0B6W,CAAC,kBAADA,CAAqB,QAAQ,CAAC3W,CAAD,CAAmB,CACxE,IAAA6B,KAAA;AAAY,CAAC,WAAD,CAAc,iBAAd,CAAiC,UAAjC,CACP,QAAQ,CAACsH,CAAD,CAAcjH,CAAd,CAAiCtM,CAAjC,CAA2C,CAqQtDghB,QAASA,EAAgB,CAACliB,CAAD,CAAU,CACjCA,CAAA,CAAUR,EAAA,CAAQQ,CAAR,CAAA,CAAmBA,CAAnB,CAA6BA,CAAAM,MAAA,CAAc,GAAd,CAEvC,KAHiC,IAE7B4N,EAAU,EAFmB,CAEfiU,EAAU,EAFK,CAGxB1hB,EAAE,CAAX,CAAcA,CAAd,CAAkBT,CAAAK,OAAlB,CAAkCI,CAAA,EAAlC,CAAuC,CAAA,IACjCD,EAAQR,CAAA,CAAQS,CAAR,CADyB,CAEjC2hB,EAAmB9W,CAAA+W,uBAAA,CAAwC7hB,CAAxC,CACnB4hB,EAAJ,EAAyB,CAAAD,CAAA,CAAQ3hB,CAAR,CAAzB,GACE0N,CAAAvB,KAAA,CAAa8H,CAAAjO,IAAA,CAAc4b,CAAd,CAAb,CACA,CAAAD,CAAA,CAAQ3hB,CAAR,CAAA,CAAiB,CAAA,CAFnB,CAHqC,CAQvC,MAAO0N,EAX0B,CAnQnC,IAAIiB,EAAwB7N,CAAA,CAA6BJ,CAA7B,CAE5B,OAAO,SAAQ,CAACP,CAAD,CAAUgD,CAAV,CAAiB3D,CAAjB,CAA0BL,CAA1B,CAAmC,CAkDhD2iB,QAASA,EAAY,EAAG,CACtB3iB,CAAA8B,aAAA,EACA0N,EAAA,CAAsBxO,CAAtB,CAA+BhB,CAA/B,CAFsB,CAiFxB4iB,QAASA,EAAkB,CAACpX,CAAD,CAAKxK,CAAL,CAAcgD,CAAd,CAAqBhE,CAArB,CAA8Bib,CAA9B,CAAsC,CAE/D,OAAQjX,CAAR,EACE,KAAK,SAAL,CACE6e,CAAA,CAAO,CAAC7hB,CAAD,CAAUhB,CAAAG,KAAV,CAAwBH,CAAAE,GAAxB,CAAoC+a,CAApC,CACP,MAEF,MAAK,UAAL,CACE4H,CAAA,CAAO,CAAC7hB,CAAD,CAAU8hB,CAAV,CAAwBC,CAAxB,CAAyC9H,CAAzC,CACP,MAEF,MAAK,UAAL,CACE4H,CAAA,CAAO,CAAC7hB,CAAD,CAAU8hB,CAAV,CAAwB7H,CAAxB,CACP,MAEF,MAAK,aAAL,CACE4H,CAAA,CAAO,CAAC7hB,CAAD,CAAU+hB,CAAV,CAA2B9H,CAA3B,CACP,MAEF,SACE4H,CAAA,CAAO,CAAC7hB,CAAD,CAAUia,CAAV,CAlBX,CAsBA4H,CAAA7V,KAAA,CAAUhN,CAAV,CAGA,IADIuD,CACJ,CADYiI,CAAAwX,MAAA,CAASxX,CAAT;AAAaqX,CAAb,CACZ,CAKE,GAJIvb,EAAA,CAAW/D,CAAAyV,MAAX,CAIA,GAHFzV,CAGE,CAHMA,CAAAyV,MAAA,EAGN,EAAAzV,CAAA,WAAiBsK,EAArB,CACEtK,CAAA2N,KAAA,CAAW+J,CAAX,CADF,KAEO,IAAI3T,EAAA,CAAW/D,CAAX,CAAJ,CAEL,MAAOA,EAIX,OAAOxB,EAxCwD,CA2CjEkhB,QAASA,EAAsB,CAACjiB,CAAD,CAAUgD,CAAV,CAAiBhE,CAAjB,CAA0BiV,CAA1B,CAAsCiO,CAAtC,CAA8C,CAC3E,IAAIlM,EAAa,EACjBpW,EAAA,CAAQqU,CAAR,CAAoB,QAAQ,CAACkO,CAAD,CAAM,CAChC,IAAIvW,EAAYuW,CAAA,CAAID,CAAJ,CACXtW,EAAL,EAGAoK,CAAAhK,KAAA,CAAgB,QAAQ,EAAG,CACzB,IAAIgC,CAAJ,CACIoU,CADJ,CAGIC,EAAW,CAAA,CAHf,CAIIC,EAAsBA,QAAQ,CAACpL,CAAD,CAAW,CACtCmL,CAAL,GACEA,CAEA,CAFW,CAAA,CAEX,CADA,CAACD,CAAD,EAAkBrhB,CAAlB,EAAwBmW,CAAxB,CACA,CAAAlJ,CAAAS,SAAA,CAAgB,CAACyI,CAAjB,CAHF,CAD2C,CAQ7ClJ,EAAA,CAAS,IAAInB,CAAJ,CAAoB,CAC3B4C,IAAKA,QAAQ,EAAG,CACd6S,CAAA,EADc,CADW,CAI3BvW,OAAQA,QAAQ,EAAG,CACjBuW,CAAA,CAAoB,CAAA,CAApB,CADiB,CAJQ,CAApB,CASTF,EAAA,CAAgBR,CAAA,CAAmBhW,CAAnB,CAA8B5L,CAA9B,CAAuCgD,CAAvC,CAA8ChE,CAA9C,CAAuD,QAAQ,CAAC0V,CAAD,CAAS,CAEtF4N,CAAA,CAD2B,CAAA,CAC3B,GADgB5N,CAChB,CAFsF,CAAxE,CAKhB,OAAO1G,EA3BkB,CAA3B,CALgC,CAAlC,CAoCA,OAAOgI,EAtCoE,CAyC7EuM,QAASA,EAAiB,CAACviB,CAAD,CAAUgD,CAAV,CAAiBhE,CAAjB,CAA0BiV,CAA1B,CAAsCiO,CAAtC,CAA8C,CACtE,IAAIlM,EAAaiM,CAAA,CAAuBjiB,CAAvB,CAAgCgD,CAAhC,CAAuChE,CAAvC,CAAgDiV,CAAhD,CAA4DiO,CAA5D,CACjB,IAA0B,CAA1B,GAAIlM,CAAAtW,OAAJ,CAA6B,CAAA,IACvBf,CADuB,CACrBC,CACS,iBAAf,GAAIsjB,CAAJ,EACEvjB,CACA,CADIsjB,CAAA,CAAuBjiB,CAAvB,CAAgC,aAAhC,CAA+ChB,CAA/C,CAAwDiV,CAAxD,CAAoE,mBAApE,CACJ,CAAArV,CAAA,CAAIqjB,CAAA,CAAuBjiB,CAAvB,CAAgC,UAAhC,CAA4ChB,CAA5C,CAAqDiV,CAArD,CAAiE,gBAAjE,CAFN;AAGsB,UAHtB,GAGWiO,CAHX,GAIEvjB,CACA,CADIsjB,CAAA,CAAuBjiB,CAAvB,CAAgC,aAAhC,CAA+ChB,CAA/C,CAAwDiV,CAAxD,CAAoE,aAApE,CACJ,CAAArV,CAAA,CAAIqjB,CAAA,CAAuBjiB,CAAvB,CAAgC,UAAhC,CAA4ChB,CAA5C,CAAqDiV,CAArD,CAAiE,UAAjE,CALN,CAQItV,EAAJ,GACEqX,CADF,CACeA,CAAA/L,OAAA,CAAkBtL,CAAlB,CADf,CAGIC,EAAJ,GACEoX,CADF,CACeA,CAAA/L,OAAA,CAAkBrL,CAAlB,CADf,CAb2B,CAkB7B,GAA0B,CAA1B,GAAIoX,CAAAtW,OAAJ,CAGA,MAAO8iB,SAAuB,CAAC5U,CAAD,CAAW,CACvC,IAAI6U,EAAU,EACVzM,EAAAtW,OAAJ,EACEE,CAAA,CAAQoW,CAAR,CAAoB,QAAQ,CAAC0M,CAAD,CAAY,CACtCD,CAAAzW,KAAA,CAAa0W,CAAA,EAAb,CADsC,CAAxC,CAKFD,EAAA/iB,OAAA,CAAiBmN,CAAAsU,IAAA,CAAoBsB,CAApB,CAA6B7U,CAA7B,CAAjB,CAA0DA,CAAA,EAE1D,OAAO4L,SAAc,CAAClL,CAAD,CAAS,CAC5B1O,CAAA,CAAQ6iB,CAAR,CAAiB,QAAQ,CAACzU,CAAD,CAAS,CAChCM,CAAA,CAASN,CAAAjC,OAAA,EAAT,CAA2BiC,CAAAyB,IAAA,EADK,CAAlC,CAD4B,CAVS,CAvB6B,CAtNxE,IAAIgK,EAAkB,CAAA,CAKG,EAAzB,GAAItG,SAAAzT,OAAJ,EAA8B0G,EAAA,CAAS/G,CAAT,CAA9B,GACEL,CACA,CADUK,CACV,CAAAA,CAAA,CAAU,IAFZ,CAKAL,EAAA,CAAU4B,EAAA,CAAwB5B,CAAxB,CACLK,EAAL,GACEA,CAIA,CAJUW,CAAA8B,KAAA,CAAa,OAAb,CAIV,EAJmC,EAInC,CAHI9C,CAAAwB,SAGJ,GAFEnB,CAEF,EAFa,GAEb,CAFmBL,CAAAwB,SAEnB,EAAIxB,CAAA0B,YAAJ,GACErB,CADF,EACa,GADb,CACmBL,CAAA0B,YADnB,CALF,CAUA,KAAIohB,EAAe9iB,CAAAwB,SAAnB,CACIuhB,EAAkB/iB,CAAA0B,YADtB,CAOIuT,EAAasN,CAAA,CAAiBliB,CAAjB,CAPjB,CAQIsjB,CARJ,CAQYC,CACZ,IAAI3O,CAAAvU,OAAJ,CAAuB,CAAA,IACjBmjB,CADiB;AACRC,CACA,QAAb,EAAI9f,CAAJ,EACE8f,CACA,CADW,OACX,CAAAD,CAAA,CAAU,YAFZ,GAIEC,CACA,CADW,QACX,CADsB9f,CAAAyB,OAAA,CAAa,CAAb,CAAAse,YAAA,EACtB,CADsD/f,CAAAggB,OAAA,CAAa,CAAb,CACtD,CAAAH,CAAA,CAAU7f,CALZ,CAQc,QAAd,GAAIA,CAAJ,EAAmC,MAAnC,GAAyBA,CAAzB,GACE2f,CADF,CACWJ,CAAA,CAAkBviB,CAAlB,CAA2BgD,CAA3B,CAAkChE,CAAlC,CAA2CiV,CAA3C,CAAuD6O,CAAvD,CADX,CAGAF,EAAA,CAASL,CAAA,CAAkBviB,CAAlB,CAA2BgD,CAA3B,CAAkChE,CAAlC,CAA2CiV,CAA3C,CAAuD4O,CAAvD,CAbY,CAiBvB,GAAKF,CAAL,EAAgBC,CAAhB,CAAA,CAaA,IAAI5U,CAEJ,OAAO,CACL2M,cAAe,CAAA,CADV,CAELlL,IAAKA,QAAQ,EAAG,CACVzB,CAAJ,CACEA,CAAAyB,IAAA,EADF,EAVFgK,CAeI,CAfc,CAAA,CAed,CAdJkI,CAAA,EAcI,CAbJzgB,EAAA,CAAqBlB,CAArB,CAA8BhB,CAA9B,CAaI,CADAgP,CACA,CADS,IAAInB,CACb,CAAAmB,CAAAS,SAAA,CAAgB,CAAA,CAAhB,CALF,CAOA,OAAOT,EARO,CAFX,CAYLgK,MAAOA,QAAQ,EAAG,CA0ChBiL,QAASA,EAAU,CAACC,CAAD,CAAU,CA7D/BzJ,CAAA,CAAkB,CAAA,CAClBkI,EAAA,EACAzgB,GAAA,CAAqBlB,CAArB,CAA8BhB,CAA9B,CA6DIgP,EAAAS,SAAA,CAAgByU,CAAhB,CAF2B,CAzC7B,GAAIlV,CAAJ,CACE,MAAOA,EAGTA,EAAA,CAAS,IAAInB,CACb,KAAIsW,CAAJ,CACIC,EAAQ,EAERT,EAAJ,EACES,CAAApX,KAAA,CAAW,QAAQ,CAACxB,CAAD,CAAK,CACtB2Y,CAAA,CAAwBR,CAAA,CAAOnY,CAAP,CADF,CAAxB,CAKE4Y,EAAA1jB,OAAJ,CACE0jB,CAAApX,KAAA,CAAW,QAAQ,CAACxB,CAAD,CAAK,CACtBmX,CAAA,EACAnX,EAAA,CAAG,CAAA,CAAH,CAFsB,CAAxB,CADF,CAMEmX,CAAA,EAGEiB,EAAJ,EACEQ,CAAApX,KAAA,CAAW,QAAQ,CAACxB,CAAD,CAAK,CACtB2Y,CAAA,CAAwBP,CAAA,CAAMpY,CAAN,CADF,CAAxB,CAKFwD,EAAAoC,QAAA,CAAe,CACbX,IAAKA,QAAQ,EAAG,CAiBXgK,CAAL,GACE,CAAC0J,CAAD;AAA0BpiB,CAA1B,EAjBAsiB,IAAA,EAiBA,CACA,CAAAJ,CAAA,CAlBAI,IAAA,EAkBA,CAFF,CAjBgB,CADH,CAIbtX,OAAQA,QAAQ,EAAG,CAcd0N,CAAL,GACE,CAAC0J,CAAD,EAA0BpiB,CAA1B,EAdcsiB,CAAAA,CAcd,CACA,CAAAJ,CAAA,CAfcI,CAAAA,CAed,CAFF,CAdmB,CAJN,CAAf,CASAxW,EAAAuW,MAAA,CAAsBA,CAAtB,CAA6BH,CAA7B,CACA,OAAOjV,EAxCS,CAZb,CAfP,CAhDgD,CAJI,CAD5C,CAD4D,CAAhDsT,CA0vE1B,CAAA7W,SAAA,CAaY,mBAbZ,CAn+DgC6Y,CAAC,qBAADA,CAAwB,QAAQ,CAACtE,CAAD,CAAsB,CACpFA,CAAAnL,QAAA7H,KAAA,CAAiC,mBAAjC,CACA,KAAAQ,KAAA,CAAY,CAAC,aAAD,CAAgB,iBAAhB,CAAmC,QAAQ,CAAC+W,CAAD,CAAc1W,CAAd,CAA+B,CA+CpF2W,QAASA,EAAgB,CAACzT,CAAD,CAAmB,CAM1C,MAAOwT,EAAA,CAJOxT,CAAA/P,QAIP,CAHK+P,CAAA/M,MAGL,CADO+M,CAAA1Q,QACP,CAFO0Q,CAAA/Q,QAEP,CANmC,CA9C5C,MAAOqiB,SAAqB,CAACtR,CAAD,CAAmB,CAC7C,GAAIA,CAAA5Q,KAAJ,EAA6B4Q,CAAA7Q,GAA7B,CAAkD,CAChD,IAAI+W,EAAgBuN,CAAA,CAAiBzT,CAAA5Q,KAAjB,CAApB,CACI+W,EAAcsN,CAAA,CAAiBzT,CAAA7Q,GAAjB,CAClB,IAAK+W,CAAL,EAAuBC,CAAvB,CAEA,MAAO,CACL8B,MAAOA,QAAQ,EAAG,CAoBhByL,QAASA,EAAY,EAAG,CACtB,MAAO,SAAQ,EAAG,CAChB7jB,CAAA,CAAQshB,CAAR,CAA0B,QAAQ,CAAClT,CAAD,CAAS,CAEzCA,CAAAyB,IAAA,EAFyC,CAA3C,CADgB,CADI,CAnBxB,IAAIyR,EAAmB,EAEnBjL,EAAJ,EACEiL,CAAAlV,KAAA,CAAsBiK,CAAA+B,MAAA,EAAtB,CAGE9B,EAAJ;AACEgL,CAAAlV,KAAA,CAAsBkK,CAAA8B,MAAA,EAAtB,CAGFnL,EAAAsU,IAAA,CAAoBD,CAApB,CAkBAhR,QAAa,CAACC,CAAD,CAAS,CACpBnC,CAAAS,SAAA,CAAgB0B,CAAhB,CADoB,CAlBtB,CAEA,KAAInC,EAAS,IAAInB,CAAJ,CAAoB,CAC/B4C,IAAKgU,CAAA,EAD0B,CAE/B1X,OAAQ0X,CAAA,EAFuB,CAApB,CAKb,OAAOzV,EAlBS,CADb,CALyC,CAAlD,IAyCE,OAAOwV,EAAA,CAAiBzT,CAAjB,CA1CoC,CADqC,CAA1E,CAFwE,CAAtDuT,CAm+DhC,CAngIsC,CAArC,CAAD,CAmhIGplB,MAnhIH,CAmhIWA,MAAAC,QAnhIX;",
+"sources":["angular-animate.js"],
+"names":["window","angular","undefined","assertArg","arg","name","reason","ngMinErr","mergeClasses","a","b","isArray","join","packageStyles","options","styles","to","from","pendClasses","classes","fix","isPrefix","className","isString","length","split","forEach","klass","i","stripCommentsFromElement","element","jqLite","ELEMENT_NODE","nodeType","extractElementNode","elm","$$addClass","$$jqLite","addClass","$$removeClass","removeClass","applyAnimationClassesFactory","prepareAnimationOptions","$$prepared","domOperation","noop","options.domOperation","$$domOperationFired","applyAnimationStyles","applyAnimationFromStyles","applyAnimationToStyles","css","mergeAnimationDetails","oldAnimation","newAnimation","target","newOptions","toAdd","toRemove","resolveElementClasses","attr","preparationClasses","concatWithSpace","realDomOperation","extend","existing","splitClassesToLookup","obj","flags","value","key","ADD_CLASS","REMOVE_CLASS","val","prop","allow","getDomNode","applyGeneratedPreparationClasses","event","EVENT_CLASS_PREFIX","ADD_CLASS_SUFFIX","REMOVE_CLASS_SUFFIX","blockTransitions","node","duration","applyInlineStyle","TRANSITION_DELAY_PROP","blockKeyframeAnimations","applyBlock","ANIMATION_PROP","ANIMATION_PLAYSTATE_KEY","styleTuple","style","computeCssStyles","$window","properties","Object","create","detectedStyles","getComputedStyle","formalStyleName","actualStyleName","c","charAt","parseMaxTime","str","maxValue","values","substring","parseFloat","Math","max","truthyTimingValue","getCssTransitionDurationStyle","applyOnlyDuration","TRANSITION_PROP","DURATION_KEY","createLocalCacheLookup","cache","flush","count","entry","total","get","put","registerRestorableStyles","backup","isDefined","getPropertyValue","copy","isObject","isUndefined","isFunction","isElement","TRANSITIONEND_EVENT","ANIMATIONEND_EVENT","ontransitionend","onwebkittransitionend","onanimationend","onwebkitanimationend","ANIMATION_DELAY_PROP","DELAY_KEY","ANIMATION_DURATION_PROP","TRANSITION_DURATION_PROP","$$minErr","DETECT_CSS_PROPERTIES","transitionDuration","transitionDelay","transitionProperty","PROPERTY_KEY","animationDuration","animationDelay","animationIterationCount","ANIMATION_ITERATION_COUNT_KEY","DETECT_STAGGER_CSS_PROPERTIES","module","directive","ngAnimateSwapDirective","$animate","$rootScope","restrict","transclude","terminal","priority","link","scope","$element","attrs","ctrl","$transclude","previousElement","previousScope","$watchCollection","ngAnimateSwap","leave","$destroy","$new","enter","$$AnimateChildrenDirective","$interpolate","setData","data","NG_ANIMATE_CHILDREN_DATA","ngAnimateChildren","$observe","factory","$$rAFSchedulerFactory","$$rAF","scheduler","tasks","queue","concat","nextTick","items","shift","cancelFn","waitUntilQuiet","scheduler.waitUntilQuiet","fn","provider","$$AnimateQueueProvider","$animateProvider","makeTruthyCssClassMap","classString","keys","ONE_SPACE","map","hasMatchingClasses","newClassString","currentClassString","currentClassMap","some","isAllowed","ruleType","currentAnimation","previousAnimation","rules","hasAnimationClasses","animation","and","skip","cancel","push","structural","RUNNING_STATE","state","nA","nR","cA","cR","$get","$rootElement","$document","$$HashMap","$$animation","$$AnimateRunner","$templateRequest","$$forceReflow","postDigestTaskFactory","postDigestCalled","$$postDigest","findCallbacks","parent","targetNode","targetParentNode","matches","entries","callbackRegistry","contains","call","callback","queueAnimation","initialOptions","notifyProgress","runner","phase","runInNextPostDigestOrNow","callbacks","progress","close","reject","activeClasses","applyAnimationClasses","complete","isAnimatableClassName","isStructural","indexOf","skipAnimations","animationsEnabled","hidden","disabledElementsLookup","existingAnimation","activeAnimationsLookup","hasExistingAnimation","PRE_DIGEST_STATE","areAnimationsAllowed","closeChildAnimations","skipAnimationFlag","cancelAnimationFlag","end","joinAnimationFlag","isValidAnimation","clearElementAnimationState","counter","markElementAnimationState","animationDetails","animationCancelled","realRunner","done","status","setHost","children","querySelectorAll","child","parseInt","getAttribute","NG_ANIMATE_ATTR_NAME","remove","removeAttribute","isMatchingElement","nodeOrElmA","nodeOrElmB","parentElement","bodyElement","body","bodyElementDetected","nodeName","rootElementDetected","parentAnimationDetected","animateChildren","elementDisabled","parentHost","NG_ANIMATE_PIN_DATA","parentNode","details","parentElementDisabled","setAttribute","newValue","oldValue","deregisterWatch","$watch","totalPendingRequests","isEmpty","classNameFilter","test","Node","prototype","compareDocumentPosition","on","container","off","filterFromRegistry","list","matchContainer","matchCallback","containerNode","filter","arguments","pin","enabled","bool","argCount","hasElement","recordExists","$$AnimationProvider","getRunner","RUNNER_STORAGE_KEY","drivers","$injector","$$rAFScheduler","sortAnimations","animations","processNode","processed","elementNode","domNode","lookup","parentEntry","tree","flatten","result","remainingLevelEntries","nextLevelEntries","row","childEntry","animationQueue","getAnchorNodes","hasAttribute","NG_ANIMATE_REF_ATTR","SELECTOR","anchors","groupAnimations","preparedAnimations","refLookup","index","enterOrMove","anchorNodes","direction","anchor","animationID","usedIndicesLookup","anchorGroups","operations","fromAnimation","toAnimation","lookupKey","toString","group","beforeStart","cssClassesIntersection","indexKey","aa","j","invokeFirstDriver","driverName","has","driver","updateAnimationRunners","newRunner","handleDestroyedElement","rejected","removeData","tempClasses","NG_ANIMATE_CLASSNAME","prepareClassName","PREPARE_CLASS_SUFFIX","groupedAnimations","toBeSortedAnimations","animationEntry","triggerAnimationStart","startAnimationFn","closeFn","targetElement","operation","start","animationRunner","$AnimateCssProvider","gcsLookup","gcsStaggerLookup","$timeout","$sniffer","$$animateQueue","gcsHashFn","extraClasses","parentCounter","computeCachedCssStaggerStyles","cacheKey","stagger","staggerClassName","rafWaitQueue","pageWidth","computeTimings","timings","aD","tD","maxDelay","maxDuration","init","endFn","animationClosed","animationCompleted","animationPaused","$$skipPreparationClasses","temporaryStyles","restoreStyles","setProperty","removeProperty","onDone","events","onAnimationProgress","animationTimerData","ANIMATE_TIMER_KEY","timer","applyBlocking","blockTransition","blockKeyframeAnimation","closeAndReturnNoopAnimator","$$willAnimate","stopPropagation","ev","originalEvent","timeStamp","$manualTimeStamp","Date","now","elapsedTime","toFixed","ELAPSED_TIME_MAX_DECIMAL_PLACES","startTime","maxDelayTime","recalculateTimingStyles","fullClassName","relativeDelay","hasTransitions","hasAnimations","applyAnimationDelay","delay","delayStyle","ONE_SECOND","maxDurationTime","easing","easeProp","easeVal","TIMING_KEY","timerTime","CLOSING_TIME_BUFFER","endTime","animationsData","setupFallbackTimer","currentTimerData","expectedEndTime","onAnimationExpired","cleanupStyles","playPause","playAnimation","arr","splice","maxStagger","itemIndex","floor","runnerHost","resume","runnerHost.resume","pause","runnerHost.pause","transitions","method","structuralClassName","addRemoveClassName","applyClassesEarly","trim","ACTIVE_CLASS_SUFFIX","hasToStyles","keyframeStyle","staggerVal","transitionStyle","durationStyle","staggerIndex","isFirst","skipBlocking","SAFE_FAST_FORWARD_DURATION_VALUE","hasTransitionAll","applyTransitionDuration","applyAnimationDuration","applyTransitionDelay","$$AnimateCssDriverProvider","$$animationProvider","$animateCss","filterCssClasses","replace","getUniqueValues","prepareAnchoredAnimation","outAnchor","inAnchor","calculateAnchorStyles","coords","getBoundingClientRect","bodyNode","scrollTop","scrollLeft","prepareInAnimation","endingClasses","startingClasses","animator","clone","NG_ANIMATE_SHIM_CLASS_NAME","cloneNode","NG_ANIMATE_ANCHOR_CLASS_NAME","rootBodyElement","append","animatorIn","animatorOut","prepareOutAnimation","NG_OUT_ANCHOR_CLASS_NAME","startingAnimator","prepareFromToAnchorAnimation","prepareRegularAnimation","anchorAnimations","outElement","inElement","animationRunners","all","rootNode","initDriverFn","$$AnimateJsProvider","lookupAnimations","flagMap","animationFactory","$$registeredAnimations","applyOptions","executeAnimationFn","args","classesToAdd","classesToRemove","apply","groupEventedAnimations","fnName","ani","endProgressCb","resolved","onAnimationComplete","packageAnimations","startAnimation","runners","animateFn","before","after","afterFn","beforeFn","toUpperCase","substr","onComplete","success","closeActiveAnimations","chain","cancelled","$$AnimateJsDriverProvider","$$animateJs","prepareAnimation","endFnFactory"]
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.js
new file mode 100644
index 00000000..99f5cc42
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.js
@@ -0,0 +1,398 @@
+/**
+ * @license AngularJS v1.5.0
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+/**
+ * @ngdoc module
+ * @name ngAria
+ * @description
+ *
+ * The `ngAria` module provides support for common
+ * [<abbr title="Accessible Rich Internet Applications">ARIA</abbr>](http://www.w3.org/TR/wai-aria/)
+ * attributes that convey state or semantic information about the application for users
+ * of assistive technologies, such as screen readers.
+ *
+ * <div doc-module-components="ngAria"></div>
+ *
+ * ## Usage
+ *
+ * For ngAria to do its magic, simply include the module `ngAria` as a dependency. The following
+ * directives are supported:
+ * `ngModel`, `ngChecked`, `ngRequired`, `ngValue`, `ngDisabled`, `ngShow`, `ngHide`, `ngClick`,
+ * `ngDblClick`, and `ngMessages`.
+ *
+ * Below is a more detailed breakdown of the attributes handled by ngAria:
+ *
+ * | Directive | Supported Attributes |
+ * |---------------------------------------------|----------------------------------------------------------------------------------------|
+ * | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles |
+ * | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled |
+ * | {@link ng.directive:ngRequired ngRequired} | aria-required |
+ * | {@link ng.directive:ngChecked ngChecked} | aria-checked |
+ * | {@link ng.directive:ngValue ngValue} | aria-checked |
+ * | {@link ng.directive:ngShow ngShow} | aria-hidden |
+ * | {@link ng.directive:ngHide ngHide} | aria-hidden |
+ * | {@link ng.directive:ngDblclick ngDblclick} | tabindex |
+ * | {@link module:ngMessages ngMessages} | aria-live |
+ * | {@link ng.directive:ngClick ngClick} | tabindex, keypress event, button role |
+ *
+ * Find out more information about each directive by reading the
+ * {@link guide/accessibility ngAria Developer Guide}.
+ *
+ * ##Example
+ * Using ngDisabled with ngAria:
+ * ```html
+ * <md-checkbox ng-disabled="disabled">
+ * ```
+ * Becomes:
+ * ```html
+ * <md-checkbox ng-disabled="disabled" aria-disabled="true">
+ * ```
+ *
+ * ##Disabling Attributes
+ * It's possible to disable individual attributes added by ngAria with the
+ * {@link ngAria.$ariaProvider#config config} method. For more details, see the
+ * {@link guide/accessibility Developer Guide}.
+ */
+ /* global -ngAriaModule */
+var ngAriaModule = angular.module('ngAria', ['ng']).
+ provider('$aria', $AriaProvider);
+
+/**
+* Internal Utilities
+*/
+var nodeBlackList = ['BUTTON', 'A', 'INPUT', 'TEXTAREA', 'SELECT', 'DETAILS', 'SUMMARY'];
+
+var isNodeOneOf = function(elem, nodeTypeArray) {
+ if (nodeTypeArray.indexOf(elem[0].nodeName) !== -1) {
+ return true;
+ }
+};
+/**
+ * @ngdoc provider
+ * @name $ariaProvider
+ *
+ * @description
+ *
+ * Used for configuring the ARIA attributes injected and managed by ngAria.
+ *
+ * ```js
+ * angular.module('myApp', ['ngAria'], function config($ariaProvider) {
+ * $ariaProvider.config({
+ * ariaValue: true,
+ * tabindex: false
+ * });
+ * });
+ *```
+ *
+ * ## Dependencies
+ * Requires the {@link ngAria} module to be installed.
+ *
+ */
+function $AriaProvider() {
+ var config = {
+ ariaHidden: true,
+ ariaChecked: true,
+ ariaDisabled: true,
+ ariaRequired: true,
+ ariaInvalid: true,
+ ariaValue: true,
+ tabindex: true,
+ bindKeypress: true,
+ bindRoleForClick: true
+ };
+
+ /**
+ * @ngdoc method
+ * @name $ariaProvider#config
+ *
+ * @param {object} config object to enable/disable specific ARIA attributes
+ *
+ * - **ariaHidden** – `{boolean}` – Enables/disables aria-hidden tags
+ * - **ariaChecked** – `{boolean}` – Enables/disables aria-checked tags
+ * - **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags
+ * - **ariaRequired** – `{boolean}` – Enables/disables aria-required tags
+ * - **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags
+ * - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and aria-valuenow tags
+ * - **tabindex** – `{boolean}` – Enables/disables tabindex tags
+ * - **bindKeypress** – `{boolean}` – Enables/disables keypress event binding on `div` and
+ * `li` elements with ng-click
+ * - **bindRoleForClick** – `{boolean}` – Adds role=button to non-interactive elements like `div`
+ * using ng-click, making them more accessible to users of assistive technologies
+ *
+ * @description
+ * Enables/disables various ARIA attributes
+ */
+ this.config = function(newConfig) {
+ config = angular.extend(config, newConfig);
+ };
+
+ function watchExpr(attrName, ariaAttr, nodeBlackList, negate) {
+ return function(scope, elem, attr) {
+ var ariaCamelName = attr.$normalize(ariaAttr);
+ if (config[ariaCamelName] && !isNodeOneOf(elem, nodeBlackList) && !attr[ariaCamelName]) {
+ scope.$watch(attr[attrName], function(boolVal) {
+ // ensure boolean value
+ boolVal = negate ? !boolVal : !!boolVal;
+ elem.attr(ariaAttr, boolVal);
+ });
+ }
+ };
+ }
+ /**
+ * @ngdoc service
+ * @name $aria
+ *
+ * @description
+ * @priority 200
+ *
+ * The $aria service contains helper methods for applying common
+ * [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
+ *
+ * ngAria injects common accessibility attributes that tell assistive technologies when HTML
+ * elements are enabled, selected, hidden, and more. To see how this is performed with ngAria,
+ * let's review a code snippet from ngAria itself:
+ *
+ *```js
+ * ngAriaModule.directive('ngDisabled', ['$aria', function($aria) {
+ * return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nodeBlackList, false);
+ * }])
+ *```
+ * Shown above, the ngAria module creates a directive with the same signature as the
+ * traditional `ng-disabled` directive. But this ngAria version is dedicated to
+ * solely managing accessibility attributes on custom elements. The internal `$aria` service is
+ * used to watch the boolean attribute `ngDisabled`. If it has not been explicitly set by the
+ * developer, `aria-disabled` is injected as an attribute with its value synchronized to the
+ * value in `ngDisabled`.
+ *
+ * Because ngAria hooks into the `ng-disabled` directive, developers do not have to do
+ * anything to enable this feature. The `aria-disabled` attribute is automatically managed
+ * simply as a silent side-effect of using `ng-disabled` with the ngAria module.
+ *
+ * The full list of directives that interface with ngAria:
+ * * **ngModel**
+ * * **ngChecked**
+ * * **ngRequired**
+ * * **ngDisabled**
+ * * **ngValue**
+ * * **ngShow**
+ * * **ngHide**
+ * * **ngClick**
+ * * **ngDblclick**
+ * * **ngMessages**
+ *
+ * Read the {@link guide/accessibility ngAria Developer Guide} for a thorough explanation of each
+ * directive.
+ *
+ *
+ * ## Dependencies
+ * Requires the {@link ngAria} module to be installed.
+ */
+ this.$get = function() {
+ return {
+ config: function(key) {
+ return config[key];
+ },
+ $$watchExpr: watchExpr
+ };
+ };
+}
+
+
+ngAriaModule.directive('ngShow', ['$aria', function($aria) {
+ return $aria.$$watchExpr('ngShow', 'aria-hidden', [], true);
+}])
+.directive('ngHide', ['$aria', function($aria) {
+ return $aria.$$watchExpr('ngHide', 'aria-hidden', [], false);
+}])
+.directive('ngValue', ['$aria', function($aria) {
+ return $aria.$$watchExpr('ngValue', 'aria-checked', nodeBlackList, false);
+}])
+.directive('ngChecked', ['$aria', function($aria) {
+ return $aria.$$watchExpr('ngChecked', 'aria-checked', nodeBlackList, false);
+}])
+.directive('ngRequired', ['$aria', function($aria) {
+ return $aria.$$watchExpr('ngRequired', 'aria-required', nodeBlackList, false);
+}])
+.directive('ngModel', ['$aria', function($aria) {
+
+ function shouldAttachAttr(attr, normalizedAttr, elem, allowBlacklistEls) {
+ return $aria.config(normalizedAttr) && !elem.attr(attr) && (allowBlacklistEls || !isNodeOneOf(elem, nodeBlackList));
+ }
+
+ function shouldAttachRole(role, elem) {
+ // if element does not have role attribute
+ // AND element type is equal to role (if custom element has a type equaling shape) <-- remove?
+ // AND element is not INPUT
+ return !elem.attr('role') && (elem.attr('type') === role) && (elem[0].nodeName !== 'INPUT');
+ }
+
+ function getShape(attr, elem) {
+ var type = attr.type,
+ role = attr.role;
+
+ return ((type || role) === 'checkbox' || role === 'menuitemcheckbox') ? 'checkbox' :
+ ((type || role) === 'radio' || role === 'menuitemradio') ? 'radio' :
+ (type === 'range' || role === 'progressbar' || role === 'slider') ? 'range' : '';
+ }
+
+ return {
+ restrict: 'A',
+ require: 'ngModel',
+ priority: 200, //Make sure watches are fired after any other directives that affect the ngModel value
+ compile: function(elem, attr) {
+ var shape = getShape(attr, elem);
+
+ return {
+ pre: function(scope, elem, attr, ngModel) {
+ if (shape === 'checkbox') {
+ //Use the input[checkbox] $isEmpty implementation for elements with checkbox roles
+ ngModel.$isEmpty = function(value) {
+ return value === false;
+ };
+ }
+ },
+ post: function(scope, elem, attr, ngModel) {
+ var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem, false);
+
+ function ngAriaWatchModelValue() {
+ return ngModel.$modelValue;
+ }
+
+ function getRadioReaction(newVal) {
+ var boolVal = (attr.value == ngModel.$viewValue);
+ elem.attr('aria-checked', boolVal);
+ }
+
+ function getCheckboxReaction() {
+ elem.attr('aria-checked', !ngModel.$isEmpty(ngModel.$viewValue));
+ }
+
+ switch (shape) {
+ case 'radio':
+ case 'checkbox':
+ if (shouldAttachRole(shape, elem)) {
+ elem.attr('role', shape);
+ }
+ if (shouldAttachAttr('aria-checked', 'ariaChecked', elem, false)) {
+ scope.$watch(ngAriaWatchModelValue, shape === 'radio' ?
+ getRadioReaction : getCheckboxReaction);
+ }
+ if (needsTabIndex) {
+ elem.attr('tabindex', 0);
+ }
+ break;
+ case 'range':
+ if (shouldAttachRole(shape, elem)) {
+ elem.attr('role', 'slider');
+ }
+ if ($aria.config('ariaValue')) {
+ var needsAriaValuemin = !elem.attr('aria-valuemin') &&
+ (attr.hasOwnProperty('min') || attr.hasOwnProperty('ngMin'));
+ var needsAriaValuemax = !elem.attr('aria-valuemax') &&
+ (attr.hasOwnProperty('max') || attr.hasOwnProperty('ngMax'));
+ var needsAriaValuenow = !elem.attr('aria-valuenow');
+
+ if (needsAriaValuemin) {
+ attr.$observe('min', function ngAriaValueMinReaction(newVal) {
+ elem.attr('aria-valuemin', newVal);
+ });
+ }
+ if (needsAriaValuemax) {
+ attr.$observe('max', function ngAriaValueMinReaction(newVal) {
+ elem.attr('aria-valuemax', newVal);
+ });
+ }
+ if (needsAriaValuenow) {
+ scope.$watch(ngAriaWatchModelValue, function ngAriaValueNowReaction(newVal) {
+ elem.attr('aria-valuenow', newVal);
+ });
+ }
+ }
+ if (needsTabIndex) {
+ elem.attr('tabindex', 0);
+ }
+ break;
+ }
+
+ if (!attr.hasOwnProperty('ngRequired') && ngModel.$validators.required
+ && shouldAttachAttr('aria-required', 'ariaRequired', elem, false)) {
+ // ngModel.$error.required is undefined on custom controls
+ attr.$observe('required', function() {
+ elem.attr('aria-required', !!attr['required']);
+ });
+ }
+
+ if (shouldAttachAttr('aria-invalid', 'ariaInvalid', elem, true)) {
+ scope.$watch(function ngAriaInvalidWatch() {
+ return ngModel.$invalid;
+ }, function ngAriaInvalidReaction(newVal) {
+ elem.attr('aria-invalid', !!newVal);
+ });
+ }
+ }
+ };
+ }
+ };
+}])
+.directive('ngDisabled', ['$aria', function($aria) {
+ return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nodeBlackList, false);
+}])
+.directive('ngMessages', function() {
+ return {
+ restrict: 'A',
+ require: '?ngMessages',
+ link: function(scope, elem, attr, ngMessages) {
+ if (!elem.attr('aria-live')) {
+ elem.attr('aria-live', 'assertive');
+ }
+ }
+ };
+})
+.directive('ngClick',['$aria', '$parse', function($aria, $parse) {
+ return {
+ restrict: 'A',
+ compile: function(elem, attr) {
+ var fn = $parse(attr.ngClick, /* interceptorFn */ null, /* expensiveChecks */ true);
+ return function(scope, elem, attr) {
+
+ if (!isNodeOneOf(elem, nodeBlackList)) {
+
+ if ($aria.config('bindRoleForClick') && !elem.attr('role')) {
+ elem.attr('role', 'button');
+ }
+
+ if ($aria.config('tabindex') && !elem.attr('tabindex')) {
+ elem.attr('tabindex', 0);
+ }
+
+ if ($aria.config('bindKeypress') && !attr.ngKeypress) {
+ elem.on('keypress', function(event) {
+ var keyCode = event.which || event.keyCode;
+ if (keyCode === 32 || keyCode === 13) {
+ scope.$apply(callback);
+ }
+
+ function callback() {
+ fn(scope, { $event: event });
+ }
+ });
+ }
+ }
+ };
+ }
+ };
+}])
+.directive('ngDblclick', ['$aria', function($aria) {
+ return function(scope, elem, attr) {
+ if ($aria.config('tabindex') && !elem.attr('tabindex') && !isNodeOneOf(elem, nodeBlackList)) {
+ elem.attr('tabindex', 0);
+ }
+ };
+}]);
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js
new file mode 100644
index 00000000..cf0fd742
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js
@@ -0,0 +1,14 @@
+/*
+ AngularJS v1.5.0
+ (c) 2010-2016 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(s,q,t){'use strict';var f="BUTTON A INPUT TEXTAREA SELECT DETAILS SUMMARY".split(" "),l=function(a,c){if(-1!==c.indexOf(a[0].nodeName))return!0};q.module("ngAria",["ng"]).provider("$aria",function(){function a(a,h,p,n){return function(d,e,b){var g=b.$normalize(h);!c[g]||l(e,p)||b[g]||d.$watch(b[a],function(b){b=n?!b:!!b;e.attr(h,b)})}}var c={ariaHidden:!0,ariaChecked:!0,ariaDisabled:!0,ariaRequired:!0,ariaInvalid:!0,ariaValue:!0,tabindex:!0,bindKeypress:!0,bindRoleForClick:!0};this.config=
+function(a){c=q.extend(c,a)};this.$get=function(){return{config:function(a){return c[a]},$$watchExpr:a}}}).directive("ngShow",["$aria",function(a){return a.$$watchExpr("ngShow","aria-hidden",[],!0)}]).directive("ngHide",["$aria",function(a){return a.$$watchExpr("ngHide","aria-hidden",[],!1)}]).directive("ngValue",["$aria",function(a){return a.$$watchExpr("ngValue","aria-checked",f,!1)}]).directive("ngChecked",["$aria",function(a){return a.$$watchExpr("ngChecked","aria-checked",f,!1)}]).directive("ngRequired",
+["$aria",function(a){return a.$$watchExpr("ngRequired","aria-required",f,!1)}]).directive("ngModel",["$aria",function(a){function c(c,n,d,e){return a.config(n)&&!d.attr(c)&&(e||!l(d,f))}function m(a,c){return!c.attr("role")&&c.attr("type")===a&&"INPUT"!==c[0].nodeName}function h(a,c){var d=a.type,e=a.role;return"checkbox"===(d||e)||"menuitemcheckbox"===e?"checkbox":"radio"===(d||e)||"menuitemradio"===e?"radio":"range"===d||"progressbar"===e||"slider"===e?"range":""}return{restrict:"A",require:"ngModel",
+priority:200,compile:function(f,n){var d=h(n,f);return{pre:function(a,b,c,k){"checkbox"===d&&(k.$isEmpty=function(a){return!1===a})},post:function(e,b,g,k){function f(){return k.$modelValue}function h(a){b.attr("aria-checked",g.value==k.$viewValue)}function n(){b.attr("aria-checked",!k.$isEmpty(k.$viewValue))}var l=c("tabindex","tabindex",b,!1);switch(d){case "radio":case "checkbox":m(d,b)&&b.attr("role",d);c("aria-checked","ariaChecked",b,!1)&&e.$watch(f,"radio"===d?h:n);l&&b.attr("tabindex",0);
+break;case "range":m(d,b)&&b.attr("role","slider");if(a.config("ariaValue")){var p=!b.attr("aria-valuemin")&&(g.hasOwnProperty("min")||g.hasOwnProperty("ngMin")),q=!b.attr("aria-valuemax")&&(g.hasOwnProperty("max")||g.hasOwnProperty("ngMax")),r=!b.attr("aria-valuenow");p&&g.$observe("min",function(a){b.attr("aria-valuemin",a)});q&&g.$observe("max",function(a){b.attr("aria-valuemax",a)});r&&e.$watch(f,function(a){b.attr("aria-valuenow",a)})}l&&b.attr("tabindex",0)}!g.hasOwnProperty("ngRequired")&&
+k.$validators.required&&c("aria-required","ariaRequired",b,!1)&&g.$observe("required",function(){b.attr("aria-required",!!g.required)});c("aria-invalid","ariaInvalid",b,!0)&&e.$watch(function(){return k.$invalid},function(a){b.attr("aria-invalid",!!a)})}}}}}]).directive("ngDisabled",["$aria",function(a){return a.$$watchExpr("ngDisabled","aria-disabled",f,!1)}]).directive("ngMessages",function(){return{restrict:"A",require:"?ngMessages",link:function(a,c,f,h){c.attr("aria-live")||c.attr("aria-live",
+"assertive")}}}).directive("ngClick",["$aria","$parse",function(a,c){return{restrict:"A",compile:function(m,h){var p=c(h.ngClick,null,!0);return function(c,d,e){if(!l(d,f)&&(a.config("bindRoleForClick")&&!d.attr("role")&&d.attr("role","button"),a.config("tabindex")&&!d.attr("tabindex")&&d.attr("tabindex",0),a.config("bindKeypress")&&!e.ngKeypress))d.on("keypress",function(a){function d(){p(c,{$event:a})}var e=a.which||a.keyCode;32!==e&&13!==e||c.$apply(d)})}}}}]).directive("ngDblclick",["$aria",function(a){return function(c,
+m,h){!a.config("tabindex")||m.attr("tabindex")||l(m,f)||m.attr("tabindex",0)}}])})(window,window.angular);
+//# sourceMappingURL=angular-aria.min.js.map
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js.map
new file mode 100644
index 00000000..b1db15b5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js.map
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"angular-aria.min.js",
+"lineCount":13,
+"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CA6DtC,IAAIC,EAAgB,gDAAA,MAAA,CAAA,GAAA,CAApB,CAEIC,EAAcA,QAAQ,CAACC,CAAD,CAAOC,CAAP,CAAsB,CAC9C,GAAiD,EAAjD,GAAIA,CAAAC,QAAA,CAAsBF,CAAA,CAAK,CAAL,CAAAG,SAAtB,CAAJ,CACE,MAAO,CAAA,CAFqC,CAR7BP,EAAAQ,OAAA,CAAe,QAAf,CAAyB,CAAC,IAAD,CAAzB,CAAAC,SAAAC,CACc,OADdA,CAkCnBC,QAAsB,EAAG,CAsCvBC,QAASA,EAAS,CAACC,CAAD,CAAWC,CAAX,CAAqBZ,CAArB,CAAoCa,CAApC,CAA4C,CAC5D,MAAO,SAAQ,CAACC,CAAD,CAAQZ,CAAR,CAAca,CAAd,CAAoB,CACjC,IAAIC,EAAgBD,CAAAE,WAAA,CAAgBL,CAAhB,CAChB,EAAAM,CAAA,CAAOF,CAAP,CAAJ,EAA8Bf,CAAA,CAAYC,CAAZ,CAAkBF,CAAlB,CAA9B,EAAmEe,CAAA,CAAKC,CAAL,CAAnE,EACEF,CAAAK,OAAA,CAAaJ,CAAA,CAAKJ,CAAL,CAAb,CAA6B,QAAQ,CAACS,CAAD,CAAU,CAE7CA,CAAA,CAAUP,CAAA,CAAS,CAACO,CAAV,CAAoB,CAAEA,CAAAA,CAChClB,EAAAa,KAAA,CAAUH,CAAV,CAAoBQ,CAApB,CAH6C,CAA/C,CAH+B,CADyB,CArC9D,IAAIF,EAAS,CACXG,WAAY,CAAA,CADD,CAEXC,YAAa,CAAA,CAFF,CAGXC,aAAc,CAAA,CAHH,CAIXC,aAAc,CAAA,CAJH,CAKXC,YAAa,CAAA,CALF,CAMXC,UAAW,CAAA,CANA,CAOXC,SAAU,CAAA,CAPC,CAQXC,aAAc,CAAA,CARH,CASXC,iBAAkB,CAAA,CATP,CAiCb,KAAAX,OAAA;AAAcY,QAAQ,CAACC,CAAD,CAAY,CAChCb,CAAA,CAASpB,CAAAkC,OAAA,CAAed,CAAf,CAAuBa,CAAvB,CADuB,CAiElC,KAAAE,KAAA,CAAYC,QAAQ,EAAG,CACrB,MAAO,CACLhB,OAAQA,QAAQ,CAACiB,CAAD,CAAM,CACpB,MAAOjB,EAAA,CAAOiB,CAAP,CADa,CADjB,CAILC,YAAa1B,CAJR,CADc,CAnGA,CAlCNF,CAgJnB6B,UAAA,CAAuB,QAAvB,CAAiC,CAAC,OAAD,CAAU,QAAQ,CAACC,CAAD,CAAQ,CACzD,MAAOA,EAAAF,YAAA,CAAkB,QAAlB,CAA4B,aAA5B,CAA2C,EAA3C,CAA+C,CAAA,CAA/C,CADkD,CAA1B,CAAjC,CAAAC,UAAA,CAGW,QAHX,CAGqB,CAAC,OAAD,CAAU,QAAQ,CAACC,CAAD,CAAQ,CAC7C,MAAOA,EAAAF,YAAA,CAAkB,QAAlB,CAA4B,aAA5B,CAA2C,EAA3C,CAA+C,CAAA,CAA/C,CADsC,CAA1B,CAHrB,CAAAC,UAAA,CAMW,SANX,CAMsB,CAAC,OAAD,CAAU,QAAQ,CAACC,CAAD,CAAQ,CAC9C,MAAOA,EAAAF,YAAA,CAAkB,SAAlB,CAA6B,cAA7B,CAA6CpC,CAA7C,CAA4D,CAAA,CAA5D,CADuC,CAA1B,CANtB,CAAAqC,UAAA,CASW,WATX,CASwB,CAAC,OAAD,CAAU,QAAQ,CAACC,CAAD,CAAQ,CAChD,MAAOA,EAAAF,YAAA,CAAkB,WAAlB,CAA+B,cAA/B,CAA+CpC,CAA/C,CAA8D,CAAA,CAA9D,CADyC,CAA1B,CATxB,CAAAqC,UAAA,CAYW,YAZX;AAYyB,CAAC,OAAD,CAAU,QAAQ,CAACC,CAAD,CAAQ,CACjD,MAAOA,EAAAF,YAAA,CAAkB,YAAlB,CAAgC,eAAhC,CAAiDpC,CAAjD,CAAgE,CAAA,CAAhE,CAD0C,CAA1B,CAZzB,CAAAqC,UAAA,CAeW,SAfX,CAesB,CAAC,OAAD,CAAU,QAAQ,CAACC,CAAD,CAAQ,CAE9CC,QAASA,EAAgB,CAACxB,CAAD,CAAOyB,CAAP,CAAuBtC,CAAvB,CAA6BuC,CAA7B,CAAgD,CACvE,MAAOH,EAAApB,OAAA,CAAasB,CAAb,CAAP,EAAuC,CAACtC,CAAAa,KAAA,CAAUA,CAAV,CAAxC,GAA4D0B,CAA5D,EAAiF,CAACxC,CAAA,CAAYC,CAAZ,CAAkBF,CAAlB,CAAlF,CADuE,CAIzE0C,QAASA,EAAgB,CAACC,CAAD,CAAOzC,CAAP,CAAa,CAIpC,MAAO,CAACA,CAAAa,KAAA,CAAU,MAAV,CAAR,EAA8Bb,CAAAa,KAAA,CAAU,MAAV,CAA9B,GAAoD4B,CAApD,EAAmF,OAAnF,GAA8DzC,CAAA,CAAK,CAAL,CAAAG,SAJ1B,CAOtCuC,QAASA,EAAQ,CAAC7B,CAAD,CAAOb,CAAP,CAAa,CAAA,IACxB2C,EAAO9B,CAAA8B,KADiB,CAExBF,EAAO5B,CAAA4B,KAEX,OAA2B,UAApB,IAAEE,CAAF,EAAUF,CAAV,GAA2C,kBAA3C,GAAkCA,CAAlC,CAAiE,UAAjE,CACoB,OAApB,IAAEE,CAAF,EAAUF,CAAV,GAA2C,eAA3C,GAAkCA,CAAlC,CAA8D,OAA9D,CACU,OAAV,GAACE,CAAD,EAA2C,aAA3C,GAAkCF,CAAlC,EAAqE,QAArE,GAA4DA,CAA5D,CAAiF,OAAjF,CAA2F,EANtE,CAS9B,MAAO,CACLG,SAAU,GADL,CAELC,QAAS,SAFJ;AAGLC,SAAU,GAHL,CAILC,QAASA,QAAQ,CAAC/C,CAAD,CAAOa,CAAP,CAAa,CAC5B,IAAImC,EAAQN,CAAA,CAAS7B,CAAT,CAAeb,CAAf,CAEZ,OAAO,CACLiD,IAAKA,QAAQ,CAACrC,CAAD,CAAQZ,CAAR,CAAca,CAAd,CAAoBqC,CAApB,CAA6B,CAC1B,UAAd,GAAIF,CAAJ,GAEEE,CAAAC,SAFF,CAEqBC,QAAQ,CAACC,CAAD,CAAQ,CACjC,MAAiB,CAAA,CAAjB,GAAOA,CAD0B,CAFrC,CADwC,CADrC,CASLC,KAAMA,QAAQ,CAAC1C,CAAD,CAAQZ,CAAR,CAAca,CAAd,CAAoBqC,CAApB,CAA6B,CAGzCK,QAASA,EAAqB,EAAG,CAC/B,MAAOL,EAAAM,YADwB,CAIjCC,QAASA,EAAgB,CAACC,CAAD,CAAS,CAEhC1D,CAAAa,KAAA,CAAU,cAAV,CADeA,CAAAwC,MACf,EAD6BH,CAAAS,WAC7B,CAFgC,CAKlCC,QAASA,EAAmB,EAAG,CAC7B5D,CAAAa,KAAA,CAAU,cAAV,CAA0B,CAACqC,CAAAC,SAAA,CAAiBD,CAAAS,WAAjB,CAA3B,CAD6B,CAX/B,IAAIE,EAAgBxB,CAAA,CAAiB,UAAjB,CAA6B,UAA7B,CAAyCrC,CAAzC,CAA+C,CAAA,CAA/C,CAepB,QAAQgD,CAAR,EACE,KAAK,OAAL,CACA,KAAK,UAAL,CACMR,CAAA,CAAiBQ,CAAjB,CAAwBhD,CAAxB,CAAJ,EACEA,CAAAa,KAAA,CAAU,MAAV,CAAkBmC,CAAlB,CAEEX,EAAA,CAAiB,cAAjB,CAAiC,aAAjC,CAAgDrC,CAAhD,CAAsD,CAAA,CAAtD,CAAJ,EACEY,CAAAK,OAAA,CAAasC,CAAb,CAA8C,OAAV,GAAAP,CAAA,CAChCS,CADgC,CACbG,CADvB,CAGEC,EAAJ,EACE7D,CAAAa,KAAA,CAAU,UAAV,CAAsB,CAAtB,CAEF;KACF,MAAK,OAAL,CACM2B,CAAA,CAAiBQ,CAAjB,CAAwBhD,CAAxB,CAAJ,EACEA,CAAAa,KAAA,CAAU,MAAV,CAAkB,QAAlB,CAEF,IAAIuB,CAAApB,OAAA,CAAa,WAAb,CAAJ,CAA+B,CAC7B,IAAI8C,EAAoB,CAAC9D,CAAAa,KAAA,CAAU,eAAV,CAArBiD,GACCjD,CAAAkD,eAAA,CAAoB,KAApB,CADDD,EAC+BjD,CAAAkD,eAAA,CAAoB,OAApB,CAD/BD,CAAJ,CAEIE,EAAoB,CAAChE,CAAAa,KAAA,CAAU,eAAV,CAArBmD,GACCnD,CAAAkD,eAAA,CAAoB,KAApB,CADDC,EAC+BnD,CAAAkD,eAAA,CAAoB,OAApB,CAD/BC,CAFJ,CAIIC,EAAoB,CAACjE,CAAAa,KAAA,CAAU,eAAV,CAErBiD,EAAJ,EACEjD,CAAAqD,SAAA,CAAc,KAAd,CAAqBC,QAA+B,CAACT,CAAD,CAAS,CAC3D1D,CAAAa,KAAA,CAAU,eAAV,CAA2B6C,CAA3B,CAD2D,CAA7D,CAIEM,EAAJ,EACEnD,CAAAqD,SAAA,CAAc,KAAd,CAAqBC,QAA+B,CAACT,CAAD,CAAS,CAC3D1D,CAAAa,KAAA,CAAU,eAAV,CAA2B6C,CAA3B,CAD2D,CAA7D,CAIEO,EAAJ,EACErD,CAAAK,OAAA,CAAasC,CAAb,CAAoCa,QAA+B,CAACV,CAAD,CAAS,CAC1E1D,CAAAa,KAAA,CAAU,eAAV,CAA2B6C,CAA3B,CAD0E,CAA5E,CAlB2B,CAuB3BG,CAAJ,EACE7D,CAAAa,KAAA,CAAU,UAAV,CAAsB,CAAtB,CA1CN,CA+CK,CAAAA,CAAAkD,eAAA,CAAoB,YAApB,CAAL;AAA0Cb,CAAAmB,YAAAC,SAA1C,EACKjC,CAAA,CAAiB,eAAjB,CAAkC,cAAlC,CAAkDrC,CAAlD,CAAwD,CAAA,CAAxD,CADL,EAGEa,CAAAqD,SAAA,CAAc,UAAd,CAA0B,QAAQ,EAAG,CACnClE,CAAAa,KAAA,CAAU,eAAV,CAA2B,CAAE,CAAAA,CAAA,SAA7B,CADmC,CAArC,CAKEwB,EAAA,CAAiB,cAAjB,CAAiC,aAAjC,CAAgDrC,CAAhD,CAAsD,CAAA,CAAtD,CAAJ,EACEY,CAAAK,OAAA,CAAasD,QAA2B,EAAG,CACzC,MAAOrB,EAAAsB,SADkC,CAA3C,CAEGC,QAA8B,CAACf,CAAD,CAAS,CACxC1D,CAAAa,KAAA,CAAU,cAAV,CAA0B,CAAE6C,CAAAA,CAA5B,CADwC,CAF1C,CAxEuC,CATtC,CAHqB,CAJzB,CAtBuC,CAA1B,CAftB,CAAAvB,UAAA,CAwIW,YAxIX,CAwIyB,CAAC,OAAD,CAAU,QAAQ,CAACC,CAAD,CAAQ,CACjD,MAAOA,EAAAF,YAAA,CAAkB,YAAlB,CAAgC,eAAhC,CAAiDpC,CAAjD,CAAgE,CAAA,CAAhE,CAD0C,CAA1B,CAxIzB,CAAAqC,UAAA,CA2IW,YA3IX,CA2IyB,QAAQ,EAAG,CAClC,MAAO,CACLS,SAAU,GADL,CAELC,QAAS,aAFJ,CAGL6B,KAAMA,QAAQ,CAAC9D,CAAD,CAAQZ,CAAR,CAAca,CAAd,CAAoB8D,CAApB,CAAgC,CACvC3E,CAAAa,KAAA,CAAU,WAAV,CAAL,EACEb,CAAAa,KAAA,CAAU,WAAV;AAAuB,WAAvB,CAF0C,CAHzC,CAD2B,CA3IpC,CAAAsB,UAAA,CAsJW,SAtJX,CAsJqB,CAAC,OAAD,CAAU,QAAV,CAAoB,QAAQ,CAACC,CAAD,CAAQwC,CAAR,CAAgB,CAC/D,MAAO,CACLhC,SAAU,GADL,CAELG,QAASA,QAAQ,CAAC/C,CAAD,CAAOa,CAAP,CAAa,CAC5B,IAAIgE,EAAKD,CAAA,CAAO/D,CAAAiE,QAAP,CAAyC,IAAzC,CAAqE,CAAA,CAArE,CACT,OAAO,SAAQ,CAAClE,CAAD,CAAQZ,CAAR,CAAca,CAAd,CAAoB,CAEjC,GAAK,CAAAd,CAAA,CAAYC,CAAZ,CAAkBF,CAAlB,CAAL,GAEMsC,CAAApB,OAAA,CAAa,kBAAb,CAQA,EARqC,CAAAhB,CAAAa,KAAA,CAAU,MAAV,CAQrC,EAPFb,CAAAa,KAAA,CAAU,MAAV,CAAkB,QAAlB,CAOE,CAJAuB,CAAApB,OAAA,CAAa,UAAb,CAIA,EAJ6B,CAAAhB,CAAAa,KAAA,CAAU,UAAV,CAI7B,EAHFb,CAAAa,KAAA,CAAU,UAAV,CAAsB,CAAtB,CAGE,CAAAuB,CAAApB,OAAA,CAAa,cAAb,CAAA,EAAiC+D,CAAAlE,CAAAkE,WAVvC,EAWI/E,CAAAgF,GAAA,CAAQ,UAAR,CAAoB,QAAQ,CAACC,CAAD,CAAQ,CAMlCC,QAASA,EAAQ,EAAG,CAClBL,CAAA,CAAGjE,CAAH,CAAU,CAAEuE,OAAQF,CAAV,CAAV,CADkB,CALpB,IAAIG,EAAUH,CAAAI,MAAVD,EAAyBH,CAAAG,QACb,GAAhB,GAAIA,CAAJ,EAAkC,EAAlC,GAAsBA,CAAtB,EACExE,CAAA0E,OAAA,CAAaJ,CAAb,CAHgC,CAApC,CAb6B,CAFP,CAFzB,CADwD,CAA5C,CAtJrB,CAAA/C,UAAA,CAwLW,YAxLX,CAwLyB,CAAC,OAAD,CAAU,QAAQ,CAACC,CAAD,CAAQ,CACjD,MAAO,SAAQ,CAACxB,CAAD;AAAQZ,CAAR,CAAca,CAAd,CAAoB,CAC7B,CAAAuB,CAAApB,OAAA,CAAa,UAAb,CAAJ,EAAiChB,CAAAa,KAAA,CAAU,UAAV,CAAjC,EAA2Dd,CAAA,CAAYC,CAAZ,CAAkBF,CAAlB,CAA3D,EACEE,CAAAa,KAAA,CAAU,UAAV,CAAsB,CAAtB,CAF+B,CADc,CAA1B,CAxLzB,CAvMsC,CAArC,CAAD,CAwYGlB,MAxYH,CAwYWA,MAAAC,QAxYX;",
+"sources":["angular-aria.js"],
+"names":["window","angular","undefined","nodeBlackList","isNodeOneOf","elem","nodeTypeArray","indexOf","nodeName","module","provider","ngAriaModule","$AriaProvider","watchExpr","attrName","ariaAttr","negate","scope","attr","ariaCamelName","$normalize","config","$watch","boolVal","ariaHidden","ariaChecked","ariaDisabled","ariaRequired","ariaInvalid","ariaValue","tabindex","bindKeypress","bindRoleForClick","this.config","newConfig","extend","$get","this.$get","key","$$watchExpr","directive","$aria","shouldAttachAttr","normalizedAttr","allowBlacklistEls","shouldAttachRole","role","getShape","type","restrict","require","priority","compile","shape","pre","ngModel","$isEmpty","ngModel.$isEmpty","value","post","ngAriaWatchModelValue","$modelValue","getRadioReaction","newVal","$viewValue","getCheckboxReaction","needsTabIndex","needsAriaValuemin","hasOwnProperty","needsAriaValuemax","needsAriaValuenow","$observe","ngAriaValueMinReaction","ngAriaValueNowReaction","$validators","required","ngAriaInvalidWatch","$invalid","ngAriaInvalidReaction","link","ngMessages","$parse","fn","ngClick","ngKeypress","on","event","callback","$event","keyCode","which","$apply"]
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.js
new file mode 100644
index 00000000..2157ef03
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.js
@@ -0,0 +1,322 @@
+/**
+ * @license AngularJS v1.5.0
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+/**
+ * @ngdoc module
+ * @name ngCookies
+ * @description
+ *
+ * # ngCookies
+ *
+ * The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies.
+ *
+ *
+ * <div doc-module-components="ngCookies"></div>
+ *
+ * See {@link ngCookies.$cookies `$cookies`} for usage.
+ */
+
+
+angular.module('ngCookies', ['ng']).
+ /**
+ * @ngdoc provider
+ * @name $cookiesProvider
+ * @description
+ * Use `$cookiesProvider` to change the default behavior of the {@link ngCookies.$cookies $cookies} service.
+ * */
+ provider('$cookies', [function $CookiesProvider() {
+ /**
+ * @ngdoc property
+ * @name $cookiesProvider#defaults
+ * @description
+ *
+ * Object containing default options to pass when setting cookies.
+ *
+ * The object may have following properties:
+ *
+ * - **path** - `{string}` - The cookie will be available only for this path and its
+ * sub-paths. By default, this is the URL that appears in your `<base>` tag.
+ * - **domain** - `{string}` - The cookie will be available only for this domain and
+ * its sub-domains. For security reasons the user agent will not accept the cookie
+ * if the current domain is not a sub-domain of this domain or equal to it.
+ * - **expires** - `{string|Date}` - String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT"
+ * or a Date object indicating the exact date/time this cookie will expire.
+ * - **secure** - `{boolean}` - If `true`, then the cookie will only be available through a
+ * secured connection.
+ *
+ * Note: By default, the address that appears in your `<base>` tag will be used as the path.
+ * This is important so that cookies will be visible for all routes when html5mode is enabled.
+ *
+ **/
+ var defaults = this.defaults = {};
+
+ function calcOptions(options) {
+ return options ? angular.extend({}, defaults, options) : defaults;
+ }
+
+ /**
+ * @ngdoc service
+ * @name $cookies
+ *
+ * @description
+ * Provides read/write access to browser's cookies.
+ *
+ * <div class="alert alert-info">
+ * Up until Angular 1.3, `$cookies` exposed properties that represented the
+ * current browser cookie values. In version 1.4, this behavior has changed, and
+ * `$cookies` now provides a standard api of getters, setters etc.
+ * </div>
+ *
+ * Requires the {@link ngCookies `ngCookies`} module to be installed.
+ *
+ * @example
+ *
+ * ```js
+ * angular.module('cookiesExample', ['ngCookies'])
+ * .controller('ExampleController', ['$cookies', function($cookies) {
+ * // Retrieving a cookie
+ * var favoriteCookie = $cookies.get('myFavorite');
+ * // Setting a cookie
+ * $cookies.put('myFavorite', 'oatmeal');
+ * }]);
+ * ```
+ */
+ this.$get = ['$$cookieReader', '$$cookieWriter', function($$cookieReader, $$cookieWriter) {
+ return {
+ /**
+ * @ngdoc method
+ * @name $cookies#get
+ *
+ * @description
+ * Returns the value of given cookie key
+ *
+ * @param {string} key Id to use for lookup.
+ * @returns {string} Raw cookie value.
+ */
+ get: function(key) {
+ return $$cookieReader()[key];
+ },
+
+ /**
+ * @ngdoc method
+ * @name $cookies#getObject
+ *
+ * @description
+ * Returns the deserialized value of given cookie key
+ *
+ * @param {string} key Id to use for lookup.
+ * @returns {Object} Deserialized cookie value.
+ */
+ getObject: function(key) {
+ var value = this.get(key);
+ return value ? angular.fromJson(value) : value;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $cookies#getAll
+ *
+ * @description
+ * Returns a key value object with all the cookies
+ *
+ * @returns {Object} All cookies
+ */
+ getAll: function() {
+ return $$cookieReader();
+ },
+
+ /**
+ * @ngdoc method
+ * @name $cookies#put
+ *
+ * @description
+ * Sets a value for given cookie key
+ *
+ * @param {string} key Id for the `value`.
+ * @param {string} value Raw value to be stored.
+ * @param {Object=} options Options object.
+ * See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
+ */
+ put: function(key, value, options) {
+ $$cookieWriter(key, value, calcOptions(options));
+ },
+
+ /**
+ * @ngdoc method
+ * @name $cookies#putObject
+ *
+ * @description
+ * Serializes and sets a value for given cookie key
+ *
+ * @param {string} key Id for the `value`.
+ * @param {Object} value Value to be stored.
+ * @param {Object=} options Options object.
+ * See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
+ */
+ putObject: function(key, value, options) {
+ this.put(key, angular.toJson(value), options);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $cookies#remove
+ *
+ * @description
+ * Remove given cookie
+ *
+ * @param {string} key Id of the key-value pair to delete.
+ * @param {Object=} options Options object.
+ * See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
+ */
+ remove: function(key, options) {
+ $$cookieWriter(key, undefined, calcOptions(options));
+ }
+ };
+ }];
+ }]);
+
+angular.module('ngCookies').
+/**
+ * @ngdoc service
+ * @name $cookieStore
+ * @deprecated
+ * @requires $cookies
+ *
+ * @description
+ * Provides a key-value (string-object) storage, that is backed by session cookies.
+ * Objects put or retrieved from this storage are automatically serialized or
+ * deserialized by angular's toJson/fromJson.
+ *
+ * Requires the {@link ngCookies `ngCookies`} module to be installed.
+ *
+ * <div class="alert alert-danger">
+ * **Note:** The $cookieStore service is **deprecated**.
+ * Please use the {@link ngCookies.$cookies `$cookies`} service instead.
+ * </div>
+ *
+ * @example
+ *
+ * ```js
+ * angular.module('cookieStoreExample', ['ngCookies'])
+ * .controller('ExampleController', ['$cookieStore', function($cookieStore) {
+ * // Put cookie
+ * $cookieStore.put('myFavorite','oatmeal');
+ * // Get cookie
+ * var favoriteCookie = $cookieStore.get('myFavorite');
+ * // Removing a cookie
+ * $cookieStore.remove('myFavorite');
+ * }]);
+ * ```
+ */
+ factory('$cookieStore', ['$cookies', function($cookies) {
+
+ return {
+ /**
+ * @ngdoc method
+ * @name $cookieStore#get
+ *
+ * @description
+ * Returns the value of given cookie key
+ *
+ * @param {string} key Id to use for lookup.
+ * @returns {Object} Deserialized cookie value, undefined if the cookie does not exist.
+ */
+ get: function(key) {
+ return $cookies.getObject(key);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $cookieStore#put
+ *
+ * @description
+ * Sets a value for given cookie key
+ *
+ * @param {string} key Id for the `value`.
+ * @param {Object} value Value to be stored.
+ */
+ put: function(key, value) {
+ $cookies.putObject(key, value);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $cookieStore#remove
+ *
+ * @description
+ * Remove given cookie
+ *
+ * @param {string} key Id of the key-value pair to delete.
+ */
+ remove: function(key) {
+ $cookies.remove(key);
+ }
+ };
+
+ }]);
+
+/**
+ * @name $$cookieWriter
+ * @requires $document
+ *
+ * @description
+ * This is a private service for writing cookies
+ *
+ * @param {string} name Cookie name
+ * @param {string=} value Cookie value (if undefined, cookie will be deleted)
+ * @param {Object=} options Object with options that need to be stored for the cookie.
+ */
+function $$CookieWriter($document, $log, $browser) {
+ var cookiePath = $browser.baseHref();
+ var rawDocument = $document[0];
+
+ function buildCookieString(name, value, options) {
+ var path, expires;
+ options = options || {};
+ expires = options.expires;
+ path = angular.isDefined(options.path) ? options.path : cookiePath;
+ if (angular.isUndefined(value)) {
+ expires = 'Thu, 01 Jan 1970 00:00:00 GMT';
+ value = '';
+ }
+ if (angular.isString(expires)) {
+ expires = new Date(expires);
+ }
+
+ var str = encodeURIComponent(name) + '=' + encodeURIComponent(value);
+ str += path ? ';path=' + path : '';
+ str += options.domain ? ';domain=' + options.domain : '';
+ str += expires ? ';expires=' + expires.toUTCString() : '';
+ str += options.secure ? ';secure' : '';
+
+ // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:
+ // - 300 cookies
+ // - 20 cookies per unique domain
+ // - 4096 bytes per cookie
+ var cookieLength = str.length + 1;
+ if (cookieLength > 4096) {
+ $log.warn("Cookie '" + name +
+ "' possibly not set or overflowed because it was too large (" +
+ cookieLength + " > 4096 bytes)!");
+ }
+
+ return str;
+ }
+
+ return function(name, value, options) {
+ rawDocument.cookie = buildCookieString(name, value, options);
+ };
+}
+
+$$CookieWriter.$inject = ['$document', '$log', '$browser'];
+
+angular.module('ngCookies').provider('$$cookieWriter', function $$CookieWriterProvider() {
+ this.$get = $$CookieWriter;
+});
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js
new file mode 100644
index 00000000..d0f126a9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js
@@ -0,0 +1,9 @@
+/*
+ AngularJS v1.5.0
+ (c) 2010-2016 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(p,c,n){'use strict';function l(b,a,g){var d=g.baseHref(),k=b[0];return function(b,e,f){var g,h;f=f||{};h=f.expires;g=c.isDefined(f.path)?f.path:d;c.isUndefined(e)&&(h="Thu, 01 Jan 1970 00:00:00 GMT",e="");c.isString(h)&&(h=new Date(h));e=encodeURIComponent(b)+"="+encodeURIComponent(e);e=e+(g?";path="+g:"")+(f.domain?";domain="+f.domain:"");e+=h?";expires="+h.toUTCString():"";e+=f.secure?";secure":"";f=e.length+1;4096<f&&a.warn("Cookie '"+b+"' possibly not set or overflowed because it was too large ("+
+f+" > 4096 bytes)!");k.cookie=e}}c.module("ngCookies",["ng"]).provider("$cookies",[function(){var b=this.defaults={};this.$get=["$$cookieReader","$$cookieWriter",function(a,g){return{get:function(d){return a()[d]},getObject:function(d){return(d=this.get(d))?c.fromJson(d):d},getAll:function(){return a()},put:function(d,a,m){g(d,a,m?c.extend({},b,m):b)},putObject:function(d,b,a){this.put(d,c.toJson(b),a)},remove:function(a,k){g(a,n,k?c.extend({},b,k):b)}}}]}]);c.module("ngCookies").factory("$cookieStore",
+["$cookies",function(b){return{get:function(a){return b.getObject(a)},put:function(a,c){b.putObject(a,c)},remove:function(a){b.remove(a)}}}]);l.$inject=["$document","$log","$browser"];c.module("ngCookies").provider("$$cookieWriter",function(){this.$get=l})})(window,window.angular);
+//# sourceMappingURL=angular-cookies.min.js.map
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js.map
new file mode 100644
index 00000000..555b5103
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js.map
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"angular-cookies.min.js",
+"lineCount":8,
+"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CA2QtCC,QAASA,EAAc,CAACC,CAAD,CAAYC,CAAZ,CAAkBC,CAAlB,CAA4B,CACjD,IAAIC,EAAaD,CAAAE,SAAA,EAAjB,CACIC,EAAcL,CAAA,CAAU,CAAV,CAmClB,OAAO,SAAQ,CAACM,CAAD,CAAOC,CAAP,CAAcC,CAAd,CAAuB,CAjCW,IAC3CC,CAD2C,CACrCC,CACVF,EAAA,CAgCoDA,CAhCpD,EAAqB,EACrBE,EAAA,CAAUF,CAAAE,QACVD,EAAA,CAAOZ,CAAAc,UAAA,CAAkBH,CAAAC,KAAlB,CAAA,CAAkCD,CAAAC,KAAlC,CAAiDN,CACpDN,EAAAe,YAAA,CAAoBL,CAApB,CAAJ,GACEG,CACA,CADU,+BACV,CAAAH,CAAA,CAAQ,EAFV,CAIIV,EAAAgB,SAAA,CAAiBH,CAAjB,CAAJ,GACEA,CADF,CACY,IAAII,IAAJ,CAASJ,CAAT,CADZ,CAIIK,EAAAA,CAAMC,kBAAA,CAqB6BV,CArB7B,CAANS,CAAiC,GAAjCA,CAAuCC,kBAAA,CAAmBT,CAAnB,CAE3CQ,EAAA,CADAA,CACA,EADON,CAAA,CAAO,QAAP,CAAkBA,CAAlB,CAAyB,EAChC,GAAOD,CAAAS,OAAA,CAAiB,UAAjB,CAA8BT,CAAAS,OAA9B,CAA+C,EAAtD,CACAF,EAAA,EAAOL,CAAA,CAAU,WAAV,CAAwBA,CAAAQ,YAAA,EAAxB,CAAgD,EACvDH,EAAA,EAAOP,CAAAW,OAAA,CAAiB,SAAjB,CAA6B,EAMhCC,EAAAA,CAAeL,CAAAM,OAAfD,CAA4B,CACb,KAAnB,CAAIA,CAAJ,EACEnB,CAAAqB,KAAA,CAAU,UAAV,CASqChB,CATrC,CACE,6DADF;AAEEc,CAFF,CAEiB,iBAFjB,CASFf,EAAAkB,OAAA,CAJOR,CAG6B,CArCW,CAzPnDlB,CAAA2B,OAAA,CAAe,WAAf,CAA4B,CAAC,IAAD,CAA5B,CAAAC,SAAA,CAOY,UAPZ,CAOwB,CAACC,QAAyB,EAAG,CAwBjD,IAAIC,EAAW,IAAAA,SAAXA,CAA2B,EAiC/B,KAAAC,KAAA,CAAY,CAAC,gBAAD,CAAmB,gBAAnB,CAAqC,QAAQ,CAACC,CAAD,CAAiBC,CAAjB,CAAiC,CACxF,MAAO,CAWLC,IAAKA,QAAQ,CAACC,CAAD,CAAM,CACjB,MAAOH,EAAA,EAAA,CAAiBG,CAAjB,CADU,CAXd,CAyBLC,UAAWA,QAAQ,CAACD,CAAD,CAAM,CAEvB,MAAO,CADHzB,CACG,CADK,IAAAwB,IAAA,CAASC,CAAT,CACL,EAAQnC,CAAAqC,SAAA,CAAiB3B,CAAjB,CAAR,CAAkCA,CAFlB,CAzBpB,CAuCL4B,OAAQA,QAAQ,EAAG,CACjB,MAAON,EAAA,EADU,CAvCd,CAuDLO,IAAKA,QAAQ,CAACJ,CAAD,CAAMzB,CAAN,CAAaC,CAAb,CAAsB,CACjCsB,CAAA,CAAeE,CAAf,CAAoBzB,CAApB,CAAuCC,CAvFpC,CAAUX,CAAAwC,OAAA,CAAe,EAAf,CAAmBV,CAAnB,CAuF0BnB,CAvF1B,CAAV,CAAkDmB,CAuFrD,CADiC,CAvD9B,CAuELW,UAAWA,QAAQ,CAACN,CAAD,CAAMzB,CAAN,CAAaC,CAAb,CAAsB,CACvC,IAAA4B,IAAA,CAASJ,CAAT,CAAcnC,CAAA0C,OAAA,CAAehC,CAAf,CAAd,CAAqCC,CAArC,CADuC,CAvEpC,CAsFLgC,OAAQA,QAAQ,CAACR,CAAD,CAAMxB,CAAN,CAAe,CAC7BsB,CAAA,CAAeE,CAAf,CAAoBlC,CAApB,CAA2CU,CAtHxC,CAAUX,CAAAwC,OAAA,CAAe,EAAf,CAAmBV,CAAnB,CAsH8BnB,CAtH9B,CAAV,CAAkDmB,CAsHrD,CAD6B,CAtF1B,CADiF,CAA9E,CAzDqC,CAA7B,CAPxB,CA8JA9B,EAAA2B,OAAA,CAAe,WAAf,CAAAiB,QAAA,CAiCS,cAjCT;AAiCyB,CAAC,UAAD,CAAa,QAAQ,CAACC,CAAD,CAAW,CAErD,MAAO,CAWLX,IAAKA,QAAQ,CAACC,CAAD,CAAM,CACjB,MAAOU,EAAAT,UAAA,CAAmBD,CAAnB,CADU,CAXd,CAyBLI,IAAKA,QAAQ,CAACJ,CAAD,CAAMzB,CAAN,CAAa,CACxBmC,CAAAJ,UAAA,CAAmBN,CAAnB,CAAwBzB,CAAxB,CADwB,CAzBrB,CAsCLiC,OAAQA,QAAQ,CAACR,CAAD,CAAM,CACpBU,CAAAF,OAAA,CAAgBR,CAAhB,CADoB,CAtCjB,CAF8C,CAAhC,CAjCzB,CAqIAjC,EAAA4C,QAAA,CAAyB,CAAC,WAAD,CAAc,MAAd,CAAsB,UAAtB,CAEzB9C,EAAA2B,OAAA,CAAe,WAAf,CAAAC,SAAA,CAAqC,gBAArC,CAAuDmB,QAA+B,EAAG,CACvF,IAAAhB,KAAA,CAAY7B,CAD2E,CAAzF,CAvTsC,CAArC,CAAD,CA4TGH,MA5TH,CA4TWA,MAAAC,QA5TX;",
+"sources":["angular-cookies.js"],
+"names":["window","angular","undefined","$$CookieWriter","$document","$log","$browser","cookiePath","baseHref","rawDocument","name","value","options","path","expires","isDefined","isUndefined","isString","Date","str","encodeURIComponent","domain","toUTCString","secure","cookieLength","length","warn","cookie","module","provider","$CookiesProvider","defaults","$get","$$cookieReader","$$cookieWriter","get","key","getObject","fromJson","getAll","put","extend","putObject","toJson","remove","factory","$cookies","$inject","$$CookieWriterProvider"]
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-csp.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-csp.css
new file mode 100644
index 00000000..23134fdf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-csp.css
@@ -0,0 +1,20 @@
+
+@charset "UTF-8";
+
+[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak],
+.ng-cloak, .x-ng-cloak,
+.ng-hide:not(.ng-hide-animate) {
+ display: none !important;
+}
+
+ng\:form {
+ display: block;
+}
+
+.ng-animate-shim {
+ visibility:hidden;
+}
+
+.ng-anchor {
+ position:absolute;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.js
new file mode 100644
index 00000000..77948fd5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.js
@@ -0,0 +1,484 @@
+/**
+ * @license AngularJS v1.5.0
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+
+(function() {'use strict';
+ function isFunction(value) {return typeof value === 'function';};
+
+/* global: toDebugString: true */
+
+function serializeObject(obj) {
+ var seen = [];
+
+ return JSON.stringify(obj, function(key, val) {
+ val = toJsonReplacer(key, val);
+ if (isObject(val)) {
+
+ if (seen.indexOf(val) >= 0) return '...';
+
+ seen.push(val);
+ }
+ return val;
+ });
+}
+
+function toDebugString(obj) {
+ if (typeof obj === 'function') {
+ return obj.toString().replace(/ \{[\s\S]*$/, '');
+ } else if (isUndefined(obj)) {
+ return 'undefined';
+ } else if (typeof obj !== 'string') {
+ return serializeObject(obj);
+ }
+ return obj;
+}
+
+/**
+ * @description
+ *
+ * This object provides a utility for producing rich Error messages within
+ * Angular. It can be called as follows:
+ *
+ * var exampleMinErr = minErr('example');
+ * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
+ *
+ * The above creates an instance of minErr in the example namespace. The
+ * resulting error will have a namespaced error code of example.one. The
+ * resulting error will replace {0} with the value of foo, and {1} with the
+ * value of bar. The object is not restricted in the number of arguments it can
+ * take.
+ *
+ * If fewer arguments are specified than necessary for interpolation, the extra
+ * interpolation markers will be preserved in the final string.
+ *
+ * Since data will be parsed statically during a build step, some restrictions
+ * are applied with respect to how minErr instances are created and called.
+ * Instances should have names of the form namespaceMinErr for a minErr created
+ * using minErr('namespace') . Error codes, namespaces and template strings
+ * should all be static strings, not variables or general expressions.
+ *
+ * @param {string} module The namespace to use for the new minErr instance.
+ * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning
+ * error from returned function, for cases when a particular type of error is useful.
+ * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
+ */
+
+function minErr(module, ErrorConstructor) {
+ ErrorConstructor = ErrorConstructor || Error;
+ return function() {
+ var SKIP_INDEXES = 2;
+
+ var templateArgs = arguments,
+ code = templateArgs[0],
+ message = '[' + (module ? module + ':' : '') + code + '] ',
+ template = templateArgs[1],
+ paramPrefix, i;
+
+ message += template.replace(/\{\d+\}/g, function(match) {
+ var index = +match.slice(1, -1),
+ shiftedIndex = index + SKIP_INDEXES;
+
+ if (shiftedIndex < templateArgs.length) {
+ return toDebugString(templateArgs[shiftedIndex]);
+ }
+
+ return match;
+ });
+
+ message += '\nhttp://errors.angularjs.org/1.5.0/' +
+ (module ? module + '/' : '') + code;
+
+ for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
+ message += paramPrefix + 'p' + (i - SKIP_INDEXES) + '=' +
+ encodeURIComponent(toDebugString(templateArgs[i]));
+ }
+
+ return new ErrorConstructor(message);
+ };
+}
+
+/**
+ * @ngdoc type
+ * @name angular.Module
+ * @module ng
+ * @description
+ *
+ * Interface for configuring angular {@link angular.module modules}.
+ */
+
+function setupModuleLoader(window) {
+
+ var $injectorMinErr = minErr('$injector');
+ var ngMinErr = minErr('ng');
+
+ function ensure(obj, name, factory) {
+ return obj[name] || (obj[name] = factory());
+ }
+
+ var angular = ensure(window, 'angular', Object);
+
+ // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
+ angular.$$minErr = angular.$$minErr || minErr;
+
+ return ensure(angular, 'module', function() {
+ /** @type {Object.<string, angular.Module>} */
+ var modules = {};
+
+ /**
+ * @ngdoc function
+ * @name angular.module
+ * @module ng
+ * @description
+ *
+ * The `angular.module` is a global place for creating, registering and retrieving Angular
+ * modules.
+ * All modules (angular core or 3rd party) that should be available to an application must be
+ * registered using this mechanism.
+ *
+ * Passing one argument retrieves an existing {@link angular.Module},
+ * whereas passing more than one argument creates a new {@link angular.Module}
+ *
+ *
+ * # Module
+ *
+ * A module is a collection of services, directives, controllers, filters, and configuration information.
+ * `angular.module` is used to configure the {@link auto.$injector $injector}.
+ *
+ * ```js
+ * // Create a new module
+ * var myModule = angular.module('myModule', []);
+ *
+ * // register a new service
+ * myModule.value('appName', 'MyCoolApp');
+ *
+ * // configure existing services inside initialization blocks.
+ * myModule.config(['$locationProvider', function($locationProvider) {
+ * // Configure existing providers
+ * $locationProvider.hashPrefix('!');
+ * }]);
+ * ```
+ *
+ * Then you can create an injector and load your modules like this:
+ *
+ * ```js
+ * var injector = angular.injector(['ng', 'myModule'])
+ * ```
+ *
+ * However it's more likely that you'll just use
+ * {@link ng.directive:ngApp ngApp} or
+ * {@link angular.bootstrap} to simplify this process for you.
+ *
+ * @param {!string} name The name of the module to create or retrieve.
+ * @param {!Array.<string>=} requires If specified then new module is being created. If
+ * unspecified then the module is being retrieved for further configuration.
+ * @param {Function=} configFn Optional configuration function for the module. Same as
+ * {@link angular.Module#config Module#config()}.
+ * @returns {angular.Module} new module with the {@link angular.Module} api.
+ */
+ return function module(name, requires, configFn) {
+ var assertNotHasOwnProperty = function(name, context) {
+ if (name === 'hasOwnProperty') {
+ throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
+ }
+ };
+
+ assertNotHasOwnProperty(name, 'module');
+ if (requires && modules.hasOwnProperty(name)) {
+ modules[name] = null;
+ }
+ return ensure(modules, name, function() {
+ if (!requires) {
+ throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " +
+ "the module name or forgot to load it. If registering a module ensure that you " +
+ "specify the dependencies as the second argument.", name);
+ }
+
+ /** @type {!Array.<Array.<*>>} */
+ var invokeQueue = [];
+
+ /** @type {!Array.<Function>} */
+ var configBlocks = [];
+
+ /** @type {!Array.<Function>} */
+ var runBlocks = [];
+
+ var config = invokeLater('$injector', 'invoke', 'push', configBlocks);
+
+ /** @type {angular.Module} */
+ var moduleInstance = {
+ // Private state
+ _invokeQueue: invokeQueue,
+ _configBlocks: configBlocks,
+ _runBlocks: runBlocks,
+
+ /**
+ * @ngdoc property
+ * @name angular.Module#requires
+ * @module ng
+ *
+ * @description
+ * Holds the list of modules which the injector will load before the current module is
+ * loaded.
+ */
+ requires: requires,
+
+ /**
+ * @ngdoc property
+ * @name angular.Module#name
+ * @module ng
+ *
+ * @description
+ * Name of the module.
+ */
+ name: name,
+
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#provider
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} providerType Construction function for creating new instance of the
+ * service.
+ * @description
+ * See {@link auto.$provide#provider $provide.provider()}.
+ */
+ provider: invokeLaterAndSetModuleName('$provide', 'provider'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#factory
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} providerFunction Function for creating new instance of the service.
+ * @description
+ * See {@link auto.$provide#factory $provide.factory()}.
+ */
+ factory: invokeLaterAndSetModuleName('$provide', 'factory'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#service
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} constructor A constructor function that will be instantiated.
+ * @description
+ * See {@link auto.$provide#service $provide.service()}.
+ */
+ service: invokeLaterAndSetModuleName('$provide', 'service'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#value
+ * @module ng
+ * @param {string} name service name
+ * @param {*} object Service instance object.
+ * @description
+ * See {@link auto.$provide#value $provide.value()}.
+ */
+ value: invokeLater('$provide', 'value'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#constant
+ * @module ng
+ * @param {string} name constant name
+ * @param {*} object Constant value.
+ * @description
+ * Because the constants are fixed, they get applied before other provide methods.
+ * See {@link auto.$provide#constant $provide.constant()}.
+ */
+ constant: invokeLater('$provide', 'constant', 'unshift'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#decorator
+ * @module ng
+ * @param {string} The name of the service to decorate.
+ * @param {Function} This function will be invoked when the service needs to be
+ * instantiated and should return the decorated service instance.
+ * @description
+ * See {@link auto.$provide#decorator $provide.decorator()}.
+ */
+ decorator: invokeLaterAndSetModuleName('$provide', 'decorator'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#animation
+ * @module ng
+ * @param {string} name animation name
+ * @param {Function} animationFactory Factory function for creating new instance of an
+ * animation.
+ * @description
+ *
+ * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
+ *
+ *
+ * Defines an animation hook that can be later used with
+ * {@link $animate $animate} service and directives that use this service.
+ *
+ * ```js
+ * module.animation('.animation-name', function($inject1, $inject2) {
+ * return {
+ * eventName : function(element, done) {
+ * //code to run the animation
+ * //once complete, then run done()
+ * return function cancellationFunction(element) {
+ * //code to cancel the animation
+ * }
+ * }
+ * }
+ * })
+ * ```
+ *
+ * See {@link ng.$animateProvider#register $animateProvider.register()} and
+ * {@link ngAnimate ngAnimate module} for more information.
+ */
+ animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#filter
+ * @module ng
+ * @param {string} name Filter name - this must be a valid angular expression identifier
+ * @param {Function} filterFactory Factory function for creating new instance of filter.
+ * @description
+ * See {@link ng.$filterProvider#register $filterProvider.register()}.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
+ * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
+ * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
+ * (`myapp_subsection_filterx`).
+ * </div>
+ */
+ filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#controller
+ * @module ng
+ * @param {string|Object} name Controller name, or an object map of controllers where the
+ * keys are the names and the values are the constructors.
+ * @param {Function} constructor Controller constructor function.
+ * @description
+ * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
+ */
+ controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#directive
+ * @module ng
+ * @param {string|Object} name Directive name, or an object map of directives where the
+ * keys are the names and the values are the factories.
+ * @param {Function} directiveFactory Factory function for creating new instance of
+ * directives.
+ * @description
+ * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
+ */
+ directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#component
+ * @module ng
+ * @param {string} name Name of the component in camel-case (i.e. myComp which will match as my-comp)
+ * @param {Object} options Component definition object (a simplified
+ * {@link ng.$compile#directive-definition-object directive definition object})
+ *
+ * @description
+ * See {@link ng.$compileProvider#component $compileProvider.component()}.
+ */
+ component: invokeLaterAndSetModuleName('$compileProvider', 'component'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#config
+ * @module ng
+ * @param {Function} configFn Execute this function on module load. Useful for service
+ * configuration.
+ * @description
+ * Use this method to register work which needs to be performed on module loading.
+ * For more about how to configure services, see
+ * {@link providers#provider-recipe Provider Recipe}.
+ */
+ config: config,
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#run
+ * @module ng
+ * @param {Function} initializationFn Execute this function after injector creation.
+ * Useful for application initialization.
+ * @description
+ * Use this method to register work which should be performed when the injector is done
+ * loading all modules.
+ */
+ run: function(block) {
+ runBlocks.push(block);
+ return this;
+ }
+ };
+
+ if (configFn) {
+ config(configFn);
+ }
+
+ return moduleInstance;
+
+ /**
+ * @param {string} provider
+ * @param {string} method
+ * @param {String=} insertMethod
+ * @returns {angular.Module}
+ */
+ function invokeLater(provider, method, insertMethod, queue) {
+ if (!queue) queue = invokeQueue;
+ return function() {
+ queue[insertMethod || 'push']([provider, method, arguments]);
+ return moduleInstance;
+ };
+ }
+
+ /**
+ * @param {string} provider
+ * @param {string} method
+ * @returns {angular.Module}
+ */
+ function invokeLaterAndSetModuleName(provider, method) {
+ return function(recipeName, factoryFunction) {
+ if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
+ invokeQueue.push([provider, method, arguments]);
+ return moduleInstance;
+ };
+ }
+ });
+ };
+ });
+
+}
+
+setupModuleLoader(window);
+})(window);
+
+/**
+ * Closure compiler type information
+ *
+ * @typedef { {
+ * requires: !Array.<string>,
+ * invokeQueue: !Array.<Array.<*>>,
+ *
+ * service: function(string, Function):angular.Module,
+ * factory: function(string, Function):angular.Module,
+ * value: function(string, *):angular.Module,
+ *
+ * filter: function(string, Function):angular.Module,
+ *
+ * init: function(Function):angular.Module
+ * } }
+ */
+angular.Module;
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.min.js
new file mode 100644
index 00000000..316ee26e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.min.js
@@ -0,0 +1,10 @@
+/*
+ AngularJS v1.5.0
+ (c) 2010-2016 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(){'use strict';function d(b){return function(){var a=arguments[0],e;e="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.5.0/"+(b?b+"/":"")+a;for(a=1;a<arguments.length;a++){e=e+(1==a?"?":"&")+"p"+(a-1)+"=";var d=encodeURIComponent,c;c=arguments[a];c="function"==typeof c?c.toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof c?"undefined":"string"!=typeof c?JSON.stringify(c):c;e+=d(c)}return Error(e)}}(function(b){function a(c,a,b){return c[a]||(c[a]=b())}var e=d("$injector"),n=d("ng");
+b=a(b,"angular",Object);b.$$minErr=b.$$minErr||d;return a(b,"module",function(){var c={};return function(b,d,h){if("hasOwnProperty"===b)throw n("badname","module");d&&c.hasOwnProperty(b)&&(c[b]=null);return a(c,b,function(){function c(a,b,d,e){e||(e=f);return function(){e[d||"push"]([a,b,arguments]);return g}}function a(c,e){return function(a,d){d&&"function"===typeof d&&(d.$$moduleName=b);f.push([c,e,arguments]);return g}}if(!d)throw e("nomod",b);var f=[],k=[],l=[],m=c("$injector","invoke","push",
+k),g={_invokeQueue:f,_configBlocks:k,_runBlocks:l,requires:d,name:b,provider:a("$provide","provider"),factory:a("$provide","factory"),service:a("$provide","service"),value:c("$provide","value"),constant:c("$provide","constant","unshift"),decorator:a("$provide","decorator"),animation:a("$animateProvider","register"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),component:a("$compileProvider","component"),config:m,run:function(a){l.push(a);
+return this}};h&&m(h);return g})}})})(window)})(window);
+//# sourceMappingURL=angular-loader.min.js.map
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.min.js.map
new file mode 100644
index 00000000..67ebb8b6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.min.js.map
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"angular-loader.min.js",
+"lineCount":9,
+"mappings":"A;;;;;aAMC,SAAQ,EAAG,CA6DZA,QAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,SAAAA,EAAAA,CAAAA,IAAAA,EAAAA,SAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,GAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,EAAAA,EAAAA,CAAAA,CAAAA,sCAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,EAAAA,EAAAA,CAAAA,KAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,SAAAA,OAAAA,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAAA,CAAAA,CAAAA,GAAAA,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,CAAAA,CAAAA,CAAAA,EAAAA,GAAAA,KAAAA,EAAAA,kBAAAA,CAAAA,CAAAA,EAAAA,CAAAA,SAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,UAAAA,EAAAA,MAAAA,EAAAA,CAAAA,CAAAA,SAAAA,EAAAA,QAAAA,CAAAA,aAAAA,CAAAA,EAAAA,CAAAA,CAAAA,WAAAA,EAAAA,MAAAA,EAAAA,CAAAA,WAAAA,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,CAAAA,IAAAA,UAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,MAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CA2CAC,SAA0B,CAACC,CAAD,CAAS,CAKjCC,QAASA,EAAM,CAACC,CAAD,CAAMC,CAAN,CAAYC,CAAZ,CAAqB,CAClC,MAAOF,EAAA,CAAIC,CAAJ,CAAP,GAAqBD,CAAA,CAAIC,CAAJ,CAArB,CAAiCC,CAAA,EAAjC,CADkC,CAHpC,IAAIC,EAAkBP,CAAA,CAAO,WAAP,CAAtB,CACIQ,EAAWR,CAAA,CAAO,IAAP,CAMXS;CAAAA,CAAUN,CAAA,CAAOD,CAAP,CAAe,SAAf,CAA0BQ,MAA1B,CAGdD,EAAAE,SAAA,CAAmBF,CAAAE,SAAnB,EAAuCX,CAEvC,OAAOG,EAAA,CAAOM,CAAP,CAAgB,QAAhB,CAA0B,QAAQ,EAAG,CAE1C,IAAIG,EAAU,EAqDd,OAAOC,SAAe,CAACR,CAAD,CAAOS,CAAP,CAAiBC,CAAjB,CAA2B,CAE7C,GAAa,gBAAb,GAKsBV,CALtB,CACE,KAAMG,EAAA,CAAS,SAAT,CAIoBQ,QAJpB,CAAN,CAKAF,CAAJ,EAAgBF,CAAAK,eAAA,CAAuBZ,CAAvB,CAAhB,GACEO,CAAA,CAAQP,CAAR,CADF,CACkB,IADlB,CAGA,OAAOF,EAAA,CAAOS,CAAP,CAAgBP,CAAhB,CAAsB,QAAQ,EAAG,CAuPtCa,QAASA,EAAW,CAACC,CAAD,CAAWC,CAAX,CAAmBC,CAAnB,CAAiCC,CAAjC,CAAwC,CACrDA,CAAL,GAAYA,CAAZ,CAAoBC,CAApB,CACA,OAAO,SAAQ,EAAG,CAChBD,CAAA,CAAMD,CAAN,EAAsB,MAAtB,CAAA,CAA8B,CAACF,CAAD,CAAWC,CAAX,CAAmBI,SAAnB,CAA9B,CACA,OAAOC,EAFS,CAFwC,CAa5DC,QAASA,EAA2B,CAACP,CAAD,CAAWC,CAAX,CAAmB,CACrD,MAAO,SAAQ,CAACO,CAAD,CAAaC,CAAb,CAA8B,CACvCA,CAAJ,EA7b4C,UA6b5C,GA7b2B,MA6bOA,EAAlC,GAAoDA,CAAAC,aAApD,CAAmFxB,CAAnF,CACAkB,EAAAO,KAAA,CAAiB,CAACX,CAAD,CAAWC,CAAX,CAAmBI,SAAnB,CAAjB,CACA,OAAOC,EAHoC,CADQ,CAnQvD,GAAKX,CAAAA,CAAL,CACE,KAAMP,EAAA,CAAgB,OAAhB,CAEiDF,CAFjD,CAAN,CAMF,IAAIkB,EAAc,EAAlB,CAGIQ,EAAe,EAHnB,CAMIC,EAAY,EANhB,CAQIC,EAASf,CAAA,CAAY,WAAZ,CAAyB,QAAzB,CAAmC,MAAnC;AAA2Ca,CAA3C,CARb,CAWIN,EAAiB,CAEnBS,aAAcX,CAFK,CAGnBY,cAAeJ,CAHI,CAInBK,WAAYJ,CAJO,CAenBlB,SAAUA,CAfS,CAyBnBT,KAAMA,CAzBa,CAsCnBc,SAAUO,CAAA,CAA4B,UAA5B,CAAwC,UAAxC,CAtCS,CAiDnBpB,QAASoB,CAAA,CAA4B,UAA5B,CAAwC,SAAxC,CAjDU,CA4DnBW,QAASX,CAAA,CAA4B,UAA5B,CAAwC,SAAxC,CA5DU,CAuEnBY,MAAOpB,CAAA,CAAY,UAAZ,CAAwB,OAAxB,CAvEY,CAmFnBqB,SAAUrB,CAAA,CAAY,UAAZ,CAAwB,UAAxB,CAAoC,SAApC,CAnFS,CA+FnBsB,UAAWd,CAAA,CAA4B,UAA5B,CAAwC,WAAxC,CA/FQ,CAiInBe,UAAWf,CAAA,CAA4B,kBAA5B,CAAgD,UAAhD,CAjIQ,CAmJnBgB,OAAQhB,CAAA,CAA4B,iBAA5B,CAA+C,UAA/C,CAnJW,CA+JnBiB,WAAYjB,CAAA,CAA4B,qBAA5B,CAAmD,UAAnD,CA/JO,CA4KnBkB,UAAWlB,CAAA,CAA4B,kBAA5B,CAAgD,WAAhD,CA5KQ,CAyLnBmB,UAAWnB,CAAA,CAA4B,kBAA5B,CAAgD,WAAhD,CAzLQ,CAsMnBO,OAAQA,CAtMW,CAkNnBa,IAAKA,QAAQ,CAACC,CAAD,CAAQ,CACnBf,CAAAF,KAAA,CAAeiB,CAAf,CACA;MAAO,KAFY,CAlNF,CAwNjBhC,EAAJ,EACEkB,CAAA,CAAOlB,CAAP,CAGF,OAAOU,EA/O+B,CAAjC,CAXwC,CAvDP,CAArC,CAd0B,CAAnCxB,CAiWA,CAAkBC,MAAlB,CAzcY,CAAX,CAAD,CA0cGA,MA1cH;",
+"sources":["angular-loader.js"],
+"names":["minErr","setupModuleLoader","window","ensure","obj","name","factory","$injectorMinErr","ngMinErr","angular","Object","$$minErr","modules","module","requires","configFn","context","hasOwnProperty","invokeLater","provider","method","insertMethod","queue","invokeQueue","arguments","moduleInstance","invokeLaterAndSetModuleName","recipeName","factoryFunction","$$moduleName","push","configBlocks","runBlocks","config","_invokeQueue","_configBlocks","_runBlocks","service","value","constant","decorator","animation","filter","controller","directive","component","run","block"]
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.js
new file mode 100644
index 00000000..0c3c6c18
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.js
@@ -0,0 +1,980 @@
+/**
+ * @license AngularJS v1.5.0
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+// NOTE: ADVANCED_OPTIMIZATIONS mode.
+//
+// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using
+// constructs incompatible with that mode.
+
+var $interpolateMinErr = window['angular']['$interpolateMinErr'];
+
+var noop = window['angular']['noop'],
+ isFunction = window['angular']['isFunction'],
+ toJson = window['angular']['toJson'];
+
+function stringify(value) {
+ if (value == null /* null/undefined */) { return ''; }
+ switch (typeof value) {
+ case 'string': return value;
+ case 'number': return '' + value;
+ default: return toJson(value);
+ }
+}
+
+// Convert an index into the string into line/column for use in error messages
+// As such, this doesn't have to be efficient.
+function indexToLineAndColumn(text, index) {
+ var lines = text.split(/\n/g);
+ for (var i=0; i < lines.length; i++) {
+ var line=lines[i];
+ if (index >= line.length) {
+ index -= line.length;
+ } else {
+ return { line: i + 1, column: index + 1 };
+ }
+ }
+}
+var PARSE_CACHE_FOR_TEXT_LITERALS = Object.create(null);
+
+function parseTextLiteral(text) {
+ var cachedFn = PARSE_CACHE_FOR_TEXT_LITERALS[text];
+ if (cachedFn != null) {
+ return cachedFn;
+ }
+ function parsedFn(context) { return text; }
+ parsedFn['$$watchDelegate'] = function watchDelegate(scope, listener, objectEquality) {
+ var unwatch = scope['$watch'](noop,
+ function textLiteralWatcher() {
+ if (isFunction(listener)) { listener.call(null, text, text, scope); }
+ unwatch();
+ },
+ objectEquality);
+ return unwatch;
+ };
+ PARSE_CACHE_FOR_TEXT_LITERALS[text] = parsedFn;
+ parsedFn['exp'] = text; // Needed to pretend to be $interpolate for tests copied from interpolateSpec.js
+ parsedFn['expressions'] = []; // Require this to call $compile.$$addBindingInfo() which allows Protractor to find elements by binding.
+ return parsedFn;
+}
+
+function subtractOffset(expressionFn, offset) {
+ if (offset === 0) {
+ return expressionFn;
+ }
+ function minusOffset(value) {
+ return (value == void 0) ? value : value - offset;
+ }
+ function parsedFn(context) { return minusOffset(expressionFn(context)); }
+ var unwatch;
+ parsedFn['$$watchDelegate'] = function watchDelegate(scope, listener, objectEquality) {
+ unwatch = scope['$watch'](expressionFn,
+ function pluralExpressionWatchListener(newValue, oldValue) {
+ if (isFunction(listener)) { listener.call(null, minusOffset(newValue), minusOffset(oldValue), scope); }
+ },
+ objectEquality);
+ return unwatch;
+ };
+ return parsedFn;
+}
+
+// NOTE: ADVANCED_OPTIMIZATIONS mode.
+//
+// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using
+// constructs incompatible with that mode.
+
+/* global $interpolateMinErr: false */
+/* global isFunction: false */
+/* global noop: false */
+
+/**
+ * @constructor
+ * @private
+ */
+function MessageSelectorBase(expressionFn, choices) {
+ var self = this;
+ this.expressionFn = expressionFn;
+ this.choices = choices;
+ if (choices["other"] === void 0) {
+ throw $interpolateMinErr('reqother', '“other†is a required option.');
+ }
+ this.parsedFn = function(context) { return self.getResult(context); };
+ this.parsedFn['$$watchDelegate'] = function $$watchDelegate(scope, listener, objectEquality) {
+ return self.watchDelegate(scope, listener, objectEquality);
+ };
+ this.parsedFn['exp'] = expressionFn['exp'];
+ this.parsedFn['expressions'] = expressionFn['expressions'];
+}
+
+MessageSelectorBase.prototype.getMessageFn = function getMessageFn(value) {
+ return this.choices[this.categorizeValue(value)];
+};
+
+MessageSelectorBase.prototype.getResult = function getResult(context) {
+ return this.getMessageFn(this.expressionFn(context))(context);
+};
+
+MessageSelectorBase.prototype.watchDelegate = function watchDelegate(scope, listener, objectEquality) {
+ var watchers = new MessageSelectorWatchers(this, scope, listener, objectEquality);
+ return function() { watchers.cancelWatch(); };
+};
+
+/**
+ * @constructor
+ * @private
+ */
+function MessageSelectorWatchers(msgSelector, scope, listener, objectEquality) {
+ var self = this;
+ this.scope = scope;
+ this.msgSelector = msgSelector;
+ this.listener = listener;
+ this.objectEquality = objectEquality;
+ this.lastMessage = void 0;
+ this.messageFnWatcher = noop;
+ var expressionFnListener = function(newValue, oldValue) { return self.expressionFnListener(newValue, oldValue); };
+ this.expressionFnWatcher = scope['$watch'](msgSelector.expressionFn, expressionFnListener, objectEquality);
+}
+
+MessageSelectorWatchers.prototype.expressionFnListener = function expressionFnListener(newValue, oldValue) {
+ var self = this;
+ this.messageFnWatcher();
+ var messageFnListener = function(newMessage, oldMessage) { return self.messageFnListener(newMessage, oldMessage); };
+ var messageFn = this.msgSelector.getMessageFn(newValue);
+ this.messageFnWatcher = this.scope['$watch'](messageFn, messageFnListener, this.objectEquality);
+};
+
+MessageSelectorWatchers.prototype.messageFnListener = function messageFnListener(newMessage, oldMessage) {
+ if (isFunction(this.listener)) {
+ this.listener.call(null, newMessage, newMessage === oldMessage ? newMessage : this.lastMessage, this.scope);
+ }
+ this.lastMessage = newMessage;
+};
+
+MessageSelectorWatchers.prototype.cancelWatch = function cancelWatch() {
+ this.expressionFnWatcher();
+ this.messageFnWatcher();
+};
+
+/**
+ * @constructor
+ * @extends MessageSelectorBase
+ * @private
+ */
+function SelectMessage(expressionFn, choices) {
+ MessageSelectorBase.call(this, expressionFn, choices);
+}
+
+function SelectMessageProto() {}
+SelectMessageProto.prototype = MessageSelectorBase.prototype;
+
+SelectMessage.prototype = new SelectMessageProto();
+SelectMessage.prototype.categorizeValue = function categorizeSelectValue(value) {
+ return (this.choices[value] !== void 0) ? value : "other";
+};
+
+/**
+ * @constructor
+ * @extends MessageSelectorBase
+ * @private
+ */
+function PluralMessage(expressionFn, choices, offset, pluralCat) {
+ MessageSelectorBase.call(this, expressionFn, choices);
+ this.offset = offset;
+ this.pluralCat = pluralCat;
+}
+
+function PluralMessageProto() {}
+PluralMessageProto.prototype = MessageSelectorBase.prototype;
+
+PluralMessage.prototype = new PluralMessageProto();
+PluralMessage.prototype.categorizeValue = function categorizePluralValue(value) {
+ if (isNaN(value)) {
+ return "other";
+ } else if (this.choices[value] !== void 0) {
+ return value;
+ } else {
+ var category = this.pluralCat(value - this.offset);
+ return (this.choices[category] !== void 0) ? category : "other";
+ }
+};
+
+// NOTE: ADVANCED_OPTIMIZATIONS mode.
+//
+// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using
+// constructs incompatible with that mode.
+
+/* global $interpolateMinErr: false */
+/* global isFunction: false */
+/* global parseTextLiteral: false */
+
+/**
+ * @constructor
+ * @private
+ */
+function InterpolationParts(trustedContext, allOrNothing) {
+ this.trustedContext = trustedContext;
+ this.allOrNothing = allOrNothing;
+ this.textParts = [];
+ this.expressionFns = [];
+ this.expressionIndices = [];
+ this.partialText = '';
+ this.concatParts = null;
+}
+
+InterpolationParts.prototype.flushPartialText = function flushPartialText() {
+ if (this.partialText) {
+ if (this.concatParts == null) {
+ this.textParts.push(this.partialText);
+ } else {
+ this.textParts.push(this.concatParts.join(''));
+ this.concatParts = null;
+ }
+ this.partialText = '';
+ }
+};
+
+InterpolationParts.prototype.addText = function addText(text) {
+ if (text.length) {
+ if (!this.partialText) {
+ this.partialText = text;
+ } else if (this.concatParts) {
+ this.concatParts.push(text);
+ } else {
+ this.concatParts = [this.partialText, text];
+ }
+ }
+};
+
+InterpolationParts.prototype.addExpressionFn = function addExpressionFn(expressionFn) {
+ this.flushPartialText();
+ this.expressionIndices.push(this.textParts.length);
+ this.expressionFns.push(expressionFn);
+ this.textParts.push('');
+};
+
+InterpolationParts.prototype.getExpressionValues = function getExpressionValues(context) {
+ var expressionValues = new Array(this.expressionFns.length);
+ for (var i = 0; i < this.expressionFns.length; i++) {
+ expressionValues[i] = this.expressionFns[i](context);
+ }
+ return expressionValues;
+};
+
+InterpolationParts.prototype.getResult = function getResult(expressionValues) {
+ for (var i = 0; i < this.expressionIndices.length; i++) {
+ var expressionValue = expressionValues[i];
+ if (this.allOrNothing && expressionValue === void 0) return;
+ this.textParts[this.expressionIndices[i]] = expressionValue;
+ }
+ return this.textParts.join('');
+};
+
+
+InterpolationParts.prototype.toParsedFn = function toParsedFn(mustHaveExpression, originalText) {
+ var self = this;
+ this.flushPartialText();
+ if (mustHaveExpression && this.expressionFns.length === 0) {
+ return void 0;
+ }
+ if (this.textParts.length === 0) {
+ return parseTextLiteral('');
+ }
+ if (this.trustedContext && this.textParts.length > 1) {
+ $interpolateMinErr['throwNoconcat'](originalText);
+ }
+ if (this.expressionFns.length === 0) {
+ if (this.textParts.length != 1) { this.errorInParseLogic(); }
+ return parseTextLiteral(this.textParts[0]);
+ }
+ var parsedFn = function(context) {
+ return self.getResult(self.getExpressionValues(context));
+ };
+ parsedFn['$$watchDelegate'] = function $$watchDelegate(scope, listener, objectEquality) {
+ return self.watchDelegate(scope, listener, objectEquality);
+ };
+
+ parsedFn['exp'] = originalText; // Needed to pretend to be $interpolate for tests copied from interpolateSpec.js
+ parsedFn['expressions'] = new Array(this.expressionFns.length); // Require this to call $compile.$$addBindingInfo() which allows Protractor to find elements by binding.
+ for (var i = 0; i < this.expressionFns.length; i++) {
+ parsedFn['expressions'][i] = this.expressionFns[i]['exp'];
+ }
+
+ return parsedFn;
+};
+
+InterpolationParts.prototype.watchDelegate = function watchDelegate(scope, listener, objectEquality) {
+ var watcher = new InterpolationPartsWatcher(this, scope, listener, objectEquality);
+ return function() { watcher.cancelWatch(); };
+};
+
+function InterpolationPartsWatcher(interpolationParts, scope, listener, objectEquality) {
+ this.interpolationParts = interpolationParts;
+ this.scope = scope;
+ this.previousResult = (void 0);
+ this.listener = listener;
+ var self = this;
+ this.expressionFnsWatcher = scope['$watchGroup'](interpolationParts.expressionFns, function(newExpressionValues, oldExpressionValues) {
+ self.watchListener(newExpressionValues, oldExpressionValues);
+ });
+}
+
+InterpolationPartsWatcher.prototype.watchListener = function watchListener(newExpressionValues, oldExpressionValues) {
+ var result = this.interpolationParts.getResult(newExpressionValues);
+ if (isFunction(this.listener)) {
+ this.listener.call(null, result, newExpressionValues === oldExpressionValues ? result : this.previousResult, this.scope);
+ }
+ this.previousResult = result;
+};
+
+InterpolationPartsWatcher.prototype.cancelWatch = function cancelWatch() {
+ this.expressionFnsWatcher();
+};
+
+// NOTE: ADVANCED_OPTIMIZATIONS mode.
+//
+// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using
+// constructs incompatible with that mode.
+
+/* global $interpolateMinErr: false */
+/* global indexToLineAndColumn: false */
+/* global InterpolationParts: false */
+/* global PluralMessage: false */
+/* global SelectMessage: false */
+/* global subtractOffset: false */
+
+// The params src and dst are exactly one of two types: NestedParserState or MessageFormatParser.
+// This function is fully optimized by V8. (inspect via IRHydra or --trace-deopt.)
+// The idea behind writing it this way is to avoid repeating oneself. This is the ONE place where
+// the parser state that is saved/restored when parsing nested mustaches is specified.
+function copyNestedParserState(src, dst) {
+ dst.expressionFn = src.expressionFn;
+ dst.expressionMinusOffsetFn = src.expressionMinusOffsetFn;
+ dst.pluralOffset = src.pluralOffset;
+ dst.choices = src.choices;
+ dst.choiceKey = src.choiceKey;
+ dst.interpolationParts = src.interpolationParts;
+ dst.ruleChoiceKeyword = src.ruleChoiceKeyword;
+ dst.msgStartIndex = src.msgStartIndex;
+ dst.expressionStartIndex = src.expressionStartIndex;
+}
+
+function NestedParserState(parser) {
+ copyNestedParserState(parser, this);
+}
+
+/**
+ * @constructor
+ * @private
+ */
+function MessageFormatParser(text, startIndex, $parse, pluralCat, stringifier,
+ mustHaveExpression, trustedContext, allOrNothing) {
+ this.text = text;
+ this.index = startIndex || 0;
+ this.$parse = $parse;
+ this.pluralCat = pluralCat;
+ this.stringifier = stringifier;
+ this.mustHaveExpression = !!mustHaveExpression;
+ this.trustedContext = trustedContext;
+ this.allOrNothing = !!allOrNothing;
+ this.expressionFn = null;
+ this.expressionMinusOffsetFn = null;
+ this.pluralOffset = null;
+ this.choices = null;
+ this.choiceKey = null;
+ this.interpolationParts = null;
+ this.msgStartIndex = null;
+ this.nestedStateStack = [];
+ this.parsedFn = null;
+ this.rule = null;
+ this.ruleStack = null;
+ this.ruleChoiceKeyword = null;
+ this.interpNestLevel = null;
+ this.expressionStartIndex = null;
+ this.stringStartIndex = null;
+ this.stringQuote = null;
+ this.stringInterestsRe = null;
+ this.angularOperatorStack = null;
+ this.textPart = null;
+}
+
+// preserve v8 optimization.
+var EMPTY_STATE = new NestedParserState(new MessageFormatParser(
+ /* text= */ '', /* startIndex= */ 0, /* $parse= */ null, /* pluralCat= */ null, /* stringifier= */ null,
+ /* mustHaveExpression= */ false, /* trustedContext= */ null, /* allOrNothing */ false));
+
+MessageFormatParser.prototype.pushState = function pushState() {
+ this.nestedStateStack.push(new NestedParserState(this));
+ copyNestedParserState(EMPTY_STATE, this);
+};
+
+MessageFormatParser.prototype.popState = function popState() {
+ if (this.nestedStateStack.length === 0) {
+ this.errorInParseLogic();
+ }
+ var previousState = this.nestedStateStack.pop();
+ copyNestedParserState(previousState, this);
+};
+
+// Oh my JavaScript! Who knew you couldn't match a regex at a specific
+// location in a string but will always search forward?!
+// Apparently you'll be growing this ability via the sticky flag (y) in
+// ES6. I'll just to work around you for now.
+MessageFormatParser.prototype.matchRe = function matchRe(re, search) {
+ re.lastIndex = this.index;
+ var match = re.exec(this.text);
+ if (match != null && (search === true || (match.index == this.index))) {
+ this.index = re.lastIndex;
+ return match;
+ }
+ return null;
+};
+
+MessageFormatParser.prototype.searchRe = function searchRe(re) {
+ return this.matchRe(re, true);
+};
+
+
+MessageFormatParser.prototype.consumeRe = function consumeRe(re) {
+ // Without the sticky flag, we can't use the .test() method to consume a
+ // match at the current index. Instead, we'll use the slower .exec() method
+ // and verify match.index.
+ return !!this.matchRe(re);
+};
+
+// Run through our grammar avoiding deeply nested function call chains.
+MessageFormatParser.prototype.run = function run(initialRule) {
+ this.ruleStack = [initialRule];
+ do {
+ this.rule = this.ruleStack.pop();
+ while (this.rule) {
+ this.rule();
+ }
+ this.assertRuleOrNull(this.rule);
+ } while (this.ruleStack.length > 0);
+};
+
+MessageFormatParser.prototype.errorInParseLogic = function errorInParseLogic() {
+ throw $interpolateMinErr('logicbug',
+ 'The messageformat parser has encountered an internal error. Please file a github issue against the AngularJS project and provide this message text that triggers the bug. Text: “{0}â€',
+ this.text);
+};
+
+MessageFormatParser.prototype.assertRuleOrNull = function assertRuleOrNull(rule) {
+ if (rule === void 0) {
+ this.errorInParseLogic();
+ }
+};
+
+var NEXT_WORD_RE = /\s*(\w+)\s*/g;
+MessageFormatParser.prototype.errorExpecting = function errorExpecting() {
+ // What was wrong with the syntax? Unsupported type, missing comma, or something else?
+ var match = this.matchRe(NEXT_WORD_RE), position;
+ if (match == null) {
+ position = indexToLineAndColumn(this.text, this.index);
+ throw $interpolateMinErr('reqarg',
+ 'Expected one of “plural†or “select†at line {0}, column {1} of text “{2}â€',
+ position.line, position.column, this.text);
+ }
+ var word = match[1];
+ if (word == "select" || word == "plural") {
+ position = indexToLineAndColumn(this.text, this.index);
+ throw $interpolateMinErr('reqcomma',
+ 'Expected a comma after the keyword “{0}†at line {1}, column {2} of text “{3}â€',
+ word, position.line, position.column, this.text);
+ } else {
+ position = indexToLineAndColumn(this.text, this.index);
+ throw $interpolateMinErr('unknarg',
+ 'Unsupported keyword “{0}†at line {0}, column {1}. Only “plural†and “select†are currently supported. Text: “{3}â€',
+ word, position.line, position.column, this.text);
+ }
+};
+
+var STRING_START_RE = /['"]/g;
+MessageFormatParser.prototype.ruleString = function ruleString() {
+ var match = this.matchRe(STRING_START_RE);
+ if (match == null) {
+ var position = indexToLineAndColumn(this.text, this.index);
+ throw $interpolateMinErr('wantstring',
+ 'Expected the beginning of a string at line {0}, column {1} in text “{2}â€',
+ position.line, position.column, this.text);
+ }
+ this.startStringAtMatch(match);
+};
+
+MessageFormatParser.prototype.startStringAtMatch = function startStringAtMatch(match) {
+ this.stringStartIndex = match.index;
+ this.stringQuote = match[0];
+ this.stringInterestsRe = this.stringQuote == "'" ? SQUOTED_STRING_INTEREST_RE : DQUOTED_STRING_INTEREST_RE;
+ this.rule = this.ruleInsideString;
+};
+
+var SQUOTED_STRING_INTEREST_RE = /\\(?:\\|'|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{2}|[0-7]{3}|\r\n|\n|[\s\S])|'/g;
+var DQUOTED_STRING_INTEREST_RE = /\\(?:\\|"|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{2}|[0-7]{3}|\r\n|\n|[\s\S])|"/g;
+MessageFormatParser.prototype.ruleInsideString = function ruleInsideString() {
+ var match = this.searchRe(this.stringInterestsRe);
+ if (match == null) {
+ var position = indexToLineAndColumn(this.text, this.stringStartIndex);
+ throw $interpolateMinErr('untermstr',
+ 'The string beginning at line {0}, column {1} is unterminated in text “{2}â€',
+ position.line, position.column, this.text);
+ }
+ var chars = match[0];
+ if (match == this.stringQuote) {
+ this.rule = null;
+ }
+};
+
+var PLURAL_OR_SELECT_ARG_TYPE_RE = /\s*(plural|select)\s*,\s*/g;
+MessageFormatParser.prototype.rulePluralOrSelect = function rulePluralOrSelect() {
+ var match = this.searchRe(PLURAL_OR_SELECT_ARG_TYPE_RE);
+ if (match == null) {
+ this.errorExpecting();
+ }
+ var argType = match[1];
+ switch (argType) {
+ case "plural": this.rule = this.rulePluralStyle; break;
+ case "select": this.rule = this.ruleSelectStyle; break;
+ default: this.errorInParseLogic();
+ }
+};
+
+MessageFormatParser.prototype.rulePluralStyle = function rulePluralStyle() {
+ this.choices = Object.create(null);
+ this.ruleChoiceKeyword = this.rulePluralValueOrKeyword;
+ this.rule = this.rulePluralOffset;
+};
+
+MessageFormatParser.prototype.ruleSelectStyle = function ruleSelectStyle() {
+ this.choices = Object.create(null);
+ this.ruleChoiceKeyword = this.ruleSelectKeyword;
+ this.rule = this.ruleSelectKeyword;
+};
+
+var NUMBER_RE = /[0]|(?:[1-9][0-9]*)/g;
+var PLURAL_OFFSET_RE = new RegExp("\\s*offset\\s*:\\s*(" + NUMBER_RE.source + ")", "g");
+
+MessageFormatParser.prototype.rulePluralOffset = function rulePluralOffset() {
+ var match = this.matchRe(PLURAL_OFFSET_RE);
+ this.pluralOffset = (match == null) ? 0 : parseInt(match[1], 10);
+ this.expressionMinusOffsetFn = subtractOffset(this.expressionFn, this.pluralOffset);
+ this.rule = this.rulePluralValueOrKeyword;
+};
+
+MessageFormatParser.prototype.assertChoiceKeyIsNew = function assertChoiceKeyIsNew(choiceKey, index) {
+ if (this.choices[choiceKey] !== void 0) {
+ var position = indexToLineAndColumn(this.text, index);
+ throw $interpolateMinErr('dupvalue',
+ 'The choice “{0}†is specified more than once. Duplicate key is at line {1}, column {2} in text “{3}â€',
+ choiceKey, position.line, position.column, this.text);
+ }
+};
+
+var SELECT_KEYWORD = /\s*(\w+)/g;
+MessageFormatParser.prototype.ruleSelectKeyword = function ruleSelectKeyword() {
+ var match = this.matchRe(SELECT_KEYWORD);
+ if (match == null) {
+ this.parsedFn = new SelectMessage(this.expressionFn, this.choices).parsedFn;
+ this.rule = null;
+ return;
+ }
+ this.choiceKey = match[1];
+ this.assertChoiceKeyIsNew(this.choiceKey, match.index);
+ this.rule = this.ruleMessageText;
+};
+
+var EXPLICIT_VALUE_OR_KEYWORD_RE = new RegExp("\\s*(?:(?:=(" + NUMBER_RE.source + "))|(\\w+))", "g");
+MessageFormatParser.prototype.rulePluralValueOrKeyword = function rulePluralValueOrKeyword() {
+ var match = this.matchRe(EXPLICIT_VALUE_OR_KEYWORD_RE);
+ if (match == null) {
+ this.parsedFn = new PluralMessage(this.expressionFn, this.choices, this.pluralOffset, this.pluralCat).parsedFn;
+ this.rule = null;
+ return;
+ }
+ if (match[1] != null) {
+ this.choiceKey = parseInt(match[1], 10);
+ } else {
+ this.choiceKey = match[2];
+ }
+ this.assertChoiceKeyIsNew(this.choiceKey, match.index);
+ this.rule = this.ruleMessageText;
+};
+
+var BRACE_OPEN_RE = /\s*{/g;
+var BRACE_CLOSE_RE = /}/g;
+MessageFormatParser.prototype.ruleMessageText = function ruleMessageText() {
+ if (!this.consumeRe(BRACE_OPEN_RE)) {
+ var position = indexToLineAndColumn(this.text, this.index);
+ throw $interpolateMinErr('reqopenbrace',
+ 'The plural choice “{0}†must be followed by a message in braces at line {1}, column {2} in text “{3}â€',
+ this.choiceKey, position.line, position.column, this.text);
+ }
+ this.msgStartIndex = this.index;
+ this.interpolationParts = new InterpolationParts(this.trustedContext, this.allOrNothing);
+ this.rule = this.ruleInInterpolationOrMessageText;
+};
+
+// Note: Since "\" is used as an escape character, don't allow it to be part of the
+// startSymbol/endSymbol when I add the feature to allow them to be redefined.
+var INTERP_OR_END_MESSAGE_RE = /\\.|{{|}/g;
+var INTERP_OR_PLURALVALUE_OR_END_MESSAGE_RE = /\\.|{{|#|}/g;
+var ESCAPE_OR_MUSTACHE_BEGIN_RE = /\\.|{{/g;
+MessageFormatParser.prototype.advanceInInterpolationOrMessageText = function advanceInInterpolationOrMessageText() {
+ var currentIndex = this.index, match, re;
+ if (this.ruleChoiceKeyword == null) { // interpolation
+ match = this.searchRe(ESCAPE_OR_MUSTACHE_BEGIN_RE);
+ if (match == null) { // End of interpolation text. Nothing more to process.
+ this.textPart = this.text.substring(currentIndex);
+ this.index = this.text.length;
+ return null;
+ }
+ } else {
+ match = this.searchRe(this.ruleChoiceKeyword == this.rulePluralValueOrKeyword ?
+ INTERP_OR_PLURALVALUE_OR_END_MESSAGE_RE : INTERP_OR_END_MESSAGE_RE);
+ if (match == null) {
+ var position = indexToLineAndColumn(this.text, this.msgStartIndex);
+ throw $interpolateMinErr('reqendbrace',
+ 'The plural/select choice “{0}†message starting at line {1}, column {2} does not have an ending closing brace. Text “{3}â€',
+ this.choiceKey, position.line, position.column, this.text);
+ }
+ }
+ // match is non-null.
+ var token = match[0];
+ this.textPart = this.text.substring(currentIndex, match.index);
+ return token;
+};
+
+MessageFormatParser.prototype.ruleInInterpolationOrMessageText = function ruleInInterpolationOrMessageText() {
+ var currentIndex = this.index;
+ var token = this.advanceInInterpolationOrMessageText();
+ if (token == null) {
+ // End of interpolation text. Nothing more to process.
+ this.index = this.text.length;
+ this.interpolationParts.addText(this.text.substring(currentIndex));
+ this.rule = null;
+ return;
+ }
+ if (token[0] == "\\") {
+ // unescape next character and continue
+ this.interpolationParts.addText(this.textPart + token[1]);
+ return;
+ }
+ this.interpolationParts.addText(this.textPart);
+ if (token == "{{") {
+ this.pushState();
+ this.ruleStack.push(this.ruleEndMustacheInInterpolationOrMessage);
+ this.rule = this.ruleEnteredMustache;
+ } else if (token == "}") {
+ this.choices[this.choiceKey] = this.interpolationParts.toParsedFn(/*mustHaveExpression=*/false, this.text);
+ this.rule = this.ruleChoiceKeyword;
+ } else if (token == "#") {
+ this.interpolationParts.addExpressionFn(this.expressionMinusOffsetFn);
+ } else {
+ this.errorInParseLogic();
+ }
+};
+
+MessageFormatParser.prototype.ruleInterpolate = function ruleInterpolate() {
+ this.interpolationParts = new InterpolationParts(this.trustedContext, this.allOrNothing);
+ this.rule = this.ruleInInterpolation;
+};
+
+MessageFormatParser.prototype.ruleInInterpolation = function ruleInInterpolation() {
+ var currentIndex = this.index;
+ var match = this.searchRe(ESCAPE_OR_MUSTACHE_BEGIN_RE);
+ if (match == null) {
+ // End of interpolation text. Nothing more to process.
+ this.index = this.text.length;
+ this.interpolationParts.addText(this.text.substring(currentIndex));
+ this.parsedFn = this.interpolationParts.toParsedFn(this.mustHaveExpression, this.text);
+ this.rule = null;
+ return;
+ }
+ var token = match[0];
+ if (token[0] == "\\") {
+ // unescape next character and continue
+ this.interpolationParts.addText(this.text.substring(currentIndex, match.index) + token[1]);
+ return;
+ }
+ this.interpolationParts.addText(this.text.substring(currentIndex, match.index));
+ this.pushState();
+ this.ruleStack.push(this.ruleInterpolationEndMustache);
+ this.rule = this.ruleEnteredMustache;
+};
+
+MessageFormatParser.prototype.ruleInterpolationEndMustache = function ruleInterpolationEndMustache() {
+ var expressionFn = this.parsedFn;
+ this.popState();
+ this.interpolationParts.addExpressionFn(expressionFn);
+ this.rule = this.ruleInInterpolation;
+};
+
+MessageFormatParser.prototype.ruleEnteredMustache = function ruleEnteredMustache() {
+ this.parsedFn = null;
+ this.ruleStack.push(this.ruleEndMustache);
+ this.rule = this.ruleAngularExpression;
+};
+
+MessageFormatParser.prototype.ruleEndMustacheInInterpolationOrMessage = function ruleEndMustacheInInterpolationOrMessage() {
+ var expressionFn = this.parsedFn;
+ this.popState();
+ this.interpolationParts.addExpressionFn(expressionFn);
+ this.rule = this.ruleInInterpolationOrMessageText;
+};
+
+
+
+var INTERP_END_RE = /\s*}}/g;
+MessageFormatParser.prototype.ruleEndMustache = function ruleEndMustache() {
+ var match = this.matchRe(INTERP_END_RE);
+ if (match == null) {
+ var position = indexToLineAndColumn(this.text, this.index);
+ throw $interpolateMinErr('reqendinterp',
+ 'Expecting end of interpolation symbol, “{0}â€, at line {1}, column {2} in text “{3}â€',
+ '}}', position.line, position.column, this.text);
+ }
+ if (this.parsedFn == null) {
+ // If we parsed a MessageFormat extension, (e.g. select/plural today, maybe more some other
+ // day), then the result *has* to be a string and those rules would have already set
+ // this.parsedFn. If there was no MessageFormat extension, then there is no requirement to
+ // stringify the result and parsedFn isn't set. We set it here. While we could have set it
+ // unconditionally when exiting the Angular expression, I intend for us to not just replace
+ // $interpolate, but also to replace $parse in a future version (so ng-bind can work), and in
+ // such a case we do not want to unnecessarily stringify something if it's not going to be used
+ // in a string context.
+ this.parsedFn = this.$parse(this.expressionFn, this.stringifier);
+ this.parsedFn['exp'] = this.expressionFn['exp']; // Needed to pretend to be $interpolate for tests copied from interpolateSpec.js
+ this.parsedFn['expressions'] = this.expressionFn['expressions']; // Require this to call $compile.$$addBindingInfo() which allows Protractor to find elements by binding.
+ }
+ this.rule = null;
+};
+
+MessageFormatParser.prototype.ruleAngularExpression = function ruleAngularExpression() {
+ this.angularOperatorStack = [];
+ this.expressionStartIndex = this.index;
+ this.rule = this.ruleInAngularExpression;
+};
+
+function getEndOperator(opBegin) {
+ switch (opBegin) {
+ case "{": return "}";
+ case "[": return "]";
+ case "(": return ")";
+ default: return null;
+ }
+}
+
+function getBeginOperator(opEnd) {
+ switch (opEnd) {
+ case "}": return "{";
+ case "]": return "[";
+ case ")": return "(";
+ default: return null;
+ }
+}
+
+// TODO(chirayu): The interpolation endSymbol must also be accounted for. It
+// just so happens that "}" is an operator so it's in the list below. But we
+// should support any other type of start/end interpolation symbol.
+var INTERESTING_OPERATORS_RE = /[[\]{}()'",]/g;
+MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularExpression() {
+ var startIndex = this.index;
+ var match = this.searchRe(INTERESTING_OPERATORS_RE);
+ var position;
+ if (match == null) {
+ if (this.angularOperatorStack.length === 0) {
+ // This is the end of the Angular expression so this is actually a
+ // success. Note that when inside an interpolation, this means we even
+ // consumed the closing interpolation symbols if they were curlies. This
+ // is NOT an error at this point but will become an error further up the
+ // stack when the part that saw the opening curlies is unable to find the
+ // closing ones.
+ this.index = this.text.length;
+ this.expressionFn = this.$parse(this.text.substring(this.expressionStartIndex, this.index));
+ // Needed to pretend to be $interpolate for tests copied from interpolateSpec.js
+ this.expressionFn['exp'] = this.text.substring(this.expressionStartIndex, this.index);
+ this.expressionFn['expressions'] = this.expressionFn['expressions'];
+ this.rule = null;
+ return;
+ }
+ var innermostOperator = this.angularOperatorStack[0];
+ throw $interpolateMinErr('badexpr',
+ 'Unexpected end of Angular expression. Expecting operator “{0}†at the end of the text “{1}â€',
+ this.getEndOperator(innermostOperator), this.text);
+ }
+ var operator = match[0];
+ if (operator == "'" || operator == '"') {
+ this.ruleStack.push(this.ruleInAngularExpression);
+ this.startStringAtMatch(match);
+ return;
+ }
+ if (operator == ",") {
+ if (this.trustedContext) {
+ position = indexToLineAndColumn(this.text, this.index);
+ throw $interpolateMinErr('unsafe',
+ 'Use of select/plural MessageFormat syntax is currently disallowed in a secure context ({0}). At line {1}, column {2} of text “{3}â€',
+ this.trustedContext, position.line, position.column, this.text);
+ }
+ // only the top level comma has relevance.
+ if (this.angularOperatorStack.length === 0) {
+ // todo: does this need to be trimmed?
+ this.expressionFn = this.$parse(this.text.substring(this.expressionStartIndex, match.index));
+ // Needed to pretend to be $interpolate for tests copied from interpolateSpec.js
+ this.expressionFn['exp'] = this.text.substring(this.expressionStartIndex, match.index);
+ this.expressionFn['expressions'] = this.expressionFn['expressions'];
+ this.rule = null;
+ this.rule = this.rulePluralOrSelect;
+ }
+ return;
+ }
+ if (getEndOperator(operator) != null) {
+ this.angularOperatorStack.unshift(operator);
+ return;
+ }
+ var beginOperator = getBeginOperator(operator);
+ if (beginOperator == null) {
+ this.errorInParseLogic();
+ }
+ if (this.angularOperatorStack.length > 0) {
+ if (beginOperator == this.angularOperatorStack[0]) {
+ this.angularOperatorStack.shift();
+ return;
+ }
+ position = indexToLineAndColumn(this.text, this.index);
+ throw $interpolateMinErr('badexpr',
+ 'Unexpected operator “{0}†at line {1}, column {2} in text. Was expecting “{3}â€. Text: “{4}â€',
+ operator, position.line, position.column, getEndOperator(this.angularOperatorStack[0]), this.text);
+ }
+ // We are trying to pop off the operator stack but there really isn't anything to pop off.
+ this.index = match.index;
+ this.expressionFn = this.$parse(this.text.substring(this.expressionStartIndex, this.index));
+ // Needed to pretend to be $interpolate for tests copied from interpolateSpec.js
+ this.expressionFn['exp'] = this.text.substring(this.expressionStartIndex, this.index);
+ this.expressionFn['expressions'] = this.expressionFn['expressions'];
+ this.rule = null;
+};
+
+// NOTE: ADVANCED_OPTIMIZATIONS mode.
+//
+// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using
+// constructs incompatible with that mode.
+
+/* global $interpolateMinErr: false */
+/* global MessageFormatParser: false */
+/* global stringify: false */
+
+/**
+ * @ngdoc service
+ * @name $$messageFormat
+ *
+ * @description
+ * Angular internal service to recognize MessageFormat extensions in interpolation expressions.
+ * For more information, see:
+ * https://docs.google.com/a/google.com/document/d/1pbtW2yvtmFBikfRrJd8VAsabiFkKezmYZ_PbgdjQOVU/edit
+ *
+ * ## Example
+ *
+ * <example name="ngMessageFormat-example" module="msgFmtExample" deps="angular-message-format.min.js">
+ * <file name="index.html">
+ * <div ng-controller="AppController">
+ * <button ng-click="decreaseRecipients()" id="decreaseRecipients">decreaseRecipients</button><br>
+ * <span>{{recipients.length, plural, offset:1
+ * =0 {{{sender.name}} gave no gifts (\#=#)}
+ * =1 {{{sender.name}} gave one gift to {{recipients[0].name}} (\#=#)}
+ * one {{{sender.name}} gave {{recipients[0].name}} and one other person a gift (\#=#)}
+ * other {{{sender.name}} gave {{recipients[0].name}} and # other people a gift (\#=#)}
+ * }}</span>
+ * </div>
+ * </file>
+ *
+ * <file name="script.js">
+ * function Person(name, gender) {
+ * this.name = name;
+ * this.gender = gender;
+ * }
+ *
+ * var alice = new Person("Alice", "female"),
+ * bob = new Person("Bob", "male"),
+ * charlie = new Person("Charlie", "male"),
+ * harry = new Person("Harry Potter", "male");
+ *
+ * angular.module('msgFmtExample', ['ngMessageFormat'])
+ * .controller('AppController', ['$scope', function($scope) {
+ * $scope.recipients = [alice, bob, charlie];
+ * $scope.sender = harry;
+ * $scope.decreaseRecipients = function() {
+ * --$scope.recipients.length;
+ * };
+ * }]);
+ * </file>
+ *
+ * <file name="protractor.js" type="protractor">
+ * describe('MessageFormat plural', function() {
+ * it('should pluralize initial values', function() {
+ * var messageElem = element(by.binding('recipients.length')), decreaseRecipientsBtn = element(by.id('decreaseRecipients'));
+ * expect(messageElem.getText()).toEqual('Harry Potter gave Alice and 2 other people a gift (#=2)');
+ * decreaseRecipientsBtn.click();
+ * expect(messageElem.getText()).toEqual('Harry Potter gave Alice and one other person a gift (#=1)');
+ * decreaseRecipientsBtn.click();
+ * expect(messageElem.getText()).toEqual('Harry Potter gave one gift to Alice (#=0)');
+ * decreaseRecipientsBtn.click();
+ * expect(messageElem.getText()).toEqual('Harry Potter gave no gifts (#=-1)');
+ * });
+ * });
+ * </file>
+ * </example>
+ */
+var $$MessageFormatFactory = ['$parse', '$locale', '$sce', '$exceptionHandler', function $$messageFormat(
+ $parse, $locale, $sce, $exceptionHandler) {
+
+ function getStringifier(trustedContext, allOrNothing, text) {
+ return function stringifier(value) {
+ try {
+ value = trustedContext ? $sce['getTrusted'](trustedContext, value) : $sce['valueOf'](value);
+ return allOrNothing && (value === void 0) ? value : stringify(value);
+ } catch (err) {
+ $exceptionHandler($interpolateMinErr['interr'](text, err));
+ }
+ };
+ }
+
+ function interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {
+ var stringifier = getStringifier(trustedContext, allOrNothing, text);
+ var parser = new MessageFormatParser(text, 0, $parse, $locale['pluralCat'], stringifier,
+ mustHaveExpression, trustedContext, allOrNothing);
+ parser.run(parser.ruleInterpolate);
+ return parser.parsedFn;
+ }
+
+ return {
+ 'interpolate': interpolate
+ };
+}];
+
+var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpolateDecorator($$messageFormat, $interpolate) {
+ if ($interpolate['startSymbol']() != "{{" || $interpolate['endSymbol']() != "}}") {
+ throw $interpolateMinErr('nochgmustache', 'angular-message-format.js currently does not allow you to use custom start and end symbols for interpolation.');
+ }
+ var interpolate = $$messageFormat['interpolate'];
+ interpolate['startSymbol'] = $interpolate['startSymbol'];
+ interpolate['endSymbol'] = $interpolate['endSymbol'];
+ return interpolate;
+}];
+
+
+/**
+ * @ngdoc module
+ * @name ngMessageFormat
+ * @packageName angular-message-format
+ * @description
+ */
+var module = window['angular']['module']('ngMessageFormat', ['ng']);
+module['factory']('$$messageFormat', $$MessageFormatFactory);
+module['config'](['$provide', function($provide) {
+ $provide['decorator']('$interpolate', $$interpolateDecorator);
+}]);
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.min.js
new file mode 100644
index 00000000..f85a5876
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.min.js
@@ -0,0 +1,26 @@
+/*
+ AngularJS v1.5.0
+ (c) 2010-2016 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(h){'use strict';function C(a){if(null==a)return"";switch(typeof a){case "string":return a;case "number":return""+a;default:return D(a)}}function f(a,b){for(var d=a.split(/\n/g),k=0;k<d.length;k++){var c=d[k];if(b>=c.length)b-=c.length;else return{h:k+1,f:b+1}}}function t(a){function b(){return a}var d=u[a];if(null!=d)return d;b.$$watchDelegate=function(b,d,c){var e=b.$watch(v,function(){m(d)&&d.call(null,a,a,b);e()},c);return e};u[a]=b;b.exp=a;b.expressions=[];return b}function F(a,b){function d(a){return void 0==
+a?a:a-b}function c(b){return d(a(b))}if(0===b)return a;var e;c.$$watchDelegate=function(b,c,k){return e=b.$watch(a,function(a,k){m(c)&&c.call(null,d(a),d(k),b)},k)};return c}function l(a,b){var d=this;this.b=a;this.e=b;if(void 0===b.other)throw e("reqother");this.d=function(a){return d.D(a)};this.d.$$watchDelegate=function(a,b,c){return d.P(a,b,c)};this.d.exp=a.exp;this.d.expressions=a.expressions}function n(a,b,d,c){var e=this;this.scope=b;this.oa=a;this.v=d;this.qa=c;this.U=void 0;this.K=v;this.ka=
+b.$watch(a.b,function(a){return e.ja(a)},c)}function p(a,b){l.call(this,a,b)}function w(){}function q(a,b,d,c){l.call(this,a,b);this.offset=d;this.M=c}function x(){}function g(a,b){this.u=a;this.B=b;this.i=[];this.g=[];this.J=[];this.s="";this.q=null}function r(a,b,d){this.c=a;this.scope=b;this.W=void 0;this.v=d;var c=this;this.la=b.$watchGroup(a.g,function(a,b){c.Ea(a,b)})}function s(a,b){b.b=a.b;b.C=a.C;b.w=a.w;b.e=a.e;b.k=a.k;b.c=a.c;b.n=a.n;b.F=a.F;b.l=a.l}function y(a){s(a,this)}function c(a,
+b,d,c,e,E,f,g){this.text=a;this.index=b||0;this.A=d;this.M=c;this.Da=e;this.pa=!!E;this.u=f;this.B=!!g;this.F=this.c=this.k=this.e=this.w=this.C=this.b=null;this.L=[];this.G=this.j=this.ca=this.O=this.da=this.l=this.n=this.o=this.a=this.d=null}function z(a){switch(a){case "{":return"}";case "[":return"]";case "(":return")";default:return null}}function G(a){switch(a){case "}":return"{";case "]":return"[";case ")":return"(";default:return null}}var e=h.angular.$interpolateMinErr,v=h.angular.noop,m=
+h.angular.isFunction,D=h.angular.toJson,u=Object.create(null);l.prototype.T=function(a){return this.e[this.R(a)]};l.prototype.D=function(a){return this.T(this.b(a))(a)};l.prototype.P=function(a,b,d){var c=new n(this,a,b,d);return function(){c.I()}};n.prototype.ja=function(a){var b=this;this.K();a=this.oa.T(a);this.K=this.scope.$watch(a,function(a,c){return b.na(a,c)},this.qa)};n.prototype.na=function(a,b){m(this.v)&&this.v.call(null,a,a===b?a:this.U,this.scope);this.U=a};n.prototype.I=function(){this.ka();
+this.K()};w.prototype=l.prototype;p.prototype=new w;p.prototype.R=function(a){return void 0!==this.e[a]?a:"other"};x.prototype=l.prototype;q.prototype=new x;q.prototype.R=function(a){if(isNaN(a))return"other";if(void 0!==this.e[a])return a;a=this.M(a-this.offset);return void 0!==this.e[a]?a:"other"};g.prototype.S=function(){this.s&&(null==this.q?this.i.push(this.s):(this.i.push(this.q.join("")),this.q=null),this.s="")};g.prototype.p=function(a){a.length&&(this.s?this.q?this.q.push(a):this.q=[this.s,
+a]:this.s=a)};g.prototype.H=function(a){this.S();this.J.push(this.i.length);this.g.push(a);this.i.push("")};g.prototype.ma=function(a){for(var b=Array(this.g.length),d=0;d<this.g.length;d++)b[d]=this.g[d](a);return b};g.prototype.D=function(a){for(var b=0;b<this.J.length;b++){var d=a[b];if(this.B&&void 0===d)return;this.i[this.J[b]]=d}return this.i.join("")};g.prototype.ea=function(a,b){var d=this;this.S();if(!a||0!==this.g.length){if(0===this.i.length)return t("");this.u&&1<this.i.length&&e.throwNoconcat(b);
+if(0===this.g.length)return 1!=this.i.length&&this.r(),t(this.i[0]);var c=function(a){return d.D(d.ma(a))};c.$$watchDelegate=function(a,b,c){return d.P(a,b,c)};c.exp=b;c.expressions=Array(this.g.length);for(var f=0;f<this.g.length;f++)c.expressions[f]=this.g[f].exp;return c}};g.prototype.P=function(a,b){var c=new r(this,a,b);return function(){c.I()}};r.prototype.Ea=function(a,b){var c=this.c.D(a);m(this.v)&&this.v.call(null,c,a===b?c:this.W,this.scope);this.W=c};r.prototype.I=function(){this.la()};
+var H=new y(new c("",0,null,null,null,!1,null,!1));c.prototype.pushState=function(){this.L.push(new y(this));s(H,this)};c.prototype.V=function(){0===this.L.length&&this.r();var a=this.L.pop();s(a,this)};c.prototype.m=function(a,b){a.lastIndex=this.index;var c=a.exec(this.text);return null==c||!0!==b&&c.index!=this.index?null:(this.index=a.lastIndex,c)};c.prototype.t=function(a){return this.m(a,!0)};c.prototype.ha=function(a){return!!this.m(a)};c.prototype.Ba=function(a){this.o=[a];do{for(this.a=this.o.pop();this.a;)this.a();
+this.ga(this.a)}while(0<this.o.length)};c.prototype.r=function(){throw e("logicbug",this.text);};c.prototype.ga=function(a){void 0===a&&this.r()};var I=/\s*(\w+)\s*/g;c.prototype.ia=function(){var a=this.m(I);if(null==a)throw a=f(this.text,this.index),e("reqarg",a.h,a.f,this.text);var b=a[1];if("select"==b||"plural"==b)throw a=f(this.text,this.index),e("reqcomma",b,a.h,a.f,this.text);a=f(this.text,this.index);throw e("unknarg",b,a.h,a.f,this.text);};c.prototype.Ca=function(a){this.da=a.index;this.O=
+a[0];this.ca="'"==this.O?J:K;this.a=this.ua};var J=/\\(?:\\|'|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{2}|[0-7]{3}|\r\n|\n|[\s\S])|'/g,K=/\\(?:\\|"|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{2}|[0-7]{3}|\r\n|\n|[\s\S])|"/g;c.prototype.ua=function(){var a=this.t(this.ca);if(null==a)throw a=f(this.text,this.da),e("untermstr",a.h,a.f,this.text);a==this.O&&(this.a=null)};var L=/\s*(plural|select)\s*,\s*/g;c.prototype.ya=function(){var a=this.t(L);null==a&&this.ia();switch(a[1]){case "plural":this.a=this.za;break;case "select":this.a=
+this.Aa;break;default:this.r()}};c.prototype.za=function(){this.e=Object.create(null);this.n=this.N;this.a=this.xa};c.prototype.Aa=function(){this.e=Object.create(null);this.a=this.n=this.ba};var A=/[0]|(?:[1-9][0-9]*)/g,M=new RegExp("\\s*offset\\s*:\\s*("+A.source+")","g");c.prototype.xa=function(){var a=this.m(M);this.w=null==a?0:parseInt(a[1],10);this.C=F(this.b,this.w);this.a=this.N};c.prototype.Q=function(a,b){if(void 0!==this.e[a]){var c=f(this.text,b);throw e("dupvalue",a,c.h,c.f,this.text);
+}};var N=/\s*(\w+)/g;c.prototype.ba=function(){var a=this.m(N);null==a?(this.d=(new p(this.b,this.e)).d,this.a=null):(this.k=a[1],this.Q(this.k,a.index),this.a=this.aa)};var O=new RegExp("\\s*(?:(?:=("+A.source+"))|(\\w+))","g");c.prototype.N=function(){var a=this.m(O);null==a?(this.d=(new q(this.b,this.e,this.w,this.M)).d,this.a=null):(this.k=null!=a[1]?parseInt(a[1],10):a[2],this.Q(this.k,a.index),this.a=this.aa)};var P=/\s*{/g;c.prototype.aa=function(){if(!this.ha(P)){var a=f(this.text,this.index);
+throw e("reqopenbrace",this.k,a.h,a.f,this.text);}this.F=this.index;this.c=new g(this.u,this.B);this.a=this.$};var Q=/\\.|{{|}/g,R=/\\.|{{|#|}/g,B=/\\.|{{/g;c.prototype.fa=function(){var a=this.index,b;if(null==this.n){if(b=this.t(B),null==b)return this.G=this.text.substring(a),this.index=this.text.length,null}else if(b=this.t(this.n==this.N?R:Q),null==b)throw a=f(this.text,this.F),e("reqendbrace",this.k,a.h,a.f,this.text);var c=b[0];this.G=this.text.substring(a,b.index);return c};c.prototype.$=function(){var a=
+this.index,b=this.fa();null==b?(this.index=this.text.length,this.c.p(this.text.substring(a)),this.a=null):"\\"==b[0]?this.c.p(this.G+b[1]):(this.c.p(this.G),"{{"==b?(this.pushState(),this.o.push(this.ta),this.a=this.X):"}"==b?(this.e[this.k]=this.c.ea(!1,this.text),this.a=this.n):"#"==b?this.c.H(this.C):this.r())};c.prototype.va=function(){this.c=new g(this.u,this.B);this.a=this.Z};c.prototype.Z=function(){var a=this.index,b=this.t(B);if(null==b)this.index=this.text.length,this.c.p(this.text.substring(a)),
+this.d=this.c.ea(this.pa,this.text),this.a=null;else{var c=b[0];"\\"==c[0]?this.c.p(this.text.substring(a,b.index)+c[1]):(this.c.p(this.text.substring(a,b.index)),this.pushState(),this.o.push(this.wa),this.a=this.X)}};c.prototype.wa=function(){var a=this.d;this.V();this.c.H(a);this.a=this.Z};c.prototype.X=function(){this.d=null;this.o.push(this.sa);this.a=this.ra};c.prototype.ta=function(){var a=this.d;this.V();this.c.H(a);this.a=this.$};var S=/\s*}}/g;c.prototype.sa=function(){if(null==this.m(S)){var a=
+f(this.text,this.index);throw e("reqendinterp","}}",a.h,a.f,this.text);}null==this.d&&(this.d=this.A(this.b,this.Da),this.d.exp=this.b.exp,this.d.expressions=this.b.expressions);this.a=null};c.prototype.ra=function(){this.j=[];this.l=this.index;this.a=this.Y};var T=/[[\]{}()'",]/g;c.prototype.Y=function(){var a=this.t(T);if(null==a){if(0===this.j.length){this.index=this.text.length;this.b=this.A(this.text.substring(this.l,this.index));this.b.exp=this.text.substring(this.l,this.index);this.b.expressions=
+this.b.expressions;this.a=null;return}throw e("badexpr",this.Ga(this.j[0]),this.text);}var b=a[0];if("'"==b||'"'==b)this.o.push(this.Y),this.Ca(a);else if(","==b){if(this.u)throw a=f(this.text,this.index),e("unsafe",this.u,a.h,a.f,this.text);0===this.j.length&&(this.b=this.A(this.text.substring(this.l,a.index)),this.b.exp=this.text.substring(this.l,a.index),this.b.expressions=this.b.expressions,this.a=null,this.a=this.ya)}else if(null!=z(b))this.j.unshift(b);else{var c=G(b);null==c&&this.r();if(0<
+this.j.length){if(c==this.j[0]){this.j.shift();return}a=f(this.text,this.index);throw e("badexpr",b,a.h,a.f,z(this.j[0]),this.text);}this.index=a.index;this.b=this.A(this.text.substring(this.l,this.index));this.b.exp=this.text.substring(this.l,this.index);this.b.expressions=this.b.expressions;this.a=null}};var U=["$$messageFormat","$delegate",function(a,b){if("{{"!=b.startSymbol()||"}}"!=b.endSymbol())throw e("nochgmustache");var c=a.interpolate;c.startSymbol=b.startSymbol;c.endSymbol=b.endSymbol;
+return c}];h=h.angular.module("ngMessageFormat",["ng"]);h.factory("$$messageFormat",["$parse","$locale","$sce","$exceptionHandler",function(a,b,d,f){function g(a,b,c){return function(g){try{return g=a?d.getTrusted(a,g):d.valueOf(g),b&&void 0===g?g:C(g)}catch(h){f(e.interr(c,h))}}}return{interpolate:function(d,e,f,h){d=new c(d,0,a,b.pluralCat,g(f,h,d),e,f,h);d.Ba(d.va);return d.d}}}]);h.config(["$provide",function(a){a.decorator("$interpolate",U)}])})(window,window.Fa);
+//# sourceMappingURL=angular-message-format.min.js.map
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.min.js.map
new file mode 100644
index 00000000..a6da634b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.min.js.map
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"angular-message-format.min.js",
+"lineCount":25,
+"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAA6B,CAatCC,QAASA,EAAS,CAACC,CAAD,CAAQ,CACxB,GAAa,IAAb,EAAIA,CAAJ,CAA0C,MAAO,EACjD,QAAQ,MAAOA,EAAf,EACE,KAAK,QAAL,CAAmB,MAAOA,EAC1B,MAAK,QAAL,CAAmB,MAAO,EAAP,CAAYA,CAC/B,SAAmB,MAAOC,EAAA,CAAOD,CAAP,CAH5B,CAFwB,CAW1BE,QAASA,EAAoB,CAACC,CAAD,CAAOC,CAAP,CAAc,CAEzC,IADA,IAAIC,EAAQF,CAAAG,MAAA,CAAW,KAAX,CAAZ,CACSC,EAAE,CAAX,CAAcA,CAAd,CAAkBF,CAAAG,OAAlB,CAAgCD,CAAA,EAAhC,CAAqC,CACnC,IAAIE,EAAKJ,CAAA,CAAME,CAAN,CACT,IAAIH,CAAJ,EAAaK,CAAAD,OAAb,CACEJ,CAAA,EAASK,CAAAD,OADX,KAGE,OAAO,CAAEC,EAAMF,CAANE,CAAU,CAAZ,CAAeC,EAAQN,CAARM,CAAgB,CAA/B,CAL0B,CAFI,CAa3CC,QAASA,EAAgB,CAACR,CAAD,CAAO,CAK9BS,QAASA,EAAQ,EAAU,CAAE,MAAOT,EAAT,CAJ3B,IAAIU,EAAWC,CAAA,CAA8BX,CAA9B,CACf,IAAgB,IAAhB,EAAIU,CAAJ,CACE,MAAOA,EAGTD,EAAA,gBAAA,CAA8B,QAAsB,CAACG,CAAD,CAAQC,CAAR,CAAkBC,CAAlB,CAAkC,CACpF,IAAIC,EAAUH,CAAA,OAAA,CAAgBI,CAAhB,CACVC,QAA2B,EAAG,CACxBC,CAAA,CAAWL,CAAX,CAAJ,EAA4BA,CAAAM,KAAA,CAAc,IAAd,CAAoBnB,CAApB,CAA0BA,CAA1B,CAAgCY,CAAhC,CAC5BG,EAAA,EAF4B,CADpB,CAKVD,CALU,CAMd,OAAOC,EAP6E,CAStFJ,EAAA,CAA8BX,CAA9B,CAAA,CAAsCS,CACtCA,EAAA,IAAA,CAAkBT,CAClBS,EAAA,YAAA,CAA0B,EAC1B,OAAOA,EAlBuB,CAqBhCW,QAASA,EAAc,CAACC,CAAD,CAAeC,CAAf,CAAuB,CAI5CC,QAASA,EAAW,CAAC1B,CAAD,CAAQ,CAC1B,MAAiB,KAAK,EAAf;AAACA,CAAD,CAAoBA,CAApB,CAA4BA,CAA5B,CAAoCyB,CADjB,CAG5Bb,QAASA,EAAQ,CAACe,CAAD,CAAU,CAAE,MAAOD,EAAA,CAAYF,CAAA,CAAaG,CAAb,CAAZ,CAAT,CAN3B,GAAe,CAAf,GAAIF,CAAJ,CACE,MAAOD,EAMT,KAAIN,CACJN,EAAA,gBAAA,CAA8B,QAAsB,CAACG,CAAD,CAAQC,CAAR,CAAkBC,CAAlB,CAAkC,CAMpF,MALAC,EAKA,CALUH,CAAA,OAAA,CAAgBS,CAAhB,CACNI,QAAsC,CAACC,CAAD,CAAWC,CAAX,CAAqB,CACrDT,CAAA,CAAWL,CAAX,CAAJ,EAA4BA,CAAAM,KAAA,CAAc,IAAd,CAAoBI,CAAA,CAAYG,CAAZ,CAApB,CAA2CH,CAAA,CAAYI,CAAZ,CAA3C,CAAkEf,CAAlE,CAD6B,CADrD,CAINE,CAJM,CAD0E,CAQtF,OAAOL,EAjBqC,CAiC9CmB,QAASA,EAAmB,CAACP,CAAD,CAAeQ,CAAf,CAAwB,CAClD,IAAIC,EAAO,IACX,KAAAT,EAAA,CAAoBA,CACpB,KAAAQ,EAAA,CAAeA,CACf,IAAyB,IAAK,EAA9B,GAAIA,CAAA,MAAJ,CACE,KAAME,EAAA,CAAmB,UAAnB,CAAN,CAEF,IAAAtB,EAAA,CAAgBuB,QAAQ,CAACR,CAAD,CAAU,CAAE,MAAOM,EAAAG,EAAA,CAAeT,CAAf,CAAT,CAClC,KAAAf,EAAA,gBAAA,CAAmC,QAAwB,CAACG,CAAD,CAAQC,CAAR,CAAkBC,CAAlB,CAAkC,CAC3F,MAAOgB,EAAAI,EAAA,CAAmBtB,CAAnB,CAA0BC,CAA1B,CAAoCC,CAApC,CADoF,CAG7F,KAAAL,EAAA,IAAA,CAAuBY,CAAA,IACvB,KAAAZ,EAAA,YAAA,CAA+BY,CAAA,YAZmB,CAgCpDc,QAASA,EAAuB,CAACC,CAAD,CAAcxB,CAAd,CAAqBC,CAArB,CAA+BC,CAA/B,CAA+C,CAC7E,IAAIgB,EAAO,IACX,KAAAlB,MAAA,CAAaA,CACb,KAAAwB,GAAA,CAAmBA,CACnB,KAAAvB,EAAA,CAAgBA,CAChB,KAAAC,GAAA,CAAsBA,CACtB,KAAAuB,EAAA,CAAmB,IAAK,EACxB,KAAAC,EAAA,CAAwBtB,CAExB,KAAAuB,GAAA;AAA2B3B,CAAA,OAAA,CAAgBwB,CAAAf,EAAhB,CADAmB,QAAQ,CAACd,CAAD,CAAqB,CAAE,MAAOI,EAAAU,GAAA,CAA0Bd,CAA1B,CAAT,CAC7B,CAAgEZ,CAAhE,CATkD,CAqC/E2B,QAASA,EAAa,CAACpB,CAAD,CAAeQ,CAAf,CAAwB,CAC5CD,CAAAT,KAAA,CAAyB,IAAzB,CAA+BE,CAA/B,CAA6CQ,CAA7C,CAD4C,CAI9Ca,QAASA,EAAkB,EAAG,EAa9BC,QAASA,EAAa,CAACtB,CAAD,CAAeQ,CAAf,CAAwBP,CAAxB,CAAgCsB,CAAhC,CAA2C,CAC/DhB,CAAAT,KAAA,CAAyB,IAAzB,CAA+BE,CAA/B,CAA6CQ,CAA7C,CACA,KAAAP,OAAA,CAAcA,CACd,KAAAsB,EAAA,CAAiBA,CAH8C,CAMjEC,QAASA,EAAkB,EAAG,EA4B9BC,QAASA,EAAkB,CAACC,CAAD,CAAiBC,CAAjB,CAA+B,CACxD,IAAAD,EAAA,CAAsBA,CACtB,KAAAC,EAAA,CAAoBA,CACpB,KAAAC,EAAA,CAAiB,EACjB,KAAAC,EAAA,CAAqB,EACrB,KAAAC,EAAA,CAAyB,EACzB,KAAAC,EAAA,CAAmB,EACnB,KAAAC,EAAA,CAAmB,IAPqC,CAgG1DC,QAASA,EAAyB,CAACC,CAAD,CAAqB3C,CAArB,CAA4BC,CAA5B,CAAsD,CACtF,IAAA0C,EAAA,CAA0BA,CAC1B,KAAA3C,MAAA,CAAaA,CACb,KAAA4C,EAAA,CAAuB,IAAK,EAC5B,KAAA3C,EAAA,CAAgBA,CAChB,KAAIiB,EAAO,IACX,KAAA2B,GAAA,CAA4B7C,CAAA,YAAA,CAAqB2C,CAAAL,EAArB,CAAuD,QAAQ,CAACQ,CAAD,CAAsBC,CAAtB,CAA2C,CACpI7B,CAAA8B,GAAA,CAAmBF,CAAnB,CAAwCC,CAAxC,CADoI,CAA1G,CAN0D,CAuCxFE,QAASA,EAAqB,CAACC,CAAD,CAAMC,CAAN,CAAW,CACvCA,CAAA1C,EAAA,CAAmByC,CAAAzC,EACnB0C,EAAAC,EAAA,CAA8BF,CAAAE,EAC9BD,EAAAE,EAAA,CAAmBH,CAAAG,EACnBF,EAAAlC,EAAA,CAAciC,CAAAjC,EACdkC,EAAAG,EAAA,CAAgBJ,CAAAI,EAChBH,EAAAR,EAAA,CAAyBO,CAAAP,EACzBQ,EAAAI,EAAA,CAAwBL,CAAAK,EACxBJ,EAAAK,EAAA,CAAoBN,CAAAM,EACpBL,EAAAM,EAAA,CAA2BP,CAAAO,EATY,CAYzCC,QAASA,EAAiB,CAACC,CAAD,CAAS,CACjCV,CAAA,CAAsBU,CAAtB,CAA8B,IAA9B,CADiC,CAQnCC,QAASA,EAAmB,CAACxE,CAAD;AAAOyE,CAAP,CAAmBC,CAAnB,CAA2B9B,CAA3B,CAAsC+B,CAAtC,CACCC,CADD,CACqB7B,CADrB,CACqCC,CADrC,CACmD,CAC7E,IAAAhD,KAAA,CAAYA,CACZ,KAAAC,MAAA,CAAawE,CAAb,EAA2B,CAC3B,KAAAC,EAAA,CAAcA,CACd,KAAA9B,EAAA,CAAiBA,CACjB,KAAA+B,GAAA,CAAmBA,CACnB,KAAAC,GAAA,CAA0B,CAAEA,CAAAA,CAC5B,KAAA7B,EAAA,CAAsBA,CACtB,KAAAC,EAAA,CAAoB,CAAEA,CAAAA,CAOtB,KAAAoB,EAAA,CADA,IAAAb,EACA,CAFA,IAAAW,EAEA,CAHA,IAAArC,EAGA,CAJA,IAAAoC,EAIA,CALA,IAAAD,EAKA,CANA,IAAA3C,EAMA,CANoB,IAOpB,KAAAwD,EAAA,CAAwB,EAWxB,KAAAC,EAAA,CADA,IAAAC,EACA,CAFA,IAAAC,GAEA,CAHA,IAAAC,EAGA,CAJA,IAAAC,GAIA,CALA,IAAAb,EAKA,CAPA,IAAAF,EAOA,CARA,IAAAgB,EAQA,CATA,IAAAC,EASA,CAVA,IAAA3E,EAUA,CAVgB,IAjB6D,CAmY/E4E,QAASA,EAAc,CAACC,CAAD,CAAU,CAC/B,OAAQA,CAAR,EACE,KAAK,GAAL,CAAU,MAAO,GACjB,MAAK,GAAL,CAAU,MAAO,GACjB,MAAK,GAAL,CAAU,MAAO,GACjB,SAAS,MAAO,KAJlB,CAD+B,CASjCC,QAASA,EAAgB,CAACC,CAAD,CAAQ,CAC/B,OAAQA,CAAR,EACE,KAAK,GAAL,CAAU,MAAO,GACjB,MAAK,GAAL,CAAU,MAAO,GACjB,MAAK,GAAL,CAAU,MAAO,GACjB,SAAS,MAAO,KAJlB,CAD+B,CApvBjC,IAAIzD,EAAqBpC,CAAA,QAAA,mBAAzB,CAEIqB,EAAOrB,CAAA,QAAA,KAFX,CAGIuB;AAAavB,CAAA,QAAA,WAHjB,CAIIG,EAASH,CAAA,QAAA,OAJb,CA4BIgB,EAAgC8E,MAAAC,OAAA,CAAc,IAAd,CAuEpC9D,EAAA+D,UAAAC,EAAA,CAA6CC,QAAqB,CAAChG,CAAD,CAAQ,CACxE,MAAO,KAAAgC,EAAA,CAAa,IAAAiE,EAAA,CAAqBjG,CAArB,CAAb,CADiE,CAI1E+B,EAAA+D,UAAA1D,EAAA,CAA0C8D,QAAkB,CAACvE,CAAD,CAAU,CACpE,MAAO,KAAAoE,EAAA,CAAkB,IAAAvE,EAAA,CAAkBG,CAAlB,CAAlB,CAAA,CAA8CA,CAA9C,CAD6D,CAItEI,EAAA+D,UAAAzD,EAAA,CAA8C8D,QAAsB,CAACpF,CAAD,CAAQC,CAAR,CAAkBC,CAAlB,CAAkC,CACpG,IAAImF,EAAW,IAAI9D,CAAJ,CAA4B,IAA5B,CAAkCvB,CAAlC,CAAyCC,CAAzC,CAAmDC,CAAnD,CACf,OAAO,SAAQ,EAAG,CAAEmF,CAAAC,EAAA,EAAF,CAFkF,CAqBtG/D,EAAAwD,UAAAnD,GAAA,CAAyD2D,QAA6B,CAACzE,CAAD,CAAqB,CACzG,IAAII,EAAO,IACX,KAAAQ,EAAA,EAEI8D,EAAAA,CAAY,IAAAhE,GAAAwD,EAAA,CAA8BlE,CAA9B,CAChB,KAAAY,EAAA,CAAwB,IAAA1B,MAAA,OAAA,CAAqBwF,CAArB,CAFAC,QAAQ,CAACC,CAAD,CAAaC,CAAb,CAAyB,CAAE,MAAOzE,EAAAuE,GAAA,CAAuBC,CAAvB,CAAmCC,CAAnC,CAAT,CAEjC,CAAmD,IAAAzF,GAAnD,CALiF,CAQ3GqB,EAAAwD,UAAAU,GAAA,CAAsDG,QAA0B,CAACF,CAAD,CAAaC,CAAb,CAAyB,CACnGrF,CAAA,CAAW,IAAAL,EAAX,CAAJ,EACE,IAAAA,EAAAM,KAAA,CAAmB,IAAnB,CAAyBmF,CAAzB,CAAqCA,CAAA,GAAeC,CAAf,CAA4BD,CAA5B,CAAyC,IAAAjE,EAA9E,CAAgG,IAAAzB,MAAhG,CAEF,KAAAyB,EAAA,CAAmBiE,CAJoF,CAOzGnE,EAAAwD,UAAAO,EAAA,CAAgDO,QAAoB,EAAG,CACrE,IAAAlE,GAAA,EACA;IAAAD,EAAA,EAFqE,CAevEI,EAAAiD,UAAA,CAA+B/D,CAAA+D,UAE/BlD,EAAAkD,UAAA,CAA0B,IAAIjD,CAC9BD,EAAAkD,UAAAG,EAAA,CAA0CY,QAA8B,CAAC7G,CAAD,CAAQ,CAC9E,MAAgC,KAAK,EAA9B,GAAC,IAAAgC,EAAA,CAAahC,CAAb,CAAD,CAAmCA,CAAnC,CAA2C,OAD4B,CAgBhFgD,EAAA8C,UAAA,CAA+B/D,CAAA+D,UAE/BhD,EAAAgD,UAAA,CAA0B,IAAI9C,CAC9BF,EAAAgD,UAAAG,EAAA,CAA0Ca,QAA8B,CAAC9G,CAAD,CAAQ,CAC9E,GAAI+G,KAAA,CAAM/G,CAAN,CAAJ,CACE,MAAO,OACF,IAA4B,IAAK,EAAjC,GAAI,IAAAgC,EAAA,CAAahC,CAAb,CAAJ,CACL,MAAOA,EAEHgH,EAAAA,CAAW,IAAAjE,EAAA,CAAe/C,CAAf,CAAuB,IAAAyB,OAAvB,CACf,OAAmC,KAAK,EAAjC,GAAC,IAAAO,EAAA,CAAagF,CAAb,CAAD,CAAsCA,CAAtC,CAAiD,OAPoB,CAkChF/D,EAAA6C,UAAAmB,EAAA,CAAgDC,QAAyB,EAAG,CACtE,IAAA3D,EAAJ,GAC0B,IAAxB,EAAI,IAAAC,EAAJ,CACE,IAAAJ,EAAA+D,KAAA,CAAoB,IAAA5D,EAApB,CADF,EAGE,IAAAH,EAAA+D,KAAA,CAAoB,IAAA3D,EAAA4D,KAAA,CAAsB,EAAtB,CAApB,CACA,CAAA,IAAA5D,EAAA,CAAmB,IAJrB,CAMA,CAAA,IAAAD,EAAA,CAAmB,EAPrB,CAD0E,CAY5EN,EAAA6C,UAAAuB,EAAA,CAAuCC,QAAgB,CAACnH,CAAD,CAAO,CACxDA,CAAAK,OAAJ,GACO,IAAA+C,EAAL,CAEW,IAAAC,EAAJ,CACL,IAAAA,EAAA2D,KAAA,CAAsBhH,CAAtB,CADK,CAGL,IAAAqD,EAHK,CAGc,CAAC,IAAAD,EAAD;AAAmBpD,CAAnB,CALrB,CACE,IAAAoD,EADF,CACqBpD,CAFvB,CAD4D,CAY9D8C,EAAA6C,UAAAyB,EAAA,CAA+CC,QAAwB,CAAChG,CAAD,CAAe,CACpF,IAAAyF,EAAA,EACA,KAAA3D,EAAA6D,KAAA,CAA4B,IAAA/D,EAAA5C,OAA5B,CACA,KAAA6C,EAAA8D,KAAA,CAAwB3F,CAAxB,CACA,KAAA4B,EAAA+D,KAAA,CAAoB,EAApB,CAJoF,CAOtFlE,EAAA6C,UAAA2B,GAAA,CAAmDC,QAA4B,CAAC/F,CAAD,CAAU,CAEvF,IADA,IAAIgG,EAAuBC,KAAJ,CAAU,IAAAvE,EAAA7C,OAAV,CAAvB,CACSD,EAAI,CAAb,CAAgBA,CAAhB,CAAoB,IAAA8C,EAAA7C,OAApB,CAA+CD,CAAA,EAA/C,CACEoH,CAAA,CAAiBpH,CAAjB,CAAA,CAAsB,IAAA8C,EAAA,CAAmB9C,CAAnB,CAAA,CAAsBoB,CAAtB,CAExB,OAAOgG,EALgF,CAQzF1E,EAAA6C,UAAA1D,EAAA,CAAyCyF,QAAkB,CAACF,CAAD,CAAmB,CAC5E,IAAS,IAAApH,EAAI,CAAb,CAAgBA,CAAhB,CAAoB,IAAA+C,EAAA9C,OAApB,CAAmDD,CAAA,EAAnD,CAAwD,CACtD,IAAIuH,EAAkBH,CAAA,CAAiBpH,CAAjB,CACtB,IAAI,IAAA4C,EAAJ,EAA6C,IAAK,EAAlD,GAAyB2E,CAAzB,CAAqD,MACrD,KAAA1E,EAAA,CAAe,IAAAE,EAAA,CAAuB/C,CAAvB,CAAf,CAAA,CAA4CuH,CAHU,CAKxD,MAAO,KAAA1E,EAAAgE,KAAA,CAAoB,EAApB,CANqE,CAU9EnE,EAAA6C,UAAAiC,GAAA,CAA0CC,QAAmB,CAACjD,CAAD,CAAqBkD,CAArB,CAAmC,CAC9F,IAAIhG,EAAO,IACX,KAAAgF,EAAA,EACA,IAAIlC,CAAAA,CAAJ,EAAwD,CAAxD,GAA0B,IAAA1B,EAAA7C,OAA1B,CAAA,CAGA,GAA8B,CAA9B,GAAI,IAAA4C,EAAA5C,OAAJ,CACE,MAAOG,EAAA,CAAiB,EAAjB,CAEL,KAAAuC,EAAJ,EAAmD,CAAnD,CAA2B,IAAAE,EAAA5C,OAA3B,EACE0B,CAAA,cAAA,CAAoC+F,CAApC,CAEF;GAAkC,CAAlC,GAAI,IAAA5E,EAAA7C,OAAJ,CAEE,MAD6B,EACtB,EADH,IAAA4C,EAAA5C,OACG,EAD2B,IAAA0H,EAAA,EAC3B,CAAAvH,CAAA,CAAiB,IAAAyC,EAAA,CAAe,CAAf,CAAjB,CAET,KAAIxC,EAAWA,QAAQ,CAACe,CAAD,CAAU,CAC/B,MAAOM,EAAAG,EAAA,CAAeH,CAAAwF,GAAA,CAAyB9F,CAAzB,CAAf,CADwB,CAGjCf,EAAA,gBAAA,CAA8B,QAAwB,CAACG,CAAD,CAAQC,CAAR,CAAkBC,CAAlB,CAAkC,CACtF,MAAOgB,EAAAI,EAAA,CAAmBtB,CAAnB,CAA0BC,CAA1B,CAAoCC,CAApC,CAD+E,CAIxFL,EAAA,IAAA,CAAkBqH,CAClBrH,EAAA,YAAA,CAA8BgH,KAAJ,CAAU,IAAAvE,EAAA7C,OAAV,CAC1B,KAAS,IAAAD,EAAI,CAAb,CAAgBA,CAAhB,CAAoB,IAAA8C,EAAA7C,OAApB,CAA+CD,CAAA,EAA/C,CACEK,CAAA,YAAA,CAAwBL,CAAxB,CAAA,CAA6B,IAAA8C,EAAA,CAAmB9C,CAAnB,CAAA,IAG/B,OAAOK,EA1BP,CAH8F,CAgChGqC,EAAA6C,UAAAzD,EAAA,CAA6C8F,QAAsB,CAACpH,CAAD,CAAQC,CAAR,CAAkC,CACnG,IAAIoH,EAAU,IAAI3E,CAAJ,CAA8B,IAA9B,CAAoC1C,CAApC,CAA2CC,CAA3C,CACd,OAAO,SAAQ,EAAG,CAAEoH,CAAA/B,EAAA,EAAF,CAFiF,CAgBrG5C,EAAAqC,UAAA/B,GAAA,CAAoDsE,QAAsB,CAACxE,CAAD,CAAsBC,CAAtB,CAA2C,CACnH,IAAIwE,EAAS,IAAA5E,EAAAtB,EAAA,CAAkCyB,CAAlC,CACTxC,EAAA,CAAW,IAAAL,EAAX,CAAJ,EACE,IAAAA,EAAAM,KAAA,CAAmB,IAAnB,CAAyBgH,CAAzB,CAAiCzE,CAAA,GAAwBC,CAAxB,CAA8CwE,CAA9C,CAAuD,IAAA3E,EAAxF,CAA6G,IAAA5C,MAA7G,CAEF,KAAA4C,EAAA,CAAsB2E,CAL6F,CAQrH7E,EAAAqC,UAAAO,EAAA,CAAkDkC,QAAoB,EAAG,CACvE,IAAA3E,GAAA,EADuE,CAwEzE;IAAI4E,EAAc,IAAI/D,CAAJ,CAAsB,IAAIE,CAAJ,CACpB,EADoB,CACE,CADF,CACmB,IADnB,CAC0C,IAD1C,CACmE,IADnE,CAEN,CAAA,CAFM,CAEuB,IAFvB,CAEgD,CAAA,CAFhD,CAAtB,CAIlBA,EAAAmB,UAAA2C,UAAA,CAA0CC,QAAkB,EAAG,CAC7D,IAAA1D,EAAAmC,KAAA,CAA2B,IAAI1C,CAAJ,CAAsB,IAAtB,CAA3B,CACAT,EAAA,CAAsBwE,CAAtB,CAAmC,IAAnC,CAF6D,CAK/D7D,EAAAmB,UAAA6C,EAAA,CAAyCC,QAAiB,EAAG,CACtB,CAArC,GAAI,IAAA5D,EAAAxE,OAAJ,EACE,IAAA0H,EAAA,EAEF,KAAIW,EAAgB,IAAA7D,EAAA8D,IAAA,EACpB9E,EAAA,CAAsB6E,CAAtB,CAAqC,IAArC,CAL2D,CAY7DlE,EAAAmB,UAAAiD,EAAA,CAAwCC,QAAgB,CAACC,CAAD,CAAKC,CAAL,CAAa,CACnED,CAAAE,UAAA,CAAe,IAAA/I,MACf,KAAIgJ,EAAQH,CAAAI,KAAA,CAAQ,IAAAlJ,KAAR,CACZ,OAAa,KAAb,EAAIiJ,CAAJ,EAAiC,CAAA,CAAjC,GAAsBF,CAAtB,EAA0CE,CAAAhJ,MAA1C,EAAyD,IAAAA,MAAzD,CAIO,IAJP,EACE,IAAAA,MACOgJ,CADMH,CAAAE,UACNC,CAAAA,CAFT,CAHmE,CAUrEzE,EAAAmB,UAAAwD,EAAA,CAAyCC,QAAiB,CAACN,CAAD,CAAK,CAC7D,MAAO,KAAAF,EAAA,CAAaE,CAAb,CAAiB,CAAA,CAAjB,CADsD,CAK/DtE,EAAAmB,UAAA0D,GAAA,CAA0CC,QAAkB,CAACR,CAAD,CAAK,CAI/D,MAAO,CAAE,CAAA,IAAAF,EAAA,CAAaE,CAAb,CAJsD,CAQjEtE,EAAAmB,UAAA4D,GAAA,CAAoCC,QAAY,CAACC,CAAD,CAAc,CAC5D,IAAAtE,EAAA,CAAiB,CAACsE,CAAD,CACjB,GAAG,CAED,IADA,IAAArE,EACA,CADY,IAAAD,EAAAwD,IAAA,EACZ,CAAO,IAAAvD,EAAP,CAAA,CACE,IAAAA,EAAA,EAEF;IAAAsE,GAAA,CAAsB,IAAAtE,EAAtB,CALC,CAAH,MAMiC,CANjC,CAMS,IAAAD,EAAA9E,OANT,CAF4D,CAW9DmE,EAAAmB,UAAAoC,EAAA,CAAkD4B,QAA0B,EAAG,CAC3E,KAAM5H,EAAA,CAAmB,UAAnB,CAEF,IAAA/B,KAFE,CAAN,CAD2E,CAM/EwE,EAAAmB,UAAA+D,GAAA,CAAiDE,QAAyB,CAACxE,CAAD,CAAO,CAClE,IAAK,EAAlB,GAAIA,CAAJ,EACE,IAAA2C,EAAA,EAF6E,CAMjF,KAAI8B,EAAe,cACnBrF,EAAAmB,UAAAmE,GAAA,CAA+CC,QAAuB,EAAG,CAAA,IAEnEd,EAAQ,IAAAL,EAAA,CAAaiB,CAAb,CACZ,IAAa,IAAb,EAAIZ,CAAJ,CAEE,KADAe,EACM,CADKjK,CAAA,CAAqB,IAAAC,KAArB,CAAgC,IAAAC,MAAhC,CACL,CAAA8B,CAAA,CAAmB,QAAnB,CAEFiI,CAAA1J,EAFE,CAEa0J,CAAAzJ,EAFb,CAE8B,IAAAP,KAF9B,CAAN,CAIF,IAAIiK,EAAOhB,CAAA,CAAM,CAAN,CACX,IAAY,QAAZ,EAAIgB,CAAJ,EAAgC,QAAhC,EAAwBA,CAAxB,CAEE,KADAD,EACM,CADKjK,CAAA,CAAqB,IAAAC,KAArB,CAAgC,IAAAC,MAAhC,CACL,CAAA8B,CAAA,CAAmB,UAAnB,CAEFkI,CAFE,CAEID,CAAA1J,EAFJ,CAEmB0J,CAAAzJ,EAFnB,CAEoC,IAAAP,KAFpC,CAAN,CAIAgK,CAAA,CAAWjK,CAAA,CAAqB,IAAAC,KAArB,CAAgC,IAAAC,MAAhC,CACX,MAAM8B,EAAA,CAAmB,SAAnB,CAEFkI,CAFE,CAEID,CAAA1J,EAFJ,CAEmB0J,CAAAzJ,EAFnB,CAEoC,IAAAP,KAFpC,CAAN,CAjBqE,CAmCzEwE,EAAAmB,UAAAuE,GAAA,CAAmDC,QAA2B,CAAClB,CAAD,CAAQ,CACpF,IAAA/D,GAAA,CAAwB+D,CAAAhJ,MACxB,KAAAgF,EAAA;AAAmBgE,CAAA,CAAM,CAAN,CACnB,KAAAjE,GAAA,CAA6C,GAApB,EAAA,IAAAC,EAAA,CAA0BmF,CAA1B,CAAuDC,CAChF,KAAAjF,EAAA,CAAY,IAAAkF,GAJwE,CAOtF,KAAIF,EAA6B,uEAAjC,CACIC,EAA6B,uEACjC7F,EAAAmB,UAAA2E,GAAA,CAAiDC,QAAyB,EAAG,CAC3E,IAAItB,EAAQ,IAAAE,EAAA,CAAc,IAAAnE,GAAd,CACZ,IAAa,IAAb,EAAIiE,CAAJ,CAEE,KADIe,EACE,CADSjK,CAAA,CAAqB,IAAAC,KAArB,CAAgC,IAAAkF,GAAhC,CACT,CAAAnD,CAAA,CAAmB,WAAnB,CAEFiI,CAAA1J,EAFE,CAEa0J,CAAAzJ,EAFb,CAE8B,IAAAP,KAF9B,CAAN,CAKEiJ,CAAJ,EAAa,IAAAhE,EAAb,GACE,IAAAG,EADF,CACc,IADd,CAT2E,CAc7E,KAAIoF,EAA+B,4BACnChG,EAAAmB,UAAA8E,GAAA,CAAmDC,QAA2B,EAAG,CAC/E,IAAIzB,EAAQ,IAAAE,EAAA,CAAcqB,CAAd,CACC,KAAb,EAAIvB,CAAJ,EACE,IAAAa,GAAA,EAGF,QADcb,CAAA0B,CAAM,CAANA,CACd,EACE,KAAK,QAAL,CAAe,IAAAvF,EAAA,CAAY,IAAAwF,GAAsB,MACjD,MAAK,QAAL,CAAe,IAAAxF,EAAA;AAAY,IAAAyF,GAAsB,MACjD,SAAS,IAAA9C,EAAA,EAHX,CAN+E,CAajFvD,EAAAmB,UAAAiF,GAAA,CAAgDE,QAAwB,EAAG,CACzE,IAAAjJ,EAAA,CAAe4D,MAAAC,OAAA,CAAc,IAAd,CACf,KAAAvB,EAAA,CAAyB,IAAA4G,EACzB,KAAA3F,EAAA,CAAY,IAAA4F,GAH6D,CAM3ExG,EAAAmB,UAAAkF,GAAA,CAAgDI,QAAwB,EAAG,CACzE,IAAApJ,EAAA,CAAe4D,MAAAC,OAAA,CAAc,IAAd,CAEf,KAAAN,EAAA,CADA,IAAAjB,EACA,CADyB,IAAA+G,GAFgD,CAM3E,KAAIC,EAAY,sBAAhB,CACIC,EAAmB,IAAIC,MAAJ,CAAW,sBAAX,CAAoCF,CAAAG,OAApC,CAAuD,GAAvD,CAA4D,GAA5D,CAEvB9G,EAAAmB,UAAAqF,GAAA,CAAiDO,QAAyB,EAAG,CAC3E,IAAItC,EAAQ,IAAAL,EAAA,CAAawC,CAAb,CACZ,KAAAnH,EAAA,CAA8B,IAAV,EAACgF,CAAD,CAAkB,CAAlB,CAAsBuC,QAAA,CAASvC,CAAA,CAAM,CAAN,CAAT,CAAmB,EAAnB,CAC1C,KAAAjF,EAAA,CAA+B5C,CAAA,CAAe,IAAAC,EAAf,CAAkC,IAAA4C,EAAlC,CAC/B,KAAAmB,EAAA,CAAY,IAAA2F,EAJ+D,CAO7EvG,EAAAmB,UAAA8F,EAAA,CAAqDC,QAA6B,CAACxH,CAAD,CAAYjE,CAAZ,CAAmB,CACnG,GAAgC,IAAK,EAArC,GAAI,IAAA4B,EAAA,CAAaqC,CAAb,CAAJ,CAAwC,CACtC,IAAI8F,EAAWjK,CAAA,CAAqB,IAAAC,KAArB,CAAgCC,CAAhC,CACf,MAAM8B,EAAA,CAAmB,UAAnB,CAEFmC,CAFE,CAES8F,CAAA1J,EAFT,CAEwB0J,CAAAzJ,EAFxB,CAEyC,IAAAP,KAFzC,CAAN;AAFsC,CAD2D,CASrG,KAAI2L,EAAiB,WACrBnH,EAAAmB,UAAAuF,GAAA,CAAkDU,QAA0B,EAAG,CAC7E,IAAI3C,EAAQ,IAAAL,EAAA,CAAa+C,CAAb,CACC,KAAb,EAAI1C,CAAJ,EACE,IAAAxI,EACA,CADgBA,CAAA,IAAIgC,CAAJ,CAAkB,IAAApB,EAAlB,CAAqC,IAAAQ,EAArC,CAAApB,GAChB,CAAA,IAAA2E,EAAA,CAAY,IAFd,GAKA,IAAAlB,EAEA,CAFiB+E,CAAA,CAAM,CAAN,CAEjB,CADA,IAAAwC,EAAA,CAA0B,IAAAvH,EAA1B,CAA0C+E,CAAAhJ,MAA1C,CACA,CAAA,IAAAmF,EAAA,CAAY,IAAAyG,GAPZ,CAF6E,CAY/E,KAAIC,EAA+B,IAAIT,MAAJ,CAAW,cAAX,CAA4BF,CAAAG,OAA5B,CAA+C,YAA/C,CAA6D,GAA7D,CACnC9G,EAAAmB,UAAAoF,EAAA,CAAyDgB,QAAiC,EAAG,CAC3F,IAAI9C,EAAQ,IAAAL,EAAA,CAAakD,CAAb,CACC,KAAb,EAAI7C,CAAJ,EACE,IAAAxI,EACA,CADgBA,CAAA,IAAIkC,CAAJ,CAAkB,IAAAtB,EAAlB,CAAqC,IAAAQ,EAArC,CAAmD,IAAAoC,EAAnD,CAAsE,IAAArB,EAAtE,CAAAnC,GAChB,CAAA,IAAA2E,EAAA,CAAY,IAFd,GAME,IAAAlB,EAKF,CANgB,IAAhB,EAAI+E,CAAA,CAAM,CAAN,CAAJ,CACmBuC,QAAA,CAASvC,CAAA,CAAM,CAAN,CAAT,CAAmB,EAAnB,CADnB,CAGmBA,CAAA,CAAM,CAAN,CAGnB,CADA,IAAAwC,EAAA,CAA0B,IAAAvH,EAA1B,CAA0C+E,CAAAhJ,MAA1C,CACA,CAAA,IAAAmF,EAAA,CAAY,IAAAyG,GAXZ,CAF2F,CAgB7F,KAAIG,EAAgB,OAEpBxH,EAAAmB,UAAAkG,GAAA,CAAgDI,QAAwB,EAAG,CACzE,GAAK,CAAA,IAAA5C,GAAA,CAAe2C,CAAf,CAAL,CAAoC,CAClC,IAAIhC,EAAWjK,CAAA,CAAqB,IAAAC,KAArB,CAAgC,IAAAC,MAAhC,CACf;KAAM8B,EAAA,CAAmB,cAAnB,CAEF,IAAAmC,EAFE,CAEc8F,CAAA1J,EAFd,CAE6B0J,CAAAzJ,EAF7B,CAE8C,IAAAP,KAF9C,CAAN,CAFkC,CAMpC,IAAAoE,EAAA,CAAqB,IAAAnE,MACrB,KAAAsD,EAAA,CAA0B,IAAIT,CAAJ,CAAuB,IAAAC,EAAvB,CAA4C,IAAAC,EAA5C,CAC1B,KAAAoC,EAAA,CAAY,IAAA8G,EAT6D,CAc3E,KAAIC,EAA2B,WAA/B,CACIC,EAA0C,aAD9C,CAEIC,EAA8B,SAClC7H,EAAAmB,UAAA2G,GAAA,CAAoEC,QAA4C,EAAG,CAAA,IAC7GC,EAAe,IAAAvM,MAD8F,CAClFgJ,CAC/B,IAA8B,IAA9B,EAAI,IAAA9E,EAAJ,CAEE,IADA8E,CACI,CADI,IAAAE,EAAA,CAAckD,CAAd,CACJ,CAAS,IAAT,EAAApD,CAAJ,CAGE,MAFA,KAAAnE,EAEO,CAFS,IAAA9E,KAAAyM,UAAA,CAAoBD,CAApB,CAET,CADP,IAAAvM,MACO,CADM,IAAAD,KAAAK,OACN,CAAA,IAHT,CAFF,IAUE,IAFA4I,CAEI,CAFI,IAAAE,EAAA,CAAc,IAAAhF,EAAA,EAA0B,IAAA4G,EAA1B,CACAqB,CADA,CAC0CD,CADxD,CAEJ,CAAS,IAAT,EAAAlD,CAAJ,CAEE,KADIe,EACE,CADSjK,CAAA,CAAqB,IAAAC,KAArB,CAAgC,IAAAoE,EAAhC,CACT,CAAArC,CAAA,CAAmB,aAAnB,CAEF,IAAAmC,EAFE,CAEc8F,CAAA1J,EAFd,CAE6B0J,CAAAzJ,EAF7B,CAE8C,IAAAP,KAF9C,CAAN,CAMJ,IAAI0M,EAAQzD,CAAA,CAAM,CAAN,CACZ,KAAAnE,EAAA,CAAgB,IAAA9E,KAAAyM,UAAA,CAAoBD,CAApB,CAAkCvD,CAAAhJ,MAAlC,CAChB,OAAOyM,EAtB0G,CAyBnHlI,EAAAmB,UAAAuG,EAAA,CAAiES,QAAyC,EAAG,CAC3G,IAAIH;AAAe,IAAAvM,MAAnB,CACIyM,EAAQ,IAAAJ,GAAA,EACC,KAAb,EAAII,CAAJ,EAEE,IAAAzM,MAEA,CAFa,IAAAD,KAAAK,OAEb,CADA,IAAAkD,EAAA2D,EAAA,CAAgC,IAAAlH,KAAAyM,UAAA,CAAoBD,CAApB,CAAhC,CACA,CAAA,IAAApH,EAAA,CAAY,IAJd,EAOgB,IAAhB,EAAIsH,CAAA,CAAM,CAAN,CAAJ,CAEE,IAAAnJ,EAAA2D,EAAA,CAAgC,IAAApC,EAAhC,CAAgD4H,CAAA,CAAM,CAAN,CAAhD,CAFF,EAKA,IAAAnJ,EAAA2D,EAAA,CAAgC,IAAApC,EAAhC,CACA,CAAa,IAAb,EAAI4H,CAAJ,EACE,IAAApE,UAAA,EAEA,CADA,IAAAnD,EAAA6B,KAAA,CAAoB,IAAA4F,GAApB,CACA,CAAA,IAAAxH,EAAA,CAAY,IAAAyH,EAHd,EAIoB,GAAb,EAAIH,CAAJ,EACL,IAAA7K,EAAA,CAAa,IAAAqC,EAAb,CACA,CAD+B,IAAAX,EAAAqE,GAAA,CAA0D,CAAA,CAA1D,CAAiE,IAAA5H,KAAjE,CAC/B,CAAA,IAAAoF,EAAA,CAAY,IAAAjB,EAFP,EAGa,GAAb,EAAIuI,CAAJ,CACL,IAAAnJ,EAAA6D,EAAA,CAAwC,IAAApD,EAAxC,CADK,CAGL,IAAA+D,EAAA,EAhBF,CAV2G,CA8B7GvD,EAAAmB,UAAAmH,GAAA,CAAgDC,QAAwB,EAAG,CACzE,IAAAxJ,EAAA,CAA0B,IAAIT,CAAJ,CAAuB,IAAAC,EAAvB,CAA4C,IAAAC,EAA5C,CAC1B,KAAAoC,EAAA,CAAY,IAAA4H,EAF6D,CAK3ExI,EAAAmB,UAAAqH,EAAA,CAAoDC,QAA4B,EAAG,CACjF,IAAIT,EAAe,IAAAvM,MAAnB,CACIgJ,EAAQ,IAAAE,EAAA,CAAckD,CAAd,CACZ,IAAa,IAAb,EAAIpD,CAAJ,CAEE,IAAAhJ,MAGA,CAHa,IAAAD,KAAAK,OAGb,CAFA,IAAAkD,EAAA2D,EAAA,CAAgC,IAAAlH,KAAAyM,UAAA,CAAoBD,CAApB,CAAhC,CAEA;AADA,IAAA/L,EACA,CADgB,IAAA8C,EAAAqE,GAAA,CAAmC,IAAAhD,GAAnC,CAA4D,IAAA5E,KAA5D,CAChB,CAAA,IAAAoF,EAAA,CAAY,IALd,KAAA,CAQA,IAAIsH,EAAQzD,CAAA,CAAM,CAAN,CACI,KAAhB,EAAIyD,CAAA,CAAM,CAAN,CAAJ,CAEE,IAAAnJ,EAAA2D,EAAA,CAAgC,IAAAlH,KAAAyM,UAAA,CAAoBD,CAApB,CAAkCvD,CAAAhJ,MAAlC,CAAhC,CAAiFyM,CAAA,CAAM,CAAN,CAAjF,CAFF,EAKA,IAAAnJ,EAAA2D,EAAA,CAAgC,IAAAlH,KAAAyM,UAAA,CAAoBD,CAApB,CAAkCvD,CAAAhJ,MAAlC,CAAhC,CAGA,CAFA,IAAAqI,UAAA,EAEA,CADA,IAAAnD,EAAA6B,KAAA,CAAoB,IAAAkG,GAApB,CACA,CAAA,IAAA9H,EAAA,CAAY,IAAAyH,EARZ,CATA,CAHiF,CAuBnFrI,EAAAmB,UAAAuH,GAAA,CAA6DC,QAAqC,EAAG,CACnG,IAAI9L,EAAe,IAAAZ,EACnB,KAAA+H,EAAA,EACA,KAAAjF,EAAA6D,EAAA,CAAwC/F,CAAxC,CACA,KAAA+D,EAAA,CAAY,IAAA4H,EAJuF,CAOrGxI,EAAAmB,UAAAkH,EAAA,CAAoDO,QAA4B,EAAG,CACjF,IAAA3M,EAAA,CAAgB,IAChB,KAAA0E,EAAA6B,KAAA,CAAoB,IAAAqG,GAApB,CACA,KAAAjI,EAAA,CAAY,IAAAkI,GAHqE,CAMnF9I,EAAAmB,UAAAiH,GAAA,CAAwEW,QAAgD,EAAG,CACzH,IAAIlM,EAAe,IAAAZ,EACnB,KAAA+H,EAAA,EACA,KAAAjF,EAAA6D,EAAA,CAAwC/F,CAAxC,CACA,KAAA+D,EAAA,CAAY,IAAA8G,EAJ6G,CAS3H,KAAIsB,EAAgB,QACpBhJ,EAAAmB,UAAA0H,GAAA,CAAgDI,QAAwB,EAAG,CAEzE,GAAa,IAAb,EADY,IAAA7E,EAAAK,CAAauE,CAAbvE,CACZ,CAAmB,CACjB,IAAIe;AAAWjK,CAAA,CAAqB,IAAAC,KAArB,CAAgC,IAAAC,MAAhC,CACf,MAAM8B,EAAA,CAAmB,cAAnB,CAEF,IAFE,CAEIiI,CAAA1J,EAFJ,CAEmB0J,CAAAzJ,EAFnB,CAEoC,IAAAP,KAFpC,CAAN,CAFiB,CAME,IAArB,EAAI,IAAAS,EAAJ,GASE,IAAAA,EAEA,CAFgB,IAAAiE,EAAA,CAAY,IAAArD,EAAZ,CAA+B,IAAAsD,GAA/B,CAEhB,CADA,IAAAlE,EAAA,IACA,CADuB,IAAAY,EAAA,IACvB,CAAA,IAAAZ,EAAA,YAAA,CAA+B,IAAAY,EAAA,YAXjC,CAaA,KAAA+D,EAAA,CAAY,IArB6D,CAwB3EZ,EAAAmB,UAAA2H,GAAA,CAAsDI,QAA8B,EAAG,CACrF,IAAA3I,EAAA,CAA4B,EAC5B,KAAAV,EAAA,CAA4B,IAAApE,MAC5B,KAAAmF,EAAA,CAAY,IAAAuI,EAHyE,CA2BvF,KAAIC,EAA2B,eAC/BpJ,EAAAmB,UAAAgI,EAAA,CAAwDE,QAAgC,EAAG,CAEzF,IAAI5E,EAAQ,IAAAE,EAAA,CAAcyE,CAAd,CAEZ,IAAa,IAAb,EAAI3E,CAAJ,CAAmB,CACjB,GAAyC,CAAzC,GAAI,IAAAlE,EAAA1E,OAAJ,CAA4C,CAO1C,IAAAJ,MAAA,CAAa,IAAAD,KAAAK,OACb,KAAAgB,EAAA,CAAoB,IAAAqD,EAAA,CAAY,IAAA1E,KAAAyM,UAAA,CAAoB,IAAApI,EAApB,CAA+C,IAAApE,MAA/C,CAAZ,CAEpB,KAAAoB,EAAA,IAAA,CAA2B,IAAArB,KAAAyM,UAAA,CAAoB,IAAApI,EAApB,CAA+C,IAAApE,MAA/C,CAC3B,KAAAoB,EAAA,YAAA;AAAmC,IAAAA,EAAA,YACnC,KAAA+D,EAAA,CAAY,IACZ,OAb0C,CAgB5C,KAAMrD,EAAA,CAAmB,SAAnB,CAEF,IAAAsD,GAAA,CAHoB,IAAAN,EAAA+I,CAA0B,CAA1BA,CAGpB,CAFE,CAEsC,IAAA9N,KAFtC,CAAN,CAjBiB,CAqBnB,IAAI+N,EAAW9E,CAAA,CAAM,CAAN,CACf,IAAgB,GAAhB,EAAI8E,CAAJ,EAAmC,GAAnC,EAAuBA,CAAvB,CACE,IAAA5I,EAAA6B,KAAA,CAAoB,IAAA2G,EAApB,CACA,CAAA,IAAAzD,GAAA,CAAwBjB,CAAxB,CAFF,KAKA,IAAgB,GAAhB,EAAI8E,CAAJ,CAAqB,CACnB,GAAI,IAAAhL,EAAJ,CAEE,KADAiH,EACM,CADKjK,CAAA,CAAqB,IAAAC,KAArB,CAAgC,IAAAC,MAAhC,CACL,CAAA8B,CAAA,CAAmB,QAAnB,CAEF,IAAAgB,EAFE,CAEmBiH,CAAA1J,EAFnB,CAEkC0J,CAAAzJ,EAFlC,CAEmD,IAAAP,KAFnD,CAAN,CAKuC,CAAzC,GAAI,IAAA+E,EAAA1E,OAAJ,GAEE,IAAAgB,EAKA,CALoB,IAAAqD,EAAA,CAAY,IAAA1E,KAAAyM,UAAA,CAAoB,IAAApI,EAApB,CAA+C4E,CAAAhJ,MAA/C,CAAZ,CAKpB,CAHA,IAAAoB,EAAA,IAGA,CAH2B,IAAArB,KAAAyM,UAAA,CAAoB,IAAApI,EAApB,CAA+C4E,CAAAhJ,MAA/C,CAG3B,CAFA,IAAAoB,EAAA,YAEA,CAFmC,IAAAA,EAAA,YAEnC,CADA,IAAA+D,EACA,CADY,IACZ,CAAA,IAAAA,EAAA,CAAY,IAAAqF,GAPd,CARmB,CAArB,IAmBA,IAAgC,IAAhC,EAAIpF,CAAA,CAAe0I,CAAf,CAAJ,CACE,IAAAhJ,EAAAiJ,QAAA,CAAkCD,CAAlC,CADF,KAAA,CAIA,IAAIE,EAAgB1I,CAAA,CAAiBwI,CAAjB,CACC,KAArB,EAAIE,CAAJ,EACE,IAAAlG,EAAA,EAEF,IAAuC,CAAvC;AAAI,IAAAhD,EAAA1E,OAAJ,CAA0C,CACxC,GAAI4N,CAAJ,EAAqB,IAAAlJ,EAAA,CAA0B,CAA1B,CAArB,CAAmD,CACjD,IAAAA,EAAAmJ,MAAA,EACA,OAFiD,CAInDlE,CAAA,CAAWjK,CAAA,CAAqB,IAAAC,KAArB,CAAgC,IAAAC,MAAhC,CACX,MAAM8B,EAAA,CAAmB,SAAnB,CAEFgM,CAFE,CAEQ/D,CAAA1J,EAFR,CAEuB0J,CAAAzJ,EAFvB,CAEwC8E,CAAA,CAAe,IAAAN,EAAA,CAA0B,CAA1B,CAAf,CAFxC,CAEsF,IAAA/E,KAFtF,CAAN,CANwC,CAW1C,IAAAC,MAAA,CAAagJ,CAAAhJ,MACb,KAAAoB,EAAA,CAAoB,IAAAqD,EAAA,CAAY,IAAA1E,KAAAyM,UAAA,CAAoB,IAAApI,EAApB,CAA+C,IAAApE,MAA/C,CAAZ,CAEpB,KAAAoB,EAAA,IAAA,CAA2B,IAAArB,KAAAyM,UAAA,CAAoB,IAAApI,EAApB,CAA+C,IAAApE,MAA/C,CAC3B,KAAAoB,EAAA,YAAA,CAAmC,IAAAA,EAAA,YACnC,KAAA+D,EAAA,CAAY,IAxBZ,CAlDyF,CA8K3F,KAAI+I,EAAyB,CAAC,iBAAD,CAAoB,WAApB,CAAiCA,QAA+B,CAACC,CAAD,CAAkBC,CAAlB,CAAgC,CAC3H,GAAqC,IAArC,EAAIA,CAAA,YAAA,EAAJ,EAA4E,IAA5E,EAA6CA,CAAA,UAAA,EAA7C,CACE,KAAMtM,EAAA,CAAmB,eAAnB,CAAN,CAEF,IAAIuM,EAAcF,CAAA,YAClBE,EAAA,YAAA,CAA6BD,CAAA,YAC7BC,EAAA,UAAA,CAA2BD,CAAA,UAC3B;MAAOC,EAPoH,CAAhG,CAiBzBC,EAAAA,CAAS5O,CAAA,QAAA,OAAA,CAA4B,iBAA5B,CAA+C,CAAC,IAAD,CAA/C,CACb4O,EAAA,QAAA,CAAkB,iBAAlB,CA7C6BC,CAAC,QAADA,CAAW,SAAXA,CAAsB,MAAtBA,CAA8B,mBAA9BA,CAAmDJ,QAAwB,CACrF1J,CADqF,CAC3E+J,CAD2E,CAChEC,CADgE,CACxDC,CADwD,CACrC,CAEjEC,QAASA,EAAc,CAAC7L,CAAD,CAAiBC,CAAjB,CAA+BhD,CAA/B,CAAqC,CAC1D,MAAO2E,SAAoB,CAAC9E,CAAD,CAAQ,CACjC,GAAI,CAEF,MADAA,EACO,CADCkD,CAAA,CAAiB2L,CAAA,WAAA,CAAmB3L,CAAnB,CAAmClD,CAAnC,CAAjB,CAA6D6O,CAAA,QAAA,CAAgB7O,CAAhB,CAC9D,CAAAmD,CAAA,EAA2B,IAAK,EAAhC,GAAiBnD,CAAjB,CAAqCA,CAArC,CAA6CD,CAAA,CAAUC,CAAV,CAFlD,CAGF,MAAOgP,CAAP,CAAY,CACZF,CAAA,CAAkB5M,CAAA,OAAA,CAA6B/B,CAA7B,CAAmC6O,CAAnC,CAAlB,CADY,CAJmB,CADuB,CAmB5D,MAAO,CACL,YATFP,QAAoB,CAACtO,CAAD,CAAO4E,CAAP,CAA2B7B,CAA3B,CAA2CC,CAA3C,CAAyD,CAEvEuB,CAAAA,CAAS,IAAIC,CAAJ,CAAwBxE,CAAxB,CAA8B,CAA9B,CAAiC0E,CAAjC,CAAyC+J,CAAA,UAAzC,CADKG,CAAAjK,CAAe5B,CAAf4B,CAA+B3B,CAA/B2B,CAA6C3E,CAA7C2E,CACL,CACwBC,CADxB,CAC4C7B,CAD5C,CAC4DC,CAD5D,CAEbuB,EAAAgF,GAAA,CAAWhF,CAAAuI,GAAX,CACA,OAAOvI,EAAA9D,EALoE,CAQtE,CArB0D,CADtC+N,CA6C7B,CACAD,EAAA,OAAA,CAAiB,CAAC,UAAD,CAAa,QAAQ,CAACO,CAAD,CAAW,CAC/CA,CAAA,UAAA,CAAsB,cAAtB,CAAsCX,CAAtC,CAD+C,CAAhC,CAAjB,CAz8BsC,CAArC,CAAD,CA88BGxO,MA98BH,CA88BWA,MAAAoP,GA98BX;",
+"sources":["angular-message-format.js"],
+"names":["window","stringify","value","toJson","indexToLineAndColumn","text","index","lines","split","i","length","line","column","parseTextLiteral","parsedFn","cachedFn","PARSE_CACHE_FOR_TEXT_LITERALS","scope","listener","objectEquality","unwatch","noop","textLiteralWatcher","isFunction","call","subtractOffset","expressionFn","offset","minusOffset","context","pluralExpressionWatchListener","newValue","oldValue","MessageSelectorBase","choices","self","$interpolateMinErr","this.parsedFn","getResult","watchDelegate","MessageSelectorWatchers","msgSelector","lastMessage","messageFnWatcher","expressionFnWatcher","expressionFnListener","SelectMessage","SelectMessageProto","PluralMessage","pluralCat","PluralMessageProto","InterpolationParts","trustedContext","allOrNothing","textParts","expressionFns","expressionIndices","partialText","concatParts","InterpolationPartsWatcher","interpolationParts","previousResult","expressionFnsWatcher","newExpressionValues","oldExpressionValues","watchListener","copyNestedParserState","src","dst","expressionMinusOffsetFn","pluralOffset","choiceKey","ruleChoiceKeyword","msgStartIndex","expressionStartIndex","NestedParserState","parser","MessageFormatParser","startIndex","$parse","stringifier","mustHaveExpression","nestedStateStack","textPart","angularOperatorStack","stringInterestsRe","stringQuote","stringStartIndex","ruleStack","rule","getEndOperator","opBegin","getBeginOperator","opEnd","Object","create","prototype","getMessageFn","MessageSelectorBase.prototype.getMessageFn","categorizeValue","MessageSelectorBase.prototype.getResult","MessageSelectorBase.prototype.watchDelegate","watchers","cancelWatch","MessageSelectorWatchers.prototype.expressionFnListener","messageFn","messageFnListener","newMessage","oldMessage","MessageSelectorWatchers.prototype.messageFnListener","MessageSelectorWatchers.prototype.cancelWatch","SelectMessage.prototype.categorizeValue","PluralMessage.prototype.categorizeValue","isNaN","category","flushPartialText","InterpolationParts.prototype.flushPartialText","push","join","addText","InterpolationParts.prototype.addText","addExpressionFn","InterpolationParts.prototype.addExpressionFn","getExpressionValues","InterpolationParts.prototype.getExpressionValues","expressionValues","Array","InterpolationParts.prototype.getResult","expressionValue","toParsedFn","InterpolationParts.prototype.toParsedFn","originalText","errorInParseLogic","InterpolationParts.prototype.watchDelegate","watcher","InterpolationPartsWatcher.prototype.watchListener","result","InterpolationPartsWatcher.prototype.cancelWatch","EMPTY_STATE","pushState","MessageFormatParser.prototype.pushState","popState","MessageFormatParser.prototype.popState","previousState","pop","matchRe","MessageFormatParser.prototype.matchRe","re","search","lastIndex","match","exec","searchRe","MessageFormatParser.prototype.searchRe","consumeRe","MessageFormatParser.prototype.consumeRe","run","MessageFormatParser.prototype.run","initialRule","assertRuleOrNull","MessageFormatParser.prototype.errorInParseLogic","MessageFormatParser.prototype.assertRuleOrNull","NEXT_WORD_RE","errorExpecting","MessageFormatParser.prototype.errorExpecting","position","word","startStringAtMatch","MessageFormatParser.prototype.startStringAtMatch","SQUOTED_STRING_INTEREST_RE","DQUOTED_STRING_INTEREST_RE","ruleInsideString","MessageFormatParser.prototype.ruleInsideString","PLURAL_OR_SELECT_ARG_TYPE_RE","rulePluralOrSelect","MessageFormatParser.prototype.rulePluralOrSelect","argType","rulePluralStyle","ruleSelectStyle","MessageFormatParser.prototype.rulePluralStyle","rulePluralValueOrKeyword","rulePluralOffset","MessageFormatParser.prototype.ruleSelectStyle","ruleSelectKeyword","NUMBER_RE","PLURAL_OFFSET_RE","RegExp","source","MessageFormatParser.prototype.rulePluralOffset","parseInt","assertChoiceKeyIsNew","MessageFormatParser.prototype.assertChoiceKeyIsNew","SELECT_KEYWORD","MessageFormatParser.prototype.ruleSelectKeyword","ruleMessageText","EXPLICIT_VALUE_OR_KEYWORD_RE","MessageFormatParser.prototype.rulePluralValueOrKeyword","BRACE_OPEN_RE","MessageFormatParser.prototype.ruleMessageText","ruleInInterpolationOrMessageText","INTERP_OR_END_MESSAGE_RE","INTERP_OR_PLURALVALUE_OR_END_MESSAGE_RE","ESCAPE_OR_MUSTACHE_BEGIN_RE","advanceInInterpolationOrMessageText","MessageFormatParser.prototype.advanceInInterpolationOrMessageText","currentIndex","substring","token","MessageFormatParser.prototype.ruleInInterpolationOrMessageText","ruleEndMustacheInInterpolationOrMessage","ruleEnteredMustache","ruleInterpolate","MessageFormatParser.prototype.ruleInterpolate","ruleInInterpolation","MessageFormatParser.prototype.ruleInInterpolation","ruleInterpolationEndMustache","MessageFormatParser.prototype.ruleInterpolationEndMustache","MessageFormatParser.prototype.ruleEnteredMustache","ruleEndMustache","ruleAngularExpression","MessageFormatParser.prototype.ruleEndMustacheInInterpolationOrMessage","INTERP_END_RE","MessageFormatParser.prototype.ruleEndMustache","MessageFormatParser.prototype.ruleAngularExpression","ruleInAngularExpression","INTERESTING_OPERATORS_RE","MessageFormatParser.prototype.ruleInAngularExpression","innermostOperator","operator","unshift","beginOperator","shift","$$interpolateDecorator","$$messageFormat","$interpolate","interpolate","module","$$MessageFormatFactory","$locale","$sce","$exceptionHandler","getStringifier","err","$provide","angular"]
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.js
new file mode 100644
index 00000000..0d206230
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.js
@@ -0,0 +1,687 @@
+/**
+ * @license AngularJS v1.5.0
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+/* jshint ignore:start */
+// this code is in the core, but not in angular-messages.js
+var isArray = angular.isArray;
+var forEach = angular.forEach;
+var isString = angular.isString;
+var jqLite = angular.element;
+/* jshint ignore:end */
+
+/**
+ * @ngdoc module
+ * @name ngMessages
+ * @description
+ *
+ * The `ngMessages` module provides enhanced support for displaying messages within templates
+ * (typically within forms or when rendering message objects that return key/value data).
+ * Instead of relying on JavaScript code and/or complex ng-if statements within your form template to
+ * show and hide error messages specific to the state of an input field, the `ngMessages` and
+ * `ngMessage` directives are designed to handle the complexity, inheritance and priority
+ * sequencing based on the order of how the messages are defined in the template.
+ *
+ * Currently, the ngMessages module only contains the code for the `ngMessages`, `ngMessagesInclude`
+ * `ngMessage` and `ngMessageExp` directives.
+ *
+ * # Usage
+ * The `ngMessages` directive listens on a key/value collection which is set on the ngMessages attribute.
+ * Since the {@link ngModel ngModel} directive exposes an `$error` object, this error object can be
+ * used with `ngMessages` to display control error messages in an easier way than with just regular angular
+ * template directives.
+ *
+ * ```html
+ * <form name="myForm">
+ * <label>
+ * Enter text:
+ * <input type="text" ng-model="field" name="myField" required minlength="5" />
+ * </label>
+ * <div ng-messages="myForm.myField.$error" role="alert">
+ * <div ng-message="required">You did not enter a field</div>
+ * <div ng-message="minlength, maxlength">
+ * Your email must be between 5 and 100 characters long
+ * </div>
+ * </div>
+ * </form>
+ * ```
+ *
+ * Now whatever key/value entries are present within the provided object (in this case `$error`) then
+ * the ngMessages directive will render the inner first ngMessage directive (depending if the key values
+ * match the attribute value present on each ngMessage directive). In other words, if your errors
+ * object contains the following data:
+ *
+ * ```javascript
+ * <!-- keep in mind that ngModel automatically sets these error flags -->
+ * myField.$error = { minlength : true, required : true };
+ * ```
+ *
+ * Then the `required` message will be displayed first. When required is false then the `minlength` message
+ * will be displayed right after (since these messages are ordered this way in the template HTML code).
+ * The prioritization of each message is determined by what order they're present in the DOM.
+ * Therefore, instead of having custom JavaScript code determine the priority of what errors are
+ * present before others, the presentation of the errors are handled within the template.
+ *
+ * By default, ngMessages will only display one error at a time. However, if you wish to display all
+ * messages then the `ng-messages-multiple` attribute flag can be used on the element containing the
+ * ngMessages directive to make this happen.
+ *
+ * ```html
+ * <!-- attribute-style usage -->
+ * <div ng-messages="myForm.myField.$error" ng-messages-multiple>...</div>
+ *
+ * <!-- element-style usage -->
+ * <ng-messages for="myForm.myField.$error" multiple>...</ng-messages>
+ * ```
+ *
+ * ## Reusing and Overriding Messages
+ * In addition to prioritization, ngMessages also allows for including messages from a remote or an inline
+ * template. This allows for generic collection of messages to be reused across multiple parts of an
+ * application.
+ *
+ * ```html
+ * <script type="text/ng-template" id="error-messages">
+ * <div ng-message="required">This field is required</div>
+ * <div ng-message="minlength">This field is too short</div>
+ * </script>
+ *
+ * <div ng-messages="myForm.myField.$error" role="alert">
+ * <div ng-messages-include="error-messages"></div>
+ * </div>
+ * ```
+ *
+ * However, including generic messages may not be useful enough to match all input fields, therefore,
+ * `ngMessages` provides the ability to override messages defined in the remote template by redefining
+ * them within the directive container.
+ *
+ * ```html
+ * <!-- a generic template of error messages known as "my-custom-messages" -->
+ * <script type="text/ng-template" id="my-custom-messages">
+ * <div ng-message="required">This field is required</div>
+ * <div ng-message="minlength">This field is too short</div>
+ * </script>
+ *
+ * <form name="myForm">
+ * <label>
+ * Email address
+ * <input type="email"
+ * id="email"
+ * name="myEmail"
+ * ng-model="email"
+ * minlength="5"
+ * required />
+ * </label>
+ * <!-- any ng-message elements that appear BEFORE the ng-messages-include will
+ * override the messages present in the ng-messages-include template -->
+ * <div ng-messages="myForm.myEmail.$error" role="alert">
+ * <!-- this required message has overridden the template message -->
+ * <div ng-message="required">You did not enter your email address</div>
+ *
+ * <!-- this is a brand new message and will appear last in the prioritization -->
+ * <div ng-message="email">Your email address is invalid</div>
+ *
+ * <!-- and here are the generic error messages -->
+ * <div ng-messages-include="my-custom-messages"></div>
+ * </div>
+ * </form>
+ * ```
+ *
+ * In the example HTML code above the message that is set on required will override the corresponding
+ * required message defined within the remote template. Therefore, with particular input fields (such
+ * email addresses, date fields, autocomplete inputs, etc...), specialized error messages can be applied
+ * while more generic messages can be used to handle other, more general input errors.
+ *
+ * ## Dynamic Messaging
+ * ngMessages also supports using expressions to dynamically change key values. Using arrays and
+ * repeaters to list messages is also supported. This means that the code below will be able to
+ * fully adapt itself and display the appropriate message when any of the expression data changes:
+ *
+ * ```html
+ * <form name="myForm">
+ * <label>
+ * Email address
+ * <input type="email"
+ * name="myEmail"
+ * ng-model="email"
+ * minlength="5"
+ * required />
+ * </label>
+ * <div ng-messages="myForm.myEmail.$error" role="alert">
+ * <div ng-message="required">You did not enter your email address</div>
+ * <div ng-repeat="errorMessage in errorMessages">
+ * <!-- use ng-message-exp for a message whose key is given by an expression -->
+ * <div ng-message-exp="errorMessage.type">{{ errorMessage.text }}</div>
+ * </div>
+ * </div>
+ * </form>
+ * ```
+ *
+ * The `errorMessage.type` expression can be a string value or it can be an array so
+ * that multiple errors can be associated with a single error message:
+ *
+ * ```html
+ * <label>
+ * Email address
+ * <input type="email"
+ * ng-model="data.email"
+ * name="myEmail"
+ * ng-minlength="5"
+ * ng-maxlength="100"
+ * required />
+ * </label>
+ * <div ng-messages="myForm.myEmail.$error" role="alert">
+ * <div ng-message-exp="'required'">You did not enter your email address</div>
+ * <div ng-message-exp="['minlength', 'maxlength']">
+ * Your email must be between 5 and 100 characters long
+ * </div>
+ * </div>
+ * ```
+ *
+ * Feel free to use other structural directives such as ng-if and ng-switch to further control
+ * what messages are active and when. Be careful, if you place ng-message on the same element
+ * as these structural directives, Angular may not be able to determine if a message is active
+ * or not. Therefore it is best to place the ng-message on a child element of the structural
+ * directive.
+ *
+ * ```html
+ * <div ng-messages="myForm.myEmail.$error" role="alert">
+ * <div ng-if="showRequiredError">
+ * <div ng-message="required">Please enter something</div>
+ * </div>
+ * </div>
+ * ```
+ *
+ * ## Animations
+ * If the `ngAnimate` module is active within the application then the `ngMessages`, `ngMessage` and
+ * `ngMessageExp` directives will trigger animations whenever any messages are added and removed from
+ * the DOM by the `ngMessages` directive.
+ *
+ * Whenever the `ngMessages` directive contains one or more visible messages then the `.ng-active` CSS
+ * class will be added to the element. The `.ng-inactive` CSS class will be applied when there are no
+ * messages present. Therefore, CSS transitions and keyframes as well as JavaScript animations can
+ * hook into the animations whenever these classes are added/removed.
+ *
+ * Let's say that our HTML code for our messages container looks like so:
+ *
+ * ```html
+ * <div ng-messages="myMessages" class="my-messages" role="alert">
+ * <div ng-message="alert" class="some-message">...</div>
+ * <div ng-message="fail" class="some-message">...</div>
+ * </div>
+ * ```
+ *
+ * Then the CSS animation code for the message container looks like so:
+ *
+ * ```css
+ * .my-messages {
+ * transition:1s linear all;
+ * }
+ * .my-messages.ng-active {
+ * // messages are visible
+ * }
+ * .my-messages.ng-inactive {
+ * // messages are hidden
+ * }
+ * ```
+ *
+ * Whenever an inner message is attached (becomes visible) or removed (becomes hidden) then the enter
+ * and leave animation is triggered for each particular element bound to the `ngMessage` directive.
+ *
+ * Therefore, the CSS code for the inner messages looks like so:
+ *
+ * ```css
+ * .some-message {
+ * transition:1s linear all;
+ * }
+ *
+ * .some-message.ng-enter {}
+ * .some-message.ng-enter.ng-enter-active {}
+ *
+ * .some-message.ng-leave {}
+ * .some-message.ng-leave.ng-leave-active {}
+ * ```
+ *
+ * {@link ngAnimate Click here} to learn how to use JavaScript animations or to learn more about ngAnimate.
+ */
+angular.module('ngMessages', [])
+
+ /**
+ * @ngdoc directive
+ * @module ngMessages
+ * @name ngMessages
+ * @restrict AE
+ *
+ * @description
+ * `ngMessages` is a directive that is designed to show and hide messages based on the state
+ * of a key/value object that it listens on. The directive itself complements error message
+ * reporting with the `ngModel` $error object (which stores a key/value state of validation errors).
+ *
+ * `ngMessages` manages the state of internal messages within its container element. The internal
+ * messages use the `ngMessage` directive and will be inserted/removed from the page depending
+ * on if they're present within the key/value object. By default, only one message will be displayed
+ * at a time and this depends on the prioritization of the messages within the template. (This can
+ * be changed by using the `ng-messages-multiple` or `multiple` attribute on the directive container.)
+ *
+ * A remote template can also be used to promote message reusability and messages can also be
+ * overridden.
+ *
+ * {@link module:ngMessages Click here} to learn more about `ngMessages` and `ngMessage`.
+ *
+ * @usage
+ * ```html
+ * <!-- using attribute directives -->
+ * <ANY ng-messages="expression" role="alert">
+ * <ANY ng-message="stringValue">...</ANY>
+ * <ANY ng-message="stringValue1, stringValue2, ...">...</ANY>
+ * <ANY ng-message-exp="expressionValue">...</ANY>
+ * </ANY>
+ *
+ * <!-- or by using element directives -->
+ * <ng-messages for="expression" role="alert">
+ * <ng-message when="stringValue">...</ng-message>
+ * <ng-message when="stringValue1, stringValue2, ...">...</ng-message>
+ * <ng-message when-exp="expressionValue">...</ng-message>
+ * </ng-messages>
+ * ```
+ *
+ * @param {string} ngMessages an angular expression evaluating to a key/value object
+ * (this is typically the $error object on an ngModel instance).
+ * @param {string=} ngMessagesMultiple|multiple when set, all messages will be displayed with true
+ *
+ * @example
+ * <example name="ngMessages-directive" module="ngMessagesExample"
+ * deps="angular-messages.js"
+ * animations="true" fixBase="true">
+ * <file name="index.html">
+ * <form name="myForm">
+ * <label>
+ * Enter your name:
+ * <input type="text"
+ * name="myName"
+ * ng-model="name"
+ * ng-minlength="5"
+ * ng-maxlength="20"
+ * required />
+ * </label>
+ * <pre>myForm.myName.$error = {{ myForm.myName.$error | json }}</pre>
+ *
+ * <div ng-messages="myForm.myName.$error" style="color:maroon" role="alert">
+ * <div ng-message="required">You did not enter a field</div>
+ * <div ng-message="minlength">Your field is too short</div>
+ * <div ng-message="maxlength">Your field is too long</div>
+ * </div>
+ * </form>
+ * </file>
+ * <file name="script.js">
+ * angular.module('ngMessagesExample', ['ngMessages']);
+ * </file>
+ * </example>
+ */
+ .directive('ngMessages', ['$animate', function($animate) {
+ var ACTIVE_CLASS = 'ng-active';
+ var INACTIVE_CLASS = 'ng-inactive';
+
+ return {
+ require: 'ngMessages',
+ restrict: 'AE',
+ controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {
+ var ctrl = this;
+ var latestKey = 0;
+ var nextAttachId = 0;
+
+ this.getAttachId = function getAttachId() { return nextAttachId++; };
+
+ var messages = this.messages = {};
+ var renderLater, cachedCollection;
+
+ this.render = function(collection) {
+ collection = collection || {};
+
+ renderLater = false;
+ cachedCollection = collection;
+
+ // this is true if the attribute is empty or if the attribute value is truthy
+ var multiple = isAttrTruthy($scope, $attrs.ngMessagesMultiple) ||
+ isAttrTruthy($scope, $attrs.multiple);
+
+ var unmatchedMessages = [];
+ var matchedKeys = {};
+ var messageItem = ctrl.head;
+ var messageFound = false;
+ var totalMessages = 0;
+
+ // we use != instead of !== to allow for both undefined and null values
+ while (messageItem != null) {
+ totalMessages++;
+ var messageCtrl = messageItem.message;
+
+ var messageUsed = false;
+ if (!messageFound) {
+ forEach(collection, function(value, key) {
+ if (!messageUsed && truthy(value) && messageCtrl.test(key)) {
+ // this is to prevent the same error name from showing up twice
+ if (matchedKeys[key]) return;
+ matchedKeys[key] = true;
+
+ messageUsed = true;
+ messageCtrl.attach();
+ }
+ });
+ }
+
+ if (messageUsed) {
+ // unless we want to display multiple messages then we should
+ // set a flag here to avoid displaying the next message in the list
+ messageFound = !multiple;
+ } else {
+ unmatchedMessages.push(messageCtrl);
+ }
+
+ messageItem = messageItem.next;
+ }
+
+ forEach(unmatchedMessages, function(messageCtrl) {
+ messageCtrl.detach();
+ });
+
+ unmatchedMessages.length !== totalMessages
+ ? $animate.setClass($element, ACTIVE_CLASS, INACTIVE_CLASS)
+ : $animate.setClass($element, INACTIVE_CLASS, ACTIVE_CLASS);
+ };
+
+ $scope.$watchCollection($attrs.ngMessages || $attrs['for'], ctrl.render);
+
+ this.reRender = function() {
+ if (!renderLater) {
+ renderLater = true;
+ $scope.$evalAsync(function() {
+ if (renderLater) {
+ cachedCollection && ctrl.render(cachedCollection);
+ }
+ });
+ }
+ };
+
+ this.register = function(comment, messageCtrl) {
+ var nextKey = latestKey.toString();
+ messages[nextKey] = {
+ message: messageCtrl
+ };
+ insertMessageNode($element[0], comment, nextKey);
+ comment.$$ngMessageNode = nextKey;
+ latestKey++;
+
+ ctrl.reRender();
+ };
+
+ this.deregister = function(comment) {
+ var key = comment.$$ngMessageNode;
+ delete comment.$$ngMessageNode;
+ removeMessageNode($element[0], comment, key);
+ delete messages[key];
+ ctrl.reRender();
+ };
+
+ function findPreviousMessage(parent, comment) {
+ var prevNode = comment;
+ var parentLookup = [];
+ while (prevNode && prevNode !== parent) {
+ var prevKey = prevNode.$$ngMessageNode;
+ if (prevKey && prevKey.length) {
+ return messages[prevKey];
+ }
+
+ // dive deeper into the DOM and examine its children for any ngMessage
+ // comments that may be in an element that appears deeper in the list
+ if (prevNode.childNodes.length && parentLookup.indexOf(prevNode) == -1) {
+ parentLookup.push(prevNode);
+ prevNode = prevNode.childNodes[prevNode.childNodes.length - 1];
+ } else {
+ prevNode = prevNode.previousSibling || prevNode.parentNode;
+ }
+ }
+ }
+
+ function insertMessageNode(parent, comment, key) {
+ var messageNode = messages[key];
+ if (!ctrl.head) {
+ ctrl.head = messageNode;
+ } else {
+ var match = findPreviousMessage(parent, comment);
+ if (match) {
+ messageNode.next = match.next;
+ match.next = messageNode;
+ } else {
+ messageNode.next = ctrl.head;
+ ctrl.head = messageNode;
+ }
+ }
+ }
+
+ function removeMessageNode(parent, comment, key) {
+ var messageNode = messages[key];
+
+ var match = findPreviousMessage(parent, comment);
+ if (match) {
+ match.next = messageNode.next;
+ } else {
+ ctrl.head = messageNode.next;
+ }
+ }
+ }]
+ };
+
+ function isAttrTruthy(scope, attr) {
+ return (isString(attr) && attr.length === 0) || //empty attribute
+ truthy(scope.$eval(attr));
+ }
+
+ function truthy(val) {
+ return isString(val) ? val.length : !!val;
+ }
+ }])
+
+ /**
+ * @ngdoc directive
+ * @name ngMessagesInclude
+ * @restrict AE
+ * @scope
+ *
+ * @description
+ * `ngMessagesInclude` is a directive with the purpose to import existing ngMessage template
+ * code from a remote template and place the downloaded template code into the exact spot
+ * that the ngMessagesInclude directive is placed within the ngMessages container. This allows
+ * for a series of pre-defined messages to be reused and also allows for the developer to
+ * determine what messages are overridden due to the placement of the ngMessagesInclude directive.
+ *
+ * @usage
+ * ```html
+ * <!-- using attribute directives -->
+ * <ANY ng-messages="expression" role="alert">
+ * <ANY ng-messages-include="remoteTplString">...</ANY>
+ * </ANY>
+ *
+ * <!-- or by using element directives -->
+ * <ng-messages for="expression" role="alert">
+ * <ng-messages-include src="expressionValue1">...</ng-messages-include>
+ * </ng-messages>
+ * ```
+ *
+ * {@link module:ngMessages Click here} to learn more about `ngMessages` and `ngMessage`.
+ *
+ * @param {string} ngMessagesInclude|src a string value corresponding to the remote template.
+ */
+ .directive('ngMessagesInclude',
+ ['$templateRequest', '$document', '$compile', function($templateRequest, $document, $compile) {
+
+ return {
+ restrict: 'AE',
+ require: '^^ngMessages', // we only require this for validation sake
+ link: function($scope, element, attrs) {
+ var src = attrs.ngMessagesInclude || attrs.src;
+ $templateRequest(src).then(function(html) {
+ $compile(html)($scope, function(contents) {
+ element.after(contents);
+
+ // the anchor is placed for debugging purposes
+ var anchor = jqLite($document[0].createComment(' ngMessagesInclude: ' + src + ' '));
+ element.after(anchor);
+
+ // we don't want to pollute the DOM anymore by keeping an empty directive element
+ element.remove();
+ });
+ });
+ }
+ };
+ }])
+
+ /**
+ * @ngdoc directive
+ * @name ngMessage
+ * @restrict AE
+ * @scope
+ *
+ * @description
+ * `ngMessage` is a directive with the purpose to show and hide a particular message.
+ * For `ngMessage` to operate, a parent `ngMessages` directive on a parent DOM element
+ * must be situated since it determines which messages are visible based on the state
+ * of the provided key/value map that `ngMessages` listens on.
+ *
+ * More information about using `ngMessage` can be found in the
+ * {@link module:ngMessages `ngMessages` module documentation}.
+ *
+ * @usage
+ * ```html
+ * <!-- using attribute directives -->
+ * <ANY ng-messages="expression" role="alert">
+ * <ANY ng-message="stringValue">...</ANY>
+ * <ANY ng-message="stringValue1, stringValue2, ...">...</ANY>
+ * </ANY>
+ *
+ * <!-- or by using element directives -->
+ * <ng-messages for="expression" role="alert">
+ * <ng-message when="stringValue">...</ng-message>
+ * <ng-message when="stringValue1, stringValue2, ...">...</ng-message>
+ * </ng-messages>
+ * ```
+ *
+ * @param {expression} ngMessage|when a string value corresponding to the message key.
+ */
+ .directive('ngMessage', ngMessageDirectiveFactory())
+
+
+ /**
+ * @ngdoc directive
+ * @name ngMessageExp
+ * @restrict AE
+ * @priority 1
+ * @scope
+ *
+ * @description
+ * `ngMessageExp` is a directive with the purpose to show and hide a particular message.
+ * For `ngMessageExp` to operate, a parent `ngMessages` directive on a parent DOM element
+ * must be situated since it determines which messages are visible based on the state
+ * of the provided key/value map that `ngMessages` listens on.
+ *
+ * @usage
+ * ```html
+ * <!-- using attribute directives -->
+ * <ANY ng-messages="expression">
+ * <ANY ng-message-exp="expressionValue">...</ANY>
+ * </ANY>
+ *
+ * <!-- or by using element directives -->
+ * <ng-messages for="expression">
+ * <ng-message when-exp="expressionValue">...</ng-message>
+ * </ng-messages>
+ * ```
+ *
+ * {@link module:ngMessages Click here} to learn more about `ngMessages` and `ngMessage`.
+ *
+ * @param {expression} ngMessageExp|whenExp an expression value corresponding to the message key.
+ */
+ .directive('ngMessageExp', ngMessageDirectiveFactory());
+
+function ngMessageDirectiveFactory() {
+ return ['$animate', function($animate) {
+ return {
+ restrict: 'AE',
+ transclude: 'element',
+ priority: 1, // must run before ngBind, otherwise the text is set on the comment
+ terminal: true,
+ require: '^^ngMessages',
+ link: function(scope, element, attrs, ngMessagesCtrl, $transclude) {
+ var commentNode = element[0];
+
+ var records;
+ var staticExp = attrs.ngMessage || attrs.when;
+ var dynamicExp = attrs.ngMessageExp || attrs.whenExp;
+ var assignRecords = function(items) {
+ records = items
+ ? (isArray(items)
+ ? items
+ : items.split(/[\s,]+/))
+ : null;
+ ngMessagesCtrl.reRender();
+ };
+
+ if (dynamicExp) {
+ assignRecords(scope.$eval(dynamicExp));
+ scope.$watchCollection(dynamicExp, assignRecords);
+ } else {
+ assignRecords(staticExp);
+ }
+
+ var currentElement, messageCtrl;
+ ngMessagesCtrl.register(commentNode, messageCtrl = {
+ test: function(name) {
+ return contains(records, name);
+ },
+ attach: function() {
+ if (!currentElement) {
+ $transclude(scope, function(elm) {
+ $animate.enter(elm, null, element);
+ currentElement = elm;
+
+ // Each time we attach this node to a message we get a new id that we can match
+ // when we are destroying the node later.
+ var $$attachId = currentElement.$$attachId = ngMessagesCtrl.getAttachId();
+
+ // in the event that the parent element is destroyed
+ // by any other structural directive then it's time
+ // to deregister the message from the controller
+ currentElement.on('$destroy', function() {
+ if (currentElement && currentElement.$$attachId === $$attachId) {
+ ngMessagesCtrl.deregister(commentNode);
+ messageCtrl.detach();
+ }
+ });
+ });
+ }
+ },
+ detach: function() {
+ if (currentElement) {
+ var elm = currentElement;
+ currentElement = null;
+ $animate.leave(elm);
+ }
+ }
+ });
+ }
+ };
+ }];
+
+ function contains(collection, key) {
+ if (collection) {
+ return isArray(collection)
+ ? collection.indexOf(key) >= 0
+ : collection.hasOwnProperty(key);
+ }
+ }
+}
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js
new file mode 100644
index 00000000..19f59cc8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js
@@ -0,0 +1,12 @@
+/*
+ AngularJS v1.5.0
+ (c) 2010-2016 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(A,d,B){'use strict';function l(){return["$animate",function(v){return{restrict:"AE",transclude:"element",priority:1,terminal:!0,require:"^^ngMessages",link:function(n,r,a,b,m){var k=r[0],f,p=a.ngMessage||a.when;a=a.ngMessageExp||a.whenExp;var d=function(a){f=a?w(a)?a:a.split(/[\s,]+/):null;b.reRender()};a?(d(n.$eval(a)),n.$watchCollection(a,d)):d(p);var e,q;b.register(k,q={test:function(a){var g=f;a=g?w(g)?0<=g.indexOf(a):g.hasOwnProperty(a):void 0;return a},attach:function(){e||m(n,function(a){v.enter(a,
+null,r);e=a;var g=e.$$attachId=b.getAttachId();e.on("$destroy",function(){e&&e.$$attachId===g&&(b.deregister(k),q.detach())})})},detach:function(){if(e){var a=e;e=null;v.leave(a)}}})}}}]}var w=d.isArray,x=d.forEach,y=d.isString,z=d.element;d.module("ngMessages",[]).directive("ngMessages",["$animate",function(d){function n(a,b){return y(b)&&0===b.length||r(a.$eval(b))}function r(a){return y(a)?a.length:!!a}return{require:"ngMessages",restrict:"AE",controller:["$element","$scope","$attrs",function(a,
+b,m){function k(a,b){for(var c=b,f=[];c&&c!==a;){var h=c.$$ngMessageNode;if(h&&h.length)return e[h];c.childNodes.length&&-1==f.indexOf(c)?(f.push(c),c=c.childNodes[c.childNodes.length-1]):c=c.previousSibling||c.parentNode}}var f=this,p=0,l=0;this.getAttachId=function(){return l++};var e=this.messages={},q,s;this.render=function(g){g=g||{};q=!1;s=g;for(var e=n(b,m.ngMessagesMultiple)||n(b,m.multiple),c=[],k={},h=f.head,p=!1,l=0;null!=h;){l++;var t=h.message,u=!1;p||x(g,function(a,c){!u&&r(a)&&t.test(c)&&
+!k[c]&&(u=k[c]=!0,t.attach())});u?p=!e:c.push(t);h=h.next}x(c,function(a){a.detach()});c.length!==l?d.setClass(a,"ng-active","ng-inactive"):d.setClass(a,"ng-inactive","ng-active")};b.$watchCollection(m.ngMessages||m["for"],f.render);this.reRender=function(){q||(q=!0,b.$evalAsync(function(){q&&s&&f.render(s)}))};this.register=function(g,b){var c=p.toString();e[c]={message:b};var d=a[0],h=e[c];f.head?(d=k(d,g))?(h.next=d.next,d.next=h):(h.next=f.head,f.head=h):f.head=h;g.$$ngMessageNode=c;p++;f.reRender()};
+this.deregister=function(b){var d=b.$$ngMessageNode;delete b.$$ngMessageNode;var c=e[d];(b=k(a[0],b))?b.next=c.next:f.head=c.next;delete e[d];f.reRender()}}]}}]).directive("ngMessagesInclude",["$templateRequest","$document","$compile",function(d,n,l){return{restrict:"AE",require:"^^ngMessages",link:function(a,b,m){var k=m.ngMessagesInclude||m.src;d(k).then(function(d){l(d)(a,function(a){b.after(a);a=z(n[0].createComment(" ngMessagesInclude: "+k+" "));b.after(a);b.remove()})})}}}]).directive("ngMessage",
+l()).directive("ngMessageExp",l())})(window,window.angular);
+//# sourceMappingURL=angular-messages.min.js.map
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js.map
new file mode 100644
index 00000000..0cb2a943
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js.map
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"angular-messages.min.js",
+"lineCount":11,
+"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CA0lBtCC,QAASA,EAAyB,EAAG,CACnC,MAAO,CAAC,UAAD,CAAa,QAAQ,CAACC,CAAD,CAAW,CACrC,MAAO,CACLC,SAAU,IADL,CAELC,WAAY,SAFP,CAGLC,SAAU,CAHL,CAILC,SAAU,CAAA,CAJL,CAKLC,QAAS,cALJ,CAMLC,KAAMA,QAAQ,CAACC,CAAD,CAAQC,CAAR,CAAiBC,CAAjB,CAAwBC,CAAxB,CAAwCC,CAAxC,CAAqD,CACjE,IAAIC,EAAcJ,CAAA,CAAQ,CAAR,CAAlB,CAEIK,CAFJ,CAGIC,EAAYL,CAAAM,UAAZD,EAA+BL,CAAAO,KAC/BC,EAAAA,CAAaR,CAAAS,aAAbD,EAAmCR,CAAAU,QACvC,KAAIC,EAAgBA,QAAQ,CAACC,CAAD,CAAQ,CAClCR,CAAA,CAAUQ,CAAA,CACHC,CAAA,CAAQD,CAAR,CAAA,CACKA,CADL,CAEKA,CAAAE,MAAA,CAAY,QAAZ,CAHF,CAIJ,IACNb,EAAAc,SAAA,EANkC,CAShCP,EAAJ,EACEG,CAAA,CAAcb,CAAAkB,MAAA,CAAYR,CAAZ,CAAd,CACA,CAAAV,CAAAmB,iBAAA,CAAuBT,CAAvB,CAAmCG,CAAnC,CAFF,EAIEA,CAAA,CAAcN,CAAd,CAnB+D,KAsB7Da,CAtB6D,CAsB7CC,CACpBlB,EAAAmB,SAAA,CAAwBjB,CAAxB,CAAqCgB,CAArC,CAAmD,CACjDE,KAAMA,QAAQ,CAACC,CAAD,CAAO,CACHlB,IAAAA,EAAAA,CAsCtB,EAAA,CADEmB,CAAJ,CACSV,CAAA,CAAQU,CAAR,CAAA,CAC0B,CAD1B,EACDA,CAAAC,QAAA,CAvCyBF,CAuCzB,CADC,CAEDC,CAAAE,eAAA,CAxCyBH,CAwCzB,CAHR,CADiC,IAAA,EApCzB,OAAO,EADY,CAD4B,CAIjDI,OAAQA,QAAQ,EAAG,CACZR,CAAL,EACEhB,CAAA,CAAYJ,CAAZ,CAAmB,QAAQ,CAAC6B,CAAD,CAAM,CAC/BpC,CAAAqC,MAAA,CAAeD,CAAf;AAAoB,IAApB,CAA0B5B,CAA1B,CACAmB,EAAA,CAAiBS,CAIjB,KAAIE,EAAaX,CAAAW,WAAbA,CAAyC5B,CAAA6B,YAAA,EAK7CZ,EAAAa,GAAA,CAAkB,UAAlB,CAA8B,QAAQ,EAAG,CACnCb,CAAJ,EAAsBA,CAAAW,WAAtB,GAAoDA,CAApD,GACE5B,CAAA+B,WAAA,CAA0B7B,CAA1B,CACA,CAAAgB,CAAAc,OAAA,EAFF,CADuC,CAAzC,CAX+B,CAAjC,CAFe,CAJ8B,CA0BjDA,OAAQA,QAAQ,EAAG,CACjB,GAAIf,CAAJ,CAAoB,CAClB,IAAIS,EAAMT,CACVA,EAAA,CAAiB,IACjB3B,EAAA2C,MAAA,CAAeP,CAAf,CAHkB,CADH,CA1B8B,CAAnD,CAvBiE,CAN9D,CAD8B,CAAhC,CAD4B,CAtlBrC,IAAId,EAAUzB,CAAAyB,QAAd,CACIsB,EAAU/C,CAAA+C,QADd,CAEIC,EAAWhD,CAAAgD,SAFf,CAGIC,EAASjD,CAAAW,QA4ObX,EAAAkD,OAAA,CAAe,YAAf,CAA6B,EAA7B,CAAAC,UAAA,CA0Ec,YA1Ed,CA0E4B,CAAC,UAAD,CAAa,QAAQ,CAAChD,CAAD,CAAW,CA0JvDiD,QAASA,EAAY,CAAC1C,CAAD,CAAQ2C,CAAR,CAAc,CAClC,MAAQL,EAAA,CAASK,CAAT,CAAR,EAA0C,CAA1C,GAA0BA,CAAAC,OAA1B,EACOC,CAAA,CAAO7C,CAAAkB,MAAA,CAAYyB,CAAZ,CAAP,CAF2B,CAKnCE,QAASA,EAAM,CAACC,CAAD,CAAM,CACnB,MAAOR,EAAA,CAASQ,CAAT,CAAA,CAAgBA,CAAAF,OAAhB,CAA6B,CAAEE,CAAAA,CADnB,CA3JrB,MAAO,CACLhD,QAAS,YADJ,CAELJ,SAAU,IAFL,CAGLqD,WAAY,CAAC,UAAD,CAAa,QAAb,CAAuB,QAAvB,CAAiC,QAAQ,CAACC,CAAD;AAAWC,CAAX,CAAmBC,CAAnB,CAA2B,CAkG9EC,QAASA,EAAmB,CAACC,CAAD,CAASC,CAAT,CAAkB,CAG5C,IAFA,IAAIC,EAAWD,CAAf,CACIE,EAAe,EACnB,CAAOD,CAAP,EAAmBA,CAAnB,GAAgCF,CAAhC,CAAA,CAAwC,CACtC,IAAII,EAAUF,CAAAG,gBACd,IAAID,CAAJ,EAAeA,CAAAZ,OAAf,CACE,MAAOc,EAAA,CAASF,CAAT,CAKLF,EAAAK,WAAAf,OAAJ,EAAqE,EAArE,EAAkCW,CAAA7B,QAAA,CAAqB4B,CAArB,CAAlC,EACEC,CAAAK,KAAA,CAAkBN,CAAlB,CACA,CAAAA,CAAA,CAAWA,CAAAK,WAAA,CAAoBL,CAAAK,WAAAf,OAApB,CAAiD,CAAjD,CAFb,EAIEU,CAJF,CAIaA,CAAAO,gBAJb,EAIyCP,CAAAQ,WAZH,CAHI,CAjG9C,IAAIC,EAAO,IAAX,CACIC,EAAY,CADhB,CAEIC,EAAe,CAEnB,KAAAjC,YAAA,CAAmBkC,QAAoB,EAAG,CAAE,MAAOD,EAAA,EAAT,CAE1C,KAAIP,EAAW,IAAAA,SAAXA,CAA2B,EAA/B,CACIS,CADJ,CACiBC,CAEjB,KAAAC,OAAA,CAAcC,QAAQ,CAAC7C,CAAD,CAAa,CACjCA,CAAA,CAAaA,CAAb,EAA2B,EAE3B0C,EAAA,CAAc,CAAA,CACdC,EAAA,CAAmB3C,CAanB,KAVA,IAAI8C,EAAW7B,CAAA,CAAaO,CAAb,CAAqBC,CAAAsB,mBAArB,CAAXD,EACW7B,CAAA,CAAaO,CAAb,CAAqBC,CAAAqB,SAArB,CADf,CAGIE,EAAoB,EAHxB,CAIIC,EAAc,EAJlB,CAKIC,EAAcZ,CAAAa,KALlB,CAMIC,EAAe,CAAA,CANnB,CAOIC,EAAgB,CAGpB,CAAsB,IAAtB,EAAOH,CAAP,CAAA,CAA4B,CAC1BG,CAAA,EACA,KAAIzD,EAAcsD,CAAAI,QAAlB,CAEIC,EAAc,CAAA,CACbH,EAAL,EACExC,CAAA,CAAQZ,CAAR,CAAoB,QAAQ,CAACwD,CAAD,CAAQC,CAAR,CAAa,CAClCF,CAAAA,CAAL,EAAoBnC,CAAA,CAAOoC,CAAP,CAApB,EAAqC5D,CAAAE,KAAA,CAAiB2D,CAAjB,CAArC;AAEM,CAAAR,CAAA,CAAYQ,CAAZ,CAFN,GAKEF,CACA,CAHAN,CAAA,CAAYQ,CAAZ,CAGA,CAHmB,CAAA,CAGnB,CAAA7D,CAAAO,OAAA,EANF,CADuC,CAAzC,CAYEoD,EAAJ,CAGEH,CAHF,CAGiB,CAACN,CAHlB,CAKEE,CAAAb,KAAA,CAAuBvC,CAAvB,CAGFsD,EAAA,CAAcA,CAAAQ,KA1BY,CA6B5B9C,CAAA,CAAQoC,CAAR,CAA2B,QAAQ,CAACpD,CAAD,CAAc,CAC/CA,CAAAc,OAAA,EAD+C,CAAjD,CAIAsC,EAAA7B,OAAA,GAA6BkC,CAA7B,CACKrF,CAAA2F,SAAA,CAAkBpC,CAAlB,CAnEQqC,WAmER,CAlEUC,aAkEV,CADL,CAEK7F,CAAA2F,SAAA,CAAkBpC,CAAlB,CAnEUsC,aAmEV,CApEQD,WAoER,CApD4B,CAuDnCpC,EAAA9B,iBAAA,CAAwB+B,CAAAqC,WAAxB,EAA6CrC,CAAA,CAAO,KAAP,CAA7C,CAA4Da,CAAAM,OAA5D,CAEA,KAAApD,SAAA,CAAgBuE,QAAQ,EAAG,CACpBrB,CAAL,GACEA,CACA,CADc,CAAA,CACd,CAAAlB,CAAAwC,WAAA,CAAkB,QAAQ,EAAG,CACvBtB,CAAJ,EACEC,CADF,EACsBL,CAAAM,OAAA,CAAYD,CAAZ,CAFK,CAA7B,CAFF,CADyB,CAW3B,KAAA9C,SAAA,CAAgBoE,QAAQ,CAACrC,CAAD,CAAUhC,CAAV,CAAuB,CAC7C,IAAIsE,EAAU3B,CAAA4B,SAAA,EACdlC,EAAA,CAASiC,CAAT,CAAA,CAAoB,CAClBZ,QAAS1D,CADS,CAGF,KAAA,EAAA2B,CAAA,CAAS,CAAT,CAAA,CAoCd6C,EAAcnC,CAAA,CApCsBiC,CAoCtB,CACb5B,EAAAa,KAAL,CAIE,CADIkB,CACJ,CADY3C,CAAA,CAAoBC,CAApB,CAxCiBC,CAwCjB,CACZ,GACEwC,CAAAV,KACA,CADmBW,CAAAX,KACnB,CAAAW,CAAAX,KAAA,CAAaU,CAFf,GAIEA,CAAAV,KACA,CADmBpB,CAAAa,KACnB,CAAAb,CAAAa,KAAA,CAAYiB,CALd,CAJF,CACE9B,CAAAa,KADF,CACciB,CArCdxC,EAAAI,gBAAA,CAA0BkC,CAC1B3B,EAAA,EAEAD,EAAA9C,SAAA,EAT6C,CAY/C;IAAAiB,WAAA,CAAkB6D,QAAQ,CAAC1C,CAAD,CAAU,CAClC,IAAI6B,EAAM7B,CAAAI,gBACV,QAAOJ,CAAAI,gBA2CP,KAAIoC,EAAcnC,CAAA,CA1CsBwB,CA0CtB,CAGlB,EADIY,CACJ,CADY3C,CAAA,CA5CMH,CAAAI,CAAS,CAATA,CA4CN,CA5CmBC,CA4CnB,CACZ,EACEyC,CAAAX,KADF,CACeU,CAAAV,KADf,CAGEpB,CAAAa,KAHF,CAGciB,CAAAV,KA/Cd,QAAOzB,CAAA,CAASwB,CAAT,CACPnB,EAAA9C,SAAA,EALkC,CA1F0C,CAApE,CAHP,CAJgD,CAAhC,CA1E5B,CAAAwB,UAAA,CA4Qc,mBA5Qd,CA6QK,CAAC,kBAAD,CAAqB,WAArB,CAAkC,UAAlC,CAA8C,QAAQ,CAACuD,CAAD,CAAmBC,CAAnB,CAA8BC,CAA9B,CAAwC,CAE9F,MAAO,CACLxG,SAAU,IADL,CAELI,QAAS,cAFJ,CAGLC,KAAMA,QAAQ,CAACkD,CAAD,CAAShD,CAAT,CAAkBC,CAAlB,CAAyB,CACrC,IAAIiG,EAAMjG,CAAAkG,kBAAND,EAAiCjG,CAAAiG,IACrCH,EAAA,CAAiBG,CAAjB,CAAAE,KAAA,CAA2B,QAAQ,CAACC,CAAD,CAAO,CACxCJ,CAAA,CAASI,CAAT,CAAA,CAAerD,CAAf,CAAuB,QAAQ,CAACsD,CAAD,CAAW,CACxCtG,CAAAuG,MAAA,CAAcD,CAAd,CAGIE,EAAAA,CAASlE,CAAA,CAAO0D,CAAA,CAAU,CAAV,CAAAS,cAAA,CAA2B,sBAA3B,CAAoDP,CAApD,CAA0D,GAA1D,CAAP,CACblG,EAAAuG,MAAA,CAAcC,CAAd,CAGAxG,EAAA0G,OAAA,EARwC,CAA1C,CADwC,CAA1C,CAFqC,CAHlC,CAFuF,CAA9F,CA7QL,CAAAlE,UAAA,CAoUa,WApUb;AAoU0BjD,CAAA,EApU1B,CAAAiD,UAAA,CAqWa,cArWb,CAqW6BjD,CAAA,EArW7B,CAnPsC,CAArC,CAAD,CAyqBGH,MAzqBH,CAyqBWA,MAAAC,QAzqBX;",
+"sources":["angular-messages.js"],
+"names":["window","angular","undefined","ngMessageDirectiveFactory","$animate","restrict","transclude","priority","terminal","require","link","scope","element","attrs","ngMessagesCtrl","$transclude","commentNode","records","staticExp","ngMessage","when","dynamicExp","ngMessageExp","whenExp","assignRecords","items","isArray","split","reRender","$eval","$watchCollection","currentElement","messageCtrl","register","test","name","collection","indexOf","hasOwnProperty","attach","elm","enter","$$attachId","getAttachId","on","deregister","detach","leave","forEach","isString","jqLite","module","directive","isAttrTruthy","attr","length","truthy","val","controller","$element","$scope","$attrs","findPreviousMessage","parent","comment","prevNode","parentLookup","prevKey","$$ngMessageNode","messages","childNodes","push","previousSibling","parentNode","ctrl","latestKey","nextAttachId","this.getAttachId","renderLater","cachedCollection","render","this.render","multiple","ngMessagesMultiple","unmatchedMessages","matchedKeys","messageItem","head","messageFound","totalMessages","message","messageUsed","value","key","next","setClass","ACTIVE_CLASS","INACTIVE_CLASS","ngMessages","this.reRender","$evalAsync","this.register","nextKey","toString","messageNode","match","this.deregister","$templateRequest","$document","$compile","src","ngMessagesInclude","then","html","contents","after","anchor","createComment","remove"]
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-mocks.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-mocks.js
new file mode 100644
index 00000000..34d36087
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-mocks.js
@@ -0,0 +1,2842 @@
+/**
+ * @license AngularJS v1.5.0
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {
+
+'use strict';
+
+/**
+ * @ngdoc object
+ * @name angular.mock
+ * @description
+ *
+ * Namespace from 'angular-mocks.js' which contains testing related code.
+ */
+angular.mock = {};
+
+/**
+ * ! This is a private undocumented service !
+ *
+ * @name $browser
+ *
+ * @description
+ * This service is a mock implementation of {@link ng.$browser}. It provides fake
+ * implementation for commonly used browser apis that are hard to test, e.g. setTimeout, xhr,
+ * cookies, etc...
+ *
+ * The api of this service is the same as that of the real {@link ng.$browser $browser}, except
+ * that there are several helper methods available which can be used in tests.
+ */
+angular.mock.$BrowserProvider = function() {
+ this.$get = function() {
+ return new angular.mock.$Browser();
+ };
+};
+
+angular.mock.$Browser = function() {
+ var self = this;
+
+ this.isMock = true;
+ self.$$url = "http://server/";
+ self.$$lastUrl = self.$$url; // used by url polling fn
+ self.pollFns = [];
+
+ // TODO(vojta): remove this temporary api
+ self.$$completeOutstandingRequest = angular.noop;
+ self.$$incOutstandingRequestCount = angular.noop;
+
+
+ // register url polling fn
+
+ self.onUrlChange = function(listener) {
+ self.pollFns.push(
+ function() {
+ if (self.$$lastUrl !== self.$$url || self.$$state !== self.$$lastState) {
+ self.$$lastUrl = self.$$url;
+ self.$$lastState = self.$$state;
+ listener(self.$$url, self.$$state);
+ }
+ }
+ );
+
+ return listener;
+ };
+
+ self.$$applicationDestroyed = angular.noop;
+ self.$$checkUrlChange = angular.noop;
+
+ self.deferredFns = [];
+ self.deferredNextId = 0;
+
+ self.defer = function(fn, delay) {
+ delay = delay || 0;
+ self.deferredFns.push({time:(self.defer.now + delay), fn:fn, id: self.deferredNextId});
+ self.deferredFns.sort(function(a, b) { return a.time - b.time;});
+ return self.deferredNextId++;
+ };
+
+
+ /**
+ * @name $browser#defer.now
+ *
+ * @description
+ * Current milliseconds mock time.
+ */
+ self.defer.now = 0;
+
+
+ self.defer.cancel = function(deferId) {
+ var fnIndex;
+
+ angular.forEach(self.deferredFns, function(fn, index) {
+ if (fn.id === deferId) fnIndex = index;
+ });
+
+ if (angular.isDefined(fnIndex)) {
+ self.deferredFns.splice(fnIndex, 1);
+ return true;
+ }
+
+ return false;
+ };
+
+
+ /**
+ * @name $browser#defer.flush
+ *
+ * @description
+ * Flushes all pending requests and executes the defer callbacks.
+ *
+ * @param {number=} number of milliseconds to flush. See {@link #defer.now}
+ */
+ self.defer.flush = function(delay) {
+ if (angular.isDefined(delay)) {
+ self.defer.now += delay;
+ } else {
+ if (self.deferredFns.length) {
+ self.defer.now = self.deferredFns[self.deferredFns.length - 1].time;
+ } else {
+ throw new Error('No deferred tasks to be flushed');
+ }
+ }
+
+ while (self.deferredFns.length && self.deferredFns[0].time <= self.defer.now) {
+ self.deferredFns.shift().fn();
+ }
+ };
+
+ self.$$baseHref = '/';
+ self.baseHref = function() {
+ return this.$$baseHref;
+ };
+};
+angular.mock.$Browser.prototype = {
+
+/**
+ * @name $browser#poll
+ *
+ * @description
+ * run all fns in pollFns
+ */
+ poll: function poll() {
+ angular.forEach(this.pollFns, function(pollFn) {
+ pollFn();
+ });
+ },
+
+ url: function(url, replace, state) {
+ if (angular.isUndefined(state)) {
+ state = null;
+ }
+ if (url) {
+ this.$$url = url;
+ // Native pushState serializes & copies the object; simulate it.
+ this.$$state = angular.copy(state);
+ return this;
+ }
+
+ return this.$$url;
+ },
+
+ state: function() {
+ return this.$$state;
+ },
+
+ notifyWhenNoOutstandingRequests: function(fn) {
+ fn();
+ }
+};
+
+
+/**
+ * @ngdoc provider
+ * @name $exceptionHandlerProvider
+ *
+ * @description
+ * Configures the mock implementation of {@link ng.$exceptionHandler} to rethrow or to log errors
+ * passed to the `$exceptionHandler`.
+ */
+
+/**
+ * @ngdoc service
+ * @name $exceptionHandler
+ *
+ * @description
+ * Mock implementation of {@link ng.$exceptionHandler} that rethrows or logs errors passed
+ * to it. See {@link ngMock.$exceptionHandlerProvider $exceptionHandlerProvider} for configuration
+ * information.
+ *
+ *
+ * ```js
+ * describe('$exceptionHandlerProvider', function() {
+ *
+ * it('should capture log messages and exceptions', function() {
+ *
+ * module(function($exceptionHandlerProvider) {
+ * $exceptionHandlerProvider.mode('log');
+ * });
+ *
+ * inject(function($log, $exceptionHandler, $timeout) {
+ * $timeout(function() { $log.log(1); });
+ * $timeout(function() { $log.log(2); throw 'banana peel'; });
+ * $timeout(function() { $log.log(3); });
+ * expect($exceptionHandler.errors).toEqual([]);
+ * expect($log.assertEmpty());
+ * $timeout.flush();
+ * expect($exceptionHandler.errors).toEqual(['banana peel']);
+ * expect($log.log.logs).toEqual([[1], [2], [3]]);
+ * });
+ * });
+ * });
+ * ```
+ */
+
+angular.mock.$ExceptionHandlerProvider = function() {
+ var handler;
+
+ /**
+ * @ngdoc method
+ * @name $exceptionHandlerProvider#mode
+ *
+ * @description
+ * Sets the logging mode.
+ *
+ * @param {string} mode Mode of operation, defaults to `rethrow`.
+ *
+ * - `log`: Sometimes it is desirable to test that an error is thrown, for this case the `log`
+ * mode stores an array of errors in `$exceptionHandler.errors`, to allow later
+ * assertion of them. See {@link ngMock.$log#assertEmpty assertEmpty()} and
+ * {@link ngMock.$log#reset reset()}
+ * - `rethrow`: If any errors are passed to the handler in tests, it typically means that there
+ * is a bug in the application or test, so this mock will make these tests fail.
+ * For any implementations that expect exceptions to be thrown, the `rethrow` mode
+ * will also maintain a log of thrown errors.
+ */
+ this.mode = function(mode) {
+
+ switch (mode) {
+ case 'log':
+ case 'rethrow':
+ var errors = [];
+ handler = function(e) {
+ if (arguments.length == 1) {
+ errors.push(e);
+ } else {
+ errors.push([].slice.call(arguments, 0));
+ }
+ if (mode === "rethrow") {
+ throw e;
+ }
+ };
+ handler.errors = errors;
+ break;
+ default:
+ throw new Error("Unknown mode '" + mode + "', only 'log'/'rethrow' modes are allowed!");
+ }
+ };
+
+ this.$get = function() {
+ return handler;
+ };
+
+ this.mode('rethrow');
+};
+
+
+/**
+ * @ngdoc service
+ * @name $log
+ *
+ * @description
+ * Mock implementation of {@link ng.$log} that gathers all logged messages in arrays
+ * (one array per logging level). These arrays are exposed as `logs` property of each of the
+ * level-specific log function, e.g. for level `error` the array is exposed as `$log.error.logs`.
+ *
+ */
+angular.mock.$LogProvider = function() {
+ var debug = true;
+
+ function concat(array1, array2, index) {
+ return array1.concat(Array.prototype.slice.call(array2, index));
+ }
+
+ this.debugEnabled = function(flag) {
+ if (angular.isDefined(flag)) {
+ debug = flag;
+ return this;
+ } else {
+ return debug;
+ }
+ };
+
+ this.$get = function() {
+ var $log = {
+ log: function() { $log.log.logs.push(concat([], arguments, 0)); },
+ warn: function() { $log.warn.logs.push(concat([], arguments, 0)); },
+ info: function() { $log.info.logs.push(concat([], arguments, 0)); },
+ error: function() { $log.error.logs.push(concat([], arguments, 0)); },
+ debug: function() {
+ if (debug) {
+ $log.debug.logs.push(concat([], arguments, 0));
+ }
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $log#reset
+ *
+ * @description
+ * Reset all of the logging arrays to empty.
+ */
+ $log.reset = function() {
+ /**
+ * @ngdoc property
+ * @name $log#log.logs
+ *
+ * @description
+ * Array of messages logged using {@link ng.$log#log `log()`}.
+ *
+ * @example
+ * ```js
+ * $log.log('Some Log');
+ * var first = $log.log.logs.unshift();
+ * ```
+ */
+ $log.log.logs = [];
+ /**
+ * @ngdoc property
+ * @name $log#info.logs
+ *
+ * @description
+ * Array of messages logged using {@link ng.$log#info `info()`}.
+ *
+ * @example
+ * ```js
+ * $log.info('Some Info');
+ * var first = $log.info.logs.unshift();
+ * ```
+ */
+ $log.info.logs = [];
+ /**
+ * @ngdoc property
+ * @name $log#warn.logs
+ *
+ * @description
+ * Array of messages logged using {@link ng.$log#warn `warn()`}.
+ *
+ * @example
+ * ```js
+ * $log.warn('Some Warning');
+ * var first = $log.warn.logs.unshift();
+ * ```
+ */
+ $log.warn.logs = [];
+ /**
+ * @ngdoc property
+ * @name $log#error.logs
+ *
+ * @description
+ * Array of messages logged using {@link ng.$log#error `error()`}.
+ *
+ * @example
+ * ```js
+ * $log.error('Some Error');
+ * var first = $log.error.logs.unshift();
+ * ```
+ */
+ $log.error.logs = [];
+ /**
+ * @ngdoc property
+ * @name $log#debug.logs
+ *
+ * @description
+ * Array of messages logged using {@link ng.$log#debug `debug()`}.
+ *
+ * @example
+ * ```js
+ * $log.debug('Some Error');
+ * var first = $log.debug.logs.unshift();
+ * ```
+ */
+ $log.debug.logs = [];
+ };
+
+ /**
+ * @ngdoc method
+ * @name $log#assertEmpty
+ *
+ * @description
+ * Assert that all of the logging methods have no logged messages. If any messages are present,
+ * an exception is thrown.
+ */
+ $log.assertEmpty = function() {
+ var errors = [];
+ angular.forEach(['error', 'warn', 'info', 'log', 'debug'], function(logLevel) {
+ angular.forEach($log[logLevel].logs, function(log) {
+ angular.forEach(log, function(logItem) {
+ errors.push('MOCK $log (' + logLevel + '): ' + String(logItem) + '\n' +
+ (logItem.stack || ''));
+ });
+ });
+ });
+ if (errors.length) {
+ errors.unshift("Expected $log to be empty! Either a message was logged unexpectedly, or " +
+ "an expected log message was not checked and removed:");
+ errors.push('');
+ throw new Error(errors.join('\n---------\n'));
+ }
+ };
+
+ $log.reset();
+ return $log;
+ };
+};
+
+
+/**
+ * @ngdoc service
+ * @name $interval
+ *
+ * @description
+ * Mock implementation of the $interval service.
+ *
+ * Use {@link ngMock.$interval#flush `$interval.flush(millis)`} to
+ * move forward by `millis` milliseconds and trigger any functions scheduled to run in that
+ * time.
+ *
+ * @param {function()} fn A function that should be called repeatedly.
+ * @param {number} delay Number of milliseconds between each function call.
+ * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat
+ * indefinitely.
+ * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
+ * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
+ * @param {...*=} Pass additional parameters to the executed function.
+ * @returns {promise} A promise which will be notified on each iteration.
+ */
+angular.mock.$IntervalProvider = function() {
+ this.$get = ['$browser', '$rootScope', '$q', '$$q',
+ function($browser, $rootScope, $q, $$q) {
+ var repeatFns = [],
+ nextRepeatId = 0,
+ now = 0;
+
+ var $interval = function(fn, delay, count, invokeApply) {
+ var hasParams = arguments.length > 4,
+ args = hasParams ? Array.prototype.slice.call(arguments, 4) : [],
+ iteration = 0,
+ skipApply = (angular.isDefined(invokeApply) && !invokeApply),
+ deferred = (skipApply ? $$q : $q).defer(),
+ promise = deferred.promise;
+
+ count = (angular.isDefined(count)) ? count : 0;
+ promise.then(null, null, (!hasParams) ? fn : function() {
+ fn.apply(null, args);
+ });
+
+ promise.$$intervalId = nextRepeatId;
+
+ function tick() {
+ deferred.notify(iteration++);
+
+ if (count > 0 && iteration >= count) {
+ var fnIndex;
+ deferred.resolve(iteration);
+
+ angular.forEach(repeatFns, function(fn, index) {
+ if (fn.id === promise.$$intervalId) fnIndex = index;
+ });
+
+ if (angular.isDefined(fnIndex)) {
+ repeatFns.splice(fnIndex, 1);
+ }
+ }
+
+ if (skipApply) {
+ $browser.defer.flush();
+ } else {
+ $rootScope.$apply();
+ }
+ }
+
+ repeatFns.push({
+ nextTime:(now + delay),
+ delay: delay,
+ fn: tick,
+ id: nextRepeatId,
+ deferred: deferred
+ });
+ repeatFns.sort(function(a, b) { return a.nextTime - b.nextTime;});
+
+ nextRepeatId++;
+ return promise;
+ };
+ /**
+ * @ngdoc method
+ * @name $interval#cancel
+ *
+ * @description
+ * Cancels a task associated with the `promise`.
+ *
+ * @param {promise} promise A promise from calling the `$interval` function.
+ * @returns {boolean} Returns `true` if the task was successfully cancelled.
+ */
+ $interval.cancel = function(promise) {
+ if (!promise) return false;
+ var fnIndex;
+
+ angular.forEach(repeatFns, function(fn, index) {
+ if (fn.id === promise.$$intervalId) fnIndex = index;
+ });
+
+ if (angular.isDefined(fnIndex)) {
+ repeatFns[fnIndex].deferred.reject('canceled');
+ repeatFns.splice(fnIndex, 1);
+ return true;
+ }
+
+ return false;
+ };
+
+ /**
+ * @ngdoc method
+ * @name $interval#flush
+ * @description
+ *
+ * Runs interval tasks scheduled to be run in the next `millis` milliseconds.
+ *
+ * @param {number=} millis maximum timeout amount to flush up until.
+ *
+ * @return {number} The amount of time moved forward.
+ */
+ $interval.flush = function(millis) {
+ now += millis;
+ while (repeatFns.length && repeatFns[0].nextTime <= now) {
+ var task = repeatFns[0];
+ task.fn();
+ task.nextTime += task.delay;
+ repeatFns.sort(function(a, b) { return a.nextTime - b.nextTime;});
+ }
+ return millis;
+ };
+
+ return $interval;
+ }];
+};
+
+
+/* jshint -W101 */
+/* The R_ISO8061_STR regex is never going to fit into the 100 char limit!
+ * This directive should go inside the anonymous function but a bug in JSHint means that it would
+ * not be enacted early enough to prevent the warning.
+ */
+var R_ISO8061_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?:\:?(\d\d)(?:\:?(\d\d)(?:\.(\d{3}))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/;
+
+function jsonStringToDate(string) {
+ var match;
+ if (match = string.match(R_ISO8061_STR)) {
+ var date = new Date(0),
+ tzHour = 0,
+ tzMin = 0;
+ if (match[9]) {
+ tzHour = toInt(match[9] + match[10]);
+ tzMin = toInt(match[9] + match[11]);
+ }
+ date.setUTCFullYear(toInt(match[1]), toInt(match[2]) - 1, toInt(match[3]));
+ date.setUTCHours(toInt(match[4] || 0) - tzHour,
+ toInt(match[5] || 0) - tzMin,
+ toInt(match[6] || 0),
+ toInt(match[7] || 0));
+ return date;
+ }
+ return string;
+}
+
+function toInt(str) {
+ return parseInt(str, 10);
+}
+
+function padNumber(num, digits, trim) {
+ var neg = '';
+ if (num < 0) {
+ neg = '-';
+ num = -num;
+ }
+ num = '' + num;
+ while (num.length < digits) num = '0' + num;
+ if (trim) {
+ num = num.substr(num.length - digits);
+ }
+ return neg + num;
+}
+
+
+/**
+ * @ngdoc type
+ * @name angular.mock.TzDate
+ * @description
+ *
+ * *NOTE*: this is not an injectable instance, just a globally available mock class of `Date`.
+ *
+ * Mock of the Date type which has its timezone specified via constructor arg.
+ *
+ * The main purpose is to create Date-like instances with timezone fixed to the specified timezone
+ * offset, so that we can test code that depends on local timezone settings without dependency on
+ * the time zone settings of the machine where the code is running.
+ *
+ * @param {number} offset Offset of the *desired* timezone in hours (fractions will be honored)
+ * @param {(number|string)} timestamp Timestamp representing the desired time in *UTC*
+ *
+ * @example
+ * !!!! WARNING !!!!!
+ * This is not a complete Date object so only methods that were implemented can be called safely.
+ * To make matters worse, TzDate instances inherit stuff from Date via a prototype.
+ *
+ * We do our best to intercept calls to "unimplemented" methods, but since the list of methods is
+ * incomplete we might be missing some non-standard methods. This can result in errors like:
+ * "Date.prototype.foo called on incompatible Object".
+ *
+ * ```js
+ * var newYearInBratislava = new TzDate(-1, '2009-12-31T23:00:00Z');
+ * newYearInBratislava.getTimezoneOffset() => -60;
+ * newYearInBratislava.getFullYear() => 2010;
+ * newYearInBratislava.getMonth() => 0;
+ * newYearInBratislava.getDate() => 1;
+ * newYearInBratislava.getHours() => 0;
+ * newYearInBratislava.getMinutes() => 0;
+ * newYearInBratislava.getSeconds() => 0;
+ * ```
+ *
+ */
+angular.mock.TzDate = function(offset, timestamp) {
+ var self = new Date(0);
+ if (angular.isString(timestamp)) {
+ var tsStr = timestamp;
+
+ self.origDate = jsonStringToDate(timestamp);
+
+ timestamp = self.origDate.getTime();
+ if (isNaN(timestamp)) {
+ throw {
+ name: "Illegal Argument",
+ message: "Arg '" + tsStr + "' passed into TzDate constructor is not a valid date string"
+ };
+ }
+ } else {
+ self.origDate = new Date(timestamp);
+ }
+
+ var localOffset = new Date(timestamp).getTimezoneOffset();
+ self.offsetDiff = localOffset * 60 * 1000 - offset * 1000 * 60 * 60;
+ self.date = new Date(timestamp + self.offsetDiff);
+
+ self.getTime = function() {
+ return self.date.getTime() - self.offsetDiff;
+ };
+
+ self.toLocaleDateString = function() {
+ return self.date.toLocaleDateString();
+ };
+
+ self.getFullYear = function() {
+ return self.date.getFullYear();
+ };
+
+ self.getMonth = function() {
+ return self.date.getMonth();
+ };
+
+ self.getDate = function() {
+ return self.date.getDate();
+ };
+
+ self.getHours = function() {
+ return self.date.getHours();
+ };
+
+ self.getMinutes = function() {
+ return self.date.getMinutes();
+ };
+
+ self.getSeconds = function() {
+ return self.date.getSeconds();
+ };
+
+ self.getMilliseconds = function() {
+ return self.date.getMilliseconds();
+ };
+
+ self.getTimezoneOffset = function() {
+ return offset * 60;
+ };
+
+ self.getUTCFullYear = function() {
+ return self.origDate.getUTCFullYear();
+ };
+
+ self.getUTCMonth = function() {
+ return self.origDate.getUTCMonth();
+ };
+
+ self.getUTCDate = function() {
+ return self.origDate.getUTCDate();
+ };
+
+ self.getUTCHours = function() {
+ return self.origDate.getUTCHours();
+ };
+
+ self.getUTCMinutes = function() {
+ return self.origDate.getUTCMinutes();
+ };
+
+ self.getUTCSeconds = function() {
+ return self.origDate.getUTCSeconds();
+ };
+
+ self.getUTCMilliseconds = function() {
+ return self.origDate.getUTCMilliseconds();
+ };
+
+ self.getDay = function() {
+ return self.date.getDay();
+ };
+
+ // provide this method only on browsers that already have it
+ if (self.toISOString) {
+ self.toISOString = function() {
+ return padNumber(self.origDate.getUTCFullYear(), 4) + '-' +
+ padNumber(self.origDate.getUTCMonth() + 1, 2) + '-' +
+ padNumber(self.origDate.getUTCDate(), 2) + 'T' +
+ padNumber(self.origDate.getUTCHours(), 2) + ':' +
+ padNumber(self.origDate.getUTCMinutes(), 2) + ':' +
+ padNumber(self.origDate.getUTCSeconds(), 2) + '.' +
+ padNumber(self.origDate.getUTCMilliseconds(), 3) + 'Z';
+ };
+ }
+
+ //hide all methods not implemented in this mock that the Date prototype exposes
+ var unimplementedMethods = ['getUTCDay',
+ 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds',
+ 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear',
+ 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds',
+ 'setYear', 'toDateString', 'toGMTString', 'toJSON', 'toLocaleFormat', 'toLocaleString',
+ 'toLocaleTimeString', 'toSource', 'toString', 'toTimeString', 'toUTCString', 'valueOf'];
+
+ angular.forEach(unimplementedMethods, function(methodName) {
+ self[methodName] = function() {
+ throw new Error("Method '" + methodName + "' is not implemented in the TzDate mock");
+ };
+ });
+
+ return self;
+};
+
+//make "tzDateInstance instanceof Date" return true
+angular.mock.TzDate.prototype = Date.prototype;
+/* jshint +W101 */
+
+
+/**
+ * @ngdoc service
+ * @name $animate
+ *
+ * @description
+ * Mock implementation of the {@link ng.$animate `$animate`} service. Exposes two additional methods
+ * for testing animations.
+ */
+angular.mock.animate = angular.module('ngAnimateMock', ['ng'])
+
+ .config(['$provide', function($provide) {
+
+ $provide.factory('$$forceReflow', function() {
+ function reflowFn() {
+ reflowFn.totalReflows++;
+ }
+ reflowFn.totalReflows = 0;
+ return reflowFn;
+ });
+
+ $provide.factory('$$animateAsyncRun', function() {
+ var queue = [];
+ var queueFn = function() {
+ return function(fn) {
+ queue.push(fn);
+ };
+ };
+ queueFn.flush = function() {
+ if (queue.length === 0) return false;
+
+ for (var i = 0; i < queue.length; i++) {
+ queue[i]();
+ }
+ queue = [];
+
+ return true;
+ };
+ return queueFn;
+ });
+
+ $provide.decorator('$$animateJs', ['$delegate', function($delegate) {
+ var runners = [];
+
+ var animateJsConstructor = function() {
+ var animator = $delegate.apply($delegate, arguments);
+ // If no javascript animation is found, animator is undefined
+ if (animator) {
+ runners.push(animator);
+ }
+ return animator;
+ };
+
+ animateJsConstructor.$closeAndFlush = function() {
+ runners.forEach(function(runner) {
+ runner.end();
+ });
+ runners = [];
+ };
+
+ return animateJsConstructor;
+ }]);
+
+ $provide.decorator('$animateCss', ['$delegate', function($delegate) {
+ var runners = [];
+
+ var animateCssConstructor = function(element, options) {
+ var animator = $delegate(element, options);
+ runners.push(animator);
+ return animator;
+ };
+
+ animateCssConstructor.$closeAndFlush = function() {
+ runners.forEach(function(runner) {
+ runner.end();
+ });
+ runners = [];
+ };
+
+ return animateCssConstructor;
+ }]);
+
+ $provide.decorator('$animate', ['$delegate', '$timeout', '$browser', '$$rAF', '$animateCss', '$$animateJs',
+ '$$forceReflow', '$$animateAsyncRun', '$rootScope',
+ function($delegate, $timeout, $browser, $$rAF, $animateCss, $$animateJs,
+ $$forceReflow, $$animateAsyncRun, $rootScope) {
+ var animate = {
+ queue: [],
+ cancel: $delegate.cancel,
+ on: $delegate.on,
+ off: $delegate.off,
+ pin: $delegate.pin,
+ get reflows() {
+ return $$forceReflow.totalReflows;
+ },
+ enabled: $delegate.enabled,
+ /**
+ * @ngdoc method
+ * @name $animate#closeAndFlush
+ * @description
+ *
+ * This method will close all pending animations (both {@link ngAnimate#javascript-based-animations Javascript}
+ * and {@link ngAnimate.$animateCss CSS}) and it will also flush any remaining animation frames and/or callbacks.
+ */
+ closeAndFlush: function() {
+ // we allow the flush command to swallow the errors
+ // because depending on whether CSS or JS animations are
+ // used, there may not be a RAF flush. The primary flush
+ // at the end of this function must throw an exception
+ // because it will track if there were pending animations
+ this.flush(true);
+ $animateCss.$closeAndFlush();
+ $$animateJs.$closeAndFlush();
+ this.flush();
+ },
+ /**
+ * @ngdoc method
+ * @name $animate#flush
+ * @description
+ *
+ * This method is used to flush the pending callbacks and animation frames to either start
+ * an animation or conclude an animation. Note that this will not actually close an
+ * actively running animation (see {@link ngMock.$animate#closeAndFlush `closeAndFlush()`} for that).
+ */
+ flush: function(hideErrors) {
+ $rootScope.$digest();
+
+ var doNextRun, somethingFlushed = false;
+ do {
+ doNextRun = false;
+
+ if ($$rAF.queue.length) {
+ $$rAF.flush();
+ doNextRun = somethingFlushed = true;
+ }
+
+ if ($$animateAsyncRun.flush()) {
+ doNextRun = somethingFlushed = true;
+ }
+ } while (doNextRun);
+
+ if (!somethingFlushed && !hideErrors) {
+ throw new Error('No pending animations ready to be closed or flushed');
+ }
+
+ $rootScope.$digest();
+ }
+ };
+
+ angular.forEach(
+ ['animate','enter','leave','move','addClass','removeClass','setClass'], function(method) {
+ animate[method] = function() {
+ animate.queue.push({
+ event: method,
+ element: arguments[0],
+ options: arguments[arguments.length - 1],
+ args: arguments
+ });
+ return $delegate[method].apply($delegate, arguments);
+ };
+ });
+
+ return animate;
+ }]);
+
+ }]);
+
+
+/**
+ * @ngdoc function
+ * @name angular.mock.dump
+ * @description
+ *
+ * *NOTE*: this is not an injectable instance, just a globally available function.
+ *
+ * Method for serializing common angular objects (scope, elements, etc..) into strings, useful for
+ * debugging.
+ *
+ * This method is also available on window, where it can be used to display objects on debug
+ * console.
+ *
+ * @param {*} object - any object to turn into string.
+ * @return {string} a serialized string of the argument
+ */
+angular.mock.dump = function(object) {
+ return serialize(object);
+
+ function serialize(object) {
+ var out;
+
+ if (angular.isElement(object)) {
+ object = angular.element(object);
+ out = angular.element('<div></div>');
+ angular.forEach(object, function(element) {
+ out.append(angular.element(element).clone());
+ });
+ out = out.html();
+ } else if (angular.isArray(object)) {
+ out = [];
+ angular.forEach(object, function(o) {
+ out.push(serialize(o));
+ });
+ out = '[ ' + out.join(', ') + ' ]';
+ } else if (angular.isObject(object)) {
+ if (angular.isFunction(object.$eval) && angular.isFunction(object.$apply)) {
+ out = serializeScope(object);
+ } else if (object instanceof Error) {
+ out = object.stack || ('' + object.name + ': ' + object.message);
+ } else {
+ // TODO(i): this prevents methods being logged,
+ // we should have a better way to serialize objects
+ out = angular.toJson(object, true);
+ }
+ } else {
+ out = String(object);
+ }
+
+ return out;
+ }
+
+ function serializeScope(scope, offset) {
+ offset = offset || ' ';
+ var log = [offset + 'Scope(' + scope.$id + '): {'];
+ for (var key in scope) {
+ if (Object.prototype.hasOwnProperty.call(scope, key) && !key.match(/^(\$|this)/)) {
+ log.push(' ' + key + ': ' + angular.toJson(scope[key]));
+ }
+ }
+ var child = scope.$$childHead;
+ while (child) {
+ log.push(serializeScope(child, offset + ' '));
+ child = child.$$nextSibling;
+ }
+ log.push('}');
+ return log.join('\n' + offset);
+ }
+};
+
+/**
+ * @ngdoc service
+ * @name $httpBackend
+ * @description
+ * Fake HTTP backend implementation suitable for unit testing applications that use the
+ * {@link ng.$http $http service}.
+ *
+ * *Note*: For fake HTTP backend implementation suitable for end-to-end testing or backend-less
+ * development please see {@link ngMockE2E.$httpBackend e2e $httpBackend mock}.
+ *
+ * During unit testing, we want our unit tests to run quickly and have no external dependencies so
+ * we don’t want to send [XHR](https://developer.mozilla.org/en/xmlhttprequest) or
+ * [JSONP](http://en.wikipedia.org/wiki/JSONP) requests to a real server. All we really need is
+ * to verify whether a certain request has been sent or not, or alternatively just let the
+ * application make requests, respond with pre-trained responses and assert that the end result is
+ * what we expect it to be.
+ *
+ * This mock implementation can be used to respond with static or dynamic responses via the
+ * `expect` and `when` apis and their shortcuts (`expectGET`, `whenPOST`, etc).
+ *
+ * When an Angular application needs some data from a server, it calls the $http service, which
+ * sends the request to a real server using $httpBackend service. With dependency injection, it is
+ * easy to inject $httpBackend mock (which has the same API as $httpBackend) and use it to verify
+ * the requests and respond with some testing data without sending a request to a real server.
+ *
+ * There are two ways to specify what test data should be returned as http responses by the mock
+ * backend when the code under test makes http requests:
+ *
+ * - `$httpBackend.expect` - specifies a request expectation
+ * - `$httpBackend.when` - specifies a backend definition
+ *
+ *
+ * ## Request Expectations vs Backend Definitions
+ *
+ * Request expectations provide a way to make assertions about requests made by the application and
+ * to define responses for those requests. The test will fail if the expected requests are not made
+ * or they are made in the wrong order.
+ *
+ * Backend definitions allow you to define a fake backend for your application which doesn't assert
+ * if a particular request was made or not, it just returns a trained response if a request is made.
+ * The test will pass whether or not the request gets made during testing.
+ *
+ *
+ * <table class="table">
+ * <tr><th width="220px"></th><th>Request expectations</th><th>Backend definitions</th></tr>
+ * <tr>
+ * <th>Syntax</th>
+ * <td>.expect(...).respond(...)</td>
+ * <td>.when(...).respond(...)</td>
+ * </tr>
+ * <tr>
+ * <th>Typical usage</th>
+ * <td>strict unit tests</td>
+ * <td>loose (black-box) unit testing</td>
+ * </tr>
+ * <tr>
+ * <th>Fulfills multiple requests</th>
+ * <td>NO</td>
+ * <td>YES</td>
+ * </tr>
+ * <tr>
+ * <th>Order of requests matters</th>
+ * <td>YES</td>
+ * <td>NO</td>
+ * </tr>
+ * <tr>
+ * <th>Request required</th>
+ * <td>YES</td>
+ * <td>NO</td>
+ * </tr>
+ * <tr>
+ * <th>Response required</th>
+ * <td>optional (see below)</td>
+ * <td>YES</td>
+ * </tr>
+ * </table>
+ *
+ * In cases where both backend definitions and request expectations are specified during unit
+ * testing, the request expectations are evaluated first.
+ *
+ * If a request expectation has no response specified, the algorithm will search your backend
+ * definitions for an appropriate response.
+ *
+ * If a request didn't match any expectation or if the expectation doesn't have the response
+ * defined, the backend definitions are evaluated in sequential order to see if any of them match
+ * the request. The response from the first matched definition is returned.
+ *
+ *
+ * ## Flushing HTTP requests
+ *
+ * The $httpBackend used in production always responds to requests asynchronously. If we preserved
+ * this behavior in unit testing, we'd have to create async unit tests, which are hard to write,
+ * to follow and to maintain. But neither can the testing mock respond synchronously; that would
+ * change the execution of the code under test. For this reason, the mock $httpBackend has a
+ * `flush()` method, which allows the test to explicitly flush pending requests. This preserves
+ * the async api of the backend, while allowing the test to execute synchronously.
+ *
+ *
+ * ## Unit testing with mock $httpBackend
+ * The following code shows how to setup and use the mock backend when unit testing a controller.
+ * First we create the controller under test:
+ *
+ ```js
+ // The module code
+ angular
+ .module('MyApp', [])
+ .controller('MyController', MyController);
+
+ // The controller code
+ function MyController($scope, $http) {
+ var authToken;
+
+ $http.get('/auth.py').then(function(response) {
+ authToken = response.headers('A-Token');
+ $scope.user = response.data;
+ });
+
+ $scope.saveMessage = function(message) {
+ var headers = { 'Authorization': authToken };
+ $scope.status = 'Saving...';
+
+ $http.post('/add-msg.py', message, { headers: headers } ).then(function(response) {
+ $scope.status = '';
+ }).catch(function() {
+ $scope.status = 'Failed...';
+ });
+ };
+ }
+ ```
+ *
+ * Now we setup the mock backend and create the test specs:
+ *
+ ```js
+ // testing controller
+ describe('MyController', function() {
+ var $httpBackend, $rootScope, createController, authRequestHandler;
+
+ // Set up the module
+ beforeEach(module('MyApp'));
+
+ beforeEach(inject(function($injector) {
+ // Set up the mock http service responses
+ $httpBackend = $injector.get('$httpBackend');
+ // backend definition common for all tests
+ authRequestHandler = $httpBackend.when('GET', '/auth.py')
+ .respond({userId: 'userX'}, {'A-Token': 'xxx'});
+
+ // Get hold of a scope (i.e. the root scope)
+ $rootScope = $injector.get('$rootScope');
+ // The $controller service is used to create instances of controllers
+ var $controller = $injector.get('$controller');
+
+ createController = function() {
+ return $controller('MyController', {'$scope' : $rootScope });
+ };
+ }));
+
+
+ afterEach(function() {
+ $httpBackend.verifyNoOutstandingExpectation();
+ $httpBackend.verifyNoOutstandingRequest();
+ });
+
+
+ it('should fetch authentication token', function() {
+ $httpBackend.expectGET('/auth.py');
+ var controller = createController();
+ $httpBackend.flush();
+ });
+
+
+ it('should fail authentication', function() {
+
+ // Notice how you can change the response even after it was set
+ authRequestHandler.respond(401, '');
+
+ $httpBackend.expectGET('/auth.py');
+ var controller = createController();
+ $httpBackend.flush();
+ expect($rootScope.status).toBe('Failed...');
+ });
+
+
+ it('should send msg to server', function() {
+ var controller = createController();
+ $httpBackend.flush();
+
+ // now you don’t care about the authentication, but
+ // the controller will still send the request and
+ // $httpBackend will respond without you having to
+ // specify the expectation and response for this request
+
+ $httpBackend.expectPOST('/add-msg.py', 'message content').respond(201, '');
+ $rootScope.saveMessage('message content');
+ expect($rootScope.status).toBe('Saving...');
+ $httpBackend.flush();
+ expect($rootScope.status).toBe('');
+ });
+
+
+ it('should send auth header', function() {
+ var controller = createController();
+ $httpBackend.flush();
+
+ $httpBackend.expectPOST('/add-msg.py', undefined, function(headers) {
+ // check if the header was sent, if it wasn't the expectation won't
+ // match the request and the test will fail
+ return headers['Authorization'] == 'xxx';
+ }).respond(201, '');
+
+ $rootScope.saveMessage('whatever');
+ $httpBackend.flush();
+ });
+ });
+ ```
+ *
+ * ## Dynamic responses
+ *
+ * You define a response to a request by chaining a call to `respond()` onto a definition or expectation.
+ * If you provide a **callback** as the first parameter to `respond(callback)` then you can dynamically generate
+ * a response based on the properties of the request.
+ *
+ * The `callback` function should be of the form `function(method, url, data, headers, params)`.
+ *
+ * ### Query parameters
+ *
+ * By default, query parameters on request URLs are parsed into the `params` object. So a request URL
+ * of `/list?q=searchstr&orderby=-name` would set `params` to be `{q: 'searchstr', orderby: '-name'}`.
+ *
+ * ### Regex parameter matching
+ *
+ * If an expectation or definition uses a **regex** to match the URL, you can provide an array of **keys** via a
+ * `params` argument. The index of each **key** in the array will match the index of a **group** in the
+ * **regex**.
+ *
+ * The `params` object in the **callback** will now have properties with these keys, which hold the value of the
+ * corresponding **group** in the **regex**.
+ *
+ * This also applies to the `when` and `expect` shortcut methods.
+ *
+ *
+ * ```js
+ * $httpBackend.expect('GET', /\/user\/(.+)/, undefined, undefined, ['id'])
+ * .respond(function(method, url, data, headers, params) {
+ * // for requested url of '/user/1234' params is {id: '1234'}
+ * });
+ *
+ * $httpBackend.whenPATCH(/\/user\/(.+)\/article\/(.+)/, undefined, undefined, ['user', 'article'])
+ * .respond(function(method, url, data, headers, params) {
+ * // for url of '/user/1234/article/567' params is {user: '1234', article: '567'}
+ * });
+ * ```
+ *
+ * ## Matching route requests
+ *
+ * For extra convenience, `whenRoute` and `expectRoute` shortcuts are available. These methods offer colon
+ * delimited matching of the url path, ignoring the query string. This allows declarations
+ * similar to how application routes are configured with `$routeProvider`. Because these methods convert
+ * the definition url to regex, declaration order is important. Combined with query parameter parsing,
+ * the following is possible:
+ *
+ ```js
+ $httpBackend.whenRoute('GET', '/users/:id')
+ .respond(function(method, url, data, headers, params) {
+ return [200, MockUserList[Number(params.id)]];
+ });
+
+ $httpBackend.whenRoute('GET', '/users')
+ .respond(function(method, url, data, headers, params) {
+ var userList = angular.copy(MockUserList),
+ defaultSort = 'lastName',
+ count, pages, isPrevious, isNext;
+
+ // paged api response '/v1/users?page=2'
+ params.page = Number(params.page) || 1;
+
+ // query for last names '/v1/users?q=Archer'
+ if (params.q) {
+ userList = $filter('filter')({lastName: params.q});
+ }
+
+ pages = Math.ceil(userList.length / pagingLength);
+ isPrevious = params.page > 1;
+ isNext = params.page < pages;
+
+ return [200, {
+ count: userList.length,
+ previous: isPrevious,
+ next: isNext,
+ // sort field -> '/v1/users?sortBy=firstName'
+ results: $filter('orderBy')(userList, params.sortBy || defaultSort)
+ .splice((params.page - 1) * pagingLength, pagingLength)
+ }];
+ });
+ ```
+ */
+angular.mock.$HttpBackendProvider = function() {
+ this.$get = ['$rootScope', '$timeout', createHttpBackendMock];
+};
+
+/**
+ * General factory function for $httpBackend mock.
+ * Returns instance for unit testing (when no arguments specified):
+ * - passing through is disabled
+ * - auto flushing is disabled
+ *
+ * Returns instance for e2e testing (when `$delegate` and `$browser` specified):
+ * - passing through (delegating request to real backend) is enabled
+ * - auto flushing is enabled
+ *
+ * @param {Object=} $delegate Real $httpBackend instance (allow passing through if specified)
+ * @param {Object=} $browser Auto-flushing enabled if specified
+ * @return {Object} Instance of $httpBackend mock
+ */
+function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
+ var definitions = [],
+ expectations = [],
+ responses = [],
+ responsesPush = angular.bind(responses, responses.push),
+ copy = angular.copy;
+
+ function createResponse(status, data, headers, statusText) {
+ if (angular.isFunction(status)) return status;
+
+ return function() {
+ return angular.isNumber(status)
+ ? [status, data, headers, statusText]
+ : [200, status, data, headers];
+ };
+ }
+
+ // TODO(vojta): change params to: method, url, data, headers, callback
+ function $httpBackend(method, url, data, callback, headers, timeout, withCredentials) {
+ var xhr = new MockXhr(),
+ expectation = expectations[0],
+ wasExpected = false;
+
+ function prettyPrint(data) {
+ return (angular.isString(data) || angular.isFunction(data) || data instanceof RegExp)
+ ? data
+ : angular.toJson(data);
+ }
+
+ function wrapResponse(wrapped) {
+ if (!$browser && timeout) {
+ timeout.then ? timeout.then(handleTimeout) : $timeout(handleTimeout, timeout);
+ }
+
+ return handleResponse;
+
+ function handleResponse() {
+ var response = wrapped.response(method, url, data, headers, wrapped.params(url));
+ xhr.$$respHeaders = response[2];
+ callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders(),
+ copy(response[3] || ''));
+ }
+
+ function handleTimeout() {
+ for (var i = 0, ii = responses.length; i < ii; i++) {
+ if (responses[i] === handleResponse) {
+ responses.splice(i, 1);
+ callback(-1, undefined, '');
+ break;
+ }
+ }
+ }
+ }
+
+ if (expectation && expectation.match(method, url)) {
+ if (!expectation.matchData(data)) {
+ throw new Error('Expected ' + expectation + ' with different data\n' +
+ 'EXPECTED: ' + prettyPrint(expectation.data) + '\nGOT: ' + data);
+ }
+
+ if (!expectation.matchHeaders(headers)) {
+ throw new Error('Expected ' + expectation + ' with different headers\n' +
+ 'EXPECTED: ' + prettyPrint(expectation.headers) + '\nGOT: ' +
+ prettyPrint(headers));
+ }
+
+ expectations.shift();
+
+ if (expectation.response) {
+ responses.push(wrapResponse(expectation));
+ return;
+ }
+ wasExpected = true;
+ }
+
+ var i = -1, definition;
+ while ((definition = definitions[++i])) {
+ if (definition.match(method, url, data, headers || {})) {
+ if (definition.response) {
+ // if $browser specified, we do auto flush all requests
+ ($browser ? $browser.defer : responsesPush)(wrapResponse(definition));
+ } else if (definition.passThrough) {
+ $delegate(method, url, data, callback, headers, timeout, withCredentials);
+ } else throw new Error('No response defined !');
+ return;
+ }
+ }
+ throw wasExpected ?
+ new Error('No response defined !') :
+ new Error('Unexpected request: ' + method + ' ' + url + '\n' +
+ (expectation ? 'Expected ' + expectation : 'No more request expected'));
+ }
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#when
+ * @description
+ * Creates a new backend definition.
+ *
+ * @param {string} method HTTP method.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(string|RegExp|function(string))=} data HTTP request body or function that receives
+ * data string and returns true if the data is as expected.
+ * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header
+ * object and returns true if the headers match the current definition.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ *
+ * - respond –
+ * `{function([status,] data[, headers, statusText])
+ * | function(function(method, url, data, headers, params)}`
+ * – The respond method takes a set of static data to be returned or a function that can
+ * return an array containing response status (number), response data (string), response
+ * headers (Object), and the text for the status (string). The respond method returns the
+ * `requestHandler` object for possible overrides.
+ */
+ $httpBackend.when = function(method, url, data, headers, keys) {
+ var definition = new MockHttpExpectation(method, url, data, headers, keys),
+ chain = {
+ respond: function(status, data, headers, statusText) {
+ definition.passThrough = undefined;
+ definition.response = createResponse(status, data, headers, statusText);
+ return chain;
+ }
+ };
+
+ if ($browser) {
+ chain.passThrough = function() {
+ definition.response = undefined;
+ definition.passThrough = true;
+ return chain;
+ };
+ }
+
+ definitions.push(definition);
+ return chain;
+ };
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#whenGET
+ * @description
+ * Creates a new backend definition for GET requests. For more info see `when()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(Object|function(Object))=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#whenHEAD
+ * @description
+ * Creates a new backend definition for HEAD requests. For more info see `when()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(Object|function(Object))=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#whenDELETE
+ * @description
+ * Creates a new backend definition for DELETE requests. For more info see `when()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(Object|function(Object))=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#whenPOST
+ * @description
+ * Creates a new backend definition for POST requests. For more info see `when()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(string|RegExp|function(string))=} data HTTP request body or function that receives
+ * data string and returns true if the data is as expected.
+ * @param {(Object|function(Object))=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#whenPUT
+ * @description
+ * Creates a new backend definition for PUT requests. For more info see `when()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(string|RegExp|function(string))=} data HTTP request body or function that receives
+ * data string and returns true if the data is as expected.
+ * @param {(Object|function(Object))=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#whenJSONP
+ * @description
+ * Creates a new backend definition for JSONP requests. For more info see `when()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ */
+ createShortMethods('when');
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#whenRoute
+ * @description
+ * Creates a new backend definition that compares only with the requested route.
+ *
+ * @param {string} method HTTP method.
+ * @param {string} url HTTP url string that supports colon param matching.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled. See #when for more info.
+ */
+ $httpBackend.whenRoute = function(method, url) {
+ var pathObj = parseRoute(url);
+ return $httpBackend.when(method, pathObj.regexp, undefined, undefined, pathObj.keys);
+ };
+
+ function parseRoute(url) {
+ var ret = {
+ regexp: url
+ },
+ keys = ret.keys = [];
+
+ if (!url || !angular.isString(url)) return ret;
+
+ url = url
+ .replace(/([().])/g, '\\$1')
+ .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option) {
+ var optional = option === '?' ? option : null;
+ var star = option === '*' ? option : null;
+ keys.push({ name: key, optional: !!optional });
+ slash = slash || '';
+ return ''
+ + (optional ? '' : slash)
+ + '(?:'
+ + (optional ? slash : '')
+ + (star && '(.+?)' || '([^/]+)')
+ + (optional || '')
+ + ')'
+ + (optional || '');
+ })
+ .replace(/([\/$\*])/g, '\\$1');
+
+ ret.regexp = new RegExp('^' + url, 'i');
+ return ret;
+ }
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#expect
+ * @description
+ * Creates a new request expectation.
+ *
+ * @param {string} method HTTP method.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
+ * receives data string and returns true if the data is as expected, or Object if request body
+ * is in JSON format.
+ * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header
+ * object and returns true if the headers match the current expectation.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ *
+ * - respond –
+ * `{function([status,] data[, headers, statusText])
+ * | function(function(method, url, data, headers, params)}`
+ * – The respond method takes a set of static data to be returned or a function that can
+ * return an array containing response status (number), response data (string), response
+ * headers (Object), and the text for the status (string). The respond method returns the
+ * `requestHandler` object for possible overrides.
+ */
+ $httpBackend.expect = function(method, url, data, headers, keys) {
+ var expectation = new MockHttpExpectation(method, url, data, headers, keys),
+ chain = {
+ respond: function(status, data, headers, statusText) {
+ expectation.response = createResponse(status, data, headers, statusText);
+ return chain;
+ }
+ };
+
+ expectations.push(expectation);
+ return chain;
+ };
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#expectGET
+ * @description
+ * Creates a new request expectation for GET requests. For more info see `expect()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {Object=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled. See #expect for more info.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#expectHEAD
+ * @description
+ * Creates a new request expectation for HEAD requests. For more info see `expect()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {Object=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#expectDELETE
+ * @description
+ * Creates a new request expectation for DELETE requests. For more info see `expect()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {Object=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#expectPOST
+ * @description
+ * Creates a new request expectation for POST requests. For more info see `expect()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
+ * receives data string and returns true if the data is as expected, or Object if request body
+ * is in JSON format.
+ * @param {Object=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#expectPUT
+ * @description
+ * Creates a new request expectation for PUT requests. For more info see `expect()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
+ * receives data string and returns true if the data is as expected, or Object if request body
+ * is in JSON format.
+ * @param {Object=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#expectPATCH
+ * @description
+ * Creates a new request expectation for PATCH requests. For more info see `expect()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
+ * receives data string and returns true if the data is as expected, or Object if request body
+ * is in JSON format.
+ * @param {Object=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#expectJSONP
+ * @description
+ * Creates a new request expectation for JSONP requests. For more info see `expect()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives an url
+ * and returns true if the url matches the current definition.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
+ */
+ createShortMethods('expect');
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#expectRoute
+ * @description
+ * Creates a new request expectation that compares only with the requested route.
+ *
+ * @param {string} method HTTP method.
+ * @param {string} url HTTP url string that supports colon param matching.
+ * @returns {requestHandler} Returns an object with `respond` method that controls how a matched
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled. See #expect for more info.
+ */
+ $httpBackend.expectRoute = function(method, url) {
+ var pathObj = parseRoute(url);
+ return $httpBackend.expect(method, pathObj.regexp, undefined, undefined, pathObj.keys);
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#flush
+ * @description
+ * Flushes all pending requests using the trained responses.
+ *
+ * @param {number=} count Number of responses to flush (in the order they arrived). If undefined,
+ * all pending requests will be flushed. If there are no pending requests when the flush method
+ * is called an exception is thrown (as this typically a sign of programming error).
+ */
+ $httpBackend.flush = function(count, digest) {
+ if (digest !== false) $rootScope.$digest();
+ if (!responses.length) throw new Error('No pending request to flush !');
+
+ if (angular.isDefined(count) && count !== null) {
+ while (count--) {
+ if (!responses.length) throw new Error('No more pending request to flush !');
+ responses.shift()();
+ }
+ } else {
+ while (responses.length) {
+ responses.shift()();
+ }
+ }
+ $httpBackend.verifyNoOutstandingExpectation(digest);
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#verifyNoOutstandingExpectation
+ * @description
+ * Verifies that all of the requests defined via the `expect` api were made. If any of the
+ * requests were not made, verifyNoOutstandingExpectation throws an exception.
+ *
+ * Typically, you would call this method following each test case that asserts requests using an
+ * "afterEach" clause.
+ *
+ * ```js
+ * afterEach($httpBackend.verifyNoOutstandingExpectation);
+ * ```
+ */
+ $httpBackend.verifyNoOutstandingExpectation = function(digest) {
+ if (digest !== false) $rootScope.$digest();
+ if (expectations.length) {
+ throw new Error('Unsatisfied requests: ' + expectations.join(', '));
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#verifyNoOutstandingRequest
+ * @description
+ * Verifies that there are no outstanding requests that need to be flushed.
+ *
+ * Typically, you would call this method following each test case that asserts requests using an
+ * "afterEach" clause.
+ *
+ * ```js
+ * afterEach($httpBackend.verifyNoOutstandingRequest);
+ * ```
+ */
+ $httpBackend.verifyNoOutstandingRequest = function() {
+ if (responses.length) {
+ throw new Error('Unflushed requests: ' + responses.length);
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $httpBackend#resetExpectations
+ * @description
+ * Resets all request expectations, but preserves all backend definitions. Typically, you would
+ * call resetExpectations during a multiple-phase test when you want to reuse the same instance of
+ * $httpBackend mock.
+ */
+ $httpBackend.resetExpectations = function() {
+ expectations.length = 0;
+ responses.length = 0;
+ };
+
+ return $httpBackend;
+
+
+ function createShortMethods(prefix) {
+ angular.forEach(['GET', 'DELETE', 'JSONP', 'HEAD'], function(method) {
+ $httpBackend[prefix + method] = function(url, headers, keys) {
+ return $httpBackend[prefix](method, url, undefined, headers, keys);
+ };
+ });
+
+ angular.forEach(['PUT', 'POST', 'PATCH'], function(method) {
+ $httpBackend[prefix + method] = function(url, data, headers, keys) {
+ return $httpBackend[prefix](method, url, data, headers, keys);
+ };
+ });
+ }
+}
+
+function MockHttpExpectation(method, url, data, headers, keys) {
+
+ this.data = data;
+ this.headers = headers;
+
+ this.match = function(m, u, d, h) {
+ if (method != m) return false;
+ if (!this.matchUrl(u)) return false;
+ if (angular.isDefined(d) && !this.matchData(d)) return false;
+ if (angular.isDefined(h) && !this.matchHeaders(h)) return false;
+ return true;
+ };
+
+ this.matchUrl = function(u) {
+ if (!url) return true;
+ if (angular.isFunction(url.test)) return url.test(u);
+ if (angular.isFunction(url)) return url(u);
+ return url == u;
+ };
+
+ this.matchHeaders = function(h) {
+ if (angular.isUndefined(headers)) return true;
+ if (angular.isFunction(headers)) return headers(h);
+ return angular.equals(headers, h);
+ };
+
+ this.matchData = function(d) {
+ if (angular.isUndefined(data)) return true;
+ if (data && angular.isFunction(data.test)) return data.test(d);
+ if (data && angular.isFunction(data)) return data(d);
+ if (data && !angular.isString(data)) {
+ return angular.equals(angular.fromJson(angular.toJson(data)), angular.fromJson(d));
+ }
+ return data == d;
+ };
+
+ this.toString = function() {
+ return method + ' ' + url;
+ };
+
+ this.params = function(u) {
+ return angular.extend(parseQuery(), pathParams());
+
+ function pathParams() {
+ var keyObj = {};
+ if (!url || !angular.isFunction(url.test) || !keys || keys.length === 0) return keyObj;
+
+ var m = url.exec(u);
+ if (!m) return keyObj;
+ for (var i = 1, len = m.length; i < len; ++i) {
+ var key = keys[i - 1];
+ var val = m[i];
+ if (key && val) {
+ keyObj[key.name || key] = val;
+ }
+ }
+
+ return keyObj;
+ }
+
+ function parseQuery() {
+ var obj = {}, key_value, key,
+ queryStr = u.indexOf('?') > -1
+ ? u.substring(u.indexOf('?') + 1)
+ : "";
+
+ angular.forEach(queryStr.split('&'), function(keyValue) {
+ if (keyValue) {
+ key_value = keyValue.replace(/\+/g,'%20').split('=');
+ key = tryDecodeURIComponent(key_value[0]);
+ if (angular.isDefined(key)) {
+ var val = angular.isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true;
+ if (!hasOwnProperty.call(obj, key)) {
+ obj[key] = val;
+ } else if (angular.isArray(obj[key])) {
+ obj[key].push(val);
+ } else {
+ obj[key] = [obj[key],val];
+ }
+ }
+ }
+ });
+ return obj;
+ }
+ function tryDecodeURIComponent(value) {
+ try {
+ return decodeURIComponent(value);
+ } catch (e) {
+ // Ignore any invalid uri component
+ }
+ }
+ };
+}
+
+function createMockXhr() {
+ return new MockXhr();
+}
+
+function MockXhr() {
+
+ // hack for testing $http, $httpBackend
+ MockXhr.$$lastInstance = this;
+
+ this.open = function(method, url, async) {
+ this.$$method = method;
+ this.$$url = url;
+ this.$$async = async;
+ this.$$reqHeaders = {};
+ this.$$respHeaders = {};
+ };
+
+ this.send = function(data) {
+ this.$$data = data;
+ };
+
+ this.setRequestHeader = function(key, value) {
+ this.$$reqHeaders[key] = value;
+ };
+
+ this.getResponseHeader = function(name) {
+ // the lookup must be case insensitive,
+ // that's why we try two quick lookups first and full scan last
+ var header = this.$$respHeaders[name];
+ if (header) return header;
+
+ name = angular.lowercase(name);
+ header = this.$$respHeaders[name];
+ if (header) return header;
+
+ header = undefined;
+ angular.forEach(this.$$respHeaders, function(headerVal, headerName) {
+ if (!header && angular.lowercase(headerName) == name) header = headerVal;
+ });
+ return header;
+ };
+
+ this.getAllResponseHeaders = function() {
+ var lines = [];
+
+ angular.forEach(this.$$respHeaders, function(value, key) {
+ lines.push(key + ': ' + value);
+ });
+ return lines.join('\n');
+ };
+
+ this.abort = angular.noop;
+}
+
+
+/**
+ * @ngdoc service
+ * @name $timeout
+ * @description
+ *
+ * This service is just a simple decorator for {@link ng.$timeout $timeout} service
+ * that adds a "flush" and "verifyNoPendingTasks" methods.
+ */
+
+angular.mock.$TimeoutDecorator = ['$delegate', '$browser', function($delegate, $browser) {
+
+ /**
+ * @ngdoc method
+ * @name $timeout#flush
+ * @description
+ *
+ * Flushes the queue of pending tasks.
+ *
+ * @param {number=} delay maximum timeout amount to flush up until
+ */
+ $delegate.flush = function(delay) {
+ $browser.defer.flush(delay);
+ };
+
+ /**
+ * @ngdoc method
+ * @name $timeout#verifyNoPendingTasks
+ * @description
+ *
+ * Verifies that there are no pending tasks that need to be flushed.
+ */
+ $delegate.verifyNoPendingTasks = function() {
+ if ($browser.deferredFns.length) {
+ throw new Error('Deferred tasks to flush (' + $browser.deferredFns.length + '): ' +
+ formatPendingTasksAsString($browser.deferredFns));
+ }
+ };
+
+ function formatPendingTasksAsString(tasks) {
+ var result = [];
+ angular.forEach(tasks, function(task) {
+ result.push('{id: ' + task.id + ', ' + 'time: ' + task.time + '}');
+ });
+
+ return result.join(', ');
+ }
+
+ return $delegate;
+}];
+
+angular.mock.$RAFDecorator = ['$delegate', function($delegate) {
+ var rafFn = function(fn) {
+ var index = rafFn.queue.length;
+ rafFn.queue.push(fn);
+ return function() {
+ rafFn.queue.splice(index, 1);
+ };
+ };
+
+ rafFn.queue = [];
+ rafFn.supported = $delegate.supported;
+
+ rafFn.flush = function() {
+ if (rafFn.queue.length === 0) {
+ throw new Error('No rAF callbacks present');
+ }
+
+ var length = rafFn.queue.length;
+ for (var i = 0; i < length; i++) {
+ rafFn.queue[i]();
+ }
+
+ rafFn.queue = rafFn.queue.slice(i);
+ };
+
+ return rafFn;
+}];
+
+/**
+ *
+ */
+angular.mock.$RootElementProvider = function() {
+ this.$get = function() {
+ return angular.element('<div ng-app></div>');
+ };
+};
+
+/**
+ * @ngdoc service
+ * @name $controller
+ * @description
+ * A decorator for {@link ng.$controller} with additional `bindings` parameter, useful when testing
+ * controllers of directives that use {@link $compile#-bindtocontroller- `bindToController`}.
+ *
+ *
+ * ## Example
+ *
+ * ```js
+ *
+ * // Directive definition ...
+ *
+ * myMod.directive('myDirective', {
+ * controller: 'MyDirectiveController',
+ * bindToController: {
+ * name: '@'
+ * }
+ * });
+ *
+ *
+ * // Controller definition ...
+ *
+ * myMod.controller('MyDirectiveController', ['$log', function($log) {
+ * $log.info(this.name);
+ * })];
+ *
+ *
+ * // In a test ...
+ *
+ * describe('myDirectiveController', function() {
+ * it('should write the bound name to the log', inject(function($controller, $log) {
+ * var ctrl = $controller('MyDirectiveController', { /* no locals &#42;/ }, { name: 'Clark Kent' });
+ * expect(ctrl.name).toEqual('Clark Kent');
+ * expect($log.info.logs).toEqual(['Clark Kent']);
+ * });
+ * });
+ *
+ * ```
+ *
+ * @param {Function|string} constructor If called with a function then it's considered to be the
+ * controller constructor function. Otherwise it's considered to be a string which is used
+ * to retrieve the controller constructor using the following steps:
+ *
+ * * check if a controller with given name is registered via `$controllerProvider`
+ * * check if evaluating the string on the current scope returns a constructor
+ * * if $controllerProvider#allowGlobals, check `window[constructor]` on the global
+ * `window` object (not recommended)
+ *
+ * The string can use the `controller as property` syntax, where the controller instance is published
+ * as the specified property on the `scope`; the `scope` must be injected into `locals` param for this
+ * to work correctly.
+ *
+ * @param {Object} locals Injection locals for Controller.
+ * @param {Object=} bindings Properties to add to the controller before invoking the constructor. This is used
+ * to simulate the `bindToController` feature and simplify certain kinds of tests.
+ * @return {Object} Instance of given controller.
+ */
+angular.mock.$ControllerDecorator = ['$delegate', function($delegate) {
+ return function(expression, locals, later, ident) {
+ if (later && typeof later === 'object') {
+ var create = $delegate(expression, locals, true, ident);
+ angular.extend(create.instance, later);
+ return create();
+ }
+ return $delegate(expression, locals, later, ident);
+ };
+}];
+
+/**
+ * @ngdoc service
+ * @name $componentController
+ * @description
+ * A service that can be used to create instances of component controllers.
+ * <div class="alert alert-info">
+ * Be aware that the controller will be instantiated and attached to the scope as specified in
+ * the component definition object. That means that you must always provide a `$scope` object
+ * in the `locals` param.
+ * </div>
+ * @param {string} componentName the name of the component whose controller we want to instantiate
+ * @param {Object} locals Injection locals for Controller.
+ * @param {Object=} bindings Properties to add to the controller before invoking the constructor. This is used
+ * to simulate the `bindToController` feature and simplify certain kinds of tests.
+ * @param {string=} ident Override the property name to use when attaching the controller to the scope.
+ * @return {Object} Instance of requested controller.
+ */
+angular.mock.$ComponentControllerProvider = ['$compileProvider', function($compileProvider) {
+ return {
+ $get: ['$controller','$injector', function($controller,$injector) {
+ return function $componentController(componentName, locals, bindings, ident) {
+ // get all directives associated to the component name
+ var directives = $injector.get(componentName + 'Directive');
+ // look for those directives that are components
+ var candidateDirectives = directives.filter(function(directiveInfo) {
+ // components have controller, controllerAs and restrict:'E'
+ return directiveInfo.controller && directiveInfo.controllerAs && directiveInfo.restrict === 'E';
+ });
+ // check if valid directives found
+ if (candidateDirectives.length === 0) {
+ throw new Error('No component found');
+ }
+ if (candidateDirectives.length > 1) {
+ throw new Error('Too many components found');
+ }
+ // get the info of the component
+ var directiveInfo = candidateDirectives[0];
+ return $controller(directiveInfo.controller, locals, bindings, ident || directiveInfo.controllerAs);
+ };
+ }]
+ };
+}];
+
+
+/**
+ * @ngdoc module
+ * @name ngMock
+ * @packageName angular-mocks
+ * @description
+ *
+ * # ngMock
+ *
+ * The `ngMock` module provides support to inject and mock Angular services into unit tests.
+ * In addition, ngMock also extends various core ng services such that they can be
+ * inspected and controlled in a synchronous manner within test code.
+ *
+ *
+ * <div doc-module-components="ngMock"></div>
+ *
+ */
+angular.module('ngMock', ['ng']).provider({
+ $browser: angular.mock.$BrowserProvider,
+ $exceptionHandler: angular.mock.$ExceptionHandlerProvider,
+ $log: angular.mock.$LogProvider,
+ $interval: angular.mock.$IntervalProvider,
+ $httpBackend: angular.mock.$HttpBackendProvider,
+ $rootElement: angular.mock.$RootElementProvider,
+ $componentController: angular.mock.$ComponentControllerProvider
+}).config(['$provide', function($provide) {
+ $provide.decorator('$timeout', angular.mock.$TimeoutDecorator);
+ $provide.decorator('$$rAF', angular.mock.$RAFDecorator);
+ $provide.decorator('$rootScope', angular.mock.$RootScopeDecorator);
+ $provide.decorator('$controller', angular.mock.$ControllerDecorator);
+}]);
+
+/**
+ * @ngdoc module
+ * @name ngMockE2E
+ * @module ngMockE2E
+ * @packageName angular-mocks
+ * @description
+ *
+ * The `ngMockE2E` is an angular module which contains mocks suitable for end-to-end testing.
+ * Currently there is only one mock present in this module -
+ * the {@link ngMockE2E.$httpBackend e2e $httpBackend} mock.
+ */
+angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
+ $provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator);
+}]);
+
+/**
+ * @ngdoc service
+ * @name $httpBackend
+ * @module ngMockE2E
+ * @description
+ * Fake HTTP backend implementation suitable for end-to-end testing or backend-less development of
+ * applications that use the {@link ng.$http $http service}.
+ *
+ * *Note*: For fake http backend implementation suitable for unit testing please see
+ * {@link ngMock.$httpBackend unit-testing $httpBackend mock}.
+ *
+ * This implementation can be used to respond with static or dynamic responses via the `when` api
+ * and its shortcuts (`whenGET`, `whenPOST`, etc) and optionally pass through requests to the
+ * real $httpBackend for specific requests (e.g. to interact with certain remote apis or to fetch
+ * templates from a webserver).
+ *
+ * As opposed to unit-testing, in an end-to-end testing scenario or in scenario when an application
+ * is being developed with the real backend api replaced with a mock, it is often desirable for
+ * certain category of requests to bypass the mock and issue a real http request (e.g. to fetch
+ * templates or static files from the webserver). To configure the backend with this behavior
+ * use the `passThrough` request handler of `when` instead of `respond`.
+ *
+ * Additionally, we don't want to manually have to flush mocked out requests like we do during unit
+ * testing. For this reason the e2e $httpBackend flushes mocked out requests
+ * automatically, closely simulating the behavior of the XMLHttpRequest object.
+ *
+ * To setup the application to run with this http backend, you have to create a module that depends
+ * on the `ngMockE2E` and your application modules and defines the fake backend:
+ *
+ * ```js
+ * myAppDev = angular.module('myAppDev', ['myApp', 'ngMockE2E']);
+ * myAppDev.run(function($httpBackend) {
+ * phones = [{name: 'phone1'}, {name: 'phone2'}];
+ *
+ * // returns the current list of phones
+ * $httpBackend.whenGET('/phones').respond(phones);
+ *
+ * // adds a new phone to the phones array
+ * $httpBackend.whenPOST('/phones').respond(function(method, url, data) {
+ * var phone = angular.fromJson(data);
+ * phones.push(phone);
+ * return [200, phone, {}];
+ * });
+ * $httpBackend.whenGET(/^\/templates\//).passThrough();
+ * //...
+ * });
+ * ```
+ *
+ * Afterwards, bootstrap your app with this new module.
+ */
+
+/**
+ * @ngdoc method
+ * @name $httpBackend#when
+ * @module ngMockE2E
+ * @description
+ * Creates a new backend definition.
+ *
+ * @param {string} method HTTP method.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(string|RegExp)=} data HTTP request body.
+ * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header
+ * object and returns true if the headers match the current definition.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
+ * {@link ngMock.$httpBackend $httpBackend mock}.
+ * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
+ * control how a matched request is handled. You can save this object for later use and invoke
+ * `respond` or `passThrough` again in order to change how a matched request is handled.
+ *
+ * - respond –
+ * `{function([status,] data[, headers, statusText])
+ * | function(function(method, url, data, headers, params)}`
+ * – The respond method takes a set of static data to be returned or a function that can return
+ * an array containing response status (number), response data (string), response headers
+ * (Object), and the text for the status (string).
+ * - passThrough – `{function()}` – Any request matching a backend definition with
+ * `passThrough` handler will be passed through to the real backend (an XHR request will be made
+ * to the server.)
+ * - Both methods return the `requestHandler` object for possible overrides.
+ */
+
+/**
+ * @ngdoc method
+ * @name $httpBackend#whenGET
+ * @module ngMockE2E
+ * @description
+ * Creates a new backend definition for GET requests. For more info see `when()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(Object|function(Object))=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
+ * {@link ngMock.$httpBackend $httpBackend mock}.
+ * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
+ * control how a matched request is handled. You can save this object for later use and invoke
+ * `respond` or `passThrough` again in order to change how a matched request is handled.
+ */
+
+/**
+ * @ngdoc method
+ * @name $httpBackend#whenHEAD
+ * @module ngMockE2E
+ * @description
+ * Creates a new backend definition for HEAD requests. For more info see `when()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(Object|function(Object))=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
+ * {@link ngMock.$httpBackend $httpBackend mock}.
+ * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
+ * control how a matched request is handled. You can save this object for later use and invoke
+ * `respond` or `passThrough` again in order to change how a matched request is handled.
+ */
+
+/**
+ * @ngdoc method
+ * @name $httpBackend#whenDELETE
+ * @module ngMockE2E
+ * @description
+ * Creates a new backend definition for DELETE requests. For more info see `when()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(Object|function(Object))=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
+ * {@link ngMock.$httpBackend $httpBackend mock}.
+ * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
+ * control how a matched request is handled. You can save this object for later use and invoke
+ * `respond` or `passThrough` again in order to change how a matched request is handled.
+ */
+
+/**
+ * @ngdoc method
+ * @name $httpBackend#whenPOST
+ * @module ngMockE2E
+ * @description
+ * Creates a new backend definition for POST requests. For more info see `when()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(string|RegExp)=} data HTTP request body.
+ * @param {(Object|function(Object))=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
+ * {@link ngMock.$httpBackend $httpBackend mock}.
+ * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
+ * control how a matched request is handled. You can save this object for later use and invoke
+ * `respond` or `passThrough` again in order to change how a matched request is handled.
+ */
+
+/**
+ * @ngdoc method
+ * @name $httpBackend#whenPUT
+ * @module ngMockE2E
+ * @description
+ * Creates a new backend definition for PUT requests. For more info see `when()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(string|RegExp)=} data HTTP request body.
+ * @param {(Object|function(Object))=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
+ * {@link ngMock.$httpBackend $httpBackend mock}.
+ * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
+ * control how a matched request is handled. You can save this object for later use and invoke
+ * `respond` or `passThrough` again in order to change how a matched request is handled.
+ */
+
+/**
+ * @ngdoc method
+ * @name $httpBackend#whenPATCH
+ * @module ngMockE2E
+ * @description
+ * Creates a new backend definition for PATCH requests. For more info see `when()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(string|RegExp)=} data HTTP request body.
+ * @param {(Object|function(Object))=} headers HTTP headers.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
+ * {@link ngMock.$httpBackend $httpBackend mock}.
+ * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
+ * control how a matched request is handled. You can save this object for later use and invoke
+ * `respond` or `passThrough` again in order to change how a matched request is handled.
+ */
+
+/**
+ * @ngdoc method
+ * @name $httpBackend#whenJSONP
+ * @module ngMockE2E
+ * @description
+ * Creates a new backend definition for JSONP requests. For more info see `when()`.
+ *
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives a url
+ * and returns true if the url matches the current definition.
+ * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
+ * {@link ngMock.$httpBackend $httpBackend mock}.
+ * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
+ * control how a matched request is handled. You can save this object for later use and invoke
+ * `respond` or `passThrough` again in order to change how a matched request is handled.
+ */
+/**
+ * @ngdoc method
+ * @name $httpBackend#whenRoute
+ * @module ngMockE2E
+ * @description
+ * Creates a new backend definition that compares only with the requested route.
+ *
+ * @param {string} method HTTP method.
+ * @param {string} url HTTP url string that supports colon param matching.
+ * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
+ * control how a matched request is handled. You can save this object for later use and invoke
+ * `respond` or `passThrough` again in order to change how a matched request is handled.
+ */
+angular.mock.e2e = {};
+angular.mock.e2e.$httpBackendDecorator =
+ ['$rootScope', '$timeout', '$delegate', '$browser', createHttpBackendMock];
+
+
+/**
+ * @ngdoc type
+ * @name $rootScope.Scope
+ * @module ngMock
+ * @description
+ * {@link ng.$rootScope.Scope Scope} type decorated with helper methods useful for testing. These
+ * methods are automatically available on any {@link ng.$rootScope.Scope Scope} instance when
+ * `ngMock` module is loaded.
+ *
+ * In addition to all the regular `Scope` methods, the following helper methods are available:
+ */
+angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) {
+
+ var $rootScopePrototype = Object.getPrototypeOf($delegate);
+
+ $rootScopePrototype.$countChildScopes = countChildScopes;
+ $rootScopePrototype.$countWatchers = countWatchers;
+
+ return $delegate;
+
+ // ------------------------------------------------------------------------------------------ //
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$countChildScopes
+ * @module ngMock
+ * @description
+ * Counts all the direct and indirect child scopes of the current scope.
+ *
+ * The current scope is excluded from the count. The count includes all isolate child scopes.
+ *
+ * @returns {number} Total number of child scopes.
+ */
+ function countChildScopes() {
+ // jshint validthis: true
+ var count = 0; // exclude the current scope
+ var pendingChildHeads = [this.$$childHead];
+ var currentScope;
+
+ while (pendingChildHeads.length) {
+ currentScope = pendingChildHeads.shift();
+
+ while (currentScope) {
+ count += 1;
+ pendingChildHeads.push(currentScope.$$childHead);
+ currentScope = currentScope.$$nextSibling;
+ }
+ }
+
+ return count;
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$countWatchers
+ * @module ngMock
+ * @description
+ * Counts all the watchers of direct and indirect child scopes of the current scope.
+ *
+ * The watchers of the current scope are included in the count and so are all the watchers of
+ * isolate child scopes.
+ *
+ * @returns {number} Total number of watchers.
+ */
+ function countWatchers() {
+ // jshint validthis: true
+ var count = this.$$watchers ? this.$$watchers.length : 0; // include the current scope
+ var pendingChildHeads = [this.$$childHead];
+ var currentScope;
+
+ while (pendingChildHeads.length) {
+ currentScope = pendingChildHeads.shift();
+
+ while (currentScope) {
+ count += currentScope.$$watchers ? currentScope.$$watchers.length : 0;
+ pendingChildHeads.push(currentScope.$$childHead);
+ currentScope = currentScope.$$nextSibling;
+ }
+ }
+
+ return count;
+ }
+}];
+
+
+if (window.jasmine || window.mocha) {
+
+ var currentSpec = null,
+ annotatedFunctions = [],
+ isSpecRunning = function() {
+ return !!currentSpec;
+ };
+
+ angular.mock.$$annotate = angular.injector.$$annotate;
+ angular.injector.$$annotate = function(fn) {
+ if (typeof fn === 'function' && !fn.$inject) {
+ annotatedFunctions.push(fn);
+ }
+ return angular.mock.$$annotate.apply(this, arguments);
+ };
+
+
+ (window.beforeEach || window.setup)(function() {
+ annotatedFunctions = [];
+ currentSpec = this;
+ });
+
+ (window.afterEach || window.teardown)(function() {
+ var injector = currentSpec.$injector;
+
+ annotatedFunctions.forEach(function(fn) {
+ delete fn.$inject;
+ });
+
+ angular.forEach(currentSpec.$modules, function(module) {
+ if (module && module.$$hashKey) {
+ module.$$hashKey = undefined;
+ }
+ });
+
+ currentSpec.$injector = null;
+ currentSpec.$modules = null;
+ currentSpec.$providerInjector = null;
+ currentSpec = null;
+
+ if (injector) {
+ injector.get('$rootElement').off();
+ injector.get('$rootScope').$destroy();
+ }
+
+ // clean up jquery's fragment cache
+ angular.forEach(angular.element.fragments, function(val, key) {
+ delete angular.element.fragments[key];
+ });
+
+ MockXhr.$$lastInstance = null;
+
+ angular.forEach(angular.callbacks, function(val, key) {
+ delete angular.callbacks[key];
+ });
+ angular.callbacks.counter = 0;
+ });
+
+ /**
+ * @ngdoc function
+ * @name angular.mock.module
+ * @description
+ *
+ * *NOTE*: This function is also published on window for easy access.<br>
+ * *NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha
+ *
+ * This function registers a module configuration code. It collects the configuration information
+ * which will be used when the injector is created by {@link angular.mock.inject inject}.
+ *
+ * See {@link angular.mock.inject inject} for usage example
+ *
+ * @param {...(string|Function|Object)} fns any number of modules which are represented as string
+ * aliases or as anonymous module initialization functions. The modules are used to
+ * configure the injector. The 'ng' and 'ngMock' modules are automatically loaded. If an
+ * object literal is passed each key-value pair will be registered on the module via
+ * {@link auto.$provide $provide}.value, the key being the string name (or token) to associate
+ * with the value on the injector.
+ */
+ window.module = angular.mock.module = function() {
+ var moduleFns = Array.prototype.slice.call(arguments, 0);
+ return isSpecRunning() ? workFn() : workFn;
+ /////////////////////
+ function workFn() {
+ if (currentSpec.$injector) {
+ throw new Error('Injector already created, can not register a module!');
+ } else {
+ var fn, modules = currentSpec.$modules || (currentSpec.$modules = []);
+ angular.forEach(moduleFns, function(module) {
+ if (angular.isObject(module) && !angular.isArray(module)) {
+ fn = function($provide) {
+ angular.forEach(module, function(value, key) {
+ $provide.value(key, value);
+ });
+ };
+ } else {
+ fn = module;
+ }
+ if (currentSpec.$providerInjector) {
+ currentSpec.$providerInjector.invoke(fn);
+ } else {
+ modules.push(fn);
+ }
+ });
+ }
+ }
+ };
+
+ /**
+ * @ngdoc function
+ * @name angular.mock.inject
+ * @description
+ *
+ * *NOTE*: This function is also published on window for easy access.<br>
+ * *NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha
+ *
+ * The inject function wraps a function into an injectable function. The inject() creates new
+ * instance of {@link auto.$injector $injector} per test, which is then used for
+ * resolving references.
+ *
+ *
+ * ## Resolving References (Underscore Wrapping)
+ * Often, we would like to inject a reference once, in a `beforeEach()` block and reuse this
+ * in multiple `it()` clauses. To be able to do this we must assign the reference to a variable
+ * that is declared in the scope of the `describe()` block. Since we would, most likely, want
+ * the variable to have the same name of the reference we have a problem, since the parameter
+ * to the `inject()` function would hide the outer variable.
+ *
+ * To help with this, the injected parameters can, optionally, be enclosed with underscores.
+ * These are ignored by the injector when the reference name is resolved.
+ *
+ * For example, the parameter `_myService_` would be resolved as the reference `myService`.
+ * Since it is available in the function body as _myService_, we can then assign it to a variable
+ * defined in an outer scope.
+ *
+ * ```
+ * // Defined out reference variable outside
+ * var myService;
+ *
+ * // Wrap the parameter in underscores
+ * beforeEach( inject( function(_myService_){
+ * myService = _myService_;
+ * }));
+ *
+ * // Use myService in a series of tests.
+ * it('makes use of myService', function() {
+ * myService.doStuff();
+ * });
+ *
+ * ```
+ *
+ * See also {@link angular.mock.module angular.mock.module}
+ *
+ * ## Example
+ * Example of what a typical jasmine tests looks like with the inject method.
+ * ```js
+ *
+ * angular.module('myApplicationModule', [])
+ * .value('mode', 'app')
+ * .value('version', 'v1.0.1');
+ *
+ *
+ * describe('MyApp', function() {
+ *
+ * // You need to load modules that you want to test,
+ * // it loads only the "ng" module by default.
+ * beforeEach(module('myApplicationModule'));
+ *
+ *
+ * // inject() is used to inject arguments of all given functions
+ * it('should provide a version', inject(function(mode, version) {
+ * expect(version).toEqual('v1.0.1');
+ * expect(mode).toEqual('app');
+ * }));
+ *
+ *
+ * // The inject and module method can also be used inside of the it or beforeEach
+ * it('should override a version and test the new version is injected', function() {
+ * // module() takes functions or strings (module aliases)
+ * module(function($provide) {
+ * $provide.value('version', 'overridden'); // override version here
+ * });
+ *
+ * inject(function(version) {
+ * expect(version).toEqual('overridden');
+ * });
+ * });
+ * });
+ *
+ * ```
+ *
+ * @param {...Function} fns any number of functions which will be injected using the injector.
+ */
+
+
+
+ var ErrorAddingDeclarationLocationStack = function(e, errorForStack) {
+ this.message = e.message;
+ this.name = e.name;
+ if (e.line) this.line = e.line;
+ if (e.sourceId) this.sourceId = e.sourceId;
+ if (e.stack && errorForStack)
+ this.stack = e.stack + '\n' + errorForStack.stack;
+ if (e.stackArray) this.stackArray = e.stackArray;
+ };
+ ErrorAddingDeclarationLocationStack.prototype.toString = Error.prototype.toString;
+
+ window.inject = angular.mock.inject = function() {
+ var blockFns = Array.prototype.slice.call(arguments, 0);
+ var errorForStack = new Error('Declaration Location');
+ return isSpecRunning() ? workFn.call(currentSpec) : workFn;
+ /////////////////////
+ function workFn() {
+ var modules = currentSpec.$modules || [];
+ var strictDi = !!currentSpec.$injectorStrict;
+ modules.unshift(function($injector) {
+ currentSpec.$providerInjector = $injector;
+ });
+ modules.unshift('ngMock');
+ modules.unshift('ng');
+ var injector = currentSpec.$injector;
+ if (!injector) {
+ if (strictDi) {
+ // If strictDi is enabled, annotate the providerInjector blocks
+ angular.forEach(modules, function(moduleFn) {
+ if (typeof moduleFn === "function") {
+ angular.injector.$$annotate(moduleFn);
+ }
+ });
+ }
+ injector = currentSpec.$injector = angular.injector(modules, strictDi);
+ currentSpec.$injectorStrict = strictDi;
+ }
+ for (var i = 0, ii = blockFns.length; i < ii; i++) {
+ if (currentSpec.$injectorStrict) {
+ // If the injector is strict / strictDi, and the spec wants to inject using automatic
+ // annotation, then annotate the function here.
+ injector.annotate(blockFns[i]);
+ }
+ try {
+ /* jshint -W040 *//* Jasmine explicitly provides a `this` object when calling functions */
+ injector.invoke(blockFns[i] || angular.noop, this);
+ /* jshint +W040 */
+ } catch (e) {
+ if (e.stack && errorForStack) {
+ throw new ErrorAddingDeclarationLocationStack(e, errorForStack);
+ }
+ throw e;
+ } finally {
+ errorForStack = null;
+ }
+ }
+ }
+ };
+
+
+ angular.mock.inject.strictDi = function(value) {
+ value = arguments.length ? !!value : true;
+ return isSpecRunning() ? workFn() : workFn;
+
+ function workFn() {
+ if (value !== currentSpec.$injectorStrict) {
+ if (currentSpec.$injector) {
+ throw new Error('Injector already created, can not modify strict annotations');
+ } else {
+ currentSpec.$injectorStrict = value;
+ }
+ }
+ }
+ };
+}
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.js
new file mode 100644
index 00000000..444be83c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.js
@@ -0,0 +1,768 @@
+/**
+ * @license AngularJS v1.5.0
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+var $resourceMinErr = angular.$$minErr('$resource');
+
+// Helper functions and regex to lookup a dotted path on an object
+// stopping at undefined/null. The path must be composed of ASCII
+// identifiers (just like $parse)
+var MEMBER_NAME_REGEX = /^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;
+
+function isValidDottedPath(path) {
+ return (path != null && path !== '' && path !== 'hasOwnProperty' &&
+ MEMBER_NAME_REGEX.test('.' + path));
+}
+
+function lookupDottedPath(obj, path) {
+ if (!isValidDottedPath(path)) {
+ throw $resourceMinErr('badmember', 'Dotted member path "@{0}" is invalid.', path);
+ }
+ var keys = path.split('.');
+ for (var i = 0, ii = keys.length; i < ii && angular.isDefined(obj); i++) {
+ var key = keys[i];
+ obj = (obj !== null) ? obj[key] : undefined;
+ }
+ return obj;
+}
+
+/**
+ * Create a shallow copy of an object and clear other fields from the destination
+ */
+function shallowClearAndCopy(src, dst) {
+ dst = dst || {};
+
+ angular.forEach(dst, function(value, key) {
+ delete dst[key];
+ });
+
+ for (var key in src) {
+ if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
+ dst[key] = src[key];
+ }
+ }
+
+ return dst;
+}
+
+/**
+ * @ngdoc module
+ * @name ngResource
+ * @description
+ *
+ * # ngResource
+ *
+ * The `ngResource` module provides interaction support with RESTful services
+ * via the $resource service.
+ *
+ *
+ * <div doc-module-components="ngResource"></div>
+ *
+ * See {@link ngResource.$resource `$resource`} for usage.
+ */
+
+/**
+ * @ngdoc service
+ * @name $resource
+ * @requires $http
+ * @requires ng.$log
+ * @requires $q
+ * @requires ng.$timeout
+ *
+ * @description
+ * A factory which creates a resource object that lets you interact with
+ * [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.
+ *
+ * The returned resource object has action methods which provide high-level behaviors without
+ * the need to interact with the low level {@link ng.$http $http} service.
+ *
+ * Requires the {@link ngResource `ngResource`} module to be installed.
+ *
+ * By default, trailing slashes will be stripped from the calculated URLs,
+ * which can pose problems with server backends that do not expect that
+ * behavior. This can be disabled by configuring the `$resourceProvider` like
+ * this:
+ *
+ * ```js
+ app.config(['$resourceProvider', function($resourceProvider) {
+ // Don't strip trailing slashes from calculated URLs
+ $resourceProvider.defaults.stripTrailingSlashes = false;
+ }]);
+ * ```
+ *
+ * @param {string} url A parameterized URL template with parameters prefixed by `:` as in
+ * `/user/:username`. If you are using a URL with a port number (e.g.
+ * `http://example.com:8080/api`), it will be respected.
+ *
+ * If you are using a url with a suffix, just add the suffix, like this:
+ * `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')`
+ * or even `$resource('http://example.com/resource/:resource_id.:format')`
+ * If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be
+ * collapsed down to a single `.`. If you need this sequence to appear and not collapse then you
+ * can escape it with `/\.`.
+ *
+ * @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
+ * `actions` methods. If a parameter value is a function, it will be executed every time
+ * when a param value needs to be obtained for a request (unless the param was overridden).
+ *
+ * Each key value in the parameter object is first bound to url template if present and then any
+ * excess keys are appended to the url search query after the `?`.
+ *
+ * Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in
+ * URL `/path/greet?salutation=Hello`.
+ *
+ * If the parameter value is prefixed with `@` then the value for that parameter will be extracted
+ * from the corresponding property on the `data` object (provided when calling an action method).
+ * For example, if the `defaultParam` object is `{someParam: '@someProp'}` then the value of
+ * `someParam` will be `data.someProp`.
+ *
+ * @param {Object.<Object>=} actions Hash with declaration of custom actions that should extend
+ * the default set of resource actions. The declaration should be created in the format of {@link
+ * ng.$http#usage $http.config}:
+ *
+ * {action1: {method:?, params:?, isArray:?, headers:?, ...},
+ * action2: {method:?, params:?, isArray:?, headers:?, ...},
+ * ...}
+ *
+ * Where:
+ *
+ * - **`action`** – {string} – The name of action. This name becomes the name of the method on
+ * your resource object.
+ * - **`method`** – {string} – Case insensitive HTTP method (e.g. `GET`, `POST`, `PUT`,
+ * `DELETE`, `JSONP`, etc).
+ * - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of
+ * the parameter value is a function, it will be executed every time when a param value needs to
+ * be obtained for a request (unless the param was overridden).
+ * - **`url`** – {string} – action specific `url` override. The url templating is supported just
+ * like for the resource-level urls.
+ * - **`isArray`** – {boolean=} – If true then the returned object for this action is an array,
+ * see `returns` section.
+ * - **`transformRequest`** –
+ * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
+ * transform function or an array of such functions. The transform function takes the http
+ * request body and headers and returns its transformed (typically serialized) version.
+ * By default, transformRequest will contain one function that checks if the request data is
+ * an object and serializes to using `angular.toJson`. To prevent this behavior, set
+ * `transformRequest` to an empty array: `transformRequest: []`
+ * - **`transformResponse`** –
+ * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
+ * transform function or an array of such functions. The transform function takes the http
+ * response body and headers and returns its transformed (typically deserialized) version.
+ * By default, transformResponse will contain one function that checks if the response looks
+ * like a JSON string and deserializes it using `angular.fromJson`. To prevent this behavior,
+ * set `transformResponse` to an empty array: `transformResponse: []`
+ * - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
+ * GET request, otherwise if a cache instance built with
+ * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
+ * caching.
+ * - **`timeout`** – `{number}` – timeout in milliseconds.<br />
+ * **Note:** In contrast to {@link ng.$http#usage $http.config}, {@link ng.$q promises} are
+ * **not** supported in $resource, because the same value would be used for multiple requests.
+ * If you are looking for a way to cancel requests, you should use the `cancellable` option.
+ * - **`cancellable`** – `{boolean}` – if set to true, the request made by a "non-instance" call
+ * will be cancelled (if not already completed) by calling `$cancelRequest()` on the call's
+ * return value. Calling `$cancelRequest()` for a non-cancellable or an already
+ * completed/cancelled request will have no effect.<br />
+ * - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the
+ * XHR object. See
+ * [requests with credentials](https://developer.mozilla.org/en/http_access_control#section_5)
+ * for more information.
+ * - **`responseType`** - `{string}` - see
+ * [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).
+ * - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
+ * `response` and `responseError`. Both `response` and `responseError` interceptors get called
+ * with `http response` object. See {@link ng.$http $http interceptors}.
+ *
+ * @param {Object} options Hash with custom settings that should extend the
+ * default `$resourceProvider` behavior. The supported options are:
+ *
+ * - **`stripTrailingSlashes`** – {boolean} – If true then the trailing
+ * slashes from any calculated URL will be stripped. (Defaults to true.)
+ * - **`cancellable`** – {boolean} – If true, the request made by a "non-instance" call will be
+ * cancelled (if not already completed) by calling `$cancelRequest()` on the call's return value.
+ * This can be overwritten per action. (Defaults to false.)
+ *
+ * @returns {Object} A resource "class" object with methods for the default set of resource actions
+ * optionally extended with custom `actions`. The default set contains these actions:
+ * ```js
+ * { 'get': {method:'GET'},
+ * 'save': {method:'POST'},
+ * 'query': {method:'GET', isArray:true},
+ * 'remove': {method:'DELETE'},
+ * 'delete': {method:'DELETE'} };
+ * ```
+ *
+ * Calling these methods invoke an {@link ng.$http} with the specified http method,
+ * destination and parameters. When the data is returned from the server then the object is an
+ * instance of the resource class. The actions `save`, `remove` and `delete` are available on it
+ * as methods with the `$` prefix. This allows you to easily perform CRUD operations (create,
+ * read, update, delete) on server-side data like this:
+ * ```js
+ * var User = $resource('/user/:userId', {userId:'@id'});
+ * var user = User.get({userId:123}, function() {
+ * user.abc = true;
+ * user.$save();
+ * });
+ * ```
+ *
+ * It is important to realize that invoking a $resource object method immediately returns an
+ * empty reference (object or array depending on `isArray`). Once the data is returned from the
+ * server the existing reference is populated with the actual data. This is a useful trick since
+ * usually the resource is assigned to a model which is then rendered by the view. Having an empty
+ * object results in no rendering, once the data arrives from the server then the object is
+ * populated with the data and the view automatically re-renders itself showing the new data. This
+ * means that in most cases one never has to write a callback function for the action methods.
+ *
+ * The action methods on the class object or instance object can be invoked with the following
+ * parameters:
+ *
+ * - HTTP GET "class" actions: `Resource.action([parameters], [success], [error])`
+ * - non-GET "class" actions: `Resource.action([parameters], postData, [success], [error])`
+ * - non-GET instance actions: `instance.$action([parameters], [success], [error])`
+ *
+ *
+ * Success callback is called with (value, responseHeaders) arguments, where the value is
+ * the populated resource instance or collection object. The error callback is called
+ * with (httpResponse) argument.
+ *
+ * Class actions return empty instance (with additional properties below).
+ * Instance actions return promise of the action.
+ *
+ * The Resource instances and collections have these additional properties:
+ *
+ * - `$promise`: the {@link ng.$q promise} of the original server interaction that created this
+ * instance or collection.
+ *
+ * On success, the promise is resolved with the same resource instance or collection object,
+ * updated with data from server. This makes it easy to use in
+ * {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view
+ * rendering until the resource(s) are loaded.
+ *
+ * On failure, the promise is rejected with the {@link ng.$http http response} object, without
+ * the `resource` property.
+ *
+ * If an interceptor object was provided, the promise will instead be resolved with the value
+ * returned by the interceptor.
+ *
+ * - `$resolved`: `true` after first server interaction is completed (either with success or
+ * rejection), `false` before that. Knowing if the Resource has been resolved is useful in
+ * data-binding.
+ *
+ * The Resource instances and collections have these additional methods:
+ *
+ * - `$cancelRequest`: If there is a cancellable, pending request related to the instance or
+ * collection, calling this method will abort the request.
+ *
+ * @example
+ *
+ * # Credit card resource
+ *
+ * ```js
+ // Define CreditCard class
+ var CreditCard = $resource('/user/:userId/card/:cardId',
+ {userId:123, cardId:'@id'}, {
+ charge: {method:'POST', params:{charge:true}}
+ });
+
+ // We can retrieve a collection from the server
+ var cards = CreditCard.query(function() {
+ // GET: /user/123/card
+ // server returns: [ {id:456, number:'1234', name:'Smith'} ];
+
+ var card = cards[0];
+ // each item is an instance of CreditCard
+ expect(card instanceof CreditCard).toEqual(true);
+ card.name = "J. Smith";
+ // non GET methods are mapped onto the instances
+ card.$save();
+ // POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'}
+ // server returns: {id:456, number:'1234', name: 'J. Smith'};
+
+ // our custom method is mapped as well.
+ card.$charge({amount:9.99});
+ // POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'}
+ });
+
+ // we can create an instance as well
+ var newCard = new CreditCard({number:'0123'});
+ newCard.name = "Mike Smith";
+ newCard.$save();
+ // POST: /user/123/card {number:'0123', name:'Mike Smith'}
+ // server returns: {id:789, number:'0123', name: 'Mike Smith'};
+ expect(newCard.id).toEqual(789);
+ * ```
+ *
+ * The object returned from this function execution is a resource "class" which has "static" method
+ * for each action in the definition.
+ *
+ * Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and
+ * `headers`.
+ *
+ * @example
+ *
+ * # User resource
+ *
+ * When the data is returned from the server then the object is an instance of the resource type and
+ * all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
+ * operations (create, read, update, delete) on server-side data.
+
+ ```js
+ var User = $resource('/user/:userId', {userId:'@id'});
+ User.get({userId:123}, function(user) {
+ user.abc = true;
+ user.$save();
+ });
+ ```
+ *
+ * It's worth noting that the success callback for `get`, `query` and other methods gets passed
+ * in the response that came from the server as well as $http header getter function, so one
+ * could rewrite the above example and get access to http headers as:
+ *
+ ```js
+ var User = $resource('/user/:userId', {userId:'@id'});
+ User.get({userId:123}, function(user, getResponseHeaders){
+ user.abc = true;
+ user.$save(function(user, putResponseHeaders) {
+ //user => saved user object
+ //putResponseHeaders => $http header getter
+ });
+ });
+ ```
+ *
+ * You can also access the raw `$http` promise via the `$promise` property on the object returned
+ *
+ ```
+ var User = $resource('/user/:userId', {userId:'@id'});
+ User.get({userId:123})
+ .$promise.then(function(user) {
+ $scope.user = user;
+ });
+ ```
+ *
+ * @example
+ *
+ * # Creating a custom 'PUT' request
+ *
+ * In this example we create a custom method on our resource to make a PUT request
+ * ```js
+ * var app = angular.module('app', ['ngResource', 'ngRoute']);
+ *
+ * // Some APIs expect a PUT request in the format URL/object/ID
+ * // Here we are creating an 'update' method
+ * app.factory('Notes', ['$resource', function($resource) {
+ * return $resource('/notes/:id', null,
+ * {
+ * 'update': { method:'PUT' }
+ * });
+ * }]);
+ *
+ * // In our controller we get the ID from the URL using ngRoute and $routeParams
+ * // We pass in $routeParams and our Notes factory along with $scope
+ * app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes',
+ function($scope, $routeParams, Notes) {
+ * // First get a note object from the factory
+ * var note = Notes.get({ id:$routeParams.id });
+ * $id = note.id;
+ *
+ * // Now call update passing in the ID first then the object you are updating
+ * Notes.update({ id:$id }, note);
+ *
+ * // This will PUT /notes/ID with the note object in the request payload
+ * }]);
+ * ```
+ *
+ * @example
+ *
+ * # Cancelling requests
+ *
+ * If an action's configuration specifies that it is cancellable, you can cancel the request related
+ * to an instance or collection (as long as it is a result of a "non-instance" call):
+ *
+ ```js
+ // ...defining the `Hotel` resource...
+ var Hotel = $resource('/api/hotel/:id', {id: '@id'}, {
+ // Let's make the `query()` method cancellable
+ query: {method: 'get', isArray: true, cancellable: true}
+ });
+
+ // ...somewhere in the PlanVacationController...
+ ...
+ this.onDestinationChanged = function onDestinationChanged(destination) {
+ // We don't care about any pending request for hotels
+ // in a different destination any more
+ this.availableHotels.$cancelRequest();
+
+ // Let's query for hotels in '<destination>'
+ // (calls: /api/hotel?location=<destination>)
+ this.availableHotels = Hotel.query({location: destination});
+ };
+ ```
+ *
+ */
+angular.module('ngResource', ['ng']).
+ provider('$resource', function() {
+ var PROTOCOL_AND_DOMAIN_REGEX = /^https?:\/\/[^\/]*/;
+ var provider = this;
+
+ this.defaults = {
+ // Strip slashes by default
+ stripTrailingSlashes: true,
+
+ // Default actions configuration
+ actions: {
+ 'get': {method: 'GET'},
+ 'save': {method: 'POST'},
+ 'query': {method: 'GET', isArray: true},
+ 'remove': {method: 'DELETE'},
+ 'delete': {method: 'DELETE'}
+ }
+ };
+
+ this.$get = ['$http', '$log', '$q', '$timeout', function($http, $log, $q, $timeout) {
+
+ var noop = angular.noop,
+ forEach = angular.forEach,
+ extend = angular.extend,
+ copy = angular.copy,
+ isFunction = angular.isFunction;
+
+ /**
+ * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
+ * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set
+ * (pchar) allowed in path segments:
+ * segment = *pchar
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+ function encodeUriSegment(val) {
+ return encodeUriQuery(val, true).
+ replace(/%26/gi, '&').
+ replace(/%3D/gi, '=').
+ replace(/%2B/gi, '+');
+ }
+
+
+ /**
+ * This method is intended for encoding *key* or *value* parts of query component. We need a
+ * custom method because encodeURIComponent is too aggressive and encodes stuff that doesn't
+ * have to be encoded per http://tools.ietf.org/html/rfc3986:
+ * query = *( pchar / "/" / "?" )
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+ function encodeUriQuery(val, pctEncodeSpaces) {
+ return encodeURIComponent(val).
+ replace(/%40/gi, '@').
+ replace(/%3A/gi, ':').
+ replace(/%24/g, '$').
+ replace(/%2C/gi, ',').
+ replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
+ }
+
+ function Route(template, defaults) {
+ this.template = template;
+ this.defaults = extend({}, provider.defaults, defaults);
+ this.urlParams = {};
+ }
+
+ Route.prototype = {
+ setUrlParams: function(config, params, actionUrl) {
+ var self = this,
+ url = actionUrl || self.template,
+ val,
+ encodedVal,
+ protocolAndDomain = '';
+
+ var urlParams = self.urlParams = {};
+ forEach(url.split(/\W/), function(param) {
+ if (param === 'hasOwnProperty') {
+ throw $resourceMinErr('badname', "hasOwnProperty is not a valid parameter name.");
+ }
+ if (!(new RegExp("^\\d+$").test(param)) && param &&
+ (new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {
+ urlParams[param] = {
+ isQueryParamValue: (new RegExp("\\?.*=:" + param + "(?:\\W|$)")).test(url)
+ };
+ }
+ });
+ url = url.replace(/\\:/g, ':');
+ url = url.replace(PROTOCOL_AND_DOMAIN_REGEX, function(match) {
+ protocolAndDomain = match;
+ return '';
+ });
+
+ params = params || {};
+ forEach(self.urlParams, function(paramInfo, urlParam) {
+ val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
+ if (angular.isDefined(val) && val !== null) {
+ if (paramInfo.isQueryParamValue) {
+ encodedVal = encodeUriQuery(val, true);
+ } else {
+ encodedVal = encodeUriSegment(val);
+ }
+ url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), function(match, p1) {
+ return encodedVal + p1;
+ });
+ } else {
+ url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function(match,
+ leadingSlashes, tail) {
+ if (tail.charAt(0) == '/') {
+ return tail;
+ } else {
+ return leadingSlashes + tail;
+ }
+ });
+ }
+ });
+
+ // strip trailing slashes and set the url (unless this behavior is specifically disabled)
+ if (self.defaults.stripTrailingSlashes) {
+ url = url.replace(/\/+$/, '') || '/';
+ }
+
+ // then replace collapse `/.` if found in the last URL path segment before the query
+ // E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x`
+ url = url.replace(/\/\.(?=\w+($|\?))/, '.');
+ // replace escaped `/\.` with `/.`
+ config.url = protocolAndDomain + url.replace(/\/\\\./, '/.');
+
+
+ // set params - delegate param encoding to $http
+ forEach(params, function(value, key) {
+ if (!self.urlParams[key]) {
+ config.params = config.params || {};
+ config.params[key] = value;
+ }
+ });
+ }
+ };
+
+
+ function resourceFactory(url, paramDefaults, actions, options) {
+ var route = new Route(url, options);
+
+ actions = extend({}, provider.defaults.actions, actions);
+
+ function extractParams(data, actionParams) {
+ var ids = {};
+ actionParams = extend({}, paramDefaults, actionParams);
+ forEach(actionParams, function(value, key) {
+ if (isFunction(value)) { value = value(); }
+ ids[key] = value && value.charAt && value.charAt(0) == '@' ?
+ lookupDottedPath(data, value.substr(1)) : value;
+ });
+ return ids;
+ }
+
+ function defaultResponseInterceptor(response) {
+ return response.resource;
+ }
+
+ function Resource(value) {
+ shallowClearAndCopy(value || {}, this);
+ }
+
+ Resource.prototype.toJSON = function() {
+ var data = extend({}, this);
+ delete data.$promise;
+ delete data.$resolved;
+ return data;
+ };
+
+ forEach(actions, function(action, name) {
+ var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method);
+ var numericTimeout = action.timeout;
+ var cancellable = angular.isDefined(action.cancellable) ? action.cancellable :
+ (options && angular.isDefined(options.cancellable)) ? options.cancellable :
+ provider.defaults.cancellable;
+
+ if (numericTimeout && !angular.isNumber(numericTimeout)) {
+ $log.debug('ngResource:\n' +
+ ' Only numeric values are allowed as `timeout`.\n' +
+ ' Promises are not supported in $resource, because the same value would ' +
+ 'be used for multiple requests. If you are looking for a way to cancel ' +
+ 'requests, you should use the `cancellable` option.');
+ delete action.timeout;
+ numericTimeout = null;
+ }
+
+ Resource[name] = function(a1, a2, a3, a4) {
+ var params = {}, data, success, error;
+
+ /* jshint -W086 */ /* (purposefully fall through case statements) */
+ switch (arguments.length) {
+ case 4:
+ error = a4;
+ success = a3;
+ //fallthrough
+ case 3:
+ case 2:
+ if (isFunction(a2)) {
+ if (isFunction(a1)) {
+ success = a1;
+ error = a2;
+ break;
+ }
+
+ success = a2;
+ error = a3;
+ //fallthrough
+ } else {
+ params = a1;
+ data = a2;
+ success = a3;
+ break;
+ }
+ case 1:
+ if (isFunction(a1)) success = a1;
+ else if (hasBody) data = a1;
+ else params = a1;
+ break;
+ case 0: break;
+ default:
+ throw $resourceMinErr('badargs',
+ "Expected up to 4 arguments [params, data, success, error], got {0} arguments",
+ arguments.length);
+ }
+ /* jshint +W086 */ /* (purposefully fall through case statements) */
+
+ var isInstanceCall = this instanceof Resource;
+ var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
+ var httpConfig = {};
+ var responseInterceptor = action.interceptor && action.interceptor.response ||
+ defaultResponseInterceptor;
+ var responseErrorInterceptor = action.interceptor && action.interceptor.responseError ||
+ undefined;
+ var timeoutDeferred;
+ var numericTimeoutPromise;
+
+ forEach(action, function(value, key) {
+ switch (key) {
+ default:
+ httpConfig[key] = copy(value);
+ break;
+ case 'params':
+ case 'isArray':
+ case 'interceptor':
+ case 'cancellable':
+ break;
+ }
+ });
+
+ if (!isInstanceCall && cancellable) {
+ timeoutDeferred = $q.defer();
+ httpConfig.timeout = timeoutDeferred.promise;
+
+ if (numericTimeout) {
+ numericTimeoutPromise = $timeout(timeoutDeferred.resolve, numericTimeout);
+ }
+ }
+
+ if (hasBody) httpConfig.data = data;
+ route.setUrlParams(httpConfig,
+ extend({}, extractParams(data, action.params || {}), params),
+ action.url);
+
+ var promise = $http(httpConfig).then(function(response) {
+ var data = response.data;
+
+ if (data) {
+ // Need to convert action.isArray to boolean in case it is undefined
+ // jshint -W018
+ if (angular.isArray(data) !== (!!action.isArray)) {
+ throw $resourceMinErr('badcfg',
+ 'Error in resource configuration for action `{0}`. Expected response to ' +
+ 'contain an {1} but got an {2} (Request: {3} {4})', name, action.isArray ? 'array' : 'object',
+ angular.isArray(data) ? 'array' : 'object', httpConfig.method, httpConfig.url);
+ }
+ // jshint +W018
+ if (action.isArray) {
+ value.length = 0;
+ forEach(data, function(item) {
+ if (typeof item === "object") {
+ value.push(new Resource(item));
+ } else {
+ // Valid JSON values may be string literals, and these should not be converted
+ // into objects. These items will not have access to the Resource prototype
+ // methods, but unfortunately there
+ value.push(item);
+ }
+ });
+ } else {
+ var promise = value.$promise; // Save the promise
+ shallowClearAndCopy(data, value);
+ value.$promise = promise; // Restore the promise
+ }
+ }
+ response.resource = value;
+
+ return response;
+ }, function(response) {
+ (error || noop)(response);
+ return $q.reject(response);
+ });
+
+ promise.finally(function() {
+ value.$resolved = true;
+ if (!isInstanceCall && cancellable) {
+ value.$cancelRequest = angular.noop;
+ $timeout.cancel(numericTimeoutPromise);
+ timeoutDeferred = numericTimeoutPromise = httpConfig.timeout = null;
+ }
+ });
+
+ promise = promise.then(
+ function(response) {
+ var value = responseInterceptor(response);
+ (success || noop)(value, response.headers);
+ return value;
+ },
+ responseErrorInterceptor);
+
+ if (!isInstanceCall) {
+ // we are creating instance / collection
+ // - set the initial promise
+ // - return the instance / collection
+ value.$promise = promise;
+ value.$resolved = false;
+ if (cancellable) value.$cancelRequest = timeoutDeferred.resolve;
+
+ return value;
+ }
+
+ // instance call
+ return promise;
+ };
+
+
+ Resource.prototype['$' + name] = function(params, success, error) {
+ if (isFunction(params)) {
+ error = success; success = params; params = {};
+ }
+ var result = Resource[name].call(this, params, this, success, error);
+ return result.$promise || result;
+ };
+ });
+
+ Resource.bind = function(additionalParamDefaults) {
+ return resourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions);
+ };
+
+ return Resource;
+ }
+
+ return resourceFactory;
+ }];
+ });
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.min.js
new file mode 100644
index 00000000..306657dc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.min.js
@@ -0,0 +1,15 @@
+/*
+ AngularJS v1.5.0
+ (c) 2010-2016 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(Q,d,G){'use strict';function H(t,g){g=g||{};d.forEach(g,function(d,q){delete g[q]});for(var q in t)!t.hasOwnProperty(q)||"$"===q.charAt(0)&&"$"===q.charAt(1)||(g[q]=t[q]);return g}var z=d.$$minErr("$resource"),N=/^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;d.module("ngResource",["ng"]).provider("$resource",function(){var t=/^https?:\/\/[^\/]*/,g=this;this.defaults={stripTrailingSlashes:!0,actions:{get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}}};
+this.$get=["$http","$log","$q","$timeout",function(q,M,I,J){function A(d,h){return encodeURIComponent(d).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,h?"%20":"+")}function B(d,h){this.template=d;this.defaults=v({},g.defaults,h);this.urlParams={}}function K(e,h,n,k){function c(a,b){var c={};b=v({},h,b);u(b,function(b,h){x(b)&&(b=b());var f;if(b&&b.charAt&&"@"==b.charAt(0)){f=a;var l=b.substr(1);if(null==l||""===l||"hasOwnProperty"===l||!N.test("."+
+l))throw z("badmember",l);for(var l=l.split("."),m=0,k=l.length;m<k&&d.isDefined(f);m++){var r=l[m];f=null!==f?f[r]:G}}else f=b;c[h]=f});return c}function O(a){return a.resource}function m(a){H(a||{},this)}var t=new B(e,k);n=v({},g.defaults.actions,n);m.prototype.toJSON=function(){var a=v({},this);delete a.$promise;delete a.$resolved;return a};u(n,function(a,b){var h=/^(POST|PUT|PATCH)$/i.test(a.method),e=a.timeout,E=d.isDefined(a.cancellable)?a.cancellable:k&&d.isDefined(k.cancellable)?k.cancellable:
+g.defaults.cancellable;e&&!d.isNumber(e)&&(M.debug("ngResource:\n Only numeric values are allowed as `timeout`.\n Promises are not supported in $resource, because the same value would be used for multiple requests. If you are looking for a way to cancel requests, you should use the `cancellable` option."),delete a.timeout,e=null);m[b]=function(f,l,k,g){var r={},n,w,C;switch(arguments.length){case 4:C=g,w=k;case 3:case 2:if(x(l)){if(x(f)){w=f;C=l;break}w=l;C=k}else{r=f;n=l;w=k;break}case 1:x(f)?
+w=f:h?n=f:r=f;break;case 0:break;default:throw z("badargs",arguments.length);}var D=this instanceof m,p=D?n:a.isArray?[]:new m(n),s={},A=a.interceptor&&a.interceptor.response||O,B=a.interceptor&&a.interceptor.responseError||G,y,F;u(a,function(a,b){switch(b){default:s[b]=P(a);case "params":case "isArray":case "interceptor":case "cancellable":}});!D&&E&&(y=I.defer(),s.timeout=y.promise,e&&(F=J(y.resolve,e)));h&&(s.data=n);t.setUrlParams(s,v({},c(n,a.params||{}),r),a.url);r=q(s).then(function(f){var c=
+f.data;if(c){if(d.isArray(c)!==!!a.isArray)throw z("badcfg",b,a.isArray?"array":"object",d.isArray(c)?"array":"object",s.method,s.url);if(a.isArray)p.length=0,u(c,function(b){"object"===typeof b?p.push(new m(b)):p.push(b)});else{var l=p.$promise;H(c,p);p.$promise=l}}f.resource=p;return f},function(b){(C||L)(b);return I.reject(b)});r.finally(function(){p.$resolved=!0;!D&&E&&(p.$cancelRequest=d.noop,J.cancel(F),y=F=s.timeout=null)});r=r.then(function(b){var a=A(b);(w||L)(a,b.headers);return a},B);return D?
+r:(p.$promise=r,p.$resolved=!1,E&&(p.$cancelRequest=y.resolve),p)};m.prototype["$"+b]=function(a,c,d){x(a)&&(d=c,c=a,a={});a=m[b].call(this,a,this,c,d);return a.$promise||a}});m.bind=function(a){return K(e,v({},h,a),n)};return m}var L=d.noop,u=d.forEach,v=d.extend,P=d.copy,x=d.isFunction;B.prototype={setUrlParams:function(e,h,n){var k=this,c=n||k.template,g,m,q="",a=k.urlParams={};u(c.split(/\W/),function(b){if("hasOwnProperty"===b)throw z("badname");!/^\d+$/.test(b)&&b&&(new RegExp("(^|[^\\\\]):"+
+b+"(\\W|$)")).test(c)&&(a[b]={isQueryParamValue:(new RegExp("\\?.*=:"+b+"(?:\\W|$)")).test(c)})});c=c.replace(/\\:/g,":");c=c.replace(t,function(a){q=a;return""});h=h||{};u(k.urlParams,function(a,e){g=h.hasOwnProperty(e)?h[e]:k.defaults[e];d.isDefined(g)&&null!==g?(m=a.isQueryParamValue?A(g,!0):A(g,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+"),c=c.replace(new RegExp(":"+e+"(\\W|$)","g"),function(a,b){return m+b})):c=c.replace(new RegExp("(/?):"+e+"(\\W|$)","g"),function(a,b,c){return"/"==
+c.charAt(0)?c:b+c})});k.defaults.stripTrailingSlashes&&(c=c.replace(/\/+$/,"")||"/");c=c.replace(/\/\.(?=\w+($|\?))/,".");e.url=q+c.replace(/\/\\\./,"/.");u(h,function(a,c){k.urlParams[c]||(e.params=e.params||{},e.params[c]=a)})}};return K}]})})(window,window.angular);
+//# sourceMappingURL=angular-resource.min.js.map
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.min.js.map
new file mode 100644
index 00000000..5174e18b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.min.js.map
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"angular-resource.min.js",
+"lineCount":14,
+"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CA6BtCC,QAASA,EAAmB,CAACC,CAAD,CAAMC,CAAN,CAAW,CACrCA,CAAA,CAAMA,CAAN,EAAa,EAEbJ,EAAAK,QAAA,CAAgBD,CAAhB,CAAqB,QAAQ,CAACE,CAAD,CAAQC,CAAR,CAAa,CACxC,OAAOH,CAAA,CAAIG,CAAJ,CADiC,CAA1C,CAIA,KAASA,IAAAA,CAAT,GAAgBJ,EAAhB,CACM,CAAAA,CAAAK,eAAA,CAAmBD,CAAnB,CAAJ,EAAmD,GAAnD,GAAiCA,CAAAE,OAAA,CAAW,CAAX,CAAjC,EAA4E,GAA5E,GAA0DF,CAAAE,OAAA,CAAW,CAAX,CAA1D,GACEL,CAAA,CAAIG,CAAJ,CADF,CACaJ,CAAA,CAAII,CAAJ,CADb,CAKF,OAAOH,EAb8B,CA3BvC,IAAIM,EAAkBV,CAAAW,SAAA,CAAiB,WAAjB,CAAtB,CAKIC,EAAoB,mCAwYxBZ,EAAAa,OAAA,CAAe,YAAf,CAA6B,CAAC,IAAD,CAA7B,CAAAC,SAAA,CACW,WADX,CACwB,QAAQ,EAAG,CAC/B,IAAIC,EAA4B,oBAAhC,CACID,EAAW,IAEf,KAAAE,SAAA,CAAgB,CAEdC,qBAAsB,CAAA,CAFR,CAKdC,QAAS,CACP,IAAO,CAACC,OAAQ,KAAT,CADA,CAEP,KAAQ,CAACA,OAAQ,MAAT,CAFD,CAGP,MAAS,CAACA,OAAQ,KAAT,CAAgBC,QAAS,CAAA,CAAzB,CAHF,CAIP,OAAU,CAACD,OAAQ,QAAT,CAJH,CAKP,SAAU,CAACA,OAAQ,QAAT,CALH,CALK,CAchB;IAAAE,KAAA,CAAY,CAAC,OAAD,CAAU,MAAV,CAAkB,IAAlB,CAAwB,UAAxB,CAAoC,QAAQ,CAACC,CAAD,CAAQC,CAAR,CAAcC,CAAd,CAAkBC,CAAlB,CAA4B,CAsClFC,QAASA,EAAc,CAACC,CAAD,CAAMC,CAAN,CAAuB,CAC5C,MAAOC,mBAAA,CAAmBF,CAAnB,CAAAG,QAAA,CACG,OADH,CACY,GADZ,CAAAA,QAAA,CAEG,OAFH,CAEY,GAFZ,CAAAA,QAAA,CAGG,MAHH,CAGW,GAHX,CAAAA,QAAA,CAIG,OAJH,CAIY,GAJZ,CAAAA,QAAA,CAKG,MALH,CAKYF,CAAA,CAAkB,KAAlB,CAA0B,GALtC,CADqC,CAS9CG,QAASA,EAAK,CAACC,CAAD,CAAWhB,CAAX,CAAqB,CACjC,IAAAgB,SAAA,CAAgBA,CAChB,KAAAhB,SAAA,CAAgBiB,CAAA,CAAO,EAAP,CAAWnB,CAAAE,SAAX,CAA8BA,CAA9B,CAChB,KAAAkB,UAAA,CAAiB,EAHgB,CA+EnCC,QAASA,EAAe,CAACC,CAAD,CAAMC,CAAN,CAAqBnB,CAArB,CAA8BoB,CAA9B,CAAuC,CAK7DC,QAASA,EAAa,CAACC,CAAD,CAAOC,CAAP,CAAqB,CACzC,IAAIC,EAAM,EACVD,EAAA,CAAeR,CAAA,CAAO,EAAP,CAAWI,CAAX,CAA0BI,CAA1B,CACfpC,EAAA,CAAQoC,CAAR,CAAsB,QAAQ,CAACnC,CAAD,CAAQC,CAAR,CAAa,CACrCoC,CAAA,CAAWrC,CAAX,CAAJ,GAAyBA,CAAzB,CAAiCA,CAAA,EAAjC,CACW,KAAA,CAAA,IAAAA,CAAA,EAASA,CAAAG,OAAT,EAA4C,GAA5C,EAAyBH,CAAAG,OAAA,CAAa,CAAb,CAAzB,CAAA,CACT,CAAA,CAAA,CAAA,KAAA,EAAA,CAAA,OAAA,CAAA,CAAA,CA5hBZ,IALgB,IAKhB,EAAuBmC,CAAvB,EALiC,EAKjC,GAAuBA,CAAvB,EALgD,gBAKhD,GAAuBA,CAAvB,EAJI,CAAAhC,CAAAiC,KAAA,CAAuB,GAAvB;AAImBD,CAJnB,CAIJ,CACE,KAAMlC,EAAA,CAAgB,WAAhB,CAAsEkC,CAAtE,CAAN,CAGF,IADIE,IAAAA,EAAOF,CAAAG,MAAA,CAAW,GAAX,CAAPD,CACKE,EAAI,CADTF,CACYG,EAAKH,CAAAI,OAArB,CAAkCF,CAAlC,CAAsCC,CAAtC,EAA4CjD,CAAAmD,UAAA,CAAkBC,CAAlB,CAA5C,CAAoEJ,CAAA,EAApE,CAAyE,CACvE,IAAIzC,EAAMuC,CAAA,CAAKE,CAAL,CACVI,EAAA,CAAe,IAAT,GAACA,CAAD,CAAiBA,CAAA,CAAI7C,CAAJ,CAAjB,CAA4BN,CAFqC,CAuhBpD,CAAA,IACiCK,EAAAA,CAAAA,CAD5CoC,EAAA,CAAInC,CAAJ,CAAA,CAAW,CAF8B,CAA3C,CAKA,OAAOmC,EARkC,CAW3CW,QAASA,EAA0B,CAACC,CAAD,CAAW,CAC5C,MAAOA,EAAAC,SADqC,CAI9CC,QAASA,EAAQ,CAAClD,CAAD,CAAQ,CACvBJ,CAAA,CAAoBI,CAApB,EAA6B,EAA7B,CAAiC,IAAjC,CADuB,CAnBzB,IAAImD,EAAQ,IAAI1B,CAAJ,CAAUK,CAAV,CAAeE,CAAf,CAEZpB,EAAA,CAAUe,CAAA,CAAO,EAAP,CAAWnB,CAAAE,SAAAE,QAAX,CAAsCA,CAAtC,CAqBVsC,EAAAE,UAAAC,OAAA,CAA4BC,QAAQ,EAAG,CACrC,IAAIpB,EAAOP,CAAA,CAAO,EAAP,CAAW,IAAX,CACX,QAAOO,CAAAqB,SACP,QAAOrB,CAAAsB,UACP,OAAOtB,EAJ8B,CAOvCnC,EAAA,CAAQa,CAAR,CAAiB,QAAQ,CAAC6C,CAAD,CAASC,CAAT,CAAe,CACtC,IAAIC,EAAU,qBAAApB,KAAA,CAA2BkB,CAAA5C,OAA3B,CAAd,CACI+C,EAAiBH,CAAAI,QADrB,CAEIC,EAAcpE,CAAAmD,UAAA,CAAkBY,CAAAK,YAAlB,CAAA,CAAwCL,CAAAK,YAAxC,CACb9B,CAAD,EAAYtC,CAAAmD,UAAA,CAAkBb,CAAA8B,YAAlB,CAAZ,CAAsD9B,CAAA8B,YAAtD;AACAtD,CAAAE,SAAAoD,YAEAF,EAAJ,EAAuB,CAAAlE,CAAAqE,SAAA,CAAiBH,CAAjB,CAAvB,GACE3C,CAAA+C,MAAA,CAAW,gQAAX,CAMA,CADA,OAAOP,CAAAI,QACP,CAAAD,CAAA,CAAiB,IAPnB,CAUAV,EAAA,CAASQ,CAAT,CAAA,CAAiB,QAAQ,CAACO,CAAD,CAAKC,CAAL,CAASC,CAAT,CAAaC,CAAb,CAAiB,CAAA,IACpCC,EAAS,EAD2B,CACvBnC,CADuB,CACjBoC,CADiB,CACRC,CAGhC,QAAQC,SAAA5B,OAAR,EACE,KAAK,CAAL,CACE2B,CACA,CADQH,CACR,CAAAE,CAAA,CAAUH,CAEZ,MAAK,CAAL,CACA,KAAK,CAAL,CACE,GAAI9B,CAAA,CAAW6B,CAAX,CAAJ,CAAoB,CAClB,GAAI7B,CAAA,CAAW4B,CAAX,CAAJ,CAAoB,CAClBK,CAAA,CAAUL,CACVM,EAAA,CAAQL,CACR,MAHkB,CAMpBI,CAAA,CAAUJ,CACVK,EAAA,CAAQJ,CARU,CAApB,IAUO,CACLE,CAAA,CAASJ,CACT/B,EAAA,CAAOgC,CACPI,EAAA,CAAUH,CACV,MAJK,CAMT,KAAK,CAAL,CACM9B,CAAA,CAAW4B,CAAX,CAAJ;AAAoBK,CAApB,CAA8BL,CAA9B,CACSN,CAAJ,CAAazB,CAAb,CAAoB+B,CAApB,CACAI,CADA,CACSJ,CACd,MACF,MAAK,CAAL,CAAQ,KACR,SACE,KAAM7D,EAAA,CAAgB,SAAhB,CAEJoE,SAAA5B,OAFI,CAAN,CA9BJ,CAoCA,IAAI6B,EAAiB,IAAjBA,WAAiCvB,EAArC,CACIlD,EAAQyE,CAAA,CAAiBvC,CAAjB,CAAyBuB,CAAA3C,QAAA,CAAiB,EAAjB,CAAsB,IAAIoC,CAAJ,CAAahB,CAAb,CAD3D,CAEIwC,EAAa,EAFjB,CAGIC,EAAsBlB,CAAAmB,YAAtBD,EAA4ClB,CAAAmB,YAAA5B,SAA5C2B,EACF5B,CAJF,CAKI8B,EAA2BpB,CAAAmB,YAA3BC,EAAiDpB,CAAAmB,YAAAE,cAAjDD,EACFlF,CANF,CAOIoF,CAPJ,CAQIC,CAEJjF,EAAA,CAAQ0D,CAAR,CAAgB,QAAQ,CAACzD,CAAD,CAAQC,CAAR,CAAa,CACnC,OAAQA,CAAR,EACE,QACEyE,CAAA,CAAWzE,CAAX,CAAA,CAAkBgF,CAAA,CAAKjF,CAAL,CAEpB,MAAK,QAAL,CACA,KAAK,SAAL,CACA,KAAK,aAAL,CACA,KAAK,aAAL,CAPF,CADmC,CAArC,CAaKyE,EAAAA,CAAL,EAAuBX,CAAvB,GACEiB,CAGA,CAHkB7D,CAAAgE,MAAA,EAGlB,CAFAR,CAAAb,QAEA,CAFqBkB,CAAAI,QAErB,CAAIvB,CAAJ,GACEoB,CADF,CAC0B7D,CAAA,CAAS4D,CAAAK,QAAT,CAAkCxB,CAAlC,CAD1B,CAJF,CASID,EAAJ,GAAae,CAAAxC,KAAb,CAA+BA,CAA/B,CACAiB,EAAAkC,aAAA,CAAmBX,CAAnB,CACE/C,CAAA,CAAO,EAAP,CAAWM,CAAA,CAAcC,CAAd,CAAoBuB,CAAAY,OAApB,EAAqC,EAArC,CAAX,CAAqDA,CAArD,CADF,CAEEZ,CAAA3B,IAFF,CAIIqD,EAAAA,CAAUnE,CAAA,CAAM0D,CAAN,CAAAY,KAAA,CAAuB,QAAQ,CAACtC,CAAD,CAAW,CACtD,IAAId;AAAOc,CAAAd,KAEX,IAAIA,CAAJ,CAAU,CAGR,GAAIxC,CAAAoB,QAAA,CAAgBoB,CAAhB,CAAJ,GAA+B,CAAEpB,CAAA2C,CAAA3C,QAAjC,CACE,KAAMV,EAAA,CAAgB,QAAhB,CAEkDsD,CAFlD,CAEwDD,CAAA3C,QAAA,CAAiB,OAAjB,CAA2B,QAFnF,CAGJpB,CAAAoB,QAAA,CAAgBoB,CAAhB,CAAA,CAAwB,OAAxB,CAAkC,QAH9B,CAGwCwC,CAAA7D,OAHxC,CAG2D6D,CAAA5C,IAH3D,CAAN,CAMF,GAAI2B,CAAA3C,QAAJ,CACEd,CAAA4C,OACA,CADe,CACf,CAAA7C,CAAA,CAAQmC,CAAR,CAAc,QAAQ,CAACqD,CAAD,CAAO,CACP,QAApB,GAAI,MAAOA,EAAX,CACEvF,CAAAwF,KAAA,CAAW,IAAItC,CAAJ,CAAaqC,CAAb,CAAX,CADF,CAMEvF,CAAAwF,KAAA,CAAWD,CAAX,CAPyB,CAA7B,CAFF,KAYO,CACL,IAAIJ,EAAUnF,CAAAuD,SACd3D,EAAA,CAAoBsC,CAApB,CAA0BlC,CAA1B,CACAA,EAAAuD,SAAA,CAAiB4B,CAHZ,CAtBC,CA4BVnC,CAAAC,SAAA,CAAoBjD,CAEpB,OAAOgD,EAjC+C,CAA1C,CAkCX,QAAQ,CAACA,CAAD,CAAW,CACpB,CAACuB,CAAD,EAAUkB,CAAV,EAAgBzC,CAAhB,CACA,OAAO9B,EAAAwE,OAAA,CAAU1C,CAAV,CAFa,CAlCR,CAuCdmC,EAAAQ,QAAA,CAAgB,QAAQ,EAAG,CACzB3F,CAAAwD,UAAA,CAAkB,CAAA,CACbiB,EAAAA,CAAL,EAAuBX,CAAvB,GACE9D,CAAA4F,eAEA,CAFuBlG,CAAA+F,KAEvB,CADAtE,CAAA0E,OAAA,CAAgBb,CAAhB,CACA,CAAAD,CAAA,CAAkBC,CAAlB,CAA0CN,CAAAb,QAA1C,CAA+D,IAHjE,CAFyB,CAA3B,CASAsB,EAAA,CAAUA,CAAAG,KAAA,CACR,QAAQ,CAACtC,CAAD,CAAW,CACjB,IAAIhD,EAAQ2E,CAAA,CAAoB3B,CAApB,CACZ,EAACsB,CAAD,EAAYmB,CAAZ,EAAkBzF,CAAlB,CAAyBgD,CAAA8C,QAAzB,CACA,OAAO9F,EAHU,CADX,CAMR6E,CANQ,CAQV,OAAKJ,EAAL;AAYOU,CAZP,EAIEnF,CAAAuD,SAIOvD,CAJUmF,CAIVnF,CAHPA,CAAAwD,UAGOxD,CAHW,CAAA,CAGXA,CAFH8D,CAEG9D,GAFUA,CAAA4F,eAEV5F,CAFiC+E,CAAAK,QAEjCpF,EAAAA,CART,CArIwC,CAqJ1CkD,EAAAE,UAAA,CAAmB,GAAnB,CAAyBM,CAAzB,CAAA,CAAiC,QAAQ,CAACW,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAAyB,CAC5DlC,CAAA,CAAWgC,CAAX,CAAJ,GACEE,CAAmC,CAA3BD,CAA2B,CAAlBA,CAAkB,CAARD,CAAQ,CAAAA,CAAA,CAAS,EAD9C,CAGI0B,EAAAA,CAAS7C,CAAA,CAASQ,CAAT,CAAAsC,KAAA,CAAoB,IAApB,CAA0B3B,CAA1B,CAAkC,IAAlC,CAAwCC,CAAxC,CAAiDC,CAAjD,CACb,OAAOwB,EAAAxC,SAAP,EAA0BwC,CALsC,CAtK5B,CAAxC,CA+KA7C,EAAA+C,KAAA,CAAgBC,QAAQ,CAACC,CAAD,CAA0B,CAChD,MAAOtE,EAAA,CAAgBC,CAAhB,CAAqBH,CAAA,CAAO,EAAP,CAAWI,CAAX,CAA0BoE,CAA1B,CAArB,CAAyEvF,CAAzE,CADyC,CAIlD,OAAOsC,EAlNsD,CA9HmB,IAE9EuC,EAAO/F,CAAA+F,KAFuE,CAGhF1F,EAAUL,CAAAK,QAHsE,CAIhF4B,EAASjC,CAAAiC,OAJuE,CAKhFsD,EAAOvF,CAAAuF,KALyE,CAMhF5C,EAAa3C,CAAA2C,WA+CfZ,EAAA2B,UAAA,CAAkB,CAChBiC,aAAcA,QAAQ,CAACe,CAAD,CAAS/B,CAAT,CAAiBgC,CAAjB,CAA4B,CAAA,IAC5CC,EAAO,IADqC,CAE9CxE,EAAMuE,CAANvE,EAAmBwE,CAAA5E,SAF2B,CAG9CL,CAH8C,CAI9CkF,CAJ8C,CAK9CC,EAAoB,EAL0B,CAO5C5E,EAAY0E,CAAA1E,UAAZA,CAA6B,EACjC7B,EAAA,CAAQ+B,CAAAW,MAAA,CAAU,IAAV,CAAR,CAAyB,QAAQ,CAACgE,CAAD,CAAQ,CACvC,GAAc,gBAAd,GAAIA,CAAJ,CACE,KAAMrG,EAAA,CAAgB,SAAhB,CAAN,CAEI,CAAA,OAAAmC,KAAA,CAA0BkE,CAA1B,CAAN,EAA2CA,CAA3C,EACGlE,CAAA,IAAImE,MAAJ,CAAW,cAAX;AAA4BD,CAA5B,CAAoC,SAApC,CAAAlE,MAAA,CAAoDT,CAApD,CADH,GAEEF,CAAA,CAAU6E,CAAV,CAFF,CAEqB,CACjBE,kBAAmBpE,CAAC,IAAImE,MAAJ,CAAW,SAAX,CAAuBD,CAAvB,CAA+B,WAA/B,CAADlE,MAAA,CAAmDT,CAAnD,CADF,CAFrB,CAJuC,CAAzC,CAWAA,EAAA,CAAMA,CAAAN,QAAA,CAAY,MAAZ,CAAoB,GAApB,CACNM,EAAA,CAAMA,CAAAN,QAAA,CAAYf,CAAZ,CAAuC,QAAQ,CAACmG,CAAD,CAAQ,CAC3DJ,CAAA,CAAoBI,CACpB,OAAO,EAFoD,CAAvD,CAKNvC,EAAA,CAASA,CAAT,EAAmB,EACnBtE,EAAA,CAAQuG,CAAA1E,UAAR,CAAwB,QAAQ,CAACiF,CAAD,CAAYC,CAAZ,CAAsB,CACpDzF,CAAA,CAAMgD,CAAAnE,eAAA,CAAsB4G,CAAtB,CAAA,CAAkCzC,CAAA,CAAOyC,CAAP,CAAlC,CAAqDR,CAAA5F,SAAA,CAAcoG,CAAd,CACvDpH,EAAAmD,UAAA,CAAkBxB,CAAlB,CAAJ,EAAsC,IAAtC,GAA8BA,CAA9B,EAEIkF,CAIF,CALIM,CAAAF,kBAAJ,CACevF,CAAA,CAAeC,CAAf,CAAoB,CAAA,CAApB,CADf,CA/DCD,CAAA,CAkE+BC,CAlE/B,CAAoB,CAAA,CAApB,CAAAG,QAAA,CACG,OADH,CACY,GADZ,CAAAA,QAAA,CAEG,OAFH,CAEY,GAFZ,CAAAA,QAAA,CAGG,OAHH,CAGY,GAHZ,CAoED,CAAAM,CAAA,CAAMA,CAAAN,QAAA,CAAY,IAAIkF,MAAJ,CAAW,GAAX,CAAiBI,CAAjB,CAA4B,SAA5B,CAAuC,GAAvC,CAAZ,CAAyD,QAAQ,CAACF,CAAD,CAAQG,CAAR,CAAY,CACjF,MAAOR,EAAP,CAAoBQ,CAD6D,CAA7E,CANR,EAUEjF,CAVF,CAUQA,CAAAN,QAAA,CAAY,IAAIkF,MAAJ,CAAW,OAAX,CAAsBI,CAAtB,CAAiC,SAAjC,CAA4C,GAA5C,CAAZ,CAA8D,QAAQ,CAACF,CAAD,CACxEI,CADwE,CACxDC,CADwD,CAClD,CACxB,MAAsB,GAAtB;AAAIA,CAAA9G,OAAA,CAAY,CAAZ,CAAJ,CACS8G,CADT,CAGSD,CAHT,CAG0BC,CAJF,CADpB,CAZ4C,CAAtD,CAwBIX,EAAA5F,SAAAC,qBAAJ,GACEmB,CADF,CACQA,CAAAN,QAAA,CAAY,MAAZ,CAAoB,EAApB,CADR,EACmC,GADnC,CAMAM,EAAA,CAAMA,CAAAN,QAAA,CAAY,mBAAZ,CAAiC,GAAjC,CAEN4E,EAAAtE,IAAA,CAAa0E,CAAb,CAAiC1E,CAAAN,QAAA,CAAY,QAAZ,CAAsB,IAAtB,CAIjCzB,EAAA,CAAQsE,CAAR,CAAgB,QAAQ,CAACrE,CAAD,CAAQC,CAAR,CAAa,CAC9BqG,CAAA1E,UAAA,CAAe3B,CAAf,CAAL,GACEmG,CAAA/B,OACA,CADgB+B,CAAA/B,OAChB,EADiC,EACjC,CAAA+B,CAAA/B,OAAA,CAAcpE,CAAd,CAAA,CAAqBD,CAFvB,CADmC,CAArC,CA9DgD,CADlC,CA8RlB,OAAO6B,EAnV2E,CAAxE,CAlBmB,CADnC,CA/YsC,CAArC,CAAD,CA0vBGpC,MA1vBH,CA0vBWA,MAAAC,QA1vBX;",
+"sources":["angular-resource.js"],
+"names":["window","angular","undefined","shallowClearAndCopy","src","dst","forEach","value","key","hasOwnProperty","charAt","$resourceMinErr","$$minErr","MEMBER_NAME_REGEX","module","provider","PROTOCOL_AND_DOMAIN_REGEX","defaults","stripTrailingSlashes","actions","method","isArray","$get","$http","$log","$q","$timeout","encodeUriQuery","val","pctEncodeSpaces","encodeURIComponent","replace","Route","template","extend","urlParams","resourceFactory","url","paramDefaults","options","extractParams","data","actionParams","ids","isFunction","path","test","keys","split","i","ii","length","isDefined","obj","defaultResponseInterceptor","response","resource","Resource","route","prototype","toJSON","Resource.prototype.toJSON","$promise","$resolved","action","name","hasBody","numericTimeout","timeout","cancellable","isNumber","debug","a1","a2","a3","a4","params","success","error","arguments","isInstanceCall","httpConfig","responseInterceptor","interceptor","responseErrorInterceptor","responseError","timeoutDeferred","numericTimeoutPromise","copy","defer","promise","resolve","setUrlParams","then","item","push","noop","reject","finally","$cancelRequest","cancel","headers","result","call","bind","Resource.bind","additionalParamDefaults","config","actionUrl","self","encodedVal","protocolAndDomain","param","RegExp","isQueryParamValue","match","paramInfo","urlParam","p1","leadingSlashes","tail"]
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.js
new file mode 100644
index 00000000..45ac238e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.js
@@ -0,0 +1,1016 @@
+/**
+ * @license AngularJS v1.5.0
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+/**
+ * @ngdoc module
+ * @name ngRoute
+ * @description
+ *
+ * # ngRoute
+ *
+ * The `ngRoute` module provides routing and deeplinking services and directives for angular apps.
+ *
+ * ## Example
+ * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
+ *
+ *
+ * <div doc-module-components="ngRoute"></div>
+ */
+ /* global -ngRouteModule */
+var ngRouteModule = angular.module('ngRoute', ['ng']).
+ provider('$route', $RouteProvider),
+ $routeMinErr = angular.$$minErr('ngRoute');
+
+/**
+ * @ngdoc provider
+ * @name $routeProvider
+ *
+ * @description
+ *
+ * Used for configuring routes.
+ *
+ * ## Example
+ * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
+ *
+ * ## Dependencies
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
+ */
+function $RouteProvider() {
+ function inherit(parent, extra) {
+ return angular.extend(Object.create(parent), extra);
+ }
+
+ var routes = {};
+
+ /**
+ * @ngdoc method
+ * @name $routeProvider#when
+ *
+ * @param {string} path Route path (matched against `$location.path`). If `$location.path`
+ * contains redundant trailing slash or is missing one, the route will still match and the
+ * `$location.path` will be updated to add or drop the trailing slash to exactly match the
+ * route definition.
+ *
+ * * `path` can contain named groups starting with a colon: e.g. `:name`. All characters up
+ * to the next slash are matched and stored in `$routeParams` under the given `name`
+ * when the route matches.
+ * * `path` can contain named groups starting with a colon and ending with a star:
+ * e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name`
+ * when the route matches.
+ * * `path` can contain optional named groups with a question mark: e.g.`:name?`.
+ *
+ * For example, routes like `/color/:color/largecode/:largecode*\/edit` will match
+ * `/color/brown/largecode/code/with/slashes/edit` and extract:
+ *
+ * * `color: brown`
+ * * `largecode: code/with/slashes`.
+ *
+ *
+ * @param {Object} route Mapping information to be assigned to `$route.current` on route
+ * match.
+ *
+ * Object properties:
+ *
+ * - `controller` – `{(string|function()=}` – Controller fn that should be associated with
+ * newly created scope or the name of a {@link angular.Module#controller registered
+ * controller} if passed as a string.
+ * - `controllerAs` – `{string=}` – An identifier name for a reference to the controller.
+ * If present, the controller will be published to scope under the `controllerAs` name.
+ * - `template` – `{string=|function()=}` – html template as a string or a function that
+ * returns an html template as a string which should be used by {@link
+ * ngRoute.directive:ngView ngView} or {@link ng.directive:ngInclude ngInclude} directives.
+ * This property takes precedence over `templateUrl`.
+ *
+ * If `template` is a function, it will be called with the following parameters:
+ *
+ * - `{Array.<Object>}` - route parameters extracted from the current
+ * `$location.path()` by applying the current route
+ *
+ * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
+ * template that should be used by {@link ngRoute.directive:ngView ngView}.
+ *
+ * If `templateUrl` is a function, it will be called with the following parameters:
+ *
+ * - `{Array.<Object>}` - route parameters extracted from the current
+ * `$location.path()` by applying the current route
+ *
+ * - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
+ * be injected into the controller. If any of these dependencies are promises, the router
+ * will wait for them all to be resolved or one to be rejected before the controller is
+ * instantiated.
+ * If all the promises are resolved successfully, the values of the resolved promises are
+ * injected and {@link ngRoute.$route#$routeChangeSuccess $routeChangeSuccess} event is
+ * fired. If any of the promises are rejected the
+ * {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired.
+ * For easier access to the resolved dependencies from the template, the `resolve` map will
+ * be available on the scope of the route, under `$resolve` (by default) or a custom name
+ * specified by the `resolveAs` property (see below). This can be particularly useful, when
+ * working with {@link angular.Module#component components} as route templates.<br />
+ * <div class="alert alert-warning">
+ * **Note:** If your scope already contains a property with this name, it will be hidden
+ * or overwritten. Make sure, you specify an appropriate name for this property, that
+ * does not collide with other properties on the scope.
+ * </div>
+ * The map object is:
+ *
+ * - `key` – `{string}`: a name of a dependency to be injected into the controller.
+ * - `factory` - `{string|function}`: If `string` then it is an alias for a service.
+ * Otherwise if function, then it is {@link auto.$injector#invoke injected}
+ * and the return value is treated as the dependency. If the result is a promise, it is
+ * resolved before its value is injected into the controller. Be aware that
+ * `ngRoute.$routeParams` will still refer to the previous route within these resolve
+ * functions. Use `$route.current.params` to access the new route parameters, instead.
+ *
+ * - `resolveAs` - `{string=}` - The name under which the `resolve` map will be available on
+ * the scope of the route. If omitted, defaults to `$resolve`.
+ *
+ * - `redirectTo` – `{(string|function())=}` – value to update
+ * {@link ng.$location $location} path with and trigger route redirection.
+ *
+ * If `redirectTo` is a function, it will be called with the following parameters:
+ *
+ * - `{Object.<string>}` - route parameters extracted from the current
+ * `$location.path()` by applying the current route templateUrl.
+ * - `{string}` - current `$location.path()`
+ * - `{Object}` - current `$location.search()`
+ *
+ * The custom `redirectTo` function is expected to return a string which will be used
+ * to update `$location.path()` and `$location.search()`.
+ *
+ * - `[reloadOnSearch=true]` - `{boolean=}` - reload route when only `$location.search()`
+ * or `$location.hash()` changes.
+ *
+ * If the option is set to `false` and url in the browser changes, then
+ * `$routeUpdate` event is broadcasted on the root scope.
+ *
+ * - `[caseInsensitiveMatch=false]` - `{boolean=}` - match routes without being case sensitive
+ *
+ * If the option is set to `true`, then the particular route can be matched without being
+ * case sensitive
+ *
+ * @returns {Object} self
+ *
+ * @description
+ * Adds a new route definition to the `$route` service.
+ */
+ this.when = function(path, route) {
+ //copy original route object to preserve params inherited from proto chain
+ var routeCopy = angular.copy(route);
+ if (angular.isUndefined(routeCopy.reloadOnSearch)) {
+ routeCopy.reloadOnSearch = true;
+ }
+ if (angular.isUndefined(routeCopy.caseInsensitiveMatch)) {
+ routeCopy.caseInsensitiveMatch = this.caseInsensitiveMatch;
+ }
+ routes[path] = angular.extend(
+ routeCopy,
+ path && pathRegExp(path, routeCopy)
+ );
+
+ // create redirection for trailing slashes
+ if (path) {
+ var redirectPath = (path[path.length - 1] == '/')
+ ? path.substr(0, path.length - 1)
+ : path + '/';
+
+ routes[redirectPath] = angular.extend(
+ {redirectTo: path},
+ pathRegExp(redirectPath, routeCopy)
+ );
+ }
+
+ return this;
+ };
+
+ /**
+ * @ngdoc property
+ * @name $routeProvider#caseInsensitiveMatch
+ * @description
+ *
+ * A boolean property indicating if routes defined
+ * using this provider should be matched using a case insensitive
+ * algorithm. Defaults to `false`.
+ */
+ this.caseInsensitiveMatch = false;
+
+ /**
+ * @param path {string} path
+ * @param opts {Object} options
+ * @return {?Object}
+ *
+ * @description
+ * Normalizes the given path, returning a regular expression
+ * and the original path.
+ *
+ * Inspired by pathRexp in visionmedia/express/lib/utils.js.
+ */
+ function pathRegExp(path, opts) {
+ var insensitive = opts.caseInsensitiveMatch,
+ ret = {
+ originalPath: path,
+ regexp: path
+ },
+ keys = ret.keys = [];
+
+ path = path
+ .replace(/([().])/g, '\\$1')
+ .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option) {
+ var optional = option === '?' ? option : null;
+ var star = option === '*' ? option : null;
+ keys.push({ name: key, optional: !!optional });
+ slash = slash || '';
+ return ''
+ + (optional ? '' : slash)
+ + '(?:'
+ + (optional ? slash : '')
+ + (star && '(.+?)' || '([^/]+)')
+ + (optional || '')
+ + ')'
+ + (optional || '');
+ })
+ .replace(/([\/$\*])/g, '\\$1');
+
+ ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : '');
+ return ret;
+ }
+
+ /**
+ * @ngdoc method
+ * @name $routeProvider#otherwise
+ *
+ * @description
+ * Sets route definition that will be used on route change when no other route definition
+ * is matched.
+ *
+ * @param {Object|string} params Mapping information to be assigned to `$route.current`.
+ * If called with a string, the value maps to `redirectTo`.
+ * @returns {Object} self
+ */
+ this.otherwise = function(params) {
+ if (typeof params === 'string') {
+ params = {redirectTo: params};
+ }
+ this.when(null, params);
+ return this;
+ };
+
+
+ this.$get = ['$rootScope',
+ '$location',
+ '$routeParams',
+ '$q',
+ '$injector',
+ '$templateRequest',
+ '$sce',
+ function($rootScope, $location, $routeParams, $q, $injector, $templateRequest, $sce) {
+
+ /**
+ * @ngdoc service
+ * @name $route
+ * @requires $location
+ * @requires $routeParams
+ *
+ * @property {Object} current Reference to the current route definition.
+ * The route definition contains:
+ *
+ * - `controller`: The controller constructor as defined in the route definition.
+ * - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for
+ * controller instantiation. The `locals` contain
+ * the resolved values of the `resolve` map. Additionally the `locals` also contain:
+ *
+ * - `$scope` - The current route scope.
+ * - `$template` - The current route template HTML.
+ *
+ * The `locals` will be assigned to the route scope's `$resolve` property. You can override
+ * the property name, using `resolveAs` in the route definition. See
+ * {@link ngRoute.$routeProvider $routeProvider} for more info.
+ *
+ * @property {Object} routes Object with all route configuration Objects as its properties.
+ *
+ * @description
+ * `$route` is used for deep-linking URLs to controllers and views (HTML partials).
+ * It watches `$location.url()` and tries to map the path to an existing route definition.
+ *
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
+ *
+ * You can define routes through {@link ngRoute.$routeProvider $routeProvider}'s API.
+ *
+ * The `$route` service is typically used in conjunction with the
+ * {@link ngRoute.directive:ngView `ngView`} directive and the
+ * {@link ngRoute.$routeParams `$routeParams`} service.
+ *
+ * @example
+ * This example shows how changing the URL hash causes the `$route` to match a route against the
+ * URL, and the `ngView` pulls in the partial.
+ *
+ * <example name="$route-service" module="ngRouteExample"
+ * deps="angular-route.js" fixBase="true">
+ * <file name="index.html">
+ * <div ng-controller="MainController">
+ * Choose:
+ * <a href="Book/Moby">Moby</a> |
+ * <a href="Book/Moby/ch/1">Moby: Ch1</a> |
+ * <a href="Book/Gatsby">Gatsby</a> |
+ * <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
+ * <a href="Book/Scarlet">Scarlet Letter</a><br/>
+ *
+ * <div ng-view></div>
+ *
+ * <hr />
+ *
+ * <pre>$location.path() = {{$location.path()}}</pre>
+ * <pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
+ * <pre>$route.current.params = {{$route.current.params}}</pre>
+ * <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
+ * <pre>$routeParams = {{$routeParams}}</pre>
+ * </div>
+ * </file>
+ *
+ * <file name="book.html">
+ * controller: {{name}}<br />
+ * Book Id: {{params.bookId}}<br />
+ * </file>
+ *
+ * <file name="chapter.html">
+ * controller: {{name}}<br />
+ * Book Id: {{params.bookId}}<br />
+ * Chapter Id: {{params.chapterId}}
+ * </file>
+ *
+ * <file name="script.js">
+ * angular.module('ngRouteExample', ['ngRoute'])
+ *
+ * .controller('MainController', function($scope, $route, $routeParams, $location) {
+ * $scope.$route = $route;
+ * $scope.$location = $location;
+ * $scope.$routeParams = $routeParams;
+ * })
+ *
+ * .controller('BookController', function($scope, $routeParams) {
+ * $scope.name = "BookController";
+ * $scope.params = $routeParams;
+ * })
+ *
+ * .controller('ChapterController', function($scope, $routeParams) {
+ * $scope.name = "ChapterController";
+ * $scope.params = $routeParams;
+ * })
+ *
+ * .config(function($routeProvider, $locationProvider) {
+ * $routeProvider
+ * .when('/Book/:bookId', {
+ * templateUrl: 'book.html',
+ * controller: 'BookController',
+ * resolve: {
+ * // I will cause a 1 second delay
+ * delay: function($q, $timeout) {
+ * var delay = $q.defer();
+ * $timeout(delay.resolve, 1000);
+ * return delay.promise;
+ * }
+ * }
+ * })
+ * .when('/Book/:bookId/ch/:chapterId', {
+ * templateUrl: 'chapter.html',
+ * controller: 'ChapterController'
+ * });
+ *
+ * // configure html5 to get links working on jsfiddle
+ * $locationProvider.html5Mode(true);
+ * });
+ *
+ * </file>
+ *
+ * <file name="protractor.js" type="protractor">
+ * it('should load and compile correct template', function() {
+ * element(by.linkText('Moby: Ch1')).click();
+ * var content = element(by.css('[ng-view]')).getText();
+ * expect(content).toMatch(/controller\: ChapterController/);
+ * expect(content).toMatch(/Book Id\: Moby/);
+ * expect(content).toMatch(/Chapter Id\: 1/);
+ *
+ * element(by.partialLinkText('Scarlet')).click();
+ *
+ * content = element(by.css('[ng-view]')).getText();
+ * expect(content).toMatch(/controller\: BookController/);
+ * expect(content).toMatch(/Book Id\: Scarlet/);
+ * });
+ * </file>
+ * </example>
+ */
+
+ /**
+ * @ngdoc event
+ * @name $route#$routeChangeStart
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted before a route change. At this point the route services starts
+ * resolving all of the dependencies needed for the route change to occur.
+ * Typically this involves fetching the view template as well as any dependencies
+ * defined in `resolve` route property. Once all of the dependencies are resolved
+ * `$routeChangeSuccess` is fired.
+ *
+ * The route change (and the `$location` change that triggered it) can be prevented
+ * by calling `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on}
+ * for more details about event object.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {Route} next Future route information.
+ * @param {Route} current Current route information.
+ */
+
+ /**
+ * @ngdoc event
+ * @name $route#$routeChangeSuccess
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted after a route change has happened successfully.
+ * The `resolve` dependencies are now available in the `current.locals` property.
+ *
+ * {@link ngRoute.directive:ngView ngView} listens for the directive
+ * to instantiate the controller and render the view.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {Route} current Current route information.
+ * @param {Route|Undefined} previous Previous route information, or undefined if current is
+ * first route entered.
+ */
+
+ /**
+ * @ngdoc event
+ * @name $route#$routeChangeError
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted if any of the resolve promises are rejected.
+ *
+ * @param {Object} angularEvent Synthetic event object
+ * @param {Route} current Current route information.
+ * @param {Route} previous Previous route information.
+ * @param {Route} rejection Rejection of the promise. Usually the error of the failed promise.
+ */
+
+ /**
+ * @ngdoc event
+ * @name $route#$routeUpdate
+ * @eventType broadcast on root scope
+ * @description
+ * The `reloadOnSearch` property has been set to false, and we are reusing the same
+ * instance of the Controller.
+ *
+ * @param {Object} angularEvent Synthetic event object
+ * @param {Route} current Current/previous route information.
+ */
+
+ var forceReload = false,
+ preparedRoute,
+ preparedRouteIsUpdateOnly,
+ $route = {
+ routes: routes,
+
+ /**
+ * @ngdoc method
+ * @name $route#reload
+ *
+ * @description
+ * Causes `$route` service to reload the current route even if
+ * {@link ng.$location $location} hasn't changed.
+ *
+ * As a result of that, {@link ngRoute.directive:ngView ngView}
+ * creates new scope and reinstantiates the controller.
+ */
+ reload: function() {
+ forceReload = true;
+
+ var fakeLocationEvent = {
+ defaultPrevented: false,
+ preventDefault: function fakePreventDefault() {
+ this.defaultPrevented = true;
+ forceReload = false;
+ }
+ };
+
+ $rootScope.$evalAsync(function() {
+ prepareRoute(fakeLocationEvent);
+ if (!fakeLocationEvent.defaultPrevented) commitRoute();
+ });
+ },
+
+ /**
+ * @ngdoc method
+ * @name $route#updateParams
+ *
+ * @description
+ * Causes `$route` service to update the current URL, replacing
+ * current route parameters with those specified in `newParams`.
+ * Provided property names that match the route's path segment
+ * definitions will be interpolated into the location's path, while
+ * remaining properties will be treated as query params.
+ *
+ * @param {!Object<string, string>} newParams mapping of URL parameter names to values
+ */
+ updateParams: function(newParams) {
+ if (this.current && this.current.$$route) {
+ newParams = angular.extend({}, this.current.params, newParams);
+ $location.path(interpolate(this.current.$$route.originalPath, newParams));
+ // interpolate modifies newParams, only query params are left
+ $location.search(newParams);
+ } else {
+ throw $routeMinErr('norout', 'Tried updating route when with no current route');
+ }
+ }
+ };
+
+ $rootScope.$on('$locationChangeStart', prepareRoute);
+ $rootScope.$on('$locationChangeSuccess', commitRoute);
+
+ return $route;
+
+ /////////////////////////////////////////////////////
+
+ /**
+ * @param on {string} current url
+ * @param route {Object} route regexp to match the url against
+ * @return {?Object}
+ *
+ * @description
+ * Check if the route matches the current url.
+ *
+ * Inspired by match in
+ * visionmedia/express/lib/router/router.js.
+ */
+ function switchRouteMatcher(on, route) {
+ var keys = route.keys,
+ params = {};
+
+ if (!route.regexp) return null;
+
+ var m = route.regexp.exec(on);
+ if (!m) return null;
+
+ for (var i = 1, len = m.length; i < len; ++i) {
+ var key = keys[i - 1];
+
+ var val = m[i];
+
+ if (key && val) {
+ params[key.name] = val;
+ }
+ }
+ return params;
+ }
+
+ function prepareRoute($locationEvent) {
+ var lastRoute = $route.current;
+
+ preparedRoute = parseRoute();
+ preparedRouteIsUpdateOnly = preparedRoute && lastRoute && preparedRoute.$$route === lastRoute.$$route
+ && angular.equals(preparedRoute.pathParams, lastRoute.pathParams)
+ && !preparedRoute.reloadOnSearch && !forceReload;
+
+ if (!preparedRouteIsUpdateOnly && (lastRoute || preparedRoute)) {
+ if ($rootScope.$broadcast('$routeChangeStart', preparedRoute, lastRoute).defaultPrevented) {
+ if ($locationEvent) {
+ $locationEvent.preventDefault();
+ }
+ }
+ }
+ }
+
+ function commitRoute() {
+ var lastRoute = $route.current;
+ var nextRoute = preparedRoute;
+
+ if (preparedRouteIsUpdateOnly) {
+ lastRoute.params = nextRoute.params;
+ angular.copy(lastRoute.params, $routeParams);
+ $rootScope.$broadcast('$routeUpdate', lastRoute);
+ } else if (nextRoute || lastRoute) {
+ forceReload = false;
+ $route.current = nextRoute;
+ if (nextRoute) {
+ if (nextRoute.redirectTo) {
+ if (angular.isString(nextRoute.redirectTo)) {
+ $location.path(interpolate(nextRoute.redirectTo, nextRoute.params)).search(nextRoute.params)
+ .replace();
+ } else {
+ $location.url(nextRoute.redirectTo(nextRoute.pathParams, $location.path(), $location.search()))
+ .replace();
+ }
+ }
+ }
+
+ $q.when(nextRoute).
+ then(function() {
+ if (nextRoute) {
+ var locals = angular.extend({}, nextRoute.resolve),
+ template, templateUrl;
+
+ angular.forEach(locals, function(value, key) {
+ locals[key] = angular.isString(value) ?
+ $injector.get(value) : $injector.invoke(value, null, null, key);
+ });
+
+ if (angular.isDefined(template = nextRoute.template)) {
+ if (angular.isFunction(template)) {
+ template = template(nextRoute.params);
+ }
+ } else if (angular.isDefined(templateUrl = nextRoute.templateUrl)) {
+ if (angular.isFunction(templateUrl)) {
+ templateUrl = templateUrl(nextRoute.params);
+ }
+ if (angular.isDefined(templateUrl)) {
+ nextRoute.loadedTemplateUrl = $sce.valueOf(templateUrl);
+ template = $templateRequest(templateUrl);
+ }
+ }
+ if (angular.isDefined(template)) {
+ locals['$template'] = template;
+ }
+ return $q.all(locals);
+ }
+ }).
+ then(function(locals) {
+ // after route change
+ if (nextRoute == $route.current) {
+ if (nextRoute) {
+ nextRoute.locals = locals;
+ angular.copy(nextRoute.params, $routeParams);
+ }
+ $rootScope.$broadcast('$routeChangeSuccess', nextRoute, lastRoute);
+ }
+ }, function(error) {
+ if (nextRoute == $route.current) {
+ $rootScope.$broadcast('$routeChangeError', nextRoute, lastRoute, error);
+ }
+ });
+ }
+ }
+
+
+ /**
+ * @returns {Object} the current active route, by matching it against the URL
+ */
+ function parseRoute() {
+ // Match a route
+ var params, match;
+ angular.forEach(routes, function(route, path) {
+ if (!match && (params = switchRouteMatcher($location.path(), route))) {
+ match = inherit(route, {
+ params: angular.extend({}, $location.search(), params),
+ pathParams: params});
+ match.$$route = route;
+ }
+ });
+ // No route matched; fallback to "otherwise" route
+ return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}});
+ }
+
+ /**
+ * @returns {string} interpolation of the redirect path with the parameters
+ */
+ function interpolate(string, params) {
+ var result = [];
+ angular.forEach((string || '').split(':'), function(segment, i) {
+ if (i === 0) {
+ result.push(segment);
+ } else {
+ var segmentMatch = segment.match(/(\w+)(?:[?*])?(.*)/);
+ var key = segmentMatch[1];
+ result.push(params[key]);
+ result.push(segmentMatch[2] || '');
+ delete params[key];
+ }
+ });
+ return result.join('');
+ }
+ }];
+}
+
+ngRouteModule.provider('$routeParams', $RouteParamsProvider);
+
+
+/**
+ * @ngdoc service
+ * @name $routeParams
+ * @requires $route
+ *
+ * @description
+ * The `$routeParams` service allows you to retrieve the current set of route parameters.
+ *
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
+ *
+ * The route parameters are a combination of {@link ng.$location `$location`}'s
+ * {@link ng.$location#search `search()`} and {@link ng.$location#path `path()`}.
+ * The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched.
+ *
+ * In case of parameter name collision, `path` params take precedence over `search` params.
+ *
+ * The service guarantees that the identity of the `$routeParams` object will remain unchanged
+ * (but its properties will likely change) even when a route change occurs.
+ *
+ * Note that the `$routeParams` are only updated *after* a route change completes successfully.
+ * This means that you cannot rely on `$routeParams` being correct in route resolve functions.
+ * Instead you can use `$route.current.params` to access the new route's parameters.
+ *
+ * @example
+ * ```js
+ * // Given:
+ * // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
+ * // Route: /Chapter/:chapterId/Section/:sectionId
+ * //
+ * // Then
+ * $routeParams ==> {chapterId:'1', sectionId:'2', search:'moby'}
+ * ```
+ */
+function $RouteParamsProvider() {
+ this.$get = function() { return {}; };
+}
+
+ngRouteModule.directive('ngView', ngViewFactory);
+ngRouteModule.directive('ngView', ngViewFillContentFactory);
+
+
+/**
+ * @ngdoc directive
+ * @name ngView
+ * @restrict ECA
+ *
+ * @description
+ * # Overview
+ * `ngView` is a directive that complements the {@link ngRoute.$route $route} service by
+ * including the rendered template of the current route into the main layout (`index.html`) file.
+ * Every time the current route changes, the included view changes with it according to the
+ * configuration of the `$route` service.
+ *
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
+ *
+ * @animations
+ * enter - animation is used to bring new content into the browser.
+ * leave - animation is used to animate existing content away.
+ *
+ * The enter and leave animation occur concurrently.
+ *
+ * @scope
+ * @priority 400
+ * @param {string=} onload Expression to evaluate whenever the view updates.
+ *
+ * @param {string=} autoscroll Whether `ngView` should call {@link ng.$anchorScroll
+ * $anchorScroll} to scroll the viewport after the view is updated.
+ *
+ * - If the attribute is not set, disable scrolling.
+ * - If the attribute is set without value, enable scrolling.
+ * - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated
+ * as an expression yields a truthy value.
+ * @example
+ <example name="ngView-directive" module="ngViewExample"
+ deps="angular-route.js;angular-animate.js"
+ animations="true" fixBase="true">
+ <file name="index.html">
+ <div ng-controller="MainCtrl as main">
+ Choose:
+ <a href="Book/Moby">Moby</a> |
+ <a href="Book/Moby/ch/1">Moby: Ch1</a> |
+ <a href="Book/Gatsby">Gatsby</a> |
+ <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
+ <a href="Book/Scarlet">Scarlet Letter</a><br/>
+
+ <div class="view-animate-container">
+ <div ng-view class="view-animate"></div>
+ </div>
+ <hr />
+
+ <pre>$location.path() = {{main.$location.path()}}</pre>
+ <pre>$route.current.templateUrl = {{main.$route.current.templateUrl}}</pre>
+ <pre>$route.current.params = {{main.$route.current.params}}</pre>
+ <pre>$routeParams = {{main.$routeParams}}</pre>
+ </div>
+ </file>
+
+ <file name="book.html">
+ <div>
+ controller: {{book.name}}<br />
+ Book Id: {{book.params.bookId}}<br />
+ </div>
+ </file>
+
+ <file name="chapter.html">
+ <div>
+ controller: {{chapter.name}}<br />
+ Book Id: {{chapter.params.bookId}}<br />
+ Chapter Id: {{chapter.params.chapterId}}
+ </div>
+ </file>
+
+ <file name="animations.css">
+ .view-animate-container {
+ position:relative;
+ height:100px!important;
+ background:white;
+ border:1px solid black;
+ height:40px;
+ overflow:hidden;
+ }
+
+ .view-animate {
+ padding:10px;
+ }
+
+ .view-animate.ng-enter, .view-animate.ng-leave {
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
+
+ display:block;
+ width:100%;
+ border-left:1px solid black;
+
+ position:absolute;
+ top:0;
+ left:0;
+ right:0;
+ bottom:0;
+ padding:10px;
+ }
+
+ .view-animate.ng-enter {
+ left:100%;
+ }
+ .view-animate.ng-enter.ng-enter-active {
+ left:0;
+ }
+ .view-animate.ng-leave.ng-leave-active {
+ left:-100%;
+ }
+ </file>
+
+ <file name="script.js">
+ angular.module('ngViewExample', ['ngRoute', 'ngAnimate'])
+ .config(['$routeProvider', '$locationProvider',
+ function($routeProvider, $locationProvider) {
+ $routeProvider
+ .when('/Book/:bookId', {
+ templateUrl: 'book.html',
+ controller: 'BookCtrl',
+ controllerAs: 'book'
+ })
+ .when('/Book/:bookId/ch/:chapterId', {
+ templateUrl: 'chapter.html',
+ controller: 'ChapterCtrl',
+ controllerAs: 'chapter'
+ });
+
+ $locationProvider.html5Mode(true);
+ }])
+ .controller('MainCtrl', ['$route', '$routeParams', '$location',
+ function($route, $routeParams, $location) {
+ this.$route = $route;
+ this.$location = $location;
+ this.$routeParams = $routeParams;
+ }])
+ .controller('BookCtrl', ['$routeParams', function($routeParams) {
+ this.name = "BookCtrl";
+ this.params = $routeParams;
+ }])
+ .controller('ChapterCtrl', ['$routeParams', function($routeParams) {
+ this.name = "ChapterCtrl";
+ this.params = $routeParams;
+ }]);
+
+ </file>
+
+ <file name="protractor.js" type="protractor">
+ it('should load and compile correct template', function() {
+ element(by.linkText('Moby: Ch1')).click();
+ var content = element(by.css('[ng-view]')).getText();
+ expect(content).toMatch(/controller\: ChapterCtrl/);
+ expect(content).toMatch(/Book Id\: Moby/);
+ expect(content).toMatch(/Chapter Id\: 1/);
+
+ element(by.partialLinkText('Scarlet')).click();
+
+ content = element(by.css('[ng-view]')).getText();
+ expect(content).toMatch(/controller\: BookCtrl/);
+ expect(content).toMatch(/Book Id\: Scarlet/);
+ });
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngView#$viewContentLoaded
+ * @eventType emit on the current ngView scope
+ * @description
+ * Emitted every time the ngView content is reloaded.
+ */
+ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate'];
+function ngViewFactory($route, $anchorScroll, $animate) {
+ return {
+ restrict: 'ECA',
+ terminal: true,
+ priority: 400,
+ transclude: 'element',
+ link: function(scope, $element, attr, ctrl, $transclude) {
+ var currentScope,
+ currentElement,
+ previousLeaveAnimation,
+ autoScrollExp = attr.autoscroll,
+ onloadExp = attr.onload || '';
+
+ scope.$on('$routeChangeSuccess', update);
+ update();
+
+ function cleanupLastView() {
+ if (previousLeaveAnimation) {
+ $animate.cancel(previousLeaveAnimation);
+ previousLeaveAnimation = null;
+ }
+
+ if (currentScope) {
+ currentScope.$destroy();
+ currentScope = null;
+ }
+ if (currentElement) {
+ previousLeaveAnimation = $animate.leave(currentElement);
+ previousLeaveAnimation.then(function() {
+ previousLeaveAnimation = null;
+ });
+ currentElement = null;
+ }
+ }
+
+ function update() {
+ var locals = $route.current && $route.current.locals,
+ template = locals && locals.$template;
+
+ if (angular.isDefined(template)) {
+ var newScope = scope.$new();
+ var current = $route.current;
+
+ // Note: This will also link all children of ng-view that were contained in the original
+ // html. If that content contains controllers, ... they could pollute/change the scope.
+ // However, using ng-view on an element with additional content does not make sense...
+ // Note: We can't remove them in the cloneAttchFn of $transclude as that
+ // function is called before linking the content, which would apply child
+ // directives to non existing elements.
+ var clone = $transclude(newScope, function(clone) {
+ $animate.enter(clone, null, currentElement || $element).then(function onNgViewEnter() {
+ if (angular.isDefined(autoScrollExp)
+ && (!autoScrollExp || scope.$eval(autoScrollExp))) {
+ $anchorScroll();
+ }
+ });
+ cleanupLastView();
+ });
+
+ currentElement = clone;
+ currentScope = current.scope = newScope;
+ currentScope.$emit('$viewContentLoaded');
+ currentScope.$eval(onloadExp);
+ } else {
+ cleanupLastView();
+ }
+ }
+ }
+ };
+}
+
+// This directive is called during the $transclude call of the first `ngView` directive.
+// It will replace and compile the content of the element with the loaded template.
+// We need this directive so that the element content is already filled when
+// the link function of another directive on the same element as ngView
+// is called.
+ngViewFillContentFactory.$inject = ['$compile', '$controller', '$route'];
+function ngViewFillContentFactory($compile, $controller, $route) {
+ return {
+ restrict: 'ECA',
+ priority: -400,
+ link: function(scope, $element) {
+ var current = $route.current,
+ locals = current.locals;
+
+ $element.html(locals.$template);
+
+ var link = $compile($element.contents());
+
+ if (current.controller) {
+ locals.$scope = scope;
+ var controller = $controller(current.controller, locals);
+ if (current.controllerAs) {
+ scope[current.controllerAs] = controller;
+ }
+ $element.data('$ngControllerController', controller);
+ $element.children().data('$ngControllerController', controller);
+ }
+ scope[current.resolveAs || '$resolve'] = locals;
+
+ link(scope);
+ }
+ };
+}
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.min.js
new file mode 100644
index 00000000..4d0d0187
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.min.js
@@ -0,0 +1,15 @@
+/*
+ AngularJS v1.5.0
+ (c) 2010-2016 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(r,d,C){'use strict';function x(s,h,g){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(a,c,b,f,y){function k(){n&&(g.cancel(n),n=null);l&&(l.$destroy(),l=null);m&&(n=g.leave(m),n.then(function(){n=null}),m=null)}function z(){var b=s.current&&s.current.locals;if(d.isDefined(b&&b.$template)){var b=a.$new(),f=s.current;m=y(b,function(b){g.enter(b,null,m||c).then(function(){!d.isDefined(u)||u&&!a.$eval(u)||h()});k()});l=f.scope=b;l.$emit("$viewContentLoaded");
+l.$eval(v)}else k()}var l,m,n,u=b.autoscroll,v=b.onload||"";a.$on("$routeChangeSuccess",z);z()}}}function A(d,h,g){return{restrict:"ECA",priority:-400,link:function(a,c){var b=g.current,f=b.locals;c.html(f.$template);var y=d(c.contents());if(b.controller){f.$scope=a;var k=h(b.controller,f);b.controllerAs&&(a[b.controllerAs]=k);c.data("$ngControllerController",k);c.children().data("$ngControllerController",k)}a[b.resolveAs||"$resolve"]=f;y(a)}}}r=d.module("ngRoute",["ng"]).provider("$route",function(){function s(a,
+c){return d.extend(Object.create(a),c)}function h(a,d){var b=d.caseInsensitiveMatch,f={originalPath:a,regexp:a},g=f.keys=[];a=a.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?\*])?/g,function(a,d,b,c){a="?"===c?c:null;c="*"===c?c:null;g.push({name:b,optional:!!a});d=d||"";return""+(a?"":d)+"(?:"+(a?d:"")+(c&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([\/$\*])/g,"\\$1");f.regexp=new RegExp("^"+a+"$",b?"i":"");return f}var g={};this.when=function(a,c){var b=d.copy(c);d.isUndefined(b.reloadOnSearch)&&
+(b.reloadOnSearch=!0);d.isUndefined(b.caseInsensitiveMatch)&&(b.caseInsensitiveMatch=this.caseInsensitiveMatch);g[a]=d.extend(b,a&&h(a,b));if(a){var f="/"==a[a.length-1]?a.substr(0,a.length-1):a+"/";g[f]=d.extend({redirectTo:a},h(f,b))}return this};this.caseInsensitiveMatch=!1;this.otherwise=function(a){"string"===typeof a&&(a={redirectTo:a});this.when(null,a);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce",function(a,c,b,f,h,k,r){function l(b){var e=
+t.current;(x=(p=n())&&e&&p.$$route===e.$$route&&d.equals(p.pathParams,e.pathParams)&&!p.reloadOnSearch&&!v)||!e&&!p||a.$broadcast("$routeChangeStart",p,e).defaultPrevented&&b&&b.preventDefault()}function m(){var w=t.current,e=p;if(x)w.params=e.params,d.copy(w.params,b),a.$broadcast("$routeUpdate",w);else if(e||w)v=!1,(t.current=e)&&e.redirectTo&&(d.isString(e.redirectTo)?c.path(u(e.redirectTo,e.params)).search(e.params).replace():c.url(e.redirectTo(e.pathParams,c.path(),c.search())).replace()),f.when(e).then(function(){if(e){var a=
+d.extend({},e.resolve),b,c;d.forEach(a,function(b,e){a[e]=d.isString(b)?h.get(b):h.invoke(b,null,null,e)});d.isDefined(b=e.template)?d.isFunction(b)&&(b=b(e.params)):d.isDefined(c=e.templateUrl)&&(d.isFunction(c)&&(c=c(e.params)),d.isDefined(c)&&(e.loadedTemplateUrl=r.valueOf(c),b=k(c)));d.isDefined(b)&&(a.$template=b);return f.all(a)}}).then(function(c){e==t.current&&(e&&(e.locals=c,d.copy(e.params,b)),a.$broadcast("$routeChangeSuccess",e,w))},function(b){e==t.current&&a.$broadcast("$routeChangeError",
+e,w,b)})}function n(){var a,b;d.forEach(g,function(f,g){var q;if(q=!b){var h=c.path();q=f.keys;var l={};if(f.regexp)if(h=f.regexp.exec(h)){for(var k=1,n=h.length;k<n;++k){var m=q[k-1],p=h[k];m&&p&&(l[m.name]=p)}q=l}else q=null;else q=null;q=a=q}q&&(b=s(f,{params:d.extend({},c.search(),a),pathParams:a}),b.$$route=f)});return b||g[null]&&s(g[null],{params:{},pathParams:{}})}function u(a,b){var c=[];d.forEach((a||"").split(":"),function(a,d){if(0===d)c.push(a);else{var f=a.match(/(\w+)(?:[?*])?(.*)/),
+g=f[1];c.push(b[g]);c.push(f[2]||"");delete b[g]}});return c.join("")}var v=!1,p,x,t={routes:g,reload:function(){v=!0;var b={defaultPrevented:!1,preventDefault:function(){this.defaultPrevented=!0;v=!1}};a.$evalAsync(function(){l(b);b.defaultPrevented||m()})},updateParams:function(a){if(this.current&&this.current.$$route)a=d.extend({},this.current.params,a),c.path(u(this.current.$$route.originalPath,a)),c.search(a);else throw B("norout");}};a.$on("$locationChangeStart",l);a.$on("$locationChangeSuccess",
+m);return t}]});var B=d.$$minErr("ngRoute");r.provider("$routeParams",function(){this.$get=function(){return{}}});r.directive("ngView",x);r.directive("ngView",A);x.$inject=["$route","$anchorScroll","$animate"];A.$inject=["$compile","$controller","$route"]})(window,window.angular);
+//# sourceMappingURL=angular-route.min.js.map
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.min.js.map
new file mode 100644
index 00000000..fb5cffce
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.min.js.map
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"angular-route.min.js",
+"lineCount":14,
+"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CAw4BtCC,QAASA,EAAa,CAACC,CAAD,CAASC,CAAT,CAAwBC,CAAxB,CAAkC,CACtD,MAAO,CACLC,SAAU,KADL,CAELC,SAAU,CAAA,CAFL,CAGLC,SAAU,GAHL,CAILC,WAAY,SAJP,CAKLC,KAAMA,QAAQ,CAACC,CAAD,CAAQC,CAAR,CAAkBC,CAAlB,CAAwBC,CAAxB,CAA8BC,CAA9B,CAA2C,CAUrDC,QAASA,EAAe,EAAG,CACrBC,CAAJ,GACEZ,CAAAa,OAAA,CAAgBD,CAAhB,CACA,CAAAA,CAAA,CAAyB,IAF3B,CAKIE,EAAJ,GACEA,CAAAC,SAAA,EACA,CAAAD,CAAA,CAAe,IAFjB,CAIIE,EAAJ,GACEJ,CAIA,CAJyBZ,CAAAiB,MAAA,CAAeD,CAAf,CAIzB,CAHAJ,CAAAM,KAAA,CAA4B,QAAQ,EAAG,CACrCN,CAAA,CAAyB,IADY,CAAvC,CAGA,CAAAI,CAAA,CAAiB,IALnB,CAVyB,CAmB3BG,QAASA,EAAM,EAAG,CAAA,IACZC,EAAStB,CAAAuB,QAATD,EAA2BtB,CAAAuB,QAAAD,OAG/B,IAAIzB,CAAA2B,UAAA,CAFWF,CAEX,EAFqBA,CAAAG,UAErB,CAAJ,CAAiC,CAC3BC,IAAAA,EAAWlB,CAAAmB,KAAA,EAAXD,CACAH,EAAUvB,CAAAuB,QAkBdL,EAAA,CAVYN,CAAAgB,CAAYF,CAAZE,CAAsB,QAAQ,CAACA,CAAD,CAAQ,CAChD1B,CAAA2B,MAAA,CAAeD,CAAf,CAAsB,IAAtB,CAA4BV,CAA5B,EAA8CT,CAA9C,CAAAW,KAAA,CAA6DU,QAAsB,EAAG,CAChF,CAAAjC,CAAA2B,UAAA,CAAkBO,CAAlB,CAAJ,EACOA,CADP,EACwB,CAAAvB,CAAAwB,MAAA,CAAYD,CAAZ,CADxB,EAEE9B,CAAA,EAHkF,CAAtF,CAMAY,EAAA,EAPgD,CAAtCe,CAWZZ,EAAA,CAAeO,CAAAf,MAAf,CAA+BkB,CAC/BV,EAAAiB,MAAA,CAAmB,oBAAnB,CACAjB;CAAAgB,MAAA,CAAmBE,CAAnB,CAvB+B,CAAjC,IAyBErB,EAAA,EA7Bc,CA7BmC,IACjDG,CADiD,CAEjDE,CAFiD,CAGjDJ,CAHiD,CAIjDiB,EAAgBrB,CAAAyB,WAJiC,CAKjDD,EAAYxB,CAAA0B,OAAZF,EAA2B,EAE/B1B,EAAA6B,IAAA,CAAU,qBAAV,CAAiChB,CAAjC,CACAA,EAAA,EARqD,CALpD,CAD+C,CA6ExDiB,QAASA,EAAwB,CAACC,CAAD,CAAWC,CAAX,CAAwBxC,CAAxB,CAAgC,CAC/D,MAAO,CACLG,SAAU,KADL,CAELE,SAAW,IAFN,CAGLE,KAAMA,QAAQ,CAACC,CAAD,CAAQC,CAAR,CAAkB,CAAA,IAC1Bc,EAAUvB,CAAAuB,QADgB,CAE1BD,EAASC,CAAAD,OAEbb,EAAAgC,KAAA,CAAcnB,CAAAG,UAAd,CAEA,KAAIlB,EAAOgC,CAAA,CAAS9B,CAAAiC,SAAA,EAAT,CAEX,IAAInB,CAAAoB,WAAJ,CAAwB,CACtBrB,CAAAsB,OAAA,CAAgBpC,CAChB,KAAImC,EAAaH,CAAA,CAAYjB,CAAAoB,WAAZ,CAAgCrB,CAAhC,CACbC,EAAAsB,aAAJ,GACErC,CAAA,CAAMe,CAAAsB,aAAN,CADF,CACgCF,CADhC,CAGAlC,EAAAqC,KAAA,CAAc,yBAAd,CAAyCH,CAAzC,CACAlC,EAAAsC,SAAA,EAAAD,KAAA,CAAyB,yBAAzB,CAAoDH,CAApD,CAPsB,CASxBnC,CAAA,CAAMe,CAAAyB,UAAN,EAA2B,UAA3B,CAAA,CAAyC1B,CAEzCf,EAAA,CAAKC,CAAL,CAnB8B,CAH3B,CADwD,CAn8B7DyC,CAAAA,CAAgBpD,CAAAqD,OAAA,CAAe,SAAf,CAA0B,CAAC,IAAD,CAA1B,CAAAC,SAAA,CACa,QADb,CAkBpBC,QAAuB,EAAG,CACxBC,QAASA,EAAO,CAACC,CAAD;AAASC,CAAT,CAAgB,CAC9B,MAAO1D,EAAA2D,OAAA,CAAeC,MAAAC,OAAA,CAAcJ,CAAd,CAAf,CAAsCC,CAAtC,CADuB,CAwKhCI,QAASA,EAAU,CAACC,CAAD,CAAOC,CAAP,CAAa,CAAA,IAC1BC,EAAcD,CAAAE,qBADY,CAE1BC,EAAM,CACJC,aAAcL,CADV,CAEJM,OAAQN,CAFJ,CAFoB,CAM1BO,EAAOH,CAAAG,KAAPA,CAAkB,EAEtBP,EAAA,CAAOA,CAAAQ,QAAA,CACI,UADJ,CACgB,MADhB,CAAAA,QAAA,CAEI,uBAFJ,CAE6B,QAAQ,CAACC,CAAD,CAAIC,CAAJ,CAAWC,CAAX,CAAgBC,CAAhB,CAAwB,CAC5DC,CAAAA,CAAsB,GAAX,GAAAD,CAAA,CAAiBA,CAAjB,CAA0B,IACrCE,EAAAA,CAAkB,GAAX,GAAAF,CAAA,CAAiBA,CAAjB,CAA0B,IACrCL,EAAAQ,KAAA,CAAU,CAAEC,KAAML,CAAR,CAAaE,SAAU,CAAEA,CAAAA,CAAzB,CAAV,CACAH,EAAA,CAAQA,CAAR,EAAiB,EACjB,OAAO,EAAP,EACKG,CAAA,CAAW,EAAX,CAAgBH,CADrB,EAEI,KAFJ,EAGKG,CAAA,CAAWH,CAAX,CAAmB,EAHxB,GAIKI,CAJL,EAIa,OAJb,EAIwB,SAJxB,GAKKD,CALL,EAKiB,EALjB,EAMI,GANJ,EAOKA,CAPL,EAOiB,EAPjB,CALgE,CAF7D,CAAAL,QAAA,CAgBI,YAhBJ,CAgBkB,MAhBlB,CAkBPJ,EAAAE,OAAA,CAAa,IAAIW,MAAJ,CAAW,GAAX,CAAiBjB,CAAjB,CAAwB,GAAxB,CAA6BE,CAAA,CAAc,GAAd,CAAoB,EAAjD,CACb,OAAOE,EA3BuB,CApKhC,IAAIc,EAAS,EAiHb,KAAAC,KAAA,CAAYC,QAAQ,CAACpB,CAAD,CAAOqB,CAAP,CAAc,CAEhC,IAAIC,EAAYrF,CAAAsF,KAAA,CAAaF,CAAb,CACZpF,EAAAuF,YAAA,CAAoBF,CAAAG,eAApB,CAAJ;CACEH,CAAAG,eADF,CAC6B,CAAA,CAD7B,CAGIxF,EAAAuF,YAAA,CAAoBF,CAAAnB,qBAApB,CAAJ,GACEmB,CAAAnB,qBADF,CACmC,IAAAA,qBADnC,CAGAe,EAAA,CAAOlB,CAAP,CAAA,CAAe/D,CAAA2D,OAAA,CACb0B,CADa,CAEbtB,CAFa,EAELD,CAAA,CAAWC,CAAX,CAAiBsB,CAAjB,CAFK,CAMf,IAAItB,CAAJ,CAAU,CACR,IAAI0B,EAAyC,GAA1B,EAAC1B,CAAA,CAAKA,CAAA2B,OAAL,CAAmB,CAAnB,CAAD,CACX3B,CAAA4B,OAAA,CAAY,CAAZ,CAAe5B,CAAA2B,OAAf,CAA6B,CAA7B,CADW,CAEX3B,CAFW,CAEJ,GAEfkB,EAAA,CAAOQ,CAAP,CAAA,CAAuBzF,CAAA2D,OAAA,CACrB,CAACiC,WAAY7B,CAAb,CADqB,CAErBD,CAAA,CAAW2B,CAAX,CAAyBJ,CAAzB,CAFqB,CALf,CAWV,MAAO,KA1ByB,CAsClC,KAAAnB,qBAAA,CAA4B,CAAA,CAuD5B,KAAA2B,UAAA,CAAiBC,QAAQ,CAACC,CAAD,CAAS,CACV,QAAtB,GAAI,MAAOA,EAAX,GACEA,CADF,CACW,CAACH,WAAYG,CAAb,CADX,CAGA,KAAAb,KAAA,CAAU,IAAV,CAAgBa,CAAhB,CACA,OAAO,KALyB,CASlC,KAAAC,KAAA,CAAY,CAAC,YAAD,CACC,WADD,CAEC,cAFD,CAGC,IAHD,CAIC,WAJD,CAKC,kBALD,CAMC,MAND,CAOR,QAAQ,CAACC,CAAD,CAAaC,CAAb,CAAwBC,CAAxB,CAAsCC,CAAtC,CAA0CC,CAA1C,CAAqDC,CAArD,CAAuEC,CAAvE,CAA6E,CAySvFC,QAASA,EAAY,CAACC,CAAD,CAAiB,CACpC,IAAIC;AAAYvG,CAAAuB,QAOhB,EAJAiF,CAIA,EALAC,CAKA,CALgBC,CAAA,EAKhB,GAJ6CH,CAI7C,EAJ0DE,CAAAE,QAI1D,GAJoFJ,CAAAI,QAIpF,EAHO9G,CAAA+G,OAAA,CAAeH,CAAAI,WAAf,CAAyCN,CAAAM,WAAzC,CAGP,EAFO,CAACJ,CAAApB,eAER,EAFwC,CAACyB,CAEzC,GAAmCP,CAAAA,CAAnC,EAAgDE,CAAAA,CAAhD,EACMX,CAAAiB,WAAA,CAAsB,mBAAtB,CAA2CN,CAA3C,CAA0DF,CAA1D,CAAAS,iBADN,EAEQV,CAFR,EAGMA,CAAAW,eAAA,EAX8B,CAiBtCC,QAASA,EAAW,EAAG,CACrB,IAAIX,EAAYvG,CAAAuB,QAAhB,CACI4F,EAAYV,CAEhB,IAAID,CAAJ,CACED,CAAAX,OAEA,CAFmBuB,CAAAvB,OAEnB,CADA/F,CAAAsF,KAAA,CAAaoB,CAAAX,OAAb,CAA+BI,CAA/B,CACA,CAAAF,CAAAiB,WAAA,CAAsB,cAAtB,CAAsCR,CAAtC,CAHF,KAIO,IAAIY,CAAJ,EAAiBZ,CAAjB,CACLO,CAcA,CAdc,CAAA,CAcd,EAbA9G,CAAAuB,QAaA,CAbiB4F,CAajB,GAXMA,CAAA1B,WAWN,GAVQ5F,CAAAuH,SAAA,CAAiBD,CAAA1B,WAAjB,CAAJ,CACEM,CAAAnC,KAAA,CAAeyD,CAAA,CAAYF,CAAA1B,WAAZ,CAAkC0B,CAAAvB,OAAlC,CAAf,CAAA0B,OAAA,CAA2EH,CAAAvB,OAA3E,CAAAxB,QAAA,EADF,CAIE2B,CAAAwB,IAAA,CAAcJ,CAAA1B,WAAA,CAAqB0B,CAAAN,WAArB,CAA2Cd,CAAAnC,KAAA,EAA3C,CAA6DmC,CAAAuB,OAAA,EAA7D,CAAd,CAAAlD,QAAA,EAMN,EAAA6B,CAAAlB,KAAA,CAAQoC,CAAR,CAAA/F,KAAA,CACO,QAAQ,EAAG,CACd,GAAI+F,CAAJ,CAAe,CAAA,IACT7F;AAASzB,CAAA2D,OAAA,CAAe,EAAf,CAAmB2D,CAAAK,QAAnB,CADA,CAETC,CAFS,CAECC,CAEd7H,EAAA8H,QAAA,CAAgBrG,CAAhB,CAAwB,QAAQ,CAACsG,CAAD,CAAQrD,CAAR,CAAa,CAC3CjD,CAAA,CAAOiD,CAAP,CAAA,CAAc1E,CAAAuH,SAAA,CAAiBQ,CAAjB,CAAA,CACV1B,CAAA2B,IAAA,CAAcD,CAAd,CADU,CACa1B,CAAA4B,OAAA,CAAiBF,CAAjB,CAAwB,IAAxB,CAA8B,IAA9B,CAAoCrD,CAApC,CAFgB,CAA7C,CAKI1E,EAAA2B,UAAA,CAAkBiG,CAAlB,CAA6BN,CAAAM,SAA7B,CAAJ,CACM5H,CAAAkI,WAAA,CAAmBN,CAAnB,CADN,GAEIA,CAFJ,CAEeA,CAAA,CAASN,CAAAvB,OAAT,CAFf,EAIW/F,CAAA2B,UAAA,CAAkBkG,CAAlB,CAAgCP,CAAAO,YAAhC,CAJX,GAKM7H,CAAAkI,WAAA,CAAmBL,CAAnB,CAGJ,GAFEA,CAEF,CAFgBA,CAAA,CAAYP,CAAAvB,OAAZ,CAEhB,EAAI/F,CAAA2B,UAAA,CAAkBkG,CAAlB,CAAJ,GACEP,CAAAa,kBACA,CAD8B5B,CAAA6B,QAAA,CAAaP,CAAb,CAC9B,CAAAD,CAAA,CAAWtB,CAAA,CAAiBuB,CAAjB,CAFb,CARF,CAaI7H,EAAA2B,UAAA,CAAkBiG,CAAlB,CAAJ,GACEnG,CAAA,UADF,CACwBmG,CADxB,CAGA,OAAOxB,EAAAiC,IAAA,CAAO5G,CAAP,CAzBM,CADD,CADlB,CAAAF,KAAA,CA8BO,QAAQ,CAACE,CAAD,CAAS,CAEhB6F,CAAJ,EAAiBnH,CAAAuB,QAAjB,GACM4F,CAIJ,GAHEA,CAAA7F,OACA,CADmBA,CACnB,CAAAzB,CAAAsF,KAAA,CAAagC,CAAAvB,OAAb,CAA+BI,CAA/B,CAEF,EAAAF,CAAAiB,WAAA,CAAsB,qBAAtB,CAA6CI,CAA7C,CAAwDZ,CAAxD,CALF,CAFoB,CA9BxB,CAuCK,QAAQ,CAAC4B,CAAD,CAAQ,CACbhB,CAAJ,EAAiBnH,CAAAuB,QAAjB,EACEuE,CAAAiB,WAAA,CAAsB,mBAAtB;AAA2CI,CAA3C,CAAsDZ,CAAtD,CAAiE4B,CAAjE,CAFe,CAvCrB,CAvBmB,CA0EvBzB,QAASA,EAAU,EAAG,CAAA,IAEhBd,CAFgB,CAERwC,CACZvI,EAAA8H,QAAA,CAAgB7C,CAAhB,CAAwB,QAAQ,CAACG,CAAD,CAAQrB,CAAR,CAAc,CACxC,IAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,IAAA,EAAA,CAAA,KAAA,EAnHbO,EAAAA,CAmHac,CAnHNd,KAAX,KACIyB,EAAS,EAEb,IAgHiBX,CAhHZf,OAAL,CAGA,GADImE,CACJ,CA6GiBpD,CA9GTf,OAAAoE,KAAA,CAAkBC,CAAlB,CACR,CAAA,CAEA,IATqC,IAS5BC,EAAI,CATwB,CASrBC,EAAMJ,CAAA9C,OAAtB,CAAgCiD,CAAhC,CAAoCC,CAApC,CAAyC,EAAED,CAA3C,CAA8C,CAC5C,IAAIjE,EAAMJ,CAAA,CAAKqE,CAAL,CAAS,CAAT,CAAV,CAEIE,EAAML,CAAA,CAAEG,CAAF,CAENjE,EAAJ,EAAWmE,CAAX,GACE9C,CAAA,CAAOrB,CAAAK,KAAP,CADF,CACqB8D,CADrB,CAL4C,CAS9C,CAAA,CAAO9C,CAXP,CAAA,IAAQ,EAAA,CAAO,IAHf,KAAmB,EAAA,CAAO,IAgHT,EAAA,CAAA,CAAA,CAAA,CAAX,CAAA,CAAJ,GACEwC,CAGA,CAHQ/E,CAAA,CAAQ4B,CAAR,CAAe,CACrBW,OAAQ/F,CAAA2D,OAAA,CAAe,EAAf,CAAmBuC,CAAAuB,OAAA,EAAnB,CAAuC1B,CAAvC,CADa,CAErBiB,WAAYjB,CAFS,CAAf,CAGR,CAAAwC,CAAAzB,QAAA,CAAgB1B,CAJlB,CAD4C,CAA9C,CASA,OAAOmD,EAAP,EAAgBtD,CAAA,CAAO,IAAP,CAAhB,EAAgCzB,CAAA,CAAQyB,CAAA,CAAO,IAAP,CAAR,CAAsB,CAACc,OAAQ,EAAT,CAAaiB,WAAW,EAAxB,CAAtB,CAZZ,CAkBtBQ,QAASA,EAAW,CAACsB,CAAD,CAAS/C,CAAT,CAAiB,CACnC,IAAIgD,EAAS,EACb/I,EAAA8H,QAAA,CAAgBkB,CAACF,CAADE,EAAW,EAAXA,OAAA,CAAqB,GAArB,CAAhB,CAA2C,QAAQ,CAACC,CAAD,CAAUN,CAAV,CAAa,CAC9D,GAAU,CAAV,GAAIA,CAAJ,CACEI,CAAAjE,KAAA,CAAYmE,CAAZ,CADF,KAEO,CACL,IAAIC,EAAeD,CAAAV,MAAA,CAAc,oBAAd,CAAnB;AACI7D,EAAMwE,CAAA,CAAa,CAAb,CACVH,EAAAjE,KAAA,CAAYiB,CAAA,CAAOrB,CAAP,CAAZ,CACAqE,EAAAjE,KAAA,CAAYoE,CAAA,CAAa,CAAb,CAAZ,EAA+B,EAA/B,CACA,QAAOnD,CAAA,CAAOrB,CAAP,CALF,CAHuD,CAAhE,CAWA,OAAOqE,EAAAI,KAAA,CAAY,EAAZ,CAb4B,CAtZkD,IAuMnFlC,EAAc,CAAA,CAvMqE,CAwMnFL,CAxMmF,CAyMnFD,CAzMmF,CA0MnFxG,EAAS,CACP8E,OAAQA,CADD,CAcPmE,OAAQA,QAAQ,EAAG,CACjBnC,CAAA,CAAc,CAAA,CAEd,KAAIoC,EAAoB,CACtBlC,iBAAkB,CAAA,CADI,CAEtBC,eAAgBkC,QAA2B,EAAG,CAC5C,IAAAnC,iBAAA,CAAwB,CAAA,CACxBF,EAAA,CAAc,CAAA,CAF8B,CAFxB,CAQxBhB,EAAAsD,WAAA,CAAsB,QAAQ,EAAG,CAC/B/C,CAAA,CAAa6C,CAAb,CACKA,EAAAlC,iBAAL,EAAyCE,CAAA,EAFV,CAAjC,CAXiB,CAdZ,CA4CPmC,aAAcA,QAAQ,CAACC,CAAD,CAAY,CAChC,GAAI,IAAA/H,QAAJ,EAAoB,IAAAA,QAAAoF,QAApB,CACE2C,CAGA,CAHYzJ,CAAA2D,OAAA,CAAe,EAAf,CAAmB,IAAAjC,QAAAqE,OAAnB,CAAwC0D,CAAxC,CAGZ,CAFAvD,CAAAnC,KAAA,CAAeyD,CAAA,CAAY,IAAA9F,QAAAoF,QAAA1C,aAAZ,CAA+CqF,CAA/C,CAAf,CAEA,CAAAvD,CAAAuB,OAAA,CAAiBgC,CAAjB,CAJF,KAME,MAAMC,EAAA,CAAa,QAAb,CAAN,CAP8B,CA5C3B,CAwDbzD,EAAAzD,IAAA,CAAe,sBAAf,CAAuCgE,CAAvC,CACAP,EAAAzD,IAAA,CAAe,wBAAf;AAAyC6E,CAAzC,CAEA,OAAOlH,EArQgF,CAP7E,CA5NY,CAlBN,CAApB,KAEIuJ,EAAe1J,CAAA2J,SAAA,CAAiB,SAAjB,CA2pBnBvG,EAAAE,SAAA,CAAuB,cAAvB,CAoCAsG,QAA6B,EAAG,CAC9B,IAAA5D,KAAA,CAAY6D,QAAQ,EAAG,CAAE,MAAO,EAAT,CADO,CApChC,CAwCAzG,EAAA0G,UAAA,CAAwB,QAAxB,CAAkC5J,CAAlC,CACAkD,EAAA0G,UAAA,CAAwB,QAAxB,CAAkCrH,CAAlC,CA+KAvC,EAAA6J,QAAA,CAAwB,CAAC,QAAD,CAAW,eAAX,CAA4B,UAA5B,CA6ExBtH,EAAAsH,QAAA,CAAmC,CAAC,UAAD,CAAa,aAAb,CAA4B,QAA5B,CAp9BG,CAArC,CAAD,CAk/BGhK,MAl/BH,CAk/BWA,MAAAC,QAl/BX;",
+"sources":["angular-route.js"],
+"names":["window","angular","undefined","ngViewFactory","$route","$anchorScroll","$animate","restrict","terminal","priority","transclude","link","scope","$element","attr","ctrl","$transclude","cleanupLastView","previousLeaveAnimation","cancel","currentScope","$destroy","currentElement","leave","then","update","locals","current","isDefined","$template","newScope","$new","clone","enter","onNgViewEnter","autoScrollExp","$eval","$emit","onloadExp","autoscroll","onload","$on","ngViewFillContentFactory","$compile","$controller","html","contents","controller","$scope","controllerAs","data","children","resolveAs","ngRouteModule","module","provider","$RouteProvider","inherit","parent","extra","extend","Object","create","pathRegExp","path","opts","insensitive","caseInsensitiveMatch","ret","originalPath","regexp","keys","replace","_","slash","key","option","optional","star","push","name","RegExp","routes","when","this.when","route","routeCopy","copy","isUndefined","reloadOnSearch","redirectPath","length","substr","redirectTo","otherwise","this.otherwise","params","$get","$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce","prepareRoute","$locationEvent","lastRoute","preparedRouteIsUpdateOnly","preparedRoute","parseRoute","$$route","equals","pathParams","forceReload","$broadcast","defaultPrevented","preventDefault","commitRoute","nextRoute","isString","interpolate","search","url","resolve","template","templateUrl","forEach","value","get","invoke","isFunction","loadedTemplateUrl","valueOf","all","error","match","m","exec","on","i","len","val","string","result","split","segment","segmentMatch","join","reload","fakeLocationEvent","fakePreventDefault","$evalAsync","updateParams","newParams","$routeMinErr","$$minErr","$RouteParamsProvider","this.$get","directive","$inject"]
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.js
new file mode 100644
index 00000000..8b610c76
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.js
@@ -0,0 +1,717 @@
+/**
+ * @license AngularJS v1.5.0
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+var $sanitizeMinErr = angular.$$minErr('$sanitize');
+
+/**
+ * @ngdoc module
+ * @name ngSanitize
+ * @description
+ *
+ * # ngSanitize
+ *
+ * The `ngSanitize` module provides functionality to sanitize HTML.
+ *
+ *
+ * <div doc-module-components="ngSanitize"></div>
+ *
+ * See {@link ngSanitize.$sanitize `$sanitize`} for usage.
+ */
+
+/**
+ * @ngdoc service
+ * @name $sanitize
+ * @kind function
+ *
+ * @description
+ * Sanitizes an html string by stripping all potentially dangerous tokens.
+ *
+ * The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are
+ * then serialized back to properly escaped html string. This means that no unsafe input can make
+ * it into the returned string.
+ *
+ * The whitelist for URL sanitization of attribute values is configured using the functions
+ * `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider
+ * `$compileProvider`}.
+ *
+ * The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}.
+ *
+ * @param {string} html HTML input.
+ * @returns {string} Sanitized HTML.
+ *
+ * @example
+ <example module="sanitizeExample" deps="angular-sanitize.js">
+ <file name="index.html">
+ <script>
+ angular.module('sanitizeExample', ['ngSanitize'])
+ .controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
+ $scope.snippet =
+ '<p style="color:blue">an html\n' +
+ '<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
+ 'snippet</p>';
+ $scope.deliberatelyTrustDangerousSnippet = function() {
+ return $sce.trustAsHtml($scope.snippet);
+ };
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
+ <table>
+ <tr>
+ <td>Directive</td>
+ <td>How</td>
+ <td>Source</td>
+ <td>Rendered</td>
+ </tr>
+ <tr id="bind-html-with-sanitize">
+ <td>ng-bind-html</td>
+ <td>Automatically uses $sanitize</td>
+ <td><pre>&lt;div ng-bind-html="snippet"&gt;<br/>&lt;/div&gt;</pre></td>
+ <td><div ng-bind-html="snippet"></div></td>
+ </tr>
+ <tr id="bind-html-with-trust">
+ <td>ng-bind-html</td>
+ <td>Bypass $sanitize by explicitly trusting the dangerous value</td>
+ <td>
+ <pre>&lt;div ng-bind-html="deliberatelyTrustDangerousSnippet()"&gt;
+&lt;/div&gt;</pre>
+ </td>
+ <td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td>
+ </tr>
+ <tr id="bind-default">
+ <td>ng-bind</td>
+ <td>Automatically escapes</td>
+ <td><pre>&lt;div ng-bind="snippet"&gt;<br/>&lt;/div&gt;</pre></td>
+ <td><div ng-bind="snippet"></div></td>
+ </tr>
+ </table>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should sanitize the html snippet by default', function() {
+ expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
+ toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
+ });
+
+ it('should inline raw snippet if bound to a trusted value', function() {
+ expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).
+ toBe("<p style=\"color:blue\">an html\n" +
+ "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
+ "snippet</p>");
+ });
+
+ it('should escape snippet without any filter', function() {
+ expect(element(by.css('#bind-default div')).getInnerHtml()).
+ toBe("&lt;p style=\"color:blue\"&gt;an html\n" +
+ "&lt;em onmouseover=\"this.textContent='PWN3D!'\"&gt;click here&lt;/em&gt;\n" +
+ "snippet&lt;/p&gt;");
+ });
+
+ it('should update', function() {
+ element(by.model('snippet')).clear();
+ element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>');
+ expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
+ toBe('new <b>text</b>');
+ expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(
+ 'new <b onclick="alert(1)">text</b>');
+ expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(
+ "new &lt;b onclick=\"alert(1)\"&gt;text&lt;/b&gt;");
+ });
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc provider
+ * @name $sanitizeProvider
+ *
+ * @description
+ * Creates and configures {@link $sanitize} instance.
+ */
+function $SanitizeProvider() {
+ var svgEnabled = false;
+
+ this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
+ if (svgEnabled) {
+ angular.extend(validElements, svgElements);
+ }
+ return function(html) {
+ var buf = [];
+ htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {
+ return !/^unsafe:/.test($$sanitizeUri(uri, isImage));
+ }));
+ return buf.join('');
+ };
+ }];
+
+
+ /**
+ * @ngdoc method
+ * @name $sanitizeProvider#enableSvg
+ * @kind function
+ *
+ * @description
+ * Enables a subset of svg to be supported by the sanitizer.
+ *
+ * <div class="alert alert-warning">
+ * <p>By enabling this setting without taking other precautions, you might expose your
+ * application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned
+ * outside of the containing element and be rendered over other elements on the page (e.g. a login
+ * link). Such behavior can then result in phishing incidents.</p>
+ *
+ * <p>To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg
+ * tags within the sanitized content:</p>
+ *
+ * <br>
+ *
+ * <pre><code>
+ * .rootOfTheIncludedContent svg {
+ * overflow: hidden !important;
+ * }
+ * </code></pre>
+ * </div>
+ *
+ * @param {boolean=} regexp New regexp to whitelist urls with.
+ * @returns {boolean|ng.$sanitizeProvider} Returns the currently configured value if called
+ * without an argument or self for chaining otherwise.
+ */
+ this.enableSvg = function(enableSvg) {
+ if (angular.isDefined(enableSvg)) {
+ svgEnabled = enableSvg;
+ return this;
+ } else {
+ return svgEnabled;
+ }
+ };
+}
+
+function sanitizeText(chars) {
+ var buf = [];
+ var writer = htmlSanitizeWriter(buf, angular.noop);
+ writer.chars(chars);
+ return buf.join('');
+}
+
+
+// Regular Expressions for parsing tags and attributes
+var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
+ // Match everything outside of normal chars and " (quote character)
+ NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
+
+
+// Good source of info about elements and attributes
+// http://dev.w3.org/html5/spec/Overview.html#semantics
+// http://simon.html5.org/html-elements
+
+// Safe Void Elements - HTML5
+// http://dev.w3.org/html5/spec/Overview.html#void-elements
+var voidElements = toMap("area,br,col,hr,img,wbr");
+
+// Elements that you can, intentionally, leave open (and which close themselves)
+// http://dev.w3.org/html5/spec/Overview.html#optional-tags
+var optionalEndTagBlockElements = toMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),
+ optionalEndTagInlineElements = toMap("rp,rt"),
+ optionalEndTagElements = angular.extend({},
+ optionalEndTagInlineElements,
+ optionalEndTagBlockElements);
+
+// Safe Block Elements - HTML5
+var blockElements = angular.extend({}, optionalEndTagBlockElements, toMap("address,article," +
+ "aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," +
+ "h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul"));
+
+// Inline Elements - HTML5
+var inlineElements = angular.extend({}, optionalEndTagInlineElements, toMap("a,abbr,acronym,b," +
+ "bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," +
+ "samp,small,span,strike,strong,sub,sup,time,tt,u,var"));
+
+// SVG Elements
+// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements
+// Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.
+// They can potentially allow for arbitrary javascript to be executed. See #11290
+var svgElements = toMap("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph," +
+ "hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline," +
+ "radialGradient,rect,stop,svg,switch,text,title,tspan");
+
+// Blocked Elements (will be stripped)
+var blockedElements = toMap("script,style");
+
+var validElements = angular.extend({},
+ voidElements,
+ blockElements,
+ inlineElements,
+ optionalEndTagElements);
+
+//Attributes that have href and hence need to be sanitized
+var uriAttrs = toMap("background,cite,href,longdesc,src,xlink:href");
+
+var htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +
+ 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +
+ 'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +
+ 'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' +
+ 'valign,value,vspace,width');
+
+// SVG attributes (without "id" and "name" attributes)
+// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes
+var svgAttrs = toMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +
+ 'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' +
+ 'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' +
+ 'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' +
+ 'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' +
+ 'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' +
+ 'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' +
+ 'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' +
+ 'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' +
+ 'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' +
+ 'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' +
+ 'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' +
+ 'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' +
+ 'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' +
+ 'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);
+
+var validAttrs = angular.extend({},
+ uriAttrs,
+ svgAttrs,
+ htmlAttrs);
+
+function toMap(str, lowercaseKeys) {
+ var obj = {}, items = str.split(','), i;
+ for (i = 0; i < items.length; i++) {
+ obj[lowercaseKeys ? angular.lowercase(items[i]) : items[i]] = true;
+ }
+ return obj;
+}
+
+var inertBodyElement;
+(function(window) {
+ var doc;
+ if (window.document && window.document.implementation) {
+ doc = window.document.implementation.createHTMLDocument("inert");
+ } else {
+ throw $sanitizeMinErr('noinert', "Can't create an inert html document");
+ }
+ var docElement = doc.documentElement || doc.getDocumentElement();
+ var bodyElements = docElement.getElementsByTagName('body');
+
+ // usually there should be only one body element in the document, but IE doesn't have any, so we need to create one
+ if (bodyElements.length === 1) {
+ inertBodyElement = bodyElements[0];
+ } else {
+ var html = doc.createElement('html');
+ inertBodyElement = doc.createElement('body');
+ html.appendChild(inertBodyElement);
+ doc.appendChild(html);
+ }
+})(window);
+
+/**
+ * @example
+ * htmlParser(htmlString, {
+ * start: function(tag, attrs) {},
+ * end: function(tag) {},
+ * chars: function(text) {},
+ * comment: function(text) {}
+ * });
+ *
+ * @param {string} html string
+ * @param {object} handler
+ */
+function htmlParser(html, handler) {
+ if (html === null || html === undefined) {
+ html = '';
+ } else if (typeof html !== 'string') {
+ html = '' + html;
+ }
+ inertBodyElement.innerHTML = html;
+
+ //mXSS protection
+ var mXSSAttempts = 5;
+ do {
+ if (mXSSAttempts === 0) {
+ throw $sanitizeMinErr('uinput', "Failed to sanitize html because the input is unstable");
+ }
+ mXSSAttempts--;
+
+ // strip custom-namespaced attributes on IE<=11
+ if (document.documentMode <= 11) {
+ stripCustomNsAttrs(inertBodyElement);
+ }
+ html = inertBodyElement.innerHTML; //trigger mXSS
+ inertBodyElement.innerHTML = html;
+ } while (html !== inertBodyElement.innerHTML);
+
+ var node = inertBodyElement.firstChild;
+ while (node) {
+ switch (node.nodeType) {
+ case 1: // ELEMENT_NODE
+ handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes));
+ break;
+ case 3: // TEXT NODE
+ handler.chars(node.textContent);
+ break;
+ }
+
+ var nextNode;
+ if (!(nextNode = node.firstChild)) {
+ if (node.nodeType == 1) {
+ handler.end(node.nodeName.toLowerCase());
+ }
+ nextNode = node.nextSibling;
+ if (!nextNode) {
+ while (nextNode == null) {
+ node = node.parentNode;
+ if (node === inertBodyElement) break;
+ nextNode = node.nextSibling;
+ if (node.nodeType == 1) {
+ handler.end(node.nodeName.toLowerCase());
+ }
+ }
+ }
+ }
+ node = nextNode;
+ }
+
+ while (node = inertBodyElement.firstChild) {
+ inertBodyElement.removeChild(node);
+ }
+}
+
+function attrToMap(attrs) {
+ var map = {};
+ for (var i = 0, ii = attrs.length; i < ii; i++) {
+ var attr = attrs[i];
+ map[attr.name] = attr.value;
+ }
+ return map;
+}
+
+
+/**
+ * Escapes all potentially dangerous characters, so that the
+ * resulting string can be safely inserted into attribute or
+ * element text.
+ * @param value
+ * @returns {string} escaped text
+ */
+function encodeEntities(value) {
+ return value.
+ replace(/&/g, '&amp;').
+ replace(SURROGATE_PAIR_REGEXP, function(value) {
+ var hi = value.charCodeAt(0);
+ var low = value.charCodeAt(1);
+ return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
+ }).
+ replace(NON_ALPHANUMERIC_REGEXP, function(value) {
+ return '&#' + value.charCodeAt(0) + ';';
+ }).
+ replace(/</g, '&lt;').
+ replace(/>/g, '&gt;');
+}
+
+/**
+ * create an HTML/XML writer which writes to buffer
+ * @param {Array} buf use buf.join('') to get out sanitized html string
+ * @returns {object} in the form of {
+ * start: function(tag, attrs) {},
+ * end: function(tag) {},
+ * chars: function(text) {},
+ * comment: function(text) {}
+ * }
+ */
+function htmlSanitizeWriter(buf, uriValidator) {
+ var ignoreCurrentElement = false;
+ var out = angular.bind(buf, buf.push);
+ return {
+ start: function(tag, attrs) {
+ tag = angular.lowercase(tag);
+ if (!ignoreCurrentElement && blockedElements[tag]) {
+ ignoreCurrentElement = tag;
+ }
+ if (!ignoreCurrentElement && validElements[tag] === true) {
+ out('<');
+ out(tag);
+ angular.forEach(attrs, function(value, key) {
+ var lkey=angular.lowercase(key);
+ var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');
+ if (validAttrs[lkey] === true &&
+ (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
+ out(' ');
+ out(key);
+ out('="');
+ out(encodeEntities(value));
+ out('"');
+ }
+ });
+ out('>');
+ }
+ },
+ end: function(tag) {
+ tag = angular.lowercase(tag);
+ if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {
+ out('</');
+ out(tag);
+ out('>');
+ }
+ if (tag == ignoreCurrentElement) {
+ ignoreCurrentElement = false;
+ }
+ },
+ chars: function(chars) {
+ if (!ignoreCurrentElement) {
+ out(encodeEntities(chars));
+ }
+ }
+ };
+}
+
+
+/**
+ * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare
+ * ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want
+ * to allow any of these custom attributes. This method strips them all.
+ *
+ * @param node Root element to process
+ */
+function stripCustomNsAttrs(node) {
+ if (node.nodeType === Node.ELEMENT_NODE) {
+ var attrs = node.attributes;
+ for (var i = 0, l = attrs.length; i < l; i++) {
+ var attrNode = attrs[i];
+ var attrName = attrNode.name.toLowerCase();
+ if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {
+ node.removeAttributeNode(attrNode);
+ i--;
+ l--;
+ }
+ }
+ }
+
+ var nextNode = node.firstChild;
+ if (nextNode) {
+ stripCustomNsAttrs(nextNode);
+ }
+
+ nextNode = node.nextSibling;
+ if (nextNode) {
+ stripCustomNsAttrs(nextNode);
+ }
+}
+
+
+
+// define ngSanitize module and register $sanitize service
+angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
+
+/* global sanitizeText: false */
+
+/**
+ * @ngdoc filter
+ * @name linky
+ * @kind function
+ *
+ * @description
+ * Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and
+ * plain email address links.
+ *
+ * Requires the {@link ngSanitize `ngSanitize`} module to be installed.
+ *
+ * @param {string} text Input text.
+ * @param {string} target Window (`_blank|_self|_parent|_top`) or named frame to open links in.
+ * @param {object|function(url)} [attributes] Add custom attributes to the link element.
+ *
+ * Can be one of:
+ *
+ * - `object`: A map of attributes
+ * - `function`: Takes the url as a parameter and returns a map of attributes
+ *
+ * If the map of attributes contains a value for `target`, it overrides the value of
+ * the target parameter.
+ *
+ *
+ * @returns {string} Html-linkified and {@link $sanitize sanitized} text.
+ *
+ * @usage
+ <span ng-bind-html="linky_expression | linky"></span>
+ *
+ * @example
+ <example module="linkyExample" deps="angular-sanitize.js">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
+ <table>
+ <tr>
+ <th>Filter</th>
+ <th>Source</th>
+ <th>Rendered</th>
+ </tr>
+ <tr id="linky-filter">
+ <td>linky filter</td>
+ <td>
+ <pre>&lt;div ng-bind-html="snippet | linky"&gt;<br>&lt;/div&gt;</pre>
+ </td>
+ <td>
+ <div ng-bind-html="snippet | linky"></div>
+ </td>
+ </tr>
+ <tr id="linky-target">
+ <td>linky target</td>
+ <td>
+ <pre>&lt;div ng-bind-html="snippetWithSingleURL | linky:'_blank'"&gt;<br>&lt;/div&gt;</pre>
+ </td>
+ <td>
+ <div ng-bind-html="snippetWithSingleURL | linky:'_blank'"></div>
+ </td>
+ </tr>
+ <tr id="linky-custom-attributes">
+ <td>linky custom attributes</td>
+ <td>
+ <pre>&lt;div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"&gt;<br>&lt;/div&gt;</pre>
+ </td>
+ <td>
+ <div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"></div>
+ </td>
+ </tr>
+ <tr id="escaped-html">
+ <td>no filter</td>
+ <td><pre>&lt;div ng-bind="snippet"&gt;<br>&lt;/div&gt;</pre></td>
+ <td><div ng-bind="snippet"></div></td>
+ </tr>
+ </table>
+ </file>
+ <file name="script.js">
+ angular.module('linkyExample', ['ngSanitize'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.snippet =
+ 'Pretty text with some links:\n'+
+ 'http://angularjs.org/,\n'+
+ 'mailto:us@somewhere.org,\n'+
+ 'another@somewhere.org,\n'+
+ 'and one more: ftp://127.0.0.1/.';
+ $scope.snippetWithSingleURL = 'http://angularjs.org/';
+ }]);
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should linkify the snippet with urls', function() {
+ expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
+ toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +
+ 'another@somewhere.org, and one more: ftp://127.0.0.1/.');
+ expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
+ });
+
+ it('should not linkify snippet without the linky filter', function() {
+ expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
+ toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +
+ 'another@somewhere.org, and one more: ftp://127.0.0.1/.');
+ expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
+ });
+
+ it('should update', function() {
+ element(by.model('snippet')).clear();
+ element(by.model('snippet')).sendKeys('new http://link.');
+ expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
+ toBe('new http://link.');
+ expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
+ expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
+ .toBe('new http://link.');
+ });
+
+ it('should work with the target property', function() {
+ expect(element(by.id('linky-target')).
+ element(by.binding("snippetWithSingleURL | linky:'_blank'")).getText()).
+ toBe('http://angularjs.org/');
+ expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
+ });
+
+ it('should optionally add custom attributes', function() {
+ expect(element(by.id('linky-custom-attributes')).
+ element(by.binding("snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}")).getText()).
+ toBe('http://angularjs.org/');
+ expect(element(by.css('#linky-custom-attributes a')).getAttribute('rel')).toEqual('nofollow');
+ });
+ </file>
+ </example>
+ */
+angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
+ var LINKY_URL_REGEXP =
+ /((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,
+ MAILTO_REGEXP = /^mailto:/i;
+
+ var linkyMinErr = angular.$$minErr('linky');
+ var isString = angular.isString;
+
+ return function(text, target, attributes) {
+ if (text == null || text === '') return text;
+ if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);
+
+ var match;
+ var raw = text;
+ var html = [];
+ var url;
+ var i;
+ while ((match = raw.match(LINKY_URL_REGEXP))) {
+ // We can not end in these as they are sometimes found at the end of the sentence
+ url = match[0];
+ // if we did not match ftp/http/www/mailto then assume mailto
+ if (!match[2] && !match[4]) {
+ url = (match[3] ? 'http://' : 'mailto:') + url;
+ }
+ i = match.index;
+ addText(raw.substr(0, i));
+ addLink(url, match[0].replace(MAILTO_REGEXP, ''));
+ raw = raw.substring(i + match[0].length);
+ }
+ addText(raw);
+ return $sanitize(html.join(''));
+
+ function addText(text) {
+ if (!text) {
+ return;
+ }
+ html.push(sanitizeText(text));
+ }
+
+ function addLink(url, text) {
+ var key;
+ html.push('<a ');
+ if (angular.isFunction(attributes)) {
+ attributes = attributes(url);
+ }
+ if (angular.isObject(attributes)) {
+ for (key in attributes) {
+ html.push(key + '="' + attributes[key] + '" ');
+ }
+ } else {
+ attributes = {};
+ }
+ if (angular.isDefined(target) && !('target' in attributes)) {
+ html.push('target="',
+ target,
+ '" ');
+ }
+ html.push('href="',
+ url.replace(/"/g, '&quot;'),
+ '">');
+ addText(text);
+ html.push('</a>');
+ }
+ };
+}]);
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js
new file mode 100644
index 00000000..135d5a0e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js
@@ -0,0 +1,15 @@
+/*
+ AngularJS v1.5.0
+ (c) 2010-2016 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(A,e,B){'use strict';function C(a){var c=[];v(c,e.noop).chars(a);return c.join("")}function h(a,c){var b={},d=a.split(","),l;for(l=0;l<d.length;l++)b[c?e.lowercase(d[l]):d[l]]=!0;return b}function D(a,c){null===a||a===B?a="":"string"!==typeof a&&(a=""+a);g.innerHTML=a;var b=5;do{if(0===b)throw w("uinput");b--;11>=document.documentMode&&n(g);a=g.innerHTML;g.innerHTML=a}while(a!==g.innerHTML);for(b=g.firstChild;b;){switch(b.nodeType){case 1:c.start(b.nodeName.toLowerCase(),E(b.attributes));
+break;case 3:c.chars(b.textContent)}var d;if(!(d=b.firstChild)&&(1==b.nodeType&&c.end(b.nodeName.toLowerCase()),d=b.nextSibling,!d))for(;null==d;){b=b.parentNode;if(b===g)break;d=b.nextSibling;1==b.nodeType&&c.end(b.nodeName.toLowerCase())}b=d}for(;b=g.firstChild;)g.removeChild(b)}function E(a){for(var c={},b=0,d=a.length;b<d;b++){var l=a[b];c[l.name]=l.value}return c}function x(a){return a.replace(/&/g,"&amp;").replace(F,function(a){var b=a.charCodeAt(0);a=a.charCodeAt(1);return"&#"+(1024*(b-55296)+
+(a-56320)+65536)+";"}).replace(G,function(a){return"&#"+a.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}function v(a,c){var b=!1,d=e.bind(a,a.push);return{start:function(a,f){a=e.lowercase(a);!b&&H[a]&&(b=a);b||!0!==t[a]||(d("<"),d(a),e.forEach(f,function(b,f){var g=e.lowercase(f),h="img"===a&&"src"===g||"background"===g;!0!==I[g]||!0===y[g]&&!c(b,h)||(d(" "),d(f),d('="'),d(x(b)),d('"'))}),d(">"))},end:function(a){a=e.lowercase(a);b||!0!==t[a]||!0===z[a]||(d("</"),d(a),d(">"));a==
+b&&(b=!1)},chars:function(a){b||d(x(a))}}}function n(a){if(a.nodeType===Node.ELEMENT_NODE)for(var c=a.attributes,b=0,d=c.length;b<d;b++){var e=c[b],f=e.name.toLowerCase();if("xmlns:ns1"===f||0===f.indexOf("ns1:"))a.removeAttributeNode(e),b--,d--}(c=a.firstChild)&&n(c);(c=a.nextSibling)&&n(c)}var w=e.$$minErr("$sanitize"),F=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,G=/([^\#-~ |!])/g,z=h("area,br,col,hr,img,wbr"),q=h("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),k=h("rp,rt"),u=e.extend({},k,q),q=e.extend({},
+q,h("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul")),k=e.extend({},k,h("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),J=h("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,stop,svg,switch,text,title,tspan"),
+H=h("script,style"),t=e.extend({},z,q,k,u),y=h("background,cite,href,longdesc,src,xlink:href"),u=h("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,valign,value,vspace,width"),k=h("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan",
+!0),I=e.extend({},y,k,u),g;(function(a){if(a.document&&a.document.implementation)a=a.document.implementation.createHTMLDocument("inert");else throw w("noinert");var c=(a.documentElement||a.getDocumentElement()).getElementsByTagName("body");1===c.length?g=c[0]:(c=a.createElement("html"),g=a.createElement("body"),c.appendChild(g),a.appendChild(c))})(A);e.module("ngSanitize",[]).provider("$sanitize",function(){var a=!1;this.$get=["$$sanitizeUri",function(c){a&&e.extend(t,J);return function(a){var d=
+[];D(a,v(d,function(a,b){return!/^unsafe:/.test(c(a,b))}));return d.join("")}}];this.enableSvg=function(c){return e.isDefined(c)?(a=c,this):a}});e.module("ngSanitize").filter("linky",["$sanitize",function(a){var c=/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,b=/^mailto:/i,d=e.$$minErr("linky"),g=e.isString;return function(f,h,m){function k(a){a&&p.push(C(a))}function q(a,b){var c;p.push("<a ");e.isFunction(m)&&(m=m(a));if(e.isObject(m))for(c in m)p.push(c+
+'="'+m[c]+'" ');else m={};!e.isDefined(h)||"target"in m||p.push('target="',h,'" ');p.push('href="',a.replace(/"/g,"&quot;"),'">');k(b);p.push("</a>")}if(null==f||""===f)return f;if(!g(f))throw d("notstring",f);for(var r=f,p=[],s,n;f=r.match(c);)s=f[0],f[2]||f[4]||(s=(f[3]?"http://":"mailto:")+s),n=f.index,k(r.substr(0,n)),q(s,f[0].replace(b,"")),r=r.substring(n+f[0].length);k(r);return a(p.join(""))}}])})(window,window.angular);
+//# sourceMappingURL=angular-sanitize.min.js.map
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js.map
new file mode 100644
index 00000000..7276abd2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js.map
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"angular-sanitize.min.js",
+"lineCount":14,
+"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CAsMtCC,QAASA,EAAY,CAACC,CAAD,CAAQ,CAC3B,IAAIC,EAAM,EACGC,EAAAC,CAAmBF,CAAnBE,CAAwBN,CAAAO,KAAxBD,CACbH,MAAA,CAAaA,CAAb,CACA,OAAOC,EAAAI,KAAA,CAAS,EAAT,CAJoB,CAyF7BC,QAASA,EAAK,CAACC,CAAD,CAAMC,CAAN,CAAqB,CAAA,IAC7BC,EAAM,EADuB,CACnBC,EAAQH,CAAAI,MAAA,CAAU,GAAV,CADW,CACKC,CACtC,KAAKA,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgBF,CAAAG,OAAhB,CAA8BD,CAAA,EAA9B,CACEH,CAAA,CAAID,CAAA,CAAgBX,CAAAiB,UAAA,CAAkBJ,CAAA,CAAME,CAAN,CAAlB,CAAhB,CAA8CF,CAAA,CAAME,CAAN,CAAlD,CAAA,CAA8D,CAAA,CAEhE,OAAOH,EAL0B,CA0CnCM,QAASA,EAAU,CAACC,CAAD,CAAOC,CAAP,CAAgB,CACpB,IAAb,GAAID,CAAJ,EAAqBA,CAArB,GAA8BlB,CAA9B,CACEkB,CADF,CACS,EADT,CAE2B,QAF3B,GAEW,MAAOA,EAFlB,GAGEA,CAHF,CAGS,EAHT,CAGcA,CAHd,CAKAE,EAAAC,UAAA,CAA6BH,CAG7B,KAAII,EAAe,CACnB,GAAG,CACD,GAAqB,CAArB,GAAIA,CAAJ,CACE,KAAMC,EAAA,CAAgB,QAAhB,CAAN,CAEFD,CAAA,EAG6B,GAA7B,EAAIE,QAAAC,aAAJ,EACEC,CAAA,CAAmBN,CAAnB,CAEFF,EAAA,CAAOE,CAAAC,UACPD,EAAAC,UAAA,CAA6BH,CAX5B,CAAH,MAYSA,CAZT,GAYkBE,CAAAC,UAZlB,CAeA,KADIM,CACJ,CADWP,CAAAQ,WACX,CAAOD,CAAP,CAAA,CAAa,CACX,OAAQA,CAAAE,SAAR,EACE,KAAK,CAAL,CACEV,CAAAW,MAAA,CAAcH,CAAAI,SAAAC,YAAA,EAAd,CAA2CC,CAAA,CAAUN,CAAAO,WAAV,CAA3C,CACA;KACF,MAAK,CAAL,CACEf,CAAAjB,MAAA,CAAcyB,CAAAQ,YAAd,CALJ,CASA,IAAIC,CACJ,IAAM,EAAAA,CAAA,CAAWT,CAAAC,WAAX,CAAN,GACuB,CAIhBQ,EAJDT,CAAAE,SAICO,EAHHjB,CAAAkB,IAAA,CAAYV,CAAAI,SAAAC,YAAA,EAAZ,CAGGI,CADLA,CACKA,CADMT,CAAAW,YACNF,CAAAA,CAAAA,CALP,EAMI,IAAA,CAAmB,IAAnB,EAAOA,CAAP,CAAA,CAAyB,CACvBT,CAAA,CAAOA,CAAAY,WACP,IAAIZ,CAAJ,GAAaP,CAAb,CAA+B,KAC/BgB,EAAA,CAAWT,CAAAW,YACU,EAArB,EAAIX,CAAAE,SAAJ,EACEV,CAAAkB,IAAA,CAAYV,CAAAI,SAAAC,YAAA,EAAZ,CALqB,CAU7BL,CAAA,CAAOS,CA3BI,CA8Bb,IAAA,CAAOT,CAAP,CAAcP,CAAAQ,WAAd,CAAA,CACER,CAAAoB,YAAA,CAA6Bb,CAA7B,CAxD+B,CA4DnCM,QAASA,EAAS,CAACQ,CAAD,CAAQ,CAExB,IADA,IAAIC,EAAM,EAAV,CACS5B,EAAI,CADb,CACgB6B,EAAKF,CAAA1B,OAArB,CAAmCD,CAAnC,CAAuC6B,CAAvC,CAA2C7B,CAAA,EAA3C,CAAgD,CAC9C,IAAI8B,EAAOH,CAAA,CAAM3B,CAAN,CACX4B,EAAA,CAAIE,CAAAC,KAAJ,CAAA,CAAiBD,CAAAE,MAF6B,CAIhD,MAAOJ,EANiB,CAiB1BK,QAASA,EAAc,CAACD,CAAD,CAAQ,CAC7B,MAAOA,EAAAE,QAAA,CACG,IADH,CACS,OADT,CAAAA,QAAA,CAEGC,CAFH,CAE0B,QAAQ,CAACH,CAAD,CAAQ,CAC7C,IAAII,EAAKJ,CAAAK,WAAA,CAAiB,CAAjB,CACLC,EAAAA,CAAMN,CAAAK,WAAA,CAAiB,CAAjB,CACV,OAAO,IAAP,EAAgC,IAAhC,EAAiBD,CAAjB,CAAsB,KAAtB;CAA0CE,CAA1C,CAAgD,KAAhD,EAA0D,KAA1D,EAAqE,GAHxB,CAF1C,CAAAJ,QAAA,CAOGK,CAPH,CAO4B,QAAQ,CAACP,CAAD,CAAQ,CAC/C,MAAO,IAAP,CAAcA,CAAAK,WAAA,CAAiB,CAAjB,CAAd,CAAoC,GADW,CAP5C,CAAAH,QAAA,CAUG,IAVH,CAUS,MAVT,CAAAA,QAAA,CAWG,IAXH,CAWS,MAXT,CADsB,CAyB/B5C,QAASA,EAAkB,CAACD,CAAD,CAAMmD,CAAN,CAAoB,CAC7C,IAAIC,EAAuB,CAAA,CAA3B,CACIC,EAAMzD,CAAA0D,KAAA,CAAatD,CAAb,CAAkBA,CAAAuD,KAAlB,CACV,OAAO,CACL5B,MAAOA,QAAQ,CAAC6B,CAAD,CAAMlB,CAAN,CAAa,CAC1BkB,CAAA,CAAM5D,CAAAiB,UAAA,CAAkB2C,CAAlB,CACDJ,EAAAA,CAAL,EAA6BK,CAAA,CAAgBD,CAAhB,CAA7B,GACEJ,CADF,CACyBI,CADzB,CAGKJ,EAAL,EAAoD,CAAA,CAApD,GAA6BM,CAAA,CAAcF,CAAd,CAA7B,GACEH,CAAA,CAAI,GAAJ,CAcA,CAbAA,CAAA,CAAIG,CAAJ,CAaA,CAZA5D,CAAA+D,QAAA,CAAgBrB,CAAhB,CAAuB,QAAQ,CAACK,CAAD,CAAQiB,CAAR,CAAa,CAC1C,IAAIC,EAAKjE,CAAAiB,UAAA,CAAkB+C,CAAlB,CAAT,CACIE,EAAmB,KAAnBA,GAAWN,CAAXM,EAAqC,KAArCA,GAA4BD,CAA5BC,EAAyD,YAAzDA,GAAgDD,CAC3B,EAAA,CAAzB,GAAIE,CAAA,CAAWF,CAAX,CAAJ,EACsB,CAAA,CADtB,GACGG,CAAA,CAASH,CAAT,CADH,EAC8B,CAAAV,CAAA,CAAaR,CAAb,CAAoBmB,CAApB,CAD9B,GAEET,CAAA,CAAI,GAAJ,CAIA,CAHAA,CAAA,CAAIO,CAAJ,CAGA,CAFAP,CAAA,CAAI,IAAJ,CAEA,CADAA,CAAA,CAAIT,CAAA,CAAeD,CAAf,CAAJ,CACA,CAAAU,CAAA,CAAI,GAAJ,CANF,CAH0C,CAA5C,CAYA,CAAAA,CAAA,CAAI,GAAJ,CAfF,CAL0B,CADvB,CAwBLnB,IAAKA,QAAQ,CAACsB,CAAD,CAAM,CACjBA,CAAA,CAAM5D,CAAAiB,UAAA,CAAkB2C,CAAlB,CACDJ,EAAL,EAAoD,CAAA,CAApD,GAA6BM,CAAA,CAAcF,CAAd,CAA7B,EAAkF,CAAA,CAAlF,GAA4DS,CAAA,CAAaT,CAAb,CAA5D,GACEH,CAAA,CAAI,IAAJ,CAEA,CADAA,CAAA,CAAIG,CAAJ,CACA,CAAAH,CAAA,CAAI,GAAJ,CAHF,CAKIG,EAAJ;AAAWJ,CAAX,GACEA,CADF,CACyB,CAAA,CADzB,CAPiB,CAxBd,CAmCLrD,MAAOA,QAAQ,CAACA,CAAD,CAAQ,CAChBqD,CAAL,EACEC,CAAA,CAAIT,CAAA,CAAe7C,CAAf,CAAJ,CAFmB,CAnClB,CAHsC,CAsD/CwB,QAASA,EAAkB,CAACC,CAAD,CAAO,CAChC,GAAIA,CAAAE,SAAJ,GAAsBwC,IAAAC,aAAtB,CAEE,IADA,IAAI7B,EAAQd,CAAAO,WAAZ,CACSpB,EAAI,CADb,CACgByD,EAAI9B,CAAA1B,OAApB,CAAkCD,CAAlC,CAAsCyD,CAAtC,CAAyCzD,CAAA,EAAzC,CAA8C,CAC5C,IAAI0D,EAAW/B,CAAA,CAAM3B,CAAN,CAAf,CACI2D,EAAWD,CAAA3B,KAAAb,YAAA,EACf,IAAiB,WAAjB,GAAIyC,CAAJ,EAA6D,CAA7D,GAAgCA,CAAAC,QAAA,CAAiB,MAAjB,CAAhC,CACE/C,CAAAgD,oBAAA,CAAyBH,CAAzB,CAEA,CADA1D,CAAA,EACA,CAAAyD,CAAA,EAN0C,CAYhD,CADInC,CACJ,CADeT,CAAAC,WACf,GACEF,CAAA,CAAmBU,CAAnB,CAIF,EADAA,CACA,CADWT,CAAAW,YACX,GACEZ,CAAA,CAAmBU,CAAnB,CArB8B,CAxdlC,IAAIb,EAAkBxB,CAAA6E,SAAA,CAAiB,WAAjB,CAAtB,CAkMI3B,EAAwB,iCAlM5B,CAoMEI,EAA0B,eApM5B,CA6MIe,EAAe5D,CAAA,CAAM,wBAAN,CA7MnB,CAiNIqE,EAA8BrE,CAAA,CAAM,gDAAN,CAjNlC,CAkNIsE,EAA+BtE,CAAA,CAAM,OAAN,CAlNnC,CAmNIuE,EAAyBhF,CAAAiF,OAAA,CAAe,EAAf,CACeF,CADf,CAEeD,CAFf,CAnN7B,CAwNII,EAAgBlF,CAAAiF,OAAA,CAAe,EAAf;AAAmBH,CAAnB,CAAgDrE,CAAA,CAAM,qKAAN,CAAhD,CAxNpB,CA6NI0E,EAAiBnF,CAAAiF,OAAA,CAAe,EAAf,CAAmBF,CAAnB,CAAiDtE,CAAA,CAAM,2JAAN,CAAjD,CA7NrB,CAqOI2E,EAAc3E,CAAA,CAAM,wNAAN,CArOlB;AA0OIoD,EAAkBpD,CAAA,CAAM,cAAN,CA1OtB,CA4OIqD,EAAgB9D,CAAAiF,OAAA,CAAe,EAAf,CACeZ,CADf,CAEea,CAFf,CAGeC,CAHf,CAIeH,CAJf,CA5OpB,CAmPIZ,EAAW3D,CAAA,CAAM,8CAAN,CAnPf,CAqPI4E,EAAY5E,CAAA,CAAM,kTAAN,CArPhB,CA6PI6E,EAAW7E,CAAA,CAAM,guCAAN;AAcoE,CAAA,CAdpE,CA7Pf,CA6QI0D,EAAanE,CAAAiF,OAAA,CAAe,EAAf,CACeb,CADf,CAEekB,CAFf,CAGeD,CAHf,CA7QjB,CA0RIhE,CACH,UAAQ,CAACtB,CAAD,CAAS,CAEhB,GAAIA,CAAA0B,SAAJ,EAAuB1B,CAAA0B,SAAA8D,eAAvB,CACEC,CAAA,CAAMzF,CAAA0B,SAAA8D,eAAAE,mBAAA,CAAkD,OAAlD,CADR,KAGE,MAAMjE,EAAA,CAAgB,SAAhB,CAAN,CAGF,IAAIkE,EAAeC,CADFH,CAAAI,gBACED,EADqBH,CAAAK,mBAAA,EACrBF,sBAAA,CAAgC,MAAhC,CAGS,EAA5B,GAAID,CAAA1E,OAAJ,CACEK,CADF,CACqBqE,CAAA,CAAa,CAAb,CADrB,EAGMvE,CAGJ,CAHWqE,CAAAM,cAAA,CAAkB,MAAlB,CAGX,CAFAzE,CAEA,CAFmBmE,CAAAM,cAAA,CAAkB,MAAlB,CAEnB,CADA3E,CAAA4E,YAAA,CAAiB1E,CAAjB,CACA,CAAAmE,CAAAO,YAAA,CAAgB5E,CAAhB,CANF,CAXgB,CAAjB,CAAD,CAmBGpB,CAnBH,CAyNAC,EAAAgG,OAAA,CAAe,YAAf,CAA6B,EAA7B,CAAAC,SAAA,CAA0C,WAA1C,CApXAC,QAA0B,EAAG,CAC3B,IAAIC,EAAa,CAAA,CAEjB,KAAAC,KAAA,CAAY,CAAC,eAAD,CAAkB,QAAQ,CAACC,CAAD,CAAgB,CAChDF,CAAJ,EACEnG,CAAAiF,OAAA,CAAenB,CAAf,CAA8BsB,CAA9B,CAEF,OAAO,SAAQ,CAACjE,CAAD,CAAO,CACpB,IAAIf;AAAM,EACVc,EAAA,CAAWC,CAAX,CAAiBd,CAAA,CAAmBD,CAAnB,CAAwB,QAAQ,CAACkG,CAAD,CAAMpC,CAAN,CAAe,CAC9D,MAAO,CAAC,UAAAqC,KAAA,CAAgBF,CAAA,CAAcC,CAAd,CAAmBpC,CAAnB,CAAhB,CADsD,CAA/C,CAAjB,CAGA,OAAO9D,EAAAI,KAAA,CAAS,EAAT,CALa,CAJ8B,CAA1C,CA4CZ,KAAAgG,UAAA,CAAiBC,QAAQ,CAACD,CAAD,CAAY,CACnC,MAAIxG,EAAA0G,UAAA,CAAkBF,CAAlB,CAAJ,EACEL,CACO,CADMK,CACN,CAAA,IAFT,EAISL,CAL0B,CA/CV,CAoX7B,CAmIAnG,EAAAgG,OAAA,CAAe,YAAf,CAAAW,OAAA,CAAoC,OAApC,CAA6C,CAAC,WAAD,CAAc,QAAQ,CAACC,CAAD,CAAY,CAAA,IACzEC,EACE,yFAFuE,CAGzEC,EAAgB,WAHyD,CAKzEC,EAAc/G,CAAA6E,SAAA,CAAiB,OAAjB,CAL2D,CAMzEmC,EAAWhH,CAAAgH,SAEf,OAAO,SAAQ,CAACC,CAAD,CAAOC,CAAP,CAAe/E,CAAf,CAA2B,CAwBxCgF,QAASA,EAAO,CAACF,CAAD,CAAO,CAChBA,CAAL,EAGA9F,CAAAwC,KAAA,CAAUzD,CAAA,CAAa+G,CAAb,CAAV,CAJqB,CAOvBG,QAASA,EAAO,CAACC,CAAD,CAAMJ,CAAN,CAAY,CAC1B,IAAIjD,CACJ7C,EAAAwC,KAAA,CAAU,KAAV,CACI3D,EAAAsH,WAAA,CAAmBnF,CAAnB,CAAJ,GACEA,CADF,CACeA,CAAA,CAAWkF,CAAX,CADf,CAGA,IAAIrH,CAAAuH,SAAA,CAAiBpF,CAAjB,CAAJ,CACE,IAAK6B,CAAL,GAAY7B,EAAZ,CACEhB,CAAAwC,KAAA,CAAUK,CAAV;AAAgB,IAAhB,CAAuB7B,CAAA,CAAW6B,CAAX,CAAvB,CAAyC,IAAzC,CAFJ,KAKE7B,EAAA,CAAa,EAEX,EAAAnC,CAAA0G,UAAA,CAAkBQ,CAAlB,CAAJ,EAAmC,QAAnC,EAA+C/E,EAA/C,EACEhB,CAAAwC,KAAA,CAAU,UAAV,CACUuD,CADV,CAEU,IAFV,CAIF/F,EAAAwC,KAAA,CAAU,QAAV,CACU0D,CAAApE,QAAA,CAAY,IAAZ,CAAkB,QAAlB,CADV,CAEU,IAFV,CAGAkE,EAAA,CAAQF,CAAR,CACA9F,EAAAwC,KAAA,CAAU,MAAV,CAtB0B,CA9B5B,GAAY,IAAZ,EAAIsD,CAAJ,EAA6B,EAA7B,GAAoBA,CAApB,CAAiC,MAAOA,EACxC,IAAK,CAAAD,CAAA,CAASC,CAAT,CAAL,CAAqB,KAAMF,EAAA,CAAY,WAAZ,CAA8DE,CAA9D,CAAN,CAOrB,IAJA,IAAIO,EAAMP,CAAV,CACI9F,EAAO,EADX,CAEIkG,CAFJ,CAGItG,CACJ,CAAQ0G,CAAR,CAAgBD,CAAAC,MAAA,CAAUZ,CAAV,CAAhB,CAAA,CAEEQ,CAQA,CARMI,CAAA,CAAM,CAAN,CAQN,CANKA,CAAA,CAAM,CAAN,CAML,EANkBA,CAAA,CAAM,CAAN,CAMlB,GALEJ,CAKF,EALSI,CAAA,CAAM,CAAN,CAAA,CAAW,SAAX,CAAuB,SAKhC,EAL6CJ,CAK7C,EAHAtG,CAGA,CAHI0G,CAAAC,MAGJ,CAFAP,CAAA,CAAQK,CAAAG,OAAA,CAAW,CAAX,CAAc5G,CAAd,CAAR,CAEA,CADAqG,CAAA,CAAQC,CAAR,CAAaI,CAAA,CAAM,CAAN,CAAAxE,QAAA,CAAiB6D,CAAjB,CAAgC,EAAhC,CAAb,CACA,CAAAU,CAAA,CAAMA,CAAAI,UAAA,CAAc7G,CAAd,CAAkB0G,CAAA,CAAM,CAAN,CAAAzG,OAAlB,CAERmG,EAAA,CAAQK,CAAR,CACA,OAAOZ,EAAA,CAAUzF,CAAAX,KAAA,CAAU,EAAV,CAAV,CAtBiC,CARmC,CAAlC,CAA7C,CApoBsC,CAArC,CAAD,CAusBGT,MAvsBH,CAusBWA,MAAAC,QAvsBX;",
+"sources":["angular-sanitize.js"],
+"names":["window","angular","undefined","sanitizeText","chars","buf","htmlSanitizeWriter","writer","noop","join","toMap","str","lowercaseKeys","obj","items","split","i","length","lowercase","htmlParser","html","handler","inertBodyElement","innerHTML","mXSSAttempts","$sanitizeMinErr","document","documentMode","stripCustomNsAttrs","node","firstChild","nodeType","start","nodeName","toLowerCase","attrToMap","attributes","textContent","nextNode","end","nextSibling","parentNode","removeChild","attrs","map","ii","attr","name","value","encodeEntities","replace","SURROGATE_PAIR_REGEXP","hi","charCodeAt","low","NON_ALPHANUMERIC_REGEXP","uriValidator","ignoreCurrentElement","out","bind","push","tag","blockedElements","validElements","forEach","key","lkey","isImage","validAttrs","uriAttrs","voidElements","Node","ELEMENT_NODE","l","attrNode","attrName","indexOf","removeAttributeNode","$$minErr","optionalEndTagBlockElements","optionalEndTagInlineElements","optionalEndTagElements","extend","blockElements","inlineElements","svgElements","htmlAttrs","svgAttrs","implementation","doc","createHTMLDocument","bodyElements","getElementsByTagName","documentElement","getDocumentElement","createElement","appendChild","module","provider","$SanitizeProvider","svgEnabled","$get","$$sanitizeUri","uri","test","enableSvg","this.enableSvg","isDefined","filter","$sanitize","LINKY_URL_REGEXP","MAILTO_REGEXP","linkyMinErr","isString","text","target","addText","addLink","url","isFunction","isObject","raw","match","index","substr","substring"]
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-scenario.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-scenario.js
new file mode 100644
index 00000000..20af805f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-scenario.js
@@ -0,0 +1,41849 @@
+/*!
+ * jQuery JavaScript Library v2.1.1
+ * http://jquery.com/
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ *
+ * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2014-05-01T17:11Z
+ */
+
+(function( global, factory ) {'use strict';
+
+ if ( typeof module === "object" && typeof module.exports === "object" ) {
+ // For CommonJS and CommonJS-like environments where a proper window is present,
+ // execute the factory and get jQuery
+ // For environments that do not inherently posses a window with a document
+ // (such as Node.js), expose a jQuery-making factory as module.exports
+ // This accentuates the need for the creation of a real window
+ // e.g. var jQuery = require("jquery")(window);
+ // See ticket #14549 for more info
+ module.exports = global.document ?
+ factory( global, true ) :
+ function( w ) {
+ if ( !w.document ) {
+ throw new Error( "jQuery requires a window with a document" );
+ }
+ return factory( w );
+ };
+ } else {
+ factory( global );
+ }
+
+// Pass this if window is not defined yet
+}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
+
+// Can't do this because several apps including ASP.NET trace
+// the stack via arguments.caller.callee and Firefox dies if
+// you try to trace through "use strict" call chains. (#13335)
+// Support: Firefox 18+
+//
+
+var arr = [];
+
+var slice = arr.slice;
+
+var concat = arr.concat;
+
+var push = arr.push;
+
+var indexOf = arr.indexOf;
+
+var class2type = {};
+
+var toString = class2type.toString;
+
+var hasOwn = class2type.hasOwnProperty;
+
+var support = {};
+
+
+
+var
+ // Use the correct document accordingly with window argument (sandbox)
+ document = window.document,
+
+ version = "2.1.1",
+
+ // Define a local copy of jQuery
+ jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ // Need init if jQuery is called (just allow error to be thrown if not included)
+ return new jQuery.fn.init( selector, context );
+ },
+
+ // Support: Android<4.1
+ // Make sure we trim BOM and NBSP
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
+
+ // Matches dashed string for camelizing
+ rmsPrefix = /^-ms-/,
+ rdashAlpha = /-([\da-z])/gi,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return letter.toUpperCase();
+ };
+
+jQuery.fn = jQuery.prototype = {
+ // The current version of jQuery being used
+ jquery: version,
+
+ constructor: jQuery,
+
+ // Start with an empty selector
+ selector: "",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ toArray: function() {
+ return slice.call( this );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num != null ?
+
+ // Return just the one element from the set
+ ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
+
+ // Return all the elements in a clean array
+ slice.call( this );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems ) {
+
+ // Build a new jQuery matched element set
+ var ret = jQuery.merge( this.constructor(), elems );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+ ret.context = this.context;
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ slice: function() {
+ return this.pushStack( slice.apply( this, arguments ) );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ eq: function( i ) {
+ var len = this.length,
+ j = +i + ( i < 0 ? len : 0 );
+ return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
+ },
+
+ end: function() {
+ return this.prevObject || this.constructor(null);
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: push,
+ sort: arr.sort,
+ splice: arr.splice
+};
+
+jQuery.extend = jQuery.fn.extend = function() {
+ var options, name, src, copy, copyIsArray, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+
+ // skip the boolean and the target
+ target = arguments[ i ] || {};
+ i++;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
+
+ // extend jQuery itself if only one argument is passed
+ if ( i === length ) {
+ target = this;
+ i--;
+ }
+
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && jQuery.isArray(src) ? src : [];
+
+ } else {
+ clone = src && jQuery.isPlainObject(src) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend({
+ // Unique for each copy of jQuery on the page
+ expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
+
+ // Assume jQuery is ready without the ready module
+ isReady: true,
+
+ error: function( msg ) {
+ throw new Error( msg );
+ },
+
+ noop: function() {},
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return jQuery.type(obj) === "function";
+ },
+
+ isArray: Array.isArray,
+
+ isWindow: function( obj ) {
+ return obj != null && obj === obj.window;
+ },
+
+ isNumeric: function( obj ) {
+ // parseFloat NaNs numeric-cast false positives (null|true|false|"")
+ // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
+ // subtraction forces infinities to NaN
+ return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0;
+ },
+
+ isPlainObject: function( obj ) {
+ // Not plain objects:
+ // - Any object or value whose internal [[Class]] property is not "[object Object]"
+ // - DOM nodes
+ // - window
+ if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ if ( obj.constructor &&
+ !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
+ return false;
+ }
+
+ // If the function hasn't returned already, we're confident that
+ // |obj| is a plain object, created by {} or constructed with new Object
+ return true;
+ },
+
+ isEmptyObject: function( obj ) {
+ var name;
+ for ( name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ type: function( obj ) {
+ if ( obj == null ) {
+ return obj + "";
+ }
+ // Support: Android < 4.0, iOS < 6 (functionish RegExp)
+ return typeof obj === "object" || typeof obj === "function" ?
+ class2type[ toString.call(obj) ] || "object" :
+ typeof obj;
+ },
+
+ // Evaluates a script in a global context
+ globalEval: function( code ) {
+ var script,
+ indirect = eval;
+
+ code = jQuery.trim( code );
+
+ if ( code ) {
+ // If the code includes a valid, prologue position
+ // strict mode pragma, execute code by injecting a
+ // script tag into the document.
+ if ( code.indexOf("use strict") === 1 ) {
+ script = document.createElement("script");
+ script.text = code;
+ document.head.appendChild( script ).parentNode.removeChild( script );
+ } else {
+ // Otherwise, avoid the DOM node creation, insertion
+ // and removal by using an indirect global eval
+ indirect( code );
+ }
+ }
+ },
+
+ // Convert dashed to camelCase; used by the css and data modules
+ // Microsoft forgot to hump their vendor prefix (#9572)
+ camelCase: function( string ) {
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
+ },
+
+ // args is for internal usage only
+ each: function( obj, callback, args ) {
+ var value,
+ i = 0,
+ length = obj.length,
+ isArray = isArraylike( obj );
+
+ if ( args ) {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+ }
+
+ return obj;
+ },
+
+ // Support: Android<4.1
+ trim: function( text ) {
+ return text == null ?
+ "" :
+ ( text + "" ).replace( rtrim, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( arr, results ) {
+ var ret = results || [];
+
+ if ( arr != null ) {
+ if ( isArraylike( Object(arr) ) ) {
+ jQuery.merge( ret,
+ typeof arr === "string" ?
+ [ arr ] : arr
+ );
+ } else {
+ push.call( ret, arr );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, arr, i ) {
+ return arr == null ? -1 : indexOf.call( arr, elem, i );
+ },
+
+ merge: function( first, second ) {
+ var len = +second.length,
+ j = 0,
+ i = first.length;
+
+ for ( ; j < len; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+
+ first.length = i;
+
+ return first;
+ },
+
+ grep: function( elems, callback, invert ) {
+ var callbackInverse,
+ matches = [],
+ i = 0,
+ length = elems.length,
+ callbackExpect = !invert;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( ; i < length; i++ ) {
+ callbackInverse = !callback( elems[ i ], i );
+ if ( callbackInverse !== callbackExpect ) {
+ matches.push( elems[ i ] );
+ }
+ }
+
+ return matches;
+ },
+
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var value,
+ i = 0,
+ length = elems.length,
+ isArray = isArraylike( elems ),
+ ret = [];
+
+ // Go through the array, translating each of the items to their new values
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret.push( value );
+ }
+ }
+
+ // Go through every key on the object,
+ } else {
+ for ( i in elems ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret.push( value );
+ }
+ }
+ }
+
+ // Flatten any nested arrays
+ return concat.apply( [], ret );
+ },
+
+ // A global GUID counter for objects
+ guid: 1,
+
+ // Bind a function to a context, optionally partially applying any
+ // arguments.
+ proxy: function( fn, context ) {
+ var tmp, args, proxy;
+
+ if ( typeof context === "string" ) {
+ tmp = fn[ context ];
+ context = fn;
+ fn = tmp;
+ }
+
+ // Quick check to determine if target is callable, in the spec
+ // this throws a TypeError, but we will just return undefined.
+ if ( !jQuery.isFunction( fn ) ) {
+ return undefined;
+ }
+
+ // Simulated bind
+ args = slice.call( arguments, 2 );
+ proxy = function() {
+ return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
+ };
+
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || jQuery.guid++;
+
+ return proxy;
+ },
+
+ now: Date.now,
+
+ // jQuery.support is not used in Core but other projects attach their
+ // properties to it so it needs to exist.
+ support: support
+});
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+function isArraylike( obj ) {
+ var length = obj.length,
+ type = jQuery.type( obj );
+
+ if ( type === "function" || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ if ( obj.nodeType === 1 && length ) {
+ return true;
+ }
+
+ return type === "array" || length === 0 ||
+ typeof length === "number" && length > 0 && ( length - 1 ) in obj;
+}
+var Sizzle =
+/*!
+ * Sizzle CSS Selector Engine v1.10.19
+ * http://sizzlejs.com/
+ *
+ * Copyright 2013 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2014-04-18
+ */
+(function( window ) {
+
+var i,
+ support,
+ Expr,
+ getText,
+ isXML,
+ tokenize,
+ compile,
+ select,
+ outermostContext,
+ sortInput,
+ hasDuplicate,
+
+ // Local document vars
+ setDocument,
+ document,
+ docElem,
+ documentIsHTML,
+ rbuggyQSA,
+ rbuggyMatches,
+ matches,
+ contains,
+
+ // Instance-specific data
+ expando = "sizzle" + -(new Date()),
+ preferredDoc = window.document,
+ dirruns = 0,
+ done = 0,
+ classCache = createCache(),
+ tokenCache = createCache(),
+ compilerCache = createCache(),
+ sortOrder = function( a, b ) {
+ if ( a === b ) {
+ hasDuplicate = true;
+ }
+ return 0;
+ },
+
+ // General-purpose constants
+ strundefined = typeof undefined,
+ MAX_NEGATIVE = 1 << 31,
+
+ // Instance methods
+ hasOwn = ({}).hasOwnProperty,
+ arr = [],
+ pop = arr.pop,
+ push_native = arr.push,
+ push = arr.push,
+ slice = arr.slice,
+ // Use a stripped-down indexOf if we can't use a native one
+ indexOf = arr.indexOf || function( elem ) {
+ var i = 0,
+ len = this.length;
+ for ( ; i < len; i++ ) {
+ if ( this[i] === elem ) {
+ return i;
+ }
+ }
+ return -1;
+ },
+
+ booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
+
+ // Regular expressions
+
+ // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
+ whitespace = "[\\x20\\t\\r\\n\\f]",
+ // http://www.w3.org/TR/css3-syntax/#characters
+ characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
+
+ // Loosely modeled on CSS identifier characters
+ // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
+ // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
+ identifier = characterEncoding.replace( "w", "w#" ),
+
+ // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
+ attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
+ // Operator (capture 2)
+ "*([*^$|!~]?=)" + whitespace +
+ // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
+ "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
+ "*\\]",
+
+ pseudos = ":(" + characterEncoding + ")(?:\\((" +
+ // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
+ // 1. quoted (capture 3; capture 4 or capture 5)
+ "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
+ // 2. simple (capture 6)
+ "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
+ // 3. anything else (capture 2)
+ ".*" +
+ ")\\)|)",
+
+ // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
+
+ rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
+ rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
+
+ rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
+
+ rpseudo = new RegExp( pseudos ),
+ ridentifier = new RegExp( "^" + identifier + "$" ),
+
+ matchExpr = {
+ "ID": new RegExp( "^#(" + characterEncoding + ")" ),
+ "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
+ "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
+ "ATTR": new RegExp( "^" + attributes ),
+ "PSEUDO": new RegExp( "^" + pseudos ),
+ "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
+ "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
+ "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
+ "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
+ // For use in libraries implementing .is()
+ // We use this for POS matching in `select`
+ "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
+ whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
+ },
+
+ rinputs = /^(?:input|select|textarea|button)$/i,
+ rheader = /^h\d$/i,
+
+ rnative = /^[^{]+\{\s*\[native \w/,
+
+ // Easily-parseable/retrievable ID or TAG or CLASS selectors
+ rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
+
+ rsibling = /[+~]/,
+ rescape = /'|\\/g,
+
+ // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
+ runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
+ funescape = function( _, escaped, escapedWhitespace ) {
+ var high = "0x" + escaped - 0x10000;
+ // NaN means non-codepoint
+ // Support: Firefox<24
+ // Workaround erroneous numeric interpretation of +"0x"
+ return high !== high || escapedWhitespace ?
+ escaped :
+ high < 0 ?
+ // BMP codepoint
+ String.fromCharCode( high + 0x10000 ) :
+ // Supplemental Plane codepoint (surrogate pair)
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
+ };
+
+// Optimize for push.apply( _, NodeList )
+try {
+ push.apply(
+ (arr = slice.call( preferredDoc.childNodes )),
+ preferredDoc.childNodes
+ );
+ // Support: Android<4.0
+ // Detect silently failing push.apply
+ arr[ preferredDoc.childNodes.length ].nodeType;
+} catch ( e ) {
+ push = { apply: arr.length ?
+
+ // Leverage slice if possible
+ function( target, els ) {
+ push_native.apply( target, slice.call(els) );
+ } :
+
+ // Support: IE<9
+ // Otherwise append directly
+ function( target, els ) {
+ var j = target.length,
+ i = 0;
+ // Can't trust NodeList.length
+ while ( (target[j++] = els[i++]) ) {}
+ target.length = j - 1;
+ }
+ };
+}
+
+function Sizzle( selector, context, results, seed ) {
+ var match, elem, m, nodeType,
+ // QSA vars
+ i, groups, old, nid, newContext, newSelector;
+
+ if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
+ setDocument( context );
+ }
+
+ context = context || document;
+ results = results || [];
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
+ return [];
+ }
+
+ if ( documentIsHTML && !seed ) {
+
+ // Shortcuts
+ if ( (match = rquickExpr.exec( selector )) ) {
+ // Speed-up: Sizzle("#ID")
+ if ( (m = match[1]) ) {
+ if ( nodeType === 9 ) {
+ elem = context.getElementById( m );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document (jQuery #6963)
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE, Opera, and Webkit return items
+ // by name instead of ID
+ if ( elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ } else {
+ return results;
+ }
+ } else {
+ // Context is not a document
+ if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
+ contains( context, elem ) && elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ }
+
+ // Speed-up: Sizzle("TAG")
+ } else if ( match[2] ) {
+ push.apply( results, context.getElementsByTagName( selector ) );
+ return results;
+
+ // Speed-up: Sizzle(".CLASS")
+ } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
+ push.apply( results, context.getElementsByClassName( m ) );
+ return results;
+ }
+ }
+
+ // QSA path
+ if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
+ nid = old = expando;
+ newContext = context;
+ newSelector = nodeType === 9 && selector;
+
+ // qSA works strangely on Element-rooted queries
+ // We can work around this by specifying an extra ID on the root
+ // and working up from there (Thanks to Andrew Dupont for the technique)
+ // IE 8 doesn't work on object elements
+ if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+ groups = tokenize( selector );
+
+ if ( (old = context.getAttribute("id")) ) {
+ nid = old.replace( rescape, "\\$&" );
+ } else {
+ context.setAttribute( "id", nid );
+ }
+ nid = "[id='" + nid + "'] ";
+
+ i = groups.length;
+ while ( i-- ) {
+ groups[i] = nid + toSelector( groups[i] );
+ }
+ newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
+ newSelector = groups.join(",");
+ }
+
+ if ( newSelector ) {
+ try {
+ push.apply( results,
+ newContext.querySelectorAll( newSelector )
+ );
+ return results;
+ } catch(qsaError) {
+ } finally {
+ if ( !old ) {
+ context.removeAttribute("id");
+ }
+ }
+ }
+ }
+ }
+
+ // All others
+ return select( selector.replace( rtrim, "$1" ), context, results, seed );
+}
+
+/**
+ * Create key-value caches of limited size
+ * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
+ * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
+ * deleting the oldest entry
+ */
+function createCache() {
+ var keys = [];
+
+ function cache( key, value ) {
+ // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
+ if ( keys.push( key + " " ) > Expr.cacheLength ) {
+ // Only keep the most recent entries
+ delete cache[ keys.shift() ];
+ }
+ return (cache[ key + " " ] = value);
+ }
+ return cache;
+}
+
+/**
+ * Mark a function for special use by Sizzle
+ * @param {Function} fn The function to mark
+ */
+function markFunction( fn ) {
+ fn[ expando ] = true;
+ return fn;
+}
+
+/**
+ * Support testing using an element
+ * @param {Function} fn Passed the created div and expects a boolean result
+ */
+function assert( fn ) {
+ var div = document.createElement("div");
+
+ try {
+ return !!fn( div );
+ } catch (e) {
+ return false;
+ } finally {
+ // Remove from its parent by default
+ if ( div.parentNode ) {
+ div.parentNode.removeChild( div );
+ }
+ // release memory in IE
+ div = null;
+ }
+}
+
+/**
+ * Adds the same handler for all of the specified attrs
+ * @param {String} attrs Pipe-separated list of attributes
+ * @param {Function} handler The method that will be applied
+ */
+function addHandle( attrs, handler ) {
+ var arr = attrs.split("|"),
+ i = attrs.length;
+
+ while ( i-- ) {
+ Expr.attrHandle[ arr[i] ] = handler;
+ }
+}
+
+/**
+ * Checks document order of two siblings
+ * @param {Element} a
+ * @param {Element} b
+ * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
+ */
+function siblingCheck( a, b ) {
+ var cur = b && a,
+ diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
+ ( ~b.sourceIndex || MAX_NEGATIVE ) -
+ ( ~a.sourceIndex || MAX_NEGATIVE );
+
+ // Use IE sourceIndex if available on both nodes
+ if ( diff ) {
+ return diff;
+ }
+
+ // Check if b follows a
+ if ( cur ) {
+ while ( (cur = cur.nextSibling) ) {
+ if ( cur === b ) {
+ return -1;
+ }
+ }
+ }
+
+ return a ? 1 : -1;
+}
+
+/**
+ * Returns a function to use in pseudos for input types
+ * @param {String} type
+ */
+function createInputPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === type;
+ };
+}
+
+/**
+ * Returns a function to use in pseudos for buttons
+ * @param {String} type
+ */
+function createButtonPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && elem.type === type;
+ };
+}
+
+/**
+ * Returns a function to use in pseudos for positionals
+ * @param {Function} fn
+ */
+function createPositionalPseudo( fn ) {
+ return markFunction(function( argument ) {
+ argument = +argument;
+ return markFunction(function( seed, matches ) {
+ var j,
+ matchIndexes = fn( [], seed.length, argument ),
+ i = matchIndexes.length;
+
+ // Match elements found at the specified indexes
+ while ( i-- ) {
+ if ( seed[ (j = matchIndexes[i]) ] ) {
+ seed[j] = !(matches[j] = seed[j]);
+ }
+ }
+ });
+ });
+}
+
+/**
+ * Checks a node for validity as a Sizzle context
+ * @param {Element|Object=} context
+ * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
+ */
+function testContext( context ) {
+ return context && typeof context.getElementsByTagName !== strundefined && context;
+}
+
+// Expose support vars for convenience
+support = Sizzle.support = {};
+
+/**
+ * Detects XML nodes
+ * @param {Element|Object} elem An element or a document
+ * @returns {Boolean} True iff elem is a non-HTML XML node
+ */
+isXML = Sizzle.isXML = function( elem ) {
+ // documentElement is verified for cases where it doesn't yet exist
+ // (such as loading iframes in IE - #4833)
+ var documentElement = elem && (elem.ownerDocument || elem).documentElement;
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+/**
+ * Sets document-related variables once based on the current document
+ * @param {Element|Object} [doc] An element or document object to use to set the document
+ * @returns {Object} Returns the current document
+ */
+setDocument = Sizzle.setDocument = function( node ) {
+ var hasCompare,
+ doc = node ? node.ownerDocument || node : preferredDoc,
+ parent = doc.defaultView;
+
+ // If no document and documentElement is available, return
+ if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
+ return document;
+ }
+
+ // Set our document
+ document = doc;
+ docElem = doc.documentElement;
+
+ // Support tests
+ documentIsHTML = !isXML( doc );
+
+ // Support: IE>8
+ // If iframe document is assigned to "document" variable and if iframe has been reloaded,
+ // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
+ // IE6-8 do not support the defaultView property so parent will be undefined
+ if ( parent && parent !== parent.top ) {
+ // IE11 does not have attachEvent, so all must suffer
+ if ( parent.addEventListener ) {
+ parent.addEventListener( "unload", function() {
+ setDocument();
+ }, false );
+ } else if ( parent.attachEvent ) {
+ parent.attachEvent( "onunload", function() {
+ setDocument();
+ });
+ }
+ }
+
+ /* Attributes
+ ---------------------------------------------------------------------- */
+
+ // Support: IE<8
+ // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
+ support.attributes = assert(function( div ) {
+ div.className = "i";
+ return !div.getAttribute("className");
+ });
+
+ /* getElement(s)By*
+ ---------------------------------------------------------------------- */
+
+ // Check if getElementsByTagName("*") returns only elements
+ support.getElementsByTagName = assert(function( div ) {
+ div.appendChild( doc.createComment("") );
+ return !div.getElementsByTagName("*").length;
+ });
+
+ // Check if getElementsByClassName can be trusted
+ support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {
+ div.innerHTML = "<div class='a'></div><div class='a i'></div>";
+
+ // Support: Safari<4
+ // Catch class over-caching
+ div.firstChild.className = "i";
+ // Support: Opera<10
+ // Catch gEBCN failure to find non-leading classes
+ return div.getElementsByClassName("i").length === 2;
+ });
+
+ // Support: IE<10
+ // Check if getElementById returns elements by name
+ // The broken getElementById methods don't pick up programatically-set names,
+ // so use a roundabout getElementsByName test
+ support.getById = assert(function( div ) {
+ docElem.appendChild( div ).id = expando;
+ return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
+ });
+
+ // ID find and filter
+ if ( support.getById ) {
+ Expr.find["ID"] = function( id, context ) {
+ if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
+ var m = context.getElementById( id );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [ m ] : [];
+ }
+ };
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ return elem.getAttribute("id") === attrId;
+ };
+ };
+ } else {
+ // Support: IE6/7
+ // getElementById is not reliable as a find shortcut
+ delete Expr.find["ID"];
+
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
+ return node && node.value === attrId;
+ };
+ };
+ }
+
+ // Tag
+ Expr.find["TAG"] = support.getElementsByTagName ?
+ function( tag, context ) {
+ if ( typeof context.getElementsByTagName !== strundefined ) {
+ return context.getElementsByTagName( tag );
+ }
+ } :
+ function( tag, context ) {
+ var elem,
+ tmp = [],
+ i = 0,
+ results = context.getElementsByTagName( tag );
+
+ // Filter out possible comments
+ if ( tag === "*" ) {
+ while ( (elem = results[i++]) ) {
+ if ( elem.nodeType === 1 ) {
+ tmp.push( elem );
+ }
+ }
+
+ return tmp;
+ }
+ return results;
+ };
+
+ // Class
+ Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
+ if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
+ return context.getElementsByClassName( className );
+ }
+ };
+
+ /* QSA/matchesSelector
+ ---------------------------------------------------------------------- */
+
+ // QSA and matchesSelector support
+
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
+ rbuggyMatches = [];
+
+ // qSa(:focus) reports false when true (Chrome 21)
+ // We allow this because of a bug in IE8/9 that throws an error
+ // whenever `document.activeElement` is accessed on an iframe
+ // So, we allow :focus to pass through QSA all the time to avoid the IE error
+ // See http://bugs.jquery.com/ticket/13378
+ rbuggyQSA = [];
+
+ if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
+ // Build QSA regex
+ // Regex strategy adopted from Diego Perini
+ assert(function( div ) {
+ // Select is set to empty string on purpose
+ // This is to test IE's treatment of not explicitly
+ // setting a boolean content attribute,
+ // since its presence should be enough
+ // http://bugs.jquery.com/ticket/12359
+ div.innerHTML = "<select msallowclip=''><option selected=''></option></select>";
+
+ // Support: IE8, Opera 11-12.16
+ // Nothing should be selected when empty strings follow ^= or $= or *=
+ // The test attribute must be unknown in Opera but "safe" for WinRT
+ // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
+ if ( div.querySelectorAll("[msallowclip^='']").length ) {
+ rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
+ }
+
+ // Support: IE8
+ // Boolean attributes and "value" are not treated correctly
+ if ( !div.querySelectorAll("[selected]").length ) {
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
+ }
+
+ // Webkit/Opera - :checked should return selected option elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":checked").length ) {
+ rbuggyQSA.push(":checked");
+ }
+ });
+
+ assert(function( div ) {
+ // Support: Windows 8 Native Apps
+ // The type and name attributes are restricted during .innerHTML assignment
+ var input = doc.createElement("input");
+ input.setAttribute( "type", "hidden" );
+ div.appendChild( input ).setAttribute( "name", "D" );
+
+ // Support: IE8
+ // Enforce case-sensitivity of name attribute
+ if ( div.querySelectorAll("[name=d]").length ) {
+ rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
+ }
+
+ // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":enabled").length ) {
+ rbuggyQSA.push( ":enabled", ":disabled" );
+ }
+
+ // Opera 10-11 does not throw on post-comma invalid pseudos
+ div.querySelectorAll("*,:x");
+ rbuggyQSA.push(",.*:");
+ });
+ }
+
+ if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
+ docElem.webkitMatchesSelector ||
+ docElem.mozMatchesSelector ||
+ docElem.oMatchesSelector ||
+ docElem.msMatchesSelector) )) ) {
+
+ assert(function( div ) {
+ // Check to see if it's possible to do matchesSelector
+ // on a disconnected node (IE 9)
+ support.disconnectedMatch = matches.call( div, "div" );
+
+ // This should fail with an exception
+ // Gecko does not error, returns false instead
+ matches.call( div, "[s!='']:x" );
+ rbuggyMatches.push( "!=", pseudos );
+ });
+ }
+
+ rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
+ rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
+
+ /* Contains
+ ---------------------------------------------------------------------- */
+ hasCompare = rnative.test( docElem.compareDocumentPosition );
+
+ // Element contains another
+ // Purposefully does not implement inclusive descendent
+ // As in, an element does not contain itself
+ contains = hasCompare || rnative.test( docElem.contains ) ?
+ function( a, b ) {
+ var adown = a.nodeType === 9 ? a.documentElement : a,
+ bup = b && b.parentNode;
+ return a === bup || !!( bup && bup.nodeType === 1 && (
+ adown.contains ?
+ adown.contains( bup ) :
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
+ ));
+ } :
+ function( a, b ) {
+ if ( b ) {
+ while ( (b = b.parentNode) ) {
+ if ( b === a ) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ /* Sorting
+ ---------------------------------------------------------------------- */
+
+ // Document order sorting
+ sortOrder = hasCompare ?
+ function( a, b ) {
+
+ // Flag for duplicate removal
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ // Sort on method existence if only one input has compareDocumentPosition
+ var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
+ if ( compare ) {
+ return compare;
+ }
+
+ // Calculate position if both inputs belong to the same document
+ compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
+ a.compareDocumentPosition( b ) :
+
+ // Otherwise we know they are disconnected
+ 1;
+
+ // Disconnected nodes
+ if ( compare & 1 ||
+ (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
+
+ // Choose the first element that is related to our preferred document
+ if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
+ return -1;
+ }
+ if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
+ return 1;
+ }
+
+ // Maintain original order
+ return sortInput ?
+ ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
+ 0;
+ }
+
+ return compare & 4 ? -1 : 1;
+ } :
+ function( a, b ) {
+ // Exit early if the nodes are identical
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ var cur,
+ i = 0,
+ aup = a.parentNode,
+ bup = b.parentNode,
+ ap = [ a ],
+ bp = [ b ];
+
+ // Parentless nodes are either documents or disconnected
+ if ( !aup || !bup ) {
+ return a === doc ? -1 :
+ b === doc ? 1 :
+ aup ? -1 :
+ bup ? 1 :
+ sortInput ?
+ ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
+ 0;
+
+ // If the nodes are siblings, we can do a quick check
+ } else if ( aup === bup ) {
+ return siblingCheck( a, b );
+ }
+
+ // Otherwise we need full lists of their ancestors for comparison
+ cur = a;
+ while ( (cur = cur.parentNode) ) {
+ ap.unshift( cur );
+ }
+ cur = b;
+ while ( (cur = cur.parentNode) ) {
+ bp.unshift( cur );
+ }
+
+ // Walk down the tree looking for a discrepancy
+ while ( ap[i] === bp[i] ) {
+ i++;
+ }
+
+ return i ?
+ // Do a sibling check if the nodes have a common ancestor
+ siblingCheck( ap[i], bp[i] ) :
+
+ // Otherwise nodes in our document sort first
+ ap[i] === preferredDoc ? -1 :
+ bp[i] === preferredDoc ? 1 :
+ 0;
+ };
+
+ return doc;
+};
+
+Sizzle.matches = function( expr, elements ) {
+ return Sizzle( expr, null, null, elements );
+};
+
+Sizzle.matchesSelector = function( elem, expr ) {
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ // Make sure that attribute selectors are quoted
+ expr = expr.replace( rattributeQuotes, "='$1']" );
+
+ if ( support.matchesSelector && documentIsHTML &&
+ ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
+ ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
+
+ try {
+ var ret = matches.call( elem, expr );
+
+ // IE 9's matchesSelector returns false on disconnected nodes
+ if ( ret || support.disconnectedMatch ||
+ // As well, disconnected nodes are said to be in a document
+ // fragment in IE 9
+ elem.document && elem.document.nodeType !== 11 ) {
+ return ret;
+ }
+ } catch(e) {}
+ }
+
+ return Sizzle( expr, document, null, [ elem ] ).length > 0;
+};
+
+Sizzle.contains = function( context, elem ) {
+ // Set document vars if needed
+ if ( ( context.ownerDocument || context ) !== document ) {
+ setDocument( context );
+ }
+ return contains( context, elem );
+};
+
+Sizzle.attr = function( elem, name ) {
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ var fn = Expr.attrHandle[ name.toLowerCase() ],
+ // Don't get fooled by Object.prototype properties (jQuery #13807)
+ val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
+ fn( elem, name, !documentIsHTML ) :
+ undefined;
+
+ return val !== undefined ?
+ val :
+ support.attributes || !documentIsHTML ?
+ elem.getAttribute( name ) :
+ (val = elem.getAttributeNode(name)) && val.specified ?
+ val.value :
+ null;
+};
+
+Sizzle.error = function( msg ) {
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+/**
+ * Document sorting and removing duplicates
+ * @param {ArrayLike} results
+ */
+Sizzle.uniqueSort = function( results ) {
+ var elem,
+ duplicates = [],
+ j = 0,
+ i = 0;
+
+ // Unless we *know* we can detect duplicates, assume their presence
+ hasDuplicate = !support.detectDuplicates;
+ sortInput = !support.sortStable && results.slice( 0 );
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ while ( (elem = results[i++]) ) {
+ if ( elem === results[ i ] ) {
+ j = duplicates.push( i );
+ }
+ }
+ while ( j-- ) {
+ results.splice( duplicates[ j ], 1 );
+ }
+ }
+
+ // Clear input after sorting to release objects
+ // See https://github.com/jquery/sizzle/pull/225
+ sortInput = null;
+
+ return results;
+};
+
+/**
+ * Utility function for retrieving the text value of an array of DOM nodes
+ * @param {Array|Element} elem
+ */
+getText = Sizzle.getText = function( elem ) {
+ var node,
+ ret = "",
+ i = 0,
+ nodeType = elem.nodeType;
+
+ if ( !nodeType ) {
+ // If no nodeType, this is expected to be an array
+ while ( (node = elem[i++]) ) {
+ // Do not traverse comment nodes
+ ret += getText( node );
+ }
+ } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+ // Use textContent for elements
+ // innerText usage removed for consistency of new lines (jQuery #11153)
+ if ( typeof elem.textContent === "string" ) {
+ return elem.textContent;
+ } else {
+ // Traverse its children
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ ret += getText( elem );
+ }
+ }
+ } else if ( nodeType === 3 || nodeType === 4 ) {
+ return elem.nodeValue;
+ }
+ // Do not include comment or processing instruction nodes
+
+ return ret;
+};
+
+Expr = Sizzle.selectors = {
+
+ // Can be adjusted by the user
+ cacheLength: 50,
+
+ createPseudo: markFunction,
+
+ match: matchExpr,
+
+ attrHandle: {},
+
+ find: {},
+
+ relative: {
+ ">": { dir: "parentNode", first: true },
+ " ": { dir: "parentNode" },
+ "+": { dir: "previousSibling", first: true },
+ "~": { dir: "previousSibling" }
+ },
+
+ preFilter: {
+ "ATTR": function( match ) {
+ match[1] = match[1].replace( runescape, funescape );
+
+ // Move the given value to match[3] whether quoted or unquoted
+ match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
+
+ if ( match[2] === "~=" ) {
+ match[3] = " " + match[3] + " ";
+ }
+
+ return match.slice( 0, 4 );
+ },
+
+ "CHILD": function( match ) {
+ /* matches from matchExpr["CHILD"]
+ 1 type (only|nth|...)
+ 2 what (child|of-type)
+ 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
+ 4 xn-component of xn+y argument ([+-]?\d*n|)
+ 5 sign of xn-component
+ 6 x of xn-component
+ 7 sign of y-component
+ 8 y of y-component
+ */
+ match[1] = match[1].toLowerCase();
+
+ if ( match[1].slice( 0, 3 ) === "nth" ) {
+ // nth-* requires argument
+ if ( !match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ // numeric x and y parameters for Expr.filter.CHILD
+ // remember that false/true cast respectively to 0/1
+ match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
+ match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
+
+ // other types prohibit arguments
+ } else if ( match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ return match;
+ },
+
+ "PSEUDO": function( match ) {
+ var excess,
+ unquoted = !match[6] && match[2];
+
+ if ( matchExpr["CHILD"].test( match[0] ) ) {
+ return null;
+ }
+
+ // Accept quoted arguments as-is
+ if ( match[3] ) {
+ match[2] = match[4] || match[5] || "";
+
+ // Strip excess characters from unquoted arguments
+ } else if ( unquoted && rpseudo.test( unquoted ) &&
+ // Get excess from tokenize (recursively)
+ (excess = tokenize( unquoted, true )) &&
+ // advance to the next closing parenthesis
+ (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
+
+ // excess is a negative index
+ match[0] = match[0].slice( 0, excess );
+ match[2] = unquoted.slice( 0, excess );
+ }
+
+ // Return only captures needed by the pseudo filter method (type and argument)
+ return match.slice( 0, 3 );
+ }
+ },
+
+ filter: {
+
+ "TAG": function( nodeNameSelector ) {
+ var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
+ return nodeNameSelector === "*" ?
+ function() { return true; } :
+ function( elem ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
+ };
+ },
+
+ "CLASS": function( className ) {
+ var pattern = classCache[ className + " " ];
+
+ return pattern ||
+ (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
+ classCache( className, function( elem ) {
+ return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
+ });
+ },
+
+ "ATTR": function( name, operator, check ) {
+ return function( elem ) {
+ var result = Sizzle.attr( elem, name );
+
+ if ( result == null ) {
+ return operator === "!=";
+ }
+ if ( !operator ) {
+ return true;
+ }
+
+ result += "";
+
+ return operator === "=" ? result === check :
+ operator === "!=" ? result !== check :
+ operator === "^=" ? check && result.indexOf( check ) === 0 :
+ operator === "*=" ? check && result.indexOf( check ) > -1 :
+ operator === "$=" ? check && result.slice( -check.length ) === check :
+ operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
+ operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
+ false;
+ };
+ },
+
+ "CHILD": function( type, what, argument, first, last ) {
+ var simple = type.slice( 0, 3 ) !== "nth",
+ forward = type.slice( -4 ) !== "last",
+ ofType = what === "of-type";
+
+ return first === 1 && last === 0 ?
+
+ // Shortcut for :nth-*(n)
+ function( elem ) {
+ return !!elem.parentNode;
+ } :
+
+ function( elem, context, xml ) {
+ var cache, outerCache, node, diff, nodeIndex, start,
+ dir = simple !== forward ? "nextSibling" : "previousSibling",
+ parent = elem.parentNode,
+ name = ofType && elem.nodeName.toLowerCase(),
+ useCache = !xml && !ofType;
+
+ if ( parent ) {
+
+ // :(first|last|only)-(child|of-type)
+ if ( simple ) {
+ while ( dir ) {
+ node = elem;
+ while ( (node = node[ dir ]) ) {
+ if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
+ return false;
+ }
+ }
+ // Reverse direction for :only-* (if we haven't yet done so)
+ start = dir = type === "only" && !start && "nextSibling";
+ }
+ return true;
+ }
+
+ start = [ forward ? parent.firstChild : parent.lastChild ];
+
+ // non-xml :nth-child(...) stores cache data on `parent`
+ if ( forward && useCache ) {
+ // Seek `elem` from a previously-cached index
+ outerCache = parent[ expando ] || (parent[ expando ] = {});
+ cache = outerCache[ type ] || [];
+ nodeIndex = cache[0] === dirruns && cache[1];
+ diff = cache[0] === dirruns && cache[2];
+ node = nodeIndex && parent.childNodes[ nodeIndex ];
+
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+
+ // Fallback to seeking `elem` from the start
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ // When found, cache indexes on `parent` and break
+ if ( node.nodeType === 1 && ++diff && node === elem ) {
+ outerCache[ type ] = [ dirruns, nodeIndex, diff ];
+ break;
+ }
+ }
+
+ // Use previously-cached element index if available
+ } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
+ diff = cache[1];
+
+ // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
+ } else {
+ // Use the same loop as above to seek `elem` from the start
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
+ // Cache the index of each encountered element
+ if ( useCache ) {
+ (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
+ }
+
+ if ( node === elem ) {
+ break;
+ }
+ }
+ }
+ }
+
+ // Incorporate the offset, then check against cycle size
+ diff -= last;
+ return diff === first || ( diff % first === 0 && diff / first >= 0 );
+ }
+ };
+ },
+
+ "PSEUDO": function( pseudo, argument ) {
+ // pseudo-class names are case-insensitive
+ // http://www.w3.org/TR/selectors/#pseudo-classes
+ // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
+ // Remember that setFilters inherits from pseudos
+ var args,
+ fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
+ Sizzle.error( "unsupported pseudo: " + pseudo );
+
+ // The user may use createPseudo to indicate that
+ // arguments are needed to create the filter function
+ // just as Sizzle does
+ if ( fn[ expando ] ) {
+ return fn( argument );
+ }
+
+ // But maintain support for old signatures
+ if ( fn.length > 1 ) {
+ args = [ pseudo, pseudo, "", argument ];
+ return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
+ markFunction(function( seed, matches ) {
+ var idx,
+ matched = fn( seed, argument ),
+ i = matched.length;
+ while ( i-- ) {
+ idx = indexOf.call( seed, matched[i] );
+ seed[ idx ] = !( matches[ idx ] = matched[i] );
+ }
+ }) :
+ function( elem ) {
+ return fn( elem, 0, args );
+ };
+ }
+
+ return fn;
+ }
+ },
+
+ pseudos: {
+ // Potentially complex pseudos
+ "not": markFunction(function( selector ) {
+ // Trim the selector passed to compile
+ // to avoid treating leading and trailing
+ // spaces as combinators
+ var input = [],
+ results = [],
+ matcher = compile( selector.replace( rtrim, "$1" ) );
+
+ return matcher[ expando ] ?
+ markFunction(function( seed, matches, context, xml ) {
+ var elem,
+ unmatched = matcher( seed, null, xml, [] ),
+ i = seed.length;
+
+ // Match elements unmatched by `matcher`
+ while ( i-- ) {
+ if ( (elem = unmatched[i]) ) {
+ seed[i] = !(matches[i] = elem);
+ }
+ }
+ }) :
+ function( elem, context, xml ) {
+ input[0] = elem;
+ matcher( input, null, xml, results );
+ return !results.pop();
+ };
+ }),
+
+ "has": markFunction(function( selector ) {
+ return function( elem ) {
+ return Sizzle( selector, elem ).length > 0;
+ };
+ }),
+
+ "contains": markFunction(function( text ) {
+ return function( elem ) {
+ return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
+ };
+ }),
+
+ // "Whether an element is represented by a :lang() selector
+ // is based solely on the element's language value
+ // being equal to the identifier C,
+ // or beginning with the identifier C immediately followed by "-".
+ // The matching of C against the element's language value is performed case-insensitively.
+ // The identifier C does not have to be a valid language name."
+ // http://www.w3.org/TR/selectors/#lang-pseudo
+ "lang": markFunction( function( lang ) {
+ // lang value must be a valid identifier
+ if ( !ridentifier.test(lang || "") ) {
+ Sizzle.error( "unsupported lang: " + lang );
+ }
+ lang = lang.replace( runescape, funescape ).toLowerCase();
+ return function( elem ) {
+ var elemLang;
+ do {
+ if ( (elemLang = documentIsHTML ?
+ elem.lang :
+ elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
+
+ elemLang = elemLang.toLowerCase();
+ return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
+ }
+ } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
+ return false;
+ };
+ }),
+
+ // Miscellaneous
+ "target": function( elem ) {
+ var hash = window.location && window.location.hash;
+ return hash && hash.slice( 1 ) === elem.id;
+ },
+
+ "root": function( elem ) {
+ return elem === docElem;
+ },
+
+ "focus": function( elem ) {
+ return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
+ },
+
+ // Boolean properties
+ "enabled": function( elem ) {
+ return elem.disabled === false;
+ },
+
+ "disabled": function( elem ) {
+ return elem.disabled === true;
+ },
+
+ "checked": function( elem ) {
+ // In CSS3, :checked should return both checked and selected elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ var nodeName = elem.nodeName.toLowerCase();
+ return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
+ },
+
+ "selected": function( elem ) {
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ if ( elem.parentNode ) {
+ elem.parentNode.selectedIndex;
+ }
+
+ return elem.selected === true;
+ },
+
+ // Contents
+ "empty": function( elem ) {
+ // http://www.w3.org/TR/selectors/#empty-pseudo
+ // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
+ // but not by others (comment: 8; processing instruction: 7; etc.)
+ // nodeType < 6 works because attributes (2) do not appear as children
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ if ( elem.nodeType < 6 ) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ "parent": function( elem ) {
+ return !Expr.pseudos["empty"]( elem );
+ },
+
+ // Element/input types
+ "header": function( elem ) {
+ return rheader.test( elem.nodeName );
+ },
+
+ "input": function( elem ) {
+ return rinputs.test( elem.nodeName );
+ },
+
+ "button": function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === "button" || name === "button";
+ },
+
+ "text": function( elem ) {
+ var attr;
+ return elem.nodeName.toLowerCase() === "input" &&
+ elem.type === "text" &&
+
+ // Support: IE<8
+ // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
+ ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
+ },
+
+ // Position-in-collection
+ "first": createPositionalPseudo(function() {
+ return [ 0 ];
+ }),
+
+ "last": createPositionalPseudo(function( matchIndexes, length ) {
+ return [ length - 1 ];
+ }),
+
+ "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ return [ argument < 0 ? argument + length : argument ];
+ }),
+
+ "even": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 0;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "odd": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 1;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; --i >= 0; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; ++i < length; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ })
+ }
+};
+
+Expr.pseudos["nth"] = Expr.pseudos["eq"];
+
+// Add button/input type pseudos
+for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
+ Expr.pseudos[ i ] = createInputPseudo( i );
+}
+for ( i in { submit: true, reset: true } ) {
+ Expr.pseudos[ i ] = createButtonPseudo( i );
+}
+
+// Easy API for creating new setFilters
+function setFilters() {}
+setFilters.prototype = Expr.filters = Expr.pseudos;
+Expr.setFilters = new setFilters();
+
+tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
+ var matched, match, tokens, type,
+ soFar, groups, preFilters,
+ cached = tokenCache[ selector + " " ];
+
+ if ( cached ) {
+ return parseOnly ? 0 : cached.slice( 0 );
+ }
+
+ soFar = selector;
+ groups = [];
+ preFilters = Expr.preFilter;
+
+ while ( soFar ) {
+
+ // Comma and first run
+ if ( !matched || (match = rcomma.exec( soFar )) ) {
+ if ( match ) {
+ // Don't consume trailing commas as valid
+ soFar = soFar.slice( match[0].length ) || soFar;
+ }
+ groups.push( (tokens = []) );
+ }
+
+ matched = false;
+
+ // Combinators
+ if ( (match = rcombinators.exec( soFar )) ) {
+ matched = match.shift();
+ tokens.push({
+ value: matched,
+ // Cast descendant combinators to space
+ type: match[0].replace( rtrim, " " )
+ });
+ soFar = soFar.slice( matched.length );
+ }
+
+ // Filters
+ for ( type in Expr.filter ) {
+ if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
+ (match = preFilters[ type ]( match ))) ) {
+ matched = match.shift();
+ tokens.push({
+ value: matched,
+ type: type,
+ matches: match
+ });
+ soFar = soFar.slice( matched.length );
+ }
+ }
+
+ if ( !matched ) {
+ break;
+ }
+ }
+
+ // Return the length of the invalid excess
+ // if we're just parsing
+ // Otherwise, throw an error or return tokens
+ return parseOnly ?
+ soFar.length :
+ soFar ?
+ Sizzle.error( selector ) :
+ // Cache the tokens
+ tokenCache( selector, groups ).slice( 0 );
+};
+
+function toSelector( tokens ) {
+ var i = 0,
+ len = tokens.length,
+ selector = "";
+ for ( ; i < len; i++ ) {
+ selector += tokens[i].value;
+ }
+ return selector;
+}
+
+function addCombinator( matcher, combinator, base ) {
+ var dir = combinator.dir,
+ checkNonElements = base && dir === "parentNode",
+ doneName = done++;
+
+ return combinator.first ?
+ // Check against closest ancestor/preceding element
+ function( elem, context, xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ return matcher( elem, context, xml );
+ }
+ }
+ } :
+
+ // Check against all ancestor/preceding elements
+ function( elem, context, xml ) {
+ var oldCache, outerCache,
+ newCache = [ dirruns, doneName ];
+
+ // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
+ if ( xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ if ( matcher( elem, context, xml ) ) {
+ return true;
+ }
+ }
+ }
+ } else {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ outerCache = elem[ expando ] || (elem[ expando ] = {});
+ if ( (oldCache = outerCache[ dir ]) &&
+ oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
+
+ // Assign to newCache so results back-propagate to previous elements
+ return (newCache[ 2 ] = oldCache[ 2 ]);
+ } else {
+ // Reuse newcache so results back-propagate to previous elements
+ outerCache[ dir ] = newCache;
+
+ // A match means we're done; a fail means we have to keep checking
+ if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ };
+}
+
+function elementMatcher( matchers ) {
+ return matchers.length > 1 ?
+ function( elem, context, xml ) {
+ var i = matchers.length;
+ while ( i-- ) {
+ if ( !matchers[i]( elem, context, xml ) ) {
+ return false;
+ }
+ }
+ return true;
+ } :
+ matchers[0];
+}
+
+function multipleContexts( selector, contexts, results ) {
+ var i = 0,
+ len = contexts.length;
+ for ( ; i < len; i++ ) {
+ Sizzle( selector, contexts[i], results );
+ }
+ return results;
+}
+
+function condense( unmatched, map, filter, context, xml ) {
+ var elem,
+ newUnmatched = [],
+ i = 0,
+ len = unmatched.length,
+ mapped = map != null;
+
+ for ( ; i < len; i++ ) {
+ if ( (elem = unmatched[i]) ) {
+ if ( !filter || filter( elem, context, xml ) ) {
+ newUnmatched.push( elem );
+ if ( mapped ) {
+ map.push( i );
+ }
+ }
+ }
+ }
+
+ return newUnmatched;
+}
+
+function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
+ if ( postFilter && !postFilter[ expando ] ) {
+ postFilter = setMatcher( postFilter );
+ }
+ if ( postFinder && !postFinder[ expando ] ) {
+ postFinder = setMatcher( postFinder, postSelector );
+ }
+ return markFunction(function( seed, results, context, xml ) {
+ var temp, i, elem,
+ preMap = [],
+ postMap = [],
+ preexisting = results.length,
+
+ // Get initial elements from seed or context
+ elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
+
+ // Prefilter to get matcher input, preserving a map for seed-results synchronization
+ matcherIn = preFilter && ( seed || !selector ) ?
+ condense( elems, preMap, preFilter, context, xml ) :
+ elems,
+
+ matcherOut = matcher ?
+ // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
+ postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
+
+ // ...intermediate processing is necessary
+ [] :
+
+ // ...otherwise use results directly
+ results :
+ matcherIn;
+
+ // Find primary matches
+ if ( matcher ) {
+ matcher( matcherIn, matcherOut, context, xml );
+ }
+
+ // Apply postFilter
+ if ( postFilter ) {
+ temp = condense( matcherOut, postMap );
+ postFilter( temp, [], context, xml );
+
+ // Un-match failing elements by moving them back to matcherIn
+ i = temp.length;
+ while ( i-- ) {
+ if ( (elem = temp[i]) ) {
+ matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
+ }
+ }
+ }
+
+ if ( seed ) {
+ if ( postFinder || preFilter ) {
+ if ( postFinder ) {
+ // Get the final matcherOut by condensing this intermediate into postFinder contexts
+ temp = [];
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) ) {
+ // Restore matcherIn since elem is not yet a final match
+ temp.push( (matcherIn[i] = elem) );
+ }
+ }
+ postFinder( null, (matcherOut = []), temp, xml );
+ }
+
+ // Move matched elements from seed to results to keep them synchronized
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) &&
+ (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
+
+ seed[temp] = !(results[temp] = elem);
+ }
+ }
+ }
+
+ // Add elements to results, through postFinder if defined
+ } else {
+ matcherOut = condense(
+ matcherOut === results ?
+ matcherOut.splice( preexisting, matcherOut.length ) :
+ matcherOut
+ );
+ if ( postFinder ) {
+ postFinder( null, results, matcherOut, xml );
+ } else {
+ push.apply( results, matcherOut );
+ }
+ }
+ });
+}
+
+function matcherFromTokens( tokens ) {
+ var checkContext, matcher, j,
+ len = tokens.length,
+ leadingRelative = Expr.relative[ tokens[0].type ],
+ implicitRelative = leadingRelative || Expr.relative[" "],
+ i = leadingRelative ? 1 : 0,
+
+ // The foundational matcher ensures that elements are reachable from top-level context(s)
+ matchContext = addCombinator( function( elem ) {
+ return elem === checkContext;
+ }, implicitRelative, true ),
+ matchAnyContext = addCombinator( function( elem ) {
+ return indexOf.call( checkContext, elem ) > -1;
+ }, implicitRelative, true ),
+ matchers = [ function( elem, context, xml ) {
+ return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
+ (checkContext = context).nodeType ?
+ matchContext( elem, context, xml ) :
+ matchAnyContext( elem, context, xml ) );
+ } ];
+
+ for ( ; i < len; i++ ) {
+ if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
+ matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
+ } else {
+ matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
+
+ // Return special upon seeing a positional matcher
+ if ( matcher[ expando ] ) {
+ // Find the next relative operator (if any) for proper handling
+ j = ++i;
+ for ( ; j < len; j++ ) {
+ if ( Expr.relative[ tokens[j].type ] ) {
+ break;
+ }
+ }
+ return setMatcher(
+ i > 1 && elementMatcher( matchers ),
+ i > 1 && toSelector(
+ // If the preceding token was a descendant combinator, insert an implicit any-element `*`
+ tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
+ ).replace( rtrim, "$1" ),
+ matcher,
+ i < j && matcherFromTokens( tokens.slice( i, j ) ),
+ j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
+ j < len && toSelector( tokens )
+ );
+ }
+ matchers.push( matcher );
+ }
+ }
+
+ return elementMatcher( matchers );
+}
+
+function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
+ var bySet = setMatchers.length > 0,
+ byElement = elementMatchers.length > 0,
+ superMatcher = function( seed, context, xml, results, outermost ) {
+ var elem, j, matcher,
+ matchedCount = 0,
+ i = "0",
+ unmatched = seed && [],
+ setMatched = [],
+ contextBackup = outermostContext,
+ // We must always have either seed elements or outermost context
+ elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
+ // Use integer dirruns iff this is the outermost matcher
+ dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
+ len = elems.length;
+
+ if ( outermost ) {
+ outermostContext = context !== document && context;
+ }
+
+ // Add elements passing elementMatchers directly to results
+ // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
+ // Support: IE<9, Safari
+ // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
+ for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
+ if ( byElement && elem ) {
+ j = 0;
+ while ( (matcher = elementMatchers[j++]) ) {
+ if ( matcher( elem, context, xml ) ) {
+ results.push( elem );
+ break;
+ }
+ }
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ }
+ }
+
+ // Track unmatched elements for set filters
+ if ( bySet ) {
+ // They will have gone through all possible matchers
+ if ( (elem = !matcher && elem) ) {
+ matchedCount--;
+ }
+
+ // Lengthen the array for every element, matched or not
+ if ( seed ) {
+ unmatched.push( elem );
+ }
+ }
+ }
+
+ // Apply set filters to unmatched elements
+ matchedCount += i;
+ if ( bySet && i !== matchedCount ) {
+ j = 0;
+ while ( (matcher = setMatchers[j++]) ) {
+ matcher( unmatched, setMatched, context, xml );
+ }
+
+ if ( seed ) {
+ // Reintegrate element matches to eliminate the need for sorting
+ if ( matchedCount > 0 ) {
+ while ( i-- ) {
+ if ( !(unmatched[i] || setMatched[i]) ) {
+ setMatched[i] = pop.call( results );
+ }
+ }
+ }
+
+ // Discard index placeholder values to get only actual matches
+ setMatched = condense( setMatched );
+ }
+
+ // Add matches to results
+ push.apply( results, setMatched );
+
+ // Seedless set matches succeeding multiple successful matchers stipulate sorting
+ if ( outermost && !seed && setMatched.length > 0 &&
+ ( matchedCount + setMatchers.length ) > 1 ) {
+
+ Sizzle.uniqueSort( results );
+ }
+ }
+
+ // Override manipulation of globals by nested matchers
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ outermostContext = contextBackup;
+ }
+
+ return unmatched;
+ };
+
+ return bySet ?
+ markFunction( superMatcher ) :
+ superMatcher;
+}
+
+compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
+ var i,
+ setMatchers = [],
+ elementMatchers = [],
+ cached = compilerCache[ selector + " " ];
+
+ if ( !cached ) {
+ // Generate a function of recursive functions that can be used to check each element
+ if ( !match ) {
+ match = tokenize( selector );
+ }
+ i = match.length;
+ while ( i-- ) {
+ cached = matcherFromTokens( match[i] );
+ if ( cached[ expando ] ) {
+ setMatchers.push( cached );
+ } else {
+ elementMatchers.push( cached );
+ }
+ }
+
+ // Cache the compiled function
+ cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
+
+ // Save selector and tokenization
+ cached.selector = selector;
+ }
+ return cached;
+};
+
+/**
+ * A low-level selection function that works with Sizzle's compiled
+ * selector functions
+ * @param {String|Function} selector A selector or a pre-compiled
+ * selector function built with Sizzle.compile
+ * @param {Element} context
+ * @param {Array} [results]
+ * @param {Array} [seed] A set of elements to match against
+ */
+select = Sizzle.select = function( selector, context, results, seed ) {
+ var i, tokens, token, type, find,
+ compiled = typeof selector === "function" && selector,
+ match = !seed && tokenize( (selector = compiled.selector || selector) );
+
+ results = results || [];
+
+ // Try to minimize operations if there is no seed and only one group
+ if ( match.length === 1 ) {
+
+ // Take a shortcut and set the context if the root selector is an ID
+ tokens = match[0] = match[0].slice( 0 );
+ if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
+ support.getById && context.nodeType === 9 && documentIsHTML &&
+ Expr.relative[ tokens[1].type ] ) {
+
+ context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
+ if ( !context ) {
+ return results;
+
+ // Precompiled matchers will still verify ancestry, so step up a level
+ } else if ( compiled ) {
+ context = context.parentNode;
+ }
+
+ selector = selector.slice( tokens.shift().value.length );
+ }
+
+ // Fetch a seed set for right-to-left matching
+ i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
+ while ( i-- ) {
+ token = tokens[i];
+
+ // Abort if we hit a combinator
+ if ( Expr.relative[ (type = token.type) ] ) {
+ break;
+ }
+ if ( (find = Expr.find[ type ]) ) {
+ // Search, expanding context for leading sibling combinators
+ if ( (seed = find(
+ token.matches[0].replace( runescape, funescape ),
+ rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
+ )) ) {
+
+ // If seed is empty or no tokens remain, we can return early
+ tokens.splice( i, 1 );
+ selector = seed.length && toSelector( tokens );
+ if ( !selector ) {
+ push.apply( results, seed );
+ return results;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ // Compile and execute a filtering function if one is not provided
+ // Provide `match` to avoid retokenization if we modified the selector above
+ ( compiled || compile( selector, match ) )(
+ seed,
+ context,
+ !documentIsHTML,
+ results,
+ rsibling.test( selector ) && testContext( context.parentNode ) || context
+ );
+ return results;
+};
+
+// One-time assignments
+
+// Sort stability
+support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
+
+// Support: Chrome<14
+// Always assume duplicates if they aren't passed to the comparison function
+support.detectDuplicates = !!hasDuplicate;
+
+// Initialize against the default document
+setDocument();
+
+// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
+// Detached nodes confoundingly follow *each other*
+support.sortDetached = assert(function( div1 ) {
+ // Should return 1, but returns 4 (following)
+ return div1.compareDocumentPosition( document.createElement("div") ) & 1;
+});
+
+// Support: IE<8
+// Prevent attribute/property "interpolation"
+// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+if ( !assert(function( div ) {
+ div.innerHTML = "<a href='#'></a>";
+ return div.firstChild.getAttribute("href") === "#" ;
+}) ) {
+ addHandle( "type|href|height|width", function( elem, name, isXML ) {
+ if ( !isXML ) {
+ return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
+ }
+ });
+}
+
+// Support: IE<9
+// Use defaultValue in place of getAttribute("value")
+if ( !support.attributes || !assert(function( div ) {
+ div.innerHTML = "<input/>";
+ div.firstChild.setAttribute( "value", "" );
+ return div.firstChild.getAttribute( "value" ) === "";
+}) ) {
+ addHandle( "value", function( elem, name, isXML ) {
+ if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
+ return elem.defaultValue;
+ }
+ });
+}
+
+// Support: IE<9
+// Use getAttributeNode to fetch booleans when getAttribute lies
+if ( !assert(function( div ) {
+ return div.getAttribute("disabled") == null;
+}) ) {
+ addHandle( booleans, function( elem, name, isXML ) {
+ var val;
+ if ( !isXML ) {
+ return elem[ name ] === true ? name.toLowerCase() :
+ (val = elem.getAttributeNode( name )) && val.specified ?
+ val.value :
+ null;
+ }
+ });
+}
+
+return Sizzle;
+
+})( window );
+
+
+
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.pseudos;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+
+
+
+var rneedsContext = jQuery.expr.match.needsContext;
+
+var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
+
+
+
+var risSimple = /^.[^:#\[\.,]*$/;
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, not ) {
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep( elements, function( elem, i ) {
+ /* jshint -W018 */
+ return !!qualifier.call( elem, i, elem ) !== not;
+ });
+
+ }
+
+ if ( qualifier.nodeType ) {
+ return jQuery.grep( elements, function( elem ) {
+ return ( elem === qualifier ) !== not;
+ });
+
+ }
+
+ if ( typeof qualifier === "string" ) {
+ if ( risSimple.test( qualifier ) ) {
+ return jQuery.filter( qualifier, elements, not );
+ }
+
+ qualifier = jQuery.filter( qualifier, elements );
+ }
+
+ return jQuery.grep( elements, function( elem ) {
+ return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
+ });
+}
+
+jQuery.filter = function( expr, elems, not ) {
+ var elem = elems[ 0 ];
+
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return elems.length === 1 && elem.nodeType === 1 ?
+ jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
+ jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
+ return elem.nodeType === 1;
+ }));
+};
+
+jQuery.fn.extend({
+ find: function( selector ) {
+ var i,
+ len = this.length,
+ ret = [],
+ self = this;
+
+ if ( typeof selector !== "string" ) {
+ return this.pushStack( jQuery( selector ).filter(function() {
+ for ( i = 0; i < len; i++ ) {
+ if ( jQuery.contains( self[ i ], this ) ) {
+ return true;
+ }
+ }
+ }) );
+ }
+
+ for ( i = 0; i < len; i++ ) {
+ jQuery.find( selector, self[ i ], ret );
+ }
+
+ // Needed because $( selector, context ) becomes $( context ).find( selector )
+ ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
+ ret.selector = this.selector ? this.selector + " " + selector : selector;
+ return ret;
+ },
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector || [], false) );
+ },
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector || [], true) );
+ },
+ is: function( selector ) {
+ return !!winnow(
+ this,
+
+ // If this is a positional/relative selector, check membership in the returned set
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
+ typeof selector === "string" && rneedsContext.test( selector ) ?
+ jQuery( selector ) :
+ selector || [],
+ false
+ ).length;
+ }
+});
+
+
+// Initialize a jQuery object
+
+
+// A central reference to the root jQuery(document)
+var rootjQuery,
+
+ // A simple way to check for HTML strings
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
+ // Strict HTML recognition (#11290: must start with <)
+ rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
+
+ init = jQuery.fn.init = function( selector, context ) {
+ var match, elem;
+
+ // HANDLE: $(""), $(null), $(undefined), $(false)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
+ // Assume that strings that start and end with <> are HTML and skip the regex check
+ match = [ null, selector, null ];
+
+ } else {
+ match = rquickExpr.exec( selector );
+ }
+
+ // Match html or make sure no context is specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ context = context instanceof jQuery ? context[0] : context;
+
+ // scripts is true for back-compat
+ // Intentionally let the error be thrown if parseHTML is not present
+ jQuery.merge( this, jQuery.parseHTML(
+ match[1],
+ context && context.nodeType ? context.ownerDocument || context : document,
+ true
+ ) );
+
+ // HANDLE: $(html, props)
+ if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
+ for ( match in context ) {
+ // Properties of context are called as methods if possible
+ if ( jQuery.isFunction( this[ match ] ) ) {
+ this[ match ]( context[ match ] );
+
+ // ...and otherwise set as attributes
+ } else {
+ this.attr( match, context[ match ] );
+ }
+ }
+ }
+
+ return this;
+
+ // HANDLE: $(#id)
+ } else {
+ elem = document.getElementById( match[2] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return ( context || rootjQuery ).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return this.constructor( context ).find( selector );
+ }
+
+ // HANDLE: $(DOMElement)
+ } else if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return typeof rootjQuery.ready !== "undefined" ?
+ rootjQuery.ready( selector ) :
+ // Execute immediately if ready is not present
+ selector( jQuery );
+ }
+
+ if ( selector.selector !== undefined ) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.makeArray( selector, this );
+ };
+
+// Give the init function the jQuery prototype for later instantiation
+init.prototype = jQuery.fn;
+
+// Initialize central reference
+rootjQuery = jQuery( document );
+
+
+var rparentsprev = /^(?:parents|prev(?:Until|All))/,
+ // methods guaranteed to produce a unique set when starting from a unique set
+ guaranteedUnique = {
+ children: true,
+ contents: true,
+ next: true,
+ prev: true
+ };
+
+jQuery.extend({
+ dir: function( elem, dir, until ) {
+ var matched = [],
+ truncate = until !== undefined;
+
+ while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
+ if ( elem.nodeType === 1 ) {
+ if ( truncate && jQuery( elem ).is( until ) ) {
+ break;
+ }
+ matched.push( elem );
+ }
+ }
+ return matched;
+ },
+
+ sibling: function( n, elem ) {
+ var matched = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType === 1 && n !== elem ) {
+ matched.push( n );
+ }
+ }
+
+ return matched;
+ }
+});
+
+jQuery.fn.extend({
+ has: function( target ) {
+ var targets = jQuery( target, this ),
+ l = targets.length;
+
+ return this.filter(function() {
+ var i = 0;
+ for ( ; i < l; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
+
+ closest: function( selectors, context ) {
+ var cur,
+ i = 0,
+ l = this.length,
+ matched = [],
+ pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
+ jQuery( selectors, context || this.context ) :
+ 0;
+
+ for ( ; i < l; i++ ) {
+ for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
+ // Always skip document fragments
+ if ( cur.nodeType < 11 && (pos ?
+ pos.index(cur) > -1 :
+
+ // Don't pass non-elements to Sizzle
+ cur.nodeType === 1 &&
+ jQuery.find.matchesSelector(cur, selectors)) ) {
+
+ matched.push( cur );
+ break;
+ }
+ }
+ }
+
+ return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+
+ // No argument, return index in parent
+ if ( !elem ) {
+ return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
+ }
+
+ // index in selector
+ if ( typeof elem === "string" ) {
+ return indexOf.call( jQuery( elem ), this[ 0 ] );
+ }
+
+ // Locate the position of the desired element
+ return indexOf.call( this,
+
+ // If it receives a jQuery object, the first element is used
+ elem.jquery ? elem[ 0 ] : elem
+ );
+ },
+
+ add: function( selector, context ) {
+ return this.pushStack(
+ jQuery.unique(
+ jQuery.merge( this.get(), jQuery( selector, context ) )
+ )
+ );
+ },
+
+ addBack: function( selector ) {
+ return this.add( selector == null ?
+ this.prevObject : this.prevObject.filter(selector)
+ );
+ }
+});
+
+function sibling( cur, dir ) {
+ while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
+ return cur;
+}
+
+jQuery.each({
+ parent: function( elem ) {
+ var parent = elem.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function( elem ) {
+ return jQuery.dir( elem, "parentNode" );
+ },
+ parentsUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "parentNode", until );
+ },
+ next: function( elem ) {
+ return sibling( elem, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return sibling( elem, "previousSibling" );
+ },
+ nextAll: function( elem ) {
+ return jQuery.dir( elem, "nextSibling" );
+ },
+ prevAll: function( elem ) {
+ return jQuery.dir( elem, "previousSibling" );
+ },
+ nextUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "nextSibling", until );
+ },
+ prevUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "previousSibling", until );
+ },
+ siblings: function( elem ) {
+ return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
+ },
+ children: function( elem ) {
+ return jQuery.sibling( elem.firstChild );
+ },
+ contents: function( elem ) {
+ return elem.contentDocument || jQuery.merge( [], elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var matched = jQuery.map( this, fn, until );
+
+ if ( name.slice( -5 ) !== "Until" ) {
+ selector = until;
+ }
+
+ if ( selector && typeof selector === "string" ) {
+ matched = jQuery.filter( selector, matched );
+ }
+
+ if ( this.length > 1 ) {
+ // Remove duplicates
+ if ( !guaranteedUnique[ name ] ) {
+ jQuery.unique( matched );
+ }
+
+ // Reverse order for parents* and prev-derivatives
+ if ( rparentsprev.test( name ) ) {
+ matched.reverse();
+ }
+ }
+
+ return this.pushStack( matched );
+ };
+});
+var rnotwhite = (/\S+/g);
+
+
+
+// String to Object options format cache
+var optionsCache = {};
+
+// Convert String-formatted options into Object-formatted ones and store in cache
+function createOptions( options ) {
+ var object = optionsCache[ options ] = {};
+ jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
+ object[ flag ] = true;
+ });
+ return object;
+}
+
+/*
+ * Create a callback list using the following parameters:
+ *
+ * options: an optional list of space-separated options that will change how
+ * the callback list behaves or a more traditional option object
+ *
+ * By default a callback list will act like an event callback list and can be
+ * "fired" multiple times.
+ *
+ * Possible options:
+ *
+ * once: will ensure the callback list can only be fired once (like a Deferred)
+ *
+ * memory: will keep track of previous values and will call any callback added
+ * after the list has been fired right away with the latest "memorized"
+ * values (like a Deferred)
+ *
+ * unique: will ensure a callback can only be added once (no duplicate in the list)
+ *
+ * stopOnFalse: interrupt callings when a callback returns false
+ *
+ */
+jQuery.Callbacks = function( options ) {
+
+ // Convert options from String-formatted to Object-formatted if needed
+ // (we check in cache first)
+ options = typeof options === "string" ?
+ ( optionsCache[ options ] || createOptions( options ) ) :
+ jQuery.extend( {}, options );
+
+ var // Last fire value (for non-forgettable lists)
+ memory,
+ // Flag to know if list was already fired
+ fired,
+ // Flag to know if list is currently firing
+ firing,
+ // First callback to fire (used internally by add and fireWith)
+ firingStart,
+ // End of the loop when firing
+ firingLength,
+ // Index of currently firing callback (modified by remove if needed)
+ firingIndex,
+ // Actual callback list
+ list = [],
+ // Stack of fire calls for repeatable lists
+ stack = !options.once && [],
+ // Fire callbacks
+ fire = function( data ) {
+ memory = options.memory && data;
+ fired = true;
+ firingIndex = firingStart || 0;
+ firingStart = 0;
+ firingLength = list.length;
+ firing = true;
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+ if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
+ memory = false; // To prevent further calls using add
+ break;
+ }
+ }
+ firing = false;
+ if ( list ) {
+ if ( stack ) {
+ if ( stack.length ) {
+ fire( stack.shift() );
+ }
+ } else if ( memory ) {
+ list = [];
+ } else {
+ self.disable();
+ }
+ }
+ },
+ // Actual Callbacks object
+ self = {
+ // Add a callback or a collection of callbacks to the list
+ add: function() {
+ if ( list ) {
+ // First, we save the current length
+ var start = list.length;
+ (function add( args ) {
+ jQuery.each( args, function( _, arg ) {
+ var type = jQuery.type( arg );
+ if ( type === "function" ) {
+ if ( !options.unique || !self.has( arg ) ) {
+ list.push( arg );
+ }
+ } else if ( arg && arg.length && type !== "string" ) {
+ // Inspect recursively
+ add( arg );
+ }
+ });
+ })( arguments );
+ // Do we need to add the callbacks to the
+ // current firing batch?
+ if ( firing ) {
+ firingLength = list.length;
+ // With memory, if we're not firing then
+ // we should call right away
+ } else if ( memory ) {
+ firingStart = start;
+ fire( memory );
+ }
+ }
+ return this;
+ },
+ // Remove a callback from the list
+ remove: function() {
+ if ( list ) {
+ jQuery.each( arguments, function( _, arg ) {
+ var index;
+ while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
+ list.splice( index, 1 );
+ // Handle firing indexes
+ if ( firing ) {
+ if ( index <= firingLength ) {
+ firingLength--;
+ }
+ if ( index <= firingIndex ) {
+ firingIndex--;
+ }
+ }
+ }
+ });
+ }
+ return this;
+ },
+ // Check if a given callback is in the list.
+ // If no argument is given, return whether or not list has callbacks attached.
+ has: function( fn ) {
+ return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
+ },
+ // Remove all callbacks from the list
+ empty: function() {
+ list = [];
+ firingLength = 0;
+ return this;
+ },
+ // Have the list do nothing anymore
+ disable: function() {
+ list = stack = memory = undefined;
+ return this;
+ },
+ // Is it disabled?
+ disabled: function() {
+ return !list;
+ },
+ // Lock the list in its current state
+ lock: function() {
+ stack = undefined;
+ if ( !memory ) {
+ self.disable();
+ }
+ return this;
+ },
+ // Is it locked?
+ locked: function() {
+ return !stack;
+ },
+ // Call all callbacks with the given context and arguments
+ fireWith: function( context, args ) {
+ if ( list && ( !fired || stack ) ) {
+ args = args || [];
+ args = [ context, args.slice ? args.slice() : args ];
+ if ( firing ) {
+ stack.push( args );
+ } else {
+ fire( args );
+ }
+ }
+ return this;
+ },
+ // Call all the callbacks with the given arguments
+ fire: function() {
+ self.fireWith( this, arguments );
+ return this;
+ },
+ // To know if the callbacks have already been called at least once
+ fired: function() {
+ return !!fired;
+ }
+ };
+
+ return self;
+};
+
+
+jQuery.extend({
+
+ Deferred: function( func ) {
+ var tuples = [
+ // action, add listener, listener list, final state
+ [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
+ [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
+ [ "notify", "progress", jQuery.Callbacks("memory") ]
+ ],
+ state = "pending",
+ promise = {
+ state: function() {
+ return state;
+ },
+ always: function() {
+ deferred.done( arguments ).fail( arguments );
+ return this;
+ },
+ then: function( /* fnDone, fnFail, fnProgress */ ) {
+ var fns = arguments;
+ return jQuery.Deferred(function( newDefer ) {
+ jQuery.each( tuples, function( i, tuple ) {
+ var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
+ // deferred[ done | fail | progress ] for forwarding actions to newDefer
+ deferred[ tuple[1] ](function() {
+ var returned = fn && fn.apply( this, arguments );
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
+ returned.promise()
+ .done( newDefer.resolve )
+ .fail( newDefer.reject )
+ .progress( newDefer.notify );
+ } else {
+ newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
+ }
+ });
+ });
+ fns = null;
+ }).promise();
+ },
+ // Get a promise for this deferred
+ // If obj is provided, the promise aspect is added to the object
+ promise: function( obj ) {
+ return obj != null ? jQuery.extend( obj, promise ) : promise;
+ }
+ },
+ deferred = {};
+
+ // Keep pipe for back-compat
+ promise.pipe = promise.then;
+
+ // Add list-specific methods
+ jQuery.each( tuples, function( i, tuple ) {
+ var list = tuple[ 2 ],
+ stateString = tuple[ 3 ];
+
+ // promise[ done | fail | progress ] = list.add
+ promise[ tuple[1] ] = list.add;
+
+ // Handle state
+ if ( stateString ) {
+ list.add(function() {
+ // state = [ resolved | rejected ]
+ state = stateString;
+
+ // [ reject_list | resolve_list ].disable; progress_list.lock
+ }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
+ }
+
+ // deferred[ resolve | reject | notify ]
+ deferred[ tuple[0] ] = function() {
+ deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
+ return this;
+ };
+ deferred[ tuple[0] + "With" ] = list.fireWith;
+ });
+
+ // Make the deferred a promise
+ promise.promise( deferred );
+
+ // Call given func if any
+ if ( func ) {
+ func.call( deferred, deferred );
+ }
+
+ // All done!
+ return deferred;
+ },
+
+ // Deferred helper
+ when: function( subordinate /* , ..., subordinateN */ ) {
+ var i = 0,
+ resolveValues = slice.call( arguments ),
+ length = resolveValues.length,
+
+ // the count of uncompleted subordinates
+ remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
+
+ // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
+ deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
+
+ // Update function for both resolve and progress values
+ updateFunc = function( i, contexts, values ) {
+ return function( value ) {
+ contexts[ i ] = this;
+ values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
+ if ( values === progressValues ) {
+ deferred.notifyWith( contexts, values );
+ } else if ( !( --remaining ) ) {
+ deferred.resolveWith( contexts, values );
+ }
+ };
+ },
+
+ progressValues, progressContexts, resolveContexts;
+
+ // add listeners to Deferred subordinates; treat others as resolved
+ if ( length > 1 ) {
+ progressValues = new Array( length );
+ progressContexts = new Array( length );
+ resolveContexts = new Array( length );
+ for ( ; i < length; i++ ) {
+ if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
+ resolveValues[ i ].promise()
+ .done( updateFunc( i, resolveContexts, resolveValues ) )
+ .fail( deferred.reject )
+ .progress( updateFunc( i, progressContexts, progressValues ) );
+ } else {
+ --remaining;
+ }
+ }
+ }
+
+ // if we're not waiting on anything, resolve the master
+ if ( !remaining ) {
+ deferred.resolveWith( resolveContexts, resolveValues );
+ }
+
+ return deferred.promise();
+ }
+});
+
+
+// The deferred used on DOM ready
+var readyList;
+
+jQuery.fn.ready = function( fn ) {
+ // Add the callback
+ jQuery.ready.promise().done( fn );
+
+ return this;
+};
+
+jQuery.extend({
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // A counter to track how many items to wait for before
+ // the ready event fires. See #6781
+ readyWait: 1,
+
+ // Hold (or release) the ready event
+ holdReady: function( hold ) {
+ if ( hold ) {
+ jQuery.readyWait++;
+ } else {
+ jQuery.ready( true );
+ }
+ },
+
+ // Handle when the DOM is ready
+ ready: function( wait ) {
+
+ // Abort if there are pending holds or we're already ready
+ if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
+ return;
+ }
+
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If a normal DOM Ready event fired, decrement, and wait if need be
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
+ return;
+ }
+
+ // If there are functions bound, to execute
+ readyList.resolveWith( document, [ jQuery ] );
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.triggerHandler ) {
+ jQuery( document ).triggerHandler( "ready" );
+ jQuery( document ).off( "ready" );
+ }
+ }
+});
+
+/**
+ * The ready event handler and self cleanup method
+ */
+function completed() {
+ document.removeEventListener( "DOMContentLoaded", completed, false );
+ window.removeEventListener( "load", completed, false );
+ jQuery.ready();
+}
+
+jQuery.ready.promise = function( obj ) {
+ if ( !readyList ) {
+
+ readyList = jQuery.Deferred();
+
+ // Catch cases where $(document).ready() is called after the browser event has already occurred.
+ // we once tried to use readyState "interactive" here, but it caused issues like the one
+ // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
+ if ( document.readyState === "complete" ) {
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ setTimeout( jQuery.ready );
+
+ } else {
+
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", completed, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", completed, false );
+ }
+ }
+ return readyList.promise( obj );
+};
+
+// Kick off the DOM ready check even if the user does not
+jQuery.ready.promise();
+
+
+
+
+// Multifunctional method to get and set values of a collection
+// The value/s can optionally be executed if it's a function
+var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
+ var i = 0,
+ len = elems.length,
+ bulk = key == null;
+
+ // Sets many values
+ if ( jQuery.type( key ) === "object" ) {
+ chainable = true;
+ for ( i in key ) {
+ jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
+ }
+
+ // Sets one value
+ } else if ( value !== undefined ) {
+ chainable = true;
+
+ if ( !jQuery.isFunction( value ) ) {
+ raw = true;
+ }
+
+ if ( bulk ) {
+ // Bulk operations run against the entire set
+ if ( raw ) {
+ fn.call( elems, value );
+ fn = null;
+
+ // ...except when executing function values
+ } else {
+ bulk = fn;
+ fn = function( elem, key, value ) {
+ return bulk.call( jQuery( elem ), value );
+ };
+ }
+ }
+
+ if ( fn ) {
+ for ( ; i < len; i++ ) {
+ fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
+ }
+ }
+ }
+
+ return chainable ?
+ elems :
+
+ // Gets
+ bulk ?
+ fn.call( elems ) :
+ len ? fn( elems[0], key ) : emptyGet;
+};
+
+
+/**
+ * Determines whether an object can have data
+ */
+jQuery.acceptData = function( owner ) {
+ // Accepts only:
+ // - Node
+ // - Node.ELEMENT_NODE
+ // - Node.DOCUMENT_NODE
+ // - Object
+ // - Any
+ /* jshint -W018 */
+ return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
+};
+
+
+function Data() {
+ // Support: Android < 4,
+ // Old WebKit does not have Object.preventExtensions/freeze method,
+ // return new empty object instead with no [[set]] accessor
+ Object.defineProperty( this.cache = {}, 0, {
+ get: function() {
+ return {};
+ }
+ });
+
+ this.expando = jQuery.expando + Math.random();
+}
+
+Data.uid = 1;
+Data.accepts = jQuery.acceptData;
+
+Data.prototype = {
+ key: function( owner ) {
+ // We can accept data for non-element nodes in modern browsers,
+ // but we should not, see #8335.
+ // Always return the key for a frozen object.
+ if ( !Data.accepts( owner ) ) {
+ return 0;
+ }
+
+ var descriptor = {},
+ // Check if the owner object already has a cache key
+ unlock = owner[ this.expando ];
+
+ // If not, create one
+ if ( !unlock ) {
+ unlock = Data.uid++;
+
+ // Secure it in a non-enumerable, non-writable property
+ try {
+ descriptor[ this.expando ] = { value: unlock };
+ Object.defineProperties( owner, descriptor );
+
+ // Support: Android < 4
+ // Fallback to a less secure definition
+ } catch ( e ) {
+ descriptor[ this.expando ] = unlock;
+ jQuery.extend( owner, descriptor );
+ }
+ }
+
+ // Ensure the cache object
+ if ( !this.cache[ unlock ] ) {
+ this.cache[ unlock ] = {};
+ }
+
+ return unlock;
+ },
+ set: function( owner, data, value ) {
+ var prop,
+ // There may be an unlock assigned to this node,
+ // if there is no entry for this "owner", create one inline
+ // and set the unlock as though an owner entry had always existed
+ unlock = this.key( owner ),
+ cache = this.cache[ unlock ];
+
+ // Handle: [ owner, key, value ] args
+ if ( typeof data === "string" ) {
+ cache[ data ] = value;
+
+ // Handle: [ owner, { properties } ] args
+ } else {
+ // Fresh assignments by object are shallow copied
+ if ( jQuery.isEmptyObject( cache ) ) {
+ jQuery.extend( this.cache[ unlock ], data );
+ // Otherwise, copy the properties one-by-one to the cache object
+ } else {
+ for ( prop in data ) {
+ cache[ prop ] = data[ prop ];
+ }
+ }
+ }
+ return cache;
+ },
+ get: function( owner, key ) {
+ // Either a valid cache is found, or will be created.
+ // New caches will be created and the unlock returned,
+ // allowing direct access to the newly created
+ // empty data object. A valid owner object must be provided.
+ var cache = this.cache[ this.key( owner ) ];
+
+ return key === undefined ?
+ cache : cache[ key ];
+ },
+ access: function( owner, key, value ) {
+ var stored;
+ // In cases where either:
+ //
+ // 1. No key was specified
+ // 2. A string key was specified, but no value provided
+ //
+ // Take the "read" path and allow the get method to determine
+ // which value to return, respectively either:
+ //
+ // 1. The entire cache object
+ // 2. The data stored at the key
+ //
+ if ( key === undefined ||
+ ((key && typeof key === "string") && value === undefined) ) {
+
+ stored = this.get( owner, key );
+
+ return stored !== undefined ?
+ stored : this.get( owner, jQuery.camelCase(key) );
+ }
+
+ // [*]When the key is not a string, or both a key and value
+ // are specified, set or extend (existing objects) with either:
+ //
+ // 1. An object of properties
+ // 2. A key and value
+ //
+ this.set( owner, key, value );
+
+ // Since the "set" path can have two possible entry points
+ // return the expected data based on which path was taken[*]
+ return value !== undefined ? value : key;
+ },
+ remove: function( owner, key ) {
+ var i, name, camel,
+ unlock = this.key( owner ),
+ cache = this.cache[ unlock ];
+
+ if ( key === undefined ) {
+ this.cache[ unlock ] = {};
+
+ } else {
+ // Support array or space separated string of keys
+ if ( jQuery.isArray( key ) ) {
+ // If "name" is an array of keys...
+ // When data is initially created, via ("key", "val") signature,
+ // keys will be converted to camelCase.
+ // Since there is no way to tell _how_ a key was added, remove
+ // both plain key and camelCase key. #12786
+ // This will only penalize the array argument path.
+ name = key.concat( key.map( jQuery.camelCase ) );
+ } else {
+ camel = jQuery.camelCase( key );
+ // Try the string as a key before any manipulation
+ if ( key in cache ) {
+ name = [ key, camel ];
+ } else {
+ // If a key with the spaces exists, use it.
+ // Otherwise, create an array by matching non-whitespace
+ name = camel;
+ name = name in cache ?
+ [ name ] : ( name.match( rnotwhite ) || [] );
+ }
+ }
+
+ i = name.length;
+ while ( i-- ) {
+ delete cache[ name[ i ] ];
+ }
+ }
+ },
+ hasData: function( owner ) {
+ return !jQuery.isEmptyObject(
+ this.cache[ owner[ this.expando ] ] || {}
+ );
+ },
+ discard: function( owner ) {
+ if ( owner[ this.expando ] ) {
+ delete this.cache[ owner[ this.expando ] ];
+ }
+ }
+};
+var data_priv = new Data();
+
+var data_user = new Data();
+
+
+
+/*
+ Implementation Summary
+
+ 1. Enforce API surface and semantic compatibility with 1.9.x branch
+ 2. Improve the module's maintainability by reducing the storage
+ paths to a single mechanism.
+ 3. Use the same single mechanism to support "private" and "user" data.
+ 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
+ 5. Avoid exposing implementation details on user objects (eg. expando properties)
+ 6. Provide a clear path for implementation upgrade to WeakMap in 2014
+*/
+var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
+ rmultiDash = /([A-Z])/g;
+
+function dataAttr( elem, key, data ) {
+ var name;
+
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+ name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
+ data = elem.getAttribute( name );
+
+ if ( typeof data === "string" ) {
+ try {
+ data = data === "true" ? true :
+ data === "false" ? false :
+ data === "null" ? null :
+ // Only convert to a number if it doesn't change the string
+ +data + "" === data ? +data :
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ data_user.set( elem, key, data );
+ } else {
+ data = undefined;
+ }
+ }
+ return data;
+}
+
+jQuery.extend({
+ hasData: function( elem ) {
+ return data_user.hasData( elem ) || data_priv.hasData( elem );
+ },
+
+ data: function( elem, name, data ) {
+ return data_user.access( elem, name, data );
+ },
+
+ removeData: function( elem, name ) {
+ data_user.remove( elem, name );
+ },
+
+ // TODO: Now that all calls to _data and _removeData have been replaced
+ // with direct calls to data_priv methods, these can be deprecated.
+ _data: function( elem, name, data ) {
+ return data_priv.access( elem, name, data );
+ },
+
+ _removeData: function( elem, name ) {
+ data_priv.remove( elem, name );
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ var i, name, data,
+ elem = this[ 0 ],
+ attrs = elem && elem.attributes;
+
+ // Gets all values
+ if ( key === undefined ) {
+ if ( this.length ) {
+ data = data_user.get( elem );
+
+ if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
+ i = attrs.length;
+ while ( i-- ) {
+
+ // Support: IE11+
+ // The attrs elements can be null (#14894)
+ if ( attrs[ i ] ) {
+ name = attrs[ i ].name;
+ if ( name.indexOf( "data-" ) === 0 ) {
+ name = jQuery.camelCase( name.slice(5) );
+ dataAttr( elem, name, data[ name ] );
+ }
+ }
+ }
+ data_priv.set( elem, "hasDataAttrs", true );
+ }
+ }
+
+ return data;
+ }
+
+ // Sets multiple values
+ if ( typeof key === "object" ) {
+ return this.each(function() {
+ data_user.set( this, key );
+ });
+ }
+
+ return access( this, function( value ) {
+ var data,
+ camelKey = jQuery.camelCase( key );
+
+ // The calling jQuery object (element matches) is not empty
+ // (and therefore has an element appears at this[ 0 ]) and the
+ // `value` parameter was not undefined. An empty jQuery object
+ // will result in `undefined` for elem = this[ 0 ] which will
+ // throw an exception if an attempt to read a data cache is made.
+ if ( elem && value === undefined ) {
+ // Attempt to get data from the cache
+ // with the key as-is
+ data = data_user.get( elem, key );
+ if ( data !== undefined ) {
+ return data;
+ }
+
+ // Attempt to get data from the cache
+ // with the key camelized
+ data = data_user.get( elem, camelKey );
+ if ( data !== undefined ) {
+ return data;
+ }
+
+ // Attempt to "discover" the data in
+ // HTML5 custom data-* attrs
+ data = dataAttr( elem, camelKey, undefined );
+ if ( data !== undefined ) {
+ return data;
+ }
+
+ // We tried really hard, but the data doesn't exist.
+ return;
+ }
+
+ // Set the data...
+ this.each(function() {
+ // First, attempt to store a copy or reference of any
+ // data that might've been store with a camelCased key.
+ var data = data_user.get( this, camelKey );
+
+ // For HTML5 data-* attribute interop, we have to
+ // store property names with dashes in a camelCase form.
+ // This might not apply to all properties...*
+ data_user.set( this, camelKey, value );
+
+ // *... In the case of properties that might _actually_
+ // have dashes, we need to also store a copy of that
+ // unchanged property.
+ if ( key.indexOf("-") !== -1 && data !== undefined ) {
+ data_user.set( this, key, value );
+ }
+ });
+ }, null, value, arguments.length > 1, null, true );
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ data_user.remove( this, key );
+ });
+ }
+});
+
+
+jQuery.extend({
+ queue: function( elem, type, data ) {
+ var queue;
+
+ if ( elem ) {
+ type = ( type || "fx" ) + "queue";
+ queue = data_priv.get( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !queue || jQuery.isArray( data ) ) {
+ queue = data_priv.access( elem, type, jQuery.makeArray(data) );
+ } else {
+ queue.push( data );
+ }
+ }
+ return queue || [];
+ }
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ),
+ startLength = queue.length,
+ fn = queue.shift(),
+ hooks = jQuery._queueHooks( elem, type ),
+ next = function() {
+ jQuery.dequeue( elem, type );
+ };
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ startLength--;
+ }
+
+ if ( fn ) {
+
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift( "inprogress" );
+ }
+
+ // clear up the last queue stop function
+ delete hooks.stop;
+ fn.call( elem, next, hooks );
+ }
+
+ if ( !startLength && hooks ) {
+ hooks.empty.fire();
+ }
+ },
+
+ // not intended for public consumption - generates a queueHooks object, or returns the current one
+ _queueHooks: function( elem, type ) {
+ var key = type + "queueHooks";
+ return data_priv.get( elem, key ) || data_priv.access( elem, key, {
+ empty: jQuery.Callbacks("once memory").add(function() {
+ data_priv.remove( elem, [ type + "queue", key ] );
+ })
+ });
+ }
+});
+
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ var setter = 2;
+
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ setter--;
+ }
+
+ if ( arguments.length < setter ) {
+ return jQuery.queue( this[0], type );
+ }
+
+ return data === undefined ?
+ this :
+ this.each(function() {
+ var queue = jQuery.queue( this, type, data );
+
+ // ensure a hooks for this queue
+ jQuery._queueHooks( this, type );
+
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ },
+ // Get a promise resolved when queues of a certain type
+ // are emptied (fx is the type by default)
+ promise: function( type, obj ) {
+ var tmp,
+ count = 1,
+ defer = jQuery.Deferred(),
+ elements = this,
+ i = this.length,
+ resolve = function() {
+ if ( !( --count ) ) {
+ defer.resolveWith( elements, [ elements ] );
+ }
+ };
+
+ if ( typeof type !== "string" ) {
+ obj = type;
+ type = undefined;
+ }
+ type = type || "fx";
+
+ while ( i-- ) {
+ tmp = data_priv.get( elements[ i ], type + "queueHooks" );
+ if ( tmp && tmp.empty ) {
+ count++;
+ tmp.empty.add( resolve );
+ }
+ }
+ resolve();
+ return defer.promise( obj );
+ }
+});
+var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
+
+var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
+
+var isHidden = function( elem, el ) {
+ // isHidden might be called from jQuery#filter function;
+ // in that case, element will be second argument
+ elem = el || elem;
+ return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
+ };
+
+var rcheckableType = (/^(?:checkbox|radio)$/i);
+
+
+
+(function() {
+ var fragment = document.createDocumentFragment(),
+ div = fragment.appendChild( document.createElement( "div" ) ),
+ input = document.createElement( "input" );
+
+ // #11217 - WebKit loses check when the name is after the checked attribute
+ // Support: Windows Web Apps (WWA)
+ // `name` and `type` need .setAttribute for WWA
+ input.setAttribute( "type", "radio" );
+ input.setAttribute( "checked", "checked" );
+ input.setAttribute( "name", "t" );
+
+ div.appendChild( input );
+
+ // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
+ // old WebKit doesn't clone checked state correctly in fragments
+ support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+ // Make sure textarea (and checkbox) defaultValue is properly cloned
+ // Support: IE9-IE11+
+ div.innerHTML = "<textarea>x</textarea>";
+ support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
+})();
+var strundefined = typeof undefined;
+
+
+
+support.focusinBubbles = "onfocusin" in window;
+
+
+var
+ rkeyEvent = /^key/,
+ rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+ rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
+
+function returnTrue() {
+ return true;
+}
+
+function returnFalse() {
+ return false;
+}
+
+function safeActiveElement() {
+ try {
+ return document.activeElement;
+ } catch ( err ) { }
+}
+
+/*
+ * Helper functions for managing events -- not part of the public interface.
+ * Props to Dean Edwards' addEvent library for many of the ideas.
+ */
+jQuery.event = {
+
+ global: {},
+
+ add: function( elem, types, handler, data, selector ) {
+
+ var handleObjIn, eventHandle, tmp,
+ events, t, handleObj,
+ special, handlers, type, namespaces, origType,
+ elemData = data_priv.get( elem );
+
+ // Don't attach events to noData or text/comment nodes (but allow plain objects)
+ if ( !elemData ) {
+ return;
+ }
+
+ // Caller can pass in an object of custom data in lieu of the handler
+ if ( handler.handler ) {
+ handleObjIn = handler;
+ handler = handleObjIn.handler;
+ selector = handleObjIn.selector;
+ }
+
+ // Make sure that the handler has a unique ID, used to find/remove it later
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
+
+ // Init the element's event structure and main handler, if this is the first
+ if ( !(events = elemData.events) ) {
+ events = elemData.events = {};
+ }
+ if ( !(eventHandle = elemData.handle) ) {
+ eventHandle = elemData.handle = function( e ) {
+ // Discard the second event of a jQuery.event.trigger() and
+ // when an event is called after a page has unloaded
+ return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
+ jQuery.event.dispatch.apply( elem, arguments ) : undefined;
+ };
+ }
+
+ // Handle multiple events separated by a space
+ types = ( types || "" ).match( rnotwhite ) || [ "" ];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // There *must* be a type, no attaching namespace-only handlers
+ if ( !type ) {
+ continue;
+ }
+
+ // If event changes its type, use the special event handlers for the changed type
+ special = jQuery.event.special[ type ] || {};
+
+ // If selector defined, determine special event api type, otherwise given type
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+
+ // Update special based on newly reset type
+ special = jQuery.event.special[ type ] || {};
+
+ // handleObj is passed to all event handlers
+ handleObj = jQuery.extend({
+ type: type,
+ origType: origType,
+ data: data,
+ handler: handler,
+ guid: handler.guid,
+ selector: selector,
+ needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
+ namespace: namespaces.join(".")
+ }, handleObjIn );
+
+ // Init the event handler queue if we're the first
+ if ( !(handlers = events[ type ]) ) {
+ handlers = events[ type ] = [];
+ handlers.delegateCount = 0;
+
+ // Only use addEventListener if the special events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ special.add.call( elem, handleObj );
+
+ if ( !handleObj.handler.guid ) {
+ handleObj.handler.guid = handler.guid;
+ }
+ }
+
+ // Add to the element's handler list, delegates in front
+ if ( selector ) {
+ handlers.splice( handlers.delegateCount++, 0, handleObj );
+ } else {
+ handlers.push( handleObj );
+ }
+
+ // Keep track of which events have ever been used, for event optimization
+ jQuery.event.global[ type ] = true;
+ }
+
+ },
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, selector, mappedTypes ) {
+
+ var j, origCount, tmp,
+ events, t, handleObj,
+ special, handlers, type, namespaces, origType,
+ elemData = data_priv.hasData( elem ) && data_priv.get( elem );
+
+ if ( !elemData || !(events = elemData.events) ) {
+ return;
+ }
+
+ // Once for each type.namespace in types; type may be omitted
+ types = ( types || "" ).match( rnotwhite ) || [ "" ];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // Unbind all events (on this namespace, if provided) for the element
+ if ( !type ) {
+ for ( type in events ) {
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
+ }
+ continue;
+ }
+
+ special = jQuery.event.special[ type ] || {};
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+ handlers = events[ type ] || [];
+ tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
+
+ // Remove matching events
+ origCount = j = handlers.length;
+ while ( j-- ) {
+ handleObj = handlers[ j ];
+
+ if ( ( mappedTypes || origType === handleObj.origType ) &&
+ ( !handler || handler.guid === handleObj.guid ) &&
+ ( !tmp || tmp.test( handleObj.namespace ) ) &&
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
+ handlers.splice( j, 1 );
+
+ if ( handleObj.selector ) {
+ handlers.delegateCount--;
+ }
+ if ( special.remove ) {
+ special.remove.call( elem, handleObj );
+ }
+ }
+ }
+
+ // Remove generic event handler if we removed something and no more handlers exist
+ // (avoids potential for endless recursion during removal of special event handlers)
+ if ( origCount && !handlers.length ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
+ jQuery.removeEvent( elem, type, elemData.handle );
+ }
+
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ delete elemData.handle;
+ data_priv.remove( elem, "events" );
+ }
+ },
+
+ trigger: function( event, data, elem, onlyHandlers ) {
+
+ var i, cur, tmp, bubbleType, ontype, handle, special,
+ eventPath = [ elem || document ],
+ type = hasOwn.call( event, "type" ) ? event.type : event,
+ namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
+
+ cur = tmp = elem = elem || document;
+
+ // Don't do events on text and comment nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
+ return;
+ }
+
+ if ( type.indexOf(".") >= 0 ) {
+ // Namespaced trigger; create a regexp to match event type in handle()
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ namespaces.sort();
+ }
+ ontype = type.indexOf(":") < 0 && "on" + type;
+
+ // Caller can pass in a jQuery.Event object, Object, or just an event type string
+ event = event[ jQuery.expando ] ?
+ event :
+ new jQuery.Event( type, typeof event === "object" && event );
+
+ // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
+ event.isTrigger = onlyHandlers ? 2 : 3;
+ event.namespace = namespaces.join(".");
+ event.namespace_re = event.namespace ?
+ new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
+ null;
+
+ // Clean up the event in case it is being reused
+ event.result = undefined;
+ if ( !event.target ) {
+ event.target = elem;
+ }
+
+ // Clone any incoming data and prepend the event, creating the handler arg list
+ data = data == null ?
+ [ event ] :
+ jQuery.makeArray( data, [ event ] );
+
+ // Allow special events to draw outside the lines
+ special = jQuery.event.special[ type ] || {};
+ if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
+ return;
+ }
+
+ // Determine event propagation path in advance, per W3C events spec (#9951)
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+ bubbleType = special.delegateType || type;
+ if ( !rfocusMorph.test( bubbleType + type ) ) {
+ cur = cur.parentNode;
+ }
+ for ( ; cur; cur = cur.parentNode ) {
+ eventPath.push( cur );
+ tmp = cur;
+ }
+
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
+ if ( tmp === (elem.ownerDocument || document) ) {
+ eventPath.push( tmp.defaultView || tmp.parentWindow || window );
+ }
+ }
+
+ // Fire handlers on the event path
+ i = 0;
+ while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
+
+ event.type = i > 1 ?
+ bubbleType :
+ special.bindType || type;
+
+ // jQuery handler
+ handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
+ if ( handle ) {
+ handle.apply( cur, data );
+ }
+
+ // Native handler
+ handle = ontype && cur[ ontype ];
+ if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
+ event.result = handle.apply( cur, data );
+ if ( event.result === false ) {
+ event.preventDefault();
+ }
+ }
+ }
+ event.type = type;
+
+ // If nobody prevented the default action, do it now
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
+
+ if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
+ jQuery.acceptData( elem ) ) {
+
+ // Call a native DOM method on the target with the same name name as the event.
+ // Don't do default actions on window, that's where global variables be (#6170)
+ if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
+
+ // Don't re-trigger an onFOO event when we call its FOO() method
+ tmp = elem[ ontype ];
+
+ if ( tmp ) {
+ elem[ ontype ] = null;
+ }
+
+ // Prevent re-triggering of the same event, since we already bubbled it above
+ jQuery.event.triggered = type;
+ elem[ type ]();
+ jQuery.event.triggered = undefined;
+
+ if ( tmp ) {
+ elem[ ontype ] = tmp;
+ }
+ }
+ }
+ }
+
+ return event.result;
+ },
+
+ dispatch: function( event ) {
+
+ // Make a writable jQuery.Event from the native event object
+ event = jQuery.event.fix( event );
+
+ var i, j, ret, matched, handleObj,
+ handlerQueue = [],
+ args = slice.call( arguments ),
+ handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
+ special = jQuery.event.special[ event.type ] || {};
+
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event
+ args[0] = event;
+ event.delegateTarget = this;
+
+ // Call the preDispatch hook for the mapped type, and let it bail if desired
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
+ return;
+ }
+
+ // Determine handlers
+ handlerQueue = jQuery.event.handlers.call( this, event, handlers );
+
+ // Run delegates first; they may want to stop propagation beneath us
+ i = 0;
+ while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
+ event.currentTarget = matched.elem;
+
+ j = 0;
+ while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
+
+ // Triggered event must either 1) have no namespace, or
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+ if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
+
+ event.handleObj = handleObj;
+ event.data = handleObj.data;
+
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+ .apply( matched.elem, args );
+
+ if ( ret !== undefined ) {
+ if ( (event.result = ret) === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+ }
+ }
+ }
+
+ // Call the postDispatch hook for the mapped type
+ if ( special.postDispatch ) {
+ special.postDispatch.call( this, event );
+ }
+
+ return event.result;
+ },
+
+ handlers: function( event, handlers ) {
+ var i, matches, sel, handleObj,
+ handlerQueue = [],
+ delegateCount = handlers.delegateCount,
+ cur = event.target;
+
+ // Find delegate handlers
+ // Black-hole SVG <use> instance trees (#13180)
+ // Avoid non-left-click bubbling in Firefox (#3861)
+ if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
+
+ for ( ; cur !== this; cur = cur.parentNode || this ) {
+
+ // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
+ if ( cur.disabled !== true || event.type !== "click" ) {
+ matches = [];
+ for ( i = 0; i < delegateCount; i++ ) {
+ handleObj = handlers[ i ];
+
+ // Don't conflict with Object.prototype properties (#13203)
+ sel = handleObj.selector + " ";
+
+ if ( matches[ sel ] === undefined ) {
+ matches[ sel ] = handleObj.needsContext ?
+ jQuery( sel, this ).index( cur ) >= 0 :
+ jQuery.find( sel, this, null, [ cur ] ).length;
+ }
+ if ( matches[ sel ] ) {
+ matches.push( handleObj );
+ }
+ }
+ if ( matches.length ) {
+ handlerQueue.push({ elem: cur, handlers: matches });
+ }
+ }
+ }
+ }
+
+ // Add the remaining (directly-bound) handlers
+ if ( delegateCount < handlers.length ) {
+ handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
+ }
+
+ return handlerQueue;
+ },
+
+ // Includes some event props shared by KeyEvent and MouseEvent
+ props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
+
+ fixHooks: {},
+
+ keyHooks: {
+ props: "char charCode key keyCode".split(" "),
+ filter: function( event, original ) {
+
+ // Add which for key events
+ if ( event.which == null ) {
+ event.which = original.charCode != null ? original.charCode : original.keyCode;
+ }
+
+ return event;
+ }
+ },
+
+ mouseHooks: {
+ props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
+ filter: function( event, original ) {
+ var eventDoc, doc, body,
+ button = original.button;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && original.clientX != null ) {
+ eventDoc = event.target.ownerDocument || document;
+ doc = eventDoc.documentElement;
+ body = eventDoc.body;
+
+ event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
+ event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
+ }
+
+ // Add which for click: 1 === left; 2 === middle; 3 === right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && button !== undefined ) {
+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
+ }
+
+ return event;
+ }
+ },
+
+ fix: function( event ) {
+ if ( event[ jQuery.expando ] ) {
+ return event;
+ }
+
+ // Create a writable copy of the event object and normalize some properties
+ var i, prop, copy,
+ type = event.type,
+ originalEvent = event,
+ fixHook = this.fixHooks[ type ];
+
+ if ( !fixHook ) {
+ this.fixHooks[ type ] = fixHook =
+ rmouseEvent.test( type ) ? this.mouseHooks :
+ rkeyEvent.test( type ) ? this.keyHooks :
+ {};
+ }
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
+
+ event = new jQuery.Event( originalEvent );
+
+ i = copy.length;
+ while ( i-- ) {
+ prop = copy[ i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Support: Cordova 2.5 (WebKit) (#13255)
+ // All events should have a target; Cordova deviceready doesn't
+ if ( !event.target ) {
+ event.target = document;
+ }
+
+ // Support: Safari 6.0+, Chrome < 28
+ // Target should not be a text node (#504, #13143)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
+
+ return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
+ },
+
+ special: {
+ load: {
+ // Prevent triggered image.load events from bubbling to window.load
+ noBubble: true
+ },
+ focus: {
+ // Fire native event if possible so blur/focus sequence is correct
+ trigger: function() {
+ if ( this !== safeActiveElement() && this.focus ) {
+ this.focus();
+ return false;
+ }
+ },
+ delegateType: "focusin"
+ },
+ blur: {
+ trigger: function() {
+ if ( this === safeActiveElement() && this.blur ) {
+ this.blur();
+ return false;
+ }
+ },
+ delegateType: "focusout"
+ },
+ click: {
+ // For checkbox, fire native event so checked state will be right
+ trigger: function() {
+ if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
+ this.click();
+ return false;
+ }
+ },
+
+ // For cross-browser consistency, don't fire native .click() on links
+ _default: function( event ) {
+ return jQuery.nodeName( event.target, "a" );
+ }
+ },
+
+ beforeunload: {
+ postDispatch: function( event ) {
+
+ // Support: Firefox 20+
+ // Firefox doesn't alert if the returnValue field is not set.
+ if ( event.result !== undefined && event.originalEvent ) {
+ event.originalEvent.returnValue = event.result;
+ }
+ }
+ }
+ },
+
+ simulate: function( type, elem, event, bubble ) {
+ // Piggyback on a donor event to simulate a different one.
+ // Fake originalEvent to avoid donor's stopPropagation, but if the
+ // simulated event prevents default then we do the same on the donor.
+ var e = jQuery.extend(
+ new jQuery.Event(),
+ event,
+ {
+ type: type,
+ isSimulated: true,
+ originalEvent: {}
+ }
+ );
+ if ( bubble ) {
+ jQuery.event.trigger( e, null, elem );
+ } else {
+ jQuery.event.dispatch.call( elem, e );
+ }
+ if ( e.isDefaultPrevented() ) {
+ event.preventDefault();
+ }
+ }
+};
+
+jQuery.removeEvent = function( elem, type, handle ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
+};
+
+jQuery.Event = function( src, props ) {
+ // Allow instantiation without the 'new' keyword
+ if ( !(this instanceof jQuery.Event) ) {
+ return new jQuery.Event( src, props );
+ }
+
+ // Event object
+ if ( src && src.type ) {
+ this.originalEvent = src;
+ this.type = src.type;
+
+ // Events bubbling up the document may have been marked as prevented
+ // by a handler lower down the tree; reflect the correct value.
+ this.isDefaultPrevented = src.defaultPrevented ||
+ src.defaultPrevented === undefined &&
+ // Support: Android < 4.0
+ src.returnValue === false ?
+ returnTrue :
+ returnFalse;
+
+ // Event type
+ } else {
+ this.type = src;
+ }
+
+ // Put explicitly provided properties onto the event object
+ if ( props ) {
+ jQuery.extend( this, props );
+ }
+
+ // Create a timestamp if incoming event doesn't have one
+ this.timeStamp = src && src.timeStamp || jQuery.now();
+
+ // Mark it as fixed
+ this[ jQuery.expando ] = true;
+};
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse,
+
+ preventDefault: function() {
+ var e = this.originalEvent;
+
+ this.isDefaultPrevented = returnTrue;
+
+ if ( e && e.preventDefault ) {
+ e.preventDefault();
+ }
+ },
+ stopPropagation: function() {
+ var e = this.originalEvent;
+
+ this.isPropagationStopped = returnTrue;
+
+ if ( e && e.stopPropagation ) {
+ e.stopPropagation();
+ }
+ },
+ stopImmediatePropagation: function() {
+ var e = this.originalEvent;
+
+ this.isImmediatePropagationStopped = returnTrue;
+
+ if ( e && e.stopImmediatePropagation ) {
+ e.stopImmediatePropagation();
+ }
+
+ this.stopPropagation();
+ }
+};
+
+// Create mouseenter/leave events using mouseover/out and event-time checks
+// Support: Chrome 15+
+jQuery.each({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout",
+ pointerenter: "pointerover",
+ pointerleave: "pointerout"
+}, function( orig, fix ) {
+ jQuery.event.special[ orig ] = {
+ delegateType: fix,
+ bindType: fix,
+
+ handle: function( event ) {
+ var ret,
+ target = this,
+ related = event.relatedTarget,
+ handleObj = event.handleObj;
+
+ // For mousenter/leave call the handler if related is outside the target.
+ // NB: No relatedTarget if the mouse left/entered the browser window
+ if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
+ event.type = handleObj.origType;
+ ret = handleObj.handler.apply( this, arguments );
+ event.type = fix;
+ }
+ return ret;
+ }
+ };
+});
+
+// Create "bubbling" focus and blur events
+// Support: Firefox, Chrome, Safari
+if ( !support.focusinBubbles ) {
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+
+ // Attach a single capturing handler on the document while someone wants focusin/focusout
+ var handler = function( event ) {
+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
+ };
+
+ jQuery.event.special[ fix ] = {
+ setup: function() {
+ var doc = this.ownerDocument || this,
+ attaches = data_priv.access( doc, fix );
+
+ if ( !attaches ) {
+ doc.addEventListener( orig, handler, true );
+ }
+ data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
+ },
+ teardown: function() {
+ var doc = this.ownerDocument || this,
+ attaches = data_priv.access( doc, fix ) - 1;
+
+ if ( !attaches ) {
+ doc.removeEventListener( orig, handler, true );
+ data_priv.remove( doc, fix );
+
+ } else {
+ data_priv.access( doc, fix, attaches );
+ }
+ }
+ };
+ });
+}
+
+jQuery.fn.extend({
+
+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
+ var origFn, type;
+
+ // Types can be a map of types/handlers
+ if ( typeof types === "object" ) {
+ // ( types-Object, selector, data )
+ if ( typeof selector !== "string" ) {
+ // ( types-Object, data )
+ data = data || selector;
+ selector = undefined;
+ }
+ for ( type in types ) {
+ this.on( type, selector, data, types[ type ], one );
+ }
+ return this;
+ }
+
+ if ( data == null && fn == null ) {
+ // ( types, fn )
+ fn = selector;
+ data = selector = undefined;
+ } else if ( fn == null ) {
+ if ( typeof selector === "string" ) {
+ // ( types, selector, fn )
+ fn = data;
+ data = undefined;
+ } else {
+ // ( types, data, fn )
+ fn = data;
+ data = selector;
+ selector = undefined;
+ }
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ } else if ( !fn ) {
+ return this;
+ }
+
+ if ( one === 1 ) {
+ origFn = fn;
+ fn = function( event ) {
+ // Can use an empty set, since event contains the info
+ jQuery().off( event );
+ return origFn.apply( this, arguments );
+ };
+ // Use same guid so caller can remove using origFn
+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
+ }
+ return this.each( function() {
+ jQuery.event.add( this, types, fn, data, selector );
+ });
+ },
+ one: function( types, selector, data, fn ) {
+ return this.on( types, selector, data, fn, 1 );
+ },
+ off: function( types, selector, fn ) {
+ var handleObj, type;
+ if ( types && types.preventDefault && types.handleObj ) {
+ // ( event ) dispatched jQuery.Event
+ handleObj = types.handleObj;
+ jQuery( types.delegateTarget ).off(
+ handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
+ handleObj.selector,
+ handleObj.handler
+ );
+ return this;
+ }
+ if ( typeof types === "object" ) {
+ // ( types-object [, selector] )
+ for ( type in types ) {
+ this.off( type, selector, types[ type ] );
+ }
+ return this;
+ }
+ if ( selector === false || typeof selector === "function" ) {
+ // ( types [, fn] )
+ fn = selector;
+ selector = undefined;
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ }
+ return this.each(function() {
+ jQuery.event.remove( this, types, fn, selector );
+ });
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+ triggerHandler: function( type, data ) {
+ var elem = this[0];
+ if ( elem ) {
+ return jQuery.event.trigger( type, data, elem, true );
+ }
+ }
+});
+
+
+var
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
+ rtagName = /<([\w:]+)/,
+ rhtml = /<|&#?\w+;/,
+ rnoInnerhtml = /<(?:script|style|link)/i,
+ // checked="checked" or checked
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+ rscriptType = /^$|\/(?:java|ecma)script/i,
+ rscriptTypeMasked = /^true\/(.*)/,
+ rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
+
+ // We have to close these tags to support XHTML (#13200)
+ wrapMap = {
+
+ // Support: IE 9
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
+
+ thead: [ 1, "<table>", "</table>" ],
+ col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+
+ _default: [ 0, "", "" ]
+ };
+
+// Support: IE 9
+wrapMap.optgroup = wrapMap.option;
+
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+// Support: 1.x compatibility
+// Manipulating tables requires a tbody
+function manipulationTarget( elem, content ) {
+ return jQuery.nodeName( elem, "table" ) &&
+ jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
+
+ elem.getElementsByTagName("tbody")[0] ||
+ elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
+ elem;
+}
+
+// Replace/restore the type attribute of script elements for safe DOM manipulation
+function disableScript( elem ) {
+ elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
+ return elem;
+}
+function restoreScript( elem ) {
+ var match = rscriptTypeMasked.exec( elem.type );
+
+ if ( match ) {
+ elem.type = match[ 1 ];
+ } else {
+ elem.removeAttribute("type");
+ }
+
+ return elem;
+}
+
+// Mark scripts as having already been evaluated
+function setGlobalEval( elems, refElements ) {
+ var i = 0,
+ l = elems.length;
+
+ for ( ; i < l; i++ ) {
+ data_priv.set(
+ elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
+ );
+ }
+}
+
+function cloneCopyEvent( src, dest ) {
+ var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
+
+ if ( dest.nodeType !== 1 ) {
+ return;
+ }
+
+ // 1. Copy private data: events, handlers, etc.
+ if ( data_priv.hasData( src ) ) {
+ pdataOld = data_priv.access( src );
+ pdataCur = data_priv.set( dest, pdataOld );
+ events = pdataOld.events;
+
+ if ( events ) {
+ delete pdataCur.handle;
+ pdataCur.events = {};
+
+ for ( type in events ) {
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {
+ jQuery.event.add( dest, type, events[ type ][ i ] );
+ }
+ }
+ }
+ }
+
+ // 2. Copy user data
+ if ( data_user.hasData( src ) ) {
+ udataOld = data_user.access( src );
+ udataCur = jQuery.extend( {}, udataOld );
+
+ data_user.set( dest, udataCur );
+ }
+}
+
+function getAll( context, tag ) {
+ var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
+ context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
+ [];
+
+ return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
+ jQuery.merge( [ context ], ret ) :
+ ret;
+}
+
+// Support: IE >= 9
+function fixInput( src, dest ) {
+ var nodeName = dest.nodeName.toLowerCase();
+
+ // Fails to persist the checked state of a cloned checkbox or radio button.
+ if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
+ dest.checked = src.checked;
+
+ // Fails to return the selected option to the default selected state when cloning options
+ } else if ( nodeName === "input" || nodeName === "textarea" ) {
+ dest.defaultValue = src.defaultValue;
+ }
+}
+
+jQuery.extend({
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) {
+ var i, l, srcElements, destElements,
+ clone = elem.cloneNode( true ),
+ inPage = jQuery.contains( elem.ownerDocument, elem );
+
+ // Support: IE >= 9
+ // Fix Cloning issues
+ if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
+ !jQuery.isXMLDoc( elem ) ) {
+
+ // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
+ destElements = getAll( clone );
+ srcElements = getAll( elem );
+
+ for ( i = 0, l = srcElements.length; i < l; i++ ) {
+ fixInput( srcElements[ i ], destElements[ i ] );
+ }
+ }
+
+ // Copy the events from the original to the clone
+ if ( dataAndEvents ) {
+ if ( deepDataAndEvents ) {
+ srcElements = srcElements || getAll( elem );
+ destElements = destElements || getAll( clone );
+
+ for ( i = 0, l = srcElements.length; i < l; i++ ) {
+ cloneCopyEvent( srcElements[ i ], destElements[ i ] );
+ }
+ } else {
+ cloneCopyEvent( elem, clone );
+ }
+ }
+
+ // Preserve script evaluation history
+ destElements = getAll( clone, "script" );
+ if ( destElements.length > 0 ) {
+ setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
+ }
+
+ // Return the cloned set
+ return clone;
+ },
+
+ buildFragment: function( elems, context, scripts, selection ) {
+ var elem, tmp, tag, wrap, contains, j,
+ fragment = context.createDocumentFragment(),
+ nodes = [],
+ i = 0,
+ l = elems.length;
+
+ for ( ; i < l; i++ ) {
+ elem = elems[ i ];
+
+ if ( elem || elem === 0 ) {
+
+ // Add nodes directly
+ if ( jQuery.type( elem ) === "object" ) {
+ // Support: QtWebKit
+ // jQuery.merge because push.apply(_, arraylike) throws
+ jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
+
+ // Convert non-html into a text node
+ } else if ( !rhtml.test( elem ) ) {
+ nodes.push( context.createTextNode( elem ) );
+
+ // Convert html into DOM nodes
+ } else {
+ tmp = tmp || fragment.appendChild( context.createElement("div") );
+
+ // Deserialize a standard representation
+ tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
+ wrap = wrapMap[ tag ] || wrapMap._default;
+ tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
+
+ // Descend through wrappers to the right content
+ j = wrap[ 0 ];
+ while ( j-- ) {
+ tmp = tmp.lastChild;
+ }
+
+ // Support: QtWebKit
+ // jQuery.merge because push.apply(_, arraylike) throws
+ jQuery.merge( nodes, tmp.childNodes );
+
+ // Remember the top-level container
+ tmp = fragment.firstChild;
+
+ // Fixes #12346
+ // Support: Webkit, IE
+ tmp.textContent = "";
+ }
+ }
+ }
+
+ // Remove wrapper from fragment
+ fragment.textContent = "";
+
+ i = 0;
+ while ( (elem = nodes[ i++ ]) ) {
+
+ // #4087 - If origin and destination elements are the same, and this is
+ // that element, do not do anything
+ if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
+ continue;
+ }
+
+ contains = jQuery.contains( elem.ownerDocument, elem );
+
+ // Append to fragment
+ tmp = getAll( fragment.appendChild( elem ), "script" );
+
+ // Preserve script evaluation history
+ if ( contains ) {
+ setGlobalEval( tmp );
+ }
+
+ // Capture executables
+ if ( scripts ) {
+ j = 0;
+ while ( (elem = tmp[ j++ ]) ) {
+ if ( rscriptType.test( elem.type || "" ) ) {
+ scripts.push( elem );
+ }
+ }
+ }
+ }
+
+ return fragment;
+ },
+
+ cleanData: function( elems ) {
+ var data, elem, type, key,
+ special = jQuery.event.special,
+ i = 0;
+
+ for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
+ if ( jQuery.acceptData( elem ) ) {
+ key = elem[ data_priv.expando ];
+
+ if ( key && (data = data_priv.cache[ key ]) ) {
+ if ( data.events ) {
+ for ( type in data.events ) {
+ if ( special[ type ] ) {
+ jQuery.event.remove( elem, type );
+
+ // This is a shortcut to avoid jQuery.event.remove's overhead
+ } else {
+ jQuery.removeEvent( elem, type, data.handle );
+ }
+ }
+ }
+ if ( data_priv.cache[ key ] ) {
+ // Discard any remaining `private` data
+ delete data_priv.cache[ key ];
+ }
+ }
+ }
+ // Discard any remaining `user` data
+ delete data_user.cache[ elem[ data_user.expando ] ];
+ }
+ }
+});
+
+jQuery.fn.extend({
+ text: function( value ) {
+ return access( this, function( value ) {
+ return value === undefined ?
+ jQuery.text( this ) :
+ this.empty().each(function() {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ this.textContent = value;
+ }
+ });
+ }, null, value, arguments.length );
+ },
+
+ append: function() {
+ return this.domManip( arguments, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ var target = manipulationTarget( this, elem );
+ target.appendChild( elem );
+ }
+ });
+ },
+
+ prepend: function() {
+ return this.domManip( arguments, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ var target = manipulationTarget( this, elem );
+ target.insertBefore( elem, target.firstChild );
+ }
+ });
+ },
+
+ before: function() {
+ return this.domManip( arguments, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this );
+ }
+ });
+ },
+
+ after: function() {
+ return this.domManip( arguments, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ }
+ });
+ },
+
+ remove: function( selector, keepData /* Internal Use Only */ ) {
+ var elem,
+ elems = selector ? jQuery.filter( selector, this ) : this,
+ i = 0;
+
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ if ( !keepData && elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem ) );
+ }
+
+ if ( elem.parentNode ) {
+ if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
+ setGlobalEval( getAll( elem, "script" ) );
+ }
+ elem.parentNode.removeChild( elem );
+ }
+ }
+
+ return this;
+ },
+
+ empty: function() {
+ var elem,
+ i = 0;
+
+ for ( ; (elem = this[i]) != null; i++ ) {
+ if ( elem.nodeType === 1 ) {
+
+ // Prevent memory leaks
+ jQuery.cleanData( getAll( elem, false ) );
+
+ // Remove any remaining nodes
+ elem.textContent = "";
+ }
+ }
+
+ return this;
+ },
+
+ clone: function( dataAndEvents, deepDataAndEvents ) {
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
+
+ return this.map(function() {
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
+ });
+ },
+
+ html: function( value ) {
+ return access( this, function( value ) {
+ var elem = this[ 0 ] || {},
+ i = 0,
+ l = this.length;
+
+ if ( value === undefined && elem.nodeType === 1 ) {
+ return elem.innerHTML;
+ }
+
+ // See if we can take a shortcut and just use innerHTML
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+ !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
+
+ value = value.replace( rxhtmlTag, "<$1></$2>" );
+
+ try {
+ for ( ; i < l; i++ ) {
+ elem = this[ i ] || {};
+
+ // Remove element nodes and prevent memory leaks
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem, false ) );
+ elem.innerHTML = value;
+ }
+ }
+
+ elem = 0;
+
+ // If using innerHTML throws an exception, use the fallback method
+ } catch( e ) {}
+ }
+
+ if ( elem ) {
+ this.empty().append( value );
+ }
+ }, null, value, arguments.length );
+ },
+
+ replaceWith: function() {
+ var arg = arguments[ 0 ];
+
+ // Make the changes, replacing each context element with the new content
+ this.domManip( arguments, function( elem ) {
+ arg = this.parentNode;
+
+ jQuery.cleanData( getAll( this ) );
+
+ if ( arg ) {
+ arg.replaceChild( elem, this );
+ }
+ });
+
+ // Force removal if there was no new content (e.g., from empty arguments)
+ return arg && (arg.length || arg.nodeType) ? this : this.remove();
+ },
+
+ detach: function( selector ) {
+ return this.remove( selector, true );
+ },
+
+ domManip: function( args, callback ) {
+
+ // Flatten any nested arrays
+ args = concat.apply( [], args );
+
+ var fragment, first, scripts, hasScripts, node, doc,
+ i = 0,
+ l = this.length,
+ set = this,
+ iNoClone = l - 1,
+ value = args[ 0 ],
+ isFunction = jQuery.isFunction( value );
+
+ // We can't cloneNode fragments that contain checked, in WebKit
+ if ( isFunction ||
+ ( l > 1 && typeof value === "string" &&
+ !support.checkClone && rchecked.test( value ) ) ) {
+ return this.each(function( index ) {
+ var self = set.eq( index );
+ if ( isFunction ) {
+ args[ 0 ] = value.call( this, index, self.html() );
+ }
+ self.domManip( args, callback );
+ });
+ }
+
+ if ( l ) {
+ fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
+ first = fragment.firstChild;
+
+ if ( fragment.childNodes.length === 1 ) {
+ fragment = first;
+ }
+
+ if ( first ) {
+ scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
+ hasScripts = scripts.length;
+
+ // Use the original fragment for the last item instead of the first because it can end up
+ // being emptied incorrectly in certain situations (#8070).
+ for ( ; i < l; i++ ) {
+ node = fragment;
+
+ if ( i !== iNoClone ) {
+ node = jQuery.clone( node, true, true );
+
+ // Keep references to cloned scripts for later restoration
+ if ( hasScripts ) {
+ // Support: QtWebKit
+ // jQuery.merge because push.apply(_, arraylike) throws
+ jQuery.merge( scripts, getAll( node, "script" ) );
+ }
+ }
+
+ callback.call( this[ i ], node, i );
+ }
+
+ if ( hasScripts ) {
+ doc = scripts[ scripts.length - 1 ].ownerDocument;
+
+ // Reenable scripts
+ jQuery.map( scripts, restoreScript );
+
+ // Evaluate executable scripts on first document insertion
+ for ( i = 0; i < hasScripts; i++ ) {
+ node = scripts[ i ];
+ if ( rscriptType.test( node.type || "" ) &&
+ !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
+
+ if ( node.src ) {
+ // Optional AJAX dependency, but won't run scripts if not present
+ if ( jQuery._evalUrl ) {
+ jQuery._evalUrl( node.src );
+ }
+ } else {
+ jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return this;
+ }
+});
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function( name, original ) {
+ jQuery.fn[ name ] = function( selector ) {
+ var elems,
+ ret = [],
+ insert = jQuery( selector ),
+ last = insert.length - 1,
+ i = 0;
+
+ for ( ; i <= last; i++ ) {
+ elems = i === last ? this : this.clone( true );
+ jQuery( insert[ i ] )[ original ]( elems );
+
+ // Support: QtWebKit
+ // .get() because push.apply(_, arraylike) throws
+ push.apply( ret, elems.get() );
+ }
+
+ return this.pushStack( ret );
+ };
+});
+
+
+var iframe,
+ elemdisplay = {};
+
+/**
+ * Retrieve the actual display of a element
+ * @param {String} name nodeName of the element
+ * @param {Object} doc Document object
+ */
+// Called only from within defaultDisplay
+function actualDisplay( name, doc ) {
+ var style,
+ elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
+
+ // getDefaultComputedStyle might be reliably used only on attached element
+ display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
+
+ // Use of this method is a temporary fix (more like optmization) until something better comes along,
+ // since it was removed from specification and supported only in FF
+ style.display : jQuery.css( elem[ 0 ], "display" );
+
+ // We don't have any data stored on the element,
+ // so use "detach" method as fast way to get rid of the element
+ elem.detach();
+
+ return display;
+}
+
+/**
+ * Try to determine the default display value of an element
+ * @param {String} nodeName
+ */
+function defaultDisplay( nodeName ) {
+ var doc = document,
+ display = elemdisplay[ nodeName ];
+
+ if ( !display ) {
+ display = actualDisplay( nodeName, doc );
+
+ // If the simple way fails, read from inside an iframe
+ if ( display === "none" || !display ) {
+
+ // Use the already-created iframe if possible
+ iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
+
+ // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
+ doc = iframe[ 0 ].contentDocument;
+
+ // Support: IE
+ doc.write();
+ doc.close();
+
+ display = actualDisplay( nodeName, doc );
+ iframe.detach();
+ }
+
+ // Store the correct default display
+ elemdisplay[ nodeName ] = display;
+ }
+
+ return display;
+}
+var rmargin = (/^margin/);
+
+var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
+
+var getStyles = function( elem ) {
+ return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
+ };
+
+
+
+function curCSS( elem, name, computed ) {
+ var width, minWidth, maxWidth, ret,
+ style = elem.style;
+
+ computed = computed || getStyles( elem );
+
+ // Support: IE9
+ // getPropertyValue is only needed for .css('filter') in IE9, see #12537
+ if ( computed ) {
+ ret = computed.getPropertyValue( name ) || computed[ name ];
+ }
+
+ if ( computed ) {
+
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
+ ret = jQuery.style( elem, name );
+ }
+
+ // Support: iOS < 6
+ // A tribute to the "awesome hack by Dean Edwards"
+ // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
+ // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
+ if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
+
+ // Remember the original values
+ width = style.width;
+ minWidth = style.minWidth;
+ maxWidth = style.maxWidth;
+
+ // Put in the new values to get a computed value out
+ style.minWidth = style.maxWidth = style.width = ret;
+ ret = computed.width;
+
+ // Revert the changed values
+ style.width = width;
+ style.minWidth = minWidth;
+ style.maxWidth = maxWidth;
+ }
+ }
+
+ return ret !== undefined ?
+ // Support: IE
+ // IE returns zIndex value as an integer.
+ ret + "" :
+ ret;
+}
+
+
+function addGetHookIf( conditionFn, hookFn ) {
+ // Define the hook, we'll check on the first run if it's really needed.
+ return {
+ get: function() {
+ if ( conditionFn() ) {
+ // Hook not needed (or it's not possible to use it due to missing dependency),
+ // remove it.
+ // Since there are no other hooks for marginRight, remove the whole object.
+ delete this.get;
+ return;
+ }
+
+ // Hook needed; redefine it so that the support test is not executed again.
+
+ return (this.get = hookFn).apply( this, arguments );
+ }
+ };
+}
+
+
+(function() {
+ var pixelPositionVal, boxSizingReliableVal,
+ docElem = document.documentElement,
+ container = document.createElement( "div" ),
+ div = document.createElement( "div" );
+
+ if ( !div.style ) {
+ return;
+ }
+
+ div.style.backgroundClip = "content-box";
+ div.cloneNode( true ).style.backgroundClip = "";
+ support.clearCloneStyle = div.style.backgroundClip === "content-box";
+
+ container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
+ "position:absolute";
+ container.appendChild( div );
+
+ // Executing both pixelPosition & boxSizingReliable tests require only one layout
+ // so they're executed at the same time to save the second computation.
+ function computePixelPositionAndBoxSizingReliable() {
+ div.style.cssText =
+ // Support: Firefox<29, Android 2.3
+ // Vendor-prefix box-sizing
+ "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
+ "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
+ "border:1px;padding:1px;width:4px;position:absolute";
+ div.innerHTML = "";
+ docElem.appendChild( container );
+
+ var divStyle = window.getComputedStyle( div, null );
+ pixelPositionVal = divStyle.top !== "1%";
+ boxSizingReliableVal = divStyle.width === "4px";
+
+ docElem.removeChild( container );
+ }
+
+ // Support: node.js jsdom
+ // Don't assume that getComputedStyle is a property of the global object
+ if ( window.getComputedStyle ) {
+ jQuery.extend( support, {
+ pixelPosition: function() {
+ // This test is executed only once but we still do memoizing
+ // since we can use the boxSizingReliable pre-computing.
+ // No need to check if the test was already performed, though.
+ computePixelPositionAndBoxSizingReliable();
+ return pixelPositionVal;
+ },
+ boxSizingReliable: function() {
+ if ( boxSizingReliableVal == null ) {
+ computePixelPositionAndBoxSizingReliable();
+ }
+ return boxSizingReliableVal;
+ },
+ reliableMarginRight: function() {
+ // Support: Android 2.3
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. (#3333)
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ // This support function is only executed once so no memoizing is needed.
+ var ret,
+ marginDiv = div.appendChild( document.createElement( "div" ) );
+
+ // Reset CSS: box-sizing; display; margin; border; padding
+ marginDiv.style.cssText = div.style.cssText =
+ // Support: Firefox<29, Android 2.3
+ // Vendor-prefix box-sizing
+ "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
+ "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
+ marginDiv.style.marginRight = marginDiv.style.width = "0";
+ div.style.width = "1px";
+ docElem.appendChild( container );
+
+ ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
+
+ docElem.removeChild( container );
+
+ return ret;
+ }
+ });
+ }
+})();
+
+
+// A method for quickly swapping in/out CSS properties to get correct calculations.
+jQuery.swap = function( elem, options, callback, args ) {
+ var ret, name,
+ old = {};
+
+ // Remember the old values, and insert the new ones
+ for ( name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ ret = callback.apply( elem, args || [] );
+
+ // Revert the old values
+ for ( name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
+
+ return ret;
+};
+
+
+var
+ // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
+ // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
+ rdisplayswap = /^(none|table(?!-c[ea]).+)/,
+ rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
+ rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
+
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
+ cssNormalTransform = {
+ letterSpacing: "0",
+ fontWeight: "400"
+ },
+
+ cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
+
+// return a css property mapped to a potentially vendor prefixed property
+function vendorPropName( style, name ) {
+
+ // shortcut for names that are not vendor prefixed
+ if ( name in style ) {
+ return name;
+ }
+
+ // check for vendor prefixed names
+ var capName = name[0].toUpperCase() + name.slice(1),
+ origName = name,
+ i = cssPrefixes.length;
+
+ while ( i-- ) {
+ name = cssPrefixes[ i ] + capName;
+ if ( name in style ) {
+ return name;
+ }
+ }
+
+ return origName;
+}
+
+function setPositiveNumber( elem, value, subtract ) {
+ var matches = rnumsplit.exec( value );
+ return matches ?
+ // Guard against undefined "subtract", e.g., when used as in cssHooks
+ Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
+ value;
+}
+
+function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
+ var i = extra === ( isBorderBox ? "border" : "content" ) ?
+ // If we already have the right measurement, avoid augmentation
+ 4 :
+ // Otherwise initialize for horizontal or vertical properties
+ name === "width" ? 1 : 0,
+
+ val = 0;
+
+ for ( ; i < 4; i += 2 ) {
+ // both box models exclude margin, so add it if we want it
+ if ( extra === "margin" ) {
+ val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
+ }
+
+ if ( isBorderBox ) {
+ // border-box includes padding, so remove it if we want content
+ if ( extra === "content" ) {
+ val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+ }
+
+ // at this point, extra isn't border nor margin, so remove border
+ if ( extra !== "margin" ) {
+ val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ } else {
+ // at this point, extra isn't content, so add padding
+ val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+
+ // at this point, extra isn't content nor padding, so add border
+ if ( extra !== "padding" ) {
+ val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ }
+ }
+
+ return val;
+}
+
+function getWidthOrHeight( elem, name, extra ) {
+
+ // Start with offset property, which is equivalent to the border-box value
+ var valueIsBorderBox = true,
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
+ styles = getStyles( elem ),
+ isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
+
+ // some non-html elements return undefined for offsetWidth, so check for null/undefined
+ // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
+ // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
+ if ( val <= 0 || val == null ) {
+ // Fall back to computed then uncomputed css if necessary
+ val = curCSS( elem, name, styles );
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ];
+ }
+
+ // Computed unit is not pixels. Stop here and return.
+ if ( rnumnonpx.test(val) ) {
+ return val;
+ }
+
+ // we need the check for style in case a browser which returns unreliable values
+ // for getComputedStyle silently falls back to the reliable elem.style
+ valueIsBorderBox = isBorderBox &&
+ ( support.boxSizingReliable() || val === elem.style[ name ] );
+
+ // Normalize "", auto, and prepare for extra
+ val = parseFloat( val ) || 0;
+ }
+
+ // use the active box-sizing model to add/subtract irrelevant styles
+ return ( val +
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra || ( isBorderBox ? "border" : "content" ),
+ valueIsBorderBox,
+ styles
+ )
+ ) + "px";
+}
+
+function showHide( elements, show ) {
+ var display, elem, hidden,
+ values = [],
+ index = 0,
+ length = elements.length;
+
+ for ( ; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+
+ values[ index ] = data_priv.get( elem, "olddisplay" );
+ display = elem.style.display;
+ if ( show ) {
+ // Reset the inline display of this element to learn if it is
+ // being hidden by cascaded rules or not
+ if ( !values[ index ] && display === "none" ) {
+ elem.style.display = "";
+ }
+
+ // Set elements which have been overridden with display: none
+ // in a stylesheet to whatever the default browser style is
+ // for such an element
+ if ( elem.style.display === "" && isHidden( elem ) ) {
+ values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
+ }
+ } else {
+ hidden = isHidden( elem );
+
+ if ( display !== "none" || !hidden ) {
+ data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
+ }
+ }
+ }
+
+ // Set the display of most of the elements in a second loop
+ // to avoid the constant reflow
+ for ( index = 0; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+ if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
+ elem.style.display = show ? values[ index ] || "" : "none";
+ }
+ }
+
+ return elements;
+}
+
+jQuery.extend({
+ // Add in style property hooks for overriding the default
+ // behavior of getting and setting a style property
+ cssHooks: {
+ opacity: {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // We should always get a number back from opacity
+ var ret = curCSS( elem, "opacity" );
+ return ret === "" ? "1" : ret;
+ }
+ }
+ }
+ },
+
+ // Don't automatically add "px" to these possibly-unitless properties
+ cssNumber: {
+ "columnCount": true,
+ "fillOpacity": true,
+ "flexGrow": true,
+ "flexShrink": true,
+ "fontWeight": true,
+ "lineHeight": true,
+ "opacity": true,
+ "order": true,
+ "orphans": true,
+ "widows": true,
+ "zIndex": true,
+ "zoom": true
+ },
+
+ // Add in properties whose names you wish to fix before
+ // setting or getting the value
+ cssProps: {
+ // normalize float css property
+ "float": "cssFloat"
+ },
+
+ // Get and set the style property on a DOM Node
+ style: function( elem, name, value, extra ) {
+ // Don't set styles on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
+ return;
+ }
+
+ // Make sure that we're working with the right name
+ var ret, type, hooks,
+ origName = jQuery.camelCase( name ),
+ style = elem.style;
+
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+ // Check if we're setting a value
+ if ( value !== undefined ) {
+ type = typeof value;
+
+ // convert relative number strings (+= or -=) to relative numbers. #7345
+ if ( type === "string" && (ret = rrelNum.exec( value )) ) {
+ value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
+ // Fixes bug #9237
+ type = "number";
+ }
+
+ // Make sure that null and NaN values aren't set. See: #7116
+ if ( value == null || value !== value ) {
+ return;
+ }
+
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
+ if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
+ value += "px";
+ }
+
+ // Fixes #8908, it can be done more correctly by specifying setters in cssHooks,
+ // but it would mean to define eight (for every problematic property) identical functions
+ if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
+ style[ name ] = "inherit";
+ }
+
+ // If a hook was provided, use that value, otherwise just set the specified value
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
+ style[ name ] = value;
+ }
+
+ } else {
+ // If a hook was provided get the non-computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+ return ret;
+ }
+
+ // Otherwise just get the value from the style object
+ return style[ name ];
+ }
+ },
+
+ css: function( elem, name, extra, styles ) {
+ var val, num, hooks,
+ origName = jQuery.camelCase( name );
+
+ // Make sure that we're working with the right name
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+ // If a hook was provided get the computed value from there
+ if ( hooks && "get" in hooks ) {
+ val = hooks.get( elem, true, extra );
+ }
+
+ // Otherwise, if a way to get the computed value exists, use that
+ if ( val === undefined ) {
+ val = curCSS( elem, name, styles );
+ }
+
+ //convert "normal" to computed value
+ if ( val === "normal" && name in cssNormalTransform ) {
+ val = cssNormalTransform[ name ];
+ }
+
+ // Return, converting to number if forced or a qualifier was provided and val looks numeric
+ if ( extra === "" || extra ) {
+ num = parseFloat( val );
+ return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
+ }
+ return val;
+ }
+});
+
+jQuery.each([ "height", "width" ], function( i, name ) {
+ jQuery.cssHooks[ name ] = {
+ get: function( elem, computed, extra ) {
+ if ( computed ) {
+ // certain elements can have dimension info if we invisibly show them
+ // however, it must have a current display style that would benefit from this
+ return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
+ jQuery.swap( elem, cssShow, function() {
+ return getWidthOrHeight( elem, name, extra );
+ }) :
+ getWidthOrHeight( elem, name, extra );
+ }
+ },
+
+ set: function( elem, value, extra ) {
+ var styles = extra && getStyles( elem );
+ return setPositiveNumber( elem, value, extra ?
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra,
+ jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
+ styles
+ ) : 0
+ );
+ }
+ };
+});
+
+// Support: Android 2.3
+jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
+ function( elem, computed ) {
+ if ( computed ) {
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ // Work around by temporarily setting element display to inline-block
+ return jQuery.swap( elem, { "display": "inline-block" },
+ curCSS, [ elem, "marginRight" ] );
+ }
+ }
+);
+
+// These hooks are used by animate to expand properties
+jQuery.each({
+ margin: "",
+ padding: "",
+ border: "Width"
+}, function( prefix, suffix ) {
+ jQuery.cssHooks[ prefix + suffix ] = {
+ expand: function( value ) {
+ var i = 0,
+ expanded = {},
+
+ // assumes a single number if not a string
+ parts = typeof value === "string" ? value.split(" ") : [ value ];
+
+ for ( ; i < 4; i++ ) {
+ expanded[ prefix + cssExpand[ i ] + suffix ] =
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
+ }
+
+ return expanded;
+ }
+ };
+
+ if ( !rmargin.test( prefix ) ) {
+ jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
+ }
+});
+
+jQuery.fn.extend({
+ css: function( name, value ) {
+ return access( this, function( elem, name, value ) {
+ var styles, len,
+ map = {},
+ i = 0;
+
+ if ( jQuery.isArray( name ) ) {
+ styles = getStyles( elem );
+ len = name.length;
+
+ for ( ; i < len; i++ ) {
+ map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
+ }
+
+ return map;
+ }
+
+ return value !== undefined ?
+ jQuery.style( elem, name, value ) :
+ jQuery.css( elem, name );
+ }, name, value, arguments.length > 1 );
+ },
+ show: function() {
+ return showHide( this, true );
+ },
+ hide: function() {
+ return showHide( this );
+ },
+ toggle: function( state ) {
+ if ( typeof state === "boolean" ) {
+ return state ? this.show() : this.hide();
+ }
+
+ return this.each(function() {
+ if ( isHidden( this ) ) {
+ jQuery( this ).show();
+ } else {
+ jQuery( this ).hide();
+ }
+ });
+ }
+});
+
+
+function Tween( elem, options, prop, end, easing ) {
+ return new Tween.prototype.init( elem, options, prop, end, easing );
+}
+jQuery.Tween = Tween;
+
+Tween.prototype = {
+ constructor: Tween,
+ init: function( elem, options, prop, end, easing, unit ) {
+ this.elem = elem;
+ this.prop = prop;
+ this.easing = easing || "swing";
+ this.options = options;
+ this.start = this.now = this.cur();
+ this.end = end;
+ this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+ },
+ cur: function() {
+ var hooks = Tween.propHooks[ this.prop ];
+
+ return hooks && hooks.get ?
+ hooks.get( this ) :
+ Tween.propHooks._default.get( this );
+ },
+ run: function( percent ) {
+ var eased,
+ hooks = Tween.propHooks[ this.prop ];
+
+ if ( this.options.duration ) {
+ this.pos = eased = jQuery.easing[ this.easing ](
+ percent, this.options.duration * percent, 0, 1, this.options.duration
+ );
+ } else {
+ this.pos = eased = percent;
+ }
+ this.now = ( this.end - this.start ) * eased + this.start;
+
+ if ( this.options.step ) {
+ this.options.step.call( this.elem, this.now, this );
+ }
+
+ if ( hooks && hooks.set ) {
+ hooks.set( this );
+ } else {
+ Tween.propHooks._default.set( this );
+ }
+ return this;
+ }
+};
+
+Tween.prototype.init.prototype = Tween.prototype;
+
+Tween.propHooks = {
+ _default: {
+ get: function( tween ) {
+ var result;
+
+ if ( tween.elem[ tween.prop ] != null &&
+ (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
+ return tween.elem[ tween.prop ];
+ }
+
+ // passing an empty string as a 3rd parameter to .css will automatically
+ // attempt a parseFloat and fallback to a string if the parse fails
+ // so, simple values such as "10px" are parsed to Float.
+ // complex values such as "rotate(1rad)" are returned as is.
+ result = jQuery.css( tween.elem, tween.prop, "" );
+ // Empty strings, null, undefined and "auto" are converted to 0.
+ return !result || result === "auto" ? 0 : result;
+ },
+ set: function( tween ) {
+ // use step hook for back compat - use cssHook if its there - use .style if its
+ // available and use plain properties where available
+ if ( jQuery.fx.step[ tween.prop ] ) {
+ jQuery.fx.step[ tween.prop ]( tween );
+ } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
+ jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
+ } else {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+ }
+};
+
+// Support: IE9
+// Panic based approach to setting things on disconnected nodes
+
+Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
+ set: function( tween ) {
+ if ( tween.elem.nodeType && tween.elem.parentNode ) {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+};
+
+jQuery.easing = {
+ linear: function( p ) {
+ return p;
+ },
+ swing: function( p ) {
+ return 0.5 - Math.cos( p * Math.PI ) / 2;
+ }
+};
+
+jQuery.fx = Tween.prototype.init;
+
+// Back Compat <1.8 extension point
+jQuery.fx.step = {};
+
+
+
+
+var
+ fxNow, timerId,
+ rfxtypes = /^(?:toggle|show|hide)$/,
+ rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
+ rrun = /queueHooks$/,
+ animationPrefilters = [ defaultPrefilter ],
+ tweeners = {
+ "*": [ function( prop, value ) {
+ var tween = this.createTween( prop, value ),
+ target = tween.cur(),
+ parts = rfxnum.exec( value ),
+ unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
+
+ // Starting value computation is required for potential unit mismatches
+ start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
+ rfxnum.exec( jQuery.css( tween.elem, prop ) ),
+ scale = 1,
+ maxIterations = 20;
+
+ if ( start && start[ 3 ] !== unit ) {
+ // Trust units reported by jQuery.css
+ unit = unit || start[ 3 ];
+
+ // Make sure we update the tween properties later on
+ parts = parts || [];
+
+ // Iteratively approximate from a nonzero starting point
+ start = +target || 1;
+
+ do {
+ // If previous iteration zeroed out, double until we get *something*
+ // Use a string for doubling factor so we don't accidentally see scale as unchanged below
+ scale = scale || ".5";
+
+ // Adjust and apply
+ start = start / scale;
+ jQuery.style( tween.elem, prop, start + unit );
+
+ // Update scale, tolerating zero or NaN from tween.cur()
+ // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
+ } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
+ }
+
+ // Update tween properties
+ if ( parts ) {
+ start = tween.start = +start || +target || 0;
+ tween.unit = unit;
+ // If a +=/-= token was provided, we're doing a relative animation
+ tween.end = parts[ 1 ] ?
+ start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
+ +parts[ 2 ];
+ }
+
+ return tween;
+ } ]
+ };
+
+// Animations created synchronously will run synchronously
+function createFxNow() {
+ setTimeout(function() {
+ fxNow = undefined;
+ });
+ return ( fxNow = jQuery.now() );
+}
+
+// Generate parameters to create a standard animation
+function genFx( type, includeWidth ) {
+ var which,
+ i = 0,
+ attrs = { height: type };
+
+ // if we include width, step value is 1 to do all cssExpand values,
+ // if we don't include width, step value is 2 to skip over Left and Right
+ includeWidth = includeWidth ? 1 : 0;
+ for ( ; i < 4 ; i += 2 - includeWidth ) {
+ which = cssExpand[ i ];
+ attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
+ }
+
+ if ( includeWidth ) {
+ attrs.opacity = attrs.width = type;
+ }
+
+ return attrs;
+}
+
+function createTween( value, prop, animation ) {
+ var tween,
+ collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
+ index = 0,
+ length = collection.length;
+ for ( ; index < length; index++ ) {
+ if ( (tween = collection[ index ].call( animation, prop, value )) ) {
+
+ // we're done with this property
+ return tween;
+ }
+ }
+}
+
+function defaultPrefilter( elem, props, opts ) {
+ /* jshint validthis: true */
+ var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
+ anim = this,
+ orig = {},
+ style = elem.style,
+ hidden = elem.nodeType && isHidden( elem ),
+ dataShow = data_priv.get( elem, "fxshow" );
+
+ // handle queue: false promises
+ if ( !opts.queue ) {
+ hooks = jQuery._queueHooks( elem, "fx" );
+ if ( hooks.unqueued == null ) {
+ hooks.unqueued = 0;
+ oldfire = hooks.empty.fire;
+ hooks.empty.fire = function() {
+ if ( !hooks.unqueued ) {
+ oldfire();
+ }
+ };
+ }
+ hooks.unqueued++;
+
+ anim.always(function() {
+ // doing this makes sure that the complete handler will be called
+ // before this completes
+ anim.always(function() {
+ hooks.unqueued--;
+ if ( !jQuery.queue( elem, "fx" ).length ) {
+ hooks.empty.fire();
+ }
+ });
+ });
+ }
+
+ // height/width overflow pass
+ if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
+ // Make sure that nothing sneaks out
+ // Record all 3 overflow attributes because IE9-10 do not
+ // change the overflow attribute when overflowX and
+ // overflowY are set to the same value
+ opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
+
+ // Set display property to inline-block for height/width
+ // animations on inline elements that are having width/height animated
+ display = jQuery.css( elem, "display" );
+
+ // Test default display if display is currently "none"
+ checkDisplay = display === "none" ?
+ data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
+
+ if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
+ style.display = "inline-block";
+ }
+ }
+
+ if ( opts.overflow ) {
+ style.overflow = "hidden";
+ anim.always(function() {
+ style.overflow = opts.overflow[ 0 ];
+ style.overflowX = opts.overflow[ 1 ];
+ style.overflowY = opts.overflow[ 2 ];
+ });
+ }
+
+ // show/hide pass
+ for ( prop in props ) {
+ value = props[ prop ];
+ if ( rfxtypes.exec( value ) ) {
+ delete props[ prop ];
+ toggle = toggle || value === "toggle";
+ if ( value === ( hidden ? "hide" : "show" ) ) {
+
+ // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
+ if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
+ hidden = true;
+ } else {
+ continue;
+ }
+ }
+ orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
+
+ // Any non-fx value stops us from restoring the original display value
+ } else {
+ display = undefined;
+ }
+ }
+
+ if ( !jQuery.isEmptyObject( orig ) ) {
+ if ( dataShow ) {
+ if ( "hidden" in dataShow ) {
+ hidden = dataShow.hidden;
+ }
+ } else {
+ dataShow = data_priv.access( elem, "fxshow", {} );
+ }
+
+ // store state if its toggle - enables .stop().toggle() to "reverse"
+ if ( toggle ) {
+ dataShow.hidden = !hidden;
+ }
+ if ( hidden ) {
+ jQuery( elem ).show();
+ } else {
+ anim.done(function() {
+ jQuery( elem ).hide();
+ });
+ }
+ anim.done(function() {
+ var prop;
+
+ data_priv.remove( elem, "fxshow" );
+ for ( prop in orig ) {
+ jQuery.style( elem, prop, orig[ prop ] );
+ }
+ });
+ for ( prop in orig ) {
+ tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
+
+ if ( !( prop in dataShow ) ) {
+ dataShow[ prop ] = tween.start;
+ if ( hidden ) {
+ tween.end = tween.start;
+ tween.start = prop === "width" || prop === "height" ? 1 : 0;
+ }
+ }
+ }
+
+ // If this is a noop like .hide().hide(), restore an overwritten display value
+ } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
+ style.display = display;
+ }
+}
+
+function propFilter( props, specialEasing ) {
+ var index, name, easing, value, hooks;
+
+ // camelCase, specialEasing and expand cssHook pass
+ for ( index in props ) {
+ name = jQuery.camelCase( index );
+ easing = specialEasing[ name ];
+ value = props[ index ];
+ if ( jQuery.isArray( value ) ) {
+ easing = value[ 1 ];
+ value = props[ index ] = value[ 0 ];
+ }
+
+ if ( index !== name ) {
+ props[ name ] = value;
+ delete props[ index ];
+ }
+
+ hooks = jQuery.cssHooks[ name ];
+ if ( hooks && "expand" in hooks ) {
+ value = hooks.expand( value );
+ delete props[ name ];
+
+ // not quite $.extend, this wont overwrite keys already present.
+ // also - reusing 'index' from above because we have the correct "name"
+ for ( index in value ) {
+ if ( !( index in props ) ) {
+ props[ index ] = value[ index ];
+ specialEasing[ index ] = easing;
+ }
+ }
+ } else {
+ specialEasing[ name ] = easing;
+ }
+ }
+}
+
+function Animation( elem, properties, options ) {
+ var result,
+ stopped,
+ index = 0,
+ length = animationPrefilters.length,
+ deferred = jQuery.Deferred().always( function() {
+ // don't match elem in the :animated selector
+ delete tick.elem;
+ }),
+ tick = function() {
+ if ( stopped ) {
+ return false;
+ }
+ var currentTime = fxNow || createFxNow(),
+ remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
+ // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
+ temp = remaining / animation.duration || 0,
+ percent = 1 - temp,
+ index = 0,
+ length = animation.tweens.length;
+
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( percent );
+ }
+
+ deferred.notifyWith( elem, [ animation, percent, remaining ]);
+
+ if ( percent < 1 && length ) {
+ return remaining;
+ } else {
+ deferred.resolveWith( elem, [ animation ] );
+ return false;
+ }
+ },
+ animation = deferred.promise({
+ elem: elem,
+ props: jQuery.extend( {}, properties ),
+ opts: jQuery.extend( true, { specialEasing: {} }, options ),
+ originalProperties: properties,
+ originalOptions: options,
+ startTime: fxNow || createFxNow(),
+ duration: options.duration,
+ tweens: [],
+ createTween: function( prop, end ) {
+ var tween = jQuery.Tween( elem, animation.opts, prop, end,
+ animation.opts.specialEasing[ prop ] || animation.opts.easing );
+ animation.tweens.push( tween );
+ return tween;
+ },
+ stop: function( gotoEnd ) {
+ var index = 0,
+ // if we are going to the end, we want to run all the tweens
+ // otherwise we skip this part
+ length = gotoEnd ? animation.tweens.length : 0;
+ if ( stopped ) {
+ return this;
+ }
+ stopped = true;
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( 1 );
+ }
+
+ // resolve when we played the last frame
+ // otherwise, reject
+ if ( gotoEnd ) {
+ deferred.resolveWith( elem, [ animation, gotoEnd ] );
+ } else {
+ deferred.rejectWith( elem, [ animation, gotoEnd ] );
+ }
+ return this;
+ }
+ }),
+ props = animation.props;
+
+ propFilter( props, animation.opts.specialEasing );
+
+ for ( ; index < length ; index++ ) {
+ result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
+ if ( result ) {
+ return result;
+ }
+ }
+
+ jQuery.map( props, createTween, animation );
+
+ if ( jQuery.isFunction( animation.opts.start ) ) {
+ animation.opts.start.call( elem, animation );
+ }
+
+ jQuery.fx.timer(
+ jQuery.extend( tick, {
+ elem: elem,
+ anim: animation,
+ queue: animation.opts.queue
+ })
+ );
+
+ // attach callbacks from options
+ return animation.progress( animation.opts.progress )
+ .done( animation.opts.done, animation.opts.complete )
+ .fail( animation.opts.fail )
+ .always( animation.opts.always );
+}
+
+jQuery.Animation = jQuery.extend( Animation, {
+
+ tweener: function( props, callback ) {
+ if ( jQuery.isFunction( props ) ) {
+ callback = props;
+ props = [ "*" ];
+ } else {
+ props = props.split(" ");
+ }
+
+ var prop,
+ index = 0,
+ length = props.length;
+
+ for ( ; index < length ; index++ ) {
+ prop = props[ index ];
+ tweeners[ prop ] = tweeners[ prop ] || [];
+ tweeners[ prop ].unshift( callback );
+ }
+ },
+
+ prefilter: function( callback, prepend ) {
+ if ( prepend ) {
+ animationPrefilters.unshift( callback );
+ } else {
+ animationPrefilters.push( callback );
+ }
+ }
+});
+
+jQuery.speed = function( speed, easing, fn ) {
+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
+ };
+
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
+
+ // normalize opt.queue - true/undefined/null -> "fx"
+ if ( opt.queue == null || opt.queue === true ) {
+ opt.queue = "fx";
+ }
+
+ // Queueing
+ opt.old = opt.complete;
+
+ opt.complete = function() {
+ if ( jQuery.isFunction( opt.old ) ) {
+ opt.old.call( this );
+ }
+
+ if ( opt.queue ) {
+ jQuery.dequeue( this, opt.queue );
+ }
+ };
+
+ return opt;
+};
+
+jQuery.fn.extend({
+ fadeTo: function( speed, to, easing, callback ) {
+
+ // show any hidden elements after setting opacity to 0
+ return this.filter( isHidden ).css( "opacity", 0 ).show()
+
+ // animate to the value specified
+ .end().animate({ opacity: to }, speed, easing, callback );
+ },
+ animate: function( prop, speed, easing, callback ) {
+ var empty = jQuery.isEmptyObject( prop ),
+ optall = jQuery.speed( speed, easing, callback ),
+ doAnimation = function() {
+ // Operate on a copy of prop so per-property easing won't be lost
+ var anim = Animation( this, jQuery.extend( {}, prop ), optall );
+
+ // Empty animations, or finishing resolves immediately
+ if ( empty || data_priv.get( this, "finish" ) ) {
+ anim.stop( true );
+ }
+ };
+ doAnimation.finish = doAnimation;
+
+ return empty || optall.queue === false ?
+ this.each( doAnimation ) :
+ this.queue( optall.queue, doAnimation );
+ },
+ stop: function( type, clearQueue, gotoEnd ) {
+ var stopQueue = function( hooks ) {
+ var stop = hooks.stop;
+ delete hooks.stop;
+ stop( gotoEnd );
+ };
+
+ if ( typeof type !== "string" ) {
+ gotoEnd = clearQueue;
+ clearQueue = type;
+ type = undefined;
+ }
+ if ( clearQueue && type !== false ) {
+ this.queue( type || "fx", [] );
+ }
+
+ return this.each(function() {
+ var dequeue = true,
+ index = type != null && type + "queueHooks",
+ timers = jQuery.timers,
+ data = data_priv.get( this );
+
+ if ( index ) {
+ if ( data[ index ] && data[ index ].stop ) {
+ stopQueue( data[ index ] );
+ }
+ } else {
+ for ( index in data ) {
+ if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
+ stopQueue( data[ index ] );
+ }
+ }
+ }
+
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
+ timers[ index ].anim.stop( gotoEnd );
+ dequeue = false;
+ timers.splice( index, 1 );
+ }
+ }
+
+ // start the next in the queue if the last step wasn't forced
+ // timers currently will call their complete callbacks, which will dequeue
+ // but only if they were gotoEnd
+ if ( dequeue || !gotoEnd ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ finish: function( type ) {
+ if ( type !== false ) {
+ type = type || "fx";
+ }
+ return this.each(function() {
+ var index,
+ data = data_priv.get( this ),
+ queue = data[ type + "queue" ],
+ hooks = data[ type + "queueHooks" ],
+ timers = jQuery.timers,
+ length = queue ? queue.length : 0;
+
+ // enable finishing flag on private data
+ data.finish = true;
+
+ // empty the queue first
+ jQuery.queue( this, type, [] );
+
+ if ( hooks && hooks.stop ) {
+ hooks.stop.call( this, true );
+ }
+
+ // look for any active animations, and finish them
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
+ timers[ index ].anim.stop( true );
+ timers.splice( index, 1 );
+ }
+ }
+
+ // look for any animations in the old queue and finish them
+ for ( index = 0; index < length; index++ ) {
+ if ( queue[ index ] && queue[ index ].finish ) {
+ queue[ index ].finish.call( this );
+ }
+ }
+
+ // turn off finishing flag
+ delete data.finish;
+ });
+ }
+});
+
+jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
+ var cssFn = jQuery.fn[ name ];
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return speed == null || typeof speed === "boolean" ?
+ cssFn.apply( this, arguments ) :
+ this.animate( genFx( name, true ), speed, easing, callback );
+ };
+});
+
+// Generate shortcuts for custom animations
+jQuery.each({
+ slideDown: genFx("show"),
+ slideUp: genFx("hide"),
+ slideToggle: genFx("toggle"),
+ fadeIn: { opacity: "show" },
+ fadeOut: { opacity: "hide" },
+ fadeToggle: { opacity: "toggle" }
+}, function( name, props ) {
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return this.animate( props, speed, easing, callback );
+ };
+});
+
+jQuery.timers = [];
+jQuery.fx.tick = function() {
+ var timer,
+ i = 0,
+ timers = jQuery.timers;
+
+ fxNow = jQuery.now();
+
+ for ( ; i < timers.length; i++ ) {
+ timer = timers[ i ];
+ // Checks the timer has not already been removed
+ if ( !timer() && timers[ i ] === timer ) {
+ timers.splice( i--, 1 );
+ }
+ }
+
+ if ( !timers.length ) {
+ jQuery.fx.stop();
+ }
+ fxNow = undefined;
+};
+
+jQuery.fx.timer = function( timer ) {
+ jQuery.timers.push( timer );
+ if ( timer() ) {
+ jQuery.fx.start();
+ } else {
+ jQuery.timers.pop();
+ }
+};
+
+jQuery.fx.interval = 13;
+
+jQuery.fx.start = function() {
+ if ( !timerId ) {
+ timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
+ }
+};
+
+jQuery.fx.stop = function() {
+ clearInterval( timerId );
+ timerId = null;
+};
+
+jQuery.fx.speeds = {
+ slow: 600,
+ fast: 200,
+ // Default speed
+ _default: 400
+};
+
+
+// Based off of the plugin by Clint Helfers, with permission.
+// http://blindsignals.com/index.php/2009/07/jquery-delay/
+jQuery.fn.delay = function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function( next, hooks ) {
+ var timeout = setTimeout( next, time );
+ hooks.stop = function() {
+ clearTimeout( timeout );
+ };
+ });
+};
+
+
+(function() {
+ var input = document.createElement( "input" ),
+ select = document.createElement( "select" ),
+ opt = select.appendChild( document.createElement( "option" ) );
+
+ input.type = "checkbox";
+
+ // Support: iOS 5.1, Android 4.x, Android 2.3
+ // Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
+ support.checkOn = input.value !== "";
+
+ // Must access the parent to make an option select properly
+ // Support: IE9, IE10
+ support.optSelected = opt.selected;
+
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as disabled)
+ select.disabled = true;
+ support.optDisabled = !opt.disabled;
+
+ // Check if an input maintains its value after becoming a radio
+ // Support: IE9, IE10
+ input = document.createElement( "input" );
+ input.value = "t";
+ input.type = "radio";
+ support.radioValue = input.value === "t";
+})();
+
+
+var nodeHook, boolHook,
+ attrHandle = jQuery.expr.attrHandle;
+
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return access( this, jQuery.attr, name, value, arguments.length > 1 );
+ },
+
+ removeAttr: function( name ) {
+ return this.each(function() {
+ jQuery.removeAttr( this, name );
+ });
+ }
+});
+
+jQuery.extend({
+ attr: function( elem, name, value ) {
+ var hooks, ret,
+ nType = elem.nodeType;
+
+ // don't get/set attributes on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ // Fallback to prop when attributes are not supported
+ if ( typeof elem.getAttribute === strundefined ) {
+ return jQuery.prop( elem, name, value );
+ }
+
+ // All attributes are lowercase
+ // Grab necessary hook if one is defined
+ if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
+ name = name.toLowerCase();
+ hooks = jQuery.attrHooks[ name ] ||
+ ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
+ }
+
+ if ( value !== undefined ) {
+
+ if ( value === null ) {
+ jQuery.removeAttr( elem, name );
+
+ } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ elem.setAttribute( name, value + "" );
+ return value;
+ }
+
+ } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+ ret = jQuery.find.attr( elem, name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return ret == null ?
+ undefined :
+ ret;
+ }
+ },
+
+ removeAttr: function( elem, value ) {
+ var name, propName,
+ i = 0,
+ attrNames = value && value.match( rnotwhite );
+
+ if ( attrNames && elem.nodeType === 1 ) {
+ while ( (name = attrNames[i++]) ) {
+ propName = jQuery.propFix[ name ] || name;
+
+ // Boolean attributes get special treatment (#10870)
+ if ( jQuery.expr.match.bool.test( name ) ) {
+ // Set corresponding property to false
+ elem[ propName ] = false;
+ }
+
+ elem.removeAttribute( name );
+ }
+ }
+ },
+
+ attrHooks: {
+ type: {
+ set: function( elem, value ) {
+ if ( !support.radioValue && value === "radio" &&
+ jQuery.nodeName( elem, "input" ) ) {
+ // Setting the type on a radio button after the value resets the value in IE6-9
+ // Reset value to default in case type is set after value during creation
+ var val = elem.value;
+ elem.setAttribute( "type", value );
+ if ( val ) {
+ elem.value = val;
+ }
+ return value;
+ }
+ }
+ }
+ }
+});
+
+// Hooks for boolean attributes
+boolHook = {
+ set: function( elem, value, name ) {
+ if ( value === false ) {
+ // Remove boolean attributes when set to false
+ jQuery.removeAttr( elem, name );
+ } else {
+ elem.setAttribute( name, name );
+ }
+ return name;
+ }
+};
+jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
+ var getter = attrHandle[ name ] || jQuery.find.attr;
+
+ attrHandle[ name ] = function( elem, name, isXML ) {
+ var ret, handle;
+ if ( !isXML ) {
+ // Avoid an infinite loop by temporarily removing this function from the getter
+ handle = attrHandle[ name ];
+ attrHandle[ name ] = ret;
+ ret = getter( elem, name, isXML ) != null ?
+ name.toLowerCase() :
+ null;
+ attrHandle[ name ] = handle;
+ }
+ return ret;
+ };
+});
+
+
+
+
+var rfocusable = /^(?:input|select|textarea|button)$/i;
+
+jQuery.fn.extend({
+ prop: function( name, value ) {
+ return access( this, jQuery.prop, name, value, arguments.length > 1 );
+ },
+
+ removeProp: function( name ) {
+ return this.each(function() {
+ delete this[ jQuery.propFix[ name ] || name ];
+ });
+ }
+});
+
+jQuery.extend({
+ propFix: {
+ "for": "htmlFor",
+ "class": "className"
+ },
+
+ prop: function( elem, name, value ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set properties on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
+
+ if ( value !== undefined ) {
+ return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
+ ret :
+ ( elem[ name ] = value );
+
+ } else {
+ return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
+ ret :
+ elem[ name ];
+ }
+ },
+
+ propHooks: {
+ tabIndex: {
+ get: function( elem ) {
+ return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
+ elem.tabIndex :
+ -1;
+ }
+ }
+ }
+});
+
+// Support: IE9+
+// Selectedness for an option in an optgroup can be inaccurate
+if ( !support.optSelected ) {
+ jQuery.propHooks.selected = {
+ get: function( elem ) {
+ var parent = elem.parentNode;
+ if ( parent && parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ return null;
+ }
+ };
+}
+
+jQuery.each([
+ "tabIndex",
+ "readOnly",
+ "maxLength",
+ "cellSpacing",
+ "cellPadding",
+ "rowSpan",
+ "colSpan",
+ "useMap",
+ "frameBorder",
+ "contentEditable"
+], function() {
+ jQuery.propFix[ this.toLowerCase() ] = this;
+});
+
+
+
+
+var rclass = /[\t\r\n\f]/g;
+
+jQuery.fn.extend({
+ addClass: function( value ) {
+ var classes, elem, cur, clazz, j, finalValue,
+ proceed = typeof value === "string" && value,
+ i = 0,
+ len = this.length;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).addClass( value.call( this, j, this.className ) );
+ });
+ }
+
+ if ( proceed ) {
+ // The disjunction here is for better compressibility (see removeClass)
+ classes = ( value || "" ).match( rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ " "
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
+ cur += clazz + " ";
+ }
+ }
+
+ // only assign if different to avoid unneeded rendering.
+ finalValue = jQuery.trim( cur );
+ if ( elem.className !== finalValue ) {
+ elem.className = finalValue;
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ var classes, elem, cur, clazz, j, finalValue,
+ proceed = arguments.length === 0 || typeof value === "string" && value,
+ i = 0,
+ len = this.length;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).removeClass( value.call( this, j, this.className ) );
+ });
+ }
+ if ( proceed ) {
+ classes = ( value || "" ).match( rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ // This expression is here for better compressibility (see addClass)
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ ""
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ // Remove *all* instances
+ while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
+ cur = cur.replace( " " + clazz + " ", " " );
+ }
+ }
+
+ // only assign if different to avoid unneeded rendering.
+ finalValue = value ? jQuery.trim( cur ) : "";
+ if ( elem.className !== finalValue ) {
+ elem.className = finalValue;
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value;
+
+ if ( typeof stateVal === "boolean" && type === "string" ) {
+ return stateVal ? this.addClass( value ) : this.removeClass( value );
+ }
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( i ) {
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+ });
+ }
+
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className,
+ i = 0,
+ self = jQuery( this ),
+ classNames = value.match( rnotwhite ) || [];
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space separated list
+ if ( self.hasClass( className ) ) {
+ self.removeClass( className );
+ } else {
+ self.addClass( className );
+ }
+ }
+
+ // Toggle whole class name
+ } else if ( type === strundefined || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ data_priv.set( this, "__className__", this.className );
+ }
+
+ // If the element has a class name or if we're passed "false",
+ // then remove the whole classname (if there was one, the above saved it).
+ // Otherwise bring back whatever was previously saved (if anything),
+ // falling back to the empty string if nothing was stored.
+ this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
+ }
+ });
+ },
+
+ hasClass: function( selector ) {
+ var className = " " + selector + " ",
+ i = 0,
+ l = this.length;
+ for ( ; i < l; i++ ) {
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+});
+
+
+
+
+var rreturn = /\r/g;
+
+jQuery.fn.extend({
+ val: function( value ) {
+ var hooks, ret, isFunction,
+ elem = this[0];
+
+ if ( !arguments.length ) {
+ if ( elem ) {
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
+
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+ return ret;
+ }
+
+ ret = elem.value;
+
+ return typeof ret === "string" ?
+ // handle most common string cases
+ ret.replace(rreturn, "") :
+ // handle cases where value is null/undef or number
+ ret == null ? "" : ret;
+ }
+
+ return;
+ }
+
+ isFunction = jQuery.isFunction( value );
+
+ return this.each(function( i ) {
+ var val;
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call( this, i, jQuery( this ).val() );
+ } else {
+ val = value;
+ }
+
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+
+ } else if ( typeof val === "number" ) {
+ val += "";
+
+ } else if ( jQuery.isArray( val ) ) {
+ val = jQuery.map( val, function( value ) {
+ return value == null ? "" : value + "";
+ });
+ }
+
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
+
+ // If set returns undefined, fall back to normal setting
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+ this.value = val;
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ valHooks: {
+ option: {
+ get: function( elem ) {
+ var val = jQuery.find.attr( elem, "value" );
+ return val != null ?
+ val :
+ // Support: IE10-11+
+ // option.text throws exceptions (#14686, #14858)
+ jQuery.trim( jQuery.text( elem ) );
+ }
+ },
+ select: {
+ get: function( elem ) {
+ var value, option,
+ options = elem.options,
+ index = elem.selectedIndex,
+ one = elem.type === "select-one" || index < 0,
+ values = one ? null : [],
+ max = one ? index + 1 : options.length,
+ i = index < 0 ?
+ max :
+ one ? index : 0;
+
+ // Loop through all the selected options
+ for ( ; i < max; i++ ) {
+ option = options[ i ];
+
+ // IE6-9 doesn't update selected after form reset (#2551)
+ if ( ( option.selected || i === index ) &&
+ // Don't return options that are disabled or in a disabled optgroup
+ ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
+ ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
+
+ // Get the specific value for the option
+ value = jQuery( option ).val();
+
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ return values;
+ },
+
+ set: function( elem, value ) {
+ var optionSet, option,
+ options = elem.options,
+ values = jQuery.makeArray( value ),
+ i = options.length;
+
+ while ( i-- ) {
+ option = options[ i ];
+ if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
+ optionSet = true;
+ }
+ }
+
+ // force browsers to behave consistently when non-matching value is set
+ if ( !optionSet ) {
+ elem.selectedIndex = -1;
+ }
+ return values;
+ }
+ }
+ }
+});
+
+// Radios and checkboxes getter/setter
+jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = {
+ set: function( elem, value ) {
+ if ( jQuery.isArray( value ) ) {
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+ }
+ }
+ };
+ if ( !support.checkOn ) {
+ jQuery.valHooks[ this ].get = function( elem ) {
+ // Support: Webkit
+ // "" is returned instead of "on" if a value isn't specified
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ };
+ }
+});
+
+
+
+
+// Return jQuery for attributes-only inclusion
+
+
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+ "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( data, fn ) {
+ return arguments.length > 0 ?
+ this.on( name, null, data, fn ) :
+ this.trigger( name );
+ };
+});
+
+jQuery.fn.extend({
+ hover: function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+ },
+
+ bind: function( types, data, fn ) {
+ return this.on( types, null, data, fn );
+ },
+ unbind: function( types, fn ) {
+ return this.off( types, null, fn );
+ },
+
+ delegate: function( selector, types, data, fn ) {
+ return this.on( types, selector, data, fn );
+ },
+ undelegate: function( selector, types, fn ) {
+ // ( namespace ) or ( selector, types [, fn] )
+ return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
+ }
+});
+
+
+var nonce = jQuery.now();
+
+var rquery = (/\?/);
+
+
+
+// Support: Android 2.3
+// Workaround failure to string-cast null input
+jQuery.parseJSON = function( data ) {
+ return JSON.parse( data + "" );
+};
+
+
+// Cross-browser xml parsing
+jQuery.parseXML = function( data ) {
+ var xml, tmp;
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+
+ // Support: IE9
+ try {
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data, "text/xml" );
+ } catch ( e ) {
+ xml = undefined;
+ }
+
+ if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
+ jQuery.error( "Invalid XML: " + data );
+ }
+ return xml;
+};
+
+
+var
+ // Document location
+ ajaxLocParts,
+ ajaxLocation,
+
+ rhash = /#.*$/,
+ rts = /([?&])_=[^&]*/,
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
+ // #7653, #8125, #8152: local protocol detection
+ rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
+ rnoContent = /^(?:GET|HEAD)$/,
+ rprotocol = /^\/\//,
+ rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
+
+ /* Prefilters
+ * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
+ * 2) These are called:
+ * - BEFORE asking for a transport
+ * - AFTER param serialization (s.data is a string if s.processData is true)
+ * 3) key is the dataType
+ * 4) the catchall symbol "*" can be used
+ * 5) execution will start with transport dataType and THEN continue down to "*" if needed
+ */
+ prefilters = {},
+
+ /* Transports bindings
+ * 1) key is the dataType
+ * 2) the catchall symbol "*" can be used
+ * 3) selection will start with transport dataType and THEN go to "*" if needed
+ */
+ transports = {},
+
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
+ allTypes = "*/".concat("*");
+
+// #8138, IE may throw an exception when accessing
+// a field from window.location if document.domain has been set
+try {
+ ajaxLocation = location.href;
+} catch( e ) {
+ // Use the href attribute of an A element
+ // since IE will modify it given document.location
+ ajaxLocation = document.createElement( "a" );
+ ajaxLocation.href = "";
+ ajaxLocation = ajaxLocation.href;
+}
+
+// Segment location into parts
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
+
+// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
+function addToPrefiltersOrTransports( structure ) {
+
+ // dataTypeExpression is optional and defaults to "*"
+ return function( dataTypeExpression, func ) {
+
+ if ( typeof dataTypeExpression !== "string" ) {
+ func = dataTypeExpression;
+ dataTypeExpression = "*";
+ }
+
+ var dataType,
+ i = 0,
+ dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
+
+ if ( jQuery.isFunction( func ) ) {
+ // For each dataType in the dataTypeExpression
+ while ( (dataType = dataTypes[i++]) ) {
+ // Prepend if requested
+ if ( dataType[0] === "+" ) {
+ dataType = dataType.slice( 1 ) || "*";
+ (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
+
+ // Otherwise append
+ } else {
+ (structure[ dataType ] = structure[ dataType ] || []).push( func );
+ }
+ }
+ }
+ };
+}
+
+// Base inspection function for prefilters and transports
+function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
+
+ var inspected = {},
+ seekingTransport = ( structure === transports );
+
+ function inspect( dataType ) {
+ var selected;
+ inspected[ dataType ] = true;
+ jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
+ var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
+ if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
+ options.dataTypes.unshift( dataTypeOrTransport );
+ inspect( dataTypeOrTransport );
+ return false;
+ } else if ( seekingTransport ) {
+ return !( selected = dataTypeOrTransport );
+ }
+ });
+ return selected;
+ }
+
+ return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
+}
+
+// A special extend for ajax options
+// that takes "flat" options (not to be deep extended)
+// Fixes #9887
+function ajaxExtend( target, src ) {
+ var key, deep,
+ flatOptions = jQuery.ajaxSettings.flatOptions || {};
+
+ for ( key in src ) {
+ if ( src[ key ] !== undefined ) {
+ ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
+ }
+ }
+ if ( deep ) {
+ jQuery.extend( true, target, deep );
+ }
+
+ return target;
+}
+
+/* Handles responses to an ajax request:
+ * - finds the right dataType (mediates between content-type and expected dataType)
+ * - returns the corresponding response
+ */
+function ajaxHandleResponses( s, jqXHR, responses ) {
+
+ var ct, type, finalDataType, firstDataType,
+ contents = s.contents,
+ dataTypes = s.dataTypes;
+
+ // Remove auto dataType and get content-type in the process
+ while ( dataTypes[ 0 ] === "*" ) {
+ dataTypes.shift();
+ if ( ct === undefined ) {
+ ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
+ }
+ }
+
+ // Check if we're dealing with a known content-type
+ if ( ct ) {
+ for ( type in contents ) {
+ if ( contents[ type ] && contents[ type ].test( ct ) ) {
+ dataTypes.unshift( type );
+ break;
+ }
+ }
+ }
+
+ // Check to see if we have a response for the expected dataType
+ if ( dataTypes[ 0 ] in responses ) {
+ finalDataType = dataTypes[ 0 ];
+ } else {
+ // Try convertible dataTypes
+ for ( type in responses ) {
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
+ finalDataType = type;
+ break;
+ }
+ if ( !firstDataType ) {
+ firstDataType = type;
+ }
+ }
+ // Or just use first one
+ finalDataType = finalDataType || firstDataType;
+ }
+
+ // If we found a dataType
+ // We add the dataType to the list if needed
+ // and return the corresponding response
+ if ( finalDataType ) {
+ if ( finalDataType !== dataTypes[ 0 ] ) {
+ dataTypes.unshift( finalDataType );
+ }
+ return responses[ finalDataType ];
+ }
+}
+
+/* Chain conversions given the request and the original response
+ * Also sets the responseXXX fields on the jqXHR instance
+ */
+function ajaxConvert( s, response, jqXHR, isSuccess ) {
+ var conv2, current, conv, tmp, prev,
+ converters = {},
+ // Work with a copy of dataTypes in case we need to modify it for conversion
+ dataTypes = s.dataTypes.slice();
+
+ // Create converters map with lowercased keys
+ if ( dataTypes[ 1 ] ) {
+ for ( conv in s.converters ) {
+ converters[ conv.toLowerCase() ] = s.converters[ conv ];
+ }
+ }
+
+ current = dataTypes.shift();
+
+ // Convert to each sequential dataType
+ while ( current ) {
+
+ if ( s.responseFields[ current ] ) {
+ jqXHR[ s.responseFields[ current ] ] = response;
+ }
+
+ // Apply the dataFilter if provided
+ if ( !prev && isSuccess && s.dataFilter ) {
+ response = s.dataFilter( response, s.dataType );
+ }
+
+ prev = current;
+ current = dataTypes.shift();
+
+ if ( current ) {
+
+ // There's only work to do if current dataType is non-auto
+ if ( current === "*" ) {
+
+ current = prev;
+
+ // Convert response if prev dataType is non-auto and differs from current
+ } else if ( prev !== "*" && prev !== current ) {
+
+ // Seek a direct converter
+ conv = converters[ prev + " " + current ] || converters[ "* " + current ];
+
+ // If none found, seek a pair
+ if ( !conv ) {
+ for ( conv2 in converters ) {
+
+ // If conv2 outputs current
+ tmp = conv2.split( " " );
+ if ( tmp[ 1 ] === current ) {
+
+ // If prev can be converted to accepted input
+ conv = converters[ prev + " " + tmp[ 0 ] ] ||
+ converters[ "* " + tmp[ 0 ] ];
+ if ( conv ) {
+ // Condense equivalence converters
+ if ( conv === true ) {
+ conv = converters[ conv2 ];
+
+ // Otherwise, insert the intermediate dataType
+ } else if ( converters[ conv2 ] !== true ) {
+ current = tmp[ 0 ];
+ dataTypes.unshift( tmp[ 1 ] );
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ // Apply converter (if not an equivalence)
+ if ( conv !== true ) {
+
+ // Unless errors are allowed to bubble, catch and return them
+ if ( conv && s[ "throws" ] ) {
+ response = conv( response );
+ } else {
+ try {
+ response = conv( response );
+ } catch ( e ) {
+ return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return { state: "success", data: response };
+}
+
+jQuery.extend({
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+ etag: {},
+
+ ajaxSettings: {
+ url: ajaxLocation,
+ type: "GET",
+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
+ global: true,
+ processData: true,
+ async: true,
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",
+ /*
+ timeout: 0,
+ data: null,
+ dataType: null,
+ username: null,
+ password: null,
+ cache: null,
+ throws: false,
+ traditional: false,
+ headers: {},
+ */
+
+ accepts: {
+ "*": allTypes,
+ text: "text/plain",
+ html: "text/html",
+ xml: "application/xml, text/xml",
+ json: "application/json, text/javascript"
+ },
+
+ contents: {
+ xml: /xml/,
+ html: /html/,
+ json: /json/
+ },
+
+ responseFields: {
+ xml: "responseXML",
+ text: "responseText",
+ json: "responseJSON"
+ },
+
+ // Data converters
+ // Keys separate source (or catchall "*") and destination types with a single space
+ converters: {
+
+ // Convert anything to text
+ "* text": String,
+
+ // Text to html (true = no transformation)
+ "text html": true,
+
+ // Evaluate text as a json expression
+ "text json": jQuery.parseJSON,
+
+ // Parse text as xml
+ "text xml": jQuery.parseXML
+ },
+
+ // For options that shouldn't be deep extended:
+ // you can add your own custom options here if
+ // and when you create one that shouldn't be
+ // deep extended (see ajaxExtend)
+ flatOptions: {
+ url: true,
+ context: true
+ }
+ },
+
+ // Creates a full fledged settings object into target
+ // with both ajaxSettings and settings fields.
+ // If target is omitted, writes into ajaxSettings.
+ ajaxSetup: function( target, settings ) {
+ return settings ?
+
+ // Building a settings object
+ ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
+
+ // Extending ajaxSettings
+ ajaxExtend( jQuery.ajaxSettings, target );
+ },
+
+ ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
+ ajaxTransport: addToPrefiltersOrTransports( transports ),
+
+ // Main method
+ ajax: function( url, options ) {
+
+ // If url is an object, simulate pre-1.5 signature
+ if ( typeof url === "object" ) {
+ options = url;
+ url = undefined;
+ }
+
+ // Force options to be an object
+ options = options || {};
+
+ var transport,
+ // URL without anti-cache param
+ cacheURL,
+ // Response headers
+ responseHeadersString,
+ responseHeaders,
+ // timeout handle
+ timeoutTimer,
+ // Cross-domain detection vars
+ parts,
+ // To know if global events are to be dispatched
+ fireGlobals,
+ // Loop variable
+ i,
+ // Create the final options object
+ s = jQuery.ajaxSetup( {}, options ),
+ // Callbacks context
+ callbackContext = s.context || s,
+ // Context for global events is callbackContext if it is a DOM node or jQuery collection
+ globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
+ jQuery( callbackContext ) :
+ jQuery.event,
+ // Deferreds
+ deferred = jQuery.Deferred(),
+ completeDeferred = jQuery.Callbacks("once memory"),
+ // Status-dependent callbacks
+ statusCode = s.statusCode || {},
+ // Headers (they are sent all at once)
+ requestHeaders = {},
+ requestHeadersNames = {},
+ // The jqXHR state
+ state = 0,
+ // Default abort message
+ strAbort = "canceled",
+ // Fake xhr
+ jqXHR = {
+ readyState: 0,
+
+ // Builds headers hashtable if needed
+ getResponseHeader: function( key ) {
+ var match;
+ if ( state === 2 ) {
+ if ( !responseHeaders ) {
+ responseHeaders = {};
+ while ( (match = rheaders.exec( responseHeadersString )) ) {
+ responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
+ }
+ }
+ match = responseHeaders[ key.toLowerCase() ];
+ }
+ return match == null ? null : match;
+ },
+
+ // Raw string
+ getAllResponseHeaders: function() {
+ return state === 2 ? responseHeadersString : null;
+ },
+
+ // Caches the header
+ setRequestHeader: function( name, value ) {
+ var lname = name.toLowerCase();
+ if ( !state ) {
+ name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
+ requestHeaders[ name ] = value;
+ }
+ return this;
+ },
+
+ // Overrides response content-type header
+ overrideMimeType: function( type ) {
+ if ( !state ) {
+ s.mimeType = type;
+ }
+ return this;
+ },
+
+ // Status-dependent callbacks
+ statusCode: function( map ) {
+ var code;
+ if ( map ) {
+ if ( state < 2 ) {
+ for ( code in map ) {
+ // Lazy-add the new callback in a way that preserves old ones
+ statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
+ }
+ } else {
+ // Execute the appropriate callbacks
+ jqXHR.always( map[ jqXHR.status ] );
+ }
+ }
+ return this;
+ },
+
+ // Cancel the request
+ abort: function( statusText ) {
+ var finalText = statusText || strAbort;
+ if ( transport ) {
+ transport.abort( finalText );
+ }
+ done( 0, finalText );
+ return this;
+ }
+ };
+
+ // Attach deferreds
+ deferred.promise( jqXHR ).complete = completeDeferred.add;
+ jqXHR.success = jqXHR.done;
+ jqXHR.error = jqXHR.fail;
+
+ // Remove hash character (#7531: and string promotion)
+ // Add protocol if not provided (prefilters might expect it)
+ // Handle falsy url in the settings object (#10093: consistency with old signature)
+ // We also use the url parameter if available
+ s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
+ .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
+
+ // Alias method option to type as per ticket #12004
+ s.type = options.method || options.type || s.method || s.type;
+
+ // Extract dataTypes list
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
+
+ // A cross-domain request is in order when we have a protocol:host:port mismatch
+ if ( s.crossDomain == null ) {
+ parts = rurl.exec( s.url.toLowerCase() );
+ s.crossDomain = !!( parts &&
+ ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
+ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
+ ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
+ );
+ }
+
+ // Convert data if not already a string
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
+ s.data = jQuery.param( s.data, s.traditional );
+ }
+
+ // Apply prefilters
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
+
+ // If request was aborted inside a prefilter, stop there
+ if ( state === 2 ) {
+ return jqXHR;
+ }
+
+ // We can fire global events as of now if asked to
+ fireGlobals = s.global;
+
+ // Watch for a new set of requests
+ if ( fireGlobals && jQuery.active++ === 0 ) {
+ jQuery.event.trigger("ajaxStart");
+ }
+
+ // Uppercase the type
+ s.type = s.type.toUpperCase();
+
+ // Determine if request has content
+ s.hasContent = !rnoContent.test( s.type );
+
+ // Save the URL in case we're toying with the If-Modified-Since
+ // and/or If-None-Match header later on
+ cacheURL = s.url;
+
+ // More options handling for requests with no content
+ if ( !s.hasContent ) {
+
+ // If data is available, append data to url
+ if ( s.data ) {
+ cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
+ // #9682: remove data so that it's not used in an eventual retry
+ delete s.data;
+ }
+
+ // Add anti-cache in url if needed
+ if ( s.cache === false ) {
+ s.url = rts.test( cacheURL ) ?
+
+ // If there is already a '_' parameter, set its value
+ cacheURL.replace( rts, "$1_=" + nonce++ ) :
+
+ // Otherwise add one to the end
+ cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
+ }
+ }
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ if ( jQuery.lastModified[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
+ }
+ if ( jQuery.etag[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
+ }
+ }
+
+ // Set the correct header, if data is being sent
+ if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
+ jqXHR.setRequestHeader( "Content-Type", s.contentType );
+ }
+
+ // Set the Accepts header for the server, depending on the dataType
+ jqXHR.setRequestHeader(
+ "Accept",
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
+ s.accepts[ "*" ]
+ );
+
+ // Check for headers option
+ for ( i in s.headers ) {
+ jqXHR.setRequestHeader( i, s.headers[ i ] );
+ }
+
+ // Allow custom headers/mimetypes and early abort
+ if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
+ // Abort if not done already and return
+ return jqXHR.abort();
+ }
+
+ // aborting is no longer a cancellation
+ strAbort = "abort";
+
+ // Install callbacks on deferreds
+ for ( i in { success: 1, error: 1, complete: 1 } ) {
+ jqXHR[ i ]( s[ i ] );
+ }
+
+ // Get transport
+ transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
+
+ // If no transport, we auto-abort
+ if ( !transport ) {
+ done( -1, "No Transport" );
+ } else {
+ jqXHR.readyState = 1;
+
+ // Send global event
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
+ }
+ // Timeout
+ if ( s.async && s.timeout > 0 ) {
+ timeoutTimer = setTimeout(function() {
+ jqXHR.abort("timeout");
+ }, s.timeout );
+ }
+
+ try {
+ state = 1;
+ transport.send( requestHeaders, done );
+ } catch ( e ) {
+ // Propagate exception as error if not done
+ if ( state < 2 ) {
+ done( -1, e );
+ // Simply rethrow otherwise
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ // Callback for when everything is done
+ function done( status, nativeStatusText, responses, headers ) {
+ var isSuccess, success, error, response, modified,
+ statusText = nativeStatusText;
+
+ // Called once
+ if ( state === 2 ) {
+ return;
+ }
+
+ // State is "done" now
+ state = 2;
+
+ // Clear timeout if it exists
+ if ( timeoutTimer ) {
+ clearTimeout( timeoutTimer );
+ }
+
+ // Dereference transport for early garbage collection
+ // (no matter how long the jqXHR object will be used)
+ transport = undefined;
+
+ // Cache response headers
+ responseHeadersString = headers || "";
+
+ // Set readyState
+ jqXHR.readyState = status > 0 ? 4 : 0;
+
+ // Determine if successful
+ isSuccess = status >= 200 && status < 300 || status === 304;
+
+ // Get response data
+ if ( responses ) {
+ response = ajaxHandleResponses( s, jqXHR, responses );
+ }
+
+ // Convert no matter what (that way responseXXX fields are always set)
+ response = ajaxConvert( s, response, jqXHR, isSuccess );
+
+ // If successful, handle type chaining
+ if ( isSuccess ) {
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ modified = jqXHR.getResponseHeader("Last-Modified");
+ if ( modified ) {
+ jQuery.lastModified[ cacheURL ] = modified;
+ }
+ modified = jqXHR.getResponseHeader("etag");
+ if ( modified ) {
+ jQuery.etag[ cacheURL ] = modified;
+ }
+ }
+
+ // if no content
+ if ( status === 204 || s.type === "HEAD" ) {
+ statusText = "nocontent";
+
+ // if not modified
+ } else if ( status === 304 ) {
+ statusText = "notmodified";
+
+ // If we have data, let's convert it
+ } else {
+ statusText = response.state;
+ success = response.data;
+ error = response.error;
+ isSuccess = !error;
+ }
+ } else {
+ // We extract error from statusText
+ // then normalize statusText and status for non-aborts
+ error = statusText;
+ if ( status || !statusText ) {
+ statusText = "error";
+ if ( status < 0 ) {
+ status = 0;
+ }
+ }
+ }
+
+ // Set data for the fake xhr object
+ jqXHR.status = status;
+ jqXHR.statusText = ( nativeStatusText || statusText ) + "";
+
+ // Success/Error
+ if ( isSuccess ) {
+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
+ } else {
+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
+ }
+
+ // Status-dependent callbacks
+ jqXHR.statusCode( statusCode );
+ statusCode = undefined;
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
+ [ jqXHR, s, isSuccess ? success : error ] );
+ }
+
+ // Complete
+ completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
+ // Handle the global AJAX counter
+ if ( !( --jQuery.active ) ) {
+ jQuery.event.trigger("ajaxStop");
+ }
+ }
+ }
+
+ return jqXHR;
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get( url, data, callback, "json" );
+ },
+
+ getScript: function( url, callback ) {
+ return jQuery.get( url, undefined, callback, "script" );
+ }
+});
+
+jQuery.each( [ "get", "post" ], function( i, method ) {
+ jQuery[ method ] = function( url, data, callback, type ) {
+ // shift arguments if data argument was omitted
+ if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
+ callback = data;
+ data = undefined;
+ }
+
+ return jQuery.ajax({
+ url: url,
+ type: method,
+ dataType: type,
+ data: data,
+ success: callback
+ });
+ };
+});
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
+ jQuery.fn[ type ] = function( fn ) {
+ return this.on( type, fn );
+ };
+});
+
+
+jQuery._evalUrl = function( url ) {
+ return jQuery.ajax({
+ url: url,
+ type: "GET",
+ dataType: "script",
+ async: false,
+ global: false,
+ "throws": true
+ });
+};
+
+
+jQuery.fn.extend({
+ wrapAll: function( html ) {
+ var wrap;
+
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function( i ) {
+ jQuery( this ).wrapAll( html.call(this, i) );
+ });
+ }
+
+ if ( this[ 0 ] ) {
+
+ // The elements to wrap the target around
+ wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
+
+ if ( this[ 0 ].parentNode ) {
+ wrap.insertBefore( this[ 0 ] );
+ }
+
+ wrap.map(function() {
+ var elem = this;
+
+ while ( elem.firstElementChild ) {
+ elem = elem.firstElementChild;
+ }
+
+ return elem;
+ }).append( this );
+ }
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function( i ) {
+ jQuery( this ).wrapInner( html.call(this, i) );
+ });
+ }
+
+ return this.each(function() {
+ var self = jQuery( this ),
+ contents = self.contents();
+
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
+ });
+ },
+
+ wrap: function( html ) {
+ var isFunction = jQuery.isFunction( html );
+
+ return this.each(function( i ) {
+ jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
+ });
+ },
+
+ unwrap: function() {
+ return this.parent().each(function() {
+ if ( !jQuery.nodeName( this, "body" ) ) {
+ jQuery( this ).replaceWith( this.childNodes );
+ }
+ }).end();
+ }
+});
+
+
+jQuery.expr.filters.hidden = function( elem ) {
+ // Support: Opera <= 12.12
+ // Opera reports offsetWidths and offsetHeights less than zero on some elements
+ return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
+};
+jQuery.expr.filters.visible = function( elem ) {
+ return !jQuery.expr.filters.hidden( elem );
+};
+
+
+
+
+var r20 = /%20/g,
+ rbracket = /\[\]$/,
+ rCRLF = /\r?\n/g,
+ rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
+ rsubmittable = /^(?:input|select|textarea|keygen)/i;
+
+function buildParams( prefix, obj, traditional, add ) {
+ var name;
+
+ if ( jQuery.isArray( obj ) ) {
+ // Serialize array item.
+ jQuery.each( obj, function( i, v ) {
+ if ( traditional || rbracket.test( prefix ) ) {
+ // Treat each array item as a scalar.
+ add( prefix, v );
+
+ } else {
+ // Item is non-scalar (array or object), encode its numeric index.
+ buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
+ }
+ });
+
+ } else if ( !traditional && jQuery.type( obj ) === "object" ) {
+ // Serialize object item.
+ for ( name in obj ) {
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
+ }
+
+ } else {
+ // Serialize scalar item.
+ add( prefix, obj );
+ }
+}
+
+// Serialize an array of form elements or a set of
+// key/values into a query string
+jQuery.param = function( a, traditional ) {
+ var prefix,
+ s = [],
+ add = function( key, value ) {
+ // If value is a function, invoke it and return its value
+ value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
+ };
+
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
+ if ( traditional === undefined ) {
+ traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
+ }
+
+ // If an array was passed in, assume that it is an array of form elements.
+ if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
+ // Serialize the form elements
+ jQuery.each( a, function() {
+ add( this.name, this.value );
+ });
+
+ } else {
+ // If traditional, encode the "old" way (the way 1.3.2 or older
+ // did it), otherwise encode params recursively.
+ for ( prefix in a ) {
+ buildParams( prefix, a[ prefix ], traditional, add );
+ }
+ }
+
+ // Return the resulting serialization
+ return s.join( "&" ).replace( r20, "+" );
+};
+
+jQuery.fn.extend({
+ serialize: function() {
+ return jQuery.param( this.serializeArray() );
+ },
+ serializeArray: function() {
+ return this.map(function() {
+ // Can add propHook for "elements" to filter or add form elements
+ var elements = jQuery.prop( this, "elements" );
+ return elements ? jQuery.makeArray( elements ) : this;
+ })
+ .filter(function() {
+ var type = this.type;
+
+ // Use .is( ":disabled" ) so that fieldset[disabled] works
+ return this.name && !jQuery( this ).is( ":disabled" ) &&
+ rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
+ ( this.checked || !rcheckableType.test( type ) );
+ })
+ .map(function( i, elem ) {
+ var val = jQuery( this ).val();
+
+ return val == null ?
+ null :
+ jQuery.isArray( val ) ?
+ jQuery.map( val, function( val ) {
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }) :
+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }).get();
+ }
+});
+
+
+jQuery.ajaxSettings.xhr = function() {
+ try {
+ return new XMLHttpRequest();
+ } catch( e ) {}
+};
+
+var xhrId = 0,
+ xhrCallbacks = {},
+ xhrSuccessStatus = {
+ // file protocol always yields status code 0, assume 200
+ 0: 200,
+ // Support: IE9
+ // #1450: sometimes IE returns 1223 when it should be 204
+ 1223: 204
+ },
+ xhrSupported = jQuery.ajaxSettings.xhr();
+
+// Support: IE9
+// Open requests must be manually aborted on unload (#5280)
+if ( window.ActiveXObject ) {
+ jQuery( window ).on( "unload", function() {
+ for ( var key in xhrCallbacks ) {
+ xhrCallbacks[ key ]();
+ }
+ });
+}
+
+support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
+support.ajax = xhrSupported = !!xhrSupported;
+
+jQuery.ajaxTransport(function( options ) {
+ var callback;
+
+ // Cross domain only allowed if supported through XMLHttpRequest
+ if ( support.cors || xhrSupported && !options.crossDomain ) {
+ return {
+ send: function( headers, complete ) {
+ var i,
+ xhr = options.xhr(),
+ id = ++xhrId;
+
+ xhr.open( options.type, options.url, options.async, options.username, options.password );
+
+ // Apply custom fields if provided
+ if ( options.xhrFields ) {
+ for ( i in options.xhrFields ) {
+ xhr[ i ] = options.xhrFields[ i ];
+ }
+ }
+
+ // Override mime type if needed
+ if ( options.mimeType && xhr.overrideMimeType ) {
+ xhr.overrideMimeType( options.mimeType );
+ }
+
+ // X-Requested-With header
+ // For cross-domain requests, seeing as conditions for a preflight are
+ // akin to a jigsaw puzzle, we simply never set it to be sure.
+ // (it can always be set on a per-request basis or even using ajaxSetup)
+ // For same-domain requests, won't change header if already provided.
+ if ( !options.crossDomain && !headers["X-Requested-With"] ) {
+ headers["X-Requested-With"] = "XMLHttpRequest";
+ }
+
+ // Set headers
+ for ( i in headers ) {
+ xhr.setRequestHeader( i, headers[ i ] );
+ }
+
+ // Callback
+ callback = function( type ) {
+ return function() {
+ if ( callback ) {
+ delete xhrCallbacks[ id ];
+ callback = xhr.onload = xhr.onerror = null;
+
+ if ( type === "abort" ) {
+ xhr.abort();
+ } else if ( type === "error" ) {
+ complete(
+ // file: protocol always yields status 0; see #8605, #14207
+ xhr.status,
+ xhr.statusText
+ );
+ } else {
+ complete(
+ xhrSuccessStatus[ xhr.status ] || xhr.status,
+ xhr.statusText,
+ // Support: IE9
+ // Accessing binary-data responseText throws an exception
+ // (#11426)
+ typeof xhr.responseText === "string" ? {
+ text: xhr.responseText
+ } : undefined,
+ xhr.getAllResponseHeaders()
+ );
+ }
+ }
+ };
+ };
+
+ // Listen to events
+ xhr.onload = callback();
+ xhr.onerror = callback("error");
+
+ // Create the abort callback
+ callback = xhrCallbacks[ id ] = callback("abort");
+
+ try {
+ // Do send the request (this may raise an exception)
+ xhr.send( options.hasContent && options.data || null );
+ } catch ( e ) {
+ // #14683: Only rethrow if this hasn't been notified as an error yet
+ if ( callback ) {
+ throw e;
+ }
+ }
+ },
+
+ abort: function() {
+ if ( callback ) {
+ callback();
+ }
+ }
+ };
+ }
+});
+
+
+
+
+// Install script dataType
+jQuery.ajaxSetup({
+ accepts: {
+ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
+ },
+ contents: {
+ script: /(?:java|ecma)script/
+ },
+ converters: {
+ "text script": function( text ) {
+ jQuery.globalEval( text );
+ return text;
+ }
+ }
+});
+
+// Handle cache's special case and crossDomain
+jQuery.ajaxPrefilter( "script", function( s ) {
+ if ( s.cache === undefined ) {
+ s.cache = false;
+ }
+ if ( s.crossDomain ) {
+ s.type = "GET";
+ }
+});
+
+// Bind script tag hack transport
+jQuery.ajaxTransport( "script", function( s ) {
+ // This transport only deals with cross domain requests
+ if ( s.crossDomain ) {
+ var script, callback;
+ return {
+ send: function( _, complete ) {
+ script = jQuery("<script>").prop({
+ async: true,
+ charset: s.scriptCharset,
+ src: s.url
+ }).on(
+ "load error",
+ callback = function( evt ) {
+ script.remove();
+ callback = null;
+ if ( evt ) {
+ complete( evt.type === "error" ? 404 : 200, evt.type );
+ }
+ }
+ );
+ document.head.appendChild( script[ 0 ] );
+ },
+ abort: function() {
+ if ( callback ) {
+ callback();
+ }
+ }
+ };
+ }
+});
+
+
+
+
+var oldCallbacks = [],
+ rjsonp = /(=)\?(?=&|$)|\?\?/;
+
+// Default jsonp settings
+jQuery.ajaxSetup({
+ jsonp: "callback",
+ jsonpCallback: function() {
+ var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
+ this[ callback ] = true;
+ return callback;
+ }
+});
+
+// Detect, normalize options and install callbacks for jsonp requests
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
+
+ var callbackName, overwritten, responseContainer,
+ jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
+ "url" :
+ typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
+ );
+
+ // Handle iff the expected data type is "jsonp" or we have a parameter to set
+ if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
+
+ // Get callback name, remembering preexisting value associated with it
+ callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
+ s.jsonpCallback() :
+ s.jsonpCallback;
+
+ // Insert callback into url or form data
+ if ( jsonProp ) {
+ s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
+ } else if ( s.jsonp !== false ) {
+ s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
+ }
+
+ // Use data converter to retrieve json after script execution
+ s.converters["script json"] = function() {
+ if ( !responseContainer ) {
+ jQuery.error( callbackName + " was not called" );
+ }
+ return responseContainer[ 0 ];
+ };
+
+ // force json dataType
+ s.dataTypes[ 0 ] = "json";
+
+ // Install callback
+ overwritten = window[ callbackName ];
+ window[ callbackName ] = function() {
+ responseContainer = arguments;
+ };
+
+ // Clean-up function (fires after converters)
+ jqXHR.always(function() {
+ // Restore preexisting value
+ window[ callbackName ] = overwritten;
+
+ // Save back as free
+ if ( s[ callbackName ] ) {
+ // make sure that re-using the options doesn't screw things around
+ s.jsonpCallback = originalSettings.jsonpCallback;
+
+ // save the callback name for future use
+ oldCallbacks.push( callbackName );
+ }
+
+ // Call if it was a function and we have a response
+ if ( responseContainer && jQuery.isFunction( overwritten ) ) {
+ overwritten( responseContainer[ 0 ] );
+ }
+
+ responseContainer = overwritten = undefined;
+ });
+
+ // Delegate to script
+ return "script";
+ }
+});
+
+
+
+
+// data: string of html
+// context (optional): If specified, the fragment will be created in this context, defaults to document
+// keepScripts (optional): If true, will include scripts passed in the html string
+jQuery.parseHTML = function( data, context, keepScripts ) {
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ if ( typeof context === "boolean" ) {
+ keepScripts = context;
+ context = false;
+ }
+ context = context || document;
+
+ var parsed = rsingleTag.exec( data ),
+ scripts = !keepScripts && [];
+
+ // Single tag
+ if ( parsed ) {
+ return [ context.createElement( parsed[1] ) ];
+ }
+
+ parsed = jQuery.buildFragment( [ data ], context, scripts );
+
+ if ( scripts && scripts.length ) {
+ jQuery( scripts ).remove();
+ }
+
+ return jQuery.merge( [], parsed.childNodes );
+};
+
+
+// Keep a copy of the old load method
+var _load = jQuery.fn.load;
+
+/**
+ * Load a url into a page
+ */
+jQuery.fn.load = function( url, params, callback ) {
+ if ( typeof url !== "string" && _load ) {
+ return _load.apply( this, arguments );
+ }
+
+ var selector, type, response,
+ self = this,
+ off = url.indexOf(" ");
+
+ if ( off >= 0 ) {
+ selector = jQuery.trim( url.slice( off ) );
+ url = url.slice( 0, off );
+ }
+
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+
+ // We assume that it's the callback
+ callback = params;
+ params = undefined;
+
+ // Otherwise, build a param string
+ } else if ( params && typeof params === "object" ) {
+ type = "POST";
+ }
+
+ // If we have elements to modify, make the request
+ if ( self.length > 0 ) {
+ jQuery.ajax({
+ url: url,
+
+ // if "type" variable is undefined, then "GET" method will be used
+ type: type,
+ dataType: "html",
+ data: params
+ }).done(function( responseText ) {
+
+ // Save response for use in complete callback
+ response = arguments;
+
+ self.html( selector ?
+
+ // If a selector was specified, locate the right elements in a dummy div
+ // Exclude scripts to avoid IE 'Permission Denied' errors
+ jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
+
+ // Otherwise use the full result
+ responseText );
+
+ }).complete( callback && function( jqXHR, status ) {
+ self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
+ });
+ }
+
+ return this;
+};
+
+
+
+
+jQuery.expr.filters.animated = function( elem ) {
+ return jQuery.grep(jQuery.timers, function( fn ) {
+ return elem === fn.elem;
+ }).length;
+};
+
+
+
+
+var docElem = window.document.documentElement;
+
+/**
+ * Gets a window from an element
+ */
+function getWindow( elem ) {
+ return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
+}
+
+jQuery.offset = {
+ setOffset: function( elem, options, i ) {
+ var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
+ position = jQuery.css( elem, "position" ),
+ curElem = jQuery( elem ),
+ props = {};
+
+ // Set position first, in-case top/left are set even on static elem
+ if ( position === "static" ) {
+ elem.style.position = "relative";
+ }
+
+ curOffset = curElem.offset();
+ curCSSTop = jQuery.css( elem, "top" );
+ curCSSLeft = jQuery.css( elem, "left" );
+ calculatePosition = ( position === "absolute" || position === "fixed" ) &&
+ ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
+
+ // Need to be able to calculate position if either top or left is auto and position is either absolute or fixed
+ if ( calculatePosition ) {
+ curPosition = curElem.position();
+ curTop = curPosition.top;
+ curLeft = curPosition.left;
+
+ } else {
+ curTop = parseFloat( curCSSTop ) || 0;
+ curLeft = parseFloat( curCSSLeft ) || 0;
+ }
+
+ if ( jQuery.isFunction( options ) ) {
+ options = options.call( elem, i, curOffset );
+ }
+
+ if ( options.top != null ) {
+ props.top = ( options.top - curOffset.top ) + curTop;
+ }
+ if ( options.left != null ) {
+ props.left = ( options.left - curOffset.left ) + curLeft;
+ }
+
+ if ( "using" in options ) {
+ options.using.call( elem, props );
+
+ } else {
+ curElem.css( props );
+ }
+ }
+};
+
+jQuery.fn.extend({
+ offset: function( options ) {
+ if ( arguments.length ) {
+ return options === undefined ?
+ this :
+ this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ var docElem, win,
+ elem = this[ 0 ],
+ box = { top: 0, left: 0 },
+ doc = elem && elem.ownerDocument;
+
+ if ( !doc ) {
+ return;
+ }
+
+ docElem = doc.documentElement;
+
+ // Make sure it's not a disconnected DOM node
+ if ( !jQuery.contains( docElem, elem ) ) {
+ return box;
+ }
+
+ // If we don't have gBCR, just use 0,0 rather than error
+ // BlackBerry 5, iOS 3 (original iPhone)
+ if ( typeof elem.getBoundingClientRect !== strundefined ) {
+ box = elem.getBoundingClientRect();
+ }
+ win = getWindow( doc );
+ return {
+ top: box.top + win.pageYOffset - docElem.clientTop,
+ left: box.left + win.pageXOffset - docElem.clientLeft
+ };
+ },
+
+ position: function() {
+ if ( !this[ 0 ] ) {
+ return;
+ }
+
+ var offsetParent, offset,
+ elem = this[ 0 ],
+ parentOffset = { top: 0, left: 0 };
+
+ // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
+ if ( jQuery.css( elem, "position" ) === "fixed" ) {
+ // We assume that getBoundingClientRect is available when computed position is fixed
+ offset = elem.getBoundingClientRect();
+
+ } else {
+ // Get *real* offsetParent
+ offsetParent = this.offsetParent();
+
+ // Get correct offsets
+ offset = this.offset();
+ if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
+ parentOffset = offsetParent.offset();
+ }
+
+ // Add offsetParent borders
+ parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
+ parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
+ }
+
+ // Subtract parent offsets and element margins
+ return {
+ top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
+ left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
+ };
+ },
+
+ offsetParent: function() {
+ return this.map(function() {
+ var offsetParent = this.offsetParent || docElem;
+
+ while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
+ offsetParent = offsetParent.offsetParent;
+ }
+
+ return offsetParent || docElem;
+ });
+ }
+});
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
+ var top = "pageYOffset" === prop;
+
+ jQuery.fn[ method ] = function( val ) {
+ return access( this, function( elem, method, val ) {
+ var win = getWindow( elem );
+
+ if ( val === undefined ) {
+ return win ? win[ prop ] : elem[ method ];
+ }
+
+ if ( win ) {
+ win.scrollTo(
+ !top ? val : window.pageXOffset,
+ top ? val : window.pageYOffset
+ );
+
+ } else {
+ elem[ method ] = val;
+ }
+ }, method, val, arguments.length, null );
+ };
+});
+
+// Add the top/left cssHooks using jQuery.fn.position
+// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
+// getComputedStyle returns percent when specified for top/left/bottom/right
+// rather than make the css module depend on the offset module, we just check for it here
+jQuery.each( [ "top", "left" ], function( i, prop ) {
+ jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
+ function( elem, computed ) {
+ if ( computed ) {
+ computed = curCSS( elem, prop );
+ // if curCSS returns percentage, fallback to offset
+ return rnumnonpx.test( computed ) ?
+ jQuery( elem ).position()[ prop ] + "px" :
+ computed;
+ }
+ }
+ );
+});
+
+
+// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
+jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
+ jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
+ // margin is only for outerHeight, outerWidth
+ jQuery.fn[ funcName ] = function( margin, value ) {
+ var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
+ extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
+
+ return access( this, function( elem, type, value ) {
+ var doc;
+
+ if ( jQuery.isWindow( elem ) ) {
+ // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
+ // isn't a whole lot we can do. See pull request at this URL for discussion:
+ // https://github.com/jquery/jquery/pull/764
+ return elem.document.documentElement[ "client" + name ];
+ }
+
+ // Get document width or height
+ if ( elem.nodeType === 9 ) {
+ doc = elem.documentElement;
+
+ // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
+ // whichever is greatest
+ return Math.max(
+ elem.body[ "scroll" + name ], doc[ "scroll" + name ],
+ elem.body[ "offset" + name ], doc[ "offset" + name ],
+ doc[ "client" + name ]
+ );
+ }
+
+ return value === undefined ?
+ // Get width or height on the element, requesting but not forcing parseFloat
+ jQuery.css( elem, type, extra ) :
+
+ // Set width or height on the element
+ jQuery.style( elem, type, value, extra );
+ }, type, chainable ? margin : undefined, chainable, null );
+ };
+ });
+});
+
+
+// The number of elements contained in the matched element set
+jQuery.fn.size = function() {
+ return this.length;
+};
+
+jQuery.fn.andSelf = jQuery.fn.addBack;
+
+
+
+
+// Register as a named AMD module, since jQuery can be concatenated with other
+// files that may use define, but not via a proper concatenation script that
+// understands anonymous AMD modules. A named AMD is safest and most robust
+// way to register. Lowercase jquery is used because AMD module names are
+// derived from file names, and jQuery is normally delivered in a lowercase
+// file name. Do this after creating the global so that if an AMD module wants
+// to call noConflict to hide this version of jQuery, it will work.
+
+// Note that for maximum portability, libraries that are not jQuery should
+// declare themselves as anonymous modules, and avoid setting a global if an
+// AMD loader is present. jQuery is a special case. For more information, see
+// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
+
+if ( typeof define === "function" && define.amd ) {
+ define( "jquery", [], function() {
+ return jQuery;
+ });
+}
+
+
+
+
+var
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$;
+
+jQuery.noConflict = function( deep ) {
+ if ( window.$ === jQuery ) {
+ window.$ = _$;
+ }
+
+ if ( deep && window.jQuery === jQuery ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
+};
+
+// Expose jQuery and $ identifiers, even in
+// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
+// and CommonJS for browser emulators (#13566)
+if ( typeof noGlobal === strundefined ) {
+ window.jQuery = window.$ = jQuery;
+}
+
+
+
+
+return jQuery;
+
+}));
+
+/**
+ * @license AngularJS v1.5.0
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, document){
+ var _jQuery = window.jQuery.noConflict(true);
+
+/**
+ * @description
+ *
+ * This object provides a utility for producing rich Error messages within
+ * Angular. It can be called as follows:
+ *
+ * var exampleMinErr = minErr('example');
+ * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
+ *
+ * The above creates an instance of minErr in the example namespace. The
+ * resulting error will have a namespaced error code of example.one. The
+ * resulting error will replace {0} with the value of foo, and {1} with the
+ * value of bar. The object is not restricted in the number of arguments it can
+ * take.
+ *
+ * If fewer arguments are specified than necessary for interpolation, the extra
+ * interpolation markers will be preserved in the final string.
+ *
+ * Since data will be parsed statically during a build step, some restrictions
+ * are applied with respect to how minErr instances are created and called.
+ * Instances should have names of the form namespaceMinErr for a minErr created
+ * using minErr('namespace') . Error codes, namespaces and template strings
+ * should all be static strings, not variables or general expressions.
+ *
+ * @param {string} module The namespace to use for the new minErr instance.
+ * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning
+ * error from returned function, for cases when a particular type of error is useful.
+ * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
+ */
+
+function minErr(module, ErrorConstructor) {
+ ErrorConstructor = ErrorConstructor || Error;
+ return function() {
+ var SKIP_INDEXES = 2;
+
+ var templateArgs = arguments,
+ code = templateArgs[0],
+ message = '[' + (module ? module + ':' : '') + code + '] ',
+ template = templateArgs[1],
+ paramPrefix, i;
+
+ message += template.replace(/\{\d+\}/g, function(match) {
+ var index = +match.slice(1, -1),
+ shiftedIndex = index + SKIP_INDEXES;
+
+ if (shiftedIndex < templateArgs.length) {
+ return toDebugString(templateArgs[shiftedIndex]);
+ }
+
+ return match;
+ });
+
+ message += '\nhttp://errors.angularjs.org/1.5.0/' +
+ (module ? module + '/' : '') + code;
+
+ for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
+ message += paramPrefix + 'p' + (i - SKIP_INDEXES) + '=' +
+ encodeURIComponent(toDebugString(templateArgs[i]));
+ }
+
+ return new ErrorConstructor(message);
+ };
+}
+
+/* We need to tell jshint what variables are being exported */
+/* global angular: true,
+ msie: true,
+ jqLite: true,
+ jQuery: true,
+ slice: true,
+ splice: true,
+ push: true,
+ toString: true,
+ ngMinErr: true,
+ angularModule: true,
+ uid: true,
+ REGEX_STRING_REGEXP: true,
+ VALIDITY_STATE_PROPERTY: true,
+
+ lowercase: true,
+ uppercase: true,
+ manualLowercase: true,
+ manualUppercase: true,
+ nodeName_: true,
+ isArrayLike: true,
+ forEach: true,
+ forEachSorted: true,
+ reverseParams: true,
+ nextUid: true,
+ setHashKey: true,
+ extend: true,
+ toInt: true,
+ inherit: true,
+ merge: true,
+ noop: true,
+ identity: true,
+ valueFn: true,
+ isUndefined: true,
+ isDefined: true,
+ isObject: true,
+ isBlankObject: true,
+ isString: true,
+ isNumber: true,
+ isDate: true,
+ isArray: true,
+ isFunction: true,
+ isRegExp: true,
+ isWindow: true,
+ isScope: true,
+ isFile: true,
+ isFormData: true,
+ isBlob: true,
+ isBoolean: true,
+ isPromiseLike: true,
+ trim: true,
+ escapeForRegexp: true,
+ isElement: true,
+ makeMap: true,
+ includes: true,
+ arrayRemove: true,
+ copy: true,
+ shallowCopy: true,
+ equals: true,
+ csp: true,
+ jq: true,
+ concat: true,
+ sliceArgs: true,
+ bind: true,
+ toJsonReplacer: true,
+ toJson: true,
+ fromJson: true,
+ convertTimezoneToLocal: true,
+ timezoneToOffset: true,
+ startingTag: true,
+ tryDecodeURIComponent: true,
+ parseKeyValue: true,
+ toKeyValue: true,
+ encodeUriSegment: true,
+ encodeUriQuery: true,
+ angularInit: true,
+ bootstrap: true,
+ getTestability: true,
+ snake_case: true,
+ bindJQuery: true,
+ assertArg: true,
+ assertArgFn: true,
+ assertNotHasOwnProperty: true,
+ getter: true,
+ getBlockNodes: true,
+ hasOwnProperty: true,
+ createMap: true,
+
+ NODE_TYPE_ELEMENT: true,
+ NODE_TYPE_ATTRIBUTE: true,
+ NODE_TYPE_TEXT: true,
+ NODE_TYPE_COMMENT: true,
+ NODE_TYPE_DOCUMENT: true,
+ NODE_TYPE_DOCUMENT_FRAGMENT: true,
+*/
+
+////////////////////////////////////
+
+/**
+ * @ngdoc module
+ * @name ng
+ * @module ng
+ * @description
+ *
+ * # ng (core module)
+ * The ng module is loaded by default when an AngularJS application is started. The module itself
+ * contains the essential components for an AngularJS application to function. The table below
+ * lists a high level breakdown of each of the services/factories, filters, directives and testing
+ * components available within this core module.
+ *
+ * <div doc-module-components="ng"></div>
+ */
+
+var REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
+
+// The name of a form control's ValidityState property.
+// This is used so that it's possible for internal tests to create mock ValidityStates.
+var VALIDITY_STATE_PROPERTY = 'validity';
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+var lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;};
+var uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;};
+
+
+var manualLowercase = function(s) {
+ /* jshint bitwise: false */
+ return isString(s)
+ ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})
+ : s;
+};
+var manualUppercase = function(s) {
+ /* jshint bitwise: false */
+ return isString(s)
+ ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})
+ : s;
+};
+
+
+// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish
+// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods
+// with correct but slower alternatives. See https://github.com/angular/angular.js/issues/11387
+if ('i' !== 'I'.toLowerCase()) {
+ lowercase = manualLowercase;
+ uppercase = manualUppercase;
+}
+
+
+var
+ msie, // holds major version number for IE, or NaN if UA is not IE.
+ jqLite, // delay binding since jQuery could be loaded after us.
+ jQuery, // delay binding
+ slice = [].slice,
+ splice = [].splice,
+ push = [].push,
+ toString = Object.prototype.toString,
+ getPrototypeOf = Object.getPrototypeOf,
+ ngMinErr = minErr('ng'),
+
+ /** @name angular */
+ angular = window.angular || (window.angular = {}),
+ angularModule,
+ uid = 0;
+
+/**
+ * documentMode is an IE-only property
+ * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx
+ */
+msie = document.documentMode;
+
+
+/**
+ * @private
+ * @param {*} obj
+ * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments,
+ * String ...)
+ */
+function isArrayLike(obj) {
+
+ // `null`, `undefined` and `window` are not array-like
+ if (obj == null || isWindow(obj)) return false;
+
+ // arrays, strings and jQuery/jqLite objects are array like
+ // * jqLite is either the jQuery or jqLite constructor function
+ // * we have to check the existence of jqLite first as this method is called
+ // via the forEach method when constructing the jqLite object in the first place
+ if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true;
+
+ // Support: iOS 8.2 (not reproducible in simulator)
+ // "length" in obj used to prevent JIT error (gh-11508)
+ var length = "length" in Object(obj) && obj.length;
+
+ // NodeList objects (with `item` method) and
+ // other objects with suitable length characteristics are array-like
+ return isNumber(length) &&
+ (length >= 0 && ((length - 1) in obj || obj instanceof Array) || typeof obj.item == 'function');
+
+}
+
+/**
+ * @ngdoc function
+ * @name angular.forEach
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Invokes the `iterator` function once for each item in `obj` collection, which can be either an
+ * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value`
+ * is the value of an object property or an array element, `key` is the object property key or
+ * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional.
+ *
+ * It is worth noting that `.forEach` does not iterate over inherited properties because it filters
+ * using the `hasOwnProperty` method.
+ *
+ * Unlike ES262's
+ * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18),
+ * Providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just
+ * return the value provided.
+ *
+ ```js
+ var values = {name: 'misko', gender: 'male'};
+ var log = [];
+ angular.forEach(values, function(value, key) {
+ this.push(key + ': ' + value);
+ }, log);
+ expect(log).toEqual(['name: misko', 'gender: male']);
+ ```
+ *
+ * @param {Object|Array} obj Object to iterate over.
+ * @param {Function} iterator Iterator function.
+ * @param {Object=} context Object to become context (`this`) for the iterator function.
+ * @returns {Object|Array} Reference to `obj`.
+ */
+
+function forEach(obj, iterator, context) {
+ var key, length;
+ if (obj) {
+ if (isFunction(obj)) {
+ for (key in obj) {
+ // Need to check if hasOwnProperty exists,
+ // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
+ if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ }
+ } else if (isArray(obj) || isArrayLike(obj)) {
+ var isPrimitive = typeof obj !== 'object';
+ for (key = 0, length = obj.length; key < length; key++) {
+ if (isPrimitive || key in obj) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ }
+ } else if (obj.forEach && obj.forEach !== forEach) {
+ obj.forEach(iterator, context, obj);
+ } else if (isBlankObject(obj)) {
+ // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
+ for (key in obj) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ } else if (typeof obj.hasOwnProperty === 'function') {
+ // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed
+ for (key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ }
+ } else {
+ // Slow path for objects which do not have a method `hasOwnProperty`
+ for (key in obj) {
+ if (hasOwnProperty.call(obj, key)) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ }
+ }
+ }
+ return obj;
+}
+
+function forEachSorted(obj, iterator, context) {
+ var keys = Object.keys(obj).sort();
+ for (var i = 0; i < keys.length; i++) {
+ iterator.call(context, obj[keys[i]], keys[i]);
+ }
+ return keys;
+}
+
+
+/**
+ * when using forEach the params are value, key, but it is often useful to have key, value.
+ * @param {function(string, *)} iteratorFn
+ * @returns {function(*, string)}
+ */
+function reverseParams(iteratorFn) {
+ return function(value, key) {iteratorFn(key, value);};
+}
+
+/**
+ * A consistent way of creating unique IDs in angular.
+ *
+ * Using simple numbers allows us to generate 28.6 million unique ids per second for 10 years before
+ * we hit number precision issues in JavaScript.
+ *
+ * Math.pow(2,53) / 60 / 60 / 24 / 365 / 10 = 28.6M
+ *
+ * @returns {number} an unique alpha-numeric string
+ */
+function nextUid() {
+ return ++uid;
+}
+
+
+/**
+ * Set or clear the hashkey for an object.
+ * @param obj object
+ * @param h the hashkey (!truthy to delete the hashkey)
+ */
+function setHashKey(obj, h) {
+ if (h) {
+ obj.$$hashKey = h;
+ } else {
+ delete obj.$$hashKey;
+ }
+}
+
+
+function baseExtend(dst, objs, deep) {
+ var h = dst.$$hashKey;
+
+ for (var i = 0, ii = objs.length; i < ii; ++i) {
+ var obj = objs[i];
+ if (!isObject(obj) && !isFunction(obj)) continue;
+ var keys = Object.keys(obj);
+ for (var j = 0, jj = keys.length; j < jj; j++) {
+ var key = keys[j];
+ var src = obj[key];
+
+ if (deep && isObject(src)) {
+ if (isDate(src)) {
+ dst[key] = new Date(src.valueOf());
+ } else if (isRegExp(src)) {
+ dst[key] = new RegExp(src);
+ } else if (src.nodeName) {
+ dst[key] = src.cloneNode(true);
+ } else if (isElement(src)) {
+ dst[key] = src.clone();
+ } else {
+ if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
+ baseExtend(dst[key], [src], true);
+ }
+ } else {
+ dst[key] = src;
+ }
+ }
+ }
+
+ setHashKey(dst, h);
+ return dst;
+}
+
+/**
+ * @ngdoc function
+ * @name angular.extend
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s)
+ * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so
+ * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`.
+ *
+ * **Note:** Keep in mind that `angular.extend` does not support recursive merge (deep copy). Use
+ * {@link angular.merge} for this.
+ *
+ * @param {Object} dst Destination object.
+ * @param {...Object} src Source object(s).
+ * @returns {Object} Reference to `dst`.
+ */
+function extend(dst) {
+ return baseExtend(dst, slice.call(arguments, 1), false);
+}
+
+
+/**
+* @ngdoc function
+* @name angular.merge
+* @module ng
+* @kind function
+*
+* @description
+* Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s)
+* to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so
+* by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`.
+*
+* Unlike {@link angular.extend extend()}, `merge()` recursively descends into object properties of source
+* objects, performing a deep copy.
+*
+* @param {Object} dst Destination object.
+* @param {...Object} src Source object(s).
+* @returns {Object} Reference to `dst`.
+*/
+function merge(dst) {
+ return baseExtend(dst, slice.call(arguments, 1), true);
+}
+
+
+
+function toInt(str) {
+ return parseInt(str, 10);
+}
+
+
+function inherit(parent, extra) {
+ return extend(Object.create(parent), extra);
+}
+
+/**
+ * @ngdoc function
+ * @name angular.noop
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * A function that performs no operations. This function can be useful when writing code in the
+ * functional style.
+ ```js
+ function foo(callback) {
+ var result = calculateResult();
+ (callback || angular.noop)(result);
+ }
+ ```
+ */
+function noop() {}
+noop.$inject = [];
+
+
+/**
+ * @ngdoc function
+ * @name angular.identity
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * A function that returns its first argument. This function is useful when writing code in the
+ * functional style.
+ *
+ ```js
+ function transformer(transformationFn, value) {
+ return (transformationFn || angular.identity)(value);
+ };
+ ```
+ * @param {*} value to be returned.
+ * @returns {*} the value passed in.
+ */
+function identity($) {return $;}
+identity.$inject = [];
+
+
+function valueFn(value) {return function() {return value;};}
+
+function hasCustomToString(obj) {
+ return isFunction(obj.toString) && obj.toString !== toString;
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isUndefined
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is undefined.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is undefined.
+ */
+function isUndefined(value) {return typeof value === 'undefined';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isDefined
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is defined.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is defined.
+ */
+function isDefined(value) {return typeof value !== 'undefined';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isObject
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not
+ * considered to be objects. Note that JavaScript arrays are objects.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is an `Object` but not `null`.
+ */
+function isObject(value) {
+ // http://jsperf.com/isobject4
+ return value !== null && typeof value === 'object';
+}
+
+
+/**
+ * Determine if a value is an object with a null prototype
+ *
+ * @returns {boolean} True if `value` is an `Object` with a null prototype
+ */
+function isBlankObject(value) {
+ return value !== null && typeof value === 'object' && !getPrototypeOf(value);
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isString
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `String`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `String`.
+ */
+function isString(value) {return typeof value === 'string';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isNumber
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `Number`.
+ *
+ * This includes the "special" numbers `NaN`, `+Infinity` and `-Infinity`.
+ *
+ * If you wish to exclude these then you can use the native
+ * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite)
+ * method.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Number`.
+ */
+function isNumber(value) {return typeof value === 'number';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isDate
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a value is a date.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Date`.
+ */
+function isDate(value) {
+ return toString.call(value) === '[object Date]';
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isArray
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is an `Array`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is an `Array`.
+ */
+var isArray = Array.isArray;
+
+/**
+ * @ngdoc function
+ * @name angular.isFunction
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `Function`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Function`.
+ */
+function isFunction(value) {return typeof value === 'function';}
+
+
+/**
+ * Determines if a value is a regular expression object.
+ *
+ * @private
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `RegExp`.
+ */
+function isRegExp(value) {
+ return toString.call(value) === '[object RegExp]';
+}
+
+
+/**
+ * Checks if `obj` is a window object.
+ *
+ * @private
+ * @param {*} obj Object to check
+ * @returns {boolean} True if `obj` is a window obj.
+ */
+function isWindow(obj) {
+ return obj && obj.window === obj;
+}
+
+
+function isScope(obj) {
+ return obj && obj.$evalAsync && obj.$watch;
+}
+
+
+function isFile(obj) {
+ return toString.call(obj) === '[object File]';
+}
+
+
+function isFormData(obj) {
+ return toString.call(obj) === '[object FormData]';
+}
+
+
+function isBlob(obj) {
+ return toString.call(obj) === '[object Blob]';
+}
+
+
+function isBoolean(value) {
+ return typeof value === 'boolean';
+}
+
+
+function isPromiseLike(obj) {
+ return obj && isFunction(obj.then);
+}
+
+
+var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/;
+function isTypedArray(value) {
+ return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value));
+}
+
+function isArrayBuffer(obj) {
+ return toString.call(obj) === '[object ArrayBuffer]';
+}
+
+
+var trim = function(value) {
+ return isString(value) ? value.trim() : value;
+};
+
+// Copied from:
+// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021
+// Prereq: s is a string.
+var escapeForRegexp = function(s) {
+ return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1').
+ replace(/\x08/g, '\\x08');
+};
+
+
+/**
+ * @ngdoc function
+ * @name angular.isElement
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a DOM element (or wrapped jQuery element).
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).
+ */
+function isElement(node) {
+ return !!(node &&
+ (node.nodeName // we are a direct element
+ || (node.prop && node.attr && node.find))); // we have an on and find method part of jQuery API
+}
+
+/**
+ * @param str 'key1,key2,...'
+ * @returns {object} in the form of {key1:true, key2:true, ...}
+ */
+function makeMap(str) {
+ var obj = {}, items = str.split(','), i;
+ for (i = 0; i < items.length; i++) {
+ obj[items[i]] = true;
+ }
+ return obj;
+}
+
+
+function nodeName_(element) {
+ return lowercase(element.nodeName || (element[0] && element[0].nodeName));
+}
+
+function includes(array, obj) {
+ return Array.prototype.indexOf.call(array, obj) != -1;
+}
+
+function arrayRemove(array, value) {
+ var index = array.indexOf(value);
+ if (index >= 0) {
+ array.splice(index, 1);
+ }
+ return index;
+}
+
+/**
+ * @ngdoc function
+ * @name angular.copy
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Creates a deep copy of `source`, which should be an object or an array.
+ *
+ * * If no destination is supplied, a copy of the object or array is created.
+ * * If a destination is provided, all of its elements (for arrays) or properties (for objects)
+ * are deleted and then all elements/properties from the source are copied to it.
+ * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.
+ * * If `source` is identical to 'destination' an exception will be thrown.
+ *
+ * @param {*} source The source that will be used to make a copy.
+ * Can be any type, including primitives, `null`, and `undefined`.
+ * @param {(Object|Array)=} destination Destination into which the source is copied. If
+ * provided, must be of the same type as `source`.
+ * @returns {*} The copy or updated `destination`, if `destination` was specified.
+ *
+ * @example
+ <example module="copyExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form novalidate class="simple-form">
+ Name: <input type="text" ng-model="user.name" /><br />
+ E-mail: <input type="email" ng-model="user.email" /><br />
+ Gender: <input type="radio" ng-model="user.gender" value="male" />male
+ <input type="radio" ng-model="user.gender" value="female" />female<br />
+ <button ng-click="reset()">RESET</button>
+ <button ng-click="update(user)">SAVE</button>
+ </form>
+ <pre>form = {{user | json}}</pre>
+ <pre>master = {{master | json}}</pre>
+ </div>
+
+ <script>
+ angular.module('copyExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.master= {};
+
+ $scope.update = function(user) {
+ // Example with 1 argument
+ $scope.master= angular.copy(user);
+ };
+
+ $scope.reset = function() {
+ // Example with 2 arguments
+ angular.copy($scope.master, $scope.user);
+ };
+
+ $scope.reset();
+ }]);
+ </script>
+ </file>
+ </example>
+ */
+function copy(source, destination) {
+ var stackSource = [];
+ var stackDest = [];
+
+ if (destination) {
+ if (isTypedArray(destination) || isArrayBuffer(destination)) {
+ throw ngMinErr('cpta', "Can't copy! TypedArray destination cannot be mutated.");
+ }
+ if (source === destination) {
+ throw ngMinErr('cpi', "Can't copy! Source and destination are identical.");
+ }
+
+ // Empty the destination object
+ if (isArray(destination)) {
+ destination.length = 0;
+ } else {
+ forEach(destination, function(value, key) {
+ if (key !== '$$hashKey') {
+ delete destination[key];
+ }
+ });
+ }
+
+ stackSource.push(source);
+ stackDest.push(destination);
+ return copyRecurse(source, destination);
+ }
+
+ return copyElement(source);
+
+ function copyRecurse(source, destination) {
+ var h = destination.$$hashKey;
+ var result, key;
+ if (isArray(source)) {
+ for (var i = 0, ii = source.length; i < ii; i++) {
+ destination.push(copyElement(source[i]));
+ }
+ } else if (isBlankObject(source)) {
+ // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
+ for (key in source) {
+ destination[key] = copyElement(source[key]);
+ }
+ } else if (source && typeof source.hasOwnProperty === 'function') {
+ // Slow path, which must rely on hasOwnProperty
+ for (key in source) {
+ if (source.hasOwnProperty(key)) {
+ destination[key] = copyElement(source[key]);
+ }
+ }
+ } else {
+ // Slowest path --- hasOwnProperty can't be called as a method
+ for (key in source) {
+ if (hasOwnProperty.call(source, key)) {
+ destination[key] = copyElement(source[key]);
+ }
+ }
+ }
+ setHashKey(destination, h);
+ return destination;
+ }
+
+ function copyElement(source) {
+ // Simple values
+ if (!isObject(source)) {
+ return source;
+ }
+
+ // Already copied values
+ var index = stackSource.indexOf(source);
+ if (index !== -1) {
+ return stackDest[index];
+ }
+
+ if (isWindow(source) || isScope(source)) {
+ throw ngMinErr('cpws',
+ "Can't copy! Making copies of Window or Scope instances is not supported.");
+ }
+
+ var needsRecurse = false;
+ var destination = copyType(source);
+
+ if (destination === undefined) {
+ destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));
+ needsRecurse = true;
+ }
+
+ stackSource.push(source);
+ stackDest.push(destination);
+
+ return needsRecurse
+ ? copyRecurse(source, destination)
+ : destination;
+ }
+
+ function copyType(source) {
+ switch (toString.call(source)) {
+ case '[object Int8Array]':
+ case '[object Int16Array]':
+ case '[object Int32Array]':
+ case '[object Float32Array]':
+ case '[object Float64Array]':
+ case '[object Uint8Array]':
+ case '[object Uint8ClampedArray]':
+ case '[object Uint16Array]':
+ case '[object Uint32Array]':
+ return new source.constructor(copyElement(source.buffer));
+
+ case '[object ArrayBuffer]':
+ //Support: IE10
+ if (!source.slice) {
+ var copied = new ArrayBuffer(source.byteLength);
+ new Uint8Array(copied).set(new Uint8Array(source));
+ return copied;
+ }
+ return source.slice(0);
+
+ case '[object Boolean]':
+ case '[object Number]':
+ case '[object String]':
+ case '[object Date]':
+ return new source.constructor(source.valueOf());
+
+ case '[object RegExp]':
+ var re = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
+ re.lastIndex = source.lastIndex;
+ return re;
+ }
+
+ if (isFunction(source.cloneNode)) {
+ return source.cloneNode(true);
+ }
+ }
+}
+
+/**
+ * Creates a shallow copy of an object, an array or a primitive.
+ *
+ * Assumes that there are no proto properties for objects.
+ */
+function shallowCopy(src, dst) {
+ if (isArray(src)) {
+ dst = dst || [];
+
+ for (var i = 0, ii = src.length; i < ii; i++) {
+ dst[i] = src[i];
+ }
+ } else if (isObject(src)) {
+ dst = dst || {};
+
+ for (var key in src) {
+ if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
+ dst[key] = src[key];
+ }
+ }
+ }
+
+ return dst || src;
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.equals
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if two objects or two values are equivalent. Supports value types, regular
+ * expressions, arrays and objects.
+ *
+ * Two objects or values are considered equivalent if at least one of the following is true:
+ *
+ * * Both objects or values pass `===` comparison.
+ * * Both objects or values are of the same type and all of their properties are equal by
+ * comparing them with `angular.equals`.
+ * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal)
+ * * Both values represent the same regular expression (In JavaScript,
+ * /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual
+ * representation matches).
+ *
+ * During a property comparison, properties of `function` type and properties with names
+ * that begin with `$` are ignored.
+ *
+ * Scope and DOMWindow objects are being compared only by identify (`===`).
+ *
+ * @param {*} o1 Object or value to compare.
+ * @param {*} o2 Object or value to compare.
+ * @returns {boolean} True if arguments are equal.
+ */
+function equals(o1, o2) {
+ if (o1 === o2) return true;
+ if (o1 === null || o2 === null) return false;
+ if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
+ var t1 = typeof o1, t2 = typeof o2, length, key, keySet;
+ if (t1 == t2 && t1 == 'object') {
+ if (isArray(o1)) {
+ if (!isArray(o2)) return false;
+ if ((length = o1.length) == o2.length) {
+ for (key = 0; key < length; key++) {
+ if (!equals(o1[key], o2[key])) return false;
+ }
+ return true;
+ }
+ } else if (isDate(o1)) {
+ if (!isDate(o2)) return false;
+ return equals(o1.getTime(), o2.getTime());
+ } else if (isRegExp(o1)) {
+ if (!isRegExp(o2)) return false;
+ return o1.toString() == o2.toString();
+ } else {
+ if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||
+ isArray(o2) || isDate(o2) || isRegExp(o2)) return false;
+ keySet = createMap();
+ for (key in o1) {
+ if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
+ if (!equals(o1[key], o2[key])) return false;
+ keySet[key] = true;
+ }
+ for (key in o2) {
+ if (!(key in keySet) &&
+ key.charAt(0) !== '$' &&
+ isDefined(o2[key]) &&
+ !isFunction(o2[key])) return false;
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+var csp = function() {
+ if (!isDefined(csp.rules)) {
+
+
+ var ngCspElement = (document.querySelector('[ng-csp]') ||
+ document.querySelector('[data-ng-csp]'));
+
+ if (ngCspElement) {
+ var ngCspAttribute = ngCspElement.getAttribute('ng-csp') ||
+ ngCspElement.getAttribute('data-ng-csp');
+ csp.rules = {
+ noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1),
+ noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1)
+ };
+ } else {
+ csp.rules = {
+ noUnsafeEval: noUnsafeEval(),
+ noInlineStyle: false
+ };
+ }
+ }
+
+ return csp.rules;
+
+ function noUnsafeEval() {
+ try {
+ /* jshint -W031, -W054 */
+ new Function('');
+ /* jshint +W031, +W054 */
+ return false;
+ } catch (e) {
+ return true;
+ }
+ }
+};
+
+/**
+ * @ngdoc directive
+ * @module ng
+ * @name ngJq
+ *
+ * @element ANY
+ * @param {string=} ngJq the name of the library available under `window`
+ * to be used for angular.element
+ * @description
+ * Use this directive to force the angular.element library. This should be
+ * used to force either jqLite by leaving ng-jq blank or setting the name of
+ * the jquery variable under window (eg. jQuery).
+ *
+ * Since angular looks for this directive when it is loaded (doesn't wait for the
+ * DOMContentLoaded event), it must be placed on an element that comes before the script
+ * which loads angular. Also, only the first instance of `ng-jq` will be used and all
+ * others ignored.
+ *
+ * @example
+ * This example shows how to force jqLite using the `ngJq` directive to the `html` tag.
+ ```html
+ <!doctype html>
+ <html ng-app ng-jq>
+ ...
+ ...
+ </html>
+ ```
+ * @example
+ * This example shows how to use a jQuery based library of a different name.
+ * The library name must be available at the top most 'window'.
+ ```html
+ <!doctype html>
+ <html ng-app ng-jq="jQueryLib">
+ ...
+ ...
+ </html>
+ ```
+ */
+var jq = function() {
+ if (isDefined(jq.name_)) return jq.name_;
+ var el;
+ var i, ii = ngAttrPrefixes.length, prefix, name;
+ for (i = 0; i < ii; ++i) {
+ prefix = ngAttrPrefixes[i];
+ if (el = document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]')) {
+ name = el.getAttribute(prefix + 'jq');
+ break;
+ }
+ }
+
+ return (jq.name_ = name);
+};
+
+function concat(array1, array2, index) {
+ return array1.concat(slice.call(array2, index));
+}
+
+function sliceArgs(args, startIndex) {
+ return slice.call(args, startIndex || 0);
+}
+
+
+/* jshint -W101 */
+/**
+ * @ngdoc function
+ * @name angular.bind
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for
+ * `fn`). You can supply optional `args` that are prebound to the function. This feature is also
+ * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as
+ * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application).
+ *
+ * @param {Object} self Context which `fn` should be evaluated in.
+ * @param {function()} fn Function to be bound.
+ * @param {...*} args Optional arguments to be prebound to the `fn` function call.
+ * @returns {function()} Function that wraps the `fn` with all the specified bindings.
+ */
+/* jshint +W101 */
+function bind(self, fn) {
+ var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
+ if (isFunction(fn) && !(fn instanceof RegExp)) {
+ return curryArgs.length
+ ? function() {
+ return arguments.length
+ ? fn.apply(self, concat(curryArgs, arguments, 0))
+ : fn.apply(self, curryArgs);
+ }
+ : function() {
+ return arguments.length
+ ? fn.apply(self, arguments)
+ : fn.call(self);
+ };
+ } else {
+ // in IE, native methods are not functions so they cannot be bound (note: they don't need to be)
+ return fn;
+ }
+}
+
+
+function toJsonReplacer(key, value) {
+ var val = value;
+
+ if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {
+ val = undefined;
+ } else if (isWindow(value)) {
+ val = '$WINDOW';
+ } else if (value && document === value) {
+ val = '$DOCUMENT';
+ } else if (isScope(value)) {
+ val = '$SCOPE';
+ }
+
+ return val;
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.toJson
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be
+ * stripped since angular uses this notation internally.
+ *
+ * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.
+ * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace.
+ * If set to an integer, the JSON output will contain that many spaces per indentation.
+ * @returns {string|undefined} JSON-ified string representing `obj`.
+ */
+function toJson(obj, pretty) {
+ if (isUndefined(obj)) return undefined;
+ if (!isNumber(pretty)) {
+ pretty = pretty ? 2 : null;
+ }
+ return JSON.stringify(obj, toJsonReplacer, pretty);
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.fromJson
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Deserializes a JSON string.
+ *
+ * @param {string} json JSON string to deserialize.
+ * @returns {Object|Array|string|number} Deserialized JSON string.
+ */
+function fromJson(json) {
+ return isString(json)
+ ? JSON.parse(json)
+ : json;
+}
+
+
+var ALL_COLONS = /:/g;
+function timezoneToOffset(timezone, fallback) {
+ // IE/Edge do not "understand" colon (`:`) in timezone
+ timezone = timezone.replace(ALL_COLONS, '');
+ var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
+ return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
+}
+
+
+function addDateMinutes(date, minutes) {
+ date = new Date(date.getTime());
+ date.setMinutes(date.getMinutes() + minutes);
+ return date;
+}
+
+
+function convertTimezoneToLocal(date, timezone, reverse) {
+ reverse = reverse ? -1 : 1;
+ var dateTimezoneOffset = date.getTimezoneOffset();
+ var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
+ return addDateMinutes(date, reverse * (timezoneOffset - dateTimezoneOffset));
+}
+
+
+/**
+ * @returns {string} Returns the string representation of the element.
+ */
+function startingTag(element) {
+ element = jqLite(element).clone();
+ try {
+ // turns out IE does not let you set .html() on elements which
+ // are not allowed to have children. So we just ignore it.
+ element.empty();
+ } catch (e) {}
+ var elemHtml = jqLite('<div>').append(element).html();
+ try {
+ return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :
+ elemHtml.
+ match(/^(<[^>]+>)/)[1].
+ replace(/^<([\w\-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});
+ } catch (e) {
+ return lowercase(elemHtml);
+ }
+
+}
+
+
+/////////////////////////////////////////////////
+
+/**
+ * Tries to decode the URI component without throwing an exception.
+ *
+ * @private
+ * @param str value potential URI component to check.
+ * @returns {boolean} True if `value` can be decoded
+ * with the decodeURIComponent function.
+ */
+function tryDecodeURIComponent(value) {
+ try {
+ return decodeURIComponent(value);
+ } catch (e) {
+ // Ignore any invalid uri component
+ }
+}
+
+
+/**
+ * Parses an escaped url query string into key-value pairs.
+ * @returns {Object.<string,boolean|Array>}
+ */
+function parseKeyValue(/**string*/keyValue) {
+ var obj = {};
+ forEach((keyValue || "").split('&'), function(keyValue) {
+ var splitPoint, key, val;
+ if (keyValue) {
+ key = keyValue = keyValue.replace(/\+/g,'%20');
+ splitPoint = keyValue.indexOf('=');
+ if (splitPoint !== -1) {
+ key = keyValue.substring(0, splitPoint);
+ val = keyValue.substring(splitPoint + 1);
+ }
+ key = tryDecodeURIComponent(key);
+ if (isDefined(key)) {
+ val = isDefined(val) ? tryDecodeURIComponent(val) : true;
+ if (!hasOwnProperty.call(obj, key)) {
+ obj[key] = val;
+ } else if (isArray(obj[key])) {
+ obj[key].push(val);
+ } else {
+ obj[key] = [obj[key],val];
+ }
+ }
+ }
+ });
+ return obj;
+}
+
+function toKeyValue(obj) {
+ var parts = [];
+ forEach(obj, function(value, key) {
+ if (isArray(value)) {
+ forEach(value, function(arrayValue) {
+ parts.push(encodeUriQuery(key, true) +
+ (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));
+ });
+ } else {
+ parts.push(encodeUriQuery(key, true) +
+ (value === true ? '' : '=' + encodeUriQuery(value, true)));
+ }
+ });
+ return parts.length ? parts.join('&') : '';
+}
+
+
+/**
+ * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
+ * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
+ * segments:
+ * segment = *pchar
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+function encodeUriSegment(val) {
+ return encodeUriQuery(val, true).
+ replace(/%26/gi, '&').
+ replace(/%3D/gi, '=').
+ replace(/%2B/gi, '+');
+}
+
+
+/**
+ * This method is intended for encoding *key* or *value* parts of query component. We need a custom
+ * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be
+ * encoded per http://tools.ietf.org/html/rfc3986:
+ * query = *( pchar / "/" / "?" )
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+function encodeUriQuery(val, pctEncodeSpaces) {
+ return encodeURIComponent(val).
+ replace(/%40/gi, '@').
+ replace(/%3A/gi, ':').
+ replace(/%24/g, '$').
+ replace(/%2C/gi, ',').
+ replace(/%3B/gi, ';').
+ replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
+}
+
+var ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-'];
+
+function getNgAttribute(element, ngAttr) {
+ var attr, i, ii = ngAttrPrefixes.length;
+ for (i = 0; i < ii; ++i) {
+ attr = ngAttrPrefixes[i] + ngAttr;
+ if (isString(attr = element.getAttribute(attr))) {
+ return attr;
+ }
+ }
+ return null;
+}
+
+/**
+ * @ngdoc directive
+ * @name ngApp
+ * @module ng
+ *
+ * @element ANY
+ * @param {angular.Module} ngApp an optional application
+ * {@link angular.module module} name to load.
+ * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be
+ * created in "strict-di" mode. This means that the application will fail to invoke functions which
+ * do not use explicit function annotation (and are thus unsuitable for minification), as described
+ * in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in
+ * tracking down the root of these bugs.
+ *
+ * @description
+ *
+ * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive
+ * designates the **root element** of the application and is typically placed near the root element
+ * of the page - e.g. on the `<body>` or `<html>` tags.
+ *
+ * Only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`
+ * found in the document will be used to define the root element to auto-bootstrap as an
+ * application. To run multiple applications in an HTML document you must manually bootstrap them using
+ * {@link angular.bootstrap} instead. AngularJS applications cannot be nested within each other.
+ *
+ * You can specify an **AngularJS module** to be used as the root module for the application. This
+ * module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It
+ * should contain the application code needed or have dependencies on other modules that will
+ * contain the code. See {@link angular.module} for more information.
+ *
+ * In the example below if the `ngApp` directive were not placed on the `html` element then the
+ * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`
+ * would not be resolved to `3`.
+ *
+ * `ngApp` is the easiest, and most common way to bootstrap an application.
+ *
+ <example module="ngAppDemo">
+ <file name="index.html">
+ <div ng-controller="ngAppDemoController">
+ I can add: {{a}} + {{b}} = {{ a+b }}
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {
+ $scope.a = 1;
+ $scope.b = 2;
+ });
+ </file>
+ </example>
+ *
+ * Using `ngStrictDi`, you would see something like this:
+ *
+ <example ng-app-included="true">
+ <file name="index.html">
+ <div ng-app="ngAppStrictDemo" ng-strict-di>
+ <div ng-controller="GoodController1">
+ I can add: {{a}} + {{b}} = {{ a+b }}
+
+ <p>This renders because the controller does not fail to
+ instantiate, by using explicit annotation style (see
+ script.js for details)
+ </p>
+ </div>
+
+ <div ng-controller="GoodController2">
+ Name: <input ng-model="name"><br />
+ Hello, {{name}}!
+
+ <p>This renders because the controller does not fail to
+ instantiate, by using explicit annotation style
+ (see script.js for details)
+ </p>
+ </div>
+
+ <div ng-controller="BadController">
+ I can add: {{a}} + {{b}} = {{ a+b }}
+
+ <p>The controller could not be instantiated, due to relying
+ on automatic function annotations (which are disabled in
+ strict mode). As such, the content of this section is not
+ interpolated, and there should be an error in your web console.
+ </p>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('ngAppStrictDemo', [])
+ // BadController will fail to instantiate, due to relying on automatic function annotation,
+ // rather than an explicit annotation
+ .controller('BadController', function($scope) {
+ $scope.a = 1;
+ $scope.b = 2;
+ })
+ // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated,
+ // due to using explicit annotations using the array style and $inject property, respectively.
+ .controller('GoodController1', ['$scope', function($scope) {
+ $scope.a = 1;
+ $scope.b = 2;
+ }])
+ .controller('GoodController2', GoodController2);
+ function GoodController2($scope) {
+ $scope.name = "World";
+ }
+ GoodController2.$inject = ['$scope'];
+ </file>
+ <file name="style.css">
+ div[ng-controller] {
+ margin-bottom: 1em;
+ -webkit-border-radius: 4px;
+ border-radius: 4px;
+ border: 1px solid;
+ padding: .5em;
+ }
+ div[ng-controller^=Good] {
+ border-color: #d6e9c6;
+ background-color: #dff0d8;
+ color: #3c763d;
+ }
+ div[ng-controller^=Bad] {
+ border-color: #ebccd1;
+ background-color: #f2dede;
+ color: #a94442;
+ margin-bottom: 0;
+ }
+ </file>
+ </example>
+ */
+function angularInit(element, bootstrap) {
+ var appElement,
+ module,
+ config = {};
+
+ // The element `element` has priority over any other element
+ forEach(ngAttrPrefixes, function(prefix) {
+ var name = prefix + 'app';
+
+ if (!appElement && element.hasAttribute && element.hasAttribute(name)) {
+ appElement = element;
+ module = element.getAttribute(name);
+ }
+ });
+ forEach(ngAttrPrefixes, function(prefix) {
+ var name = prefix + 'app';
+ var candidate;
+
+ if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) {
+ appElement = candidate;
+ module = candidate.getAttribute(name);
+ }
+ });
+ if (appElement) {
+ config.strictDi = getNgAttribute(appElement, "strict-di") !== null;
+ bootstrap(appElement, module ? [module] : [], config);
+ }
+}
+
+/**
+ * @ngdoc function
+ * @name angular.bootstrap
+ * @module ng
+ * @description
+ * Use this function to manually start up angular application.
+ *
+ * See: {@link guide/bootstrap Bootstrap}
+ *
+ * Note that Protractor based end-to-end tests cannot use this function to bootstrap manually.
+ * They must use {@link ng.directive:ngApp ngApp}.
+ *
+ * Angular will detect if it has been loaded into the browser more than once and only allow the
+ * first loaded script to be bootstrapped and will report a warning to the browser console for
+ * each of the subsequent scripts. This prevents strange results in applications, where otherwise
+ * multiple instances of Angular try to work on the DOM.
+ *
+ * ```html
+ * <!doctype html>
+ * <html>
+ * <body>
+ * <div ng-controller="WelcomeController">
+ * {{greeting}}
+ * </div>
+ *
+ * <script src="angular.js"></script>
+ * <script>
+ * var app = angular.module('demo', [])
+ * .controller('WelcomeController', function($scope) {
+ * $scope.greeting = 'Welcome!';
+ * });
+ * angular.bootstrap(document, ['demo']);
+ * </script>
+ * </body>
+ * </html>
+ * ```
+ *
+ * @param {DOMElement} element DOM element which is the root of angular application.
+ * @param {Array<String|Function|Array>=} modules an array of modules to load into the application.
+ * Each item in the array should be the name of a predefined module or a (DI annotated)
+ * function that will be invoked by the injector as a `config` block.
+ * See: {@link angular.module modules}
+ * @param {Object=} config an object for defining configuration options for the application. The
+ * following keys are supported:
+ *
+ * * `strictDi` - disable automatic function annotation for the application. This is meant to
+ * assist in finding bugs which break minified code. Defaults to `false`.
+ *
+ * @returns {auto.$injector} Returns the newly created injector for this app.
+ */
+function bootstrap(element, modules, config) {
+ if (!isObject(config)) config = {};
+ var defaultConfig = {
+ strictDi: false
+ };
+ config = extend(defaultConfig, config);
+ var doBootstrap = function() {
+ element = jqLite(element);
+
+ if (element.injector()) {
+ var tag = (element[0] === document) ? 'document' : startingTag(element);
+ //Encode angle brackets to prevent input from being sanitized to empty string #8683
+ throw ngMinErr(
+ 'btstrpd',
+ "App Already Bootstrapped with this Element '{0}'",
+ tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
+ }
+
+ modules = modules || [];
+ modules.unshift(['$provide', function($provide) {
+ $provide.value('$rootElement', element);
+ }]);
+
+ if (config.debugInfoEnabled) {
+ // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`.
+ modules.push(['$compileProvider', function($compileProvider) {
+ $compileProvider.debugInfoEnabled(true);
+ }]);
+ }
+
+ modules.unshift('ng');
+ var injector = createInjector(modules, config.strictDi);
+ injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
+ function bootstrapApply(scope, element, compile, injector) {
+ scope.$apply(function() {
+ element.data('$injector', injector);
+ compile(element)(scope);
+ });
+ }]
+ );
+ return injector;
+ };
+
+ var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;
+ var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
+
+ if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {
+ config.debugInfoEnabled = true;
+ window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, '');
+ }
+
+ if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
+ return doBootstrap();
+ }
+
+ window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
+ angular.resumeBootstrap = function(extraModules) {
+ forEach(extraModules, function(module) {
+ modules.push(module);
+ });
+ return doBootstrap();
+ };
+
+ if (isFunction(angular.resumeDeferredBootstrap)) {
+ angular.resumeDeferredBootstrap();
+ }
+}
+
+/**
+ * @ngdoc function
+ * @name angular.reloadWithDebugInfo
+ * @module ng
+ * @description
+ * Use this function to reload the current application with debug information turned on.
+ * This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`.
+ *
+ * See {@link ng.$compileProvider#debugInfoEnabled} for more.
+ */
+function reloadWithDebugInfo() {
+ window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name;
+ window.location.reload();
+}
+
+/**
+ * @name angular.getTestability
+ * @module ng
+ * @description
+ * Get the testability service for the instance of Angular on the given
+ * element.
+ * @param {DOMElement} element DOM element which is the root of angular application.
+ */
+function getTestability(rootElement) {
+ var injector = angular.element(rootElement).injector();
+ if (!injector) {
+ throw ngMinErr('test',
+ 'no injector found for element argument to getTestability');
+ }
+ return injector.get('$$testability');
+}
+
+var SNAKE_CASE_REGEXP = /[A-Z]/g;
+function snake_case(name, separator) {
+ separator = separator || '_';
+ return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
+ return (pos ? separator : '') + letter.toLowerCase();
+ });
+}
+
+var bindJQueryFired = false;
+function bindJQuery() {
+ var originalCleanData;
+
+ if (bindJQueryFired) {
+ return;
+ }
+
+ // bind to jQuery if present;
+ var jqName = jq();
+ jQuery = isUndefined(jqName) ? window.jQuery : // use jQuery (if present)
+ !jqName ? undefined : // use jqLite
+ window[jqName]; // use jQuery specified by `ngJq`
+
+ // Use jQuery if it exists with proper functionality, otherwise default to us.
+ // Angular 1.2+ requires jQuery 1.7+ for on()/off() support.
+ // Angular 1.3+ technically requires at least jQuery 2.1+ but it may work with older
+ // versions. It will not work for sure with jQuery <1.7, though.
+ if (jQuery && jQuery.fn.on) {
+ jqLite = jQuery;
+ extend(jQuery.fn, {
+ scope: JQLitePrototype.scope,
+ isolateScope: JQLitePrototype.isolateScope,
+ controller: JQLitePrototype.controller,
+ injector: JQLitePrototype.injector,
+ inheritedData: JQLitePrototype.inheritedData
+ });
+
+ // All nodes removed from the DOM via various jQuery APIs like .remove()
+ // are passed through jQuery.cleanData. Monkey-patch this method to fire
+ // the $destroy event on all removed nodes.
+ originalCleanData = jQuery.cleanData;
+ jQuery.cleanData = function(elems) {
+ var events;
+ for (var i = 0, elem; (elem = elems[i]) != null; i++) {
+ events = jQuery._data(elem, "events");
+ if (events && events.$destroy) {
+ jQuery(elem).triggerHandler('$destroy');
+ }
+ }
+ originalCleanData(elems);
+ };
+ } else {
+ jqLite = JQLite;
+ }
+
+ angular.element = jqLite;
+
+ // Prevent double-proxying.
+ bindJQueryFired = true;
+}
+
+/**
+ * throw error if the argument is falsy.
+ */
+function assertArg(arg, name, reason) {
+ if (!arg) {
+ throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
+ }
+ return arg;
+}
+
+function assertArgFn(arg, name, acceptArrayAnnotation) {
+ if (acceptArrayAnnotation && isArray(arg)) {
+ arg = arg[arg.length - 1];
+ }
+
+ assertArg(isFunction(arg), name, 'not a function, got ' +
+ (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg));
+ return arg;
+}
+
+/**
+ * throw error if the name given is hasOwnProperty
+ * @param {String} name the name to test
+ * @param {String} context the context in which the name is used, such as module or directive
+ */
+function assertNotHasOwnProperty(name, context) {
+ if (name === 'hasOwnProperty') {
+ throw ngMinErr('badname', "hasOwnProperty is not a valid {0} name", context);
+ }
+}
+
+/**
+ * Return the value accessible from the object by path. Any undefined traversals are ignored
+ * @param {Object} obj starting object
+ * @param {String} path path to traverse
+ * @param {boolean} [bindFnToScope=true]
+ * @returns {Object} value as accessible by path
+ */
+//TODO(misko): this function needs to be removed
+function getter(obj, path, bindFnToScope) {
+ if (!path) return obj;
+ var keys = path.split('.');
+ var key;
+ var lastInstance = obj;
+ var len = keys.length;
+
+ for (var i = 0; i < len; i++) {
+ key = keys[i];
+ if (obj) {
+ obj = (lastInstance = obj)[key];
+ }
+ }
+ if (!bindFnToScope && isFunction(obj)) {
+ return bind(lastInstance, obj);
+ }
+ return obj;
+}
+
+/**
+ * Return the DOM siblings between the first and last node in the given array.
+ * @param {Array} array like object
+ * @returns {Array} the inputted object or a jqLite collection containing the nodes
+ */
+function getBlockNodes(nodes) {
+ // TODO(perf): update `nodes` instead of creating a new object?
+ var node = nodes[0];
+ var endNode = nodes[nodes.length - 1];
+ var blockNodes;
+
+ for (var i = 1; node !== endNode && (node = node.nextSibling); i++) {
+ if (blockNodes || nodes[i] !== node) {
+ if (!blockNodes) {
+ blockNodes = jqLite(slice.call(nodes, 0, i));
+ }
+ blockNodes.push(node);
+ }
+ }
+
+ return blockNodes || nodes;
+}
+
+
+/**
+ * Creates a new object without a prototype. This object is useful for lookup without having to
+ * guard against prototypically inherited properties via hasOwnProperty.
+ *
+ * Related micro-benchmarks:
+ * - http://jsperf.com/object-create2
+ * - http://jsperf.com/proto-map-lookup/2
+ * - http://jsperf.com/for-in-vs-object-keys2
+ *
+ * @returns {Object}
+ */
+function createMap() {
+ return Object.create(null);
+}
+
+var NODE_TYPE_ELEMENT = 1;
+var NODE_TYPE_ATTRIBUTE = 2;
+var NODE_TYPE_TEXT = 3;
+var NODE_TYPE_COMMENT = 8;
+var NODE_TYPE_DOCUMENT = 9;
+var NODE_TYPE_DOCUMENT_FRAGMENT = 11;
+
+/**
+ * @ngdoc type
+ * @name angular.Module
+ * @module ng
+ * @description
+ *
+ * Interface for configuring angular {@link angular.module modules}.
+ */
+
+function setupModuleLoader(window) {
+
+ var $injectorMinErr = minErr('$injector');
+ var ngMinErr = minErr('ng');
+
+ function ensure(obj, name, factory) {
+ return obj[name] || (obj[name] = factory());
+ }
+
+ var angular = ensure(window, 'angular', Object);
+
+ // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
+ angular.$$minErr = angular.$$minErr || minErr;
+
+ return ensure(angular, 'module', function() {
+ /** @type {Object.<string, angular.Module>} */
+ var modules = {};
+
+ /**
+ * @ngdoc function
+ * @name angular.module
+ * @module ng
+ * @description
+ *
+ * The `angular.module` is a global place for creating, registering and retrieving Angular
+ * modules.
+ * All modules (angular core or 3rd party) that should be available to an application must be
+ * registered using this mechanism.
+ *
+ * Passing one argument retrieves an existing {@link angular.Module},
+ * whereas passing more than one argument creates a new {@link angular.Module}
+ *
+ *
+ * # Module
+ *
+ * A module is a collection of services, directives, controllers, filters, and configuration information.
+ * `angular.module` is used to configure the {@link auto.$injector $injector}.
+ *
+ * ```js
+ * // Create a new module
+ * var myModule = angular.module('myModule', []);
+ *
+ * // register a new service
+ * myModule.value('appName', 'MyCoolApp');
+ *
+ * // configure existing services inside initialization blocks.
+ * myModule.config(['$locationProvider', function($locationProvider) {
+ * // Configure existing providers
+ * $locationProvider.hashPrefix('!');
+ * }]);
+ * ```
+ *
+ * Then you can create an injector and load your modules like this:
+ *
+ * ```js
+ * var injector = angular.injector(['ng', 'myModule'])
+ * ```
+ *
+ * However it's more likely that you'll just use
+ * {@link ng.directive:ngApp ngApp} or
+ * {@link angular.bootstrap} to simplify this process for you.
+ *
+ * @param {!string} name The name of the module to create or retrieve.
+ * @param {!Array.<string>=} requires If specified then new module is being created. If
+ * unspecified then the module is being retrieved for further configuration.
+ * @param {Function=} configFn Optional configuration function for the module. Same as
+ * {@link angular.Module#config Module#config()}.
+ * @returns {angular.Module} new module with the {@link angular.Module} api.
+ */
+ return function module(name, requires, configFn) {
+ var assertNotHasOwnProperty = function(name, context) {
+ if (name === 'hasOwnProperty') {
+ throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
+ }
+ };
+
+ assertNotHasOwnProperty(name, 'module');
+ if (requires && modules.hasOwnProperty(name)) {
+ modules[name] = null;
+ }
+ return ensure(modules, name, function() {
+ if (!requires) {
+ throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " +
+ "the module name or forgot to load it. If registering a module ensure that you " +
+ "specify the dependencies as the second argument.", name);
+ }
+
+ /** @type {!Array.<Array.<*>>} */
+ var invokeQueue = [];
+
+ /** @type {!Array.<Function>} */
+ var configBlocks = [];
+
+ /** @type {!Array.<Function>} */
+ var runBlocks = [];
+
+ var config = invokeLater('$injector', 'invoke', 'push', configBlocks);
+
+ /** @type {angular.Module} */
+ var moduleInstance = {
+ // Private state
+ _invokeQueue: invokeQueue,
+ _configBlocks: configBlocks,
+ _runBlocks: runBlocks,
+
+ /**
+ * @ngdoc property
+ * @name angular.Module#requires
+ * @module ng
+ *
+ * @description
+ * Holds the list of modules which the injector will load before the current module is
+ * loaded.
+ */
+ requires: requires,
+
+ /**
+ * @ngdoc property
+ * @name angular.Module#name
+ * @module ng
+ *
+ * @description
+ * Name of the module.
+ */
+ name: name,
+
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#provider
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} providerType Construction function for creating new instance of the
+ * service.
+ * @description
+ * See {@link auto.$provide#provider $provide.provider()}.
+ */
+ provider: invokeLaterAndSetModuleName('$provide', 'provider'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#factory
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} providerFunction Function for creating new instance of the service.
+ * @description
+ * See {@link auto.$provide#factory $provide.factory()}.
+ */
+ factory: invokeLaterAndSetModuleName('$provide', 'factory'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#service
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} constructor A constructor function that will be instantiated.
+ * @description
+ * See {@link auto.$provide#service $provide.service()}.
+ */
+ service: invokeLaterAndSetModuleName('$provide', 'service'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#value
+ * @module ng
+ * @param {string} name service name
+ * @param {*} object Service instance object.
+ * @description
+ * See {@link auto.$provide#value $provide.value()}.
+ */
+ value: invokeLater('$provide', 'value'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#constant
+ * @module ng
+ * @param {string} name constant name
+ * @param {*} object Constant value.
+ * @description
+ * Because the constants are fixed, they get applied before other provide methods.
+ * See {@link auto.$provide#constant $provide.constant()}.
+ */
+ constant: invokeLater('$provide', 'constant', 'unshift'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#decorator
+ * @module ng
+ * @param {string} The name of the service to decorate.
+ * @param {Function} This function will be invoked when the service needs to be
+ * instantiated and should return the decorated service instance.
+ * @description
+ * See {@link auto.$provide#decorator $provide.decorator()}.
+ */
+ decorator: invokeLaterAndSetModuleName('$provide', 'decorator'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#animation
+ * @module ng
+ * @param {string} name animation name
+ * @param {Function} animationFactory Factory function for creating new instance of an
+ * animation.
+ * @description
+ *
+ * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
+ *
+ *
+ * Defines an animation hook that can be later used with
+ * {@link $animate $animate} service and directives that use this service.
+ *
+ * ```js
+ * module.animation('.animation-name', function($inject1, $inject2) {
+ * return {
+ * eventName : function(element, done) {
+ * //code to run the animation
+ * //once complete, then run done()
+ * return function cancellationFunction(element) {
+ * //code to cancel the animation
+ * }
+ * }
+ * }
+ * })
+ * ```
+ *
+ * See {@link ng.$animateProvider#register $animateProvider.register()} and
+ * {@link ngAnimate ngAnimate module} for more information.
+ */
+ animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#filter
+ * @module ng
+ * @param {string} name Filter name - this must be a valid angular expression identifier
+ * @param {Function} filterFactory Factory function for creating new instance of filter.
+ * @description
+ * See {@link ng.$filterProvider#register $filterProvider.register()}.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
+ * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
+ * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
+ * (`myapp_subsection_filterx`).
+ * </div>
+ */
+ filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#controller
+ * @module ng
+ * @param {string|Object} name Controller name, or an object map of controllers where the
+ * keys are the names and the values are the constructors.
+ * @param {Function} constructor Controller constructor function.
+ * @description
+ * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
+ */
+ controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#directive
+ * @module ng
+ * @param {string|Object} name Directive name, or an object map of directives where the
+ * keys are the names and the values are the factories.
+ * @param {Function} directiveFactory Factory function for creating new instance of
+ * directives.
+ * @description
+ * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
+ */
+ directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#component
+ * @module ng
+ * @param {string} name Name of the component in camel-case (i.e. myComp which will match as my-comp)
+ * @param {Object} options Component definition object (a simplified
+ * {@link ng.$compile#directive-definition-object directive definition object})
+ *
+ * @description
+ * See {@link ng.$compileProvider#component $compileProvider.component()}.
+ */
+ component: invokeLaterAndSetModuleName('$compileProvider', 'component'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#config
+ * @module ng
+ * @param {Function} configFn Execute this function on module load. Useful for service
+ * configuration.
+ * @description
+ * Use this method to register work which needs to be performed on module loading.
+ * For more about how to configure services, see
+ * {@link providers#provider-recipe Provider Recipe}.
+ */
+ config: config,
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#run
+ * @module ng
+ * @param {Function} initializationFn Execute this function after injector creation.
+ * Useful for application initialization.
+ * @description
+ * Use this method to register work which should be performed when the injector is done
+ * loading all modules.
+ */
+ run: function(block) {
+ runBlocks.push(block);
+ return this;
+ }
+ };
+
+ if (configFn) {
+ config(configFn);
+ }
+
+ return moduleInstance;
+
+ /**
+ * @param {string} provider
+ * @param {string} method
+ * @param {String=} insertMethod
+ * @returns {angular.Module}
+ */
+ function invokeLater(provider, method, insertMethod, queue) {
+ if (!queue) queue = invokeQueue;
+ return function() {
+ queue[insertMethod || 'push']([provider, method, arguments]);
+ return moduleInstance;
+ };
+ }
+
+ /**
+ * @param {string} provider
+ * @param {string} method
+ * @returns {angular.Module}
+ */
+ function invokeLaterAndSetModuleName(provider, method) {
+ return function(recipeName, factoryFunction) {
+ if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
+ invokeQueue.push([provider, method, arguments]);
+ return moduleInstance;
+ };
+ }
+ });
+ };
+ });
+
+}
+
+/* global: toDebugString: true */
+
+function serializeObject(obj) {
+ var seen = [];
+
+ return JSON.stringify(obj, function(key, val) {
+ val = toJsonReplacer(key, val);
+ if (isObject(val)) {
+
+ if (seen.indexOf(val) >= 0) return '...';
+
+ seen.push(val);
+ }
+ return val;
+ });
+}
+
+function toDebugString(obj) {
+ if (typeof obj === 'function') {
+ return obj.toString().replace(/ \{[\s\S]*$/, '');
+ } else if (isUndefined(obj)) {
+ return 'undefined';
+ } else if (typeof obj !== 'string') {
+ return serializeObject(obj);
+ }
+ return obj;
+}
+
+/* global angularModule: true,
+ version: true,
+
+ $CompileProvider,
+
+ htmlAnchorDirective,
+ inputDirective,
+ inputDirective,
+ formDirective,
+ scriptDirective,
+ selectDirective,
+ styleDirective,
+ optionDirective,
+ ngBindDirective,
+ ngBindHtmlDirective,
+ ngBindTemplateDirective,
+ ngClassDirective,
+ ngClassEvenDirective,
+ ngClassOddDirective,
+ ngCloakDirective,
+ ngControllerDirective,
+ ngFormDirective,
+ ngHideDirective,
+ ngIfDirective,
+ ngIncludeDirective,
+ ngIncludeFillContentDirective,
+ ngInitDirective,
+ ngNonBindableDirective,
+ ngPluralizeDirective,
+ ngRepeatDirective,
+ ngShowDirective,
+ ngStyleDirective,
+ ngSwitchDirective,
+ ngSwitchWhenDirective,
+ ngSwitchDefaultDirective,
+ ngOptionsDirective,
+ ngTranscludeDirective,
+ ngModelDirective,
+ ngListDirective,
+ ngChangeDirective,
+ patternDirective,
+ patternDirective,
+ requiredDirective,
+ requiredDirective,
+ minlengthDirective,
+ minlengthDirective,
+ maxlengthDirective,
+ maxlengthDirective,
+ ngValueDirective,
+ ngModelOptionsDirective,
+ ngAttributeAliasDirectives,
+ ngEventDirectives,
+
+ $AnchorScrollProvider,
+ $AnimateProvider,
+ $CoreAnimateCssProvider,
+ $$CoreAnimateJsProvider,
+ $$CoreAnimateQueueProvider,
+ $$AnimateRunnerFactoryProvider,
+ $$AnimateAsyncRunFactoryProvider,
+ $BrowserProvider,
+ $CacheFactoryProvider,
+ $ControllerProvider,
+ $DateProvider,
+ $DocumentProvider,
+ $ExceptionHandlerProvider,
+ $FilterProvider,
+ $$ForceReflowProvider,
+ $InterpolateProvider,
+ $IntervalProvider,
+ $$HashMapProvider,
+ $HttpProvider,
+ $HttpParamSerializerProvider,
+ $HttpParamSerializerJQLikeProvider,
+ $HttpBackendProvider,
+ $xhrFactoryProvider,
+ $LocationProvider,
+ $LogProvider,
+ $ParseProvider,
+ $RootScopeProvider,
+ $QProvider,
+ $$QProvider,
+ $$SanitizeUriProvider,
+ $SceProvider,
+ $SceDelegateProvider,
+ $SnifferProvider,
+ $TemplateCacheProvider,
+ $TemplateRequestProvider,
+ $$TestabilityProvider,
+ $TimeoutProvider,
+ $$RAFProvider,
+ $WindowProvider,
+ $$jqLiteProvider,
+ $$CookieReaderProvider
+*/
+
+
+/**
+ * @ngdoc object
+ * @name angular.version
+ * @module ng
+ * @description
+ * An object that contains information about the current AngularJS version.
+ *
+ * This object has the following properties:
+ *
+ * - `full` – `{string}` – Full version string, such as "0.9.18".
+ * - `major` – `{number}` – Major version number, such as "0".
+ * - `minor` – `{number}` – Minor version number, such as "9".
+ * - `dot` – `{number}` – Dot version number, such as "18".
+ * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
+ */
+var version = {
+ full: '1.5.0', // all of these placeholder strings will be replaced by grunt's
+ major: 1, // package task
+ minor: 5,
+ dot: 0,
+ codeName: 'ennoblement-facilitation'
+};
+
+
+function publishExternalAPI(angular) {
+ extend(angular, {
+ 'bootstrap': bootstrap,
+ 'copy': copy,
+ 'extend': extend,
+ 'merge': merge,
+ 'equals': equals,
+ 'element': jqLite,
+ 'forEach': forEach,
+ 'injector': createInjector,
+ 'noop': noop,
+ 'bind': bind,
+ 'toJson': toJson,
+ 'fromJson': fromJson,
+ 'identity': identity,
+ 'isUndefined': isUndefined,
+ 'isDefined': isDefined,
+ 'isString': isString,
+ 'isFunction': isFunction,
+ 'isObject': isObject,
+ 'isNumber': isNumber,
+ 'isElement': isElement,
+ 'isArray': isArray,
+ 'version': version,
+ 'isDate': isDate,
+ 'lowercase': lowercase,
+ 'uppercase': uppercase,
+ 'callbacks': {counter: 0},
+ 'getTestability': getTestability,
+ '$$minErr': minErr,
+ '$$csp': csp,
+ 'reloadWithDebugInfo': reloadWithDebugInfo
+ });
+
+ angularModule = setupModuleLoader(window);
+
+ angularModule('ng', ['ngLocale'], ['$provide',
+ function ngModule($provide) {
+ // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
+ $provide.provider({
+ $$sanitizeUri: $$SanitizeUriProvider
+ });
+ $provide.provider('$compile', $CompileProvider).
+ directive({
+ a: htmlAnchorDirective,
+ input: inputDirective,
+ textarea: inputDirective,
+ form: formDirective,
+ script: scriptDirective,
+ select: selectDirective,
+ style: styleDirective,
+ option: optionDirective,
+ ngBind: ngBindDirective,
+ ngBindHtml: ngBindHtmlDirective,
+ ngBindTemplate: ngBindTemplateDirective,
+ ngClass: ngClassDirective,
+ ngClassEven: ngClassEvenDirective,
+ ngClassOdd: ngClassOddDirective,
+ ngCloak: ngCloakDirective,
+ ngController: ngControllerDirective,
+ ngForm: ngFormDirective,
+ ngHide: ngHideDirective,
+ ngIf: ngIfDirective,
+ ngInclude: ngIncludeDirective,
+ ngInit: ngInitDirective,
+ ngNonBindable: ngNonBindableDirective,
+ ngPluralize: ngPluralizeDirective,
+ ngRepeat: ngRepeatDirective,
+ ngShow: ngShowDirective,
+ ngStyle: ngStyleDirective,
+ ngSwitch: ngSwitchDirective,
+ ngSwitchWhen: ngSwitchWhenDirective,
+ ngSwitchDefault: ngSwitchDefaultDirective,
+ ngOptions: ngOptionsDirective,
+ ngTransclude: ngTranscludeDirective,
+ ngModel: ngModelDirective,
+ ngList: ngListDirective,
+ ngChange: ngChangeDirective,
+ pattern: patternDirective,
+ ngPattern: patternDirective,
+ required: requiredDirective,
+ ngRequired: requiredDirective,
+ minlength: minlengthDirective,
+ ngMinlength: minlengthDirective,
+ maxlength: maxlengthDirective,
+ ngMaxlength: maxlengthDirective,
+ ngValue: ngValueDirective,
+ ngModelOptions: ngModelOptionsDirective
+ }).
+ directive({
+ ngInclude: ngIncludeFillContentDirective
+ }).
+ directive(ngAttributeAliasDirectives).
+ directive(ngEventDirectives);
+ $provide.provider({
+ $anchorScroll: $AnchorScrollProvider,
+ $animate: $AnimateProvider,
+ $animateCss: $CoreAnimateCssProvider,
+ $$animateJs: $$CoreAnimateJsProvider,
+ $$animateQueue: $$CoreAnimateQueueProvider,
+ $$AnimateRunner: $$AnimateRunnerFactoryProvider,
+ $$animateAsyncRun: $$AnimateAsyncRunFactoryProvider,
+ $browser: $BrowserProvider,
+ $cacheFactory: $CacheFactoryProvider,
+ $controller: $ControllerProvider,
+ $document: $DocumentProvider,
+ $exceptionHandler: $ExceptionHandlerProvider,
+ $filter: $FilterProvider,
+ $$forceReflow: $$ForceReflowProvider,
+ $interpolate: $InterpolateProvider,
+ $interval: $IntervalProvider,
+ $http: $HttpProvider,
+ $httpParamSerializer: $HttpParamSerializerProvider,
+ $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider,
+ $httpBackend: $HttpBackendProvider,
+ $xhrFactory: $xhrFactoryProvider,
+ $location: $LocationProvider,
+ $log: $LogProvider,
+ $parse: $ParseProvider,
+ $rootScope: $RootScopeProvider,
+ $q: $QProvider,
+ $$q: $$QProvider,
+ $sce: $SceProvider,
+ $sceDelegate: $SceDelegateProvider,
+ $sniffer: $SnifferProvider,
+ $templateCache: $TemplateCacheProvider,
+ $templateRequest: $TemplateRequestProvider,
+ $$testability: $$TestabilityProvider,
+ $timeout: $TimeoutProvider,
+ $window: $WindowProvider,
+ $$rAF: $$RAFProvider,
+ $$jqLite: $$jqLiteProvider,
+ $$HashMap: $$HashMapProvider,
+ $$cookieReader: $$CookieReaderProvider
+ });
+ }
+ ]);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* global JQLitePrototype: true,
+ addEventListenerFn: true,
+ removeEventListenerFn: true,
+ BOOLEAN_ATTR: true,
+ ALIASED_ATTR: true,
+*/
+
+//////////////////////////////////
+//JQLite
+//////////////////////////////////
+
+/**
+ * @ngdoc function
+ * @name angular.element
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.
+ *
+ * If jQuery is available, `angular.element` is an alias for the
+ * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element`
+ * delegates to Angular's built-in subset of jQuery, called "jQuery lite" or **jqLite**.
+ *
+ * jqLite is a tiny, API-compatible subset of jQuery that allows
+ * Angular to manipulate the DOM in a cross-browser compatible way. jqLite implements only the most
+ * commonly needed functionality with the goal of having a very small footprint.
+ *
+ * To use `jQuery`, simply ensure it is loaded before the `angular.js` file. You can also use the
+ * {@link ngJq `ngJq`} directive to specify that jqlite should be used over jQuery, or to use a
+ * specific version of jQuery if multiple versions exist on the page.
+ *
+ * <div class="alert alert-info">**Note:** All element references in Angular are always wrapped with jQuery or
+ * jqLite (such as the element argument in a directive's compile / link function). They are never raw DOM references.</div>
+ *
+ * <div class="alert alert-warning">**Note:** Keep in mind that this function will not find elements
+ * by tag name / CSS selector. For lookups by tag name, try instead `angular.element(document).find(...)`
+ * or `$document.find()`, or use the standard DOM APIs, e.g. `document.querySelectorAll()`.</div>
+ *
+ * ## Angular's jqLite
+ * jqLite provides only the following jQuery methods:
+ *
+ * - [`addClass()`](http://api.jquery.com/addClass/)
+ * - [`after()`](http://api.jquery.com/after/)
+ * - [`append()`](http://api.jquery.com/append/)
+ * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters
+ * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData
+ * - [`children()`](http://api.jquery.com/children/) - Does not support selectors
+ * - [`clone()`](http://api.jquery.com/clone/)
+ * - [`contents()`](http://api.jquery.com/contents/)
+ * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`.
+ * As a setter, does not convert numbers to strings or append 'px', and also does not have automatic property prefixing.
+ * - [`data()`](http://api.jquery.com/data/)
+ * - [`detach()`](http://api.jquery.com/detach/)
+ * - [`empty()`](http://api.jquery.com/empty/)
+ * - [`eq()`](http://api.jquery.com/eq/)
+ * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name
+ * - [`hasClass()`](http://api.jquery.com/hasClass/)
+ * - [`html()`](http://api.jquery.com/html/)
+ * - [`next()`](http://api.jquery.com/next/) - Does not support selectors
+ * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData
+ * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter
+ * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors
+ * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors
+ * - [`prepend()`](http://api.jquery.com/prepend/)
+ * - [`prop()`](http://api.jquery.com/prop/)
+ * - [`ready()`](http://api.jquery.com/ready/)
+ * - [`remove()`](http://api.jquery.com/remove/)
+ * - [`removeAttr()`](http://api.jquery.com/removeAttr/)
+ * - [`removeClass()`](http://api.jquery.com/removeClass/)
+ * - [`removeData()`](http://api.jquery.com/removeData/)
+ * - [`replaceWith()`](http://api.jquery.com/replaceWith/)
+ * - [`text()`](http://api.jquery.com/text/)
+ * - [`toggleClass()`](http://api.jquery.com/toggleClass/)
+ * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers.
+ * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces or event object as parameter
+ * - [`val()`](http://api.jquery.com/val/)
+ * - [`wrap()`](http://api.jquery.com/wrap/)
+ *
+ * ## jQuery/jqLite Extras
+ * Angular also provides the following additional methods and events to both jQuery and jqLite:
+ *
+ * ### Events
+ * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event
+ * on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM
+ * element before it is removed.
+ *
+ * ### Methods
+ * - `controller(name)` - retrieves the controller of the current element or its parent. By default
+ * retrieves controller associated with the `ngController` directive. If `name` is provided as
+ * camelCase directive name, then the controller for this directive will be retrieved (e.g.
+ * `'ngModel'`).
+ * - `injector()` - retrieves the injector of the current element or its parent.
+ * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current
+ * element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to
+ * be enabled.
+ * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the
+ * current element. This getter should be used only on elements that contain a directive which starts a new isolate
+ * scope. Calling `scope()` on this element always returns the original non-isolate scope.
+ * Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled.
+ * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top
+ * parent element is reached.
+ *
+ * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.
+ * @returns {Object} jQuery object.
+ */
+
+JQLite.expando = 'ng339';
+
+var jqCache = JQLite.cache = {},
+ jqId = 1,
+ addEventListenerFn = function(element, type, fn) {
+ element.addEventListener(type, fn, false);
+ },
+ removeEventListenerFn = function(element, type, fn) {
+ element.removeEventListener(type, fn, false);
+ };
+
+/*
+ * !!! This is an undocumented "private" function !!!
+ */
+JQLite._data = function(node) {
+ //jQuery always returns an object on cache miss
+ return this.cache[node[this.expando]] || {};
+};
+
+function jqNextId() { return ++jqId; }
+
+
+var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
+var MOZ_HACK_REGEXP = /^moz([A-Z])/;
+var MOUSE_EVENT_MAP= { mouseleave: "mouseout", mouseenter: "mouseover"};
+var jqLiteMinErr = minErr('jqLite');
+
+/**
+ * Converts snake_case to camelCase.
+ * Also there is special case for Moz prefix starting with upper case letter.
+ * @param name Name to normalize
+ */
+function camelCase(name) {
+ return name.
+ replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
+ return offset ? letter.toUpperCase() : letter;
+ }).
+ replace(MOZ_HACK_REGEXP, 'Moz$1');
+}
+
+var SINGLE_TAG_REGEXP = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/;
+var HTML_REGEXP = /<|&#?\w+;/;
+var TAG_NAME_REGEXP = /<([\w:-]+)/;
+var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi;
+
+var wrapMap = {
+ 'option': [1, '<select multiple="multiple">', '</select>'],
+
+ 'thead': [1, '<table>', '</table>'],
+ 'col': [2, '<table><colgroup>', '</colgroup></table>'],
+ 'tr': [2, '<table><tbody>', '</tbody></table>'],
+ 'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],
+ '_default': [0, "", ""]
+};
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+
+function jqLiteIsTextNode(html) {
+ return !HTML_REGEXP.test(html);
+}
+
+function jqLiteAcceptsData(node) {
+ // The window object can accept data but has no nodeType
+ // Otherwise we are only interested in elements (1) and documents (9)
+ var nodeType = node.nodeType;
+ return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;
+}
+
+function jqLiteHasData(node) {
+ for (var key in jqCache[node.ng339]) {
+ return true;
+ }
+ return false;
+}
+
+function jqLiteCleanData(nodes) {
+ for (var i = 0, ii = nodes.length; i < ii; i++) {
+ jqLiteRemoveData(nodes[i]);
+ }
+}
+
+function jqLiteBuildFragment(html, context) {
+ var tmp, tag, wrap,
+ fragment = context.createDocumentFragment(),
+ nodes = [], i;
+
+ if (jqLiteIsTextNode(html)) {
+ // Convert non-html into a text node
+ nodes.push(context.createTextNode(html));
+ } else {
+ // Convert html into DOM nodes
+ tmp = tmp || fragment.appendChild(context.createElement("div"));
+ tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase();
+ wrap = wrapMap[tag] || wrapMap._default;
+ tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2];
+
+ // Descend through wrappers to the right content
+ i = wrap[0];
+ while (i--) {
+ tmp = tmp.lastChild;
+ }
+
+ nodes = concat(nodes, tmp.childNodes);
+
+ tmp = fragment.firstChild;
+ tmp.textContent = "";
+ }
+
+ // Remove wrapper from fragment
+ fragment.textContent = "";
+ fragment.innerHTML = ""; // Clear inner HTML
+ forEach(nodes, function(node) {
+ fragment.appendChild(node);
+ });
+
+ return fragment;
+}
+
+function jqLiteParseHTML(html, context) {
+ context = context || document;
+ var parsed;
+
+ if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {
+ return [context.createElement(parsed[1])];
+ }
+
+ if ((parsed = jqLiteBuildFragment(html, context))) {
+ return parsed.childNodes;
+ }
+
+ return [];
+}
+
+function jqLiteWrapNode(node, wrapper) {
+ var parent = node.parentNode;
+
+ if (parent) {
+ parent.replaceChild(wrapper, node);
+ }
+
+ wrapper.appendChild(node);
+}
+
+
+// IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.
+var jqLiteContains = Node.prototype.contains || function(arg) {
+ // jshint bitwise: false
+ return !!(this.compareDocumentPosition(arg) & 16);
+ // jshint bitwise: true
+};
+
+/////////////////////////////////////////////
+function JQLite(element) {
+ if (element instanceof JQLite) {
+ return element;
+ }
+
+ var argIsString;
+
+ if (isString(element)) {
+ element = trim(element);
+ argIsString = true;
+ }
+ if (!(this instanceof JQLite)) {
+ if (argIsString && element.charAt(0) != '<') {
+ throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');
+ }
+ return new JQLite(element);
+ }
+
+ if (argIsString) {
+ jqLiteAddNodes(this, jqLiteParseHTML(element));
+ } else {
+ jqLiteAddNodes(this, element);
+ }
+}
+
+function jqLiteClone(element) {
+ return element.cloneNode(true);
+}
+
+function jqLiteDealoc(element, onlyDescendants) {
+ if (!onlyDescendants) jqLiteRemoveData(element);
+
+ if (element.querySelectorAll) {
+ var descendants = element.querySelectorAll('*');
+ for (var i = 0, l = descendants.length; i < l; i++) {
+ jqLiteRemoveData(descendants[i]);
+ }
+ }
+}
+
+function jqLiteOff(element, type, fn, unsupported) {
+ if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');
+
+ var expandoStore = jqLiteExpandoStore(element);
+ var events = expandoStore && expandoStore.events;
+ var handle = expandoStore && expandoStore.handle;
+
+ if (!handle) return; //no listeners registered
+
+ if (!type) {
+ for (type in events) {
+ if (type !== '$destroy') {
+ removeEventListenerFn(element, type, handle);
+ }
+ delete events[type];
+ }
+ } else {
+
+ var removeHandler = function(type) {
+ var listenerFns = events[type];
+ if (isDefined(fn)) {
+ arrayRemove(listenerFns || [], fn);
+ }
+ if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {
+ removeEventListenerFn(element, type, handle);
+ delete events[type];
+ }
+ };
+
+ forEach(type.split(' '), function(type) {
+ removeHandler(type);
+ if (MOUSE_EVENT_MAP[type]) {
+ removeHandler(MOUSE_EVENT_MAP[type]);
+ }
+ });
+ }
+}
+
+function jqLiteRemoveData(element, name) {
+ var expandoId = element.ng339;
+ var expandoStore = expandoId && jqCache[expandoId];
+
+ if (expandoStore) {
+ if (name) {
+ delete expandoStore.data[name];
+ return;
+ }
+
+ if (expandoStore.handle) {
+ if (expandoStore.events.$destroy) {
+ expandoStore.handle({}, '$destroy');
+ }
+ jqLiteOff(element);
+ }
+ delete jqCache[expandoId];
+ element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it
+ }
+}
+
+
+function jqLiteExpandoStore(element, createIfNecessary) {
+ var expandoId = element.ng339,
+ expandoStore = expandoId && jqCache[expandoId];
+
+ if (createIfNecessary && !expandoStore) {
+ element.ng339 = expandoId = jqNextId();
+ expandoStore = jqCache[expandoId] = {events: {}, data: {}, handle: undefined};
+ }
+
+ return expandoStore;
+}
+
+
+function jqLiteData(element, key, value) {
+ if (jqLiteAcceptsData(element)) {
+
+ var isSimpleSetter = isDefined(value);
+ var isSimpleGetter = !isSimpleSetter && key && !isObject(key);
+ var massGetter = !key;
+ var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter);
+ var data = expandoStore && expandoStore.data;
+
+ if (isSimpleSetter) { // data('key', value)
+ data[key] = value;
+ } else {
+ if (massGetter) { // data()
+ return data;
+ } else {
+ if (isSimpleGetter) { // data('key')
+ // don't force creation of expandoStore if it doesn't exist yet
+ return data && data[key];
+ } else { // mass-setter: data({key1: val1, key2: val2})
+ extend(data, key);
+ }
+ }
+ }
+ }
+}
+
+function jqLiteHasClass(element, selector) {
+ if (!element.getAttribute) return false;
+ return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " ").
+ indexOf(" " + selector + " ") > -1);
+}
+
+function jqLiteRemoveClass(element, cssClasses) {
+ if (cssClasses && element.setAttribute) {
+ forEach(cssClasses.split(' '), function(cssClass) {
+ element.setAttribute('class', trim(
+ (" " + (element.getAttribute('class') || '') + " ")
+ .replace(/[\n\t]/g, " ")
+ .replace(" " + trim(cssClass) + " ", " "))
+ );
+ });
+ }
+}
+
+function jqLiteAddClass(element, cssClasses) {
+ if (cssClasses && element.setAttribute) {
+ var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')
+ .replace(/[\n\t]/g, " ");
+
+ forEach(cssClasses.split(' '), function(cssClass) {
+ cssClass = trim(cssClass);
+ if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {
+ existingClasses += cssClass + ' ';
+ }
+ });
+
+ element.setAttribute('class', trim(existingClasses));
+ }
+}
+
+
+function jqLiteAddNodes(root, elements) {
+ // THIS CODE IS VERY HOT. Don't make changes without benchmarking.
+
+ if (elements) {
+
+ // if a Node (the most common case)
+ if (elements.nodeType) {
+ root[root.length++] = elements;
+ } else {
+ var length = elements.length;
+
+ // if an Array or NodeList and not a Window
+ if (typeof length === 'number' && elements.window !== elements) {
+ if (length) {
+ for (var i = 0; i < length; i++) {
+ root[root.length++] = elements[i];
+ }
+ }
+ } else {
+ root[root.length++] = elements;
+ }
+ }
+ }
+}
+
+
+function jqLiteController(element, name) {
+ return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller');
+}
+
+function jqLiteInheritedData(element, name, value) {
+ // if element is the document object work with the html element instead
+ // this makes $(document).scope() possible
+ if (element.nodeType == NODE_TYPE_DOCUMENT) {
+ element = element.documentElement;
+ }
+ var names = isArray(name) ? name : [name];
+
+ while (element) {
+ for (var i = 0, ii = names.length; i < ii; i++) {
+ if (isDefined(value = jqLite.data(element, names[i]))) return value;
+ }
+
+ // If dealing with a document fragment node with a host element, and no parent, use the host
+ // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM
+ // to lookup parent controllers.
+ element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host);
+ }
+}
+
+function jqLiteEmpty(element) {
+ jqLiteDealoc(element, true);
+ while (element.firstChild) {
+ element.removeChild(element.firstChild);
+ }
+}
+
+function jqLiteRemove(element, keepData) {
+ if (!keepData) jqLiteDealoc(element);
+ var parent = element.parentNode;
+ if (parent) parent.removeChild(element);
+}
+
+
+function jqLiteDocumentLoaded(action, win) {
+ win = win || window;
+ if (win.document.readyState === 'complete') {
+ // Force the action to be run async for consistent behavior
+ // from the action's point of view
+ // i.e. it will definitely not be in a $apply
+ win.setTimeout(action);
+ } else {
+ // No need to unbind this handler as load is only ever called once
+ jqLite(win).on('load', action);
+ }
+}
+
+//////////////////////////////////////////
+// Functions which are declared directly.
+//////////////////////////////////////////
+var JQLitePrototype = JQLite.prototype = {
+ ready: function(fn) {
+ var fired = false;
+
+ function trigger() {
+ if (fired) return;
+ fired = true;
+ fn();
+ }
+
+ // check if document is already loaded
+ if (document.readyState === 'complete') {
+ setTimeout(trigger);
+ } else {
+ this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9
+ // we can not use jqLite since we are not done loading and jQuery could be loaded later.
+ // jshint -W064
+ JQLite(window).on('load', trigger); // fallback to window.onload for others
+ // jshint +W064
+ }
+ },
+ toString: function() {
+ var value = [];
+ forEach(this, function(e) { value.push('' + e);});
+ return '[' + value.join(', ') + ']';
+ },
+
+ eq: function(index) {
+ return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);
+ },
+
+ length: 0,
+ push: push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+//////////////////////////////////////////
+// Functions iterating getter/setters.
+// these functions return self on setter and
+// value on get.
+//////////////////////////////////////////
+var BOOLEAN_ATTR = {};
+forEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) {
+ BOOLEAN_ATTR[lowercase(value)] = value;
+});
+var BOOLEAN_ELEMENTS = {};
+forEach('input,select,option,textarea,button,form,details'.split(','), function(value) {
+ BOOLEAN_ELEMENTS[value] = true;
+});
+var ALIASED_ATTR = {
+ 'ngMinlength': 'minlength',
+ 'ngMaxlength': 'maxlength',
+ 'ngMin': 'min',
+ 'ngMax': 'max',
+ 'ngPattern': 'pattern'
+};
+
+function getBooleanAttrName(element, name) {
+ // check dom last since we will most likely fail on name
+ var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];
+
+ // booleanAttr is here twice to minimize DOM access
+ return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr;
+}
+
+function getAliasedAttrName(name) {
+ return ALIASED_ATTR[name];
+}
+
+forEach({
+ data: jqLiteData,
+ removeData: jqLiteRemoveData,
+ hasData: jqLiteHasData,
+ cleanData: jqLiteCleanData
+}, function(fn, name) {
+ JQLite[name] = fn;
+});
+
+forEach({
+ data: jqLiteData,
+ inheritedData: jqLiteInheritedData,
+
+ scope: function(element) {
+ // Can't use jqLiteData here directly so we stay compatible with jQuery!
+ return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);
+ },
+
+ isolateScope: function(element) {
+ // Can't use jqLiteData here directly so we stay compatible with jQuery!
+ return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate');
+ },
+
+ controller: jqLiteController,
+
+ injector: function(element) {
+ return jqLiteInheritedData(element, '$injector');
+ },
+
+ removeAttr: function(element, name) {
+ element.removeAttribute(name);
+ },
+
+ hasClass: jqLiteHasClass,
+
+ css: function(element, name, value) {
+ name = camelCase(name);
+
+ if (isDefined(value)) {
+ element.style[name] = value;
+ } else {
+ return element.style[name];
+ }
+ },
+
+ attr: function(element, name, value) {
+ var nodeType = element.nodeType;
+ if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT) {
+ return;
+ }
+ var lowercasedName = lowercase(name);
+ if (BOOLEAN_ATTR[lowercasedName]) {
+ if (isDefined(value)) {
+ if (!!value) {
+ element[name] = true;
+ element.setAttribute(name, lowercasedName);
+ } else {
+ element[name] = false;
+ element.removeAttribute(lowercasedName);
+ }
+ } else {
+ return (element[name] ||
+ (element.attributes.getNamedItem(name) || noop).specified)
+ ? lowercasedName
+ : undefined;
+ }
+ } else if (isDefined(value)) {
+ element.setAttribute(name, value);
+ } else if (element.getAttribute) {
+ // the extra argument "2" is to get the right thing for a.href in IE, see jQuery code
+ // some elements (e.g. Document) don't have get attribute, so return undefined
+ var ret = element.getAttribute(name, 2);
+ // normalize non-existing attributes to undefined (as jQuery)
+ return ret === null ? undefined : ret;
+ }
+ },
+
+ prop: function(element, name, value) {
+ if (isDefined(value)) {
+ element[name] = value;
+ } else {
+ return element[name];
+ }
+ },
+
+ text: (function() {
+ getText.$dv = '';
+ return getText;
+
+ function getText(element, value) {
+ if (isUndefined(value)) {
+ var nodeType = element.nodeType;
+ return (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT) ? element.textContent : '';
+ }
+ element.textContent = value;
+ }
+ })(),
+
+ val: function(element, value) {
+ if (isUndefined(value)) {
+ if (element.multiple && nodeName_(element) === 'select') {
+ var result = [];
+ forEach(element.options, function(option) {
+ if (option.selected) {
+ result.push(option.value || option.text);
+ }
+ });
+ return result.length === 0 ? null : result;
+ }
+ return element.value;
+ }
+ element.value = value;
+ },
+
+ html: function(element, value) {
+ if (isUndefined(value)) {
+ return element.innerHTML;
+ }
+ jqLiteDealoc(element, true);
+ element.innerHTML = value;
+ },
+
+ empty: jqLiteEmpty
+}, function(fn, name) {
+ /**
+ * Properties: writes return selection, reads return first value
+ */
+ JQLite.prototype[name] = function(arg1, arg2) {
+ var i, key;
+ var nodeCount = this.length;
+
+ // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it
+ // in a way that survives minification.
+ // jqLiteEmpty takes no arguments but is a setter.
+ if (fn !== jqLiteEmpty &&
+ (isUndefined((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) {
+ if (isObject(arg1)) {
+
+ // we are a write, but the object properties are the key/values
+ for (i = 0; i < nodeCount; i++) {
+ if (fn === jqLiteData) {
+ // data() takes the whole object in jQuery
+ fn(this[i], arg1);
+ } else {
+ for (key in arg1) {
+ fn(this[i], key, arg1[key]);
+ }
+ }
+ }
+ // return self for chaining
+ return this;
+ } else {
+ // we are a read, so read the first child.
+ // TODO: do we still need this?
+ var value = fn.$dv;
+ // Only if we have $dv do we iterate over all, otherwise it is just the first element.
+ var jj = (isUndefined(value)) ? Math.min(nodeCount, 1) : nodeCount;
+ for (var j = 0; j < jj; j++) {
+ var nodeValue = fn(this[j], arg1, arg2);
+ value = value ? value + nodeValue : nodeValue;
+ }
+ return value;
+ }
+ } else {
+ // we are a write, so apply to all children
+ for (i = 0; i < nodeCount; i++) {
+ fn(this[i], arg1, arg2);
+ }
+ // return self for chaining
+ return this;
+ }
+ };
+});
+
+function createEventHandler(element, events) {
+ var eventHandler = function(event, type) {
+ // jQuery specific api
+ event.isDefaultPrevented = function() {
+ return event.defaultPrevented;
+ };
+
+ var eventFns = events[type || event.type];
+ var eventFnsLength = eventFns ? eventFns.length : 0;
+
+ if (!eventFnsLength) return;
+
+ if (isUndefined(event.immediatePropagationStopped)) {
+ var originalStopImmediatePropagation = event.stopImmediatePropagation;
+ event.stopImmediatePropagation = function() {
+ event.immediatePropagationStopped = true;
+
+ if (event.stopPropagation) {
+ event.stopPropagation();
+ }
+
+ if (originalStopImmediatePropagation) {
+ originalStopImmediatePropagation.call(event);
+ }
+ };
+ }
+
+ event.isImmediatePropagationStopped = function() {
+ return event.immediatePropagationStopped === true;
+ };
+
+ // Some events have special handlers that wrap the real handler
+ var handlerWrapper = eventFns.specialHandlerWrapper || defaultHandlerWrapper;
+
+ // Copy event handlers in case event handlers array is modified during execution.
+ if ((eventFnsLength > 1)) {
+ eventFns = shallowCopy(eventFns);
+ }
+
+ for (var i = 0; i < eventFnsLength; i++) {
+ if (!event.isImmediatePropagationStopped()) {
+ handlerWrapper(element, event, eventFns[i]);
+ }
+ }
+ };
+
+ // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all
+ // events on `element`
+ eventHandler.elem = element;
+ return eventHandler;
+}
+
+function defaultHandlerWrapper(element, event, handler) {
+ handler.call(element, event);
+}
+
+function specialMouseHandlerWrapper(target, event, handler) {
+ // Refer to jQuery's implementation of mouseenter & mouseleave
+ // Read about mouseenter and mouseleave:
+ // http://www.quirksmode.org/js/events_mouse.html#link8
+ var related = event.relatedTarget;
+ // For mousenter/leave call the handler if related is outside the target.
+ // NB: No relatedTarget if the mouse left/entered the browser window
+ if (!related || (related !== target && !jqLiteContains.call(target, related))) {
+ handler.call(target, event);
+ }
+}
+
+//////////////////////////////////////////
+// Functions iterating traversal.
+// These functions chain results into a single
+// selector.
+//////////////////////////////////////////
+forEach({
+ removeData: jqLiteRemoveData,
+
+ on: function jqLiteOn(element, type, fn, unsupported) {
+ if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');
+
+ // Do not add event handlers to non-elements because they will not be cleaned up.
+ if (!jqLiteAcceptsData(element)) {
+ return;
+ }
+
+ var expandoStore = jqLiteExpandoStore(element, true);
+ var events = expandoStore.events;
+ var handle = expandoStore.handle;
+
+ if (!handle) {
+ handle = expandoStore.handle = createEventHandler(element, events);
+ }
+
+ // http://jsperf.com/string-indexof-vs-split
+ var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type];
+ var i = types.length;
+
+ var addHandler = function(type, specialHandlerWrapper, noEventListener) {
+ var eventFns = events[type];
+
+ if (!eventFns) {
+ eventFns = events[type] = [];
+ eventFns.specialHandlerWrapper = specialHandlerWrapper;
+ if (type !== '$destroy' && !noEventListener) {
+ addEventListenerFn(element, type, handle);
+ }
+ }
+
+ eventFns.push(fn);
+ };
+
+ while (i--) {
+ type = types[i];
+ if (MOUSE_EVENT_MAP[type]) {
+ addHandler(MOUSE_EVENT_MAP[type], specialMouseHandlerWrapper);
+ addHandler(type, undefined, true);
+ } else {
+ addHandler(type);
+ }
+ }
+ },
+
+ off: jqLiteOff,
+
+ one: function(element, type, fn) {
+ element = jqLite(element);
+
+ //add the listener twice so that when it is called
+ //you can remove the original function and still be
+ //able to call element.off(ev, fn) normally
+ element.on(type, function onFn() {
+ element.off(type, fn);
+ element.off(type, onFn);
+ });
+ element.on(type, fn);
+ },
+
+ replaceWith: function(element, replaceNode) {
+ var index, parent = element.parentNode;
+ jqLiteDealoc(element);
+ forEach(new JQLite(replaceNode), function(node) {
+ if (index) {
+ parent.insertBefore(node, index.nextSibling);
+ } else {
+ parent.replaceChild(node, element);
+ }
+ index = node;
+ });
+ },
+
+ children: function(element) {
+ var children = [];
+ forEach(element.childNodes, function(element) {
+ if (element.nodeType === NODE_TYPE_ELEMENT) {
+ children.push(element);
+ }
+ });
+ return children;
+ },
+
+ contents: function(element) {
+ return element.contentDocument || element.childNodes || [];
+ },
+
+ append: function(element, node) {
+ var nodeType = element.nodeType;
+ if (nodeType !== NODE_TYPE_ELEMENT && nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT) return;
+
+ node = new JQLite(node);
+
+ for (var i = 0, ii = node.length; i < ii; i++) {
+ var child = node[i];
+ element.appendChild(child);
+ }
+ },
+
+ prepend: function(element, node) {
+ if (element.nodeType === NODE_TYPE_ELEMENT) {
+ var index = element.firstChild;
+ forEach(new JQLite(node), function(child) {
+ element.insertBefore(child, index);
+ });
+ }
+ },
+
+ wrap: function(element, wrapNode) {
+ jqLiteWrapNode(element, jqLite(wrapNode).eq(0).clone()[0]);
+ },
+
+ remove: jqLiteRemove,
+
+ detach: function(element) {
+ jqLiteRemove(element, true);
+ },
+
+ after: function(element, newElement) {
+ var index = element, parent = element.parentNode;
+ newElement = new JQLite(newElement);
+
+ for (var i = 0, ii = newElement.length; i < ii; i++) {
+ var node = newElement[i];
+ parent.insertBefore(node, index.nextSibling);
+ index = node;
+ }
+ },
+
+ addClass: jqLiteAddClass,
+ removeClass: jqLiteRemoveClass,
+
+ toggleClass: function(element, selector, condition) {
+ if (selector) {
+ forEach(selector.split(' '), function(className) {
+ var classCondition = condition;
+ if (isUndefined(classCondition)) {
+ classCondition = !jqLiteHasClass(element, className);
+ }
+ (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);
+ });
+ }
+ },
+
+ parent: function(element) {
+ var parent = element.parentNode;
+ return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null;
+ },
+
+ next: function(element) {
+ return element.nextElementSibling;
+ },
+
+ find: function(element, selector) {
+ if (element.getElementsByTagName) {
+ return element.getElementsByTagName(selector);
+ } else {
+ return [];
+ }
+ },
+
+ clone: jqLiteClone,
+
+ triggerHandler: function(element, event, extraParameters) {
+
+ var dummyEvent, eventFnsCopy, handlerArgs;
+ var eventName = event.type || event;
+ var expandoStore = jqLiteExpandoStore(element);
+ var events = expandoStore && expandoStore.events;
+ var eventFns = events && events[eventName];
+
+ if (eventFns) {
+ // Create a dummy event to pass to the handlers
+ dummyEvent = {
+ preventDefault: function() { this.defaultPrevented = true; },
+ isDefaultPrevented: function() { return this.defaultPrevented === true; },
+ stopImmediatePropagation: function() { this.immediatePropagationStopped = true; },
+ isImmediatePropagationStopped: function() { return this.immediatePropagationStopped === true; },
+ stopPropagation: noop,
+ type: eventName,
+ target: element
+ };
+
+ // If a custom event was provided then extend our dummy event with it
+ if (event.type) {
+ dummyEvent = extend(dummyEvent, event);
+ }
+
+ // Copy event handlers in case event handlers array is modified during execution.
+ eventFnsCopy = shallowCopy(eventFns);
+ handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent];
+
+ forEach(eventFnsCopy, function(fn) {
+ if (!dummyEvent.isImmediatePropagationStopped()) {
+ fn.apply(element, handlerArgs);
+ }
+ });
+ }
+ }
+}, function(fn, name) {
+ /**
+ * chaining functions
+ */
+ JQLite.prototype[name] = function(arg1, arg2, arg3) {
+ var value;
+
+ for (var i = 0, ii = this.length; i < ii; i++) {
+ if (isUndefined(value)) {
+ value = fn(this[i], arg1, arg2, arg3);
+ if (isDefined(value)) {
+ // any function which returns a value needs to be wrapped
+ value = jqLite(value);
+ }
+ } else {
+ jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));
+ }
+ }
+ return isDefined(value) ? value : this;
+ };
+
+ // bind legacy bind/unbind to on/off
+ JQLite.prototype.bind = JQLite.prototype.on;
+ JQLite.prototype.unbind = JQLite.prototype.off;
+});
+
+
+// Provider for private $$jqLite service
+function $$jqLiteProvider() {
+ this.$get = function $$jqLite() {
+ return extend(JQLite, {
+ hasClass: function(node, classes) {
+ if (node.attr) node = node[0];
+ return jqLiteHasClass(node, classes);
+ },
+ addClass: function(node, classes) {
+ if (node.attr) node = node[0];
+ return jqLiteAddClass(node, classes);
+ },
+ removeClass: function(node, classes) {
+ if (node.attr) node = node[0];
+ return jqLiteRemoveClass(node, classes);
+ }
+ });
+ };
+}
+
+/**
+ * Computes a hash of an 'obj'.
+ * Hash of a:
+ * string is string
+ * number is number as string
+ * object is either result of calling $$hashKey function on the object or uniquely generated id,
+ * that is also assigned to the $$hashKey property of the object.
+ *
+ * @param obj
+ * @returns {string} hash string such that the same input will have the same hash string.
+ * The resulting string key is in 'type:hashKey' format.
+ */
+function hashKey(obj, nextUidFn) {
+ var key = obj && obj.$$hashKey;
+
+ if (key) {
+ if (typeof key === 'function') {
+ key = obj.$$hashKey();
+ }
+ return key;
+ }
+
+ var objType = typeof obj;
+ if (objType == 'function' || (objType == 'object' && obj !== null)) {
+ key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)();
+ } else {
+ key = objType + ':' + obj;
+ }
+
+ return key;
+}
+
+/**
+ * HashMap which can use objects as keys
+ */
+function HashMap(array, isolatedUid) {
+ if (isolatedUid) {
+ var uid = 0;
+ this.nextUid = function() {
+ return ++uid;
+ };
+ }
+ forEach(array, this.put, this);
+}
+HashMap.prototype = {
+ /**
+ * Store key value pair
+ * @param key key to store can be any type
+ * @param value value to store can be any type
+ */
+ put: function(key, value) {
+ this[hashKey(key, this.nextUid)] = value;
+ },
+
+ /**
+ * @param key
+ * @returns {Object} the value for the key
+ */
+ get: function(key) {
+ return this[hashKey(key, this.nextUid)];
+ },
+
+ /**
+ * Remove the key/value pair
+ * @param key
+ */
+ remove: function(key) {
+ var value = this[key = hashKey(key, this.nextUid)];
+ delete this[key];
+ return value;
+ }
+};
+
+var $$HashMapProvider = [function() {
+ this.$get = [function() {
+ return HashMap;
+ }];
+}];
+
+/**
+ * @ngdoc function
+ * @module ng
+ * @name angular.injector
+ * @kind function
+ *
+ * @description
+ * Creates an injector object that can be used for retrieving services as well as for
+ * dependency injection (see {@link guide/di dependency injection}).
+ *
+ * @param {Array.<string|Function>} modules A list of module functions or their aliases. See
+ * {@link angular.module}. The `ng` module must be explicitly added.
+ * @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which
+ * disallows argument name annotation inference.
+ * @returns {injector} Injector object. See {@link auto.$injector $injector}.
+ *
+ * @example
+ * Typical usage
+ * ```js
+ * // create an injector
+ * var $injector = angular.injector(['ng']);
+ *
+ * // use the injector to kick off your application
+ * // use the type inference to auto inject arguments, or use implicit injection
+ * $injector.invoke(function($rootScope, $compile, $document) {
+ * $compile($document)($rootScope);
+ * $rootScope.$digest();
+ * });
+ * ```
+ *
+ * Sometimes you want to get access to the injector of a currently running Angular app
+ * from outside Angular. Perhaps, you want to inject and compile some markup after the
+ * application has been bootstrapped. You can do this using the extra `injector()` added
+ * to JQuery/jqLite elements. See {@link angular.element}.
+ *
+ * *This is fairly rare but could be the case if a third party library is injecting the
+ * markup.*
+ *
+ * In the following example a new block of HTML containing a `ng-controller`
+ * directive is added to the end of the document body by JQuery. We then compile and link
+ * it into the current AngularJS scope.
+ *
+ * ```js
+ * var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>');
+ * $(document.body).append($div);
+ *
+ * angular.element(document).injector().invoke(function($compile) {
+ * var scope = angular.element($div).scope();
+ * $compile($div)(scope);
+ * });
+ * ```
+ */
+
+
+/**
+ * @ngdoc module
+ * @name auto
+ * @description
+ *
+ * Implicit module which gets automatically added to each {@link auto.$injector $injector}.
+ */
+
+var ARROW_ARG = /^([^\(]+?)=>/;
+var FN_ARGS = /^[^\(]*\(\s*([^\)]*)\)/m;
+var FN_ARG_SPLIT = /,/;
+var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
+var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
+var $injectorMinErr = minErr('$injector');
+
+function extractArgs(fn) {
+ var fnText = fn.toString().replace(STRIP_COMMENTS, ''),
+ args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
+ return args;
+}
+
+function anonFn(fn) {
+ // For anonymous functions, showing at the very least the function signature can help in
+ // debugging.
+ var args = extractArgs(fn);
+ if (args) {
+ return 'function(' + (args[1] || '').replace(/[\s\r\n]+/, ' ') + ')';
+ }
+ return 'fn';
+}
+
+function annotate(fn, strictDi, name) {
+ var $inject,
+ argDecl,
+ last;
+
+ if (typeof fn === 'function') {
+ if (!($inject = fn.$inject)) {
+ $inject = [];
+ if (fn.length) {
+ if (strictDi) {
+ if (!isString(name) || !name) {
+ name = fn.name || anonFn(fn);
+ }
+ throw $injectorMinErr('strictdi',
+ '{0} is not using explicit annotation and cannot be invoked in strict mode', name);
+ }
+ argDecl = extractArgs(fn);
+ forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {
+ arg.replace(FN_ARG, function(all, underscore, name) {
+ $inject.push(name);
+ });
+ });
+ }
+ fn.$inject = $inject;
+ }
+ } else if (isArray(fn)) {
+ last = fn.length - 1;
+ assertArgFn(fn[last], 'fn');
+ $inject = fn.slice(0, last);
+ } else {
+ assertArgFn(fn, 'fn', true);
+ }
+ return $inject;
+}
+
+///////////////////////////////////////
+
+/**
+ * @ngdoc service
+ * @name $injector
+ *
+ * @description
+ *
+ * `$injector` is used to retrieve object instances as defined by
+ * {@link auto.$provide provider}, instantiate types, invoke methods,
+ * and load modules.
+ *
+ * The following always holds true:
+ *
+ * ```js
+ * var $injector = angular.injector();
+ * expect($injector.get('$injector')).toBe($injector);
+ * expect($injector.invoke(function($injector) {
+ * return $injector;
+ * })).toBe($injector);
+ * ```
+ *
+ * # Injection Function Annotation
+ *
+ * JavaScript does not have annotations, and annotations are needed for dependency injection. The
+ * following are all valid ways of annotating function with injection arguments and are equivalent.
+ *
+ * ```js
+ * // inferred (only works if code not minified/obfuscated)
+ * $injector.invoke(function(serviceA){});
+ *
+ * // annotated
+ * function explicit(serviceA) {};
+ * explicit.$inject = ['serviceA'];
+ * $injector.invoke(explicit);
+ *
+ * // inline
+ * $injector.invoke(['serviceA', function(serviceA){}]);
+ * ```
+ *
+ * ## Inference
+ *
+ * In JavaScript calling `toString()` on a function returns the function definition. The definition
+ * can then be parsed and the function arguments can be extracted. This method of discovering
+ * annotations is disallowed when the injector is in strict mode.
+ * *NOTE:* This does not work with minification, and obfuscation tools since these tools change the
+ * argument names.
+ *
+ * ## `$inject` Annotation
+ * By adding an `$inject` property onto a function the injection parameters can be specified.
+ *
+ * ## Inline
+ * As an array of injection names, where the last item in the array is the function to call.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#get
+ *
+ * @description
+ * Return an instance of the service.
+ *
+ * @param {string} name The name of the instance to retrieve.
+ * @param {string=} caller An optional string to provide the origin of the function call for error messages.
+ * @return {*} The instance.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#invoke
+ *
+ * @description
+ * Invoke the method and supply the method arguments from the `$injector`.
+ *
+ * @param {Function|Array.<string|Function>} fn The injectable function to invoke. Function parameters are
+ * injected according to the {@link guide/di $inject Annotation} rules.
+ * @param {Object=} self The `this` for the invoked method.
+ * @param {Object=} locals Optional object. If preset then any argument names are read from this
+ * object first, before the `$injector` is consulted.
+ * @returns {*} the value returned by the invoked `fn` function.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#has
+ *
+ * @description
+ * Allows the user to query if the particular service exists.
+ *
+ * @param {string} name Name of the service to query.
+ * @returns {boolean} `true` if injector has given service.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#instantiate
+ * @description
+ * Create a new instance of JS type. The method takes a constructor function, invokes the new
+ * operator, and supplies all of the arguments to the constructor function as specified by the
+ * constructor annotation.
+ *
+ * @param {Function} Type Annotated constructor function.
+ * @param {Object=} locals Optional object. If preset then any argument names are read from this
+ * object first, before the `$injector` is consulted.
+ * @returns {Object} new instance of `Type`.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#annotate
+ *
+ * @description
+ * Returns an array of service names which the function is requesting for injection. This API is
+ * used by the injector to determine which services need to be injected into the function when the
+ * function is invoked. There are three ways in which the function can be annotated with the needed
+ * dependencies.
+ *
+ * # Argument names
+ *
+ * The simplest form is to extract the dependencies from the arguments of the function. This is done
+ * by converting the function into a string using `toString()` method and extracting the argument
+ * names.
+ * ```js
+ * // Given
+ * function MyController($scope, $route) {
+ * // ...
+ * }
+ *
+ * // Then
+ * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+ * ```
+ *
+ * You can disallow this method by using strict injection mode.
+ *
+ * This method does not work with code minification / obfuscation. For this reason the following
+ * annotation strategies are supported.
+ *
+ * # The `$inject` property
+ *
+ * If a function has an `$inject` property and its value is an array of strings, then the strings
+ * represent names of services to be injected into the function.
+ * ```js
+ * // Given
+ * var MyController = function(obfuscatedScope, obfuscatedRoute) {
+ * // ...
+ * }
+ * // Define function dependencies
+ * MyController['$inject'] = ['$scope', '$route'];
+ *
+ * // Then
+ * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+ * ```
+ *
+ * # The array notation
+ *
+ * It is often desirable to inline Injected functions and that's when setting the `$inject` property
+ * is very inconvenient. In these situations using the array notation to specify the dependencies in
+ * a way that survives minification is a better choice:
+ *
+ * ```js
+ * // We wish to write this (not minification / obfuscation safe)
+ * injector.invoke(function($compile, $rootScope) {
+ * // ...
+ * });
+ *
+ * // We are forced to write break inlining
+ * var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {
+ * // ...
+ * };
+ * tmpFn.$inject = ['$compile', '$rootScope'];
+ * injector.invoke(tmpFn);
+ *
+ * // To better support inline function the inline annotation is supported
+ * injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {
+ * // ...
+ * }]);
+ *
+ * // Therefore
+ * expect(injector.annotate(
+ * ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
+ * ).toEqual(['$compile', '$rootScope']);
+ * ```
+ *
+ * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to
+ * be retrieved as described above.
+ *
+ * @param {boolean=} [strictDi=false] Disallow argument name annotation inference.
+ *
+ * @returns {Array.<string>} The names of the services which the function requires.
+ */
+
+
+
+
+/**
+ * @ngdoc service
+ * @name $provide
+ *
+ * @description
+ *
+ * The {@link auto.$provide $provide} service has a number of methods for registering components
+ * with the {@link auto.$injector $injector}. Many of these functions are also exposed on
+ * {@link angular.Module}.
+ *
+ * An Angular **service** is a singleton object created by a **service factory**. These **service
+ * factories** are functions which, in turn, are created by a **service provider**.
+ * The **service providers** are constructor functions. When instantiated they must contain a
+ * property called `$get`, which holds the **service factory** function.
+ *
+ * When you request a service, the {@link auto.$injector $injector} is responsible for finding the
+ * correct **service provider**, instantiating it and then calling its `$get` **service factory**
+ * function to get the instance of the **service**.
+ *
+ * Often services have no configuration options and there is no need to add methods to the service
+ * provider. The provider will be no more than a constructor function with a `$get` property. For
+ * these cases the {@link auto.$provide $provide} service has additional helper methods to register
+ * services without specifying a provider.
+ *
+ * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the
+ * {@link auto.$injector $injector}
+ * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by
+ * providers and services.
+ * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by
+ * services, not providers.
+ * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`,
+ * that will be wrapped in a **service provider** object, whose `$get` property will contain the
+ * given factory function.
+ * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class`
+ * that will be wrapped in a **service provider** object, whose `$get` property will instantiate
+ * a new object using the given constructor function.
+ *
+ * See the individual methods for more information and examples.
+ */
+
+/**
+ * @ngdoc method
+ * @name $provide#provider
+ * @description
+ *
+ * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions
+ * are constructor functions, whose instances are responsible for "providing" a factory for a
+ * service.
+ *
+ * Service provider names start with the name of the service they provide followed by `Provider`.
+ * For example, the {@link ng.$log $log} service has a provider called
+ * {@link ng.$logProvider $logProvider}.
+ *
+ * Service provider objects can have additional methods which allow configuration of the provider
+ * and its service. Importantly, you can configure what kind of service is created by the `$get`
+ * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a
+ * method {@link ng.$logProvider#debugEnabled debugEnabled}
+ * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the
+ * console or not.
+ *
+ * @param {string} name The name of the instance. NOTE: the provider will be available under `name +
+ 'Provider'` key.
+ * @param {(Object|function())} provider If the provider is:
+ *
+ * - `Object`: then it should have a `$get` method. The `$get` method will be invoked using
+ * {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created.
+ * - `Constructor`: a new instance of the provider will be created using
+ * {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`.
+ *
+ * @returns {Object} registered provider instance
+
+ * @example
+ *
+ * The following example shows how to create a simple event tracking service and register it using
+ * {@link auto.$provide#provider $provide.provider()}.
+ *
+ * ```js
+ * // Define the eventTracker provider
+ * function EventTrackerProvider() {
+ * var trackingUrl = '/track';
+ *
+ * // A provider method for configuring where the tracked events should been saved
+ * this.setTrackingUrl = function(url) {
+ * trackingUrl = url;
+ * };
+ *
+ * // The service factory function
+ * this.$get = ['$http', function($http) {
+ * var trackedEvents = {};
+ * return {
+ * // Call this to track an event
+ * event: function(event) {
+ * var count = trackedEvents[event] || 0;
+ * count += 1;
+ * trackedEvents[event] = count;
+ * return count;
+ * },
+ * // Call this to save the tracked events to the trackingUrl
+ * save: function() {
+ * $http.post(trackingUrl, trackedEvents);
+ * }
+ * };
+ * }];
+ * }
+ *
+ * describe('eventTracker', function() {
+ * var postSpy;
+ *
+ * beforeEach(module(function($provide) {
+ * // Register the eventTracker provider
+ * $provide.provider('eventTracker', EventTrackerProvider);
+ * }));
+ *
+ * beforeEach(module(function(eventTrackerProvider) {
+ * // Configure eventTracker provider
+ * eventTrackerProvider.setTrackingUrl('/custom-track');
+ * }));
+ *
+ * it('tracks events', inject(function(eventTracker) {
+ * expect(eventTracker.event('login')).toEqual(1);
+ * expect(eventTracker.event('login')).toEqual(2);
+ * }));
+ *
+ * it('saves to the tracking url', inject(function(eventTracker, $http) {
+ * postSpy = spyOn($http, 'post');
+ * eventTracker.event('login');
+ * eventTracker.save();
+ * expect(postSpy).toHaveBeenCalled();
+ * expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');
+ * expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');
+ * expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });
+ * }));
+ * });
+ * ```
+ */
+
+/**
+ * @ngdoc method
+ * @name $provide#factory
+ * @description
+ *
+ * Register a **service factory**, which will be called to return the service instance.
+ * This is short for registering a service where its provider consists of only a `$get` property,
+ * which is the given service factory function.
+ * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to
+ * configure your service in a provider.
+ *
+ * @param {string} name The name of the instance.
+ * @param {Function|Array.<string|Function>} $getFn The injectable $getFn for the instance creation.
+ * Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here is an example of registering a service
+ * ```js
+ * $provide.factory('ping', ['$http', function($http) {
+ * return function ping() {
+ * return $http.send('/ping');
+ * };
+ * }]);
+ * ```
+ * You would then inject and use this service like this:
+ * ```js
+ * someModule.controller('Ctrl', ['ping', function(ping) {
+ * ping();
+ * }]);
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#service
+ * @description
+ *
+ * Register a **service constructor**, which will be invoked with `new` to create the service
+ * instance.
+ * This is short for registering a service where its provider's `$get` property is a factory
+ * function that returns an instance instantiated by the injector from the service constructor
+ * function.
+ *
+ * Internally it looks a bit like this:
+ *
+ * ```
+ * {
+ * $get: function() {
+ * return $injector.instantiate(constructor);
+ * }
+ * }
+ * ```
+ *
+ *
+ * You should use {@link auto.$provide#service $provide.service(class)} if you define your service
+ * as a type/class.
+ *
+ * @param {string} name The name of the instance.
+ * @param {Function|Array.<string|Function>} constructor An injectable class (constructor function)
+ * that will be instantiated.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here is an example of registering a service using
+ * {@link auto.$provide#service $provide.service(class)}.
+ * ```js
+ * var Ping = function($http) {
+ * this.$http = $http;
+ * };
+ *
+ * Ping.$inject = ['$http'];
+ *
+ * Ping.prototype.send = function() {
+ * return this.$http.get('/ping');
+ * };
+ * $provide.service('ping', Ping);
+ * ```
+ * You would then inject and use this service like this:
+ * ```js
+ * someModule.controller('Ctrl', ['ping', function(ping) {
+ * ping.send();
+ * }]);
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#value
+ * @description
+ *
+ * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a
+ * number, an array, an object or a function. This is short for registering a service where its
+ * provider's `$get` property is a factory function that takes no arguments and returns the **value
+ * service**.
+ *
+ * Value services are similar to constant services, except that they cannot be injected into a
+ * module configuration function (see {@link angular.Module#config}) but they can be overridden by
+ * an Angular
+ * {@link auto.$provide#decorator decorator}.
+ *
+ * @param {string} name The name of the instance.
+ * @param {*} value The value.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here are some examples of creating value services.
+ * ```js
+ * $provide.value('ADMIN_USER', 'admin');
+ *
+ * $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });
+ *
+ * $provide.value('halfOf', function(value) {
+ * return value / 2;
+ * });
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#constant
+ * @description
+ *
+ * Register a **constant service**, such as a string, a number, an array, an object or a function,
+ * with the {@link auto.$injector $injector}. Unlike {@link auto.$provide#value value} it can be
+ * injected into a module configuration function (see {@link angular.Module#config}) and it cannot
+ * be overridden by an Angular {@link auto.$provide#decorator decorator}.
+ *
+ * @param {string} name The name of the constant.
+ * @param {*} value The constant value.
+ * @returns {Object} registered instance
+ *
+ * @example
+ * Here a some examples of creating constants:
+ * ```js
+ * $provide.constant('SHARD_HEIGHT', 306);
+ *
+ * $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);
+ *
+ * $provide.constant('double', function(value) {
+ * return value * 2;
+ * });
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#decorator
+ * @description
+ *
+ * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator
+ * intercepts the creation of a service, allowing it to override or modify the behavior of the
+ * service. The object returned by the decorator may be the original service, or a new service
+ * object which replaces or wraps and delegates to the original service.
+ *
+ * @param {string} name The name of the service to decorate.
+ * @param {Function|Array.<string|Function>} decorator This function will be invoked when the service needs to be
+ * instantiated and should return the decorated service instance. The function is called using
+ * the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.
+ * Local injection arguments:
+ *
+ * * `$delegate` - The original service instance, which can be monkey patched, configured,
+ * decorated or delegated to.
+ *
+ * @example
+ * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting
+ * calls to {@link ng.$log#error $log.warn()}.
+ * ```js
+ * $provide.decorator('$log', ['$delegate', function($delegate) {
+ * $delegate.warn = $delegate.error;
+ * return $delegate;
+ * }]);
+ * ```
+ */
+
+
+function createInjector(modulesToLoad, strictDi) {
+ strictDi = (strictDi === true);
+ var INSTANTIATING = {},
+ providerSuffix = 'Provider',
+ path = [],
+ loadedModules = new HashMap([], true),
+ providerCache = {
+ $provide: {
+ provider: supportObject(provider),
+ factory: supportObject(factory),
+ service: supportObject(service),
+ value: supportObject(value),
+ constant: supportObject(constant),
+ decorator: decorator
+ }
+ },
+ providerInjector = (providerCache.$injector =
+ createInternalInjector(providerCache, function(serviceName, caller) {
+ if (angular.isString(caller)) {
+ path.push(caller);
+ }
+ throw $injectorMinErr('unpr', "Unknown provider: {0}", path.join(' <- '));
+ })),
+ instanceCache = {},
+ protoInstanceInjector =
+ createInternalInjector(instanceCache, function(serviceName, caller) {
+ var provider = providerInjector.get(serviceName + providerSuffix, caller);
+ return instanceInjector.invoke(
+ provider.$get, provider, undefined, serviceName);
+ }),
+ instanceInjector = protoInstanceInjector;
+
+ providerCache['$injector' + providerSuffix] = { $get: valueFn(protoInstanceInjector) };
+ var runBlocks = loadModules(modulesToLoad);
+ instanceInjector = protoInstanceInjector.get('$injector');
+ instanceInjector.strictDi = strictDi;
+ forEach(runBlocks, function(fn) { if (fn) instanceInjector.invoke(fn); });
+
+ return instanceInjector;
+
+ ////////////////////////////////////
+ // $provider
+ ////////////////////////////////////
+
+ function supportObject(delegate) {
+ return function(key, value) {
+ if (isObject(key)) {
+ forEach(key, reverseParams(delegate));
+ } else {
+ return delegate(key, value);
+ }
+ };
+ }
+
+ function provider(name, provider_) {
+ assertNotHasOwnProperty(name, 'service');
+ if (isFunction(provider_) || isArray(provider_)) {
+ provider_ = providerInjector.instantiate(provider_);
+ }
+ if (!provider_.$get) {
+ throw $injectorMinErr('pget', "Provider '{0}' must define $get factory method.", name);
+ }
+ return providerCache[name + providerSuffix] = provider_;
+ }
+
+ function enforceReturnValue(name, factory) {
+ return function enforcedReturnValue() {
+ var result = instanceInjector.invoke(factory, this);
+ if (isUndefined(result)) {
+ throw $injectorMinErr('undef', "Provider '{0}' must return a value from $get factory method.", name);
+ }
+ return result;
+ };
+ }
+
+ function factory(name, factoryFn, enforce) {
+ return provider(name, {
+ $get: enforce !== false ? enforceReturnValue(name, factoryFn) : factoryFn
+ });
+ }
+
+ function service(name, constructor) {
+ return factory(name, ['$injector', function($injector) {
+ return $injector.instantiate(constructor);
+ }]);
+ }
+
+ function value(name, val) { return factory(name, valueFn(val), false); }
+
+ function constant(name, value) {
+ assertNotHasOwnProperty(name, 'constant');
+ providerCache[name] = value;
+ instanceCache[name] = value;
+ }
+
+ function decorator(serviceName, decorFn) {
+ var origProvider = providerInjector.get(serviceName + providerSuffix),
+ orig$get = origProvider.$get;
+
+ origProvider.$get = function() {
+ var origInstance = instanceInjector.invoke(orig$get, origProvider);
+ return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});
+ };
+ }
+
+ ////////////////////////////////////
+ // Module Loading
+ ////////////////////////////////////
+ function loadModules(modulesToLoad) {
+ assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');
+ var runBlocks = [], moduleFn;
+ forEach(modulesToLoad, function(module) {
+ if (loadedModules.get(module)) return;
+ loadedModules.put(module, true);
+
+ function runInvokeQueue(queue) {
+ var i, ii;
+ for (i = 0, ii = queue.length; i < ii; i++) {
+ var invokeArgs = queue[i],
+ provider = providerInjector.get(invokeArgs[0]);
+
+ provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
+ }
+ }
+
+ try {
+ if (isString(module)) {
+ moduleFn = angularModule(module);
+ runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
+ runInvokeQueue(moduleFn._invokeQueue);
+ runInvokeQueue(moduleFn._configBlocks);
+ } else if (isFunction(module)) {
+ runBlocks.push(providerInjector.invoke(module));
+ } else if (isArray(module)) {
+ runBlocks.push(providerInjector.invoke(module));
+ } else {
+ assertArgFn(module, 'module');
+ }
+ } catch (e) {
+ if (isArray(module)) {
+ module = module[module.length - 1];
+ }
+ if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {
+ // Safari & FF's stack traces don't contain error.message content
+ // unlike those of Chrome and IE
+ // So if stack doesn't contain message, we create a new string that contains both.
+ // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
+ /* jshint -W022 */
+ e = e.message + '\n' + e.stack;
+ }
+ throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
+ module, e.stack || e.message || e);
+ }
+ });
+ return runBlocks;
+ }
+
+ ////////////////////////////////////
+ // internal Injector
+ ////////////////////////////////////
+
+ function createInternalInjector(cache, factory) {
+
+ function getService(serviceName, caller) {
+ if (cache.hasOwnProperty(serviceName)) {
+ if (cache[serviceName] === INSTANTIATING) {
+ throw $injectorMinErr('cdep', 'Circular dependency found: {0}',
+ serviceName + ' <- ' + path.join(' <- '));
+ }
+ return cache[serviceName];
+ } else {
+ try {
+ path.unshift(serviceName);
+ cache[serviceName] = INSTANTIATING;
+ return cache[serviceName] = factory(serviceName, caller);
+ } catch (err) {
+ if (cache[serviceName] === INSTANTIATING) {
+ delete cache[serviceName];
+ }
+ throw err;
+ } finally {
+ path.shift();
+ }
+ }
+ }
+
+
+ function injectionArgs(fn, locals, serviceName) {
+ var args = [],
+ $inject = createInjector.$$annotate(fn, strictDi, serviceName);
+
+ for (var i = 0, length = $inject.length; i < length; i++) {
+ var key = $inject[i];
+ if (typeof key !== 'string') {
+ throw $injectorMinErr('itkn',
+ 'Incorrect injection token! Expected service name as string, got {0}', key);
+ }
+ args.push(locals && locals.hasOwnProperty(key) ? locals[key] :
+ getService(key, serviceName));
+ }
+ return args;
+ }
+
+ function isClass(func) {
+ // IE 9-11 do not support classes and IE9 leaks with the code below.
+ if (msie <= 11) {
+ return false;
+ }
+ // Workaround for MS Edge.
+ // Check https://connect.microsoft.com/IE/Feedback/Details/2211653
+ return typeof func === 'function'
+ && /^(?:class\s|constructor\()/.test(Function.prototype.toString.call(func));
+ }
+
+ function invoke(fn, self, locals, serviceName) {
+ if (typeof locals === 'string') {
+ serviceName = locals;
+ locals = null;
+ }
+
+ var args = injectionArgs(fn, locals, serviceName);
+ if (isArray(fn)) {
+ fn = fn[fn.length - 1];
+ }
+
+ if (!isClass(fn)) {
+ // http://jsperf.com/angularjs-invoke-apply-vs-switch
+ // #5388
+ return fn.apply(self, args);
+ } else {
+ args.unshift(null);
+ return new (Function.prototype.bind.apply(fn, args))();
+ }
+ }
+
+
+ function instantiate(Type, locals, serviceName) {
+ // Check if Type is annotated and use just the given function at n-1 as parameter
+ // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
+ var ctor = (isArray(Type) ? Type[Type.length - 1] : Type);
+ var args = injectionArgs(Type, locals, serviceName);
+ // Empty object at position 0 is ignored for invocation with `new`, but required.
+ args.unshift(null);
+ return new (Function.prototype.bind.apply(ctor, args))();
+ }
+
+
+ return {
+ invoke: invoke,
+ instantiate: instantiate,
+ get: getService,
+ annotate: createInjector.$$annotate,
+ has: function(name) {
+ return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);
+ }
+ };
+ }
+}
+
+createInjector.$$annotate = annotate;
+
+/**
+ * @ngdoc provider
+ * @name $anchorScrollProvider
+ *
+ * @description
+ * Use `$anchorScrollProvider` to disable automatic scrolling whenever
+ * {@link ng.$location#hash $location.hash()} changes.
+ */
+function $AnchorScrollProvider() {
+
+ var autoScrollingEnabled = true;
+
+ /**
+ * @ngdoc method
+ * @name $anchorScrollProvider#disableAutoScrolling
+ *
+ * @description
+ * By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to
+ * {@link ng.$location#hash $location.hash()} and scroll to the element matching the new hash.<br />
+ * Use this method to disable automatic scrolling.
+ *
+ * If automatic scrolling is disabled, one must explicitly call
+ * {@link ng.$anchorScroll $anchorScroll()} in order to scroll to the element related to the
+ * current hash.
+ */
+ this.disableAutoScrolling = function() {
+ autoScrollingEnabled = false;
+ };
+
+ /**
+ * @ngdoc service
+ * @name $anchorScroll
+ * @kind function
+ * @requires $window
+ * @requires $location
+ * @requires $rootScope
+ *
+ * @description
+ * When called, it scrolls to the element related to the specified `hash` or (if omitted) to the
+ * current value of {@link ng.$location#hash $location.hash()}, according to the rules specified
+ * in the
+ * [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#the-indicated-part-of-the-document).
+ *
+ * It also watches the {@link ng.$location#hash $location.hash()} and automatically scrolls to
+ * match any anchor whenever it changes. This can be disabled by calling
+ * {@link ng.$anchorScrollProvider#disableAutoScrolling $anchorScrollProvider.disableAutoScrolling()}.
+ *
+ * Additionally, you can use its {@link ng.$anchorScroll#yOffset yOffset} property to specify a
+ * vertical scroll-offset (either fixed or dynamic).
+ *
+ * @param {string=} hash The hash specifying the element to scroll to. If omitted, the value of
+ * {@link ng.$location#hash $location.hash()} will be used.
+ *
+ * @property {(number|function|jqLite)} yOffset
+ * If set, specifies a vertical scroll-offset. This is often useful when there are fixed
+ * positioned elements at the top of the page, such as navbars, headers etc.
+ *
+ * `yOffset` can be specified in various ways:
+ * - **number**: A fixed number of pixels to be used as offset.<br /><br />
+ * - **function**: A getter function called everytime `$anchorScroll()` is executed. Must return
+ * a number representing the offset (in pixels).<br /><br />
+ * - **jqLite**: A jqLite/jQuery element to be used for specifying the offset. The distance from
+ * the top of the page to the element's bottom will be used as offset.<br />
+ * **Note**: The element will be taken into account only as long as its `position` is set to
+ * `fixed`. This option is useful, when dealing with responsive navbars/headers that adjust
+ * their height and/or positioning according to the viewport's size.
+ *
+ * <br />
+ * <div class="alert alert-warning">
+ * In order for `yOffset` to work properly, scrolling should take place on the document's root and
+ * not some child element.
+ * </div>
+ *
+ * @example
+ <example module="anchorScrollExample">
+ <file name="index.html">
+ <div id="scrollArea" ng-controller="ScrollController">
+ <a ng-click="gotoBottom()">Go to bottom</a>
+ <a id="bottom"></a> You're at the bottom!
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('anchorScrollExample', [])
+ .controller('ScrollController', ['$scope', '$location', '$anchorScroll',
+ function ($scope, $location, $anchorScroll) {
+ $scope.gotoBottom = function() {
+ // set the location.hash to the id of
+ // the element you wish to scroll to.
+ $location.hash('bottom');
+
+ // call $anchorScroll()
+ $anchorScroll();
+ };
+ }]);
+ </file>
+ <file name="style.css">
+ #scrollArea {
+ height: 280px;
+ overflow: auto;
+ }
+
+ #bottom {
+ display: block;
+ margin-top: 2000px;
+ }
+ </file>
+ </example>
+ *
+ * <hr />
+ * The example below illustrates the use of a vertical scroll-offset (specified as a fixed value).
+ * See {@link ng.$anchorScroll#yOffset $anchorScroll.yOffset} for more details.
+ *
+ * @example
+ <example module="anchorScrollOffsetExample">
+ <file name="index.html">
+ <div class="fixed-header" ng-controller="headerCtrl">
+ <a href="" ng-click="gotoAnchor(x)" ng-repeat="x in [1,2,3,4,5]">
+ Go to anchor {{x}}
+ </a>
+ </div>
+ <div id="anchor{{x}}" class="anchor" ng-repeat="x in [1,2,3,4,5]">
+ Anchor {{x}} of 5
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('anchorScrollOffsetExample', [])
+ .run(['$anchorScroll', function($anchorScroll) {
+ $anchorScroll.yOffset = 50; // always scroll by 50 extra pixels
+ }])
+ .controller('headerCtrl', ['$anchorScroll', '$location', '$scope',
+ function ($anchorScroll, $location, $scope) {
+ $scope.gotoAnchor = function(x) {
+ var newHash = 'anchor' + x;
+ if ($location.hash() !== newHash) {
+ // set the $location.hash to `newHash` and
+ // $anchorScroll will automatically scroll to it
+ $location.hash('anchor' + x);
+ } else {
+ // call $anchorScroll() explicitly,
+ // since $location.hash hasn't changed
+ $anchorScroll();
+ }
+ };
+ }
+ ]);
+ </file>
+ <file name="style.css">
+ body {
+ padding-top: 50px;
+ }
+
+ .anchor {
+ border: 2px dashed DarkOrchid;
+ padding: 10px 10px 200px 10px;
+ }
+
+ .fixed-header {
+ background-color: rgba(0, 0, 0, 0.2);
+ height: 50px;
+ position: fixed;
+ top: 0; left: 0; right: 0;
+ }
+
+ .fixed-header > a {
+ display: inline-block;
+ margin: 5px 15px;
+ }
+ </file>
+ </example>
+ */
+ this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {
+ var document = $window.document;
+
+ // Helper function to get first anchor from a NodeList
+ // (using `Array#some()` instead of `angular#forEach()` since it's more performant
+ // and working in all supported browsers.)
+ function getFirstAnchor(list) {
+ var result = null;
+ Array.prototype.some.call(list, function(element) {
+ if (nodeName_(element) === 'a') {
+ result = element;
+ return true;
+ }
+ });
+ return result;
+ }
+
+ function getYOffset() {
+
+ var offset = scroll.yOffset;
+
+ if (isFunction(offset)) {
+ offset = offset();
+ } else if (isElement(offset)) {
+ var elem = offset[0];
+ var style = $window.getComputedStyle(elem);
+ if (style.position !== 'fixed') {
+ offset = 0;
+ } else {
+ offset = elem.getBoundingClientRect().bottom;
+ }
+ } else if (!isNumber(offset)) {
+ offset = 0;
+ }
+
+ return offset;
+ }
+
+ function scrollTo(elem) {
+ if (elem) {
+ elem.scrollIntoView();
+
+ var offset = getYOffset();
+
+ if (offset) {
+ // `offset` is the number of pixels we should scroll UP in order to align `elem` properly.
+ // This is true ONLY if the call to `elem.scrollIntoView()` initially aligns `elem` at the
+ // top of the viewport.
+ //
+ // IF the number of pixels from the top of `elem` to the end of the page's content is less
+ // than the height of the viewport, then `elem.scrollIntoView()` will align the `elem` some
+ // way down the page.
+ //
+ // This is often the case for elements near the bottom of the page.
+ //
+ // In such cases we do not need to scroll the whole `offset` up, just the difference between
+ // the top of the element and the offset, which is enough to align the top of `elem` at the
+ // desired position.
+ var elemTop = elem.getBoundingClientRect().top;
+ $window.scrollBy(0, elemTop - offset);
+ }
+ } else {
+ $window.scrollTo(0, 0);
+ }
+ }
+
+ function scroll(hash) {
+ hash = isString(hash) ? hash : $location.hash();
+ var elm;
+
+ // empty hash, scroll to the top of the page
+ if (!hash) scrollTo(null);
+
+ // element with given id
+ else if ((elm = document.getElementById(hash))) scrollTo(elm);
+
+ // first anchor with given name :-D
+ else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);
+
+ // no element and hash == 'top', scroll to the top of the page
+ else if (hash === 'top') scrollTo(null);
+ }
+
+ // does not scroll when user clicks on anchor link that is currently on
+ // (no url change, no $location.hash() change), browser native does scroll
+ if (autoScrollingEnabled) {
+ $rootScope.$watch(function autoScrollWatch() {return $location.hash();},
+ function autoScrollWatchAction(newVal, oldVal) {
+ // skip the initial scroll if $location.hash is empty
+ if (newVal === oldVal && newVal === '') return;
+
+ jqLiteDocumentLoaded(function() {
+ $rootScope.$evalAsync(scroll);
+ });
+ });
+ }
+
+ return scroll;
+ }];
+}
+
+var $animateMinErr = minErr('$animate');
+var ELEMENT_NODE = 1;
+var NG_ANIMATE_CLASSNAME = 'ng-animate';
+
+function mergeClasses(a,b) {
+ if (!a && !b) return '';
+ if (!a) return b;
+ if (!b) return a;
+ if (isArray(a)) a = a.join(' ');
+ if (isArray(b)) b = b.join(' ');
+ return a + ' ' + b;
+}
+
+function extractElementNode(element) {
+ for (var i = 0; i < element.length; i++) {
+ var elm = element[i];
+ if (elm.nodeType === ELEMENT_NODE) {
+ return elm;
+ }
+ }
+}
+
+function splitClasses(classes) {
+ if (isString(classes)) {
+ classes = classes.split(' ');
+ }
+
+ // Use createMap() to prevent class assumptions involving property names in
+ // Object.prototype
+ var obj = createMap();
+ forEach(classes, function(klass) {
+ // sometimes the split leaves empty string values
+ // incase extra spaces were applied to the options
+ if (klass.length) {
+ obj[klass] = true;
+ }
+ });
+ return obj;
+}
+
+// if any other type of options value besides an Object value is
+// passed into the $animate.method() animation then this helper code
+// will be run which will ignore it. While this patch is not the
+// greatest solution to this, a lot of existing plugins depend on
+// $animate to either call the callback (< 1.2) or return a promise
+// that can be changed. This helper function ensures that the options
+// are wiped clean incase a callback function is provided.
+function prepareAnimateOptions(options) {
+ return isObject(options)
+ ? options
+ : {};
+}
+
+var $$CoreAnimateJsProvider = function() {
+ this.$get = function() {};
+};
+
+// this is prefixed with Core since it conflicts with
+// the animateQueueProvider defined in ngAnimate/animateQueue.js
+var $$CoreAnimateQueueProvider = function() {
+ var postDigestQueue = new HashMap();
+ var postDigestElements = [];
+
+ this.$get = ['$$AnimateRunner', '$rootScope',
+ function($$AnimateRunner, $rootScope) {
+ return {
+ enabled: noop,
+ on: noop,
+ off: noop,
+ pin: noop,
+
+ push: function(element, event, options, domOperation) {
+ domOperation && domOperation();
+
+ options = options || {};
+ options.from && element.css(options.from);
+ options.to && element.css(options.to);
+
+ if (options.addClass || options.removeClass) {
+ addRemoveClassesPostDigest(element, options.addClass, options.removeClass);
+ }
+
+ var runner = new $$AnimateRunner(); // jshint ignore:line
+
+ // since there are no animations to run the runner needs to be
+ // notified that the animation call is complete.
+ runner.complete();
+ return runner;
+ }
+ };
+
+
+ function updateData(data, classes, value) {
+ var changed = false;
+ if (classes) {
+ classes = isString(classes) ? classes.split(' ') :
+ isArray(classes) ? classes : [];
+ forEach(classes, function(className) {
+ if (className) {
+ changed = true;
+ data[className] = value;
+ }
+ });
+ }
+ return changed;
+ }
+
+ function handleCSSClassChanges() {
+ forEach(postDigestElements, function(element) {
+ var data = postDigestQueue.get(element);
+ if (data) {
+ var existing = splitClasses(element.attr('class'));
+ var toAdd = '';
+ var toRemove = '';
+ forEach(data, function(status, className) {
+ var hasClass = !!existing[className];
+ if (status !== hasClass) {
+ if (status) {
+ toAdd += (toAdd.length ? ' ' : '') + className;
+ } else {
+ toRemove += (toRemove.length ? ' ' : '') + className;
+ }
+ }
+ });
+
+ forEach(element, function(elm) {
+ toAdd && jqLiteAddClass(elm, toAdd);
+ toRemove && jqLiteRemoveClass(elm, toRemove);
+ });
+ postDigestQueue.remove(element);
+ }
+ });
+ postDigestElements.length = 0;
+ }
+
+
+ function addRemoveClassesPostDigest(element, add, remove) {
+ var data = postDigestQueue.get(element) || {};
+
+ var classesAdded = updateData(data, add, true);
+ var classesRemoved = updateData(data, remove, false);
+
+ if (classesAdded || classesRemoved) {
+
+ postDigestQueue.put(element, data);
+ postDigestElements.push(element);
+
+ if (postDigestElements.length === 1) {
+ $rootScope.$$postDigest(handleCSSClassChanges);
+ }
+ }
+ }
+ }];
+};
+
+/**
+ * @ngdoc provider
+ * @name $animateProvider
+ *
+ * @description
+ * Default implementation of $animate that doesn't perform any animations, instead just
+ * synchronously performs DOM updates and resolves the returned runner promise.
+ *
+ * In order to enable animations the `ngAnimate` module has to be loaded.
+ *
+ * To see the functional implementation check out `src/ngAnimate/animate.js`.
+ */
+var $AnimateProvider = ['$provide', function($provide) {
+ var provider = this;
+
+ this.$$registeredAnimations = Object.create(null);
+
+ /**
+ * @ngdoc method
+ * @name $animateProvider#register
+ *
+ * @description
+ * Registers a new injectable animation factory function. The factory function produces the
+ * animation object which contains callback functions for each event that is expected to be
+ * animated.
+ *
+ * * `eventFn`: `function(element, ... , doneFunction, options)`
+ * The element to animate, the `doneFunction` and the options fed into the animation. Depending
+ * on the type of animation additional arguments will be injected into the animation function. The
+ * list below explains the function signatures for the different animation methods:
+ *
+ * - setClass: function(element, addedClasses, removedClasses, doneFunction, options)
+ * - addClass: function(element, addedClasses, doneFunction, options)
+ * - removeClass: function(element, removedClasses, doneFunction, options)
+ * - enter, leave, move: function(element, doneFunction, options)
+ * - animate: function(element, fromStyles, toStyles, doneFunction, options)
+ *
+ * Make sure to trigger the `doneFunction` once the animation is fully complete.
+ *
+ * ```js
+ * return {
+ * //enter, leave, move signature
+ * eventFn : function(element, done, options) {
+ * //code to run the animation
+ * //once complete, then run done()
+ * return function endFunction(wasCancelled) {
+ * //code to cancel the animation
+ * }
+ * }
+ * }
+ * ```
+ *
+ * @param {string} name The name of the animation (this is what the class-based CSS value will be compared to).
+ * @param {Function} factory The factory function that will be executed to return the animation
+ * object.
+ */
+ this.register = function(name, factory) {
+ if (name && name.charAt(0) !== '.') {
+ throw $animateMinErr('notcsel', "Expecting class selector starting with '.' got '{0}'.", name);
+ }
+
+ var key = name + '-animation';
+ provider.$$registeredAnimations[name.substr(1)] = key;
+ $provide.factory(key, factory);
+ };
+
+ /**
+ * @ngdoc method
+ * @name $animateProvider#classNameFilter
+ *
+ * @description
+ * Sets and/or returns the CSS class regular expression that is checked when performing
+ * an animation. Upon bootstrap the classNameFilter value is not set at all and will
+ * therefore enable $animate to attempt to perform an animation on any element that is triggered.
+ * When setting the `classNameFilter` value, animations will only be performed on elements
+ * that successfully match the filter expression. This in turn can boost performance
+ * for low-powered devices as well as applications containing a lot of structural operations.
+ * @param {RegExp=} expression The className expression which will be checked against all animations
+ * @return {RegExp} The current CSS className expression value. If null then there is no expression value
+ */
+ this.classNameFilter = function(expression) {
+ if (arguments.length === 1) {
+ this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;
+ if (this.$$classNameFilter) {
+ var reservedRegex = new RegExp("(\\s+|\\/)" + NG_ANIMATE_CLASSNAME + "(\\s+|\\/)");
+ if (reservedRegex.test(this.$$classNameFilter.toString())) {
+ throw $animateMinErr('nongcls','$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME);
+
+ }
+ }
+ }
+ return this.$$classNameFilter;
+ };
+
+ this.$get = ['$$animateQueue', function($$animateQueue) {
+ function domInsert(element, parentElement, afterElement) {
+ // if for some reason the previous element was removed
+ // from the dom sometime before this code runs then let's
+ // just stick to using the parent element as the anchor
+ if (afterElement) {
+ var afterNode = extractElementNode(afterElement);
+ if (afterNode && !afterNode.parentNode && !afterNode.previousElementSibling) {
+ afterElement = null;
+ }
+ }
+ afterElement ? afterElement.after(element) : parentElement.prepend(element);
+ }
+
+ /**
+ * @ngdoc service
+ * @name $animate
+ * @description The $animate service exposes a series of DOM utility methods that provide support
+ * for animation hooks. The default behavior is the application of DOM operations, however,
+ * when an animation is detected (and animations are enabled), $animate will do the heavy lifting
+ * to ensure that animation runs with the triggered DOM operation.
+ *
+ * By default $animate doesn't trigger any animations. This is because the `ngAnimate` module isn't
+ * included and only when it is active then the animation hooks that `$animate` triggers will be
+ * functional. Once active then all structural `ng-` directives will trigger animations as they perform
+ * their DOM-related operations (enter, leave and move). Other directives such as `ngClass`,
+ * `ngShow`, `ngHide` and `ngMessages` also provide support for animations.
+ *
+ * It is recommended that the`$animate` service is always used when executing DOM-related procedures within directives.
+ *
+ * To learn more about enabling animation support, click here to visit the
+ * {@link ngAnimate ngAnimate module page}.
+ */
+ return {
+ // we don't call it directly since non-existant arguments may
+ // be interpreted as null within the sub enabled function
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#on
+ * @kind function
+ * @description Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...)
+ * has fired on the given element or among any of its children. Once the listener is fired, the provided callback
+ * is fired with the following params:
+ *
+ * ```js
+ * $animate.on('enter', container,
+ * function callback(element, phase) {
+ * // cool we detected an enter animation within the container
+ * }
+ * );
+ * ```
+ *
+ * @param {string} event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...)
+ * @param {DOMElement} container the container element that will capture each of the animation events that are fired on itself
+ * as well as among its children
+ * @param {Function} callback the callback function that will be fired when the listener is triggered
+ *
+ * The arguments present in the callback function are:
+ * * `element` - The captured DOM element that the animation was fired on.
+ * * `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends).
+ */
+ on: $$animateQueue.on,
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#off
+ * @kind function
+ * @description Deregisters an event listener based on the event which has been associated with the provided element. This method
+ * can be used in three different ways depending on the arguments:
+ *
+ * ```js
+ * // remove all the animation event listeners listening for `enter`
+ * $animate.off('enter');
+ *
+ * // remove all the animation event listeners listening for `enter` on the given element and its children
+ * $animate.off('enter', container);
+ *
+ * // remove the event listener function provided by `callback` that is set
+ * // to listen for `enter` on the given `container` as well as its children
+ * $animate.off('enter', container, callback);
+ * ```
+ *
+ * @param {string} event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...)
+ * @param {DOMElement=} container the container element the event listener was placed on
+ * @param {Function=} callback the callback function that was registered as the listener
+ */
+ off: $$animateQueue.off,
+
+ /**
+ * @ngdoc method
+ * @name $animate#pin
+ * @kind function
+ * @description Associates the provided element with a host parent element to allow the element to be animated even if it exists
+ * outside of the DOM structure of the Angular application. By doing so, any animation triggered via `$animate` can be issued on the
+ * element despite being outside the realm of the application or within another application. Say for example if the application
+ * was bootstrapped on an element that is somewhere inside of the `<body>` tag, but we wanted to allow for an element to be situated
+ * as a direct child of `document.body`, then this can be achieved by pinning the element via `$animate.pin(element)`. Keep in mind
+ * that calling `$animate.pin(element, parentElement)` will not actually insert into the DOM anywhere; it will just create the association.
+ *
+ * Note that this feature is only active when the `ngAnimate` module is used.
+ *
+ * @param {DOMElement} element the external element that will be pinned
+ * @param {DOMElement} parentElement the host parent element that will be associated with the external element
+ */
+ pin: $$animateQueue.pin,
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#enabled
+ * @kind function
+ * @description Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This
+ * function can be called in four ways:
+ *
+ * ```js
+ * // returns true or false
+ * $animate.enabled();
+ *
+ * // changes the enabled state for all animations
+ * $animate.enabled(false);
+ * $animate.enabled(true);
+ *
+ * // returns true or false if animations are enabled for an element
+ * $animate.enabled(element);
+ *
+ * // changes the enabled state for an element and its children
+ * $animate.enabled(element, true);
+ * $animate.enabled(element, false);
+ * ```
+ *
+ * @param {DOMElement=} element the element that will be considered for checking/setting the enabled state
+ * @param {boolean=} enabled whether or not the animations will be enabled for the element
+ *
+ * @return {boolean} whether or not animations are enabled
+ */
+ enabled: $$animateQueue.enabled,
+
+ /**
+ * @ngdoc method
+ * @name $animate#cancel
+ * @kind function
+ * @description Cancels the provided animation.
+ *
+ * @param {Promise} animationPromise The animation promise that is returned when an animation is started.
+ */
+ cancel: function(runner) {
+ runner.end && runner.end();
+ },
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#enter
+ * @kind function
+ * @description Inserts the element into the DOM either after the `after` element (if provided) or
+ * as the first child within the `parent` element and then triggers an animation.
+ * A promise is returned that will be resolved during the next digest once the animation
+ * has completed.
+ *
+ * @param {DOMElement} element the element which will be inserted into the DOM
+ * @param {DOMElement} parent the parent element which will append the element as
+ * a child (so long as the after element is not present)
+ * @param {DOMElement=} after the sibling element after which the element will be appended
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ enter: function(element, parent, after, options) {
+ parent = parent && jqLite(parent);
+ after = after && jqLite(after);
+ parent = parent || after.parent();
+ domInsert(element, parent, after);
+ return $$animateQueue.push(element, 'enter', prepareAnimateOptions(options));
+ },
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#move
+ * @kind function
+ * @description Inserts (moves) the element into its new position in the DOM either after
+ * the `after` element (if provided) or as the first child within the `parent` element
+ * and then triggers an animation. A promise is returned that will be resolved
+ * during the next digest once the animation has completed.
+ *
+ * @param {DOMElement} element the element which will be moved into the new DOM position
+ * @param {DOMElement} parent the parent element which will append the element as
+ * a child (so long as the after element is not present)
+ * @param {DOMElement=} after the sibling element after which the element will be appended
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ move: function(element, parent, after, options) {
+ parent = parent && jqLite(parent);
+ after = after && jqLite(after);
+ parent = parent || after.parent();
+ domInsert(element, parent, after);
+ return $$animateQueue.push(element, 'move', prepareAnimateOptions(options));
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#leave
+ * @kind function
+ * @description Triggers an animation and then removes the element from the DOM.
+ * When the function is called a promise is returned that will be resolved during the next
+ * digest once the animation has completed.
+ *
+ * @param {DOMElement} element the element which will be removed from the DOM
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ leave: function(element, options) {
+ return $$animateQueue.push(element, 'leave', prepareAnimateOptions(options), function() {
+ element.remove();
+ });
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#addClass
+ * @kind function
+ *
+ * @description Triggers an addClass animation surrounding the addition of the provided CSS class(es). Upon
+ * execution, the addClass operation will only be handled after the next digest and it will not trigger an
+ * animation if element already contains the CSS class or if the class is removed at a later step.
+ * Note that class-based animations are treated differently compared to structural animations
+ * (like enter, move and leave) since the CSS classes may be added/removed at different points
+ * depending if CSS or JavaScript animations are used.
+ *
+ * @param {DOMElement} element the element which the CSS classes will be applied to
+ * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ addClass: function(element, className, options) {
+ options = prepareAnimateOptions(options);
+ options.addClass = mergeClasses(options.addclass, className);
+ return $$animateQueue.push(element, 'addClass', options);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#removeClass
+ * @kind function
+ *
+ * @description Triggers a removeClass animation surrounding the removal of the provided CSS class(es). Upon
+ * execution, the removeClass operation will only be handled after the next digest and it will not trigger an
+ * animation if element does not contain the CSS class or if the class is added at a later step.
+ * Note that class-based animations are treated differently compared to structural animations
+ * (like enter, move and leave) since the CSS classes may be added/removed at different points
+ * depending if CSS or JavaScript animations are used.
+ *
+ * @param {DOMElement} element the element which the CSS classes will be applied to
+ * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ removeClass: function(element, className, options) {
+ options = prepareAnimateOptions(options);
+ options.removeClass = mergeClasses(options.removeClass, className);
+ return $$animateQueue.push(element, 'removeClass', options);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#setClass
+ * @kind function
+ *
+ * @description Performs both the addition and removal of a CSS classes on an element and (during the process)
+ * triggers an animation surrounding the class addition/removal. Much like `$animate.addClass` and
+ * `$animate.removeClass`, `setClass` will only evaluate the classes being added/removed once a digest has
+ * passed. Note that class-based animations are treated differently compared to structural animations
+ * (like enter, move and leave) since the CSS classes may be added/removed at different points
+ * depending if CSS or JavaScript animations are used.
+ *
+ * @param {DOMElement} element the element which the CSS classes will be applied to
+ * @param {string} add the CSS class(es) that will be added (multiple classes are separated via spaces)
+ * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces)
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ setClass: function(element, add, remove, options) {
+ options = prepareAnimateOptions(options);
+ options.addClass = mergeClasses(options.addClass, add);
+ options.removeClass = mergeClasses(options.removeClass, remove);
+ return $$animateQueue.push(element, 'setClass', options);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#animate
+ * @kind function
+ *
+ * @description Performs an inline animation on the element which applies the provided to and from CSS styles to the element.
+ * If any detected CSS transition, keyframe or JavaScript matches the provided className value, then the animation will take
+ * on the provided styles. For example, if a transition animation is set for the given classNamem, then the provided `from` and
+ * `to` styles will be applied alongside the given transition. If the CSS style provided in `from` does not have a corresponding
+ * style in `to`, the style in `from` is applied immediately, and no animation is run.
+ * If a JavaScript animation is detected then the provided styles will be given in as function parameters into the `animate`
+ * method (or as part of the `options` parameter):
+ *
+ * ```js
+ * ngModule.animation('.my-inline-animation', function() {
+ * return {
+ * animate : function(element, from, to, done, options) {
+ * //animation
+ * done();
+ * }
+ * }
+ * });
+ * ```
+ *
+ * @param {DOMElement} element the element which the CSS styles will be applied to
+ * @param {object} from the from (starting) CSS styles that will be applied to the element and across the animation.
+ * @param {object} to the to (destination) CSS styles that will be applied to the element and across the animation.
+ * @param {string=} className an optional CSS class that will be applied to the element for the duration of the animation. If
+ * this value is left as empty then a CSS class of `ng-inline-animate` will be applied to the element.
+ * (Note that if no animation is detected then this value will not be applied to the element.)
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ animate: function(element, from, to, className, options) {
+ options = prepareAnimateOptions(options);
+ options.from = options.from ? extend(options.from, from) : from;
+ options.to = options.to ? extend(options.to, to) : to;
+
+ className = className || 'ng-inline-animate';
+ options.tempClasses = mergeClasses(options.tempClasses, className);
+ return $$animateQueue.push(element, 'animate', options);
+ }
+ };
+ }];
+}];
+
+var $$AnimateAsyncRunFactoryProvider = function() {
+ this.$get = ['$$rAF', function($$rAF) {
+ var waitQueue = [];
+
+ function waitForTick(fn) {
+ waitQueue.push(fn);
+ if (waitQueue.length > 1) return;
+ $$rAF(function() {
+ for (var i = 0; i < waitQueue.length; i++) {
+ waitQueue[i]();
+ }
+ waitQueue = [];
+ });
+ }
+
+ return function() {
+ var passed = false;
+ waitForTick(function() {
+ passed = true;
+ });
+ return function(callback) {
+ passed ? callback() : waitForTick(callback);
+ };
+ };
+ }];
+};
+
+var $$AnimateRunnerFactoryProvider = function() {
+ this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$document', '$timeout',
+ function($q, $sniffer, $$animateAsyncRun, $document, $timeout) {
+
+ var INITIAL_STATE = 0;
+ var DONE_PENDING_STATE = 1;
+ var DONE_COMPLETE_STATE = 2;
+
+ AnimateRunner.chain = function(chain, callback) {
+ var index = 0;
+
+ next();
+ function next() {
+ if (index === chain.length) {
+ callback(true);
+ return;
+ }
+
+ chain[index](function(response) {
+ if (response === false) {
+ callback(false);
+ return;
+ }
+ index++;
+ next();
+ });
+ }
+ };
+
+ AnimateRunner.all = function(runners, callback) {
+ var count = 0;
+ var status = true;
+ forEach(runners, function(runner) {
+ runner.done(onProgress);
+ });
+
+ function onProgress(response) {
+ status = status && response;
+ if (++count === runners.length) {
+ callback(status);
+ }
+ }
+ };
+
+ function AnimateRunner(host) {
+ this.setHost(host);
+
+ var rafTick = $$animateAsyncRun();
+ var timeoutTick = function(fn) {
+ $timeout(fn, 0, false);
+ };
+
+ this._doneCallbacks = [];
+ this._tick = function(fn) {
+ var doc = $document[0];
+
+ // the document may not be ready or attached
+ // to the module for some internal tests
+ if (doc && doc.hidden) {
+ timeoutTick(fn);
+ } else {
+ rafTick(fn);
+ }
+ };
+ this._state = 0;
+ }
+
+ AnimateRunner.prototype = {
+ setHost: function(host) {
+ this.host = host || {};
+ },
+
+ done: function(fn) {
+ if (this._state === DONE_COMPLETE_STATE) {
+ fn();
+ } else {
+ this._doneCallbacks.push(fn);
+ }
+ },
+
+ progress: noop,
+
+ getPromise: function() {
+ if (!this.promise) {
+ var self = this;
+ this.promise = $q(function(resolve, reject) {
+ self.done(function(status) {
+ status === false ? reject() : resolve();
+ });
+ });
+ }
+ return this.promise;
+ },
+
+ then: function(resolveHandler, rejectHandler) {
+ return this.getPromise().then(resolveHandler, rejectHandler);
+ },
+
+ 'catch': function(handler) {
+ return this.getPromise()['catch'](handler);
+ },
+
+ 'finally': function(handler) {
+ return this.getPromise()['finally'](handler);
+ },
+
+ pause: function() {
+ if (this.host.pause) {
+ this.host.pause();
+ }
+ },
+
+ resume: function() {
+ if (this.host.resume) {
+ this.host.resume();
+ }
+ },
+
+ end: function() {
+ if (this.host.end) {
+ this.host.end();
+ }
+ this._resolve(true);
+ },
+
+ cancel: function() {
+ if (this.host.cancel) {
+ this.host.cancel();
+ }
+ this._resolve(false);
+ },
+
+ complete: function(response) {
+ var self = this;
+ if (self._state === INITIAL_STATE) {
+ self._state = DONE_PENDING_STATE;
+ self._tick(function() {
+ self._resolve(response);
+ });
+ }
+ },
+
+ _resolve: function(response) {
+ if (this._state !== DONE_COMPLETE_STATE) {
+ forEach(this._doneCallbacks, function(fn) {
+ fn(response);
+ });
+ this._doneCallbacks.length = 0;
+ this._state = DONE_COMPLETE_STATE;
+ }
+ }
+ };
+
+ return AnimateRunner;
+ }];
+};
+
+/**
+ * @ngdoc service
+ * @name $animateCss
+ * @kind object
+ *
+ * @description
+ * This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included,
+ * then the `$animateCss` service will actually perform animations.
+ *
+ * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}.
+ */
+var $CoreAnimateCssProvider = function() {
+ this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) {
+
+ return function(element, initialOptions) {
+ // all of the animation functions should create
+ // a copy of the options data, however, if a
+ // parent service has already created a copy then
+ // we should stick to using that
+ var options = initialOptions || {};
+ if (!options.$$prepared) {
+ options = copy(options);
+ }
+
+ // there is no point in applying the styles since
+ // there is no animation that goes on at all in
+ // this version of $animateCss.
+ if (options.cleanupStyles) {
+ options.from = options.to = null;
+ }
+
+ if (options.from) {
+ element.css(options.from);
+ options.from = null;
+ }
+
+ /* jshint newcap: false */
+ var closed, runner = new $$AnimateRunner();
+ return {
+ start: run,
+ end: run
+ };
+
+ function run() {
+ $$rAF(function() {
+ applyAnimationContents();
+ if (!closed) {
+ runner.complete();
+ }
+ closed = true;
+ });
+ return runner;
+ }
+
+ function applyAnimationContents() {
+ if (options.addClass) {
+ element.addClass(options.addClass);
+ options.addClass = null;
+ }
+ if (options.removeClass) {
+ element.removeClass(options.removeClass);
+ options.removeClass = null;
+ }
+ if (options.to) {
+ element.css(options.to);
+ options.to = null;
+ }
+ }
+ };
+ }];
+};
+
+/* global stripHash: true */
+
+/**
+ * ! This is a private undocumented service !
+ *
+ * @name $browser
+ * @requires $log
+ * @description
+ * This object has two goals:
+ *
+ * - hide all the global state in the browser caused by the window object
+ * - abstract away all the browser specific features and inconsistencies
+ *
+ * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`
+ * service, which can be used for convenient testing of the application without the interaction with
+ * the real browser apis.
+ */
+/**
+ * @param {object} window The global window object.
+ * @param {object} document jQuery wrapped document.
+ * @param {object} $log window.console or an object with the same interface.
+ * @param {object} $sniffer $sniffer service
+ */
+function Browser(window, document, $log, $sniffer) {
+ var self = this,
+ rawDocument = document[0],
+ location = window.location,
+ history = window.history,
+ setTimeout = window.setTimeout,
+ clearTimeout = window.clearTimeout,
+ pendingDeferIds = {};
+
+ self.isMock = false;
+
+ var outstandingRequestCount = 0;
+ var outstandingRequestCallbacks = [];
+
+ // TODO(vojta): remove this temporary api
+ self.$$completeOutstandingRequest = completeOutstandingRequest;
+ self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };
+
+ /**
+ * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`
+ * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.
+ */
+ function completeOutstandingRequest(fn) {
+ try {
+ fn.apply(null, sliceArgs(arguments, 1));
+ } finally {
+ outstandingRequestCount--;
+ if (outstandingRequestCount === 0) {
+ while (outstandingRequestCallbacks.length) {
+ try {
+ outstandingRequestCallbacks.pop()();
+ } catch (e) {
+ $log.error(e);
+ }
+ }
+ }
+ }
+ }
+
+ function getHash(url) {
+ var index = url.indexOf('#');
+ return index === -1 ? '' : url.substr(index);
+ }
+
+ /**
+ * @private
+ * Note: this method is used only by scenario runner
+ * TODO(vojta): prefix this method with $$ ?
+ * @param {function()} callback Function that will be called when no outstanding request
+ */
+ self.notifyWhenNoOutstandingRequests = function(callback) {
+ if (outstandingRequestCount === 0) {
+ callback();
+ } else {
+ outstandingRequestCallbacks.push(callback);
+ }
+ };
+
+ //////////////////////////////////////////////////////////////
+ // URL API
+ //////////////////////////////////////////////////////////////
+
+ var cachedState, lastHistoryState,
+ lastBrowserUrl = location.href,
+ baseElement = document.find('base'),
+ pendingLocation = null;
+
+ cacheState();
+ lastHistoryState = cachedState;
+
+ /**
+ * @name $browser#url
+ *
+ * @description
+ * GETTER:
+ * Without any argument, this method just returns current value of location.href.
+ *
+ * SETTER:
+ * With at least one argument, this method sets url to new value.
+ * If html5 history api supported, pushState/replaceState is used, otherwise
+ * location.href/location.replace is used.
+ * Returns its own instance to allow chaining
+ *
+ * NOTE: this api is intended for use only by the $location service. Please use the
+ * {@link ng.$location $location service} to change url.
+ *
+ * @param {string} url New url (when used as setter)
+ * @param {boolean=} replace Should new url replace current history record?
+ * @param {object=} state object to use with pushState/replaceState
+ */
+ self.url = function(url, replace, state) {
+ // In modern browsers `history.state` is `null` by default; treating it separately
+ // from `undefined` would cause `$browser.url('/foo')` to change `history.state`
+ // to undefined via `pushState`. Instead, let's change `undefined` to `null` here.
+ if (isUndefined(state)) {
+ state = null;
+ }
+
+ // Android Browser BFCache causes location, history reference to become stale.
+ if (location !== window.location) location = window.location;
+ if (history !== window.history) history = window.history;
+
+ // setter
+ if (url) {
+ var sameState = lastHistoryState === state;
+
+ // Don't change anything if previous and current URLs and states match. This also prevents
+ // IE<10 from getting into redirect loop when in LocationHashbangInHtml5Url mode.
+ // See https://github.com/angular/angular.js/commit/ffb2701
+ if (lastBrowserUrl === url && (!$sniffer.history || sameState)) {
+ return self;
+ }
+ var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url);
+ lastBrowserUrl = url;
+ lastHistoryState = state;
+ // Don't use history API if only the hash changed
+ // due to a bug in IE10/IE11 which leads
+ // to not firing a `hashchange` nor `popstate` event
+ // in some cases (see #9143).
+ if ($sniffer.history && (!sameBase || !sameState)) {
+ history[replace ? 'replaceState' : 'pushState'](state, '', url);
+ cacheState();
+ // Do the assignment again so that those two variables are referentially identical.
+ lastHistoryState = cachedState;
+ } else {
+ if (!sameBase || pendingLocation) {
+ pendingLocation = url;
+ }
+ if (replace) {
+ location.replace(url);
+ } else if (!sameBase) {
+ location.href = url;
+ } else {
+ location.hash = getHash(url);
+ }
+ if (location.href !== url) {
+ pendingLocation = url;
+ }
+ }
+ return self;
+ // getter
+ } else {
+ // - pendingLocation is needed as browsers don't allow to read out
+ // the new location.href if a reload happened or if there is a bug like in iOS 9 (see
+ // https://openradar.appspot.com/22186109).
+ // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172
+ return pendingLocation || location.href.replace(/%27/g,"'");
+ }
+ };
+
+ /**
+ * @name $browser#state
+ *
+ * @description
+ * This method is a getter.
+ *
+ * Return history.state or null if history.state is undefined.
+ *
+ * @returns {object} state
+ */
+ self.state = function() {
+ return cachedState;
+ };
+
+ var urlChangeListeners = [],
+ urlChangeInit = false;
+
+ function cacheStateAndFireUrlChange() {
+ pendingLocation = null;
+ cacheState();
+ fireUrlChange();
+ }
+
+ function getCurrentState() {
+ try {
+ return history.state;
+ } catch (e) {
+ // MSIE can reportedly throw when there is no state (UNCONFIRMED).
+ }
+ }
+
+ // This variable should be used *only* inside the cacheState function.
+ var lastCachedState = null;
+ function cacheState() {
+ // This should be the only place in $browser where `history.state` is read.
+ cachedState = getCurrentState();
+ cachedState = isUndefined(cachedState) ? null : cachedState;
+
+ // Prevent callbacks fo fire twice if both hashchange & popstate were fired.
+ if (equals(cachedState, lastCachedState)) {
+ cachedState = lastCachedState;
+ }
+ lastCachedState = cachedState;
+ }
+
+ function fireUrlChange() {
+ if (lastBrowserUrl === self.url() && lastHistoryState === cachedState) {
+ return;
+ }
+
+ lastBrowserUrl = self.url();
+ lastHistoryState = cachedState;
+ forEach(urlChangeListeners, function(listener) {
+ listener(self.url(), cachedState);
+ });
+ }
+
+ /**
+ * @name $browser#onUrlChange
+ *
+ * @description
+ * Register callback function that will be called, when url changes.
+ *
+ * It's only called when the url is changed from outside of angular:
+ * - user types different url into address bar
+ * - user clicks on history (forward/back) button
+ * - user clicks on a link
+ *
+ * It's not called when url is changed by $browser.url() method
+ *
+ * The listener gets called with new url as parameter.
+ *
+ * NOTE: this api is intended for use only by the $location service. Please use the
+ * {@link ng.$location $location service} to monitor url changes in angular apps.
+ *
+ * @param {function(string)} listener Listener function to be called when url changes.
+ * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.
+ */
+ self.onUrlChange = function(callback) {
+ // TODO(vojta): refactor to use node's syntax for events
+ if (!urlChangeInit) {
+ // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)
+ // don't fire popstate when user change the address bar and don't fire hashchange when url
+ // changed by push/replaceState
+
+ // html5 history api - popstate event
+ if ($sniffer.history) jqLite(window).on('popstate', cacheStateAndFireUrlChange);
+ // hashchange event
+ jqLite(window).on('hashchange', cacheStateAndFireUrlChange);
+
+ urlChangeInit = true;
+ }
+
+ urlChangeListeners.push(callback);
+ return callback;
+ };
+
+ /**
+ * @private
+ * Remove popstate and hashchange handler from window.
+ *
+ * NOTE: this api is intended for use only by $rootScope.
+ */
+ self.$$applicationDestroyed = function() {
+ jqLite(window).off('hashchange popstate', cacheStateAndFireUrlChange);
+ };
+
+ /**
+ * Checks whether the url has changed outside of Angular.
+ * Needs to be exported to be able to check for changes that have been done in sync,
+ * as hashchange/popstate events fire in async.
+ */
+ self.$$checkUrlChange = fireUrlChange;
+
+ //////////////////////////////////////////////////////////////
+ // Misc API
+ //////////////////////////////////////////////////////////////
+
+ /**
+ * @name $browser#baseHref
+ *
+ * @description
+ * Returns current <base href>
+ * (always relative - without domain)
+ *
+ * @returns {string} The current base href
+ */
+ self.baseHref = function() {
+ var href = baseElement.attr('href');
+ return href ? href.replace(/^(https?\:)?\/\/[^\/]*/, '') : '';
+ };
+
+ /**
+ * @name $browser#defer
+ * @param {function()} fn A function, who's execution should be deferred.
+ * @param {number=} [delay=0] of milliseconds to defer the function execution.
+ * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.
+ *
+ * @description
+ * Executes a fn asynchronously via `setTimeout(fn, delay)`.
+ *
+ * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using
+ * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed
+ * via `$browser.defer.flush()`.
+ *
+ */
+ self.defer = function(fn, delay) {
+ var timeoutId;
+ outstandingRequestCount++;
+ timeoutId = setTimeout(function() {
+ delete pendingDeferIds[timeoutId];
+ completeOutstandingRequest(fn);
+ }, delay || 0);
+ pendingDeferIds[timeoutId] = true;
+ return timeoutId;
+ };
+
+
+ /**
+ * @name $browser#defer.cancel
+ *
+ * @description
+ * Cancels a deferred task identified with `deferId`.
+ *
+ * @param {*} deferId Token returned by the `$browser.defer` function.
+ * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
+ * canceled.
+ */
+ self.defer.cancel = function(deferId) {
+ if (pendingDeferIds[deferId]) {
+ delete pendingDeferIds[deferId];
+ clearTimeout(deferId);
+ completeOutstandingRequest(noop);
+ return true;
+ }
+ return false;
+ };
+
+}
+
+function $BrowserProvider() {
+ this.$get = ['$window', '$log', '$sniffer', '$document',
+ function($window, $log, $sniffer, $document) {
+ return new Browser($window, $document, $log, $sniffer);
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $cacheFactory
+ *
+ * @description
+ * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to
+ * them.
+ *
+ * ```js
+ *
+ * var cache = $cacheFactory('cacheId');
+ * expect($cacheFactory.get('cacheId')).toBe(cache);
+ * expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
+ *
+ * cache.put("key", "value");
+ * cache.put("another key", "another value");
+ *
+ * // We've specified no options on creation
+ * expect(cache.info()).toEqual({id: 'cacheId', size: 2});
+ *
+ * ```
+ *
+ *
+ * @param {string} cacheId Name or id of the newly created cache.
+ * @param {object=} options Options object that specifies the cache behavior. Properties:
+ *
+ * - `{number=}` `capacity` — turns the cache into LRU cache.
+ *
+ * @returns {object} Newly created cache object with the following set of methods:
+ *
+ * - `{object}` `info()` — Returns id, size, and options of cache.
+ * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns
+ * it.
+ * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.
+ * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.
+ * - `{void}` `removeAll()` — Removes all cached values.
+ * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.
+ *
+ * @example
+ <example module="cacheExampleApp">
+ <file name="index.html">
+ <div ng-controller="CacheController">
+ <input ng-model="newCacheKey" placeholder="Key">
+ <input ng-model="newCacheValue" placeholder="Value">
+ <button ng-click="put(newCacheKey, newCacheValue)">Cache</button>
+
+ <p ng-if="keys.length">Cached Values</p>
+ <div ng-repeat="key in keys">
+ <span ng-bind="key"></span>
+ <span>: </span>
+ <b ng-bind="cache.get(key)"></b>
+ </div>
+
+ <p>Cache Info</p>
+ <div ng-repeat="(key, value) in cache.info()">
+ <span ng-bind="key"></span>
+ <span>: </span>
+ <b ng-bind="value"></b>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('cacheExampleApp', []).
+ controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {
+ $scope.keys = [];
+ $scope.cache = $cacheFactory('cacheId');
+ $scope.put = function(key, value) {
+ if (angular.isUndefined($scope.cache.get(key))) {
+ $scope.keys.push(key);
+ }
+ $scope.cache.put(key, angular.isUndefined(value) ? null : value);
+ };
+ }]);
+ </file>
+ <file name="style.css">
+ p {
+ margin: 10px 0 3px;
+ }
+ </file>
+ </example>
+ */
+function $CacheFactoryProvider() {
+
+ this.$get = function() {
+ var caches = {};
+
+ function cacheFactory(cacheId, options) {
+ if (cacheId in caches) {
+ throw minErr('$cacheFactory')('iid', "CacheId '{0}' is already taken!", cacheId);
+ }
+
+ var size = 0,
+ stats = extend({}, options, {id: cacheId}),
+ data = createMap(),
+ capacity = (options && options.capacity) || Number.MAX_VALUE,
+ lruHash = createMap(),
+ freshEnd = null,
+ staleEnd = null;
+
+ /**
+ * @ngdoc type
+ * @name $cacheFactory.Cache
+ *
+ * @description
+ * A cache object used to store and retrieve data, primarily used by
+ * {@link $http $http} and the {@link ng.directive:script script} directive to cache
+ * templates and other data.
+ *
+ * ```js
+ * angular.module('superCache')
+ * .factory('superCache', ['$cacheFactory', function($cacheFactory) {
+ * return $cacheFactory('super-cache');
+ * }]);
+ * ```
+ *
+ * Example test:
+ *
+ * ```js
+ * it('should behave like a cache', inject(function(superCache) {
+ * superCache.put('key', 'value');
+ * superCache.put('another key', 'another value');
+ *
+ * expect(superCache.info()).toEqual({
+ * id: 'super-cache',
+ * size: 2
+ * });
+ *
+ * superCache.remove('another key');
+ * expect(superCache.get('another key')).toBeUndefined();
+ *
+ * superCache.removeAll();
+ * expect(superCache.info()).toEqual({
+ * id: 'super-cache',
+ * size: 0
+ * });
+ * }));
+ * ```
+ */
+ return caches[cacheId] = {
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#put
+ * @kind function
+ *
+ * @description
+ * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be
+ * retrieved later, and incrementing the size of the cache if the key was not already
+ * present in the cache. If behaving like an LRU cache, it will also remove stale
+ * entries from the set.
+ *
+ * It will not insert undefined values into the cache.
+ *
+ * @param {string} key the key under which the cached data is stored.
+ * @param {*} value the value to store alongside the key. If it is undefined, the key
+ * will not be stored.
+ * @returns {*} the value stored.
+ */
+ put: function(key, value) {
+ if (isUndefined(value)) return;
+ if (capacity < Number.MAX_VALUE) {
+ var lruEntry = lruHash[key] || (lruHash[key] = {key: key});
+
+ refresh(lruEntry);
+ }
+
+ if (!(key in data)) size++;
+ data[key] = value;
+
+ if (size > capacity) {
+ this.remove(staleEnd.key);
+ }
+
+ return value;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#get
+ * @kind function
+ *
+ * @description
+ * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object.
+ *
+ * @param {string} key the key of the data to be retrieved
+ * @returns {*} the value stored.
+ */
+ get: function(key) {
+ if (capacity < Number.MAX_VALUE) {
+ var lruEntry = lruHash[key];
+
+ if (!lruEntry) return;
+
+ refresh(lruEntry);
+ }
+
+ return data[key];
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#remove
+ * @kind function
+ *
+ * @description
+ * Removes an entry from the {@link $cacheFactory.Cache Cache} object.
+ *
+ * @param {string} key the key of the entry to be removed
+ */
+ remove: function(key) {
+ if (capacity < Number.MAX_VALUE) {
+ var lruEntry = lruHash[key];
+
+ if (!lruEntry) return;
+
+ if (lruEntry == freshEnd) freshEnd = lruEntry.p;
+ if (lruEntry == staleEnd) staleEnd = lruEntry.n;
+ link(lruEntry.n,lruEntry.p);
+
+ delete lruHash[key];
+ }
+
+ if (!(key in data)) return;
+
+ delete data[key];
+ size--;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#removeAll
+ * @kind function
+ *
+ * @description
+ * Clears the cache object of any entries.
+ */
+ removeAll: function() {
+ data = createMap();
+ size = 0;
+ lruHash = createMap();
+ freshEnd = staleEnd = null;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#destroy
+ * @kind function
+ *
+ * @description
+ * Destroys the {@link $cacheFactory.Cache Cache} object entirely,
+ * removing it from the {@link $cacheFactory $cacheFactory} set.
+ */
+ destroy: function() {
+ data = null;
+ stats = null;
+ lruHash = null;
+ delete caches[cacheId];
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#info
+ * @kind function
+ *
+ * @description
+ * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}.
+ *
+ * @returns {object} an object with the following properties:
+ * <ul>
+ * <li>**id**: the id of the cache instance</li>
+ * <li>**size**: the number of entries kept in the cache instance</li>
+ * <li>**...**: any additional properties from the options object when creating the
+ * cache.</li>
+ * </ul>
+ */
+ info: function() {
+ return extend({}, stats, {size: size});
+ }
+ };
+
+
+ /**
+ * makes the `entry` the freshEnd of the LRU linked list
+ */
+ function refresh(entry) {
+ if (entry != freshEnd) {
+ if (!staleEnd) {
+ staleEnd = entry;
+ } else if (staleEnd == entry) {
+ staleEnd = entry.n;
+ }
+
+ link(entry.n, entry.p);
+ link(entry, freshEnd);
+ freshEnd = entry;
+ freshEnd.n = null;
+ }
+ }
+
+
+ /**
+ * bidirectionally links two entries of the LRU linked list
+ */
+ function link(nextEntry, prevEntry) {
+ if (nextEntry != prevEntry) {
+ if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify
+ if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify
+ }
+ }
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory#info
+ *
+ * @description
+ * Get information about all the caches that have been created
+ *
+ * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info`
+ */
+ cacheFactory.info = function() {
+ var info = {};
+ forEach(caches, function(cache, cacheId) {
+ info[cacheId] = cache.info();
+ });
+ return info;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory#get
+ *
+ * @description
+ * Get access to a cache object by the `cacheId` used when it was created.
+ *
+ * @param {string} cacheId Name or id of a cache to access.
+ * @returns {object} Cache object identified by the cacheId or undefined if no such cache.
+ */
+ cacheFactory.get = function(cacheId) {
+ return caches[cacheId];
+ };
+
+
+ return cacheFactory;
+ };
+}
+
+/**
+ * @ngdoc service
+ * @name $templateCache
+ *
+ * @description
+ * The first time a template is used, it is loaded in the template cache for quick retrieval. You
+ * can load templates directly into the cache in a `script` tag, or by consuming the
+ * `$templateCache` service directly.
+ *
+ * Adding via the `script` tag:
+ *
+ * ```html
+ * <script type="text/ng-template" id="templateId.html">
+ * <p>This is the content of the template</p>
+ * </script>
+ * ```
+ *
+ * **Note:** the `script` tag containing the template does not need to be included in the `head` of
+ * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (IE,
+ * element with ng-app attribute), otherwise the template will be ignored.
+ *
+ * Adding via the `$templateCache` service:
+ *
+ * ```js
+ * var myApp = angular.module('myApp', []);
+ * myApp.run(function($templateCache) {
+ * $templateCache.put('templateId.html', 'This is the content of the template');
+ * });
+ * ```
+ *
+ * To retrieve the template later, simply use it in your HTML:
+ * ```html
+ * <div ng-include=" 'templateId.html' "></div>
+ * ```
+ *
+ * or get it via Javascript:
+ * ```js
+ * $templateCache.get('templateId.html')
+ * ```
+ *
+ * See {@link ng.$cacheFactory $cacheFactory}.
+ *
+ */
+function $TemplateCacheProvider() {
+ this.$get = ['$cacheFactory', function($cacheFactory) {
+ return $cacheFactory('templates');
+ }];
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!
+ *
+ * DOM-related variables:
+ *
+ * - "node" - DOM Node
+ * - "element" - DOM Element or Node
+ * - "$node" or "$element" - jqLite-wrapped node or element
+ *
+ *
+ * Compiler related stuff:
+ *
+ * - "linkFn" - linking fn of a single directive
+ * - "nodeLinkFn" - function that aggregates all linking fns for a particular node
+ * - "childLinkFn" - function that aggregates all linking fns for child nodes of a particular node
+ * - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList)
+ */
+
+
+/**
+ * @ngdoc service
+ * @name $compile
+ * @kind function
+ *
+ * @description
+ * Compiles an HTML string or DOM into a template and produces a template function, which
+ * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together.
+ *
+ * The compilation is a process of walking the DOM tree and matching DOM elements to
+ * {@link ng.$compileProvider#directive directives}.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** This document is an in-depth reference of all directive options.
+ * For a gentle introduction to directives with examples of common use cases,
+ * see the {@link guide/directive directive guide}.
+ * </div>
+ *
+ * ## Comprehensive Directive API
+ *
+ * There are many different options for a directive.
+ *
+ * The difference resides in the return value of the factory function.
+ * You can either return a "Directive Definition Object" (see below) that defines the directive properties,
+ * or just the `postLink` function (all other properties will have the default values).
+ *
+ * <div class="alert alert-success">
+ * **Best Practice:** It's recommended to use the "directive definition object" form.
+ * </div>
+ *
+ * Here's an example directive declared with a Directive Definition Object:
+ *
+ * ```js
+ * var myModule = angular.module(...);
+ *
+ * myModule.directive('directiveName', function factory(injectables) {
+ * var directiveDefinitionObject = {
+ * priority: 0,
+ * template: '<div></div>', // or // function(tElement, tAttrs) { ... },
+ * // or
+ * // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... },
+ * transclude: false,
+ * restrict: 'A',
+ * templateNamespace: 'html',
+ * scope: false,
+ * controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },
+ * controllerAs: 'stringIdentifier',
+ * bindToController: false,
+ * require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],
+ * compile: function compile(tElement, tAttrs, transclude) {
+ * return {
+ * pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ * post: function postLink(scope, iElement, iAttrs, controller) { ... }
+ * }
+ * // or
+ * // return function postLink( ... ) { ... }
+ * },
+ * // or
+ * // link: {
+ * // pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ * // post: function postLink(scope, iElement, iAttrs, controller) { ... }
+ * // }
+ * // or
+ * // link: function postLink( ... ) { ... }
+ * };
+ * return directiveDefinitionObject;
+ * });
+ * ```
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Any unspecified options will use the default value. You can see the default values below.
+ * </div>
+ *
+ * Therefore the above can be simplified as:
+ *
+ * ```js
+ * var myModule = angular.module(...);
+ *
+ * myModule.directive('directiveName', function factory(injectables) {
+ * var directiveDefinitionObject = {
+ * link: function postLink(scope, iElement, iAttrs) { ... }
+ * };
+ * return directiveDefinitionObject;
+ * // or
+ * // return function postLink(scope, iElement, iAttrs) { ... }
+ * });
+ * ```
+ *
+ *
+ *
+ * ### Directive Definition Object
+ *
+ * The directive definition object provides instructions to the {@link ng.$compile
+ * compiler}. The attributes are:
+ *
+ * #### `multiElement`
+ * When this property is set to true, the HTML compiler will collect DOM nodes between
+ * nodes with the attributes `directive-name-start` and `directive-name-end`, and group them
+ * together as the directive elements. It is recommended that this feature be used on directives
+ * which are not strictly behavioral (such as {@link ngClick}), and which
+ * do not manipulate or replace child nodes (such as {@link ngInclude}).
+ *
+ * #### `priority`
+ * When there are multiple directives defined on a single DOM element, sometimes it
+ * is necessary to specify the order in which the directives are applied. The `priority` is used
+ * to sort the directives before their `compile` functions get called. Priority is defined as a
+ * number. Directives with greater numerical `priority` are compiled first. Pre-link functions
+ * are also run in priority order, but post-link functions are run in reverse order. The order
+ * of directives with the same priority is undefined. The default priority is `0`.
+ *
+ * #### `terminal`
+ * If set to true then the current `priority` will be the last set of directives
+ * which will execute (any directives at the current priority will still execute
+ * as the order of execution on same `priority` is undefined). Note that expressions
+ * and other directives used in the directive's template will also be excluded from execution.
+ *
+ * #### `scope`
+ * The scope property can be `true`, an object or a falsy value:
+ *
+ * * **falsy:** No scope will be created for the directive. The directive will use its parent's scope.
+ *
+ * * **`true`:** A new child scope that prototypically inherits from its parent will be created for
+ * the directive's element. If multiple directives on the same element request a new scope,
+ * only one new scope is created. The new scope rule does not apply for the root of the template
+ * since the root of the template always gets a new scope.
+ *
+ * * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's element. The
+ * 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent
+ * scope. This is useful when creating reusable components, which should not accidentally read or modify
+ * data in the parent scope.
+ *
+ * The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the
+ * directive's element. These local properties are useful for aliasing values for templates. The keys in
+ * the object hash map to the name of the property on the isolate scope; the values define how the property
+ * is bound to the parent scope, via matching attributes on the directive's element:
+ *
+ * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is
+ * always a string since DOM attributes are strings. If no `attr` name is specified then the
+ * attribute name is assumed to be the same as the local name. Given `<my-component
+ * my-attr="hello {{name}}">` and the isolate scope definition `scope: { localName:'@myAttr' }`,
+ * the directive's scope property `localName` will reflect the interpolated value of `hello
+ * {{name}}`. As the `name` attribute changes so will the `localName` property on the directive's
+ * scope. The `name` is read from the parent scope (not the directive's scope).
+ *
+ * * `=` or `=attr` - set up a bidirectional binding between a local scope property and an expression
+ * passed via the attribute `attr`. The expression is evaluated in the context of the parent scope.
+ * If no `attr` name is specified then the attribute name is assumed to be the same as the local
+ * name. Given `<my-component my-attr="parentModel">` and the isolate scope definition `scope: {
+ * localModel: '=myAttr' }`, the property `localModel` on the directive's scope will reflect the
+ * value of `parentModel` on the parent scope. Changes to `parentModel` will be reflected in
+ * `localModel` and vice versa. Optional attributes should be marked as such with a question mark:
+ * `=?` or `=?attr`. If the binding expression is non-assignable, or if the attribute isn't
+ * optional and doesn't exist, an exception ({@link error/$compile/nonassign `$compile:nonassign`})
+ * will be thrown upon discovering changes to the local value, since it will be impossible to sync
+ * them back to the parent scope. By default, the {@link ng.$rootScope.Scope#$watch `$watch`}
+ * method is used for tracking changes, and the equality check is based on object identity.
+ * However, if an object literal or an array literal is passed as the binding expression, the
+ * equality check is done by value (using the {@link angular.equals} function). It's also possible
+ * to watch the evaluated value shallowly with {@link ng.$rootScope.Scope#$watchCollection
+ * `$watchCollection`}: use `=*` or `=*attr` (`=*?` or `=*?attr` if the attribute is optional).
+ *
+ * * `<` or `<attr` - set up a one-way (one-directional) binding between a local scope property and an
+ * expression passed via the attribute `attr`. The expression is evaluated in the context of the
+ * parent scope. If no `attr` name is specified then the attribute name is assumed to be the same as the
+ * local name. You can also make the binding optional by adding `?`: `<?` or `<?attr`.
+ *
+ * For example, given `<my-component my-attr="parentModel">` and directive definition of
+ * `scope: { localModel:'<myAttr' }`, then the isolated scope property `localModel` will reflect the
+ * value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected
+ * in `localModel`, but changes in `localModel` will not reflect in `parentModel`. There are however
+ * two caveats:
+ * 1. one-way binding does not copy the value from the parent to the isolate scope, it simply
+ * sets the same value. That means if your bound value is an object, changes to its properties
+ * in the isolated scope will be reflected in the parent scope (because both reference the same object).
+ * 2. one-way binding watches changes to the **identity** of the parent value. That means the
+ * {@link ng.$rootScope.Scope#$watch `$watch`} on the parent value only fires if the reference
+ * to the value has changed. In most cases, this should not be of concern, but can be important
+ * to know if you one-way bind to an object, and then replace that object in the isolated scope.
+ * If you now change a property of the object in your parent scope, the change will not be
+ * propagated to the isolated scope, because the identity of the object on the parent scope
+ * has not changed. Instead you must assign a new object.
+ *
+ * One-way binding is useful if you do not plan to propagate changes to your isolated scope bindings
+ * back to the parent. However, it does not make this completely impossible.
+ *
+ * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope. If
+ * no `attr` name is specified then the attribute name is assumed to be the same as the local name.
+ * Given `<my-component my-attr="count = count + value">` and the isolate scope definition `scope: {
+ * localFn:'&myAttr' }`, the isolate scope property `localFn` will point to a function wrapper for
+ * the `count = count + value` expression. Often it's desirable to pass data from the isolated scope
+ * via an expression to the parent scope. This can be done by passing a map of local variable names
+ * and values into the expression wrapper fn. For example, if the expression is `increment(amount)`
+ * then we can specify the amount value by calling the `localFn` as `localFn({amount: 22})`.
+ *
+ * In general it's possible to apply more than one directive to one element, but there might be limitations
+ * depending on the type of scope required by the directives. The following points will help explain these limitations.
+ * For simplicity only two directives are taken into account, but it is also applicable for several directives:
+ *
+ * * **no scope** + **no scope** => Two directives which don't require their own scope will use their parent's scope
+ * * **child scope** + **no scope** => Both directives will share one single child scope
+ * * **child scope** + **child scope** => Both directives will share one single child scope
+ * * **isolated scope** + **no scope** => The isolated directive will use it's own created isolated scope. The other directive will use
+ * its parent's scope
+ * * **isolated scope** + **child scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives cannot
+ * be applied to the same element.
+ * * **isolated scope** + **isolated scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives
+ * cannot be applied to the same element.
+ *
+ *
+ * #### `bindToController`
+ * This property is used to bind scope properties directly to the controller. It can be either
+ * `true` or an object hash with the same format as the `scope` property. Additionally, a controller
+ * alias must be set, either by using `controllerAs: 'myAlias'` or by specifying the alias in the controller
+ * definition: `controller: 'myCtrl as myAlias'`.
+ *
+ * When an isolate scope is used for a directive (see above), `bindToController: true` will
+ * allow a component to have its properties bound to the controller, rather than to scope.
+ *
+ * After the controller is instantiated, the initial values of the isolate scope bindings will be bound to the controller
+ * properties. You can access these bindings once they have been initialized by providing a controller method called
+ * `$onInit`, which is called after all the controllers on an element have been constructed and had their bindings
+ * initialized.
+ *
+ * <div class="alert alert-warning">
+ * **Deprecation warning:** although bindings for non-ES6 class controllers are currently
+ * bound to `this` before the controller constructor is called, this use is now deprecated. Please place initialization
+ * code that relies upon bindings inside a `$onInit` method on the controller, instead.
+ * </div>
+ *
+ * It is also possible to set `bindToController` to an object hash with the same format as the `scope` property.
+ * This will set up the scope bindings to the controller directly. Note that `scope` can still be used
+ * to define which kind of scope is created. By default, no scope is created. Use `scope: {}` to create an isolate
+ * scope (useful for component directives).
+ *
+ * If both `bindToController` and `scope` are defined and have object hashes, `bindToController` overrides `scope`.
+ *
+ *
+ * #### `controller`
+ * Controller constructor function. The controller is instantiated before the
+ * pre-linking phase and can be accessed by other directives (see
+ * `require` attribute). This allows the directives to communicate with each other and augment
+ * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals:
+ *
+ * * `$scope` - Current scope associated with the element
+ * * `$element` - Current element
+ * * `$attrs` - Current attributes object for the element
+ * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope:
+ * `function([scope], cloneLinkingFn, futureParentElement, slotName)`:
+ * * `scope`: (optional) override the scope.
+ * * `cloneLinkingFn`: (optional) argument to create clones of the original transcluded content.
+ * * `futureParentElement` (optional):
+ * * defines the parent to which the `cloneLinkingFn` will add the cloned elements.
+ * * default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`.
+ * * only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements)
+ * and when the `cloneLinkinFn` is passed,
+ * as those elements need to created and cloned in a special way when they are defined outside their
+ * usual containers (e.g. like `<svg>`).
+ * * See also the `directive.templateNamespace` property.
+ * * `slotName`: (optional) the name of the slot to transclude. If falsy (e.g. `null`, `undefined` or `''`)
+ * then the default translusion is provided.
+ * The `$transclude` function also has a method on it, `$transclude.isSlotFilled(slotName)`, which returns
+ * `true` if the specified slot contains content (i.e. one or more DOM nodes).
+ *
+ * The controller can provide the following methods that act as life-cycle hooks:
+ * * `$onInit` - Called on each controller after all the controllers on an element have been constructed and
+ * had their bindings initialized (and before the pre &amp; post linking functions for the directives on
+ * this element). This is a good place to put initialization code for your controller.
+ *
+ * #### `require`
+ * Require another directive and inject its controller as the fourth argument to the linking function. The
+ * `require` property can be a string, an array or an object:
+ * * a **string** containing the name of the directive to pass to the linking function
+ * * an **array** containing the names of directives to pass to the linking function. The argument passed to the
+ * linking function will be an array of controllers in the same order as the names in the `require` property
+ * * an **object** whose property values are the names of the directives to pass to the linking function. The argument
+ * passed to the linking function will also be an object with matching keys, whose values will hold the corresponding
+ * controllers.
+ *
+ * If the `require` property is an object and `bindToController` is truthy, then the required controllers are
+ * bound to the controller using the keys of the `require` property. This binding occurs after all the controllers
+ * have been constructed but before `$onInit` is called.
+ * See the {@link $compileProvider#component} helper for an example of how this can be used.
+ *
+ * If no such required directive(s) can be found, or if the directive does not have a controller, then an error is
+ * raised (unless no link function is specified and the required controllers are not being bound to the directive
+ * controller, in which case error checking is skipped). The name can be prefixed with:
+ *
+ * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.
+ * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.
+ * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found.
+ * * `^^` - Locate the required controller by searching the element's parents. Throw an error if not found.
+ * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass
+ * `null` to the `link` fn if not found.
+ * * `?^^` - Attempt to locate the required controller by searching the element's parents, or pass
+ * `null` to the `link` fn if not found.
+ *
+ *
+ * #### `controllerAs`
+ * Identifier name for a reference to the controller in the directive's scope.
+ * This allows the controller to be referenced from the directive template. This is especially
+ * useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible
+ * to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the
+ * `controllerAs` reference might overwrite a property that already exists on the parent scope.
+ *
+ *
+ * #### `restrict`
+ * String of subset of `EACM` which restricts the directive to a specific directive
+ * declaration style. If omitted, the defaults (elements and attributes) are used.
+ *
+ * * `E` - Element name (default): `<my-directive></my-directive>`
+ * * `A` - Attribute (default): `<div my-directive="exp"></div>`
+ * * `C` - Class: `<div class="my-directive: exp;"></div>`
+ * * `M` - Comment: `<!-- directive: my-directive exp -->`
+ *
+ *
+ * #### `templateNamespace`
+ * String representing the document type used by the markup in the template.
+ * AngularJS needs this information as those elements need to be created and cloned
+ * in a special way when they are defined outside their usual containers like `<svg>` and `<math>`.
+ *
+ * * `html` - All root nodes in the template are HTML. Root nodes may also be
+ * top-level elements such as `<svg>` or `<math>`.
+ * * `svg` - The root nodes in the template are SVG elements (excluding `<math>`).
+ * * `math` - The root nodes in the template are MathML elements (excluding `<svg>`).
+ *
+ * If no `templateNamespace` is specified, then the namespace is considered to be `html`.
+ *
+ * #### `template`
+ * HTML markup that may:
+ * * Replace the contents of the directive's element (default).
+ * * Replace the directive's element itself (if `replace` is true - DEPRECATED).
+ * * Wrap the contents of the directive's element (if `transclude` is true).
+ *
+ * Value may be:
+ *
+ * * A string. For example `<div red-on-hover>{{delete_str}}</div>`.
+ * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile`
+ * function api below) and returns a string value.
+ *
+ *
+ * #### `templateUrl`
+ * This is similar to `template` but the template is loaded from the specified URL, asynchronously.
+ *
+ * Because template loading is asynchronous the compiler will suspend compilation of directives on that element
+ * for later when the template has been resolved. In the meantime it will continue to compile and link
+ * sibling and parent elements as though this element had not contained any directives.
+ *
+ * The compiler does not suspend the entire compilation to wait for templates to be loaded because this
+ * would result in the whole app "stalling" until all templates are loaded asynchronously - even in the
+ * case when only one deeply nested directive has `templateUrl`.
+ *
+ * Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}
+ *
+ * You can specify `templateUrl` as a string representing the URL or as a function which takes two
+ * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns
+ * a string value representing the url. In either case, the template URL is passed through {@link
+ * $sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}.
+ *
+ *
+ * #### `replace` ([*DEPRECATED*!], will be removed in next major release - i.e. v2.0)
+ * specify what the template should replace. Defaults to `false`.
+ *
+ * * `true` - the template will replace the directive's element.
+ * * `false` - the template will replace the contents of the directive's element.
+ *
+ * The replacement process migrates all of the attributes / classes from the old element to the new
+ * one. See the {@link guide/directive#template-expanding-directive
+ * Directives Guide} for an example.
+ *
+ * There are very few scenarios where element replacement is required for the application function,
+ * the main one being reusable custom components that are used within SVG contexts
+ * (because SVG doesn't work with custom elements in the DOM tree).
+ *
+ * #### `transclude`
+ * Extract the contents of the element where the directive appears and make it available to the directive.
+ * The contents are compiled and provided to the directive as a **transclusion function**. See the
+ * {@link $compile#transclusion Transclusion} section below.
+ *
+ *
+ * #### `compile`
+ *
+ * ```js
+ * function compile(tElement, tAttrs, transclude) { ... }
+ * ```
+ *
+ * The compile function deals with transforming the template DOM. Since most directives do not do
+ * template transformation, it is not used often. The compile function takes the following arguments:
+ *
+ * * `tElement` - template element - The element where the directive has been declared. It is
+ * safe to do template transformation on the element and child elements only.
+ *
+ * * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared
+ * between all directive compile functions.
+ *
+ * * `transclude` - [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`
+ *
+ * <div class="alert alert-warning">
+ * **Note:** The template instance and the link instance may be different objects if the template has
+ * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that
+ * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration
+ * should be done in a linking function rather than in a compile function.
+ * </div>
+
+ * <div class="alert alert-warning">
+ * **Note:** The compile function cannot handle directives that recursively use themselves in their
+ * own templates or compile functions. Compiling these directives results in an infinite loop and
+ * stack overflow errors.
+ *
+ * This can be avoided by manually using $compile in the postLink function to imperatively compile
+ * a directive's template instead of relying on automatic template compilation via `template` or
+ * `templateUrl` declaration or manual compilation inside the compile function.
+ * </div>
+ *
+ * <div class="alert alert-danger">
+ * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it
+ * e.g. does not know about the right outer scope. Please use the transclude function that is passed
+ * to the link function instead.
+ * </div>
+
+ * A compile function can have a return value which can be either a function or an object.
+ *
+ * * returning a (post-link) function - is equivalent to registering the linking function via the
+ * `link` property of the config object when the compile function is empty.
+ *
+ * * returning an object with function(s) registered via `pre` and `post` properties - allows you to
+ * control when a linking function should be called during the linking phase. See info about
+ * pre-linking and post-linking functions below.
+ *
+ *
+ * #### `link`
+ * This property is used only if the `compile` property is not defined.
+ *
+ * ```js
+ * function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }
+ * ```
+ *
+ * The link function is responsible for registering DOM listeners as well as updating the DOM. It is
+ * executed after the template has been cloned. This is where most of the directive logic will be
+ * put.
+ *
+ * * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the
+ * directive for registering {@link ng.$rootScope.Scope#$watch watches}.
+ *
+ * * `iElement` - instance element - The element where the directive is to be used. It is safe to
+ * manipulate the children of the element only in `postLink` function since the children have
+ * already been linked.
+ *
+ * * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared
+ * between all directive linking functions.
+ *
+ * * `controller` - the directive's required controller instance(s) - Instances are shared
+ * among all directives, which allows the directives to use the controllers as a communication
+ * channel. The exact value depends on the directive's `require` property:
+ * * no controller(s) required: the directive's own controller, or `undefined` if it doesn't have one
+ * * `string`: the controller instance
+ * * `array`: array of controller instances
+ *
+ * If a required controller cannot be found, and it is optional, the instance is `null`,
+ * otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown.
+ *
+ * Note that you can also require the directive's own controller - it will be made available like
+ * any other controller.
+ *
+ * * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.
+ * This is the same as the `$transclude`
+ * parameter of directive controllers, see there for details.
+ * `function([scope], cloneLinkingFn, futureParentElement)`.
+ *
+ * #### Pre-linking function
+ *
+ * Executed before the child elements are linked. Not safe to do DOM transformation since the
+ * compiler linking function will fail to locate the correct elements for linking.
+ *
+ * #### Post-linking function
+ *
+ * Executed after the child elements are linked.
+ *
+ * Note that child elements that contain `templateUrl` directives will not have been compiled
+ * and linked since they are waiting for their template to load asynchronously and their own
+ * compilation and linking has been suspended until that occurs.
+ *
+ * It is safe to do DOM transformation in the post-linking function on elements that are not waiting
+ * for their async templates to be resolved.
+ *
+ *
+ * ### Transclusion
+ *
+ * Transclusion is the process of extracting a collection of DOM elements from one part of the DOM and
+ * copying them to another part of the DOM, while maintaining their connection to the original AngularJS
+ * scope from where they were taken.
+ *
+ * Transclusion is used (often with {@link ngTransclude}) to insert the
+ * original contents of a directive's element into a specified place in the template of the directive.
+ * The benefit of transclusion, over simply moving the DOM elements manually, is that the transcluded
+ * content has access to the properties on the scope from which it was taken, even if the directive
+ * has isolated scope.
+ * See the {@link guide/directive#creating-a-directive-that-wraps-other-elements Directives Guide}.
+ *
+ * This makes it possible for the widget to have private state for its template, while the transcluded
+ * content has access to its originating scope.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** When testing an element transclude directive you must not place the directive at the root of the
+ * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives
+ * Testing Transclusion Directives}.
+ * </div>
+ *
+ * There are three kinds of transclusion depending upon whether you want to transclude just the contents of the
+ * directive's element, the entire element or multiple parts of the element contents:
+ *
+ * * `true` - transclude the content (i.e. the child nodes) of the directive's element.
+ * * `'element'` - transclude the whole of the directive's element including any directives on this
+ * element that defined at a lower priority than this directive. When used, the `template`
+ * property is ignored.
+ * * **`{...}` (an object hash):** - map elements of the content onto transclusion "slots" in the template.
+ *
+ * **Mult-slot transclusion** is declared by providing an object for the `transclude` property.
+ *
+ * This object is a map where the keys are the name of the slot to fill and the value is an element selector
+ * used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`)
+ * and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc).
+ *
+ * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}
+ *
+ * If the element selector is prefixed with a `?` then that slot is optional.
+ *
+ * For example, the transclude object `{ slotA: '?myCustomElement' }` maps `<my-custom-element>` elements to
+ * the `slotA` slot, which can be accessed via the `$transclude` function or via the {@link ngTransclude} directive.
+ *
+ * Slots that are not marked as optional (`?`) will trigger a compile time error if there are no matching elements
+ * in the transclude content. If you wish to know if an optional slot was filled with content, then you can call
+ * `$transclude.isSlotFilled(slotName)` on the transclude function passed to the directive's link function and
+ * injectable into the directive's controller.
+ *
+ *
+ * #### Transclusion Functions
+ *
+ * When a directive requests transclusion, the compiler extracts its contents and provides a **transclusion
+ * function** to the directive's `link` function and `controller`. This transclusion function is a special
+ * **linking function** that will return the compiled contents linked to a new transclusion scope.
+ *
+ * <div class="alert alert-info">
+ * If you are just using {@link ngTransclude} then you don't need to worry about this function, since
+ * ngTransclude will deal with it for us.
+ * </div>
+ *
+ * If you want to manually control the insertion and removal of the transcluded content in your directive
+ * then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery
+ * object that contains the compiled DOM, which is linked to the correct transclusion scope.
+ *
+ * When you call a transclusion function you can pass in a **clone attach function**. This function accepts
+ * two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded
+ * content and the `scope` is the newly created transclusion scope, to which the clone is bound.
+ *
+ * <div class="alert alert-info">
+ * **Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a transclude function
+ * since you then get a fresh clone of the original DOM and also have access to the new transclusion scope.
+ * </div>
+ *
+ * It is normal practice to attach your transcluded content (`clone`) to the DOM inside your **clone
+ * attach function**:
+ *
+ * ```js
+ * var transcludedContent, transclusionScope;
+ *
+ * $transclude(function(clone, scope) {
+ * element.append(clone);
+ * transcludedContent = clone;
+ * transclusionScope = scope;
+ * });
+ * ```
+ *
+ * Later, if you want to remove the transcluded content from your DOM then you should also destroy the
+ * associated transclusion scope:
+ *
+ * ```js
+ * transcludedContent.remove();
+ * transclusionScope.$destroy();
+ * ```
+ *
+ * <div class="alert alert-info">
+ * **Best Practice**: if you intend to add and remove transcluded content manually in your directive
+ * (by calling the transclude function to get the DOM and calling `element.remove()` to remove it),
+ * then you are also responsible for calling `$destroy` on the transclusion scope.
+ * </div>
+ *
+ * The built-in DOM manipulation directives, such as {@link ngIf}, {@link ngSwitch} and {@link ngRepeat}
+ * automatically destroy their transcluded clones as necessary so you do not need to worry about this if
+ * you are simply using {@link ngTransclude} to inject the transclusion into your directive.
+ *
+ *
+ * #### Transclusion Scopes
+ *
+ * When you call a transclude function it returns a DOM fragment that is pre-bound to a **transclusion
+ * scope**. This scope is special, in that it is a child of the directive's scope (and so gets destroyed
+ * when the directive's scope gets destroyed) but it inherits the properties of the scope from which it
+ * was taken.
+ *
+ * For example consider a directive that uses transclusion and isolated scope. The DOM hierarchy might look
+ * like this:
+ *
+ * ```html
+ * <div ng-app>
+ * <div isolate>
+ * <div transclusion>
+ * </div>
+ * </div>
+ * </div>
+ * ```
+ *
+ * The `$parent` scope hierarchy will look like this:
+ *
+ ```
+ - $rootScope
+ - isolate
+ - transclusion
+ ```
+ *
+ * but the scopes will inherit prototypically from different scopes to their `$parent`.
+ *
+ ```
+ - $rootScope
+ - transclusion
+ - isolate
+ ```
+ *
+ *
+ * ### Attributes
+ *
+ * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the
+ * `link()` or `compile()` functions. It has a variety of uses.
+ *
+ * * *Accessing normalized attribute names:* Directives like 'ngBind' can be expressed in many ways:
+ * 'ng:bind', `data-ng-bind`, or 'x-ng-bind'. The attributes object allows for normalized access
+ * to the attributes.
+ *
+ * * *Directive inter-communication:* All directives share the same instance of the attributes
+ * object which allows the directives to use the attributes object as inter directive
+ * communication.
+ *
+ * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object
+ * allowing other directives to read the interpolated value.
+ *
+ * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes
+ * that contain interpolation (e.g. `src="{{bar}}"`). Not only is this very efficient but it's also
+ * the only way to easily get the actual value because during the linking phase the interpolation
+ * hasn't been evaluated yet and so the value is at this time set to `undefined`.
+ *
+ * ```js
+ * function linkingFn(scope, elm, attrs, ctrl) {
+ * // get the attribute value
+ * console.log(attrs.ngModel);
+ *
+ * // change the attribute
+ * attrs.$set('ngModel', 'new value');
+ *
+ * // observe changes to interpolated attribute
+ * attrs.$observe('ngModel', function(value) {
+ * console.log('ngModel has changed value to ' + value);
+ * });
+ * }
+ * ```
+ *
+ * ## Example
+ *
+ * <div class="alert alert-warning">
+ * **Note**: Typically directives are registered with `module.directive`. The example below is
+ * to illustrate how `$compile` works.
+ * </div>
+ *
+ <example module="compileExample">
+ <file name="index.html">
+ <script>
+ angular.module('compileExample', [], function($compileProvider) {
+ // configure new 'compile' directive by passing a directive
+ // factory function. The factory function injects the '$compile'
+ $compileProvider.directive('compile', function($compile) {
+ // directive factory creates a link function
+ return function(scope, element, attrs) {
+ scope.$watch(
+ function(scope) {
+ // watch the 'compile' expression for changes
+ return scope.$eval(attrs.compile);
+ },
+ function(value) {
+ // when the 'compile' expression changes
+ // assign it into the current DOM
+ element.html(value);
+
+ // compile the new DOM and link it to the current
+ // scope.
+ // NOTE: we only compile .childNodes so that
+ // we don't get into infinite loop compiling ourselves
+ $compile(element.contents())(scope);
+ }
+ );
+ };
+ });
+ })
+ .controller('GreeterController', ['$scope', function($scope) {
+ $scope.name = 'Angular';
+ $scope.html = 'Hello {{name}}';
+ }]);
+ </script>
+ <div ng-controller="GreeterController">
+ <input ng-model="name"> <br/>
+ <textarea ng-model="html"></textarea> <br/>
+ <div compile="html"></div>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should auto compile', function() {
+ var textarea = $('textarea');
+ var output = $('div[compile]');
+ // The initial state reads 'Hello Angular'.
+ expect(output.getText()).toBe('Hello Angular');
+ textarea.clear();
+ textarea.sendKeys('{{name}}!');
+ expect(output.getText()).toBe('Angular!');
+ });
+ </file>
+ </example>
+
+ *
+ *
+ * @param {string|DOMElement} element Element or HTML string to compile into a template function.
+ * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives - DEPRECATED.
+ *
+ * <div class="alert alert-danger">
+ * **Note:** Passing a `transclude` function to the $compile function is deprecated, as it
+ * e.g. will not use the right outer scope. Please pass the transclude function as a
+ * `parentBoundTranscludeFn` to the link function instead.
+ * </div>
+ *
+ * @param {number} maxPriority only apply directives lower than given priority (Only effects the
+ * root element(s), not their children)
+ * @returns {function(scope, cloneAttachFn=, options=)} a link function which is used to bind template
+ * (a DOM element/tree) to a scope. Where:
+ *
+ * * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.
+ * * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the
+ * `template` and call the `cloneAttachFn` function allowing the caller to attach the
+ * cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is
+ * called as: <br/> `cloneAttachFn(clonedElement, scope)` where:
+ *
+ * * `clonedElement` - is a clone of the original `element` passed into the compiler.
+ * * `scope` - is the current scope with which the linking function is working with.
+ *
+ * * `options` - An optional object hash with linking options. If `options` is provided, then the following
+ * keys may be used to control linking behavior:
+ *
+ * * `parentBoundTranscludeFn` - the transclude function made available to
+ * directives; if given, it will be passed through to the link functions of
+ * directives found in `element` during compilation.
+ * * `transcludeControllers` - an object hash with keys that map controller names
+ * to a hash with the key `instance`, which maps to the controller instance;
+ * if given, it will make the controllers available to directives on the compileNode:
+ * ```
+ * {
+ * parent: {
+ * instance: parentControllerInstance
+ * }
+ * }
+ * ```
+ * * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add
+ * the cloned elements; only needed for transcludes that are allowed to contain non html
+ * elements (e.g. SVG elements). See also the directive.controller property.
+ *
+ * Calling the linking function returns the element of the template. It is either the original
+ * element passed in, or the clone of the element if the `cloneAttachFn` is provided.
+ *
+ * After linking the view is not updated until after a call to $digest which typically is done by
+ * Angular automatically.
+ *
+ * If you need access to the bound view, there are two ways to do it:
+ *
+ * - If you are not asking the linking function to clone the template, create the DOM element(s)
+ * before you send them to the compiler and keep this reference around.
+ * ```js
+ * var element = $compile('<p>{{total}}</p>')(scope);
+ * ```
+ *
+ * - if on the other hand, you need the element to be cloned, the view reference from the original
+ * example would not point to the clone, but rather to the original template that was cloned. In
+ * this case, you can access the clone via the cloneAttachFn:
+ * ```js
+ * var templateElement = angular.element('<p>{{total}}</p>'),
+ * scope = ....;
+ *
+ * var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {
+ * //attach the clone to DOM document at the right place
+ * });
+ *
+ * //now we have reference to the cloned DOM via `clonedElement`
+ * ```
+ *
+ *
+ * For information on how the compiler works, see the
+ * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.
+ */
+
+var $compileMinErr = minErr('$compile');
+
+/**
+ * @ngdoc provider
+ * @name $compileProvider
+ *
+ * @description
+ */
+$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
+function $CompileProvider($provide, $$sanitizeUriProvider) {
+ var hasDirectives = {},
+ Suffix = 'Directive',
+ COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\w\-]+)\s+(.*)$/,
+ CLASS_DIRECTIVE_REGEXP = /(([\w\-]+)(?:\:([^;]+))?;?)/,
+ ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),
+ REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/;
+
+ // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes
+ // The assumption is that future DOM event attribute names will begin with
+ // 'on' and be composed of only English letters.
+ var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
+
+ function parseIsolateBindings(scope, directiveName, isController) {
+ var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/;
+
+ var bindings = {};
+
+ forEach(scope, function(definition, scopeName) {
+ var match = definition.match(LOCAL_REGEXP);
+
+ if (!match) {
+ throw $compileMinErr('iscp',
+ "Invalid {3} for directive '{0}'." +
+ " Definition: {... {1}: '{2}' ...}",
+ directiveName, scopeName, definition,
+ (isController ? "controller bindings definition" :
+ "isolate scope definition"));
+ }
+
+ bindings[scopeName] = {
+ mode: match[1][0],
+ collection: match[2] === '*',
+ optional: match[3] === '?',
+ attrName: match[4] || scopeName
+ };
+ });
+
+ return bindings;
+ }
+
+ function parseDirectiveBindings(directive, directiveName) {
+ var bindings = {
+ isolateScope: null,
+ bindToController: null
+ };
+ if (isObject(directive.scope)) {
+ if (directive.bindToController === true) {
+ bindings.bindToController = parseIsolateBindings(directive.scope,
+ directiveName, true);
+ bindings.isolateScope = {};
+ } else {
+ bindings.isolateScope = parseIsolateBindings(directive.scope,
+ directiveName, false);
+ }
+ }
+ if (isObject(directive.bindToController)) {
+ bindings.bindToController =
+ parseIsolateBindings(directive.bindToController, directiveName, true);
+ }
+ if (isObject(bindings.bindToController)) {
+ var controller = directive.controller;
+ var controllerAs = directive.controllerAs;
+ if (!controller) {
+ // There is no controller, there may or may not be a controllerAs property
+ throw $compileMinErr('noctrl',
+ "Cannot bind to controller without directive '{0}'s controller.",
+ directiveName);
+ } else if (!identifierForController(controller, controllerAs)) {
+ // There is a controller, but no identifier or controllerAs property
+ throw $compileMinErr('noident',
+ "Cannot bind to controller without identifier for directive '{0}'.",
+ directiveName);
+ }
+ }
+ return bindings;
+ }
+
+ function assertValidDirectiveName(name) {
+ var letter = name.charAt(0);
+ if (!letter || letter !== lowercase(letter)) {
+ throw $compileMinErr('baddir', "Directive name '{0}' is invalid. The first character must be a lowercase letter", name);
+ }
+ if (name !== name.trim()) {
+ throw $compileMinErr('baddir',
+ "Directive name '{0}' is invalid. The name should not contain leading or trailing whitespaces",
+ name);
+ }
+ }
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#directive
+ * @kind function
+ *
+ * @description
+ * Register a new directive with the compiler.
+ *
+ * @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which
+ * will match as <code>ng-bind</code>), or an object map of directives where the keys are the
+ * names and the values are the factories.
+ * @param {Function|Array} directiveFactory An injectable directive factory function. See the
+ * {@link guide/directive directive guide} and the {@link $compile compile API} for more info.
+ * @returns {ng.$compileProvider} Self for chaining.
+ */
+ this.directive = function registerDirective(name, directiveFactory) {
+ assertNotHasOwnProperty(name, 'directive');
+ if (isString(name)) {
+ assertValidDirectiveName(name);
+ assertArg(directiveFactory, 'directiveFactory');
+ if (!hasDirectives.hasOwnProperty(name)) {
+ hasDirectives[name] = [];
+ $provide.factory(name + Suffix, ['$injector', '$exceptionHandler',
+ function($injector, $exceptionHandler) {
+ var directives = [];
+ forEach(hasDirectives[name], function(directiveFactory, index) {
+ try {
+ var directive = $injector.invoke(directiveFactory);
+ if (isFunction(directive)) {
+ directive = { compile: valueFn(directive) };
+ } else if (!directive.compile && directive.link) {
+ directive.compile = valueFn(directive.link);
+ }
+ directive.priority = directive.priority || 0;
+ directive.index = index;
+ directive.name = directive.name || name;
+ directive.require = directive.require || (directive.controller && directive.name);
+ directive.restrict = directive.restrict || 'EA';
+ var bindings = directive.$$bindings =
+ parseDirectiveBindings(directive, directive.name);
+ if (isObject(bindings.isolateScope)) {
+ directive.$$isolateBindings = bindings.isolateScope;
+ }
+ directive.$$moduleName = directiveFactory.$$moduleName;
+ directives.push(directive);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ });
+ return directives;
+ }]);
+ }
+ hasDirectives[name].push(directiveFactory);
+ } else {
+ forEach(name, reverseParams(registerDirective));
+ }
+ return this;
+ };
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#component
+ * @module ng
+ * @param {string} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`)
+ * @param {Object} options Component definition object (a simplified
+ * {@link ng.$compile#directive-definition-object directive definition object}),
+ * with the following properties (all optional):
+ *
+ * - `controller` – `{(string|function()=}` – controller constructor function that should be
+ * associated with newly created scope or the name of a {@link ng.$compile#-controller-
+ * registered controller} if passed as a string. An empty `noop` function by default.
+ * - `controllerAs` – `{string=}` – identifier name for to reference the controller in the component's scope.
+ * If present, the controller will be published to scope under the `controllerAs` name.
+ * If not present, this will default to be `$ctrl`.
+ * - `template` – `{string=|function()=}` – html template as a string or a function that
+ * returns an html template as a string which should be used as the contents of this component.
+ * Empty string by default.
+ *
+ * If `template` is a function, then it is {@link auto.$injector#invoke injected} with
+ * the following locals:
+ *
+ * - `$element` - Current element
+ * - `$attrs` - Current attributes object for the element
+ *
+ * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
+ * template that should be used as the contents of this component.
+ *
+ * If `templateUrl` is a function, then it is {@link auto.$injector#invoke injected} with
+ * the following locals:
+ *
+ * - `$element` - Current element
+ * - `$attrs` - Current attributes object for the element
+ *
+ * - `bindings` – `{object=}` – defines bindings between DOM attributes and component properties.
+ * Component properties are always bound to the component controller and not to the scope.
+ * See {@link ng.$compile#-bindtocontroller- `bindToController`}.
+ * - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled.
+ * Disabled by default.
+ * - `$...` – `{function()=}` – additional annotations to provide to the directive factory function.
+ *
+ * @returns {ng.$compileProvider} the compile provider itself, for chaining of function calls.
+ * @description
+ * Register a **component definition** with the compiler. This is a shorthand for registering a special
+ * type of directive, which represents a self-contained UI component in your application. Such components
+ * are always isolated (i.e. `scope: {}`) and are always restricted to elements (i.e. `restrict: 'E'`).
+ *
+ * Component definitions are very simple and do not require as much configuration as defining general
+ * directives. Component definitions usually consist only of a template and a controller backing it.
+ *
+ * In order to make the definition easier, components enforce best practices like use of `controllerAs`,
+ * `bindToController`. They always have **isolate scope** and are restricted to elements.
+ *
+ * Here are a few examples of how you would usually define components:
+ *
+ * ```js
+ * var myMod = angular.module(...);
+ * myMod.component('myComp', {
+ * template: '<div>My name is {{$ctrl.name}}</div>',
+ * controller: function() {
+ * this.name = 'shahar';
+ * }
+ * });
+ *
+ * myMod.component('myComp', {
+ * template: '<div>My name is {{$ctrl.name}}</div>',
+ * bindings: {name: '@'}
+ * });
+ *
+ * myMod.component('myComp', {
+ * templateUrl: 'views/my-comp.html',
+ * controller: 'MyCtrl as ctrl',
+ * bindings: {name: '@'}
+ * });
+ *
+ * ```
+ * For more examples, and an in-depth guide, see the {@link guide/component component guide}.
+ *
+ * <br />
+ * See also {@link ng.$compileProvider#directive $compileProvider.directive()}.
+ */
+ this.component = function registerComponent(name, options) {
+ var controller = options.controller || function() {};
+
+ function factory($injector) {
+ function makeInjectable(fn) {
+ if (isFunction(fn) || isArray(fn)) {
+ return function(tElement, tAttrs) {
+ return $injector.invoke(fn, this, {$element: tElement, $attrs: tAttrs});
+ };
+ } else {
+ return fn;
+ }
+ }
+
+ var template = (!options.template && !options.templateUrl ? '' : options.template);
+ return {
+ controller: controller,
+ controllerAs: identifierForController(options.controller) || options.controllerAs || '$ctrl',
+ template: makeInjectable(template),
+ templateUrl: makeInjectable(options.templateUrl),
+ transclude: options.transclude,
+ scope: {},
+ bindToController: options.bindings || {},
+ restrict: 'E',
+ require: options.require
+ };
+ }
+
+ // Copy any annotation properties (starting with $) over to the factory function
+ // These could be used by libraries such as the new component router
+ forEach(options, function(val, key) {
+ if (key.charAt(0) === '$') {
+ factory[key] = val;
+ }
+ });
+
+ factory.$inject = ['$injector'];
+
+ return this.directive(name, factory);
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#aHrefSanitizationWhitelist
+ * @kind function
+ *
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during a[href] sanitization.
+ *
+ * The sanitization is a security measure aimed at preventing XSS attacks via html links.
+ *
+ * Any url about to be assigned to a[href] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.aHrefSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp);
+ return this;
+ } else {
+ return $$sanitizeUriProvider.aHrefSanitizationWhitelist();
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#imgSrcSanitizationWhitelist
+ * @kind function
+ *
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during img[src] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to img[src] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.imgSrcSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp);
+ return this;
+ } else {
+ return $$sanitizeUriProvider.imgSrcSanitizationWhitelist();
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#debugInfoEnabled
+ *
+ * @param {boolean=} enabled update the debugInfoEnabled state if provided, otherwise just return the
+ * current debugInfoEnabled state
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ *
+ * @kind function
+ *
+ * @description
+ * Call this method to enable/disable various debug runtime information in the compiler such as adding
+ * binding information and a reference to the current scope on to DOM elements.
+ * If enabled, the compiler will add the following to DOM elements that have been bound to the scope
+ * * `ng-binding` CSS class
+ * * `$binding` data property containing an array of the binding expressions
+ *
+ * You may want to disable this in production for a significant performance boost. See
+ * {@link guide/production#disabling-debug-data Disabling Debug Data} for more.
+ *
+ * The default value is true.
+ */
+ var debugInfoEnabled = true;
+ this.debugInfoEnabled = function(enabled) {
+ if (isDefined(enabled)) {
+ debugInfoEnabled = enabled;
+ return this;
+ }
+ return debugInfoEnabled;
+ };
+
+ this.$get = [
+ '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse',
+ '$controller', '$rootScope', '$sce', '$animate', '$$sanitizeUri',
+ function($injector, $interpolate, $exceptionHandler, $templateRequest, $parse,
+ $controller, $rootScope, $sce, $animate, $$sanitizeUri) {
+
+ var SIMPLE_ATTR_NAME = /^\w/;
+ var specialAttrHolder = document.createElement('div');
+ var Attributes = function(element, attributesToCopy) {
+ if (attributesToCopy) {
+ var keys = Object.keys(attributesToCopy);
+ var i, l, key;
+
+ for (i = 0, l = keys.length; i < l; i++) {
+ key = keys[i];
+ this[key] = attributesToCopy[key];
+ }
+ } else {
+ this.$attr = {};
+ }
+
+ this.$$element = element;
+ };
+
+ Attributes.prototype = {
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$normalize
+ * @kind function
+ *
+ * @description
+ * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or
+ * `data-`) to its normalized, camelCase form.
+ *
+ * Also there is special case for Moz prefix starting with upper case letter.
+ *
+ * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}
+ *
+ * @param {string} name Name to normalize
+ */
+ $normalize: directiveNormalize,
+
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$addClass
+ * @kind function
+ *
+ * @description
+ * Adds the CSS class value specified by the classVal parameter to the element. If animations
+ * are enabled then an animation will be triggered for the class addition.
+ *
+ * @param {string} classVal The className value that will be added to the element
+ */
+ $addClass: function(classVal) {
+ if (classVal && classVal.length > 0) {
+ $animate.addClass(this.$$element, classVal);
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$removeClass
+ * @kind function
+ *
+ * @description
+ * Removes the CSS class value specified by the classVal parameter from the element. If
+ * animations are enabled then an animation will be triggered for the class removal.
+ *
+ * @param {string} classVal The className value that will be removed from the element
+ */
+ $removeClass: function(classVal) {
+ if (classVal && classVal.length > 0) {
+ $animate.removeClass(this.$$element, classVal);
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$updateClass
+ * @kind function
+ *
+ * @description
+ * Adds and removes the appropriate CSS class values to the element based on the difference
+ * between the new and old CSS class values (specified as newClasses and oldClasses).
+ *
+ * @param {string} newClasses The current CSS className value
+ * @param {string} oldClasses The former CSS className value
+ */
+ $updateClass: function(newClasses, oldClasses) {
+ var toAdd = tokenDifference(newClasses, oldClasses);
+ if (toAdd && toAdd.length) {
+ $animate.addClass(this.$$element, toAdd);
+ }
+
+ var toRemove = tokenDifference(oldClasses, newClasses);
+ if (toRemove && toRemove.length) {
+ $animate.removeClass(this.$$element, toRemove);
+ }
+ },
+
+ /**
+ * Set a normalized attribute on the element in a way such that all directives
+ * can share the attribute. This function properly handles boolean attributes.
+ * @param {string} key Normalized key. (ie ngAttribute)
+ * @param {string|boolean} value The value to set. If `null` attribute will be deleted.
+ * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.
+ * Defaults to true.
+ * @param {string=} attrName Optional none normalized name. Defaults to key.
+ */
+ $set: function(key, value, writeAttr, attrName) {
+ // TODO: decide whether or not to throw an error if "class"
+ //is set through this function since it may cause $updateClass to
+ //become unstable.
+
+ var node = this.$$element[0],
+ booleanKey = getBooleanAttrName(node, key),
+ aliasedKey = getAliasedAttrName(key),
+ observer = key,
+ nodeName;
+
+ if (booleanKey) {
+ this.$$element.prop(key, value);
+ attrName = booleanKey;
+ } else if (aliasedKey) {
+ this[aliasedKey] = value;
+ observer = aliasedKey;
+ }
+
+ this[key] = value;
+
+ // translate normalized key to actual key
+ if (attrName) {
+ this.$attr[key] = attrName;
+ } else {
+ attrName = this.$attr[key];
+ if (!attrName) {
+ this.$attr[key] = attrName = snake_case(key, '-');
+ }
+ }
+
+ nodeName = nodeName_(this.$$element);
+
+ if ((nodeName === 'a' && (key === 'href' || key === 'xlinkHref')) ||
+ (nodeName === 'img' && key === 'src')) {
+ // sanitize a[href] and img[src] values
+ this[key] = value = $$sanitizeUri(value, key === 'src');
+ } else if (nodeName === 'img' && key === 'srcset') {
+ // sanitize img[srcset] values
+ var result = "";
+
+ // first check if there are spaces because it's not the same pattern
+ var trimmedSrcset = trim(value);
+ // ( 999x ,| 999w ,| ,|, )
+ var srcPattern = /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/;
+ var pattern = /\s/.test(trimmedSrcset) ? srcPattern : /(,)/;
+
+ // split srcset into tuple of uri and descriptor except for the last item
+ var rawUris = trimmedSrcset.split(pattern);
+
+ // for each tuples
+ var nbrUrisWith2parts = Math.floor(rawUris.length / 2);
+ for (var i = 0; i < nbrUrisWith2parts; i++) {
+ var innerIdx = i * 2;
+ // sanitize the uri
+ result += $$sanitizeUri(trim(rawUris[innerIdx]), true);
+ // add the descriptor
+ result += (" " + trim(rawUris[innerIdx + 1]));
+ }
+
+ // split the last item into uri and descriptor
+ var lastTuple = trim(rawUris[i * 2]).split(/\s/);
+
+ // sanitize the last uri
+ result += $$sanitizeUri(trim(lastTuple[0]), true);
+
+ // and add the last descriptor if any
+ if (lastTuple.length === 2) {
+ result += (" " + trim(lastTuple[1]));
+ }
+ this[key] = value = result;
+ }
+
+ if (writeAttr !== false) {
+ if (value === null || isUndefined(value)) {
+ this.$$element.removeAttr(attrName);
+ } else {
+ if (SIMPLE_ATTR_NAME.test(attrName)) {
+ this.$$element.attr(attrName, value);
+ } else {
+ setSpecialAttr(this.$$element[0], attrName, value);
+ }
+ }
+ }
+
+ // fire observers
+ var $$observers = this.$$observers;
+ $$observers && forEach($$observers[observer], function(fn) {
+ try {
+ fn(value);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ });
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$observe
+ * @kind function
+ *
+ * @description
+ * Observes an interpolated attribute.
+ *
+ * The observer function will be invoked once during the next `$digest` following
+ * compilation. The observer is then invoked whenever the interpolated value
+ * changes.
+ *
+ * @param {string} key Normalized key. (ie ngAttribute) .
+ * @param {function(interpolatedValue)} fn Function that will be called whenever
+ the interpolated value of the attribute changes.
+ * See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation
+ * guide} for more info.
+ * @returns {function()} Returns a deregistration function for this observer.
+ */
+ $observe: function(key, fn) {
+ var attrs = this,
+ $$observers = (attrs.$$observers || (attrs.$$observers = createMap())),
+ listeners = ($$observers[key] || ($$observers[key] = []));
+
+ listeners.push(fn);
+ $rootScope.$evalAsync(function() {
+ if (!listeners.$$inter && attrs.hasOwnProperty(key) && !isUndefined(attrs[key])) {
+ // no one registered attribute interpolation function, so lets call it manually
+ fn(attrs[key]);
+ }
+ });
+
+ return function() {
+ arrayRemove(listeners, fn);
+ };
+ }
+ };
+
+ function setSpecialAttr(element, attrName, value) {
+ // Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute`
+ // so we have to jump through some hoops to get such an attribute
+ // https://github.com/angular/angular.js/pull/13318
+ specialAttrHolder.innerHTML = "<span " + attrName + ">";
+ var attributes = specialAttrHolder.firstChild.attributes;
+ var attribute = attributes[0];
+ // We have to remove the attribute from its container element before we can add it to the destination element
+ attributes.removeNamedItem(attribute.name);
+ attribute.value = value;
+ element.attributes.setNamedItem(attribute);
+ }
+
+ function safeAddClass($element, className) {
+ try {
+ $element.addClass(className);
+ } catch (e) {
+ // ignore, since it means that we are trying to set class on
+ // SVG element, where class name is read-only.
+ }
+ }
+
+
+ var startSymbol = $interpolate.startSymbol(),
+ endSymbol = $interpolate.endSymbol(),
+ denormalizeTemplate = (startSymbol == '{{' && endSymbol == '}}')
+ ? identity
+ : function denormalizeTemplate(template) {
+ return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
+ },
+ NG_ATTR_BINDING = /^ngAttr[A-Z]/;
+ var MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;
+
+ compile.$$addBindingInfo = debugInfoEnabled ? function $$addBindingInfo($element, binding) {
+ var bindings = $element.data('$binding') || [];
+
+ if (isArray(binding)) {
+ bindings = bindings.concat(binding);
+ } else {
+ bindings.push(binding);
+ }
+
+ $element.data('$binding', bindings);
+ } : noop;
+
+ compile.$$addBindingClass = debugInfoEnabled ? function $$addBindingClass($element) {
+ safeAddClass($element, 'ng-binding');
+ } : noop;
+
+ compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo($element, scope, isolated, noTemplate) {
+ var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';
+ $element.data(dataName, scope);
+ } : noop;
+
+ compile.$$addScopeClass = debugInfoEnabled ? function $$addScopeClass($element, isolated) {
+ safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope');
+ } : noop;
+
+ return compile;
+
+ //================================
+
+ function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,
+ previousCompileContext) {
+ if (!($compileNodes instanceof jqLite)) {
+ // jquery always rewraps, whereas we need to preserve the original selector so that we can
+ // modify it.
+ $compileNodes = jqLite($compileNodes);
+ }
+
+ var NOT_EMPTY = /\S+/;
+
+ // We can not compile top level text elements since text nodes can be merged and we will
+ // not be able to attach scope data to them, so we will wrap them in <span>
+ for (var i = 0, len = $compileNodes.length; i < len; i++) {
+ var domNode = $compileNodes[i];
+
+ if (domNode.nodeType === NODE_TYPE_TEXT && domNode.nodeValue.match(NOT_EMPTY) /* non-empty */) {
+ jqLiteWrapNode(domNode, $compileNodes[i] = document.createElement('span'));
+ }
+ }
+
+ var compositeLinkFn =
+ compileNodes($compileNodes, transcludeFn, $compileNodes,
+ maxPriority, ignoreDirective, previousCompileContext);
+ compile.$$addScopeClass($compileNodes);
+ var namespace = null;
+ return function publicLinkFn(scope, cloneConnectFn, options) {
+ assertArg(scope, 'scope');
+
+ if (previousCompileContext && previousCompileContext.needsNewScope) {
+ // A parent directive did a replace and a directive on this element asked
+ // for transclusion, which caused us to lose a layer of element on which
+ // we could hold the new transclusion scope, so we will create it manually
+ // here.
+ scope = scope.$parent.$new();
+ }
+
+ options = options || {};
+ var parentBoundTranscludeFn = options.parentBoundTranscludeFn,
+ transcludeControllers = options.transcludeControllers,
+ futureParentElement = options.futureParentElement;
+
+ // When `parentBoundTranscludeFn` is passed, it is a
+ // `controllersBoundTransclude` function (it was previously passed
+ // as `transclude` to directive.link) so we must unwrap it to get
+ // its `boundTranscludeFn`
+ if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude) {
+ parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude;
+ }
+
+ if (!namespace) {
+ namespace = detectNamespaceForChildElements(futureParentElement);
+ }
+ var $linkNode;
+ if (namespace !== 'html') {
+ // When using a directive with replace:true and templateUrl the $compileNodes
+ // (or a child element inside of them)
+ // might change, so we need to recreate the namespace adapted compileNodes
+ // for call to the link function.
+ // Note: This will already clone the nodes...
+ $linkNode = jqLite(
+ wrapTemplate(namespace, jqLite('<div>').append($compileNodes).html())
+ );
+ } else if (cloneConnectFn) {
+ // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart
+ // and sometimes changes the structure of the DOM.
+ $linkNode = JQLitePrototype.clone.call($compileNodes);
+ } else {
+ $linkNode = $compileNodes;
+ }
+
+ if (transcludeControllers) {
+ for (var controllerName in transcludeControllers) {
+ $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance);
+ }
+ }
+
+ compile.$$addScopeInfo($linkNode, scope);
+
+ if (cloneConnectFn) cloneConnectFn($linkNode, scope);
+ if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn);
+ return $linkNode;
+ };
+ }
+
+ function detectNamespaceForChildElements(parentElement) {
+ // TODO: Make this detect MathML as well...
+ var node = parentElement && parentElement[0];
+ if (!node) {
+ return 'html';
+ } else {
+ return nodeName_(node) !== 'foreignobject' && toString.call(node).match(/SVG/) ? 'svg' : 'html';
+ }
+ }
+
+ /**
+ * Compile function matches each node in nodeList against the directives. Once all directives
+ * for a particular node are collected their compile functions are executed. The compile
+ * functions return values - the linking functions - are combined into a composite linking
+ * function, which is the a linking function for the node.
+ *
+ * @param {NodeList} nodeList an array of nodes or NodeList to compile
+ * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the
+ * scope argument is auto-generated to the new child of the transcluded parent scope.
+ * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then
+ * the rootElement must be set the jqLite collection of the compile root. This is
+ * needed so that the jqLite collection items can be replaced with widgets.
+ * @param {number=} maxPriority Max directive priority.
+ * @returns {Function} A composite linking function of all of the matched directives or null.
+ */
+ function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,
+ previousCompileContext) {
+ var linkFns = [],
+ attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound;
+
+ for (var i = 0; i < nodeList.length; i++) {
+ attrs = new Attributes();
+
+ // we must always refer to nodeList[i] since the nodes can be replaced underneath us.
+ directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,
+ ignoreDirective);
+
+ nodeLinkFn = (directives.length)
+ ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement,
+ null, [], [], previousCompileContext)
+ : null;
+
+ if (nodeLinkFn && nodeLinkFn.scope) {
+ compile.$$addScopeClass(attrs.$$element);
+ }
+
+ childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||
+ !(childNodes = nodeList[i].childNodes) ||
+ !childNodes.length)
+ ? null
+ : compileNodes(childNodes,
+ nodeLinkFn ? (
+ (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement)
+ && nodeLinkFn.transclude) : transcludeFn);
+
+ if (nodeLinkFn || childLinkFn) {
+ linkFns.push(i, nodeLinkFn, childLinkFn);
+ linkFnFound = true;
+ nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn;
+ }
+
+ //use the previous context only for the first element in the virtual group
+ previousCompileContext = null;
+ }
+
+ // return a linking function if we have found anything, null otherwise
+ return linkFnFound ? compositeLinkFn : null;
+
+ function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {
+ var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;
+ var stableNodeList;
+
+
+ if (nodeLinkFnFound) {
+ // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our
+ // offsets don't get screwed up
+ var nodeListLength = nodeList.length;
+ stableNodeList = new Array(nodeListLength);
+
+ // create a sparse array by only copying the elements which have a linkFn
+ for (i = 0; i < linkFns.length; i+=3) {
+ idx = linkFns[i];
+ stableNodeList[idx] = nodeList[idx];
+ }
+ } else {
+ stableNodeList = nodeList;
+ }
+
+ for (i = 0, ii = linkFns.length; i < ii;) {
+ node = stableNodeList[linkFns[i++]];
+ nodeLinkFn = linkFns[i++];
+ childLinkFn = linkFns[i++];
+
+ if (nodeLinkFn) {
+ if (nodeLinkFn.scope) {
+ childScope = scope.$new();
+ compile.$$addScopeInfo(jqLite(node), childScope);
+ } else {
+ childScope = scope;
+ }
+
+ if (nodeLinkFn.transcludeOnThisElement) {
+ childBoundTranscludeFn = createBoundTranscludeFn(
+ scope, nodeLinkFn.transclude, parentBoundTranscludeFn);
+
+ } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {
+ childBoundTranscludeFn = parentBoundTranscludeFn;
+
+ } else if (!parentBoundTranscludeFn && transcludeFn) {
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);
+
+ } else {
+ childBoundTranscludeFn = null;
+ }
+
+ nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn);
+
+ } else if (childLinkFn) {
+ childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);
+ }
+ }
+ }
+ }
+
+ function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {
+
+ var boundTranscludeFn = function(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {
+
+ if (!transcludedScope) {
+ transcludedScope = scope.$new(false, containingScope);
+ transcludedScope.$$transcluded = true;
+ }
+
+ return transcludeFn(transcludedScope, cloneFn, {
+ parentBoundTranscludeFn: previousBoundTranscludeFn,
+ transcludeControllers: controllers,
+ futureParentElement: futureParentElement
+ });
+ };
+
+ // We need to attach the transclusion slots onto the `boundTranscludeFn`
+ // so that they are available inside the `controllersBoundTransclude` function
+ var boundSlots = boundTranscludeFn.$$slots = createMap();
+ for (var slotName in transcludeFn.$$slots) {
+ if (transcludeFn.$$slots[slotName]) {
+ boundSlots[slotName] = createBoundTranscludeFn(scope, transcludeFn.$$slots[slotName], previousBoundTranscludeFn);
+ } else {
+ boundSlots[slotName] = null;
+ }
+ }
+
+ return boundTranscludeFn;
+ }
+
+ /**
+ * Looks for directives on the given node and adds them to the directive collection which is
+ * sorted.
+ *
+ * @param node Node to search.
+ * @param directives An array to which the directives are added to. This array is sorted before
+ * the function returns.
+ * @param attrs The shared attrs object which is used to populate the normalized attributes.
+ * @param {number=} maxPriority Max directive priority.
+ */
+ function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {
+ var nodeType = node.nodeType,
+ attrsMap = attrs.$attr,
+ match,
+ className;
+
+ switch (nodeType) {
+ case NODE_TYPE_ELEMENT: /* Element */
+ // use the node name: <directive>
+ addDirective(directives,
+ directiveNormalize(nodeName_(node)), 'E', maxPriority, ignoreDirective);
+
+ // iterate over the attributes
+ for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes,
+ j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {
+ var attrStartName = false;
+ var attrEndName = false;
+
+ attr = nAttrs[j];
+ name = attr.name;
+ value = trim(attr.value);
+
+ // support ngAttr attribute binding
+ ngAttrName = directiveNormalize(name);
+ if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) {
+ name = name.replace(PREFIX_REGEXP, '')
+ .substr(8).replace(/_(.)/g, function(match, letter) {
+ return letter.toUpperCase();
+ });
+ }
+
+ var multiElementMatch = ngAttrName.match(MULTI_ELEMENT_DIR_RE);
+ if (multiElementMatch && directiveIsMultiElement(multiElementMatch[1])) {
+ attrStartName = name;
+ attrEndName = name.substr(0, name.length - 5) + 'end';
+ name = name.substr(0, name.length - 6);
+ }
+
+ nName = directiveNormalize(name.toLowerCase());
+ attrsMap[nName] = name;
+ if (isNgAttr || !attrs.hasOwnProperty(nName)) {
+ attrs[nName] = value;
+ if (getBooleanAttrName(node, nName)) {
+ attrs[nName] = true; // presence means true
+ }
+ }
+ addAttrInterpolateDirective(node, directives, value, nName, isNgAttr);
+ addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,
+ attrEndName);
+ }
+
+ // use class as directive
+ className = node.className;
+ if (isObject(className)) {
+ // Maybe SVGAnimatedString
+ className = className.animVal;
+ }
+ if (isString(className) && className !== '') {
+ while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {
+ nName = directiveNormalize(match[2]);
+ if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {
+ attrs[nName] = trim(match[3]);
+ }
+ className = className.substr(match.index + match[0].length);
+ }
+ }
+ break;
+ case NODE_TYPE_TEXT: /* Text Node */
+ if (msie === 11) {
+ // Workaround for #11781
+ while (node.parentNode && node.nextSibling && node.nextSibling.nodeType === NODE_TYPE_TEXT) {
+ node.nodeValue = node.nodeValue + node.nextSibling.nodeValue;
+ node.parentNode.removeChild(node.nextSibling);
+ }
+ }
+ addTextInterpolateDirective(directives, node.nodeValue);
+ break;
+ case NODE_TYPE_COMMENT: /* Comment */
+ try {
+ match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
+ if (match) {
+ nName = directiveNormalize(match[1]);
+ if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {
+ attrs[nName] = trim(match[2]);
+ }
+ }
+ } catch (e) {
+ // turns out that under some circumstances IE9 throws errors when one attempts to read
+ // comment's node value.
+ // Just ignore it and continue. (Can't seem to reproduce in test case.)
+ }
+ break;
+ }
+
+ directives.sort(byPriority);
+ return directives;
+ }
+
+ /**
+ * Given a node with an directive-start it collects all of the siblings until it finds
+ * directive-end.
+ * @param node
+ * @param attrStart
+ * @param attrEnd
+ * @returns {*}
+ */
+ function groupScan(node, attrStart, attrEnd) {
+ var nodes = [];
+ var depth = 0;
+ if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {
+ do {
+ if (!node) {
+ throw $compileMinErr('uterdir',
+ "Unterminated attribute, found '{0}' but no matching '{1}' found.",
+ attrStart, attrEnd);
+ }
+ if (node.nodeType == NODE_TYPE_ELEMENT) {
+ if (node.hasAttribute(attrStart)) depth++;
+ if (node.hasAttribute(attrEnd)) depth--;
+ }
+ nodes.push(node);
+ node = node.nextSibling;
+ } while (depth > 0);
+ } else {
+ nodes.push(node);
+ }
+
+ return jqLite(nodes);
+ }
+
+ /**
+ * Wrapper for linking function which converts normal linking function into a grouped
+ * linking function.
+ * @param linkFn
+ * @param attrStart
+ * @param attrEnd
+ * @returns {Function}
+ */
+ function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {
+ return function(scope, element, attrs, controllers, transcludeFn) {
+ element = groupScan(element[0], attrStart, attrEnd);
+ return linkFn(scope, element, attrs, controllers, transcludeFn);
+ };
+ }
+
+ /**
+ * A function generator that is used to support both eager and lazy compilation
+ * linking function.
+ * @param eager
+ * @param $compileNodes
+ * @param transcludeFn
+ * @param maxPriority
+ * @param ignoreDirective
+ * @param previousCompileContext
+ * @returns {Function}
+ */
+ function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) {
+ if (eager) {
+ return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
+ }
+
+ var compiled;
+
+ return function() {
+ if (!compiled) {
+ compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
+
+ // Null out all of these references in order to make them eligible for garbage collection
+ // since this is a potentially long lived closure
+ $compileNodes = transcludeFn = previousCompileContext = null;
+ }
+
+ return compiled.apply(this, arguments);
+ };
+ }
+
+ /**
+ * Once the directives have been collected, their compile functions are executed. This method
+ * is responsible for inlining directive templates as well as terminating the application
+ * of the directives if the terminal directive has been reached.
+ *
+ * @param {Array} directives Array of collected directives to execute their compile function.
+ * this needs to be pre-sorted by priority order.
+ * @param {Node} compileNode The raw DOM node to apply the compile functions to
+ * @param {Object} templateAttrs The shared attribute function
+ * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the
+ * scope argument is auto-generated to the new
+ * child of the transcluded parent scope.
+ * @param {JQLite} jqCollection If we are working on the root of the compile tree then this
+ * argument has the root jqLite array so that we can replace nodes
+ * on it.
+ * @param {Object=} originalReplaceDirective An optional directive that will be ignored when
+ * compiling the transclusion.
+ * @param {Array.<Function>} preLinkFns
+ * @param {Array.<Function>} postLinkFns
+ * @param {Object} previousCompileContext Context used for previous compilation of the current
+ * node
+ * @returns {Function} linkFn
+ */
+ function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
+ jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
+ previousCompileContext) {
+ previousCompileContext = previousCompileContext || {};
+
+ var terminalPriority = -Number.MAX_VALUE,
+ newScopeDirective = previousCompileContext.newScopeDirective,
+ controllerDirectives = previousCompileContext.controllerDirectives,
+ newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
+ templateDirective = previousCompileContext.templateDirective,
+ nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
+ hasTranscludeDirective = false,
+ hasTemplate = false,
+ hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
+ $compileNode = templateAttrs.$$element = jqLite(compileNode),
+ directive,
+ directiveName,
+ $template,
+ replaceDirective = originalReplaceDirective,
+ childTranscludeFn = transcludeFn,
+ linkFn,
+ didScanForMultipleTransclusion = false,
+ mightHaveMultipleTransclusionError = false,
+ directiveValue;
+
+ // executes all directives on the current element
+ for (var i = 0, ii = directives.length; i < ii; i++) {
+ directive = directives[i];
+ var attrStart = directive.$$start;
+ var attrEnd = directive.$$end;
+
+ // collect multiblock sections
+ if (attrStart) {
+ $compileNode = groupScan(compileNode, attrStart, attrEnd);
+ }
+ $template = undefined;
+
+ if (terminalPriority > directive.priority) {
+ break; // prevent further processing of directives
+ }
+
+ if (directiveValue = directive.scope) {
+
+ // skip the check for directives with async templates, we'll check the derived sync
+ // directive when the template arrives
+ if (!directive.templateUrl) {
+ if (isObject(directiveValue)) {
+ // This directive is trying to add an isolated scope.
+ // Check that there is no scope of any kind already
+ assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,
+ directive, $compileNode);
+ newIsolateScopeDirective = directive;
+ } else {
+ // This directive is trying to add a child scope.
+ // Check that there is no isolated scope already
+ assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,
+ $compileNode);
+ }
+ }
+
+ newScopeDirective = newScopeDirective || directive;
+ }
+
+ directiveName = directive.name;
+
+ // If we encounter a condition that can result in transclusion on the directive,
+ // then scan ahead in the remaining directives for others that may cause a multiple
+ // transclusion error to be thrown during the compilation process. If a matching directive
+ // is found, then we know that when we encounter a transcluded directive, we need to eagerly
+ // compile the `transclude` function rather than doing it lazily in order to throw
+ // exceptions at the correct time
+ if (!didScanForMultipleTransclusion && ((directive.replace && (directive.templateUrl || directive.template))
+ || (directive.transclude && !directive.$$tlb))) {
+ var candidateDirective;
+
+ for (var scanningIndex = i + 1; candidateDirective = directives[scanningIndex++];) {
+ if ((candidateDirective.transclude && !candidateDirective.$$tlb)
+ || (candidateDirective.replace && (candidateDirective.templateUrl || candidateDirective.template))) {
+ mightHaveMultipleTransclusionError = true;
+ break;
+ }
+ }
+
+ didScanForMultipleTransclusion = true;
+ }
+
+ if (!directive.templateUrl && directive.controller) {
+ directiveValue = directive.controller;
+ controllerDirectives = controllerDirectives || createMap();
+ assertNoDuplicate("'" + directiveName + "' controller",
+ controllerDirectives[directiveName], directive, $compileNode);
+ controllerDirectives[directiveName] = directive;
+ }
+
+ if (directiveValue = directive.transclude) {
+ hasTranscludeDirective = true;
+
+ // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.
+ // This option should only be used by directives that know how to safely handle element transclusion,
+ // where the transcluded nodes are added or replaced after linking.
+ if (!directive.$$tlb) {
+ assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);
+ nonTlbTranscludeDirective = directive;
+ }
+
+ if (directiveValue == 'element') {
+ hasElementTranscludeDirective = true;
+ terminalPriority = directive.priority;
+ $template = $compileNode;
+ $compileNode = templateAttrs.$$element =
+ jqLite(document.createComment(' ' + directiveName + ': ' +
+ templateAttrs[directiveName] + ' '));
+ compileNode = $compileNode[0];
+ replaceWith(jqCollection, sliceArgs($template), compileNode);
+
+ childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, terminalPriority,
+ replaceDirective && replaceDirective.name, {
+ // Don't pass in:
+ // - controllerDirectives - otherwise we'll create duplicates controllers
+ // - newIsolateScopeDirective or templateDirective - combining templates with
+ // element transclusion doesn't make sense.
+ //
+ // We need only nonTlbTranscludeDirective so that we prevent putting transclusion
+ // on the same element more than once.
+ nonTlbTranscludeDirective: nonTlbTranscludeDirective
+ });
+ } else {
+
+ var slots = createMap();
+
+ $template = jqLite(jqLiteClone(compileNode)).contents();
+
+ if (isObject(directiveValue)) {
+
+ // We have transclusion slots,
+ // collect them up, compile them and store their transclusion functions
+ $template = [];
+
+ var slotMap = createMap();
+ var filledSlots = createMap();
+
+ // Parse the element selectors
+ forEach(directiveValue, function(elementSelector, slotName) {
+ // If an element selector starts with a ? then it is optional
+ var optional = (elementSelector.charAt(0) === '?');
+ elementSelector = optional ? elementSelector.substring(1) : elementSelector;
+
+ slotMap[elementSelector] = slotName;
+
+ // We explicitly assign `null` since this implies that a slot was defined but not filled.
+ // Later when calling boundTransclusion functions with a slot name we only error if the
+ // slot is `undefined`
+ slots[slotName] = null;
+
+ // filledSlots contains `true` for all slots that are either optional or have been
+ // filled. This is used to check that we have not missed any required slots
+ filledSlots[slotName] = optional;
+ });
+
+ // Add the matching elements into their slot
+ forEach($compileNode.contents(), function(node) {
+ var slotName = slotMap[directiveNormalize(nodeName_(node))];
+ if (slotName) {
+ filledSlots[slotName] = true;
+ slots[slotName] = slots[slotName] || [];
+ slots[slotName].push(node);
+ } else {
+ $template.push(node);
+ }
+ });
+
+ // Check for required slots that were not filled
+ forEach(filledSlots, function(filled, slotName) {
+ if (!filled) {
+ throw $compileMinErr('reqslot', 'Required transclusion slot `{0}` was not filled.', slotName);
+ }
+ });
+
+ for (var slotName in slots) {
+ if (slots[slotName]) {
+ // Only define a transclusion function if the slot was filled
+ slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slots[slotName], transcludeFn);
+ }
+ }
+ }
+
+ $compileNode.empty(); // clear contents
+ childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, undefined,
+ undefined, { needsNewScope: directive.$$isolateScope || directive.$$newScope});
+ childTranscludeFn.$$slots = slots;
+ }
+ }
+
+ if (directive.template) {
+ hasTemplate = true;
+ assertNoDuplicate('template', templateDirective, directive, $compileNode);
+ templateDirective = directive;
+
+ directiveValue = (isFunction(directive.template))
+ ? directive.template($compileNode, templateAttrs)
+ : directive.template;
+
+ directiveValue = denormalizeTemplate(directiveValue);
+
+ if (directive.replace) {
+ replaceDirective = directive;
+ if (jqLiteIsTextNode(directiveValue)) {
+ $template = [];
+ } else {
+ $template = removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue)));
+ }
+ compileNode = $template[0];
+
+ if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
+ throw $compileMinErr('tplrt',
+ "Template for directive '{0}' must have exactly one root element. {1}",
+ directiveName, '');
+ }
+
+ replaceWith(jqCollection, $compileNode, compileNode);
+
+ var newTemplateAttrs = {$attr: {}};
+
+ // combine directives from the original node and from the template:
+ // - take the array of directives for this element
+ // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed)
+ // - collect directives from the template and sort them by priority
+ // - combine directives as: processed + template + unprocessed
+ var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs);
+ var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));
+
+ if (newIsolateScopeDirective || newScopeDirective) {
+ // The original directive caused the current element to be replaced but this element
+ // also needs to have a new scope, so we need to tell the template directives
+ // that they would need to get their scope from further up, if they require transclusion
+ markDirectiveScope(templateDirectives, newIsolateScopeDirective, newScopeDirective);
+ }
+ directives = directives.concat(templateDirectives).concat(unprocessedDirectives);
+ mergeTemplateAttributes(templateAttrs, newTemplateAttrs);
+
+ ii = directives.length;
+ } else {
+ $compileNode.html(directiveValue);
+ }
+ }
+
+ if (directive.templateUrl) {
+ hasTemplate = true;
+ assertNoDuplicate('template', templateDirective, directive, $compileNode);
+ templateDirective = directive;
+
+ if (directive.replace) {
+ replaceDirective = directive;
+ }
+
+ nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,
+ templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, {
+ controllerDirectives: controllerDirectives,
+ newScopeDirective: (newScopeDirective !== directive) && newScopeDirective,
+ newIsolateScopeDirective: newIsolateScopeDirective,
+ templateDirective: templateDirective,
+ nonTlbTranscludeDirective: nonTlbTranscludeDirective
+ });
+ ii = directives.length;
+ } else if (directive.compile) {
+ try {
+ linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);
+ if (isFunction(linkFn)) {
+ addLinkFns(null, linkFn, attrStart, attrEnd);
+ } else if (linkFn) {
+ addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd);
+ }
+ } catch (e) {
+ $exceptionHandler(e, startingTag($compileNode));
+ }
+ }
+
+ if (directive.terminal) {
+ nodeLinkFn.terminal = true;
+ terminalPriority = Math.max(terminalPriority, directive.priority);
+ }
+
+ }
+
+ nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;
+ nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective;
+ nodeLinkFn.templateOnThisElement = hasTemplate;
+ nodeLinkFn.transclude = childTranscludeFn;
+
+ previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective;
+
+ // might be normal or delayed nodeLinkFn depending on if templateUrl is present
+ return nodeLinkFn;
+
+ ////////////////////
+
+ function addLinkFns(pre, post, attrStart, attrEnd) {
+ if (pre) {
+ if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);
+ pre.require = directive.require;
+ pre.directiveName = directiveName;
+ if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
+ pre = cloneAndAnnotateFn(pre, {isolateScope: true});
+ }
+ preLinkFns.push(pre);
+ }
+ if (post) {
+ if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);
+ post.require = directive.require;
+ post.directiveName = directiveName;
+ if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
+ post = cloneAndAnnotateFn(post, {isolateScope: true});
+ }
+ postLinkFns.push(post);
+ }
+ }
+
+
+ function getControllers(directiveName, require, $element, elementControllers) {
+ var value;
+
+ if (isString(require)) {
+ var match = require.match(REQUIRE_PREFIX_REGEXP);
+ var name = require.substring(match[0].length);
+ var inheritType = match[1] || match[3];
+ var optional = match[2] === '?';
+
+ //If only parents then start at the parent element
+ if (inheritType === '^^') {
+ $element = $element.parent();
+ //Otherwise attempt getting the controller from elementControllers in case
+ //the element is transcluded (and has no data) and to avoid .data if possible
+ } else {
+ value = elementControllers && elementControllers[name];
+ value = value && value.instance;
+ }
+
+ if (!value) {
+ var dataName = '$' + name + 'Controller';
+ value = inheritType ? $element.inheritedData(dataName) : $element.data(dataName);
+ }
+
+ if (!value && !optional) {
+ throw $compileMinErr('ctreq',
+ "Controller '{0}', required by directive '{1}', can't be found!",
+ name, directiveName);
+ }
+ } else if (isArray(require)) {
+ value = [];
+ for (var i = 0, ii = require.length; i < ii; i++) {
+ value[i] = getControllers(directiveName, require[i], $element, elementControllers);
+ }
+ } else if (isObject(require)) {
+ value = {};
+ forEach(require, function(controller, property) {
+ value[property] = getControllers(directiveName, controller, $element, elementControllers);
+ });
+ }
+
+ return value || null;
+ }
+
+ function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope) {
+ var elementControllers = createMap();
+ for (var controllerKey in controllerDirectives) {
+ var directive = controllerDirectives[controllerKey];
+ var locals = {
+ $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,
+ $element: $element,
+ $attrs: attrs,
+ $transclude: transcludeFn
+ };
+
+ var controller = directive.controller;
+ if (controller == '@') {
+ controller = attrs[directive.name];
+ }
+
+ var controllerInstance = $controller(controller, locals, true, directive.controllerAs);
+
+ // For directives with element transclusion the element is a comment,
+ // but jQuery .data doesn't support attaching data to comment nodes as it's hard to
+ // clean up (http://bugs.jquery.com/ticket/8335).
+ // Instead, we save the controllers for the element in a local hash and attach to .data
+ // later, once we have the actual element.
+ elementControllers[directive.name] = controllerInstance;
+ if (!hasElementTranscludeDirective) {
+ $element.data('$' + directive.name + 'Controller', controllerInstance.instance);
+ }
+ }
+ return elementControllers;
+ }
+
+ function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
+ var i, ii, linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element,
+ attrs, removeScopeBindingWatches, removeControllerBindingWatches;
+
+ if (compileNode === linkNode) {
+ attrs = templateAttrs;
+ $element = templateAttrs.$$element;
+ } else {
+ $element = jqLite(linkNode);
+ attrs = new Attributes($element, templateAttrs);
+ }
+
+ controllerScope = scope;
+ if (newIsolateScopeDirective) {
+ isolateScope = scope.$new(true);
+ } else if (newScopeDirective) {
+ controllerScope = scope.$parent;
+ }
+
+ if (boundTranscludeFn) {
+ // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn`
+ // is later passed as `parentBoundTranscludeFn` to `publicLinkFn`
+ transcludeFn = controllersBoundTransclude;
+ transcludeFn.$$boundTransclude = boundTranscludeFn;
+ // expose the slots on the `$transclude` function
+ transcludeFn.isSlotFilled = function(slotName) {
+ return !!boundTranscludeFn.$$slots[slotName];
+ };
+ }
+
+ if (controllerDirectives) {
+ elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope);
+ }
+
+ if (newIsolateScopeDirective) {
+ // Initialize isolate scope bindings for new isolate scope directive.
+ compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective ||
+ templateDirective === newIsolateScopeDirective.$$originalDirective)));
+ compile.$$addScopeClass($element, true);
+ isolateScope.$$isolateBindings =
+ newIsolateScopeDirective.$$isolateBindings;
+ removeScopeBindingWatches = initializeDirectiveBindings(scope, attrs, isolateScope,
+ isolateScope.$$isolateBindings,
+ newIsolateScopeDirective);
+ if (removeScopeBindingWatches) {
+ isolateScope.$on('$destroy', removeScopeBindingWatches);
+ }
+ }
+
+ // Initialize bindToController bindings
+ for (var name in elementControllers) {
+ var controllerDirective = controllerDirectives[name];
+ var controller = elementControllers[name];
+ var bindings = controllerDirective.$$bindings.bindToController;
+
+ if (controller.identifier && bindings) {
+ removeControllerBindingWatches =
+ initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
+ }
+
+ var controllerResult = controller();
+ if (controllerResult !== controller.instance) {
+ // If the controller constructor has a return value, overwrite the instance
+ // from setupControllers
+ controller.instance = controllerResult;
+ $element.data('$' + controllerDirective.name + 'Controller', controllerResult);
+ removeControllerBindingWatches && removeControllerBindingWatches();
+ removeControllerBindingWatches =
+ initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
+ }
+ }
+
+ // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy
+ forEach(controllerDirectives, function(controllerDirective, name) {
+ var require = controllerDirective.require;
+ if (controllerDirective.bindToController && !isArray(require) && isObject(require)) {
+ extend(elementControllers[name].instance, getControllers(name, require, $element, elementControllers));
+ }
+ });
+
+ // Trigger the `$onInit` method on all controllers that have one
+ forEach(elementControllers, function(controller) {
+ if (isFunction(controller.instance.$onInit)) {
+ controller.instance.$onInit();
+ }
+ });
+
+ // PRELINKING
+ for (i = 0, ii = preLinkFns.length; i < ii; i++) {
+ linkFn = preLinkFns[i];
+ invokeLinkFn(linkFn,
+ linkFn.isolateScope ? isolateScope : scope,
+ $element,
+ attrs,
+ linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),
+ transcludeFn
+ );
+ }
+
+ // RECURSION
+ // We only pass the isolate scope, if the isolate directive has a template,
+ // otherwise the child elements do not belong to the isolate directive.
+ var scopeToChild = scope;
+ if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {
+ scopeToChild = isolateScope;
+ }
+ childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);
+
+ // POSTLINKING
+ for (i = postLinkFns.length - 1; i >= 0; i--) {
+ linkFn = postLinkFns[i];
+ invokeLinkFn(linkFn,
+ linkFn.isolateScope ? isolateScope : scope,
+ $element,
+ attrs,
+ linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),
+ transcludeFn
+ );
+ }
+
+ // This is the function that is injected as `$transclude`.
+ // Note: all arguments are optional!
+ function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement, slotName) {
+ var transcludeControllers;
+ // No scope passed in:
+ if (!isScope(scope)) {
+ slotName = futureParentElement;
+ futureParentElement = cloneAttachFn;
+ cloneAttachFn = scope;
+ scope = undefined;
+ }
+
+ if (hasElementTranscludeDirective) {
+ transcludeControllers = elementControllers;
+ }
+ if (!futureParentElement) {
+ futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element;
+ }
+ if (slotName) {
+ // slotTranscludeFn can be one of three things:
+ // * a transclude function - a filled slot
+ // * `null` - an optional slot that was not filled
+ // * `undefined` - a slot that was not declared (i.e. invalid)
+ var slotTranscludeFn = boundTranscludeFn.$$slots[slotName];
+ if (slotTranscludeFn) {
+ return slotTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);
+ } else if (isUndefined(slotTranscludeFn)) {
+ throw $compileMinErr('noslot',
+ 'No parent directive that requires a transclusion with slot name "{0}". ' +
+ 'Element: {1}',
+ slotName, startingTag($element));
+ }
+ } else {
+ return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);
+ }
+ }
+ }
+ }
+
+ // Depending upon the context in which a directive finds itself it might need to have a new isolated
+ // or child scope created. For instance:
+ // * if the directive has been pulled into a template because another directive with a higher priority
+ // asked for element transclusion
+ // * if the directive itself asks for transclusion but it is at the root of a template and the original
+ // element was replaced. See https://github.com/angular/angular.js/issues/12936
+ function markDirectiveScope(directives, isolateScope, newScope) {
+ for (var j = 0, jj = directives.length; j < jj; j++) {
+ directives[j] = inherit(directives[j], {$$isolateScope: isolateScope, $$newScope: newScope});
+ }
+ }
+
+ /**
+ * looks up the directive and decorates it with exception handling and proper parameters. We
+ * call this the boundDirective.
+ *
+ * @param {string} name name of the directive to look up.
+ * @param {string} location The directive must be found in specific format.
+ * String containing any of theses characters:
+ *
+ * * `E`: element name
+ * * `A': attribute
+ * * `C`: class
+ * * `M`: comment
+ * @returns {boolean} true if directive was added.
+ */
+ function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,
+ endAttrName) {
+ if (name === ignoreDirective) return null;
+ var match = null;
+ if (hasDirectives.hasOwnProperty(name)) {
+ for (var directive, directives = $injector.get(name + Suffix),
+ i = 0, ii = directives.length; i < ii; i++) {
+ try {
+ directive = directives[i];
+ if ((isUndefined(maxPriority) || maxPriority > directive.priority) &&
+ directive.restrict.indexOf(location) != -1) {
+ if (startAttrName) {
+ directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});
+ }
+ tDirectives.push(directive);
+ match = directive;
+ }
+ } catch (e) { $exceptionHandler(e); }
+ }
+ }
+ return match;
+ }
+
+
+ /**
+ * looks up the directive and returns true if it is a multi-element directive,
+ * and therefore requires DOM nodes between -start and -end markers to be grouped
+ * together.
+ *
+ * @param {string} name name of the directive to look up.
+ * @returns true if directive was registered as multi-element.
+ */
+ function directiveIsMultiElement(name) {
+ if (hasDirectives.hasOwnProperty(name)) {
+ for (var directive, directives = $injector.get(name + Suffix),
+ i = 0, ii = directives.length; i < ii; i++) {
+ directive = directives[i];
+ if (directive.multiElement) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * When the element is replaced with HTML template then the new attributes
+ * on the template need to be merged with the existing attributes in the DOM.
+ * The desired effect is to have both of the attributes present.
+ *
+ * @param {object} dst destination attributes (original DOM)
+ * @param {object} src source attributes (from the directive template)
+ */
+ function mergeTemplateAttributes(dst, src) {
+ var srcAttr = src.$attr,
+ dstAttr = dst.$attr,
+ $element = dst.$$element;
+
+ // reapply the old attributes to the new element
+ forEach(dst, function(value, key) {
+ if (key.charAt(0) != '$') {
+ if (src[key] && src[key] !== value) {
+ value += (key === 'style' ? ';' : ' ') + src[key];
+ }
+ dst.$set(key, value, true, srcAttr[key]);
+ }
+ });
+
+ // copy the new attributes on the old attrs object
+ forEach(src, function(value, key) {
+ if (key == 'class') {
+ safeAddClass($element, value);
+ dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;
+ } else if (key == 'style') {
+ $element.attr('style', $element.attr('style') + ';' + value);
+ dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;
+ // `dst` will never contain hasOwnProperty as DOM parser won't let it.
+ // You will get an "InvalidCharacterError: DOM Exception 5" error if you
+ // have an attribute like "has-own-property" or "data-has-own-property", etc.
+ } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {
+ dst[key] = value;
+ dstAttr[key] = srcAttr[key];
+ }
+ });
+ }
+
+
+ function compileTemplateUrl(directives, $compileNode, tAttrs,
+ $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {
+ var linkQueue = [],
+ afterTemplateNodeLinkFn,
+ afterTemplateChildLinkFn,
+ beforeTemplateCompileNode = $compileNode[0],
+ origAsyncDirective = directives.shift(),
+ derivedSyncDirective = inherit(origAsyncDirective, {
+ templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective
+ }),
+ templateUrl = (isFunction(origAsyncDirective.templateUrl))
+ ? origAsyncDirective.templateUrl($compileNode, tAttrs)
+ : origAsyncDirective.templateUrl,
+ templateNamespace = origAsyncDirective.templateNamespace;
+
+ $compileNode.empty();
+
+ $templateRequest(templateUrl)
+ .then(function(content) {
+ var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;
+
+ content = denormalizeTemplate(content);
+
+ if (origAsyncDirective.replace) {
+ if (jqLiteIsTextNode(content)) {
+ $template = [];
+ } else {
+ $template = removeComments(wrapTemplate(templateNamespace, trim(content)));
+ }
+ compileNode = $template[0];
+
+ if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
+ throw $compileMinErr('tplrt',
+ "Template for directive '{0}' must have exactly one root element. {1}",
+ origAsyncDirective.name, templateUrl);
+ }
+
+ tempTemplateAttrs = {$attr: {}};
+ replaceWith($rootElement, $compileNode, compileNode);
+ var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);
+
+ if (isObject(origAsyncDirective.scope)) {
+ // the original directive that caused the template to be loaded async required
+ // an isolate scope
+ markDirectiveScope(templateDirectives, true);
+ }
+ directives = templateDirectives.concat(directives);
+ mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
+ } else {
+ compileNode = beforeTemplateCompileNode;
+ $compileNode.html(content);
+ }
+
+ directives.unshift(derivedSyncDirective);
+
+ afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,
+ childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,
+ previousCompileContext);
+ forEach($rootElement, function(node, i) {
+ if (node == compileNode) {
+ $rootElement[i] = $compileNode[0];
+ }
+ });
+ afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);
+
+ while (linkQueue.length) {
+ var scope = linkQueue.shift(),
+ beforeTemplateLinkNode = linkQueue.shift(),
+ linkRootElement = linkQueue.shift(),
+ boundTranscludeFn = linkQueue.shift(),
+ linkNode = $compileNode[0];
+
+ if (scope.$$destroyed) continue;
+
+ if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {
+ var oldClasses = beforeTemplateLinkNode.className;
+
+ if (!(previousCompileContext.hasElementTranscludeDirective &&
+ origAsyncDirective.replace)) {
+ // it was cloned therefore we have to clone as well.
+ linkNode = jqLiteClone(compileNode);
+ }
+ replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);
+
+ // Copy in CSS classes from original node
+ safeAddClass(jqLite(linkNode), oldClasses);
+ }
+ if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);
+ } else {
+ childBoundTranscludeFn = boundTranscludeFn;
+ }
+ afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,
+ childBoundTranscludeFn);
+ }
+ linkQueue = null;
+ });
+
+ return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {
+ var childBoundTranscludeFn = boundTranscludeFn;
+ if (scope.$$destroyed) return;
+ if (linkQueue) {
+ linkQueue.push(scope,
+ node,
+ rootElement,
+ childBoundTranscludeFn);
+ } else {
+ if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);
+ }
+ afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn);
+ }
+ };
+ }
+
+
+ /**
+ * Sorting function for bound directives.
+ */
+ function byPriority(a, b) {
+ var diff = b.priority - a.priority;
+ if (diff !== 0) return diff;
+ if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;
+ return a.index - b.index;
+ }
+
+ function assertNoDuplicate(what, previousDirective, directive, element) {
+
+ function wrapModuleNameIfDefined(moduleName) {
+ return moduleName ?
+ (' (module: ' + moduleName + ')') :
+ '';
+ }
+
+ if (previousDirective) {
+ throw $compileMinErr('multidir', 'Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}',
+ previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName),
+ directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element));
+ }
+ }
+
+
+ function addTextInterpolateDirective(directives, text) {
+ var interpolateFn = $interpolate(text, true);
+ if (interpolateFn) {
+ directives.push({
+ priority: 0,
+ compile: function textInterpolateCompileFn(templateNode) {
+ var templateNodeParent = templateNode.parent(),
+ hasCompileParent = !!templateNodeParent.length;
+
+ // When transcluding a template that has bindings in the root
+ // we don't have a parent and thus need to add the class during linking fn.
+ if (hasCompileParent) compile.$$addBindingClass(templateNodeParent);
+
+ return function textInterpolateLinkFn(scope, node) {
+ var parent = node.parent();
+ if (!hasCompileParent) compile.$$addBindingClass(parent);
+ compile.$$addBindingInfo(parent, interpolateFn.expressions);
+ scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {
+ node[0].nodeValue = value;
+ });
+ };
+ }
+ });
+ }
+ }
+
+
+ function wrapTemplate(type, template) {
+ type = lowercase(type || 'html');
+ switch (type) {
+ case 'svg':
+ case 'math':
+ var wrapper = document.createElement('div');
+ wrapper.innerHTML = '<' + type + '>' + template + '</' + type + '>';
+ return wrapper.childNodes[0].childNodes;
+ default:
+ return template;
+ }
+ }
+
+
+ function getTrustedContext(node, attrNormalizedName) {
+ if (attrNormalizedName == "srcdoc") {
+ return $sce.HTML;
+ }
+ var tag = nodeName_(node);
+ // maction[xlink:href] can source SVG. It's not limited to <maction>.
+ if (attrNormalizedName == "xlinkHref" ||
+ (tag == "form" && attrNormalizedName == "action") ||
+ (tag != "img" && (attrNormalizedName == "src" ||
+ attrNormalizedName == "ngSrc"))) {
+ return $sce.RESOURCE_URL;
+ }
+ }
+
+
+ function addAttrInterpolateDirective(node, directives, value, name, allOrNothing) {
+ var trustedContext = getTrustedContext(node, name);
+ allOrNothing = ALL_OR_NOTHING_ATTRS[name] || allOrNothing;
+
+ var interpolateFn = $interpolate(value, true, trustedContext, allOrNothing);
+
+ // no interpolation found -> ignore
+ if (!interpolateFn) return;
+
+
+ if (name === "multiple" && nodeName_(node) === "select") {
+ throw $compileMinErr("selmulti",
+ "Binding to the 'multiple' attribute is not supported. Element: {0}",
+ startingTag(node));
+ }
+
+ directives.push({
+ priority: 100,
+ compile: function() {
+ return {
+ pre: function attrInterpolatePreLinkFn(scope, element, attr) {
+ var $$observers = (attr.$$observers || (attr.$$observers = createMap()));
+
+ if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {
+ throw $compileMinErr('nodomevents',
+ "Interpolations for HTML DOM event attributes are disallowed. Please use the " +
+ "ng- versions (such as ng-click instead of onclick) instead.");
+ }
+
+ // If the attribute has changed since last $interpolate()ed
+ var newValue = attr[name];
+ if (newValue !== value) {
+ // we need to interpolate again since the attribute value has been updated
+ // (e.g. by another directive's compile function)
+ // ensure unset/empty values make interpolateFn falsy
+ interpolateFn = newValue && $interpolate(newValue, true, trustedContext, allOrNothing);
+ value = newValue;
+ }
+
+ // if attribute was updated so that there is no interpolation going on we don't want to
+ // register any observers
+ if (!interpolateFn) return;
+
+ // initialize attr object so that it's ready in case we need the value for isolate
+ // scope initialization, otherwise the value would not be available from isolate
+ // directive's linking fn during linking phase
+ attr[name] = interpolateFn(scope);
+
+ ($$observers[name] || ($$observers[name] = [])).$$inter = true;
+ (attr.$$observers && attr.$$observers[name].$$scope || scope).
+ $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {
+ //special case for class attribute addition + removal
+ //so that class changes can tap into the animation
+ //hooks provided by the $animate service. Be sure to
+ //skip animations when the first digest occurs (when
+ //both the new and the old values are the same) since
+ //the CSS classes are the non-interpolated values
+ if (name === 'class' && newValue != oldValue) {
+ attr.$updateClass(newValue, oldValue);
+ } else {
+ attr.$set(name, newValue);
+ }
+ });
+ }
+ };
+ }
+ });
+ }
+
+
+ /**
+ * This is a special jqLite.replaceWith, which can replace items which
+ * have no parents, provided that the containing jqLite collection is provided.
+ *
+ * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
+ * in the root of the tree.
+ * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep
+ * the shell, but replace its DOM node reference.
+ * @param {Node} newNode The new DOM node.
+ */
+ function replaceWith($rootElement, elementsToRemove, newNode) {
+ var firstElementToRemove = elementsToRemove[0],
+ removeCount = elementsToRemove.length,
+ parent = firstElementToRemove.parentNode,
+ i, ii;
+
+ if ($rootElement) {
+ for (i = 0, ii = $rootElement.length; i < ii; i++) {
+ if ($rootElement[i] == firstElementToRemove) {
+ $rootElement[i++] = newNode;
+ for (var j = i, j2 = j + removeCount - 1,
+ jj = $rootElement.length;
+ j < jj; j++, j2++) {
+ if (j2 < jj) {
+ $rootElement[j] = $rootElement[j2];
+ } else {
+ delete $rootElement[j];
+ }
+ }
+ $rootElement.length -= removeCount - 1;
+
+ // If the replaced element is also the jQuery .context then replace it
+ // .context is a deprecated jQuery api, so we should set it only when jQuery set it
+ // http://api.jquery.com/context/
+ if ($rootElement.context === firstElementToRemove) {
+ $rootElement.context = newNode;
+ }
+ break;
+ }
+ }
+ }
+
+ if (parent) {
+ parent.replaceChild(newNode, firstElementToRemove);
+ }
+
+ // Append all the `elementsToRemove` to a fragment. This will...
+ // - remove them from the DOM
+ // - allow them to still be traversed with .nextSibling
+ // - allow a single fragment.qSA to fetch all elements being removed
+ var fragment = document.createDocumentFragment();
+ for (i = 0; i < removeCount; i++) {
+ fragment.appendChild(elementsToRemove[i]);
+ }
+
+ if (jqLite.hasData(firstElementToRemove)) {
+ // Copy over user data (that includes Angular's $scope etc.). Don't copy private
+ // data here because there's no public interface in jQuery to do that and copying over
+ // event listeners (which is the main use of private data) wouldn't work anyway.
+ jqLite.data(newNode, jqLite.data(firstElementToRemove));
+
+ // Remove $destroy event listeners from `firstElementToRemove`
+ jqLite(firstElementToRemove).off('$destroy');
+ }
+
+ // Cleanup any data/listeners on the elements and children.
+ // This includes invoking the $destroy event on any elements with listeners.
+ jqLite.cleanData(fragment.querySelectorAll('*'));
+
+ // Update the jqLite collection to only contain the `newNode`
+ for (i = 1; i < removeCount; i++) {
+ delete elementsToRemove[i];
+ }
+ elementsToRemove[0] = newNode;
+ elementsToRemove.length = 1;
+ }
+
+
+ function cloneAndAnnotateFn(fn, annotation) {
+ return extend(function() { return fn.apply(null, arguments); }, fn, annotation);
+ }
+
+
+ function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) {
+ try {
+ linkFn(scope, $element, attrs, controllers, transcludeFn);
+ } catch (e) {
+ $exceptionHandler(e, startingTag($element));
+ }
+ }
+
+
+ // Set up $watches for isolate scope and controller bindings. This process
+ // only occurs for isolate scopes and new scopes with controllerAs.
+ function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) {
+ var removeWatchCollection = [];
+ forEach(bindings, function(definition, scopeName) {
+ var attrName = definition.attrName,
+ optional = definition.optional,
+ mode = definition.mode, // @, =, or &
+ lastValue,
+ parentGet, parentSet, compare, removeWatch;
+
+ switch (mode) {
+
+ case '@':
+ if (!optional && !hasOwnProperty.call(attrs, attrName)) {
+ destination[scopeName] = attrs[attrName] = void 0;
+ }
+ attrs.$observe(attrName, function(value) {
+ if (isString(value)) {
+ destination[scopeName] = value;
+ }
+ });
+ attrs.$$observers[attrName].$$scope = scope;
+ lastValue = attrs[attrName];
+ if (isString(lastValue)) {
+ // If the attribute has been provided then we trigger an interpolation to ensure
+ // the value is there for use in the link fn
+ destination[scopeName] = $interpolate(lastValue)(scope);
+ } else if (isBoolean(lastValue)) {
+ // If the attributes is one of the BOOLEAN_ATTR then Angular will have converted
+ // the value to boolean rather than a string, so we special case this situation
+ destination[scopeName] = lastValue;
+ }
+ break;
+
+ case '=':
+ if (!hasOwnProperty.call(attrs, attrName)) {
+ if (optional) break;
+ attrs[attrName] = void 0;
+ }
+ if (optional && !attrs[attrName]) break;
+
+ parentGet = $parse(attrs[attrName]);
+ if (parentGet.literal) {
+ compare = equals;
+ } else {
+ compare = function(a, b) { return a === b || (a !== a && b !== b); };
+ }
+ parentSet = parentGet.assign || function() {
+ // reset the change, or we will throw this exception on every $digest
+ lastValue = destination[scopeName] = parentGet(scope);
+ throw $compileMinErr('nonassign',
+ "Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!",
+ attrs[attrName], attrName, directive.name);
+ };
+ lastValue = destination[scopeName] = parentGet(scope);
+ var parentValueWatch = function parentValueWatch(parentValue) {
+ if (!compare(parentValue, destination[scopeName])) {
+ // we are out of sync and need to copy
+ if (!compare(parentValue, lastValue)) {
+ // parent changed and it has precedence
+ destination[scopeName] = parentValue;
+ } else {
+ // if the parent can be assigned then do so
+ parentSet(scope, parentValue = destination[scopeName]);
+ }
+ }
+ return lastValue = parentValue;
+ };
+ parentValueWatch.$stateful = true;
+ if (definition.collection) {
+ removeWatch = scope.$watchCollection(attrs[attrName], parentValueWatch);
+ } else {
+ removeWatch = scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal);
+ }
+ removeWatchCollection.push(removeWatch);
+ break;
+
+ case '<':
+ if (!hasOwnProperty.call(attrs, attrName)) {
+ if (optional) break;
+ attrs[attrName] = void 0;
+ }
+ if (optional && !attrs[attrName]) break;
+
+ parentGet = $parse(attrs[attrName]);
+
+ destination[scopeName] = parentGet(scope);
+
+ removeWatch = scope.$watch(parentGet, function parentValueWatchAction(newParentValue) {
+ destination[scopeName] = newParentValue;
+ }, parentGet.literal);
+
+ removeWatchCollection.push(removeWatch);
+ break;
+
+ case '&':
+ // Don't assign Object.prototype method to scope
+ parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop;
+
+ // Don't assign noop to destination if expression is not valid
+ if (parentGet === noop && optional) break;
+
+ destination[scopeName] = function(locals) {
+ return parentGet(scope, locals);
+ };
+ break;
+ }
+ });
+
+ return removeWatchCollection.length && function removeWatches() {
+ for (var i = 0, ii = removeWatchCollection.length; i < ii; ++i) {
+ removeWatchCollection[i]();
+ }
+ };
+ }
+ }];
+}
+
+var PREFIX_REGEXP = /^((?:x|data)[\:\-_])/i;
+/**
+ * Converts all accepted directives format into proper directive name.
+ * @param name Name to normalize
+ */
+function directiveNormalize(name) {
+ return camelCase(name.replace(PREFIX_REGEXP, ''));
+}
+
+/**
+ * @ngdoc type
+ * @name $compile.directive.Attributes
+ *
+ * @description
+ * A shared object between directive compile / linking functions which contains normalized DOM
+ * element attributes. The values reflect current binding state `{{ }}`. The normalization is
+ * needed since all of these are treated as equivalent in Angular:
+ *
+ * ```
+ * <span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a">
+ * ```
+ */
+
+/**
+ * @ngdoc property
+ * @name $compile.directive.Attributes#$attr
+ *
+ * @description
+ * A map of DOM element attribute names to the normalized name. This is
+ * needed to do reverse lookup from normalized name back to actual name.
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$set
+ * @kind function
+ *
+ * @description
+ * Set DOM element attribute value.
+ *
+ *
+ * @param {string} name Normalized element attribute name of the property to modify. The name is
+ * reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}
+ * property to the original name.
+ * @param {string} value Value to set the attribute to. The value can be an interpolated string.
+ */
+
+
+
+/**
+ * Closure compiler type information
+ */
+
+function nodesetLinkingFn(
+ /* angular.Scope */ scope,
+ /* NodeList */ nodeList,
+ /* Element */ rootElement,
+ /* function(Function) */ boundTranscludeFn
+) {}
+
+function directiveLinkingFn(
+ /* nodesetLinkingFn */ nodesetLinkingFn,
+ /* angular.Scope */ scope,
+ /* Node */ node,
+ /* Element */ rootElement,
+ /* function(Function) */ boundTranscludeFn
+) {}
+
+function tokenDifference(str1, str2) {
+ var values = '',
+ tokens1 = str1.split(/\s+/),
+ tokens2 = str2.split(/\s+/);
+
+ outer:
+ for (var i = 0; i < tokens1.length; i++) {
+ var token = tokens1[i];
+ for (var j = 0; j < tokens2.length; j++) {
+ if (token == tokens2[j]) continue outer;
+ }
+ values += (values.length > 0 ? ' ' : '') + token;
+ }
+ return values;
+}
+
+function removeComments(jqNodes) {
+ jqNodes = jqLite(jqNodes);
+ var i = jqNodes.length;
+
+ if (i <= 1) {
+ return jqNodes;
+ }
+
+ while (i--) {
+ var node = jqNodes[i];
+ if (node.nodeType === NODE_TYPE_COMMENT) {
+ splice.call(jqNodes, i, 1);
+ }
+ }
+ return jqNodes;
+}
+
+var $controllerMinErr = minErr('$controller');
+
+
+var CNTRL_REG = /^(\S+)(\s+as\s+([\w$]+))?$/;
+function identifierForController(controller, ident) {
+ if (ident && isString(ident)) return ident;
+ if (isString(controller)) {
+ var match = CNTRL_REG.exec(controller);
+ if (match) return match[3];
+ }
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $controllerProvider
+ * @description
+ * The {@link ng.$controller $controller service} is used by Angular to create new
+ * controllers.
+ *
+ * This provider allows controller registration via the
+ * {@link ng.$controllerProvider#register register} method.
+ */
+function $ControllerProvider() {
+ var controllers = {},
+ globals = false;
+
+ /**
+ * @ngdoc method
+ * @name $controllerProvider#register
+ * @param {string|Object} name Controller name, or an object map of controllers where the keys are
+ * the names and the values are the constructors.
+ * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI
+ * annotations in the array notation).
+ */
+ this.register = function(name, constructor) {
+ assertNotHasOwnProperty(name, 'controller');
+ if (isObject(name)) {
+ extend(controllers, name);
+ } else {
+ controllers[name] = constructor;
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $controllerProvider#allowGlobals
+ * @description If called, allows `$controller` to find controller constructors on `window`
+ */
+ this.allowGlobals = function() {
+ globals = true;
+ };
+
+
+ this.$get = ['$injector', '$window', function($injector, $window) {
+
+ /**
+ * @ngdoc service
+ * @name $controller
+ * @requires $injector
+ *
+ * @param {Function|string} constructor If called with a function then it's considered to be the
+ * controller constructor function. Otherwise it's considered to be a string which is used
+ * to retrieve the controller constructor using the following steps:
+ *
+ * * check if a controller with given name is registered via `$controllerProvider`
+ * * check if evaluating the string on the current scope returns a constructor
+ * * if $controllerProvider#allowGlobals, check `window[constructor]` on the global
+ * `window` object (not recommended)
+ *
+ * The string can use the `controller as property` syntax, where the controller instance is published
+ * as the specified property on the `scope`; the `scope` must be injected into `locals` param for this
+ * to work correctly.
+ *
+ * @param {Object} locals Injection locals for Controller.
+ * @return {Object} Instance of given controller.
+ *
+ * @description
+ * `$controller` service is responsible for instantiating controllers.
+ *
+ * It's just a simple call to {@link auto.$injector $injector}, but extracted into
+ * a service, so that one can override this service with [BC version](https://gist.github.com/1649788).
+ */
+ return function(expression, locals, later, ident) {
+ // PRIVATE API:
+ // param `later` --- indicates that the controller's constructor is invoked at a later time.
+ // If true, $controller will allocate the object with the correct
+ // prototype chain, but will not invoke the controller until a returned
+ // callback is invoked.
+ // param `ident` --- An optional label which overrides the label parsed from the controller
+ // expression, if any.
+ var instance, match, constructor, identifier;
+ later = later === true;
+ if (ident && isString(ident)) {
+ identifier = ident;
+ }
+
+ if (isString(expression)) {
+ match = expression.match(CNTRL_REG);
+ if (!match) {
+ throw $controllerMinErr('ctrlfmt',
+ "Badly formed controller string '{0}'. " +
+ "Must match `__name__ as __id__` or `__name__`.", expression);
+ }
+ constructor = match[1],
+ identifier = identifier || match[3];
+ expression = controllers.hasOwnProperty(constructor)
+ ? controllers[constructor]
+ : getter(locals.$scope, constructor, true) ||
+ (globals ? getter($window, constructor, true) : undefined);
+
+ assertArgFn(expression, constructor, true);
+ }
+
+ if (later) {
+ // Instantiate controller later:
+ // This machinery is used to create an instance of the object before calling the
+ // controller's constructor itself.
+ //
+ // This allows properties to be added to the controller before the constructor is
+ // invoked. Primarily, this is used for isolate scope bindings in $compile.
+ //
+ // This feature is not intended for use by applications, and is thus not documented
+ // publicly.
+ // Object creation: http://jsperf.com/create-constructor/2
+ var controllerPrototype = (isArray(expression) ?
+ expression[expression.length - 1] : expression).prototype;
+ instance = Object.create(controllerPrototype || null);
+
+ if (identifier) {
+ addIdentifier(locals, identifier, instance, constructor || expression.name);
+ }
+
+ var instantiate;
+ return instantiate = extend(function() {
+ var result = $injector.invoke(expression, instance, locals, constructor);
+ if (result !== instance && (isObject(result) || isFunction(result))) {
+ instance = result;
+ if (identifier) {
+ // If result changed, re-assign controllerAs value to scope.
+ addIdentifier(locals, identifier, instance, constructor || expression.name);
+ }
+ }
+ return instance;
+ }, {
+ instance: instance,
+ identifier: identifier
+ });
+ }
+
+ instance = $injector.instantiate(expression, locals, constructor);
+
+ if (identifier) {
+ addIdentifier(locals, identifier, instance, constructor || expression.name);
+ }
+
+ return instance;
+ };
+
+ function addIdentifier(locals, identifier, instance, name) {
+ if (!(locals && isObject(locals.$scope))) {
+ throw minErr('$controller')('noscp',
+ "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",
+ name, identifier);
+ }
+
+ locals.$scope[identifier] = instance;
+ }
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $document
+ * @requires $window
+ *
+ * @description
+ * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.
+ *
+ * @example
+ <example module="documentExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <p>$document title: <b ng-bind="title"></b></p>
+ <p>window.document title: <b ng-bind="windowTitle"></b></p>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('documentExample', [])
+ .controller('ExampleController', ['$scope', '$document', function($scope, $document) {
+ $scope.title = $document[0].title;
+ $scope.windowTitle = angular.element(window.document)[0].title;
+ }]);
+ </file>
+ </example>
+ */
+function $DocumentProvider() {
+ this.$get = ['$window', function(window) {
+ return jqLite(window.document);
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $exceptionHandler
+ * @requires ng.$log
+ *
+ * @description
+ * Any uncaught exception in angular expressions is delegated to this service.
+ * The default implementation simply delegates to `$log.error` which logs it into
+ * the browser console.
+ *
+ * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by
+ * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.
+ *
+ * ## Example:
+ *
+ * ```js
+ * angular.module('exceptionOverride', []).factory('$exceptionHandler', function() {
+ * return function(exception, cause) {
+ * exception.message += ' (caused by "' + cause + '")';
+ * throw exception;
+ * };
+ * });
+ * ```
+ *
+ * This example will override the normal action of `$exceptionHandler`, to make angular
+ * exceptions fail hard when they happen, instead of just logging to the console.
+ *
+ * <hr />
+ * Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind`
+ * methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler}
+ * (unless executed during a digest).
+ *
+ * If you wish, you can manually delegate exceptions, e.g.
+ * `try { ... } catch(e) { $exceptionHandler(e); }`
+ *
+ * @param {Error} exception Exception associated with the error.
+ * @param {string=} cause optional information about the context in which
+ * the error was thrown.
+ *
+ */
+function $ExceptionHandlerProvider() {
+ this.$get = ['$log', function($log) {
+ return function(exception, cause) {
+ $log.error.apply($log, arguments);
+ };
+ }];
+}
+
+var $$ForceReflowProvider = function() {
+ this.$get = ['$document', function($document) {
+ return function(domNode) {
+ //the line below will force the browser to perform a repaint so
+ //that all the animated elements within the animation frame will
+ //be properly updated and drawn on screen. This is required to
+ //ensure that the preparation animation is properly flushed so that
+ //the active state picks up from there. DO NOT REMOVE THIS LINE.
+ //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH
+ //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND
+ //WILL TAKE YEARS AWAY FROM YOUR LIFE.
+ if (domNode) {
+ if (!domNode.nodeType && domNode instanceof jqLite) {
+ domNode = domNode[0];
+ }
+ } else {
+ domNode = $document[0].body;
+ }
+ return domNode.offsetWidth + 1;
+ };
+ }];
+};
+
+var APPLICATION_JSON = 'application/json';
+var CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': APPLICATION_JSON + ';charset=utf-8'};
+var JSON_START = /^\[|^\{(?!\{)/;
+var JSON_ENDS = {
+ '[': /]$/,
+ '{': /}$/
+};
+var JSON_PROTECTION_PREFIX = /^\)\]\}',?\n/;
+var $httpMinErr = minErr('$http');
+var $httpMinErrLegacyFn = function(method) {
+ return function() {
+ throw $httpMinErr('legacy', 'The method `{0}` on the promise returned from `$http` has been disabled.', method);
+ };
+};
+
+function serializeValue(v) {
+ if (isObject(v)) {
+ return isDate(v) ? v.toISOString() : toJson(v);
+ }
+ return v;
+}
+
+
+function $HttpParamSerializerProvider() {
+ /**
+ * @ngdoc service
+ * @name $httpParamSerializer
+ * @description
+ *
+ * Default {@link $http `$http`} params serializer that converts objects to strings
+ * according to the following rules:
+ *
+ * * `{'foo': 'bar'}` results in `foo=bar`
+ * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object)
+ * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element)
+ * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D"` (stringified and encoded representation of an object)
+ *
+ * Note that serializer will sort the request parameters alphabetically.
+ * */
+
+ this.$get = function() {
+ return function ngParamSerializer(params) {
+ if (!params) return '';
+ var parts = [];
+ forEachSorted(params, function(value, key) {
+ if (value === null || isUndefined(value)) return;
+ if (isArray(value)) {
+ forEach(value, function(v, k) {
+ parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v)));
+ });
+ } else {
+ parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value)));
+ }
+ });
+
+ return parts.join('&');
+ };
+ };
+}
+
+function $HttpParamSerializerJQLikeProvider() {
+ /**
+ * @ngdoc service
+ * @name $httpParamSerializerJQLike
+ * @description
+ *
+ * Alternative {@link $http `$http`} params serializer that follows
+ * jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.
+ * The serializer will also sort the params alphabetically.
+ *
+ * To use it for serializing `$http` request parameters, set it as the `paramSerializer` property:
+ *
+ * ```js
+ * $http({
+ * url: myUrl,
+ * method: 'GET',
+ * params: myParams,
+ * paramSerializer: '$httpParamSerializerJQLike'
+ * });
+ * ```
+ *
+ * It is also possible to set it as the default `paramSerializer` in the
+ * {@link $httpProvider#defaults `$httpProvider`}.
+ *
+ * Additionally, you can inject the serializer and use it explicitly, for example to serialize
+ * form data for submission:
+ *
+ * ```js
+ * .controller(function($http, $httpParamSerializerJQLike) {
+ * //...
+ *
+ * $http({
+ * url: myUrl,
+ * method: 'POST',
+ * data: $httpParamSerializerJQLike(myData),
+ * headers: {
+ * 'Content-Type': 'application/x-www-form-urlencoded'
+ * }
+ * });
+ *
+ * });
+ * ```
+ *
+ * */
+ this.$get = function() {
+ return function jQueryLikeParamSerializer(params) {
+ if (!params) return '';
+ var parts = [];
+ serialize(params, '', true);
+ return parts.join('&');
+
+ function serialize(toSerialize, prefix, topLevel) {
+ if (toSerialize === null || isUndefined(toSerialize)) return;
+ if (isArray(toSerialize)) {
+ forEach(toSerialize, function(value, index) {
+ serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']');
+ });
+ } else if (isObject(toSerialize) && !isDate(toSerialize)) {
+ forEachSorted(toSerialize, function(value, key) {
+ serialize(value, prefix +
+ (topLevel ? '' : '[') +
+ key +
+ (topLevel ? '' : ']'));
+ });
+ } else {
+ parts.push(encodeUriQuery(prefix) + '=' + encodeUriQuery(serializeValue(toSerialize)));
+ }
+ }
+ };
+ };
+}
+
+function defaultHttpResponseTransform(data, headers) {
+ if (isString(data)) {
+ // Strip json vulnerability protection prefix and trim whitespace
+ var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim();
+
+ if (tempData) {
+ var contentType = headers('Content-Type');
+ if ((contentType && (contentType.indexOf(APPLICATION_JSON) === 0)) || isJsonLike(tempData)) {
+ data = fromJson(tempData);
+ }
+ }
+ }
+
+ return data;
+}
+
+function isJsonLike(str) {
+ var jsonStart = str.match(JSON_START);
+ return jsonStart && JSON_ENDS[jsonStart[0]].test(str);
+}
+
+/**
+ * Parse headers into key value object
+ *
+ * @param {string} headers Raw headers as a string
+ * @returns {Object} Parsed headers as key value object
+ */
+function parseHeaders(headers) {
+ var parsed = createMap(), i;
+
+ function fillInParsed(key, val) {
+ if (key) {
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
+ }
+ }
+
+ if (isString(headers)) {
+ forEach(headers.split('\n'), function(line) {
+ i = line.indexOf(':');
+ fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));
+ });
+ } else if (isObject(headers)) {
+ forEach(headers, function(headerVal, headerKey) {
+ fillInParsed(lowercase(headerKey), trim(headerVal));
+ });
+ }
+
+ return parsed;
+}
+
+
+/**
+ * Returns a function that provides access to parsed headers.
+ *
+ * Headers are lazy parsed when first requested.
+ * @see parseHeaders
+ *
+ * @param {(string|Object)} headers Headers to provide access to.
+ * @returns {function(string=)} Returns a getter function which if called with:
+ *
+ * - if called with single an argument returns a single header value or null
+ * - if called with no arguments returns an object containing all headers.
+ */
+function headersGetter(headers) {
+ var headersObj;
+
+ return function(name) {
+ if (!headersObj) headersObj = parseHeaders(headers);
+
+ if (name) {
+ var value = headersObj[lowercase(name)];
+ if (value === void 0) {
+ value = null;
+ }
+ return value;
+ }
+
+ return headersObj;
+ };
+}
+
+
+/**
+ * Chain all given functions
+ *
+ * This function is used for both request and response transforming
+ *
+ * @param {*} data Data to transform.
+ * @param {function(string=)} headers HTTP headers getter fn.
+ * @param {number} status HTTP status code of the response.
+ * @param {(Function|Array.<Function>)} fns Function or an array of functions.
+ * @returns {*} Transformed data.
+ */
+function transformData(data, headers, status, fns) {
+ if (isFunction(fns)) {
+ return fns(data, headers, status);
+ }
+
+ forEach(fns, function(fn) {
+ data = fn(data, headers, status);
+ });
+
+ return data;
+}
+
+
+function isSuccess(status) {
+ return 200 <= status && status < 300;
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $httpProvider
+ * @description
+ * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
+ * */
+function $HttpProvider() {
+ /**
+ * @ngdoc property
+ * @name $httpProvider#defaults
+ * @description
+ *
+ * Object containing default values for all {@link ng.$http $http} requests.
+ *
+ * - **`defaults.cache`** - {Object} - an object built with {@link ng.$cacheFactory `$cacheFactory`}
+ * that will provide the cache for all requests who set their `cache` property to `true`.
+ * If you set the `defaults.cache = false` then only requests that specify their own custom
+ * cache object will be cached. See {@link $http#caching $http Caching} for more information.
+ *
+ * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
+ * Defaults value is `'XSRF-TOKEN'`.
+ *
+ * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
+ * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
+ *
+ * - **`defaults.headers`** - {Object} - Default headers for all $http requests.
+ * Refer to {@link ng.$http#setting-http-headers $http} for documentation on
+ * setting default headers.
+ * - **`defaults.headers.common`**
+ * - **`defaults.headers.post`**
+ * - **`defaults.headers.put`**
+ * - **`defaults.headers.patch`**
+ *
+ *
+ * - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function
+ * used to the prepare string representation of request parameters (specified as an object).
+ * If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.
+ * Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.
+ *
+ **/
+ var defaults = this.defaults = {
+ // transform incoming response data
+ transformResponse: [defaultHttpResponseTransform],
+
+ // transform outgoing request data
+ transformRequest: [function(d) {
+ return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d;
+ }],
+
+ // default headers
+ headers: {
+ common: {
+ 'Accept': 'application/json, text/plain, */*'
+ },
+ post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
+ put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
+ patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON)
+ },
+
+ xsrfCookieName: 'XSRF-TOKEN',
+ xsrfHeaderName: 'X-XSRF-TOKEN',
+
+ paramSerializer: '$httpParamSerializer'
+ };
+
+ var useApplyAsync = false;
+ /**
+ * @ngdoc method
+ * @name $httpProvider#useApplyAsync
+ * @description
+ *
+ * Configure $http service to combine processing of multiple http responses received at around
+ * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in
+ * significant performance improvement for bigger applications that make many HTTP requests
+ * concurrently (common during application bootstrap).
+ *
+ * Defaults to false. If no value is specified, returns the current configured value.
+ *
+ * @param {boolean=} value If true, when requests are loaded, they will schedule a deferred
+ * "apply" on the next tick, giving time for subsequent requests in a roughly ~10ms window
+ * to load and share the same digest cycle.
+ *
+ * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.
+ * otherwise, returns the current configured value.
+ **/
+ this.useApplyAsync = function(value) {
+ if (isDefined(value)) {
+ useApplyAsync = !!value;
+ return this;
+ }
+ return useApplyAsync;
+ };
+
+ var useLegacyPromise = true;
+ /**
+ * @ngdoc method
+ * @name $httpProvider#useLegacyPromiseExtensions
+ * @description
+ *
+ * Configure `$http` service to return promises without the shorthand methods `success` and `error`.
+ * This should be used to make sure that applications work without these methods.
+ *
+ * Defaults to true. If no value is specified, returns the current configured value.
+ *
+ * @param {boolean=} value If true, `$http` will return a promise with the deprecated legacy `success` and `error` methods.
+ *
+ * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.
+ * otherwise, returns the current configured value.
+ **/
+ this.useLegacyPromiseExtensions = function(value) {
+ if (isDefined(value)) {
+ useLegacyPromise = !!value;
+ return this;
+ }
+ return useLegacyPromise;
+ };
+
+ /**
+ * @ngdoc property
+ * @name $httpProvider#interceptors
+ * @description
+ *
+ * Array containing service factories for all synchronous or asynchronous {@link ng.$http $http}
+ * pre-processing of request or postprocessing of responses.
+ *
+ * These service factories are ordered by request, i.e. they are applied in the same order as the
+ * array, on request, but reverse order, on response.
+ *
+ * {@link ng.$http#interceptors Interceptors detailed info}
+ **/
+ var interceptorFactories = this.interceptors = [];
+
+ this.$get = ['$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector',
+ function($httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector) {
+
+ var defaultCache = $cacheFactory('$http');
+
+ /**
+ * Make sure that default param serializer is exposed as a function
+ */
+ defaults.paramSerializer = isString(defaults.paramSerializer) ?
+ $injector.get(defaults.paramSerializer) : defaults.paramSerializer;
+
+ /**
+ * Interceptors stored in reverse order. Inner interceptors before outer interceptors.
+ * The reversal is needed so that we can build up the interception chain around the
+ * server request.
+ */
+ var reversedInterceptors = [];
+
+ forEach(interceptorFactories, function(interceptorFactory) {
+ reversedInterceptors.unshift(isString(interceptorFactory)
+ ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));
+ });
+
+ /**
+ * @ngdoc service
+ * @kind function
+ * @name $http
+ * @requires ng.$httpBackend
+ * @requires $cacheFactory
+ * @requires $rootScope
+ * @requires $q
+ * @requires $injector
+ *
+ * @description
+ * The `$http` service is a core Angular service that facilitates communication with the remote
+ * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest)
+ * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP).
+ *
+ * For unit testing applications that use `$http` service, see
+ * {@link ngMock.$httpBackend $httpBackend mock}.
+ *
+ * For a higher level of abstraction, please check out the {@link ngResource.$resource
+ * $resource} service.
+ *
+ * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by
+ * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage
+ * it is important to familiarize yourself with these APIs and the guarantees they provide.
+ *
+ *
+ * ## General usage
+ * The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object} —
+ * that is used to generate an HTTP request and returns a {@link ng.$q promise}.
+ *
+ * ```js
+ * // Simple GET request example:
+ * $http({
+ * method: 'GET',
+ * url: '/someUrl'
+ * }).then(function successCallback(response) {
+ * // this callback will be called asynchronously
+ * // when the response is available
+ * }, function errorCallback(response) {
+ * // called asynchronously if an error occurs
+ * // or server returns response with an error status.
+ * });
+ * ```
+ *
+ * The response object has these properties:
+ *
+ * - **data** – `{string|Object}` – The response body transformed with the transform
+ * functions.
+ * - **status** – `{number}` – HTTP status code of the response.
+ * - **headers** – `{function([headerName])}` – Header getter function.
+ * - **config** – `{Object}` – The configuration object that was used to generate the request.
+ * - **statusText** – `{string}` – HTTP status text of the response.
+ *
+ * A response status code between 200 and 299 is considered a success status and
+ * will result in the success callback being called. Note that if the response is a redirect,
+ * XMLHttpRequest will transparently follow it, meaning that the error callback will not be
+ * called for such responses.
+ *
+ *
+ * ## Shortcut methods
+ *
+ * Shortcut methods are also available. All shortcut methods require passing in the URL, and
+ * request data must be passed in for POST/PUT requests. An optional config can be passed as the
+ * last argument.
+ *
+ * ```js
+ * $http.get('/someUrl', config).then(successCallback, errorCallback);
+ * $http.post('/someUrl', data, config).then(successCallback, errorCallback);
+ * ```
+ *
+ * Complete list of shortcut methods:
+ *
+ * - {@link ng.$http#get $http.get}
+ * - {@link ng.$http#head $http.head}
+ * - {@link ng.$http#post $http.post}
+ * - {@link ng.$http#put $http.put}
+ * - {@link ng.$http#delete $http.delete}
+ * - {@link ng.$http#jsonp $http.jsonp}
+ * - {@link ng.$http#patch $http.patch}
+ *
+ *
+ * ## Writing Unit Tests that use $http
+ * When unit testing (using {@link ngMock ngMock}), it is necessary to call
+ * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending
+ * request using trained responses.
+ *
+ * ```
+ * $httpBackend.expectGET(...);
+ * $http.get(...);
+ * $httpBackend.flush();
+ * ```
+ *
+ * ## Deprecation Notice
+ * <div class="alert alert-danger">
+ * The `$http` legacy promise methods `success` and `error` have been deprecated.
+ * Use the standard `then` method instead.
+ * If {@link $httpProvider#useLegacyPromiseExtensions `$httpProvider.useLegacyPromiseExtensions`} is set to
+ * `false` then these methods will throw {@link $http:legacy `$http/legacy`} error.
+ * </div>
+ *
+ * ## Setting HTTP Headers
+ *
+ * The $http service will automatically add certain HTTP headers to all requests. These defaults
+ * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration
+ * object, which currently contains this default configuration:
+ *
+ * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):
+ * - `Accept: application/json, text/plain, * / *`
+ * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)
+ * - `Content-Type: application/json`
+ * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)
+ * - `Content-Type: application/json`
+ *
+ * To add or overwrite these defaults, simply add or remove a property from these configuration
+ * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object
+ * with the lowercased HTTP method name as the key, e.g.
+ * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }`.
+ *
+ * The defaults can also be set at runtime via the `$http.defaults` object in the same
+ * fashion. For example:
+ *
+ * ```
+ * module.run(function($http) {
+ * $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w';
+ * });
+ * ```
+ *
+ * In addition, you can supply a `headers` property in the config object passed when
+ * calling `$http(config)`, which overrides the defaults without changing them globally.
+ *
+ * To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis,
+ * Use the `headers` property, setting the desired header to `undefined`. For example:
+ *
+ * ```js
+ * var req = {
+ * method: 'POST',
+ * url: 'http://example.com',
+ * headers: {
+ * 'Content-Type': undefined
+ * },
+ * data: { test: 'test' }
+ * }
+ *
+ * $http(req).then(function(){...}, function(){...});
+ * ```
+ *
+ * ## Transforming Requests and Responses
+ *
+ * Both requests and responses can be transformed using transformation functions: `transformRequest`
+ * and `transformResponse`. These properties can be a single function that returns
+ * the transformed value (`function(data, headersGetter, status)`) or an array of such transformation functions,
+ * which allows you to `push` or `unshift` a new transformation function into the transformation chain.
+ *
+ * ### Default Transformations
+ *
+ * The `$httpProvider` provider and `$http` service expose `defaults.transformRequest` and
+ * `defaults.transformResponse` properties. If a request does not provide its own transformations
+ * then these will be applied.
+ *
+ * You can augment or replace the default transformations by modifying these properties by adding to or
+ * replacing the array.
+ *
+ * Angular provides the following default transformations:
+ *
+ * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`):
+ *
+ * - If the `data` property of the request configuration object contains an object, serialize it
+ * into JSON format.
+ *
+ * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`):
+ *
+ * - If XSRF prefix is detected, strip it (see Security Considerations section below).
+ * - If JSON response is detected, deserialize it using a JSON parser.
+ *
+ *
+ * ### Overriding the Default Transformations Per Request
+ *
+ * If you wish override the request/response transformations only for a single request then provide
+ * `transformRequest` and/or `transformResponse` properties on the configuration object passed
+ * into `$http`.
+ *
+ * Note that if you provide these properties on the config object the default transformations will be
+ * overwritten. If you wish to augment the default transformations then you must include them in your
+ * local transformation array.
+ *
+ * The following code demonstrates adding a new response transformation to be run after the default response
+ * transformations have been run.
+ *
+ * ```js
+ * function appendTransform(defaults, transform) {
+ *
+ * // We can't guarantee that the default transformation is an array
+ * defaults = angular.isArray(defaults) ? defaults : [defaults];
+ *
+ * // Append the new transformation to the defaults
+ * return defaults.concat(transform);
+ * }
+ *
+ * $http({
+ * url: '...',
+ * method: 'GET',
+ * transformResponse: appendTransform($http.defaults.transformResponse, function(value) {
+ * return doTransform(value);
+ * })
+ * });
+ * ```
+ *
+ *
+ * ## Caching
+ *
+ * To enable caching, set the request configuration `cache` property to `true` (to use default
+ * cache) or to a custom cache object (built with {@link ng.$cacheFactory `$cacheFactory`}).
+ * When the cache is enabled, `$http` stores the response from the server in the specified
+ * cache. The next time the same request is made, the response is served from the cache without
+ * sending a request to the server.
+ *
+ * Note that even if the response is served from cache, delivery of the data is asynchronous in
+ * the same way that real requests are.
+ *
+ * If there are multiple GET requests for the same URL that should be cached using the same
+ * cache, but the cache is not populated yet, only one request to the server will be made and
+ * the remaining requests will be fulfilled using the response from the first request.
+ *
+ * You can change the default cache to a new object (built with
+ * {@link ng.$cacheFactory `$cacheFactory`}) by updating the
+ * {@link ng.$http#defaults `$http.defaults.cache`} property. All requests who set
+ * their `cache` property to `true` will now use this cache object.
+ *
+ * If you set the default cache to `false` then only requests that specify their own custom
+ * cache object will be cached.
+ *
+ * ## Interceptors
+ *
+ * Before you start creating interceptors, be sure to understand the
+ * {@link ng.$q $q and deferred/promise APIs}.
+ *
+ * For purposes of global error handling, authentication, or any kind of synchronous or
+ * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be
+ * able to intercept requests before they are handed to the server and
+ * responses before they are handed over to the application code that
+ * initiated these requests. The interceptors leverage the {@link ng.$q
+ * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing.
+ *
+ * The interceptors are service factories that are registered with the `$httpProvider` by
+ * adding them to the `$httpProvider.interceptors` array. The factory is called and
+ * injected with dependencies (if specified) and returns the interceptor.
+ *
+ * There are two kinds of interceptors (and two kinds of rejection interceptors):
+ *
+ * * `request`: interceptors get called with a http {@link $http#usage config} object. The function is free to
+ * modify the `config` object or create a new one. The function needs to return the `config`
+ * object directly, or a promise containing the `config` or a new `config` object.
+ * * `requestError`: interceptor gets called when a previous interceptor threw an error or
+ * resolved with a rejection.
+ * * `response`: interceptors get called with http `response` object. The function is free to
+ * modify the `response` object or create a new one. The function needs to return the `response`
+ * object directly, or as a promise containing the `response` or a new `response` object.
+ * * `responseError`: interceptor gets called when a previous interceptor threw an error or
+ * resolved with a rejection.
+ *
+ *
+ * ```js
+ * // register the interceptor as a service
+ * $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
+ * return {
+ * // optional method
+ * 'request': function(config) {
+ * // do something on success
+ * return config;
+ * },
+ *
+ * // optional method
+ * 'requestError': function(rejection) {
+ * // do something on error
+ * if (canRecover(rejection)) {
+ * return responseOrNewPromise
+ * }
+ * return $q.reject(rejection);
+ * },
+ *
+ *
+ *
+ * // optional method
+ * 'response': function(response) {
+ * // do something on success
+ * return response;
+ * },
+ *
+ * // optional method
+ * 'responseError': function(rejection) {
+ * // do something on error
+ * if (canRecover(rejection)) {
+ * return responseOrNewPromise
+ * }
+ * return $q.reject(rejection);
+ * }
+ * };
+ * });
+ *
+ * $httpProvider.interceptors.push('myHttpInterceptor');
+ *
+ *
+ * // alternatively, register the interceptor via an anonymous factory
+ * $httpProvider.interceptors.push(function($q, dependency1, dependency2) {
+ * return {
+ * 'request': function(config) {
+ * // same as above
+ * },
+ *
+ * 'response': function(response) {
+ * // same as above
+ * }
+ * };
+ * });
+ * ```
+ *
+ * ## Security Considerations
+ *
+ * When designing web applications, consider security threats from:
+ *
+ * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)
+ * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
+ *
+ * Both server and the client must cooperate in order to eliminate these threats. Angular comes
+ * pre-configured with strategies that address these issues, but for this to work backend server
+ * cooperation is required.
+ *
+ * ### JSON Vulnerability Protection
+ *
+ * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)
+ * allows third party website to turn your JSON resource URL into
+ * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To
+ * counter this your server can prefix all JSON requests with following string `")]}',\n"`.
+ * Angular will automatically strip the prefix before processing it as JSON.
+ *
+ * For example if your server needs to return:
+ * ```js
+ * ['one','two']
+ * ```
+ *
+ * which is vulnerable to attack, your server can return:
+ * ```js
+ * )]}',
+ * ['one','two']
+ * ```
+ *
+ * Angular will strip the prefix, before processing the JSON.
+ *
+ *
+ * ### Cross Site Request Forgery (XSRF) Protection
+ *
+ * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by
+ * which the attacker can trick an authenticated user into unknowingly executing actions on your
+ * website. Angular provides a mechanism to counter XSRF. When performing XHR requests, the
+ * $http service reads a token from a cookie (by default, `XSRF-TOKEN`) and sets it as an HTTP
+ * header (`X-XSRF-TOKEN`). Since only JavaScript that runs on your domain could read the
+ * cookie, your server can be assured that the XHR came from JavaScript running on your domain.
+ * The header will not be set for cross-domain requests.
+ *
+ * To take advantage of this, your server needs to set a token in a JavaScript readable session
+ * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the
+ * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure
+ * that only JavaScript running on your domain could have sent the request. The token must be
+ * unique for each user and must be verifiable by the server (to prevent the JavaScript from
+ * making up its own tokens). We recommend that the token is a digest of your site's
+ * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography&#41;)
+ * for added security.
+ *
+ * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName
+ * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,
+ * or the per-request config object.
+ *
+ * In order to prevent collisions in environments where multiple Angular apps share the
+ * same domain or subdomain, we recommend that each application uses unique cookie name.
+ *
+ * @param {object} config Object describing the request to be made and how it should be
+ * processed. The object has following properties:
+ *
+ * - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)
+ * - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.
+ * - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be serialized
+ * with the `paramSerializer` and appended as GET parameters.
+ * - **data** – `{string|Object}` – Data to be sent as the request message data.
+ * - **headers** – `{Object}` – Map of strings or functions which return strings representing
+ * HTTP headers to send to the server. If the return value of a function is null, the
+ * header will not be sent. Functions accept a config object as an argument.
+ * - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token.
+ * - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token.
+ * - **transformRequest** –
+ * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
+ * transform function or an array of such functions. The transform function takes the http
+ * request body and headers and returns its transformed (typically serialized) version.
+ * See {@link ng.$http#overriding-the-default-transformations-per-request
+ * Overriding the Default Transformations}
+ * - **transformResponse** –
+ * `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` –
+ * transform function or an array of such functions. The transform function takes the http
+ * response body, headers and status and returns its transformed (typically deserialized) version.
+ * See {@link ng.$http#overriding-the-default-transformations-per-request
+ * Overriding the Default TransformationjqLiks}
+ * - **paramSerializer** - `{string|function(Object<string,string>):string}` - A function used to
+ * prepare the string representation of request parameters (specified as an object).
+ * If specified as string, it is interpreted as function registered with the
+ * {@link $injector $injector}, which means you can create your own serializer
+ * by registering it as a {@link auto.$provide#service service}.
+ * The default serializer is the {@link $httpParamSerializer $httpParamSerializer};
+ * alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike}
+ * - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
+ * GET request, otherwise if a cache instance built with
+ * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
+ * caching.
+ * - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}
+ * that should abort the request when resolved.
+ * - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the
+ * XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials)
+ * for more information.
+ * - **responseType** - `{string}` - see
+ * [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype).
+ *
+ * @returns {HttpPromise} Returns a {@link ng.$q `Promise}` that will be resolved to a response object
+ * when the request succeeds or fails.
+ *
+ *
+ * @property {Array.<Object>} pendingRequests Array of config objects for currently pending
+ * requests. This is primarily meant to be used for debugging purposes.
+ *
+ *
+ * @example
+<example module="httpExample">
+<file name="index.html">
+ <div ng-controller="FetchController">
+ <select ng-model="method" aria-label="Request method">
+ <option>GET</option>
+ <option>JSONP</option>
+ </select>
+ <input type="text" ng-model="url" size="80" aria-label="URL" />
+ <button id="fetchbtn" ng-click="fetch()">fetch</button><br>
+ <button id="samplegetbtn" ng-click="updateModel('GET', 'http-hello.html')">Sample GET</button>
+ <button id="samplejsonpbtn"
+ ng-click="updateModel('JSONP',
+ 'https://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">
+ Sample JSONP
+ </button>
+ <button id="invalidjsonpbtn"
+ ng-click="updateModel('JSONP', 'https://angularjs.org/doesntexist&callback=JSON_CALLBACK')">
+ Invalid JSONP
+ </button>
+ <pre>http status code: {{status}}</pre>
+ <pre>http response data: {{data}}</pre>
+ </div>
+</file>
+<file name="script.js">
+ angular.module('httpExample', [])
+ .controller('FetchController', ['$scope', '$http', '$templateCache',
+ function($scope, $http, $templateCache) {
+ $scope.method = 'GET';
+ $scope.url = 'http-hello.html';
+
+ $scope.fetch = function() {
+ $scope.code = null;
+ $scope.response = null;
+
+ $http({method: $scope.method, url: $scope.url, cache: $templateCache}).
+ then(function(response) {
+ $scope.status = response.status;
+ $scope.data = response.data;
+ }, function(response) {
+ $scope.data = response.data || "Request failed";
+ $scope.status = response.status;
+ });
+ };
+
+ $scope.updateModel = function(method, url) {
+ $scope.method = method;
+ $scope.url = url;
+ };
+ }]);
+</file>
+<file name="http-hello.html">
+ Hello, $http!
+</file>
+<file name="protractor.js" type="protractor">
+ var status = element(by.binding('status'));
+ var data = element(by.binding('data'));
+ var fetchBtn = element(by.id('fetchbtn'));
+ var sampleGetBtn = element(by.id('samplegetbtn'));
+ var sampleJsonpBtn = element(by.id('samplejsonpbtn'));
+ var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));
+
+ it('should make an xhr GET request', function() {
+ sampleGetBtn.click();
+ fetchBtn.click();
+ expect(status.getText()).toMatch('200');
+ expect(data.getText()).toMatch(/Hello, \$http!/);
+ });
+
+// Commented out due to flakes. See https://github.com/angular/angular.js/issues/9185
+// it('should make a JSONP request to angularjs.org', function() {
+// sampleJsonpBtn.click();
+// fetchBtn.click();
+// expect(status.getText()).toMatch('200');
+// expect(data.getText()).toMatch(/Super Hero!/);
+// });
+
+ it('should make JSONP request to invalid URL and invoke the error handler',
+ function() {
+ invalidJsonpBtn.click();
+ fetchBtn.click();
+ expect(status.getText()).toMatch('0');
+ expect(data.getText()).toMatch('Request failed');
+ });
+</file>
+</example>
+ */
+ function $http(requestConfig) {
+
+ if (!isObject(requestConfig)) {
+ throw minErr('$http')('badreq', 'Http request configuration must be an object. Received: {0}', requestConfig);
+ }
+
+ if (!isString(requestConfig.url)) {
+ throw minErr('$http')('badreq', 'Http request configuration url must be a string. Received: {0}', requestConfig.url);
+ }
+
+ var config = extend({
+ method: 'get',
+ transformRequest: defaults.transformRequest,
+ transformResponse: defaults.transformResponse,
+ paramSerializer: defaults.paramSerializer
+ }, requestConfig);
+
+ config.headers = mergeHeaders(requestConfig);
+ config.method = uppercase(config.method);
+ config.paramSerializer = isString(config.paramSerializer) ?
+ $injector.get(config.paramSerializer) : config.paramSerializer;
+
+ var serverRequest = function(config) {
+ var headers = config.headers;
+ var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest);
+
+ // strip content-type if data is undefined
+ if (isUndefined(reqData)) {
+ forEach(headers, function(value, header) {
+ if (lowercase(header) === 'content-type') {
+ delete headers[header];
+ }
+ });
+ }
+
+ if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {
+ config.withCredentials = defaults.withCredentials;
+ }
+
+ // send request
+ return sendReq(config, reqData).then(transformResponse, transformResponse);
+ };
+
+ var chain = [serverRequest, undefined];
+ var promise = $q.when(config);
+
+ // apply interceptors
+ forEach(reversedInterceptors, function(interceptor) {
+ if (interceptor.request || interceptor.requestError) {
+ chain.unshift(interceptor.request, interceptor.requestError);
+ }
+ if (interceptor.response || interceptor.responseError) {
+ chain.push(interceptor.response, interceptor.responseError);
+ }
+ });
+
+ while (chain.length) {
+ var thenFn = chain.shift();
+ var rejectFn = chain.shift();
+
+ promise = promise.then(thenFn, rejectFn);
+ }
+
+ if (useLegacyPromise) {
+ promise.success = function(fn) {
+ assertArgFn(fn, 'fn');
+
+ promise.then(function(response) {
+ fn(response.data, response.status, response.headers, config);
+ });
+ return promise;
+ };
+
+ promise.error = function(fn) {
+ assertArgFn(fn, 'fn');
+
+ promise.then(null, function(response) {
+ fn(response.data, response.status, response.headers, config);
+ });
+ return promise;
+ };
+ } else {
+ promise.success = $httpMinErrLegacyFn('success');
+ promise.error = $httpMinErrLegacyFn('error');
+ }
+
+ return promise;
+
+ function transformResponse(response) {
+ // make a copy since the response must be cacheable
+ var resp = extend({}, response);
+ resp.data = transformData(response.data, response.headers, response.status,
+ config.transformResponse);
+ return (isSuccess(response.status))
+ ? resp
+ : $q.reject(resp);
+ }
+
+ function executeHeaderFns(headers, config) {
+ var headerContent, processedHeaders = {};
+
+ forEach(headers, function(headerFn, header) {
+ if (isFunction(headerFn)) {
+ headerContent = headerFn(config);
+ if (headerContent != null) {
+ processedHeaders[header] = headerContent;
+ }
+ } else {
+ processedHeaders[header] = headerFn;
+ }
+ });
+
+ return processedHeaders;
+ }
+
+ function mergeHeaders(config) {
+ var defHeaders = defaults.headers,
+ reqHeaders = extend({}, config.headers),
+ defHeaderName, lowercaseDefHeaderName, reqHeaderName;
+
+ defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);
+
+ // using for-in instead of forEach to avoid unnecessary iteration after header has been found
+ defaultHeadersIteration:
+ for (defHeaderName in defHeaders) {
+ lowercaseDefHeaderName = lowercase(defHeaderName);
+
+ for (reqHeaderName in reqHeaders) {
+ if (lowercase(reqHeaderName) === lowercaseDefHeaderName) {
+ continue defaultHeadersIteration;
+ }
+ }
+
+ reqHeaders[defHeaderName] = defHeaders[defHeaderName];
+ }
+
+ // execute if header value is a function for merged headers
+ return executeHeaderFns(reqHeaders, shallowCopy(config));
+ }
+ }
+
+ $http.pendingRequests = [];
+
+ /**
+ * @ngdoc method
+ * @name $http#get
+ *
+ * @description
+ * Shortcut method to perform `GET` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#delete
+ *
+ * @description
+ * Shortcut method to perform `DELETE` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#head
+ *
+ * @description
+ * Shortcut method to perform `HEAD` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#jsonp
+ *
+ * @description
+ * Shortcut method to perform `JSONP` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request.
+ * The name of the callback should be the string `JSON_CALLBACK`.
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+ createShortMethods('get', 'delete', 'head', 'jsonp');
+
+ /**
+ * @ngdoc method
+ * @name $http#post
+ *
+ * @description
+ * Shortcut method to perform `POST` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {*} data Request content
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#put
+ *
+ * @description
+ * Shortcut method to perform `PUT` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {*} data Request content
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#patch
+ *
+ * @description
+ * Shortcut method to perform `PATCH` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {*} data Request content
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+ createShortMethodsWithData('post', 'put', 'patch');
+
+ /**
+ * @ngdoc property
+ * @name $http#defaults
+ *
+ * @description
+ * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of
+ * default headers, withCredentials as well as request and response transformations.
+ *
+ * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above.
+ */
+ $http.defaults = defaults;
+
+
+ return $http;
+
+
+ function createShortMethods(names) {
+ forEach(arguments, function(name) {
+ $http[name] = function(url, config) {
+ return $http(extend({}, config || {}, {
+ method: name,
+ url: url
+ }));
+ };
+ });
+ }
+
+
+ function createShortMethodsWithData(name) {
+ forEach(arguments, function(name) {
+ $http[name] = function(url, data, config) {
+ return $http(extend({}, config || {}, {
+ method: name,
+ url: url,
+ data: data
+ }));
+ };
+ });
+ }
+
+
+ /**
+ * Makes the request.
+ *
+ * !!! ACCESSES CLOSURE VARS:
+ * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests
+ */
+ function sendReq(config, reqData) {
+ var deferred = $q.defer(),
+ promise = deferred.promise,
+ cache,
+ cachedResp,
+ reqHeaders = config.headers,
+ url = buildUrl(config.url, config.paramSerializer(config.params));
+
+ $http.pendingRequests.push(config);
+ promise.then(removePendingReq, removePendingReq);
+
+
+ if ((config.cache || defaults.cache) && config.cache !== false &&
+ (config.method === 'GET' || config.method === 'JSONP')) {
+ cache = isObject(config.cache) ? config.cache
+ : isObject(defaults.cache) ? defaults.cache
+ : defaultCache;
+ }
+
+ if (cache) {
+ cachedResp = cache.get(url);
+ if (isDefined(cachedResp)) {
+ if (isPromiseLike(cachedResp)) {
+ // cached request has already been sent, but there is no response yet
+ cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult);
+ } else {
+ // serving from cache
+ if (isArray(cachedResp)) {
+ resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);
+ } else {
+ resolvePromise(cachedResp, 200, {}, 'OK');
+ }
+ }
+ } else {
+ // put the promise for the non-transformed response into cache as a placeholder
+ cache.put(url, promise);
+ }
+ }
+
+
+ // if we won't have the response in cache, set the xsrf headers and
+ // send the request to the backend
+ if (isUndefined(cachedResp)) {
+ var xsrfValue = urlIsSameOrigin(config.url)
+ ? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName]
+ : undefined;
+ if (xsrfValue) {
+ reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;
+ }
+
+ $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,
+ config.withCredentials, config.responseType);
+ }
+
+ return promise;
+
+
+ /**
+ * Callback registered to $httpBackend():
+ * - caches the response if desired
+ * - resolves the raw $http promise
+ * - calls $apply
+ */
+ function done(status, response, headersString, statusText) {
+ if (cache) {
+ if (isSuccess(status)) {
+ cache.put(url, [status, response, parseHeaders(headersString), statusText]);
+ } else {
+ // remove promise from the cache
+ cache.remove(url);
+ }
+ }
+
+ function resolveHttpPromise() {
+ resolvePromise(response, status, headersString, statusText);
+ }
+
+ if (useApplyAsync) {
+ $rootScope.$applyAsync(resolveHttpPromise);
+ } else {
+ resolveHttpPromise();
+ if (!$rootScope.$$phase) $rootScope.$apply();
+ }
+ }
+
+
+ /**
+ * Resolves the raw $http promise.
+ */
+ function resolvePromise(response, status, headers, statusText) {
+ //status: HTTP response status code, 0, -1 (aborted by timeout / promise)
+ status = status >= -1 ? status : 0;
+
+ (isSuccess(status) ? deferred.resolve : deferred.reject)({
+ data: response,
+ status: status,
+ headers: headersGetter(headers),
+ config: config,
+ statusText: statusText
+ });
+ }
+
+ function resolvePromiseWithResult(result) {
+ resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText);
+ }
+
+ function removePendingReq() {
+ var idx = $http.pendingRequests.indexOf(config);
+ if (idx !== -1) $http.pendingRequests.splice(idx, 1);
+ }
+ }
+
+
+ function buildUrl(url, serializedParams) {
+ if (serializedParams.length > 0) {
+ url += ((url.indexOf('?') == -1) ? '?' : '&') + serializedParams;
+ }
+ return url;
+ }
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $xhrFactory
+ *
+ * @description
+ * Factory function used to create XMLHttpRequest objects.
+ *
+ * Replace or decorate this service to create your own custom XMLHttpRequest objects.
+ *
+ * ```
+ * angular.module('myApp', [])
+ * .factory('$xhrFactory', function() {
+ * return function createXhr(method, url) {
+ * return new window.XMLHttpRequest({mozSystem: true});
+ * };
+ * });
+ * ```
+ *
+ * @param {string} method HTTP method of the request (GET, POST, PUT, ..)
+ * @param {string} url URL of the request.
+ */
+function $xhrFactoryProvider() {
+ this.$get = function() {
+ return function createXhr() {
+ return new window.XMLHttpRequest();
+ };
+ };
+}
+
+/**
+ * @ngdoc service
+ * @name $httpBackend
+ * @requires $window
+ * @requires $document
+ * @requires $xhrFactory
+ *
+ * @description
+ * HTTP backend used by the {@link ng.$http service} that delegates to
+ * XMLHttpRequest object or JSONP and deals with browser incompatibilities.
+ *
+ * You should never need to use this service directly, instead use the higher-level abstractions:
+ * {@link ng.$http $http} or {@link ngResource.$resource $resource}.
+ *
+ * During testing this implementation is swapped with {@link ngMock.$httpBackend mock
+ * $httpBackend} which can be trained with responses.
+ */
+function $HttpBackendProvider() {
+ this.$get = ['$browser', '$window', '$document', '$xhrFactory', function($browser, $window, $document, $xhrFactory) {
+ return createHttpBackend($browser, $xhrFactory, $browser.defer, $window.angular.callbacks, $document[0]);
+ }];
+}
+
+function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {
+ // TODO(vojta): fix the signature
+ return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {
+ $browser.$$incOutstandingRequestCount();
+ url = url || $browser.url();
+
+ if (lowercase(method) == 'jsonp') {
+ var callbackId = '_' + (callbacks.counter++).toString(36);
+ callbacks[callbackId] = function(data) {
+ callbacks[callbackId].data = data;
+ callbacks[callbackId].called = true;
+ };
+
+ var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),
+ callbackId, function(status, text) {
+ completeRequest(callback, status, callbacks[callbackId].data, "", text);
+ callbacks[callbackId] = noop;
+ });
+ } else {
+
+ var xhr = createXhr(method, url);
+
+ xhr.open(method, url, true);
+ forEach(headers, function(value, key) {
+ if (isDefined(value)) {
+ xhr.setRequestHeader(key, value);
+ }
+ });
+
+ xhr.onload = function requestLoaded() {
+ var statusText = xhr.statusText || '';
+
+ // responseText is the old-school way of retrieving response (supported by IE9)
+ // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)
+ var response = ('response' in xhr) ? xhr.response : xhr.responseText;
+
+ // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
+ var status = xhr.status === 1223 ? 204 : xhr.status;
+
+ // fix status code when it is 0 (0 status is undocumented).
+ // Occurs when accessing file resources or on Android 4.1 stock browser
+ // while retrieving files from application cache.
+ if (status === 0) {
+ status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;
+ }
+
+ completeRequest(callback,
+ status,
+ response,
+ xhr.getAllResponseHeaders(),
+ statusText);
+ };
+
+ var requestError = function() {
+ // The response is always empty
+ // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error
+ completeRequest(callback, -1, null, null, '');
+ };
+
+ xhr.onerror = requestError;
+ xhr.onabort = requestError;
+
+ if (withCredentials) {
+ xhr.withCredentials = true;
+ }
+
+ if (responseType) {
+ try {
+ xhr.responseType = responseType;
+ } catch (e) {
+ // WebKit added support for the json responseType value on 09/03/2013
+ // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are
+ // known to throw when setting the value "json" as the response type. Other older
+ // browsers implementing the responseType
+ //
+ // The json response type can be ignored if not supported, because JSON payloads are
+ // parsed on the client-side regardless.
+ if (responseType !== 'json') {
+ throw e;
+ }
+ }
+ }
+
+ xhr.send(isUndefined(post) ? null : post);
+ }
+
+ if (timeout > 0) {
+ var timeoutId = $browserDefer(timeoutRequest, timeout);
+ } else if (isPromiseLike(timeout)) {
+ timeout.then(timeoutRequest);
+ }
+
+
+ function timeoutRequest() {
+ jsonpDone && jsonpDone();
+ xhr && xhr.abort();
+ }
+
+ function completeRequest(callback, status, response, headersString, statusText) {
+ // cancel timeout and subsequent timeout promise resolution
+ if (isDefined(timeoutId)) {
+ $browserDefer.cancel(timeoutId);
+ }
+ jsonpDone = xhr = null;
+
+ callback(status, response, headersString, statusText);
+ $browser.$$completeOutstandingRequest(noop);
+ }
+ };
+
+ function jsonpReq(url, callbackId, done) {
+ // we can't use jQuery/jqLite here because jQuery does crazy stuff with script elements, e.g.:
+ // - fetches local scripts via XHR and evals them
+ // - adds and immediately removes script elements from the document
+ var script = rawDocument.createElement('script'), callback = null;
+ script.type = "text/javascript";
+ script.src = url;
+ script.async = true;
+
+ callback = function(event) {
+ removeEventListenerFn(script, "load", callback);
+ removeEventListenerFn(script, "error", callback);
+ rawDocument.body.removeChild(script);
+ script = null;
+ var status = -1;
+ var text = "unknown";
+
+ if (event) {
+ if (event.type === "load" && !callbacks[callbackId].called) {
+ event = { type: "error" };
+ }
+ text = event.type;
+ status = event.type === "error" ? 404 : 200;
+ }
+
+ if (done) {
+ done(status, text);
+ }
+ };
+
+ addEventListenerFn(script, "load", callback);
+ addEventListenerFn(script, "error", callback);
+ rawDocument.body.appendChild(script);
+ return callback;
+ }
+}
+
+var $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate');
+$interpolateMinErr.throwNoconcat = function(text) {
+ throw $interpolateMinErr('noconcat',
+ "Error while interpolating: {0}\nStrict Contextual Escaping disallows " +
+ "interpolations that concatenate multiple expressions when a trusted value is " +
+ "required. See http://docs.angularjs.org/api/ng.$sce", text);
+};
+
+$interpolateMinErr.interr = function(text, err) {
+ return $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text, err.toString());
+};
+
+/**
+ * @ngdoc provider
+ * @name $interpolateProvider
+ *
+ * @description
+ *
+ * Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
+ *
+ * <div class="alert alert-danger">
+ * This feature is sometimes used to mix different markup languages, e.g. to wrap an Angular
+ * template within a Python Jinja template (or any other template language). Mixing templating
+ * languages is **very dangerous**. The embedding template language will not safely escape Angular
+ * expressions, so any user-controlled values in the template will cause Cross Site Scripting (XSS)
+ * security bugs!
+ * </div>
+ *
+ * @example
+<example name="custom-interpolation-markup" module="customInterpolationApp">
+<file name="index.html">
+<script>
+ var customInterpolationApp = angular.module('customInterpolationApp', []);
+
+ customInterpolationApp.config(function($interpolateProvider) {
+ $interpolateProvider.startSymbol('//');
+ $interpolateProvider.endSymbol('//');
+ });
+
+
+ customInterpolationApp.controller('DemoController', function() {
+ this.label = "This binding is brought you by // interpolation symbols.";
+ });
+</script>
+<div ng-controller="DemoController as demo">
+ //demo.label//
+</div>
+</file>
+<file name="protractor.js" type="protractor">
+ it('should interpolate binding with custom symbols', function() {
+ expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.');
+ });
+</file>
+</example>
+ */
+function $InterpolateProvider() {
+ var startSymbol = '{{';
+ var endSymbol = '}}';
+
+ /**
+ * @ngdoc method
+ * @name $interpolateProvider#startSymbol
+ * @description
+ * Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
+ *
+ * @param {string=} value new value to set the starting symbol to.
+ * @returns {string|self} Returns the symbol when used as getter and self if used as setter.
+ */
+ this.startSymbol = function(value) {
+ if (value) {
+ startSymbol = value;
+ return this;
+ } else {
+ return startSymbol;
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $interpolateProvider#endSymbol
+ * @description
+ * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
+ *
+ * @param {string=} value new value to set the ending symbol to.
+ * @returns {string|self} Returns the symbol when used as getter and self if used as setter.
+ */
+ this.endSymbol = function(value) {
+ if (value) {
+ endSymbol = value;
+ return this;
+ } else {
+ return endSymbol;
+ }
+ };
+
+
+ this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {
+ var startSymbolLength = startSymbol.length,
+ endSymbolLength = endSymbol.length,
+ escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'),
+ escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g');
+
+ function escape(ch) {
+ return '\\\\\\' + ch;
+ }
+
+ function unescapeText(text) {
+ return text.replace(escapedStartRegexp, startSymbol).
+ replace(escapedEndRegexp, endSymbol);
+ }
+
+ function stringify(value) {
+ if (value == null) { // null || undefined
+ return '';
+ }
+ switch (typeof value) {
+ case 'string':
+ break;
+ case 'number':
+ value = '' + value;
+ break;
+ default:
+ value = toJson(value);
+ }
+
+ return value;
+ }
+
+ //TODO: this is the same as the constantWatchDelegate in parse.js
+ function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {
+ var unwatch;
+ return unwatch = scope.$watch(function constantInterpolateWatch(scope) {
+ unwatch();
+ return constantInterp(scope);
+ }, listener, objectEquality);
+ }
+
+ /**
+ * @ngdoc service
+ * @name $interpolate
+ * @kind function
+ *
+ * @requires $parse
+ * @requires $sce
+ *
+ * @description
+ *
+ * Compiles a string with markup into an interpolation function. This service is used by the
+ * HTML {@link ng.$compile $compile} service for data binding. See
+ * {@link ng.$interpolateProvider $interpolateProvider} for configuring the
+ * interpolation markup.
+ *
+ *
+ * ```js
+ * var $interpolate = ...; // injected
+ * var exp = $interpolate('Hello {{name | uppercase}}!');
+ * expect(exp({name:'Angular'})).toEqual('Hello ANGULAR!');
+ * ```
+ *
+ * `$interpolate` takes an optional fourth argument, `allOrNothing`. If `allOrNothing` is
+ * `true`, the interpolation function will return `undefined` unless all embedded expressions
+ * evaluate to a value other than `undefined`.
+ *
+ * ```js
+ * var $interpolate = ...; // injected
+ * var context = {greeting: 'Hello', name: undefined };
+ *
+ * // default "forgiving" mode
+ * var exp = $interpolate('{{greeting}} {{name}}!');
+ * expect(exp(context)).toEqual('Hello !');
+ *
+ * // "allOrNothing" mode
+ * exp = $interpolate('{{greeting}} {{name}}!', false, null, true);
+ * expect(exp(context)).toBeUndefined();
+ * context.name = 'Angular';
+ * expect(exp(context)).toEqual('Hello Angular!');
+ * ```
+ *
+ * `allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior.
+ *
+ * ####Escaped Interpolation
+ * $interpolate provides a mechanism for escaping interpolation markers. Start and end markers
+ * can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash).
+ * It will be rendered as a regular start/end marker, and will not be interpreted as an expression
+ * or binding.
+ *
+ * This enables web-servers to prevent script injection attacks and defacing attacks, to some
+ * degree, while also enabling code examples to work without relying on the
+ * {@link ng.directive:ngNonBindable ngNonBindable} directive.
+ *
+ * **For security purposes, it is strongly encouraged that web servers escape user-supplied data,
+ * replacing angle brackets (&lt;, &gt;) with &amp;lt; and &amp;gt; respectively, and replacing all
+ * interpolation start/end markers with their escaped counterparts.**
+ *
+ * Escaped interpolation markers are only replaced with the actual interpolation markers in rendered
+ * output when the $interpolate service processes the text. So, for HTML elements interpolated
+ * by {@link ng.$compile $compile}, or otherwise interpolated with the `mustHaveExpression` parameter
+ * set to `true`, the interpolated text must contain an unescaped interpolation expression. As such,
+ * this is typically useful only when user-data is used in rendering a template from the server, or
+ * when otherwise untrusted data is used by a directive.
+ *
+ * <example>
+ * <file name="index.html">
+ * <div ng-init="username='A user'">
+ * <p ng-init="apptitle='Escaping demo'">{{apptitle}}: \{\{ username = "defaced value"; \}\}
+ * </p>
+ * <p><strong>{{username}}</strong> attempts to inject code which will deface the
+ * application, but fails to accomplish their task, because the server has correctly
+ * escaped the interpolation start/end markers with REVERSE SOLIDUS U+005C (backslash)
+ * characters.</p>
+ * <p>Instead, the result of the attempted script injection is visible, and can be removed
+ * from the database by an administrator.</p>
+ * </div>
+ * </file>
+ * </example>
+ *
+ * @param {string} text The text with markup to interpolate.
+ * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have
+ * embedded expression in order to return an interpolation function. Strings with no
+ * embedded expression will return null for the interpolation function.
+ * @param {string=} trustedContext when provided, the returned function passes the interpolated
+ * result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult,
+ * trustedContext)} before returning it. Refer to the {@link ng.$sce $sce} service that
+ * provides Strict Contextual Escaping for details.
+ * @param {boolean=} allOrNothing if `true`, then the returned function returns undefined
+ * unless all embedded expressions evaluate to a value other than `undefined`.
+ * @returns {function(context)} an interpolation function which is used to compute the
+ * interpolated string. The function has these parameters:
+ *
+ * - `context`: evaluation context for all expressions embedded in the interpolated text
+ */
+ function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {
+ // Provide a quick exit and simplified result function for text with no interpolation
+ if (!text.length || text.indexOf(startSymbol) === -1) {
+ var constantInterp;
+ if (!mustHaveExpression) {
+ var unescapedText = unescapeText(text);
+ constantInterp = valueFn(unescapedText);
+ constantInterp.exp = text;
+ constantInterp.expressions = [];
+ constantInterp.$$watchDelegate = constantWatchDelegate;
+ }
+ return constantInterp;
+ }
+
+ allOrNothing = !!allOrNothing;
+ var startIndex,
+ endIndex,
+ index = 0,
+ expressions = [],
+ parseFns = [],
+ textLength = text.length,
+ exp,
+ concat = [],
+ expressionPositions = [];
+
+ while (index < textLength) {
+ if (((startIndex = text.indexOf(startSymbol, index)) != -1) &&
+ ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1)) {
+ if (index !== startIndex) {
+ concat.push(unescapeText(text.substring(index, startIndex)));
+ }
+ exp = text.substring(startIndex + startSymbolLength, endIndex);
+ expressions.push(exp);
+ parseFns.push($parse(exp, parseStringifyInterceptor));
+ index = endIndex + endSymbolLength;
+ expressionPositions.push(concat.length);
+ concat.push('');
+ } else {
+ // we did not find an interpolation, so we have to add the remainder to the separators array
+ if (index !== textLength) {
+ concat.push(unescapeText(text.substring(index)));
+ }
+ break;
+ }
+ }
+
+ // Concatenating expressions makes it hard to reason about whether some combination of
+ // concatenated values are unsafe to use and could easily lead to XSS. By requiring that a
+ // single expression be used for iframe[src], object[src], etc., we ensure that the value
+ // that's used is assigned or constructed by some JS code somewhere that is more testable or
+ // make it obvious that you bound the value to some user controlled value. This helps reduce
+ // the load when auditing for XSS issues.
+ if (trustedContext && concat.length > 1) {
+ $interpolateMinErr.throwNoconcat(text);
+ }
+
+ if (!mustHaveExpression || expressions.length) {
+ var compute = function(values) {
+ for (var i = 0, ii = expressions.length; i < ii; i++) {
+ if (allOrNothing && isUndefined(values[i])) return;
+ concat[expressionPositions[i]] = values[i];
+ }
+ return concat.join('');
+ };
+
+ var getValue = function(value) {
+ return trustedContext ?
+ $sce.getTrusted(trustedContext, value) :
+ $sce.valueOf(value);
+ };
+
+ return extend(function interpolationFn(context) {
+ var i = 0;
+ var ii = expressions.length;
+ var values = new Array(ii);
+
+ try {
+ for (; i < ii; i++) {
+ values[i] = parseFns[i](context);
+ }
+
+ return compute(values);
+ } catch (err) {
+ $exceptionHandler($interpolateMinErr.interr(text, err));
+ }
+
+ }, {
+ // all of these properties are undocumented for now
+ exp: text, //just for compatibility with regular watchers created via $watch
+ expressions: expressions,
+ $$watchDelegate: function(scope, listener) {
+ var lastValue;
+ return scope.$watchGroup(parseFns, function interpolateFnWatcher(values, oldValues) {
+ var currValue = compute(values);
+ if (isFunction(listener)) {
+ listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope);
+ }
+ lastValue = currValue;
+ });
+ }
+ });
+ }
+
+ function parseStringifyInterceptor(value) {
+ try {
+ value = getValue(value);
+ return allOrNothing && !isDefined(value) ? value : stringify(value);
+ } catch (err) {
+ $exceptionHandler($interpolateMinErr.interr(text, err));
+ }
+ }
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $interpolate#startSymbol
+ * @description
+ * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
+ *
+ * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change
+ * the symbol.
+ *
+ * @returns {string} start symbol.
+ */
+ $interpolate.startSymbol = function() {
+ return startSymbol;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $interpolate#endSymbol
+ * @description
+ * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
+ *
+ * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change
+ * the symbol.
+ *
+ * @returns {string} end symbol.
+ */
+ $interpolate.endSymbol = function() {
+ return endSymbol;
+ };
+
+ return $interpolate;
+ }];
+}
+
+function $IntervalProvider() {
+ this.$get = ['$rootScope', '$window', '$q', '$$q', '$browser',
+ function($rootScope, $window, $q, $$q, $browser) {
+ var intervals = {};
+
+
+ /**
+ * @ngdoc service
+ * @name $interval
+ *
+ * @description
+ * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay`
+ * milliseconds.
+ *
+ * The return value of registering an interval function is a promise. This promise will be
+ * notified upon each tick of the interval, and will be resolved after `count` iterations, or
+ * run indefinitely if `count` is not defined. The value of the notification will be the
+ * number of iterations that have run.
+ * To cancel an interval, call `$interval.cancel(promise)`.
+ *
+ * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to
+ * move forward by `millis` milliseconds and trigger any functions scheduled to run in that
+ * time.
+ *
+ * <div class="alert alert-warning">
+ * **Note**: Intervals created by this service must be explicitly destroyed when you are finished
+ * with them. In particular they are not automatically destroyed when a controller's scope or a
+ * directive's element are destroyed.
+ * You should take this into consideration and make sure to always cancel the interval at the
+ * appropriate moment. See the example below for more details on how and when to do this.
+ * </div>
+ *
+ * @param {function()} fn A function that should be called repeatedly.
+ * @param {number} delay Number of milliseconds between each function call.
+ * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat
+ * indefinitely.
+ * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
+ * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
+ * @param {...*=} Pass additional parameters to the executed function.
+ * @returns {promise} A promise which will be notified on each iteration.
+ *
+ * @example
+ * <example module="intervalExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('intervalExample', [])
+ * .controller('ExampleController', ['$scope', '$interval',
+ * function($scope, $interval) {
+ * $scope.format = 'M/d/yy h:mm:ss a';
+ * $scope.blood_1 = 100;
+ * $scope.blood_2 = 120;
+ *
+ * var stop;
+ * $scope.fight = function() {
+ * // Don't start a new fight if we are already fighting
+ * if ( angular.isDefined(stop) ) return;
+ *
+ * stop = $interval(function() {
+ * if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {
+ * $scope.blood_1 = $scope.blood_1 - 3;
+ * $scope.blood_2 = $scope.blood_2 - 4;
+ * } else {
+ * $scope.stopFight();
+ * }
+ * }, 100);
+ * };
+ *
+ * $scope.stopFight = function() {
+ * if (angular.isDefined(stop)) {
+ * $interval.cancel(stop);
+ * stop = undefined;
+ * }
+ * };
+ *
+ * $scope.resetFight = function() {
+ * $scope.blood_1 = 100;
+ * $scope.blood_2 = 120;
+ * };
+ *
+ * $scope.$on('$destroy', function() {
+ * // Make sure that the interval is destroyed too
+ * $scope.stopFight();
+ * });
+ * }])
+ * // Register the 'myCurrentTime' directive factory method.
+ * // We inject $interval and dateFilter service since the factory method is DI.
+ * .directive('myCurrentTime', ['$interval', 'dateFilter',
+ * function($interval, dateFilter) {
+ * // return the directive link function. (compile function not needed)
+ * return function(scope, element, attrs) {
+ * var format, // date format
+ * stopTime; // so that we can cancel the time updates
+ *
+ * // used to update the UI
+ * function updateTime() {
+ * element.text(dateFilter(new Date(), format));
+ * }
+ *
+ * // watch the expression, and update the UI on change.
+ * scope.$watch(attrs.myCurrentTime, function(value) {
+ * format = value;
+ * updateTime();
+ * });
+ *
+ * stopTime = $interval(updateTime, 1000);
+ *
+ * // listen on DOM destroy (removal) event, and cancel the next UI update
+ * // to prevent updating time after the DOM element was removed.
+ * element.on('$destroy', function() {
+ * $interval.cancel(stopTime);
+ * });
+ * }
+ * }]);
+ * </script>
+ *
+ * <div>
+ * <div ng-controller="ExampleController">
+ * <label>Date format: <input ng-model="format"></label> <hr/>
+ * Current time is: <span my-current-time="format"></span>
+ * <hr/>
+ * Blood 1 : <font color='red'>{{blood_1}}</font>
+ * Blood 2 : <font color='red'>{{blood_2}}</font>
+ * <button type="button" data-ng-click="fight()">Fight</button>
+ * <button type="button" data-ng-click="stopFight()">StopFight</button>
+ * <button type="button" data-ng-click="resetFight()">resetFight</button>
+ * </div>
+ * </div>
+ *
+ * </file>
+ * </example>
+ */
+ function interval(fn, delay, count, invokeApply) {
+ var hasParams = arguments.length > 4,
+ args = hasParams ? sliceArgs(arguments, 4) : [],
+ setInterval = $window.setInterval,
+ clearInterval = $window.clearInterval,
+ iteration = 0,
+ skipApply = (isDefined(invokeApply) && !invokeApply),
+ deferred = (skipApply ? $$q : $q).defer(),
+ promise = deferred.promise;
+
+ count = isDefined(count) ? count : 0;
+
+ promise.$$intervalId = setInterval(function tick() {
+ if (skipApply) {
+ $browser.defer(callback);
+ } else {
+ $rootScope.$evalAsync(callback);
+ }
+ deferred.notify(iteration++);
+
+ if (count > 0 && iteration >= count) {
+ deferred.resolve(iteration);
+ clearInterval(promise.$$intervalId);
+ delete intervals[promise.$$intervalId];
+ }
+
+ if (!skipApply) $rootScope.$apply();
+
+ }, delay);
+
+ intervals[promise.$$intervalId] = deferred;
+
+ return promise;
+
+ function callback() {
+ if (!hasParams) {
+ fn(iteration);
+ } else {
+ fn.apply(null, args);
+ }
+ }
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $interval#cancel
+ *
+ * @description
+ * Cancels a task associated with the `promise`.
+ *
+ * @param {Promise=} promise returned by the `$interval` function.
+ * @returns {boolean} Returns `true` if the task was successfully canceled.
+ */
+ interval.cancel = function(promise) {
+ if (promise && promise.$$intervalId in intervals) {
+ intervals[promise.$$intervalId].reject('canceled');
+ $window.clearInterval(promise.$$intervalId);
+ delete intervals[promise.$$intervalId];
+ return true;
+ }
+ return false;
+ };
+
+ return interval;
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $locale
+ *
+ * @description
+ * $locale service provides localization rules for various Angular components. As of right now the
+ * only public api is:
+ *
+ * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)
+ */
+
+var PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/,
+ DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
+var $locationMinErr = minErr('$location');
+
+
+/**
+ * Encode path using encodeUriSegment, ignoring forward slashes
+ *
+ * @param {string} path Path to encode
+ * @returns {string}
+ */
+function encodePath(path) {
+ var segments = path.split('/'),
+ i = segments.length;
+
+ while (i--) {
+ segments[i] = encodeUriSegment(segments[i]);
+ }
+
+ return segments.join('/');
+}
+
+function parseAbsoluteUrl(absoluteUrl, locationObj) {
+ var parsedUrl = urlResolve(absoluteUrl);
+
+ locationObj.$$protocol = parsedUrl.protocol;
+ locationObj.$$host = parsedUrl.hostname;
+ locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;
+}
+
+
+function parseAppUrl(relativeUrl, locationObj) {
+ var prefixed = (relativeUrl.charAt(0) !== '/');
+ if (prefixed) {
+ relativeUrl = '/' + relativeUrl;
+ }
+ var match = urlResolve(relativeUrl);
+ locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?
+ match.pathname.substring(1) : match.pathname);
+ locationObj.$$search = parseKeyValue(match.search);
+ locationObj.$$hash = decodeURIComponent(match.hash);
+
+ // make sure path starts with '/';
+ if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') {
+ locationObj.$$path = '/' + locationObj.$$path;
+ }
+}
+
+
+/**
+ *
+ * @param {string} begin
+ * @param {string} whole
+ * @returns {string} returns text from whole after begin or undefined if it does not begin with
+ * expected string.
+ */
+function beginsWith(begin, whole) {
+ if (whole.indexOf(begin) === 0) {
+ return whole.substr(begin.length);
+ }
+}
+
+
+function stripHash(url) {
+ var index = url.indexOf('#');
+ return index == -1 ? url : url.substr(0, index);
+}
+
+function trimEmptyHash(url) {
+ return url.replace(/(#.+)|#$/, '$1');
+}
+
+
+function stripFile(url) {
+ return url.substr(0, stripHash(url).lastIndexOf('/') + 1);
+}
+
+/* return the server only (scheme://host:port) */
+function serverBase(url) {
+ return url.substring(0, url.indexOf('/', url.indexOf('//') + 2));
+}
+
+
+/**
+ * LocationHtml5Url represents an url
+ * This object is exposed as $location service when HTML5 mode is enabled and supported
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} appBaseNoFile application base URL stripped of any filename
+ * @param {string} basePrefix url path prefix
+ */
+function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
+ this.$$html5 = true;
+ basePrefix = basePrefix || '';
+ parseAbsoluteUrl(appBase, this);
+
+
+ /**
+ * Parse given html5 (regular) url string into properties
+ * @param {string} url HTML5 url
+ * @private
+ */
+ this.$$parse = function(url) {
+ var pathUrl = beginsWith(appBaseNoFile, url);
+ if (!isString(pathUrl)) {
+ throw $locationMinErr('ipthprfx', 'Invalid url "{0}", missing path prefix "{1}".', url,
+ appBaseNoFile);
+ }
+
+ parseAppUrl(pathUrl, this);
+
+ if (!this.$$path) {
+ this.$$path = '/';
+ }
+
+ this.$$compose();
+ };
+
+ /**
+ * Compose url and update `absUrl` property
+ * @private
+ */
+ this.$$compose = function() {
+ var search = toKeyValue(this.$$search),
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+ this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'
+ };
+
+ this.$$parseLinkUrl = function(url, relHref) {
+ if (relHref && relHref[0] === '#') {
+ // special case for links to hash fragments:
+ // keep the old url and only replace the hash fragment
+ this.hash(relHref.slice(1));
+ return true;
+ }
+ var appUrl, prevAppUrl;
+ var rewrittenUrl;
+
+ if (isDefined(appUrl = beginsWith(appBase, url))) {
+ prevAppUrl = appUrl;
+ if (isDefined(appUrl = beginsWith(basePrefix, appUrl))) {
+ rewrittenUrl = appBaseNoFile + (beginsWith('/', appUrl) || appUrl);
+ } else {
+ rewrittenUrl = appBase + prevAppUrl;
+ }
+ } else if (isDefined(appUrl = beginsWith(appBaseNoFile, url))) {
+ rewrittenUrl = appBaseNoFile + appUrl;
+ } else if (appBaseNoFile == url + '/') {
+ rewrittenUrl = appBaseNoFile;
+ }
+ if (rewrittenUrl) {
+ this.$$parse(rewrittenUrl);
+ }
+ return !!rewrittenUrl;
+ };
+}
+
+
+/**
+ * LocationHashbangUrl represents url
+ * This object is exposed as $location service when developer doesn't opt into html5 mode.
+ * It also serves as the base class for html5 mode fallback on legacy browsers.
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} appBaseNoFile application base URL stripped of any filename
+ * @param {string} hashPrefix hashbang prefix
+ */
+function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
+
+ parseAbsoluteUrl(appBase, this);
+
+
+ /**
+ * Parse given hashbang url into properties
+ * @param {string} url Hashbang url
+ * @private
+ */
+ this.$$parse = function(url) {
+ var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);
+ var withoutHashUrl;
+
+ if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === '#') {
+
+ // The rest of the url starts with a hash so we have
+ // got either a hashbang path or a plain hash fragment
+ withoutHashUrl = beginsWith(hashPrefix, withoutBaseUrl);
+ if (isUndefined(withoutHashUrl)) {
+ // There was no hashbang prefix so we just have a hash fragment
+ withoutHashUrl = withoutBaseUrl;
+ }
+
+ } else {
+ // There was no hashbang path nor hash fragment:
+ // If we are in HTML5 mode we use what is left as the path;
+ // Otherwise we ignore what is left
+ if (this.$$html5) {
+ withoutHashUrl = withoutBaseUrl;
+ } else {
+ withoutHashUrl = '';
+ if (isUndefined(withoutBaseUrl)) {
+ appBase = url;
+ this.replace();
+ }
+ }
+ }
+
+ parseAppUrl(withoutHashUrl, this);
+
+ this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);
+
+ this.$$compose();
+
+ /*
+ * In Windows, on an anchor node on documents loaded from
+ * the filesystem, the browser will return a pathname
+ * prefixed with the drive name ('/C:/path') when a
+ * pathname without a drive is set:
+ * * a.setAttribute('href', '/foo')
+ * * a.pathname === '/C:/foo' //true
+ *
+ * Inside of Angular, we're always using pathnames that
+ * do not include drive names for routing.
+ */
+ function removeWindowsDriveName(path, url, base) {
+ /*
+ Matches paths for file protocol on windows,
+ such as /C:/foo/bar, and captures only /foo/bar.
+ */
+ var windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
+
+ var firstPathSegmentMatch;
+
+ //Get the relative path from the input URL.
+ if (url.indexOf(base) === 0) {
+ url = url.replace(base, '');
+ }
+
+ // The input URL intentionally contains a first path segment that ends with a colon.
+ if (windowsFilePathExp.exec(url)) {
+ return path;
+ }
+
+ firstPathSegmentMatch = windowsFilePathExp.exec(path);
+ return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
+ }
+ };
+
+ /**
+ * Compose hashbang url and update `absUrl` property
+ * @private
+ */
+ this.$$compose = function() {
+ var search = toKeyValue(this.$$search),
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+ this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');
+ };
+
+ this.$$parseLinkUrl = function(url, relHref) {
+ if (stripHash(appBase) == stripHash(url)) {
+ this.$$parse(url);
+ return true;
+ }
+ return false;
+ };
+}
+
+
+/**
+ * LocationHashbangUrl represents url
+ * This object is exposed as $location service when html5 history api is enabled but the browser
+ * does not support it.
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} appBaseNoFile application base URL stripped of any filename
+ * @param {string} hashPrefix hashbang prefix
+ */
+function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
+ this.$$html5 = true;
+ LocationHashbangUrl.apply(this, arguments);
+
+ this.$$parseLinkUrl = function(url, relHref) {
+ if (relHref && relHref[0] === '#') {
+ // special case for links to hash fragments:
+ // keep the old url and only replace the hash fragment
+ this.hash(relHref.slice(1));
+ return true;
+ }
+
+ var rewrittenUrl;
+ var appUrl;
+
+ if (appBase == stripHash(url)) {
+ rewrittenUrl = url;
+ } else if ((appUrl = beginsWith(appBaseNoFile, url))) {
+ rewrittenUrl = appBase + hashPrefix + appUrl;
+ } else if (appBaseNoFile === url + '/') {
+ rewrittenUrl = appBaseNoFile;
+ }
+ if (rewrittenUrl) {
+ this.$$parse(rewrittenUrl);
+ }
+ return !!rewrittenUrl;
+ };
+
+ this.$$compose = function() {
+ var search = toKeyValue(this.$$search),
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+ // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#'
+ this.$$absUrl = appBase + hashPrefix + this.$$url;
+ };
+
+}
+
+
+var locationPrototype = {
+
+ /**
+ * Are we in html5 mode?
+ * @private
+ */
+ $$html5: false,
+
+ /**
+ * Has any change been replacing?
+ * @private
+ */
+ $$replace: false,
+
+ /**
+ * @ngdoc method
+ * @name $location#absUrl
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return full url representation with all segments encoded according to rules specified in
+ * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var absUrl = $location.absUrl();
+ * // => "http://example.com/#/some/path?foo=bar&baz=xoxo"
+ * ```
+ *
+ * @return {string} full url
+ */
+ absUrl: locationGetter('$$absUrl'),
+
+ /**
+ * @ngdoc method
+ * @name $location#url
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return url (e.g. `/path?a=b#hash`) when called without any parameter.
+ *
+ * Change path, search and hash, when called with parameter and return `$location`.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var url = $location.url();
+ * // => "/some/path?foo=bar&baz=xoxo"
+ * ```
+ *
+ * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)
+ * @return {string} url
+ */
+ url: function(url) {
+ if (isUndefined(url)) {
+ return this.$$url;
+ }
+
+ var match = PATH_MATCH.exec(url);
+ if (match[1] || url === '') this.path(decodeURIComponent(match[1]));
+ if (match[2] || match[1] || url === '') this.search(match[3] || '');
+ this.hash(match[5] || '');
+
+ return this;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $location#protocol
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return protocol of current url.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var protocol = $location.protocol();
+ * // => "http"
+ * ```
+ *
+ * @return {string} protocol of current url
+ */
+ protocol: locationGetter('$$protocol'),
+
+ /**
+ * @ngdoc method
+ * @name $location#host
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return host of current url.
+ *
+ * Note: compared to the non-angular version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var host = $location.host();
+ * // => "example.com"
+ *
+ * // given url http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo
+ * host = $location.host();
+ * // => "example.com"
+ * host = location.host;
+ * // => "example.com:8080"
+ * ```
+ *
+ * @return {string} host of current url.
+ */
+ host: locationGetter('$$host'),
+
+ /**
+ * @ngdoc method
+ * @name $location#port
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return port of current url.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var port = $location.port();
+ * // => 80
+ * ```
+ *
+ * @return {Number} port
+ */
+ port: locationGetter('$$port'),
+
+ /**
+ * @ngdoc method
+ * @name $location#path
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return path of current url when called without any parameter.
+ *
+ * Change path when called with parameter and return `$location`.
+ *
+ * Note: Path should always begin with forward slash (/), this method will add the forward slash
+ * if it is missing.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var path = $location.path();
+ * // => "/some/path"
+ * ```
+ *
+ * @param {(string|number)=} path New path
+ * @return {string} path
+ */
+ path: locationGetterSetter('$$path', function(path) {
+ path = path !== null ? path.toString() : '';
+ return path.charAt(0) == '/' ? path : '/' + path;
+ }),
+
+ /**
+ * @ngdoc method
+ * @name $location#search
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return search part (as object) of current url when called without any parameter.
+ *
+ * Change search part when called with parameter and return `$location`.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var searchObject = $location.search();
+ * // => {foo: 'bar', baz: 'xoxo'}
+ *
+ * // set foo to 'yipee'
+ * $location.search('foo', 'yipee');
+ * // $location.search() => {foo: 'yipee', baz: 'xoxo'}
+ * ```
+ *
+ * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or
+ * hash object.
+ *
+ * When called with a single argument the method acts as a setter, setting the `search` component
+ * of `$location` to the specified value.
+ *
+ * If the argument is a hash object containing an array of values, these values will be encoded
+ * as duplicate search parameters in the url.
+ *
+ * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`
+ * will override only a single search property.
+ *
+ * If `paramValue` is an array, it will override the property of the `search` component of
+ * `$location` specified via the first argument.
+ *
+ * If `paramValue` is `null`, the property specified via the first argument will be deleted.
+ *
+ * If `paramValue` is `true`, the property specified via the first argument will be added with no
+ * value nor trailing equal sign.
+ *
+ * @return {Object} If called with no arguments returns the parsed `search` object. If called with
+ * one or more arguments returns `$location` object itself.
+ */
+ search: function(search, paramValue) {
+ switch (arguments.length) {
+ case 0:
+ return this.$$search;
+ case 1:
+ if (isString(search) || isNumber(search)) {
+ search = search.toString();
+ this.$$search = parseKeyValue(search);
+ } else if (isObject(search)) {
+ search = copy(search, {});
+ // remove object undefined or null properties
+ forEach(search, function(value, key) {
+ if (value == null) delete search[key];
+ });
+
+ this.$$search = search;
+ } else {
+ throw $locationMinErr('isrcharg',
+ 'The first argument of the `$location#search()` call must be a string or an object.');
+ }
+ break;
+ default:
+ if (isUndefined(paramValue) || paramValue === null) {
+ delete this.$$search[search];
+ } else {
+ this.$$search[search] = paramValue;
+ }
+ }
+
+ this.$$compose();
+ return this;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $location#hash
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Returns the hash fragment when called without any parameters.
+ *
+ * Changes the hash fragment when called with a parameter and returns `$location`.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
+ * var hash = $location.hash();
+ * // => "hashValue"
+ * ```
+ *
+ * @param {(string|number)=} hash New hash fragment
+ * @return {string} hash
+ */
+ hash: locationGetterSetter('$$hash', function(hash) {
+ return hash !== null ? hash.toString() : '';
+ }),
+
+ /**
+ * @ngdoc method
+ * @name $location#replace
+ *
+ * @description
+ * If called, all changes to $location during the current `$digest` will replace the current history
+ * record, instead of adding a new one.
+ */
+ replace: function() {
+ this.$$replace = true;
+ return this;
+ }
+};
+
+forEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], function(Location) {
+ Location.prototype = Object.create(locationPrototype);
+
+ /**
+ * @ngdoc method
+ * @name $location#state
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return the history state object when called without any parameter.
+ *
+ * Change the history state object when called with one parameter and return `$location`.
+ * The state object is later passed to `pushState` or `replaceState`.
+ *
+ * NOTE: This method is supported only in HTML5 mode and only in browsers supporting
+ * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support
+ * older browsers (like IE9 or Android < 4.0), don't use this method.
+ *
+ * @param {object=} state State object for pushState or replaceState
+ * @return {object} state
+ */
+ Location.prototype.state = function(state) {
+ if (!arguments.length) {
+ return this.$$state;
+ }
+
+ if (Location !== LocationHtml5Url || !this.$$html5) {
+ throw $locationMinErr('nostate', 'History API state support is available only ' +
+ 'in HTML5 mode and only in browsers supporting HTML5 History API');
+ }
+ // The user might modify `stateObject` after invoking `$location.state(stateObject)`
+ // but we're changing the $$state reference to $browser.state() during the $digest
+ // so the modification window is narrow.
+ this.$$state = isUndefined(state) ? null : state;
+
+ return this;
+ };
+});
+
+
+function locationGetter(property) {
+ return function() {
+ return this[property];
+ };
+}
+
+
+function locationGetterSetter(property, preprocess) {
+ return function(value) {
+ if (isUndefined(value)) {
+ return this[property];
+ }
+
+ this[property] = preprocess(value);
+ this.$$compose();
+
+ return this;
+ };
+}
+
+
+/**
+ * @ngdoc service
+ * @name $location
+ *
+ * @requires $rootElement
+ *
+ * @description
+ * The $location service parses the URL in the browser address bar (based on the
+ * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL
+ * available to your application. Changes to the URL in the address bar are reflected into
+ * $location service and changes to $location are reflected into the browser address bar.
+ *
+ * **The $location service:**
+ *
+ * - Exposes the current URL in the browser address bar, so you can
+ * - Watch and observe the URL.
+ * - Change the URL.
+ * - Synchronizes the URL with the browser when the user
+ * - Changes the address bar.
+ * - Clicks the back or forward button (or clicks a History link).
+ * - Clicks on a link.
+ * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
+ *
+ * For more information see {@link guide/$location Developer Guide: Using $location}
+ */
+
+/**
+ * @ngdoc provider
+ * @name $locationProvider
+ * @description
+ * Use the `$locationProvider` to configure how the application deep linking paths are stored.
+ */
+function $LocationProvider() {
+ var hashPrefix = '',
+ html5Mode = {
+ enabled: false,
+ requireBase: true,
+ rewriteLinks: true
+ };
+
+ /**
+ * @ngdoc method
+ * @name $locationProvider#hashPrefix
+ * @description
+ * @param {string=} prefix Prefix for hash part (containing path and search)
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ */
+ this.hashPrefix = function(prefix) {
+ if (isDefined(prefix)) {
+ hashPrefix = prefix;
+ return this;
+ } else {
+ return hashPrefix;
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $locationProvider#html5Mode
+ * @description
+ * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value.
+ * If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported
+ * properties:
+ * - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to
+ * change urls where supported. Will fall back to hash-prefixed paths in browsers that do not
+ * support `pushState`.
+ * - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies
+ * whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are
+ * true, and a base tag is not present, an error will be thrown when `$location` is injected.
+ * See the {@link guide/$location $location guide for more information}
+ * - **rewriteLinks** - `{boolean}` - (default: `true`) When html5Mode is enabled,
+ * enables/disables url rewriting for relative links.
+ *
+ * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter
+ */
+ this.html5Mode = function(mode) {
+ if (isBoolean(mode)) {
+ html5Mode.enabled = mode;
+ return this;
+ } else if (isObject(mode)) {
+
+ if (isBoolean(mode.enabled)) {
+ html5Mode.enabled = mode.enabled;
+ }
+
+ if (isBoolean(mode.requireBase)) {
+ html5Mode.requireBase = mode.requireBase;
+ }
+
+ if (isBoolean(mode.rewriteLinks)) {
+ html5Mode.rewriteLinks = mode.rewriteLinks;
+ }
+
+ return this;
+ } else {
+ return html5Mode;
+ }
+ };
+
+ /**
+ * @ngdoc event
+ * @name $location#$locationChangeStart
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted before a URL will change.
+ *
+ * This change can be prevented by calling
+ * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more
+ * details about event object. Upon successful change
+ * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired.
+ *
+ * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
+ * the browser supports the HTML5 History API.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {string} newUrl New URL
+ * @param {string=} oldUrl URL that was before it was changed.
+ * @param {string=} newState New history state object
+ * @param {string=} oldState History state object that was before it was changed.
+ */
+
+ /**
+ * @ngdoc event
+ * @name $location#$locationChangeSuccess
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted after a URL was changed.
+ *
+ * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
+ * the browser supports the HTML5 History API.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {string} newUrl New URL
+ * @param {string=} oldUrl URL that was before it was changed.
+ * @param {string=} newState New history state object
+ * @param {string=} oldState History state object that was before it was changed.
+ */
+
+ this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', '$window',
+ function($rootScope, $browser, $sniffer, $rootElement, $window) {
+ var $location,
+ LocationMode,
+ baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to ''
+ initialUrl = $browser.url(),
+ appBase;
+
+ if (html5Mode.enabled) {
+ if (!baseHref && html5Mode.requireBase) {
+ throw $locationMinErr('nobase',
+ "$location in HTML5 mode requires a <base> tag to be present!");
+ }
+ appBase = serverBase(initialUrl) + (baseHref || '/');
+ LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;
+ } else {
+ appBase = stripHash(initialUrl);
+ LocationMode = LocationHashbangUrl;
+ }
+ var appBaseNoFile = stripFile(appBase);
+
+ $location = new LocationMode(appBase, appBaseNoFile, '#' + hashPrefix);
+ $location.$$parseLinkUrl(initialUrl, initialUrl);
+
+ $location.$$state = $browser.state();
+
+ var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
+
+ function setBrowserUrlWithFallback(url, replace, state) {
+ var oldUrl = $location.url();
+ var oldState = $location.$$state;
+ try {
+ $browser.url(url, replace, state);
+
+ // Make sure $location.state() returns referentially identical (not just deeply equal)
+ // state object; this makes possible quick checking if the state changed in the digest
+ // loop. Checking deep equality would be too expensive.
+ $location.$$state = $browser.state();
+ } catch (e) {
+ // Restore old values if pushState fails
+ $location.url(oldUrl);
+ $location.$$state = oldState;
+
+ throw e;
+ }
+ }
+
+ $rootElement.on('click', function(event) {
+ // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
+ // currently we open nice url link and redirect then
+
+ if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which == 2 || event.button == 2) return;
+
+ var elm = jqLite(event.target);
+
+ // traverse the DOM up to find first A tag
+ while (nodeName_(elm[0]) !== 'a') {
+ // ignore rewriting if no A tag (reached root element, or no parent - removed from document)
+ if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;
+ }
+
+ var absHref = elm.prop('href');
+ // get the actual href attribute - see
+ // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx
+ var relHref = elm.attr('href') || elm.attr('xlink:href');
+
+ if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {
+ // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during
+ // an animation.
+ absHref = urlResolve(absHref.animVal).href;
+ }
+
+ // Ignore when url is started with javascript: or mailto:
+ if (IGNORE_URI_REGEXP.test(absHref)) return;
+
+ if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) {
+ if ($location.$$parseLinkUrl(absHref, relHref)) {
+ // We do a preventDefault for all urls that are part of the angular application,
+ // in html5mode and also without, so that we are able to abort navigation without
+ // getting double entries in the location history.
+ event.preventDefault();
+ // update location manually
+ if ($location.absUrl() != $browser.url()) {
+ $rootScope.$apply();
+ // hack to work around FF6 bug 684208 when scenario runner clicks on links
+ $window.angular['ff-684208-preventDefault'] = true;
+ }
+ }
+ }
+ });
+
+
+ // rewrite hashbang url <> html5 url
+ if (trimEmptyHash($location.absUrl()) != trimEmptyHash(initialUrl)) {
+ $browser.url($location.absUrl(), true);
+ }
+
+ var initializing = true;
+
+ // update $location when $browser url changes
+ $browser.onUrlChange(function(newUrl, newState) {
+
+ if (isUndefined(beginsWith(appBaseNoFile, newUrl))) {
+ // If we are navigating outside of the app then force a reload
+ $window.location.href = newUrl;
+ return;
+ }
+
+ $rootScope.$evalAsync(function() {
+ var oldUrl = $location.absUrl();
+ var oldState = $location.$$state;
+ var defaultPrevented;
+ newUrl = trimEmptyHash(newUrl);
+ $location.$$parse(newUrl);
+ $location.$$state = newState;
+
+ defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
+ newState, oldState).defaultPrevented;
+
+ // if the location was changed by a `$locationChangeStart` handler then stop
+ // processing this location change
+ if ($location.absUrl() !== newUrl) return;
+
+ if (defaultPrevented) {
+ $location.$$parse(oldUrl);
+ $location.$$state = oldState;
+ setBrowserUrlWithFallback(oldUrl, false, oldState);
+ } else {
+ initializing = false;
+ afterLocationChange(oldUrl, oldState);
+ }
+ });
+ if (!$rootScope.$$phase) $rootScope.$digest();
+ });
+
+ // update browser
+ $rootScope.$watch(function $locationWatch() {
+ var oldUrl = trimEmptyHash($browser.url());
+ var newUrl = trimEmptyHash($location.absUrl());
+ var oldState = $browser.state();
+ var currentReplace = $location.$$replace;
+ var urlOrStateChanged = oldUrl !== newUrl ||
+ ($location.$$html5 && $sniffer.history && oldState !== $location.$$state);
+
+ if (initializing || urlOrStateChanged) {
+ initializing = false;
+
+ $rootScope.$evalAsync(function() {
+ var newUrl = $location.absUrl();
+ var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
+ $location.$$state, oldState).defaultPrevented;
+
+ // if the location was changed by a `$locationChangeStart` handler then stop
+ // processing this location change
+ if ($location.absUrl() !== newUrl) return;
+
+ if (defaultPrevented) {
+ $location.$$parse(oldUrl);
+ $location.$$state = oldState;
+ } else {
+ if (urlOrStateChanged) {
+ setBrowserUrlWithFallback(newUrl, currentReplace,
+ oldState === $location.$$state ? null : $location.$$state);
+ }
+ afterLocationChange(oldUrl, oldState);
+ }
+ });
+ }
+
+ $location.$$replace = false;
+
+ // we don't need to return anything because $evalAsync will make the digest loop dirty when
+ // there is a change
+ });
+
+ return $location;
+
+ function afterLocationChange(oldUrl, oldState) {
+ $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl,
+ $location.$$state, oldState);
+ }
+}];
+}
+
+/**
+ * @ngdoc service
+ * @name $log
+ * @requires $window
+ *
+ * @description
+ * Simple service for logging. Default implementation safely writes the message
+ * into the browser's console (if present).
+ *
+ * The main purpose of this service is to simplify debugging and troubleshooting.
+ *
+ * The default is to log `debug` messages. You can use
+ * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.
+ *
+ * @example
+ <example module="logExample">
+ <file name="script.js">
+ angular.module('logExample', [])
+ .controller('LogController', ['$scope', '$log', function($scope, $log) {
+ $scope.$log = $log;
+ $scope.message = 'Hello World!';
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="LogController">
+ <p>Reload this page with open console, enter text and hit the log button...</p>
+ <label>Message:
+ <input type="text" ng-model="message" /></label>
+ <button ng-click="$log.log(message)">log</button>
+ <button ng-click="$log.warn(message)">warn</button>
+ <button ng-click="$log.info(message)">info</button>
+ <button ng-click="$log.error(message)">error</button>
+ <button ng-click="$log.debug(message)">debug</button>
+ </div>
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc provider
+ * @name $logProvider
+ * @description
+ * Use the `$logProvider` to configure how the application logs messages
+ */
+function $LogProvider() {
+ var debug = true,
+ self = this;
+
+ /**
+ * @ngdoc method
+ * @name $logProvider#debugEnabled
+ * @description
+ * @param {boolean=} flag enable or disable debug level messages
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ */
+ this.debugEnabled = function(flag) {
+ if (isDefined(flag)) {
+ debug = flag;
+ return this;
+ } else {
+ return debug;
+ }
+ };
+
+ this.$get = ['$window', function($window) {
+ return {
+ /**
+ * @ngdoc method
+ * @name $log#log
+ *
+ * @description
+ * Write a log message
+ */
+ log: consoleLog('log'),
+
+ /**
+ * @ngdoc method
+ * @name $log#info
+ *
+ * @description
+ * Write an information message
+ */
+ info: consoleLog('info'),
+
+ /**
+ * @ngdoc method
+ * @name $log#warn
+ *
+ * @description
+ * Write a warning message
+ */
+ warn: consoleLog('warn'),
+
+ /**
+ * @ngdoc method
+ * @name $log#error
+ *
+ * @description
+ * Write an error message
+ */
+ error: consoleLog('error'),
+
+ /**
+ * @ngdoc method
+ * @name $log#debug
+ *
+ * @description
+ * Write a debug message
+ */
+ debug: (function() {
+ var fn = consoleLog('debug');
+
+ return function() {
+ if (debug) {
+ fn.apply(self, arguments);
+ }
+ };
+ }())
+ };
+
+ function formatError(arg) {
+ if (arg instanceof Error) {
+ if (arg.stack) {
+ arg = (arg.message && arg.stack.indexOf(arg.message) === -1)
+ ? 'Error: ' + arg.message + '\n' + arg.stack
+ : arg.stack;
+ } else if (arg.sourceURL) {
+ arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line;
+ }
+ }
+ return arg;
+ }
+
+ function consoleLog(type) {
+ var console = $window.console || {},
+ logFn = console[type] || console.log || noop,
+ hasApply = false;
+
+ // Note: reading logFn.apply throws an error in IE11 in IE8 document mode.
+ // The reason behind this is that console.log has type "object" in IE8...
+ try {
+ hasApply = !!logFn.apply;
+ } catch (e) {}
+
+ if (hasApply) {
+ return function() {
+ var args = [];
+ forEach(arguments, function(arg) {
+ args.push(formatError(arg));
+ });
+ return logFn.apply(console, args);
+ };
+ }
+
+ // we are IE which either doesn't have window.console => this is noop and we do nothing,
+ // or we are IE where console.log doesn't have apply so we log at least first 2 args
+ return function(arg1, arg2) {
+ logFn(arg1, arg2 == null ? '' : arg2);
+ };
+ }
+ }];
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+var $parseMinErr = minErr('$parse');
+
+// Sandboxing Angular Expressions
+// ------------------------------
+// Angular expressions are generally considered safe because these expressions only have direct
+// access to `$scope` and locals. However, one can obtain the ability to execute arbitrary JS code by
+// obtaining a reference to native JS functions such as the Function constructor.
+//
+// As an example, consider the following Angular expression:
+//
+// {}.toString.constructor('alert("evil JS code")')
+//
+// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits
+// against the expression language, but not to prevent exploits that were enabled by exposing
+// sensitive JavaScript or browser APIs on Scope. Exposing such objects on a Scope is never a good
+// practice and therefore we are not even trying to protect against interaction with an object
+// explicitly exposed in this way.
+//
+// In general, it is not possible to access a Window object from an angular expression unless a
+// window or some DOM object that has a reference to window is published onto a Scope.
+// Similarly we prevent invocations of function known to be dangerous, as well as assignments to
+// native objects.
+//
+// See https://docs.angularjs.org/guide/security
+
+
+function ensureSafeMemberName(name, fullExpression) {
+ if (name === "__defineGetter__" || name === "__defineSetter__"
+ || name === "__lookupGetter__" || name === "__lookupSetter__"
+ || name === "__proto__") {
+ throw $parseMinErr('isecfld',
+ 'Attempting to access a disallowed field in Angular expressions! '
+ + 'Expression: {0}', fullExpression);
+ }
+ return name;
+}
+
+function getStringValue(name) {
+ // Property names must be strings. This means that non-string objects cannot be used
+ // as keys in an object. Any non-string object, including a number, is typecasted
+ // into a string via the toString method.
+ // -- MDN, https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Property_accessors#Property_names
+ //
+ // So, to ensure that we are checking the same `name` that JavaScript would use, we cast it
+ // to a string. It's not always possible. If `name` is an object and its `toString` method is
+ // 'broken' (doesn't return a string, isn't a function, etc.), an error will be thrown:
+ //
+ // TypeError: Cannot convert object to primitive value
+ //
+ // For performance reasons, we don't catch this error here and allow it to propagate up the call
+ // stack. Note that you'll get the same error in JavaScript if you try to access a property using
+ // such a 'broken' object as a key.
+ return name + '';
+}
+
+function ensureSafeObject(obj, fullExpression) {
+ // nifty check if obj is Function that is fast and works across iframes and other contexts
+ if (obj) {
+ if (obj.constructor === obj) {
+ throw $parseMinErr('isecfn',
+ 'Referencing Function in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (// isWindow(obj)
+ obj.window === obj) {
+ throw $parseMinErr('isecwindow',
+ 'Referencing the Window in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (// isElement(obj)
+ obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) {
+ throw $parseMinErr('isecdom',
+ 'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (// block Object so that we can't get hold of dangerous Object.* methods
+ obj === Object) {
+ throw $parseMinErr('isecobj',
+ 'Referencing Object in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ }
+ }
+ return obj;
+}
+
+var CALL = Function.prototype.call;
+var APPLY = Function.prototype.apply;
+var BIND = Function.prototype.bind;
+
+function ensureSafeFunction(obj, fullExpression) {
+ if (obj) {
+ if (obj.constructor === obj) {
+ throw $parseMinErr('isecfn',
+ 'Referencing Function in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (obj === CALL || obj === APPLY || obj === BIND) {
+ throw $parseMinErr('isecff',
+ 'Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ }
+ }
+}
+
+function ensureSafeAssignContext(obj, fullExpression) {
+ if (obj) {
+ if (obj === (0).constructor || obj === (false).constructor || obj === ''.constructor ||
+ obj === {}.constructor || obj === [].constructor || obj === Function.constructor) {
+ throw $parseMinErr('isecaf',
+ 'Assigning to a constructor is disallowed! Expression: {0}', fullExpression);
+ }
+ }
+}
+
+var OPERATORS = createMap();
+forEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function(operator) { OPERATORS[operator] = true; });
+var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'};
+
+
+/////////////////////////////////////////
+
+
+/**
+ * @constructor
+ */
+var Lexer = function(options) {
+ this.options = options;
+};
+
+Lexer.prototype = {
+ constructor: Lexer,
+
+ lex: function(text) {
+ this.text = text;
+ this.index = 0;
+ this.tokens = [];
+
+ while (this.index < this.text.length) {
+ var ch = this.text.charAt(this.index);
+ if (ch === '"' || ch === "'") {
+ this.readString(ch);
+ } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) {
+ this.readNumber();
+ } else if (this.isIdent(ch)) {
+ this.readIdent();
+ } else if (this.is(ch, '(){}[].,;:?')) {
+ this.tokens.push({index: this.index, text: ch});
+ this.index++;
+ } else if (this.isWhitespace(ch)) {
+ this.index++;
+ } else {
+ var ch2 = ch + this.peek();
+ var ch3 = ch2 + this.peek(2);
+ var op1 = OPERATORS[ch];
+ var op2 = OPERATORS[ch2];
+ var op3 = OPERATORS[ch3];
+ if (op1 || op2 || op3) {
+ var token = op3 ? ch3 : (op2 ? ch2 : ch);
+ this.tokens.push({index: this.index, text: token, operator: true});
+ this.index += token.length;
+ } else {
+ this.throwError('Unexpected next character ', this.index, this.index + 1);
+ }
+ }
+ }
+ return this.tokens;
+ },
+
+ is: function(ch, chars) {
+ return chars.indexOf(ch) !== -1;
+ },
+
+ peek: function(i) {
+ var num = i || 1;
+ return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;
+ },
+
+ isNumber: function(ch) {
+ return ('0' <= ch && ch <= '9') && typeof ch === "string";
+ },
+
+ isWhitespace: function(ch) {
+ // IE treats non-breaking space as \u00A0
+ return (ch === ' ' || ch === '\r' || ch === '\t' ||
+ ch === '\n' || ch === '\v' || ch === '\u00A0');
+ },
+
+ isIdent: function(ch) {
+ return ('a' <= ch && ch <= 'z' ||
+ 'A' <= ch && ch <= 'Z' ||
+ '_' === ch || ch === '$');
+ },
+
+ isExpOperator: function(ch) {
+ return (ch === '-' || ch === '+' || this.isNumber(ch));
+ },
+
+ throwError: function(error, start, end) {
+ end = end || this.index;
+ var colStr = (isDefined(start)
+ ? 's ' + start + '-' + this.index + ' [' + this.text.substring(start, end) + ']'
+ : ' ' + end);
+ throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].',
+ error, colStr, this.text);
+ },
+
+ readNumber: function() {
+ var number = '';
+ var start = this.index;
+ while (this.index < this.text.length) {
+ var ch = lowercase(this.text.charAt(this.index));
+ if (ch == '.' || this.isNumber(ch)) {
+ number += ch;
+ } else {
+ var peekCh = this.peek();
+ if (ch == 'e' && this.isExpOperator(peekCh)) {
+ number += ch;
+ } else if (this.isExpOperator(ch) &&
+ peekCh && this.isNumber(peekCh) &&
+ number.charAt(number.length - 1) == 'e') {
+ number += ch;
+ } else if (this.isExpOperator(ch) &&
+ (!peekCh || !this.isNumber(peekCh)) &&
+ number.charAt(number.length - 1) == 'e') {
+ this.throwError('Invalid exponent');
+ } else {
+ break;
+ }
+ }
+ this.index++;
+ }
+ this.tokens.push({
+ index: start,
+ text: number,
+ constant: true,
+ value: Number(number)
+ });
+ },
+
+ readIdent: function() {
+ var start = this.index;
+ while (this.index < this.text.length) {
+ var ch = this.text.charAt(this.index);
+ if (!(this.isIdent(ch) || this.isNumber(ch))) {
+ break;
+ }
+ this.index++;
+ }
+ this.tokens.push({
+ index: start,
+ text: this.text.slice(start, this.index),
+ identifier: true
+ });
+ },
+
+ readString: function(quote) {
+ var start = this.index;
+ this.index++;
+ var string = '';
+ var rawString = quote;
+ var escape = false;
+ while (this.index < this.text.length) {
+ var ch = this.text.charAt(this.index);
+ rawString += ch;
+ if (escape) {
+ if (ch === 'u') {
+ var hex = this.text.substring(this.index + 1, this.index + 5);
+ if (!hex.match(/[\da-f]{4}/i)) {
+ this.throwError('Invalid unicode escape [\\u' + hex + ']');
+ }
+ this.index += 4;
+ string += String.fromCharCode(parseInt(hex, 16));
+ } else {
+ var rep = ESCAPE[ch];
+ string = string + (rep || ch);
+ }
+ escape = false;
+ } else if (ch === '\\') {
+ escape = true;
+ } else if (ch === quote) {
+ this.index++;
+ this.tokens.push({
+ index: start,
+ text: rawString,
+ constant: true,
+ value: string
+ });
+ return;
+ } else {
+ string += ch;
+ }
+ this.index++;
+ }
+ this.throwError('Unterminated quote', start);
+ }
+};
+
+var AST = function(lexer, options) {
+ this.lexer = lexer;
+ this.options = options;
+};
+
+AST.Program = 'Program';
+AST.ExpressionStatement = 'ExpressionStatement';
+AST.AssignmentExpression = 'AssignmentExpression';
+AST.ConditionalExpression = 'ConditionalExpression';
+AST.LogicalExpression = 'LogicalExpression';
+AST.BinaryExpression = 'BinaryExpression';
+AST.UnaryExpression = 'UnaryExpression';
+AST.CallExpression = 'CallExpression';
+AST.MemberExpression = 'MemberExpression';
+AST.Identifier = 'Identifier';
+AST.Literal = 'Literal';
+AST.ArrayExpression = 'ArrayExpression';
+AST.Property = 'Property';
+AST.ObjectExpression = 'ObjectExpression';
+AST.ThisExpression = 'ThisExpression';
+AST.LocalsExpression = 'LocalsExpression';
+
+// Internal use only
+AST.NGValueParameter = 'NGValueParameter';
+
+AST.prototype = {
+ ast: function(text) {
+ this.text = text;
+ this.tokens = this.lexer.lex(text);
+
+ var value = this.program();
+
+ if (this.tokens.length !== 0) {
+ this.throwError('is an unexpected token', this.tokens[0]);
+ }
+
+ return value;
+ },
+
+ program: function() {
+ var body = [];
+ while (true) {
+ if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']'))
+ body.push(this.expressionStatement());
+ if (!this.expect(';')) {
+ return { type: AST.Program, body: body};
+ }
+ }
+ },
+
+ expressionStatement: function() {
+ return { type: AST.ExpressionStatement, expression: this.filterChain() };
+ },
+
+ filterChain: function() {
+ var left = this.expression();
+ var token;
+ while ((token = this.expect('|'))) {
+ left = this.filter(left);
+ }
+ return left;
+ },
+
+ expression: function() {
+ return this.assignment();
+ },
+
+ assignment: function() {
+ var result = this.ternary();
+ if (this.expect('=')) {
+ result = { type: AST.AssignmentExpression, left: result, right: this.assignment(), operator: '='};
+ }
+ return result;
+ },
+
+ ternary: function() {
+ var test = this.logicalOR();
+ var alternate;
+ var consequent;
+ if (this.expect('?')) {
+ alternate = this.expression();
+ if (this.consume(':')) {
+ consequent = this.expression();
+ return { type: AST.ConditionalExpression, test: test, alternate: alternate, consequent: consequent};
+ }
+ }
+ return test;
+ },
+
+ logicalOR: function() {
+ var left = this.logicalAND();
+ while (this.expect('||')) {
+ left = { type: AST.LogicalExpression, operator: '||', left: left, right: this.logicalAND() };
+ }
+ return left;
+ },
+
+ logicalAND: function() {
+ var left = this.equality();
+ while (this.expect('&&')) {
+ left = { type: AST.LogicalExpression, operator: '&&', left: left, right: this.equality()};
+ }
+ return left;
+ },
+
+ equality: function() {
+ var left = this.relational();
+ var token;
+ while ((token = this.expect('==','!=','===','!=='))) {
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.relational() };
+ }
+ return left;
+ },
+
+ relational: function() {
+ var left = this.additive();
+ var token;
+ while ((token = this.expect('<', '>', '<=', '>='))) {
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.additive() };
+ }
+ return left;
+ },
+
+ additive: function() {
+ var left = this.multiplicative();
+ var token;
+ while ((token = this.expect('+','-'))) {
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.multiplicative() };
+ }
+ return left;
+ },
+
+ multiplicative: function() {
+ var left = this.unary();
+ var token;
+ while ((token = this.expect('*','/','%'))) {
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.unary() };
+ }
+ return left;
+ },
+
+ unary: function() {
+ var token;
+ if ((token = this.expect('+', '-', '!'))) {
+ return { type: AST.UnaryExpression, operator: token.text, prefix: true, argument: this.unary() };
+ } else {
+ return this.primary();
+ }
+ },
+
+ primary: function() {
+ var primary;
+ if (this.expect('(')) {
+ primary = this.filterChain();
+ this.consume(')');
+ } else if (this.expect('[')) {
+ primary = this.arrayDeclaration();
+ } else if (this.expect('{')) {
+ primary = this.object();
+ } else if (this.constants.hasOwnProperty(this.peek().text)) {
+ primary = copy(this.constants[this.consume().text]);
+ } else if (this.peek().identifier) {
+ primary = this.identifier();
+ } else if (this.peek().constant) {
+ primary = this.constant();
+ } else {
+ this.throwError('not a primary expression', this.peek());
+ }
+
+ var next;
+ while ((next = this.expect('(', '[', '.'))) {
+ if (next.text === '(') {
+ primary = {type: AST.CallExpression, callee: primary, arguments: this.parseArguments() };
+ this.consume(')');
+ } else if (next.text === '[') {
+ primary = { type: AST.MemberExpression, object: primary, property: this.expression(), computed: true };
+ this.consume(']');
+ } else if (next.text === '.') {
+ primary = { type: AST.MemberExpression, object: primary, property: this.identifier(), computed: false };
+ } else {
+ this.throwError('IMPOSSIBLE');
+ }
+ }
+ return primary;
+ },
+
+ filter: function(baseExpression) {
+ var args = [baseExpression];
+ var result = {type: AST.CallExpression, callee: this.identifier(), arguments: args, filter: true};
+
+ while (this.expect(':')) {
+ args.push(this.expression());
+ }
+
+ return result;
+ },
+
+ parseArguments: function() {
+ var args = [];
+ if (this.peekToken().text !== ')') {
+ do {
+ args.push(this.expression());
+ } while (this.expect(','));
+ }
+ return args;
+ },
+
+ identifier: function() {
+ var token = this.consume();
+ if (!token.identifier) {
+ this.throwError('is not a valid identifier', token);
+ }
+ return { type: AST.Identifier, name: token.text };
+ },
+
+ constant: function() {
+ // TODO check that it is a constant
+ return { type: AST.Literal, value: this.consume().value };
+ },
+
+ arrayDeclaration: function() {
+ var elements = [];
+ if (this.peekToken().text !== ']') {
+ do {
+ if (this.peek(']')) {
+ // Support trailing commas per ES5.1.
+ break;
+ }
+ elements.push(this.expression());
+ } while (this.expect(','));
+ }
+ this.consume(']');
+
+ return { type: AST.ArrayExpression, elements: elements };
+ },
+
+ object: function() {
+ var properties = [], property;
+ if (this.peekToken().text !== '}') {
+ do {
+ if (this.peek('}')) {
+ // Support trailing commas per ES5.1.
+ break;
+ }
+ property = {type: AST.Property, kind: 'init'};
+ if (this.peek().constant) {
+ property.key = this.constant();
+ } else if (this.peek().identifier) {
+ property.key = this.identifier();
+ } else {
+ this.throwError("invalid key", this.peek());
+ }
+ this.consume(':');
+ property.value = this.expression();
+ properties.push(property);
+ } while (this.expect(','));
+ }
+ this.consume('}');
+
+ return {type: AST.ObjectExpression, properties: properties };
+ },
+
+ throwError: function(msg, token) {
+ throw $parseMinErr('syntax',
+ 'Syntax Error: Token \'{0}\' {1} at column {2} of the expression [{3}] starting at [{4}].',
+ token.text, msg, (token.index + 1), this.text, this.text.substring(token.index));
+ },
+
+ consume: function(e1) {
+ if (this.tokens.length === 0) {
+ throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);
+ }
+
+ var token = this.expect(e1);
+ if (!token) {
+ this.throwError('is unexpected, expecting [' + e1 + ']', this.peek());
+ }
+ return token;
+ },
+
+ peekToken: function() {
+ if (this.tokens.length === 0) {
+ throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);
+ }
+ return this.tokens[0];
+ },
+
+ peek: function(e1, e2, e3, e4) {
+ return this.peekAhead(0, e1, e2, e3, e4);
+ },
+
+ peekAhead: function(i, e1, e2, e3, e4) {
+ if (this.tokens.length > i) {
+ var token = this.tokens[i];
+ var t = token.text;
+ if (t === e1 || t === e2 || t === e3 || t === e4 ||
+ (!e1 && !e2 && !e3 && !e4)) {
+ return token;
+ }
+ }
+ return false;
+ },
+
+ expect: function(e1, e2, e3, e4) {
+ var token = this.peek(e1, e2, e3, e4);
+ if (token) {
+ this.tokens.shift();
+ return token;
+ }
+ return false;
+ },
+
+
+ /* `undefined` is not a constant, it is an identifier,
+ * but using it as an identifier is not supported
+ */
+ constants: {
+ 'true': { type: AST.Literal, value: true },
+ 'false': { type: AST.Literal, value: false },
+ 'null': { type: AST.Literal, value: null },
+ 'undefined': {type: AST.Literal, value: undefined },
+ 'this': {type: AST.ThisExpression },
+ '$locals': {type: AST.LocalsExpression }
+ }
+};
+
+function ifDefined(v, d) {
+ return typeof v !== 'undefined' ? v : d;
+}
+
+function plusFn(l, r) {
+ if (typeof l === 'undefined') return r;
+ if (typeof r === 'undefined') return l;
+ return l + r;
+}
+
+function isStateless($filter, filterName) {
+ var fn = $filter(filterName);
+ return !fn.$stateful;
+}
+
+function findConstantAndWatchExpressions(ast, $filter) {
+ var allConstants;
+ var argsToWatch;
+ switch (ast.type) {
+ case AST.Program:
+ allConstants = true;
+ forEach(ast.body, function(expr) {
+ findConstantAndWatchExpressions(expr.expression, $filter);
+ allConstants = allConstants && expr.expression.constant;
+ });
+ ast.constant = allConstants;
+ break;
+ case AST.Literal:
+ ast.constant = true;
+ ast.toWatch = [];
+ break;
+ case AST.UnaryExpression:
+ findConstantAndWatchExpressions(ast.argument, $filter);
+ ast.constant = ast.argument.constant;
+ ast.toWatch = ast.argument.toWatch;
+ break;
+ case AST.BinaryExpression:
+ findConstantAndWatchExpressions(ast.left, $filter);
+ findConstantAndWatchExpressions(ast.right, $filter);
+ ast.constant = ast.left.constant && ast.right.constant;
+ ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch);
+ break;
+ case AST.LogicalExpression:
+ findConstantAndWatchExpressions(ast.left, $filter);
+ findConstantAndWatchExpressions(ast.right, $filter);
+ ast.constant = ast.left.constant && ast.right.constant;
+ ast.toWatch = ast.constant ? [] : [ast];
+ break;
+ case AST.ConditionalExpression:
+ findConstantAndWatchExpressions(ast.test, $filter);
+ findConstantAndWatchExpressions(ast.alternate, $filter);
+ findConstantAndWatchExpressions(ast.consequent, $filter);
+ ast.constant = ast.test.constant && ast.alternate.constant && ast.consequent.constant;
+ ast.toWatch = ast.constant ? [] : [ast];
+ break;
+ case AST.Identifier:
+ ast.constant = false;
+ ast.toWatch = [ast];
+ break;
+ case AST.MemberExpression:
+ findConstantAndWatchExpressions(ast.object, $filter);
+ if (ast.computed) {
+ findConstantAndWatchExpressions(ast.property, $filter);
+ }
+ ast.constant = ast.object.constant && (!ast.computed || ast.property.constant);
+ ast.toWatch = [ast];
+ break;
+ case AST.CallExpression:
+ allConstants = ast.filter ? isStateless($filter, ast.callee.name) : false;
+ argsToWatch = [];
+ forEach(ast.arguments, function(expr) {
+ findConstantAndWatchExpressions(expr, $filter);
+ allConstants = allConstants && expr.constant;
+ if (!expr.constant) {
+ argsToWatch.push.apply(argsToWatch, expr.toWatch);
+ }
+ });
+ ast.constant = allConstants;
+ ast.toWatch = ast.filter && isStateless($filter, ast.callee.name) ? argsToWatch : [ast];
+ break;
+ case AST.AssignmentExpression:
+ findConstantAndWatchExpressions(ast.left, $filter);
+ findConstantAndWatchExpressions(ast.right, $filter);
+ ast.constant = ast.left.constant && ast.right.constant;
+ ast.toWatch = [ast];
+ break;
+ case AST.ArrayExpression:
+ allConstants = true;
+ argsToWatch = [];
+ forEach(ast.elements, function(expr) {
+ findConstantAndWatchExpressions(expr, $filter);
+ allConstants = allConstants && expr.constant;
+ if (!expr.constant) {
+ argsToWatch.push.apply(argsToWatch, expr.toWatch);
+ }
+ });
+ ast.constant = allConstants;
+ ast.toWatch = argsToWatch;
+ break;
+ case AST.ObjectExpression:
+ allConstants = true;
+ argsToWatch = [];
+ forEach(ast.properties, function(property) {
+ findConstantAndWatchExpressions(property.value, $filter);
+ allConstants = allConstants && property.value.constant;
+ if (!property.value.constant) {
+ argsToWatch.push.apply(argsToWatch, property.value.toWatch);
+ }
+ });
+ ast.constant = allConstants;
+ ast.toWatch = argsToWatch;
+ break;
+ case AST.ThisExpression:
+ ast.constant = false;
+ ast.toWatch = [];
+ break;
+ case AST.LocalsExpression:
+ ast.constant = false;
+ ast.toWatch = [];
+ break;
+ }
+}
+
+function getInputs(body) {
+ if (body.length != 1) return;
+ var lastExpression = body[0].expression;
+ var candidate = lastExpression.toWatch;
+ if (candidate.length !== 1) return candidate;
+ return candidate[0] !== lastExpression ? candidate : undefined;
+}
+
+function isAssignable(ast) {
+ return ast.type === AST.Identifier || ast.type === AST.MemberExpression;
+}
+
+function assignableAST(ast) {
+ if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) {
+ return {type: AST.AssignmentExpression, left: ast.body[0].expression, right: {type: AST.NGValueParameter}, operator: '='};
+ }
+}
+
+function isLiteral(ast) {
+ return ast.body.length === 0 ||
+ ast.body.length === 1 && (
+ ast.body[0].expression.type === AST.Literal ||
+ ast.body[0].expression.type === AST.ArrayExpression ||
+ ast.body[0].expression.type === AST.ObjectExpression);
+}
+
+function isConstant(ast) {
+ return ast.constant;
+}
+
+function ASTCompiler(astBuilder, $filter) {
+ this.astBuilder = astBuilder;
+ this.$filter = $filter;
+}
+
+ASTCompiler.prototype = {
+ compile: function(expression, expensiveChecks) {
+ var self = this;
+ var ast = this.astBuilder.ast(expression);
+ this.state = {
+ nextId: 0,
+ filters: {},
+ expensiveChecks: expensiveChecks,
+ fn: {vars: [], body: [], own: {}},
+ assign: {vars: [], body: [], own: {}},
+ inputs: []
+ };
+ findConstantAndWatchExpressions(ast, self.$filter);
+ var extra = '';
+ var assignable;
+ this.stage = 'assign';
+ if ((assignable = assignableAST(ast))) {
+ this.state.computing = 'assign';
+ var result = this.nextId();
+ this.recurse(assignable, result);
+ this.return_(result);
+ extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l');
+ }
+ var toWatch = getInputs(ast.body);
+ self.stage = 'inputs';
+ forEach(toWatch, function(watch, key) {
+ var fnKey = 'fn' + key;
+ self.state[fnKey] = {vars: [], body: [], own: {}};
+ self.state.computing = fnKey;
+ var intoId = self.nextId();
+ self.recurse(watch, intoId);
+ self.return_(intoId);
+ self.state.inputs.push(fnKey);
+ watch.watchId = key;
+ });
+ this.state.computing = 'fn';
+ this.stage = 'main';
+ this.recurse(ast);
+ var fnString =
+ // The build and minification steps remove the string "use strict" from the code, but this is done using a regex.
+ // This is a workaround for this until we do a better job at only removing the prefix only when we should.
+ '"' + this.USE + ' ' + this.STRICT + '";\n' +
+ this.filterPrefix() +
+ 'var fn=' + this.generateFunction('fn', 's,l,a,i') +
+ extra +
+ this.watchFns() +
+ 'return fn;';
+
+ /* jshint -W054 */
+ var fn = (new Function('$filter',
+ 'ensureSafeMemberName',
+ 'ensureSafeObject',
+ 'ensureSafeFunction',
+ 'getStringValue',
+ 'ensureSafeAssignContext',
+ 'ifDefined',
+ 'plus',
+ 'text',
+ fnString))(
+ this.$filter,
+ ensureSafeMemberName,
+ ensureSafeObject,
+ ensureSafeFunction,
+ getStringValue,
+ ensureSafeAssignContext,
+ ifDefined,
+ plusFn,
+ expression);
+ /* jshint +W054 */
+ this.state = this.stage = undefined;
+ fn.literal = isLiteral(ast);
+ fn.constant = isConstant(ast);
+ return fn;
+ },
+
+ USE: 'use',
+
+ STRICT: 'strict',
+
+ watchFns: function() {
+ var result = [];
+ var fns = this.state.inputs;
+ var self = this;
+ forEach(fns, function(name) {
+ result.push('var ' + name + '=' + self.generateFunction(name, 's'));
+ });
+ if (fns.length) {
+ result.push('fn.inputs=[' + fns.join(',') + '];');
+ }
+ return result.join('');
+ },
+
+ generateFunction: function(name, params) {
+ return 'function(' + params + '){' +
+ this.varsPrefix(name) +
+ this.body(name) +
+ '};';
+ },
+
+ filterPrefix: function() {
+ var parts = [];
+ var self = this;
+ forEach(this.state.filters, function(id, filter) {
+ parts.push(id + '=$filter(' + self.escape(filter) + ')');
+ });
+ if (parts.length) return 'var ' + parts.join(',') + ';';
+ return '';
+ },
+
+ varsPrefix: function(section) {
+ return this.state[section].vars.length ? 'var ' + this.state[section].vars.join(',') + ';' : '';
+ },
+
+ body: function(section) {
+ return this.state[section].body.join('');
+ },
+
+ recurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
+ var left, right, self = this, args, expression;
+ recursionFn = recursionFn || noop;
+ if (!skipWatchIdCheck && isDefined(ast.watchId)) {
+ intoId = intoId || this.nextId();
+ this.if_('i',
+ this.lazyAssign(intoId, this.computedMember('i', ast.watchId)),
+ this.lazyRecurse(ast, intoId, nameId, recursionFn, create, true)
+ );
+ return;
+ }
+ switch (ast.type) {
+ case AST.Program:
+ forEach(ast.body, function(expression, pos) {
+ self.recurse(expression.expression, undefined, undefined, function(expr) { right = expr; });
+ if (pos !== ast.body.length - 1) {
+ self.current().body.push(right, ';');
+ } else {
+ self.return_(right);
+ }
+ });
+ break;
+ case AST.Literal:
+ expression = this.escape(ast.value);
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.UnaryExpression:
+ this.recurse(ast.argument, undefined, undefined, function(expr) { right = expr; });
+ expression = ast.operator + '(' + this.ifDefined(right, 0) + ')';
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.BinaryExpression:
+ this.recurse(ast.left, undefined, undefined, function(expr) { left = expr; });
+ this.recurse(ast.right, undefined, undefined, function(expr) { right = expr; });
+ if (ast.operator === '+') {
+ expression = this.plus(left, right);
+ } else if (ast.operator === '-') {
+ expression = this.ifDefined(left, 0) + ast.operator + this.ifDefined(right, 0);
+ } else {
+ expression = '(' + left + ')' + ast.operator + '(' + right + ')';
+ }
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.LogicalExpression:
+ intoId = intoId || this.nextId();
+ self.recurse(ast.left, intoId);
+ self.if_(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId));
+ recursionFn(intoId);
+ break;
+ case AST.ConditionalExpression:
+ intoId = intoId || this.nextId();
+ self.recurse(ast.test, intoId);
+ self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId));
+ recursionFn(intoId);
+ break;
+ case AST.Identifier:
+ intoId = intoId || this.nextId();
+ if (nameId) {
+ nameId.context = self.stage === 'inputs' ? 's' : this.assign(this.nextId(), this.getHasOwnProperty('l', ast.name) + '?l:s');
+ nameId.computed = false;
+ nameId.name = ast.name;
+ }
+ ensureSafeMemberName(ast.name);
+ self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)),
+ function() {
+ self.if_(self.stage === 'inputs' || 's', function() {
+ if (create && create !== 1) {
+ self.if_(
+ self.not(self.nonComputedMember('s', ast.name)),
+ self.lazyAssign(self.nonComputedMember('s', ast.name), '{}'));
+ }
+ self.assign(intoId, self.nonComputedMember('s', ast.name));
+ });
+ }, intoId && self.lazyAssign(intoId, self.nonComputedMember('l', ast.name))
+ );
+ if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.name)) {
+ self.addEnsureSafeObject(intoId);
+ }
+ recursionFn(intoId);
+ break;
+ case AST.MemberExpression:
+ left = nameId && (nameId.context = this.nextId()) || this.nextId();
+ intoId = intoId || this.nextId();
+ self.recurse(ast.object, left, undefined, function() {
+ self.if_(self.notNull(left), function() {
+ if (create && create !== 1) {
+ self.addEnsureSafeAssignContext(left);
+ }
+ if (ast.computed) {
+ right = self.nextId();
+ self.recurse(ast.property, right);
+ self.getStringValue(right);
+ self.addEnsureSafeMemberName(right);
+ if (create && create !== 1) {
+ self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}'));
+ }
+ expression = self.ensureSafeObject(self.computedMember(left, right));
+ self.assign(intoId, expression);
+ if (nameId) {
+ nameId.computed = true;
+ nameId.name = right;
+ }
+ } else {
+ ensureSafeMemberName(ast.property.name);
+ if (create && create !== 1) {
+ self.if_(self.not(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}'));
+ }
+ expression = self.nonComputedMember(left, ast.property.name);
+ if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.property.name)) {
+ expression = self.ensureSafeObject(expression);
+ }
+ self.assign(intoId, expression);
+ if (nameId) {
+ nameId.computed = false;
+ nameId.name = ast.property.name;
+ }
+ }
+ }, function() {
+ self.assign(intoId, 'undefined');
+ });
+ recursionFn(intoId);
+ }, !!create);
+ break;
+ case AST.CallExpression:
+ intoId = intoId || this.nextId();
+ if (ast.filter) {
+ right = self.filter(ast.callee.name);
+ args = [];
+ forEach(ast.arguments, function(expr) {
+ var argument = self.nextId();
+ self.recurse(expr, argument);
+ args.push(argument);
+ });
+ expression = right + '(' + args.join(',') + ')';
+ self.assign(intoId, expression);
+ recursionFn(intoId);
+ } else {
+ right = self.nextId();
+ left = {};
+ args = [];
+ self.recurse(ast.callee, right, left, function() {
+ self.if_(self.notNull(right), function() {
+ self.addEnsureSafeFunction(right);
+ forEach(ast.arguments, function(expr) {
+ self.recurse(expr, self.nextId(), undefined, function(argument) {
+ args.push(self.ensureSafeObject(argument));
+ });
+ });
+ if (left.name) {
+ if (!self.state.expensiveChecks) {
+ self.addEnsureSafeObject(left.context);
+ }
+ expression = self.member(left.context, left.name, left.computed) + '(' + args.join(',') + ')';
+ } else {
+ expression = right + '(' + args.join(',') + ')';
+ }
+ expression = self.ensureSafeObject(expression);
+ self.assign(intoId, expression);
+ }, function() {
+ self.assign(intoId, 'undefined');
+ });
+ recursionFn(intoId);
+ });
+ }
+ break;
+ case AST.AssignmentExpression:
+ right = this.nextId();
+ left = {};
+ if (!isAssignable(ast.left)) {
+ throw $parseMinErr('lval', 'Trying to assign a value to a non l-value');
+ }
+ this.recurse(ast.left, undefined, left, function() {
+ self.if_(self.notNull(left.context), function() {
+ self.recurse(ast.right, right);
+ self.addEnsureSafeObject(self.member(left.context, left.name, left.computed));
+ self.addEnsureSafeAssignContext(left.context);
+ expression = self.member(left.context, left.name, left.computed) + ast.operator + right;
+ self.assign(intoId, expression);
+ recursionFn(intoId || expression);
+ });
+ }, 1);
+ break;
+ case AST.ArrayExpression:
+ args = [];
+ forEach(ast.elements, function(expr) {
+ self.recurse(expr, self.nextId(), undefined, function(argument) {
+ args.push(argument);
+ });
+ });
+ expression = '[' + args.join(',') + ']';
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.ObjectExpression:
+ args = [];
+ forEach(ast.properties, function(property) {
+ self.recurse(property.value, self.nextId(), undefined, function(expr) {
+ args.push(self.escape(
+ property.key.type === AST.Identifier ? property.key.name :
+ ('' + property.key.value)) +
+ ':' + expr);
+ });
+ });
+ expression = '{' + args.join(',') + '}';
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.ThisExpression:
+ this.assign(intoId, 's');
+ recursionFn('s');
+ break;
+ case AST.LocalsExpression:
+ this.assign(intoId, 'l');
+ recursionFn('l');
+ break;
+ case AST.NGValueParameter:
+ this.assign(intoId, 'v');
+ recursionFn('v');
+ break;
+ }
+ },
+
+ getHasOwnProperty: function(element, property) {
+ var key = element + '.' + property;
+ var own = this.current().own;
+ if (!own.hasOwnProperty(key)) {
+ own[key] = this.nextId(false, element + '&&(' + this.escape(property) + ' in ' + element + ')');
+ }
+ return own[key];
+ },
+
+ assign: function(id, value) {
+ if (!id) return;
+ this.current().body.push(id, '=', value, ';');
+ return id;
+ },
+
+ filter: function(filterName) {
+ if (!this.state.filters.hasOwnProperty(filterName)) {
+ this.state.filters[filterName] = this.nextId(true);
+ }
+ return this.state.filters[filterName];
+ },
+
+ ifDefined: function(id, defaultValue) {
+ return 'ifDefined(' + id + ',' + this.escape(defaultValue) + ')';
+ },
+
+ plus: function(left, right) {
+ return 'plus(' + left + ',' + right + ')';
+ },
+
+ return_: function(id) {
+ this.current().body.push('return ', id, ';');
+ },
+
+ if_: function(test, alternate, consequent) {
+ if (test === true) {
+ alternate();
+ } else {
+ var body = this.current().body;
+ body.push('if(', test, '){');
+ alternate();
+ body.push('}');
+ if (consequent) {
+ body.push('else{');
+ consequent();
+ body.push('}');
+ }
+ }
+ },
+
+ not: function(expression) {
+ return '!(' + expression + ')';
+ },
+
+ notNull: function(expression) {
+ return expression + '!=null';
+ },
+
+ nonComputedMember: function(left, right) {
+ return left + '.' + right;
+ },
+
+ computedMember: function(left, right) {
+ return left + '[' + right + ']';
+ },
+
+ member: function(left, right, computed) {
+ if (computed) return this.computedMember(left, right);
+ return this.nonComputedMember(left, right);
+ },
+
+ addEnsureSafeObject: function(item) {
+ this.current().body.push(this.ensureSafeObject(item), ';');
+ },
+
+ addEnsureSafeMemberName: function(item) {
+ this.current().body.push(this.ensureSafeMemberName(item), ';');
+ },
+
+ addEnsureSafeFunction: function(item) {
+ this.current().body.push(this.ensureSafeFunction(item), ';');
+ },
+
+ addEnsureSafeAssignContext: function(item) {
+ this.current().body.push(this.ensureSafeAssignContext(item), ';');
+ },
+
+ ensureSafeObject: function(item) {
+ return 'ensureSafeObject(' + item + ',text)';
+ },
+
+ ensureSafeMemberName: function(item) {
+ return 'ensureSafeMemberName(' + item + ',text)';
+ },
+
+ ensureSafeFunction: function(item) {
+ return 'ensureSafeFunction(' + item + ',text)';
+ },
+
+ getStringValue: function(item) {
+ this.assign(item, 'getStringValue(' + item + ')');
+ },
+
+ ensureSafeAssignContext: function(item) {
+ return 'ensureSafeAssignContext(' + item + ',text)';
+ },
+
+ lazyRecurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
+ var self = this;
+ return function() {
+ self.recurse(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck);
+ };
+ },
+
+ lazyAssign: function(id, value) {
+ var self = this;
+ return function() {
+ self.assign(id, value);
+ };
+ },
+
+ stringEscapeRegex: /[^ a-zA-Z0-9]/g,
+
+ stringEscapeFn: function(c) {
+ return '\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4);
+ },
+
+ escape: function(value) {
+ if (isString(value)) return "'" + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + "'";
+ if (isNumber(value)) return value.toString();
+ if (value === true) return 'true';
+ if (value === false) return 'false';
+ if (value === null) return 'null';
+ if (typeof value === 'undefined') return 'undefined';
+
+ throw $parseMinErr('esc', 'IMPOSSIBLE');
+ },
+
+ nextId: function(skip, init) {
+ var id = 'v' + (this.state.nextId++);
+ if (!skip) {
+ this.current().vars.push(id + (init ? '=' + init : ''));
+ }
+ return id;
+ },
+
+ current: function() {
+ return this.state[this.state.computing];
+ }
+};
+
+
+function ASTInterpreter(astBuilder, $filter) {
+ this.astBuilder = astBuilder;
+ this.$filter = $filter;
+}
+
+ASTInterpreter.prototype = {
+ compile: function(expression, expensiveChecks) {
+ var self = this;
+ var ast = this.astBuilder.ast(expression);
+ this.expression = expression;
+ this.expensiveChecks = expensiveChecks;
+ findConstantAndWatchExpressions(ast, self.$filter);
+ var assignable;
+ var assign;
+ if ((assignable = assignableAST(ast))) {
+ assign = this.recurse(assignable);
+ }
+ var toWatch = getInputs(ast.body);
+ var inputs;
+ if (toWatch) {
+ inputs = [];
+ forEach(toWatch, function(watch, key) {
+ var input = self.recurse(watch);
+ watch.input = input;
+ inputs.push(input);
+ watch.watchId = key;
+ });
+ }
+ var expressions = [];
+ forEach(ast.body, function(expression) {
+ expressions.push(self.recurse(expression.expression));
+ });
+ var fn = ast.body.length === 0 ? function() {} :
+ ast.body.length === 1 ? expressions[0] :
+ function(scope, locals) {
+ var lastValue;
+ forEach(expressions, function(exp) {
+ lastValue = exp(scope, locals);
+ });
+ return lastValue;
+ };
+ if (assign) {
+ fn.assign = function(scope, value, locals) {
+ return assign(scope, locals, value);
+ };
+ }
+ if (inputs) {
+ fn.inputs = inputs;
+ }
+ fn.literal = isLiteral(ast);
+ fn.constant = isConstant(ast);
+ return fn;
+ },
+
+ recurse: function(ast, context, create) {
+ var left, right, self = this, args, expression;
+ if (ast.input) {
+ return this.inputs(ast.input, ast.watchId);
+ }
+ switch (ast.type) {
+ case AST.Literal:
+ return this.value(ast.value, context);
+ case AST.UnaryExpression:
+ right = this.recurse(ast.argument);
+ return this['unary' + ast.operator](right, context);
+ case AST.BinaryExpression:
+ left = this.recurse(ast.left);
+ right = this.recurse(ast.right);
+ return this['binary' + ast.operator](left, right, context);
+ case AST.LogicalExpression:
+ left = this.recurse(ast.left);
+ right = this.recurse(ast.right);
+ return this['binary' + ast.operator](left, right, context);
+ case AST.ConditionalExpression:
+ return this['ternary?:'](
+ this.recurse(ast.test),
+ this.recurse(ast.alternate),
+ this.recurse(ast.consequent),
+ context
+ );
+ case AST.Identifier:
+ ensureSafeMemberName(ast.name, self.expression);
+ return self.identifier(ast.name,
+ self.expensiveChecks || isPossiblyDangerousMemberName(ast.name),
+ context, create, self.expression);
+ case AST.MemberExpression:
+ left = this.recurse(ast.object, false, !!create);
+ if (!ast.computed) {
+ ensureSafeMemberName(ast.property.name, self.expression);
+ right = ast.property.name;
+ }
+ if (ast.computed) right = this.recurse(ast.property);
+ return ast.computed ?
+ this.computedMember(left, right, context, create, self.expression) :
+ this.nonComputedMember(left, right, self.expensiveChecks, context, create, self.expression);
+ case AST.CallExpression:
+ args = [];
+ forEach(ast.arguments, function(expr) {
+ args.push(self.recurse(expr));
+ });
+ if (ast.filter) right = this.$filter(ast.callee.name);
+ if (!ast.filter) right = this.recurse(ast.callee, true);
+ return ast.filter ?
+ function(scope, locals, assign, inputs) {
+ var values = [];
+ for (var i = 0; i < args.length; ++i) {
+ values.push(args[i](scope, locals, assign, inputs));
+ }
+ var value = right.apply(undefined, values, inputs);
+ return context ? {context: undefined, name: undefined, value: value} : value;
+ } :
+ function(scope, locals, assign, inputs) {
+ var rhs = right(scope, locals, assign, inputs);
+ var value;
+ if (rhs.value != null) {
+ ensureSafeObject(rhs.context, self.expression);
+ ensureSafeFunction(rhs.value, self.expression);
+ var values = [];
+ for (var i = 0; i < args.length; ++i) {
+ values.push(ensureSafeObject(args[i](scope, locals, assign, inputs), self.expression));
+ }
+ value = ensureSafeObject(rhs.value.apply(rhs.context, values), self.expression);
+ }
+ return context ? {value: value} : value;
+ };
+ case AST.AssignmentExpression:
+ left = this.recurse(ast.left, true, 1);
+ right = this.recurse(ast.right);
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ var rhs = right(scope, locals, assign, inputs);
+ ensureSafeObject(lhs.value, self.expression);
+ ensureSafeAssignContext(lhs.context);
+ lhs.context[lhs.name] = rhs;
+ return context ? {value: rhs} : rhs;
+ };
+ case AST.ArrayExpression:
+ args = [];
+ forEach(ast.elements, function(expr) {
+ args.push(self.recurse(expr));
+ });
+ return function(scope, locals, assign, inputs) {
+ var value = [];
+ for (var i = 0; i < args.length; ++i) {
+ value.push(args[i](scope, locals, assign, inputs));
+ }
+ return context ? {value: value} : value;
+ };
+ case AST.ObjectExpression:
+ args = [];
+ forEach(ast.properties, function(property) {
+ args.push({key: property.key.type === AST.Identifier ?
+ property.key.name :
+ ('' + property.key.value),
+ value: self.recurse(property.value)
+ });
+ });
+ return function(scope, locals, assign, inputs) {
+ var value = {};
+ for (var i = 0; i < args.length; ++i) {
+ value[args[i].key] = args[i].value(scope, locals, assign, inputs);
+ }
+ return context ? {value: value} : value;
+ };
+ case AST.ThisExpression:
+ return function(scope) {
+ return context ? {value: scope} : scope;
+ };
+ case AST.LocalsExpression:
+ return function(scope, locals) {
+ return context ? {value: locals} : locals;
+ };
+ case AST.NGValueParameter:
+ return function(scope, locals, assign, inputs) {
+ return context ? {value: assign} : assign;
+ };
+ }
+ },
+
+ 'unary+': function(argument, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = argument(scope, locals, assign, inputs);
+ if (isDefined(arg)) {
+ arg = +arg;
+ } else {
+ arg = 0;
+ }
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'unary-': function(argument, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = argument(scope, locals, assign, inputs);
+ if (isDefined(arg)) {
+ arg = -arg;
+ } else {
+ arg = 0;
+ }
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'unary!': function(argument, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = !argument(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary+': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ var rhs = right(scope, locals, assign, inputs);
+ var arg = plusFn(lhs, rhs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary-': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ var rhs = right(scope, locals, assign, inputs);
+ var arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary*': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) * right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary/': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) / right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary%': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) % right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary===': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) === right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary!==': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) !== right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary==': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary!=': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary<': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) < right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary>': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) > right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary<=': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) <= right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary>=': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) >= right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary&&': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) && right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary||': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) || right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'ternary?:': function(test, alternate, consequent, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = test(scope, locals, assign, inputs) ? alternate(scope, locals, assign, inputs) : consequent(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ value: function(value, context) {
+ return function() { return context ? {context: undefined, name: undefined, value: value} : value; };
+ },
+ identifier: function(name, expensiveChecks, context, create, expression) {
+ return function(scope, locals, assign, inputs) {
+ var base = locals && (name in locals) ? locals : scope;
+ if (create && create !== 1 && base && !(base[name])) {
+ base[name] = {};
+ }
+ var value = base ? base[name] : undefined;
+ if (expensiveChecks) {
+ ensureSafeObject(value, expression);
+ }
+ if (context) {
+ return {context: base, name: name, value: value};
+ } else {
+ return value;
+ }
+ };
+ },
+ computedMember: function(left, right, context, create, expression) {
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ var rhs;
+ var value;
+ if (lhs != null) {
+ rhs = right(scope, locals, assign, inputs);
+ rhs = getStringValue(rhs);
+ ensureSafeMemberName(rhs, expression);
+ if (create && create !== 1) {
+ ensureSafeAssignContext(lhs);
+ if (lhs && !(lhs[rhs])) {
+ lhs[rhs] = {};
+ }
+ }
+ value = lhs[rhs];
+ ensureSafeObject(value, expression);
+ }
+ if (context) {
+ return {context: lhs, name: rhs, value: value};
+ } else {
+ return value;
+ }
+ };
+ },
+ nonComputedMember: function(left, right, expensiveChecks, context, create, expression) {
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ if (create && create !== 1) {
+ ensureSafeAssignContext(lhs);
+ if (lhs && !(lhs[right])) {
+ lhs[right] = {};
+ }
+ }
+ var value = lhs != null ? lhs[right] : undefined;
+ if (expensiveChecks || isPossiblyDangerousMemberName(right)) {
+ ensureSafeObject(value, expression);
+ }
+ if (context) {
+ return {context: lhs, name: right, value: value};
+ } else {
+ return value;
+ }
+ };
+ },
+ inputs: function(input, watchId) {
+ return function(scope, value, locals, inputs) {
+ if (inputs) return inputs[watchId];
+ return input(scope, value, locals);
+ };
+ }
+};
+
+/**
+ * @constructor
+ */
+var Parser = function(lexer, $filter, options) {
+ this.lexer = lexer;
+ this.$filter = $filter;
+ this.options = options;
+ this.ast = new AST(this.lexer);
+ this.astCompiler = options.csp ? new ASTInterpreter(this.ast, $filter) :
+ new ASTCompiler(this.ast, $filter);
+};
+
+Parser.prototype = {
+ constructor: Parser,
+
+ parse: function(text) {
+ return this.astCompiler.compile(text, this.options.expensiveChecks);
+ }
+};
+
+function isPossiblyDangerousMemberName(name) {
+ return name == 'constructor';
+}
+
+var objectValueOf = Object.prototype.valueOf;
+
+function getValueOf(value) {
+ return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value);
+}
+
+///////////////////////////////////
+
+/**
+ * @ngdoc service
+ * @name $parse
+ * @kind function
+ *
+ * @description
+ *
+ * Converts Angular {@link guide/expression expression} into a function.
+ *
+ * ```js
+ * var getter = $parse('user.name');
+ * var setter = getter.assign;
+ * var context = {user:{name:'angular'}};
+ * var locals = {user:{name:'local'}};
+ *
+ * expect(getter(context)).toEqual('angular');
+ * setter(context, 'newValue');
+ * expect(context.user.name).toEqual('newValue');
+ * expect(getter(context, locals)).toEqual('local');
+ * ```
+ *
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ *
+ * The returned function also has the following properties:
+ * * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript
+ * literal.
+ * * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript
+ * constant literals.
+ * * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be
+ * set to a function to change its value on the given context.
+ *
+ */
+
+
+/**
+ * @ngdoc provider
+ * @name $parseProvider
+ *
+ * @description
+ * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}
+ * service.
+ */
+function $ParseProvider() {
+ var cacheDefault = createMap();
+ var cacheExpensive = createMap();
+
+ this.$get = ['$filter', function($filter) {
+ var noUnsafeEval = csp().noUnsafeEval;
+ var $parseOptions = {
+ csp: noUnsafeEval,
+ expensiveChecks: false
+ },
+ $parseOptionsExpensive = {
+ csp: noUnsafeEval,
+ expensiveChecks: true
+ };
+ var runningChecksEnabled = false;
+
+ $parse.$$runningExpensiveChecks = function() {
+ return runningChecksEnabled;
+ };
+
+ return $parse;
+
+ function $parse(exp, interceptorFn, expensiveChecks) {
+ var parsedExpression, oneTime, cacheKey;
+
+ expensiveChecks = expensiveChecks || runningChecksEnabled;
+
+ switch (typeof exp) {
+ case 'string':
+ exp = exp.trim();
+ cacheKey = exp;
+
+ var cache = (expensiveChecks ? cacheExpensive : cacheDefault);
+ parsedExpression = cache[cacheKey];
+
+ if (!parsedExpression) {
+ if (exp.charAt(0) === ':' && exp.charAt(1) === ':') {
+ oneTime = true;
+ exp = exp.substring(2);
+ }
+ var parseOptions = expensiveChecks ? $parseOptionsExpensive : $parseOptions;
+ var lexer = new Lexer(parseOptions);
+ var parser = new Parser(lexer, $filter, parseOptions);
+ parsedExpression = parser.parse(exp);
+ if (parsedExpression.constant) {
+ parsedExpression.$$watchDelegate = constantWatchDelegate;
+ } else if (oneTime) {
+ parsedExpression.$$watchDelegate = parsedExpression.literal ?
+ oneTimeLiteralWatchDelegate : oneTimeWatchDelegate;
+ } else if (parsedExpression.inputs) {
+ parsedExpression.$$watchDelegate = inputsWatchDelegate;
+ }
+ if (expensiveChecks) {
+ parsedExpression = expensiveChecksInterceptor(parsedExpression);
+ }
+ cache[cacheKey] = parsedExpression;
+ }
+ return addInterceptor(parsedExpression, interceptorFn);
+
+ case 'function':
+ return addInterceptor(exp, interceptorFn);
+
+ default:
+ return addInterceptor(noop, interceptorFn);
+ }
+ }
+
+ function expensiveChecksInterceptor(fn) {
+ if (!fn) return fn;
+ expensiveCheckFn.$$watchDelegate = fn.$$watchDelegate;
+ expensiveCheckFn.assign = expensiveChecksInterceptor(fn.assign);
+ expensiveCheckFn.constant = fn.constant;
+ expensiveCheckFn.literal = fn.literal;
+ for (var i = 0; fn.inputs && i < fn.inputs.length; ++i) {
+ fn.inputs[i] = expensiveChecksInterceptor(fn.inputs[i]);
+ }
+ expensiveCheckFn.inputs = fn.inputs;
+
+ return expensiveCheckFn;
+
+ function expensiveCheckFn(scope, locals, assign, inputs) {
+ var expensiveCheckOldValue = runningChecksEnabled;
+ runningChecksEnabled = true;
+ try {
+ return fn(scope, locals, assign, inputs);
+ } finally {
+ runningChecksEnabled = expensiveCheckOldValue;
+ }
+ }
+ }
+
+ function expressionInputDirtyCheck(newValue, oldValueOfValue) {
+
+ if (newValue == null || oldValueOfValue == null) { // null/undefined
+ return newValue === oldValueOfValue;
+ }
+
+ if (typeof newValue === 'object') {
+
+ // attempt to convert the value to a primitive type
+ // TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can
+ // be cheaply dirty-checked
+ newValue = getValueOf(newValue);
+
+ if (typeof newValue === 'object') {
+ // objects/arrays are not supported - deep-watching them would be too expensive
+ return false;
+ }
+
+ // fall-through to the primitive equality check
+ }
+
+ //Primitive or NaN
+ return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue);
+ }
+
+ function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) {
+ var inputExpressions = parsedExpression.inputs;
+ var lastResult;
+
+ if (inputExpressions.length === 1) {
+ var oldInputValueOf = expressionInputDirtyCheck; // init to something unique so that equals check fails
+ inputExpressions = inputExpressions[0];
+ return scope.$watch(function expressionInputWatch(scope) {
+ var newInputValue = inputExpressions(scope);
+ if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf)) {
+ lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]);
+ oldInputValueOf = newInputValue && getValueOf(newInputValue);
+ }
+ return lastResult;
+ }, listener, objectEquality, prettyPrintExpression);
+ }
+
+ var oldInputValueOfValues = [];
+ var oldInputValues = [];
+ for (var i = 0, ii = inputExpressions.length; i < ii; i++) {
+ oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails
+ oldInputValues[i] = null;
+ }
+
+ return scope.$watch(function expressionInputsWatch(scope) {
+ var changed = false;
+
+ for (var i = 0, ii = inputExpressions.length; i < ii; i++) {
+ var newInputValue = inputExpressions[i](scope);
+ if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) {
+ oldInputValues[i] = newInputValue;
+ oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue);
+ }
+ }
+
+ if (changed) {
+ lastResult = parsedExpression(scope, undefined, undefined, oldInputValues);
+ }
+
+ return lastResult;
+ }, listener, objectEquality, prettyPrintExpression);
+ }
+
+ function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression) {
+ var unwatch, lastValue;
+ return unwatch = scope.$watch(function oneTimeWatch(scope) {
+ return parsedExpression(scope);
+ }, function oneTimeListener(value, old, scope) {
+ lastValue = value;
+ if (isFunction(listener)) {
+ listener.apply(this, arguments);
+ }
+ if (isDefined(value)) {
+ scope.$$postDigest(function() {
+ if (isDefined(lastValue)) {
+ unwatch();
+ }
+ });
+ }
+ }, objectEquality);
+ }
+
+ function oneTimeLiteralWatchDelegate(scope, listener, objectEquality, parsedExpression) {
+ var unwatch, lastValue;
+ return unwatch = scope.$watch(function oneTimeWatch(scope) {
+ return parsedExpression(scope);
+ }, function oneTimeListener(value, old, scope) {
+ lastValue = value;
+ if (isFunction(listener)) {
+ listener.call(this, value, old, scope);
+ }
+ if (isAllDefined(value)) {
+ scope.$$postDigest(function() {
+ if (isAllDefined(lastValue)) unwatch();
+ });
+ }
+ }, objectEquality);
+
+ function isAllDefined(value) {
+ var allDefined = true;
+ forEach(value, function(val) {
+ if (!isDefined(val)) allDefined = false;
+ });
+ return allDefined;
+ }
+ }
+
+ function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) {
+ var unwatch;
+ return unwatch = scope.$watch(function constantWatch(scope) {
+ unwatch();
+ return parsedExpression(scope);
+ }, listener, objectEquality);
+ }
+
+ function addInterceptor(parsedExpression, interceptorFn) {
+ if (!interceptorFn) return parsedExpression;
+ var watchDelegate = parsedExpression.$$watchDelegate;
+ var useInputs = false;
+
+ var regularWatch =
+ watchDelegate !== oneTimeLiteralWatchDelegate &&
+ watchDelegate !== oneTimeWatchDelegate;
+
+ var fn = regularWatch ? function regularInterceptedExpression(scope, locals, assign, inputs) {
+ var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs);
+ return interceptorFn(value, scope, locals);
+ } : function oneTimeInterceptedExpression(scope, locals, assign, inputs) {
+ var value = parsedExpression(scope, locals, assign, inputs);
+ var result = interceptorFn(value, scope, locals);
+ // we only return the interceptor's result if the
+ // initial value is defined (for bind-once)
+ return isDefined(value) ? result : value;
+ };
+
+ // Propagate $$watchDelegates other then inputsWatchDelegate
+ if (parsedExpression.$$watchDelegate &&
+ parsedExpression.$$watchDelegate !== inputsWatchDelegate) {
+ fn.$$watchDelegate = parsedExpression.$$watchDelegate;
+ } else if (!interceptorFn.$stateful) {
+ // If there is an interceptor, but no watchDelegate then treat the interceptor like
+ // we treat filters - it is assumed to be a pure function unless flagged with $stateful
+ fn.$$watchDelegate = inputsWatchDelegate;
+ useInputs = !parsedExpression.inputs;
+ fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression];
+ }
+
+ return fn;
+ }
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $q
+ * @requires $rootScope
+ *
+ * @description
+ * A service that helps you run functions asynchronously, and use their return values (or exceptions)
+ * when they are done processing.
+ *
+ * This is an implementation of promises/deferred objects inspired by
+ * [Kris Kowal's Q](https://github.com/kriskowal/q).
+ *
+ * $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred
+ * implementations, and the other which resembles ES6 promises to some degree.
+ *
+ * # $q constructor
+ *
+ * The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver`
+ * function as the first argument. This is similar to the native Promise implementation from ES6 Harmony,
+ * see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
+ *
+ * While the constructor-style use is supported, not all of the supporting methods from ES6 Harmony promises are
+ * available yet.
+ *
+ * It can be used like so:
+ *
+ * ```js
+ * // for the purpose of this example let's assume that variables `$q` and `okToGreet`
+ * // are available in the current lexical scope (they could have been injected or passed in).
+ *
+ * function asyncGreet(name) {
+ * // perform some asynchronous operation, resolve or reject the promise when appropriate.
+ * return $q(function(resolve, reject) {
+ * setTimeout(function() {
+ * if (okToGreet(name)) {
+ * resolve('Hello, ' + name + '!');
+ * } else {
+ * reject('Greeting ' + name + ' is not allowed.');
+ * }
+ * }, 1000);
+ * });
+ * }
+ *
+ * var promise = asyncGreet('Robin Hood');
+ * promise.then(function(greeting) {
+ * alert('Success: ' + greeting);
+ * }, function(reason) {
+ * alert('Failed: ' + reason);
+ * });
+ * ```
+ *
+ * Note: progress/notify callbacks are not currently supported via the ES6-style interface.
+ *
+ * Note: unlike ES6 behavior, an exception thrown in the constructor function will NOT implicitly reject the promise.
+ *
+ * However, the more traditional CommonJS-style usage is still available, and documented below.
+ *
+ * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an
+ * interface for interacting with an object that represents the result of an action that is
+ * performed asynchronously, and may or may not be finished at any given point in time.
+ *
+ * From the perspective of dealing with error handling, deferred and promise APIs are to
+ * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.
+ *
+ * ```js
+ * // for the purpose of this example let's assume that variables `$q` and `okToGreet`
+ * // are available in the current lexical scope (they could have been injected or passed in).
+ *
+ * function asyncGreet(name) {
+ * var deferred = $q.defer();
+ *
+ * setTimeout(function() {
+ * deferred.notify('About to greet ' + name + '.');
+ *
+ * if (okToGreet(name)) {
+ * deferred.resolve('Hello, ' + name + '!');
+ * } else {
+ * deferred.reject('Greeting ' + name + ' is not allowed.');
+ * }
+ * }, 1000);
+ *
+ * return deferred.promise;
+ * }
+ *
+ * var promise = asyncGreet('Robin Hood');
+ * promise.then(function(greeting) {
+ * alert('Success: ' + greeting);
+ * }, function(reason) {
+ * alert('Failed: ' + reason);
+ * }, function(update) {
+ * alert('Got notification: ' + update);
+ * });
+ * ```
+ *
+ * At first it might not be obvious why this extra complexity is worth the trouble. The payoff
+ * comes in the way of guarantees that promise and deferred APIs make, see
+ * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md.
+ *
+ * Additionally the promise api allows for composition that is very hard to do with the
+ * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.
+ * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the
+ * section on serial or parallel joining of promises.
+ *
+ * # The Deferred API
+ *
+ * A new instance of deferred is constructed by calling `$q.defer()`.
+ *
+ * The purpose of the deferred object is to expose the associated Promise instance as well as APIs
+ * that can be used for signaling the successful or unsuccessful completion, as well as the status
+ * of the task.
+ *
+ * **Methods**
+ *
+ * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection
+ * constructed via `$q.reject`, the promise will be rejected instead.
+ * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to
+ * resolving it with a rejection constructed via `$q.reject`.
+ * - `notify(value)` - provides updates on the status of the promise's execution. This may be called
+ * multiple times before the promise is either resolved or rejected.
+ *
+ * **Properties**
+ *
+ * - promise – `{Promise}` – promise object associated with this deferred.
+ *
+ *
+ * # The Promise API
+ *
+ * A new promise instance is created when a deferred instance is created and can be retrieved by
+ * calling `deferred.promise`.
+ *
+ * The purpose of the promise object is to allow for interested parties to get access to the result
+ * of the deferred task when it completes.
+ *
+ * **Methods**
+ *
+ * - `then(successCallback, errorCallback, notifyCallback)` – regardless of when the promise was or
+ * will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously
+ * as soon as the result is available. The callbacks are called with a single argument: the result
+ * or rejection reason. Additionally, the notify callback may be called zero or more times to
+ * provide a progress indication, before the promise is resolved or rejected.
+ *
+ * This method *returns a new promise* which is resolved or rejected via the return value of the
+ * `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved
+ * with the value which is resolved in that promise using
+ * [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)).
+ * It also notifies via the return value of the `notifyCallback` method. The promise cannot be
+ * resolved or rejected from the notifyCallback method.
+ *
+ * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`
+ *
+ * - `finally(callback, notifyCallback)` – allows you to observe either the fulfillment or rejection of a promise,
+ * but to do so without modifying the final value. This is useful to release resources or do some
+ * clean-up that needs to be done whether the promise was rejected or resolved. See the [full
+ * specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for
+ * more information.
+ *
+ * # Chaining promises
+ *
+ * Because calling the `then` method of a promise returns a new derived promise, it is easily
+ * possible to create a chain of promises:
+ *
+ * ```js
+ * promiseB = promiseA.then(function(result) {
+ * return result + 1;
+ * });
+ *
+ * // promiseB will be resolved immediately after promiseA is resolved and its value
+ * // will be the result of promiseA incremented by 1
+ * ```
+ *
+ * It is possible to create chains of any length and since a promise can be resolved with another
+ * promise (which will defer its resolution further), it is possible to pause/defer resolution of
+ * the promises at any point in the chain. This makes it possible to implement powerful APIs like
+ * $http's response interceptors.
+ *
+ *
+ * # Differences between Kris Kowal's Q and $q
+ *
+ * There are two main differences:
+ *
+ * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation
+ * mechanism in angular, which means faster propagation of resolution or rejection into your
+ * models and avoiding unnecessary browser repaints, which would result in flickering UI.
+ * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains
+ * all the important functionality needed for common async tasks.
+ *
+ * # Testing
+ *
+ * ```js
+ * it('should simulate promise', inject(function($q, $rootScope) {
+ * var deferred = $q.defer();
+ * var promise = deferred.promise;
+ * var resolvedValue;
+ *
+ * promise.then(function(value) { resolvedValue = value; });
+ * expect(resolvedValue).toBeUndefined();
+ *
+ * // Simulate resolving of promise
+ * deferred.resolve(123);
+ * // Note that the 'then' function does not get called synchronously.
+ * // This is because we want the promise API to always be async, whether or not
+ * // it got called synchronously or asynchronously.
+ * expect(resolvedValue).toBeUndefined();
+ *
+ * // Propagate promise resolution to 'then' functions using $apply().
+ * $rootScope.$apply();
+ * expect(resolvedValue).toEqual(123);
+ * }));
+ * ```
+ *
+ * @param {function(function, function)} resolver Function which is responsible for resolving or
+ * rejecting the newly created promise. The first parameter is a function which resolves the
+ * promise, the second parameter is a function which rejects the promise.
+ *
+ * @returns {Promise} The newly created promise.
+ */
+function $QProvider() {
+
+ this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {
+ return qFactory(function(callback) {
+ $rootScope.$evalAsync(callback);
+ }, $exceptionHandler);
+ }];
+}
+
+function $$QProvider() {
+ this.$get = ['$browser', '$exceptionHandler', function($browser, $exceptionHandler) {
+ return qFactory(function(callback) {
+ $browser.defer(callback);
+ }, $exceptionHandler);
+ }];
+}
+
+/**
+ * Constructs a promise manager.
+ *
+ * @param {function(function)} nextTick Function for executing functions in the next turn.
+ * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for
+ * debugging purposes.
+ * @returns {object} Promise manager.
+ */
+function qFactory(nextTick, exceptionHandler) {
+ var $qMinErr = minErr('$q', TypeError);
+
+ /**
+ * @ngdoc method
+ * @name ng.$q#defer
+ * @kind function
+ *
+ * @description
+ * Creates a `Deferred` object which represents a task which will finish in the future.
+ *
+ * @returns {Deferred} Returns a new instance of deferred.
+ */
+ var defer = function() {
+ var d = new Deferred();
+ //Necessary to support unbound execution :/
+ d.resolve = simpleBind(d, d.resolve);
+ d.reject = simpleBind(d, d.reject);
+ d.notify = simpleBind(d, d.notify);
+ return d;
+ };
+
+ function Promise() {
+ this.$$state = { status: 0 };
+ }
+
+ extend(Promise.prototype, {
+ then: function(onFulfilled, onRejected, progressBack) {
+ if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) {
+ return this;
+ }
+ var result = new Deferred();
+
+ this.$$state.pending = this.$$state.pending || [];
+ this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);
+ if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);
+
+ return result.promise;
+ },
+
+ "catch": function(callback) {
+ return this.then(null, callback);
+ },
+
+ "finally": function(callback, progressBack) {
+ return this.then(function(value) {
+ return handleCallback(value, true, callback);
+ }, function(error) {
+ return handleCallback(error, false, callback);
+ }, progressBack);
+ }
+ });
+
+ //Faster, more basic than angular.bind http://jsperf.com/angular-bind-vs-custom-vs-native
+ function simpleBind(context, fn) {
+ return function(value) {
+ fn.call(context, value);
+ };
+ }
+
+ function processQueue(state) {
+ var fn, deferred, pending;
+
+ pending = state.pending;
+ state.processScheduled = false;
+ state.pending = undefined;
+ for (var i = 0, ii = pending.length; i < ii; ++i) {
+ deferred = pending[i][0];
+ fn = pending[i][state.status];
+ try {
+ if (isFunction(fn)) {
+ deferred.resolve(fn(state.value));
+ } else if (state.status === 1) {
+ deferred.resolve(state.value);
+ } else {
+ deferred.reject(state.value);
+ }
+ } catch (e) {
+ deferred.reject(e);
+ exceptionHandler(e);
+ }
+ }
+ }
+
+ function scheduleProcessQueue(state) {
+ if (state.processScheduled || !state.pending) return;
+ state.processScheduled = true;
+ nextTick(function() { processQueue(state); });
+ }
+
+ function Deferred() {
+ this.promise = new Promise();
+ }
+
+ extend(Deferred.prototype, {
+ resolve: function(val) {
+ if (this.promise.$$state.status) return;
+ if (val === this.promise) {
+ this.$$reject($qMinErr(
+ 'qcycle',
+ "Expected promise to be resolved with value other than itself '{0}'",
+ val));
+ } else {
+ this.$$resolve(val);
+ }
+
+ },
+
+ $$resolve: function(val) {
+ var then;
+ var that = this;
+ var done = false;
+ try {
+ if ((isObject(val) || isFunction(val))) then = val && val.then;
+ if (isFunction(then)) {
+ this.promise.$$state.status = -1;
+ then.call(val, resolvePromise, rejectPromise, simpleBind(this, this.notify));
+ } else {
+ this.promise.$$state.value = val;
+ this.promise.$$state.status = 1;
+ scheduleProcessQueue(this.promise.$$state);
+ }
+ } catch (e) {
+ rejectPromise(e);
+ exceptionHandler(e);
+ }
+
+ function resolvePromise(val) {
+ if (done) return;
+ done = true;
+ that.$$resolve(val);
+ }
+ function rejectPromise(val) {
+ if (done) return;
+ done = true;
+ that.$$reject(val);
+ }
+ },
+
+ reject: function(reason) {
+ if (this.promise.$$state.status) return;
+ this.$$reject(reason);
+ },
+
+ $$reject: function(reason) {
+ this.promise.$$state.value = reason;
+ this.promise.$$state.status = 2;
+ scheduleProcessQueue(this.promise.$$state);
+ },
+
+ notify: function(progress) {
+ var callbacks = this.promise.$$state.pending;
+
+ if ((this.promise.$$state.status <= 0) && callbacks && callbacks.length) {
+ nextTick(function() {
+ var callback, result;
+ for (var i = 0, ii = callbacks.length; i < ii; i++) {
+ result = callbacks[i][0];
+ callback = callbacks[i][3];
+ try {
+ result.notify(isFunction(callback) ? callback(progress) : progress);
+ } catch (e) {
+ exceptionHandler(e);
+ }
+ }
+ });
+ }
+ }
+ });
+
+ /**
+ * @ngdoc method
+ * @name $q#reject
+ * @kind function
+ *
+ * @description
+ * Creates a promise that is resolved as rejected with the specified `reason`. This api should be
+ * used to forward rejection in a chain of promises. If you are dealing with the last promise in
+ * a promise chain, you don't need to worry about it.
+ *
+ * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of
+ * `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via
+ * a promise error callback and you want to forward the error to the promise derived from the
+ * current promise, you have to "rethrow" the error by returning a rejection constructed via
+ * `reject`.
+ *
+ * ```js
+ * promiseB = promiseA.then(function(result) {
+ * // success: do something and resolve promiseB
+ * // with the old or a new result
+ * return result;
+ * }, function(reason) {
+ * // error: handle the error if possible and
+ * // resolve promiseB with newPromiseOrValue,
+ * // otherwise forward the rejection to promiseB
+ * if (canHandle(reason)) {
+ * // handle the error and recover
+ * return newPromiseOrValue;
+ * }
+ * return $q.reject(reason);
+ * });
+ * ```
+ *
+ * @param {*} reason Constant, message, exception or an object representing the rejection reason.
+ * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.
+ */
+ var reject = function(reason) {
+ var result = new Deferred();
+ result.reject(reason);
+ return result.promise;
+ };
+
+ var makePromise = function makePromise(value, resolved) {
+ var result = new Deferred();
+ if (resolved) {
+ result.resolve(value);
+ } else {
+ result.reject(value);
+ }
+ return result.promise;
+ };
+
+ var handleCallback = function handleCallback(value, isResolved, callback) {
+ var callbackOutput = null;
+ try {
+ if (isFunction(callback)) callbackOutput = callback();
+ } catch (e) {
+ return makePromise(e, false);
+ }
+ if (isPromiseLike(callbackOutput)) {
+ return callbackOutput.then(function() {
+ return makePromise(value, isResolved);
+ }, function(error) {
+ return makePromise(error, false);
+ });
+ } else {
+ return makePromise(value, isResolved);
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $q#when
+ * @kind function
+ *
+ * @description
+ * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.
+ * This is useful when you are dealing with an object that might or might not be a promise, or if
+ * the promise comes from a source that can't be trusted.
+ *
+ * @param {*} value Value or a promise
+ * @param {Function=} successCallback
+ * @param {Function=} errorCallback
+ * @param {Function=} progressCallback
+ * @returns {Promise} Returns a promise of the passed value or promise
+ */
+
+
+ var when = function(value, callback, errback, progressBack) {
+ var result = new Deferred();
+ result.resolve(value);
+ return result.promise.then(callback, errback, progressBack);
+ };
+
+ /**
+ * @ngdoc method
+ * @name $q#resolve
+ * @kind function
+ *
+ * @description
+ * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6.
+ *
+ * @param {*} value Value or a promise
+ * @param {Function=} successCallback
+ * @param {Function=} errorCallback
+ * @param {Function=} progressCallback
+ * @returns {Promise} Returns a promise of the passed value or promise
+ */
+ var resolve = when;
+
+ /**
+ * @ngdoc method
+ * @name $q#all
+ * @kind function
+ *
+ * @description
+ * Combines multiple promises into a single promise that is resolved when all of the input
+ * promises are resolved.
+ *
+ * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.
+ * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values,
+ * each value corresponding to the promise at the same index/key in the `promises` array/hash.
+ * If any of the promises is resolved with a rejection, this resulting promise will be rejected
+ * with the same rejection value.
+ */
+
+ function all(promises) {
+ var deferred = new Deferred(),
+ counter = 0,
+ results = isArray(promises) ? [] : {};
+
+ forEach(promises, function(promise, key) {
+ counter++;
+ when(promise).then(function(value) {
+ if (results.hasOwnProperty(key)) return;
+ results[key] = value;
+ if (!(--counter)) deferred.resolve(results);
+ }, function(reason) {
+ if (results.hasOwnProperty(key)) return;
+ deferred.reject(reason);
+ });
+ });
+
+ if (counter === 0) {
+ deferred.resolve(results);
+ }
+
+ return deferred.promise;
+ }
+
+ var $Q = function Q(resolver) {
+ if (!isFunction(resolver)) {
+ throw $qMinErr('norslvr', "Expected resolverFn, got '{0}'", resolver);
+ }
+
+ var deferred = new Deferred();
+
+ function resolveFn(value) {
+ deferred.resolve(value);
+ }
+
+ function rejectFn(reason) {
+ deferred.reject(reason);
+ }
+
+ resolver(resolveFn, rejectFn);
+
+ return deferred.promise;
+ };
+
+ // Let's make the instanceof operator work for promises, so that
+ // `new $q(fn) instanceof $q` would evaluate to true.
+ $Q.prototype = Promise.prototype;
+
+ $Q.defer = defer;
+ $Q.reject = reject;
+ $Q.when = when;
+ $Q.resolve = resolve;
+ $Q.all = all;
+
+ return $Q;
+}
+
+function $$RAFProvider() { //rAF
+ this.$get = ['$window', '$timeout', function($window, $timeout) {
+ var requestAnimationFrame = $window.requestAnimationFrame ||
+ $window.webkitRequestAnimationFrame;
+
+ var cancelAnimationFrame = $window.cancelAnimationFrame ||
+ $window.webkitCancelAnimationFrame ||
+ $window.webkitCancelRequestAnimationFrame;
+
+ var rafSupported = !!requestAnimationFrame;
+ var raf = rafSupported
+ ? function(fn) {
+ var id = requestAnimationFrame(fn);
+ return function() {
+ cancelAnimationFrame(id);
+ };
+ }
+ : function(fn) {
+ var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666
+ return function() {
+ $timeout.cancel(timer);
+ };
+ };
+
+ raf.supported = rafSupported;
+
+ return raf;
+ }];
+}
+
+/**
+ * DESIGN NOTES
+ *
+ * The design decisions behind the scope are heavily favored for speed and memory consumption.
+ *
+ * The typical use of scope is to watch the expressions, which most of the time return the same
+ * value as last time so we optimize the operation.
+ *
+ * Closures construction is expensive in terms of speed as well as memory:
+ * - No closures, instead use prototypical inheritance for API
+ * - Internal state needs to be stored on scope directly, which means that private state is
+ * exposed as $$____ properties
+ *
+ * Loop operations are optimized by using while(count--) { ... }
+ * - This means that in order to keep the same order of execution as addition we have to add
+ * items to the array at the beginning (unshift) instead of at the end (push)
+ *
+ * Child scopes are created and removed often
+ * - Using an array would be slow since inserts in the middle are expensive; so we use linked lists
+ *
+ * There are fewer watches than observers. This is why you don't want the observer to be implemented
+ * in the same way as watch. Watch requires return of the initialization function which is expensive
+ * to construct.
+ */
+
+
+/**
+ * @ngdoc provider
+ * @name $rootScopeProvider
+ * @description
+ *
+ * Provider for the $rootScope service.
+ */
+
+/**
+ * @ngdoc method
+ * @name $rootScopeProvider#digestTtl
+ * @description
+ *
+ * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and
+ * assuming that the model is unstable.
+ *
+ * The current default is 10 iterations.
+ *
+ * In complex applications it's possible that the dependencies between `$watch`s will result in
+ * several digest iterations. However if an application needs more than the default 10 digest
+ * iterations for its model to stabilize then you should investigate what is causing the model to
+ * continuously change during the digest.
+ *
+ * Increasing the TTL could have performance implications, so you should not change it without
+ * proper justification.
+ *
+ * @param {number} limit The number of digest iterations.
+ */
+
+
+/**
+ * @ngdoc service
+ * @name $rootScope
+ * @description
+ *
+ * Every application has a single root {@link ng.$rootScope.Scope scope}.
+ * All other scopes are descendant scopes of the root scope. Scopes provide separation
+ * between the model and the view, via a mechanism for watching the model for changes.
+ * They also provide event emission/broadcast and subscription facility. See the
+ * {@link guide/scope developer guide on scopes}.
+ */
+function $RootScopeProvider() {
+ var TTL = 10;
+ var $rootScopeMinErr = minErr('$rootScope');
+ var lastDirtyWatch = null;
+ var applyAsyncId = null;
+
+ this.digestTtl = function(value) {
+ if (arguments.length) {
+ TTL = value;
+ }
+ return TTL;
+ };
+
+ function createChildScopeClass(parent) {
+ function ChildScope() {
+ this.$$watchers = this.$$nextSibling =
+ this.$$childHead = this.$$childTail = null;
+ this.$$listeners = {};
+ this.$$listenerCount = {};
+ this.$$watchersCount = 0;
+ this.$id = nextUid();
+ this.$$ChildScope = null;
+ }
+ ChildScope.prototype = parent;
+ return ChildScope;
+ }
+
+ this.$get = ['$exceptionHandler', '$parse', '$browser',
+ function($exceptionHandler, $parse, $browser) {
+
+ function destroyChildScope($event) {
+ $event.currentScope.$$destroyed = true;
+ }
+
+ function cleanUpScope($scope) {
+
+ if (msie === 9) {
+ // There is a memory leak in IE9 if all child scopes are not disconnected
+ // completely when a scope is destroyed. So this code will recurse up through
+ // all this scopes children
+ //
+ // See issue https://github.com/angular/angular.js/issues/10706
+ $scope.$$childHead && cleanUpScope($scope.$$childHead);
+ $scope.$$nextSibling && cleanUpScope($scope.$$nextSibling);
+ }
+
+ // The code below works around IE9 and V8's memory leaks
+ //
+ // See:
+ // - https://code.google.com/p/v8/issues/detail?id=2073#c26
+ // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
+ // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
+
+ $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead =
+ $scope.$$childTail = $scope.$root = $scope.$$watchers = null;
+ }
+
+ /**
+ * @ngdoc type
+ * @name $rootScope.Scope
+ *
+ * @description
+ * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the
+ * {@link auto.$injector $injector}. Child scopes are created using the
+ * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
+ * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for
+ * an in-depth introduction and usage examples.
+ *
+ *
+ * # Inheritance
+ * A scope can inherit from a parent scope, as in this example:
+ * ```js
+ var parent = $rootScope;
+ var child = parent.$new();
+
+ parent.salutation = "Hello";
+ expect(child.salutation).toEqual('Hello');
+
+ child.salutation = "Welcome";
+ expect(child.salutation).toEqual('Welcome');
+ expect(parent.salutation).toEqual('Hello');
+ * ```
+ *
+ * When interacting with `Scope` in tests, additional helper methods are available on the
+ * instances of `Scope` type. See {@link ngMock.$rootScope.Scope ngMock Scope} for additional
+ * details.
+ *
+ *
+ * @param {Object.<string, function()>=} providers Map of service factory which need to be
+ * provided for the current scope. Defaults to {@link ng}.
+ * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should
+ * append/override services provided by `providers`. This is handy
+ * when unit-testing and having the need to override a default
+ * service.
+ * @returns {Object} Newly created scope.
+ *
+ */
+ function Scope() {
+ this.$id = nextUid();
+ this.$$phase = this.$parent = this.$$watchers =
+ this.$$nextSibling = this.$$prevSibling =
+ this.$$childHead = this.$$childTail = null;
+ this.$root = this;
+ this.$$destroyed = false;
+ this.$$listeners = {};
+ this.$$listenerCount = {};
+ this.$$watchersCount = 0;
+ this.$$isolateBindings = null;
+ }
+
+ /**
+ * @ngdoc property
+ * @name $rootScope.Scope#$id
+ *
+ * @description
+ * Unique scope ID (monotonically increasing) useful for debugging.
+ */
+
+ /**
+ * @ngdoc property
+ * @name $rootScope.Scope#$parent
+ *
+ * @description
+ * Reference to the parent scope.
+ */
+
+ /**
+ * @ngdoc property
+ * @name $rootScope.Scope#$root
+ *
+ * @description
+ * Reference to the root scope.
+ */
+
+ Scope.prototype = {
+ constructor: Scope,
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$new
+ * @kind function
+ *
+ * @description
+ * Creates a new child {@link ng.$rootScope.Scope scope}.
+ *
+ * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event.
+ * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.
+ *
+ * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is
+ * desired for the scope and its child scopes to be permanently detached from the parent and
+ * thus stop participating in model change detection and listener notification by invoking.
+ *
+ * @param {boolean} isolate If true, then the scope does not prototypically inherit from the
+ * parent scope. The scope is isolated, as it can not see parent scope properties.
+ * When creating widgets, it is useful for the widget to not accidentally read parent
+ * state.
+ *
+ * @param {Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent`
+ * of the newly created scope. Defaults to `this` scope if not provided.
+ * This is used when creating a transclude scope to correctly place it
+ * in the scope hierarchy while maintaining the correct prototypical
+ * inheritance.
+ *
+ * @returns {Object} The newly created child scope.
+ *
+ */
+ $new: function(isolate, parent) {
+ var child;
+
+ parent = parent || this;
+
+ if (isolate) {
+ child = new Scope();
+ child.$root = this.$root;
+ } else {
+ // Only create a child scope class if somebody asks for one,
+ // but cache it to allow the VM to optimize lookups.
+ if (!this.$$ChildScope) {
+ this.$$ChildScope = createChildScopeClass(this);
+ }
+ child = new this.$$ChildScope();
+ }
+ child.$parent = parent;
+ child.$$prevSibling = parent.$$childTail;
+ if (parent.$$childHead) {
+ parent.$$childTail.$$nextSibling = child;
+ parent.$$childTail = child;
+ } else {
+ parent.$$childHead = parent.$$childTail = child;
+ }
+
+ // When the new scope is not isolated or we inherit from `this`, and
+ // the parent scope is destroyed, the property `$$destroyed` is inherited
+ // prototypically. In all other cases, this property needs to be set
+ // when the parent scope is destroyed.
+ // The listener needs to be added after the parent is set
+ if (isolate || parent != this) child.$on('$destroy', destroyChildScope);
+
+ return child;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$watch
+ * @kind function
+ *
+ * @description
+ * Registers a `listener` callback to be executed whenever the `watchExpression` changes.
+ *
+ * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest
+ * $digest()} and should return the value that will be watched. (`watchExpression` should not change
+ * its value when executed multiple times with the same input because it may be executed multiple
+ * times by {@link ng.$rootScope.Scope#$digest $digest()}. That is, `watchExpression` should be
+ * [idempotent](http://en.wikipedia.org/wiki/Idempotence).
+ * - The `listener` is called only when the value from the current `watchExpression` and the
+ * previous call to `watchExpression` are not equal (with the exception of the initial run,
+ * see below). Inequality is determined according to reference inequality,
+ * [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators)
+ * via the `!==` Javascript operator, unless `objectEquality == true`
+ * (see next point)
+ * - When `objectEquality == true`, inequality of the `watchExpression` is determined
+ * according to the {@link angular.equals} function. To save the value of the object for
+ * later comparison, the {@link angular.copy} function is used. This therefore means that
+ * watching complex objects will have adverse memory and performance implications.
+ * - The watch `listener` may change the model, which may trigger other `listener`s to fire.
+ * This is achieved by rerunning the watchers until no changes are detected. The rerun
+ * iteration limit is 10 to prevent an infinite loop deadlock.
+ *
+ *
+ * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,
+ * you can register a `watchExpression` function with no `listener`. (Be prepared for
+ * multiple calls to your `watchExpression` because it will execute multiple times in a
+ * single {@link ng.$rootScope.Scope#$digest $digest} cycle if a change is detected.)
+ *
+ * After a watcher is registered with the scope, the `listener` fn is called asynchronously
+ * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the
+ * watcher. In rare cases, this is undesirable because the listener is called when the result
+ * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you
+ * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the
+ * listener was called due to initialization.
+ *
+ *
+ *
+ * # Example
+ * ```js
+ // let's assume that scope was dependency injected as the $rootScope
+ var scope = $rootScope;
+ scope.name = 'misko';
+ scope.counter = 0;
+
+ expect(scope.counter).toEqual(0);
+ scope.$watch('name', function(newValue, oldValue) {
+ scope.counter = scope.counter + 1;
+ });
+ expect(scope.counter).toEqual(0);
+
+ scope.$digest();
+ // the listener is always called during the first $digest loop after it was registered
+ expect(scope.counter).toEqual(1);
+
+ scope.$digest();
+ // but now it will not be called unless the value changes
+ expect(scope.counter).toEqual(1);
+
+ scope.name = 'adam';
+ scope.$digest();
+ expect(scope.counter).toEqual(2);
+
+
+
+ // Using a function as a watchExpression
+ var food;
+ scope.foodCounter = 0;
+ expect(scope.foodCounter).toEqual(0);
+ scope.$watch(
+ // This function returns the value being watched. It is called for each turn of the $digest loop
+ function() { return food; },
+ // This is the change listener, called when the value returned from the above function changes
+ function(newValue, oldValue) {
+ if ( newValue !== oldValue ) {
+ // Only increment the counter if the value changed
+ scope.foodCounter = scope.foodCounter + 1;
+ }
+ }
+ );
+ // No digest has been run so the counter will be zero
+ expect(scope.foodCounter).toEqual(0);
+
+ // Run the digest but since food has not changed count will still be zero
+ scope.$digest();
+ expect(scope.foodCounter).toEqual(0);
+
+ // Update food and run digest. Now the counter will increment
+ food = 'cheeseburger';
+ scope.$digest();
+ expect(scope.foodCounter).toEqual(1);
+
+ * ```
+ *
+ *
+ *
+ * @param {(function()|string)} watchExpression Expression that is evaluated on each
+ * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers
+ * a call to the `listener`.
+ *
+ * - `string`: Evaluated as {@link guide/expression expression}
+ * - `function(scope)`: called with current `scope` as a parameter.
+ * @param {function(newVal, oldVal, scope)} listener Callback called whenever the value
+ * of `watchExpression` changes.
+ *
+ * - `newVal` contains the current value of the `watchExpression`
+ * - `oldVal` contains the previous value of the `watchExpression`
+ * - `scope` refers to the current scope
+ * @param {boolean=} [objectEquality=false] Compare for object equality using {@link angular.equals} instead of
+ * comparing for reference equality.
+ * @returns {function()} Returns a deregistration function for this listener.
+ */
+ $watch: function(watchExp, listener, objectEquality, prettyPrintExpression) {
+ var get = $parse(watchExp);
+
+ if (get.$$watchDelegate) {
+ return get.$$watchDelegate(this, listener, objectEquality, get, watchExp);
+ }
+ var scope = this,
+ array = scope.$$watchers,
+ watcher = {
+ fn: listener,
+ last: initWatchVal,
+ get: get,
+ exp: prettyPrintExpression || watchExp,
+ eq: !!objectEquality
+ };
+
+ lastDirtyWatch = null;
+
+ if (!isFunction(listener)) {
+ watcher.fn = noop;
+ }
+
+ if (!array) {
+ array = scope.$$watchers = [];
+ }
+ // we use unshift since we use a while loop in $digest for speed.
+ // the while loop reads in reverse order.
+ array.unshift(watcher);
+ incrementWatchersCount(this, 1);
+
+ return function deregisterWatch() {
+ if (arrayRemove(array, watcher) >= 0) {
+ incrementWatchersCount(scope, -1);
+ }
+ lastDirtyWatch = null;
+ };
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$watchGroup
+ * @kind function
+ *
+ * @description
+ * A variant of {@link ng.$rootScope.Scope#$watch $watch()} where it watches an array of `watchExpressions`.
+ * If any one expression in the collection changes the `listener` is executed.
+ *
+ * - The items in the `watchExpressions` array are observed via standard $watch operation and are examined on every
+ * call to $digest() to see if any items changes.
+ * - The `listener` is called whenever any expression in the `watchExpressions` array changes.
+ *
+ * @param {Array.<string|Function(scope)>} watchExpressions Array of expressions that will be individually
+ * watched using {@link ng.$rootScope.Scope#$watch $watch()}
+ *
+ * @param {function(newValues, oldValues, scope)} listener Callback called whenever the return value of any
+ * expression in `watchExpressions` changes
+ * The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching
+ * those of `watchExpression`
+ * and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching
+ * those of `watchExpression`
+ * The `scope` refers to the current scope.
+ * @returns {function()} Returns a de-registration function for all listeners.
+ */
+ $watchGroup: function(watchExpressions, listener) {
+ var oldValues = new Array(watchExpressions.length);
+ var newValues = new Array(watchExpressions.length);
+ var deregisterFns = [];
+ var self = this;
+ var changeReactionScheduled = false;
+ var firstRun = true;
+
+ if (!watchExpressions.length) {
+ // No expressions means we call the listener ASAP
+ var shouldCall = true;
+ self.$evalAsync(function() {
+ if (shouldCall) listener(newValues, newValues, self);
+ });
+ return function deregisterWatchGroup() {
+ shouldCall = false;
+ };
+ }
+
+ if (watchExpressions.length === 1) {
+ // Special case size of one
+ return this.$watch(watchExpressions[0], function watchGroupAction(value, oldValue, scope) {
+ newValues[0] = value;
+ oldValues[0] = oldValue;
+ listener(newValues, (value === oldValue) ? newValues : oldValues, scope);
+ });
+ }
+
+ forEach(watchExpressions, function(expr, i) {
+ var unwatchFn = self.$watch(expr, function watchGroupSubAction(value, oldValue) {
+ newValues[i] = value;
+ oldValues[i] = oldValue;
+ if (!changeReactionScheduled) {
+ changeReactionScheduled = true;
+ self.$evalAsync(watchGroupAction);
+ }
+ });
+ deregisterFns.push(unwatchFn);
+ });
+
+ function watchGroupAction() {
+ changeReactionScheduled = false;
+
+ if (firstRun) {
+ firstRun = false;
+ listener(newValues, newValues, self);
+ } else {
+ listener(newValues, oldValues, self);
+ }
+ }
+
+ return function deregisterWatchGroup() {
+ while (deregisterFns.length) {
+ deregisterFns.shift()();
+ }
+ };
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$watchCollection
+ * @kind function
+ *
+ * @description
+ * Shallow watches the properties of an object and fires whenever any of the properties change
+ * (for arrays, this implies watching the array items; for object maps, this implies watching
+ * the properties). If a change is detected, the `listener` callback is fired.
+ *
+ * - The `obj` collection is observed via standard $watch operation and is examined on every
+ * call to $digest() to see if any items have been added, removed, or moved.
+ * - The `listener` is called whenever anything within the `obj` has changed. Examples include
+ * adding, removing, and moving items belonging to an object or array.
+ *
+ *
+ * # Example
+ * ```js
+ $scope.names = ['igor', 'matias', 'misko', 'james'];
+ $scope.dataCount = 4;
+
+ $scope.$watchCollection('names', function(newNames, oldNames) {
+ $scope.dataCount = newNames.length;
+ });
+
+ expect($scope.dataCount).toEqual(4);
+ $scope.$digest();
+
+ //still at 4 ... no changes
+ expect($scope.dataCount).toEqual(4);
+
+ $scope.names.pop();
+ $scope.$digest();
+
+ //now there's been a change
+ expect($scope.dataCount).toEqual(3);
+ * ```
+ *
+ *
+ * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The
+ * expression value should evaluate to an object or an array which is observed on each
+ * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the
+ * collection will trigger a call to the `listener`.
+ *
+ * @param {function(newCollection, oldCollection, scope)} listener a callback function called
+ * when a change is detected.
+ * - The `newCollection` object is the newly modified data obtained from the `obj` expression
+ * - The `oldCollection` object is a copy of the former collection data.
+ * Due to performance considerations, the`oldCollection` value is computed only if the
+ * `listener` function declares two or more arguments.
+ * - The `scope` argument refers to the current scope.
+ *
+ * @returns {function()} Returns a de-registration function for this listener. When the
+ * de-registration function is executed, the internal watch operation is terminated.
+ */
+ $watchCollection: function(obj, listener) {
+ $watchCollectionInterceptor.$stateful = true;
+
+ var self = this;
+ // the current value, updated on each dirty-check run
+ var newValue;
+ // a shallow copy of the newValue from the last dirty-check run,
+ // updated to match newValue during dirty-check run
+ var oldValue;
+ // a shallow copy of the newValue from when the last change happened
+ var veryOldValue;
+ // only track veryOldValue if the listener is asking for it
+ var trackVeryOldValue = (listener.length > 1);
+ var changeDetected = 0;
+ var changeDetector = $parse(obj, $watchCollectionInterceptor);
+ var internalArray = [];
+ var internalObject = {};
+ var initRun = true;
+ var oldLength = 0;
+
+ function $watchCollectionInterceptor(_value) {
+ newValue = _value;
+ var newLength, key, bothNaN, newItem, oldItem;
+
+ // If the new value is undefined, then return undefined as the watch may be a one-time watch
+ if (isUndefined(newValue)) return;
+
+ if (!isObject(newValue)) { // if primitive
+ if (oldValue !== newValue) {
+ oldValue = newValue;
+ changeDetected++;
+ }
+ } else if (isArrayLike(newValue)) {
+ if (oldValue !== internalArray) {
+ // we are transitioning from something which was not an array into array.
+ oldValue = internalArray;
+ oldLength = oldValue.length = 0;
+ changeDetected++;
+ }
+
+ newLength = newValue.length;
+
+ if (oldLength !== newLength) {
+ // if lengths do not match we need to trigger change notification
+ changeDetected++;
+ oldValue.length = oldLength = newLength;
+ }
+ // copy the items to oldValue and look for changes.
+ for (var i = 0; i < newLength; i++) {
+ oldItem = oldValue[i];
+ newItem = newValue[i];
+
+ bothNaN = (oldItem !== oldItem) && (newItem !== newItem);
+ if (!bothNaN && (oldItem !== newItem)) {
+ changeDetected++;
+ oldValue[i] = newItem;
+ }
+ }
+ } else {
+ if (oldValue !== internalObject) {
+ // we are transitioning from something which was not an object into object.
+ oldValue = internalObject = {};
+ oldLength = 0;
+ changeDetected++;
+ }
+ // copy the items to oldValue and look for changes.
+ newLength = 0;
+ for (key in newValue) {
+ if (hasOwnProperty.call(newValue, key)) {
+ newLength++;
+ newItem = newValue[key];
+ oldItem = oldValue[key];
+
+ if (key in oldValue) {
+ bothNaN = (oldItem !== oldItem) && (newItem !== newItem);
+ if (!bothNaN && (oldItem !== newItem)) {
+ changeDetected++;
+ oldValue[key] = newItem;
+ }
+ } else {
+ oldLength++;
+ oldValue[key] = newItem;
+ changeDetected++;
+ }
+ }
+ }
+ if (oldLength > newLength) {
+ // we used to have more keys, need to find them and destroy them.
+ changeDetected++;
+ for (key in oldValue) {
+ if (!hasOwnProperty.call(newValue, key)) {
+ oldLength--;
+ delete oldValue[key];
+ }
+ }
+ }
+ }
+ return changeDetected;
+ }
+
+ function $watchCollectionAction() {
+ if (initRun) {
+ initRun = false;
+ listener(newValue, newValue, self);
+ } else {
+ listener(newValue, veryOldValue, self);
+ }
+
+ // make a copy for the next time a collection is changed
+ if (trackVeryOldValue) {
+ if (!isObject(newValue)) {
+ //primitive
+ veryOldValue = newValue;
+ } else if (isArrayLike(newValue)) {
+ veryOldValue = new Array(newValue.length);
+ for (var i = 0; i < newValue.length; i++) {
+ veryOldValue[i] = newValue[i];
+ }
+ } else { // if object
+ veryOldValue = {};
+ for (var key in newValue) {
+ if (hasOwnProperty.call(newValue, key)) {
+ veryOldValue[key] = newValue[key];
+ }
+ }
+ }
+ }
+ }
+
+ return this.$watch(changeDetector, $watchCollectionAction);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$digest
+ * @kind function
+ *
+ * @description
+ * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and
+ * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change
+ * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}
+ * until no more listeners are firing. This means that it is possible to get into an infinite
+ * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of
+ * iterations exceeds 10.
+ *
+ * Usually, you don't call `$digest()` directly in
+ * {@link ng.directive:ngController controllers} or in
+ * {@link ng.$compileProvider#directive directives}.
+ * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within
+ * a {@link ng.$compileProvider#directive directive}), which will force a `$digest()`.
+ *
+ * If you want to be notified whenever `$digest()` is called,
+ * you can register a `watchExpression` function with
+ * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.
+ *
+ * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
+ *
+ * # Example
+ * ```js
+ var scope = ...;
+ scope.name = 'misko';
+ scope.counter = 0;
+
+ expect(scope.counter).toEqual(0);
+ scope.$watch('name', function(newValue, oldValue) {
+ scope.counter = scope.counter + 1;
+ });
+ expect(scope.counter).toEqual(0);
+
+ scope.$digest();
+ // the listener is always called during the first $digest loop after it was registered
+ expect(scope.counter).toEqual(1);
+
+ scope.$digest();
+ // but now it will not be called unless the value changes
+ expect(scope.counter).toEqual(1);
+
+ scope.name = 'adam';
+ scope.$digest();
+ expect(scope.counter).toEqual(2);
+ * ```
+ *
+ */
+ $digest: function() {
+ var watch, value, last, fn, get,
+ watchers,
+ length,
+ dirty, ttl = TTL,
+ next, current, target = this,
+ watchLog = [],
+ logIdx, logMsg, asyncTask;
+
+ beginPhase('$digest');
+ // Check for changes to browser url that happened in sync before the call to $digest
+ $browser.$$checkUrlChange();
+
+ if (this === $rootScope && applyAsyncId !== null) {
+ // If this is the root scope, and $applyAsync has scheduled a deferred $apply(), then
+ // cancel the scheduled $apply and flush the queue of expressions to be evaluated.
+ $browser.defer.cancel(applyAsyncId);
+ flushApplyAsync();
+ }
+
+ lastDirtyWatch = null;
+
+ do { // "while dirty" loop
+ dirty = false;
+ current = target;
+
+ while (asyncQueue.length) {
+ try {
+ asyncTask = asyncQueue.shift();
+ asyncTask.scope.$eval(asyncTask.expression, asyncTask.locals);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ lastDirtyWatch = null;
+ }
+
+ traverseScopesLoop:
+ do { // "traverse the scopes" loop
+ if ((watchers = current.$$watchers)) {
+ // process our watches
+ length = watchers.length;
+ while (length--) {
+ try {
+ watch = watchers[length];
+ // Most common watches are on primitives, in which case we can short
+ // circuit it with === operator, only when === fails do we use .equals
+ if (watch) {
+ get = watch.get;
+ if ((value = get(current)) !== (last = watch.last) &&
+ !(watch.eq
+ ? equals(value, last)
+ : (typeof value === 'number' && typeof last === 'number'
+ && isNaN(value) && isNaN(last)))) {
+ dirty = true;
+ lastDirtyWatch = watch;
+ watch.last = watch.eq ? copy(value, null) : value;
+ fn = watch.fn;
+ fn(value, ((last === initWatchVal) ? value : last), current);
+ if (ttl < 5) {
+ logIdx = 4 - ttl;
+ if (!watchLog[logIdx]) watchLog[logIdx] = [];
+ watchLog[logIdx].push({
+ msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp,
+ newVal: value,
+ oldVal: last
+ });
+ }
+ } else if (watch === lastDirtyWatch) {
+ // If the most recently dirty watcher is now clean, short circuit since the remaining watchers
+ // have already been tested.
+ dirty = false;
+ break traverseScopesLoop;
+ }
+ }
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ }
+
+ // Insanity Warning: scope depth-first traversal
+ // yes, this code is a bit crazy, but it works and we have tests to prove it!
+ // this piece should be kept in sync with the traversal in $broadcast
+ if (!(next = ((current.$$watchersCount && current.$$childHead) ||
+ (current !== target && current.$$nextSibling)))) {
+ while (current !== target && !(next = current.$$nextSibling)) {
+ current = current.$parent;
+ }
+ }
+ } while ((current = next));
+
+ // `break traverseScopesLoop;` takes us to here
+
+ if ((dirty || asyncQueue.length) && !(ttl--)) {
+ clearPhase();
+ throw $rootScopeMinErr('infdig',
+ '{0} $digest() iterations reached. Aborting!\n' +
+ 'Watchers fired in the last 5 iterations: {1}',
+ TTL, watchLog);
+ }
+
+ } while (dirty || asyncQueue.length);
+
+ clearPhase();
+
+ while (postDigestQueue.length) {
+ try {
+ postDigestQueue.shift()();
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ },
+
+
+ /**
+ * @ngdoc event
+ * @name $rootScope.Scope#$destroy
+ * @eventType broadcast on scope being destroyed
+ *
+ * @description
+ * Broadcasted when a scope and its children are being destroyed.
+ *
+ * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
+ * clean up DOM bindings before an element is removed from the DOM.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$destroy
+ * @kind function
+ *
+ * @description
+ * Removes the current scope (and all of its children) from the parent scope. Removal implies
+ * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer
+ * propagate to the current scope and its children. Removal also implies that the current
+ * scope is eligible for garbage collection.
+ *
+ * The `$destroy()` is usually used by directives such as
+ * {@link ng.directive:ngRepeat ngRepeat} for managing the
+ * unrolling of the loop.
+ *
+ * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.
+ * Application code can register a `$destroy` event handler that will give it a chance to
+ * perform any necessary cleanup.
+ *
+ * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
+ * clean up DOM bindings before an element is removed from the DOM.
+ */
+ $destroy: function() {
+ // We can't destroy a scope that has been already destroyed.
+ if (this.$$destroyed) return;
+ var parent = this.$parent;
+
+ this.$broadcast('$destroy');
+ this.$$destroyed = true;
+
+ if (this === $rootScope) {
+ //Remove handlers attached to window when $rootScope is removed
+ $browser.$$applicationDestroyed();
+ }
+
+ incrementWatchersCount(this, -this.$$watchersCount);
+ for (var eventName in this.$$listenerCount) {
+ decrementListenerCount(this, this.$$listenerCount[eventName], eventName);
+ }
+
+ // sever all the references to parent scopes (after this cleanup, the current scope should
+ // not be retained by any of our references and should be eligible for garbage collection)
+ if (parent && parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
+ if (parent && parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
+ if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
+ if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
+
+ // Disable listeners, watchers and apply/digest methods
+ this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop;
+ this.$on = this.$watch = this.$watchGroup = function() { return noop; };
+ this.$$listeners = {};
+
+ // Disconnect the next sibling to prevent `cleanUpScope` destroying those too
+ this.$$nextSibling = null;
+ cleanUpScope(this);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$eval
+ * @kind function
+ *
+ * @description
+ * Executes the `expression` on the current scope and returns the result. Any exceptions in
+ * the expression are propagated (uncaught). This is useful when evaluating Angular
+ * expressions.
+ *
+ * # Example
+ * ```js
+ var scope = ng.$rootScope.Scope();
+ scope.a = 1;
+ scope.b = 2;
+
+ expect(scope.$eval('a+b')).toEqual(3);
+ expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
+ * ```
+ *
+ * @param {(string|function())=} expression An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with the current `scope` parameter.
+ *
+ * @param {(object)=} locals Local variables object, useful for overriding values in scope.
+ * @returns {*} The result of evaluating the expression.
+ */
+ $eval: function(expr, locals) {
+ return $parse(expr)(this, locals);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$evalAsync
+ * @kind function
+ *
+ * @description
+ * Executes the expression on the current scope at a later point in time.
+ *
+ * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only
+ * that:
+ *
+ * - it will execute after the function that scheduled the evaluation (preferably before DOM
+ * rendering).
+ * - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after
+ * `expression` execution.
+ *
+ * Any exceptions from the execution of the expression are forwarded to the
+ * {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle
+ * will be scheduled. However, it is encouraged to always call code that changes the model
+ * from within an `$apply` call. That includes code evaluated via `$evalAsync`.
+ *
+ * @param {(string|function())=} expression An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with the current `scope` parameter.
+ *
+ * @param {(object)=} locals Local variables object, useful for overriding values in scope.
+ */
+ $evalAsync: function(expr, locals) {
+ // if we are outside of an $digest loop and this is the first time we are scheduling async
+ // task also schedule async auto-flush
+ if (!$rootScope.$$phase && !asyncQueue.length) {
+ $browser.defer(function() {
+ if (asyncQueue.length) {
+ $rootScope.$digest();
+ }
+ });
+ }
+
+ asyncQueue.push({scope: this, expression: $parse(expr), locals: locals});
+ },
+
+ $$postDigest: function(fn) {
+ postDigestQueue.push(fn);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$apply
+ * @kind function
+ *
+ * @description
+ * `$apply()` is used to execute an expression in angular from outside of the angular
+ * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).
+ * Because we are calling into the angular framework we need to perform proper scope life
+ * cycle of {@link ng.$exceptionHandler exception handling},
+ * {@link ng.$rootScope.Scope#$digest executing watches}.
+ *
+ * ## Life cycle
+ *
+ * # Pseudo-Code of `$apply()`
+ * ```js
+ function $apply(expr) {
+ try {
+ return $eval(expr);
+ } catch (e) {
+ $exceptionHandler(e);
+ } finally {
+ $root.$digest();
+ }
+ }
+ * ```
+ *
+ *
+ * Scope's `$apply()` method transitions through the following stages:
+ *
+ * 1. The {@link guide/expression expression} is executed using the
+ * {@link ng.$rootScope.Scope#$eval $eval()} method.
+ * 2. Any exceptions from the execution of the expression are forwarded to the
+ * {@link ng.$exceptionHandler $exceptionHandler} service.
+ * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the
+ * expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.
+ *
+ *
+ * @param {(string|function())=} exp An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with current `scope` parameter.
+ *
+ * @returns {*} The result of evaluating the expression.
+ */
+ $apply: function(expr) {
+ try {
+ beginPhase('$apply');
+ try {
+ return this.$eval(expr);
+ } finally {
+ clearPhase();
+ }
+ } catch (e) {
+ $exceptionHandler(e);
+ } finally {
+ try {
+ $rootScope.$digest();
+ } catch (e) {
+ $exceptionHandler(e);
+ throw e;
+ }
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$applyAsync
+ * @kind function
+ *
+ * @description
+ * Schedule the invocation of $apply to occur at a later time. The actual time difference
+ * varies across browsers, but is typically around ~10 milliseconds.
+ *
+ * This can be used to queue up multiple expressions which need to be evaluated in the same
+ * digest.
+ *
+ * @param {(string|function())=} exp An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with current `scope` parameter.
+ */
+ $applyAsync: function(expr) {
+ var scope = this;
+ expr && applyAsyncQueue.push($applyAsyncExpression);
+ expr = $parse(expr);
+ scheduleApplyAsync();
+
+ function $applyAsyncExpression() {
+ scope.$eval(expr);
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$on
+ * @kind function
+ *
+ * @description
+ * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for
+ * discussion of event life cycle.
+ *
+ * The event listener function format is: `function(event, args...)`. The `event` object
+ * passed into the listener has the following attributes:
+ *
+ * - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or
+ * `$broadcast`-ed.
+ * - `currentScope` - `{Scope}`: the scope that is currently handling the event. Once the
+ * event propagates through the scope hierarchy, this property is set to null.
+ * - `name` - `{string}`: name of the event.
+ * - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel
+ * further event propagation (available only for events that were `$emit`-ed).
+ * - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag
+ * to true.
+ * - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
+ *
+ * @param {string} name Event name to listen on.
+ * @param {function(event, ...args)} listener Function to call when the event is emitted.
+ * @returns {function()} Returns a deregistration function for this listener.
+ */
+ $on: function(name, listener) {
+ var namedListeners = this.$$listeners[name];
+ if (!namedListeners) {
+ this.$$listeners[name] = namedListeners = [];
+ }
+ namedListeners.push(listener);
+
+ var current = this;
+ do {
+ if (!current.$$listenerCount[name]) {
+ current.$$listenerCount[name] = 0;
+ }
+ current.$$listenerCount[name]++;
+ } while ((current = current.$parent));
+
+ var self = this;
+ return function() {
+ var indexOfListener = namedListeners.indexOf(listener);
+ if (indexOfListener !== -1) {
+ namedListeners[indexOfListener] = null;
+ decrementListenerCount(self, 1, name);
+ }
+ };
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$emit
+ * @kind function
+ *
+ * @description
+ * Dispatches an event `name` upwards through the scope hierarchy notifying the
+ * registered {@link ng.$rootScope.Scope#$on} listeners.
+ *
+ * The event life cycle starts at the scope on which `$emit` was called. All
+ * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
+ * notified. Afterwards, the event traverses upwards toward the root scope and calls all
+ * registered listeners along the way. The event will stop propagating if one of the listeners
+ * cancels it.
+ *
+ * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
+ * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * @param {string} name Event name to emit.
+ * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
+ * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).
+ */
+ $emit: function(name, args) {
+ var empty = [],
+ namedListeners,
+ scope = this,
+ stopPropagation = false,
+ event = {
+ name: name,
+ targetScope: scope,
+ stopPropagation: function() {stopPropagation = true;},
+ preventDefault: function() {
+ event.defaultPrevented = true;
+ },
+ defaultPrevented: false
+ },
+ listenerArgs = concat([event], arguments, 1),
+ i, length;
+
+ do {
+ namedListeners = scope.$$listeners[name] || empty;
+ event.currentScope = scope;
+ for (i = 0, length = namedListeners.length; i < length; i++) {
+
+ // if listeners were deregistered, defragment the array
+ if (!namedListeners[i]) {
+ namedListeners.splice(i, 1);
+ i--;
+ length--;
+ continue;
+ }
+ try {
+ //allow all listeners attached to the current scope to run
+ namedListeners[i].apply(null, listenerArgs);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ //if any listener on the current scope stops propagation, prevent bubbling
+ if (stopPropagation) {
+ event.currentScope = null;
+ return event;
+ }
+ //traverse upwards
+ scope = scope.$parent;
+ } while (scope);
+
+ event.currentScope = null;
+
+ return event;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$broadcast
+ * @kind function
+ *
+ * @description
+ * Dispatches an event `name` downwards to all child scopes (and their children) notifying the
+ * registered {@link ng.$rootScope.Scope#$on} listeners.
+ *
+ * The event life cycle starts at the scope on which `$broadcast` was called. All
+ * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
+ * notified. Afterwards, the event propagates to all direct and indirect scopes of the current
+ * scope and calls all registered listeners along the way. The event cannot be canceled.
+ *
+ * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
+ * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * @param {string} name Event name to broadcast.
+ * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
+ * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
+ */
+ $broadcast: function(name, args) {
+ var target = this,
+ current = target,
+ next = target,
+ event = {
+ name: name,
+ targetScope: target,
+ preventDefault: function() {
+ event.defaultPrevented = true;
+ },
+ defaultPrevented: false
+ };
+
+ if (!target.$$listenerCount[name]) return event;
+
+ var listenerArgs = concat([event], arguments, 1),
+ listeners, i, length;
+
+ //down while you can, then up and next sibling or up and next sibling until back at root
+ while ((current = next)) {
+ event.currentScope = current;
+ listeners = current.$$listeners[name] || [];
+ for (i = 0, length = listeners.length; i < length; i++) {
+ // if listeners were deregistered, defragment the array
+ if (!listeners[i]) {
+ listeners.splice(i, 1);
+ i--;
+ length--;
+ continue;
+ }
+
+ try {
+ listeners[i].apply(null, listenerArgs);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+
+ // Insanity Warning: scope depth-first traversal
+ // yes, this code is a bit crazy, but it works and we have tests to prove it!
+ // this piece should be kept in sync with the traversal in $digest
+ // (though it differs due to having the extra check for $$listenerCount)
+ if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||
+ (current !== target && current.$$nextSibling)))) {
+ while (current !== target && !(next = current.$$nextSibling)) {
+ current = current.$parent;
+ }
+ }
+ }
+
+ event.currentScope = null;
+ return event;
+ }
+ };
+
+ var $rootScope = new Scope();
+
+ //The internal queues. Expose them on the $rootScope for debugging/testing purposes.
+ var asyncQueue = $rootScope.$$asyncQueue = [];
+ var postDigestQueue = $rootScope.$$postDigestQueue = [];
+ var applyAsyncQueue = $rootScope.$$applyAsyncQueue = [];
+
+ return $rootScope;
+
+
+ function beginPhase(phase) {
+ if ($rootScope.$$phase) {
+ throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);
+ }
+
+ $rootScope.$$phase = phase;
+ }
+
+ function clearPhase() {
+ $rootScope.$$phase = null;
+ }
+
+ function incrementWatchersCount(current, count) {
+ do {
+ current.$$watchersCount += count;
+ } while ((current = current.$parent));
+ }
+
+ function decrementListenerCount(current, count, name) {
+ do {
+ current.$$listenerCount[name] -= count;
+
+ if (current.$$listenerCount[name] === 0) {
+ delete current.$$listenerCount[name];
+ }
+ } while ((current = current.$parent));
+ }
+
+ /**
+ * function used as an initial value for watchers.
+ * because it's unique we can easily tell it apart from other values
+ */
+ function initWatchVal() {}
+
+ function flushApplyAsync() {
+ while (applyAsyncQueue.length) {
+ try {
+ applyAsyncQueue.shift()();
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ applyAsyncId = null;
+ }
+
+ function scheduleApplyAsync() {
+ if (applyAsyncId === null) {
+ applyAsyncId = $browser.defer(function() {
+ $rootScope.$apply(flushApplyAsync);
+ });
+ }
+ }
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $rootElement
+ *
+ * @description
+ * The root element of Angular application. This is either the element where {@link
+ * ng.directive:ngApp ngApp} was declared or the element passed into
+ * {@link angular.bootstrap}. The element represents the root element of application. It is also the
+ * location where the application's {@link auto.$injector $injector} service gets
+ * published, and can be retrieved using `$rootElement.injector()`.
+ */
+
+
+// the implementation is in angular.bootstrap
+
+/**
+ * @description
+ * Private service to sanitize uris for links and images. Used by $compile and $sanitize.
+ */
+function $$SanitizeUriProvider() {
+ var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/,
+ imgSrcSanitizationWhitelist = /^\s*((https?|ftp|file|blob):|data:image\/)/;
+
+ /**
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during a[href] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to a[href] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.aHrefSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ aHrefSanitizationWhitelist = regexp;
+ return this;
+ }
+ return aHrefSanitizationWhitelist;
+ };
+
+
+ /**
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during img[src] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to img[src] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.imgSrcSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ imgSrcSanitizationWhitelist = regexp;
+ return this;
+ }
+ return imgSrcSanitizationWhitelist;
+ };
+
+ this.$get = function() {
+ return function sanitizeUri(uri, isImage) {
+ var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;
+ var normalizedVal;
+ normalizedVal = urlResolve(uri).href;
+ if (normalizedVal !== '' && !normalizedVal.match(regex)) {
+ return 'unsafe:' + normalizedVal;
+ }
+ return uri;
+ };
+ };
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+var $sceMinErr = minErr('$sce');
+
+var SCE_CONTEXTS = {
+ HTML: 'html',
+ CSS: 'css',
+ URL: 'url',
+ // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a
+ // url. (e.g. ng-include, script src, templateUrl)
+ RESOURCE_URL: 'resourceUrl',
+ JS: 'js'
+};
+
+// Helper functions follow.
+
+function adjustMatcher(matcher) {
+ if (matcher === 'self') {
+ return matcher;
+ } else if (isString(matcher)) {
+ // Strings match exactly except for 2 wildcards - '*' and '**'.
+ // '*' matches any character except those from the set ':/.?&'.
+ // '**' matches any character (like .* in a RegExp).
+ // More than 2 *'s raises an error as it's ill defined.
+ if (matcher.indexOf('***') > -1) {
+ throw $sceMinErr('iwcard',
+ 'Illegal sequence *** in string matcher. String: {0}', matcher);
+ }
+ matcher = escapeForRegexp(matcher).
+ replace('\\*\\*', '.*').
+ replace('\\*', '[^:/.?&;]*');
+ return new RegExp('^' + matcher + '$');
+ } else if (isRegExp(matcher)) {
+ // The only other type of matcher allowed is a Regexp.
+ // Match entire URL / disallow partial matches.
+ // Flags are reset (i.e. no global, ignoreCase or multiline)
+ return new RegExp('^' + matcher.source + '$');
+ } else {
+ throw $sceMinErr('imatcher',
+ 'Matchers may only be "self", string patterns or RegExp objects');
+ }
+}
+
+
+function adjustMatchers(matchers) {
+ var adjustedMatchers = [];
+ if (isDefined(matchers)) {
+ forEach(matchers, function(matcher) {
+ adjustedMatchers.push(adjustMatcher(matcher));
+ });
+ }
+ return adjustedMatchers;
+}
+
+
+/**
+ * @ngdoc service
+ * @name $sceDelegate
+ * @kind function
+ *
+ * @description
+ *
+ * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict
+ * Contextual Escaping (SCE)} services to AngularJS.
+ *
+ * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of
+ * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS. This is
+ * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to
+ * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things
+ * work because `$sce` delegates to `$sceDelegate` for these operations.
+ *
+ * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.
+ *
+ * The default instance of `$sceDelegate` should work out of the box with little pain. While you
+ * can override it completely to change the behavior of `$sce`, the common case would
+ * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting
+ * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as
+ * templates. Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist
+ * $sceDelegateProvider.resourceUrlWhitelist} and {@link
+ * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+ */
+
+/**
+ * @ngdoc provider
+ * @name $sceDelegateProvider
+ * @description
+ *
+ * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate
+ * $sceDelegate} service. This allows one to get/set the whitelists and blacklists used to ensure
+ * that the URLs used for sourcing Angular templates are safe. Refer {@link
+ * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and
+ * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+ *
+ * For the general details about this service in Angular, read the main page for {@link ng.$sce
+ * Strict Contextual Escaping (SCE)}.
+ *
+ * **Example**: Consider the following case. <a name="example"></a>
+ *
+ * - your app is hosted at url `http://myapp.example.com/`
+ * - but some of your templates are hosted on other domains you control such as
+ * `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.
+ * - and you have an open redirect at `http://myapp.example.com/clickThru?...`.
+ *
+ * Here is what a secure configuration for this scenario might look like:
+ *
+ * ```
+ * angular.module('myApp', []).config(function($sceDelegateProvider) {
+ * $sceDelegateProvider.resourceUrlWhitelist([
+ * // Allow same origin resource loads.
+ * 'self',
+ * // Allow loading from our assets domain. Notice the difference between * and **.
+ * 'http://srv*.assets.example.com/**'
+ * ]);
+ *
+ * // The blacklist overrides the whitelist so the open redirect here is blocked.
+ * $sceDelegateProvider.resourceUrlBlacklist([
+ * 'http://myapp.example.com/clickThru**'
+ * ]);
+ * });
+ * ```
+ */
+
+function $SceDelegateProvider() {
+ this.SCE_CONTEXTS = SCE_CONTEXTS;
+
+ // Resource URLs can also be trusted by policy.
+ var resourceUrlWhitelist = ['self'],
+ resourceUrlBlacklist = [];
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegateProvider#resourceUrlWhitelist
+ * @kind function
+ *
+ * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
+ * provided. This must be an array or null. A snapshot of this array is used so further
+ * changes to the array are ignored.
+ *
+ * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+ * allowed in this array.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** an empty whitelist array will block all URLs!
+ * </div>
+ *
+ * @return {Array} the currently set whitelist array.
+ *
+ * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
+ * same origin resource requests.
+ *
+ * @description
+ * Sets/Gets the whitelist of trusted resource URLs.
+ */
+ this.resourceUrlWhitelist = function(value) {
+ if (arguments.length) {
+ resourceUrlWhitelist = adjustMatchers(value);
+ }
+ return resourceUrlWhitelist;
+ };
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegateProvider#resourceUrlBlacklist
+ * @kind function
+ *
+ * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
+ * provided. This must be an array or null. A snapshot of this array is used so further
+ * changes to the array are ignored.
+ *
+ * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+ * allowed in this array.
+ *
+ * The typical usage for the blacklist is to **block
+ * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
+ * these would otherwise be trusted but actually return content from the redirected domain.
+ *
+ * Finally, **the blacklist overrides the whitelist** and has the final say.
+ *
+ * @return {Array} the currently set blacklist array.
+ *
+ * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there
+ * is no blacklist.)
+ *
+ * @description
+ * Sets/Gets the blacklist of trusted resource URLs.
+ */
+
+ this.resourceUrlBlacklist = function(value) {
+ if (arguments.length) {
+ resourceUrlBlacklist = adjustMatchers(value);
+ }
+ return resourceUrlBlacklist;
+ };
+
+ this.$get = ['$injector', function($injector) {
+
+ var htmlSanitizer = function htmlSanitizer(html) {
+ throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
+ };
+
+ if ($injector.has('$sanitize')) {
+ htmlSanitizer = $injector.get('$sanitize');
+ }
+
+
+ function matchUrl(matcher, parsedUrl) {
+ if (matcher === 'self') {
+ return urlIsSameOrigin(parsedUrl);
+ } else {
+ // definitely a regex. See adjustMatchers()
+ return !!matcher.exec(parsedUrl.href);
+ }
+ }
+
+ function isResourceUrlAllowedByPolicy(url) {
+ var parsedUrl = urlResolve(url.toString());
+ var i, n, allowed = false;
+ // Ensure that at least one item from the whitelist allows this url.
+ for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) {
+ if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {
+ allowed = true;
+ break;
+ }
+ }
+ if (allowed) {
+ // Ensure that no item from the blacklist blocked this url.
+ for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) {
+ if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {
+ allowed = false;
+ break;
+ }
+ }
+ }
+ return allowed;
+ }
+
+ function generateHolderType(Base) {
+ var holderType = function TrustedValueHolderType(trustedValue) {
+ this.$$unwrapTrustedValue = function() {
+ return trustedValue;
+ };
+ };
+ if (Base) {
+ holderType.prototype = new Base();
+ }
+ holderType.prototype.valueOf = function sceValueOf() {
+ return this.$$unwrapTrustedValue();
+ };
+ holderType.prototype.toString = function sceToString() {
+ return this.$$unwrapTrustedValue().toString();
+ };
+ return holderType;
+ }
+
+ var trustedValueHolderBase = generateHolderType(),
+ byType = {};
+
+ byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]);
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegate#trustAs
+ *
+ * @description
+ * Returns an object that is trusted by angular for use in specified strict
+ * contextual escaping contexts (such as ng-bind-html, ng-include, any src
+ * attribute interpolation, any dom event binding attribute interpolation
+ * such as for onclick, etc.) that uses the provided value.
+ * See {@link ng.$sce $sce} for enabling strict contextual escaping.
+ *
+ * @param {string} type The kind of context in which this value is safe for use. e.g. url,
+ * resourceUrl, html, js and css.
+ * @param {*} value The value that that should be considered trusted/safe.
+ * @returns {*} A value that can be used to stand in for the provided `value` in places
+ * where Angular expects a $sce.trustAs() return value.
+ */
+ function trustAs(type, trustedValue) {
+ var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
+ if (!Constructor) {
+ throw $sceMinErr('icontext',
+ 'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',
+ type, trustedValue);
+ }
+ if (trustedValue === null || isUndefined(trustedValue) || trustedValue === '') {
+ return trustedValue;
+ }
+ // All the current contexts in SCE_CONTEXTS happen to be strings. In order to avoid trusting
+ // mutable objects, we ensure here that the value passed in is actually a string.
+ if (typeof trustedValue !== 'string') {
+ throw $sceMinErr('itype',
+ 'Attempted to trust a non-string value in a content requiring a string: Context: {0}',
+ type);
+ }
+ return new Constructor(trustedValue);
+ }
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegate#valueOf
+ *
+ * @description
+ * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link
+ * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.
+ *
+ * If the passed parameter is not a value that had been returned by {@link
+ * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.
+ *
+ * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}
+ * call or anything else.
+ * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`} if `value` is the result of such a call. Otherwise, returns
+ * `value` unchanged.
+ */
+ function valueOf(maybeTrusted) {
+ if (maybeTrusted instanceof trustedValueHolderBase) {
+ return maybeTrusted.$$unwrapTrustedValue();
+ } else {
+ return maybeTrusted;
+ }
+ }
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegate#getTrusted
+ *
+ * @description
+ * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and
+ * returns the originally supplied value if the queried context type is a supertype of the
+ * created type. If this condition isn't satisfied, throws an exception.
+ *
+ * <div class="alert alert-danger">
+ * Disabling auto-escaping is extremely dangerous, it usually creates a Cross Site Scripting
+ * (XSS) vulnerability in your application.
+ * </div>
+ *
+ * @param {string} type The kind of context in which this value is to be used.
+ * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`} call.
+ * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`} if valid in this context. Otherwise, throws an exception.
+ */
+ function getTrusted(type, maybeTrusted) {
+ if (maybeTrusted === null || isUndefined(maybeTrusted) || maybeTrusted === '') {
+ return maybeTrusted;
+ }
+ var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
+ if (constructor && maybeTrusted instanceof constructor) {
+ return maybeTrusted.$$unwrapTrustedValue();
+ }
+ // If we get here, then we may only take one of two actions.
+ // 1. sanitize the value for the requested type, or
+ // 2. throw an exception.
+ if (type === SCE_CONTEXTS.RESOURCE_URL) {
+ if (isResourceUrlAllowedByPolicy(maybeTrusted)) {
+ return maybeTrusted;
+ } else {
+ throw $sceMinErr('insecurl',
+ 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}',
+ maybeTrusted.toString());
+ }
+ } else if (type === SCE_CONTEXTS.HTML) {
+ return htmlSanitizer(maybeTrusted);
+ }
+ throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
+ }
+
+ return { trustAs: trustAs,
+ getTrusted: getTrusted,
+ valueOf: valueOf };
+ }];
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $sceProvider
+ * @description
+ *
+ * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.
+ * - enable/disable Strict Contextual Escaping (SCE) in a module
+ * - override the default implementation with a custom delegate
+ *
+ * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}.
+ */
+
+/* jshint maxlen: false*/
+
+/**
+ * @ngdoc service
+ * @name $sce
+ * @kind function
+ *
+ * @description
+ *
+ * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS.
+ *
+ * # Strict Contextual Escaping
+ *
+ * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain
+ * contexts to result in a value that is marked as safe to use for that context. One example of
+ * such a context is binding arbitrary html controlled by the user via `ng-bind-html`. We refer
+ * to these contexts as privileged or SCE contexts.
+ *
+ * As of version 1.2, Angular ships with SCE enabled by default.
+ *
+ * Note: When enabled (the default), IE<11 in quirks mode is not supported. In this mode, IE<11 allow
+ * one to execute arbitrary javascript by the use of the expression() syntax. Refer
+ * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them.
+ * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>`
+ * to the top of your HTML document.
+ *
+ * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for
+ * security vulnerabilities such as XSS, clickjacking, etc. a lot easier.
+ *
+ * Here's an example of a binding in a privileged context:
+ *
+ * ```
+ * <input ng-model="userHtml" aria-label="User input">
+ * <div ng-bind-html="userHtml"></div>
+ * ```
+ *
+ * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user. With SCE
+ * disabled, this application allows the user to render arbitrary HTML into the DIV.
+ * In a more realistic example, one may be rendering user comments, blog articles, etc. via
+ * bindings. (HTML is just one example of a context where rendering user controlled input creates
+ * security vulnerabilities.)
+ *
+ * For the case of HTML, you might use a library, either on the client side, or on the server side,
+ * to sanitize unsafe HTML before binding to the value and rendering it in the document.
+ *
+ * How would you ensure that every place that used these types of bindings was bound to a value that
+ * was sanitized by your library (or returned as safe for rendering by your server?) How can you
+ * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some
+ * properties/fields and forgot to update the binding to the sanitized value?
+ *
+ * To be secure by default, you want to ensure that any such bindings are disallowed unless you can
+ * determine that something explicitly says it's safe to use a value for binding in that
+ * context. You can then audit your code (a simple grep would do) to ensure that this is only done
+ * for those values that you can easily tell are safe - because they were received from your server,
+ * sanitized by your library, etc. You can organize your codebase to help with this - perhaps
+ * allowing only the files in a specific directory to do this. Ensuring that the internal API
+ * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.
+ *
+ * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}
+ * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to
+ * obtain values that will be accepted by SCE / privileged contexts.
+ *
+ *
+ * ## How does it work?
+ *
+ * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted
+ * $sce.getTrusted(context, value)} rather than to the value directly. Directives use {@link
+ * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the
+ * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.
+ *
+ * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link
+ * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly
+ * simplified):
+ *
+ * ```
+ * var ngBindHtmlDirective = ['$sce', function($sce) {
+ * return function(scope, element, attr) {
+ * scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {
+ * element.html(value || '');
+ * });
+ * };
+ * }];
+ * ```
+ *
+ * ## Impact on loading templates
+ *
+ * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as
+ * `templateUrl`'s specified by {@link guide/directive directives}.
+ *
+ * By default, Angular only loads templates from the same domain and protocol as the application
+ * document. This is done by calling {@link ng.$sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl} on the template URL. To load templates from other domains and/or
+ * protocols, you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist
+ * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.
+ *
+ * *Please note*:
+ * The browser's
+ * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+ * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
+ * policy apply in addition to this and may further restrict whether the template is successfully
+ * loaded. This means that without the right CORS policy, loading templates from a different domain
+ * won't work on all browsers. Also, loading templates from `file://` URL does not work on some
+ * browsers.
+ *
+ * ## This feels like too much overhead
+ *
+ * It's important to remember that SCE only applies to interpolation expressions.
+ *
+ * If your expressions are constant literals, they're automatically trusted and you don't need to
+ * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g.
+ * `<div ng-bind-html="'<b>implicitly trusted</b>'"></div>`) just works.
+ *
+ * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them
+ * through {@link ng.$sce#getTrusted $sce.getTrusted}. SCE doesn't play a role here.
+ *
+ * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load
+ * templates in `ng-include` from your application's domain without having to even know about SCE.
+ * It blocks loading templates from other domains or loading templates over http from an https
+ * served document. You can change these by setting your own custom {@link
+ * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link
+ * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs.
+ *
+ * This significantly reduces the overhead. It is far easier to pay the small overhead and have an
+ * application that's secure and can be audited to verify that with much more ease than bolting
+ * security onto an application later.
+ *
+ * <a name="contexts"></a>
+ * ## What trusted context types are supported?
+ *
+ * | Context | Notes |
+ * |---------------------|----------------|
+ * | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. |
+ * | `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. |
+ * | `$sce.URL` | For URLs that are safe to follow as links. Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |
+ * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application. Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.) <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |
+ * | `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. |
+ *
+ * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name="resourceUrlPatternItem"></a>
+ *
+ * Each element in these arrays must be one of the following:
+ *
+ * - **'self'**
+ * - The special **string**, `'self'`, can be used to match against all URLs of the **same
+ * domain** as the application document using the **same protocol**.
+ * - **String** (except the special value `'self'`)
+ * - The string is matched against the full *normalized / absolute URL* of the resource
+ * being tested (substring matches are not good enough.)
+ * - There are exactly **two wildcard sequences** - `*` and `**`. All other characters
+ * match themselves.
+ * - `*`: matches zero or more occurrences of any character other than one of the following 6
+ * characters: '`:`', '`/`', '`.`', '`?`', '`&`' and '`;`'. It's a useful wildcard for use
+ * in a whitelist.
+ * - `**`: matches zero or more occurrences of *any* character. As such, it's not
+ * appropriate for use in a scheme, domain, etc. as it would match too much. (e.g.
+ * http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might
+ * not have been the intention.) Its usage at the very end of the path is ok. (e.g.
+ * http://foo.example.com/templates/**).
+ * - **RegExp** (*see caveat below*)
+ * - *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax
+ * (and all the inevitable escaping) makes them *harder to maintain*. It's easy to
+ * accidentally introduce a bug when one updates a complex expression (imho, all regexes should
+ * have good test coverage). For instance, the use of `.` in the regex is correct only in a
+ * small number of cases. A `.` character in the regex used when matching the scheme or a
+ * subdomain could be matched against a `:` or literal `.` that was likely not intended. It
+ * is highly recommended to use the string patterns and only fall back to regular expressions
+ * as a last resort.
+ * - The regular expression must be an instance of RegExp (i.e. not a string.) It is
+ * matched against the **entire** *normalized / absolute URL* of the resource being tested
+ * (even when the RegExp did not have the `^` and `$` codes.) In addition, any flags
+ * present on the RegExp (such as multiline, global, ignoreCase) are ignored.
+ * - If you are generating your JavaScript from some other templating engine (not
+ * recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)),
+ * remember to escape your regular expression (and be aware that you might need more than
+ * one level of escaping depending on your templating engine and the way you interpolated
+ * the value.) Do make use of your platform's escaping mechanism as it might be good
+ * enough before coding your own. E.g. Ruby has
+ * [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape)
+ * and Python has [re.escape](http://docs.python.org/library/re.html#re.escape).
+ * Javascript lacks a similar built in function for escaping. Take a look at Google
+ * Closure library's [goog.string.regExpEscape(s)](
+ * http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962).
+ *
+ * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example.
+ *
+ * ## Show me an example using SCE.
+ *
+ * <example module="mySceApp" deps="angular-sanitize.js">
+ * <file name="index.html">
+ * <div ng-controller="AppController as myCtrl">
+ * <i ng-bind-html="myCtrl.explicitlyTrustedHtml" id="explicitlyTrustedHtml"></i><br><br>
+ * <b>User comments</b><br>
+ * By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when
+ * $sanitize is available. If $sanitize isn't available, this results in an error instead of an
+ * exploit.
+ * <div class="well">
+ * <div ng-repeat="userComment in myCtrl.userComments">
+ * <b>{{userComment.name}}</b>:
+ * <span ng-bind-html="userComment.htmlComment" class="htmlComment"></span>
+ * <br>
+ * </div>
+ * </div>
+ * </div>
+ * </file>
+ *
+ * <file name="script.js">
+ * angular.module('mySceApp', ['ngSanitize'])
+ * .controller('AppController', ['$http', '$templateCache', '$sce',
+ * function($http, $templateCache, $sce) {
+ * var self = this;
+ * $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) {
+ * self.userComments = userComments;
+ * });
+ * self.explicitlyTrustedHtml = $sce.trustAsHtml(
+ * '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
+ * 'sanitization.&quot;">Hover over this text.</span>');
+ * }]);
+ * </file>
+ *
+ * <file name="test_data.json">
+ * [
+ * { "name": "Alice",
+ * "htmlComment":
+ * "<span onmouseover='this.textContent=\"PWN3D!\"'>Is <i>anyone</i> reading this?</span>"
+ * },
+ * { "name": "Bob",
+ * "htmlComment": "<i>Yes!</i> Am I the only other one?"
+ * }
+ * ]
+ * </file>
+ *
+ * <file name="protractor.js" type="protractor">
+ * describe('SCE doc demo', function() {
+ * it('should sanitize untrusted values', function() {
+ * expect(element.all(by.css('.htmlComment')).first().getInnerHtml())
+ * .toBe('<span>Is <i>anyone</i> reading this?</span>');
+ * });
+ *
+ * it('should NOT sanitize explicitly trusted values', function() {
+ * expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(
+ * '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
+ * 'sanitization.&quot;">Hover over this text.</span>');
+ * });
+ * });
+ * </file>
+ * </example>
+ *
+ *
+ *
+ * ## Can I disable SCE completely?
+ *
+ * Yes, you can. However, this is strongly discouraged. SCE gives you a lot of security benefits
+ * for little coding overhead. It will be much harder to take an SCE disabled application and
+ * either secure it on your own or enable SCE at a later stage. It might make sense to disable SCE
+ * for cases where you have a lot of existing code that was written before SCE was introduced and
+ * you're migrating them a module at a time.
+ *
+ * That said, here's how you can completely disable SCE:
+ *
+ * ```
+ * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
+ * // Completely disable SCE. For demonstration purposes only!
+ * // Do not use in new projects.
+ * $sceProvider.enabled(false);
+ * });
+ * ```
+ *
+ */
+/* jshint maxlen: 100 */
+
+function $SceProvider() {
+ var enabled = true;
+
+ /**
+ * @ngdoc method
+ * @name $sceProvider#enabled
+ * @kind function
+ *
+ * @param {boolean=} value If provided, then enables/disables SCE.
+ * @return {boolean} true if SCE is enabled, false otherwise.
+ *
+ * @description
+ * Enables/disables SCE and returns the current value.
+ */
+ this.enabled = function(value) {
+ if (arguments.length) {
+ enabled = !!value;
+ }
+ return enabled;
+ };
+
+
+ /* Design notes on the default implementation for SCE.
+ *
+ * The API contract for the SCE delegate
+ * -------------------------------------
+ * The SCE delegate object must provide the following 3 methods:
+ *
+ * - trustAs(contextEnum, value)
+ * This method is used to tell the SCE service that the provided value is OK to use in the
+ * contexts specified by contextEnum. It must return an object that will be accepted by
+ * getTrusted() for a compatible contextEnum and return this value.
+ *
+ * - valueOf(value)
+ * For values that were not produced by trustAs(), return them as is. For values that were
+ * produced by trustAs(), return the corresponding input value to trustAs. Basically, if
+ * trustAs is wrapping the given values into some type, this operation unwraps it when given
+ * such a value.
+ *
+ * - getTrusted(contextEnum, value)
+ * This function should return the a value that is safe to use in the context specified by
+ * contextEnum or throw and exception otherwise.
+ *
+ * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be
+ * opaque or wrapped in some holder object. That happens to be an implementation detail. For
+ * instance, an implementation could maintain a registry of all trusted objects by context. In
+ * such a case, trustAs() would return the same object that was passed in. getTrusted() would
+ * return the same object passed in if it was found in the registry under a compatible context or
+ * throw an exception otherwise. An implementation might only wrap values some of the time based
+ * on some criteria. getTrusted() might return a value and not throw an exception for special
+ * constants or objects even if not wrapped. All such implementations fulfill this contract.
+ *
+ *
+ * A note on the inheritance model for SCE contexts
+ * ------------------------------------------------
+ * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types. This
+ * is purely an implementation details.
+ *
+ * The contract is simply this:
+ *
+ * getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value)
+ * will also succeed.
+ *
+ * Inheritance happens to capture this in a natural way. In some future, we
+ * may not use inheritance anymore. That is OK because no code outside of
+ * sce.js and sceSpecs.js would need to be aware of this detail.
+ */
+
+ this.$get = ['$parse', '$sceDelegate', function(
+ $parse, $sceDelegate) {
+ // Prereq: Ensure that we're not running in IE<11 quirks mode. In that mode, IE < 11 allow
+ // the "expression(javascript expression)" syntax which is insecure.
+ if (enabled && msie < 8) {
+ throw $sceMinErr('iequirks',
+ 'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' +
+ 'mode. You can fix this by adding the text <!doctype html> to the top of your HTML ' +
+ 'document. See http://docs.angularjs.org/api/ng.$sce for more information.');
+ }
+
+ var sce = shallowCopy(SCE_CONTEXTS);
+
+ /**
+ * @ngdoc method
+ * @name $sce#isEnabled
+ * @kind function
+ *
+ * @return {Boolean} true if SCE is enabled, false otherwise. If you want to set the value, you
+ * have to do it at module config time on {@link ng.$sceProvider $sceProvider}.
+ *
+ * @description
+ * Returns a boolean indicating if SCE is enabled.
+ */
+ sce.isEnabled = function() {
+ return enabled;
+ };
+ sce.trustAs = $sceDelegate.trustAs;
+ sce.getTrusted = $sceDelegate.getTrusted;
+ sce.valueOf = $sceDelegate.valueOf;
+
+ if (!enabled) {
+ sce.trustAs = sce.getTrusted = function(type, value) { return value; };
+ sce.valueOf = identity;
+ }
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAs
+ *
+ * @description
+ * Converts Angular {@link guide/expression expression} into a function. This is like {@link
+ * ng.$parse $parse} and is identical when the expression is a literal constant. Otherwise, it
+ * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,
+ * *result*)}
+ *
+ * @param {string} type The kind of SCE context in which this result will be used.
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+ sce.parseAs = function sceParseAs(type, expr) {
+ var parsed = $parse(expr);
+ if (parsed.literal && parsed.constant) {
+ return parsed;
+ } else {
+ return $parse(expr, function(value) {
+ return sce.getTrusted(type, value);
+ });
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAs
+ *
+ * @description
+ * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. As such,
+ * returns an object that is trusted by angular for use in specified strict contextual
+ * escaping contexts (such as ng-bind-html, ng-include, any src attribute
+ * interpolation, any dom event binding attribute interpolation such as for onclick, etc.)
+ * that uses the provided value. See * {@link ng.$sce $sce} for enabling strict contextual
+ * escaping.
+ *
+ * @param {string} type The kind of context in which this value is safe for use. e.g. url,
+ * resourceUrl, html, js and css.
+ * @param {*} value The value that that should be considered trusted/safe.
+ * @returns {*} A value that can be used to stand in for the provided `value` in places
+ * where Angular expects a $sce.trustAs() return value.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsHtml
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsHtml(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml
+ * $sce.getTrustedHtml(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsUrl
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsUrl(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl
+ * $sce.getTrustedUrl(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsResourceUrl
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsResourceUrl(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the return
+ * value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsJs
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsJs(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs
+ * $sce.getTrustedJs(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrusted
+ *
+ * @description
+ * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}. As such,
+ * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the
+ * originally supplied value if the queried context type is a supertype of the created type.
+ * If this condition isn't satisfied, throws an exception.
+ *
+ * @param {string} type The kind of context in which this value is to be used.
+ * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}
+ * call.
+ * @returns {*} The value the was originally provided to
+ * {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.
+ * Otherwise, throws an exception.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedHtml
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedHtml(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedCss
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedCss(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedUrl
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedUrl(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedResourceUrl
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedResourceUrl(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}
+ *
+ * @param {*} value The value to pass to `$sceDelegate.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedJs
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedJs(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsHtml
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsHtml(expression string)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsCss
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsCss(value)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsUrl
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsUrl(value)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsResourceUrl
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsResourceUrl(value)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsJs
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsJs(value)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ // Shorthand delegations.
+ var parse = sce.parseAs,
+ getTrusted = sce.getTrusted,
+ trustAs = sce.trustAs;
+
+ forEach(SCE_CONTEXTS, function(enumValue, name) {
+ var lName = lowercase(name);
+ sce[camelCase("parse_as_" + lName)] = function(expr) {
+ return parse(enumValue, expr);
+ };
+ sce[camelCase("get_trusted_" + lName)] = function(value) {
+ return getTrusted(enumValue, value);
+ };
+ sce[camelCase("trust_as_" + lName)] = function(value) {
+ return trustAs(enumValue, value);
+ };
+ });
+
+ return sce;
+ }];
+}
+
+/**
+ * !!! This is an undocumented "private" service !!!
+ *
+ * @name $sniffer
+ * @requires $window
+ * @requires $document
+ *
+ * @property {boolean} history Does the browser support html5 history api ?
+ * @property {boolean} transitions Does the browser support CSS transition events ?
+ * @property {boolean} animations Does the browser support CSS animation events ?
+ *
+ * @description
+ * This is very simple implementation of testing browser's features.
+ */
+function $SnifferProvider() {
+ this.$get = ['$window', '$document', function($window, $document) {
+ var eventSupport = {},
+ android =
+ toInt((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
+ boxee = /Boxee/i.test(($window.navigator || {}).userAgent),
+ document = $document[0] || {},
+ vendorPrefix,
+ vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/,
+ bodyStyle = document.body && document.body.style,
+ transitions = false,
+ animations = false,
+ match;
+
+ if (bodyStyle) {
+ for (var prop in bodyStyle) {
+ if (match = vendorRegex.exec(prop)) {
+ vendorPrefix = match[0];
+ vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);
+ break;
+ }
+ }
+
+ if (!vendorPrefix) {
+ vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';
+ }
+
+ transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));
+ animations = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));
+
+ if (android && (!transitions || !animations)) {
+ transitions = isString(bodyStyle.webkitTransition);
+ animations = isString(bodyStyle.webkitAnimation);
+ }
+ }
+
+
+ return {
+ // Android has history.pushState, but it does not update location correctly
+ // so let's not use the history API at all.
+ // http://code.google.com/p/android/issues/detail?id=17471
+ // https://github.com/angular/angular.js/issues/904
+
+ // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has
+ // so let's not use the history API also
+ // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined
+ // jshint -W018
+ history: !!($window.history && $window.history.pushState && !(android < 4) && !boxee),
+ // jshint +W018
+ hasEvent: function(event) {
+ // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
+ // it. In particular the event is not fired when backspace or delete key are pressed or
+ // when cut operation is performed.
+ // IE10+ implements 'input' event but it erroneously fires under various situations,
+ // e.g. when placeholder changes, or a form is focused.
+ if (event === 'input' && msie <= 11) return false;
+
+ if (isUndefined(eventSupport[event])) {
+ var divElm = document.createElement('div');
+ eventSupport[event] = 'on' + event in divElm;
+ }
+
+ return eventSupport[event];
+ },
+ csp: csp(),
+ vendorPrefix: vendorPrefix,
+ transitions: transitions,
+ animations: animations,
+ android: android
+ };
+ }];
+}
+
+var $compileMinErr = minErr('$compile');
+
+/**
+ * @ngdoc provider
+ * @name $templateRequestProvider
+ * @description
+ * Used to configure the options passed to the {@link $http} service when making a template request.
+ *
+ * For example, it can be used for specifying the "Accept" header that is sent to the server, when
+ * requesting a template.
+ */
+function $TemplateRequestProvider() {
+
+ var httpOptions;
+
+ /**
+ * @ngdoc method
+ * @name $templateRequestProvider#httpOptions
+ * @description
+ * The options to be passed to the {@link $http} service when making the request.
+ * You can use this to override options such as the "Accept" header for template requests.
+ *
+ * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the
+ * options if not overridden here.
+ *
+ * @param {string=} value new value for the {@link $http} options.
+ * @returns {string|self} Returns the {@link $http} options when used as getter and self if used as setter.
+ */
+ this.httpOptions = function(val) {
+ if (val) {
+ httpOptions = val;
+ return this;
+ }
+ return httpOptions;
+ };
+
+ /**
+ * @ngdoc service
+ * @name $templateRequest
+ *
+ * @description
+ * The `$templateRequest` service runs security checks then downloads the provided template using
+ * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request
+ * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the
+ * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the
+ * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted
+ * when `tpl` is of type string and `$templateCache` has the matching entry.
+ *
+ * If you want to pass custom options to the `$http` service, such as setting the Accept header you
+ * can configure this via {@link $templateRequestProvider#httpOptions}.
+ *
+ * @param {string|TrustedResourceUrl} tpl The HTTP request template URL
+ * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty
+ *
+ * @return {Promise} a promise for the HTTP response data of the given URL.
+ *
+ * @property {number} totalPendingRequests total amount of pending template requests being downloaded.
+ */
+ this.$get = ['$templateCache', '$http', '$q', '$sce', function($templateCache, $http, $q, $sce) {
+
+ function handleRequestFn(tpl, ignoreRequestError) {
+ handleRequestFn.totalPendingRequests++;
+
+ // We consider the template cache holds only trusted templates, so
+ // there's no need to go through whitelisting again for keys that already
+ // are included in there. This also makes Angular accept any script
+ // directive, no matter its name. However, we still need to unwrap trusted
+ // types.
+ if (!isString(tpl) || !$templateCache.get(tpl)) {
+ tpl = $sce.getTrustedResourceUrl(tpl);
+ }
+
+ var transformResponse = $http.defaults && $http.defaults.transformResponse;
+
+ if (isArray(transformResponse)) {
+ transformResponse = transformResponse.filter(function(transformer) {
+ return transformer !== defaultHttpResponseTransform;
+ });
+ } else if (transformResponse === defaultHttpResponseTransform) {
+ transformResponse = null;
+ }
+
+ return $http.get(tpl, extend({
+ cache: $templateCache,
+ transformResponse: transformResponse
+ }, httpOptions))
+ ['finally'](function() {
+ handleRequestFn.totalPendingRequests--;
+ })
+ .then(function(response) {
+ $templateCache.put(tpl, response.data);
+ return response.data;
+ }, handleError);
+
+ function handleError(resp) {
+ if (!ignoreRequestError) {
+ throw $compileMinErr('tpload', 'Failed to load template: {0} (HTTP status: {1} {2})',
+ tpl, resp.status, resp.statusText);
+ }
+ return $q.reject(resp);
+ }
+ }
+
+ handleRequestFn.totalPendingRequests = 0;
+
+ return handleRequestFn;
+ }];
+}
+
+function $$TestabilityProvider() {
+ this.$get = ['$rootScope', '$browser', '$location',
+ function($rootScope, $browser, $location) {
+
+ /**
+ * @name $testability
+ *
+ * @description
+ * The private $$testability service provides a collection of methods for use when debugging
+ * or by automated test and debugging tools.
+ */
+ var testability = {};
+
+ /**
+ * @name $$testability#findBindings
+ *
+ * @description
+ * Returns an array of elements that are bound (via ng-bind or {{}})
+ * to expressions matching the input.
+ *
+ * @param {Element} element The element root to search from.
+ * @param {string} expression The binding expression to match.
+ * @param {boolean} opt_exactMatch If true, only returns exact matches
+ * for the expression. Filters and whitespace are ignored.
+ */
+ testability.findBindings = function(element, expression, opt_exactMatch) {
+ var bindings = element.getElementsByClassName('ng-binding');
+ var matches = [];
+ forEach(bindings, function(binding) {
+ var dataBinding = angular.element(binding).data('$binding');
+ if (dataBinding) {
+ forEach(dataBinding, function(bindingName) {
+ if (opt_exactMatch) {
+ var matcher = new RegExp('(^|\\s)' + escapeForRegexp(expression) + '(\\s|\\||$)');
+ if (matcher.test(bindingName)) {
+ matches.push(binding);
+ }
+ } else {
+ if (bindingName.indexOf(expression) != -1) {
+ matches.push(binding);
+ }
+ }
+ });
+ }
+ });
+ return matches;
+ };
+
+ /**
+ * @name $$testability#findModels
+ *
+ * @description
+ * Returns an array of elements that are two-way found via ng-model to
+ * expressions matching the input.
+ *
+ * @param {Element} element The element root to search from.
+ * @param {string} expression The model expression to match.
+ * @param {boolean} opt_exactMatch If true, only returns exact matches
+ * for the expression.
+ */
+ testability.findModels = function(element, expression, opt_exactMatch) {
+ var prefixes = ['ng-', 'data-ng-', 'ng\\:'];
+ for (var p = 0; p < prefixes.length; ++p) {
+ var attributeEquals = opt_exactMatch ? '=' : '*=';
+ var selector = '[' + prefixes[p] + 'model' + attributeEquals + '"' + expression + '"]';
+ var elements = element.querySelectorAll(selector);
+ if (elements.length) {
+ return elements;
+ }
+ }
+ };
+
+ /**
+ * @name $$testability#getLocation
+ *
+ * @description
+ * Shortcut for getting the location in a browser agnostic way. Returns
+ * the path, search, and hash. (e.g. /path?a=b#hash)
+ */
+ testability.getLocation = function() {
+ return $location.url();
+ };
+
+ /**
+ * @name $$testability#setLocation
+ *
+ * @description
+ * Shortcut for navigating to a location without doing a full page reload.
+ *
+ * @param {string} url The location url (path, search and hash,
+ * e.g. /path?a=b#hash) to go to.
+ */
+ testability.setLocation = function(url) {
+ if (url !== $location.url()) {
+ $location.url(url);
+ $rootScope.$digest();
+ }
+ };
+
+ /**
+ * @name $$testability#whenStable
+ *
+ * @description
+ * Calls the callback when $timeout and $http requests are completed.
+ *
+ * @param {function} callback
+ */
+ testability.whenStable = function(callback) {
+ $browser.notifyWhenNoOutstandingRequests(callback);
+ };
+
+ return testability;
+ }];
+}
+
+function $TimeoutProvider() {
+ this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler',
+ function($rootScope, $browser, $q, $$q, $exceptionHandler) {
+
+ var deferreds = {};
+
+
+ /**
+ * @ngdoc service
+ * @name $timeout
+ *
+ * @description
+ * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch
+ * block and delegates any exceptions to
+ * {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * The return value of calling `$timeout` is a promise, which will be resolved when
+ * the delay has passed and the timeout function, if provided, is executed.
+ *
+ * To cancel a timeout request, call `$timeout.cancel(promise)`.
+ *
+ * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to
+ * synchronously flush the queue of deferred functions.
+ *
+ * If you only want a promise that will be resolved after some specified delay
+ * then you can call `$timeout` without the `fn` function.
+ *
+ * @param {function()=} fn A function, whose execution should be delayed.
+ * @param {number=} [delay=0] Delay in milliseconds.
+ * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
+ * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
+ * @param {...*=} Pass additional parameters to the executed function.
+ * @returns {Promise} Promise that will be resolved when the timeout is reached. The promise
+ * will be resolved with the return value of the `fn` function.
+ *
+ */
+ function timeout(fn, delay, invokeApply) {
+ if (!isFunction(fn)) {
+ invokeApply = delay;
+ delay = fn;
+ fn = noop;
+ }
+
+ var args = sliceArgs(arguments, 3),
+ skipApply = (isDefined(invokeApply) && !invokeApply),
+ deferred = (skipApply ? $$q : $q).defer(),
+ promise = deferred.promise,
+ timeoutId;
+
+ timeoutId = $browser.defer(function() {
+ try {
+ deferred.resolve(fn.apply(null, args));
+ } catch (e) {
+ deferred.reject(e);
+ $exceptionHandler(e);
+ }
+ finally {
+ delete deferreds[promise.$$timeoutId];
+ }
+
+ if (!skipApply) $rootScope.$apply();
+ }, delay);
+
+ promise.$$timeoutId = timeoutId;
+ deferreds[timeoutId] = deferred;
+
+ return promise;
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $timeout#cancel
+ *
+ * @description
+ * Cancels a task associated with the `promise`. As a result of this, the promise will be
+ * resolved with a rejection.
+ *
+ * @param {Promise=} promise Promise returned by the `$timeout` function.
+ * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
+ * canceled.
+ */
+ timeout.cancel = function(promise) {
+ if (promise && promise.$$timeoutId in deferreds) {
+ deferreds[promise.$$timeoutId].reject('canceled');
+ delete deferreds[promise.$$timeoutId];
+ return $browser.defer.cancel(promise.$$timeoutId);
+ }
+ return false;
+ };
+
+ return timeout;
+ }];
+}
+
+// NOTE: The usage of window and document instead of $window and $document here is
+// deliberate. This service depends on the specific behavior of anchor nodes created by the
+// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and
+// cause us to break tests. In addition, when the browser resolves a URL for XHR, it
+// doesn't know about mocked locations and resolves URLs to the real document - which is
+// exactly the behavior needed here. There is little value is mocking these out for this
+// service.
+var urlParsingNode = document.createElement("a");
+var originUrl = urlResolve(window.location.href);
+
+
+/**
+ *
+ * Implementation Notes for non-IE browsers
+ * ----------------------------------------
+ * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,
+ * results both in the normalizing and parsing of the URL. Normalizing means that a relative
+ * URL will be resolved into an absolute URL in the context of the application document.
+ * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related
+ * properties are all populated to reflect the normalized URL. This approach has wide
+ * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See
+ * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
+ *
+ * Implementation Notes for IE
+ * ---------------------------
+ * IE <= 10 normalizes the URL when assigned to the anchor node similar to the other
+ * browsers. However, the parsed components will not be set if the URL assigned did not specify
+ * them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We
+ * work around that by performing the parsing in a 2nd step by taking a previously normalized
+ * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the
+ * properties such as protocol, hostname, port, etc.
+ *
+ * References:
+ * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement
+ * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
+ * http://url.spec.whatwg.org/#urlutils
+ * https://github.com/angular/angular.js/pull/2902
+ * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
+ *
+ * @kind function
+ * @param {string} url The URL to be parsed.
+ * @description Normalizes and parses a URL.
+ * @returns {object} Returns the normalized URL as a dictionary.
+ *
+ * | member name | Description |
+ * |---------------|----------------|
+ * | href | A normalized version of the provided URL if it was not an absolute URL |
+ * | protocol | The protocol including the trailing colon |
+ * | host | The host and port (if the port is non-default) of the normalizedUrl |
+ * | search | The search params, minus the question mark |
+ * | hash | The hash string, minus the hash symbol
+ * | hostname | The hostname
+ * | port | The port, without ":"
+ * | pathname | The pathname, beginning with "/"
+ *
+ */
+function urlResolve(url) {
+ var href = url;
+
+ if (msie) {
+ // Normalize before parse. Refer Implementation Notes on why this is
+ // done in two steps on IE.
+ urlParsingNode.setAttribute("href", href);
+ href = urlParsingNode.href;
+ }
+
+ urlParsingNode.setAttribute('href', href);
+
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
+ return {
+ href: urlParsingNode.href,
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
+ host: urlParsingNode.host,
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
+ hostname: urlParsingNode.hostname,
+ port: urlParsingNode.port,
+ pathname: (urlParsingNode.pathname.charAt(0) === '/')
+ ? urlParsingNode.pathname
+ : '/' + urlParsingNode.pathname
+ };
+}
+
+/**
+ * Parse a request URL and determine whether this is a same-origin request as the application document.
+ *
+ * @param {string|object} requestUrl The url of the request as a string that will be resolved
+ * or a parsed URL object.
+ * @returns {boolean} Whether the request is for the same origin as the application document.
+ */
+function urlIsSameOrigin(requestUrl) {
+ var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;
+ return (parsed.protocol === originUrl.protocol &&
+ parsed.host === originUrl.host);
+}
+
+/**
+ * @ngdoc service
+ * @name $window
+ *
+ * @description
+ * A reference to the browser's `window` object. While `window`
+ * is globally available in JavaScript, it causes testability problems, because
+ * it is a global variable. In angular we always refer to it through the
+ * `$window` service, so it may be overridden, removed or mocked for testing.
+ *
+ * Expressions, like the one defined for the `ngClick` directive in the example
+ * below, are evaluated with respect to the current scope. Therefore, there is
+ * no risk of inadvertently coding in a dependency on a global value in such an
+ * expression.
+ *
+ * @example
+ <example module="windowExample">
+ <file name="index.html">
+ <script>
+ angular.module('windowExample', [])
+ .controller('ExampleController', ['$scope', '$window', function($scope, $window) {
+ $scope.greeting = 'Hello, World!';
+ $scope.doGreeting = function(greeting) {
+ $window.alert(greeting);
+ };
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <input type="text" ng-model="greeting" aria-label="greeting" />
+ <button ng-click="doGreeting(greeting)">ALERT</button>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should display the greeting in the input box', function() {
+ element(by.model('greeting')).sendKeys('Hello, E2E Tests');
+ // If we click the button it will block the test runner
+ // element(':button').click();
+ });
+ </file>
+ </example>
+ */
+function $WindowProvider() {
+ this.$get = valueFn(window);
+}
+
+/**
+ * @name $$cookieReader
+ * @requires $document
+ *
+ * @description
+ * This is a private service for reading cookies used by $http and ngCookies
+ *
+ * @return {Object} a key/value map of the current cookies
+ */
+function $$CookieReader($document) {
+ var rawDocument = $document[0] || {};
+ var lastCookies = {};
+ var lastCookieString = '';
+
+ function safeDecodeURIComponent(str) {
+ try {
+ return decodeURIComponent(str);
+ } catch (e) {
+ return str;
+ }
+ }
+
+ return function() {
+ var cookieArray, cookie, i, index, name;
+ var currentCookieString = rawDocument.cookie || '';
+
+ if (currentCookieString !== lastCookieString) {
+ lastCookieString = currentCookieString;
+ cookieArray = lastCookieString.split('; ');
+ lastCookies = {};
+
+ for (i = 0; i < cookieArray.length; i++) {
+ cookie = cookieArray[i];
+ index = cookie.indexOf('=');
+ if (index > 0) { //ignore nameless cookies
+ name = safeDecodeURIComponent(cookie.substring(0, index));
+ // the first value that is seen for a cookie is the most
+ // specific one. values for the same cookie name that
+ // follow are for less specific paths.
+ if (isUndefined(lastCookies[name])) {
+ lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1));
+ }
+ }
+ }
+ }
+ return lastCookies;
+ };
+}
+
+$$CookieReader.$inject = ['$document'];
+
+function $$CookieReaderProvider() {
+ this.$get = $$CookieReader;
+}
+
+/* global currencyFilter: true,
+ dateFilter: true,
+ filterFilter: true,
+ jsonFilter: true,
+ limitToFilter: true,
+ lowercaseFilter: true,
+ numberFilter: true,
+ orderByFilter: true,
+ uppercaseFilter: true,
+ */
+
+/**
+ * @ngdoc provider
+ * @name $filterProvider
+ * @description
+ *
+ * Filters are just functions which transform input to an output. However filters need to be
+ * Dependency Injected. To achieve this a filter definition consists of a factory function which is
+ * annotated with dependencies and is responsible for creating a filter function.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
+ * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
+ * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
+ * (`myapp_subsection_filterx`).
+ * </div>
+ *
+ * ```js
+ * // Filter registration
+ * function MyModule($provide, $filterProvider) {
+ * // create a service to demonstrate injection (not always needed)
+ * $provide.value('greet', function(name){
+ * return 'Hello ' + name + '!';
+ * });
+ *
+ * // register a filter factory which uses the
+ * // greet service to demonstrate DI.
+ * $filterProvider.register('greet', function(greet){
+ * // return the filter function which uses the greet service
+ * // to generate salutation
+ * return function(text) {
+ * // filters need to be forgiving so check input validity
+ * return text && greet(text) || text;
+ * };
+ * });
+ * }
+ * ```
+ *
+ * The filter function is registered with the `$injector` under the filter name suffix with
+ * `Filter`.
+ *
+ * ```js
+ * it('should be the same instance', inject(
+ * function($filterProvider) {
+ * $filterProvider.register('reverse', function(){
+ * return ...;
+ * });
+ * },
+ * function($filter, reverseFilter) {
+ * expect($filter('reverse')).toBe(reverseFilter);
+ * });
+ * ```
+ *
+ *
+ * For more information about how angular filters work, and how to create your own filters, see
+ * {@link guide/filter Filters} in the Angular Developer Guide.
+ */
+
+/**
+ * @ngdoc service
+ * @name $filter
+ * @kind function
+ * @description
+ * Filters are used for formatting data displayed to the user.
+ *
+ * The general syntax in templates is as follows:
+ *
+ * {{ expression [| filter_name[:parameter_value] ... ] }}
+ *
+ * @param {String} name Name of the filter function to retrieve
+ * @return {Function} the filter function
+ * @example
+ <example name="$filter" module="filterExample">
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <h3>{{ originalText }}</h3>
+ <h3>{{ filteredText }}</h3>
+ </div>
+ </file>
+
+ <file name="script.js">
+ angular.module('filterExample', [])
+ .controller('MainCtrl', function($scope, $filter) {
+ $scope.originalText = 'hello';
+ $scope.filteredText = $filter('uppercase')($scope.originalText);
+ });
+ </file>
+ </example>
+ */
+$FilterProvider.$inject = ['$provide'];
+function $FilterProvider($provide) {
+ var suffix = 'Filter';
+
+ /**
+ * @ngdoc method
+ * @name $filterProvider#register
+ * @param {string|Object} name Name of the filter function, or an object map of filters where
+ * the keys are the filter names and the values are the filter factories.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
+ * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
+ * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
+ * (`myapp_subsection_filterx`).
+ * </div>
+ * @param {Function} factory If the first argument was a string, a factory function for the filter to be registered.
+ * @returns {Object} Registered filter instance, or if a map of filters was provided then a map
+ * of the registered filter instances.
+ */
+ function register(name, factory) {
+ if (isObject(name)) {
+ var filters = {};
+ forEach(name, function(filter, key) {
+ filters[key] = register(key, filter);
+ });
+ return filters;
+ } else {
+ return $provide.factory(name + suffix, factory);
+ }
+ }
+ this.register = register;
+
+ this.$get = ['$injector', function($injector) {
+ return function(name) {
+ return $injector.get(name + suffix);
+ };
+ }];
+
+ ////////////////////////////////////////
+
+ /* global
+ currencyFilter: false,
+ dateFilter: false,
+ filterFilter: false,
+ jsonFilter: false,
+ limitToFilter: false,
+ lowercaseFilter: false,
+ numberFilter: false,
+ orderByFilter: false,
+ uppercaseFilter: false,
+ */
+
+ register('currency', currencyFilter);
+ register('date', dateFilter);
+ register('filter', filterFilter);
+ register('json', jsonFilter);
+ register('limitTo', limitToFilter);
+ register('lowercase', lowercaseFilter);
+ register('number', numberFilter);
+ register('orderBy', orderByFilter);
+ register('uppercase', uppercaseFilter);
+}
+
+/**
+ * @ngdoc filter
+ * @name filter
+ * @kind function
+ *
+ * @description
+ * Selects a subset of items from `array` and returns it as a new array.
+ *
+ * @param {Array} array The source array.
+ * @param {string|Object|function()} expression The predicate to be used for selecting items from
+ * `array`.
+ *
+ * Can be one of:
+ *
+ * - `string`: The string is used for matching against the contents of the `array`. All strings or
+ * objects with string properties in `array` that match this string will be returned. This also
+ * applies to nested object properties.
+ * The predicate can be negated by prefixing the string with `!`.
+ *
+ * - `Object`: A pattern object can be used to filter specific properties on objects contained
+ * by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items
+ * which have property `name` containing "M" and property `phone` containing "1". A special
+ * property name `$` can be used (as in `{$:"text"}`) to accept a match against any
+ * property of the object or its nested object properties. That's equivalent to the simple
+ * substring match with a `string` as described above. The predicate can be negated by prefixing
+ * the string with `!`.
+ * For example `{name: "!M"}` predicate will return an array of items which have property `name`
+ * not containing "M".
+ *
+ * Note that a named property will match properties on the same level only, while the special
+ * `$` property will match properties on the same level or deeper. E.g. an array item like
+ * `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but
+ * **will** be matched by `{$: 'John'}`.
+ *
+ * - `function(value, index, array)`: A predicate function can be used to write arbitrary filters.
+ * The function is called for each element of the array, with the element, its index, and
+ * the entire array itself as arguments.
+ *
+ * The final result is an array of those elements that the predicate returned true for.
+ *
+ * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in
+ * determining if the expected value (from the filter expression) and actual value (from
+ * the object in the array) should be considered a match.
+ *
+ * Can be one of:
+ *
+ * - `function(actual, expected)`:
+ * The function will be given the object value and the predicate value to compare and
+ * should return true if both values should be considered equal.
+ *
+ * - `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`.
+ * This is essentially strict comparison of expected and actual.
+ *
+ * - `false|undefined`: A short hand for a function which will look for a substring match in case
+ * insensitive way.
+ *
+ * Primitive values are converted to strings. Objects are not compared against primitives,
+ * unless they have a custom `toString` method (e.g. `Date` objects).
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <div ng-init="friends = [{name:'John', phone:'555-1276'},
+ {name:'Mary', phone:'800-BIG-MARY'},
+ {name:'Mike', phone:'555-4321'},
+ {name:'Adam', phone:'555-5678'},
+ {name:'Julie', phone:'555-8765'},
+ {name:'Juliette', phone:'555-5678'}]"></div>
+
+ <label>Search: <input ng-model="searchText"></label>
+ <table id="searchTextResults">
+ <tr><th>Name</th><th>Phone</th></tr>
+ <tr ng-repeat="friend in friends | filter:searchText">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ </tr>
+ </table>
+ <hr>
+ <label>Any: <input ng-model="search.$"></label> <br>
+ <label>Name only <input ng-model="search.name"></label><br>
+ <label>Phone only <input ng-model="search.phone"></label><br>
+ <label>Equality <input type="checkbox" ng-model="strict"></label><br>
+ <table id="searchObjResults">
+ <tr><th>Name</th><th>Phone</th></tr>
+ <tr ng-repeat="friendObj in friends | filter:search:strict">
+ <td>{{friendObj.name}}</td>
+ <td>{{friendObj.phone}}</td>
+ </tr>
+ </table>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var expectFriendNames = function(expectedNames, key) {
+ element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) {
+ arr.forEach(function(wd, i) {
+ expect(wd.getText()).toMatch(expectedNames[i]);
+ });
+ });
+ };
+
+ it('should search across all fields when filtering with a string', function() {
+ var searchText = element(by.model('searchText'));
+ searchText.clear();
+ searchText.sendKeys('m');
+ expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend');
+
+ searchText.clear();
+ searchText.sendKeys('76');
+ expectFriendNames(['John', 'Julie'], 'friend');
+ });
+
+ it('should search in specific fields when filtering with a predicate object', function() {
+ var searchAny = element(by.model('search.$'));
+ searchAny.clear();
+ searchAny.sendKeys('i');
+ expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj');
+ });
+ it('should use a equal comparison when comparator is true', function() {
+ var searchName = element(by.model('search.name'));
+ var strict = element(by.model('strict'));
+ searchName.clear();
+ searchName.sendKeys('Julie');
+ strict.click();
+ expectFriendNames(['Julie'], 'friendObj');
+ });
+ </file>
+ </example>
+ */
+function filterFilter() {
+ return function(array, expression, comparator) {
+ if (!isArrayLike(array)) {
+ if (array == null) {
+ return array;
+ } else {
+ throw minErr('filter')('notarray', 'Expected array but received: {0}', array);
+ }
+ }
+
+ var expressionType = getTypeForFilter(expression);
+ var predicateFn;
+ var matchAgainstAnyProp;
+
+ switch (expressionType) {
+ case 'function':
+ predicateFn = expression;
+ break;
+ case 'boolean':
+ case 'null':
+ case 'number':
+ case 'string':
+ matchAgainstAnyProp = true;
+ //jshint -W086
+ case 'object':
+ //jshint +W086
+ predicateFn = createPredicateFn(expression, comparator, matchAgainstAnyProp);
+ break;
+ default:
+ return array;
+ }
+
+ return Array.prototype.filter.call(array, predicateFn);
+ };
+}
+
+// Helper functions for `filterFilter`
+function createPredicateFn(expression, comparator, matchAgainstAnyProp) {
+ var shouldMatchPrimitives = isObject(expression) && ('$' in expression);
+ var predicateFn;
+
+ if (comparator === true) {
+ comparator = equals;
+ } else if (!isFunction(comparator)) {
+ comparator = function(actual, expected) {
+ if (isUndefined(actual)) {
+ // No substring matching against `undefined`
+ return false;
+ }
+ if ((actual === null) || (expected === null)) {
+ // No substring matching against `null`; only match against `null`
+ return actual === expected;
+ }
+ if (isObject(expected) || (isObject(actual) && !hasCustomToString(actual))) {
+ // Should not compare primitives against objects, unless they have custom `toString` method
+ return false;
+ }
+
+ actual = lowercase('' + actual);
+ expected = lowercase('' + expected);
+ return actual.indexOf(expected) !== -1;
+ };
+ }
+
+ predicateFn = function(item) {
+ if (shouldMatchPrimitives && !isObject(item)) {
+ return deepCompare(item, expression.$, comparator, false);
+ }
+ return deepCompare(item, expression, comparator, matchAgainstAnyProp);
+ };
+
+ return predicateFn;
+}
+
+function deepCompare(actual, expected, comparator, matchAgainstAnyProp, dontMatchWholeObject) {
+ var actualType = getTypeForFilter(actual);
+ var expectedType = getTypeForFilter(expected);
+
+ if ((expectedType === 'string') && (expected.charAt(0) === '!')) {
+ return !deepCompare(actual, expected.substring(1), comparator, matchAgainstAnyProp);
+ } else if (isArray(actual)) {
+ // In case `actual` is an array, consider it a match
+ // if ANY of it's items matches `expected`
+ return actual.some(function(item) {
+ return deepCompare(item, expected, comparator, matchAgainstAnyProp);
+ });
+ }
+
+ switch (actualType) {
+ case 'object':
+ var key;
+ if (matchAgainstAnyProp) {
+ for (key in actual) {
+ if ((key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, true)) {
+ return true;
+ }
+ }
+ return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, false);
+ } else if (expectedType === 'object') {
+ for (key in expected) {
+ var expectedVal = expected[key];
+ if (isFunction(expectedVal) || isUndefined(expectedVal)) {
+ continue;
+ }
+
+ var matchAnyProperty = key === '$';
+ var actualVal = matchAnyProperty ? actual : actual[key];
+ if (!deepCompare(actualVal, expectedVal, comparator, matchAnyProperty, matchAnyProperty)) {
+ return false;
+ }
+ }
+ return true;
+ } else {
+ return comparator(actual, expected);
+ }
+ break;
+ case 'function':
+ return false;
+ default:
+ return comparator(actual, expected);
+ }
+}
+
+// Used for easily differentiating between `null` and actual `object`
+function getTypeForFilter(val) {
+ return (val === null) ? 'null' : typeof val;
+}
+
+var MAX_DIGITS = 22;
+var DECIMAL_SEP = '.';
+var ZERO_CHAR = '0';
+
+/**
+ * @ngdoc filter
+ * @name currency
+ * @kind function
+ *
+ * @description
+ * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default
+ * symbol for current locale is used.
+ *
+ * @param {number} amount Input to filter.
+ * @param {string=} symbol Currency symbol or identifier to be displayed.
+ * @param {number=} fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale
+ * @returns {string} Formatted number.
+ *
+ *
+ * @example
+ <example module="currencyExample">
+ <file name="index.html">
+ <script>
+ angular.module('currencyExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.amount = 1234.56;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <input type="number" ng-model="amount" aria-label="amount"> <br>
+ default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br>
+ custom currency identifier (USD$): <span id="currency-custom">{{amount | currency:"USD$"}}</span>
+ no fractions (0): <span id="currency-no-fractions">{{amount | currency:"USD$":0}}</span>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should init with 1234.56', function() {
+ expect(element(by.id('currency-default')).getText()).toBe('$1,234.56');
+ expect(element(by.id('currency-custom')).getText()).toBe('USD$1,234.56');
+ expect(element(by.id('currency-no-fractions')).getText()).toBe('USD$1,235');
+ });
+ it('should update', function() {
+ if (browser.params.browser == 'safari') {
+ // Safari does not understand the minus key. See
+ // https://github.com/angular/protractor/issues/481
+ return;
+ }
+ element(by.model('amount')).clear();
+ element(by.model('amount')).sendKeys('-1234');
+ expect(element(by.id('currency-default')).getText()).toBe('-$1,234.00');
+ expect(element(by.id('currency-custom')).getText()).toBe('-USD$1,234.00');
+ expect(element(by.id('currency-no-fractions')).getText()).toBe('-USD$1,234');
+ });
+ </file>
+ </example>
+ */
+currencyFilter.$inject = ['$locale'];
+function currencyFilter($locale) {
+ var formats = $locale.NUMBER_FORMATS;
+ return function(amount, currencySymbol, fractionSize) {
+ if (isUndefined(currencySymbol)) {
+ currencySymbol = formats.CURRENCY_SYM;
+ }
+
+ if (isUndefined(fractionSize)) {
+ fractionSize = formats.PATTERNS[1].maxFrac;
+ }
+
+ // if null or undefined pass it through
+ return (amount == null)
+ ? amount
+ : formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize).
+ replace(/\u00A4/g, currencySymbol);
+ };
+}
+
+/**
+ * @ngdoc filter
+ * @name number
+ * @kind function
+ *
+ * @description
+ * Formats a number as text.
+ *
+ * If the input is null or undefined, it will just be returned.
+ * If the input is infinite (Infinity/-Infinity) the Infinity symbol '∞' is returned.
+ * If the input is not a number an empty string is returned.
+ *
+ *
+ * @param {number|string} number Number to format.
+ * @param {(number|string)=} fractionSize Number of decimal places to round the number to.
+ * If this is not provided then the fraction size is computed from the current locale's number
+ * formatting pattern. In the case of the default locale, it will be 3.
+ * @returns {string} Number rounded to fractionSize and places a “,†after each third digit.
+ *
+ * @example
+ <example module="numberFilterExample">
+ <file name="index.html">
+ <script>
+ angular.module('numberFilterExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.val = 1234.56789;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>Enter number: <input ng-model='val'></label><br>
+ Default formatting: <span id='number-default'>{{val | number}}</span><br>
+ No fractions: <span>{{val | number:0}}</span><br>
+ Negative number: <span>{{-val | number:4}}</span>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should format numbers', function() {
+ expect(element(by.id('number-default')).getText()).toBe('1,234.568');
+ expect(element(by.binding('val | number:0')).getText()).toBe('1,235');
+ expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');
+ });
+
+ it('should update', function() {
+ element(by.model('val')).clear();
+ element(by.model('val')).sendKeys('3374.333');
+ expect(element(by.id('number-default')).getText()).toBe('3,374.333');
+ expect(element(by.binding('val | number:0')).getText()).toBe('3,374');
+ expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330');
+ });
+ </file>
+ </example>
+ */
+numberFilter.$inject = ['$locale'];
+function numberFilter($locale) {
+ var formats = $locale.NUMBER_FORMATS;
+ return function(number, fractionSize) {
+
+ // if null or undefined pass it through
+ return (number == null)
+ ? number
+ : formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,
+ fractionSize);
+ };
+}
+
+/**
+ * Parse a number (as a string) into three components that can be used
+ * for formatting the number.
+ *
+ * (Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/)
+ *
+ * @param {string} numStr The number to parse
+ * @return {object} An object describing this number, containing the following keys:
+ * - d : an array of digits containing leading zeros as necessary
+ * - i : the number of the digits in `d` that are to the left of the decimal point
+ * - e : the exponent for numbers that would need more than `MAX_DIGITS` digits in `d`
+ *
+ */
+function parse(numStr) {
+ var exponent = 0, digits, numberOfIntegerDigits;
+ var i, j, zeros;
+
+ // Decimal point?
+ if ((numberOfIntegerDigits = numStr.indexOf(DECIMAL_SEP)) > -1) {
+ numStr = numStr.replace(DECIMAL_SEP, '');
+ }
+
+ // Exponential form?
+ if ((i = numStr.search(/e/i)) > 0) {
+ // Work out the exponent.
+ if (numberOfIntegerDigits < 0) numberOfIntegerDigits = i;
+ numberOfIntegerDigits += +numStr.slice(i + 1);
+ numStr = numStr.substring(0, i);
+ } else if (numberOfIntegerDigits < 0) {
+ // There was no decimal point or exponent so it is an integer.
+ numberOfIntegerDigits = numStr.length;
+ }
+
+ // Count the number of leading zeros.
+ for (i = 0; numStr.charAt(i) == ZERO_CHAR; i++);
+
+ if (i == (zeros = numStr.length)) {
+ // The digits are all zero.
+ digits = [0];
+ numberOfIntegerDigits = 1;
+ } else {
+ // Count the number of trailing zeros
+ zeros--;
+ while (numStr.charAt(zeros) == ZERO_CHAR) zeros--;
+
+ // Trailing zeros are insignificant so ignore them
+ numberOfIntegerDigits -= i;
+ digits = [];
+ // Convert string to array of digits without leading/trailing zeros.
+ for (j = 0; i <= zeros; i++, j++) {
+ digits[j] = +numStr.charAt(i);
+ }
+ }
+
+ // If the number overflows the maximum allowed digits then use an exponent.
+ if (numberOfIntegerDigits > MAX_DIGITS) {
+ digits = digits.splice(0, MAX_DIGITS - 1);
+ exponent = numberOfIntegerDigits - 1;
+ numberOfIntegerDigits = 1;
+ }
+
+ return { d: digits, e: exponent, i: numberOfIntegerDigits };
+}
+
+/**
+ * Round the parsed number to the specified number of decimal places
+ * This function changed the parsedNumber in-place
+ */
+function roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) {
+ var digits = parsedNumber.d;
+ var fractionLen = digits.length - parsedNumber.i;
+
+ // determine fractionSize if it is not specified; `+fractionSize` converts it to a number
+ fractionSize = (isUndefined(fractionSize)) ? Math.min(Math.max(minFrac, fractionLen), maxFrac) : +fractionSize;
+
+ // The index of the digit to where rounding is to occur
+ var roundAt = fractionSize + parsedNumber.i;
+ var digit = digits[roundAt];
+
+ if (roundAt > 0) {
+ digits.splice(roundAt);
+ } else {
+ // We rounded to zero so reset the parsedNumber
+ parsedNumber.i = 1;
+ digits.length = roundAt = fractionSize + 1;
+ for (var i=0; i < roundAt; i++) digits[i] = 0;
+ }
+
+ if (digit >= 5) digits[roundAt - 1]++;
+
+ // Pad out with zeros to get the required fraction length
+ for (; fractionLen < fractionSize; fractionLen++) digits.push(0);
+
+
+ // Do any carrying, e.g. a digit was rounded up to 10
+ var carry = digits.reduceRight(function(carry, d, i, digits) {
+ d = d + carry;
+ digits[i] = d % 10;
+ return Math.floor(d / 10);
+ }, 0);
+ if (carry) {
+ digits.unshift(carry);
+ parsedNumber.i++;
+ }
+}
+
+/**
+ * Format a number into a string
+ * @param {number} number The number to format
+ * @param {{
+ * minFrac, // the minimum number of digits required in the fraction part of the number
+ * maxFrac, // the maximum number of digits required in the fraction part of the number
+ * gSize, // number of digits in each group of separated digits
+ * lgSize, // number of digits in the last group of digits before the decimal separator
+ * negPre, // the string to go in front of a negative number (e.g. `-` or `(`))
+ * posPre, // the string to go in front of a positive number
+ * negSuf, // the string to go after a negative number (e.g. `)`)
+ * posSuf // the string to go after a positive number
+ * }} pattern
+ * @param {string} groupSep The string to separate groups of number (e.g. `,`)
+ * @param {string} decimalSep The string to act as the decimal separator (e.g. `.`)
+ * @param {[type]} fractionSize The size of the fractional part of the number
+ * @return {string} The number formatted as a string
+ */
+function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
+
+ if (!(isString(number) || isNumber(number)) || isNaN(number)) return '';
+
+ var isInfinity = !isFinite(number);
+ var isZero = false;
+ var numStr = Math.abs(number) + '',
+ formattedText = '',
+ parsedNumber;
+
+ if (isInfinity) {
+ formattedText = '\u221e';
+ } else {
+ parsedNumber = parse(numStr);
+
+ roundNumber(parsedNumber, fractionSize, pattern.minFrac, pattern.maxFrac);
+
+ var digits = parsedNumber.d;
+ var integerLen = parsedNumber.i;
+ var exponent = parsedNumber.e;
+ var decimals = [];
+ isZero = digits.reduce(function(isZero, d) { return isZero && !d; }, true);
+
+ // pad zeros for small numbers
+ while (integerLen < 0) {
+ digits.unshift(0);
+ integerLen++;
+ }
+
+ // extract decimals digits
+ if (integerLen > 0) {
+ decimals = digits.splice(integerLen);
+ } else {
+ decimals = digits;
+ digits = [0];
+ }
+
+ // format the integer digits with grouping separators
+ var groups = [];
+ if (digits.length > pattern.lgSize) {
+ groups.unshift(digits.splice(-pattern.lgSize).join(''));
+ }
+ while (digits.length > pattern.gSize) {
+ groups.unshift(digits.splice(-pattern.gSize).join(''));
+ }
+ if (digits.length) {
+ groups.unshift(digits.join(''));
+ }
+ formattedText = groups.join(groupSep);
+
+ // append the decimal digits
+ if (decimals.length) {
+ formattedText += decimalSep + decimals.join('');
+ }
+
+ if (exponent) {
+ formattedText += 'e+' + exponent;
+ }
+ }
+ if (number < 0 && !isZero) {
+ return pattern.negPre + formattedText + pattern.negSuf;
+ } else {
+ return pattern.posPre + formattedText + pattern.posSuf;
+ }
+}
+
+function padNumber(num, digits, trim) {
+ var neg = '';
+ if (num < 0) {
+ neg = '-';
+ num = -num;
+ }
+ num = '' + num;
+ while (num.length < digits) num = ZERO_CHAR + num;
+ if (trim) {
+ num = num.substr(num.length - digits);
+ }
+ return neg + num;
+}
+
+
+function dateGetter(name, size, offset, trim) {
+ offset = offset || 0;
+ return function(date) {
+ var value = date['get' + name]();
+ if (offset > 0 || value > -offset) {
+ value += offset;
+ }
+ if (value === 0 && offset == -12) value = 12;
+ return padNumber(value, size, trim);
+ };
+}
+
+function dateStrGetter(name, shortForm) {
+ return function(date, formats) {
+ var value = date['get' + name]();
+ var get = uppercase(shortForm ? ('SHORT' + name) : name);
+
+ return formats[get][value];
+ };
+}
+
+function timeZoneGetter(date, formats, offset) {
+ var zone = -1 * offset;
+ var paddedZone = (zone >= 0) ? "+" : "";
+
+ paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
+ padNumber(Math.abs(zone % 60), 2);
+
+ return paddedZone;
+}
+
+function getFirstThursdayOfYear(year) {
+ // 0 = index of January
+ var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay();
+ // 4 = index of Thursday (+1 to account for 1st = 5)
+ // 11 = index of *next* Thursday (+1 account for 1st = 12)
+ return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst);
+}
+
+function getThursdayThisWeek(datetime) {
+ return new Date(datetime.getFullYear(), datetime.getMonth(),
+ // 4 = index of Thursday
+ datetime.getDate() + (4 - datetime.getDay()));
+}
+
+function weekGetter(size) {
+ return function(date) {
+ var firstThurs = getFirstThursdayOfYear(date.getFullYear()),
+ thisThurs = getThursdayThisWeek(date);
+
+ var diff = +thisThurs - +firstThurs,
+ result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week
+
+ return padNumber(result, size);
+ };
+}
+
+function ampmGetter(date, formats) {
+ return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];
+}
+
+function eraGetter(date, formats) {
+ return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1];
+}
+
+function longEraGetter(date, formats) {
+ return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1];
+}
+
+var DATE_FORMATS = {
+ yyyy: dateGetter('FullYear', 4),
+ yy: dateGetter('FullYear', 2, 0, true),
+ y: dateGetter('FullYear', 1),
+ MMMM: dateStrGetter('Month'),
+ MMM: dateStrGetter('Month', true),
+ MM: dateGetter('Month', 2, 1),
+ M: dateGetter('Month', 1, 1),
+ dd: dateGetter('Date', 2),
+ d: dateGetter('Date', 1),
+ HH: dateGetter('Hours', 2),
+ H: dateGetter('Hours', 1),
+ hh: dateGetter('Hours', 2, -12),
+ h: dateGetter('Hours', 1, -12),
+ mm: dateGetter('Minutes', 2),
+ m: dateGetter('Minutes', 1),
+ ss: dateGetter('Seconds', 2),
+ s: dateGetter('Seconds', 1),
+ // while ISO 8601 requires fractions to be prefixed with `.` or `,`
+ // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions
+ sss: dateGetter('Milliseconds', 3),
+ EEEE: dateStrGetter('Day'),
+ EEE: dateStrGetter('Day', true),
+ a: ampmGetter,
+ Z: timeZoneGetter,
+ ww: weekGetter(2),
+ w: weekGetter(1),
+ G: eraGetter,
+ GG: eraGetter,
+ GGG: eraGetter,
+ GGGG: longEraGetter
+};
+
+var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,
+ NUMBER_STRING = /^\-?\d+$/;
+
+/**
+ * @ngdoc filter
+ * @name date
+ * @kind function
+ *
+ * @description
+ * Formats `date` to a string based on the requested `format`.
+ *
+ * `format` string can be composed of the following elements:
+ *
+ * * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)
+ * * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
+ * * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)
+ * * `'MMMM'`: Month in year (January-December)
+ * * `'MMM'`: Month in year (Jan-Dec)
+ * * `'MM'`: Month in year, padded (01-12)
+ * * `'M'`: Month in year (1-12)
+ * * `'dd'`: Day in month, padded (01-31)
+ * * `'d'`: Day in month (1-31)
+ * * `'EEEE'`: Day in Week,(Sunday-Saturday)
+ * * `'EEE'`: Day in Week, (Sun-Sat)
+ * * `'HH'`: Hour in day, padded (00-23)
+ * * `'H'`: Hour in day (0-23)
+ * * `'hh'`: Hour in AM/PM, padded (01-12)
+ * * `'h'`: Hour in AM/PM, (1-12)
+ * * `'mm'`: Minute in hour, padded (00-59)
+ * * `'m'`: Minute in hour (0-59)
+ * * `'ss'`: Second in minute, padded (00-59)
+ * * `'s'`: Second in minute (0-59)
+ * * `'sss'`: Millisecond in second, padded (000-999)
+ * * `'a'`: AM/PM marker
+ * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)
+ * * `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year
+ * * `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year
+ * * `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD')
+ * * `'GGGG'`: The long form of the era string (e.g. 'Anno Domini')
+ *
+ * `format` string can also be one of the following predefined
+ * {@link guide/i18n localizable formats}:
+ *
+ * * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale
+ * (e.g. Sep 3, 2010 12:05:08 PM)
+ * * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 PM)
+ * * `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` for en_US locale
+ * (e.g. Friday, September 3, 2010)
+ * * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010)
+ * * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010)
+ * * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)
+ * * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 PM)
+ * * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 PM)
+ *
+ * `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g.
+ * `"h 'in the morning'"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence
+ * (e.g. `"h 'o''clock'"`).
+ *
+ * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
+ * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its
+ * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is
+ * specified in the string input, the time is considered to be in the local timezone.
+ * @param {string=} format Formatting rules (see Description). If not specified,
+ * `mediumDate` is used.
+ * @param {string=} timezone Timezone to be used for formatting. It understands UTC/GMT and the
+ * continental US time zone abbreviations, but for general use, use a time zone offset, for
+ * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
+ * If not specified, the timezone of the browser will be used.
+ * @returns {string} Formatted string or the input if input is not recognized as date/millis.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:
+ <span>{{1288323623006 | date:'medium'}}</span><br>
+ <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:
+ <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>
+ <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:
+ <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>
+ <span ng-non-bindable>{{1288323623006 | date:"MM/dd/yyyy 'at' h:mma"}}</span>:
+ <span>{{'1288323623006' | date:"MM/dd/yyyy 'at' h:mma"}}</span><br>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should format date', function() {
+ expect(element(by.binding("1288323623006 | date:'medium'")).getText()).
+ toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/);
+ expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()).
+ toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/);
+ expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()).
+ toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
+ expect(element(by.binding("'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"")).getText()).
+ toMatch(/10\/2\d\/2010 at \d{1,2}:\d{2}(AM|PM)/);
+ });
+ </file>
+ </example>
+ */
+dateFilter.$inject = ['$locale'];
+function dateFilter($locale) {
+
+
+ var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
+ // 1 2 3 4 5 6 7 8 9 10 11
+ function jsonStringToDate(string) {
+ var match;
+ if (match = string.match(R_ISO8601_STR)) {
+ var date = new Date(0),
+ tzHour = 0,
+ tzMin = 0,
+ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,
+ timeSetter = match[8] ? date.setUTCHours : date.setHours;
+
+ if (match[9]) {
+ tzHour = toInt(match[9] + match[10]);
+ tzMin = toInt(match[9] + match[11]);
+ }
+ dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3]));
+ var h = toInt(match[4] || 0) - tzHour;
+ var m = toInt(match[5] || 0) - tzMin;
+ var s = toInt(match[6] || 0);
+ var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
+ timeSetter.call(date, h, m, s, ms);
+ return date;
+ }
+ return string;
+ }
+
+
+ return function(date, format, timezone) {
+ var text = '',
+ parts = [],
+ fn, match;
+
+ format = format || 'mediumDate';
+ format = $locale.DATETIME_FORMATS[format] || format;
+ if (isString(date)) {
+ date = NUMBER_STRING.test(date) ? toInt(date) : jsonStringToDate(date);
+ }
+
+ if (isNumber(date)) {
+ date = new Date(date);
+ }
+
+ if (!isDate(date) || !isFinite(date.getTime())) {
+ return date;
+ }
+
+ while (format) {
+ match = DATE_FORMATS_SPLIT.exec(format);
+ if (match) {
+ parts = concat(parts, match, 1);
+ format = parts.pop();
+ } else {
+ parts.push(format);
+ format = null;
+ }
+ }
+
+ var dateTimezoneOffset = date.getTimezoneOffset();
+ if (timezone) {
+ dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
+ date = convertTimezoneToLocal(date, timezone, true);
+ }
+ forEach(parts, function(value) {
+ fn = DATE_FORMATS[value];
+ text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset)
+ : value === "''" ? "'" : value.replace(/(^'|'$)/g, '').replace(/''/g, "'");
+ });
+
+ return text;
+ };
+}
+
+
+/**
+ * @ngdoc filter
+ * @name json
+ * @kind function
+ *
+ * @description
+ * Allows you to convert a JavaScript object into JSON string.
+ *
+ * This filter is mostly useful for debugging. When using the double curly {{value}} notation
+ * the binding is automatically converted to JSON.
+ *
+ * @param {*} object Any JavaScript object (including arrays and primitive types) to filter.
+ * @param {number=} spacing The number of spaces to use per indentation, defaults to 2.
+ * @returns {string} JSON string.
+ *
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <pre id="default-spacing">{{ {'name':'value'} | json }}</pre>
+ <pre id="custom-spacing">{{ {'name':'value'} | json:4 }}</pre>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should jsonify filtered objects', function() {
+ expect(element(by.id('default-spacing')).getText()).toMatch(/\{\n "name": ?"value"\n}/);
+ expect(element(by.id('custom-spacing')).getText()).toMatch(/\{\n "name": ?"value"\n}/);
+ });
+ </file>
+ </example>
+ *
+ */
+function jsonFilter() {
+ return function(object, spacing) {
+ if (isUndefined(spacing)) {
+ spacing = 2;
+ }
+ return toJson(object, spacing);
+ };
+}
+
+
+/**
+ * @ngdoc filter
+ * @name lowercase
+ * @kind function
+ * @description
+ * Converts string to lowercase.
+ * @see angular.lowercase
+ */
+var lowercaseFilter = valueFn(lowercase);
+
+
+/**
+ * @ngdoc filter
+ * @name uppercase
+ * @kind function
+ * @description
+ * Converts string to uppercase.
+ * @see angular.uppercase
+ */
+var uppercaseFilter = valueFn(uppercase);
+
+/**
+ * @ngdoc filter
+ * @name limitTo
+ * @kind function
+ *
+ * @description
+ * Creates a new array or string containing only a specified number of elements. The elements
+ * are taken from either the beginning or the end of the source array, string or number, as specified by
+ * the value and sign (positive or negative) of `limit`. If a number is used as input, it is
+ * converted to a string.
+ *
+ * @param {Array|string|number} input Source array, string or number to be limited.
+ * @param {string|number} limit The length of the returned array or string. If the `limit` number
+ * is positive, `limit` number of items from the beginning of the source array/string are copied.
+ * If the number is negative, `limit` number of items from the end of the source array/string
+ * are copied. The `limit` will be trimmed if it exceeds `array.length`. If `limit` is undefined,
+ * the input will be returned unchanged.
+ * @param {(string|number)=} begin Index at which to begin limitation. As a negative index, `begin`
+ * indicates an offset from the end of `input`. Defaults to `0`.
+ * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array
+ * had less than `limit` elements.
+ *
+ * @example
+ <example module="limitToExample">
+ <file name="index.html">
+ <script>
+ angular.module('limitToExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.numbers = [1,2,3,4,5,6,7,8,9];
+ $scope.letters = "abcdefghi";
+ $scope.longNumber = 2345432342;
+ $scope.numLimit = 3;
+ $scope.letterLimit = 3;
+ $scope.longNumberLimit = 3;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>
+ Limit {{numbers}} to:
+ <input type="number" step="1" ng-model="numLimit">
+ </label>
+ <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>
+ <label>
+ Limit {{letters}} to:
+ <input type="number" step="1" ng-model="letterLimit">
+ </label>
+ <p>Output letters: {{ letters | limitTo:letterLimit }}</p>
+ <label>
+ Limit {{longNumber}} to:
+ <input type="number" step="1" ng-model="longNumberLimit">
+ </label>
+ <p>Output long number: {{ longNumber | limitTo:longNumberLimit }}</p>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var numLimitInput = element(by.model('numLimit'));
+ var letterLimitInput = element(by.model('letterLimit'));
+ var longNumberLimitInput = element(by.model('longNumberLimit'));
+ var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));
+ var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));
+ var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit'));
+
+ it('should limit the number array to first three items', function() {
+ expect(numLimitInput.getAttribute('value')).toBe('3');
+ expect(letterLimitInput.getAttribute('value')).toBe('3');
+ expect(longNumberLimitInput.getAttribute('value')).toBe('3');
+ expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');
+ expect(limitedLetters.getText()).toEqual('Output letters: abc');
+ expect(limitedLongNumber.getText()).toEqual('Output long number: 234');
+ });
+
+ // There is a bug in safari and protractor that doesn't like the minus key
+ // it('should update the output when -3 is entered', function() {
+ // numLimitInput.clear();
+ // numLimitInput.sendKeys('-3');
+ // letterLimitInput.clear();
+ // letterLimitInput.sendKeys('-3');
+ // longNumberLimitInput.clear();
+ // longNumberLimitInput.sendKeys('-3');
+ // expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');
+ // expect(limitedLetters.getText()).toEqual('Output letters: ghi');
+ // expect(limitedLongNumber.getText()).toEqual('Output long number: 342');
+ // });
+
+ it('should not exceed the maximum size of input array', function() {
+ numLimitInput.clear();
+ numLimitInput.sendKeys('100');
+ letterLimitInput.clear();
+ letterLimitInput.sendKeys('100');
+ longNumberLimitInput.clear();
+ longNumberLimitInput.sendKeys('100');
+ expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');
+ expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');
+ expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342');
+ });
+ </file>
+ </example>
+*/
+function limitToFilter() {
+ return function(input, limit, begin) {
+ if (Math.abs(Number(limit)) === Infinity) {
+ limit = Number(limit);
+ } else {
+ limit = toInt(limit);
+ }
+ if (isNaN(limit)) return input;
+
+ if (isNumber(input)) input = input.toString();
+ if (!isArray(input) && !isString(input)) return input;
+
+ begin = (!begin || isNaN(begin)) ? 0 : toInt(begin);
+ begin = (begin < 0) ? Math.max(0, input.length + begin) : begin;
+
+ if (limit >= 0) {
+ return input.slice(begin, begin + limit);
+ } else {
+ if (begin === 0) {
+ return input.slice(limit, input.length);
+ } else {
+ return input.slice(Math.max(0, begin + limit), begin);
+ }
+ }
+ };
+}
+
+/**
+ * @ngdoc filter
+ * @name orderBy
+ * @kind function
+ *
+ * @description
+ * Orders a specified `array` by the `expression` predicate. It is ordered alphabetically
+ * for strings and numerically for numbers. Note: if you notice numbers are not being sorted
+ * as expected, make sure they are actually being saved as numbers and not strings.
+ * Array-like values (e.g. NodeLists, jQuery objects, TypedArrays, Strings, etc) are also supported.
+ *
+ * @param {Array} array The array (or array-like object) to sort.
+ * @param {function(*)|string|Array.<(function(*)|string)>=} expression A predicate to be
+ * used by the comparator to determine the order of elements.
+ *
+ * Can be one of:
+ *
+ * - `function`: Getter function. The result of this function will be sorted using the
+ * `<`, `===`, `>` operator.
+ * - `string`: An Angular expression. The result of this expression is used to compare elements
+ * (for example `name` to sort by a property called `name` or `name.substr(0, 3)` to sort by
+ * 3 first characters of a property called `name`). The result of a constant expression
+ * is interpreted as a property name to be used in comparisons (for example `"special name"`
+ * to sort object by the value of their `special name` property). An expression can be
+ * optionally prefixed with `+` or `-` to control ascending or descending sort order
+ * (for example, `+name` or `-name`). If no property is provided, (e.g. `'+'`) then the array
+ * element itself is used to compare where sorting.
+ * - `Array`: An array of function or string predicates. The first predicate in the array
+ * is used for sorting, but when two items are equivalent, the next predicate is used.
+ *
+ * If the predicate is missing or empty then it defaults to `'+'`.
+ *
+ * @param {boolean=} reverse Reverse the order of the array.
+ * @returns {Array} Sorted copy of the source array.
+ *
+ *
+ * @example
+ * The example below demonstrates a simple ngRepeat, where the data is sorted
+ * by age in descending order (predicate is set to `'-age'`).
+ * `reverse` is not set, which means it defaults to `false`.
+ <example module="orderByExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <table class="friend">
+ <tr>
+ <th>Name</th>
+ <th>Phone Number</th>
+ <th>Age</th>
+ </tr>
+ <tr ng-repeat="friend in friends | orderBy:'-age'">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ <td>{{friend.age}}</td>
+ </tr>
+ </table>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('orderByExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.friends =
+ [{name:'John', phone:'555-1212', age:10},
+ {name:'Mary', phone:'555-9876', age:19},
+ {name:'Mike', phone:'555-4321', age:21},
+ {name:'Adam', phone:'555-5678', age:35},
+ {name:'Julie', phone:'555-8765', age:29}];
+ }]);
+ </file>
+ </example>
+ *
+ * The predicate and reverse parameters can be controlled dynamically through scope properties,
+ * as shown in the next example.
+ * @example
+ <example module="orderByExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
+ <hr/>
+ <button ng-click="predicate=''">Set to unsorted</button>
+ <table class="friend">
+ <tr>
+ <th>
+ <button ng-click="order('name')">Name</button>
+ <span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
+ </th>
+ <th>
+ <button ng-click="order('phone')">Phone Number</button>
+ <span class="sortorder" ng-show="predicate === 'phone'" ng-class="{reverse:reverse}"></span>
+ </th>
+ <th>
+ <button ng-click="order('age')">Age</button>
+ <span class="sortorder" ng-show="predicate === 'age'" ng-class="{reverse:reverse}"></span>
+ </th>
+ </tr>
+ <tr ng-repeat="friend in friends | orderBy:predicate:reverse">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ <td>{{friend.age}}</td>
+ </tr>
+ </table>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('orderByExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.friends =
+ [{name:'John', phone:'555-1212', age:10},
+ {name:'Mary', phone:'555-9876', age:19},
+ {name:'Mike', phone:'555-4321', age:21},
+ {name:'Adam', phone:'555-5678', age:35},
+ {name:'Julie', phone:'555-8765', age:29}];
+ $scope.predicate = 'age';
+ $scope.reverse = true;
+ $scope.order = function(predicate) {
+ $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
+ $scope.predicate = predicate;
+ };
+ }]);
+ </file>
+ <file name="style.css">
+ .sortorder:after {
+ content: '\25b2';
+ }
+ .sortorder.reverse:after {
+ content: '\25bc';
+ }
+ </file>
+ </example>
+ *
+ * It's also possible to call the orderBy filter manually, by injecting `$filter`, retrieving the
+ * filter routine with `$filter('orderBy')`, and calling the returned filter routine with the
+ * desired parameters.
+ *
+ * Example:
+ *
+ * @example
+ <example module="orderByExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
+ <table class="friend">
+ <tr>
+ <th>
+ <button ng-click="order('name')">Name</button>
+ <span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
+ </th>
+ <th>
+ <button ng-click="order('phone')">Phone Number</button>
+ <span class="sortorder" ng-show="predicate === 'phone'" ng-class="{reverse:reverse}"></span>
+ </th>
+ <th>
+ <button ng-click="order('age')">Age</button>
+ <span class="sortorder" ng-show="predicate === 'age'" ng-class="{reverse:reverse}"></span>
+ </th>
+ </tr>
+ <tr ng-repeat="friend in friends">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ <td>{{friend.age}}</td>
+ </tr>
+ </table>
+ </div>
+ </file>
+
+ <file name="script.js">
+ angular.module('orderByExample', [])
+ .controller('ExampleController', ['$scope', '$filter', function($scope, $filter) {
+ var orderBy = $filter('orderBy');
+ $scope.friends = [
+ { name: 'John', phone: '555-1212', age: 10 },
+ { name: 'Mary', phone: '555-9876', age: 19 },
+ { name: 'Mike', phone: '555-4321', age: 21 },
+ { name: 'Adam', phone: '555-5678', age: 35 },
+ { name: 'Julie', phone: '555-8765', age: 29 }
+ ];
+ $scope.order = function(predicate) {
+ $scope.predicate = predicate;
+ $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
+ $scope.friends = orderBy($scope.friends, predicate, $scope.reverse);
+ };
+ $scope.order('age', true);
+ }]);
+ </file>
+
+ <file name="style.css">
+ .sortorder:after {
+ content: '\25b2';
+ }
+ .sortorder.reverse:after {
+ content: '\25bc';
+ }
+ </file>
+</example>
+ */
+orderByFilter.$inject = ['$parse'];
+function orderByFilter($parse) {
+ return function(array, sortPredicate, reverseOrder) {
+
+ if (array == null) return array;
+ if (!isArrayLike(array)) {
+ throw minErr('orderBy')('notarray', 'Expected array but received: {0}', array);
+ }
+
+ if (!isArray(sortPredicate)) { sortPredicate = [sortPredicate]; }
+ if (sortPredicate.length === 0) { sortPredicate = ['+']; }
+
+ var predicates = processPredicates(sortPredicate, reverseOrder);
+ // Add a predicate at the end that evaluates to the element index. This makes the
+ // sort stable as it works as a tie-breaker when all the input predicates cannot
+ // distinguish between two elements.
+ predicates.push({ get: function() { return {}; }, descending: reverseOrder ? -1 : 1});
+
+ // The next three lines are a version of a Swartzian Transform idiom from Perl
+ // (sometimes called the Decorate-Sort-Undecorate idiom)
+ // See https://en.wikipedia.org/wiki/Schwartzian_transform
+ var compareValues = Array.prototype.map.call(array, getComparisonObject);
+ compareValues.sort(doComparison);
+ array = compareValues.map(function(item) { return item.value; });
+
+ return array;
+
+ function getComparisonObject(value, index) {
+ return {
+ value: value,
+ predicateValues: predicates.map(function(predicate) {
+ return getPredicateValue(predicate.get(value), index);
+ })
+ };
+ }
+
+ function doComparison(v1, v2) {
+ var result = 0;
+ for (var index=0, length = predicates.length; index < length; ++index) {
+ result = compare(v1.predicateValues[index], v2.predicateValues[index]) * predicates[index].descending;
+ if (result) break;
+ }
+ return result;
+ }
+ };
+
+ function processPredicates(sortPredicate, reverseOrder) {
+ reverseOrder = reverseOrder ? -1 : 1;
+ return sortPredicate.map(function(predicate) {
+ var descending = 1, get = identity;
+
+ if (isFunction(predicate)) {
+ get = predicate;
+ } else if (isString(predicate)) {
+ if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {
+ descending = predicate.charAt(0) == '-' ? -1 : 1;
+ predicate = predicate.substring(1);
+ }
+ if (predicate !== '') {
+ get = $parse(predicate);
+ if (get.constant) {
+ var key = get();
+ get = function(value) { return value[key]; };
+ }
+ }
+ }
+ return { get: get, descending: descending * reverseOrder };
+ });
+ }
+
+ function isPrimitive(value) {
+ switch (typeof value) {
+ case 'number': /* falls through */
+ case 'boolean': /* falls through */
+ case 'string':
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ function objectValue(value, index) {
+ // If `valueOf` is a valid function use that
+ if (typeof value.valueOf === 'function') {
+ value = value.valueOf();
+ if (isPrimitive(value)) return value;
+ }
+ // If `toString` is a valid function and not the one from `Object.prototype` use that
+ if (hasCustomToString(value)) {
+ value = value.toString();
+ if (isPrimitive(value)) return value;
+ }
+ // We have a basic object so we use the position of the object in the collection
+ return index;
+ }
+
+ function getPredicateValue(value, index) {
+ var type = typeof value;
+ if (value === null) {
+ type = 'string';
+ value = 'null';
+ } else if (type === 'string') {
+ value = value.toLowerCase();
+ } else if (type === 'object') {
+ value = objectValue(value, index);
+ }
+ return { value: value, type: type };
+ }
+
+ function compare(v1, v2) {
+ var result = 0;
+ if (v1.type === v2.type) {
+ if (v1.value !== v2.value) {
+ result = v1.value < v2.value ? -1 : 1;
+ }
+ } else {
+ result = v1.type < v2.type ? -1 : 1;
+ }
+ return result;
+ }
+}
+
+function ngDirective(directive) {
+ if (isFunction(directive)) {
+ directive = {
+ link: directive
+ };
+ }
+ directive.restrict = directive.restrict || 'AC';
+ return valueFn(directive);
+}
+
+/**
+ * @ngdoc directive
+ * @name a
+ * @restrict E
+ *
+ * @description
+ * Modifies the default behavior of the html A tag so that the default action is prevented when
+ * the href attribute is empty.
+ *
+ * This change permits the easy creation of action links with the `ngClick` directive
+ * without changing the location or causing page reloads, e.g.:
+ * `<a href="" ng-click="list.addItem()">Add Item</a>`
+ */
+var htmlAnchorDirective = valueFn({
+ restrict: 'E',
+ compile: function(element, attr) {
+ if (!attr.href && !attr.xlinkHref) {
+ return function(scope, element) {
+ // If the linked element is not an anchor tag anymore, do nothing
+ if (element[0].nodeName.toLowerCase() !== 'a') return;
+
+ // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.
+ var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?
+ 'xlink:href' : 'href';
+ element.on('click', function(event) {
+ // if we have no href url, then don't navigate anywhere.
+ if (!element.attr(href)) {
+ event.preventDefault();
+ }
+ });
+ };
+ }
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngHref
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in an href attribute will
+ * make the link go to the wrong URL if the user clicks it before
+ * Angular has a chance to replace the `{{hash}}` markup with its
+ * value. Until Angular replaces the markup the link will be broken
+ * and will most likely return a 404 error. The `ngHref` directive
+ * solves this problem.
+ *
+ * The wrong way to write it:
+ * ```html
+ * <a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
+ * ```
+ *
+ * @element A
+ * @param {template} ngHref any string which can contain `{{}}` markup.
+ *
+ * @example
+ * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes
+ * in links and their different behaviors:
+ <example>
+ <file name="index.html">
+ <input ng-model="value" /><br />
+ <a id="link-1" href ng-click="value = 1">link 1</a> (link, don't reload)<br />
+ <a id="link-2" href="" ng-click="value = 2">link 2</a> (link, don't reload)<br />
+ <a id="link-3" ng-href="/{{'123'}}">link 3</a> (link, reload!)<br />
+ <a id="link-4" href="" name="xx" ng-click="value = 4">anchor</a> (link, don't reload)<br />
+ <a id="link-5" name="xxx" ng-click="value = 5">anchor</a> (no link)<br />
+ <a id="link-6" ng-href="{{value}}">link</a> (link, change location)
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should execute ng-click but not reload when href without value', function() {
+ element(by.id('link-1')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('1');
+ expect(element(by.id('link-1')).getAttribute('href')).toBe('');
+ });
+
+ it('should execute ng-click but not reload when href empty string', function() {
+ element(by.id('link-2')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('2');
+ expect(element(by.id('link-2')).getAttribute('href')).toBe('');
+ });
+
+ it('should execute ng-click and change url when ng-href specified', function() {
+ expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\/123$/);
+
+ element(by.id('link-3')).click();
+
+ // At this point, we navigate away from an Angular page, so we need
+ // to use browser.driver to get the base webdriver.
+
+ browser.wait(function() {
+ return browser.driver.getCurrentUrl().then(function(url) {
+ return url.match(/\/123$/);
+ });
+ }, 5000, 'page should navigate to /123');
+ });
+
+ it('should execute ng-click but not reload when href empty string and name specified', function() {
+ element(by.id('link-4')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('4');
+ expect(element(by.id('link-4')).getAttribute('href')).toBe('');
+ });
+
+ it('should execute ng-click but not reload when no href but name specified', function() {
+ element(by.id('link-5')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('5');
+ expect(element(by.id('link-5')).getAttribute('href')).toBe(null);
+ });
+
+ it('should only change url when only ng-href', function() {
+ element(by.model('value')).clear();
+ element(by.model('value')).sendKeys('6');
+ expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\/6$/);
+
+ element(by.id('link-6')).click();
+
+ // At this point, we navigate away from an Angular page, so we need
+ // to use browser.driver to get the base webdriver.
+ browser.wait(function() {
+ return browser.driver.getCurrentUrl().then(function(url) {
+ return url.match(/\/6$/);
+ });
+ }, 5000, 'page should navigate to /6');
+ });
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngSrc
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in a `src` attribute doesn't
+ * work right: The browser will fetch from the URL with the literal
+ * text `{{hash}}` until Angular replaces the expression inside
+ * `{{hash}}`. The `ngSrc` directive solves this problem.
+ *
+ * The buggy way to write it:
+ * ```html
+ * <img src="http://www.gravatar.com/avatar/{{hash}}" alt="Description"/>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <img ng-src="http://www.gravatar.com/avatar/{{hash}}" alt="Description" />
+ * ```
+ *
+ * @element IMG
+ * @param {template} ngSrc any string which can contain `{{}}` markup.
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngSrcset
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't
+ * work right: The browser will fetch from the URL with the literal
+ * text `{{hash}}` until Angular replaces the expression inside
+ * `{{hash}}`. The `ngSrcset` directive solves this problem.
+ *
+ * The buggy way to write it:
+ * ```html
+ * <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description"/>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description" />
+ * ```
+ *
+ * @element IMG
+ * @param {template} ngSrcset any string which can contain `{{}}` markup.
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngDisabled
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * This directive sets the `disabled` attribute on the element if the
+ * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `disabled`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Click me to toggle: <input type="checkbox" ng-model="checked"></label><br/>
+ <button ng-model="button" ng-disabled="checked">Button</button>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should toggle button', function() {
+ expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();
+ element(by.model('checked')).click();
+ expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element INPUT
+ * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy,
+ * then the `disabled` attribute will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngChecked
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ * Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.
+ *
+ * Note that this directive should not be used together with {@link ngModel `ngModel`},
+ * as this can lead to unexpected behavior.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `checked`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Check me to check both: <input type="checkbox" ng-model="master"></label><br/>
+ <input id="checkSlave" type="checkbox" ng-checked="master" aria-label="Slave input">
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check both checkBoxes', function() {
+ expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy();
+ element(by.model('master')).click();
+ expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element INPUT
+ * @param {expression} ngChecked If the {@link guide/expression expression} is truthy,
+ * then the `checked` attribute will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngReadonly
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * Sets the `readOnly` attribute on the element, if the expression inside `ngReadonly` is truthy.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `readOnly`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Check me to make text readonly: <input type="checkbox" ng-model="checked"></label><br/>
+ <input type="text" ng-readonly="checked" value="I'm Angular" aria-label="Readonly field" />
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should toggle readonly attr', function() {
+ expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeFalsy();
+ element(by.model('checked')).click();
+ expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element INPUT
+ * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy,
+ * then special attribute "readonly" will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngSelected
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `selected`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Check me to select: <input type="checkbox" ng-model="selected"></label><br/>
+ <select aria-label="ngSelected demo">
+ <option>Hello!</option>
+ <option id="greet" ng-selected="selected">Greetings!</option>
+ </select>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should select Greetings!', function() {
+ expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();
+ element(by.model('selected')).click();
+ expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element OPTION
+ * @param {expression} ngSelected If the {@link guide/expression expression} is truthy,
+ * then special attribute "selected" will be set on the element
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngOpen
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `open`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Check me check multiple: <input type="checkbox" ng-model="open"></label><br/>
+ <details id="details" ng-open="open">
+ <summary>Show/Hide me</summary>
+ </details>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should toggle open', function() {
+ expect(element(by.id('details')).getAttribute('open')).toBeFalsy();
+ element(by.model('open')).click();
+ expect(element(by.id('details')).getAttribute('open')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element DETAILS
+ * @param {expression} ngOpen If the {@link guide/expression expression} is truthy,
+ * then special attribute "open" will be set on the element
+ */
+
+var ngAttributeAliasDirectives = {};
+
+// boolean attrs are evaluated
+forEach(BOOLEAN_ATTR, function(propName, attrName) {
+ // binding to multiple is not supported
+ if (propName == "multiple") return;
+
+ function defaultLinkFn(scope, element, attr) {
+ scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
+ attr.$set(attrName, !!value);
+ });
+ }
+
+ var normalized = directiveNormalize('ng-' + attrName);
+ var linkFn = defaultLinkFn;
+
+ if (propName === 'checked') {
+ linkFn = function(scope, element, attr) {
+ // ensuring ngChecked doesn't interfere with ngModel when both are set on the same input
+ if (attr.ngModel !== attr[normalized]) {
+ defaultLinkFn(scope, element, attr);
+ }
+ };
+ }
+
+ ngAttributeAliasDirectives[normalized] = function() {
+ return {
+ restrict: 'A',
+ priority: 100,
+ link: linkFn
+ };
+ };
+});
+
+// aliased input attrs are evaluated
+forEach(ALIASED_ATTR, function(htmlAttr, ngAttr) {
+ ngAttributeAliasDirectives[ngAttr] = function() {
+ return {
+ priority: 100,
+ link: function(scope, element, attr) {
+ //special case ngPattern when a literal regular expression value
+ //is used as the expression (this way we don't have to watch anything).
+ if (ngAttr === "ngPattern" && attr.ngPattern.charAt(0) == "/") {
+ var match = attr.ngPattern.match(REGEX_STRING_REGEXP);
+ if (match) {
+ attr.$set("ngPattern", new RegExp(match[1], match[2]));
+ return;
+ }
+ }
+
+ scope.$watch(attr[ngAttr], function ngAttrAliasWatchAction(value) {
+ attr.$set(ngAttr, value);
+ });
+ }
+ };
+ };
+});
+
+// ng-src, ng-srcset, ng-href are interpolated
+forEach(['src', 'srcset', 'href'], function(attrName) {
+ var normalized = directiveNormalize('ng-' + attrName);
+ ngAttributeAliasDirectives[normalized] = function() {
+ return {
+ priority: 99, // it needs to run after the attributes are interpolated
+ link: function(scope, element, attr) {
+ var propName = attrName,
+ name = attrName;
+
+ if (attrName === 'href' &&
+ toString.call(element.prop('href')) === '[object SVGAnimatedString]') {
+ name = 'xlinkHref';
+ attr.$attr[name] = 'xlink:href';
+ propName = null;
+ }
+
+ attr.$observe(normalized, function(value) {
+ if (!value) {
+ if (attrName === 'href') {
+ attr.$set(name, null);
+ }
+ return;
+ }
+
+ attr.$set(name, value);
+
+ // on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist
+ // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need
+ // to set the property as well to achieve the desired effect.
+ // we use attr[attrName] value since $set can sanitize the url.
+ if (msie && propName) element.prop(propName, attr[name]);
+ });
+ }
+ };
+ };
+});
+
+/* global -nullFormCtrl, -SUBMITTED_CLASS, addSetValidityMethod: true
+ */
+var nullFormCtrl = {
+ $addControl: noop,
+ $$renameControl: nullFormRenameControl,
+ $removeControl: noop,
+ $setValidity: noop,
+ $setDirty: noop,
+ $setPristine: noop,
+ $setSubmitted: noop
+},
+SUBMITTED_CLASS = 'ng-submitted';
+
+function nullFormRenameControl(control, name) {
+ control.$name = name;
+}
+
+/**
+ * @ngdoc type
+ * @name form.FormController
+ *
+ * @property {boolean} $pristine True if user has not interacted with the form yet.
+ * @property {boolean} $dirty True if user has already interacted with the form.
+ * @property {boolean} $valid True if all of the containing forms and controls are valid.
+ * @property {boolean} $invalid True if at least one containing control or form is invalid.
+ * @property {boolean} $pending True if at least one containing control or form is pending.
+ * @property {boolean} $submitted True if user has submitted the form even if its invalid.
+ *
+ * @property {Object} $error Is an object hash, containing references to controls or
+ * forms with failing validators, where:
+ *
+ * - keys are validation tokens (error names),
+ * - values are arrays of controls or forms that have a failing validator for given error name.
+ *
+ * Built-in validation tokens:
+ *
+ * - `email`
+ * - `max`
+ * - `maxlength`
+ * - `min`
+ * - `minlength`
+ * - `number`
+ * - `pattern`
+ * - `required`
+ * - `url`
+ * - `date`
+ * - `datetimelocal`
+ * - `time`
+ * - `week`
+ * - `month`
+ *
+ * @description
+ * `FormController` keeps track of all its controls and nested forms as well as the state of them,
+ * such as being valid/invalid or dirty/pristine.
+ *
+ * Each {@link ng.directive:form form} directive creates an instance
+ * of `FormController`.
+ *
+ */
+//asks for $scope to fool the BC controller module
+FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate'];
+function FormController(element, attrs, $scope, $animate, $interpolate) {
+ var form = this,
+ controls = [];
+
+ // init state
+ form.$error = {};
+ form.$$success = {};
+ form.$pending = undefined;
+ form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope);
+ form.$dirty = false;
+ form.$pristine = true;
+ form.$valid = true;
+ form.$invalid = false;
+ form.$submitted = false;
+ form.$$parentForm = nullFormCtrl;
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$rollbackViewValue
+ *
+ * @description
+ * Rollback all form controls pending updates to the `$modelValue`.
+ *
+ * Updates may be pending by a debounced event or because the input is waiting for a some future
+ * event defined in `ng-model-options`. This method is typically needed by the reset button of
+ * a form that uses `ng-model-options` to pend updates.
+ */
+ form.$rollbackViewValue = function() {
+ forEach(controls, function(control) {
+ control.$rollbackViewValue();
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$commitViewValue
+ *
+ * @description
+ * Commit all form controls pending updates to the `$modelValue`.
+ *
+ * Updates may be pending by a debounced event or because the input is waiting for a some future
+ * event defined in `ng-model-options`. This method is rarely needed as `NgModelController`
+ * usually handles calling this in response to input events.
+ */
+ form.$commitViewValue = function() {
+ forEach(controls, function(control) {
+ control.$commitViewValue();
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$addControl
+ * @param {object} control control object, either a {@link form.FormController} or an
+ * {@link ngModel.NgModelController}
+ *
+ * @description
+ * Register a control with the form. Input elements using ngModelController do this automatically
+ * when they are linked.
+ *
+ * Note that the current state of the control will not be reflected on the new parent form. This
+ * is not an issue with normal use, as freshly compiled and linked controls are in a `$pristine`
+ * state.
+ *
+ * However, if the method is used programmatically, for example by adding dynamically created controls,
+ * or controls that have been previously removed without destroying their corresponding DOM element,
+ * it's the developers responsibility to make sure the current state propagates to the parent form.
+ *
+ * For example, if an input control is added that is already `$dirty` and has `$error` properties,
+ * calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form.
+ */
+ form.$addControl = function(control) {
+ // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored
+ // and not added to the scope. Now we throw an error.
+ assertNotHasOwnProperty(control.$name, 'input');
+ controls.push(control);
+
+ if (control.$name) {
+ form[control.$name] = control;
+ }
+
+ control.$$parentForm = form;
+ };
+
+ // Private API: rename a form control
+ form.$$renameControl = function(control, newName) {
+ var oldName = control.$name;
+
+ if (form[oldName] === control) {
+ delete form[oldName];
+ }
+ form[newName] = control;
+ control.$name = newName;
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$removeControl
+ * @param {object} control control object, either a {@link form.FormController} or an
+ * {@link ngModel.NgModelController}
+ *
+ * @description
+ * Deregister a control from the form.
+ *
+ * Input elements using ngModelController do this automatically when they are destroyed.
+ *
+ * Note that only the removed control's validation state (`$errors`etc.) will be removed from the
+ * form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be
+ * different from case to case. For example, removing the only `$dirty` control from a form may or
+ * may not mean that the form is still `$dirty`.
+ */
+ form.$removeControl = function(control) {
+ if (control.$name && form[control.$name] === control) {
+ delete form[control.$name];
+ }
+ forEach(form.$pending, function(value, name) {
+ form.$setValidity(name, null, control);
+ });
+ forEach(form.$error, function(value, name) {
+ form.$setValidity(name, null, control);
+ });
+ forEach(form.$$success, function(value, name) {
+ form.$setValidity(name, null, control);
+ });
+
+ arrayRemove(controls, control);
+ control.$$parentForm = nullFormCtrl;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setValidity
+ *
+ * @description
+ * Sets the validity of a form control.
+ *
+ * This method will also propagate to parent forms.
+ */
+ addSetValidityMethod({
+ ctrl: this,
+ $element: element,
+ set: function(object, property, controller) {
+ var list = object[property];
+ if (!list) {
+ object[property] = [controller];
+ } else {
+ var index = list.indexOf(controller);
+ if (index === -1) {
+ list.push(controller);
+ }
+ }
+ },
+ unset: function(object, property, controller) {
+ var list = object[property];
+ if (!list) {
+ return;
+ }
+ arrayRemove(list, controller);
+ if (list.length === 0) {
+ delete object[property];
+ }
+ },
+ $animate: $animate
+ });
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setDirty
+ *
+ * @description
+ * Sets the form to a dirty state.
+ *
+ * This method can be called to add the 'ng-dirty' class and set the form to a dirty
+ * state (ng-dirty class). This method will also propagate to parent forms.
+ */
+ form.$setDirty = function() {
+ $animate.removeClass(element, PRISTINE_CLASS);
+ $animate.addClass(element, DIRTY_CLASS);
+ form.$dirty = true;
+ form.$pristine = false;
+ form.$$parentForm.$setDirty();
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setPristine
+ *
+ * @description
+ * Sets the form to its pristine state.
+ *
+ * This method can be called to remove the 'ng-dirty' class and set the form to its pristine
+ * state (ng-pristine class). This method will also propagate to all the controls contained
+ * in this form.
+ *
+ * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after
+ * saving or resetting it.
+ */
+ form.$setPristine = function() {
+ $animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS);
+ form.$dirty = false;
+ form.$pristine = true;
+ form.$submitted = false;
+ forEach(controls, function(control) {
+ control.$setPristine();
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setUntouched
+ *
+ * @description
+ * Sets the form to its untouched state.
+ *
+ * This method can be called to remove the 'ng-touched' class and set the form controls to their
+ * untouched state (ng-untouched class).
+ *
+ * Setting a form controls back to their untouched state is often useful when setting the form
+ * back to its pristine state.
+ */
+ form.$setUntouched = function() {
+ forEach(controls, function(control) {
+ control.$setUntouched();
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setSubmitted
+ *
+ * @description
+ * Sets the form to its submitted state.
+ */
+ form.$setSubmitted = function() {
+ $animate.addClass(element, SUBMITTED_CLASS);
+ form.$submitted = true;
+ form.$$parentForm.$setSubmitted();
+ };
+}
+
+/**
+ * @ngdoc directive
+ * @name ngForm
+ * @restrict EAC
+ *
+ * @description
+ * Nestable alias of {@link ng.directive:form `form`} directive. HTML
+ * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a
+ * sub-group of controls needs to be determined.
+ *
+ * Note: the purpose of `ngForm` is to group controls,
+ * but not to be a replacement for the `<form>` tag with all of its capabilities
+ * (e.g. posting to the server, ...).
+ *
+ * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into
+ * related scope, under this name.
+ *
+ */
+
+ /**
+ * @ngdoc directive
+ * @name form
+ * @restrict E
+ *
+ * @description
+ * Directive that instantiates
+ * {@link form.FormController FormController}.
+ *
+ * If the `name` attribute is specified, the form controller is published onto the current scope under
+ * this name.
+ *
+ * # Alias: {@link ng.directive:ngForm `ngForm`}
+ *
+ * In Angular, forms can be nested. This means that the outer form is valid when all of the child
+ * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so
+ * Angular provides the {@link ng.directive:ngForm `ngForm`} directive, which behaves identically to
+ * `form` but can be nested. Nested forms can be useful, for example, if the validity of a sub-group
+ * of controls needs to be determined.
+ *
+ * # CSS classes
+ * - `ng-valid` is set if the form is valid.
+ * - `ng-invalid` is set if the form is invalid.
+ * - `ng-pending` is set if the form is pending.
+ * - `ng-pristine` is set if the form is pristine.
+ * - `ng-dirty` is set if the form is dirty.
+ * - `ng-submitted` is set if the form was submitted.
+ *
+ * Keep in mind that ngAnimate can detect each of these classes when added and removed.
+ *
+ *
+ * # Submitting a form and preventing the default action
+ *
+ * Since the role of forms in client-side Angular applications is different than in classical
+ * roundtrip apps, it is desirable for the browser not to translate the form submission into a full
+ * page reload that sends the data to the server. Instead some javascript logic should be triggered
+ * to handle the form submission in an application-specific way.
+ *
+ * For this reason, Angular prevents the default action (form submission to the server) unless the
+ * `<form>` element has an `action` attribute specified.
+ *
+ * You can use one of the following two ways to specify what javascript method should be called when
+ * a form is submitted:
+ *
+ * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element
+ * - {@link ng.directive:ngClick ngClick} directive on the first
+ * button or input field of type submit (input[type=submit])
+ *
+ * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}
+ * or {@link ng.directive:ngClick ngClick} directives.
+ * This is because of the following form submission rules in the HTML specification:
+ *
+ * - If a form has only one input field then hitting enter in this field triggers form submit
+ * (`ngSubmit`)
+ * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter
+ * doesn't trigger submit
+ * - if a form has one or more input fields and one or more buttons or input[type=submit] then
+ * hitting enter in any of the input fields will trigger the click handler on the *first* button or
+ * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)
+ *
+ * Any pending `ngModelOptions` changes will take place immediately when an enclosing form is
+ * submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`
+ * to have access to the updated model.
+ *
+ * ## Animation Hooks
+ *
+ * Animations in ngForm are triggered when any of the associated CSS classes are added and removed.
+ * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any
+ * other validations that are performed within the form. Animations in ngForm are similar to how
+ * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well
+ * as JS animations.
+ *
+ * The following example shows a simple way to utilize CSS transitions to style a form element
+ * that has been rendered as invalid after it has been validated:
+ *
+ * <pre>
+ * //be sure to include ngAnimate as a module to hook into more
+ * //advanced animations
+ * .my-form {
+ * transition:0.5s linear all;
+ * background: white;
+ * }
+ * .my-form.ng-invalid {
+ * background: red;
+ * color:white;
+ * }
+ * </pre>
+ *
+ * @example
+ <example deps="angular-animate.js" animations="true" fixBase="true" module="formExample">
+ <file name="index.html">
+ <script>
+ angular.module('formExample', [])
+ .controller('FormController', ['$scope', function($scope) {
+ $scope.userType = 'guest';
+ }]);
+ </script>
+ <style>
+ .my-form {
+ transition:all linear 0.5s;
+ background: transparent;
+ }
+ .my-form.ng-invalid {
+ background: red;
+ }
+ </style>
+ <form name="myForm" ng-controller="FormController" class="my-form">
+ userType: <input name="input" ng-model="userType" required>
+ <span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
+ <code>userType = {{userType}}</code><br>
+ <code>myForm.input.$valid = {{myForm.input.$valid}}</code><br>
+ <code>myForm.input.$error = {{myForm.input.$error}}</code><br>
+ <code>myForm.$valid = {{myForm.$valid}}</code><br>
+ <code>myForm.$error.required = {{!!myForm.$error.required}}</code><br>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should initialize to model', function() {
+ var userType = element(by.binding('userType'));
+ var valid = element(by.binding('myForm.input.$valid'));
+
+ expect(userType.getText()).toContain('guest');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ var userType = element(by.binding('userType'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var userInput = element(by.model('userType'));
+
+ userInput.clear();
+ userInput.sendKeys('');
+
+ expect(userType.getText()).toEqual('userType =');
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ *
+ * @param {string=} name Name of the form. If specified, the form controller will be published into
+ * related scope, under this name.
+ */
+var formDirectiveFactory = function(isNgForm) {
+ return ['$timeout', '$parse', function($timeout, $parse) {
+ var formDirective = {
+ name: 'form',
+ restrict: isNgForm ? 'EAC' : 'E',
+ require: ['form', '^^?form'], //first is the form's own ctrl, second is an optional parent form
+ controller: FormController,
+ compile: function ngFormCompile(formElement, attr) {
+ // Setup initial state of the control
+ formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS);
+
+ var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false);
+
+ return {
+ pre: function ngFormPreLink(scope, formElement, attr, ctrls) {
+ var controller = ctrls[0];
+
+ // if `action` attr is not present on the form, prevent the default action (submission)
+ if (!('action' in attr)) {
+ // we can't use jq events because if a form is destroyed during submission the default
+ // action is not prevented. see #1238
+ //
+ // IE 9 is not affected because it doesn't fire a submit event and try to do a full
+ // page reload if the form was destroyed by submission of the form via a click handler
+ // on a button in the form. Looks like an IE9 specific bug.
+ var handleFormSubmission = function(event) {
+ scope.$apply(function() {
+ controller.$commitViewValue();
+ controller.$setSubmitted();
+ });
+
+ event.preventDefault();
+ };
+
+ addEventListenerFn(formElement[0], 'submit', handleFormSubmission);
+
+ // unregister the preventDefault listener so that we don't not leak memory but in a
+ // way that will achieve the prevention of the default action.
+ formElement.on('$destroy', function() {
+ $timeout(function() {
+ removeEventListenerFn(formElement[0], 'submit', handleFormSubmission);
+ }, 0, false);
+ });
+ }
+
+ var parentFormCtrl = ctrls[1] || controller.$$parentForm;
+ parentFormCtrl.$addControl(controller);
+
+ var setter = nameAttr ? getSetter(controller.$name) : noop;
+
+ if (nameAttr) {
+ setter(scope, controller);
+ attr.$observe(nameAttr, function(newValue) {
+ if (controller.$name === newValue) return;
+ setter(scope, undefined);
+ controller.$$parentForm.$$renameControl(controller, newValue);
+ setter = getSetter(controller.$name);
+ setter(scope, controller);
+ });
+ }
+ formElement.on('$destroy', function() {
+ controller.$$parentForm.$removeControl(controller);
+ setter(scope, undefined);
+ extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
+ });
+ }
+ };
+ }
+ };
+
+ return formDirective;
+
+ function getSetter(expression) {
+ if (expression === '') {
+ //create an assignable expression, so forms with an empty name can be renamed later
+ return $parse('this[""]').assign;
+ }
+ return $parse(expression).assign || noop;
+ }
+ }];
+};
+
+var formDirective = formDirectiveFactory();
+var ngFormDirective = formDirectiveFactory(true);
+
+/* global VALID_CLASS: false,
+ INVALID_CLASS: false,
+ PRISTINE_CLASS: false,
+ DIRTY_CLASS: false,
+ UNTOUCHED_CLASS: false,
+ TOUCHED_CLASS: false,
+ ngModelMinErr: false,
+*/
+
+// Regex code is obtained from SO: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231
+var ISO_DATE_REGEXP = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/;
+// See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987)
+// Note: We are being more lenient, because browsers are too.
+// 1. Scheme
+// 2. Slashes
+// 3. Username
+// 4. Password
+// 5. Hostname
+// 6. Port
+// 7. Path
+// 8. Query
+// 9. Fragment
+// 1111111111111111 222 333333 44444 555555555555555555555555 666 77777777 8888888 999
+var URL_REGEXP = /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+\])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i;
+var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
+var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/;
+var DATE_REGEXP = /^(\d{4})-(\d{2})-(\d{2})$/;
+var DATETIMELOCAL_REGEXP = /^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/;
+var WEEK_REGEXP = /^(\d{4})-W(\d\d)$/;
+var MONTH_REGEXP = /^(\d{4})-(\d\d)$/;
+var TIME_REGEXP = /^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/;
+
+var inputType = {
+
+ /**
+ * @ngdoc input
+ * @name input[text]
+ *
+ * @description
+ * Standard HTML text input with angular data binding, inherited by most of the `input` elements.
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Adds `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+ * any length.
+ * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+ * that contains the regular expression body that will be converted to a regular expression
+ * as in the ngPattern directive.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ * does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ * This parameter is ignored for input[type=password] controls, which will never trim the
+ * input.
+ *
+ * @example
+ <example name="text-input-directive" module="textInputExample">
+ <file name="index.html">
+ <script>
+ angular.module('textInputExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.example = {
+ text: 'guest',
+ word: /^\s*\w*\s*$/
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>Single word:
+ <input type="text" name="input" ng-model="example.text"
+ ng-pattern="example.word" required ng-trim="false">
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.pattern">
+ Single word only!</span>
+ </div>
+ <tt>text = {{example.text}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var text = element(by.binding('example.text'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.text'));
+
+ it('should initialize to model', function() {
+ expect(text.getText()).toContain('guest');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+
+ expect(text.getText()).toEqual('text =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if multi word', function() {
+ input.clear();
+ input.sendKeys('hello world');
+
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'text': textInputType,
+
+ /**
+ * @ngdoc input
+ * @name input[date]
+ *
+ * @description
+ * Input with date validation and transformation. In browsers that do not yet support
+ * the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601
+ * date format (yyyy-MM-dd), for example: `2009-01-06`. Since many
+ * modern browsers do not yet support this input type, it is important to provide cues to users on the
+ * expected input format via a placeholder or label.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a
+ * valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute
+ * (e.g. `min="{{minDate | date:'yyyy-MM-dd'}}"`). Note that `min` will also add native HTML5
+ * constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be
+ * a valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute
+ * (e.g. `max="{{maxDate | date:'yyyy-MM-dd'}}"`). Note that `max` will also add native HTML5
+ * constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO date string
+ * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO date string
+ * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="date-input-directive" module="dateInputExample">
+ <file name="index.html">
+ <script>
+ angular.module('dateInputExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(2013, 9, 22)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label for="exampleInput">Pick a date in 2013:</label>
+ <input type="date" id="exampleInput" name="input" ng-model="example.value"
+ placeholder="yyyy-MM-dd" min="2013-01-01" max="2013-12-31" required />
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.date">
+ Not a valid date!</span>
+ </div>
+ <tt>value = {{example.value | date: "yyyy-MM-dd"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "yyyy-MM-dd"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (see https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('2013-10-22');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('2015-01-01');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'date': createDateInputType('date', DATE_REGEXP,
+ createDateParser(DATE_REGEXP, ['yyyy', 'MM', 'dd']),
+ 'yyyy-MM-dd'),
+
+ /**
+ * @ngdoc input
+ * @name input[datetime-local]
+ *
+ * @description
+ * Input with datetime validation and transformation. In browsers that do not yet support
+ * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+ * local datetime format (yyyy-MM-ddTHH:mm:ss), for example: `2010-12-28T14:57:00`.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation
+ * inside this attribute (e.g. `min="{{minDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`).
+ * Note that `min` will also add native HTML5 constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation
+ * inside this attribute (e.g. `max="{{maxDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`).
+ * Note that `max` will also add native HTML5 constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation error key to the Date / ISO datetime string
+ * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation error key to the Date / ISO datetime string
+ * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="datetimelocal-input-directive" module="dateExample">
+ <file name="index.html">
+ <script>
+ angular.module('dateExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(2010, 11, 28, 14, 57)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label for="exampleInput">Pick a date between in 2013:</label>
+ <input type="datetime-local" id="exampleInput" name="input" ng-model="example.value"
+ placeholder="yyyy-MM-ddTHH:mm:ss" min="2001-01-01T00:00:00" max="2013-12-31T00:00:00" required />
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.datetimelocal">
+ Not a valid date!</span>
+ </div>
+ <tt>value = {{example.value | date: "yyyy-MM-ddTHH:mm:ss"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "yyyy-MM-ddTHH:mm:ss"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('2010-12-28T14:57:00');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('2015-01-01T23:59:00');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'datetime-local': createDateInputType('datetimelocal', DATETIMELOCAL_REGEXP,
+ createDateParser(DATETIMELOCAL_REGEXP, ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss', 'sss']),
+ 'yyyy-MM-ddTHH:mm:ss.sss'),
+
+ /**
+ * @ngdoc input
+ * @name input[time]
+ *
+ * @description
+ * Input with time validation and transformation. In browsers that do not yet support
+ * the HTML5 time input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+ * local time format (HH:mm:ss), for example: `14:57:00`. Model must be a Date object. This binding will always output a
+ * Date object to the model of January 1, 1970, or local date `new Date(1970, 0, 1, HH, mm, ss)`.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this
+ * attribute (e.g. `min="{{minTime | date:'HH:mm:ss'}}"`). Note that `min` will also add
+ * native HTML5 constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this
+ * attribute (e.g. `max="{{maxTime | date:'HH:mm:ss'}}"`). Note that `max` will also add
+ * native HTML5 constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO time string the
+ * `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO time string the
+ * `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="time-input-directive" module="timeExample">
+ <file name="index.html">
+ <script>
+ angular.module('timeExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(1970, 0, 1, 14, 57, 0)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label for="exampleInput">Pick a between 8am and 5pm:</label>
+ <input type="time" id="exampleInput" name="input" ng-model="example.value"
+ placeholder="HH:mm:ss" min="08:00:00" max="17:00:00" required />
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.time">
+ Not a valid date!</span>
+ </div>
+ <tt>value = {{example.value | date: "HH:mm:ss"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "HH:mm:ss"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('14:57:00');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('23:59:00');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'time': createDateInputType('time', TIME_REGEXP,
+ createDateParser(TIME_REGEXP, ['HH', 'mm', 'ss', 'sss']),
+ 'HH:mm:ss.sss'),
+
+ /**
+ * @ngdoc input
+ * @name input[week]
+ *
+ * @description
+ * Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support
+ * the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+ * week format (yyyy-W##), for example: `2013-W02`.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this
+ * attribute (e.g. `min="{{minWeek | date:'yyyy-Www'}}"`). Note that `min` will also add
+ * native HTML5 constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this
+ * attribute (e.g. `max="{{maxWeek | date:'yyyy-Www'}}"`). Note that `max` will also add
+ * native HTML5 constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string
+ * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string
+ * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="week-input-directive" module="weekExample">
+ <file name="index.html">
+ <script>
+ angular.module('weekExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(2013, 0, 3)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label>Pick a date between in 2013:
+ <input id="exampleInput" type="week" name="input" ng-model="example.value"
+ placeholder="YYYY-W##" min="2012-W32"
+ max="2013-W52" required />
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.week">
+ Not a valid date!</span>
+ </div>
+ <tt>value = {{example.value | date: "yyyy-Www"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "yyyy-Www"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('2013-W01');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('2015-W01');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'week': createDateInputType('week', WEEK_REGEXP, weekParser, 'yyyy-Www'),
+
+ /**
+ * @ngdoc input
+ * @name input[month]
+ *
+ * @description
+ * Input with month validation and transformation. In browsers that do not yet support
+ * the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+ * month format (yyyy-MM), for example: `2009-01`.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ * If the model is not set to the first of the month, the next view to model update will set it
+ * to the first of the month.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this
+ * attribute (e.g. `min="{{minMonth | date:'yyyy-MM'}}"`). Note that `min` will also add
+ * native HTML5 constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this
+ * attribute (e.g. `max="{{maxMonth | date:'yyyy-MM'}}"`). Note that `max` will also add
+ * native HTML5 constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string
+ * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string
+ * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="month-input-directive" module="monthExample">
+ <file name="index.html">
+ <script>
+ angular.module('monthExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(2013, 9, 1)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label for="exampleInput">Pick a month in 2013:</label>
+ <input id="exampleInput" type="month" name="input" ng-model="example.value"
+ placeholder="yyyy-MM" min="2013-01" max="2013-12" required />
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.month">
+ Not a valid month!</span>
+ </div>
+ <tt>value = {{example.value | date: "yyyy-MM"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "yyyy-MM"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('2013-10');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('2015-01');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'month': createDateInputType('month', MONTH_REGEXP,
+ createDateParser(MONTH_REGEXP, ['yyyy', 'MM']),
+ 'yyyy-MM'),
+
+ /**
+ * @ngdoc input
+ * @name input[number]
+ *
+ * @description
+ * Text input with number validation and transformation. Sets the `number` validation
+ * error if not a valid number.
+ *
+ * <div class="alert alert-warning">
+ * The model must always be of type `number` otherwise Angular will throw an error.
+ * Be aware that a string containing a number is not enough. See the {@link ngModel:numfmt}
+ * error docs for more information and an example of how to convert your model if necessary.
+ * </div>
+ *
+ * ## Issues with HTML5 constraint validation
+ *
+ * In browsers that follow the
+ * [HTML5 specification](https://html.spec.whatwg.org/multipage/forms.html#number-state-%28type=number%29),
+ * `input[number]` does not work as expected with {@link ngModelOptions `ngModelOptions.allowInvalid`}.
+ * If a non-number is entered in the input, the browser will report the value as an empty string,
+ * which means the view / model values in `ngModel` and subsequently the scope value
+ * will also be an empty string.
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+ * any length.
+ * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+ * that contains the regular expression body that will be converted to a regular expression
+ * as in the ngPattern directive.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ * does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="number-input-directive" module="numberExample">
+ <file name="index.html">
+ <script>
+ angular.module('numberExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.example = {
+ value: 12
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>Number:
+ <input type="number" name="input" ng-model="example.value"
+ min="0" max="99" required>
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.number">
+ Not valid number!</span>
+ </div>
+ <tt>value = {{example.value}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('12');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if over max', function() {
+ input.clear();
+ input.sendKeys('123');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'number': numberInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[url]
+ *
+ * @description
+ * Text input with URL validation. Sets the `url` validation error key if the content is not a
+ * valid URL.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** `input[url]` uses a regex to validate urls that is derived from the regex
+ * used in Chromium. If you need stricter validation, you can use `ng-pattern` or modify
+ * the built-in validators (see the {@link guide/forms Forms guide})
+ * </div>
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+ * any length.
+ * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+ * that contains the regular expression body that will be converted to a regular expression
+ * as in the ngPattern directive.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ * does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="url-input-directive" module="urlExample">
+ <file name="index.html">
+ <script>
+ angular.module('urlExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.url = {
+ text: 'http://google.com'
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>URL:
+ <input type="url" name="input" ng-model="url.text" required>
+ <label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.url">
+ Not valid url!</span>
+ </div>
+ <tt>text = {{url.text}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var text = element(by.binding('url.text'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('url.text'));
+
+ it('should initialize to model', function() {
+ expect(text.getText()).toContain('http://google.com');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+
+ expect(text.getText()).toEqual('text =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if not url', function() {
+ input.clear();
+ input.sendKeys('box');
+
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'url': urlInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[email]
+ *
+ * @description
+ * Text input with email validation. Sets the `email` validation error key if not a valid email
+ * address.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex
+ * used in Chromium. If you need stricter validation (e.g. requiring a top-level domain), you can
+ * use `ng-pattern` or modify the built-in validators (see the {@link guide/forms Forms guide})
+ * </div>
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+ * any length.
+ * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+ * that contains the regular expression body that will be converted to a regular expression
+ * as in the ngPattern directive.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ * does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="email-input-directive" module="emailExample">
+ <file name="index.html">
+ <script>
+ angular.module('emailExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.email = {
+ text: 'me@example.com'
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>Email:
+ <input type="email" name="input" ng-model="email.text" required>
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.email">
+ Not valid email!</span>
+ </div>
+ <tt>text = {{email.text}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var text = element(by.binding('email.text'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('email.text'));
+
+ it('should initialize to model', function() {
+ expect(text.getText()).toContain('me@example.com');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+ expect(text.getText()).toEqual('text =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if not email', function() {
+ input.clear();
+ input.sendKeys('xxx');
+
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'email': emailInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[radio]
+ *
+ * @description
+ * HTML radio button.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string} value The value to which the `ngModel` expression should be set when selected.
+ * Note that `value` only supports `string` values, i.e. the scope model needs to be a string,
+ * too. Use `ngValue` if you need complex models (`number`, `object`, ...).
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {string} ngValue Angular expression to which `ngModel` will be be set when the radio
+ * is selected. Should be used instead of the `value` attribute if you need
+ * a non-string `ngModel` (`boolean`, `array`, ...).
+ *
+ * @example
+ <example name="radio-input-directive" module="radioExample">
+ <file name="index.html">
+ <script>
+ angular.module('radioExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.color = {
+ name: 'blue'
+ };
+ $scope.specialValue = {
+ "id": "12345",
+ "value": "green"
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>
+ <input type="radio" ng-model="color.name" value="red">
+ Red
+ </label><br/>
+ <label>
+ <input type="radio" ng-model="color.name" ng-value="specialValue">
+ Green
+ </label><br/>
+ <label>
+ <input type="radio" ng-model="color.name" value="blue">
+ Blue
+ </label><br/>
+ <tt>color = {{color.name | json}}</tt><br/>
+ </form>
+ Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`.
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should change state', function() {
+ var color = element(by.binding('color.name'));
+
+ expect(color.getText()).toContain('blue');
+
+ element.all(by.model('color.name')).get(0).click();
+
+ expect(color.getText()).toContain('red');
+ });
+ </file>
+ </example>
+ */
+ 'radio': radioInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[checkbox]
+ *
+ * @description
+ * HTML checkbox.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {expression=} ngTrueValue The value to which the expression should be set when selected.
+ * @param {expression=} ngFalseValue The value to which the expression should be set when not selected.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="checkbox-input-directive" module="checkboxExample">
+ <file name="index.html">
+ <script>
+ angular.module('checkboxExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.checkboxModel = {
+ value1 : true,
+ value2 : 'YES'
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>Value1:
+ <input type="checkbox" ng-model="checkboxModel.value1">
+ </label><br/>
+ <label>Value2:
+ <input type="checkbox" ng-model="checkboxModel.value2"
+ ng-true-value="'YES'" ng-false-value="'NO'">
+ </label><br/>
+ <tt>value1 = {{checkboxModel.value1}}</tt><br/>
+ <tt>value2 = {{checkboxModel.value2}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should change state', function() {
+ var value1 = element(by.binding('checkboxModel.value1'));
+ var value2 = element(by.binding('checkboxModel.value2'));
+
+ expect(value1.getText()).toContain('true');
+ expect(value2.getText()).toContain('YES');
+
+ element(by.model('checkboxModel.value1')).click();
+ element(by.model('checkboxModel.value2')).click();
+
+ expect(value1.getText()).toContain('false');
+ expect(value2.getText()).toContain('NO');
+ });
+ </file>
+ </example>
+ */
+ 'checkbox': checkboxInputType,
+
+ 'hidden': noop,
+ 'button': noop,
+ 'submit': noop,
+ 'reset': noop,
+ 'file': noop
+};
+
+function stringBasedInputType(ctrl) {
+ ctrl.$formatters.push(function(value) {
+ return ctrl.$isEmpty(value) ? value : value.toString();
+ });
+}
+
+function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+ stringBasedInputType(ctrl);
+}
+
+function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ var type = lowercase(element[0].type);
+
+ // In composition mode, users are still inputing intermediate text buffer,
+ // hold the listener until composition is done.
+ // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent
+ if (!$sniffer.android) {
+ var composing = false;
+
+ element.on('compositionstart', function(data) {
+ composing = true;
+ });
+
+ element.on('compositionend', function() {
+ composing = false;
+ listener();
+ });
+ }
+
+ var listener = function(ev) {
+ if (timeout) {
+ $browser.defer.cancel(timeout);
+ timeout = null;
+ }
+ if (composing) return;
+ var value = element.val(),
+ event = ev && ev.type;
+
+ // By default we will trim the value
+ // If the attribute ng-trim exists we will avoid trimming
+ // If input type is 'password', the value is never trimmed
+ if (type !== 'password' && (!attr.ngTrim || attr.ngTrim !== 'false')) {
+ value = trim(value);
+ }
+
+ // If a control is suffering from bad input (due to native validators), browsers discard its
+ // value, so it may be necessary to revalidate (by calling $setViewValue again) even if the
+ // control's value is the same empty value twice in a row.
+ if (ctrl.$viewValue !== value || (value === '' && ctrl.$$hasNativeValidators)) {
+ ctrl.$setViewValue(value, event);
+ }
+ };
+
+ // if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the
+ // input event on backspace, delete or cut
+ if ($sniffer.hasEvent('input')) {
+ element.on('input', listener);
+ } else {
+ var timeout;
+
+ var deferListener = function(ev, input, origValue) {
+ if (!timeout) {
+ timeout = $browser.defer(function() {
+ timeout = null;
+ if (!input || input.value !== origValue) {
+ listener(ev);
+ }
+ });
+ }
+ };
+
+ element.on('keydown', function(event) {
+ var key = event.keyCode;
+
+ // ignore
+ // command modifiers arrows
+ if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;
+
+ deferListener(event, this, this.value);
+ });
+
+ // if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it
+ if ($sniffer.hasEvent('paste')) {
+ element.on('paste cut', deferListener);
+ }
+ }
+
+ // if user paste into input using mouse on older browser
+ // or form autocomplete on newer browser, we need "change" event to catch it
+ element.on('change', listener);
+
+ ctrl.$render = function() {
+ // Workaround for Firefox validation #12102.
+ var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue;
+ if (element.val() !== value) {
+ element.val(value);
+ }
+ };
+}
+
+function weekParser(isoWeek, existingDate) {
+ if (isDate(isoWeek)) {
+ return isoWeek;
+ }
+
+ if (isString(isoWeek)) {
+ WEEK_REGEXP.lastIndex = 0;
+ var parts = WEEK_REGEXP.exec(isoWeek);
+ if (parts) {
+ var year = +parts[1],
+ week = +parts[2],
+ hours = 0,
+ minutes = 0,
+ seconds = 0,
+ milliseconds = 0,
+ firstThurs = getFirstThursdayOfYear(year),
+ addDays = (week - 1) * 7;
+
+ if (existingDate) {
+ hours = existingDate.getHours();
+ minutes = existingDate.getMinutes();
+ seconds = existingDate.getSeconds();
+ milliseconds = existingDate.getMilliseconds();
+ }
+
+ return new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds);
+ }
+ }
+
+ return NaN;
+}
+
+function createDateParser(regexp, mapping) {
+ return function(iso, date) {
+ var parts, map;
+
+ if (isDate(iso)) {
+ return iso;
+ }
+
+ if (isString(iso)) {
+ // When a date is JSON'ified to wraps itself inside of an extra
+ // set of double quotes. This makes the date parsing code unable
+ // to match the date string and parse it as a date.
+ if (iso.charAt(0) == '"' && iso.charAt(iso.length - 1) == '"') {
+ iso = iso.substring(1, iso.length - 1);
+ }
+ if (ISO_DATE_REGEXP.test(iso)) {
+ return new Date(iso);
+ }
+ regexp.lastIndex = 0;
+ parts = regexp.exec(iso);
+
+ if (parts) {
+ parts.shift();
+ if (date) {
+ map = {
+ yyyy: date.getFullYear(),
+ MM: date.getMonth() + 1,
+ dd: date.getDate(),
+ HH: date.getHours(),
+ mm: date.getMinutes(),
+ ss: date.getSeconds(),
+ sss: date.getMilliseconds() / 1000
+ };
+ } else {
+ map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 };
+ }
+
+ forEach(parts, function(part, index) {
+ if (index < mapping.length) {
+ map[mapping[index]] = +part;
+ }
+ });
+ return new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, map.sss * 1000 || 0);
+ }
+ }
+
+ return NaN;
+ };
+}
+
+function createDateInputType(type, regexp, parseDate, format) {
+ return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter) {
+ badInputChecker(scope, element, attr, ctrl);
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+ var timezone = ctrl && ctrl.$options && ctrl.$options.timezone;
+ var previousDate;
+
+ ctrl.$$parserName = type;
+ ctrl.$parsers.push(function(value) {
+ if (ctrl.$isEmpty(value)) return null;
+ if (regexp.test(value)) {
+ // Note: We cannot read ctrl.$modelValue, as there might be a different
+ // parser/formatter in the processing chain so that the model
+ // contains some different data format!
+ var parsedDate = parseDate(value, previousDate);
+ if (timezone) {
+ parsedDate = convertTimezoneToLocal(parsedDate, timezone);
+ }
+ return parsedDate;
+ }
+ return undefined;
+ });
+
+ ctrl.$formatters.push(function(value) {
+ if (value && !isDate(value)) {
+ throw ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value);
+ }
+ if (isValidDate(value)) {
+ previousDate = value;
+ if (previousDate && timezone) {
+ previousDate = convertTimezoneToLocal(previousDate, timezone, true);
+ }
+ return $filter('date')(value, format, timezone);
+ } else {
+ previousDate = null;
+ return '';
+ }
+ });
+
+ if (isDefined(attr.min) || attr.ngMin) {
+ var minVal;
+ ctrl.$validators.min = function(value) {
+ return !isValidDate(value) || isUndefined(minVal) || parseDate(value) >= minVal;
+ };
+ attr.$observe('min', function(val) {
+ minVal = parseObservedDateValue(val);
+ ctrl.$validate();
+ });
+ }
+
+ if (isDefined(attr.max) || attr.ngMax) {
+ var maxVal;
+ ctrl.$validators.max = function(value) {
+ return !isValidDate(value) || isUndefined(maxVal) || parseDate(value) <= maxVal;
+ };
+ attr.$observe('max', function(val) {
+ maxVal = parseObservedDateValue(val);
+ ctrl.$validate();
+ });
+ }
+
+ function isValidDate(value) {
+ // Invalid Date: getTime() returns NaN
+ return value && !(value.getTime && value.getTime() !== value.getTime());
+ }
+
+ function parseObservedDateValue(val) {
+ return isDefined(val) && !isDate(val) ? parseDate(val) || undefined : val;
+ }
+ };
+}
+
+function badInputChecker(scope, element, attr, ctrl) {
+ var node = element[0];
+ var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity);
+ if (nativeValidation) {
+ ctrl.$parsers.push(function(value) {
+ var validity = element.prop(VALIDITY_STATE_PROPERTY) || {};
+ return validity.badInput || validity.typeMismatch ? undefined : value;
+ });
+ }
+}
+
+function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ badInputChecker(scope, element, attr, ctrl);
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+
+ ctrl.$$parserName = 'number';
+ ctrl.$parsers.push(function(value) {
+ if (ctrl.$isEmpty(value)) return null;
+ if (NUMBER_REGEXP.test(value)) return parseFloat(value);
+ return undefined;
+ });
+
+ ctrl.$formatters.push(function(value) {
+ if (!ctrl.$isEmpty(value)) {
+ if (!isNumber(value)) {
+ throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);
+ }
+ value = value.toString();
+ }
+ return value;
+ });
+
+ if (isDefined(attr.min) || attr.ngMin) {
+ var minVal;
+ ctrl.$validators.min = function(value) {
+ return ctrl.$isEmpty(value) || isUndefined(minVal) || value >= minVal;
+ };
+
+ attr.$observe('min', function(val) {
+ if (isDefined(val) && !isNumber(val)) {
+ val = parseFloat(val, 10);
+ }
+ minVal = isNumber(val) && !isNaN(val) ? val : undefined;
+ // TODO(matsko): implement validateLater to reduce number of validations
+ ctrl.$validate();
+ });
+ }
+
+ if (isDefined(attr.max) || attr.ngMax) {
+ var maxVal;
+ ctrl.$validators.max = function(value) {
+ return ctrl.$isEmpty(value) || isUndefined(maxVal) || value <= maxVal;
+ };
+
+ attr.$observe('max', function(val) {
+ if (isDefined(val) && !isNumber(val)) {
+ val = parseFloat(val, 10);
+ }
+ maxVal = isNumber(val) && !isNaN(val) ? val : undefined;
+ // TODO(matsko): implement validateLater to reduce number of validations
+ ctrl.$validate();
+ });
+ }
+}
+
+function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ // Note: no badInputChecker here by purpose as `url` is only a validation
+ // in browsers, i.e. we can always read out input.value even if it is not valid!
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+ stringBasedInputType(ctrl);
+
+ ctrl.$$parserName = 'url';
+ ctrl.$validators.url = function(modelValue, viewValue) {
+ var value = modelValue || viewValue;
+ return ctrl.$isEmpty(value) || URL_REGEXP.test(value);
+ };
+}
+
+function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ // Note: no badInputChecker here by purpose as `url` is only a validation
+ // in browsers, i.e. we can always read out input.value even if it is not valid!
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+ stringBasedInputType(ctrl);
+
+ ctrl.$$parserName = 'email';
+ ctrl.$validators.email = function(modelValue, viewValue) {
+ var value = modelValue || viewValue;
+ return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value);
+ };
+}
+
+function radioInputType(scope, element, attr, ctrl) {
+ // make the name unique, if not defined
+ if (isUndefined(attr.name)) {
+ element.attr('name', nextUid());
+ }
+
+ var listener = function(ev) {
+ if (element[0].checked) {
+ ctrl.$setViewValue(attr.value, ev && ev.type);
+ }
+ };
+
+ element.on('click', listener);
+
+ ctrl.$render = function() {
+ var value = attr.value;
+ element[0].checked = (value == ctrl.$viewValue);
+ };
+
+ attr.$observe('value', ctrl.$render);
+}
+
+function parseConstantExpr($parse, context, name, expression, fallback) {
+ var parseFn;
+ if (isDefined(expression)) {
+ parseFn = $parse(expression);
+ if (!parseFn.constant) {
+ throw ngModelMinErr('constexpr', 'Expected constant expression for `{0}`, but saw ' +
+ '`{1}`.', name, expression);
+ }
+ return parseFn(context);
+ }
+ return fallback;
+}
+
+function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
+ var trueValue = parseConstantExpr($parse, scope, 'ngTrueValue', attr.ngTrueValue, true);
+ var falseValue = parseConstantExpr($parse, scope, 'ngFalseValue', attr.ngFalseValue, false);
+
+ var listener = function(ev) {
+ ctrl.$setViewValue(element[0].checked, ev && ev.type);
+ };
+
+ element.on('click', listener);
+
+ ctrl.$render = function() {
+ element[0].checked = ctrl.$viewValue;
+ };
+
+ // Override the standard `$isEmpty` because the $viewValue of an empty checkbox is always set to `false`
+ // This is because of the parser below, which compares the `$modelValue` with `trueValue` to convert
+ // it to a boolean.
+ ctrl.$isEmpty = function(value) {
+ return value === false;
+ };
+
+ ctrl.$formatters.push(function(value) {
+ return equals(value, trueValue);
+ });
+
+ ctrl.$parsers.push(function(value) {
+ return value ? trueValue : falseValue;
+ });
+}
+
+
+/**
+ * @ngdoc directive
+ * @name textarea
+ * @restrict E
+ *
+ * @description
+ * HTML textarea element control with angular data-binding. The data-binding and validation
+ * properties of this element are exactly the same as those of the
+ * {@link ng.directive:input input element}.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any
+ * length.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ * does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name input
+ * @restrict E
+ *
+ * @description
+ * HTML input element control. When used together with {@link ngModel `ngModel`}, it provides data-binding,
+ * input state control, and validation.
+ * Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Not every feature offered is available for all input types.
+ * Specifically, data binding and event handling via `ng-model` is unsupported for `input[file]`.
+ * </div>
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {boolean=} ngRequired Sets `required` attribute if set to true
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any
+ * length.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ * value does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ * This parameter is ignored for input[type=password] controls, which will never trim the
+ * input.
+ *
+ * @example
+ <example name="input-directive" module="inputExample">
+ <file name="index.html">
+ <script>
+ angular.module('inputExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.user = {name: 'guest', last: 'visitor'};
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <form name="myForm">
+ <label>
+ User name:
+ <input type="text" name="userName" ng-model="user.name" required>
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.userName.$error.required">
+ Required!</span>
+ </div>
+ <label>
+ Last name:
+ <input type="text" name="lastName" ng-model="user.last"
+ ng-minlength="3" ng-maxlength="10">
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.lastName.$error.minlength">
+ Too short!</span>
+ <span class="error" ng-show="myForm.lastName.$error.maxlength">
+ Too long!</span>
+ </div>
+ </form>
+ <hr>
+ <tt>user = {{user}}</tt><br/>
+ <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br/>
+ <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br/>
+ <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br/>
+ <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br/>
+ <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br/>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var user = element(by.exactBinding('user'));
+ var userNameValid = element(by.binding('myForm.userName.$valid'));
+ var lastNameValid = element(by.binding('myForm.lastName.$valid'));
+ var lastNameError = element(by.binding('myForm.lastName.$error'));
+ var formValid = element(by.binding('myForm.$valid'));
+ var userNameInput = element(by.model('user.name'));
+ var userLastInput = element(by.model('user.last'));
+
+ it('should initialize to model', function() {
+ expect(user.getText()).toContain('{"name":"guest","last":"visitor"}');
+ expect(userNameValid.getText()).toContain('true');
+ expect(formValid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty when required', function() {
+ userNameInput.clear();
+ userNameInput.sendKeys('');
+
+ expect(user.getText()).toContain('{"last":"visitor"}');
+ expect(userNameValid.getText()).toContain('false');
+ expect(formValid.getText()).toContain('false');
+ });
+
+ it('should be valid if empty when min length is set', function() {
+ userLastInput.clear();
+ userLastInput.sendKeys('');
+
+ expect(user.getText()).toContain('{"name":"guest","last":""}');
+ expect(lastNameValid.getText()).toContain('true');
+ expect(formValid.getText()).toContain('true');
+ });
+
+ it('should be invalid if less than required min length', function() {
+ userLastInput.clear();
+ userLastInput.sendKeys('xx');
+
+ expect(user.getText()).toContain('{"name":"guest"}');
+ expect(lastNameValid.getText()).toContain('false');
+ expect(lastNameError.getText()).toContain('minlength');
+ expect(formValid.getText()).toContain('false');
+ });
+
+ it('should be invalid if longer than max length', function() {
+ userLastInput.clear();
+ userLastInput.sendKeys('some ridiculously long name');
+
+ expect(user.getText()).toContain('{"name":"guest"}');
+ expect(lastNameValid.getText()).toContain('false');
+ expect(lastNameError.getText()).toContain('maxlength');
+ expect(formValid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+var inputDirective = ['$browser', '$sniffer', '$filter', '$parse',
+ function($browser, $sniffer, $filter, $parse) {
+ return {
+ restrict: 'E',
+ require: ['?ngModel'],
+ link: {
+ pre: function(scope, element, attr, ctrls) {
+ if (ctrls[0]) {
+ (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrls[0], $sniffer,
+ $browser, $filter, $parse);
+ }
+ }
+ }
+ };
+}];
+
+
+
+var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
+/**
+ * @ngdoc directive
+ * @name ngValue
+ *
+ * @description
+ * Binds the given expression to the value of `<option>` or {@link input[radio] `input[radio]`},
+ * so that when the element is selected, the {@link ngModel `ngModel`} of that element is set to
+ * the bound value.
+ *
+ * `ngValue` is useful when dynamically generating lists of radio buttons using
+ * {@link ngRepeat `ngRepeat`}, as shown below.
+ *
+ * Likewise, `ngValue` can be used to generate `<option>` elements for
+ * the {@link select `select`} element. In that case however, only strings are supported
+ * for the `value `attribute, so the resulting `ngModel` will always be a string.
+ * Support for `select` models with non-string values is available via `ngOptions`.
+ *
+ * @element input
+ * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute
+ * of the `input` element
+ *
+ * @example
+ <example name="ngValue-directive" module="valueExample">
+ <file name="index.html">
+ <script>
+ angular.module('valueExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.names = ['pizza', 'unicorns', 'robots'];
+ $scope.my = { favorite: 'unicorns' };
+ }]);
+ </script>
+ <form ng-controller="ExampleController">
+ <h2>Which is your favorite?</h2>
+ <label ng-repeat="name in names" for="{{name}}">
+ {{name}}
+ <input type="radio"
+ ng-model="my.favorite"
+ ng-value="name"
+ id="{{name}}"
+ name="favorite">
+ </label>
+ <div>You chose {{my.favorite}}</div>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var favorite = element(by.binding('my.favorite'));
+
+ it('should initialize to model', function() {
+ expect(favorite.getText()).toContain('unicorns');
+ });
+ it('should bind the values to the inputs', function() {
+ element.all(by.model('my.favorite')).get(0).click();
+ expect(favorite.getText()).toContain('pizza');
+ });
+ </file>
+ </example>
+ */
+var ngValueDirective = function() {
+ return {
+ restrict: 'A',
+ priority: 100,
+ compile: function(tpl, tplAttr) {
+ if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {
+ return function ngValueConstantLink(scope, elm, attr) {
+ attr.$set('value', scope.$eval(attr.ngValue));
+ };
+ } else {
+ return function ngValueLink(scope, elm, attr) {
+ scope.$watch(attr.ngValue, function valueWatchAction(value) {
+ attr.$set('value', value);
+ });
+ };
+ }
+ }
+ };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngBind
+ * @restrict AC
+ *
+ * @description
+ * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element
+ * with the value of a given expression, and to update the text content when the value of that
+ * expression changes.
+ *
+ * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like
+ * `{{ expression }}` which is similar but less verbose.
+ *
+ * It is preferable to use `ngBind` instead of `{{ expression }}` if a template is momentarily
+ * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an
+ * element attribute, it makes the bindings invisible to the user while the page is loading.
+ *
+ * An alternative solution to this problem would be using the
+ * {@link ng.directive:ngCloak ngCloak} directive.
+ *
+ *
+ * @element ANY
+ * @param {expression} ngBind {@link guide/expression Expression} to evaluate.
+ *
+ * @example
+ * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
+ <example module="bindExample">
+ <file name="index.html">
+ <script>
+ angular.module('bindExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.name = 'Whirled';
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>Enter name: <input type="text" ng-model="name"></label><br>
+ Hello <span ng-bind="name"></span>!
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-bind', function() {
+ var nameInput = element(by.model('name'));
+
+ expect(element(by.binding('name')).getText()).toBe('Whirled');
+ nameInput.clear();
+ nameInput.sendKeys('world');
+ expect(element(by.binding('name')).getText()).toBe('world');
+ });
+ </file>
+ </example>
+ */
+var ngBindDirective = ['$compile', function($compile) {
+ return {
+ restrict: 'AC',
+ compile: function ngBindCompile(templateElement) {
+ $compile.$$addBindingClass(templateElement);
+ return function ngBindLink(scope, element, attr) {
+ $compile.$$addBindingInfo(element, attr.ngBind);
+ element = element[0];
+ scope.$watch(attr.ngBind, function ngBindWatchAction(value) {
+ element.textContent = isUndefined(value) ? '' : value;
+ });
+ };
+ }
+ };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngBindTemplate
+ *
+ * @description
+ * The `ngBindTemplate` directive specifies that the element
+ * text content should be replaced with the interpolation of the template
+ * in the `ngBindTemplate` attribute.
+ * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}`
+ * expressions. This directive is needed since some HTML elements
+ * (such as TITLE and OPTION) cannot contain SPAN elements.
+ *
+ * @element ANY
+ * @param {string} ngBindTemplate template of form
+ * <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.
+ *
+ * @example
+ * Try it here: enter text in text box and watch the greeting change.
+ <example module="bindExample">
+ <file name="index.html">
+ <script>
+ angular.module('bindExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.salutation = 'Hello';
+ $scope.name = 'World';
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>Salutation: <input type="text" ng-model="salutation"></label><br>
+ <label>Name: <input type="text" ng-model="name"></label><br>
+ <pre ng-bind-template="{{salutation}} {{name}}!"></pre>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-bind', function() {
+ var salutationElem = element(by.binding('salutation'));
+ var salutationInput = element(by.model('salutation'));
+ var nameInput = element(by.model('name'));
+
+ expect(salutationElem.getText()).toBe('Hello World!');
+
+ salutationInput.clear();
+ salutationInput.sendKeys('Greetings');
+ nameInput.clear();
+ nameInput.sendKeys('user');
+
+ expect(salutationElem.getText()).toBe('Greetings user!');
+ });
+ </file>
+ </example>
+ */
+var ngBindTemplateDirective = ['$interpolate', '$compile', function($interpolate, $compile) {
+ return {
+ compile: function ngBindTemplateCompile(templateElement) {
+ $compile.$$addBindingClass(templateElement);
+ return function ngBindTemplateLink(scope, element, attr) {
+ var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));
+ $compile.$$addBindingInfo(element, interpolateFn.expressions);
+ element = element[0];
+ attr.$observe('ngBindTemplate', function(value) {
+ element.textContent = isUndefined(value) ? '' : value;
+ });
+ };
+ }
+ };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngBindHtml
+ *
+ * @description
+ * Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default,
+ * the resulting HTML content will be sanitized using the {@link ngSanitize.$sanitize $sanitize} service.
+ * To utilize this functionality, ensure that `$sanitize` is available, for example, by including {@link
+ * ngSanitize} in your module's dependencies (not in core Angular). In order to use {@link ngSanitize}
+ * in your module's dependencies, you need to include "angular-sanitize.js" in your application.
+ *
+ * You may also bypass sanitization for values you know are safe. To do so, bind to
+ * an explicitly trusted value via {@link ng.$sce#trustAsHtml $sce.trustAsHtml}. See the example
+ * under {@link ng.$sce#show-me-an-example-using-sce- Strict Contextual Escaping (SCE)}.
+ *
+ * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you
+ * will have an exception (instead of an exploit.)
+ *
+ * @element ANY
+ * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.
+ *
+ * @example
+
+ <example module="bindHtmlExample" deps="angular-sanitize.js">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <p ng-bind-html="myHTML"></p>
+ </div>
+ </file>
+
+ <file name="script.js">
+ angular.module('bindHtmlExample', ['ngSanitize'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.myHTML =
+ 'I am an <code>HTML</code>string with ' +
+ '<a href="#">links!</a> and other <em>stuff</em>';
+ }]);
+ </file>
+
+ <file name="protractor.js" type="protractor">
+ it('should check ng-bind-html', function() {
+ expect(element(by.binding('myHTML')).getText()).toBe(
+ 'I am an HTMLstring with links! and other stuff');
+ });
+ </file>
+ </example>
+ */
+var ngBindHtmlDirective = ['$sce', '$parse', '$compile', function($sce, $parse, $compile) {
+ return {
+ restrict: 'A',
+ compile: function ngBindHtmlCompile(tElement, tAttrs) {
+ var ngBindHtmlGetter = $parse(tAttrs.ngBindHtml);
+ var ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, function getStringValue(value) {
+ return (value || '').toString();
+ });
+ $compile.$$addBindingClass(tElement);
+
+ return function ngBindHtmlLink(scope, element, attr) {
+ $compile.$$addBindingInfo(element, attr.ngBindHtml);
+
+ scope.$watch(ngBindHtmlWatch, function ngBindHtmlWatchAction() {
+ // we re-evaluate the expr because we want a TrustedValueHolderType
+ // for $sce, not a string
+ element.html($sce.getTrustedHtml(ngBindHtmlGetter(scope)) || '');
+ });
+ };
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngChange
+ *
+ * @description
+ * Evaluate the given expression when the user changes the input.
+ * The expression is evaluated immediately, unlike the JavaScript onchange event
+ * which only triggers at the end of a change (usually, when the user leaves the
+ * form element or presses the return key).
+ *
+ * The `ngChange` expression is only evaluated when a change in the input value causes
+ * a new value to be committed to the model.
+ *
+ * It will not be evaluated:
+ * * if the value returned from the `$parsers` transformation pipeline has not changed
+ * * if the input has continued to be invalid since the model will stay `null`
+ * * if the model is changed programmatically and not by a change to the input value
+ *
+ *
+ * Note, this directive requires `ngModel` to be present.
+ *
+ * @element input
+ * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change
+ * in input value.
+ *
+ * @example
+ * <example name="ngChange-directive" module="changeExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('changeExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.counter = 0;
+ * $scope.change = function() {
+ * $scope.counter++;
+ * };
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" />
+ * <input type="checkbox" ng-model="confirmed" id="ng-change-example2" />
+ * <label for="ng-change-example2">Confirmed</label><br />
+ * <tt>debug = {{confirmed}}</tt><br/>
+ * <tt>counter = {{counter}}</tt><br/>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * var counter = element(by.binding('counter'));
+ * var debug = element(by.binding('confirmed'));
+ *
+ * it('should evaluate the expression if changing from view', function() {
+ * expect(counter.getText()).toContain('0');
+ *
+ * element(by.id('ng-change-example1')).click();
+ *
+ * expect(counter.getText()).toContain('1');
+ * expect(debug.getText()).toContain('true');
+ * });
+ *
+ * it('should not evaluate the expression if changing from model', function() {
+ * element(by.id('ng-change-example2')).click();
+
+ * expect(counter.getText()).toContain('0');
+ * expect(debug.getText()).toContain('true');
+ * });
+ * </file>
+ * </example>
+ */
+var ngChangeDirective = valueFn({
+ restrict: 'A',
+ require: 'ngModel',
+ link: function(scope, element, attr, ctrl) {
+ ctrl.$viewChangeListeners.push(function() {
+ scope.$eval(attr.ngChange);
+ });
+ }
+});
+
+function classDirective(name, selector) {
+ name = 'ngClass' + name;
+ return ['$animate', function($animate) {
+ return {
+ restrict: 'AC',
+ link: function(scope, element, attr) {
+ var oldVal;
+
+ scope.$watch(attr[name], ngClassWatchAction, true);
+
+ attr.$observe('class', function(value) {
+ ngClassWatchAction(scope.$eval(attr[name]));
+ });
+
+
+ if (name !== 'ngClass') {
+ scope.$watch('$index', function($index, old$index) {
+ // jshint bitwise: false
+ var mod = $index & 1;
+ if (mod !== (old$index & 1)) {
+ var classes = arrayClasses(scope.$eval(attr[name]));
+ mod === selector ?
+ addClasses(classes) :
+ removeClasses(classes);
+ }
+ });
+ }
+
+ function addClasses(classes) {
+ var newClasses = digestClassCounts(classes, 1);
+ attr.$addClass(newClasses);
+ }
+
+ function removeClasses(classes) {
+ var newClasses = digestClassCounts(classes, -1);
+ attr.$removeClass(newClasses);
+ }
+
+ function digestClassCounts(classes, count) {
+ // Use createMap() to prevent class assumptions involving property
+ // names in Object.prototype
+ var classCounts = element.data('$classCounts') || createMap();
+ var classesToUpdate = [];
+ forEach(classes, function(className) {
+ if (count > 0 || classCounts[className]) {
+ classCounts[className] = (classCounts[className] || 0) + count;
+ if (classCounts[className] === +(count > 0)) {
+ classesToUpdate.push(className);
+ }
+ }
+ });
+ element.data('$classCounts', classCounts);
+ return classesToUpdate.join(' ');
+ }
+
+ function updateClasses(oldClasses, newClasses) {
+ var toAdd = arrayDifference(newClasses, oldClasses);
+ var toRemove = arrayDifference(oldClasses, newClasses);
+ toAdd = digestClassCounts(toAdd, 1);
+ toRemove = digestClassCounts(toRemove, -1);
+ if (toAdd && toAdd.length) {
+ $animate.addClass(element, toAdd);
+ }
+ if (toRemove && toRemove.length) {
+ $animate.removeClass(element, toRemove);
+ }
+ }
+
+ function ngClassWatchAction(newVal) {
+ if (selector === true || scope.$index % 2 === selector) {
+ var newClasses = arrayClasses(newVal || []);
+ if (!oldVal) {
+ addClasses(newClasses);
+ } else if (!equals(newVal,oldVal)) {
+ var oldClasses = arrayClasses(oldVal);
+ updateClasses(oldClasses, newClasses);
+ }
+ }
+ oldVal = shallowCopy(newVal);
+ }
+ }
+ };
+
+ function arrayDifference(tokens1, tokens2) {
+ var values = [];
+
+ outer:
+ for (var i = 0; i < tokens1.length; i++) {
+ var token = tokens1[i];
+ for (var j = 0; j < tokens2.length; j++) {
+ if (token == tokens2[j]) continue outer;
+ }
+ values.push(token);
+ }
+ return values;
+ }
+
+ function arrayClasses(classVal) {
+ var classes = [];
+ if (isArray(classVal)) {
+ forEach(classVal, function(v) {
+ classes = classes.concat(arrayClasses(v));
+ });
+ return classes;
+ } else if (isString(classVal)) {
+ return classVal.split(' ');
+ } else if (isObject(classVal)) {
+ forEach(classVal, function(v, k) {
+ if (v) {
+ classes = classes.concat(k.split(' '));
+ }
+ });
+ return classes;
+ }
+ return classVal;
+ }
+ }];
+}
+
+/**
+ * @ngdoc directive
+ * @name ngClass
+ * @restrict AC
+ *
+ * @description
+ * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding
+ * an expression that represents all classes to be added.
+ *
+ * The directive operates in three different ways, depending on which of three types the expression
+ * evaluates to:
+ *
+ * 1. If the expression evaluates to a string, the string should be one or more space-delimited class
+ * names.
+ *
+ * 2. If the expression evaluates to an object, then for each key-value pair of the
+ * object with a truthy value the corresponding key is used as a class name.
+ *
+ * 3. If the expression evaluates to an array, each element of the array should either be a string as in
+ * type 1 or an object as in type 2. This means that you can mix strings and objects together in an array
+ * to give you more control over what CSS classes appear. See the code below for an example of this.
+ *
+ *
+ * The directive won't add duplicate classes if a particular class was already set.
+ *
+ * When the expression changes, the previously added classes are removed and only then are the
+ * new classes added.
+ *
+ * @animations
+ * **add** - happens just before the class is applied to the elements
+ *
+ * **remove** - happens just before the class is removed from the element
+ *
+ * @element ANY
+ * @param {expression} ngClass {@link guide/expression Expression} to eval. The result
+ * of the evaluation can be a string representing space delimited class
+ * names, an array, or a map of class names to boolean values. In the case of a map, the
+ * names of the properties whose values are truthy will be added as css classes to the
+ * element.
+ *
+ * @example Example that demonstrates basic bindings via ngClass directive.
+ <example>
+ <file name="index.html">
+ <p ng-class="{strike: deleted, bold: important, 'has-error': error}">Map Syntax Example</p>
+ <label>
+ <input type="checkbox" ng-model="deleted">
+ deleted (apply "strike" class)
+ </label><br>
+ <label>
+ <input type="checkbox" ng-model="important">
+ important (apply "bold" class)
+ </label><br>
+ <label>
+ <input type="checkbox" ng-model="error">
+ error (apply "has-error" class)
+ </label>
+ <hr>
+ <p ng-class="style">Using String Syntax</p>
+ <input type="text" ng-model="style"
+ placeholder="Type: bold strike red" aria-label="Type: bold strike red">
+ <hr>
+ <p ng-class="[style1, style2, style3]">Using Array Syntax</p>
+ <input ng-model="style1"
+ placeholder="Type: bold, strike or red" aria-label="Type: bold, strike or red"><br>
+ <input ng-model="style2"
+ placeholder="Type: bold, strike or red" aria-label="Type: bold, strike or red 2"><br>
+ <input ng-model="style3"
+ placeholder="Type: bold, strike or red" aria-label="Type: bold, strike or red 3"><br>
+ <hr>
+ <p ng-class="[style4, {orange: warning}]">Using Array and Map Syntax</p>
+ <input ng-model="style4" placeholder="Type: bold, strike" aria-label="Type: bold, strike"><br>
+ <label><input type="checkbox" ng-model="warning"> warning (apply "orange" class)</label>
+ </file>
+ <file name="style.css">
+ .strike {
+ text-decoration: line-through;
+ }
+ .bold {
+ font-weight: bold;
+ }
+ .red {
+ color: red;
+ }
+ .has-error {
+ color: red;
+ background-color: yellow;
+ }
+ .orange {
+ color: orange;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var ps = element.all(by.css('p'));
+
+ it('should let you toggle the class', function() {
+
+ expect(ps.first().getAttribute('class')).not.toMatch(/bold/);
+ expect(ps.first().getAttribute('class')).not.toMatch(/has-error/);
+
+ element(by.model('important')).click();
+ expect(ps.first().getAttribute('class')).toMatch(/bold/);
+
+ element(by.model('error')).click();
+ expect(ps.first().getAttribute('class')).toMatch(/has-error/);
+ });
+
+ it('should let you toggle string example', function() {
+ expect(ps.get(1).getAttribute('class')).toBe('');
+ element(by.model('style')).clear();
+ element(by.model('style')).sendKeys('red');
+ expect(ps.get(1).getAttribute('class')).toBe('red');
+ });
+
+ it('array example should have 3 classes', function() {
+ expect(ps.get(2).getAttribute('class')).toBe('');
+ element(by.model('style1')).sendKeys('bold');
+ element(by.model('style2')).sendKeys('strike');
+ element(by.model('style3')).sendKeys('red');
+ expect(ps.get(2).getAttribute('class')).toBe('bold strike red');
+ });
+
+ it('array with map example should have 2 classes', function() {
+ expect(ps.last().getAttribute('class')).toBe('');
+ element(by.model('style4')).sendKeys('bold');
+ element(by.model('warning')).click();
+ expect(ps.last().getAttribute('class')).toBe('bold orange');
+ });
+ </file>
+ </example>
+
+ ## Animations
+
+ The example below demonstrates how to perform animations using ngClass.
+
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <input id="setbtn" type="button" value="set" ng-click="myVar='my-class'">
+ <input id="clearbtn" type="button" value="clear" ng-click="myVar=''">
+ <br>
+ <span class="base-class" ng-class="myVar">Sample Text</span>
+ </file>
+ <file name="style.css">
+ .base-class {
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+ }
+
+ .base-class.my-class {
+ color: red;
+ font-size:3em;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-class', function() {
+ expect(element(by.css('.base-class')).getAttribute('class')).not.
+ toMatch(/my-class/);
+
+ element(by.id('setbtn')).click();
+
+ expect(element(by.css('.base-class')).getAttribute('class')).
+ toMatch(/my-class/);
+
+ element(by.id('clearbtn')).click();
+
+ expect(element(by.css('.base-class')).getAttribute('class')).not.
+ toMatch(/my-class/);
+ });
+ </file>
+ </example>
+
+
+ ## ngClass and pre-existing CSS3 Transitions/Animations
+ The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.
+ Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder
+ any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure
+ to view the step by step details of {@link $animate#addClass $animate.addClass} and
+ {@link $animate#removeClass $animate.removeClass}.
+ */
+var ngClassDirective = classDirective('', true);
+
+/**
+ * @ngdoc directive
+ * @name ngClassOdd
+ * @restrict AC
+ *
+ * @description
+ * The `ngClassOdd` and `ngClassEven` directives work exactly as
+ * {@link ng.directive:ngClass ngClass}, except they work in
+ * conjunction with `ngRepeat` and take effect only on odd (even) rows.
+ *
+ * This directive can be applied only within the scope of an
+ * {@link ng.directive:ngRepeat ngRepeat}.
+ *
+ * @element ANY
+ * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result
+ * of the evaluation can be a string representing space delimited class names or an array.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
+ <li ng-repeat="name in names">
+ <span ng-class-odd="'odd'" ng-class-even="'even'">
+ {{name}}
+ </span>
+ </li>
+ </ol>
+ </file>
+ <file name="style.css">
+ .odd {
+ color: red;
+ }
+ .even {
+ color: blue;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-class-odd and ng-class-even', function() {
+ expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
+ toMatch(/odd/);
+ expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
+ toMatch(/even/);
+ });
+ </file>
+ </example>
+ */
+var ngClassOddDirective = classDirective('Odd', 0);
+
+/**
+ * @ngdoc directive
+ * @name ngClassEven
+ * @restrict AC
+ *
+ * @description
+ * The `ngClassOdd` and `ngClassEven` directives work exactly as
+ * {@link ng.directive:ngClass ngClass}, except they work in
+ * conjunction with `ngRepeat` and take effect only on odd (even) rows.
+ *
+ * This directive can be applied only within the scope of an
+ * {@link ng.directive:ngRepeat ngRepeat}.
+ *
+ * @element ANY
+ * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The
+ * result of the evaluation can be a string representing space delimited class names or an array.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
+ <li ng-repeat="name in names">
+ <span ng-class-odd="'odd'" ng-class-even="'even'">
+ {{name}} &nbsp; &nbsp; &nbsp;
+ </span>
+ </li>
+ </ol>
+ </file>
+ <file name="style.css">
+ .odd {
+ color: red;
+ }
+ .even {
+ color: blue;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-class-odd and ng-class-even', function() {
+ expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
+ toMatch(/odd/);
+ expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
+ toMatch(/even/);
+ });
+ </file>
+ </example>
+ */
+var ngClassEvenDirective = classDirective('Even', 1);
+
+/**
+ * @ngdoc directive
+ * @name ngCloak
+ * @restrict AC
+ *
+ * @description
+ * The `ngCloak` directive is used to prevent the Angular html template from being briefly
+ * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this
+ * directive to avoid the undesirable flicker effect caused by the html template display.
+ *
+ * The directive can be applied to the `<body>` element, but the preferred usage is to apply
+ * multiple `ngCloak` directives to small portions of the page to permit progressive rendering
+ * of the browser view.
+ *
+ * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and
+ * `angular.min.js`.
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```css
+ * [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
+ * display: none !important;
+ * }
+ * ```
+ *
+ * When this css rule is loaded by the browser, all html elements (including their children) that
+ * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive
+ * during the compilation of the template it deletes the `ngCloak` element attribute, making
+ * the compiled element visible.
+ *
+ * For the best result, the `angular.js` script must be loaded in the head section of the html
+ * document; alternatively, the css rule above must be included in the external stylesheet of the
+ * application.
+ *
+ * @element ANY
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <div id="template1" ng-cloak>{{ 'hello' }}</div>
+ <div id="template2" class="ng-cloak">{{ 'world' }}</div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should remove the template directive and css class', function() {
+ expect($('#template1').getAttribute('ng-cloak')).
+ toBeNull();
+ expect($('#template2').getAttribute('ng-cloak')).
+ toBeNull();
+ });
+ </file>
+ </example>
+ *
+ */
+var ngCloakDirective = ngDirective({
+ compile: function(element, attr) {
+ attr.$set('ngCloak', undefined);
+ element.removeClass('ng-cloak');
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngController
+ *
+ * @description
+ * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular
+ * supports the principles behind the Model-View-Controller design pattern.
+ *
+ * MVC components in angular:
+ *
+ * * Model — Models are the properties of a scope; scopes are attached to the DOM where scope properties
+ * are accessed through bindings.
+ * * View — The template (HTML with data bindings) that is rendered into the View.
+ * * Controller — The `ngController` directive specifies a Controller class; the class contains business
+ * logic behind the application to decorate the scope with functions and values
+ *
+ * Note that you can also attach controllers to the DOM by declaring it in a route definition
+ * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller
+ * again using `ng-controller` in the template itself. This will cause the controller to be attached
+ * and executed twice.
+ *
+ * @element ANY
+ * @scope
+ * @priority 500
+ * @param {expression} ngController Name of a constructor function registered with the current
+ * {@link ng.$controllerProvider $controllerProvider} or an {@link guide/expression expression}
+ * that on the current scope evaluates to a constructor function.
+ *
+ * The controller instance can be published into a scope property by specifying
+ * `ng-controller="as propertyName"`.
+ *
+ * If the current `$controllerProvider` is configured to use globals (via
+ * {@link ng.$controllerProvider#allowGlobals `$controllerProvider.allowGlobals()` }), this may
+ * also be the name of a globally accessible constructor function (not recommended).
+ *
+ * @example
+ * Here is a simple form for editing user contact information. Adding, removing, clearing, and
+ * greeting are methods declared on the controller (see source tab). These methods can
+ * easily be called from the angular markup. Any changes to the data are automatically reflected
+ * in the View without the need for a manual update.
+ *
+ * Two different declaration styles are included below:
+ *
+ * * one binds methods and properties directly onto the controller using `this`:
+ * `ng-controller="SettingsController1 as settings"`
+ * * one injects `$scope` into the controller:
+ * `ng-controller="SettingsController2"`
+ *
+ * The second option is more common in the Angular community, and is generally used in boilerplates
+ * and in this guide. However, there are advantages to binding properties directly to the controller
+ * and avoiding scope.
+ *
+ * * Using `controller as` makes it obvious which controller you are accessing in the template when
+ * multiple controllers apply to an element.
+ * * If you are writing your controllers as classes you have easier access to the properties and
+ * methods, which will appear on the scope, from inside the controller code.
+ * * Since there is always a `.` in the bindings, you don't have to worry about prototypal
+ * inheritance masking primitives.
+ *
+ * This example demonstrates the `controller as` syntax.
+ *
+ * <example name="ngControllerAs" module="controllerAsExample">
+ * <file name="index.html">
+ * <div id="ctrl-as-exmpl" ng-controller="SettingsController1 as settings">
+ * <label>Name: <input type="text" ng-model="settings.name"/></label>
+ * <button ng-click="settings.greet()">greet</button><br/>
+ * Contact:
+ * <ul>
+ * <li ng-repeat="contact in settings.contacts">
+ * <select ng-model="contact.type" aria-label="Contact method" id="select_{{$index}}">
+ * <option>phone</option>
+ * <option>email</option>
+ * </select>
+ * <input type="text" ng-model="contact.value" aria-labelledby="select_{{$index}}" />
+ * <button ng-click="settings.clearContact(contact)">clear</button>
+ * <button ng-click="settings.removeContact(contact)" aria-label="Remove">X</button>
+ * </li>
+ * <li><button ng-click="settings.addContact()">add</button></li>
+ * </ul>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('controllerAsExample', [])
+ * .controller('SettingsController1', SettingsController1);
+ *
+ * function SettingsController1() {
+ * this.name = "John Smith";
+ * this.contacts = [
+ * {type: 'phone', value: '408 555 1212'},
+ * {type: 'email', value: 'john.smith@example.org'} ];
+ * }
+ *
+ * SettingsController1.prototype.greet = function() {
+ * alert(this.name);
+ * };
+ *
+ * SettingsController1.prototype.addContact = function() {
+ * this.contacts.push({type: 'email', value: 'yourname@example.org'});
+ * };
+ *
+ * SettingsController1.prototype.removeContact = function(contactToRemove) {
+ * var index = this.contacts.indexOf(contactToRemove);
+ * this.contacts.splice(index, 1);
+ * };
+ *
+ * SettingsController1.prototype.clearContact = function(contact) {
+ * contact.type = 'phone';
+ * contact.value = '';
+ * };
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should check controller as', function() {
+ * var container = element(by.id('ctrl-as-exmpl'));
+ * expect(container.element(by.model('settings.name'))
+ * .getAttribute('value')).toBe('John Smith');
+ *
+ * var firstRepeat =
+ * container.element(by.repeater('contact in settings.contacts').row(0));
+ * var secondRepeat =
+ * container.element(by.repeater('contact in settings.contacts').row(1));
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('408 555 1212');
+ *
+ * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('john.smith@example.org');
+ *
+ * firstRepeat.element(by.buttonText('clear')).click();
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('');
+ *
+ * container.element(by.buttonText('add')).click();
+ *
+ * expect(container.element(by.repeater('contact in settings.contacts').row(2))
+ * .element(by.model('contact.value'))
+ * .getAttribute('value'))
+ * .toBe('yourname@example.org');
+ * });
+ * </file>
+ * </example>
+ *
+ * This example demonstrates the "attach to `$scope`" style of controller.
+ *
+ * <example name="ngController" module="controllerExample">
+ * <file name="index.html">
+ * <div id="ctrl-exmpl" ng-controller="SettingsController2">
+ * <label>Name: <input type="text" ng-model="name"/></label>
+ * <button ng-click="greet()">greet</button><br/>
+ * Contact:
+ * <ul>
+ * <li ng-repeat="contact in contacts">
+ * <select ng-model="contact.type" id="select_{{$index}}">
+ * <option>phone</option>
+ * <option>email</option>
+ * </select>
+ * <input type="text" ng-model="contact.value" aria-labelledby="select_{{$index}}" />
+ * <button ng-click="clearContact(contact)">clear</button>
+ * <button ng-click="removeContact(contact)">X</button>
+ * </li>
+ * <li>[ <button ng-click="addContact()">add</button> ]</li>
+ * </ul>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('controllerExample', [])
+ * .controller('SettingsController2', ['$scope', SettingsController2]);
+ *
+ * function SettingsController2($scope) {
+ * $scope.name = "John Smith";
+ * $scope.contacts = [
+ * {type:'phone', value:'408 555 1212'},
+ * {type:'email', value:'john.smith@example.org'} ];
+ *
+ * $scope.greet = function() {
+ * alert($scope.name);
+ * };
+ *
+ * $scope.addContact = function() {
+ * $scope.contacts.push({type:'email', value:'yourname@example.org'});
+ * };
+ *
+ * $scope.removeContact = function(contactToRemove) {
+ * var index = $scope.contacts.indexOf(contactToRemove);
+ * $scope.contacts.splice(index, 1);
+ * };
+ *
+ * $scope.clearContact = function(contact) {
+ * contact.type = 'phone';
+ * contact.value = '';
+ * };
+ * }
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should check controller', function() {
+ * var container = element(by.id('ctrl-exmpl'));
+ *
+ * expect(container.element(by.model('name'))
+ * .getAttribute('value')).toBe('John Smith');
+ *
+ * var firstRepeat =
+ * container.element(by.repeater('contact in contacts').row(0));
+ * var secondRepeat =
+ * container.element(by.repeater('contact in contacts').row(1));
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('408 555 1212');
+ * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('john.smith@example.org');
+ *
+ * firstRepeat.element(by.buttonText('clear')).click();
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('');
+ *
+ * container.element(by.buttonText('add')).click();
+ *
+ * expect(container.element(by.repeater('contact in contacts').row(2))
+ * .element(by.model('contact.value'))
+ * .getAttribute('value'))
+ * .toBe('yourname@example.org');
+ * });
+ * </file>
+ *</example>
+
+ */
+var ngControllerDirective = [function() {
+ return {
+ restrict: 'A',
+ scope: true,
+ controller: '@',
+ priority: 500
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngCsp
+ *
+ * @element html
+ * @description
+ *
+ * Angular has some features that can break certain
+ * [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) rules.
+ *
+ * If you intend to implement these rules then you must tell Angular not to use these features.
+ *
+ * This is necessary when developing things like Google Chrome Extensions or Universal Windows Apps.
+ *
+ *
+ * The following rules affect Angular:
+ *
+ * * `unsafe-eval`: this rule forbids apps to use `eval` or `Function(string)` generated functions
+ * (among other things). Angular makes use of this in the {@link $parse} service to provide a 30%
+ * increase in the speed of evaluating Angular expressions.
+ *
+ * * `unsafe-inline`: this rule forbids apps from inject custom styles into the document. Angular
+ * makes use of this to include some CSS rules (e.g. {@link ngCloak} and {@link ngHide}).
+ * To make these directives work when a CSP rule is blocking inline styles, you must link to the
+ * `angular-csp.css` in your HTML manually.
+ *
+ * If you do not provide `ngCsp` then Angular tries to autodetect if CSP is blocking unsafe-eval
+ * and automatically deactivates this feature in the {@link $parse} service. This autodetection,
+ * however, triggers a CSP error to be logged in the console:
+ *
+ * ```
+ * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of
+ * script in the following Content Security Policy directive: "default-src 'self'". Note that
+ * 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
+ * ```
+ *
+ * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`
+ * directive on an element of the HTML document that appears before the `<script>` tag that loads
+ * the `angular.js` file.
+ *
+ * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*
+ *
+ * You can specify which of the CSP related Angular features should be deactivated by providing
+ * a value for the `ng-csp` attribute. The options are as follows:
+ *
+ * * no-inline-style: this stops Angular from injecting CSS styles into the DOM
+ *
+ * * no-unsafe-eval: this stops Angular from optimizing $parse with unsafe eval of strings
+ *
+ * You can use these values in the following combinations:
+ *
+ *
+ * * No declaration means that Angular will assume that you can do inline styles, but it will do
+ * a runtime check for unsafe-eval. E.g. `<body>`. This is backwardly compatible with previous versions
+ * of Angular.
+ *
+ * * A simple `ng-csp` (or `data-ng-csp`) attribute will tell Angular to deactivate both inline
+ * styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous versions
+ * of Angular.
+ *
+ * * Specifying only `no-unsafe-eval` tells Angular that we must not use eval, but that we can inject
+ * inline styles. E.g. `<body ng-csp="no-unsafe-eval">`.
+ *
+ * * Specifying only `no-inline-style` tells Angular that we must not inject styles, but that we can
+ * run eval - no automatic check for unsafe eval will occur. E.g. `<body ng-csp="no-inline-style">`
+ *
+ * * Specifying both `no-unsafe-eval` and `no-inline-style` tells Angular that we must not inject
+ * styles nor use eval, which is the same as an empty: ng-csp.
+ * E.g.`<body ng-csp="no-inline-style;no-unsafe-eval">`
+ *
+ * @example
+ * This example shows how to apply the `ngCsp` directive to the `html` tag.
+ ```html
+ <!doctype html>
+ <html ng-app ng-csp>
+ ...
+ ...
+ </html>
+ ```
+ * @example
+ // Note: the suffix `.csp` in the example name triggers
+ // csp mode in our http server!
+ <example name="example.csp" module="cspExample" ng-csp="true">
+ <file name="index.html">
+ <div ng-controller="MainController as ctrl">
+ <div>
+ <button ng-click="ctrl.inc()" id="inc">Increment</button>
+ <span id="counter">
+ {{ctrl.counter}}
+ </span>
+ </div>
+
+ <div>
+ <button ng-click="ctrl.evil()" id="evil">Evil</button>
+ <span id="evilError">
+ {{ctrl.evilError}}
+ </span>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('cspExample', [])
+ .controller('MainController', function() {
+ this.counter = 0;
+ this.inc = function() {
+ this.counter++;
+ };
+ this.evil = function() {
+ // jshint evil:true
+ try {
+ eval('1+2');
+ } catch (e) {
+ this.evilError = e.message;
+ }
+ };
+ });
+ </file>
+ <file name="protractor.js" type="protractor">
+ var util, webdriver;
+
+ var incBtn = element(by.id('inc'));
+ var counter = element(by.id('counter'));
+ var evilBtn = element(by.id('evil'));
+ var evilError = element(by.id('evilError'));
+
+ function getAndClearSevereErrors() {
+ return browser.manage().logs().get('browser').then(function(browserLog) {
+ return browserLog.filter(function(logEntry) {
+ return logEntry.level.value > webdriver.logging.Level.WARNING.value;
+ });
+ });
+ }
+
+ function clearErrors() {
+ getAndClearSevereErrors();
+ }
+
+ function expectNoErrors() {
+ getAndClearSevereErrors().then(function(filteredLog) {
+ expect(filteredLog.length).toEqual(0);
+ if (filteredLog.length) {
+ console.log('browser console errors: ' + util.inspect(filteredLog));
+ }
+ });
+ }
+
+ function expectError(regex) {
+ getAndClearSevereErrors().then(function(filteredLog) {
+ var found = false;
+ filteredLog.forEach(function(log) {
+ if (log.message.match(regex)) {
+ found = true;
+ }
+ });
+ if (!found) {
+ throw new Error('expected an error that matches ' + regex);
+ }
+ });
+ }
+
+ beforeEach(function() {
+ util = require('util');
+ webdriver = require('protractor/node_modules/selenium-webdriver');
+ });
+
+ // For now, we only test on Chrome,
+ // as Safari does not load the page with Protractor's injected scripts,
+ // and Firefox webdriver always disables content security policy (#6358)
+ if (browser.params.browser !== 'chrome') {
+ return;
+ }
+
+ it('should not report errors when the page is loaded', function() {
+ // clear errors so we are not dependent on previous tests
+ clearErrors();
+ // Need to reload the page as the page is already loaded when
+ // we come here
+ browser.driver.getCurrentUrl().then(function(url) {
+ browser.get(url);
+ });
+ expectNoErrors();
+ });
+
+ it('should evaluate expressions', function() {
+ expect(counter.getText()).toEqual('0');
+ incBtn.click();
+ expect(counter.getText()).toEqual('1');
+ expectNoErrors();
+ });
+
+ it('should throw and report an error when using "eval"', function() {
+ evilBtn.click();
+ expect(evilError.getText()).toMatch(/Content Security Policy/);
+ expectError(/Content Security Policy/);
+ });
+ </file>
+ </example>
+ */
+
+// ngCsp is not implemented as a proper directive any more, because we need it be processed while we
+// bootstrap the system (before $parse is instantiated), for this reason we just have
+// the csp() fn that looks for the `ng-csp` attribute anywhere in the current doc
+
+/**
+ * @ngdoc directive
+ * @name ngClick
+ *
+ * @description
+ * The ngClick directive allows you to specify custom behavior when
+ * an element is clicked.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon
+ * click. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-click="count = count + 1" ng-init="count=0">
+ Increment
+ </button>
+ <span>
+ count: {{count}}
+ </span>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-click', function() {
+ expect(element(by.binding('count')).getText()).toMatch('0');
+ element(by.css('button')).click();
+ expect(element(by.binding('count')).getText()).toMatch('1');
+ });
+ </file>
+ </example>
+ */
+/*
+ * A collection of directives that allows creation of custom event handlers that are defined as
+ * angular expressions and are compiled and executed within the current scope.
+ */
+var ngEventDirectives = {};
+
+// For events that might fire synchronously during DOM manipulation
+// we need to execute their event handlers asynchronously using $evalAsync,
+// so that they are not executed in an inconsistent state.
+var forceAsyncEvents = {
+ 'blur': true,
+ 'focus': true
+};
+forEach(
+ 'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),
+ function(eventName) {
+ var directiveName = directiveNormalize('ng-' + eventName);
+ ngEventDirectives[directiveName] = ['$parse', '$rootScope', function($parse, $rootScope) {
+ return {
+ restrict: 'A',
+ compile: function($element, attr) {
+ // We expose the powerful $event object on the scope that provides access to the Window,
+ // etc. that isn't protected by the fast paths in $parse. We explicitly request better
+ // checks at the cost of speed since event handler expressions are not executed as
+ // frequently as regular change detection.
+ var fn = $parse(attr[directiveName], /* interceptorFn */ null, /* expensiveChecks */ true);
+ return function ngEventHandler(scope, element) {
+ element.on(eventName, function(event) {
+ var callback = function() {
+ fn(scope, {$event:event});
+ };
+ if (forceAsyncEvents[eventName] && $rootScope.$$phase) {
+ scope.$evalAsync(callback);
+ } else {
+ scope.$apply(callback);
+ }
+ });
+ };
+ }
+ };
+ }];
+ }
+);
+
+/**
+ * @ngdoc directive
+ * @name ngDblclick
+ *
+ * @description
+ * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon
+ * a dblclick. (The Event object is available as `$event`)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-dblclick="count = count + 1" ng-init="count=0">
+ Increment (on double click)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMousedown
+ *
+ * @description
+ * The ngMousedown directive allows you to specify custom behavior on mousedown event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon
+ * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mousedown="count = count + 1" ng-init="count=0">
+ Increment (on mouse down)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseup
+ *
+ * @description
+ * Specify custom behavior on mouseup event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon
+ * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseup="count = count + 1" ng-init="count=0">
+ Increment (on mouse up)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngMouseover
+ *
+ * @description
+ * Specify custom behavior on mouseover event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon
+ * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseover="count = count + 1" ng-init="count=0">
+ Increment (when mouse is over)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseenter
+ *
+ * @description
+ * Specify custom behavior on mouseenter event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon
+ * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseenter="count = count + 1" ng-init="count=0">
+ Increment (when mouse enters)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseleave
+ *
+ * @description
+ * Specify custom behavior on mouseleave event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon
+ * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseleave="count = count + 1" ng-init="count=0">
+ Increment (when mouse leaves)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMousemove
+ *
+ * @description
+ * Specify custom behavior on mousemove event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon
+ * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mousemove="count = count + 1" ng-init="count=0">
+ Increment (when mouse moves)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeydown
+ *
+ * @description
+ * Specify custom behavior on keydown event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon
+ * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-keydown="count = count + 1" ng-init="count=0">
+ key down count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeyup
+ *
+ * @description
+ * Specify custom behavior on keyup event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon
+ * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <p>Typing in the input box below updates the key count</p>
+ <input ng-keyup="count = count + 1" ng-init="count=0"> key up count: {{count}}
+
+ <p>Typing in the input box below updates the keycode</p>
+ <input ng-keyup="event=$event">
+ <p>event keyCode: {{ event.keyCode }}</p>
+ <p>event altKey: {{ event.altKey }}</p>
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeypress
+ *
+ * @description
+ * Specify custom behavior on keypress event.
+ *
+ * @element ANY
+ * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon
+ * keypress. ({@link guide/expression#-event- Event object is available as `$event`}
+ * and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-keypress="count = count + 1" ng-init="count=0">
+ key press count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngSubmit
+ *
+ * @description
+ * Enables binding angular expressions to onsubmit events.
+ *
+ * Additionally it prevents the default action (which for form means sending the request to the
+ * server and reloading the current page), but only if the form does not contain `action`,
+ * `data-action`, or `x-action` attributes.
+ *
+ * <div class="alert alert-warning">
+ * **Warning:** Be careful not to cause "double-submission" by using both the `ngClick` and
+ * `ngSubmit` handlers together. See the
+ * {@link form#submitting-a-form-and-preventing-the-default-action `form` directive documentation}
+ * for a detailed discussion of when `ngSubmit` may be triggered.
+ * </div>
+ *
+ * @element form
+ * @priority 0
+ * @param {expression} ngSubmit {@link guide/expression Expression} to eval.
+ * ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example module="submitExample">
+ <file name="index.html">
+ <script>
+ angular.module('submitExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.list = [];
+ $scope.text = 'hello';
+ $scope.submit = function() {
+ if ($scope.text) {
+ $scope.list.push(this.text);
+ $scope.text = '';
+ }
+ };
+ }]);
+ </script>
+ <form ng-submit="submit()" ng-controller="ExampleController">
+ Enter text and hit enter:
+ <input type="text" ng-model="text" name="text" />
+ <input type="submit" id="submit" value="Submit" />
+ <pre>list={{list}}</pre>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-submit', function() {
+ expect(element(by.binding('list')).getText()).toBe('list=[]');
+ element(by.css('#submit')).click();
+ expect(element(by.binding('list')).getText()).toContain('hello');
+ expect(element(by.model('text')).getAttribute('value')).toBe('');
+ });
+ it('should ignore empty strings', function() {
+ expect(element(by.binding('list')).getText()).toBe('list=[]');
+ element(by.css('#submit')).click();
+ element(by.css('#submit')).click();
+ expect(element(by.binding('list')).getText()).toContain('hello');
+ });
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngFocus
+ *
+ * @description
+ * Specify custom behavior on focus event.
+ *
+ * Note: As the `focus` event is executed synchronously when calling `input.focus()`
+ * AngularJS executes the expression using `scope.$evalAsync` if the event is fired
+ * during an `$apply` to ensure a consistent state.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon
+ * focus. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ * See {@link ng.directive:ngClick ngClick}
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngBlur
+ *
+ * @description
+ * Specify custom behavior on blur event.
+ *
+ * A [blur event](https://developer.mozilla.org/en-US/docs/Web/Events/blur) fires when
+ * an element has lost focus.
+ *
+ * Note: As the `blur` event is executed synchronously also during DOM manipulations
+ * (e.g. removing a focussed input),
+ * AngularJS executes the expression using `scope.$evalAsync` if the event is fired
+ * during an `$apply` to ensure a consistent state.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon
+ * blur. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ * See {@link ng.directive:ngClick ngClick}
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngCopy
+ *
+ * @description
+ * Specify custom behavior on copy event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon
+ * copy. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-copy="copied=true" ng-init="copied=false; value='copy me'" ng-model="value">
+ copied: {{copied}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngCut
+ *
+ * @description
+ * Specify custom behavior on cut event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon
+ * cut. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-cut="cut=true" ng-init="cut=false; value='cut me'" ng-model="value">
+ cut: {{cut}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngPaste
+ *
+ * @description
+ * Specify custom behavior on paste event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon
+ * paste. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-paste="paste=true" ng-init="paste=false" placeholder='paste here'>
+ pasted: {{paste}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngIf
+ * @restrict A
+ * @multiElement
+ *
+ * @description
+ * The `ngIf` directive removes or recreates a portion of the DOM tree based on an
+ * {expression}. If the expression assigned to `ngIf` evaluates to a false
+ * value then the element is removed from the DOM, otherwise a clone of the
+ * element is reinserted into the DOM.
+ *
+ * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the
+ * element in the DOM rather than changing its visibility via the `display` css property. A common
+ * case when this difference is significant is when using css selectors that rely on an element's
+ * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes.
+ *
+ * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope
+ * is created when the element is restored. The scope created within `ngIf` inherits from
+ * its parent scope using
+ * [prototypal inheritance](https://github.com/angular/angular.js/wiki/Understanding-Scopes#javascript-prototypal-inheritance).
+ * An important implication of this is if `ngModel` is used within `ngIf` to bind to
+ * a javascript primitive defined in the parent scope. In this case any modifications made to the
+ * variable within the child scope will override (hide) the value in the parent scope.
+ *
+ * Also, `ngIf` recreates elements using their compiled state. An example of this behavior
+ * is if an element's class attribute is directly modified after it's compiled, using something like
+ * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element
+ * the added class will be lost because the original compiled state is used to regenerate the element.
+ *
+ * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter`
+ * and `leave` effects.
+ *
+ * @animations
+ * enter - happens just after the `ngIf` contents change and a new DOM element is created and injected into the `ngIf` container
+ * leave - happens just before the `ngIf` contents are removed from the DOM
+ *
+ * @element ANY
+ * @scope
+ * @priority 600
+ * @param {expression} ngIf If the {@link guide/expression expression} is falsy then
+ * the element is removed from the DOM tree. If it is truthy a copy of the compiled
+ * element is added to the DOM tree.
+ *
+ * @example
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <label>Click me: <input type="checkbox" ng-model="checked" ng-init="checked=true" /></label><br/>
+ Show when checked:
+ <span ng-if="checked" class="animate-if">
+ This is removed when the checkbox is unchecked.
+ </span>
+ </file>
+ <file name="animations.css">
+ .animate-if {
+ background:white;
+ border:1px solid black;
+ padding:10px;
+ }
+
+ .animate-if.ng-enter, .animate-if.ng-leave {
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+ }
+
+ .animate-if.ng-enter,
+ .animate-if.ng-leave.ng-leave-active {
+ opacity:0;
+ }
+
+ .animate-if.ng-leave,
+ .animate-if.ng-enter.ng-enter-active {
+ opacity:1;
+ }
+ </file>
+ </example>
+ */
+var ngIfDirective = ['$animate', function($animate) {
+ return {
+ multiElement: true,
+ transclude: 'element',
+ priority: 600,
+ terminal: true,
+ restrict: 'A',
+ $$tlb: true,
+ link: function($scope, $element, $attr, ctrl, $transclude) {
+ var block, childScope, previousElements;
+ $scope.$watch($attr.ngIf, function ngIfWatchAction(value) {
+
+ if (value) {
+ if (!childScope) {
+ $transclude(function(clone, newScope) {
+ childScope = newScope;
+ clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ');
+ // Note: We only need the first/last node of the cloned nodes.
+ // However, we need to keep the reference to the jqlite wrapper as it might be changed later
+ // by a directive with templateUrl when its template arrives.
+ block = {
+ clone: clone
+ };
+ $animate.enter(clone, $element.parent(), $element);
+ });
+ }
+ } else {
+ if (previousElements) {
+ previousElements.remove();
+ previousElements = null;
+ }
+ if (childScope) {
+ childScope.$destroy();
+ childScope = null;
+ }
+ if (block) {
+ previousElements = getBlockNodes(block.clone);
+ $animate.leave(previousElements).then(function() {
+ previousElements = null;
+ });
+ block = null;
+ }
+ }
+ });
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngInclude
+ * @restrict ECA
+ *
+ * @description
+ * Fetches, compiles and includes an external HTML fragment.
+ *
+ * By default, the template URL is restricted to the same domain and protocol as the
+ * application document. This is done by calling {@link $sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols
+ * you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist them} or
+ * {@link $sce#trustAsResourceUrl wrap them} as trusted values. Refer to Angular's {@link
+ * ng.$sce Strict Contextual Escaping}.
+ *
+ * In addition, the browser's
+ * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+ * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
+ * policy may further restrict whether the template is successfully loaded.
+ * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://`
+ * access on some browsers.
+ *
+ * @animations
+ * enter - animation is used to bring new content into the browser.
+ * leave - animation is used to animate existing content away.
+ *
+ * The enter and leave animation occur concurrently.
+ *
+ * @scope
+ * @priority 400
+ *
+ * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,
+ * make sure you wrap it in **single** quotes, e.g. `src="'myPartialTemplate.html'"`.
+ * @param {string=} onload Expression to evaluate when a new partial is loaded.
+ * <div class="alert alert-warning">
+ * **Note:** When using onload on SVG elements in IE11, the browser will try to call
+ * a function with the name on the window element, which will usually throw a
+ * "function is undefined" error. To fix this, you can instead use `data-onload` or a
+ * different form that {@link guide/directive#normalization matches} `onload`.
+ * </div>
+ *
+ * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll
+ * $anchorScroll} to scroll the viewport after the content is loaded.
+ *
+ * - If the attribute is not set, disable scrolling.
+ * - If the attribute is set without value, enable scrolling.
+ * - Otherwise enable scrolling only if the expression evaluates to truthy value.
+ *
+ * @example
+ <example module="includeExample" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <select ng-model="template" ng-options="t.name for t in templates">
+ <option value="">(blank)</option>
+ </select>
+ url of the template: <code>{{template.url}}</code>
+ <hr/>
+ <div class="slide-animate-container">
+ <div class="slide-animate" ng-include="template.url"></div>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('includeExample', ['ngAnimate'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.templates =
+ [ { name: 'template1.html', url: 'template1.html'},
+ { name: 'template2.html', url: 'template2.html'} ];
+ $scope.template = $scope.templates[0];
+ }]);
+ </file>
+ <file name="template1.html">
+ Content of template1.html
+ </file>
+ <file name="template2.html">
+ Content of template2.html
+ </file>
+ <file name="animations.css">
+ .slide-animate-container {
+ position:relative;
+ background:white;
+ border:1px solid black;
+ height:40px;
+ overflow:hidden;
+ }
+
+ .slide-animate {
+ padding:10px;
+ }
+
+ .slide-animate.ng-enter, .slide-animate.ng-leave {
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+
+ position:absolute;
+ top:0;
+ left:0;
+ right:0;
+ bottom:0;
+ display:block;
+ padding:10px;
+ }
+
+ .slide-animate.ng-enter {
+ top:-50px;
+ }
+ .slide-animate.ng-enter.ng-enter-active {
+ top:0;
+ }
+
+ .slide-animate.ng-leave {
+ top:0;
+ }
+ .slide-animate.ng-leave.ng-leave-active {
+ top:50px;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var templateSelect = element(by.model('template'));
+ var includeElem = element(by.css('[ng-include]'));
+
+ it('should load template1.html', function() {
+ expect(includeElem.getText()).toMatch(/Content of template1.html/);
+ });
+
+ it('should load template2.html', function() {
+ if (browser.params.browser == 'firefox') {
+ // Firefox can't handle using selects
+ // See https://github.com/angular/protractor/issues/480
+ return;
+ }
+ templateSelect.click();
+ templateSelect.all(by.css('option')).get(2).click();
+ expect(includeElem.getText()).toMatch(/Content of template2.html/);
+ });
+
+ it('should change to blank', function() {
+ if (browser.params.browser == 'firefox') {
+ // Firefox can't handle using selects
+ return;
+ }
+ templateSelect.click();
+ templateSelect.all(by.css('option')).get(0).click();
+ expect(includeElem.isPresent()).toBe(false);
+ });
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentRequested
+ * @eventType emit on the scope ngInclude was declared in
+ * @description
+ * Emitted every time the ngInclude content is requested.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {String} src URL of content to load.
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentLoaded
+ * @eventType emit on the current ngInclude scope
+ * @description
+ * Emitted every time the ngInclude content is reloaded.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {String} src URL of content to load.
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentError
+ * @eventType emit on the scope ngInclude was declared in
+ * @description
+ * Emitted when a template HTTP request yields an erroneous response (status < 200 || status > 299)
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {String} src URL of content to load.
+ */
+var ngIncludeDirective = ['$templateRequest', '$anchorScroll', '$animate',
+ function($templateRequest, $anchorScroll, $animate) {
+ return {
+ restrict: 'ECA',
+ priority: 400,
+ terminal: true,
+ transclude: 'element',
+ controller: angular.noop,
+ compile: function(element, attr) {
+ var srcExp = attr.ngInclude || attr.src,
+ onloadExp = attr.onload || '',
+ autoScrollExp = attr.autoscroll;
+
+ return function(scope, $element, $attr, ctrl, $transclude) {
+ var changeCounter = 0,
+ currentScope,
+ previousElement,
+ currentElement;
+
+ var cleanupLastIncludeContent = function() {
+ if (previousElement) {
+ previousElement.remove();
+ previousElement = null;
+ }
+ if (currentScope) {
+ currentScope.$destroy();
+ currentScope = null;
+ }
+ if (currentElement) {
+ $animate.leave(currentElement).then(function() {
+ previousElement = null;
+ });
+ previousElement = currentElement;
+ currentElement = null;
+ }
+ };
+
+ scope.$watch(srcExp, function ngIncludeWatchAction(src) {
+ var afterAnimation = function() {
+ if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {
+ $anchorScroll();
+ }
+ };
+ var thisChangeId = ++changeCounter;
+
+ if (src) {
+ //set the 2nd param to true to ignore the template request error so that the inner
+ //contents and scope can be cleaned up.
+ $templateRequest(src, true).then(function(response) {
+ if (scope.$$destroyed) return;
+
+ if (thisChangeId !== changeCounter) return;
+ var newScope = scope.$new();
+ ctrl.template = response;
+
+ // Note: This will also link all children of ng-include that were contained in the original
+ // html. If that content contains controllers, ... they could pollute/change the scope.
+ // However, using ng-include on an element with additional content does not make sense...
+ // Note: We can't remove them in the cloneAttchFn of $transclude as that
+ // function is called before linking the content, which would apply child
+ // directives to non existing elements.
+ var clone = $transclude(newScope, function(clone) {
+ cleanupLastIncludeContent();
+ $animate.enter(clone, null, $element).then(afterAnimation);
+ });
+
+ currentScope = newScope;
+ currentElement = clone;
+
+ currentScope.$emit('$includeContentLoaded', src);
+ scope.$eval(onloadExp);
+ }, function() {
+ if (scope.$$destroyed) return;
+
+ if (thisChangeId === changeCounter) {
+ cleanupLastIncludeContent();
+ scope.$emit('$includeContentError', src);
+ }
+ });
+ scope.$emit('$includeContentRequested', src);
+ } else {
+ cleanupLastIncludeContent();
+ ctrl.template = null;
+ }
+ });
+ };
+ }
+ };
+}];
+
+// This directive is called during the $transclude call of the first `ngInclude` directive.
+// It will replace and compile the content of the element with the loaded template.
+// We need this directive so that the element content is already filled when
+// the link function of another directive on the same element as ngInclude
+// is called.
+var ngIncludeFillContentDirective = ['$compile',
+ function($compile) {
+ return {
+ restrict: 'ECA',
+ priority: -400,
+ require: 'ngInclude',
+ link: function(scope, $element, $attr, ctrl) {
+ if (toString.call($element[0]).match(/SVG/)) {
+ // WebKit: https://bugs.webkit.org/show_bug.cgi?id=135698 --- SVG elements do not
+ // support innerHTML, so detect this here and try to generate the contents
+ // specially.
+ $element.empty();
+ $compile(jqLiteBuildFragment(ctrl.template, document).childNodes)(scope,
+ function namespaceAdaptedClone(clone) {
+ $element.append(clone);
+ }, {futureParentElement: $element});
+ return;
+ }
+
+ $element.html(ctrl.template);
+ $compile($element.contents())(scope);
+ }
+ };
+ }];
+
+/**
+ * @ngdoc directive
+ * @name ngInit
+ * @restrict AC
+ *
+ * @description
+ * The `ngInit` directive allows you to evaluate an expression in the
+ * current scope.
+ *
+ * <div class="alert alert-danger">
+ * This directive can be abused to add unnecessary amounts of logic into your templates.
+ * There are only a few appropriate uses of `ngInit`, such as for aliasing special properties of
+ * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below; and for injecting data via
+ * server side scripting. Besides these few cases, you should use {@link guide/controller controllers}
+ * rather than `ngInit` to initialize values on a scope.
+ * </div>
+ *
+ * <div class="alert alert-warning">
+ * **Note**: If you have assignment in `ngInit` along with a {@link ng.$filter `filter`}, make
+ * sure you have parentheses to ensure correct operator precedence:
+ * <pre class="prettyprint">
+ * `<div ng-init="test1 = ($index | toString)"></div>`
+ * </pre>
+ * </div>
+ *
+ * @priority 450
+ *
+ * @element ANY
+ * @param {expression} ngInit {@link guide/expression Expression} to eval.
+ *
+ * @example
+ <example module="initExample">
+ <file name="index.html">
+ <script>
+ angular.module('initExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.list = [['a', 'b'], ['c', 'd']];
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <div ng-repeat="innerList in list" ng-init="outerIndex = $index">
+ <div ng-repeat="value in innerList" ng-init="innerIndex = $index">
+ <span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
+ </div>
+ </div>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should alias index positions', function() {
+ var elements = element.all(by.css('.example-init'));
+ expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;');
+ expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;');
+ expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;');
+ expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;');
+ });
+ </file>
+ </example>
+ */
+var ngInitDirective = ngDirective({
+ priority: 450,
+ compile: function() {
+ return {
+ pre: function(scope, element, attrs) {
+ scope.$eval(attrs.ngInit);
+ }
+ };
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngList
+ *
+ * @description
+ * Text input that converts between a delimited string and an array of strings. The default
+ * delimiter is a comma followed by a space - equivalent to `ng-list=", "`. You can specify a custom
+ * delimiter as the value of the `ngList` attribute - for example, `ng-list=" | "`.
+ *
+ * The behaviour of the directive is affected by the use of the `ngTrim` attribute.
+ * * If `ngTrim` is set to `"false"` then whitespace around both the separator and each
+ * list item is respected. This implies that the user of the directive is responsible for
+ * dealing with whitespace but also allows you to use whitespace as a delimiter, such as a
+ * tab or newline character.
+ * * Otherwise whitespace around the delimiter is ignored when splitting (although it is respected
+ * when joining the list items back together) and whitespace around each list item is stripped
+ * before it is added to the model.
+ *
+ * ### Example with Validation
+ *
+ * <example name="ngList-directive" module="listExample">
+ * <file name="app.js">
+ * angular.module('listExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.names = ['morpheus', 'neo', 'trinity'];
+ * }]);
+ * </file>
+ * <file name="index.html">
+ * <form name="myForm" ng-controller="ExampleController">
+ * <label>List: <input name="namesInput" ng-model="names" ng-list required></label>
+ * <span role="alert">
+ * <span class="error" ng-show="myForm.namesInput.$error.required">
+ * Required!</span>
+ * </span>
+ * <br>
+ * <tt>names = {{names}}</tt><br/>
+ * <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>
+ * <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>
+ * <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ * <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ * </form>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * var listInput = element(by.model('names'));
+ * var names = element(by.exactBinding('names'));
+ * var valid = element(by.binding('myForm.namesInput.$valid'));
+ * var error = element(by.css('span.error'));
+ *
+ * it('should initialize to model', function() {
+ * expect(names.getText()).toContain('["morpheus","neo","trinity"]');
+ * expect(valid.getText()).toContain('true');
+ * expect(error.getCssValue('display')).toBe('none');
+ * });
+ *
+ * it('should be invalid if empty', function() {
+ * listInput.clear();
+ * listInput.sendKeys('');
+ *
+ * expect(names.getText()).toContain('');
+ * expect(valid.getText()).toContain('false');
+ * expect(error.getCssValue('display')).not.toBe('none');
+ * });
+ * </file>
+ * </example>
+ *
+ * ### Example - splitting on newline
+ * <example name="ngList-directive-newlines">
+ * <file name="index.html">
+ * <textarea ng-model="list" ng-list="&#10;" ng-trim="false"></textarea>
+ * <pre>{{ list | json }}</pre>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it("should split the text by newlines", function() {
+ * var listInput = element(by.model('list'));
+ * var output = element(by.binding('list | json'));
+ * listInput.sendKeys('abc\ndef\nghi');
+ * expect(output.getText()).toContain('[\n "abc",\n "def",\n "ghi"\n]');
+ * });
+ * </file>
+ * </example>
+ *
+ * @element input
+ * @param {string=} ngList optional delimiter that should be used to split the value.
+ */
+var ngListDirective = function() {
+ return {
+ restrict: 'A',
+ priority: 100,
+ require: 'ngModel',
+ link: function(scope, element, attr, ctrl) {
+ // We want to control whitespace trimming so we use this convoluted approach
+ // to access the ngList attribute, which doesn't pre-trim the attribute
+ var ngList = element.attr(attr.$attr.ngList) || ', ';
+ var trimValues = attr.ngTrim !== 'false';
+ var separator = trimValues ? trim(ngList) : ngList;
+
+ var parse = function(viewValue) {
+ // If the viewValue is invalid (say required but empty) it will be `undefined`
+ if (isUndefined(viewValue)) return;
+
+ var list = [];
+
+ if (viewValue) {
+ forEach(viewValue.split(separator), function(value) {
+ if (value) list.push(trimValues ? trim(value) : value);
+ });
+ }
+
+ return list;
+ };
+
+ ctrl.$parsers.push(parse);
+ ctrl.$formatters.push(function(value) {
+ if (isArray(value)) {
+ return value.join(ngList);
+ }
+
+ return undefined;
+ });
+
+ // Override the standard $isEmpty because an empty array means the input is empty.
+ ctrl.$isEmpty = function(value) {
+ return !value || !value.length;
+ };
+ }
+ };
+};
+
+/* global VALID_CLASS: true,
+ INVALID_CLASS: true,
+ PRISTINE_CLASS: true,
+ DIRTY_CLASS: true,
+ UNTOUCHED_CLASS: true,
+ TOUCHED_CLASS: true,
+*/
+
+var VALID_CLASS = 'ng-valid',
+ INVALID_CLASS = 'ng-invalid',
+ PRISTINE_CLASS = 'ng-pristine',
+ DIRTY_CLASS = 'ng-dirty',
+ UNTOUCHED_CLASS = 'ng-untouched',
+ TOUCHED_CLASS = 'ng-touched',
+ PENDING_CLASS = 'ng-pending',
+ EMPTY_CLASS = 'ng-empty',
+ NOT_EMPTY_CLASS = 'ng-not-empty';
+
+var ngModelMinErr = minErr('ngModel');
+
+/**
+ * @ngdoc type
+ * @name ngModel.NgModelController
+ *
+ * @property {*} $viewValue The actual value from the control's view. For `input` elements, this is a
+ * String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue
+ * is set.
+ * @property {*} $modelValue The value in the model that the control is bound to.
+ * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever
+ the control reads value from the DOM. The functions are called in array order, each passing
+ its return value through to the next. The last return value is forwarded to the
+ {@link ngModel.NgModelController#$validators `$validators`} collection.
+
+Parsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue
+`$viewValue`}.
+
+Returning `undefined` from a parser means a parse error occurred. In that case,
+no {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel`
+will be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`}
+is set to `true`. The parse error is stored in `ngModel.$error.parse`.
+
+ *
+ * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever
+ the model value changes. The functions are called in reverse array order, each passing the value through to the
+ next. The last return value is used as the actual DOM value.
+ Used to format / convert values for display in the control.
+ * ```js
+ * function formatter(value) {
+ * if (value) {
+ * return value.toUpperCase();
+ * }
+ * }
+ * ngModel.$formatters.push(formatter);
+ * ```
+ *
+ * @property {Object.<string, function>} $validators A collection of validators that are applied
+ * whenever the model value changes. The key value within the object refers to the name of the
+ * validator while the function refers to the validation operation. The validation operation is
+ * provided with the model value as an argument and must return a true or false value depending
+ * on the response of that validation.
+ *
+ * ```js
+ * ngModel.$validators.validCharacters = function(modelValue, viewValue) {
+ * var value = modelValue || viewValue;
+ * return /[0-9]+/.test(value) &&
+ * /[a-z]+/.test(value) &&
+ * /[A-Z]+/.test(value) &&
+ * /\W+/.test(value);
+ * };
+ * ```
+ *
+ * @property {Object.<string, function>} $asyncValidators A collection of validations that are expected to
+ * perform an asynchronous validation (e.g. a HTTP request). The validation function that is provided
+ * is expected to return a promise when it is run during the model validation process. Once the promise
+ * is delivered then the validation status will be set to true when fulfilled and false when rejected.
+ * When the asynchronous validators are triggered, each of the validators will run in parallel and the model
+ * value will only be updated once all validators have been fulfilled. As long as an asynchronous validator
+ * is unfulfilled, its key will be added to the controllers `$pending` property. Also, all asynchronous validators
+ * will only run once all synchronous validators have passed.
+ *
+ * Please note that if $http is used then it is important that the server returns a success HTTP response code
+ * in order to fulfill the validation and a status level of `4xx` in order to reject the validation.
+ *
+ * ```js
+ * ngModel.$asyncValidators.uniqueUsername = function(modelValue, viewValue) {
+ * var value = modelValue || viewValue;
+ *
+ * // Lookup user by username
+ * return $http.get('/api/users/' + value).
+ * then(function resolved() {
+ * //username exists, this means validation fails
+ * return $q.reject('exists');
+ * }, function rejected() {
+ * //username does not exist, therefore this validation passes
+ * return true;
+ * });
+ * };
+ * ```
+ *
+ * @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the
+ * view value has changed. It is called with no arguments, and its return value is ignored.
+ * This can be used in place of additional $watches against the model value.
+ *
+ * @property {Object} $error An object hash with all failing validator ids as keys.
+ * @property {Object} $pending An object hash with all pending validator ids as keys.
+ *
+ * @property {boolean} $untouched True if control has not lost focus yet.
+ * @property {boolean} $touched True if control has lost focus.
+ * @property {boolean} $pristine True if user has not interacted with the control yet.
+ * @property {boolean} $dirty True if user has already interacted with the control.
+ * @property {boolean} $valid True if there is no error.
+ * @property {boolean} $invalid True if at least one error on the control.
+ * @property {string} $name The name attribute of the control.
+ *
+ * @description
+ *
+ * `NgModelController` provides API for the {@link ngModel `ngModel`} directive.
+ * The controller contains services for data-binding, validation, CSS updates, and value formatting
+ * and parsing. It purposefully does not contain any logic which deals with DOM rendering or
+ * listening to DOM events.
+ * Such DOM related logic should be provided by other directives which make use of
+ * `NgModelController` for data-binding to control elements.
+ * Angular provides this DOM logic for most {@link input `input`} elements.
+ * At the end of this page you can find a {@link ngModel.NgModelController#custom-control-example
+ * custom control example} that uses `ngModelController` to bind to `contenteditable` elements.
+ *
+ * @example
+ * ### Custom Control Example
+ * This example shows how to use `NgModelController` with a custom control to achieve
+ * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)
+ * collaborate together to achieve the desired result.
+ *
+ * `contenteditable` is an HTML5 attribute, which tells the browser to let the element
+ * contents be edited in place by the user.
+ *
+ * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize}
+ * module to automatically remove "bad" content like inline event listener (e.g. `<span onclick="...">`).
+ * However, as we are using `$sce` the model can still decide to provide unsafe content if it marks
+ * that content using the `$sce` service.
+ *
+ * <example name="NgModelController" module="customControl" deps="angular-sanitize.js">
+ <file name="style.css">
+ [contenteditable] {
+ border: 1px solid black;
+ background-color: white;
+ min-height: 20px;
+ }
+
+ .ng-invalid {
+ border: 1px solid red;
+ }
+
+ </file>
+ <file name="script.js">
+ angular.module('customControl', ['ngSanitize']).
+ directive('contenteditable', ['$sce', function($sce) {
+ return {
+ restrict: 'A', // only activate on element attribute
+ require: '?ngModel', // get a hold of NgModelController
+ link: function(scope, element, attrs, ngModel) {
+ if (!ngModel) return; // do nothing if no ng-model
+
+ // Specify how UI should be updated
+ ngModel.$render = function() {
+ element.html($sce.getTrustedHtml(ngModel.$viewValue || ''));
+ };
+
+ // Listen for change events to enable binding
+ element.on('blur keyup change', function() {
+ scope.$evalAsync(read);
+ });
+ read(); // initialize
+
+ // Write data to the model
+ function read() {
+ var html = element.html();
+ // When we clear the content editable the browser leaves a <br> behind
+ // If strip-br attribute is provided then we strip this out
+ if ( attrs.stripBr && html == '<br>' ) {
+ html = '';
+ }
+ ngModel.$setViewValue(html);
+ }
+ }
+ };
+ }]);
+ </file>
+ <file name="index.html">
+ <form name="myForm">
+ <div contenteditable
+ name="myWidget" ng-model="userContent"
+ strip-br="true"
+ required>Change me!</div>
+ <span ng-show="myForm.myWidget.$error.required">Required!</span>
+ <hr>
+ <textarea ng-model="userContent" aria-label="Dynamic textarea"></textarea>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should data-bind and become invalid', function() {
+ if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') {
+ // SafariDriver can't handle contenteditable
+ // and Firefox driver can't clear contenteditables very well
+ return;
+ }
+ var contentEditable = element(by.css('[contenteditable]'));
+ var content = 'Change me!';
+
+ expect(contentEditable.getText()).toEqual(content);
+
+ contentEditable.clear();
+ contentEditable.sendKeys(protractor.Key.BACK_SPACE);
+ expect(contentEditable.getText()).toEqual('');
+ expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/);
+ });
+ </file>
+ * </example>
+ *
+ *
+ */
+var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$rootScope', '$q', '$interpolate',
+ function($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $rootScope, $q, $interpolate) {
+ this.$viewValue = Number.NaN;
+ this.$modelValue = Number.NaN;
+ this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity.
+ this.$validators = {};
+ this.$asyncValidators = {};
+ this.$parsers = [];
+ this.$formatters = [];
+ this.$viewChangeListeners = [];
+ this.$untouched = true;
+ this.$touched = false;
+ this.$pristine = true;
+ this.$dirty = false;
+ this.$valid = true;
+ this.$invalid = false;
+ this.$error = {}; // keep invalid keys here
+ this.$$success = {}; // keep valid keys here
+ this.$pending = undefined; // keep pending keys here
+ this.$name = $interpolate($attr.name || '', false)($scope);
+ this.$$parentForm = nullFormCtrl;
+
+ var parsedNgModel = $parse($attr.ngModel),
+ parsedNgModelAssign = parsedNgModel.assign,
+ ngModelGet = parsedNgModel,
+ ngModelSet = parsedNgModelAssign,
+ pendingDebounce = null,
+ parserValid,
+ ctrl = this;
+
+ this.$$setOptions = function(options) {
+ ctrl.$options = options;
+ if (options && options.getterSetter) {
+ var invokeModelGetter = $parse($attr.ngModel + '()'),
+ invokeModelSetter = $parse($attr.ngModel + '($$$p)');
+
+ ngModelGet = function($scope) {
+ var modelValue = parsedNgModel($scope);
+ if (isFunction(modelValue)) {
+ modelValue = invokeModelGetter($scope);
+ }
+ return modelValue;
+ };
+ ngModelSet = function($scope, newValue) {
+ if (isFunction(parsedNgModel($scope))) {
+ invokeModelSetter($scope, {$$$p: ctrl.$modelValue});
+ } else {
+ parsedNgModelAssign($scope, ctrl.$modelValue);
+ }
+ };
+ } else if (!parsedNgModel.assign) {
+ throw ngModelMinErr('nonassign', "Expression '{0}' is non-assignable. Element: {1}",
+ $attr.ngModel, startingTag($element));
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$render
+ *
+ * @description
+ * Called when the view needs to be updated. It is expected that the user of the ng-model
+ * directive will implement this method.
+ *
+ * The `$render()` method is invoked in the following situations:
+ *
+ * * `$rollbackViewValue()` is called. If we are rolling back the view value to the last
+ * committed value then `$render()` is called to update the input control.
+ * * The value referenced by `ng-model` is changed programmatically and both the `$modelValue` and
+ * the `$viewValue` are different from last time.
+ *
+ * Since `ng-model` does not do a deep watch, `$render()` is only invoked if the values of
+ * `$modelValue` and `$viewValue` are actually different from their previous value. If `$modelValue`
+ * or `$viewValue` are objects (rather than a string or number) then `$render()` will not be
+ * invoked if you only change a property on the objects.
+ */
+ this.$render = noop;
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$isEmpty
+ *
+ * @description
+ * This is called when we need to determine if the value of an input is empty.
+ *
+ * For instance, the required directive does this to work out if the input has data or not.
+ *
+ * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.
+ *
+ * You can override this for input directives whose concept of being empty is different from the
+ * default. The `checkboxInputType` directive does this because in its case a value of `false`
+ * implies empty.
+ *
+ * @param {*} value The value of the input to check for emptiness.
+ * @returns {boolean} True if `value` is "empty".
+ */
+ this.$isEmpty = function(value) {
+ return isUndefined(value) || value === '' || value === null || value !== value;
+ };
+
+ this.$$updateEmptyClasses = function(value) {
+ if (ctrl.$isEmpty(value)) {
+ $animate.removeClass($element, NOT_EMPTY_CLASS);
+ $animate.addClass($element, EMPTY_CLASS);
+ } else {
+ $animate.removeClass($element, EMPTY_CLASS);
+ $animate.addClass($element, NOT_EMPTY_CLASS);
+ }
+ };
+
+
+ var currentValidationRunId = 0;
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setValidity
+ *
+ * @description
+ * Change the validity state, and notify the form.
+ *
+ * This method can be called within $parsers/$formatters or a custom validation implementation.
+ * However, in most cases it should be sufficient to use the `ngModel.$validators` and
+ * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically.
+ *
+ * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned
+ * to either `$error[validationErrorKey]` or `$pending[validationErrorKey]`
+ * (for unfulfilled `$asyncValidators`), so that it is available for data-binding.
+ * The `validationErrorKey` should be in camelCase and will get converted into dash-case
+ * for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`
+ * class and can be bound to as `{{someForm.someControl.$error.myError}}` .
+ * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined),
+ * or skipped (null). Pending is used for unfulfilled `$asyncValidators`.
+ * Skipped is used by Angular when validators do not run because of parse errors and
+ * when `$asyncValidators` do not run because any of the `$validators` failed.
+ */
+ addSetValidityMethod({
+ ctrl: this,
+ $element: $element,
+ set: function(object, property) {
+ object[property] = true;
+ },
+ unset: function(object, property) {
+ delete object[property];
+ },
+ $animate: $animate
+ });
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setPristine
+ *
+ * @description
+ * Sets the control to its pristine state.
+ *
+ * This method can be called to remove the `ng-dirty` class and set the control to its pristine
+ * state (`ng-pristine` class). A model is considered to be pristine when the control
+ * has not been changed from when first compiled.
+ */
+ this.$setPristine = function() {
+ ctrl.$dirty = false;
+ ctrl.$pristine = true;
+ $animate.removeClass($element, DIRTY_CLASS);
+ $animate.addClass($element, PRISTINE_CLASS);
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setDirty
+ *
+ * @description
+ * Sets the control to its dirty state.
+ *
+ * This method can be called to remove the `ng-pristine` class and set the control to its dirty
+ * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed
+ * from when first compiled.
+ */
+ this.$setDirty = function() {
+ ctrl.$dirty = true;
+ ctrl.$pristine = false;
+ $animate.removeClass($element, PRISTINE_CLASS);
+ $animate.addClass($element, DIRTY_CLASS);
+ ctrl.$$parentForm.$setDirty();
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setUntouched
+ *
+ * @description
+ * Sets the control to its untouched state.
+ *
+ * This method can be called to remove the `ng-touched` class and set the control to its
+ * untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched
+ * by default, however this function can be used to restore that state if the model has
+ * already been touched by the user.
+ */
+ this.$setUntouched = function() {
+ ctrl.$touched = false;
+ ctrl.$untouched = true;
+ $animate.setClass($element, UNTOUCHED_CLASS, TOUCHED_CLASS);
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setTouched
+ *
+ * @description
+ * Sets the control to its touched state.
+ *
+ * This method can be called to remove the `ng-untouched` class and set the control to its
+ * touched state (`ng-touched` class). A model is considered to be touched when the user has
+ * first focused the control element and then shifted focus away from the control (blur event).
+ */
+ this.$setTouched = function() {
+ ctrl.$touched = true;
+ ctrl.$untouched = false;
+ $animate.setClass($element, TOUCHED_CLASS, UNTOUCHED_CLASS);
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$rollbackViewValue
+ *
+ * @description
+ * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`,
+ * which may be caused by a pending debounced event or because the input is waiting for a some
+ * future event.
+ *
+ * If you have an input that uses `ng-model-options` to set up debounced updates or updates that
+ * depend on special events such as blur, you can have a situation where there is a period when
+ * the `$viewValue` is out of sync with the ngModel's `$modelValue`.
+ *
+ * In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update
+ * and reset the input to the last committed view value.
+ *
+ * It is also possible that you run into difficulties if you try to update the ngModel's `$modelValue`
+ * programmatically before these debounced/future events have resolved/occurred, because Angular's
+ * dirty checking mechanism is not able to tell whether the model has actually changed or not.
+ *
+ * The `$rollbackViewValue()` method should be called before programmatically changing the model of an
+ * input which may have such events pending. This is important in order to make sure that the
+ * input field will be updated with the new model value and any pending operations are cancelled.
+ *
+ * <example name="ng-model-cancel-update" module="cancel-update-example">
+ * <file name="app.js">
+ * angular.module('cancel-update-example', [])
+ *
+ * .controller('CancelUpdateController', ['$scope', function($scope) {
+ * $scope.model = {};
+ *
+ * $scope.setEmpty = function(e, value, rollback) {
+ * if (e.keyCode == 27) {
+ * e.preventDefault();
+ * if (rollback) {
+ * $scope.myForm[value].$rollbackViewValue();
+ * }
+ * $scope.model[value] = '';
+ * }
+ * };
+ * }]);
+ * </file>
+ * <file name="index.html">
+ * <div ng-controller="CancelUpdateController">
+ * <p>Both of these inputs are only updated if they are blurred. Hitting escape should
+ * empty them. Follow these steps and observe the difference:</p>
+ * <ol>
+ * <li>Type something in the input. You will see that the model is not yet updated</li>
+ * <li>Press the Escape key.
+ * <ol>
+ * <li> In the first example, nothing happens, because the model is already '', and no
+ * update is detected. If you blur the input, the model will be set to the current view.
+ * </li>
+ * <li> In the second example, the pending update is cancelled, and the input is set back
+ * to the last committed view value (''). Blurring the input does nothing.
+ * </li>
+ * </ol>
+ * </li>
+ * </ol>
+ *
+ * <form name="myForm" ng-model-options="{ updateOn: 'blur' }">
+ * <div>
+ * <p id="inputDescription1">Without $rollbackViewValue():</p>
+ * <input name="value1" aria-describedby="inputDescription1" ng-model="model.value1"
+ * ng-keydown="setEmpty($event, 'value1')">
+ * value1: "{{ model.value1 }}"
+ * </div>
+ *
+ * <div>
+ * <p id="inputDescription2">With $rollbackViewValue():</p>
+ * <input name="value2" aria-describedby="inputDescription2" ng-model="model.value2"
+ * ng-keydown="setEmpty($event, 'value2', true)">
+ * value2: "{{ model.value2 }}"
+ * </div>
+ * </form>
+ * </div>
+ * </file>
+ <file name="style.css">
+ div {
+ display: table-cell;
+ }
+ div:nth-child(1) {
+ padding-right: 30px;
+ }
+
+ </file>
+ * </example>
+ */
+ this.$rollbackViewValue = function() {
+ $timeout.cancel(pendingDebounce);
+ ctrl.$viewValue = ctrl.$$lastCommittedViewValue;
+ ctrl.$render();
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$validate
+ *
+ * @description
+ * Runs each of the registered validators (first synchronous validators and then
+ * asynchronous validators).
+ * If the validity changes to invalid, the model will be set to `undefined`,
+ * unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.
+ * If the validity changes to valid, it will set the model to the last available valid
+ * `$modelValue`, i.e. either the last parsed value or the last value set from the scope.
+ */
+ this.$validate = function() {
+ // ignore $validate before model is initialized
+ if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {
+ return;
+ }
+
+ var viewValue = ctrl.$$lastCommittedViewValue;
+ // Note: we use the $$rawModelValue as $modelValue might have been
+ // set to undefined during a view -> model update that found validation
+ // errors. We can't parse the view here, since that could change
+ // the model although neither viewValue nor the model on the scope changed
+ var modelValue = ctrl.$$rawModelValue;
+
+ var prevValid = ctrl.$valid;
+ var prevModelValue = ctrl.$modelValue;
+
+ var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;
+
+ ctrl.$$runValidators(modelValue, viewValue, function(allValid) {
+ // If there was no change in validity, don't update the model
+ // This prevents changing an invalid modelValue to undefined
+ if (!allowInvalid && prevValid !== allValid) {
+ // Note: Don't check ctrl.$valid here, as we could have
+ // external validators (e.g. calculated on the server),
+ // that just call $setValidity and need the model value
+ // to calculate their validity.
+ ctrl.$modelValue = allValid ? modelValue : undefined;
+
+ if (ctrl.$modelValue !== prevModelValue) {
+ ctrl.$$writeModelToScope();
+ }
+ }
+ });
+
+ };
+
+ this.$$runValidators = function(modelValue, viewValue, doneCallback) {
+ currentValidationRunId++;
+ var localValidationRunId = currentValidationRunId;
+
+ // check parser error
+ if (!processParseErrors()) {
+ validationDone(false);
+ return;
+ }
+ if (!processSyncValidators()) {
+ validationDone(false);
+ return;
+ }
+ processAsyncValidators();
+
+ function processParseErrors() {
+ var errorKey = ctrl.$$parserName || 'parse';
+ if (isUndefined(parserValid)) {
+ setValidity(errorKey, null);
+ } else {
+ if (!parserValid) {
+ forEach(ctrl.$validators, function(v, name) {
+ setValidity(name, null);
+ });
+ forEach(ctrl.$asyncValidators, function(v, name) {
+ setValidity(name, null);
+ });
+ }
+ // Set the parse error last, to prevent unsetting it, should a $validators key == parserName
+ setValidity(errorKey, parserValid);
+ return parserValid;
+ }
+ return true;
+ }
+
+ function processSyncValidators() {
+ var syncValidatorsValid = true;
+ forEach(ctrl.$validators, function(validator, name) {
+ var result = validator(modelValue, viewValue);
+ syncValidatorsValid = syncValidatorsValid && result;
+ setValidity(name, result);
+ });
+ if (!syncValidatorsValid) {
+ forEach(ctrl.$asyncValidators, function(v, name) {
+ setValidity(name, null);
+ });
+ return false;
+ }
+ return true;
+ }
+
+ function processAsyncValidators() {
+ var validatorPromises = [];
+ var allValid = true;
+ forEach(ctrl.$asyncValidators, function(validator, name) {
+ var promise = validator(modelValue, viewValue);
+ if (!isPromiseLike(promise)) {
+ throw ngModelMinErr('nopromise',
+ "Expected asynchronous validator to return a promise but got '{0}' instead.", promise);
+ }
+ setValidity(name, undefined);
+ validatorPromises.push(promise.then(function() {
+ setValidity(name, true);
+ }, function(error) {
+ allValid = false;
+ setValidity(name, false);
+ }));
+ });
+ if (!validatorPromises.length) {
+ validationDone(true);
+ } else {
+ $q.all(validatorPromises).then(function() {
+ validationDone(allValid);
+ }, noop);
+ }
+ }
+
+ function setValidity(name, isValid) {
+ if (localValidationRunId === currentValidationRunId) {
+ ctrl.$setValidity(name, isValid);
+ }
+ }
+
+ function validationDone(allValid) {
+ if (localValidationRunId === currentValidationRunId) {
+
+ doneCallback(allValid);
+ }
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$commitViewValue
+ *
+ * @description
+ * Commit a pending update to the `$modelValue`.
+ *
+ * Updates may be pending by a debounced event or because the input is waiting for a some future
+ * event defined in `ng-model-options`. this method is rarely needed as `NgModelController`
+ * usually handles calling this in response to input events.
+ */
+ this.$commitViewValue = function() {
+ var viewValue = ctrl.$viewValue;
+
+ $timeout.cancel(pendingDebounce);
+
+ // If the view value has not changed then we should just exit, except in the case where there is
+ // a native validator on the element. In this case the validation state may have changed even though
+ // the viewValue has stayed empty.
+ if (ctrl.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !ctrl.$$hasNativeValidators)) {
+ return;
+ }
+ ctrl.$$updateEmptyClasses(viewValue);
+ ctrl.$$lastCommittedViewValue = viewValue;
+
+ // change to dirty
+ if (ctrl.$pristine) {
+ this.$setDirty();
+ }
+ this.$$parseAndValidate();
+ };
+
+ this.$$parseAndValidate = function() {
+ var viewValue = ctrl.$$lastCommittedViewValue;
+ var modelValue = viewValue;
+ parserValid = isUndefined(modelValue) ? undefined : true;
+
+ if (parserValid) {
+ for (var i = 0; i < ctrl.$parsers.length; i++) {
+ modelValue = ctrl.$parsers[i](modelValue);
+ if (isUndefined(modelValue)) {
+ parserValid = false;
+ break;
+ }
+ }
+ }
+ if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {
+ // ctrl.$modelValue has not been touched yet...
+ ctrl.$modelValue = ngModelGet($scope);
+ }
+ var prevModelValue = ctrl.$modelValue;
+ var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;
+ ctrl.$$rawModelValue = modelValue;
+
+ if (allowInvalid) {
+ ctrl.$modelValue = modelValue;
+ writeToModelIfNeeded();
+ }
+
+ // Pass the $$lastCommittedViewValue here, because the cached viewValue might be out of date.
+ // This can happen if e.g. $setViewValue is called from inside a parser
+ ctrl.$$runValidators(modelValue, ctrl.$$lastCommittedViewValue, function(allValid) {
+ if (!allowInvalid) {
+ // Note: Don't check ctrl.$valid here, as we could have
+ // external validators (e.g. calculated on the server),
+ // that just call $setValidity and need the model value
+ // to calculate their validity.
+ ctrl.$modelValue = allValid ? modelValue : undefined;
+ writeToModelIfNeeded();
+ }
+ });
+
+ function writeToModelIfNeeded() {
+ if (ctrl.$modelValue !== prevModelValue) {
+ ctrl.$$writeModelToScope();
+ }
+ }
+ };
+
+ this.$$writeModelToScope = function() {
+ ngModelSet($scope, ctrl.$modelValue);
+ forEach(ctrl.$viewChangeListeners, function(listener) {
+ try {
+ listener();
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setViewValue
+ *
+ * @description
+ * Update the view value.
+ *
+ * This method should be called when a control wants to change the view value; typically,
+ * this is done from within a DOM event handler. For example, the {@link ng.directive:input input}
+ * directive calls it when the value of the input changes and {@link ng.directive:select select}
+ * calls it when an option is selected.
+ *
+ * When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers`
+ * and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged
+ * value sent directly for processing, finally to be applied to `$modelValue` and then the
+ * **expression** specified in the `ng-model` attribute. Lastly, all the registered change listeners,
+ * in the `$viewChangeListeners` list, are called.
+ *
+ * In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn`
+ * and the `default` trigger is not listed, all those actions will remain pending until one of the
+ * `updateOn` events is triggered on the DOM element.
+ * All these actions will be debounced if the {@link ng.directive:ngModelOptions ngModelOptions}
+ * directive is used with a custom debounce for this particular event.
+ * Note that a `$digest` is only triggered once the `updateOn` events are fired, or if `debounce`
+ * is specified, once the timer runs out.
+ *
+ * When used with standard inputs, the view value will always be a string (which is in some cases
+ * parsed into another type, such as a `Date` object for `input[date]`.)
+ * However, custom controls might also pass objects to this method. In this case, we should make
+ * a copy of the object before passing it to `$setViewValue`. This is because `ngModel` does not
+ * perform a deep watch of objects, it only looks for a change of identity. If you only change
+ * the property of the object then ngModel will not realize that the object has changed and
+ * will not invoke the `$parsers` and `$validators` pipelines. For this reason, you should
+ * not change properties of the copy once it has been passed to `$setViewValue`.
+ * Otherwise you may cause the model value on the scope to change incorrectly.
+ *
+ * <div class="alert alert-info">
+ * In any case, the value passed to the method should always reflect the current value
+ * of the control. For example, if you are calling `$setViewValue` for an input element,
+ * you should pass the input DOM value. Otherwise, the control and the scope model become
+ * out of sync. It's also important to note that `$setViewValue` does not call `$render` or change
+ * the control's DOM value in any way. If we want to change the control's DOM value
+ * programmatically, we should update the `ngModel` scope expression. Its new value will be
+ * picked up by the model controller, which will run it through the `$formatters`, `$render` it
+ * to update the DOM, and finally call `$validate` on it.
+ * </div>
+ *
+ * @param {*} value value from the view.
+ * @param {string} trigger Event that triggered the update.
+ */
+ this.$setViewValue = function(value, trigger) {
+ ctrl.$viewValue = value;
+ if (!ctrl.$options || ctrl.$options.updateOnDefault) {
+ ctrl.$$debounceViewValueCommit(trigger);
+ }
+ };
+
+ this.$$debounceViewValueCommit = function(trigger) {
+ var debounceDelay = 0,
+ options = ctrl.$options,
+ debounce;
+
+ if (options && isDefined(options.debounce)) {
+ debounce = options.debounce;
+ if (isNumber(debounce)) {
+ debounceDelay = debounce;
+ } else if (isNumber(debounce[trigger])) {
+ debounceDelay = debounce[trigger];
+ } else if (isNumber(debounce['default'])) {
+ debounceDelay = debounce['default'];
+ }
+ }
+
+ $timeout.cancel(pendingDebounce);
+ if (debounceDelay) {
+ pendingDebounce = $timeout(function() {
+ ctrl.$commitViewValue();
+ }, debounceDelay);
+ } else if ($rootScope.$$phase) {
+ ctrl.$commitViewValue();
+ } else {
+ $scope.$apply(function() {
+ ctrl.$commitViewValue();
+ });
+ }
+ };
+
+ // model -> value
+ // Note: we cannot use a normal scope.$watch as we want to detect the following:
+ // 1. scope value is 'a'
+ // 2. user enters 'b'
+ // 3. ng-change kicks in and reverts scope value to 'a'
+ // -> scope value did not change since the last digest as
+ // ng-change executes in apply phase
+ // 4. view should be changed back to 'a'
+ $scope.$watch(function ngModelWatch() {
+ var modelValue = ngModelGet($scope);
+
+ // if scope model value and ngModel value are out of sync
+ // TODO(perf): why not move this to the action fn?
+ if (modelValue !== ctrl.$modelValue &&
+ // checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator
+ (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue)
+ ) {
+ ctrl.$modelValue = ctrl.$$rawModelValue = modelValue;
+ parserValid = undefined;
+
+ var formatters = ctrl.$formatters,
+ idx = formatters.length;
+
+ var viewValue = modelValue;
+ while (idx--) {
+ viewValue = formatters[idx](viewValue);
+ }
+ if (ctrl.$viewValue !== viewValue) {
+ ctrl.$$updateEmptyClasses(viewValue);
+ ctrl.$viewValue = ctrl.$$lastCommittedViewValue = viewValue;
+ ctrl.$render();
+
+ ctrl.$$runValidators(modelValue, viewValue, noop);
+ }
+ }
+
+ return modelValue;
+ });
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngModel
+ *
+ * @element input
+ * @priority 1
+ *
+ * @description
+ * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a
+ * property on the scope using {@link ngModel.NgModelController NgModelController},
+ * which is created and exposed by this directive.
+ *
+ * `ngModel` is responsible for:
+ *
+ * - Binding the view into the model, which other directives such as `input`, `textarea` or `select`
+ * require.
+ * - Providing validation behavior (i.e. required, number, email, url).
+ * - Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors).
+ * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`,
+ * `ng-untouched`, `ng-empty`, `ng-not-empty`) including animations.
+ * - Registering the control with its parent {@link ng.directive:form form}.
+ *
+ * Note: `ngModel` will try to bind to the property given by evaluating the expression on the
+ * current scope. If the property doesn't already exist on this scope, it will be created
+ * implicitly and added to the scope.
+ *
+ * For best practices on using `ngModel`, see:
+ *
+ * - [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes)
+ *
+ * For basic examples, how to use `ngModel`, see:
+ *
+ * - {@link ng.directive:input input}
+ * - {@link input[text] text}
+ * - {@link input[checkbox] checkbox}
+ * - {@link input[radio] radio}
+ * - {@link input[number] number}
+ * - {@link input[email] email}
+ * - {@link input[url] url}
+ * - {@link input[date] date}
+ * - {@link input[datetime-local] datetime-local}
+ * - {@link input[time] time}
+ * - {@link input[month] month}
+ * - {@link input[week] week}
+ * - {@link ng.directive:select select}
+ * - {@link ng.directive:textarea textarea}
+ *
+ * # Complex Models (objects or collections)
+ *
+ * By default, `ngModel` watches the model by reference, not value. This is important to know when
+ * binding inputs to models that are objects (e.g. `Date`) or collections (e.g. arrays). If only properties of the
+ * object or collection change, `ngModel` will not be notified and so the input will not be re-rendered.
+ *
+ * The model must be assigned an entirely new object or collection before a re-rendering will occur.
+ *
+ * Some directives have options that will cause them to use a custom `$watchCollection` on the model expression
+ * - for example, `ngOptions` will do so when a `track by` clause is included in the comprehension expression or
+ * if the select is given the `multiple` attribute.
+ *
+ * The `$watchCollection()` method only does a shallow comparison, meaning that changing properties deeper than the
+ * first level of the object (or only changing the properties of an item in the collection if it's an array) will still
+ * not trigger a re-rendering of the model.
+ *
+ * # CSS classes
+ * The following CSS classes are added and removed on the associated input/select/textarea element
+ * depending on the validity of the model.
+ *
+ * - `ng-valid`: the model is valid
+ * - `ng-invalid`: the model is invalid
+ * - `ng-valid-[key]`: for each valid key added by `$setValidity`
+ * - `ng-invalid-[key]`: for each invalid key added by `$setValidity`
+ * - `ng-pristine`: the control hasn't been interacted with yet
+ * - `ng-dirty`: the control has been interacted with
+ * - `ng-touched`: the control has been blurred
+ * - `ng-untouched`: the control hasn't been blurred
+ * - `ng-pending`: any `$asyncValidators` are unfulfilled
+ * - `ng-empty`: the view does not contain a value or the value is deemed "empty", as defined
+ * by the {@link ngModel.NgModelController#$isEmpty} method
+ * - `ng-not-empty`: the view contains a non-empty value
+ *
+ * Keep in mind that ngAnimate can detect each of these classes when added and removed.
+ *
+ * ## Animation Hooks
+ *
+ * Animations within models are triggered when any of the associated CSS classes are added and removed
+ * on the input element which is attached to the model. These classes include: `.ng-pristine`, `.ng-dirty`,
+ * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.
+ * The animations that are triggered within ngModel are similar to how they work in ngClass and
+ * animations can be hooked into using CSS transitions, keyframes as well as JS animations.
+ *
+ * The following example shows a simple way to utilize CSS transitions to style an input element
+ * that has been rendered as invalid after it has been validated:
+ *
+ * <pre>
+ * //be sure to include ngAnimate as a module to hook into more
+ * //advanced animations
+ * .my-input {
+ * transition:0.5s linear all;
+ * background: white;
+ * }
+ * .my-input.ng-invalid {
+ * background: red;
+ * color:white;
+ * }
+ * </pre>
+ *
+ * @example
+ * <example deps="angular-animate.js" animations="true" fixBase="true" module="inputExample">
+ <file name="index.html">
+ <script>
+ angular.module('inputExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.val = '1';
+ }]);
+ </script>
+ <style>
+ .my-input {
+ transition:all linear 0.5s;
+ background: transparent;
+ }
+ .my-input.ng-invalid {
+ color:white;
+ background: red;
+ }
+ </style>
+ <p id="inputDescription">
+ Update input to see transitions when valid/invalid.
+ Integer is a valid value.
+ </p>
+ <form name="testForm" ng-controller="ExampleController">
+ <input ng-model="val" ng-pattern="/^\d+$/" name="anim" class="my-input"
+ aria-describedby="inputDescription" />
+ </form>
+ </file>
+ * </example>
+ *
+ * ## Binding to a getter/setter
+ *
+ * Sometimes it's helpful to bind `ngModel` to a getter/setter function. A getter/setter is a
+ * function that returns a representation of the model when called with zero arguments, and sets
+ * the internal state of a model when called with an argument. It's sometimes useful to use this
+ * for models that have an internal representation that's different from what the model exposes
+ * to the view.
+ *
+ * <div class="alert alert-success">
+ * **Best Practice:** It's best to keep getters fast because Angular is likely to call them more
+ * frequently than other parts of your code.
+ * </div>
+ *
+ * You use this behavior by adding `ng-model-options="{ getterSetter: true }"` to an element that
+ * has `ng-model` attached to it. You can also add `ng-model-options="{ getterSetter: true }"` to
+ * a `<form>`, which will enable this behavior for all `<input>`s within it. See
+ * {@link ng.directive:ngModelOptions `ngModelOptions`} for more.
+ *
+ * The following example shows how to use `ngModel` with a getter/setter:
+ *
+ * @example
+ * <example name="ngModel-getter-setter" module="getterSetterExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form name="userForm">
+ <label>Name:
+ <input type="text" name="userName"
+ ng-model="user.name"
+ ng-model-options="{ getterSetter: true }" />
+ </label>
+ </form>
+ <pre>user.name = <span ng-bind="user.name()"></span></pre>
+ </div>
+ </file>
+ <file name="app.js">
+ angular.module('getterSetterExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ var _name = 'Brian';
+ $scope.user = {
+ name: function(newName) {
+ // Note that newName can be undefined for two reasons:
+ // 1. Because it is called as a getter and thus called with no arguments
+ // 2. Because the property should actually be set to undefined. This happens e.g. if the
+ // input is invalid
+ return arguments.length ? (_name = newName) : _name;
+ }
+ };
+ }]);
+ </file>
+ * </example>
+ */
+var ngModelDirective = ['$rootScope', function($rootScope) {
+ return {
+ restrict: 'A',
+ require: ['ngModel', '^?form', '^?ngModelOptions'],
+ controller: NgModelController,
+ // Prelink needs to run before any input directive
+ // so that we can set the NgModelOptions in NgModelController
+ // before anyone else uses it.
+ priority: 1,
+ compile: function ngModelCompile(element) {
+ // Setup initial state of the control
+ element.addClass(PRISTINE_CLASS).addClass(UNTOUCHED_CLASS).addClass(VALID_CLASS);
+
+ return {
+ pre: function ngModelPreLink(scope, element, attr, ctrls) {
+ var modelCtrl = ctrls[0],
+ formCtrl = ctrls[1] || modelCtrl.$$parentForm;
+
+ modelCtrl.$$setOptions(ctrls[2] && ctrls[2].$options);
+
+ // notify others, especially parent forms
+ formCtrl.$addControl(modelCtrl);
+
+ attr.$observe('name', function(newValue) {
+ if (modelCtrl.$name !== newValue) {
+ modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue);
+ }
+ });
+
+ scope.$on('$destroy', function() {
+ modelCtrl.$$parentForm.$removeControl(modelCtrl);
+ });
+ },
+ post: function ngModelPostLink(scope, element, attr, ctrls) {
+ var modelCtrl = ctrls[0];
+ if (modelCtrl.$options && modelCtrl.$options.updateOn) {
+ element.on(modelCtrl.$options.updateOn, function(ev) {
+ modelCtrl.$$debounceViewValueCommit(ev && ev.type);
+ });
+ }
+
+ element.on('blur', function(ev) {
+ if (modelCtrl.$touched) return;
+
+ if ($rootScope.$$phase) {
+ scope.$evalAsync(modelCtrl.$setTouched);
+ } else {
+ scope.$apply(modelCtrl.$setTouched);
+ }
+ });
+ }
+ };
+ }
+ };
+}];
+
+var DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/;
+
+/**
+ * @ngdoc directive
+ * @name ngModelOptions
+ *
+ * @description
+ * Allows tuning how model updates are done. Using `ngModelOptions` you can specify a custom list of
+ * events that will trigger a model update and/or a debouncing delay so that the actual update only
+ * takes place when a timer expires; this timer will be reset after another change takes place.
+ *
+ * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might
+ * be different from the value in the actual model. This means that if you update the model you
+ * should also invoke {@link ngModel.NgModelController `$rollbackViewValue`} on the relevant input field in
+ * order to make sure it is synchronized with the model and that any debounced action is canceled.
+ *
+ * The easiest way to reference the control's {@link ngModel.NgModelController `$rollbackViewValue`}
+ * method is by making sure the input is placed inside a form that has a `name` attribute. This is
+ * important because `form` controllers are published to the related scope under the name in their
+ * `name` attribute.
+ *
+ * Any pending changes will take place immediately when an enclosing form is submitted via the
+ * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`
+ * to have access to the updated model.
+ *
+ * `ngModelOptions` has an effect on the element it's declared on and its descendants.
+ *
+ * @param {Object} ngModelOptions options to apply to the current model. Valid keys are:
+ * - `updateOn`: string specifying which event should the input be bound to. You can set several
+ * events using an space delimited list. There is a special event called `default` that
+ * matches the default events belonging of the control.
+ * - `debounce`: integer value which contains the debounce model update value in milliseconds. A
+ * value of 0 triggers an immediate update. If an object is supplied instead, you can specify a
+ * custom value for each event. For example:
+ * `ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 500, 'blur': 0 } }"`
+ * - `allowInvalid`: boolean value which indicates that the model can be set with values that did
+ * not validate correctly instead of the default behavior of setting the model to undefined.
+ * - `getterSetter`: boolean value which determines whether or not to treat functions bound to
+ `ngModel` as getters/setters.
+ * - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for
+ * `<input type="date">`, `<input type="time">`, ... . It understands UTC/GMT and the
+ * continental US time zone abbreviations, but for general use, use a time zone offset, for
+ * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
+ * If not specified, the timezone of the browser will be used.
+ *
+ * @example
+
+ The following example shows how to override immediate updates. Changes on the inputs within the
+ form will update the model only when the control loses focus (blur event). If `escape` key is
+ pressed while the input field is focused, the value is reset to the value in the current model.
+
+ <example name="ngModelOptions-directive-blur" module="optionsExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form name="userForm">
+ <label>Name:
+ <input type="text" name="userName"
+ ng-model="user.name"
+ ng-model-options="{ updateOn: 'blur' }"
+ ng-keyup="cancel($event)" />
+ </label><br />
+ <label>Other data:
+ <input type="text" ng-model="user.data" />
+ </label><br />
+ </form>
+ <pre>user.name = <span ng-bind="user.name"></span></pre>
+ <pre>user.data = <span ng-bind="user.data"></span></pre>
+ </div>
+ </file>
+ <file name="app.js">
+ angular.module('optionsExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.user = { name: 'John', data: '' };
+
+ $scope.cancel = function(e) {
+ if (e.keyCode == 27) {
+ $scope.userForm.userName.$rollbackViewValue();
+ }
+ };
+ }]);
+ </file>
+ <file name="protractor.js" type="protractor">
+ var model = element(by.binding('user.name'));
+ var input = element(by.model('user.name'));
+ var other = element(by.model('user.data'));
+
+ it('should allow custom events', function() {
+ input.sendKeys(' Doe');
+ input.click();
+ expect(model.getText()).toEqual('John');
+ other.click();
+ expect(model.getText()).toEqual('John Doe');
+ });
+
+ it('should $rollbackViewValue when model changes', function() {
+ input.sendKeys(' Doe');
+ expect(input.getAttribute('value')).toEqual('John Doe');
+ input.sendKeys(protractor.Key.ESCAPE);
+ expect(input.getAttribute('value')).toEqual('John');
+ other.click();
+ expect(model.getText()).toEqual('John');
+ });
+ </file>
+ </example>
+
+ This one shows how to debounce model changes. Model will be updated only 1 sec after last change.
+ If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.
+
+ <example name="ngModelOptions-directive-debounce" module="optionsExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form name="userForm">
+ <label>Name:
+ <input type="text" name="userName"
+ ng-model="user.name"
+ ng-model-options="{ debounce: 1000 }" />
+ </label>
+ <button ng-click="userForm.userName.$rollbackViewValue(); user.name=''">Clear</button>
+ <br />
+ </form>
+ <pre>user.name = <span ng-bind="user.name"></span></pre>
+ </div>
+ </file>
+ <file name="app.js">
+ angular.module('optionsExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.user = { name: 'Igor' };
+ }]);
+ </file>
+ </example>
+
+ This one shows how to bind to getter/setters:
+
+ <example name="ngModelOptions-directive-getter-setter" module="getterSetterExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form name="userForm">
+ <label>Name:
+ <input type="text" name="userName"
+ ng-model="user.name"
+ ng-model-options="{ getterSetter: true }" />
+ </label>
+ </form>
+ <pre>user.name = <span ng-bind="user.name()"></span></pre>
+ </div>
+ </file>
+ <file name="app.js">
+ angular.module('getterSetterExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ var _name = 'Brian';
+ $scope.user = {
+ name: function(newName) {
+ // Note that newName can be undefined for two reasons:
+ // 1. Because it is called as a getter and thus called with no arguments
+ // 2. Because the property should actually be set to undefined. This happens e.g. if the
+ // input is invalid
+ return arguments.length ? (_name = newName) : _name;
+ }
+ };
+ }]);
+ </file>
+ </example>
+ */
+var ngModelOptionsDirective = function() {
+ return {
+ restrict: 'A',
+ controller: ['$scope', '$attrs', function($scope, $attrs) {
+ var that = this;
+ this.$options = copy($scope.$eval($attrs.ngModelOptions));
+ // Allow adding/overriding bound events
+ if (isDefined(this.$options.updateOn)) {
+ this.$options.updateOnDefault = false;
+ // extract "default" pseudo-event from list of events that can trigger a model update
+ this.$options.updateOn = trim(this.$options.updateOn.replace(DEFAULT_REGEXP, function() {
+ that.$options.updateOnDefault = true;
+ return ' ';
+ }));
+ } else {
+ this.$options.updateOnDefault = true;
+ }
+ }]
+ };
+};
+
+
+
+// helper methods
+function addSetValidityMethod(context) {
+ var ctrl = context.ctrl,
+ $element = context.$element,
+ classCache = {},
+ set = context.set,
+ unset = context.unset,
+ $animate = context.$animate;
+
+ classCache[INVALID_CLASS] = !(classCache[VALID_CLASS] = $element.hasClass(VALID_CLASS));
+
+ ctrl.$setValidity = setValidity;
+
+ function setValidity(validationErrorKey, state, controller) {
+ if (isUndefined(state)) {
+ createAndSet('$pending', validationErrorKey, controller);
+ } else {
+ unsetAndCleanup('$pending', validationErrorKey, controller);
+ }
+ if (!isBoolean(state)) {
+ unset(ctrl.$error, validationErrorKey, controller);
+ unset(ctrl.$$success, validationErrorKey, controller);
+ } else {
+ if (state) {
+ unset(ctrl.$error, validationErrorKey, controller);
+ set(ctrl.$$success, validationErrorKey, controller);
+ } else {
+ set(ctrl.$error, validationErrorKey, controller);
+ unset(ctrl.$$success, validationErrorKey, controller);
+ }
+ }
+ if (ctrl.$pending) {
+ cachedToggleClass(PENDING_CLASS, true);
+ ctrl.$valid = ctrl.$invalid = undefined;
+ toggleValidationCss('', null);
+ } else {
+ cachedToggleClass(PENDING_CLASS, false);
+ ctrl.$valid = isObjectEmpty(ctrl.$error);
+ ctrl.$invalid = !ctrl.$valid;
+ toggleValidationCss('', ctrl.$valid);
+ }
+
+ // re-read the state as the set/unset methods could have
+ // combined state in ctrl.$error[validationError] (used for forms),
+ // where setting/unsetting only increments/decrements the value,
+ // and does not replace it.
+ var combinedState;
+ if (ctrl.$pending && ctrl.$pending[validationErrorKey]) {
+ combinedState = undefined;
+ } else if (ctrl.$error[validationErrorKey]) {
+ combinedState = false;
+ } else if (ctrl.$$success[validationErrorKey]) {
+ combinedState = true;
+ } else {
+ combinedState = null;
+ }
+
+ toggleValidationCss(validationErrorKey, combinedState);
+ ctrl.$$parentForm.$setValidity(validationErrorKey, combinedState, ctrl);
+ }
+
+ function createAndSet(name, value, controller) {
+ if (!ctrl[name]) {
+ ctrl[name] = {};
+ }
+ set(ctrl[name], value, controller);
+ }
+
+ function unsetAndCleanup(name, value, controller) {
+ if (ctrl[name]) {
+ unset(ctrl[name], value, controller);
+ }
+ if (isObjectEmpty(ctrl[name])) {
+ ctrl[name] = undefined;
+ }
+ }
+
+ function cachedToggleClass(className, switchValue) {
+ if (switchValue && !classCache[className]) {
+ $animate.addClass($element, className);
+ classCache[className] = true;
+ } else if (!switchValue && classCache[className]) {
+ $animate.removeClass($element, className);
+ classCache[className] = false;
+ }
+ }
+
+ function toggleValidationCss(validationErrorKey, isValid) {
+ validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
+
+ cachedToggleClass(VALID_CLASS + validationErrorKey, isValid === true);
+ cachedToggleClass(INVALID_CLASS + validationErrorKey, isValid === false);
+ }
+}
+
+function isObjectEmpty(obj) {
+ if (obj) {
+ for (var prop in obj) {
+ if (obj.hasOwnProperty(prop)) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+/**
+ * @ngdoc directive
+ * @name ngNonBindable
+ * @restrict AC
+ * @priority 1000
+ *
+ * @description
+ * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current
+ * DOM element. This is useful if the element contains what appears to be Angular directives and
+ * bindings but which should be ignored by Angular. This could be the case if you have a site that
+ * displays snippets of code, for instance.
+ *
+ * @element ANY
+ *
+ * @example
+ * In this example there are two locations where a simple interpolation binding (`{{}}`) is present,
+ * but the one wrapped in `ngNonBindable` is left alone.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <div>Normal: {{1 + 2}}</div>
+ <div ng-non-bindable>Ignored: {{1 + 2}}</div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-non-bindable', function() {
+ expect(element(by.binding('1 + 2')).getText()).toContain('3');
+ expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/);
+ });
+ </file>
+ </example>
+ */
+var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
+
+/* global jqLiteRemove */
+
+var ngOptionsMinErr = minErr('ngOptions');
+
+/**
+ * @ngdoc directive
+ * @name ngOptions
+ * @restrict A
+ *
+ * @description
+ *
+ * The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
+ * elements for the `<select>` element using the array or object obtained by evaluating the
+ * `ngOptions` comprehension expression.
+ *
+ * In many cases, `ngRepeat` can be used on `<option>` elements instead of `ngOptions` to achieve a
+ * similar result. However, `ngOptions` provides some benefits such as reducing memory and
+ * increasing speed by not creating a new scope for each repeated instance, as well as providing
+ * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the
+ * comprehension expression. `ngOptions` should be used when the `<select>` model needs to be bound
+ * to a non-string value. This is because an option element can only be bound to string values at
+ * present.
+ *
+ * When an item in the `<select>` menu is selected, the array element or object property
+ * represented by the selected option will be bound to the model identified by the `ngModel`
+ * directive.
+ *
+ * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can
+ * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
+ * option. See example below for demonstration.
+ *
+ * ## Complex Models (objects or collections)
+ *
+ * By default, `ngModel` watches the model by reference, not value. This is important to know when
+ * binding the select to a model that is an object or a collection.
+ *
+ * One issue occurs if you want to preselect an option. For example, if you set
+ * the model to an object that is equal to an object in your collection, `ngOptions` won't be able to set the selection,
+ * because the objects are not identical. So by default, you should always reference the item in your collection
+ * for preselections, e.g.: `$scope.selected = $scope.collection[3]`.
+ *
+ * Another solution is to use a `track by` clause, because then `ngOptions` will track the identity
+ * of the item not by reference, but by the result of the `track by` expression. For example, if your
+ * collection items have an id property, you would `track by item.id`.
+ *
+ * A different issue with objects or collections is that ngModel won't detect if an object property or
+ * a collection item changes. For that reason, `ngOptions` additionally watches the model using
+ * `$watchCollection`, when the expression contains a `track by` clause or the the select has the `multiple` attribute.
+ * This allows ngOptions to trigger a re-rendering of the options even if the actual object/collection
+ * has not changed identity, but only a property on the object or an item in the collection changes.
+ *
+ * Note that `$watchCollection` does a shallow comparison of the properties of the object (or the items in the collection
+ * if the model is an array). This means that changing a property deeper than the first level inside the
+ * object/collection will not trigger a re-rendering.
+ *
+ * ## `select` **`as`**
+ *
+ * Using `select` **`as`** will bind the result of the `select` expression to the model, but
+ * the value of the `<select>` and `<option>` html elements will be either the index (for array data sources)
+ * or property name (for object data sources) of the value within the collection. If a **`track by`** expression
+ * is used, the result of that expression will be set as the value of the `option` and `select` elements.
+ *
+ *
+ * ### `select` **`as`** and **`track by`**
+ *
+ * <div class="alert alert-warning">
+ * Be careful when using `select` **`as`** and **`track by`** in the same expression.
+ * </div>
+ *
+ * Given this array of items on the $scope:
+ *
+ * ```js
+ * $scope.items = [{
+ * id: 1,
+ * label: 'aLabel',
+ * subItem: { name: 'aSubItem' }
+ * }, {
+ * id: 2,
+ * label: 'bLabel',
+ * subItem: { name: 'bSubItem' }
+ * }];
+ * ```
+ *
+ * This will work:
+ *
+ * ```html
+ * <select ng-options="item as item.label for item in items track by item.id" ng-model="selected"></select>
+ * ```
+ * ```js
+ * $scope.selected = $scope.items[0];
+ * ```
+ *
+ * but this will not work:
+ *
+ * ```html
+ * <select ng-options="item.subItem as item.label for item in items track by item.id" ng-model="selected"></select>
+ * ```
+ * ```js
+ * $scope.selected = $scope.items[0].subItem;
+ * ```
+ *
+ * In both examples, the **`track by`** expression is applied successfully to each `item` in the
+ * `items` array. Because the selected option has been set programmatically in the controller, the
+ * **`track by`** expression is also applied to the `ngModel` value. In the first example, the
+ * `ngModel` value is `items[0]` and the **`track by`** expression evaluates to `items[0].id` with
+ * no issue. In the second example, the `ngModel` value is `items[0].subItem` and the **`track by`**
+ * expression evaluates to `items[0].subItem.id` (which is undefined). As a result, the model value
+ * is not matched against any `<option>` and the `<select>` appears as having no selected value.
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required The control is considered valid only if value is entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {comprehension_expression=} ngOptions in one of the following forms:
+ *
+ * * for array data sources:
+ * * `label` **`for`** `value` **`in`** `array`
+ * * `select` **`as`** `label` **`for`** `value` **`in`** `array`
+ * * `label` **`group by`** `group` **`for`** `value` **`in`** `array`
+ * * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array`
+ * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
+ * * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
+ * * `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr`
+ * (for including a filter with `track by`)
+ * * for object data sources:
+ * * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+ * * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+ * * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`
+ * * `label` **`disable when`** `disable` **`for (`**`key`**`,`** `value`**`) in`** `object`
+ * * `select` **`as`** `label` **`group by`** `group`
+ * **`for` `(`**`key`**`,`** `value`**`) in`** `object`
+ * * `select` **`as`** `label` **`disable when`** `disable`
+ * **`for` `(`**`key`**`,`** `value`**`) in`** `object`
+ *
+ * Where:
+ *
+ * * `array` / `object`: an expression which evaluates to an array / object to iterate over.
+ * * `value`: local variable which will refer to each item in the `array` or each property value
+ * of `object` during iteration.
+ * * `key`: local variable which will refer to a property name in `object` during iteration.
+ * * `label`: The result of this expression will be the label for `<option>` element. The
+ * `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).
+ * * `select`: The result of this expression will be bound to the model of the parent `<select>`
+ * element. If not specified, `select` expression will default to `value`.
+ * * `group`: The result of this expression will be used to group options using the `<optgroup>`
+ * DOM element.
+ * * `disable`: The result of this expression will be used to disable the rendered `<option>`
+ * element. Return `true` to disable.
+ * * `trackexpr`: Used when working with an array of objects. The result of this expression will be
+ * used to identify the objects in the array. The `trackexpr` will most likely refer to the
+ * `value` variable (e.g. `value.propertyName`). With this the selection is preserved
+ * even when the options are recreated (e.g. reloaded from the server).
+ *
+ * @example
+ <example module="selectExample">
+ <file name="index.html">
+ <script>
+ angular.module('selectExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.colors = [
+ {name:'black', shade:'dark'},
+ {name:'white', shade:'light', notAnOption: true},
+ {name:'red', shade:'dark'},
+ {name:'blue', shade:'dark', notAnOption: true},
+ {name:'yellow', shade:'light', notAnOption: false}
+ ];
+ $scope.myColor = $scope.colors[2]; // red
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <ul>
+ <li ng-repeat="color in colors">
+ <label>Name: <input ng-model="color.name"></label>
+ <label><input type="checkbox" ng-model="color.notAnOption"> Disabled?</label>
+ <button ng-click="colors.splice($index, 1)" aria-label="Remove">X</button>
+ </li>
+ <li>
+ <button ng-click="colors.push({})">add</button>
+ </li>
+ </ul>
+ <hr/>
+ <label>Color (null not allowed):
+ <select ng-model="myColor" ng-options="color.name for color in colors"></select>
+ </label><br/>
+ <label>Color (null allowed):
+ <span class="nullable">
+ <select ng-model="myColor" ng-options="color.name for color in colors">
+ <option value="">-- choose color --</option>
+ </select>
+ </span></label><br/>
+
+ <label>Color grouped by shade:
+ <select ng-model="myColor" ng-options="color.name group by color.shade for color in colors">
+ </select>
+ </label><br/>
+
+ <label>Color grouped by shade, with some disabled:
+ <select ng-model="myColor"
+ ng-options="color.name group by color.shade disable when color.notAnOption for color in colors">
+ </select>
+ </label><br/>
+
+
+
+ Select <button ng-click="myColor = { name:'not in list', shade: 'other' }">bogus</button>.
+ <br/>
+ <hr/>
+ Currently selected: {{ {selected_color:myColor} }}
+ <div style="border:solid 1px black; height:20px"
+ ng-style="{'background-color':myColor.name}">
+ </div>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-options', function() {
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');
+ element.all(by.model('myColor')).first().click();
+ element.all(by.css('select[ng-model="myColor"] option')).first().click();
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');
+ element(by.css('.nullable select[ng-model="myColor"]')).click();
+ element.all(by.css('.nullable select[ng-model="myColor"] option')).first().click();
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');
+ });
+ </file>
+ </example>
+ */
+
+// jshint maxlen: false
+// //00001111111111000000000002222222222000000000000000000000333333333300000000000000000000000004444444444400000000000005555555555555550000000006666666666666660000000777777777777777000000000000000888888888800000000000000000009999999999
+var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/;
+ // 1: value expression (valueFn)
+ // 2: label expression (displayFn)
+ // 3: group by expression (groupByFn)
+ // 4: disable when expression (disableWhenFn)
+ // 5: array item variable name
+ // 6: object item key variable name
+ // 7: object item value variable name
+ // 8: collection expression
+ // 9: track by expression
+// jshint maxlen: 100
+
+
+var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
+
+ function parseOptionsExpression(optionsExp, selectElement, scope) {
+
+ var match = optionsExp.match(NG_OPTIONS_REGEXP);
+ if (!(match)) {
+ throw ngOptionsMinErr('iexp',
+ "Expected expression in form of " +
+ "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
+ " but got '{0}'. Element: {1}",
+ optionsExp, startingTag(selectElement));
+ }
+
+ // Extract the parts from the ngOptions expression
+
+ // The variable name for the value of the item in the collection
+ var valueName = match[5] || match[7];
+ // The variable name for the key of the item in the collection
+ var keyName = match[6];
+
+ // An expression that generates the viewValue for an option if there is a label expression
+ var selectAs = / as /.test(match[0]) && match[1];
+ // An expression that is used to track the id of each object in the options collection
+ var trackBy = match[9];
+ // An expression that generates the viewValue for an option if there is no label expression
+ var valueFn = $parse(match[2] ? match[1] : valueName);
+ var selectAsFn = selectAs && $parse(selectAs);
+ var viewValueFn = selectAsFn || valueFn;
+ var trackByFn = trackBy && $parse(trackBy);
+
+ // Get the value by which we are going to track the option
+ // if we have a trackFn then use that (passing scope and locals)
+ // otherwise just hash the given viewValue
+ var getTrackByValueFn = trackBy ?
+ function(value, locals) { return trackByFn(scope, locals); } :
+ function getHashOfValue(value) { return hashKey(value); };
+ var getTrackByValue = function(value, key) {
+ return getTrackByValueFn(value, getLocals(value, key));
+ };
+
+ var displayFn = $parse(match[2] || match[1]);
+ var groupByFn = $parse(match[3] || '');
+ var disableWhenFn = $parse(match[4] || '');
+ var valuesFn = $parse(match[8]);
+
+ var locals = {};
+ var getLocals = keyName ? function(value, key) {
+ locals[keyName] = key;
+ locals[valueName] = value;
+ return locals;
+ } : function(value) {
+ locals[valueName] = value;
+ return locals;
+ };
+
+
+ function Option(selectValue, viewValue, label, group, disabled) {
+ this.selectValue = selectValue;
+ this.viewValue = viewValue;
+ this.label = label;
+ this.group = group;
+ this.disabled = disabled;
+ }
+
+ function getOptionValuesKeys(optionValues) {
+ var optionValuesKeys;
+
+ if (!keyName && isArrayLike(optionValues)) {
+ optionValuesKeys = optionValues;
+ } else {
+ // if object, extract keys, in enumeration order, unsorted
+ optionValuesKeys = [];
+ for (var itemKey in optionValues) {
+ if (optionValues.hasOwnProperty(itemKey) && itemKey.charAt(0) !== '$') {
+ optionValuesKeys.push(itemKey);
+ }
+ }
+ }
+ return optionValuesKeys;
+ }
+
+ return {
+ trackBy: trackBy,
+ getTrackByValue: getTrackByValue,
+ getWatchables: $parse(valuesFn, function(optionValues) {
+ // Create a collection of things that we would like to watch (watchedArray)
+ // so that they can all be watched using a single $watchCollection
+ // that only runs the handler once if anything changes
+ var watchedArray = [];
+ optionValues = optionValues || [];
+
+ var optionValuesKeys = getOptionValuesKeys(optionValues);
+ var optionValuesLength = optionValuesKeys.length;
+ for (var index = 0; index < optionValuesLength; index++) {
+ var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];
+ var value = optionValues[key];
+
+ var locals = getLocals(optionValues[key], key);
+ var selectValue = getTrackByValueFn(optionValues[key], locals);
+ watchedArray.push(selectValue);
+
+ // Only need to watch the displayFn if there is a specific label expression
+ if (match[2] || match[1]) {
+ var label = displayFn(scope, locals);
+ watchedArray.push(label);
+ }
+
+ // Only need to watch the disableWhenFn if there is a specific disable expression
+ if (match[4]) {
+ var disableWhen = disableWhenFn(scope, locals);
+ watchedArray.push(disableWhen);
+ }
+ }
+ return watchedArray;
+ }),
+
+ getOptions: function() {
+
+ var optionItems = [];
+ var selectValueMap = {};
+
+ // The option values were already computed in the `getWatchables` fn,
+ // which must have been called to trigger `getOptions`
+ var optionValues = valuesFn(scope) || [];
+ var optionValuesKeys = getOptionValuesKeys(optionValues);
+ var optionValuesLength = optionValuesKeys.length;
+
+ for (var index = 0; index < optionValuesLength; index++) {
+ var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];
+ var value = optionValues[key];
+ var locals = getLocals(value, key);
+ var viewValue = viewValueFn(scope, locals);
+ var selectValue = getTrackByValueFn(viewValue, locals);
+ var label = displayFn(scope, locals);
+ var group = groupByFn(scope, locals);
+ var disabled = disableWhenFn(scope, locals);
+ var optionItem = new Option(selectValue, viewValue, label, group, disabled);
+
+ optionItems.push(optionItem);
+ selectValueMap[selectValue] = optionItem;
+ }
+
+ return {
+ items: optionItems,
+ selectValueMap: selectValueMap,
+ getOptionFromViewValue: function(value) {
+ return selectValueMap[getTrackByValue(value)];
+ },
+ getViewValueFromOption: function(option) {
+ // If the viewValue could be an object that may be mutated by the application,
+ // we need to make a copy and not return the reference to the value on the option.
+ return trackBy ? angular.copy(option.viewValue) : option.viewValue;
+ }
+ };
+ }
+ };
+ }
+
+
+ // we can't just jqLite('<option>') since jqLite is not smart enough
+ // to create it in <select> and IE barfs otherwise.
+ var optionTemplate = document.createElement('option'),
+ optGroupTemplate = document.createElement('optgroup');
+
+ function ngOptionsPostLink(scope, selectElement, attr, ctrls) {
+
+ var selectCtrl = ctrls[0];
+ var ngModelCtrl = ctrls[1];
+ var multiple = attr.multiple;
+
+ // The emptyOption allows the application developer to provide their own custom "empty"
+ // option when the viewValue does not match any of the option values.
+ var emptyOption;
+ for (var i = 0, children = selectElement.children(), ii = children.length; i < ii; i++) {
+ if (children[i].value === '') {
+ emptyOption = children.eq(i);
+ break;
+ }
+ }
+
+ var providedEmptyOption = !!emptyOption;
+
+ var unknownOption = jqLite(optionTemplate.cloneNode(false));
+ unknownOption.val('?');
+
+ var options;
+ var ngOptions = parseOptionsExpression(attr.ngOptions, selectElement, scope);
+
+
+ var renderEmptyOption = function() {
+ if (!providedEmptyOption) {
+ selectElement.prepend(emptyOption);
+ }
+ selectElement.val('');
+ emptyOption.prop('selected', true); // needed for IE
+ emptyOption.attr('selected', true);
+ };
+
+ var removeEmptyOption = function() {
+ if (!providedEmptyOption) {
+ emptyOption.remove();
+ }
+ };
+
+
+ var renderUnknownOption = function() {
+ selectElement.prepend(unknownOption);
+ selectElement.val('?');
+ unknownOption.prop('selected', true); // needed for IE
+ unknownOption.attr('selected', true);
+ };
+
+ var removeUnknownOption = function() {
+ unknownOption.remove();
+ };
+
+ // Update the controller methods for multiple selectable options
+ if (!multiple) {
+
+ selectCtrl.writeValue = function writeNgOptionsValue(value) {
+ var option = options.getOptionFromViewValue(value);
+
+ if (option && !option.disabled) {
+ if (selectElement[0].value !== option.selectValue) {
+ removeUnknownOption();
+ removeEmptyOption();
+
+ selectElement[0].value = option.selectValue;
+ option.element.selected = true;
+ option.element.setAttribute('selected', 'selected');
+ }
+ } else {
+ if (value === null || providedEmptyOption) {
+ removeUnknownOption();
+ renderEmptyOption();
+ } else {
+ removeEmptyOption();
+ renderUnknownOption();
+ }
+ }
+ };
+
+ selectCtrl.readValue = function readNgOptionsValue() {
+
+ var selectedOption = options.selectValueMap[selectElement.val()];
+
+ if (selectedOption && !selectedOption.disabled) {
+ removeEmptyOption();
+ removeUnknownOption();
+ return options.getViewValueFromOption(selectedOption);
+ }
+ return null;
+ };
+
+ // If we are using `track by` then we must watch the tracked value on the model
+ // since ngModel only watches for object identity change
+ if (ngOptions.trackBy) {
+ scope.$watch(
+ function() { return ngOptions.getTrackByValue(ngModelCtrl.$viewValue); },
+ function() { ngModelCtrl.$render(); }
+ );
+ }
+
+ } else {
+
+ ngModelCtrl.$isEmpty = function(value) {
+ return !value || value.length === 0;
+ };
+
+
+ selectCtrl.writeValue = function writeNgOptionsMultiple(value) {
+ options.items.forEach(function(option) {
+ option.element.selected = false;
+ });
+
+ if (value) {
+ value.forEach(function(item) {
+ var option = options.getOptionFromViewValue(item);
+ if (option && !option.disabled) option.element.selected = true;
+ });
+ }
+ };
+
+
+ selectCtrl.readValue = function readNgOptionsMultiple() {
+ var selectedValues = selectElement.val() || [],
+ selections = [];
+
+ forEach(selectedValues, function(value) {
+ var option = options.selectValueMap[value];
+ if (option && !option.disabled) selections.push(options.getViewValueFromOption(option));
+ });
+
+ return selections;
+ };
+
+ // If we are using `track by` then we must watch these tracked values on the model
+ // since ngModel only watches for object identity change
+ if (ngOptions.trackBy) {
+
+ scope.$watchCollection(function() {
+ if (isArray(ngModelCtrl.$viewValue)) {
+ return ngModelCtrl.$viewValue.map(function(value) {
+ return ngOptions.getTrackByValue(value);
+ });
+ }
+ }, function() {
+ ngModelCtrl.$render();
+ });
+
+ }
+ }
+
+
+ if (providedEmptyOption) {
+
+ // we need to remove it before calling selectElement.empty() because otherwise IE will
+ // remove the label from the element. wtf?
+ emptyOption.remove();
+
+ // compile the element since there might be bindings in it
+ $compile(emptyOption)(scope);
+
+ // remove the class, which is added automatically because we recompile the element and it
+ // becomes the compilation root
+ emptyOption.removeClass('ng-scope');
+ } else {
+ emptyOption = jqLite(optionTemplate.cloneNode(false));
+ }
+
+ // We need to do this here to ensure that the options object is defined
+ // when we first hit it in writeNgOptionsValue
+ updateOptions();
+
+ // We will re-render the option elements if the option values or labels change
+ scope.$watchCollection(ngOptions.getWatchables, updateOptions);
+
+ // ------------------------------------------------------------------ //
+
+
+ function updateOptionElement(option, element) {
+ option.element = element;
+ element.disabled = option.disabled;
+ // NOTE: The label must be set before the value, otherwise IE10/11/EDGE create unresponsive
+ // selects in certain circumstances when multiple selects are next to each other and display
+ // the option list in listbox style, i.e. the select is [multiple], or specifies a [size].
+ // See https://github.com/angular/angular.js/issues/11314 for more info.
+ // This is unfortunately untestable with unit / e2e tests
+ if (option.label !== element.label) {
+ element.label = option.label;
+ element.textContent = option.label;
+ }
+ if (option.value !== element.value) element.value = option.selectValue;
+ }
+
+ function addOrReuseElement(parent, current, type, templateElement) {
+ var element;
+ // Check whether we can reuse the next element
+ if (current && lowercase(current.nodeName) === type) {
+ // The next element is the right type so reuse it
+ element = current;
+ } else {
+ // The next element is not the right type so create a new one
+ element = templateElement.cloneNode(false);
+ if (!current) {
+ // There are no more elements so just append it to the select
+ parent.appendChild(element);
+ } else {
+ // The next element is not a group so insert the new one
+ parent.insertBefore(element, current);
+ }
+ }
+ return element;
+ }
+
+
+ function removeExcessElements(current) {
+ var next;
+ while (current) {
+ next = current.nextSibling;
+ jqLiteRemove(current);
+ current = next;
+ }
+ }
+
+
+ function skipEmptyAndUnknownOptions(current) {
+ var emptyOption_ = emptyOption && emptyOption[0];
+ var unknownOption_ = unknownOption && unknownOption[0];
+
+ // We cannot rely on the extracted empty option being the same as the compiled empty option,
+ // because the compiled empty option might have been replaced by a comment because
+ // it had an "element" transclusion directive on it (such as ngIf)
+ if (emptyOption_ || unknownOption_) {
+ while (current &&
+ (current === emptyOption_ ||
+ current === unknownOption_ ||
+ current.nodeType === NODE_TYPE_COMMENT ||
+ (nodeName_(current) === 'option' && current.value === ''))) {
+ current = current.nextSibling;
+ }
+ }
+ return current;
+ }
+
+
+ function updateOptions() {
+
+ var previousValue = options && selectCtrl.readValue();
+
+ options = ngOptions.getOptions();
+
+ var groupMap = {};
+ var currentElement = selectElement[0].firstChild;
+
+ // Ensure that the empty option is always there if it was explicitly provided
+ if (providedEmptyOption) {
+ selectElement.prepend(emptyOption);
+ }
+
+ currentElement = skipEmptyAndUnknownOptions(currentElement);
+
+ options.items.forEach(function updateOption(option) {
+ var group;
+ var groupElement;
+ var optionElement;
+
+ if (isDefined(option.group)) {
+
+ // This option is to live in a group
+ // See if we have already created this group
+ group = groupMap[option.group];
+
+ if (!group) {
+
+ // We have not already created this group
+ groupElement = addOrReuseElement(selectElement[0],
+ currentElement,
+ 'optgroup',
+ optGroupTemplate);
+ // Move to the next element
+ currentElement = groupElement.nextSibling;
+
+ // Update the label on the group element
+ groupElement.label = option.group;
+
+ // Store it for use later
+ group = groupMap[option.group] = {
+ groupElement: groupElement,
+ currentOptionElement: groupElement.firstChild
+ };
+
+ }
+
+ // So now we have a group for this option we add the option to the group
+ optionElement = addOrReuseElement(group.groupElement,
+ group.currentOptionElement,
+ 'option',
+ optionTemplate);
+ updateOptionElement(option, optionElement);
+ // Move to the next element
+ group.currentOptionElement = optionElement.nextSibling;
+
+ } else {
+
+ // This option is not in a group
+ optionElement = addOrReuseElement(selectElement[0],
+ currentElement,
+ 'option',
+ optionTemplate);
+ updateOptionElement(option, optionElement);
+ // Move to the next element
+ currentElement = optionElement.nextSibling;
+ }
+ });
+
+
+ // Now remove all excess options and group
+ Object.keys(groupMap).forEach(function(key) {
+ removeExcessElements(groupMap[key].currentOptionElement);
+ });
+ removeExcessElements(currentElement);
+
+ ngModelCtrl.$render();
+
+ // Check to see if the value has changed due to the update to the options
+ if (!ngModelCtrl.$isEmpty(previousValue)) {
+ var nextValue = selectCtrl.readValue();
+ var isNotPrimitive = ngOptions.trackBy || multiple;
+ if (isNotPrimitive ? !equals(previousValue, nextValue) : previousValue !== nextValue) {
+ ngModelCtrl.$setViewValue(nextValue);
+ ngModelCtrl.$render();
+ }
+ }
+
+ }
+ }
+
+ return {
+ restrict: 'A',
+ terminal: true,
+ require: ['select', 'ngModel'],
+ link: {
+ pre: function ngOptionsPreLink(scope, selectElement, attr, ctrls) {
+ // Deactivate the SelectController.register method to prevent
+ // option directives from accidentally registering themselves
+ // (and unwanted $destroy handlers etc.)
+ ctrls[0].registerOption = noop;
+ },
+ post: ngOptionsPostLink
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngPluralize
+ * @restrict EA
+ *
+ * @description
+ * `ngPluralize` is a directive that displays messages according to en-US localization rules.
+ * These rules are bundled with angular.js, but can be overridden
+ * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive
+ * by specifying the mappings between
+ * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
+ * and the strings to be displayed.
+ *
+ * # Plural categories and explicit number rules
+ * There are two
+ * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
+ * in Angular's default en-US locale: "one" and "other".
+ *
+ * While a plural category may match many numbers (for example, in en-US locale, "other" can match
+ * any number that is not 1), an explicit number rule can only match one number. For example, the
+ * explicit number rule for "3" matches the number 3. There are examples of plural categories
+ * and explicit number rules throughout the rest of this documentation.
+ *
+ * # Configuring ngPluralize
+ * You configure ngPluralize by providing 2 attributes: `count` and `when`.
+ * You can also provide an optional attribute, `offset`.
+ *
+ * The value of the `count` attribute can be either a string or an {@link guide/expression
+ * Angular expression}; these are evaluated on the current scope for its bound value.
+ *
+ * The `when` attribute specifies the mappings between plural categories and the actual
+ * string to be displayed. The value of the attribute should be a JSON object.
+ *
+ * The following example shows how to configure ngPluralize:
+ *
+ * ```html
+ * <ng-pluralize count="personCount"
+ when="{'0': 'Nobody is viewing.',
+ * 'one': '1 person is viewing.',
+ * 'other': '{} people are viewing.'}">
+ * </ng-pluralize>
+ *```
+ *
+ * In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not
+ * specify this rule, 0 would be matched to the "other" category and "0 people are viewing"
+ * would be shown instead of "Nobody is viewing". You can specify an explicit number rule for
+ * other numbers, for example 12, so that instead of showing "12 people are viewing", you can
+ * show "a dozen people are viewing".
+ *
+ * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted
+ * into pluralized strings. In the previous example, Angular will replace `{}` with
+ * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder
+ * for <span ng-non-bindable>{{numberExpression}}</span>.
+ *
+ * If no rule is defined for a category, then an empty string is displayed and a warning is generated.
+ * Note that some locales define more categories than `one` and `other`. For example, fr-fr defines `few` and `many`.
+ *
+ * # Configuring ngPluralize with offset
+ * The `offset` attribute allows further customization of pluralized text, which can result in
+ * a better user experience. For example, instead of the message "4 people are viewing this document",
+ * you might display "John, Kate and 2 others are viewing this document".
+ * The offset attribute allows you to offset a number by any desired value.
+ * Let's take a look at an example:
+ *
+ * ```html
+ * <ng-pluralize count="personCount" offset=2
+ * when="{'0': 'Nobody is viewing.',
+ * '1': '{{person1}} is viewing.',
+ * '2': '{{person1}} and {{person2}} are viewing.',
+ * 'one': '{{person1}}, {{person2}} and one other person are viewing.',
+ * 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
+ * </ng-pluralize>
+ * ```
+ *
+ * Notice that we are still using two plural categories(one, other), but we added
+ * three explicit number rules 0, 1 and 2.
+ * When one person, perhaps John, views the document, "John is viewing" will be shown.
+ * When three people view the document, no explicit number rule is found, so
+ * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.
+ * In this case, plural category 'one' is matched and "John, Mary and one other person are viewing"
+ * is shown.
+ *
+ * Note that when you specify offsets, you must provide explicit number rules for
+ * numbers from 0 up to and including the offset. If you use an offset of 3, for example,
+ * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for
+ * plural categories "one" and "other".
+ *
+ * @param {string|expression} count The variable to be bound to.
+ * @param {string} when The mapping between plural category to its corresponding strings.
+ * @param {number=} offset Offset to deduct from the total number.
+ *
+ * @example
+ <example module="pluralizeExample">
+ <file name="index.html">
+ <script>
+ angular.module('pluralizeExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.person1 = 'Igor';
+ $scope.person2 = 'Misko';
+ $scope.personCount = 1;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>Person 1:<input type="text" ng-model="person1" value="Igor" /></label><br/>
+ <label>Person 2:<input type="text" ng-model="person2" value="Misko" /></label><br/>
+ <label>Number of People:<input type="text" ng-model="personCount" value="1" /></label><br/>
+
+ <!--- Example with simple pluralization rules for en locale --->
+ Without Offset:
+ <ng-pluralize count="personCount"
+ when="{'0': 'Nobody is viewing.',
+ 'one': '1 person is viewing.',
+ 'other': '{} people are viewing.'}">
+ </ng-pluralize><br>
+
+ <!--- Example with offset --->
+ With Offset(2):
+ <ng-pluralize count="personCount" offset=2
+ when="{'0': 'Nobody is viewing.',
+ '1': '{{person1}} is viewing.',
+ '2': '{{person1}} and {{person2}} are viewing.',
+ 'one': '{{person1}}, {{person2}} and one other person are viewing.',
+ 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
+ </ng-pluralize>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should show correct pluralized string', function() {
+ var withoutOffset = element.all(by.css('ng-pluralize')).get(0);
+ var withOffset = element.all(by.css('ng-pluralize')).get(1);
+ var countInput = element(by.model('personCount'));
+
+ expect(withoutOffset.getText()).toEqual('1 person is viewing.');
+ expect(withOffset.getText()).toEqual('Igor is viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('0');
+
+ expect(withoutOffset.getText()).toEqual('Nobody is viewing.');
+ expect(withOffset.getText()).toEqual('Nobody is viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('2');
+
+ expect(withoutOffset.getText()).toEqual('2 people are viewing.');
+ expect(withOffset.getText()).toEqual('Igor and Misko are viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('3');
+
+ expect(withoutOffset.getText()).toEqual('3 people are viewing.');
+ expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('4');
+
+ expect(withoutOffset.getText()).toEqual('4 people are viewing.');
+ expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.');
+ });
+ it('should show data-bound names', function() {
+ var withOffset = element.all(by.css('ng-pluralize')).get(1);
+ var personCount = element(by.model('personCount'));
+ var person1 = element(by.model('person1'));
+ var person2 = element(by.model('person2'));
+ personCount.clear();
+ personCount.sendKeys('4');
+ person1.clear();
+ person1.sendKeys('Di');
+ person2.clear();
+ person2.sendKeys('Vojta');
+ expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.');
+ });
+ </file>
+ </example>
+ */
+var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale, $interpolate, $log) {
+ var BRACE = /{}/g,
+ IS_WHEN = /^when(Minus)?(.+)$/;
+
+ return {
+ link: function(scope, element, attr) {
+ var numberExp = attr.count,
+ whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs
+ offset = attr.offset || 0,
+ whens = scope.$eval(whenExp) || {},
+ whensExpFns = {},
+ startSymbol = $interpolate.startSymbol(),
+ endSymbol = $interpolate.endSymbol(),
+ braceReplacement = startSymbol + numberExp + '-' + offset + endSymbol,
+ watchRemover = angular.noop,
+ lastCount;
+
+ forEach(attr, function(expression, attributeName) {
+ var tmpMatch = IS_WHEN.exec(attributeName);
+ if (tmpMatch) {
+ var whenKey = (tmpMatch[1] ? '-' : '') + lowercase(tmpMatch[2]);
+ whens[whenKey] = element.attr(attr.$attr[attributeName]);
+ }
+ });
+ forEach(whens, function(expression, key) {
+ whensExpFns[key] = $interpolate(expression.replace(BRACE, braceReplacement));
+
+ });
+
+ scope.$watch(numberExp, function ngPluralizeWatchAction(newVal) {
+ var count = parseFloat(newVal);
+ var countIsNaN = isNaN(count);
+
+ if (!countIsNaN && !(count in whens)) {
+ // If an explicit number rule such as 1, 2, 3... is defined, just use it.
+ // Otherwise, check it against pluralization rules in $locale service.
+ count = $locale.pluralCat(count - offset);
+ }
+
+ // If both `count` and `lastCount` are NaN, we don't need to re-register a watch.
+ // In JS `NaN !== NaN`, so we have to explicitly check.
+ if ((count !== lastCount) && !(countIsNaN && isNumber(lastCount) && isNaN(lastCount))) {
+ watchRemover();
+ var whenExpFn = whensExpFns[count];
+ if (isUndefined(whenExpFn)) {
+ if (newVal != null) {
+ $log.debug("ngPluralize: no rule defined for '" + count + "' in " + whenExp);
+ }
+ watchRemover = noop;
+ updateElementText();
+ } else {
+ watchRemover = scope.$watch(whenExpFn, updateElementText);
+ }
+ lastCount = count;
+ }
+ });
+
+ function updateElementText(newText) {
+ element.text(newText || '');
+ }
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngRepeat
+ * @multiElement
+ *
+ * @description
+ * The `ngRepeat` directive instantiates a template once per item from a collection. Each template
+ * instance gets its own scope, where the given loop variable is set to the current collection item,
+ * and `$index` is set to the item index or key.
+ *
+ * Special properties are exposed on the local scope of each template instance, including:
+ *
+ * | Variable | Type | Details |
+ * |-----------|-----------------|-----------------------------------------------------------------------------|
+ * | `$index` | {@type number} | iterator offset of the repeated element (0..length-1) |
+ * | `$first` | {@type boolean} | true if the repeated element is first in the iterator. |
+ * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |
+ * | `$last` | {@type boolean} | true if the repeated element is last in the iterator. |
+ * | `$even` | {@type boolean} | true if the iterator position `$index` is even (otherwise false). |
+ * | `$odd` | {@type boolean} | true if the iterator position `$index` is odd (otherwise false). |
+ *
+ * <div class="alert alert-info">
+ * Creating aliases for these properties is possible with {@link ng.directive:ngInit `ngInit`}.
+ * This may be useful when, for instance, nesting ngRepeats.
+ * </div>
+ *
+ *
+ * # Iterating over object properties
+ *
+ * It is possible to get `ngRepeat` to iterate over the properties of an object using the following
+ * syntax:
+ *
+ * ```js
+ * <div ng-repeat="(key, value) in myObj"> ... </div>
+ * ```
+ *
+ * You need to be aware that the JavaScript specification does not define the order of keys
+ * returned for an object. (To mitigate this in Angular 1.3 the `ngRepeat` directive
+ * used to sort the keys alphabetically.)
+ *
+ * Version 1.4 removed the alphabetic sorting. We now rely on the order returned by the browser
+ * when running `for key in myObj`. It seems that browsers generally follow the strategy of providing
+ * keys in the order in which they were defined, although there are exceptions when keys are deleted
+ * and reinstated. See the [MDN page on `delete` for more info](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete#Cross-browser_notes).
+ *
+ * If this is not desired, the recommended workaround is to convert your object into an array
+ * that is sorted into the order that you prefer before providing it to `ngRepeat`. You could
+ * do this with a filter such as [toArrayFilter](http://ngmodules.org/modules/angular-toArrayFilter)
+ * or implement a `$watch` on the object yourself.
+ *
+ *
+ * # Tracking and Duplicates
+ *
+ * `ngRepeat` uses {@link $rootScope.Scope#$watchCollection $watchCollection} to detect changes in
+ * the collection. When a change happens, ngRepeat then makes the corresponding changes to the DOM:
+ *
+ * * When an item is added, a new instance of the template is added to the DOM.
+ * * When an item is removed, its template instance is removed from the DOM.
+ * * When items are reordered, their respective templates are reordered in the DOM.
+ *
+ * To minimize creation of DOM elements, `ngRepeat` uses a function
+ * to "keep track" of all items in the collection and their corresponding DOM elements.
+ * For example, if an item is added to the collection, ngRepeat will know that all other items
+ * already have DOM elements, and will not re-render them.
+ *
+ * The default tracking function (which tracks items by their identity) does not allow
+ * duplicate items in arrays. This is because when there are duplicates, it is not possible
+ * to maintain a one-to-one mapping between collection items and DOM elements.
+ *
+ * If you do need to repeat duplicate items, you can substitute the default tracking behavior
+ * with your own using the `track by` expression.
+ *
+ * For example, you may track items by the index of each item in the collection, using the
+ * special scope property `$index`:
+ * ```html
+ * <div ng-repeat="n in [42, 42, 43, 43] track by $index">
+ * {{n}}
+ * </div>
+ * ```
+ *
+ * You may also use arbitrary expressions in `track by`, including references to custom functions
+ * on the scope:
+ * ```html
+ * <div ng-repeat="n in [42, 42, 43, 43] track by myTrackingFunction(n)">
+ * {{n}}
+ * </div>
+ * ```
+ *
+ * <div class="alert alert-success">
+ * If you are working with objects that have an identifier property, you should track
+ * by the identifier instead of the whole object. Should you reload your data later, `ngRepeat`
+ * will not have to rebuild the DOM elements for items it has already rendered, even if the
+ * JavaScript objects in the collection have been substituted for new ones. For large collections,
+ * this significantly improves rendering performance. If you don't have a unique identifier,
+ * `track by $index` can also provide a performance boost.
+ * </div>
+ * ```html
+ * <div ng-repeat="model in collection track by model.id">
+ * {{model.name}}
+ * </div>
+ * ```
+ *
+ * When no `track by` expression is provided, it is equivalent to tracking by the built-in
+ * `$id` function, which tracks items by their identity:
+ * ```html
+ * <div ng-repeat="obj in collection track by $id(obj)">
+ * {{obj.prop}}
+ * </div>
+ * ```
+ *
+ * <div class="alert alert-warning">
+ * **Note:** `track by` must always be the last expression:
+ * </div>
+ * ```
+ * <div ng-repeat="model in collection | orderBy: 'id' as filtered_result track by model.id">
+ * {{model.name}}
+ * </div>
+ * ```
+ *
+ * # Special repeat start and end points
+ * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending
+ * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.
+ * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on)
+ * up to and including the ending HTML tag where **ng-repeat-end** is placed.
+ *
+ * The example below makes use of this feature:
+ * ```html
+ * <header ng-repeat-start="item in items">
+ * Header {{ item }}
+ * </header>
+ * <div class="body">
+ * Body {{ item }}
+ * </div>
+ * <footer ng-repeat-end>
+ * Footer {{ item }}
+ * </footer>
+ * ```
+ *
+ * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to:
+ * ```html
+ * <header>
+ * Header A
+ * </header>
+ * <div class="body">
+ * Body A
+ * </div>
+ * <footer>
+ * Footer A
+ * </footer>
+ * <header>
+ * Header B
+ * </header>
+ * <div class="body">
+ * Body B
+ * </div>
+ * <footer>
+ * Footer B
+ * </footer>
+ * ```
+ *
+ * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such
+ * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).
+ *
+ * @animations
+ * **.enter** - when a new item is added to the list or when an item is revealed after a filter
+ *
+ * **.leave** - when an item is removed from the list or when an item is filtered out
+ *
+ * **.move** - when an adjacent item is filtered out causing a reorder or when the item contents are reordered
+ *
+ * See the example below for defining CSS animations with ngRepeat.
+ *
+ * @element ANY
+ * @scope
+ * @priority 1000
+ * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These
+ * formats are currently supported:
+ *
+ * * `variable in expression` – where variable is the user defined loop variable and `expression`
+ * is a scope expression giving the collection to enumerate.
+ *
+ * For example: `album in artist.albums`.
+ *
+ * * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,
+ * and `expression` is the scope expression giving the collection to enumerate.
+ *
+ * For example: `(name, age) in {'adam':10, 'amalie':12}`.
+ *
+ * * `variable in expression track by tracking_expression` – You can also provide an optional tracking expression
+ * which can be used to associate the objects in the collection with the DOM elements. If no tracking expression
+ * is specified, ng-repeat associates elements by identity. It is an error to have
+ * more than one tracking expression value resolve to the same key. (This would mean that two distinct objects are
+ * mapped to the same DOM element, which is not possible.)
+ *
+ * Note that the tracking expression must come last, after any filters, and the alias expression.
+ *
+ * For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements
+ * will be associated by item identity in the array.
+ *
+ * For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique
+ * `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements
+ * with the corresponding item in the array by identity. Moving the same object in array would move the DOM
+ * element in the same way in the DOM.
+ *
+ * For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this
+ * case the object identity does not matter. Two objects are considered equivalent as long as their `id`
+ * property is same.
+ *
+ * For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter
+ * to items in conjunction with a tracking expression.
+ *
+ * * `variable in expression as alias_expression` – You can also provide an optional alias expression which will then store the
+ * intermediate results of the repeater after the filters have been applied. Typically this is used to render a special message
+ * when a filter is active on the repeater, but the filtered result set is empty.
+ *
+ * For example: `item in items | filter:x as results` will store the fragment of the repeated items as `results`, but only after
+ * the items have been processed through the filter.
+ *
+ * Please note that `as [variable name] is not an operator but rather a part of ngRepeat micro-syntax so it can be used only at the end
+ * (and not as operator, inside an expression).
+ *
+ * For example: `item in items | filter : x | orderBy : order | limitTo : limit as results` .
+ *
+ * @example
+ * This example uses `ngRepeat` to display a list of people. A filter is used to restrict the displayed
+ * results by name. New (entering) and removed (leaving) items are animated.
+ <example module="ngRepeat" name="ngRepeat" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <div ng-controller="repeatController">
+ I have {{friends.length}} friends. They are:
+ <input type="search" ng-model="q" placeholder="filter friends..." aria-label="filter friends" />
+ <ul class="example-animate-container">
+ <li class="animate-repeat" ng-repeat="friend in friends | filter:q as results">
+ [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
+ </li>
+ <li class="animate-repeat" ng-if="results.length == 0">
+ <strong>No results found...</strong>
+ </li>
+ </ul>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('ngRepeat', ['ngAnimate']).controller('repeatController', function($scope) {
+ $scope.friends = [
+ {name:'John', age:25, gender:'boy'},
+ {name:'Jessie', age:30, gender:'girl'},
+ {name:'Johanna', age:28, gender:'girl'},
+ {name:'Joy', age:15, gender:'girl'},
+ {name:'Mary', age:28, gender:'girl'},
+ {name:'Peter', age:95, gender:'boy'},
+ {name:'Sebastian', age:50, gender:'boy'},
+ {name:'Erika', age:27, gender:'girl'},
+ {name:'Patrick', age:40, gender:'boy'},
+ {name:'Samantha', age:60, gender:'girl'}
+ ];
+ });
+ </file>
+ <file name="animations.css">
+ .example-animate-container {
+ background:white;
+ border:1px solid black;
+ list-style:none;
+ margin:0;
+ padding:0 10px;
+ }
+
+ .animate-repeat {
+ line-height:30px;
+ list-style:none;
+ box-sizing:border-box;
+ }
+
+ .animate-repeat.ng-move,
+ .animate-repeat.ng-enter,
+ .animate-repeat.ng-leave {
+ transition:all linear 0.5s;
+ }
+
+ .animate-repeat.ng-leave.ng-leave-active,
+ .animate-repeat.ng-move,
+ .animate-repeat.ng-enter {
+ opacity:0;
+ max-height:0;
+ }
+
+ .animate-repeat.ng-leave,
+ .animate-repeat.ng-move.ng-move-active,
+ .animate-repeat.ng-enter.ng-enter-active {
+ opacity:1;
+ max-height:30px;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var friends = element.all(by.repeater('friend in friends'));
+
+ it('should render initial data set', function() {
+ expect(friends.count()).toBe(10);
+ expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.');
+ expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.');
+ expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.');
+ expect(element(by.binding('friends.length')).getText())
+ .toMatch("I have 10 friends. They are:");
+ });
+
+ it('should update repeater when filter predicate changes', function() {
+ expect(friends.count()).toBe(10);
+
+ element(by.model('q')).sendKeys('ma');
+
+ expect(friends.count()).toBe(2);
+ expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');
+ expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.');
+ });
+ </file>
+ </example>
+ */
+var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
+ var NG_REMOVED = '$$NG_REMOVED';
+ var ngRepeatMinErr = minErr('ngRepeat');
+
+ var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {
+ // TODO(perf): generate setters to shave off ~40ms or 1-1.5%
+ scope[valueIdentifier] = value;
+ if (keyIdentifier) scope[keyIdentifier] = key;
+ scope.$index = index;
+ scope.$first = (index === 0);
+ scope.$last = (index === (arrayLength - 1));
+ scope.$middle = !(scope.$first || scope.$last);
+ // jshint bitwise: false
+ scope.$odd = !(scope.$even = (index&1) === 0);
+ // jshint bitwise: true
+ };
+
+ var getBlockStart = function(block) {
+ return block.clone[0];
+ };
+
+ var getBlockEnd = function(block) {
+ return block.clone[block.clone.length - 1];
+ };
+
+
+ return {
+ restrict: 'A',
+ multiElement: true,
+ transclude: 'element',
+ priority: 1000,
+ terminal: true,
+ $$tlb: true,
+ compile: function ngRepeatCompile($element, $attr) {
+ var expression = $attr.ngRepeat;
+ var ngRepeatEndComment = document.createComment(' end ngRepeat: ' + expression + ' ');
+
+ var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
+
+ if (!match) {
+ throw ngRepeatMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",
+ expression);
+ }
+
+ var lhs = match[1];
+ var rhs = match[2];
+ var aliasAs = match[3];
+ var trackByExp = match[4];
+
+ match = lhs.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/);
+
+ if (!match) {
+ throw ngRepeatMinErr('iidexp', "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",
+ lhs);
+ }
+ var valueIdentifier = match[3] || match[1];
+ var keyIdentifier = match[2];
+
+ if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) ||
+ /^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(aliasAs))) {
+ throw ngRepeatMinErr('badident', "alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.",
+ aliasAs);
+ }
+
+ var trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn;
+ var hashFnLocals = {$id: hashKey};
+
+ if (trackByExp) {
+ trackByExpGetter = $parse(trackByExp);
+ } else {
+ trackByIdArrayFn = function(key, value) {
+ return hashKey(value);
+ };
+ trackByIdObjFn = function(key) {
+ return key;
+ };
+ }
+
+ return function ngRepeatLink($scope, $element, $attr, ctrl, $transclude) {
+
+ if (trackByExpGetter) {
+ trackByIdExpFn = function(key, value, index) {
+ // assign key, value, and $index to the locals so that they can be used in hash functions
+ if (keyIdentifier) hashFnLocals[keyIdentifier] = key;
+ hashFnLocals[valueIdentifier] = value;
+ hashFnLocals.$index = index;
+ return trackByExpGetter($scope, hashFnLocals);
+ };
+ }
+
+ // Store a list of elements from previous run. This is a hash where key is the item from the
+ // iterator, and the value is objects with following properties.
+ // - scope: bound scope
+ // - element: previous element.
+ // - index: position
+ //
+ // We are using no-proto object so that we don't need to guard against inherited props via
+ // hasOwnProperty.
+ var lastBlockMap = createMap();
+
+ //watch props
+ $scope.$watchCollection(rhs, function ngRepeatAction(collection) {
+ var index, length,
+ previousNode = $element[0], // node that cloned nodes should be inserted after
+ // initialized to the comment node anchor
+ nextNode,
+ // Same as lastBlockMap but it has the current state. It will become the
+ // lastBlockMap on the next iteration.
+ nextBlockMap = createMap(),
+ collectionLength,
+ key, value, // key/value of iteration
+ trackById,
+ trackByIdFn,
+ collectionKeys,
+ block, // last object information {scope, element, id}
+ nextBlockOrder,
+ elementsToRemove;
+
+ if (aliasAs) {
+ $scope[aliasAs] = collection;
+ }
+
+ if (isArrayLike(collection)) {
+ collectionKeys = collection;
+ trackByIdFn = trackByIdExpFn || trackByIdArrayFn;
+ } else {
+ trackByIdFn = trackByIdExpFn || trackByIdObjFn;
+ // if object, extract keys, in enumeration order, unsorted
+ collectionKeys = [];
+ for (var itemKey in collection) {
+ if (hasOwnProperty.call(collection, itemKey) && itemKey.charAt(0) !== '$') {
+ collectionKeys.push(itemKey);
+ }
+ }
+ }
+
+ collectionLength = collectionKeys.length;
+ nextBlockOrder = new Array(collectionLength);
+
+ // locate existing items
+ for (index = 0; index < collectionLength; index++) {
+ key = (collection === collectionKeys) ? index : collectionKeys[index];
+ value = collection[key];
+ trackById = trackByIdFn(key, value, index);
+ if (lastBlockMap[trackById]) {
+ // found previously seen block
+ block = lastBlockMap[trackById];
+ delete lastBlockMap[trackById];
+ nextBlockMap[trackById] = block;
+ nextBlockOrder[index] = block;
+ } else if (nextBlockMap[trackById]) {
+ // if collision detected. restore lastBlockMap and throw an error
+ forEach(nextBlockOrder, function(block) {
+ if (block && block.scope) lastBlockMap[block.id] = block;
+ });
+ throw ngRepeatMinErr('dupes',
+ "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}",
+ expression, trackById, value);
+ } else {
+ // new never before seen block
+ nextBlockOrder[index] = {id: trackById, scope: undefined, clone: undefined};
+ nextBlockMap[trackById] = true;
+ }
+ }
+
+ // remove leftover items
+ for (var blockKey in lastBlockMap) {
+ block = lastBlockMap[blockKey];
+ elementsToRemove = getBlockNodes(block.clone);
+ $animate.leave(elementsToRemove);
+ if (elementsToRemove[0].parentNode) {
+ // if the element was not removed yet because of pending animation, mark it as deleted
+ // so that we can ignore it later
+ for (index = 0, length = elementsToRemove.length; index < length; index++) {
+ elementsToRemove[index][NG_REMOVED] = true;
+ }
+ }
+ block.scope.$destroy();
+ }
+
+ // we are not using forEach for perf reasons (trying to avoid #call)
+ for (index = 0; index < collectionLength; index++) {
+ key = (collection === collectionKeys) ? index : collectionKeys[index];
+ value = collection[key];
+ block = nextBlockOrder[index];
+
+ if (block.scope) {
+ // if we have already seen this object, then we need to reuse the
+ // associated scope/element
+
+ nextNode = previousNode;
+
+ // skip nodes that are already pending removal via leave animation
+ do {
+ nextNode = nextNode.nextSibling;
+ } while (nextNode && nextNode[NG_REMOVED]);
+
+ if (getBlockStart(block) != nextNode) {
+ // existing item which got moved
+ $animate.move(getBlockNodes(block.clone), null, jqLite(previousNode));
+ }
+ previousNode = getBlockEnd(block);
+ updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);
+ } else {
+ // new item which we don't know about
+ $transclude(function ngRepeatTransclude(clone, scope) {
+ block.scope = scope;
+ // http://jsperf.com/clone-vs-createcomment
+ var endNode = ngRepeatEndComment.cloneNode(false);
+ clone[clone.length++] = endNode;
+
+ // TODO(perf): support naked previousNode in `enter` to avoid creation of jqLite wrapper?
+ $animate.enter(clone, null, jqLite(previousNode));
+ previousNode = endNode;
+ // Note: We only need the first/last node of the cloned nodes.
+ // However, we need to keep the reference to the jqlite wrapper as it might be changed later
+ // by a directive with templateUrl when its template arrives.
+ block.clone = clone;
+ nextBlockMap[block.id] = block;
+ updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);
+ });
+ }
+ }
+ lastBlockMap = nextBlockMap;
+ });
+ };
+ }
+ };
+}];
+
+var NG_HIDE_CLASS = 'ng-hide';
+var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
+/**
+ * @ngdoc directive
+ * @name ngShow
+ * @multiElement
+ *
+ * @description
+ * The `ngShow` directive shows or hides the given HTML element based on the expression
+ * provided to the `ngShow` attribute. The element is shown or hidden by removing or adding
+ * the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+ * in AngularJS and sets the display style to none (using an !important flag).
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```html
+ * <!-- when $scope.myValue is truthy (element is visible) -->
+ * <div ng-show="myValue"></div>
+ *
+ * <!-- when $scope.myValue is falsy (element is hidden) -->
+ * <div ng-show="myValue" class="ng-hide"></div>
+ * ```
+ *
+ * When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added to the class
+ * attribute on the element causing it to become hidden. When truthy, the `.ng-hide` CSS class is removed
+ * from the element causing the element not to appear hidden.
+ *
+ * ## Why is !important used?
+ *
+ * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
+ * can be easily overridden by heavier selectors. For example, something as simple
+ * as changing the display style on a HTML list item would make hidden elements appear visible.
+ * This also becomes a bigger issue when dealing with CSS frameworks.
+ *
+ * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+ * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+ * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
+ *
+ * ### Overriding `.ng-hide`
+ *
+ * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
+ * class CSS. Note that the selector that needs to be used is actually `.ng-hide:not(.ng-hide-animate)` to cope
+ * with extra animation classes that can be added.
+ *
+ * ```css
+ * .ng-hide:not(.ng-hide-animate) {
+ * /&#42; this is just another form of hiding an element &#42;/
+ * display: block!important;
+ * position: absolute;
+ * top: -9999px;
+ * left: -9999px;
+ * }
+ * ```
+ *
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
+ *
+ * ## A note about animations with `ngShow`
+ *
+ * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+ * is true and false. This system works like the animation system present with ngClass except that
+ * you must also include the !important flag to override the display property
+ * so that you can perform an animation when the element is hidden during the time of the animation.
+ *
+ * ```css
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
+ * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ * /&#42; this is required as of 1.3x to properly
+ * apply all styling in a show/hide animation &#42;/
+ * transition: 0s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add-active,
+ * .my-element.ng-hide-remove-active {
+ * /&#42; the transition is defined in the active class &#42;/
+ * transition: 1s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add { ... }
+ * .my-element.ng-hide-add.ng-hide-add-active { ... }
+ * .my-element.ng-hide-remove { ... }
+ * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+ * ```
+ *
+ * Keep in mind that, as of AngularJS version 1.3.0-beta.11, there is no need to change the display
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
+ *
+ * @animations
+ * addClass: `.ng-hide` - happens after the `ngShow` expression evaluates to a truthy value and the just before contents are set to visible
+ * removeClass: `.ng-hide` - happens after the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden
+ *
+ * @element ANY
+ * @param {expression} ngShow If the {@link guide/expression expression} is truthy
+ * then the element is shown or hidden respectively.
+ *
+ * @example
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ Click me: <input type="checkbox" ng-model="checked" aria-label="Toggle ngHide"><br/>
+ <div>
+ Show:
+ <div class="check-element animate-show" ng-show="checked">
+ <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+ </div>
+ </div>
+ <div>
+ Hide:
+ <div class="check-element animate-show" ng-hide="checked">
+ <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+ </div>
+ </div>
+ </file>
+ <file name="glyphicons.css">
+ @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);
+ </file>
+ <file name="animations.css">
+ .animate-show {
+ line-height: 20px;
+ opacity: 1;
+ padding: 10px;
+ border: 1px solid black;
+ background: white;
+ }
+
+ .animate-show.ng-hide-add, .animate-show.ng-hide-remove {
+ transition: all linear 0.5s;
+ }
+
+ .animate-show.ng-hide {
+ line-height: 0;
+ opacity: 0;
+ padding: 0 10px;
+ }
+
+ .check-element {
+ padding: 10px;
+ border: 1px solid black;
+ background: white;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+ var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+ it('should check ng-show / ng-hide', function() {
+ expect(thumbsUp.isDisplayed()).toBeFalsy();
+ expect(thumbsDown.isDisplayed()).toBeTruthy();
+
+ element(by.model('checked')).click();
+
+ expect(thumbsUp.isDisplayed()).toBeTruthy();
+ expect(thumbsDown.isDisplayed()).toBeFalsy();
+ });
+ </file>
+ </example>
+ */
+var ngShowDirective = ['$animate', function($animate) {
+ return {
+ restrict: 'A',
+ multiElement: true,
+ link: function(scope, element, attr) {
+ scope.$watch(attr.ngShow, function ngShowWatchAction(value) {
+ // we're adding a temporary, animation-specific class for ng-hide since this way
+ // we can control when the element is actually displayed on screen without having
+ // to have a global/greedy CSS selector that breaks when other animations are run.
+ // Read: https://github.com/angular/angular.js/issues/9103#issuecomment-58335845
+ $animate[value ? 'removeClass' : 'addClass'](element, NG_HIDE_CLASS, {
+ tempClasses: NG_HIDE_IN_PROGRESS_CLASS
+ });
+ });
+ }
+ };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngHide
+ * @multiElement
+ *
+ * @description
+ * The `ngHide` directive shows or hides the given HTML element based on the expression
+ * provided to the `ngHide` attribute. The element is shown or hidden by removing or adding
+ * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+ * in AngularJS and sets the display style to none (using an !important flag).
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```html
+ * <!-- when $scope.myValue is truthy (element is hidden) -->
+ * <div ng-hide="myValue" class="ng-hide"></div>
+ *
+ * <!-- when $scope.myValue is falsy (element is visible) -->
+ * <div ng-hide="myValue"></div>
+ * ```
+ *
+ * When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added to the class
+ * attribute on the element causing it to become hidden. When falsy, the `.ng-hide` CSS class is removed
+ * from the element causing the element not to appear hidden.
+ *
+ * ## Why is !important used?
+ *
+ * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
+ * can be easily overridden by heavier selectors. For example, something as simple
+ * as changing the display style on a HTML list item would make hidden elements appear visible.
+ * This also becomes a bigger issue when dealing with CSS frameworks.
+ *
+ * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+ * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+ * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
+ *
+ * ### Overriding `.ng-hide`
+ *
+ * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
+ * class in CSS:
+ *
+ * ```css
+ * .ng-hide {
+ * /&#42; this is just another form of hiding an element &#42;/
+ * display: block!important;
+ * position: absolute;
+ * top: -9999px;
+ * left: -9999px;
+ * }
+ * ```
+ *
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
+ *
+ * ## A note about animations with `ngHide`
+ *
+ * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+ * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`
+ * CSS class is added and removed for you instead of your own CSS class.
+ *
+ * ```css
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
+ * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ * transition: 0.5s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add { ... }
+ * .my-element.ng-hide-add.ng-hide-add-active { ... }
+ * .my-element.ng-hide-remove { ... }
+ * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+ * ```
+ *
+ * Keep in mind that, as of AngularJS version 1.3.0-beta.11, there is no need to change the display
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
+ *
+ * @animations
+ * removeClass: `.ng-hide` - happens after the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden
+ * addClass: `.ng-hide` - happens after the `ngHide` expression evaluates to a non truthy value and just before the contents are set to visible
+ *
+ * @element ANY
+ * @param {expression} ngHide If the {@link guide/expression expression} is truthy then
+ * the element is shown or hidden respectively.
+ *
+ * @example
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ Click me: <input type="checkbox" ng-model="checked" aria-label="Toggle ngShow"><br/>
+ <div>
+ Show:
+ <div class="check-element animate-hide" ng-show="checked">
+ <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+ </div>
+ </div>
+ <div>
+ Hide:
+ <div class="check-element animate-hide" ng-hide="checked">
+ <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+ </div>
+ </div>
+ </file>
+ <file name="glyphicons.css">
+ @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);
+ </file>
+ <file name="animations.css">
+ .animate-hide {
+ transition: all linear 0.5s;
+ line-height: 20px;
+ opacity: 1;
+ padding: 10px;
+ border: 1px solid black;
+ background: white;
+ }
+
+ .animate-hide.ng-hide {
+ line-height: 0;
+ opacity: 0;
+ padding: 0 10px;
+ }
+
+ .check-element {
+ padding: 10px;
+ border: 1px solid black;
+ background: white;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+ var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+ it('should check ng-show / ng-hide', function() {
+ expect(thumbsUp.isDisplayed()).toBeFalsy();
+ expect(thumbsDown.isDisplayed()).toBeTruthy();
+
+ element(by.model('checked')).click();
+
+ expect(thumbsUp.isDisplayed()).toBeTruthy();
+ expect(thumbsDown.isDisplayed()).toBeFalsy();
+ });
+ </file>
+ </example>
+ */
+var ngHideDirective = ['$animate', function($animate) {
+ return {
+ restrict: 'A',
+ multiElement: true,
+ link: function(scope, element, attr) {
+ scope.$watch(attr.ngHide, function ngHideWatchAction(value) {
+ // The comment inside of the ngShowDirective explains why we add and
+ // remove a temporary class for the show/hide animation
+ $animate[value ? 'addClass' : 'removeClass'](element,NG_HIDE_CLASS, {
+ tempClasses: NG_HIDE_IN_PROGRESS_CLASS
+ });
+ });
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngStyle
+ * @restrict AC
+ *
+ * @description
+ * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.
+ *
+ * @element ANY
+ * @param {expression} ngStyle
+ *
+ * {@link guide/expression Expression} which evals to an
+ * object whose keys are CSS style names and values are corresponding values for those CSS
+ * keys.
+ *
+ * Since some CSS style names are not valid keys for an object, they must be quoted.
+ * See the 'background-color' style in the example below.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input type="button" value="set color" ng-click="myStyle={color:'red'}">
+ <input type="button" value="set background" ng-click="myStyle={'background-color':'blue'}">
+ <input type="button" value="clear" ng-click="myStyle={}">
+ <br/>
+ <span ng-style="myStyle">Sample Text</span>
+ <pre>myStyle={{myStyle}}</pre>
+ </file>
+ <file name="style.css">
+ span {
+ color: black;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var colorSpan = element(by.css('span'));
+
+ it('should check ng-style', function() {
+ expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
+ element(by.css('input[value=\'set color\']')).click();
+ expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');
+ element(by.css('input[value=clear]')).click();
+ expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
+ });
+ </file>
+ </example>
+ */
+var ngStyleDirective = ngDirective(function(scope, element, attr) {
+ scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
+ if (oldStyles && (newStyles !== oldStyles)) {
+ forEach(oldStyles, function(val, style) { element.css(style, '');});
+ }
+ if (newStyles) element.css(newStyles);
+ }, true);
+});
+
+/**
+ * @ngdoc directive
+ * @name ngSwitch
+ * @restrict EA
+ *
+ * @description
+ * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.
+ * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location
+ * as specified in the template.
+ *
+ * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
+ * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element
+ * matches the value obtained from the evaluated expression. In other words, you define a container element
+ * (where you place the directive), place an expression on the **`on="..."` attribute**
+ * (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place
+ * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on
+ * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default
+ * attribute is displayed.
+ *
+ * <div class="alert alert-info">
+ * Be aware that the attribute values to match against cannot be expressions. They are interpreted
+ * as literal string values to match against.
+ * For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the
+ * value of the expression `$scope.someVal`.
+ * </div>
+
+ * @animations
+ * enter - happens after the ngSwitch contents change and the matched child element is placed inside the container
+ * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM
+ *
+ * @usage
+ *
+ * ```
+ * <ANY ng-switch="expression">
+ * <ANY ng-switch-when="matchValue1">...</ANY>
+ * <ANY ng-switch-when="matchValue2">...</ANY>
+ * <ANY ng-switch-default>...</ANY>
+ * </ANY>
+ * ```
+ *
+ *
+ * @scope
+ * @priority 1200
+ * @param {*} ngSwitch|on expression to match against <code>ng-switch-when</code>.
+ * On child elements add:
+ *
+ * * `ngSwitchWhen`: the case statement to match against. If match then this
+ * case will be displayed. If the same match appears multiple times, all the
+ * elements will be displayed.
+ * * `ngSwitchDefault`: the default case when no other case match. If there
+ * are multiple default cases, all of them will be displayed when no other
+ * case match.
+ *
+ *
+ * @example
+ <example module="switchExample" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <select ng-model="selection" ng-options="item for item in items">
+ </select>
+ <code>selection={{selection}}</code>
+ <hr/>
+ <div class="animate-switch-container"
+ ng-switch on="selection">
+ <div class="animate-switch" ng-switch-when="settings">Settings Div</div>
+ <div class="animate-switch" ng-switch-when="home">Home Span</div>
+ <div class="animate-switch" ng-switch-default>default</div>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('switchExample', ['ngAnimate'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.items = ['settings', 'home', 'other'];
+ $scope.selection = $scope.items[0];
+ }]);
+ </file>
+ <file name="animations.css">
+ .animate-switch-container {
+ position:relative;
+ background:white;
+ border:1px solid black;
+ height:40px;
+ overflow:hidden;
+ }
+
+ .animate-switch {
+ padding:10px;
+ }
+
+ .animate-switch.ng-animate {
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+
+ position:absolute;
+ top:0;
+ left:0;
+ right:0;
+ bottom:0;
+ }
+
+ .animate-switch.ng-leave.ng-leave-active,
+ .animate-switch.ng-enter {
+ top:-50px;
+ }
+ .animate-switch.ng-leave,
+ .animate-switch.ng-enter.ng-enter-active {
+ top:0;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var switchElem = element(by.css('[ng-switch]'));
+ var select = element(by.model('selection'));
+
+ it('should start in settings', function() {
+ expect(switchElem.getText()).toMatch(/Settings Div/);
+ });
+ it('should change to home', function() {
+ select.all(by.css('option')).get(1).click();
+ expect(switchElem.getText()).toMatch(/Home Span/);
+ });
+ it('should select default', function() {
+ select.all(by.css('option')).get(2).click();
+ expect(switchElem.getText()).toMatch(/default/);
+ });
+ </file>
+ </example>
+ */
+var ngSwitchDirective = ['$animate', function($animate) {
+ return {
+ require: 'ngSwitch',
+
+ // asks for $scope to fool the BC controller module
+ controller: ['$scope', function ngSwitchController() {
+ this.cases = {};
+ }],
+ link: function(scope, element, attr, ngSwitchController) {
+ var watchExpr = attr.ngSwitch || attr.on,
+ selectedTranscludes = [],
+ selectedElements = [],
+ previousLeaveAnimations = [],
+ selectedScopes = [];
+
+ var spliceFactory = function(array, index) {
+ return function() { array.splice(index, 1); };
+ };
+
+ scope.$watch(watchExpr, function ngSwitchWatchAction(value) {
+ var i, ii;
+ for (i = 0, ii = previousLeaveAnimations.length; i < ii; ++i) {
+ $animate.cancel(previousLeaveAnimations[i]);
+ }
+ previousLeaveAnimations.length = 0;
+
+ for (i = 0, ii = selectedScopes.length; i < ii; ++i) {
+ var selected = getBlockNodes(selectedElements[i].clone);
+ selectedScopes[i].$destroy();
+ var promise = previousLeaveAnimations[i] = $animate.leave(selected);
+ promise.then(spliceFactory(previousLeaveAnimations, i));
+ }
+
+ selectedElements.length = 0;
+ selectedScopes.length = 0;
+
+ if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {
+ forEach(selectedTranscludes, function(selectedTransclude) {
+ selectedTransclude.transclude(function(caseElement, selectedScope) {
+ selectedScopes.push(selectedScope);
+ var anchor = selectedTransclude.element;
+ caseElement[caseElement.length++] = document.createComment(' end ngSwitchWhen: ');
+ var block = { clone: caseElement };
+
+ selectedElements.push(block);
+ $animate.enter(caseElement, anchor.parent(), anchor);
+ });
+ });
+ }
+ });
+ }
+ };
+}];
+
+var ngSwitchWhenDirective = ngDirective({
+ transclude: 'element',
+ priority: 1200,
+ require: '^ngSwitch',
+ multiElement: true,
+ link: function(scope, element, attrs, ctrl, $transclude) {
+ ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);
+ ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });
+ }
+});
+
+var ngSwitchDefaultDirective = ngDirective({
+ transclude: 'element',
+ priority: 1200,
+ require: '^ngSwitch',
+ multiElement: true,
+ link: function(scope, element, attr, ctrl, $transclude) {
+ ctrl.cases['?'] = (ctrl.cases['?'] || []);
+ ctrl.cases['?'].push({ transclude: $transclude, element: element });
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngTransclude
+ * @restrict EAC
+ *
+ * @description
+ * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
+ *
+ * You can specify that you want to insert a named transclusion slot, instead of the default slot, by providing the slot name
+ * as the value of the `ng-transclude` or `ng-transclude-slot` attribute.
+ *
+ * If the transcluded content is not empty (i.e. contains one or more DOM nodes, including whitespace text nodes), any existing
+ * content of this element will be removed before the transcluded content is inserted.
+ * If the transcluded content is empty, the existing content is left intact. This lets you provide fallback content in the case
+ * that no transcluded content is provided.
+ *
+ * @element ANY
+ *
+ * @param {string} ngTransclude|ngTranscludeSlot the name of the slot to insert at this point. If this is not provided, is empty
+ * or its value is the same as the name of the attribute then the default slot is used.
+ *
+ * @example
+ * ### Basic transclusion
+ * This example demonstrates basic transclusion of content into a component directive.
+ * <example name="simpleTranscludeExample" module="transcludeExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('transcludeExample', [])
+ * .directive('pane', function(){
+ * return {
+ * restrict: 'E',
+ * transclude: true,
+ * scope: { title:'@' },
+ * template: '<div style="border: 1px solid black;">' +
+ * '<div style="background-color: gray">{{title}}</div>' +
+ * '<ng-transclude></ng-transclude>' +
+ * '</div>'
+ * };
+ * })
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.title = 'Lorem Ipsum';
+ * $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <input ng-model="title" aria-label="title"> <br/>
+ * <textarea ng-model="text" aria-label="text"></textarea> <br/>
+ * <pane title="{{title}}">{{text}}</pane>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should have transcluded', function() {
+ * var titleElement = element(by.model('title'));
+ * titleElement.clear();
+ * titleElement.sendKeys('TITLE');
+ * var textElement = element(by.model('text'));
+ * textElement.clear();
+ * textElement.sendKeys('TEXT');
+ * expect(element(by.binding('title')).getText()).toEqual('TITLE');
+ * expect(element(by.binding('text')).getText()).toEqual('TEXT');
+ * });
+ * </file>
+ * </example>
+ *
+ * @example
+ * ### Transclude fallback content
+ * This example shows how to use `NgTransclude` with fallback content, that
+ * is displayed if no transcluded content is provided.
+ *
+ * <example module="transcludeFallbackContentExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('transcludeFallbackContentExample', [])
+ * .directive('myButton', function(){
+ * return {
+ * restrict: 'E',
+ * transclude: true,
+ * scope: true,
+ * template: '<button style="cursor: pointer;">' +
+ * '<ng-transclude>' +
+ * '<b style="color: red;">Button1</b>' +
+ * '</ng-transclude>' +
+ * '</button>'
+ * };
+ * });
+ * </script>
+ * <!-- fallback button content -->
+ * <my-button id="fallback"></my-button>
+ * <!-- modified button content -->
+ * <my-button id="modified">
+ * <i style="color: green;">Button2</i>
+ * </my-button>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should have different transclude element content', function() {
+ * expect(element(by.id('fallback')).getText()).toBe('Button1');
+ * expect(element(by.id('modified')).getText()).toBe('Button2');
+ * });
+ * </file>
+ * </example>
+ *
+ * @example
+ * ### Multi-slot transclusion
+ * This example demonstrates using multi-slot transclusion in a component directive.
+ * <example name="multiSlotTranscludeExample" module="multiSlotTranscludeExample">
+ * <file name="index.html">
+ * <style>
+ * .title, .footer {
+ * background-color: gray
+ * }
+ * </style>
+ * <div ng-controller="ExampleController">
+ * <input ng-model="title" aria-label="title"> <br/>
+ * <textarea ng-model="text" aria-label="text"></textarea> <br/>
+ * <pane>
+ * <pane-title><a ng-href="{{link}}">{{title}}</a></pane-title>
+ * <pane-body><p>{{text}}</p></pane-body>
+ * </pane>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('multiSlotTranscludeExample', [])
+ * .directive('pane', function(){
+ * return {
+ * restrict: 'E',
+ * transclude: {
+ * 'title': '?paneTitle',
+ * 'body': 'paneBody',
+ * 'footer': '?paneFooter'
+ * },
+ * template: '<div style="border: 1px solid black;">' +
+ * '<div class="title" ng-transclude="title">Fallback Title</div>' +
+ * '<div ng-transclude="body"></div>' +
+ * '<div class="footer" ng-transclude="footer">Fallback Footer</div>' +
+ * '</div>'
+ * };
+ * })
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.title = 'Lorem Ipsum';
+ * $scope.link = "https://google.com";
+ * $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
+ * }]);
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should have transcluded the title and the body', function() {
+ * var titleElement = element(by.model('title'));
+ * titleElement.clear();
+ * titleElement.sendKeys('TITLE');
+ * var textElement = element(by.model('text'));
+ * textElement.clear();
+ * textElement.sendKeys('TEXT');
+ * expect(element(by.css('.title')).getText()).toEqual('TITLE');
+ * expect(element(by.binding('text')).getText()).toEqual('TEXT');
+ * expect(element(by.css('.footer')).getText()).toEqual('Fallback Footer');
+ * });
+ * </file>
+ * </example>
+ */
+var ngTranscludeMinErr = minErr('ngTransclude');
+var ngTranscludeDirective = ngDirective({
+ restrict: 'EAC',
+ link: function($scope, $element, $attrs, controller, $transclude) {
+
+ if ($attrs.ngTransclude === $attrs.$attr.ngTransclude) {
+ // If the attribute is of the form: `ng-transclude="ng-transclude"`
+ // then treat it like the default
+ $attrs.ngTransclude = '';
+ }
+
+ function ngTranscludeCloneAttachFn(clone) {
+ if (clone.length) {
+ $element.empty();
+ $element.append(clone);
+ }
+ }
+
+ if (!$transclude) {
+ throw ngTranscludeMinErr('orphan',
+ 'Illegal use of ngTransclude directive in the template! ' +
+ 'No parent directive that requires a transclusion found. ' +
+ 'Element: {0}',
+ startingTag($element));
+ }
+
+ // If there is no slot name defined or the slot name is not optional
+ // then transclude the slot
+ var slotName = $attrs.ngTransclude || $attrs.ngTranscludeSlot;
+ $transclude(ngTranscludeCloneAttachFn, null, slotName);
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name script
+ * @restrict E
+ *
+ * @description
+ * Load the content of a `<script>` element into {@link ng.$templateCache `$templateCache`}, so that the
+ * template can be used by {@link ng.directive:ngInclude `ngInclude`},
+ * {@link ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the
+ * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be
+ * assigned through the element's `id`, which can then be used as a directive's `templateUrl`.
+ *
+ * @param {string} type Must be set to `'text/ng-template'`.
+ * @param {string} id Cache name of the template.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <script type="text/ng-template" id="/tpl.html">
+ Content of the template.
+ </script>
+
+ <a ng-click="currentTpl='/tpl.html'" id="tpl-link">Load inlined template</a>
+ <div id="tpl-content" ng-include src="currentTpl"></div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should load template defined inside script tag', function() {
+ element(by.css('#tpl-link')).click();
+ expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);
+ });
+ </file>
+ </example>
+ */
+var scriptDirective = ['$templateCache', function($templateCache) {
+ return {
+ restrict: 'E',
+ terminal: true,
+ compile: function(element, attr) {
+ if (attr.type == 'text/ng-template') {
+ var templateUrl = attr.id,
+ text = element[0].text;
+
+ $templateCache.put(templateUrl, text);
+ }
+ }
+ };
+}];
+
+var noopNgModelController = { $setViewValue: noop, $render: noop };
+
+function chromeHack(optionElement) {
+ // Workaround for https://code.google.com/p/chromium/issues/detail?id=381459
+ // Adding an <option selected="selected"> element to a <select required="required"> should
+ // automatically select the new element
+ if (optionElement[0].hasAttribute('selected')) {
+ optionElement[0].selected = true;
+ }
+}
+
+/**
+ * @ngdoc type
+ * @name select.SelectController
+ * @description
+ * The controller for the `<select>` directive. This provides support for reading
+ * and writing the selected value(s) of the control and also coordinates dynamically
+ * added `<option>` elements, perhaps by an `ngRepeat` directive.
+ */
+var SelectController =
+ ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {
+
+ var self = this,
+ optionsMap = new HashMap();
+
+ // If the ngModel doesn't get provided then provide a dummy noop version to prevent errors
+ self.ngModelCtrl = noopNgModelController;
+
+ // The "unknown" option is one that is prepended to the list if the viewValue
+ // does not match any of the options. When it is rendered the value of the unknown
+ // option is '? XXX ?' where XXX is the hashKey of the value that is not known.
+ //
+ // We can't just jqLite('<option>') since jqLite is not smart enough
+ // to create it in <select> and IE barfs otherwise.
+ self.unknownOption = jqLite(document.createElement('option'));
+ self.renderUnknownOption = function(val) {
+ var unknownVal = '? ' + hashKey(val) + ' ?';
+ self.unknownOption.val(unknownVal);
+ $element.prepend(self.unknownOption);
+ $element.val(unknownVal);
+ };
+
+ $scope.$on('$destroy', function() {
+ // disable unknown option so that we don't do work when the whole select is being destroyed
+ self.renderUnknownOption = noop;
+ });
+
+ self.removeUnknownOption = function() {
+ if (self.unknownOption.parent()) self.unknownOption.remove();
+ };
+
+
+ // Read the value of the select control, the implementation of this changes depending
+ // upon whether the select can have multiple values and whether ngOptions is at work.
+ self.readValue = function readSingleValue() {
+ self.removeUnknownOption();
+ return $element.val();
+ };
+
+
+ // Write the value to the select control, the implementation of this changes depending
+ // upon whether the select can have multiple values and whether ngOptions is at work.
+ self.writeValue = function writeSingleValue(value) {
+ if (self.hasOption(value)) {
+ self.removeUnknownOption();
+ $element.val(value);
+ if (value === '') self.emptyOption.prop('selected', true); // to make IE9 happy
+ } else {
+ if (value == null && self.emptyOption) {
+ self.removeUnknownOption();
+ $element.val('');
+ } else {
+ self.renderUnknownOption(value);
+ }
+ }
+ };
+
+
+ // Tell the select control that an option, with the given value, has been added
+ self.addOption = function(value, element) {
+ // Skip comment nodes, as they only pollute the `optionsMap`
+ if (element[0].nodeType === NODE_TYPE_COMMENT) return;
+
+ assertNotHasOwnProperty(value, '"option value"');
+ if (value === '') {
+ self.emptyOption = element;
+ }
+ var count = optionsMap.get(value) || 0;
+ optionsMap.put(value, count + 1);
+ self.ngModelCtrl.$render();
+ chromeHack(element);
+ };
+
+ // Tell the select control that an option, with the given value, has been removed
+ self.removeOption = function(value) {
+ var count = optionsMap.get(value);
+ if (count) {
+ if (count === 1) {
+ optionsMap.remove(value);
+ if (value === '') {
+ self.emptyOption = undefined;
+ }
+ } else {
+ optionsMap.put(value, count - 1);
+ }
+ }
+ };
+
+ // Check whether the select control has an option matching the given value
+ self.hasOption = function(value) {
+ return !!optionsMap.get(value);
+ };
+
+
+ self.registerOption = function(optionScope, optionElement, optionAttrs, interpolateValueFn, interpolateTextFn) {
+
+ if (interpolateValueFn) {
+ // The value attribute is interpolated
+ var oldVal;
+ optionAttrs.$observe('value', function valueAttributeObserveAction(newVal) {
+ if (isDefined(oldVal)) {
+ self.removeOption(oldVal);
+ }
+ oldVal = newVal;
+ self.addOption(newVal, optionElement);
+ });
+ } else if (interpolateTextFn) {
+ // The text content is interpolated
+ optionScope.$watch(interpolateTextFn, function interpolateWatchAction(newVal, oldVal) {
+ optionAttrs.$set('value', newVal);
+ if (oldVal !== newVal) {
+ self.removeOption(oldVal);
+ }
+ self.addOption(newVal, optionElement);
+ });
+ } else {
+ // The value attribute is static
+ self.addOption(optionAttrs.value, optionElement);
+ }
+
+ optionElement.on('$destroy', function() {
+ self.removeOption(optionAttrs.value);
+ self.ngModelCtrl.$render();
+ });
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name select
+ * @restrict E
+ *
+ * @description
+ * HTML `SELECT` element with angular data-binding.
+ *
+ * The `select` directive is used together with {@link ngModel `ngModel`} to provide data-binding
+ * between the scope and the `<select>` control (including setting default values).
+ * It also handles dynamic `<option>` elements, which can be added using the {@link ngRepeat `ngRepeat}` or
+ * {@link ngOptions `ngOptions`} directives.
+ *
+ * When an item in the `<select>` menu is selected, the value of the selected option will be bound
+ * to the model identified by the `ngModel` directive. With static or repeated options, this is
+ * the content of the `value` attribute or the textContent of the `<option>`, if the value attribute is missing.
+ * If you want dynamic value attributes, you can use interpolation inside the value attribute.
+ *
+ * <div class="alert alert-warning">
+ * Note that the value of a `select` directive used without `ngOptions` is always a string.
+ * When the model needs to be bound to a non-string value, you must either explicitly convert it
+ * using a directive (see example below) or use `ngOptions` to specify the set of options.
+ * This is because an option element can only be bound to string values at present.
+ * </div>
+ *
+ * If the viewValue of `ngModel` does not match any of the options, then the control
+ * will automatically add an "unknown" option, which it then removes when the mismatch is resolved.
+ *
+ * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can
+ * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
+ * option. See example below for demonstration.
+ *
+ * <div class="alert alert-info">
+ * In many cases, `ngRepeat` can be used on `<option>` elements instead of {@link ng.directive:ngOptions
+ * ngOptions} to achieve a similar result. However, `ngOptions` provides some benefits, such as
+ * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the
+ * comprehension expression, and additionally in reducing memory and increasing speed by not creating
+ * a new scope for each repeated instance.
+ * </div>
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} multiple Allows multiple options to be selected. The selected values will be
+ * bound to the model as an array.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds required attribute and required validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use ngRequired instead of required
+ * when you want to data-bind to the required attribute.
+ * @param {string=} ngChange Angular expression to be executed when selected option(s) changes due to user
+ * interaction with the select element.
+ * @param {string=} ngOptions sets the options that the select is populated with and defines what is
+ * set on the model on selection. See {@link ngOptions `ngOptions`}.
+ *
+ * @example
+ * ### Simple `select` elements with static options
+ *
+ * <example name="static-select" module="staticSelect">
+ * <file name="index.html">
+ * <div ng-controller="ExampleController">
+ * <form name="myForm">
+ * <label for="singleSelect"> Single select: </label><br>
+ * <select name="singleSelect" ng-model="data.singleSelect">
+ * <option value="option-1">Option 1</option>
+ * <option value="option-2">Option 2</option>
+ * </select><br>
+ *
+ * <label for="singleSelect"> Single select with "not selected" option and dynamic option values: </label><br>
+ * <select name="singleSelect" id="singleSelect" ng-model="data.singleSelect">
+ * <option value="">---Please select---</option> <!-- not selected / blank option -->
+ * <option value="{{data.option1}}">Option 1</option> <!-- interpolation -->
+ * <option value="option-2">Option 2</option>
+ * </select><br>
+ * <button ng-click="forceUnknownOption()">Force unknown option</button><br>
+ * <tt>singleSelect = {{data.singleSelect}}</tt>
+ *
+ * <hr>
+ * <label for="multipleSelect"> Multiple select: </label><br>
+ * <select name="multipleSelect" id="multipleSelect" ng-model="data.multipleSelect" multiple>
+ * <option value="option-1">Option 1</option>
+ * <option value="option-2">Option 2</option>
+ * <option value="option-3">Option 3</option>
+ * </select><br>
+ * <tt>multipleSelect = {{data.multipleSelect}}</tt><br/>
+ * </form>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('staticSelect', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.data = {
+ * singleSelect: null,
+ * multipleSelect: [],
+ * option1: 'option-1',
+ * };
+ *
+ * $scope.forceUnknownOption = function() {
+ * $scope.data.singleSelect = 'nonsense';
+ * };
+ * }]);
+ * </file>
+ *</example>
+ *
+ * ### Using `ngRepeat` to generate `select` options
+ * <example name="ngrepeat-select" module="ngrepeatSelect">
+ * <file name="index.html">
+ * <div ng-controller="ExampleController">
+ * <form name="myForm">
+ * <label for="repeatSelect"> Repeat select: </label>
+ * <select name="repeatSelect" id="repeatSelect" ng-model="data.repeatSelect">
+ * <option ng-repeat="option in data.availableOptions" value="{{option.id}}">{{option.name}}</option>
+ * </select>
+ * </form>
+ * <hr>
+ * <tt>repeatSelect = {{data.repeatSelect}}</tt><br/>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('ngrepeatSelect', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.data = {
+ * repeatSelect: null,
+ * availableOptions: [
+ * {id: '1', name: 'Option A'},
+ * {id: '2', name: 'Option B'},
+ * {id: '3', name: 'Option C'}
+ * ],
+ * };
+ * }]);
+ * </file>
+ *</example>
+ *
+ *
+ * ### Using `select` with `ngOptions` and setting a default value
+ * See the {@link ngOptions ngOptions documentation} for more `ngOptions` usage examples.
+ *
+ * <example name="select-with-default-values" module="defaultValueSelect">
+ * <file name="index.html">
+ * <div ng-controller="ExampleController">
+ * <form name="myForm">
+ * <label for="mySelect">Make a choice:</label>
+ * <select name="mySelect" id="mySelect"
+ * ng-options="option.name for option in data.availableOptions track by option.id"
+ * ng-model="data.selectedOption"></select>
+ * </form>
+ * <hr>
+ * <tt>option = {{data.selectedOption}}</tt><br/>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('defaultValueSelect', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.data = {
+ * availableOptions: [
+ * {id: '1', name: 'Option A'},
+ * {id: '2', name: 'Option B'},
+ * {id: '3', name: 'Option C'}
+ * ],
+ * selectedOption: {id: '3', name: 'Option C'} //This sets the default value of the select in the ui
+ * };
+ * }]);
+ * </file>
+ *</example>
+ *
+ *
+ * ### Binding `select` to a non-string value via `ngModel` parsing / formatting
+ *
+ * <example name="select-with-non-string-options" module="nonStringSelect">
+ * <file name="index.html">
+ * <select ng-model="model.id" convert-to-number>
+ * <option value="0">Zero</option>
+ * <option value="1">One</option>
+ * <option value="2">Two</option>
+ * </select>
+ * {{ model }}
+ * </file>
+ * <file name="app.js">
+ * angular.module('nonStringSelect', [])
+ * .run(function($rootScope) {
+ * $rootScope.model = { id: 2 };
+ * })
+ * .directive('convertToNumber', function() {
+ * return {
+ * require: 'ngModel',
+ * link: function(scope, element, attrs, ngModel) {
+ * ngModel.$parsers.push(function(val) {
+ * return parseInt(val, 10);
+ * });
+ * ngModel.$formatters.push(function(val) {
+ * return '' + val;
+ * });
+ * }
+ * };
+ * });
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should initialize to model', function() {
+ * var select = element(by.css('select'));
+ * expect(element(by.model('model.id')).$('option:checked').getText()).toEqual('Two');
+ * });
+ * </file>
+ * </example>
+ *
+ */
+var selectDirective = function() {
+
+ return {
+ restrict: 'E',
+ require: ['select', '?ngModel'],
+ controller: SelectController,
+ priority: 1,
+ link: {
+ pre: selectPreLink,
+ post: selectPostLink
+ }
+ };
+
+ function selectPreLink(scope, element, attr, ctrls) {
+
+ // if ngModel is not defined, we don't need to do anything
+ var ngModelCtrl = ctrls[1];
+ if (!ngModelCtrl) return;
+
+ var selectCtrl = ctrls[0];
+
+ selectCtrl.ngModelCtrl = ngModelCtrl;
+
+ // When the selected item(s) changes we delegate getting the value of the select control
+ // to the `readValue` method, which can be changed if the select can have multiple
+ // selected values or if the options are being generated by `ngOptions`
+ element.on('change', function() {
+ scope.$apply(function() {
+ ngModelCtrl.$setViewValue(selectCtrl.readValue());
+ });
+ });
+
+ // If the select allows multiple values then we need to modify how we read and write
+ // values from and to the control; also what it means for the value to be empty and
+ // we have to add an extra watch since ngModel doesn't work well with arrays - it
+ // doesn't trigger rendering if only an item in the array changes.
+ if (attr.multiple) {
+
+ // Read value now needs to check each option to see if it is selected
+ selectCtrl.readValue = function readMultipleValue() {
+ var array = [];
+ forEach(element.find('option'), function(option) {
+ if (option.selected) {
+ array.push(option.value);
+ }
+ });
+ return array;
+ };
+
+ // Write value now needs to set the selected property of each matching option
+ selectCtrl.writeValue = function writeMultipleValue(value) {
+ var items = new HashMap(value);
+ forEach(element.find('option'), function(option) {
+ option.selected = isDefined(items.get(option.value));
+ });
+ };
+
+ // we have to do it on each watch since ngModel watches reference, but
+ // we need to work of an array, so we need to see if anything was inserted/removed
+ var lastView, lastViewRef = NaN;
+ scope.$watch(function selectMultipleWatch() {
+ if (lastViewRef === ngModelCtrl.$viewValue && !equals(lastView, ngModelCtrl.$viewValue)) {
+ lastView = shallowCopy(ngModelCtrl.$viewValue);
+ ngModelCtrl.$render();
+ }
+ lastViewRef = ngModelCtrl.$viewValue;
+ });
+
+ // If we are a multiple select then value is now a collection
+ // so the meaning of $isEmpty changes
+ ngModelCtrl.$isEmpty = function(value) {
+ return !value || value.length === 0;
+ };
+
+ }
+ }
+
+ function selectPostLink(scope, element, attrs, ctrls) {
+ // if ngModel is not defined, we don't need to do anything
+ var ngModelCtrl = ctrls[1];
+ if (!ngModelCtrl) return;
+
+ var selectCtrl = ctrls[0];
+
+ // We delegate rendering to the `writeValue` method, which can be changed
+ // if the select can have multiple selected values or if the options are being
+ // generated by `ngOptions`.
+ // This must be done in the postLink fn to prevent $render to be called before
+ // all nodes have been linked correctly.
+ ngModelCtrl.$render = function() {
+ selectCtrl.writeValue(ngModelCtrl.$viewValue);
+ };
+ }
+};
+
+
+// The option directive is purely designed to communicate the existence (or lack of)
+// of dynamically created (and destroyed) option elements to their containing select
+// directive via its controller.
+var optionDirective = ['$interpolate', function($interpolate) {
+ return {
+ restrict: 'E',
+ priority: 100,
+ compile: function(element, attr) {
+ if (isDefined(attr.value)) {
+ // If the value attribute is defined, check if it contains an interpolation
+ var interpolateValueFn = $interpolate(attr.value, true);
+ } else {
+ // If the value attribute is not defined then we fall back to the
+ // text content of the option element, which may be interpolated
+ var interpolateTextFn = $interpolate(element.text(), true);
+ if (!interpolateTextFn) {
+ attr.$set('value', element.text());
+ }
+ }
+
+ return function(scope, element, attr) {
+ // This is an optimization over using ^^ since we don't want to have to search
+ // all the way to the root of the DOM for every single option element
+ var selectCtrlName = '$selectController',
+ parent = element.parent(),
+ selectCtrl = parent.data(selectCtrlName) ||
+ parent.parent().data(selectCtrlName); // in case we are in optgroup
+
+ if (selectCtrl) {
+ selectCtrl.registerOption(scope, element, attr, interpolateValueFn, interpolateTextFn);
+ }
+ };
+ }
+ };
+}];
+
+var styleDirective = valueFn({
+ restrict: 'E',
+ terminal: false
+});
+
+/**
+ * @ngdoc directive
+ * @name ngRequired
+ *
+ * @description
+ *
+ * ngRequired adds the required {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
+ * It is most often used for {@link input `input`} and {@link select `select`} controls, but can also be
+ * applied to custom controls.
+ *
+ * The directive sets the `required` attribute on the element if the Angular expression inside
+ * `ngRequired` evaluates to true. A special directive for setting `required` is necessary because we
+ * cannot use interpolation inside `required`. See the {@link guide/interpolation interpolation guide}
+ * for more info.
+ *
+ * The validator will set the `required` error key to true if the `required` attribute is set and
+ * calling {@link ngModel.NgModelController#$isEmpty `NgModelController.$isEmpty`} with the
+ * {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`} returns `true`. For example, the
+ * `$isEmpty()` implementation for `input[text]` checks the length of the `$viewValue`. When developing
+ * custom controls, `$isEmpty()` can be overwritten to account for a $viewValue that is not string-based.
+ *
+ * @example
+ * <example name="ngRequiredDirective" module="ngRequiredExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('ngRequiredExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.required = true;
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <form name="form">
+ * <label for="required">Toggle required: </label>
+ * <input type="checkbox" ng-model="required" id="required" />
+ * <br>
+ * <label for="input">This input must be filled if `required` is true: </label>
+ * <input type="text" ng-model="model" id="input" name="input" ng-required="required" /><br>
+ * <hr>
+ * required error set? = <code>{{form.input.$error.required}}</code><br>
+ * model = <code>{{model}}</code>
+ * </form>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ var required = element(by.binding('form.input.$error.required'));
+ var model = element(by.binding('model'));
+ var input = element(by.id('input'));
+
+ it('should set the required error', function() {
+ expect(required.getText()).toContain('true');
+
+ input.sendKeys('123');
+ expect(required.getText()).not.toContain('true');
+ expect(model.getText()).toContain('123');
+ });
+ * </file>
+ * </example>
+ */
+var requiredDirective = function() {
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ if (!ctrl) return;
+ attr.required = true; // force truthy in case we are on non input element
+
+ ctrl.$validators.required = function(modelValue, viewValue) {
+ return !attr.required || !ctrl.$isEmpty(viewValue);
+ };
+
+ attr.$observe('required', function() {
+ ctrl.$validate();
+ });
+ }
+ };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngPattern
+ *
+ * @description
+ *
+ * ngPattern adds the pattern {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
+ * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.
+ *
+ * The validator sets the `pattern` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
+ * does not match a RegExp which is obtained by evaluating the Angular expression given in the
+ * `ngPattern` attribute value:
+ * * If the expression evaluates to a RegExp object, then this is used directly.
+ * * If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it
+ * in `^` and `$` characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`.
+ *
+ * <div class="alert alert-info">
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * </div>
+ *
+ * <div class="alert alert-info">
+ * **Note:** This directive is also added when the plain `pattern` attribute is used, with two
+ * differences:
+ * <ol>
+ * <li>
+ * `ngPattern` does not set the `pattern` attribute and therefore HTML5 constraint validation is
+ * not available.
+ * </li>
+ * <li>
+ * The `ngPattern` attribute must be an expression, while the `pattern` value must be
+ * interpolated.
+ * </li>
+ * </ol>
+ * </div>
+ *
+ * @example
+ * <example name="ngPatternDirective" module="ngPatternExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('ngPatternExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.regex = '\\d+';
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <form name="form">
+ * <label for="regex">Set a pattern (regex string): </label>
+ * <input type="text" ng-model="regex" id="regex" />
+ * <br>
+ * <label for="input">This input is restricted by the current pattern: </label>
+ * <input type="text" ng-model="model" id="input" name="input" ng-pattern="regex" /><br>
+ * <hr>
+ * input valid? = <code>{{form.input.$valid}}</code><br>
+ * model = <code>{{model}}</code>
+ * </form>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ var model = element(by.binding('model'));
+ var input = element(by.id('input'));
+
+ it('should validate the input with the default pattern', function() {
+ input.sendKeys('aaa');
+ expect(model.getText()).not.toContain('aaa');
+
+ input.clear().then(function() {
+ input.sendKeys('123');
+ expect(model.getText()).toContain('123');
+ });
+ });
+ * </file>
+ * </example>
+ */
+var patternDirective = function() {
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ if (!ctrl) return;
+
+ var regexp, patternExp = attr.ngPattern || attr.pattern;
+ attr.$observe('pattern', function(regex) {
+ if (isString(regex) && regex.length > 0) {
+ regex = new RegExp('^' + regex + '$');
+ }
+
+ if (regex && !regex.test) {
+ throw minErr('ngPattern')('noregexp',
+ 'Expected {0} to be a RegExp but was {1}. Element: {2}', patternExp,
+ regex, startingTag(elm));
+ }
+
+ regexp = regex || undefined;
+ ctrl.$validate();
+ });
+
+ ctrl.$validators.pattern = function(modelValue, viewValue) {
+ // HTML5 pattern constraint validates the input value, so we validate the viewValue
+ return ctrl.$isEmpty(viewValue) || isUndefined(regexp) || regexp.test(viewValue);
+ };
+ }
+ };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngMaxlength
+ *
+ * @description
+ *
+ * ngMaxlength adds the maxlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
+ * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.
+ *
+ * The validator sets the `maxlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
+ * is longer than the integer obtained by evaluating the Angular expression given in the
+ * `ngMaxlength` attribute value.
+ *
+ * <div class="alert alert-info">
+ * **Note:** This directive is also added when the plain `maxlength` attribute is used, with two
+ * differences:
+ * <ol>
+ * <li>
+ * `ngMaxlength` does not set the `maxlength` attribute and therefore HTML5 constraint
+ * validation is not available.
+ * </li>
+ * <li>
+ * The `ngMaxlength` attribute must be an expression, while the `maxlength` value must be
+ * interpolated.
+ * </li>
+ * </ol>
+ * </div>
+ *
+ * @example
+ * <example name="ngMaxlengthDirective" module="ngMaxlengthExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('ngMaxlengthExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.maxlength = 5;
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <form name="form">
+ * <label for="maxlength">Set a maxlength: </label>
+ * <input type="number" ng-model="maxlength" id="maxlength" />
+ * <br>
+ * <label for="input">This input is restricted by the current maxlength: </label>
+ * <input type="text" ng-model="model" id="input" name="input" ng-maxlength="maxlength" /><br>
+ * <hr>
+ * input valid? = <code>{{form.input.$valid}}</code><br>
+ * model = <code>{{model}}</code>
+ * </form>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ var model = element(by.binding('model'));
+ var input = element(by.id('input'));
+
+ it('should validate the input with the default maxlength', function() {
+ input.sendKeys('abcdef');
+ expect(model.getText()).not.toContain('abcdef');
+
+ input.clear().then(function() {
+ input.sendKeys('abcde');
+ expect(model.getText()).toContain('abcde');
+ });
+ });
+ * </file>
+ * </example>
+ */
+var maxlengthDirective = function() {
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ if (!ctrl) return;
+
+ var maxlength = -1;
+ attr.$observe('maxlength', function(value) {
+ var intVal = toInt(value);
+ maxlength = isNaN(intVal) ? -1 : intVal;
+ ctrl.$validate();
+ });
+ ctrl.$validators.maxlength = function(modelValue, viewValue) {
+ return (maxlength < 0) || ctrl.$isEmpty(viewValue) || (viewValue.length <= maxlength);
+ };
+ }
+ };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngMinlength
+ *
+ * @description
+ *
+ * ngMinlength adds the minlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
+ * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.
+ *
+ * The validator sets the `minlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
+ * is shorter than the integer obtained by evaluating the Angular expression given in the
+ * `ngMinlength` attribute value.
+ *
+ * <div class="alert alert-info">
+ * **Note:** This directive is also added when the plain `minlength` attribute is used, with two
+ * differences:
+ * <ol>
+ * <li>
+ * `ngMinlength` does not set the `minlength` attribute and therefore HTML5 constraint
+ * validation is not available.
+ * </li>
+ * <li>
+ * The `ngMinlength` value must be an expression, while the `minlength` value must be
+ * interpolated.
+ * </li>
+ * </ol>
+ * </div>
+ *
+ * @example
+ * <example name="ngMinlengthDirective" module="ngMinlengthExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('ngMinlengthExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.minlength = 3;
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <form name="form">
+ * <label for="minlength">Set a minlength: </label>
+ * <input type="number" ng-model="minlength" id="minlength" />
+ * <br>
+ * <label for="input">This input is restricted by the current minlength: </label>
+ * <input type="text" ng-model="model" id="input" name="input" ng-minlength="minlength" /><br>
+ * <hr>
+ * input valid? = <code>{{form.input.$valid}}</code><br>
+ * model = <code>{{model}}</code>
+ * </form>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ var model = element(by.binding('model'));
+ var input = element(by.id('input'));
+
+ it('should validate the input with the default minlength', function() {
+ input.sendKeys('ab');
+ expect(model.getText()).not.toContain('ab');
+
+ input.sendKeys('abc');
+ expect(model.getText()).toContain('abc');
+ });
+ * </file>
+ * </example>
+ */
+var minlengthDirective = function() {
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ if (!ctrl) return;
+
+ var minlength = 0;
+ attr.$observe('minlength', function(value) {
+ minlength = toInt(value) || 0;
+ ctrl.$validate();
+ });
+ ctrl.$validators.minlength = function(modelValue, viewValue) {
+ return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;
+ };
+ }
+ };
+};
+
+if (window.angular.bootstrap) {
+ //AngularJS is already loaded, so we can return here...
+ console.log('WARNING: Tried to load angular more than once.');
+ return;
+}
+
+//try to bind to jquery now so that one can write jqLite(document).ready()
+//but we will rebind on bootstrap again.
+bindJQuery();
+
+publishExternalAPI(angular);
+
+angular.module("ngLocale", [], ["$provide", function($provide) {
+var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
+function getDecimals(n) {
+ n = n + '';
+ var i = n.indexOf('.');
+ return (i == -1) ? 0 : n.length - i - 1;
+}
+
+function getVF(n, opt_precision) {
+ var v = opt_precision;
+
+ if (undefined === v) {
+ v = Math.min(getDecimals(n), 3);
+ }
+
+ var base = Math.pow(10, v);
+ var f = ((n * base) | 0) % base;
+ return {v: v, f: f};
+}
+
+$provide.value("$locale", {
+ "DATETIME_FORMATS": {
+ "AMPMS": [
+ "AM",
+ "PM"
+ ],
+ "DAY": [
+ "Sunday",
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday"
+ ],
+ "ERANAMES": [
+ "Before Christ",
+ "Anno Domini"
+ ],
+ "ERAS": [
+ "BC",
+ "AD"
+ ],
+ "FIRSTDAYOFWEEK": 6,
+ "MONTH": [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"
+ ],
+ "SHORTDAY": [
+ "Sun",
+ "Mon",
+ "Tue",
+ "Wed",
+ "Thu",
+ "Fri",
+ "Sat"
+ ],
+ "SHORTMONTH": [
+ "Jan",
+ "Feb",
+ "Mar",
+ "Apr",
+ "May",
+ "Jun",
+ "Jul",
+ "Aug",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dec"
+ ],
+ "STANDALONEMONTH": [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"
+ ],
+ "WEEKENDRANGE": [
+ 5,
+ 6
+ ],
+ "fullDate": "EEEE, MMMM d, y",
+ "longDate": "MMMM d, y",
+ "medium": "MMM d, y h:mm:ss a",
+ "mediumDate": "MMM d, y",
+ "mediumTime": "h:mm:ss a",
+ "short": "M/d/yy h:mm a",
+ "shortDate": "M/d/yy",
+ "shortTime": "h:mm a"
+ },
+ "NUMBER_FORMATS": {
+ "CURRENCY_SYM": "$",
+ "DECIMAL_SEP": ".",
+ "GROUP_SEP": ",",
+ "PATTERNS": [
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "maxFrac": 3,
+ "minFrac": 0,
+ "minInt": 1,
+ "negPre": "-",
+ "negSuf": "",
+ "posPre": "",
+ "posSuf": ""
+ },
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "maxFrac": 2,
+ "minFrac": 2,
+ "minInt": 1,
+ "negPre": "-\u00a4",
+ "negSuf": "",
+ "posPre": "\u00a4",
+ "posSuf": ""
+ }
+ ]
+ },
+ "id": "en-us",
+ "localeID": "en_US",
+ "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
+});
+}]);
+
+/**
+ * Setup file for the Scenario.
+ * Must be first in the compilation/bootstrap list.
+ */
+
+// Public namespace
+angular.scenario = angular.scenario || {};
+
+/**
+ * Expose jQuery (e.g. for custom dsl extensions).
+ */
+angular.scenario.jQuery = _jQuery;
+
+/**
+ * Defines a new output format.
+ *
+ * @param {string} name the name of the new output format
+ * @param {function()} fn function(context, runner) that generates the output
+ */
+angular.scenario.output = angular.scenario.output || function(name, fn) {
+ angular.scenario.output[name] = fn;
+};
+
+/**
+ * Defines a new DSL statement. If your factory function returns a Future
+ * it's returned, otherwise the result is assumed to be a map of functions
+ * for chaining. Chained functions are subject to the same rules.
+ *
+ * Note: All functions on the chain are bound to the chain scope so values
+ * set on "this" in your statement function are available in the chained
+ * functions.
+ *
+ * @param {string} name The name of the statement
+ * @param {function()} fn Factory function(), return a function for
+ * the statement.
+ */
+angular.scenario.dsl = angular.scenario.dsl || function(name, fn) {
+ angular.scenario.dsl[name] = function() {
+ /* jshint -W040 *//* The dsl binds `this` for us when calling chained functions */
+ function executeStatement(statement, args) {
+ var result = statement.apply(this, args);
+ if (angular.isFunction(result) || result instanceof angular.scenario.Future) {
+ return result;
+ }
+ var self = this;
+ var chain = angular.extend({}, result);
+ angular.forEach(chain, function(value, name) {
+ if (angular.isFunction(value)) {
+ chain[name] = function() {
+ return executeStatement.call(self, value, arguments);
+ };
+ } else {
+ chain[name] = value;
+ }
+ });
+ return chain;
+ }
+ var statement = fn.apply(this, arguments);
+ return function() {
+ return executeStatement.call(this, statement, arguments);
+ };
+ };
+};
+
+/**
+ * Defines a new matcher for use with the expects() statement. The value
+ * this.actual (like in Jasmine) is available in your matcher to compare
+ * against. Your function should return a boolean. The future is automatically
+ * created for you.
+ *
+ * @param {string} name The name of the matcher
+ * @param {function()} fn The matching function(expected).
+ */
+angular.scenario.matcher = angular.scenario.matcher || function(name, fn) {
+ angular.scenario.matcher[name] = function(expected) {
+ var description = this.future.name +
+ (this.inverse ? ' not ' : ' ') + name +
+ ' ' + angular.toJson(expected);
+ var self = this;
+ this.addFuture('expect ' + description,
+ function(done) {
+ var error;
+ self.actual = self.future.value;
+ if ((self.inverse && fn.call(self, expected)) ||
+ (!self.inverse && !fn.call(self, expected))) {
+ error = 'expected ' + description +
+ ' but was ' + angular.toJson(self.actual);
+ }
+ done(error);
+ });
+ };
+};
+
+/**
+ * Initialize the scenario runner and run !
+ *
+ * Access global window and document object
+ * Access $runner through closure
+ *
+ * @param {Object=} config Config options
+ */
+angular.scenario.setUpAndRun = function(config) {
+ var href = window.location.href;
+ var body = _jQuery(document.body);
+ var output = [];
+ var objModel = new angular.scenario.ObjectModel($runner);
+
+ if (config && config.scenario_output) {
+ output = config.scenario_output.split(',');
+ }
+
+ angular.forEach(angular.scenario.output, function(fn, name) {
+ if (!output.length || output.indexOf(name) != -1) {
+ var context = body.append('<div></div>').find('div:last');
+ context.attr('id', name);
+ fn.call({}, context, $runner, objModel);
+ }
+ });
+
+ if (!/^http/.test(href) && !/^https/.test(href)) {
+ body.append('<p id="system-error"></p>');
+ body.find('#system-error').text(
+ 'Scenario runner must be run using http or https. The protocol ' +
+ href.split(':')[0] + ':// is not supported.'
+ );
+ return;
+ }
+
+ var appFrame = body.append('<div id="application"></div>').find('#application');
+ var application = new angular.scenario.Application(appFrame);
+
+ $runner.on('RunnerEnd', function() {
+ appFrame.css('display', 'none');
+ appFrame.find('iframe').attr('src', 'about:blank');
+ });
+
+ $runner.on('RunnerError', function(error) {
+ if (window.console) {
+ console.log(formatException(error));
+ } else {
+ // Do something for IE
+ alert(error);
+ }
+ });
+
+ $runner.run(application);
+};
+
+/**
+ * Iterates through list with iterator function that must call the
+ * continueFunction to continue iterating.
+ *
+ * @param {Array} list list to iterate over
+ * @param {function()} iterator Callback function(value, continueFunction)
+ * @param {function()} done Callback function(error, result) called when
+ * iteration finishes or an error occurs.
+ */
+function asyncForEach(list, iterator, done) {
+ var i = 0;
+ function loop(error, index) {
+ if (index && index > i) {
+ i = index;
+ }
+ if (error || i >= list.length) {
+ done(error);
+ } else {
+ try {
+ iterator(list[i++], loop);
+ } catch (e) {
+ done(e);
+ }
+ }
+ }
+ loop();
+}
+
+/**
+ * Formats an exception into a string with the stack trace, but limits
+ * to a specific line length.
+ *
+ * @param {Object} error The exception to format, can be anything throwable
+ * @param {Number=} [maxStackLines=5] max lines of the stack trace to include
+ * default is 5.
+ */
+function formatException(error, maxStackLines) {
+ maxStackLines = maxStackLines || 5;
+ var message = error.toString();
+ if (error.stack) {
+ var stack = error.stack.split('\n');
+ if (stack[0].indexOf(message) === -1) {
+ maxStackLines++;
+ stack.unshift(error.message);
+ }
+ message = stack.slice(0, maxStackLines).join('\n');
+ }
+ return message;
+}
+
+/**
+ * Returns a function that gets the file name and line number from a
+ * location in the stack if available based on the call site.
+ *
+ * Note: this returns another function because accessing .stack is very
+ * expensive in Chrome.
+ *
+ * @param {Number} offset Number of stack lines to skip
+ */
+function callerFile(offset) {
+ var error = new Error();
+
+ return function() {
+ var line = (error.stack || '').split('\n')[offset];
+
+ // Clean up the stack trace line
+ if (line) {
+ if (line.indexOf('@') !== -1) {
+ // Firefox
+ line = line.substring(line.indexOf('@') + 1);
+ } else {
+ // Chrome
+ line = line.substring(line.indexOf('(') + 1).replace(')', '');
+ }
+ }
+
+ return line || '';
+ };
+}
+
+
+/**
+ * Don't use the jQuery trigger method since it works incorrectly.
+ *
+ * jQuery notifies listeners and then changes the state of a checkbox and
+ * does not create a real browser event. A real click changes the state of
+ * the checkbox and then notifies listeners.
+ *
+ * To work around this we instead use our own handler that fires a real event.
+ */
+(function(fn) {
+ // We need a handle to the original trigger function for input tests.
+ var parentTrigger = fn._originalTrigger = fn.trigger;
+ fn.trigger = function(type) {
+ if (/(click|change|keydown|blur|input|mousedown|mouseup)/.test(type)) {
+ var processDefaults = [];
+ this.each(function(index, node) {
+ processDefaults.push(browserTrigger(node, type));
+ });
+
+ // this is not compatible with jQuery - we return an array of returned values,
+ // so that scenario runner know whether JS code has preventDefault() of the event or not...
+ return processDefaults;
+ }
+ return parentTrigger.apply(this, arguments);
+ };
+})(_jQuery.fn);
+
+/**
+ * Finds all bindings with the substring match of name and returns an
+ * array of their values.
+ *
+ * @param {string} bindExp The name to match
+ * @return {Array.<string>} String of binding values
+ */
+_jQuery.fn.bindings = function(windowJquery, bindExp) {
+ var result = [], match,
+ bindSelector = '.ng-binding:visible';
+ if (angular.isString(bindExp)) {
+ bindExp = bindExp.replace(/\s/g, '');
+ match = function(actualExp) {
+ if (actualExp) {
+ actualExp = actualExp.replace(/\s/g, '');
+ if (actualExp == bindExp) return true;
+ if (actualExp.indexOf(bindExp) === 0) {
+ return actualExp.charAt(bindExp.length) == '|';
+ }
+ }
+ };
+ } else if (bindExp) {
+ match = function(actualExp) {
+ return actualExp && bindExp.exec(actualExp);
+ };
+ } else {
+ match = function(actualExp) {
+ return !!actualExp;
+ };
+ }
+ var selection = this.find(bindSelector);
+ if (this.is(bindSelector)) {
+ selection = selection.add(this);
+ }
+
+ function push(value) {
+ if (angular.isUndefined(value)) {
+ value = '';
+ } else if (typeof value !== 'string') {
+ value = angular.toJson(value);
+ }
+ result.push('' + value);
+ }
+
+ selection.each(function() {
+ var element = windowJquery(this),
+ bindings;
+ if (bindings = element.data('$binding')) {
+ for (var expressions = [], binding, j=0, jj=bindings.length; j < jj; j++) {
+ binding = bindings[j];
+
+ if (binding.expressions) {
+ expressions = binding.expressions;
+ } else {
+ expressions = [binding];
+ }
+ for (var scope, expression, i = 0, ii = expressions.length; i < ii; i++) {
+ expression = expressions[i];
+ if (match(expression)) {
+ scope = scope || element.scope();
+ push(scope.$eval(expression));
+ }
+ }
+ }
+ }
+ });
+ return result;
+};
+
+(function() {
+ /**
+ * Triggers a browser event. Attempts to choose the right event if one is
+ * not specified.
+ *
+ * @param {Object} element Either a wrapped jQuery/jqLite node or a DOMElement
+ * @param {string} eventType Optional event type
+ * @param {Object=} eventData An optional object which contains additional event data (such as x,y
+ * coordinates, keys, etc...) that are passed into the event when triggered
+ */
+ window.browserTrigger = function browserTrigger(element, eventType, eventData) {
+ if (element && !element.nodeName) element = element[0];
+ if (!element) return;
+
+ eventData = eventData || {};
+ var relatedTarget = eventData.relatedTarget || element;
+ var keys = eventData.keys;
+ var x = eventData.x;
+ var y = eventData.y;
+
+ var inputType = (element.type) ? element.type.toLowerCase() : null,
+ nodeName = element.nodeName.toLowerCase();
+ if (!eventType) {
+ eventType = {
+ 'text': 'change',
+ 'textarea': 'change',
+ 'hidden': 'change',
+ 'password': 'change',
+ 'button': 'click',
+ 'submit': 'click',
+ 'reset': 'click',
+ 'image': 'click',
+ 'checkbox': 'click',
+ 'radio': 'click',
+ 'select-one': 'change',
+ 'select-multiple': 'change',
+ '_default_': 'click'
+ }[inputType || '_default_'];
+ }
+
+ if (nodeName == 'option') {
+ element.parentNode.value = element.value;
+ element = element.parentNode;
+ eventType = 'change';
+ }
+
+ keys = keys || [];
+ function pressed(key) {
+ return keys.indexOf(key) !== -1;
+ }
+
+ var evnt;
+ if (/transitionend/.test(eventType)) {
+ if (window.WebKitTransitionEvent) {
+ evnt = new WebKitTransitionEvent(eventType, eventData);
+ evnt.initEvent(eventType, false, true);
+ } else {
+ try {
+ evnt = new TransitionEvent(eventType, eventData);
+ }
+ catch (e) {
+ evnt = document.createEvent('TransitionEvent');
+ evnt.initTransitionEvent(eventType, null, null, null, eventData.elapsedTime || 0);
+ }
+ }
+ } else if (/animationend/.test(eventType)) {
+ if (window.WebKitAnimationEvent) {
+ evnt = new WebKitAnimationEvent(eventType, eventData);
+ evnt.initEvent(eventType, false, true);
+ } else {
+ try {
+ evnt = new AnimationEvent(eventType, eventData);
+ }
+ catch (e) {
+ evnt = document.createEvent('AnimationEvent');
+ evnt.initAnimationEvent(eventType, null, null, null, eventData.elapsedTime || 0);
+ }
+ }
+ } else if (/touch/.test(eventType) && supportsTouchEvents()) {
+ evnt = createTouchEvent(element, eventType, x, y);
+ } else {
+ evnt = document.createEvent('MouseEvents');
+ x = x || 0;
+ y = y || 0;
+ evnt.initMouseEvent(eventType, true, true, window, 0, x, y, x, y, pressed('ctrl'),
+ pressed('alt'), pressed('shift'), pressed('meta'), 0, relatedTarget);
+ }
+
+ /* we're unable to change the timeStamp value directly so this
+ * is only here to allow for testing where the timeStamp value is
+ * read */
+ evnt.$manualTimeStamp = eventData.timeStamp;
+
+ if (!evnt) return;
+
+ var originalPreventDefault = evnt.preventDefault,
+ appWindow = element.ownerDocument.defaultView,
+ fakeProcessDefault = true,
+ finalProcessDefault,
+ angular = appWindow.angular || {};
+
+ // igor: temporary fix for https://bugzilla.mozilla.org/show_bug.cgi?id=684208
+ angular['ff-684208-preventDefault'] = false;
+ evnt.preventDefault = function() {
+ fakeProcessDefault = false;
+ return originalPreventDefault.apply(evnt, arguments);
+ };
+
+ element.dispatchEvent(evnt);
+ finalProcessDefault = !(angular['ff-684208-preventDefault'] || !fakeProcessDefault);
+
+ delete angular['ff-684208-preventDefault'];
+
+ return finalProcessDefault;
+ };
+
+ function supportsTouchEvents() {
+ if ('_cached' in supportsTouchEvents) {
+ return supportsTouchEvents._cached;
+ }
+ if (!document.createTouch || !document.createTouchList) {
+ supportsTouchEvents._cached = false;
+ return false;
+ }
+ try {
+ document.createEvent('TouchEvent');
+ } catch (e) {
+ supportsTouchEvents._cached = false;
+ return false;
+ }
+ supportsTouchEvents._cached = true;
+ return true;
+ }
+
+ function createTouchEvent(element, eventType, x, y) {
+ var evnt = new Event(eventType);
+ x = x || 0;
+ y = y || 0;
+
+ var touch = document.createTouch(window, element, Date.now(), x, y, x, y);
+ var touches = document.createTouchList(touch);
+
+ evnt.touches = touches;
+
+ return evnt;
+ }
+}());
+
+/**
+ * Represents the application currently being tested and abstracts usage
+ * of iframes or separate windows.
+ *
+ * @param {Object} context jQuery wrapper around HTML context.
+ */
+angular.scenario.Application = function(context) {
+ this.context = context;
+ context.append(
+ '<h2>Current URL: <a href="about:blank">None</a></h2>' +
+ '<div id="test-frames"></div>'
+ );
+};
+
+/**
+ * Gets the jQuery collection of frames. Don't use this directly because
+ * frames may go stale.
+ *
+ * @private
+ * @return {Object} jQuery collection
+ */
+angular.scenario.Application.prototype.getFrame_ = function() {
+ return this.context.find('#test-frames iframe:last');
+};
+
+/**
+ * Gets the window of the test runner frame. Always favor executeAction()
+ * instead of this method since it prevents you from getting a stale window.
+ *
+ * @private
+ * @return {Object} the window of the frame
+ */
+angular.scenario.Application.prototype.getWindow_ = function() {
+ var contentWindow = this.getFrame_().prop('contentWindow');
+ if (!contentWindow) {
+ throw 'Frame window is not accessible.';
+ }
+ return contentWindow;
+};
+
+/**
+ * Changes the location of the frame.
+ *
+ * @param {string} url The URL. If it begins with a # then only the
+ * hash of the page is changed.
+ * @param {function()} loadFn function($window, $document) Called when frame loads.
+ * @param {function()} errorFn function(error) Called if any error when loading.
+ */
+angular.scenario.Application.prototype.navigateTo = function(url, loadFn, errorFn) {
+ var self = this;
+ var frame = self.getFrame_();
+ //TODO(esprehn): Refactor to use rethrow()
+ errorFn = errorFn || function(e) { throw e; };
+ if (url === 'about:blank') {
+ errorFn('Sandbox Error: Navigating to about:blank is not allowed.');
+ } else if (url.charAt(0) === '#') {
+ url = frame.attr('src').split('#')[0] + url;
+ frame.attr('src', url);
+ self.executeAction(loadFn);
+ } else {
+ frame.remove();
+ self.context.find('#test-frames').append('<iframe>');
+ frame = self.getFrame_();
+
+ frame.load(function() {
+ frame.off();
+ try {
+ var $window = self.getWindow_();
+
+ if (!$window.angular) {
+ self.executeAction(loadFn);
+ return;
+ }
+
+ if (!$window.angular.resumeBootstrap) {
+ $window.angular.resumeDeferredBootstrap = resumeDeferredBootstrap;
+ } else {
+ resumeDeferredBootstrap();
+ }
+
+ } catch (e) {
+ errorFn(e);
+ }
+
+ function resumeDeferredBootstrap() {
+ // Disable animations
+ var $injector = $window.angular.resumeBootstrap([['$provide', function($provide) {
+ return ['$animate', function($animate) {
+ $animate.enabled(false);
+ }];
+ }]]);
+ self.rootElement = $injector.get('$rootElement')[0];
+ self.executeAction(loadFn);
+ }
+ }).attr('src', url);
+
+ // for IE compatibility set the name *after* setting the frame url
+ frame[0].contentWindow.name = "NG_DEFER_BOOTSTRAP!";
+ }
+ self.context.find('> h2 a').attr('href', url).text(url);
+};
+
+/**
+ * Executes a function in the context of the tested application. Will wait
+ * for all pending angular xhr requests before executing.
+ *
+ * @param {function()} action The callback to execute. function($window, $document)
+ * $document is a jQuery wrapped document.
+ */
+angular.scenario.Application.prototype.executeAction = function(action) {
+ var self = this;
+ var $window = this.getWindow_();
+ if (!$window.document) {
+ throw 'Sandbox Error: Application document not accessible.';
+ }
+ if (!$window.angular) {
+ return action.call(this, $window, _jQuery($window.document));
+ }
+
+ if (!!this.rootElement) {
+ executeWithElement(this.rootElement);
+ } else {
+ angularInit($window.document, angular.bind(this, executeWithElement));
+ }
+
+ function executeWithElement(element) {
+ var $injector = $window.angular.element(element).injector();
+ var $element = _jQuery(element);
+
+ $element.injector = function() {
+ return $injector;
+ };
+
+ $injector.invoke(function($browser) {
+ $browser.notifyWhenNoOutstandingRequests(function() {
+ action.call(self, $window, $element);
+ });
+ });
+ }
+};
+
+/**
+ * The representation of define blocks. Don't used directly, instead use
+ * define() in your tests.
+ *
+ * @param {string} descName Name of the block
+ * @param {Object} parent describe or undefined if the root.
+ */
+angular.scenario.Describe = function(descName, parent) {
+ this.only = parent && parent.only;
+ this.beforeEachFns = [];
+ this.afterEachFns = [];
+ this.its = [];
+ this.children = [];
+ this.name = descName;
+ this.parent = parent;
+ this.id = angular.scenario.Describe.id++;
+
+ /**
+ * Calls all before functions.
+ */
+ var beforeEachFns = this.beforeEachFns;
+ this.setupBefore = function() {
+ if (parent) parent.setupBefore.call(this);
+ angular.forEach(beforeEachFns, function(fn) { fn.call(this); }, this);
+ };
+
+ /**
+ * Calls all after functions.
+ */
+ var afterEachFns = this.afterEachFns;
+ this.setupAfter = function() {
+ angular.forEach(afterEachFns, function(fn) { fn.call(this); }, this);
+ if (parent) parent.setupAfter.call(this);
+ };
+};
+
+// Shared Unique ID generator for every describe block
+angular.scenario.Describe.id = 0;
+
+// Shared Unique ID generator for every it (spec)
+angular.scenario.Describe.specId = 0;
+
+/**
+ * Defines a block to execute before each it or nested describe.
+ *
+ * @param {function()} body Body of the block.
+ */
+angular.scenario.Describe.prototype.beforeEach = function(body) {
+ this.beforeEachFns.push(body);
+};
+
+/**
+ * Defines a block to execute after each it or nested describe.
+ *
+ * @param {function()} body Body of the block.
+ */
+angular.scenario.Describe.prototype.afterEach = function(body) {
+ this.afterEachFns.push(body);
+};
+
+/**
+ * Creates a new describe block that's a child of this one.
+ *
+ * @param {string} name Name of the block. Appended to the parent block's name.
+ * @param {function()} body Body of the block.
+ */
+angular.scenario.Describe.prototype.describe = function(name, body) {
+ var child = new angular.scenario.Describe(name, this);
+ this.children.push(child);
+ body.call(child);
+};
+
+/**
+ * Same as describe() but makes ddescribe blocks the only to run.
+ *
+ * @param {string} name Name of the test.
+ * @param {function()} body Body of the block.
+ */
+angular.scenario.Describe.prototype.ddescribe = function(name, body) {
+ var child = new angular.scenario.Describe(name, this);
+ child.only = true;
+ this.children.push(child);
+ body.call(child);
+};
+
+/**
+ * Use to disable a describe block.
+ */
+angular.scenario.Describe.prototype.xdescribe = angular.noop;
+
+/**
+ * Defines a test.
+ *
+ * @param {string} name Name of the test.
+ * @param {function()} body Body of the block.
+ */
+angular.scenario.Describe.prototype.it = function(name, body) {
+ this.its.push({
+ id: angular.scenario.Describe.specId++,
+ definition: this,
+ only: this.only,
+ name: name,
+ before: this.setupBefore,
+ body: body,
+ after: this.setupAfter
+ });
+};
+
+/**
+ * Same as it() but makes iit tests the only test to run.
+ *
+ * @param {string} name Name of the test.
+ * @param {function()} body Body of the block.
+ */
+angular.scenario.Describe.prototype.iit = function(name, body) {
+ this.it.apply(this, arguments);
+ this.its[this.its.length - 1].only = true;
+};
+
+/**
+ * Use to disable a test block.
+ */
+angular.scenario.Describe.prototype.xit = angular.noop;
+
+/**
+ * Gets an array of functions representing all the tests (recursively).
+ * that can be executed with SpecRunner's.
+ *
+ * @return {Array<Object>} Array of it blocks {
+ * definition : Object // parent Describe
+ * only: boolean
+ * name: string
+ * before: Function
+ * body: Function
+ * after: Function
+ * }
+ */
+angular.scenario.Describe.prototype.getSpecs = function() {
+ var specs = arguments[0] || [];
+ angular.forEach(this.children, function(child) {
+ child.getSpecs(specs);
+ });
+ angular.forEach(this.its, function(it) {
+ specs.push(it);
+ });
+ var only = [];
+ angular.forEach(specs, function(it) {
+ if (it.only) {
+ only.push(it);
+ }
+ });
+ return (only.length && only) || specs;
+};
+
+/**
+ * A future action in a spec.
+ *
+ * @param {string} name name of the future action
+ * @param {function()} behavior future callback(error, result)
+ * @param {function()} line Optional. function that returns the file/line number.
+ */
+angular.scenario.Future = function(name, behavior, line) {
+ this.name = name;
+ this.behavior = behavior;
+ this.fulfilled = false;
+ this.value = undefined;
+ this.parser = angular.identity;
+ this.line = line || function() { return ''; };
+};
+
+/**
+ * Executes the behavior of the closure.
+ *
+ * @param {function()} doneFn Callback function(error, result)
+ */
+angular.scenario.Future.prototype.execute = function(doneFn) {
+ var self = this;
+ this.behavior(function(error, result) {
+ self.fulfilled = true;
+ if (result) {
+ try {
+ result = self.parser(result);
+ } catch (e) {
+ error = e;
+ }
+ }
+ self.value = error || result;
+ doneFn(error, result);
+ });
+};
+
+/**
+ * Configures the future to convert its final with a function fn(value)
+ *
+ * @param {function()} fn function(value) that returns the parsed value
+ */
+angular.scenario.Future.prototype.parsedWith = function(fn) {
+ this.parser = fn;
+ return this;
+};
+
+/**
+ * Configures the future to parse its final value from JSON
+ * into objects.
+ */
+angular.scenario.Future.prototype.fromJson = function() {
+ return this.parsedWith(angular.fromJson);
+};
+
+/**
+ * Configures the future to convert its final value from objects
+ * into JSON.
+ */
+angular.scenario.Future.prototype.toJson = function() {
+ return this.parsedWith(angular.toJson);
+};
+
+/**
+ * Maintains an object tree from the runner events.
+ *
+ * @param {Object} runner The scenario Runner instance to connect to.
+ *
+ * TODO(esprehn): Every output type creates one of these, but we probably
+ * want one global shared instance. Need to handle events better too
+ * so the HTML output doesn't need to do spec model.getSpec(spec.id)
+ * silliness.
+ *
+ * TODO(vojta) refactor on, emit methods (from all objects) - use inheritance
+ */
+angular.scenario.ObjectModel = function(runner) {
+ var self = this;
+
+ this.specMap = {};
+ this.listeners = [];
+ this.value = {
+ name: '',
+ children: {}
+ };
+
+ runner.on('SpecBegin', function(spec) {
+ var block = self.value,
+ definitions = [];
+
+ angular.forEach(self.getDefinitionPath(spec), function(def) {
+ if (!block.children[def.name]) {
+ block.children[def.name] = {
+ id: def.id,
+ name: def.name,
+ children: {},
+ specs: {}
+ };
+ }
+ block = block.children[def.name];
+ definitions.push(def.name);
+ });
+
+ var it = self.specMap[spec.id] =
+ block.specs[spec.name] =
+ new angular.scenario.ObjectModel.Spec(spec.id, spec.name, definitions);
+
+ // forward the event
+ self.emit('SpecBegin', it);
+ });
+
+ runner.on('SpecError', function(spec, error) {
+ var it = self.getSpec(spec.id);
+ it.status = 'error';
+ it.error = error;
+
+ // forward the event
+ self.emit('SpecError', it, error);
+ });
+
+ runner.on('SpecEnd', function(spec) {
+ var it = self.getSpec(spec.id);
+ complete(it);
+
+ // forward the event
+ self.emit('SpecEnd', it);
+ });
+
+ runner.on('StepBegin', function(spec, step) {
+ var it = self.getSpec(spec.id);
+ step = new angular.scenario.ObjectModel.Step(step.name);
+ it.steps.push(step);
+
+ // forward the event
+ self.emit('StepBegin', it, step);
+ });
+
+ runner.on('StepEnd', function(spec) {
+ var it = self.getSpec(spec.id);
+ var step = it.getLastStep();
+ if (step.name !== step.name) {
+ throw 'Events fired in the wrong order. Step names don\'t match.';
+ }
+ complete(step);
+
+ // forward the event
+ self.emit('StepEnd', it, step);
+ });
+
+ runner.on('StepFailure', function(spec, step, error) {
+ var it = self.getSpec(spec.id),
+ modelStep = it.getLastStep();
+
+ modelStep.setErrorStatus('failure', error, step.line());
+ it.setStatusFromStep(modelStep);
+
+ // forward the event
+ self.emit('StepFailure', it, modelStep, error);
+ });
+
+ runner.on('StepError', function(spec, step, error) {
+ var it = self.getSpec(spec.id),
+ modelStep = it.getLastStep();
+
+ modelStep.setErrorStatus('error', error, step.line());
+ it.setStatusFromStep(modelStep);
+
+ // forward the event
+ self.emit('StepError', it, modelStep, error);
+ });
+
+ runner.on('RunnerBegin', function() {
+ self.emit('RunnerBegin');
+ });
+ runner.on('RunnerEnd', function() {
+ self.emit('RunnerEnd');
+ });
+
+ function complete(item) {
+ item.endTime = Date.now();
+ item.duration = item.endTime - item.startTime;
+ item.status = item.status || 'success';
+ }
+};
+
+/**
+ * Adds a listener for an event.
+ *
+ * @param {string} eventName Name of the event to add a handler for
+ * @param {function()} listener Function that will be called when event is fired
+ */
+angular.scenario.ObjectModel.prototype.on = function(eventName, listener) {
+ eventName = eventName.toLowerCase();
+ this.listeners[eventName] = this.listeners[eventName] || [];
+ this.listeners[eventName].push(listener);
+};
+
+/**
+ * Emits an event which notifies listeners and passes extra
+ * arguments.
+ *
+ * @param {string} eventName Name of the event to fire.
+ */
+angular.scenario.ObjectModel.prototype.emit = function(eventName) {
+ var self = this,
+ args = Array.prototype.slice.call(arguments, 1);
+
+ eventName = eventName.toLowerCase();
+
+ if (this.listeners[eventName]) {
+ angular.forEach(this.listeners[eventName], function(listener) {
+ listener.apply(self, args);
+ });
+ }
+};
+
+/**
+ * Computes the path of definition describe blocks that wrap around
+ * this spec.
+ *
+ * @param spec Spec to compute the path for.
+ * @return {Array<Describe>} The describe block path
+ */
+angular.scenario.ObjectModel.prototype.getDefinitionPath = function(spec) {
+ var path = [];
+ var currentDefinition = spec.definition;
+ while (currentDefinition && currentDefinition.name) {
+ path.unshift(currentDefinition);
+ currentDefinition = currentDefinition.parent;
+ }
+ return path;
+};
+
+/**
+ * Gets a spec by id.
+ *
+ * @param {string} id The id of the spec to get the object for.
+ * @return {Object} the Spec instance
+ */
+angular.scenario.ObjectModel.prototype.getSpec = function(id) {
+ return this.specMap[id];
+};
+
+/**
+ * A single it block.
+ *
+ * @param {string} id Id of the spec
+ * @param {string} name Name of the spec
+ * @param {Array<string>=} definitionNames List of all describe block names that wrap this spec
+ */
+angular.scenario.ObjectModel.Spec = function(id, name, definitionNames) {
+ this.id = id;
+ this.name = name;
+ this.startTime = Date.now();
+ this.steps = [];
+ this.fullDefinitionName = (definitionNames || []).join(' ');
+};
+
+/**
+ * Adds a new step to the Spec.
+ *
+ * @param {string} name Name of the step (really name of the future)
+ * @return {Object} the added step
+ */
+angular.scenario.ObjectModel.Spec.prototype.addStep = function(name) {
+ var step = new angular.scenario.ObjectModel.Step(name);
+ this.steps.push(step);
+ return step;
+};
+
+/**
+ * Gets the most recent step.
+ *
+ * @return {Object} the step
+ */
+angular.scenario.ObjectModel.Spec.prototype.getLastStep = function() {
+ return this.steps[this.steps.length - 1];
+};
+
+/**
+ * Set status of the Spec from given Step
+ *
+ * @param {angular.scenario.ObjectModel.Step} step
+ */
+angular.scenario.ObjectModel.Spec.prototype.setStatusFromStep = function(step) {
+ if (!this.status || step.status == 'error') {
+ this.status = step.status;
+ this.error = step.error;
+ this.line = step.line;
+ }
+};
+
+/**
+ * A single step inside a Spec.
+ *
+ * @param {string} name Name of the step
+ */
+angular.scenario.ObjectModel.Step = function(name) {
+ this.name = name;
+ this.startTime = Date.now();
+};
+
+/**
+ * Helper method for setting all error status related properties
+ *
+ * @param {string} status
+ * @param {string} error
+ * @param {string} line
+ */
+angular.scenario.ObjectModel.Step.prototype.setErrorStatus = function(status, error, line) {
+ this.status = status;
+ this.error = error;
+ this.line = line;
+};
+
+/**
+ * Runner for scenarios
+ *
+ * Has to be initialized before any test is loaded,
+ * because it publishes the API into window (global space).
+ */
+angular.scenario.Runner = function($window) {
+ this.listeners = [];
+ this.$window = $window;
+ this.rootDescribe = new angular.scenario.Describe();
+ this.currentDescribe = this.rootDescribe;
+ this.api = {
+ it: this.it,
+ iit: this.iit,
+ xit: angular.noop,
+ describe: this.describe,
+ ddescribe: this.ddescribe,
+ xdescribe: angular.noop,
+ beforeEach: this.beforeEach,
+ afterEach: this.afterEach
+ };
+ angular.forEach(this.api, angular.bind(this, function(fn, key) {
+ this.$window[key] = angular.bind(this, fn);
+ }));
+};
+
+/**
+ * Emits an event which notifies listeners and passes extra
+ * arguments.
+ *
+ * @param {string} eventName Name of the event to fire.
+ */
+angular.scenario.Runner.prototype.emit = function(eventName) {
+ var self = this;
+ var args = Array.prototype.slice.call(arguments, 1);
+ eventName = eventName.toLowerCase();
+ if (!this.listeners[eventName]) {
+ return;
+ }
+ angular.forEach(this.listeners[eventName], function(listener) {
+ listener.apply(self, args);
+ });
+};
+
+/**
+ * Adds a listener for an event.
+ *
+ * @param {string} eventName The name of the event to add a handler for
+ * @param {string} listener The fn(...) that takes the extra arguments from emit()
+ */
+angular.scenario.Runner.prototype.on = function(eventName, listener) {
+ eventName = eventName.toLowerCase();
+ this.listeners[eventName] = this.listeners[eventName] || [];
+ this.listeners[eventName].push(listener);
+};
+
+/**
+ * Defines a describe block of a spec.
+ *
+ * @see Describe.js
+ *
+ * @param {string} name Name of the block
+ * @param {function()} body Body of the block
+ */
+angular.scenario.Runner.prototype.describe = function(name, body) {
+ var self = this;
+ this.currentDescribe.describe(name, function() {
+ var parentDescribe = self.currentDescribe;
+ self.currentDescribe = this;
+ try {
+ body.call(this);
+ } finally {
+ self.currentDescribe = parentDescribe;
+ }
+ });
+};
+
+/**
+ * Same as describe, but makes ddescribe the only blocks to run.
+ *
+ * @see Describe.js
+ *
+ * @param {string} name Name of the block
+ * @param {function()} body Body of the block
+ */
+angular.scenario.Runner.prototype.ddescribe = function(name, body) {
+ var self = this;
+ this.currentDescribe.ddescribe(name, function() {
+ var parentDescribe = self.currentDescribe;
+ self.currentDescribe = this;
+ try {
+ body.call(this);
+ } finally {
+ self.currentDescribe = parentDescribe;
+ }
+ });
+};
+
+/**
+ * Defines a test in a describe block of a spec.
+ *
+ * @see Describe.js
+ *
+ * @param {string} name Name of the block
+ * @param {function()} body Body of the block
+ */
+angular.scenario.Runner.prototype.it = function(name, body) {
+ this.currentDescribe.it(name, body);
+};
+
+/**
+ * Same as it, but makes iit tests the only tests to run.
+ *
+ * @see Describe.js
+ *
+ * @param {string} name Name of the block
+ * @param {function()} body Body of the block
+ */
+angular.scenario.Runner.prototype.iit = function(name, body) {
+ this.currentDescribe.iit(name, body);
+};
+
+/**
+ * Defines a function to be called before each it block in the describe
+ * (and before all nested describes).
+ *
+ * @see Describe.js
+ *
+ * @param {function()} Callback to execute
+ */
+angular.scenario.Runner.prototype.beforeEach = function(body) {
+ this.currentDescribe.beforeEach(body);
+};
+
+/**
+ * Defines a function to be called after each it block in the describe
+ * (and before all nested describes).
+ *
+ * @see Describe.js
+ *
+ * @param {function()} Callback to execute
+ */
+angular.scenario.Runner.prototype.afterEach = function(body) {
+ this.currentDescribe.afterEach(body);
+};
+
+/**
+ * Creates a new spec runner.
+ *
+ * @private
+ * @param {Object} scope parent scope
+ */
+angular.scenario.Runner.prototype.createSpecRunner_ = function(scope) {
+ var child = scope.$new();
+ var Cls = angular.scenario.SpecRunner;
+
+ // Export all the methods to child scope manually as now we don't mess controllers with scopes
+ // TODO(vojta): refactor scenario runner so that these objects are not tightly coupled as current
+ for (var name in Cls.prototype) {
+ child[name] = angular.bind(child, Cls.prototype[name]);
+ }
+
+ Cls.call(child);
+ return child;
+};
+
+/**
+ * Runs all the loaded tests with the specified runner class on the
+ * provided application.
+ *
+ * @param {angular.scenario.Application} application App to remote control.
+ */
+angular.scenario.Runner.prototype.run = function(application) {
+ var self = this;
+ var $root = angular.injector(['ng']).get('$rootScope');
+ angular.extend($root, this);
+ angular.forEach(angular.scenario.Runner.prototype, function(fn, name) {
+ $root[name] = angular.bind(self, fn);
+ });
+ $root.application = application;
+ $root.emit('RunnerBegin');
+ asyncForEach(this.rootDescribe.getSpecs(), function(spec, specDone) {
+ var dslCache = {};
+ var runner = self.createSpecRunner_($root);
+ angular.forEach(angular.scenario.dsl, function(fn, key) {
+ dslCache[key] = fn.call($root);
+ });
+ angular.forEach(angular.scenario.dsl, function(fn, key) {
+ self.$window[key] = function() {
+ var line = callerFile(3);
+ var scope = runner.$new();
+
+ // Make the dsl accessible on the current chain
+ scope.dsl = {};
+ angular.forEach(dslCache, function(fn, key) {
+ scope.dsl[key] = function() {
+ return dslCache[key].apply(scope, arguments);
+ };
+ });
+
+ // Make these methods work on the current chain
+ scope.addFuture = function() {
+ Array.prototype.push.call(arguments, line);
+ return angular.scenario.SpecRunner.
+ prototype.addFuture.apply(scope, arguments);
+ };
+ scope.addFutureAction = function() {
+ Array.prototype.push.call(arguments, line);
+ return angular.scenario.SpecRunner.
+ prototype.addFutureAction.apply(scope, arguments);
+ };
+
+ return scope.dsl[key].apply(scope, arguments);
+ };
+ });
+ runner.run(spec, function() {
+ runner.$destroy();
+ specDone.apply(this, arguments);
+ });
+ },
+ function(error) {
+ if (error) {
+ self.emit('RunnerError', error);
+ }
+ self.emit('RunnerEnd');
+ });
+};
+
+/**
+ * This class is the "this" of the it/beforeEach/afterEach method.
+ * Responsibilities:
+ * - "this" for it/beforeEach/afterEach
+ * - keep state for single it/beforeEach/afterEach execution
+ * - keep track of all of the futures to execute
+ * - run single spec (execute each future)
+ */
+angular.scenario.SpecRunner = function() {
+ this.futures = [];
+ this.afterIndex = 0;
+};
+
+/**
+ * Executes a spec which is an it block with associated before/after functions
+ * based on the describe nesting.
+ *
+ * @param {Object} spec A spec object
+ * @param {function()} specDone function that is called when the spec finishes,
+ * of the form `Function(error, index)`
+ */
+angular.scenario.SpecRunner.prototype.run = function(spec, specDone) {
+ var self = this;
+ this.spec = spec;
+
+ this.emit('SpecBegin', spec);
+
+ try {
+ spec.before.call(this);
+ spec.body.call(this);
+ this.afterIndex = this.futures.length;
+ spec.after.call(this);
+ } catch (e) {
+ this.emit('SpecError', spec, e);
+ this.emit('SpecEnd', spec);
+ specDone();
+ return;
+ }
+
+ var handleError = function(error, done) {
+ if (self.error) {
+ return done();
+ }
+ self.error = true;
+ done(null, self.afterIndex);
+ };
+
+ asyncForEach(
+ this.futures,
+ function(future, futureDone) {
+ self.step = future;
+ self.emit('StepBegin', spec, future);
+ try {
+ future.execute(function(error) {
+ if (error) {
+ self.emit('StepFailure', spec, future, error);
+ self.emit('StepEnd', spec, future);
+ return handleError(error, futureDone);
+ }
+ self.emit('StepEnd', spec, future);
+ self.$window.setTimeout(function() { futureDone(); }, 0);
+ });
+ } catch (e) {
+ self.emit('StepError', spec, future, e);
+ self.emit('StepEnd', spec, future);
+ handleError(e, futureDone);
+ }
+ },
+ function(e) {
+ if (e) {
+ self.emit('SpecError', spec, e);
+ }
+ self.emit('SpecEnd', spec);
+ // Call done in a timeout so exceptions don't recursively
+ // call this function
+ self.$window.setTimeout(function() { specDone(); }, 0);
+ }
+ );
+};
+
+/**
+ * Adds a new future action.
+ *
+ * Note: Do not pass line manually. It happens automatically.
+ *
+ * @param {string} name Name of the future
+ * @param {function()} behavior Behavior of the future
+ * @param {function()} line fn() that returns file/line number
+ */
+angular.scenario.SpecRunner.prototype.addFuture = function(name, behavior, line) {
+ var future = new angular.scenario.Future(name, angular.bind(this, behavior), line);
+ this.futures.push(future);
+ return future;
+};
+
+/**
+ * Adds a new future action to be executed on the application window.
+ *
+ * Note: Do not pass line manually. It happens automatically.
+ *
+ * @param {string} name Name of the future
+ * @param {function()} behavior Behavior of the future
+ * @param {function()} line fn() that returns file/line number
+ */
+angular.scenario.SpecRunner.prototype.addFutureAction = function(name, behavior, line) {
+ var self = this;
+ var NG = /\[ng\\\:/;
+ return this.addFuture(name, function(done) {
+ this.application.executeAction(function($window, $document) {
+
+ //TODO(esprehn): Refactor this so it doesn't need to be in here.
+ $document.elements = function(selector) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ selector = (self.selector || '') + ' ' + (selector || '');
+ selector = _jQuery.trim(selector) || '*';
+ angular.forEach(args, function(value, index) {
+ selector = selector.replace('$' + (index + 1), value);
+ });
+ var result = $document.find(selector);
+ if (selector.match(NG)) {
+ angular.forEach(['[ng-','[data-ng-','[x-ng-'], function(value, index) {
+ result = result.add(selector.replace(NG, value), $document);
+ });
+ }
+ if (!result.length) {
+ throw {
+ type: 'selector',
+ message: 'Selector ' + selector + ' did not match any elements.'
+ };
+ }
+
+ return result;
+ };
+
+ try {
+ behavior.call(self, $window, $document, done);
+ } catch (e) {
+ if (e.type && e.type === 'selector') {
+ done(e.message);
+ } else {
+ throw e;
+ }
+ }
+ });
+ }, line);
+};
+
+/**
+ * Shared DSL statements that are useful to all scenarios.
+ */
+
+ /**
+ * Usage:
+ * pause() pauses until you call resume() in the console
+ */
+angular.scenario.dsl('pause', function() {
+ return function() {
+ return this.addFuture('pausing for you to resume', function(done) {
+ this.emit('InteractivePause', this.spec, this.step);
+ this.$window.resume = function() { done(); };
+ });
+ };
+});
+
+/**
+ * Usage:
+ * sleep(seconds) pauses the test for specified number of seconds
+ */
+angular.scenario.dsl('sleep', function() {
+ return function(time) {
+ return this.addFuture('sleep for ' + time + ' seconds', function(done) {
+ this.$window.setTimeout(function() { done(null, time * 1000); }, time * 1000);
+ });
+ };
+});
+
+/**
+ * Usage:
+ * browser().navigateTo(url) Loads the url into the frame
+ * browser().navigateTo(url, fn) where fn(url) is called and returns the URL to navigate to
+ * browser().reload() refresh the page (reload the same URL)
+ * browser().window.href() window.location.href
+ * browser().window.path() window.location.pathname
+ * browser().window.search() window.location.search
+ * browser().window.hash() window.location.hash without # prefix
+ * browser().location().url() see ng.$location#url
+ * browser().location().path() see ng.$location#path
+ * browser().location().search() see ng.$location#search
+ * browser().location().hash() see ng.$location#hash
+ */
+angular.scenario.dsl('browser', function() {
+ var chain = {};
+
+ chain.navigateTo = function(url, delegate) {
+ var application = this.application;
+ return this.addFuture("browser navigate to '" + url + "'", function(done) {
+ if (delegate) {
+ url = delegate.call(this, url);
+ }
+ application.navigateTo(url, function() {
+ done(null, url);
+ }, done);
+ });
+ };
+
+ chain.reload = function() {
+ var application = this.application;
+ return this.addFutureAction('browser reload', function($window, $document, done) {
+ var href = $window.location.href;
+ application.navigateTo(href, function() {
+ done(null, href);
+ }, done);
+ });
+ };
+
+ chain.window = function() {
+ var api = {};
+
+ api.href = function() {
+ return this.addFutureAction('window.location.href', function($window, $document, done) {
+ done(null, $window.location.href);
+ });
+ };
+
+ api.path = function() {
+ return this.addFutureAction('window.location.path', function($window, $document, done) {
+ done(null, $window.location.pathname);
+ });
+ };
+
+ api.search = function() {
+ return this.addFutureAction('window.location.search', function($window, $document, done) {
+ done(null, $window.location.search);
+ });
+ };
+
+ api.hash = function() {
+ return this.addFutureAction('window.location.hash', function($window, $document, done) {
+ done(null, $window.location.hash.replace('#', ''));
+ });
+ };
+
+ return api;
+ };
+
+ chain.location = function() {
+ var api = {};
+
+ api.url = function() {
+ return this.addFutureAction('$location.url()', function($window, $document, done) {
+ done(null, $document.injector().get('$location').url());
+ });
+ };
+
+ api.path = function() {
+ return this.addFutureAction('$location.path()', function($window, $document, done) {
+ done(null, $document.injector().get('$location').path());
+ });
+ };
+
+ api.search = function() {
+ return this.addFutureAction('$location.search()', function($window, $document, done) {
+ done(null, $document.injector().get('$location').search());
+ });
+ };
+
+ api.hash = function() {
+ return this.addFutureAction('$location.hash()', function($window, $document, done) {
+ done(null, $document.injector().get('$location').hash());
+ });
+ };
+
+ return api;
+ };
+
+ return function() {
+ return chain;
+ };
+});
+
+/**
+ * Usage:
+ * expect(future).{matcher} where matcher is one of the matchers defined
+ * with angular.scenario.matcher
+ *
+ * ex. expect(binding("name")).toEqual("Elliott")
+ */
+angular.scenario.dsl('expect', function() {
+ var chain = angular.extend({}, angular.scenario.matcher);
+
+ chain.not = function() {
+ this.inverse = true;
+ return chain;
+ };
+
+ return function(future) {
+ this.future = future;
+ return chain;
+ };
+});
+
+/**
+ * Usage:
+ * using(selector, label) scopes the next DSL element selection
+ *
+ * ex.
+ * using('#foo', "'Foo' text field").input('bar')
+ */
+angular.scenario.dsl('using', function() {
+ return function(selector, label) {
+ this.selector = _jQuery.trim((this.selector || '') + ' ' + selector);
+ if (angular.isString(label) && label.length) {
+ this.label = label + ' ( ' + this.selector + ' )';
+ } else {
+ this.label = this.selector;
+ }
+ return this.dsl;
+ };
+});
+
+/**
+ * Usage:
+ * binding(name) returns the value of the first matching binding
+ */
+angular.scenario.dsl('binding', function() {
+ return function(name) {
+ return this.addFutureAction("select binding '" + name + "'",
+ function($window, $document, done) {
+ var values = $document.elements().bindings($window.angular.element, name);
+ if (!values.length) {
+ return done("Binding selector '" + name + "' did not match.");
+ }
+ done(null, values[0]);
+ });
+ };
+});
+
+/**
+ * Usage:
+ * input(name).enter(value) enters value in input with specified name
+ * input(name).check() checks checkbox
+ * input(name).select(value) selects the radio button with specified name/value
+ * input(name).val() returns the value of the input.
+ */
+angular.scenario.dsl('input', function() {
+ var chain = {};
+ var supportInputEvent = 'oninput' in document.createElement('div') && !(msie && msie <= 11);
+
+ chain.enter = function(value, event) {
+ return this.addFutureAction("input '" + this.name + "' enter '" + value + "'",
+ function($window, $document, done) {
+ var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':input');
+ input.val(value);
+ input.trigger(event || (supportInputEvent ? 'input' : 'change'));
+ done();
+ });
+ };
+
+ chain.check = function() {
+ return this.addFutureAction("checkbox '" + this.name + "' toggle",
+ function($window, $document, done) {
+ var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':checkbox');
+ input.trigger('click');
+ done();
+ });
+ };
+
+ chain.select = function(value) {
+ return this.addFutureAction("radio button '" + this.name + "' toggle '" + value + "'",
+ function($window, $document, done) {
+ var input = $document.
+ elements('[ng\\:model="$1"][value="$2"]', this.name, value).filter(':radio');
+ input.trigger('click');
+ done();
+ });
+ };
+
+ chain.val = function() {
+ return this.addFutureAction("return input val", function($window, $document, done) {
+ var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':input');
+ done(null,input.val());
+ });
+ };
+
+ return function(name) {
+ this.name = name;
+ return chain;
+ };
+});
+
+
+/**
+ * Usage:
+ * repeater('#products table', 'Product List').count() number of rows
+ * repeater('#products table', 'Product List').row(1) all bindings in row as an array
+ * repeater('#products table', 'Product List').column('product.name') all values across all rows
+ * in an array
+ */
+angular.scenario.dsl('repeater', function() {
+ var chain = {};
+
+ chain.count = function() {
+ return this.addFutureAction("repeater '" + this.label + "' count",
+ function($window, $document, done) {
+ try {
+ done(null, $document.elements().length);
+ } catch (e) {
+ done(null, 0);
+ }
+ });
+ };
+
+ chain.column = function(binding) {
+ return this.addFutureAction("repeater '" + this.label + "' column '" + binding + "'",
+ function($window, $document, done) {
+ done(null, $document.elements().bindings($window.angular.element, binding));
+ });
+ };
+
+ chain.row = function(index) {
+ return this.addFutureAction("repeater '" + this.label + "' row '" + index + "'",
+ function($window, $document, done) {
+ var matches = $document.elements().slice(index, index + 1);
+ if (!matches.length) {
+ return done('row ' + index + ' out of bounds');
+ }
+ done(null, matches.bindings($window.angular.element));
+ });
+ };
+
+ return function(selector, label) {
+ this.dsl.using(selector, label);
+ return chain;
+ };
+});
+
+/**
+ * Usage:
+ * select(name).option('value') select one option
+ * select(name).options('value1', 'value2', ...) select options from a multi select
+ */
+angular.scenario.dsl('select', function() {
+ var chain = {};
+
+ chain.option = function(value) {
+ return this.addFutureAction("select '" + this.name + "' option '" + value + "'",
+ function($window, $document, done) {
+ var select = $document.elements('select[ng\\:model="$1"]', this.name);
+ var option = select.find('option[value="' + value + '"]');
+ if (option.length) {
+ select.val(value);
+ } else {
+ option = select.find('option').filter(function() {
+ return _jQuery(this).text() === value;
+ });
+ if (!option.length) {
+ option = select.find('option:contains("' + value + '")');
+ }
+ if (option.length) {
+ select.val(option.val());
+ } else {
+ return done("option '" + value + "' not found");
+ }
+ }
+ select.trigger('change');
+ done();
+ });
+ };
+
+ chain.options = function() {
+ var values = arguments;
+ return this.addFutureAction("select '" + this.name + "' options '" + values + "'",
+ function($window, $document, done) {
+ var select = $document.elements('select[multiple][ng\\:model="$1"]', this.name);
+ select.val(values);
+ select.trigger('change');
+ done();
+ });
+ };
+
+ return function(name) {
+ this.name = name;
+ return chain;
+ };
+});
+
+/**
+ * Usage:
+ * element(selector, label).count() get the number of elements that match selector
+ * element(selector, label).click() clicks an element
+ * element(selector, label).mouseover() mouseover an element
+ * element(selector, label).mousedown() mousedown an element
+ * element(selector, label).mouseup() mouseup an element
+ * element(selector, label).query(fn) executes fn(selectedElements, done)
+ * element(selector, label).{method}() gets the value (as defined by jQuery, ex. val)
+ * element(selector, label).{method}(value) sets the value (as defined by jQuery, ex. val)
+ * element(selector, label).{method}(key) gets the value (as defined by jQuery, ex. attr)
+ * element(selector, label).{method}(key, value) sets the value (as defined by jQuery, ex. attr)
+ */
+angular.scenario.dsl('element', function() {
+ var KEY_VALUE_METHODS = ['attr', 'css', 'prop'];
+ var VALUE_METHODS = [
+ 'val', 'text', 'html', 'height', 'innerHeight', 'outerHeight', 'width',
+ 'innerWidth', 'outerWidth', 'position', 'scrollLeft', 'scrollTop', 'offset'
+ ];
+ var chain = {};
+
+ chain.count = function() {
+ return this.addFutureAction("element '" + this.label + "' count",
+ function($window, $document, done) {
+ try {
+ done(null, $document.elements().length);
+ } catch (e) {
+ done(null, 0);
+ }
+ });
+ };
+
+ chain.click = function() {
+ return this.addFutureAction("element '" + this.label + "' click",
+ function($window, $document, done) {
+ var elements = $document.elements();
+ var href = elements.attr('href');
+ var eventProcessDefault = elements.trigger('click')[0];
+
+ if (href && elements[0].nodeName.toLowerCase() === 'a' && eventProcessDefault) {
+ this.application.navigateTo(href, function() {
+ done();
+ }, done);
+ } else {
+ done();
+ }
+ });
+ };
+
+ chain.dblclick = function() {
+ return this.addFutureAction("element '" + this.label + "' dblclick",
+ function($window, $document, done) {
+ var elements = $document.elements();
+ var href = elements.attr('href');
+ var eventProcessDefault = elements.trigger('dblclick')[0];
+
+ if (href && elements[0].nodeName.toLowerCase() === 'a' && eventProcessDefault) {
+ this.application.navigateTo(href, function() {
+ done();
+ }, done);
+ } else {
+ done();
+ }
+ });
+ };
+
+ chain.mouseover = function() {
+ return this.addFutureAction("element '" + this.label + "' mouseover",
+ function($window, $document, done) {
+ var elements = $document.elements();
+ elements.trigger('mouseover');
+ done();
+ });
+ };
+
+ chain.mousedown = function() {
+ return this.addFutureAction("element '" + this.label + "' mousedown",
+ function($window, $document, done) {
+ var elements = $document.elements();
+ elements.trigger('mousedown');
+ done();
+ });
+ };
+
+ chain.mouseup = function() {
+ return this.addFutureAction("element '" + this.label + "' mouseup",
+ function($window, $document, done) {
+ var elements = $document.elements();
+ elements.trigger('mouseup');
+ done();
+ });
+ };
+
+ chain.query = function(fn) {
+ return this.addFutureAction('element ' + this.label + ' custom query',
+ function($window, $document, done) {
+ fn.call(this, $document.elements(), done);
+ });
+ };
+
+ angular.forEach(KEY_VALUE_METHODS, function(methodName) {
+ chain[methodName] = function(name, value) {
+ var args = arguments,
+ futureName = (args.length == 1)
+ ? "element '" + this.label + "' get " + methodName + " '" + name + "'"
+ : "element '" + this.label + "' set " + methodName + " '" + name + "' to " + "'" +
+ value + "'";
+
+ return this.addFutureAction(futureName, function($window, $document, done) {
+ var element = $document.elements();
+ done(null, element[methodName].apply(element, args));
+ });
+ };
+ });
+
+ angular.forEach(VALUE_METHODS, function(methodName) {
+ chain[methodName] = function(value) {
+ var args = arguments,
+ futureName = (args.length === 0)
+ ? "element '" + this.label + "' " + methodName
+ : "element '" + this.label + "' set " + methodName + " to '" + value + "'";
+
+ return this.addFutureAction(futureName, function($window, $document, done) {
+ var element = $document.elements();
+ done(null, element[methodName].apply(element, args));
+ });
+ };
+ });
+
+ return function(selector, label) {
+ this.dsl.using(selector, label);
+ return chain;
+ };
+});
+
+/**
+ * Matchers for implementing specs. Follows the Jasmine spec conventions.
+ */
+
+angular.scenario.matcher('toEqual', function(expected) {
+ return angular.equals(this.actual, expected);
+});
+
+angular.scenario.matcher('toBe', function(expected) {
+ return this.actual === expected;
+});
+
+angular.scenario.matcher('toBeDefined', function() {
+ return angular.isDefined(this.actual);
+});
+
+angular.scenario.matcher('toBeTruthy', function() {
+ return this.actual;
+});
+
+angular.scenario.matcher('toBeFalsy', function() {
+ return !this.actual;
+});
+
+angular.scenario.matcher('toMatch', function(expected) {
+ return new RegExp(expected).test(this.actual);
+});
+
+angular.scenario.matcher('toBeNull', function() {
+ return this.actual === null;
+});
+
+angular.scenario.matcher('toContain', function(expected) {
+ return includes(this.actual, expected);
+});
+
+angular.scenario.matcher('toBeLessThan', function(expected) {
+ return this.actual < expected;
+});
+
+angular.scenario.matcher('toBeGreaterThan', function(expected) {
+ return this.actual > expected;
+});
+
+/**
+ * User Interface for the Scenario Runner.
+ *
+ * TODO(esprehn): This should be refactored now that ObjectModel exists
+ * to use angular bindings for the UI.
+ */
+angular.scenario.output('html', function(context, runner, model) {
+ var specUiMap = {},
+ lastStepUiMap = {};
+
+ context.append(
+ '<div id="header">' +
+ ' <h1><span class="angular">AngularJS</span>: Scenario Test Runner</h1>' +
+ ' <ul id="status-legend" class="status-display">' +
+ ' <li class="status-error">0 Errors</li>' +
+ ' <li class="status-failure">0 Failures</li>' +
+ ' <li class="status-success">0 Passed</li>' +
+ ' </ul>' +
+ '</div>' +
+ '<div id="specs">' +
+ ' <div class="test-children"></div>' +
+ '</div>'
+ );
+
+ runner.on('InteractivePause', function(spec) {
+ var ui = lastStepUiMap[spec.id];
+ ui.find('.test-title').
+ html('paused... <a href="javascript:resume()">resume</a> when ready.');
+ });
+
+ runner.on('SpecBegin', function(spec) {
+ var ui = findContext(spec);
+ ui.find('> .tests').append(
+ '<li class="status-pending test-it"></li>'
+ );
+ ui = ui.find('> .tests li:last');
+ ui.append(
+ '<div class="test-info">' +
+ ' <p class="test-title">' +
+ ' <span class="timer-result"></span>' +
+ ' <span class="test-name"></span>' +
+ ' </p>' +
+ '</div>' +
+ '<div class="scrollpane">' +
+ ' <ol class="test-actions"></ol>' +
+ '</div>'
+ );
+ ui.find('> .test-info .test-name').text(spec.name);
+ ui.find('> .test-info').click(function() {
+ var scrollpane = ui.find('> .scrollpane');
+ var actions = scrollpane.find('> .test-actions');
+ var name = context.find('> .test-info .test-name');
+ if (actions.find(':visible').length) {
+ actions.hide();
+ name.removeClass('open').addClass('closed');
+ } else {
+ actions.show();
+ scrollpane.attr('scrollTop', scrollpane.attr('scrollHeight'));
+ name.removeClass('closed').addClass('open');
+ }
+ });
+
+ specUiMap[spec.id] = ui;
+ });
+
+ runner.on('SpecError', function(spec, error) {
+ var ui = specUiMap[spec.id];
+ ui.append('<pre></pre>');
+ ui.find('> pre').text(formatException(error));
+ });
+
+ runner.on('SpecEnd', function(spec) {
+ var ui = specUiMap[spec.id];
+ spec = model.getSpec(spec.id);
+ ui.removeClass('status-pending');
+ ui.addClass('status-' + spec.status);
+ ui.find("> .test-info .timer-result").text(spec.duration + "ms");
+ if (spec.status === 'success') {
+ ui.find('> .test-info .test-name').addClass('closed');
+ ui.find('> .scrollpane .test-actions').hide();
+ }
+ updateTotals(spec.status);
+ });
+
+ runner.on('StepBegin', function(spec, step) {
+ var ui = specUiMap[spec.id];
+ spec = model.getSpec(spec.id);
+ step = spec.getLastStep();
+ ui.find('> .scrollpane .test-actions').append('<li class="status-pending"></li>');
+ var stepUi = lastStepUiMap[spec.id] = ui.find('> .scrollpane .test-actions li:last');
+ stepUi.append(
+ '<div class="timer-result"></div>' +
+ '<div class="test-title"></div>'
+ );
+ stepUi.find('> .test-title').text(step.name);
+ var scrollpane = stepUi.parents('.scrollpane');
+ scrollpane.attr('scrollTop', scrollpane.attr('scrollHeight'));
+ });
+
+ runner.on('StepFailure', function(spec, step, error) {
+ var ui = lastStepUiMap[spec.id];
+ addError(ui, step.line, error);
+ });
+
+ runner.on('StepError', function(spec, step, error) {
+ var ui = lastStepUiMap[spec.id];
+ addError(ui, step.line, error);
+ });
+
+ runner.on('StepEnd', function(spec, step) {
+ var stepUi = lastStepUiMap[spec.id];
+ spec = model.getSpec(spec.id);
+ step = spec.getLastStep();
+ stepUi.find('.timer-result').text(step.duration + 'ms');
+ stepUi.removeClass('status-pending');
+ stepUi.addClass('status-' + step.status);
+ var scrollpane = specUiMap[spec.id].find('> .scrollpane');
+ scrollpane.attr('scrollTop', scrollpane.attr('scrollHeight'));
+ });
+
+ /**
+ * Finds the context of a spec block defined by the passed definition.
+ *
+ * @param {Object} The definition created by the Describe object.
+ */
+ function findContext(spec) {
+ var currentContext = context.find('#specs');
+ angular.forEach(model.getDefinitionPath(spec), function(defn) {
+ var id = 'describe-' + defn.id;
+ if (!context.find('#' + id).length) {
+ currentContext.find('> .test-children').append(
+ '<div class="test-describe" id="' + id + '">' +
+ ' <h2></h2>' +
+ ' <div class="test-children"></div>' +
+ ' <ul class="tests"></ul>' +
+ '</div>'
+ );
+ context.find('#' + id).find('> h2').text('describe: ' + defn.name);
+ }
+ currentContext = context.find('#' + id);
+ });
+ return context.find('#describe-' + spec.definition.id);
+ }
+
+ /**
+ * Updates the test counter for the status.
+ *
+ * @param {string} the status.
+ */
+ function updateTotals(status) {
+ var legend = context.find('#status-legend .status-' + status);
+ var parts = legend.text().split(' ');
+ var value = (parts[0] * 1) + 1;
+ legend.text(value + ' ' + parts[1]);
+ }
+
+ /**
+ * Add an error to a step.
+ *
+ * @param {Object} The JQuery wrapped context
+ * @param {function()} fn() that should return the file/line number of the error
+ * @param {Object} the error.
+ */
+ function addError(context, line, error) {
+ context.find('.test-title').append('<pre></pre>');
+ var message = _jQuery.trim(line() + '\n\n' + formatException(error));
+ context.find('.test-title pre:last').text(message);
+ }
+});
+
+/**
+ * Generates JSON output into a context.
+ */
+angular.scenario.output('json', function(context, runner, model) {
+ model.on('RunnerEnd', function() {
+ context.text(angular.toJson(model.value));
+ });
+});
+
+/**
+ * Generates XML output into a context.
+ */
+angular.scenario.output('xml', function(context, runner, model) {
+ var $ = function(args) {return new context.init(args);};
+ model.on('RunnerEnd', function() {
+ var scenario = $('<scenario></scenario>');
+ context.append(scenario);
+ serializeXml(scenario, model.value);
+ });
+
+ /**
+ * Convert the tree into XML.
+ *
+ * @param {Object} context jQuery context to add the XML to.
+ * @param {Object} tree node to serialize
+ */
+ function serializeXml(context, tree) {
+ angular.forEach(tree.children, function(child) {
+ var describeContext = $('<describe></describe>');
+ describeContext.attr('id', child.id);
+ describeContext.attr('name', child.name);
+ context.append(describeContext);
+ serializeXml(describeContext, child);
+ });
+ var its = $('<its></its>');
+ context.append(its);
+ angular.forEach(tree.specs, function(spec) {
+ var it = $('<it></it>');
+ it.attr('id', spec.id);
+ it.attr('name', spec.name);
+ it.attr('duration', spec.duration);
+ it.attr('status', spec.status);
+ its.append(it);
+ angular.forEach(spec.steps, function(step) {
+ var stepContext = $('<step></step>');
+ stepContext.attr('name', step.name);
+ stepContext.attr('duration', step.duration);
+ stepContext.attr('status', step.status);
+ it.append(stepContext);
+ if (step.error) {
+ var error = $('<error></error>');
+ stepContext.append(error);
+ error.text(formatException(step.error));
+ }
+ });
+ });
+ }
+});
+
+/**
+ * Creates a global value $result with the result of the runner.
+ */
+angular.scenario.output('object', function(context, runner, model) {
+ runner.$window.$result = model.value;
+});
+
+bindJQuery();
+publishExternalAPI(angular);
+
+var $runner = new angular.scenario.Runner(window),
+ scripts = document.getElementsByTagName('script'),
+ script = scripts[scripts.length - 1],
+ config = {};
+
+angular.forEach(script.attributes, function(attr) {
+ var match = attr.name.match(/ng[:\-](.*)/);
+ if (match) {
+ config[match[1]] = attr.value || true;
+ }
+});
+
+if (config.autotest) {
+ JQLite(document).ready(function() {
+ angular.scenario.setUpAndRun(config);
+ });
+}
+})(window, document);
+
+
+!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";\n\n[ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak],\n.ng-cloak, .x-ng-cloak,\n.ng-hide:not(.ng-hide-animate) {\n display: none !important;\n}\n\nng\\:form {\n display: block;\n}\n\n.ng-animate-shim {\n visibility:hidden;\n}\n\n.ng-anchor {\n position:absolute;\n}\n</style>');
+!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";\n/* CSS Document */\n\n/** Structure */\nbody {\n font-family: Arial, sans-serif;\n margin: 0;\n font-size: 14px;\n}\n\n#system-error {\n font-size: 1.5em;\n text-align: center;\n}\n\n#json, #xml {\n display: none;\n}\n\n#header {\n position: fixed;\n width: 100%;\n}\n\n#specs {\n padding-top: 50px;\n}\n\n#header .angular {\n font-family: Courier New, monospace;\n font-weight: bold;\n}\n\n#header h1 {\n font-weight: normal;\n float: left;\n font-size: 30px;\n line-height: 30px;\n margin: 0;\n padding: 10px 10px;\n height: 30px;\n}\n\n#application h2,\n#specs h2 {\n margin: 0;\n padding: 0.5em;\n font-size: 1.1em;\n}\n\n#status-legend {\n margin-top: 10px;\n margin-right: 10px;\n}\n\n#header,\n#application,\n.test-info,\n.test-actions li {\n overflow: hidden;\n}\n\n#application {\n margin: 10px;\n}\n\n#application iframe {\n width: 100%;\n height: 758px;\n}\n\n#application .popout {\n float: right;\n}\n\n#application iframe {\n border: none;\n}\n\n.tests li,\n.test-actions li,\n.test-it li,\n.test-it ol,\n.status-display {\n list-style-type: none;\n}\n\n.tests,\n.test-it ol,\n.status-display {\n margin: 0;\n padding: 0;\n}\n\n.test-info {\n margin-left: 1em;\n margin-top: 0.5em;\n border-radius: 8px 0 0 8px;\n -webkit-border-radius: 8px 0 0 8px;\n -moz-border-radius: 8px 0 0 8px;\n cursor: pointer;\n}\n\n.test-info:hover .test-name {\n text-decoration: underline;\n}\n\n.test-info .closed:before {\n content: \'\\25b8\\00A0\';\n}\n\n.test-info .open:before {\n content: \'\\25be\\00A0\';\n font-weight: bold;\n}\n\n.test-it ol {\n margin-left: 2.5em;\n}\n\n.status-display,\n.status-display li {\n float: right;\n}\n\n.status-display li {\n padding: 5px 10px;\n}\n\n.timer-result,\n.test-title {\n display: inline-block;\n margin: 0;\n padding: 4px;\n}\n\n.test-actions .test-title,\n.test-actions .test-result {\n display: table-cell;\n padding-left: 0.5em;\n padding-right: 0.5em;\n}\n\n.test-actions {\n display: table;\n}\n\n.test-actions li {\n display: table-row;\n}\n\n.timer-result {\n width: 4em;\n padding: 0 10px;\n text-align: right;\n font-family: monospace;\n}\n\n.test-it pre,\n.test-actions pre {\n clear: left;\n color: black;\n margin-left: 6em;\n}\n\n.test-describe {\n padding-bottom: 0.5em;\n}\n\n.test-describe .test-describe {\n margin: 5px 5px 10px 2em;\n}\n\n.test-actions .status-pending .test-title:before {\n content: \'\\00bb\\00A0\';\n}\n\n.scrollpane {\n max-height: 20em;\n overflow: auto;\n}\n\n/** Colors */\n\n#header {\n background-color: #F2C200;\n}\n\n#specs h2 {\n border-top: 2px solid #BABAD1;\n}\n\n#specs h2,\n#application h2 {\n background-color: #efefef;\n}\n\n#application {\n border: 1px solid #BABAD1;\n}\n\n.test-describe .test-describe {\n border-left: 1px solid #BABAD1;\n border-right: 1px solid #BABAD1;\n border-bottom: 1px solid #BABAD1;\n}\n\n.status-display {\n border: 1px solid #777;\n}\n\n.status-display .status-pending,\n.status-pending .test-info {\n background-color: #F9EEBC;\n}\n\n.status-display .status-success,\n.status-success .test-info {\n background-color: #B1D7A1;\n}\n\n.status-display .status-failure,\n.status-failure .test-info {\n background-color: #FF8286;\n}\n\n.status-display .status-error,\n.status-error .test-info {\n background-color: black;\n color: white;\n}\n\n.test-actions .status-success .test-title {\n color: #30B30A;\n}\n\n.test-actions .status-failure .test-title {\n color: #DF0000;\n}\n\n.test-actions .status-error .test-title {\n color: black;\n}\n\n.test-actions .timer-result {\n color: #888;\n}\n</style>'); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.js
new file mode 100644
index 00000000..fc1cf7da
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.js
@@ -0,0 +1,729 @@
+/**
+ * @license AngularJS v1.5.0
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+/* global ngTouchClickDirectiveFactory: false,
+ */
+
+/**
+ * @ngdoc module
+ * @name ngTouch
+ * @description
+ *
+ * # ngTouch
+ *
+ * The `ngTouch` module provides touch events and other helpers for touch-enabled devices.
+ * The implementation is based on jQuery Mobile touch event handling
+ * ([jquerymobile.com](http://jquerymobile.com/)).
+ *
+ *
+ * See {@link ngTouch.$swipe `$swipe`} for usage.
+ *
+ * <div doc-module-components="ngTouch"></div>
+ *
+ */
+
+// define ngTouch module
+/* global -ngTouch */
+var ngTouch = angular.module('ngTouch', []);
+
+ngTouch.provider('$touch', $TouchProvider);
+
+function nodeName_(element) {
+ return angular.lowercase(element.nodeName || (element[0] && element[0].nodeName));
+}
+
+/**
+ * @ngdoc provider
+ * @name $touchProvider
+ *
+ * @description
+ * The `$touchProvider` allows enabling / disabling {@link ngTouch.ngClick ngTouch's ngClick directive}.
+ */
+$TouchProvider.$inject = ['$provide', '$compileProvider'];
+function $TouchProvider($provide, $compileProvider) {
+
+ /**
+ * @ngdoc method
+ * @name $touchProvider#ngClickOverrideEnabled
+ *
+ * @param {boolean=} enabled update the ngClickOverrideEnabled state if provided, otherwise just return the
+ * current ngClickOverrideEnabled state
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ *
+ * @kind function
+ *
+ * @description
+ * Call this method to enable/disable {@link ngTouch.ngClick ngTouch's ngClick directive}. If enabled,
+ * the default ngClick directive will be replaced by a version that eliminates the 300ms delay for
+ * click events on browser for touch-devices.
+ *
+ * The default is `false`.
+ *
+ */
+ var ngClickOverrideEnabled = false;
+ var ngClickDirectiveAdded = false;
+ this.ngClickOverrideEnabled = function(enabled) {
+ if (angular.isDefined(enabled)) {
+
+ if (enabled && !ngClickDirectiveAdded) {
+ ngClickDirectiveAdded = true;
+
+ // Use this to identify the correct directive in the delegate
+ ngTouchClickDirectiveFactory.$$moduleName = 'ngTouch';
+ $compileProvider.directive('ngClick', ngTouchClickDirectiveFactory);
+
+ $provide.decorator('ngClickDirective', ['$delegate', function($delegate) {
+ if (ngClickOverrideEnabled) {
+ // drop the default ngClick directive
+ $delegate.shift();
+ } else {
+ // drop the ngTouch ngClick directive if the override has been re-disabled (because
+ // we cannot de-register added directives)
+ var i = $delegate.length - 1;
+ while (i >= 0) {
+ if ($delegate[i].$$moduleName === 'ngTouch') {
+ $delegate.splice(i, 1);
+ break;
+ }
+ i--;
+ }
+ }
+
+ return $delegate;
+ }]);
+ }
+
+ ngClickOverrideEnabled = enabled;
+ return this;
+ }
+
+ return ngClickOverrideEnabled;
+ };
+
+ /**
+ * @ngdoc service
+ * @name $touch
+ * @kind object
+ *
+ * @description
+ * Provides the {@link ngTouch.$touch#ngClickOverrideEnabled `ngClickOverrideEnabled`} method.
+ *
+ */
+ this.$get = function() {
+ return {
+ /**
+ * @ngdoc method
+ * @name $touch#ngClickOverrideEnabled
+ *
+ * @returns {*} current value of `ngClickOverrideEnabled` set in the {@link ngTouch.$touchProvider $touchProvider},
+ * i.e. if {@link ngTouch.ngClick ngTouch's ngClick} directive is enabled.
+ *
+ * @kind function
+ */
+ ngClickOverrideEnabled: function() {
+ return ngClickOverrideEnabled;
+ }
+ };
+ };
+
+}
+
+/* global ngTouch: false */
+
+ /**
+ * @ngdoc service
+ * @name $swipe
+ *
+ * @description
+ * The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe
+ * behavior, to make implementing swipe-related directives more convenient.
+ *
+ * Requires the {@link ngTouch `ngTouch`} module to be installed.
+ *
+ * `$swipe` is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngTouch`.
+ *
+ * # Usage
+ * The `$swipe` service is an object with a single method: `bind`. `bind` takes an element
+ * which is to be watched for swipes, and an object with four handler functions. See the
+ * documentation for `bind` below.
+ */
+
+ngTouch.factory('$swipe', [function() {
+ // The total distance in any direction before we make the call on swipe vs. scroll.
+ var MOVE_BUFFER_RADIUS = 10;
+
+ var POINTER_EVENTS = {
+ 'mouse': {
+ start: 'mousedown',
+ move: 'mousemove',
+ end: 'mouseup'
+ },
+ 'touch': {
+ start: 'touchstart',
+ move: 'touchmove',
+ end: 'touchend',
+ cancel: 'touchcancel'
+ }
+ };
+
+ function getCoordinates(event) {
+ var originalEvent = event.originalEvent || event;
+ var touches = originalEvent.touches && originalEvent.touches.length ? originalEvent.touches : [originalEvent];
+ var e = (originalEvent.changedTouches && originalEvent.changedTouches[0]) || touches[0];
+
+ return {
+ x: e.clientX,
+ y: e.clientY
+ };
+ }
+
+ function getEvents(pointerTypes, eventType) {
+ var res = [];
+ angular.forEach(pointerTypes, function(pointerType) {
+ var eventName = POINTER_EVENTS[pointerType][eventType];
+ if (eventName) {
+ res.push(eventName);
+ }
+ });
+ return res.join(' ');
+ }
+
+ return {
+ /**
+ * @ngdoc method
+ * @name $swipe#bind
+ *
+ * @description
+ * The main method of `$swipe`. It takes an element to be watched for swipe motions, and an
+ * object containing event handlers.
+ * The pointer types that should be used can be specified via the optional
+ * third argument, which is an array of strings `'mouse'` and `'touch'`. By default,
+ * `$swipe` will listen for `mouse` and `touch` events.
+ *
+ * The four events are `start`, `move`, `end`, and `cancel`. `start`, `move`, and `end`
+ * receive as a parameter a coordinates object of the form `{ x: 150, y: 310 }` and the raw
+ * `event`. `cancel` receives the raw `event` as its single parameter.
+ *
+ * `start` is called on either `mousedown` or `touchstart`. After this event, `$swipe` is
+ * watching for `touchmove` or `mousemove` events. These events are ignored until the total
+ * distance moved in either dimension exceeds a small threshold.
+ *
+ * Once this threshold is exceeded, either the horizontal or vertical delta is greater.
+ * - If the horizontal distance is greater, this is a swipe and `move` and `end` events follow.
+ * - If the vertical distance is greater, this is a scroll, and we let the browser take over.
+ * A `cancel` event is sent.
+ *
+ * `move` is called on `mousemove` and `touchmove` after the above logic has determined that
+ * a swipe is in progress.
+ *
+ * `end` is called when a swipe is successfully completed with a `touchend` or `mouseup`.
+ *
+ * `cancel` is called either on a `touchcancel` from the browser, or when we begin scrolling
+ * as described above.
+ *
+ */
+ bind: function(element, eventHandlers, pointerTypes) {
+ // Absolute total movement, used to control swipe vs. scroll.
+ var totalX, totalY;
+ // Coordinates of the start position.
+ var startCoords;
+ // Last event's position.
+ var lastPos;
+ // Whether a swipe is active.
+ var active = false;
+
+ pointerTypes = pointerTypes || ['mouse', 'touch'];
+ element.on(getEvents(pointerTypes, 'start'), function(event) {
+ startCoords = getCoordinates(event);
+ active = true;
+ totalX = 0;
+ totalY = 0;
+ lastPos = startCoords;
+ eventHandlers['start'] && eventHandlers['start'](startCoords, event);
+ });
+ var events = getEvents(pointerTypes, 'cancel');
+ if (events) {
+ element.on(events, function(event) {
+ active = false;
+ eventHandlers['cancel'] && eventHandlers['cancel'](event);
+ });
+ }
+
+ element.on(getEvents(pointerTypes, 'move'), function(event) {
+ if (!active) return;
+
+ // Android will send a touchcancel if it thinks we're starting to scroll.
+ // So when the total distance (+ or - or both) exceeds 10px in either direction,
+ // we either:
+ // - On totalX > totalY, we send preventDefault() and treat this as a swipe.
+ // - On totalY > totalX, we let the browser handle it as a scroll.
+
+ if (!startCoords) return;
+ var coords = getCoordinates(event);
+
+ totalX += Math.abs(coords.x - lastPos.x);
+ totalY += Math.abs(coords.y - lastPos.y);
+
+ lastPos = coords;
+
+ if (totalX < MOVE_BUFFER_RADIUS && totalY < MOVE_BUFFER_RADIUS) {
+ return;
+ }
+
+ // One of totalX or totalY has exceeded the buffer, so decide on swipe vs. scroll.
+ if (totalY > totalX) {
+ // Allow native scrolling to take over.
+ active = false;
+ eventHandlers['cancel'] && eventHandlers['cancel'](event);
+ return;
+ } else {
+ // Prevent the browser from scrolling.
+ event.preventDefault();
+ eventHandlers['move'] && eventHandlers['move'](coords, event);
+ }
+ });
+
+ element.on(getEvents(pointerTypes, 'end'), function(event) {
+ if (!active) return;
+ active = false;
+ eventHandlers['end'] && eventHandlers['end'](getCoordinates(event), event);
+ });
+ }
+ };
+}]);
+
+/* global ngTouch: false,
+ nodeName_: false
+*/
+
+/**
+ * @ngdoc directive
+ * @name ngClick
+ * @deprecated
+ *
+ * @description
+ * <div class="alert alert-danger">
+ * **DEPRECATION NOTICE**: Beginning with Angular 1.5, this directive is deprecated and by default **disabled**.
+ * The directive will receive no further support and might be removed from future releases.
+ * If you need the directive, you can enable it with the {@link ngTouch.$touchProvider $touchProvider#ngClickOverrideEnabled}
+ * function. We also recommend that you migrate to [FastClick](https://github.com/ftlabs/fastclick).
+ * To learn more about the 300ms delay, this [Telerik article](http://developer.telerik.com/featured/300-ms-click-delay-ios-8/)
+ * gives a good overview.
+ * </div>
+ * A more powerful replacement for the default ngClick designed to be used on touchscreen
+ * devices. Most mobile browsers wait about 300ms after a tap-and-release before sending
+ * the click event. This version handles them immediately, and then prevents the
+ * following click event from propagating.
+ *
+ * Requires the {@link ngTouch `ngTouch`} module to be installed.
+ *
+ * This directive can fall back to using an ordinary click event, and so works on desktop
+ * browsers as well as mobile.
+ *
+ * This directive also sets the CSS class `ng-click-active` while the element is being held
+ * down (by a mouse click or touch) so you can restyle the depressed element if you wish.
+ *
+ * @element ANY
+ * @param {expression} ngClick {@link guide/expression Expression} to evaluate
+ * upon tap. (Event object is available as `$event`)
+ *
+ * @example
+ <example module="ngClickExample" deps="angular-touch.js">
+ <file name="index.html">
+ <button ng-click="count = count + 1" ng-init="count=0">
+ Increment
+ </button>
+ count: {{ count }}
+ </file>
+ <file name="script.js">
+ angular.module('ngClickExample', ['ngTouch']);
+ </file>
+ </example>
+ */
+
+var ngTouchClickDirectiveFactory = ['$parse', '$timeout', '$rootElement',
+ function($parse, $timeout, $rootElement) {
+ var TAP_DURATION = 750; // Shorter than 750ms is a tap, longer is a taphold or drag.
+ var MOVE_TOLERANCE = 12; // 12px seems to work in most mobile browsers.
+ var PREVENT_DURATION = 2500; // 2.5 seconds maximum from preventGhostClick call to click
+ var CLICKBUSTER_THRESHOLD = 25; // 25 pixels in any dimension is the limit for busting clicks.
+
+ var ACTIVE_CLASS_NAME = 'ng-click-active';
+ var lastPreventedTime;
+ var touchCoordinates;
+ var lastLabelClickCoordinates;
+
+
+ // TAP EVENTS AND GHOST CLICKS
+ //
+ // Why tap events?
+ // Mobile browsers detect a tap, then wait a moment (usually ~300ms) to see if you're
+ // double-tapping, and then fire a click event.
+ //
+ // This delay sucks and makes mobile apps feel unresponsive.
+ // So we detect touchstart, touchcancel and touchend ourselves and determine when
+ // the user has tapped on something.
+ //
+ // What happens when the browser then generates a click event?
+ // The browser, of course, also detects the tap and fires a click after a delay. This results in
+ // tapping/clicking twice. We do "clickbusting" to prevent it.
+ //
+ // How does it work?
+ // We attach global touchstart and click handlers, that run during the capture (early) phase.
+ // So the sequence for a tap is:
+ // - global touchstart: Sets an "allowable region" at the point touched.
+ // - element's touchstart: Starts a touch
+ // (- touchcancel ends the touch, no click follows)
+ // - element's touchend: Determines if the tap is valid (didn't move too far away, didn't hold
+ // too long) and fires the user's tap handler. The touchend also calls preventGhostClick().
+ // - preventGhostClick() removes the allowable region the global touchstart created.
+ // - The browser generates a click event.
+ // - The global click handler catches the click, and checks whether it was in an allowable region.
+ // - If preventGhostClick was called, the region will have been removed, the click is busted.
+ // - If the region is still there, the click proceeds normally. Therefore clicks on links and
+ // other elements without ngTap on them work normally.
+ //
+ // This is an ugly, terrible hack!
+ // Yeah, tell me about it. The alternatives are using the slow click events, or making our users
+ // deal with the ghost clicks, so I consider this the least of evils. Fortunately Angular
+ // encapsulates this ugly logic away from the user.
+ //
+ // Why not just put click handlers on the element?
+ // We do that too, just to be sure. If the tap event caused the DOM to change,
+ // it is possible another element is now in that position. To take account for these possibly
+ // distinct elements, the handlers are global and care only about coordinates.
+
+ // Checks if the coordinates are close enough to be within the region.
+ function hit(x1, y1, x2, y2) {
+ return Math.abs(x1 - x2) < CLICKBUSTER_THRESHOLD && Math.abs(y1 - y2) < CLICKBUSTER_THRESHOLD;
+ }
+
+ // Checks a list of allowable regions against a click location.
+ // Returns true if the click should be allowed.
+ // Splices out the allowable region from the list after it has been used.
+ function checkAllowableRegions(touchCoordinates, x, y) {
+ for (var i = 0; i < touchCoordinates.length; i += 2) {
+ if (hit(touchCoordinates[i], touchCoordinates[i + 1], x, y)) {
+ touchCoordinates.splice(i, i + 2);
+ return true; // allowable region
+ }
+ }
+ return false; // No allowable region; bust it.
+ }
+
+ // Global click handler that prevents the click if it's in a bustable zone and preventGhostClick
+ // was called recently.
+ function onClick(event) {
+ if (Date.now() - lastPreventedTime > PREVENT_DURATION) {
+ return; // Too old.
+ }
+
+ var touches = event.touches && event.touches.length ? event.touches : [event];
+ var x = touches[0].clientX;
+ var y = touches[0].clientY;
+ // Work around desktop Webkit quirk where clicking a label will fire two clicks (on the label
+ // and on the input element). Depending on the exact browser, this second click we don't want
+ // to bust has either (0,0), negative coordinates, or coordinates equal to triggering label
+ // click event
+ if (x < 1 && y < 1) {
+ return; // offscreen
+ }
+ if (lastLabelClickCoordinates &&
+ lastLabelClickCoordinates[0] === x && lastLabelClickCoordinates[1] === y) {
+ return; // input click triggered by label click
+ }
+ // reset label click coordinates on first subsequent click
+ if (lastLabelClickCoordinates) {
+ lastLabelClickCoordinates = null;
+ }
+ // remember label click coordinates to prevent click busting of trigger click event on input
+ if (nodeName_(event.target) === 'label') {
+ lastLabelClickCoordinates = [x, y];
+ }
+
+ // Look for an allowable region containing this click.
+ // If we find one, that means it was created by touchstart and not removed by
+ // preventGhostClick, so we don't bust it.
+ if (checkAllowableRegions(touchCoordinates, x, y)) {
+ return;
+ }
+
+ // If we didn't find an allowable region, bust the click.
+ event.stopPropagation();
+ event.preventDefault();
+
+ // Blur focused form elements
+ event.target && event.target.blur && event.target.blur();
+ }
+
+
+ // Global touchstart handler that creates an allowable region for a click event.
+ // This allowable region can be removed by preventGhostClick if we want to bust it.
+ function onTouchStart(event) {
+ var touches = event.touches && event.touches.length ? event.touches : [event];
+ var x = touches[0].clientX;
+ var y = touches[0].clientY;
+ touchCoordinates.push(x, y);
+
+ $timeout(function() {
+ // Remove the allowable region.
+ for (var i = 0; i < touchCoordinates.length; i += 2) {
+ if (touchCoordinates[i] == x && touchCoordinates[i + 1] == y) {
+ touchCoordinates.splice(i, i + 2);
+ return;
+ }
+ }
+ }, PREVENT_DURATION, false);
+ }
+
+ // On the first call, attaches some event handlers. Then whenever it gets called, it creates a
+ // zone around the touchstart where clicks will get busted.
+ function preventGhostClick(x, y) {
+ if (!touchCoordinates) {
+ $rootElement[0].addEventListener('click', onClick, true);
+ $rootElement[0].addEventListener('touchstart', onTouchStart, true);
+ touchCoordinates = [];
+ }
+
+ lastPreventedTime = Date.now();
+
+ checkAllowableRegions(touchCoordinates, x, y);
+ }
+
+ // Actual linking function.
+ return function(scope, element, attr) {
+ var clickHandler = $parse(attr.ngClick),
+ tapping = false,
+ tapElement, // Used to blur the element after a tap.
+ startTime, // Used to check if the tap was held too long.
+ touchStartX,
+ touchStartY;
+
+ function resetState() {
+ tapping = false;
+ element.removeClass(ACTIVE_CLASS_NAME);
+ }
+
+ element.on('touchstart', function(event) {
+ tapping = true;
+ tapElement = event.target ? event.target : event.srcElement; // IE uses srcElement.
+ // Hack for Safari, which can target text nodes instead of containers.
+ if (tapElement.nodeType == 3) {
+ tapElement = tapElement.parentNode;
+ }
+
+ element.addClass(ACTIVE_CLASS_NAME);
+
+ startTime = Date.now();
+
+ // Use jQuery originalEvent
+ var originalEvent = event.originalEvent || event;
+ var touches = originalEvent.touches && originalEvent.touches.length ? originalEvent.touches : [originalEvent];
+ var e = touches[0];
+ touchStartX = e.clientX;
+ touchStartY = e.clientY;
+ });
+
+ element.on('touchcancel', function(event) {
+ resetState();
+ });
+
+ element.on('touchend', function(event) {
+ var diff = Date.now() - startTime;
+
+ // Use jQuery originalEvent
+ var originalEvent = event.originalEvent || event;
+ var touches = (originalEvent.changedTouches && originalEvent.changedTouches.length) ?
+ originalEvent.changedTouches :
+ ((originalEvent.touches && originalEvent.touches.length) ? originalEvent.touches : [originalEvent]);
+ var e = touches[0];
+ var x = e.clientX;
+ var y = e.clientY;
+ var dist = Math.sqrt(Math.pow(x - touchStartX, 2) + Math.pow(y - touchStartY, 2));
+
+ if (tapping && diff < TAP_DURATION && dist < MOVE_TOLERANCE) {
+ // Call preventGhostClick so the clickbuster will catch the corresponding click.
+ preventGhostClick(x, y);
+
+ // Blur the focused element (the button, probably) before firing the callback.
+ // This doesn't work perfectly on Android Chrome, but seems to work elsewhere.
+ // I couldn't get anything to work reliably on Android Chrome.
+ if (tapElement) {
+ tapElement.blur();
+ }
+
+ if (!angular.isDefined(attr.disabled) || attr.disabled === false) {
+ element.triggerHandler('click', [event]);
+ }
+ }
+
+ resetState();
+ });
+
+ // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click
+ // something else nearby.
+ element.onclick = function(event) { };
+
+ // Actual click handler.
+ // There are three different kinds of clicks, only two of which reach this point.
+ // - On desktop browsers without touch events, their clicks will always come here.
+ // - On mobile browsers, the simulated "fast" click will call this.
+ // - But the browser's follow-up slow click will be "busted" before it reaches this handler.
+ // Therefore it's safe to use this directive on both mobile and desktop.
+ element.on('click', function(event, touchend) {
+ scope.$apply(function() {
+ clickHandler(scope, {$event: (touchend || event)});
+ });
+ });
+
+ element.on('mousedown', function(event) {
+ element.addClass(ACTIVE_CLASS_NAME);
+ });
+
+ element.on('mousemove mouseup', function(event) {
+ element.removeClass(ACTIVE_CLASS_NAME);
+ });
+
+ };
+}];
+
+/* global ngTouch: false */
+
+/**
+ * @ngdoc directive
+ * @name ngSwipeLeft
+ *
+ * @description
+ * Specify custom behavior when an element is swiped to the left on a touchscreen device.
+ * A leftward swipe is a quick, right-to-left slide of the finger.
+ * Though ngSwipeLeft is designed for touch-based devices, it will work with a mouse click and drag
+ * too.
+ *
+ * To disable the mouse click and drag functionality, add `ng-swipe-disable-mouse` to
+ * the `ng-swipe-left` or `ng-swipe-right` DOM Element.
+ *
+ * Requires the {@link ngTouch `ngTouch`} module to be installed.
+ *
+ * @element ANY
+ * @param {expression} ngSwipeLeft {@link guide/expression Expression} to evaluate
+ * upon left swipe. (Event object is available as `$event`)
+ *
+ * @example
+ <example module="ngSwipeLeftExample" deps="angular-touch.js">
+ <file name="index.html">
+ <div ng-show="!showActions" ng-swipe-left="showActions = true">
+ Some list content, like an email in the inbox
+ </div>
+ <div ng-show="showActions" ng-swipe-right="showActions = false">
+ <button ng-click="reply()">Reply</button>
+ <button ng-click="delete()">Delete</button>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('ngSwipeLeftExample', ['ngTouch']);
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngSwipeRight
+ *
+ * @description
+ * Specify custom behavior when an element is swiped to the right on a touchscreen device.
+ * A rightward swipe is a quick, left-to-right slide of the finger.
+ * Though ngSwipeRight is designed for touch-based devices, it will work with a mouse click and drag
+ * too.
+ *
+ * Requires the {@link ngTouch `ngTouch`} module to be installed.
+ *
+ * @element ANY
+ * @param {expression} ngSwipeRight {@link guide/expression Expression} to evaluate
+ * upon right swipe. (Event object is available as `$event`)
+ *
+ * @example
+ <example module="ngSwipeRightExample" deps="angular-touch.js">
+ <file name="index.html">
+ <div ng-show="!showActions" ng-swipe-left="showActions = true">
+ Some list content, like an email in the inbox
+ </div>
+ <div ng-show="showActions" ng-swipe-right="showActions = false">
+ <button ng-click="reply()">Reply</button>
+ <button ng-click="delete()">Delete</button>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('ngSwipeRightExample', ['ngTouch']);
+ </file>
+ </example>
+ */
+
+function makeSwipeDirective(directiveName, direction, eventName) {
+ ngTouch.directive(directiveName, ['$parse', '$swipe', function($parse, $swipe) {
+ // The maximum vertical delta for a swipe should be less than 75px.
+ var MAX_VERTICAL_DISTANCE = 75;
+ // Vertical distance should not be more than a fraction of the horizontal distance.
+ var MAX_VERTICAL_RATIO = 0.3;
+ // At least a 30px lateral motion is necessary for a swipe.
+ var MIN_HORIZONTAL_DISTANCE = 30;
+
+ return function(scope, element, attr) {
+ var swipeHandler = $parse(attr[directiveName]);
+
+ var startCoords, valid;
+
+ function validSwipe(coords) {
+ // Check that it's within the coordinates.
+ // Absolute vertical distance must be within tolerances.
+ // Horizontal distance, we take the current X - the starting X.
+ // This is negative for leftward swipes and positive for rightward swipes.
+ // After multiplying by the direction (-1 for left, +1 for right), legal swipes
+ // (ie. same direction as the directive wants) will have a positive delta and
+ // illegal ones a negative delta.
+ // Therefore this delta must be positive, and larger than the minimum.
+ if (!startCoords) return false;
+ var deltaY = Math.abs(coords.y - startCoords.y);
+ var deltaX = (coords.x - startCoords.x) * direction;
+ return valid && // Short circuit for already-invalidated swipes.
+ deltaY < MAX_VERTICAL_DISTANCE &&
+ deltaX > 0 &&
+ deltaX > MIN_HORIZONTAL_DISTANCE &&
+ deltaY / deltaX < MAX_VERTICAL_RATIO;
+ }
+
+ var pointerTypes = ['touch'];
+ if (!angular.isDefined(attr['ngSwipeDisableMouse'])) {
+ pointerTypes.push('mouse');
+ }
+ $swipe.bind(element, {
+ 'start': function(coords, event) {
+ startCoords = coords;
+ valid = true;
+ },
+ 'cancel': function(event) {
+ valid = false;
+ },
+ 'end': function(coords, event) {
+ if (validSwipe(coords)) {
+ scope.$apply(function() {
+ element.triggerHandler(eventName);
+ swipeHandler(scope, {$event: event});
+ });
+ }
+ }
+ }, pointerTypes);
+ };
+ }]);
+}
+
+// Left is negative X-coordinate, right is positive.
+makeSwipeDirective('ngSwipeLeft', -1, 'swipeleft');
+makeSwipeDirective('ngSwipeRight', 1, 'swiperight');
+
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.min.js
new file mode 100644
index 00000000..d17a0328
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.min.js
@@ -0,0 +1,14 @@
+/*
+ AngularJS v1.5.0
+ (c) 2010-2016 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(x,n,y){'use strict';function s(f,k){var e=!1,a=!1;this.ngClickOverrideEnabled=function(b){return n.isDefined(b)?(b&&!a&&(a=!0,t.$$moduleName="ngTouch",k.directive("ngClick",t),f.decorator("ngClickDirective",["$delegate",function(a){if(e)a.shift();else for(var b=a.length-1;0<=b;){if("ngTouch"===a[b].$$moduleName){a.splice(b,1);break}b--}return a}])),e=b,this):e};this.$get=function(){return{ngClickOverrideEnabled:function(){return e}}}}function v(f,k,e){p.directive(f,["$parse","$swipe",function(a,
+b){return function(l,u,g){function h(c){if(!d)return!1;var a=Math.abs(c.y-d.y);c=(c.x-d.x)*k;return r&&75>a&&0<c&&30<c&&.3>a/c}var m=a(g[f]),d,r,c=["touch"];n.isDefined(g.ngSwipeDisableMouse)||c.push("mouse");b.bind(u,{start:function(c,a){d=c;r=!0},cancel:function(c){r=!1},end:function(c,d){h(c)&&l.$apply(function(){u.triggerHandler(e);m(l,{$event:d})})}},c)}}])}var p=n.module("ngTouch",[]);p.provider("$touch",s);s.$inject=["$provide","$compileProvider"];p.factory("$swipe",[function(){function f(a){a=
+a.originalEvent||a;var b=a.touches&&a.touches.length?a.touches:[a];a=a.changedTouches&&a.changedTouches[0]||b[0];return{x:a.clientX,y:a.clientY}}function k(a,b){var l=[];n.forEach(a,function(a){(a=e[a][b])&&l.push(a)});return l.join(" ")}var e={mouse:{start:"mousedown",move:"mousemove",end:"mouseup"},touch:{start:"touchstart",move:"touchmove",end:"touchend",cancel:"touchcancel"}};return{bind:function(a,b,l){var e,g,h,m,d=!1;l=l||["mouse","touch"];a.on(k(l,"start"),function(c){h=f(c);d=!0;g=e=0;m=
+h;b.start&&b.start(h,c)});var r=k(l,"cancel");if(r)a.on(r,function(c){d=!1;b.cancel&&b.cancel(c)});a.on(k(l,"move"),function(c){if(d&&h){var a=f(c);e+=Math.abs(a.x-m.x);g+=Math.abs(a.y-m.y);m=a;10>e&&10>g||(g>e?(d=!1,b.cancel&&b.cancel(c)):(c.preventDefault(),b.move&&b.move(a,c)))}});a.on(k(l,"end"),function(c){d&&(d=!1,b.end&&b.end(f(c),c))})}}}]);var t=["$parse","$timeout","$rootElement",function(f,k,e){function a(a,d,b){for(var c=0;c<a.length;c+=2){var g=a[c+1],e=b;if(25>Math.abs(a[c]-d)&&25>Math.abs(g-
+e))return a.splice(c,c+2),!0}return!1}function b(b){if(!(2500<Date.now()-u)){var d=b.touches&&b.touches.length?b.touches:[b],e=d[0].clientX,d=d[0].clientY;if(!(1>e&&1>d||h&&h[0]===e&&h[1]===d)){h&&(h=null);var c=b.target;"label"===n.lowercase(c.nodeName||c[0]&&c[0].nodeName)&&(h=[e,d]);a(g,e,d)||(b.stopPropagation(),b.preventDefault(),b.target&&b.target.blur&&b.target.blur())}}}function l(a){a=a.touches&&a.touches.length?a.touches:[a];var b=a[0].clientX,e=a[0].clientY;g.push(b,e);k(function(){for(var a=
+0;a<g.length;a+=2)if(g[a]==b&&g[a+1]==e){g.splice(a,a+2);break}},2500,!1)}var u,g,h;return function(h,d,k){var c=f(k.ngClick),w=!1,q,p,s,t;d.on("touchstart",function(a){w=!0;q=a.target?a.target:a.srcElement;3==q.nodeType&&(q=q.parentNode);d.addClass("ng-click-active");p=Date.now();a=a.originalEvent||a;a=(a.touches&&a.touches.length?a.touches:[a])[0];s=a.clientX;t=a.clientY});d.on("touchcancel",function(a){w=!1;d.removeClass("ng-click-active")});d.on("touchend",function(c){var h=Date.now()-p,f=c.originalEvent||
+c,m=(f.changedTouches&&f.changedTouches.length?f.changedTouches:f.touches&&f.touches.length?f.touches:[f])[0],f=m.clientX,m=m.clientY,v=Math.sqrt(Math.pow(f-s,2)+Math.pow(m-t,2));w&&750>h&&12>v&&(g||(e[0].addEventListener("click",b,!0),e[0].addEventListener("touchstart",l,!0),g=[]),u=Date.now(),a(g,f,m),q&&q.blur(),n.isDefined(k.disabled)&&!1!==k.disabled||d.triggerHandler("click",[c]));w=!1;d.removeClass("ng-click-active")});d.onclick=function(a){};d.on("click",function(a,b){h.$apply(function(){c(h,
+{$event:b||a})})});d.on("mousedown",function(a){d.addClass("ng-click-active")});d.on("mousemove mouseup",function(a){d.removeClass("ng-click-active")})}}];v("ngSwipeLeft",-1,"swipeleft");v("ngSwipeRight",1,"swiperight")})(window,window.angular);
+//# sourceMappingURL=angular-touch.min.js.map
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.min.js.map
new file mode 100644
index 00000000..9267ec82
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.min.js.map
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"angular-touch.min.js",
+"lineCount":13,
+"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CAyCtCC,QAASA,EAAc,CAACC,CAAD,CAAWC,CAAX,CAA6B,CAoBlD,IAAIC,EAAyB,CAAA,CAA7B,CACIC,EAAwB,CAAA,CAC5B,KAAAD,uBAAA,CAA8BE,QAAQ,CAACC,CAAD,CAAU,CAC9C,MAAIR,EAAAS,UAAA,CAAkBD,CAAlB,CAAJ,EAEMA,CA6BG,EA7BSF,CAAAA,CA6BT,GA5BLA,CAMA,CANwB,CAAA,CAMxB,CAHAI,CAAAC,aAGA,CAH4C,SAG5C,CAFAP,CAAAQ,UAAA,CAA2B,SAA3B,CAAsCF,CAAtC,CAEA,CAAAP,CAAAU,UAAA,CAAmB,kBAAnB,CAAuC,CAAC,WAAD,CAAc,QAAQ,CAACC,CAAD,CAAY,CACvE,GAAIT,CAAJ,CAEES,CAAAC,MAAA,EAFF,KAOE,KADA,IAAIC,EAAIF,CAAAG,OAAJD,CAAuB,CAC3B,CAAY,CAAZ,EAAOA,CAAP,CAAA,CAAe,CACb,GAAkC,SAAlC,GAAIF,CAAA,CAAUE,CAAV,CAAAL,aAAJ,CAA6C,CAC3CG,CAAAI,OAAA,CAAiBF,CAAjB,CAAoB,CAApB,CACA,MAF2C,CAI7CA,CAAA,EALa,CASjB,MAAOF,EAjBgE,CAAlC,CAAvC,CAsBK,EADPT,CACO,CADkBG,CAClB,CAAA,IA/BT,EAkCOH,CAnCuC,CA+ChD,KAAAc,KAAA,CAAYC,QAAQ,EAAG,CACrB,MAAO,CAULf,uBAAwBA,QAAQ,EAAG,CACjC,MAAOA,EAD0B,CAV9B,CADc,CArE2B,CA0mBpDgB,QAASA,EAAkB,CAACC,CAAD,CAAgBC,CAAhB,CAA2BC,CAA3B,CAAsC,CAC/DC,CAAAb,UAAA,CAAkBU,CAAlB,CAAiC,CAAC,QAAD,CAAW,QAAX,CAAqB,QAAQ,CAACI,CAAD;AAASC,CAAT,CAAiB,CAQ7E,MAAO,SAAQ,CAACC,CAAD,CAAQC,CAAR,CAAiBC,CAAjB,CAAuB,CAKpCC,QAASA,EAAU,CAACC,CAAD,CAAS,CAS1B,GAAKC,CAAAA,CAAL,CAAkB,MAAO,CAAA,CACzB,KAAIC,EAASC,IAAAC,IAAA,CAASJ,CAAAK,EAAT,CAAoBJ,CAAAI,EAApB,CACTC,EAAAA,EAAUN,CAAAO,EAAVD,CAAqBL,CAAAM,EAArBD,EAAsCf,CAC1C,OAAOiB,EAAP,EAvBwBC,EAuBxB,CACIP,CADJ,EAEa,CAFb,CAEII,CAFJ,EAnB0BI,EAmB1B,CAGIJ,CAHJ,EArBqBK,EAqBrB,CAIIT,CAJJ,CAIaI,CAhBa,CAJ5B,IAAIM,EAAelB,CAAA,CAAOI,CAAA,CAAKR,CAAL,CAAP,CAAnB,CAEIW,CAFJ,CAEiBO,CAFjB,CAuBIK,EAAe,CAAC,OAAD,CACd7C,EAAAS,UAAA,CAAkBqB,CAAA,oBAAlB,CAAL,EACEe,CAAAC,KAAA,CAAkB,OAAlB,CAEFnB,EAAAoB,KAAA,CAAYlB,CAAZ,CAAqB,CACnB,MAASmB,QAAQ,CAAChB,CAAD,CAASiB,CAAT,CAAgB,CAC/BhB,CAAA,CAAcD,CACdQ,EAAA,CAAQ,CAAA,CAFuB,CADd,CAKnB,OAAUU,QAAQ,CAACD,CAAD,CAAQ,CACxBT,CAAA,CAAQ,CAAA,CADgB,CALP,CAQnB,IAAOW,QAAQ,CAACnB,CAAD,CAASiB,CAAT,CAAgB,CACzBlB,CAAA,CAAWC,CAAX,CAAJ,EACEJ,CAAAwB,OAAA,CAAa,QAAQ,EAAG,CACtBvB,CAAAwB,eAAA,CAAuB7B,CAAvB,CACAoB,EAAA,CAAahB,CAAb,CAAoB,CAAC0B,OAAQL,CAAT,CAApB,CAFsB,CAAxB,CAF2B,CARZ,CAArB,CAgBGJ,CAhBH,CA5BoC,CARuC,CAA9C,CAAjC,CAD+D,CA1nBjE,IAAIpB,EAAUzB,CAAAuD,OAAA,CAAe,SAAf,CAA0B,EAA1B,CAEd9B,EAAA+B,SAAA,CAAiB,QAAjB,CAA2BtD,CAA3B,CAaAA,EAAAuD,QAAA,CAAyB,CAAC,UAAD,CAAa,kBAAb,CA6GzBhC,EAAAiC,QAAA,CAAgB,QAAhB,CAA0B,CAAC,QAAQ,EAAG,CAkBpCC,QAASA,EAAc,CAACV,CAAD,CAAQ,CACzBW,CAAAA;AAAgBX,CAAAW,cAAhBA,EAAuCX,CAC3C,KAAIY,EAAUD,CAAAC,QAAA,EAAyBD,CAAAC,QAAA5C,OAAzB,CAAwD2C,CAAAC,QAAxD,CAAgF,CAACD,CAAD,CAC1FE,EAAAA,CAAKF,CAAAG,eAALD,EAAqCF,CAAAG,eAAA,CAA6B,CAA7B,CAArCD,EAAyED,CAAA,CAAQ,CAAR,CAE7E,OAAO,CACLtB,EAAGuB,CAAAE,QADE,CAEL3B,EAAGyB,CAAAG,QAFE,CALsB,CAW/BC,QAASA,EAAS,CAACrB,CAAD,CAAesB,CAAf,CAA0B,CAC1C,IAAIC,EAAM,EACVpE,EAAAqE,QAAA,CAAgBxB,CAAhB,CAA8B,QAAQ,CAACyB,CAAD,CAAc,CAElD,CADI9C,CACJ,CADgB+C,CAAA,CAAeD,CAAf,CAAA,CAA4BH,CAA5B,CAChB,GACEC,CAAAtB,KAAA,CAAStB,CAAT,CAHgD,CAApD,CAMA,OAAO4C,EAAAI,KAAA,CAAS,GAAT,CARmC,CAzB5C,IAAID,EAAiB,CACnB,MAAS,CACPvB,MAAO,WADA,CAEPyB,KAAM,WAFC,CAGPtB,IAAK,SAHE,CADU,CAMnB,MAAS,CACPH,MAAO,YADA,CAEPyB,KAAM,WAFC,CAGPtB,IAAK,UAHE,CAIPD,OAAQ,aAJD,CANU,CAoCrB,OAAO,CAkCLH,KAAMA,QAAQ,CAAClB,CAAD,CAAU6C,CAAV,CAAyB7B,CAAzB,CAAuC,CAAA,IAE/C8B,CAF+C,CAEvCC,CAFuC,CAI/C3C,CAJ+C,CAM/C4C,CAN+C,CAQ/CC,EAAS,CAAA,CAEbjC,EAAA,CAAeA,CAAf,EAA+B,CAAC,OAAD,CAAU,OAAV,CAC/BhB,EAAAkD,GAAA,CAAWb,CAAA,CAAUrB,CAAV,CAAwB,OAAxB,CAAX,CAA6C,QAAQ,CAACI,CAAD,CAAQ,CAC3DhB,CAAA,CAAc0B,CAAA,CAAeV,CAAf,CACd6B,EAAA,CAAS,CAAA,CAETF,EAAA,CADAD,CACA,CADS,CAETE,EAAA;AAAU5C,CACVyC,EAAA,MAAA,EAA0BA,CAAA,MAAA,CAAuBzC,CAAvB,CAAoCgB,CAApC,CANiC,CAA7D,CAQA,KAAI+B,EAASd,CAAA,CAAUrB,CAAV,CAAwB,QAAxB,CACb,IAAImC,CAAJ,CACEnD,CAAAkD,GAAA,CAAWC,CAAX,CAAmB,QAAQ,CAAC/B,CAAD,CAAQ,CACjC6B,CAAA,CAAS,CAAA,CACTJ,EAAA,OAAA,EAA2BA,CAAA,OAAA,CAAwBzB,CAAxB,CAFM,CAAnC,CAMFpB,EAAAkD,GAAA,CAAWb,CAAA,CAAUrB,CAAV,CAAwB,MAAxB,CAAX,CAA4C,QAAQ,CAACI,CAAD,CAAQ,CAC1D,GAAK6B,CAAL,EAQK7C,CARL,CAQA,CACA,IAAID,EAAS2B,CAAA,CAAeV,CAAf,CAEb0B,EAAA,EAAUxC,IAAAC,IAAA,CAASJ,CAAAO,EAAT,CAAoBsC,CAAAtC,EAApB,CACVqC,EAAA,EAAUzC,IAAAC,IAAA,CAASJ,CAAAK,EAAT,CAAoBwC,CAAAxC,EAApB,CAEVwC,EAAA,CAAU7C,CAlHSiD,GAoHnB,CAAIN,CAAJ,EApHmBM,EAoHnB,CAAmCL,CAAnC,GAKIA,CAAJ,CAAaD,CAAb,EAEEG,CACA,CADS,CAAA,CACT,CAAAJ,CAAA,OAAA,EAA2BA,CAAA,OAAA,CAAwBzB,CAAxB,CAH7B,GAOEA,CAAAiC,eAAA,EACA,CAAAR,CAAA,KAAA,EAAyBA,CAAA,KAAA,CAAsB1C,CAAtB,CAA8BiB,CAA9B,CAR3B,CALA,CARA,CAT0D,CAA5D,CAkCApB,EAAAkD,GAAA,CAAWb,CAAA,CAAUrB,CAAV,CAAwB,KAAxB,CAAX,CAA2C,QAAQ,CAACI,CAAD,CAAQ,CACpD6B,CAAL,GACAA,CACA,CADS,CAAA,CACT,CAAAJ,CAAA,IAAA,EAAwBA,CAAA,IAAA,CAAqBf,CAAA,CAAeV,CAAf,CAArB,CAA4CA,CAA5C,CAFxB,CADyD,CAA3D,CA7DmD,CAlChD,CAxC6B,CAAZ,CAA1B,CAiMA,KAAIvC,EAA+B,CAAC,QAAD,CAAW,UAAX,CAAuB,cAAvB,CAC/B,QAAQ,CAACgB,CAAD,CAASyD,CAAT,CAAmBC,CAAnB,CAAiC,CA2D3CC,QAASA,EAAqB,CAACC,CAAD,CAAmB/C,CAAnB,CAAsBF,CAAtB,CAAyB,CACrD,IAAS,IAAArB,EAAI,CAAb,CAAgBA,CAAhB,CAAoBsE,CAAArE,OAApB,CAA6CD,CAA7C,EAAkD,CAAlD,CAAqD,CACtB,IAAA,EAAAsE,CAAA,CAAiBtE,CAAjB,CAAqB,CAArB,CAAA,CAA4BqB,EAAAA,CAAzD,IAzDwBkD,EAyDxB,CARKpD,IAAAC,IAAA,CAQGkD,CAAAE,CAAiBxE,CAAjBwE,CARH,CAQiDjD,CARjD,CAQL,EAzDwBgD,EAyDxB,CARkDpD,IAAAC,IAAA,CAASqD,CAAT;AAAcC,CAAd,CAQlD,CAEE,MADAJ,EAAApE,OAAA,CAAwBF,CAAxB,CAA2BA,CAA3B,CAA+B,CAA/B,CACO,CAAA,CAAA,CAH0C,CAMrD,MAAO,CAAA,CAP8C,CAYvD2E,QAASA,EAAO,CAAC1C,CAAD,CAAQ,CACtB,GAAI,EArEiB2C,IAqEjB,CAAAC,IAAAC,IAAA,EAAA,CAAaC,CAAb,CAAJ,CAAA,CAIA,IAAIlC,EAAUZ,CAAAY,QAAA,EAAiBZ,CAAAY,QAAA5C,OAAjB,CAAwCgC,CAAAY,QAAxC,CAAwD,CAACZ,CAAD,CAAtE,CACIV,EAAIsB,CAAA,CAAQ,CAAR,CAAAG,QADR,CAEI3B,EAAIwB,CAAA,CAAQ,CAAR,CAAAI,QAKR,IAAI,EAAI,CAAJ,CAAA1B,CAAA,EAAa,CAAb,CAASF,CAAT,EAGA2D,CAHA,EAIAA,CAAA,CAA0B,CAA1B,CAJA,GAIiCzD,CAJjC,EAIsCyD,CAAA,CAA0B,CAA1B,CAJtC,GAIuE3D,CAJvE,CAAJ,CAGA,CAKI2D,CAAJ,GACEA,CADF,CAC8B,IAD9B,CAIcC,KAAAA,EAAAhD,CAAAgD,OAAkB,QAAhC,GAxZKjG,CAAAkG,UAAA,CAAkBrE,CAAAsE,SAAlB,EAAuCtE,CAAA,CAAQ,CAAR,CAAvC,EAAqDA,CAAA,CAAQ,CAAR,CAAAsE,SAArD,CAwZL,GACEH,CADF,CAC8B,CAACzD,CAAD,CAAIF,CAAJ,CAD9B,CAOIgD,EAAA,CAAsBC,CAAtB,CAAwC/C,CAAxC,CAA2CF,CAA3C,CAAJ,GAKAY,CAAAmD,gBAAA,EAIA,CAHAnD,CAAAiC,eAAA,EAGA,CAAAjC,CAAAgD,OAAA,EAAgBhD,CAAAgD,OAAAI,KAAhB,EAAqCpD,CAAAgD,OAAAI,KAAA,EATrC,CAhBA,CAdA,CADsB,CA8CxBC,QAASA,EAAY,CAACrD,CAAD,CAAQ,CACvBY,CAAAA,CAAUZ,CAAAY,QAAA,EAAiBZ,CAAAY,QAAA5C,OAAjB,CAAwCgC,CAAAY,QAAxC,CAAwD,CAACZ,CAAD,CACtE,KAAIV,EAAIsB,CAAA,CAAQ,CAAR,CAAAG,QAAR,CACI3B,EAAIwB,CAAA,CAAQ,CAAR,CAAAI,QACRqB,EAAAxC,KAAA,CAAsBP,CAAtB,CAAyBF,CAAzB,CAEA8C,EAAA,CAAS,QAAQ,EAAG,CAElB,IAAS,IAAAnE;AAAI,CAAb,CAAgBA,CAAhB,CAAoBsE,CAAArE,OAApB,CAA6CD,CAA7C,EAAkD,CAAlD,CACE,GAAIsE,CAAA,CAAiBtE,CAAjB,CAAJ,EAA2BuB,CAA3B,EAAgC+C,CAAA,CAAiBtE,CAAjB,CAAqB,CAArB,CAAhC,EAA2DqB,CAA3D,CAA8D,CAC5DiD,CAAApE,OAAA,CAAwBF,CAAxB,CAA2BA,CAA3B,CAA+B,CAA/B,CACA,MAF4D,CAH9C,CAApB,CAxHqB4E,IAwHrB,CAQqB,CAAA,CARrB,CAN2B,CA9G7B,IAAIG,CAAJ,CACIT,CADJ,CAEIU,CA4IJ,OAAO,SAAQ,CAACpE,CAAD,CAAQC,CAAR,CAAiBC,CAAjB,CAAuB,CAAA,IAChCyE,EAAe7E,CAAA,CAAOI,CAAA0E,QAAP,CADiB,CAEhCC,EAAU,CAAA,CAFsB,CAGhCC,CAHgC,CAIhCC,CAJgC,CAKhCC,CALgC,CAMhCC,CAOJhF,EAAAkD,GAAA,CAAW,YAAX,CAAyB,QAAQ,CAAC9B,CAAD,CAAQ,CACvCwD,CAAA,CAAU,CAAA,CACVC,EAAA,CAAazD,CAAAgD,OAAA,CAAehD,CAAAgD,OAAf,CAA8BhD,CAAA6D,WAEhB,EAA3B,EAAIJ,CAAAK,SAAJ,GACEL,CADF,CACeA,CAAAM,WADf,CAIAnF,EAAAoF,SAAA,CApKoBC,iBAoKpB,CAEAP,EAAA,CAAYd,IAAAC,IAAA,EAGRlC,EAAAA,CAAgBX,CAAAW,cAAhBA,EAAuCX,CAEvCa,EAAAA,CAAI,CADMF,CAAAC,QAAAA,EAAyBD,CAAAC,QAAA5C,OAAzB4C,CAAwDD,CAAAC,QAAxDA,CAAgF,CAACD,CAAD,CACtF,EAAQ,CAAR,CACRgD,EAAA,CAAc9C,CAAAE,QACd6C,EAAA,CAAc/C,CAAAG,QAjByB,CAAzC,CAoBApC,EAAAkD,GAAA,CAAW,aAAX,CAA0B,QAAQ,CAAC9B,CAAD,CAAQ,CAxBxCwD,CAAA,CAAU,CAAA,CACV5E,EAAAsF,YAAA,CAzJoBD,iBAyJpB,CAuBwC,CAA1C,CAIArF,EAAAkD,GAAA,CAAW,UAAX,CAAuB,QAAQ,CAAC9B,CAAD,CAAQ,CACrC,IAAImE,EAAOvB,IAAAC,IAAA,EAAPsB,CAAoBT,CAAxB,CAGI/C,EAAgBX,CAAAW,cAAhBA;AAAuCX,CAH3C,CAOIa,EAAI,CAHOF,CAAAG,eAADF,EAAiCD,CAAAG,eAAA9C,OAAjC4C,CACVD,CAAAG,eADUF,CAERD,CAAAC,QAAD,EAA0BD,CAAAC,QAAA5C,OAA1B,CAA0D2C,CAAAC,QAA1D,CAAkF,CAACD,CAAD,CAC/E,EAAQ,CAAR,CAPR,CAQIrB,EAAIuB,CAAAE,QARR,CASI3B,EAAIyB,CAAAG,QATR,CAUIoD,EAAOlF,IAAAmF,KAAA,CAAUnF,IAAAoF,IAAA,CAAShF,CAAT,CAAaqE,CAAb,CAA0B,CAA1B,CAAV,CAAyCzE,IAAAoF,IAAA,CAASlF,CAAT,CAAawE,CAAb,CAA0B,CAA1B,CAAzC,CAEPJ,EAAJ,EAtMee,GAsMf,CAAeJ,CAAf,EArMiBK,EAqMjB,CAAsCJ,CAAtC,GA9DG/B,CAyED,GAxEFF,CAAA,CAAa,CAAb,CAAAsC,iBAAA,CAAiC,OAAjC,CAA0C/B,CAA1C,CAAmD,CAAA,CAAnD,CAEA,CADAP,CAAA,CAAa,CAAb,CAAAsC,iBAAA,CAAiC,YAAjC,CAA+CpB,CAA/C,CAA6D,CAAA,CAA7D,CACA,CAAAhB,CAAA,CAAmB,EAsEjB,EAnEJS,CAmEI,CAnEgBF,IAAAC,IAAA,EAmEhB,CAjEJT,CAAA,CAAsBC,CAAtB,CAwDsB/C,CAxDtB,CAwDyBF,CAxDzB,CAiEI,CAJIqE,CAIJ,EAHEA,CAAAL,KAAA,EAGF,CAAKrG,CAAAS,UAAA,CAAkBqB,CAAA6F,SAAlB,CAAL,EAA2D,CAAA,CAA3D,GAAyC7F,CAAA6F,SAAzC,EACE9F,CAAAwB,eAAA,CAAuB,OAAvB,CAAgC,CAACJ,CAAD,CAAhC,CAZJ,CAzCAwD,EAAA,CAAU,CAAA,CACV5E,EAAAsF,YAAA,CAzJoBD,iBAyJpB,CA2BqC,CAAvC,CAkCArF,EAAA+F,QAAA,CAAkBC,QAAQ,CAAC5E,CAAD,CAAQ,EAQlCpB,EAAAkD,GAAA,CAAW,OAAX,CAAoB,QAAQ,CAAC9B,CAAD,CAAQ6E,CAAR,CAAkB,CAC5ClG,CAAAwB,OAAA,CAAa,QAAQ,EAAG,CACtBmD,CAAA,CAAa3E,CAAb;AAAoB,CAAC0B,OAASwE,CAATxE,EAAqBL,CAAtB,CAApB,CADsB,CAAxB,CAD4C,CAA9C,CAMApB,EAAAkD,GAAA,CAAW,WAAX,CAAwB,QAAQ,CAAC9B,CAAD,CAAQ,CACtCpB,CAAAoF,SAAA,CArOoBC,iBAqOpB,CADsC,CAAxC,CAIArF,EAAAkD,GAAA,CAAW,mBAAX,CAAgC,QAAQ,CAAC9B,CAAD,CAAQ,CAC9CpB,CAAAsF,YAAA,CAzOoBD,iBAyOpB,CAD8C,CAAhD,CAzFoC,CArJK,CADV,CAwXnC7F,EAAA,CAAmB,aAAnB,CAAmC,EAAnC,CAAsC,WAAtC,CACAA,EAAA,CAAmB,cAAnB,CAAmC,CAAnC,CAAsC,YAAtC,CA/sBsC,CAArC,CAAD,CAmtBGtB,MAntBH,CAmtBWA,MAAAC,QAntBX;",
+"sources":["angular-touch.js"],
+"names":["window","angular","undefined","$TouchProvider","$provide","$compileProvider","ngClickOverrideEnabled","ngClickDirectiveAdded","this.ngClickOverrideEnabled","enabled","isDefined","ngTouchClickDirectiveFactory","$$moduleName","directive","decorator","$delegate","shift","i","length","splice","$get","this.$get","makeSwipeDirective","directiveName","direction","eventName","ngTouch","$parse","$swipe","scope","element","attr","validSwipe","coords","startCoords","deltaY","Math","abs","y","deltaX","x","valid","MAX_VERTICAL_DISTANCE","MIN_HORIZONTAL_DISTANCE","MAX_VERTICAL_RATIO","swipeHandler","pointerTypes","push","bind","start","event","cancel","end","$apply","triggerHandler","$event","module","provider","$inject","factory","getCoordinates","originalEvent","touches","e","changedTouches","clientX","clientY","getEvents","eventType","res","forEach","pointerType","POINTER_EVENTS","join","move","eventHandlers","totalX","totalY","lastPos","active","on","events","MOVE_BUFFER_RADIUS","preventDefault","$timeout","$rootElement","checkAllowableRegions","touchCoordinates","CLICKBUSTER_THRESHOLD","x1","y1","y2","onClick","PREVENT_DURATION","Date","now","lastPreventedTime","lastLabelClickCoordinates","target","lowercase","nodeName","stopPropagation","blur","onTouchStart","clickHandler","ngClick","tapping","tapElement","startTime","touchStartX","touchStartY","srcElement","nodeType","parentNode","addClass","ACTIVE_CLASS_NAME","removeClass","diff","dist","sqrt","pow","TAP_DURATION","MOVE_TOLERANCE","addEventListener","disabled","onclick","element.onclick","touchend"]
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.js
new file mode 100644
index 00000000..a8aad46a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.js
@@ -0,0 +1,30428 @@
+/**
+ * @license AngularJS v1.5.0
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, document, undefined) {'use strict';
+
+/**
+ * @description
+ *
+ * This object provides a utility for producing rich Error messages within
+ * Angular. It can be called as follows:
+ *
+ * var exampleMinErr = minErr('example');
+ * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
+ *
+ * The above creates an instance of minErr in the example namespace. The
+ * resulting error will have a namespaced error code of example.one. The
+ * resulting error will replace {0} with the value of foo, and {1} with the
+ * value of bar. The object is not restricted in the number of arguments it can
+ * take.
+ *
+ * If fewer arguments are specified than necessary for interpolation, the extra
+ * interpolation markers will be preserved in the final string.
+ *
+ * Since data will be parsed statically during a build step, some restrictions
+ * are applied with respect to how minErr instances are created and called.
+ * Instances should have names of the form namespaceMinErr for a minErr created
+ * using minErr('namespace') . Error codes, namespaces and template strings
+ * should all be static strings, not variables or general expressions.
+ *
+ * @param {string} module The namespace to use for the new minErr instance.
+ * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning
+ * error from returned function, for cases when a particular type of error is useful.
+ * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
+ */
+
+function minErr(module, ErrorConstructor) {
+ ErrorConstructor = ErrorConstructor || Error;
+ return function() {
+ var SKIP_INDEXES = 2;
+
+ var templateArgs = arguments,
+ code = templateArgs[0],
+ message = '[' + (module ? module + ':' : '') + code + '] ',
+ template = templateArgs[1],
+ paramPrefix, i;
+
+ message += template.replace(/\{\d+\}/g, function(match) {
+ var index = +match.slice(1, -1),
+ shiftedIndex = index + SKIP_INDEXES;
+
+ if (shiftedIndex < templateArgs.length) {
+ return toDebugString(templateArgs[shiftedIndex]);
+ }
+
+ return match;
+ });
+
+ message += '\nhttp://errors.angularjs.org/1.5.0/' +
+ (module ? module + '/' : '') + code;
+
+ for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
+ message += paramPrefix + 'p' + (i - SKIP_INDEXES) + '=' +
+ encodeURIComponent(toDebugString(templateArgs[i]));
+ }
+
+ return new ErrorConstructor(message);
+ };
+}
+
+/* We need to tell jshint what variables are being exported */
+/* global angular: true,
+ msie: true,
+ jqLite: true,
+ jQuery: true,
+ slice: true,
+ splice: true,
+ push: true,
+ toString: true,
+ ngMinErr: true,
+ angularModule: true,
+ uid: true,
+ REGEX_STRING_REGEXP: true,
+ VALIDITY_STATE_PROPERTY: true,
+
+ lowercase: true,
+ uppercase: true,
+ manualLowercase: true,
+ manualUppercase: true,
+ nodeName_: true,
+ isArrayLike: true,
+ forEach: true,
+ forEachSorted: true,
+ reverseParams: true,
+ nextUid: true,
+ setHashKey: true,
+ extend: true,
+ toInt: true,
+ inherit: true,
+ merge: true,
+ noop: true,
+ identity: true,
+ valueFn: true,
+ isUndefined: true,
+ isDefined: true,
+ isObject: true,
+ isBlankObject: true,
+ isString: true,
+ isNumber: true,
+ isDate: true,
+ isArray: true,
+ isFunction: true,
+ isRegExp: true,
+ isWindow: true,
+ isScope: true,
+ isFile: true,
+ isFormData: true,
+ isBlob: true,
+ isBoolean: true,
+ isPromiseLike: true,
+ trim: true,
+ escapeForRegexp: true,
+ isElement: true,
+ makeMap: true,
+ includes: true,
+ arrayRemove: true,
+ copy: true,
+ shallowCopy: true,
+ equals: true,
+ csp: true,
+ jq: true,
+ concat: true,
+ sliceArgs: true,
+ bind: true,
+ toJsonReplacer: true,
+ toJson: true,
+ fromJson: true,
+ convertTimezoneToLocal: true,
+ timezoneToOffset: true,
+ startingTag: true,
+ tryDecodeURIComponent: true,
+ parseKeyValue: true,
+ toKeyValue: true,
+ encodeUriSegment: true,
+ encodeUriQuery: true,
+ angularInit: true,
+ bootstrap: true,
+ getTestability: true,
+ snake_case: true,
+ bindJQuery: true,
+ assertArg: true,
+ assertArgFn: true,
+ assertNotHasOwnProperty: true,
+ getter: true,
+ getBlockNodes: true,
+ hasOwnProperty: true,
+ createMap: true,
+
+ NODE_TYPE_ELEMENT: true,
+ NODE_TYPE_ATTRIBUTE: true,
+ NODE_TYPE_TEXT: true,
+ NODE_TYPE_COMMENT: true,
+ NODE_TYPE_DOCUMENT: true,
+ NODE_TYPE_DOCUMENT_FRAGMENT: true,
+*/
+
+////////////////////////////////////
+
+/**
+ * @ngdoc module
+ * @name ng
+ * @module ng
+ * @description
+ *
+ * # ng (core module)
+ * The ng module is loaded by default when an AngularJS application is started. The module itself
+ * contains the essential components for an AngularJS application to function. The table below
+ * lists a high level breakdown of each of the services/factories, filters, directives and testing
+ * components available within this core module.
+ *
+ * <div doc-module-components="ng"></div>
+ */
+
+var REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
+
+// The name of a form control's ValidityState property.
+// This is used so that it's possible for internal tests to create mock ValidityStates.
+var VALIDITY_STATE_PROPERTY = 'validity';
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+var lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;};
+var uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;};
+
+
+var manualLowercase = function(s) {
+ /* jshint bitwise: false */
+ return isString(s)
+ ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})
+ : s;
+};
+var manualUppercase = function(s) {
+ /* jshint bitwise: false */
+ return isString(s)
+ ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})
+ : s;
+};
+
+
+// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish
+// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods
+// with correct but slower alternatives. See https://github.com/angular/angular.js/issues/11387
+if ('i' !== 'I'.toLowerCase()) {
+ lowercase = manualLowercase;
+ uppercase = manualUppercase;
+}
+
+
+var
+ msie, // holds major version number for IE, or NaN if UA is not IE.
+ jqLite, // delay binding since jQuery could be loaded after us.
+ jQuery, // delay binding
+ slice = [].slice,
+ splice = [].splice,
+ push = [].push,
+ toString = Object.prototype.toString,
+ getPrototypeOf = Object.getPrototypeOf,
+ ngMinErr = minErr('ng'),
+
+ /** @name angular */
+ angular = window.angular || (window.angular = {}),
+ angularModule,
+ uid = 0;
+
+/**
+ * documentMode is an IE-only property
+ * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx
+ */
+msie = document.documentMode;
+
+
+/**
+ * @private
+ * @param {*} obj
+ * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments,
+ * String ...)
+ */
+function isArrayLike(obj) {
+
+ // `null`, `undefined` and `window` are not array-like
+ if (obj == null || isWindow(obj)) return false;
+
+ // arrays, strings and jQuery/jqLite objects are array like
+ // * jqLite is either the jQuery or jqLite constructor function
+ // * we have to check the existence of jqLite first as this method is called
+ // via the forEach method when constructing the jqLite object in the first place
+ if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true;
+
+ // Support: iOS 8.2 (not reproducible in simulator)
+ // "length" in obj used to prevent JIT error (gh-11508)
+ var length = "length" in Object(obj) && obj.length;
+
+ // NodeList objects (with `item` method) and
+ // other objects with suitable length characteristics are array-like
+ return isNumber(length) &&
+ (length >= 0 && ((length - 1) in obj || obj instanceof Array) || typeof obj.item == 'function');
+
+}
+
+/**
+ * @ngdoc function
+ * @name angular.forEach
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Invokes the `iterator` function once for each item in `obj` collection, which can be either an
+ * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value`
+ * is the value of an object property or an array element, `key` is the object property key or
+ * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional.
+ *
+ * It is worth noting that `.forEach` does not iterate over inherited properties because it filters
+ * using the `hasOwnProperty` method.
+ *
+ * Unlike ES262's
+ * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18),
+ * Providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just
+ * return the value provided.
+ *
+ ```js
+ var values = {name: 'misko', gender: 'male'};
+ var log = [];
+ angular.forEach(values, function(value, key) {
+ this.push(key + ': ' + value);
+ }, log);
+ expect(log).toEqual(['name: misko', 'gender: male']);
+ ```
+ *
+ * @param {Object|Array} obj Object to iterate over.
+ * @param {Function} iterator Iterator function.
+ * @param {Object=} context Object to become context (`this`) for the iterator function.
+ * @returns {Object|Array} Reference to `obj`.
+ */
+
+function forEach(obj, iterator, context) {
+ var key, length;
+ if (obj) {
+ if (isFunction(obj)) {
+ for (key in obj) {
+ // Need to check if hasOwnProperty exists,
+ // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
+ if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ }
+ } else if (isArray(obj) || isArrayLike(obj)) {
+ var isPrimitive = typeof obj !== 'object';
+ for (key = 0, length = obj.length; key < length; key++) {
+ if (isPrimitive || key in obj) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ }
+ } else if (obj.forEach && obj.forEach !== forEach) {
+ obj.forEach(iterator, context, obj);
+ } else if (isBlankObject(obj)) {
+ // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
+ for (key in obj) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ } else if (typeof obj.hasOwnProperty === 'function') {
+ // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed
+ for (key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ }
+ } else {
+ // Slow path for objects which do not have a method `hasOwnProperty`
+ for (key in obj) {
+ if (hasOwnProperty.call(obj, key)) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ }
+ }
+ }
+ return obj;
+}
+
+function forEachSorted(obj, iterator, context) {
+ var keys = Object.keys(obj).sort();
+ for (var i = 0; i < keys.length; i++) {
+ iterator.call(context, obj[keys[i]], keys[i]);
+ }
+ return keys;
+}
+
+
+/**
+ * when using forEach the params are value, key, but it is often useful to have key, value.
+ * @param {function(string, *)} iteratorFn
+ * @returns {function(*, string)}
+ */
+function reverseParams(iteratorFn) {
+ return function(value, key) {iteratorFn(key, value);};
+}
+
+/**
+ * A consistent way of creating unique IDs in angular.
+ *
+ * Using simple numbers allows us to generate 28.6 million unique ids per second for 10 years before
+ * we hit number precision issues in JavaScript.
+ *
+ * Math.pow(2,53) / 60 / 60 / 24 / 365 / 10 = 28.6M
+ *
+ * @returns {number} an unique alpha-numeric string
+ */
+function nextUid() {
+ return ++uid;
+}
+
+
+/**
+ * Set or clear the hashkey for an object.
+ * @param obj object
+ * @param h the hashkey (!truthy to delete the hashkey)
+ */
+function setHashKey(obj, h) {
+ if (h) {
+ obj.$$hashKey = h;
+ } else {
+ delete obj.$$hashKey;
+ }
+}
+
+
+function baseExtend(dst, objs, deep) {
+ var h = dst.$$hashKey;
+
+ for (var i = 0, ii = objs.length; i < ii; ++i) {
+ var obj = objs[i];
+ if (!isObject(obj) && !isFunction(obj)) continue;
+ var keys = Object.keys(obj);
+ for (var j = 0, jj = keys.length; j < jj; j++) {
+ var key = keys[j];
+ var src = obj[key];
+
+ if (deep && isObject(src)) {
+ if (isDate(src)) {
+ dst[key] = new Date(src.valueOf());
+ } else if (isRegExp(src)) {
+ dst[key] = new RegExp(src);
+ } else if (src.nodeName) {
+ dst[key] = src.cloneNode(true);
+ } else if (isElement(src)) {
+ dst[key] = src.clone();
+ } else {
+ if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
+ baseExtend(dst[key], [src], true);
+ }
+ } else {
+ dst[key] = src;
+ }
+ }
+ }
+
+ setHashKey(dst, h);
+ return dst;
+}
+
+/**
+ * @ngdoc function
+ * @name angular.extend
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s)
+ * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so
+ * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`.
+ *
+ * **Note:** Keep in mind that `angular.extend` does not support recursive merge (deep copy). Use
+ * {@link angular.merge} for this.
+ *
+ * @param {Object} dst Destination object.
+ * @param {...Object} src Source object(s).
+ * @returns {Object} Reference to `dst`.
+ */
+function extend(dst) {
+ return baseExtend(dst, slice.call(arguments, 1), false);
+}
+
+
+/**
+* @ngdoc function
+* @name angular.merge
+* @module ng
+* @kind function
+*
+* @description
+* Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s)
+* to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so
+* by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`.
+*
+* Unlike {@link angular.extend extend()}, `merge()` recursively descends into object properties of source
+* objects, performing a deep copy.
+*
+* @param {Object} dst Destination object.
+* @param {...Object} src Source object(s).
+* @returns {Object} Reference to `dst`.
+*/
+function merge(dst) {
+ return baseExtend(dst, slice.call(arguments, 1), true);
+}
+
+
+
+function toInt(str) {
+ return parseInt(str, 10);
+}
+
+
+function inherit(parent, extra) {
+ return extend(Object.create(parent), extra);
+}
+
+/**
+ * @ngdoc function
+ * @name angular.noop
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * A function that performs no operations. This function can be useful when writing code in the
+ * functional style.
+ ```js
+ function foo(callback) {
+ var result = calculateResult();
+ (callback || angular.noop)(result);
+ }
+ ```
+ */
+function noop() {}
+noop.$inject = [];
+
+
+/**
+ * @ngdoc function
+ * @name angular.identity
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * A function that returns its first argument. This function is useful when writing code in the
+ * functional style.
+ *
+ ```js
+ function transformer(transformationFn, value) {
+ return (transformationFn || angular.identity)(value);
+ };
+ ```
+ * @param {*} value to be returned.
+ * @returns {*} the value passed in.
+ */
+function identity($) {return $;}
+identity.$inject = [];
+
+
+function valueFn(value) {return function() {return value;};}
+
+function hasCustomToString(obj) {
+ return isFunction(obj.toString) && obj.toString !== toString;
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isUndefined
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is undefined.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is undefined.
+ */
+function isUndefined(value) {return typeof value === 'undefined';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isDefined
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is defined.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is defined.
+ */
+function isDefined(value) {return typeof value !== 'undefined';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isObject
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not
+ * considered to be objects. Note that JavaScript arrays are objects.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is an `Object` but not `null`.
+ */
+function isObject(value) {
+ // http://jsperf.com/isobject4
+ return value !== null && typeof value === 'object';
+}
+
+
+/**
+ * Determine if a value is an object with a null prototype
+ *
+ * @returns {boolean} True if `value` is an `Object` with a null prototype
+ */
+function isBlankObject(value) {
+ return value !== null && typeof value === 'object' && !getPrototypeOf(value);
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isString
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `String`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `String`.
+ */
+function isString(value) {return typeof value === 'string';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isNumber
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `Number`.
+ *
+ * This includes the "special" numbers `NaN`, `+Infinity` and `-Infinity`.
+ *
+ * If you wish to exclude these then you can use the native
+ * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite)
+ * method.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Number`.
+ */
+function isNumber(value) {return typeof value === 'number';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isDate
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a value is a date.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Date`.
+ */
+function isDate(value) {
+ return toString.call(value) === '[object Date]';
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isArray
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is an `Array`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is an `Array`.
+ */
+var isArray = Array.isArray;
+
+/**
+ * @ngdoc function
+ * @name angular.isFunction
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `Function`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Function`.
+ */
+function isFunction(value) {return typeof value === 'function';}
+
+
+/**
+ * Determines if a value is a regular expression object.
+ *
+ * @private
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `RegExp`.
+ */
+function isRegExp(value) {
+ return toString.call(value) === '[object RegExp]';
+}
+
+
+/**
+ * Checks if `obj` is a window object.
+ *
+ * @private
+ * @param {*} obj Object to check
+ * @returns {boolean} True if `obj` is a window obj.
+ */
+function isWindow(obj) {
+ return obj && obj.window === obj;
+}
+
+
+function isScope(obj) {
+ return obj && obj.$evalAsync && obj.$watch;
+}
+
+
+function isFile(obj) {
+ return toString.call(obj) === '[object File]';
+}
+
+
+function isFormData(obj) {
+ return toString.call(obj) === '[object FormData]';
+}
+
+
+function isBlob(obj) {
+ return toString.call(obj) === '[object Blob]';
+}
+
+
+function isBoolean(value) {
+ return typeof value === 'boolean';
+}
+
+
+function isPromiseLike(obj) {
+ return obj && isFunction(obj.then);
+}
+
+
+var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/;
+function isTypedArray(value) {
+ return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value));
+}
+
+function isArrayBuffer(obj) {
+ return toString.call(obj) === '[object ArrayBuffer]';
+}
+
+
+var trim = function(value) {
+ return isString(value) ? value.trim() : value;
+};
+
+// Copied from:
+// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021
+// Prereq: s is a string.
+var escapeForRegexp = function(s) {
+ return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1').
+ replace(/\x08/g, '\\x08');
+};
+
+
+/**
+ * @ngdoc function
+ * @name angular.isElement
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a DOM element (or wrapped jQuery element).
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).
+ */
+function isElement(node) {
+ return !!(node &&
+ (node.nodeName // we are a direct element
+ || (node.prop && node.attr && node.find))); // we have an on and find method part of jQuery API
+}
+
+/**
+ * @param str 'key1,key2,...'
+ * @returns {object} in the form of {key1:true, key2:true, ...}
+ */
+function makeMap(str) {
+ var obj = {}, items = str.split(','), i;
+ for (i = 0; i < items.length; i++) {
+ obj[items[i]] = true;
+ }
+ return obj;
+}
+
+
+function nodeName_(element) {
+ return lowercase(element.nodeName || (element[0] && element[0].nodeName));
+}
+
+function includes(array, obj) {
+ return Array.prototype.indexOf.call(array, obj) != -1;
+}
+
+function arrayRemove(array, value) {
+ var index = array.indexOf(value);
+ if (index >= 0) {
+ array.splice(index, 1);
+ }
+ return index;
+}
+
+/**
+ * @ngdoc function
+ * @name angular.copy
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Creates a deep copy of `source`, which should be an object or an array.
+ *
+ * * If no destination is supplied, a copy of the object or array is created.
+ * * If a destination is provided, all of its elements (for arrays) or properties (for objects)
+ * are deleted and then all elements/properties from the source are copied to it.
+ * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.
+ * * If `source` is identical to 'destination' an exception will be thrown.
+ *
+ * @param {*} source The source that will be used to make a copy.
+ * Can be any type, including primitives, `null`, and `undefined`.
+ * @param {(Object|Array)=} destination Destination into which the source is copied. If
+ * provided, must be of the same type as `source`.
+ * @returns {*} The copy or updated `destination`, if `destination` was specified.
+ *
+ * @example
+ <example module="copyExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form novalidate class="simple-form">
+ Name: <input type="text" ng-model="user.name" /><br />
+ E-mail: <input type="email" ng-model="user.email" /><br />
+ Gender: <input type="radio" ng-model="user.gender" value="male" />male
+ <input type="radio" ng-model="user.gender" value="female" />female<br />
+ <button ng-click="reset()">RESET</button>
+ <button ng-click="update(user)">SAVE</button>
+ </form>
+ <pre>form = {{user | json}}</pre>
+ <pre>master = {{master | json}}</pre>
+ </div>
+
+ <script>
+ angular.module('copyExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.master= {};
+
+ $scope.update = function(user) {
+ // Example with 1 argument
+ $scope.master= angular.copy(user);
+ };
+
+ $scope.reset = function() {
+ // Example with 2 arguments
+ angular.copy($scope.master, $scope.user);
+ };
+
+ $scope.reset();
+ }]);
+ </script>
+ </file>
+ </example>
+ */
+function copy(source, destination) {
+ var stackSource = [];
+ var stackDest = [];
+
+ if (destination) {
+ if (isTypedArray(destination) || isArrayBuffer(destination)) {
+ throw ngMinErr('cpta', "Can't copy! TypedArray destination cannot be mutated.");
+ }
+ if (source === destination) {
+ throw ngMinErr('cpi', "Can't copy! Source and destination are identical.");
+ }
+
+ // Empty the destination object
+ if (isArray(destination)) {
+ destination.length = 0;
+ } else {
+ forEach(destination, function(value, key) {
+ if (key !== '$$hashKey') {
+ delete destination[key];
+ }
+ });
+ }
+
+ stackSource.push(source);
+ stackDest.push(destination);
+ return copyRecurse(source, destination);
+ }
+
+ return copyElement(source);
+
+ function copyRecurse(source, destination) {
+ var h = destination.$$hashKey;
+ var result, key;
+ if (isArray(source)) {
+ for (var i = 0, ii = source.length; i < ii; i++) {
+ destination.push(copyElement(source[i]));
+ }
+ } else if (isBlankObject(source)) {
+ // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
+ for (key in source) {
+ destination[key] = copyElement(source[key]);
+ }
+ } else if (source && typeof source.hasOwnProperty === 'function') {
+ // Slow path, which must rely on hasOwnProperty
+ for (key in source) {
+ if (source.hasOwnProperty(key)) {
+ destination[key] = copyElement(source[key]);
+ }
+ }
+ } else {
+ // Slowest path --- hasOwnProperty can't be called as a method
+ for (key in source) {
+ if (hasOwnProperty.call(source, key)) {
+ destination[key] = copyElement(source[key]);
+ }
+ }
+ }
+ setHashKey(destination, h);
+ return destination;
+ }
+
+ function copyElement(source) {
+ // Simple values
+ if (!isObject(source)) {
+ return source;
+ }
+
+ // Already copied values
+ var index = stackSource.indexOf(source);
+ if (index !== -1) {
+ return stackDest[index];
+ }
+
+ if (isWindow(source) || isScope(source)) {
+ throw ngMinErr('cpws',
+ "Can't copy! Making copies of Window or Scope instances is not supported.");
+ }
+
+ var needsRecurse = false;
+ var destination = copyType(source);
+
+ if (destination === undefined) {
+ destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));
+ needsRecurse = true;
+ }
+
+ stackSource.push(source);
+ stackDest.push(destination);
+
+ return needsRecurse
+ ? copyRecurse(source, destination)
+ : destination;
+ }
+
+ function copyType(source) {
+ switch (toString.call(source)) {
+ case '[object Int8Array]':
+ case '[object Int16Array]':
+ case '[object Int32Array]':
+ case '[object Float32Array]':
+ case '[object Float64Array]':
+ case '[object Uint8Array]':
+ case '[object Uint8ClampedArray]':
+ case '[object Uint16Array]':
+ case '[object Uint32Array]':
+ return new source.constructor(copyElement(source.buffer));
+
+ case '[object ArrayBuffer]':
+ //Support: IE10
+ if (!source.slice) {
+ var copied = new ArrayBuffer(source.byteLength);
+ new Uint8Array(copied).set(new Uint8Array(source));
+ return copied;
+ }
+ return source.slice(0);
+
+ case '[object Boolean]':
+ case '[object Number]':
+ case '[object String]':
+ case '[object Date]':
+ return new source.constructor(source.valueOf());
+
+ case '[object RegExp]':
+ var re = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
+ re.lastIndex = source.lastIndex;
+ return re;
+ }
+
+ if (isFunction(source.cloneNode)) {
+ return source.cloneNode(true);
+ }
+ }
+}
+
+/**
+ * Creates a shallow copy of an object, an array or a primitive.
+ *
+ * Assumes that there are no proto properties for objects.
+ */
+function shallowCopy(src, dst) {
+ if (isArray(src)) {
+ dst = dst || [];
+
+ for (var i = 0, ii = src.length; i < ii; i++) {
+ dst[i] = src[i];
+ }
+ } else if (isObject(src)) {
+ dst = dst || {};
+
+ for (var key in src) {
+ if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
+ dst[key] = src[key];
+ }
+ }
+ }
+
+ return dst || src;
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.equals
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if two objects or two values are equivalent. Supports value types, regular
+ * expressions, arrays and objects.
+ *
+ * Two objects or values are considered equivalent if at least one of the following is true:
+ *
+ * * Both objects or values pass `===` comparison.
+ * * Both objects or values are of the same type and all of their properties are equal by
+ * comparing them with `angular.equals`.
+ * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal)
+ * * Both values represent the same regular expression (In JavaScript,
+ * /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual
+ * representation matches).
+ *
+ * During a property comparison, properties of `function` type and properties with names
+ * that begin with `$` are ignored.
+ *
+ * Scope and DOMWindow objects are being compared only by identify (`===`).
+ *
+ * @param {*} o1 Object or value to compare.
+ * @param {*} o2 Object or value to compare.
+ * @returns {boolean} True if arguments are equal.
+ */
+function equals(o1, o2) {
+ if (o1 === o2) return true;
+ if (o1 === null || o2 === null) return false;
+ if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
+ var t1 = typeof o1, t2 = typeof o2, length, key, keySet;
+ if (t1 == t2 && t1 == 'object') {
+ if (isArray(o1)) {
+ if (!isArray(o2)) return false;
+ if ((length = o1.length) == o2.length) {
+ for (key = 0; key < length; key++) {
+ if (!equals(o1[key], o2[key])) return false;
+ }
+ return true;
+ }
+ } else if (isDate(o1)) {
+ if (!isDate(o2)) return false;
+ return equals(o1.getTime(), o2.getTime());
+ } else if (isRegExp(o1)) {
+ if (!isRegExp(o2)) return false;
+ return o1.toString() == o2.toString();
+ } else {
+ if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||
+ isArray(o2) || isDate(o2) || isRegExp(o2)) return false;
+ keySet = createMap();
+ for (key in o1) {
+ if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
+ if (!equals(o1[key], o2[key])) return false;
+ keySet[key] = true;
+ }
+ for (key in o2) {
+ if (!(key in keySet) &&
+ key.charAt(0) !== '$' &&
+ isDefined(o2[key]) &&
+ !isFunction(o2[key])) return false;
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+var csp = function() {
+ if (!isDefined(csp.rules)) {
+
+
+ var ngCspElement = (document.querySelector('[ng-csp]') ||
+ document.querySelector('[data-ng-csp]'));
+
+ if (ngCspElement) {
+ var ngCspAttribute = ngCspElement.getAttribute('ng-csp') ||
+ ngCspElement.getAttribute('data-ng-csp');
+ csp.rules = {
+ noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1),
+ noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1)
+ };
+ } else {
+ csp.rules = {
+ noUnsafeEval: noUnsafeEval(),
+ noInlineStyle: false
+ };
+ }
+ }
+
+ return csp.rules;
+
+ function noUnsafeEval() {
+ try {
+ /* jshint -W031, -W054 */
+ new Function('');
+ /* jshint +W031, +W054 */
+ return false;
+ } catch (e) {
+ return true;
+ }
+ }
+};
+
+/**
+ * @ngdoc directive
+ * @module ng
+ * @name ngJq
+ *
+ * @element ANY
+ * @param {string=} ngJq the name of the library available under `window`
+ * to be used for angular.element
+ * @description
+ * Use this directive to force the angular.element library. This should be
+ * used to force either jqLite by leaving ng-jq blank or setting the name of
+ * the jquery variable under window (eg. jQuery).
+ *
+ * Since angular looks for this directive when it is loaded (doesn't wait for the
+ * DOMContentLoaded event), it must be placed on an element that comes before the script
+ * which loads angular. Also, only the first instance of `ng-jq` will be used and all
+ * others ignored.
+ *
+ * @example
+ * This example shows how to force jqLite using the `ngJq` directive to the `html` tag.
+ ```html
+ <!doctype html>
+ <html ng-app ng-jq>
+ ...
+ ...
+ </html>
+ ```
+ * @example
+ * This example shows how to use a jQuery based library of a different name.
+ * The library name must be available at the top most 'window'.
+ ```html
+ <!doctype html>
+ <html ng-app ng-jq="jQueryLib">
+ ...
+ ...
+ </html>
+ ```
+ */
+var jq = function() {
+ if (isDefined(jq.name_)) return jq.name_;
+ var el;
+ var i, ii = ngAttrPrefixes.length, prefix, name;
+ for (i = 0; i < ii; ++i) {
+ prefix = ngAttrPrefixes[i];
+ if (el = document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]')) {
+ name = el.getAttribute(prefix + 'jq');
+ break;
+ }
+ }
+
+ return (jq.name_ = name);
+};
+
+function concat(array1, array2, index) {
+ return array1.concat(slice.call(array2, index));
+}
+
+function sliceArgs(args, startIndex) {
+ return slice.call(args, startIndex || 0);
+}
+
+
+/* jshint -W101 */
+/**
+ * @ngdoc function
+ * @name angular.bind
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for
+ * `fn`). You can supply optional `args` that are prebound to the function. This feature is also
+ * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as
+ * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application).
+ *
+ * @param {Object} self Context which `fn` should be evaluated in.
+ * @param {function()} fn Function to be bound.
+ * @param {...*} args Optional arguments to be prebound to the `fn` function call.
+ * @returns {function()} Function that wraps the `fn` with all the specified bindings.
+ */
+/* jshint +W101 */
+function bind(self, fn) {
+ var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
+ if (isFunction(fn) && !(fn instanceof RegExp)) {
+ return curryArgs.length
+ ? function() {
+ return arguments.length
+ ? fn.apply(self, concat(curryArgs, arguments, 0))
+ : fn.apply(self, curryArgs);
+ }
+ : function() {
+ return arguments.length
+ ? fn.apply(self, arguments)
+ : fn.call(self);
+ };
+ } else {
+ // in IE, native methods are not functions so they cannot be bound (note: they don't need to be)
+ return fn;
+ }
+}
+
+
+function toJsonReplacer(key, value) {
+ var val = value;
+
+ if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {
+ val = undefined;
+ } else if (isWindow(value)) {
+ val = '$WINDOW';
+ } else if (value && document === value) {
+ val = '$DOCUMENT';
+ } else if (isScope(value)) {
+ val = '$SCOPE';
+ }
+
+ return val;
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.toJson
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be
+ * stripped since angular uses this notation internally.
+ *
+ * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.
+ * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace.
+ * If set to an integer, the JSON output will contain that many spaces per indentation.
+ * @returns {string|undefined} JSON-ified string representing `obj`.
+ */
+function toJson(obj, pretty) {
+ if (isUndefined(obj)) return undefined;
+ if (!isNumber(pretty)) {
+ pretty = pretty ? 2 : null;
+ }
+ return JSON.stringify(obj, toJsonReplacer, pretty);
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.fromJson
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Deserializes a JSON string.
+ *
+ * @param {string} json JSON string to deserialize.
+ * @returns {Object|Array|string|number} Deserialized JSON string.
+ */
+function fromJson(json) {
+ return isString(json)
+ ? JSON.parse(json)
+ : json;
+}
+
+
+var ALL_COLONS = /:/g;
+function timezoneToOffset(timezone, fallback) {
+ // IE/Edge do not "understand" colon (`:`) in timezone
+ timezone = timezone.replace(ALL_COLONS, '');
+ var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
+ return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
+}
+
+
+function addDateMinutes(date, minutes) {
+ date = new Date(date.getTime());
+ date.setMinutes(date.getMinutes() + minutes);
+ return date;
+}
+
+
+function convertTimezoneToLocal(date, timezone, reverse) {
+ reverse = reverse ? -1 : 1;
+ var dateTimezoneOffset = date.getTimezoneOffset();
+ var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
+ return addDateMinutes(date, reverse * (timezoneOffset - dateTimezoneOffset));
+}
+
+
+/**
+ * @returns {string} Returns the string representation of the element.
+ */
+function startingTag(element) {
+ element = jqLite(element).clone();
+ try {
+ // turns out IE does not let you set .html() on elements which
+ // are not allowed to have children. So we just ignore it.
+ element.empty();
+ } catch (e) {}
+ var elemHtml = jqLite('<div>').append(element).html();
+ try {
+ return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :
+ elemHtml.
+ match(/^(<[^>]+>)/)[1].
+ replace(/^<([\w\-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});
+ } catch (e) {
+ return lowercase(elemHtml);
+ }
+
+}
+
+
+/////////////////////////////////////////////////
+
+/**
+ * Tries to decode the URI component without throwing an exception.
+ *
+ * @private
+ * @param str value potential URI component to check.
+ * @returns {boolean} True if `value` can be decoded
+ * with the decodeURIComponent function.
+ */
+function tryDecodeURIComponent(value) {
+ try {
+ return decodeURIComponent(value);
+ } catch (e) {
+ // Ignore any invalid uri component
+ }
+}
+
+
+/**
+ * Parses an escaped url query string into key-value pairs.
+ * @returns {Object.<string,boolean|Array>}
+ */
+function parseKeyValue(/**string*/keyValue) {
+ var obj = {};
+ forEach((keyValue || "").split('&'), function(keyValue) {
+ var splitPoint, key, val;
+ if (keyValue) {
+ key = keyValue = keyValue.replace(/\+/g,'%20');
+ splitPoint = keyValue.indexOf('=');
+ if (splitPoint !== -1) {
+ key = keyValue.substring(0, splitPoint);
+ val = keyValue.substring(splitPoint + 1);
+ }
+ key = tryDecodeURIComponent(key);
+ if (isDefined(key)) {
+ val = isDefined(val) ? tryDecodeURIComponent(val) : true;
+ if (!hasOwnProperty.call(obj, key)) {
+ obj[key] = val;
+ } else if (isArray(obj[key])) {
+ obj[key].push(val);
+ } else {
+ obj[key] = [obj[key],val];
+ }
+ }
+ }
+ });
+ return obj;
+}
+
+function toKeyValue(obj) {
+ var parts = [];
+ forEach(obj, function(value, key) {
+ if (isArray(value)) {
+ forEach(value, function(arrayValue) {
+ parts.push(encodeUriQuery(key, true) +
+ (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));
+ });
+ } else {
+ parts.push(encodeUriQuery(key, true) +
+ (value === true ? '' : '=' + encodeUriQuery(value, true)));
+ }
+ });
+ return parts.length ? parts.join('&') : '';
+}
+
+
+/**
+ * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
+ * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
+ * segments:
+ * segment = *pchar
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+function encodeUriSegment(val) {
+ return encodeUriQuery(val, true).
+ replace(/%26/gi, '&').
+ replace(/%3D/gi, '=').
+ replace(/%2B/gi, '+');
+}
+
+
+/**
+ * This method is intended for encoding *key* or *value* parts of query component. We need a custom
+ * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be
+ * encoded per http://tools.ietf.org/html/rfc3986:
+ * query = *( pchar / "/" / "?" )
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+function encodeUriQuery(val, pctEncodeSpaces) {
+ return encodeURIComponent(val).
+ replace(/%40/gi, '@').
+ replace(/%3A/gi, ':').
+ replace(/%24/g, '$').
+ replace(/%2C/gi, ',').
+ replace(/%3B/gi, ';').
+ replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
+}
+
+var ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-'];
+
+function getNgAttribute(element, ngAttr) {
+ var attr, i, ii = ngAttrPrefixes.length;
+ for (i = 0; i < ii; ++i) {
+ attr = ngAttrPrefixes[i] + ngAttr;
+ if (isString(attr = element.getAttribute(attr))) {
+ return attr;
+ }
+ }
+ return null;
+}
+
+/**
+ * @ngdoc directive
+ * @name ngApp
+ * @module ng
+ *
+ * @element ANY
+ * @param {angular.Module} ngApp an optional application
+ * {@link angular.module module} name to load.
+ * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be
+ * created in "strict-di" mode. This means that the application will fail to invoke functions which
+ * do not use explicit function annotation (and are thus unsuitable for minification), as described
+ * in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in
+ * tracking down the root of these bugs.
+ *
+ * @description
+ *
+ * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive
+ * designates the **root element** of the application and is typically placed near the root element
+ * of the page - e.g. on the `<body>` or `<html>` tags.
+ *
+ * Only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`
+ * found in the document will be used to define the root element to auto-bootstrap as an
+ * application. To run multiple applications in an HTML document you must manually bootstrap them using
+ * {@link angular.bootstrap} instead. AngularJS applications cannot be nested within each other.
+ *
+ * You can specify an **AngularJS module** to be used as the root module for the application. This
+ * module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It
+ * should contain the application code needed or have dependencies on other modules that will
+ * contain the code. See {@link angular.module} for more information.
+ *
+ * In the example below if the `ngApp` directive were not placed on the `html` element then the
+ * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`
+ * would not be resolved to `3`.
+ *
+ * `ngApp` is the easiest, and most common way to bootstrap an application.
+ *
+ <example module="ngAppDemo">
+ <file name="index.html">
+ <div ng-controller="ngAppDemoController">
+ I can add: {{a}} + {{b}} = {{ a+b }}
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {
+ $scope.a = 1;
+ $scope.b = 2;
+ });
+ </file>
+ </example>
+ *
+ * Using `ngStrictDi`, you would see something like this:
+ *
+ <example ng-app-included="true">
+ <file name="index.html">
+ <div ng-app="ngAppStrictDemo" ng-strict-di>
+ <div ng-controller="GoodController1">
+ I can add: {{a}} + {{b}} = {{ a+b }}
+
+ <p>This renders because the controller does not fail to
+ instantiate, by using explicit annotation style (see
+ script.js for details)
+ </p>
+ </div>
+
+ <div ng-controller="GoodController2">
+ Name: <input ng-model="name"><br />
+ Hello, {{name}}!
+
+ <p>This renders because the controller does not fail to
+ instantiate, by using explicit annotation style
+ (see script.js for details)
+ </p>
+ </div>
+
+ <div ng-controller="BadController">
+ I can add: {{a}} + {{b}} = {{ a+b }}
+
+ <p>The controller could not be instantiated, due to relying
+ on automatic function annotations (which are disabled in
+ strict mode). As such, the content of this section is not
+ interpolated, and there should be an error in your web console.
+ </p>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('ngAppStrictDemo', [])
+ // BadController will fail to instantiate, due to relying on automatic function annotation,
+ // rather than an explicit annotation
+ .controller('BadController', function($scope) {
+ $scope.a = 1;
+ $scope.b = 2;
+ })
+ // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated,
+ // due to using explicit annotations using the array style and $inject property, respectively.
+ .controller('GoodController1', ['$scope', function($scope) {
+ $scope.a = 1;
+ $scope.b = 2;
+ }])
+ .controller('GoodController2', GoodController2);
+ function GoodController2($scope) {
+ $scope.name = "World";
+ }
+ GoodController2.$inject = ['$scope'];
+ </file>
+ <file name="style.css">
+ div[ng-controller] {
+ margin-bottom: 1em;
+ -webkit-border-radius: 4px;
+ border-radius: 4px;
+ border: 1px solid;
+ padding: .5em;
+ }
+ div[ng-controller^=Good] {
+ border-color: #d6e9c6;
+ background-color: #dff0d8;
+ color: #3c763d;
+ }
+ div[ng-controller^=Bad] {
+ border-color: #ebccd1;
+ background-color: #f2dede;
+ color: #a94442;
+ margin-bottom: 0;
+ }
+ </file>
+ </example>
+ */
+function angularInit(element, bootstrap) {
+ var appElement,
+ module,
+ config = {};
+
+ // The element `element` has priority over any other element
+ forEach(ngAttrPrefixes, function(prefix) {
+ var name = prefix + 'app';
+
+ if (!appElement && element.hasAttribute && element.hasAttribute(name)) {
+ appElement = element;
+ module = element.getAttribute(name);
+ }
+ });
+ forEach(ngAttrPrefixes, function(prefix) {
+ var name = prefix + 'app';
+ var candidate;
+
+ if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) {
+ appElement = candidate;
+ module = candidate.getAttribute(name);
+ }
+ });
+ if (appElement) {
+ config.strictDi = getNgAttribute(appElement, "strict-di") !== null;
+ bootstrap(appElement, module ? [module] : [], config);
+ }
+}
+
+/**
+ * @ngdoc function
+ * @name angular.bootstrap
+ * @module ng
+ * @description
+ * Use this function to manually start up angular application.
+ *
+ * See: {@link guide/bootstrap Bootstrap}
+ *
+ * Note that Protractor based end-to-end tests cannot use this function to bootstrap manually.
+ * They must use {@link ng.directive:ngApp ngApp}.
+ *
+ * Angular will detect if it has been loaded into the browser more than once and only allow the
+ * first loaded script to be bootstrapped and will report a warning to the browser console for
+ * each of the subsequent scripts. This prevents strange results in applications, where otherwise
+ * multiple instances of Angular try to work on the DOM.
+ *
+ * ```html
+ * <!doctype html>
+ * <html>
+ * <body>
+ * <div ng-controller="WelcomeController">
+ * {{greeting}}
+ * </div>
+ *
+ * <script src="angular.js"></script>
+ * <script>
+ * var app = angular.module('demo', [])
+ * .controller('WelcomeController', function($scope) {
+ * $scope.greeting = 'Welcome!';
+ * });
+ * angular.bootstrap(document, ['demo']);
+ * </script>
+ * </body>
+ * </html>
+ * ```
+ *
+ * @param {DOMElement} element DOM element which is the root of angular application.
+ * @param {Array<String|Function|Array>=} modules an array of modules to load into the application.
+ * Each item in the array should be the name of a predefined module or a (DI annotated)
+ * function that will be invoked by the injector as a `config` block.
+ * See: {@link angular.module modules}
+ * @param {Object=} config an object for defining configuration options for the application. The
+ * following keys are supported:
+ *
+ * * `strictDi` - disable automatic function annotation for the application. This is meant to
+ * assist in finding bugs which break minified code. Defaults to `false`.
+ *
+ * @returns {auto.$injector} Returns the newly created injector for this app.
+ */
+function bootstrap(element, modules, config) {
+ if (!isObject(config)) config = {};
+ var defaultConfig = {
+ strictDi: false
+ };
+ config = extend(defaultConfig, config);
+ var doBootstrap = function() {
+ element = jqLite(element);
+
+ if (element.injector()) {
+ var tag = (element[0] === document) ? 'document' : startingTag(element);
+ //Encode angle brackets to prevent input from being sanitized to empty string #8683
+ throw ngMinErr(
+ 'btstrpd',
+ "App Already Bootstrapped with this Element '{0}'",
+ tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
+ }
+
+ modules = modules || [];
+ modules.unshift(['$provide', function($provide) {
+ $provide.value('$rootElement', element);
+ }]);
+
+ if (config.debugInfoEnabled) {
+ // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`.
+ modules.push(['$compileProvider', function($compileProvider) {
+ $compileProvider.debugInfoEnabled(true);
+ }]);
+ }
+
+ modules.unshift('ng');
+ var injector = createInjector(modules, config.strictDi);
+ injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
+ function bootstrapApply(scope, element, compile, injector) {
+ scope.$apply(function() {
+ element.data('$injector', injector);
+ compile(element)(scope);
+ });
+ }]
+ );
+ return injector;
+ };
+
+ var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;
+ var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
+
+ if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {
+ config.debugInfoEnabled = true;
+ window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, '');
+ }
+
+ if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
+ return doBootstrap();
+ }
+
+ window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
+ angular.resumeBootstrap = function(extraModules) {
+ forEach(extraModules, function(module) {
+ modules.push(module);
+ });
+ return doBootstrap();
+ };
+
+ if (isFunction(angular.resumeDeferredBootstrap)) {
+ angular.resumeDeferredBootstrap();
+ }
+}
+
+/**
+ * @ngdoc function
+ * @name angular.reloadWithDebugInfo
+ * @module ng
+ * @description
+ * Use this function to reload the current application with debug information turned on.
+ * This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`.
+ *
+ * See {@link ng.$compileProvider#debugInfoEnabled} for more.
+ */
+function reloadWithDebugInfo() {
+ window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name;
+ window.location.reload();
+}
+
+/**
+ * @name angular.getTestability
+ * @module ng
+ * @description
+ * Get the testability service for the instance of Angular on the given
+ * element.
+ * @param {DOMElement} element DOM element which is the root of angular application.
+ */
+function getTestability(rootElement) {
+ var injector = angular.element(rootElement).injector();
+ if (!injector) {
+ throw ngMinErr('test',
+ 'no injector found for element argument to getTestability');
+ }
+ return injector.get('$$testability');
+}
+
+var SNAKE_CASE_REGEXP = /[A-Z]/g;
+function snake_case(name, separator) {
+ separator = separator || '_';
+ return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
+ return (pos ? separator : '') + letter.toLowerCase();
+ });
+}
+
+var bindJQueryFired = false;
+function bindJQuery() {
+ var originalCleanData;
+
+ if (bindJQueryFired) {
+ return;
+ }
+
+ // bind to jQuery if present;
+ var jqName = jq();
+ jQuery = isUndefined(jqName) ? window.jQuery : // use jQuery (if present)
+ !jqName ? undefined : // use jqLite
+ window[jqName]; // use jQuery specified by `ngJq`
+
+ // Use jQuery if it exists with proper functionality, otherwise default to us.
+ // Angular 1.2+ requires jQuery 1.7+ for on()/off() support.
+ // Angular 1.3+ technically requires at least jQuery 2.1+ but it may work with older
+ // versions. It will not work for sure with jQuery <1.7, though.
+ if (jQuery && jQuery.fn.on) {
+ jqLite = jQuery;
+ extend(jQuery.fn, {
+ scope: JQLitePrototype.scope,
+ isolateScope: JQLitePrototype.isolateScope,
+ controller: JQLitePrototype.controller,
+ injector: JQLitePrototype.injector,
+ inheritedData: JQLitePrototype.inheritedData
+ });
+
+ // All nodes removed from the DOM via various jQuery APIs like .remove()
+ // are passed through jQuery.cleanData. Monkey-patch this method to fire
+ // the $destroy event on all removed nodes.
+ originalCleanData = jQuery.cleanData;
+ jQuery.cleanData = function(elems) {
+ var events;
+ for (var i = 0, elem; (elem = elems[i]) != null; i++) {
+ events = jQuery._data(elem, "events");
+ if (events && events.$destroy) {
+ jQuery(elem).triggerHandler('$destroy');
+ }
+ }
+ originalCleanData(elems);
+ };
+ } else {
+ jqLite = JQLite;
+ }
+
+ angular.element = jqLite;
+
+ // Prevent double-proxying.
+ bindJQueryFired = true;
+}
+
+/**
+ * throw error if the argument is falsy.
+ */
+function assertArg(arg, name, reason) {
+ if (!arg) {
+ throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
+ }
+ return arg;
+}
+
+function assertArgFn(arg, name, acceptArrayAnnotation) {
+ if (acceptArrayAnnotation && isArray(arg)) {
+ arg = arg[arg.length - 1];
+ }
+
+ assertArg(isFunction(arg), name, 'not a function, got ' +
+ (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg));
+ return arg;
+}
+
+/**
+ * throw error if the name given is hasOwnProperty
+ * @param {String} name the name to test
+ * @param {String} context the context in which the name is used, such as module or directive
+ */
+function assertNotHasOwnProperty(name, context) {
+ if (name === 'hasOwnProperty') {
+ throw ngMinErr('badname', "hasOwnProperty is not a valid {0} name", context);
+ }
+}
+
+/**
+ * Return the value accessible from the object by path. Any undefined traversals are ignored
+ * @param {Object} obj starting object
+ * @param {String} path path to traverse
+ * @param {boolean} [bindFnToScope=true]
+ * @returns {Object} value as accessible by path
+ */
+//TODO(misko): this function needs to be removed
+function getter(obj, path, bindFnToScope) {
+ if (!path) return obj;
+ var keys = path.split('.');
+ var key;
+ var lastInstance = obj;
+ var len = keys.length;
+
+ for (var i = 0; i < len; i++) {
+ key = keys[i];
+ if (obj) {
+ obj = (lastInstance = obj)[key];
+ }
+ }
+ if (!bindFnToScope && isFunction(obj)) {
+ return bind(lastInstance, obj);
+ }
+ return obj;
+}
+
+/**
+ * Return the DOM siblings between the first and last node in the given array.
+ * @param {Array} array like object
+ * @returns {Array} the inputted object or a jqLite collection containing the nodes
+ */
+function getBlockNodes(nodes) {
+ // TODO(perf): update `nodes` instead of creating a new object?
+ var node = nodes[0];
+ var endNode = nodes[nodes.length - 1];
+ var blockNodes;
+
+ for (var i = 1; node !== endNode && (node = node.nextSibling); i++) {
+ if (blockNodes || nodes[i] !== node) {
+ if (!blockNodes) {
+ blockNodes = jqLite(slice.call(nodes, 0, i));
+ }
+ blockNodes.push(node);
+ }
+ }
+
+ return blockNodes || nodes;
+}
+
+
+/**
+ * Creates a new object without a prototype. This object is useful for lookup without having to
+ * guard against prototypically inherited properties via hasOwnProperty.
+ *
+ * Related micro-benchmarks:
+ * - http://jsperf.com/object-create2
+ * - http://jsperf.com/proto-map-lookup/2
+ * - http://jsperf.com/for-in-vs-object-keys2
+ *
+ * @returns {Object}
+ */
+function createMap() {
+ return Object.create(null);
+}
+
+var NODE_TYPE_ELEMENT = 1;
+var NODE_TYPE_ATTRIBUTE = 2;
+var NODE_TYPE_TEXT = 3;
+var NODE_TYPE_COMMENT = 8;
+var NODE_TYPE_DOCUMENT = 9;
+var NODE_TYPE_DOCUMENT_FRAGMENT = 11;
+
+/**
+ * @ngdoc type
+ * @name angular.Module
+ * @module ng
+ * @description
+ *
+ * Interface for configuring angular {@link angular.module modules}.
+ */
+
+function setupModuleLoader(window) {
+
+ var $injectorMinErr = minErr('$injector');
+ var ngMinErr = minErr('ng');
+
+ function ensure(obj, name, factory) {
+ return obj[name] || (obj[name] = factory());
+ }
+
+ var angular = ensure(window, 'angular', Object);
+
+ // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
+ angular.$$minErr = angular.$$minErr || minErr;
+
+ return ensure(angular, 'module', function() {
+ /** @type {Object.<string, angular.Module>} */
+ var modules = {};
+
+ /**
+ * @ngdoc function
+ * @name angular.module
+ * @module ng
+ * @description
+ *
+ * The `angular.module` is a global place for creating, registering and retrieving Angular
+ * modules.
+ * All modules (angular core or 3rd party) that should be available to an application must be
+ * registered using this mechanism.
+ *
+ * Passing one argument retrieves an existing {@link angular.Module},
+ * whereas passing more than one argument creates a new {@link angular.Module}
+ *
+ *
+ * # Module
+ *
+ * A module is a collection of services, directives, controllers, filters, and configuration information.
+ * `angular.module` is used to configure the {@link auto.$injector $injector}.
+ *
+ * ```js
+ * // Create a new module
+ * var myModule = angular.module('myModule', []);
+ *
+ * // register a new service
+ * myModule.value('appName', 'MyCoolApp');
+ *
+ * // configure existing services inside initialization blocks.
+ * myModule.config(['$locationProvider', function($locationProvider) {
+ * // Configure existing providers
+ * $locationProvider.hashPrefix('!');
+ * }]);
+ * ```
+ *
+ * Then you can create an injector and load your modules like this:
+ *
+ * ```js
+ * var injector = angular.injector(['ng', 'myModule'])
+ * ```
+ *
+ * However it's more likely that you'll just use
+ * {@link ng.directive:ngApp ngApp} or
+ * {@link angular.bootstrap} to simplify this process for you.
+ *
+ * @param {!string} name The name of the module to create or retrieve.
+ * @param {!Array.<string>=} requires If specified then new module is being created. If
+ * unspecified then the module is being retrieved for further configuration.
+ * @param {Function=} configFn Optional configuration function for the module. Same as
+ * {@link angular.Module#config Module#config()}.
+ * @returns {angular.Module} new module with the {@link angular.Module} api.
+ */
+ return function module(name, requires, configFn) {
+ var assertNotHasOwnProperty = function(name, context) {
+ if (name === 'hasOwnProperty') {
+ throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
+ }
+ };
+
+ assertNotHasOwnProperty(name, 'module');
+ if (requires && modules.hasOwnProperty(name)) {
+ modules[name] = null;
+ }
+ return ensure(modules, name, function() {
+ if (!requires) {
+ throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " +
+ "the module name or forgot to load it. If registering a module ensure that you " +
+ "specify the dependencies as the second argument.", name);
+ }
+
+ /** @type {!Array.<Array.<*>>} */
+ var invokeQueue = [];
+
+ /** @type {!Array.<Function>} */
+ var configBlocks = [];
+
+ /** @type {!Array.<Function>} */
+ var runBlocks = [];
+
+ var config = invokeLater('$injector', 'invoke', 'push', configBlocks);
+
+ /** @type {angular.Module} */
+ var moduleInstance = {
+ // Private state
+ _invokeQueue: invokeQueue,
+ _configBlocks: configBlocks,
+ _runBlocks: runBlocks,
+
+ /**
+ * @ngdoc property
+ * @name angular.Module#requires
+ * @module ng
+ *
+ * @description
+ * Holds the list of modules which the injector will load before the current module is
+ * loaded.
+ */
+ requires: requires,
+
+ /**
+ * @ngdoc property
+ * @name angular.Module#name
+ * @module ng
+ *
+ * @description
+ * Name of the module.
+ */
+ name: name,
+
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#provider
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} providerType Construction function for creating new instance of the
+ * service.
+ * @description
+ * See {@link auto.$provide#provider $provide.provider()}.
+ */
+ provider: invokeLaterAndSetModuleName('$provide', 'provider'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#factory
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} providerFunction Function for creating new instance of the service.
+ * @description
+ * See {@link auto.$provide#factory $provide.factory()}.
+ */
+ factory: invokeLaterAndSetModuleName('$provide', 'factory'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#service
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} constructor A constructor function that will be instantiated.
+ * @description
+ * See {@link auto.$provide#service $provide.service()}.
+ */
+ service: invokeLaterAndSetModuleName('$provide', 'service'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#value
+ * @module ng
+ * @param {string} name service name
+ * @param {*} object Service instance object.
+ * @description
+ * See {@link auto.$provide#value $provide.value()}.
+ */
+ value: invokeLater('$provide', 'value'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#constant
+ * @module ng
+ * @param {string} name constant name
+ * @param {*} object Constant value.
+ * @description
+ * Because the constants are fixed, they get applied before other provide methods.
+ * See {@link auto.$provide#constant $provide.constant()}.
+ */
+ constant: invokeLater('$provide', 'constant', 'unshift'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#decorator
+ * @module ng
+ * @param {string} The name of the service to decorate.
+ * @param {Function} This function will be invoked when the service needs to be
+ * instantiated and should return the decorated service instance.
+ * @description
+ * See {@link auto.$provide#decorator $provide.decorator()}.
+ */
+ decorator: invokeLaterAndSetModuleName('$provide', 'decorator'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#animation
+ * @module ng
+ * @param {string} name animation name
+ * @param {Function} animationFactory Factory function for creating new instance of an
+ * animation.
+ * @description
+ *
+ * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
+ *
+ *
+ * Defines an animation hook that can be later used with
+ * {@link $animate $animate} service and directives that use this service.
+ *
+ * ```js
+ * module.animation('.animation-name', function($inject1, $inject2) {
+ * return {
+ * eventName : function(element, done) {
+ * //code to run the animation
+ * //once complete, then run done()
+ * return function cancellationFunction(element) {
+ * //code to cancel the animation
+ * }
+ * }
+ * }
+ * })
+ * ```
+ *
+ * See {@link ng.$animateProvider#register $animateProvider.register()} and
+ * {@link ngAnimate ngAnimate module} for more information.
+ */
+ animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#filter
+ * @module ng
+ * @param {string} name Filter name - this must be a valid angular expression identifier
+ * @param {Function} filterFactory Factory function for creating new instance of filter.
+ * @description
+ * See {@link ng.$filterProvider#register $filterProvider.register()}.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
+ * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
+ * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
+ * (`myapp_subsection_filterx`).
+ * </div>
+ */
+ filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#controller
+ * @module ng
+ * @param {string|Object} name Controller name, or an object map of controllers where the
+ * keys are the names and the values are the constructors.
+ * @param {Function} constructor Controller constructor function.
+ * @description
+ * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
+ */
+ controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#directive
+ * @module ng
+ * @param {string|Object} name Directive name, or an object map of directives where the
+ * keys are the names and the values are the factories.
+ * @param {Function} directiveFactory Factory function for creating new instance of
+ * directives.
+ * @description
+ * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
+ */
+ directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#component
+ * @module ng
+ * @param {string} name Name of the component in camel-case (i.e. myComp which will match as my-comp)
+ * @param {Object} options Component definition object (a simplified
+ * {@link ng.$compile#directive-definition-object directive definition object})
+ *
+ * @description
+ * See {@link ng.$compileProvider#component $compileProvider.component()}.
+ */
+ component: invokeLaterAndSetModuleName('$compileProvider', 'component'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#config
+ * @module ng
+ * @param {Function} configFn Execute this function on module load. Useful for service
+ * configuration.
+ * @description
+ * Use this method to register work which needs to be performed on module loading.
+ * For more about how to configure services, see
+ * {@link providers#provider-recipe Provider Recipe}.
+ */
+ config: config,
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#run
+ * @module ng
+ * @param {Function} initializationFn Execute this function after injector creation.
+ * Useful for application initialization.
+ * @description
+ * Use this method to register work which should be performed when the injector is done
+ * loading all modules.
+ */
+ run: function(block) {
+ runBlocks.push(block);
+ return this;
+ }
+ };
+
+ if (configFn) {
+ config(configFn);
+ }
+
+ return moduleInstance;
+
+ /**
+ * @param {string} provider
+ * @param {string} method
+ * @param {String=} insertMethod
+ * @returns {angular.Module}
+ */
+ function invokeLater(provider, method, insertMethod, queue) {
+ if (!queue) queue = invokeQueue;
+ return function() {
+ queue[insertMethod || 'push']([provider, method, arguments]);
+ return moduleInstance;
+ };
+ }
+
+ /**
+ * @param {string} provider
+ * @param {string} method
+ * @returns {angular.Module}
+ */
+ function invokeLaterAndSetModuleName(provider, method) {
+ return function(recipeName, factoryFunction) {
+ if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
+ invokeQueue.push([provider, method, arguments]);
+ return moduleInstance;
+ };
+ }
+ });
+ };
+ });
+
+}
+
+/* global: toDebugString: true */
+
+function serializeObject(obj) {
+ var seen = [];
+
+ return JSON.stringify(obj, function(key, val) {
+ val = toJsonReplacer(key, val);
+ if (isObject(val)) {
+
+ if (seen.indexOf(val) >= 0) return '...';
+
+ seen.push(val);
+ }
+ return val;
+ });
+}
+
+function toDebugString(obj) {
+ if (typeof obj === 'function') {
+ return obj.toString().replace(/ \{[\s\S]*$/, '');
+ } else if (isUndefined(obj)) {
+ return 'undefined';
+ } else if (typeof obj !== 'string') {
+ return serializeObject(obj);
+ }
+ return obj;
+}
+
+/* global angularModule: true,
+ version: true,
+
+ $CompileProvider,
+
+ htmlAnchorDirective,
+ inputDirective,
+ inputDirective,
+ formDirective,
+ scriptDirective,
+ selectDirective,
+ styleDirective,
+ optionDirective,
+ ngBindDirective,
+ ngBindHtmlDirective,
+ ngBindTemplateDirective,
+ ngClassDirective,
+ ngClassEvenDirective,
+ ngClassOddDirective,
+ ngCloakDirective,
+ ngControllerDirective,
+ ngFormDirective,
+ ngHideDirective,
+ ngIfDirective,
+ ngIncludeDirective,
+ ngIncludeFillContentDirective,
+ ngInitDirective,
+ ngNonBindableDirective,
+ ngPluralizeDirective,
+ ngRepeatDirective,
+ ngShowDirective,
+ ngStyleDirective,
+ ngSwitchDirective,
+ ngSwitchWhenDirective,
+ ngSwitchDefaultDirective,
+ ngOptionsDirective,
+ ngTranscludeDirective,
+ ngModelDirective,
+ ngListDirective,
+ ngChangeDirective,
+ patternDirective,
+ patternDirective,
+ requiredDirective,
+ requiredDirective,
+ minlengthDirective,
+ minlengthDirective,
+ maxlengthDirective,
+ maxlengthDirective,
+ ngValueDirective,
+ ngModelOptionsDirective,
+ ngAttributeAliasDirectives,
+ ngEventDirectives,
+
+ $AnchorScrollProvider,
+ $AnimateProvider,
+ $CoreAnimateCssProvider,
+ $$CoreAnimateJsProvider,
+ $$CoreAnimateQueueProvider,
+ $$AnimateRunnerFactoryProvider,
+ $$AnimateAsyncRunFactoryProvider,
+ $BrowserProvider,
+ $CacheFactoryProvider,
+ $ControllerProvider,
+ $DateProvider,
+ $DocumentProvider,
+ $ExceptionHandlerProvider,
+ $FilterProvider,
+ $$ForceReflowProvider,
+ $InterpolateProvider,
+ $IntervalProvider,
+ $$HashMapProvider,
+ $HttpProvider,
+ $HttpParamSerializerProvider,
+ $HttpParamSerializerJQLikeProvider,
+ $HttpBackendProvider,
+ $xhrFactoryProvider,
+ $LocationProvider,
+ $LogProvider,
+ $ParseProvider,
+ $RootScopeProvider,
+ $QProvider,
+ $$QProvider,
+ $$SanitizeUriProvider,
+ $SceProvider,
+ $SceDelegateProvider,
+ $SnifferProvider,
+ $TemplateCacheProvider,
+ $TemplateRequestProvider,
+ $$TestabilityProvider,
+ $TimeoutProvider,
+ $$RAFProvider,
+ $WindowProvider,
+ $$jqLiteProvider,
+ $$CookieReaderProvider
+*/
+
+
+/**
+ * @ngdoc object
+ * @name angular.version
+ * @module ng
+ * @description
+ * An object that contains information about the current AngularJS version.
+ *
+ * This object has the following properties:
+ *
+ * - `full` – `{string}` – Full version string, such as "0.9.18".
+ * - `major` – `{number}` – Major version number, such as "0".
+ * - `minor` – `{number}` – Minor version number, such as "9".
+ * - `dot` – `{number}` – Dot version number, such as "18".
+ * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
+ */
+var version = {
+ full: '1.5.0', // all of these placeholder strings will be replaced by grunt's
+ major: 1, // package task
+ minor: 5,
+ dot: 0,
+ codeName: 'ennoblement-facilitation'
+};
+
+
+function publishExternalAPI(angular) {
+ extend(angular, {
+ 'bootstrap': bootstrap,
+ 'copy': copy,
+ 'extend': extend,
+ 'merge': merge,
+ 'equals': equals,
+ 'element': jqLite,
+ 'forEach': forEach,
+ 'injector': createInjector,
+ 'noop': noop,
+ 'bind': bind,
+ 'toJson': toJson,
+ 'fromJson': fromJson,
+ 'identity': identity,
+ 'isUndefined': isUndefined,
+ 'isDefined': isDefined,
+ 'isString': isString,
+ 'isFunction': isFunction,
+ 'isObject': isObject,
+ 'isNumber': isNumber,
+ 'isElement': isElement,
+ 'isArray': isArray,
+ 'version': version,
+ 'isDate': isDate,
+ 'lowercase': lowercase,
+ 'uppercase': uppercase,
+ 'callbacks': {counter: 0},
+ 'getTestability': getTestability,
+ '$$minErr': minErr,
+ '$$csp': csp,
+ 'reloadWithDebugInfo': reloadWithDebugInfo
+ });
+
+ angularModule = setupModuleLoader(window);
+
+ angularModule('ng', ['ngLocale'], ['$provide',
+ function ngModule($provide) {
+ // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
+ $provide.provider({
+ $$sanitizeUri: $$SanitizeUriProvider
+ });
+ $provide.provider('$compile', $CompileProvider).
+ directive({
+ a: htmlAnchorDirective,
+ input: inputDirective,
+ textarea: inputDirective,
+ form: formDirective,
+ script: scriptDirective,
+ select: selectDirective,
+ style: styleDirective,
+ option: optionDirective,
+ ngBind: ngBindDirective,
+ ngBindHtml: ngBindHtmlDirective,
+ ngBindTemplate: ngBindTemplateDirective,
+ ngClass: ngClassDirective,
+ ngClassEven: ngClassEvenDirective,
+ ngClassOdd: ngClassOddDirective,
+ ngCloak: ngCloakDirective,
+ ngController: ngControllerDirective,
+ ngForm: ngFormDirective,
+ ngHide: ngHideDirective,
+ ngIf: ngIfDirective,
+ ngInclude: ngIncludeDirective,
+ ngInit: ngInitDirective,
+ ngNonBindable: ngNonBindableDirective,
+ ngPluralize: ngPluralizeDirective,
+ ngRepeat: ngRepeatDirective,
+ ngShow: ngShowDirective,
+ ngStyle: ngStyleDirective,
+ ngSwitch: ngSwitchDirective,
+ ngSwitchWhen: ngSwitchWhenDirective,
+ ngSwitchDefault: ngSwitchDefaultDirective,
+ ngOptions: ngOptionsDirective,
+ ngTransclude: ngTranscludeDirective,
+ ngModel: ngModelDirective,
+ ngList: ngListDirective,
+ ngChange: ngChangeDirective,
+ pattern: patternDirective,
+ ngPattern: patternDirective,
+ required: requiredDirective,
+ ngRequired: requiredDirective,
+ minlength: minlengthDirective,
+ ngMinlength: minlengthDirective,
+ maxlength: maxlengthDirective,
+ ngMaxlength: maxlengthDirective,
+ ngValue: ngValueDirective,
+ ngModelOptions: ngModelOptionsDirective
+ }).
+ directive({
+ ngInclude: ngIncludeFillContentDirective
+ }).
+ directive(ngAttributeAliasDirectives).
+ directive(ngEventDirectives);
+ $provide.provider({
+ $anchorScroll: $AnchorScrollProvider,
+ $animate: $AnimateProvider,
+ $animateCss: $CoreAnimateCssProvider,
+ $$animateJs: $$CoreAnimateJsProvider,
+ $$animateQueue: $$CoreAnimateQueueProvider,
+ $$AnimateRunner: $$AnimateRunnerFactoryProvider,
+ $$animateAsyncRun: $$AnimateAsyncRunFactoryProvider,
+ $browser: $BrowserProvider,
+ $cacheFactory: $CacheFactoryProvider,
+ $controller: $ControllerProvider,
+ $document: $DocumentProvider,
+ $exceptionHandler: $ExceptionHandlerProvider,
+ $filter: $FilterProvider,
+ $$forceReflow: $$ForceReflowProvider,
+ $interpolate: $InterpolateProvider,
+ $interval: $IntervalProvider,
+ $http: $HttpProvider,
+ $httpParamSerializer: $HttpParamSerializerProvider,
+ $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider,
+ $httpBackend: $HttpBackendProvider,
+ $xhrFactory: $xhrFactoryProvider,
+ $location: $LocationProvider,
+ $log: $LogProvider,
+ $parse: $ParseProvider,
+ $rootScope: $RootScopeProvider,
+ $q: $QProvider,
+ $$q: $$QProvider,
+ $sce: $SceProvider,
+ $sceDelegate: $SceDelegateProvider,
+ $sniffer: $SnifferProvider,
+ $templateCache: $TemplateCacheProvider,
+ $templateRequest: $TemplateRequestProvider,
+ $$testability: $$TestabilityProvider,
+ $timeout: $TimeoutProvider,
+ $window: $WindowProvider,
+ $$rAF: $$RAFProvider,
+ $$jqLite: $$jqLiteProvider,
+ $$HashMap: $$HashMapProvider,
+ $$cookieReader: $$CookieReaderProvider
+ });
+ }
+ ]);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* global JQLitePrototype: true,
+ addEventListenerFn: true,
+ removeEventListenerFn: true,
+ BOOLEAN_ATTR: true,
+ ALIASED_ATTR: true,
+*/
+
+//////////////////////////////////
+//JQLite
+//////////////////////////////////
+
+/**
+ * @ngdoc function
+ * @name angular.element
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.
+ *
+ * If jQuery is available, `angular.element` is an alias for the
+ * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element`
+ * delegates to Angular's built-in subset of jQuery, called "jQuery lite" or **jqLite**.
+ *
+ * jqLite is a tiny, API-compatible subset of jQuery that allows
+ * Angular to manipulate the DOM in a cross-browser compatible way. jqLite implements only the most
+ * commonly needed functionality with the goal of having a very small footprint.
+ *
+ * To use `jQuery`, simply ensure it is loaded before the `angular.js` file. You can also use the
+ * {@link ngJq `ngJq`} directive to specify that jqlite should be used over jQuery, or to use a
+ * specific version of jQuery if multiple versions exist on the page.
+ *
+ * <div class="alert alert-info">**Note:** All element references in Angular are always wrapped with jQuery or
+ * jqLite (such as the element argument in a directive's compile / link function). They are never raw DOM references.</div>
+ *
+ * <div class="alert alert-warning">**Note:** Keep in mind that this function will not find elements
+ * by tag name / CSS selector. For lookups by tag name, try instead `angular.element(document).find(...)`
+ * or `$document.find()`, or use the standard DOM APIs, e.g. `document.querySelectorAll()`.</div>
+ *
+ * ## Angular's jqLite
+ * jqLite provides only the following jQuery methods:
+ *
+ * - [`addClass()`](http://api.jquery.com/addClass/)
+ * - [`after()`](http://api.jquery.com/after/)
+ * - [`append()`](http://api.jquery.com/append/)
+ * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters
+ * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData
+ * - [`children()`](http://api.jquery.com/children/) - Does not support selectors
+ * - [`clone()`](http://api.jquery.com/clone/)
+ * - [`contents()`](http://api.jquery.com/contents/)
+ * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`.
+ * As a setter, does not convert numbers to strings or append 'px', and also does not have automatic property prefixing.
+ * - [`data()`](http://api.jquery.com/data/)
+ * - [`detach()`](http://api.jquery.com/detach/)
+ * - [`empty()`](http://api.jquery.com/empty/)
+ * - [`eq()`](http://api.jquery.com/eq/)
+ * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name
+ * - [`hasClass()`](http://api.jquery.com/hasClass/)
+ * - [`html()`](http://api.jquery.com/html/)
+ * - [`next()`](http://api.jquery.com/next/) - Does not support selectors
+ * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData
+ * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter
+ * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors
+ * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors
+ * - [`prepend()`](http://api.jquery.com/prepend/)
+ * - [`prop()`](http://api.jquery.com/prop/)
+ * - [`ready()`](http://api.jquery.com/ready/)
+ * - [`remove()`](http://api.jquery.com/remove/)
+ * - [`removeAttr()`](http://api.jquery.com/removeAttr/)
+ * - [`removeClass()`](http://api.jquery.com/removeClass/)
+ * - [`removeData()`](http://api.jquery.com/removeData/)
+ * - [`replaceWith()`](http://api.jquery.com/replaceWith/)
+ * - [`text()`](http://api.jquery.com/text/)
+ * - [`toggleClass()`](http://api.jquery.com/toggleClass/)
+ * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers.
+ * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces or event object as parameter
+ * - [`val()`](http://api.jquery.com/val/)
+ * - [`wrap()`](http://api.jquery.com/wrap/)
+ *
+ * ## jQuery/jqLite Extras
+ * Angular also provides the following additional methods and events to both jQuery and jqLite:
+ *
+ * ### Events
+ * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event
+ * on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM
+ * element before it is removed.
+ *
+ * ### Methods
+ * - `controller(name)` - retrieves the controller of the current element or its parent. By default
+ * retrieves controller associated with the `ngController` directive. If `name` is provided as
+ * camelCase directive name, then the controller for this directive will be retrieved (e.g.
+ * `'ngModel'`).
+ * - `injector()` - retrieves the injector of the current element or its parent.
+ * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current
+ * element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to
+ * be enabled.
+ * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the
+ * current element. This getter should be used only on elements that contain a directive which starts a new isolate
+ * scope. Calling `scope()` on this element always returns the original non-isolate scope.
+ * Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled.
+ * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top
+ * parent element is reached.
+ *
+ * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.
+ * @returns {Object} jQuery object.
+ */
+
+JQLite.expando = 'ng339';
+
+var jqCache = JQLite.cache = {},
+ jqId = 1,
+ addEventListenerFn = function(element, type, fn) {
+ element.addEventListener(type, fn, false);
+ },
+ removeEventListenerFn = function(element, type, fn) {
+ element.removeEventListener(type, fn, false);
+ };
+
+/*
+ * !!! This is an undocumented "private" function !!!
+ */
+JQLite._data = function(node) {
+ //jQuery always returns an object on cache miss
+ return this.cache[node[this.expando]] || {};
+};
+
+function jqNextId() { return ++jqId; }
+
+
+var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
+var MOZ_HACK_REGEXP = /^moz([A-Z])/;
+var MOUSE_EVENT_MAP= { mouseleave: "mouseout", mouseenter: "mouseover"};
+var jqLiteMinErr = minErr('jqLite');
+
+/**
+ * Converts snake_case to camelCase.
+ * Also there is special case for Moz prefix starting with upper case letter.
+ * @param name Name to normalize
+ */
+function camelCase(name) {
+ return name.
+ replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
+ return offset ? letter.toUpperCase() : letter;
+ }).
+ replace(MOZ_HACK_REGEXP, 'Moz$1');
+}
+
+var SINGLE_TAG_REGEXP = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/;
+var HTML_REGEXP = /<|&#?\w+;/;
+var TAG_NAME_REGEXP = /<([\w:-]+)/;
+var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi;
+
+var wrapMap = {
+ 'option': [1, '<select multiple="multiple">', '</select>'],
+
+ 'thead': [1, '<table>', '</table>'],
+ 'col': [2, '<table><colgroup>', '</colgroup></table>'],
+ 'tr': [2, '<table><tbody>', '</tbody></table>'],
+ 'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],
+ '_default': [0, "", ""]
+};
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+
+function jqLiteIsTextNode(html) {
+ return !HTML_REGEXP.test(html);
+}
+
+function jqLiteAcceptsData(node) {
+ // The window object can accept data but has no nodeType
+ // Otherwise we are only interested in elements (1) and documents (9)
+ var nodeType = node.nodeType;
+ return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;
+}
+
+function jqLiteHasData(node) {
+ for (var key in jqCache[node.ng339]) {
+ return true;
+ }
+ return false;
+}
+
+function jqLiteCleanData(nodes) {
+ for (var i = 0, ii = nodes.length; i < ii; i++) {
+ jqLiteRemoveData(nodes[i]);
+ }
+}
+
+function jqLiteBuildFragment(html, context) {
+ var tmp, tag, wrap,
+ fragment = context.createDocumentFragment(),
+ nodes = [], i;
+
+ if (jqLiteIsTextNode(html)) {
+ // Convert non-html into a text node
+ nodes.push(context.createTextNode(html));
+ } else {
+ // Convert html into DOM nodes
+ tmp = tmp || fragment.appendChild(context.createElement("div"));
+ tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase();
+ wrap = wrapMap[tag] || wrapMap._default;
+ tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2];
+
+ // Descend through wrappers to the right content
+ i = wrap[0];
+ while (i--) {
+ tmp = tmp.lastChild;
+ }
+
+ nodes = concat(nodes, tmp.childNodes);
+
+ tmp = fragment.firstChild;
+ tmp.textContent = "";
+ }
+
+ // Remove wrapper from fragment
+ fragment.textContent = "";
+ fragment.innerHTML = ""; // Clear inner HTML
+ forEach(nodes, function(node) {
+ fragment.appendChild(node);
+ });
+
+ return fragment;
+}
+
+function jqLiteParseHTML(html, context) {
+ context = context || document;
+ var parsed;
+
+ if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {
+ return [context.createElement(parsed[1])];
+ }
+
+ if ((parsed = jqLiteBuildFragment(html, context))) {
+ return parsed.childNodes;
+ }
+
+ return [];
+}
+
+function jqLiteWrapNode(node, wrapper) {
+ var parent = node.parentNode;
+
+ if (parent) {
+ parent.replaceChild(wrapper, node);
+ }
+
+ wrapper.appendChild(node);
+}
+
+
+// IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.
+var jqLiteContains = Node.prototype.contains || function(arg) {
+ // jshint bitwise: false
+ return !!(this.compareDocumentPosition(arg) & 16);
+ // jshint bitwise: true
+};
+
+/////////////////////////////////////////////
+function JQLite(element) {
+ if (element instanceof JQLite) {
+ return element;
+ }
+
+ var argIsString;
+
+ if (isString(element)) {
+ element = trim(element);
+ argIsString = true;
+ }
+ if (!(this instanceof JQLite)) {
+ if (argIsString && element.charAt(0) != '<') {
+ throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');
+ }
+ return new JQLite(element);
+ }
+
+ if (argIsString) {
+ jqLiteAddNodes(this, jqLiteParseHTML(element));
+ } else {
+ jqLiteAddNodes(this, element);
+ }
+}
+
+function jqLiteClone(element) {
+ return element.cloneNode(true);
+}
+
+function jqLiteDealoc(element, onlyDescendants) {
+ if (!onlyDescendants) jqLiteRemoveData(element);
+
+ if (element.querySelectorAll) {
+ var descendants = element.querySelectorAll('*');
+ for (var i = 0, l = descendants.length; i < l; i++) {
+ jqLiteRemoveData(descendants[i]);
+ }
+ }
+}
+
+function jqLiteOff(element, type, fn, unsupported) {
+ if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');
+
+ var expandoStore = jqLiteExpandoStore(element);
+ var events = expandoStore && expandoStore.events;
+ var handle = expandoStore && expandoStore.handle;
+
+ if (!handle) return; //no listeners registered
+
+ if (!type) {
+ for (type in events) {
+ if (type !== '$destroy') {
+ removeEventListenerFn(element, type, handle);
+ }
+ delete events[type];
+ }
+ } else {
+
+ var removeHandler = function(type) {
+ var listenerFns = events[type];
+ if (isDefined(fn)) {
+ arrayRemove(listenerFns || [], fn);
+ }
+ if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {
+ removeEventListenerFn(element, type, handle);
+ delete events[type];
+ }
+ };
+
+ forEach(type.split(' '), function(type) {
+ removeHandler(type);
+ if (MOUSE_EVENT_MAP[type]) {
+ removeHandler(MOUSE_EVENT_MAP[type]);
+ }
+ });
+ }
+}
+
+function jqLiteRemoveData(element, name) {
+ var expandoId = element.ng339;
+ var expandoStore = expandoId && jqCache[expandoId];
+
+ if (expandoStore) {
+ if (name) {
+ delete expandoStore.data[name];
+ return;
+ }
+
+ if (expandoStore.handle) {
+ if (expandoStore.events.$destroy) {
+ expandoStore.handle({}, '$destroy');
+ }
+ jqLiteOff(element);
+ }
+ delete jqCache[expandoId];
+ element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it
+ }
+}
+
+
+function jqLiteExpandoStore(element, createIfNecessary) {
+ var expandoId = element.ng339,
+ expandoStore = expandoId && jqCache[expandoId];
+
+ if (createIfNecessary && !expandoStore) {
+ element.ng339 = expandoId = jqNextId();
+ expandoStore = jqCache[expandoId] = {events: {}, data: {}, handle: undefined};
+ }
+
+ return expandoStore;
+}
+
+
+function jqLiteData(element, key, value) {
+ if (jqLiteAcceptsData(element)) {
+
+ var isSimpleSetter = isDefined(value);
+ var isSimpleGetter = !isSimpleSetter && key && !isObject(key);
+ var massGetter = !key;
+ var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter);
+ var data = expandoStore && expandoStore.data;
+
+ if (isSimpleSetter) { // data('key', value)
+ data[key] = value;
+ } else {
+ if (massGetter) { // data()
+ return data;
+ } else {
+ if (isSimpleGetter) { // data('key')
+ // don't force creation of expandoStore if it doesn't exist yet
+ return data && data[key];
+ } else { // mass-setter: data({key1: val1, key2: val2})
+ extend(data, key);
+ }
+ }
+ }
+ }
+}
+
+function jqLiteHasClass(element, selector) {
+ if (!element.getAttribute) return false;
+ return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " ").
+ indexOf(" " + selector + " ") > -1);
+}
+
+function jqLiteRemoveClass(element, cssClasses) {
+ if (cssClasses && element.setAttribute) {
+ forEach(cssClasses.split(' '), function(cssClass) {
+ element.setAttribute('class', trim(
+ (" " + (element.getAttribute('class') || '') + " ")
+ .replace(/[\n\t]/g, " ")
+ .replace(" " + trim(cssClass) + " ", " "))
+ );
+ });
+ }
+}
+
+function jqLiteAddClass(element, cssClasses) {
+ if (cssClasses && element.setAttribute) {
+ var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')
+ .replace(/[\n\t]/g, " ");
+
+ forEach(cssClasses.split(' '), function(cssClass) {
+ cssClass = trim(cssClass);
+ if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {
+ existingClasses += cssClass + ' ';
+ }
+ });
+
+ element.setAttribute('class', trim(existingClasses));
+ }
+}
+
+
+function jqLiteAddNodes(root, elements) {
+ // THIS CODE IS VERY HOT. Don't make changes without benchmarking.
+
+ if (elements) {
+
+ // if a Node (the most common case)
+ if (elements.nodeType) {
+ root[root.length++] = elements;
+ } else {
+ var length = elements.length;
+
+ // if an Array or NodeList and not a Window
+ if (typeof length === 'number' && elements.window !== elements) {
+ if (length) {
+ for (var i = 0; i < length; i++) {
+ root[root.length++] = elements[i];
+ }
+ }
+ } else {
+ root[root.length++] = elements;
+ }
+ }
+ }
+}
+
+
+function jqLiteController(element, name) {
+ return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller');
+}
+
+function jqLiteInheritedData(element, name, value) {
+ // if element is the document object work with the html element instead
+ // this makes $(document).scope() possible
+ if (element.nodeType == NODE_TYPE_DOCUMENT) {
+ element = element.documentElement;
+ }
+ var names = isArray(name) ? name : [name];
+
+ while (element) {
+ for (var i = 0, ii = names.length; i < ii; i++) {
+ if (isDefined(value = jqLite.data(element, names[i]))) return value;
+ }
+
+ // If dealing with a document fragment node with a host element, and no parent, use the host
+ // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM
+ // to lookup parent controllers.
+ element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host);
+ }
+}
+
+function jqLiteEmpty(element) {
+ jqLiteDealoc(element, true);
+ while (element.firstChild) {
+ element.removeChild(element.firstChild);
+ }
+}
+
+function jqLiteRemove(element, keepData) {
+ if (!keepData) jqLiteDealoc(element);
+ var parent = element.parentNode;
+ if (parent) parent.removeChild(element);
+}
+
+
+function jqLiteDocumentLoaded(action, win) {
+ win = win || window;
+ if (win.document.readyState === 'complete') {
+ // Force the action to be run async for consistent behavior
+ // from the action's point of view
+ // i.e. it will definitely not be in a $apply
+ win.setTimeout(action);
+ } else {
+ // No need to unbind this handler as load is only ever called once
+ jqLite(win).on('load', action);
+ }
+}
+
+//////////////////////////////////////////
+// Functions which are declared directly.
+//////////////////////////////////////////
+var JQLitePrototype = JQLite.prototype = {
+ ready: function(fn) {
+ var fired = false;
+
+ function trigger() {
+ if (fired) return;
+ fired = true;
+ fn();
+ }
+
+ // check if document is already loaded
+ if (document.readyState === 'complete') {
+ setTimeout(trigger);
+ } else {
+ this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9
+ // we can not use jqLite since we are not done loading and jQuery could be loaded later.
+ // jshint -W064
+ JQLite(window).on('load', trigger); // fallback to window.onload for others
+ // jshint +W064
+ }
+ },
+ toString: function() {
+ var value = [];
+ forEach(this, function(e) { value.push('' + e);});
+ return '[' + value.join(', ') + ']';
+ },
+
+ eq: function(index) {
+ return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);
+ },
+
+ length: 0,
+ push: push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+//////////////////////////////////////////
+// Functions iterating getter/setters.
+// these functions return self on setter and
+// value on get.
+//////////////////////////////////////////
+var BOOLEAN_ATTR = {};
+forEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) {
+ BOOLEAN_ATTR[lowercase(value)] = value;
+});
+var BOOLEAN_ELEMENTS = {};
+forEach('input,select,option,textarea,button,form,details'.split(','), function(value) {
+ BOOLEAN_ELEMENTS[value] = true;
+});
+var ALIASED_ATTR = {
+ 'ngMinlength': 'minlength',
+ 'ngMaxlength': 'maxlength',
+ 'ngMin': 'min',
+ 'ngMax': 'max',
+ 'ngPattern': 'pattern'
+};
+
+function getBooleanAttrName(element, name) {
+ // check dom last since we will most likely fail on name
+ var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];
+
+ // booleanAttr is here twice to minimize DOM access
+ return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr;
+}
+
+function getAliasedAttrName(name) {
+ return ALIASED_ATTR[name];
+}
+
+forEach({
+ data: jqLiteData,
+ removeData: jqLiteRemoveData,
+ hasData: jqLiteHasData,
+ cleanData: jqLiteCleanData
+}, function(fn, name) {
+ JQLite[name] = fn;
+});
+
+forEach({
+ data: jqLiteData,
+ inheritedData: jqLiteInheritedData,
+
+ scope: function(element) {
+ // Can't use jqLiteData here directly so we stay compatible with jQuery!
+ return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);
+ },
+
+ isolateScope: function(element) {
+ // Can't use jqLiteData here directly so we stay compatible with jQuery!
+ return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate');
+ },
+
+ controller: jqLiteController,
+
+ injector: function(element) {
+ return jqLiteInheritedData(element, '$injector');
+ },
+
+ removeAttr: function(element, name) {
+ element.removeAttribute(name);
+ },
+
+ hasClass: jqLiteHasClass,
+
+ css: function(element, name, value) {
+ name = camelCase(name);
+
+ if (isDefined(value)) {
+ element.style[name] = value;
+ } else {
+ return element.style[name];
+ }
+ },
+
+ attr: function(element, name, value) {
+ var nodeType = element.nodeType;
+ if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT) {
+ return;
+ }
+ var lowercasedName = lowercase(name);
+ if (BOOLEAN_ATTR[lowercasedName]) {
+ if (isDefined(value)) {
+ if (!!value) {
+ element[name] = true;
+ element.setAttribute(name, lowercasedName);
+ } else {
+ element[name] = false;
+ element.removeAttribute(lowercasedName);
+ }
+ } else {
+ return (element[name] ||
+ (element.attributes.getNamedItem(name) || noop).specified)
+ ? lowercasedName
+ : undefined;
+ }
+ } else if (isDefined(value)) {
+ element.setAttribute(name, value);
+ } else if (element.getAttribute) {
+ // the extra argument "2" is to get the right thing for a.href in IE, see jQuery code
+ // some elements (e.g. Document) don't have get attribute, so return undefined
+ var ret = element.getAttribute(name, 2);
+ // normalize non-existing attributes to undefined (as jQuery)
+ return ret === null ? undefined : ret;
+ }
+ },
+
+ prop: function(element, name, value) {
+ if (isDefined(value)) {
+ element[name] = value;
+ } else {
+ return element[name];
+ }
+ },
+
+ text: (function() {
+ getText.$dv = '';
+ return getText;
+
+ function getText(element, value) {
+ if (isUndefined(value)) {
+ var nodeType = element.nodeType;
+ return (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT) ? element.textContent : '';
+ }
+ element.textContent = value;
+ }
+ })(),
+
+ val: function(element, value) {
+ if (isUndefined(value)) {
+ if (element.multiple && nodeName_(element) === 'select') {
+ var result = [];
+ forEach(element.options, function(option) {
+ if (option.selected) {
+ result.push(option.value || option.text);
+ }
+ });
+ return result.length === 0 ? null : result;
+ }
+ return element.value;
+ }
+ element.value = value;
+ },
+
+ html: function(element, value) {
+ if (isUndefined(value)) {
+ return element.innerHTML;
+ }
+ jqLiteDealoc(element, true);
+ element.innerHTML = value;
+ },
+
+ empty: jqLiteEmpty
+}, function(fn, name) {
+ /**
+ * Properties: writes return selection, reads return first value
+ */
+ JQLite.prototype[name] = function(arg1, arg2) {
+ var i, key;
+ var nodeCount = this.length;
+
+ // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it
+ // in a way that survives minification.
+ // jqLiteEmpty takes no arguments but is a setter.
+ if (fn !== jqLiteEmpty &&
+ (isUndefined((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) {
+ if (isObject(arg1)) {
+
+ // we are a write, but the object properties are the key/values
+ for (i = 0; i < nodeCount; i++) {
+ if (fn === jqLiteData) {
+ // data() takes the whole object in jQuery
+ fn(this[i], arg1);
+ } else {
+ for (key in arg1) {
+ fn(this[i], key, arg1[key]);
+ }
+ }
+ }
+ // return self for chaining
+ return this;
+ } else {
+ // we are a read, so read the first child.
+ // TODO: do we still need this?
+ var value = fn.$dv;
+ // Only if we have $dv do we iterate over all, otherwise it is just the first element.
+ var jj = (isUndefined(value)) ? Math.min(nodeCount, 1) : nodeCount;
+ for (var j = 0; j < jj; j++) {
+ var nodeValue = fn(this[j], arg1, arg2);
+ value = value ? value + nodeValue : nodeValue;
+ }
+ return value;
+ }
+ } else {
+ // we are a write, so apply to all children
+ for (i = 0; i < nodeCount; i++) {
+ fn(this[i], arg1, arg2);
+ }
+ // return self for chaining
+ return this;
+ }
+ };
+});
+
+function createEventHandler(element, events) {
+ var eventHandler = function(event, type) {
+ // jQuery specific api
+ event.isDefaultPrevented = function() {
+ return event.defaultPrevented;
+ };
+
+ var eventFns = events[type || event.type];
+ var eventFnsLength = eventFns ? eventFns.length : 0;
+
+ if (!eventFnsLength) return;
+
+ if (isUndefined(event.immediatePropagationStopped)) {
+ var originalStopImmediatePropagation = event.stopImmediatePropagation;
+ event.stopImmediatePropagation = function() {
+ event.immediatePropagationStopped = true;
+
+ if (event.stopPropagation) {
+ event.stopPropagation();
+ }
+
+ if (originalStopImmediatePropagation) {
+ originalStopImmediatePropagation.call(event);
+ }
+ };
+ }
+
+ event.isImmediatePropagationStopped = function() {
+ return event.immediatePropagationStopped === true;
+ };
+
+ // Some events have special handlers that wrap the real handler
+ var handlerWrapper = eventFns.specialHandlerWrapper || defaultHandlerWrapper;
+
+ // Copy event handlers in case event handlers array is modified during execution.
+ if ((eventFnsLength > 1)) {
+ eventFns = shallowCopy(eventFns);
+ }
+
+ for (var i = 0; i < eventFnsLength; i++) {
+ if (!event.isImmediatePropagationStopped()) {
+ handlerWrapper(element, event, eventFns[i]);
+ }
+ }
+ };
+
+ // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all
+ // events on `element`
+ eventHandler.elem = element;
+ return eventHandler;
+}
+
+function defaultHandlerWrapper(element, event, handler) {
+ handler.call(element, event);
+}
+
+function specialMouseHandlerWrapper(target, event, handler) {
+ // Refer to jQuery's implementation of mouseenter & mouseleave
+ // Read about mouseenter and mouseleave:
+ // http://www.quirksmode.org/js/events_mouse.html#link8
+ var related = event.relatedTarget;
+ // For mousenter/leave call the handler if related is outside the target.
+ // NB: No relatedTarget if the mouse left/entered the browser window
+ if (!related || (related !== target && !jqLiteContains.call(target, related))) {
+ handler.call(target, event);
+ }
+}
+
+//////////////////////////////////////////
+// Functions iterating traversal.
+// These functions chain results into a single
+// selector.
+//////////////////////////////////////////
+forEach({
+ removeData: jqLiteRemoveData,
+
+ on: function jqLiteOn(element, type, fn, unsupported) {
+ if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');
+
+ // Do not add event handlers to non-elements because they will not be cleaned up.
+ if (!jqLiteAcceptsData(element)) {
+ return;
+ }
+
+ var expandoStore = jqLiteExpandoStore(element, true);
+ var events = expandoStore.events;
+ var handle = expandoStore.handle;
+
+ if (!handle) {
+ handle = expandoStore.handle = createEventHandler(element, events);
+ }
+
+ // http://jsperf.com/string-indexof-vs-split
+ var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type];
+ var i = types.length;
+
+ var addHandler = function(type, specialHandlerWrapper, noEventListener) {
+ var eventFns = events[type];
+
+ if (!eventFns) {
+ eventFns = events[type] = [];
+ eventFns.specialHandlerWrapper = specialHandlerWrapper;
+ if (type !== '$destroy' && !noEventListener) {
+ addEventListenerFn(element, type, handle);
+ }
+ }
+
+ eventFns.push(fn);
+ };
+
+ while (i--) {
+ type = types[i];
+ if (MOUSE_EVENT_MAP[type]) {
+ addHandler(MOUSE_EVENT_MAP[type], specialMouseHandlerWrapper);
+ addHandler(type, undefined, true);
+ } else {
+ addHandler(type);
+ }
+ }
+ },
+
+ off: jqLiteOff,
+
+ one: function(element, type, fn) {
+ element = jqLite(element);
+
+ //add the listener twice so that when it is called
+ //you can remove the original function and still be
+ //able to call element.off(ev, fn) normally
+ element.on(type, function onFn() {
+ element.off(type, fn);
+ element.off(type, onFn);
+ });
+ element.on(type, fn);
+ },
+
+ replaceWith: function(element, replaceNode) {
+ var index, parent = element.parentNode;
+ jqLiteDealoc(element);
+ forEach(new JQLite(replaceNode), function(node) {
+ if (index) {
+ parent.insertBefore(node, index.nextSibling);
+ } else {
+ parent.replaceChild(node, element);
+ }
+ index = node;
+ });
+ },
+
+ children: function(element) {
+ var children = [];
+ forEach(element.childNodes, function(element) {
+ if (element.nodeType === NODE_TYPE_ELEMENT) {
+ children.push(element);
+ }
+ });
+ return children;
+ },
+
+ contents: function(element) {
+ return element.contentDocument || element.childNodes || [];
+ },
+
+ append: function(element, node) {
+ var nodeType = element.nodeType;
+ if (nodeType !== NODE_TYPE_ELEMENT && nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT) return;
+
+ node = new JQLite(node);
+
+ for (var i = 0, ii = node.length; i < ii; i++) {
+ var child = node[i];
+ element.appendChild(child);
+ }
+ },
+
+ prepend: function(element, node) {
+ if (element.nodeType === NODE_TYPE_ELEMENT) {
+ var index = element.firstChild;
+ forEach(new JQLite(node), function(child) {
+ element.insertBefore(child, index);
+ });
+ }
+ },
+
+ wrap: function(element, wrapNode) {
+ jqLiteWrapNode(element, jqLite(wrapNode).eq(0).clone()[0]);
+ },
+
+ remove: jqLiteRemove,
+
+ detach: function(element) {
+ jqLiteRemove(element, true);
+ },
+
+ after: function(element, newElement) {
+ var index = element, parent = element.parentNode;
+ newElement = new JQLite(newElement);
+
+ for (var i = 0, ii = newElement.length; i < ii; i++) {
+ var node = newElement[i];
+ parent.insertBefore(node, index.nextSibling);
+ index = node;
+ }
+ },
+
+ addClass: jqLiteAddClass,
+ removeClass: jqLiteRemoveClass,
+
+ toggleClass: function(element, selector, condition) {
+ if (selector) {
+ forEach(selector.split(' '), function(className) {
+ var classCondition = condition;
+ if (isUndefined(classCondition)) {
+ classCondition = !jqLiteHasClass(element, className);
+ }
+ (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);
+ });
+ }
+ },
+
+ parent: function(element) {
+ var parent = element.parentNode;
+ return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null;
+ },
+
+ next: function(element) {
+ return element.nextElementSibling;
+ },
+
+ find: function(element, selector) {
+ if (element.getElementsByTagName) {
+ return element.getElementsByTagName(selector);
+ } else {
+ return [];
+ }
+ },
+
+ clone: jqLiteClone,
+
+ triggerHandler: function(element, event, extraParameters) {
+
+ var dummyEvent, eventFnsCopy, handlerArgs;
+ var eventName = event.type || event;
+ var expandoStore = jqLiteExpandoStore(element);
+ var events = expandoStore && expandoStore.events;
+ var eventFns = events && events[eventName];
+
+ if (eventFns) {
+ // Create a dummy event to pass to the handlers
+ dummyEvent = {
+ preventDefault: function() { this.defaultPrevented = true; },
+ isDefaultPrevented: function() { return this.defaultPrevented === true; },
+ stopImmediatePropagation: function() { this.immediatePropagationStopped = true; },
+ isImmediatePropagationStopped: function() { return this.immediatePropagationStopped === true; },
+ stopPropagation: noop,
+ type: eventName,
+ target: element
+ };
+
+ // If a custom event was provided then extend our dummy event with it
+ if (event.type) {
+ dummyEvent = extend(dummyEvent, event);
+ }
+
+ // Copy event handlers in case event handlers array is modified during execution.
+ eventFnsCopy = shallowCopy(eventFns);
+ handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent];
+
+ forEach(eventFnsCopy, function(fn) {
+ if (!dummyEvent.isImmediatePropagationStopped()) {
+ fn.apply(element, handlerArgs);
+ }
+ });
+ }
+ }
+}, function(fn, name) {
+ /**
+ * chaining functions
+ */
+ JQLite.prototype[name] = function(arg1, arg2, arg3) {
+ var value;
+
+ for (var i = 0, ii = this.length; i < ii; i++) {
+ if (isUndefined(value)) {
+ value = fn(this[i], arg1, arg2, arg3);
+ if (isDefined(value)) {
+ // any function which returns a value needs to be wrapped
+ value = jqLite(value);
+ }
+ } else {
+ jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));
+ }
+ }
+ return isDefined(value) ? value : this;
+ };
+
+ // bind legacy bind/unbind to on/off
+ JQLite.prototype.bind = JQLite.prototype.on;
+ JQLite.prototype.unbind = JQLite.prototype.off;
+});
+
+
+// Provider for private $$jqLite service
+function $$jqLiteProvider() {
+ this.$get = function $$jqLite() {
+ return extend(JQLite, {
+ hasClass: function(node, classes) {
+ if (node.attr) node = node[0];
+ return jqLiteHasClass(node, classes);
+ },
+ addClass: function(node, classes) {
+ if (node.attr) node = node[0];
+ return jqLiteAddClass(node, classes);
+ },
+ removeClass: function(node, classes) {
+ if (node.attr) node = node[0];
+ return jqLiteRemoveClass(node, classes);
+ }
+ });
+ };
+}
+
+/**
+ * Computes a hash of an 'obj'.
+ * Hash of a:
+ * string is string
+ * number is number as string
+ * object is either result of calling $$hashKey function on the object or uniquely generated id,
+ * that is also assigned to the $$hashKey property of the object.
+ *
+ * @param obj
+ * @returns {string} hash string such that the same input will have the same hash string.
+ * The resulting string key is in 'type:hashKey' format.
+ */
+function hashKey(obj, nextUidFn) {
+ var key = obj && obj.$$hashKey;
+
+ if (key) {
+ if (typeof key === 'function') {
+ key = obj.$$hashKey();
+ }
+ return key;
+ }
+
+ var objType = typeof obj;
+ if (objType == 'function' || (objType == 'object' && obj !== null)) {
+ key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)();
+ } else {
+ key = objType + ':' + obj;
+ }
+
+ return key;
+}
+
+/**
+ * HashMap which can use objects as keys
+ */
+function HashMap(array, isolatedUid) {
+ if (isolatedUid) {
+ var uid = 0;
+ this.nextUid = function() {
+ return ++uid;
+ };
+ }
+ forEach(array, this.put, this);
+}
+HashMap.prototype = {
+ /**
+ * Store key value pair
+ * @param key key to store can be any type
+ * @param value value to store can be any type
+ */
+ put: function(key, value) {
+ this[hashKey(key, this.nextUid)] = value;
+ },
+
+ /**
+ * @param key
+ * @returns {Object} the value for the key
+ */
+ get: function(key) {
+ return this[hashKey(key, this.nextUid)];
+ },
+
+ /**
+ * Remove the key/value pair
+ * @param key
+ */
+ remove: function(key) {
+ var value = this[key = hashKey(key, this.nextUid)];
+ delete this[key];
+ return value;
+ }
+};
+
+var $$HashMapProvider = [function() {
+ this.$get = [function() {
+ return HashMap;
+ }];
+}];
+
+/**
+ * @ngdoc function
+ * @module ng
+ * @name angular.injector
+ * @kind function
+ *
+ * @description
+ * Creates an injector object that can be used for retrieving services as well as for
+ * dependency injection (see {@link guide/di dependency injection}).
+ *
+ * @param {Array.<string|Function>} modules A list of module functions or their aliases. See
+ * {@link angular.module}. The `ng` module must be explicitly added.
+ * @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which
+ * disallows argument name annotation inference.
+ * @returns {injector} Injector object. See {@link auto.$injector $injector}.
+ *
+ * @example
+ * Typical usage
+ * ```js
+ * // create an injector
+ * var $injector = angular.injector(['ng']);
+ *
+ * // use the injector to kick off your application
+ * // use the type inference to auto inject arguments, or use implicit injection
+ * $injector.invoke(function($rootScope, $compile, $document) {
+ * $compile($document)($rootScope);
+ * $rootScope.$digest();
+ * });
+ * ```
+ *
+ * Sometimes you want to get access to the injector of a currently running Angular app
+ * from outside Angular. Perhaps, you want to inject and compile some markup after the
+ * application has been bootstrapped. You can do this using the extra `injector()` added
+ * to JQuery/jqLite elements. See {@link angular.element}.
+ *
+ * *This is fairly rare but could be the case if a third party library is injecting the
+ * markup.*
+ *
+ * In the following example a new block of HTML containing a `ng-controller`
+ * directive is added to the end of the document body by JQuery. We then compile and link
+ * it into the current AngularJS scope.
+ *
+ * ```js
+ * var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>');
+ * $(document.body).append($div);
+ *
+ * angular.element(document).injector().invoke(function($compile) {
+ * var scope = angular.element($div).scope();
+ * $compile($div)(scope);
+ * });
+ * ```
+ */
+
+
+/**
+ * @ngdoc module
+ * @name auto
+ * @description
+ *
+ * Implicit module which gets automatically added to each {@link auto.$injector $injector}.
+ */
+
+var ARROW_ARG = /^([^\(]+?)=>/;
+var FN_ARGS = /^[^\(]*\(\s*([^\)]*)\)/m;
+var FN_ARG_SPLIT = /,/;
+var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
+var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
+var $injectorMinErr = minErr('$injector');
+
+function extractArgs(fn) {
+ var fnText = fn.toString().replace(STRIP_COMMENTS, ''),
+ args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
+ return args;
+}
+
+function anonFn(fn) {
+ // For anonymous functions, showing at the very least the function signature can help in
+ // debugging.
+ var args = extractArgs(fn);
+ if (args) {
+ return 'function(' + (args[1] || '').replace(/[\s\r\n]+/, ' ') + ')';
+ }
+ return 'fn';
+}
+
+function annotate(fn, strictDi, name) {
+ var $inject,
+ argDecl,
+ last;
+
+ if (typeof fn === 'function') {
+ if (!($inject = fn.$inject)) {
+ $inject = [];
+ if (fn.length) {
+ if (strictDi) {
+ if (!isString(name) || !name) {
+ name = fn.name || anonFn(fn);
+ }
+ throw $injectorMinErr('strictdi',
+ '{0} is not using explicit annotation and cannot be invoked in strict mode', name);
+ }
+ argDecl = extractArgs(fn);
+ forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {
+ arg.replace(FN_ARG, function(all, underscore, name) {
+ $inject.push(name);
+ });
+ });
+ }
+ fn.$inject = $inject;
+ }
+ } else if (isArray(fn)) {
+ last = fn.length - 1;
+ assertArgFn(fn[last], 'fn');
+ $inject = fn.slice(0, last);
+ } else {
+ assertArgFn(fn, 'fn', true);
+ }
+ return $inject;
+}
+
+///////////////////////////////////////
+
+/**
+ * @ngdoc service
+ * @name $injector
+ *
+ * @description
+ *
+ * `$injector` is used to retrieve object instances as defined by
+ * {@link auto.$provide provider}, instantiate types, invoke methods,
+ * and load modules.
+ *
+ * The following always holds true:
+ *
+ * ```js
+ * var $injector = angular.injector();
+ * expect($injector.get('$injector')).toBe($injector);
+ * expect($injector.invoke(function($injector) {
+ * return $injector;
+ * })).toBe($injector);
+ * ```
+ *
+ * # Injection Function Annotation
+ *
+ * JavaScript does not have annotations, and annotations are needed for dependency injection. The
+ * following are all valid ways of annotating function with injection arguments and are equivalent.
+ *
+ * ```js
+ * // inferred (only works if code not minified/obfuscated)
+ * $injector.invoke(function(serviceA){});
+ *
+ * // annotated
+ * function explicit(serviceA) {};
+ * explicit.$inject = ['serviceA'];
+ * $injector.invoke(explicit);
+ *
+ * // inline
+ * $injector.invoke(['serviceA', function(serviceA){}]);
+ * ```
+ *
+ * ## Inference
+ *
+ * In JavaScript calling `toString()` on a function returns the function definition. The definition
+ * can then be parsed and the function arguments can be extracted. This method of discovering
+ * annotations is disallowed when the injector is in strict mode.
+ * *NOTE:* This does not work with minification, and obfuscation tools since these tools change the
+ * argument names.
+ *
+ * ## `$inject` Annotation
+ * By adding an `$inject` property onto a function the injection parameters can be specified.
+ *
+ * ## Inline
+ * As an array of injection names, where the last item in the array is the function to call.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#get
+ *
+ * @description
+ * Return an instance of the service.
+ *
+ * @param {string} name The name of the instance to retrieve.
+ * @param {string=} caller An optional string to provide the origin of the function call for error messages.
+ * @return {*} The instance.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#invoke
+ *
+ * @description
+ * Invoke the method and supply the method arguments from the `$injector`.
+ *
+ * @param {Function|Array.<string|Function>} fn The injectable function to invoke. Function parameters are
+ * injected according to the {@link guide/di $inject Annotation} rules.
+ * @param {Object=} self The `this` for the invoked method.
+ * @param {Object=} locals Optional object. If preset then any argument names are read from this
+ * object first, before the `$injector` is consulted.
+ * @returns {*} the value returned by the invoked `fn` function.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#has
+ *
+ * @description
+ * Allows the user to query if the particular service exists.
+ *
+ * @param {string} name Name of the service to query.
+ * @returns {boolean} `true` if injector has given service.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#instantiate
+ * @description
+ * Create a new instance of JS type. The method takes a constructor function, invokes the new
+ * operator, and supplies all of the arguments to the constructor function as specified by the
+ * constructor annotation.
+ *
+ * @param {Function} Type Annotated constructor function.
+ * @param {Object=} locals Optional object. If preset then any argument names are read from this
+ * object first, before the `$injector` is consulted.
+ * @returns {Object} new instance of `Type`.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#annotate
+ *
+ * @description
+ * Returns an array of service names which the function is requesting for injection. This API is
+ * used by the injector to determine which services need to be injected into the function when the
+ * function is invoked. There are three ways in which the function can be annotated with the needed
+ * dependencies.
+ *
+ * # Argument names
+ *
+ * The simplest form is to extract the dependencies from the arguments of the function. This is done
+ * by converting the function into a string using `toString()` method and extracting the argument
+ * names.
+ * ```js
+ * // Given
+ * function MyController($scope, $route) {
+ * // ...
+ * }
+ *
+ * // Then
+ * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+ * ```
+ *
+ * You can disallow this method by using strict injection mode.
+ *
+ * This method does not work with code minification / obfuscation. For this reason the following
+ * annotation strategies are supported.
+ *
+ * # The `$inject` property
+ *
+ * If a function has an `$inject` property and its value is an array of strings, then the strings
+ * represent names of services to be injected into the function.
+ * ```js
+ * // Given
+ * var MyController = function(obfuscatedScope, obfuscatedRoute) {
+ * // ...
+ * }
+ * // Define function dependencies
+ * MyController['$inject'] = ['$scope', '$route'];
+ *
+ * // Then
+ * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+ * ```
+ *
+ * # The array notation
+ *
+ * It is often desirable to inline Injected functions and that's when setting the `$inject` property
+ * is very inconvenient. In these situations using the array notation to specify the dependencies in
+ * a way that survives minification is a better choice:
+ *
+ * ```js
+ * // We wish to write this (not minification / obfuscation safe)
+ * injector.invoke(function($compile, $rootScope) {
+ * // ...
+ * });
+ *
+ * // We are forced to write break inlining
+ * var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {
+ * // ...
+ * };
+ * tmpFn.$inject = ['$compile', '$rootScope'];
+ * injector.invoke(tmpFn);
+ *
+ * // To better support inline function the inline annotation is supported
+ * injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {
+ * // ...
+ * }]);
+ *
+ * // Therefore
+ * expect(injector.annotate(
+ * ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
+ * ).toEqual(['$compile', '$rootScope']);
+ * ```
+ *
+ * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to
+ * be retrieved as described above.
+ *
+ * @param {boolean=} [strictDi=false] Disallow argument name annotation inference.
+ *
+ * @returns {Array.<string>} The names of the services which the function requires.
+ */
+
+
+
+
+/**
+ * @ngdoc service
+ * @name $provide
+ *
+ * @description
+ *
+ * The {@link auto.$provide $provide} service has a number of methods for registering components
+ * with the {@link auto.$injector $injector}. Many of these functions are also exposed on
+ * {@link angular.Module}.
+ *
+ * An Angular **service** is a singleton object created by a **service factory**. These **service
+ * factories** are functions which, in turn, are created by a **service provider**.
+ * The **service providers** are constructor functions. When instantiated they must contain a
+ * property called `$get`, which holds the **service factory** function.
+ *
+ * When you request a service, the {@link auto.$injector $injector} is responsible for finding the
+ * correct **service provider**, instantiating it and then calling its `$get` **service factory**
+ * function to get the instance of the **service**.
+ *
+ * Often services have no configuration options and there is no need to add methods to the service
+ * provider. The provider will be no more than a constructor function with a `$get` property. For
+ * these cases the {@link auto.$provide $provide} service has additional helper methods to register
+ * services without specifying a provider.
+ *
+ * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the
+ * {@link auto.$injector $injector}
+ * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by
+ * providers and services.
+ * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by
+ * services, not providers.
+ * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`,
+ * that will be wrapped in a **service provider** object, whose `$get` property will contain the
+ * given factory function.
+ * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class`
+ * that will be wrapped in a **service provider** object, whose `$get` property will instantiate
+ * a new object using the given constructor function.
+ *
+ * See the individual methods for more information and examples.
+ */
+
+/**
+ * @ngdoc method
+ * @name $provide#provider
+ * @description
+ *
+ * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions
+ * are constructor functions, whose instances are responsible for "providing" a factory for a
+ * service.
+ *
+ * Service provider names start with the name of the service they provide followed by `Provider`.
+ * For example, the {@link ng.$log $log} service has a provider called
+ * {@link ng.$logProvider $logProvider}.
+ *
+ * Service provider objects can have additional methods which allow configuration of the provider
+ * and its service. Importantly, you can configure what kind of service is created by the `$get`
+ * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a
+ * method {@link ng.$logProvider#debugEnabled debugEnabled}
+ * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the
+ * console or not.
+ *
+ * @param {string} name The name of the instance. NOTE: the provider will be available under `name +
+ 'Provider'` key.
+ * @param {(Object|function())} provider If the provider is:
+ *
+ * - `Object`: then it should have a `$get` method. The `$get` method will be invoked using
+ * {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created.
+ * - `Constructor`: a new instance of the provider will be created using
+ * {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`.
+ *
+ * @returns {Object} registered provider instance
+
+ * @example
+ *
+ * The following example shows how to create a simple event tracking service and register it using
+ * {@link auto.$provide#provider $provide.provider()}.
+ *
+ * ```js
+ * // Define the eventTracker provider
+ * function EventTrackerProvider() {
+ * var trackingUrl = '/track';
+ *
+ * // A provider method for configuring where the tracked events should been saved
+ * this.setTrackingUrl = function(url) {
+ * trackingUrl = url;
+ * };
+ *
+ * // The service factory function
+ * this.$get = ['$http', function($http) {
+ * var trackedEvents = {};
+ * return {
+ * // Call this to track an event
+ * event: function(event) {
+ * var count = trackedEvents[event] || 0;
+ * count += 1;
+ * trackedEvents[event] = count;
+ * return count;
+ * },
+ * // Call this to save the tracked events to the trackingUrl
+ * save: function() {
+ * $http.post(trackingUrl, trackedEvents);
+ * }
+ * };
+ * }];
+ * }
+ *
+ * describe('eventTracker', function() {
+ * var postSpy;
+ *
+ * beforeEach(module(function($provide) {
+ * // Register the eventTracker provider
+ * $provide.provider('eventTracker', EventTrackerProvider);
+ * }));
+ *
+ * beforeEach(module(function(eventTrackerProvider) {
+ * // Configure eventTracker provider
+ * eventTrackerProvider.setTrackingUrl('/custom-track');
+ * }));
+ *
+ * it('tracks events', inject(function(eventTracker) {
+ * expect(eventTracker.event('login')).toEqual(1);
+ * expect(eventTracker.event('login')).toEqual(2);
+ * }));
+ *
+ * it('saves to the tracking url', inject(function(eventTracker, $http) {
+ * postSpy = spyOn($http, 'post');
+ * eventTracker.event('login');
+ * eventTracker.save();
+ * expect(postSpy).toHaveBeenCalled();
+ * expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');
+ * expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');
+ * expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });
+ * }));
+ * });
+ * ```
+ */
+
+/**
+ * @ngdoc method
+ * @name $provide#factory
+ * @description
+ *
+ * Register a **service factory**, which will be called to return the service instance.
+ * This is short for registering a service where its provider consists of only a `$get` property,
+ * which is the given service factory function.
+ * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to
+ * configure your service in a provider.
+ *
+ * @param {string} name The name of the instance.
+ * @param {Function|Array.<string|Function>} $getFn The injectable $getFn for the instance creation.
+ * Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here is an example of registering a service
+ * ```js
+ * $provide.factory('ping', ['$http', function($http) {
+ * return function ping() {
+ * return $http.send('/ping');
+ * };
+ * }]);
+ * ```
+ * You would then inject and use this service like this:
+ * ```js
+ * someModule.controller('Ctrl', ['ping', function(ping) {
+ * ping();
+ * }]);
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#service
+ * @description
+ *
+ * Register a **service constructor**, which will be invoked with `new` to create the service
+ * instance.
+ * This is short for registering a service where its provider's `$get` property is a factory
+ * function that returns an instance instantiated by the injector from the service constructor
+ * function.
+ *
+ * Internally it looks a bit like this:
+ *
+ * ```
+ * {
+ * $get: function() {
+ * return $injector.instantiate(constructor);
+ * }
+ * }
+ * ```
+ *
+ *
+ * You should use {@link auto.$provide#service $provide.service(class)} if you define your service
+ * as a type/class.
+ *
+ * @param {string} name The name of the instance.
+ * @param {Function|Array.<string|Function>} constructor An injectable class (constructor function)
+ * that will be instantiated.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here is an example of registering a service using
+ * {@link auto.$provide#service $provide.service(class)}.
+ * ```js
+ * var Ping = function($http) {
+ * this.$http = $http;
+ * };
+ *
+ * Ping.$inject = ['$http'];
+ *
+ * Ping.prototype.send = function() {
+ * return this.$http.get('/ping');
+ * };
+ * $provide.service('ping', Ping);
+ * ```
+ * You would then inject and use this service like this:
+ * ```js
+ * someModule.controller('Ctrl', ['ping', function(ping) {
+ * ping.send();
+ * }]);
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#value
+ * @description
+ *
+ * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a
+ * number, an array, an object or a function. This is short for registering a service where its
+ * provider's `$get` property is a factory function that takes no arguments and returns the **value
+ * service**.
+ *
+ * Value services are similar to constant services, except that they cannot be injected into a
+ * module configuration function (see {@link angular.Module#config}) but they can be overridden by
+ * an Angular
+ * {@link auto.$provide#decorator decorator}.
+ *
+ * @param {string} name The name of the instance.
+ * @param {*} value The value.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here are some examples of creating value services.
+ * ```js
+ * $provide.value('ADMIN_USER', 'admin');
+ *
+ * $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });
+ *
+ * $provide.value('halfOf', function(value) {
+ * return value / 2;
+ * });
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#constant
+ * @description
+ *
+ * Register a **constant service**, such as a string, a number, an array, an object or a function,
+ * with the {@link auto.$injector $injector}. Unlike {@link auto.$provide#value value} it can be
+ * injected into a module configuration function (see {@link angular.Module#config}) and it cannot
+ * be overridden by an Angular {@link auto.$provide#decorator decorator}.
+ *
+ * @param {string} name The name of the constant.
+ * @param {*} value The constant value.
+ * @returns {Object} registered instance
+ *
+ * @example
+ * Here a some examples of creating constants:
+ * ```js
+ * $provide.constant('SHARD_HEIGHT', 306);
+ *
+ * $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);
+ *
+ * $provide.constant('double', function(value) {
+ * return value * 2;
+ * });
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#decorator
+ * @description
+ *
+ * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator
+ * intercepts the creation of a service, allowing it to override or modify the behavior of the
+ * service. The object returned by the decorator may be the original service, or a new service
+ * object which replaces or wraps and delegates to the original service.
+ *
+ * @param {string} name The name of the service to decorate.
+ * @param {Function|Array.<string|Function>} decorator This function will be invoked when the service needs to be
+ * instantiated and should return the decorated service instance. The function is called using
+ * the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.
+ * Local injection arguments:
+ *
+ * * `$delegate` - The original service instance, which can be monkey patched, configured,
+ * decorated or delegated to.
+ *
+ * @example
+ * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting
+ * calls to {@link ng.$log#error $log.warn()}.
+ * ```js
+ * $provide.decorator('$log', ['$delegate', function($delegate) {
+ * $delegate.warn = $delegate.error;
+ * return $delegate;
+ * }]);
+ * ```
+ */
+
+
+function createInjector(modulesToLoad, strictDi) {
+ strictDi = (strictDi === true);
+ var INSTANTIATING = {},
+ providerSuffix = 'Provider',
+ path = [],
+ loadedModules = new HashMap([], true),
+ providerCache = {
+ $provide: {
+ provider: supportObject(provider),
+ factory: supportObject(factory),
+ service: supportObject(service),
+ value: supportObject(value),
+ constant: supportObject(constant),
+ decorator: decorator
+ }
+ },
+ providerInjector = (providerCache.$injector =
+ createInternalInjector(providerCache, function(serviceName, caller) {
+ if (angular.isString(caller)) {
+ path.push(caller);
+ }
+ throw $injectorMinErr('unpr', "Unknown provider: {0}", path.join(' <- '));
+ })),
+ instanceCache = {},
+ protoInstanceInjector =
+ createInternalInjector(instanceCache, function(serviceName, caller) {
+ var provider = providerInjector.get(serviceName + providerSuffix, caller);
+ return instanceInjector.invoke(
+ provider.$get, provider, undefined, serviceName);
+ }),
+ instanceInjector = protoInstanceInjector;
+
+ providerCache['$injector' + providerSuffix] = { $get: valueFn(protoInstanceInjector) };
+ var runBlocks = loadModules(modulesToLoad);
+ instanceInjector = protoInstanceInjector.get('$injector');
+ instanceInjector.strictDi = strictDi;
+ forEach(runBlocks, function(fn) { if (fn) instanceInjector.invoke(fn); });
+
+ return instanceInjector;
+
+ ////////////////////////////////////
+ // $provider
+ ////////////////////////////////////
+
+ function supportObject(delegate) {
+ return function(key, value) {
+ if (isObject(key)) {
+ forEach(key, reverseParams(delegate));
+ } else {
+ return delegate(key, value);
+ }
+ };
+ }
+
+ function provider(name, provider_) {
+ assertNotHasOwnProperty(name, 'service');
+ if (isFunction(provider_) || isArray(provider_)) {
+ provider_ = providerInjector.instantiate(provider_);
+ }
+ if (!provider_.$get) {
+ throw $injectorMinErr('pget', "Provider '{0}' must define $get factory method.", name);
+ }
+ return providerCache[name + providerSuffix] = provider_;
+ }
+
+ function enforceReturnValue(name, factory) {
+ return function enforcedReturnValue() {
+ var result = instanceInjector.invoke(factory, this);
+ if (isUndefined(result)) {
+ throw $injectorMinErr('undef', "Provider '{0}' must return a value from $get factory method.", name);
+ }
+ return result;
+ };
+ }
+
+ function factory(name, factoryFn, enforce) {
+ return provider(name, {
+ $get: enforce !== false ? enforceReturnValue(name, factoryFn) : factoryFn
+ });
+ }
+
+ function service(name, constructor) {
+ return factory(name, ['$injector', function($injector) {
+ return $injector.instantiate(constructor);
+ }]);
+ }
+
+ function value(name, val) { return factory(name, valueFn(val), false); }
+
+ function constant(name, value) {
+ assertNotHasOwnProperty(name, 'constant');
+ providerCache[name] = value;
+ instanceCache[name] = value;
+ }
+
+ function decorator(serviceName, decorFn) {
+ var origProvider = providerInjector.get(serviceName + providerSuffix),
+ orig$get = origProvider.$get;
+
+ origProvider.$get = function() {
+ var origInstance = instanceInjector.invoke(orig$get, origProvider);
+ return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});
+ };
+ }
+
+ ////////////////////////////////////
+ // Module Loading
+ ////////////////////////////////////
+ function loadModules(modulesToLoad) {
+ assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');
+ var runBlocks = [], moduleFn;
+ forEach(modulesToLoad, function(module) {
+ if (loadedModules.get(module)) return;
+ loadedModules.put(module, true);
+
+ function runInvokeQueue(queue) {
+ var i, ii;
+ for (i = 0, ii = queue.length; i < ii; i++) {
+ var invokeArgs = queue[i],
+ provider = providerInjector.get(invokeArgs[0]);
+
+ provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
+ }
+ }
+
+ try {
+ if (isString(module)) {
+ moduleFn = angularModule(module);
+ runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
+ runInvokeQueue(moduleFn._invokeQueue);
+ runInvokeQueue(moduleFn._configBlocks);
+ } else if (isFunction(module)) {
+ runBlocks.push(providerInjector.invoke(module));
+ } else if (isArray(module)) {
+ runBlocks.push(providerInjector.invoke(module));
+ } else {
+ assertArgFn(module, 'module');
+ }
+ } catch (e) {
+ if (isArray(module)) {
+ module = module[module.length - 1];
+ }
+ if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {
+ // Safari & FF's stack traces don't contain error.message content
+ // unlike those of Chrome and IE
+ // So if stack doesn't contain message, we create a new string that contains both.
+ // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
+ /* jshint -W022 */
+ e = e.message + '\n' + e.stack;
+ }
+ throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
+ module, e.stack || e.message || e);
+ }
+ });
+ return runBlocks;
+ }
+
+ ////////////////////////////////////
+ // internal Injector
+ ////////////////////////////////////
+
+ function createInternalInjector(cache, factory) {
+
+ function getService(serviceName, caller) {
+ if (cache.hasOwnProperty(serviceName)) {
+ if (cache[serviceName] === INSTANTIATING) {
+ throw $injectorMinErr('cdep', 'Circular dependency found: {0}',
+ serviceName + ' <- ' + path.join(' <- '));
+ }
+ return cache[serviceName];
+ } else {
+ try {
+ path.unshift(serviceName);
+ cache[serviceName] = INSTANTIATING;
+ return cache[serviceName] = factory(serviceName, caller);
+ } catch (err) {
+ if (cache[serviceName] === INSTANTIATING) {
+ delete cache[serviceName];
+ }
+ throw err;
+ } finally {
+ path.shift();
+ }
+ }
+ }
+
+
+ function injectionArgs(fn, locals, serviceName) {
+ var args = [],
+ $inject = createInjector.$$annotate(fn, strictDi, serviceName);
+
+ for (var i = 0, length = $inject.length; i < length; i++) {
+ var key = $inject[i];
+ if (typeof key !== 'string') {
+ throw $injectorMinErr('itkn',
+ 'Incorrect injection token! Expected service name as string, got {0}', key);
+ }
+ args.push(locals && locals.hasOwnProperty(key) ? locals[key] :
+ getService(key, serviceName));
+ }
+ return args;
+ }
+
+ function isClass(func) {
+ // IE 9-11 do not support classes and IE9 leaks with the code below.
+ if (msie <= 11) {
+ return false;
+ }
+ // Workaround for MS Edge.
+ // Check https://connect.microsoft.com/IE/Feedback/Details/2211653
+ return typeof func === 'function'
+ && /^(?:class\s|constructor\()/.test(Function.prototype.toString.call(func));
+ }
+
+ function invoke(fn, self, locals, serviceName) {
+ if (typeof locals === 'string') {
+ serviceName = locals;
+ locals = null;
+ }
+
+ var args = injectionArgs(fn, locals, serviceName);
+ if (isArray(fn)) {
+ fn = fn[fn.length - 1];
+ }
+
+ if (!isClass(fn)) {
+ // http://jsperf.com/angularjs-invoke-apply-vs-switch
+ // #5388
+ return fn.apply(self, args);
+ } else {
+ args.unshift(null);
+ return new (Function.prototype.bind.apply(fn, args))();
+ }
+ }
+
+
+ function instantiate(Type, locals, serviceName) {
+ // Check if Type is annotated and use just the given function at n-1 as parameter
+ // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
+ var ctor = (isArray(Type) ? Type[Type.length - 1] : Type);
+ var args = injectionArgs(Type, locals, serviceName);
+ // Empty object at position 0 is ignored for invocation with `new`, but required.
+ args.unshift(null);
+ return new (Function.prototype.bind.apply(ctor, args))();
+ }
+
+
+ return {
+ invoke: invoke,
+ instantiate: instantiate,
+ get: getService,
+ annotate: createInjector.$$annotate,
+ has: function(name) {
+ return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);
+ }
+ };
+ }
+}
+
+createInjector.$$annotate = annotate;
+
+/**
+ * @ngdoc provider
+ * @name $anchorScrollProvider
+ *
+ * @description
+ * Use `$anchorScrollProvider` to disable automatic scrolling whenever
+ * {@link ng.$location#hash $location.hash()} changes.
+ */
+function $AnchorScrollProvider() {
+
+ var autoScrollingEnabled = true;
+
+ /**
+ * @ngdoc method
+ * @name $anchorScrollProvider#disableAutoScrolling
+ *
+ * @description
+ * By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to
+ * {@link ng.$location#hash $location.hash()} and scroll to the element matching the new hash.<br />
+ * Use this method to disable automatic scrolling.
+ *
+ * If automatic scrolling is disabled, one must explicitly call
+ * {@link ng.$anchorScroll $anchorScroll()} in order to scroll to the element related to the
+ * current hash.
+ */
+ this.disableAutoScrolling = function() {
+ autoScrollingEnabled = false;
+ };
+
+ /**
+ * @ngdoc service
+ * @name $anchorScroll
+ * @kind function
+ * @requires $window
+ * @requires $location
+ * @requires $rootScope
+ *
+ * @description
+ * When called, it scrolls to the element related to the specified `hash` or (if omitted) to the
+ * current value of {@link ng.$location#hash $location.hash()}, according to the rules specified
+ * in the
+ * [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#the-indicated-part-of-the-document).
+ *
+ * It also watches the {@link ng.$location#hash $location.hash()} and automatically scrolls to
+ * match any anchor whenever it changes. This can be disabled by calling
+ * {@link ng.$anchorScrollProvider#disableAutoScrolling $anchorScrollProvider.disableAutoScrolling()}.
+ *
+ * Additionally, you can use its {@link ng.$anchorScroll#yOffset yOffset} property to specify a
+ * vertical scroll-offset (either fixed or dynamic).
+ *
+ * @param {string=} hash The hash specifying the element to scroll to. If omitted, the value of
+ * {@link ng.$location#hash $location.hash()} will be used.
+ *
+ * @property {(number|function|jqLite)} yOffset
+ * If set, specifies a vertical scroll-offset. This is often useful when there are fixed
+ * positioned elements at the top of the page, such as navbars, headers etc.
+ *
+ * `yOffset` can be specified in various ways:
+ * - **number**: A fixed number of pixels to be used as offset.<br /><br />
+ * - **function**: A getter function called everytime `$anchorScroll()` is executed. Must return
+ * a number representing the offset (in pixels).<br /><br />
+ * - **jqLite**: A jqLite/jQuery element to be used for specifying the offset. The distance from
+ * the top of the page to the element's bottom will be used as offset.<br />
+ * **Note**: The element will be taken into account only as long as its `position` is set to
+ * `fixed`. This option is useful, when dealing with responsive navbars/headers that adjust
+ * their height and/or positioning according to the viewport's size.
+ *
+ * <br />
+ * <div class="alert alert-warning">
+ * In order for `yOffset` to work properly, scrolling should take place on the document's root and
+ * not some child element.
+ * </div>
+ *
+ * @example
+ <example module="anchorScrollExample">
+ <file name="index.html">
+ <div id="scrollArea" ng-controller="ScrollController">
+ <a ng-click="gotoBottom()">Go to bottom</a>
+ <a id="bottom"></a> You're at the bottom!
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('anchorScrollExample', [])
+ .controller('ScrollController', ['$scope', '$location', '$anchorScroll',
+ function ($scope, $location, $anchorScroll) {
+ $scope.gotoBottom = function() {
+ // set the location.hash to the id of
+ // the element you wish to scroll to.
+ $location.hash('bottom');
+
+ // call $anchorScroll()
+ $anchorScroll();
+ };
+ }]);
+ </file>
+ <file name="style.css">
+ #scrollArea {
+ height: 280px;
+ overflow: auto;
+ }
+
+ #bottom {
+ display: block;
+ margin-top: 2000px;
+ }
+ </file>
+ </example>
+ *
+ * <hr />
+ * The example below illustrates the use of a vertical scroll-offset (specified as a fixed value).
+ * See {@link ng.$anchorScroll#yOffset $anchorScroll.yOffset} for more details.
+ *
+ * @example
+ <example module="anchorScrollOffsetExample">
+ <file name="index.html">
+ <div class="fixed-header" ng-controller="headerCtrl">
+ <a href="" ng-click="gotoAnchor(x)" ng-repeat="x in [1,2,3,4,5]">
+ Go to anchor {{x}}
+ </a>
+ </div>
+ <div id="anchor{{x}}" class="anchor" ng-repeat="x in [1,2,3,4,5]">
+ Anchor {{x}} of 5
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('anchorScrollOffsetExample', [])
+ .run(['$anchorScroll', function($anchorScroll) {
+ $anchorScroll.yOffset = 50; // always scroll by 50 extra pixels
+ }])
+ .controller('headerCtrl', ['$anchorScroll', '$location', '$scope',
+ function ($anchorScroll, $location, $scope) {
+ $scope.gotoAnchor = function(x) {
+ var newHash = 'anchor' + x;
+ if ($location.hash() !== newHash) {
+ // set the $location.hash to `newHash` and
+ // $anchorScroll will automatically scroll to it
+ $location.hash('anchor' + x);
+ } else {
+ // call $anchorScroll() explicitly,
+ // since $location.hash hasn't changed
+ $anchorScroll();
+ }
+ };
+ }
+ ]);
+ </file>
+ <file name="style.css">
+ body {
+ padding-top: 50px;
+ }
+
+ .anchor {
+ border: 2px dashed DarkOrchid;
+ padding: 10px 10px 200px 10px;
+ }
+
+ .fixed-header {
+ background-color: rgba(0, 0, 0, 0.2);
+ height: 50px;
+ position: fixed;
+ top: 0; left: 0; right: 0;
+ }
+
+ .fixed-header > a {
+ display: inline-block;
+ margin: 5px 15px;
+ }
+ </file>
+ </example>
+ */
+ this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {
+ var document = $window.document;
+
+ // Helper function to get first anchor from a NodeList
+ // (using `Array#some()` instead of `angular#forEach()` since it's more performant
+ // and working in all supported browsers.)
+ function getFirstAnchor(list) {
+ var result = null;
+ Array.prototype.some.call(list, function(element) {
+ if (nodeName_(element) === 'a') {
+ result = element;
+ return true;
+ }
+ });
+ return result;
+ }
+
+ function getYOffset() {
+
+ var offset = scroll.yOffset;
+
+ if (isFunction(offset)) {
+ offset = offset();
+ } else if (isElement(offset)) {
+ var elem = offset[0];
+ var style = $window.getComputedStyle(elem);
+ if (style.position !== 'fixed') {
+ offset = 0;
+ } else {
+ offset = elem.getBoundingClientRect().bottom;
+ }
+ } else if (!isNumber(offset)) {
+ offset = 0;
+ }
+
+ return offset;
+ }
+
+ function scrollTo(elem) {
+ if (elem) {
+ elem.scrollIntoView();
+
+ var offset = getYOffset();
+
+ if (offset) {
+ // `offset` is the number of pixels we should scroll UP in order to align `elem` properly.
+ // This is true ONLY if the call to `elem.scrollIntoView()` initially aligns `elem` at the
+ // top of the viewport.
+ //
+ // IF the number of pixels from the top of `elem` to the end of the page's content is less
+ // than the height of the viewport, then `elem.scrollIntoView()` will align the `elem` some
+ // way down the page.
+ //
+ // This is often the case for elements near the bottom of the page.
+ //
+ // In such cases we do not need to scroll the whole `offset` up, just the difference between
+ // the top of the element and the offset, which is enough to align the top of `elem` at the
+ // desired position.
+ var elemTop = elem.getBoundingClientRect().top;
+ $window.scrollBy(0, elemTop - offset);
+ }
+ } else {
+ $window.scrollTo(0, 0);
+ }
+ }
+
+ function scroll(hash) {
+ hash = isString(hash) ? hash : $location.hash();
+ var elm;
+
+ // empty hash, scroll to the top of the page
+ if (!hash) scrollTo(null);
+
+ // element with given id
+ else if ((elm = document.getElementById(hash))) scrollTo(elm);
+
+ // first anchor with given name :-D
+ else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);
+
+ // no element and hash == 'top', scroll to the top of the page
+ else if (hash === 'top') scrollTo(null);
+ }
+
+ // does not scroll when user clicks on anchor link that is currently on
+ // (no url change, no $location.hash() change), browser native does scroll
+ if (autoScrollingEnabled) {
+ $rootScope.$watch(function autoScrollWatch() {return $location.hash();},
+ function autoScrollWatchAction(newVal, oldVal) {
+ // skip the initial scroll if $location.hash is empty
+ if (newVal === oldVal && newVal === '') return;
+
+ jqLiteDocumentLoaded(function() {
+ $rootScope.$evalAsync(scroll);
+ });
+ });
+ }
+
+ return scroll;
+ }];
+}
+
+var $animateMinErr = minErr('$animate');
+var ELEMENT_NODE = 1;
+var NG_ANIMATE_CLASSNAME = 'ng-animate';
+
+function mergeClasses(a,b) {
+ if (!a && !b) return '';
+ if (!a) return b;
+ if (!b) return a;
+ if (isArray(a)) a = a.join(' ');
+ if (isArray(b)) b = b.join(' ');
+ return a + ' ' + b;
+}
+
+function extractElementNode(element) {
+ for (var i = 0; i < element.length; i++) {
+ var elm = element[i];
+ if (elm.nodeType === ELEMENT_NODE) {
+ return elm;
+ }
+ }
+}
+
+function splitClasses(classes) {
+ if (isString(classes)) {
+ classes = classes.split(' ');
+ }
+
+ // Use createMap() to prevent class assumptions involving property names in
+ // Object.prototype
+ var obj = createMap();
+ forEach(classes, function(klass) {
+ // sometimes the split leaves empty string values
+ // incase extra spaces were applied to the options
+ if (klass.length) {
+ obj[klass] = true;
+ }
+ });
+ return obj;
+}
+
+// if any other type of options value besides an Object value is
+// passed into the $animate.method() animation then this helper code
+// will be run which will ignore it. While this patch is not the
+// greatest solution to this, a lot of existing plugins depend on
+// $animate to either call the callback (< 1.2) or return a promise
+// that can be changed. This helper function ensures that the options
+// are wiped clean incase a callback function is provided.
+function prepareAnimateOptions(options) {
+ return isObject(options)
+ ? options
+ : {};
+}
+
+var $$CoreAnimateJsProvider = function() {
+ this.$get = function() {};
+};
+
+// this is prefixed with Core since it conflicts with
+// the animateQueueProvider defined in ngAnimate/animateQueue.js
+var $$CoreAnimateQueueProvider = function() {
+ var postDigestQueue = new HashMap();
+ var postDigestElements = [];
+
+ this.$get = ['$$AnimateRunner', '$rootScope',
+ function($$AnimateRunner, $rootScope) {
+ return {
+ enabled: noop,
+ on: noop,
+ off: noop,
+ pin: noop,
+
+ push: function(element, event, options, domOperation) {
+ domOperation && domOperation();
+
+ options = options || {};
+ options.from && element.css(options.from);
+ options.to && element.css(options.to);
+
+ if (options.addClass || options.removeClass) {
+ addRemoveClassesPostDigest(element, options.addClass, options.removeClass);
+ }
+
+ var runner = new $$AnimateRunner(); // jshint ignore:line
+
+ // since there are no animations to run the runner needs to be
+ // notified that the animation call is complete.
+ runner.complete();
+ return runner;
+ }
+ };
+
+
+ function updateData(data, classes, value) {
+ var changed = false;
+ if (classes) {
+ classes = isString(classes) ? classes.split(' ') :
+ isArray(classes) ? classes : [];
+ forEach(classes, function(className) {
+ if (className) {
+ changed = true;
+ data[className] = value;
+ }
+ });
+ }
+ return changed;
+ }
+
+ function handleCSSClassChanges() {
+ forEach(postDigestElements, function(element) {
+ var data = postDigestQueue.get(element);
+ if (data) {
+ var existing = splitClasses(element.attr('class'));
+ var toAdd = '';
+ var toRemove = '';
+ forEach(data, function(status, className) {
+ var hasClass = !!existing[className];
+ if (status !== hasClass) {
+ if (status) {
+ toAdd += (toAdd.length ? ' ' : '') + className;
+ } else {
+ toRemove += (toRemove.length ? ' ' : '') + className;
+ }
+ }
+ });
+
+ forEach(element, function(elm) {
+ toAdd && jqLiteAddClass(elm, toAdd);
+ toRemove && jqLiteRemoveClass(elm, toRemove);
+ });
+ postDigestQueue.remove(element);
+ }
+ });
+ postDigestElements.length = 0;
+ }
+
+
+ function addRemoveClassesPostDigest(element, add, remove) {
+ var data = postDigestQueue.get(element) || {};
+
+ var classesAdded = updateData(data, add, true);
+ var classesRemoved = updateData(data, remove, false);
+
+ if (classesAdded || classesRemoved) {
+
+ postDigestQueue.put(element, data);
+ postDigestElements.push(element);
+
+ if (postDigestElements.length === 1) {
+ $rootScope.$$postDigest(handleCSSClassChanges);
+ }
+ }
+ }
+ }];
+};
+
+/**
+ * @ngdoc provider
+ * @name $animateProvider
+ *
+ * @description
+ * Default implementation of $animate that doesn't perform any animations, instead just
+ * synchronously performs DOM updates and resolves the returned runner promise.
+ *
+ * In order to enable animations the `ngAnimate` module has to be loaded.
+ *
+ * To see the functional implementation check out `src/ngAnimate/animate.js`.
+ */
+var $AnimateProvider = ['$provide', function($provide) {
+ var provider = this;
+
+ this.$$registeredAnimations = Object.create(null);
+
+ /**
+ * @ngdoc method
+ * @name $animateProvider#register
+ *
+ * @description
+ * Registers a new injectable animation factory function. The factory function produces the
+ * animation object which contains callback functions for each event that is expected to be
+ * animated.
+ *
+ * * `eventFn`: `function(element, ... , doneFunction, options)`
+ * The element to animate, the `doneFunction` and the options fed into the animation. Depending
+ * on the type of animation additional arguments will be injected into the animation function. The
+ * list below explains the function signatures for the different animation methods:
+ *
+ * - setClass: function(element, addedClasses, removedClasses, doneFunction, options)
+ * - addClass: function(element, addedClasses, doneFunction, options)
+ * - removeClass: function(element, removedClasses, doneFunction, options)
+ * - enter, leave, move: function(element, doneFunction, options)
+ * - animate: function(element, fromStyles, toStyles, doneFunction, options)
+ *
+ * Make sure to trigger the `doneFunction` once the animation is fully complete.
+ *
+ * ```js
+ * return {
+ * //enter, leave, move signature
+ * eventFn : function(element, done, options) {
+ * //code to run the animation
+ * //once complete, then run done()
+ * return function endFunction(wasCancelled) {
+ * //code to cancel the animation
+ * }
+ * }
+ * }
+ * ```
+ *
+ * @param {string} name The name of the animation (this is what the class-based CSS value will be compared to).
+ * @param {Function} factory The factory function that will be executed to return the animation
+ * object.
+ */
+ this.register = function(name, factory) {
+ if (name && name.charAt(0) !== '.') {
+ throw $animateMinErr('notcsel', "Expecting class selector starting with '.' got '{0}'.", name);
+ }
+
+ var key = name + '-animation';
+ provider.$$registeredAnimations[name.substr(1)] = key;
+ $provide.factory(key, factory);
+ };
+
+ /**
+ * @ngdoc method
+ * @name $animateProvider#classNameFilter
+ *
+ * @description
+ * Sets and/or returns the CSS class regular expression that is checked when performing
+ * an animation. Upon bootstrap the classNameFilter value is not set at all and will
+ * therefore enable $animate to attempt to perform an animation on any element that is triggered.
+ * When setting the `classNameFilter` value, animations will only be performed on elements
+ * that successfully match the filter expression. This in turn can boost performance
+ * for low-powered devices as well as applications containing a lot of structural operations.
+ * @param {RegExp=} expression The className expression which will be checked against all animations
+ * @return {RegExp} The current CSS className expression value. If null then there is no expression value
+ */
+ this.classNameFilter = function(expression) {
+ if (arguments.length === 1) {
+ this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;
+ if (this.$$classNameFilter) {
+ var reservedRegex = new RegExp("(\\s+|\\/)" + NG_ANIMATE_CLASSNAME + "(\\s+|\\/)");
+ if (reservedRegex.test(this.$$classNameFilter.toString())) {
+ throw $animateMinErr('nongcls','$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME);
+
+ }
+ }
+ }
+ return this.$$classNameFilter;
+ };
+
+ this.$get = ['$$animateQueue', function($$animateQueue) {
+ function domInsert(element, parentElement, afterElement) {
+ // if for some reason the previous element was removed
+ // from the dom sometime before this code runs then let's
+ // just stick to using the parent element as the anchor
+ if (afterElement) {
+ var afterNode = extractElementNode(afterElement);
+ if (afterNode && !afterNode.parentNode && !afterNode.previousElementSibling) {
+ afterElement = null;
+ }
+ }
+ afterElement ? afterElement.after(element) : parentElement.prepend(element);
+ }
+
+ /**
+ * @ngdoc service
+ * @name $animate
+ * @description The $animate service exposes a series of DOM utility methods that provide support
+ * for animation hooks. The default behavior is the application of DOM operations, however,
+ * when an animation is detected (and animations are enabled), $animate will do the heavy lifting
+ * to ensure that animation runs with the triggered DOM operation.
+ *
+ * By default $animate doesn't trigger any animations. This is because the `ngAnimate` module isn't
+ * included and only when it is active then the animation hooks that `$animate` triggers will be
+ * functional. Once active then all structural `ng-` directives will trigger animations as they perform
+ * their DOM-related operations (enter, leave and move). Other directives such as `ngClass`,
+ * `ngShow`, `ngHide` and `ngMessages` also provide support for animations.
+ *
+ * It is recommended that the`$animate` service is always used when executing DOM-related procedures within directives.
+ *
+ * To learn more about enabling animation support, click here to visit the
+ * {@link ngAnimate ngAnimate module page}.
+ */
+ return {
+ // we don't call it directly since non-existant arguments may
+ // be interpreted as null within the sub enabled function
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#on
+ * @kind function
+ * @description Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...)
+ * has fired on the given element or among any of its children. Once the listener is fired, the provided callback
+ * is fired with the following params:
+ *
+ * ```js
+ * $animate.on('enter', container,
+ * function callback(element, phase) {
+ * // cool we detected an enter animation within the container
+ * }
+ * );
+ * ```
+ *
+ * @param {string} event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...)
+ * @param {DOMElement} container the container element that will capture each of the animation events that are fired on itself
+ * as well as among its children
+ * @param {Function} callback the callback function that will be fired when the listener is triggered
+ *
+ * The arguments present in the callback function are:
+ * * `element` - The captured DOM element that the animation was fired on.
+ * * `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends).
+ */
+ on: $$animateQueue.on,
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#off
+ * @kind function
+ * @description Deregisters an event listener based on the event which has been associated with the provided element. This method
+ * can be used in three different ways depending on the arguments:
+ *
+ * ```js
+ * // remove all the animation event listeners listening for `enter`
+ * $animate.off('enter');
+ *
+ * // remove all the animation event listeners listening for `enter` on the given element and its children
+ * $animate.off('enter', container);
+ *
+ * // remove the event listener function provided by `callback` that is set
+ * // to listen for `enter` on the given `container` as well as its children
+ * $animate.off('enter', container, callback);
+ * ```
+ *
+ * @param {string} event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...)
+ * @param {DOMElement=} container the container element the event listener was placed on
+ * @param {Function=} callback the callback function that was registered as the listener
+ */
+ off: $$animateQueue.off,
+
+ /**
+ * @ngdoc method
+ * @name $animate#pin
+ * @kind function
+ * @description Associates the provided element with a host parent element to allow the element to be animated even if it exists
+ * outside of the DOM structure of the Angular application. By doing so, any animation triggered via `$animate` can be issued on the
+ * element despite being outside the realm of the application or within another application. Say for example if the application
+ * was bootstrapped on an element that is somewhere inside of the `<body>` tag, but we wanted to allow for an element to be situated
+ * as a direct child of `document.body`, then this can be achieved by pinning the element via `$animate.pin(element)`. Keep in mind
+ * that calling `$animate.pin(element, parentElement)` will not actually insert into the DOM anywhere; it will just create the association.
+ *
+ * Note that this feature is only active when the `ngAnimate` module is used.
+ *
+ * @param {DOMElement} element the external element that will be pinned
+ * @param {DOMElement} parentElement the host parent element that will be associated with the external element
+ */
+ pin: $$animateQueue.pin,
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#enabled
+ * @kind function
+ * @description Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This
+ * function can be called in four ways:
+ *
+ * ```js
+ * // returns true or false
+ * $animate.enabled();
+ *
+ * // changes the enabled state for all animations
+ * $animate.enabled(false);
+ * $animate.enabled(true);
+ *
+ * // returns true or false if animations are enabled for an element
+ * $animate.enabled(element);
+ *
+ * // changes the enabled state for an element and its children
+ * $animate.enabled(element, true);
+ * $animate.enabled(element, false);
+ * ```
+ *
+ * @param {DOMElement=} element the element that will be considered for checking/setting the enabled state
+ * @param {boolean=} enabled whether or not the animations will be enabled for the element
+ *
+ * @return {boolean} whether or not animations are enabled
+ */
+ enabled: $$animateQueue.enabled,
+
+ /**
+ * @ngdoc method
+ * @name $animate#cancel
+ * @kind function
+ * @description Cancels the provided animation.
+ *
+ * @param {Promise} animationPromise The animation promise that is returned when an animation is started.
+ */
+ cancel: function(runner) {
+ runner.end && runner.end();
+ },
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#enter
+ * @kind function
+ * @description Inserts the element into the DOM either after the `after` element (if provided) or
+ * as the first child within the `parent` element and then triggers an animation.
+ * A promise is returned that will be resolved during the next digest once the animation
+ * has completed.
+ *
+ * @param {DOMElement} element the element which will be inserted into the DOM
+ * @param {DOMElement} parent the parent element which will append the element as
+ * a child (so long as the after element is not present)
+ * @param {DOMElement=} after the sibling element after which the element will be appended
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ enter: function(element, parent, after, options) {
+ parent = parent && jqLite(parent);
+ after = after && jqLite(after);
+ parent = parent || after.parent();
+ domInsert(element, parent, after);
+ return $$animateQueue.push(element, 'enter', prepareAnimateOptions(options));
+ },
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#move
+ * @kind function
+ * @description Inserts (moves) the element into its new position in the DOM either after
+ * the `after` element (if provided) or as the first child within the `parent` element
+ * and then triggers an animation. A promise is returned that will be resolved
+ * during the next digest once the animation has completed.
+ *
+ * @param {DOMElement} element the element which will be moved into the new DOM position
+ * @param {DOMElement} parent the parent element which will append the element as
+ * a child (so long as the after element is not present)
+ * @param {DOMElement=} after the sibling element after which the element will be appended
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ move: function(element, parent, after, options) {
+ parent = parent && jqLite(parent);
+ after = after && jqLite(after);
+ parent = parent || after.parent();
+ domInsert(element, parent, after);
+ return $$animateQueue.push(element, 'move', prepareAnimateOptions(options));
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#leave
+ * @kind function
+ * @description Triggers an animation and then removes the element from the DOM.
+ * When the function is called a promise is returned that will be resolved during the next
+ * digest once the animation has completed.
+ *
+ * @param {DOMElement} element the element which will be removed from the DOM
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ leave: function(element, options) {
+ return $$animateQueue.push(element, 'leave', prepareAnimateOptions(options), function() {
+ element.remove();
+ });
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#addClass
+ * @kind function
+ *
+ * @description Triggers an addClass animation surrounding the addition of the provided CSS class(es). Upon
+ * execution, the addClass operation will only be handled after the next digest and it will not trigger an
+ * animation if element already contains the CSS class or if the class is removed at a later step.
+ * Note that class-based animations are treated differently compared to structural animations
+ * (like enter, move and leave) since the CSS classes may be added/removed at different points
+ * depending if CSS or JavaScript animations are used.
+ *
+ * @param {DOMElement} element the element which the CSS classes will be applied to
+ * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ addClass: function(element, className, options) {
+ options = prepareAnimateOptions(options);
+ options.addClass = mergeClasses(options.addclass, className);
+ return $$animateQueue.push(element, 'addClass', options);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#removeClass
+ * @kind function
+ *
+ * @description Triggers a removeClass animation surrounding the removal of the provided CSS class(es). Upon
+ * execution, the removeClass operation will only be handled after the next digest and it will not trigger an
+ * animation if element does not contain the CSS class or if the class is added at a later step.
+ * Note that class-based animations are treated differently compared to structural animations
+ * (like enter, move and leave) since the CSS classes may be added/removed at different points
+ * depending if CSS or JavaScript animations are used.
+ *
+ * @param {DOMElement} element the element which the CSS classes will be applied to
+ * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ removeClass: function(element, className, options) {
+ options = prepareAnimateOptions(options);
+ options.removeClass = mergeClasses(options.removeClass, className);
+ return $$animateQueue.push(element, 'removeClass', options);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#setClass
+ * @kind function
+ *
+ * @description Performs both the addition and removal of a CSS classes on an element and (during the process)
+ * triggers an animation surrounding the class addition/removal. Much like `$animate.addClass` and
+ * `$animate.removeClass`, `setClass` will only evaluate the classes being added/removed once a digest has
+ * passed. Note that class-based animations are treated differently compared to structural animations
+ * (like enter, move and leave) since the CSS classes may be added/removed at different points
+ * depending if CSS or JavaScript animations are used.
+ *
+ * @param {DOMElement} element the element which the CSS classes will be applied to
+ * @param {string} add the CSS class(es) that will be added (multiple classes are separated via spaces)
+ * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces)
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ setClass: function(element, add, remove, options) {
+ options = prepareAnimateOptions(options);
+ options.addClass = mergeClasses(options.addClass, add);
+ options.removeClass = mergeClasses(options.removeClass, remove);
+ return $$animateQueue.push(element, 'setClass', options);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#animate
+ * @kind function
+ *
+ * @description Performs an inline animation on the element which applies the provided to and from CSS styles to the element.
+ * If any detected CSS transition, keyframe or JavaScript matches the provided className value, then the animation will take
+ * on the provided styles. For example, if a transition animation is set for the given classNamem, then the provided `from` and
+ * `to` styles will be applied alongside the given transition. If the CSS style provided in `from` does not have a corresponding
+ * style in `to`, the style in `from` is applied immediately, and no animation is run.
+ * If a JavaScript animation is detected then the provided styles will be given in as function parameters into the `animate`
+ * method (or as part of the `options` parameter):
+ *
+ * ```js
+ * ngModule.animation('.my-inline-animation', function() {
+ * return {
+ * animate : function(element, from, to, done, options) {
+ * //animation
+ * done();
+ * }
+ * }
+ * });
+ * ```
+ *
+ * @param {DOMElement} element the element which the CSS styles will be applied to
+ * @param {object} from the from (starting) CSS styles that will be applied to the element and across the animation.
+ * @param {object} to the to (destination) CSS styles that will be applied to the element and across the animation.
+ * @param {string=} className an optional CSS class that will be applied to the element for the duration of the animation. If
+ * this value is left as empty then a CSS class of `ng-inline-animate` will be applied to the element.
+ * (Note that if no animation is detected then this value will not be applied to the element.)
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ animate: function(element, from, to, className, options) {
+ options = prepareAnimateOptions(options);
+ options.from = options.from ? extend(options.from, from) : from;
+ options.to = options.to ? extend(options.to, to) : to;
+
+ className = className || 'ng-inline-animate';
+ options.tempClasses = mergeClasses(options.tempClasses, className);
+ return $$animateQueue.push(element, 'animate', options);
+ }
+ };
+ }];
+}];
+
+var $$AnimateAsyncRunFactoryProvider = function() {
+ this.$get = ['$$rAF', function($$rAF) {
+ var waitQueue = [];
+
+ function waitForTick(fn) {
+ waitQueue.push(fn);
+ if (waitQueue.length > 1) return;
+ $$rAF(function() {
+ for (var i = 0; i < waitQueue.length; i++) {
+ waitQueue[i]();
+ }
+ waitQueue = [];
+ });
+ }
+
+ return function() {
+ var passed = false;
+ waitForTick(function() {
+ passed = true;
+ });
+ return function(callback) {
+ passed ? callback() : waitForTick(callback);
+ };
+ };
+ }];
+};
+
+var $$AnimateRunnerFactoryProvider = function() {
+ this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$document', '$timeout',
+ function($q, $sniffer, $$animateAsyncRun, $document, $timeout) {
+
+ var INITIAL_STATE = 0;
+ var DONE_PENDING_STATE = 1;
+ var DONE_COMPLETE_STATE = 2;
+
+ AnimateRunner.chain = function(chain, callback) {
+ var index = 0;
+
+ next();
+ function next() {
+ if (index === chain.length) {
+ callback(true);
+ return;
+ }
+
+ chain[index](function(response) {
+ if (response === false) {
+ callback(false);
+ return;
+ }
+ index++;
+ next();
+ });
+ }
+ };
+
+ AnimateRunner.all = function(runners, callback) {
+ var count = 0;
+ var status = true;
+ forEach(runners, function(runner) {
+ runner.done(onProgress);
+ });
+
+ function onProgress(response) {
+ status = status && response;
+ if (++count === runners.length) {
+ callback(status);
+ }
+ }
+ };
+
+ function AnimateRunner(host) {
+ this.setHost(host);
+
+ var rafTick = $$animateAsyncRun();
+ var timeoutTick = function(fn) {
+ $timeout(fn, 0, false);
+ };
+
+ this._doneCallbacks = [];
+ this._tick = function(fn) {
+ var doc = $document[0];
+
+ // the document may not be ready or attached
+ // to the module for some internal tests
+ if (doc && doc.hidden) {
+ timeoutTick(fn);
+ } else {
+ rafTick(fn);
+ }
+ };
+ this._state = 0;
+ }
+
+ AnimateRunner.prototype = {
+ setHost: function(host) {
+ this.host = host || {};
+ },
+
+ done: function(fn) {
+ if (this._state === DONE_COMPLETE_STATE) {
+ fn();
+ } else {
+ this._doneCallbacks.push(fn);
+ }
+ },
+
+ progress: noop,
+
+ getPromise: function() {
+ if (!this.promise) {
+ var self = this;
+ this.promise = $q(function(resolve, reject) {
+ self.done(function(status) {
+ status === false ? reject() : resolve();
+ });
+ });
+ }
+ return this.promise;
+ },
+
+ then: function(resolveHandler, rejectHandler) {
+ return this.getPromise().then(resolveHandler, rejectHandler);
+ },
+
+ 'catch': function(handler) {
+ return this.getPromise()['catch'](handler);
+ },
+
+ 'finally': function(handler) {
+ return this.getPromise()['finally'](handler);
+ },
+
+ pause: function() {
+ if (this.host.pause) {
+ this.host.pause();
+ }
+ },
+
+ resume: function() {
+ if (this.host.resume) {
+ this.host.resume();
+ }
+ },
+
+ end: function() {
+ if (this.host.end) {
+ this.host.end();
+ }
+ this._resolve(true);
+ },
+
+ cancel: function() {
+ if (this.host.cancel) {
+ this.host.cancel();
+ }
+ this._resolve(false);
+ },
+
+ complete: function(response) {
+ var self = this;
+ if (self._state === INITIAL_STATE) {
+ self._state = DONE_PENDING_STATE;
+ self._tick(function() {
+ self._resolve(response);
+ });
+ }
+ },
+
+ _resolve: function(response) {
+ if (this._state !== DONE_COMPLETE_STATE) {
+ forEach(this._doneCallbacks, function(fn) {
+ fn(response);
+ });
+ this._doneCallbacks.length = 0;
+ this._state = DONE_COMPLETE_STATE;
+ }
+ }
+ };
+
+ return AnimateRunner;
+ }];
+};
+
+/**
+ * @ngdoc service
+ * @name $animateCss
+ * @kind object
+ *
+ * @description
+ * This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included,
+ * then the `$animateCss` service will actually perform animations.
+ *
+ * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}.
+ */
+var $CoreAnimateCssProvider = function() {
+ this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) {
+
+ return function(element, initialOptions) {
+ // all of the animation functions should create
+ // a copy of the options data, however, if a
+ // parent service has already created a copy then
+ // we should stick to using that
+ var options = initialOptions || {};
+ if (!options.$$prepared) {
+ options = copy(options);
+ }
+
+ // there is no point in applying the styles since
+ // there is no animation that goes on at all in
+ // this version of $animateCss.
+ if (options.cleanupStyles) {
+ options.from = options.to = null;
+ }
+
+ if (options.from) {
+ element.css(options.from);
+ options.from = null;
+ }
+
+ /* jshint newcap: false */
+ var closed, runner = new $$AnimateRunner();
+ return {
+ start: run,
+ end: run
+ };
+
+ function run() {
+ $$rAF(function() {
+ applyAnimationContents();
+ if (!closed) {
+ runner.complete();
+ }
+ closed = true;
+ });
+ return runner;
+ }
+
+ function applyAnimationContents() {
+ if (options.addClass) {
+ element.addClass(options.addClass);
+ options.addClass = null;
+ }
+ if (options.removeClass) {
+ element.removeClass(options.removeClass);
+ options.removeClass = null;
+ }
+ if (options.to) {
+ element.css(options.to);
+ options.to = null;
+ }
+ }
+ };
+ }];
+};
+
+/* global stripHash: true */
+
+/**
+ * ! This is a private undocumented service !
+ *
+ * @name $browser
+ * @requires $log
+ * @description
+ * This object has two goals:
+ *
+ * - hide all the global state in the browser caused by the window object
+ * - abstract away all the browser specific features and inconsistencies
+ *
+ * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`
+ * service, which can be used for convenient testing of the application without the interaction with
+ * the real browser apis.
+ */
+/**
+ * @param {object} window The global window object.
+ * @param {object} document jQuery wrapped document.
+ * @param {object} $log window.console or an object with the same interface.
+ * @param {object} $sniffer $sniffer service
+ */
+function Browser(window, document, $log, $sniffer) {
+ var self = this,
+ rawDocument = document[0],
+ location = window.location,
+ history = window.history,
+ setTimeout = window.setTimeout,
+ clearTimeout = window.clearTimeout,
+ pendingDeferIds = {};
+
+ self.isMock = false;
+
+ var outstandingRequestCount = 0;
+ var outstandingRequestCallbacks = [];
+
+ // TODO(vojta): remove this temporary api
+ self.$$completeOutstandingRequest = completeOutstandingRequest;
+ self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };
+
+ /**
+ * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`
+ * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.
+ */
+ function completeOutstandingRequest(fn) {
+ try {
+ fn.apply(null, sliceArgs(arguments, 1));
+ } finally {
+ outstandingRequestCount--;
+ if (outstandingRequestCount === 0) {
+ while (outstandingRequestCallbacks.length) {
+ try {
+ outstandingRequestCallbacks.pop()();
+ } catch (e) {
+ $log.error(e);
+ }
+ }
+ }
+ }
+ }
+
+ function getHash(url) {
+ var index = url.indexOf('#');
+ return index === -1 ? '' : url.substr(index);
+ }
+
+ /**
+ * @private
+ * Note: this method is used only by scenario runner
+ * TODO(vojta): prefix this method with $$ ?
+ * @param {function()} callback Function that will be called when no outstanding request
+ */
+ self.notifyWhenNoOutstandingRequests = function(callback) {
+ if (outstandingRequestCount === 0) {
+ callback();
+ } else {
+ outstandingRequestCallbacks.push(callback);
+ }
+ };
+
+ //////////////////////////////////////////////////////////////
+ // URL API
+ //////////////////////////////////////////////////////////////
+
+ var cachedState, lastHistoryState,
+ lastBrowserUrl = location.href,
+ baseElement = document.find('base'),
+ pendingLocation = null;
+
+ cacheState();
+ lastHistoryState = cachedState;
+
+ /**
+ * @name $browser#url
+ *
+ * @description
+ * GETTER:
+ * Without any argument, this method just returns current value of location.href.
+ *
+ * SETTER:
+ * With at least one argument, this method sets url to new value.
+ * If html5 history api supported, pushState/replaceState is used, otherwise
+ * location.href/location.replace is used.
+ * Returns its own instance to allow chaining
+ *
+ * NOTE: this api is intended for use only by the $location service. Please use the
+ * {@link ng.$location $location service} to change url.
+ *
+ * @param {string} url New url (when used as setter)
+ * @param {boolean=} replace Should new url replace current history record?
+ * @param {object=} state object to use with pushState/replaceState
+ */
+ self.url = function(url, replace, state) {
+ // In modern browsers `history.state` is `null` by default; treating it separately
+ // from `undefined` would cause `$browser.url('/foo')` to change `history.state`
+ // to undefined via `pushState`. Instead, let's change `undefined` to `null` here.
+ if (isUndefined(state)) {
+ state = null;
+ }
+
+ // Android Browser BFCache causes location, history reference to become stale.
+ if (location !== window.location) location = window.location;
+ if (history !== window.history) history = window.history;
+
+ // setter
+ if (url) {
+ var sameState = lastHistoryState === state;
+
+ // Don't change anything if previous and current URLs and states match. This also prevents
+ // IE<10 from getting into redirect loop when in LocationHashbangInHtml5Url mode.
+ // See https://github.com/angular/angular.js/commit/ffb2701
+ if (lastBrowserUrl === url && (!$sniffer.history || sameState)) {
+ return self;
+ }
+ var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url);
+ lastBrowserUrl = url;
+ lastHistoryState = state;
+ // Don't use history API if only the hash changed
+ // due to a bug in IE10/IE11 which leads
+ // to not firing a `hashchange` nor `popstate` event
+ // in some cases (see #9143).
+ if ($sniffer.history && (!sameBase || !sameState)) {
+ history[replace ? 'replaceState' : 'pushState'](state, '', url);
+ cacheState();
+ // Do the assignment again so that those two variables are referentially identical.
+ lastHistoryState = cachedState;
+ } else {
+ if (!sameBase || pendingLocation) {
+ pendingLocation = url;
+ }
+ if (replace) {
+ location.replace(url);
+ } else if (!sameBase) {
+ location.href = url;
+ } else {
+ location.hash = getHash(url);
+ }
+ if (location.href !== url) {
+ pendingLocation = url;
+ }
+ }
+ return self;
+ // getter
+ } else {
+ // - pendingLocation is needed as browsers don't allow to read out
+ // the new location.href if a reload happened or if there is a bug like in iOS 9 (see
+ // https://openradar.appspot.com/22186109).
+ // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172
+ return pendingLocation || location.href.replace(/%27/g,"'");
+ }
+ };
+
+ /**
+ * @name $browser#state
+ *
+ * @description
+ * This method is a getter.
+ *
+ * Return history.state or null if history.state is undefined.
+ *
+ * @returns {object} state
+ */
+ self.state = function() {
+ return cachedState;
+ };
+
+ var urlChangeListeners = [],
+ urlChangeInit = false;
+
+ function cacheStateAndFireUrlChange() {
+ pendingLocation = null;
+ cacheState();
+ fireUrlChange();
+ }
+
+ function getCurrentState() {
+ try {
+ return history.state;
+ } catch (e) {
+ // MSIE can reportedly throw when there is no state (UNCONFIRMED).
+ }
+ }
+
+ // This variable should be used *only* inside the cacheState function.
+ var lastCachedState = null;
+ function cacheState() {
+ // This should be the only place in $browser where `history.state` is read.
+ cachedState = getCurrentState();
+ cachedState = isUndefined(cachedState) ? null : cachedState;
+
+ // Prevent callbacks fo fire twice if both hashchange & popstate were fired.
+ if (equals(cachedState, lastCachedState)) {
+ cachedState = lastCachedState;
+ }
+ lastCachedState = cachedState;
+ }
+
+ function fireUrlChange() {
+ if (lastBrowserUrl === self.url() && lastHistoryState === cachedState) {
+ return;
+ }
+
+ lastBrowserUrl = self.url();
+ lastHistoryState = cachedState;
+ forEach(urlChangeListeners, function(listener) {
+ listener(self.url(), cachedState);
+ });
+ }
+
+ /**
+ * @name $browser#onUrlChange
+ *
+ * @description
+ * Register callback function that will be called, when url changes.
+ *
+ * It's only called when the url is changed from outside of angular:
+ * - user types different url into address bar
+ * - user clicks on history (forward/back) button
+ * - user clicks on a link
+ *
+ * It's not called when url is changed by $browser.url() method
+ *
+ * The listener gets called with new url as parameter.
+ *
+ * NOTE: this api is intended for use only by the $location service. Please use the
+ * {@link ng.$location $location service} to monitor url changes in angular apps.
+ *
+ * @param {function(string)} listener Listener function to be called when url changes.
+ * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.
+ */
+ self.onUrlChange = function(callback) {
+ // TODO(vojta): refactor to use node's syntax for events
+ if (!urlChangeInit) {
+ // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)
+ // don't fire popstate when user change the address bar and don't fire hashchange when url
+ // changed by push/replaceState
+
+ // html5 history api - popstate event
+ if ($sniffer.history) jqLite(window).on('popstate', cacheStateAndFireUrlChange);
+ // hashchange event
+ jqLite(window).on('hashchange', cacheStateAndFireUrlChange);
+
+ urlChangeInit = true;
+ }
+
+ urlChangeListeners.push(callback);
+ return callback;
+ };
+
+ /**
+ * @private
+ * Remove popstate and hashchange handler from window.
+ *
+ * NOTE: this api is intended for use only by $rootScope.
+ */
+ self.$$applicationDestroyed = function() {
+ jqLite(window).off('hashchange popstate', cacheStateAndFireUrlChange);
+ };
+
+ /**
+ * Checks whether the url has changed outside of Angular.
+ * Needs to be exported to be able to check for changes that have been done in sync,
+ * as hashchange/popstate events fire in async.
+ */
+ self.$$checkUrlChange = fireUrlChange;
+
+ //////////////////////////////////////////////////////////////
+ // Misc API
+ //////////////////////////////////////////////////////////////
+
+ /**
+ * @name $browser#baseHref
+ *
+ * @description
+ * Returns current <base href>
+ * (always relative - without domain)
+ *
+ * @returns {string} The current base href
+ */
+ self.baseHref = function() {
+ var href = baseElement.attr('href');
+ return href ? href.replace(/^(https?\:)?\/\/[^\/]*/, '') : '';
+ };
+
+ /**
+ * @name $browser#defer
+ * @param {function()} fn A function, who's execution should be deferred.
+ * @param {number=} [delay=0] of milliseconds to defer the function execution.
+ * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.
+ *
+ * @description
+ * Executes a fn asynchronously via `setTimeout(fn, delay)`.
+ *
+ * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using
+ * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed
+ * via `$browser.defer.flush()`.
+ *
+ */
+ self.defer = function(fn, delay) {
+ var timeoutId;
+ outstandingRequestCount++;
+ timeoutId = setTimeout(function() {
+ delete pendingDeferIds[timeoutId];
+ completeOutstandingRequest(fn);
+ }, delay || 0);
+ pendingDeferIds[timeoutId] = true;
+ return timeoutId;
+ };
+
+
+ /**
+ * @name $browser#defer.cancel
+ *
+ * @description
+ * Cancels a deferred task identified with `deferId`.
+ *
+ * @param {*} deferId Token returned by the `$browser.defer` function.
+ * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
+ * canceled.
+ */
+ self.defer.cancel = function(deferId) {
+ if (pendingDeferIds[deferId]) {
+ delete pendingDeferIds[deferId];
+ clearTimeout(deferId);
+ completeOutstandingRequest(noop);
+ return true;
+ }
+ return false;
+ };
+
+}
+
+function $BrowserProvider() {
+ this.$get = ['$window', '$log', '$sniffer', '$document',
+ function($window, $log, $sniffer, $document) {
+ return new Browser($window, $document, $log, $sniffer);
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $cacheFactory
+ *
+ * @description
+ * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to
+ * them.
+ *
+ * ```js
+ *
+ * var cache = $cacheFactory('cacheId');
+ * expect($cacheFactory.get('cacheId')).toBe(cache);
+ * expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
+ *
+ * cache.put("key", "value");
+ * cache.put("another key", "another value");
+ *
+ * // We've specified no options on creation
+ * expect(cache.info()).toEqual({id: 'cacheId', size: 2});
+ *
+ * ```
+ *
+ *
+ * @param {string} cacheId Name or id of the newly created cache.
+ * @param {object=} options Options object that specifies the cache behavior. Properties:
+ *
+ * - `{number=}` `capacity` — turns the cache into LRU cache.
+ *
+ * @returns {object} Newly created cache object with the following set of methods:
+ *
+ * - `{object}` `info()` — Returns id, size, and options of cache.
+ * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns
+ * it.
+ * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.
+ * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.
+ * - `{void}` `removeAll()` — Removes all cached values.
+ * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.
+ *
+ * @example
+ <example module="cacheExampleApp">
+ <file name="index.html">
+ <div ng-controller="CacheController">
+ <input ng-model="newCacheKey" placeholder="Key">
+ <input ng-model="newCacheValue" placeholder="Value">
+ <button ng-click="put(newCacheKey, newCacheValue)">Cache</button>
+
+ <p ng-if="keys.length">Cached Values</p>
+ <div ng-repeat="key in keys">
+ <span ng-bind="key"></span>
+ <span>: </span>
+ <b ng-bind="cache.get(key)"></b>
+ </div>
+
+ <p>Cache Info</p>
+ <div ng-repeat="(key, value) in cache.info()">
+ <span ng-bind="key"></span>
+ <span>: </span>
+ <b ng-bind="value"></b>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('cacheExampleApp', []).
+ controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {
+ $scope.keys = [];
+ $scope.cache = $cacheFactory('cacheId');
+ $scope.put = function(key, value) {
+ if (angular.isUndefined($scope.cache.get(key))) {
+ $scope.keys.push(key);
+ }
+ $scope.cache.put(key, angular.isUndefined(value) ? null : value);
+ };
+ }]);
+ </file>
+ <file name="style.css">
+ p {
+ margin: 10px 0 3px;
+ }
+ </file>
+ </example>
+ */
+function $CacheFactoryProvider() {
+
+ this.$get = function() {
+ var caches = {};
+
+ function cacheFactory(cacheId, options) {
+ if (cacheId in caches) {
+ throw minErr('$cacheFactory')('iid', "CacheId '{0}' is already taken!", cacheId);
+ }
+
+ var size = 0,
+ stats = extend({}, options, {id: cacheId}),
+ data = createMap(),
+ capacity = (options && options.capacity) || Number.MAX_VALUE,
+ lruHash = createMap(),
+ freshEnd = null,
+ staleEnd = null;
+
+ /**
+ * @ngdoc type
+ * @name $cacheFactory.Cache
+ *
+ * @description
+ * A cache object used to store and retrieve data, primarily used by
+ * {@link $http $http} and the {@link ng.directive:script script} directive to cache
+ * templates and other data.
+ *
+ * ```js
+ * angular.module('superCache')
+ * .factory('superCache', ['$cacheFactory', function($cacheFactory) {
+ * return $cacheFactory('super-cache');
+ * }]);
+ * ```
+ *
+ * Example test:
+ *
+ * ```js
+ * it('should behave like a cache', inject(function(superCache) {
+ * superCache.put('key', 'value');
+ * superCache.put('another key', 'another value');
+ *
+ * expect(superCache.info()).toEqual({
+ * id: 'super-cache',
+ * size: 2
+ * });
+ *
+ * superCache.remove('another key');
+ * expect(superCache.get('another key')).toBeUndefined();
+ *
+ * superCache.removeAll();
+ * expect(superCache.info()).toEqual({
+ * id: 'super-cache',
+ * size: 0
+ * });
+ * }));
+ * ```
+ */
+ return caches[cacheId] = {
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#put
+ * @kind function
+ *
+ * @description
+ * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be
+ * retrieved later, and incrementing the size of the cache if the key was not already
+ * present in the cache. If behaving like an LRU cache, it will also remove stale
+ * entries from the set.
+ *
+ * It will not insert undefined values into the cache.
+ *
+ * @param {string} key the key under which the cached data is stored.
+ * @param {*} value the value to store alongside the key. If it is undefined, the key
+ * will not be stored.
+ * @returns {*} the value stored.
+ */
+ put: function(key, value) {
+ if (isUndefined(value)) return;
+ if (capacity < Number.MAX_VALUE) {
+ var lruEntry = lruHash[key] || (lruHash[key] = {key: key});
+
+ refresh(lruEntry);
+ }
+
+ if (!(key in data)) size++;
+ data[key] = value;
+
+ if (size > capacity) {
+ this.remove(staleEnd.key);
+ }
+
+ return value;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#get
+ * @kind function
+ *
+ * @description
+ * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object.
+ *
+ * @param {string} key the key of the data to be retrieved
+ * @returns {*} the value stored.
+ */
+ get: function(key) {
+ if (capacity < Number.MAX_VALUE) {
+ var lruEntry = lruHash[key];
+
+ if (!lruEntry) return;
+
+ refresh(lruEntry);
+ }
+
+ return data[key];
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#remove
+ * @kind function
+ *
+ * @description
+ * Removes an entry from the {@link $cacheFactory.Cache Cache} object.
+ *
+ * @param {string} key the key of the entry to be removed
+ */
+ remove: function(key) {
+ if (capacity < Number.MAX_VALUE) {
+ var lruEntry = lruHash[key];
+
+ if (!lruEntry) return;
+
+ if (lruEntry == freshEnd) freshEnd = lruEntry.p;
+ if (lruEntry == staleEnd) staleEnd = lruEntry.n;
+ link(lruEntry.n,lruEntry.p);
+
+ delete lruHash[key];
+ }
+
+ if (!(key in data)) return;
+
+ delete data[key];
+ size--;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#removeAll
+ * @kind function
+ *
+ * @description
+ * Clears the cache object of any entries.
+ */
+ removeAll: function() {
+ data = createMap();
+ size = 0;
+ lruHash = createMap();
+ freshEnd = staleEnd = null;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#destroy
+ * @kind function
+ *
+ * @description
+ * Destroys the {@link $cacheFactory.Cache Cache} object entirely,
+ * removing it from the {@link $cacheFactory $cacheFactory} set.
+ */
+ destroy: function() {
+ data = null;
+ stats = null;
+ lruHash = null;
+ delete caches[cacheId];
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#info
+ * @kind function
+ *
+ * @description
+ * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}.
+ *
+ * @returns {object} an object with the following properties:
+ * <ul>
+ * <li>**id**: the id of the cache instance</li>
+ * <li>**size**: the number of entries kept in the cache instance</li>
+ * <li>**...**: any additional properties from the options object when creating the
+ * cache.</li>
+ * </ul>
+ */
+ info: function() {
+ return extend({}, stats, {size: size});
+ }
+ };
+
+
+ /**
+ * makes the `entry` the freshEnd of the LRU linked list
+ */
+ function refresh(entry) {
+ if (entry != freshEnd) {
+ if (!staleEnd) {
+ staleEnd = entry;
+ } else if (staleEnd == entry) {
+ staleEnd = entry.n;
+ }
+
+ link(entry.n, entry.p);
+ link(entry, freshEnd);
+ freshEnd = entry;
+ freshEnd.n = null;
+ }
+ }
+
+
+ /**
+ * bidirectionally links two entries of the LRU linked list
+ */
+ function link(nextEntry, prevEntry) {
+ if (nextEntry != prevEntry) {
+ if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify
+ if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify
+ }
+ }
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory#info
+ *
+ * @description
+ * Get information about all the caches that have been created
+ *
+ * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info`
+ */
+ cacheFactory.info = function() {
+ var info = {};
+ forEach(caches, function(cache, cacheId) {
+ info[cacheId] = cache.info();
+ });
+ return info;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory#get
+ *
+ * @description
+ * Get access to a cache object by the `cacheId` used when it was created.
+ *
+ * @param {string} cacheId Name or id of a cache to access.
+ * @returns {object} Cache object identified by the cacheId or undefined if no such cache.
+ */
+ cacheFactory.get = function(cacheId) {
+ return caches[cacheId];
+ };
+
+
+ return cacheFactory;
+ };
+}
+
+/**
+ * @ngdoc service
+ * @name $templateCache
+ *
+ * @description
+ * The first time a template is used, it is loaded in the template cache for quick retrieval. You
+ * can load templates directly into the cache in a `script` tag, or by consuming the
+ * `$templateCache` service directly.
+ *
+ * Adding via the `script` tag:
+ *
+ * ```html
+ * <script type="text/ng-template" id="templateId.html">
+ * <p>This is the content of the template</p>
+ * </script>
+ * ```
+ *
+ * **Note:** the `script` tag containing the template does not need to be included in the `head` of
+ * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (IE,
+ * element with ng-app attribute), otherwise the template will be ignored.
+ *
+ * Adding via the `$templateCache` service:
+ *
+ * ```js
+ * var myApp = angular.module('myApp', []);
+ * myApp.run(function($templateCache) {
+ * $templateCache.put('templateId.html', 'This is the content of the template');
+ * });
+ * ```
+ *
+ * To retrieve the template later, simply use it in your HTML:
+ * ```html
+ * <div ng-include=" 'templateId.html' "></div>
+ * ```
+ *
+ * or get it via Javascript:
+ * ```js
+ * $templateCache.get('templateId.html')
+ * ```
+ *
+ * See {@link ng.$cacheFactory $cacheFactory}.
+ *
+ */
+function $TemplateCacheProvider() {
+ this.$get = ['$cacheFactory', function($cacheFactory) {
+ return $cacheFactory('templates');
+ }];
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!
+ *
+ * DOM-related variables:
+ *
+ * - "node" - DOM Node
+ * - "element" - DOM Element or Node
+ * - "$node" or "$element" - jqLite-wrapped node or element
+ *
+ *
+ * Compiler related stuff:
+ *
+ * - "linkFn" - linking fn of a single directive
+ * - "nodeLinkFn" - function that aggregates all linking fns for a particular node
+ * - "childLinkFn" - function that aggregates all linking fns for child nodes of a particular node
+ * - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList)
+ */
+
+
+/**
+ * @ngdoc service
+ * @name $compile
+ * @kind function
+ *
+ * @description
+ * Compiles an HTML string or DOM into a template and produces a template function, which
+ * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together.
+ *
+ * The compilation is a process of walking the DOM tree and matching DOM elements to
+ * {@link ng.$compileProvider#directive directives}.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** This document is an in-depth reference of all directive options.
+ * For a gentle introduction to directives with examples of common use cases,
+ * see the {@link guide/directive directive guide}.
+ * </div>
+ *
+ * ## Comprehensive Directive API
+ *
+ * There are many different options for a directive.
+ *
+ * The difference resides in the return value of the factory function.
+ * You can either return a "Directive Definition Object" (see below) that defines the directive properties,
+ * or just the `postLink` function (all other properties will have the default values).
+ *
+ * <div class="alert alert-success">
+ * **Best Practice:** It's recommended to use the "directive definition object" form.
+ * </div>
+ *
+ * Here's an example directive declared with a Directive Definition Object:
+ *
+ * ```js
+ * var myModule = angular.module(...);
+ *
+ * myModule.directive('directiveName', function factory(injectables) {
+ * var directiveDefinitionObject = {
+ * priority: 0,
+ * template: '<div></div>', // or // function(tElement, tAttrs) { ... },
+ * // or
+ * // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... },
+ * transclude: false,
+ * restrict: 'A',
+ * templateNamespace: 'html',
+ * scope: false,
+ * controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },
+ * controllerAs: 'stringIdentifier',
+ * bindToController: false,
+ * require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],
+ * compile: function compile(tElement, tAttrs, transclude) {
+ * return {
+ * pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ * post: function postLink(scope, iElement, iAttrs, controller) { ... }
+ * }
+ * // or
+ * // return function postLink( ... ) { ... }
+ * },
+ * // or
+ * // link: {
+ * // pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ * // post: function postLink(scope, iElement, iAttrs, controller) { ... }
+ * // }
+ * // or
+ * // link: function postLink( ... ) { ... }
+ * };
+ * return directiveDefinitionObject;
+ * });
+ * ```
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Any unspecified options will use the default value. You can see the default values below.
+ * </div>
+ *
+ * Therefore the above can be simplified as:
+ *
+ * ```js
+ * var myModule = angular.module(...);
+ *
+ * myModule.directive('directiveName', function factory(injectables) {
+ * var directiveDefinitionObject = {
+ * link: function postLink(scope, iElement, iAttrs) { ... }
+ * };
+ * return directiveDefinitionObject;
+ * // or
+ * // return function postLink(scope, iElement, iAttrs) { ... }
+ * });
+ * ```
+ *
+ *
+ *
+ * ### Directive Definition Object
+ *
+ * The directive definition object provides instructions to the {@link ng.$compile
+ * compiler}. The attributes are:
+ *
+ * #### `multiElement`
+ * When this property is set to true, the HTML compiler will collect DOM nodes between
+ * nodes with the attributes `directive-name-start` and `directive-name-end`, and group them
+ * together as the directive elements. It is recommended that this feature be used on directives
+ * which are not strictly behavioral (such as {@link ngClick}), and which
+ * do not manipulate or replace child nodes (such as {@link ngInclude}).
+ *
+ * #### `priority`
+ * When there are multiple directives defined on a single DOM element, sometimes it
+ * is necessary to specify the order in which the directives are applied. The `priority` is used
+ * to sort the directives before their `compile` functions get called. Priority is defined as a
+ * number. Directives with greater numerical `priority` are compiled first. Pre-link functions
+ * are also run in priority order, but post-link functions are run in reverse order. The order
+ * of directives with the same priority is undefined. The default priority is `0`.
+ *
+ * #### `terminal`
+ * If set to true then the current `priority` will be the last set of directives
+ * which will execute (any directives at the current priority will still execute
+ * as the order of execution on same `priority` is undefined). Note that expressions
+ * and other directives used in the directive's template will also be excluded from execution.
+ *
+ * #### `scope`
+ * The scope property can be `true`, an object or a falsy value:
+ *
+ * * **falsy:** No scope will be created for the directive. The directive will use its parent's scope.
+ *
+ * * **`true`:** A new child scope that prototypically inherits from its parent will be created for
+ * the directive's element. If multiple directives on the same element request a new scope,
+ * only one new scope is created. The new scope rule does not apply for the root of the template
+ * since the root of the template always gets a new scope.
+ *
+ * * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's element. The
+ * 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent
+ * scope. This is useful when creating reusable components, which should not accidentally read or modify
+ * data in the parent scope.
+ *
+ * The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the
+ * directive's element. These local properties are useful for aliasing values for templates. The keys in
+ * the object hash map to the name of the property on the isolate scope; the values define how the property
+ * is bound to the parent scope, via matching attributes on the directive's element:
+ *
+ * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is
+ * always a string since DOM attributes are strings. If no `attr` name is specified then the
+ * attribute name is assumed to be the same as the local name. Given `<my-component
+ * my-attr="hello {{name}}">` and the isolate scope definition `scope: { localName:'@myAttr' }`,
+ * the directive's scope property `localName` will reflect the interpolated value of `hello
+ * {{name}}`. As the `name` attribute changes so will the `localName` property on the directive's
+ * scope. The `name` is read from the parent scope (not the directive's scope).
+ *
+ * * `=` or `=attr` - set up a bidirectional binding between a local scope property and an expression
+ * passed via the attribute `attr`. The expression is evaluated in the context of the parent scope.
+ * If no `attr` name is specified then the attribute name is assumed to be the same as the local
+ * name. Given `<my-component my-attr="parentModel">` and the isolate scope definition `scope: {
+ * localModel: '=myAttr' }`, the property `localModel` on the directive's scope will reflect the
+ * value of `parentModel` on the parent scope. Changes to `parentModel` will be reflected in
+ * `localModel` and vice versa. Optional attributes should be marked as such with a question mark:
+ * `=?` or `=?attr`. If the binding expression is non-assignable, or if the attribute isn't
+ * optional and doesn't exist, an exception ({@link error/$compile/nonassign `$compile:nonassign`})
+ * will be thrown upon discovering changes to the local value, since it will be impossible to sync
+ * them back to the parent scope. By default, the {@link ng.$rootScope.Scope#$watch `$watch`}
+ * method is used for tracking changes, and the equality check is based on object identity.
+ * However, if an object literal or an array literal is passed as the binding expression, the
+ * equality check is done by value (using the {@link angular.equals} function). It's also possible
+ * to watch the evaluated value shallowly with {@link ng.$rootScope.Scope#$watchCollection
+ * `$watchCollection`}: use `=*` or `=*attr` (`=*?` or `=*?attr` if the attribute is optional).
+ *
+ * * `<` or `<attr` - set up a one-way (one-directional) binding between a local scope property and an
+ * expression passed via the attribute `attr`. The expression is evaluated in the context of the
+ * parent scope. If no `attr` name is specified then the attribute name is assumed to be the same as the
+ * local name. You can also make the binding optional by adding `?`: `<?` or `<?attr`.
+ *
+ * For example, given `<my-component my-attr="parentModel">` and directive definition of
+ * `scope: { localModel:'<myAttr' }`, then the isolated scope property `localModel` will reflect the
+ * value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected
+ * in `localModel`, but changes in `localModel` will not reflect in `parentModel`. There are however
+ * two caveats:
+ * 1. one-way binding does not copy the value from the parent to the isolate scope, it simply
+ * sets the same value. That means if your bound value is an object, changes to its properties
+ * in the isolated scope will be reflected in the parent scope (because both reference the same object).
+ * 2. one-way binding watches changes to the **identity** of the parent value. That means the
+ * {@link ng.$rootScope.Scope#$watch `$watch`} on the parent value only fires if the reference
+ * to the value has changed. In most cases, this should not be of concern, but can be important
+ * to know if you one-way bind to an object, and then replace that object in the isolated scope.
+ * If you now change a property of the object in your parent scope, the change will not be
+ * propagated to the isolated scope, because the identity of the object on the parent scope
+ * has not changed. Instead you must assign a new object.
+ *
+ * One-way binding is useful if you do not plan to propagate changes to your isolated scope bindings
+ * back to the parent. However, it does not make this completely impossible.
+ *
+ * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope. If
+ * no `attr` name is specified then the attribute name is assumed to be the same as the local name.
+ * Given `<my-component my-attr="count = count + value">` and the isolate scope definition `scope: {
+ * localFn:'&myAttr' }`, the isolate scope property `localFn` will point to a function wrapper for
+ * the `count = count + value` expression. Often it's desirable to pass data from the isolated scope
+ * via an expression to the parent scope. This can be done by passing a map of local variable names
+ * and values into the expression wrapper fn. For example, if the expression is `increment(amount)`
+ * then we can specify the amount value by calling the `localFn` as `localFn({amount: 22})`.
+ *
+ * In general it's possible to apply more than one directive to one element, but there might be limitations
+ * depending on the type of scope required by the directives. The following points will help explain these limitations.
+ * For simplicity only two directives are taken into account, but it is also applicable for several directives:
+ *
+ * * **no scope** + **no scope** => Two directives which don't require their own scope will use their parent's scope
+ * * **child scope** + **no scope** => Both directives will share one single child scope
+ * * **child scope** + **child scope** => Both directives will share one single child scope
+ * * **isolated scope** + **no scope** => The isolated directive will use it's own created isolated scope. The other directive will use
+ * its parent's scope
+ * * **isolated scope** + **child scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives cannot
+ * be applied to the same element.
+ * * **isolated scope** + **isolated scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives
+ * cannot be applied to the same element.
+ *
+ *
+ * #### `bindToController`
+ * This property is used to bind scope properties directly to the controller. It can be either
+ * `true` or an object hash with the same format as the `scope` property. Additionally, a controller
+ * alias must be set, either by using `controllerAs: 'myAlias'` or by specifying the alias in the controller
+ * definition: `controller: 'myCtrl as myAlias'`.
+ *
+ * When an isolate scope is used for a directive (see above), `bindToController: true` will
+ * allow a component to have its properties bound to the controller, rather than to scope.
+ *
+ * After the controller is instantiated, the initial values of the isolate scope bindings will be bound to the controller
+ * properties. You can access these bindings once they have been initialized by providing a controller method called
+ * `$onInit`, which is called after all the controllers on an element have been constructed and had their bindings
+ * initialized.
+ *
+ * <div class="alert alert-warning">
+ * **Deprecation warning:** although bindings for non-ES6 class controllers are currently
+ * bound to `this` before the controller constructor is called, this use is now deprecated. Please place initialization
+ * code that relies upon bindings inside a `$onInit` method on the controller, instead.
+ * </div>
+ *
+ * It is also possible to set `bindToController` to an object hash with the same format as the `scope` property.
+ * This will set up the scope bindings to the controller directly. Note that `scope` can still be used
+ * to define which kind of scope is created. By default, no scope is created. Use `scope: {}` to create an isolate
+ * scope (useful for component directives).
+ *
+ * If both `bindToController` and `scope` are defined and have object hashes, `bindToController` overrides `scope`.
+ *
+ *
+ * #### `controller`
+ * Controller constructor function. The controller is instantiated before the
+ * pre-linking phase and can be accessed by other directives (see
+ * `require` attribute). This allows the directives to communicate with each other and augment
+ * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals:
+ *
+ * * `$scope` - Current scope associated with the element
+ * * `$element` - Current element
+ * * `$attrs` - Current attributes object for the element
+ * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope:
+ * `function([scope], cloneLinkingFn, futureParentElement, slotName)`:
+ * * `scope`: (optional) override the scope.
+ * * `cloneLinkingFn`: (optional) argument to create clones of the original transcluded content.
+ * * `futureParentElement` (optional):
+ * * defines the parent to which the `cloneLinkingFn` will add the cloned elements.
+ * * default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`.
+ * * only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements)
+ * and when the `cloneLinkinFn` is passed,
+ * as those elements need to created and cloned in a special way when they are defined outside their
+ * usual containers (e.g. like `<svg>`).
+ * * See also the `directive.templateNamespace` property.
+ * * `slotName`: (optional) the name of the slot to transclude. If falsy (e.g. `null`, `undefined` or `''`)
+ * then the default translusion is provided.
+ * The `$transclude` function also has a method on it, `$transclude.isSlotFilled(slotName)`, which returns
+ * `true` if the specified slot contains content (i.e. one or more DOM nodes).
+ *
+ * The controller can provide the following methods that act as life-cycle hooks:
+ * * `$onInit` - Called on each controller after all the controllers on an element have been constructed and
+ * had their bindings initialized (and before the pre &amp; post linking functions for the directives on
+ * this element). This is a good place to put initialization code for your controller.
+ *
+ * #### `require`
+ * Require another directive and inject its controller as the fourth argument to the linking function. The
+ * `require` property can be a string, an array or an object:
+ * * a **string** containing the name of the directive to pass to the linking function
+ * * an **array** containing the names of directives to pass to the linking function. The argument passed to the
+ * linking function will be an array of controllers in the same order as the names in the `require` property
+ * * an **object** whose property values are the names of the directives to pass to the linking function. The argument
+ * passed to the linking function will also be an object with matching keys, whose values will hold the corresponding
+ * controllers.
+ *
+ * If the `require` property is an object and `bindToController` is truthy, then the required controllers are
+ * bound to the controller using the keys of the `require` property. This binding occurs after all the controllers
+ * have been constructed but before `$onInit` is called.
+ * See the {@link $compileProvider#component} helper for an example of how this can be used.
+ *
+ * If no such required directive(s) can be found, or if the directive does not have a controller, then an error is
+ * raised (unless no link function is specified and the required controllers are not being bound to the directive
+ * controller, in which case error checking is skipped). The name can be prefixed with:
+ *
+ * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.
+ * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.
+ * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found.
+ * * `^^` - Locate the required controller by searching the element's parents. Throw an error if not found.
+ * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass
+ * `null` to the `link` fn if not found.
+ * * `?^^` - Attempt to locate the required controller by searching the element's parents, or pass
+ * `null` to the `link` fn if not found.
+ *
+ *
+ * #### `controllerAs`
+ * Identifier name for a reference to the controller in the directive's scope.
+ * This allows the controller to be referenced from the directive template. This is especially
+ * useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible
+ * to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the
+ * `controllerAs` reference might overwrite a property that already exists on the parent scope.
+ *
+ *
+ * #### `restrict`
+ * String of subset of `EACM` which restricts the directive to a specific directive
+ * declaration style. If omitted, the defaults (elements and attributes) are used.
+ *
+ * * `E` - Element name (default): `<my-directive></my-directive>`
+ * * `A` - Attribute (default): `<div my-directive="exp"></div>`
+ * * `C` - Class: `<div class="my-directive: exp;"></div>`
+ * * `M` - Comment: `<!-- directive: my-directive exp -->`
+ *
+ *
+ * #### `templateNamespace`
+ * String representing the document type used by the markup in the template.
+ * AngularJS needs this information as those elements need to be created and cloned
+ * in a special way when they are defined outside their usual containers like `<svg>` and `<math>`.
+ *
+ * * `html` - All root nodes in the template are HTML. Root nodes may also be
+ * top-level elements such as `<svg>` or `<math>`.
+ * * `svg` - The root nodes in the template are SVG elements (excluding `<math>`).
+ * * `math` - The root nodes in the template are MathML elements (excluding `<svg>`).
+ *
+ * If no `templateNamespace` is specified, then the namespace is considered to be `html`.
+ *
+ * #### `template`
+ * HTML markup that may:
+ * * Replace the contents of the directive's element (default).
+ * * Replace the directive's element itself (if `replace` is true - DEPRECATED).
+ * * Wrap the contents of the directive's element (if `transclude` is true).
+ *
+ * Value may be:
+ *
+ * * A string. For example `<div red-on-hover>{{delete_str}}</div>`.
+ * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile`
+ * function api below) and returns a string value.
+ *
+ *
+ * #### `templateUrl`
+ * This is similar to `template` but the template is loaded from the specified URL, asynchronously.
+ *
+ * Because template loading is asynchronous the compiler will suspend compilation of directives on that element
+ * for later when the template has been resolved. In the meantime it will continue to compile and link
+ * sibling and parent elements as though this element had not contained any directives.
+ *
+ * The compiler does not suspend the entire compilation to wait for templates to be loaded because this
+ * would result in the whole app "stalling" until all templates are loaded asynchronously - even in the
+ * case when only one deeply nested directive has `templateUrl`.
+ *
+ * Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}
+ *
+ * You can specify `templateUrl` as a string representing the URL or as a function which takes two
+ * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns
+ * a string value representing the url. In either case, the template URL is passed through {@link
+ * $sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}.
+ *
+ *
+ * #### `replace` ([*DEPRECATED*!], will be removed in next major release - i.e. v2.0)
+ * specify what the template should replace. Defaults to `false`.
+ *
+ * * `true` - the template will replace the directive's element.
+ * * `false` - the template will replace the contents of the directive's element.
+ *
+ * The replacement process migrates all of the attributes / classes from the old element to the new
+ * one. See the {@link guide/directive#template-expanding-directive
+ * Directives Guide} for an example.
+ *
+ * There are very few scenarios where element replacement is required for the application function,
+ * the main one being reusable custom components that are used within SVG contexts
+ * (because SVG doesn't work with custom elements in the DOM tree).
+ *
+ * #### `transclude`
+ * Extract the contents of the element where the directive appears and make it available to the directive.
+ * The contents are compiled and provided to the directive as a **transclusion function**. See the
+ * {@link $compile#transclusion Transclusion} section below.
+ *
+ *
+ * #### `compile`
+ *
+ * ```js
+ * function compile(tElement, tAttrs, transclude) { ... }
+ * ```
+ *
+ * The compile function deals with transforming the template DOM. Since most directives do not do
+ * template transformation, it is not used often. The compile function takes the following arguments:
+ *
+ * * `tElement` - template element - The element where the directive has been declared. It is
+ * safe to do template transformation on the element and child elements only.
+ *
+ * * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared
+ * between all directive compile functions.
+ *
+ * * `transclude` - [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`
+ *
+ * <div class="alert alert-warning">
+ * **Note:** The template instance and the link instance may be different objects if the template has
+ * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that
+ * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration
+ * should be done in a linking function rather than in a compile function.
+ * </div>
+
+ * <div class="alert alert-warning">
+ * **Note:** The compile function cannot handle directives that recursively use themselves in their
+ * own templates or compile functions. Compiling these directives results in an infinite loop and
+ * stack overflow errors.
+ *
+ * This can be avoided by manually using $compile in the postLink function to imperatively compile
+ * a directive's template instead of relying on automatic template compilation via `template` or
+ * `templateUrl` declaration or manual compilation inside the compile function.
+ * </div>
+ *
+ * <div class="alert alert-danger">
+ * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it
+ * e.g. does not know about the right outer scope. Please use the transclude function that is passed
+ * to the link function instead.
+ * </div>
+
+ * A compile function can have a return value which can be either a function or an object.
+ *
+ * * returning a (post-link) function - is equivalent to registering the linking function via the
+ * `link` property of the config object when the compile function is empty.
+ *
+ * * returning an object with function(s) registered via `pre` and `post` properties - allows you to
+ * control when a linking function should be called during the linking phase. See info about
+ * pre-linking and post-linking functions below.
+ *
+ *
+ * #### `link`
+ * This property is used only if the `compile` property is not defined.
+ *
+ * ```js
+ * function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }
+ * ```
+ *
+ * The link function is responsible for registering DOM listeners as well as updating the DOM. It is
+ * executed after the template has been cloned. This is where most of the directive logic will be
+ * put.
+ *
+ * * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the
+ * directive for registering {@link ng.$rootScope.Scope#$watch watches}.
+ *
+ * * `iElement` - instance element - The element where the directive is to be used. It is safe to
+ * manipulate the children of the element only in `postLink` function since the children have
+ * already been linked.
+ *
+ * * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared
+ * between all directive linking functions.
+ *
+ * * `controller` - the directive's required controller instance(s) - Instances are shared
+ * among all directives, which allows the directives to use the controllers as a communication
+ * channel. The exact value depends on the directive's `require` property:
+ * * no controller(s) required: the directive's own controller, or `undefined` if it doesn't have one
+ * * `string`: the controller instance
+ * * `array`: array of controller instances
+ *
+ * If a required controller cannot be found, and it is optional, the instance is `null`,
+ * otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown.
+ *
+ * Note that you can also require the directive's own controller - it will be made available like
+ * any other controller.
+ *
+ * * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.
+ * This is the same as the `$transclude`
+ * parameter of directive controllers, see there for details.
+ * `function([scope], cloneLinkingFn, futureParentElement)`.
+ *
+ * #### Pre-linking function
+ *
+ * Executed before the child elements are linked. Not safe to do DOM transformation since the
+ * compiler linking function will fail to locate the correct elements for linking.
+ *
+ * #### Post-linking function
+ *
+ * Executed after the child elements are linked.
+ *
+ * Note that child elements that contain `templateUrl` directives will not have been compiled
+ * and linked since they are waiting for their template to load asynchronously and their own
+ * compilation and linking has been suspended until that occurs.
+ *
+ * It is safe to do DOM transformation in the post-linking function on elements that are not waiting
+ * for their async templates to be resolved.
+ *
+ *
+ * ### Transclusion
+ *
+ * Transclusion is the process of extracting a collection of DOM elements from one part of the DOM and
+ * copying them to another part of the DOM, while maintaining their connection to the original AngularJS
+ * scope from where they were taken.
+ *
+ * Transclusion is used (often with {@link ngTransclude}) to insert the
+ * original contents of a directive's element into a specified place in the template of the directive.
+ * The benefit of transclusion, over simply moving the DOM elements manually, is that the transcluded
+ * content has access to the properties on the scope from which it was taken, even if the directive
+ * has isolated scope.
+ * See the {@link guide/directive#creating-a-directive-that-wraps-other-elements Directives Guide}.
+ *
+ * This makes it possible for the widget to have private state for its template, while the transcluded
+ * content has access to its originating scope.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** When testing an element transclude directive you must not place the directive at the root of the
+ * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives
+ * Testing Transclusion Directives}.
+ * </div>
+ *
+ * There are three kinds of transclusion depending upon whether you want to transclude just the contents of the
+ * directive's element, the entire element or multiple parts of the element contents:
+ *
+ * * `true` - transclude the content (i.e. the child nodes) of the directive's element.
+ * * `'element'` - transclude the whole of the directive's element including any directives on this
+ * element that defined at a lower priority than this directive. When used, the `template`
+ * property is ignored.
+ * * **`{...}` (an object hash):** - map elements of the content onto transclusion "slots" in the template.
+ *
+ * **Mult-slot transclusion** is declared by providing an object for the `transclude` property.
+ *
+ * This object is a map where the keys are the name of the slot to fill and the value is an element selector
+ * used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`)
+ * and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc).
+ *
+ * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}
+ *
+ * If the element selector is prefixed with a `?` then that slot is optional.
+ *
+ * For example, the transclude object `{ slotA: '?myCustomElement' }` maps `<my-custom-element>` elements to
+ * the `slotA` slot, which can be accessed via the `$transclude` function or via the {@link ngTransclude} directive.
+ *
+ * Slots that are not marked as optional (`?`) will trigger a compile time error if there are no matching elements
+ * in the transclude content. If you wish to know if an optional slot was filled with content, then you can call
+ * `$transclude.isSlotFilled(slotName)` on the transclude function passed to the directive's link function and
+ * injectable into the directive's controller.
+ *
+ *
+ * #### Transclusion Functions
+ *
+ * When a directive requests transclusion, the compiler extracts its contents and provides a **transclusion
+ * function** to the directive's `link` function and `controller`. This transclusion function is a special
+ * **linking function** that will return the compiled contents linked to a new transclusion scope.
+ *
+ * <div class="alert alert-info">
+ * If you are just using {@link ngTransclude} then you don't need to worry about this function, since
+ * ngTransclude will deal with it for us.
+ * </div>
+ *
+ * If you want to manually control the insertion and removal of the transcluded content in your directive
+ * then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery
+ * object that contains the compiled DOM, which is linked to the correct transclusion scope.
+ *
+ * When you call a transclusion function you can pass in a **clone attach function**. This function accepts
+ * two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded
+ * content and the `scope` is the newly created transclusion scope, to which the clone is bound.
+ *
+ * <div class="alert alert-info">
+ * **Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a transclude function
+ * since you then get a fresh clone of the original DOM and also have access to the new transclusion scope.
+ * </div>
+ *
+ * It is normal practice to attach your transcluded content (`clone`) to the DOM inside your **clone
+ * attach function**:
+ *
+ * ```js
+ * var transcludedContent, transclusionScope;
+ *
+ * $transclude(function(clone, scope) {
+ * element.append(clone);
+ * transcludedContent = clone;
+ * transclusionScope = scope;
+ * });
+ * ```
+ *
+ * Later, if you want to remove the transcluded content from your DOM then you should also destroy the
+ * associated transclusion scope:
+ *
+ * ```js
+ * transcludedContent.remove();
+ * transclusionScope.$destroy();
+ * ```
+ *
+ * <div class="alert alert-info">
+ * **Best Practice**: if you intend to add and remove transcluded content manually in your directive
+ * (by calling the transclude function to get the DOM and calling `element.remove()` to remove it),
+ * then you are also responsible for calling `$destroy` on the transclusion scope.
+ * </div>
+ *
+ * The built-in DOM manipulation directives, such as {@link ngIf}, {@link ngSwitch} and {@link ngRepeat}
+ * automatically destroy their transcluded clones as necessary so you do not need to worry about this if
+ * you are simply using {@link ngTransclude} to inject the transclusion into your directive.
+ *
+ *
+ * #### Transclusion Scopes
+ *
+ * When you call a transclude function it returns a DOM fragment that is pre-bound to a **transclusion
+ * scope**. This scope is special, in that it is a child of the directive's scope (and so gets destroyed
+ * when the directive's scope gets destroyed) but it inherits the properties of the scope from which it
+ * was taken.
+ *
+ * For example consider a directive that uses transclusion and isolated scope. The DOM hierarchy might look
+ * like this:
+ *
+ * ```html
+ * <div ng-app>
+ * <div isolate>
+ * <div transclusion>
+ * </div>
+ * </div>
+ * </div>
+ * ```
+ *
+ * The `$parent` scope hierarchy will look like this:
+ *
+ ```
+ - $rootScope
+ - isolate
+ - transclusion
+ ```
+ *
+ * but the scopes will inherit prototypically from different scopes to their `$parent`.
+ *
+ ```
+ - $rootScope
+ - transclusion
+ - isolate
+ ```
+ *
+ *
+ * ### Attributes
+ *
+ * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the
+ * `link()` or `compile()` functions. It has a variety of uses.
+ *
+ * * *Accessing normalized attribute names:* Directives like 'ngBind' can be expressed in many ways:
+ * 'ng:bind', `data-ng-bind`, or 'x-ng-bind'. The attributes object allows for normalized access
+ * to the attributes.
+ *
+ * * *Directive inter-communication:* All directives share the same instance of the attributes
+ * object which allows the directives to use the attributes object as inter directive
+ * communication.
+ *
+ * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object
+ * allowing other directives to read the interpolated value.
+ *
+ * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes
+ * that contain interpolation (e.g. `src="{{bar}}"`). Not only is this very efficient but it's also
+ * the only way to easily get the actual value because during the linking phase the interpolation
+ * hasn't been evaluated yet and so the value is at this time set to `undefined`.
+ *
+ * ```js
+ * function linkingFn(scope, elm, attrs, ctrl) {
+ * // get the attribute value
+ * console.log(attrs.ngModel);
+ *
+ * // change the attribute
+ * attrs.$set('ngModel', 'new value');
+ *
+ * // observe changes to interpolated attribute
+ * attrs.$observe('ngModel', function(value) {
+ * console.log('ngModel has changed value to ' + value);
+ * });
+ * }
+ * ```
+ *
+ * ## Example
+ *
+ * <div class="alert alert-warning">
+ * **Note**: Typically directives are registered with `module.directive`. The example below is
+ * to illustrate how `$compile` works.
+ * </div>
+ *
+ <example module="compileExample">
+ <file name="index.html">
+ <script>
+ angular.module('compileExample', [], function($compileProvider) {
+ // configure new 'compile' directive by passing a directive
+ // factory function. The factory function injects the '$compile'
+ $compileProvider.directive('compile', function($compile) {
+ // directive factory creates a link function
+ return function(scope, element, attrs) {
+ scope.$watch(
+ function(scope) {
+ // watch the 'compile' expression for changes
+ return scope.$eval(attrs.compile);
+ },
+ function(value) {
+ // when the 'compile' expression changes
+ // assign it into the current DOM
+ element.html(value);
+
+ // compile the new DOM and link it to the current
+ // scope.
+ // NOTE: we only compile .childNodes so that
+ // we don't get into infinite loop compiling ourselves
+ $compile(element.contents())(scope);
+ }
+ );
+ };
+ });
+ })
+ .controller('GreeterController', ['$scope', function($scope) {
+ $scope.name = 'Angular';
+ $scope.html = 'Hello {{name}}';
+ }]);
+ </script>
+ <div ng-controller="GreeterController">
+ <input ng-model="name"> <br/>
+ <textarea ng-model="html"></textarea> <br/>
+ <div compile="html"></div>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should auto compile', function() {
+ var textarea = $('textarea');
+ var output = $('div[compile]');
+ // The initial state reads 'Hello Angular'.
+ expect(output.getText()).toBe('Hello Angular');
+ textarea.clear();
+ textarea.sendKeys('{{name}}!');
+ expect(output.getText()).toBe('Angular!');
+ });
+ </file>
+ </example>
+
+ *
+ *
+ * @param {string|DOMElement} element Element or HTML string to compile into a template function.
+ * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives - DEPRECATED.
+ *
+ * <div class="alert alert-danger">
+ * **Note:** Passing a `transclude` function to the $compile function is deprecated, as it
+ * e.g. will not use the right outer scope. Please pass the transclude function as a
+ * `parentBoundTranscludeFn` to the link function instead.
+ * </div>
+ *
+ * @param {number} maxPriority only apply directives lower than given priority (Only effects the
+ * root element(s), not their children)
+ * @returns {function(scope, cloneAttachFn=, options=)} a link function which is used to bind template
+ * (a DOM element/tree) to a scope. Where:
+ *
+ * * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.
+ * * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the
+ * `template` and call the `cloneAttachFn` function allowing the caller to attach the
+ * cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is
+ * called as: <br/> `cloneAttachFn(clonedElement, scope)` where:
+ *
+ * * `clonedElement` - is a clone of the original `element` passed into the compiler.
+ * * `scope` - is the current scope with which the linking function is working with.
+ *
+ * * `options` - An optional object hash with linking options. If `options` is provided, then the following
+ * keys may be used to control linking behavior:
+ *
+ * * `parentBoundTranscludeFn` - the transclude function made available to
+ * directives; if given, it will be passed through to the link functions of
+ * directives found in `element` during compilation.
+ * * `transcludeControllers` - an object hash with keys that map controller names
+ * to a hash with the key `instance`, which maps to the controller instance;
+ * if given, it will make the controllers available to directives on the compileNode:
+ * ```
+ * {
+ * parent: {
+ * instance: parentControllerInstance
+ * }
+ * }
+ * ```
+ * * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add
+ * the cloned elements; only needed for transcludes that are allowed to contain non html
+ * elements (e.g. SVG elements). See also the directive.controller property.
+ *
+ * Calling the linking function returns the element of the template. It is either the original
+ * element passed in, or the clone of the element if the `cloneAttachFn` is provided.
+ *
+ * After linking the view is not updated until after a call to $digest which typically is done by
+ * Angular automatically.
+ *
+ * If you need access to the bound view, there are two ways to do it:
+ *
+ * - If you are not asking the linking function to clone the template, create the DOM element(s)
+ * before you send them to the compiler and keep this reference around.
+ * ```js
+ * var element = $compile('<p>{{total}}</p>')(scope);
+ * ```
+ *
+ * - if on the other hand, you need the element to be cloned, the view reference from the original
+ * example would not point to the clone, but rather to the original template that was cloned. In
+ * this case, you can access the clone via the cloneAttachFn:
+ * ```js
+ * var templateElement = angular.element('<p>{{total}}</p>'),
+ * scope = ....;
+ *
+ * var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {
+ * //attach the clone to DOM document at the right place
+ * });
+ *
+ * //now we have reference to the cloned DOM via `clonedElement`
+ * ```
+ *
+ *
+ * For information on how the compiler works, see the
+ * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.
+ */
+
+var $compileMinErr = minErr('$compile');
+
+/**
+ * @ngdoc provider
+ * @name $compileProvider
+ *
+ * @description
+ */
+$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
+function $CompileProvider($provide, $$sanitizeUriProvider) {
+ var hasDirectives = {},
+ Suffix = 'Directive',
+ COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\w\-]+)\s+(.*)$/,
+ CLASS_DIRECTIVE_REGEXP = /(([\w\-]+)(?:\:([^;]+))?;?)/,
+ ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),
+ REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/;
+
+ // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes
+ // The assumption is that future DOM event attribute names will begin with
+ // 'on' and be composed of only English letters.
+ var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
+
+ function parseIsolateBindings(scope, directiveName, isController) {
+ var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/;
+
+ var bindings = {};
+
+ forEach(scope, function(definition, scopeName) {
+ var match = definition.match(LOCAL_REGEXP);
+
+ if (!match) {
+ throw $compileMinErr('iscp',
+ "Invalid {3} for directive '{0}'." +
+ " Definition: {... {1}: '{2}' ...}",
+ directiveName, scopeName, definition,
+ (isController ? "controller bindings definition" :
+ "isolate scope definition"));
+ }
+
+ bindings[scopeName] = {
+ mode: match[1][0],
+ collection: match[2] === '*',
+ optional: match[3] === '?',
+ attrName: match[4] || scopeName
+ };
+ });
+
+ return bindings;
+ }
+
+ function parseDirectiveBindings(directive, directiveName) {
+ var bindings = {
+ isolateScope: null,
+ bindToController: null
+ };
+ if (isObject(directive.scope)) {
+ if (directive.bindToController === true) {
+ bindings.bindToController = parseIsolateBindings(directive.scope,
+ directiveName, true);
+ bindings.isolateScope = {};
+ } else {
+ bindings.isolateScope = parseIsolateBindings(directive.scope,
+ directiveName, false);
+ }
+ }
+ if (isObject(directive.bindToController)) {
+ bindings.bindToController =
+ parseIsolateBindings(directive.bindToController, directiveName, true);
+ }
+ if (isObject(bindings.bindToController)) {
+ var controller = directive.controller;
+ var controllerAs = directive.controllerAs;
+ if (!controller) {
+ // There is no controller, there may or may not be a controllerAs property
+ throw $compileMinErr('noctrl',
+ "Cannot bind to controller without directive '{0}'s controller.",
+ directiveName);
+ } else if (!identifierForController(controller, controllerAs)) {
+ // There is a controller, but no identifier or controllerAs property
+ throw $compileMinErr('noident',
+ "Cannot bind to controller without identifier for directive '{0}'.",
+ directiveName);
+ }
+ }
+ return bindings;
+ }
+
+ function assertValidDirectiveName(name) {
+ var letter = name.charAt(0);
+ if (!letter || letter !== lowercase(letter)) {
+ throw $compileMinErr('baddir', "Directive name '{0}' is invalid. The first character must be a lowercase letter", name);
+ }
+ if (name !== name.trim()) {
+ throw $compileMinErr('baddir',
+ "Directive name '{0}' is invalid. The name should not contain leading or trailing whitespaces",
+ name);
+ }
+ }
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#directive
+ * @kind function
+ *
+ * @description
+ * Register a new directive with the compiler.
+ *
+ * @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which
+ * will match as <code>ng-bind</code>), or an object map of directives where the keys are the
+ * names and the values are the factories.
+ * @param {Function|Array} directiveFactory An injectable directive factory function. See the
+ * {@link guide/directive directive guide} and the {@link $compile compile API} for more info.
+ * @returns {ng.$compileProvider} Self for chaining.
+ */
+ this.directive = function registerDirective(name, directiveFactory) {
+ assertNotHasOwnProperty(name, 'directive');
+ if (isString(name)) {
+ assertValidDirectiveName(name);
+ assertArg(directiveFactory, 'directiveFactory');
+ if (!hasDirectives.hasOwnProperty(name)) {
+ hasDirectives[name] = [];
+ $provide.factory(name + Suffix, ['$injector', '$exceptionHandler',
+ function($injector, $exceptionHandler) {
+ var directives = [];
+ forEach(hasDirectives[name], function(directiveFactory, index) {
+ try {
+ var directive = $injector.invoke(directiveFactory);
+ if (isFunction(directive)) {
+ directive = { compile: valueFn(directive) };
+ } else if (!directive.compile && directive.link) {
+ directive.compile = valueFn(directive.link);
+ }
+ directive.priority = directive.priority || 0;
+ directive.index = index;
+ directive.name = directive.name || name;
+ directive.require = directive.require || (directive.controller && directive.name);
+ directive.restrict = directive.restrict || 'EA';
+ var bindings = directive.$$bindings =
+ parseDirectiveBindings(directive, directive.name);
+ if (isObject(bindings.isolateScope)) {
+ directive.$$isolateBindings = bindings.isolateScope;
+ }
+ directive.$$moduleName = directiveFactory.$$moduleName;
+ directives.push(directive);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ });
+ return directives;
+ }]);
+ }
+ hasDirectives[name].push(directiveFactory);
+ } else {
+ forEach(name, reverseParams(registerDirective));
+ }
+ return this;
+ };
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#component
+ * @module ng
+ * @param {string} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`)
+ * @param {Object} options Component definition object (a simplified
+ * {@link ng.$compile#directive-definition-object directive definition object}),
+ * with the following properties (all optional):
+ *
+ * - `controller` – `{(string|function()=}` – controller constructor function that should be
+ * associated with newly created scope or the name of a {@link ng.$compile#-controller-
+ * registered controller} if passed as a string. An empty `noop` function by default.
+ * - `controllerAs` – `{string=}` – identifier name for to reference the controller in the component's scope.
+ * If present, the controller will be published to scope under the `controllerAs` name.
+ * If not present, this will default to be `$ctrl`.
+ * - `template` – `{string=|function()=}` – html template as a string or a function that
+ * returns an html template as a string which should be used as the contents of this component.
+ * Empty string by default.
+ *
+ * If `template` is a function, then it is {@link auto.$injector#invoke injected} with
+ * the following locals:
+ *
+ * - `$element` - Current element
+ * - `$attrs` - Current attributes object for the element
+ *
+ * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
+ * template that should be used as the contents of this component.
+ *
+ * If `templateUrl` is a function, then it is {@link auto.$injector#invoke injected} with
+ * the following locals:
+ *
+ * - `$element` - Current element
+ * - `$attrs` - Current attributes object for the element
+ *
+ * - `bindings` – `{object=}` – defines bindings between DOM attributes and component properties.
+ * Component properties are always bound to the component controller and not to the scope.
+ * See {@link ng.$compile#-bindtocontroller- `bindToController`}.
+ * - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled.
+ * Disabled by default.
+ * - `$...` – `{function()=}` – additional annotations to provide to the directive factory function.
+ *
+ * @returns {ng.$compileProvider} the compile provider itself, for chaining of function calls.
+ * @description
+ * Register a **component definition** with the compiler. This is a shorthand for registering a special
+ * type of directive, which represents a self-contained UI component in your application. Such components
+ * are always isolated (i.e. `scope: {}`) and are always restricted to elements (i.e. `restrict: 'E'`).
+ *
+ * Component definitions are very simple and do not require as much configuration as defining general
+ * directives. Component definitions usually consist only of a template and a controller backing it.
+ *
+ * In order to make the definition easier, components enforce best practices like use of `controllerAs`,
+ * `bindToController`. They always have **isolate scope** and are restricted to elements.
+ *
+ * Here are a few examples of how you would usually define components:
+ *
+ * ```js
+ * var myMod = angular.module(...);
+ * myMod.component('myComp', {
+ * template: '<div>My name is {{$ctrl.name}}</div>',
+ * controller: function() {
+ * this.name = 'shahar';
+ * }
+ * });
+ *
+ * myMod.component('myComp', {
+ * template: '<div>My name is {{$ctrl.name}}</div>',
+ * bindings: {name: '@'}
+ * });
+ *
+ * myMod.component('myComp', {
+ * templateUrl: 'views/my-comp.html',
+ * controller: 'MyCtrl as ctrl',
+ * bindings: {name: '@'}
+ * });
+ *
+ * ```
+ * For more examples, and an in-depth guide, see the {@link guide/component component guide}.
+ *
+ * <br />
+ * See also {@link ng.$compileProvider#directive $compileProvider.directive()}.
+ */
+ this.component = function registerComponent(name, options) {
+ var controller = options.controller || function() {};
+
+ function factory($injector) {
+ function makeInjectable(fn) {
+ if (isFunction(fn) || isArray(fn)) {
+ return function(tElement, tAttrs) {
+ return $injector.invoke(fn, this, {$element: tElement, $attrs: tAttrs});
+ };
+ } else {
+ return fn;
+ }
+ }
+
+ var template = (!options.template && !options.templateUrl ? '' : options.template);
+ return {
+ controller: controller,
+ controllerAs: identifierForController(options.controller) || options.controllerAs || '$ctrl',
+ template: makeInjectable(template),
+ templateUrl: makeInjectable(options.templateUrl),
+ transclude: options.transclude,
+ scope: {},
+ bindToController: options.bindings || {},
+ restrict: 'E',
+ require: options.require
+ };
+ }
+
+ // Copy any annotation properties (starting with $) over to the factory function
+ // These could be used by libraries such as the new component router
+ forEach(options, function(val, key) {
+ if (key.charAt(0) === '$') {
+ factory[key] = val;
+ }
+ });
+
+ factory.$inject = ['$injector'];
+
+ return this.directive(name, factory);
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#aHrefSanitizationWhitelist
+ * @kind function
+ *
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during a[href] sanitization.
+ *
+ * The sanitization is a security measure aimed at preventing XSS attacks via html links.
+ *
+ * Any url about to be assigned to a[href] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.aHrefSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp);
+ return this;
+ } else {
+ return $$sanitizeUriProvider.aHrefSanitizationWhitelist();
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#imgSrcSanitizationWhitelist
+ * @kind function
+ *
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during img[src] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to img[src] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.imgSrcSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp);
+ return this;
+ } else {
+ return $$sanitizeUriProvider.imgSrcSanitizationWhitelist();
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#debugInfoEnabled
+ *
+ * @param {boolean=} enabled update the debugInfoEnabled state if provided, otherwise just return the
+ * current debugInfoEnabled state
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ *
+ * @kind function
+ *
+ * @description
+ * Call this method to enable/disable various debug runtime information in the compiler such as adding
+ * binding information and a reference to the current scope on to DOM elements.
+ * If enabled, the compiler will add the following to DOM elements that have been bound to the scope
+ * * `ng-binding` CSS class
+ * * `$binding` data property containing an array of the binding expressions
+ *
+ * You may want to disable this in production for a significant performance boost. See
+ * {@link guide/production#disabling-debug-data Disabling Debug Data} for more.
+ *
+ * The default value is true.
+ */
+ var debugInfoEnabled = true;
+ this.debugInfoEnabled = function(enabled) {
+ if (isDefined(enabled)) {
+ debugInfoEnabled = enabled;
+ return this;
+ }
+ return debugInfoEnabled;
+ };
+
+ this.$get = [
+ '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse',
+ '$controller', '$rootScope', '$sce', '$animate', '$$sanitizeUri',
+ function($injector, $interpolate, $exceptionHandler, $templateRequest, $parse,
+ $controller, $rootScope, $sce, $animate, $$sanitizeUri) {
+
+ var SIMPLE_ATTR_NAME = /^\w/;
+ var specialAttrHolder = document.createElement('div');
+ var Attributes = function(element, attributesToCopy) {
+ if (attributesToCopy) {
+ var keys = Object.keys(attributesToCopy);
+ var i, l, key;
+
+ for (i = 0, l = keys.length; i < l; i++) {
+ key = keys[i];
+ this[key] = attributesToCopy[key];
+ }
+ } else {
+ this.$attr = {};
+ }
+
+ this.$$element = element;
+ };
+
+ Attributes.prototype = {
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$normalize
+ * @kind function
+ *
+ * @description
+ * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or
+ * `data-`) to its normalized, camelCase form.
+ *
+ * Also there is special case for Moz prefix starting with upper case letter.
+ *
+ * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}
+ *
+ * @param {string} name Name to normalize
+ */
+ $normalize: directiveNormalize,
+
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$addClass
+ * @kind function
+ *
+ * @description
+ * Adds the CSS class value specified by the classVal parameter to the element. If animations
+ * are enabled then an animation will be triggered for the class addition.
+ *
+ * @param {string} classVal The className value that will be added to the element
+ */
+ $addClass: function(classVal) {
+ if (classVal && classVal.length > 0) {
+ $animate.addClass(this.$$element, classVal);
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$removeClass
+ * @kind function
+ *
+ * @description
+ * Removes the CSS class value specified by the classVal parameter from the element. If
+ * animations are enabled then an animation will be triggered for the class removal.
+ *
+ * @param {string} classVal The className value that will be removed from the element
+ */
+ $removeClass: function(classVal) {
+ if (classVal && classVal.length > 0) {
+ $animate.removeClass(this.$$element, classVal);
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$updateClass
+ * @kind function
+ *
+ * @description
+ * Adds and removes the appropriate CSS class values to the element based on the difference
+ * between the new and old CSS class values (specified as newClasses and oldClasses).
+ *
+ * @param {string} newClasses The current CSS className value
+ * @param {string} oldClasses The former CSS className value
+ */
+ $updateClass: function(newClasses, oldClasses) {
+ var toAdd = tokenDifference(newClasses, oldClasses);
+ if (toAdd && toAdd.length) {
+ $animate.addClass(this.$$element, toAdd);
+ }
+
+ var toRemove = tokenDifference(oldClasses, newClasses);
+ if (toRemove && toRemove.length) {
+ $animate.removeClass(this.$$element, toRemove);
+ }
+ },
+
+ /**
+ * Set a normalized attribute on the element in a way such that all directives
+ * can share the attribute. This function properly handles boolean attributes.
+ * @param {string} key Normalized key. (ie ngAttribute)
+ * @param {string|boolean} value The value to set. If `null` attribute will be deleted.
+ * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.
+ * Defaults to true.
+ * @param {string=} attrName Optional none normalized name. Defaults to key.
+ */
+ $set: function(key, value, writeAttr, attrName) {
+ // TODO: decide whether or not to throw an error if "class"
+ //is set through this function since it may cause $updateClass to
+ //become unstable.
+
+ var node = this.$$element[0],
+ booleanKey = getBooleanAttrName(node, key),
+ aliasedKey = getAliasedAttrName(key),
+ observer = key,
+ nodeName;
+
+ if (booleanKey) {
+ this.$$element.prop(key, value);
+ attrName = booleanKey;
+ } else if (aliasedKey) {
+ this[aliasedKey] = value;
+ observer = aliasedKey;
+ }
+
+ this[key] = value;
+
+ // translate normalized key to actual key
+ if (attrName) {
+ this.$attr[key] = attrName;
+ } else {
+ attrName = this.$attr[key];
+ if (!attrName) {
+ this.$attr[key] = attrName = snake_case(key, '-');
+ }
+ }
+
+ nodeName = nodeName_(this.$$element);
+
+ if ((nodeName === 'a' && (key === 'href' || key === 'xlinkHref')) ||
+ (nodeName === 'img' && key === 'src')) {
+ // sanitize a[href] and img[src] values
+ this[key] = value = $$sanitizeUri(value, key === 'src');
+ } else if (nodeName === 'img' && key === 'srcset') {
+ // sanitize img[srcset] values
+ var result = "";
+
+ // first check if there are spaces because it's not the same pattern
+ var trimmedSrcset = trim(value);
+ // ( 999x ,| 999w ,| ,|, )
+ var srcPattern = /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/;
+ var pattern = /\s/.test(trimmedSrcset) ? srcPattern : /(,)/;
+
+ // split srcset into tuple of uri and descriptor except for the last item
+ var rawUris = trimmedSrcset.split(pattern);
+
+ // for each tuples
+ var nbrUrisWith2parts = Math.floor(rawUris.length / 2);
+ for (var i = 0; i < nbrUrisWith2parts; i++) {
+ var innerIdx = i * 2;
+ // sanitize the uri
+ result += $$sanitizeUri(trim(rawUris[innerIdx]), true);
+ // add the descriptor
+ result += (" " + trim(rawUris[innerIdx + 1]));
+ }
+
+ // split the last item into uri and descriptor
+ var lastTuple = trim(rawUris[i * 2]).split(/\s/);
+
+ // sanitize the last uri
+ result += $$sanitizeUri(trim(lastTuple[0]), true);
+
+ // and add the last descriptor if any
+ if (lastTuple.length === 2) {
+ result += (" " + trim(lastTuple[1]));
+ }
+ this[key] = value = result;
+ }
+
+ if (writeAttr !== false) {
+ if (value === null || isUndefined(value)) {
+ this.$$element.removeAttr(attrName);
+ } else {
+ if (SIMPLE_ATTR_NAME.test(attrName)) {
+ this.$$element.attr(attrName, value);
+ } else {
+ setSpecialAttr(this.$$element[0], attrName, value);
+ }
+ }
+ }
+
+ // fire observers
+ var $$observers = this.$$observers;
+ $$observers && forEach($$observers[observer], function(fn) {
+ try {
+ fn(value);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ });
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$observe
+ * @kind function
+ *
+ * @description
+ * Observes an interpolated attribute.
+ *
+ * The observer function will be invoked once during the next `$digest` following
+ * compilation. The observer is then invoked whenever the interpolated value
+ * changes.
+ *
+ * @param {string} key Normalized key. (ie ngAttribute) .
+ * @param {function(interpolatedValue)} fn Function that will be called whenever
+ the interpolated value of the attribute changes.
+ * See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation
+ * guide} for more info.
+ * @returns {function()} Returns a deregistration function for this observer.
+ */
+ $observe: function(key, fn) {
+ var attrs = this,
+ $$observers = (attrs.$$observers || (attrs.$$observers = createMap())),
+ listeners = ($$observers[key] || ($$observers[key] = []));
+
+ listeners.push(fn);
+ $rootScope.$evalAsync(function() {
+ if (!listeners.$$inter && attrs.hasOwnProperty(key) && !isUndefined(attrs[key])) {
+ // no one registered attribute interpolation function, so lets call it manually
+ fn(attrs[key]);
+ }
+ });
+
+ return function() {
+ arrayRemove(listeners, fn);
+ };
+ }
+ };
+
+ function setSpecialAttr(element, attrName, value) {
+ // Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute`
+ // so we have to jump through some hoops to get such an attribute
+ // https://github.com/angular/angular.js/pull/13318
+ specialAttrHolder.innerHTML = "<span " + attrName + ">";
+ var attributes = specialAttrHolder.firstChild.attributes;
+ var attribute = attributes[0];
+ // We have to remove the attribute from its container element before we can add it to the destination element
+ attributes.removeNamedItem(attribute.name);
+ attribute.value = value;
+ element.attributes.setNamedItem(attribute);
+ }
+
+ function safeAddClass($element, className) {
+ try {
+ $element.addClass(className);
+ } catch (e) {
+ // ignore, since it means that we are trying to set class on
+ // SVG element, where class name is read-only.
+ }
+ }
+
+
+ var startSymbol = $interpolate.startSymbol(),
+ endSymbol = $interpolate.endSymbol(),
+ denormalizeTemplate = (startSymbol == '{{' && endSymbol == '}}')
+ ? identity
+ : function denormalizeTemplate(template) {
+ return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
+ },
+ NG_ATTR_BINDING = /^ngAttr[A-Z]/;
+ var MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;
+
+ compile.$$addBindingInfo = debugInfoEnabled ? function $$addBindingInfo($element, binding) {
+ var bindings = $element.data('$binding') || [];
+
+ if (isArray(binding)) {
+ bindings = bindings.concat(binding);
+ } else {
+ bindings.push(binding);
+ }
+
+ $element.data('$binding', bindings);
+ } : noop;
+
+ compile.$$addBindingClass = debugInfoEnabled ? function $$addBindingClass($element) {
+ safeAddClass($element, 'ng-binding');
+ } : noop;
+
+ compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo($element, scope, isolated, noTemplate) {
+ var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';
+ $element.data(dataName, scope);
+ } : noop;
+
+ compile.$$addScopeClass = debugInfoEnabled ? function $$addScopeClass($element, isolated) {
+ safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope');
+ } : noop;
+
+ return compile;
+
+ //================================
+
+ function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,
+ previousCompileContext) {
+ if (!($compileNodes instanceof jqLite)) {
+ // jquery always rewraps, whereas we need to preserve the original selector so that we can
+ // modify it.
+ $compileNodes = jqLite($compileNodes);
+ }
+
+ var NOT_EMPTY = /\S+/;
+
+ // We can not compile top level text elements since text nodes can be merged and we will
+ // not be able to attach scope data to them, so we will wrap them in <span>
+ for (var i = 0, len = $compileNodes.length; i < len; i++) {
+ var domNode = $compileNodes[i];
+
+ if (domNode.nodeType === NODE_TYPE_TEXT && domNode.nodeValue.match(NOT_EMPTY) /* non-empty */) {
+ jqLiteWrapNode(domNode, $compileNodes[i] = document.createElement('span'));
+ }
+ }
+
+ var compositeLinkFn =
+ compileNodes($compileNodes, transcludeFn, $compileNodes,
+ maxPriority, ignoreDirective, previousCompileContext);
+ compile.$$addScopeClass($compileNodes);
+ var namespace = null;
+ return function publicLinkFn(scope, cloneConnectFn, options) {
+ assertArg(scope, 'scope');
+
+ if (previousCompileContext && previousCompileContext.needsNewScope) {
+ // A parent directive did a replace and a directive on this element asked
+ // for transclusion, which caused us to lose a layer of element on which
+ // we could hold the new transclusion scope, so we will create it manually
+ // here.
+ scope = scope.$parent.$new();
+ }
+
+ options = options || {};
+ var parentBoundTranscludeFn = options.parentBoundTranscludeFn,
+ transcludeControllers = options.transcludeControllers,
+ futureParentElement = options.futureParentElement;
+
+ // When `parentBoundTranscludeFn` is passed, it is a
+ // `controllersBoundTransclude` function (it was previously passed
+ // as `transclude` to directive.link) so we must unwrap it to get
+ // its `boundTranscludeFn`
+ if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude) {
+ parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude;
+ }
+
+ if (!namespace) {
+ namespace = detectNamespaceForChildElements(futureParentElement);
+ }
+ var $linkNode;
+ if (namespace !== 'html') {
+ // When using a directive with replace:true and templateUrl the $compileNodes
+ // (or a child element inside of them)
+ // might change, so we need to recreate the namespace adapted compileNodes
+ // for call to the link function.
+ // Note: This will already clone the nodes...
+ $linkNode = jqLite(
+ wrapTemplate(namespace, jqLite('<div>').append($compileNodes).html())
+ );
+ } else if (cloneConnectFn) {
+ // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart
+ // and sometimes changes the structure of the DOM.
+ $linkNode = JQLitePrototype.clone.call($compileNodes);
+ } else {
+ $linkNode = $compileNodes;
+ }
+
+ if (transcludeControllers) {
+ for (var controllerName in transcludeControllers) {
+ $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance);
+ }
+ }
+
+ compile.$$addScopeInfo($linkNode, scope);
+
+ if (cloneConnectFn) cloneConnectFn($linkNode, scope);
+ if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn);
+ return $linkNode;
+ };
+ }
+
+ function detectNamespaceForChildElements(parentElement) {
+ // TODO: Make this detect MathML as well...
+ var node = parentElement && parentElement[0];
+ if (!node) {
+ return 'html';
+ } else {
+ return nodeName_(node) !== 'foreignobject' && toString.call(node).match(/SVG/) ? 'svg' : 'html';
+ }
+ }
+
+ /**
+ * Compile function matches each node in nodeList against the directives. Once all directives
+ * for a particular node are collected their compile functions are executed. The compile
+ * functions return values - the linking functions - are combined into a composite linking
+ * function, which is the a linking function for the node.
+ *
+ * @param {NodeList} nodeList an array of nodes or NodeList to compile
+ * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the
+ * scope argument is auto-generated to the new child of the transcluded parent scope.
+ * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then
+ * the rootElement must be set the jqLite collection of the compile root. This is
+ * needed so that the jqLite collection items can be replaced with widgets.
+ * @param {number=} maxPriority Max directive priority.
+ * @returns {Function} A composite linking function of all of the matched directives or null.
+ */
+ function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,
+ previousCompileContext) {
+ var linkFns = [],
+ attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound;
+
+ for (var i = 0; i < nodeList.length; i++) {
+ attrs = new Attributes();
+
+ // we must always refer to nodeList[i] since the nodes can be replaced underneath us.
+ directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,
+ ignoreDirective);
+
+ nodeLinkFn = (directives.length)
+ ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement,
+ null, [], [], previousCompileContext)
+ : null;
+
+ if (nodeLinkFn && nodeLinkFn.scope) {
+ compile.$$addScopeClass(attrs.$$element);
+ }
+
+ childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||
+ !(childNodes = nodeList[i].childNodes) ||
+ !childNodes.length)
+ ? null
+ : compileNodes(childNodes,
+ nodeLinkFn ? (
+ (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement)
+ && nodeLinkFn.transclude) : transcludeFn);
+
+ if (nodeLinkFn || childLinkFn) {
+ linkFns.push(i, nodeLinkFn, childLinkFn);
+ linkFnFound = true;
+ nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn;
+ }
+
+ //use the previous context only for the first element in the virtual group
+ previousCompileContext = null;
+ }
+
+ // return a linking function if we have found anything, null otherwise
+ return linkFnFound ? compositeLinkFn : null;
+
+ function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {
+ var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;
+ var stableNodeList;
+
+
+ if (nodeLinkFnFound) {
+ // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our
+ // offsets don't get screwed up
+ var nodeListLength = nodeList.length;
+ stableNodeList = new Array(nodeListLength);
+
+ // create a sparse array by only copying the elements which have a linkFn
+ for (i = 0; i < linkFns.length; i+=3) {
+ idx = linkFns[i];
+ stableNodeList[idx] = nodeList[idx];
+ }
+ } else {
+ stableNodeList = nodeList;
+ }
+
+ for (i = 0, ii = linkFns.length; i < ii;) {
+ node = stableNodeList[linkFns[i++]];
+ nodeLinkFn = linkFns[i++];
+ childLinkFn = linkFns[i++];
+
+ if (nodeLinkFn) {
+ if (nodeLinkFn.scope) {
+ childScope = scope.$new();
+ compile.$$addScopeInfo(jqLite(node), childScope);
+ } else {
+ childScope = scope;
+ }
+
+ if (nodeLinkFn.transcludeOnThisElement) {
+ childBoundTranscludeFn = createBoundTranscludeFn(
+ scope, nodeLinkFn.transclude, parentBoundTranscludeFn);
+
+ } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {
+ childBoundTranscludeFn = parentBoundTranscludeFn;
+
+ } else if (!parentBoundTranscludeFn && transcludeFn) {
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);
+
+ } else {
+ childBoundTranscludeFn = null;
+ }
+
+ nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn);
+
+ } else if (childLinkFn) {
+ childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);
+ }
+ }
+ }
+ }
+
+ function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {
+
+ var boundTranscludeFn = function(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {
+
+ if (!transcludedScope) {
+ transcludedScope = scope.$new(false, containingScope);
+ transcludedScope.$$transcluded = true;
+ }
+
+ return transcludeFn(transcludedScope, cloneFn, {
+ parentBoundTranscludeFn: previousBoundTranscludeFn,
+ transcludeControllers: controllers,
+ futureParentElement: futureParentElement
+ });
+ };
+
+ // We need to attach the transclusion slots onto the `boundTranscludeFn`
+ // so that they are available inside the `controllersBoundTransclude` function
+ var boundSlots = boundTranscludeFn.$$slots = createMap();
+ for (var slotName in transcludeFn.$$slots) {
+ if (transcludeFn.$$slots[slotName]) {
+ boundSlots[slotName] = createBoundTranscludeFn(scope, transcludeFn.$$slots[slotName], previousBoundTranscludeFn);
+ } else {
+ boundSlots[slotName] = null;
+ }
+ }
+
+ return boundTranscludeFn;
+ }
+
+ /**
+ * Looks for directives on the given node and adds them to the directive collection which is
+ * sorted.
+ *
+ * @param node Node to search.
+ * @param directives An array to which the directives are added to. This array is sorted before
+ * the function returns.
+ * @param attrs The shared attrs object which is used to populate the normalized attributes.
+ * @param {number=} maxPriority Max directive priority.
+ */
+ function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {
+ var nodeType = node.nodeType,
+ attrsMap = attrs.$attr,
+ match,
+ className;
+
+ switch (nodeType) {
+ case NODE_TYPE_ELEMENT: /* Element */
+ // use the node name: <directive>
+ addDirective(directives,
+ directiveNormalize(nodeName_(node)), 'E', maxPriority, ignoreDirective);
+
+ // iterate over the attributes
+ for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes,
+ j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {
+ var attrStartName = false;
+ var attrEndName = false;
+
+ attr = nAttrs[j];
+ name = attr.name;
+ value = trim(attr.value);
+
+ // support ngAttr attribute binding
+ ngAttrName = directiveNormalize(name);
+ if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) {
+ name = name.replace(PREFIX_REGEXP, '')
+ .substr(8).replace(/_(.)/g, function(match, letter) {
+ return letter.toUpperCase();
+ });
+ }
+
+ var multiElementMatch = ngAttrName.match(MULTI_ELEMENT_DIR_RE);
+ if (multiElementMatch && directiveIsMultiElement(multiElementMatch[1])) {
+ attrStartName = name;
+ attrEndName = name.substr(0, name.length - 5) + 'end';
+ name = name.substr(0, name.length - 6);
+ }
+
+ nName = directiveNormalize(name.toLowerCase());
+ attrsMap[nName] = name;
+ if (isNgAttr || !attrs.hasOwnProperty(nName)) {
+ attrs[nName] = value;
+ if (getBooleanAttrName(node, nName)) {
+ attrs[nName] = true; // presence means true
+ }
+ }
+ addAttrInterpolateDirective(node, directives, value, nName, isNgAttr);
+ addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,
+ attrEndName);
+ }
+
+ // use class as directive
+ className = node.className;
+ if (isObject(className)) {
+ // Maybe SVGAnimatedString
+ className = className.animVal;
+ }
+ if (isString(className) && className !== '') {
+ while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {
+ nName = directiveNormalize(match[2]);
+ if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {
+ attrs[nName] = trim(match[3]);
+ }
+ className = className.substr(match.index + match[0].length);
+ }
+ }
+ break;
+ case NODE_TYPE_TEXT: /* Text Node */
+ if (msie === 11) {
+ // Workaround for #11781
+ while (node.parentNode && node.nextSibling && node.nextSibling.nodeType === NODE_TYPE_TEXT) {
+ node.nodeValue = node.nodeValue + node.nextSibling.nodeValue;
+ node.parentNode.removeChild(node.nextSibling);
+ }
+ }
+ addTextInterpolateDirective(directives, node.nodeValue);
+ break;
+ case NODE_TYPE_COMMENT: /* Comment */
+ try {
+ match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
+ if (match) {
+ nName = directiveNormalize(match[1]);
+ if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {
+ attrs[nName] = trim(match[2]);
+ }
+ }
+ } catch (e) {
+ // turns out that under some circumstances IE9 throws errors when one attempts to read
+ // comment's node value.
+ // Just ignore it and continue. (Can't seem to reproduce in test case.)
+ }
+ break;
+ }
+
+ directives.sort(byPriority);
+ return directives;
+ }
+
+ /**
+ * Given a node with an directive-start it collects all of the siblings until it finds
+ * directive-end.
+ * @param node
+ * @param attrStart
+ * @param attrEnd
+ * @returns {*}
+ */
+ function groupScan(node, attrStart, attrEnd) {
+ var nodes = [];
+ var depth = 0;
+ if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {
+ do {
+ if (!node) {
+ throw $compileMinErr('uterdir',
+ "Unterminated attribute, found '{0}' but no matching '{1}' found.",
+ attrStart, attrEnd);
+ }
+ if (node.nodeType == NODE_TYPE_ELEMENT) {
+ if (node.hasAttribute(attrStart)) depth++;
+ if (node.hasAttribute(attrEnd)) depth--;
+ }
+ nodes.push(node);
+ node = node.nextSibling;
+ } while (depth > 0);
+ } else {
+ nodes.push(node);
+ }
+
+ return jqLite(nodes);
+ }
+
+ /**
+ * Wrapper for linking function which converts normal linking function into a grouped
+ * linking function.
+ * @param linkFn
+ * @param attrStart
+ * @param attrEnd
+ * @returns {Function}
+ */
+ function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {
+ return function(scope, element, attrs, controllers, transcludeFn) {
+ element = groupScan(element[0], attrStart, attrEnd);
+ return linkFn(scope, element, attrs, controllers, transcludeFn);
+ };
+ }
+
+ /**
+ * A function generator that is used to support both eager and lazy compilation
+ * linking function.
+ * @param eager
+ * @param $compileNodes
+ * @param transcludeFn
+ * @param maxPriority
+ * @param ignoreDirective
+ * @param previousCompileContext
+ * @returns {Function}
+ */
+ function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) {
+ if (eager) {
+ return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
+ }
+
+ var compiled;
+
+ return function() {
+ if (!compiled) {
+ compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
+
+ // Null out all of these references in order to make them eligible for garbage collection
+ // since this is a potentially long lived closure
+ $compileNodes = transcludeFn = previousCompileContext = null;
+ }
+
+ return compiled.apply(this, arguments);
+ };
+ }
+
+ /**
+ * Once the directives have been collected, their compile functions are executed. This method
+ * is responsible for inlining directive templates as well as terminating the application
+ * of the directives if the terminal directive has been reached.
+ *
+ * @param {Array} directives Array of collected directives to execute their compile function.
+ * this needs to be pre-sorted by priority order.
+ * @param {Node} compileNode The raw DOM node to apply the compile functions to
+ * @param {Object} templateAttrs The shared attribute function
+ * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the
+ * scope argument is auto-generated to the new
+ * child of the transcluded parent scope.
+ * @param {JQLite} jqCollection If we are working on the root of the compile tree then this
+ * argument has the root jqLite array so that we can replace nodes
+ * on it.
+ * @param {Object=} originalReplaceDirective An optional directive that will be ignored when
+ * compiling the transclusion.
+ * @param {Array.<Function>} preLinkFns
+ * @param {Array.<Function>} postLinkFns
+ * @param {Object} previousCompileContext Context used for previous compilation of the current
+ * node
+ * @returns {Function} linkFn
+ */
+ function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
+ jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
+ previousCompileContext) {
+ previousCompileContext = previousCompileContext || {};
+
+ var terminalPriority = -Number.MAX_VALUE,
+ newScopeDirective = previousCompileContext.newScopeDirective,
+ controllerDirectives = previousCompileContext.controllerDirectives,
+ newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
+ templateDirective = previousCompileContext.templateDirective,
+ nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
+ hasTranscludeDirective = false,
+ hasTemplate = false,
+ hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
+ $compileNode = templateAttrs.$$element = jqLite(compileNode),
+ directive,
+ directiveName,
+ $template,
+ replaceDirective = originalReplaceDirective,
+ childTranscludeFn = transcludeFn,
+ linkFn,
+ didScanForMultipleTransclusion = false,
+ mightHaveMultipleTransclusionError = false,
+ directiveValue;
+
+ // executes all directives on the current element
+ for (var i = 0, ii = directives.length; i < ii; i++) {
+ directive = directives[i];
+ var attrStart = directive.$$start;
+ var attrEnd = directive.$$end;
+
+ // collect multiblock sections
+ if (attrStart) {
+ $compileNode = groupScan(compileNode, attrStart, attrEnd);
+ }
+ $template = undefined;
+
+ if (terminalPriority > directive.priority) {
+ break; // prevent further processing of directives
+ }
+
+ if (directiveValue = directive.scope) {
+
+ // skip the check for directives with async templates, we'll check the derived sync
+ // directive when the template arrives
+ if (!directive.templateUrl) {
+ if (isObject(directiveValue)) {
+ // This directive is trying to add an isolated scope.
+ // Check that there is no scope of any kind already
+ assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,
+ directive, $compileNode);
+ newIsolateScopeDirective = directive;
+ } else {
+ // This directive is trying to add a child scope.
+ // Check that there is no isolated scope already
+ assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,
+ $compileNode);
+ }
+ }
+
+ newScopeDirective = newScopeDirective || directive;
+ }
+
+ directiveName = directive.name;
+
+ // If we encounter a condition that can result in transclusion on the directive,
+ // then scan ahead in the remaining directives for others that may cause a multiple
+ // transclusion error to be thrown during the compilation process. If a matching directive
+ // is found, then we know that when we encounter a transcluded directive, we need to eagerly
+ // compile the `transclude` function rather than doing it lazily in order to throw
+ // exceptions at the correct time
+ if (!didScanForMultipleTransclusion && ((directive.replace && (directive.templateUrl || directive.template))
+ || (directive.transclude && !directive.$$tlb))) {
+ var candidateDirective;
+
+ for (var scanningIndex = i + 1; candidateDirective = directives[scanningIndex++];) {
+ if ((candidateDirective.transclude && !candidateDirective.$$tlb)
+ || (candidateDirective.replace && (candidateDirective.templateUrl || candidateDirective.template))) {
+ mightHaveMultipleTransclusionError = true;
+ break;
+ }
+ }
+
+ didScanForMultipleTransclusion = true;
+ }
+
+ if (!directive.templateUrl && directive.controller) {
+ directiveValue = directive.controller;
+ controllerDirectives = controllerDirectives || createMap();
+ assertNoDuplicate("'" + directiveName + "' controller",
+ controllerDirectives[directiveName], directive, $compileNode);
+ controllerDirectives[directiveName] = directive;
+ }
+
+ if (directiveValue = directive.transclude) {
+ hasTranscludeDirective = true;
+
+ // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.
+ // This option should only be used by directives that know how to safely handle element transclusion,
+ // where the transcluded nodes are added or replaced after linking.
+ if (!directive.$$tlb) {
+ assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);
+ nonTlbTranscludeDirective = directive;
+ }
+
+ if (directiveValue == 'element') {
+ hasElementTranscludeDirective = true;
+ terminalPriority = directive.priority;
+ $template = $compileNode;
+ $compileNode = templateAttrs.$$element =
+ jqLite(document.createComment(' ' + directiveName + ': ' +
+ templateAttrs[directiveName] + ' '));
+ compileNode = $compileNode[0];
+ replaceWith(jqCollection, sliceArgs($template), compileNode);
+
+ childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, terminalPriority,
+ replaceDirective && replaceDirective.name, {
+ // Don't pass in:
+ // - controllerDirectives - otherwise we'll create duplicates controllers
+ // - newIsolateScopeDirective or templateDirective - combining templates with
+ // element transclusion doesn't make sense.
+ //
+ // We need only nonTlbTranscludeDirective so that we prevent putting transclusion
+ // on the same element more than once.
+ nonTlbTranscludeDirective: nonTlbTranscludeDirective
+ });
+ } else {
+
+ var slots = createMap();
+
+ $template = jqLite(jqLiteClone(compileNode)).contents();
+
+ if (isObject(directiveValue)) {
+
+ // We have transclusion slots,
+ // collect them up, compile them and store their transclusion functions
+ $template = [];
+
+ var slotMap = createMap();
+ var filledSlots = createMap();
+
+ // Parse the element selectors
+ forEach(directiveValue, function(elementSelector, slotName) {
+ // If an element selector starts with a ? then it is optional
+ var optional = (elementSelector.charAt(0) === '?');
+ elementSelector = optional ? elementSelector.substring(1) : elementSelector;
+
+ slotMap[elementSelector] = slotName;
+
+ // We explicitly assign `null` since this implies that a slot was defined but not filled.
+ // Later when calling boundTransclusion functions with a slot name we only error if the
+ // slot is `undefined`
+ slots[slotName] = null;
+
+ // filledSlots contains `true` for all slots that are either optional or have been
+ // filled. This is used to check that we have not missed any required slots
+ filledSlots[slotName] = optional;
+ });
+
+ // Add the matching elements into their slot
+ forEach($compileNode.contents(), function(node) {
+ var slotName = slotMap[directiveNormalize(nodeName_(node))];
+ if (slotName) {
+ filledSlots[slotName] = true;
+ slots[slotName] = slots[slotName] || [];
+ slots[slotName].push(node);
+ } else {
+ $template.push(node);
+ }
+ });
+
+ // Check for required slots that were not filled
+ forEach(filledSlots, function(filled, slotName) {
+ if (!filled) {
+ throw $compileMinErr('reqslot', 'Required transclusion slot `{0}` was not filled.', slotName);
+ }
+ });
+
+ for (var slotName in slots) {
+ if (slots[slotName]) {
+ // Only define a transclusion function if the slot was filled
+ slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slots[slotName], transcludeFn);
+ }
+ }
+ }
+
+ $compileNode.empty(); // clear contents
+ childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, undefined,
+ undefined, { needsNewScope: directive.$$isolateScope || directive.$$newScope});
+ childTranscludeFn.$$slots = slots;
+ }
+ }
+
+ if (directive.template) {
+ hasTemplate = true;
+ assertNoDuplicate('template', templateDirective, directive, $compileNode);
+ templateDirective = directive;
+
+ directiveValue = (isFunction(directive.template))
+ ? directive.template($compileNode, templateAttrs)
+ : directive.template;
+
+ directiveValue = denormalizeTemplate(directiveValue);
+
+ if (directive.replace) {
+ replaceDirective = directive;
+ if (jqLiteIsTextNode(directiveValue)) {
+ $template = [];
+ } else {
+ $template = removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue)));
+ }
+ compileNode = $template[0];
+
+ if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
+ throw $compileMinErr('tplrt',
+ "Template for directive '{0}' must have exactly one root element. {1}",
+ directiveName, '');
+ }
+
+ replaceWith(jqCollection, $compileNode, compileNode);
+
+ var newTemplateAttrs = {$attr: {}};
+
+ // combine directives from the original node and from the template:
+ // - take the array of directives for this element
+ // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed)
+ // - collect directives from the template and sort them by priority
+ // - combine directives as: processed + template + unprocessed
+ var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs);
+ var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));
+
+ if (newIsolateScopeDirective || newScopeDirective) {
+ // The original directive caused the current element to be replaced but this element
+ // also needs to have a new scope, so we need to tell the template directives
+ // that they would need to get their scope from further up, if they require transclusion
+ markDirectiveScope(templateDirectives, newIsolateScopeDirective, newScopeDirective);
+ }
+ directives = directives.concat(templateDirectives).concat(unprocessedDirectives);
+ mergeTemplateAttributes(templateAttrs, newTemplateAttrs);
+
+ ii = directives.length;
+ } else {
+ $compileNode.html(directiveValue);
+ }
+ }
+
+ if (directive.templateUrl) {
+ hasTemplate = true;
+ assertNoDuplicate('template', templateDirective, directive, $compileNode);
+ templateDirective = directive;
+
+ if (directive.replace) {
+ replaceDirective = directive;
+ }
+
+ nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,
+ templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, {
+ controllerDirectives: controllerDirectives,
+ newScopeDirective: (newScopeDirective !== directive) && newScopeDirective,
+ newIsolateScopeDirective: newIsolateScopeDirective,
+ templateDirective: templateDirective,
+ nonTlbTranscludeDirective: nonTlbTranscludeDirective
+ });
+ ii = directives.length;
+ } else if (directive.compile) {
+ try {
+ linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);
+ if (isFunction(linkFn)) {
+ addLinkFns(null, linkFn, attrStart, attrEnd);
+ } else if (linkFn) {
+ addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd);
+ }
+ } catch (e) {
+ $exceptionHandler(e, startingTag($compileNode));
+ }
+ }
+
+ if (directive.terminal) {
+ nodeLinkFn.terminal = true;
+ terminalPriority = Math.max(terminalPriority, directive.priority);
+ }
+
+ }
+
+ nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;
+ nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective;
+ nodeLinkFn.templateOnThisElement = hasTemplate;
+ nodeLinkFn.transclude = childTranscludeFn;
+
+ previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective;
+
+ // might be normal or delayed nodeLinkFn depending on if templateUrl is present
+ return nodeLinkFn;
+
+ ////////////////////
+
+ function addLinkFns(pre, post, attrStart, attrEnd) {
+ if (pre) {
+ if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);
+ pre.require = directive.require;
+ pre.directiveName = directiveName;
+ if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
+ pre = cloneAndAnnotateFn(pre, {isolateScope: true});
+ }
+ preLinkFns.push(pre);
+ }
+ if (post) {
+ if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);
+ post.require = directive.require;
+ post.directiveName = directiveName;
+ if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
+ post = cloneAndAnnotateFn(post, {isolateScope: true});
+ }
+ postLinkFns.push(post);
+ }
+ }
+
+
+ function getControllers(directiveName, require, $element, elementControllers) {
+ var value;
+
+ if (isString(require)) {
+ var match = require.match(REQUIRE_PREFIX_REGEXP);
+ var name = require.substring(match[0].length);
+ var inheritType = match[1] || match[3];
+ var optional = match[2] === '?';
+
+ //If only parents then start at the parent element
+ if (inheritType === '^^') {
+ $element = $element.parent();
+ //Otherwise attempt getting the controller from elementControllers in case
+ //the element is transcluded (and has no data) and to avoid .data if possible
+ } else {
+ value = elementControllers && elementControllers[name];
+ value = value && value.instance;
+ }
+
+ if (!value) {
+ var dataName = '$' + name + 'Controller';
+ value = inheritType ? $element.inheritedData(dataName) : $element.data(dataName);
+ }
+
+ if (!value && !optional) {
+ throw $compileMinErr('ctreq',
+ "Controller '{0}', required by directive '{1}', can't be found!",
+ name, directiveName);
+ }
+ } else if (isArray(require)) {
+ value = [];
+ for (var i = 0, ii = require.length; i < ii; i++) {
+ value[i] = getControllers(directiveName, require[i], $element, elementControllers);
+ }
+ } else if (isObject(require)) {
+ value = {};
+ forEach(require, function(controller, property) {
+ value[property] = getControllers(directiveName, controller, $element, elementControllers);
+ });
+ }
+
+ return value || null;
+ }
+
+ function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope) {
+ var elementControllers = createMap();
+ for (var controllerKey in controllerDirectives) {
+ var directive = controllerDirectives[controllerKey];
+ var locals = {
+ $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,
+ $element: $element,
+ $attrs: attrs,
+ $transclude: transcludeFn
+ };
+
+ var controller = directive.controller;
+ if (controller == '@') {
+ controller = attrs[directive.name];
+ }
+
+ var controllerInstance = $controller(controller, locals, true, directive.controllerAs);
+
+ // For directives with element transclusion the element is a comment,
+ // but jQuery .data doesn't support attaching data to comment nodes as it's hard to
+ // clean up (http://bugs.jquery.com/ticket/8335).
+ // Instead, we save the controllers for the element in a local hash and attach to .data
+ // later, once we have the actual element.
+ elementControllers[directive.name] = controllerInstance;
+ if (!hasElementTranscludeDirective) {
+ $element.data('$' + directive.name + 'Controller', controllerInstance.instance);
+ }
+ }
+ return elementControllers;
+ }
+
+ function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
+ var i, ii, linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element,
+ attrs, removeScopeBindingWatches, removeControllerBindingWatches;
+
+ if (compileNode === linkNode) {
+ attrs = templateAttrs;
+ $element = templateAttrs.$$element;
+ } else {
+ $element = jqLite(linkNode);
+ attrs = new Attributes($element, templateAttrs);
+ }
+
+ controllerScope = scope;
+ if (newIsolateScopeDirective) {
+ isolateScope = scope.$new(true);
+ } else if (newScopeDirective) {
+ controllerScope = scope.$parent;
+ }
+
+ if (boundTranscludeFn) {
+ // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn`
+ // is later passed as `parentBoundTranscludeFn` to `publicLinkFn`
+ transcludeFn = controllersBoundTransclude;
+ transcludeFn.$$boundTransclude = boundTranscludeFn;
+ // expose the slots on the `$transclude` function
+ transcludeFn.isSlotFilled = function(slotName) {
+ return !!boundTranscludeFn.$$slots[slotName];
+ };
+ }
+
+ if (controllerDirectives) {
+ elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope);
+ }
+
+ if (newIsolateScopeDirective) {
+ // Initialize isolate scope bindings for new isolate scope directive.
+ compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective ||
+ templateDirective === newIsolateScopeDirective.$$originalDirective)));
+ compile.$$addScopeClass($element, true);
+ isolateScope.$$isolateBindings =
+ newIsolateScopeDirective.$$isolateBindings;
+ removeScopeBindingWatches = initializeDirectiveBindings(scope, attrs, isolateScope,
+ isolateScope.$$isolateBindings,
+ newIsolateScopeDirective);
+ if (removeScopeBindingWatches) {
+ isolateScope.$on('$destroy', removeScopeBindingWatches);
+ }
+ }
+
+ // Initialize bindToController bindings
+ for (var name in elementControllers) {
+ var controllerDirective = controllerDirectives[name];
+ var controller = elementControllers[name];
+ var bindings = controllerDirective.$$bindings.bindToController;
+
+ if (controller.identifier && bindings) {
+ removeControllerBindingWatches =
+ initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
+ }
+
+ var controllerResult = controller();
+ if (controllerResult !== controller.instance) {
+ // If the controller constructor has a return value, overwrite the instance
+ // from setupControllers
+ controller.instance = controllerResult;
+ $element.data('$' + controllerDirective.name + 'Controller', controllerResult);
+ removeControllerBindingWatches && removeControllerBindingWatches();
+ removeControllerBindingWatches =
+ initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
+ }
+ }
+
+ // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy
+ forEach(controllerDirectives, function(controllerDirective, name) {
+ var require = controllerDirective.require;
+ if (controllerDirective.bindToController && !isArray(require) && isObject(require)) {
+ extend(elementControllers[name].instance, getControllers(name, require, $element, elementControllers));
+ }
+ });
+
+ // Trigger the `$onInit` method on all controllers that have one
+ forEach(elementControllers, function(controller) {
+ if (isFunction(controller.instance.$onInit)) {
+ controller.instance.$onInit();
+ }
+ });
+
+ // PRELINKING
+ for (i = 0, ii = preLinkFns.length; i < ii; i++) {
+ linkFn = preLinkFns[i];
+ invokeLinkFn(linkFn,
+ linkFn.isolateScope ? isolateScope : scope,
+ $element,
+ attrs,
+ linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),
+ transcludeFn
+ );
+ }
+
+ // RECURSION
+ // We only pass the isolate scope, if the isolate directive has a template,
+ // otherwise the child elements do not belong to the isolate directive.
+ var scopeToChild = scope;
+ if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {
+ scopeToChild = isolateScope;
+ }
+ childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);
+
+ // POSTLINKING
+ for (i = postLinkFns.length - 1; i >= 0; i--) {
+ linkFn = postLinkFns[i];
+ invokeLinkFn(linkFn,
+ linkFn.isolateScope ? isolateScope : scope,
+ $element,
+ attrs,
+ linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),
+ transcludeFn
+ );
+ }
+
+ // This is the function that is injected as `$transclude`.
+ // Note: all arguments are optional!
+ function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement, slotName) {
+ var transcludeControllers;
+ // No scope passed in:
+ if (!isScope(scope)) {
+ slotName = futureParentElement;
+ futureParentElement = cloneAttachFn;
+ cloneAttachFn = scope;
+ scope = undefined;
+ }
+
+ if (hasElementTranscludeDirective) {
+ transcludeControllers = elementControllers;
+ }
+ if (!futureParentElement) {
+ futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element;
+ }
+ if (slotName) {
+ // slotTranscludeFn can be one of three things:
+ // * a transclude function - a filled slot
+ // * `null` - an optional slot that was not filled
+ // * `undefined` - a slot that was not declared (i.e. invalid)
+ var slotTranscludeFn = boundTranscludeFn.$$slots[slotName];
+ if (slotTranscludeFn) {
+ return slotTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);
+ } else if (isUndefined(slotTranscludeFn)) {
+ throw $compileMinErr('noslot',
+ 'No parent directive that requires a transclusion with slot name "{0}". ' +
+ 'Element: {1}',
+ slotName, startingTag($element));
+ }
+ } else {
+ return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);
+ }
+ }
+ }
+ }
+
+ // Depending upon the context in which a directive finds itself it might need to have a new isolated
+ // or child scope created. For instance:
+ // * if the directive has been pulled into a template because another directive with a higher priority
+ // asked for element transclusion
+ // * if the directive itself asks for transclusion but it is at the root of a template and the original
+ // element was replaced. See https://github.com/angular/angular.js/issues/12936
+ function markDirectiveScope(directives, isolateScope, newScope) {
+ for (var j = 0, jj = directives.length; j < jj; j++) {
+ directives[j] = inherit(directives[j], {$$isolateScope: isolateScope, $$newScope: newScope});
+ }
+ }
+
+ /**
+ * looks up the directive and decorates it with exception handling and proper parameters. We
+ * call this the boundDirective.
+ *
+ * @param {string} name name of the directive to look up.
+ * @param {string} location The directive must be found in specific format.
+ * String containing any of theses characters:
+ *
+ * * `E`: element name
+ * * `A': attribute
+ * * `C`: class
+ * * `M`: comment
+ * @returns {boolean} true if directive was added.
+ */
+ function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,
+ endAttrName) {
+ if (name === ignoreDirective) return null;
+ var match = null;
+ if (hasDirectives.hasOwnProperty(name)) {
+ for (var directive, directives = $injector.get(name + Suffix),
+ i = 0, ii = directives.length; i < ii; i++) {
+ try {
+ directive = directives[i];
+ if ((isUndefined(maxPriority) || maxPriority > directive.priority) &&
+ directive.restrict.indexOf(location) != -1) {
+ if (startAttrName) {
+ directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});
+ }
+ tDirectives.push(directive);
+ match = directive;
+ }
+ } catch (e) { $exceptionHandler(e); }
+ }
+ }
+ return match;
+ }
+
+
+ /**
+ * looks up the directive and returns true if it is a multi-element directive,
+ * and therefore requires DOM nodes between -start and -end markers to be grouped
+ * together.
+ *
+ * @param {string} name name of the directive to look up.
+ * @returns true if directive was registered as multi-element.
+ */
+ function directiveIsMultiElement(name) {
+ if (hasDirectives.hasOwnProperty(name)) {
+ for (var directive, directives = $injector.get(name + Suffix),
+ i = 0, ii = directives.length; i < ii; i++) {
+ directive = directives[i];
+ if (directive.multiElement) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * When the element is replaced with HTML template then the new attributes
+ * on the template need to be merged with the existing attributes in the DOM.
+ * The desired effect is to have both of the attributes present.
+ *
+ * @param {object} dst destination attributes (original DOM)
+ * @param {object} src source attributes (from the directive template)
+ */
+ function mergeTemplateAttributes(dst, src) {
+ var srcAttr = src.$attr,
+ dstAttr = dst.$attr,
+ $element = dst.$$element;
+
+ // reapply the old attributes to the new element
+ forEach(dst, function(value, key) {
+ if (key.charAt(0) != '$') {
+ if (src[key] && src[key] !== value) {
+ value += (key === 'style' ? ';' : ' ') + src[key];
+ }
+ dst.$set(key, value, true, srcAttr[key]);
+ }
+ });
+
+ // copy the new attributes on the old attrs object
+ forEach(src, function(value, key) {
+ if (key == 'class') {
+ safeAddClass($element, value);
+ dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;
+ } else if (key == 'style') {
+ $element.attr('style', $element.attr('style') + ';' + value);
+ dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;
+ // `dst` will never contain hasOwnProperty as DOM parser won't let it.
+ // You will get an "InvalidCharacterError: DOM Exception 5" error if you
+ // have an attribute like "has-own-property" or "data-has-own-property", etc.
+ } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {
+ dst[key] = value;
+ dstAttr[key] = srcAttr[key];
+ }
+ });
+ }
+
+
+ function compileTemplateUrl(directives, $compileNode, tAttrs,
+ $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {
+ var linkQueue = [],
+ afterTemplateNodeLinkFn,
+ afterTemplateChildLinkFn,
+ beforeTemplateCompileNode = $compileNode[0],
+ origAsyncDirective = directives.shift(),
+ derivedSyncDirective = inherit(origAsyncDirective, {
+ templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective
+ }),
+ templateUrl = (isFunction(origAsyncDirective.templateUrl))
+ ? origAsyncDirective.templateUrl($compileNode, tAttrs)
+ : origAsyncDirective.templateUrl,
+ templateNamespace = origAsyncDirective.templateNamespace;
+
+ $compileNode.empty();
+
+ $templateRequest(templateUrl)
+ .then(function(content) {
+ var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;
+
+ content = denormalizeTemplate(content);
+
+ if (origAsyncDirective.replace) {
+ if (jqLiteIsTextNode(content)) {
+ $template = [];
+ } else {
+ $template = removeComments(wrapTemplate(templateNamespace, trim(content)));
+ }
+ compileNode = $template[0];
+
+ if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
+ throw $compileMinErr('tplrt',
+ "Template for directive '{0}' must have exactly one root element. {1}",
+ origAsyncDirective.name, templateUrl);
+ }
+
+ tempTemplateAttrs = {$attr: {}};
+ replaceWith($rootElement, $compileNode, compileNode);
+ var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);
+
+ if (isObject(origAsyncDirective.scope)) {
+ // the original directive that caused the template to be loaded async required
+ // an isolate scope
+ markDirectiveScope(templateDirectives, true);
+ }
+ directives = templateDirectives.concat(directives);
+ mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
+ } else {
+ compileNode = beforeTemplateCompileNode;
+ $compileNode.html(content);
+ }
+
+ directives.unshift(derivedSyncDirective);
+
+ afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,
+ childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,
+ previousCompileContext);
+ forEach($rootElement, function(node, i) {
+ if (node == compileNode) {
+ $rootElement[i] = $compileNode[0];
+ }
+ });
+ afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);
+
+ while (linkQueue.length) {
+ var scope = linkQueue.shift(),
+ beforeTemplateLinkNode = linkQueue.shift(),
+ linkRootElement = linkQueue.shift(),
+ boundTranscludeFn = linkQueue.shift(),
+ linkNode = $compileNode[0];
+
+ if (scope.$$destroyed) continue;
+
+ if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {
+ var oldClasses = beforeTemplateLinkNode.className;
+
+ if (!(previousCompileContext.hasElementTranscludeDirective &&
+ origAsyncDirective.replace)) {
+ // it was cloned therefore we have to clone as well.
+ linkNode = jqLiteClone(compileNode);
+ }
+ replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);
+
+ // Copy in CSS classes from original node
+ safeAddClass(jqLite(linkNode), oldClasses);
+ }
+ if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);
+ } else {
+ childBoundTranscludeFn = boundTranscludeFn;
+ }
+ afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,
+ childBoundTranscludeFn);
+ }
+ linkQueue = null;
+ });
+
+ return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {
+ var childBoundTranscludeFn = boundTranscludeFn;
+ if (scope.$$destroyed) return;
+ if (linkQueue) {
+ linkQueue.push(scope,
+ node,
+ rootElement,
+ childBoundTranscludeFn);
+ } else {
+ if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);
+ }
+ afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn);
+ }
+ };
+ }
+
+
+ /**
+ * Sorting function for bound directives.
+ */
+ function byPriority(a, b) {
+ var diff = b.priority - a.priority;
+ if (diff !== 0) return diff;
+ if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;
+ return a.index - b.index;
+ }
+
+ function assertNoDuplicate(what, previousDirective, directive, element) {
+
+ function wrapModuleNameIfDefined(moduleName) {
+ return moduleName ?
+ (' (module: ' + moduleName + ')') :
+ '';
+ }
+
+ if (previousDirective) {
+ throw $compileMinErr('multidir', 'Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}',
+ previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName),
+ directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element));
+ }
+ }
+
+
+ function addTextInterpolateDirective(directives, text) {
+ var interpolateFn = $interpolate(text, true);
+ if (interpolateFn) {
+ directives.push({
+ priority: 0,
+ compile: function textInterpolateCompileFn(templateNode) {
+ var templateNodeParent = templateNode.parent(),
+ hasCompileParent = !!templateNodeParent.length;
+
+ // When transcluding a template that has bindings in the root
+ // we don't have a parent and thus need to add the class during linking fn.
+ if (hasCompileParent) compile.$$addBindingClass(templateNodeParent);
+
+ return function textInterpolateLinkFn(scope, node) {
+ var parent = node.parent();
+ if (!hasCompileParent) compile.$$addBindingClass(parent);
+ compile.$$addBindingInfo(parent, interpolateFn.expressions);
+ scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {
+ node[0].nodeValue = value;
+ });
+ };
+ }
+ });
+ }
+ }
+
+
+ function wrapTemplate(type, template) {
+ type = lowercase(type || 'html');
+ switch (type) {
+ case 'svg':
+ case 'math':
+ var wrapper = document.createElement('div');
+ wrapper.innerHTML = '<' + type + '>' + template + '</' + type + '>';
+ return wrapper.childNodes[0].childNodes;
+ default:
+ return template;
+ }
+ }
+
+
+ function getTrustedContext(node, attrNormalizedName) {
+ if (attrNormalizedName == "srcdoc") {
+ return $sce.HTML;
+ }
+ var tag = nodeName_(node);
+ // maction[xlink:href] can source SVG. It's not limited to <maction>.
+ if (attrNormalizedName == "xlinkHref" ||
+ (tag == "form" && attrNormalizedName == "action") ||
+ (tag != "img" && (attrNormalizedName == "src" ||
+ attrNormalizedName == "ngSrc"))) {
+ return $sce.RESOURCE_URL;
+ }
+ }
+
+
+ function addAttrInterpolateDirective(node, directives, value, name, allOrNothing) {
+ var trustedContext = getTrustedContext(node, name);
+ allOrNothing = ALL_OR_NOTHING_ATTRS[name] || allOrNothing;
+
+ var interpolateFn = $interpolate(value, true, trustedContext, allOrNothing);
+
+ // no interpolation found -> ignore
+ if (!interpolateFn) return;
+
+
+ if (name === "multiple" && nodeName_(node) === "select") {
+ throw $compileMinErr("selmulti",
+ "Binding to the 'multiple' attribute is not supported. Element: {0}",
+ startingTag(node));
+ }
+
+ directives.push({
+ priority: 100,
+ compile: function() {
+ return {
+ pre: function attrInterpolatePreLinkFn(scope, element, attr) {
+ var $$observers = (attr.$$observers || (attr.$$observers = createMap()));
+
+ if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {
+ throw $compileMinErr('nodomevents',
+ "Interpolations for HTML DOM event attributes are disallowed. Please use the " +
+ "ng- versions (such as ng-click instead of onclick) instead.");
+ }
+
+ // If the attribute has changed since last $interpolate()ed
+ var newValue = attr[name];
+ if (newValue !== value) {
+ // we need to interpolate again since the attribute value has been updated
+ // (e.g. by another directive's compile function)
+ // ensure unset/empty values make interpolateFn falsy
+ interpolateFn = newValue && $interpolate(newValue, true, trustedContext, allOrNothing);
+ value = newValue;
+ }
+
+ // if attribute was updated so that there is no interpolation going on we don't want to
+ // register any observers
+ if (!interpolateFn) return;
+
+ // initialize attr object so that it's ready in case we need the value for isolate
+ // scope initialization, otherwise the value would not be available from isolate
+ // directive's linking fn during linking phase
+ attr[name] = interpolateFn(scope);
+
+ ($$observers[name] || ($$observers[name] = [])).$$inter = true;
+ (attr.$$observers && attr.$$observers[name].$$scope || scope).
+ $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {
+ //special case for class attribute addition + removal
+ //so that class changes can tap into the animation
+ //hooks provided by the $animate service. Be sure to
+ //skip animations when the first digest occurs (when
+ //both the new and the old values are the same) since
+ //the CSS classes are the non-interpolated values
+ if (name === 'class' && newValue != oldValue) {
+ attr.$updateClass(newValue, oldValue);
+ } else {
+ attr.$set(name, newValue);
+ }
+ });
+ }
+ };
+ }
+ });
+ }
+
+
+ /**
+ * This is a special jqLite.replaceWith, which can replace items which
+ * have no parents, provided that the containing jqLite collection is provided.
+ *
+ * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
+ * in the root of the tree.
+ * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep
+ * the shell, but replace its DOM node reference.
+ * @param {Node} newNode The new DOM node.
+ */
+ function replaceWith($rootElement, elementsToRemove, newNode) {
+ var firstElementToRemove = elementsToRemove[0],
+ removeCount = elementsToRemove.length,
+ parent = firstElementToRemove.parentNode,
+ i, ii;
+
+ if ($rootElement) {
+ for (i = 0, ii = $rootElement.length; i < ii; i++) {
+ if ($rootElement[i] == firstElementToRemove) {
+ $rootElement[i++] = newNode;
+ for (var j = i, j2 = j + removeCount - 1,
+ jj = $rootElement.length;
+ j < jj; j++, j2++) {
+ if (j2 < jj) {
+ $rootElement[j] = $rootElement[j2];
+ } else {
+ delete $rootElement[j];
+ }
+ }
+ $rootElement.length -= removeCount - 1;
+
+ // If the replaced element is also the jQuery .context then replace it
+ // .context is a deprecated jQuery api, so we should set it only when jQuery set it
+ // http://api.jquery.com/context/
+ if ($rootElement.context === firstElementToRemove) {
+ $rootElement.context = newNode;
+ }
+ break;
+ }
+ }
+ }
+
+ if (parent) {
+ parent.replaceChild(newNode, firstElementToRemove);
+ }
+
+ // Append all the `elementsToRemove` to a fragment. This will...
+ // - remove them from the DOM
+ // - allow them to still be traversed with .nextSibling
+ // - allow a single fragment.qSA to fetch all elements being removed
+ var fragment = document.createDocumentFragment();
+ for (i = 0; i < removeCount; i++) {
+ fragment.appendChild(elementsToRemove[i]);
+ }
+
+ if (jqLite.hasData(firstElementToRemove)) {
+ // Copy over user data (that includes Angular's $scope etc.). Don't copy private
+ // data here because there's no public interface in jQuery to do that and copying over
+ // event listeners (which is the main use of private data) wouldn't work anyway.
+ jqLite.data(newNode, jqLite.data(firstElementToRemove));
+
+ // Remove $destroy event listeners from `firstElementToRemove`
+ jqLite(firstElementToRemove).off('$destroy');
+ }
+
+ // Cleanup any data/listeners on the elements and children.
+ // This includes invoking the $destroy event on any elements with listeners.
+ jqLite.cleanData(fragment.querySelectorAll('*'));
+
+ // Update the jqLite collection to only contain the `newNode`
+ for (i = 1; i < removeCount; i++) {
+ delete elementsToRemove[i];
+ }
+ elementsToRemove[0] = newNode;
+ elementsToRemove.length = 1;
+ }
+
+
+ function cloneAndAnnotateFn(fn, annotation) {
+ return extend(function() { return fn.apply(null, arguments); }, fn, annotation);
+ }
+
+
+ function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) {
+ try {
+ linkFn(scope, $element, attrs, controllers, transcludeFn);
+ } catch (e) {
+ $exceptionHandler(e, startingTag($element));
+ }
+ }
+
+
+ // Set up $watches for isolate scope and controller bindings. This process
+ // only occurs for isolate scopes and new scopes with controllerAs.
+ function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) {
+ var removeWatchCollection = [];
+ forEach(bindings, function(definition, scopeName) {
+ var attrName = definition.attrName,
+ optional = definition.optional,
+ mode = definition.mode, // @, =, or &
+ lastValue,
+ parentGet, parentSet, compare, removeWatch;
+
+ switch (mode) {
+
+ case '@':
+ if (!optional && !hasOwnProperty.call(attrs, attrName)) {
+ destination[scopeName] = attrs[attrName] = void 0;
+ }
+ attrs.$observe(attrName, function(value) {
+ if (isString(value)) {
+ destination[scopeName] = value;
+ }
+ });
+ attrs.$$observers[attrName].$$scope = scope;
+ lastValue = attrs[attrName];
+ if (isString(lastValue)) {
+ // If the attribute has been provided then we trigger an interpolation to ensure
+ // the value is there for use in the link fn
+ destination[scopeName] = $interpolate(lastValue)(scope);
+ } else if (isBoolean(lastValue)) {
+ // If the attributes is one of the BOOLEAN_ATTR then Angular will have converted
+ // the value to boolean rather than a string, so we special case this situation
+ destination[scopeName] = lastValue;
+ }
+ break;
+
+ case '=':
+ if (!hasOwnProperty.call(attrs, attrName)) {
+ if (optional) break;
+ attrs[attrName] = void 0;
+ }
+ if (optional && !attrs[attrName]) break;
+
+ parentGet = $parse(attrs[attrName]);
+ if (parentGet.literal) {
+ compare = equals;
+ } else {
+ compare = function(a, b) { return a === b || (a !== a && b !== b); };
+ }
+ parentSet = parentGet.assign || function() {
+ // reset the change, or we will throw this exception on every $digest
+ lastValue = destination[scopeName] = parentGet(scope);
+ throw $compileMinErr('nonassign',
+ "Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!",
+ attrs[attrName], attrName, directive.name);
+ };
+ lastValue = destination[scopeName] = parentGet(scope);
+ var parentValueWatch = function parentValueWatch(parentValue) {
+ if (!compare(parentValue, destination[scopeName])) {
+ // we are out of sync and need to copy
+ if (!compare(parentValue, lastValue)) {
+ // parent changed and it has precedence
+ destination[scopeName] = parentValue;
+ } else {
+ // if the parent can be assigned then do so
+ parentSet(scope, parentValue = destination[scopeName]);
+ }
+ }
+ return lastValue = parentValue;
+ };
+ parentValueWatch.$stateful = true;
+ if (definition.collection) {
+ removeWatch = scope.$watchCollection(attrs[attrName], parentValueWatch);
+ } else {
+ removeWatch = scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal);
+ }
+ removeWatchCollection.push(removeWatch);
+ break;
+
+ case '<':
+ if (!hasOwnProperty.call(attrs, attrName)) {
+ if (optional) break;
+ attrs[attrName] = void 0;
+ }
+ if (optional && !attrs[attrName]) break;
+
+ parentGet = $parse(attrs[attrName]);
+
+ destination[scopeName] = parentGet(scope);
+
+ removeWatch = scope.$watch(parentGet, function parentValueWatchAction(newParentValue) {
+ destination[scopeName] = newParentValue;
+ }, parentGet.literal);
+
+ removeWatchCollection.push(removeWatch);
+ break;
+
+ case '&':
+ // Don't assign Object.prototype method to scope
+ parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop;
+
+ // Don't assign noop to destination if expression is not valid
+ if (parentGet === noop && optional) break;
+
+ destination[scopeName] = function(locals) {
+ return parentGet(scope, locals);
+ };
+ break;
+ }
+ });
+
+ return removeWatchCollection.length && function removeWatches() {
+ for (var i = 0, ii = removeWatchCollection.length; i < ii; ++i) {
+ removeWatchCollection[i]();
+ }
+ };
+ }
+ }];
+}
+
+var PREFIX_REGEXP = /^((?:x|data)[\:\-_])/i;
+/**
+ * Converts all accepted directives format into proper directive name.
+ * @param name Name to normalize
+ */
+function directiveNormalize(name) {
+ return camelCase(name.replace(PREFIX_REGEXP, ''));
+}
+
+/**
+ * @ngdoc type
+ * @name $compile.directive.Attributes
+ *
+ * @description
+ * A shared object between directive compile / linking functions which contains normalized DOM
+ * element attributes. The values reflect current binding state `{{ }}`. The normalization is
+ * needed since all of these are treated as equivalent in Angular:
+ *
+ * ```
+ * <span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a">
+ * ```
+ */
+
+/**
+ * @ngdoc property
+ * @name $compile.directive.Attributes#$attr
+ *
+ * @description
+ * A map of DOM element attribute names to the normalized name. This is
+ * needed to do reverse lookup from normalized name back to actual name.
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$set
+ * @kind function
+ *
+ * @description
+ * Set DOM element attribute value.
+ *
+ *
+ * @param {string} name Normalized element attribute name of the property to modify. The name is
+ * reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}
+ * property to the original name.
+ * @param {string} value Value to set the attribute to. The value can be an interpolated string.
+ */
+
+
+
+/**
+ * Closure compiler type information
+ */
+
+function nodesetLinkingFn(
+ /* angular.Scope */ scope,
+ /* NodeList */ nodeList,
+ /* Element */ rootElement,
+ /* function(Function) */ boundTranscludeFn
+) {}
+
+function directiveLinkingFn(
+ /* nodesetLinkingFn */ nodesetLinkingFn,
+ /* angular.Scope */ scope,
+ /* Node */ node,
+ /* Element */ rootElement,
+ /* function(Function) */ boundTranscludeFn
+) {}
+
+function tokenDifference(str1, str2) {
+ var values = '',
+ tokens1 = str1.split(/\s+/),
+ tokens2 = str2.split(/\s+/);
+
+ outer:
+ for (var i = 0; i < tokens1.length; i++) {
+ var token = tokens1[i];
+ for (var j = 0; j < tokens2.length; j++) {
+ if (token == tokens2[j]) continue outer;
+ }
+ values += (values.length > 0 ? ' ' : '') + token;
+ }
+ return values;
+}
+
+function removeComments(jqNodes) {
+ jqNodes = jqLite(jqNodes);
+ var i = jqNodes.length;
+
+ if (i <= 1) {
+ return jqNodes;
+ }
+
+ while (i--) {
+ var node = jqNodes[i];
+ if (node.nodeType === NODE_TYPE_COMMENT) {
+ splice.call(jqNodes, i, 1);
+ }
+ }
+ return jqNodes;
+}
+
+var $controllerMinErr = minErr('$controller');
+
+
+var CNTRL_REG = /^(\S+)(\s+as\s+([\w$]+))?$/;
+function identifierForController(controller, ident) {
+ if (ident && isString(ident)) return ident;
+ if (isString(controller)) {
+ var match = CNTRL_REG.exec(controller);
+ if (match) return match[3];
+ }
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $controllerProvider
+ * @description
+ * The {@link ng.$controller $controller service} is used by Angular to create new
+ * controllers.
+ *
+ * This provider allows controller registration via the
+ * {@link ng.$controllerProvider#register register} method.
+ */
+function $ControllerProvider() {
+ var controllers = {},
+ globals = false;
+
+ /**
+ * @ngdoc method
+ * @name $controllerProvider#register
+ * @param {string|Object} name Controller name, or an object map of controllers where the keys are
+ * the names and the values are the constructors.
+ * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI
+ * annotations in the array notation).
+ */
+ this.register = function(name, constructor) {
+ assertNotHasOwnProperty(name, 'controller');
+ if (isObject(name)) {
+ extend(controllers, name);
+ } else {
+ controllers[name] = constructor;
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $controllerProvider#allowGlobals
+ * @description If called, allows `$controller` to find controller constructors on `window`
+ */
+ this.allowGlobals = function() {
+ globals = true;
+ };
+
+
+ this.$get = ['$injector', '$window', function($injector, $window) {
+
+ /**
+ * @ngdoc service
+ * @name $controller
+ * @requires $injector
+ *
+ * @param {Function|string} constructor If called with a function then it's considered to be the
+ * controller constructor function. Otherwise it's considered to be a string which is used
+ * to retrieve the controller constructor using the following steps:
+ *
+ * * check if a controller with given name is registered via `$controllerProvider`
+ * * check if evaluating the string on the current scope returns a constructor
+ * * if $controllerProvider#allowGlobals, check `window[constructor]` on the global
+ * `window` object (not recommended)
+ *
+ * The string can use the `controller as property` syntax, where the controller instance is published
+ * as the specified property on the `scope`; the `scope` must be injected into `locals` param for this
+ * to work correctly.
+ *
+ * @param {Object} locals Injection locals for Controller.
+ * @return {Object} Instance of given controller.
+ *
+ * @description
+ * `$controller` service is responsible for instantiating controllers.
+ *
+ * It's just a simple call to {@link auto.$injector $injector}, but extracted into
+ * a service, so that one can override this service with [BC version](https://gist.github.com/1649788).
+ */
+ return function(expression, locals, later, ident) {
+ // PRIVATE API:
+ // param `later` --- indicates that the controller's constructor is invoked at a later time.
+ // If true, $controller will allocate the object with the correct
+ // prototype chain, but will not invoke the controller until a returned
+ // callback is invoked.
+ // param `ident` --- An optional label which overrides the label parsed from the controller
+ // expression, if any.
+ var instance, match, constructor, identifier;
+ later = later === true;
+ if (ident && isString(ident)) {
+ identifier = ident;
+ }
+
+ if (isString(expression)) {
+ match = expression.match(CNTRL_REG);
+ if (!match) {
+ throw $controllerMinErr('ctrlfmt',
+ "Badly formed controller string '{0}'. " +
+ "Must match `__name__ as __id__` or `__name__`.", expression);
+ }
+ constructor = match[1],
+ identifier = identifier || match[3];
+ expression = controllers.hasOwnProperty(constructor)
+ ? controllers[constructor]
+ : getter(locals.$scope, constructor, true) ||
+ (globals ? getter($window, constructor, true) : undefined);
+
+ assertArgFn(expression, constructor, true);
+ }
+
+ if (later) {
+ // Instantiate controller later:
+ // This machinery is used to create an instance of the object before calling the
+ // controller's constructor itself.
+ //
+ // This allows properties to be added to the controller before the constructor is
+ // invoked. Primarily, this is used for isolate scope bindings in $compile.
+ //
+ // This feature is not intended for use by applications, and is thus not documented
+ // publicly.
+ // Object creation: http://jsperf.com/create-constructor/2
+ var controllerPrototype = (isArray(expression) ?
+ expression[expression.length - 1] : expression).prototype;
+ instance = Object.create(controllerPrototype || null);
+
+ if (identifier) {
+ addIdentifier(locals, identifier, instance, constructor || expression.name);
+ }
+
+ var instantiate;
+ return instantiate = extend(function() {
+ var result = $injector.invoke(expression, instance, locals, constructor);
+ if (result !== instance && (isObject(result) || isFunction(result))) {
+ instance = result;
+ if (identifier) {
+ // If result changed, re-assign controllerAs value to scope.
+ addIdentifier(locals, identifier, instance, constructor || expression.name);
+ }
+ }
+ return instance;
+ }, {
+ instance: instance,
+ identifier: identifier
+ });
+ }
+
+ instance = $injector.instantiate(expression, locals, constructor);
+
+ if (identifier) {
+ addIdentifier(locals, identifier, instance, constructor || expression.name);
+ }
+
+ return instance;
+ };
+
+ function addIdentifier(locals, identifier, instance, name) {
+ if (!(locals && isObject(locals.$scope))) {
+ throw minErr('$controller')('noscp',
+ "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",
+ name, identifier);
+ }
+
+ locals.$scope[identifier] = instance;
+ }
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $document
+ * @requires $window
+ *
+ * @description
+ * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.
+ *
+ * @example
+ <example module="documentExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <p>$document title: <b ng-bind="title"></b></p>
+ <p>window.document title: <b ng-bind="windowTitle"></b></p>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('documentExample', [])
+ .controller('ExampleController', ['$scope', '$document', function($scope, $document) {
+ $scope.title = $document[0].title;
+ $scope.windowTitle = angular.element(window.document)[0].title;
+ }]);
+ </file>
+ </example>
+ */
+function $DocumentProvider() {
+ this.$get = ['$window', function(window) {
+ return jqLite(window.document);
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $exceptionHandler
+ * @requires ng.$log
+ *
+ * @description
+ * Any uncaught exception in angular expressions is delegated to this service.
+ * The default implementation simply delegates to `$log.error` which logs it into
+ * the browser console.
+ *
+ * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by
+ * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.
+ *
+ * ## Example:
+ *
+ * ```js
+ * angular.module('exceptionOverride', []).factory('$exceptionHandler', function() {
+ * return function(exception, cause) {
+ * exception.message += ' (caused by "' + cause + '")';
+ * throw exception;
+ * };
+ * });
+ * ```
+ *
+ * This example will override the normal action of `$exceptionHandler`, to make angular
+ * exceptions fail hard when they happen, instead of just logging to the console.
+ *
+ * <hr />
+ * Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind`
+ * methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler}
+ * (unless executed during a digest).
+ *
+ * If you wish, you can manually delegate exceptions, e.g.
+ * `try { ... } catch(e) { $exceptionHandler(e); }`
+ *
+ * @param {Error} exception Exception associated with the error.
+ * @param {string=} cause optional information about the context in which
+ * the error was thrown.
+ *
+ */
+function $ExceptionHandlerProvider() {
+ this.$get = ['$log', function($log) {
+ return function(exception, cause) {
+ $log.error.apply($log, arguments);
+ };
+ }];
+}
+
+var $$ForceReflowProvider = function() {
+ this.$get = ['$document', function($document) {
+ return function(domNode) {
+ //the line below will force the browser to perform a repaint so
+ //that all the animated elements within the animation frame will
+ //be properly updated and drawn on screen. This is required to
+ //ensure that the preparation animation is properly flushed so that
+ //the active state picks up from there. DO NOT REMOVE THIS LINE.
+ //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH
+ //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND
+ //WILL TAKE YEARS AWAY FROM YOUR LIFE.
+ if (domNode) {
+ if (!domNode.nodeType && domNode instanceof jqLite) {
+ domNode = domNode[0];
+ }
+ } else {
+ domNode = $document[0].body;
+ }
+ return domNode.offsetWidth + 1;
+ };
+ }];
+};
+
+var APPLICATION_JSON = 'application/json';
+var CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': APPLICATION_JSON + ';charset=utf-8'};
+var JSON_START = /^\[|^\{(?!\{)/;
+var JSON_ENDS = {
+ '[': /]$/,
+ '{': /}$/
+};
+var JSON_PROTECTION_PREFIX = /^\)\]\}',?\n/;
+var $httpMinErr = minErr('$http');
+var $httpMinErrLegacyFn = function(method) {
+ return function() {
+ throw $httpMinErr('legacy', 'The method `{0}` on the promise returned from `$http` has been disabled.', method);
+ };
+};
+
+function serializeValue(v) {
+ if (isObject(v)) {
+ return isDate(v) ? v.toISOString() : toJson(v);
+ }
+ return v;
+}
+
+
+function $HttpParamSerializerProvider() {
+ /**
+ * @ngdoc service
+ * @name $httpParamSerializer
+ * @description
+ *
+ * Default {@link $http `$http`} params serializer that converts objects to strings
+ * according to the following rules:
+ *
+ * * `{'foo': 'bar'}` results in `foo=bar`
+ * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object)
+ * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element)
+ * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D"` (stringified and encoded representation of an object)
+ *
+ * Note that serializer will sort the request parameters alphabetically.
+ * */
+
+ this.$get = function() {
+ return function ngParamSerializer(params) {
+ if (!params) return '';
+ var parts = [];
+ forEachSorted(params, function(value, key) {
+ if (value === null || isUndefined(value)) return;
+ if (isArray(value)) {
+ forEach(value, function(v, k) {
+ parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v)));
+ });
+ } else {
+ parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value)));
+ }
+ });
+
+ return parts.join('&');
+ };
+ };
+}
+
+function $HttpParamSerializerJQLikeProvider() {
+ /**
+ * @ngdoc service
+ * @name $httpParamSerializerJQLike
+ * @description
+ *
+ * Alternative {@link $http `$http`} params serializer that follows
+ * jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.
+ * The serializer will also sort the params alphabetically.
+ *
+ * To use it for serializing `$http` request parameters, set it as the `paramSerializer` property:
+ *
+ * ```js
+ * $http({
+ * url: myUrl,
+ * method: 'GET',
+ * params: myParams,
+ * paramSerializer: '$httpParamSerializerJQLike'
+ * });
+ * ```
+ *
+ * It is also possible to set it as the default `paramSerializer` in the
+ * {@link $httpProvider#defaults `$httpProvider`}.
+ *
+ * Additionally, you can inject the serializer and use it explicitly, for example to serialize
+ * form data for submission:
+ *
+ * ```js
+ * .controller(function($http, $httpParamSerializerJQLike) {
+ * //...
+ *
+ * $http({
+ * url: myUrl,
+ * method: 'POST',
+ * data: $httpParamSerializerJQLike(myData),
+ * headers: {
+ * 'Content-Type': 'application/x-www-form-urlencoded'
+ * }
+ * });
+ *
+ * });
+ * ```
+ *
+ * */
+ this.$get = function() {
+ return function jQueryLikeParamSerializer(params) {
+ if (!params) return '';
+ var parts = [];
+ serialize(params, '', true);
+ return parts.join('&');
+
+ function serialize(toSerialize, prefix, topLevel) {
+ if (toSerialize === null || isUndefined(toSerialize)) return;
+ if (isArray(toSerialize)) {
+ forEach(toSerialize, function(value, index) {
+ serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']');
+ });
+ } else if (isObject(toSerialize) && !isDate(toSerialize)) {
+ forEachSorted(toSerialize, function(value, key) {
+ serialize(value, prefix +
+ (topLevel ? '' : '[') +
+ key +
+ (topLevel ? '' : ']'));
+ });
+ } else {
+ parts.push(encodeUriQuery(prefix) + '=' + encodeUriQuery(serializeValue(toSerialize)));
+ }
+ }
+ };
+ };
+}
+
+function defaultHttpResponseTransform(data, headers) {
+ if (isString(data)) {
+ // Strip json vulnerability protection prefix and trim whitespace
+ var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim();
+
+ if (tempData) {
+ var contentType = headers('Content-Type');
+ if ((contentType && (contentType.indexOf(APPLICATION_JSON) === 0)) || isJsonLike(tempData)) {
+ data = fromJson(tempData);
+ }
+ }
+ }
+
+ return data;
+}
+
+function isJsonLike(str) {
+ var jsonStart = str.match(JSON_START);
+ return jsonStart && JSON_ENDS[jsonStart[0]].test(str);
+}
+
+/**
+ * Parse headers into key value object
+ *
+ * @param {string} headers Raw headers as a string
+ * @returns {Object} Parsed headers as key value object
+ */
+function parseHeaders(headers) {
+ var parsed = createMap(), i;
+
+ function fillInParsed(key, val) {
+ if (key) {
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
+ }
+ }
+
+ if (isString(headers)) {
+ forEach(headers.split('\n'), function(line) {
+ i = line.indexOf(':');
+ fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));
+ });
+ } else if (isObject(headers)) {
+ forEach(headers, function(headerVal, headerKey) {
+ fillInParsed(lowercase(headerKey), trim(headerVal));
+ });
+ }
+
+ return parsed;
+}
+
+
+/**
+ * Returns a function that provides access to parsed headers.
+ *
+ * Headers are lazy parsed when first requested.
+ * @see parseHeaders
+ *
+ * @param {(string|Object)} headers Headers to provide access to.
+ * @returns {function(string=)} Returns a getter function which if called with:
+ *
+ * - if called with single an argument returns a single header value or null
+ * - if called with no arguments returns an object containing all headers.
+ */
+function headersGetter(headers) {
+ var headersObj;
+
+ return function(name) {
+ if (!headersObj) headersObj = parseHeaders(headers);
+
+ if (name) {
+ var value = headersObj[lowercase(name)];
+ if (value === void 0) {
+ value = null;
+ }
+ return value;
+ }
+
+ return headersObj;
+ };
+}
+
+
+/**
+ * Chain all given functions
+ *
+ * This function is used for both request and response transforming
+ *
+ * @param {*} data Data to transform.
+ * @param {function(string=)} headers HTTP headers getter fn.
+ * @param {number} status HTTP status code of the response.
+ * @param {(Function|Array.<Function>)} fns Function or an array of functions.
+ * @returns {*} Transformed data.
+ */
+function transformData(data, headers, status, fns) {
+ if (isFunction(fns)) {
+ return fns(data, headers, status);
+ }
+
+ forEach(fns, function(fn) {
+ data = fn(data, headers, status);
+ });
+
+ return data;
+}
+
+
+function isSuccess(status) {
+ return 200 <= status && status < 300;
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $httpProvider
+ * @description
+ * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
+ * */
+function $HttpProvider() {
+ /**
+ * @ngdoc property
+ * @name $httpProvider#defaults
+ * @description
+ *
+ * Object containing default values for all {@link ng.$http $http} requests.
+ *
+ * - **`defaults.cache`** - {Object} - an object built with {@link ng.$cacheFactory `$cacheFactory`}
+ * that will provide the cache for all requests who set their `cache` property to `true`.
+ * If you set the `defaults.cache = false` then only requests that specify their own custom
+ * cache object will be cached. See {@link $http#caching $http Caching} for more information.
+ *
+ * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
+ * Defaults value is `'XSRF-TOKEN'`.
+ *
+ * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
+ * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
+ *
+ * - **`defaults.headers`** - {Object} - Default headers for all $http requests.
+ * Refer to {@link ng.$http#setting-http-headers $http} for documentation on
+ * setting default headers.
+ * - **`defaults.headers.common`**
+ * - **`defaults.headers.post`**
+ * - **`defaults.headers.put`**
+ * - **`defaults.headers.patch`**
+ *
+ *
+ * - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function
+ * used to the prepare string representation of request parameters (specified as an object).
+ * If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.
+ * Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.
+ *
+ **/
+ var defaults = this.defaults = {
+ // transform incoming response data
+ transformResponse: [defaultHttpResponseTransform],
+
+ // transform outgoing request data
+ transformRequest: [function(d) {
+ return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d;
+ }],
+
+ // default headers
+ headers: {
+ common: {
+ 'Accept': 'application/json, text/plain, */*'
+ },
+ post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
+ put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
+ patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON)
+ },
+
+ xsrfCookieName: 'XSRF-TOKEN',
+ xsrfHeaderName: 'X-XSRF-TOKEN',
+
+ paramSerializer: '$httpParamSerializer'
+ };
+
+ var useApplyAsync = false;
+ /**
+ * @ngdoc method
+ * @name $httpProvider#useApplyAsync
+ * @description
+ *
+ * Configure $http service to combine processing of multiple http responses received at around
+ * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in
+ * significant performance improvement for bigger applications that make many HTTP requests
+ * concurrently (common during application bootstrap).
+ *
+ * Defaults to false. If no value is specified, returns the current configured value.
+ *
+ * @param {boolean=} value If true, when requests are loaded, they will schedule a deferred
+ * "apply" on the next tick, giving time for subsequent requests in a roughly ~10ms window
+ * to load and share the same digest cycle.
+ *
+ * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.
+ * otherwise, returns the current configured value.
+ **/
+ this.useApplyAsync = function(value) {
+ if (isDefined(value)) {
+ useApplyAsync = !!value;
+ return this;
+ }
+ return useApplyAsync;
+ };
+
+ var useLegacyPromise = true;
+ /**
+ * @ngdoc method
+ * @name $httpProvider#useLegacyPromiseExtensions
+ * @description
+ *
+ * Configure `$http` service to return promises without the shorthand methods `success` and `error`.
+ * This should be used to make sure that applications work without these methods.
+ *
+ * Defaults to true. If no value is specified, returns the current configured value.
+ *
+ * @param {boolean=} value If true, `$http` will return a promise with the deprecated legacy `success` and `error` methods.
+ *
+ * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.
+ * otherwise, returns the current configured value.
+ **/
+ this.useLegacyPromiseExtensions = function(value) {
+ if (isDefined(value)) {
+ useLegacyPromise = !!value;
+ return this;
+ }
+ return useLegacyPromise;
+ };
+
+ /**
+ * @ngdoc property
+ * @name $httpProvider#interceptors
+ * @description
+ *
+ * Array containing service factories for all synchronous or asynchronous {@link ng.$http $http}
+ * pre-processing of request or postprocessing of responses.
+ *
+ * These service factories are ordered by request, i.e. they are applied in the same order as the
+ * array, on request, but reverse order, on response.
+ *
+ * {@link ng.$http#interceptors Interceptors detailed info}
+ **/
+ var interceptorFactories = this.interceptors = [];
+
+ this.$get = ['$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector',
+ function($httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector) {
+
+ var defaultCache = $cacheFactory('$http');
+
+ /**
+ * Make sure that default param serializer is exposed as a function
+ */
+ defaults.paramSerializer = isString(defaults.paramSerializer) ?
+ $injector.get(defaults.paramSerializer) : defaults.paramSerializer;
+
+ /**
+ * Interceptors stored in reverse order. Inner interceptors before outer interceptors.
+ * The reversal is needed so that we can build up the interception chain around the
+ * server request.
+ */
+ var reversedInterceptors = [];
+
+ forEach(interceptorFactories, function(interceptorFactory) {
+ reversedInterceptors.unshift(isString(interceptorFactory)
+ ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));
+ });
+
+ /**
+ * @ngdoc service
+ * @kind function
+ * @name $http
+ * @requires ng.$httpBackend
+ * @requires $cacheFactory
+ * @requires $rootScope
+ * @requires $q
+ * @requires $injector
+ *
+ * @description
+ * The `$http` service is a core Angular service that facilitates communication with the remote
+ * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest)
+ * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP).
+ *
+ * For unit testing applications that use `$http` service, see
+ * {@link ngMock.$httpBackend $httpBackend mock}.
+ *
+ * For a higher level of abstraction, please check out the {@link ngResource.$resource
+ * $resource} service.
+ *
+ * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by
+ * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage
+ * it is important to familiarize yourself with these APIs and the guarantees they provide.
+ *
+ *
+ * ## General usage
+ * The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object} —
+ * that is used to generate an HTTP request and returns a {@link ng.$q promise}.
+ *
+ * ```js
+ * // Simple GET request example:
+ * $http({
+ * method: 'GET',
+ * url: '/someUrl'
+ * }).then(function successCallback(response) {
+ * // this callback will be called asynchronously
+ * // when the response is available
+ * }, function errorCallback(response) {
+ * // called asynchronously if an error occurs
+ * // or server returns response with an error status.
+ * });
+ * ```
+ *
+ * The response object has these properties:
+ *
+ * - **data** – `{string|Object}` – The response body transformed with the transform
+ * functions.
+ * - **status** – `{number}` – HTTP status code of the response.
+ * - **headers** – `{function([headerName])}` – Header getter function.
+ * - **config** – `{Object}` – The configuration object that was used to generate the request.
+ * - **statusText** – `{string}` – HTTP status text of the response.
+ *
+ * A response status code between 200 and 299 is considered a success status and
+ * will result in the success callback being called. Note that if the response is a redirect,
+ * XMLHttpRequest will transparently follow it, meaning that the error callback will not be
+ * called for such responses.
+ *
+ *
+ * ## Shortcut methods
+ *
+ * Shortcut methods are also available. All shortcut methods require passing in the URL, and
+ * request data must be passed in for POST/PUT requests. An optional config can be passed as the
+ * last argument.
+ *
+ * ```js
+ * $http.get('/someUrl', config).then(successCallback, errorCallback);
+ * $http.post('/someUrl', data, config).then(successCallback, errorCallback);
+ * ```
+ *
+ * Complete list of shortcut methods:
+ *
+ * - {@link ng.$http#get $http.get}
+ * - {@link ng.$http#head $http.head}
+ * - {@link ng.$http#post $http.post}
+ * - {@link ng.$http#put $http.put}
+ * - {@link ng.$http#delete $http.delete}
+ * - {@link ng.$http#jsonp $http.jsonp}
+ * - {@link ng.$http#patch $http.patch}
+ *
+ *
+ * ## Writing Unit Tests that use $http
+ * When unit testing (using {@link ngMock ngMock}), it is necessary to call
+ * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending
+ * request using trained responses.
+ *
+ * ```
+ * $httpBackend.expectGET(...);
+ * $http.get(...);
+ * $httpBackend.flush();
+ * ```
+ *
+ * ## Deprecation Notice
+ * <div class="alert alert-danger">
+ * The `$http` legacy promise methods `success` and `error` have been deprecated.
+ * Use the standard `then` method instead.
+ * If {@link $httpProvider#useLegacyPromiseExtensions `$httpProvider.useLegacyPromiseExtensions`} is set to
+ * `false` then these methods will throw {@link $http:legacy `$http/legacy`} error.
+ * </div>
+ *
+ * ## Setting HTTP Headers
+ *
+ * The $http service will automatically add certain HTTP headers to all requests. These defaults
+ * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration
+ * object, which currently contains this default configuration:
+ *
+ * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):
+ * - `Accept: application/json, text/plain, * / *`
+ * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)
+ * - `Content-Type: application/json`
+ * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)
+ * - `Content-Type: application/json`
+ *
+ * To add or overwrite these defaults, simply add or remove a property from these configuration
+ * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object
+ * with the lowercased HTTP method name as the key, e.g.
+ * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }`.
+ *
+ * The defaults can also be set at runtime via the `$http.defaults` object in the same
+ * fashion. For example:
+ *
+ * ```
+ * module.run(function($http) {
+ * $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w';
+ * });
+ * ```
+ *
+ * In addition, you can supply a `headers` property in the config object passed when
+ * calling `$http(config)`, which overrides the defaults without changing them globally.
+ *
+ * To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis,
+ * Use the `headers` property, setting the desired header to `undefined`. For example:
+ *
+ * ```js
+ * var req = {
+ * method: 'POST',
+ * url: 'http://example.com',
+ * headers: {
+ * 'Content-Type': undefined
+ * },
+ * data: { test: 'test' }
+ * }
+ *
+ * $http(req).then(function(){...}, function(){...});
+ * ```
+ *
+ * ## Transforming Requests and Responses
+ *
+ * Both requests and responses can be transformed using transformation functions: `transformRequest`
+ * and `transformResponse`. These properties can be a single function that returns
+ * the transformed value (`function(data, headersGetter, status)`) or an array of such transformation functions,
+ * which allows you to `push` or `unshift` a new transformation function into the transformation chain.
+ *
+ * ### Default Transformations
+ *
+ * The `$httpProvider` provider and `$http` service expose `defaults.transformRequest` and
+ * `defaults.transformResponse` properties. If a request does not provide its own transformations
+ * then these will be applied.
+ *
+ * You can augment or replace the default transformations by modifying these properties by adding to or
+ * replacing the array.
+ *
+ * Angular provides the following default transformations:
+ *
+ * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`):
+ *
+ * - If the `data` property of the request configuration object contains an object, serialize it
+ * into JSON format.
+ *
+ * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`):
+ *
+ * - If XSRF prefix is detected, strip it (see Security Considerations section below).
+ * - If JSON response is detected, deserialize it using a JSON parser.
+ *
+ *
+ * ### Overriding the Default Transformations Per Request
+ *
+ * If you wish override the request/response transformations only for a single request then provide
+ * `transformRequest` and/or `transformResponse` properties on the configuration object passed
+ * into `$http`.
+ *
+ * Note that if you provide these properties on the config object the default transformations will be
+ * overwritten. If you wish to augment the default transformations then you must include them in your
+ * local transformation array.
+ *
+ * The following code demonstrates adding a new response transformation to be run after the default response
+ * transformations have been run.
+ *
+ * ```js
+ * function appendTransform(defaults, transform) {
+ *
+ * // We can't guarantee that the default transformation is an array
+ * defaults = angular.isArray(defaults) ? defaults : [defaults];
+ *
+ * // Append the new transformation to the defaults
+ * return defaults.concat(transform);
+ * }
+ *
+ * $http({
+ * url: '...',
+ * method: 'GET',
+ * transformResponse: appendTransform($http.defaults.transformResponse, function(value) {
+ * return doTransform(value);
+ * })
+ * });
+ * ```
+ *
+ *
+ * ## Caching
+ *
+ * To enable caching, set the request configuration `cache` property to `true` (to use default
+ * cache) or to a custom cache object (built with {@link ng.$cacheFactory `$cacheFactory`}).
+ * When the cache is enabled, `$http` stores the response from the server in the specified
+ * cache. The next time the same request is made, the response is served from the cache without
+ * sending a request to the server.
+ *
+ * Note that even if the response is served from cache, delivery of the data is asynchronous in
+ * the same way that real requests are.
+ *
+ * If there are multiple GET requests for the same URL that should be cached using the same
+ * cache, but the cache is not populated yet, only one request to the server will be made and
+ * the remaining requests will be fulfilled using the response from the first request.
+ *
+ * You can change the default cache to a new object (built with
+ * {@link ng.$cacheFactory `$cacheFactory`}) by updating the
+ * {@link ng.$http#defaults `$http.defaults.cache`} property. All requests who set
+ * their `cache` property to `true` will now use this cache object.
+ *
+ * If you set the default cache to `false` then only requests that specify their own custom
+ * cache object will be cached.
+ *
+ * ## Interceptors
+ *
+ * Before you start creating interceptors, be sure to understand the
+ * {@link ng.$q $q and deferred/promise APIs}.
+ *
+ * For purposes of global error handling, authentication, or any kind of synchronous or
+ * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be
+ * able to intercept requests before they are handed to the server and
+ * responses before they are handed over to the application code that
+ * initiated these requests. The interceptors leverage the {@link ng.$q
+ * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing.
+ *
+ * The interceptors are service factories that are registered with the `$httpProvider` by
+ * adding them to the `$httpProvider.interceptors` array. The factory is called and
+ * injected with dependencies (if specified) and returns the interceptor.
+ *
+ * There are two kinds of interceptors (and two kinds of rejection interceptors):
+ *
+ * * `request`: interceptors get called with a http {@link $http#usage config} object. The function is free to
+ * modify the `config` object or create a new one. The function needs to return the `config`
+ * object directly, or a promise containing the `config` or a new `config` object.
+ * * `requestError`: interceptor gets called when a previous interceptor threw an error or
+ * resolved with a rejection.
+ * * `response`: interceptors get called with http `response` object. The function is free to
+ * modify the `response` object or create a new one. The function needs to return the `response`
+ * object directly, or as a promise containing the `response` or a new `response` object.
+ * * `responseError`: interceptor gets called when a previous interceptor threw an error or
+ * resolved with a rejection.
+ *
+ *
+ * ```js
+ * // register the interceptor as a service
+ * $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
+ * return {
+ * // optional method
+ * 'request': function(config) {
+ * // do something on success
+ * return config;
+ * },
+ *
+ * // optional method
+ * 'requestError': function(rejection) {
+ * // do something on error
+ * if (canRecover(rejection)) {
+ * return responseOrNewPromise
+ * }
+ * return $q.reject(rejection);
+ * },
+ *
+ *
+ *
+ * // optional method
+ * 'response': function(response) {
+ * // do something on success
+ * return response;
+ * },
+ *
+ * // optional method
+ * 'responseError': function(rejection) {
+ * // do something on error
+ * if (canRecover(rejection)) {
+ * return responseOrNewPromise
+ * }
+ * return $q.reject(rejection);
+ * }
+ * };
+ * });
+ *
+ * $httpProvider.interceptors.push('myHttpInterceptor');
+ *
+ *
+ * // alternatively, register the interceptor via an anonymous factory
+ * $httpProvider.interceptors.push(function($q, dependency1, dependency2) {
+ * return {
+ * 'request': function(config) {
+ * // same as above
+ * },
+ *
+ * 'response': function(response) {
+ * // same as above
+ * }
+ * };
+ * });
+ * ```
+ *
+ * ## Security Considerations
+ *
+ * When designing web applications, consider security threats from:
+ *
+ * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)
+ * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
+ *
+ * Both server and the client must cooperate in order to eliminate these threats. Angular comes
+ * pre-configured with strategies that address these issues, but for this to work backend server
+ * cooperation is required.
+ *
+ * ### JSON Vulnerability Protection
+ *
+ * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)
+ * allows third party website to turn your JSON resource URL into
+ * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To
+ * counter this your server can prefix all JSON requests with following string `")]}',\n"`.
+ * Angular will automatically strip the prefix before processing it as JSON.
+ *
+ * For example if your server needs to return:
+ * ```js
+ * ['one','two']
+ * ```
+ *
+ * which is vulnerable to attack, your server can return:
+ * ```js
+ * )]}',
+ * ['one','two']
+ * ```
+ *
+ * Angular will strip the prefix, before processing the JSON.
+ *
+ *
+ * ### Cross Site Request Forgery (XSRF) Protection
+ *
+ * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by
+ * which the attacker can trick an authenticated user into unknowingly executing actions on your
+ * website. Angular provides a mechanism to counter XSRF. When performing XHR requests, the
+ * $http service reads a token from a cookie (by default, `XSRF-TOKEN`) and sets it as an HTTP
+ * header (`X-XSRF-TOKEN`). Since only JavaScript that runs on your domain could read the
+ * cookie, your server can be assured that the XHR came from JavaScript running on your domain.
+ * The header will not be set for cross-domain requests.
+ *
+ * To take advantage of this, your server needs to set a token in a JavaScript readable session
+ * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the
+ * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure
+ * that only JavaScript running on your domain could have sent the request. The token must be
+ * unique for each user and must be verifiable by the server (to prevent the JavaScript from
+ * making up its own tokens). We recommend that the token is a digest of your site's
+ * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography&#41;)
+ * for added security.
+ *
+ * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName
+ * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,
+ * or the per-request config object.
+ *
+ * In order to prevent collisions in environments where multiple Angular apps share the
+ * same domain or subdomain, we recommend that each application uses unique cookie name.
+ *
+ * @param {object} config Object describing the request to be made and how it should be
+ * processed. The object has following properties:
+ *
+ * - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)
+ * - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.
+ * - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be serialized
+ * with the `paramSerializer` and appended as GET parameters.
+ * - **data** – `{string|Object}` – Data to be sent as the request message data.
+ * - **headers** – `{Object}` – Map of strings or functions which return strings representing
+ * HTTP headers to send to the server. If the return value of a function is null, the
+ * header will not be sent. Functions accept a config object as an argument.
+ * - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token.
+ * - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token.
+ * - **transformRequest** –
+ * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
+ * transform function or an array of such functions. The transform function takes the http
+ * request body and headers and returns its transformed (typically serialized) version.
+ * See {@link ng.$http#overriding-the-default-transformations-per-request
+ * Overriding the Default Transformations}
+ * - **transformResponse** –
+ * `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` –
+ * transform function or an array of such functions. The transform function takes the http
+ * response body, headers and status and returns its transformed (typically deserialized) version.
+ * See {@link ng.$http#overriding-the-default-transformations-per-request
+ * Overriding the Default TransformationjqLiks}
+ * - **paramSerializer** - `{string|function(Object<string,string>):string}` - A function used to
+ * prepare the string representation of request parameters (specified as an object).
+ * If specified as string, it is interpreted as function registered with the
+ * {@link $injector $injector}, which means you can create your own serializer
+ * by registering it as a {@link auto.$provide#service service}.
+ * The default serializer is the {@link $httpParamSerializer $httpParamSerializer};
+ * alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike}
+ * - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
+ * GET request, otherwise if a cache instance built with
+ * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
+ * caching.
+ * - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}
+ * that should abort the request when resolved.
+ * - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the
+ * XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials)
+ * for more information.
+ * - **responseType** - `{string}` - see
+ * [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype).
+ *
+ * @returns {HttpPromise} Returns a {@link ng.$q `Promise}` that will be resolved to a response object
+ * when the request succeeds or fails.
+ *
+ *
+ * @property {Array.<Object>} pendingRequests Array of config objects for currently pending
+ * requests. This is primarily meant to be used for debugging purposes.
+ *
+ *
+ * @example
+<example module="httpExample">
+<file name="index.html">
+ <div ng-controller="FetchController">
+ <select ng-model="method" aria-label="Request method">
+ <option>GET</option>
+ <option>JSONP</option>
+ </select>
+ <input type="text" ng-model="url" size="80" aria-label="URL" />
+ <button id="fetchbtn" ng-click="fetch()">fetch</button><br>
+ <button id="samplegetbtn" ng-click="updateModel('GET', 'http-hello.html')">Sample GET</button>
+ <button id="samplejsonpbtn"
+ ng-click="updateModel('JSONP',
+ 'https://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">
+ Sample JSONP
+ </button>
+ <button id="invalidjsonpbtn"
+ ng-click="updateModel('JSONP', 'https://angularjs.org/doesntexist&callback=JSON_CALLBACK')">
+ Invalid JSONP
+ </button>
+ <pre>http status code: {{status}}</pre>
+ <pre>http response data: {{data}}</pre>
+ </div>
+</file>
+<file name="script.js">
+ angular.module('httpExample', [])
+ .controller('FetchController', ['$scope', '$http', '$templateCache',
+ function($scope, $http, $templateCache) {
+ $scope.method = 'GET';
+ $scope.url = 'http-hello.html';
+
+ $scope.fetch = function() {
+ $scope.code = null;
+ $scope.response = null;
+
+ $http({method: $scope.method, url: $scope.url, cache: $templateCache}).
+ then(function(response) {
+ $scope.status = response.status;
+ $scope.data = response.data;
+ }, function(response) {
+ $scope.data = response.data || "Request failed";
+ $scope.status = response.status;
+ });
+ };
+
+ $scope.updateModel = function(method, url) {
+ $scope.method = method;
+ $scope.url = url;
+ };
+ }]);
+</file>
+<file name="http-hello.html">
+ Hello, $http!
+</file>
+<file name="protractor.js" type="protractor">
+ var status = element(by.binding('status'));
+ var data = element(by.binding('data'));
+ var fetchBtn = element(by.id('fetchbtn'));
+ var sampleGetBtn = element(by.id('samplegetbtn'));
+ var sampleJsonpBtn = element(by.id('samplejsonpbtn'));
+ var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));
+
+ it('should make an xhr GET request', function() {
+ sampleGetBtn.click();
+ fetchBtn.click();
+ expect(status.getText()).toMatch('200');
+ expect(data.getText()).toMatch(/Hello, \$http!/);
+ });
+
+// Commented out due to flakes. See https://github.com/angular/angular.js/issues/9185
+// it('should make a JSONP request to angularjs.org', function() {
+// sampleJsonpBtn.click();
+// fetchBtn.click();
+// expect(status.getText()).toMatch('200');
+// expect(data.getText()).toMatch(/Super Hero!/);
+// });
+
+ it('should make JSONP request to invalid URL and invoke the error handler',
+ function() {
+ invalidJsonpBtn.click();
+ fetchBtn.click();
+ expect(status.getText()).toMatch('0');
+ expect(data.getText()).toMatch('Request failed');
+ });
+</file>
+</example>
+ */
+ function $http(requestConfig) {
+
+ if (!isObject(requestConfig)) {
+ throw minErr('$http')('badreq', 'Http request configuration must be an object. Received: {0}', requestConfig);
+ }
+
+ if (!isString(requestConfig.url)) {
+ throw minErr('$http')('badreq', 'Http request configuration url must be a string. Received: {0}', requestConfig.url);
+ }
+
+ var config = extend({
+ method: 'get',
+ transformRequest: defaults.transformRequest,
+ transformResponse: defaults.transformResponse,
+ paramSerializer: defaults.paramSerializer
+ }, requestConfig);
+
+ config.headers = mergeHeaders(requestConfig);
+ config.method = uppercase(config.method);
+ config.paramSerializer = isString(config.paramSerializer) ?
+ $injector.get(config.paramSerializer) : config.paramSerializer;
+
+ var serverRequest = function(config) {
+ var headers = config.headers;
+ var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest);
+
+ // strip content-type if data is undefined
+ if (isUndefined(reqData)) {
+ forEach(headers, function(value, header) {
+ if (lowercase(header) === 'content-type') {
+ delete headers[header];
+ }
+ });
+ }
+
+ if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {
+ config.withCredentials = defaults.withCredentials;
+ }
+
+ // send request
+ return sendReq(config, reqData).then(transformResponse, transformResponse);
+ };
+
+ var chain = [serverRequest, undefined];
+ var promise = $q.when(config);
+
+ // apply interceptors
+ forEach(reversedInterceptors, function(interceptor) {
+ if (interceptor.request || interceptor.requestError) {
+ chain.unshift(interceptor.request, interceptor.requestError);
+ }
+ if (interceptor.response || interceptor.responseError) {
+ chain.push(interceptor.response, interceptor.responseError);
+ }
+ });
+
+ while (chain.length) {
+ var thenFn = chain.shift();
+ var rejectFn = chain.shift();
+
+ promise = promise.then(thenFn, rejectFn);
+ }
+
+ if (useLegacyPromise) {
+ promise.success = function(fn) {
+ assertArgFn(fn, 'fn');
+
+ promise.then(function(response) {
+ fn(response.data, response.status, response.headers, config);
+ });
+ return promise;
+ };
+
+ promise.error = function(fn) {
+ assertArgFn(fn, 'fn');
+
+ promise.then(null, function(response) {
+ fn(response.data, response.status, response.headers, config);
+ });
+ return promise;
+ };
+ } else {
+ promise.success = $httpMinErrLegacyFn('success');
+ promise.error = $httpMinErrLegacyFn('error');
+ }
+
+ return promise;
+
+ function transformResponse(response) {
+ // make a copy since the response must be cacheable
+ var resp = extend({}, response);
+ resp.data = transformData(response.data, response.headers, response.status,
+ config.transformResponse);
+ return (isSuccess(response.status))
+ ? resp
+ : $q.reject(resp);
+ }
+
+ function executeHeaderFns(headers, config) {
+ var headerContent, processedHeaders = {};
+
+ forEach(headers, function(headerFn, header) {
+ if (isFunction(headerFn)) {
+ headerContent = headerFn(config);
+ if (headerContent != null) {
+ processedHeaders[header] = headerContent;
+ }
+ } else {
+ processedHeaders[header] = headerFn;
+ }
+ });
+
+ return processedHeaders;
+ }
+
+ function mergeHeaders(config) {
+ var defHeaders = defaults.headers,
+ reqHeaders = extend({}, config.headers),
+ defHeaderName, lowercaseDefHeaderName, reqHeaderName;
+
+ defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);
+
+ // using for-in instead of forEach to avoid unnecessary iteration after header has been found
+ defaultHeadersIteration:
+ for (defHeaderName in defHeaders) {
+ lowercaseDefHeaderName = lowercase(defHeaderName);
+
+ for (reqHeaderName in reqHeaders) {
+ if (lowercase(reqHeaderName) === lowercaseDefHeaderName) {
+ continue defaultHeadersIteration;
+ }
+ }
+
+ reqHeaders[defHeaderName] = defHeaders[defHeaderName];
+ }
+
+ // execute if header value is a function for merged headers
+ return executeHeaderFns(reqHeaders, shallowCopy(config));
+ }
+ }
+
+ $http.pendingRequests = [];
+
+ /**
+ * @ngdoc method
+ * @name $http#get
+ *
+ * @description
+ * Shortcut method to perform `GET` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#delete
+ *
+ * @description
+ * Shortcut method to perform `DELETE` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#head
+ *
+ * @description
+ * Shortcut method to perform `HEAD` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#jsonp
+ *
+ * @description
+ * Shortcut method to perform `JSONP` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request.
+ * The name of the callback should be the string `JSON_CALLBACK`.
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+ createShortMethods('get', 'delete', 'head', 'jsonp');
+
+ /**
+ * @ngdoc method
+ * @name $http#post
+ *
+ * @description
+ * Shortcut method to perform `POST` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {*} data Request content
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#put
+ *
+ * @description
+ * Shortcut method to perform `PUT` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {*} data Request content
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#patch
+ *
+ * @description
+ * Shortcut method to perform `PATCH` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {*} data Request content
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+ createShortMethodsWithData('post', 'put', 'patch');
+
+ /**
+ * @ngdoc property
+ * @name $http#defaults
+ *
+ * @description
+ * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of
+ * default headers, withCredentials as well as request and response transformations.
+ *
+ * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above.
+ */
+ $http.defaults = defaults;
+
+
+ return $http;
+
+
+ function createShortMethods(names) {
+ forEach(arguments, function(name) {
+ $http[name] = function(url, config) {
+ return $http(extend({}, config || {}, {
+ method: name,
+ url: url
+ }));
+ };
+ });
+ }
+
+
+ function createShortMethodsWithData(name) {
+ forEach(arguments, function(name) {
+ $http[name] = function(url, data, config) {
+ return $http(extend({}, config || {}, {
+ method: name,
+ url: url,
+ data: data
+ }));
+ };
+ });
+ }
+
+
+ /**
+ * Makes the request.
+ *
+ * !!! ACCESSES CLOSURE VARS:
+ * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests
+ */
+ function sendReq(config, reqData) {
+ var deferred = $q.defer(),
+ promise = deferred.promise,
+ cache,
+ cachedResp,
+ reqHeaders = config.headers,
+ url = buildUrl(config.url, config.paramSerializer(config.params));
+
+ $http.pendingRequests.push(config);
+ promise.then(removePendingReq, removePendingReq);
+
+
+ if ((config.cache || defaults.cache) && config.cache !== false &&
+ (config.method === 'GET' || config.method === 'JSONP')) {
+ cache = isObject(config.cache) ? config.cache
+ : isObject(defaults.cache) ? defaults.cache
+ : defaultCache;
+ }
+
+ if (cache) {
+ cachedResp = cache.get(url);
+ if (isDefined(cachedResp)) {
+ if (isPromiseLike(cachedResp)) {
+ // cached request has already been sent, but there is no response yet
+ cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult);
+ } else {
+ // serving from cache
+ if (isArray(cachedResp)) {
+ resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);
+ } else {
+ resolvePromise(cachedResp, 200, {}, 'OK');
+ }
+ }
+ } else {
+ // put the promise for the non-transformed response into cache as a placeholder
+ cache.put(url, promise);
+ }
+ }
+
+
+ // if we won't have the response in cache, set the xsrf headers and
+ // send the request to the backend
+ if (isUndefined(cachedResp)) {
+ var xsrfValue = urlIsSameOrigin(config.url)
+ ? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName]
+ : undefined;
+ if (xsrfValue) {
+ reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;
+ }
+
+ $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,
+ config.withCredentials, config.responseType);
+ }
+
+ return promise;
+
+
+ /**
+ * Callback registered to $httpBackend():
+ * - caches the response if desired
+ * - resolves the raw $http promise
+ * - calls $apply
+ */
+ function done(status, response, headersString, statusText) {
+ if (cache) {
+ if (isSuccess(status)) {
+ cache.put(url, [status, response, parseHeaders(headersString), statusText]);
+ } else {
+ // remove promise from the cache
+ cache.remove(url);
+ }
+ }
+
+ function resolveHttpPromise() {
+ resolvePromise(response, status, headersString, statusText);
+ }
+
+ if (useApplyAsync) {
+ $rootScope.$applyAsync(resolveHttpPromise);
+ } else {
+ resolveHttpPromise();
+ if (!$rootScope.$$phase) $rootScope.$apply();
+ }
+ }
+
+
+ /**
+ * Resolves the raw $http promise.
+ */
+ function resolvePromise(response, status, headers, statusText) {
+ //status: HTTP response status code, 0, -1 (aborted by timeout / promise)
+ status = status >= -1 ? status : 0;
+
+ (isSuccess(status) ? deferred.resolve : deferred.reject)({
+ data: response,
+ status: status,
+ headers: headersGetter(headers),
+ config: config,
+ statusText: statusText
+ });
+ }
+
+ function resolvePromiseWithResult(result) {
+ resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText);
+ }
+
+ function removePendingReq() {
+ var idx = $http.pendingRequests.indexOf(config);
+ if (idx !== -1) $http.pendingRequests.splice(idx, 1);
+ }
+ }
+
+
+ function buildUrl(url, serializedParams) {
+ if (serializedParams.length > 0) {
+ url += ((url.indexOf('?') == -1) ? '?' : '&') + serializedParams;
+ }
+ return url;
+ }
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $xhrFactory
+ *
+ * @description
+ * Factory function used to create XMLHttpRequest objects.
+ *
+ * Replace or decorate this service to create your own custom XMLHttpRequest objects.
+ *
+ * ```
+ * angular.module('myApp', [])
+ * .factory('$xhrFactory', function() {
+ * return function createXhr(method, url) {
+ * return new window.XMLHttpRequest({mozSystem: true});
+ * };
+ * });
+ * ```
+ *
+ * @param {string} method HTTP method of the request (GET, POST, PUT, ..)
+ * @param {string} url URL of the request.
+ */
+function $xhrFactoryProvider() {
+ this.$get = function() {
+ return function createXhr() {
+ return new window.XMLHttpRequest();
+ };
+ };
+}
+
+/**
+ * @ngdoc service
+ * @name $httpBackend
+ * @requires $window
+ * @requires $document
+ * @requires $xhrFactory
+ *
+ * @description
+ * HTTP backend used by the {@link ng.$http service} that delegates to
+ * XMLHttpRequest object or JSONP and deals with browser incompatibilities.
+ *
+ * You should never need to use this service directly, instead use the higher-level abstractions:
+ * {@link ng.$http $http} or {@link ngResource.$resource $resource}.
+ *
+ * During testing this implementation is swapped with {@link ngMock.$httpBackend mock
+ * $httpBackend} which can be trained with responses.
+ */
+function $HttpBackendProvider() {
+ this.$get = ['$browser', '$window', '$document', '$xhrFactory', function($browser, $window, $document, $xhrFactory) {
+ return createHttpBackend($browser, $xhrFactory, $browser.defer, $window.angular.callbacks, $document[0]);
+ }];
+}
+
+function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {
+ // TODO(vojta): fix the signature
+ return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {
+ $browser.$$incOutstandingRequestCount();
+ url = url || $browser.url();
+
+ if (lowercase(method) == 'jsonp') {
+ var callbackId = '_' + (callbacks.counter++).toString(36);
+ callbacks[callbackId] = function(data) {
+ callbacks[callbackId].data = data;
+ callbacks[callbackId].called = true;
+ };
+
+ var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),
+ callbackId, function(status, text) {
+ completeRequest(callback, status, callbacks[callbackId].data, "", text);
+ callbacks[callbackId] = noop;
+ });
+ } else {
+
+ var xhr = createXhr(method, url);
+
+ xhr.open(method, url, true);
+ forEach(headers, function(value, key) {
+ if (isDefined(value)) {
+ xhr.setRequestHeader(key, value);
+ }
+ });
+
+ xhr.onload = function requestLoaded() {
+ var statusText = xhr.statusText || '';
+
+ // responseText is the old-school way of retrieving response (supported by IE9)
+ // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)
+ var response = ('response' in xhr) ? xhr.response : xhr.responseText;
+
+ // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
+ var status = xhr.status === 1223 ? 204 : xhr.status;
+
+ // fix status code when it is 0 (0 status is undocumented).
+ // Occurs when accessing file resources or on Android 4.1 stock browser
+ // while retrieving files from application cache.
+ if (status === 0) {
+ status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;
+ }
+
+ completeRequest(callback,
+ status,
+ response,
+ xhr.getAllResponseHeaders(),
+ statusText);
+ };
+
+ var requestError = function() {
+ // The response is always empty
+ // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error
+ completeRequest(callback, -1, null, null, '');
+ };
+
+ xhr.onerror = requestError;
+ xhr.onabort = requestError;
+
+ if (withCredentials) {
+ xhr.withCredentials = true;
+ }
+
+ if (responseType) {
+ try {
+ xhr.responseType = responseType;
+ } catch (e) {
+ // WebKit added support for the json responseType value on 09/03/2013
+ // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are
+ // known to throw when setting the value "json" as the response type. Other older
+ // browsers implementing the responseType
+ //
+ // The json response type can be ignored if not supported, because JSON payloads are
+ // parsed on the client-side regardless.
+ if (responseType !== 'json') {
+ throw e;
+ }
+ }
+ }
+
+ xhr.send(isUndefined(post) ? null : post);
+ }
+
+ if (timeout > 0) {
+ var timeoutId = $browserDefer(timeoutRequest, timeout);
+ } else if (isPromiseLike(timeout)) {
+ timeout.then(timeoutRequest);
+ }
+
+
+ function timeoutRequest() {
+ jsonpDone && jsonpDone();
+ xhr && xhr.abort();
+ }
+
+ function completeRequest(callback, status, response, headersString, statusText) {
+ // cancel timeout and subsequent timeout promise resolution
+ if (isDefined(timeoutId)) {
+ $browserDefer.cancel(timeoutId);
+ }
+ jsonpDone = xhr = null;
+
+ callback(status, response, headersString, statusText);
+ $browser.$$completeOutstandingRequest(noop);
+ }
+ };
+
+ function jsonpReq(url, callbackId, done) {
+ // we can't use jQuery/jqLite here because jQuery does crazy stuff with script elements, e.g.:
+ // - fetches local scripts via XHR and evals them
+ // - adds and immediately removes script elements from the document
+ var script = rawDocument.createElement('script'), callback = null;
+ script.type = "text/javascript";
+ script.src = url;
+ script.async = true;
+
+ callback = function(event) {
+ removeEventListenerFn(script, "load", callback);
+ removeEventListenerFn(script, "error", callback);
+ rawDocument.body.removeChild(script);
+ script = null;
+ var status = -1;
+ var text = "unknown";
+
+ if (event) {
+ if (event.type === "load" && !callbacks[callbackId].called) {
+ event = { type: "error" };
+ }
+ text = event.type;
+ status = event.type === "error" ? 404 : 200;
+ }
+
+ if (done) {
+ done(status, text);
+ }
+ };
+
+ addEventListenerFn(script, "load", callback);
+ addEventListenerFn(script, "error", callback);
+ rawDocument.body.appendChild(script);
+ return callback;
+ }
+}
+
+var $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate');
+$interpolateMinErr.throwNoconcat = function(text) {
+ throw $interpolateMinErr('noconcat',
+ "Error while interpolating: {0}\nStrict Contextual Escaping disallows " +
+ "interpolations that concatenate multiple expressions when a trusted value is " +
+ "required. See http://docs.angularjs.org/api/ng.$sce", text);
+};
+
+$interpolateMinErr.interr = function(text, err) {
+ return $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text, err.toString());
+};
+
+/**
+ * @ngdoc provider
+ * @name $interpolateProvider
+ *
+ * @description
+ *
+ * Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
+ *
+ * <div class="alert alert-danger">
+ * This feature is sometimes used to mix different markup languages, e.g. to wrap an Angular
+ * template within a Python Jinja template (or any other template language). Mixing templating
+ * languages is **very dangerous**. The embedding template language will not safely escape Angular
+ * expressions, so any user-controlled values in the template will cause Cross Site Scripting (XSS)
+ * security bugs!
+ * </div>
+ *
+ * @example
+<example name="custom-interpolation-markup" module="customInterpolationApp">
+<file name="index.html">
+<script>
+ var customInterpolationApp = angular.module('customInterpolationApp', []);
+
+ customInterpolationApp.config(function($interpolateProvider) {
+ $interpolateProvider.startSymbol('//');
+ $interpolateProvider.endSymbol('//');
+ });
+
+
+ customInterpolationApp.controller('DemoController', function() {
+ this.label = "This binding is brought you by // interpolation symbols.";
+ });
+</script>
+<div ng-controller="DemoController as demo">
+ //demo.label//
+</div>
+</file>
+<file name="protractor.js" type="protractor">
+ it('should interpolate binding with custom symbols', function() {
+ expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.');
+ });
+</file>
+</example>
+ */
+function $InterpolateProvider() {
+ var startSymbol = '{{';
+ var endSymbol = '}}';
+
+ /**
+ * @ngdoc method
+ * @name $interpolateProvider#startSymbol
+ * @description
+ * Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
+ *
+ * @param {string=} value new value to set the starting symbol to.
+ * @returns {string|self} Returns the symbol when used as getter and self if used as setter.
+ */
+ this.startSymbol = function(value) {
+ if (value) {
+ startSymbol = value;
+ return this;
+ } else {
+ return startSymbol;
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $interpolateProvider#endSymbol
+ * @description
+ * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
+ *
+ * @param {string=} value new value to set the ending symbol to.
+ * @returns {string|self} Returns the symbol when used as getter and self if used as setter.
+ */
+ this.endSymbol = function(value) {
+ if (value) {
+ endSymbol = value;
+ return this;
+ } else {
+ return endSymbol;
+ }
+ };
+
+
+ this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {
+ var startSymbolLength = startSymbol.length,
+ endSymbolLength = endSymbol.length,
+ escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'),
+ escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g');
+
+ function escape(ch) {
+ return '\\\\\\' + ch;
+ }
+
+ function unescapeText(text) {
+ return text.replace(escapedStartRegexp, startSymbol).
+ replace(escapedEndRegexp, endSymbol);
+ }
+
+ function stringify(value) {
+ if (value == null) { // null || undefined
+ return '';
+ }
+ switch (typeof value) {
+ case 'string':
+ break;
+ case 'number':
+ value = '' + value;
+ break;
+ default:
+ value = toJson(value);
+ }
+
+ return value;
+ }
+
+ //TODO: this is the same as the constantWatchDelegate in parse.js
+ function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {
+ var unwatch;
+ return unwatch = scope.$watch(function constantInterpolateWatch(scope) {
+ unwatch();
+ return constantInterp(scope);
+ }, listener, objectEquality);
+ }
+
+ /**
+ * @ngdoc service
+ * @name $interpolate
+ * @kind function
+ *
+ * @requires $parse
+ * @requires $sce
+ *
+ * @description
+ *
+ * Compiles a string with markup into an interpolation function. This service is used by the
+ * HTML {@link ng.$compile $compile} service for data binding. See
+ * {@link ng.$interpolateProvider $interpolateProvider} for configuring the
+ * interpolation markup.
+ *
+ *
+ * ```js
+ * var $interpolate = ...; // injected
+ * var exp = $interpolate('Hello {{name | uppercase}}!');
+ * expect(exp({name:'Angular'})).toEqual('Hello ANGULAR!');
+ * ```
+ *
+ * `$interpolate` takes an optional fourth argument, `allOrNothing`. If `allOrNothing` is
+ * `true`, the interpolation function will return `undefined` unless all embedded expressions
+ * evaluate to a value other than `undefined`.
+ *
+ * ```js
+ * var $interpolate = ...; // injected
+ * var context = {greeting: 'Hello', name: undefined };
+ *
+ * // default "forgiving" mode
+ * var exp = $interpolate('{{greeting}} {{name}}!');
+ * expect(exp(context)).toEqual('Hello !');
+ *
+ * // "allOrNothing" mode
+ * exp = $interpolate('{{greeting}} {{name}}!', false, null, true);
+ * expect(exp(context)).toBeUndefined();
+ * context.name = 'Angular';
+ * expect(exp(context)).toEqual('Hello Angular!');
+ * ```
+ *
+ * `allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior.
+ *
+ * ####Escaped Interpolation
+ * $interpolate provides a mechanism for escaping interpolation markers. Start and end markers
+ * can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash).
+ * It will be rendered as a regular start/end marker, and will not be interpreted as an expression
+ * or binding.
+ *
+ * This enables web-servers to prevent script injection attacks and defacing attacks, to some
+ * degree, while also enabling code examples to work without relying on the
+ * {@link ng.directive:ngNonBindable ngNonBindable} directive.
+ *
+ * **For security purposes, it is strongly encouraged that web servers escape user-supplied data,
+ * replacing angle brackets (&lt;, &gt;) with &amp;lt; and &amp;gt; respectively, and replacing all
+ * interpolation start/end markers with their escaped counterparts.**
+ *
+ * Escaped interpolation markers are only replaced with the actual interpolation markers in rendered
+ * output when the $interpolate service processes the text. So, for HTML elements interpolated
+ * by {@link ng.$compile $compile}, or otherwise interpolated with the `mustHaveExpression` parameter
+ * set to `true`, the interpolated text must contain an unescaped interpolation expression. As such,
+ * this is typically useful only when user-data is used in rendering a template from the server, or
+ * when otherwise untrusted data is used by a directive.
+ *
+ * <example>
+ * <file name="index.html">
+ * <div ng-init="username='A user'">
+ * <p ng-init="apptitle='Escaping demo'">{{apptitle}}: \{\{ username = "defaced value"; \}\}
+ * </p>
+ * <p><strong>{{username}}</strong> attempts to inject code which will deface the
+ * application, but fails to accomplish their task, because the server has correctly
+ * escaped the interpolation start/end markers with REVERSE SOLIDUS U+005C (backslash)
+ * characters.</p>
+ * <p>Instead, the result of the attempted script injection is visible, and can be removed
+ * from the database by an administrator.</p>
+ * </div>
+ * </file>
+ * </example>
+ *
+ * @param {string} text The text with markup to interpolate.
+ * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have
+ * embedded expression in order to return an interpolation function. Strings with no
+ * embedded expression will return null for the interpolation function.
+ * @param {string=} trustedContext when provided, the returned function passes the interpolated
+ * result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult,
+ * trustedContext)} before returning it. Refer to the {@link ng.$sce $sce} service that
+ * provides Strict Contextual Escaping for details.
+ * @param {boolean=} allOrNothing if `true`, then the returned function returns undefined
+ * unless all embedded expressions evaluate to a value other than `undefined`.
+ * @returns {function(context)} an interpolation function which is used to compute the
+ * interpolated string. The function has these parameters:
+ *
+ * - `context`: evaluation context for all expressions embedded in the interpolated text
+ */
+ function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {
+ // Provide a quick exit and simplified result function for text with no interpolation
+ if (!text.length || text.indexOf(startSymbol) === -1) {
+ var constantInterp;
+ if (!mustHaveExpression) {
+ var unescapedText = unescapeText(text);
+ constantInterp = valueFn(unescapedText);
+ constantInterp.exp = text;
+ constantInterp.expressions = [];
+ constantInterp.$$watchDelegate = constantWatchDelegate;
+ }
+ return constantInterp;
+ }
+
+ allOrNothing = !!allOrNothing;
+ var startIndex,
+ endIndex,
+ index = 0,
+ expressions = [],
+ parseFns = [],
+ textLength = text.length,
+ exp,
+ concat = [],
+ expressionPositions = [];
+
+ while (index < textLength) {
+ if (((startIndex = text.indexOf(startSymbol, index)) != -1) &&
+ ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1)) {
+ if (index !== startIndex) {
+ concat.push(unescapeText(text.substring(index, startIndex)));
+ }
+ exp = text.substring(startIndex + startSymbolLength, endIndex);
+ expressions.push(exp);
+ parseFns.push($parse(exp, parseStringifyInterceptor));
+ index = endIndex + endSymbolLength;
+ expressionPositions.push(concat.length);
+ concat.push('');
+ } else {
+ // we did not find an interpolation, so we have to add the remainder to the separators array
+ if (index !== textLength) {
+ concat.push(unescapeText(text.substring(index)));
+ }
+ break;
+ }
+ }
+
+ // Concatenating expressions makes it hard to reason about whether some combination of
+ // concatenated values are unsafe to use and could easily lead to XSS. By requiring that a
+ // single expression be used for iframe[src], object[src], etc., we ensure that the value
+ // that's used is assigned or constructed by some JS code somewhere that is more testable or
+ // make it obvious that you bound the value to some user controlled value. This helps reduce
+ // the load when auditing for XSS issues.
+ if (trustedContext && concat.length > 1) {
+ $interpolateMinErr.throwNoconcat(text);
+ }
+
+ if (!mustHaveExpression || expressions.length) {
+ var compute = function(values) {
+ for (var i = 0, ii = expressions.length; i < ii; i++) {
+ if (allOrNothing && isUndefined(values[i])) return;
+ concat[expressionPositions[i]] = values[i];
+ }
+ return concat.join('');
+ };
+
+ var getValue = function(value) {
+ return trustedContext ?
+ $sce.getTrusted(trustedContext, value) :
+ $sce.valueOf(value);
+ };
+
+ return extend(function interpolationFn(context) {
+ var i = 0;
+ var ii = expressions.length;
+ var values = new Array(ii);
+
+ try {
+ for (; i < ii; i++) {
+ values[i] = parseFns[i](context);
+ }
+
+ return compute(values);
+ } catch (err) {
+ $exceptionHandler($interpolateMinErr.interr(text, err));
+ }
+
+ }, {
+ // all of these properties are undocumented for now
+ exp: text, //just for compatibility with regular watchers created via $watch
+ expressions: expressions,
+ $$watchDelegate: function(scope, listener) {
+ var lastValue;
+ return scope.$watchGroup(parseFns, function interpolateFnWatcher(values, oldValues) {
+ var currValue = compute(values);
+ if (isFunction(listener)) {
+ listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope);
+ }
+ lastValue = currValue;
+ });
+ }
+ });
+ }
+
+ function parseStringifyInterceptor(value) {
+ try {
+ value = getValue(value);
+ return allOrNothing && !isDefined(value) ? value : stringify(value);
+ } catch (err) {
+ $exceptionHandler($interpolateMinErr.interr(text, err));
+ }
+ }
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $interpolate#startSymbol
+ * @description
+ * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
+ *
+ * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change
+ * the symbol.
+ *
+ * @returns {string} start symbol.
+ */
+ $interpolate.startSymbol = function() {
+ return startSymbol;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $interpolate#endSymbol
+ * @description
+ * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
+ *
+ * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change
+ * the symbol.
+ *
+ * @returns {string} end symbol.
+ */
+ $interpolate.endSymbol = function() {
+ return endSymbol;
+ };
+
+ return $interpolate;
+ }];
+}
+
+function $IntervalProvider() {
+ this.$get = ['$rootScope', '$window', '$q', '$$q', '$browser',
+ function($rootScope, $window, $q, $$q, $browser) {
+ var intervals = {};
+
+
+ /**
+ * @ngdoc service
+ * @name $interval
+ *
+ * @description
+ * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay`
+ * milliseconds.
+ *
+ * The return value of registering an interval function is a promise. This promise will be
+ * notified upon each tick of the interval, and will be resolved after `count` iterations, or
+ * run indefinitely if `count` is not defined. The value of the notification will be the
+ * number of iterations that have run.
+ * To cancel an interval, call `$interval.cancel(promise)`.
+ *
+ * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to
+ * move forward by `millis` milliseconds and trigger any functions scheduled to run in that
+ * time.
+ *
+ * <div class="alert alert-warning">
+ * **Note**: Intervals created by this service must be explicitly destroyed when you are finished
+ * with them. In particular they are not automatically destroyed when a controller's scope or a
+ * directive's element are destroyed.
+ * You should take this into consideration and make sure to always cancel the interval at the
+ * appropriate moment. See the example below for more details on how and when to do this.
+ * </div>
+ *
+ * @param {function()} fn A function that should be called repeatedly.
+ * @param {number} delay Number of milliseconds between each function call.
+ * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat
+ * indefinitely.
+ * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
+ * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
+ * @param {...*=} Pass additional parameters to the executed function.
+ * @returns {promise} A promise which will be notified on each iteration.
+ *
+ * @example
+ * <example module="intervalExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('intervalExample', [])
+ * .controller('ExampleController', ['$scope', '$interval',
+ * function($scope, $interval) {
+ * $scope.format = 'M/d/yy h:mm:ss a';
+ * $scope.blood_1 = 100;
+ * $scope.blood_2 = 120;
+ *
+ * var stop;
+ * $scope.fight = function() {
+ * // Don't start a new fight if we are already fighting
+ * if ( angular.isDefined(stop) ) return;
+ *
+ * stop = $interval(function() {
+ * if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {
+ * $scope.blood_1 = $scope.blood_1 - 3;
+ * $scope.blood_2 = $scope.blood_2 - 4;
+ * } else {
+ * $scope.stopFight();
+ * }
+ * }, 100);
+ * };
+ *
+ * $scope.stopFight = function() {
+ * if (angular.isDefined(stop)) {
+ * $interval.cancel(stop);
+ * stop = undefined;
+ * }
+ * };
+ *
+ * $scope.resetFight = function() {
+ * $scope.blood_1 = 100;
+ * $scope.blood_2 = 120;
+ * };
+ *
+ * $scope.$on('$destroy', function() {
+ * // Make sure that the interval is destroyed too
+ * $scope.stopFight();
+ * });
+ * }])
+ * // Register the 'myCurrentTime' directive factory method.
+ * // We inject $interval and dateFilter service since the factory method is DI.
+ * .directive('myCurrentTime', ['$interval', 'dateFilter',
+ * function($interval, dateFilter) {
+ * // return the directive link function. (compile function not needed)
+ * return function(scope, element, attrs) {
+ * var format, // date format
+ * stopTime; // so that we can cancel the time updates
+ *
+ * // used to update the UI
+ * function updateTime() {
+ * element.text(dateFilter(new Date(), format));
+ * }
+ *
+ * // watch the expression, and update the UI on change.
+ * scope.$watch(attrs.myCurrentTime, function(value) {
+ * format = value;
+ * updateTime();
+ * });
+ *
+ * stopTime = $interval(updateTime, 1000);
+ *
+ * // listen on DOM destroy (removal) event, and cancel the next UI update
+ * // to prevent updating time after the DOM element was removed.
+ * element.on('$destroy', function() {
+ * $interval.cancel(stopTime);
+ * });
+ * }
+ * }]);
+ * </script>
+ *
+ * <div>
+ * <div ng-controller="ExampleController">
+ * <label>Date format: <input ng-model="format"></label> <hr/>
+ * Current time is: <span my-current-time="format"></span>
+ * <hr/>
+ * Blood 1 : <font color='red'>{{blood_1}}</font>
+ * Blood 2 : <font color='red'>{{blood_2}}</font>
+ * <button type="button" data-ng-click="fight()">Fight</button>
+ * <button type="button" data-ng-click="stopFight()">StopFight</button>
+ * <button type="button" data-ng-click="resetFight()">resetFight</button>
+ * </div>
+ * </div>
+ *
+ * </file>
+ * </example>
+ */
+ function interval(fn, delay, count, invokeApply) {
+ var hasParams = arguments.length > 4,
+ args = hasParams ? sliceArgs(arguments, 4) : [],
+ setInterval = $window.setInterval,
+ clearInterval = $window.clearInterval,
+ iteration = 0,
+ skipApply = (isDefined(invokeApply) && !invokeApply),
+ deferred = (skipApply ? $$q : $q).defer(),
+ promise = deferred.promise;
+
+ count = isDefined(count) ? count : 0;
+
+ promise.$$intervalId = setInterval(function tick() {
+ if (skipApply) {
+ $browser.defer(callback);
+ } else {
+ $rootScope.$evalAsync(callback);
+ }
+ deferred.notify(iteration++);
+
+ if (count > 0 && iteration >= count) {
+ deferred.resolve(iteration);
+ clearInterval(promise.$$intervalId);
+ delete intervals[promise.$$intervalId];
+ }
+
+ if (!skipApply) $rootScope.$apply();
+
+ }, delay);
+
+ intervals[promise.$$intervalId] = deferred;
+
+ return promise;
+
+ function callback() {
+ if (!hasParams) {
+ fn(iteration);
+ } else {
+ fn.apply(null, args);
+ }
+ }
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $interval#cancel
+ *
+ * @description
+ * Cancels a task associated with the `promise`.
+ *
+ * @param {Promise=} promise returned by the `$interval` function.
+ * @returns {boolean} Returns `true` if the task was successfully canceled.
+ */
+ interval.cancel = function(promise) {
+ if (promise && promise.$$intervalId in intervals) {
+ intervals[promise.$$intervalId].reject('canceled');
+ $window.clearInterval(promise.$$intervalId);
+ delete intervals[promise.$$intervalId];
+ return true;
+ }
+ return false;
+ };
+
+ return interval;
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $locale
+ *
+ * @description
+ * $locale service provides localization rules for various Angular components. As of right now the
+ * only public api is:
+ *
+ * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)
+ */
+
+var PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/,
+ DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
+var $locationMinErr = minErr('$location');
+
+
+/**
+ * Encode path using encodeUriSegment, ignoring forward slashes
+ *
+ * @param {string} path Path to encode
+ * @returns {string}
+ */
+function encodePath(path) {
+ var segments = path.split('/'),
+ i = segments.length;
+
+ while (i--) {
+ segments[i] = encodeUriSegment(segments[i]);
+ }
+
+ return segments.join('/');
+}
+
+function parseAbsoluteUrl(absoluteUrl, locationObj) {
+ var parsedUrl = urlResolve(absoluteUrl);
+
+ locationObj.$$protocol = parsedUrl.protocol;
+ locationObj.$$host = parsedUrl.hostname;
+ locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;
+}
+
+
+function parseAppUrl(relativeUrl, locationObj) {
+ var prefixed = (relativeUrl.charAt(0) !== '/');
+ if (prefixed) {
+ relativeUrl = '/' + relativeUrl;
+ }
+ var match = urlResolve(relativeUrl);
+ locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?
+ match.pathname.substring(1) : match.pathname);
+ locationObj.$$search = parseKeyValue(match.search);
+ locationObj.$$hash = decodeURIComponent(match.hash);
+
+ // make sure path starts with '/';
+ if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') {
+ locationObj.$$path = '/' + locationObj.$$path;
+ }
+}
+
+
+/**
+ *
+ * @param {string} begin
+ * @param {string} whole
+ * @returns {string} returns text from whole after begin or undefined if it does not begin with
+ * expected string.
+ */
+function beginsWith(begin, whole) {
+ if (whole.indexOf(begin) === 0) {
+ return whole.substr(begin.length);
+ }
+}
+
+
+function stripHash(url) {
+ var index = url.indexOf('#');
+ return index == -1 ? url : url.substr(0, index);
+}
+
+function trimEmptyHash(url) {
+ return url.replace(/(#.+)|#$/, '$1');
+}
+
+
+function stripFile(url) {
+ return url.substr(0, stripHash(url).lastIndexOf('/') + 1);
+}
+
+/* return the server only (scheme://host:port) */
+function serverBase(url) {
+ return url.substring(0, url.indexOf('/', url.indexOf('//') + 2));
+}
+
+
+/**
+ * LocationHtml5Url represents an url
+ * This object is exposed as $location service when HTML5 mode is enabled and supported
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} appBaseNoFile application base URL stripped of any filename
+ * @param {string} basePrefix url path prefix
+ */
+function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
+ this.$$html5 = true;
+ basePrefix = basePrefix || '';
+ parseAbsoluteUrl(appBase, this);
+
+
+ /**
+ * Parse given html5 (regular) url string into properties
+ * @param {string} url HTML5 url
+ * @private
+ */
+ this.$$parse = function(url) {
+ var pathUrl = beginsWith(appBaseNoFile, url);
+ if (!isString(pathUrl)) {
+ throw $locationMinErr('ipthprfx', 'Invalid url "{0}", missing path prefix "{1}".', url,
+ appBaseNoFile);
+ }
+
+ parseAppUrl(pathUrl, this);
+
+ if (!this.$$path) {
+ this.$$path = '/';
+ }
+
+ this.$$compose();
+ };
+
+ /**
+ * Compose url and update `absUrl` property
+ * @private
+ */
+ this.$$compose = function() {
+ var search = toKeyValue(this.$$search),
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+ this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'
+ };
+
+ this.$$parseLinkUrl = function(url, relHref) {
+ if (relHref && relHref[0] === '#') {
+ // special case for links to hash fragments:
+ // keep the old url and only replace the hash fragment
+ this.hash(relHref.slice(1));
+ return true;
+ }
+ var appUrl, prevAppUrl;
+ var rewrittenUrl;
+
+ if (isDefined(appUrl = beginsWith(appBase, url))) {
+ prevAppUrl = appUrl;
+ if (isDefined(appUrl = beginsWith(basePrefix, appUrl))) {
+ rewrittenUrl = appBaseNoFile + (beginsWith('/', appUrl) || appUrl);
+ } else {
+ rewrittenUrl = appBase + prevAppUrl;
+ }
+ } else if (isDefined(appUrl = beginsWith(appBaseNoFile, url))) {
+ rewrittenUrl = appBaseNoFile + appUrl;
+ } else if (appBaseNoFile == url + '/') {
+ rewrittenUrl = appBaseNoFile;
+ }
+ if (rewrittenUrl) {
+ this.$$parse(rewrittenUrl);
+ }
+ return !!rewrittenUrl;
+ };
+}
+
+
+/**
+ * LocationHashbangUrl represents url
+ * This object is exposed as $location service when developer doesn't opt into html5 mode.
+ * It also serves as the base class for html5 mode fallback on legacy browsers.
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} appBaseNoFile application base URL stripped of any filename
+ * @param {string} hashPrefix hashbang prefix
+ */
+function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
+
+ parseAbsoluteUrl(appBase, this);
+
+
+ /**
+ * Parse given hashbang url into properties
+ * @param {string} url Hashbang url
+ * @private
+ */
+ this.$$parse = function(url) {
+ var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);
+ var withoutHashUrl;
+
+ if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === '#') {
+
+ // The rest of the url starts with a hash so we have
+ // got either a hashbang path or a plain hash fragment
+ withoutHashUrl = beginsWith(hashPrefix, withoutBaseUrl);
+ if (isUndefined(withoutHashUrl)) {
+ // There was no hashbang prefix so we just have a hash fragment
+ withoutHashUrl = withoutBaseUrl;
+ }
+
+ } else {
+ // There was no hashbang path nor hash fragment:
+ // If we are in HTML5 mode we use what is left as the path;
+ // Otherwise we ignore what is left
+ if (this.$$html5) {
+ withoutHashUrl = withoutBaseUrl;
+ } else {
+ withoutHashUrl = '';
+ if (isUndefined(withoutBaseUrl)) {
+ appBase = url;
+ this.replace();
+ }
+ }
+ }
+
+ parseAppUrl(withoutHashUrl, this);
+
+ this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);
+
+ this.$$compose();
+
+ /*
+ * In Windows, on an anchor node on documents loaded from
+ * the filesystem, the browser will return a pathname
+ * prefixed with the drive name ('/C:/path') when a
+ * pathname without a drive is set:
+ * * a.setAttribute('href', '/foo')
+ * * a.pathname === '/C:/foo' //true
+ *
+ * Inside of Angular, we're always using pathnames that
+ * do not include drive names for routing.
+ */
+ function removeWindowsDriveName(path, url, base) {
+ /*
+ Matches paths for file protocol on windows,
+ such as /C:/foo/bar, and captures only /foo/bar.
+ */
+ var windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
+
+ var firstPathSegmentMatch;
+
+ //Get the relative path from the input URL.
+ if (url.indexOf(base) === 0) {
+ url = url.replace(base, '');
+ }
+
+ // The input URL intentionally contains a first path segment that ends with a colon.
+ if (windowsFilePathExp.exec(url)) {
+ return path;
+ }
+
+ firstPathSegmentMatch = windowsFilePathExp.exec(path);
+ return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
+ }
+ };
+
+ /**
+ * Compose hashbang url and update `absUrl` property
+ * @private
+ */
+ this.$$compose = function() {
+ var search = toKeyValue(this.$$search),
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+ this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');
+ };
+
+ this.$$parseLinkUrl = function(url, relHref) {
+ if (stripHash(appBase) == stripHash(url)) {
+ this.$$parse(url);
+ return true;
+ }
+ return false;
+ };
+}
+
+
+/**
+ * LocationHashbangUrl represents url
+ * This object is exposed as $location service when html5 history api is enabled but the browser
+ * does not support it.
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} appBaseNoFile application base URL stripped of any filename
+ * @param {string} hashPrefix hashbang prefix
+ */
+function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
+ this.$$html5 = true;
+ LocationHashbangUrl.apply(this, arguments);
+
+ this.$$parseLinkUrl = function(url, relHref) {
+ if (relHref && relHref[0] === '#') {
+ // special case for links to hash fragments:
+ // keep the old url and only replace the hash fragment
+ this.hash(relHref.slice(1));
+ return true;
+ }
+
+ var rewrittenUrl;
+ var appUrl;
+
+ if (appBase == stripHash(url)) {
+ rewrittenUrl = url;
+ } else if ((appUrl = beginsWith(appBaseNoFile, url))) {
+ rewrittenUrl = appBase + hashPrefix + appUrl;
+ } else if (appBaseNoFile === url + '/') {
+ rewrittenUrl = appBaseNoFile;
+ }
+ if (rewrittenUrl) {
+ this.$$parse(rewrittenUrl);
+ }
+ return !!rewrittenUrl;
+ };
+
+ this.$$compose = function() {
+ var search = toKeyValue(this.$$search),
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+ // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#'
+ this.$$absUrl = appBase + hashPrefix + this.$$url;
+ };
+
+}
+
+
+var locationPrototype = {
+
+ /**
+ * Are we in html5 mode?
+ * @private
+ */
+ $$html5: false,
+
+ /**
+ * Has any change been replacing?
+ * @private
+ */
+ $$replace: false,
+
+ /**
+ * @ngdoc method
+ * @name $location#absUrl
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return full url representation with all segments encoded according to rules specified in
+ * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var absUrl = $location.absUrl();
+ * // => "http://example.com/#/some/path?foo=bar&baz=xoxo"
+ * ```
+ *
+ * @return {string} full url
+ */
+ absUrl: locationGetter('$$absUrl'),
+
+ /**
+ * @ngdoc method
+ * @name $location#url
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return url (e.g. `/path?a=b#hash`) when called without any parameter.
+ *
+ * Change path, search and hash, when called with parameter and return `$location`.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var url = $location.url();
+ * // => "/some/path?foo=bar&baz=xoxo"
+ * ```
+ *
+ * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)
+ * @return {string} url
+ */
+ url: function(url) {
+ if (isUndefined(url)) {
+ return this.$$url;
+ }
+
+ var match = PATH_MATCH.exec(url);
+ if (match[1] || url === '') this.path(decodeURIComponent(match[1]));
+ if (match[2] || match[1] || url === '') this.search(match[3] || '');
+ this.hash(match[5] || '');
+
+ return this;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $location#protocol
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return protocol of current url.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var protocol = $location.protocol();
+ * // => "http"
+ * ```
+ *
+ * @return {string} protocol of current url
+ */
+ protocol: locationGetter('$$protocol'),
+
+ /**
+ * @ngdoc method
+ * @name $location#host
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return host of current url.
+ *
+ * Note: compared to the non-angular version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var host = $location.host();
+ * // => "example.com"
+ *
+ * // given url http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo
+ * host = $location.host();
+ * // => "example.com"
+ * host = location.host;
+ * // => "example.com:8080"
+ * ```
+ *
+ * @return {string} host of current url.
+ */
+ host: locationGetter('$$host'),
+
+ /**
+ * @ngdoc method
+ * @name $location#port
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return port of current url.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var port = $location.port();
+ * // => 80
+ * ```
+ *
+ * @return {Number} port
+ */
+ port: locationGetter('$$port'),
+
+ /**
+ * @ngdoc method
+ * @name $location#path
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return path of current url when called without any parameter.
+ *
+ * Change path when called with parameter and return `$location`.
+ *
+ * Note: Path should always begin with forward slash (/), this method will add the forward slash
+ * if it is missing.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var path = $location.path();
+ * // => "/some/path"
+ * ```
+ *
+ * @param {(string|number)=} path New path
+ * @return {string} path
+ */
+ path: locationGetterSetter('$$path', function(path) {
+ path = path !== null ? path.toString() : '';
+ return path.charAt(0) == '/' ? path : '/' + path;
+ }),
+
+ /**
+ * @ngdoc method
+ * @name $location#search
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return search part (as object) of current url when called without any parameter.
+ *
+ * Change search part when called with parameter and return `$location`.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var searchObject = $location.search();
+ * // => {foo: 'bar', baz: 'xoxo'}
+ *
+ * // set foo to 'yipee'
+ * $location.search('foo', 'yipee');
+ * // $location.search() => {foo: 'yipee', baz: 'xoxo'}
+ * ```
+ *
+ * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or
+ * hash object.
+ *
+ * When called with a single argument the method acts as a setter, setting the `search` component
+ * of `$location` to the specified value.
+ *
+ * If the argument is a hash object containing an array of values, these values will be encoded
+ * as duplicate search parameters in the url.
+ *
+ * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`
+ * will override only a single search property.
+ *
+ * If `paramValue` is an array, it will override the property of the `search` component of
+ * `$location` specified via the first argument.
+ *
+ * If `paramValue` is `null`, the property specified via the first argument will be deleted.
+ *
+ * If `paramValue` is `true`, the property specified via the first argument will be added with no
+ * value nor trailing equal sign.
+ *
+ * @return {Object} If called with no arguments returns the parsed `search` object. If called with
+ * one or more arguments returns `$location` object itself.
+ */
+ search: function(search, paramValue) {
+ switch (arguments.length) {
+ case 0:
+ return this.$$search;
+ case 1:
+ if (isString(search) || isNumber(search)) {
+ search = search.toString();
+ this.$$search = parseKeyValue(search);
+ } else if (isObject(search)) {
+ search = copy(search, {});
+ // remove object undefined or null properties
+ forEach(search, function(value, key) {
+ if (value == null) delete search[key];
+ });
+
+ this.$$search = search;
+ } else {
+ throw $locationMinErr('isrcharg',
+ 'The first argument of the `$location#search()` call must be a string or an object.');
+ }
+ break;
+ default:
+ if (isUndefined(paramValue) || paramValue === null) {
+ delete this.$$search[search];
+ } else {
+ this.$$search[search] = paramValue;
+ }
+ }
+
+ this.$$compose();
+ return this;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $location#hash
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Returns the hash fragment when called without any parameters.
+ *
+ * Changes the hash fragment when called with a parameter and returns `$location`.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
+ * var hash = $location.hash();
+ * // => "hashValue"
+ * ```
+ *
+ * @param {(string|number)=} hash New hash fragment
+ * @return {string} hash
+ */
+ hash: locationGetterSetter('$$hash', function(hash) {
+ return hash !== null ? hash.toString() : '';
+ }),
+
+ /**
+ * @ngdoc method
+ * @name $location#replace
+ *
+ * @description
+ * If called, all changes to $location during the current `$digest` will replace the current history
+ * record, instead of adding a new one.
+ */
+ replace: function() {
+ this.$$replace = true;
+ return this;
+ }
+};
+
+forEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], function(Location) {
+ Location.prototype = Object.create(locationPrototype);
+
+ /**
+ * @ngdoc method
+ * @name $location#state
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return the history state object when called without any parameter.
+ *
+ * Change the history state object when called with one parameter and return `$location`.
+ * The state object is later passed to `pushState` or `replaceState`.
+ *
+ * NOTE: This method is supported only in HTML5 mode and only in browsers supporting
+ * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support
+ * older browsers (like IE9 or Android < 4.0), don't use this method.
+ *
+ * @param {object=} state State object for pushState or replaceState
+ * @return {object} state
+ */
+ Location.prototype.state = function(state) {
+ if (!arguments.length) {
+ return this.$$state;
+ }
+
+ if (Location !== LocationHtml5Url || !this.$$html5) {
+ throw $locationMinErr('nostate', 'History API state support is available only ' +
+ 'in HTML5 mode and only in browsers supporting HTML5 History API');
+ }
+ // The user might modify `stateObject` after invoking `$location.state(stateObject)`
+ // but we're changing the $$state reference to $browser.state() during the $digest
+ // so the modification window is narrow.
+ this.$$state = isUndefined(state) ? null : state;
+
+ return this;
+ };
+});
+
+
+function locationGetter(property) {
+ return function() {
+ return this[property];
+ };
+}
+
+
+function locationGetterSetter(property, preprocess) {
+ return function(value) {
+ if (isUndefined(value)) {
+ return this[property];
+ }
+
+ this[property] = preprocess(value);
+ this.$$compose();
+
+ return this;
+ };
+}
+
+
+/**
+ * @ngdoc service
+ * @name $location
+ *
+ * @requires $rootElement
+ *
+ * @description
+ * The $location service parses the URL in the browser address bar (based on the
+ * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL
+ * available to your application. Changes to the URL in the address bar are reflected into
+ * $location service and changes to $location are reflected into the browser address bar.
+ *
+ * **The $location service:**
+ *
+ * - Exposes the current URL in the browser address bar, so you can
+ * - Watch and observe the URL.
+ * - Change the URL.
+ * - Synchronizes the URL with the browser when the user
+ * - Changes the address bar.
+ * - Clicks the back or forward button (or clicks a History link).
+ * - Clicks on a link.
+ * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
+ *
+ * For more information see {@link guide/$location Developer Guide: Using $location}
+ */
+
+/**
+ * @ngdoc provider
+ * @name $locationProvider
+ * @description
+ * Use the `$locationProvider` to configure how the application deep linking paths are stored.
+ */
+function $LocationProvider() {
+ var hashPrefix = '',
+ html5Mode = {
+ enabled: false,
+ requireBase: true,
+ rewriteLinks: true
+ };
+
+ /**
+ * @ngdoc method
+ * @name $locationProvider#hashPrefix
+ * @description
+ * @param {string=} prefix Prefix for hash part (containing path and search)
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ */
+ this.hashPrefix = function(prefix) {
+ if (isDefined(prefix)) {
+ hashPrefix = prefix;
+ return this;
+ } else {
+ return hashPrefix;
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $locationProvider#html5Mode
+ * @description
+ * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value.
+ * If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported
+ * properties:
+ * - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to
+ * change urls where supported. Will fall back to hash-prefixed paths in browsers that do not
+ * support `pushState`.
+ * - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies
+ * whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are
+ * true, and a base tag is not present, an error will be thrown when `$location` is injected.
+ * See the {@link guide/$location $location guide for more information}
+ * - **rewriteLinks** - `{boolean}` - (default: `true`) When html5Mode is enabled,
+ * enables/disables url rewriting for relative links.
+ *
+ * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter
+ */
+ this.html5Mode = function(mode) {
+ if (isBoolean(mode)) {
+ html5Mode.enabled = mode;
+ return this;
+ } else if (isObject(mode)) {
+
+ if (isBoolean(mode.enabled)) {
+ html5Mode.enabled = mode.enabled;
+ }
+
+ if (isBoolean(mode.requireBase)) {
+ html5Mode.requireBase = mode.requireBase;
+ }
+
+ if (isBoolean(mode.rewriteLinks)) {
+ html5Mode.rewriteLinks = mode.rewriteLinks;
+ }
+
+ return this;
+ } else {
+ return html5Mode;
+ }
+ };
+
+ /**
+ * @ngdoc event
+ * @name $location#$locationChangeStart
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted before a URL will change.
+ *
+ * This change can be prevented by calling
+ * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more
+ * details about event object. Upon successful change
+ * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired.
+ *
+ * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
+ * the browser supports the HTML5 History API.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {string} newUrl New URL
+ * @param {string=} oldUrl URL that was before it was changed.
+ * @param {string=} newState New history state object
+ * @param {string=} oldState History state object that was before it was changed.
+ */
+
+ /**
+ * @ngdoc event
+ * @name $location#$locationChangeSuccess
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted after a URL was changed.
+ *
+ * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
+ * the browser supports the HTML5 History API.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {string} newUrl New URL
+ * @param {string=} oldUrl URL that was before it was changed.
+ * @param {string=} newState New history state object
+ * @param {string=} oldState History state object that was before it was changed.
+ */
+
+ this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', '$window',
+ function($rootScope, $browser, $sniffer, $rootElement, $window) {
+ var $location,
+ LocationMode,
+ baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to ''
+ initialUrl = $browser.url(),
+ appBase;
+
+ if (html5Mode.enabled) {
+ if (!baseHref && html5Mode.requireBase) {
+ throw $locationMinErr('nobase',
+ "$location in HTML5 mode requires a <base> tag to be present!");
+ }
+ appBase = serverBase(initialUrl) + (baseHref || '/');
+ LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;
+ } else {
+ appBase = stripHash(initialUrl);
+ LocationMode = LocationHashbangUrl;
+ }
+ var appBaseNoFile = stripFile(appBase);
+
+ $location = new LocationMode(appBase, appBaseNoFile, '#' + hashPrefix);
+ $location.$$parseLinkUrl(initialUrl, initialUrl);
+
+ $location.$$state = $browser.state();
+
+ var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
+
+ function setBrowserUrlWithFallback(url, replace, state) {
+ var oldUrl = $location.url();
+ var oldState = $location.$$state;
+ try {
+ $browser.url(url, replace, state);
+
+ // Make sure $location.state() returns referentially identical (not just deeply equal)
+ // state object; this makes possible quick checking if the state changed in the digest
+ // loop. Checking deep equality would be too expensive.
+ $location.$$state = $browser.state();
+ } catch (e) {
+ // Restore old values if pushState fails
+ $location.url(oldUrl);
+ $location.$$state = oldState;
+
+ throw e;
+ }
+ }
+
+ $rootElement.on('click', function(event) {
+ // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
+ // currently we open nice url link and redirect then
+
+ if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which == 2 || event.button == 2) return;
+
+ var elm = jqLite(event.target);
+
+ // traverse the DOM up to find first A tag
+ while (nodeName_(elm[0]) !== 'a') {
+ // ignore rewriting if no A tag (reached root element, or no parent - removed from document)
+ if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;
+ }
+
+ var absHref = elm.prop('href');
+ // get the actual href attribute - see
+ // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx
+ var relHref = elm.attr('href') || elm.attr('xlink:href');
+
+ if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {
+ // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during
+ // an animation.
+ absHref = urlResolve(absHref.animVal).href;
+ }
+
+ // Ignore when url is started with javascript: or mailto:
+ if (IGNORE_URI_REGEXP.test(absHref)) return;
+
+ if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) {
+ if ($location.$$parseLinkUrl(absHref, relHref)) {
+ // We do a preventDefault for all urls that are part of the angular application,
+ // in html5mode and also without, so that we are able to abort navigation without
+ // getting double entries in the location history.
+ event.preventDefault();
+ // update location manually
+ if ($location.absUrl() != $browser.url()) {
+ $rootScope.$apply();
+ // hack to work around FF6 bug 684208 when scenario runner clicks on links
+ $window.angular['ff-684208-preventDefault'] = true;
+ }
+ }
+ }
+ });
+
+
+ // rewrite hashbang url <> html5 url
+ if (trimEmptyHash($location.absUrl()) != trimEmptyHash(initialUrl)) {
+ $browser.url($location.absUrl(), true);
+ }
+
+ var initializing = true;
+
+ // update $location when $browser url changes
+ $browser.onUrlChange(function(newUrl, newState) {
+
+ if (isUndefined(beginsWith(appBaseNoFile, newUrl))) {
+ // If we are navigating outside of the app then force a reload
+ $window.location.href = newUrl;
+ return;
+ }
+
+ $rootScope.$evalAsync(function() {
+ var oldUrl = $location.absUrl();
+ var oldState = $location.$$state;
+ var defaultPrevented;
+ newUrl = trimEmptyHash(newUrl);
+ $location.$$parse(newUrl);
+ $location.$$state = newState;
+
+ defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
+ newState, oldState).defaultPrevented;
+
+ // if the location was changed by a `$locationChangeStart` handler then stop
+ // processing this location change
+ if ($location.absUrl() !== newUrl) return;
+
+ if (defaultPrevented) {
+ $location.$$parse(oldUrl);
+ $location.$$state = oldState;
+ setBrowserUrlWithFallback(oldUrl, false, oldState);
+ } else {
+ initializing = false;
+ afterLocationChange(oldUrl, oldState);
+ }
+ });
+ if (!$rootScope.$$phase) $rootScope.$digest();
+ });
+
+ // update browser
+ $rootScope.$watch(function $locationWatch() {
+ var oldUrl = trimEmptyHash($browser.url());
+ var newUrl = trimEmptyHash($location.absUrl());
+ var oldState = $browser.state();
+ var currentReplace = $location.$$replace;
+ var urlOrStateChanged = oldUrl !== newUrl ||
+ ($location.$$html5 && $sniffer.history && oldState !== $location.$$state);
+
+ if (initializing || urlOrStateChanged) {
+ initializing = false;
+
+ $rootScope.$evalAsync(function() {
+ var newUrl = $location.absUrl();
+ var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
+ $location.$$state, oldState).defaultPrevented;
+
+ // if the location was changed by a `$locationChangeStart` handler then stop
+ // processing this location change
+ if ($location.absUrl() !== newUrl) return;
+
+ if (defaultPrevented) {
+ $location.$$parse(oldUrl);
+ $location.$$state = oldState;
+ } else {
+ if (urlOrStateChanged) {
+ setBrowserUrlWithFallback(newUrl, currentReplace,
+ oldState === $location.$$state ? null : $location.$$state);
+ }
+ afterLocationChange(oldUrl, oldState);
+ }
+ });
+ }
+
+ $location.$$replace = false;
+
+ // we don't need to return anything because $evalAsync will make the digest loop dirty when
+ // there is a change
+ });
+
+ return $location;
+
+ function afterLocationChange(oldUrl, oldState) {
+ $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl,
+ $location.$$state, oldState);
+ }
+}];
+}
+
+/**
+ * @ngdoc service
+ * @name $log
+ * @requires $window
+ *
+ * @description
+ * Simple service for logging. Default implementation safely writes the message
+ * into the browser's console (if present).
+ *
+ * The main purpose of this service is to simplify debugging and troubleshooting.
+ *
+ * The default is to log `debug` messages. You can use
+ * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.
+ *
+ * @example
+ <example module="logExample">
+ <file name="script.js">
+ angular.module('logExample', [])
+ .controller('LogController', ['$scope', '$log', function($scope, $log) {
+ $scope.$log = $log;
+ $scope.message = 'Hello World!';
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="LogController">
+ <p>Reload this page with open console, enter text and hit the log button...</p>
+ <label>Message:
+ <input type="text" ng-model="message" /></label>
+ <button ng-click="$log.log(message)">log</button>
+ <button ng-click="$log.warn(message)">warn</button>
+ <button ng-click="$log.info(message)">info</button>
+ <button ng-click="$log.error(message)">error</button>
+ <button ng-click="$log.debug(message)">debug</button>
+ </div>
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc provider
+ * @name $logProvider
+ * @description
+ * Use the `$logProvider` to configure how the application logs messages
+ */
+function $LogProvider() {
+ var debug = true,
+ self = this;
+
+ /**
+ * @ngdoc method
+ * @name $logProvider#debugEnabled
+ * @description
+ * @param {boolean=} flag enable or disable debug level messages
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ */
+ this.debugEnabled = function(flag) {
+ if (isDefined(flag)) {
+ debug = flag;
+ return this;
+ } else {
+ return debug;
+ }
+ };
+
+ this.$get = ['$window', function($window) {
+ return {
+ /**
+ * @ngdoc method
+ * @name $log#log
+ *
+ * @description
+ * Write a log message
+ */
+ log: consoleLog('log'),
+
+ /**
+ * @ngdoc method
+ * @name $log#info
+ *
+ * @description
+ * Write an information message
+ */
+ info: consoleLog('info'),
+
+ /**
+ * @ngdoc method
+ * @name $log#warn
+ *
+ * @description
+ * Write a warning message
+ */
+ warn: consoleLog('warn'),
+
+ /**
+ * @ngdoc method
+ * @name $log#error
+ *
+ * @description
+ * Write an error message
+ */
+ error: consoleLog('error'),
+
+ /**
+ * @ngdoc method
+ * @name $log#debug
+ *
+ * @description
+ * Write a debug message
+ */
+ debug: (function() {
+ var fn = consoleLog('debug');
+
+ return function() {
+ if (debug) {
+ fn.apply(self, arguments);
+ }
+ };
+ }())
+ };
+
+ function formatError(arg) {
+ if (arg instanceof Error) {
+ if (arg.stack) {
+ arg = (arg.message && arg.stack.indexOf(arg.message) === -1)
+ ? 'Error: ' + arg.message + '\n' + arg.stack
+ : arg.stack;
+ } else if (arg.sourceURL) {
+ arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line;
+ }
+ }
+ return arg;
+ }
+
+ function consoleLog(type) {
+ var console = $window.console || {},
+ logFn = console[type] || console.log || noop,
+ hasApply = false;
+
+ // Note: reading logFn.apply throws an error in IE11 in IE8 document mode.
+ // The reason behind this is that console.log has type "object" in IE8...
+ try {
+ hasApply = !!logFn.apply;
+ } catch (e) {}
+
+ if (hasApply) {
+ return function() {
+ var args = [];
+ forEach(arguments, function(arg) {
+ args.push(formatError(arg));
+ });
+ return logFn.apply(console, args);
+ };
+ }
+
+ // we are IE which either doesn't have window.console => this is noop and we do nothing,
+ // or we are IE where console.log doesn't have apply so we log at least first 2 args
+ return function(arg1, arg2) {
+ logFn(arg1, arg2 == null ? '' : arg2);
+ };
+ }
+ }];
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+var $parseMinErr = minErr('$parse');
+
+// Sandboxing Angular Expressions
+// ------------------------------
+// Angular expressions are generally considered safe because these expressions only have direct
+// access to `$scope` and locals. However, one can obtain the ability to execute arbitrary JS code by
+// obtaining a reference to native JS functions such as the Function constructor.
+//
+// As an example, consider the following Angular expression:
+//
+// {}.toString.constructor('alert("evil JS code")')
+//
+// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits
+// against the expression language, but not to prevent exploits that were enabled by exposing
+// sensitive JavaScript or browser APIs on Scope. Exposing such objects on a Scope is never a good
+// practice and therefore we are not even trying to protect against interaction with an object
+// explicitly exposed in this way.
+//
+// In general, it is not possible to access a Window object from an angular expression unless a
+// window or some DOM object that has a reference to window is published onto a Scope.
+// Similarly we prevent invocations of function known to be dangerous, as well as assignments to
+// native objects.
+//
+// See https://docs.angularjs.org/guide/security
+
+
+function ensureSafeMemberName(name, fullExpression) {
+ if (name === "__defineGetter__" || name === "__defineSetter__"
+ || name === "__lookupGetter__" || name === "__lookupSetter__"
+ || name === "__proto__") {
+ throw $parseMinErr('isecfld',
+ 'Attempting to access a disallowed field in Angular expressions! '
+ + 'Expression: {0}', fullExpression);
+ }
+ return name;
+}
+
+function getStringValue(name) {
+ // Property names must be strings. This means that non-string objects cannot be used
+ // as keys in an object. Any non-string object, including a number, is typecasted
+ // into a string via the toString method.
+ // -- MDN, https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Property_accessors#Property_names
+ //
+ // So, to ensure that we are checking the same `name` that JavaScript would use, we cast it
+ // to a string. It's not always possible. If `name` is an object and its `toString` method is
+ // 'broken' (doesn't return a string, isn't a function, etc.), an error will be thrown:
+ //
+ // TypeError: Cannot convert object to primitive value
+ //
+ // For performance reasons, we don't catch this error here and allow it to propagate up the call
+ // stack. Note that you'll get the same error in JavaScript if you try to access a property using
+ // such a 'broken' object as a key.
+ return name + '';
+}
+
+function ensureSafeObject(obj, fullExpression) {
+ // nifty check if obj is Function that is fast and works across iframes and other contexts
+ if (obj) {
+ if (obj.constructor === obj) {
+ throw $parseMinErr('isecfn',
+ 'Referencing Function in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (// isWindow(obj)
+ obj.window === obj) {
+ throw $parseMinErr('isecwindow',
+ 'Referencing the Window in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (// isElement(obj)
+ obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) {
+ throw $parseMinErr('isecdom',
+ 'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (// block Object so that we can't get hold of dangerous Object.* methods
+ obj === Object) {
+ throw $parseMinErr('isecobj',
+ 'Referencing Object in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ }
+ }
+ return obj;
+}
+
+var CALL = Function.prototype.call;
+var APPLY = Function.prototype.apply;
+var BIND = Function.prototype.bind;
+
+function ensureSafeFunction(obj, fullExpression) {
+ if (obj) {
+ if (obj.constructor === obj) {
+ throw $parseMinErr('isecfn',
+ 'Referencing Function in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (obj === CALL || obj === APPLY || obj === BIND) {
+ throw $parseMinErr('isecff',
+ 'Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ }
+ }
+}
+
+function ensureSafeAssignContext(obj, fullExpression) {
+ if (obj) {
+ if (obj === (0).constructor || obj === (false).constructor || obj === ''.constructor ||
+ obj === {}.constructor || obj === [].constructor || obj === Function.constructor) {
+ throw $parseMinErr('isecaf',
+ 'Assigning to a constructor is disallowed! Expression: {0}', fullExpression);
+ }
+ }
+}
+
+var OPERATORS = createMap();
+forEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function(operator) { OPERATORS[operator] = true; });
+var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'};
+
+
+/////////////////////////////////////////
+
+
+/**
+ * @constructor
+ */
+var Lexer = function(options) {
+ this.options = options;
+};
+
+Lexer.prototype = {
+ constructor: Lexer,
+
+ lex: function(text) {
+ this.text = text;
+ this.index = 0;
+ this.tokens = [];
+
+ while (this.index < this.text.length) {
+ var ch = this.text.charAt(this.index);
+ if (ch === '"' || ch === "'") {
+ this.readString(ch);
+ } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) {
+ this.readNumber();
+ } else if (this.isIdent(ch)) {
+ this.readIdent();
+ } else if (this.is(ch, '(){}[].,;:?')) {
+ this.tokens.push({index: this.index, text: ch});
+ this.index++;
+ } else if (this.isWhitespace(ch)) {
+ this.index++;
+ } else {
+ var ch2 = ch + this.peek();
+ var ch3 = ch2 + this.peek(2);
+ var op1 = OPERATORS[ch];
+ var op2 = OPERATORS[ch2];
+ var op3 = OPERATORS[ch3];
+ if (op1 || op2 || op3) {
+ var token = op3 ? ch3 : (op2 ? ch2 : ch);
+ this.tokens.push({index: this.index, text: token, operator: true});
+ this.index += token.length;
+ } else {
+ this.throwError('Unexpected next character ', this.index, this.index + 1);
+ }
+ }
+ }
+ return this.tokens;
+ },
+
+ is: function(ch, chars) {
+ return chars.indexOf(ch) !== -1;
+ },
+
+ peek: function(i) {
+ var num = i || 1;
+ return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;
+ },
+
+ isNumber: function(ch) {
+ return ('0' <= ch && ch <= '9') && typeof ch === "string";
+ },
+
+ isWhitespace: function(ch) {
+ // IE treats non-breaking space as \u00A0
+ return (ch === ' ' || ch === '\r' || ch === '\t' ||
+ ch === '\n' || ch === '\v' || ch === '\u00A0');
+ },
+
+ isIdent: function(ch) {
+ return ('a' <= ch && ch <= 'z' ||
+ 'A' <= ch && ch <= 'Z' ||
+ '_' === ch || ch === '$');
+ },
+
+ isExpOperator: function(ch) {
+ return (ch === '-' || ch === '+' || this.isNumber(ch));
+ },
+
+ throwError: function(error, start, end) {
+ end = end || this.index;
+ var colStr = (isDefined(start)
+ ? 's ' + start + '-' + this.index + ' [' + this.text.substring(start, end) + ']'
+ : ' ' + end);
+ throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].',
+ error, colStr, this.text);
+ },
+
+ readNumber: function() {
+ var number = '';
+ var start = this.index;
+ while (this.index < this.text.length) {
+ var ch = lowercase(this.text.charAt(this.index));
+ if (ch == '.' || this.isNumber(ch)) {
+ number += ch;
+ } else {
+ var peekCh = this.peek();
+ if (ch == 'e' && this.isExpOperator(peekCh)) {
+ number += ch;
+ } else if (this.isExpOperator(ch) &&
+ peekCh && this.isNumber(peekCh) &&
+ number.charAt(number.length - 1) == 'e') {
+ number += ch;
+ } else if (this.isExpOperator(ch) &&
+ (!peekCh || !this.isNumber(peekCh)) &&
+ number.charAt(number.length - 1) == 'e') {
+ this.throwError('Invalid exponent');
+ } else {
+ break;
+ }
+ }
+ this.index++;
+ }
+ this.tokens.push({
+ index: start,
+ text: number,
+ constant: true,
+ value: Number(number)
+ });
+ },
+
+ readIdent: function() {
+ var start = this.index;
+ while (this.index < this.text.length) {
+ var ch = this.text.charAt(this.index);
+ if (!(this.isIdent(ch) || this.isNumber(ch))) {
+ break;
+ }
+ this.index++;
+ }
+ this.tokens.push({
+ index: start,
+ text: this.text.slice(start, this.index),
+ identifier: true
+ });
+ },
+
+ readString: function(quote) {
+ var start = this.index;
+ this.index++;
+ var string = '';
+ var rawString = quote;
+ var escape = false;
+ while (this.index < this.text.length) {
+ var ch = this.text.charAt(this.index);
+ rawString += ch;
+ if (escape) {
+ if (ch === 'u') {
+ var hex = this.text.substring(this.index + 1, this.index + 5);
+ if (!hex.match(/[\da-f]{4}/i)) {
+ this.throwError('Invalid unicode escape [\\u' + hex + ']');
+ }
+ this.index += 4;
+ string += String.fromCharCode(parseInt(hex, 16));
+ } else {
+ var rep = ESCAPE[ch];
+ string = string + (rep || ch);
+ }
+ escape = false;
+ } else if (ch === '\\') {
+ escape = true;
+ } else if (ch === quote) {
+ this.index++;
+ this.tokens.push({
+ index: start,
+ text: rawString,
+ constant: true,
+ value: string
+ });
+ return;
+ } else {
+ string += ch;
+ }
+ this.index++;
+ }
+ this.throwError('Unterminated quote', start);
+ }
+};
+
+var AST = function(lexer, options) {
+ this.lexer = lexer;
+ this.options = options;
+};
+
+AST.Program = 'Program';
+AST.ExpressionStatement = 'ExpressionStatement';
+AST.AssignmentExpression = 'AssignmentExpression';
+AST.ConditionalExpression = 'ConditionalExpression';
+AST.LogicalExpression = 'LogicalExpression';
+AST.BinaryExpression = 'BinaryExpression';
+AST.UnaryExpression = 'UnaryExpression';
+AST.CallExpression = 'CallExpression';
+AST.MemberExpression = 'MemberExpression';
+AST.Identifier = 'Identifier';
+AST.Literal = 'Literal';
+AST.ArrayExpression = 'ArrayExpression';
+AST.Property = 'Property';
+AST.ObjectExpression = 'ObjectExpression';
+AST.ThisExpression = 'ThisExpression';
+AST.LocalsExpression = 'LocalsExpression';
+
+// Internal use only
+AST.NGValueParameter = 'NGValueParameter';
+
+AST.prototype = {
+ ast: function(text) {
+ this.text = text;
+ this.tokens = this.lexer.lex(text);
+
+ var value = this.program();
+
+ if (this.tokens.length !== 0) {
+ this.throwError('is an unexpected token', this.tokens[0]);
+ }
+
+ return value;
+ },
+
+ program: function() {
+ var body = [];
+ while (true) {
+ if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']'))
+ body.push(this.expressionStatement());
+ if (!this.expect(';')) {
+ return { type: AST.Program, body: body};
+ }
+ }
+ },
+
+ expressionStatement: function() {
+ return { type: AST.ExpressionStatement, expression: this.filterChain() };
+ },
+
+ filterChain: function() {
+ var left = this.expression();
+ var token;
+ while ((token = this.expect('|'))) {
+ left = this.filter(left);
+ }
+ return left;
+ },
+
+ expression: function() {
+ return this.assignment();
+ },
+
+ assignment: function() {
+ var result = this.ternary();
+ if (this.expect('=')) {
+ result = { type: AST.AssignmentExpression, left: result, right: this.assignment(), operator: '='};
+ }
+ return result;
+ },
+
+ ternary: function() {
+ var test = this.logicalOR();
+ var alternate;
+ var consequent;
+ if (this.expect('?')) {
+ alternate = this.expression();
+ if (this.consume(':')) {
+ consequent = this.expression();
+ return { type: AST.ConditionalExpression, test: test, alternate: alternate, consequent: consequent};
+ }
+ }
+ return test;
+ },
+
+ logicalOR: function() {
+ var left = this.logicalAND();
+ while (this.expect('||')) {
+ left = { type: AST.LogicalExpression, operator: '||', left: left, right: this.logicalAND() };
+ }
+ return left;
+ },
+
+ logicalAND: function() {
+ var left = this.equality();
+ while (this.expect('&&')) {
+ left = { type: AST.LogicalExpression, operator: '&&', left: left, right: this.equality()};
+ }
+ return left;
+ },
+
+ equality: function() {
+ var left = this.relational();
+ var token;
+ while ((token = this.expect('==','!=','===','!=='))) {
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.relational() };
+ }
+ return left;
+ },
+
+ relational: function() {
+ var left = this.additive();
+ var token;
+ while ((token = this.expect('<', '>', '<=', '>='))) {
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.additive() };
+ }
+ return left;
+ },
+
+ additive: function() {
+ var left = this.multiplicative();
+ var token;
+ while ((token = this.expect('+','-'))) {
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.multiplicative() };
+ }
+ return left;
+ },
+
+ multiplicative: function() {
+ var left = this.unary();
+ var token;
+ while ((token = this.expect('*','/','%'))) {
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.unary() };
+ }
+ return left;
+ },
+
+ unary: function() {
+ var token;
+ if ((token = this.expect('+', '-', '!'))) {
+ return { type: AST.UnaryExpression, operator: token.text, prefix: true, argument: this.unary() };
+ } else {
+ return this.primary();
+ }
+ },
+
+ primary: function() {
+ var primary;
+ if (this.expect('(')) {
+ primary = this.filterChain();
+ this.consume(')');
+ } else if (this.expect('[')) {
+ primary = this.arrayDeclaration();
+ } else if (this.expect('{')) {
+ primary = this.object();
+ } else if (this.constants.hasOwnProperty(this.peek().text)) {
+ primary = copy(this.constants[this.consume().text]);
+ } else if (this.peek().identifier) {
+ primary = this.identifier();
+ } else if (this.peek().constant) {
+ primary = this.constant();
+ } else {
+ this.throwError('not a primary expression', this.peek());
+ }
+
+ var next;
+ while ((next = this.expect('(', '[', '.'))) {
+ if (next.text === '(') {
+ primary = {type: AST.CallExpression, callee: primary, arguments: this.parseArguments() };
+ this.consume(')');
+ } else if (next.text === '[') {
+ primary = { type: AST.MemberExpression, object: primary, property: this.expression(), computed: true };
+ this.consume(']');
+ } else if (next.text === '.') {
+ primary = { type: AST.MemberExpression, object: primary, property: this.identifier(), computed: false };
+ } else {
+ this.throwError('IMPOSSIBLE');
+ }
+ }
+ return primary;
+ },
+
+ filter: function(baseExpression) {
+ var args = [baseExpression];
+ var result = {type: AST.CallExpression, callee: this.identifier(), arguments: args, filter: true};
+
+ while (this.expect(':')) {
+ args.push(this.expression());
+ }
+
+ return result;
+ },
+
+ parseArguments: function() {
+ var args = [];
+ if (this.peekToken().text !== ')') {
+ do {
+ args.push(this.expression());
+ } while (this.expect(','));
+ }
+ return args;
+ },
+
+ identifier: function() {
+ var token = this.consume();
+ if (!token.identifier) {
+ this.throwError('is not a valid identifier', token);
+ }
+ return { type: AST.Identifier, name: token.text };
+ },
+
+ constant: function() {
+ // TODO check that it is a constant
+ return { type: AST.Literal, value: this.consume().value };
+ },
+
+ arrayDeclaration: function() {
+ var elements = [];
+ if (this.peekToken().text !== ']') {
+ do {
+ if (this.peek(']')) {
+ // Support trailing commas per ES5.1.
+ break;
+ }
+ elements.push(this.expression());
+ } while (this.expect(','));
+ }
+ this.consume(']');
+
+ return { type: AST.ArrayExpression, elements: elements };
+ },
+
+ object: function() {
+ var properties = [], property;
+ if (this.peekToken().text !== '}') {
+ do {
+ if (this.peek('}')) {
+ // Support trailing commas per ES5.1.
+ break;
+ }
+ property = {type: AST.Property, kind: 'init'};
+ if (this.peek().constant) {
+ property.key = this.constant();
+ } else if (this.peek().identifier) {
+ property.key = this.identifier();
+ } else {
+ this.throwError("invalid key", this.peek());
+ }
+ this.consume(':');
+ property.value = this.expression();
+ properties.push(property);
+ } while (this.expect(','));
+ }
+ this.consume('}');
+
+ return {type: AST.ObjectExpression, properties: properties };
+ },
+
+ throwError: function(msg, token) {
+ throw $parseMinErr('syntax',
+ 'Syntax Error: Token \'{0}\' {1} at column {2} of the expression [{3}] starting at [{4}].',
+ token.text, msg, (token.index + 1), this.text, this.text.substring(token.index));
+ },
+
+ consume: function(e1) {
+ if (this.tokens.length === 0) {
+ throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);
+ }
+
+ var token = this.expect(e1);
+ if (!token) {
+ this.throwError('is unexpected, expecting [' + e1 + ']', this.peek());
+ }
+ return token;
+ },
+
+ peekToken: function() {
+ if (this.tokens.length === 0) {
+ throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);
+ }
+ return this.tokens[0];
+ },
+
+ peek: function(e1, e2, e3, e4) {
+ return this.peekAhead(0, e1, e2, e3, e4);
+ },
+
+ peekAhead: function(i, e1, e2, e3, e4) {
+ if (this.tokens.length > i) {
+ var token = this.tokens[i];
+ var t = token.text;
+ if (t === e1 || t === e2 || t === e3 || t === e4 ||
+ (!e1 && !e2 && !e3 && !e4)) {
+ return token;
+ }
+ }
+ return false;
+ },
+
+ expect: function(e1, e2, e3, e4) {
+ var token = this.peek(e1, e2, e3, e4);
+ if (token) {
+ this.tokens.shift();
+ return token;
+ }
+ return false;
+ },
+
+
+ /* `undefined` is not a constant, it is an identifier,
+ * but using it as an identifier is not supported
+ */
+ constants: {
+ 'true': { type: AST.Literal, value: true },
+ 'false': { type: AST.Literal, value: false },
+ 'null': { type: AST.Literal, value: null },
+ 'undefined': {type: AST.Literal, value: undefined },
+ 'this': {type: AST.ThisExpression },
+ '$locals': {type: AST.LocalsExpression }
+ }
+};
+
+function ifDefined(v, d) {
+ return typeof v !== 'undefined' ? v : d;
+}
+
+function plusFn(l, r) {
+ if (typeof l === 'undefined') return r;
+ if (typeof r === 'undefined') return l;
+ return l + r;
+}
+
+function isStateless($filter, filterName) {
+ var fn = $filter(filterName);
+ return !fn.$stateful;
+}
+
+function findConstantAndWatchExpressions(ast, $filter) {
+ var allConstants;
+ var argsToWatch;
+ switch (ast.type) {
+ case AST.Program:
+ allConstants = true;
+ forEach(ast.body, function(expr) {
+ findConstantAndWatchExpressions(expr.expression, $filter);
+ allConstants = allConstants && expr.expression.constant;
+ });
+ ast.constant = allConstants;
+ break;
+ case AST.Literal:
+ ast.constant = true;
+ ast.toWatch = [];
+ break;
+ case AST.UnaryExpression:
+ findConstantAndWatchExpressions(ast.argument, $filter);
+ ast.constant = ast.argument.constant;
+ ast.toWatch = ast.argument.toWatch;
+ break;
+ case AST.BinaryExpression:
+ findConstantAndWatchExpressions(ast.left, $filter);
+ findConstantAndWatchExpressions(ast.right, $filter);
+ ast.constant = ast.left.constant && ast.right.constant;
+ ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch);
+ break;
+ case AST.LogicalExpression:
+ findConstantAndWatchExpressions(ast.left, $filter);
+ findConstantAndWatchExpressions(ast.right, $filter);
+ ast.constant = ast.left.constant && ast.right.constant;
+ ast.toWatch = ast.constant ? [] : [ast];
+ break;
+ case AST.ConditionalExpression:
+ findConstantAndWatchExpressions(ast.test, $filter);
+ findConstantAndWatchExpressions(ast.alternate, $filter);
+ findConstantAndWatchExpressions(ast.consequent, $filter);
+ ast.constant = ast.test.constant && ast.alternate.constant && ast.consequent.constant;
+ ast.toWatch = ast.constant ? [] : [ast];
+ break;
+ case AST.Identifier:
+ ast.constant = false;
+ ast.toWatch = [ast];
+ break;
+ case AST.MemberExpression:
+ findConstantAndWatchExpressions(ast.object, $filter);
+ if (ast.computed) {
+ findConstantAndWatchExpressions(ast.property, $filter);
+ }
+ ast.constant = ast.object.constant && (!ast.computed || ast.property.constant);
+ ast.toWatch = [ast];
+ break;
+ case AST.CallExpression:
+ allConstants = ast.filter ? isStateless($filter, ast.callee.name) : false;
+ argsToWatch = [];
+ forEach(ast.arguments, function(expr) {
+ findConstantAndWatchExpressions(expr, $filter);
+ allConstants = allConstants && expr.constant;
+ if (!expr.constant) {
+ argsToWatch.push.apply(argsToWatch, expr.toWatch);
+ }
+ });
+ ast.constant = allConstants;
+ ast.toWatch = ast.filter && isStateless($filter, ast.callee.name) ? argsToWatch : [ast];
+ break;
+ case AST.AssignmentExpression:
+ findConstantAndWatchExpressions(ast.left, $filter);
+ findConstantAndWatchExpressions(ast.right, $filter);
+ ast.constant = ast.left.constant && ast.right.constant;
+ ast.toWatch = [ast];
+ break;
+ case AST.ArrayExpression:
+ allConstants = true;
+ argsToWatch = [];
+ forEach(ast.elements, function(expr) {
+ findConstantAndWatchExpressions(expr, $filter);
+ allConstants = allConstants && expr.constant;
+ if (!expr.constant) {
+ argsToWatch.push.apply(argsToWatch, expr.toWatch);
+ }
+ });
+ ast.constant = allConstants;
+ ast.toWatch = argsToWatch;
+ break;
+ case AST.ObjectExpression:
+ allConstants = true;
+ argsToWatch = [];
+ forEach(ast.properties, function(property) {
+ findConstantAndWatchExpressions(property.value, $filter);
+ allConstants = allConstants && property.value.constant;
+ if (!property.value.constant) {
+ argsToWatch.push.apply(argsToWatch, property.value.toWatch);
+ }
+ });
+ ast.constant = allConstants;
+ ast.toWatch = argsToWatch;
+ break;
+ case AST.ThisExpression:
+ ast.constant = false;
+ ast.toWatch = [];
+ break;
+ case AST.LocalsExpression:
+ ast.constant = false;
+ ast.toWatch = [];
+ break;
+ }
+}
+
+function getInputs(body) {
+ if (body.length != 1) return;
+ var lastExpression = body[0].expression;
+ var candidate = lastExpression.toWatch;
+ if (candidate.length !== 1) return candidate;
+ return candidate[0] !== lastExpression ? candidate : undefined;
+}
+
+function isAssignable(ast) {
+ return ast.type === AST.Identifier || ast.type === AST.MemberExpression;
+}
+
+function assignableAST(ast) {
+ if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) {
+ return {type: AST.AssignmentExpression, left: ast.body[0].expression, right: {type: AST.NGValueParameter}, operator: '='};
+ }
+}
+
+function isLiteral(ast) {
+ return ast.body.length === 0 ||
+ ast.body.length === 1 && (
+ ast.body[0].expression.type === AST.Literal ||
+ ast.body[0].expression.type === AST.ArrayExpression ||
+ ast.body[0].expression.type === AST.ObjectExpression);
+}
+
+function isConstant(ast) {
+ return ast.constant;
+}
+
+function ASTCompiler(astBuilder, $filter) {
+ this.astBuilder = astBuilder;
+ this.$filter = $filter;
+}
+
+ASTCompiler.prototype = {
+ compile: function(expression, expensiveChecks) {
+ var self = this;
+ var ast = this.astBuilder.ast(expression);
+ this.state = {
+ nextId: 0,
+ filters: {},
+ expensiveChecks: expensiveChecks,
+ fn: {vars: [], body: [], own: {}},
+ assign: {vars: [], body: [], own: {}},
+ inputs: []
+ };
+ findConstantAndWatchExpressions(ast, self.$filter);
+ var extra = '';
+ var assignable;
+ this.stage = 'assign';
+ if ((assignable = assignableAST(ast))) {
+ this.state.computing = 'assign';
+ var result = this.nextId();
+ this.recurse(assignable, result);
+ this.return_(result);
+ extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l');
+ }
+ var toWatch = getInputs(ast.body);
+ self.stage = 'inputs';
+ forEach(toWatch, function(watch, key) {
+ var fnKey = 'fn' + key;
+ self.state[fnKey] = {vars: [], body: [], own: {}};
+ self.state.computing = fnKey;
+ var intoId = self.nextId();
+ self.recurse(watch, intoId);
+ self.return_(intoId);
+ self.state.inputs.push(fnKey);
+ watch.watchId = key;
+ });
+ this.state.computing = 'fn';
+ this.stage = 'main';
+ this.recurse(ast);
+ var fnString =
+ // The build and minification steps remove the string "use strict" from the code, but this is done using a regex.
+ // This is a workaround for this until we do a better job at only removing the prefix only when we should.
+ '"' + this.USE + ' ' + this.STRICT + '";\n' +
+ this.filterPrefix() +
+ 'var fn=' + this.generateFunction('fn', 's,l,a,i') +
+ extra +
+ this.watchFns() +
+ 'return fn;';
+
+ /* jshint -W054 */
+ var fn = (new Function('$filter',
+ 'ensureSafeMemberName',
+ 'ensureSafeObject',
+ 'ensureSafeFunction',
+ 'getStringValue',
+ 'ensureSafeAssignContext',
+ 'ifDefined',
+ 'plus',
+ 'text',
+ fnString))(
+ this.$filter,
+ ensureSafeMemberName,
+ ensureSafeObject,
+ ensureSafeFunction,
+ getStringValue,
+ ensureSafeAssignContext,
+ ifDefined,
+ plusFn,
+ expression);
+ /* jshint +W054 */
+ this.state = this.stage = undefined;
+ fn.literal = isLiteral(ast);
+ fn.constant = isConstant(ast);
+ return fn;
+ },
+
+ USE: 'use',
+
+ STRICT: 'strict',
+
+ watchFns: function() {
+ var result = [];
+ var fns = this.state.inputs;
+ var self = this;
+ forEach(fns, function(name) {
+ result.push('var ' + name + '=' + self.generateFunction(name, 's'));
+ });
+ if (fns.length) {
+ result.push('fn.inputs=[' + fns.join(',') + '];');
+ }
+ return result.join('');
+ },
+
+ generateFunction: function(name, params) {
+ return 'function(' + params + '){' +
+ this.varsPrefix(name) +
+ this.body(name) +
+ '};';
+ },
+
+ filterPrefix: function() {
+ var parts = [];
+ var self = this;
+ forEach(this.state.filters, function(id, filter) {
+ parts.push(id + '=$filter(' + self.escape(filter) + ')');
+ });
+ if (parts.length) return 'var ' + parts.join(',') + ';';
+ return '';
+ },
+
+ varsPrefix: function(section) {
+ return this.state[section].vars.length ? 'var ' + this.state[section].vars.join(',') + ';' : '';
+ },
+
+ body: function(section) {
+ return this.state[section].body.join('');
+ },
+
+ recurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
+ var left, right, self = this, args, expression;
+ recursionFn = recursionFn || noop;
+ if (!skipWatchIdCheck && isDefined(ast.watchId)) {
+ intoId = intoId || this.nextId();
+ this.if_('i',
+ this.lazyAssign(intoId, this.computedMember('i', ast.watchId)),
+ this.lazyRecurse(ast, intoId, nameId, recursionFn, create, true)
+ );
+ return;
+ }
+ switch (ast.type) {
+ case AST.Program:
+ forEach(ast.body, function(expression, pos) {
+ self.recurse(expression.expression, undefined, undefined, function(expr) { right = expr; });
+ if (pos !== ast.body.length - 1) {
+ self.current().body.push(right, ';');
+ } else {
+ self.return_(right);
+ }
+ });
+ break;
+ case AST.Literal:
+ expression = this.escape(ast.value);
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.UnaryExpression:
+ this.recurse(ast.argument, undefined, undefined, function(expr) { right = expr; });
+ expression = ast.operator + '(' + this.ifDefined(right, 0) + ')';
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.BinaryExpression:
+ this.recurse(ast.left, undefined, undefined, function(expr) { left = expr; });
+ this.recurse(ast.right, undefined, undefined, function(expr) { right = expr; });
+ if (ast.operator === '+') {
+ expression = this.plus(left, right);
+ } else if (ast.operator === '-') {
+ expression = this.ifDefined(left, 0) + ast.operator + this.ifDefined(right, 0);
+ } else {
+ expression = '(' + left + ')' + ast.operator + '(' + right + ')';
+ }
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.LogicalExpression:
+ intoId = intoId || this.nextId();
+ self.recurse(ast.left, intoId);
+ self.if_(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId));
+ recursionFn(intoId);
+ break;
+ case AST.ConditionalExpression:
+ intoId = intoId || this.nextId();
+ self.recurse(ast.test, intoId);
+ self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId));
+ recursionFn(intoId);
+ break;
+ case AST.Identifier:
+ intoId = intoId || this.nextId();
+ if (nameId) {
+ nameId.context = self.stage === 'inputs' ? 's' : this.assign(this.nextId(), this.getHasOwnProperty('l', ast.name) + '?l:s');
+ nameId.computed = false;
+ nameId.name = ast.name;
+ }
+ ensureSafeMemberName(ast.name);
+ self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)),
+ function() {
+ self.if_(self.stage === 'inputs' || 's', function() {
+ if (create && create !== 1) {
+ self.if_(
+ self.not(self.nonComputedMember('s', ast.name)),
+ self.lazyAssign(self.nonComputedMember('s', ast.name), '{}'));
+ }
+ self.assign(intoId, self.nonComputedMember('s', ast.name));
+ });
+ }, intoId && self.lazyAssign(intoId, self.nonComputedMember('l', ast.name))
+ );
+ if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.name)) {
+ self.addEnsureSafeObject(intoId);
+ }
+ recursionFn(intoId);
+ break;
+ case AST.MemberExpression:
+ left = nameId && (nameId.context = this.nextId()) || this.nextId();
+ intoId = intoId || this.nextId();
+ self.recurse(ast.object, left, undefined, function() {
+ self.if_(self.notNull(left), function() {
+ if (create && create !== 1) {
+ self.addEnsureSafeAssignContext(left);
+ }
+ if (ast.computed) {
+ right = self.nextId();
+ self.recurse(ast.property, right);
+ self.getStringValue(right);
+ self.addEnsureSafeMemberName(right);
+ if (create && create !== 1) {
+ self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}'));
+ }
+ expression = self.ensureSafeObject(self.computedMember(left, right));
+ self.assign(intoId, expression);
+ if (nameId) {
+ nameId.computed = true;
+ nameId.name = right;
+ }
+ } else {
+ ensureSafeMemberName(ast.property.name);
+ if (create && create !== 1) {
+ self.if_(self.not(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}'));
+ }
+ expression = self.nonComputedMember(left, ast.property.name);
+ if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.property.name)) {
+ expression = self.ensureSafeObject(expression);
+ }
+ self.assign(intoId, expression);
+ if (nameId) {
+ nameId.computed = false;
+ nameId.name = ast.property.name;
+ }
+ }
+ }, function() {
+ self.assign(intoId, 'undefined');
+ });
+ recursionFn(intoId);
+ }, !!create);
+ break;
+ case AST.CallExpression:
+ intoId = intoId || this.nextId();
+ if (ast.filter) {
+ right = self.filter(ast.callee.name);
+ args = [];
+ forEach(ast.arguments, function(expr) {
+ var argument = self.nextId();
+ self.recurse(expr, argument);
+ args.push(argument);
+ });
+ expression = right + '(' + args.join(',') + ')';
+ self.assign(intoId, expression);
+ recursionFn(intoId);
+ } else {
+ right = self.nextId();
+ left = {};
+ args = [];
+ self.recurse(ast.callee, right, left, function() {
+ self.if_(self.notNull(right), function() {
+ self.addEnsureSafeFunction(right);
+ forEach(ast.arguments, function(expr) {
+ self.recurse(expr, self.nextId(), undefined, function(argument) {
+ args.push(self.ensureSafeObject(argument));
+ });
+ });
+ if (left.name) {
+ if (!self.state.expensiveChecks) {
+ self.addEnsureSafeObject(left.context);
+ }
+ expression = self.member(left.context, left.name, left.computed) + '(' + args.join(',') + ')';
+ } else {
+ expression = right + '(' + args.join(',') + ')';
+ }
+ expression = self.ensureSafeObject(expression);
+ self.assign(intoId, expression);
+ }, function() {
+ self.assign(intoId, 'undefined');
+ });
+ recursionFn(intoId);
+ });
+ }
+ break;
+ case AST.AssignmentExpression:
+ right = this.nextId();
+ left = {};
+ if (!isAssignable(ast.left)) {
+ throw $parseMinErr('lval', 'Trying to assign a value to a non l-value');
+ }
+ this.recurse(ast.left, undefined, left, function() {
+ self.if_(self.notNull(left.context), function() {
+ self.recurse(ast.right, right);
+ self.addEnsureSafeObject(self.member(left.context, left.name, left.computed));
+ self.addEnsureSafeAssignContext(left.context);
+ expression = self.member(left.context, left.name, left.computed) + ast.operator + right;
+ self.assign(intoId, expression);
+ recursionFn(intoId || expression);
+ });
+ }, 1);
+ break;
+ case AST.ArrayExpression:
+ args = [];
+ forEach(ast.elements, function(expr) {
+ self.recurse(expr, self.nextId(), undefined, function(argument) {
+ args.push(argument);
+ });
+ });
+ expression = '[' + args.join(',') + ']';
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.ObjectExpression:
+ args = [];
+ forEach(ast.properties, function(property) {
+ self.recurse(property.value, self.nextId(), undefined, function(expr) {
+ args.push(self.escape(
+ property.key.type === AST.Identifier ? property.key.name :
+ ('' + property.key.value)) +
+ ':' + expr);
+ });
+ });
+ expression = '{' + args.join(',') + '}';
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.ThisExpression:
+ this.assign(intoId, 's');
+ recursionFn('s');
+ break;
+ case AST.LocalsExpression:
+ this.assign(intoId, 'l');
+ recursionFn('l');
+ break;
+ case AST.NGValueParameter:
+ this.assign(intoId, 'v');
+ recursionFn('v');
+ break;
+ }
+ },
+
+ getHasOwnProperty: function(element, property) {
+ var key = element + '.' + property;
+ var own = this.current().own;
+ if (!own.hasOwnProperty(key)) {
+ own[key] = this.nextId(false, element + '&&(' + this.escape(property) + ' in ' + element + ')');
+ }
+ return own[key];
+ },
+
+ assign: function(id, value) {
+ if (!id) return;
+ this.current().body.push(id, '=', value, ';');
+ return id;
+ },
+
+ filter: function(filterName) {
+ if (!this.state.filters.hasOwnProperty(filterName)) {
+ this.state.filters[filterName] = this.nextId(true);
+ }
+ return this.state.filters[filterName];
+ },
+
+ ifDefined: function(id, defaultValue) {
+ return 'ifDefined(' + id + ',' + this.escape(defaultValue) + ')';
+ },
+
+ plus: function(left, right) {
+ return 'plus(' + left + ',' + right + ')';
+ },
+
+ return_: function(id) {
+ this.current().body.push('return ', id, ';');
+ },
+
+ if_: function(test, alternate, consequent) {
+ if (test === true) {
+ alternate();
+ } else {
+ var body = this.current().body;
+ body.push('if(', test, '){');
+ alternate();
+ body.push('}');
+ if (consequent) {
+ body.push('else{');
+ consequent();
+ body.push('}');
+ }
+ }
+ },
+
+ not: function(expression) {
+ return '!(' + expression + ')';
+ },
+
+ notNull: function(expression) {
+ return expression + '!=null';
+ },
+
+ nonComputedMember: function(left, right) {
+ return left + '.' + right;
+ },
+
+ computedMember: function(left, right) {
+ return left + '[' + right + ']';
+ },
+
+ member: function(left, right, computed) {
+ if (computed) return this.computedMember(left, right);
+ return this.nonComputedMember(left, right);
+ },
+
+ addEnsureSafeObject: function(item) {
+ this.current().body.push(this.ensureSafeObject(item), ';');
+ },
+
+ addEnsureSafeMemberName: function(item) {
+ this.current().body.push(this.ensureSafeMemberName(item), ';');
+ },
+
+ addEnsureSafeFunction: function(item) {
+ this.current().body.push(this.ensureSafeFunction(item), ';');
+ },
+
+ addEnsureSafeAssignContext: function(item) {
+ this.current().body.push(this.ensureSafeAssignContext(item), ';');
+ },
+
+ ensureSafeObject: function(item) {
+ return 'ensureSafeObject(' + item + ',text)';
+ },
+
+ ensureSafeMemberName: function(item) {
+ return 'ensureSafeMemberName(' + item + ',text)';
+ },
+
+ ensureSafeFunction: function(item) {
+ return 'ensureSafeFunction(' + item + ',text)';
+ },
+
+ getStringValue: function(item) {
+ this.assign(item, 'getStringValue(' + item + ')');
+ },
+
+ ensureSafeAssignContext: function(item) {
+ return 'ensureSafeAssignContext(' + item + ',text)';
+ },
+
+ lazyRecurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
+ var self = this;
+ return function() {
+ self.recurse(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck);
+ };
+ },
+
+ lazyAssign: function(id, value) {
+ var self = this;
+ return function() {
+ self.assign(id, value);
+ };
+ },
+
+ stringEscapeRegex: /[^ a-zA-Z0-9]/g,
+
+ stringEscapeFn: function(c) {
+ return '\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4);
+ },
+
+ escape: function(value) {
+ if (isString(value)) return "'" + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + "'";
+ if (isNumber(value)) return value.toString();
+ if (value === true) return 'true';
+ if (value === false) return 'false';
+ if (value === null) return 'null';
+ if (typeof value === 'undefined') return 'undefined';
+
+ throw $parseMinErr('esc', 'IMPOSSIBLE');
+ },
+
+ nextId: function(skip, init) {
+ var id = 'v' + (this.state.nextId++);
+ if (!skip) {
+ this.current().vars.push(id + (init ? '=' + init : ''));
+ }
+ return id;
+ },
+
+ current: function() {
+ return this.state[this.state.computing];
+ }
+};
+
+
+function ASTInterpreter(astBuilder, $filter) {
+ this.astBuilder = astBuilder;
+ this.$filter = $filter;
+}
+
+ASTInterpreter.prototype = {
+ compile: function(expression, expensiveChecks) {
+ var self = this;
+ var ast = this.astBuilder.ast(expression);
+ this.expression = expression;
+ this.expensiveChecks = expensiveChecks;
+ findConstantAndWatchExpressions(ast, self.$filter);
+ var assignable;
+ var assign;
+ if ((assignable = assignableAST(ast))) {
+ assign = this.recurse(assignable);
+ }
+ var toWatch = getInputs(ast.body);
+ var inputs;
+ if (toWatch) {
+ inputs = [];
+ forEach(toWatch, function(watch, key) {
+ var input = self.recurse(watch);
+ watch.input = input;
+ inputs.push(input);
+ watch.watchId = key;
+ });
+ }
+ var expressions = [];
+ forEach(ast.body, function(expression) {
+ expressions.push(self.recurse(expression.expression));
+ });
+ var fn = ast.body.length === 0 ? function() {} :
+ ast.body.length === 1 ? expressions[0] :
+ function(scope, locals) {
+ var lastValue;
+ forEach(expressions, function(exp) {
+ lastValue = exp(scope, locals);
+ });
+ return lastValue;
+ };
+ if (assign) {
+ fn.assign = function(scope, value, locals) {
+ return assign(scope, locals, value);
+ };
+ }
+ if (inputs) {
+ fn.inputs = inputs;
+ }
+ fn.literal = isLiteral(ast);
+ fn.constant = isConstant(ast);
+ return fn;
+ },
+
+ recurse: function(ast, context, create) {
+ var left, right, self = this, args, expression;
+ if (ast.input) {
+ return this.inputs(ast.input, ast.watchId);
+ }
+ switch (ast.type) {
+ case AST.Literal:
+ return this.value(ast.value, context);
+ case AST.UnaryExpression:
+ right = this.recurse(ast.argument);
+ return this['unary' + ast.operator](right, context);
+ case AST.BinaryExpression:
+ left = this.recurse(ast.left);
+ right = this.recurse(ast.right);
+ return this['binary' + ast.operator](left, right, context);
+ case AST.LogicalExpression:
+ left = this.recurse(ast.left);
+ right = this.recurse(ast.right);
+ return this['binary' + ast.operator](left, right, context);
+ case AST.ConditionalExpression:
+ return this['ternary?:'](
+ this.recurse(ast.test),
+ this.recurse(ast.alternate),
+ this.recurse(ast.consequent),
+ context
+ );
+ case AST.Identifier:
+ ensureSafeMemberName(ast.name, self.expression);
+ return self.identifier(ast.name,
+ self.expensiveChecks || isPossiblyDangerousMemberName(ast.name),
+ context, create, self.expression);
+ case AST.MemberExpression:
+ left = this.recurse(ast.object, false, !!create);
+ if (!ast.computed) {
+ ensureSafeMemberName(ast.property.name, self.expression);
+ right = ast.property.name;
+ }
+ if (ast.computed) right = this.recurse(ast.property);
+ return ast.computed ?
+ this.computedMember(left, right, context, create, self.expression) :
+ this.nonComputedMember(left, right, self.expensiveChecks, context, create, self.expression);
+ case AST.CallExpression:
+ args = [];
+ forEach(ast.arguments, function(expr) {
+ args.push(self.recurse(expr));
+ });
+ if (ast.filter) right = this.$filter(ast.callee.name);
+ if (!ast.filter) right = this.recurse(ast.callee, true);
+ return ast.filter ?
+ function(scope, locals, assign, inputs) {
+ var values = [];
+ for (var i = 0; i < args.length; ++i) {
+ values.push(args[i](scope, locals, assign, inputs));
+ }
+ var value = right.apply(undefined, values, inputs);
+ return context ? {context: undefined, name: undefined, value: value} : value;
+ } :
+ function(scope, locals, assign, inputs) {
+ var rhs = right(scope, locals, assign, inputs);
+ var value;
+ if (rhs.value != null) {
+ ensureSafeObject(rhs.context, self.expression);
+ ensureSafeFunction(rhs.value, self.expression);
+ var values = [];
+ for (var i = 0; i < args.length; ++i) {
+ values.push(ensureSafeObject(args[i](scope, locals, assign, inputs), self.expression));
+ }
+ value = ensureSafeObject(rhs.value.apply(rhs.context, values), self.expression);
+ }
+ return context ? {value: value} : value;
+ };
+ case AST.AssignmentExpression:
+ left = this.recurse(ast.left, true, 1);
+ right = this.recurse(ast.right);
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ var rhs = right(scope, locals, assign, inputs);
+ ensureSafeObject(lhs.value, self.expression);
+ ensureSafeAssignContext(lhs.context);
+ lhs.context[lhs.name] = rhs;
+ return context ? {value: rhs} : rhs;
+ };
+ case AST.ArrayExpression:
+ args = [];
+ forEach(ast.elements, function(expr) {
+ args.push(self.recurse(expr));
+ });
+ return function(scope, locals, assign, inputs) {
+ var value = [];
+ for (var i = 0; i < args.length; ++i) {
+ value.push(args[i](scope, locals, assign, inputs));
+ }
+ return context ? {value: value} : value;
+ };
+ case AST.ObjectExpression:
+ args = [];
+ forEach(ast.properties, function(property) {
+ args.push({key: property.key.type === AST.Identifier ?
+ property.key.name :
+ ('' + property.key.value),
+ value: self.recurse(property.value)
+ });
+ });
+ return function(scope, locals, assign, inputs) {
+ var value = {};
+ for (var i = 0; i < args.length; ++i) {
+ value[args[i].key] = args[i].value(scope, locals, assign, inputs);
+ }
+ return context ? {value: value} : value;
+ };
+ case AST.ThisExpression:
+ return function(scope) {
+ return context ? {value: scope} : scope;
+ };
+ case AST.LocalsExpression:
+ return function(scope, locals) {
+ return context ? {value: locals} : locals;
+ };
+ case AST.NGValueParameter:
+ return function(scope, locals, assign, inputs) {
+ return context ? {value: assign} : assign;
+ };
+ }
+ },
+
+ 'unary+': function(argument, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = argument(scope, locals, assign, inputs);
+ if (isDefined(arg)) {
+ arg = +arg;
+ } else {
+ arg = 0;
+ }
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'unary-': function(argument, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = argument(scope, locals, assign, inputs);
+ if (isDefined(arg)) {
+ arg = -arg;
+ } else {
+ arg = 0;
+ }
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'unary!': function(argument, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = !argument(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary+': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ var rhs = right(scope, locals, assign, inputs);
+ var arg = plusFn(lhs, rhs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary-': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ var rhs = right(scope, locals, assign, inputs);
+ var arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary*': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) * right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary/': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) / right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary%': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) % right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary===': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) === right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary!==': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) !== right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary==': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary!=': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary<': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) < right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary>': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) > right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary<=': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) <= right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary>=': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) >= right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary&&': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) && right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary||': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) || right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'ternary?:': function(test, alternate, consequent, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = test(scope, locals, assign, inputs) ? alternate(scope, locals, assign, inputs) : consequent(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ value: function(value, context) {
+ return function() { return context ? {context: undefined, name: undefined, value: value} : value; };
+ },
+ identifier: function(name, expensiveChecks, context, create, expression) {
+ return function(scope, locals, assign, inputs) {
+ var base = locals && (name in locals) ? locals : scope;
+ if (create && create !== 1 && base && !(base[name])) {
+ base[name] = {};
+ }
+ var value = base ? base[name] : undefined;
+ if (expensiveChecks) {
+ ensureSafeObject(value, expression);
+ }
+ if (context) {
+ return {context: base, name: name, value: value};
+ } else {
+ return value;
+ }
+ };
+ },
+ computedMember: function(left, right, context, create, expression) {
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ var rhs;
+ var value;
+ if (lhs != null) {
+ rhs = right(scope, locals, assign, inputs);
+ rhs = getStringValue(rhs);
+ ensureSafeMemberName(rhs, expression);
+ if (create && create !== 1) {
+ ensureSafeAssignContext(lhs);
+ if (lhs && !(lhs[rhs])) {
+ lhs[rhs] = {};
+ }
+ }
+ value = lhs[rhs];
+ ensureSafeObject(value, expression);
+ }
+ if (context) {
+ return {context: lhs, name: rhs, value: value};
+ } else {
+ return value;
+ }
+ };
+ },
+ nonComputedMember: function(left, right, expensiveChecks, context, create, expression) {
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ if (create && create !== 1) {
+ ensureSafeAssignContext(lhs);
+ if (lhs && !(lhs[right])) {
+ lhs[right] = {};
+ }
+ }
+ var value = lhs != null ? lhs[right] : undefined;
+ if (expensiveChecks || isPossiblyDangerousMemberName(right)) {
+ ensureSafeObject(value, expression);
+ }
+ if (context) {
+ return {context: lhs, name: right, value: value};
+ } else {
+ return value;
+ }
+ };
+ },
+ inputs: function(input, watchId) {
+ return function(scope, value, locals, inputs) {
+ if (inputs) return inputs[watchId];
+ return input(scope, value, locals);
+ };
+ }
+};
+
+/**
+ * @constructor
+ */
+var Parser = function(lexer, $filter, options) {
+ this.lexer = lexer;
+ this.$filter = $filter;
+ this.options = options;
+ this.ast = new AST(this.lexer);
+ this.astCompiler = options.csp ? new ASTInterpreter(this.ast, $filter) :
+ new ASTCompiler(this.ast, $filter);
+};
+
+Parser.prototype = {
+ constructor: Parser,
+
+ parse: function(text) {
+ return this.astCompiler.compile(text, this.options.expensiveChecks);
+ }
+};
+
+function isPossiblyDangerousMemberName(name) {
+ return name == 'constructor';
+}
+
+var objectValueOf = Object.prototype.valueOf;
+
+function getValueOf(value) {
+ return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value);
+}
+
+///////////////////////////////////
+
+/**
+ * @ngdoc service
+ * @name $parse
+ * @kind function
+ *
+ * @description
+ *
+ * Converts Angular {@link guide/expression expression} into a function.
+ *
+ * ```js
+ * var getter = $parse('user.name');
+ * var setter = getter.assign;
+ * var context = {user:{name:'angular'}};
+ * var locals = {user:{name:'local'}};
+ *
+ * expect(getter(context)).toEqual('angular');
+ * setter(context, 'newValue');
+ * expect(context.user.name).toEqual('newValue');
+ * expect(getter(context, locals)).toEqual('local');
+ * ```
+ *
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ *
+ * The returned function also has the following properties:
+ * * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript
+ * literal.
+ * * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript
+ * constant literals.
+ * * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be
+ * set to a function to change its value on the given context.
+ *
+ */
+
+
+/**
+ * @ngdoc provider
+ * @name $parseProvider
+ *
+ * @description
+ * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}
+ * service.
+ */
+function $ParseProvider() {
+ var cacheDefault = createMap();
+ var cacheExpensive = createMap();
+
+ this.$get = ['$filter', function($filter) {
+ var noUnsafeEval = csp().noUnsafeEval;
+ var $parseOptions = {
+ csp: noUnsafeEval,
+ expensiveChecks: false
+ },
+ $parseOptionsExpensive = {
+ csp: noUnsafeEval,
+ expensiveChecks: true
+ };
+ var runningChecksEnabled = false;
+
+ $parse.$$runningExpensiveChecks = function() {
+ return runningChecksEnabled;
+ };
+
+ return $parse;
+
+ function $parse(exp, interceptorFn, expensiveChecks) {
+ var parsedExpression, oneTime, cacheKey;
+
+ expensiveChecks = expensiveChecks || runningChecksEnabled;
+
+ switch (typeof exp) {
+ case 'string':
+ exp = exp.trim();
+ cacheKey = exp;
+
+ var cache = (expensiveChecks ? cacheExpensive : cacheDefault);
+ parsedExpression = cache[cacheKey];
+
+ if (!parsedExpression) {
+ if (exp.charAt(0) === ':' && exp.charAt(1) === ':') {
+ oneTime = true;
+ exp = exp.substring(2);
+ }
+ var parseOptions = expensiveChecks ? $parseOptionsExpensive : $parseOptions;
+ var lexer = new Lexer(parseOptions);
+ var parser = new Parser(lexer, $filter, parseOptions);
+ parsedExpression = parser.parse(exp);
+ if (parsedExpression.constant) {
+ parsedExpression.$$watchDelegate = constantWatchDelegate;
+ } else if (oneTime) {
+ parsedExpression.$$watchDelegate = parsedExpression.literal ?
+ oneTimeLiteralWatchDelegate : oneTimeWatchDelegate;
+ } else if (parsedExpression.inputs) {
+ parsedExpression.$$watchDelegate = inputsWatchDelegate;
+ }
+ if (expensiveChecks) {
+ parsedExpression = expensiveChecksInterceptor(parsedExpression);
+ }
+ cache[cacheKey] = parsedExpression;
+ }
+ return addInterceptor(parsedExpression, interceptorFn);
+
+ case 'function':
+ return addInterceptor(exp, interceptorFn);
+
+ default:
+ return addInterceptor(noop, interceptorFn);
+ }
+ }
+
+ function expensiveChecksInterceptor(fn) {
+ if (!fn) return fn;
+ expensiveCheckFn.$$watchDelegate = fn.$$watchDelegate;
+ expensiveCheckFn.assign = expensiveChecksInterceptor(fn.assign);
+ expensiveCheckFn.constant = fn.constant;
+ expensiveCheckFn.literal = fn.literal;
+ for (var i = 0; fn.inputs && i < fn.inputs.length; ++i) {
+ fn.inputs[i] = expensiveChecksInterceptor(fn.inputs[i]);
+ }
+ expensiveCheckFn.inputs = fn.inputs;
+
+ return expensiveCheckFn;
+
+ function expensiveCheckFn(scope, locals, assign, inputs) {
+ var expensiveCheckOldValue = runningChecksEnabled;
+ runningChecksEnabled = true;
+ try {
+ return fn(scope, locals, assign, inputs);
+ } finally {
+ runningChecksEnabled = expensiveCheckOldValue;
+ }
+ }
+ }
+
+ function expressionInputDirtyCheck(newValue, oldValueOfValue) {
+
+ if (newValue == null || oldValueOfValue == null) { // null/undefined
+ return newValue === oldValueOfValue;
+ }
+
+ if (typeof newValue === 'object') {
+
+ // attempt to convert the value to a primitive type
+ // TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can
+ // be cheaply dirty-checked
+ newValue = getValueOf(newValue);
+
+ if (typeof newValue === 'object') {
+ // objects/arrays are not supported - deep-watching them would be too expensive
+ return false;
+ }
+
+ // fall-through to the primitive equality check
+ }
+
+ //Primitive or NaN
+ return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue);
+ }
+
+ function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) {
+ var inputExpressions = parsedExpression.inputs;
+ var lastResult;
+
+ if (inputExpressions.length === 1) {
+ var oldInputValueOf = expressionInputDirtyCheck; // init to something unique so that equals check fails
+ inputExpressions = inputExpressions[0];
+ return scope.$watch(function expressionInputWatch(scope) {
+ var newInputValue = inputExpressions(scope);
+ if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf)) {
+ lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]);
+ oldInputValueOf = newInputValue && getValueOf(newInputValue);
+ }
+ return lastResult;
+ }, listener, objectEquality, prettyPrintExpression);
+ }
+
+ var oldInputValueOfValues = [];
+ var oldInputValues = [];
+ for (var i = 0, ii = inputExpressions.length; i < ii; i++) {
+ oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails
+ oldInputValues[i] = null;
+ }
+
+ return scope.$watch(function expressionInputsWatch(scope) {
+ var changed = false;
+
+ for (var i = 0, ii = inputExpressions.length; i < ii; i++) {
+ var newInputValue = inputExpressions[i](scope);
+ if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) {
+ oldInputValues[i] = newInputValue;
+ oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue);
+ }
+ }
+
+ if (changed) {
+ lastResult = parsedExpression(scope, undefined, undefined, oldInputValues);
+ }
+
+ return lastResult;
+ }, listener, objectEquality, prettyPrintExpression);
+ }
+
+ function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression) {
+ var unwatch, lastValue;
+ return unwatch = scope.$watch(function oneTimeWatch(scope) {
+ return parsedExpression(scope);
+ }, function oneTimeListener(value, old, scope) {
+ lastValue = value;
+ if (isFunction(listener)) {
+ listener.apply(this, arguments);
+ }
+ if (isDefined(value)) {
+ scope.$$postDigest(function() {
+ if (isDefined(lastValue)) {
+ unwatch();
+ }
+ });
+ }
+ }, objectEquality);
+ }
+
+ function oneTimeLiteralWatchDelegate(scope, listener, objectEquality, parsedExpression) {
+ var unwatch, lastValue;
+ return unwatch = scope.$watch(function oneTimeWatch(scope) {
+ return parsedExpression(scope);
+ }, function oneTimeListener(value, old, scope) {
+ lastValue = value;
+ if (isFunction(listener)) {
+ listener.call(this, value, old, scope);
+ }
+ if (isAllDefined(value)) {
+ scope.$$postDigest(function() {
+ if (isAllDefined(lastValue)) unwatch();
+ });
+ }
+ }, objectEquality);
+
+ function isAllDefined(value) {
+ var allDefined = true;
+ forEach(value, function(val) {
+ if (!isDefined(val)) allDefined = false;
+ });
+ return allDefined;
+ }
+ }
+
+ function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) {
+ var unwatch;
+ return unwatch = scope.$watch(function constantWatch(scope) {
+ unwatch();
+ return parsedExpression(scope);
+ }, listener, objectEquality);
+ }
+
+ function addInterceptor(parsedExpression, interceptorFn) {
+ if (!interceptorFn) return parsedExpression;
+ var watchDelegate = parsedExpression.$$watchDelegate;
+ var useInputs = false;
+
+ var regularWatch =
+ watchDelegate !== oneTimeLiteralWatchDelegate &&
+ watchDelegate !== oneTimeWatchDelegate;
+
+ var fn = regularWatch ? function regularInterceptedExpression(scope, locals, assign, inputs) {
+ var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs);
+ return interceptorFn(value, scope, locals);
+ } : function oneTimeInterceptedExpression(scope, locals, assign, inputs) {
+ var value = parsedExpression(scope, locals, assign, inputs);
+ var result = interceptorFn(value, scope, locals);
+ // we only return the interceptor's result if the
+ // initial value is defined (for bind-once)
+ return isDefined(value) ? result : value;
+ };
+
+ // Propagate $$watchDelegates other then inputsWatchDelegate
+ if (parsedExpression.$$watchDelegate &&
+ parsedExpression.$$watchDelegate !== inputsWatchDelegate) {
+ fn.$$watchDelegate = parsedExpression.$$watchDelegate;
+ } else if (!interceptorFn.$stateful) {
+ // If there is an interceptor, but no watchDelegate then treat the interceptor like
+ // we treat filters - it is assumed to be a pure function unless flagged with $stateful
+ fn.$$watchDelegate = inputsWatchDelegate;
+ useInputs = !parsedExpression.inputs;
+ fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression];
+ }
+
+ return fn;
+ }
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $q
+ * @requires $rootScope
+ *
+ * @description
+ * A service that helps you run functions asynchronously, and use their return values (or exceptions)
+ * when they are done processing.
+ *
+ * This is an implementation of promises/deferred objects inspired by
+ * [Kris Kowal's Q](https://github.com/kriskowal/q).
+ *
+ * $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred
+ * implementations, and the other which resembles ES6 promises to some degree.
+ *
+ * # $q constructor
+ *
+ * The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver`
+ * function as the first argument. This is similar to the native Promise implementation from ES6 Harmony,
+ * see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
+ *
+ * While the constructor-style use is supported, not all of the supporting methods from ES6 Harmony promises are
+ * available yet.
+ *
+ * It can be used like so:
+ *
+ * ```js
+ * // for the purpose of this example let's assume that variables `$q` and `okToGreet`
+ * // are available in the current lexical scope (they could have been injected or passed in).
+ *
+ * function asyncGreet(name) {
+ * // perform some asynchronous operation, resolve or reject the promise when appropriate.
+ * return $q(function(resolve, reject) {
+ * setTimeout(function() {
+ * if (okToGreet(name)) {
+ * resolve('Hello, ' + name + '!');
+ * } else {
+ * reject('Greeting ' + name + ' is not allowed.');
+ * }
+ * }, 1000);
+ * });
+ * }
+ *
+ * var promise = asyncGreet('Robin Hood');
+ * promise.then(function(greeting) {
+ * alert('Success: ' + greeting);
+ * }, function(reason) {
+ * alert('Failed: ' + reason);
+ * });
+ * ```
+ *
+ * Note: progress/notify callbacks are not currently supported via the ES6-style interface.
+ *
+ * Note: unlike ES6 behavior, an exception thrown in the constructor function will NOT implicitly reject the promise.
+ *
+ * However, the more traditional CommonJS-style usage is still available, and documented below.
+ *
+ * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an
+ * interface for interacting with an object that represents the result of an action that is
+ * performed asynchronously, and may or may not be finished at any given point in time.
+ *
+ * From the perspective of dealing with error handling, deferred and promise APIs are to
+ * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.
+ *
+ * ```js
+ * // for the purpose of this example let's assume that variables `$q` and `okToGreet`
+ * // are available in the current lexical scope (they could have been injected or passed in).
+ *
+ * function asyncGreet(name) {
+ * var deferred = $q.defer();
+ *
+ * setTimeout(function() {
+ * deferred.notify('About to greet ' + name + '.');
+ *
+ * if (okToGreet(name)) {
+ * deferred.resolve('Hello, ' + name + '!');
+ * } else {
+ * deferred.reject('Greeting ' + name + ' is not allowed.');
+ * }
+ * }, 1000);
+ *
+ * return deferred.promise;
+ * }
+ *
+ * var promise = asyncGreet('Robin Hood');
+ * promise.then(function(greeting) {
+ * alert('Success: ' + greeting);
+ * }, function(reason) {
+ * alert('Failed: ' + reason);
+ * }, function(update) {
+ * alert('Got notification: ' + update);
+ * });
+ * ```
+ *
+ * At first it might not be obvious why this extra complexity is worth the trouble. The payoff
+ * comes in the way of guarantees that promise and deferred APIs make, see
+ * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md.
+ *
+ * Additionally the promise api allows for composition that is very hard to do with the
+ * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.
+ * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the
+ * section on serial or parallel joining of promises.
+ *
+ * # The Deferred API
+ *
+ * A new instance of deferred is constructed by calling `$q.defer()`.
+ *
+ * The purpose of the deferred object is to expose the associated Promise instance as well as APIs
+ * that can be used for signaling the successful or unsuccessful completion, as well as the status
+ * of the task.
+ *
+ * **Methods**
+ *
+ * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection
+ * constructed via `$q.reject`, the promise will be rejected instead.
+ * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to
+ * resolving it with a rejection constructed via `$q.reject`.
+ * - `notify(value)` - provides updates on the status of the promise's execution. This may be called
+ * multiple times before the promise is either resolved or rejected.
+ *
+ * **Properties**
+ *
+ * - promise – `{Promise}` – promise object associated with this deferred.
+ *
+ *
+ * # The Promise API
+ *
+ * A new promise instance is created when a deferred instance is created and can be retrieved by
+ * calling `deferred.promise`.
+ *
+ * The purpose of the promise object is to allow for interested parties to get access to the result
+ * of the deferred task when it completes.
+ *
+ * **Methods**
+ *
+ * - `then(successCallback, errorCallback, notifyCallback)` – regardless of when the promise was or
+ * will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously
+ * as soon as the result is available. The callbacks are called with a single argument: the result
+ * or rejection reason. Additionally, the notify callback may be called zero or more times to
+ * provide a progress indication, before the promise is resolved or rejected.
+ *
+ * This method *returns a new promise* which is resolved or rejected via the return value of the
+ * `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved
+ * with the value which is resolved in that promise using
+ * [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)).
+ * It also notifies via the return value of the `notifyCallback` method. The promise cannot be
+ * resolved or rejected from the notifyCallback method.
+ *
+ * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`
+ *
+ * - `finally(callback, notifyCallback)` – allows you to observe either the fulfillment or rejection of a promise,
+ * but to do so without modifying the final value. This is useful to release resources or do some
+ * clean-up that needs to be done whether the promise was rejected or resolved. See the [full
+ * specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for
+ * more information.
+ *
+ * # Chaining promises
+ *
+ * Because calling the `then` method of a promise returns a new derived promise, it is easily
+ * possible to create a chain of promises:
+ *
+ * ```js
+ * promiseB = promiseA.then(function(result) {
+ * return result + 1;
+ * });
+ *
+ * // promiseB will be resolved immediately after promiseA is resolved and its value
+ * // will be the result of promiseA incremented by 1
+ * ```
+ *
+ * It is possible to create chains of any length and since a promise can be resolved with another
+ * promise (which will defer its resolution further), it is possible to pause/defer resolution of
+ * the promises at any point in the chain. This makes it possible to implement powerful APIs like
+ * $http's response interceptors.
+ *
+ *
+ * # Differences between Kris Kowal's Q and $q
+ *
+ * There are two main differences:
+ *
+ * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation
+ * mechanism in angular, which means faster propagation of resolution or rejection into your
+ * models and avoiding unnecessary browser repaints, which would result in flickering UI.
+ * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains
+ * all the important functionality needed for common async tasks.
+ *
+ * # Testing
+ *
+ * ```js
+ * it('should simulate promise', inject(function($q, $rootScope) {
+ * var deferred = $q.defer();
+ * var promise = deferred.promise;
+ * var resolvedValue;
+ *
+ * promise.then(function(value) { resolvedValue = value; });
+ * expect(resolvedValue).toBeUndefined();
+ *
+ * // Simulate resolving of promise
+ * deferred.resolve(123);
+ * // Note that the 'then' function does not get called synchronously.
+ * // This is because we want the promise API to always be async, whether or not
+ * // it got called synchronously or asynchronously.
+ * expect(resolvedValue).toBeUndefined();
+ *
+ * // Propagate promise resolution to 'then' functions using $apply().
+ * $rootScope.$apply();
+ * expect(resolvedValue).toEqual(123);
+ * }));
+ * ```
+ *
+ * @param {function(function, function)} resolver Function which is responsible for resolving or
+ * rejecting the newly created promise. The first parameter is a function which resolves the
+ * promise, the second parameter is a function which rejects the promise.
+ *
+ * @returns {Promise} The newly created promise.
+ */
+function $QProvider() {
+
+ this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {
+ return qFactory(function(callback) {
+ $rootScope.$evalAsync(callback);
+ }, $exceptionHandler);
+ }];
+}
+
+function $$QProvider() {
+ this.$get = ['$browser', '$exceptionHandler', function($browser, $exceptionHandler) {
+ return qFactory(function(callback) {
+ $browser.defer(callback);
+ }, $exceptionHandler);
+ }];
+}
+
+/**
+ * Constructs a promise manager.
+ *
+ * @param {function(function)} nextTick Function for executing functions in the next turn.
+ * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for
+ * debugging purposes.
+ * @returns {object} Promise manager.
+ */
+function qFactory(nextTick, exceptionHandler) {
+ var $qMinErr = minErr('$q', TypeError);
+
+ /**
+ * @ngdoc method
+ * @name ng.$q#defer
+ * @kind function
+ *
+ * @description
+ * Creates a `Deferred` object which represents a task which will finish in the future.
+ *
+ * @returns {Deferred} Returns a new instance of deferred.
+ */
+ var defer = function() {
+ var d = new Deferred();
+ //Necessary to support unbound execution :/
+ d.resolve = simpleBind(d, d.resolve);
+ d.reject = simpleBind(d, d.reject);
+ d.notify = simpleBind(d, d.notify);
+ return d;
+ };
+
+ function Promise() {
+ this.$$state = { status: 0 };
+ }
+
+ extend(Promise.prototype, {
+ then: function(onFulfilled, onRejected, progressBack) {
+ if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) {
+ return this;
+ }
+ var result = new Deferred();
+
+ this.$$state.pending = this.$$state.pending || [];
+ this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);
+ if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);
+
+ return result.promise;
+ },
+
+ "catch": function(callback) {
+ return this.then(null, callback);
+ },
+
+ "finally": function(callback, progressBack) {
+ return this.then(function(value) {
+ return handleCallback(value, true, callback);
+ }, function(error) {
+ return handleCallback(error, false, callback);
+ }, progressBack);
+ }
+ });
+
+ //Faster, more basic than angular.bind http://jsperf.com/angular-bind-vs-custom-vs-native
+ function simpleBind(context, fn) {
+ return function(value) {
+ fn.call(context, value);
+ };
+ }
+
+ function processQueue(state) {
+ var fn, deferred, pending;
+
+ pending = state.pending;
+ state.processScheduled = false;
+ state.pending = undefined;
+ for (var i = 0, ii = pending.length; i < ii; ++i) {
+ deferred = pending[i][0];
+ fn = pending[i][state.status];
+ try {
+ if (isFunction(fn)) {
+ deferred.resolve(fn(state.value));
+ } else if (state.status === 1) {
+ deferred.resolve(state.value);
+ } else {
+ deferred.reject(state.value);
+ }
+ } catch (e) {
+ deferred.reject(e);
+ exceptionHandler(e);
+ }
+ }
+ }
+
+ function scheduleProcessQueue(state) {
+ if (state.processScheduled || !state.pending) return;
+ state.processScheduled = true;
+ nextTick(function() { processQueue(state); });
+ }
+
+ function Deferred() {
+ this.promise = new Promise();
+ }
+
+ extend(Deferred.prototype, {
+ resolve: function(val) {
+ if (this.promise.$$state.status) return;
+ if (val === this.promise) {
+ this.$$reject($qMinErr(
+ 'qcycle',
+ "Expected promise to be resolved with value other than itself '{0}'",
+ val));
+ } else {
+ this.$$resolve(val);
+ }
+
+ },
+
+ $$resolve: function(val) {
+ var then;
+ var that = this;
+ var done = false;
+ try {
+ if ((isObject(val) || isFunction(val))) then = val && val.then;
+ if (isFunction(then)) {
+ this.promise.$$state.status = -1;
+ then.call(val, resolvePromise, rejectPromise, simpleBind(this, this.notify));
+ } else {
+ this.promise.$$state.value = val;
+ this.promise.$$state.status = 1;
+ scheduleProcessQueue(this.promise.$$state);
+ }
+ } catch (e) {
+ rejectPromise(e);
+ exceptionHandler(e);
+ }
+
+ function resolvePromise(val) {
+ if (done) return;
+ done = true;
+ that.$$resolve(val);
+ }
+ function rejectPromise(val) {
+ if (done) return;
+ done = true;
+ that.$$reject(val);
+ }
+ },
+
+ reject: function(reason) {
+ if (this.promise.$$state.status) return;
+ this.$$reject(reason);
+ },
+
+ $$reject: function(reason) {
+ this.promise.$$state.value = reason;
+ this.promise.$$state.status = 2;
+ scheduleProcessQueue(this.promise.$$state);
+ },
+
+ notify: function(progress) {
+ var callbacks = this.promise.$$state.pending;
+
+ if ((this.promise.$$state.status <= 0) && callbacks && callbacks.length) {
+ nextTick(function() {
+ var callback, result;
+ for (var i = 0, ii = callbacks.length; i < ii; i++) {
+ result = callbacks[i][0];
+ callback = callbacks[i][3];
+ try {
+ result.notify(isFunction(callback) ? callback(progress) : progress);
+ } catch (e) {
+ exceptionHandler(e);
+ }
+ }
+ });
+ }
+ }
+ });
+
+ /**
+ * @ngdoc method
+ * @name $q#reject
+ * @kind function
+ *
+ * @description
+ * Creates a promise that is resolved as rejected with the specified `reason`. This api should be
+ * used to forward rejection in a chain of promises. If you are dealing with the last promise in
+ * a promise chain, you don't need to worry about it.
+ *
+ * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of
+ * `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via
+ * a promise error callback and you want to forward the error to the promise derived from the
+ * current promise, you have to "rethrow" the error by returning a rejection constructed via
+ * `reject`.
+ *
+ * ```js
+ * promiseB = promiseA.then(function(result) {
+ * // success: do something and resolve promiseB
+ * // with the old or a new result
+ * return result;
+ * }, function(reason) {
+ * // error: handle the error if possible and
+ * // resolve promiseB with newPromiseOrValue,
+ * // otherwise forward the rejection to promiseB
+ * if (canHandle(reason)) {
+ * // handle the error and recover
+ * return newPromiseOrValue;
+ * }
+ * return $q.reject(reason);
+ * });
+ * ```
+ *
+ * @param {*} reason Constant, message, exception or an object representing the rejection reason.
+ * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.
+ */
+ var reject = function(reason) {
+ var result = new Deferred();
+ result.reject(reason);
+ return result.promise;
+ };
+
+ var makePromise = function makePromise(value, resolved) {
+ var result = new Deferred();
+ if (resolved) {
+ result.resolve(value);
+ } else {
+ result.reject(value);
+ }
+ return result.promise;
+ };
+
+ var handleCallback = function handleCallback(value, isResolved, callback) {
+ var callbackOutput = null;
+ try {
+ if (isFunction(callback)) callbackOutput = callback();
+ } catch (e) {
+ return makePromise(e, false);
+ }
+ if (isPromiseLike(callbackOutput)) {
+ return callbackOutput.then(function() {
+ return makePromise(value, isResolved);
+ }, function(error) {
+ return makePromise(error, false);
+ });
+ } else {
+ return makePromise(value, isResolved);
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $q#when
+ * @kind function
+ *
+ * @description
+ * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.
+ * This is useful when you are dealing with an object that might or might not be a promise, or if
+ * the promise comes from a source that can't be trusted.
+ *
+ * @param {*} value Value or a promise
+ * @param {Function=} successCallback
+ * @param {Function=} errorCallback
+ * @param {Function=} progressCallback
+ * @returns {Promise} Returns a promise of the passed value or promise
+ */
+
+
+ var when = function(value, callback, errback, progressBack) {
+ var result = new Deferred();
+ result.resolve(value);
+ return result.promise.then(callback, errback, progressBack);
+ };
+
+ /**
+ * @ngdoc method
+ * @name $q#resolve
+ * @kind function
+ *
+ * @description
+ * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6.
+ *
+ * @param {*} value Value or a promise
+ * @param {Function=} successCallback
+ * @param {Function=} errorCallback
+ * @param {Function=} progressCallback
+ * @returns {Promise} Returns a promise of the passed value or promise
+ */
+ var resolve = when;
+
+ /**
+ * @ngdoc method
+ * @name $q#all
+ * @kind function
+ *
+ * @description
+ * Combines multiple promises into a single promise that is resolved when all of the input
+ * promises are resolved.
+ *
+ * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.
+ * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values,
+ * each value corresponding to the promise at the same index/key in the `promises` array/hash.
+ * If any of the promises is resolved with a rejection, this resulting promise will be rejected
+ * with the same rejection value.
+ */
+
+ function all(promises) {
+ var deferred = new Deferred(),
+ counter = 0,
+ results = isArray(promises) ? [] : {};
+
+ forEach(promises, function(promise, key) {
+ counter++;
+ when(promise).then(function(value) {
+ if (results.hasOwnProperty(key)) return;
+ results[key] = value;
+ if (!(--counter)) deferred.resolve(results);
+ }, function(reason) {
+ if (results.hasOwnProperty(key)) return;
+ deferred.reject(reason);
+ });
+ });
+
+ if (counter === 0) {
+ deferred.resolve(results);
+ }
+
+ return deferred.promise;
+ }
+
+ var $Q = function Q(resolver) {
+ if (!isFunction(resolver)) {
+ throw $qMinErr('norslvr', "Expected resolverFn, got '{0}'", resolver);
+ }
+
+ var deferred = new Deferred();
+
+ function resolveFn(value) {
+ deferred.resolve(value);
+ }
+
+ function rejectFn(reason) {
+ deferred.reject(reason);
+ }
+
+ resolver(resolveFn, rejectFn);
+
+ return deferred.promise;
+ };
+
+ // Let's make the instanceof operator work for promises, so that
+ // `new $q(fn) instanceof $q` would evaluate to true.
+ $Q.prototype = Promise.prototype;
+
+ $Q.defer = defer;
+ $Q.reject = reject;
+ $Q.when = when;
+ $Q.resolve = resolve;
+ $Q.all = all;
+
+ return $Q;
+}
+
+function $$RAFProvider() { //rAF
+ this.$get = ['$window', '$timeout', function($window, $timeout) {
+ var requestAnimationFrame = $window.requestAnimationFrame ||
+ $window.webkitRequestAnimationFrame;
+
+ var cancelAnimationFrame = $window.cancelAnimationFrame ||
+ $window.webkitCancelAnimationFrame ||
+ $window.webkitCancelRequestAnimationFrame;
+
+ var rafSupported = !!requestAnimationFrame;
+ var raf = rafSupported
+ ? function(fn) {
+ var id = requestAnimationFrame(fn);
+ return function() {
+ cancelAnimationFrame(id);
+ };
+ }
+ : function(fn) {
+ var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666
+ return function() {
+ $timeout.cancel(timer);
+ };
+ };
+
+ raf.supported = rafSupported;
+
+ return raf;
+ }];
+}
+
+/**
+ * DESIGN NOTES
+ *
+ * The design decisions behind the scope are heavily favored for speed and memory consumption.
+ *
+ * The typical use of scope is to watch the expressions, which most of the time return the same
+ * value as last time so we optimize the operation.
+ *
+ * Closures construction is expensive in terms of speed as well as memory:
+ * - No closures, instead use prototypical inheritance for API
+ * - Internal state needs to be stored on scope directly, which means that private state is
+ * exposed as $$____ properties
+ *
+ * Loop operations are optimized by using while(count--) { ... }
+ * - This means that in order to keep the same order of execution as addition we have to add
+ * items to the array at the beginning (unshift) instead of at the end (push)
+ *
+ * Child scopes are created and removed often
+ * - Using an array would be slow since inserts in the middle are expensive; so we use linked lists
+ *
+ * There are fewer watches than observers. This is why you don't want the observer to be implemented
+ * in the same way as watch. Watch requires return of the initialization function which is expensive
+ * to construct.
+ */
+
+
+/**
+ * @ngdoc provider
+ * @name $rootScopeProvider
+ * @description
+ *
+ * Provider for the $rootScope service.
+ */
+
+/**
+ * @ngdoc method
+ * @name $rootScopeProvider#digestTtl
+ * @description
+ *
+ * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and
+ * assuming that the model is unstable.
+ *
+ * The current default is 10 iterations.
+ *
+ * In complex applications it's possible that the dependencies between `$watch`s will result in
+ * several digest iterations. However if an application needs more than the default 10 digest
+ * iterations for its model to stabilize then you should investigate what is causing the model to
+ * continuously change during the digest.
+ *
+ * Increasing the TTL could have performance implications, so you should not change it without
+ * proper justification.
+ *
+ * @param {number} limit The number of digest iterations.
+ */
+
+
+/**
+ * @ngdoc service
+ * @name $rootScope
+ * @description
+ *
+ * Every application has a single root {@link ng.$rootScope.Scope scope}.
+ * All other scopes are descendant scopes of the root scope. Scopes provide separation
+ * between the model and the view, via a mechanism for watching the model for changes.
+ * They also provide event emission/broadcast and subscription facility. See the
+ * {@link guide/scope developer guide on scopes}.
+ */
+function $RootScopeProvider() {
+ var TTL = 10;
+ var $rootScopeMinErr = minErr('$rootScope');
+ var lastDirtyWatch = null;
+ var applyAsyncId = null;
+
+ this.digestTtl = function(value) {
+ if (arguments.length) {
+ TTL = value;
+ }
+ return TTL;
+ };
+
+ function createChildScopeClass(parent) {
+ function ChildScope() {
+ this.$$watchers = this.$$nextSibling =
+ this.$$childHead = this.$$childTail = null;
+ this.$$listeners = {};
+ this.$$listenerCount = {};
+ this.$$watchersCount = 0;
+ this.$id = nextUid();
+ this.$$ChildScope = null;
+ }
+ ChildScope.prototype = parent;
+ return ChildScope;
+ }
+
+ this.$get = ['$exceptionHandler', '$parse', '$browser',
+ function($exceptionHandler, $parse, $browser) {
+
+ function destroyChildScope($event) {
+ $event.currentScope.$$destroyed = true;
+ }
+
+ function cleanUpScope($scope) {
+
+ if (msie === 9) {
+ // There is a memory leak in IE9 if all child scopes are not disconnected
+ // completely when a scope is destroyed. So this code will recurse up through
+ // all this scopes children
+ //
+ // See issue https://github.com/angular/angular.js/issues/10706
+ $scope.$$childHead && cleanUpScope($scope.$$childHead);
+ $scope.$$nextSibling && cleanUpScope($scope.$$nextSibling);
+ }
+
+ // The code below works around IE9 and V8's memory leaks
+ //
+ // See:
+ // - https://code.google.com/p/v8/issues/detail?id=2073#c26
+ // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
+ // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
+
+ $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead =
+ $scope.$$childTail = $scope.$root = $scope.$$watchers = null;
+ }
+
+ /**
+ * @ngdoc type
+ * @name $rootScope.Scope
+ *
+ * @description
+ * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the
+ * {@link auto.$injector $injector}. Child scopes are created using the
+ * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
+ * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for
+ * an in-depth introduction and usage examples.
+ *
+ *
+ * # Inheritance
+ * A scope can inherit from a parent scope, as in this example:
+ * ```js
+ var parent = $rootScope;
+ var child = parent.$new();
+
+ parent.salutation = "Hello";
+ expect(child.salutation).toEqual('Hello');
+
+ child.salutation = "Welcome";
+ expect(child.salutation).toEqual('Welcome');
+ expect(parent.salutation).toEqual('Hello');
+ * ```
+ *
+ * When interacting with `Scope` in tests, additional helper methods are available on the
+ * instances of `Scope` type. See {@link ngMock.$rootScope.Scope ngMock Scope} for additional
+ * details.
+ *
+ *
+ * @param {Object.<string, function()>=} providers Map of service factory which need to be
+ * provided for the current scope. Defaults to {@link ng}.
+ * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should
+ * append/override services provided by `providers`. This is handy
+ * when unit-testing and having the need to override a default
+ * service.
+ * @returns {Object} Newly created scope.
+ *
+ */
+ function Scope() {
+ this.$id = nextUid();
+ this.$$phase = this.$parent = this.$$watchers =
+ this.$$nextSibling = this.$$prevSibling =
+ this.$$childHead = this.$$childTail = null;
+ this.$root = this;
+ this.$$destroyed = false;
+ this.$$listeners = {};
+ this.$$listenerCount = {};
+ this.$$watchersCount = 0;
+ this.$$isolateBindings = null;
+ }
+
+ /**
+ * @ngdoc property
+ * @name $rootScope.Scope#$id
+ *
+ * @description
+ * Unique scope ID (monotonically increasing) useful for debugging.
+ */
+
+ /**
+ * @ngdoc property
+ * @name $rootScope.Scope#$parent
+ *
+ * @description
+ * Reference to the parent scope.
+ */
+
+ /**
+ * @ngdoc property
+ * @name $rootScope.Scope#$root
+ *
+ * @description
+ * Reference to the root scope.
+ */
+
+ Scope.prototype = {
+ constructor: Scope,
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$new
+ * @kind function
+ *
+ * @description
+ * Creates a new child {@link ng.$rootScope.Scope scope}.
+ *
+ * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event.
+ * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.
+ *
+ * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is
+ * desired for the scope and its child scopes to be permanently detached from the parent and
+ * thus stop participating in model change detection and listener notification by invoking.
+ *
+ * @param {boolean} isolate If true, then the scope does not prototypically inherit from the
+ * parent scope. The scope is isolated, as it can not see parent scope properties.
+ * When creating widgets, it is useful for the widget to not accidentally read parent
+ * state.
+ *
+ * @param {Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent`
+ * of the newly created scope. Defaults to `this` scope if not provided.
+ * This is used when creating a transclude scope to correctly place it
+ * in the scope hierarchy while maintaining the correct prototypical
+ * inheritance.
+ *
+ * @returns {Object} The newly created child scope.
+ *
+ */
+ $new: function(isolate, parent) {
+ var child;
+
+ parent = parent || this;
+
+ if (isolate) {
+ child = new Scope();
+ child.$root = this.$root;
+ } else {
+ // Only create a child scope class if somebody asks for one,
+ // but cache it to allow the VM to optimize lookups.
+ if (!this.$$ChildScope) {
+ this.$$ChildScope = createChildScopeClass(this);
+ }
+ child = new this.$$ChildScope();
+ }
+ child.$parent = parent;
+ child.$$prevSibling = parent.$$childTail;
+ if (parent.$$childHead) {
+ parent.$$childTail.$$nextSibling = child;
+ parent.$$childTail = child;
+ } else {
+ parent.$$childHead = parent.$$childTail = child;
+ }
+
+ // When the new scope is not isolated or we inherit from `this`, and
+ // the parent scope is destroyed, the property `$$destroyed` is inherited
+ // prototypically. In all other cases, this property needs to be set
+ // when the parent scope is destroyed.
+ // The listener needs to be added after the parent is set
+ if (isolate || parent != this) child.$on('$destroy', destroyChildScope);
+
+ return child;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$watch
+ * @kind function
+ *
+ * @description
+ * Registers a `listener` callback to be executed whenever the `watchExpression` changes.
+ *
+ * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest
+ * $digest()} and should return the value that will be watched. (`watchExpression` should not change
+ * its value when executed multiple times with the same input because it may be executed multiple
+ * times by {@link ng.$rootScope.Scope#$digest $digest()}. That is, `watchExpression` should be
+ * [idempotent](http://en.wikipedia.org/wiki/Idempotence).
+ * - The `listener` is called only when the value from the current `watchExpression` and the
+ * previous call to `watchExpression` are not equal (with the exception of the initial run,
+ * see below). Inequality is determined according to reference inequality,
+ * [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators)
+ * via the `!==` Javascript operator, unless `objectEquality == true`
+ * (see next point)
+ * - When `objectEquality == true`, inequality of the `watchExpression` is determined
+ * according to the {@link angular.equals} function. To save the value of the object for
+ * later comparison, the {@link angular.copy} function is used. This therefore means that
+ * watching complex objects will have adverse memory and performance implications.
+ * - The watch `listener` may change the model, which may trigger other `listener`s to fire.
+ * This is achieved by rerunning the watchers until no changes are detected. The rerun
+ * iteration limit is 10 to prevent an infinite loop deadlock.
+ *
+ *
+ * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,
+ * you can register a `watchExpression` function with no `listener`. (Be prepared for
+ * multiple calls to your `watchExpression` because it will execute multiple times in a
+ * single {@link ng.$rootScope.Scope#$digest $digest} cycle if a change is detected.)
+ *
+ * After a watcher is registered with the scope, the `listener` fn is called asynchronously
+ * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the
+ * watcher. In rare cases, this is undesirable because the listener is called when the result
+ * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you
+ * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the
+ * listener was called due to initialization.
+ *
+ *
+ *
+ * # Example
+ * ```js
+ // let's assume that scope was dependency injected as the $rootScope
+ var scope = $rootScope;
+ scope.name = 'misko';
+ scope.counter = 0;
+
+ expect(scope.counter).toEqual(0);
+ scope.$watch('name', function(newValue, oldValue) {
+ scope.counter = scope.counter + 1;
+ });
+ expect(scope.counter).toEqual(0);
+
+ scope.$digest();
+ // the listener is always called during the first $digest loop after it was registered
+ expect(scope.counter).toEqual(1);
+
+ scope.$digest();
+ // but now it will not be called unless the value changes
+ expect(scope.counter).toEqual(1);
+
+ scope.name = 'adam';
+ scope.$digest();
+ expect(scope.counter).toEqual(2);
+
+
+
+ // Using a function as a watchExpression
+ var food;
+ scope.foodCounter = 0;
+ expect(scope.foodCounter).toEqual(0);
+ scope.$watch(
+ // This function returns the value being watched. It is called for each turn of the $digest loop
+ function() { return food; },
+ // This is the change listener, called when the value returned from the above function changes
+ function(newValue, oldValue) {
+ if ( newValue !== oldValue ) {
+ // Only increment the counter if the value changed
+ scope.foodCounter = scope.foodCounter + 1;
+ }
+ }
+ );
+ // No digest has been run so the counter will be zero
+ expect(scope.foodCounter).toEqual(0);
+
+ // Run the digest but since food has not changed count will still be zero
+ scope.$digest();
+ expect(scope.foodCounter).toEqual(0);
+
+ // Update food and run digest. Now the counter will increment
+ food = 'cheeseburger';
+ scope.$digest();
+ expect(scope.foodCounter).toEqual(1);
+
+ * ```
+ *
+ *
+ *
+ * @param {(function()|string)} watchExpression Expression that is evaluated on each
+ * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers
+ * a call to the `listener`.
+ *
+ * - `string`: Evaluated as {@link guide/expression expression}
+ * - `function(scope)`: called with current `scope` as a parameter.
+ * @param {function(newVal, oldVal, scope)} listener Callback called whenever the value
+ * of `watchExpression` changes.
+ *
+ * - `newVal` contains the current value of the `watchExpression`
+ * - `oldVal` contains the previous value of the `watchExpression`
+ * - `scope` refers to the current scope
+ * @param {boolean=} [objectEquality=false] Compare for object equality using {@link angular.equals} instead of
+ * comparing for reference equality.
+ * @returns {function()} Returns a deregistration function for this listener.
+ */
+ $watch: function(watchExp, listener, objectEquality, prettyPrintExpression) {
+ var get = $parse(watchExp);
+
+ if (get.$$watchDelegate) {
+ return get.$$watchDelegate(this, listener, objectEquality, get, watchExp);
+ }
+ var scope = this,
+ array = scope.$$watchers,
+ watcher = {
+ fn: listener,
+ last: initWatchVal,
+ get: get,
+ exp: prettyPrintExpression || watchExp,
+ eq: !!objectEquality
+ };
+
+ lastDirtyWatch = null;
+
+ if (!isFunction(listener)) {
+ watcher.fn = noop;
+ }
+
+ if (!array) {
+ array = scope.$$watchers = [];
+ }
+ // we use unshift since we use a while loop in $digest for speed.
+ // the while loop reads in reverse order.
+ array.unshift(watcher);
+ incrementWatchersCount(this, 1);
+
+ return function deregisterWatch() {
+ if (arrayRemove(array, watcher) >= 0) {
+ incrementWatchersCount(scope, -1);
+ }
+ lastDirtyWatch = null;
+ };
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$watchGroup
+ * @kind function
+ *
+ * @description
+ * A variant of {@link ng.$rootScope.Scope#$watch $watch()} where it watches an array of `watchExpressions`.
+ * If any one expression in the collection changes the `listener` is executed.
+ *
+ * - The items in the `watchExpressions` array are observed via standard $watch operation and are examined on every
+ * call to $digest() to see if any items changes.
+ * - The `listener` is called whenever any expression in the `watchExpressions` array changes.
+ *
+ * @param {Array.<string|Function(scope)>} watchExpressions Array of expressions that will be individually
+ * watched using {@link ng.$rootScope.Scope#$watch $watch()}
+ *
+ * @param {function(newValues, oldValues, scope)} listener Callback called whenever the return value of any
+ * expression in `watchExpressions` changes
+ * The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching
+ * those of `watchExpression`
+ * and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching
+ * those of `watchExpression`
+ * The `scope` refers to the current scope.
+ * @returns {function()} Returns a de-registration function for all listeners.
+ */
+ $watchGroup: function(watchExpressions, listener) {
+ var oldValues = new Array(watchExpressions.length);
+ var newValues = new Array(watchExpressions.length);
+ var deregisterFns = [];
+ var self = this;
+ var changeReactionScheduled = false;
+ var firstRun = true;
+
+ if (!watchExpressions.length) {
+ // No expressions means we call the listener ASAP
+ var shouldCall = true;
+ self.$evalAsync(function() {
+ if (shouldCall) listener(newValues, newValues, self);
+ });
+ return function deregisterWatchGroup() {
+ shouldCall = false;
+ };
+ }
+
+ if (watchExpressions.length === 1) {
+ // Special case size of one
+ return this.$watch(watchExpressions[0], function watchGroupAction(value, oldValue, scope) {
+ newValues[0] = value;
+ oldValues[0] = oldValue;
+ listener(newValues, (value === oldValue) ? newValues : oldValues, scope);
+ });
+ }
+
+ forEach(watchExpressions, function(expr, i) {
+ var unwatchFn = self.$watch(expr, function watchGroupSubAction(value, oldValue) {
+ newValues[i] = value;
+ oldValues[i] = oldValue;
+ if (!changeReactionScheduled) {
+ changeReactionScheduled = true;
+ self.$evalAsync(watchGroupAction);
+ }
+ });
+ deregisterFns.push(unwatchFn);
+ });
+
+ function watchGroupAction() {
+ changeReactionScheduled = false;
+
+ if (firstRun) {
+ firstRun = false;
+ listener(newValues, newValues, self);
+ } else {
+ listener(newValues, oldValues, self);
+ }
+ }
+
+ return function deregisterWatchGroup() {
+ while (deregisterFns.length) {
+ deregisterFns.shift()();
+ }
+ };
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$watchCollection
+ * @kind function
+ *
+ * @description
+ * Shallow watches the properties of an object and fires whenever any of the properties change
+ * (for arrays, this implies watching the array items; for object maps, this implies watching
+ * the properties). If a change is detected, the `listener` callback is fired.
+ *
+ * - The `obj` collection is observed via standard $watch operation and is examined on every
+ * call to $digest() to see if any items have been added, removed, or moved.
+ * - The `listener` is called whenever anything within the `obj` has changed. Examples include
+ * adding, removing, and moving items belonging to an object or array.
+ *
+ *
+ * # Example
+ * ```js
+ $scope.names = ['igor', 'matias', 'misko', 'james'];
+ $scope.dataCount = 4;
+
+ $scope.$watchCollection('names', function(newNames, oldNames) {
+ $scope.dataCount = newNames.length;
+ });
+
+ expect($scope.dataCount).toEqual(4);
+ $scope.$digest();
+
+ //still at 4 ... no changes
+ expect($scope.dataCount).toEqual(4);
+
+ $scope.names.pop();
+ $scope.$digest();
+
+ //now there's been a change
+ expect($scope.dataCount).toEqual(3);
+ * ```
+ *
+ *
+ * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The
+ * expression value should evaluate to an object or an array which is observed on each
+ * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the
+ * collection will trigger a call to the `listener`.
+ *
+ * @param {function(newCollection, oldCollection, scope)} listener a callback function called
+ * when a change is detected.
+ * - The `newCollection` object is the newly modified data obtained from the `obj` expression
+ * - The `oldCollection` object is a copy of the former collection data.
+ * Due to performance considerations, the`oldCollection` value is computed only if the
+ * `listener` function declares two or more arguments.
+ * - The `scope` argument refers to the current scope.
+ *
+ * @returns {function()} Returns a de-registration function for this listener. When the
+ * de-registration function is executed, the internal watch operation is terminated.
+ */
+ $watchCollection: function(obj, listener) {
+ $watchCollectionInterceptor.$stateful = true;
+
+ var self = this;
+ // the current value, updated on each dirty-check run
+ var newValue;
+ // a shallow copy of the newValue from the last dirty-check run,
+ // updated to match newValue during dirty-check run
+ var oldValue;
+ // a shallow copy of the newValue from when the last change happened
+ var veryOldValue;
+ // only track veryOldValue if the listener is asking for it
+ var trackVeryOldValue = (listener.length > 1);
+ var changeDetected = 0;
+ var changeDetector = $parse(obj, $watchCollectionInterceptor);
+ var internalArray = [];
+ var internalObject = {};
+ var initRun = true;
+ var oldLength = 0;
+
+ function $watchCollectionInterceptor(_value) {
+ newValue = _value;
+ var newLength, key, bothNaN, newItem, oldItem;
+
+ // If the new value is undefined, then return undefined as the watch may be a one-time watch
+ if (isUndefined(newValue)) return;
+
+ if (!isObject(newValue)) { // if primitive
+ if (oldValue !== newValue) {
+ oldValue = newValue;
+ changeDetected++;
+ }
+ } else if (isArrayLike(newValue)) {
+ if (oldValue !== internalArray) {
+ // we are transitioning from something which was not an array into array.
+ oldValue = internalArray;
+ oldLength = oldValue.length = 0;
+ changeDetected++;
+ }
+
+ newLength = newValue.length;
+
+ if (oldLength !== newLength) {
+ // if lengths do not match we need to trigger change notification
+ changeDetected++;
+ oldValue.length = oldLength = newLength;
+ }
+ // copy the items to oldValue and look for changes.
+ for (var i = 0; i < newLength; i++) {
+ oldItem = oldValue[i];
+ newItem = newValue[i];
+
+ bothNaN = (oldItem !== oldItem) && (newItem !== newItem);
+ if (!bothNaN && (oldItem !== newItem)) {
+ changeDetected++;
+ oldValue[i] = newItem;
+ }
+ }
+ } else {
+ if (oldValue !== internalObject) {
+ // we are transitioning from something which was not an object into object.
+ oldValue = internalObject = {};
+ oldLength = 0;
+ changeDetected++;
+ }
+ // copy the items to oldValue and look for changes.
+ newLength = 0;
+ for (key in newValue) {
+ if (hasOwnProperty.call(newValue, key)) {
+ newLength++;
+ newItem = newValue[key];
+ oldItem = oldValue[key];
+
+ if (key in oldValue) {
+ bothNaN = (oldItem !== oldItem) && (newItem !== newItem);
+ if (!bothNaN && (oldItem !== newItem)) {
+ changeDetected++;
+ oldValue[key] = newItem;
+ }
+ } else {
+ oldLength++;
+ oldValue[key] = newItem;
+ changeDetected++;
+ }
+ }
+ }
+ if (oldLength > newLength) {
+ // we used to have more keys, need to find them and destroy them.
+ changeDetected++;
+ for (key in oldValue) {
+ if (!hasOwnProperty.call(newValue, key)) {
+ oldLength--;
+ delete oldValue[key];
+ }
+ }
+ }
+ }
+ return changeDetected;
+ }
+
+ function $watchCollectionAction() {
+ if (initRun) {
+ initRun = false;
+ listener(newValue, newValue, self);
+ } else {
+ listener(newValue, veryOldValue, self);
+ }
+
+ // make a copy for the next time a collection is changed
+ if (trackVeryOldValue) {
+ if (!isObject(newValue)) {
+ //primitive
+ veryOldValue = newValue;
+ } else if (isArrayLike(newValue)) {
+ veryOldValue = new Array(newValue.length);
+ for (var i = 0; i < newValue.length; i++) {
+ veryOldValue[i] = newValue[i];
+ }
+ } else { // if object
+ veryOldValue = {};
+ for (var key in newValue) {
+ if (hasOwnProperty.call(newValue, key)) {
+ veryOldValue[key] = newValue[key];
+ }
+ }
+ }
+ }
+ }
+
+ return this.$watch(changeDetector, $watchCollectionAction);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$digest
+ * @kind function
+ *
+ * @description
+ * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and
+ * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change
+ * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}
+ * until no more listeners are firing. This means that it is possible to get into an infinite
+ * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of
+ * iterations exceeds 10.
+ *
+ * Usually, you don't call `$digest()` directly in
+ * {@link ng.directive:ngController controllers} or in
+ * {@link ng.$compileProvider#directive directives}.
+ * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within
+ * a {@link ng.$compileProvider#directive directive}), which will force a `$digest()`.
+ *
+ * If you want to be notified whenever `$digest()` is called,
+ * you can register a `watchExpression` function with
+ * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.
+ *
+ * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
+ *
+ * # Example
+ * ```js
+ var scope = ...;
+ scope.name = 'misko';
+ scope.counter = 0;
+
+ expect(scope.counter).toEqual(0);
+ scope.$watch('name', function(newValue, oldValue) {
+ scope.counter = scope.counter + 1;
+ });
+ expect(scope.counter).toEqual(0);
+
+ scope.$digest();
+ // the listener is always called during the first $digest loop after it was registered
+ expect(scope.counter).toEqual(1);
+
+ scope.$digest();
+ // but now it will not be called unless the value changes
+ expect(scope.counter).toEqual(1);
+
+ scope.name = 'adam';
+ scope.$digest();
+ expect(scope.counter).toEqual(2);
+ * ```
+ *
+ */
+ $digest: function() {
+ var watch, value, last, fn, get,
+ watchers,
+ length,
+ dirty, ttl = TTL,
+ next, current, target = this,
+ watchLog = [],
+ logIdx, logMsg, asyncTask;
+
+ beginPhase('$digest');
+ // Check for changes to browser url that happened in sync before the call to $digest
+ $browser.$$checkUrlChange();
+
+ if (this === $rootScope && applyAsyncId !== null) {
+ // If this is the root scope, and $applyAsync has scheduled a deferred $apply(), then
+ // cancel the scheduled $apply and flush the queue of expressions to be evaluated.
+ $browser.defer.cancel(applyAsyncId);
+ flushApplyAsync();
+ }
+
+ lastDirtyWatch = null;
+
+ do { // "while dirty" loop
+ dirty = false;
+ current = target;
+
+ while (asyncQueue.length) {
+ try {
+ asyncTask = asyncQueue.shift();
+ asyncTask.scope.$eval(asyncTask.expression, asyncTask.locals);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ lastDirtyWatch = null;
+ }
+
+ traverseScopesLoop:
+ do { // "traverse the scopes" loop
+ if ((watchers = current.$$watchers)) {
+ // process our watches
+ length = watchers.length;
+ while (length--) {
+ try {
+ watch = watchers[length];
+ // Most common watches are on primitives, in which case we can short
+ // circuit it with === operator, only when === fails do we use .equals
+ if (watch) {
+ get = watch.get;
+ if ((value = get(current)) !== (last = watch.last) &&
+ !(watch.eq
+ ? equals(value, last)
+ : (typeof value === 'number' && typeof last === 'number'
+ && isNaN(value) && isNaN(last)))) {
+ dirty = true;
+ lastDirtyWatch = watch;
+ watch.last = watch.eq ? copy(value, null) : value;
+ fn = watch.fn;
+ fn(value, ((last === initWatchVal) ? value : last), current);
+ if (ttl < 5) {
+ logIdx = 4 - ttl;
+ if (!watchLog[logIdx]) watchLog[logIdx] = [];
+ watchLog[logIdx].push({
+ msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp,
+ newVal: value,
+ oldVal: last
+ });
+ }
+ } else if (watch === lastDirtyWatch) {
+ // If the most recently dirty watcher is now clean, short circuit since the remaining watchers
+ // have already been tested.
+ dirty = false;
+ break traverseScopesLoop;
+ }
+ }
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ }
+
+ // Insanity Warning: scope depth-first traversal
+ // yes, this code is a bit crazy, but it works and we have tests to prove it!
+ // this piece should be kept in sync with the traversal in $broadcast
+ if (!(next = ((current.$$watchersCount && current.$$childHead) ||
+ (current !== target && current.$$nextSibling)))) {
+ while (current !== target && !(next = current.$$nextSibling)) {
+ current = current.$parent;
+ }
+ }
+ } while ((current = next));
+
+ // `break traverseScopesLoop;` takes us to here
+
+ if ((dirty || asyncQueue.length) && !(ttl--)) {
+ clearPhase();
+ throw $rootScopeMinErr('infdig',
+ '{0} $digest() iterations reached. Aborting!\n' +
+ 'Watchers fired in the last 5 iterations: {1}',
+ TTL, watchLog);
+ }
+
+ } while (dirty || asyncQueue.length);
+
+ clearPhase();
+
+ while (postDigestQueue.length) {
+ try {
+ postDigestQueue.shift()();
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ },
+
+
+ /**
+ * @ngdoc event
+ * @name $rootScope.Scope#$destroy
+ * @eventType broadcast on scope being destroyed
+ *
+ * @description
+ * Broadcasted when a scope and its children are being destroyed.
+ *
+ * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
+ * clean up DOM bindings before an element is removed from the DOM.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$destroy
+ * @kind function
+ *
+ * @description
+ * Removes the current scope (and all of its children) from the parent scope. Removal implies
+ * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer
+ * propagate to the current scope and its children. Removal also implies that the current
+ * scope is eligible for garbage collection.
+ *
+ * The `$destroy()` is usually used by directives such as
+ * {@link ng.directive:ngRepeat ngRepeat} for managing the
+ * unrolling of the loop.
+ *
+ * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.
+ * Application code can register a `$destroy` event handler that will give it a chance to
+ * perform any necessary cleanup.
+ *
+ * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
+ * clean up DOM bindings before an element is removed from the DOM.
+ */
+ $destroy: function() {
+ // We can't destroy a scope that has been already destroyed.
+ if (this.$$destroyed) return;
+ var parent = this.$parent;
+
+ this.$broadcast('$destroy');
+ this.$$destroyed = true;
+
+ if (this === $rootScope) {
+ //Remove handlers attached to window when $rootScope is removed
+ $browser.$$applicationDestroyed();
+ }
+
+ incrementWatchersCount(this, -this.$$watchersCount);
+ for (var eventName in this.$$listenerCount) {
+ decrementListenerCount(this, this.$$listenerCount[eventName], eventName);
+ }
+
+ // sever all the references to parent scopes (after this cleanup, the current scope should
+ // not be retained by any of our references and should be eligible for garbage collection)
+ if (parent && parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
+ if (parent && parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
+ if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
+ if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
+
+ // Disable listeners, watchers and apply/digest methods
+ this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop;
+ this.$on = this.$watch = this.$watchGroup = function() { return noop; };
+ this.$$listeners = {};
+
+ // Disconnect the next sibling to prevent `cleanUpScope` destroying those too
+ this.$$nextSibling = null;
+ cleanUpScope(this);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$eval
+ * @kind function
+ *
+ * @description
+ * Executes the `expression` on the current scope and returns the result. Any exceptions in
+ * the expression are propagated (uncaught). This is useful when evaluating Angular
+ * expressions.
+ *
+ * # Example
+ * ```js
+ var scope = ng.$rootScope.Scope();
+ scope.a = 1;
+ scope.b = 2;
+
+ expect(scope.$eval('a+b')).toEqual(3);
+ expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
+ * ```
+ *
+ * @param {(string|function())=} expression An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with the current `scope` parameter.
+ *
+ * @param {(object)=} locals Local variables object, useful for overriding values in scope.
+ * @returns {*} The result of evaluating the expression.
+ */
+ $eval: function(expr, locals) {
+ return $parse(expr)(this, locals);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$evalAsync
+ * @kind function
+ *
+ * @description
+ * Executes the expression on the current scope at a later point in time.
+ *
+ * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only
+ * that:
+ *
+ * - it will execute after the function that scheduled the evaluation (preferably before DOM
+ * rendering).
+ * - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after
+ * `expression` execution.
+ *
+ * Any exceptions from the execution of the expression are forwarded to the
+ * {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle
+ * will be scheduled. However, it is encouraged to always call code that changes the model
+ * from within an `$apply` call. That includes code evaluated via `$evalAsync`.
+ *
+ * @param {(string|function())=} expression An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with the current `scope` parameter.
+ *
+ * @param {(object)=} locals Local variables object, useful for overriding values in scope.
+ */
+ $evalAsync: function(expr, locals) {
+ // if we are outside of an $digest loop and this is the first time we are scheduling async
+ // task also schedule async auto-flush
+ if (!$rootScope.$$phase && !asyncQueue.length) {
+ $browser.defer(function() {
+ if (asyncQueue.length) {
+ $rootScope.$digest();
+ }
+ });
+ }
+
+ asyncQueue.push({scope: this, expression: $parse(expr), locals: locals});
+ },
+
+ $$postDigest: function(fn) {
+ postDigestQueue.push(fn);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$apply
+ * @kind function
+ *
+ * @description
+ * `$apply()` is used to execute an expression in angular from outside of the angular
+ * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).
+ * Because we are calling into the angular framework we need to perform proper scope life
+ * cycle of {@link ng.$exceptionHandler exception handling},
+ * {@link ng.$rootScope.Scope#$digest executing watches}.
+ *
+ * ## Life cycle
+ *
+ * # Pseudo-Code of `$apply()`
+ * ```js
+ function $apply(expr) {
+ try {
+ return $eval(expr);
+ } catch (e) {
+ $exceptionHandler(e);
+ } finally {
+ $root.$digest();
+ }
+ }
+ * ```
+ *
+ *
+ * Scope's `$apply()` method transitions through the following stages:
+ *
+ * 1. The {@link guide/expression expression} is executed using the
+ * {@link ng.$rootScope.Scope#$eval $eval()} method.
+ * 2. Any exceptions from the execution of the expression are forwarded to the
+ * {@link ng.$exceptionHandler $exceptionHandler} service.
+ * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the
+ * expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.
+ *
+ *
+ * @param {(string|function())=} exp An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with current `scope` parameter.
+ *
+ * @returns {*} The result of evaluating the expression.
+ */
+ $apply: function(expr) {
+ try {
+ beginPhase('$apply');
+ try {
+ return this.$eval(expr);
+ } finally {
+ clearPhase();
+ }
+ } catch (e) {
+ $exceptionHandler(e);
+ } finally {
+ try {
+ $rootScope.$digest();
+ } catch (e) {
+ $exceptionHandler(e);
+ throw e;
+ }
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$applyAsync
+ * @kind function
+ *
+ * @description
+ * Schedule the invocation of $apply to occur at a later time. The actual time difference
+ * varies across browsers, but is typically around ~10 milliseconds.
+ *
+ * This can be used to queue up multiple expressions which need to be evaluated in the same
+ * digest.
+ *
+ * @param {(string|function())=} exp An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with current `scope` parameter.
+ */
+ $applyAsync: function(expr) {
+ var scope = this;
+ expr && applyAsyncQueue.push($applyAsyncExpression);
+ expr = $parse(expr);
+ scheduleApplyAsync();
+
+ function $applyAsyncExpression() {
+ scope.$eval(expr);
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$on
+ * @kind function
+ *
+ * @description
+ * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for
+ * discussion of event life cycle.
+ *
+ * The event listener function format is: `function(event, args...)`. The `event` object
+ * passed into the listener has the following attributes:
+ *
+ * - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or
+ * `$broadcast`-ed.
+ * - `currentScope` - `{Scope}`: the scope that is currently handling the event. Once the
+ * event propagates through the scope hierarchy, this property is set to null.
+ * - `name` - `{string}`: name of the event.
+ * - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel
+ * further event propagation (available only for events that were `$emit`-ed).
+ * - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag
+ * to true.
+ * - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
+ *
+ * @param {string} name Event name to listen on.
+ * @param {function(event, ...args)} listener Function to call when the event is emitted.
+ * @returns {function()} Returns a deregistration function for this listener.
+ */
+ $on: function(name, listener) {
+ var namedListeners = this.$$listeners[name];
+ if (!namedListeners) {
+ this.$$listeners[name] = namedListeners = [];
+ }
+ namedListeners.push(listener);
+
+ var current = this;
+ do {
+ if (!current.$$listenerCount[name]) {
+ current.$$listenerCount[name] = 0;
+ }
+ current.$$listenerCount[name]++;
+ } while ((current = current.$parent));
+
+ var self = this;
+ return function() {
+ var indexOfListener = namedListeners.indexOf(listener);
+ if (indexOfListener !== -1) {
+ namedListeners[indexOfListener] = null;
+ decrementListenerCount(self, 1, name);
+ }
+ };
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$emit
+ * @kind function
+ *
+ * @description
+ * Dispatches an event `name` upwards through the scope hierarchy notifying the
+ * registered {@link ng.$rootScope.Scope#$on} listeners.
+ *
+ * The event life cycle starts at the scope on which `$emit` was called. All
+ * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
+ * notified. Afterwards, the event traverses upwards toward the root scope and calls all
+ * registered listeners along the way. The event will stop propagating if one of the listeners
+ * cancels it.
+ *
+ * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
+ * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * @param {string} name Event name to emit.
+ * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
+ * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).
+ */
+ $emit: function(name, args) {
+ var empty = [],
+ namedListeners,
+ scope = this,
+ stopPropagation = false,
+ event = {
+ name: name,
+ targetScope: scope,
+ stopPropagation: function() {stopPropagation = true;},
+ preventDefault: function() {
+ event.defaultPrevented = true;
+ },
+ defaultPrevented: false
+ },
+ listenerArgs = concat([event], arguments, 1),
+ i, length;
+
+ do {
+ namedListeners = scope.$$listeners[name] || empty;
+ event.currentScope = scope;
+ for (i = 0, length = namedListeners.length; i < length; i++) {
+
+ // if listeners were deregistered, defragment the array
+ if (!namedListeners[i]) {
+ namedListeners.splice(i, 1);
+ i--;
+ length--;
+ continue;
+ }
+ try {
+ //allow all listeners attached to the current scope to run
+ namedListeners[i].apply(null, listenerArgs);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ //if any listener on the current scope stops propagation, prevent bubbling
+ if (stopPropagation) {
+ event.currentScope = null;
+ return event;
+ }
+ //traverse upwards
+ scope = scope.$parent;
+ } while (scope);
+
+ event.currentScope = null;
+
+ return event;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$broadcast
+ * @kind function
+ *
+ * @description
+ * Dispatches an event `name` downwards to all child scopes (and their children) notifying the
+ * registered {@link ng.$rootScope.Scope#$on} listeners.
+ *
+ * The event life cycle starts at the scope on which `$broadcast` was called. All
+ * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
+ * notified. Afterwards, the event propagates to all direct and indirect scopes of the current
+ * scope and calls all registered listeners along the way. The event cannot be canceled.
+ *
+ * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
+ * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * @param {string} name Event name to broadcast.
+ * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
+ * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
+ */
+ $broadcast: function(name, args) {
+ var target = this,
+ current = target,
+ next = target,
+ event = {
+ name: name,
+ targetScope: target,
+ preventDefault: function() {
+ event.defaultPrevented = true;
+ },
+ defaultPrevented: false
+ };
+
+ if (!target.$$listenerCount[name]) return event;
+
+ var listenerArgs = concat([event], arguments, 1),
+ listeners, i, length;
+
+ //down while you can, then up and next sibling or up and next sibling until back at root
+ while ((current = next)) {
+ event.currentScope = current;
+ listeners = current.$$listeners[name] || [];
+ for (i = 0, length = listeners.length; i < length; i++) {
+ // if listeners were deregistered, defragment the array
+ if (!listeners[i]) {
+ listeners.splice(i, 1);
+ i--;
+ length--;
+ continue;
+ }
+
+ try {
+ listeners[i].apply(null, listenerArgs);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+
+ // Insanity Warning: scope depth-first traversal
+ // yes, this code is a bit crazy, but it works and we have tests to prove it!
+ // this piece should be kept in sync with the traversal in $digest
+ // (though it differs due to having the extra check for $$listenerCount)
+ if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||
+ (current !== target && current.$$nextSibling)))) {
+ while (current !== target && !(next = current.$$nextSibling)) {
+ current = current.$parent;
+ }
+ }
+ }
+
+ event.currentScope = null;
+ return event;
+ }
+ };
+
+ var $rootScope = new Scope();
+
+ //The internal queues. Expose them on the $rootScope for debugging/testing purposes.
+ var asyncQueue = $rootScope.$$asyncQueue = [];
+ var postDigestQueue = $rootScope.$$postDigestQueue = [];
+ var applyAsyncQueue = $rootScope.$$applyAsyncQueue = [];
+
+ return $rootScope;
+
+
+ function beginPhase(phase) {
+ if ($rootScope.$$phase) {
+ throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);
+ }
+
+ $rootScope.$$phase = phase;
+ }
+
+ function clearPhase() {
+ $rootScope.$$phase = null;
+ }
+
+ function incrementWatchersCount(current, count) {
+ do {
+ current.$$watchersCount += count;
+ } while ((current = current.$parent));
+ }
+
+ function decrementListenerCount(current, count, name) {
+ do {
+ current.$$listenerCount[name] -= count;
+
+ if (current.$$listenerCount[name] === 0) {
+ delete current.$$listenerCount[name];
+ }
+ } while ((current = current.$parent));
+ }
+
+ /**
+ * function used as an initial value for watchers.
+ * because it's unique we can easily tell it apart from other values
+ */
+ function initWatchVal() {}
+
+ function flushApplyAsync() {
+ while (applyAsyncQueue.length) {
+ try {
+ applyAsyncQueue.shift()();
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ applyAsyncId = null;
+ }
+
+ function scheduleApplyAsync() {
+ if (applyAsyncId === null) {
+ applyAsyncId = $browser.defer(function() {
+ $rootScope.$apply(flushApplyAsync);
+ });
+ }
+ }
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $rootElement
+ *
+ * @description
+ * The root element of Angular application. This is either the element where {@link
+ * ng.directive:ngApp ngApp} was declared or the element passed into
+ * {@link angular.bootstrap}. The element represents the root element of application. It is also the
+ * location where the application's {@link auto.$injector $injector} service gets
+ * published, and can be retrieved using `$rootElement.injector()`.
+ */
+
+
+// the implementation is in angular.bootstrap
+
+/**
+ * @description
+ * Private service to sanitize uris for links and images. Used by $compile and $sanitize.
+ */
+function $$SanitizeUriProvider() {
+ var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/,
+ imgSrcSanitizationWhitelist = /^\s*((https?|ftp|file|blob):|data:image\/)/;
+
+ /**
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during a[href] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to a[href] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.aHrefSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ aHrefSanitizationWhitelist = regexp;
+ return this;
+ }
+ return aHrefSanitizationWhitelist;
+ };
+
+
+ /**
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during img[src] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to img[src] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.imgSrcSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ imgSrcSanitizationWhitelist = regexp;
+ return this;
+ }
+ return imgSrcSanitizationWhitelist;
+ };
+
+ this.$get = function() {
+ return function sanitizeUri(uri, isImage) {
+ var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;
+ var normalizedVal;
+ normalizedVal = urlResolve(uri).href;
+ if (normalizedVal !== '' && !normalizedVal.match(regex)) {
+ return 'unsafe:' + normalizedVal;
+ }
+ return uri;
+ };
+ };
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+var $sceMinErr = minErr('$sce');
+
+var SCE_CONTEXTS = {
+ HTML: 'html',
+ CSS: 'css',
+ URL: 'url',
+ // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a
+ // url. (e.g. ng-include, script src, templateUrl)
+ RESOURCE_URL: 'resourceUrl',
+ JS: 'js'
+};
+
+// Helper functions follow.
+
+function adjustMatcher(matcher) {
+ if (matcher === 'self') {
+ return matcher;
+ } else if (isString(matcher)) {
+ // Strings match exactly except for 2 wildcards - '*' and '**'.
+ // '*' matches any character except those from the set ':/.?&'.
+ // '**' matches any character (like .* in a RegExp).
+ // More than 2 *'s raises an error as it's ill defined.
+ if (matcher.indexOf('***') > -1) {
+ throw $sceMinErr('iwcard',
+ 'Illegal sequence *** in string matcher. String: {0}', matcher);
+ }
+ matcher = escapeForRegexp(matcher).
+ replace('\\*\\*', '.*').
+ replace('\\*', '[^:/.?&;]*');
+ return new RegExp('^' + matcher + '$');
+ } else if (isRegExp(matcher)) {
+ // The only other type of matcher allowed is a Regexp.
+ // Match entire URL / disallow partial matches.
+ // Flags are reset (i.e. no global, ignoreCase or multiline)
+ return new RegExp('^' + matcher.source + '$');
+ } else {
+ throw $sceMinErr('imatcher',
+ 'Matchers may only be "self", string patterns or RegExp objects');
+ }
+}
+
+
+function adjustMatchers(matchers) {
+ var adjustedMatchers = [];
+ if (isDefined(matchers)) {
+ forEach(matchers, function(matcher) {
+ adjustedMatchers.push(adjustMatcher(matcher));
+ });
+ }
+ return adjustedMatchers;
+}
+
+
+/**
+ * @ngdoc service
+ * @name $sceDelegate
+ * @kind function
+ *
+ * @description
+ *
+ * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict
+ * Contextual Escaping (SCE)} services to AngularJS.
+ *
+ * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of
+ * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS. This is
+ * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to
+ * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things
+ * work because `$sce` delegates to `$sceDelegate` for these operations.
+ *
+ * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.
+ *
+ * The default instance of `$sceDelegate` should work out of the box with little pain. While you
+ * can override it completely to change the behavior of `$sce`, the common case would
+ * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting
+ * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as
+ * templates. Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist
+ * $sceDelegateProvider.resourceUrlWhitelist} and {@link
+ * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+ */
+
+/**
+ * @ngdoc provider
+ * @name $sceDelegateProvider
+ * @description
+ *
+ * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate
+ * $sceDelegate} service. This allows one to get/set the whitelists and blacklists used to ensure
+ * that the URLs used for sourcing Angular templates are safe. Refer {@link
+ * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and
+ * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+ *
+ * For the general details about this service in Angular, read the main page for {@link ng.$sce
+ * Strict Contextual Escaping (SCE)}.
+ *
+ * **Example**: Consider the following case. <a name="example"></a>
+ *
+ * - your app is hosted at url `http://myapp.example.com/`
+ * - but some of your templates are hosted on other domains you control such as
+ * `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.
+ * - and you have an open redirect at `http://myapp.example.com/clickThru?...`.
+ *
+ * Here is what a secure configuration for this scenario might look like:
+ *
+ * ```
+ * angular.module('myApp', []).config(function($sceDelegateProvider) {
+ * $sceDelegateProvider.resourceUrlWhitelist([
+ * // Allow same origin resource loads.
+ * 'self',
+ * // Allow loading from our assets domain. Notice the difference between * and **.
+ * 'http://srv*.assets.example.com/**'
+ * ]);
+ *
+ * // The blacklist overrides the whitelist so the open redirect here is blocked.
+ * $sceDelegateProvider.resourceUrlBlacklist([
+ * 'http://myapp.example.com/clickThru**'
+ * ]);
+ * });
+ * ```
+ */
+
+function $SceDelegateProvider() {
+ this.SCE_CONTEXTS = SCE_CONTEXTS;
+
+ // Resource URLs can also be trusted by policy.
+ var resourceUrlWhitelist = ['self'],
+ resourceUrlBlacklist = [];
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegateProvider#resourceUrlWhitelist
+ * @kind function
+ *
+ * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
+ * provided. This must be an array or null. A snapshot of this array is used so further
+ * changes to the array are ignored.
+ *
+ * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+ * allowed in this array.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** an empty whitelist array will block all URLs!
+ * </div>
+ *
+ * @return {Array} the currently set whitelist array.
+ *
+ * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
+ * same origin resource requests.
+ *
+ * @description
+ * Sets/Gets the whitelist of trusted resource URLs.
+ */
+ this.resourceUrlWhitelist = function(value) {
+ if (arguments.length) {
+ resourceUrlWhitelist = adjustMatchers(value);
+ }
+ return resourceUrlWhitelist;
+ };
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegateProvider#resourceUrlBlacklist
+ * @kind function
+ *
+ * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
+ * provided. This must be an array or null. A snapshot of this array is used so further
+ * changes to the array are ignored.
+ *
+ * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+ * allowed in this array.
+ *
+ * The typical usage for the blacklist is to **block
+ * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
+ * these would otherwise be trusted but actually return content from the redirected domain.
+ *
+ * Finally, **the blacklist overrides the whitelist** and has the final say.
+ *
+ * @return {Array} the currently set blacklist array.
+ *
+ * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there
+ * is no blacklist.)
+ *
+ * @description
+ * Sets/Gets the blacklist of trusted resource URLs.
+ */
+
+ this.resourceUrlBlacklist = function(value) {
+ if (arguments.length) {
+ resourceUrlBlacklist = adjustMatchers(value);
+ }
+ return resourceUrlBlacklist;
+ };
+
+ this.$get = ['$injector', function($injector) {
+
+ var htmlSanitizer = function htmlSanitizer(html) {
+ throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
+ };
+
+ if ($injector.has('$sanitize')) {
+ htmlSanitizer = $injector.get('$sanitize');
+ }
+
+
+ function matchUrl(matcher, parsedUrl) {
+ if (matcher === 'self') {
+ return urlIsSameOrigin(parsedUrl);
+ } else {
+ // definitely a regex. See adjustMatchers()
+ return !!matcher.exec(parsedUrl.href);
+ }
+ }
+
+ function isResourceUrlAllowedByPolicy(url) {
+ var parsedUrl = urlResolve(url.toString());
+ var i, n, allowed = false;
+ // Ensure that at least one item from the whitelist allows this url.
+ for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) {
+ if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {
+ allowed = true;
+ break;
+ }
+ }
+ if (allowed) {
+ // Ensure that no item from the blacklist blocked this url.
+ for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) {
+ if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {
+ allowed = false;
+ break;
+ }
+ }
+ }
+ return allowed;
+ }
+
+ function generateHolderType(Base) {
+ var holderType = function TrustedValueHolderType(trustedValue) {
+ this.$$unwrapTrustedValue = function() {
+ return trustedValue;
+ };
+ };
+ if (Base) {
+ holderType.prototype = new Base();
+ }
+ holderType.prototype.valueOf = function sceValueOf() {
+ return this.$$unwrapTrustedValue();
+ };
+ holderType.prototype.toString = function sceToString() {
+ return this.$$unwrapTrustedValue().toString();
+ };
+ return holderType;
+ }
+
+ var trustedValueHolderBase = generateHolderType(),
+ byType = {};
+
+ byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]);
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegate#trustAs
+ *
+ * @description
+ * Returns an object that is trusted by angular for use in specified strict
+ * contextual escaping contexts (such as ng-bind-html, ng-include, any src
+ * attribute interpolation, any dom event binding attribute interpolation
+ * such as for onclick, etc.) that uses the provided value.
+ * See {@link ng.$sce $sce} for enabling strict contextual escaping.
+ *
+ * @param {string} type The kind of context in which this value is safe for use. e.g. url,
+ * resourceUrl, html, js and css.
+ * @param {*} value The value that that should be considered trusted/safe.
+ * @returns {*} A value that can be used to stand in for the provided `value` in places
+ * where Angular expects a $sce.trustAs() return value.
+ */
+ function trustAs(type, trustedValue) {
+ var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
+ if (!Constructor) {
+ throw $sceMinErr('icontext',
+ 'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',
+ type, trustedValue);
+ }
+ if (trustedValue === null || isUndefined(trustedValue) || trustedValue === '') {
+ return trustedValue;
+ }
+ // All the current contexts in SCE_CONTEXTS happen to be strings. In order to avoid trusting
+ // mutable objects, we ensure here that the value passed in is actually a string.
+ if (typeof trustedValue !== 'string') {
+ throw $sceMinErr('itype',
+ 'Attempted to trust a non-string value in a content requiring a string: Context: {0}',
+ type);
+ }
+ return new Constructor(trustedValue);
+ }
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegate#valueOf
+ *
+ * @description
+ * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link
+ * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.
+ *
+ * If the passed parameter is not a value that had been returned by {@link
+ * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.
+ *
+ * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}
+ * call or anything else.
+ * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`} if `value` is the result of such a call. Otherwise, returns
+ * `value` unchanged.
+ */
+ function valueOf(maybeTrusted) {
+ if (maybeTrusted instanceof trustedValueHolderBase) {
+ return maybeTrusted.$$unwrapTrustedValue();
+ } else {
+ return maybeTrusted;
+ }
+ }
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegate#getTrusted
+ *
+ * @description
+ * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and
+ * returns the originally supplied value if the queried context type is a supertype of the
+ * created type. If this condition isn't satisfied, throws an exception.
+ *
+ * <div class="alert alert-danger">
+ * Disabling auto-escaping is extremely dangerous, it usually creates a Cross Site Scripting
+ * (XSS) vulnerability in your application.
+ * </div>
+ *
+ * @param {string} type The kind of context in which this value is to be used.
+ * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`} call.
+ * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`} if valid in this context. Otherwise, throws an exception.
+ */
+ function getTrusted(type, maybeTrusted) {
+ if (maybeTrusted === null || isUndefined(maybeTrusted) || maybeTrusted === '') {
+ return maybeTrusted;
+ }
+ var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
+ if (constructor && maybeTrusted instanceof constructor) {
+ return maybeTrusted.$$unwrapTrustedValue();
+ }
+ // If we get here, then we may only take one of two actions.
+ // 1. sanitize the value for the requested type, or
+ // 2. throw an exception.
+ if (type === SCE_CONTEXTS.RESOURCE_URL) {
+ if (isResourceUrlAllowedByPolicy(maybeTrusted)) {
+ return maybeTrusted;
+ } else {
+ throw $sceMinErr('insecurl',
+ 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}',
+ maybeTrusted.toString());
+ }
+ } else if (type === SCE_CONTEXTS.HTML) {
+ return htmlSanitizer(maybeTrusted);
+ }
+ throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
+ }
+
+ return { trustAs: trustAs,
+ getTrusted: getTrusted,
+ valueOf: valueOf };
+ }];
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $sceProvider
+ * @description
+ *
+ * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.
+ * - enable/disable Strict Contextual Escaping (SCE) in a module
+ * - override the default implementation with a custom delegate
+ *
+ * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}.
+ */
+
+/* jshint maxlen: false*/
+
+/**
+ * @ngdoc service
+ * @name $sce
+ * @kind function
+ *
+ * @description
+ *
+ * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS.
+ *
+ * # Strict Contextual Escaping
+ *
+ * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain
+ * contexts to result in a value that is marked as safe to use for that context. One example of
+ * such a context is binding arbitrary html controlled by the user via `ng-bind-html`. We refer
+ * to these contexts as privileged or SCE contexts.
+ *
+ * As of version 1.2, Angular ships with SCE enabled by default.
+ *
+ * Note: When enabled (the default), IE<11 in quirks mode is not supported. In this mode, IE<11 allow
+ * one to execute arbitrary javascript by the use of the expression() syntax. Refer
+ * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them.
+ * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>`
+ * to the top of your HTML document.
+ *
+ * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for
+ * security vulnerabilities such as XSS, clickjacking, etc. a lot easier.
+ *
+ * Here's an example of a binding in a privileged context:
+ *
+ * ```
+ * <input ng-model="userHtml" aria-label="User input">
+ * <div ng-bind-html="userHtml"></div>
+ * ```
+ *
+ * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user. With SCE
+ * disabled, this application allows the user to render arbitrary HTML into the DIV.
+ * In a more realistic example, one may be rendering user comments, blog articles, etc. via
+ * bindings. (HTML is just one example of a context where rendering user controlled input creates
+ * security vulnerabilities.)
+ *
+ * For the case of HTML, you might use a library, either on the client side, or on the server side,
+ * to sanitize unsafe HTML before binding to the value and rendering it in the document.
+ *
+ * How would you ensure that every place that used these types of bindings was bound to a value that
+ * was sanitized by your library (or returned as safe for rendering by your server?) How can you
+ * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some
+ * properties/fields and forgot to update the binding to the sanitized value?
+ *
+ * To be secure by default, you want to ensure that any such bindings are disallowed unless you can
+ * determine that something explicitly says it's safe to use a value for binding in that
+ * context. You can then audit your code (a simple grep would do) to ensure that this is only done
+ * for those values that you can easily tell are safe - because they were received from your server,
+ * sanitized by your library, etc. You can organize your codebase to help with this - perhaps
+ * allowing only the files in a specific directory to do this. Ensuring that the internal API
+ * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.
+ *
+ * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}
+ * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to
+ * obtain values that will be accepted by SCE / privileged contexts.
+ *
+ *
+ * ## How does it work?
+ *
+ * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted
+ * $sce.getTrusted(context, value)} rather than to the value directly. Directives use {@link
+ * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the
+ * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.
+ *
+ * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link
+ * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly
+ * simplified):
+ *
+ * ```
+ * var ngBindHtmlDirective = ['$sce', function($sce) {
+ * return function(scope, element, attr) {
+ * scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {
+ * element.html(value || '');
+ * });
+ * };
+ * }];
+ * ```
+ *
+ * ## Impact on loading templates
+ *
+ * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as
+ * `templateUrl`'s specified by {@link guide/directive directives}.
+ *
+ * By default, Angular only loads templates from the same domain and protocol as the application
+ * document. This is done by calling {@link ng.$sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl} on the template URL. To load templates from other domains and/or
+ * protocols, you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist
+ * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.
+ *
+ * *Please note*:
+ * The browser's
+ * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+ * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
+ * policy apply in addition to this and may further restrict whether the template is successfully
+ * loaded. This means that without the right CORS policy, loading templates from a different domain
+ * won't work on all browsers. Also, loading templates from `file://` URL does not work on some
+ * browsers.
+ *
+ * ## This feels like too much overhead
+ *
+ * It's important to remember that SCE only applies to interpolation expressions.
+ *
+ * If your expressions are constant literals, they're automatically trusted and you don't need to
+ * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g.
+ * `<div ng-bind-html="'<b>implicitly trusted</b>'"></div>`) just works.
+ *
+ * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them
+ * through {@link ng.$sce#getTrusted $sce.getTrusted}. SCE doesn't play a role here.
+ *
+ * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load
+ * templates in `ng-include` from your application's domain without having to even know about SCE.
+ * It blocks loading templates from other domains or loading templates over http from an https
+ * served document. You can change these by setting your own custom {@link
+ * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link
+ * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs.
+ *
+ * This significantly reduces the overhead. It is far easier to pay the small overhead and have an
+ * application that's secure and can be audited to verify that with much more ease than bolting
+ * security onto an application later.
+ *
+ * <a name="contexts"></a>
+ * ## What trusted context types are supported?
+ *
+ * | Context | Notes |
+ * |---------------------|----------------|
+ * | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. |
+ * | `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. |
+ * | `$sce.URL` | For URLs that are safe to follow as links. Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |
+ * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application. Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.) <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |
+ * | `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. |
+ *
+ * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name="resourceUrlPatternItem"></a>
+ *
+ * Each element in these arrays must be one of the following:
+ *
+ * - **'self'**
+ * - The special **string**, `'self'`, can be used to match against all URLs of the **same
+ * domain** as the application document using the **same protocol**.
+ * - **String** (except the special value `'self'`)
+ * - The string is matched against the full *normalized / absolute URL* of the resource
+ * being tested (substring matches are not good enough.)
+ * - There are exactly **two wildcard sequences** - `*` and `**`. All other characters
+ * match themselves.
+ * - `*`: matches zero or more occurrences of any character other than one of the following 6
+ * characters: '`:`', '`/`', '`.`', '`?`', '`&`' and '`;`'. It's a useful wildcard for use
+ * in a whitelist.
+ * - `**`: matches zero or more occurrences of *any* character. As such, it's not
+ * appropriate for use in a scheme, domain, etc. as it would match too much. (e.g.
+ * http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might
+ * not have been the intention.) Its usage at the very end of the path is ok. (e.g.
+ * http://foo.example.com/templates/**).
+ * - **RegExp** (*see caveat below*)
+ * - *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax
+ * (and all the inevitable escaping) makes them *harder to maintain*. It's easy to
+ * accidentally introduce a bug when one updates a complex expression (imho, all regexes should
+ * have good test coverage). For instance, the use of `.` in the regex is correct only in a
+ * small number of cases. A `.` character in the regex used when matching the scheme or a
+ * subdomain could be matched against a `:` or literal `.` that was likely not intended. It
+ * is highly recommended to use the string patterns and only fall back to regular expressions
+ * as a last resort.
+ * - The regular expression must be an instance of RegExp (i.e. not a string.) It is
+ * matched against the **entire** *normalized / absolute URL* of the resource being tested
+ * (even when the RegExp did not have the `^` and `$` codes.) In addition, any flags
+ * present on the RegExp (such as multiline, global, ignoreCase) are ignored.
+ * - If you are generating your JavaScript from some other templating engine (not
+ * recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)),
+ * remember to escape your regular expression (and be aware that you might need more than
+ * one level of escaping depending on your templating engine and the way you interpolated
+ * the value.) Do make use of your platform's escaping mechanism as it might be good
+ * enough before coding your own. E.g. Ruby has
+ * [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape)
+ * and Python has [re.escape](http://docs.python.org/library/re.html#re.escape).
+ * Javascript lacks a similar built in function for escaping. Take a look at Google
+ * Closure library's [goog.string.regExpEscape(s)](
+ * http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962).
+ *
+ * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example.
+ *
+ * ## Show me an example using SCE.
+ *
+ * <example module="mySceApp" deps="angular-sanitize.js">
+ * <file name="index.html">
+ * <div ng-controller="AppController as myCtrl">
+ * <i ng-bind-html="myCtrl.explicitlyTrustedHtml" id="explicitlyTrustedHtml"></i><br><br>
+ * <b>User comments</b><br>
+ * By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when
+ * $sanitize is available. If $sanitize isn't available, this results in an error instead of an
+ * exploit.
+ * <div class="well">
+ * <div ng-repeat="userComment in myCtrl.userComments">
+ * <b>{{userComment.name}}</b>:
+ * <span ng-bind-html="userComment.htmlComment" class="htmlComment"></span>
+ * <br>
+ * </div>
+ * </div>
+ * </div>
+ * </file>
+ *
+ * <file name="script.js">
+ * angular.module('mySceApp', ['ngSanitize'])
+ * .controller('AppController', ['$http', '$templateCache', '$sce',
+ * function($http, $templateCache, $sce) {
+ * var self = this;
+ * $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) {
+ * self.userComments = userComments;
+ * });
+ * self.explicitlyTrustedHtml = $sce.trustAsHtml(
+ * '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
+ * 'sanitization.&quot;">Hover over this text.</span>');
+ * }]);
+ * </file>
+ *
+ * <file name="test_data.json">
+ * [
+ * { "name": "Alice",
+ * "htmlComment":
+ * "<span onmouseover='this.textContent=\"PWN3D!\"'>Is <i>anyone</i> reading this?</span>"
+ * },
+ * { "name": "Bob",
+ * "htmlComment": "<i>Yes!</i> Am I the only other one?"
+ * }
+ * ]
+ * </file>
+ *
+ * <file name="protractor.js" type="protractor">
+ * describe('SCE doc demo', function() {
+ * it('should sanitize untrusted values', function() {
+ * expect(element.all(by.css('.htmlComment')).first().getInnerHtml())
+ * .toBe('<span>Is <i>anyone</i> reading this?</span>');
+ * });
+ *
+ * it('should NOT sanitize explicitly trusted values', function() {
+ * expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(
+ * '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
+ * 'sanitization.&quot;">Hover over this text.</span>');
+ * });
+ * });
+ * </file>
+ * </example>
+ *
+ *
+ *
+ * ## Can I disable SCE completely?
+ *
+ * Yes, you can. However, this is strongly discouraged. SCE gives you a lot of security benefits
+ * for little coding overhead. It will be much harder to take an SCE disabled application and
+ * either secure it on your own or enable SCE at a later stage. It might make sense to disable SCE
+ * for cases where you have a lot of existing code that was written before SCE was introduced and
+ * you're migrating them a module at a time.
+ *
+ * That said, here's how you can completely disable SCE:
+ *
+ * ```
+ * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
+ * // Completely disable SCE. For demonstration purposes only!
+ * // Do not use in new projects.
+ * $sceProvider.enabled(false);
+ * });
+ * ```
+ *
+ */
+/* jshint maxlen: 100 */
+
+function $SceProvider() {
+ var enabled = true;
+
+ /**
+ * @ngdoc method
+ * @name $sceProvider#enabled
+ * @kind function
+ *
+ * @param {boolean=} value If provided, then enables/disables SCE.
+ * @return {boolean} true if SCE is enabled, false otherwise.
+ *
+ * @description
+ * Enables/disables SCE and returns the current value.
+ */
+ this.enabled = function(value) {
+ if (arguments.length) {
+ enabled = !!value;
+ }
+ return enabled;
+ };
+
+
+ /* Design notes on the default implementation for SCE.
+ *
+ * The API contract for the SCE delegate
+ * -------------------------------------
+ * The SCE delegate object must provide the following 3 methods:
+ *
+ * - trustAs(contextEnum, value)
+ * This method is used to tell the SCE service that the provided value is OK to use in the
+ * contexts specified by contextEnum. It must return an object that will be accepted by
+ * getTrusted() for a compatible contextEnum and return this value.
+ *
+ * - valueOf(value)
+ * For values that were not produced by trustAs(), return them as is. For values that were
+ * produced by trustAs(), return the corresponding input value to trustAs. Basically, if
+ * trustAs is wrapping the given values into some type, this operation unwraps it when given
+ * such a value.
+ *
+ * - getTrusted(contextEnum, value)
+ * This function should return the a value that is safe to use in the context specified by
+ * contextEnum or throw and exception otherwise.
+ *
+ * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be
+ * opaque or wrapped in some holder object. That happens to be an implementation detail. For
+ * instance, an implementation could maintain a registry of all trusted objects by context. In
+ * such a case, trustAs() would return the same object that was passed in. getTrusted() would
+ * return the same object passed in if it was found in the registry under a compatible context or
+ * throw an exception otherwise. An implementation might only wrap values some of the time based
+ * on some criteria. getTrusted() might return a value and not throw an exception for special
+ * constants or objects even if not wrapped. All such implementations fulfill this contract.
+ *
+ *
+ * A note on the inheritance model for SCE contexts
+ * ------------------------------------------------
+ * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types. This
+ * is purely an implementation details.
+ *
+ * The contract is simply this:
+ *
+ * getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value)
+ * will also succeed.
+ *
+ * Inheritance happens to capture this in a natural way. In some future, we
+ * may not use inheritance anymore. That is OK because no code outside of
+ * sce.js and sceSpecs.js would need to be aware of this detail.
+ */
+
+ this.$get = ['$parse', '$sceDelegate', function(
+ $parse, $sceDelegate) {
+ // Prereq: Ensure that we're not running in IE<11 quirks mode. In that mode, IE < 11 allow
+ // the "expression(javascript expression)" syntax which is insecure.
+ if (enabled && msie < 8) {
+ throw $sceMinErr('iequirks',
+ 'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' +
+ 'mode. You can fix this by adding the text <!doctype html> to the top of your HTML ' +
+ 'document. See http://docs.angularjs.org/api/ng.$sce for more information.');
+ }
+
+ var sce = shallowCopy(SCE_CONTEXTS);
+
+ /**
+ * @ngdoc method
+ * @name $sce#isEnabled
+ * @kind function
+ *
+ * @return {Boolean} true if SCE is enabled, false otherwise. If you want to set the value, you
+ * have to do it at module config time on {@link ng.$sceProvider $sceProvider}.
+ *
+ * @description
+ * Returns a boolean indicating if SCE is enabled.
+ */
+ sce.isEnabled = function() {
+ return enabled;
+ };
+ sce.trustAs = $sceDelegate.trustAs;
+ sce.getTrusted = $sceDelegate.getTrusted;
+ sce.valueOf = $sceDelegate.valueOf;
+
+ if (!enabled) {
+ sce.trustAs = sce.getTrusted = function(type, value) { return value; };
+ sce.valueOf = identity;
+ }
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAs
+ *
+ * @description
+ * Converts Angular {@link guide/expression expression} into a function. This is like {@link
+ * ng.$parse $parse} and is identical when the expression is a literal constant. Otherwise, it
+ * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,
+ * *result*)}
+ *
+ * @param {string} type The kind of SCE context in which this result will be used.
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+ sce.parseAs = function sceParseAs(type, expr) {
+ var parsed = $parse(expr);
+ if (parsed.literal && parsed.constant) {
+ return parsed;
+ } else {
+ return $parse(expr, function(value) {
+ return sce.getTrusted(type, value);
+ });
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAs
+ *
+ * @description
+ * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. As such,
+ * returns an object that is trusted by angular for use in specified strict contextual
+ * escaping contexts (such as ng-bind-html, ng-include, any src attribute
+ * interpolation, any dom event binding attribute interpolation such as for onclick, etc.)
+ * that uses the provided value. See * {@link ng.$sce $sce} for enabling strict contextual
+ * escaping.
+ *
+ * @param {string} type The kind of context in which this value is safe for use. e.g. url,
+ * resourceUrl, html, js and css.
+ * @param {*} value The value that that should be considered trusted/safe.
+ * @returns {*} A value that can be used to stand in for the provided `value` in places
+ * where Angular expects a $sce.trustAs() return value.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsHtml
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsHtml(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml
+ * $sce.getTrustedHtml(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsUrl
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsUrl(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl
+ * $sce.getTrustedUrl(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsResourceUrl
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsResourceUrl(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the return
+ * value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsJs
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsJs(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs
+ * $sce.getTrustedJs(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrusted
+ *
+ * @description
+ * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}. As such,
+ * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the
+ * originally supplied value if the queried context type is a supertype of the created type.
+ * If this condition isn't satisfied, throws an exception.
+ *
+ * @param {string} type The kind of context in which this value is to be used.
+ * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}
+ * call.
+ * @returns {*} The value the was originally provided to
+ * {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.
+ * Otherwise, throws an exception.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedHtml
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedHtml(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedCss
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedCss(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedUrl
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedUrl(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedResourceUrl
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedResourceUrl(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}
+ *
+ * @param {*} value The value to pass to `$sceDelegate.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedJs
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedJs(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsHtml
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsHtml(expression string)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsCss
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsCss(value)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsUrl
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsUrl(value)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsResourceUrl
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsResourceUrl(value)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsJs
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsJs(value)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ // Shorthand delegations.
+ var parse = sce.parseAs,
+ getTrusted = sce.getTrusted,
+ trustAs = sce.trustAs;
+
+ forEach(SCE_CONTEXTS, function(enumValue, name) {
+ var lName = lowercase(name);
+ sce[camelCase("parse_as_" + lName)] = function(expr) {
+ return parse(enumValue, expr);
+ };
+ sce[camelCase("get_trusted_" + lName)] = function(value) {
+ return getTrusted(enumValue, value);
+ };
+ sce[camelCase("trust_as_" + lName)] = function(value) {
+ return trustAs(enumValue, value);
+ };
+ });
+
+ return sce;
+ }];
+}
+
+/**
+ * !!! This is an undocumented "private" service !!!
+ *
+ * @name $sniffer
+ * @requires $window
+ * @requires $document
+ *
+ * @property {boolean} history Does the browser support html5 history api ?
+ * @property {boolean} transitions Does the browser support CSS transition events ?
+ * @property {boolean} animations Does the browser support CSS animation events ?
+ *
+ * @description
+ * This is very simple implementation of testing browser's features.
+ */
+function $SnifferProvider() {
+ this.$get = ['$window', '$document', function($window, $document) {
+ var eventSupport = {},
+ android =
+ toInt((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
+ boxee = /Boxee/i.test(($window.navigator || {}).userAgent),
+ document = $document[0] || {},
+ vendorPrefix,
+ vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/,
+ bodyStyle = document.body && document.body.style,
+ transitions = false,
+ animations = false,
+ match;
+
+ if (bodyStyle) {
+ for (var prop in bodyStyle) {
+ if (match = vendorRegex.exec(prop)) {
+ vendorPrefix = match[0];
+ vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);
+ break;
+ }
+ }
+
+ if (!vendorPrefix) {
+ vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';
+ }
+
+ transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));
+ animations = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));
+
+ if (android && (!transitions || !animations)) {
+ transitions = isString(bodyStyle.webkitTransition);
+ animations = isString(bodyStyle.webkitAnimation);
+ }
+ }
+
+
+ return {
+ // Android has history.pushState, but it does not update location correctly
+ // so let's not use the history API at all.
+ // http://code.google.com/p/android/issues/detail?id=17471
+ // https://github.com/angular/angular.js/issues/904
+
+ // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has
+ // so let's not use the history API also
+ // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined
+ // jshint -W018
+ history: !!($window.history && $window.history.pushState && !(android < 4) && !boxee),
+ // jshint +W018
+ hasEvent: function(event) {
+ // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
+ // it. In particular the event is not fired when backspace or delete key are pressed or
+ // when cut operation is performed.
+ // IE10+ implements 'input' event but it erroneously fires under various situations,
+ // e.g. when placeholder changes, or a form is focused.
+ if (event === 'input' && msie <= 11) return false;
+
+ if (isUndefined(eventSupport[event])) {
+ var divElm = document.createElement('div');
+ eventSupport[event] = 'on' + event in divElm;
+ }
+
+ return eventSupport[event];
+ },
+ csp: csp(),
+ vendorPrefix: vendorPrefix,
+ transitions: transitions,
+ animations: animations,
+ android: android
+ };
+ }];
+}
+
+var $compileMinErr = minErr('$compile');
+
+/**
+ * @ngdoc provider
+ * @name $templateRequestProvider
+ * @description
+ * Used to configure the options passed to the {@link $http} service when making a template request.
+ *
+ * For example, it can be used for specifying the "Accept" header that is sent to the server, when
+ * requesting a template.
+ */
+function $TemplateRequestProvider() {
+
+ var httpOptions;
+
+ /**
+ * @ngdoc method
+ * @name $templateRequestProvider#httpOptions
+ * @description
+ * The options to be passed to the {@link $http} service when making the request.
+ * You can use this to override options such as the "Accept" header for template requests.
+ *
+ * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the
+ * options if not overridden here.
+ *
+ * @param {string=} value new value for the {@link $http} options.
+ * @returns {string|self} Returns the {@link $http} options when used as getter and self if used as setter.
+ */
+ this.httpOptions = function(val) {
+ if (val) {
+ httpOptions = val;
+ return this;
+ }
+ return httpOptions;
+ };
+
+ /**
+ * @ngdoc service
+ * @name $templateRequest
+ *
+ * @description
+ * The `$templateRequest` service runs security checks then downloads the provided template using
+ * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request
+ * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the
+ * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the
+ * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted
+ * when `tpl` is of type string and `$templateCache` has the matching entry.
+ *
+ * If you want to pass custom options to the `$http` service, such as setting the Accept header you
+ * can configure this via {@link $templateRequestProvider#httpOptions}.
+ *
+ * @param {string|TrustedResourceUrl} tpl The HTTP request template URL
+ * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty
+ *
+ * @return {Promise} a promise for the HTTP response data of the given URL.
+ *
+ * @property {number} totalPendingRequests total amount of pending template requests being downloaded.
+ */
+ this.$get = ['$templateCache', '$http', '$q', '$sce', function($templateCache, $http, $q, $sce) {
+
+ function handleRequestFn(tpl, ignoreRequestError) {
+ handleRequestFn.totalPendingRequests++;
+
+ // We consider the template cache holds only trusted templates, so
+ // there's no need to go through whitelisting again for keys that already
+ // are included in there. This also makes Angular accept any script
+ // directive, no matter its name. However, we still need to unwrap trusted
+ // types.
+ if (!isString(tpl) || !$templateCache.get(tpl)) {
+ tpl = $sce.getTrustedResourceUrl(tpl);
+ }
+
+ var transformResponse = $http.defaults && $http.defaults.transformResponse;
+
+ if (isArray(transformResponse)) {
+ transformResponse = transformResponse.filter(function(transformer) {
+ return transformer !== defaultHttpResponseTransform;
+ });
+ } else if (transformResponse === defaultHttpResponseTransform) {
+ transformResponse = null;
+ }
+
+ return $http.get(tpl, extend({
+ cache: $templateCache,
+ transformResponse: transformResponse
+ }, httpOptions))
+ ['finally'](function() {
+ handleRequestFn.totalPendingRequests--;
+ })
+ .then(function(response) {
+ $templateCache.put(tpl, response.data);
+ return response.data;
+ }, handleError);
+
+ function handleError(resp) {
+ if (!ignoreRequestError) {
+ throw $compileMinErr('tpload', 'Failed to load template: {0} (HTTP status: {1} {2})',
+ tpl, resp.status, resp.statusText);
+ }
+ return $q.reject(resp);
+ }
+ }
+
+ handleRequestFn.totalPendingRequests = 0;
+
+ return handleRequestFn;
+ }];
+}
+
+function $$TestabilityProvider() {
+ this.$get = ['$rootScope', '$browser', '$location',
+ function($rootScope, $browser, $location) {
+
+ /**
+ * @name $testability
+ *
+ * @description
+ * The private $$testability service provides a collection of methods for use when debugging
+ * or by automated test and debugging tools.
+ */
+ var testability = {};
+
+ /**
+ * @name $$testability#findBindings
+ *
+ * @description
+ * Returns an array of elements that are bound (via ng-bind or {{}})
+ * to expressions matching the input.
+ *
+ * @param {Element} element The element root to search from.
+ * @param {string} expression The binding expression to match.
+ * @param {boolean} opt_exactMatch If true, only returns exact matches
+ * for the expression. Filters and whitespace are ignored.
+ */
+ testability.findBindings = function(element, expression, opt_exactMatch) {
+ var bindings = element.getElementsByClassName('ng-binding');
+ var matches = [];
+ forEach(bindings, function(binding) {
+ var dataBinding = angular.element(binding).data('$binding');
+ if (dataBinding) {
+ forEach(dataBinding, function(bindingName) {
+ if (opt_exactMatch) {
+ var matcher = new RegExp('(^|\\s)' + escapeForRegexp(expression) + '(\\s|\\||$)');
+ if (matcher.test(bindingName)) {
+ matches.push(binding);
+ }
+ } else {
+ if (bindingName.indexOf(expression) != -1) {
+ matches.push(binding);
+ }
+ }
+ });
+ }
+ });
+ return matches;
+ };
+
+ /**
+ * @name $$testability#findModels
+ *
+ * @description
+ * Returns an array of elements that are two-way found via ng-model to
+ * expressions matching the input.
+ *
+ * @param {Element} element The element root to search from.
+ * @param {string} expression The model expression to match.
+ * @param {boolean} opt_exactMatch If true, only returns exact matches
+ * for the expression.
+ */
+ testability.findModels = function(element, expression, opt_exactMatch) {
+ var prefixes = ['ng-', 'data-ng-', 'ng\\:'];
+ for (var p = 0; p < prefixes.length; ++p) {
+ var attributeEquals = opt_exactMatch ? '=' : '*=';
+ var selector = '[' + prefixes[p] + 'model' + attributeEquals + '"' + expression + '"]';
+ var elements = element.querySelectorAll(selector);
+ if (elements.length) {
+ return elements;
+ }
+ }
+ };
+
+ /**
+ * @name $$testability#getLocation
+ *
+ * @description
+ * Shortcut for getting the location in a browser agnostic way. Returns
+ * the path, search, and hash. (e.g. /path?a=b#hash)
+ */
+ testability.getLocation = function() {
+ return $location.url();
+ };
+
+ /**
+ * @name $$testability#setLocation
+ *
+ * @description
+ * Shortcut for navigating to a location without doing a full page reload.
+ *
+ * @param {string} url The location url (path, search and hash,
+ * e.g. /path?a=b#hash) to go to.
+ */
+ testability.setLocation = function(url) {
+ if (url !== $location.url()) {
+ $location.url(url);
+ $rootScope.$digest();
+ }
+ };
+
+ /**
+ * @name $$testability#whenStable
+ *
+ * @description
+ * Calls the callback when $timeout and $http requests are completed.
+ *
+ * @param {function} callback
+ */
+ testability.whenStable = function(callback) {
+ $browser.notifyWhenNoOutstandingRequests(callback);
+ };
+
+ return testability;
+ }];
+}
+
+function $TimeoutProvider() {
+ this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler',
+ function($rootScope, $browser, $q, $$q, $exceptionHandler) {
+
+ var deferreds = {};
+
+
+ /**
+ * @ngdoc service
+ * @name $timeout
+ *
+ * @description
+ * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch
+ * block and delegates any exceptions to
+ * {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * The return value of calling `$timeout` is a promise, which will be resolved when
+ * the delay has passed and the timeout function, if provided, is executed.
+ *
+ * To cancel a timeout request, call `$timeout.cancel(promise)`.
+ *
+ * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to
+ * synchronously flush the queue of deferred functions.
+ *
+ * If you only want a promise that will be resolved after some specified delay
+ * then you can call `$timeout` without the `fn` function.
+ *
+ * @param {function()=} fn A function, whose execution should be delayed.
+ * @param {number=} [delay=0] Delay in milliseconds.
+ * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
+ * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
+ * @param {...*=} Pass additional parameters to the executed function.
+ * @returns {Promise} Promise that will be resolved when the timeout is reached. The promise
+ * will be resolved with the return value of the `fn` function.
+ *
+ */
+ function timeout(fn, delay, invokeApply) {
+ if (!isFunction(fn)) {
+ invokeApply = delay;
+ delay = fn;
+ fn = noop;
+ }
+
+ var args = sliceArgs(arguments, 3),
+ skipApply = (isDefined(invokeApply) && !invokeApply),
+ deferred = (skipApply ? $$q : $q).defer(),
+ promise = deferred.promise,
+ timeoutId;
+
+ timeoutId = $browser.defer(function() {
+ try {
+ deferred.resolve(fn.apply(null, args));
+ } catch (e) {
+ deferred.reject(e);
+ $exceptionHandler(e);
+ }
+ finally {
+ delete deferreds[promise.$$timeoutId];
+ }
+
+ if (!skipApply) $rootScope.$apply();
+ }, delay);
+
+ promise.$$timeoutId = timeoutId;
+ deferreds[timeoutId] = deferred;
+
+ return promise;
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $timeout#cancel
+ *
+ * @description
+ * Cancels a task associated with the `promise`. As a result of this, the promise will be
+ * resolved with a rejection.
+ *
+ * @param {Promise=} promise Promise returned by the `$timeout` function.
+ * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
+ * canceled.
+ */
+ timeout.cancel = function(promise) {
+ if (promise && promise.$$timeoutId in deferreds) {
+ deferreds[promise.$$timeoutId].reject('canceled');
+ delete deferreds[promise.$$timeoutId];
+ return $browser.defer.cancel(promise.$$timeoutId);
+ }
+ return false;
+ };
+
+ return timeout;
+ }];
+}
+
+// NOTE: The usage of window and document instead of $window and $document here is
+// deliberate. This service depends on the specific behavior of anchor nodes created by the
+// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and
+// cause us to break tests. In addition, when the browser resolves a URL for XHR, it
+// doesn't know about mocked locations and resolves URLs to the real document - which is
+// exactly the behavior needed here. There is little value is mocking these out for this
+// service.
+var urlParsingNode = document.createElement("a");
+var originUrl = urlResolve(window.location.href);
+
+
+/**
+ *
+ * Implementation Notes for non-IE browsers
+ * ----------------------------------------
+ * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,
+ * results both in the normalizing and parsing of the URL. Normalizing means that a relative
+ * URL will be resolved into an absolute URL in the context of the application document.
+ * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related
+ * properties are all populated to reflect the normalized URL. This approach has wide
+ * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See
+ * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
+ *
+ * Implementation Notes for IE
+ * ---------------------------
+ * IE <= 10 normalizes the URL when assigned to the anchor node similar to the other
+ * browsers. However, the parsed components will not be set if the URL assigned did not specify
+ * them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We
+ * work around that by performing the parsing in a 2nd step by taking a previously normalized
+ * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the
+ * properties such as protocol, hostname, port, etc.
+ *
+ * References:
+ * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement
+ * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
+ * http://url.spec.whatwg.org/#urlutils
+ * https://github.com/angular/angular.js/pull/2902
+ * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
+ *
+ * @kind function
+ * @param {string} url The URL to be parsed.
+ * @description Normalizes and parses a URL.
+ * @returns {object} Returns the normalized URL as a dictionary.
+ *
+ * | member name | Description |
+ * |---------------|----------------|
+ * | href | A normalized version of the provided URL if it was not an absolute URL |
+ * | protocol | The protocol including the trailing colon |
+ * | host | The host and port (if the port is non-default) of the normalizedUrl |
+ * | search | The search params, minus the question mark |
+ * | hash | The hash string, minus the hash symbol
+ * | hostname | The hostname
+ * | port | The port, without ":"
+ * | pathname | The pathname, beginning with "/"
+ *
+ */
+function urlResolve(url) {
+ var href = url;
+
+ if (msie) {
+ // Normalize before parse. Refer Implementation Notes on why this is
+ // done in two steps on IE.
+ urlParsingNode.setAttribute("href", href);
+ href = urlParsingNode.href;
+ }
+
+ urlParsingNode.setAttribute('href', href);
+
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
+ return {
+ href: urlParsingNode.href,
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
+ host: urlParsingNode.host,
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
+ hostname: urlParsingNode.hostname,
+ port: urlParsingNode.port,
+ pathname: (urlParsingNode.pathname.charAt(0) === '/')
+ ? urlParsingNode.pathname
+ : '/' + urlParsingNode.pathname
+ };
+}
+
+/**
+ * Parse a request URL and determine whether this is a same-origin request as the application document.
+ *
+ * @param {string|object} requestUrl The url of the request as a string that will be resolved
+ * or a parsed URL object.
+ * @returns {boolean} Whether the request is for the same origin as the application document.
+ */
+function urlIsSameOrigin(requestUrl) {
+ var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;
+ return (parsed.protocol === originUrl.protocol &&
+ parsed.host === originUrl.host);
+}
+
+/**
+ * @ngdoc service
+ * @name $window
+ *
+ * @description
+ * A reference to the browser's `window` object. While `window`
+ * is globally available in JavaScript, it causes testability problems, because
+ * it is a global variable. In angular we always refer to it through the
+ * `$window` service, so it may be overridden, removed or mocked for testing.
+ *
+ * Expressions, like the one defined for the `ngClick` directive in the example
+ * below, are evaluated with respect to the current scope. Therefore, there is
+ * no risk of inadvertently coding in a dependency on a global value in such an
+ * expression.
+ *
+ * @example
+ <example module="windowExample">
+ <file name="index.html">
+ <script>
+ angular.module('windowExample', [])
+ .controller('ExampleController', ['$scope', '$window', function($scope, $window) {
+ $scope.greeting = 'Hello, World!';
+ $scope.doGreeting = function(greeting) {
+ $window.alert(greeting);
+ };
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <input type="text" ng-model="greeting" aria-label="greeting" />
+ <button ng-click="doGreeting(greeting)">ALERT</button>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should display the greeting in the input box', function() {
+ element(by.model('greeting')).sendKeys('Hello, E2E Tests');
+ // If we click the button it will block the test runner
+ // element(':button').click();
+ });
+ </file>
+ </example>
+ */
+function $WindowProvider() {
+ this.$get = valueFn(window);
+}
+
+/**
+ * @name $$cookieReader
+ * @requires $document
+ *
+ * @description
+ * This is a private service for reading cookies used by $http and ngCookies
+ *
+ * @return {Object} a key/value map of the current cookies
+ */
+function $$CookieReader($document) {
+ var rawDocument = $document[0] || {};
+ var lastCookies = {};
+ var lastCookieString = '';
+
+ function safeDecodeURIComponent(str) {
+ try {
+ return decodeURIComponent(str);
+ } catch (e) {
+ return str;
+ }
+ }
+
+ return function() {
+ var cookieArray, cookie, i, index, name;
+ var currentCookieString = rawDocument.cookie || '';
+
+ if (currentCookieString !== lastCookieString) {
+ lastCookieString = currentCookieString;
+ cookieArray = lastCookieString.split('; ');
+ lastCookies = {};
+
+ for (i = 0; i < cookieArray.length; i++) {
+ cookie = cookieArray[i];
+ index = cookie.indexOf('=');
+ if (index > 0) { //ignore nameless cookies
+ name = safeDecodeURIComponent(cookie.substring(0, index));
+ // the first value that is seen for a cookie is the most
+ // specific one. values for the same cookie name that
+ // follow are for less specific paths.
+ if (isUndefined(lastCookies[name])) {
+ lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1));
+ }
+ }
+ }
+ }
+ return lastCookies;
+ };
+}
+
+$$CookieReader.$inject = ['$document'];
+
+function $$CookieReaderProvider() {
+ this.$get = $$CookieReader;
+}
+
+/* global currencyFilter: true,
+ dateFilter: true,
+ filterFilter: true,
+ jsonFilter: true,
+ limitToFilter: true,
+ lowercaseFilter: true,
+ numberFilter: true,
+ orderByFilter: true,
+ uppercaseFilter: true,
+ */
+
+/**
+ * @ngdoc provider
+ * @name $filterProvider
+ * @description
+ *
+ * Filters are just functions which transform input to an output. However filters need to be
+ * Dependency Injected. To achieve this a filter definition consists of a factory function which is
+ * annotated with dependencies and is responsible for creating a filter function.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
+ * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
+ * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
+ * (`myapp_subsection_filterx`).
+ * </div>
+ *
+ * ```js
+ * // Filter registration
+ * function MyModule($provide, $filterProvider) {
+ * // create a service to demonstrate injection (not always needed)
+ * $provide.value('greet', function(name){
+ * return 'Hello ' + name + '!';
+ * });
+ *
+ * // register a filter factory which uses the
+ * // greet service to demonstrate DI.
+ * $filterProvider.register('greet', function(greet){
+ * // return the filter function which uses the greet service
+ * // to generate salutation
+ * return function(text) {
+ * // filters need to be forgiving so check input validity
+ * return text && greet(text) || text;
+ * };
+ * });
+ * }
+ * ```
+ *
+ * The filter function is registered with the `$injector` under the filter name suffix with
+ * `Filter`.
+ *
+ * ```js
+ * it('should be the same instance', inject(
+ * function($filterProvider) {
+ * $filterProvider.register('reverse', function(){
+ * return ...;
+ * });
+ * },
+ * function($filter, reverseFilter) {
+ * expect($filter('reverse')).toBe(reverseFilter);
+ * });
+ * ```
+ *
+ *
+ * For more information about how angular filters work, and how to create your own filters, see
+ * {@link guide/filter Filters} in the Angular Developer Guide.
+ */
+
+/**
+ * @ngdoc service
+ * @name $filter
+ * @kind function
+ * @description
+ * Filters are used for formatting data displayed to the user.
+ *
+ * The general syntax in templates is as follows:
+ *
+ * {{ expression [| filter_name[:parameter_value] ... ] }}
+ *
+ * @param {String} name Name of the filter function to retrieve
+ * @return {Function} the filter function
+ * @example
+ <example name="$filter" module="filterExample">
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <h3>{{ originalText }}</h3>
+ <h3>{{ filteredText }}</h3>
+ </div>
+ </file>
+
+ <file name="script.js">
+ angular.module('filterExample', [])
+ .controller('MainCtrl', function($scope, $filter) {
+ $scope.originalText = 'hello';
+ $scope.filteredText = $filter('uppercase')($scope.originalText);
+ });
+ </file>
+ </example>
+ */
+$FilterProvider.$inject = ['$provide'];
+function $FilterProvider($provide) {
+ var suffix = 'Filter';
+
+ /**
+ * @ngdoc method
+ * @name $filterProvider#register
+ * @param {string|Object} name Name of the filter function, or an object map of filters where
+ * the keys are the filter names and the values are the filter factories.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
+ * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
+ * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
+ * (`myapp_subsection_filterx`).
+ * </div>
+ * @param {Function} factory If the first argument was a string, a factory function for the filter to be registered.
+ * @returns {Object} Registered filter instance, or if a map of filters was provided then a map
+ * of the registered filter instances.
+ */
+ function register(name, factory) {
+ if (isObject(name)) {
+ var filters = {};
+ forEach(name, function(filter, key) {
+ filters[key] = register(key, filter);
+ });
+ return filters;
+ } else {
+ return $provide.factory(name + suffix, factory);
+ }
+ }
+ this.register = register;
+
+ this.$get = ['$injector', function($injector) {
+ return function(name) {
+ return $injector.get(name + suffix);
+ };
+ }];
+
+ ////////////////////////////////////////
+
+ /* global
+ currencyFilter: false,
+ dateFilter: false,
+ filterFilter: false,
+ jsonFilter: false,
+ limitToFilter: false,
+ lowercaseFilter: false,
+ numberFilter: false,
+ orderByFilter: false,
+ uppercaseFilter: false,
+ */
+
+ register('currency', currencyFilter);
+ register('date', dateFilter);
+ register('filter', filterFilter);
+ register('json', jsonFilter);
+ register('limitTo', limitToFilter);
+ register('lowercase', lowercaseFilter);
+ register('number', numberFilter);
+ register('orderBy', orderByFilter);
+ register('uppercase', uppercaseFilter);
+}
+
+/**
+ * @ngdoc filter
+ * @name filter
+ * @kind function
+ *
+ * @description
+ * Selects a subset of items from `array` and returns it as a new array.
+ *
+ * @param {Array} array The source array.
+ * @param {string|Object|function()} expression The predicate to be used for selecting items from
+ * `array`.
+ *
+ * Can be one of:
+ *
+ * - `string`: The string is used for matching against the contents of the `array`. All strings or
+ * objects with string properties in `array` that match this string will be returned. This also
+ * applies to nested object properties.
+ * The predicate can be negated by prefixing the string with `!`.
+ *
+ * - `Object`: A pattern object can be used to filter specific properties on objects contained
+ * by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items
+ * which have property `name` containing "M" and property `phone` containing "1". A special
+ * property name `$` can be used (as in `{$:"text"}`) to accept a match against any
+ * property of the object or its nested object properties. That's equivalent to the simple
+ * substring match with a `string` as described above. The predicate can be negated by prefixing
+ * the string with `!`.
+ * For example `{name: "!M"}` predicate will return an array of items which have property `name`
+ * not containing "M".
+ *
+ * Note that a named property will match properties on the same level only, while the special
+ * `$` property will match properties on the same level or deeper. E.g. an array item like
+ * `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but
+ * **will** be matched by `{$: 'John'}`.
+ *
+ * - `function(value, index, array)`: A predicate function can be used to write arbitrary filters.
+ * The function is called for each element of the array, with the element, its index, and
+ * the entire array itself as arguments.
+ *
+ * The final result is an array of those elements that the predicate returned true for.
+ *
+ * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in
+ * determining if the expected value (from the filter expression) and actual value (from
+ * the object in the array) should be considered a match.
+ *
+ * Can be one of:
+ *
+ * - `function(actual, expected)`:
+ * The function will be given the object value and the predicate value to compare and
+ * should return true if both values should be considered equal.
+ *
+ * - `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`.
+ * This is essentially strict comparison of expected and actual.
+ *
+ * - `false|undefined`: A short hand for a function which will look for a substring match in case
+ * insensitive way.
+ *
+ * Primitive values are converted to strings. Objects are not compared against primitives,
+ * unless they have a custom `toString` method (e.g. `Date` objects).
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <div ng-init="friends = [{name:'John', phone:'555-1276'},
+ {name:'Mary', phone:'800-BIG-MARY'},
+ {name:'Mike', phone:'555-4321'},
+ {name:'Adam', phone:'555-5678'},
+ {name:'Julie', phone:'555-8765'},
+ {name:'Juliette', phone:'555-5678'}]"></div>
+
+ <label>Search: <input ng-model="searchText"></label>
+ <table id="searchTextResults">
+ <tr><th>Name</th><th>Phone</th></tr>
+ <tr ng-repeat="friend in friends | filter:searchText">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ </tr>
+ </table>
+ <hr>
+ <label>Any: <input ng-model="search.$"></label> <br>
+ <label>Name only <input ng-model="search.name"></label><br>
+ <label>Phone only <input ng-model="search.phone"></label><br>
+ <label>Equality <input type="checkbox" ng-model="strict"></label><br>
+ <table id="searchObjResults">
+ <tr><th>Name</th><th>Phone</th></tr>
+ <tr ng-repeat="friendObj in friends | filter:search:strict">
+ <td>{{friendObj.name}}</td>
+ <td>{{friendObj.phone}}</td>
+ </tr>
+ </table>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var expectFriendNames = function(expectedNames, key) {
+ element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) {
+ arr.forEach(function(wd, i) {
+ expect(wd.getText()).toMatch(expectedNames[i]);
+ });
+ });
+ };
+
+ it('should search across all fields when filtering with a string', function() {
+ var searchText = element(by.model('searchText'));
+ searchText.clear();
+ searchText.sendKeys('m');
+ expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend');
+
+ searchText.clear();
+ searchText.sendKeys('76');
+ expectFriendNames(['John', 'Julie'], 'friend');
+ });
+
+ it('should search in specific fields when filtering with a predicate object', function() {
+ var searchAny = element(by.model('search.$'));
+ searchAny.clear();
+ searchAny.sendKeys('i');
+ expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj');
+ });
+ it('should use a equal comparison when comparator is true', function() {
+ var searchName = element(by.model('search.name'));
+ var strict = element(by.model('strict'));
+ searchName.clear();
+ searchName.sendKeys('Julie');
+ strict.click();
+ expectFriendNames(['Julie'], 'friendObj');
+ });
+ </file>
+ </example>
+ */
+function filterFilter() {
+ return function(array, expression, comparator) {
+ if (!isArrayLike(array)) {
+ if (array == null) {
+ return array;
+ } else {
+ throw minErr('filter')('notarray', 'Expected array but received: {0}', array);
+ }
+ }
+
+ var expressionType = getTypeForFilter(expression);
+ var predicateFn;
+ var matchAgainstAnyProp;
+
+ switch (expressionType) {
+ case 'function':
+ predicateFn = expression;
+ break;
+ case 'boolean':
+ case 'null':
+ case 'number':
+ case 'string':
+ matchAgainstAnyProp = true;
+ //jshint -W086
+ case 'object':
+ //jshint +W086
+ predicateFn = createPredicateFn(expression, comparator, matchAgainstAnyProp);
+ break;
+ default:
+ return array;
+ }
+
+ return Array.prototype.filter.call(array, predicateFn);
+ };
+}
+
+// Helper functions for `filterFilter`
+function createPredicateFn(expression, comparator, matchAgainstAnyProp) {
+ var shouldMatchPrimitives = isObject(expression) && ('$' in expression);
+ var predicateFn;
+
+ if (comparator === true) {
+ comparator = equals;
+ } else if (!isFunction(comparator)) {
+ comparator = function(actual, expected) {
+ if (isUndefined(actual)) {
+ // No substring matching against `undefined`
+ return false;
+ }
+ if ((actual === null) || (expected === null)) {
+ // No substring matching against `null`; only match against `null`
+ return actual === expected;
+ }
+ if (isObject(expected) || (isObject(actual) && !hasCustomToString(actual))) {
+ // Should not compare primitives against objects, unless they have custom `toString` method
+ return false;
+ }
+
+ actual = lowercase('' + actual);
+ expected = lowercase('' + expected);
+ return actual.indexOf(expected) !== -1;
+ };
+ }
+
+ predicateFn = function(item) {
+ if (shouldMatchPrimitives && !isObject(item)) {
+ return deepCompare(item, expression.$, comparator, false);
+ }
+ return deepCompare(item, expression, comparator, matchAgainstAnyProp);
+ };
+
+ return predicateFn;
+}
+
+function deepCompare(actual, expected, comparator, matchAgainstAnyProp, dontMatchWholeObject) {
+ var actualType = getTypeForFilter(actual);
+ var expectedType = getTypeForFilter(expected);
+
+ if ((expectedType === 'string') && (expected.charAt(0) === '!')) {
+ return !deepCompare(actual, expected.substring(1), comparator, matchAgainstAnyProp);
+ } else if (isArray(actual)) {
+ // In case `actual` is an array, consider it a match
+ // if ANY of it's items matches `expected`
+ return actual.some(function(item) {
+ return deepCompare(item, expected, comparator, matchAgainstAnyProp);
+ });
+ }
+
+ switch (actualType) {
+ case 'object':
+ var key;
+ if (matchAgainstAnyProp) {
+ for (key in actual) {
+ if ((key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, true)) {
+ return true;
+ }
+ }
+ return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, false);
+ } else if (expectedType === 'object') {
+ for (key in expected) {
+ var expectedVal = expected[key];
+ if (isFunction(expectedVal) || isUndefined(expectedVal)) {
+ continue;
+ }
+
+ var matchAnyProperty = key === '$';
+ var actualVal = matchAnyProperty ? actual : actual[key];
+ if (!deepCompare(actualVal, expectedVal, comparator, matchAnyProperty, matchAnyProperty)) {
+ return false;
+ }
+ }
+ return true;
+ } else {
+ return comparator(actual, expected);
+ }
+ break;
+ case 'function':
+ return false;
+ default:
+ return comparator(actual, expected);
+ }
+}
+
+// Used for easily differentiating between `null` and actual `object`
+function getTypeForFilter(val) {
+ return (val === null) ? 'null' : typeof val;
+}
+
+var MAX_DIGITS = 22;
+var DECIMAL_SEP = '.';
+var ZERO_CHAR = '0';
+
+/**
+ * @ngdoc filter
+ * @name currency
+ * @kind function
+ *
+ * @description
+ * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default
+ * symbol for current locale is used.
+ *
+ * @param {number} amount Input to filter.
+ * @param {string=} symbol Currency symbol or identifier to be displayed.
+ * @param {number=} fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale
+ * @returns {string} Formatted number.
+ *
+ *
+ * @example
+ <example module="currencyExample">
+ <file name="index.html">
+ <script>
+ angular.module('currencyExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.amount = 1234.56;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <input type="number" ng-model="amount" aria-label="amount"> <br>
+ default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br>
+ custom currency identifier (USD$): <span id="currency-custom">{{amount | currency:"USD$"}}</span>
+ no fractions (0): <span id="currency-no-fractions">{{amount | currency:"USD$":0}}</span>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should init with 1234.56', function() {
+ expect(element(by.id('currency-default')).getText()).toBe('$1,234.56');
+ expect(element(by.id('currency-custom')).getText()).toBe('USD$1,234.56');
+ expect(element(by.id('currency-no-fractions')).getText()).toBe('USD$1,235');
+ });
+ it('should update', function() {
+ if (browser.params.browser == 'safari') {
+ // Safari does not understand the minus key. See
+ // https://github.com/angular/protractor/issues/481
+ return;
+ }
+ element(by.model('amount')).clear();
+ element(by.model('amount')).sendKeys('-1234');
+ expect(element(by.id('currency-default')).getText()).toBe('-$1,234.00');
+ expect(element(by.id('currency-custom')).getText()).toBe('-USD$1,234.00');
+ expect(element(by.id('currency-no-fractions')).getText()).toBe('-USD$1,234');
+ });
+ </file>
+ </example>
+ */
+currencyFilter.$inject = ['$locale'];
+function currencyFilter($locale) {
+ var formats = $locale.NUMBER_FORMATS;
+ return function(amount, currencySymbol, fractionSize) {
+ if (isUndefined(currencySymbol)) {
+ currencySymbol = formats.CURRENCY_SYM;
+ }
+
+ if (isUndefined(fractionSize)) {
+ fractionSize = formats.PATTERNS[1].maxFrac;
+ }
+
+ // if null or undefined pass it through
+ return (amount == null)
+ ? amount
+ : formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize).
+ replace(/\u00A4/g, currencySymbol);
+ };
+}
+
+/**
+ * @ngdoc filter
+ * @name number
+ * @kind function
+ *
+ * @description
+ * Formats a number as text.
+ *
+ * If the input is null or undefined, it will just be returned.
+ * If the input is infinite (Infinity/-Infinity) the Infinity symbol '∞' is returned.
+ * If the input is not a number an empty string is returned.
+ *
+ *
+ * @param {number|string} number Number to format.
+ * @param {(number|string)=} fractionSize Number of decimal places to round the number to.
+ * If this is not provided then the fraction size is computed from the current locale's number
+ * formatting pattern. In the case of the default locale, it will be 3.
+ * @returns {string} Number rounded to fractionSize and places a “,†after each third digit.
+ *
+ * @example
+ <example module="numberFilterExample">
+ <file name="index.html">
+ <script>
+ angular.module('numberFilterExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.val = 1234.56789;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>Enter number: <input ng-model='val'></label><br>
+ Default formatting: <span id='number-default'>{{val | number}}</span><br>
+ No fractions: <span>{{val | number:0}}</span><br>
+ Negative number: <span>{{-val | number:4}}</span>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should format numbers', function() {
+ expect(element(by.id('number-default')).getText()).toBe('1,234.568');
+ expect(element(by.binding('val | number:0')).getText()).toBe('1,235');
+ expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');
+ });
+
+ it('should update', function() {
+ element(by.model('val')).clear();
+ element(by.model('val')).sendKeys('3374.333');
+ expect(element(by.id('number-default')).getText()).toBe('3,374.333');
+ expect(element(by.binding('val | number:0')).getText()).toBe('3,374');
+ expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330');
+ });
+ </file>
+ </example>
+ */
+numberFilter.$inject = ['$locale'];
+function numberFilter($locale) {
+ var formats = $locale.NUMBER_FORMATS;
+ return function(number, fractionSize) {
+
+ // if null or undefined pass it through
+ return (number == null)
+ ? number
+ : formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,
+ fractionSize);
+ };
+}
+
+/**
+ * Parse a number (as a string) into three components that can be used
+ * for formatting the number.
+ *
+ * (Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/)
+ *
+ * @param {string} numStr The number to parse
+ * @return {object} An object describing this number, containing the following keys:
+ * - d : an array of digits containing leading zeros as necessary
+ * - i : the number of the digits in `d` that are to the left of the decimal point
+ * - e : the exponent for numbers that would need more than `MAX_DIGITS` digits in `d`
+ *
+ */
+function parse(numStr) {
+ var exponent = 0, digits, numberOfIntegerDigits;
+ var i, j, zeros;
+
+ // Decimal point?
+ if ((numberOfIntegerDigits = numStr.indexOf(DECIMAL_SEP)) > -1) {
+ numStr = numStr.replace(DECIMAL_SEP, '');
+ }
+
+ // Exponential form?
+ if ((i = numStr.search(/e/i)) > 0) {
+ // Work out the exponent.
+ if (numberOfIntegerDigits < 0) numberOfIntegerDigits = i;
+ numberOfIntegerDigits += +numStr.slice(i + 1);
+ numStr = numStr.substring(0, i);
+ } else if (numberOfIntegerDigits < 0) {
+ // There was no decimal point or exponent so it is an integer.
+ numberOfIntegerDigits = numStr.length;
+ }
+
+ // Count the number of leading zeros.
+ for (i = 0; numStr.charAt(i) == ZERO_CHAR; i++);
+
+ if (i == (zeros = numStr.length)) {
+ // The digits are all zero.
+ digits = [0];
+ numberOfIntegerDigits = 1;
+ } else {
+ // Count the number of trailing zeros
+ zeros--;
+ while (numStr.charAt(zeros) == ZERO_CHAR) zeros--;
+
+ // Trailing zeros are insignificant so ignore them
+ numberOfIntegerDigits -= i;
+ digits = [];
+ // Convert string to array of digits without leading/trailing zeros.
+ for (j = 0; i <= zeros; i++, j++) {
+ digits[j] = +numStr.charAt(i);
+ }
+ }
+
+ // If the number overflows the maximum allowed digits then use an exponent.
+ if (numberOfIntegerDigits > MAX_DIGITS) {
+ digits = digits.splice(0, MAX_DIGITS - 1);
+ exponent = numberOfIntegerDigits - 1;
+ numberOfIntegerDigits = 1;
+ }
+
+ return { d: digits, e: exponent, i: numberOfIntegerDigits };
+}
+
+/**
+ * Round the parsed number to the specified number of decimal places
+ * This function changed the parsedNumber in-place
+ */
+function roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) {
+ var digits = parsedNumber.d;
+ var fractionLen = digits.length - parsedNumber.i;
+
+ // determine fractionSize if it is not specified; `+fractionSize` converts it to a number
+ fractionSize = (isUndefined(fractionSize)) ? Math.min(Math.max(minFrac, fractionLen), maxFrac) : +fractionSize;
+
+ // The index of the digit to where rounding is to occur
+ var roundAt = fractionSize + parsedNumber.i;
+ var digit = digits[roundAt];
+
+ if (roundAt > 0) {
+ digits.splice(roundAt);
+ } else {
+ // We rounded to zero so reset the parsedNumber
+ parsedNumber.i = 1;
+ digits.length = roundAt = fractionSize + 1;
+ for (var i=0; i < roundAt; i++) digits[i] = 0;
+ }
+
+ if (digit >= 5) digits[roundAt - 1]++;
+
+ // Pad out with zeros to get the required fraction length
+ for (; fractionLen < fractionSize; fractionLen++) digits.push(0);
+
+
+ // Do any carrying, e.g. a digit was rounded up to 10
+ var carry = digits.reduceRight(function(carry, d, i, digits) {
+ d = d + carry;
+ digits[i] = d % 10;
+ return Math.floor(d / 10);
+ }, 0);
+ if (carry) {
+ digits.unshift(carry);
+ parsedNumber.i++;
+ }
+}
+
+/**
+ * Format a number into a string
+ * @param {number} number The number to format
+ * @param {{
+ * minFrac, // the minimum number of digits required in the fraction part of the number
+ * maxFrac, // the maximum number of digits required in the fraction part of the number
+ * gSize, // number of digits in each group of separated digits
+ * lgSize, // number of digits in the last group of digits before the decimal separator
+ * negPre, // the string to go in front of a negative number (e.g. `-` or `(`))
+ * posPre, // the string to go in front of a positive number
+ * negSuf, // the string to go after a negative number (e.g. `)`)
+ * posSuf // the string to go after a positive number
+ * }} pattern
+ * @param {string} groupSep The string to separate groups of number (e.g. `,`)
+ * @param {string} decimalSep The string to act as the decimal separator (e.g. `.`)
+ * @param {[type]} fractionSize The size of the fractional part of the number
+ * @return {string} The number formatted as a string
+ */
+function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
+
+ if (!(isString(number) || isNumber(number)) || isNaN(number)) return '';
+
+ var isInfinity = !isFinite(number);
+ var isZero = false;
+ var numStr = Math.abs(number) + '',
+ formattedText = '',
+ parsedNumber;
+
+ if (isInfinity) {
+ formattedText = '\u221e';
+ } else {
+ parsedNumber = parse(numStr);
+
+ roundNumber(parsedNumber, fractionSize, pattern.minFrac, pattern.maxFrac);
+
+ var digits = parsedNumber.d;
+ var integerLen = parsedNumber.i;
+ var exponent = parsedNumber.e;
+ var decimals = [];
+ isZero = digits.reduce(function(isZero, d) { return isZero && !d; }, true);
+
+ // pad zeros for small numbers
+ while (integerLen < 0) {
+ digits.unshift(0);
+ integerLen++;
+ }
+
+ // extract decimals digits
+ if (integerLen > 0) {
+ decimals = digits.splice(integerLen);
+ } else {
+ decimals = digits;
+ digits = [0];
+ }
+
+ // format the integer digits with grouping separators
+ var groups = [];
+ if (digits.length > pattern.lgSize) {
+ groups.unshift(digits.splice(-pattern.lgSize).join(''));
+ }
+ while (digits.length > pattern.gSize) {
+ groups.unshift(digits.splice(-pattern.gSize).join(''));
+ }
+ if (digits.length) {
+ groups.unshift(digits.join(''));
+ }
+ formattedText = groups.join(groupSep);
+
+ // append the decimal digits
+ if (decimals.length) {
+ formattedText += decimalSep + decimals.join('');
+ }
+
+ if (exponent) {
+ formattedText += 'e+' + exponent;
+ }
+ }
+ if (number < 0 && !isZero) {
+ return pattern.negPre + formattedText + pattern.negSuf;
+ } else {
+ return pattern.posPre + formattedText + pattern.posSuf;
+ }
+}
+
+function padNumber(num, digits, trim) {
+ var neg = '';
+ if (num < 0) {
+ neg = '-';
+ num = -num;
+ }
+ num = '' + num;
+ while (num.length < digits) num = ZERO_CHAR + num;
+ if (trim) {
+ num = num.substr(num.length - digits);
+ }
+ return neg + num;
+}
+
+
+function dateGetter(name, size, offset, trim) {
+ offset = offset || 0;
+ return function(date) {
+ var value = date['get' + name]();
+ if (offset > 0 || value > -offset) {
+ value += offset;
+ }
+ if (value === 0 && offset == -12) value = 12;
+ return padNumber(value, size, trim);
+ };
+}
+
+function dateStrGetter(name, shortForm) {
+ return function(date, formats) {
+ var value = date['get' + name]();
+ var get = uppercase(shortForm ? ('SHORT' + name) : name);
+
+ return formats[get][value];
+ };
+}
+
+function timeZoneGetter(date, formats, offset) {
+ var zone = -1 * offset;
+ var paddedZone = (zone >= 0) ? "+" : "";
+
+ paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
+ padNumber(Math.abs(zone % 60), 2);
+
+ return paddedZone;
+}
+
+function getFirstThursdayOfYear(year) {
+ // 0 = index of January
+ var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay();
+ // 4 = index of Thursday (+1 to account for 1st = 5)
+ // 11 = index of *next* Thursday (+1 account for 1st = 12)
+ return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst);
+}
+
+function getThursdayThisWeek(datetime) {
+ return new Date(datetime.getFullYear(), datetime.getMonth(),
+ // 4 = index of Thursday
+ datetime.getDate() + (4 - datetime.getDay()));
+}
+
+function weekGetter(size) {
+ return function(date) {
+ var firstThurs = getFirstThursdayOfYear(date.getFullYear()),
+ thisThurs = getThursdayThisWeek(date);
+
+ var diff = +thisThurs - +firstThurs,
+ result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week
+
+ return padNumber(result, size);
+ };
+}
+
+function ampmGetter(date, formats) {
+ return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];
+}
+
+function eraGetter(date, formats) {
+ return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1];
+}
+
+function longEraGetter(date, formats) {
+ return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1];
+}
+
+var DATE_FORMATS = {
+ yyyy: dateGetter('FullYear', 4),
+ yy: dateGetter('FullYear', 2, 0, true),
+ y: dateGetter('FullYear', 1),
+ MMMM: dateStrGetter('Month'),
+ MMM: dateStrGetter('Month', true),
+ MM: dateGetter('Month', 2, 1),
+ M: dateGetter('Month', 1, 1),
+ dd: dateGetter('Date', 2),
+ d: dateGetter('Date', 1),
+ HH: dateGetter('Hours', 2),
+ H: dateGetter('Hours', 1),
+ hh: dateGetter('Hours', 2, -12),
+ h: dateGetter('Hours', 1, -12),
+ mm: dateGetter('Minutes', 2),
+ m: dateGetter('Minutes', 1),
+ ss: dateGetter('Seconds', 2),
+ s: dateGetter('Seconds', 1),
+ // while ISO 8601 requires fractions to be prefixed with `.` or `,`
+ // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions
+ sss: dateGetter('Milliseconds', 3),
+ EEEE: dateStrGetter('Day'),
+ EEE: dateStrGetter('Day', true),
+ a: ampmGetter,
+ Z: timeZoneGetter,
+ ww: weekGetter(2),
+ w: weekGetter(1),
+ G: eraGetter,
+ GG: eraGetter,
+ GGG: eraGetter,
+ GGGG: longEraGetter
+};
+
+var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,
+ NUMBER_STRING = /^\-?\d+$/;
+
+/**
+ * @ngdoc filter
+ * @name date
+ * @kind function
+ *
+ * @description
+ * Formats `date` to a string based on the requested `format`.
+ *
+ * `format` string can be composed of the following elements:
+ *
+ * * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)
+ * * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
+ * * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)
+ * * `'MMMM'`: Month in year (January-December)
+ * * `'MMM'`: Month in year (Jan-Dec)
+ * * `'MM'`: Month in year, padded (01-12)
+ * * `'M'`: Month in year (1-12)
+ * * `'dd'`: Day in month, padded (01-31)
+ * * `'d'`: Day in month (1-31)
+ * * `'EEEE'`: Day in Week,(Sunday-Saturday)
+ * * `'EEE'`: Day in Week, (Sun-Sat)
+ * * `'HH'`: Hour in day, padded (00-23)
+ * * `'H'`: Hour in day (0-23)
+ * * `'hh'`: Hour in AM/PM, padded (01-12)
+ * * `'h'`: Hour in AM/PM, (1-12)
+ * * `'mm'`: Minute in hour, padded (00-59)
+ * * `'m'`: Minute in hour (0-59)
+ * * `'ss'`: Second in minute, padded (00-59)
+ * * `'s'`: Second in minute (0-59)
+ * * `'sss'`: Millisecond in second, padded (000-999)
+ * * `'a'`: AM/PM marker
+ * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)
+ * * `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year
+ * * `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year
+ * * `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD')
+ * * `'GGGG'`: The long form of the era string (e.g. 'Anno Domini')
+ *
+ * `format` string can also be one of the following predefined
+ * {@link guide/i18n localizable formats}:
+ *
+ * * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale
+ * (e.g. Sep 3, 2010 12:05:08 PM)
+ * * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 PM)
+ * * `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` for en_US locale
+ * (e.g. Friday, September 3, 2010)
+ * * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010)
+ * * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010)
+ * * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)
+ * * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 PM)
+ * * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 PM)
+ *
+ * `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g.
+ * `"h 'in the morning'"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence
+ * (e.g. `"h 'o''clock'"`).
+ *
+ * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
+ * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its
+ * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is
+ * specified in the string input, the time is considered to be in the local timezone.
+ * @param {string=} format Formatting rules (see Description). If not specified,
+ * `mediumDate` is used.
+ * @param {string=} timezone Timezone to be used for formatting. It understands UTC/GMT and the
+ * continental US time zone abbreviations, but for general use, use a time zone offset, for
+ * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
+ * If not specified, the timezone of the browser will be used.
+ * @returns {string} Formatted string or the input if input is not recognized as date/millis.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:
+ <span>{{1288323623006 | date:'medium'}}</span><br>
+ <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:
+ <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>
+ <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:
+ <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>
+ <span ng-non-bindable>{{1288323623006 | date:"MM/dd/yyyy 'at' h:mma"}}</span>:
+ <span>{{'1288323623006' | date:"MM/dd/yyyy 'at' h:mma"}}</span><br>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should format date', function() {
+ expect(element(by.binding("1288323623006 | date:'medium'")).getText()).
+ toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/);
+ expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()).
+ toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/);
+ expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()).
+ toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
+ expect(element(by.binding("'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"")).getText()).
+ toMatch(/10\/2\d\/2010 at \d{1,2}:\d{2}(AM|PM)/);
+ });
+ </file>
+ </example>
+ */
+dateFilter.$inject = ['$locale'];
+function dateFilter($locale) {
+
+
+ var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
+ // 1 2 3 4 5 6 7 8 9 10 11
+ function jsonStringToDate(string) {
+ var match;
+ if (match = string.match(R_ISO8601_STR)) {
+ var date = new Date(0),
+ tzHour = 0,
+ tzMin = 0,
+ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,
+ timeSetter = match[8] ? date.setUTCHours : date.setHours;
+
+ if (match[9]) {
+ tzHour = toInt(match[9] + match[10]);
+ tzMin = toInt(match[9] + match[11]);
+ }
+ dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3]));
+ var h = toInt(match[4] || 0) - tzHour;
+ var m = toInt(match[5] || 0) - tzMin;
+ var s = toInt(match[6] || 0);
+ var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
+ timeSetter.call(date, h, m, s, ms);
+ return date;
+ }
+ return string;
+ }
+
+
+ return function(date, format, timezone) {
+ var text = '',
+ parts = [],
+ fn, match;
+
+ format = format || 'mediumDate';
+ format = $locale.DATETIME_FORMATS[format] || format;
+ if (isString(date)) {
+ date = NUMBER_STRING.test(date) ? toInt(date) : jsonStringToDate(date);
+ }
+
+ if (isNumber(date)) {
+ date = new Date(date);
+ }
+
+ if (!isDate(date) || !isFinite(date.getTime())) {
+ return date;
+ }
+
+ while (format) {
+ match = DATE_FORMATS_SPLIT.exec(format);
+ if (match) {
+ parts = concat(parts, match, 1);
+ format = parts.pop();
+ } else {
+ parts.push(format);
+ format = null;
+ }
+ }
+
+ var dateTimezoneOffset = date.getTimezoneOffset();
+ if (timezone) {
+ dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
+ date = convertTimezoneToLocal(date, timezone, true);
+ }
+ forEach(parts, function(value) {
+ fn = DATE_FORMATS[value];
+ text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset)
+ : value === "''" ? "'" : value.replace(/(^'|'$)/g, '').replace(/''/g, "'");
+ });
+
+ return text;
+ };
+}
+
+
+/**
+ * @ngdoc filter
+ * @name json
+ * @kind function
+ *
+ * @description
+ * Allows you to convert a JavaScript object into JSON string.
+ *
+ * This filter is mostly useful for debugging. When using the double curly {{value}} notation
+ * the binding is automatically converted to JSON.
+ *
+ * @param {*} object Any JavaScript object (including arrays and primitive types) to filter.
+ * @param {number=} spacing The number of spaces to use per indentation, defaults to 2.
+ * @returns {string} JSON string.
+ *
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <pre id="default-spacing">{{ {'name':'value'} | json }}</pre>
+ <pre id="custom-spacing">{{ {'name':'value'} | json:4 }}</pre>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should jsonify filtered objects', function() {
+ expect(element(by.id('default-spacing')).getText()).toMatch(/\{\n "name": ?"value"\n}/);
+ expect(element(by.id('custom-spacing')).getText()).toMatch(/\{\n "name": ?"value"\n}/);
+ });
+ </file>
+ </example>
+ *
+ */
+function jsonFilter() {
+ return function(object, spacing) {
+ if (isUndefined(spacing)) {
+ spacing = 2;
+ }
+ return toJson(object, spacing);
+ };
+}
+
+
+/**
+ * @ngdoc filter
+ * @name lowercase
+ * @kind function
+ * @description
+ * Converts string to lowercase.
+ * @see angular.lowercase
+ */
+var lowercaseFilter = valueFn(lowercase);
+
+
+/**
+ * @ngdoc filter
+ * @name uppercase
+ * @kind function
+ * @description
+ * Converts string to uppercase.
+ * @see angular.uppercase
+ */
+var uppercaseFilter = valueFn(uppercase);
+
+/**
+ * @ngdoc filter
+ * @name limitTo
+ * @kind function
+ *
+ * @description
+ * Creates a new array or string containing only a specified number of elements. The elements
+ * are taken from either the beginning or the end of the source array, string or number, as specified by
+ * the value and sign (positive or negative) of `limit`. If a number is used as input, it is
+ * converted to a string.
+ *
+ * @param {Array|string|number} input Source array, string or number to be limited.
+ * @param {string|number} limit The length of the returned array or string. If the `limit` number
+ * is positive, `limit` number of items from the beginning of the source array/string are copied.
+ * If the number is negative, `limit` number of items from the end of the source array/string
+ * are copied. The `limit` will be trimmed if it exceeds `array.length`. If `limit` is undefined,
+ * the input will be returned unchanged.
+ * @param {(string|number)=} begin Index at which to begin limitation. As a negative index, `begin`
+ * indicates an offset from the end of `input`. Defaults to `0`.
+ * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array
+ * had less than `limit` elements.
+ *
+ * @example
+ <example module="limitToExample">
+ <file name="index.html">
+ <script>
+ angular.module('limitToExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.numbers = [1,2,3,4,5,6,7,8,9];
+ $scope.letters = "abcdefghi";
+ $scope.longNumber = 2345432342;
+ $scope.numLimit = 3;
+ $scope.letterLimit = 3;
+ $scope.longNumberLimit = 3;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>
+ Limit {{numbers}} to:
+ <input type="number" step="1" ng-model="numLimit">
+ </label>
+ <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>
+ <label>
+ Limit {{letters}} to:
+ <input type="number" step="1" ng-model="letterLimit">
+ </label>
+ <p>Output letters: {{ letters | limitTo:letterLimit }}</p>
+ <label>
+ Limit {{longNumber}} to:
+ <input type="number" step="1" ng-model="longNumberLimit">
+ </label>
+ <p>Output long number: {{ longNumber | limitTo:longNumberLimit }}</p>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var numLimitInput = element(by.model('numLimit'));
+ var letterLimitInput = element(by.model('letterLimit'));
+ var longNumberLimitInput = element(by.model('longNumberLimit'));
+ var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));
+ var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));
+ var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit'));
+
+ it('should limit the number array to first three items', function() {
+ expect(numLimitInput.getAttribute('value')).toBe('3');
+ expect(letterLimitInput.getAttribute('value')).toBe('3');
+ expect(longNumberLimitInput.getAttribute('value')).toBe('3');
+ expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');
+ expect(limitedLetters.getText()).toEqual('Output letters: abc');
+ expect(limitedLongNumber.getText()).toEqual('Output long number: 234');
+ });
+
+ // There is a bug in safari and protractor that doesn't like the minus key
+ // it('should update the output when -3 is entered', function() {
+ // numLimitInput.clear();
+ // numLimitInput.sendKeys('-3');
+ // letterLimitInput.clear();
+ // letterLimitInput.sendKeys('-3');
+ // longNumberLimitInput.clear();
+ // longNumberLimitInput.sendKeys('-3');
+ // expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');
+ // expect(limitedLetters.getText()).toEqual('Output letters: ghi');
+ // expect(limitedLongNumber.getText()).toEqual('Output long number: 342');
+ // });
+
+ it('should not exceed the maximum size of input array', function() {
+ numLimitInput.clear();
+ numLimitInput.sendKeys('100');
+ letterLimitInput.clear();
+ letterLimitInput.sendKeys('100');
+ longNumberLimitInput.clear();
+ longNumberLimitInput.sendKeys('100');
+ expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');
+ expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');
+ expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342');
+ });
+ </file>
+ </example>
+*/
+function limitToFilter() {
+ return function(input, limit, begin) {
+ if (Math.abs(Number(limit)) === Infinity) {
+ limit = Number(limit);
+ } else {
+ limit = toInt(limit);
+ }
+ if (isNaN(limit)) return input;
+
+ if (isNumber(input)) input = input.toString();
+ if (!isArray(input) && !isString(input)) return input;
+
+ begin = (!begin || isNaN(begin)) ? 0 : toInt(begin);
+ begin = (begin < 0) ? Math.max(0, input.length + begin) : begin;
+
+ if (limit >= 0) {
+ return input.slice(begin, begin + limit);
+ } else {
+ if (begin === 0) {
+ return input.slice(limit, input.length);
+ } else {
+ return input.slice(Math.max(0, begin + limit), begin);
+ }
+ }
+ };
+}
+
+/**
+ * @ngdoc filter
+ * @name orderBy
+ * @kind function
+ *
+ * @description
+ * Orders a specified `array` by the `expression` predicate. It is ordered alphabetically
+ * for strings and numerically for numbers. Note: if you notice numbers are not being sorted
+ * as expected, make sure they are actually being saved as numbers and not strings.
+ * Array-like values (e.g. NodeLists, jQuery objects, TypedArrays, Strings, etc) are also supported.
+ *
+ * @param {Array} array The array (or array-like object) to sort.
+ * @param {function(*)|string|Array.<(function(*)|string)>=} expression A predicate to be
+ * used by the comparator to determine the order of elements.
+ *
+ * Can be one of:
+ *
+ * - `function`: Getter function. The result of this function will be sorted using the
+ * `<`, `===`, `>` operator.
+ * - `string`: An Angular expression. The result of this expression is used to compare elements
+ * (for example `name` to sort by a property called `name` or `name.substr(0, 3)` to sort by
+ * 3 first characters of a property called `name`). The result of a constant expression
+ * is interpreted as a property name to be used in comparisons (for example `"special name"`
+ * to sort object by the value of their `special name` property). An expression can be
+ * optionally prefixed with `+` or `-` to control ascending or descending sort order
+ * (for example, `+name` or `-name`). If no property is provided, (e.g. `'+'`) then the array
+ * element itself is used to compare where sorting.
+ * - `Array`: An array of function or string predicates. The first predicate in the array
+ * is used for sorting, but when two items are equivalent, the next predicate is used.
+ *
+ * If the predicate is missing or empty then it defaults to `'+'`.
+ *
+ * @param {boolean=} reverse Reverse the order of the array.
+ * @returns {Array} Sorted copy of the source array.
+ *
+ *
+ * @example
+ * The example below demonstrates a simple ngRepeat, where the data is sorted
+ * by age in descending order (predicate is set to `'-age'`).
+ * `reverse` is not set, which means it defaults to `false`.
+ <example module="orderByExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <table class="friend">
+ <tr>
+ <th>Name</th>
+ <th>Phone Number</th>
+ <th>Age</th>
+ </tr>
+ <tr ng-repeat="friend in friends | orderBy:'-age'">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ <td>{{friend.age}}</td>
+ </tr>
+ </table>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('orderByExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.friends =
+ [{name:'John', phone:'555-1212', age:10},
+ {name:'Mary', phone:'555-9876', age:19},
+ {name:'Mike', phone:'555-4321', age:21},
+ {name:'Adam', phone:'555-5678', age:35},
+ {name:'Julie', phone:'555-8765', age:29}];
+ }]);
+ </file>
+ </example>
+ *
+ * The predicate and reverse parameters can be controlled dynamically through scope properties,
+ * as shown in the next example.
+ * @example
+ <example module="orderByExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
+ <hr/>
+ <button ng-click="predicate=''">Set to unsorted</button>
+ <table class="friend">
+ <tr>
+ <th>
+ <button ng-click="order('name')">Name</button>
+ <span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
+ </th>
+ <th>
+ <button ng-click="order('phone')">Phone Number</button>
+ <span class="sortorder" ng-show="predicate === 'phone'" ng-class="{reverse:reverse}"></span>
+ </th>
+ <th>
+ <button ng-click="order('age')">Age</button>
+ <span class="sortorder" ng-show="predicate === 'age'" ng-class="{reverse:reverse}"></span>
+ </th>
+ </tr>
+ <tr ng-repeat="friend in friends | orderBy:predicate:reverse">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ <td>{{friend.age}}</td>
+ </tr>
+ </table>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('orderByExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.friends =
+ [{name:'John', phone:'555-1212', age:10},
+ {name:'Mary', phone:'555-9876', age:19},
+ {name:'Mike', phone:'555-4321', age:21},
+ {name:'Adam', phone:'555-5678', age:35},
+ {name:'Julie', phone:'555-8765', age:29}];
+ $scope.predicate = 'age';
+ $scope.reverse = true;
+ $scope.order = function(predicate) {
+ $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
+ $scope.predicate = predicate;
+ };
+ }]);
+ </file>
+ <file name="style.css">
+ .sortorder:after {
+ content: '\25b2';
+ }
+ .sortorder.reverse:after {
+ content: '\25bc';
+ }
+ </file>
+ </example>
+ *
+ * It's also possible to call the orderBy filter manually, by injecting `$filter`, retrieving the
+ * filter routine with `$filter('orderBy')`, and calling the returned filter routine with the
+ * desired parameters.
+ *
+ * Example:
+ *
+ * @example
+ <example module="orderByExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
+ <table class="friend">
+ <tr>
+ <th>
+ <button ng-click="order('name')">Name</button>
+ <span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
+ </th>
+ <th>
+ <button ng-click="order('phone')">Phone Number</button>
+ <span class="sortorder" ng-show="predicate === 'phone'" ng-class="{reverse:reverse}"></span>
+ </th>
+ <th>
+ <button ng-click="order('age')">Age</button>
+ <span class="sortorder" ng-show="predicate === 'age'" ng-class="{reverse:reverse}"></span>
+ </th>
+ </tr>
+ <tr ng-repeat="friend in friends">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ <td>{{friend.age}}</td>
+ </tr>
+ </table>
+ </div>
+ </file>
+
+ <file name="script.js">
+ angular.module('orderByExample', [])
+ .controller('ExampleController', ['$scope', '$filter', function($scope, $filter) {
+ var orderBy = $filter('orderBy');
+ $scope.friends = [
+ { name: 'John', phone: '555-1212', age: 10 },
+ { name: 'Mary', phone: '555-9876', age: 19 },
+ { name: 'Mike', phone: '555-4321', age: 21 },
+ { name: 'Adam', phone: '555-5678', age: 35 },
+ { name: 'Julie', phone: '555-8765', age: 29 }
+ ];
+ $scope.order = function(predicate) {
+ $scope.predicate = predicate;
+ $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
+ $scope.friends = orderBy($scope.friends, predicate, $scope.reverse);
+ };
+ $scope.order('age', true);
+ }]);
+ </file>
+
+ <file name="style.css">
+ .sortorder:after {
+ content: '\25b2';
+ }
+ .sortorder.reverse:after {
+ content: '\25bc';
+ }
+ </file>
+</example>
+ */
+orderByFilter.$inject = ['$parse'];
+function orderByFilter($parse) {
+ return function(array, sortPredicate, reverseOrder) {
+
+ if (array == null) return array;
+ if (!isArrayLike(array)) {
+ throw minErr('orderBy')('notarray', 'Expected array but received: {0}', array);
+ }
+
+ if (!isArray(sortPredicate)) { sortPredicate = [sortPredicate]; }
+ if (sortPredicate.length === 0) { sortPredicate = ['+']; }
+
+ var predicates = processPredicates(sortPredicate, reverseOrder);
+ // Add a predicate at the end that evaluates to the element index. This makes the
+ // sort stable as it works as a tie-breaker when all the input predicates cannot
+ // distinguish between two elements.
+ predicates.push({ get: function() { return {}; }, descending: reverseOrder ? -1 : 1});
+
+ // The next three lines are a version of a Swartzian Transform idiom from Perl
+ // (sometimes called the Decorate-Sort-Undecorate idiom)
+ // See https://en.wikipedia.org/wiki/Schwartzian_transform
+ var compareValues = Array.prototype.map.call(array, getComparisonObject);
+ compareValues.sort(doComparison);
+ array = compareValues.map(function(item) { return item.value; });
+
+ return array;
+
+ function getComparisonObject(value, index) {
+ return {
+ value: value,
+ predicateValues: predicates.map(function(predicate) {
+ return getPredicateValue(predicate.get(value), index);
+ })
+ };
+ }
+
+ function doComparison(v1, v2) {
+ var result = 0;
+ for (var index=0, length = predicates.length; index < length; ++index) {
+ result = compare(v1.predicateValues[index], v2.predicateValues[index]) * predicates[index].descending;
+ if (result) break;
+ }
+ return result;
+ }
+ };
+
+ function processPredicates(sortPredicate, reverseOrder) {
+ reverseOrder = reverseOrder ? -1 : 1;
+ return sortPredicate.map(function(predicate) {
+ var descending = 1, get = identity;
+
+ if (isFunction(predicate)) {
+ get = predicate;
+ } else if (isString(predicate)) {
+ if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {
+ descending = predicate.charAt(0) == '-' ? -1 : 1;
+ predicate = predicate.substring(1);
+ }
+ if (predicate !== '') {
+ get = $parse(predicate);
+ if (get.constant) {
+ var key = get();
+ get = function(value) { return value[key]; };
+ }
+ }
+ }
+ return { get: get, descending: descending * reverseOrder };
+ });
+ }
+
+ function isPrimitive(value) {
+ switch (typeof value) {
+ case 'number': /* falls through */
+ case 'boolean': /* falls through */
+ case 'string':
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ function objectValue(value, index) {
+ // If `valueOf` is a valid function use that
+ if (typeof value.valueOf === 'function') {
+ value = value.valueOf();
+ if (isPrimitive(value)) return value;
+ }
+ // If `toString` is a valid function and not the one from `Object.prototype` use that
+ if (hasCustomToString(value)) {
+ value = value.toString();
+ if (isPrimitive(value)) return value;
+ }
+ // We have a basic object so we use the position of the object in the collection
+ return index;
+ }
+
+ function getPredicateValue(value, index) {
+ var type = typeof value;
+ if (value === null) {
+ type = 'string';
+ value = 'null';
+ } else if (type === 'string') {
+ value = value.toLowerCase();
+ } else if (type === 'object') {
+ value = objectValue(value, index);
+ }
+ return { value: value, type: type };
+ }
+
+ function compare(v1, v2) {
+ var result = 0;
+ if (v1.type === v2.type) {
+ if (v1.value !== v2.value) {
+ result = v1.value < v2.value ? -1 : 1;
+ }
+ } else {
+ result = v1.type < v2.type ? -1 : 1;
+ }
+ return result;
+ }
+}
+
+function ngDirective(directive) {
+ if (isFunction(directive)) {
+ directive = {
+ link: directive
+ };
+ }
+ directive.restrict = directive.restrict || 'AC';
+ return valueFn(directive);
+}
+
+/**
+ * @ngdoc directive
+ * @name a
+ * @restrict E
+ *
+ * @description
+ * Modifies the default behavior of the html A tag so that the default action is prevented when
+ * the href attribute is empty.
+ *
+ * This change permits the easy creation of action links with the `ngClick` directive
+ * without changing the location or causing page reloads, e.g.:
+ * `<a href="" ng-click="list.addItem()">Add Item</a>`
+ */
+var htmlAnchorDirective = valueFn({
+ restrict: 'E',
+ compile: function(element, attr) {
+ if (!attr.href && !attr.xlinkHref) {
+ return function(scope, element) {
+ // If the linked element is not an anchor tag anymore, do nothing
+ if (element[0].nodeName.toLowerCase() !== 'a') return;
+
+ // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.
+ var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?
+ 'xlink:href' : 'href';
+ element.on('click', function(event) {
+ // if we have no href url, then don't navigate anywhere.
+ if (!element.attr(href)) {
+ event.preventDefault();
+ }
+ });
+ };
+ }
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngHref
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in an href attribute will
+ * make the link go to the wrong URL if the user clicks it before
+ * Angular has a chance to replace the `{{hash}}` markup with its
+ * value. Until Angular replaces the markup the link will be broken
+ * and will most likely return a 404 error. The `ngHref` directive
+ * solves this problem.
+ *
+ * The wrong way to write it:
+ * ```html
+ * <a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
+ * ```
+ *
+ * @element A
+ * @param {template} ngHref any string which can contain `{{}}` markup.
+ *
+ * @example
+ * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes
+ * in links and their different behaviors:
+ <example>
+ <file name="index.html">
+ <input ng-model="value" /><br />
+ <a id="link-1" href ng-click="value = 1">link 1</a> (link, don't reload)<br />
+ <a id="link-2" href="" ng-click="value = 2">link 2</a> (link, don't reload)<br />
+ <a id="link-3" ng-href="/{{'123'}}">link 3</a> (link, reload!)<br />
+ <a id="link-4" href="" name="xx" ng-click="value = 4">anchor</a> (link, don't reload)<br />
+ <a id="link-5" name="xxx" ng-click="value = 5">anchor</a> (no link)<br />
+ <a id="link-6" ng-href="{{value}}">link</a> (link, change location)
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should execute ng-click but not reload when href without value', function() {
+ element(by.id('link-1')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('1');
+ expect(element(by.id('link-1')).getAttribute('href')).toBe('');
+ });
+
+ it('should execute ng-click but not reload when href empty string', function() {
+ element(by.id('link-2')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('2');
+ expect(element(by.id('link-2')).getAttribute('href')).toBe('');
+ });
+
+ it('should execute ng-click and change url when ng-href specified', function() {
+ expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\/123$/);
+
+ element(by.id('link-3')).click();
+
+ // At this point, we navigate away from an Angular page, so we need
+ // to use browser.driver to get the base webdriver.
+
+ browser.wait(function() {
+ return browser.driver.getCurrentUrl().then(function(url) {
+ return url.match(/\/123$/);
+ });
+ }, 5000, 'page should navigate to /123');
+ });
+
+ it('should execute ng-click but not reload when href empty string and name specified', function() {
+ element(by.id('link-4')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('4');
+ expect(element(by.id('link-4')).getAttribute('href')).toBe('');
+ });
+
+ it('should execute ng-click but not reload when no href but name specified', function() {
+ element(by.id('link-5')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('5');
+ expect(element(by.id('link-5')).getAttribute('href')).toBe(null);
+ });
+
+ it('should only change url when only ng-href', function() {
+ element(by.model('value')).clear();
+ element(by.model('value')).sendKeys('6');
+ expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\/6$/);
+
+ element(by.id('link-6')).click();
+
+ // At this point, we navigate away from an Angular page, so we need
+ // to use browser.driver to get the base webdriver.
+ browser.wait(function() {
+ return browser.driver.getCurrentUrl().then(function(url) {
+ return url.match(/\/6$/);
+ });
+ }, 5000, 'page should navigate to /6');
+ });
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngSrc
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in a `src` attribute doesn't
+ * work right: The browser will fetch from the URL with the literal
+ * text `{{hash}}` until Angular replaces the expression inside
+ * `{{hash}}`. The `ngSrc` directive solves this problem.
+ *
+ * The buggy way to write it:
+ * ```html
+ * <img src="http://www.gravatar.com/avatar/{{hash}}" alt="Description"/>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <img ng-src="http://www.gravatar.com/avatar/{{hash}}" alt="Description" />
+ * ```
+ *
+ * @element IMG
+ * @param {template} ngSrc any string which can contain `{{}}` markup.
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngSrcset
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't
+ * work right: The browser will fetch from the URL with the literal
+ * text `{{hash}}` until Angular replaces the expression inside
+ * `{{hash}}`. The `ngSrcset` directive solves this problem.
+ *
+ * The buggy way to write it:
+ * ```html
+ * <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description"/>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description" />
+ * ```
+ *
+ * @element IMG
+ * @param {template} ngSrcset any string which can contain `{{}}` markup.
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngDisabled
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * This directive sets the `disabled` attribute on the element if the
+ * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `disabled`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Click me to toggle: <input type="checkbox" ng-model="checked"></label><br/>
+ <button ng-model="button" ng-disabled="checked">Button</button>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should toggle button', function() {
+ expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();
+ element(by.model('checked')).click();
+ expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element INPUT
+ * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy,
+ * then the `disabled` attribute will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngChecked
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ * Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.
+ *
+ * Note that this directive should not be used together with {@link ngModel `ngModel`},
+ * as this can lead to unexpected behavior.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `checked`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Check me to check both: <input type="checkbox" ng-model="master"></label><br/>
+ <input id="checkSlave" type="checkbox" ng-checked="master" aria-label="Slave input">
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check both checkBoxes', function() {
+ expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy();
+ element(by.model('master')).click();
+ expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element INPUT
+ * @param {expression} ngChecked If the {@link guide/expression expression} is truthy,
+ * then the `checked` attribute will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngReadonly
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * Sets the `readOnly` attribute on the element, if the expression inside `ngReadonly` is truthy.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `readOnly`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Check me to make text readonly: <input type="checkbox" ng-model="checked"></label><br/>
+ <input type="text" ng-readonly="checked" value="I'm Angular" aria-label="Readonly field" />
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should toggle readonly attr', function() {
+ expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeFalsy();
+ element(by.model('checked')).click();
+ expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element INPUT
+ * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy,
+ * then special attribute "readonly" will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngSelected
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `selected`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Check me to select: <input type="checkbox" ng-model="selected"></label><br/>
+ <select aria-label="ngSelected demo">
+ <option>Hello!</option>
+ <option id="greet" ng-selected="selected">Greetings!</option>
+ </select>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should select Greetings!', function() {
+ expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();
+ element(by.model('selected')).click();
+ expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element OPTION
+ * @param {expression} ngSelected If the {@link guide/expression expression} is truthy,
+ * then special attribute "selected" will be set on the element
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngOpen
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `open`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Check me check multiple: <input type="checkbox" ng-model="open"></label><br/>
+ <details id="details" ng-open="open">
+ <summary>Show/Hide me</summary>
+ </details>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should toggle open', function() {
+ expect(element(by.id('details')).getAttribute('open')).toBeFalsy();
+ element(by.model('open')).click();
+ expect(element(by.id('details')).getAttribute('open')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element DETAILS
+ * @param {expression} ngOpen If the {@link guide/expression expression} is truthy,
+ * then special attribute "open" will be set on the element
+ */
+
+var ngAttributeAliasDirectives = {};
+
+// boolean attrs are evaluated
+forEach(BOOLEAN_ATTR, function(propName, attrName) {
+ // binding to multiple is not supported
+ if (propName == "multiple") return;
+
+ function defaultLinkFn(scope, element, attr) {
+ scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
+ attr.$set(attrName, !!value);
+ });
+ }
+
+ var normalized = directiveNormalize('ng-' + attrName);
+ var linkFn = defaultLinkFn;
+
+ if (propName === 'checked') {
+ linkFn = function(scope, element, attr) {
+ // ensuring ngChecked doesn't interfere with ngModel when both are set on the same input
+ if (attr.ngModel !== attr[normalized]) {
+ defaultLinkFn(scope, element, attr);
+ }
+ };
+ }
+
+ ngAttributeAliasDirectives[normalized] = function() {
+ return {
+ restrict: 'A',
+ priority: 100,
+ link: linkFn
+ };
+ };
+});
+
+// aliased input attrs are evaluated
+forEach(ALIASED_ATTR, function(htmlAttr, ngAttr) {
+ ngAttributeAliasDirectives[ngAttr] = function() {
+ return {
+ priority: 100,
+ link: function(scope, element, attr) {
+ //special case ngPattern when a literal regular expression value
+ //is used as the expression (this way we don't have to watch anything).
+ if (ngAttr === "ngPattern" && attr.ngPattern.charAt(0) == "/") {
+ var match = attr.ngPattern.match(REGEX_STRING_REGEXP);
+ if (match) {
+ attr.$set("ngPattern", new RegExp(match[1], match[2]));
+ return;
+ }
+ }
+
+ scope.$watch(attr[ngAttr], function ngAttrAliasWatchAction(value) {
+ attr.$set(ngAttr, value);
+ });
+ }
+ };
+ };
+});
+
+// ng-src, ng-srcset, ng-href are interpolated
+forEach(['src', 'srcset', 'href'], function(attrName) {
+ var normalized = directiveNormalize('ng-' + attrName);
+ ngAttributeAliasDirectives[normalized] = function() {
+ return {
+ priority: 99, // it needs to run after the attributes are interpolated
+ link: function(scope, element, attr) {
+ var propName = attrName,
+ name = attrName;
+
+ if (attrName === 'href' &&
+ toString.call(element.prop('href')) === '[object SVGAnimatedString]') {
+ name = 'xlinkHref';
+ attr.$attr[name] = 'xlink:href';
+ propName = null;
+ }
+
+ attr.$observe(normalized, function(value) {
+ if (!value) {
+ if (attrName === 'href') {
+ attr.$set(name, null);
+ }
+ return;
+ }
+
+ attr.$set(name, value);
+
+ // on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist
+ // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need
+ // to set the property as well to achieve the desired effect.
+ // we use attr[attrName] value since $set can sanitize the url.
+ if (msie && propName) element.prop(propName, attr[name]);
+ });
+ }
+ };
+ };
+});
+
+/* global -nullFormCtrl, -SUBMITTED_CLASS, addSetValidityMethod: true
+ */
+var nullFormCtrl = {
+ $addControl: noop,
+ $$renameControl: nullFormRenameControl,
+ $removeControl: noop,
+ $setValidity: noop,
+ $setDirty: noop,
+ $setPristine: noop,
+ $setSubmitted: noop
+},
+SUBMITTED_CLASS = 'ng-submitted';
+
+function nullFormRenameControl(control, name) {
+ control.$name = name;
+}
+
+/**
+ * @ngdoc type
+ * @name form.FormController
+ *
+ * @property {boolean} $pristine True if user has not interacted with the form yet.
+ * @property {boolean} $dirty True if user has already interacted with the form.
+ * @property {boolean} $valid True if all of the containing forms and controls are valid.
+ * @property {boolean} $invalid True if at least one containing control or form is invalid.
+ * @property {boolean} $pending True if at least one containing control or form is pending.
+ * @property {boolean} $submitted True if user has submitted the form even if its invalid.
+ *
+ * @property {Object} $error Is an object hash, containing references to controls or
+ * forms with failing validators, where:
+ *
+ * - keys are validation tokens (error names),
+ * - values are arrays of controls or forms that have a failing validator for given error name.
+ *
+ * Built-in validation tokens:
+ *
+ * - `email`
+ * - `max`
+ * - `maxlength`
+ * - `min`
+ * - `minlength`
+ * - `number`
+ * - `pattern`
+ * - `required`
+ * - `url`
+ * - `date`
+ * - `datetimelocal`
+ * - `time`
+ * - `week`
+ * - `month`
+ *
+ * @description
+ * `FormController` keeps track of all its controls and nested forms as well as the state of them,
+ * such as being valid/invalid or dirty/pristine.
+ *
+ * Each {@link ng.directive:form form} directive creates an instance
+ * of `FormController`.
+ *
+ */
+//asks for $scope to fool the BC controller module
+FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate'];
+function FormController(element, attrs, $scope, $animate, $interpolate) {
+ var form = this,
+ controls = [];
+
+ // init state
+ form.$error = {};
+ form.$$success = {};
+ form.$pending = undefined;
+ form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope);
+ form.$dirty = false;
+ form.$pristine = true;
+ form.$valid = true;
+ form.$invalid = false;
+ form.$submitted = false;
+ form.$$parentForm = nullFormCtrl;
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$rollbackViewValue
+ *
+ * @description
+ * Rollback all form controls pending updates to the `$modelValue`.
+ *
+ * Updates may be pending by a debounced event or because the input is waiting for a some future
+ * event defined in `ng-model-options`. This method is typically needed by the reset button of
+ * a form that uses `ng-model-options` to pend updates.
+ */
+ form.$rollbackViewValue = function() {
+ forEach(controls, function(control) {
+ control.$rollbackViewValue();
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$commitViewValue
+ *
+ * @description
+ * Commit all form controls pending updates to the `$modelValue`.
+ *
+ * Updates may be pending by a debounced event or because the input is waiting for a some future
+ * event defined in `ng-model-options`. This method is rarely needed as `NgModelController`
+ * usually handles calling this in response to input events.
+ */
+ form.$commitViewValue = function() {
+ forEach(controls, function(control) {
+ control.$commitViewValue();
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$addControl
+ * @param {object} control control object, either a {@link form.FormController} or an
+ * {@link ngModel.NgModelController}
+ *
+ * @description
+ * Register a control with the form. Input elements using ngModelController do this automatically
+ * when they are linked.
+ *
+ * Note that the current state of the control will not be reflected on the new parent form. This
+ * is not an issue with normal use, as freshly compiled and linked controls are in a `$pristine`
+ * state.
+ *
+ * However, if the method is used programmatically, for example by adding dynamically created controls,
+ * or controls that have been previously removed without destroying their corresponding DOM element,
+ * it's the developers responsibility to make sure the current state propagates to the parent form.
+ *
+ * For example, if an input control is added that is already `$dirty` and has `$error` properties,
+ * calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form.
+ */
+ form.$addControl = function(control) {
+ // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored
+ // and not added to the scope. Now we throw an error.
+ assertNotHasOwnProperty(control.$name, 'input');
+ controls.push(control);
+
+ if (control.$name) {
+ form[control.$name] = control;
+ }
+
+ control.$$parentForm = form;
+ };
+
+ // Private API: rename a form control
+ form.$$renameControl = function(control, newName) {
+ var oldName = control.$name;
+
+ if (form[oldName] === control) {
+ delete form[oldName];
+ }
+ form[newName] = control;
+ control.$name = newName;
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$removeControl
+ * @param {object} control control object, either a {@link form.FormController} or an
+ * {@link ngModel.NgModelController}
+ *
+ * @description
+ * Deregister a control from the form.
+ *
+ * Input elements using ngModelController do this automatically when they are destroyed.
+ *
+ * Note that only the removed control's validation state (`$errors`etc.) will be removed from the
+ * form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be
+ * different from case to case. For example, removing the only `$dirty` control from a form may or
+ * may not mean that the form is still `$dirty`.
+ */
+ form.$removeControl = function(control) {
+ if (control.$name && form[control.$name] === control) {
+ delete form[control.$name];
+ }
+ forEach(form.$pending, function(value, name) {
+ form.$setValidity(name, null, control);
+ });
+ forEach(form.$error, function(value, name) {
+ form.$setValidity(name, null, control);
+ });
+ forEach(form.$$success, function(value, name) {
+ form.$setValidity(name, null, control);
+ });
+
+ arrayRemove(controls, control);
+ control.$$parentForm = nullFormCtrl;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setValidity
+ *
+ * @description
+ * Sets the validity of a form control.
+ *
+ * This method will also propagate to parent forms.
+ */
+ addSetValidityMethod({
+ ctrl: this,
+ $element: element,
+ set: function(object, property, controller) {
+ var list = object[property];
+ if (!list) {
+ object[property] = [controller];
+ } else {
+ var index = list.indexOf(controller);
+ if (index === -1) {
+ list.push(controller);
+ }
+ }
+ },
+ unset: function(object, property, controller) {
+ var list = object[property];
+ if (!list) {
+ return;
+ }
+ arrayRemove(list, controller);
+ if (list.length === 0) {
+ delete object[property];
+ }
+ },
+ $animate: $animate
+ });
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setDirty
+ *
+ * @description
+ * Sets the form to a dirty state.
+ *
+ * This method can be called to add the 'ng-dirty' class and set the form to a dirty
+ * state (ng-dirty class). This method will also propagate to parent forms.
+ */
+ form.$setDirty = function() {
+ $animate.removeClass(element, PRISTINE_CLASS);
+ $animate.addClass(element, DIRTY_CLASS);
+ form.$dirty = true;
+ form.$pristine = false;
+ form.$$parentForm.$setDirty();
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setPristine
+ *
+ * @description
+ * Sets the form to its pristine state.
+ *
+ * This method can be called to remove the 'ng-dirty' class and set the form to its pristine
+ * state (ng-pristine class). This method will also propagate to all the controls contained
+ * in this form.
+ *
+ * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after
+ * saving or resetting it.
+ */
+ form.$setPristine = function() {
+ $animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS);
+ form.$dirty = false;
+ form.$pristine = true;
+ form.$submitted = false;
+ forEach(controls, function(control) {
+ control.$setPristine();
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setUntouched
+ *
+ * @description
+ * Sets the form to its untouched state.
+ *
+ * This method can be called to remove the 'ng-touched' class and set the form controls to their
+ * untouched state (ng-untouched class).
+ *
+ * Setting a form controls back to their untouched state is often useful when setting the form
+ * back to its pristine state.
+ */
+ form.$setUntouched = function() {
+ forEach(controls, function(control) {
+ control.$setUntouched();
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setSubmitted
+ *
+ * @description
+ * Sets the form to its submitted state.
+ */
+ form.$setSubmitted = function() {
+ $animate.addClass(element, SUBMITTED_CLASS);
+ form.$submitted = true;
+ form.$$parentForm.$setSubmitted();
+ };
+}
+
+/**
+ * @ngdoc directive
+ * @name ngForm
+ * @restrict EAC
+ *
+ * @description
+ * Nestable alias of {@link ng.directive:form `form`} directive. HTML
+ * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a
+ * sub-group of controls needs to be determined.
+ *
+ * Note: the purpose of `ngForm` is to group controls,
+ * but not to be a replacement for the `<form>` tag with all of its capabilities
+ * (e.g. posting to the server, ...).
+ *
+ * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into
+ * related scope, under this name.
+ *
+ */
+
+ /**
+ * @ngdoc directive
+ * @name form
+ * @restrict E
+ *
+ * @description
+ * Directive that instantiates
+ * {@link form.FormController FormController}.
+ *
+ * If the `name` attribute is specified, the form controller is published onto the current scope under
+ * this name.
+ *
+ * # Alias: {@link ng.directive:ngForm `ngForm`}
+ *
+ * In Angular, forms can be nested. This means that the outer form is valid when all of the child
+ * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so
+ * Angular provides the {@link ng.directive:ngForm `ngForm`} directive, which behaves identically to
+ * `form` but can be nested. Nested forms can be useful, for example, if the validity of a sub-group
+ * of controls needs to be determined.
+ *
+ * # CSS classes
+ * - `ng-valid` is set if the form is valid.
+ * - `ng-invalid` is set if the form is invalid.
+ * - `ng-pending` is set if the form is pending.
+ * - `ng-pristine` is set if the form is pristine.
+ * - `ng-dirty` is set if the form is dirty.
+ * - `ng-submitted` is set if the form was submitted.
+ *
+ * Keep in mind that ngAnimate can detect each of these classes when added and removed.
+ *
+ *
+ * # Submitting a form and preventing the default action
+ *
+ * Since the role of forms in client-side Angular applications is different than in classical
+ * roundtrip apps, it is desirable for the browser not to translate the form submission into a full
+ * page reload that sends the data to the server. Instead some javascript logic should be triggered
+ * to handle the form submission in an application-specific way.
+ *
+ * For this reason, Angular prevents the default action (form submission to the server) unless the
+ * `<form>` element has an `action` attribute specified.
+ *
+ * You can use one of the following two ways to specify what javascript method should be called when
+ * a form is submitted:
+ *
+ * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element
+ * - {@link ng.directive:ngClick ngClick} directive on the first
+ * button or input field of type submit (input[type=submit])
+ *
+ * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}
+ * or {@link ng.directive:ngClick ngClick} directives.
+ * This is because of the following form submission rules in the HTML specification:
+ *
+ * - If a form has only one input field then hitting enter in this field triggers form submit
+ * (`ngSubmit`)
+ * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter
+ * doesn't trigger submit
+ * - if a form has one or more input fields and one or more buttons or input[type=submit] then
+ * hitting enter in any of the input fields will trigger the click handler on the *first* button or
+ * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)
+ *
+ * Any pending `ngModelOptions` changes will take place immediately when an enclosing form is
+ * submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`
+ * to have access to the updated model.
+ *
+ * ## Animation Hooks
+ *
+ * Animations in ngForm are triggered when any of the associated CSS classes are added and removed.
+ * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any
+ * other validations that are performed within the form. Animations in ngForm are similar to how
+ * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well
+ * as JS animations.
+ *
+ * The following example shows a simple way to utilize CSS transitions to style a form element
+ * that has been rendered as invalid after it has been validated:
+ *
+ * <pre>
+ * //be sure to include ngAnimate as a module to hook into more
+ * //advanced animations
+ * .my-form {
+ * transition:0.5s linear all;
+ * background: white;
+ * }
+ * .my-form.ng-invalid {
+ * background: red;
+ * color:white;
+ * }
+ * </pre>
+ *
+ * @example
+ <example deps="angular-animate.js" animations="true" fixBase="true" module="formExample">
+ <file name="index.html">
+ <script>
+ angular.module('formExample', [])
+ .controller('FormController', ['$scope', function($scope) {
+ $scope.userType = 'guest';
+ }]);
+ </script>
+ <style>
+ .my-form {
+ transition:all linear 0.5s;
+ background: transparent;
+ }
+ .my-form.ng-invalid {
+ background: red;
+ }
+ </style>
+ <form name="myForm" ng-controller="FormController" class="my-form">
+ userType: <input name="input" ng-model="userType" required>
+ <span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
+ <code>userType = {{userType}}</code><br>
+ <code>myForm.input.$valid = {{myForm.input.$valid}}</code><br>
+ <code>myForm.input.$error = {{myForm.input.$error}}</code><br>
+ <code>myForm.$valid = {{myForm.$valid}}</code><br>
+ <code>myForm.$error.required = {{!!myForm.$error.required}}</code><br>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should initialize to model', function() {
+ var userType = element(by.binding('userType'));
+ var valid = element(by.binding('myForm.input.$valid'));
+
+ expect(userType.getText()).toContain('guest');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ var userType = element(by.binding('userType'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var userInput = element(by.model('userType'));
+
+ userInput.clear();
+ userInput.sendKeys('');
+
+ expect(userType.getText()).toEqual('userType =');
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ *
+ * @param {string=} name Name of the form. If specified, the form controller will be published into
+ * related scope, under this name.
+ */
+var formDirectiveFactory = function(isNgForm) {
+ return ['$timeout', '$parse', function($timeout, $parse) {
+ var formDirective = {
+ name: 'form',
+ restrict: isNgForm ? 'EAC' : 'E',
+ require: ['form', '^^?form'], //first is the form's own ctrl, second is an optional parent form
+ controller: FormController,
+ compile: function ngFormCompile(formElement, attr) {
+ // Setup initial state of the control
+ formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS);
+
+ var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false);
+
+ return {
+ pre: function ngFormPreLink(scope, formElement, attr, ctrls) {
+ var controller = ctrls[0];
+
+ // if `action` attr is not present on the form, prevent the default action (submission)
+ if (!('action' in attr)) {
+ // we can't use jq events because if a form is destroyed during submission the default
+ // action is not prevented. see #1238
+ //
+ // IE 9 is not affected because it doesn't fire a submit event and try to do a full
+ // page reload if the form was destroyed by submission of the form via a click handler
+ // on a button in the form. Looks like an IE9 specific bug.
+ var handleFormSubmission = function(event) {
+ scope.$apply(function() {
+ controller.$commitViewValue();
+ controller.$setSubmitted();
+ });
+
+ event.preventDefault();
+ };
+
+ addEventListenerFn(formElement[0], 'submit', handleFormSubmission);
+
+ // unregister the preventDefault listener so that we don't not leak memory but in a
+ // way that will achieve the prevention of the default action.
+ formElement.on('$destroy', function() {
+ $timeout(function() {
+ removeEventListenerFn(formElement[0], 'submit', handleFormSubmission);
+ }, 0, false);
+ });
+ }
+
+ var parentFormCtrl = ctrls[1] || controller.$$parentForm;
+ parentFormCtrl.$addControl(controller);
+
+ var setter = nameAttr ? getSetter(controller.$name) : noop;
+
+ if (nameAttr) {
+ setter(scope, controller);
+ attr.$observe(nameAttr, function(newValue) {
+ if (controller.$name === newValue) return;
+ setter(scope, undefined);
+ controller.$$parentForm.$$renameControl(controller, newValue);
+ setter = getSetter(controller.$name);
+ setter(scope, controller);
+ });
+ }
+ formElement.on('$destroy', function() {
+ controller.$$parentForm.$removeControl(controller);
+ setter(scope, undefined);
+ extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
+ });
+ }
+ };
+ }
+ };
+
+ return formDirective;
+
+ function getSetter(expression) {
+ if (expression === '') {
+ //create an assignable expression, so forms with an empty name can be renamed later
+ return $parse('this[""]').assign;
+ }
+ return $parse(expression).assign || noop;
+ }
+ }];
+};
+
+var formDirective = formDirectiveFactory();
+var ngFormDirective = formDirectiveFactory(true);
+
+/* global VALID_CLASS: false,
+ INVALID_CLASS: false,
+ PRISTINE_CLASS: false,
+ DIRTY_CLASS: false,
+ UNTOUCHED_CLASS: false,
+ TOUCHED_CLASS: false,
+ ngModelMinErr: false,
+*/
+
+// Regex code is obtained from SO: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231
+var ISO_DATE_REGEXP = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/;
+// See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987)
+// Note: We are being more lenient, because browsers are too.
+// 1. Scheme
+// 2. Slashes
+// 3. Username
+// 4. Password
+// 5. Hostname
+// 6. Port
+// 7. Path
+// 8. Query
+// 9. Fragment
+// 1111111111111111 222 333333 44444 555555555555555555555555 666 77777777 8888888 999
+var URL_REGEXP = /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+\])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i;
+var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
+var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/;
+var DATE_REGEXP = /^(\d{4})-(\d{2})-(\d{2})$/;
+var DATETIMELOCAL_REGEXP = /^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/;
+var WEEK_REGEXP = /^(\d{4})-W(\d\d)$/;
+var MONTH_REGEXP = /^(\d{4})-(\d\d)$/;
+var TIME_REGEXP = /^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/;
+
+var inputType = {
+
+ /**
+ * @ngdoc input
+ * @name input[text]
+ *
+ * @description
+ * Standard HTML text input with angular data binding, inherited by most of the `input` elements.
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Adds `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+ * any length.
+ * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+ * that contains the regular expression body that will be converted to a regular expression
+ * as in the ngPattern directive.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ * does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ * This parameter is ignored for input[type=password] controls, which will never trim the
+ * input.
+ *
+ * @example
+ <example name="text-input-directive" module="textInputExample">
+ <file name="index.html">
+ <script>
+ angular.module('textInputExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.example = {
+ text: 'guest',
+ word: /^\s*\w*\s*$/
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>Single word:
+ <input type="text" name="input" ng-model="example.text"
+ ng-pattern="example.word" required ng-trim="false">
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.pattern">
+ Single word only!</span>
+ </div>
+ <tt>text = {{example.text}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var text = element(by.binding('example.text'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.text'));
+
+ it('should initialize to model', function() {
+ expect(text.getText()).toContain('guest');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+
+ expect(text.getText()).toEqual('text =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if multi word', function() {
+ input.clear();
+ input.sendKeys('hello world');
+
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'text': textInputType,
+
+ /**
+ * @ngdoc input
+ * @name input[date]
+ *
+ * @description
+ * Input with date validation and transformation. In browsers that do not yet support
+ * the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601
+ * date format (yyyy-MM-dd), for example: `2009-01-06`. Since many
+ * modern browsers do not yet support this input type, it is important to provide cues to users on the
+ * expected input format via a placeholder or label.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a
+ * valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute
+ * (e.g. `min="{{minDate | date:'yyyy-MM-dd'}}"`). Note that `min` will also add native HTML5
+ * constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be
+ * a valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute
+ * (e.g. `max="{{maxDate | date:'yyyy-MM-dd'}}"`). Note that `max` will also add native HTML5
+ * constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO date string
+ * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO date string
+ * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="date-input-directive" module="dateInputExample">
+ <file name="index.html">
+ <script>
+ angular.module('dateInputExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(2013, 9, 22)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label for="exampleInput">Pick a date in 2013:</label>
+ <input type="date" id="exampleInput" name="input" ng-model="example.value"
+ placeholder="yyyy-MM-dd" min="2013-01-01" max="2013-12-31" required />
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.date">
+ Not a valid date!</span>
+ </div>
+ <tt>value = {{example.value | date: "yyyy-MM-dd"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "yyyy-MM-dd"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (see https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('2013-10-22');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('2015-01-01');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'date': createDateInputType('date', DATE_REGEXP,
+ createDateParser(DATE_REGEXP, ['yyyy', 'MM', 'dd']),
+ 'yyyy-MM-dd'),
+
+ /**
+ * @ngdoc input
+ * @name input[datetime-local]
+ *
+ * @description
+ * Input with datetime validation and transformation. In browsers that do not yet support
+ * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+ * local datetime format (yyyy-MM-ddTHH:mm:ss), for example: `2010-12-28T14:57:00`.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation
+ * inside this attribute (e.g. `min="{{minDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`).
+ * Note that `min` will also add native HTML5 constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation
+ * inside this attribute (e.g. `max="{{maxDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`).
+ * Note that `max` will also add native HTML5 constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation error key to the Date / ISO datetime string
+ * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation error key to the Date / ISO datetime string
+ * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="datetimelocal-input-directive" module="dateExample">
+ <file name="index.html">
+ <script>
+ angular.module('dateExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(2010, 11, 28, 14, 57)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label for="exampleInput">Pick a date between in 2013:</label>
+ <input type="datetime-local" id="exampleInput" name="input" ng-model="example.value"
+ placeholder="yyyy-MM-ddTHH:mm:ss" min="2001-01-01T00:00:00" max="2013-12-31T00:00:00" required />
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.datetimelocal">
+ Not a valid date!</span>
+ </div>
+ <tt>value = {{example.value | date: "yyyy-MM-ddTHH:mm:ss"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "yyyy-MM-ddTHH:mm:ss"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('2010-12-28T14:57:00');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('2015-01-01T23:59:00');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'datetime-local': createDateInputType('datetimelocal', DATETIMELOCAL_REGEXP,
+ createDateParser(DATETIMELOCAL_REGEXP, ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss', 'sss']),
+ 'yyyy-MM-ddTHH:mm:ss.sss'),
+
+ /**
+ * @ngdoc input
+ * @name input[time]
+ *
+ * @description
+ * Input with time validation and transformation. In browsers that do not yet support
+ * the HTML5 time input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+ * local time format (HH:mm:ss), for example: `14:57:00`. Model must be a Date object. This binding will always output a
+ * Date object to the model of January 1, 1970, or local date `new Date(1970, 0, 1, HH, mm, ss)`.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this
+ * attribute (e.g. `min="{{minTime | date:'HH:mm:ss'}}"`). Note that `min` will also add
+ * native HTML5 constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this
+ * attribute (e.g. `max="{{maxTime | date:'HH:mm:ss'}}"`). Note that `max` will also add
+ * native HTML5 constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO time string the
+ * `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO time string the
+ * `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="time-input-directive" module="timeExample">
+ <file name="index.html">
+ <script>
+ angular.module('timeExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(1970, 0, 1, 14, 57, 0)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label for="exampleInput">Pick a between 8am and 5pm:</label>
+ <input type="time" id="exampleInput" name="input" ng-model="example.value"
+ placeholder="HH:mm:ss" min="08:00:00" max="17:00:00" required />
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.time">
+ Not a valid date!</span>
+ </div>
+ <tt>value = {{example.value | date: "HH:mm:ss"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "HH:mm:ss"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('14:57:00');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('23:59:00');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'time': createDateInputType('time', TIME_REGEXP,
+ createDateParser(TIME_REGEXP, ['HH', 'mm', 'ss', 'sss']),
+ 'HH:mm:ss.sss'),
+
+ /**
+ * @ngdoc input
+ * @name input[week]
+ *
+ * @description
+ * Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support
+ * the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+ * week format (yyyy-W##), for example: `2013-W02`.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this
+ * attribute (e.g. `min="{{minWeek | date:'yyyy-Www'}}"`). Note that `min` will also add
+ * native HTML5 constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this
+ * attribute (e.g. `max="{{maxWeek | date:'yyyy-Www'}}"`). Note that `max` will also add
+ * native HTML5 constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string
+ * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string
+ * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="week-input-directive" module="weekExample">
+ <file name="index.html">
+ <script>
+ angular.module('weekExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(2013, 0, 3)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label>Pick a date between in 2013:
+ <input id="exampleInput" type="week" name="input" ng-model="example.value"
+ placeholder="YYYY-W##" min="2012-W32"
+ max="2013-W52" required />
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.week">
+ Not a valid date!</span>
+ </div>
+ <tt>value = {{example.value | date: "yyyy-Www"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "yyyy-Www"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('2013-W01');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('2015-W01');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'week': createDateInputType('week', WEEK_REGEXP, weekParser, 'yyyy-Www'),
+
+ /**
+ * @ngdoc input
+ * @name input[month]
+ *
+ * @description
+ * Input with month validation and transformation. In browsers that do not yet support
+ * the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+ * month format (yyyy-MM), for example: `2009-01`.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ * If the model is not set to the first of the month, the next view to model update will set it
+ * to the first of the month.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this
+ * attribute (e.g. `min="{{minMonth | date:'yyyy-MM'}}"`). Note that `min` will also add
+ * native HTML5 constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this
+ * attribute (e.g. `max="{{maxMonth | date:'yyyy-MM'}}"`). Note that `max` will also add
+ * native HTML5 constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string
+ * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string
+ * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="month-input-directive" module="monthExample">
+ <file name="index.html">
+ <script>
+ angular.module('monthExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(2013, 9, 1)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label for="exampleInput">Pick a month in 2013:</label>
+ <input id="exampleInput" type="month" name="input" ng-model="example.value"
+ placeholder="yyyy-MM" min="2013-01" max="2013-12" required />
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.month">
+ Not a valid month!</span>
+ </div>
+ <tt>value = {{example.value | date: "yyyy-MM"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "yyyy-MM"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('2013-10');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('2015-01');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'month': createDateInputType('month', MONTH_REGEXP,
+ createDateParser(MONTH_REGEXP, ['yyyy', 'MM']),
+ 'yyyy-MM'),
+
+ /**
+ * @ngdoc input
+ * @name input[number]
+ *
+ * @description
+ * Text input with number validation and transformation. Sets the `number` validation
+ * error if not a valid number.
+ *
+ * <div class="alert alert-warning">
+ * The model must always be of type `number` otherwise Angular will throw an error.
+ * Be aware that a string containing a number is not enough. See the {@link ngModel:numfmt}
+ * error docs for more information and an example of how to convert your model if necessary.
+ * </div>
+ *
+ * ## Issues with HTML5 constraint validation
+ *
+ * In browsers that follow the
+ * [HTML5 specification](https://html.spec.whatwg.org/multipage/forms.html#number-state-%28type=number%29),
+ * `input[number]` does not work as expected with {@link ngModelOptions `ngModelOptions.allowInvalid`}.
+ * If a non-number is entered in the input, the browser will report the value as an empty string,
+ * which means the view / model values in `ngModel` and subsequently the scope value
+ * will also be an empty string.
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+ * any length.
+ * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+ * that contains the regular expression body that will be converted to a regular expression
+ * as in the ngPattern directive.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ * does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="number-input-directive" module="numberExample">
+ <file name="index.html">
+ <script>
+ angular.module('numberExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.example = {
+ value: 12
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>Number:
+ <input type="number" name="input" ng-model="example.value"
+ min="0" max="99" required>
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.number">
+ Not valid number!</span>
+ </div>
+ <tt>value = {{example.value}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('12');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if over max', function() {
+ input.clear();
+ input.sendKeys('123');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'number': numberInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[url]
+ *
+ * @description
+ * Text input with URL validation. Sets the `url` validation error key if the content is not a
+ * valid URL.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** `input[url]` uses a regex to validate urls that is derived from the regex
+ * used in Chromium. If you need stricter validation, you can use `ng-pattern` or modify
+ * the built-in validators (see the {@link guide/forms Forms guide})
+ * </div>
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+ * any length.
+ * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+ * that contains the regular expression body that will be converted to a regular expression
+ * as in the ngPattern directive.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ * does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="url-input-directive" module="urlExample">
+ <file name="index.html">
+ <script>
+ angular.module('urlExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.url = {
+ text: 'http://google.com'
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>URL:
+ <input type="url" name="input" ng-model="url.text" required>
+ <label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.url">
+ Not valid url!</span>
+ </div>
+ <tt>text = {{url.text}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var text = element(by.binding('url.text'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('url.text'));
+
+ it('should initialize to model', function() {
+ expect(text.getText()).toContain('http://google.com');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+
+ expect(text.getText()).toEqual('text =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if not url', function() {
+ input.clear();
+ input.sendKeys('box');
+
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'url': urlInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[email]
+ *
+ * @description
+ * Text input with email validation. Sets the `email` validation error key if not a valid email
+ * address.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex
+ * used in Chromium. If you need stricter validation (e.g. requiring a top-level domain), you can
+ * use `ng-pattern` or modify the built-in validators (see the {@link guide/forms Forms guide})
+ * </div>
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+ * any length.
+ * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+ * that contains the regular expression body that will be converted to a regular expression
+ * as in the ngPattern directive.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ * does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="email-input-directive" module="emailExample">
+ <file name="index.html">
+ <script>
+ angular.module('emailExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.email = {
+ text: 'me@example.com'
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>Email:
+ <input type="email" name="input" ng-model="email.text" required>
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.email">
+ Not valid email!</span>
+ </div>
+ <tt>text = {{email.text}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var text = element(by.binding('email.text'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('email.text'));
+
+ it('should initialize to model', function() {
+ expect(text.getText()).toContain('me@example.com');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+ expect(text.getText()).toEqual('text =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if not email', function() {
+ input.clear();
+ input.sendKeys('xxx');
+
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'email': emailInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[radio]
+ *
+ * @description
+ * HTML radio button.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string} value The value to which the `ngModel` expression should be set when selected.
+ * Note that `value` only supports `string` values, i.e. the scope model needs to be a string,
+ * too. Use `ngValue` if you need complex models (`number`, `object`, ...).
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {string} ngValue Angular expression to which `ngModel` will be be set when the radio
+ * is selected. Should be used instead of the `value` attribute if you need
+ * a non-string `ngModel` (`boolean`, `array`, ...).
+ *
+ * @example
+ <example name="radio-input-directive" module="radioExample">
+ <file name="index.html">
+ <script>
+ angular.module('radioExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.color = {
+ name: 'blue'
+ };
+ $scope.specialValue = {
+ "id": "12345",
+ "value": "green"
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>
+ <input type="radio" ng-model="color.name" value="red">
+ Red
+ </label><br/>
+ <label>
+ <input type="radio" ng-model="color.name" ng-value="specialValue">
+ Green
+ </label><br/>
+ <label>
+ <input type="radio" ng-model="color.name" value="blue">
+ Blue
+ </label><br/>
+ <tt>color = {{color.name | json}}</tt><br/>
+ </form>
+ Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`.
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should change state', function() {
+ var color = element(by.binding('color.name'));
+
+ expect(color.getText()).toContain('blue');
+
+ element.all(by.model('color.name')).get(0).click();
+
+ expect(color.getText()).toContain('red');
+ });
+ </file>
+ </example>
+ */
+ 'radio': radioInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[checkbox]
+ *
+ * @description
+ * HTML checkbox.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {expression=} ngTrueValue The value to which the expression should be set when selected.
+ * @param {expression=} ngFalseValue The value to which the expression should be set when not selected.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="checkbox-input-directive" module="checkboxExample">
+ <file name="index.html">
+ <script>
+ angular.module('checkboxExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.checkboxModel = {
+ value1 : true,
+ value2 : 'YES'
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>Value1:
+ <input type="checkbox" ng-model="checkboxModel.value1">
+ </label><br/>
+ <label>Value2:
+ <input type="checkbox" ng-model="checkboxModel.value2"
+ ng-true-value="'YES'" ng-false-value="'NO'">
+ </label><br/>
+ <tt>value1 = {{checkboxModel.value1}}</tt><br/>
+ <tt>value2 = {{checkboxModel.value2}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should change state', function() {
+ var value1 = element(by.binding('checkboxModel.value1'));
+ var value2 = element(by.binding('checkboxModel.value2'));
+
+ expect(value1.getText()).toContain('true');
+ expect(value2.getText()).toContain('YES');
+
+ element(by.model('checkboxModel.value1')).click();
+ element(by.model('checkboxModel.value2')).click();
+
+ expect(value1.getText()).toContain('false');
+ expect(value2.getText()).toContain('NO');
+ });
+ </file>
+ </example>
+ */
+ 'checkbox': checkboxInputType,
+
+ 'hidden': noop,
+ 'button': noop,
+ 'submit': noop,
+ 'reset': noop,
+ 'file': noop
+};
+
+function stringBasedInputType(ctrl) {
+ ctrl.$formatters.push(function(value) {
+ return ctrl.$isEmpty(value) ? value : value.toString();
+ });
+}
+
+function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+ stringBasedInputType(ctrl);
+}
+
+function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ var type = lowercase(element[0].type);
+
+ // In composition mode, users are still inputing intermediate text buffer,
+ // hold the listener until composition is done.
+ // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent
+ if (!$sniffer.android) {
+ var composing = false;
+
+ element.on('compositionstart', function(data) {
+ composing = true;
+ });
+
+ element.on('compositionend', function() {
+ composing = false;
+ listener();
+ });
+ }
+
+ var listener = function(ev) {
+ if (timeout) {
+ $browser.defer.cancel(timeout);
+ timeout = null;
+ }
+ if (composing) return;
+ var value = element.val(),
+ event = ev && ev.type;
+
+ // By default we will trim the value
+ // If the attribute ng-trim exists we will avoid trimming
+ // If input type is 'password', the value is never trimmed
+ if (type !== 'password' && (!attr.ngTrim || attr.ngTrim !== 'false')) {
+ value = trim(value);
+ }
+
+ // If a control is suffering from bad input (due to native validators), browsers discard its
+ // value, so it may be necessary to revalidate (by calling $setViewValue again) even if the
+ // control's value is the same empty value twice in a row.
+ if (ctrl.$viewValue !== value || (value === '' && ctrl.$$hasNativeValidators)) {
+ ctrl.$setViewValue(value, event);
+ }
+ };
+
+ // if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the
+ // input event on backspace, delete or cut
+ if ($sniffer.hasEvent('input')) {
+ element.on('input', listener);
+ } else {
+ var timeout;
+
+ var deferListener = function(ev, input, origValue) {
+ if (!timeout) {
+ timeout = $browser.defer(function() {
+ timeout = null;
+ if (!input || input.value !== origValue) {
+ listener(ev);
+ }
+ });
+ }
+ };
+
+ element.on('keydown', function(event) {
+ var key = event.keyCode;
+
+ // ignore
+ // command modifiers arrows
+ if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;
+
+ deferListener(event, this, this.value);
+ });
+
+ // if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it
+ if ($sniffer.hasEvent('paste')) {
+ element.on('paste cut', deferListener);
+ }
+ }
+
+ // if user paste into input using mouse on older browser
+ // or form autocomplete on newer browser, we need "change" event to catch it
+ element.on('change', listener);
+
+ ctrl.$render = function() {
+ // Workaround for Firefox validation #12102.
+ var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue;
+ if (element.val() !== value) {
+ element.val(value);
+ }
+ };
+}
+
+function weekParser(isoWeek, existingDate) {
+ if (isDate(isoWeek)) {
+ return isoWeek;
+ }
+
+ if (isString(isoWeek)) {
+ WEEK_REGEXP.lastIndex = 0;
+ var parts = WEEK_REGEXP.exec(isoWeek);
+ if (parts) {
+ var year = +parts[1],
+ week = +parts[2],
+ hours = 0,
+ minutes = 0,
+ seconds = 0,
+ milliseconds = 0,
+ firstThurs = getFirstThursdayOfYear(year),
+ addDays = (week - 1) * 7;
+
+ if (existingDate) {
+ hours = existingDate.getHours();
+ minutes = existingDate.getMinutes();
+ seconds = existingDate.getSeconds();
+ milliseconds = existingDate.getMilliseconds();
+ }
+
+ return new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds);
+ }
+ }
+
+ return NaN;
+}
+
+function createDateParser(regexp, mapping) {
+ return function(iso, date) {
+ var parts, map;
+
+ if (isDate(iso)) {
+ return iso;
+ }
+
+ if (isString(iso)) {
+ // When a date is JSON'ified to wraps itself inside of an extra
+ // set of double quotes. This makes the date parsing code unable
+ // to match the date string and parse it as a date.
+ if (iso.charAt(0) == '"' && iso.charAt(iso.length - 1) == '"') {
+ iso = iso.substring(1, iso.length - 1);
+ }
+ if (ISO_DATE_REGEXP.test(iso)) {
+ return new Date(iso);
+ }
+ regexp.lastIndex = 0;
+ parts = regexp.exec(iso);
+
+ if (parts) {
+ parts.shift();
+ if (date) {
+ map = {
+ yyyy: date.getFullYear(),
+ MM: date.getMonth() + 1,
+ dd: date.getDate(),
+ HH: date.getHours(),
+ mm: date.getMinutes(),
+ ss: date.getSeconds(),
+ sss: date.getMilliseconds() / 1000
+ };
+ } else {
+ map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 };
+ }
+
+ forEach(parts, function(part, index) {
+ if (index < mapping.length) {
+ map[mapping[index]] = +part;
+ }
+ });
+ return new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, map.sss * 1000 || 0);
+ }
+ }
+
+ return NaN;
+ };
+}
+
+function createDateInputType(type, regexp, parseDate, format) {
+ return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter) {
+ badInputChecker(scope, element, attr, ctrl);
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+ var timezone = ctrl && ctrl.$options && ctrl.$options.timezone;
+ var previousDate;
+
+ ctrl.$$parserName = type;
+ ctrl.$parsers.push(function(value) {
+ if (ctrl.$isEmpty(value)) return null;
+ if (regexp.test(value)) {
+ // Note: We cannot read ctrl.$modelValue, as there might be a different
+ // parser/formatter in the processing chain so that the model
+ // contains some different data format!
+ var parsedDate = parseDate(value, previousDate);
+ if (timezone) {
+ parsedDate = convertTimezoneToLocal(parsedDate, timezone);
+ }
+ return parsedDate;
+ }
+ return undefined;
+ });
+
+ ctrl.$formatters.push(function(value) {
+ if (value && !isDate(value)) {
+ throw ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value);
+ }
+ if (isValidDate(value)) {
+ previousDate = value;
+ if (previousDate && timezone) {
+ previousDate = convertTimezoneToLocal(previousDate, timezone, true);
+ }
+ return $filter('date')(value, format, timezone);
+ } else {
+ previousDate = null;
+ return '';
+ }
+ });
+
+ if (isDefined(attr.min) || attr.ngMin) {
+ var minVal;
+ ctrl.$validators.min = function(value) {
+ return !isValidDate(value) || isUndefined(minVal) || parseDate(value) >= minVal;
+ };
+ attr.$observe('min', function(val) {
+ minVal = parseObservedDateValue(val);
+ ctrl.$validate();
+ });
+ }
+
+ if (isDefined(attr.max) || attr.ngMax) {
+ var maxVal;
+ ctrl.$validators.max = function(value) {
+ return !isValidDate(value) || isUndefined(maxVal) || parseDate(value) <= maxVal;
+ };
+ attr.$observe('max', function(val) {
+ maxVal = parseObservedDateValue(val);
+ ctrl.$validate();
+ });
+ }
+
+ function isValidDate(value) {
+ // Invalid Date: getTime() returns NaN
+ return value && !(value.getTime && value.getTime() !== value.getTime());
+ }
+
+ function parseObservedDateValue(val) {
+ return isDefined(val) && !isDate(val) ? parseDate(val) || undefined : val;
+ }
+ };
+}
+
+function badInputChecker(scope, element, attr, ctrl) {
+ var node = element[0];
+ var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity);
+ if (nativeValidation) {
+ ctrl.$parsers.push(function(value) {
+ var validity = element.prop(VALIDITY_STATE_PROPERTY) || {};
+ return validity.badInput || validity.typeMismatch ? undefined : value;
+ });
+ }
+}
+
+function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ badInputChecker(scope, element, attr, ctrl);
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+
+ ctrl.$$parserName = 'number';
+ ctrl.$parsers.push(function(value) {
+ if (ctrl.$isEmpty(value)) return null;
+ if (NUMBER_REGEXP.test(value)) return parseFloat(value);
+ return undefined;
+ });
+
+ ctrl.$formatters.push(function(value) {
+ if (!ctrl.$isEmpty(value)) {
+ if (!isNumber(value)) {
+ throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);
+ }
+ value = value.toString();
+ }
+ return value;
+ });
+
+ if (isDefined(attr.min) || attr.ngMin) {
+ var minVal;
+ ctrl.$validators.min = function(value) {
+ return ctrl.$isEmpty(value) || isUndefined(minVal) || value >= minVal;
+ };
+
+ attr.$observe('min', function(val) {
+ if (isDefined(val) && !isNumber(val)) {
+ val = parseFloat(val, 10);
+ }
+ minVal = isNumber(val) && !isNaN(val) ? val : undefined;
+ // TODO(matsko): implement validateLater to reduce number of validations
+ ctrl.$validate();
+ });
+ }
+
+ if (isDefined(attr.max) || attr.ngMax) {
+ var maxVal;
+ ctrl.$validators.max = function(value) {
+ return ctrl.$isEmpty(value) || isUndefined(maxVal) || value <= maxVal;
+ };
+
+ attr.$observe('max', function(val) {
+ if (isDefined(val) && !isNumber(val)) {
+ val = parseFloat(val, 10);
+ }
+ maxVal = isNumber(val) && !isNaN(val) ? val : undefined;
+ // TODO(matsko): implement validateLater to reduce number of validations
+ ctrl.$validate();
+ });
+ }
+}
+
+function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ // Note: no badInputChecker here by purpose as `url` is only a validation
+ // in browsers, i.e. we can always read out input.value even if it is not valid!
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+ stringBasedInputType(ctrl);
+
+ ctrl.$$parserName = 'url';
+ ctrl.$validators.url = function(modelValue, viewValue) {
+ var value = modelValue || viewValue;
+ return ctrl.$isEmpty(value) || URL_REGEXP.test(value);
+ };
+}
+
+function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ // Note: no badInputChecker here by purpose as `url` is only a validation
+ // in browsers, i.e. we can always read out input.value even if it is not valid!
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+ stringBasedInputType(ctrl);
+
+ ctrl.$$parserName = 'email';
+ ctrl.$validators.email = function(modelValue, viewValue) {
+ var value = modelValue || viewValue;
+ return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value);
+ };
+}
+
+function radioInputType(scope, element, attr, ctrl) {
+ // make the name unique, if not defined
+ if (isUndefined(attr.name)) {
+ element.attr('name', nextUid());
+ }
+
+ var listener = function(ev) {
+ if (element[0].checked) {
+ ctrl.$setViewValue(attr.value, ev && ev.type);
+ }
+ };
+
+ element.on('click', listener);
+
+ ctrl.$render = function() {
+ var value = attr.value;
+ element[0].checked = (value == ctrl.$viewValue);
+ };
+
+ attr.$observe('value', ctrl.$render);
+}
+
+function parseConstantExpr($parse, context, name, expression, fallback) {
+ var parseFn;
+ if (isDefined(expression)) {
+ parseFn = $parse(expression);
+ if (!parseFn.constant) {
+ throw ngModelMinErr('constexpr', 'Expected constant expression for `{0}`, but saw ' +
+ '`{1}`.', name, expression);
+ }
+ return parseFn(context);
+ }
+ return fallback;
+}
+
+function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
+ var trueValue = parseConstantExpr($parse, scope, 'ngTrueValue', attr.ngTrueValue, true);
+ var falseValue = parseConstantExpr($parse, scope, 'ngFalseValue', attr.ngFalseValue, false);
+
+ var listener = function(ev) {
+ ctrl.$setViewValue(element[0].checked, ev && ev.type);
+ };
+
+ element.on('click', listener);
+
+ ctrl.$render = function() {
+ element[0].checked = ctrl.$viewValue;
+ };
+
+ // Override the standard `$isEmpty` because the $viewValue of an empty checkbox is always set to `false`
+ // This is because of the parser below, which compares the `$modelValue` with `trueValue` to convert
+ // it to a boolean.
+ ctrl.$isEmpty = function(value) {
+ return value === false;
+ };
+
+ ctrl.$formatters.push(function(value) {
+ return equals(value, trueValue);
+ });
+
+ ctrl.$parsers.push(function(value) {
+ return value ? trueValue : falseValue;
+ });
+}
+
+
+/**
+ * @ngdoc directive
+ * @name textarea
+ * @restrict E
+ *
+ * @description
+ * HTML textarea element control with angular data-binding. The data-binding and validation
+ * properties of this element are exactly the same as those of the
+ * {@link ng.directive:input input element}.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any
+ * length.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ * does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name input
+ * @restrict E
+ *
+ * @description
+ * HTML input element control. When used together with {@link ngModel `ngModel`}, it provides data-binding,
+ * input state control, and validation.
+ * Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Not every feature offered is available for all input types.
+ * Specifically, data binding and event handling via `ng-model` is unsupported for `input[file]`.
+ * </div>
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {boolean=} ngRequired Sets `required` attribute if set to true
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any
+ * length.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ * value does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ * This parameter is ignored for input[type=password] controls, which will never trim the
+ * input.
+ *
+ * @example
+ <example name="input-directive" module="inputExample">
+ <file name="index.html">
+ <script>
+ angular.module('inputExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.user = {name: 'guest', last: 'visitor'};
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <form name="myForm">
+ <label>
+ User name:
+ <input type="text" name="userName" ng-model="user.name" required>
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.userName.$error.required">
+ Required!</span>
+ </div>
+ <label>
+ Last name:
+ <input type="text" name="lastName" ng-model="user.last"
+ ng-minlength="3" ng-maxlength="10">
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.lastName.$error.minlength">
+ Too short!</span>
+ <span class="error" ng-show="myForm.lastName.$error.maxlength">
+ Too long!</span>
+ </div>
+ </form>
+ <hr>
+ <tt>user = {{user}}</tt><br/>
+ <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br/>
+ <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br/>
+ <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br/>
+ <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br/>
+ <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br/>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var user = element(by.exactBinding('user'));
+ var userNameValid = element(by.binding('myForm.userName.$valid'));
+ var lastNameValid = element(by.binding('myForm.lastName.$valid'));
+ var lastNameError = element(by.binding('myForm.lastName.$error'));
+ var formValid = element(by.binding('myForm.$valid'));
+ var userNameInput = element(by.model('user.name'));
+ var userLastInput = element(by.model('user.last'));
+
+ it('should initialize to model', function() {
+ expect(user.getText()).toContain('{"name":"guest","last":"visitor"}');
+ expect(userNameValid.getText()).toContain('true');
+ expect(formValid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty when required', function() {
+ userNameInput.clear();
+ userNameInput.sendKeys('');
+
+ expect(user.getText()).toContain('{"last":"visitor"}');
+ expect(userNameValid.getText()).toContain('false');
+ expect(formValid.getText()).toContain('false');
+ });
+
+ it('should be valid if empty when min length is set', function() {
+ userLastInput.clear();
+ userLastInput.sendKeys('');
+
+ expect(user.getText()).toContain('{"name":"guest","last":""}');
+ expect(lastNameValid.getText()).toContain('true');
+ expect(formValid.getText()).toContain('true');
+ });
+
+ it('should be invalid if less than required min length', function() {
+ userLastInput.clear();
+ userLastInput.sendKeys('xx');
+
+ expect(user.getText()).toContain('{"name":"guest"}');
+ expect(lastNameValid.getText()).toContain('false');
+ expect(lastNameError.getText()).toContain('minlength');
+ expect(formValid.getText()).toContain('false');
+ });
+
+ it('should be invalid if longer than max length', function() {
+ userLastInput.clear();
+ userLastInput.sendKeys('some ridiculously long name');
+
+ expect(user.getText()).toContain('{"name":"guest"}');
+ expect(lastNameValid.getText()).toContain('false');
+ expect(lastNameError.getText()).toContain('maxlength');
+ expect(formValid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+var inputDirective = ['$browser', '$sniffer', '$filter', '$parse',
+ function($browser, $sniffer, $filter, $parse) {
+ return {
+ restrict: 'E',
+ require: ['?ngModel'],
+ link: {
+ pre: function(scope, element, attr, ctrls) {
+ if (ctrls[0]) {
+ (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrls[0], $sniffer,
+ $browser, $filter, $parse);
+ }
+ }
+ }
+ };
+}];
+
+
+
+var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
+/**
+ * @ngdoc directive
+ * @name ngValue
+ *
+ * @description
+ * Binds the given expression to the value of `<option>` or {@link input[radio] `input[radio]`},
+ * so that when the element is selected, the {@link ngModel `ngModel`} of that element is set to
+ * the bound value.
+ *
+ * `ngValue` is useful when dynamically generating lists of radio buttons using
+ * {@link ngRepeat `ngRepeat`}, as shown below.
+ *
+ * Likewise, `ngValue` can be used to generate `<option>` elements for
+ * the {@link select `select`} element. In that case however, only strings are supported
+ * for the `value `attribute, so the resulting `ngModel` will always be a string.
+ * Support for `select` models with non-string values is available via `ngOptions`.
+ *
+ * @element input
+ * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute
+ * of the `input` element
+ *
+ * @example
+ <example name="ngValue-directive" module="valueExample">
+ <file name="index.html">
+ <script>
+ angular.module('valueExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.names = ['pizza', 'unicorns', 'robots'];
+ $scope.my = { favorite: 'unicorns' };
+ }]);
+ </script>
+ <form ng-controller="ExampleController">
+ <h2>Which is your favorite?</h2>
+ <label ng-repeat="name in names" for="{{name}}">
+ {{name}}
+ <input type="radio"
+ ng-model="my.favorite"
+ ng-value="name"
+ id="{{name}}"
+ name="favorite">
+ </label>
+ <div>You chose {{my.favorite}}</div>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var favorite = element(by.binding('my.favorite'));
+
+ it('should initialize to model', function() {
+ expect(favorite.getText()).toContain('unicorns');
+ });
+ it('should bind the values to the inputs', function() {
+ element.all(by.model('my.favorite')).get(0).click();
+ expect(favorite.getText()).toContain('pizza');
+ });
+ </file>
+ </example>
+ */
+var ngValueDirective = function() {
+ return {
+ restrict: 'A',
+ priority: 100,
+ compile: function(tpl, tplAttr) {
+ if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {
+ return function ngValueConstantLink(scope, elm, attr) {
+ attr.$set('value', scope.$eval(attr.ngValue));
+ };
+ } else {
+ return function ngValueLink(scope, elm, attr) {
+ scope.$watch(attr.ngValue, function valueWatchAction(value) {
+ attr.$set('value', value);
+ });
+ };
+ }
+ }
+ };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngBind
+ * @restrict AC
+ *
+ * @description
+ * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element
+ * with the value of a given expression, and to update the text content when the value of that
+ * expression changes.
+ *
+ * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like
+ * `{{ expression }}` which is similar but less verbose.
+ *
+ * It is preferable to use `ngBind` instead of `{{ expression }}` if a template is momentarily
+ * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an
+ * element attribute, it makes the bindings invisible to the user while the page is loading.
+ *
+ * An alternative solution to this problem would be using the
+ * {@link ng.directive:ngCloak ngCloak} directive.
+ *
+ *
+ * @element ANY
+ * @param {expression} ngBind {@link guide/expression Expression} to evaluate.
+ *
+ * @example
+ * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
+ <example module="bindExample">
+ <file name="index.html">
+ <script>
+ angular.module('bindExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.name = 'Whirled';
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>Enter name: <input type="text" ng-model="name"></label><br>
+ Hello <span ng-bind="name"></span>!
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-bind', function() {
+ var nameInput = element(by.model('name'));
+
+ expect(element(by.binding('name')).getText()).toBe('Whirled');
+ nameInput.clear();
+ nameInput.sendKeys('world');
+ expect(element(by.binding('name')).getText()).toBe('world');
+ });
+ </file>
+ </example>
+ */
+var ngBindDirective = ['$compile', function($compile) {
+ return {
+ restrict: 'AC',
+ compile: function ngBindCompile(templateElement) {
+ $compile.$$addBindingClass(templateElement);
+ return function ngBindLink(scope, element, attr) {
+ $compile.$$addBindingInfo(element, attr.ngBind);
+ element = element[0];
+ scope.$watch(attr.ngBind, function ngBindWatchAction(value) {
+ element.textContent = isUndefined(value) ? '' : value;
+ });
+ };
+ }
+ };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngBindTemplate
+ *
+ * @description
+ * The `ngBindTemplate` directive specifies that the element
+ * text content should be replaced with the interpolation of the template
+ * in the `ngBindTemplate` attribute.
+ * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}`
+ * expressions. This directive is needed since some HTML elements
+ * (such as TITLE and OPTION) cannot contain SPAN elements.
+ *
+ * @element ANY
+ * @param {string} ngBindTemplate template of form
+ * <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.
+ *
+ * @example
+ * Try it here: enter text in text box and watch the greeting change.
+ <example module="bindExample">
+ <file name="index.html">
+ <script>
+ angular.module('bindExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.salutation = 'Hello';
+ $scope.name = 'World';
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>Salutation: <input type="text" ng-model="salutation"></label><br>
+ <label>Name: <input type="text" ng-model="name"></label><br>
+ <pre ng-bind-template="{{salutation}} {{name}}!"></pre>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-bind', function() {
+ var salutationElem = element(by.binding('salutation'));
+ var salutationInput = element(by.model('salutation'));
+ var nameInput = element(by.model('name'));
+
+ expect(salutationElem.getText()).toBe('Hello World!');
+
+ salutationInput.clear();
+ salutationInput.sendKeys('Greetings');
+ nameInput.clear();
+ nameInput.sendKeys('user');
+
+ expect(salutationElem.getText()).toBe('Greetings user!');
+ });
+ </file>
+ </example>
+ */
+var ngBindTemplateDirective = ['$interpolate', '$compile', function($interpolate, $compile) {
+ return {
+ compile: function ngBindTemplateCompile(templateElement) {
+ $compile.$$addBindingClass(templateElement);
+ return function ngBindTemplateLink(scope, element, attr) {
+ var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));
+ $compile.$$addBindingInfo(element, interpolateFn.expressions);
+ element = element[0];
+ attr.$observe('ngBindTemplate', function(value) {
+ element.textContent = isUndefined(value) ? '' : value;
+ });
+ };
+ }
+ };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngBindHtml
+ *
+ * @description
+ * Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default,
+ * the resulting HTML content will be sanitized using the {@link ngSanitize.$sanitize $sanitize} service.
+ * To utilize this functionality, ensure that `$sanitize` is available, for example, by including {@link
+ * ngSanitize} in your module's dependencies (not in core Angular). In order to use {@link ngSanitize}
+ * in your module's dependencies, you need to include "angular-sanitize.js" in your application.
+ *
+ * You may also bypass sanitization for values you know are safe. To do so, bind to
+ * an explicitly trusted value via {@link ng.$sce#trustAsHtml $sce.trustAsHtml}. See the example
+ * under {@link ng.$sce#show-me-an-example-using-sce- Strict Contextual Escaping (SCE)}.
+ *
+ * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you
+ * will have an exception (instead of an exploit.)
+ *
+ * @element ANY
+ * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.
+ *
+ * @example
+
+ <example module="bindHtmlExample" deps="angular-sanitize.js">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <p ng-bind-html="myHTML"></p>
+ </div>
+ </file>
+
+ <file name="script.js">
+ angular.module('bindHtmlExample', ['ngSanitize'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.myHTML =
+ 'I am an <code>HTML</code>string with ' +
+ '<a href="#">links!</a> and other <em>stuff</em>';
+ }]);
+ </file>
+
+ <file name="protractor.js" type="protractor">
+ it('should check ng-bind-html', function() {
+ expect(element(by.binding('myHTML')).getText()).toBe(
+ 'I am an HTMLstring with links! and other stuff');
+ });
+ </file>
+ </example>
+ */
+var ngBindHtmlDirective = ['$sce', '$parse', '$compile', function($sce, $parse, $compile) {
+ return {
+ restrict: 'A',
+ compile: function ngBindHtmlCompile(tElement, tAttrs) {
+ var ngBindHtmlGetter = $parse(tAttrs.ngBindHtml);
+ var ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, function getStringValue(value) {
+ return (value || '').toString();
+ });
+ $compile.$$addBindingClass(tElement);
+
+ return function ngBindHtmlLink(scope, element, attr) {
+ $compile.$$addBindingInfo(element, attr.ngBindHtml);
+
+ scope.$watch(ngBindHtmlWatch, function ngBindHtmlWatchAction() {
+ // we re-evaluate the expr because we want a TrustedValueHolderType
+ // for $sce, not a string
+ element.html($sce.getTrustedHtml(ngBindHtmlGetter(scope)) || '');
+ });
+ };
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngChange
+ *
+ * @description
+ * Evaluate the given expression when the user changes the input.
+ * The expression is evaluated immediately, unlike the JavaScript onchange event
+ * which only triggers at the end of a change (usually, when the user leaves the
+ * form element or presses the return key).
+ *
+ * The `ngChange` expression is only evaluated when a change in the input value causes
+ * a new value to be committed to the model.
+ *
+ * It will not be evaluated:
+ * * if the value returned from the `$parsers` transformation pipeline has not changed
+ * * if the input has continued to be invalid since the model will stay `null`
+ * * if the model is changed programmatically and not by a change to the input value
+ *
+ *
+ * Note, this directive requires `ngModel` to be present.
+ *
+ * @element input
+ * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change
+ * in input value.
+ *
+ * @example
+ * <example name="ngChange-directive" module="changeExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('changeExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.counter = 0;
+ * $scope.change = function() {
+ * $scope.counter++;
+ * };
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" />
+ * <input type="checkbox" ng-model="confirmed" id="ng-change-example2" />
+ * <label for="ng-change-example2">Confirmed</label><br />
+ * <tt>debug = {{confirmed}}</tt><br/>
+ * <tt>counter = {{counter}}</tt><br/>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * var counter = element(by.binding('counter'));
+ * var debug = element(by.binding('confirmed'));
+ *
+ * it('should evaluate the expression if changing from view', function() {
+ * expect(counter.getText()).toContain('0');
+ *
+ * element(by.id('ng-change-example1')).click();
+ *
+ * expect(counter.getText()).toContain('1');
+ * expect(debug.getText()).toContain('true');
+ * });
+ *
+ * it('should not evaluate the expression if changing from model', function() {
+ * element(by.id('ng-change-example2')).click();
+
+ * expect(counter.getText()).toContain('0');
+ * expect(debug.getText()).toContain('true');
+ * });
+ * </file>
+ * </example>
+ */
+var ngChangeDirective = valueFn({
+ restrict: 'A',
+ require: 'ngModel',
+ link: function(scope, element, attr, ctrl) {
+ ctrl.$viewChangeListeners.push(function() {
+ scope.$eval(attr.ngChange);
+ });
+ }
+});
+
+function classDirective(name, selector) {
+ name = 'ngClass' + name;
+ return ['$animate', function($animate) {
+ return {
+ restrict: 'AC',
+ link: function(scope, element, attr) {
+ var oldVal;
+
+ scope.$watch(attr[name], ngClassWatchAction, true);
+
+ attr.$observe('class', function(value) {
+ ngClassWatchAction(scope.$eval(attr[name]));
+ });
+
+
+ if (name !== 'ngClass') {
+ scope.$watch('$index', function($index, old$index) {
+ // jshint bitwise: false
+ var mod = $index & 1;
+ if (mod !== (old$index & 1)) {
+ var classes = arrayClasses(scope.$eval(attr[name]));
+ mod === selector ?
+ addClasses(classes) :
+ removeClasses(classes);
+ }
+ });
+ }
+
+ function addClasses(classes) {
+ var newClasses = digestClassCounts(classes, 1);
+ attr.$addClass(newClasses);
+ }
+
+ function removeClasses(classes) {
+ var newClasses = digestClassCounts(classes, -1);
+ attr.$removeClass(newClasses);
+ }
+
+ function digestClassCounts(classes, count) {
+ // Use createMap() to prevent class assumptions involving property
+ // names in Object.prototype
+ var classCounts = element.data('$classCounts') || createMap();
+ var classesToUpdate = [];
+ forEach(classes, function(className) {
+ if (count > 0 || classCounts[className]) {
+ classCounts[className] = (classCounts[className] || 0) + count;
+ if (classCounts[className] === +(count > 0)) {
+ classesToUpdate.push(className);
+ }
+ }
+ });
+ element.data('$classCounts', classCounts);
+ return classesToUpdate.join(' ');
+ }
+
+ function updateClasses(oldClasses, newClasses) {
+ var toAdd = arrayDifference(newClasses, oldClasses);
+ var toRemove = arrayDifference(oldClasses, newClasses);
+ toAdd = digestClassCounts(toAdd, 1);
+ toRemove = digestClassCounts(toRemove, -1);
+ if (toAdd && toAdd.length) {
+ $animate.addClass(element, toAdd);
+ }
+ if (toRemove && toRemove.length) {
+ $animate.removeClass(element, toRemove);
+ }
+ }
+
+ function ngClassWatchAction(newVal) {
+ if (selector === true || scope.$index % 2 === selector) {
+ var newClasses = arrayClasses(newVal || []);
+ if (!oldVal) {
+ addClasses(newClasses);
+ } else if (!equals(newVal,oldVal)) {
+ var oldClasses = arrayClasses(oldVal);
+ updateClasses(oldClasses, newClasses);
+ }
+ }
+ oldVal = shallowCopy(newVal);
+ }
+ }
+ };
+
+ function arrayDifference(tokens1, tokens2) {
+ var values = [];
+
+ outer:
+ for (var i = 0; i < tokens1.length; i++) {
+ var token = tokens1[i];
+ for (var j = 0; j < tokens2.length; j++) {
+ if (token == tokens2[j]) continue outer;
+ }
+ values.push(token);
+ }
+ return values;
+ }
+
+ function arrayClasses(classVal) {
+ var classes = [];
+ if (isArray(classVal)) {
+ forEach(classVal, function(v) {
+ classes = classes.concat(arrayClasses(v));
+ });
+ return classes;
+ } else if (isString(classVal)) {
+ return classVal.split(' ');
+ } else if (isObject(classVal)) {
+ forEach(classVal, function(v, k) {
+ if (v) {
+ classes = classes.concat(k.split(' '));
+ }
+ });
+ return classes;
+ }
+ return classVal;
+ }
+ }];
+}
+
+/**
+ * @ngdoc directive
+ * @name ngClass
+ * @restrict AC
+ *
+ * @description
+ * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding
+ * an expression that represents all classes to be added.
+ *
+ * The directive operates in three different ways, depending on which of three types the expression
+ * evaluates to:
+ *
+ * 1. If the expression evaluates to a string, the string should be one or more space-delimited class
+ * names.
+ *
+ * 2. If the expression evaluates to an object, then for each key-value pair of the
+ * object with a truthy value the corresponding key is used as a class name.
+ *
+ * 3. If the expression evaluates to an array, each element of the array should either be a string as in
+ * type 1 or an object as in type 2. This means that you can mix strings and objects together in an array
+ * to give you more control over what CSS classes appear. See the code below for an example of this.
+ *
+ *
+ * The directive won't add duplicate classes if a particular class was already set.
+ *
+ * When the expression changes, the previously added classes are removed and only then are the
+ * new classes added.
+ *
+ * @animations
+ * **add** - happens just before the class is applied to the elements
+ *
+ * **remove** - happens just before the class is removed from the element
+ *
+ * @element ANY
+ * @param {expression} ngClass {@link guide/expression Expression} to eval. The result
+ * of the evaluation can be a string representing space delimited class
+ * names, an array, or a map of class names to boolean values. In the case of a map, the
+ * names of the properties whose values are truthy will be added as css classes to the
+ * element.
+ *
+ * @example Example that demonstrates basic bindings via ngClass directive.
+ <example>
+ <file name="index.html">
+ <p ng-class="{strike: deleted, bold: important, 'has-error': error}">Map Syntax Example</p>
+ <label>
+ <input type="checkbox" ng-model="deleted">
+ deleted (apply "strike" class)
+ </label><br>
+ <label>
+ <input type="checkbox" ng-model="important">
+ important (apply "bold" class)
+ </label><br>
+ <label>
+ <input type="checkbox" ng-model="error">
+ error (apply "has-error" class)
+ </label>
+ <hr>
+ <p ng-class="style">Using String Syntax</p>
+ <input type="text" ng-model="style"
+ placeholder="Type: bold strike red" aria-label="Type: bold strike red">
+ <hr>
+ <p ng-class="[style1, style2, style3]">Using Array Syntax</p>
+ <input ng-model="style1"
+ placeholder="Type: bold, strike or red" aria-label="Type: bold, strike or red"><br>
+ <input ng-model="style2"
+ placeholder="Type: bold, strike or red" aria-label="Type: bold, strike or red 2"><br>
+ <input ng-model="style3"
+ placeholder="Type: bold, strike or red" aria-label="Type: bold, strike or red 3"><br>
+ <hr>
+ <p ng-class="[style4, {orange: warning}]">Using Array and Map Syntax</p>
+ <input ng-model="style4" placeholder="Type: bold, strike" aria-label="Type: bold, strike"><br>
+ <label><input type="checkbox" ng-model="warning"> warning (apply "orange" class)</label>
+ </file>
+ <file name="style.css">
+ .strike {
+ text-decoration: line-through;
+ }
+ .bold {
+ font-weight: bold;
+ }
+ .red {
+ color: red;
+ }
+ .has-error {
+ color: red;
+ background-color: yellow;
+ }
+ .orange {
+ color: orange;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var ps = element.all(by.css('p'));
+
+ it('should let you toggle the class', function() {
+
+ expect(ps.first().getAttribute('class')).not.toMatch(/bold/);
+ expect(ps.first().getAttribute('class')).not.toMatch(/has-error/);
+
+ element(by.model('important')).click();
+ expect(ps.first().getAttribute('class')).toMatch(/bold/);
+
+ element(by.model('error')).click();
+ expect(ps.first().getAttribute('class')).toMatch(/has-error/);
+ });
+
+ it('should let you toggle string example', function() {
+ expect(ps.get(1).getAttribute('class')).toBe('');
+ element(by.model('style')).clear();
+ element(by.model('style')).sendKeys('red');
+ expect(ps.get(1).getAttribute('class')).toBe('red');
+ });
+
+ it('array example should have 3 classes', function() {
+ expect(ps.get(2).getAttribute('class')).toBe('');
+ element(by.model('style1')).sendKeys('bold');
+ element(by.model('style2')).sendKeys('strike');
+ element(by.model('style3')).sendKeys('red');
+ expect(ps.get(2).getAttribute('class')).toBe('bold strike red');
+ });
+
+ it('array with map example should have 2 classes', function() {
+ expect(ps.last().getAttribute('class')).toBe('');
+ element(by.model('style4')).sendKeys('bold');
+ element(by.model('warning')).click();
+ expect(ps.last().getAttribute('class')).toBe('bold orange');
+ });
+ </file>
+ </example>
+
+ ## Animations
+
+ The example below demonstrates how to perform animations using ngClass.
+
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <input id="setbtn" type="button" value="set" ng-click="myVar='my-class'">
+ <input id="clearbtn" type="button" value="clear" ng-click="myVar=''">
+ <br>
+ <span class="base-class" ng-class="myVar">Sample Text</span>
+ </file>
+ <file name="style.css">
+ .base-class {
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+ }
+
+ .base-class.my-class {
+ color: red;
+ font-size:3em;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-class', function() {
+ expect(element(by.css('.base-class')).getAttribute('class')).not.
+ toMatch(/my-class/);
+
+ element(by.id('setbtn')).click();
+
+ expect(element(by.css('.base-class')).getAttribute('class')).
+ toMatch(/my-class/);
+
+ element(by.id('clearbtn')).click();
+
+ expect(element(by.css('.base-class')).getAttribute('class')).not.
+ toMatch(/my-class/);
+ });
+ </file>
+ </example>
+
+
+ ## ngClass and pre-existing CSS3 Transitions/Animations
+ The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.
+ Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder
+ any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure
+ to view the step by step details of {@link $animate#addClass $animate.addClass} and
+ {@link $animate#removeClass $animate.removeClass}.
+ */
+var ngClassDirective = classDirective('', true);
+
+/**
+ * @ngdoc directive
+ * @name ngClassOdd
+ * @restrict AC
+ *
+ * @description
+ * The `ngClassOdd` and `ngClassEven` directives work exactly as
+ * {@link ng.directive:ngClass ngClass}, except they work in
+ * conjunction with `ngRepeat` and take effect only on odd (even) rows.
+ *
+ * This directive can be applied only within the scope of an
+ * {@link ng.directive:ngRepeat ngRepeat}.
+ *
+ * @element ANY
+ * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result
+ * of the evaluation can be a string representing space delimited class names or an array.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
+ <li ng-repeat="name in names">
+ <span ng-class-odd="'odd'" ng-class-even="'even'">
+ {{name}}
+ </span>
+ </li>
+ </ol>
+ </file>
+ <file name="style.css">
+ .odd {
+ color: red;
+ }
+ .even {
+ color: blue;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-class-odd and ng-class-even', function() {
+ expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
+ toMatch(/odd/);
+ expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
+ toMatch(/even/);
+ });
+ </file>
+ </example>
+ */
+var ngClassOddDirective = classDirective('Odd', 0);
+
+/**
+ * @ngdoc directive
+ * @name ngClassEven
+ * @restrict AC
+ *
+ * @description
+ * The `ngClassOdd` and `ngClassEven` directives work exactly as
+ * {@link ng.directive:ngClass ngClass}, except they work in
+ * conjunction with `ngRepeat` and take effect only on odd (even) rows.
+ *
+ * This directive can be applied only within the scope of an
+ * {@link ng.directive:ngRepeat ngRepeat}.
+ *
+ * @element ANY
+ * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The
+ * result of the evaluation can be a string representing space delimited class names or an array.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
+ <li ng-repeat="name in names">
+ <span ng-class-odd="'odd'" ng-class-even="'even'">
+ {{name}} &nbsp; &nbsp; &nbsp;
+ </span>
+ </li>
+ </ol>
+ </file>
+ <file name="style.css">
+ .odd {
+ color: red;
+ }
+ .even {
+ color: blue;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-class-odd and ng-class-even', function() {
+ expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
+ toMatch(/odd/);
+ expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
+ toMatch(/even/);
+ });
+ </file>
+ </example>
+ */
+var ngClassEvenDirective = classDirective('Even', 1);
+
+/**
+ * @ngdoc directive
+ * @name ngCloak
+ * @restrict AC
+ *
+ * @description
+ * The `ngCloak` directive is used to prevent the Angular html template from being briefly
+ * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this
+ * directive to avoid the undesirable flicker effect caused by the html template display.
+ *
+ * The directive can be applied to the `<body>` element, but the preferred usage is to apply
+ * multiple `ngCloak` directives to small portions of the page to permit progressive rendering
+ * of the browser view.
+ *
+ * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and
+ * `angular.min.js`.
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```css
+ * [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
+ * display: none !important;
+ * }
+ * ```
+ *
+ * When this css rule is loaded by the browser, all html elements (including their children) that
+ * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive
+ * during the compilation of the template it deletes the `ngCloak` element attribute, making
+ * the compiled element visible.
+ *
+ * For the best result, the `angular.js` script must be loaded in the head section of the html
+ * document; alternatively, the css rule above must be included in the external stylesheet of the
+ * application.
+ *
+ * @element ANY
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <div id="template1" ng-cloak>{{ 'hello' }}</div>
+ <div id="template2" class="ng-cloak">{{ 'world' }}</div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should remove the template directive and css class', function() {
+ expect($('#template1').getAttribute('ng-cloak')).
+ toBeNull();
+ expect($('#template2').getAttribute('ng-cloak')).
+ toBeNull();
+ });
+ </file>
+ </example>
+ *
+ */
+var ngCloakDirective = ngDirective({
+ compile: function(element, attr) {
+ attr.$set('ngCloak', undefined);
+ element.removeClass('ng-cloak');
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngController
+ *
+ * @description
+ * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular
+ * supports the principles behind the Model-View-Controller design pattern.
+ *
+ * MVC components in angular:
+ *
+ * * Model — Models are the properties of a scope; scopes are attached to the DOM where scope properties
+ * are accessed through bindings.
+ * * View — The template (HTML with data bindings) that is rendered into the View.
+ * * Controller — The `ngController` directive specifies a Controller class; the class contains business
+ * logic behind the application to decorate the scope with functions and values
+ *
+ * Note that you can also attach controllers to the DOM by declaring it in a route definition
+ * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller
+ * again using `ng-controller` in the template itself. This will cause the controller to be attached
+ * and executed twice.
+ *
+ * @element ANY
+ * @scope
+ * @priority 500
+ * @param {expression} ngController Name of a constructor function registered with the current
+ * {@link ng.$controllerProvider $controllerProvider} or an {@link guide/expression expression}
+ * that on the current scope evaluates to a constructor function.
+ *
+ * The controller instance can be published into a scope property by specifying
+ * `ng-controller="as propertyName"`.
+ *
+ * If the current `$controllerProvider` is configured to use globals (via
+ * {@link ng.$controllerProvider#allowGlobals `$controllerProvider.allowGlobals()` }), this may
+ * also be the name of a globally accessible constructor function (not recommended).
+ *
+ * @example
+ * Here is a simple form for editing user contact information. Adding, removing, clearing, and
+ * greeting are methods declared on the controller (see source tab). These methods can
+ * easily be called from the angular markup. Any changes to the data are automatically reflected
+ * in the View without the need for a manual update.
+ *
+ * Two different declaration styles are included below:
+ *
+ * * one binds methods and properties directly onto the controller using `this`:
+ * `ng-controller="SettingsController1 as settings"`
+ * * one injects `$scope` into the controller:
+ * `ng-controller="SettingsController2"`
+ *
+ * The second option is more common in the Angular community, and is generally used in boilerplates
+ * and in this guide. However, there are advantages to binding properties directly to the controller
+ * and avoiding scope.
+ *
+ * * Using `controller as` makes it obvious which controller you are accessing in the template when
+ * multiple controllers apply to an element.
+ * * If you are writing your controllers as classes you have easier access to the properties and
+ * methods, which will appear on the scope, from inside the controller code.
+ * * Since there is always a `.` in the bindings, you don't have to worry about prototypal
+ * inheritance masking primitives.
+ *
+ * This example demonstrates the `controller as` syntax.
+ *
+ * <example name="ngControllerAs" module="controllerAsExample">
+ * <file name="index.html">
+ * <div id="ctrl-as-exmpl" ng-controller="SettingsController1 as settings">
+ * <label>Name: <input type="text" ng-model="settings.name"/></label>
+ * <button ng-click="settings.greet()">greet</button><br/>
+ * Contact:
+ * <ul>
+ * <li ng-repeat="contact in settings.contacts">
+ * <select ng-model="contact.type" aria-label="Contact method" id="select_{{$index}}">
+ * <option>phone</option>
+ * <option>email</option>
+ * </select>
+ * <input type="text" ng-model="contact.value" aria-labelledby="select_{{$index}}" />
+ * <button ng-click="settings.clearContact(contact)">clear</button>
+ * <button ng-click="settings.removeContact(contact)" aria-label="Remove">X</button>
+ * </li>
+ * <li><button ng-click="settings.addContact()">add</button></li>
+ * </ul>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('controllerAsExample', [])
+ * .controller('SettingsController1', SettingsController1);
+ *
+ * function SettingsController1() {
+ * this.name = "John Smith";
+ * this.contacts = [
+ * {type: 'phone', value: '408 555 1212'},
+ * {type: 'email', value: 'john.smith@example.org'} ];
+ * }
+ *
+ * SettingsController1.prototype.greet = function() {
+ * alert(this.name);
+ * };
+ *
+ * SettingsController1.prototype.addContact = function() {
+ * this.contacts.push({type: 'email', value: 'yourname@example.org'});
+ * };
+ *
+ * SettingsController1.prototype.removeContact = function(contactToRemove) {
+ * var index = this.contacts.indexOf(contactToRemove);
+ * this.contacts.splice(index, 1);
+ * };
+ *
+ * SettingsController1.prototype.clearContact = function(contact) {
+ * contact.type = 'phone';
+ * contact.value = '';
+ * };
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should check controller as', function() {
+ * var container = element(by.id('ctrl-as-exmpl'));
+ * expect(container.element(by.model('settings.name'))
+ * .getAttribute('value')).toBe('John Smith');
+ *
+ * var firstRepeat =
+ * container.element(by.repeater('contact in settings.contacts').row(0));
+ * var secondRepeat =
+ * container.element(by.repeater('contact in settings.contacts').row(1));
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('408 555 1212');
+ *
+ * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('john.smith@example.org');
+ *
+ * firstRepeat.element(by.buttonText('clear')).click();
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('');
+ *
+ * container.element(by.buttonText('add')).click();
+ *
+ * expect(container.element(by.repeater('contact in settings.contacts').row(2))
+ * .element(by.model('contact.value'))
+ * .getAttribute('value'))
+ * .toBe('yourname@example.org');
+ * });
+ * </file>
+ * </example>
+ *
+ * This example demonstrates the "attach to `$scope`" style of controller.
+ *
+ * <example name="ngController" module="controllerExample">
+ * <file name="index.html">
+ * <div id="ctrl-exmpl" ng-controller="SettingsController2">
+ * <label>Name: <input type="text" ng-model="name"/></label>
+ * <button ng-click="greet()">greet</button><br/>
+ * Contact:
+ * <ul>
+ * <li ng-repeat="contact in contacts">
+ * <select ng-model="contact.type" id="select_{{$index}}">
+ * <option>phone</option>
+ * <option>email</option>
+ * </select>
+ * <input type="text" ng-model="contact.value" aria-labelledby="select_{{$index}}" />
+ * <button ng-click="clearContact(contact)">clear</button>
+ * <button ng-click="removeContact(contact)">X</button>
+ * </li>
+ * <li>[ <button ng-click="addContact()">add</button> ]</li>
+ * </ul>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('controllerExample', [])
+ * .controller('SettingsController2', ['$scope', SettingsController2]);
+ *
+ * function SettingsController2($scope) {
+ * $scope.name = "John Smith";
+ * $scope.contacts = [
+ * {type:'phone', value:'408 555 1212'},
+ * {type:'email', value:'john.smith@example.org'} ];
+ *
+ * $scope.greet = function() {
+ * alert($scope.name);
+ * };
+ *
+ * $scope.addContact = function() {
+ * $scope.contacts.push({type:'email', value:'yourname@example.org'});
+ * };
+ *
+ * $scope.removeContact = function(contactToRemove) {
+ * var index = $scope.contacts.indexOf(contactToRemove);
+ * $scope.contacts.splice(index, 1);
+ * };
+ *
+ * $scope.clearContact = function(contact) {
+ * contact.type = 'phone';
+ * contact.value = '';
+ * };
+ * }
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should check controller', function() {
+ * var container = element(by.id('ctrl-exmpl'));
+ *
+ * expect(container.element(by.model('name'))
+ * .getAttribute('value')).toBe('John Smith');
+ *
+ * var firstRepeat =
+ * container.element(by.repeater('contact in contacts').row(0));
+ * var secondRepeat =
+ * container.element(by.repeater('contact in contacts').row(1));
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('408 555 1212');
+ * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('john.smith@example.org');
+ *
+ * firstRepeat.element(by.buttonText('clear')).click();
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('');
+ *
+ * container.element(by.buttonText('add')).click();
+ *
+ * expect(container.element(by.repeater('contact in contacts').row(2))
+ * .element(by.model('contact.value'))
+ * .getAttribute('value'))
+ * .toBe('yourname@example.org');
+ * });
+ * </file>
+ *</example>
+
+ */
+var ngControllerDirective = [function() {
+ return {
+ restrict: 'A',
+ scope: true,
+ controller: '@',
+ priority: 500
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngCsp
+ *
+ * @element html
+ * @description
+ *
+ * Angular has some features that can break certain
+ * [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) rules.
+ *
+ * If you intend to implement these rules then you must tell Angular not to use these features.
+ *
+ * This is necessary when developing things like Google Chrome Extensions or Universal Windows Apps.
+ *
+ *
+ * The following rules affect Angular:
+ *
+ * * `unsafe-eval`: this rule forbids apps to use `eval` or `Function(string)` generated functions
+ * (among other things). Angular makes use of this in the {@link $parse} service to provide a 30%
+ * increase in the speed of evaluating Angular expressions.
+ *
+ * * `unsafe-inline`: this rule forbids apps from inject custom styles into the document. Angular
+ * makes use of this to include some CSS rules (e.g. {@link ngCloak} and {@link ngHide}).
+ * To make these directives work when a CSP rule is blocking inline styles, you must link to the
+ * `angular-csp.css` in your HTML manually.
+ *
+ * If you do not provide `ngCsp` then Angular tries to autodetect if CSP is blocking unsafe-eval
+ * and automatically deactivates this feature in the {@link $parse} service. This autodetection,
+ * however, triggers a CSP error to be logged in the console:
+ *
+ * ```
+ * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of
+ * script in the following Content Security Policy directive: "default-src 'self'". Note that
+ * 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
+ * ```
+ *
+ * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`
+ * directive on an element of the HTML document that appears before the `<script>` tag that loads
+ * the `angular.js` file.
+ *
+ * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*
+ *
+ * You can specify which of the CSP related Angular features should be deactivated by providing
+ * a value for the `ng-csp` attribute. The options are as follows:
+ *
+ * * no-inline-style: this stops Angular from injecting CSS styles into the DOM
+ *
+ * * no-unsafe-eval: this stops Angular from optimizing $parse with unsafe eval of strings
+ *
+ * You can use these values in the following combinations:
+ *
+ *
+ * * No declaration means that Angular will assume that you can do inline styles, but it will do
+ * a runtime check for unsafe-eval. E.g. `<body>`. This is backwardly compatible with previous versions
+ * of Angular.
+ *
+ * * A simple `ng-csp` (or `data-ng-csp`) attribute will tell Angular to deactivate both inline
+ * styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous versions
+ * of Angular.
+ *
+ * * Specifying only `no-unsafe-eval` tells Angular that we must not use eval, but that we can inject
+ * inline styles. E.g. `<body ng-csp="no-unsafe-eval">`.
+ *
+ * * Specifying only `no-inline-style` tells Angular that we must not inject styles, but that we can
+ * run eval - no automatic check for unsafe eval will occur. E.g. `<body ng-csp="no-inline-style">`
+ *
+ * * Specifying both `no-unsafe-eval` and `no-inline-style` tells Angular that we must not inject
+ * styles nor use eval, which is the same as an empty: ng-csp.
+ * E.g.`<body ng-csp="no-inline-style;no-unsafe-eval">`
+ *
+ * @example
+ * This example shows how to apply the `ngCsp` directive to the `html` tag.
+ ```html
+ <!doctype html>
+ <html ng-app ng-csp>
+ ...
+ ...
+ </html>
+ ```
+ * @example
+ // Note: the suffix `.csp` in the example name triggers
+ // csp mode in our http server!
+ <example name="example.csp" module="cspExample" ng-csp="true">
+ <file name="index.html">
+ <div ng-controller="MainController as ctrl">
+ <div>
+ <button ng-click="ctrl.inc()" id="inc">Increment</button>
+ <span id="counter">
+ {{ctrl.counter}}
+ </span>
+ </div>
+
+ <div>
+ <button ng-click="ctrl.evil()" id="evil">Evil</button>
+ <span id="evilError">
+ {{ctrl.evilError}}
+ </span>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('cspExample', [])
+ .controller('MainController', function() {
+ this.counter = 0;
+ this.inc = function() {
+ this.counter++;
+ };
+ this.evil = function() {
+ // jshint evil:true
+ try {
+ eval('1+2');
+ } catch (e) {
+ this.evilError = e.message;
+ }
+ };
+ });
+ </file>
+ <file name="protractor.js" type="protractor">
+ var util, webdriver;
+
+ var incBtn = element(by.id('inc'));
+ var counter = element(by.id('counter'));
+ var evilBtn = element(by.id('evil'));
+ var evilError = element(by.id('evilError'));
+
+ function getAndClearSevereErrors() {
+ return browser.manage().logs().get('browser').then(function(browserLog) {
+ return browserLog.filter(function(logEntry) {
+ return logEntry.level.value > webdriver.logging.Level.WARNING.value;
+ });
+ });
+ }
+
+ function clearErrors() {
+ getAndClearSevereErrors();
+ }
+
+ function expectNoErrors() {
+ getAndClearSevereErrors().then(function(filteredLog) {
+ expect(filteredLog.length).toEqual(0);
+ if (filteredLog.length) {
+ console.log('browser console errors: ' + util.inspect(filteredLog));
+ }
+ });
+ }
+
+ function expectError(regex) {
+ getAndClearSevereErrors().then(function(filteredLog) {
+ var found = false;
+ filteredLog.forEach(function(log) {
+ if (log.message.match(regex)) {
+ found = true;
+ }
+ });
+ if (!found) {
+ throw new Error('expected an error that matches ' + regex);
+ }
+ });
+ }
+
+ beforeEach(function() {
+ util = require('util');
+ webdriver = require('protractor/node_modules/selenium-webdriver');
+ });
+
+ // For now, we only test on Chrome,
+ // as Safari does not load the page with Protractor's injected scripts,
+ // and Firefox webdriver always disables content security policy (#6358)
+ if (browser.params.browser !== 'chrome') {
+ return;
+ }
+
+ it('should not report errors when the page is loaded', function() {
+ // clear errors so we are not dependent on previous tests
+ clearErrors();
+ // Need to reload the page as the page is already loaded when
+ // we come here
+ browser.driver.getCurrentUrl().then(function(url) {
+ browser.get(url);
+ });
+ expectNoErrors();
+ });
+
+ it('should evaluate expressions', function() {
+ expect(counter.getText()).toEqual('0');
+ incBtn.click();
+ expect(counter.getText()).toEqual('1');
+ expectNoErrors();
+ });
+
+ it('should throw and report an error when using "eval"', function() {
+ evilBtn.click();
+ expect(evilError.getText()).toMatch(/Content Security Policy/);
+ expectError(/Content Security Policy/);
+ });
+ </file>
+ </example>
+ */
+
+// ngCsp is not implemented as a proper directive any more, because we need it be processed while we
+// bootstrap the system (before $parse is instantiated), for this reason we just have
+// the csp() fn that looks for the `ng-csp` attribute anywhere in the current doc
+
+/**
+ * @ngdoc directive
+ * @name ngClick
+ *
+ * @description
+ * The ngClick directive allows you to specify custom behavior when
+ * an element is clicked.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon
+ * click. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-click="count = count + 1" ng-init="count=0">
+ Increment
+ </button>
+ <span>
+ count: {{count}}
+ </span>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-click', function() {
+ expect(element(by.binding('count')).getText()).toMatch('0');
+ element(by.css('button')).click();
+ expect(element(by.binding('count')).getText()).toMatch('1');
+ });
+ </file>
+ </example>
+ */
+/*
+ * A collection of directives that allows creation of custom event handlers that are defined as
+ * angular expressions and are compiled and executed within the current scope.
+ */
+var ngEventDirectives = {};
+
+// For events that might fire synchronously during DOM manipulation
+// we need to execute their event handlers asynchronously using $evalAsync,
+// so that they are not executed in an inconsistent state.
+var forceAsyncEvents = {
+ 'blur': true,
+ 'focus': true
+};
+forEach(
+ 'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),
+ function(eventName) {
+ var directiveName = directiveNormalize('ng-' + eventName);
+ ngEventDirectives[directiveName] = ['$parse', '$rootScope', function($parse, $rootScope) {
+ return {
+ restrict: 'A',
+ compile: function($element, attr) {
+ // We expose the powerful $event object on the scope that provides access to the Window,
+ // etc. that isn't protected by the fast paths in $parse. We explicitly request better
+ // checks at the cost of speed since event handler expressions are not executed as
+ // frequently as regular change detection.
+ var fn = $parse(attr[directiveName], /* interceptorFn */ null, /* expensiveChecks */ true);
+ return function ngEventHandler(scope, element) {
+ element.on(eventName, function(event) {
+ var callback = function() {
+ fn(scope, {$event:event});
+ };
+ if (forceAsyncEvents[eventName] && $rootScope.$$phase) {
+ scope.$evalAsync(callback);
+ } else {
+ scope.$apply(callback);
+ }
+ });
+ };
+ }
+ };
+ }];
+ }
+);
+
+/**
+ * @ngdoc directive
+ * @name ngDblclick
+ *
+ * @description
+ * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon
+ * a dblclick. (The Event object is available as `$event`)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-dblclick="count = count + 1" ng-init="count=0">
+ Increment (on double click)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMousedown
+ *
+ * @description
+ * The ngMousedown directive allows you to specify custom behavior on mousedown event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon
+ * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mousedown="count = count + 1" ng-init="count=0">
+ Increment (on mouse down)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseup
+ *
+ * @description
+ * Specify custom behavior on mouseup event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon
+ * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseup="count = count + 1" ng-init="count=0">
+ Increment (on mouse up)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngMouseover
+ *
+ * @description
+ * Specify custom behavior on mouseover event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon
+ * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseover="count = count + 1" ng-init="count=0">
+ Increment (when mouse is over)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseenter
+ *
+ * @description
+ * Specify custom behavior on mouseenter event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon
+ * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseenter="count = count + 1" ng-init="count=0">
+ Increment (when mouse enters)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseleave
+ *
+ * @description
+ * Specify custom behavior on mouseleave event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon
+ * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseleave="count = count + 1" ng-init="count=0">
+ Increment (when mouse leaves)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMousemove
+ *
+ * @description
+ * Specify custom behavior on mousemove event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon
+ * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mousemove="count = count + 1" ng-init="count=0">
+ Increment (when mouse moves)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeydown
+ *
+ * @description
+ * Specify custom behavior on keydown event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon
+ * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-keydown="count = count + 1" ng-init="count=0">
+ key down count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeyup
+ *
+ * @description
+ * Specify custom behavior on keyup event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon
+ * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <p>Typing in the input box below updates the key count</p>
+ <input ng-keyup="count = count + 1" ng-init="count=0"> key up count: {{count}}
+
+ <p>Typing in the input box below updates the keycode</p>
+ <input ng-keyup="event=$event">
+ <p>event keyCode: {{ event.keyCode }}</p>
+ <p>event altKey: {{ event.altKey }}</p>
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeypress
+ *
+ * @description
+ * Specify custom behavior on keypress event.
+ *
+ * @element ANY
+ * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon
+ * keypress. ({@link guide/expression#-event- Event object is available as `$event`}
+ * and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-keypress="count = count + 1" ng-init="count=0">
+ key press count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngSubmit
+ *
+ * @description
+ * Enables binding angular expressions to onsubmit events.
+ *
+ * Additionally it prevents the default action (which for form means sending the request to the
+ * server and reloading the current page), but only if the form does not contain `action`,
+ * `data-action`, or `x-action` attributes.
+ *
+ * <div class="alert alert-warning">
+ * **Warning:** Be careful not to cause "double-submission" by using both the `ngClick` and
+ * `ngSubmit` handlers together. See the
+ * {@link form#submitting-a-form-and-preventing-the-default-action `form` directive documentation}
+ * for a detailed discussion of when `ngSubmit` may be triggered.
+ * </div>
+ *
+ * @element form
+ * @priority 0
+ * @param {expression} ngSubmit {@link guide/expression Expression} to eval.
+ * ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example module="submitExample">
+ <file name="index.html">
+ <script>
+ angular.module('submitExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.list = [];
+ $scope.text = 'hello';
+ $scope.submit = function() {
+ if ($scope.text) {
+ $scope.list.push(this.text);
+ $scope.text = '';
+ }
+ };
+ }]);
+ </script>
+ <form ng-submit="submit()" ng-controller="ExampleController">
+ Enter text and hit enter:
+ <input type="text" ng-model="text" name="text" />
+ <input type="submit" id="submit" value="Submit" />
+ <pre>list={{list}}</pre>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-submit', function() {
+ expect(element(by.binding('list')).getText()).toBe('list=[]');
+ element(by.css('#submit')).click();
+ expect(element(by.binding('list')).getText()).toContain('hello');
+ expect(element(by.model('text')).getAttribute('value')).toBe('');
+ });
+ it('should ignore empty strings', function() {
+ expect(element(by.binding('list')).getText()).toBe('list=[]');
+ element(by.css('#submit')).click();
+ element(by.css('#submit')).click();
+ expect(element(by.binding('list')).getText()).toContain('hello');
+ });
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngFocus
+ *
+ * @description
+ * Specify custom behavior on focus event.
+ *
+ * Note: As the `focus` event is executed synchronously when calling `input.focus()`
+ * AngularJS executes the expression using `scope.$evalAsync` if the event is fired
+ * during an `$apply` to ensure a consistent state.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon
+ * focus. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ * See {@link ng.directive:ngClick ngClick}
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngBlur
+ *
+ * @description
+ * Specify custom behavior on blur event.
+ *
+ * A [blur event](https://developer.mozilla.org/en-US/docs/Web/Events/blur) fires when
+ * an element has lost focus.
+ *
+ * Note: As the `blur` event is executed synchronously also during DOM manipulations
+ * (e.g. removing a focussed input),
+ * AngularJS executes the expression using `scope.$evalAsync` if the event is fired
+ * during an `$apply` to ensure a consistent state.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon
+ * blur. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ * See {@link ng.directive:ngClick ngClick}
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngCopy
+ *
+ * @description
+ * Specify custom behavior on copy event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon
+ * copy. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-copy="copied=true" ng-init="copied=false; value='copy me'" ng-model="value">
+ copied: {{copied}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngCut
+ *
+ * @description
+ * Specify custom behavior on cut event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon
+ * cut. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-cut="cut=true" ng-init="cut=false; value='cut me'" ng-model="value">
+ cut: {{cut}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngPaste
+ *
+ * @description
+ * Specify custom behavior on paste event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon
+ * paste. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-paste="paste=true" ng-init="paste=false" placeholder='paste here'>
+ pasted: {{paste}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngIf
+ * @restrict A
+ * @multiElement
+ *
+ * @description
+ * The `ngIf` directive removes or recreates a portion of the DOM tree based on an
+ * {expression}. If the expression assigned to `ngIf` evaluates to a false
+ * value then the element is removed from the DOM, otherwise a clone of the
+ * element is reinserted into the DOM.
+ *
+ * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the
+ * element in the DOM rather than changing its visibility via the `display` css property. A common
+ * case when this difference is significant is when using css selectors that rely on an element's
+ * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes.
+ *
+ * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope
+ * is created when the element is restored. The scope created within `ngIf` inherits from
+ * its parent scope using
+ * [prototypal inheritance](https://github.com/angular/angular.js/wiki/Understanding-Scopes#javascript-prototypal-inheritance).
+ * An important implication of this is if `ngModel` is used within `ngIf` to bind to
+ * a javascript primitive defined in the parent scope. In this case any modifications made to the
+ * variable within the child scope will override (hide) the value in the parent scope.
+ *
+ * Also, `ngIf` recreates elements using their compiled state. An example of this behavior
+ * is if an element's class attribute is directly modified after it's compiled, using something like
+ * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element
+ * the added class will be lost because the original compiled state is used to regenerate the element.
+ *
+ * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter`
+ * and `leave` effects.
+ *
+ * @animations
+ * enter - happens just after the `ngIf` contents change and a new DOM element is created and injected into the `ngIf` container
+ * leave - happens just before the `ngIf` contents are removed from the DOM
+ *
+ * @element ANY
+ * @scope
+ * @priority 600
+ * @param {expression} ngIf If the {@link guide/expression expression} is falsy then
+ * the element is removed from the DOM tree. If it is truthy a copy of the compiled
+ * element is added to the DOM tree.
+ *
+ * @example
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <label>Click me: <input type="checkbox" ng-model="checked" ng-init="checked=true" /></label><br/>
+ Show when checked:
+ <span ng-if="checked" class="animate-if">
+ This is removed when the checkbox is unchecked.
+ </span>
+ </file>
+ <file name="animations.css">
+ .animate-if {
+ background:white;
+ border:1px solid black;
+ padding:10px;
+ }
+
+ .animate-if.ng-enter, .animate-if.ng-leave {
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+ }
+
+ .animate-if.ng-enter,
+ .animate-if.ng-leave.ng-leave-active {
+ opacity:0;
+ }
+
+ .animate-if.ng-leave,
+ .animate-if.ng-enter.ng-enter-active {
+ opacity:1;
+ }
+ </file>
+ </example>
+ */
+var ngIfDirective = ['$animate', function($animate) {
+ return {
+ multiElement: true,
+ transclude: 'element',
+ priority: 600,
+ terminal: true,
+ restrict: 'A',
+ $$tlb: true,
+ link: function($scope, $element, $attr, ctrl, $transclude) {
+ var block, childScope, previousElements;
+ $scope.$watch($attr.ngIf, function ngIfWatchAction(value) {
+
+ if (value) {
+ if (!childScope) {
+ $transclude(function(clone, newScope) {
+ childScope = newScope;
+ clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ');
+ // Note: We only need the first/last node of the cloned nodes.
+ // However, we need to keep the reference to the jqlite wrapper as it might be changed later
+ // by a directive with templateUrl when its template arrives.
+ block = {
+ clone: clone
+ };
+ $animate.enter(clone, $element.parent(), $element);
+ });
+ }
+ } else {
+ if (previousElements) {
+ previousElements.remove();
+ previousElements = null;
+ }
+ if (childScope) {
+ childScope.$destroy();
+ childScope = null;
+ }
+ if (block) {
+ previousElements = getBlockNodes(block.clone);
+ $animate.leave(previousElements).then(function() {
+ previousElements = null;
+ });
+ block = null;
+ }
+ }
+ });
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngInclude
+ * @restrict ECA
+ *
+ * @description
+ * Fetches, compiles and includes an external HTML fragment.
+ *
+ * By default, the template URL is restricted to the same domain and protocol as the
+ * application document. This is done by calling {@link $sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols
+ * you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist them} or
+ * {@link $sce#trustAsResourceUrl wrap them} as trusted values. Refer to Angular's {@link
+ * ng.$sce Strict Contextual Escaping}.
+ *
+ * In addition, the browser's
+ * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+ * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
+ * policy may further restrict whether the template is successfully loaded.
+ * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://`
+ * access on some browsers.
+ *
+ * @animations
+ * enter - animation is used to bring new content into the browser.
+ * leave - animation is used to animate existing content away.
+ *
+ * The enter and leave animation occur concurrently.
+ *
+ * @scope
+ * @priority 400
+ *
+ * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,
+ * make sure you wrap it in **single** quotes, e.g. `src="'myPartialTemplate.html'"`.
+ * @param {string=} onload Expression to evaluate when a new partial is loaded.
+ * <div class="alert alert-warning">
+ * **Note:** When using onload on SVG elements in IE11, the browser will try to call
+ * a function with the name on the window element, which will usually throw a
+ * "function is undefined" error. To fix this, you can instead use `data-onload` or a
+ * different form that {@link guide/directive#normalization matches} `onload`.
+ * </div>
+ *
+ * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll
+ * $anchorScroll} to scroll the viewport after the content is loaded.
+ *
+ * - If the attribute is not set, disable scrolling.
+ * - If the attribute is set without value, enable scrolling.
+ * - Otherwise enable scrolling only if the expression evaluates to truthy value.
+ *
+ * @example
+ <example module="includeExample" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <select ng-model="template" ng-options="t.name for t in templates">
+ <option value="">(blank)</option>
+ </select>
+ url of the template: <code>{{template.url}}</code>
+ <hr/>
+ <div class="slide-animate-container">
+ <div class="slide-animate" ng-include="template.url"></div>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('includeExample', ['ngAnimate'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.templates =
+ [ { name: 'template1.html', url: 'template1.html'},
+ { name: 'template2.html', url: 'template2.html'} ];
+ $scope.template = $scope.templates[0];
+ }]);
+ </file>
+ <file name="template1.html">
+ Content of template1.html
+ </file>
+ <file name="template2.html">
+ Content of template2.html
+ </file>
+ <file name="animations.css">
+ .slide-animate-container {
+ position:relative;
+ background:white;
+ border:1px solid black;
+ height:40px;
+ overflow:hidden;
+ }
+
+ .slide-animate {
+ padding:10px;
+ }
+
+ .slide-animate.ng-enter, .slide-animate.ng-leave {
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+
+ position:absolute;
+ top:0;
+ left:0;
+ right:0;
+ bottom:0;
+ display:block;
+ padding:10px;
+ }
+
+ .slide-animate.ng-enter {
+ top:-50px;
+ }
+ .slide-animate.ng-enter.ng-enter-active {
+ top:0;
+ }
+
+ .slide-animate.ng-leave {
+ top:0;
+ }
+ .slide-animate.ng-leave.ng-leave-active {
+ top:50px;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var templateSelect = element(by.model('template'));
+ var includeElem = element(by.css('[ng-include]'));
+
+ it('should load template1.html', function() {
+ expect(includeElem.getText()).toMatch(/Content of template1.html/);
+ });
+
+ it('should load template2.html', function() {
+ if (browser.params.browser == 'firefox') {
+ // Firefox can't handle using selects
+ // See https://github.com/angular/protractor/issues/480
+ return;
+ }
+ templateSelect.click();
+ templateSelect.all(by.css('option')).get(2).click();
+ expect(includeElem.getText()).toMatch(/Content of template2.html/);
+ });
+
+ it('should change to blank', function() {
+ if (browser.params.browser == 'firefox') {
+ // Firefox can't handle using selects
+ return;
+ }
+ templateSelect.click();
+ templateSelect.all(by.css('option')).get(0).click();
+ expect(includeElem.isPresent()).toBe(false);
+ });
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentRequested
+ * @eventType emit on the scope ngInclude was declared in
+ * @description
+ * Emitted every time the ngInclude content is requested.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {String} src URL of content to load.
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentLoaded
+ * @eventType emit on the current ngInclude scope
+ * @description
+ * Emitted every time the ngInclude content is reloaded.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {String} src URL of content to load.
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentError
+ * @eventType emit on the scope ngInclude was declared in
+ * @description
+ * Emitted when a template HTTP request yields an erroneous response (status < 200 || status > 299)
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {String} src URL of content to load.
+ */
+var ngIncludeDirective = ['$templateRequest', '$anchorScroll', '$animate',
+ function($templateRequest, $anchorScroll, $animate) {
+ return {
+ restrict: 'ECA',
+ priority: 400,
+ terminal: true,
+ transclude: 'element',
+ controller: angular.noop,
+ compile: function(element, attr) {
+ var srcExp = attr.ngInclude || attr.src,
+ onloadExp = attr.onload || '',
+ autoScrollExp = attr.autoscroll;
+
+ return function(scope, $element, $attr, ctrl, $transclude) {
+ var changeCounter = 0,
+ currentScope,
+ previousElement,
+ currentElement;
+
+ var cleanupLastIncludeContent = function() {
+ if (previousElement) {
+ previousElement.remove();
+ previousElement = null;
+ }
+ if (currentScope) {
+ currentScope.$destroy();
+ currentScope = null;
+ }
+ if (currentElement) {
+ $animate.leave(currentElement).then(function() {
+ previousElement = null;
+ });
+ previousElement = currentElement;
+ currentElement = null;
+ }
+ };
+
+ scope.$watch(srcExp, function ngIncludeWatchAction(src) {
+ var afterAnimation = function() {
+ if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {
+ $anchorScroll();
+ }
+ };
+ var thisChangeId = ++changeCounter;
+
+ if (src) {
+ //set the 2nd param to true to ignore the template request error so that the inner
+ //contents and scope can be cleaned up.
+ $templateRequest(src, true).then(function(response) {
+ if (scope.$$destroyed) return;
+
+ if (thisChangeId !== changeCounter) return;
+ var newScope = scope.$new();
+ ctrl.template = response;
+
+ // Note: This will also link all children of ng-include that were contained in the original
+ // html. If that content contains controllers, ... they could pollute/change the scope.
+ // However, using ng-include on an element with additional content does not make sense...
+ // Note: We can't remove them in the cloneAttchFn of $transclude as that
+ // function is called before linking the content, which would apply child
+ // directives to non existing elements.
+ var clone = $transclude(newScope, function(clone) {
+ cleanupLastIncludeContent();
+ $animate.enter(clone, null, $element).then(afterAnimation);
+ });
+
+ currentScope = newScope;
+ currentElement = clone;
+
+ currentScope.$emit('$includeContentLoaded', src);
+ scope.$eval(onloadExp);
+ }, function() {
+ if (scope.$$destroyed) return;
+
+ if (thisChangeId === changeCounter) {
+ cleanupLastIncludeContent();
+ scope.$emit('$includeContentError', src);
+ }
+ });
+ scope.$emit('$includeContentRequested', src);
+ } else {
+ cleanupLastIncludeContent();
+ ctrl.template = null;
+ }
+ });
+ };
+ }
+ };
+}];
+
+// This directive is called during the $transclude call of the first `ngInclude` directive.
+// It will replace and compile the content of the element with the loaded template.
+// We need this directive so that the element content is already filled when
+// the link function of another directive on the same element as ngInclude
+// is called.
+var ngIncludeFillContentDirective = ['$compile',
+ function($compile) {
+ return {
+ restrict: 'ECA',
+ priority: -400,
+ require: 'ngInclude',
+ link: function(scope, $element, $attr, ctrl) {
+ if (toString.call($element[0]).match(/SVG/)) {
+ // WebKit: https://bugs.webkit.org/show_bug.cgi?id=135698 --- SVG elements do not
+ // support innerHTML, so detect this here and try to generate the contents
+ // specially.
+ $element.empty();
+ $compile(jqLiteBuildFragment(ctrl.template, document).childNodes)(scope,
+ function namespaceAdaptedClone(clone) {
+ $element.append(clone);
+ }, {futureParentElement: $element});
+ return;
+ }
+
+ $element.html(ctrl.template);
+ $compile($element.contents())(scope);
+ }
+ };
+ }];
+
+/**
+ * @ngdoc directive
+ * @name ngInit
+ * @restrict AC
+ *
+ * @description
+ * The `ngInit` directive allows you to evaluate an expression in the
+ * current scope.
+ *
+ * <div class="alert alert-danger">
+ * This directive can be abused to add unnecessary amounts of logic into your templates.
+ * There are only a few appropriate uses of `ngInit`, such as for aliasing special properties of
+ * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below; and for injecting data via
+ * server side scripting. Besides these few cases, you should use {@link guide/controller controllers}
+ * rather than `ngInit` to initialize values on a scope.
+ * </div>
+ *
+ * <div class="alert alert-warning">
+ * **Note**: If you have assignment in `ngInit` along with a {@link ng.$filter `filter`}, make
+ * sure you have parentheses to ensure correct operator precedence:
+ * <pre class="prettyprint">
+ * `<div ng-init="test1 = ($index | toString)"></div>`
+ * </pre>
+ * </div>
+ *
+ * @priority 450
+ *
+ * @element ANY
+ * @param {expression} ngInit {@link guide/expression Expression} to eval.
+ *
+ * @example
+ <example module="initExample">
+ <file name="index.html">
+ <script>
+ angular.module('initExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.list = [['a', 'b'], ['c', 'd']];
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <div ng-repeat="innerList in list" ng-init="outerIndex = $index">
+ <div ng-repeat="value in innerList" ng-init="innerIndex = $index">
+ <span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
+ </div>
+ </div>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should alias index positions', function() {
+ var elements = element.all(by.css('.example-init'));
+ expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;');
+ expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;');
+ expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;');
+ expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;');
+ });
+ </file>
+ </example>
+ */
+var ngInitDirective = ngDirective({
+ priority: 450,
+ compile: function() {
+ return {
+ pre: function(scope, element, attrs) {
+ scope.$eval(attrs.ngInit);
+ }
+ };
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngList
+ *
+ * @description
+ * Text input that converts between a delimited string and an array of strings. The default
+ * delimiter is a comma followed by a space - equivalent to `ng-list=", "`. You can specify a custom
+ * delimiter as the value of the `ngList` attribute - for example, `ng-list=" | "`.
+ *
+ * The behaviour of the directive is affected by the use of the `ngTrim` attribute.
+ * * If `ngTrim` is set to `"false"` then whitespace around both the separator and each
+ * list item is respected. This implies that the user of the directive is responsible for
+ * dealing with whitespace but also allows you to use whitespace as a delimiter, such as a
+ * tab or newline character.
+ * * Otherwise whitespace around the delimiter is ignored when splitting (although it is respected
+ * when joining the list items back together) and whitespace around each list item is stripped
+ * before it is added to the model.
+ *
+ * ### Example with Validation
+ *
+ * <example name="ngList-directive" module="listExample">
+ * <file name="app.js">
+ * angular.module('listExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.names = ['morpheus', 'neo', 'trinity'];
+ * }]);
+ * </file>
+ * <file name="index.html">
+ * <form name="myForm" ng-controller="ExampleController">
+ * <label>List: <input name="namesInput" ng-model="names" ng-list required></label>
+ * <span role="alert">
+ * <span class="error" ng-show="myForm.namesInput.$error.required">
+ * Required!</span>
+ * </span>
+ * <br>
+ * <tt>names = {{names}}</tt><br/>
+ * <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>
+ * <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>
+ * <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ * <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ * </form>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * var listInput = element(by.model('names'));
+ * var names = element(by.exactBinding('names'));
+ * var valid = element(by.binding('myForm.namesInput.$valid'));
+ * var error = element(by.css('span.error'));
+ *
+ * it('should initialize to model', function() {
+ * expect(names.getText()).toContain('["morpheus","neo","trinity"]');
+ * expect(valid.getText()).toContain('true');
+ * expect(error.getCssValue('display')).toBe('none');
+ * });
+ *
+ * it('should be invalid if empty', function() {
+ * listInput.clear();
+ * listInput.sendKeys('');
+ *
+ * expect(names.getText()).toContain('');
+ * expect(valid.getText()).toContain('false');
+ * expect(error.getCssValue('display')).not.toBe('none');
+ * });
+ * </file>
+ * </example>
+ *
+ * ### Example - splitting on newline
+ * <example name="ngList-directive-newlines">
+ * <file name="index.html">
+ * <textarea ng-model="list" ng-list="&#10;" ng-trim="false"></textarea>
+ * <pre>{{ list | json }}</pre>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it("should split the text by newlines", function() {
+ * var listInput = element(by.model('list'));
+ * var output = element(by.binding('list | json'));
+ * listInput.sendKeys('abc\ndef\nghi');
+ * expect(output.getText()).toContain('[\n "abc",\n "def",\n "ghi"\n]');
+ * });
+ * </file>
+ * </example>
+ *
+ * @element input
+ * @param {string=} ngList optional delimiter that should be used to split the value.
+ */
+var ngListDirective = function() {
+ return {
+ restrict: 'A',
+ priority: 100,
+ require: 'ngModel',
+ link: function(scope, element, attr, ctrl) {
+ // We want to control whitespace trimming so we use this convoluted approach
+ // to access the ngList attribute, which doesn't pre-trim the attribute
+ var ngList = element.attr(attr.$attr.ngList) || ', ';
+ var trimValues = attr.ngTrim !== 'false';
+ var separator = trimValues ? trim(ngList) : ngList;
+
+ var parse = function(viewValue) {
+ // If the viewValue is invalid (say required but empty) it will be `undefined`
+ if (isUndefined(viewValue)) return;
+
+ var list = [];
+
+ if (viewValue) {
+ forEach(viewValue.split(separator), function(value) {
+ if (value) list.push(trimValues ? trim(value) : value);
+ });
+ }
+
+ return list;
+ };
+
+ ctrl.$parsers.push(parse);
+ ctrl.$formatters.push(function(value) {
+ if (isArray(value)) {
+ return value.join(ngList);
+ }
+
+ return undefined;
+ });
+
+ // Override the standard $isEmpty because an empty array means the input is empty.
+ ctrl.$isEmpty = function(value) {
+ return !value || !value.length;
+ };
+ }
+ };
+};
+
+/* global VALID_CLASS: true,
+ INVALID_CLASS: true,
+ PRISTINE_CLASS: true,
+ DIRTY_CLASS: true,
+ UNTOUCHED_CLASS: true,
+ TOUCHED_CLASS: true,
+*/
+
+var VALID_CLASS = 'ng-valid',
+ INVALID_CLASS = 'ng-invalid',
+ PRISTINE_CLASS = 'ng-pristine',
+ DIRTY_CLASS = 'ng-dirty',
+ UNTOUCHED_CLASS = 'ng-untouched',
+ TOUCHED_CLASS = 'ng-touched',
+ PENDING_CLASS = 'ng-pending',
+ EMPTY_CLASS = 'ng-empty',
+ NOT_EMPTY_CLASS = 'ng-not-empty';
+
+var ngModelMinErr = minErr('ngModel');
+
+/**
+ * @ngdoc type
+ * @name ngModel.NgModelController
+ *
+ * @property {*} $viewValue The actual value from the control's view. For `input` elements, this is a
+ * String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue
+ * is set.
+ * @property {*} $modelValue The value in the model that the control is bound to.
+ * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever
+ the control reads value from the DOM. The functions are called in array order, each passing
+ its return value through to the next. The last return value is forwarded to the
+ {@link ngModel.NgModelController#$validators `$validators`} collection.
+
+Parsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue
+`$viewValue`}.
+
+Returning `undefined` from a parser means a parse error occurred. In that case,
+no {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel`
+will be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`}
+is set to `true`. The parse error is stored in `ngModel.$error.parse`.
+
+ *
+ * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever
+ the model value changes. The functions are called in reverse array order, each passing the value through to the
+ next. The last return value is used as the actual DOM value.
+ Used to format / convert values for display in the control.
+ * ```js
+ * function formatter(value) {
+ * if (value) {
+ * return value.toUpperCase();
+ * }
+ * }
+ * ngModel.$formatters.push(formatter);
+ * ```
+ *
+ * @property {Object.<string, function>} $validators A collection of validators that are applied
+ * whenever the model value changes. The key value within the object refers to the name of the
+ * validator while the function refers to the validation operation. The validation operation is
+ * provided with the model value as an argument and must return a true or false value depending
+ * on the response of that validation.
+ *
+ * ```js
+ * ngModel.$validators.validCharacters = function(modelValue, viewValue) {
+ * var value = modelValue || viewValue;
+ * return /[0-9]+/.test(value) &&
+ * /[a-z]+/.test(value) &&
+ * /[A-Z]+/.test(value) &&
+ * /\W+/.test(value);
+ * };
+ * ```
+ *
+ * @property {Object.<string, function>} $asyncValidators A collection of validations that are expected to
+ * perform an asynchronous validation (e.g. a HTTP request). The validation function that is provided
+ * is expected to return a promise when it is run during the model validation process. Once the promise
+ * is delivered then the validation status will be set to true when fulfilled and false when rejected.
+ * When the asynchronous validators are triggered, each of the validators will run in parallel and the model
+ * value will only be updated once all validators have been fulfilled. As long as an asynchronous validator
+ * is unfulfilled, its key will be added to the controllers `$pending` property. Also, all asynchronous validators
+ * will only run once all synchronous validators have passed.
+ *
+ * Please note that if $http is used then it is important that the server returns a success HTTP response code
+ * in order to fulfill the validation and a status level of `4xx` in order to reject the validation.
+ *
+ * ```js
+ * ngModel.$asyncValidators.uniqueUsername = function(modelValue, viewValue) {
+ * var value = modelValue || viewValue;
+ *
+ * // Lookup user by username
+ * return $http.get('/api/users/' + value).
+ * then(function resolved() {
+ * //username exists, this means validation fails
+ * return $q.reject('exists');
+ * }, function rejected() {
+ * //username does not exist, therefore this validation passes
+ * return true;
+ * });
+ * };
+ * ```
+ *
+ * @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the
+ * view value has changed. It is called with no arguments, and its return value is ignored.
+ * This can be used in place of additional $watches against the model value.
+ *
+ * @property {Object} $error An object hash with all failing validator ids as keys.
+ * @property {Object} $pending An object hash with all pending validator ids as keys.
+ *
+ * @property {boolean} $untouched True if control has not lost focus yet.
+ * @property {boolean} $touched True if control has lost focus.
+ * @property {boolean} $pristine True if user has not interacted with the control yet.
+ * @property {boolean} $dirty True if user has already interacted with the control.
+ * @property {boolean} $valid True if there is no error.
+ * @property {boolean} $invalid True if at least one error on the control.
+ * @property {string} $name The name attribute of the control.
+ *
+ * @description
+ *
+ * `NgModelController` provides API for the {@link ngModel `ngModel`} directive.
+ * The controller contains services for data-binding, validation, CSS updates, and value formatting
+ * and parsing. It purposefully does not contain any logic which deals with DOM rendering or
+ * listening to DOM events.
+ * Such DOM related logic should be provided by other directives which make use of
+ * `NgModelController` for data-binding to control elements.
+ * Angular provides this DOM logic for most {@link input `input`} elements.
+ * At the end of this page you can find a {@link ngModel.NgModelController#custom-control-example
+ * custom control example} that uses `ngModelController` to bind to `contenteditable` elements.
+ *
+ * @example
+ * ### Custom Control Example
+ * This example shows how to use `NgModelController` with a custom control to achieve
+ * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)
+ * collaborate together to achieve the desired result.
+ *
+ * `contenteditable` is an HTML5 attribute, which tells the browser to let the element
+ * contents be edited in place by the user.
+ *
+ * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize}
+ * module to automatically remove "bad" content like inline event listener (e.g. `<span onclick="...">`).
+ * However, as we are using `$sce` the model can still decide to provide unsafe content if it marks
+ * that content using the `$sce` service.
+ *
+ * <example name="NgModelController" module="customControl" deps="angular-sanitize.js">
+ <file name="style.css">
+ [contenteditable] {
+ border: 1px solid black;
+ background-color: white;
+ min-height: 20px;
+ }
+
+ .ng-invalid {
+ border: 1px solid red;
+ }
+
+ </file>
+ <file name="script.js">
+ angular.module('customControl', ['ngSanitize']).
+ directive('contenteditable', ['$sce', function($sce) {
+ return {
+ restrict: 'A', // only activate on element attribute
+ require: '?ngModel', // get a hold of NgModelController
+ link: function(scope, element, attrs, ngModel) {
+ if (!ngModel) return; // do nothing if no ng-model
+
+ // Specify how UI should be updated
+ ngModel.$render = function() {
+ element.html($sce.getTrustedHtml(ngModel.$viewValue || ''));
+ };
+
+ // Listen for change events to enable binding
+ element.on('blur keyup change', function() {
+ scope.$evalAsync(read);
+ });
+ read(); // initialize
+
+ // Write data to the model
+ function read() {
+ var html = element.html();
+ // When we clear the content editable the browser leaves a <br> behind
+ // If strip-br attribute is provided then we strip this out
+ if ( attrs.stripBr && html == '<br>' ) {
+ html = '';
+ }
+ ngModel.$setViewValue(html);
+ }
+ }
+ };
+ }]);
+ </file>
+ <file name="index.html">
+ <form name="myForm">
+ <div contenteditable
+ name="myWidget" ng-model="userContent"
+ strip-br="true"
+ required>Change me!</div>
+ <span ng-show="myForm.myWidget.$error.required">Required!</span>
+ <hr>
+ <textarea ng-model="userContent" aria-label="Dynamic textarea"></textarea>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should data-bind and become invalid', function() {
+ if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') {
+ // SafariDriver can't handle contenteditable
+ // and Firefox driver can't clear contenteditables very well
+ return;
+ }
+ var contentEditable = element(by.css('[contenteditable]'));
+ var content = 'Change me!';
+
+ expect(contentEditable.getText()).toEqual(content);
+
+ contentEditable.clear();
+ contentEditable.sendKeys(protractor.Key.BACK_SPACE);
+ expect(contentEditable.getText()).toEqual('');
+ expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/);
+ });
+ </file>
+ * </example>
+ *
+ *
+ */
+var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$rootScope', '$q', '$interpolate',
+ function($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $rootScope, $q, $interpolate) {
+ this.$viewValue = Number.NaN;
+ this.$modelValue = Number.NaN;
+ this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity.
+ this.$validators = {};
+ this.$asyncValidators = {};
+ this.$parsers = [];
+ this.$formatters = [];
+ this.$viewChangeListeners = [];
+ this.$untouched = true;
+ this.$touched = false;
+ this.$pristine = true;
+ this.$dirty = false;
+ this.$valid = true;
+ this.$invalid = false;
+ this.$error = {}; // keep invalid keys here
+ this.$$success = {}; // keep valid keys here
+ this.$pending = undefined; // keep pending keys here
+ this.$name = $interpolate($attr.name || '', false)($scope);
+ this.$$parentForm = nullFormCtrl;
+
+ var parsedNgModel = $parse($attr.ngModel),
+ parsedNgModelAssign = parsedNgModel.assign,
+ ngModelGet = parsedNgModel,
+ ngModelSet = parsedNgModelAssign,
+ pendingDebounce = null,
+ parserValid,
+ ctrl = this;
+
+ this.$$setOptions = function(options) {
+ ctrl.$options = options;
+ if (options && options.getterSetter) {
+ var invokeModelGetter = $parse($attr.ngModel + '()'),
+ invokeModelSetter = $parse($attr.ngModel + '($$$p)');
+
+ ngModelGet = function($scope) {
+ var modelValue = parsedNgModel($scope);
+ if (isFunction(modelValue)) {
+ modelValue = invokeModelGetter($scope);
+ }
+ return modelValue;
+ };
+ ngModelSet = function($scope, newValue) {
+ if (isFunction(parsedNgModel($scope))) {
+ invokeModelSetter($scope, {$$$p: ctrl.$modelValue});
+ } else {
+ parsedNgModelAssign($scope, ctrl.$modelValue);
+ }
+ };
+ } else if (!parsedNgModel.assign) {
+ throw ngModelMinErr('nonassign', "Expression '{0}' is non-assignable. Element: {1}",
+ $attr.ngModel, startingTag($element));
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$render
+ *
+ * @description
+ * Called when the view needs to be updated. It is expected that the user of the ng-model
+ * directive will implement this method.
+ *
+ * The `$render()` method is invoked in the following situations:
+ *
+ * * `$rollbackViewValue()` is called. If we are rolling back the view value to the last
+ * committed value then `$render()` is called to update the input control.
+ * * The value referenced by `ng-model` is changed programmatically and both the `$modelValue` and
+ * the `$viewValue` are different from last time.
+ *
+ * Since `ng-model` does not do a deep watch, `$render()` is only invoked if the values of
+ * `$modelValue` and `$viewValue` are actually different from their previous value. If `$modelValue`
+ * or `$viewValue` are objects (rather than a string or number) then `$render()` will not be
+ * invoked if you only change a property on the objects.
+ */
+ this.$render = noop;
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$isEmpty
+ *
+ * @description
+ * This is called when we need to determine if the value of an input is empty.
+ *
+ * For instance, the required directive does this to work out if the input has data or not.
+ *
+ * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.
+ *
+ * You can override this for input directives whose concept of being empty is different from the
+ * default. The `checkboxInputType` directive does this because in its case a value of `false`
+ * implies empty.
+ *
+ * @param {*} value The value of the input to check for emptiness.
+ * @returns {boolean} True if `value` is "empty".
+ */
+ this.$isEmpty = function(value) {
+ return isUndefined(value) || value === '' || value === null || value !== value;
+ };
+
+ this.$$updateEmptyClasses = function(value) {
+ if (ctrl.$isEmpty(value)) {
+ $animate.removeClass($element, NOT_EMPTY_CLASS);
+ $animate.addClass($element, EMPTY_CLASS);
+ } else {
+ $animate.removeClass($element, EMPTY_CLASS);
+ $animate.addClass($element, NOT_EMPTY_CLASS);
+ }
+ };
+
+
+ var currentValidationRunId = 0;
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setValidity
+ *
+ * @description
+ * Change the validity state, and notify the form.
+ *
+ * This method can be called within $parsers/$formatters or a custom validation implementation.
+ * However, in most cases it should be sufficient to use the `ngModel.$validators` and
+ * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically.
+ *
+ * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned
+ * to either `$error[validationErrorKey]` or `$pending[validationErrorKey]`
+ * (for unfulfilled `$asyncValidators`), so that it is available for data-binding.
+ * The `validationErrorKey` should be in camelCase and will get converted into dash-case
+ * for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`
+ * class and can be bound to as `{{someForm.someControl.$error.myError}}` .
+ * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined),
+ * or skipped (null). Pending is used for unfulfilled `$asyncValidators`.
+ * Skipped is used by Angular when validators do not run because of parse errors and
+ * when `$asyncValidators` do not run because any of the `$validators` failed.
+ */
+ addSetValidityMethod({
+ ctrl: this,
+ $element: $element,
+ set: function(object, property) {
+ object[property] = true;
+ },
+ unset: function(object, property) {
+ delete object[property];
+ },
+ $animate: $animate
+ });
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setPristine
+ *
+ * @description
+ * Sets the control to its pristine state.
+ *
+ * This method can be called to remove the `ng-dirty` class and set the control to its pristine
+ * state (`ng-pristine` class). A model is considered to be pristine when the control
+ * has not been changed from when first compiled.
+ */
+ this.$setPristine = function() {
+ ctrl.$dirty = false;
+ ctrl.$pristine = true;
+ $animate.removeClass($element, DIRTY_CLASS);
+ $animate.addClass($element, PRISTINE_CLASS);
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setDirty
+ *
+ * @description
+ * Sets the control to its dirty state.
+ *
+ * This method can be called to remove the `ng-pristine` class and set the control to its dirty
+ * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed
+ * from when first compiled.
+ */
+ this.$setDirty = function() {
+ ctrl.$dirty = true;
+ ctrl.$pristine = false;
+ $animate.removeClass($element, PRISTINE_CLASS);
+ $animate.addClass($element, DIRTY_CLASS);
+ ctrl.$$parentForm.$setDirty();
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setUntouched
+ *
+ * @description
+ * Sets the control to its untouched state.
+ *
+ * This method can be called to remove the `ng-touched` class and set the control to its
+ * untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched
+ * by default, however this function can be used to restore that state if the model has
+ * already been touched by the user.
+ */
+ this.$setUntouched = function() {
+ ctrl.$touched = false;
+ ctrl.$untouched = true;
+ $animate.setClass($element, UNTOUCHED_CLASS, TOUCHED_CLASS);
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setTouched
+ *
+ * @description
+ * Sets the control to its touched state.
+ *
+ * This method can be called to remove the `ng-untouched` class and set the control to its
+ * touched state (`ng-touched` class). A model is considered to be touched when the user has
+ * first focused the control element and then shifted focus away from the control (blur event).
+ */
+ this.$setTouched = function() {
+ ctrl.$touched = true;
+ ctrl.$untouched = false;
+ $animate.setClass($element, TOUCHED_CLASS, UNTOUCHED_CLASS);
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$rollbackViewValue
+ *
+ * @description
+ * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`,
+ * which may be caused by a pending debounced event or because the input is waiting for a some
+ * future event.
+ *
+ * If you have an input that uses `ng-model-options` to set up debounced updates or updates that
+ * depend on special events such as blur, you can have a situation where there is a period when
+ * the `$viewValue` is out of sync with the ngModel's `$modelValue`.
+ *
+ * In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update
+ * and reset the input to the last committed view value.
+ *
+ * It is also possible that you run into difficulties if you try to update the ngModel's `$modelValue`
+ * programmatically before these debounced/future events have resolved/occurred, because Angular's
+ * dirty checking mechanism is not able to tell whether the model has actually changed or not.
+ *
+ * The `$rollbackViewValue()` method should be called before programmatically changing the model of an
+ * input which may have such events pending. This is important in order to make sure that the
+ * input field will be updated with the new model value and any pending operations are cancelled.
+ *
+ * <example name="ng-model-cancel-update" module="cancel-update-example">
+ * <file name="app.js">
+ * angular.module('cancel-update-example', [])
+ *
+ * .controller('CancelUpdateController', ['$scope', function($scope) {
+ * $scope.model = {};
+ *
+ * $scope.setEmpty = function(e, value, rollback) {
+ * if (e.keyCode == 27) {
+ * e.preventDefault();
+ * if (rollback) {
+ * $scope.myForm[value].$rollbackViewValue();
+ * }
+ * $scope.model[value] = '';
+ * }
+ * };
+ * }]);
+ * </file>
+ * <file name="index.html">
+ * <div ng-controller="CancelUpdateController">
+ * <p>Both of these inputs are only updated if they are blurred. Hitting escape should
+ * empty them. Follow these steps and observe the difference:</p>
+ * <ol>
+ * <li>Type something in the input. You will see that the model is not yet updated</li>
+ * <li>Press the Escape key.
+ * <ol>
+ * <li> In the first example, nothing happens, because the model is already '', and no
+ * update is detected. If you blur the input, the model will be set to the current view.
+ * </li>
+ * <li> In the second example, the pending update is cancelled, and the input is set back
+ * to the last committed view value (''). Blurring the input does nothing.
+ * </li>
+ * </ol>
+ * </li>
+ * </ol>
+ *
+ * <form name="myForm" ng-model-options="{ updateOn: 'blur' }">
+ * <div>
+ * <p id="inputDescription1">Without $rollbackViewValue():</p>
+ * <input name="value1" aria-describedby="inputDescription1" ng-model="model.value1"
+ * ng-keydown="setEmpty($event, 'value1')">
+ * value1: "{{ model.value1 }}"
+ * </div>
+ *
+ * <div>
+ * <p id="inputDescription2">With $rollbackViewValue():</p>
+ * <input name="value2" aria-describedby="inputDescription2" ng-model="model.value2"
+ * ng-keydown="setEmpty($event, 'value2', true)">
+ * value2: "{{ model.value2 }}"
+ * </div>
+ * </form>
+ * </div>
+ * </file>
+ <file name="style.css">
+ div {
+ display: table-cell;
+ }
+ div:nth-child(1) {
+ padding-right: 30px;
+ }
+
+ </file>
+ * </example>
+ */
+ this.$rollbackViewValue = function() {
+ $timeout.cancel(pendingDebounce);
+ ctrl.$viewValue = ctrl.$$lastCommittedViewValue;
+ ctrl.$render();
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$validate
+ *
+ * @description
+ * Runs each of the registered validators (first synchronous validators and then
+ * asynchronous validators).
+ * If the validity changes to invalid, the model will be set to `undefined`,
+ * unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.
+ * If the validity changes to valid, it will set the model to the last available valid
+ * `$modelValue`, i.e. either the last parsed value or the last value set from the scope.
+ */
+ this.$validate = function() {
+ // ignore $validate before model is initialized
+ if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {
+ return;
+ }
+
+ var viewValue = ctrl.$$lastCommittedViewValue;
+ // Note: we use the $$rawModelValue as $modelValue might have been
+ // set to undefined during a view -> model update that found validation
+ // errors. We can't parse the view here, since that could change
+ // the model although neither viewValue nor the model on the scope changed
+ var modelValue = ctrl.$$rawModelValue;
+
+ var prevValid = ctrl.$valid;
+ var prevModelValue = ctrl.$modelValue;
+
+ var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;
+
+ ctrl.$$runValidators(modelValue, viewValue, function(allValid) {
+ // If there was no change in validity, don't update the model
+ // This prevents changing an invalid modelValue to undefined
+ if (!allowInvalid && prevValid !== allValid) {
+ // Note: Don't check ctrl.$valid here, as we could have
+ // external validators (e.g. calculated on the server),
+ // that just call $setValidity and need the model value
+ // to calculate their validity.
+ ctrl.$modelValue = allValid ? modelValue : undefined;
+
+ if (ctrl.$modelValue !== prevModelValue) {
+ ctrl.$$writeModelToScope();
+ }
+ }
+ });
+
+ };
+
+ this.$$runValidators = function(modelValue, viewValue, doneCallback) {
+ currentValidationRunId++;
+ var localValidationRunId = currentValidationRunId;
+
+ // check parser error
+ if (!processParseErrors()) {
+ validationDone(false);
+ return;
+ }
+ if (!processSyncValidators()) {
+ validationDone(false);
+ return;
+ }
+ processAsyncValidators();
+
+ function processParseErrors() {
+ var errorKey = ctrl.$$parserName || 'parse';
+ if (isUndefined(parserValid)) {
+ setValidity(errorKey, null);
+ } else {
+ if (!parserValid) {
+ forEach(ctrl.$validators, function(v, name) {
+ setValidity(name, null);
+ });
+ forEach(ctrl.$asyncValidators, function(v, name) {
+ setValidity(name, null);
+ });
+ }
+ // Set the parse error last, to prevent unsetting it, should a $validators key == parserName
+ setValidity(errorKey, parserValid);
+ return parserValid;
+ }
+ return true;
+ }
+
+ function processSyncValidators() {
+ var syncValidatorsValid = true;
+ forEach(ctrl.$validators, function(validator, name) {
+ var result = validator(modelValue, viewValue);
+ syncValidatorsValid = syncValidatorsValid && result;
+ setValidity(name, result);
+ });
+ if (!syncValidatorsValid) {
+ forEach(ctrl.$asyncValidators, function(v, name) {
+ setValidity(name, null);
+ });
+ return false;
+ }
+ return true;
+ }
+
+ function processAsyncValidators() {
+ var validatorPromises = [];
+ var allValid = true;
+ forEach(ctrl.$asyncValidators, function(validator, name) {
+ var promise = validator(modelValue, viewValue);
+ if (!isPromiseLike(promise)) {
+ throw ngModelMinErr('nopromise',
+ "Expected asynchronous validator to return a promise but got '{0}' instead.", promise);
+ }
+ setValidity(name, undefined);
+ validatorPromises.push(promise.then(function() {
+ setValidity(name, true);
+ }, function(error) {
+ allValid = false;
+ setValidity(name, false);
+ }));
+ });
+ if (!validatorPromises.length) {
+ validationDone(true);
+ } else {
+ $q.all(validatorPromises).then(function() {
+ validationDone(allValid);
+ }, noop);
+ }
+ }
+
+ function setValidity(name, isValid) {
+ if (localValidationRunId === currentValidationRunId) {
+ ctrl.$setValidity(name, isValid);
+ }
+ }
+
+ function validationDone(allValid) {
+ if (localValidationRunId === currentValidationRunId) {
+
+ doneCallback(allValid);
+ }
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$commitViewValue
+ *
+ * @description
+ * Commit a pending update to the `$modelValue`.
+ *
+ * Updates may be pending by a debounced event or because the input is waiting for a some future
+ * event defined in `ng-model-options`. this method is rarely needed as `NgModelController`
+ * usually handles calling this in response to input events.
+ */
+ this.$commitViewValue = function() {
+ var viewValue = ctrl.$viewValue;
+
+ $timeout.cancel(pendingDebounce);
+
+ // If the view value has not changed then we should just exit, except in the case where there is
+ // a native validator on the element. In this case the validation state may have changed even though
+ // the viewValue has stayed empty.
+ if (ctrl.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !ctrl.$$hasNativeValidators)) {
+ return;
+ }
+ ctrl.$$updateEmptyClasses(viewValue);
+ ctrl.$$lastCommittedViewValue = viewValue;
+
+ // change to dirty
+ if (ctrl.$pristine) {
+ this.$setDirty();
+ }
+ this.$$parseAndValidate();
+ };
+
+ this.$$parseAndValidate = function() {
+ var viewValue = ctrl.$$lastCommittedViewValue;
+ var modelValue = viewValue;
+ parserValid = isUndefined(modelValue) ? undefined : true;
+
+ if (parserValid) {
+ for (var i = 0; i < ctrl.$parsers.length; i++) {
+ modelValue = ctrl.$parsers[i](modelValue);
+ if (isUndefined(modelValue)) {
+ parserValid = false;
+ break;
+ }
+ }
+ }
+ if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {
+ // ctrl.$modelValue has not been touched yet...
+ ctrl.$modelValue = ngModelGet($scope);
+ }
+ var prevModelValue = ctrl.$modelValue;
+ var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;
+ ctrl.$$rawModelValue = modelValue;
+
+ if (allowInvalid) {
+ ctrl.$modelValue = modelValue;
+ writeToModelIfNeeded();
+ }
+
+ // Pass the $$lastCommittedViewValue here, because the cached viewValue might be out of date.
+ // This can happen if e.g. $setViewValue is called from inside a parser
+ ctrl.$$runValidators(modelValue, ctrl.$$lastCommittedViewValue, function(allValid) {
+ if (!allowInvalid) {
+ // Note: Don't check ctrl.$valid here, as we could have
+ // external validators (e.g. calculated on the server),
+ // that just call $setValidity and need the model value
+ // to calculate their validity.
+ ctrl.$modelValue = allValid ? modelValue : undefined;
+ writeToModelIfNeeded();
+ }
+ });
+
+ function writeToModelIfNeeded() {
+ if (ctrl.$modelValue !== prevModelValue) {
+ ctrl.$$writeModelToScope();
+ }
+ }
+ };
+
+ this.$$writeModelToScope = function() {
+ ngModelSet($scope, ctrl.$modelValue);
+ forEach(ctrl.$viewChangeListeners, function(listener) {
+ try {
+ listener();
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setViewValue
+ *
+ * @description
+ * Update the view value.
+ *
+ * This method should be called when a control wants to change the view value; typically,
+ * this is done from within a DOM event handler. For example, the {@link ng.directive:input input}
+ * directive calls it when the value of the input changes and {@link ng.directive:select select}
+ * calls it when an option is selected.
+ *
+ * When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers`
+ * and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged
+ * value sent directly for processing, finally to be applied to `$modelValue` and then the
+ * **expression** specified in the `ng-model` attribute. Lastly, all the registered change listeners,
+ * in the `$viewChangeListeners` list, are called.
+ *
+ * In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn`
+ * and the `default` trigger is not listed, all those actions will remain pending until one of the
+ * `updateOn` events is triggered on the DOM element.
+ * All these actions will be debounced if the {@link ng.directive:ngModelOptions ngModelOptions}
+ * directive is used with a custom debounce for this particular event.
+ * Note that a `$digest` is only triggered once the `updateOn` events are fired, or if `debounce`
+ * is specified, once the timer runs out.
+ *
+ * When used with standard inputs, the view value will always be a string (which is in some cases
+ * parsed into another type, such as a `Date` object for `input[date]`.)
+ * However, custom controls might also pass objects to this method. In this case, we should make
+ * a copy of the object before passing it to `$setViewValue`. This is because `ngModel` does not
+ * perform a deep watch of objects, it only looks for a change of identity. If you only change
+ * the property of the object then ngModel will not realize that the object has changed and
+ * will not invoke the `$parsers` and `$validators` pipelines. For this reason, you should
+ * not change properties of the copy once it has been passed to `$setViewValue`.
+ * Otherwise you may cause the model value on the scope to change incorrectly.
+ *
+ * <div class="alert alert-info">
+ * In any case, the value passed to the method should always reflect the current value
+ * of the control. For example, if you are calling `$setViewValue` for an input element,
+ * you should pass the input DOM value. Otherwise, the control and the scope model become
+ * out of sync. It's also important to note that `$setViewValue` does not call `$render` or change
+ * the control's DOM value in any way. If we want to change the control's DOM value
+ * programmatically, we should update the `ngModel` scope expression. Its new value will be
+ * picked up by the model controller, which will run it through the `$formatters`, `$render` it
+ * to update the DOM, and finally call `$validate` on it.
+ * </div>
+ *
+ * @param {*} value value from the view.
+ * @param {string} trigger Event that triggered the update.
+ */
+ this.$setViewValue = function(value, trigger) {
+ ctrl.$viewValue = value;
+ if (!ctrl.$options || ctrl.$options.updateOnDefault) {
+ ctrl.$$debounceViewValueCommit(trigger);
+ }
+ };
+
+ this.$$debounceViewValueCommit = function(trigger) {
+ var debounceDelay = 0,
+ options = ctrl.$options,
+ debounce;
+
+ if (options && isDefined(options.debounce)) {
+ debounce = options.debounce;
+ if (isNumber(debounce)) {
+ debounceDelay = debounce;
+ } else if (isNumber(debounce[trigger])) {
+ debounceDelay = debounce[trigger];
+ } else if (isNumber(debounce['default'])) {
+ debounceDelay = debounce['default'];
+ }
+ }
+
+ $timeout.cancel(pendingDebounce);
+ if (debounceDelay) {
+ pendingDebounce = $timeout(function() {
+ ctrl.$commitViewValue();
+ }, debounceDelay);
+ } else if ($rootScope.$$phase) {
+ ctrl.$commitViewValue();
+ } else {
+ $scope.$apply(function() {
+ ctrl.$commitViewValue();
+ });
+ }
+ };
+
+ // model -> value
+ // Note: we cannot use a normal scope.$watch as we want to detect the following:
+ // 1. scope value is 'a'
+ // 2. user enters 'b'
+ // 3. ng-change kicks in and reverts scope value to 'a'
+ // -> scope value did not change since the last digest as
+ // ng-change executes in apply phase
+ // 4. view should be changed back to 'a'
+ $scope.$watch(function ngModelWatch() {
+ var modelValue = ngModelGet($scope);
+
+ // if scope model value and ngModel value are out of sync
+ // TODO(perf): why not move this to the action fn?
+ if (modelValue !== ctrl.$modelValue &&
+ // checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator
+ (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue)
+ ) {
+ ctrl.$modelValue = ctrl.$$rawModelValue = modelValue;
+ parserValid = undefined;
+
+ var formatters = ctrl.$formatters,
+ idx = formatters.length;
+
+ var viewValue = modelValue;
+ while (idx--) {
+ viewValue = formatters[idx](viewValue);
+ }
+ if (ctrl.$viewValue !== viewValue) {
+ ctrl.$$updateEmptyClasses(viewValue);
+ ctrl.$viewValue = ctrl.$$lastCommittedViewValue = viewValue;
+ ctrl.$render();
+
+ ctrl.$$runValidators(modelValue, viewValue, noop);
+ }
+ }
+
+ return modelValue;
+ });
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngModel
+ *
+ * @element input
+ * @priority 1
+ *
+ * @description
+ * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a
+ * property on the scope using {@link ngModel.NgModelController NgModelController},
+ * which is created and exposed by this directive.
+ *
+ * `ngModel` is responsible for:
+ *
+ * - Binding the view into the model, which other directives such as `input`, `textarea` or `select`
+ * require.
+ * - Providing validation behavior (i.e. required, number, email, url).
+ * - Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors).
+ * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`,
+ * `ng-untouched`, `ng-empty`, `ng-not-empty`) including animations.
+ * - Registering the control with its parent {@link ng.directive:form form}.
+ *
+ * Note: `ngModel` will try to bind to the property given by evaluating the expression on the
+ * current scope. If the property doesn't already exist on this scope, it will be created
+ * implicitly and added to the scope.
+ *
+ * For best practices on using `ngModel`, see:
+ *
+ * - [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes)
+ *
+ * For basic examples, how to use `ngModel`, see:
+ *
+ * - {@link ng.directive:input input}
+ * - {@link input[text] text}
+ * - {@link input[checkbox] checkbox}
+ * - {@link input[radio] radio}
+ * - {@link input[number] number}
+ * - {@link input[email] email}
+ * - {@link input[url] url}
+ * - {@link input[date] date}
+ * - {@link input[datetime-local] datetime-local}
+ * - {@link input[time] time}
+ * - {@link input[month] month}
+ * - {@link input[week] week}
+ * - {@link ng.directive:select select}
+ * - {@link ng.directive:textarea textarea}
+ *
+ * # Complex Models (objects or collections)
+ *
+ * By default, `ngModel` watches the model by reference, not value. This is important to know when
+ * binding inputs to models that are objects (e.g. `Date`) or collections (e.g. arrays). If only properties of the
+ * object or collection change, `ngModel` will not be notified and so the input will not be re-rendered.
+ *
+ * The model must be assigned an entirely new object or collection before a re-rendering will occur.
+ *
+ * Some directives have options that will cause them to use a custom `$watchCollection` on the model expression
+ * - for example, `ngOptions` will do so when a `track by` clause is included in the comprehension expression or
+ * if the select is given the `multiple` attribute.
+ *
+ * The `$watchCollection()` method only does a shallow comparison, meaning that changing properties deeper than the
+ * first level of the object (or only changing the properties of an item in the collection if it's an array) will still
+ * not trigger a re-rendering of the model.
+ *
+ * # CSS classes
+ * The following CSS classes are added and removed on the associated input/select/textarea element
+ * depending on the validity of the model.
+ *
+ * - `ng-valid`: the model is valid
+ * - `ng-invalid`: the model is invalid
+ * - `ng-valid-[key]`: for each valid key added by `$setValidity`
+ * - `ng-invalid-[key]`: for each invalid key added by `$setValidity`
+ * - `ng-pristine`: the control hasn't been interacted with yet
+ * - `ng-dirty`: the control has been interacted with
+ * - `ng-touched`: the control has been blurred
+ * - `ng-untouched`: the control hasn't been blurred
+ * - `ng-pending`: any `$asyncValidators` are unfulfilled
+ * - `ng-empty`: the view does not contain a value or the value is deemed "empty", as defined
+ * by the {@link ngModel.NgModelController#$isEmpty} method
+ * - `ng-not-empty`: the view contains a non-empty value
+ *
+ * Keep in mind that ngAnimate can detect each of these classes when added and removed.
+ *
+ * ## Animation Hooks
+ *
+ * Animations within models are triggered when any of the associated CSS classes are added and removed
+ * on the input element which is attached to the model. These classes include: `.ng-pristine`, `.ng-dirty`,
+ * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.
+ * The animations that are triggered within ngModel are similar to how they work in ngClass and
+ * animations can be hooked into using CSS transitions, keyframes as well as JS animations.
+ *
+ * The following example shows a simple way to utilize CSS transitions to style an input element
+ * that has been rendered as invalid after it has been validated:
+ *
+ * <pre>
+ * //be sure to include ngAnimate as a module to hook into more
+ * //advanced animations
+ * .my-input {
+ * transition:0.5s linear all;
+ * background: white;
+ * }
+ * .my-input.ng-invalid {
+ * background: red;
+ * color:white;
+ * }
+ * </pre>
+ *
+ * @example
+ * <example deps="angular-animate.js" animations="true" fixBase="true" module="inputExample">
+ <file name="index.html">
+ <script>
+ angular.module('inputExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.val = '1';
+ }]);
+ </script>
+ <style>
+ .my-input {
+ transition:all linear 0.5s;
+ background: transparent;
+ }
+ .my-input.ng-invalid {
+ color:white;
+ background: red;
+ }
+ </style>
+ <p id="inputDescription">
+ Update input to see transitions when valid/invalid.
+ Integer is a valid value.
+ </p>
+ <form name="testForm" ng-controller="ExampleController">
+ <input ng-model="val" ng-pattern="/^\d+$/" name="anim" class="my-input"
+ aria-describedby="inputDescription" />
+ </form>
+ </file>
+ * </example>
+ *
+ * ## Binding to a getter/setter
+ *
+ * Sometimes it's helpful to bind `ngModel` to a getter/setter function. A getter/setter is a
+ * function that returns a representation of the model when called with zero arguments, and sets
+ * the internal state of a model when called with an argument. It's sometimes useful to use this
+ * for models that have an internal representation that's different from what the model exposes
+ * to the view.
+ *
+ * <div class="alert alert-success">
+ * **Best Practice:** It's best to keep getters fast because Angular is likely to call them more
+ * frequently than other parts of your code.
+ * </div>
+ *
+ * You use this behavior by adding `ng-model-options="{ getterSetter: true }"` to an element that
+ * has `ng-model` attached to it. You can also add `ng-model-options="{ getterSetter: true }"` to
+ * a `<form>`, which will enable this behavior for all `<input>`s within it. See
+ * {@link ng.directive:ngModelOptions `ngModelOptions`} for more.
+ *
+ * The following example shows how to use `ngModel` with a getter/setter:
+ *
+ * @example
+ * <example name="ngModel-getter-setter" module="getterSetterExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form name="userForm">
+ <label>Name:
+ <input type="text" name="userName"
+ ng-model="user.name"
+ ng-model-options="{ getterSetter: true }" />
+ </label>
+ </form>
+ <pre>user.name = <span ng-bind="user.name()"></span></pre>
+ </div>
+ </file>
+ <file name="app.js">
+ angular.module('getterSetterExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ var _name = 'Brian';
+ $scope.user = {
+ name: function(newName) {
+ // Note that newName can be undefined for two reasons:
+ // 1. Because it is called as a getter and thus called with no arguments
+ // 2. Because the property should actually be set to undefined. This happens e.g. if the
+ // input is invalid
+ return arguments.length ? (_name = newName) : _name;
+ }
+ };
+ }]);
+ </file>
+ * </example>
+ */
+var ngModelDirective = ['$rootScope', function($rootScope) {
+ return {
+ restrict: 'A',
+ require: ['ngModel', '^?form', '^?ngModelOptions'],
+ controller: NgModelController,
+ // Prelink needs to run before any input directive
+ // so that we can set the NgModelOptions in NgModelController
+ // before anyone else uses it.
+ priority: 1,
+ compile: function ngModelCompile(element) {
+ // Setup initial state of the control
+ element.addClass(PRISTINE_CLASS).addClass(UNTOUCHED_CLASS).addClass(VALID_CLASS);
+
+ return {
+ pre: function ngModelPreLink(scope, element, attr, ctrls) {
+ var modelCtrl = ctrls[0],
+ formCtrl = ctrls[1] || modelCtrl.$$parentForm;
+
+ modelCtrl.$$setOptions(ctrls[2] && ctrls[2].$options);
+
+ // notify others, especially parent forms
+ formCtrl.$addControl(modelCtrl);
+
+ attr.$observe('name', function(newValue) {
+ if (modelCtrl.$name !== newValue) {
+ modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue);
+ }
+ });
+
+ scope.$on('$destroy', function() {
+ modelCtrl.$$parentForm.$removeControl(modelCtrl);
+ });
+ },
+ post: function ngModelPostLink(scope, element, attr, ctrls) {
+ var modelCtrl = ctrls[0];
+ if (modelCtrl.$options && modelCtrl.$options.updateOn) {
+ element.on(modelCtrl.$options.updateOn, function(ev) {
+ modelCtrl.$$debounceViewValueCommit(ev && ev.type);
+ });
+ }
+
+ element.on('blur', function(ev) {
+ if (modelCtrl.$touched) return;
+
+ if ($rootScope.$$phase) {
+ scope.$evalAsync(modelCtrl.$setTouched);
+ } else {
+ scope.$apply(modelCtrl.$setTouched);
+ }
+ });
+ }
+ };
+ }
+ };
+}];
+
+var DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/;
+
+/**
+ * @ngdoc directive
+ * @name ngModelOptions
+ *
+ * @description
+ * Allows tuning how model updates are done. Using `ngModelOptions` you can specify a custom list of
+ * events that will trigger a model update and/or a debouncing delay so that the actual update only
+ * takes place when a timer expires; this timer will be reset after another change takes place.
+ *
+ * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might
+ * be different from the value in the actual model. This means that if you update the model you
+ * should also invoke {@link ngModel.NgModelController `$rollbackViewValue`} on the relevant input field in
+ * order to make sure it is synchronized with the model and that any debounced action is canceled.
+ *
+ * The easiest way to reference the control's {@link ngModel.NgModelController `$rollbackViewValue`}
+ * method is by making sure the input is placed inside a form that has a `name` attribute. This is
+ * important because `form` controllers are published to the related scope under the name in their
+ * `name` attribute.
+ *
+ * Any pending changes will take place immediately when an enclosing form is submitted via the
+ * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`
+ * to have access to the updated model.
+ *
+ * `ngModelOptions` has an effect on the element it's declared on and its descendants.
+ *
+ * @param {Object} ngModelOptions options to apply to the current model. Valid keys are:
+ * - `updateOn`: string specifying which event should the input be bound to. You can set several
+ * events using an space delimited list. There is a special event called `default` that
+ * matches the default events belonging of the control.
+ * - `debounce`: integer value which contains the debounce model update value in milliseconds. A
+ * value of 0 triggers an immediate update. If an object is supplied instead, you can specify a
+ * custom value for each event. For example:
+ * `ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 500, 'blur': 0 } }"`
+ * - `allowInvalid`: boolean value which indicates that the model can be set with values that did
+ * not validate correctly instead of the default behavior of setting the model to undefined.
+ * - `getterSetter`: boolean value which determines whether or not to treat functions bound to
+ `ngModel` as getters/setters.
+ * - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for
+ * `<input type="date">`, `<input type="time">`, ... . It understands UTC/GMT and the
+ * continental US time zone abbreviations, but for general use, use a time zone offset, for
+ * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
+ * If not specified, the timezone of the browser will be used.
+ *
+ * @example
+
+ The following example shows how to override immediate updates. Changes on the inputs within the
+ form will update the model only when the control loses focus (blur event). If `escape` key is
+ pressed while the input field is focused, the value is reset to the value in the current model.
+
+ <example name="ngModelOptions-directive-blur" module="optionsExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form name="userForm">
+ <label>Name:
+ <input type="text" name="userName"
+ ng-model="user.name"
+ ng-model-options="{ updateOn: 'blur' }"
+ ng-keyup="cancel($event)" />
+ </label><br />
+ <label>Other data:
+ <input type="text" ng-model="user.data" />
+ </label><br />
+ </form>
+ <pre>user.name = <span ng-bind="user.name"></span></pre>
+ <pre>user.data = <span ng-bind="user.data"></span></pre>
+ </div>
+ </file>
+ <file name="app.js">
+ angular.module('optionsExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.user = { name: 'John', data: '' };
+
+ $scope.cancel = function(e) {
+ if (e.keyCode == 27) {
+ $scope.userForm.userName.$rollbackViewValue();
+ }
+ };
+ }]);
+ </file>
+ <file name="protractor.js" type="protractor">
+ var model = element(by.binding('user.name'));
+ var input = element(by.model('user.name'));
+ var other = element(by.model('user.data'));
+
+ it('should allow custom events', function() {
+ input.sendKeys(' Doe');
+ input.click();
+ expect(model.getText()).toEqual('John');
+ other.click();
+ expect(model.getText()).toEqual('John Doe');
+ });
+
+ it('should $rollbackViewValue when model changes', function() {
+ input.sendKeys(' Doe');
+ expect(input.getAttribute('value')).toEqual('John Doe');
+ input.sendKeys(protractor.Key.ESCAPE);
+ expect(input.getAttribute('value')).toEqual('John');
+ other.click();
+ expect(model.getText()).toEqual('John');
+ });
+ </file>
+ </example>
+
+ This one shows how to debounce model changes. Model will be updated only 1 sec after last change.
+ If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.
+
+ <example name="ngModelOptions-directive-debounce" module="optionsExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form name="userForm">
+ <label>Name:
+ <input type="text" name="userName"
+ ng-model="user.name"
+ ng-model-options="{ debounce: 1000 }" />
+ </label>
+ <button ng-click="userForm.userName.$rollbackViewValue(); user.name=''">Clear</button>
+ <br />
+ </form>
+ <pre>user.name = <span ng-bind="user.name"></span></pre>
+ </div>
+ </file>
+ <file name="app.js">
+ angular.module('optionsExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.user = { name: 'Igor' };
+ }]);
+ </file>
+ </example>
+
+ This one shows how to bind to getter/setters:
+
+ <example name="ngModelOptions-directive-getter-setter" module="getterSetterExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form name="userForm">
+ <label>Name:
+ <input type="text" name="userName"
+ ng-model="user.name"
+ ng-model-options="{ getterSetter: true }" />
+ </label>
+ </form>
+ <pre>user.name = <span ng-bind="user.name()"></span></pre>
+ </div>
+ </file>
+ <file name="app.js">
+ angular.module('getterSetterExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ var _name = 'Brian';
+ $scope.user = {
+ name: function(newName) {
+ // Note that newName can be undefined for two reasons:
+ // 1. Because it is called as a getter and thus called with no arguments
+ // 2. Because the property should actually be set to undefined. This happens e.g. if the
+ // input is invalid
+ return arguments.length ? (_name = newName) : _name;
+ }
+ };
+ }]);
+ </file>
+ </example>
+ */
+var ngModelOptionsDirective = function() {
+ return {
+ restrict: 'A',
+ controller: ['$scope', '$attrs', function($scope, $attrs) {
+ var that = this;
+ this.$options = copy($scope.$eval($attrs.ngModelOptions));
+ // Allow adding/overriding bound events
+ if (isDefined(this.$options.updateOn)) {
+ this.$options.updateOnDefault = false;
+ // extract "default" pseudo-event from list of events that can trigger a model update
+ this.$options.updateOn = trim(this.$options.updateOn.replace(DEFAULT_REGEXP, function() {
+ that.$options.updateOnDefault = true;
+ return ' ';
+ }));
+ } else {
+ this.$options.updateOnDefault = true;
+ }
+ }]
+ };
+};
+
+
+
+// helper methods
+function addSetValidityMethod(context) {
+ var ctrl = context.ctrl,
+ $element = context.$element,
+ classCache = {},
+ set = context.set,
+ unset = context.unset,
+ $animate = context.$animate;
+
+ classCache[INVALID_CLASS] = !(classCache[VALID_CLASS] = $element.hasClass(VALID_CLASS));
+
+ ctrl.$setValidity = setValidity;
+
+ function setValidity(validationErrorKey, state, controller) {
+ if (isUndefined(state)) {
+ createAndSet('$pending', validationErrorKey, controller);
+ } else {
+ unsetAndCleanup('$pending', validationErrorKey, controller);
+ }
+ if (!isBoolean(state)) {
+ unset(ctrl.$error, validationErrorKey, controller);
+ unset(ctrl.$$success, validationErrorKey, controller);
+ } else {
+ if (state) {
+ unset(ctrl.$error, validationErrorKey, controller);
+ set(ctrl.$$success, validationErrorKey, controller);
+ } else {
+ set(ctrl.$error, validationErrorKey, controller);
+ unset(ctrl.$$success, validationErrorKey, controller);
+ }
+ }
+ if (ctrl.$pending) {
+ cachedToggleClass(PENDING_CLASS, true);
+ ctrl.$valid = ctrl.$invalid = undefined;
+ toggleValidationCss('', null);
+ } else {
+ cachedToggleClass(PENDING_CLASS, false);
+ ctrl.$valid = isObjectEmpty(ctrl.$error);
+ ctrl.$invalid = !ctrl.$valid;
+ toggleValidationCss('', ctrl.$valid);
+ }
+
+ // re-read the state as the set/unset methods could have
+ // combined state in ctrl.$error[validationError] (used for forms),
+ // where setting/unsetting only increments/decrements the value,
+ // and does not replace it.
+ var combinedState;
+ if (ctrl.$pending && ctrl.$pending[validationErrorKey]) {
+ combinedState = undefined;
+ } else if (ctrl.$error[validationErrorKey]) {
+ combinedState = false;
+ } else if (ctrl.$$success[validationErrorKey]) {
+ combinedState = true;
+ } else {
+ combinedState = null;
+ }
+
+ toggleValidationCss(validationErrorKey, combinedState);
+ ctrl.$$parentForm.$setValidity(validationErrorKey, combinedState, ctrl);
+ }
+
+ function createAndSet(name, value, controller) {
+ if (!ctrl[name]) {
+ ctrl[name] = {};
+ }
+ set(ctrl[name], value, controller);
+ }
+
+ function unsetAndCleanup(name, value, controller) {
+ if (ctrl[name]) {
+ unset(ctrl[name], value, controller);
+ }
+ if (isObjectEmpty(ctrl[name])) {
+ ctrl[name] = undefined;
+ }
+ }
+
+ function cachedToggleClass(className, switchValue) {
+ if (switchValue && !classCache[className]) {
+ $animate.addClass($element, className);
+ classCache[className] = true;
+ } else if (!switchValue && classCache[className]) {
+ $animate.removeClass($element, className);
+ classCache[className] = false;
+ }
+ }
+
+ function toggleValidationCss(validationErrorKey, isValid) {
+ validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
+
+ cachedToggleClass(VALID_CLASS + validationErrorKey, isValid === true);
+ cachedToggleClass(INVALID_CLASS + validationErrorKey, isValid === false);
+ }
+}
+
+function isObjectEmpty(obj) {
+ if (obj) {
+ for (var prop in obj) {
+ if (obj.hasOwnProperty(prop)) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+/**
+ * @ngdoc directive
+ * @name ngNonBindable
+ * @restrict AC
+ * @priority 1000
+ *
+ * @description
+ * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current
+ * DOM element. This is useful if the element contains what appears to be Angular directives and
+ * bindings but which should be ignored by Angular. This could be the case if you have a site that
+ * displays snippets of code, for instance.
+ *
+ * @element ANY
+ *
+ * @example
+ * In this example there are two locations where a simple interpolation binding (`{{}}`) is present,
+ * but the one wrapped in `ngNonBindable` is left alone.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <div>Normal: {{1 + 2}}</div>
+ <div ng-non-bindable>Ignored: {{1 + 2}}</div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-non-bindable', function() {
+ expect(element(by.binding('1 + 2')).getText()).toContain('3');
+ expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/);
+ });
+ </file>
+ </example>
+ */
+var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
+
+/* global jqLiteRemove */
+
+var ngOptionsMinErr = minErr('ngOptions');
+
+/**
+ * @ngdoc directive
+ * @name ngOptions
+ * @restrict A
+ *
+ * @description
+ *
+ * The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
+ * elements for the `<select>` element using the array or object obtained by evaluating the
+ * `ngOptions` comprehension expression.
+ *
+ * In many cases, `ngRepeat` can be used on `<option>` elements instead of `ngOptions` to achieve a
+ * similar result. However, `ngOptions` provides some benefits such as reducing memory and
+ * increasing speed by not creating a new scope for each repeated instance, as well as providing
+ * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the
+ * comprehension expression. `ngOptions` should be used when the `<select>` model needs to be bound
+ * to a non-string value. This is because an option element can only be bound to string values at
+ * present.
+ *
+ * When an item in the `<select>` menu is selected, the array element or object property
+ * represented by the selected option will be bound to the model identified by the `ngModel`
+ * directive.
+ *
+ * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can
+ * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
+ * option. See example below for demonstration.
+ *
+ * ## Complex Models (objects or collections)
+ *
+ * By default, `ngModel` watches the model by reference, not value. This is important to know when
+ * binding the select to a model that is an object or a collection.
+ *
+ * One issue occurs if you want to preselect an option. For example, if you set
+ * the model to an object that is equal to an object in your collection, `ngOptions` won't be able to set the selection,
+ * because the objects are not identical. So by default, you should always reference the item in your collection
+ * for preselections, e.g.: `$scope.selected = $scope.collection[3]`.
+ *
+ * Another solution is to use a `track by` clause, because then `ngOptions` will track the identity
+ * of the item not by reference, but by the result of the `track by` expression. For example, if your
+ * collection items have an id property, you would `track by item.id`.
+ *
+ * A different issue with objects or collections is that ngModel won't detect if an object property or
+ * a collection item changes. For that reason, `ngOptions` additionally watches the model using
+ * `$watchCollection`, when the expression contains a `track by` clause or the the select has the `multiple` attribute.
+ * This allows ngOptions to trigger a re-rendering of the options even if the actual object/collection
+ * has not changed identity, but only a property on the object or an item in the collection changes.
+ *
+ * Note that `$watchCollection` does a shallow comparison of the properties of the object (or the items in the collection
+ * if the model is an array). This means that changing a property deeper than the first level inside the
+ * object/collection will not trigger a re-rendering.
+ *
+ * ## `select` **`as`**
+ *
+ * Using `select` **`as`** will bind the result of the `select` expression to the model, but
+ * the value of the `<select>` and `<option>` html elements will be either the index (for array data sources)
+ * or property name (for object data sources) of the value within the collection. If a **`track by`** expression
+ * is used, the result of that expression will be set as the value of the `option` and `select` elements.
+ *
+ *
+ * ### `select` **`as`** and **`track by`**
+ *
+ * <div class="alert alert-warning">
+ * Be careful when using `select` **`as`** and **`track by`** in the same expression.
+ * </div>
+ *
+ * Given this array of items on the $scope:
+ *
+ * ```js
+ * $scope.items = [{
+ * id: 1,
+ * label: 'aLabel',
+ * subItem: { name: 'aSubItem' }
+ * }, {
+ * id: 2,
+ * label: 'bLabel',
+ * subItem: { name: 'bSubItem' }
+ * }];
+ * ```
+ *
+ * This will work:
+ *
+ * ```html
+ * <select ng-options="item as item.label for item in items track by item.id" ng-model="selected"></select>
+ * ```
+ * ```js
+ * $scope.selected = $scope.items[0];
+ * ```
+ *
+ * but this will not work:
+ *
+ * ```html
+ * <select ng-options="item.subItem as item.label for item in items track by item.id" ng-model="selected"></select>
+ * ```
+ * ```js
+ * $scope.selected = $scope.items[0].subItem;
+ * ```
+ *
+ * In both examples, the **`track by`** expression is applied successfully to each `item` in the
+ * `items` array. Because the selected option has been set programmatically in the controller, the
+ * **`track by`** expression is also applied to the `ngModel` value. In the first example, the
+ * `ngModel` value is `items[0]` and the **`track by`** expression evaluates to `items[0].id` with
+ * no issue. In the second example, the `ngModel` value is `items[0].subItem` and the **`track by`**
+ * expression evaluates to `items[0].subItem.id` (which is undefined). As a result, the model value
+ * is not matched against any `<option>` and the `<select>` appears as having no selected value.
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required The control is considered valid only if value is entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {comprehension_expression=} ngOptions in one of the following forms:
+ *
+ * * for array data sources:
+ * * `label` **`for`** `value` **`in`** `array`
+ * * `select` **`as`** `label` **`for`** `value` **`in`** `array`
+ * * `label` **`group by`** `group` **`for`** `value` **`in`** `array`
+ * * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array`
+ * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
+ * * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
+ * * `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr`
+ * (for including a filter with `track by`)
+ * * for object data sources:
+ * * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+ * * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+ * * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`
+ * * `label` **`disable when`** `disable` **`for (`**`key`**`,`** `value`**`) in`** `object`
+ * * `select` **`as`** `label` **`group by`** `group`
+ * **`for` `(`**`key`**`,`** `value`**`) in`** `object`
+ * * `select` **`as`** `label` **`disable when`** `disable`
+ * **`for` `(`**`key`**`,`** `value`**`) in`** `object`
+ *
+ * Where:
+ *
+ * * `array` / `object`: an expression which evaluates to an array / object to iterate over.
+ * * `value`: local variable which will refer to each item in the `array` or each property value
+ * of `object` during iteration.
+ * * `key`: local variable which will refer to a property name in `object` during iteration.
+ * * `label`: The result of this expression will be the label for `<option>` element. The
+ * `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).
+ * * `select`: The result of this expression will be bound to the model of the parent `<select>`
+ * element. If not specified, `select` expression will default to `value`.
+ * * `group`: The result of this expression will be used to group options using the `<optgroup>`
+ * DOM element.
+ * * `disable`: The result of this expression will be used to disable the rendered `<option>`
+ * element. Return `true` to disable.
+ * * `trackexpr`: Used when working with an array of objects. The result of this expression will be
+ * used to identify the objects in the array. The `trackexpr` will most likely refer to the
+ * `value` variable (e.g. `value.propertyName`). With this the selection is preserved
+ * even when the options are recreated (e.g. reloaded from the server).
+ *
+ * @example
+ <example module="selectExample">
+ <file name="index.html">
+ <script>
+ angular.module('selectExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.colors = [
+ {name:'black', shade:'dark'},
+ {name:'white', shade:'light', notAnOption: true},
+ {name:'red', shade:'dark'},
+ {name:'blue', shade:'dark', notAnOption: true},
+ {name:'yellow', shade:'light', notAnOption: false}
+ ];
+ $scope.myColor = $scope.colors[2]; // red
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <ul>
+ <li ng-repeat="color in colors">
+ <label>Name: <input ng-model="color.name"></label>
+ <label><input type="checkbox" ng-model="color.notAnOption"> Disabled?</label>
+ <button ng-click="colors.splice($index, 1)" aria-label="Remove">X</button>
+ </li>
+ <li>
+ <button ng-click="colors.push({})">add</button>
+ </li>
+ </ul>
+ <hr/>
+ <label>Color (null not allowed):
+ <select ng-model="myColor" ng-options="color.name for color in colors"></select>
+ </label><br/>
+ <label>Color (null allowed):
+ <span class="nullable">
+ <select ng-model="myColor" ng-options="color.name for color in colors">
+ <option value="">-- choose color --</option>
+ </select>
+ </span></label><br/>
+
+ <label>Color grouped by shade:
+ <select ng-model="myColor" ng-options="color.name group by color.shade for color in colors">
+ </select>
+ </label><br/>
+
+ <label>Color grouped by shade, with some disabled:
+ <select ng-model="myColor"
+ ng-options="color.name group by color.shade disable when color.notAnOption for color in colors">
+ </select>
+ </label><br/>
+
+
+
+ Select <button ng-click="myColor = { name:'not in list', shade: 'other' }">bogus</button>.
+ <br/>
+ <hr/>
+ Currently selected: {{ {selected_color:myColor} }}
+ <div style="border:solid 1px black; height:20px"
+ ng-style="{'background-color':myColor.name}">
+ </div>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-options', function() {
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');
+ element.all(by.model('myColor')).first().click();
+ element.all(by.css('select[ng-model="myColor"] option')).first().click();
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');
+ element(by.css('.nullable select[ng-model="myColor"]')).click();
+ element.all(by.css('.nullable select[ng-model="myColor"] option')).first().click();
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');
+ });
+ </file>
+ </example>
+ */
+
+// jshint maxlen: false
+// //00001111111111000000000002222222222000000000000000000000333333333300000000000000000000000004444444444400000000000005555555555555550000000006666666666666660000000777777777777777000000000000000888888888800000000000000000009999999999
+var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/;
+ // 1: value expression (valueFn)
+ // 2: label expression (displayFn)
+ // 3: group by expression (groupByFn)
+ // 4: disable when expression (disableWhenFn)
+ // 5: array item variable name
+ // 6: object item key variable name
+ // 7: object item value variable name
+ // 8: collection expression
+ // 9: track by expression
+// jshint maxlen: 100
+
+
+var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
+
+ function parseOptionsExpression(optionsExp, selectElement, scope) {
+
+ var match = optionsExp.match(NG_OPTIONS_REGEXP);
+ if (!(match)) {
+ throw ngOptionsMinErr('iexp',
+ "Expected expression in form of " +
+ "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
+ " but got '{0}'. Element: {1}",
+ optionsExp, startingTag(selectElement));
+ }
+
+ // Extract the parts from the ngOptions expression
+
+ // The variable name for the value of the item in the collection
+ var valueName = match[5] || match[7];
+ // The variable name for the key of the item in the collection
+ var keyName = match[6];
+
+ // An expression that generates the viewValue for an option if there is a label expression
+ var selectAs = / as /.test(match[0]) && match[1];
+ // An expression that is used to track the id of each object in the options collection
+ var trackBy = match[9];
+ // An expression that generates the viewValue for an option if there is no label expression
+ var valueFn = $parse(match[2] ? match[1] : valueName);
+ var selectAsFn = selectAs && $parse(selectAs);
+ var viewValueFn = selectAsFn || valueFn;
+ var trackByFn = trackBy && $parse(trackBy);
+
+ // Get the value by which we are going to track the option
+ // if we have a trackFn then use that (passing scope and locals)
+ // otherwise just hash the given viewValue
+ var getTrackByValueFn = trackBy ?
+ function(value, locals) { return trackByFn(scope, locals); } :
+ function getHashOfValue(value) { return hashKey(value); };
+ var getTrackByValue = function(value, key) {
+ return getTrackByValueFn(value, getLocals(value, key));
+ };
+
+ var displayFn = $parse(match[2] || match[1]);
+ var groupByFn = $parse(match[3] || '');
+ var disableWhenFn = $parse(match[4] || '');
+ var valuesFn = $parse(match[8]);
+
+ var locals = {};
+ var getLocals = keyName ? function(value, key) {
+ locals[keyName] = key;
+ locals[valueName] = value;
+ return locals;
+ } : function(value) {
+ locals[valueName] = value;
+ return locals;
+ };
+
+
+ function Option(selectValue, viewValue, label, group, disabled) {
+ this.selectValue = selectValue;
+ this.viewValue = viewValue;
+ this.label = label;
+ this.group = group;
+ this.disabled = disabled;
+ }
+
+ function getOptionValuesKeys(optionValues) {
+ var optionValuesKeys;
+
+ if (!keyName && isArrayLike(optionValues)) {
+ optionValuesKeys = optionValues;
+ } else {
+ // if object, extract keys, in enumeration order, unsorted
+ optionValuesKeys = [];
+ for (var itemKey in optionValues) {
+ if (optionValues.hasOwnProperty(itemKey) && itemKey.charAt(0) !== '$') {
+ optionValuesKeys.push(itemKey);
+ }
+ }
+ }
+ return optionValuesKeys;
+ }
+
+ return {
+ trackBy: trackBy,
+ getTrackByValue: getTrackByValue,
+ getWatchables: $parse(valuesFn, function(optionValues) {
+ // Create a collection of things that we would like to watch (watchedArray)
+ // so that they can all be watched using a single $watchCollection
+ // that only runs the handler once if anything changes
+ var watchedArray = [];
+ optionValues = optionValues || [];
+
+ var optionValuesKeys = getOptionValuesKeys(optionValues);
+ var optionValuesLength = optionValuesKeys.length;
+ for (var index = 0; index < optionValuesLength; index++) {
+ var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];
+ var value = optionValues[key];
+
+ var locals = getLocals(optionValues[key], key);
+ var selectValue = getTrackByValueFn(optionValues[key], locals);
+ watchedArray.push(selectValue);
+
+ // Only need to watch the displayFn if there is a specific label expression
+ if (match[2] || match[1]) {
+ var label = displayFn(scope, locals);
+ watchedArray.push(label);
+ }
+
+ // Only need to watch the disableWhenFn if there is a specific disable expression
+ if (match[4]) {
+ var disableWhen = disableWhenFn(scope, locals);
+ watchedArray.push(disableWhen);
+ }
+ }
+ return watchedArray;
+ }),
+
+ getOptions: function() {
+
+ var optionItems = [];
+ var selectValueMap = {};
+
+ // The option values were already computed in the `getWatchables` fn,
+ // which must have been called to trigger `getOptions`
+ var optionValues = valuesFn(scope) || [];
+ var optionValuesKeys = getOptionValuesKeys(optionValues);
+ var optionValuesLength = optionValuesKeys.length;
+
+ for (var index = 0; index < optionValuesLength; index++) {
+ var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];
+ var value = optionValues[key];
+ var locals = getLocals(value, key);
+ var viewValue = viewValueFn(scope, locals);
+ var selectValue = getTrackByValueFn(viewValue, locals);
+ var label = displayFn(scope, locals);
+ var group = groupByFn(scope, locals);
+ var disabled = disableWhenFn(scope, locals);
+ var optionItem = new Option(selectValue, viewValue, label, group, disabled);
+
+ optionItems.push(optionItem);
+ selectValueMap[selectValue] = optionItem;
+ }
+
+ return {
+ items: optionItems,
+ selectValueMap: selectValueMap,
+ getOptionFromViewValue: function(value) {
+ return selectValueMap[getTrackByValue(value)];
+ },
+ getViewValueFromOption: function(option) {
+ // If the viewValue could be an object that may be mutated by the application,
+ // we need to make a copy and not return the reference to the value on the option.
+ return trackBy ? angular.copy(option.viewValue) : option.viewValue;
+ }
+ };
+ }
+ };
+ }
+
+
+ // we can't just jqLite('<option>') since jqLite is not smart enough
+ // to create it in <select> and IE barfs otherwise.
+ var optionTemplate = document.createElement('option'),
+ optGroupTemplate = document.createElement('optgroup');
+
+ function ngOptionsPostLink(scope, selectElement, attr, ctrls) {
+
+ var selectCtrl = ctrls[0];
+ var ngModelCtrl = ctrls[1];
+ var multiple = attr.multiple;
+
+ // The emptyOption allows the application developer to provide their own custom "empty"
+ // option when the viewValue does not match any of the option values.
+ var emptyOption;
+ for (var i = 0, children = selectElement.children(), ii = children.length; i < ii; i++) {
+ if (children[i].value === '') {
+ emptyOption = children.eq(i);
+ break;
+ }
+ }
+
+ var providedEmptyOption = !!emptyOption;
+
+ var unknownOption = jqLite(optionTemplate.cloneNode(false));
+ unknownOption.val('?');
+
+ var options;
+ var ngOptions = parseOptionsExpression(attr.ngOptions, selectElement, scope);
+
+
+ var renderEmptyOption = function() {
+ if (!providedEmptyOption) {
+ selectElement.prepend(emptyOption);
+ }
+ selectElement.val('');
+ emptyOption.prop('selected', true); // needed for IE
+ emptyOption.attr('selected', true);
+ };
+
+ var removeEmptyOption = function() {
+ if (!providedEmptyOption) {
+ emptyOption.remove();
+ }
+ };
+
+
+ var renderUnknownOption = function() {
+ selectElement.prepend(unknownOption);
+ selectElement.val('?');
+ unknownOption.prop('selected', true); // needed for IE
+ unknownOption.attr('selected', true);
+ };
+
+ var removeUnknownOption = function() {
+ unknownOption.remove();
+ };
+
+ // Update the controller methods for multiple selectable options
+ if (!multiple) {
+
+ selectCtrl.writeValue = function writeNgOptionsValue(value) {
+ var option = options.getOptionFromViewValue(value);
+
+ if (option && !option.disabled) {
+ if (selectElement[0].value !== option.selectValue) {
+ removeUnknownOption();
+ removeEmptyOption();
+
+ selectElement[0].value = option.selectValue;
+ option.element.selected = true;
+ option.element.setAttribute('selected', 'selected');
+ }
+ } else {
+ if (value === null || providedEmptyOption) {
+ removeUnknownOption();
+ renderEmptyOption();
+ } else {
+ removeEmptyOption();
+ renderUnknownOption();
+ }
+ }
+ };
+
+ selectCtrl.readValue = function readNgOptionsValue() {
+
+ var selectedOption = options.selectValueMap[selectElement.val()];
+
+ if (selectedOption && !selectedOption.disabled) {
+ removeEmptyOption();
+ removeUnknownOption();
+ return options.getViewValueFromOption(selectedOption);
+ }
+ return null;
+ };
+
+ // If we are using `track by` then we must watch the tracked value on the model
+ // since ngModel only watches for object identity change
+ if (ngOptions.trackBy) {
+ scope.$watch(
+ function() { return ngOptions.getTrackByValue(ngModelCtrl.$viewValue); },
+ function() { ngModelCtrl.$render(); }
+ );
+ }
+
+ } else {
+
+ ngModelCtrl.$isEmpty = function(value) {
+ return !value || value.length === 0;
+ };
+
+
+ selectCtrl.writeValue = function writeNgOptionsMultiple(value) {
+ options.items.forEach(function(option) {
+ option.element.selected = false;
+ });
+
+ if (value) {
+ value.forEach(function(item) {
+ var option = options.getOptionFromViewValue(item);
+ if (option && !option.disabled) option.element.selected = true;
+ });
+ }
+ };
+
+
+ selectCtrl.readValue = function readNgOptionsMultiple() {
+ var selectedValues = selectElement.val() || [],
+ selections = [];
+
+ forEach(selectedValues, function(value) {
+ var option = options.selectValueMap[value];
+ if (option && !option.disabled) selections.push(options.getViewValueFromOption(option));
+ });
+
+ return selections;
+ };
+
+ // If we are using `track by` then we must watch these tracked values on the model
+ // since ngModel only watches for object identity change
+ if (ngOptions.trackBy) {
+
+ scope.$watchCollection(function() {
+ if (isArray(ngModelCtrl.$viewValue)) {
+ return ngModelCtrl.$viewValue.map(function(value) {
+ return ngOptions.getTrackByValue(value);
+ });
+ }
+ }, function() {
+ ngModelCtrl.$render();
+ });
+
+ }
+ }
+
+
+ if (providedEmptyOption) {
+
+ // we need to remove it before calling selectElement.empty() because otherwise IE will
+ // remove the label from the element. wtf?
+ emptyOption.remove();
+
+ // compile the element since there might be bindings in it
+ $compile(emptyOption)(scope);
+
+ // remove the class, which is added automatically because we recompile the element and it
+ // becomes the compilation root
+ emptyOption.removeClass('ng-scope');
+ } else {
+ emptyOption = jqLite(optionTemplate.cloneNode(false));
+ }
+
+ // We need to do this here to ensure that the options object is defined
+ // when we first hit it in writeNgOptionsValue
+ updateOptions();
+
+ // We will re-render the option elements if the option values or labels change
+ scope.$watchCollection(ngOptions.getWatchables, updateOptions);
+
+ // ------------------------------------------------------------------ //
+
+
+ function updateOptionElement(option, element) {
+ option.element = element;
+ element.disabled = option.disabled;
+ // NOTE: The label must be set before the value, otherwise IE10/11/EDGE create unresponsive
+ // selects in certain circumstances when multiple selects are next to each other and display
+ // the option list in listbox style, i.e. the select is [multiple], or specifies a [size].
+ // See https://github.com/angular/angular.js/issues/11314 for more info.
+ // This is unfortunately untestable with unit / e2e tests
+ if (option.label !== element.label) {
+ element.label = option.label;
+ element.textContent = option.label;
+ }
+ if (option.value !== element.value) element.value = option.selectValue;
+ }
+
+ function addOrReuseElement(parent, current, type, templateElement) {
+ var element;
+ // Check whether we can reuse the next element
+ if (current && lowercase(current.nodeName) === type) {
+ // The next element is the right type so reuse it
+ element = current;
+ } else {
+ // The next element is not the right type so create a new one
+ element = templateElement.cloneNode(false);
+ if (!current) {
+ // There are no more elements so just append it to the select
+ parent.appendChild(element);
+ } else {
+ // The next element is not a group so insert the new one
+ parent.insertBefore(element, current);
+ }
+ }
+ return element;
+ }
+
+
+ function removeExcessElements(current) {
+ var next;
+ while (current) {
+ next = current.nextSibling;
+ jqLiteRemove(current);
+ current = next;
+ }
+ }
+
+
+ function skipEmptyAndUnknownOptions(current) {
+ var emptyOption_ = emptyOption && emptyOption[0];
+ var unknownOption_ = unknownOption && unknownOption[0];
+
+ // We cannot rely on the extracted empty option being the same as the compiled empty option,
+ // because the compiled empty option might have been replaced by a comment because
+ // it had an "element" transclusion directive on it (such as ngIf)
+ if (emptyOption_ || unknownOption_) {
+ while (current &&
+ (current === emptyOption_ ||
+ current === unknownOption_ ||
+ current.nodeType === NODE_TYPE_COMMENT ||
+ (nodeName_(current) === 'option' && current.value === ''))) {
+ current = current.nextSibling;
+ }
+ }
+ return current;
+ }
+
+
+ function updateOptions() {
+
+ var previousValue = options && selectCtrl.readValue();
+
+ options = ngOptions.getOptions();
+
+ var groupMap = {};
+ var currentElement = selectElement[0].firstChild;
+
+ // Ensure that the empty option is always there if it was explicitly provided
+ if (providedEmptyOption) {
+ selectElement.prepend(emptyOption);
+ }
+
+ currentElement = skipEmptyAndUnknownOptions(currentElement);
+
+ options.items.forEach(function updateOption(option) {
+ var group;
+ var groupElement;
+ var optionElement;
+
+ if (isDefined(option.group)) {
+
+ // This option is to live in a group
+ // See if we have already created this group
+ group = groupMap[option.group];
+
+ if (!group) {
+
+ // We have not already created this group
+ groupElement = addOrReuseElement(selectElement[0],
+ currentElement,
+ 'optgroup',
+ optGroupTemplate);
+ // Move to the next element
+ currentElement = groupElement.nextSibling;
+
+ // Update the label on the group element
+ groupElement.label = option.group;
+
+ // Store it for use later
+ group = groupMap[option.group] = {
+ groupElement: groupElement,
+ currentOptionElement: groupElement.firstChild
+ };
+
+ }
+
+ // So now we have a group for this option we add the option to the group
+ optionElement = addOrReuseElement(group.groupElement,
+ group.currentOptionElement,
+ 'option',
+ optionTemplate);
+ updateOptionElement(option, optionElement);
+ // Move to the next element
+ group.currentOptionElement = optionElement.nextSibling;
+
+ } else {
+
+ // This option is not in a group
+ optionElement = addOrReuseElement(selectElement[0],
+ currentElement,
+ 'option',
+ optionTemplate);
+ updateOptionElement(option, optionElement);
+ // Move to the next element
+ currentElement = optionElement.nextSibling;
+ }
+ });
+
+
+ // Now remove all excess options and group
+ Object.keys(groupMap).forEach(function(key) {
+ removeExcessElements(groupMap[key].currentOptionElement);
+ });
+ removeExcessElements(currentElement);
+
+ ngModelCtrl.$render();
+
+ // Check to see if the value has changed due to the update to the options
+ if (!ngModelCtrl.$isEmpty(previousValue)) {
+ var nextValue = selectCtrl.readValue();
+ var isNotPrimitive = ngOptions.trackBy || multiple;
+ if (isNotPrimitive ? !equals(previousValue, nextValue) : previousValue !== nextValue) {
+ ngModelCtrl.$setViewValue(nextValue);
+ ngModelCtrl.$render();
+ }
+ }
+
+ }
+ }
+
+ return {
+ restrict: 'A',
+ terminal: true,
+ require: ['select', 'ngModel'],
+ link: {
+ pre: function ngOptionsPreLink(scope, selectElement, attr, ctrls) {
+ // Deactivate the SelectController.register method to prevent
+ // option directives from accidentally registering themselves
+ // (and unwanted $destroy handlers etc.)
+ ctrls[0].registerOption = noop;
+ },
+ post: ngOptionsPostLink
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngPluralize
+ * @restrict EA
+ *
+ * @description
+ * `ngPluralize` is a directive that displays messages according to en-US localization rules.
+ * These rules are bundled with angular.js, but can be overridden
+ * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive
+ * by specifying the mappings between
+ * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
+ * and the strings to be displayed.
+ *
+ * # Plural categories and explicit number rules
+ * There are two
+ * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
+ * in Angular's default en-US locale: "one" and "other".
+ *
+ * While a plural category may match many numbers (for example, in en-US locale, "other" can match
+ * any number that is not 1), an explicit number rule can only match one number. For example, the
+ * explicit number rule for "3" matches the number 3. There are examples of plural categories
+ * and explicit number rules throughout the rest of this documentation.
+ *
+ * # Configuring ngPluralize
+ * You configure ngPluralize by providing 2 attributes: `count` and `when`.
+ * You can also provide an optional attribute, `offset`.
+ *
+ * The value of the `count` attribute can be either a string or an {@link guide/expression
+ * Angular expression}; these are evaluated on the current scope for its bound value.
+ *
+ * The `when` attribute specifies the mappings between plural categories and the actual
+ * string to be displayed. The value of the attribute should be a JSON object.
+ *
+ * The following example shows how to configure ngPluralize:
+ *
+ * ```html
+ * <ng-pluralize count="personCount"
+ when="{'0': 'Nobody is viewing.',
+ * 'one': '1 person is viewing.',
+ * 'other': '{} people are viewing.'}">
+ * </ng-pluralize>
+ *```
+ *
+ * In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not
+ * specify this rule, 0 would be matched to the "other" category and "0 people are viewing"
+ * would be shown instead of "Nobody is viewing". You can specify an explicit number rule for
+ * other numbers, for example 12, so that instead of showing "12 people are viewing", you can
+ * show "a dozen people are viewing".
+ *
+ * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted
+ * into pluralized strings. In the previous example, Angular will replace `{}` with
+ * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder
+ * for <span ng-non-bindable>{{numberExpression}}</span>.
+ *
+ * If no rule is defined for a category, then an empty string is displayed and a warning is generated.
+ * Note that some locales define more categories than `one` and `other`. For example, fr-fr defines `few` and `many`.
+ *
+ * # Configuring ngPluralize with offset
+ * The `offset` attribute allows further customization of pluralized text, which can result in
+ * a better user experience. For example, instead of the message "4 people are viewing this document",
+ * you might display "John, Kate and 2 others are viewing this document".
+ * The offset attribute allows you to offset a number by any desired value.
+ * Let's take a look at an example:
+ *
+ * ```html
+ * <ng-pluralize count="personCount" offset=2
+ * when="{'0': 'Nobody is viewing.',
+ * '1': '{{person1}} is viewing.',
+ * '2': '{{person1}} and {{person2}} are viewing.',
+ * 'one': '{{person1}}, {{person2}} and one other person are viewing.',
+ * 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
+ * </ng-pluralize>
+ * ```
+ *
+ * Notice that we are still using two plural categories(one, other), but we added
+ * three explicit number rules 0, 1 and 2.
+ * When one person, perhaps John, views the document, "John is viewing" will be shown.
+ * When three people view the document, no explicit number rule is found, so
+ * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.
+ * In this case, plural category 'one' is matched and "John, Mary and one other person are viewing"
+ * is shown.
+ *
+ * Note that when you specify offsets, you must provide explicit number rules for
+ * numbers from 0 up to and including the offset. If you use an offset of 3, for example,
+ * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for
+ * plural categories "one" and "other".
+ *
+ * @param {string|expression} count The variable to be bound to.
+ * @param {string} when The mapping between plural category to its corresponding strings.
+ * @param {number=} offset Offset to deduct from the total number.
+ *
+ * @example
+ <example module="pluralizeExample">
+ <file name="index.html">
+ <script>
+ angular.module('pluralizeExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.person1 = 'Igor';
+ $scope.person2 = 'Misko';
+ $scope.personCount = 1;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>Person 1:<input type="text" ng-model="person1" value="Igor" /></label><br/>
+ <label>Person 2:<input type="text" ng-model="person2" value="Misko" /></label><br/>
+ <label>Number of People:<input type="text" ng-model="personCount" value="1" /></label><br/>
+
+ <!--- Example with simple pluralization rules for en locale --->
+ Without Offset:
+ <ng-pluralize count="personCount"
+ when="{'0': 'Nobody is viewing.',
+ 'one': '1 person is viewing.',
+ 'other': '{} people are viewing.'}">
+ </ng-pluralize><br>
+
+ <!--- Example with offset --->
+ With Offset(2):
+ <ng-pluralize count="personCount" offset=2
+ when="{'0': 'Nobody is viewing.',
+ '1': '{{person1}} is viewing.',
+ '2': '{{person1}} and {{person2}} are viewing.',
+ 'one': '{{person1}}, {{person2}} and one other person are viewing.',
+ 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
+ </ng-pluralize>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should show correct pluralized string', function() {
+ var withoutOffset = element.all(by.css('ng-pluralize')).get(0);
+ var withOffset = element.all(by.css('ng-pluralize')).get(1);
+ var countInput = element(by.model('personCount'));
+
+ expect(withoutOffset.getText()).toEqual('1 person is viewing.');
+ expect(withOffset.getText()).toEqual('Igor is viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('0');
+
+ expect(withoutOffset.getText()).toEqual('Nobody is viewing.');
+ expect(withOffset.getText()).toEqual('Nobody is viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('2');
+
+ expect(withoutOffset.getText()).toEqual('2 people are viewing.');
+ expect(withOffset.getText()).toEqual('Igor and Misko are viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('3');
+
+ expect(withoutOffset.getText()).toEqual('3 people are viewing.');
+ expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('4');
+
+ expect(withoutOffset.getText()).toEqual('4 people are viewing.');
+ expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.');
+ });
+ it('should show data-bound names', function() {
+ var withOffset = element.all(by.css('ng-pluralize')).get(1);
+ var personCount = element(by.model('personCount'));
+ var person1 = element(by.model('person1'));
+ var person2 = element(by.model('person2'));
+ personCount.clear();
+ personCount.sendKeys('4');
+ person1.clear();
+ person1.sendKeys('Di');
+ person2.clear();
+ person2.sendKeys('Vojta');
+ expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.');
+ });
+ </file>
+ </example>
+ */
+var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale, $interpolate, $log) {
+ var BRACE = /{}/g,
+ IS_WHEN = /^when(Minus)?(.+)$/;
+
+ return {
+ link: function(scope, element, attr) {
+ var numberExp = attr.count,
+ whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs
+ offset = attr.offset || 0,
+ whens = scope.$eval(whenExp) || {},
+ whensExpFns = {},
+ startSymbol = $interpolate.startSymbol(),
+ endSymbol = $interpolate.endSymbol(),
+ braceReplacement = startSymbol + numberExp + '-' + offset + endSymbol,
+ watchRemover = angular.noop,
+ lastCount;
+
+ forEach(attr, function(expression, attributeName) {
+ var tmpMatch = IS_WHEN.exec(attributeName);
+ if (tmpMatch) {
+ var whenKey = (tmpMatch[1] ? '-' : '') + lowercase(tmpMatch[2]);
+ whens[whenKey] = element.attr(attr.$attr[attributeName]);
+ }
+ });
+ forEach(whens, function(expression, key) {
+ whensExpFns[key] = $interpolate(expression.replace(BRACE, braceReplacement));
+
+ });
+
+ scope.$watch(numberExp, function ngPluralizeWatchAction(newVal) {
+ var count = parseFloat(newVal);
+ var countIsNaN = isNaN(count);
+
+ if (!countIsNaN && !(count in whens)) {
+ // If an explicit number rule such as 1, 2, 3... is defined, just use it.
+ // Otherwise, check it against pluralization rules in $locale service.
+ count = $locale.pluralCat(count - offset);
+ }
+
+ // If both `count` and `lastCount` are NaN, we don't need to re-register a watch.
+ // In JS `NaN !== NaN`, so we have to explicitly check.
+ if ((count !== lastCount) && !(countIsNaN && isNumber(lastCount) && isNaN(lastCount))) {
+ watchRemover();
+ var whenExpFn = whensExpFns[count];
+ if (isUndefined(whenExpFn)) {
+ if (newVal != null) {
+ $log.debug("ngPluralize: no rule defined for '" + count + "' in " + whenExp);
+ }
+ watchRemover = noop;
+ updateElementText();
+ } else {
+ watchRemover = scope.$watch(whenExpFn, updateElementText);
+ }
+ lastCount = count;
+ }
+ });
+
+ function updateElementText(newText) {
+ element.text(newText || '');
+ }
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngRepeat
+ * @multiElement
+ *
+ * @description
+ * The `ngRepeat` directive instantiates a template once per item from a collection. Each template
+ * instance gets its own scope, where the given loop variable is set to the current collection item,
+ * and `$index` is set to the item index or key.
+ *
+ * Special properties are exposed on the local scope of each template instance, including:
+ *
+ * | Variable | Type | Details |
+ * |-----------|-----------------|-----------------------------------------------------------------------------|
+ * | `$index` | {@type number} | iterator offset of the repeated element (0..length-1) |
+ * | `$first` | {@type boolean} | true if the repeated element is first in the iterator. |
+ * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |
+ * | `$last` | {@type boolean} | true if the repeated element is last in the iterator. |
+ * | `$even` | {@type boolean} | true if the iterator position `$index` is even (otherwise false). |
+ * | `$odd` | {@type boolean} | true if the iterator position `$index` is odd (otherwise false). |
+ *
+ * <div class="alert alert-info">
+ * Creating aliases for these properties is possible with {@link ng.directive:ngInit `ngInit`}.
+ * This may be useful when, for instance, nesting ngRepeats.
+ * </div>
+ *
+ *
+ * # Iterating over object properties
+ *
+ * It is possible to get `ngRepeat` to iterate over the properties of an object using the following
+ * syntax:
+ *
+ * ```js
+ * <div ng-repeat="(key, value) in myObj"> ... </div>
+ * ```
+ *
+ * You need to be aware that the JavaScript specification does not define the order of keys
+ * returned for an object. (To mitigate this in Angular 1.3 the `ngRepeat` directive
+ * used to sort the keys alphabetically.)
+ *
+ * Version 1.4 removed the alphabetic sorting. We now rely on the order returned by the browser
+ * when running `for key in myObj`. It seems that browsers generally follow the strategy of providing
+ * keys in the order in which they were defined, although there are exceptions when keys are deleted
+ * and reinstated. See the [MDN page on `delete` for more info](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete#Cross-browser_notes).
+ *
+ * If this is not desired, the recommended workaround is to convert your object into an array
+ * that is sorted into the order that you prefer before providing it to `ngRepeat`. You could
+ * do this with a filter such as [toArrayFilter](http://ngmodules.org/modules/angular-toArrayFilter)
+ * or implement a `$watch` on the object yourself.
+ *
+ *
+ * # Tracking and Duplicates
+ *
+ * `ngRepeat` uses {@link $rootScope.Scope#$watchCollection $watchCollection} to detect changes in
+ * the collection. When a change happens, ngRepeat then makes the corresponding changes to the DOM:
+ *
+ * * When an item is added, a new instance of the template is added to the DOM.
+ * * When an item is removed, its template instance is removed from the DOM.
+ * * When items are reordered, their respective templates are reordered in the DOM.
+ *
+ * To minimize creation of DOM elements, `ngRepeat` uses a function
+ * to "keep track" of all items in the collection and their corresponding DOM elements.
+ * For example, if an item is added to the collection, ngRepeat will know that all other items
+ * already have DOM elements, and will not re-render them.
+ *
+ * The default tracking function (which tracks items by their identity) does not allow
+ * duplicate items in arrays. This is because when there are duplicates, it is not possible
+ * to maintain a one-to-one mapping between collection items and DOM elements.
+ *
+ * If you do need to repeat duplicate items, you can substitute the default tracking behavior
+ * with your own using the `track by` expression.
+ *
+ * For example, you may track items by the index of each item in the collection, using the
+ * special scope property `$index`:
+ * ```html
+ * <div ng-repeat="n in [42, 42, 43, 43] track by $index">
+ * {{n}}
+ * </div>
+ * ```
+ *
+ * You may also use arbitrary expressions in `track by`, including references to custom functions
+ * on the scope:
+ * ```html
+ * <div ng-repeat="n in [42, 42, 43, 43] track by myTrackingFunction(n)">
+ * {{n}}
+ * </div>
+ * ```
+ *
+ * <div class="alert alert-success">
+ * If you are working with objects that have an identifier property, you should track
+ * by the identifier instead of the whole object. Should you reload your data later, `ngRepeat`
+ * will not have to rebuild the DOM elements for items it has already rendered, even if the
+ * JavaScript objects in the collection have been substituted for new ones. For large collections,
+ * this significantly improves rendering performance. If you don't have a unique identifier,
+ * `track by $index` can also provide a performance boost.
+ * </div>
+ * ```html
+ * <div ng-repeat="model in collection track by model.id">
+ * {{model.name}}
+ * </div>
+ * ```
+ *
+ * When no `track by` expression is provided, it is equivalent to tracking by the built-in
+ * `$id` function, which tracks items by their identity:
+ * ```html
+ * <div ng-repeat="obj in collection track by $id(obj)">
+ * {{obj.prop}}
+ * </div>
+ * ```
+ *
+ * <div class="alert alert-warning">
+ * **Note:** `track by` must always be the last expression:
+ * </div>
+ * ```
+ * <div ng-repeat="model in collection | orderBy: 'id' as filtered_result track by model.id">
+ * {{model.name}}
+ * </div>
+ * ```
+ *
+ * # Special repeat start and end points
+ * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending
+ * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.
+ * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on)
+ * up to and including the ending HTML tag where **ng-repeat-end** is placed.
+ *
+ * The example below makes use of this feature:
+ * ```html
+ * <header ng-repeat-start="item in items">
+ * Header {{ item }}
+ * </header>
+ * <div class="body">
+ * Body {{ item }}
+ * </div>
+ * <footer ng-repeat-end>
+ * Footer {{ item }}
+ * </footer>
+ * ```
+ *
+ * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to:
+ * ```html
+ * <header>
+ * Header A
+ * </header>
+ * <div class="body">
+ * Body A
+ * </div>
+ * <footer>
+ * Footer A
+ * </footer>
+ * <header>
+ * Header B
+ * </header>
+ * <div class="body">
+ * Body B
+ * </div>
+ * <footer>
+ * Footer B
+ * </footer>
+ * ```
+ *
+ * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such
+ * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).
+ *
+ * @animations
+ * **.enter** - when a new item is added to the list or when an item is revealed after a filter
+ *
+ * **.leave** - when an item is removed from the list or when an item is filtered out
+ *
+ * **.move** - when an adjacent item is filtered out causing a reorder or when the item contents are reordered
+ *
+ * See the example below for defining CSS animations with ngRepeat.
+ *
+ * @element ANY
+ * @scope
+ * @priority 1000
+ * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These
+ * formats are currently supported:
+ *
+ * * `variable in expression` – where variable is the user defined loop variable and `expression`
+ * is a scope expression giving the collection to enumerate.
+ *
+ * For example: `album in artist.albums`.
+ *
+ * * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,
+ * and `expression` is the scope expression giving the collection to enumerate.
+ *
+ * For example: `(name, age) in {'adam':10, 'amalie':12}`.
+ *
+ * * `variable in expression track by tracking_expression` – You can also provide an optional tracking expression
+ * which can be used to associate the objects in the collection with the DOM elements. If no tracking expression
+ * is specified, ng-repeat associates elements by identity. It is an error to have
+ * more than one tracking expression value resolve to the same key. (This would mean that two distinct objects are
+ * mapped to the same DOM element, which is not possible.)
+ *
+ * Note that the tracking expression must come last, after any filters, and the alias expression.
+ *
+ * For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements
+ * will be associated by item identity in the array.
+ *
+ * For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique
+ * `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements
+ * with the corresponding item in the array by identity. Moving the same object in array would move the DOM
+ * element in the same way in the DOM.
+ *
+ * For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this
+ * case the object identity does not matter. Two objects are considered equivalent as long as their `id`
+ * property is same.
+ *
+ * For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter
+ * to items in conjunction with a tracking expression.
+ *
+ * * `variable in expression as alias_expression` – You can also provide an optional alias expression which will then store the
+ * intermediate results of the repeater after the filters have been applied. Typically this is used to render a special message
+ * when a filter is active on the repeater, but the filtered result set is empty.
+ *
+ * For example: `item in items | filter:x as results` will store the fragment of the repeated items as `results`, but only after
+ * the items have been processed through the filter.
+ *
+ * Please note that `as [variable name] is not an operator but rather a part of ngRepeat micro-syntax so it can be used only at the end
+ * (and not as operator, inside an expression).
+ *
+ * For example: `item in items | filter : x | orderBy : order | limitTo : limit as results` .
+ *
+ * @example
+ * This example uses `ngRepeat` to display a list of people. A filter is used to restrict the displayed
+ * results by name. New (entering) and removed (leaving) items are animated.
+ <example module="ngRepeat" name="ngRepeat" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <div ng-controller="repeatController">
+ I have {{friends.length}} friends. They are:
+ <input type="search" ng-model="q" placeholder="filter friends..." aria-label="filter friends" />
+ <ul class="example-animate-container">
+ <li class="animate-repeat" ng-repeat="friend in friends | filter:q as results">
+ [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
+ </li>
+ <li class="animate-repeat" ng-if="results.length == 0">
+ <strong>No results found...</strong>
+ </li>
+ </ul>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('ngRepeat', ['ngAnimate']).controller('repeatController', function($scope) {
+ $scope.friends = [
+ {name:'John', age:25, gender:'boy'},
+ {name:'Jessie', age:30, gender:'girl'},
+ {name:'Johanna', age:28, gender:'girl'},
+ {name:'Joy', age:15, gender:'girl'},
+ {name:'Mary', age:28, gender:'girl'},
+ {name:'Peter', age:95, gender:'boy'},
+ {name:'Sebastian', age:50, gender:'boy'},
+ {name:'Erika', age:27, gender:'girl'},
+ {name:'Patrick', age:40, gender:'boy'},
+ {name:'Samantha', age:60, gender:'girl'}
+ ];
+ });
+ </file>
+ <file name="animations.css">
+ .example-animate-container {
+ background:white;
+ border:1px solid black;
+ list-style:none;
+ margin:0;
+ padding:0 10px;
+ }
+
+ .animate-repeat {
+ line-height:30px;
+ list-style:none;
+ box-sizing:border-box;
+ }
+
+ .animate-repeat.ng-move,
+ .animate-repeat.ng-enter,
+ .animate-repeat.ng-leave {
+ transition:all linear 0.5s;
+ }
+
+ .animate-repeat.ng-leave.ng-leave-active,
+ .animate-repeat.ng-move,
+ .animate-repeat.ng-enter {
+ opacity:0;
+ max-height:0;
+ }
+
+ .animate-repeat.ng-leave,
+ .animate-repeat.ng-move.ng-move-active,
+ .animate-repeat.ng-enter.ng-enter-active {
+ opacity:1;
+ max-height:30px;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var friends = element.all(by.repeater('friend in friends'));
+
+ it('should render initial data set', function() {
+ expect(friends.count()).toBe(10);
+ expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.');
+ expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.');
+ expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.');
+ expect(element(by.binding('friends.length')).getText())
+ .toMatch("I have 10 friends. They are:");
+ });
+
+ it('should update repeater when filter predicate changes', function() {
+ expect(friends.count()).toBe(10);
+
+ element(by.model('q')).sendKeys('ma');
+
+ expect(friends.count()).toBe(2);
+ expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');
+ expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.');
+ });
+ </file>
+ </example>
+ */
+var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
+ var NG_REMOVED = '$$NG_REMOVED';
+ var ngRepeatMinErr = minErr('ngRepeat');
+
+ var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {
+ // TODO(perf): generate setters to shave off ~40ms or 1-1.5%
+ scope[valueIdentifier] = value;
+ if (keyIdentifier) scope[keyIdentifier] = key;
+ scope.$index = index;
+ scope.$first = (index === 0);
+ scope.$last = (index === (arrayLength - 1));
+ scope.$middle = !(scope.$first || scope.$last);
+ // jshint bitwise: false
+ scope.$odd = !(scope.$even = (index&1) === 0);
+ // jshint bitwise: true
+ };
+
+ var getBlockStart = function(block) {
+ return block.clone[0];
+ };
+
+ var getBlockEnd = function(block) {
+ return block.clone[block.clone.length - 1];
+ };
+
+
+ return {
+ restrict: 'A',
+ multiElement: true,
+ transclude: 'element',
+ priority: 1000,
+ terminal: true,
+ $$tlb: true,
+ compile: function ngRepeatCompile($element, $attr) {
+ var expression = $attr.ngRepeat;
+ var ngRepeatEndComment = document.createComment(' end ngRepeat: ' + expression + ' ');
+
+ var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
+
+ if (!match) {
+ throw ngRepeatMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",
+ expression);
+ }
+
+ var lhs = match[1];
+ var rhs = match[2];
+ var aliasAs = match[3];
+ var trackByExp = match[4];
+
+ match = lhs.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/);
+
+ if (!match) {
+ throw ngRepeatMinErr('iidexp', "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",
+ lhs);
+ }
+ var valueIdentifier = match[3] || match[1];
+ var keyIdentifier = match[2];
+
+ if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) ||
+ /^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(aliasAs))) {
+ throw ngRepeatMinErr('badident', "alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.",
+ aliasAs);
+ }
+
+ var trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn;
+ var hashFnLocals = {$id: hashKey};
+
+ if (trackByExp) {
+ trackByExpGetter = $parse(trackByExp);
+ } else {
+ trackByIdArrayFn = function(key, value) {
+ return hashKey(value);
+ };
+ trackByIdObjFn = function(key) {
+ return key;
+ };
+ }
+
+ return function ngRepeatLink($scope, $element, $attr, ctrl, $transclude) {
+
+ if (trackByExpGetter) {
+ trackByIdExpFn = function(key, value, index) {
+ // assign key, value, and $index to the locals so that they can be used in hash functions
+ if (keyIdentifier) hashFnLocals[keyIdentifier] = key;
+ hashFnLocals[valueIdentifier] = value;
+ hashFnLocals.$index = index;
+ return trackByExpGetter($scope, hashFnLocals);
+ };
+ }
+
+ // Store a list of elements from previous run. This is a hash where key is the item from the
+ // iterator, and the value is objects with following properties.
+ // - scope: bound scope
+ // - element: previous element.
+ // - index: position
+ //
+ // We are using no-proto object so that we don't need to guard against inherited props via
+ // hasOwnProperty.
+ var lastBlockMap = createMap();
+
+ //watch props
+ $scope.$watchCollection(rhs, function ngRepeatAction(collection) {
+ var index, length,
+ previousNode = $element[0], // node that cloned nodes should be inserted after
+ // initialized to the comment node anchor
+ nextNode,
+ // Same as lastBlockMap but it has the current state. It will become the
+ // lastBlockMap on the next iteration.
+ nextBlockMap = createMap(),
+ collectionLength,
+ key, value, // key/value of iteration
+ trackById,
+ trackByIdFn,
+ collectionKeys,
+ block, // last object information {scope, element, id}
+ nextBlockOrder,
+ elementsToRemove;
+
+ if (aliasAs) {
+ $scope[aliasAs] = collection;
+ }
+
+ if (isArrayLike(collection)) {
+ collectionKeys = collection;
+ trackByIdFn = trackByIdExpFn || trackByIdArrayFn;
+ } else {
+ trackByIdFn = trackByIdExpFn || trackByIdObjFn;
+ // if object, extract keys, in enumeration order, unsorted
+ collectionKeys = [];
+ for (var itemKey in collection) {
+ if (hasOwnProperty.call(collection, itemKey) && itemKey.charAt(0) !== '$') {
+ collectionKeys.push(itemKey);
+ }
+ }
+ }
+
+ collectionLength = collectionKeys.length;
+ nextBlockOrder = new Array(collectionLength);
+
+ // locate existing items
+ for (index = 0; index < collectionLength; index++) {
+ key = (collection === collectionKeys) ? index : collectionKeys[index];
+ value = collection[key];
+ trackById = trackByIdFn(key, value, index);
+ if (lastBlockMap[trackById]) {
+ // found previously seen block
+ block = lastBlockMap[trackById];
+ delete lastBlockMap[trackById];
+ nextBlockMap[trackById] = block;
+ nextBlockOrder[index] = block;
+ } else if (nextBlockMap[trackById]) {
+ // if collision detected. restore lastBlockMap and throw an error
+ forEach(nextBlockOrder, function(block) {
+ if (block && block.scope) lastBlockMap[block.id] = block;
+ });
+ throw ngRepeatMinErr('dupes',
+ "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}",
+ expression, trackById, value);
+ } else {
+ // new never before seen block
+ nextBlockOrder[index] = {id: trackById, scope: undefined, clone: undefined};
+ nextBlockMap[trackById] = true;
+ }
+ }
+
+ // remove leftover items
+ for (var blockKey in lastBlockMap) {
+ block = lastBlockMap[blockKey];
+ elementsToRemove = getBlockNodes(block.clone);
+ $animate.leave(elementsToRemove);
+ if (elementsToRemove[0].parentNode) {
+ // if the element was not removed yet because of pending animation, mark it as deleted
+ // so that we can ignore it later
+ for (index = 0, length = elementsToRemove.length; index < length; index++) {
+ elementsToRemove[index][NG_REMOVED] = true;
+ }
+ }
+ block.scope.$destroy();
+ }
+
+ // we are not using forEach for perf reasons (trying to avoid #call)
+ for (index = 0; index < collectionLength; index++) {
+ key = (collection === collectionKeys) ? index : collectionKeys[index];
+ value = collection[key];
+ block = nextBlockOrder[index];
+
+ if (block.scope) {
+ // if we have already seen this object, then we need to reuse the
+ // associated scope/element
+
+ nextNode = previousNode;
+
+ // skip nodes that are already pending removal via leave animation
+ do {
+ nextNode = nextNode.nextSibling;
+ } while (nextNode && nextNode[NG_REMOVED]);
+
+ if (getBlockStart(block) != nextNode) {
+ // existing item which got moved
+ $animate.move(getBlockNodes(block.clone), null, jqLite(previousNode));
+ }
+ previousNode = getBlockEnd(block);
+ updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);
+ } else {
+ // new item which we don't know about
+ $transclude(function ngRepeatTransclude(clone, scope) {
+ block.scope = scope;
+ // http://jsperf.com/clone-vs-createcomment
+ var endNode = ngRepeatEndComment.cloneNode(false);
+ clone[clone.length++] = endNode;
+
+ // TODO(perf): support naked previousNode in `enter` to avoid creation of jqLite wrapper?
+ $animate.enter(clone, null, jqLite(previousNode));
+ previousNode = endNode;
+ // Note: We only need the first/last node of the cloned nodes.
+ // However, we need to keep the reference to the jqlite wrapper as it might be changed later
+ // by a directive with templateUrl when its template arrives.
+ block.clone = clone;
+ nextBlockMap[block.id] = block;
+ updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);
+ });
+ }
+ }
+ lastBlockMap = nextBlockMap;
+ });
+ };
+ }
+ };
+}];
+
+var NG_HIDE_CLASS = 'ng-hide';
+var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
+/**
+ * @ngdoc directive
+ * @name ngShow
+ * @multiElement
+ *
+ * @description
+ * The `ngShow` directive shows or hides the given HTML element based on the expression
+ * provided to the `ngShow` attribute. The element is shown or hidden by removing or adding
+ * the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+ * in AngularJS and sets the display style to none (using an !important flag).
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```html
+ * <!-- when $scope.myValue is truthy (element is visible) -->
+ * <div ng-show="myValue"></div>
+ *
+ * <!-- when $scope.myValue is falsy (element is hidden) -->
+ * <div ng-show="myValue" class="ng-hide"></div>
+ * ```
+ *
+ * When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added to the class
+ * attribute on the element causing it to become hidden. When truthy, the `.ng-hide` CSS class is removed
+ * from the element causing the element not to appear hidden.
+ *
+ * ## Why is !important used?
+ *
+ * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
+ * can be easily overridden by heavier selectors. For example, something as simple
+ * as changing the display style on a HTML list item would make hidden elements appear visible.
+ * This also becomes a bigger issue when dealing with CSS frameworks.
+ *
+ * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+ * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+ * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
+ *
+ * ### Overriding `.ng-hide`
+ *
+ * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
+ * class CSS. Note that the selector that needs to be used is actually `.ng-hide:not(.ng-hide-animate)` to cope
+ * with extra animation classes that can be added.
+ *
+ * ```css
+ * .ng-hide:not(.ng-hide-animate) {
+ * /&#42; this is just another form of hiding an element &#42;/
+ * display: block!important;
+ * position: absolute;
+ * top: -9999px;
+ * left: -9999px;
+ * }
+ * ```
+ *
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
+ *
+ * ## A note about animations with `ngShow`
+ *
+ * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+ * is true and false. This system works like the animation system present with ngClass except that
+ * you must also include the !important flag to override the display property
+ * so that you can perform an animation when the element is hidden during the time of the animation.
+ *
+ * ```css
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
+ * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ * /&#42; this is required as of 1.3x to properly
+ * apply all styling in a show/hide animation &#42;/
+ * transition: 0s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add-active,
+ * .my-element.ng-hide-remove-active {
+ * /&#42; the transition is defined in the active class &#42;/
+ * transition: 1s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add { ... }
+ * .my-element.ng-hide-add.ng-hide-add-active { ... }
+ * .my-element.ng-hide-remove { ... }
+ * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+ * ```
+ *
+ * Keep in mind that, as of AngularJS version 1.3.0-beta.11, there is no need to change the display
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
+ *
+ * @animations
+ * addClass: `.ng-hide` - happens after the `ngShow` expression evaluates to a truthy value and the just before contents are set to visible
+ * removeClass: `.ng-hide` - happens after the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden
+ *
+ * @element ANY
+ * @param {expression} ngShow If the {@link guide/expression expression} is truthy
+ * then the element is shown or hidden respectively.
+ *
+ * @example
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ Click me: <input type="checkbox" ng-model="checked" aria-label="Toggle ngHide"><br/>
+ <div>
+ Show:
+ <div class="check-element animate-show" ng-show="checked">
+ <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+ </div>
+ </div>
+ <div>
+ Hide:
+ <div class="check-element animate-show" ng-hide="checked">
+ <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+ </div>
+ </div>
+ </file>
+ <file name="glyphicons.css">
+ @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);
+ </file>
+ <file name="animations.css">
+ .animate-show {
+ line-height: 20px;
+ opacity: 1;
+ padding: 10px;
+ border: 1px solid black;
+ background: white;
+ }
+
+ .animate-show.ng-hide-add, .animate-show.ng-hide-remove {
+ transition: all linear 0.5s;
+ }
+
+ .animate-show.ng-hide {
+ line-height: 0;
+ opacity: 0;
+ padding: 0 10px;
+ }
+
+ .check-element {
+ padding: 10px;
+ border: 1px solid black;
+ background: white;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+ var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+ it('should check ng-show / ng-hide', function() {
+ expect(thumbsUp.isDisplayed()).toBeFalsy();
+ expect(thumbsDown.isDisplayed()).toBeTruthy();
+
+ element(by.model('checked')).click();
+
+ expect(thumbsUp.isDisplayed()).toBeTruthy();
+ expect(thumbsDown.isDisplayed()).toBeFalsy();
+ });
+ </file>
+ </example>
+ */
+var ngShowDirective = ['$animate', function($animate) {
+ return {
+ restrict: 'A',
+ multiElement: true,
+ link: function(scope, element, attr) {
+ scope.$watch(attr.ngShow, function ngShowWatchAction(value) {
+ // we're adding a temporary, animation-specific class for ng-hide since this way
+ // we can control when the element is actually displayed on screen without having
+ // to have a global/greedy CSS selector that breaks when other animations are run.
+ // Read: https://github.com/angular/angular.js/issues/9103#issuecomment-58335845
+ $animate[value ? 'removeClass' : 'addClass'](element, NG_HIDE_CLASS, {
+ tempClasses: NG_HIDE_IN_PROGRESS_CLASS
+ });
+ });
+ }
+ };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngHide
+ * @multiElement
+ *
+ * @description
+ * The `ngHide` directive shows or hides the given HTML element based on the expression
+ * provided to the `ngHide` attribute. The element is shown or hidden by removing or adding
+ * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+ * in AngularJS and sets the display style to none (using an !important flag).
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```html
+ * <!-- when $scope.myValue is truthy (element is hidden) -->
+ * <div ng-hide="myValue" class="ng-hide"></div>
+ *
+ * <!-- when $scope.myValue is falsy (element is visible) -->
+ * <div ng-hide="myValue"></div>
+ * ```
+ *
+ * When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added to the class
+ * attribute on the element causing it to become hidden. When falsy, the `.ng-hide` CSS class is removed
+ * from the element causing the element not to appear hidden.
+ *
+ * ## Why is !important used?
+ *
+ * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
+ * can be easily overridden by heavier selectors. For example, something as simple
+ * as changing the display style on a HTML list item would make hidden elements appear visible.
+ * This also becomes a bigger issue when dealing with CSS frameworks.
+ *
+ * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+ * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+ * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
+ *
+ * ### Overriding `.ng-hide`
+ *
+ * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
+ * class in CSS:
+ *
+ * ```css
+ * .ng-hide {
+ * /&#42; this is just another form of hiding an element &#42;/
+ * display: block!important;
+ * position: absolute;
+ * top: -9999px;
+ * left: -9999px;
+ * }
+ * ```
+ *
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
+ *
+ * ## A note about animations with `ngHide`
+ *
+ * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+ * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`
+ * CSS class is added and removed for you instead of your own CSS class.
+ *
+ * ```css
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
+ * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ * transition: 0.5s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add { ... }
+ * .my-element.ng-hide-add.ng-hide-add-active { ... }
+ * .my-element.ng-hide-remove { ... }
+ * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+ * ```
+ *
+ * Keep in mind that, as of AngularJS version 1.3.0-beta.11, there is no need to change the display
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
+ *
+ * @animations
+ * removeClass: `.ng-hide` - happens after the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden
+ * addClass: `.ng-hide` - happens after the `ngHide` expression evaluates to a non truthy value and just before the contents are set to visible
+ *
+ * @element ANY
+ * @param {expression} ngHide If the {@link guide/expression expression} is truthy then
+ * the element is shown or hidden respectively.
+ *
+ * @example
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ Click me: <input type="checkbox" ng-model="checked" aria-label="Toggle ngShow"><br/>
+ <div>
+ Show:
+ <div class="check-element animate-hide" ng-show="checked">
+ <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+ </div>
+ </div>
+ <div>
+ Hide:
+ <div class="check-element animate-hide" ng-hide="checked">
+ <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+ </div>
+ </div>
+ </file>
+ <file name="glyphicons.css">
+ @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);
+ </file>
+ <file name="animations.css">
+ .animate-hide {
+ transition: all linear 0.5s;
+ line-height: 20px;
+ opacity: 1;
+ padding: 10px;
+ border: 1px solid black;
+ background: white;
+ }
+
+ .animate-hide.ng-hide {
+ line-height: 0;
+ opacity: 0;
+ padding: 0 10px;
+ }
+
+ .check-element {
+ padding: 10px;
+ border: 1px solid black;
+ background: white;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+ var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+ it('should check ng-show / ng-hide', function() {
+ expect(thumbsUp.isDisplayed()).toBeFalsy();
+ expect(thumbsDown.isDisplayed()).toBeTruthy();
+
+ element(by.model('checked')).click();
+
+ expect(thumbsUp.isDisplayed()).toBeTruthy();
+ expect(thumbsDown.isDisplayed()).toBeFalsy();
+ });
+ </file>
+ </example>
+ */
+var ngHideDirective = ['$animate', function($animate) {
+ return {
+ restrict: 'A',
+ multiElement: true,
+ link: function(scope, element, attr) {
+ scope.$watch(attr.ngHide, function ngHideWatchAction(value) {
+ // The comment inside of the ngShowDirective explains why we add and
+ // remove a temporary class for the show/hide animation
+ $animate[value ? 'addClass' : 'removeClass'](element,NG_HIDE_CLASS, {
+ tempClasses: NG_HIDE_IN_PROGRESS_CLASS
+ });
+ });
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngStyle
+ * @restrict AC
+ *
+ * @description
+ * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.
+ *
+ * @element ANY
+ * @param {expression} ngStyle
+ *
+ * {@link guide/expression Expression} which evals to an
+ * object whose keys are CSS style names and values are corresponding values for those CSS
+ * keys.
+ *
+ * Since some CSS style names are not valid keys for an object, they must be quoted.
+ * See the 'background-color' style in the example below.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input type="button" value="set color" ng-click="myStyle={color:'red'}">
+ <input type="button" value="set background" ng-click="myStyle={'background-color':'blue'}">
+ <input type="button" value="clear" ng-click="myStyle={}">
+ <br/>
+ <span ng-style="myStyle">Sample Text</span>
+ <pre>myStyle={{myStyle}}</pre>
+ </file>
+ <file name="style.css">
+ span {
+ color: black;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var colorSpan = element(by.css('span'));
+
+ it('should check ng-style', function() {
+ expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
+ element(by.css('input[value=\'set color\']')).click();
+ expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');
+ element(by.css('input[value=clear]')).click();
+ expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
+ });
+ </file>
+ </example>
+ */
+var ngStyleDirective = ngDirective(function(scope, element, attr) {
+ scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
+ if (oldStyles && (newStyles !== oldStyles)) {
+ forEach(oldStyles, function(val, style) { element.css(style, '');});
+ }
+ if (newStyles) element.css(newStyles);
+ }, true);
+});
+
+/**
+ * @ngdoc directive
+ * @name ngSwitch
+ * @restrict EA
+ *
+ * @description
+ * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.
+ * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location
+ * as specified in the template.
+ *
+ * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
+ * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element
+ * matches the value obtained from the evaluated expression. In other words, you define a container element
+ * (where you place the directive), place an expression on the **`on="..."` attribute**
+ * (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place
+ * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on
+ * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default
+ * attribute is displayed.
+ *
+ * <div class="alert alert-info">
+ * Be aware that the attribute values to match against cannot be expressions. They are interpreted
+ * as literal string values to match against.
+ * For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the
+ * value of the expression `$scope.someVal`.
+ * </div>
+
+ * @animations
+ * enter - happens after the ngSwitch contents change and the matched child element is placed inside the container
+ * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM
+ *
+ * @usage
+ *
+ * ```
+ * <ANY ng-switch="expression">
+ * <ANY ng-switch-when="matchValue1">...</ANY>
+ * <ANY ng-switch-when="matchValue2">...</ANY>
+ * <ANY ng-switch-default>...</ANY>
+ * </ANY>
+ * ```
+ *
+ *
+ * @scope
+ * @priority 1200
+ * @param {*} ngSwitch|on expression to match against <code>ng-switch-when</code>.
+ * On child elements add:
+ *
+ * * `ngSwitchWhen`: the case statement to match against. If match then this
+ * case will be displayed. If the same match appears multiple times, all the
+ * elements will be displayed.
+ * * `ngSwitchDefault`: the default case when no other case match. If there
+ * are multiple default cases, all of them will be displayed when no other
+ * case match.
+ *
+ *
+ * @example
+ <example module="switchExample" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <select ng-model="selection" ng-options="item for item in items">
+ </select>
+ <code>selection={{selection}}</code>
+ <hr/>
+ <div class="animate-switch-container"
+ ng-switch on="selection">
+ <div class="animate-switch" ng-switch-when="settings">Settings Div</div>
+ <div class="animate-switch" ng-switch-when="home">Home Span</div>
+ <div class="animate-switch" ng-switch-default>default</div>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('switchExample', ['ngAnimate'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.items = ['settings', 'home', 'other'];
+ $scope.selection = $scope.items[0];
+ }]);
+ </file>
+ <file name="animations.css">
+ .animate-switch-container {
+ position:relative;
+ background:white;
+ border:1px solid black;
+ height:40px;
+ overflow:hidden;
+ }
+
+ .animate-switch {
+ padding:10px;
+ }
+
+ .animate-switch.ng-animate {
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+
+ position:absolute;
+ top:0;
+ left:0;
+ right:0;
+ bottom:0;
+ }
+
+ .animate-switch.ng-leave.ng-leave-active,
+ .animate-switch.ng-enter {
+ top:-50px;
+ }
+ .animate-switch.ng-leave,
+ .animate-switch.ng-enter.ng-enter-active {
+ top:0;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var switchElem = element(by.css('[ng-switch]'));
+ var select = element(by.model('selection'));
+
+ it('should start in settings', function() {
+ expect(switchElem.getText()).toMatch(/Settings Div/);
+ });
+ it('should change to home', function() {
+ select.all(by.css('option')).get(1).click();
+ expect(switchElem.getText()).toMatch(/Home Span/);
+ });
+ it('should select default', function() {
+ select.all(by.css('option')).get(2).click();
+ expect(switchElem.getText()).toMatch(/default/);
+ });
+ </file>
+ </example>
+ */
+var ngSwitchDirective = ['$animate', function($animate) {
+ return {
+ require: 'ngSwitch',
+
+ // asks for $scope to fool the BC controller module
+ controller: ['$scope', function ngSwitchController() {
+ this.cases = {};
+ }],
+ link: function(scope, element, attr, ngSwitchController) {
+ var watchExpr = attr.ngSwitch || attr.on,
+ selectedTranscludes = [],
+ selectedElements = [],
+ previousLeaveAnimations = [],
+ selectedScopes = [];
+
+ var spliceFactory = function(array, index) {
+ return function() { array.splice(index, 1); };
+ };
+
+ scope.$watch(watchExpr, function ngSwitchWatchAction(value) {
+ var i, ii;
+ for (i = 0, ii = previousLeaveAnimations.length; i < ii; ++i) {
+ $animate.cancel(previousLeaveAnimations[i]);
+ }
+ previousLeaveAnimations.length = 0;
+
+ for (i = 0, ii = selectedScopes.length; i < ii; ++i) {
+ var selected = getBlockNodes(selectedElements[i].clone);
+ selectedScopes[i].$destroy();
+ var promise = previousLeaveAnimations[i] = $animate.leave(selected);
+ promise.then(spliceFactory(previousLeaveAnimations, i));
+ }
+
+ selectedElements.length = 0;
+ selectedScopes.length = 0;
+
+ if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {
+ forEach(selectedTranscludes, function(selectedTransclude) {
+ selectedTransclude.transclude(function(caseElement, selectedScope) {
+ selectedScopes.push(selectedScope);
+ var anchor = selectedTransclude.element;
+ caseElement[caseElement.length++] = document.createComment(' end ngSwitchWhen: ');
+ var block = { clone: caseElement };
+
+ selectedElements.push(block);
+ $animate.enter(caseElement, anchor.parent(), anchor);
+ });
+ });
+ }
+ });
+ }
+ };
+}];
+
+var ngSwitchWhenDirective = ngDirective({
+ transclude: 'element',
+ priority: 1200,
+ require: '^ngSwitch',
+ multiElement: true,
+ link: function(scope, element, attrs, ctrl, $transclude) {
+ ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);
+ ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });
+ }
+});
+
+var ngSwitchDefaultDirective = ngDirective({
+ transclude: 'element',
+ priority: 1200,
+ require: '^ngSwitch',
+ multiElement: true,
+ link: function(scope, element, attr, ctrl, $transclude) {
+ ctrl.cases['?'] = (ctrl.cases['?'] || []);
+ ctrl.cases['?'].push({ transclude: $transclude, element: element });
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngTransclude
+ * @restrict EAC
+ *
+ * @description
+ * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
+ *
+ * You can specify that you want to insert a named transclusion slot, instead of the default slot, by providing the slot name
+ * as the value of the `ng-transclude` or `ng-transclude-slot` attribute.
+ *
+ * If the transcluded content is not empty (i.e. contains one or more DOM nodes, including whitespace text nodes), any existing
+ * content of this element will be removed before the transcluded content is inserted.
+ * If the transcluded content is empty, the existing content is left intact. This lets you provide fallback content in the case
+ * that no transcluded content is provided.
+ *
+ * @element ANY
+ *
+ * @param {string} ngTransclude|ngTranscludeSlot the name of the slot to insert at this point. If this is not provided, is empty
+ * or its value is the same as the name of the attribute then the default slot is used.
+ *
+ * @example
+ * ### Basic transclusion
+ * This example demonstrates basic transclusion of content into a component directive.
+ * <example name="simpleTranscludeExample" module="transcludeExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('transcludeExample', [])
+ * .directive('pane', function(){
+ * return {
+ * restrict: 'E',
+ * transclude: true,
+ * scope: { title:'@' },
+ * template: '<div style="border: 1px solid black;">' +
+ * '<div style="background-color: gray">{{title}}</div>' +
+ * '<ng-transclude></ng-transclude>' +
+ * '</div>'
+ * };
+ * })
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.title = 'Lorem Ipsum';
+ * $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <input ng-model="title" aria-label="title"> <br/>
+ * <textarea ng-model="text" aria-label="text"></textarea> <br/>
+ * <pane title="{{title}}">{{text}}</pane>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should have transcluded', function() {
+ * var titleElement = element(by.model('title'));
+ * titleElement.clear();
+ * titleElement.sendKeys('TITLE');
+ * var textElement = element(by.model('text'));
+ * textElement.clear();
+ * textElement.sendKeys('TEXT');
+ * expect(element(by.binding('title')).getText()).toEqual('TITLE');
+ * expect(element(by.binding('text')).getText()).toEqual('TEXT');
+ * });
+ * </file>
+ * </example>
+ *
+ * @example
+ * ### Transclude fallback content
+ * This example shows how to use `NgTransclude` with fallback content, that
+ * is displayed if no transcluded content is provided.
+ *
+ * <example module="transcludeFallbackContentExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('transcludeFallbackContentExample', [])
+ * .directive('myButton', function(){
+ * return {
+ * restrict: 'E',
+ * transclude: true,
+ * scope: true,
+ * template: '<button style="cursor: pointer;">' +
+ * '<ng-transclude>' +
+ * '<b style="color: red;">Button1</b>' +
+ * '</ng-transclude>' +
+ * '</button>'
+ * };
+ * });
+ * </script>
+ * <!-- fallback button content -->
+ * <my-button id="fallback"></my-button>
+ * <!-- modified button content -->
+ * <my-button id="modified">
+ * <i style="color: green;">Button2</i>
+ * </my-button>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should have different transclude element content', function() {
+ * expect(element(by.id('fallback')).getText()).toBe('Button1');
+ * expect(element(by.id('modified')).getText()).toBe('Button2');
+ * });
+ * </file>
+ * </example>
+ *
+ * @example
+ * ### Multi-slot transclusion
+ * This example demonstrates using multi-slot transclusion in a component directive.
+ * <example name="multiSlotTranscludeExample" module="multiSlotTranscludeExample">
+ * <file name="index.html">
+ * <style>
+ * .title, .footer {
+ * background-color: gray
+ * }
+ * </style>
+ * <div ng-controller="ExampleController">
+ * <input ng-model="title" aria-label="title"> <br/>
+ * <textarea ng-model="text" aria-label="text"></textarea> <br/>
+ * <pane>
+ * <pane-title><a ng-href="{{link}}">{{title}}</a></pane-title>
+ * <pane-body><p>{{text}}</p></pane-body>
+ * </pane>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('multiSlotTranscludeExample', [])
+ * .directive('pane', function(){
+ * return {
+ * restrict: 'E',
+ * transclude: {
+ * 'title': '?paneTitle',
+ * 'body': 'paneBody',
+ * 'footer': '?paneFooter'
+ * },
+ * template: '<div style="border: 1px solid black;">' +
+ * '<div class="title" ng-transclude="title">Fallback Title</div>' +
+ * '<div ng-transclude="body"></div>' +
+ * '<div class="footer" ng-transclude="footer">Fallback Footer</div>' +
+ * '</div>'
+ * };
+ * })
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.title = 'Lorem Ipsum';
+ * $scope.link = "https://google.com";
+ * $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
+ * }]);
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should have transcluded the title and the body', function() {
+ * var titleElement = element(by.model('title'));
+ * titleElement.clear();
+ * titleElement.sendKeys('TITLE');
+ * var textElement = element(by.model('text'));
+ * textElement.clear();
+ * textElement.sendKeys('TEXT');
+ * expect(element(by.css('.title')).getText()).toEqual('TITLE');
+ * expect(element(by.binding('text')).getText()).toEqual('TEXT');
+ * expect(element(by.css('.footer')).getText()).toEqual('Fallback Footer');
+ * });
+ * </file>
+ * </example>
+ */
+var ngTranscludeMinErr = minErr('ngTransclude');
+var ngTranscludeDirective = ngDirective({
+ restrict: 'EAC',
+ link: function($scope, $element, $attrs, controller, $transclude) {
+
+ if ($attrs.ngTransclude === $attrs.$attr.ngTransclude) {
+ // If the attribute is of the form: `ng-transclude="ng-transclude"`
+ // then treat it like the default
+ $attrs.ngTransclude = '';
+ }
+
+ function ngTranscludeCloneAttachFn(clone) {
+ if (clone.length) {
+ $element.empty();
+ $element.append(clone);
+ }
+ }
+
+ if (!$transclude) {
+ throw ngTranscludeMinErr('orphan',
+ 'Illegal use of ngTransclude directive in the template! ' +
+ 'No parent directive that requires a transclusion found. ' +
+ 'Element: {0}',
+ startingTag($element));
+ }
+
+ // If there is no slot name defined or the slot name is not optional
+ // then transclude the slot
+ var slotName = $attrs.ngTransclude || $attrs.ngTranscludeSlot;
+ $transclude(ngTranscludeCloneAttachFn, null, slotName);
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name script
+ * @restrict E
+ *
+ * @description
+ * Load the content of a `<script>` element into {@link ng.$templateCache `$templateCache`}, so that the
+ * template can be used by {@link ng.directive:ngInclude `ngInclude`},
+ * {@link ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the
+ * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be
+ * assigned through the element's `id`, which can then be used as a directive's `templateUrl`.
+ *
+ * @param {string} type Must be set to `'text/ng-template'`.
+ * @param {string} id Cache name of the template.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <script type="text/ng-template" id="/tpl.html">
+ Content of the template.
+ </script>
+
+ <a ng-click="currentTpl='/tpl.html'" id="tpl-link">Load inlined template</a>
+ <div id="tpl-content" ng-include src="currentTpl"></div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should load template defined inside script tag', function() {
+ element(by.css('#tpl-link')).click();
+ expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);
+ });
+ </file>
+ </example>
+ */
+var scriptDirective = ['$templateCache', function($templateCache) {
+ return {
+ restrict: 'E',
+ terminal: true,
+ compile: function(element, attr) {
+ if (attr.type == 'text/ng-template') {
+ var templateUrl = attr.id,
+ text = element[0].text;
+
+ $templateCache.put(templateUrl, text);
+ }
+ }
+ };
+}];
+
+var noopNgModelController = { $setViewValue: noop, $render: noop };
+
+function chromeHack(optionElement) {
+ // Workaround for https://code.google.com/p/chromium/issues/detail?id=381459
+ // Adding an <option selected="selected"> element to a <select required="required"> should
+ // automatically select the new element
+ if (optionElement[0].hasAttribute('selected')) {
+ optionElement[0].selected = true;
+ }
+}
+
+/**
+ * @ngdoc type
+ * @name select.SelectController
+ * @description
+ * The controller for the `<select>` directive. This provides support for reading
+ * and writing the selected value(s) of the control and also coordinates dynamically
+ * added `<option>` elements, perhaps by an `ngRepeat` directive.
+ */
+var SelectController =
+ ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {
+
+ var self = this,
+ optionsMap = new HashMap();
+
+ // If the ngModel doesn't get provided then provide a dummy noop version to prevent errors
+ self.ngModelCtrl = noopNgModelController;
+
+ // The "unknown" option is one that is prepended to the list if the viewValue
+ // does not match any of the options. When it is rendered the value of the unknown
+ // option is '? XXX ?' where XXX is the hashKey of the value that is not known.
+ //
+ // We can't just jqLite('<option>') since jqLite is not smart enough
+ // to create it in <select> and IE barfs otherwise.
+ self.unknownOption = jqLite(document.createElement('option'));
+ self.renderUnknownOption = function(val) {
+ var unknownVal = '? ' + hashKey(val) + ' ?';
+ self.unknownOption.val(unknownVal);
+ $element.prepend(self.unknownOption);
+ $element.val(unknownVal);
+ };
+
+ $scope.$on('$destroy', function() {
+ // disable unknown option so that we don't do work when the whole select is being destroyed
+ self.renderUnknownOption = noop;
+ });
+
+ self.removeUnknownOption = function() {
+ if (self.unknownOption.parent()) self.unknownOption.remove();
+ };
+
+
+ // Read the value of the select control, the implementation of this changes depending
+ // upon whether the select can have multiple values and whether ngOptions is at work.
+ self.readValue = function readSingleValue() {
+ self.removeUnknownOption();
+ return $element.val();
+ };
+
+
+ // Write the value to the select control, the implementation of this changes depending
+ // upon whether the select can have multiple values and whether ngOptions is at work.
+ self.writeValue = function writeSingleValue(value) {
+ if (self.hasOption(value)) {
+ self.removeUnknownOption();
+ $element.val(value);
+ if (value === '') self.emptyOption.prop('selected', true); // to make IE9 happy
+ } else {
+ if (value == null && self.emptyOption) {
+ self.removeUnknownOption();
+ $element.val('');
+ } else {
+ self.renderUnknownOption(value);
+ }
+ }
+ };
+
+
+ // Tell the select control that an option, with the given value, has been added
+ self.addOption = function(value, element) {
+ // Skip comment nodes, as they only pollute the `optionsMap`
+ if (element[0].nodeType === NODE_TYPE_COMMENT) return;
+
+ assertNotHasOwnProperty(value, '"option value"');
+ if (value === '') {
+ self.emptyOption = element;
+ }
+ var count = optionsMap.get(value) || 0;
+ optionsMap.put(value, count + 1);
+ self.ngModelCtrl.$render();
+ chromeHack(element);
+ };
+
+ // Tell the select control that an option, with the given value, has been removed
+ self.removeOption = function(value) {
+ var count = optionsMap.get(value);
+ if (count) {
+ if (count === 1) {
+ optionsMap.remove(value);
+ if (value === '') {
+ self.emptyOption = undefined;
+ }
+ } else {
+ optionsMap.put(value, count - 1);
+ }
+ }
+ };
+
+ // Check whether the select control has an option matching the given value
+ self.hasOption = function(value) {
+ return !!optionsMap.get(value);
+ };
+
+
+ self.registerOption = function(optionScope, optionElement, optionAttrs, interpolateValueFn, interpolateTextFn) {
+
+ if (interpolateValueFn) {
+ // The value attribute is interpolated
+ var oldVal;
+ optionAttrs.$observe('value', function valueAttributeObserveAction(newVal) {
+ if (isDefined(oldVal)) {
+ self.removeOption(oldVal);
+ }
+ oldVal = newVal;
+ self.addOption(newVal, optionElement);
+ });
+ } else if (interpolateTextFn) {
+ // The text content is interpolated
+ optionScope.$watch(interpolateTextFn, function interpolateWatchAction(newVal, oldVal) {
+ optionAttrs.$set('value', newVal);
+ if (oldVal !== newVal) {
+ self.removeOption(oldVal);
+ }
+ self.addOption(newVal, optionElement);
+ });
+ } else {
+ // The value attribute is static
+ self.addOption(optionAttrs.value, optionElement);
+ }
+
+ optionElement.on('$destroy', function() {
+ self.removeOption(optionAttrs.value);
+ self.ngModelCtrl.$render();
+ });
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name select
+ * @restrict E
+ *
+ * @description
+ * HTML `SELECT` element with angular data-binding.
+ *
+ * The `select` directive is used together with {@link ngModel `ngModel`} to provide data-binding
+ * between the scope and the `<select>` control (including setting default values).
+ * It also handles dynamic `<option>` elements, which can be added using the {@link ngRepeat `ngRepeat}` or
+ * {@link ngOptions `ngOptions`} directives.
+ *
+ * When an item in the `<select>` menu is selected, the value of the selected option will be bound
+ * to the model identified by the `ngModel` directive. With static or repeated options, this is
+ * the content of the `value` attribute or the textContent of the `<option>`, if the value attribute is missing.
+ * If you want dynamic value attributes, you can use interpolation inside the value attribute.
+ *
+ * <div class="alert alert-warning">
+ * Note that the value of a `select` directive used without `ngOptions` is always a string.
+ * When the model needs to be bound to a non-string value, you must either explicitly convert it
+ * using a directive (see example below) or use `ngOptions` to specify the set of options.
+ * This is because an option element can only be bound to string values at present.
+ * </div>
+ *
+ * If the viewValue of `ngModel` does not match any of the options, then the control
+ * will automatically add an "unknown" option, which it then removes when the mismatch is resolved.
+ *
+ * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can
+ * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
+ * option. See example below for demonstration.
+ *
+ * <div class="alert alert-info">
+ * In many cases, `ngRepeat` can be used on `<option>` elements instead of {@link ng.directive:ngOptions
+ * ngOptions} to achieve a similar result. However, `ngOptions` provides some benefits, such as
+ * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the
+ * comprehension expression, and additionally in reducing memory and increasing speed by not creating
+ * a new scope for each repeated instance.
+ * </div>
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} multiple Allows multiple options to be selected. The selected values will be
+ * bound to the model as an array.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds required attribute and required validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use ngRequired instead of required
+ * when you want to data-bind to the required attribute.
+ * @param {string=} ngChange Angular expression to be executed when selected option(s) changes due to user
+ * interaction with the select element.
+ * @param {string=} ngOptions sets the options that the select is populated with and defines what is
+ * set on the model on selection. See {@link ngOptions `ngOptions`}.
+ *
+ * @example
+ * ### Simple `select` elements with static options
+ *
+ * <example name="static-select" module="staticSelect">
+ * <file name="index.html">
+ * <div ng-controller="ExampleController">
+ * <form name="myForm">
+ * <label for="singleSelect"> Single select: </label><br>
+ * <select name="singleSelect" ng-model="data.singleSelect">
+ * <option value="option-1">Option 1</option>
+ * <option value="option-2">Option 2</option>
+ * </select><br>
+ *
+ * <label for="singleSelect"> Single select with "not selected" option and dynamic option values: </label><br>
+ * <select name="singleSelect" id="singleSelect" ng-model="data.singleSelect">
+ * <option value="">---Please select---</option> <!-- not selected / blank option -->
+ * <option value="{{data.option1}}">Option 1</option> <!-- interpolation -->
+ * <option value="option-2">Option 2</option>
+ * </select><br>
+ * <button ng-click="forceUnknownOption()">Force unknown option</button><br>
+ * <tt>singleSelect = {{data.singleSelect}}</tt>
+ *
+ * <hr>
+ * <label for="multipleSelect"> Multiple select: </label><br>
+ * <select name="multipleSelect" id="multipleSelect" ng-model="data.multipleSelect" multiple>
+ * <option value="option-1">Option 1</option>
+ * <option value="option-2">Option 2</option>
+ * <option value="option-3">Option 3</option>
+ * </select><br>
+ * <tt>multipleSelect = {{data.multipleSelect}}</tt><br/>
+ * </form>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('staticSelect', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.data = {
+ * singleSelect: null,
+ * multipleSelect: [],
+ * option1: 'option-1',
+ * };
+ *
+ * $scope.forceUnknownOption = function() {
+ * $scope.data.singleSelect = 'nonsense';
+ * };
+ * }]);
+ * </file>
+ *</example>
+ *
+ * ### Using `ngRepeat` to generate `select` options
+ * <example name="ngrepeat-select" module="ngrepeatSelect">
+ * <file name="index.html">
+ * <div ng-controller="ExampleController">
+ * <form name="myForm">
+ * <label for="repeatSelect"> Repeat select: </label>
+ * <select name="repeatSelect" id="repeatSelect" ng-model="data.repeatSelect">
+ * <option ng-repeat="option in data.availableOptions" value="{{option.id}}">{{option.name}}</option>
+ * </select>
+ * </form>
+ * <hr>
+ * <tt>repeatSelect = {{data.repeatSelect}}</tt><br/>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('ngrepeatSelect', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.data = {
+ * repeatSelect: null,
+ * availableOptions: [
+ * {id: '1', name: 'Option A'},
+ * {id: '2', name: 'Option B'},
+ * {id: '3', name: 'Option C'}
+ * ],
+ * };
+ * }]);
+ * </file>
+ *</example>
+ *
+ *
+ * ### Using `select` with `ngOptions` and setting a default value
+ * See the {@link ngOptions ngOptions documentation} for more `ngOptions` usage examples.
+ *
+ * <example name="select-with-default-values" module="defaultValueSelect">
+ * <file name="index.html">
+ * <div ng-controller="ExampleController">
+ * <form name="myForm">
+ * <label for="mySelect">Make a choice:</label>
+ * <select name="mySelect" id="mySelect"
+ * ng-options="option.name for option in data.availableOptions track by option.id"
+ * ng-model="data.selectedOption"></select>
+ * </form>
+ * <hr>
+ * <tt>option = {{data.selectedOption}}</tt><br/>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('defaultValueSelect', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.data = {
+ * availableOptions: [
+ * {id: '1', name: 'Option A'},
+ * {id: '2', name: 'Option B'},
+ * {id: '3', name: 'Option C'}
+ * ],
+ * selectedOption: {id: '3', name: 'Option C'} //This sets the default value of the select in the ui
+ * };
+ * }]);
+ * </file>
+ *</example>
+ *
+ *
+ * ### Binding `select` to a non-string value via `ngModel` parsing / formatting
+ *
+ * <example name="select-with-non-string-options" module="nonStringSelect">
+ * <file name="index.html">
+ * <select ng-model="model.id" convert-to-number>
+ * <option value="0">Zero</option>
+ * <option value="1">One</option>
+ * <option value="2">Two</option>
+ * </select>
+ * {{ model }}
+ * </file>
+ * <file name="app.js">
+ * angular.module('nonStringSelect', [])
+ * .run(function($rootScope) {
+ * $rootScope.model = { id: 2 };
+ * })
+ * .directive('convertToNumber', function() {
+ * return {
+ * require: 'ngModel',
+ * link: function(scope, element, attrs, ngModel) {
+ * ngModel.$parsers.push(function(val) {
+ * return parseInt(val, 10);
+ * });
+ * ngModel.$formatters.push(function(val) {
+ * return '' + val;
+ * });
+ * }
+ * };
+ * });
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should initialize to model', function() {
+ * var select = element(by.css('select'));
+ * expect(element(by.model('model.id')).$('option:checked').getText()).toEqual('Two');
+ * });
+ * </file>
+ * </example>
+ *
+ */
+var selectDirective = function() {
+
+ return {
+ restrict: 'E',
+ require: ['select', '?ngModel'],
+ controller: SelectController,
+ priority: 1,
+ link: {
+ pre: selectPreLink,
+ post: selectPostLink
+ }
+ };
+
+ function selectPreLink(scope, element, attr, ctrls) {
+
+ // if ngModel is not defined, we don't need to do anything
+ var ngModelCtrl = ctrls[1];
+ if (!ngModelCtrl) return;
+
+ var selectCtrl = ctrls[0];
+
+ selectCtrl.ngModelCtrl = ngModelCtrl;
+
+ // When the selected item(s) changes we delegate getting the value of the select control
+ // to the `readValue` method, which can be changed if the select can have multiple
+ // selected values or if the options are being generated by `ngOptions`
+ element.on('change', function() {
+ scope.$apply(function() {
+ ngModelCtrl.$setViewValue(selectCtrl.readValue());
+ });
+ });
+
+ // If the select allows multiple values then we need to modify how we read and write
+ // values from and to the control; also what it means for the value to be empty and
+ // we have to add an extra watch since ngModel doesn't work well with arrays - it
+ // doesn't trigger rendering if only an item in the array changes.
+ if (attr.multiple) {
+
+ // Read value now needs to check each option to see if it is selected
+ selectCtrl.readValue = function readMultipleValue() {
+ var array = [];
+ forEach(element.find('option'), function(option) {
+ if (option.selected) {
+ array.push(option.value);
+ }
+ });
+ return array;
+ };
+
+ // Write value now needs to set the selected property of each matching option
+ selectCtrl.writeValue = function writeMultipleValue(value) {
+ var items = new HashMap(value);
+ forEach(element.find('option'), function(option) {
+ option.selected = isDefined(items.get(option.value));
+ });
+ };
+
+ // we have to do it on each watch since ngModel watches reference, but
+ // we need to work of an array, so we need to see if anything was inserted/removed
+ var lastView, lastViewRef = NaN;
+ scope.$watch(function selectMultipleWatch() {
+ if (lastViewRef === ngModelCtrl.$viewValue && !equals(lastView, ngModelCtrl.$viewValue)) {
+ lastView = shallowCopy(ngModelCtrl.$viewValue);
+ ngModelCtrl.$render();
+ }
+ lastViewRef = ngModelCtrl.$viewValue;
+ });
+
+ // If we are a multiple select then value is now a collection
+ // so the meaning of $isEmpty changes
+ ngModelCtrl.$isEmpty = function(value) {
+ return !value || value.length === 0;
+ };
+
+ }
+ }
+
+ function selectPostLink(scope, element, attrs, ctrls) {
+ // if ngModel is not defined, we don't need to do anything
+ var ngModelCtrl = ctrls[1];
+ if (!ngModelCtrl) return;
+
+ var selectCtrl = ctrls[0];
+
+ // We delegate rendering to the `writeValue` method, which can be changed
+ // if the select can have multiple selected values or if the options are being
+ // generated by `ngOptions`.
+ // This must be done in the postLink fn to prevent $render to be called before
+ // all nodes have been linked correctly.
+ ngModelCtrl.$render = function() {
+ selectCtrl.writeValue(ngModelCtrl.$viewValue);
+ };
+ }
+};
+
+
+// The option directive is purely designed to communicate the existence (or lack of)
+// of dynamically created (and destroyed) option elements to their containing select
+// directive via its controller.
+var optionDirective = ['$interpolate', function($interpolate) {
+ return {
+ restrict: 'E',
+ priority: 100,
+ compile: function(element, attr) {
+ if (isDefined(attr.value)) {
+ // If the value attribute is defined, check if it contains an interpolation
+ var interpolateValueFn = $interpolate(attr.value, true);
+ } else {
+ // If the value attribute is not defined then we fall back to the
+ // text content of the option element, which may be interpolated
+ var interpolateTextFn = $interpolate(element.text(), true);
+ if (!interpolateTextFn) {
+ attr.$set('value', element.text());
+ }
+ }
+
+ return function(scope, element, attr) {
+ // This is an optimization over using ^^ since we don't want to have to search
+ // all the way to the root of the DOM for every single option element
+ var selectCtrlName = '$selectController',
+ parent = element.parent(),
+ selectCtrl = parent.data(selectCtrlName) ||
+ parent.parent().data(selectCtrlName); // in case we are in optgroup
+
+ if (selectCtrl) {
+ selectCtrl.registerOption(scope, element, attr, interpolateValueFn, interpolateTextFn);
+ }
+ };
+ }
+ };
+}];
+
+var styleDirective = valueFn({
+ restrict: 'E',
+ terminal: false
+});
+
+/**
+ * @ngdoc directive
+ * @name ngRequired
+ *
+ * @description
+ *
+ * ngRequired adds the required {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
+ * It is most often used for {@link input `input`} and {@link select `select`} controls, but can also be
+ * applied to custom controls.
+ *
+ * The directive sets the `required` attribute on the element if the Angular expression inside
+ * `ngRequired` evaluates to true. A special directive for setting `required` is necessary because we
+ * cannot use interpolation inside `required`. See the {@link guide/interpolation interpolation guide}
+ * for more info.
+ *
+ * The validator will set the `required` error key to true if the `required` attribute is set and
+ * calling {@link ngModel.NgModelController#$isEmpty `NgModelController.$isEmpty`} with the
+ * {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`} returns `true`. For example, the
+ * `$isEmpty()` implementation for `input[text]` checks the length of the `$viewValue`. When developing
+ * custom controls, `$isEmpty()` can be overwritten to account for a $viewValue that is not string-based.
+ *
+ * @example
+ * <example name="ngRequiredDirective" module="ngRequiredExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('ngRequiredExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.required = true;
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <form name="form">
+ * <label for="required">Toggle required: </label>
+ * <input type="checkbox" ng-model="required" id="required" />
+ * <br>
+ * <label for="input">This input must be filled if `required` is true: </label>
+ * <input type="text" ng-model="model" id="input" name="input" ng-required="required" /><br>
+ * <hr>
+ * required error set? = <code>{{form.input.$error.required}}</code><br>
+ * model = <code>{{model}}</code>
+ * </form>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ var required = element(by.binding('form.input.$error.required'));
+ var model = element(by.binding('model'));
+ var input = element(by.id('input'));
+
+ it('should set the required error', function() {
+ expect(required.getText()).toContain('true');
+
+ input.sendKeys('123');
+ expect(required.getText()).not.toContain('true');
+ expect(model.getText()).toContain('123');
+ });
+ * </file>
+ * </example>
+ */
+var requiredDirective = function() {
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ if (!ctrl) return;
+ attr.required = true; // force truthy in case we are on non input element
+
+ ctrl.$validators.required = function(modelValue, viewValue) {
+ return !attr.required || !ctrl.$isEmpty(viewValue);
+ };
+
+ attr.$observe('required', function() {
+ ctrl.$validate();
+ });
+ }
+ };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngPattern
+ *
+ * @description
+ *
+ * ngPattern adds the pattern {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
+ * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.
+ *
+ * The validator sets the `pattern` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
+ * does not match a RegExp which is obtained by evaluating the Angular expression given in the
+ * `ngPattern` attribute value:
+ * * If the expression evaluates to a RegExp object, then this is used directly.
+ * * If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it
+ * in `^` and `$` characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`.
+ *
+ * <div class="alert alert-info">
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * </div>
+ *
+ * <div class="alert alert-info">
+ * **Note:** This directive is also added when the plain `pattern` attribute is used, with two
+ * differences:
+ * <ol>
+ * <li>
+ * `ngPattern` does not set the `pattern` attribute and therefore HTML5 constraint validation is
+ * not available.
+ * </li>
+ * <li>
+ * The `ngPattern` attribute must be an expression, while the `pattern` value must be
+ * interpolated.
+ * </li>
+ * </ol>
+ * </div>
+ *
+ * @example
+ * <example name="ngPatternDirective" module="ngPatternExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('ngPatternExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.regex = '\\d+';
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <form name="form">
+ * <label for="regex">Set a pattern (regex string): </label>
+ * <input type="text" ng-model="regex" id="regex" />
+ * <br>
+ * <label for="input">This input is restricted by the current pattern: </label>
+ * <input type="text" ng-model="model" id="input" name="input" ng-pattern="regex" /><br>
+ * <hr>
+ * input valid? = <code>{{form.input.$valid}}</code><br>
+ * model = <code>{{model}}</code>
+ * </form>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ var model = element(by.binding('model'));
+ var input = element(by.id('input'));
+
+ it('should validate the input with the default pattern', function() {
+ input.sendKeys('aaa');
+ expect(model.getText()).not.toContain('aaa');
+
+ input.clear().then(function() {
+ input.sendKeys('123');
+ expect(model.getText()).toContain('123');
+ });
+ });
+ * </file>
+ * </example>
+ */
+var patternDirective = function() {
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ if (!ctrl) return;
+
+ var regexp, patternExp = attr.ngPattern || attr.pattern;
+ attr.$observe('pattern', function(regex) {
+ if (isString(regex) && regex.length > 0) {
+ regex = new RegExp('^' + regex + '$');
+ }
+
+ if (regex && !regex.test) {
+ throw minErr('ngPattern')('noregexp',
+ 'Expected {0} to be a RegExp but was {1}. Element: {2}', patternExp,
+ regex, startingTag(elm));
+ }
+
+ regexp = regex || undefined;
+ ctrl.$validate();
+ });
+
+ ctrl.$validators.pattern = function(modelValue, viewValue) {
+ // HTML5 pattern constraint validates the input value, so we validate the viewValue
+ return ctrl.$isEmpty(viewValue) || isUndefined(regexp) || regexp.test(viewValue);
+ };
+ }
+ };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngMaxlength
+ *
+ * @description
+ *
+ * ngMaxlength adds the maxlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
+ * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.
+ *
+ * The validator sets the `maxlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
+ * is longer than the integer obtained by evaluating the Angular expression given in the
+ * `ngMaxlength` attribute value.
+ *
+ * <div class="alert alert-info">
+ * **Note:** This directive is also added when the plain `maxlength` attribute is used, with two
+ * differences:
+ * <ol>
+ * <li>
+ * `ngMaxlength` does not set the `maxlength` attribute and therefore HTML5 constraint
+ * validation is not available.
+ * </li>
+ * <li>
+ * The `ngMaxlength` attribute must be an expression, while the `maxlength` value must be
+ * interpolated.
+ * </li>
+ * </ol>
+ * </div>
+ *
+ * @example
+ * <example name="ngMaxlengthDirective" module="ngMaxlengthExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('ngMaxlengthExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.maxlength = 5;
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <form name="form">
+ * <label for="maxlength">Set a maxlength: </label>
+ * <input type="number" ng-model="maxlength" id="maxlength" />
+ * <br>
+ * <label for="input">This input is restricted by the current maxlength: </label>
+ * <input type="text" ng-model="model" id="input" name="input" ng-maxlength="maxlength" /><br>
+ * <hr>
+ * input valid? = <code>{{form.input.$valid}}</code><br>
+ * model = <code>{{model}}</code>
+ * </form>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ var model = element(by.binding('model'));
+ var input = element(by.id('input'));
+
+ it('should validate the input with the default maxlength', function() {
+ input.sendKeys('abcdef');
+ expect(model.getText()).not.toContain('abcdef');
+
+ input.clear().then(function() {
+ input.sendKeys('abcde');
+ expect(model.getText()).toContain('abcde');
+ });
+ });
+ * </file>
+ * </example>
+ */
+var maxlengthDirective = function() {
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ if (!ctrl) return;
+
+ var maxlength = -1;
+ attr.$observe('maxlength', function(value) {
+ var intVal = toInt(value);
+ maxlength = isNaN(intVal) ? -1 : intVal;
+ ctrl.$validate();
+ });
+ ctrl.$validators.maxlength = function(modelValue, viewValue) {
+ return (maxlength < 0) || ctrl.$isEmpty(viewValue) || (viewValue.length <= maxlength);
+ };
+ }
+ };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngMinlength
+ *
+ * @description
+ *
+ * ngMinlength adds the minlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
+ * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.
+ *
+ * The validator sets the `minlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
+ * is shorter than the integer obtained by evaluating the Angular expression given in the
+ * `ngMinlength` attribute value.
+ *
+ * <div class="alert alert-info">
+ * **Note:** This directive is also added when the plain `minlength` attribute is used, with two
+ * differences:
+ * <ol>
+ * <li>
+ * `ngMinlength` does not set the `minlength` attribute and therefore HTML5 constraint
+ * validation is not available.
+ * </li>
+ * <li>
+ * The `ngMinlength` value must be an expression, while the `minlength` value must be
+ * interpolated.
+ * </li>
+ * </ol>
+ * </div>
+ *
+ * @example
+ * <example name="ngMinlengthDirective" module="ngMinlengthExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('ngMinlengthExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.minlength = 3;
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <form name="form">
+ * <label for="minlength">Set a minlength: </label>
+ * <input type="number" ng-model="minlength" id="minlength" />
+ * <br>
+ * <label for="input">This input is restricted by the current minlength: </label>
+ * <input type="text" ng-model="model" id="input" name="input" ng-minlength="minlength" /><br>
+ * <hr>
+ * input valid? = <code>{{form.input.$valid}}</code><br>
+ * model = <code>{{model}}</code>
+ * </form>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ var model = element(by.binding('model'));
+ var input = element(by.id('input'));
+
+ it('should validate the input with the default minlength', function() {
+ input.sendKeys('ab');
+ expect(model.getText()).not.toContain('ab');
+
+ input.sendKeys('abc');
+ expect(model.getText()).toContain('abc');
+ });
+ * </file>
+ * </example>
+ */
+var minlengthDirective = function() {
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ if (!ctrl) return;
+
+ var minlength = 0;
+ attr.$observe('minlength', function(value) {
+ minlength = toInt(value) || 0;
+ ctrl.$validate();
+ });
+ ctrl.$validators.minlength = function(modelValue, viewValue) {
+ return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;
+ };
+ }
+ };
+};
+
+if (window.angular.bootstrap) {
+ //AngularJS is already loaded, so we can return here...
+ console.log('WARNING: Tried to load angular more than once.');
+ return;
+}
+
+//try to bind to jquery now so that one can write jqLite(document).ready()
+//but we will rebind on bootstrap again.
+bindJQuery();
+
+publishExternalAPI(angular);
+
+angular.module("ngLocale", [], ["$provide", function($provide) {
+var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
+function getDecimals(n) {
+ n = n + '';
+ var i = n.indexOf('.');
+ return (i == -1) ? 0 : n.length - i - 1;
+}
+
+function getVF(n, opt_precision) {
+ var v = opt_precision;
+
+ if (undefined === v) {
+ v = Math.min(getDecimals(n), 3);
+ }
+
+ var base = Math.pow(10, v);
+ var f = ((n * base) | 0) % base;
+ return {v: v, f: f};
+}
+
+$provide.value("$locale", {
+ "DATETIME_FORMATS": {
+ "AMPMS": [
+ "AM",
+ "PM"
+ ],
+ "DAY": [
+ "Sunday",
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday"
+ ],
+ "ERANAMES": [
+ "Before Christ",
+ "Anno Domini"
+ ],
+ "ERAS": [
+ "BC",
+ "AD"
+ ],
+ "FIRSTDAYOFWEEK": 6,
+ "MONTH": [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"
+ ],
+ "SHORTDAY": [
+ "Sun",
+ "Mon",
+ "Tue",
+ "Wed",
+ "Thu",
+ "Fri",
+ "Sat"
+ ],
+ "SHORTMONTH": [
+ "Jan",
+ "Feb",
+ "Mar",
+ "Apr",
+ "May",
+ "Jun",
+ "Jul",
+ "Aug",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dec"
+ ],
+ "STANDALONEMONTH": [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"
+ ],
+ "WEEKENDRANGE": [
+ 5,
+ 6
+ ],
+ "fullDate": "EEEE, MMMM d, y",
+ "longDate": "MMMM d, y",
+ "medium": "MMM d, y h:mm:ss a",
+ "mediumDate": "MMM d, y",
+ "mediumTime": "h:mm:ss a",
+ "short": "M/d/yy h:mm a",
+ "shortDate": "M/d/yy",
+ "shortTime": "h:mm a"
+ },
+ "NUMBER_FORMATS": {
+ "CURRENCY_SYM": "$",
+ "DECIMAL_SEP": ".",
+ "GROUP_SEP": ",",
+ "PATTERNS": [
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "maxFrac": 3,
+ "minFrac": 0,
+ "minInt": 1,
+ "negPre": "-",
+ "negSuf": "",
+ "posPre": "",
+ "posSuf": ""
+ },
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "maxFrac": 2,
+ "minFrac": 2,
+ "minInt": 1,
+ "negPre": "-\u00a4",
+ "negSuf": "",
+ "posPre": "\u00a4",
+ "posSuf": ""
+ }
+ ]
+ },
+ "id": "en-us",
+ "localeID": "en_US",
+ "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
+});
+}]);
+
+ jqLite(document).ready(function() {
+ angularInit(document, bootstrap);
+ });
+
+})(window, document);
+
+!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>'); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.min.js
new file mode 100644
index 00000000..dcb1a136
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.min.js
@@ -0,0 +1,307 @@
+/*
+ AngularJS v1.5.0
+ (c) 2010-2016 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(O,W,v){'use strict';function H(a){return function(){var b=arguments[0],d;d="["+(a?a+":":"")+b+"] http://errors.angularjs.org/1.5.0/"+(a?a+"/":"")+b;for(b=1;b<arguments.length;b++){d=d+(1==b?"?":"&")+"p"+(b-1)+"=";var c=encodeURIComponent,e;e=arguments[b];e="function"==typeof e?e.toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof e?"undefined":"string"!=typeof e?JSON.stringify(e):e;d+=c(e)}return Error(d)}}function Ca(a){if(null==a||Za(a))return!1;if(L(a)||F(a)||C&&a instanceof C)return!0;
+var b="length"in Object(a)&&a.length;return N(b)&&(0<=b&&(b-1 in a||a instanceof Array)||"function"==typeof a.item)}function n(a,b,d){var c,e;if(a)if(D(a))for(c in a)"prototype"==c||"length"==c||"name"==c||a.hasOwnProperty&&!a.hasOwnProperty(c)||b.call(d,a[c],c,a);else if(L(a)||Ca(a)){var f="object"!==typeof a;c=0;for(e=a.length;c<e;c++)(f||c in a)&&b.call(d,a[c],c,a)}else if(a.forEach&&a.forEach!==n)a.forEach(b,d,a);else if(qc(a))for(c in a)b.call(d,a[c],c,a);else if("function"===typeof a.hasOwnProperty)for(c in a)a.hasOwnProperty(c)&&
+b.call(d,a[c],c,a);else for(c in a)sa.call(a,c)&&b.call(d,a[c],c,a);return a}function rc(a,b,d){for(var c=Object.keys(a).sort(),e=0;e<c.length;e++)b.call(d,a[c[e]],c[e]);return c}function sc(a){return function(b,d){a(d,b)}}function Yd(){return++pb}function Qb(a,b,d){for(var c=a.$$hashKey,e=0,f=b.length;e<f;++e){var g=b[e];if(E(g)||D(g))for(var h=Object.keys(g),k=0,l=h.length;k<l;k++){var m=h[k],r=g[m];d&&E(r)?V(r)?a[m]=new Date(r.valueOf()):$a(r)?a[m]=new RegExp(r):r.nodeName?a[m]=r.cloneNode(!0):
+Rb(r)?a[m]=r.clone():(E(a[m])||(a[m]=L(r)?[]:{}),Qb(a[m],[r],!0)):a[m]=r}}c?a.$$hashKey=c:delete a.$$hashKey;return a}function T(a){return Qb(a,wa.call(arguments,1),!1)}function Zd(a){return Qb(a,wa.call(arguments,1),!0)}function ca(a){return parseInt(a,10)}function Sb(a,b){return T(Object.create(a),b)}function B(){}function ab(a){return a}function ba(a){return function(){return a}}function tc(a){return D(a.toString)&&a.toString!==ga}function x(a){return"undefined"===typeof a}function y(a){return"undefined"!==
+typeof a}function E(a){return null!==a&&"object"===typeof a}function qc(a){return null!==a&&"object"===typeof a&&!uc(a)}function F(a){return"string"===typeof a}function N(a){return"number"===typeof a}function V(a){return"[object Date]"===ga.call(a)}function D(a){return"function"===typeof a}function $a(a){return"[object RegExp]"===ga.call(a)}function Za(a){return a&&a.window===a}function bb(a){return a&&a.$evalAsync&&a.$watch}function Na(a){return"boolean"===typeof a}function $d(a){return a&&N(a.length)&&
+ae.test(ga.call(a))}function Rb(a){return!(!a||!(a.nodeName||a.prop&&a.attr&&a.find))}function be(a){var b={};a=a.split(",");var d;for(d=0;d<a.length;d++)b[a[d]]=!0;return b}function ra(a){return G(a.nodeName||a[0]&&a[0].nodeName)}function cb(a,b){var d=a.indexOf(b);0<=d&&a.splice(d,1);return d}function Oa(a,b){function d(a,b){var d=b.$$hashKey,e;if(L(a)){e=0;for(var f=a.length;e<f;e++)b.push(c(a[e]))}else if(qc(a))for(e in a)b[e]=c(a[e]);else if(a&&"function"===typeof a.hasOwnProperty)for(e in a)a.hasOwnProperty(e)&&
+(b[e]=c(a[e]));else for(e in a)sa.call(a,e)&&(b[e]=c(a[e]));d?b.$$hashKey=d:delete b.$$hashKey;return b}function c(a){if(!E(a))return a;var b=f.indexOf(a);if(-1!==b)return g[b];if(Za(a)||bb(a))throw Da("cpws");var b=!1,c=e(a);c===v&&(c=L(a)?[]:Object.create(uc(a)),b=!0);f.push(a);g.push(c);return b?d(a,c):c}function e(a){switch(ga.call(a)){case "[object Int8Array]":case "[object Int16Array]":case "[object Int32Array]":case "[object Float32Array]":case "[object Float64Array]":case "[object Uint8Array]":case "[object Uint8ClampedArray]":case "[object Uint16Array]":case "[object Uint32Array]":return new a.constructor(c(a.buffer));
+case "[object ArrayBuffer]":if(!a.slice){var b=new ArrayBuffer(a.byteLength);(new Uint8Array(b)).set(new Uint8Array(a));return b}return a.slice(0);case "[object Boolean]":case "[object Number]":case "[object String]":case "[object Date]":return new a.constructor(a.valueOf());case "[object RegExp]":return b=new RegExp(a.source,a.toString().match(/[^\/]*$/)[0]),b.lastIndex=a.lastIndex,b}if(D(a.cloneNode))return a.cloneNode(!0)}var f=[],g=[];if(b){if($d(b)||"[object ArrayBuffer]"===ga.call(b))throw Da("cpta");
+if(a===b)throw Da("cpi");L(b)?b.length=0:n(b,function(a,c){"$$hashKey"!==c&&delete b[c]});f.push(a);g.push(b);return d(a,b)}return c(a)}function na(a,b){if(L(a)){b=b||[];for(var d=0,c=a.length;d<c;d++)b[d]=a[d]}else if(E(a))for(d in b=b||{},a)if("$"!==d.charAt(0)||"$"!==d.charAt(1))b[d]=a[d];return b||a}function oa(a,b){if(a===b)return!0;if(null===a||null===b)return!1;if(a!==a&&b!==b)return!0;var d=typeof a,c;if(d==typeof b&&"object"==d)if(L(a)){if(!L(b))return!1;if((d=a.length)==b.length){for(c=
+0;c<d;c++)if(!oa(a[c],b[c]))return!1;return!0}}else{if(V(a))return V(b)?oa(a.getTime(),b.getTime()):!1;if($a(a))return $a(b)?a.toString()==b.toString():!1;if(bb(a)||bb(b)||Za(a)||Za(b)||L(b)||V(b)||$a(b))return!1;d=Z();for(c in a)if("$"!==c.charAt(0)&&!D(a[c])){if(!oa(a[c],b[c]))return!1;d[c]=!0}for(c in b)if(!(c in d)&&"$"!==c.charAt(0)&&y(b[c])&&!D(b[c]))return!1;return!0}return!1}function db(a,b,d){return a.concat(wa.call(b,d))}function vc(a,b){var d=2<arguments.length?wa.call(arguments,2):[];
+return!D(b)||b instanceof RegExp?b:d.length?function(){return arguments.length?b.apply(a,db(d,arguments,0)):b.apply(a,d)}:function(){return arguments.length?b.apply(a,arguments):b.call(a)}}function ce(a,b){var d=b;"string"===typeof a&&"$"===a.charAt(0)&&"$"===a.charAt(1)?d=v:Za(b)?d="$WINDOW":b&&W===b?d="$DOCUMENT":bb(b)&&(d="$SCOPE");return d}function eb(a,b){if(x(a))return v;N(b)||(b=b?2:null);return JSON.stringify(a,ce,b)}function wc(a){return F(a)?JSON.parse(a):a}function xc(a,b){a=a.replace(de,
+"");var d=Date.parse("Jan 01, 1970 00:00:00 "+a)/6E4;return isNaN(d)?b:d}function Tb(a,b,d){d=d?-1:1;var c=a.getTimezoneOffset();b=xc(b,c);d*=b-c;a=new Date(a.getTime());a.setMinutes(a.getMinutes()+d);return a}function ta(a){a=C(a).clone();try{a.empty()}catch(b){}var d=C("<div>").append(a).html();try{return a[0].nodeType===Pa?G(d):d.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+G(b)})}catch(c){return G(d)}}function yc(a){try{return decodeURIComponent(a)}catch(b){}}function zc(a){var b=
+{};n((a||"").split("&"),function(a){var c,e,f;a&&(e=a=a.replace(/\+/g,"%20"),c=a.indexOf("="),-1!==c&&(e=a.substring(0,c),f=a.substring(c+1)),e=yc(e),y(e)&&(f=y(f)?yc(f):!0,sa.call(b,e)?L(b[e])?b[e].push(f):b[e]=[b[e],f]:b[e]=f))});return b}function Ub(a){var b=[];n(a,function(a,c){L(a)?n(a,function(a){b.push(ha(c,!0)+(!0===a?"":"="+ha(a,!0)))}):b.push(ha(c,!0)+(!0===a?"":"="+ha(a,!0)))});return b.length?b.join("&"):""}function qb(a){return ha(a,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,
+"+")}function ha(a,b){return encodeURIComponent(a).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,b?"%20":"+")}function ee(a,b){var d,c,e=Qa.length;for(c=0;c<e;++c)if(d=Qa[c]+b,F(d=a.getAttribute(d)))return d;return null}function fe(a,b){var d,c,e={};n(Qa,function(b){b+="app";!d&&a.hasAttribute&&a.hasAttribute(b)&&(d=a,c=a.getAttribute(b))});n(Qa,function(b){b+="app";var e;!d&&(e=a.querySelector("["+b.replace(":","\\:")+"]"))&&
+(d=e,c=e.getAttribute(b))});d&&(e.strictDi=null!==ee(d,"strict-di"),b(d,c?[c]:[],e))}function Ac(a,b,d){E(d)||(d={});d=T({strictDi:!1},d);var c=function(){a=C(a);if(a.injector()){var c=a[0]===W?"document":ta(a);throw Da("btstrpd",c.replace(/</,"&lt;").replace(/>/,"&gt;"));}b=b||[];b.unshift(["$provide",function(b){b.value("$rootElement",a)}]);d.debugInfoEnabled&&b.push(["$compileProvider",function(a){a.debugInfoEnabled(!0)}]);b.unshift("ng");c=fb(b,d.strictDi);c.invoke(["$rootScope","$rootElement",
+"$compile","$injector",function(a,b,c,d){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},e=/^NG_ENABLE_DEBUG_INFO!/,f=/^NG_DEFER_BOOTSTRAP!/;O&&e.test(O.name)&&(d.debugInfoEnabled=!0,O.name=O.name.replace(e,""));if(O&&!f.test(O.name))return c();O.name=O.name.replace(f,"");ia.resumeBootstrap=function(a){n(a,function(a){b.push(a)});return c()};D(ia.resumeDeferredBootstrap)&&ia.resumeDeferredBootstrap()}function ge(){O.name="NG_ENABLE_DEBUG_INFO!"+O.name;O.location.reload()}function he(a){a=
+ia.element(a).injector();if(!a)throw Da("test");return a.get("$$testability")}function Bc(a,b){b=b||"_";return a.replace(ie,function(a,c){return(c?b:"")+a.toLowerCase()})}function je(){var a;if(!Cc){var b=rb();(ua=x(b)?O.jQuery:b?O[b]:v)&&ua.fn.on?(C=ua,T(ua.fn,{scope:Ra.scope,isolateScope:Ra.isolateScope,controller:Ra.controller,injector:Ra.injector,inheritedData:Ra.inheritedData}),a=ua.cleanData,ua.cleanData=function(b){for(var c,e=0,f;null!=(f=b[e]);e++)(c=ua._data(f,"events"))&&c.$destroy&&ua(f).triggerHandler("$destroy");
+a(b)}):C=U;ia.element=C;Cc=!0}}function sb(a,b,d){if(!a)throw Da("areq",b||"?",d||"required");return a}function Sa(a,b,d){d&&L(a)&&(a=a[a.length-1]);sb(D(a),b,"not a function, got "+(a&&"object"===typeof a?a.constructor.name||"Object":typeof a));return a}function Ta(a,b){if("hasOwnProperty"===a)throw Da("badname",b);}function Dc(a,b,d){if(!b)return a;b=b.split(".");for(var c,e=a,f=b.length,g=0;g<f;g++)c=b[g],a&&(a=(e=a)[c]);return!d&&D(a)?vc(e,a):a}function tb(a){for(var b=a[0],d=a[a.length-1],c,
+e=1;b!==d&&(b=b.nextSibling);e++)if(c||a[e]!==b)c||(c=C(wa.call(a,0,e))),c.push(b);return c||a}function Z(){return Object.create(null)}function ke(a){function b(a,b,c){return a[b]||(a[b]=c())}var d=H("$injector"),c=H("ng");a=b(a,"angular",Object);a.$$minErr=a.$$minErr||H;return b(a,"module",function(){var a={};return function(f,g,h){if("hasOwnProperty"===f)throw c("badname","module");g&&a.hasOwnProperty(f)&&(a[f]=null);return b(a,f,function(){function a(b,d,e,f){f||(f=c);return function(){f[e||"push"]([b,
+d,arguments]);return K}}function b(a,d){return function(b,e){e&&D(e)&&(e.$$moduleName=f);c.push([a,d,arguments]);return K}}if(!g)throw d("nomod",f);var c=[],e=[],s=[],I=a("$injector","invoke","push",e),K={_invokeQueue:c,_configBlocks:e,_runBlocks:s,requires:g,name:f,provider:b("$provide","provider"),factory:b("$provide","factory"),service:b("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),decorator:b("$provide","decorator"),animation:b("$animateProvider",
+"register"),filter:b("$filterProvider","register"),controller:b("$controllerProvider","register"),directive:b("$compileProvider","directive"),component:b("$compileProvider","component"),config:I,run:function(a){s.push(a);return this}};h&&I(h);return K})}})}function le(a){T(a,{bootstrap:Ac,copy:Oa,extend:T,merge:Zd,equals:oa,element:C,forEach:n,injector:fb,noop:B,bind:vc,toJson:eb,fromJson:wc,identity:ab,isUndefined:x,isDefined:y,isString:F,isFunction:D,isObject:E,isNumber:N,isElement:Rb,isArray:L,
+version:me,isDate:V,lowercase:G,uppercase:ub,callbacks:{counter:0},getTestability:he,$$minErr:H,$$csp:Ea,reloadWithDebugInfo:ge});Vb=ke(O);Vb("ng",["ngLocale"],["$provide",function(a){a.provider({$$sanitizeUri:ne});a.provider("$compile",Ec).directive({a:oe,input:Fc,textarea:Fc,form:pe,script:qe,select:re,style:se,option:te,ngBind:ue,ngBindHtml:ve,ngBindTemplate:we,ngClass:xe,ngClassEven:ye,ngClassOdd:ze,ngCloak:Ae,ngController:Be,ngForm:Ce,ngHide:De,ngIf:Ee,ngInclude:Fe,ngInit:Ge,ngNonBindable:He,
+ngPluralize:Ie,ngRepeat:Je,ngShow:Ke,ngStyle:Le,ngSwitch:Me,ngSwitchWhen:Ne,ngSwitchDefault:Oe,ngOptions:Pe,ngTransclude:Qe,ngModel:Re,ngList:Se,ngChange:Te,pattern:Gc,ngPattern:Gc,required:Hc,ngRequired:Hc,minlength:Ic,ngMinlength:Ic,maxlength:Jc,ngMaxlength:Jc,ngValue:Ue,ngModelOptions:Ve}).directive({ngInclude:We}).directive(vb).directive(Kc);a.provider({$anchorScroll:Xe,$animate:Ye,$animateCss:Ze,$$animateJs:$e,$$animateQueue:af,$$AnimateRunner:bf,$$animateAsyncRun:cf,$browser:df,$cacheFactory:ef,
+$controller:ff,$document:gf,$exceptionHandler:hf,$filter:Lc,$$forceReflow:jf,$interpolate:kf,$interval:lf,$http:mf,$httpParamSerializer:nf,$httpParamSerializerJQLike:of,$httpBackend:pf,$xhrFactory:qf,$location:rf,$log:sf,$parse:tf,$rootScope:uf,$q:vf,$$q:wf,$sce:xf,$sceDelegate:yf,$sniffer:zf,$templateCache:Af,$templateRequest:Bf,$$testability:Cf,$timeout:Df,$window:Ef,$$rAF:Ff,$$jqLite:Gf,$$HashMap:Hf,$$cookieReader:If})}])}function gb(a){return a.replace(Jf,function(a,d,c,e){return e?c.toUpperCase():
+c}).replace(Kf,"Moz$1")}function Mc(a){a=a.nodeType;return 1===a||!a||9===a}function Nc(a,b){var d,c,e=b.createDocumentFragment(),f=[];if(Wb.test(a)){d=d||e.appendChild(b.createElement("div"));c=(Lf.exec(a)||["",""])[1].toLowerCase();c=da[c]||da._default;d.innerHTML=c[1]+a.replace(Mf,"<$1></$2>")+c[2];for(c=c[0];c--;)d=d.lastChild;f=db(f,d.childNodes);d=e.firstChild;d.textContent=""}else f.push(b.createTextNode(a));e.textContent="";e.innerHTML="";n(f,function(a){e.appendChild(a)});return e}function Oc(a,
+b){var d=a.parentNode;d&&d.replaceChild(b,a);b.appendChild(a)}function U(a){if(a instanceof U)return a;var b;F(a)&&(a=X(a),b=!0);if(!(this instanceof U)){if(b&&"<"!=a.charAt(0))throw Xb("nosel");return new U(a)}if(b){b=W;var d;a=(d=Nf.exec(a))?[b.createElement(d[1])]:(d=Nc(a,b))?d.childNodes:[]}Pc(this,a)}function Yb(a){return a.cloneNode(!0)}function wb(a,b){b||hb(a);if(a.querySelectorAll)for(var d=a.querySelectorAll("*"),c=0,e=d.length;c<e;c++)hb(d[c])}function Qc(a,b,d,c){if(y(c))throw Xb("offargs");
+var e=(c=xb(a))&&c.events,f=c&&c.handle;if(f)if(b){var g=function(b){var c=e[b];y(d)&&cb(c||[],d);y(d)&&c&&0<c.length||(a.removeEventListener(b,f,!1),delete e[b])};n(b.split(" "),function(a){g(a);yb[a]&&g(yb[a])})}else for(b in e)"$destroy"!==b&&a.removeEventListener(b,f,!1),delete e[b]}function hb(a,b){var d=a.ng339,c=d&&ib[d];c&&(b?delete c.data[b]:(c.handle&&(c.events.$destroy&&c.handle({},"$destroy"),Qc(a)),delete ib[d],a.ng339=v))}function xb(a,b){var d=a.ng339,d=d&&ib[d];b&&!d&&(a.ng339=d=++Of,
+d=ib[d]={events:{},data:{},handle:v});return d}function Zb(a,b,d){if(Mc(a)){var c=y(d),e=!c&&b&&!E(b),f=!b;a=(a=xb(a,!e))&&a.data;if(c)a[b]=d;else{if(f)return a;if(e)return a&&a[b];T(a,b)}}}function zb(a,b){return a.getAttribute?-1<(" "+(a.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+b+" "):!1}function Ab(a,b){b&&a.setAttribute&&n(b.split(" "),function(b){a.setAttribute("class",X((" "+(a.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+X(b)+" "," ")))})}function Bb(a,
+b){if(b&&a.setAttribute){var d=(" "+(a.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");n(b.split(" "),function(a){a=X(a);-1===d.indexOf(" "+a+" ")&&(d+=a+" ")});a.setAttribute("class",X(d))}}function Pc(a,b){if(b)if(b.nodeType)a[a.length++]=b;else{var d=b.length;if("number"===typeof d&&b.window!==b){if(d)for(var c=0;c<d;c++)a[a.length++]=b[c]}else a[a.length++]=b}}function Rc(a,b){return Cb(a,"$"+(b||"ngController")+"Controller")}function Cb(a,b,d){9==a.nodeType&&(a=a.documentElement);for(b=
+L(b)?b:[b];a;){for(var c=0,e=b.length;c<e;c++)if(y(d=C.data(a,b[c])))return d;a=a.parentNode||11===a.nodeType&&a.host}}function Sc(a){for(wb(a,!0);a.firstChild;)a.removeChild(a.firstChild)}function $b(a,b){b||wb(a);var d=a.parentNode;d&&d.removeChild(a)}function Pf(a,b){b=b||O;if("complete"===b.document.readyState)b.setTimeout(a);else C(b).on("load",a)}function Tc(a,b){var d=Db[b.toLowerCase()];return d&&Uc[ra(a)]&&d}function Qf(a,b){var d=function(c,d){c.isDefaultPrevented=function(){return c.defaultPrevented};
+var f=b[d||c.type],g=f?f.length:0;if(g){if(x(c.immediatePropagationStopped)){var h=c.stopImmediatePropagation;c.stopImmediatePropagation=function(){c.immediatePropagationStopped=!0;c.stopPropagation&&c.stopPropagation();h&&h.call(c)}}c.isImmediatePropagationStopped=function(){return!0===c.immediatePropagationStopped};var k=f.specialHandlerWrapper||Rf;1<g&&(f=na(f));for(var l=0;l<g;l++)c.isImmediatePropagationStopped()||k(a,c,f[l])}};d.elem=a;return d}function Rf(a,b,d){d.call(a,b)}function Sf(a,b,
+d){var c=b.relatedTarget;c&&(c===a||Tf.call(a,c))||d.call(a,b)}function Gf(){this.$get=function(){return T(U,{hasClass:function(a,b){a.attr&&(a=a[0]);return zb(a,b)},addClass:function(a,b){a.attr&&(a=a[0]);return Bb(a,b)},removeClass:function(a,b){a.attr&&(a=a[0]);return Ab(a,b)}})}}function Fa(a,b){var d=a&&a.$$hashKey;if(d)return"function"===typeof d&&(d=a.$$hashKey()),d;d=typeof a;return d="function"==d||"object"==d&&null!==a?a.$$hashKey=d+":"+(b||Yd)():d+":"+a}function Ua(a,b){if(b){var d=0;this.nextUid=
+function(){return++d}}n(a,this.put,this)}function Vc(a){a=a.toString().replace(Uf,"");return a.match(Vf)||a.match(Wf)}function Xf(a){return(a=Vc(a))?"function("+(a[1]||"").replace(/[\s\r\n]+/," ")+")":"fn"}function fb(a,b){function d(a){return function(b,c){if(E(b))n(b,sc(a));else return a(b,c)}}function c(a,b){Ta(a,"service");if(D(b)||L(b))b=s.instantiate(b);if(!b.$get)throw Ga("pget",a);return r[a+"Provider"]=b}function e(a,b){return function(){var c=t.invoke(b,this);if(x(c))throw Ga("undef",a);
+return c}}function f(a,b,d){return c(a,{$get:!1!==d?e(a,b):b})}function g(a){sb(x(a)||L(a),"modulesToLoad","not an array");var b=[],c;n(a,function(a){function d(a){var b,c;b=0;for(c=a.length;b<c;b++){var e=a[b],f=s.get(e[0]);f[e[1]].apply(f,e[2])}}if(!m.get(a)){m.put(a,!0);try{F(a)?(c=Vb(a),b=b.concat(g(c.requires)).concat(c._runBlocks),d(c._invokeQueue),d(c._configBlocks)):D(a)?b.push(s.invoke(a)):L(a)?b.push(s.invoke(a)):Sa(a,"module")}catch(e){throw L(a)&&(a=a[a.length-1]),e.message&&e.stack&&
+-1==e.stack.indexOf(e.message)&&(e=e.message+"\n"+e.stack),Ga("modulerr",a,e.stack||e.message||e);}}});return b}function h(a,c){function d(b,e){if(a.hasOwnProperty(b)){if(a[b]===k)throw Ga("cdep",b+" <- "+l.join(" <- "));return a[b]}try{return l.unshift(b),a[b]=k,a[b]=c(b,e)}catch(f){throw a[b]===k&&delete a[b],f;}finally{l.shift()}}function e(a,c,f){var g=[];a=fb.$$annotate(a,b,f);for(var h=0,k=a.length;h<k;h++){var l=a[h];if("string"!==typeof l)throw Ga("itkn",l);g.push(c&&c.hasOwnProperty(l)?c[l]:
+d(l,f))}return g}return{invoke:function(a,b,c,d){"string"===typeof c&&(d=c,c=null);c=e(a,c,d);L(a)&&(a=a[a.length-1]);d=11>=xa?!1:"function"===typeof a&&/^(?:class\s|constructor\()/.test(Function.prototype.toString.call(a));return d?(c.unshift(null),new (Function.prototype.bind.apply(a,c))):a.apply(b,c)},instantiate:function(a,b,c){var d=L(a)?a[a.length-1]:a;a=e(a,b,c);a.unshift(null);return new (Function.prototype.bind.apply(d,a))},get:d,annotate:fb.$$annotate,has:function(b){return r.hasOwnProperty(b+
+"Provider")||a.hasOwnProperty(b)}}}b=!0===b;var k={},l=[],m=new Ua([],!0),r={$provide:{provider:d(c),factory:d(f),service:d(function(a,b){return f(a,["$injector",function(a){return a.instantiate(b)}])}),value:d(function(a,b){return f(a,ba(b),!1)}),constant:d(function(a,b){Ta(a,"constant");r[a]=b;I[a]=b}),decorator:function(a,b){var c=s.get(a+"Provider"),d=c.$get;c.$get=function(){var a=t.invoke(d,c);return t.invoke(b,null,{$delegate:a})}}}},s=r.$injector=h(r,function(a,b){ia.isString(b)&&l.push(b);
+throw Ga("unpr",l.join(" <- "));}),I={},K=h(I,function(a,b){var c=s.get(a+"Provider",b);return t.invoke(c.$get,c,v,a)}),t=K;r.$injectorProvider={$get:ba(K)};var p=g(a),t=K.get("$injector");t.strictDi=b;n(p,function(a){a&&t.invoke(a)});return t}function Xe(){var a=!0;this.disableAutoScrolling=function(){a=!1};this.$get=["$window","$location","$rootScope",function(b,d,c){function e(a){var b=null;Array.prototype.some.call(a,function(a){if("a"===ra(a))return b=a,!0});return b}function f(a){if(a){a.scrollIntoView();
+var c;c=g.yOffset;D(c)?c=c():Rb(c)?(c=c[0],c="fixed"!==b.getComputedStyle(c).position?0:c.getBoundingClientRect().bottom):N(c)||(c=0);c&&(a=a.getBoundingClientRect().top,b.scrollBy(0,a-c))}else b.scrollTo(0,0)}function g(a){a=F(a)?a:d.hash();var b;a?(b=h.getElementById(a))?f(b):(b=e(h.getElementsByName(a)))?f(b):"top"===a&&f(null):f(null)}var h=b.document;a&&c.$watch(function(){return d.hash()},function(a,b){a===b&&""===a||Pf(function(){c.$evalAsync(g)})});return g}]}function jb(a,b){if(!a&&!b)return"";
+if(!a)return b;if(!b)return a;L(a)&&(a=a.join(" "));L(b)&&(b=b.join(" "));return a+" "+b}function Yf(a){F(a)&&(a=a.split(" "));var b=Z();n(a,function(a){a.length&&(b[a]=!0)});return b}function Ha(a){return E(a)?a:{}}function Zf(a,b,d,c){function e(a){try{a.apply(null,wa.call(arguments,1))}finally{if(K--,0===K)for(;t.length;)try{t.pop()()}catch(b){d.error(b)}}}function f(){z=null;g();h()}function g(){a:{try{p=m.state;break a}catch(a){}p=void 0}p=x(p)?null:p;oa(p,$)&&(p=$);$=p}function h(){if(u!==k.url()||
+w!==p)u=k.url(),w=p,n(A,function(a){a(k.url(),p)})}var k=this,l=a.location,m=a.history,r=a.setTimeout,s=a.clearTimeout,I={};k.isMock=!1;var K=0,t=[];k.$$completeOutstandingRequest=e;k.$$incOutstandingRequestCount=function(){K++};k.notifyWhenNoOutstandingRequests=function(a){0===K?a():t.push(a)};var p,w,u=l.href,la=b.find("base"),z=null;g();w=p;k.url=function(b,d,e){x(e)&&(e=null);l!==a.location&&(l=a.location);m!==a.history&&(m=a.history);if(b){var f=w===e;if(u===b&&(!c.history||f))return k;var h=
+u&&Ia(u)===Ia(b);u=b;w=e;if(!c.history||h&&f){if(!h||z)z=b;d?l.replace(b):h?(d=l,e=b.indexOf("#"),e=-1===e?"":b.substr(e),d.hash=e):l.href=b;l.href!==b&&(z=b)}else m[d?"replaceState":"pushState"](e,"",b),g(),w=p;return k}return z||l.href.replace(/%27/g,"'")};k.state=function(){return p};var A=[],Q=!1,$=null;k.onUrlChange=function(b){if(!Q){if(c.history)C(a).on("popstate",f);C(a).on("hashchange",f);Q=!0}A.push(b);return b};k.$$applicationDestroyed=function(){C(a).off("hashchange popstate",f)};k.$$checkUrlChange=
+h;k.baseHref=function(){var a=la.attr("href");return a?a.replace(/^(https?\:)?\/\/[^\/]*/,""):""};k.defer=function(a,b){var c;K++;c=r(function(){delete I[c];e(a)},b||0);I[c]=!0;return c};k.defer.cancel=function(a){return I[a]?(delete I[a],s(a),e(B),!0):!1}}function df(){this.$get=["$window","$log","$sniffer","$document",function(a,b,d,c){return new Zf(a,c,b,d)}]}function ef(){this.$get=function(){function a(a,c){function e(a){a!=r&&(s?s==a&&(s=a.n):s=a,f(a.n,a.p),f(a,r),r=a,r.n=null)}function f(a,
+b){a!=b&&(a&&(a.p=b),b&&(b.n=a))}if(a in b)throw H("$cacheFactory")("iid",a);var g=0,h=T({},c,{id:a}),k=Z(),l=c&&c.capacity||Number.MAX_VALUE,m=Z(),r=null,s=null;return b[a]={put:function(a,b){if(!x(b)){if(l<Number.MAX_VALUE){var c=m[a]||(m[a]={key:a});e(c)}a in k||g++;k[a]=b;g>l&&this.remove(s.key);return b}},get:function(a){if(l<Number.MAX_VALUE){var b=m[a];if(!b)return;e(b)}return k[a]},remove:function(a){if(l<Number.MAX_VALUE){var b=m[a];if(!b)return;b==r&&(r=b.p);b==s&&(s=b.n);f(b.n,b.p);delete m[a]}a in
+k&&(delete k[a],g--)},removeAll:function(){k=Z();g=0;m=Z();r=s=null},destroy:function(){m=h=k=null;delete b[a]},info:function(){return T({},h,{size:g})}}}var b={};a.info=function(){var a={};n(b,function(b,e){a[e]=b.info()});return a};a.get=function(a){return b[a]};return a}}function Af(){this.$get=["$cacheFactory",function(a){return a("templates")}]}function Ec(a,b){function d(a,b,c){var d=/^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/,e={};n(a,function(a,f){var g=a.match(d);if(!g)throw ja("iscp",b,f,a,c?
+"controller bindings definition":"isolate scope definition");e[f]={mode:g[1][0],collection:"*"===g[2],optional:"?"===g[3],attrName:g[4]||f}});return e}function c(a){var b=a.charAt(0);if(!b||b!==G(b))throw ja("baddir",a);if(a!==a.trim())throw ja("baddir",a);}var e={},f=/^\s*directive\:\s*([\w\-]+)\s+(.*)$/,g=/(([\w\-]+)(?:\:([^;]+))?;?)/,h=be("ngSrc,ngSrcset,src,srcset"),k=/^(?:(\^\^?)?(\?)?(\^\^?)?)?/,l=/^(on[a-z]+|formaction)$/;this.directive=function s(b,f){Ta(b,"directive");F(b)?(c(b),sb(f,"directiveFactory"),
+e.hasOwnProperty(b)||(e[b]=[],a.factory(b+"Directive",["$injector","$exceptionHandler",function(a,c){var f=[];n(e[b],function(e,g){try{var h=a.invoke(e);D(h)?h={compile:ba(h)}:!h.compile&&h.link&&(h.compile=ba(h.link));h.priority=h.priority||0;h.index=g;h.name=h.name||b;h.require=h.require||h.controller&&h.name;h.restrict=h.restrict||"EA";var k=h,l=h,m=h.name,s={isolateScope:null,bindToController:null};E(l.scope)&&(!0===l.bindToController?(s.bindToController=d(l.scope,m,!0),s.isolateScope={}):s.isolateScope=
+d(l.scope,m,!1));E(l.bindToController)&&(s.bindToController=d(l.bindToController,m,!0));if(E(s.bindToController)){var P=l.controller,S=l.controllerAs;if(!P)throw ja("noctrl",m);if(!Wc(P,S))throw ja("noident",m);}var ma=k.$$bindings=s;E(ma.isolateScope)&&(h.$$isolateBindings=ma.isolateScope);h.$$moduleName=e.$$moduleName;f.push(h)}catch(K){c(K)}});return f}])),e[b].push(f)):n(b,sc(s));return this};this.component=function(a,b){function c(a){function e(b){return D(b)||L(b)?function(c,d){return a.invoke(b,
+this,{$element:c,$attrs:d})}:b}var f=b.template||b.templateUrl?b.template:"";return{controller:d,controllerAs:Wc(b.controller)||b.controllerAs||"$ctrl",template:e(f),templateUrl:e(b.templateUrl),transclude:b.transclude,scope:{},bindToController:b.bindings||{},restrict:"E",require:b.require}}var d=b.controller||function(){};n(b,function(a,b){"$"===b.charAt(0)&&(c[b]=a)});c.$inject=["$injector"];return this.directive(a,c)};this.aHrefSanitizationWhitelist=function(a){return y(a)?(b.aHrefSanitizationWhitelist(a),
+this):b.aHrefSanitizationWhitelist()};this.imgSrcSanitizationWhitelist=function(a){return y(a)?(b.imgSrcSanitizationWhitelist(a),this):b.imgSrcSanitizationWhitelist()};var m=!0;this.debugInfoEnabled=function(a){return y(a)?(m=a,this):m};this.$get=["$injector","$interpolate","$exceptionHandler","$templateRequest","$parse","$controller","$rootScope","$sce","$animate","$$sanitizeUri",function(a,b,c,d,p,w,u,la,z,A){function Q(a,b,c){ba.innerHTML="<span "+b+">";b=ba.firstChild.attributes;var d=b[0];b.removeNamedItem(d.name);
+d.value=c;a.attributes.setNamedItem(d)}function $(a,b){try{a.addClass(b)}catch(c){}}function M(a,b,c,d,e){a instanceof C||(a=C(a));for(var f=/\S+/,g=0,h=a.length;g<h;g++){var k=a[g];k.nodeType===Pa&&k.nodeValue.match(f)&&Oc(k,a[g]=W.createElement("span"))}var l=P(a,b,a,c,d,e);M.$$addScopeClass(a);var m=null;return function(b,c,d){sb(b,"scope");e&&e.needsNewScope&&(b=b.$parent.$new());d=d||{};var f=d.parentBoundTranscludeFn,g=d.transcludeControllers;d=d.futureParentElement;f&&f.$$boundTransclude&&
+(f=f.$$boundTransclude);m||(m=(d=d&&d[0])?"foreignobject"!==ra(d)&&ga.call(d).match(/SVG/)?"svg":"html":"html");d="html"!==m?C(U(m,C("<div>").append(a).html())):c?Ra.clone.call(a):a;if(g)for(var h in g)d.data("$"+h+"Controller",g[h].instance);M.$$addScopeInfo(d,b);c&&c(d,b);l&&l(b,d,d,f);return d}}function P(a,b,c,d,e,f){function g(a,c,d,e){var f,k,l,m,p,s,u;if(A)for(u=Array(c.length),m=0;m<h.length;m+=3)f=h[m],u[f]=c[f];else u=c;m=0;for(p=h.length;m<p;)k=u[h[m++]],c=h[m++],f=h[m++],c?(c.scope?(l=
+a.$new(),M.$$addScopeInfo(C(k),l)):l=a,s=c.transcludeOnThisElement?S(a,c.transclude,e):!c.templateOnThisElement&&e?e:!e&&b?S(a,b):null,c(f,l,k,d,s)):f&&f(a,k.childNodes,v,e)}for(var h=[],k,l,m,p,A,s=0;s<a.length;s++){k=new na;l=ma(a[s],[],k,0===s?d:v,e);(f=l.length?y(l,a[s],k,b,c,null,[],[],f):null)&&f.scope&&M.$$addScopeClass(k.$$element);k=f&&f.terminal||!(m=a[s].childNodes)||!m.length?null:P(m,f?(f.transcludeOnThisElement||!f.templateOnThisElement)&&f.transclude:b);if(f||k)h.push(s,f,k),p=!0,A=
+A||f;f=null}return p?g:null}function S(a,b,c){var d=function(d,e,f,g,h){d||(d=a.$new(!1,h),d.$$transcluded=!0);return b(d,e,{parentBoundTranscludeFn:c,transcludeControllers:f,futureParentElement:g})},e=d.$$slots=Z(),f;for(f in b.$$slots)e[f]=b.$$slots[f]?S(a,b.$$slots[f],c):null;return d}function ma(a,b,c,d,e){var h=c.$attr,k;switch(a.nodeType){case 1:H(b,va(ra(a)),"E",d,e);for(var l,m,p,s=a.attributes,A=0,u=s&&s.length;A<u;A++){var t=!1,w=!1;l=s[A];k=l.name;m=X(l.value);l=va(k);if(p=pa.test(l))k=
+k.replace(Xc,"").substr(8).replace(/_(.)/g,function(a,b){return b.toUpperCase()});(l=l.match(ua))&&O(l[1])&&(t=k,w=k.substr(0,k.length-5)+"end",k=k.substr(0,k.length-6));l=va(k.toLowerCase());h[l]=k;if(p||!c.hasOwnProperty(l))c[l]=m,Tc(a,l)&&(c[l]=!0);Y(a,b,m,l,p);H(b,l,"A",d,e,t,w)}a=a.className;E(a)&&(a=a.animVal);if(F(a)&&""!==a)for(;k=g.exec(a);)l=va(k[2]),H(b,l,"C",d,e)&&(c[l]=X(k[3])),a=a.substr(k.index+k[0].length);break;case Pa:if(11===xa)for(;a.parentNode&&a.nextSibling&&a.nextSibling.nodeType===
+Pa;)a.nodeValue+=a.nextSibling.nodeValue,a.parentNode.removeChild(a.nextSibling);N(b,a.nodeValue);break;case 8:try{if(k=f.exec(a.nodeValue))l=va(k[1]),H(b,l,"M",d,e)&&(c[l]=X(k[2]))}catch(M){}}b.sort(ya);return b}function q(a,b,c){var d=[],e=0;if(b&&a.hasAttribute&&a.hasAttribute(b)){do{if(!a)throw ja("uterdir",b,c);1==a.nodeType&&(a.hasAttribute(b)&&e++,a.hasAttribute(c)&&e--);d.push(a);a=a.nextSibling}while(0<e)}else d.push(a);return C(d)}function Yc(a,b,c){return function(d,e,f,g,h){e=q(e[0],b,
+c);return a(d,e,f,g,h)}}function ac(a,b,c,d,e,f){if(a)return M(b,c,d,e,f);var g;return function(){g||(g=M(b,c,d,e,f),b=c=f=null);return g.apply(this,arguments)}}function y(a,b,d,e,f,g,h,l,m){function p(a,b,c,d){if(a){c&&(a=Yc(a,c,d));a.require=J.require;a.directiveName=H;if(P===J||J.$$isolateScope)a=ca(a,{isolateScope:!0});h.push(a)}if(b){c&&(b=Yc(b,c,d));b.require=J.require;b.directiveName=H;if(P===J||J.$$isolateScope)b=ca(b,{isolateScope:!0});l.push(b)}}function s(a,b,c,d){var e;if(F(b)){var f=
+b.match(k);b=b.substring(f[0].length);var g=f[1]||f[3],f="?"===f[2];"^^"===g?c=c.parent():e=(e=d&&d[b])&&e.instance;if(!e){var h="$"+b+"Controller";e=g?c.inheritedData(h):c.data(h)}if(!e&&!f)throw ja("ctreq",b,a);}else if(L(b))for(e=[],g=0,f=b.length;g<f;g++)e[g]=s(a,b[g],c,d);else E(b)&&(e={},n(b,function(b,f){e[f]=s(a,b,c,d)}));return e||null}function A(a,b,c,d,e,f){var g=Z(),h;for(h in d){var k=d[h],l={$scope:k===P||k.$$isolateScope?e:f,$element:a,$attrs:b,$transclude:c},m=k.controller;"@"==m&&
+(m=b[k.name]);l=w(m,l,!0,k.controllerAs);g[k.name]=l;B||a.data("$"+k.name+"Controller",l.instance)}return g}function u(a,c,e,f,g){function k(a,b,c,d){var e;bb(a)||(d=c,c=b,b=a,a=v);B&&(e=ma);c||(c=B?z.parent():z);if(d){var f=g.$$slots[d];if(f)return f(a,b,e,c,Eb);if(x(f))throw ja("noslot",d,ta(z));}else return g(a,b,e,c,Eb)}var m,p,t,w,ma,S,z,Ja;b===e?(f=d,z=d.$$element):(z=C(e),f=new na(z,d));t=c;P?w=c.$new(!0):Q&&(t=c.$parent);g&&(S=k,S.$$boundTransclude=g,S.isSlotFilled=function(a){return!!g.$$slots[a]});
+I&&(ma=A(z,f,S,I,w,c));P&&(M.$$addScopeInfo(z,w,!0,!($&&($===P||$===P.$$originalDirective))),M.$$addScopeClass(z,!0),w.$$isolateBindings=P.$$isolateBindings,(Ja=ia(c,f,w,w.$$isolateBindings,P))&&w.$on("$destroy",Ja));for(p in ma){Ja=I[p];var K=ma[p],la=Ja.$$bindings.bindToController;K.identifier&&la&&(m=ia(t,f,K.instance,la,Ja));var q=K();q!==K.instance&&(K.instance=q,z.data("$"+Ja.name+"Controller",q),m&&m(),m=ia(t,f,K.instance,la,Ja))}n(I,function(a,b){var c=a.require;a.bindToController&&!L(c)&&
+E(c)&&T(ma[b].instance,s(b,c,z,ma))});n(ma,function(a){D(a.instance.$onInit)&&a.instance.$onInit()});m=0;for(p=h.length;m<p;m++)t=h[m],ka(t,t.isolateScope?w:c,z,f,t.require&&s(t.directiveName,t.require,z,ma),S);var Eb=c;P&&(P.template||null===P.templateUrl)&&(Eb=w);a&&a(Eb,e.childNodes,v,g);for(m=l.length-1;0<=m;m--)t=l[m],ka(t,t.isolateScope?w:c,z,f,t.require&&s(t.directiveName,t.require,z,ma),S)}m=m||{};for(var t=-Number.MAX_VALUE,Q=m.newScopeDirective,I=m.controllerDirectives,P=m.newIsolateScopeDirective,
+$=m.templateDirective,S=m.nonTlbTranscludeDirective,z=!1,la=!1,B=m.hasElementTranscludeDirective,ea=d.$$element=C(b),J,H,G,ya=e,O,N=!1,Fb=!1,fa,R=0,Va=a.length;R<Va;R++){J=a[R];var Y=J.$$start,ba=J.$$end;Y&&(ea=q(b,Y,ba));G=v;if(t>J.priority)break;if(fa=J.scope)J.templateUrl||(E(fa)?(Wa("new/isolated scope",P||Q,J,ea),P=J):Wa("new/isolated scope",P,J,ea)),Q=Q||J;H=J.name;if(!N&&(J.replace&&(J.templateUrl||J.template)||J.transclude&&!J.$$tlb)){for(fa=R+1;N=a[fa++];)if(N.transclude&&!N.$$tlb||N.replace&&
+(N.templateUrl||N.template)){Fb=!0;break}N=!0}!J.templateUrl&&J.controller&&(fa=J.controller,I=I||Z(),Wa("'"+H+"' controller",I[H],J,ea),I[H]=J);if(fa=J.transclude)if(z=!0,J.$$tlb||(Wa("transclusion",S,J,ea),S=J),"element"==fa)B=!0,t=J.priority,G=ea,ea=d.$$element=C(W.createComment(" "+H+": "+d[H]+" ")),b=ea[0],aa(f,wa.call(G,0),b),ya=ac(Fb,G,e,t,g&&g.name,{nonTlbTranscludeDirective:S});else{var V=Z();G=C(Yb(b)).contents();if(E(fa)){G=[];var ha=Z(),da=Z();n(fa,function(a,b){var c="?"===a.charAt(0);
+a=c?a.substring(1):a;ha[a]=b;V[b]=null;da[b]=c});n(ea.contents(),function(a){var b=ha[va(ra(a))];b?(da[b]=!0,V[b]=V[b]||[],V[b].push(a)):G.push(a)});n(da,function(a,b){if(!a)throw ja("reqslot",b);});for(var ga in V)V[ga]&&(V[ga]=ac(Fb,V[ga],e))}ea.empty();ya=ac(Fb,G,e,v,v,{needsNewScope:J.$$isolateScope||J.$$newScope});ya.$$slots=V}if(J.template)if(la=!0,Wa("template",$,J,ea),$=J,fa=D(J.template)?J.template(ea,d):J.template,fa=qa(fa),J.replace){g=J;G=Wb.test(fa)?Zc(U(J.templateNamespace,X(fa))):[];
+b=G[0];if(1!=G.length||1!==b.nodeType)throw ja("tplrt",H,"");aa(f,ea,b);Va={$attr:{}};fa=ma(b,[],Va);var oa=a.splice(R+1,a.length-(R+1));(P||Q)&&$c(fa,P,Q);a=a.concat(fa).concat(oa);ad(d,Va);Va=a.length}else ea.html(fa);if(J.templateUrl)la=!0,Wa("template",$,J,ea),$=J,J.replace&&(g=J),u=$f(a.splice(R,a.length-R),ea,d,f,z&&ya,h,l,{controllerDirectives:I,newScopeDirective:Q!==J&&Q,newIsolateScopeDirective:P,templateDirective:$,nonTlbTranscludeDirective:S}),Va=a.length;else if(J.compile)try{O=J.compile(ea,
+d,ya),D(O)?p(null,O,Y,ba):O&&p(O.pre,O.post,Y,ba)}catch(pa){c(pa,ta(ea))}J.terminal&&(u.terminal=!0,t=Math.max(t,J.priority))}u.scope=Q&&!0===Q.scope;u.transcludeOnThisElement=z;u.templateOnThisElement=la;u.transclude=ya;m.hasElementTranscludeDirective=B;return u}function $c(a,b,c){for(var d=0,e=a.length;d<e;d++)a[d]=Sb(a[d],{$$isolateScope:b,$$newScope:c})}function H(b,d,f,g,h,k,l){if(d===h)return null;h=null;if(e.hasOwnProperty(d)){var m;d=a.get(d+"Directive");for(var p=0,A=d.length;p<A;p++)try{m=
+d[p],(x(g)||g>m.priority)&&-1!=m.restrict.indexOf(f)&&(k&&(m=Sb(m,{$$start:k,$$end:l})),b.push(m),h=m)}catch(t){c(t)}}return h}function O(b){if(e.hasOwnProperty(b))for(var c=a.get(b+"Directive"),d=0,f=c.length;d<f;d++)if(b=c[d],b.multiElement)return!0;return!1}function ad(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;n(a,function(d,e){"$"!=e.charAt(0)&&(b[e]&&b[e]!==d&&(d+=("style"===e?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});n(b,function(b,f){"class"==f?($(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+
+b):"style"==f?(e.attr("style",e.attr("style")+";"+b),a.style=(a.style?a.style+";":"")+b):"$"==f.charAt(0)||a.hasOwnProperty(f)||(a[f]=b,d[f]=c[f])})}function $f(a,b,c,e,f,g,h,k){var l=[],m,p,s=b[0],A=a.shift(),u=Sb(A,{templateUrl:null,transclude:null,replace:null,$$originalDirective:A}),w=D(A.templateUrl)?A.templateUrl(b,c):A.templateUrl,Q=A.templateNamespace;b.empty();d(w).then(function(d){var t,I;d=qa(d);if(A.replace){d=Wb.test(d)?Zc(U(Q,X(d))):[];t=d[0];if(1!=d.length||1!==t.nodeType)throw ja("tplrt",
+A.name,w);d={$attr:{}};aa(e,b,t);var M=ma(t,[],d);E(A.scope)&&$c(M,!0);a=M.concat(a);ad(c,d)}else t=s,b.html(d);a.unshift(u);m=y(a,t,c,f,b,A,g,h,k);n(e,function(a,c){a==t&&(e[c]=b[0])});for(p=P(b[0].childNodes,f);l.length;){d=l.shift();I=l.shift();var z=l.shift(),K=l.shift(),M=b[0];if(!d.$$destroyed){if(I!==s){var la=I.className;k.hasElementTranscludeDirective&&A.replace||(M=Yb(t));aa(z,C(I),M);$(C(M),la)}I=m.transcludeOnThisElement?S(d,m.transclude,K):K;m(p,d,M,e,I)}}l=null});return function(a,b,
+c,d,e){a=e;b.$$destroyed||(l?l.push(b,c,d,a):(m.transcludeOnThisElement&&(a=S(b,m.transclude,e)),m(p,b,c,d,a)))}}function ya(a,b){var c=b.priority-a.priority;return 0!==c?c:a.name!==b.name?a.name<b.name?-1:1:a.index-b.index}function Wa(a,b,c,d){function e(a){return a?" (module: "+a+")":""}if(b)throw ja("multidir",b.name,e(b.$$moduleName),c.name,e(c.$$moduleName),a,ta(d));}function N(a,c){var d=b(c,!0);d&&a.push({priority:0,compile:function(a){a=a.parent();var b=!!a.length;b&&M.$$addBindingClass(a);
+return function(a,c){var e=c.parent();b||M.$$addBindingClass(e);M.$$addBindingInfo(e,d.expressions);a.$watch(d,function(a){c[0].nodeValue=a})}}})}function U(a,b){a=G(a||"html");switch(a){case "svg":case "math":var c=W.createElement("div");c.innerHTML="<"+a+">"+b+"</"+a+">";return c.childNodes[0].childNodes;default:return b}}function R(a,b){if("srcdoc"==b)return la.HTML;var c=ra(a);if("xlinkHref"==b||"form"==c&&"action"==b||"img"!=c&&("src"==b||"ngSrc"==b))return la.RESOURCE_URL}function Y(a,c,d,e,
+f){var g=R(a,e);f=h[e]||f;var k=b(d,!0,g,f);if(k){if("multiple"===e&&"select"===ra(a))throw ja("selmulti",ta(a));c.push({priority:100,compile:function(){return{pre:function(a,c,h){c=h.$$observers||(h.$$observers=Z());if(l.test(e))throw ja("nodomevents");var m=h[e];m!==d&&(k=m&&b(m,!0,g,f),d=m);k&&(h[e]=k(a),(c[e]||(c[e]=[])).$$inter=!0,(h.$$observers&&h.$$observers[e].$$scope||a).$watch(k,function(a,b){"class"===e&&a!=b?h.$updateClass(a,b):h.$set(e,a)}))}}}})}}function aa(a,b,c){var d=b[0],e=b.length,
+f=d.parentNode,g,h;if(a)for(g=0,h=a.length;g<h;g++)if(a[g]==d){a[g++]=c;h=g+e-1;for(var k=a.length;g<k;g++,h++)h<k?a[g]=a[h]:delete a[g];a.length-=e-1;a.context===d&&(a.context=c);break}f&&f.replaceChild(c,d);a=W.createDocumentFragment();for(g=0;g<e;g++)a.appendChild(b[g]);C.hasData(d)&&(C.data(c,C.data(d)),C(d).off("$destroy"));C.cleanData(a.querySelectorAll("*"));for(g=1;g<e;g++)delete b[g];b[0]=c;b.length=1}function ca(a,b){return T(function(){return a.apply(null,arguments)},a,b)}function ka(a,
+b,d,e,f,g){try{a(b,d,e,f,g)}catch(h){c(h,ta(d))}}function ia(a,c,d,e,f){var g=[];n(e,function(e,h){var k=e.attrName,l=e.optional,m,A,s,t;switch(e.mode){case "@":l||sa.call(c,k)||(d[h]=c[k]=void 0);c.$observe(k,function(a){F(a)&&(d[h]=a)});c.$$observers[k].$$scope=a;m=c[k];F(m)?d[h]=b(m)(a):Na(m)&&(d[h]=m);break;case "=":if(!sa.call(c,k)){if(l)break;c[k]=void 0}if(l&&!c[k])break;A=p(c[k]);t=A.literal?oa:function(a,b){return a===b||a!==a&&b!==b};s=A.assign||function(){m=d[h]=A(a);throw ja("nonassign",
+c[k],k,f.name);};m=d[h]=A(a);l=function(b){t(b,d[h])||(t(b,m)?s(a,b=d[h]):d[h]=b);return m=b};l.$stateful=!0;l=e.collection?a.$watchCollection(c[k],l):a.$watch(p(c[k],l),null,A.literal);g.push(l);break;case "<":if(!sa.call(c,k)){if(l)break;c[k]=void 0}if(l&&!c[k])break;A=p(c[k]);d[h]=A(a);l=a.$watch(A,function(a){d[h]=a},A.literal);g.push(l);break;case "&":A=c.hasOwnProperty(k)?p(c[k]):B;if(A===B&&l)break;d[h]=function(b){return A(a,b)}}});return g.length&&function(){for(var a=0,b=g.length;a<b;++a)g[a]()}}
+var V=/^\w/,ba=W.createElement("div"),na=function(a,b){if(b){var c=Object.keys(b),d,e,f;d=0;for(e=c.length;d<e;d++)f=c[d],this[f]=b[f]}else this.$attr={};this.$$element=a};na.prototype={$normalize:va,$addClass:function(a){a&&0<a.length&&z.addClass(this.$$element,a)},$removeClass:function(a){a&&0<a.length&&z.removeClass(this.$$element,a)},$updateClass:function(a,b){var c=bd(a,b);c&&c.length&&z.addClass(this.$$element,c);(c=bd(b,a))&&c.length&&z.removeClass(this.$$element,c)},$set:function(a,b,d,e){var f=
+Tc(this.$$element[0],a),g=cd[a],h=a;f?(this.$$element.prop(a,b),e=f):g&&(this[g]=b,h=g);this[a]=b;e?this.$attr[a]=e:(e=this.$attr[a])||(this.$attr[a]=e=Bc(a,"-"));f=ra(this.$$element);if("a"===f&&("href"===a||"xlinkHref"===a)||"img"===f&&"src"===a)this[a]=b=A(b,"src"===a);else if("img"===f&&"srcset"===a){for(var f="",g=X(b),k=/(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/,k=/\s/.test(g)?k:/(,)/,g=g.split(k),k=Math.floor(g.length/2),l=0;l<k;l++)var m=2*l,f=f+A(X(g[m]),!0),f=f+(" "+X(g[m+1]));g=X(g[2*l]).split(/\s/);
+f+=A(X(g[0]),!0);2===g.length&&(f+=" "+X(g[1]));this[a]=b=f}!1!==d&&(null===b||x(b)?this.$$element.removeAttr(e):V.test(e)?this.$$element.attr(e,b):Q(this.$$element[0],e,b));(a=this.$$observers)&&n(a[h],function(a){try{a(b)}catch(d){c(d)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers=Z()),e=d[a]||(d[a]=[]);e.push(b);u.$evalAsync(function(){e.$$inter||!c.hasOwnProperty(a)||x(c[a])||b(c[a])});return function(){cb(e,b)}}};var ha=b.startSymbol(),da=b.endSymbol(),qa="{{"==ha&&"}}"==
+da?ab:function(a){return a.replace(/\{\{/g,ha).replace(/}}/g,da)},pa=/^ngAttr[A-Z]/,ua=/^(.+)Start$/;M.$$addBindingInfo=m?function(a,b){var c=a.data("$binding")||[];L(b)?c=c.concat(b):c.push(b);a.data("$binding",c)}:B;M.$$addBindingClass=m?function(a){$(a,"ng-binding")}:B;M.$$addScopeInfo=m?function(a,b,c,d){a.data(c?d?"$isolateScopeNoTemplate":"$isolateScope":"$scope",b)}:B;M.$$addScopeClass=m?function(a,b){$(a,b?"ng-isolate-scope":"ng-scope")}:B;return M}]}function va(a){return gb(a.replace(Xc,
+""))}function bd(a,b){var d="",c=a.split(/\s+/),e=b.split(/\s+/),f=0;a:for(;f<c.length;f++){for(var g=c[f],h=0;h<e.length;h++)if(g==e[h])continue a;d+=(0<d.length?" ":"")+g}return d}function Zc(a){a=C(a);var b=a.length;if(1>=b)return a;for(;b--;)8===a[b].nodeType&&ag.call(a,b,1);return a}function Wc(a,b){if(b&&F(b))return b;if(F(a)){var d=dd.exec(a);if(d)return d[3]}}function ff(){var a={},b=!1;this.register=function(b,c){Ta(b,"controller");E(b)?T(a,b):a[b]=c};this.allowGlobals=function(){b=!0};this.$get=
+["$injector","$window",function(d,c){function e(a,b,c,d){if(!a||!E(a.$scope))throw H("$controller")("noscp",d,b);a.$scope[b]=c}return function(f,g,h,k){var l,m,r;h=!0===h;k&&F(k)&&(r=k);if(F(f)){k=f.match(dd);if(!k)throw bg("ctrlfmt",f);m=k[1];r=r||k[3];f=a.hasOwnProperty(m)?a[m]:Dc(g.$scope,m,!0)||(b?Dc(c,m,!0):v);Sa(f,m,!0)}if(h)return h=(L(f)?f[f.length-1]:f).prototype,l=Object.create(h||null),r&&e(g,r,l,m||f.name),T(function(){var a=d.invoke(f,l,g,m);a!==l&&(E(a)||D(a))&&(l=a,r&&e(g,r,l,m||f.name));
+return l},{instance:l,identifier:r});l=d.instantiate(f,g,m);r&&e(g,r,l,m||f.name);return l}}]}function gf(){this.$get=["$window",function(a){return C(a.document)}]}function hf(){this.$get=["$log",function(a){return function(b,d){a.error.apply(a,arguments)}}]}function bc(a){return E(a)?V(a)?a.toISOString():eb(a):a}function nf(){this.$get=function(){return function(a){if(!a)return"";var b=[];rc(a,function(a,c){null===a||x(a)||(L(a)?n(a,function(a,d){b.push(ha(c)+"="+ha(bc(a)))}):b.push(ha(c)+"="+ha(bc(a))))});
+return b.join("&")}}}function of(){this.$get=function(){return function(a){function b(a,e,f){null===a||x(a)||(L(a)?n(a,function(a,c){b(a,e+"["+(E(a)?c:"")+"]")}):E(a)&&!V(a)?rc(a,function(a,c){b(a,e+(f?"":"[")+c+(f?"":"]"))}):d.push(ha(e)+"="+ha(bc(a))))}if(!a)return"";var d=[];b(a,"",!0);return d.join("&")}}}function cc(a,b){if(F(a)){var d=a.replace(cg,"").trim();if(d){var c=b("Content-Type");(c=c&&0===c.indexOf(ed))||(c=(c=d.match(dg))&&eg[c[0]].test(d));c&&(a=wc(d))}}return a}function fd(a){var b=
+Z(),d;F(a)?n(a.split("\n"),function(a){d=a.indexOf(":");var e=G(X(a.substr(0,d)));a=X(a.substr(d+1));e&&(b[e]=b[e]?b[e]+", "+a:a)}):E(a)&&n(a,function(a,d){var f=G(d),g=X(a);f&&(b[f]=b[f]?b[f]+", "+g:g)});return b}function gd(a){var b;return function(d){b||(b=fd(a));return d?(d=b[G(d)],void 0===d&&(d=null),d):b}}function hd(a,b,d,c){if(D(c))return c(a,b,d);n(c,function(c){a=c(a,b,d)});return a}function mf(){var a=this.defaults={transformResponse:[cc],transformRequest:[function(a){return E(a)&&"[object File]"!==
+ga.call(a)&&"[object Blob]"!==ga.call(a)&&"[object FormData]"!==ga.call(a)?eb(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:na(dc),put:na(dc),patch:na(dc)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer"},b=!1;this.useApplyAsync=function(a){return y(a)?(b=!!a,this):b};var d=!0;this.useLegacyPromiseExtensions=function(a){return y(a)?(d=!!a,this):d};var c=this.interceptors=[];this.$get=["$httpBackend","$$cookieReader","$cacheFactory",
+"$rootScope","$q","$injector",function(e,f,g,h,k,l){function m(b){function c(a){var b=T({},a);b.data=hd(a.data,a.headers,a.status,f.transformResponse);a=a.status;return 200<=a&&300>a?b:k.reject(b)}function e(a,b){var c,d={};n(a,function(a,e){D(a)?(c=a(b),null!=c&&(d[e]=c)):d[e]=a});return d}if(!E(b))throw H("$http")("badreq",b);if(!F(b.url))throw H("$http")("badreq",b.url);var f=T({method:"get",transformRequest:a.transformRequest,transformResponse:a.transformResponse,paramSerializer:a.paramSerializer},
+b);f.headers=function(b){var c=a.headers,d=T({},b.headers),f,g,h,c=T({},c.common,c[G(b.method)]);a:for(f in c){g=G(f);for(h in d)if(G(h)===g)continue a;d[f]=c[f]}return e(d,na(b))}(b);f.method=ub(f.method);f.paramSerializer=F(f.paramSerializer)?l.get(f.paramSerializer):f.paramSerializer;var g=[function(b){var d=b.headers,e=hd(b.data,gd(d),v,b.transformRequest);x(e)&&n(d,function(a,b){"content-type"===G(b)&&delete d[b]});x(b.withCredentials)&&!x(a.withCredentials)&&(b.withCredentials=a.withCredentials);
+return r(b,e).then(c,c)},v],h=k.when(f);for(n(K,function(a){(a.request||a.requestError)&&g.unshift(a.request,a.requestError);(a.response||a.responseError)&&g.push(a.response,a.responseError)});g.length;){b=g.shift();var m=g.shift(),h=h.then(b,m)}d?(h.success=function(a){Sa(a,"fn");h.then(function(b){a(b.data,b.status,b.headers,f)});return h},h.error=function(a){Sa(a,"fn");h.then(null,function(b){a(b.data,b.status,b.headers,f)});return h}):(h.success=id("success"),h.error=id("error"));return h}function r(c,
+d){function g(a,c,d,e){function f(){l(c,a,d,e)}K&&(200<=a&&300>a?K.put(S,[a,c,fd(d),e]):K.remove(S));b?h.$applyAsync(f):(f(),h.$$phase||h.$apply())}function l(a,b,d,e){b=-1<=b?b:0;(200<=b&&300>b?A.resolve:A.reject)({data:a,status:b,headers:gd(d),config:c,statusText:e})}function r(a){l(a.data,a.status,na(a.headers()),a.statusText)}function z(){var a=m.pendingRequests.indexOf(c);-1!==a&&m.pendingRequests.splice(a,1)}var A=k.defer(),Q=A.promise,K,M,P=c.headers,S=s(c.url,c.paramSerializer(c.params));
+m.pendingRequests.push(c);Q.then(z,z);!c.cache&&!a.cache||!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method||(K=E(c.cache)?c.cache:E(a.cache)?a.cache:I);K&&(M=K.get(S),y(M)?M&&D(M.then)?M.then(r,r):L(M)?l(M[1],M[0],na(M[2]),M[3]):l(M,200,{},"OK"):K.put(S,Q));x(M)&&((M=jd(c.url)?f()[c.xsrfCookieName||a.xsrfCookieName]:v)&&(P[c.xsrfHeaderName||a.xsrfHeaderName]=M),e(c.method,S,d,g,P,c.timeout,c.withCredentials,c.responseType));return Q}function s(a,b){0<b.length&&(a+=(-1==a.indexOf("?")?"?":"&")+b);
+return a}var I=g("$http");a.paramSerializer=F(a.paramSerializer)?l.get(a.paramSerializer):a.paramSerializer;var K=[];n(c,function(a){K.unshift(F(a)?l.get(a):l.invoke(a))});m.pendingRequests=[];(function(a){n(arguments,function(a){m[a]=function(b,c){return m(T({},c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){n(arguments,function(a){m[a]=function(b,c,d){return m(T({},d||{},{method:a,url:b,data:c}))}})})("post","put","patch");m.defaults=a;return m}]}function qf(){this.$get=
+function(){return function(){return new O.XMLHttpRequest}}}function pf(){this.$get=["$browser","$window","$document","$xhrFactory",function(a,b,d,c){return fg(a,c,a.defer,b.angular.callbacks,d[0])}]}function fg(a,b,d,c,e){function f(a,b,d){var f=e.createElement("script"),m=null;f.type="text/javascript";f.src=a;f.async=!0;m=function(a){f.removeEventListener("load",m,!1);f.removeEventListener("error",m,!1);e.body.removeChild(f);f=null;var g=-1,I="unknown";a&&("load"!==a.type||c[b].called||(a={type:"error"}),
+I=a.type,g="error"===a.type?404:200);d&&d(g,I)};f.addEventListener("load",m,!1);f.addEventListener("error",m,!1);e.body.appendChild(f);return m}return function(e,h,k,l,m,r,s,I){function K(){w&&w();u&&u.abort()}function t(b,c,e,f,g){y(z)&&d.cancel(z);w=u=null;b(c,e,f,g);a.$$completeOutstandingRequest(B)}a.$$incOutstandingRequestCount();h=h||a.url();if("jsonp"==G(e)){var p="_"+(c.counter++).toString(36);c[p]=function(a){c[p].data=a;c[p].called=!0};var w=f(h.replace("JSON_CALLBACK","angular.callbacks."+
+p),p,function(a,b){t(l,a,c[p].data,"",b);c[p]=B})}else{var u=b(e,h);u.open(e,h,!0);n(m,function(a,b){y(a)&&u.setRequestHeader(b,a)});u.onload=function(){var a=u.statusText||"",b="response"in u?u.response:u.responseText,c=1223===u.status?204:u.status;0===c&&(c=b?200:"file"==za(h).protocol?404:0);t(l,c,b,u.getAllResponseHeaders(),a)};e=function(){t(l,-1,null,null,"")};u.onerror=e;u.onabort=e;s&&(u.withCredentials=!0);if(I)try{u.responseType=I}catch(la){if("json"!==I)throw la;}u.send(x(k)?null:k)}if(0<
+r)var z=d(K,r);else r&&D(r.then)&&r.then(K)}}function kf(){var a="{{",b="}}";this.startSymbol=function(b){return b?(a=b,this):a};this.endSymbol=function(a){return a?(b=a,this):b};this.$get=["$parse","$exceptionHandler","$sce",function(d,c,e){function f(a){return"\\\\\\"+a}function g(c){return c.replace(r,a).replace(s,b)}function h(a,b,c,d){var e;return e=a.$watch(function(a){e();return d(a)},b,c)}function k(f,k,r,p){function s(a){try{var b=a;a=r?e.getTrusted(r,b):e.valueOf(b);var d;if(p&&!y(a))d=
+a;else if(null==a)d="";else{switch(typeof a){case "string":break;case "number":a=""+a;break;default:a=eb(a)}d=a}return d}catch(g){c(Ka.interr(f,g))}}if(!f.length||-1===f.indexOf(a)){var u;k||(k=g(f),u=ba(k),u.exp=f,u.expressions=[],u.$$watchDelegate=h);return u}p=!!p;var n,z,A=0,Q=[],$=[];u=f.length;for(var M=[],P=[];A<u;)if(-1!=(n=f.indexOf(a,A))&&-1!=(z=f.indexOf(b,n+l)))A!==n&&M.push(g(f.substring(A,n))),A=f.substring(n+l,z),Q.push(A),$.push(d(A,s)),A=z+m,P.push(M.length),M.push("");else{A!==u&&
+M.push(g(f.substring(A)));break}r&&1<M.length&&Ka.throwNoconcat(f);if(!k||Q.length){var S=function(a){for(var b=0,c=Q.length;b<c;b++){if(p&&x(a[b]))return;M[P[b]]=a[b]}return M.join("")};return T(function(a){var b=0,d=Q.length,e=Array(d);try{for(;b<d;b++)e[b]=$[b](a);return S(e)}catch(g){c(Ka.interr(f,g))}},{exp:f,expressions:Q,$$watchDelegate:function(a,b){var c;return a.$watchGroup($,function(d,e){var f=S(d);D(b)&&b.call(this,f,d!==e?c:f,a);c=f})}})}}var l=a.length,m=b.length,r=new RegExp(a.replace(/./g,
+f),"g"),s=new RegExp(b.replace(/./g,f),"g");k.startSymbol=function(){return a};k.endSymbol=function(){return b};return k}]}function lf(){this.$get=["$rootScope","$window","$q","$$q","$browser",function(a,b,d,c,e){function f(f,k,l,m){function r(){s?f.apply(null,I):f(p)}var s=4<arguments.length,I=s?wa.call(arguments,4):[],K=b.setInterval,t=b.clearInterval,p=0,w=y(m)&&!m,u=(w?c:d).defer(),n=u.promise;l=y(l)?l:0;n.$$intervalId=K(function(){w?e.defer(r):a.$evalAsync(r);u.notify(p++);0<l&&p>=l&&(u.resolve(p),
+t(n.$$intervalId),delete g[n.$$intervalId]);w||a.$apply()},k);g[n.$$intervalId]=u;return n}var g={};f.cancel=function(a){return a&&a.$$intervalId in g?(g[a.$$intervalId].reject("canceled"),b.clearInterval(a.$$intervalId),delete g[a.$$intervalId],!0):!1};return f}]}function ec(a){a=a.split("/");for(var b=a.length;b--;)a[b]=qb(a[b]);return a.join("/")}function kd(a,b){var d=za(a);b.$$protocol=d.protocol;b.$$host=d.hostname;b.$$port=ca(d.port)||gg[d.protocol]||null}function ld(a,b){var d="/"!==a.charAt(0);
+d&&(a="/"+a);var c=za(a);b.$$path=decodeURIComponent(d&&"/"===c.pathname.charAt(0)?c.pathname.substring(1):c.pathname);b.$$search=zc(c.search);b.$$hash=decodeURIComponent(c.hash);b.$$path&&"/"!=b.$$path.charAt(0)&&(b.$$path="/"+b.$$path)}function pa(a,b){if(0===b.indexOf(a))return b.substr(a.length)}function Ia(a){var b=a.indexOf("#");return-1==b?a:a.substr(0,b)}function kb(a){return a.replace(/(#.+)|#$/,"$1")}function fc(a,b,d){this.$$html5=!0;d=d||"";kd(a,this);this.$$parse=function(a){var d=pa(b,
+a);if(!F(d))throw Gb("ipthprfx",a,b);ld(d,this);this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=Ub(this.$$search),d=this.$$hash?"#"+qb(this.$$hash):"";this.$$url=ec(this.$$path)+(a?"?"+a:"")+d;this.$$absUrl=b+this.$$url.substr(1)};this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;y(f=pa(a,c))?(g=f,g=y(f=pa(d,f))?b+(pa("/",f)||f):a+g):y(f=pa(b,c))?g=b+f:b==c+"/"&&(g=b);g&&this.$$parse(g);return!!g}}function gc(a,b,d){kd(a,this);
+this.$$parse=function(c){var e=pa(a,c)||pa(b,c),f;x(e)||"#"!==e.charAt(0)?this.$$html5?f=e:(f="",x(e)&&(a=c,this.replace())):(f=pa(d,e),x(f)&&(f=e));ld(f,this);c=this.$$path;var e=a,g=/^\/[A-Z]:(\/.*)/;0===f.indexOf(e)&&(f=f.replace(e,""));g.exec(f)||(c=(f=g.exec(c))?f[1]:c);this.$$path=c;this.$$compose()};this.$$compose=function(){var b=Ub(this.$$search),e=this.$$hash?"#"+qb(this.$$hash):"";this.$$url=ec(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+(this.$$url?d+this.$$url:"")};this.$$parseLinkUrl=
+function(b,d){return Ia(a)==Ia(b)?(this.$$parse(b),!0):!1}}function md(a,b,d){this.$$html5=!0;gc.apply(this,arguments);this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;a==Ia(c)?f=c:(g=pa(b,c))?f=a+d+g:b===c+"/"&&(f=b);f&&this.$$parse(f);return!!f};this.$$compose=function(){var b=Ub(this.$$search),e=this.$$hash?"#"+qb(this.$$hash):"";this.$$url=ec(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+d+this.$$url}}function Hb(a){return function(){return this[a]}}function nd(a,
+b){return function(d){if(x(d))return this[a];this[a]=b(d);this.$$compose();return this}}function rf(){var a="",b={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(b){return y(b)?(a=b,this):a};this.html5Mode=function(a){return Na(a)?(b.enabled=a,this):E(a)?(Na(a.enabled)&&(b.enabled=a.enabled),Na(a.requireBase)&&(b.requireBase=a.requireBase),Na(a.rewriteLinks)&&(b.rewriteLinks=a.rewriteLinks),this):b};this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(d,
+c,e,f,g){function h(a,b,d){var e=l.url(),f=l.$$state;try{c.url(a,b,d),l.$$state=c.state()}catch(g){throw l.url(e),l.$$state=f,g;}}function k(a,b){d.$broadcast("$locationChangeSuccess",l.absUrl(),a,l.$$state,b)}var l,m;m=c.baseHref();var r=c.url(),s;if(b.enabled){if(!m&&b.requireBase)throw Gb("nobase");s=r.substring(0,r.indexOf("/",r.indexOf("//")+2))+(m||"/");m=e.history?fc:md}else s=Ia(r),m=gc;var I=s.substr(0,Ia(s).lastIndexOf("/")+1);l=new m(s,I,"#"+a);l.$$parseLinkUrl(r,r);l.$$state=c.state();
+var n=/^\s*(javascript|mailto):/i;f.on("click",function(a){if(b.rewriteLinks&&!a.ctrlKey&&!a.metaKey&&!a.shiftKey&&2!=a.which&&2!=a.button){for(var e=C(a.target);"a"!==ra(e[0]);)if(e[0]===f[0]||!(e=e.parent())[0])return;var h=e.prop("href"),k=e.attr("href")||e.attr("xlink:href");E(h)&&"[object SVGAnimatedString]"===h.toString()&&(h=za(h.animVal).href);n.test(h)||!h||e.attr("target")||a.isDefaultPrevented()||!l.$$parseLinkUrl(h,k)||(a.preventDefault(),l.absUrl()!=c.url()&&(d.$apply(),g.angular["ff-684208-preventDefault"]=
+!0))}});kb(l.absUrl())!=kb(r)&&c.url(l.absUrl(),!0);var t=!0;c.onUrlChange(function(a,b){x(pa(I,a))?g.location.href=a:(d.$evalAsync(function(){var c=l.absUrl(),e=l.$$state,f;a=kb(a);l.$$parse(a);l.$$state=b;f=d.$broadcast("$locationChangeStart",a,c,b,e).defaultPrevented;l.absUrl()===a&&(f?(l.$$parse(c),l.$$state=e,h(c,!1,e)):(t=!1,k(c,e)))}),d.$$phase||d.$digest())});d.$watch(function(){var a=kb(c.url()),b=kb(l.absUrl()),f=c.state(),g=l.$$replace,m=a!==b||l.$$html5&&e.history&&f!==l.$$state;if(t||
+m)t=!1,d.$evalAsync(function(){var b=l.absUrl(),c=d.$broadcast("$locationChangeStart",b,a,l.$$state,f).defaultPrevented;l.absUrl()===b&&(c?(l.$$parse(a),l.$$state=f):(m&&h(b,g,f===l.$$state?null:l.$$state),k(a,f)))});l.$$replace=!1});return l}]}function sf(){var a=!0,b=this;this.debugEnabled=function(b){return y(b)?(a=b,this):a};this.$get=["$window",function(d){function c(a){a instanceof Error&&(a.stack?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&
+(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=d.console||{},e=b[a]||b.log||B;a=!1;try{a=!!e.apply}catch(k){}return a?function(){var a=[];n(arguments,function(b){a.push(c(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){a&&c.apply(b,arguments)}}()}}]}function Xa(a,b){if("__defineGetter__"===a||"__defineSetter__"===a||"__lookupGetter__"===a||"__lookupSetter__"===
+a||"__proto__"===a)throw ka("isecfld",b);return a}function hg(a){return a+""}function Aa(a,b){if(a){if(a.constructor===a)throw ka("isecfn",b);if(a.window===a)throw ka("isecwindow",b);if(a.children&&(a.nodeName||a.prop&&a.attr&&a.find))throw ka("isecdom",b);if(a===Object)throw ka("isecobj",b);}return a}function od(a,b){if(a){if(a.constructor===a)throw ka("isecfn",b);if(a===ig||a===jg||a===kg)throw ka("isecff",b);}}function Ib(a,b){if(a&&(a===(0).constructor||a===(!1).constructor||a==="".constructor||
+a==={}.constructor||a===[].constructor||a===Function.constructor))throw ka("isecaf",b);}function lg(a,b){return"undefined"!==typeof a?a:b}function pd(a,b){return"undefined"===typeof a?b:"undefined"===typeof b?a:a+b}function R(a,b){var d,c;switch(a.type){case q.Program:d=!0;n(a.body,function(a){R(a.expression,b);d=d&&a.expression.constant});a.constant=d;break;case q.Literal:a.constant=!0;a.toWatch=[];break;case q.UnaryExpression:R(a.argument,b);a.constant=a.argument.constant;a.toWatch=a.argument.toWatch;
+break;case q.BinaryExpression:R(a.left,b);R(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.left.toWatch.concat(a.right.toWatch);break;case q.LogicalExpression:R(a.left,b);R(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.constant?[]:[a];break;case q.ConditionalExpression:R(a.test,b);R(a.alternate,b);R(a.consequent,b);a.constant=a.test.constant&&a.alternate.constant&&a.consequent.constant;a.toWatch=a.constant?[]:[a];break;case q.Identifier:a.constant=!1;a.toWatch=
+[a];break;case q.MemberExpression:R(a.object,b);a.computed&&R(a.property,b);a.constant=a.object.constant&&(!a.computed||a.property.constant);a.toWatch=[a];break;case q.CallExpression:d=a.filter?!b(a.callee.name).$stateful:!1;c=[];n(a.arguments,function(a){R(a,b);d=d&&a.constant;a.constant||c.push.apply(c,a.toWatch)});a.constant=d;a.toWatch=a.filter&&!b(a.callee.name).$stateful?c:[a];break;case q.AssignmentExpression:R(a.left,b);R(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=[a];
+break;case q.ArrayExpression:d=!0;c=[];n(a.elements,function(a){R(a,b);d=d&&a.constant;a.constant||c.push.apply(c,a.toWatch)});a.constant=d;a.toWatch=c;break;case q.ObjectExpression:d=!0;c=[];n(a.properties,function(a){R(a.value,b);d=d&&a.value.constant;a.value.constant||c.push.apply(c,a.value.toWatch)});a.constant=d;a.toWatch=c;break;case q.ThisExpression:a.constant=!1;a.toWatch=[];break;case q.LocalsExpression:a.constant=!1,a.toWatch=[]}}function qd(a){if(1==a.length){a=a[0].expression;var b=a.toWatch;
+return 1!==b.length?b:b[0]!==a?b:v}}function rd(a){return a.type===q.Identifier||a.type===q.MemberExpression}function sd(a){if(1===a.body.length&&rd(a.body[0].expression))return{type:q.AssignmentExpression,left:a.body[0].expression,right:{type:q.NGValueParameter},operator:"="}}function td(a){return 0===a.body.length||1===a.body.length&&(a.body[0].expression.type===q.Literal||a.body[0].expression.type===q.ArrayExpression||a.body[0].expression.type===q.ObjectExpression)}function ud(a,b){this.astBuilder=
+a;this.$filter=b}function vd(a,b){this.astBuilder=a;this.$filter=b}function Jb(a){return"constructor"==a}function hc(a){return D(a.valueOf)?a.valueOf():mg.call(a)}function tf(){var a=Z(),b=Z();this.$get=["$filter",function(d){function c(c,f,r){var u,n,z;r=r||K;switch(typeof c){case "string":z=c=c.trim();var A=r?b:a;u=A[z];if(!u){":"===c.charAt(0)&&":"===c.charAt(1)&&(n=!0,c=c.substring(2));u=r?I:s;var Q=new ic(u);u=(new jc(Q,d,u)).parse(c);u.constant?u.$$watchDelegate=l:n?u.$$watchDelegate=u.literal?
+k:h:u.inputs&&(u.$$watchDelegate=g);r&&(u=e(u));A[z]=u}return m(u,f);case "function":return m(c,f);default:return m(B,f)}}function e(a){function b(c,d,e,f){var g=K;K=!0;try{return a(c,d,e,f)}finally{K=g}}if(!a)return a;b.$$watchDelegate=a.$$watchDelegate;b.assign=e(a.assign);b.constant=a.constant;b.literal=a.literal;for(var c=0;a.inputs&&c<a.inputs.length;++c)a.inputs[c]=e(a.inputs[c]);b.inputs=a.inputs;return b}function f(a,b){return null==a||null==b?a===b:"object"===typeof a&&(a=hc(a),"object"===
+typeof a)?!1:a===b||a!==a&&b!==b}function g(a,b,c,d,e){var g=d.inputs,h;if(1===g.length){var k=f,g=g[0];return a.$watch(function(a){var b=g(a);f(b,k)||(h=d(a,v,v,[b]),k=b&&hc(b));return h},b,c,e)}for(var l=[],m=[],r=0,s=g.length;r<s;r++)l[r]=f,m[r]=null;return a.$watch(function(a){for(var b=!1,c=0,e=g.length;c<e;c++){var k=g[c](a);if(b||(b=!f(k,l[c])))m[c]=k,l[c]=k&&hc(k)}b&&(h=d(a,v,v,m));return h},b,c,e)}function h(a,b,c,d){var e,f;return e=a.$watch(function(a){return d(a)},function(a,c,d){f=a;
+D(b)&&b.apply(this,arguments);y(a)&&d.$$postDigest(function(){y(f)&&e()})},c)}function k(a,b,c,d){function e(a){var b=!0;n(a,function(a){y(a)||(b=!1)});return b}var f,g;return f=a.$watch(function(a){return d(a)},function(a,c,d){g=a;D(b)&&b.call(this,a,c,d);e(a)&&d.$$postDigest(function(){e(g)&&f()})},c)}function l(a,b,c,d){var e;return e=a.$watch(function(a){e();return d(a)},b,c)}function m(a,b){if(!b)return a;var c=a.$$watchDelegate,d=!1,c=c!==k&&c!==h?function(c,e,f,g){f=d&&g?g[0]:a(c,e,f,g);return b(f,
+c,e)}:function(c,d,e,f){e=a(c,d,e,f);c=b(e,c,d);return y(e)?c:e};a.$$watchDelegate&&a.$$watchDelegate!==g?c.$$watchDelegate=a.$$watchDelegate:b.$stateful||(c.$$watchDelegate=g,d=!a.inputs,c.inputs=a.inputs?a.inputs:[a]);return c}var r=Ea().noUnsafeEval,s={csp:r,expensiveChecks:!1},I={csp:r,expensiveChecks:!0},K=!1;c.$$runningExpensiveChecks=function(){return K};return c}]}function vf(){this.$get=["$rootScope","$exceptionHandler",function(a,b){return wd(function(b){a.$evalAsync(b)},b)}]}function wf(){this.$get=
+["$browser","$exceptionHandler",function(a,b){return wd(function(b){a.defer(b)},b)}]}function wd(a,b){function d(){this.$$state={status:0}}function c(a,b){return function(c){b.call(a,c)}}function e(c){!c.processScheduled&&c.pending&&(c.processScheduled=!0,a(function(){var a,d,e;e=c.pending;c.processScheduled=!1;c.pending=v;for(var f=0,g=e.length;f<g;++f){d=e[f][0];a=e[f][c.status];try{D(a)?d.resolve(a(c.value)):1===c.status?d.resolve(c.value):d.reject(c.value)}catch(h){d.reject(h),b(h)}}}))}function f(){this.promise=
+new d}var g=H("$q",TypeError);T(d.prototype,{then:function(a,b,c){if(x(a)&&x(b)&&x(c))return this;var d=new f;this.$$state.pending=this.$$state.pending||[];this.$$state.pending.push([d,a,b,c]);0<this.$$state.status&&e(this.$$state);return d.promise},"catch":function(a){return this.then(null,a)},"finally":function(a,b){return this.then(function(b){return k(b,!0,a)},function(b){return k(b,!1,a)},b)}});T(f.prototype,{resolve:function(a){this.promise.$$state.status||(a===this.promise?this.$$reject(g("qcycle",
+a)):this.$$resolve(a))},$$resolve:function(a){function d(a){k||(k=!0,h.$$resolve(a))}function f(a){k||(k=!0,h.$$reject(a))}var g,h=this,k=!1;try{if(E(a)||D(a))g=a&&a.then;D(g)?(this.promise.$$state.status=-1,g.call(a,d,f,c(this,this.notify))):(this.promise.$$state.value=a,this.promise.$$state.status=1,e(this.promise.$$state))}catch(l){f(l),b(l)}},reject:function(a){this.promise.$$state.status||this.$$reject(a)},$$reject:function(a){this.promise.$$state.value=a;this.promise.$$state.status=2;e(this.promise.$$state)},
+notify:function(c){var d=this.promise.$$state.pending;0>=this.promise.$$state.status&&d&&d.length&&a(function(){for(var a,e,f=0,g=d.length;f<g;f++){e=d[f][0];a=d[f][3];try{e.notify(D(a)?a(c):c)}catch(h){b(h)}}})}});var h=function(a,b){var c=new f;b?c.resolve(a):c.reject(a);return c.promise},k=function(a,b,c){var d=null;try{D(c)&&(d=c())}catch(e){return h(e,!1)}return d&&D(d.then)?d.then(function(){return h(a,b)},function(a){return h(a,!1)}):h(a,b)},l=function(a,b,c,d){var e=new f;e.resolve(a);return e.promise.then(b,
+c,d)},m=function(a){if(!D(a))throw g("norslvr",a);var b=new f;a(function(a){b.resolve(a)},function(a){b.reject(a)});return b.promise};m.prototype=d.prototype;m.defer=function(){var a=new f;a.resolve=c(a,a.resolve);a.reject=c(a,a.reject);a.notify=c(a,a.notify);return a};m.reject=function(a){var b=new f;b.reject(a);return b.promise};m.when=l;m.resolve=l;m.all=function(a){var b=new f,c=0,d=L(a)?[]:{};n(a,function(a,e){c++;l(a).then(function(a){d.hasOwnProperty(e)||(d[e]=a,--c||b.resolve(d))},function(a){d.hasOwnProperty(e)||
+b.reject(a)})});0===c&&b.resolve(d);return b.promise};return m}function Ff(){this.$get=["$window","$timeout",function(a,b){var d=a.requestAnimationFrame||a.webkitRequestAnimationFrame,c=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.webkitCancelRequestAnimationFrame,e=!!d,f=e?function(a){var b=d(a);return function(){c(b)}}:function(a){var c=b(a,16.66,!1);return function(){b.cancel(c)}};f.supported=e;return f}]}function uf(){function a(a){function b(){this.$$watchers=this.$$nextSibling=this.$$childHead=
+this.$$childTail=null;this.$$listeners={};this.$$listenerCount={};this.$$watchersCount=0;this.$id=++pb;this.$$ChildScope=null}b.prototype=a;return b}var b=10,d=H("$rootScope"),c=null,e=null;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=["$exceptionHandler","$parse","$browser",function(f,g,h){function k(a){a.currentScope.$$destroyed=!0}function l(a){9===xa&&(a.$$childHead&&l(a.$$childHead),a.$$nextSibling&&l(a.$$nextSibling));a.$parent=a.$$nextSibling=a.$$prevSibling=a.$$childHead=
+a.$$childTail=a.$root=a.$$watchers=null}function m(){this.$id=++pb;this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this.$root=this;this.$$destroyed=!1;this.$$listeners={};this.$$listenerCount={};this.$$watchersCount=0;this.$$isolateBindings=null}function r(a){if(w.$$phase)throw d("inprog",w.$$phase);w.$$phase=a}function s(a,b){do a.$$watchersCount+=b;while(a=a.$parent)}function I(a,b,c){do a.$$listenerCount[c]-=b,0===a.$$listenerCount[c]&&
+delete a.$$listenerCount[c];while(a=a.$parent)}function q(){}function t(){for(;z.length;)try{z.shift()()}catch(a){f(a)}e=null}function p(){null===e&&(e=h.defer(function(){w.$apply(t)}))}m.prototype={constructor:m,$new:function(b,c){var d;c=c||this;b?(d=new m,d.$root=this.$root):(this.$$ChildScope||(this.$$ChildScope=a(this)),d=new this.$$ChildScope);d.$parent=c;d.$$prevSibling=c.$$childTail;c.$$childHead?(c.$$childTail.$$nextSibling=d,c.$$childTail=d):c.$$childHead=c.$$childTail=d;(b||c!=this)&&d.$on("$destroy",
+k);return d},$watch:function(a,b,d,e){var f=g(a);if(f.$$watchDelegate)return f.$$watchDelegate(this,b,d,f,a);var h=this,k=h.$$watchers,l={fn:b,last:q,get:f,exp:e||a,eq:!!d};c=null;D(b)||(l.fn=B);k||(k=h.$$watchers=[]);k.unshift(l);s(this,1);return function(){0<=cb(k,l)&&s(h,-1);c=null}},$watchGroup:function(a,b){function c(){h=!1;k?(k=!1,b(e,e,g)):b(e,d,g)}var d=Array(a.length),e=Array(a.length),f=[],g=this,h=!1,k=!0;if(!a.length){var l=!0;g.$evalAsync(function(){l&&b(e,e,g)});return function(){l=
+!1}}if(1===a.length)return this.$watch(a[0],function(a,c,f){e[0]=a;d[0]=c;b(e,a===c?e:d,f)});n(a,function(a,b){var k=g.$watch(a,function(a,f){e[b]=a;d[b]=f;h||(h=!0,g.$evalAsync(c))});f.push(k)});return function(){for(;f.length;)f.shift()()}},$watchCollection:function(a,b){function c(a){e=a;var b,d,g,h;if(!x(e)){if(E(e))if(Ca(e))for(f!==r&&(f=r,u=f.length=0,l++),a=e.length,u!==a&&(l++,f.length=u=a),b=0;b<a;b++)h=f[b],g=e[b],d=h!==h&&g!==g,d||h===g||(l++,f[b]=g);else{f!==s&&(f=s={},u=0,l++);a=0;for(b in e)sa.call(e,
+b)&&(a++,g=e[b],h=f[b],b in f?(d=h!==h&&g!==g,d||h===g||(l++,f[b]=g)):(u++,f[b]=g,l++));if(u>a)for(b in l++,f)sa.call(e,b)||(u--,delete f[b])}else f!==e&&(f=e,l++);return l}}c.$stateful=!0;var d=this,e,f,h,k=1<b.length,l=0,m=g(a,c),r=[],s={},p=!0,u=0;return this.$watch(m,function(){p?(p=!1,b(e,e,d)):b(e,h,d);if(k)if(E(e))if(Ca(e)){h=Array(e.length);for(var a=0;a<e.length;a++)h[a]=e[a]}else for(a in h={},e)sa.call(e,a)&&(h[a]=e[a]);else h=e})},$digest:function(){var a,g,k,l,m,s,p,n,I=b,z,y=[],x,C;
+r("$digest");h.$$checkUrlChange();this===w&&null!==e&&(h.defer.cancel(e),t());c=null;do{n=!1;for(z=this;u.length;){try{C=u.shift(),C.scope.$eval(C.expression,C.locals)}catch(B){f(B)}c=null}a:do{if(s=z.$$watchers)for(p=s.length;p--;)try{if(a=s[p])if(m=a.get,(g=m(z))!==(k=a.last)&&!(a.eq?oa(g,k):"number"===typeof g&&"number"===typeof k&&isNaN(g)&&isNaN(k)))n=!0,c=a,a.last=a.eq?Oa(g,null):g,l=a.fn,l(g,k===q?g:k,z),5>I&&(x=4-I,y[x]||(y[x]=[]),y[x].push({msg:D(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):
+a.exp,newVal:g,oldVal:k}));else if(a===c){n=!1;break a}}catch(E){f(E)}if(!(s=z.$$watchersCount&&z.$$childHead||z!==this&&z.$$nextSibling))for(;z!==this&&!(s=z.$$nextSibling);)z=z.$parent}while(z=s);if((n||u.length)&&!I--)throw w.$$phase=null,d("infdig",b,y);}while(n||u.length);for(w.$$phase=null;v.length;)try{v.shift()()}catch(H){f(H)}},$destroy:function(){if(!this.$$destroyed){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;this===w&&h.$$applicationDestroyed();s(this,-this.$$watchersCount);
+for(var b in this.$$listenerCount)I(this,this.$$listenerCount[b],b);a&&a.$$childHead==this&&(a.$$childHead=this.$$nextSibling);a&&a.$$childTail==this&&(a.$$childTail=this.$$prevSibling);this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling);this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling);this.$destroy=this.$digest=this.$apply=this.$evalAsync=this.$applyAsync=B;this.$on=this.$watch=this.$watchGroup=function(){return B};this.$$listeners={};this.$$nextSibling=
+null;l(this)}},$eval:function(a,b){return g(a)(this,b)},$evalAsync:function(a,b){w.$$phase||u.length||h.defer(function(){u.length&&w.$digest()});u.push({scope:this,expression:g(a),locals:b})},$$postDigest:function(a){v.push(a)},$apply:function(a){try{r("$apply");try{return this.$eval(a)}finally{w.$$phase=null}}catch(b){f(b)}finally{try{w.$digest()}catch(c){throw f(c),c;}}},$applyAsync:function(a){function b(){c.$eval(a)}var c=this;a&&z.push(b);a=g(a);p()},$on:function(a,b){var c=this.$$listeners[a];
+c||(this.$$listeners[a]=c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||(d.$$listenerCount[a]=0),d.$$listenerCount[a]++;while(d=d.$parent);var e=this;return function(){var d=c.indexOf(b);-1!==d&&(c[d]=null,I(e,1,a))}},$emit:function(a,b){var c=[],d,e=this,g=!1,h={name:a,targetScope:e,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},k=db([h],arguments,1),l,m;do{d=e.$$listeners[a]||c;h.currentScope=e;l=0;for(m=d.length;l<m;l++)if(d[l])try{d[l].apply(null,
+k)}catch(r){f(r)}else d.splice(l,1),l--,m--;if(g)return h.currentScope=null,h;e=e.$parent}while(e);h.currentScope=null;return h},$broadcast:function(a,b){var c=this,d=this,e={name:a,targetScope:this,preventDefault:function(){e.defaultPrevented=!0},defaultPrevented:!1};if(!this.$$listenerCount[a])return e;for(var g=db([e],arguments,1),h,k;c=d;){e.currentScope=c;d=c.$$listeners[a]||[];h=0;for(k=d.length;h<k;h++)if(d[h])try{d[h].apply(null,g)}catch(l){f(l)}else d.splice(h,1),h--,k--;if(!(d=c.$$listenerCount[a]&&
+c.$$childHead||c!==this&&c.$$nextSibling))for(;c!==this&&!(d=c.$$nextSibling);)c=c.$parent}e.currentScope=null;return e}};var w=new m,u=w.$$asyncQueue=[],v=w.$$postDigestQueue=[],z=w.$$applyAsyncQueue=[];return w}]}function ne(){var a=/^\s*(https?|ftp|mailto|tel|file):/,b=/^\s*((https?|ftp|file|blob):|data:image\/)/;this.aHrefSanitizationWhitelist=function(b){return y(b)?(a=b,this):a};this.imgSrcSanitizationWhitelist=function(a){return y(a)?(b=a,this):b};this.$get=function(){return function(d,c){var e=
+c?b:a,f;f=za(d).href;return""===f||f.match(e)?d:"unsafe:"+f}}}function ng(a){if("self"===a)return a;if(F(a)){if(-1<a.indexOf("***"))throw Ba("iwcard",a);a=xd(a).replace("\\*\\*",".*").replace("\\*","[^:/.?&;]*");return new RegExp("^"+a+"$")}if($a(a))return new RegExp("^"+a.source+"$");throw Ba("imatcher");}function yd(a){var b=[];y(a)&&n(a,function(a){b.push(ng(a))});return b}function yf(){this.SCE_CONTEXTS=qa;var a=["self"],b=[];this.resourceUrlWhitelist=function(b){arguments.length&&(a=yd(b));return a};
+this.resourceUrlBlacklist=function(a){arguments.length&&(b=yd(a));return b};this.$get=["$injector",function(d){function c(a,b){return"self"===a?jd(b):!!a.exec(b.href)}function e(a){var b=function(a){this.$$unwrapTrustedValue=function(){return a}};a&&(b.prototype=new a);b.prototype.valueOf=function(){return this.$$unwrapTrustedValue()};b.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()};return b}var f=function(a){throw Ba("unsafe");};d.has("$sanitize")&&(f=d.get("$sanitize"));
+var g=e(),h={};h[qa.HTML]=e(g);h[qa.CSS]=e(g);h[qa.URL]=e(g);h[qa.JS]=e(g);h[qa.RESOURCE_URL]=e(h[qa.URL]);return{trustAs:function(a,b){var c=h.hasOwnProperty(a)?h[a]:null;if(!c)throw Ba("icontext",a,b);if(null===b||x(b)||""===b)return b;if("string"!==typeof b)throw Ba("itype",a);return new c(b)},getTrusted:function(d,e){if(null===e||x(e)||""===e)return e;var g=h.hasOwnProperty(d)?h[d]:null;if(g&&e instanceof g)return e.$$unwrapTrustedValue();if(d===qa.RESOURCE_URL){var g=za(e.toString()),r,s,n=!1;
+r=0;for(s=a.length;r<s;r++)if(c(a[r],g)){n=!0;break}if(n)for(r=0,s=b.length;r<s;r++)if(c(b[r],g)){n=!1;break}if(n)return e;throw Ba("insecurl",e.toString());}if(d===qa.HTML)return f(e);throw Ba("unsafe");},valueOf:function(a){return a instanceof g?a.$$unwrapTrustedValue():a}}}]}function xf(){var a=!0;this.enabled=function(b){arguments.length&&(a=!!b);return a};this.$get=["$parse","$sceDelegate",function(b,d){if(a&&8>xa)throw Ba("iequirks");var c=na(qa);c.isEnabled=function(){return a};c.trustAs=d.trustAs;
+c.getTrusted=d.getTrusted;c.valueOf=d.valueOf;a||(c.trustAs=c.getTrusted=function(a,b){return b},c.valueOf=ab);c.parseAs=function(a,d){var e=b(d);return e.literal&&e.constant?e:b(d,function(b){return c.getTrusted(a,b)})};var e=c.parseAs,f=c.getTrusted,g=c.trustAs;n(qa,function(a,b){var d=G(b);c[gb("parse_as_"+d)]=function(b){return e(a,b)};c[gb("get_trusted_"+d)]=function(b){return f(a,b)};c[gb("trust_as_"+d)]=function(b){return g(a,b)}});return c}]}function zf(){this.$get=["$window","$document",
+function(a,b){var d={},c=ca((/android (\d+)/.exec(G((a.navigator||{}).userAgent))||[])[1]),e=/Boxee/i.test((a.navigator||{}).userAgent),f=b[0]||{},g,h=/^(Moz|webkit|ms)(?=[A-Z])/,k=f.body&&f.body.style,l=!1,m=!1;if(k){for(var r in k)if(l=h.exec(r)){g=l[0];g=g.substr(0,1).toUpperCase()+g.substr(1);break}g||(g="WebkitOpacity"in k&&"webkit");l=!!("transition"in k||g+"Transition"in k);m=!!("animation"in k||g+"Animation"in k);!c||l&&m||(l=F(k.webkitTransition),m=F(k.webkitAnimation))}return{history:!(!a.history||
+!a.history.pushState||4>c||e),hasEvent:function(a){if("input"===a&&11>=xa)return!1;if(x(d[a])){var b=f.createElement("div");d[a]="on"+a in b}return d[a]},csp:Ea(),vendorPrefix:g,transitions:l,animations:m,android:c}}]}function Bf(){var a;this.httpOptions=function(b){return b?(a=b,this):a};this.$get=["$templateCache","$http","$q","$sce",function(b,d,c,e){function f(g,h){f.totalPendingRequests++;F(g)&&b.get(g)||(g=e.getTrustedResourceUrl(g));var k=d.defaults&&d.defaults.transformResponse;L(k)?k=k.filter(function(a){return a!==
+cc}):k===cc&&(k=null);return d.get(g,T({cache:b,transformResponse:k},a))["finally"](function(){f.totalPendingRequests--}).then(function(a){b.put(g,a.data);return a.data},function(a){if(!h)throw ja("tpload",g,a.status,a.statusText);return c.reject(a)})}f.totalPendingRequests=0;return f}]}function Cf(){this.$get=["$rootScope","$browser","$location",function(a,b,d){return{findBindings:function(a,b,d){a=a.getElementsByClassName("ng-binding");var g=[];n(a,function(a){var c=ia.element(a).data("$binding");
+c&&n(c,function(c){d?(new RegExp("(^|\\s)"+xd(b)+"(\\s|\\||$)")).test(c)&&g.push(a):-1!=c.indexOf(b)&&g.push(a)})});return g},findModels:function(a,b,d){for(var g=["ng-","data-ng-","ng\\:"],h=0;h<g.length;++h){var k=a.querySelectorAll("["+g[h]+"model"+(d?"=":"*=")+'"'+b+'"]');if(k.length)return k}},getLocation:function(){return d.url()},setLocation:function(b){b!==d.url()&&(d.url(b),a.$digest())},whenStable:function(a){b.notifyWhenNoOutstandingRequests(a)}}}]}function Df(){this.$get=["$rootScope",
+"$browser","$q","$$q","$exceptionHandler",function(a,b,d,c,e){function f(f,k,l){D(f)||(l=k,k=f,f=B);var m=wa.call(arguments,3),r=y(l)&&!l,s=(r?c:d).defer(),n=s.promise,q;q=b.defer(function(){try{s.resolve(f.apply(null,m))}catch(b){s.reject(b),e(b)}finally{delete g[n.$$timeoutId]}r||a.$apply()},k);n.$$timeoutId=q;g[q]=s;return n}var g={};f.cancel=function(a){return a&&a.$$timeoutId in g?(g[a.$$timeoutId].reject("canceled"),delete g[a.$$timeoutId],b.defer.cancel(a.$$timeoutId)):!1};return f}]}function za(a){xa&&
+(Y.setAttribute("href",a),a=Y.href);Y.setAttribute("href",a);return{href:Y.href,protocol:Y.protocol?Y.protocol.replace(/:$/,""):"",host:Y.host,search:Y.search?Y.search.replace(/^\?/,""):"",hash:Y.hash?Y.hash.replace(/^#/,""):"",hostname:Y.hostname,port:Y.port,pathname:"/"===Y.pathname.charAt(0)?Y.pathname:"/"+Y.pathname}}function jd(a){a=F(a)?za(a):a;return a.protocol===zd.protocol&&a.host===zd.host}function Ef(){this.$get=ba(O)}function Ad(a){function b(a){try{return decodeURIComponent(a)}catch(b){return a}}
+var d=a[0]||{},c={},e="";return function(){var a,g,h,k,l;a=d.cookie||"";if(a!==e)for(e=a,a=e.split("; "),c={},h=0;h<a.length;h++)g=a[h],k=g.indexOf("="),0<k&&(l=b(g.substring(0,k)),x(c[l])&&(c[l]=b(g.substring(k+1))));return c}}function If(){this.$get=Ad}function Lc(a){function b(d,c){if(E(d)){var e={};n(d,function(a,c){e[c]=b(c,a)});return e}return a.factory(d+"Filter",c)}this.register=b;this.$get=["$injector",function(a){return function(b){return a.get(b+"Filter")}}];b("currency",Bd);b("date",Cd);
+b("filter",og);b("json",pg);b("limitTo",qg);b("lowercase",rg);b("number",Dd);b("orderBy",Ed);b("uppercase",sg)}function og(){return function(a,b,d){if(!Ca(a)){if(null==a)return a;throw H("filter")("notarray",a);}var c;switch(kc(b)){case "function":break;case "boolean":case "null":case "number":case "string":c=!0;case "object":b=tg(b,d,c);break;default:return a}return Array.prototype.filter.call(a,b)}}function tg(a,b,d){var c=E(a)&&"$"in a;!0===b?b=oa:D(b)||(b=function(a,b){if(x(a))return!1;if(null===
+a||null===b)return a===b;if(E(b)||E(a)&&!tc(a))return!1;a=G(""+a);b=G(""+b);return-1!==a.indexOf(b)});return function(e){return c&&!E(e)?La(e,a.$,b,!1):La(e,a,b,d)}}function La(a,b,d,c,e){var f=kc(a),g=kc(b);if("string"===g&&"!"===b.charAt(0))return!La(a,b.substring(1),d,c);if(L(a))return a.some(function(a){return La(a,b,d,c)});switch(f){case "object":var h;if(c){for(h in a)if("$"!==h.charAt(0)&&La(a[h],b,d,!0))return!0;return e?!1:La(a,b,d,!1)}if("object"===g){for(h in b)if(e=b[h],!D(e)&&!x(e)&&
+(f="$"===h,!La(f?a:a[h],e,d,f,f)))return!1;return!0}return d(a,b);case "function":return!1;default:return d(a,b)}}function kc(a){return null===a?"null":typeof a}function Bd(a){var b=a.NUMBER_FORMATS;return function(a,c,e){x(c)&&(c=b.CURRENCY_SYM);x(e)&&(e=b.PATTERNS[1].maxFrac);return null==a?a:Fd(a,b.PATTERNS[1],b.GROUP_SEP,b.DECIMAL_SEP,e).replace(/\u00A4/g,c)}}function Dd(a){var b=a.NUMBER_FORMATS;return function(a,c){return null==a?a:Fd(a,b.PATTERNS[0],b.GROUP_SEP,b.DECIMAL_SEP,c)}}function ug(a){var b=
+0,d,c,e,f,g;-1<(c=a.indexOf(Gd))&&(a=a.replace(Gd,""));0<(e=a.search(/e/i))?(0>c&&(c=e),c+=+a.slice(e+1),a=a.substring(0,e)):0>c&&(c=a.length);for(e=0;a.charAt(e)==lc;e++);if(e==(g=a.length))d=[0],c=1;else{for(g--;a.charAt(g)==lc;)g--;c-=e;d=[];for(f=0;e<=g;e++,f++)d[f]=+a.charAt(e)}c>Hd&&(d=d.splice(0,Hd-1),b=c-1,c=1);return{d:d,e:b,i:c}}function vg(a,b,d,c){var e=a.d,f=e.length-a.i;b=x(b)?Math.min(Math.max(d,f),c):+b;d=b+a.i;c=e[d];if(0<d)e.splice(d);else{a.i=1;e.length=d=b+1;for(var g=0;g<d;g++)e[g]=
+0}for(5<=c&&e[d-1]++;f<b;f++)e.push(0);if(b=e.reduceRight(function(a,b,c,d){b+=a;d[c]=b%10;return Math.floor(b/10)},0))e.unshift(b),a.i++}function Fd(a,b,d,c,e){if(!F(a)&&!N(a)||isNaN(a))return"";var f=!isFinite(a),g=!1,h=Math.abs(a)+"",k="";if(f)k="\u221e";else{g=ug(h);vg(g,e,b.minFrac,b.maxFrac);k=g.d;h=g.i;e=g.e;f=[];for(g=k.reduce(function(a,b){return a&&!b},!0);0>h;)k.unshift(0),h++;0<h?f=k.splice(h):(f=k,k=[0]);h=[];for(k.length>b.lgSize&&h.unshift(k.splice(-b.lgSize).join(""));k.length>b.gSize;)h.unshift(k.splice(-b.gSize).join(""));
+k.length&&h.unshift(k.join(""));k=h.join(d);f.length&&(k+=c+f.join(""));e&&(k+="e+"+e)}return 0>a&&!g?b.negPre+k+b.negSuf:b.posPre+k+b.posSuf}function Kb(a,b,d){var c="";0>a&&(c="-",a=-a);for(a=""+a;a.length<b;)a=lc+a;d&&(a=a.substr(a.length-b));return c+a}function aa(a,b,d,c){d=d||0;return function(e){e=e["get"+a]();if(0<d||e>-d)e+=d;0===e&&-12==d&&(e=12);return Kb(e,b,c)}}function Lb(a,b){return function(d,c){var e=d["get"+a](),f=ub(b?"SHORT"+a:a);return c[f][e]}}function Id(a){var b=(new Date(a,
+0,1)).getDay();return new Date(a,0,(4>=b?5:12)-b)}function Jd(a){return function(b){var d=Id(b.getFullYear());b=+new Date(b.getFullYear(),b.getMonth(),b.getDate()+(4-b.getDay()))-+d;b=1+Math.round(b/6048E5);return Kb(b,a)}}function mc(a,b){return 0>=a.getFullYear()?b.ERAS[0]:b.ERAS[1]}function Cd(a){function b(a){var b;if(b=a.match(d)){a=new Date(0);var f=0,g=0,h=b[8]?a.setUTCFullYear:a.setFullYear,k=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=ca(b[9]+b[10]),g=ca(b[9]+b[11]));h.call(a,ca(b[1]),ca(b[2])-
+1,ca(b[3]));f=ca(b[4]||0)-f;g=ca(b[5]||0)-g;h=ca(b[6]||0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));k.call(a,f,g,h,b)}return a}var d=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,d,f){var g="",h=[],k,l;d=d||"mediumDate";d=a.DATETIME_FORMATS[d]||d;F(c)&&(c=wg.test(c)?ca(c):b(c));N(c)&&(c=new Date(c));if(!V(c)||!isFinite(c.getTime()))return c;for(;d;)(l=xg.exec(d))?(h=db(h,l,1),d=h.pop()):(h.push(d),d=null);var m=c.getTimezoneOffset();
+f&&(m=xc(f,m),c=Tb(c,f,!0));n(h,function(b){k=yg[b];g+=k?k(c,a.DATETIME_FORMATS,m):"''"===b?"'":b.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function pg(){return function(a,b){x(b)&&(b=2);return eb(a,b)}}function qg(){return function(a,b,d){b=Infinity===Math.abs(Number(b))?Number(b):ca(b);if(isNaN(b))return a;N(a)&&(a=a.toString());if(!L(a)&&!F(a))return a;d=!d||isNaN(d)?0:ca(d);d=0>d?Math.max(0,a.length+d):d;return 0<=b?a.slice(d,d+b):0===d?a.slice(b,a.length):a.slice(Math.max(0,d+b),
+d)}}function Ed(a){function b(b,d){d=d?-1:1;return b.map(function(b){var c=1,h=ab;if(D(b))h=b;else if(F(b)){if("+"==b.charAt(0)||"-"==b.charAt(0))c="-"==b.charAt(0)?-1:1,b=b.substring(1);if(""!==b&&(h=a(b),h.constant))var k=h(),h=function(a){return a[k]}}return{get:h,descending:c*d}})}function d(a){switch(typeof a){case "number":case "boolean":case "string":return!0;default:return!1}}return function(a,e,f){if(null==a)return a;if(!Ca(a))throw H("orderBy")("notarray",a);L(e)||(e=[e]);0===e.length&&
+(e=["+"]);var g=b(e,f);g.push({get:function(){return{}},descending:f?-1:1});a=Array.prototype.map.call(a,function(a,b){return{value:a,predicateValues:g.map(function(c){var e=c.get(a);c=typeof e;if(null===e)c="string",e="null";else if("string"===c)e=e.toLowerCase();else if("object"===c)a:{if("function"===typeof e.valueOf&&(e=e.valueOf(),d(e)))break a;if(tc(e)&&(e=e.toString(),d(e)))break a;e=b}return{value:e,type:c}})}});a.sort(function(a,b){for(var c=0,d=0,e=g.length;d<e;++d){var c=a.predicateValues[d],
+f=b.predicateValues[d],n=0;c.type===f.type?c.value!==f.value&&(n=c.value<f.value?-1:1):n=c.type<f.type?-1:1;if(c=n*g[d].descending)break}return c});return a=a.map(function(a){return a.value})}}function Ma(a){D(a)&&(a={link:a});a.restrict=a.restrict||"AC";return ba(a)}function Kd(a,b,d,c,e){var f=this,g=[];f.$error={};f.$$success={};f.$pending=v;f.$name=e(b.name||b.ngForm||"")(d);f.$dirty=!1;f.$pristine=!0;f.$valid=!0;f.$invalid=!1;f.$submitted=!1;f.$$parentForm=Mb;f.$rollbackViewValue=function(){n(g,
+function(a){a.$rollbackViewValue()})};f.$commitViewValue=function(){n(g,function(a){a.$commitViewValue()})};f.$addControl=function(a){Ta(a.$name,"input");g.push(a);a.$name&&(f[a.$name]=a);a.$$parentForm=f};f.$$renameControl=function(a,b){var c=a.$name;f[c]===a&&delete f[c];f[b]=a;a.$name=b};f.$removeControl=function(a){a.$name&&f[a.$name]===a&&delete f[a.$name];n(f.$pending,function(b,c){f.$setValidity(c,null,a)});n(f.$error,function(b,c){f.$setValidity(c,null,a)});n(f.$$success,function(b,c){f.$setValidity(c,
+null,a)});cb(g,a);a.$$parentForm=Mb};Ld({ctrl:this,$element:a,set:function(a,b,c){var d=a[b];d?-1===d.indexOf(c)&&d.push(c):a[b]=[c]},unset:function(a,b,c){var d=a[b];d&&(cb(d,c),0===d.length&&delete a[b])},$animate:c});f.$setDirty=function(){c.removeClass(a,Ya);c.addClass(a,Nb);f.$dirty=!0;f.$pristine=!1;f.$$parentForm.$setDirty()};f.$setPristine=function(){c.setClass(a,Ya,Nb+" ng-submitted");f.$dirty=!1;f.$pristine=!0;f.$submitted=!1;n(g,function(a){a.$setPristine()})};f.$setUntouched=function(){n(g,
+function(a){a.$setUntouched()})};f.$setSubmitted=function(){c.addClass(a,"ng-submitted");f.$submitted=!0;f.$$parentForm.$setSubmitted()}}function nc(a){a.$formatters.push(function(b){return a.$isEmpty(b)?b:b.toString()})}function lb(a,b,d,c,e,f){var g=G(b[0].type);if(!e.android){var h=!1;b.on("compositionstart",function(a){h=!0});b.on("compositionend",function(){h=!1;k()})}var k=function(a){l&&(f.defer.cancel(l),l=null);if(!h){var e=b.val();a=a&&a.type;"password"===g||d.ngTrim&&"false"===d.ngTrim||
+(e=X(e));(c.$viewValue!==e||""===e&&c.$$hasNativeValidators)&&c.$setViewValue(e,a)}};if(e.hasEvent("input"))b.on("input",k);else{var l,m=function(a,b,c){l||(l=f.defer(function(){l=null;b&&b.value===c||k(a)}))};b.on("keydown",function(a){var b=a.keyCode;91===b||15<b&&19>b||37<=b&&40>=b||m(a,this,this.value)});if(e.hasEvent("paste"))b.on("paste cut",m)}b.on("change",k);c.$render=function(){var a=c.$isEmpty(c.$viewValue)?"":c.$viewValue;b.val()!==a&&b.val(a)}}function Ob(a,b){return function(d,c){var e,
+f;if(V(d))return d;if(F(d)){'"'==d.charAt(0)&&'"'==d.charAt(d.length-1)&&(d=d.substring(1,d.length-1));if(zg.test(d))return new Date(d);a.lastIndex=0;if(e=a.exec(d))return e.shift(),f=c?{yyyy:c.getFullYear(),MM:c.getMonth()+1,dd:c.getDate(),HH:c.getHours(),mm:c.getMinutes(),ss:c.getSeconds(),sss:c.getMilliseconds()/1E3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},n(e,function(a,c){c<b.length&&(f[b[c]]=+a)}),new Date(f.yyyy,f.MM-1,f.dd,f.HH,f.mm,f.ss||0,1E3*f.sss||0)}return NaN}}function mb(a,b,d,c){return function(e,
+f,g,h,k,l,m){function r(a){return a&&!(a.getTime&&a.getTime()!==a.getTime())}function s(a){return y(a)&&!V(a)?d(a)||v:a}Md(e,f,g,h);lb(e,f,g,h,k,l);var n=h&&h.$options&&h.$options.timezone,q;h.$$parserName=a;h.$parsers.push(function(a){return h.$isEmpty(a)?null:b.test(a)?(a=d(a,q),n&&(a=Tb(a,n)),a):v});h.$formatters.push(function(a){if(a&&!V(a))throw nb("datefmt",a);if(r(a))return(q=a)&&n&&(q=Tb(q,n,!0)),m("date")(a,c,n);q=null;return""});if(y(g.min)||g.ngMin){var t;h.$validators.min=function(a){return!r(a)||
+x(t)||d(a)>=t};g.$observe("min",function(a){t=s(a);h.$validate()})}if(y(g.max)||g.ngMax){var p;h.$validators.max=function(a){return!r(a)||x(p)||d(a)<=p};g.$observe("max",function(a){p=s(a);h.$validate()})}}}function Md(a,b,d,c){(c.$$hasNativeValidators=E(b[0].validity))&&c.$parsers.push(function(a){var c=b.prop("validity")||{};return c.badInput||c.typeMismatch?v:a})}function Nd(a,b,d,c,e){if(y(c)){a=a(c);if(!a.constant)throw nb("constexpr",d,c);return a(b)}return e}function oc(a,b){a="ngClass"+a;
+return["$animate",function(d){function c(a,b){var c=[],d=0;a:for(;d<a.length;d++){for(var e=a[d],m=0;m<b.length;m++)if(e==b[m])continue a;c.push(e)}return c}function e(a){var b=[];return L(a)?(n(a,function(a){b=b.concat(e(a))}),b):F(a)?a.split(" "):E(a)?(n(a,function(a,c){a&&(b=b.concat(c.split(" ")))}),b):a}return{restrict:"AC",link:function(f,g,h){function k(a,b){var c=g.data("$classCounts")||Z(),d=[];n(a,function(a){if(0<b||c[a])c[a]=(c[a]||0)+b,c[a]===+(0<b)&&d.push(a)});g.data("$classCounts",
+c);return d.join(" ")}function l(a){if(!0===b||f.$index%2===b){var l=e(a||[]);if(!m){var n=k(l,1);h.$addClass(n)}else if(!oa(a,m)){var q=e(m),n=c(l,q),l=c(q,l),n=k(n,1),l=k(l,-1);n&&n.length&&d.addClass(g,n);l&&l.length&&d.removeClass(g,l)}}m=na(a)}var m;f.$watch(h[a],l,!0);h.$observe("class",function(b){l(f.$eval(h[a]))});"ngClass"!==a&&f.$watch("$index",function(c,d){var g=c&1;if(g!==(d&1)){var l=e(f.$eval(h[a]));g===b?(g=k(l,1),h.$addClass(g)):(g=k(l,-1),h.$removeClass(g))}})}}}]}function Ld(a){function b(a,
+b){b&&!f[a]?(k.addClass(e,a),f[a]=!0):!b&&f[a]&&(k.removeClass(e,a),f[a]=!1)}function d(a,c){a=a?"-"+Bc(a,"-"):"";b(ob+a,!0===c);b(Od+a,!1===c)}var c=a.ctrl,e=a.$element,f={},g=a.set,h=a.unset,k=a.$animate;f[Od]=!(f[ob]=e.hasClass(ob));c.$setValidity=function(a,e,f){x(e)?(c.$pending||(c.$pending={}),g(c.$pending,a,f)):(c.$pending&&h(c.$pending,a,f),Pd(c.$pending)&&(c.$pending=v));Na(e)?e?(h(c.$error,a,f),g(c.$$success,a,f)):(g(c.$error,a,f),h(c.$$success,a,f)):(h(c.$error,a,f),h(c.$$success,a,f));
+c.$pending?(b(Qd,!0),c.$valid=c.$invalid=v,d("",null)):(b(Qd,!1),c.$valid=Pd(c.$error),c.$invalid=!c.$valid,d("",c.$valid));e=c.$pending&&c.$pending[a]?v:c.$error[a]?!1:c.$$success[a]?!0:null;d(a,e);c.$$parentForm.$setValidity(a,e,c)}}function Pd(a){if(a)for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}var Ag=/^\/(.+)\/([a-z]*)$/,sa=Object.prototype.hasOwnProperty,G=function(a){return F(a)?a.toLowerCase():a},ub=function(a){return F(a)?a.toUpperCase():a},xa,C,ua,wa=[].slice,ag=[].splice,Bg=
+[].push,ga=Object.prototype.toString,uc=Object.getPrototypeOf,Da=H("ng"),ia=O.angular||(O.angular={}),Vb,pb=0;xa=W.documentMode;B.$inject=[];ab.$inject=[];var L=Array.isArray,ae=/^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/,X=function(a){return F(a)?a.trim():a},xd=function(a){return a.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")},Ea=function(){if(!y(Ea.rules)){var a=W.querySelector("[ng-csp]")||W.querySelector("[data-ng-csp]");
+if(a){var b=a.getAttribute("ng-csp")||a.getAttribute("data-ng-csp");Ea.rules={noUnsafeEval:!b||-1!==b.indexOf("no-unsafe-eval"),noInlineStyle:!b||-1!==b.indexOf("no-inline-style")}}else{a=Ea;try{new Function(""),b=!1}catch(d){b=!0}a.rules={noUnsafeEval:b,noInlineStyle:!1}}}return Ea.rules},rb=function(){if(y(rb.name_))return rb.name_;var a,b,d=Qa.length,c,e;for(b=0;b<d;++b)if(c=Qa[b],a=W.querySelector("["+c.replace(":","\\:")+"jq]")){e=a.getAttribute(c+"jq");break}return rb.name_=e},de=/:/g,Qa=["ng-",
+"data-ng-","ng:","x-ng-"],ie=/[A-Z]/g,Cc=!1,Pa=3,me={full:"1.5.0",major:1,minor:5,dot:0,codeName:"ennoblement-facilitation"};U.expando="ng339";var ib=U.cache={},Of=1;U._data=function(a){return this.cache[a[this.expando]]||{}};var Jf=/([\:\-\_]+(.))/g,Kf=/^moz([A-Z])/,yb={mouseleave:"mouseout",mouseenter:"mouseover"},Xb=H("jqLite"),Nf=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,Wb=/<|&#?\w+;/,Lf=/<([\w:-]+)/,Mf=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,da={option:[1,'<select multiple="multiple">',
+"</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};da.optgroup=da.option;da.tbody=da.tfoot=da.colgroup=da.caption=da.thead;da.th=da.td;var Tf=Node.prototype.contains||function(a){return!!(this.compareDocumentPosition(a)&16)},Ra=U.prototype={ready:function(a){function b(){d||(d=!0,a())}var d=!1;"complete"===W.readyState?setTimeout(b):(this.on("DOMContentLoaded",
+b),U(O).on("load",b))},toString:function(){var a=[];n(this,function(b){a.push(""+b)});return"["+a.join(", ")+"]"},eq:function(a){return 0<=a?C(this[a]):C(this[this.length+a])},length:0,push:Bg,sort:[].sort,splice:[].splice},Db={};n("multiple selected checked disabled readOnly required open".split(" "),function(a){Db[G(a)]=a});var Uc={};n("input select option textarea button form details".split(" "),function(a){Uc[a]=!0});var cd={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",
+ngPattern:"pattern"};n({data:Zb,removeData:hb,hasData:function(a){for(var b in ib[a.ng339])return!0;return!1},cleanData:function(a){for(var b=0,d=a.length;b<d;b++)hb(a[b])}},function(a,b){U[b]=a});n({data:Zb,inheritedData:Cb,scope:function(a){return C.data(a,"$scope")||Cb(a.parentNode||a,["$isolateScope","$scope"])},isolateScope:function(a){return C.data(a,"$isolateScope")||C.data(a,"$isolateScopeNoTemplate")},controller:Rc,injector:function(a){return Cb(a,"$injector")},removeAttr:function(a,b){a.removeAttribute(b)},
+hasClass:zb,css:function(a,b,d){b=gb(b);if(y(d))a.style[b]=d;else return a.style[b]},attr:function(a,b,d){var c=a.nodeType;if(c!==Pa&&2!==c&&8!==c)if(c=G(b),Db[c])if(y(d))d?(a[b]=!0,a.setAttribute(b,c)):(a[b]=!1,a.removeAttribute(c));else return a[b]||(a.attributes.getNamedItem(b)||B).specified?c:v;else if(y(d))a.setAttribute(b,d);else if(a.getAttribute)return a=a.getAttribute(b,2),null===a?v:a},prop:function(a,b,d){if(y(d))a[b]=d;else return a[b]},text:function(){function a(a,d){if(x(d)){var c=a.nodeType;
+return 1===c||c===Pa?a.textContent:""}a.textContent=d}a.$dv="";return a}(),val:function(a,b){if(x(b)){if(a.multiple&&"select"===ra(a)){var d=[];n(a.options,function(a){a.selected&&d.push(a.value||a.text)});return 0===d.length?null:d}return a.value}a.value=b},html:function(a,b){if(x(b))return a.innerHTML;wb(a,!0);a.innerHTML=b},empty:Sc},function(a,b){U.prototype[b]=function(b,c){var e,f,g=this.length;if(a!==Sc&&x(2==a.length&&a!==zb&&a!==Rc?b:c)){if(E(b)){for(e=0;e<g;e++)if(a===Zb)a(this[e],b);else for(f in b)a(this[e],
+f,b[f]);return this}e=a.$dv;g=x(e)?Math.min(g,1):g;for(f=0;f<g;f++){var h=a(this[f],b,c);e=e?e+h:h}return e}for(e=0;e<g;e++)a(this[e],b,c);return this}});n({removeData:hb,on:function(a,b,d,c){if(y(c))throw Xb("onargs");if(Mc(a)){c=xb(a,!0);var e=c.events,f=c.handle;f||(f=c.handle=Qf(a,e));c=0<=b.indexOf(" ")?b.split(" "):[b];for(var g=c.length,h=function(b,c,g){var h=e[b];h||(h=e[b]=[],h.specialHandlerWrapper=c,"$destroy"===b||g||a.addEventListener(b,f,!1));h.push(d)};g--;)b=c[g],yb[b]?(h(yb[b],Sf),
+h(b,v,!0)):h(b)}},off:Qc,one:function(a,b,d){a=C(a);a.on(b,function e(){a.off(b,d);a.off(b,e)});a.on(b,d)},replaceWith:function(a,b){var d,c=a.parentNode;wb(a);n(new U(b),function(b){d?c.insertBefore(b,d.nextSibling):c.replaceChild(b,a);d=b})},children:function(a){var b=[];n(a.childNodes,function(a){1===a.nodeType&&b.push(a)});return b},contents:function(a){return a.contentDocument||a.childNodes||[]},append:function(a,b){var d=a.nodeType;if(1===d||11===d){b=new U(b);for(var d=0,c=b.length;d<c;d++)a.appendChild(b[d])}},
+prepend:function(a,b){if(1===a.nodeType){var d=a.firstChild;n(new U(b),function(b){a.insertBefore(b,d)})}},wrap:function(a,b){Oc(a,C(b).eq(0).clone()[0])},remove:$b,detach:function(a){$b(a,!0)},after:function(a,b){var d=a,c=a.parentNode;b=new U(b);for(var e=0,f=b.length;e<f;e++){var g=b[e];c.insertBefore(g,d.nextSibling);d=g}},addClass:Bb,removeClass:Ab,toggleClass:function(a,b,d){b&&n(b.split(" "),function(b){var e=d;x(e)&&(e=!zb(a,b));(e?Bb:Ab)(a,b)})},parent:function(a){return(a=a.parentNode)&&
+11!==a.nodeType?a:null},next:function(a){return a.nextElementSibling},find:function(a,b){return a.getElementsByTagName?a.getElementsByTagName(b):[]},clone:Yb,triggerHandler:function(a,b,d){var c,e,f=b.type||b,g=xb(a);if(g=(g=g&&g.events)&&g[f])c={preventDefault:function(){this.defaultPrevented=!0},isDefaultPrevented:function(){return!0===this.defaultPrevented},stopImmediatePropagation:function(){this.immediatePropagationStopped=!0},isImmediatePropagationStopped:function(){return!0===this.immediatePropagationStopped},
+stopPropagation:B,type:f,target:a},b.type&&(c=T(c,b)),b=na(g),e=d?[c].concat(d):[c],n(b,function(b){c.isImmediatePropagationStopped()||b.apply(a,e)})}},function(a,b){U.prototype[b]=function(b,c,e){for(var f,g=0,h=this.length;g<h;g++)x(f)?(f=a(this[g],b,c,e),y(f)&&(f=C(f))):Pc(f,a(this[g],b,c,e));return y(f)?f:this};U.prototype.bind=U.prototype.on;U.prototype.unbind=U.prototype.off});Ua.prototype={put:function(a,b){this[Fa(a,this.nextUid)]=b},get:function(a){return this[Fa(a,this.nextUid)]},remove:function(a){var b=
+this[a=Fa(a,this.nextUid)];delete this[a];return b}};var Hf=[function(){this.$get=[function(){return Ua}]}],Vf=/^([^\(]+?)=>/,Wf=/^[^\(]*\(\s*([^\)]*)\)/m,Cg=/,/,Dg=/^\s*(_?)(\S+?)\1\s*$/,Uf=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Ga=H("$injector");fb.$$annotate=function(a,b,d){var c;if("function"===typeof a){if(!(c=a.$inject)){c=[];if(a.length){if(b)throw F(d)&&d||(d=a.name||Xf(a)),Ga("strictdi",d);b=Vc(a);n(b[1].split(Cg),function(a){a.replace(Dg,function(a,b,d){c.push(d)})})}a.$inject=c}}else L(a)?
+(b=a.length-1,Sa(a[b],"fn"),c=a.slice(0,b)):Sa(a,"fn",!0);return c};var Rd=H("$animate"),$e=function(){this.$get=function(){}},af=function(){var a=new Ua,b=[];this.$get=["$$AnimateRunner","$rootScope",function(d,c){function e(a,b,c){var d=!1;b&&(b=F(b)?b.split(" "):L(b)?b:[],n(b,function(b){b&&(d=!0,a[b]=c)}));return d}function f(){n(b,function(b){var c=a.get(b);if(c){var d=Yf(b.attr("class")),e="",f="";n(c,function(a,b){a!==!!d[b]&&(a?e+=(e.length?" ":"")+b:f+=(f.length?" ":"")+b)});n(b,function(a){e&&
+Bb(a,e);f&&Ab(a,f)});a.remove(b)}});b.length=0}return{enabled:B,on:B,off:B,pin:B,push:function(g,h,k,l){l&&l();k=k||{};k.from&&g.css(k.from);k.to&&g.css(k.to);if(k.addClass||k.removeClass)if(h=k.addClass,l=k.removeClass,k=a.get(g)||{},h=e(k,h,!0),l=e(k,l,!1),h||l)a.put(g,k),b.push(g),1===b.length&&c.$$postDigest(f);g=new d;g.complete();return g}}}]},Ye=["$provide",function(a){var b=this;this.$$registeredAnimations=Object.create(null);this.register=function(d,c){if(d&&"."!==d.charAt(0))throw Rd("notcsel",
+d);var e=d+"-animation";b.$$registeredAnimations[d.substr(1)]=e;a.factory(e,c)};this.classNameFilter=function(a){if(1===arguments.length&&(this.$$classNameFilter=a instanceof RegExp?a:null)&&/(\s+|\/)ng-animate(\s+|\/)/.test(this.$$classNameFilter.toString()))throw Rd("nongcls","ng-animate");return this.$$classNameFilter};this.$get=["$$animateQueue",function(a){function b(a,c,d){if(d){var h;a:{for(h=0;h<d.length;h++){var k=d[h];if(1===k.nodeType){h=k;break a}}h=void 0}!h||h.parentNode||h.previousElementSibling||
+(d=null)}d?d.after(a):c.prepend(a)}return{on:a.on,off:a.off,pin:a.pin,enabled:a.enabled,cancel:function(a){a.end&&a.end()},enter:function(e,f,g,h){f=f&&C(f);g=g&&C(g);f=f||g.parent();b(e,f,g);return a.push(e,"enter",Ha(h))},move:function(e,f,g,h){f=f&&C(f);g=g&&C(g);f=f||g.parent();b(e,f,g);return a.push(e,"move",Ha(h))},leave:function(b,c){return a.push(b,"leave",Ha(c),function(){b.remove()})},addClass:function(b,c,g){g=Ha(g);g.addClass=jb(g.addclass,c);return a.push(b,"addClass",g)},removeClass:function(b,
+c,g){g=Ha(g);g.removeClass=jb(g.removeClass,c);return a.push(b,"removeClass",g)},setClass:function(b,c,g,h){h=Ha(h);h.addClass=jb(h.addClass,c);h.removeClass=jb(h.removeClass,g);return a.push(b,"setClass",h)},animate:function(b,c,g,h,k){k=Ha(k);k.from=k.from?T(k.from,c):c;k.to=k.to?T(k.to,g):g;k.tempClasses=jb(k.tempClasses,h||"ng-inline-animate");return a.push(b,"animate",k)}}}]}],cf=function(){this.$get=["$$rAF",function(a){function b(b){d.push(b);1<d.length||a(function(){for(var a=0;a<d.length;a++)d[a]();
+d=[]})}var d=[];return function(){var a=!1;b(function(){a=!0});return function(d){a?d():b(d)}}}]},bf=function(){this.$get=["$q","$sniffer","$$animateAsyncRun","$document","$timeout",function(a,b,d,c,e){function f(a){this.setHost(a);var b=d();this._doneCallbacks=[];this._tick=function(a){var d=c[0];d&&d.hidden?e(a,0,!1):b(a)};this._state=0}f.chain=function(a,b){function c(){if(d===a.length)b(!0);else a[d](function(a){!1===a?b(!1):(d++,c())})}var d=0;c()};f.all=function(a,b){function c(f){e=e&&f;++d===
+a.length&&b(e)}var d=0,e=!0;n(a,function(a){a.done(c)})};f.prototype={setHost:function(a){this.host=a||{}},done:function(a){2===this._state?a():this._doneCallbacks.push(a)},progress:B,getPromise:function(){if(!this.promise){var b=this;this.promise=a(function(a,c){b.done(function(b){!1===b?c():a()})})}return this.promise},then:function(a,b){return this.getPromise().then(a,b)},"catch":function(a){return this.getPromise()["catch"](a)},"finally":function(a){return this.getPromise()["finally"](a)},pause:function(){this.host.pause&&
+this.host.pause()},resume:function(){this.host.resume&&this.host.resume()},end:function(){this.host.end&&this.host.end();this._resolve(!0)},cancel:function(){this.host.cancel&&this.host.cancel();this._resolve(!1)},complete:function(a){var b=this;0===b._state&&(b._state=1,b._tick(function(){b._resolve(a)}))},_resolve:function(a){2!==this._state&&(n(this._doneCallbacks,function(b){b(a)}),this._doneCallbacks.length=0,this._state=2)}};return f}]},Ze=function(){this.$get=["$$rAF","$q","$$AnimateRunner",
+function(a,b,d){return function(b,e){function f(){a(function(){g.addClass&&(b.addClass(g.addClass),g.addClass=null);g.removeClass&&(b.removeClass(g.removeClass),g.removeClass=null);g.to&&(b.css(g.to),g.to=null);h||k.complete();h=!0});return k}var g=e||{};g.$$prepared||(g=Oa(g));g.cleanupStyles&&(g.from=g.to=null);g.from&&(b.css(g.from),g.from=null);var h,k=new d;return{start:f,end:f}}}]},ja=H("$compile");Ec.$inject=["$provide","$$sanitizeUriProvider"];var Xc=/^((?:x|data)[\:\-_])/i,bg=H("$controller"),
+dd=/^(\S+)(\s+as\s+([\w$]+))?$/,jf=function(){this.$get=["$document",function(a){return function(b){b?!b.nodeType&&b instanceof C&&(b=b[0]):b=a[0].body;return b.offsetWidth+1}}]},ed="application/json",dc={"Content-Type":ed+";charset=utf-8"},dg=/^\[|^\{(?!\{)/,eg={"[":/]$/,"{":/}$/},cg=/^\)\]\}',?\n/,Eg=H("$http"),id=function(a){return function(){throw Eg("legacy",a);}},Ka=ia.$interpolateMinErr=H("$interpolate");Ka.throwNoconcat=function(a){throw Ka("noconcat",a);};Ka.interr=function(a,b){return Ka("interr",
+a,b.toString())};var Fg=/^([^\?#]*)(\?([^#]*))?(#(.*))?$/,gg={http:80,https:443,ftp:21},Gb=H("$location"),Gg={$$html5:!1,$$replace:!1,absUrl:Hb("$$absUrl"),url:function(a){if(x(a))return this.$$url;var b=Fg.exec(a);(b[1]||""===a)&&this.path(decodeURIComponent(b[1]));(b[2]||b[1]||""===a)&&this.search(b[3]||"");this.hash(b[5]||"");return this},protocol:Hb("$$protocol"),host:Hb("$$host"),port:Hb("$$port"),path:nd("$$path",function(a){a=null!==a?a.toString():"";return"/"==a.charAt(0)?a:"/"+a}),search:function(a,
+b){switch(arguments.length){case 0:return this.$$search;case 1:if(F(a)||N(a))a=a.toString(),this.$$search=zc(a);else if(E(a))a=Oa(a,{}),n(a,function(b,c){null==b&&delete a[c]}),this.$$search=a;else throw Gb("isrcharg");break;default:x(b)||null===b?delete this.$$search[a]:this.$$search[a]=b}this.$$compose();return this},hash:nd("$$hash",function(a){return null!==a?a.toString():""}),replace:function(){this.$$replace=!0;return this}};n([md,gc,fc],function(a){a.prototype=Object.create(Gg);a.prototype.state=
+function(b){if(!arguments.length)return this.$$state;if(a!==fc||!this.$$html5)throw Gb("nostate");this.$$state=x(b)?null:b;return this}});var ka=H("$parse"),ig=Function.prototype.call,jg=Function.prototype.apply,kg=Function.prototype.bind,Pb=Z();n("+ - * / % === !== == != < > <= >= && || ! = |".split(" "),function(a){Pb[a]=!0});var Hg={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},ic=function(a){this.options=a};ic.prototype={constructor:ic,lex:function(a){this.text=a;this.index=0;for(this.tokens=
+[];this.index<this.text.length;)if(a=this.text.charAt(this.index),'"'===a||"'"===a)this.readString(a);else if(this.isNumber(a)||"."===a&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdent(a))this.readIdent();else if(this.is(a,"(){}[].,;:?"))this.tokens.push({index:this.index,text:a}),this.index++;else if(this.isWhitespace(a))this.index++;else{var b=a+this.peek(),d=b+this.peek(2),c=Pb[b],e=Pb[d];Pb[a]||c||e?(a=e?d:c?b:a,this.tokens.push({index:this.index,text:a,operator:!0}),this.index+=
+a.length):this.throwError("Unexpected next character ",this.index,this.index+1)}return this.tokens},is:function(a,b){return-1!==b.indexOf(a)},peek:function(a){a=a||1;return this.index+a<this.text.length?this.text.charAt(this.index+a):!1},isNumber:function(a){return"0"<=a&&"9">=a&&"string"===typeof a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdent:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isExpOperator:function(a){return"-"===
+a||"+"===a||this.isNumber(a)},throwError:function(a,b,d){d=d||this.index;b=y(b)?"s "+b+"-"+this.index+" ["+this.text.substring(b,d)+"]":" "+d;throw ka("lexerr",a,b,this.text);},readNumber:function(){for(var a="",b=this.index;this.index<this.text.length;){var d=G(this.text.charAt(this.index));if("."==d||this.isNumber(d))a+=d;else{var c=this.peek();if("e"==d&&this.isExpOperator(c))a+=d;else if(this.isExpOperator(d)&&c&&this.isNumber(c)&&"e"==a.charAt(a.length-1))a+=d;else if(!this.isExpOperator(d)||
+c&&this.isNumber(c)||"e"!=a.charAt(a.length-1))break;else this.throwError("Invalid exponent")}this.index++}this.tokens.push({index:b,text:a,constant:!0,value:Number(a)})},readIdent:function(){for(var a=this.index;this.index<this.text.length;){var b=this.text.charAt(this.index);if(!this.isIdent(b)&&!this.isNumber(b))break;this.index++}this.tokens.push({index:a,text:this.text.slice(a,this.index),identifier:!0})},readString:function(a){var b=this.index;this.index++;for(var d="",c=a,e=!1;this.index<this.text.length;){var f=
+this.text.charAt(this.index),c=c+f;if(e)"u"===f?(e=this.text.substring(this.index+1,this.index+5),e.match(/[\da-f]{4}/i)||this.throwError("Invalid unicode escape [\\u"+e+"]"),this.index+=4,d+=String.fromCharCode(parseInt(e,16))):d+=Hg[f]||f,e=!1;else if("\\"===f)e=!0;else{if(f===a){this.index++;this.tokens.push({index:b,text:c,constant:!0,value:d});return}d+=f}this.index++}this.throwError("Unterminated quote",b)}};var q=function(a,b){this.lexer=a;this.options=b};q.Program="Program";q.ExpressionStatement=
+"ExpressionStatement";q.AssignmentExpression="AssignmentExpression";q.ConditionalExpression="ConditionalExpression";q.LogicalExpression="LogicalExpression";q.BinaryExpression="BinaryExpression";q.UnaryExpression="UnaryExpression";q.CallExpression="CallExpression";q.MemberExpression="MemberExpression";q.Identifier="Identifier";q.Literal="Literal";q.ArrayExpression="ArrayExpression";q.Property="Property";q.ObjectExpression="ObjectExpression";q.ThisExpression="ThisExpression";q.LocalsExpression="LocalsExpression";
+q.NGValueParameter="NGValueParameter";q.prototype={ast:function(a){this.text=a;this.tokens=this.lexer.lex(a);a=this.program();0!==this.tokens.length&&this.throwError("is an unexpected token",this.tokens[0]);return a},program:function(){for(var a=[];;)if(0<this.tokens.length&&!this.peek("}",")",";","]")&&a.push(this.expressionStatement()),!this.expect(";"))return{type:q.Program,body:a}},expressionStatement:function(){return{type:q.ExpressionStatement,expression:this.filterChain()}},filterChain:function(){for(var a=
+this.expression();this.expect("|");)a=this.filter(a);return a},expression:function(){return this.assignment()},assignment:function(){var a=this.ternary();this.expect("=")&&(a={type:q.AssignmentExpression,left:a,right:this.assignment(),operator:"="});return a},ternary:function(){var a=this.logicalOR(),b,d;return this.expect("?")&&(b=this.expression(),this.consume(":"))?(d=this.expression(),{type:q.ConditionalExpression,test:a,alternate:b,consequent:d}):a},logicalOR:function(){for(var a=this.logicalAND();this.expect("||");)a=
+{type:q.LogicalExpression,operator:"||",left:a,right:this.logicalAND()};return a},logicalAND:function(){for(var a=this.equality();this.expect("&&");)a={type:q.LogicalExpression,operator:"&&",left:a,right:this.equality()};return a},equality:function(){for(var a=this.relational(),b;b=this.expect("==","!=","===","!==");)a={type:q.BinaryExpression,operator:b.text,left:a,right:this.relational()};return a},relational:function(){for(var a=this.additive(),b;b=this.expect("<",">","<=",">=");)a={type:q.BinaryExpression,
+operator:b.text,left:a,right:this.additive()};return a},additive:function(){for(var a=this.multiplicative(),b;b=this.expect("+","-");)a={type:q.BinaryExpression,operator:b.text,left:a,right:this.multiplicative()};return a},multiplicative:function(){for(var a=this.unary(),b;b=this.expect("*","/","%");)a={type:q.BinaryExpression,operator:b.text,left:a,right:this.unary()};return a},unary:function(){var a;return(a=this.expect("+","-","!"))?{type:q.UnaryExpression,operator:a.text,prefix:!0,argument:this.unary()}:
+this.primary()},primary:function(){var a;this.expect("(")?(a=this.filterChain(),this.consume(")")):this.expect("[")?a=this.arrayDeclaration():this.expect("{")?a=this.object():this.constants.hasOwnProperty(this.peek().text)?a=Oa(this.constants[this.consume().text]):this.peek().identifier?a=this.identifier():this.peek().constant?a=this.constant():this.throwError("not a primary expression",this.peek());for(var b;b=this.expect("(","[",".");)"("===b.text?(a={type:q.CallExpression,callee:a,arguments:this.parseArguments()},
+this.consume(")")):"["===b.text?(a={type:q.MemberExpression,object:a,property:this.expression(),computed:!0},this.consume("]")):"."===b.text?a={type:q.MemberExpression,object:a,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return a},filter:function(a){a=[a];for(var b={type:q.CallExpression,callee:this.identifier(),arguments:a,filter:!0};this.expect(":");)a.push(this.expression());return b},parseArguments:function(){var a=[];if(")"!==this.peekToken().text){do a.push(this.expression());
+while(this.expect(","))}return a},identifier:function(){var a=this.consume();a.identifier||this.throwError("is not a valid identifier",a);return{type:q.Identifier,name:a.text}},constant:function(){return{type:q.Literal,value:this.consume().value}},arrayDeclaration:function(){var a=[];if("]"!==this.peekToken().text){do{if(this.peek("]"))break;a.push(this.expression())}while(this.expect(","))}this.consume("]");return{type:q.ArrayExpression,elements:a}},object:function(){var a=[],b;if("}"!==this.peekToken().text){do{if(this.peek("}"))break;
+b={type:q.Property,kind:"init"};this.peek().constant?b.key=this.constant():this.peek().identifier?b.key=this.identifier():this.throwError("invalid key",this.peek());this.consume(":");b.value=this.expression();a.push(b)}while(this.expect(","))}this.consume("}");return{type:q.ObjectExpression,properties:a}},throwError:function(a,b){throw ka("syntax",b.text,a,b.index+1,this.text,this.text.substring(b.index));},consume:function(a){if(0===this.tokens.length)throw ka("ueoe",this.text);var b=this.expect(a);
+b||this.throwError("is unexpected, expecting ["+a+"]",this.peek());return b},peekToken:function(){if(0===this.tokens.length)throw ka("ueoe",this.text);return this.tokens[0]},peek:function(a,b,d,c){return this.peekAhead(0,a,b,d,c)},peekAhead:function(a,b,d,c,e){if(this.tokens.length>a){a=this.tokens[a];var f=a.text;if(f===b||f===d||f===c||f===e||!(b||d||c||e))return a}return!1},expect:function(a,b,d,c){return(a=this.peek(a,b,d,c))?(this.tokens.shift(),a):!1},constants:{"true":{type:q.Literal,value:!0},
+"false":{type:q.Literal,value:!1},"null":{type:q.Literal,value:null},undefined:{type:q.Literal,value:v},"this":{type:q.ThisExpression},$locals:{type:q.LocalsExpression}}};ud.prototype={compile:function(a,b){var d=this,c=this.astBuilder.ast(a);this.state={nextId:0,filters:{},expensiveChecks:b,fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]};R(c,d.$filter);var e="",f;this.stage="assign";if(f=sd(c))this.state.computing="assign",e=this.nextId(),this.recurse(f,e),this.return_(e),
+e="fn.assign="+this.generateFunction("assign","s,v,l");f=qd(c.body);d.stage="inputs";n(f,function(a,b){var c="fn"+b;d.state[c]={vars:[],body:[],own:{}};d.state.computing=c;var e=d.nextId();d.recurse(a,e);d.return_(e);d.state.inputs.push(c);a.watchId=b});this.state.computing="fn";this.stage="main";this.recurse(c);e='"'+this.USE+" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+e+this.watchFns()+"return fn;";e=(new Function("$filter","ensureSafeMemberName","ensureSafeObject",
+"ensureSafeFunction","getStringValue","ensureSafeAssignContext","ifDefined","plus","text",e))(this.$filter,Xa,Aa,od,hg,Ib,lg,pd,a);this.state=this.stage=v;e.literal=td(c);e.constant=c.constant;return e},USE:"use",STRICT:"strict",watchFns:function(){var a=[],b=this.state.inputs,d=this;n(b,function(b){a.push("var "+b+"="+d.generateFunction(b,"s"))});b.length&&a.push("fn.inputs=["+b.join(",")+"];");return a.join("")},generateFunction:function(a,b){return"function("+b+"){"+this.varsPrefix(a)+this.body(a)+
+"};"},filterPrefix:function(){var a=[],b=this;n(this.state.filters,function(d,c){a.push(d+"=$filter("+b.escape(c)+")")});return a.length?"var "+a.join(",")+";":""},varsPrefix:function(a){return this.state[a].vars.length?"var "+this.state[a].vars.join(",")+";":""},body:function(a){return this.state[a].body.join("")},recurse:function(a,b,d,c,e,f){var g,h,k=this,l,m;c=c||B;if(!f&&y(a.watchId))b=b||this.nextId(),this.if_("i",this.lazyAssign(b,this.computedMember("i",a.watchId)),this.lazyRecurse(a,b,d,
+c,e,!0));else switch(a.type){case q.Program:n(a.body,function(b,c){k.recurse(b.expression,v,v,function(a){h=a});c!==a.body.length-1?k.current().body.push(h,";"):k.return_(h)});break;case q.Literal:m=this.escape(a.value);this.assign(b,m);c(m);break;case q.UnaryExpression:this.recurse(a.argument,v,v,function(a){h=a});m=a.operator+"("+this.ifDefined(h,0)+")";this.assign(b,m);c(m);break;case q.BinaryExpression:this.recurse(a.left,v,v,function(a){g=a});this.recurse(a.right,v,v,function(a){h=a});m="+"===
+a.operator?this.plus(g,h):"-"===a.operator?this.ifDefined(g,0)+a.operator+this.ifDefined(h,0):"("+g+")"+a.operator+"("+h+")";this.assign(b,m);c(m);break;case q.LogicalExpression:b=b||this.nextId();k.recurse(a.left,b);k.if_("&&"===a.operator?b:k.not(b),k.lazyRecurse(a.right,b));c(b);break;case q.ConditionalExpression:b=b||this.nextId();k.recurse(a.test,b);k.if_(b,k.lazyRecurse(a.alternate,b),k.lazyRecurse(a.consequent,b));c(b);break;case q.Identifier:b=b||this.nextId();d&&(d.context="inputs"===k.stage?
+"s":this.assign(this.nextId(),this.getHasOwnProperty("l",a.name)+"?l:s"),d.computed=!1,d.name=a.name);Xa(a.name);k.if_("inputs"===k.stage||k.not(k.getHasOwnProperty("l",a.name)),function(){k.if_("inputs"===k.stage||"s",function(){e&&1!==e&&k.if_(k.not(k.nonComputedMember("s",a.name)),k.lazyAssign(k.nonComputedMember("s",a.name),"{}"));k.assign(b,k.nonComputedMember("s",a.name))})},b&&k.lazyAssign(b,k.nonComputedMember("l",a.name)));(k.state.expensiveChecks||Jb(a.name))&&k.addEnsureSafeObject(b);c(b);
+break;case q.MemberExpression:g=d&&(d.context=this.nextId())||this.nextId();b=b||this.nextId();k.recurse(a.object,g,v,function(){k.if_(k.notNull(g),function(){e&&1!==e&&k.addEnsureSafeAssignContext(g);if(a.computed)h=k.nextId(),k.recurse(a.property,h),k.getStringValue(h),k.addEnsureSafeMemberName(h),e&&1!==e&&k.if_(k.not(k.computedMember(g,h)),k.lazyAssign(k.computedMember(g,h),"{}")),m=k.ensureSafeObject(k.computedMember(g,h)),k.assign(b,m),d&&(d.computed=!0,d.name=h);else{Xa(a.property.name);e&&
+1!==e&&k.if_(k.not(k.nonComputedMember(g,a.property.name)),k.lazyAssign(k.nonComputedMember(g,a.property.name),"{}"));m=k.nonComputedMember(g,a.property.name);if(k.state.expensiveChecks||Jb(a.property.name))m=k.ensureSafeObject(m);k.assign(b,m);d&&(d.computed=!1,d.name=a.property.name)}},function(){k.assign(b,"undefined")});c(b)},!!e);break;case q.CallExpression:b=b||this.nextId();a.filter?(h=k.filter(a.callee.name),l=[],n(a.arguments,function(a){var b=k.nextId();k.recurse(a,b);l.push(b)}),m=h+"("+
+l.join(",")+")",k.assign(b,m),c(b)):(h=k.nextId(),g={},l=[],k.recurse(a.callee,h,g,function(){k.if_(k.notNull(h),function(){k.addEnsureSafeFunction(h);n(a.arguments,function(a){k.recurse(a,k.nextId(),v,function(a){l.push(k.ensureSafeObject(a))})});g.name?(k.state.expensiveChecks||k.addEnsureSafeObject(g.context),m=k.member(g.context,g.name,g.computed)+"("+l.join(",")+")"):m=h+"("+l.join(",")+")";m=k.ensureSafeObject(m);k.assign(b,m)},function(){k.assign(b,"undefined")});c(b)}));break;case q.AssignmentExpression:h=
+this.nextId();g={};if(!rd(a.left))throw ka("lval");this.recurse(a.left,v,g,function(){k.if_(k.notNull(g.context),function(){k.recurse(a.right,h);k.addEnsureSafeObject(k.member(g.context,g.name,g.computed));k.addEnsureSafeAssignContext(g.context);m=k.member(g.context,g.name,g.computed)+a.operator+h;k.assign(b,m);c(b||m)})},1);break;case q.ArrayExpression:l=[];n(a.elements,function(a){k.recurse(a,k.nextId(),v,function(a){l.push(a)})});m="["+l.join(",")+"]";this.assign(b,m);c(m);break;case q.ObjectExpression:l=
+[];n(a.properties,function(a){k.recurse(a.value,k.nextId(),v,function(b){l.push(k.escape(a.key.type===q.Identifier?a.key.name:""+a.key.value)+":"+b)})});m="{"+l.join(",")+"}";this.assign(b,m);c(m);break;case q.ThisExpression:this.assign(b,"s");c("s");break;case q.LocalsExpression:this.assign(b,"l");c("l");break;case q.NGValueParameter:this.assign(b,"v"),c("v")}},getHasOwnProperty:function(a,b){var d=a+"."+b,c=this.current().own;c.hasOwnProperty(d)||(c[d]=this.nextId(!1,a+"&&("+this.escape(b)+" in "+
+a+")"));return c[d]},assign:function(a,b){if(a)return this.current().body.push(a,"=",b,";"),a},filter:function(a){this.state.filters.hasOwnProperty(a)||(this.state.filters[a]=this.nextId(!0));return this.state.filters[a]},ifDefined:function(a,b){return"ifDefined("+a+","+this.escape(b)+")"},plus:function(a,b){return"plus("+a+","+b+")"},return_:function(a){this.current().body.push("return ",a,";")},if_:function(a,b,d){if(!0===a)b();else{var c=this.current().body;c.push("if(",a,"){");b();c.push("}");
+d&&(c.push("else{"),d(),c.push("}"))}},not:function(a){return"!("+a+")"},notNull:function(a){return a+"!=null"},nonComputedMember:function(a,b){return a+"."+b},computedMember:function(a,b){return a+"["+b+"]"},member:function(a,b,d){return d?this.computedMember(a,b):this.nonComputedMember(a,b)},addEnsureSafeObject:function(a){this.current().body.push(this.ensureSafeObject(a),";")},addEnsureSafeMemberName:function(a){this.current().body.push(this.ensureSafeMemberName(a),";")},addEnsureSafeFunction:function(a){this.current().body.push(this.ensureSafeFunction(a),
+";")},addEnsureSafeAssignContext:function(a){this.current().body.push(this.ensureSafeAssignContext(a),";")},ensureSafeObject:function(a){return"ensureSafeObject("+a+",text)"},ensureSafeMemberName:function(a){return"ensureSafeMemberName("+a+",text)"},ensureSafeFunction:function(a){return"ensureSafeFunction("+a+",text)"},getStringValue:function(a){this.assign(a,"getStringValue("+a+")")},ensureSafeAssignContext:function(a){return"ensureSafeAssignContext("+a+",text)"},lazyRecurse:function(a,b,d,c,e,f){var g=
+this;return function(){g.recurse(a,b,d,c,e,f)}},lazyAssign:function(a,b){var d=this;return function(){d.assign(a,b)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)},escape:function(a){if(F(a))return"'"+a.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(N(a))return a.toString();if(!0===a)return"true";if(!1===a)return"false";if(null===a)return"null";if("undefined"===typeof a)return"undefined";throw ka("esc");},nextId:function(a,
+b){var d="v"+this.state.nextId++;a||this.current().vars.push(d+(b?"="+b:""));return d},current:function(){return this.state[this.state.computing]}};vd.prototype={compile:function(a,b){var d=this,c=this.astBuilder.ast(a);this.expression=a;this.expensiveChecks=b;R(c,d.$filter);var e,f;if(e=sd(c))f=this.recurse(e);e=qd(c.body);var g;e&&(g=[],n(e,function(a,b){var c=d.recurse(a);a.input=c;g.push(c);a.watchId=b}));var h=[];n(c.body,function(a){h.push(d.recurse(a.expression))});e=0===c.body.length?function(){}:
+1===c.body.length?h[0]:function(a,b){var c;n(h,function(d){c=d(a,b)});return c};f&&(e.assign=function(a,b,c){return f(a,c,b)});g&&(e.inputs=g);e.literal=td(c);e.constant=c.constant;return e},recurse:function(a,b,d){var c,e,f=this,g;if(a.input)return this.inputs(a.input,a.watchId);switch(a.type){case q.Literal:return this.value(a.value,b);case q.UnaryExpression:return e=this.recurse(a.argument),this["unary"+a.operator](e,b);case q.BinaryExpression:return c=this.recurse(a.left),e=this.recurse(a.right),
+this["binary"+a.operator](c,e,b);case q.LogicalExpression:return c=this.recurse(a.left),e=this.recurse(a.right),this["binary"+a.operator](c,e,b);case q.ConditionalExpression:return this["ternary?:"](this.recurse(a.test),this.recurse(a.alternate),this.recurse(a.consequent),b);case q.Identifier:return Xa(a.name,f.expression),f.identifier(a.name,f.expensiveChecks||Jb(a.name),b,d,f.expression);case q.MemberExpression:return c=this.recurse(a.object,!1,!!d),a.computed||(Xa(a.property.name,f.expression),
+e=a.property.name),a.computed&&(e=this.recurse(a.property)),a.computed?this.computedMember(c,e,b,d,f.expression):this.nonComputedMember(c,e,f.expensiveChecks,b,d,f.expression);case q.CallExpression:return g=[],n(a.arguments,function(a){g.push(f.recurse(a))}),a.filter&&(e=this.$filter(a.callee.name)),a.filter||(e=this.recurse(a.callee,!0)),a.filter?function(a,c,d,f){for(var r=[],n=0;n<g.length;++n)r.push(g[n](a,c,d,f));a=e.apply(v,r,f);return b?{context:v,name:v,value:a}:a}:function(a,c,d,m){var r=
+e(a,c,d,m),n;if(null!=r.value){Aa(r.context,f.expression);od(r.value,f.expression);n=[];for(var q=0;q<g.length;++q)n.push(Aa(g[q](a,c,d,m),f.expression));n=Aa(r.value.apply(r.context,n),f.expression)}return b?{value:n}:n};case q.AssignmentExpression:return c=this.recurse(a.left,!0,1),e=this.recurse(a.right),function(a,d,g,m){var r=c(a,d,g,m);a=e(a,d,g,m);Aa(r.value,f.expression);Ib(r.context);r.context[r.name]=a;return b?{value:a}:a};case q.ArrayExpression:return g=[],n(a.elements,function(a){g.push(f.recurse(a))}),
+function(a,c,d,e){for(var f=[],n=0;n<g.length;++n)f.push(g[n](a,c,d,e));return b?{value:f}:f};case q.ObjectExpression:return g=[],n(a.properties,function(a){g.push({key:a.key.type===q.Identifier?a.key.name:""+a.key.value,value:f.recurse(a.value)})}),function(a,c,d,e){for(var f={},n=0;n<g.length;++n)f[g[n].key]=g[n].value(a,c,d,e);return b?{value:f}:f};case q.ThisExpression:return function(a){return b?{value:a}:a};case q.LocalsExpression:return function(a,c){return b?{value:c}:c};case q.NGValueParameter:return function(a,
+c,d,e){return b?{value:d}:d}}},"unary+":function(a,b){return function(d,c,e,f){d=a(d,c,e,f);d=y(d)?+d:0;return b?{value:d}:d}},"unary-":function(a,b){return function(d,c,e,f){d=a(d,c,e,f);d=y(d)?-d:0;return b?{value:d}:d}},"unary!":function(a,b){return function(d,c,e,f){d=!a(d,c,e,f);return b?{value:d}:d}},"binary+":function(a,b,d){return function(c,e,f,g){var h=a(c,e,f,g);c=b(c,e,f,g);h=pd(h,c);return d?{value:h}:h}},"binary-":function(a,b,d){return function(c,e,f,g){var h=a(c,e,f,g);c=b(c,e,f,g);
+h=(y(h)?h:0)-(y(c)?c:0);return d?{value:h}:h}},"binary*":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)*b(c,e,f,g);return d?{value:c}:c}},"binary/":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)/b(c,e,f,g);return d?{value:c}:c}},"binary%":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)%b(c,e,f,g);return d?{value:c}:c}},"binary===":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)===b(c,e,f,g);return d?{value:c}:c}},"binary!==":function(a,b,d){return function(c,e,f,g){c=a(c,
+e,f,g)!==b(c,e,f,g);return d?{value:c}:c}},"binary==":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)==b(c,e,f,g);return d?{value:c}:c}},"binary!=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)!=b(c,e,f,g);return d?{value:c}:c}},"binary<":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)<b(c,e,f,g);return d?{value:c}:c}},"binary>":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>b(c,e,f,g);return d?{value:c}:c}},"binary<=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,
+g)<=b(c,e,f,g);return d?{value:c}:c}},"binary>=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>=b(c,e,f,g);return d?{value:c}:c}},"binary&&":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)&&b(c,e,f,g);return d?{value:c}:c}},"binary||":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)||b(c,e,f,g);return d?{value:c}:c}},"ternary?:":function(a,b,d,c){return function(e,f,g,h){e=a(e,f,g,h)?b(e,f,g,h):d(e,f,g,h);return c?{value:e}:e}},value:function(a,b){return function(){return b?{context:v,
+name:v,value:a}:a}},identifier:function(a,b,d,c,e){return function(f,g,h,k){f=g&&a in g?g:f;c&&1!==c&&f&&!f[a]&&(f[a]={});g=f?f[a]:v;b&&Aa(g,e);return d?{context:f,name:a,value:g}:g}},computedMember:function(a,b,d,c,e){return function(f,g,h,k){var l=a(f,g,h,k),m,n;null!=l&&(m=b(f,g,h,k),m+="",Xa(m,e),c&&1!==c&&(Ib(l),l&&!l[m]&&(l[m]={})),n=l[m],Aa(n,e));return d?{context:l,name:m,value:n}:n}},nonComputedMember:function(a,b,d,c,e,f){return function(g,h,k,l){g=a(g,h,k,l);e&&1!==e&&(Ib(g),g&&!g[b]&&
+(g[b]={}));h=null!=g?g[b]:v;(d||Jb(b))&&Aa(h,f);return c?{context:g,name:b,value:h}:h}},inputs:function(a,b){return function(d,c,e,f){return f?f[b]:a(d,c,e)}}};var jc=function(a,b,d){this.lexer=a;this.$filter=b;this.options=d;this.ast=new q(this.lexer);this.astCompiler=d.csp?new vd(this.ast,b):new ud(this.ast,b)};jc.prototype={constructor:jc,parse:function(a){return this.astCompiler.compile(a,this.options.expensiveChecks)}};var mg=Object.prototype.valueOf,Ba=H("$sce"),qa={HTML:"html",CSS:"css",URL:"url",
+RESOURCE_URL:"resourceUrl",JS:"js"},ja=H("$compile"),Y=W.createElement("a"),zd=za(O.location.href);Ad.$inject=["$document"];Lc.$inject=["$provide"];var Hd=22,Gd=".",lc="0";Bd.$inject=["$locale"];Dd.$inject=["$locale"];var yg={yyyy:aa("FullYear",4),yy:aa("FullYear",2,0,!0),y:aa("FullYear",1),MMMM:Lb("Month"),MMM:Lb("Month",!0),MM:aa("Month",2,1),M:aa("Month",1,1),dd:aa("Date",2),d:aa("Date",1),HH:aa("Hours",2),H:aa("Hours",1),hh:aa("Hours",2,-12),h:aa("Hours",1,-12),mm:aa("Minutes",2),m:aa("Minutes",
+1),ss:aa("Seconds",2),s:aa("Seconds",1),sss:aa("Milliseconds",3),EEEE:Lb("Day"),EEE:Lb("Day",!0),a:function(a,b){return 12>a.getHours()?b.AMPMS[0]:b.AMPMS[1]},Z:function(a,b,d){a=-1*d;return a=(0<=a?"+":"")+(Kb(Math[0<a?"floor":"ceil"](a/60),2)+Kb(Math.abs(a%60),2))},ww:Jd(2),w:Jd(1),G:mc,GG:mc,GGG:mc,GGGG:function(a,b){return 0>=a.getFullYear()?b.ERANAMES[0]:b.ERANAMES[1]}},xg=/((?:[^yMdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,wg=/^\-?\d+$/;Cd.$inject=["$locale"];
+var rg=ba(G),sg=ba(ub);Ed.$inject=["$parse"];var oe=ba({restrict:"E",compile:function(a,b){if(!b.href&&!b.xlinkHref)return function(a,b){if("a"===b[0].nodeName.toLowerCase()){var e="[object SVGAnimatedString]"===ga.call(b.prop("href"))?"xlink:href":"href";b.on("click",function(a){b.attr(e)||a.preventDefault()})}}}}),vb={};n(Db,function(a,b){function d(a,d,e){a.$watch(e[c],function(a){e.$set(b,!!a)})}if("multiple"!=a){var c=va("ng-"+b),e=d;"checked"===a&&(e=function(a,b,e){e.ngModel!==e[c]&&d(a,b,
+e)});vb[c]=function(){return{restrict:"A",priority:100,link:e}}}});n(cd,function(a,b){vb[b]=function(){return{priority:100,link:function(a,c,e){if("ngPattern"===b&&"/"==e.ngPattern.charAt(0)&&(c=e.ngPattern.match(Ag))){e.$set("ngPattern",new RegExp(c[1],c[2]));return}a.$watch(e[b],function(a){e.$set(b,a)})}}}});n(["src","srcset","href"],function(a){var b=va("ng-"+a);vb[b]=function(){return{priority:99,link:function(d,c,e){var f=a,g=a;"href"===a&&"[object SVGAnimatedString]"===ga.call(c.prop("href"))&&
+(g="xlinkHref",e.$attr[g]="xlink:href",f=null);e.$observe(b,function(b){b?(e.$set(g,b),xa&&f&&c.prop(f,e[g])):"href"===a&&e.$set(g,null)})}}}});var Mb={$addControl:B,$$renameControl:function(a,b){a.$name=b},$removeControl:B,$setValidity:B,$setDirty:B,$setPristine:B,$setSubmitted:B};Kd.$inject=["$element","$attrs","$scope","$animate","$interpolate"];var Sd=function(a){return["$timeout","$parse",function(b,d){function c(a){return""===a?d('this[""]').assign:d(a).assign||B}return{name:"form",restrict:a?
+"EAC":"E",require:["form","^^?form"],controller:Kd,compile:function(d,f){d.addClass(Ya).addClass(ob);var g=f.name?"name":a&&f.ngForm?"ngForm":!1;return{pre:function(a,d,e,f){var n=f[0];if(!("action"in e)){var s=function(b){a.$apply(function(){n.$commitViewValue();n.$setSubmitted()});b.preventDefault()};d[0].addEventListener("submit",s,!1);d.on("$destroy",function(){b(function(){d[0].removeEventListener("submit",s,!1)},0,!1)})}(f[1]||n.$$parentForm).$addControl(n);var q=g?c(n.$name):B;g&&(q(a,n),e.$observe(g,
+function(b){n.$name!==b&&(q(a,v),n.$$parentForm.$$renameControl(n,b),q=c(n.$name),q(a,n))}));d.on("$destroy",function(){n.$$parentForm.$removeControl(n);q(a,v);T(n,Mb)})}}}}}]},pe=Sd(),Ce=Sd(!0),zg=/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/,Ig=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+\])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,Jg=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,Kg=
+/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,Td=/^(\d{4})-(\d{2})-(\d{2})$/,Ud=/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,pc=/^(\d{4})-W(\d\d)$/,Vd=/^(\d{4})-(\d\d)$/,Wd=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Xd={text:function(a,b,d,c,e,f){lb(a,b,d,c,e,f);nc(c)},date:mb("date",Td,Ob(Td,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":mb("datetimelocal",Ud,Ob(Ud,"yyyy MM dd HH mm ss sss".split(" ")),"yyyy-MM-ddTHH:mm:ss.sss"),time:mb("time",Wd,Ob(Wd,["HH","mm","ss",
+"sss"]),"HH:mm:ss.sss"),week:mb("week",pc,function(a,b){if(V(a))return a;if(F(a)){pc.lastIndex=0;var d=pc.exec(a);if(d){var c=+d[1],e=+d[2],f=d=0,g=0,h=0,k=Id(c),e=7*(e-1);b&&(d=b.getHours(),f=b.getMinutes(),g=b.getSeconds(),h=b.getMilliseconds());return new Date(c,0,k.getDate()+e,d,f,g,h)}}return NaN},"yyyy-Www"),month:mb("month",Vd,Ob(Vd,["yyyy","MM"]),"yyyy-MM"),number:function(a,b,d,c,e,f){Md(a,b,d,c);lb(a,b,d,c,e,f);c.$$parserName="number";c.$parsers.push(function(a){return c.$isEmpty(a)?null:
+Kg.test(a)?parseFloat(a):v});c.$formatters.push(function(a){if(!c.$isEmpty(a)){if(!N(a))throw nb("numfmt",a);a=a.toString()}return a});if(y(d.min)||d.ngMin){var g;c.$validators.min=function(a){return c.$isEmpty(a)||x(g)||a>=g};d.$observe("min",function(a){y(a)&&!N(a)&&(a=parseFloat(a,10));g=N(a)&&!isNaN(a)?a:v;c.$validate()})}if(y(d.max)||d.ngMax){var h;c.$validators.max=function(a){return c.$isEmpty(a)||x(h)||a<=h};d.$observe("max",function(a){y(a)&&!N(a)&&(a=parseFloat(a,10));h=N(a)&&!isNaN(a)?
+a:v;c.$validate()})}},url:function(a,b,d,c,e,f){lb(a,b,d,c,e,f);nc(c);c.$$parserName="url";c.$validators.url=function(a,b){var d=a||b;return c.$isEmpty(d)||Ig.test(d)}},email:function(a,b,d,c,e,f){lb(a,b,d,c,e,f);nc(c);c.$$parserName="email";c.$validators.email=function(a,b){var d=a||b;return c.$isEmpty(d)||Jg.test(d)}},radio:function(a,b,d,c){x(d.name)&&b.attr("name",++pb);b.on("click",function(a){b[0].checked&&c.$setViewValue(d.value,a&&a.type)});c.$render=function(){b[0].checked=d.value==c.$viewValue};
+d.$observe("value",c.$render)},checkbox:function(a,b,d,c,e,f,g,h){var k=Nd(h,a,"ngTrueValue",d.ngTrueValue,!0),l=Nd(h,a,"ngFalseValue",d.ngFalseValue,!1);b.on("click",function(a){c.$setViewValue(b[0].checked,a&&a.type)});c.$render=function(){b[0].checked=c.$viewValue};c.$isEmpty=function(a){return!1===a};c.$formatters.push(function(a){return oa(a,k)});c.$parsers.push(function(a){return a?k:l})},hidden:B,button:B,submit:B,reset:B,file:B},Fc=["$browser","$sniffer","$filter","$parse",function(a,b,d,
+c){return{restrict:"E",require:["?ngModel"],link:{pre:function(e,f,g,h){h[0]&&(Xd[G(g.type)]||Xd.text)(e,f,g,h[0],b,a,d,c)}}}}],Lg=/^(true|false|\d+)$/,Ue=function(){return{restrict:"A",priority:100,compile:function(a,b){return Lg.test(b.ngValue)?function(a,b,e){e.$set("value",a.$eval(e.ngValue))}:function(a,b,e){a.$watch(e.ngValue,function(a){e.$set("value",a)})}}}},ue=["$compile",function(a){return{restrict:"AC",compile:function(b){a.$$addBindingClass(b);return function(b,c,e){a.$$addBindingInfo(c,
+e.ngBind);c=c[0];b.$watch(e.ngBind,function(a){c.textContent=x(a)?"":a})}}}}],we=["$interpolate","$compile",function(a,b){return{compile:function(d){b.$$addBindingClass(d);return function(c,d,f){c=a(d.attr(f.$attr.ngBindTemplate));b.$$addBindingInfo(d,c.expressions);d=d[0];f.$observe("ngBindTemplate",function(a){d.textContent=x(a)?"":a})}}}}],ve=["$sce","$parse","$compile",function(a,b,d){return{restrict:"A",compile:function(c,e){var f=b(e.ngBindHtml),g=b(e.ngBindHtml,function(a){return(a||"").toString()});
+d.$$addBindingClass(c);return function(b,c,e){d.$$addBindingInfo(c,e.ngBindHtml);b.$watch(g,function(){c.html(a.getTrustedHtml(f(b))||"")})}}}}],Te=ba({restrict:"A",require:"ngModel",link:function(a,b,d,c){c.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),xe=oc("",!0),ze=oc("Odd",0),ye=oc("Even",1),Ae=Ma({compile:function(a,b){b.$set("ngCloak",v);a.removeClass("ng-cloak")}}),Be=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],Kc={},Mg={blur:!0,focus:!0};n("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),
+function(a){var b=va("ng-"+a);Kc[b]=["$parse","$rootScope",function(d,c){return{restrict:"A",compile:function(e,f){var g=d(f[b],null,!0);return function(b,d){d.on(a,function(d){var e=function(){g(b,{$event:d})};Mg[a]&&c.$$phase?b.$evalAsync(e):b.$apply(e)})}}}}]});var Ee=["$animate",function(a){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(b,d,c,e,f){var g,h,k;b.$watch(c.ngIf,function(b){b?h||f(function(b,e){h=e;b[b.length++]=W.createComment(" end ngIf: "+
+c.ngIf+" ");g={clone:b};a.enter(b,d.parent(),d)}):(k&&(k.remove(),k=null),h&&(h.$destroy(),h=null),g&&(k=tb(g.clone),a.leave(k).then(function(){k=null}),g=null))})}}}],Fe=["$templateRequest","$anchorScroll","$animate",function(a,b,d){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:ia.noop,compile:function(c,e){var f=e.ngInclude||e.src,g=e.onload||"",h=e.autoscroll;return function(c,e,m,n,s){var q=0,v,t,p,w=function(){t&&(t.remove(),t=null);v&&(v.$destroy(),v=null);p&&
+(d.leave(p).then(function(){t=null}),t=p,p=null)};c.$watch(f,function(f){var m=function(){!y(h)||h&&!c.$eval(h)||b()},z=++q;f?(a(f,!0).then(function(a){if(!c.$$destroyed&&z===q){var b=c.$new();n.template=a;a=s(b,function(a){w();d.enter(a,null,e).then(m)});v=b;p=a;v.$emit("$includeContentLoaded",f);c.$eval(g)}},function(){c.$$destroyed||z!==q||(w(),c.$emit("$includeContentError",f))}),c.$emit("$includeContentRequested",f)):(w(),n.template=null)})}}}}],We=["$compile",function(a){return{restrict:"ECA",
+priority:-400,require:"ngInclude",link:function(b,d,c,e){ga.call(d[0]).match(/SVG/)?(d.empty(),a(Nc(e.template,W).childNodes)(b,function(a){d.append(a)},{futureParentElement:d})):(d.html(e.template),a(d.contents())(b))}}}],Ge=Ma({priority:450,compile:function(){return{pre:function(a,b,d){a.$eval(d.ngInit)}}}}),Se=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(a,b,d,c){var e=b.attr(d.$attr.ngList)||", ",f="false"!==d.ngTrim,g=f?X(e):e;c.$parsers.push(function(a){if(!x(a)){var b=
+[];a&&n(a.split(g),function(a){a&&b.push(f?X(a):a)});return b}});c.$formatters.push(function(a){return L(a)?a.join(e):v});c.$isEmpty=function(a){return!a||!a.length}}}},ob="ng-valid",Od="ng-invalid",Ya="ng-pristine",Nb="ng-dirty",Qd="ng-pending",nb=H("ngModel"),Ng=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate","$timeout","$rootScope","$q","$interpolate",function(a,b,d,c,e,f,g,h,k,l){this.$modelValue=this.$viewValue=Number.NaN;this.$$rawModelValue=v;this.$validators={};this.$asyncValidators=
+{};this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$untouched=!0;this.$touched=!1;this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$error={};this.$$success={};this.$pending=v;this.$name=l(d.name||"",!1)(a);this.$$parentForm=Mb;var m=e(d.ngModel),r=m.assign,q=m,I=r,K=null,t,p=this;this.$$setOptions=function(a){if((p.$options=a)&&a.getterSetter){var b=e(d.ngModel+"()"),f=e(d.ngModel+"($$$p)");q=function(a){var c=m(a);D(c)&&(c=b(a));return c};I=function(a,
+b){D(m(a))?f(a,{$$$p:p.$modelValue}):r(a,p.$modelValue)}}else if(!m.assign)throw nb("nonassign",d.ngModel,ta(c));};this.$render=B;this.$isEmpty=function(a){return x(a)||""===a||null===a||a!==a};this.$$updateEmptyClasses=function(a){p.$isEmpty(a)?(f.removeClass(c,"ng-not-empty"),f.addClass(c,"ng-empty")):(f.removeClass(c,"ng-empty"),f.addClass(c,"ng-not-empty"))};var w=0;Ld({ctrl:this,$element:c,set:function(a,b){a[b]=!0},unset:function(a,b){delete a[b]},$animate:f});this.$setPristine=function(){p.$dirty=
+!1;p.$pristine=!0;f.removeClass(c,Nb);f.addClass(c,Ya)};this.$setDirty=function(){p.$dirty=!0;p.$pristine=!1;f.removeClass(c,Ya);f.addClass(c,Nb);p.$$parentForm.$setDirty()};this.$setUntouched=function(){p.$touched=!1;p.$untouched=!0;f.setClass(c,"ng-untouched","ng-touched")};this.$setTouched=function(){p.$touched=!0;p.$untouched=!1;f.setClass(c,"ng-touched","ng-untouched")};this.$rollbackViewValue=function(){g.cancel(K);p.$viewValue=p.$$lastCommittedViewValue;p.$render()};this.$validate=function(){if(!N(p.$modelValue)||
+!isNaN(p.$modelValue)){var a=p.$$rawModelValue,b=p.$valid,c=p.$modelValue,d=p.$options&&p.$options.allowInvalid;p.$$runValidators(a,p.$$lastCommittedViewValue,function(e){d||b===e||(p.$modelValue=e?a:v,p.$modelValue!==c&&p.$$writeModelToScope())})}};this.$$runValidators=function(a,b,c){function d(){var c=!0;n(p.$validators,function(d,e){var g=d(a,b);c=c&&g;f(e,g)});return c?!0:(n(p.$asyncValidators,function(a,b){f(b,null)}),!1)}function e(){var c=[],d=!0;n(p.$asyncValidators,function(e,g){var h=e(a,
+b);if(!h||!D(h.then))throw nb("nopromise",h);f(g,v);c.push(h.then(function(){f(g,!0)},function(a){d=!1;f(g,!1)}))});c.length?k.all(c).then(function(){g(d)},B):g(!0)}function f(a,b){h===w&&p.$setValidity(a,b)}function g(a){h===w&&c(a)}w++;var h=w;(function(){var a=p.$$parserName||"parse";if(x(t))f(a,null);else return t||(n(p.$validators,function(a,b){f(b,null)}),n(p.$asyncValidators,function(a,b){f(b,null)})),f(a,t),t;return!0})()?d()?e():g(!1):g(!1)};this.$commitViewValue=function(){var a=p.$viewValue;
+g.cancel(K);if(p.$$lastCommittedViewValue!==a||""===a&&p.$$hasNativeValidators)p.$$updateEmptyClasses(a),p.$$lastCommittedViewValue=a,p.$pristine&&this.$setDirty(),this.$$parseAndValidate()};this.$$parseAndValidate=function(){var b=p.$$lastCommittedViewValue;if(t=x(b)?v:!0)for(var c=0;c<p.$parsers.length;c++)if(b=p.$parsers[c](b),x(b)){t=!1;break}N(p.$modelValue)&&isNaN(p.$modelValue)&&(p.$modelValue=q(a));var d=p.$modelValue,e=p.$options&&p.$options.allowInvalid;p.$$rawModelValue=b;e&&(p.$modelValue=
+b,p.$modelValue!==d&&p.$$writeModelToScope());p.$$runValidators(b,p.$$lastCommittedViewValue,function(a){e||(p.$modelValue=a?b:v,p.$modelValue!==d&&p.$$writeModelToScope())})};this.$$writeModelToScope=function(){I(a,p.$modelValue);n(p.$viewChangeListeners,function(a){try{a()}catch(c){b(c)}})};this.$setViewValue=function(a,b){p.$viewValue=a;p.$options&&!p.$options.updateOnDefault||p.$$debounceViewValueCommit(b)};this.$$debounceViewValueCommit=function(b){var c=0,d=p.$options;d&&y(d.debounce)&&(d=d.debounce,
+N(d)?c=d:N(d[b])?c=d[b]:N(d["default"])&&(c=d["default"]));g.cancel(K);c?K=g(function(){p.$commitViewValue()},c):h.$$phase?p.$commitViewValue():a.$apply(function(){p.$commitViewValue()})};a.$watch(function(){var b=q(a);if(b!==p.$modelValue&&(p.$modelValue===p.$modelValue||b===b)){p.$modelValue=p.$$rawModelValue=b;t=v;for(var c=p.$formatters,d=c.length,e=b;d--;)e=c[d](e);p.$viewValue!==e&&(p.$$updateEmptyClasses(e),p.$viewValue=p.$$lastCommittedViewValue=e,p.$render(),p.$$runValidators(b,e,B))}return b})}],
+Re=["$rootScope",function(a){return{restrict:"A",require:["ngModel","^?form","^?ngModelOptions"],controller:Ng,priority:1,compile:function(b){b.addClass(Ya).addClass("ng-untouched").addClass(ob);return{pre:function(a,b,e,f){var g=f[0];b=f[1]||g.$$parentForm;g.$$setOptions(f[2]&&f[2].$options);b.$addControl(g);e.$observe("name",function(a){g.$name!==a&&g.$$parentForm.$$renameControl(g,a)});a.$on("$destroy",function(){g.$$parentForm.$removeControl(g)})},post:function(b,c,e,f){var g=f[0];if(g.$options&&
+g.$options.updateOn)c.on(g.$options.updateOn,function(a){g.$$debounceViewValueCommit(a&&a.type)});c.on("blur",function(c){g.$touched||(a.$$phase?b.$evalAsync(g.$setTouched):b.$apply(g.$setTouched))})}}}}}],Og=/(\s+|^)default(\s+|$)/,Ve=function(){return{restrict:"A",controller:["$scope","$attrs",function(a,b){var d=this;this.$options=Oa(a.$eval(b.ngModelOptions));y(this.$options.updateOn)?(this.$options.updateOnDefault=!1,this.$options.updateOn=X(this.$options.updateOn.replace(Og,function(){d.$options.updateOnDefault=
+!0;return" "}))):this.$options.updateOnDefault=!0}]}},He=Ma({terminal:!0,priority:1E3}),Pg=H("ngOptions"),Qg=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,Pe=["$compile","$parse",function(a,b){function d(a,c,d){function e(a,b,c,d,f){this.selectValue=a;this.viewValue=b;this.label=c;this.group=d;this.disabled=f}
+function l(a){var b;if(!q&&Ca(a))b=a;else{b=[];for(var c in a)a.hasOwnProperty(c)&&"$"!==c.charAt(0)&&b.push(c)}return b}var m=a.match(Qg);if(!m)throw Pg("iexp",a,ta(c));var n=m[5]||m[7],q=m[6];a=/ as /.test(m[0])&&m[1];var v=m[9];c=b(m[2]?m[1]:n);var y=a&&b(a)||c,t=v&&b(v),p=v?function(a,b){return t(d,b)}:function(a){return Fa(a)},w=function(a,b){return p(a,B(a,b))},u=b(m[2]||m[1]),x=b(m[3]||""),z=b(m[4]||""),A=b(m[8]),C={},B=q?function(a,b){C[q]=b;C[n]=a;return C}:function(a){C[n]=a;return C};return{trackBy:v,
+getTrackByValue:w,getWatchables:b(A,function(a){var b=[];a=a||[];for(var c=l(a),e=c.length,f=0;f<e;f++){var g=a===c?f:c[f],k=B(a[g],g),g=p(a[g],k);b.push(g);if(m[2]||m[1])g=u(d,k),b.push(g);m[4]&&(k=z(d,k),b.push(k))}return b}),getOptions:function(){for(var a=[],b={},c=A(d)||[],f=l(c),g=f.length,m=0;m<g;m++){var n=c===f?m:f[m],r=B(c[n],n),q=y(d,r),n=p(q,r),s=u(d,r),t=x(d,r),r=z(d,r),q=new e(n,q,s,t,r);a.push(q);b[n]=q}return{items:a,selectValueMap:b,getOptionFromViewValue:function(a){return b[w(a)]},
+getViewValueFromOption:function(a){return v?ia.copy(a.viewValue):a.viewValue}}}}}var c=W.createElement("option"),e=W.createElement("optgroup");return{restrict:"A",terminal:!0,require:["select","ngModel"],link:{pre:function(a,b,c,d){d[0].registerOption=B},post:function(b,g,h,k){function l(a,b){a.element=b;b.disabled=a.disabled;a.label!==b.label&&(b.label=a.label,b.textContent=a.label);a.value!==b.value&&(b.value=a.selectValue)}function m(a,b,c,d){b&&G(b.nodeName)===c?c=b:(c=d.cloneNode(!1),b?a.insertBefore(c,
+b):a.appendChild(c));return c}function r(a){for(var b;a;)b=a.nextSibling,$b(a),a=b}function q(a){var b=w&&w[0],c=A&&A[0];if(b||c)for(;a&&(a===b||a===c||8===a.nodeType||"option"===ra(a)&&""===a.value);)a=a.nextSibling;return a}function v(){var a=D&&x.readValue();D=E.getOptions();var b={},d=g[0].firstChild;z&&g.prepend(w);d=q(d);D.items.forEach(function(a){var f,h;y(a.group)?(f=b[a.group],f||(f=m(g[0],d,"optgroup",e),d=f.nextSibling,f.label=a.group,f=b[a.group]={groupElement:f,currentOptionElement:f.firstChild}),
+h=m(f.groupElement,f.currentOptionElement,"option",c),l(a,h),f.currentOptionElement=h.nextSibling):(h=m(g[0],d,"option",c),l(a,h),d=h.nextSibling)});Object.keys(b).forEach(function(a){r(b[a].currentOptionElement)});r(d);t.$render();if(!t.$isEmpty(a)){var f=x.readValue();(E.trackBy||p?oa(a,f):a===f)||(t.$setViewValue(f),t.$render())}}var x=k[0],t=k[1],p=h.multiple,w;k=0;for(var u=g.children(),B=u.length;k<B;k++)if(""===u[k].value){w=u.eq(k);break}var z=!!w,A=C(c.cloneNode(!1));A.val("?");var D,E=d(h.ngOptions,
+g,b);p?(t.$isEmpty=function(a){return!a||0===a.length},x.writeValue=function(a){D.items.forEach(function(a){a.element.selected=!1});a&&a.forEach(function(a){(a=D.getOptionFromViewValue(a))&&!a.disabled&&(a.element.selected=!0)})},x.readValue=function(){var a=g.val()||[],b=[];n(a,function(a){(a=D.selectValueMap[a])&&!a.disabled&&b.push(D.getViewValueFromOption(a))});return b},E.trackBy&&b.$watchCollection(function(){if(L(t.$viewValue))return t.$viewValue.map(function(a){return E.getTrackByValue(a)})},
+function(){t.$render()})):(x.writeValue=function(a){var b=D.getOptionFromViewValue(a);b&&!b.disabled?g[0].value!==b.selectValue&&(A.remove(),z||w.remove(),g[0].value=b.selectValue,b.element.selected=!0,b.element.setAttribute("selected","selected")):null===a||z?(A.remove(),z||g.prepend(w),g.val(""),w.prop("selected",!0),w.attr("selected",!0)):(z||w.remove(),g.prepend(A),g.val("?"),A.prop("selected",!0),A.attr("selected",!0))},x.readValue=function(){var a=D.selectValueMap[g.val()];return a&&!a.disabled?
+(z||w.remove(),A.remove(),D.getViewValueFromOption(a)):null},E.trackBy&&b.$watch(function(){return E.getTrackByValue(t.$viewValue)},function(){t.$render()}));z?(w.remove(),a(w)(b),w.removeClass("ng-scope")):w=C(c.cloneNode(!1));v();b.$watchCollection(E.getWatchables,v)}}}}],Ie=["$locale","$interpolate","$log",function(a,b,d){var c=/{}/g,e=/^when(Minus)?(.+)$/;return{link:function(f,g,h){function k(a){g.text(a||"")}var l=h.count,m=h.$attr.when&&g.attr(h.$attr.when),r=h.offset||0,q=f.$eval(m)||{},v=
+{},y=b.startSymbol(),t=b.endSymbol(),p=y+l+"-"+r+t,w=ia.noop,u;n(h,function(a,b){var c=e.exec(b);c&&(c=(c[1]?"-":"")+G(c[2]),q[c]=g.attr(h.$attr[b]))});n(q,function(a,d){v[d]=b(a.replace(c,p))});f.$watch(l,function(b){var c=parseFloat(b),e=isNaN(c);e||c in q||(c=a.pluralCat(c-r));c===u||e&&N(u)&&isNaN(u)||(w(),e=v[c],x(e)?(null!=b&&d.debug("ngPluralize: no rule defined for '"+c+"' in "+m),w=B,k()):w=f.$watch(e,k),u=c)})}}}],Je=["$parse","$animate",function(a,b){var d=H("ngRepeat"),c=function(a,b,
+c,d,k,l,m){a[c]=d;k&&(a[k]=l);a.$index=b;a.$first=0===b;a.$last=b===m-1;a.$middle=!(a.$first||a.$last);a.$odd=!(a.$even=0===(b&1))};return{restrict:"A",multiElement:!0,transclude:"element",priority:1E3,terminal:!0,$$tlb:!0,compile:function(e,f){var g=f.ngRepeat,h=W.createComment(" end ngRepeat: "+g+" "),k=g.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);if(!k)throw d("iexp",g);var l=k[1],m=k[2],r=k[3],q=k[4],k=l.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/);
+if(!k)throw d("iidexp",l);var x=k[3]||k[1],y=k[2];if(r&&(!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(r)||/^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(r)))throw d("badident",r);var t,p,w,u,B={$id:Fa};q?t=a(q):(w=function(a,b){return Fa(b)},u=function(a){return a});return function(a,e,f,k,l){t&&(p=function(b,c,d){y&&(B[y]=b);B[x]=c;B.$index=d;return t(a,B)});var q=Z();a.$watchCollection(m,function(f){var k,m,s=e[0],t,B=Z(),D,E,H,F,L,G,N;r&&(a[r]=f);if(Ca(f))L=
+f,m=p||w;else for(N in m=p||u,L=[],f)sa.call(f,N)&&"$"!==N.charAt(0)&&L.push(N);D=L.length;N=Array(D);for(k=0;k<D;k++)if(E=f===L?k:L[k],H=f[E],F=m(E,H,k),q[F])G=q[F],delete q[F],B[F]=G,N[k]=G;else{if(B[F])throw n(N,function(a){a&&a.scope&&(q[a.id]=a)}),d("dupes",g,F,H);N[k]={id:F,scope:v,clone:v};B[F]=!0}for(t in q){G=q[t];F=tb(G.clone);b.leave(F);if(F[0].parentNode)for(k=0,m=F.length;k<m;k++)F[k].$$NG_REMOVED=!0;G.scope.$destroy()}for(k=0;k<D;k++)if(E=f===L?k:L[k],H=f[E],G=N[k],G.scope){t=s;do t=
+t.nextSibling;while(t&&t.$$NG_REMOVED);G.clone[0]!=t&&b.move(tb(G.clone),null,C(s));s=G.clone[G.clone.length-1];c(G.scope,k,x,H,y,E,D)}else l(function(a,d){G.scope=d;var e=h.cloneNode(!1);a[a.length++]=e;b.enter(a,null,C(s));s=e;G.clone=a;B[G.id]=G;c(G.scope,k,x,H,y,E,D)});q=B})}}}}],Ke=["$animate",function(a){return{restrict:"A",multiElement:!0,link:function(b,d,c){b.$watch(c.ngShow,function(b){a[b?"removeClass":"addClass"](d,"ng-hide",{tempClasses:"ng-hide-animate"})})}}}],De=["$animate",function(a){return{restrict:"A",
+multiElement:!0,link:function(b,d,c){b.$watch(c.ngHide,function(b){a[b?"addClass":"removeClass"](d,"ng-hide",{tempClasses:"ng-hide-animate"})})}}}],Le=Ma(function(a,b,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&n(d,function(a,c){b.css(c,"")});a&&b.css(a)},!0)}),Me=["$animate",function(a){return{require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(b,d,c,e){var f=[],g=[],h=[],k=[],l=function(a,b){return function(){a.splice(b,1)}};b.$watch(c.ngSwitch||c.on,function(b){var c,
+d;c=0;for(d=h.length;c<d;++c)a.cancel(h[c]);c=h.length=0;for(d=k.length;c<d;++c){var q=tb(g[c].clone);k[c].$destroy();(h[c]=a.leave(q)).then(l(h,c))}g.length=0;k.length=0;(f=e.cases["!"+b]||e.cases["?"])&&n(f,function(b){b.transclude(function(c,d){k.push(d);var e=b.element;c[c.length++]=W.createComment(" end ngSwitchWhen: ");g.push({clone:c});a.enter(c,e.parent(),e)})})})}}}],Ne=Ma({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(a,b,d,c,e){c.cases["!"+d.ngSwitchWhen]=
+c.cases["!"+d.ngSwitchWhen]||[];c.cases["!"+d.ngSwitchWhen].push({transclude:e,element:b})}}),Oe=Ma({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(a,b,d,c,e){c.cases["?"]=c.cases["?"]||[];c.cases["?"].push({transclude:e,element:b})}}),Rg=H("ngTransclude"),Qe=Ma({restrict:"EAC",link:function(a,b,d,c,e){d.ngTransclude===d.$attr.ngTransclude&&(d.ngTransclude="");if(!e)throw Rg("orphan",ta(b));e(function(a){a.length&&(b.empty(),b.append(a))},null,d.ngTransclude||
+d.ngTranscludeSlot)}}),qe=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(b,d){"text/ng-template"==d.type&&a.put(d.id,b[0].text)}}}],Sg={$setViewValue:B,$render:B},Tg=["$element","$scope","$attrs",function(a,b,d){var c=this,e=new Ua;c.ngModelCtrl=Sg;c.unknownOption=C(W.createElement("option"));c.renderUnknownOption=function(b){b="? "+Fa(b)+" ?";c.unknownOption.val(b);a.prepend(c.unknownOption);a.val(b)};b.$on("$destroy",function(){c.renderUnknownOption=B});c.removeUnknownOption=
+function(){c.unknownOption.parent()&&c.unknownOption.remove()};c.readValue=function(){c.removeUnknownOption();return a.val()};c.writeValue=function(b){c.hasOption(b)?(c.removeUnknownOption(),a.val(b),""===b&&c.emptyOption.prop("selected",!0)):null==b&&c.emptyOption?(c.removeUnknownOption(),a.val("")):c.renderUnknownOption(b)};c.addOption=function(a,b){if(8!==b[0].nodeType){Ta(a,'"option value"');""===a&&(c.emptyOption=b);var d=e.get(a)||0;e.put(a,d+1);c.ngModelCtrl.$render();b[0].hasAttribute("selected")&&
+(b[0].selected=!0)}};c.removeOption=function(a){var b=e.get(a);b&&(1===b?(e.remove(a),""===a&&(c.emptyOption=v)):e.put(a,b-1))};c.hasOption=function(a){return!!e.get(a)};c.registerOption=function(a,b,d,e,l){if(e){var m;d.$observe("value",function(a){y(m)&&c.removeOption(m);m=a;c.addOption(a,b)})}else l?a.$watch(l,function(a,e){d.$set("value",a);e!==a&&c.removeOption(e);c.addOption(a,b)}):c.addOption(d.value,b);b.on("$destroy",function(){c.removeOption(d.value);c.ngModelCtrl.$render()})}}],re=function(){return{restrict:"E",
+require:["select","?ngModel"],controller:Tg,priority:1,link:{pre:function(a,b,d,c){var e=c[1];if(e){var f=c[0];f.ngModelCtrl=e;b.on("change",function(){a.$apply(function(){e.$setViewValue(f.readValue())})});if(d.multiple){f.readValue=function(){var a=[];n(b.find("option"),function(b){b.selected&&a.push(b.value)});return a};f.writeValue=function(a){var c=new Ua(a);n(b.find("option"),function(a){a.selected=y(c.get(a.value))})};var g,h=NaN;a.$watch(function(){h!==e.$viewValue||oa(g,e.$viewValue)||(g=
+na(e.$viewValue),e.$render());h=e.$viewValue});e.$isEmpty=function(a){return!a||0===a.length}}}},post:function(a,b,d,c){var e=c[1];if(e){var f=c[0];e.$render=function(){f.writeValue(e.$viewValue)}}}}}},te=["$interpolate",function(a){return{restrict:"E",priority:100,compile:function(b,d){if(y(d.value))var c=a(d.value,!0);else{var e=a(b.text(),!0);e||d.$set("value",b.text())}return function(a,b,d){var k=b.parent();(k=k.data("$selectController")||k.parent().data("$selectController"))&&k.registerOption(a,
+b,d,c,e)}}}}],se=ba({restrict:"E",terminal:!1}),Hc=function(){return{restrict:"A",require:"?ngModel",link:function(a,b,d,c){c&&(d.required=!0,c.$validators.required=function(a,b){return!d.required||!c.$isEmpty(b)},d.$observe("required",function(){c.$validate()}))}}},Gc=function(){return{restrict:"A",require:"?ngModel",link:function(a,b,d,c){if(c){var e,f=d.ngPattern||d.pattern;d.$observe("pattern",function(a){F(a)&&0<a.length&&(a=new RegExp("^"+a+"$"));if(a&&!a.test)throw H("ngPattern")("noregexp",
+f,a,ta(b));e=a||v;c.$validate()});c.$validators.pattern=function(a,b){return c.$isEmpty(b)||x(e)||e.test(b)}}}}},Jc=function(){return{restrict:"A",require:"?ngModel",link:function(a,b,d,c){if(c){var e=-1;d.$observe("maxlength",function(a){a=ca(a);e=isNaN(a)?-1:a;c.$validate()});c.$validators.maxlength=function(a,b){return 0>e||c.$isEmpty(b)||b.length<=e}}}}},Ic=function(){return{restrict:"A",require:"?ngModel",link:function(a,b,d,c){if(c){var e=0;d.$observe("minlength",function(a){e=ca(a)||0;c.$validate()});
+c.$validators.minlength=function(a,b){return c.$isEmpty(b)||b.length>=e}}}}};O.angular.bootstrap?console.log("WARNING: Tried to load angular more than once."):(je(),le(ia),ia.module("ngLocale",[],["$provide",function(a){function b(a){a+="";var b=a.indexOf(".");return-1==b?0:a.length-b-1}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:"January February March April May June July August September October November December".split(" "),
+SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),STANDALONEMONTH:"January February March April May June July August September October November December".split(" "),WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",
+PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-\u00a4",negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(a,c){var e=a|0,f=c;v===f&&(f=Math.min(b(a),3));Math.pow(10,f);return 1==e&&0==f?"one":"other"}})}]),C(W).ready(function(){fe(W,Ac)}))})(window,document);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');
+//# sourceMappingURL=angular.min.js.map
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.min.js.map
new file mode 100644
index 00000000..07fc1ce3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.min.js.map
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"angular.min.js",
+"lineCount":306,
+"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAmBC,CAAnB,CAA8B,CAgCvCC,QAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,SAAAA,EAAAA,CAAAA,IAAAA,EAAAA,SAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,GAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,EAAAA,EAAAA,CAAAA,CAAAA,sCAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,EAAAA,EAAAA,CAAAA,KAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,SAAAA,OAAAA,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAAA,CAAAA,CAAAA,GAAAA,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,CAAAA,CAAAA,CAAAA,EAAAA,GAAAA,KAAAA,EAAAA,kBAAAA,CAAAA,CAAAA,EAAAA,CAAAA,SAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,UAAAA,EAAAA,MAAAA,EAAAA,CAAAA,CAAAA,SAAAA,EAAAA,QAAAA,CAAAA,aAAAA,CAAAA,EAAAA,CAAAA,CAAAA,WAAAA,EAAAA,MAAAA,EAAAA,CAAAA,WAAAA,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,CAAAA,IAAAA,UAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,MAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAmNAC,QAASA,GAAW,CAACC,CAAD,CAAM,CAGxB,GAAW,IAAX,EAAIA,CAAJ,EAAmBC,EAAA,CAASD,CAAT,CAAnB,CAAkC,MAAO,CAAA,CAMzC,IAAIE,CAAA,CAAQF,CAAR,CAAJ,EAAoBG,CAAA,CAASH,CAAT,CAApB,EAAsCI,CAAtC,EAAgDJ,CAAhD,WAA+DI,EAA/D,CAAwE,MAAO,CAAA,CAI/E;IAAIC,EAAS,QAATA,EAAqBC,OAAA,CAAON,CAAP,CAArBK,EAAoCL,CAAAK,OAIxC,OAAOE,EAAA,CAASF,CAAT,CAAP,GACa,CADb,EACGA,CADH,GACoBA,CADpB,CAC6B,CAD7B,GACmCL,EADnC,EAC0CA,CAD1C,WACyDQ,MADzD,GACsF,UADtF,EACmE,MAAOR,EAAAS,KAD1E,CAjBwB,CAyD1BC,QAASA,EAAO,CAACV,CAAD,CAAMW,CAAN,CAAgBC,CAAhB,CAAyB,CAAA,IACnCC,CADmC,CAC9BR,CACT,IAAIL,CAAJ,CACE,GAAIc,CAAA,CAAWd,CAAX,CAAJ,CACE,IAAKa,CAAL,GAAYb,EAAZ,CAGa,WAAX,EAAIa,CAAJ,EAAiC,QAAjC,EAA0BA,CAA1B,EAAoD,MAApD,EAA6CA,CAA7C,EAAgEb,CAAAe,eAAhE,EAAsF,CAAAf,CAAAe,eAAA,CAAmBF,CAAnB,CAAtF,EACEF,CAAAK,KAAA,CAAcJ,CAAd,CAAuBZ,CAAA,CAAIa,CAAJ,CAAvB,CAAiCA,CAAjC,CAAsCb,CAAtC,CALN,KAQO,IAAIE,CAAA,CAAQF,CAAR,CAAJ,EAAoBD,EAAA,CAAYC,CAAZ,CAApB,CAAsC,CAC3C,IAAIiB,EAA6B,QAA7BA,GAAc,MAAOjB,EACpBa,EAAA,CAAM,CAAX,KAAcR,CAAd,CAAuBL,CAAAK,OAAvB,CAAmCQ,CAAnC,CAAyCR,CAAzC,CAAiDQ,CAAA,EAAjD,CACE,CAAII,CAAJ,EAAmBJ,CAAnB,GAA0Bb,EAA1B,GACEW,CAAAK,KAAA,CAAcJ,CAAd,CAAuBZ,CAAA,CAAIa,CAAJ,CAAvB,CAAiCA,CAAjC,CAAsCb,CAAtC,CAJuC,CAAtC,IAOA,IAAIA,CAAAU,QAAJ,EAAmBV,CAAAU,QAAnB,GAAmCA,CAAnC,CACHV,CAAAU,QAAA,CAAYC,CAAZ,CAAsBC,CAAtB,CAA+BZ,CAA/B,CADG,KAEA,IAAIkB,EAAA,CAAclB,CAAd,CAAJ,CAEL,IAAKa,CAAL,GAAYb,EAAZ,CACEW,CAAAK,KAAA,CAAcJ,CAAd,CAAuBZ,CAAA,CAAIa,CAAJ,CAAvB,CAAiCA,CAAjC,CAAsCb,CAAtC,CAHG,KAKA,IAAkC,UAAlC,GAAI,MAAOA,EAAAe,eAAX,CAEL,IAAKF,CAAL,GAAYb,EAAZ,CACMA,CAAAe,eAAA,CAAmBF,CAAnB,CAAJ;AACEF,CAAAK,KAAA,CAAcJ,CAAd,CAAuBZ,CAAA,CAAIa,CAAJ,CAAvB,CAAiCA,CAAjC,CAAsCb,CAAtC,CAJC,KASL,KAAKa,CAAL,GAAYb,EAAZ,CACMe,EAAAC,KAAA,CAAoBhB,CAApB,CAAyBa,CAAzB,CAAJ,EACEF,CAAAK,KAAA,CAAcJ,CAAd,CAAuBZ,CAAA,CAAIa,CAAJ,CAAvB,CAAiCA,CAAjC,CAAsCb,CAAtC,CAKR,OAAOA,EAzCgC,CA4CzCmB,QAASA,GAAa,CAACnB,CAAD,CAAMW,CAAN,CAAgBC,CAAhB,CAAyB,CAE7C,IADA,IAAIQ,EAAOd,MAAAc,KAAA,CAAYpB,CAAZ,CAAAqB,KAAA,EAAX,CACSC,EAAI,CAAb,CAAgBA,CAAhB,CAAoBF,CAAAf,OAApB,CAAiCiB,CAAA,EAAjC,CACEX,CAAAK,KAAA,CAAcJ,CAAd,CAAuBZ,CAAA,CAAIoB,CAAA,CAAKE,CAAL,CAAJ,CAAvB,CAAqCF,CAAA,CAAKE,CAAL,CAArC,CAEF,OAAOF,EALsC,CAc/CG,QAASA,GAAa,CAACC,CAAD,CAAa,CACjC,MAAO,SAAQ,CAACC,CAAD,CAAQZ,CAAR,CAAa,CAACW,CAAA,CAAWX,CAAX,CAAgBY,CAAhB,CAAD,CADK,CAcnCC,QAASA,GAAO,EAAG,CACjB,MAAO,EAAEC,EADQ,CAmBnBC,QAASA,GAAU,CAACC,CAAD,CAAMC,CAAN,CAAYC,CAAZ,CAAkB,CAGnC,IAFA,IAAIC,EAAIH,CAAAI,UAAR,CAESX,EAAI,CAFb,CAEgBY,EAAKJ,CAAAzB,OAArB,CAAkCiB,CAAlC,CAAsCY,CAAtC,CAA0C,EAAEZ,CAA5C,CAA+C,CAC7C,IAAItB,EAAM8B,CAAA,CAAKR,CAAL,CACV,IAAKa,CAAA,CAASnC,CAAT,CAAL,EAAuBc,CAAA,CAAWd,CAAX,CAAvB,CAEA,IADA,IAAIoB,EAAOd,MAAAc,KAAA,CAAYpB,CAAZ,CAAX,CACSoC,EAAI,CADb,CACgBC,EAAKjB,CAAAf,OAArB,CAAkC+B,CAAlC,CAAsCC,CAAtC,CAA0CD,CAAA,EAA1C,CAA+C,CAC7C,IAAIvB,EAAMO,CAAA,CAAKgB,CAAL,CAAV,CACIE,EAAMtC,CAAA,CAAIa,CAAJ,CAENkB,EAAJ,EAAYI,CAAA,CAASG,CAAT,CAAZ,CACMC,CAAA,CAAOD,CAAP,CAAJ,CACET,CAAA,CAAIhB,CAAJ,CADF,CACa,IAAI2B,IAAJ,CAASF,CAAAG,QAAA,EAAT,CADb,CAEWC,EAAA,CAASJ,CAAT,CAAJ,CACLT,CAAA,CAAIhB,CAAJ,CADK,CACM,IAAI8B,MAAJ,CAAWL,CAAX,CADN,CAEIA,CAAAM,SAAJ,CACLf,CAAA,CAAIhB,CAAJ,CADK,CACMyB,CAAAO,UAAA,CAAc,CAAA,CAAd,CADN;AAEIC,EAAA,CAAUR,CAAV,CAAJ,CACLT,CAAA,CAAIhB,CAAJ,CADK,CACMyB,CAAAS,MAAA,EADN,EAGAZ,CAAA,CAASN,CAAA,CAAIhB,CAAJ,CAAT,CACL,GADyBgB,CAAA,CAAIhB,CAAJ,CACzB,CADoCX,CAAA,CAAQoC,CAAR,CAAA,CAAe,EAAf,CAAoB,EACxD,EAAAV,EAAA,CAAWC,CAAA,CAAIhB,CAAJ,CAAX,CAAqB,CAACyB,CAAD,CAArB,CAA4B,CAAA,CAA5B,CAJK,CAPT,CAcET,CAAA,CAAIhB,CAAJ,CAdF,CAcayB,CAlBgC,CAJF,CA2B/BN,CAtChB,CAsCWH,CArCTI,UADF,CAsCgBD,CAtChB,CAGE,OAmCSH,CAnCFI,UAoCT,OAAOJ,EA/B4B,CAoDrCmB,QAASA,EAAM,CAACnB,CAAD,CAAM,CACnB,MAAOD,GAAA,CAAWC,CAAX,CAAgBoB,EAAAjC,KAAA,CAAWkC,SAAX,CAAsB,CAAtB,CAAhB,CAA0C,CAAA,CAA1C,CADY,CAuBrBC,QAASA,GAAK,CAACtB,CAAD,CAAM,CAClB,MAAOD,GAAA,CAAWC,CAAX,CAAgBoB,EAAAjC,KAAA,CAAWkC,SAAX,CAAsB,CAAtB,CAAhB,CAA0C,CAAA,CAA1C,CADW,CAMpBE,QAASA,GAAK,CAACC,CAAD,CAAM,CAClB,MAAOC,SAAA,CAASD,CAAT,CAAc,EAAd,CADW,CAKpBE,QAASA,GAAO,CAACC,CAAD,CAASC,CAAT,CAAgB,CAC9B,MAAOT,EAAA,CAAO1C,MAAAoD,OAAA,CAAcF,CAAd,CAAP,CAA8BC,CAA9B,CADuB,CAoBhCE,QAASA,EAAI,EAAG,EAsBhBC,QAASA,GAAQ,CAACC,CAAD,CAAI,CAAC,MAAOA,EAAR,CAIrBC,QAASA,GAAO,CAACrC,CAAD,CAAQ,CAAC,MAAO,SAAQ,EAAG,CAAC,MAAOA,EAAR,CAAnB,CAExBsC,QAASA,GAAiB,CAAC/D,CAAD,CAAM,CAC9B,MAAOc,EAAA,CAAWd,CAAAgE,SAAX,CAAP,EAAmChE,CAAAgE,SAAnC,GAAoDA,EADtB,CAiBhCC,QAASA,EAAW,CAACxC,CAAD,CAAQ,CAAC,MAAwB,WAAxB,GAAO,MAAOA,EAAf,CAe5ByC,QAASA,EAAS,CAACzC,CAAD,CAAQ,CAAC,MAAwB,WAAxB;AAAO,MAAOA,EAAf,CAgB1BU,QAASA,EAAQ,CAACV,CAAD,CAAQ,CAEvB,MAAiB,KAAjB,GAAOA,CAAP,EAA0C,QAA1C,GAAyB,MAAOA,EAFT,CAWzBP,QAASA,GAAa,CAACO,CAAD,CAAQ,CAC5B,MAAiB,KAAjB,GAAOA,CAAP,EAA0C,QAA1C,GAAyB,MAAOA,EAAhC,EAAsD,CAAC0C,EAAA,CAAe1C,CAAf,CAD3B,CAiB9BtB,QAASA,EAAQ,CAACsB,CAAD,CAAQ,CAAC,MAAwB,QAAxB,GAAO,MAAOA,EAAf,CAqBzBlB,QAASA,EAAQ,CAACkB,CAAD,CAAQ,CAAC,MAAwB,QAAxB,GAAO,MAAOA,EAAf,CAezBc,QAASA,EAAM,CAACd,CAAD,CAAQ,CACrB,MAAgC,eAAhC,GAAOuC,EAAAhD,KAAA,CAAcS,CAAd,CADc,CA+BvBX,QAASA,EAAU,CAACW,CAAD,CAAQ,CAAC,MAAwB,UAAxB,GAAO,MAAOA,EAAf,CAU3BiB,QAASA,GAAQ,CAACjB,CAAD,CAAQ,CACvB,MAAgC,iBAAhC,GAAOuC,EAAAhD,KAAA,CAAcS,CAAd,CADgB,CAYzBxB,QAASA,GAAQ,CAACD,CAAD,CAAM,CACrB,MAAOA,EAAP,EAAcA,CAAAL,OAAd,GAA6BK,CADR,CAKvBoE,QAASA,GAAO,CAACpE,CAAD,CAAM,CACpB,MAAOA,EAAP,EAAcA,CAAAqE,WAAd,EAAgCrE,CAAAsE,OADZ,CAoBtBC,QAASA,GAAS,CAAC9C,CAAD,CAAQ,CACxB,MAAwB,SAAxB,GAAO,MAAOA,EADU,CAW1B+C,QAASA,GAAY,CAAC/C,CAAD,CAAQ,CAC3B,MAAOA,EAAP,EAAgBlB,CAAA,CAASkB,CAAApB,OAAT,CAAhB;AAA0CoE,EAAAC,KAAA,CAAwBV,EAAAhD,KAAA,CAAcS,CAAd,CAAxB,CADf,CAkC7BqB,QAASA,GAAS,CAAC6B,CAAD,CAAO,CACvB,MAAO,EAAGA,CAAAA,CAAH,EACJ,EAAAA,CAAA/B,SAAA,EACG+B,CAAAC,KADH,EACgBD,CAAAE,KADhB,EAC6BF,CAAAG,KAD7B,CADI,CADgB,CAUzBC,QAASA,GAAO,CAAC1B,CAAD,CAAM,CAAA,IAChBrD,EAAM,EAAIgF,EAAAA,CAAQ3B,CAAA4B,MAAA,CAAU,GAAV,CAAtB,KAAsC3D,CACtC,KAAKA,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgB0D,CAAA3E,OAAhB,CAA8BiB,CAAA,EAA9B,CACEtB,CAAA,CAAIgF,CAAA,CAAM1D,CAAN,CAAJ,CAAA,CAAgB,CAAA,CAElB,OAAOtB,EALa,CAStBkF,QAASA,GAAS,CAACC,CAAD,CAAU,CAC1B,MAAOC,EAAA,CAAUD,CAAAvC,SAAV,EAA+BuC,CAAA,CAAQ,CAAR,CAA/B,EAA6CA,CAAA,CAAQ,CAAR,CAAAvC,SAA7C,CADmB,CAQ5ByC,QAASA,GAAW,CAACC,CAAD,CAAQ7D,CAAR,CAAe,CACjC,IAAI8D,EAAQD,CAAAE,QAAA,CAAc/D,CAAd,CACC,EAAb,EAAI8D,CAAJ,EACED,CAAAG,OAAA,CAAaF,CAAb,CAAoB,CAApB,CAEF,OAAOA,EAL0B,CAkEnCG,QAASA,GAAI,CAACC,CAAD,CAASC,CAAT,CAAsB,CA8BjCC,QAASA,EAAW,CAACF,CAAD,CAASC,CAAT,CAAsB,CACxC,IAAI5D,EAAI4D,CAAA3D,UAAR,CACYpB,CACZ,IAAIX,CAAA,CAAQyF,CAAR,CAAJ,CAAqB,CACVrE,CAAAA,CAAI,CAAb,KAAS,IAAOY,EAAKyD,CAAAtF,OAArB,CAAoCiB,CAApC,CAAwCY,CAAxC,CAA4CZ,CAAA,EAA5C,CACEsE,CAAAE,KAAA,CAAiBC,CAAA,CAAYJ,CAAA,CAAOrE,CAAP,CAAZ,CAAjB,CAFiB,CAArB,IAIO,IAAIJ,EAAA,CAAcyE,CAAd,CAAJ,CAEL,IAAK9E,CAAL,GAAY8E,EAAZ,CACEC,CAAA,CAAY/E,CAAZ,CAAA,CAAmBkF,CAAA,CAAYJ,CAAA,CAAO9E,CAAP,CAAZ,CAHhB,KAKA,IAAI8E,CAAJ,EAA+C,UAA/C,GAAc,MAAOA,EAAA5E,eAArB,CAEL,IAAKF,CAAL,GAAY8E,EAAZ,CACMA,CAAA5E,eAAA,CAAsBF,CAAtB,CAAJ;CACE+E,CAAA,CAAY/E,CAAZ,CADF,CACqBkF,CAAA,CAAYJ,CAAA,CAAO9E,CAAP,CAAZ,CADrB,CAHG,KASL,KAAKA,CAAL,GAAY8E,EAAZ,CACM5E,EAAAC,KAAA,CAAoB2E,CAApB,CAA4B9E,CAA5B,CAAJ,GACE+E,CAAA,CAAY/E,CAAZ,CADF,CACqBkF,CAAA,CAAYJ,CAAA,CAAO9E,CAAP,CAAZ,CADrB,CAKoBmB,EA/gB1B,CA+gBa4D,CA9gBX3D,UADF,CA+gB0BD,CA/gB1B,CAGE,OA4gBW4D,CA5gBJ3D,UA6gBP,OAAO2D,EA5BiC,CA+B1CG,QAASA,EAAW,CAACJ,CAAD,CAAS,CAE3B,GAAK,CAAAxD,CAAA,CAASwD,CAAT,CAAL,CACE,MAAOA,EAIT,KAAIJ,EAAQS,CAAAR,QAAA,CAAoBG,CAApB,CACZ,IAAe,EAAf,GAAIJ,CAAJ,CACE,MAAOU,EAAA,CAAUV,CAAV,CAGT,IAAItF,EAAA,CAAS0F,CAAT,CAAJ,EAAwBvB,EAAA,CAAQuB,CAAR,CAAxB,CACE,KAAMO,GAAA,CAAS,MAAT,CAAN,CAIEC,IAAAA,EAAe,CAAA,CAAfA,CACAP,EAAcQ,CAAA,CAAST,CAAT,CAEdC,EAAJ,GAAoB/F,CAApB,GACE+F,CACA,CADc1F,CAAA,CAAQyF,CAAR,CAAA,CAAkB,EAAlB,CAAuBrF,MAAAoD,OAAA,CAAcS,EAAA,CAAewB,CAAf,CAAd,CACrC,CAAAQ,CAAA,CAAe,CAAA,CAFjB,CAKAH,EAAAF,KAAA,CAAiBH,CAAjB,CACAM,EAAAH,KAAA,CAAeF,CAAf,CAEA,OAAOO,EAAA,CACHN,CAAA,CAAYF,CAAZ,CAAoBC,CAApB,CADG,CAEHA,CA9BuB,CAiC7BQ,QAASA,EAAQ,CAACT,CAAD,CAAS,CACxB,OAAQ3B,EAAAhD,KAAA,CAAc2E,CAAd,CAAR,EACE,KAAK,oBAAL,CACA,KAAK,qBAAL,CACA,KAAK,qBAAL,CACA,KAAK,uBAAL,CACA,KAAK,uBAAL,CACA,KAAK,qBAAL,CACA,KAAK,4BAAL,CACA,KAAK,sBAAL,CACA,KAAK,sBAAL,CACE,MAAO,KAAIA,CAAAU,YAAJ,CAAuBN,CAAA,CAAYJ,CAAAW,OAAZ,CAAvB,CAET;KAAK,sBAAL,CAEE,GAAKrD,CAAA0C,CAAA1C,MAAL,CAAmB,CACjB,IAAIsD,EAAS,IAAIC,WAAJ,CAAgBb,CAAAc,WAAhB,CACbC,EAAA,IAAIC,UAAJ,CAAeJ,CAAf,CAAAG,KAAA,CAA2B,IAAIC,UAAJ,CAAehB,CAAf,CAA3B,CACA,OAAOY,EAHU,CAKnB,MAAOZ,EAAA1C,MAAA,CAAa,CAAb,CAET,MAAK,kBAAL,CACA,KAAK,iBAAL,CACA,KAAK,iBAAL,CACA,KAAK,eAAL,CACE,MAAO,KAAI0C,CAAAU,YAAJ,CAAuBV,CAAAlD,QAAA,EAAvB,CAET,MAAK,iBAAL,CAGE,MAFImE,EAEGA,CAFE,IAAIjE,MAAJ,CAAWgD,CAAAA,OAAX,CAA0BA,CAAA3B,SAAA,EAAA6C,MAAA,CAAwB,SAAxB,CAAA,CAAmC,CAAnC,CAA1B,CAEFD,CADPA,CAAAE,UACOF,CADQjB,CAAAmB,UACRF,CAAAA,CA9BX,CAiCA,GAAI9F,CAAA,CAAW6E,CAAA9C,UAAX,CAAJ,CACE,MAAO8C,EAAA9C,UAAA,CAAiB,CAAA,CAAjB,CAnCe,CA7F1B,IAAImD,EAAc,EAAlB,CACIC,EAAY,EAEhB,IAAIL,CAAJ,CAAiB,CACf,GAAIpB,EAAA,CAAaoB,CAAb,CAAJ,EA/H4B,sBA+H5B,GA/HK5B,EAAAhD,KAAA,CA+H0C4E,CA/H1C,CA+HL,CACE,KAAMM,GAAA,CAAS,MAAT,CAAN;AAEF,GAAIP,CAAJ,GAAeC,CAAf,CACE,KAAMM,GAAA,CAAS,KAAT,CAAN,CAIEhG,CAAA,CAAQ0F,CAAR,CAAJ,CACEA,CAAAvF,OADF,CACuB,CADvB,CAGEK,CAAA,CAAQkF,CAAR,CAAqB,QAAQ,CAACnE,CAAD,CAAQZ,CAAR,CAAa,CAC5B,WAAZ,GAAIA,CAAJ,EACE,OAAO+E,CAAA,CAAY/E,CAAZ,CAF+B,CAA1C,CAOFmF,EAAAF,KAAA,CAAiBH,CAAjB,CACAM,EAAAH,KAAA,CAAeF,CAAf,CACA,OAAOC,EAAA,CAAYF,CAAZ,CAAoBC,CAApB,CArBQ,CAwBjB,MAAOG,EAAA,CAAYJ,CAAZ,CA5B0B,CA2InCoB,QAASA,GAAW,CAACzE,CAAD,CAAMT,CAAN,CAAW,CAC7B,GAAI3B,CAAA,CAAQoC,CAAR,CAAJ,CAAkB,CAChBT,CAAA,CAAMA,CAAN,EAAa,EAEb,KAHgB,IAGPP,EAAI,CAHG,CAGAY,EAAKI,CAAAjC,OAArB,CAAiCiB,CAAjC,CAAqCY,CAArC,CAAyCZ,CAAA,EAAzC,CACEO,CAAA,CAAIP,CAAJ,CAAA,CAASgB,CAAA,CAAIhB,CAAJ,CAJK,CAAlB,IAMO,IAAIa,CAAA,CAASG,CAAT,CAAJ,CAGL,IAASzB,CAAT,GAFAgB,EAEgBS,CAFVT,CAEUS,EAFH,EAEGA,CAAAA,CAAhB,CACE,GAAwB,GAAxB,GAAMzB,CAAAmG,OAAA,CAAW,CAAX,CAAN,EAAiD,GAAjD,GAA+BnG,CAAAmG,OAAA,CAAW,CAAX,CAA/B,CACEnF,CAAA,CAAIhB,CAAJ,CAAA,CAAWyB,CAAA,CAAIzB,CAAJ,CAKjB,OAAOgB,EAAP,EAAcS,CAjBe,CAkD/B2E,QAASA,GAAM,CAACC,CAAD,CAAKC,CAAL,CAAS,CACtB,GAAID,CAAJ,GAAWC,CAAX,CAAe,MAAO,CAAA,CACtB,IAAW,IAAX,GAAID,CAAJ,EAA0B,IAA1B,GAAmBC,CAAnB,CAAgC,MAAO,CAAA,CACvC,IAAID,CAAJ,GAAWA,CAAX,EAAiBC,CAAjB,GAAwBA,CAAxB,CAA4B,MAAO,CAAA,CAHb,KAIlBC,EAAK,MAAOF,EAJM,CAIsBrG,CAC5C,IAAIuG,CAAJ,EADyBC,MAAOF,EAChC,EAAsB,QAAtB,EAAgBC,CAAhB,CACE,GAAIlH,CAAA,CAAQgH,CAAR,CAAJ,CAAiB,CACf,GAAK,CAAAhH,CAAA,CAAQiH,CAAR,CAAL,CAAkB,MAAO,CAAA,CACzB,KAAK9G,CAAL,CAAc6G,CAAA7G,OAAd,GAA4B8G,CAAA9G,OAA5B,CAAuC,CACrC,IAAKQ,CAAL;AAAW,CAAX,CAAcA,CAAd,CAAoBR,CAApB,CAA4BQ,CAAA,EAA5B,CACE,GAAK,CAAAoG,EAAA,CAAOC,CAAA,CAAGrG,CAAH,CAAP,CAAgBsG,CAAA,CAAGtG,CAAH,CAAhB,CAAL,CAA+B,MAAO,CAAA,CAExC,OAAO,CAAA,CAJ8B,CAFxB,CAAjB,IAQO,CAAA,GAAI0B,CAAA,CAAO2E,CAAP,CAAJ,CACL,MAAK3E,EAAA,CAAO4E,CAAP,CAAL,CACOF,EAAA,CAAOC,CAAAI,QAAA,EAAP,CAAqBH,CAAAG,QAAA,EAArB,CADP,CAAwB,CAAA,CAEnB,IAAI5E,EAAA,CAASwE,CAAT,CAAJ,CACL,MAAKxE,GAAA,CAASyE,CAAT,CAAL,CACOD,CAAAlD,SAAA,EADP,EACwBmD,CAAAnD,SAAA,EADxB,CAA0B,CAAA,CAG1B,IAAII,EAAA,CAAQ8C,CAAR,CAAJ,EAAmB9C,EAAA,CAAQ+C,CAAR,CAAnB,EAAkClH,EAAA,CAASiH,CAAT,CAAlC,EAAkDjH,EAAA,CAASkH,CAAT,CAAlD,EACEjH,CAAA,CAAQiH,CAAR,CADF,EACiB5E,CAAA,CAAO4E,CAAP,CADjB,EAC+BzE,EAAA,CAASyE,CAAT,CAD/B,CAC6C,MAAO,CAAA,CACpDI,EAAA,CAASC,CAAA,EACT,KAAK3G,CAAL,GAAYqG,EAAZ,CACE,GAAsB,GAAtB,GAAIrG,CAAAmG,OAAA,CAAW,CAAX,CAAJ,EAA6B,CAAAlG,CAAA,CAAWoG,CAAA,CAAGrG,CAAH,CAAX,CAA7B,CAAA,CACA,GAAK,CAAAoG,EAAA,CAAOC,CAAA,CAAGrG,CAAH,CAAP,CAAgBsG,CAAA,CAAGtG,CAAH,CAAhB,CAAL,CAA+B,MAAO,CAAA,CACtC0G,EAAA,CAAO1G,CAAP,CAAA,CAAc,CAAA,CAFd,CAIF,IAAKA,CAAL,GAAYsG,EAAZ,CACE,GAAM,EAAAtG,CAAA,GAAO0G,EAAP,CAAN,EACsB,GADtB,GACI1G,CAAAmG,OAAA,CAAW,CAAX,CADJ,EAEI9C,CAAA,CAAUiD,CAAA,CAAGtG,CAAH,CAAV,CAFJ,EAGK,CAAAC,CAAA,CAAWqG,CAAA,CAAGtG,CAAH,CAAX,CAHL,CAG0B,MAAO,CAAA,CAEnC,OAAO,CAAA,CArBF,CAwBT,MAAO,CAAA,CAtCe,CAkIxB4G,QAASA,GAAM,CAACC,CAAD,CAASC,CAAT,CAAiBpC,CAAjB,CAAwB,CACrC,MAAOmC,EAAAD,OAAA,CAAcxE,EAAAjC,KAAA,CAAW2G,CAAX,CAAmBpC,CAAnB,CAAd,CAD8B,CA4BvCqC,QAASA,GAAI,CAACC,CAAD,CAAOC,CAAP,CAAW,CACtB,IAAIC,EAA+B,CAAnB,CAAA7E,SAAA7C,OAAA,CAxBT4C,EAAAjC,KAAA,CAwB0CkC,SAxB1C,CAwBqD8E,CAxBrD,CAwBS,CAAiD,EACjE;MAAI,CAAAlH,CAAA,CAAWgH,CAAX,CAAJ,EAAwBA,CAAxB,WAAsCnF,OAAtC,CAcSmF,CAdT,CACSC,CAAA1H,OAAA,CACH,QAAQ,EAAG,CACT,MAAO6C,UAAA7C,OAAA,CACHyH,CAAAG,MAAA,CAASJ,CAAT,CAAeJ,EAAA,CAAOM,CAAP,CAAkB7E,SAAlB,CAA6B,CAA7B,CAAf,CADG,CAEH4E,CAAAG,MAAA,CAASJ,CAAT,CAAeE,CAAf,CAHK,CADR,CAMH,QAAQ,EAAG,CACT,MAAO7E,UAAA7C,OAAA,CACHyH,CAAAG,MAAA,CAASJ,CAAT,CAAe3E,SAAf,CADG,CAEH4E,CAAA9G,KAAA,CAAQ6G,CAAR,CAHK,CATK,CAqBxBK,QAASA,GAAc,CAACrH,CAAD,CAAMY,CAAN,CAAa,CAClC,IAAI0G,EAAM1G,CAES,SAAnB,GAAI,MAAOZ,EAAX,EAAiD,GAAjD,GAA+BA,CAAAmG,OAAA,CAAW,CAAX,CAA/B,EAA0E,GAA1E,GAAwDnG,CAAAmG,OAAA,CAAW,CAAX,CAAxD,CACEmB,CADF,CACQtI,CADR,CAEWI,EAAA,CAASwB,CAAT,CAAJ,CACL0G,CADK,CACC,SADD,CAEI1G,CAAJ,EAAc7B,CAAd,GAA2B6B,CAA3B,CACL0G,CADK,CACC,WADD,CAEI/D,EAAA,CAAQ3C,CAAR,CAFJ,GAGL0G,CAHK,CAGC,QAHD,CAMP,OAAOA,EAb2B,CAgCpCC,QAASA,GAAM,CAACpI,CAAD,CAAMqI,CAAN,CAAc,CAC3B,GAAIpE,CAAA,CAAYjE,CAAZ,CAAJ,CAAsB,MAAOH,EACxBU,EAAA,CAAS8H,CAAT,CAAL,GACEA,CADF,CACWA,CAAA,CAAS,CAAT,CAAa,IADxB,CAGA,OAAOC,KAAAC,UAAA,CAAevI,CAAf,CAAoBkI,EAApB,CAAoCG,CAApC,CALoB,CAqB7BG,QAASA,GAAQ,CAACC,CAAD,CAAO,CACtB,MAAOtI,EAAA,CAASsI,CAAT,CAAA,CACDH,IAAAI,MAAA,CAAWD,CAAX,CADC,CAEDA,CAHgB,CAQxBE,QAASA,GAAgB,CAACC,CAAD,CAAWC,CAAX,CAAqB,CAE5CD,CAAA,CAAWA,CAAAE,QAAA,CAAiBC,EAAjB;AAA6B,EAA7B,CACX,KAAIC,EAA0BxG,IAAAkG,MAAA,CAAW,wBAAX,CAAsCE,CAAtC,CAA1BI,CAA4E,GAChF,OAAOC,MAAA,CAAMD,CAAN,CAAA,CAAiCH,CAAjC,CAA4CG,CAJP,CAe9CE,QAASA,GAAsB,CAACC,CAAD,CAAOP,CAAP,CAAiBQ,CAAjB,CAA0B,CACvDA,CAAA,CAAUA,CAAA,CAAW,EAAX,CAAe,CACzB,KAAIC,EAAqBF,CAAAG,kBAAA,EACrBC,EAAAA,CAAiBZ,EAAA,CAAiBC,CAAjB,CAA2BS,CAA3B,CACO,EAAA,EAAWE,CAAX,CAA4BF,CAVxDF,EAAA,CAAO,IAAI3G,IAAJ,CAUe2G,CAVN7B,QAAA,EAAT,CACP6B,EAAAK,WAAA,CAAgBL,CAAAM,WAAA,EAAhB,CAAoCC,CAApC,CASA,OAROP,EAIgD,CAWzDQ,QAASA,GAAW,CAACxE,CAAD,CAAU,CAC5BA,CAAA,CAAU/E,CAAA,CAAO+E,CAAP,CAAApC,MAAA,EACV,IAAI,CAGFoC,CAAAyE,MAAA,EAHE,CAIF,MAAOC,CAAP,CAAU,EACZ,IAAIC,EAAW1J,CAAA,CAAO,OAAP,CAAA2J,OAAA,CAAuB5E,CAAvB,CAAA6E,KAAA,EACf,IAAI,CACF,MAAO7E,EAAA,CAAQ,CAAR,CAAA8E,SAAA,GAAwBC,EAAxB,CAAyC9E,CAAA,CAAU0E,CAAV,CAAzC,CACHA,CAAAjD,MAAA,CACQ,YADR,CAAA,CACsB,CADtB,CAAAiC,QAAA,CAEU,aAFV,CAEyB,QAAQ,CAACjC,CAAD,CAAQjE,CAAR,CAAkB,CAAC,MAAO,GAAP,CAAawC,CAAA,CAAUxC,CAAV,CAAd,CAFnD,CAFF,CAKF,MAAOiH,CAAP,CAAU,CACV,MAAOzE,EAAA,CAAU0E,CAAV,CADG,CAbgB,CA8B9BK,QAASA,GAAqB,CAAC1I,CAAD,CAAQ,CACpC,GAAI,CACF,MAAO2I,mBAAA,CAAmB3I,CAAnB,CADL,CAEF,MAAOoI,CAAP,CAAU,EAHwB,CAatCQ,QAASA,GAAa,CAAYC,CAAZ,CAAsB,CAC1C,IAAItK;AAAM,EACVU,EAAA,CAAQuE,CAACqF,CAADrF,EAAa,EAAbA,OAAA,CAAuB,GAAvB,CAAR,CAAqC,QAAQ,CAACqF,CAAD,CAAW,CAAA,IAClDC,CADkD,CACtC1J,CADsC,CACjCsH,CACjBmC,EAAJ,GACEzJ,CAOA,CAPMyJ,CAON,CAPiBA,CAAAxB,QAAA,CAAiB,KAAjB,CAAuB,KAAvB,CAOjB,CANAyB,CAMA,CANaD,CAAA9E,QAAA,CAAiB,GAAjB,CAMb,CALoB,EAKpB,GALI+E,CAKJ,GAJE1J,CACA,CADMyJ,CAAAE,UAAA,CAAmB,CAAnB,CAAsBD,CAAtB,CACN,CAAApC,CAAA,CAAMmC,CAAAE,UAAA,CAAmBD,CAAnB,CAAgC,CAAhC,CAGR,EADA1J,CACA,CADMsJ,EAAA,CAAsBtJ,CAAtB,CACN,CAAIqD,CAAA,CAAUrD,CAAV,CAAJ,GACEsH,CACA,CADMjE,CAAA,CAAUiE,CAAV,CAAA,CAAiBgC,EAAA,CAAsBhC,CAAtB,CAAjB,CAA8C,CAAA,CACpD,CAAKpH,EAAAC,KAAA,CAAoBhB,CAApB,CAAyBa,CAAzB,CAAL,CAEWX,CAAA,CAAQF,CAAA,CAAIa,CAAJ,CAAR,CAAJ,CACLb,CAAA,CAAIa,CAAJ,CAAAiF,KAAA,CAAcqC,CAAd,CADK,CAGLnI,CAAA,CAAIa,CAAJ,CAHK,CAGM,CAACb,CAAA,CAAIa,CAAJ,CAAD,CAAUsH,CAAV,CALb,CACEnI,CAAA,CAAIa,CAAJ,CADF,CACasH,CAHf,CARF,CAFsD,CAAxD,CAsBA,OAAOnI,EAxBmC,CA2B5CyK,QAASA,GAAU,CAACzK,CAAD,CAAM,CACvB,IAAI0K,EAAQ,EACZhK,EAAA,CAAQV,CAAR,CAAa,QAAQ,CAACyB,CAAD,CAAQZ,CAAR,CAAa,CAC5BX,CAAA,CAAQuB,CAAR,CAAJ,CACEf,CAAA,CAAQe,CAAR,CAAe,QAAQ,CAACkJ,CAAD,CAAa,CAClCD,CAAA5E,KAAA,CAAW8E,EAAA,CAAe/J,CAAf,CAAoB,CAAA,CAApB,CAAX,EAC2B,CAAA,CAAf,GAAA8J,CAAA,CAAsB,EAAtB,CAA2B,GAA3B,CAAiCC,EAAA,CAAeD,CAAf,CAA2B,CAAA,CAA3B,CAD7C,EADkC,CAApC,CADF,CAMAD,CAAA5E,KAAA,CAAW8E,EAAA,CAAe/J,CAAf,CAAoB,CAAA,CAApB,CAAX,EACsB,CAAA,CAAV,GAAAY,CAAA,CAAiB,EAAjB,CAAsB,GAAtB,CAA4BmJ,EAAA,CAAenJ,CAAf,CAAsB,CAAA,CAAtB,CADxC,EAPgC,CAAlC,CAWA,OAAOiJ,EAAArK,OAAA,CAAeqK,CAAAG,KAAA,CAAW,GAAX,CAAf,CAAiC,EAbjB,CA4BzBC,QAASA,GAAgB,CAAC3C,CAAD,CAAM,CAC7B,MAAOyC,GAAA,CAAezC,CAAf,CAAoB,CAAA,CAApB,CAAAW,QAAA,CACY,OADZ,CACqB,GADrB,CAAAA,QAAA,CAEY,OAFZ,CAEqB,GAFrB,CAAAA,QAAA,CAGY,OAHZ;AAGqB,GAHrB,CADsB,CAmB/B8B,QAASA,GAAc,CAACzC,CAAD,CAAM4C,CAAN,CAAuB,CAC5C,MAAOC,mBAAA,CAAmB7C,CAAnB,CAAAW,QAAA,CACY,OADZ,CACqB,GADrB,CAAAA,QAAA,CAEY,OAFZ,CAEqB,GAFrB,CAAAA,QAAA,CAGY,MAHZ,CAGoB,GAHpB,CAAAA,QAAA,CAIY,OAJZ,CAIqB,GAJrB,CAAAA,QAAA,CAKY,OALZ,CAKqB,GALrB,CAAAA,QAAA,CAMY,MANZ,CAMqBiC,CAAA,CAAkB,KAAlB,CAA0B,GAN/C,CADqC,CAY9CE,QAASA,GAAc,CAAC9F,CAAD,CAAU+F,CAAV,CAAkB,CAAA,IACnCrG,CADmC,CAC7BvD,CAD6B,CAC1BY,EAAKiJ,EAAA9K,OAClB,KAAKiB,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgBY,CAAhB,CAAoB,EAAEZ,CAAtB,CAEE,GADAuD,CACI,CADGsG,EAAA,CAAe7J,CAAf,CACH,CADuB4J,CACvB,CAAA/K,CAAA,CAAS0E,CAAT,CAAgBM,CAAAiG,aAAA,CAAqBvG,CAArB,CAAhB,CAAJ,CACE,MAAOA,EAGX,OAAO,KARgC,CA0IzCwG,QAASA,GAAW,CAAClG,CAAD,CAAUmG,CAAV,CAAqB,CAAA,IACnCC,CADmC,CAEnCC,CAFmC,CAGnCC,EAAS,EAGb/K,EAAA,CAAQyK,EAAR,CAAwB,QAAQ,CAACO,CAAD,CAAS,CACnCC,CAAAA,EAAgB,KAEfJ,EAAAA,CAAL,EAAmBpG,CAAAyG,aAAnB,EAA2CzG,CAAAyG,aAAA,CAAqBD,CAArB,CAA3C,GACEJ,CACA,CADapG,CACb,CAAAqG,CAAA,CAASrG,CAAAiG,aAAA,CAAqBO,CAArB,CAFX,CAHuC,CAAzC,CAQAjL,EAAA,CAAQyK,EAAR,CAAwB,QAAQ,CAACO,CAAD,CAAS,CACnCC,CAAAA,EAAgB,KACpB,KAAIE,CAECN,EAAAA,CAAL,GAAoBM,CAApB,CAAgC1G,CAAA2G,cAAA,CAAsB,GAAtB,CAA4BH,CAAA7C,QAAA,CAAa,GAAb,CAAkB,KAAlB,CAA5B,CAAuD,GAAvD,CAAhC;CACEyC,CACA,CADaM,CACb,CAAAL,CAAA,CAASK,CAAAT,aAAA,CAAuBO,CAAvB,CAFX,CAJuC,CAAzC,CASIJ,EAAJ,GACEE,CAAAM,SACA,CAD8D,IAC9D,GADkBd,EAAA,CAAeM,CAAf,CAA2B,WAA3B,CAClB,CAAAD,CAAA,CAAUC,CAAV,CAAsBC,CAAA,CAAS,CAACA,CAAD,CAAT,CAAoB,EAA1C,CAA8CC,CAA9C,CAFF,CAvBuC,CA+EzCH,QAASA,GAAS,CAACnG,CAAD,CAAU6G,CAAV,CAAmBP,CAAnB,CAA2B,CACtCtJ,CAAA,CAASsJ,CAAT,CAAL,GAAuBA,CAAvB,CAAgC,EAAhC,CAIAA,EAAA,CAASzI,CAAA,CAHWiJ,CAClBF,SAAU,CAAA,CADQE,CAGX,CAAsBR,CAAtB,CACT,KAAIS,EAAcA,QAAQ,EAAG,CAC3B/G,CAAA,CAAU/E,CAAA,CAAO+E,CAAP,CAEV,IAAIA,CAAAgH,SAAA,EAAJ,CAAwB,CACtB,IAAIC,EAAOjH,CAAA,CAAQ,CAAR,CAAD,GAAgBvF,CAAhB,CAA4B,UAA5B,CAAyC+J,EAAA,CAAYxE,CAAZ,CAEnD,MAAMe,GAAA,CACF,SADE,CAGFkG,CAAAtD,QAAA,CAAY,GAAZ,CAAgB,MAAhB,CAAAA,QAAA,CAAgC,GAAhC,CAAoC,MAApC,CAHE,CAAN,CAHsB,CASxBkD,CAAA,CAAUA,CAAV,EAAqB,EACrBA,EAAAK,QAAA,CAAgB,CAAC,UAAD,CAAa,QAAQ,CAACC,CAAD,CAAW,CAC9CA,CAAA7K,MAAA,CAAe,cAAf,CAA+B0D,CAA/B,CAD8C,CAAhC,CAAhB,CAIIsG,EAAAc,iBAAJ,EAEEP,CAAAlG,KAAA,CAAa,CAAC,kBAAD,CAAqB,QAAQ,CAAC0G,CAAD,CAAmB,CAC3DA,CAAAD,iBAAA,CAAkC,CAAA,CAAlC,CAD2D,CAAhD,CAAb,CAKFP,EAAAK,QAAA,CAAgB,IAAhB,CACIF,EAAAA,CAAWM,EAAA,CAAeT,CAAf,CAAwBP,CAAAM,SAAxB,CACfI,EAAAO,OAAA,CAAgB,CAAC,YAAD,CAAe,cAAf;AAA+B,UAA/B,CAA2C,WAA3C,CACbC,QAAuB,CAACC,CAAD,CAAQzH,CAAR,CAAiB0H,CAAjB,CAA0BV,CAA1B,CAAoC,CAC1DS,CAAAE,OAAA,CAAa,QAAQ,EAAG,CACtB3H,CAAA4H,KAAA,CAAa,WAAb,CAA0BZ,CAA1B,CACAU,EAAA,CAAQ1H,CAAR,CAAA,CAAiByH,CAAjB,CAFsB,CAAxB,CAD0D,CAD9C,CAAhB,CAQA,OAAOT,EAlCoB,CAA7B,CAqCIa,EAAuB,wBArC3B,CAsCIC,EAAqB,sBAErBtN,EAAJ,EAAcqN,CAAAtI,KAAA,CAA0B/E,CAAAgM,KAA1B,CAAd,GACEF,CAAAc,iBACA,CAD0B,CAAA,CAC1B,CAAA5M,CAAAgM,KAAA,CAAchM,CAAAgM,KAAA7C,QAAA,CAAoBkE,CAApB,CAA0C,EAA1C,CAFhB,CAKA,IAAIrN,CAAJ,EAAe,CAAAsN,CAAAvI,KAAA,CAAwB/E,CAAAgM,KAAxB,CAAf,CACE,MAAOO,EAAA,EAGTvM,EAAAgM,KAAA,CAAchM,CAAAgM,KAAA7C,QAAA,CAAoBmE,CAApB,CAAwC,EAAxC,CACdC,GAAAC,gBAAA,CAA0BC,QAAQ,CAACC,CAAD,CAAe,CAC/C3M,CAAA,CAAQ2M,CAAR,CAAsB,QAAQ,CAAC7B,CAAD,CAAS,CACrCQ,CAAAlG,KAAA,CAAa0F,CAAb,CADqC,CAAvC,CAGA,OAAOU,EAAA,EAJwC,CAO7CpL,EAAA,CAAWoM,EAAAI,wBAAX,CAAJ,EACEJ,EAAAI,wBAAA,EAhEyC,CA8E7CC,QAASA,GAAmB,EAAG,CAC7B5N,CAAAgM,KAAA,CAAc,uBAAd,CAAwChM,CAAAgM,KACxChM,EAAA6N,SAAAC,OAAA,EAF6B,CAa/BC,QAASA,GAAc,CAACC,CAAD,CAAc,CAC/BxB,CAAAA;AAAWe,EAAA/H,QAAA,CAAgBwI,CAAhB,CAAAxB,SAAA,EACf,IAAKA,CAAAA,CAAL,CACE,KAAMjG,GAAA,CAAS,MAAT,CAAN,CAGF,MAAOiG,EAAAyB,IAAA,CAAa,eAAb,CAN4B,CAUrCC,QAASA,GAAU,CAAClC,CAAD,CAAOmC,CAAP,CAAkB,CACnCA,CAAA,CAAYA,CAAZ,EAAyB,GACzB,OAAOnC,EAAA7C,QAAA,CAAaiF,EAAb,CAAgC,QAAQ,CAACC,CAAD,CAASC,CAAT,CAAc,CAC3D,OAAQA,CAAA,CAAMH,CAAN,CAAkB,EAA1B,EAAgCE,CAAAE,YAAA,EAD2B,CAAtD,CAF4B,CAQrCC,QAASA,GAAU,EAAG,CACpB,IAAIC,CAEJ,IAAIC,CAAAA,EAAJ,CAAA,CAKA,IAAIC,EAASC,EAAA,EASb,EARAC,EAQA,CARSvK,CAAA,CAAYqK,CAAZ,CAAA,CAAsB3O,CAAA6O,OAAtB,CACCF,CAAD,CACsB3O,CAAA,CAAO2O,CAAP,CADtB,CAAsBzO,CAO/B,GAAc2O,EAAA1G,GAAA2G,GAAd,EACErO,CAaA,CAbSoO,EAaT,CAZAxL,CAAA,CAAOwL,EAAA1G,GAAP,CAAkB,CAChB8E,MAAO8B,EAAA9B,MADS,CAEhB+B,aAAcD,EAAAC,aAFE,CAGhBC,WAAYF,EAAAE,WAHI,CAIhBzC,SAAUuC,EAAAvC,SAJM,CAKhB0C,cAAeH,EAAAG,cALC,CAAlB,CAYA,CADAT,CACA,CADoBI,EAAAM,UACpB,CAAAN,EAAAM,UAAA,CAAmBC,QAAQ,CAACC,CAAD,CAAQ,CAEjC,IADA,IAAIC,CAAJ,CACS3N,EAAI,CADb,CACgB4N,CAAhB,CAA2C,IAA3C,GAAuBA,CAAvB,CAA8BF,CAAA,CAAM1N,CAAN,CAA9B,EAAiDA,CAAA,EAAjD,CAEE,CADA2N,CACA,CADST,EAAAW,MAAA,CAAaD,CAAb,CAAmB,QAAnB,CACT,GAAcD,CAAAG,SAAd,EACEZ,EAAA,CAAOU,CAAP,CAAAG,eAAA,CAA4B,UAA5B,CAGJjB;CAAA,CAAkBY,CAAlB,CARiC,CAdrC,EAyBE5O,CAzBF,CAyBWkP,CAGXpC,GAAA/H,QAAA,CAAkB/E,CAGlBiO,GAAA,CAAkB,CAAA,CA7ClB,CAHoB,CAsDtBkB,QAASA,GAAS,CAACC,CAAD,CAAM7D,CAAN,CAAY8D,CAAZ,CAAoB,CACpC,GAAKD,CAAAA,CAAL,CACE,KAAMtJ,GAAA,CAAS,MAAT,CAA2CyF,CAA3C,EAAmD,GAAnD,CAA0D8D,CAA1D,EAAoE,UAApE,CAAN,CAEF,MAAOD,EAJ6B,CAOtCE,QAASA,GAAW,CAACF,CAAD,CAAM7D,CAAN,CAAYgE,CAAZ,CAAmC,CACjDA,CAAJ,EAA6BzP,CAAA,CAAQsP,CAAR,CAA7B,GACIA,CADJ,CACUA,CAAA,CAAIA,CAAAnP,OAAJ,CAAiB,CAAjB,CADV,CAIAkP,GAAA,CAAUzO,CAAA,CAAW0O,CAAX,CAAV,CAA2B7D,CAA3B,CAAiC,sBAAjC,EACK6D,CAAA,EAAsB,QAAtB,GAAO,MAAOA,EAAd,CAAiCA,CAAAnJ,YAAAsF,KAAjC,EAAyD,QAAzD,CAAoE,MAAO6D,EADhF,EAEA,OAAOA,EAP8C,CAevDI,QAASA,GAAuB,CAACjE,CAAD,CAAO/K,CAAP,CAAgB,CAC9C,GAAa,gBAAb,GAAI+K,CAAJ,CACE,KAAMzF,GAAA,CAAS,SAAT,CAA8DtF,CAA9D,CAAN,CAF4C,CAchDiP,QAASA,GAAM,CAAC7P,CAAD,CAAM8P,CAAN,CAAYC,CAAZ,CAA2B,CACxC,GAAKD,CAAAA,CAAL,CAAW,MAAO9P,EACdoB,EAAAA,CAAO0O,CAAA7K,MAAA,CAAW,GAAX,CAKX,KAJA,IAAIpE,CAAJ,CACImP,EAAehQ,CADnB,CAEIiQ,EAAM7O,CAAAf,OAFV,CAISiB,EAAI,CAAb,CAAgBA,CAAhB,CAAoB2O,CAApB,CAAyB3O,CAAA,EAAzB,CACET,CACA,CADMO,CAAA,CAAKE,CAAL,CACN,CAAItB,CAAJ,GACEA,CADF,CACQ,CAACgQ,CAAD,CAAgBhQ,CAAhB,EAAqBa,CAArB,CADR,CAIF,OAAKkP,CAAAA,CAAL,EAAsBjP,CAAA,CAAWd,CAAX,CAAtB,CACS4H,EAAA,CAAKoI,CAAL,CAAmBhQ,CAAnB,CADT,CAGOA,CAhBiC,CAwB1CkQ,QAASA,GAAa,CAACC,CAAD,CAAQ,CAM5B,IAJA,IAAIxL,EAAOwL,CAAA,CAAM,CAAN,CAAX,CACIC,EAAUD,CAAA,CAAMA,CAAA9P,OAAN,CAAqB,CAArB,CADd,CAEIgQ,CAFJ;AAIS/O,EAAI,CAAb,CAAgBqD,CAAhB,GAAyByL,CAAzB,GAAqCzL,CAArC,CAA4CA,CAAA2L,YAA5C,EAA+DhP,CAAA,EAA/D,CACE,GAAI+O,CAAJ,EAAkBF,CAAA,CAAM7O,CAAN,CAAlB,GAA+BqD,CAA/B,CACO0L,CAGL,GAFEA,CAEF,CAFejQ,CAAA,CAAO6C,EAAAjC,KAAA,CAAWmP,CAAX,CAAkB,CAAlB,CAAqB7O,CAArB,CAAP,CAEf,EAAA+O,CAAAvK,KAAA,CAAgBnB,CAAhB,CAIJ,OAAO0L,EAAP,EAAqBF,CAfO,CA8B9B3I,QAASA,EAAS,EAAG,CACnB,MAAOlH,OAAAoD,OAAA,CAAc,IAAd,CADY,CAoBrB6M,QAASA,GAAiB,CAAC5Q,CAAD,CAAS,CAKjC6Q,QAASA,EAAM,CAACxQ,CAAD,CAAM2L,CAAN,CAAY8E,CAAZ,CAAqB,CAClC,MAAOzQ,EAAA,CAAI2L,CAAJ,CAAP,GAAqB3L,CAAA,CAAI2L,CAAJ,CAArB,CAAiC8E,CAAA,EAAjC,CADkC,CAHpC,IAAIC,EAAkB5Q,CAAA,CAAO,WAAP,CAAtB,CACIoG,EAAWpG,CAAA,CAAO,IAAP,CAMXoN,EAAAA,CAAUsD,CAAA,CAAO7Q,CAAP,CAAe,SAAf,CAA0BW,MAA1B,CAGd4M,EAAAyD,SAAA,CAAmBzD,CAAAyD,SAAnB,EAAuC7Q,CAEvC,OAAO0Q,EAAA,CAAOtD,CAAP,CAAgB,QAAhB,CAA0B,QAAQ,EAAG,CAE1C,IAAIlB,EAAU,EAqDd,OAAOR,SAAe,CAACG,CAAD,CAAOiF,CAAP,CAAiBC,CAAjB,CAA2B,CAE7C,GAAa,gBAAb,GAKsBlF,CALtB,CACE,KAAMzF,EAAA,CAAS,SAAT,CAIoBtF,QAJpB,CAAN,CAKAgQ,CAAJ,EAAgB5E,CAAAjL,eAAA,CAAuB4K,CAAvB,CAAhB,GACEK,CAAA,CAAQL,CAAR,CADF,CACkB,IADlB,CAGA,OAAO6E,EAAA,CAAOxE,CAAP,CAAgBL,CAAhB,CAAsB,QAAQ,EAAG,CAuPtCmF,QAASA,EAAW,CAACC,CAAD,CAAWC,CAAX,CAAmBC,CAAnB,CAAiCC,CAAjC,CAAwC,CACrDA,CAAL,GAAYA,CAAZ,CAAoBC,CAApB,CACA,OAAO,SAAQ,EAAG,CAChBD,CAAA,CAAMD,CAAN,EAAsB,MAAtB,CAAA,CAA8B,CAACF,CAAD;AAAWC,CAAX,CAAmB9N,SAAnB,CAA9B,CACA,OAAOkO,EAFS,CAFwC,CAa5DC,QAASA,EAA2B,CAACN,CAAD,CAAWC,CAAX,CAAmB,CACrD,MAAO,SAAQ,CAACM,CAAD,CAAaC,CAAb,CAA8B,CACvCA,CAAJ,EAAuBzQ,CAAA,CAAWyQ,CAAX,CAAvB,GAAoDA,CAAAC,aAApD,CAAmF7F,CAAnF,CACAwF,EAAArL,KAAA,CAAiB,CAACiL,CAAD,CAAWC,CAAX,CAAmB9N,SAAnB,CAAjB,CACA,OAAOkO,EAHoC,CADQ,CAnQvD,GAAKR,CAAAA,CAAL,CACE,KAAMF,EAAA,CAAgB,OAAhB,CAEiD/E,CAFjD,CAAN,CAMF,IAAIwF,EAAc,EAAlB,CAGIM,EAAe,EAHnB,CAMIC,EAAY,EANhB,CAQIjG,EAASqF,CAAA,CAAY,WAAZ,CAAyB,QAAzB,CAAmC,MAAnC,CAA2CW,CAA3C,CARb,CAWIL,EAAiB,CAEnBO,aAAcR,CAFK,CAGnBS,cAAeH,CAHI,CAInBI,WAAYH,CAJO,CAenBd,SAAUA,CAfS,CAyBnBjF,KAAMA,CAzBa,CAsCnBoF,SAAUM,CAAA,CAA4B,UAA5B,CAAwC,UAAxC,CAtCS,CAiDnBZ,QAASY,CAAA,CAA4B,UAA5B,CAAwC,SAAxC,CAjDU,CA4DnBS,QAAST,CAAA,CAA4B,UAA5B,CAAwC,SAAxC,CA5DU,CAuEnB5P,MAAOqP,CAAA,CAAY,UAAZ,CAAwB,OAAxB,CAvEY,CAmFnBiB,SAAUjB,CAAA,CAAY,UAAZ,CAAwB,UAAxB,CAAoC,SAApC,CAnFS,CA+FnBkB,UAAWX,CAAA,CAA4B,UAA5B,CAAwC,WAAxC,CA/FQ,CAiInBY,UAAWZ,CAAA,CAA4B,kBAA5B;AAAgD,UAAhD,CAjIQ,CAmJnBa,OAAQb,CAAA,CAA4B,iBAA5B,CAA+C,UAA/C,CAnJW,CA+JnBzC,WAAYyC,CAAA,CAA4B,qBAA5B,CAAmD,UAAnD,CA/JO,CA4KnBc,UAAWd,CAAA,CAA4B,kBAA5B,CAAgD,WAAhD,CA5KQ,CAyLnBe,UAAWf,CAAA,CAA4B,kBAA5B,CAAgD,WAAhD,CAzLQ,CAsMnB5F,OAAQA,CAtMW,CAkNnB4G,IAAKA,QAAQ,CAACC,CAAD,CAAQ,CACnBZ,CAAA5L,KAAA,CAAewM,CAAf,CACA,OAAO,KAFY,CAlNF,CAwNjBzB,EAAJ,EACEpF,CAAA,CAAOoF,CAAP,CAGF,OAAOO,EA/O+B,CAAjC,CAXwC,CAvDP,CAArC,CAd0B,CAsfnCmB,QAASA,GAAkB,CAACrF,CAAD,CAAU,CACnClK,CAAA,CAAOkK,CAAP,CAAgB,CACd,UAAa5B,EADC,CAEd,KAAQ5F,EAFM,CAGd,OAAU1C,CAHI,CAId,MAASG,EAJK,CAKd,OAAU8D,EALI,CAMd,QAAW7G,CANG,CAOd,QAAWM,CAPG,CAQd,SAAY+L,EARE,CASd,KAAQ9I,CATM,CAUd,KAAQiE,EAVM,CAWd,OAAUQ,EAXI,CAYd,SAAYI,EAZE,CAad,SAAY5E,EAbE,CAcd,YAAeK,CAdD,CAed,UAAaC,CAfC,CAgBd,SAAY/D,CAhBE,CAiBd,WAAcW,CAjBA,CAkBd,SAAYqB,CAlBE,CAmBd,SAAY5B,CAnBE,CAoBd,UAAauC,EApBC,CAqBd,QAAW5C,CArBG;AAsBd,QAAWsS,EAtBG,CAuBd,OAAUjQ,CAvBI,CAwBd,UAAa6C,CAxBC,CAyBd,UAAaqN,EAzBC,CA0Bd,UAAa,CAACC,QAAS,CAAV,CA1BC,CA2Bd,eAAkBhF,EA3BJ,CA4Bd,SAAY5N,CA5BE,CA6Bd,MAAS6S,EA7BK,CA8Bd,oBAAuBpF,EA9BT,CAAhB,CAiCAqF,GAAA,CAAgBrC,EAAA,CAAkB5Q,CAAlB,CAEhBiT,GAAA,CAAc,IAAd,CAAoB,CAAC,UAAD,CAApB,CAAkC,CAAC,UAAD,CAChCC,QAAiB,CAACvG,CAAD,CAAW,CAE1BA,CAAAyE,SAAA,CAAkB,CAChB+B,cAAeC,EADC,CAAlB,CAGAzG,EAAAyE,SAAA,CAAkB,UAAlB,CAA8BiC,EAA9B,CAAAb,UAAA,CACY,CACNc,EAAGC,EADG,CAENC,MAAOC,EAFD,CAGNC,SAAUD,EAHJ,CAINE,KAAMC,EAJA,CAKNC,OAAQC,EALF,CAMNC,OAAQC,EANF,CAONC,MAAOC,EAPD,CAQNC,OAAQC,EARF,CASNC,OAAQC,EATF,CAUNC,WAAYC,EAVN,CAWNC,eAAgBC,EAXV,CAYNC,QAASC,EAZH,CAaNC,YAAaC,EAbP,CAcNC,WAAYC,EAdN,CAeNC,QAASC,EAfH,CAgBNC,aAAcC,EAhBR,CAiBNC,OAAQC,EAjBF,CAkBNC,OAAQC,EAlBF,CAmBNC,KAAMC,EAnBA,CAoBNC,UAAWC,EApBL,CAqBNC,OAAQC,EArBF,CAsBNC,cAAeC,EAtBT;AAuBNC,YAAaC,EAvBP,CAwBNC,SAAUC,EAxBJ,CAyBNC,OAAQC,EAzBF,CA0BNC,QAASC,EA1BH,CA2BNC,SAAUC,EA3BJ,CA4BNC,aAAcC,EA5BR,CA6BNC,gBAAiBC,EA7BX,CA8BNC,UAAWC,EA9BL,CA+BNC,aAAcC,EA/BR,CAgCNC,QAASC,EAhCH,CAiCNC,OAAQC,EAjCF,CAkCNC,SAAUC,EAlCJ,CAmCNC,QAASC,EAnCH,CAoCNC,UAAWD,EApCL,CAqCNE,SAAUC,EArCJ,CAsCNC,WAAYD,EAtCN,CAuCNE,UAAWC,EAvCL,CAwCNC,YAAaD,EAxCP,CAyCNE,UAAWC,EAzCL,CA0CNC,YAAaD,EA1CP,CA2CNE,QAASC,EA3CH,CA4CNC,eAAgBC,EA5CV,CADZ,CAAAhG,UAAA,CA+CY,CACRmD,UAAW8C,EADH,CA/CZ,CAAAjG,UAAA,CAkDYkG,EAlDZ,CAAAlG,UAAA,CAmDYmG,EAnDZ,CAoDAhM,EAAAyE,SAAA,CAAkB,CAChBwH,cAAeC,EADC,CAEhBC,SAAUC,EAFM,CAGhBC,YAAaC,EAHG,CAIhBC,YAAaC,EAJG,CAKhBC,eAAgBC,EALA,CAMhBC,gBAAiBC,EAND,CAOhBC,kBAAmBC,EAPH,CAQhBC,SAAUC,EARM,CAShBC,cAAeC,EATC;AAUhBC,YAAaC,EAVG,CAWhBC,UAAWC,EAXK,CAYhBC,kBAAmBC,EAZH,CAahBC,QAASC,EAbO,CAchBC,cAAeC,EAdC,CAehBC,aAAcC,EAfE,CAgBhBC,UAAWC,EAhBK,CAiBhBC,MAAOC,EAjBS,CAkBhBC,qBAAsBC,EAlBN,CAmBhBC,2BAA4BC,EAnBZ,CAoBhBC,aAAcC,EApBE,CAqBhBC,YAAaC,EArBG,CAsBhBC,UAAWC,EAtBK,CAuBhBC,KAAMC,EAvBU,CAwBhBC,OAAQC,EAxBQ,CAyBhBC,WAAYC,EAzBI,CA0BhBC,GAAIC,EA1BY,CA2BhBC,IAAKC,EA3BW,CA4BhBC,KAAMC,EA5BU,CA6BhBC,aAAcC,EA7BE,CA8BhBC,SAAUC,EA9BM,CA+BhBC,eAAgBC,EA/BA,CAgChBC,iBAAkBC,EAhCF,CAiChBC,cAAeC,EAjCC,CAkChBC,SAAUC,EAlCM,CAmChBC,QAASC,EAnCO,CAoChBC,MAAOC,EApCS,CAqChBC,SAAUC,EArCM,CAsChBC,UAAWC,EAtCK,CAuChBC,eAAgBC,EAvCA,CAAlB,CAzD0B,CADI,CAAlC,CApCmC,CAiSrCC,QAASA,GAAS,CAAC1R,CAAD,CAAO,CACvB,MAAOA,EAAA7C,QAAA,CACGwU,EADH,CACyB,QAAQ,CAACC,CAAD,CAAIzP,CAAJ,CAAeE,CAAf,CAAuBwP,CAAvB,CAA+B,CACnE,MAAOA,EAAA,CAASxP,CAAAyP,YAAA,EAAT;AAAgCzP,CAD4B,CADhE,CAAAlF,QAAA,CAIG4U,EAJH,CAIoB,OAJpB,CADgB,CAgCzBC,QAASA,GAAiB,CAAChZ,CAAD,CAAO,CAG3BsF,CAAAA,CAAWtF,CAAAsF,SACf,OA30BsB2T,EA20BtB,GAAO3T,CAAP,EAAyC,CAACA,CAA1C,EAv0BuB4T,CAu0BvB,GAAsD5T,CAJvB,CAoBjC6T,QAASA,GAAmB,CAAC9T,CAAD,CAAOpJ,CAAP,CAAgB,CAAA,IACtCmd,CADsC,CACjC3R,CADiC,CAEtC4R,EAAWpd,CAAAqd,uBAAA,EAF2B,CAGtC9N,EAAQ,EAEZ,IA5BQ+N,EAAAxZ,KAAA,CA4BasF,CA5Bb,CA4BR,CAGO,CAEL+T,CAAA,CAAMA,CAAN,EAAaC,CAAAG,YAAA,CAAqBvd,CAAAwd,cAAA,CAAsB,KAAtB,CAArB,CACbhS,EAAA,CAAM,CAACiS,EAAAC,KAAA,CAAqBtU,CAArB,CAAD,EAA+B,CAAC,EAAD,CAAK,EAAL,CAA/B,EAAyC,CAAzC,CAAAkE,YAAA,EACNqQ,EAAA,CAAOC,EAAA,CAAQpS,CAAR,CAAP,EAAuBoS,EAAAC,SACvBV,EAAAW,UAAA,CAAgBH,CAAA,CAAK,CAAL,CAAhB,CAA0BvU,CAAAlB,QAAA,CAAa6V,EAAb,CAA+B,WAA/B,CAA1B,CAAwEJ,CAAA,CAAK,CAAL,CAIxE,KADAjd,CACA,CADIid,CAAA,CAAK,CAAL,CACJ,CAAOjd,CAAA,EAAP,CAAA,CACEyc,CAAA,CAAMA,CAAAa,UAGRzO,EAAA,CAAQ1I,EAAA,CAAO0I,CAAP,CAAc4N,CAAAc,WAAd,CAERd,EAAA,CAAMC,CAAAc,WACNf,EAAAgB,YAAA,CAAkB,EAhBb,CAHP,IAEE5O,EAAArK,KAAA,CAAWlF,CAAAoe,eAAA,CAAuBhV,CAAvB,CAAX,CAqBFgU,EAAAe,YAAA,CAAuB,EACvBf,EAAAU,UAAA,CAAqB,EACrBhe,EAAA,CAAQyP,CAAR,CAAe,QAAQ,CAACxL,CAAD,CAAO,CAC5BqZ,CAAAG,YAAA,CAAqBxZ,CAArB,CAD4B,CAA9B,CAIA,OAAOqZ,EAlCmC,CAoD5CiB,QAASA,GAAc,CAACta,CAAD;AAAOua,CAAP,CAAgB,CACrC,IAAI1b,EAASmB,CAAAwa,WAET3b,EAAJ,EACEA,CAAA4b,aAAA,CAAoBF,CAApB,CAA6Bva,CAA7B,CAGFua,EAAAf,YAAA,CAAoBxZ,CAApB,CAPqC,CAmBvC2K,QAASA,EAAM,CAACnK,CAAD,CAAU,CACvB,GAAIA,CAAJ,WAAuBmK,EAAvB,CACE,MAAOnK,EAGT,KAAIka,CAEAlf,EAAA,CAASgF,CAAT,CAAJ,GACEA,CACA,CADUma,CAAA,CAAKna,CAAL,CACV,CAAAka,CAAA,CAAc,CAAA,CAFhB,CAIA,IAAM,EAAA,IAAA,WAAgB/P,EAAhB,CAAN,CAA+B,CAC7B,GAAI+P,CAAJ,EAAwC,GAAxC,EAAmBla,CAAA6B,OAAA,CAAe,CAAf,CAAnB,CACE,KAAMuY,GAAA,CAAa,OAAb,CAAN,CAEF,MAAO,KAAIjQ,CAAJ,CAAWnK,CAAX,CAJsB,CAO/B,GAAIka,CAAJ,CAAiB,CAnDjBze,CAAA,CAAqBhB,CACrB,KAAI4f,CAGF,EAAA,CADF,CAAKA,CAAL,CAAcC,EAAAnB,KAAA,CAAuBtU,CAAvB,CAAd,EACS,CAACpJ,CAAAwd,cAAA,CAAsBoB,CAAA,CAAO,CAAP,CAAtB,CAAD,CADT,CAIA,CAAKA,CAAL,CAAc1B,EAAA,CAAoB9T,CAApB,CAA0BpJ,CAA1B,CAAd,EACS4e,CAAAX,WADT,CAIO,EAwCU,CACfa,EAAA,CAAe,IAAf,CAAqB,CAArB,CAnBqB,CAyBzBC,QAASA,GAAW,CAACxa,CAAD,CAAU,CAC5B,MAAOA,EAAAtC,UAAA,CAAkB,CAAA,CAAlB,CADqB,CAI9B+c,QAASA,GAAY,CAACza,CAAD,CAAU0a,CAAV,CAA2B,CACzCA,CAAL,EAAsBC,EAAA,CAAiB3a,CAAjB,CAEtB,IAAIA,CAAA4a,iBAAJ,CAEE,IADA,IAAIC,EAAc7a,CAAA4a,iBAAA,CAAyB,GAAzB,CAAlB,CACSze,EAAI,CADb,CACgB2e,EAAID,CAAA3f,OAApB,CAAwCiB,CAAxC,CAA4C2e,CAA5C,CAA+C3e,CAAA,EAA/C,CACEwe,EAAA,CAAiBE,CAAA,CAAY1e,CAAZ,CAAjB,CAN0C,CAWhD4e,QAASA,GAAS,CAAC/a,CAAD,CAAUgb,CAAV,CAAgBrY,CAAhB,CAAoBsY,CAApB,CAAiC,CACjD,GAAIlc,CAAA,CAAUkc,CAAV,CAAJ,CAA4B,KAAMb,GAAA,CAAa,SAAb,CAAN;AAG5B,IAAItQ,GADAoR,CACApR,CADeqR,EAAA,CAAmBnb,CAAnB,CACf8J,GAAyBoR,CAAApR,OAA7B,CACIsR,EAASF,CAATE,EAAyBF,CAAAE,OAE7B,IAAKA,CAAL,CAEA,GAAKJ,CAAL,CAOO,CAEL,IAAIK,EAAgBA,QAAQ,CAACL,CAAD,CAAO,CACjC,IAAIM,EAAcxR,CAAA,CAAOkR,CAAP,CACdjc,EAAA,CAAU4D,CAAV,CAAJ,EACEzC,EAAA,CAAYob,CAAZ,EAA2B,EAA3B,CAA+B3Y,CAA/B,CAEI5D,EAAA,CAAU4D,CAAV,CAAN,EAAuB2Y,CAAvB,EAA2D,CAA3D,CAAsCA,CAAApgB,OAAtC,GACwB8E,CAnNxBub,oBAAA,CAmNiCP,CAnNjC,CAmNuCI,CAnNvC,CAAsC,CAAA,CAAtC,CAoNE,CAAA,OAAOtR,CAAA,CAAOkR,CAAP,CAFT,CALiC,CAWnCzf,EAAA,CAAQyf,CAAAlb,MAAA,CAAW,GAAX,CAAR,CAAyB,QAAQ,CAACkb,CAAD,CAAO,CACtCK,CAAA,CAAcL,CAAd,CACIQ,GAAA,CAAgBR,CAAhB,CAAJ,EACEK,CAAA,CAAcG,EAAA,CAAgBR,CAAhB,CAAd,CAHoC,CAAxC,CAbK,CAPP,IACE,KAAKA,CAAL,GAAalR,EAAb,CACe,UAGb,GAHIkR,CAGJ,EAFwBhb,CAvMxBub,oBAAA,CAuMiCP,CAvMjC,CAuMuCI,CAvMvC,CAAsC,CAAA,CAAtC,CAyMA,CAAA,OAAOtR,CAAA,CAAOkR,CAAP,CAdsC,CAsCnDL,QAASA,GAAgB,CAAC3a,CAAD,CAAUwG,CAAV,CAAgB,CACvC,IAAIiV,EAAYzb,CAAA0b,MAAhB,CACIR,EAAeO,CAAfP,EAA4BS,EAAA,CAAQF,CAAR,CAE5BP,EAAJ,GACM1U,CAAJ,CACE,OAAO0U,CAAAtT,KAAA,CAAkBpB,CAAlB,CADT,EAKI0U,CAAAE,OAOJ,GANMF,CAAApR,OAAAG,SAGJ,EAFEiR,CAAAE,OAAA,CAAoB,EAApB,CAAwB,UAAxB,CAEF,CAAAL,EAAA,CAAU/a,CAAV,CAGF,EADA,OAAO2b,EAAA,CAAQF,CAAR,CACP,CAAAzb,CAAA0b,MAAA,CAAgBhhB,CAZhB,CADF,CAJuC,CAsBzCygB,QAASA,GAAkB,CAACnb,CAAD,CAAU4b,CAAV,CAA6B,CAAA,IAClDH,EAAYzb,CAAA0b,MADsC,CAElDR,EAAeO,CAAfP,EAA4BS,EAAA,CAAQF,CAAR,CAE5BG,EAAJ,EAA0BV,CAAAA,CAA1B,GACElb,CAAA0b,MACA,CADgBD,CAChB,CAlPyB,EAAEI,EAkP3B;AAAAX,CAAA,CAAeS,EAAA,CAAQF,CAAR,CAAf,CAAoC,CAAC3R,OAAQ,EAAT,CAAalC,KAAM,EAAnB,CAAuBwT,OAAQ1gB,CAA/B,CAFtC,CAKA,OAAOwgB,EAT+C,CAaxDY,QAASA,GAAU,CAAC9b,CAAD,CAAUtE,CAAV,CAAeY,CAAf,CAAsB,CACvC,GAAIkc,EAAA,CAAkBxY,CAAlB,CAAJ,CAAgC,CAE9B,IAAI+b,EAAiBhd,CAAA,CAAUzC,CAAV,CAArB,CACI0f,EAAiB,CAACD,CAAlBC,EAAoCtgB,CAApCsgB,EAA2C,CAAChf,CAAA,CAAStB,CAAT,CADhD,CAEIugB,EAAa,CAACvgB,CAEdkM,EAAAA,EADAsT,CACAtT,CADeuT,EAAA,CAAmBnb,CAAnB,CAA4B,CAACgc,CAA7B,CACfpU,GAAuBsT,CAAAtT,KAE3B,IAAImU,CAAJ,CACEnU,CAAA,CAAKlM,CAAL,CAAA,CAAYY,CADd,KAEO,CACL,GAAI2f,CAAJ,CACE,MAAOrU,EAEP,IAAIoU,CAAJ,CAEE,MAAOpU,EAAP,EAAeA,CAAA,CAAKlM,CAAL,CAEfmC,EAAA,CAAO+J,CAAP,CAAalM,CAAb,CARC,CAVuB,CADO,CA0BzCwgB,QAASA,GAAc,CAAClc,CAAD,CAAUmc,CAAV,CAAoB,CACzC,MAAKnc,EAAAiG,aAAL,CAEqC,EAFrC,CACQtC,CAAC,GAADA,EAAQ3D,CAAAiG,aAAA,CAAqB,OAArB,CAARtC,EAAyC,EAAzCA,EAA+C,GAA/CA,SAAA,CAA4D,SAA5D,CAAuE,GAAvE,CAAAtD,QAAA,CACI,GADJ,CACU8b,CADV,CACqB,GADrB,CADR,CAAkC,CAAA,CADO,CAM3CC,QAASA,GAAiB,CAACpc,CAAD,CAAUqc,CAAV,CAAsB,CAC1CA,CAAJ,EAAkBrc,CAAAsc,aAAlB,EACE/gB,CAAA,CAAQ8gB,CAAAvc,MAAA,CAAiB,GAAjB,CAAR,CAA+B,QAAQ,CAACyc,CAAD,CAAW,CAChDvc,CAAAsc,aAAA,CAAqB,OAArB,CAA8BnC,CAAA,CAC1BxW,CAAC,GAADA,EAAQ3D,CAAAiG,aAAA,CAAqB,OAArB,CAARtC,EAAyC,EAAzCA,EAA+C,GAA/CA,SAAA,CACS,SADT,CACoB,GADpB,CAAAA,QAAA,CAES,GAFT,CAEewW,CAAA,CAAKoC,CAAL,CAFf,CAEgC,GAFhC,CAEqC,GAFrC,CAD0B,CAA9B,CADgD,CAAlD,CAF4C,CAYhDC,QAASA,GAAc,CAACxc,CAAD;AAAUqc,CAAV,CAAsB,CAC3C,GAAIA,CAAJ,EAAkBrc,CAAAsc,aAAlB,CAAwC,CACtC,IAAIG,EAAkB9Y,CAAC,GAADA,EAAQ3D,CAAAiG,aAAA,CAAqB,OAArB,CAARtC,EAAyC,EAAzCA,EAA+C,GAA/CA,SAAA,CACW,SADX,CACsB,GADtB,CAGtBpI,EAAA,CAAQ8gB,CAAAvc,MAAA,CAAiB,GAAjB,CAAR,CAA+B,QAAQ,CAACyc,CAAD,CAAW,CAChDA,CAAA,CAAWpC,CAAA,CAAKoC,CAAL,CAC4C,GAAvD,GAAIE,CAAApc,QAAA,CAAwB,GAAxB,CAA8Bkc,CAA9B,CAAyC,GAAzC,CAAJ,GACEE,CADF,EACqBF,CADrB,CACgC,GADhC,CAFgD,CAAlD,CAOAvc,EAAAsc,aAAA,CAAqB,OAArB,CAA8BnC,CAAA,CAAKsC,CAAL,CAA9B,CAXsC,CADG,CAiB7ClC,QAASA,GAAc,CAACmC,CAAD,CAAOC,CAAP,CAAiB,CAGtC,GAAIA,CAAJ,CAGE,GAAIA,CAAA7X,SAAJ,CACE4X,CAAA,CAAKA,CAAAxhB,OAAA,EAAL,CAAA,CAAsByhB,CADxB,KAEO,CACL,IAAIzhB,EAASyhB,CAAAzhB,OAGb,IAAsB,QAAtB,GAAI,MAAOA,EAAX,EAAkCyhB,CAAAniB,OAAlC,GAAsDmiB,CAAtD,CACE,IAAIzhB,CAAJ,CACE,IAAS,IAAAiB,EAAI,CAAb,CAAgBA,CAAhB,CAAoBjB,CAApB,CAA4BiB,CAAA,EAA5B,CACEugB,CAAA,CAAKA,CAAAxhB,OAAA,EAAL,CAAA,CAAsByhB,CAAA,CAASxgB,CAAT,CAF1B,CADF,IAOEugB,EAAA,CAAKA,CAAAxhB,OAAA,EAAL,CAAA,CAAsByhB,CAXnB,CAR6B,CA0BxCC,QAASA,GAAgB,CAAC5c,CAAD,CAAUwG,CAAV,CAAgB,CACvC,MAAOqW,GAAA,CAAoB7c,CAApB,CAA6B,GAA7B,EAAoCwG,CAApC,EAA4C,cAA5C,EAA8D,YAA9D,CADgC,CAIzCqW,QAASA,GAAmB,CAAC7c,CAAD,CAAUwG,CAAV,CAAgBlK,CAAhB,CAAuB,CA1mC1Boc,CA6mCvB,EAAI1Y,CAAA8E,SAAJ,GACE9E,CADF,CACYA,CAAA8c,gBADZ,CAKA,KAFIC,CAEJ;AAFYhiB,CAAA,CAAQyL,CAAR,CAAA,CAAgBA,CAAhB,CAAuB,CAACA,CAAD,CAEnC,CAAOxG,CAAP,CAAA,CAAgB,CACd,IADc,IACL7D,EAAI,CADC,CACEY,EAAKggB,CAAA7hB,OAArB,CAAmCiB,CAAnC,CAAuCY,CAAvC,CAA2CZ,CAAA,EAA3C,CACE,GAAI4C,CAAA,CAAUzC,CAAV,CAAkBrB,CAAA2M,KAAA,CAAY5H,CAAZ,CAAqB+c,CAAA,CAAM5gB,CAAN,CAArB,CAAlB,CAAJ,CAAuD,MAAOG,EAMhE0D,EAAA,CAAUA,CAAAga,WAAV,EAznC8BgD,EAynC9B,GAAiChd,CAAA8E,SAAjC,EAAqF9E,CAAAid,KARvE,CARiC,CAoBnDC,QAASA,GAAW,CAACld,CAAD,CAAU,CAE5B,IADAya,EAAA,CAAaza,CAAb,CAAsB,CAAA,CAAtB,CACA,CAAOA,CAAA2Z,WAAP,CAAA,CACE3Z,CAAAmd,YAAA,CAAoBnd,CAAA2Z,WAApB,CAH0B,CAO9ByD,QAASA,GAAY,CAACpd,CAAD,CAAUqd,CAAV,CAAoB,CAClCA,CAAL,EAAe5C,EAAA,CAAaza,CAAb,CACf,KAAI3B,EAAS2B,CAAAga,WACT3b,EAAJ,EAAYA,CAAA8e,YAAA,CAAmBnd,CAAnB,CAH2B,CAOzCsd,QAASA,GAAoB,CAACC,CAAD,CAASC,CAAT,CAAc,CACzCA,CAAA,CAAMA,CAAN,EAAahjB,CACb,IAAgC,UAAhC,GAAIgjB,CAAA/iB,SAAAgjB,WAAJ,CAIED,CAAAE,WAAA,CAAeH,CAAf,CAJF,KAOEtiB,EAAA,CAAOuiB,CAAP,CAAAlU,GAAA,CAAe,MAAf,CAAuBiU,CAAvB,CATuC,CA0E3CI,QAASA,GAAkB,CAAC3d,CAAD,CAAUwG,CAAV,CAAgB,CAEzC,IAAIoX,EAAcC,EAAA,CAAarX,CAAAuC,YAAA,EAAb,CAGlB,OAAO6U,EAAP,EAAsBE,EAAA,CAAiB/d,EAAA,CAAUC,CAAV,CAAjB,CAAtB,EAA8D4d,CALrB,CA0L3CG,QAASA,GAAkB,CAAC/d,CAAD,CAAU8J,CAAV,CAAkB,CAC3C,IAAIkU,EAAeA,QAAQ,CAACC,CAAD,CAAQjD,CAAR,CAAc,CAEvCiD,CAAAC,mBAAA,CAA2BC,QAAQ,EAAG,CACpC,MAAOF,EAAAG,iBAD6B,CAItC;IAAIC,EAAWvU,CAAA,CAAOkR,CAAP,EAAeiD,CAAAjD,KAAf,CAAf,CACIsD,EAAiBD,CAAA,CAAWA,CAAAnjB,OAAX,CAA6B,CAElD,IAAKojB,CAAL,CAAA,CAEA,GAAIxf,CAAA,CAAYmf,CAAAM,4BAAZ,CAAJ,CAAoD,CAClD,IAAIC,EAAmCP,CAAAQ,yBACvCR,EAAAQ,yBAAA,CAAiCC,QAAQ,EAAG,CAC1CT,CAAAM,4BAAA,CAAoC,CAAA,CAEhCN,EAAAU,gBAAJ,EACEV,CAAAU,gBAAA,EAGEH,EAAJ,EACEA,CAAA3iB,KAAA,CAAsCoiB,CAAtC,CARwC,CAFM,CAepDA,CAAAW,8BAAA,CAAsCC,QAAQ,EAAG,CAC/C,MAA6C,CAAA,CAA7C,GAAOZ,CAAAM,4BADwC,CAKjD,KAAIO,EAAiBT,CAAAU,sBAAjBD,EAAmDE,EAGjC,EAAtB,CAAKV,CAAL,GACED,CADF,CACazc,EAAA,CAAYyc,CAAZ,CADb,CAIA,KAAS,IAAAliB,EAAI,CAAb,CAAgBA,CAAhB,CAAoBmiB,CAApB,CAAoCniB,CAAA,EAApC,CACO8hB,CAAAW,8BAAA,EAAL,EACEE,CAAA,CAAe9e,CAAf,CAAwBie,CAAxB,CAA+BI,CAAA,CAASliB,CAAT,CAA/B,CA/BJ,CATuC,CA+CzC6hB,EAAAjU,KAAA,CAAoB/J,CACpB,OAAOge,EAjDoC,CAoD7CgB,QAASA,GAAqB,CAAChf,CAAD,CAAUie,CAAV,CAAiBgB,CAAjB,CAA0B,CACtDA,CAAApjB,KAAA,CAAamE,CAAb,CAAsBie,CAAtB,CADsD,CAIxDiB,QAASA,GAA0B,CAACC,CAAD,CAASlB,CAAT;AAAgBgB,CAAhB,CAAyB,CAI1D,IAAIG,EAAUnB,CAAAoB,cAGTD,EAAL,GAAiBA,CAAjB,GAA6BD,CAA7B,EAAwCG,EAAAzjB,KAAA,CAAoBsjB,CAApB,CAA4BC,CAA5B,CAAxC,GACEH,CAAApjB,KAAA,CAAasjB,CAAb,CAAqBlB,CAArB,CARwD,CAuP5DpG,QAASA,GAAgB,EAAG,CAC1B,IAAA0H,KAAA,CAAYC,QAAiB,EAAG,CAC9B,MAAO3hB,EAAA,CAAOsM,CAAP,CAAe,CACpBsV,SAAUA,QAAQ,CAACjgB,CAAD,CAAOkgB,CAAP,CAAgB,CAC5BlgB,CAAAE,KAAJ,GAAeF,CAAf,CAAsBA,CAAA,CAAK,CAAL,CAAtB,CACA,OAAO0c,GAAA,CAAe1c,CAAf,CAAqBkgB,CAArB,CAFyB,CADd,CAKpBC,SAAUA,QAAQ,CAACngB,CAAD,CAAOkgB,CAAP,CAAgB,CAC5BlgB,CAAAE,KAAJ,GAAeF,CAAf,CAAsBA,CAAA,CAAK,CAAL,CAAtB,CACA,OAAOgd,GAAA,CAAehd,CAAf,CAAqBkgB,CAArB,CAFyB,CALd,CASpBE,YAAaA,QAAQ,CAACpgB,CAAD,CAAOkgB,CAAP,CAAgB,CAC/BlgB,CAAAE,KAAJ,GAAeF,CAAf,CAAsBA,CAAA,CAAK,CAAL,CAAtB,CACA,OAAO4c,GAAA,CAAkB5c,CAAlB,CAAwBkgB,CAAxB,CAF4B,CATjB,CAAf,CADuB,CADN,CA+B5BG,QAASA,GAAO,CAAChlB,CAAD,CAAMilB,CAAN,CAAiB,CAC/B,IAAIpkB,EAAMb,CAANa,EAAab,CAAAiC,UAEjB,IAAIpB,CAAJ,CAIE,MAHmB,UAGZA,GAHH,MAAOA,EAGJA,GAFLA,CAEKA,CAFCb,CAAAiC,UAAA,EAEDpB,EAAAA,CAGLqkB,EAAAA,CAAU,MAAOllB,EAOrB,OALEa,EAKF,CANe,UAAf,EAAIqkB,CAAJ,EAAyC,QAAzC,EAA8BA,CAA9B,EAA6D,IAA7D,GAAqDllB,CAArD,CACQA,CAAAiC,UADR,CACwBijB,CADxB,CACkC,GADlC,CACwC,CAACD,CAAD,EAAcvjB,EAAd,GADxC,CAGQwjB,CAHR,CAGkB,GAHlB,CAGwBllB,CAdO,CAuBjCmlB,QAASA,GAAO,CAAC7f,CAAD,CAAQ8f,CAAR,CAAqB,CACnC,GAAIA,CAAJ,CAAiB,CACf,IAAIzjB,EAAM,CACV,KAAAD,QAAA;AAAe2jB,QAAQ,EAAG,CACxB,MAAO,EAAE1jB,CADe,CAFX,CAMjBjB,CAAA,CAAQ4E,CAAR,CAAe,IAAAggB,IAAf,CAAyB,IAAzB,CAPmC,CAiHrCC,QAASA,GAAW,CAACzd,CAAD,CAAK,CACnB0d,CAAAA,CAAS1d,CAAA9D,SAAA,EAAA8E,QAAA,CAAsB2c,EAAtB,CAAsC,EAAtC,CAEb,OADWD,EAAA3e,MAAA,CAAa6e,EAAb,CACX,EADsCF,CAAA3e,MAAA,CAAa8e,EAAb,CAFf,CAMzBC,QAASA,GAAM,CAAC9d,CAAD,CAAK,CAIlB,MAAA,CADI+d,CACJ,CADWN,EAAA,CAAYzd,CAAZ,CACX,EACS,WADT,CACuBgB,CAAC+c,CAAA,CAAK,CAAL,CAAD/c,EAAY,EAAZA,SAAA,CAAwB,WAAxB,CAAqC,GAArC,CADvB,CACmE,GADnE,CAGO,IAPW,CA2iBpB2D,QAASA,GAAc,CAACqZ,CAAD,CAAgB/Z,CAAhB,CAA0B,CA4C/Cga,QAASA,EAAa,CAACC,CAAD,CAAW,CAC/B,MAAO,SAAQ,CAACnlB,CAAD,CAAMY,CAAN,CAAa,CAC1B,GAAIU,CAAA,CAAStB,CAAT,CAAJ,CACEH,CAAA,CAAQG,CAAR,CAAaU,EAAA,CAAcykB,CAAd,CAAb,CADF,KAGE,OAAOA,EAAA,CAASnlB,CAAT,CAAcY,CAAd,CAJiB,CADG,CAUjCsP,QAASA,EAAQ,CAACpF,CAAD,CAAOsa,CAAP,CAAkB,CACjCrW,EAAA,CAAwBjE,CAAxB,CAA8B,SAA9B,CACA,IAAI7K,CAAA,CAAWmlB,CAAX,CAAJ,EAA6B/lB,CAAA,CAAQ+lB,CAAR,CAA7B,CACEA,CAAA,CAAYC,CAAAC,YAAA,CAA6BF,CAA7B,CAEd,IAAKvB,CAAAuB,CAAAvB,KAAL,CACE,KAAMhU,GAAA,CAAgB,MAAhB,CAA2E/E,CAA3E,CAAN,CAEF,MAAOya,EAAA,CAAcza,CAAd,CA3DY0a,UA2DZ,CAAP,CAA8CJ,CARb,CAWnCK,QAASA,EAAkB,CAAC3a,CAAD,CAAO8E,CAAP,CAAgB,CACzC,MAAO8V,SAA4B,EAAG,CACpC,IAAIC,EAASC,CAAA/Z,OAAA,CAAwB+D,CAAxB,CAAiC,IAAjC,CACb,IAAIxM,CAAA,CAAYuiB,CAAZ,CAAJ,CACE,KAAM9V,GAAA,CAAgB,OAAhB,CAAyF/E,CAAzF,CAAN;AAEF,MAAO6a,EAL6B,CADG,CAU3C/V,QAASA,EAAO,CAAC9E,CAAD,CAAO+a,CAAP,CAAkBC,CAAlB,CAA2B,CACzC,MAAO5V,EAAA,CAASpF,CAAT,CAAe,CACpB+Y,KAAkB,CAAA,CAAZ,GAAAiC,CAAA,CAAoBL,CAAA,CAAmB3a,CAAnB,CAAyB+a,CAAzB,CAApB,CAA0DA,CAD5C,CAAf,CADkC,CAiC3CE,QAASA,EAAW,CAACd,CAAD,CAAgB,CAClCvW,EAAA,CAAUtL,CAAA,CAAY6hB,CAAZ,CAAV,EAAwC5lB,CAAA,CAAQ4lB,CAAR,CAAxC,CAAgE,eAAhE,CAAiF,cAAjF,CADkC,KAE9BpU,EAAY,EAFkB,CAEdmV,CACpBnmB,EAAA,CAAQolB,CAAR,CAAuB,QAAQ,CAACta,CAAD,CAAS,CAItCsb,QAASA,EAAc,CAAC5V,CAAD,CAAQ,CAAA,IACzB5P,CADyB,CACtBY,CACFZ,EAAA,CAAI,CAAT,KAAYY,CAAZ,CAAiBgP,CAAA7Q,OAAjB,CAA+BiB,CAA/B,CAAmCY,CAAnC,CAAuCZ,CAAA,EAAvC,CAA4C,CAAA,IACtCylB,EAAa7V,CAAA,CAAM5P,CAAN,CADyB,CAEtCyP,EAAWmV,CAAAtY,IAAA,CAAqBmZ,CAAA,CAAW,CAAX,CAArB,CAEfhW,EAAA,CAASgW,CAAA,CAAW,CAAX,CAAT,CAAA9e,MAAA,CAA8B8I,CAA9B,CAAwCgW,CAAA,CAAW,CAAX,CAAxC,CAJ0C,CAFf,CAH/B,GAAI,CAAAC,CAAApZ,IAAA,CAAkBpC,CAAlB,CAAJ,CAAA,CACAwb,CAAA1B,IAAA,CAAkB9Z,CAAlB,CAA0B,CAAA,CAA1B,CAYA,IAAI,CACErL,CAAA,CAASqL,CAAT,CAAJ,EACEqb,CAGA,CAHWjU,EAAA,CAAcpH,CAAd,CAGX,CAFAkG,CAEA,CAFYA,CAAAjK,OAAA,CAAiBmf,CAAA,CAAYC,CAAAjW,SAAZ,CAAjB,CAAAnJ,OAAA,CAAwDof,CAAAhV,WAAxD,CAEZ,CADAiV,CAAA,CAAeD,CAAAlV,aAAf,CACA,CAAAmV,CAAA,CAAeD,CAAAjV,cAAf,CAJF,EAKW9Q,CAAA,CAAW0K,CAAX,CAAJ,CACHkG,CAAA5L,KAAA,CAAeogB,CAAAxZ,OAAA,CAAwBlB,CAAxB,CAAf,CADG,CAEItL,CAAA,CAAQsL,CAAR,CAAJ,CACHkG,CAAA5L,KAAA,CAAeogB,CAAAxZ,OAAA,CAAwBlB,CAAxB,CAAf,CADG,CAGLkE,EAAA,CAAYlE,CAAZ,CAAoB,QAApB,CAXA,CAaF,MAAO3B,CAAP,CAAU,CAYV,KAXI3J,EAAA,CAAQsL,CAAR,CAWE,GAVJA,CAUI,CAVKA,CAAA,CAAOA,CAAAnL,OAAP,CAAuB,CAAvB,CAUL,EARFwJ,CAAAod,QAQE,EARWpd,CAAAqd,MAQX;AARqD,EAQrD,EARsBrd,CAAAqd,MAAA1hB,QAAA,CAAgBqE,CAAAod,QAAhB,CAQtB,GAFJpd,CAEI,CAFAA,CAAAod,QAEA,CAFY,IAEZ,CAFmBpd,CAAAqd,MAEnB,EAAAxW,EAAA,CAAgB,UAAhB,CACIlF,CADJ,CACY3B,CAAAqd,MADZ,EACuBrd,CAAAod,QADvB,EACoCpd,CADpC,CAAN,CAZU,CA1BZ,CADsC,CAAxC,CA2CA,OAAO6H,EA9C2B,CAqDpCyV,QAASA,EAAsB,CAACC,CAAD,CAAQ3W,CAAR,CAAiB,CAE9C4W,QAASA,EAAU,CAACC,CAAD,CAAcC,CAAd,CAAsB,CACvC,GAAIH,CAAArmB,eAAA,CAAqBumB,CAArB,CAAJ,CAAuC,CACrC,GAAIF,CAAA,CAAME,CAAN,CAAJ,GAA2BE,CAA3B,CACE,KAAM9W,GAAA,CAAgB,MAAhB,CACI4W,CADJ,CACkB,MADlB,CAC2BxX,CAAAjF,KAAA,CAAU,MAAV,CAD3B,CAAN,CAGF,MAAOuc,EAAA,CAAME,CAAN,CAL8B,CAOrC,GAAI,CAGF,MAFAxX,EAAAzD,QAAA,CAAaib,CAAb,CAEO,CADPF,CAAA,CAAME,CAAN,CACO,CADcE,CACd,CAAAJ,CAAA,CAAME,CAAN,CAAA,CAAqB7W,CAAA,CAAQ6W,CAAR,CAAqBC,CAArB,CAH1B,CAIF,MAAOE,CAAP,CAAY,CAIZ,KAHIL,EAAA,CAAME,CAAN,CAGEG,GAHqBD,CAGrBC,EAFJ,OAAOL,CAAA,CAAME,CAAN,CAEHG,CAAAA,CAAN,CAJY,CAJd,OASU,CACR3X,CAAA4X,MAAA,EADQ,CAjB2B,CAwBzCC,QAASA,EAAa,CAAC7f,CAAD,CAAK8f,CAAL,CAAaN,CAAb,CAA0B,CAAA,IAC1CzB,EAAO,EACPgC,EAAAA,CAAUpb,EAAAqb,WAAA,CAA0BhgB,CAA1B,CAA8BiE,CAA9B,CAAwCub,CAAxC,CAEd,KAJ8C,IAIrChmB,EAAI,CAJiC,CAI9BjB,EAASwnB,CAAAxnB,OAAzB,CAAyCiB,CAAzC,CAA6CjB,CAA7C,CAAqDiB,CAAA,EAArD,CAA0D,CACxD,IAAIT,EAAMgnB,CAAA,CAAQvmB,CAAR,CACV,IAAmB,QAAnB,GAAI,MAAOT,EAAX,CACE,KAAM6P,GAAA,CAAgB,MAAhB,CACyE7P,CADzE,CAAN,CAGFglB,CAAA/f,KAAA,CAAU8hB,CAAA,EAAUA,CAAA7mB,eAAA,CAAsBF,CAAtB,CAAV,CAAuC+mB,CAAA,CAAO/mB,CAAP,CAAvC;AACuCwmB,CAAA,CAAWxmB,CAAX,CAAgBymB,CAAhB,CADjD,CANwD,CAS1D,MAAOzB,EAbuC,CA4DhD,MAAO,CACLnZ,OAlCFA,QAAe,CAAC5E,CAAD,CAAKD,CAAL,CAAW+f,CAAX,CAAmBN,CAAnB,CAAgC,CACvB,QAAtB,GAAI,MAAOM,EAAX,GACEN,CACA,CADcM,CACd,CAAAA,CAAA,CAAS,IAFX,CAKI/B,EAAAA,CAAO8B,CAAA,CAAc7f,CAAd,CAAkB8f,CAAlB,CAA0BN,CAA1B,CACPpnB,EAAA,CAAQ4H,CAAR,CAAJ,GACEA,CADF,CACOA,CAAA,CAAGA,CAAAzH,OAAH,CAAe,CAAf,CADP,CAfE,EAAA,CADU,EAAZ,EAAI0nB,EAAJ,CACS,CAAA,CADT,CAKuB,UALvB,GAKO,MAeMjgB,EApBb,EAMK,4BAAApD,KAAA,CAAkCsjB,QAAAC,UAAAjkB,SAAAhD,KAAA,CAc1B8G,CAd0B,CAAlC,CAcL,OAAK,EAAL,EAKE+d,CAAAxZ,QAAA,CAAa,IAAb,CACO,CAAA,KAAK2b,QAAAC,UAAArgB,KAAAK,MAAA,CAA8BH,CAA9B,CAAkC+d,CAAlC,CAAL,CANT,EAGS/d,CAAAG,MAAA,CAASJ,CAAT,CAAege,CAAf,CAdoC,CAiCxC,CAELM,YAbFA,QAAoB,CAAC+B,CAAD,CAAON,CAAP,CAAeN,CAAf,CAA4B,CAG9C,IAAIa,EAAQjoB,CAAA,CAAQgoB,CAAR,CAAA,CAAgBA,CAAA,CAAKA,CAAA7nB,OAAL,CAAmB,CAAnB,CAAhB,CAAwC6nB,CAChDrC,EAAAA,CAAO8B,CAAA,CAAcO,CAAd,CAAoBN,CAApB,CAA4BN,CAA5B,CAEXzB,EAAAxZ,QAAA,CAAa,IAAb,CACA,OAAO,MAAK2b,QAAAC,UAAArgB,KAAAK,MAAA,CAA8BkgB,CAA9B,CAAoCtC,CAApC,CAAL,CAPuC,CAWzC,CAGLjY,IAAKyZ,CAHA,CAILe,SAAU3b,EAAAqb,WAJL,CAKLO,IAAKA,QAAQ,CAAC1c,CAAD,CAAO,CAClB,MAAOya,EAAArlB,eAAA,CAA6B4K,CAA7B;AA1PQ0a,UA0PR,CAAP,EAA8De,CAAArmB,eAAA,CAAqB4K,CAArB,CAD5C,CALf,CAtFuC,CAhKhDI,CAAA,CAAyB,CAAA,CAAzB,GAAYA,CADmC,KAE3Cyb,EAAgB,EAF2B,CAI3C1X,EAAO,EAJoC,CAK3CkX,EAAgB,IAAI7B,EAAJ,CAAY,EAAZ,CAAgB,CAAA,CAAhB,CAL2B,CAM3CiB,EAAgB,CACd9Z,SAAU,CACNyE,SAAUgV,CAAA,CAAchV,CAAd,CADJ,CAENN,QAASsV,CAAA,CAActV,CAAd,CAFH,CAGNqB,QAASiU,CAAA,CAuEnBjU,QAAgB,CAACnG,CAAD,CAAOtF,CAAP,CAAoB,CAClC,MAAOoK,EAAA,CAAQ9E,CAAR,CAAc,CAAC,WAAD,CAAc,QAAQ,CAAC2c,CAAD,CAAY,CACrD,MAAOA,EAAAnC,YAAA,CAAsB9f,CAAtB,CAD8C,CAAlC,CAAd,CAD2B,CAvEjB,CAHH,CAIN5E,MAAOskB,CAAA,CA4EjBtkB,QAAc,CAACkK,CAAD,CAAOxD,CAAP,CAAY,CAAE,MAAOsI,EAAA,CAAQ9E,CAAR,CAAc7H,EAAA,CAAQqE,CAAR,CAAd,CAA4B,CAAA,CAA5B,CAAT,CA5ET,CAJD,CAKN4J,SAAUgU,CAAA,CA6EpBhU,QAAiB,CAACpG,CAAD,CAAOlK,CAAP,CAAc,CAC7BmO,EAAA,CAAwBjE,CAAxB,CAA8B,UAA9B,CACAya,EAAA,CAAcza,CAAd,CAAA,CAAsBlK,CACtB8mB,EAAA,CAAc5c,CAAd,CAAA,CAAsBlK,CAHO,CA7EX,CALJ,CAMNuQ,UAkFVA,QAAkB,CAACsV,CAAD,CAAckB,CAAd,CAAuB,CAAA,IACnCC,EAAevC,CAAAtY,IAAA,CAAqB0Z,CAArB,CA7FAjB,UA6FA,CADoB,CAEnCqC,EAAWD,CAAA/D,KAEf+D,EAAA/D,KAAA,CAAoBiE,QAAQ,EAAG,CAC7B,IAAIC,EAAenC,CAAA/Z,OAAA,CAAwBgc,CAAxB,CAAkCD,CAAlC,CACnB,OAAOhC,EAAA/Z,OAAA,CAAwB8b,CAAxB,CAAiC,IAAjC,CAAuC,CAACK,UAAWD,CAAZ,CAAvC,CAFsB,CAJQ,CAxFzB,CADI,CAN2B,CAgB3C1C,EAAoBE,CAAAkC,UAApBpC,CACIiB,CAAA,CAAuBf,CAAvB,CAAsC,QAAQ,CAACkB,CAAD,CAAcC,CAAd,CAAsB,CAC9Dra,EAAA/M,SAAA,CAAiBonB,CAAjB,CAAJ,EACEzX,CAAAhK,KAAA,CAAUyhB,CAAV,CAEF;KAAM7W,GAAA,CAAgB,MAAhB,CAAiDZ,CAAAjF,KAAA,CAAU,MAAV,CAAjD,CAAN,CAJkE,CAApE,CAjBuC,CAuB3C0d,EAAgB,EAvB2B,CAwB3CO,EACI3B,CAAA,CAAuBoB,CAAvB,CAAsC,QAAQ,CAACjB,CAAD,CAAcC,CAAd,CAAsB,CAClE,IAAIxW,EAAWmV,CAAAtY,IAAA,CAAqB0Z,CAArB,CAvBJjB,UAuBI,CAAmDkB,CAAnD,CACf,OAAOd,EAAA/Z,OAAA,CACHqE,CAAA2T,KADG,CACY3T,CADZ,CACsBlR,CADtB,CACiCynB,CADjC,CAF2D,CAApE,CAzBuC,CA8B3Cb,EAAmBqC,CAEvB1C,EAAA,kBAAA,CAA8C,CAAE1B,KAAM5gB,EAAA,CAAQglB,CAAR,CAAR,CAC9C,KAAIpX,EAAYkV,CAAA,CAAYd,CAAZ,CAAhB,CACAW,EAAmBqC,CAAAlb,IAAA,CAA0B,WAA1B,CACnB6Y,EAAA1a,SAAA,CAA4BA,CAC5BrL,EAAA,CAAQgR,CAAR,CAAmB,QAAQ,CAAC5J,CAAD,CAAK,CAAMA,CAAJ,EAAQ2e,CAAA/Z,OAAA,CAAwB5E,CAAxB,CAAV,CAAhC,CAEA,OAAO2e,EAtCwC,CA6QjDjO,QAASA,GAAqB,EAAG,CAE/B,IAAIuQ,EAAuB,CAAA,CAe3B,KAAAC,qBAAA,CAA4BC,QAAQ,EAAG,CACrCF,CAAA,CAAuB,CAAA,CADc,CAiJvC,KAAArE,KAAA,CAAY,CAAC,SAAD,CAAY,WAAZ,CAAyB,YAAzB,CAAuC,QAAQ,CAAC/H,CAAD,CAAU1B,CAAV,CAAqBM,CAArB,CAAiC,CAM1F2N,QAASA,EAAc,CAACC,CAAD,CAAO,CAC5B,IAAI3C,EAAS,IACbhmB,MAAAynB,UAAAmB,KAAApoB,KAAA,CAA0BmoB,CAA1B,CAAgC,QAAQ,CAAChkB,CAAD,CAAU,CAChD,GAA2B,GAA3B,GAAID,EAAA,CAAUC,CAAV,CAAJ,CAEE,MADAqhB,EACO,CADErhB,CACF,CAAA,CAAA,CAHuC,CAAlD,CAMA,OAAOqhB,EARqB,CAgC9B6C,QAASA,EAAQ,CAACna,CAAD,CAAO,CACtB,GAAIA,CAAJ,CAAU,CACRA,CAAAoa,eAAA,EAEA;IAAI9L,CAvBFA,EAAAA,CAAS+L,CAAAC,QAET1oB,EAAA,CAAW0c,CAAX,CAAJ,CACEA,CADF,CACWA,CAAA,EADX,CAEW1a,EAAA,CAAU0a,CAAV,CAAJ,EACDtO,CAGF,CAHSsO,CAAA,CAAO,CAAP,CAGT,CAAAA,CAAA,CADqB,OAAvB,GADYb,CAAA8M,iBAAA7V,CAAyB1E,CAAzB0E,CACR8V,SAAJ,CACW,CADX,CAGWxa,CAAAya,sBAAA,EAAAC,OANN,EAQKrpB,CAAA,CAASid,CAAT,CARL,GASLA,CATK,CASI,CATJ,CAqBDA,EAAJ,GAcMqM,CACJ,CADc3a,CAAAya,sBAAA,EAAAG,IACd,CAAAnN,CAAAoN,SAAA,CAAiB,CAAjB,CAAoBF,CAApB,CAA8BrM,CAA9B,CAfF,CALQ,CAAV,IAuBEb,EAAA0M,SAAA,CAAiB,CAAjB,CAAoB,CAApB,CAxBoB,CA4BxBE,QAASA,EAAM,CAACS,CAAD,CAAO,CACpBA,CAAA,CAAO7pB,CAAA,CAAS6pB,CAAT,CAAA,CAAiBA,CAAjB,CAAwB/O,CAAA+O,KAAA,EAC/B,KAAIC,CAGCD,EAAL,CAGK,CAAKC,CAAL,CAAWrqB,CAAAsqB,eAAA,CAAwBF,CAAxB,CAAX,EAA2CX,CAAA,CAASY,CAAT,CAA3C,CAGA,CAAKA,CAAL,CAAWf,CAAA,CAAetpB,CAAAuqB,kBAAA,CAA2BH,CAA3B,CAAf,CAAX,EAA8DX,CAAA,CAASY,CAAT,CAA9D,CAGa,KAHb,GAGID,CAHJ,EAGoBX,CAAA,CAAS,IAAT,CATzB,CAAWA,CAAA,CAAS,IAAT,CALS,CAjEtB,IAAIzpB,EAAW+c,CAAA/c,SAoFXmpB,EAAJ,EACExN,CAAAjX,OAAA,CAAkB8lB,QAAwB,EAAG,CAAC,MAAOnP,EAAA+O,KAAA,EAAR,CAA7C,CACEK,QAA8B,CAACC,CAAD,CAASC,CAAT,CAAiB,CAEzCD,CAAJ,GAAeC,CAAf,EAAoC,EAApC,GAAyBD,CAAzB,EAEA7H,EAAA,CAAqB,QAAQ,EAAG,CAC9BlH,CAAAlX,WAAA,CAAsBklB,CAAtB,CAD8B,CAAhC,CAJ6C,CADjD,CAWF,OAAOA,EAjGmF,CAAhF,CAlKmB,CA2QjCiB,QAASA,GAAY,CAACvX,CAAD,CAAGwX,CAAH,CAAM,CACzB,GAAKxX,CAAAA,CAAL,EAAWwX,CAAAA,CAAX,CAAc,MAAO,EACrB;GAAKxX,CAAAA,CAAL,CAAQ,MAAOwX,EACf,IAAKA,CAAAA,CAAL,CAAQ,MAAOxX,EACX/S,EAAA,CAAQ+S,CAAR,CAAJ,GAAgBA,CAAhB,CAAoBA,CAAApI,KAAA,CAAO,GAAP,CAApB,CACI3K,EAAA,CAAQuqB,CAAR,CAAJ,GAAgBA,CAAhB,CAAoBA,CAAA5f,KAAA,CAAO,GAAP,CAApB,CACA,OAAOoI,EAAP,CAAW,GAAX,CAAiBwX,CANQ,CAkB3BC,QAASA,GAAY,CAAC7F,CAAD,CAAU,CACzB1kB,CAAA,CAAS0kB,CAAT,CAAJ,GACEA,CADF,CACYA,CAAA5f,MAAA,CAAc,GAAd,CADZ,CAMA,KAAIjF,EAAMwH,CAAA,EACV9G,EAAA,CAAQmkB,CAAR,CAAiB,QAAQ,CAAC8F,CAAD,CAAQ,CAG3BA,CAAAtqB,OAAJ,GACEL,CAAA,CAAI2qB,CAAJ,CADF,CACe,CAAA,CADf,CAH+B,CAAjC,CAOA,OAAO3qB,EAfsB,CAyB/B4qB,QAASA,GAAqB,CAACC,CAAD,CAAU,CACtC,MAAO1oB,EAAA,CAAS0oB,CAAT,CAAA,CACDA,CADC,CAED,EAHgC,CAyzBxCC,QAASA,GAAO,CAACnrB,CAAD,CAASC,CAAT,CAAmBub,CAAnB,CAAyBc,CAAzB,CAAmC,CAsBjD8O,QAASA,EAA0B,CAACjjB,CAAD,CAAK,CACtC,GAAI,CACFA,CAAAG,MAAA,CAAS,IAAT,CA7gJGhF,EAAAjC,KAAA,CA6gJsBkC,SA7gJtB,CA6gJiC8E,CA7gJjC,CA6gJH,CADE,CAAJ,OAEU,CAER,GADAgjB,CAAA,EACI,CAA4B,CAA5B,GAAAA,CAAJ,CACE,IAAA,CAAOC,CAAA5qB,OAAP,CAAA,CACE,GAAI,CACF4qB,CAAAC,IAAA,EAAA,EADE,CAEF,MAAOrhB,CAAP,CAAU,CACVsR,CAAAgQ,MAAA,CAAWthB,CAAX,CADU,CANR,CAH4B,CAiJxCuhB,QAASA,EAA0B,EAAG,CACpCC,CAAA,CAAkB,IAClBC,EAAA,EACAC,EAAA,EAHoC,CAgBtCD,QAASA,EAAU,EAAG,CAVK,CAAA,CAAA,CACzB,GAAI,CACF,CAAA,CAAOE,CAAAC,MAAP,OAAA,CADE,CAEF,MAAO5hB,CAAP,CAAU,EAHa,CAAA,CAAA,IAAA,EAAA,CAazB6hB,CAAA,CAAcznB,CAAA,CAAYynB,CAAZ,CAAA,CAA2B,IAA3B,CAAkCA,CAG5CzkB,GAAA,CAAOykB,CAAP,CAAoBC,CAApB,CAAJ,GACED,CADF,CACgBC,CADhB,CAGAA,EAAA,CAAkBD,CATE,CAYtBH,QAASA,EAAa,EAAG,CACvB,GAAIK,CAAJ,GAAuB/jB,CAAAgkB,IAAA,EAAvB;AAAqCC,CAArC,GAA0DJ,CAA1D,CAIAE,CAEA,CAFiB/jB,CAAAgkB,IAAA,EAEjB,CADAC,CACA,CADmBJ,CACnB,CAAAhrB,CAAA,CAAQqrB,CAAR,CAA4B,QAAQ,CAACC,CAAD,CAAW,CAC7CA,CAAA,CAASnkB,CAAAgkB,IAAA,EAAT,CAAqBH,CAArB,CAD6C,CAA/C,CAPuB,CAnMwB,IAC7C7jB,EAAO,IADsC,CAG7C2F,EAAW7N,CAAA6N,SAHkC,CAI7Cge,EAAU7rB,CAAA6rB,QAJmC,CAK7C3I,EAAaljB,CAAAkjB,WALgC,CAM7CoJ,EAAetsB,CAAAssB,aAN8B,CAO7CC,EAAkB,EAEtBrkB,EAAAskB,OAAA,CAAc,CAAA,CAEd,KAAInB,EAA0B,CAA9B,CACIC,EAA8B,EAGlCpjB,EAAAukB,6BAAA,CAAoCrB,CACpCljB,EAAAwkB,6BAAA,CAAoCC,QAAQ,EAAG,CAAEtB,CAAA,EAAF,CAkC/CnjB,EAAA0kB,gCAAA,CAAuCC,QAAQ,CAACC,CAAD,CAAW,CACxB,CAAhC,GAAIzB,CAAJ,CACEyB,CAAA,EADF,CAGExB,CAAAnlB,KAAA,CAAiC2mB,CAAjC,CAJsD,CAlDT,KA8D7Cf,CA9D6C,CA8DhCI,CA9DgC,CA+D7CF,EAAiBpe,CAAAkf,KA/D4B,CAgE7CC,GAAc/sB,CAAAkF,KAAA,CAAc,MAAd,CAhE+B,CAiE7CumB,EAAkB,IAEtBC,EAAA,EACAQ,EAAA,CAAmBJ,CAsBnB7jB,EAAAgkB,IAAA,CAAWe,QAAQ,CAACf,CAAD,CAAM/iB,CAAN,CAAe2iB,CAAf,CAAsB,CAInCxnB,CAAA,CAAYwnB,CAAZ,CAAJ,GACEA,CADF,CACU,IADV,CAKIje,EAAJ,GAAiB7N,CAAA6N,SAAjB,GAAkCA,CAAlC,CAA6C7N,CAAA6N,SAA7C,CACIge,EAAJ,GAAgB7rB,CAAA6rB,QAAhB,GAAgCA,CAAhC,CAA0C7rB,CAAA6rB,QAA1C,CAGA,IAAIK,CAAJ,CAAS,CACP,IAAIgB,EAAYf,CAAZe,GAAiCpB,CAKrC,IAAIG,CAAJ,GAAuBC,CAAvB,GAAgCL,CAAAvP,CAAAuP,QAAhC,EAAoDqB,CAApD,EACE,MAAOhlB,EAET,KAAIilB;AAAWlB,CAAXkB,EAA6BC,EAAA,CAAUnB,CAAV,CAA7BkB,GAA2DC,EAAA,CAAUlB,CAAV,CAC/DD,EAAA,CAAiBC,CACjBC,EAAA,CAAmBL,CAKnB,IAAID,CAAAvP,CAAAuP,QAAJ,EAA0BsB,CAA1B,EAAuCD,CAAvC,CAKO,CACL,GAAKC,CAAAA,CAAL,EAAiBzB,CAAjB,CACEA,CAAA,CAAkBQ,CAEhB/iB,EAAJ,CACE0E,CAAA1E,QAAA,CAAiB+iB,CAAjB,CADF,CAEYiB,CAAL,EAGLtf,CAAA,CAAAA,CAAA,CA7FFjI,CA6FE,CAAwBsmB,CA7FlBrmB,QAAA,CAAY,GAAZ,CA6FN,CA5FN,CA4FM,CA5FY,EAAX,GAAAD,CAAA,CAAe,EAAf,CA4FuBsmB,CA5FHmB,OAAA,CAAWznB,CAAX,CA4FrB,CAAAiI,CAAAwc,KAAA,CAAgB,CAHX,EACLxc,CAAAkf,KADK,CACWb,CAIdre,EAAAkf,KAAJ,GAAsBb,CAAtB,GACER,CADF,CACoBQ,CADpB,CAXK,CALP,IACEL,EAAA,CAAQ1iB,CAAA,CAAU,cAAV,CAA2B,WAAnC,CAAA,CAAgD2iB,CAAhD,CAAuD,EAAvD,CAA2DI,CAA3D,CAGA,CAFAP,CAAA,EAEA,CAAAQ,CAAA,CAAmBJ,CAgBrB,OAAO7jB,EApCA,CA2CP,MAAOwjB,EAAP,EAA0B7d,CAAAkf,KAAA5jB,QAAA,CAAsB,MAAtB,CAA6B,GAA7B,CAxDW,CAsEzCjB,EAAA4jB,MAAA,CAAawB,QAAQ,EAAG,CACtB,MAAOvB,EADe,CAhKyB,KAoK7CK,EAAqB,EApKwB,CAqK7CmB,EAAgB,CAAA,CArK6B,CAsL7CvB,EAAkB,IA8CtB9jB,EAAAslB,YAAA,CAAmBC,QAAQ,CAACX,CAAD,CAAW,CAEpC,GAAKS,CAAAA,CAAL,CAAoB,CAMlB,GAAIjR,CAAAuP,QAAJ,CAAsBprB,CAAA,CAAOT,CAAP,CAAA8O,GAAA,CAAkB,UAAlB,CAA8B2c,CAA9B,CAEtBhrB,EAAA,CAAOT,CAAP,CAAA8O,GAAA,CAAkB,YAAlB,CAAgC2c,CAAhC,CAEA8B,EAAA,CAAgB,CAAA,CAVE,CAapBnB,CAAAjmB,KAAA,CAAwB2mB,CAAxB,CACA,OAAOA,EAhB6B,CAyBtC5kB,EAAAwlB,uBAAA,CAA8BC,QAAQ,EAAG,CACvCltB,CAAA,CAAOT,CAAP,CAAA4tB,IAAA,CAAmB,qBAAnB,CAA0CnC,CAA1C,CADuC,CASzCvjB,EAAA2lB,iBAAA;AAAwBjC,CAexB1jB,EAAA4lB,SAAA,CAAgBC,QAAQ,EAAG,CACzB,IAAIhB,EAAOC,EAAA9nB,KAAA,CAAiB,MAAjB,CACX,OAAO6nB,EAAA,CAAOA,CAAA5jB,QAAA,CAAa,wBAAb,CAAuC,EAAvC,CAAP,CAAoD,EAFlC,CAmB3BjB,EAAA8lB,MAAA,CAAaC,QAAQ,CAAC9lB,CAAD,CAAK+lB,CAAL,CAAY,CAC/B,IAAIC,CACJ9C,EAAA,EACA8C,EAAA,CAAYjL,CAAA,CAAW,QAAQ,EAAG,CAChC,OAAOqJ,CAAA,CAAgB4B,CAAhB,CACP/C,EAAA,CAA2BjjB,CAA3B,CAFgC,CAAtB,CAGT+lB,CAHS,EAGA,CAHA,CAIZ3B,EAAA,CAAgB4B,CAAhB,CAAA,CAA6B,CAAA,CAC7B,OAAOA,EARwB,CAsBjCjmB,EAAA8lB,MAAAI,OAAA,CAAoBC,QAAQ,CAACC,CAAD,CAAU,CACpC,MAAI/B,EAAA,CAAgB+B,CAAhB,CAAJ,EACE,OAAO/B,CAAA,CAAgB+B,CAAhB,CAGA,CAFPhC,CAAA,CAAagC,CAAb,CAEO,CADPlD,CAAA,CAA2BpnB,CAA3B,CACO,CAAA,CAAA,CAJT,EAMO,CAAA,CAP6B,CA9TW,CA0UnD2V,QAASA,GAAgB,EAAG,CAC1B,IAAAoL,KAAA,CAAY,CAAC,SAAD,CAAY,MAAZ,CAAoB,UAApB,CAAgC,WAAhC,CACR,QAAQ,CAAC/H,CAAD,CAAUxB,CAAV,CAAgBc,CAAhB,CAA0BtC,CAA1B,CAAqC,CAC3C,MAAO,KAAImR,EAAJ,CAAYnO,CAAZ,CAAqBhD,CAArB,CAAgCwB,CAAhC,CAAsCc,CAAtC,CADoC,CADrC,CADc,CAwF5BzC,QAASA,GAAqB,EAAG,CAE/B,IAAAkL,KAAA,CAAYC,QAAQ,EAAG,CAGrBuJ,QAASA,EAAY,CAACC,CAAD,CAAUtD,CAAV,CAAmB,CA0MtCuD,QAASA,EAAO,CAACC,CAAD,CAAQ,CAClBA,CAAJ,EAAaC,CAAb,GACOC,CAAL,CAEWA,CAFX,EAEuBF,CAFvB,GAGEE,CAHF,CAGaF,CAAAG,EAHb,EACED,CADF,CACaF,CAQb,CAHAI,CAAA,CAAKJ,CAAAG,EAAL,CAAcH,CAAAK,EAAd,CAGA,CAFAD,CAAA,CAAKJ,CAAL,CAAYC,CAAZ,CAEA,CADAA,CACA,CADWD,CACX,CAAAC,CAAAE,EAAA,CAAa,IAVf,CADsB,CAmBxBC,QAASA,EAAI,CAACE,CAAD;AAAYC,CAAZ,CAAuB,CAC9BD,CAAJ,EAAiBC,CAAjB,GACMD,CACJ,GADeA,CAAAD,EACf,CAD6BE,CAC7B,EAAIA,CAAJ,GAAeA,CAAAJ,EAAf,CAA6BG,CAA7B,CAFF,CADkC,CA5NpC,GAAIR,CAAJ,GAAeU,EAAf,CACE,KAAM/uB,EAAA,CAAO,eAAP,CAAA,CAAwB,KAAxB,CAAkEquB,CAAlE,CAAN,CAFoC,IAKlCW,EAAO,CAL2B,CAMlCC,EAAQ/rB,CAAA,CAAO,EAAP,CAAW6nB,CAAX,CAAoB,CAACmE,GAAIb,CAAL,CAApB,CAN0B,CAOlCphB,EAAOvF,CAAA,EAP2B,CAQlCynB,EAAYpE,CAAZoE,EAAuBpE,CAAAoE,SAAvBA,EAA4CC,MAAAC,UARV,CASlCC,EAAU5nB,CAAA,EATwB,CAUlC8mB,EAAW,IAVuB,CAWlCC,EAAW,IAyCf,OAAOM,EAAA,CAAOV,CAAP,CAAP,CAAyB,CAoBvB7I,IAAKA,QAAQ,CAACzkB,CAAD,CAAMY,CAAN,CAAa,CACxB,GAAI,CAAAwC,CAAA,CAAYxC,CAAZ,CAAJ,CAAA,CACA,GAAIwtB,CAAJ,CAAeC,MAAAC,UAAf,CAAiC,CAC/B,IAAIE,EAAWD,CAAA,CAAQvuB,CAAR,CAAXwuB,GAA4BD,CAAA,CAAQvuB,CAAR,CAA5BwuB,CAA2C,CAACxuB,IAAKA,CAAN,CAA3CwuB,CAEJjB,EAAA,CAAQiB,CAAR,CAH+B,CAM3BxuB,CAAN,GAAakM,EAAb,EAAoB+hB,CAAA,EACpB/hB,EAAA,CAAKlM,CAAL,CAAA,CAAYY,CAERqtB,EAAJ,CAAWG,CAAX,EACE,IAAAK,OAAA,CAAYf,CAAA1tB,IAAZ,CAGF,OAAOY,EAdP,CADwB,CApBH,CAiDvBmM,IAAKA,QAAQ,CAAC/M,CAAD,CAAM,CACjB,GAAIouB,CAAJ,CAAeC,MAAAC,UAAf,CAAiC,CAC/B,IAAIE,EAAWD,CAAA,CAAQvuB,CAAR,CAEf,IAAKwuB,CAAAA,CAAL,CAAe,MAEfjB,EAAA,CAAQiB,CAAR,CAL+B,CAQjC,MAAOtiB,EAAA,CAAKlM,CAAL,CATU,CAjDI,CAwEvByuB,OAAQA,QAAQ,CAACzuB,CAAD,CAAM,CACpB,GAAIouB,CAAJ,CAAeC,MAAAC,UAAf,CAAiC,CAC/B,IAAIE,EAAWD,CAAA,CAAQvuB,CAAR,CAEf,IAAKwuB,CAAAA,CAAL,CAAe,MAEXA,EAAJ,EAAgBf,CAAhB,GAA0BA,CAA1B,CAAqCe,CAAAX,EAArC,CACIW,EAAJ,EAAgBd,CAAhB,GAA0BA,CAA1B,CAAqCc,CAAAb,EAArC,CACAC,EAAA,CAAKY,CAAAb,EAAL,CAAgBa,CAAAX,EAAhB,CAEA,QAAOU,CAAA,CAAQvuB,CAAR,CATwB,CAY3BA,CAAN;AAAakM,CAAb,GAEA,OAAOA,CAAA,CAAKlM,CAAL,CACP,CAAAiuB,CAAA,EAHA,CAboB,CAxEC,CAoGvBS,UAAWA,QAAQ,EAAG,CACpBxiB,CAAA,CAAOvF,CAAA,EACPsnB,EAAA,CAAO,CACPM,EAAA,CAAU5nB,CAAA,EACV8mB,EAAA,CAAWC,CAAX,CAAsB,IAJF,CApGC,CAqHvBiB,QAASA,QAAQ,EAAG,CAGlBJ,CAAA,CADAL,CACA,CAFAhiB,CAEA,CAFO,IAGP,QAAO8hB,CAAA,CAAOV,CAAP,CAJW,CArHG,CA6IvBsB,KAAMA,QAAQ,EAAG,CACf,MAAOzsB,EAAA,CAAO,EAAP,CAAW+rB,CAAX,CAAkB,CAACD,KAAMA,CAAP,CAAlB,CADQ,CA7IM,CApDa,CAFxC,IAAID,EAAS,EAiPbX,EAAAuB,KAAA,CAAoBC,QAAQ,EAAG,CAC7B,IAAID,EAAO,EACX/uB,EAAA,CAAQmuB,CAAR,CAAgB,QAAQ,CAACzH,CAAD,CAAQ+G,CAAR,CAAiB,CACvCsB,CAAA,CAAKtB,CAAL,CAAA,CAAgB/G,CAAAqI,KAAA,EADuB,CAAzC,CAGA,OAAOA,EALsB,CAmB/BvB,EAAAtgB,IAAA,CAAmB+hB,QAAQ,CAACxB,CAAD,CAAU,CACnC,MAAOU,EAAA,CAAOV,CAAP,CAD4B,CAKrC,OAAOD,EA1Qc,CAFQ,CA2TjC9R,QAASA,GAAsB,EAAG,CAChC,IAAAsI,KAAA,CAAY,CAAC,eAAD,CAAkB,QAAQ,CAACnL,CAAD,CAAgB,CACpD,MAAOA,EAAA,CAAc,WAAd,CAD6C,CAA1C,CADoB,CA60BlCvG,QAASA,GAAgB,CAAC1G,CAAD,CAAWsjB,CAAX,CAAkC,CAazDC,QAASA,EAAoB,CAACjjB,CAAD,CAAQkjB,CAAR,CAAuBC,CAAvB,CAAqC,CAChE,IAAIC,EAAe,qCAAnB,CAEIC,EAAW,EAEfvvB,EAAA,CAAQkM,CAAR,CAAe,QAAQ,CAACsjB,CAAD,CAAaC,CAAb,CAAwB,CAC7C,IAAItpB,EAAQqpB,CAAArpB,MAAA,CAAiBmpB,CAAjB,CAEZ,IAAKnpB,CAAAA,CAAL,CACE,KAAMupB,GAAA,CAAe,MAAf,CAGFN,CAHE,CAGaK,CAHb,CAGwBD,CAHxB,CAIDH,CAAA;AAAe,gCAAf,CACD,0BALE,CAAN,CAQFE,CAAA,CAASE,CAAT,CAAA,CAAsB,CACpBE,KAAMxpB,CAAA,CAAM,CAAN,CAAA,CAAS,CAAT,CADc,CAEpBypB,WAAyB,GAAzBA,GAAYzpB,CAAA,CAAM,CAAN,CAFQ,CAGpB0pB,SAAuB,GAAvBA,GAAU1pB,CAAA,CAAM,CAAN,CAHU,CAIpB2pB,SAAU3pB,CAAA,CAAM,CAAN,CAAV2pB,EAAsBL,CAJF,CAZuB,CAA/C,CAoBA,OAAOF,EAzByD,CAiElEQ,QAASA,EAAwB,CAAC9kB,CAAD,CAAO,CACtC,IAAIqC,EAASrC,CAAA3E,OAAA,CAAY,CAAZ,CACb,IAAKgH,CAAAA,CAAL,EAAeA,CAAf,GAA0B5I,CAAA,CAAU4I,CAAV,CAA1B,CACE,KAAMoiB,GAAA,CAAe,QAAf,CAA4GzkB,CAA5G,CAAN,CAEF,GAAIA,CAAJ,GAAaA,CAAA2T,KAAA,EAAb,CACE,KAAM8Q,GAAA,CAAe,QAAf,CAEAzkB,CAFA,CAAN,CANoC,CA9EiB,IACrD+kB,EAAgB,EADqC,CAGrDC,EAA2B,qCAH0B,CAIrDC,EAAyB,6BAJ4B,CAKrDC,EAAuB9rB,EAAA,CAAQ,2BAAR,CAL8B,CAMrD+rB,EAAwB,6BAN6B,CAWrDC,EAA4B,yBA8F/B,KAAA5e,UAAA,CAAiB6e,QAASC,EAAiB,CAACtlB,CAAD,CAAOulB,CAAP,CAAyB,CACnEthB,EAAA,CAAwBjE,CAAxB,CAA8B,WAA9B,CACIxL,EAAA,CAASwL,CAAT,CAAJ,EACE8kB,CAAA,CAAyB9kB,CAAzB,CAkCA,CAjCA4D,EAAA,CAAU2hB,CAAV,CAA4B,kBAA5B,CAiCA;AAhCKR,CAAA3vB,eAAA,CAA6B4K,CAA7B,CAgCL,GA/BE+kB,CAAA,CAAc/kB,CAAd,CACA,CADsB,EACtB,CAAAW,CAAAmE,QAAA,CAAiB9E,CAAjB,CA9GOwlB,WA8GP,CAAgC,CAAC,WAAD,CAAc,mBAAd,CAC9B,QAAQ,CAAC7I,CAAD,CAAYzO,CAAZ,CAA+B,CACrC,IAAIuX,EAAa,EACjB1wB,EAAA,CAAQgwB,CAAA,CAAc/kB,CAAd,CAAR,CAA6B,QAAQ,CAACulB,CAAD,CAAmB3rB,CAAnB,CAA0B,CAC7D,GAAI,CACF,IAAI4M,EAAYmW,CAAA5b,OAAA,CAAiBwkB,CAAjB,CACZpwB,EAAA,CAAWqR,CAAX,CAAJ,CACEA,CADF,CACc,CAAEtF,QAAS/I,EAAA,CAAQqO,CAAR,CAAX,CADd,CAEYtF,CAAAsF,CAAAtF,QAFZ,EAEiCsF,CAAAsc,KAFjC,GAGEtc,CAAAtF,QAHF,CAGsB/I,EAAA,CAAQqO,CAAAsc,KAAR,CAHtB,CAKAtc,EAAAkf,SAAA,CAAqBlf,CAAAkf,SAArB,EAA2C,CAC3Clf,EAAA5M,MAAA,CAAkBA,CAClB4M,EAAAxG,KAAA,CAAiBwG,CAAAxG,KAAjB,EAAmCA,CACnCwG,EAAAmf,QAAA,CAAoBnf,CAAAmf,QAApB,EAA0Cnf,CAAAvD,WAA1C,EAAkEuD,CAAAxG,KAClEwG,EAAAof,SAAA,CAAqBpf,CAAAof,SAArB,EAA2C,IAC5Bpf,KAAAA,EAAAA,CAAAA,CACYA,EAAAA,CADZA,CACuBxG,EAAAwG,CAAAxG,KADvBwG,CAtFvB8d,EAAW,CACbthB,aAAc,IADD,CAEb6iB,iBAAkB,IAFL,CAIXrvB,EAAA,CAASgQ,CAAAvF,MAAT,CAAJ,GACqC,CAAA,CAAnC,GAAIuF,CAAAqf,iBAAJ,EACEvB,CAAAuB,iBAEA,CAF4B3B,CAAA,CAAqB1d,CAAAvF,MAArB,CACqBkjB,CADrB,CACoC,CAAA,CADpC,CAE5B,CAAAG,CAAAthB,aAAA,CAAwB,EAH1B,EAKEshB,CAAAthB,aALF;AAK0BkhB,CAAA,CAAqB1d,CAAAvF,MAArB,CACqBkjB,CADrB,CACoC,CAAA,CADpC,CAN5B,CAUI3tB,EAAA,CAASgQ,CAAAqf,iBAAT,CAAJ,GACEvB,CAAAuB,iBADF,CAEM3B,CAAA,CAAqB1d,CAAAqf,iBAArB,CAAiD1B,CAAjD,CAAgE,CAAA,CAAhE,CAFN,CAIA,IAAI3tB,CAAA,CAAS8tB,CAAAuB,iBAAT,CAAJ,CAAyC,CACvC,IAAI5iB,EAAauD,CAAAvD,WAAjB,CACI6iB,EAAetf,CAAAsf,aACnB,IAAK7iB,CAAAA,CAAL,CAEE,KAAMwhB,GAAA,CAAe,QAAf,CAEAN,CAFA,CAAN,CAGK,GAAK,CAAA4B,EAAA,CAAwB9iB,CAAxB,CAAoC6iB,CAApC,CAAL,CAEL,KAAMrB,GAAA,CAAe,SAAf,CAEAN,CAFA,CAAN,CAVqC,CAoE7B,IAAIG,GAAW9d,CAAAwf,WAAX1B,CArDTA,CAuDS9tB,EAAA,CAAS8tB,EAAAthB,aAAT,CAAJ,GACEwD,CAAAyf,kBADF,CACgC3B,EAAAthB,aADhC,CAGAwD,EAAAX,aAAA,CAAyB0f,CAAA1f,aACzB4f,EAAAtrB,KAAA,CAAgBqM,CAAhB,CAlBE,CAmBF,MAAOtI,CAAP,CAAU,CACVgQ,CAAA,CAAkBhQ,CAAlB,CADU,CApBiD,CAA/D,CAwBA,OAAOunB,EA1B8B,CADT,CAAhC,CA8BF,EAAAV,CAAA,CAAc/kB,CAAd,CAAA7F,KAAA,CAAyBorB,CAAzB,CAnCF,EAqCExwB,CAAA,CAAQiL,CAAR,CAAcpK,EAAA,CAAc0vB,CAAd,CAAd,CAEF,OAAO,KAzC4D,CA6HrE,KAAA7e,UAAA,CAAiByf,QAA0B,CAAClmB,CAAD,CAAOkf,CAAP,CAAgB,CAGzDpa,QAASA,EAAO,CAAC6X,CAAD,CAAY,CAC1BwJ,QAASA,EAAc,CAAChqB,CAAD,CAAK,CAC1B,MAAIhH,EAAA,CAAWgH,CAAX,CAAJ,EAAsB5H,CAAA,CAAQ4H,CAAR,CAAtB,CACS,QAAQ,CAACiqB,CAAD,CAAWC,CAAX,CAAmB,CAChC,MAAO1J,EAAA5b,OAAA,CAAiB5E,CAAjB;AAAqB,IAArB,CAA2B,CAACmqB,SAAUF,CAAX,CAAqBG,OAAQF,CAA7B,CAA3B,CADyB,CADpC,CAKSlqB,CANiB,CAU5B,IAAIqqB,EAAatH,CAAAsH,SAAD,EAAsBtH,CAAAuH,YAAtB,CAAiDvH,CAAAsH,SAAjD,CAA4C,EAC5D,OAAO,CACLvjB,WAAYA,CADP,CAEL6iB,aAAcC,EAAA,CAAwB7G,CAAAjc,WAAxB,CAAd6iB,EAA6D5G,CAAA4G,aAA7DA,EAAqF,OAFhF,CAGLU,SAAUL,CAAA,CAAeK,CAAf,CAHL,CAILC,YAAaN,CAAA,CAAejH,CAAAuH,YAAf,CAJR,CAKLC,WAAYxH,CAAAwH,WALP,CAMLzlB,MAAO,EANF,CAOL4kB,iBAAkB3G,CAAAoF,SAAlBuB,EAAsC,EAPjC,CAQLD,SAAU,GARL,CASLD,QAASzG,CAAAyG,QATJ,CAZmB,CAF5B,IAAI1iB,EAAaic,CAAAjc,WAAbA,EAAmC,QAAQ,EAAG,EA6BlDlO,EAAA,CAAQmqB,CAAR,CAAiB,QAAQ,CAAC1iB,CAAD,CAAMtH,CAAN,CAAW,CACZ,GAAtB,GAAIA,CAAAmG,OAAA,CAAW,CAAX,CAAJ,GACEyJ,CAAA,CAAQ5P,CAAR,CADF,CACiBsH,CADjB,CADkC,CAApC,CAMAsI,EAAAoX,QAAA,CAAkB,CAAC,WAAD,CAElB,OAAO,KAAA1V,UAAA,CAAexG,CAAf,CAAqB8E,CAArB,CAtCkD,CA8D3D,KAAA6hB,2BAAA,CAAkCC,QAAQ,CAACC,CAAD,CAAS,CACjD,MAAItuB,EAAA,CAAUsuB,CAAV,CAAJ,EACE5C,CAAA0C,2BAAA,CAAiDE,CAAjD,CACO;AAAA,IAFT,EAIS5C,CAAA0C,2BAAA,EALwC,CA8BnD,KAAAG,4BAAA,CAAmCC,QAAQ,CAACF,CAAD,CAAS,CAClD,MAAItuB,EAAA,CAAUsuB,CAAV,CAAJ,EACE5C,CAAA6C,4BAAA,CAAkDD,CAAlD,CACO,CAAA,IAFT,EAIS5C,CAAA6C,4BAAA,EALyC,CA+BpD,KAAIlmB,EAAmB,CAAA,CACvB,KAAAA,iBAAA,CAAwBomB,QAAQ,CAACC,CAAD,CAAU,CACxC,MAAI1uB,EAAA,CAAU0uB,CAAV,CAAJ,EACErmB,CACO,CADYqmB,CACZ,CAAA,IAFT,EAIOrmB,CALiC,CAQ1C,KAAAmY,KAAA,CAAY,CACF,WADE,CACW,cADX,CAC2B,mBAD3B,CACgD,kBADhD,CACoE,QADpE,CAEF,aAFE,CAEa,YAFb,CAE2B,MAF3B,CAEmC,UAFnC,CAE+C,eAF/C,CAGV,QAAQ,CAAC4D,CAAD,CAAcnO,CAAd,CAA8BN,CAA9B,CAAmDwC,CAAnD,CAAuEhB,CAAvE,CACC5B,CADD,CACgB8B,CADhB,CAC8BM,EAD9B,CACsCpD,CADtC,CACkD3F,CADlD,CACiE,CAiPzE+f,QAASA,EAAc,CAAC1tB,CAAD,CAAUqrB,CAAV,CAAoB/uB,CAApB,CAA2B,CAIhDqxB,EAAApU,UAAA,CAA8B,QAA9B,CAAyC8R,CAAzC,CAAoD,GAChDuC,EAAAA,CAAaD,EAAAhU,WAAAiU,WACjB,KAAIC,EAAYD,CAAA,CAAW,CAAX,CAEhBA,EAAAE,gBAAA,CAA2BD,CAAArnB,KAA3B,CACAqnB;CAAAvxB,MAAA,CAAkBA,CAClB0D,EAAA4tB,WAAAG,aAAA,CAAgCF,CAAhC,CAVgD,CAalDG,QAASA,EAAY,CAAClB,CAAD,CAAWmB,CAAX,CAAsB,CACzC,GAAI,CACFnB,CAAAnN,SAAA,CAAkBsO,CAAlB,CADE,CAEF,MAAOvpB,CAAP,CAAU,EAH6B,CAiD3CgD,QAASA,EAAO,CAACwmB,CAAD,CAAgBC,CAAhB,CAA8BC,CAA9B,CAA2CC,CAA3C,CACIC,CADJ,CAC4B,CACpCJ,CAAN,WAA+BjzB,EAA/B,GAGEizB,CAHF,CAGkBjzB,CAAA,CAAOizB,CAAP,CAHlB,CAUA,KAJA,IAAIK,EAAY,KAAhB,CAISpyB,EAAI,CAJb,CAIgB2O,EAAMojB,CAAAhzB,OAAtB,CAA4CiB,CAA5C,CAAgD2O,CAAhD,CAAqD3O,CAAA,EAArD,CAA0D,CACxD,IAAIqyB,EAAUN,CAAA,CAAc/xB,CAAd,CAEVqyB,EAAA1pB,SAAJ,GAAyBC,EAAzB,EAA2CypB,CAAAC,UAAA/sB,MAAA,CAAwB6sB,CAAxB,CAA3C,EACEzU,EAAA,CAAe0U,CAAf,CAAwBN,CAAA,CAAc/xB,CAAd,CAAxB,CAA2C1B,CAAAwe,cAAA,CAAuB,MAAvB,CAA3C,CAJsD,CAQ1D,IAAIyV,EACIC,CAAA,CAAaT,CAAb,CAA4BC,CAA5B,CAA0CD,CAA1C,CACaE,CADb,CAC0BC,CAD1B,CAC2CC,CAD3C,CAER5mB,EAAAknB,gBAAA,CAAwBV,CAAxB,CACA,KAAIW,EAAY,IAChB,OAAOC,SAAqB,CAACrnB,CAAD,CAAQsnB,CAAR,CAAwBrJ,CAAxB,CAAiC,CAC3Dtb,EAAA,CAAU3C,CAAV,CAAiB,OAAjB,CAEI6mB,EAAJ,EAA8BA,CAAAU,cAA9B,GAKEvnB,CALF,CAKUA,CAAAwnB,QAAAC,KAAA,EALV,CAQAxJ,EAAA,CAAUA,CAAV,EAAqB,EAXsC,KAYvDyJ,EAA0BzJ,CAAAyJ,wBAZ6B,CAazDC,EAAwB1J,CAAA0J,sBACxBC,EAAAA,CAAsB3J,CAAA2J,oBAMpBF,EAAJ,EAA+BA,CAAAG,kBAA/B;CACEH,CADF,CAC4BA,CAAAG,kBAD5B,CAIKT,EAAL,GAyCA,CAzCA,CAsCF,CADIrvB,CACJ,CArCgD6vB,CAqChD,EArCgDA,CAoCpB,CAAc,CAAd,CAC5B,EAG6B,eAApB,GAAAtvB,EAAA,CAAUP,CAAV,CAAA,EAAuCX,EAAAhD,KAAA,CAAc2D,CAAd,CAAAkC,MAAA,CAA0B,KAA1B,CAAvC,CAA0E,KAA1E,CAAkF,MAH3F,CACS,MAvCP,CAUE6tB,EAAA,CANgB,MAAlB,GAAIV,CAAJ,CAMc5zB,CAAA,CACVu0B,CAAA,CAAaX,CAAb,CAAwB5zB,CAAA,CAAO,OAAP,CAAA2J,OAAA,CAAuBspB,CAAvB,CAAArpB,KAAA,EAAxB,CADU,CANd,CASWkqB,CAAJ,CAGOxlB,EAAA3L,MAAA/B,KAAA,CAA2BqyB,CAA3B,CAHP,CAKOA,CAGd,IAAIkB,CAAJ,CACE,IAASK,IAAAA,CAAT,GAA2BL,EAA3B,CACEG,CAAA3nB,KAAA,CAAe,GAAf,CAAqB6nB,CAArB,CAAsC,YAAtC,CAAoDL,CAAA,CAAsBK,CAAtB,CAAAC,SAApD,CAIJhoB,EAAAioB,eAAA,CAAuBJ,CAAvB,CAAkC9nB,CAAlC,CAEIsnB,EAAJ,EAAoBA,CAAA,CAAeQ,CAAf,CAA0B9nB,CAA1B,CAChBinB,EAAJ,EAAqBA,CAAA,CAAgBjnB,CAAhB,CAAuB8nB,CAAvB,CAAkCA,CAAlC,CAA6CJ,CAA7C,CACrB,OAAOI,EAvDoD,CAxBnB,CA4G5CZ,QAASA,EAAY,CAACiB,CAAD,CAAWzB,CAAX,CAAyB0B,CAAzB,CAAuCzB,CAAvC,CAAoDC,CAApD,CACGC,CADH,CAC2B,CA0C9CI,QAASA,EAAe,CAACjnB,CAAD,CAAQmoB,CAAR,CAAkBC,CAAlB,CAAgCV,CAAhC,CAAyD,CAAA,IAC/DW,CAD+D,CAClDtwB,CADkD,CAC5CuwB,CAD4C,CAChC5zB,CADgC,CAC7BY,CAD6B,CACpBizB,CADoB,CAE3EC,CAGJ,IAAIC,CAAJ,CAOE,IAHAD,CAGK,CAHgB50B,KAAJ,CADIu0B,CAAA10B,OACJ,CAGZ,CAAAiB,CAAA,CAAI,CAAT,CAAYA,CAAZ,CAAgBg0B,CAAAj1B,OAAhB,CAAgCiB,CAAhC,EAAmC,CAAnC,CACEi0B,CACA,CADMD,CAAA,CAAQh0B,CAAR,CACN,CAAA8zB,CAAA,CAAeG,CAAf,CAAA,CAAsBR,CAAA,CAASQ,CAAT,CAT1B,KAYEH,EAAA,CAAiBL,CAGdzzB,EAAA,CAAI,CAAT,KAAYY,CAAZ,CAAiBozB,CAAAj1B,OAAjB,CAAiCiB,CAAjC,CAAqCY,CAArC,CAAA,CACEyC,CAIA,CAJOywB,CAAA,CAAeE,CAAA,CAAQh0B,CAAA,EAAR,CAAf,CAIP,CAHAk0B,CAGA,CAHaF,CAAA,CAAQh0B,CAAA,EAAR,CAGb,CAFA2zB,CAEA,CAFcK,CAAA,CAAQh0B,CAAA,EAAR,CAEd,CAAIk0B,CAAJ,EACMA,CAAA5oB,MAAJ,EACEsoB,CACA;AADatoB,CAAAynB,KAAA,EACb,CAAAxnB,CAAAioB,eAAA,CAAuB10B,CAAA,CAAOuE,CAAP,CAAvB,CAAqCuwB,CAArC,CAFF,EAIEA,CAJF,CAIetoB,CAiBf,CAbEuoB,CAaF,CAdIK,CAAAC,wBAAJ,CAC2BC,CAAA,CACrB9oB,CADqB,CACd4oB,CAAAnD,WADc,CACSiC,CADT,CAD3B,CAIYqB,CAAAH,CAAAG,sBAAL,EAAyCrB,CAAzC,CACoBA,CADpB,CAGKA,CAAAA,CAAL,EAAgChB,CAAhC,CACoBoC,CAAA,CAAwB9oB,CAAxB,CAA+B0mB,CAA/B,CADpB,CAIoB,IAG3B,CAAAkC,CAAA,CAAWP,CAAX,CAAwBC,CAAxB,CAAoCvwB,CAApC,CAA0CqwB,CAA1C,CAAwDG,CAAxD,CAtBF,EAwBWF,CAxBX,EAyBEA,CAAA,CAAYroB,CAAZ,CAAmBjI,CAAAka,WAAnB,CAAoChf,CAApC,CAA+Cy0B,CAA/C,CAlD2E,CAtCjF,IAJ8C,IAC1CgB,EAAU,EADgC,CAE1CM,CAF0C,CAEnCxE,CAFmC,CAEXvS,CAFW,CAEcgX,CAFd,CAE2BR,CAF3B,CAIrC/zB,EAAI,CAAb,CAAgBA,CAAhB,CAAoByzB,CAAA10B,OAApB,CAAqCiB,CAAA,EAArC,CAA0C,CACxCs0B,CAAA,CAAQ,IAAIE,EAGZ1E,EAAA,CAAa2E,EAAA,CAAkBhB,CAAA,CAASzzB,CAAT,CAAlB,CAA+B,EAA/B,CAAmCs0B,CAAnC,CAAgD,CAAN,GAAAt0B,CAAA,CAAUiyB,CAAV,CAAwB1zB,CAAlE,CACmB2zB,CADnB,CAQb,EALAgC,CAKA,CALcpE,CAAA/wB,OAAD,CACP21B,CAAA,CAAsB5E,CAAtB,CAAkC2D,CAAA,CAASzzB,CAAT,CAAlC,CAA+Cs0B,CAA/C,CAAsDtC,CAAtD,CAAoE0B,CAApE,CACwB,IADxB,CAC8B,EAD9B,CACkC,EADlC,CACsCvB,CADtC,CADO,CAGP,IAEN,GAAkB+B,CAAA5oB,MAAlB,EACEC,CAAAknB,gBAAA,CAAwB6B,CAAAK,UAAxB,CAGFhB,EAAA,CAAeO,CAAD,EAAeA,CAAAU,SAAf,EACE,EAAArX,CAAA,CAAakW,CAAA,CAASzzB,CAAT,CAAAud,WAAb,CADF,EAECxe,CAAAwe,CAAAxe,OAFD,CAGR,IAHQ,CAIRyzB,CAAA,CAAajV,CAAb,CACG2W,CAAA,EACEA,CAAAC,wBADF,EACwC,CAACD,CAAAG,sBADzC,GAEOH,CAAAnD,WAFP,CAEgCiB,CAHnC,CAKN,IAAIkC,CAAJ,EAAkBP,CAAlB,CACEK,CAAAxvB,KAAA,CAAaxE,CAAb,CAAgBk0B,CAAhB,CAA4BP,CAA5B,CAEA,CADAY,CACA,CADc,CAAA,CACd,CAAAR,CAAA;AAAkBA,CAAlB,EAAqCG,CAIvC/B,EAAA,CAAyB,IAhCe,CAoC1C,MAAOoC,EAAA,CAAchC,CAAd,CAAgC,IAxCO,CAkGhD6B,QAASA,EAAuB,CAAC9oB,CAAD,CAAQ0mB,CAAR,CAAsB6C,CAAtB,CAAiD,CAE/E,IAAIC,EAAoBA,QAAQ,CAACC,CAAD,CAAmBC,CAAnB,CAA4BC,CAA5B,CAAyC/B,CAAzC,CAA8DgC,CAA9D,CAA+E,CAExGH,CAAL,GACEA,CACA,CADmBzpB,CAAAynB,KAAA,CAAW,CAAA,CAAX,CAAkBmC,CAAlB,CACnB,CAAAH,CAAAI,cAAA,CAAiC,CAAA,CAFnC,CAKA,OAAOnD,EAAA,CAAa+C,CAAb,CAA+BC,CAA/B,CAAwC,CAC7ChC,wBAAyB6B,CADoB,CAE7C5B,sBAAuBgC,CAFsB,CAG7C/B,oBAAqBA,CAHwB,CAAxC,CAPsG,CAA/G,CAgBIkC,EAAaN,CAAAO,QAAbD,CAAyClvB,CAAA,EAhB7C,CAiBSovB,CAAT,KAASA,CAAT,GAAqBtD,EAAAqD,QAArB,CAEID,CAAA,CAAWE,CAAX,CAAA,CADEtD,CAAAqD,QAAA,CAAqBC,CAArB,CAAJ,CACyBlB,CAAA,CAAwB9oB,CAAxB,CAA+B0mB,CAAAqD,QAAA,CAAqBC,CAArB,CAA/B,CAA+DT,CAA/D,CADzB,CAGyB,IAI3B,OAAOC,EA3BwE,CAwCjFL,QAASA,GAAiB,CAACpxB,CAAD,CAAOysB,CAAP,CAAmBwE,CAAnB,CAA0BrC,CAA1B,CAAuCC,CAAvC,CAAwD,CAAA,IAE5EqD,EAAWjB,CAAAkB,MAFiE,CAG5EjwB,CAGJ,QALelC,CAAAsF,SAKf,EACE,KA7tMgB2T,CA6tMhB,CAEEmZ,CAAA,CAAa3F,CAAb,CACI4F,EAAA,CAAmB9xB,EAAA,CAAUP,CAAV,CAAnB,CADJ,CACyC,GADzC,CAC8C4uB,CAD9C,CAC2DC,CAD3D,CAIA,KANF,IAMW3uB,CANX,CAM0CpD,CAN1C,CAMiDw1B,CANjD,CAM2DC,EAASvyB,CAAAouB,WANpE,CAOW3wB,EAAI,CAPf,CAOkBC,EAAK60B,CAAL70B,EAAe60B,CAAA72B,OAD/B,CAC8C+B,CAD9C,CACkDC,CADlD,CACsDD,CAAA,EADtD,CAC2D,CACzD,IAAI+0B,EAAgB,CAAA,CAApB,CACIC,EAAc,CAAA,CAElBvyB,EAAA,CAAOqyB,CAAA,CAAO90B,CAAP,CACPuJ,EAAA,CAAO9G,CAAA8G,KACPlK,EAAA,CAAQ6d,CAAA,CAAKza,CAAApD,MAAL,CAGR41B,EAAA,CAAaL,EAAA,CAAmBrrB,CAAnB,CACb,IAAIsrB,CAAJ,CAAeK,EAAA5yB,KAAA,CAAqB2yB,CAArB,CAAf,CACE1rB,CAAA;AAAOA,CAAA7C,QAAA,CAAayuB,EAAb,CAA4B,EAA5B,CAAAvK,OAAA,CACG,CADH,CAAAlkB,QAAA,CACc,OADd,CACuB,QAAQ,CAACjC,CAAD,CAAQmH,CAAR,CAAgB,CAClD,MAAOA,EAAAyP,YAAA,EAD2C,CAD/C,CAOT,EADI+Z,CACJ,CADwBH,CAAAxwB,MAAA,CAAiB4wB,EAAjB,CACxB,GAAyBC,CAAA,CAAwBF,CAAA,CAAkB,CAAlB,CAAxB,CAAzB,GACEL,CAEA,CAFgBxrB,CAEhB,CADAyrB,CACA,CADczrB,CAAAqhB,OAAA,CAAY,CAAZ,CAAerhB,CAAAtL,OAAf,CAA6B,CAA7B,CACd,CADgD,KAChD,CAAAsL,CAAA,CAAOA,CAAAqhB,OAAA,CAAY,CAAZ,CAAerhB,CAAAtL,OAAf,CAA6B,CAA7B,CAHT,CAMAs3B,EAAA,CAAQX,EAAA,CAAmBrrB,CAAAuC,YAAA,EAAnB,CACR2oB,EAAA,CAASc,CAAT,CAAA,CAAkBhsB,CAClB,IAAIsrB,CAAJ,EAAiB,CAAArB,CAAA70B,eAAA,CAAqB42B,CAArB,CAAjB,CACI/B,CAAA,CAAM+B,CAAN,CACA,CADel2B,CACf,CAAIqhB,EAAA,CAAmBne,CAAnB,CAAyBgzB,CAAzB,CAAJ,GACE/B,CAAA,CAAM+B,CAAN,CADF,CACiB,CAAA,CADjB,CAIJC,EAAA,CAA4BjzB,CAA5B,CAAkCysB,CAAlC,CAA8C3vB,CAA9C,CAAqDk2B,CAArD,CAA4DV,CAA5D,CACAF,EAAA,CAAa3F,CAAb,CAAyBuG,CAAzB,CAAgC,GAAhC,CAAqCpE,CAArC,CAAkDC,CAAlD,CAAmE2D,CAAnE,CACcC,CADd,CAjCyD,CAsC3DhE,CAAA,CAAYzuB,CAAAyuB,UACRjxB,EAAA,CAASixB,CAAT,CAAJ,GAEIA,CAFJ,CAEgBA,CAAAyE,QAFhB,CAIA,IAAI13B,CAAA,CAASizB,CAAT,CAAJ,EAAyC,EAAzC,GAA2BA,CAA3B,CACE,IAAA,CAAOvsB,CAAP,CAAe+pB,CAAAtS,KAAA,CAA4B8U,CAA5B,CAAf,CAAA,CACEuE,CAIA,CAJQX,EAAA,CAAmBnwB,CAAA,CAAM,CAAN,CAAnB,CAIR,CAHIkwB,CAAA,CAAa3F,CAAb,CAAyBuG,CAAzB,CAAgC,GAAhC,CAAqCpE,CAArC,CAAkDC,CAAlD,CAGJ,GAFEoC,CAAA,CAAM+B,CAAN,CAEF,CAFiBrY,CAAA,CAAKzY,CAAA,CAAM,CAAN,CAAL,CAEjB,EAAAusB,CAAA,CAAYA,CAAApG,OAAA,CAAiBnmB,CAAAtB,MAAjB,CAA+BsB,CAAA,CAAM,CAAN,CAAAxG,OAA/B,CAGhB,MACF,MAAK6J,EAAL,CACE,GAAa,EAAb,GAAI6d,EAAJ,CAEE,IAAA,CAAOpjB,CAAAwa,WAAP,EAA0Bxa,CAAA2L,YAA1B,EAA8C3L,CAAA2L,YAAArG,SAA9C;AAA4EC,EAA5E,CAAA,CACEvF,CAAAivB,UACA,EADkCjvB,CAAA2L,YAAAsjB,UAClC,CAAAjvB,CAAAwa,WAAAmD,YAAA,CAA4B3d,CAAA2L,YAA5B,CAGJwnB,EAAA,CAA4B1G,CAA5B,CAAwCzsB,CAAAivB,UAAxC,CACA,MACF,MAhyMgBmE,CAgyMhB,CACE,GAAI,CAEF,GADAlxB,CACA,CADQ8pB,CAAArS,KAAA,CAA8B3Z,CAAAivB,UAA9B,CACR,CACE+D,CACA,CADQX,EAAA,CAAmBnwB,CAAA,CAAM,CAAN,CAAnB,CACR,CAAIkwB,CAAA,CAAa3F,CAAb,CAAyBuG,CAAzB,CAAgC,GAAhC,CAAqCpE,CAArC,CAAkDC,CAAlD,CAAJ,GACEoC,CAAA,CAAM+B,CAAN,CADF,CACiBrY,CAAA,CAAKzY,CAAA,CAAM,CAAN,CAAL,CADjB,CAJA,CAQF,MAAOgD,CAAP,CAAU,EAhFhB,CAwFAunB,CAAA/vB,KAAA,CAAgB22B,EAAhB,CACA,OAAO5G,EA/FyE,CA0GlF6G,QAASA,EAAS,CAACtzB,CAAD,CAAOuzB,CAAP,CAAkBC,CAAlB,CAA2B,CAC3C,IAAIhoB,EAAQ,EAAZ,CACIioB,EAAQ,CACZ,IAAIF,CAAJ,EAAiBvzB,CAAAiH,aAAjB,EAAsCjH,CAAAiH,aAAA,CAAkBssB,CAAlB,CAAtC,EACE,EAAG,CACD,GAAKvzB,CAAAA,CAAL,CACE,KAAMyrB,GAAA,CAAe,SAAf,CAEI8H,CAFJ,CAEeC,CAFf,CAAN,CAt0MYva,CA00Md,EAAIjZ,CAAAsF,SAAJ,GACMtF,CAAAiH,aAAA,CAAkBssB,CAAlB,CACJ,EADkCE,CAAA,EAClC,CAAIzzB,CAAAiH,aAAA,CAAkBusB,CAAlB,CAAJ,EAAgCC,CAAA,EAFlC,CAIAjoB,EAAArK,KAAA,CAAWnB,CAAX,CACAA,EAAA,CAAOA,CAAA2L,YAXN,CAAH,MAYiB,CAZjB,CAYS8nB,CAZT,CADF,KAeEjoB,EAAArK,KAAA,CAAWnB,CAAX,CAGF,OAAOvE,EAAA,CAAO+P,CAAP,CArBoC,CAgC7CkoB,QAASA,GAA0B,CAACC,CAAD,CAASJ,CAAT,CAAoBC,CAApB,CAA6B,CAC9D,MAAO,SAAQ,CAACvrB,CAAD,CAAQzH,CAAR,CAAiBywB,CAAjB,CAAwBW,CAAxB,CAAqCjD,CAArC,CAAmD,CAChEnuB,CAAA,CAAU8yB,CAAA,CAAU9yB,CAAA,CAAQ,CAAR,CAAV,CAAsB+yB,CAAtB;AAAiCC,CAAjC,CACV,OAAOG,EAAA,CAAO1rB,CAAP,CAAczH,CAAd,CAAuBywB,CAAvB,CAA8BW,CAA9B,CAA2CjD,CAA3C,CAFyD,CADJ,CAkBhEiF,QAASA,GAAoB,CAACC,CAAD,CAAQnF,CAAR,CAAuBC,CAAvB,CAAqCC,CAArC,CAAkDC,CAAlD,CAAmEC,CAAnE,CAA2F,CACpH,GAAI+E,CAAJ,CACI,MAAO3rB,EAAA,CAAQwmB,CAAR,CAAuBC,CAAvB,CAAqCC,CAArC,CAAkDC,CAAlD,CAAmEC,CAAnE,CAGX,KAAIgF,CAEJ,OAAO,SAAQ,EAAG,CACTA,CAAL,GACIA,CAIA,CAJW5rB,CAAA,CAAQwmB,CAAR,CAAuBC,CAAvB,CAAqCC,CAArC,CAAkDC,CAAlD,CAAmEC,CAAnE,CAIX,CAAAJ,CAAA,CAAgBC,CAAhB,CAA+BG,CAA/B,CAAwD,IAL5D,CAQA,OAAOgF,EAAAxwB,MAAA,CAAe,IAAf,CAAqB/E,SAArB,CATO,CAPkG,CA2CxH8yB,QAASA,EAAqB,CAAC5E,CAAD,CAAasH,CAAb,CAA0BC,CAA1B,CAAyCrF,CAAzC,CACCsF,CADD,CACeC,CADf,CACyCC,CADzC,CACqDC,CADrD,CAECtF,CAFD,CAEyB,CAsSrDuF,QAASA,EAAU,CAACC,CAAD,CAAMC,CAAN,CAAYhB,CAAZ,CAAuBC,CAAvB,CAAgC,CACjD,GAAIc,CAAJ,CAAS,CACHf,CAAJ,GAAee,CAAf,CAAqBZ,EAAA,CAA2BY,CAA3B,CAAgCf,CAAhC,CAA2CC,CAA3C,CAArB,CACAc,EAAA3H,QAAA,CAAcnf,CAAAmf,QACd2H,EAAAnJ,cAAA,CAAoBA,CACpB,IAAIqJ,CAAJ,GAAiChnB,CAAjC,EAA8CA,CAAAinB,eAA9C,CACEH,CAAA,CAAMI,EAAA,CAAmBJ,CAAnB,CAAwB,CAACtqB,aAAc,CAAA,CAAf,CAAxB,CAERmqB,EAAAhzB,KAAA,CAAgBmzB,CAAhB,CAPO,CAST,GAAIC,CAAJ,CAAU,CACJhB,CAAJ,GAAegB,CAAf,CAAsBb,EAAA,CAA2Ba,CAA3B,CAAiChB,CAAjC,CAA4CC,CAA5C,CAAtB,CACAe,EAAA5H,QAAA,CAAenf,CAAAmf,QACf4H,EAAApJ,cAAA,CAAqBA,CACrB,IAAIqJ,CAAJ,GAAiChnB,CAAjC,EAA8CA,CAAAinB,eAA9C,CACEF,CAAA,CAAOG,EAAA,CAAmBH,CAAnB,CAAyB,CAACvqB,aAAc,CAAA,CAAf,CAAzB,CAEToqB,EAAAjzB,KAAA,CAAiBozB,CAAjB,CAPQ,CAVuC,CAsBnDI,QAASA,EAAc,CAACxJ,CAAD,CAAgBwB,CAAhB,CAAyBW,CAAzB,CAAmCsH,CAAnC,CAAuD,CAC5E,IAAI93B,CAEJ,IAAItB,CAAA,CAASmxB,CAAT,CAAJ,CAAuB,CACrB,IAAIzqB;AAAQyqB,CAAAzqB,MAAA,CAAciqB,CAAd,CACRnlB,EAAAA,CAAO2lB,CAAA9mB,UAAA,CAAkB3D,CAAA,CAAM,CAAN,CAAAxG,OAAlB,CACX,KAAIm5B,EAAc3yB,CAAA,CAAM,CAAN,CAAd2yB,EAA0B3yB,CAAA,CAAM,CAAN,CAA9B,CACI0pB,EAAwB,GAAxBA,GAAW1pB,CAAA,CAAM,CAAN,CAGK,KAApB,GAAI2yB,CAAJ,CACEvH,CADF,CACaA,CAAAzuB,OAAA,EADb,CAME/B,CANF,EAKEA,CALF,CAKU83B,CALV,EAKgCA,CAAA,CAAmB5tB,CAAnB,CALhC,GAMmBlK,CAAAozB,SAGnB,IAAKpzB,CAAAA,CAAL,CAAY,CACV,IAAIg4B,EAAW,GAAXA,CAAiB9tB,CAAjB8tB,CAAwB,YAC5Bh4B,EAAA,CAAQ+3B,CAAA,CAAcvH,CAAApjB,cAAA,CAAuB4qB,CAAvB,CAAd,CAAiDxH,CAAAllB,KAAA,CAAc0sB,CAAd,CAF/C,CAKZ,GAAKh4B,CAAAA,CAAL,EAAe8uB,CAAAA,CAAf,CACE,KAAMH,GAAA,CAAe,OAAf,CAEFzkB,CAFE,CAEImkB,CAFJ,CAAN,CAtBmB,CAAvB,IA0BO,IAAI5vB,CAAA,CAAQoxB,CAAR,CAAJ,CAEL,IADA7vB,CACgBS,CADR,EACQA,CAAPZ,CAAOY,CAAH,CAAGA,CAAAA,CAAAA,CAAKovB,CAAAjxB,OAArB,CAAqCiB,CAArC,CAAyCY,CAAzC,CAA6CZ,CAAA,EAA7C,CACEG,CAAA,CAAMH,CAAN,CAAA,CAAWg4B,CAAA,CAAexJ,CAAf,CAA8BwB,CAAA,CAAQhwB,CAAR,CAA9B,CAA0C2wB,CAA1C,CAAoDsH,CAApD,CAHR,KAKIp3B,EAAA,CAASmvB,CAAT,CAAJ,GACL7vB,CACA,CADQ,EACR,CAAAf,CAAA,CAAQ4wB,CAAR,CAAiB,QAAQ,CAAC1iB,CAAD,CAAa8qB,CAAb,CAAuB,CAC9Cj4B,CAAA,CAAMi4B,CAAN,CAAA,CAAkBJ,CAAA,CAAexJ,CAAf,CAA8BlhB,CAA9B,CAA0CqjB,CAA1C,CAAoDsH,CAApD,CAD4B,CAAhD,CAFK,CAOP,OAAO93B,EAAP,EAAgB,IAzC4D,CA4C9Ek4B,QAASA,EAAgB,CAAC1H,CAAD,CAAW2D,CAAX,CAAkBtC,CAAlB,CAAgCsG,CAAhC,CAAsDjrB,CAAtD,CAAoE/B,CAApE,CAA2E,CAClG,IAAI2sB,EAAqB/xB,CAAA,EAAzB,CACSqyB,CAAT,KAASA,CAAT,GAA0BD,EAA1B,CAAgD,CAC9C,IAAIznB,EAAYynB,CAAA,CAAqBC,CAArB,CAAhB,CACIjS,EAAS,CACXkS,OAAQ3nB,CAAA,GAAcgnB,CAAd,EAA0ChnB,CAAAinB,eAA1C,CAAqEzqB,CAArE,CAAoF/B,CADjF,CAEXqlB,SAAUA,CAFC,CAGXC,OAAQ0D,CAHG,CAIXmE,YAAazG,CAJF,CADb,CAQI1kB,EAAauD,CAAAvD,WACC,IAAlB,EAAIA,CAAJ;CACEA,CADF,CACegnB,CAAA,CAAMzjB,CAAAxG,KAAN,CADf,CAIIquB,EAAAA,CAAqBvgB,CAAA,CAAY7K,CAAZ,CAAwBgZ,CAAxB,CAAgC,CAAA,CAAhC,CAAsCzV,CAAAsf,aAAtC,CAOzB8H,EAAA,CAAmBpnB,CAAAxG,KAAnB,CAAA,CAAqCquB,CAChCC,EAAL,EACEhI,CAAAllB,KAAA,CAAc,GAAd,CAAoBoF,CAAAxG,KAApB,CAAqC,YAArC,CAAmDquB,CAAAnF,SAAnD,CAvB4C,CA0BhD,MAAO0E,EA5B2F,CA+BpG/D,QAASA,EAAU,CAACP,CAAD,CAAcroB,CAAd,CAAqBstB,CAArB,CAA+BlF,CAA/B,CAA6CoB,CAA7C,CAAgE,CA0HjF+D,QAASA,EAA0B,CAACvtB,CAAD,CAAQwtB,CAAR,CAAuB5F,CAAvB,CAA4CoC,CAA5C,CAAsD,CACvF,IAAIrC,CAECnwB,GAAA,CAAQwI,CAAR,CAAL,GACEgqB,CAGA,CAHWpC,CAGX,CAFAA,CAEA,CAFsB4F,CAEtB,CADAA,CACA,CADgBxtB,CAChB,CAAAA,CAAA,CAAQ/M,CAJV,CAOIo6B,EAAJ,GACE1F,CADF,CAC0BgF,EAD1B,CAGK/E,EAAL,GACEA,CADF,CACwByF,CAAA,CAAgChI,CAAAzuB,OAAA,EAAhC,CAAoDyuB,CAD5E,CAGA,IAAI2E,CAAJ,CAAc,CAKZ,IAAIyD,EAAmBjE,CAAAO,QAAA,CAA0BC,CAA1B,CACvB,IAAIyD,CAAJ,CACE,MAAOA,EAAA,CAAiBztB,CAAjB,CAAwBwtB,CAAxB,CAAuC7F,CAAvC,CAA8DC,CAA9D,CAAmF8F,EAAnF,CACF,IAAIr2B,CAAA,CAAYo2B,CAAZ,CAAJ,CACL,KAAMjK,GAAA,CAAe,QAAf,CAGLwG,CAHK,CAGKjtB,EAAA,CAAYsoB,CAAZ,CAHL,CAAN,CATU,CAAd,IAeE,OAAOmE,EAAA,CAAkBxpB,CAAlB,CAAyBwtB,CAAzB,CAAwC7F,CAAxC,CAA+DC,CAA/D,CAAoF8F,EAApF,CA/B8E,CA1HR,IAC7Eh5B,CAD6E,CAC1EY,CAD0E,CACtEo2B,CADsE,CAC9D3pB,CAD8D,CAC/B4qB,EAD+B,CACXjG,CADW,CACGrB,CADH,CAEtEsI,EAEP7B,EAAJ,GAAoBwB,CAApB,EACEtE,CACA,CADQ+C,CACR,CAAA1G,CAAA,CAAW0G,CAAA1C,UAFb,GAIEhE,CACA,CADW7xB,CAAA,CAAO85B,CAAP,CACX,CAAAtE,CAAA,CAAQ,IAAIE,EAAJ,CAAe7D,CAAf,CAAyB0G,CAAzB,CALV,CAQA6B,EAAA,CAAkB5tB,CACdusB,EAAJ,CACExqB,CADF,CACiB/B,CAAAynB,KAAA,CAAW,CAAA,CAAX,CADjB,CAEWoG,CAFX,GAGED,CAHF,CAGoB5tB,CAAAwnB,QAHpB,CAMIgC,EAAJ,GAGE9C,CAGA,CAHe6G,CAGf,CAFA7G,CAAAmB,kBAEA,CAFiC2B,CAEjC,CAAA9C,CAAAoH,aAAA,CAA4BC,QAAQ,CAAC/D,CAAD,CAAW,CAC7C,MAAO,CAAE,CAAAR,CAAAO,QAAA,CAA0BC,CAA1B,CADoC,CANjD,CAWIgD;CAAJ,GACEL,EADF,CACuBI,CAAA,CAAiB1H,CAAjB,CAA2B2D,CAA3B,CAAkCtC,CAAlC,CAAgDsG,CAAhD,CAAsEjrB,CAAtE,CAAoF/B,CAApF,CADvB,CAIIusB,EAAJ,GAEEtsB,CAAAioB,eAAA,CAAuB7C,CAAvB,CAAiCtjB,CAAjC,CAA+C,CAAA,CAA/C,CAAqD,EAAEisB,CAAF,GAAwBA,CAAxB,GAA8CzB,CAA9C,EACjDyB,CADiD,GAC3BzB,CAAA0B,oBAD2B,EAArD,CAQA,CANAhuB,CAAAknB,gBAAA,CAAwB9B,CAAxB,CAAkC,CAAA,CAAlC,CAMA,CALAtjB,CAAAijB,kBAKA,CAJIuH,CAAAvH,kBAIJ,EAHA2I,EAGA,CAH4BO,EAAA,CAA4BluB,CAA5B,CAAmCgpB,CAAnC,CAA0CjnB,CAA1C,CACEA,CAAAijB,kBADF,CAEEuH,CAFF,CAG5B,GACExqB,CAAAosB,IAAA,CAAiB,UAAjB,CAA6BR,EAA7B,CAXJ,CAgBA,KAAS5uB,CAAT,GAAiB4tB,GAAjB,CAAqC,CAC/ByB,EAAAA,CAAsBpB,CAAA,CAAqBjuB,CAArB,CAC1B,KAAIiD,EAAa2qB,EAAA,CAAmB5tB,CAAnB,CAAjB,CACIskB,GAAW+K,EAAArJ,WAAAH,iBAEX5iB,EAAAqsB,WAAJ,EAA6BhL,EAA7B,GACEiL,CADF,CAEIJ,EAAA,CAA4BN,CAA5B,CAA6C5E,CAA7C,CAAoDhnB,CAAAimB,SAApD,CAAyE5E,EAAzE,CAAmF+K,EAAnF,CAFJ,CAKA,KAAIG,EAAmBvsB,CAAA,EACnBusB,EAAJ,GAAyBvsB,CAAAimB,SAAzB,GAGEjmB,CAAAimB,SAGA,CAHsBsG,CAGtB,CAFAlJ,CAAAllB,KAAA,CAAc,GAAd,CAAoBiuB,EAAArvB,KAApB,CAA+C,YAA/C,CAA6DwvB,CAA7D,CAEA,CADAD,CACA,EADkCA,CAAA,EAClC,CAAAA,CAAA,CACEJ,EAAA,CAA4BN,CAA5B,CAA6C5E,CAA7C,CAAoDhnB,CAAAimB,SAApD,CAAyE5E,EAAzE,CAAmF+K,EAAnF,CAPJ,CAXmC,CAuBrCt6B,CAAA,CAAQk5B,CAAR,CAA8B,QAAQ,CAACoB,CAAD,CAAsBrvB,CAAtB,CAA4B,CAChE,IAAI2lB,EAAU0J,CAAA1J,QACV0J,EAAAxJ,iBAAJ,EAA6C,CAAAtxB,CAAA,CAAQoxB,CAAR,CAA7C;AAAiEnvB,CAAA,CAASmvB,CAAT,CAAjE,EACEtuB,CAAA,CAAOu2B,EAAA,CAAmB5tB,CAAnB,CAAAkpB,SAAP,CAA0CyE,CAAA,CAAe3tB,CAAf,CAAqB2lB,CAArB,CAA8BW,CAA9B,CAAwCsH,EAAxC,CAA1C,CAH8D,CAAlE,CAQA74B,EAAA,CAAQ64B,EAAR,CAA4B,QAAQ,CAAC3qB,CAAD,CAAa,CAC3C9N,CAAA,CAAW8N,CAAAimB,SAAAuG,QAAX,CAAJ,EACExsB,CAAAimB,SAAAuG,QAAA,EAF6C,CAAjD,CAOK95B,EAAA,CAAI,CAAT,KAAYY,CAAZ,CAAiB42B,CAAAz4B,OAAjB,CAAoCiB,CAApC,CAAwCY,CAAxC,CAA4CZ,CAAA,EAA5C,CACEg3B,CACA,CADSQ,CAAA,CAAWx3B,CAAX,CACT,CAAA+5B,EAAA,CAAa/C,CAAb,CACIA,CAAA3pB,aAAA,CAAsBA,CAAtB,CAAqC/B,CADzC,CAEIqlB,CAFJ,CAGI2D,CAHJ,CAII0C,CAAAhH,QAJJ,EAIsBgI,CAAA,CAAehB,CAAAxI,cAAf,CAAqCwI,CAAAhH,QAArC,CAAqDW,CAArD,CAA+DsH,EAA/D,CAJtB,CAKIjG,CALJ,CAYF,KAAIgH,GAAe1tB,CACfusB,EAAJ,GAAiCA,CAAAhH,SAAjC,EAA+G,IAA/G,GAAsEgH,CAAA/G,YAAtE,IACEkI,EADF,CACiB3rB,CADjB,CAGAsmB,EAAA,EAAeA,CAAA,CAAYqF,EAAZ,CAA0BJ,CAAArb,WAA1B,CAA+Chf,CAA/C,CAA0Du2B,CAA1D,CAGf,KAAK90B,CAAL,CAASy3B,CAAA14B,OAAT,CAA8B,CAA9B,CAAsC,CAAtC,EAAiCiB,CAAjC,CAAyCA,CAAA,EAAzC,CACEg3B,CACA,CADSS,CAAA,CAAYz3B,CAAZ,CACT,CAAA+5B,EAAA,CAAa/C,CAAb,CACIA,CAAA3pB,aAAA,CAAsBA,CAAtB,CAAqC/B,CADzC,CAEIqlB,CAFJ,CAGI2D,CAHJ,CAII0C,CAAAhH,QAJJ,EAIsBgI,CAAA,CAAehB,CAAAxI,cAAf,CAAqCwI,CAAAhH,QAArC,CAAqDW,CAArD,CAA+DsH,EAA/D,CAJtB,CAKIjG,CALJ,CA/G+E,CAtYnFG,CAAA,CAAyBA,CAAzB,EAAmD,EAuBnD,KAxBqD,IAGjD6H,EAAmB,CAACpM,MAAAC,UAH6B,CAIjDsL,EAAoBhH,CAAAgH,kBAJ6B,CAKjDb,EAAuBnG,CAAAmG,qBAL0B,CAMjDT,EAA2B1F,CAAA0F,yBANsB;AAOjDyB,EAAoBnH,CAAAmH,kBAP6B,CAQjDW,EAA4B9H,CAAA8H,0BARqB,CASjDC,EAAyB,CAAA,CATwB,CAUjDC,GAAc,CAAA,CAVmC,CAWjDxB,EAAgCxG,CAAAwG,8BAXiB,CAYjDyB,GAAe/C,CAAA1C,UAAfyF,CAAyCt7B,CAAA,CAAOs4B,CAAP,CAZQ,CAajDvmB,CAbiD,CAcjD2d,CAdiD,CAejD6L,CAfiD,CAiBjDC,GAAoBtI,CAjB6B,CAkBjDgF,CAlBiD,CAmBjDuD,EAAiC,CAAA,CAnBgB,CAoBjDC,GAAqC,CAAA,CApBY,CAqBjDC,EArBiD,CAwB5Cz6B,EAAI,CAxBwC,CAwBrCY,GAAKkvB,CAAA/wB,OAArB,CAAwCiB,CAAxC,CAA4CY,EAA5C,CAAgDZ,CAAA,EAAhD,CAAqD,CACnD6Q,CAAA,CAAYif,CAAA,CAAW9vB,CAAX,CACZ,KAAI42B,EAAY/lB,CAAA6pB,QAAhB,CACI7D,GAAUhmB,CAAA8pB,MAGV/D,EAAJ,GACEwD,EADF,CACiBzD,CAAA,CAAUS,CAAV,CAAuBR,CAAvB,CAAkCC,EAAlC,CADjB,CAGAwD,EAAA,CAAY97B,CAEZ,IAAIy7B,CAAJ,CAAuBnpB,CAAAkf,SAAvB,CACE,KAGF,IAAI0K,EAAJ,CAAqB5pB,CAAAvF,MAArB,CAIOuF,CAAAigB,YAeL,GAdMjwB,CAAA,CAAS45B,EAAT,CAAJ,EAGEG,EAAA,CAAkB,oBAAlB,CAAwC/C,CAAxC,EAAoEsB,CAApE,CACkBtoB,CADlB,CAC6BupB,EAD7B,CAEA,CAAAvC,CAAA,CAA2BhnB,CAL7B,EASE+pB,EAAA,CAAkB,oBAAlB,CAAwC/C,CAAxC,CAAkEhnB,CAAlE,CACkBupB,EADlB,CAKJ,EAAAjB,CAAA,CAAoBA,CAApB,EAAyCtoB,CAG3C2d,EAAA,CAAgB3d,CAAAxG,KAQhB,IAAKkwB,CAAAA,CAAL,GAAyC1pB,CAAArJ,QAAzC,GAA+DqJ,CAAAigB,YAA/D,EAAwFjgB,CAAAggB,SAAxF,GACQhgB,CAAAkgB,WADR,EACiC8J,CAAAhqB,CAAAgqB,MADjC,EACoD,CAG5C,IAASC,EAAT,CAAyB96B,CAAzB,CAA6B,CAA7B,CAAgC+6B,CAAhC,CAAqDjL,CAAA,CAAWgL,EAAA,EAAX,CAArD,CAAA,CACI,GAAKC,CAAAhK,WAAL,EAAuC8J,CAAAE,CAAAF,MAAvC,EACQE,CAAAvzB,QADR;CACuCuzB,CAAAjK,YADvC,EACyEiK,CAAAlK,SADzE,EACwG,CACpG2J,EAAA,CAAqC,CAAA,CACrC,MAFoG,CAM5GD,CAAA,CAAiC,CAAA,CAXW,CAc/CzJ,CAAAjgB,CAAAigB,YAAL,EAA8BjgB,CAAAvD,WAA9B,GACEmtB,EAIA,CAJiB5pB,CAAAvD,WAIjB,CAHAgrB,CAGA,CAHuBA,CAGvB,EAH+CpyB,CAAA,EAG/C,CAFA00B,EAAA,CAAkB,GAAlB,CAAwBpM,CAAxB,CAAwC,cAAxC,CACI8J,CAAA,CAAqB9J,CAArB,CADJ,CACyC3d,CADzC,CACoDupB,EADpD,CAEA,CAAA9B,CAAA,CAAqB9J,CAArB,CAAA,CAAsC3d,CALxC,CAQA,IAAI4pB,EAAJ,CAAqB5pB,CAAAkgB,WAArB,CAWE,GAVAmJ,CAUI,CAVqB,CAAA,CAUrB,CALCrpB,CAAAgqB,MAKD,GAJFD,EAAA,CAAkB,cAAlB,CAAkCX,CAAlC,CAA6DppB,CAA7D,CAAwEupB,EAAxE,CACA,CAAAH,CAAA,CAA4BppB,CAG1B,EAAkB,SAAlB,EAAA4pB,EAAJ,CACE9B,CASA,CATgC,CAAA,CAShC,CARAqB,CAQA,CARmBnpB,CAAAkf,SAQnB,CAPAsK,CAOA,CAPYD,EAOZ,CANAA,EAMA,CANe/C,CAAA1C,UAMf,CALI71B,CAAA,CAAOR,CAAA08B,cAAA,CAAuB,GAAvB,CAA6BxM,CAA7B,CAA6C,IAA7C,CACuB6I,CAAA,CAAc7I,CAAd,CADvB,CACsD,GADtD,CAAP,CAKJ,CAHA4I,CAGA,CAHcgD,EAAA,CAAa,CAAb,CAGd,CAFAa,EAAA,CAAY3D,CAAZ,CA5uOH31B,EAAAjC,KAAA,CA4uOuC26B,CA5uOvC,CAA+B,CAA/B,CA4uOG,CAAgDjD,CAAhD,CAEA,CAAAkD,EAAA,CAAoBrD,EAAA,CAAqBuD,EAArB,CAAyDH,CAAzD,CAAoErI,CAApE,CAAkFgI,CAAlF,CACQkB,CADR,EAC4BA,CAAA7wB,KAD5B,CACmD,CAQzC4vB,0BAA2BA,CARc,CADnD,CAVtB,KAqBO,CAEL,IAAIkB,EAAQj1B,CAAA,EAEZm0B,EAAA,CAAYv7B,CAAA,CAAOuf,EAAA,CAAY+Y,CAAZ,CAAP,CAAAgE,SAAA,EAEZ,IAAIv6B,CAAA,CAAS45B,EAAT,CAAJ,CAA8B,CAI5BJ,CAAA,CAAY,EAEZ,KAAIgB,GAAUn1B,CAAA,EAAd,CACIo1B,GAAcp1B,CAAA,EAGlB9G,EAAA,CAAQq7B,EAAR,CAAwB,QAAQ,CAACc,CAAD,CAAkBjG,CAAlB,CAA4B,CAE1D,IAAIrG,EAA0C,GAA1CA,GAAYsM,CAAA71B,OAAA,CAAuB,CAAvB,CAChB61B;CAAA,CAAkBtM,CAAA,CAAWsM,CAAAryB,UAAA,CAA0B,CAA1B,CAAX,CAA0CqyB,CAE5DF,GAAA,CAAQE,CAAR,CAAA,CAA2BjG,CAK3B6F,EAAA,CAAM7F,CAAN,CAAA,CAAkB,IAIlBgG,GAAA,CAAYhG,CAAZ,CAAA,CAAwBrG,CAdkC,CAA5D,CAkBA7vB,EAAA,CAAQg7B,EAAAgB,SAAA,EAAR,CAAiC,QAAQ,CAAC/3B,CAAD,CAAO,CAC9C,IAAIiyB,EAAW+F,EAAA,CAAQ3F,EAAA,CAAmB9xB,EAAA,CAAUP,CAAV,CAAnB,CAAR,CACXiyB,EAAJ,EACEgG,EAAA,CAAYhG,CAAZ,CAEA,CAFwB,CAAA,CAExB,CADA6F,CAAA,CAAM7F,CAAN,CACA,CADkB6F,CAAA,CAAM7F,CAAN,CAClB,EADqC,EACrC,CAAA6F,CAAA,CAAM7F,CAAN,CAAA9wB,KAAA,CAAqBnB,CAArB,CAHF,EAKEg3B,CAAA71B,KAAA,CAAenB,CAAf,CAP4C,CAAhD,CAYAjE,EAAA,CAAQk8B,EAAR,CAAqB,QAAQ,CAACE,CAAD,CAASlG,CAAT,CAAmB,CAC9C,GAAKkG,CAAAA,CAAL,CACE,KAAM1M,GAAA,CAAe,SAAf,CAA8EwG,CAA9E,CAAN,CAF4C,CAAhD,CAMA,KAASA,IAAAA,EAAT,GAAqB6F,EAArB,CACMA,CAAA,CAAM7F,EAAN,CAAJ,GAEE6F,CAAA,CAAM7F,EAAN,CAFF,CAEoB2B,EAAA,CAAqBuD,EAArB,CAAyDW,CAAA,CAAM7F,EAAN,CAAzD,CAA0EtD,CAA1E,CAFpB,CA/C0B,CAsD9BoI,EAAA9xB,MAAA,EACAgyB,GAAA,CAAoBrD,EAAA,CAAqBuD,EAArB,CAAyDH,CAAzD,CAAoErI,CAApE,CAAkFzzB,CAAlF,CAChBA,CADgB,CACL,CAAEs0B,cAAehiB,CAAAinB,eAAfjF,EAA2ChiB,CAAA4qB,WAA7C,CADK,CAEpBnB,GAAAjF,QAAA,CAA4B8F,CA/DvB,CAmET,GAAItqB,CAAAggB,SAAJ,CAWE,GAVAsJ,EAUI3yB,CAVU,CAAA,CAUVA,CATJozB,EAAA,CAAkB,UAAlB,CAA8BtB,CAA9B,CAAiDzoB,CAAjD,CAA4DupB,EAA5D,CASI5yB,CARJ8xB,CAQI9xB,CARgBqJ,CAQhBrJ,CANJizB,EAMIjzB,CANchI,CAAA,CAAWqR,CAAAggB,SAAX,CAAD,CACXhgB,CAAAggB,SAAA,CAAmBuJ,EAAnB,CAAiC/C,CAAjC,CADW,CAEXxmB,CAAAggB,SAIFrpB,CAFJizB,EAEIjzB,CAFak0B,EAAA,CAAoBjB,EAApB,CAEbjzB,CAAAqJ,CAAArJ,QAAJ,CAAuB,CACrB0zB,CAAA,CAAmBrqB,CAIjBwpB,EAAA,CA1yLJzd,EAAAxZ,KAAA,CAuyLuBq3B,EAvyLvB,CAuyLE,CAGckB,EAAA,CAAetI,CAAA,CAAaxiB,CAAA+qB,kBAAb,CAA0C5d,CAAA,CAAKyc,EAAL,CAA1C,CAAf,CAHd,CACc,EAIdrD;CAAA,CAAciD,CAAA,CAAU,CAAV,CAEd,IAAwB,CAAxB,EAAIA,CAAAt7B,OAAJ,EAlnNYud,CAknNZ,GAA6B8a,CAAAzuB,SAA7B,CACE,KAAMmmB,GAAA,CAAe,OAAf,CAEFN,CAFE,CAEa,EAFb,CAAN,CAKFyM,EAAA,CAAY3D,CAAZ,CAA0B8C,EAA1B,CAAwChD,CAAxC,CAEIyE,GAAAA,CAAmB,CAACrG,MAAO,EAAR,CAOnBsG,GAAAA,CAAqBrH,EAAA,CAAkB2C,CAAlB,CAA+B,EAA/B,CAAmCyE,EAAnC,CACzB,KAAIE,GAAwBjM,CAAA3rB,OAAA,CAAkBnE,CAAlB,CAAsB,CAAtB,CAAyB8vB,CAAA/wB,OAAzB,EAA8CiB,CAA9C,CAAkD,CAAlD,EAE5B,EAAI63B,CAAJ,EAAgCsB,CAAhC,GAIE6C,EAAA,CAAmBF,EAAnB,CAAuCjE,CAAvC,CAAiEsB,CAAjE,CAEFrJ,EAAA,CAAaA,CAAA3pB,OAAA,CAAkB21B,EAAlB,CAAA31B,OAAA,CAA6C41B,EAA7C,CACbE,GAAA,CAAwB5E,CAAxB,CAAuCwE,EAAvC,CAEAj7B,GAAA,CAAKkvB,CAAA/wB,OApCgB,CAAvB,IAsCEq7B,GAAA1xB,KAAA,CAAkB+xB,EAAlB,CAIJ,IAAI5pB,CAAAigB,YAAJ,CACEqJ,EAgBA,CAhBc,CAAA,CAgBd,CAfAS,EAAA,CAAkB,UAAlB,CAA8BtB,CAA9B,CAAiDzoB,CAAjD,CAA4DupB,EAA5D,CAeA,CAdAd,CAcA,CAdoBzoB,CAcpB,CAZIA,CAAArJ,QAYJ,GAXE0zB,CAWF,CAXqBrqB,CAWrB,EARAqjB,CAQA,CARagI,EAAA,CAAmBpM,CAAA3rB,OAAA,CAAkBnE,CAAlB,CAAqB8vB,CAAA/wB,OAArB,CAAyCiB,CAAzC,CAAnB,CAAgEo6B,EAAhE,CACT/C,CADS,CACMC,CADN,CACoB4C,CADpB,EAC8CI,EAD9C,CACiE9C,CADjE,CAC6EC,CAD7E,CAC0F,CACjGa,qBAAsBA,CAD2E,CAEjGa,kBAAoBA,CAApBA,GAA0CtoB,CAA1CsoB,EAAwDA,CAFyC,CAGjGtB,yBAA0BA,CAHuE,CAIjGyB,kBAAmBA,CAJ8E,CAKjGW,0BAA2BA,CALsE,CAD1F,CAQb,CAAAr5B,EAAA,CAAKkvB,CAAA/wB,OAjBP,KAkBO,IAAI8R,CAAAtF,QAAJ,CACL,GAAI,CACFyrB,CACA,CADSnmB,CAAAtF,QAAA,CAAkB6uB,EAAlB;AAAgC/C,CAAhC,CAA+CiD,EAA/C,CACT,CAAI96B,CAAA,CAAWw3B,CAAX,CAAJ,CACEU,CAAA,CAAW,IAAX,CAAiBV,CAAjB,CAAyBJ,CAAzB,CAAoCC,EAApC,CADF,CAEWG,CAFX,EAGEU,CAAA,CAAWV,CAAAW,IAAX,CAAuBX,CAAAY,KAAvB,CAAoChB,CAApC,CAA+CC,EAA/C,CALA,CAOF,MAAOtuB,EAAP,CAAU,CACVgQ,CAAA,CAAkBhQ,EAAlB,CAAqBF,EAAA,CAAY+xB,EAAZ,CAArB,CADU,CAKVvpB,CAAA+jB,SAAJ,GACEV,CAAAU,SACA,CADsB,CAAA,CACtB,CAAAoF,CAAA,CAAmBmC,IAAAC,IAAA,CAASpC,CAAT,CAA2BnpB,CAAAkf,SAA3B,CAFrB,CA3PmD,CAkQrDmE,CAAA5oB,MAAA,CAAmB6tB,CAAnB,EAAoE,CAAA,CAApE,GAAwCA,CAAA7tB,MACxC4oB,EAAAC,wBAAA,CAAqC+F,CACrChG,EAAAG,sBAAA,CAAmC8F,EACnCjG,EAAAnD,WAAA,CAAwBuJ,EAExBnI,EAAAwG,8BAAA,CAAuDA,CAGvD,OAAOzE,EAlS8C,CA4iBvD8H,QAASA,GAAkB,CAAClM,CAAD,CAAaziB,CAAb,CAA2BgvB,CAA3B,CAAqC,CAC9D,IAD8D,IACrDv7B,EAAI,CADiD,CAC9CC,EAAK+uB,CAAA/wB,OAArB,CAAwC+B,CAAxC,CAA4CC,CAA5C,CAAgDD,CAAA,EAAhD,CACEgvB,CAAA,CAAWhvB,CAAX,CAAA,CAAgBmB,EAAA,CAAQ6tB,CAAA,CAAWhvB,CAAX,CAAR,CAAuB,CAACg3B,eAAgBzqB,CAAjB,CAA+BouB,WAAYY,CAA3C,CAAvB,CAF4C,CAoBhE5G,QAASA,EAAY,CAAC6G,CAAD,CAAcjyB,CAAd,CAAoB6B,CAApB,CAA8B+lB,CAA9B,CAA2CC,CAA3C,CAA4DqK,CAA5D,CACCC,CADD,CACc,CACjC,GAAInyB,CAAJ,GAAa6nB,CAAb,CAA8B,MAAO,KACjC3sB,EAAAA,CAAQ,IACZ,IAAI6pB,CAAA3vB,eAAA,CAA6B4K,CAA7B,CAAJ,CAAwC,CAAA,IAC7BwG,CAAWif,EAAAA,CAAa9I,CAAA1a,IAAA,CAAcjC,CAAd,CAjqD1BwlB,WAiqD0B,CAAjC,KADsC,IAElC7vB,EAAI,CAF8B,CAE3BY,EAAKkvB,CAAA/wB,OADhB,CACmCiB,CADnC,CACuCY,CADvC,CAC2CZ,CAAA,EAD3C,CAEE,GAAI,CACF6Q,CACA;AADYif,CAAA,CAAW9vB,CAAX,CACZ,EAAK2C,CAAA,CAAYsvB,CAAZ,CAAL,EAAiCA,CAAjC,CAA+CphB,CAAAkf,SAA/C,GAC8C,EAD9C,EACKlf,CAAAof,SAAA/rB,QAAA,CAA2BgI,CAA3B,CADL,GAEMqwB,CAIJ,GAHE1rB,CAGF,CAHc5O,EAAA,CAAQ4O,CAAR,CAAmB,CAAC6pB,QAAS6B,CAAV,CAAyB5B,MAAO6B,CAAhC,CAAnB,CAGd,EADAF,CAAA93B,KAAA,CAAiBqM,CAAjB,CACA,CAAAtL,CAAA,CAAQsL,CANV,CAFE,CAUF,MAAOtI,CAAP,CAAU,CAAEgQ,CAAA,CAAkBhQ,CAAlB,CAAF,CAbwB,CAgBxC,MAAOhD,EAnB0B,CA+BnC6wB,QAASA,EAAuB,CAAC/rB,CAAD,CAAO,CACrC,GAAI+kB,CAAA3vB,eAAA,CAA6B4K,CAA7B,CAAJ,CACE,IADsC,IAClBylB,EAAa9I,CAAA1a,IAAA,CAAcjC,CAAd,CA9rD1BwlB,WA8rD0B,CADK,CAElC7vB,EAAI,CAF8B,CAE3BY,EAAKkvB,CAAA/wB,OADhB,CACmCiB,CADnC,CACuCY,CADvC,CAC2CZ,CAAA,EAD3C,CAGE,GADA6Q,CACI4rB,CADQ3M,CAAA,CAAW9vB,CAAX,CACRy8B,CAAA5rB,CAAA4rB,aAAJ,CACE,MAAO,CAAA,CAIb,OAAO,CAAA,CAV8B,CAqBvCR,QAASA,GAAuB,CAAC17B,CAAD,CAAMS,CAAN,CAAW,CAAA,IACrC07B,EAAU17B,CAAAw0B,MAD2B,CAErCmH,EAAUp8B,CAAAi1B,MAF2B,CAGrC7E,EAAWpwB,CAAAo0B,UAGfv1B,EAAA,CAAQmB,CAAR,CAAa,QAAQ,CAACJ,CAAD,CAAQZ,CAAR,CAAa,CACX,GAArB,EAAIA,CAAAmG,OAAA,CAAW,CAAX,CAAJ,GACM1E,CAAA,CAAIzB,CAAJ,CAGJ,EAHgByB,CAAA,CAAIzB,CAAJ,CAGhB,GAH6BY,CAG7B,GAFEA,CAEF,GAFoB,OAAR,GAAAZ,CAAA,CAAkB,GAAlB,CAAwB,GAEpC,EAF2CyB,CAAA,CAAIzB,CAAJ,CAE3C,EAAAgB,CAAAq8B,KAAA,CAASr9B,CAAT,CAAcY,CAAd,CAAqB,CAAA,CAArB,CAA2Bu8B,CAAA,CAAQn9B,CAAR,CAA3B,CAJF,CADgC,CAAlC,CAUAH,EAAA,CAAQ4B,CAAR,CAAa,QAAQ,CAACb,CAAD,CAAQZ,CAAR,CAAa,CACrB,OAAX,EAAIA,CAAJ,EACEsyB,CAAA,CAAalB,CAAb,CAAuBxwB,CAAvB,CACA,CAAAI,CAAA,CAAI,OAAJ,CAAA,EAAgBA,CAAA,CAAI,OAAJ,CAAA,CAAeA,CAAA,CAAI,OAAJ,CAAf,CAA8B,GAA9B,CAAoC,EAApD;AAA0DJ,CAF5D,EAGkB,OAAX,EAAIZ,CAAJ,EACLoxB,CAAAptB,KAAA,CAAc,OAAd,CAAuBotB,CAAAptB,KAAA,CAAc,OAAd,CAAvB,CAAgD,GAAhD,CAAsDpD,CAAtD,CACA,CAAAI,CAAA,MAAA,EAAgBA,CAAA,MAAA,CAAeA,CAAA,MAAf,CAA8B,GAA9B,CAAoC,EAApD,EAA0DJ,CAFrD,EAMqB,GANrB,EAMIZ,CAAAmG,OAAA,CAAW,CAAX,CANJ,EAM6BnF,CAAAd,eAAA,CAAmBF,CAAnB,CAN7B,GAOLgB,CAAA,CAAIhB,CAAJ,CACA,CADWY,CACX,CAAAw8B,CAAA,CAAQp9B,CAAR,CAAA,CAAem9B,CAAA,CAAQn9B,CAAR,CARV,CAJyB,CAAlC,CAhByC,CAkC3C28B,QAASA,GAAkB,CAACpM,CAAD,CAAasK,CAAb,CAA2B1J,CAA3B,CACvBgD,CADuB,CACT4G,CADS,CACU9C,CADV,CACsBC,CADtB,CACmCtF,CADnC,CAC2D,CAAA,IAChF0K,EAAY,EADoE,CAEhFC,CAFgF,CAGhFC,CAHgF,CAIhFC,EAA4B5C,CAAA,CAAa,CAAb,CAJoD,CAKhF6C,EAAqBnN,CAAA1J,MAAA,EAL2D,CAMhF8W,EAAuBj7B,EAAA,CAAQg7B,CAAR,CAA4B,CACjDnM,YAAa,IADoC,CAC9BC,WAAY,IADkB,CACZvpB,QAAS,IADG,CACG+xB,oBAAqB0D,CADxB,CAA5B,CANyD,CAShFnM,EAAetxB,CAAA,CAAWy9B,CAAAnM,YAAX,CAAD,CACRmM,CAAAnM,YAAA,CAA+BsJ,CAA/B,CAA6C1J,CAA7C,CADQ,CAERuM,CAAAnM,YAX0E,CAYhF8K,EAAoBqB,CAAArB,kBAExBxB,EAAA9xB,MAAA,EAEAyS,EAAA,CAAiB+V,CAAjB,CAAAqM,KAAA,CACQ,QAAQ,CAACC,CAAD,CAAU,CAAA,IAClBhG,CADkB,CACyBvD,CAE/CuJ,EAAA,CAAU1B,EAAA,CAAoB0B,CAApB,CAEV,IAAIH,CAAAz1B,QAAJ,CAAgC,CAI5B6yB,CAAA,CA7wMJzd,EAAAxZ,KAAA,CA0wMuBg6B,CA1wMvB,CA0wME,CAGczB,EAAA,CAAetI,CAAA,CAAauI,CAAb,CAAgC5d,CAAA,CAAKof,CAAL,CAAhC,CAAf,CAHd,CACc,EAIdhG,EAAA,CAAciD,CAAA,CAAU,CAAV,CAEd,IAAwB,CAAxB,EAAIA,CAAAt7B,OAAJ,EArlOYud,CAqlOZ,GAA6B8a,CAAAzuB,SAA7B,CACE,KAAMmmB,GAAA,CAAe,OAAf;AAEFmO,CAAA5yB,KAFE,CAEuBymB,CAFvB,CAAN,CAKFuM,CAAA,CAAoB,CAAC7H,MAAO,EAAR,CACpByF,GAAA,CAAYvH,CAAZ,CAA0B0G,CAA1B,CAAwChD,CAAxC,CACA,KAAI0E,EAAqBrH,EAAA,CAAkB2C,CAAlB,CAA+B,EAA/B,CAAmCiG,CAAnC,CAErBx8B,EAAA,CAASo8B,CAAA3xB,MAAT,CAAJ,EAGE0wB,EAAA,CAAmBF,CAAnB,CAAuC,CAAA,CAAvC,CAEFhM,EAAA,CAAagM,CAAA31B,OAAA,CAA0B2pB,CAA1B,CACbmM,GAAA,CAAwBvL,CAAxB,CAAgC2M,CAAhC,CAxB8B,CAAhC,IA0BEjG,EACA,CADc4F,CACd,CAAA5C,CAAA1xB,KAAA,CAAkB00B,CAAlB,CAGFtN,EAAA/kB,QAAA,CAAmBmyB,CAAnB,CAEAJ,EAAA,CAA0BpI,CAAA,CAAsB5E,CAAtB,CAAkCsH,CAAlC,CAA+C1G,CAA/C,CACtB4J,CADsB,CACHF,CADG,CACW6C,CADX,CAC+BzF,CAD/B,CAC2CC,CAD3C,CAEtBtF,CAFsB,CAG1B/yB,EAAA,CAAQs0B,CAAR,CAAsB,QAAQ,CAACrwB,CAAD,CAAOrD,CAAP,CAAU,CAClCqD,CAAJ,EAAY+zB,CAAZ,GACE1D,CAAA,CAAa1zB,CAAb,CADF,CACoBo6B,CAAA,CAAa,CAAb,CADpB,CADsC,CAAxC,CAOA,KAFA2C,CAEA,CAF2BvK,CAAA,CAAa4H,CAAA,CAAa,CAAb,CAAA7c,WAAb,CAAyC+c,CAAzC,CAE3B,CAAOuC,CAAA99B,OAAP,CAAA,CAAyB,CACnBuM,CAAAA,CAAQuxB,CAAAzW,MAAA,EACRkX,EAAAA,CAAyBT,CAAAzW,MAAA,EAFN,KAGnBmX,EAAkBV,CAAAzW,MAAA,EAHC,CAInB0O,EAAoB+H,CAAAzW,MAAA,EAJD,CAKnBwS,EAAWwB,CAAA,CAAa,CAAb,CAEf,IAAIoD,CAAAlyB,CAAAkyB,YAAJ,CAAA,CAEA,GAAIF,CAAJ,GAA+BN,CAA/B,CAA0D,CACxD,IAAIS,GAAaH,CAAAxL,UAEXK,EAAAwG,8BAAN,EACIsE,CAAAz1B,QADJ,GAGEoxB,CAHF,CAGava,EAAA,CAAY+Y,CAAZ,CAHb,CAKA6D,GAAA,CAAYsC,CAAZ,CAA6Bz+B,CAAA,CAAOw+B,CAAP,CAA7B,CAA6D1E,CAA7D,CAGA/G,EAAA,CAAa/yB,CAAA,CAAO85B,CAAP,CAAb,CAA+B6E,EAA/B,CAXwD,CAcxD5J,CAAA,CADEiJ,CAAA3I,wBAAJ,CAC2BC,CAAA,CAAwB9oB,CAAxB,CAA+BwxB,CAAA/L,WAA/B,CAAmE+D,CAAnE,CAD3B,CAG2BA,CAE3BgI,EAAA,CAAwBC,CAAxB,CAAkDzxB,CAAlD,CAAyDstB,CAAzD,CAAmElF,CAAnE,CACEG,CADF,CApBA,CAPuB,CA8BzBgJ,CAAA,CAAY,IA7EU,CAD1B,CAiFA,OAAOa,SAA0B,CAACC,CAAD,CAAoBryB,CAApB;AAA2BjI,CAA3B,CAAiCgJ,CAAjC,CAA8CyoB,CAA9C,CAAiE,CAC5FjB,CAAAA,CAAyBiB,CACzBxpB,EAAAkyB,YAAJ,GACIX,CAAJ,CACEA,CAAAr4B,KAAA,CAAe8G,CAAf,CACejI,CADf,CAEegJ,CAFf,CAGewnB,CAHf,CADF,EAMMiJ,CAAA3I,wBAGJ,GAFEN,CAEF,CAF2BO,CAAA,CAAwB9oB,CAAxB,CAA+BwxB,CAAA/L,WAA/B,CAAmE+D,CAAnE,CAE3B,EAAAgI,CAAA,CAAwBC,CAAxB,CAAkDzxB,CAAlD,CAAyDjI,CAAzD,CAA+DgJ,CAA/D,CAA4EwnB,CAA5E,CATF,CADA,CAFgG,CAjGd,CAsHtF6C,QAASA,GAAU,CAAC/kB,CAAD,CAAIwX,CAAJ,CAAO,CACxB,IAAIyU,EAAOzU,CAAA4G,SAAP6N,CAAoBjsB,CAAAoe,SACxB,OAAa,EAAb,GAAI6N,CAAJ,CAAuBA,CAAvB,CACIjsB,CAAAtH,KAAJ,GAAe8e,CAAA9e,KAAf,CAA+BsH,CAAAtH,KAAD,CAAU8e,CAAA9e,KAAV,CAAqB,EAArB,CAAyB,CAAvD,CACOsH,CAAA1N,MADP,CACiBklB,CAAAllB,MAJO,CAO1B22B,QAASA,GAAiB,CAACiD,CAAD,CAAOC,CAAP,CAA0BjtB,CAA1B,CAAqChN,CAArC,CAA8C,CAEtEk6B,QAASA,EAAuB,CAACC,CAAD,CAAa,CAC3C,MAAOA,EAAA,CACJ,YADI,CACWA,CADX,CACwB,GADxB,CAEL,EAHyC,CAM7C,GAAIF,CAAJ,CACE,KAAMhP,GAAA,CAAe,UAAf,CACFgP,CAAAzzB,KADE,CACsB0zB,CAAA,CAAwBD,CAAA5tB,aAAxB,CADtB,CAEFW,CAAAxG,KAFE,CAEc0zB,CAAA,CAAwBltB,CAAAX,aAAxB,CAFd,CAE+D2tB,CAF/D,CAEqEx1B,EAAA,CAAYxE,CAAZ,CAFrE,CAAN,CAToE,CAgBxE2yB,QAASA,EAA2B,CAAC1G,CAAD,CAAamO,CAAb,CAAmB,CACrD,IAAIC,EAAgBrlB,CAAA,CAAaolB,CAAb,CAAmB,CAAA,CAAnB,CAChBC,EAAJ,EACEpO,CAAAtrB,KAAA,CAAgB,CACdurB,SAAU,CADI,CAEdxkB,QAAS4yB,QAAiC,CAACC,CAAD,CAAe,CACnDC,CAAAA,CAAqBD,CAAAl8B,OAAA,EAAzB,KACIo8B,EAAmB,CAAEv/B,CAAAs/B,CAAAt/B,OAIrBu/B,EAAJ,EAAsB/yB,CAAAgzB,kBAAA,CAA0BF,CAA1B,CAEtB;MAAOG,SAA8B,CAAClzB,CAAD,CAAQjI,CAAR,CAAc,CACjD,IAAInB,EAASmB,CAAAnB,OAAA,EACRo8B,EAAL,EAAuB/yB,CAAAgzB,kBAAA,CAA0Br8B,CAA1B,CACvBqJ,EAAAkzB,iBAAA,CAAyBv8B,CAAzB,CAAiCg8B,CAAAQ,YAAjC,CACApzB,EAAAtI,OAAA,CAAak7B,CAAb,CAA4BS,QAAiC,CAACx+B,CAAD,CAAQ,CACnEkD,CAAA,CAAK,CAAL,CAAAivB,UAAA,CAAoBnyB,CAD+C,CAArE,CAJiD,CARI,CAF3C,CAAhB,CAHmD,CA2BvDkzB,QAASA,EAAY,CAACxU,CAAD,CAAOgS,CAAP,CAAiB,CACpChS,CAAA,CAAO/a,CAAA,CAAU+a,CAAV,EAAkB,MAAlB,CACP,QAAQA,CAAR,EACA,KAAK,KAAL,CACA,KAAK,MAAL,CACE,IAAIjB,EAAUtf,CAAAwe,cAAA,CAAuB,KAAvB,CACdc,EAAAR,UAAA,CAAoB,GAApB,CAA0ByB,CAA1B,CAAiC,GAAjC,CAAuCgS,CAAvC,CAAkD,IAAlD,CAAyDhS,CAAzD,CAAgE,GAChE,OAAOjB,EAAAL,WAAA,CAAmB,CAAnB,CAAAA,WACT,SACE,MAAOsT,EAPT,CAFoC,CActC+N,QAASA,EAAiB,CAACv7B,CAAD,CAAOw7B,CAAP,CAA2B,CACnD,GAA0B,QAA1B,EAAIA,CAAJ,CACE,MAAOtkB,GAAAukB,KAET,KAAIh0B,EAAMlH,EAAA,CAAUP,CAAV,CAEV,IAA0B,WAA1B,EAAIw7B,CAAJ,EACY,MADZ,EACK/zB,CADL,EAC4C,QAD5C,EACsB+zB,CADtB,EAEY,KAFZ,EAEK/zB,CAFL,GAE4C,KAF5C,EAEsB+zB,CAFtB,EAG4C,OAH5C,EAGsBA,CAHtB,EAIE,MAAOtkB,GAAAwkB,aAV0C,CAerDzI,QAASA,EAA2B,CAACjzB,CAAD,CAAOysB,CAAP,CAAmB3vB,CAAnB,CAA0BkK,CAA1B;AAAgC20B,CAAhC,CAA8C,CAChF,IAAIC,EAAiBL,CAAA,CAAkBv7B,CAAlB,CAAwBgH,CAAxB,CACrB20B,EAAA,CAAezP,CAAA,CAAqBllB,CAArB,CAAf,EAA6C20B,CAE7C,KAAId,EAAgBrlB,CAAA,CAAa1Y,CAAb,CAAoB,CAAA,CAApB,CAA0B8+B,CAA1B,CAA0CD,CAA1C,CAGpB,IAAKd,CAAL,CAAA,CAGA,GAAa,UAAb,GAAI7zB,CAAJ,EAA+C,QAA/C,GAA2BzG,EAAA,CAAUP,CAAV,CAA3B,CACE,KAAMyrB,GAAA,CAAe,UAAf,CAEFzmB,EAAA,CAAYhF,CAAZ,CAFE,CAAN,CAKFysB,CAAAtrB,KAAA,CAAgB,CACdurB,SAAU,GADI,CAEdxkB,QAASA,QAAQ,EAAG,CAChB,MAAO,CACLosB,IAAKuH,QAAiC,CAAC5zB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CACvD47B,CAAAA,CAAe57B,CAAA47B,YAAfA,GAAoC57B,CAAA47B,YAApCA,CAAuDj5B,CAAA,EAAvDi5B,CAEJ,IAAI1P,CAAArsB,KAAA,CAA+BiH,CAA/B,CAAJ,CACE,KAAMykB,GAAA,CAAe,aAAf,CAAN,CAMF,IAAIsQ,EAAW77B,CAAA,CAAK8G,CAAL,CACX+0B,EAAJ,GAAiBj/B,CAAjB,GAIE+9B,CACA,CADgBkB,CAChB,EAD4BvmB,CAAA,CAAaumB,CAAb,CAAuB,CAAA,CAAvB,CAA6BH,CAA7B,CAA6CD,CAA7C,CAC5B,CAAA7+B,CAAA,CAAQi/B,CALV,CAUKlB,EAAL,GAKA36B,CAAA,CAAK8G,CAAL,CAGA,CAHa6zB,CAAA,CAAc5yB,CAAd,CAGb,CADA+zB,CAACF,CAAA,CAAY90B,CAAZ,CAADg1B,GAAuBF,CAAA,CAAY90B,CAAZ,CAAvBg1B,CAA2C,EAA3CA,UACA,CAD0D,CAAA,CAC1D,CAAAr8B,CAACO,CAAA47B,YAADn8B,EAAqBO,CAAA47B,YAAA,CAAiB90B,CAAjB,CAAAi1B,QAArBt8B,EAAuDsI,CAAvDtI,QAAA,CACSk7B,CADT,CACwBS,QAAiC,CAACS,CAAD,CAAWG,CAAX,CAAqB,CAO7D,OAAb,GAAIl1B,CAAJ,EAAwB+0B,CAAxB,EAAoCG,CAApC,CACEh8B,CAAAi8B,aAAA,CAAkBJ,CAAlB,CAA4BG,CAA5B,CADF,CAGEh8B,CAAAq5B,KAAA,CAAUvyB,CAAV,CAAgB+0B,CAAhB,CAVwE,CAD9E,CARA,CArB2D,CADxD,CADS,CAFN,CAAhB,CATA,CAPgF,CAgFlFnE,QAASA,GAAW,CAACvH,CAAD,CAAe+L,CAAf,CAAiCC,CAAjC,CAA0C,CAAA,IACxDC,EAAuBF,CAAA,CAAiB,CAAjB,CADiC,CAExDG,EAAcH,CAAA1gC,OAF0C;AAGxDmD,EAASy9B,CAAA9hB,WAH+C,CAIxD7d,CAJwD,CAIrDY,CAEP,IAAI8yB,CAAJ,CACE,IAAK1zB,CAAO,CAAH,CAAG,CAAAY,CAAA,CAAK8yB,CAAA30B,OAAjB,CAAsCiB,CAAtC,CAA0CY,CAA1C,CAA8CZ,CAAA,EAA9C,CACE,GAAI0zB,CAAA,CAAa1zB,CAAb,CAAJ,EAAuB2/B,CAAvB,CAA6C,CAC3CjM,CAAA,CAAa1zB,CAAA,EAAb,CAAA,CAAoB0/B,CACJG,EAAAA,CAAK/+B,CAAL++B,CAASD,CAATC,CAAuB,CAAvC,KAAS,IACA9+B,EAAK2yB,CAAA30B,OADd,CAEK+B,CAFL,CAESC,CAFT,CAEaD,CAAA,EAAA,CAAK++B,CAAA,EAFlB,CAGMA,CAAJ,CAAS9+B,CAAT,CACE2yB,CAAA,CAAa5yB,CAAb,CADF,CACoB4yB,CAAA,CAAamM,CAAb,CADpB,CAGE,OAAOnM,CAAA,CAAa5yB,CAAb,CAGX4yB,EAAA30B,OAAA,EAAuB6gC,CAAvB,CAAqC,CAKjClM,EAAAp0B,QAAJ,GAA6BqgC,CAA7B,GACEjM,CAAAp0B,QADF,CACyBogC,CADzB,CAGA,MAnB2C,CAwB7Cx9B,CAAJ,EACEA,CAAA4b,aAAA,CAAoB4hB,CAApB,CAA6BC,CAA7B,CAOEjjB,EAAAA,CAAWpe,CAAAqe,uBAAA,EACf,KAAK3c,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgB4/B,CAAhB,CAA6B5/B,CAAA,EAA7B,CACE0c,CAAAG,YAAA,CAAqB4iB,CAAA,CAAiBz/B,CAAjB,CAArB,CAGElB,EAAAghC,QAAA,CAAeH,CAAf,CAAJ,GAIE7gC,CAAA2M,KAAA,CAAYi0B,CAAZ,CAAqB5gC,CAAA2M,KAAA,CAAYk0B,CAAZ,CAArB,CAGA,CAAA7gC,CAAA,CAAO6gC,CAAP,CAAA1T,IAAA,CAAiC,UAAjC,CAPF,CAYAntB,EAAA0O,UAAA,CAAiBkP,CAAA+B,iBAAA,CAA0B,GAA1B,CAAjB,CAGA,KAAKze,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgB4/B,CAAhB,CAA6B5/B,CAAA,EAA7B,CACE,OAAOy/B,CAAA,CAAiBz/B,CAAjB,CAETy/B,EAAA,CAAiB,CAAjB,CAAA,CAAsBC,CACtBD,EAAA1gC,OAAA,CAA0B,CAhEkC,CAoE9Dg5B,QAASA,GAAkB,CAACvxB,CAAD,CAAKu5B,CAAL,CAAiB,CAC1C,MAAOr+B,EAAA,CAAO,QAAQ,EAAG,CAAE,MAAO8E,EAAAG,MAAA,CAAS,IAAT,CAAe/E,SAAf,CAAT,CAAlB,CAAyD4E,CAAzD,CAA6Du5B,CAA7D,CADmC,CAK5ChG,QAASA,GAAY,CAAC/C,CAAD;AAAS1rB,CAAT,CAAgBqlB,CAAhB,CAA0B2D,CAA1B,CAAiCW,CAAjC,CAA8CjD,CAA9C,CAA4D,CAC/E,GAAI,CACFgF,CAAA,CAAO1rB,CAAP,CAAcqlB,CAAd,CAAwB2D,CAAxB,CAA+BW,CAA/B,CAA4CjD,CAA5C,CADE,CAEF,MAAOzpB,CAAP,CAAU,CACVgQ,CAAA,CAAkBhQ,CAAlB,CAAqBF,EAAA,CAAYsoB,CAAZ,CAArB,CADU,CAHmE,CAWjF6I,QAASA,GAA2B,CAACluB,CAAD,CAAQgpB,CAAR,CAAehwB,CAAf,CAA4BqqB,CAA5B,CAAsC9d,CAAtC,CAAiD,CACnF,IAAImvB,EAAwB,EAC5B5gC,EAAA,CAAQuvB,CAAR,CAAkB,QAAQ,CAACC,CAAD,CAAaC,CAAb,CAAwB,CAAA,IAC5CK,EAAWN,CAAAM,SADiC,CAEhDD,EAAWL,CAAAK,SAFqC,CAIhDgR,CAJgD,CAKhDC,CALgD,CAKrCC,CALqC,CAK1BC,CAEtB,QAJOxR,CAAAG,KAIP,EAEE,KAAK,GAAL,CACOE,CAAL,EAAkBxvB,EAAAC,KAAA,CAAoB40B,CAApB,CAA2BpF,CAA3B,CAAlB,GACE5qB,CAAA,CAAYuqB,CAAZ,CADF,CAC2ByF,CAAA,CAAMpF,CAAN,CAD3B,CAC6C,IAAK,EADlD,CAGAoF,EAAA+L,SAAA,CAAenR,CAAf,CAAyB,QAAQ,CAAC/uB,CAAD,CAAQ,CACnCtB,CAAA,CAASsB,CAAT,CAAJ,GACEmE,CAAA,CAAYuqB,CAAZ,CADF,CAC2B1uB,CAD3B,CADuC,CAAzC,CAKAm0B,EAAA6K,YAAA,CAAkBjQ,CAAlB,CAAAoQ,QAAA,CAAsCh0B,CACtC20B,EAAA,CAAY3L,CAAA,CAAMpF,CAAN,CACRrwB,EAAA,CAASohC,CAAT,CAAJ,CAGE37B,CAAA,CAAYuqB,CAAZ,CAHF,CAG2BhW,CAAA,CAAaonB,CAAb,CAAA,CAAwB30B,CAAxB,CAH3B,CAIWrI,EAAA,CAAUg9B,CAAV,CAJX,GAOE37B,CAAA,CAAYuqB,CAAZ,CAPF,CAO2BoR,CAP3B,CASA,MAEF,MAAK,GAAL,CACE,GAAK,CAAAxgC,EAAAC,KAAA,CAAoB40B,CAApB,CAA2BpF,CAA3B,CAAL,CAA2C,CACzC,GAAID,CAAJ,CAAc,KACdqF,EAAA,CAAMpF,CAAN,CAAA,CAAkB,IAAK,EAFkB,CAI3C,GAAID,CAAJ,EAAiB,CAAAqF,CAAA,CAAMpF,CAAN,CAAjB,CAAkC,KAElCgR,EAAA,CAAYnmB,CAAA,CAAOua,CAAA,CAAMpF,CAAN,CAAP,CAEVkR,EAAA,CADEF,CAAAI,QAAJ,CACY36B,EADZ,CAGYy6B,QAAQ,CAACzuB,CAAD,CAAIwX,CAAJ,CAAO,CAAE,MAAOxX,EAAP,GAAawX,CAAb,EAAmBxX,CAAnB,GAAyBA,CAAzB,EAA8BwX,CAA9B,GAAoCA,CAAtC,CAE3BgX,EAAA,CAAYD,CAAAK,OAAZ,EAAgC,QAAQ,EAAG,CAEzCN,CAAA,CAAY37B,CAAA,CAAYuqB,CAAZ,CAAZ,CAAqCqR,CAAA,CAAU50B,CAAV,CACrC,MAAMwjB,GAAA,CAAe,WAAf;AAEFwF,CAAA,CAAMpF,CAAN,CAFE,CAEeA,CAFf,CAEyBre,CAAAxG,KAFzB,CAAN,CAHyC,CAO3C41B,EAAA,CAAY37B,CAAA,CAAYuqB,CAAZ,CAAZ,CAAqCqR,CAAA,CAAU50B,CAAV,CACjCk1B,EAAAA,CAAmBA,QAAyB,CAACC,CAAD,CAAc,CACvDL,CAAA,CAAQK,CAAR,CAAqBn8B,CAAA,CAAYuqB,CAAZ,CAArB,CAAL,GAEOuR,CAAA,CAAQK,CAAR,CAAqBR,CAArB,CAAL,CAKEE,CAAA,CAAU70B,CAAV,CAAiBm1B,CAAjB,CAA+Bn8B,CAAA,CAAYuqB,CAAZ,CAA/B,CALF,CAEEvqB,CAAA,CAAYuqB,CAAZ,CAFF,CAE2B4R,CAJ7B,CAUA,OAAOR,EAAP,CAAmBQ,CAXyC,CAa9DD,EAAAE,UAAA,CAA6B,CAAA,CAE3BC,EAAA,CADE/R,CAAAI,WAAJ,CACgB1jB,CAAAs1B,iBAAA,CAAuBtM,CAAA,CAAMpF,CAAN,CAAvB,CAAwCsR,CAAxC,CADhB,CAGgBl1B,CAAAtI,OAAA,CAAa+W,CAAA,CAAOua,CAAA,CAAMpF,CAAN,CAAP,CAAwBsR,CAAxB,CAAb,CAAwD,IAAxD,CAA8DN,CAAAI,QAA9D,CAEhBN,EAAAx7B,KAAA,CAA2Bm8B,CAA3B,CACA,MAEF,MAAK,GAAL,CACE,GAAK,CAAAlhC,EAAAC,KAAA,CAAoB40B,CAApB,CAA2BpF,CAA3B,CAAL,CAA2C,CACzC,GAAID,CAAJ,CAAc,KACdqF,EAAA,CAAMpF,CAAN,CAAA,CAAkB,IAAK,EAFkB,CAI3C,GAAID,CAAJ,EAAiB,CAAAqF,CAAA,CAAMpF,CAAN,CAAjB,CAAkC,KAElCgR,EAAA,CAAYnmB,CAAA,CAAOua,CAAA,CAAMpF,CAAN,CAAP,CAEZ5qB,EAAA,CAAYuqB,CAAZ,CAAA,CAAyBqR,CAAA,CAAU50B,CAAV,CAEzBq1B,EAAA,CAAcr1B,CAAAtI,OAAA,CAAak9B,CAAb,CAAwBW,QAA+B,CAACC,CAAD,CAAiB,CACpFx8B,CAAA,CAAYuqB,CAAZ,CAAA,CAAyBiS,CAD2D,CAAxE,CAEXZ,CAAAI,QAFW,CAIdN,EAAAx7B,KAAA,CAA2Bm8B,CAA3B,CACA,MAEF,MAAK,GAAL,CAEET,CAAA,CAAY5L,CAAA70B,eAAA,CAAqByvB,CAArB,CAAA,CAAiCnV,CAAA,CAAOua,CAAA,CAAMpF,CAAN,CAAP,CAAjC,CAA2D7sB,CAGvE,IAAI69B,CAAJ,GAAkB79B,CAAlB,EAA0B4sB,CAA1B,CAAoC,KAEpC3qB,EAAA,CAAYuqB,CAAZ,CAAA,CAAyB,QAAQ,CAACvI,CAAD,CAAS,CACxC,MAAO4Z,EAAA,CAAU50B,CAAV,CAAiBgb,CAAjB,CADiC,CA5F9C,CAPgD,CAAlD,CA0GA,OAAO0Z,EAAAjhC,OAAP,EAAuCgiC,QAAsB,EAAG,CAC9D,IAD8D,IACrD/gC,EAAI,CADiD,CAC9CY,EAAKo/B,CAAAjhC,OAArB,CAAmDiB,CAAnD,CAAuDY,CAAvD,CAA2D,EAAEZ,CAA7D,CACEggC,CAAA,CAAsBhgC,CAAtB,CAAA,EAF4D,CA5GmB,CAjvDZ;AAEzE,IAAIghC,EAAmB,KAAvB,CACIxP,GAAoBlzB,CAAAwe,cAAA,CAAuB,KAAvB,CADxB,CAEI0X,GAAaA,QAAQ,CAAC3wB,CAAD,CAAUo9B,CAAV,CAA4B,CACnD,GAAIA,CAAJ,CAAsB,CACpB,IAAInhC,EAAOd,MAAAc,KAAA,CAAYmhC,CAAZ,CAAX,CACIjhC,CADJ,CACO2e,CADP,CACUpf,CAELS,EAAA,CAAI,CAAT,KAAY2e,CAAZ,CAAgB7e,CAAAf,OAAhB,CAA6BiB,CAA7B,CAAiC2e,CAAjC,CAAoC3e,CAAA,EAApC,CACET,CACA,CADMO,CAAA,CAAKE,CAAL,CACN,CAAA,IAAA,CAAKT,CAAL,CAAA,CAAY0hC,CAAA,CAAiB1hC,CAAjB,CANM,CAAtB,IASE,KAAAi2B,MAAA,CAAa,EAGf,KAAAb,UAAA,CAAiB9wB,CAbkC,CAgBrD2wB,GAAA7N,UAAA,CAAuB,CAgBrBua,WAAYxL,EAhBS,CA8BrByL,UAAWA,QAAQ,CAACC,CAAD,CAAW,CACxBA,CAAJ,EAAkC,CAAlC,CAAgBA,CAAAriC,OAAhB,EACEoY,CAAAqM,SAAA,CAAkB,IAAAmR,UAAlB,CAAkCyM,CAAlC,CAF0B,CA9BT,CA+CrBC,aAAcA,QAAQ,CAACD,CAAD,CAAW,CAC3BA,CAAJ,EAAkC,CAAlC,CAAgBA,CAAAriC,OAAhB,EACEoY,CAAAsM,YAAA,CAAqB,IAAAkR,UAArB,CAAqCyM,CAArC,CAF6B,CA/CZ,CAiErB5B,aAAcA,QAAQ,CAAC8B,CAAD,CAAa7D,CAAb,CAAyB,CAC7C,IAAI8D,EAAQC,EAAA,CAAgBF,CAAhB,CAA4B7D,CAA5B,CACR8D,EAAJ,EAAaA,CAAAxiC,OAAb,EACEoY,CAAAqM,SAAA,CAAkB,IAAAmR,UAAlB,CAAkC4M,CAAlC,CAIF,EADIE,CACJ,CADeD,EAAA,CAAgB/D,CAAhB,CAA4B6D,CAA5B,CACf,GAAgBG,CAAA1iC,OAAhB,EACEoY,CAAAsM,YAAA,CAAqB,IAAAkR,UAArB,CAAqC8M,CAArC,CAR2C,CAjE1B,CAsFrB7E,KAAMA,QAAQ,CAACr9B,CAAD,CAAMY,CAAN,CAAauhC,CAAb,CAAwBxS,CAAxB,CAAkC,CAAA,IAM1CyS;AAAangB,EAAA,CADN,IAAAmT,UAAAtxB,CAAe,CAAfA,CACM,CAAyB9D,CAAzB,CAN6B,CAO1CqiC,EA7jJHC,EAAA,CA6jJmCtiC,CA7jJnC,CAsjJ6C,CAQ1CuiC,EAAWviC,CAGXoiC,EAAJ,EACE,IAAAhN,UAAArxB,KAAA,CAAoB/D,CAApB,CAAyBY,CAAzB,CACA,CAAA+uB,CAAA,CAAWyS,CAFb,EAGWC,CAHX,GAIE,IAAA,CAAKA,CAAL,CACA,CADmBzhC,CACnB,CAAA2hC,CAAA,CAAWF,CALb,CAQA,KAAA,CAAKriC,CAAL,CAAA,CAAYY,CAGR+uB,EAAJ,CACE,IAAAsG,MAAA,CAAWj2B,CAAX,CADF,CACoB2vB,CADpB,EAGEA,CAHF,CAGa,IAAAsG,MAAA,CAAWj2B,CAAX,CAHb,IAKI,IAAAi2B,MAAA,CAAWj2B,CAAX,CALJ,CAKsB2vB,CALtB,CAKiC3iB,EAAA,CAAWhN,CAAX,CAAgB,GAAhB,CALjC,CASA+B,EAAA,CAAWsC,EAAA,CAAU,IAAA+wB,UAAV,CAEX,IAAkB,GAAlB,GAAKrzB,CAAL,GAAkC,MAAlC,GAA0B/B,CAA1B,EAAoD,WAApD,GAA4CA,CAA5C,GACkB,KADlB,GACK+B,CADL,EACmC,KADnC,GAC2B/B,CAD3B,CAGE,IAAA,CAAKA,CAAL,CAAA,CAAYY,CAAZ,CAAoBqR,CAAA,CAAcrR,CAAd,CAA6B,KAA7B,GAAqBZ,CAArB,CAHtB,KAIO,IAAiB,KAAjB,GAAI+B,CAAJ,EAAkC,QAAlC,GAA0B/B,CAA1B,CAA4C,CAejD,IAbI2lB,IAAAA,EAAS,EAATA,CAGA6c,EAAgB/jB,CAAA,CAAK7d,CAAL,CAHhB+kB,CAKA8c,EAAa,qCALb9c,CAMApP,EAAU,IAAA1S,KAAA,CAAU2+B,CAAV,CAAA,CAA2BC,CAA3B,CAAwC,KANlD9c,CASA+c,EAAUF,CAAAp+B,MAAA,CAAoBmS,CAApB,CATVoP,CAYAgd,EAAoB/F,IAAAgG,MAAA,CAAWF,CAAAljC,OAAX,CAA4B,CAA5B,CAZpBmmB,CAaKllB,EAAI,CAAb,CAAgBA,CAAhB,CAAoBkiC,CAApB,CAAuCliC,CAAA,EAAvC,CACE,IAAIoiC,EAAe,CAAfA,CAAWpiC,CAAf,CAEAklB,EAAAA,CAAAA,CAAU1T,CAAA,CAAcwM,CAAA,CAAKikB,CAAA,CAAQG,CAAR,CAAL,CAAd,CAAuC,CAAA,CAAvC,CAFV,CAIAld,EAAAA,CAAAA,EAAW,GAAXA,CAAiBlH,CAAA,CAAKikB,CAAA,CAAQG,CAAR,CAAmB,CAAnB,CAAL,CAAjBld,CAIEmd,EAAAA,CAAYrkB,CAAA,CAAKikB,CAAA,CAAY,CAAZ,CAAQjiC,CAAR,CAAL,CAAA2D,MAAA,CAA2B,IAA3B,CAGhBuhB;CAAA,EAAU1T,CAAA,CAAcwM,CAAA,CAAKqkB,CAAA,CAAU,CAAV,CAAL,CAAd,CAAkC,CAAA,CAAlC,CAGe,EAAzB,GAAIA,CAAAtjC,OAAJ,GACEmmB,CADF,EACa,GADb,CACmBlH,CAAA,CAAKqkB,CAAA,CAAU,CAAV,CAAL,CADnB,CAGA,KAAA,CAAK9iC,CAAL,CAAA,CAAYY,CAAZ,CAAoB+kB,CAjC6B,CAoCjC,CAAA,CAAlB,GAAIwc,CAAJ,GACgB,IAAd,GAAIvhC,CAAJ,EAAsBwC,CAAA,CAAYxC,CAAZ,CAAtB,CACE,IAAAw0B,UAAA2N,WAAA,CAA0BpT,CAA1B,CADF,CAGM8R,CAAA59B,KAAA,CAAsB8rB,CAAtB,CAAJ,CACE,IAAAyF,UAAApxB,KAAA,CAAoB2rB,CAApB,CAA8B/uB,CAA9B,CADF,CAGEoxB,CAAA,CAAe,IAAAoD,UAAA,CAAe,CAAf,CAAf,CAAkCzF,CAAlC,CAA4C/uB,CAA5C,CAPN,CAcA,EADIg/B,CACJ,CADkB,IAAAA,YAClB,GAAe//B,CAAA,CAAQ+/B,CAAA,CAAY2C,CAAZ,CAAR,CAA+B,QAAQ,CAACt7B,CAAD,CAAK,CACzD,GAAI,CACFA,CAAA,CAAGrG,CAAH,CADE,CAEF,MAAOoI,CAAP,CAAU,CACVgQ,CAAA,CAAkBhQ,CAAlB,CADU,CAH6C,CAA5C,CAvF+B,CAtF3B,CA0MrB83B,SAAUA,QAAQ,CAAC9gC,CAAD,CAAMiH,CAAN,CAAU,CAAA,IACtB8tB,EAAQ,IADc,CAEtB6K,EAAe7K,CAAA6K,YAAfA,GAAqC7K,CAAA6K,YAArCA,CAAyDj5B,CAAA,EAAzDi5B,CAFsB,CAGtBoD,EAAapD,CAAA,CAAY5/B,CAAZ,CAAbgjC,GAAkCpD,CAAA,CAAY5/B,CAAZ,CAAlCgjC,CAAqD,EAArDA,CAEJA,EAAA/9B,KAAA,CAAegC,CAAf,CACAyT,EAAAlX,WAAA,CAAsB,QAAQ,EAAG,CAC1Bw/B,CAAAlD,QAAL,EAA0B,CAAA/K,CAAA70B,eAAA,CAAqBF,CAArB,CAA1B,EAAwDoD,CAAA,CAAY2xB,CAAA,CAAM/0B,CAAN,CAAZ,CAAxD,EAEEiH,CAAA,CAAG8tB,CAAA,CAAM/0B,CAAN,CAAH,CAH6B,CAAjC,CAOA,OAAO,SAAQ,EAAG,CAChBwE,EAAA,CAAYw+B,CAAZ,CAAuB/7B,CAAvB,CADgB,CAbQ,CA1MP,CApBkD,KAwQrEg8B,GAAc3pB,CAAA2pB,YAAA,EAxQuD,CAyQrEC,GAAY5pB,CAAA4pB,UAAA,EAzQyD,CA0QrE/G,GAAsC,IAAhB,EAAC8G,EAAD,EAAsC,IAAtC;AAAwBC,EAAxB,CAChBngC,EADgB,CAEhBo5B,QAA4B,CAAC7K,CAAD,CAAW,CACvC,MAAOA,EAAArpB,QAAA,CAAiB,OAAjB,CAA0Bg7B,EAA1B,CAAAh7B,QAAA,CAA+C,KAA/C,CAAsDi7B,EAAtD,CADgC,CA5QwB,CA+QrEzM,GAAkB,cA/QmD,CAgRrEG,GAAuB,aAE3B5qB,EAAAkzB,iBAAA,CAA2BxzB,CAAA,CAAmBwzB,QAAyB,CAAC9N,CAAD,CAAW+R,CAAX,CAAoB,CACzF,IAAI/T,EAAWgC,CAAAllB,KAAA,CAAc,UAAd,CAAXkjB,EAAwC,EAExC/vB,EAAA,CAAQ8jC,CAAR,CAAJ,CACE/T,CADF,CACaA,CAAAxoB,OAAA,CAAgBu8B,CAAhB,CADb,CAGE/T,CAAAnqB,KAAA,CAAck+B,CAAd,CAGF/R,EAAAllB,KAAA,CAAc,UAAd,CAA0BkjB,CAA1B,CATyF,CAAhE,CAUvBtsB,CAEJkJ,EAAAgzB,kBAAA,CAA4BtzB,CAAA,CAAmBszB,QAA0B,CAAC5N,CAAD,CAAW,CAClFkB,CAAA,CAAalB,CAAb,CAAuB,YAAvB,CADkF,CAAxD,CAExBtuB,CAEJkJ,EAAAioB,eAAA,CAAyBvoB,CAAA,CAAmBuoB,QAAuB,CAAC7C,CAAD,CAAWrlB,CAAX,CAAkBq3B,CAAlB,CAA4BC,CAA5B,CAAwC,CAEzGjS,CAAAllB,KAAA,CADek3B,CAAAxK,CAAYyK,CAAA,CAAa,yBAAb,CAAyC,eAArDzK,CAAwE,QACvF,CAAwB7sB,CAAxB,CAFyG,CAAlF,CAGrBjJ,CAEJkJ,EAAAknB,gBAAA,CAA0BxnB,CAAA,CAAmBwnB,QAAwB,CAAC9B,CAAD,CAAWgS,CAAX,CAAqB,CACxF9Q,CAAA,CAAalB,CAAb,CAAuBgS,CAAA,CAAW,kBAAX,CAAgC,UAAvD,CADwF,CAAhE,CAEtBtgC,CAEJ,OAAOkJ,EA3SkE,CAJ/D,CA1W6C,CAytE3DmqB,QAASA,GAAkB,CAACrrB,CAAD,CAAO,CAChC,MAAO0R,GAAA,CAAU1R,CAAA7C,QAAA,CAAayuB,EAAb;AAA4B,EAA5B,CAAV,CADyB,CAgElCuL,QAASA,GAAe,CAACqB,CAAD,CAAOC,CAAP,CAAa,CAAA,IAC/BC,EAAS,EADsB,CAE/BC,EAAUH,CAAAl/B,MAAA,CAAW,KAAX,CAFqB,CAG/Bs/B,EAAUH,CAAAn/B,MAAA,CAAW,KAAX,CAHqB,CAM1B3D,EAAI,CADb,EAAA,CACA,IAAA,CAAgBA,CAAhB,CAAoBgjC,CAAAjkC,OAApB,CAAoCiB,CAAA,EAApC,CAAyC,CAEvC,IADA,IAAIkjC,EAAQF,CAAA,CAAQhjC,CAAR,CAAZ,CACSc,EAAI,CAAb,CAAgBA,CAAhB,CAAoBmiC,CAAAlkC,OAApB,CAAoC+B,CAAA,EAApC,CACE,GAAIoiC,CAAJ,EAAaD,CAAA,CAAQniC,CAAR,CAAb,CAAyB,SAAS,CAEpCiiC,EAAA,GAA2B,CAAhB,CAAAA,CAAAhkC,OAAA,CAAoB,GAApB,CAA0B,EAArC,EAA2CmkC,CALJ,CAOzC,MAAOH,EAb4B,CAgBrCpH,QAASA,GAAc,CAACwH,CAAD,CAAU,CAC/BA,CAAA,CAAUrkC,CAAA,CAAOqkC,CAAP,CACV,KAAInjC,EAAImjC,CAAApkC,OAER,IAAS,CAAT,EAAIiB,CAAJ,CACE,MAAOmjC,EAGT,KAAA,CAAOnjC,CAAA,EAAP,CAAA,CA/mPsBy2B,CAinPpB,GADW0M,CAAA9/B,CAAQrD,CAARqD,CACPsF,SAAJ,EACExE,EAAAzE,KAAA,CAAYyjC,CAAZ,CAAqBnjC,CAArB,CAAwB,CAAxB,CAGJ,OAAOmjC,EAdwB,CAqBjC/S,QAASA,GAAuB,CAAC9iB,CAAD,CAAa81B,CAAb,CAAoB,CAClD,GAAIA,CAAJ,EAAavkC,CAAA,CAASukC,CAAT,CAAb,CAA8B,MAAOA,EACrC,IAAIvkC,CAAA,CAASyO,CAAT,CAAJ,CAA0B,CACxB,IAAI/H,EAAQ89B,EAAArmB,KAAA,CAAe1P,CAAf,CACZ,IAAI/H,CAAJ,CAAW,MAAOA,EAAA,CAAM,CAAN,CAFM,CAFwB,CAmBpD6S,QAASA,GAAmB,EAAG,CAAA,IACzB6c,EAAc,EADW,CAEzBqO,EAAU,CAAA,CAUd,KAAAC,SAAA,CAAgBC,QAAQ,CAACn5B,CAAD,CAAOtF,CAAP,CAAoB,CAC1CuJ,EAAA,CAAwBjE,CAAxB,CAA8B,YAA9B,CACIxJ,EAAA,CAASwJ,CAAT,CAAJ,CACE3I,CAAA,CAAOuzB,CAAP,CAAoB5qB,CAApB,CADF,CAGE4qB,CAAA,CAAY5qB,CAAZ,CAHF,CAGsBtF,CALoB,CAc5C,KAAA0+B,aAAA,CAAoBC,QAAQ,EAAG,CAC7BJ,CAAA,CAAU,CAAA,CADmB,CAK/B,KAAAlgB,KAAA;AAAY,CAAC,WAAD,CAAc,SAAd,CAAyB,QAAQ,CAAC4D,CAAD,CAAY3L,CAAZ,CAAqB,CAyGhEsoB,QAASA,EAAa,CAACrd,CAAD,CAASqT,CAAT,CAAqBpG,CAArB,CAA+BlpB,CAA/B,CAAqC,CACzD,GAAMic,CAAAA,CAAN,EAAgB,CAAAzlB,CAAA,CAASylB,CAAAkS,OAAT,CAAhB,CACE,KAAMh6B,EAAA,CAAO,aAAP,CAAA,CAAsB,OAAtB,CAEJ6L,CAFI,CAEEsvB,CAFF,CAAN,CAKFrT,CAAAkS,OAAA,CAAcmB,CAAd,CAAA,CAA4BpG,CAP6B,CA5E3D,MAAO,SAAQ,CAACqQ,CAAD,CAAatd,CAAb,CAAqBud,CAArB,CAA4BT,CAA5B,CAAmC,CAAA,IAQ5C7P,CAR4C,CAQ3BxuB,CAR2B,CAQd40B,CAClCkK,EAAA,CAAkB,CAAA,CAAlB,GAAQA,CACJT,EAAJ,EAAavkC,CAAA,CAASukC,CAAT,CAAb,GACEzJ,CADF,CACeyJ,CADf,CAIA,IAAIvkC,CAAA,CAAS+kC,CAAT,CAAJ,CAA0B,CACxBr+B,CAAA,CAAQq+B,CAAAr+B,MAAA,CAAiB89B,EAAjB,CACR,IAAK99B,CAAAA,CAAL,CACE,KAAMu+B,GAAA,CAAkB,SAAlB,CAE8CF,CAF9C,CAAN,CAIF7+B,CAAA,CAAcQ,CAAA,CAAM,CAAN,CACdo0B,EADA,CACaA,CADb,EAC2Bp0B,CAAA,CAAM,CAAN,CAC3Bq+B,EAAA,CAAa3O,CAAAx1B,eAAA,CAA2BsF,CAA3B,CAAA,CACPkwB,CAAA,CAAYlwB,CAAZ,CADO,CAEPwJ,EAAA,CAAO+X,CAAAkS,OAAP,CAAsBzzB,CAAtB,CAAmC,CAAA,CAAnC,CAFO,GAGJu+B,CAAA,CAAU/0B,EAAA,CAAO8M,CAAP,CAAgBtW,CAAhB,CAA6B,CAAA,CAA7B,CAAV,CAA+CxG,CAH3C,CAKb6P,GAAA,CAAYw1B,CAAZ,CAAwB7+B,CAAxB,CAAqC,CAAA,CAArC,CAdwB,CAiB1B,GAAI8+B,CAAJ,CAoBE,MATIE,EASiB,CATKpd,CAAC/nB,CAAA,CAAQglC,CAAR,CAAA,CACzBA,CAAA,CAAWA,CAAA7kC,OAAX,CAA+B,CAA/B,CADyB,CACW6kC,CADZjd,WASL,CAPrB4M,CAOqB,CAPVv0B,MAAAoD,OAAA,CAAc2hC,CAAd,EAAqC,IAArC,CAOU,CALjBpK,CAKiB,EAJnBgK,CAAA,CAAcrd,CAAd,CAAsBqT,CAAtB,CAAkCpG,CAAlC,CAA4CxuB,CAA5C,EAA2D6+B,CAAAv5B,KAA3D,CAImB,CAAA3I,CAAA,CAAO,QAAQ,EAAG,CACrC,IAAIwjB,EAAS8B,CAAA5b,OAAA,CAAiBw4B,CAAjB,CAA6BrQ,CAA7B,CAAuCjN,CAAvC,CAA+CvhB,CAA/C,CACTmgB,EAAJ,GAAeqO,CAAf,GAA4B1yB,CAAA,CAASqkB,CAAT,CAA5B,EAAgD1lB,CAAA,CAAW0lB,CAAX,CAAhD,IACEqO,CACA,CADWrO,CACX,CAAIyU,CAAJ,EAEEgK,CAAA,CAAcrd,CAAd,CAAsBqT,CAAtB,CAAkCpG,CAAlC,CAA4CxuB,CAA5C,EAA2D6+B,CAAAv5B,KAA3D,CAJJ,CAOA;MAAOkpB,EAT8B,CAAlB,CAUlB,CACDA,SAAUA,CADT,CAEDoG,WAAYA,CAFX,CAVkB,CAgBvBpG,EAAA,CAAWvM,CAAAnC,YAAA,CAAsB+e,CAAtB,CAAkCtd,CAAlC,CAA0CvhB,CAA1C,CAEP40B,EAAJ,EACEgK,CAAA,CAAcrd,CAAd,CAAsBqT,CAAtB,CAAkCpG,CAAlC,CAA4CxuB,CAA5C,EAA2D6+B,CAAAv5B,KAA3D,CAGF,OAAOkpB,EAzEyC,CA7Bc,CAAtD,CA/BiB,CA6K/Bjb,QAASA,GAAiB,EAAG,CAC3B,IAAA8K,KAAA,CAAY,CAAC,SAAD,CAAY,QAAQ,CAAC/kB,CAAD,CAAS,CACvC,MAAOS,EAAA,CAAOT,CAAAC,SAAP,CADgC,CAA7B,CADe,CA8C7Bka,QAASA,GAAyB,EAAG,CACnC,IAAA4K,KAAA,CAAY,CAAC,MAAD,CAAS,QAAQ,CAACvJ,CAAD,CAAO,CAClC,MAAO,SAAQ,CAACmqB,CAAD,CAAYC,CAAZ,CAAmB,CAChCpqB,CAAAgQ,MAAAljB,MAAA,CAAiBkT,CAAjB,CAAuBjY,SAAvB,CADgC,CADA,CAAxB,CADuB,CA8CrCsiC,QAASA,GAAc,CAACC,CAAD,CAAI,CACzB,MAAItjC,EAAA,CAASsjC,CAAT,CAAJ,CACSljC,CAAA,CAAOkjC,CAAP,CAAA,CAAYA,CAAAC,YAAA,EAAZ,CAA8Bt9B,EAAA,CAAOq9B,CAAP,CADvC,CAGOA,CAJkB,CAQ3B/qB,QAASA,GAA4B,EAAG,CAiBtC,IAAAgK,KAAA,CAAYC,QAAQ,EAAG,CACrB,MAAOghB,SAA0B,CAACC,CAAD,CAAS,CACxC,GAAKA,CAAAA,CAAL,CAAa,MAAO,EACpB,KAAIl7B,EAAQ,EACZvJ,GAAA,CAAcykC,CAAd,CAAsB,QAAQ,CAACnkC,CAAD,CAAQZ,CAAR,CAAa,CAC3B,IAAd,GAAIY,CAAJ,EAAsBwC,CAAA,CAAYxC,CAAZ,CAAtB,GACIvB,CAAA,CAAQuB,CAAR,CAAJ,CACEf,CAAA,CAAQe,CAAR,CAAe,QAAQ,CAACgkC,CAAD,CAAII,CAAJ,CAAO,CAC5Bn7B,CAAA5E,KAAA,CAAW8E,EAAA,CAAe/J,CAAf,CAAX,CAAkC,GAAlC,CAAwC+J,EAAA,CAAe46B,EAAA,CAAeC,CAAf,CAAf,CAAxC,CAD4B,CAA9B,CADF,CAKE/6B,CAAA5E,KAAA,CAAW8E,EAAA,CAAe/J,CAAf,CAAX,CAAiC,GAAjC,CAAuC+J,EAAA,CAAe46B,EAAA,CAAe/jC,CAAf,CAAf,CAAvC,CANF,CADyC,CAA3C,CAWA;MAAOiJ,EAAAG,KAAA,CAAW,GAAX,CAdiC,CADrB,CAjBe,CAqCxC+P,QAASA,GAAkC,EAAG,CA4C5C,IAAA8J,KAAA,CAAYC,QAAQ,EAAG,CACrB,MAAOmhB,SAAkC,CAACF,CAAD,CAAS,CAMhDG,QAASA,EAAS,CAACC,CAAD,CAAct6B,CAAd,CAAsBu6B,CAAtB,CAAgC,CAC5B,IAApB,GAAID,CAAJ,EAA4B/hC,CAAA,CAAY+hC,CAAZ,CAA5B,GACI9lC,CAAA,CAAQ8lC,CAAR,CAAJ,CACEtlC,CAAA,CAAQslC,CAAR,CAAqB,QAAQ,CAACvkC,CAAD,CAAQ8D,CAAR,CAAe,CAC1CwgC,CAAA,CAAUtkC,CAAV,CAAiBiK,CAAjB,CAA0B,GAA1B,EAAiCvJ,CAAA,CAASV,CAAT,CAAA,CAAkB8D,CAAlB,CAA0B,EAA3D,EAAiE,GAAjE,CAD0C,CAA5C,CADF,CAIWpD,CAAA,CAAS6jC,CAAT,CAAJ,EAA8B,CAAAzjC,CAAA,CAAOyjC,CAAP,CAA9B,CACL7kC,EAAA,CAAc6kC,CAAd,CAA2B,QAAQ,CAACvkC,CAAD,CAAQZ,CAAR,CAAa,CAC9CklC,CAAA,CAAUtkC,CAAV,CAAiBiK,CAAjB,EACKu6B,CAAA,CAAW,EAAX,CAAgB,GADrB,EAEIplC,CAFJ,EAGKolC,CAAA,CAAW,EAAX,CAAgB,GAHrB,EAD8C,CAAhD,CADK,CAQLv7B,CAAA5E,KAAA,CAAW8E,EAAA,CAAec,CAAf,CAAX,CAAoC,GAApC,CAA0Cd,EAAA,CAAe46B,EAAA,CAAeQ,CAAf,CAAf,CAA1C,CAbF,CADgD,CALlD,GAAKJ,CAAAA,CAAL,CAAa,MAAO,EACpB,KAAIl7B,EAAQ,EACZq7B,EAAA,CAAUH,CAAV,CAAkB,EAAlB,CAAsB,CAAA,CAAtB,CACA,OAAOl7B,EAAAG,KAAA,CAAW,GAAX,CAJyC,CAD7B,CA5CqB,CAwE9Cq7B,QAASA,GAA4B,CAACn5B,CAAD,CAAOo5B,CAAP,CAAgB,CACnD,GAAIhmC,CAAA,CAAS4M,CAAT,CAAJ,CAAoB,CAElB,IAAIq5B,EAAWr5B,CAAAjE,QAAA,CAAau9B,EAAb,CAAqC,EAArC,CAAA/mB,KAAA,EAEf,IAAI8mB,CAAJ,CAAc,CACZ,IAAIE,EAAcH,CAAA,CAAQ,cAAR,CACd,EAAC,CAAD,CAAC,CAAD,EAAC,CAAD,GAAC,CAAA,QAAA,CAAA,EAAA,CAAD,IAWN,CAXM,EAUFI,CAVE,CAAkEljC,CAUxDwD,MAAA,CAAU2/B,EAAV,CAVV,GAWcC,EAAA,CAAUF,CAAA,CAAU,CAAV,CAAV,CAAA7hC,KAAA,CAXoDrB,CAWpD,CAXd,CAAA,EAAJ,GACE0J,CADF,CACSvE,EAAA,CAAS49B,CAAT,CADT,CAFY,CAJI,CAYpB,MAAOr5B,EAb4C,CA2BrD25B,QAASA,GAAY,CAACP,CAAD,CAAU,CAAA,IACzB3mB;AAAShY,CAAA,EADgB,CACHlG,CAQtBnB,EAAA,CAASgmC,CAAT,CAAJ,CACEzlC,CAAA,CAAQylC,CAAAlhC,MAAA,CAAc,IAAd,CAAR,CAA6B,QAAQ,CAAC0hC,CAAD,CAAO,CAC1CrlC,CAAA,CAAIqlC,CAAAnhC,QAAA,CAAa,GAAb,CACS,KAAA,EAAAJ,CAAA,CAAUka,CAAA,CAAKqnB,CAAA3Z,OAAA,CAAY,CAAZ,CAAe1rB,CAAf,CAAL,CAAV,CAAoC,EAAA,CAAAge,CAAA,CAAKqnB,CAAA3Z,OAAA,CAAY1rB,CAAZ,CAAgB,CAAhB,CAAL,CAR/CT,EAAJ,GACE2e,CAAA,CAAO3e,CAAP,CADF,CACgB2e,CAAA,CAAO3e,CAAP,CAAA,CAAc2e,CAAA,CAAO3e,CAAP,CAAd,CAA4B,IAA5B,CAAmCsH,CAAnC,CAAyCA,CADzD,CAM4C,CAA5C,CADF,CAKWhG,CAAA,CAASgkC,CAAT,CALX,EAMEzlC,CAAA,CAAQylC,CAAR,CAAiB,QAAQ,CAACS,CAAD,CAAYC,CAAZ,CAAuB,CACjC,IAAA,EAAAzhC,CAAA,CAAUyhC,CAAV,CAAA,CAAsB,EAAAvnB,CAAA,CAAKsnB,CAAL,CAZjC/lC,EAAJ,GACE2e,CAAA,CAAO3e,CAAP,CADF,CACgB2e,CAAA,CAAO3e,CAAP,CAAA,CAAc2e,CAAA,CAAO3e,CAAP,CAAd,CAA4B,IAA5B,CAAmCsH,CAAnC,CAAyCA,CADzD,CAWgD,CAAhD,CAKF,OAAOqX,EApBsB,CAoC/BsnB,QAASA,GAAa,CAACX,CAAD,CAAU,CAC9B,IAAIY,CAEJ,OAAO,SAAQ,CAACp7B,CAAD,CAAO,CACfo7B,CAAL,GAAiBA,CAAjB,CAA+BL,EAAA,CAAaP,CAAb,CAA/B,CAEA,OAAIx6B,EAAJ,EACMlK,CAIGA,CAJKslC,CAAA,CAAW3hC,CAAA,CAAUuG,CAAV,CAAX,CAILlK,CAHO,IAAK,EAGZA,GAHHA,CAGGA,GAFLA,CAEKA,CAFG,IAEHA,EAAAA,CALT,EAQOslC,CAXa,CAHQ,CA8BhCC,QAASA,GAAa,CAACj6B,CAAD,CAAOo5B,CAAP,CAAgBc,CAAhB,CAAwBC,CAAxB,CAA6B,CACjD,GAAIpmC,CAAA,CAAWomC,CAAX,CAAJ,CACE,MAAOA,EAAA,CAAIn6B,CAAJ,CAAUo5B,CAAV,CAAmBc,CAAnB,CAGTvmC,EAAA,CAAQwmC,CAAR,CAAa,QAAQ,CAACp/B,CAAD,CAAK,CACxBiF,CAAA,CAAOjF,CAAA,CAAGiF,CAAH,CAASo5B,CAAT,CAAkBc,CAAlB,CADiB,CAA1B,CAIA,OAAOl6B,EAT0C,CAwBnDyN,QAASA,GAAa,EAAG,CAkCvB,IAAI2sB,EAAW,IAAAA,SAAXA,CAA2B,CAE7BC,kBAAmB,CAAClB,EAAD,CAFU,CAK7BmB,iBAAkB,CAAC,QAAQ,CAACC,CAAD,CAAI,CAC7B,MAAOnlC,EAAA,CAASmlC,CAAT,CAAA,EAv2SmB,eAu2SnB;AAv2SJtjC,EAAAhD,KAAA,CAu2S2BsmC,CAv2S3B,CAu2SI,EA71SmB,eA61SnB,GA71SJtjC,EAAAhD,KAAA,CA61SyCsmC,CA71SzC,CA61SI,EAl2SmB,mBAk2SnB,GAl2SJtjC,EAAAhD,KAAA,CAk2S2DsmC,CAl2S3D,CAk2SI,CAA4Dl/B,EAAA,CAAOk/B,CAAP,CAA5D,CAAwEA,CADlD,CAAb,CALW,CAU7BnB,QAAS,CACPoB,OAAQ,CACN,OAAU,mCADJ,CADD,CAIPrO,KAAQnyB,EAAA,CAAYygC,EAAZ,CAJD,CAKPliB,IAAQve,EAAA,CAAYygC,EAAZ,CALD,CAMPC,MAAQ1gC,EAAA,CAAYygC,EAAZ,CAND,CAVoB,CAmB7BE,eAAgB,YAnBa,CAoB7BC,eAAgB,cApBa,CAsB7BC,gBAAiB,sBAtBY,CAA/B,CAyBIC,EAAgB,CAAA,CAoBpB,KAAAA,cAAA,CAAqBC,QAAQ,CAACrmC,CAAD,CAAQ,CACnC,MAAIyC,EAAA,CAAUzC,CAAV,CAAJ,EACEomC,CACO,CADS,CAAEpmC,CAAAA,CACX,CAAA,IAFT,EAIOomC,CAL4B,CAQrC,KAAIE,EAAmB,CAAA,CAgBvB,KAAAC,2BAAA,CAAkCC,QAAQ,CAACxmC,CAAD,CAAQ,CAChD,MAAIyC,EAAA,CAAUzC,CAAV,CAAJ,EACEsmC,CACO,CADY,CAAEtmC,CAAAA,CACd,CAAA,IAFT,EAIOsmC,CALyC,CAqBlD,KAAIG,EAAuB,IAAAC,aAAvBD,CAA2C,EAE/C,KAAAxjB,KAAA,CAAY,CAAC,cAAD,CAAiB,gBAAjB,CAAmC,eAAnC;AAAoD,YAApD,CAAkE,IAAlE,CAAwE,WAAxE,CACR,QAAQ,CAAC7J,CAAD,CAAesC,CAAf,CAA+B5D,CAA/B,CAA8CgC,CAA9C,CAA0DE,CAA1D,CAA8D6M,CAA9D,CAAyE,CAwhBnF/N,QAASA,EAAK,CAAC6tB,CAAD,CAAgB,CAwF5BhB,QAASA,EAAiB,CAACiB,CAAD,CAAW,CAEnC,IAAIC,EAAOtlC,CAAA,CAAO,EAAP,CAAWqlC,CAAX,CACXC,EAAAv7B,KAAA,CAAYi6B,EAAA,CAAcqB,CAAAt7B,KAAd,CAA6Bs7B,CAAAlC,QAA7B,CAA+CkC,CAAApB,OAA/C,CACcx7B,CAAA27B,kBADd,CAEMH,EAAAA,CAAAoB,CAAApB,OAAlB,OA9vBC,IA8vBM,EA9vBCA,CA8vBD,EA9vBoB,GA8vBpB,CA9vBWA,CA8vBX,CACHqB,CADG,CAEH7sB,CAAA8sB,OAAA,CAAUD,CAAV,CAP+B,CAUrCE,QAASA,EAAgB,CAACrC,CAAD,CAAU16B,CAAV,CAAkB,CAAA,IACrCg9B,CADqC,CACtBC,EAAmB,EAEtChoC,EAAA,CAAQylC,CAAR,CAAiB,QAAQ,CAACwC,CAAD,CAAWC,CAAX,CAAmB,CACtC9nC,CAAA,CAAW6nC,CAAX,CAAJ,EACEF,CACA,CADgBE,CAAA,CAASl9B,CAAT,CAChB,CAAqB,IAArB,EAAIg9B,CAAJ,GACEC,CAAA,CAAiBE,CAAjB,CADF,CAC6BH,CAD7B,CAFF,EAMEC,CAAA,CAAiBE,CAAjB,CANF,CAM6BD,CAPa,CAA5C,CAWA,OAAOD,EAdkC,CAhG3C,GAAK,CAAAvmC,CAAA,CAASimC,CAAT,CAAL,CACE,KAAMtoC,EAAA,CAAO,OAAP,CAAA,CAAgB,QAAhB,CAA0FsoC,CAA1F,CAAN,CAGF,GAAK,CAAAjoC,CAAA,CAASioC,CAAAvc,IAAT,CAAL,CACE,KAAM/rB,EAAA,CAAO,OAAP,CAAA,CAAgB,QAAhB,CAA6FsoC,CAAAvc,IAA7F,CAAN,CAGF,IAAIpgB,EAASzI,CAAA,CAAO,CAClBgO,OAAQ,KADU,CAElBq2B,iBAAkBF,CAAAE,iBAFA,CAGlBD,kBAAmBD,CAAAC,kBAHD,CAIlBQ,gBAAiBT,CAAAS,gBAJC,CAAP;AAKVQ,CALU,CAOb38B,EAAA06B,QAAA,CAkGA0C,QAAqB,CAACp9B,CAAD,CAAS,CAAA,IACxBq9B,EAAa3B,CAAAhB,QADW,CAExB4C,EAAa/lC,CAAA,CAAO,EAAP,CAAWyI,CAAA06B,QAAX,CAFW,CAGxB6C,CAHwB,CAGTC,CAHS,CAGeC,CAHf,CAK5BJ,EAAa9lC,CAAA,CAAO,EAAP,CAAW8lC,CAAAvB,OAAX,CAA8BuB,CAAA,CAAW1jC,CAAA,CAAUqG,CAAAuF,OAAV,CAAX,CAA9B,CAGb,EAAA,CACA,IAAKg4B,CAAL,GAAsBF,EAAtB,CAAkC,CAChCG,CAAA,CAAyB7jC,CAAA,CAAU4jC,CAAV,CAEzB,KAAKE,CAAL,GAAsBH,EAAtB,CACE,GAAI3jC,CAAA,CAAU8jC,CAAV,CAAJ,GAAiCD,CAAjC,CACE,SAAS,CAIbF,EAAA,CAAWC,CAAX,CAAA,CAA4BF,CAAA,CAAWE,CAAX,CATI,CAalC,MAAOR,EAAA,CAAiBO,CAAjB,CAA6BhiC,EAAA,CAAY0E,CAAZ,CAA7B,CAtBqB,CAlGb,CAAa28B,CAAb,CACjB38B,EAAAuF,OAAA,CAAgByB,EAAA,CAAUhH,CAAAuF,OAAV,CAChBvF,EAAAm8B,gBAAA,CAAyBznC,CAAA,CAASsL,CAAAm8B,gBAAT,CAAA,CACvBtf,CAAA1a,IAAA,CAAcnC,CAAAm8B,gBAAd,CADuB,CACiBn8B,CAAAm8B,gBAuB1C,KAAIuB,EAAQ,CArBQC,QAAQ,CAAC39B,CAAD,CAAS,CACnC,IAAI06B,EAAU16B,CAAA06B,QAAd,CACIkD,EAAUrC,EAAA,CAAcv7B,CAAAsB,KAAd,CAA2B+5B,EAAA,CAAcX,CAAd,CAA3B,CAAmDtmC,CAAnD,CAA8D4L,CAAA47B,iBAA9D,CAGVpjC,EAAA,CAAYolC,CAAZ,CAAJ,EACE3oC,CAAA,CAAQylC,CAAR,CAAiB,QAAQ,CAAC1kC,CAAD,CAAQmnC,CAAR,CAAgB,CACb,cAA1B,GAAIxjC,CAAA,CAAUwjC,CAAV,CAAJ,EACI,OAAOzC,CAAA,CAAQyC,CAAR,CAF4B,CAAzC,CAOE3kC,EAAA,CAAYwH,CAAA69B,gBAAZ,CAAJ,EAA4C,CAAArlC,CAAA,CAAYkjC,CAAAmC,gBAAZ,CAA5C,GACE79B,CAAA69B,gBADF,CAC2BnC,CAAAmC,gBAD3B,CAKA;MAAOC,EAAA,CAAQ99B,CAAR,CAAgB49B,CAAhB,CAAA5K,KAAA,CAA8B2I,CAA9B,CAAiDA,CAAjD,CAlB4B,CAqBzB,CAAgBvnC,CAAhB,CAAZ,CACI2pC,EAAU/tB,CAAAguB,KAAA,CAAQh+B,CAAR,CAYd,KATA/K,CAAA,CAAQgpC,CAAR,CAA8B,QAAQ,CAACC,CAAD,CAAc,CAClD,CAAIA,CAAAC,QAAJ,EAA2BD,CAAAE,aAA3B,GACEV,CAAA98B,QAAA,CAAcs9B,CAAAC,QAAd,CAAmCD,CAAAE,aAAnC,CAEF,EAAIF,CAAAtB,SAAJ,EAA4BsB,CAAAG,cAA5B,GACEX,CAAArjC,KAAA,CAAW6jC,CAAAtB,SAAX,CAAiCsB,CAAAG,cAAjC,CALgD,CAApD,CASA,CAAOX,CAAA9oC,OAAP,CAAA,CAAqB,CACf0pC,CAAAA,CAASZ,CAAAzhB,MAAA,EACb,KAAIsiB,EAAWb,CAAAzhB,MAAA,EAAf,CAEA8hB,EAAUA,CAAA/K,KAAA,CAAasL,CAAb,CAAqBC,CAArB,CAJS,CAOjBjC,CAAJ,EACEyB,CAAAS,QASA,CATkBC,QAAQ,CAACpiC,CAAD,CAAK,CAC7B4H,EAAA,CAAY5H,CAAZ,CAAgB,IAAhB,CAEA0hC,EAAA/K,KAAA,CAAa,QAAQ,CAAC4J,CAAD,CAAW,CAC9BvgC,CAAA,CAAGugC,CAAAt7B,KAAH,CAAkBs7B,CAAApB,OAAlB,CAAmCoB,CAAAlC,QAAnC,CAAqD16B,CAArD,CAD8B,CAAhC,CAGA,OAAO+9B,EANsB,CAS/B,CAAAA,CAAAre,MAAA,CAAgBgf,QAAQ,CAACriC,CAAD,CAAK,CAC3B4H,EAAA,CAAY5H,CAAZ,CAAgB,IAAhB,CAEA0hC,EAAA/K,KAAA,CAAa,IAAb,CAAmB,QAAQ,CAAC4J,CAAD,CAAW,CACpCvgC,CAAA,CAAGugC,CAAAt7B,KAAH,CAAkBs7B,CAAApB,OAAlB,CAAmCoB,CAAAlC,QAAnC,CAAqD16B,CAArD,CADoC,CAAtC,CAGA,OAAO+9B,EANoB,CAV/B,GAmBEA,CAAAS,QACA,CADkBG,EAAA,CAAoB,SAApB,CAClB,CAAAZ,CAAAre,MAAA,CAAgBif,EAAA,CAAoB,OAApB,CApBlB,CAuBA,OAAOZ,EAtFqB,CAwR9BD,QAASA,EAAO,CAAC99B,CAAD;AAAS49B,CAAT,CAAkB,CA+DhCgB,QAASA,EAAI,CAACpD,CAAD,CAASoB,CAAT,CAAmBiC,CAAnB,CAAkCC,CAAlC,CAA8C,CAUzDC,QAASA,EAAkB,EAAG,CAC5BC,CAAA,CAAepC,CAAf,CAAyBpB,CAAzB,CAAiCqD,CAAjC,CAAgDC,CAAhD,CAD4B,CAT1BnjB,CAAJ,GAz/BC,GA0/BC,EAAc6f,CAAd,EA1/ByB,GA0/BzB,CAAcA,CAAd,CACE7f,CAAA9B,IAAA,CAAUuG,CAAV,CAAe,CAACob,CAAD,CAASoB,CAAT,CAAmB3B,EAAA,CAAa4D,CAAb,CAAnB,CAAgDC,CAAhD,CAAf,CADF,CAIEnjB,CAAAkI,OAAA,CAAazD,CAAb,CALJ,CAaIgc,EAAJ,CACEtsB,CAAAmvB,YAAA,CAAuBF,CAAvB,CADF,EAGEA,CAAA,EACA,CAAKjvB,CAAAovB,QAAL,EAAyBpvB,CAAAzO,OAAA,EAJ3B,CAdyD,CA0B3D29B,QAASA,EAAc,CAACpC,CAAD,CAAWpB,CAAX,CAAmBd,CAAnB,CAA4BoE,CAA5B,CAAwC,CAE7DtD,CAAA,CAAoB,EAAX,EAAAA,CAAA,CAAeA,CAAf,CAAwB,CAEjC,EAthCC,GAshCA,EAAUA,CAAV,EAthC0B,GAshC1B,CAAUA,CAAV,CAAoB2D,CAAAC,QAApB,CAAuCD,CAAArC,OAAxC,EAAyD,CACvDx7B,KAAMs7B,CADiD,CAEvDpB,OAAQA,CAF+C,CAGvDd,QAASW,EAAA,CAAcX,CAAd,CAH8C,CAIvD16B,OAAQA,CAJ+C,CAKvD8+B,WAAYA,CAL2C,CAAzD,CAJ6D,CAa/DO,QAASA,EAAwB,CAACtkB,CAAD,CAAS,CACxCikB,CAAA,CAAejkB,CAAAzZ,KAAf,CAA4ByZ,CAAAygB,OAA5B,CAA2ClgC,EAAA,CAAYyf,CAAA2f,QAAA,EAAZ,CAA3C,CAA0E3f,CAAA+jB,WAA1E,CADwC,CAI1CQ,QAASA,EAAgB,EAAG,CAC1B,IAAIxV,EAAMhb,CAAAywB,gBAAAxlC,QAAA,CAA8BiG,CAA9B,CACG,GAAb,GAAI8pB,CAAJ,EAAgBhb,CAAAywB,gBAAAvlC,OAAA,CAA6B8vB,CAA7B,CAAkC,CAAlC,CAFU,CA1GI,IAC5BqV,EAAWnvB,CAAAkS,MAAA,EADiB,CAE5B6b,EAAUoB,CAAApB,QAFkB,CAG5BpiB,CAH4B,CAI5B6jB,CAJ4B,CAK5BlC,EAAat9B,CAAA06B,QALe,CAM5Bta,EAAMqf,CAAA,CAASz/B,CAAAogB,IAAT,CAAqBpgB,CAAAm8B,gBAAA,CAAuBn8B,CAAAm6B,OAAvB,CAArB,CAEVrrB;CAAAywB,gBAAAllC,KAAA,CAA2B2F,CAA3B,CACA+9B,EAAA/K,KAAA,CAAasM,CAAb,CAA+BA,CAA/B,CAGK3jB,EAAA3b,CAAA2b,MAAL,EAAqBA,CAAA+f,CAAA/f,MAArB,EAAyD,CAAA,CAAzD,GAAwC3b,CAAA2b,MAAxC,EACuB,KADvB,GACK3b,CAAAuF,OADL,EACkD,OADlD,GACgCvF,CAAAuF,OADhC,GAEEoW,CAFF,CAEUjlB,CAAA,CAASsJ,CAAA2b,MAAT,CAAA,CAAyB3b,CAAA2b,MAAzB,CACAjlB,CAAA,CAASglC,CAAA/f,MAAT,CAAA,CAA2B+f,CAAA/f,MAA3B,CACA+jB,CAJV,CAOI/jB,EAAJ,GACE6jB,CACA,CADa7jB,CAAAxZ,IAAA,CAAUie,CAAV,CACb,CAAI3nB,CAAA,CAAU+mC,CAAV,CAAJ,CACoBA,CAAlB,EAhvUMnqC,CAAA,CAgvUYmqC,CAhvUDxM,KAAX,CAgvUN,CAEEwM,CAAAxM,KAAA,CAAgBqM,CAAhB,CAA0CA,CAA1C,CAFF,CAKM5qC,CAAA,CAAQ+qC,CAAR,CAAJ,CACER,CAAA,CAAeQ,CAAA,CAAW,CAAX,CAAf,CAA8BA,CAAA,CAAW,CAAX,CAA9B,CAA6ClkC,EAAA,CAAYkkC,CAAA,CAAW,CAAX,CAAZ,CAA7C,CAAyEA,CAAA,CAAW,CAAX,CAAzE,CADF,CAGER,CAAA,CAAeQ,CAAf,CAA2B,GAA3B,CAAgC,EAAhC,CAAoC,IAApC,CATN,CAcE7jB,CAAA9B,IAAA,CAAUuG,CAAV,CAAe2d,CAAf,CAhBJ,CAuBIvlC,EAAA,CAAYgnC,CAAZ,CAAJ,GAQE,CAPIG,CAOJ,CAPgBC,EAAA,CAAgB5/B,CAAAogB,IAAhB,CAAA,CACV1O,CAAA,EAAA,CAAiB1R,CAAAi8B,eAAjB,EAA0CP,CAAAO,eAA1C,CADU,CAEV7nC,CAKN,IAHEkpC,CAAA,CAAYt9B,CAAAk8B,eAAZ,EAAqCR,CAAAQ,eAArC,CAGF,CAHmEyD,CAGnE,EAAAvwB,CAAA,CAAapP,CAAAuF,OAAb,CAA4B6a,CAA5B,CAAiCwd,CAAjC,CAA0CgB,CAA1C,CAAgDtB,CAAhD,CAA4Dt9B,CAAA6/B,QAA5D,CACI7/B,CAAA69B,gBADJ,CAC4B79B,CAAA8/B,aAD5B,CARF,CAYA,OAAO/B,EAtDyB,CAiHlC0B,QAASA,EAAQ,CAACrf,CAAD,CAAM2f,CAAN,CAAwB,CACT,CAA9B,CAAIA,CAAAnrC,OAAJ,GACEwrB,CADF,GACgC,EAAtB,EAACA,CAAArmB,QAAA,CAAY,GAAZ,CAAD,CAA2B,GAA3B,CAAiC,GAD3C,EACkDgmC,CADlD,CAGA;MAAO3f,EAJgC,CA/5BzC,IAAIsf,EAAe5xB,CAAA,CAAc,OAAd,CAKnB4tB,EAAAS,gBAAA,CAA2BznC,CAAA,CAASgnC,CAAAS,gBAAT,CAAA,CACzBtf,CAAA1a,IAAA,CAAcu5B,CAAAS,gBAAd,CADyB,CACiBT,CAAAS,gBAO5C,KAAI8B,EAAuB,EAE3BhpC,EAAA,CAAQwnC,CAAR,CAA8B,QAAQ,CAACuD,CAAD,CAAqB,CACzD/B,CAAAr9B,QAAA,CAA6BlM,CAAA,CAASsrC,CAAT,CAAA,CACvBnjB,CAAA1a,IAAA,CAAc69B,CAAd,CADuB,CACanjB,CAAA5b,OAAA,CAAiB++B,CAAjB,CAD1C,CADyD,CAA3D,CAopBAlxB,EAAAywB,gBAAA,CAAwB,EA4GxBU,UAA2B,CAACxpB,CAAD,CAAQ,CACjCxhB,CAAA,CAAQwC,SAAR,CAAmB,QAAQ,CAACyI,CAAD,CAAO,CAChC4O,CAAA,CAAM5O,CAAN,CAAA,CAAc,QAAQ,CAACkgB,CAAD,CAAMpgB,CAAN,CAAc,CAClC,MAAO8O,EAAA,CAAMvX,CAAA,CAAO,EAAP,CAAWyI,CAAX,EAAqB,EAArB,CAAyB,CACpCuF,OAAQrF,CAD4B,CAEpCkgB,IAAKA,CAF+B,CAAzB,CAAN,CAD2B,CADJ,CAAlC,CADiC,CAAnC6f,CA1DA,CAAmB,KAAnB,CAA0B,QAA1B,CAAoC,MAApC,CAA4C,OAA5C,CAsEAC,UAAmC,CAAChgC,CAAD,CAAO,CACxCjL,CAAA,CAAQwC,SAAR,CAAmB,QAAQ,CAACyI,CAAD,CAAO,CAChC4O,CAAA,CAAM5O,CAAN,CAAA,CAAc,QAAQ,CAACkgB,CAAD,CAAM9e,CAAN,CAAYtB,CAAZ,CAAoB,CACxC,MAAO8O,EAAA,CAAMvX,CAAA,CAAO,EAAP,CAAWyI,CAAX,EAAqB,EAArB,CAAyB,CACpCuF,OAAQrF,CAD4B,CAEpCkgB,IAAKA,CAF+B,CAGpC9e,KAAMA,CAH8B,CAAzB,CAAN,CADiC,CADV,CAAlC,CADwC,CAA1C4+B,CA9BA,CAA2B,MAA3B,CAAmC,KAAnC,CAA0C,OAA1C,CAYApxB,EAAA4sB,SAAA,CAAiBA,CAGjB,OAAO5sB,EA9wB4E,CADzE,CA9HW,CA8jCzBS,QAASA,GAAmB,EAAG,CAC7B,IAAA0J,KAAA;AAAYC,QAAQ,EAAG,CACrB,MAAOinB,SAAkB,EAAG,CAC1B,MAAO,KAAIjsC,CAAAksC,eADe,CADP,CADM,CAyB/B/wB,QAASA,GAAoB,EAAG,CAC9B,IAAA4J,KAAA,CAAY,CAAC,UAAD,CAAa,SAAb,CAAwB,WAAxB,CAAqC,aAArC,CAAoD,QAAQ,CAACrL,CAAD,CAAWsD,CAAX,CAAoBhD,CAApB,CAA+BoB,CAA/B,CAA4C,CAClH,MAAO+wB,GAAA,CAAkBzyB,CAAlB,CAA4B0B,CAA5B,CAAyC1B,CAAAsU,MAAzC,CAAyDhR,CAAAzP,QAAA6+B,UAAzD,CAAoFpyB,CAAA,CAAU,CAAV,CAApF,CAD2G,CAAxG,CADkB,CAMhCmyB,QAASA,GAAiB,CAACzyB,CAAD,CAAWuyB,CAAX,CAAsBI,CAAtB,CAAqCD,CAArC,CAAgDE,CAAhD,CAA6D,CA8GrFC,QAASA,EAAQ,CAACrgB,CAAD,CAAMsgB,CAAN,CAAkB9B,CAAlB,CAAwB,CAAA,IAInC72B,EAASy4B,CAAA7tB,cAAA,CAA0B,QAA1B,CAJ0B,CAIWqO,EAAW,IAC7DjZ,EAAA2M,KAAA,CAAc,iBACd3M,EAAAlR,IAAA,CAAaupB,CACbrY,EAAA44B,MAAA,CAAe,CAAA,CAEf3f,EAAA,CAAWA,QAAQ,CAACrJ,CAAD,CAAQ,CACH5P,CA3kRtBkN,oBAAA,CA2kR8BP,MA3kR9B,CA2kRsCsM,CA3kRtC,CAAsC,CAAA,CAAtC,CA4kRsBjZ,EA5kRtBkN,oBAAA,CA4kR8BP,OA5kR9B,CA4kRuCsM,CA5kRvC,CAAsC,CAAA,CAAtC,CA6kRAwf,EAAAI,KAAA/pB,YAAA,CAA6B9O,CAA7B,CACAA,EAAA,CAAS,IACT,KAAIyzB,EAAU,EAAd,CACI1H,EAAO,SAEPnc,EAAJ,GACqB,MAInB,GAJIA,CAAAjD,KAIJ,EAJ8B4rB,CAAA,CAAUI,CAAV,CAAAG,OAI9B,GAHElpB,CAGF,CAHU,CAAEjD,KAAM,OAAR,CAGV;AADAof,CACA,CADOnc,CAAAjD,KACP,CAAA8mB,CAAA,CAAwB,OAAf,GAAA7jB,CAAAjD,KAAA,CAAyB,GAAzB,CAA+B,GAL1C,CAQIkqB,EAAJ,EACEA,CAAA,CAAKpD,CAAL,CAAa1H,CAAb,CAjBuB,CAqBR/rB,EAlmRjB+4B,iBAAA,CAkmRyBpsB,MAlmRzB,CAkmRiCsM,CAlmRjC,CAAmC,CAAA,CAAnC,CAmmRiBjZ,EAnmRjB+4B,iBAAA,CAmmRyBpsB,OAnmRzB,CAmmRkCsM,CAnmRlC,CAAmC,CAAA,CAAnC,CAomRFwf,EAAAI,KAAAluB,YAAA,CAA6B3K,CAA7B,CACA,OAAOiZ,EAjCgC,CA5GzC,MAAO,SAAQ,CAACzb,CAAD,CAAS6a,CAAT,CAAcqN,CAAd,CAAoBzM,CAApB,CAA8B0Z,CAA9B,CAAuCmF,CAAvC,CAAgDhC,CAAhD,CAAiEiC,CAAjE,CAA+E,CA2F5FiB,QAASA,EAAc,EAAG,CACxBC,CAAA,EAAaA,CAAA,EACbC,EAAA,EAAOA,CAAAC,MAAA,EAFiB,CAK1BC,QAASA,EAAe,CAACngB,CAAD,CAAWwa,CAAX,CAAmBoB,CAAnB,CAA6BiC,CAA7B,CAA4CC,CAA5C,CAAwD,CAE1ErmC,CAAA,CAAU4pB,CAAV,CAAJ,EACEke,CAAAje,OAAA,CAAqBD,CAArB,CAEF2e,EAAA,CAAYC,CAAZ,CAAkB,IAElBjgB,EAAA,CAASwa,CAAT,CAAiBoB,CAAjB,CAA2BiC,CAA3B,CAA0CC,CAA1C,CACAlxB,EAAA+S,6BAAA,CAAsCzoB,CAAtC,CAR8E,CA/FhF0V,CAAAgT,6BAAA,EACAR,EAAA,CAAMA,CAAN,EAAaxS,CAAAwS,IAAA,EAEb,IAAyB,OAAzB,EAAIzmB,CAAA,CAAU4L,CAAV,CAAJ,CAAkC,CAChC,IAAIm7B,EAAa,GAAbA,CAAmBnoC,CAAC+nC,CAAAr5B,QAAA,EAAD1O,UAAA,CAA+B,EAA/B,CACvB+nC,EAAA,CAAUI,CAAV,CAAA,CAAwB,QAAQ,CAACp/B,CAAD,CAAO,CACrCg/B,CAAA,CAAUI,CAAV,CAAAp/B,KAAA,CAA6BA,CAC7Bg/B,EAAA,CAAUI,CAAV,CAAAG,OAAA,CAA+B,CAAA,CAFM,CAKvC,KAAIG,EAAYP,CAAA,CAASrgB,CAAA/iB,QAAA,CAAY,eAAZ,CAA6B,oBAA7B;AAAoDqjC,CAApD,CAAT,CACZA,CADY,CACA,QAAQ,CAAClF,CAAD,CAAS1H,CAAT,CAAe,CACrCqN,CAAA,CAAgBngB,CAAhB,CAA0Bwa,CAA1B,CAAkC8E,CAAA,CAAUI,CAAV,CAAAp/B,KAAlC,CAA8D,EAA9D,CAAkEwyB,CAAlE,CACAwM,EAAA,CAAUI,CAAV,CAAA,CAAwBxoC,CAFa,CADvB,CAPgB,CAAlC,IAYO,CAEL,IAAI+oC,EAAMd,CAAA,CAAU56B,CAAV,CAAkB6a,CAAlB,CAEV6gB,EAAAG,KAAA,CAAS77B,CAAT,CAAiB6a,CAAjB,CAAsB,CAAA,CAAtB,CACAnrB,EAAA,CAAQylC,CAAR,CAAiB,QAAQ,CAAC1kC,CAAD,CAAQZ,CAAR,CAAa,CAChCqD,CAAA,CAAUzC,CAAV,CAAJ,EACIirC,CAAAI,iBAAA,CAAqBjsC,CAArB,CAA0BY,CAA1B,CAFgC,CAAtC,CAMAirC,EAAAK,OAAA,CAAaC,QAAsB,EAAG,CACpC,IAAIzC,EAAamC,CAAAnC,WAAbA,EAA+B,EAAnC,CAIIlC,EAAY,UAAD,EAAeqE,EAAf,CAAsBA,CAAArE,SAAtB,CAAqCqE,CAAAO,aAJpD,CAOIhG,EAAwB,IAAf,GAAAyF,CAAAzF,OAAA,CAAsB,GAAtB,CAA4ByF,CAAAzF,OAK1B,EAAf,GAAIA,CAAJ,GACEA,CADF,CACWoB,CAAA,CAAW,GAAX,CAA6C,MAA5B,EAAA6E,EAAA,CAAWrhB,CAAX,CAAAshB,SAAA,CAAqC,GAArC,CAA2C,CADvE,CAIAP,EAAA,CAAgBngB,CAAhB,CACIwa,CADJ,CAEIoB,CAFJ,CAGIqE,CAAAU,sBAAA,EAHJ,CAII7C,CAJJ,CAjBoC,CAwBlCV,EAAAA,CAAeA,QAAQ,EAAG,CAG5B+C,CAAA,CAAgBngB,CAAhB,CAA2B,EAA3B,CAA8B,IAA9B,CAAoC,IAApC,CAA0C,EAA1C,CAH4B,CAM9BigB,EAAAW,QAAA,CAAcxD,CACd6C,EAAAY,QAAA,CAAczD,CAEVP,EAAJ,GACEoD,CAAApD,gBADF,CACwB,CAAA,CADxB,CAIA,IAAIiC,CAAJ,CACE,GAAI,CACFmB,CAAAnB,aAAA,CAAmBA,CADjB,CAEF,MAAO1hC,EAAP,CAAU,CAQV,GAAqB,MAArB,GAAI0hC,CAAJ,CACE,KAAM1hC,GAAN,CATQ,CAcd6iC,CAAAa,KAAA,CAAStpC,CAAA,CAAYi1B,CAAZ,CAAA,CAAoB,IAApB,CAA2BA,CAApC,CAjEK,CAoEP,GAAc,CAAd;AAAIoS,CAAJ,CACE,IAAIxd,EAAYke,CAAA,CAAcQ,CAAd,CAA8BlB,CAA9B,CADlB,KAEyBA,EAAlB,EAh+UKxqC,CAAA,CAg+UawqC,CAh+UF7M,KAAX,CAg+UL,EACL6M,CAAA7M,KAAA,CAAa+N,CAAb,CAvF0F,CAFT,CA0MvFpyB,QAASA,GAAoB,EAAG,CAC9B,IAAI0pB,EAAc,IAAlB,CACIC,EAAY,IAWhB,KAAAD,YAAA,CAAmB0J,QAAQ,CAAC/rC,CAAD,CAAQ,CACjC,MAAIA,EAAJ,EACEqiC,CACO,CADOriC,CACP,CAAA,IAFT,EAISqiC,CALwB,CAkBnC,KAAAC,UAAA,CAAiB0J,QAAQ,CAAChsC,CAAD,CAAQ,CAC/B,MAAIA,EAAJ,EACEsiC,CACO,CADKtiC,CACL,CAAA,IAFT,EAISsiC,CALsB,CAUjC,KAAArf,KAAA,CAAY,CAAC,QAAD,CAAW,mBAAX,CAAgC,MAAhC,CAAwC,QAAQ,CAACrJ,CAAD,CAASxB,CAAT,CAA4BgC,CAA5B,CAAkC,CAM5F6xB,QAASA,EAAM,CAACC,CAAD,CAAK,CAClB,MAAO,QAAP,CAAkBA,CADA,CAIpBC,QAASA,EAAY,CAACrO,CAAD,CAAO,CAC1B,MAAOA,EAAAz2B,QAAA,CAAa+kC,CAAb,CAAiC/J,CAAjC,CAAAh7B,QAAA,CACGglC,CADH,CACqB/J,CADrB,CADmB,CAuB5BgK,QAASA,EAAqB,CAACnhC,CAAD,CAAQof,CAAR,CAAkBgiB,CAAlB,CAAkCC,CAAlC,CAAkD,CAC9E,IAAIC,CACJ,OAAOA,EAAP,CAAiBthC,CAAAtI,OAAA,CAAa6pC,QAAiC,CAACvhC,CAAD,CAAQ,CACrEshC,CAAA,EACA,OAAOD,EAAA,CAAerhC,CAAf,CAF8D,CAAtD,CAGdof,CAHc,CAGJgiB,CAHI,CAF6D,CAsGhF7zB,QAASA,EAAY,CAAColB,CAAD,CAAO6O,CAAP,CAA2B7N,CAA3B,CAA2CD,CAA3C,CAAyD,CAuG5E+N,QAASA,EAAyB,CAAC5sC,CAAD,CAAQ,CACxC,GAAI,CACeA,IAAAA,EAAAA,CAvCjB,EAAA,CAAO8+B,CAAA,CACL1kB,CAAAyyB,WAAA,CAAgB/N,CAAhB,CAAgC9+B,CAAhC,CADK,CAELoa,CAAApZ,QAAA,CAAahB,CAAb,CAsCK,KAAA,CAAA,IAAA6+B,CAAA,EAAiB,CAAAp8B,CAAA,CAAUzC,CAAV,CAAjB,CAAoCA,CAAAA;AAAAA,CAApC,KAjOX,IAAa,IAAb,EAAIA,CAAJ,CACE,CAAA,CAAO,EADT,KAAA,CAGA,OAAQ,MAAOA,EAAf,EACE,KAAK,QAAL,CACE,KACF,MAAK,QAAL,CACEA,CAAA,CAAQ,EAAR,CAAaA,CACb,MACF,SACEA,CAAA,CAAQ2G,EAAA,CAAO3G,CAAP,CAPZ,CAUA,CAAA,CAAOA,CAbP,CAiOI,MAAO,EAFL,CAGF,MAAOgmB,CAAP,CAAY,CACZ5N,CAAA,CAAkB00B,EAAAC,OAAA,CAA0BjP,CAA1B,CAAgC9X,CAAhC,CAAlB,CADY,CAJ0B,CArG1C,GAAKpnB,CAAAk/B,CAAAl/B,OAAL,EAAmD,EAAnD,GAAoBk/B,CAAA/5B,QAAA,CAAas+B,CAAb,CAApB,CAAsD,CACpD,IAAImK,CACCG,EAAL,GACMK,CAIJ,CAJoBb,CAAA,CAAarO,CAAb,CAIpB,CAHA0O,CAGA,CAHiBnqC,EAAA,CAAQ2qC,CAAR,CAGjB,CAFAR,CAAAS,IAEA,CAFqBnP,CAErB,CADA0O,CAAAjO,YACA,CAD6B,EAC7B,CAAAiO,CAAAU,gBAAA,CAAiCZ,CALnC,CAOA,OAAOE,EAT6C,CAYtD3N,CAAA,CAAe,CAAEA,CAAAA,CAd2D,KAexEt4B,CAfwE,CAgBxE4mC,CAhBwE,CAiBxErpC,EAAQ,CAjBgE,CAkBxEy6B,EAAc,EAlB0D,CAmBxE6O,EAAW,EACXC,EAAAA,CAAavP,CAAAl/B,OAKjB,KAzB4E,IAsBxEoH,EAAS,EAtB+D,CAuBxEsnC,EAAsB,EAE1B,CAAOxpC,CAAP,CAAeupC,CAAf,CAAA,CACE,GAAyD,EAAzD,GAAM9mC,CAAN,CAAmBu3B,CAAA/5B,QAAA,CAAas+B,CAAb,CAA0Bv+B,CAA1B,CAAnB,GAC+E,EAD/E,GACOqpC,CADP,CACkBrP,CAAA/5B,QAAA,CAAau+B,CAAb,CAAwB/7B,CAAxB,CAAqCgnC,CAArC,CADlB,EAEMzpC,CAQJ,GARcyC,CAQd,EAPEP,CAAA3B,KAAA,CAAY8nC,CAAA,CAAarO,CAAA/0B,UAAA,CAAejF,CAAf,CAAsByC,CAAtB,CAAb,CAAZ,CAOF,CALA0mC,CAKA,CALMnP,CAAA/0B,UAAA,CAAexC,CAAf,CAA4BgnC,CAA5B,CAA+CJ,CAA/C,CAKN,CAJA5O,CAAAl6B,KAAA,CAAiB4oC,CAAjB,CAIA,CAHAG,CAAA/oC,KAAA,CAAcuV,CAAA,CAAOqzB,CAAP,CAAYL,CAAZ,CAAd,CAGA,CAFA9oC,CAEA,CAFQqpC,CAER,CAFmBK,CAEnB,CADAF,CAAAjpC,KAAA,CAAyB2B,CAAApH,OAAzB,CACA,CAAAoH,CAAA3B,KAAA,CAAY,EAAZ,CAVF,KAWO,CAEDP,CAAJ,GAAcupC,CAAd;AACErnC,CAAA3B,KAAA,CAAY8nC,CAAA,CAAarO,CAAA/0B,UAAA,CAAejF,CAAf,CAAb,CAAZ,CAEF,MALK,CAeLg7B,CAAJ,EAAsC,CAAtC,CAAsB94B,CAAApH,OAAtB,EACIkuC,EAAAW,cAAA,CAAiC3P,CAAjC,CAGJ,IAAK6O,CAAAA,CAAL,EAA2BpO,CAAA3/B,OAA3B,CAA+C,CAC7C,IAAI8uC,EAAUA,QAAQ,CAAC9K,CAAD,CAAS,CAC7B,IAD6B,IACpB/iC,EAAI,CADgB,CACbY,EAAK89B,CAAA3/B,OAArB,CAAyCiB,CAAzC,CAA6CY,CAA7C,CAAiDZ,CAAA,EAAjD,CAAsD,CACpD,GAAIg/B,CAAJ,EAAoBr8B,CAAA,CAAYogC,CAAA,CAAO/iC,CAAP,CAAZ,CAApB,CAA4C,MAC5CmG,EAAA,CAAOsnC,CAAA,CAAoBztC,CAApB,CAAP,CAAA,CAAiC+iC,CAAA,CAAO/iC,CAAP,CAFmB,CAItD,MAAOmG,EAAAoD,KAAA,CAAY,EAAZ,CALsB,CAc/B,OAAO7H,EAAA,CAAOosC,QAAwB,CAACxuC,CAAD,CAAU,CAC5C,IAAIU,EAAI,CAAR,CACIY,EAAK89B,CAAA3/B,OADT,CAEIgkC,EAAa7jC,KAAJ,CAAU0B,CAAV,CAEb,IAAI,CACF,IAAA,CAAOZ,CAAP,CAAWY,CAAX,CAAeZ,CAAA,EAAf,CACE+iC,CAAA,CAAO/iC,CAAP,CAAA,CAAYutC,CAAA,CAASvtC,CAAT,CAAA,CAAYV,CAAZ,CAGd,OAAOuuC,EAAA,CAAQ9K,CAAR,CALL,CAMF,MAAO5c,CAAP,CAAY,CACZ5N,CAAA,CAAkB00B,EAAAC,OAAA,CAA0BjP,CAA1B,CAAgC9X,CAAhC,CAAlB,CADY,CAX8B,CAAzC,CAeF,CAEHinB,IAAKnP,CAFF,CAGHS,YAAaA,CAHV,CAIH2O,gBAAiBA,QAAQ,CAAC/hC,CAAD,CAAQof,CAAR,CAAkB,CACzC,IAAIuV,CACJ,OAAO30B,EAAAyiC,YAAA,CAAkBR,CAAlB,CAA4BS,QAA6B,CAACjL,CAAD,CAASkL,CAAT,CAAoB,CAClF,IAAIC,EAAYL,CAAA,CAAQ9K,CAAR,CACZvjC,EAAA,CAAWkrB,CAAX,CAAJ,EACEA,CAAAhrB,KAAA,CAAc,IAAd,CAAoBwuC,CAApB,CAA+BnL,CAAA,GAAWkL,CAAX,CAAuBhO,CAAvB,CAAmCiO,CAAlE,CAA6E5iC,CAA7E,CAEF20B,EAAA,CAAYiO,CALsE,CAA7E,CAFkC,CAJxC,CAfE,CAfsC,CAxD6B,CAvIc,IACxFR,EAAoBlL,CAAAzjC,OADoE,CAExF4uC,EAAkBlL,CAAA1jC,OAFsE,CAGxFwtC,EAAqB,IAAIlrC,MAAJ,CAAWmhC,CAAAh7B,QAAA,CAAoB,IAApB;AAA0B4kC,CAA1B,CAAX,CAA8C,GAA9C,CAHmE,CAIxFI,EAAmB,IAAInrC,MAAJ,CAAWohC,CAAAj7B,QAAA,CAAkB,IAAlB,CAAwB4kC,CAAxB,CAAX,CAA4C,GAA5C,CAgQvBvzB,EAAA2pB,YAAA,CAA2B2L,QAAQ,EAAG,CACpC,MAAO3L,EAD6B,CAgBtC3pB,EAAA4pB,UAAA,CAAyB2L,QAAQ,EAAG,CAClC,MAAO3L,EAD2B,CAIpC,OAAO5pB,EAxRqF,CAAlF,CAzCkB,CAqUhCG,QAASA,GAAiB,EAAG,CAC3B,IAAAoK,KAAA,CAAY,CAAC,YAAD,CAAe,SAAf,CAA0B,IAA1B,CAAgC,KAAhC,CAAuC,UAAvC,CACP,QAAQ,CAACnJ,CAAD,CAAeoB,CAAf,CAA0BlB,CAA1B,CAAgCE,CAAhC,CAAuCtC,CAAvC,CAAiD,CAiI5Ds2B,QAASA,EAAQ,CAAC7nC,CAAD,CAAK+lB,CAAL,CAAY+hB,CAAZ,CAAmBC,CAAnB,CAAgC,CAkC/CpjB,QAASA,EAAQ,EAAG,CACbqjB,CAAL,CAGEhoC,CAAAG,MAAA,CAAS,IAAT,CAAe4d,CAAf,CAHF,CACE/d,CAAA,CAAGioC,CAAH,CAFgB,CAlC2B,IAC3CD,EAA+B,CAA/BA,CAAY5sC,SAAA7C,OAD+B,CAE3CwlB,EAAOiqB,CAAA,CAplVR7sC,EAAAjC,KAAA,CAolV8BkC,SAplV9B,CAolVyC8E,CAplVzC,CAolVQ,CAAsC,EAFF,CAG3CgoC,EAAcrzB,CAAAqzB,YAH6B,CAI3CC,EAAgBtzB,CAAAszB,cAJ2B,CAK3CF,EAAY,CAL+B,CAM3CG,EAAahsC,CAAA,CAAU2rC,CAAV,CAAbK,EAAuC,CAACL,CANG,CAO3CjF,EAAWjd,CAACuiB,CAAA,CAAYv0B,CAAZ,CAAkBF,CAAnBkS,OAAA,EAPgC,CAQ3C6b,EAAUoB,CAAApB,QAEdoG,EAAA,CAAQ1rC,CAAA,CAAU0rC,CAAV,CAAA,CAAmBA,CAAnB,CAA2B,CAEnCpG,EAAA2G,aAAA,CAAuBH,CAAA,CAAYI,QAAa,EAAG,CAC7CF,CAAJ,CACE72B,CAAAsU,MAAA,CAAelB,CAAf,CADF,CAGElR,CAAAlX,WAAA,CAAsBooB,CAAtB,CAEFme,EAAAyF,OAAA,CAAgBN,CAAA,EAAhB,CAEY,EAAZ,CAAIH,CAAJ,EAAiBG,CAAjB,EAA8BH,CAA9B,GACEhF,CAAAC,QAAA,CAAiBkF,CAAjB,CAEA;AADAE,CAAA,CAAczG,CAAA2G,aAAd,CACA,CAAA,OAAOG,CAAA,CAAU9G,CAAA2G,aAAV,CAHT,CAMKD,EAAL,EAAgB30B,CAAAzO,OAAA,EAdiC,CAA5B,CAgBpB+gB,CAhBoB,CAkBvByiB,EAAA,CAAU9G,CAAA2G,aAAV,CAAA,CAAkCvF,CAElC,OAAOpB,EAhCwC,CAhIjD,IAAI8G,EAAY,EAsLhBX,EAAA5hB,OAAA,CAAkBwiB,QAAQ,CAAC/G,CAAD,CAAU,CAClC,MAAIA,EAAJ,EAAeA,CAAA2G,aAAf,GAAuCG,EAAvC,EACEA,CAAA,CAAU9G,CAAA2G,aAAV,CAAA5H,OAAA,CAAuC,UAAvC,CAGO,CAFP5rB,CAAAszB,cAAA,CAAsBzG,CAAA2G,aAAtB,CAEO,CADP,OAAOG,CAAA,CAAU9G,CAAA2G,aAAV,CACA,CAAA,CAAA,CAJT,EAMO,CAAA,CAP2B,CAUpC,OAAOR,EAjMqD,CADlD,CADe,CA6N7Ba,QAASA,GAAU,CAAC1gC,CAAD,CAAO,CACpB2gC,CAAAA,CAAW3gC,CAAA7K,MAAA,CAAW,GAAX,CAGf,KAHA,IACI3D,EAAImvC,CAAApwC,OAER,CAAOiB,CAAA,EAAP,CAAA,CACEmvC,CAAA,CAASnvC,CAAT,CAAA,CAAcwJ,EAAA,CAAiB2lC,CAAA,CAASnvC,CAAT,CAAjB,CAGhB,OAAOmvC,EAAA5lC,KAAA,CAAc,GAAd,CARiB,CAW1B6lC,QAASA,GAAgB,CAACC,CAAD,CAAcC,CAAd,CAA2B,CAClD,IAAIC,EAAY3D,EAAA,CAAWyD,CAAX,CAEhBC,EAAAE,WAAA,CAAyBD,CAAA1D,SACzByD,EAAAG,OAAA,CAAqBF,CAAAG,SACrBJ,EAAAK,OAAA,CAAqB7tC,EAAA,CAAMytC,CAAAK,KAAN,CAArB,EAA8CC,EAAA,CAAcN,CAAA1D,SAAd,CAA9C,EAAmF,IALjC,CASpDiE,QAASA,GAAW,CAACC,CAAD,CAAcT,CAAd,CAA2B,CAC7C,IAAIU,EAAsC,GAAtCA,GAAYD,CAAArqC,OAAA,CAAmB,CAAnB,CACZsqC;CAAJ,GACED,CADF,CACgB,GADhB,CACsBA,CADtB,CAGA,KAAIxqC,EAAQqmC,EAAA,CAAWmE,CAAX,CACZT,EAAAW,OAAA,CAAqBnnC,kBAAA,CAAmBknC,CAAA,EAAyC,GAAzC,GAAYzqC,CAAA2qC,SAAAxqC,OAAA,CAAsB,CAAtB,CAAZ,CACpCH,CAAA2qC,SAAAhnC,UAAA,CAAyB,CAAzB,CADoC,CACN3D,CAAA2qC,SADb,CAErBZ,EAAAa,SAAA,CAAuBpnC,EAAA,CAAcxD,CAAA6qC,OAAd,CACvBd,EAAAe,OAAA,CAAqBvnC,kBAAA,CAAmBvD,CAAAmjB,KAAnB,CAGjB4mB,EAAAW,OAAJ,EAA0D,GAA1D,EAA0BX,CAAAW,OAAAvqC,OAAA,CAA0B,CAA1B,CAA1B,GACE4pC,CAAAW,OADF,CACuB,GADvB,CAC6BX,CAAAW,OAD7B,CAZ6C,CAyB/CK,QAASA,GAAU,CAACC,CAAD,CAAQC,CAAR,CAAe,CAChC,GAA6B,CAA7B,GAAIA,CAAAtsC,QAAA,CAAcqsC,CAAd,CAAJ,CACE,MAAOC,EAAA9kB,OAAA,CAAa6kB,CAAAxxC,OAAb,CAFuB,CAOlC0sB,QAASA,GAAS,CAAClB,CAAD,CAAM,CACtB,IAAItmB,EAAQsmB,CAAArmB,QAAA,CAAY,GAAZ,CACZ,OAAiB,EAAV,EAAAD,CAAA,CAAcsmB,CAAd,CAAoBA,CAAAmB,OAAA,CAAW,CAAX,CAAcznB,CAAd,CAFL,CAKxBwsC,QAASA,GAAa,CAAClmB,CAAD,CAAM,CAC1B,MAAOA,EAAA/iB,QAAA,CAAY,UAAZ,CAAwB,IAAxB,CADmB,CAwB5BkpC,QAASA,GAAgB,CAACC,CAAD,CAAUC,CAAV,CAAyBC,CAAzB,CAAqC,CAC5D,IAAAC,QAAA,CAAe,CAAA,CACfD,EAAA,CAAaA,CAAb,EAA2B,EAC3BzB,GAAA,CAAiBuB,CAAjB,CAA0B,IAA1B,CAQA,KAAAI,QAAA,CAAeC,QAAQ,CAACzmB,CAAD,CAAM,CAC3B,IAAI0mB,EAAUX,EAAA,CAAWM,CAAX;AAA0BrmB,CAA1B,CACd,IAAK,CAAA1rB,CAAA,CAASoyC,CAAT,CAAL,CACE,KAAMC,GAAA,CAAgB,UAAhB,CAA6E3mB,CAA7E,CACFqmB,CADE,CAAN,CAIFd,EAAA,CAAYmB,CAAZ,CAAqB,IAArB,CAEK,KAAAhB,OAAL,GACE,IAAAA,OADF,CACgB,GADhB,CAIA,KAAAkB,UAAA,EAb2B,CAoB7B,KAAAA,UAAA,CAAiBC,QAAQ,EAAG,CAAA,IACtBhB,EAASjnC,EAAA,CAAW,IAAAgnC,SAAX,CADa,CAEtBznB,EAAO,IAAA2nB,OAAA,CAAc,GAAd,CAAoB7mC,EAAA,CAAiB,IAAA6mC,OAAjB,CAApB,CAAoD,EAE/D,KAAAgB,MAAA,CAAanC,EAAA,CAAW,IAAAe,OAAX,CAAb,EAAwCG,CAAA,CAAS,GAAT,CAAeA,CAAf,CAAwB,EAAhE,EAAsE1nB,CACtE,KAAA4oB,SAAA,CAAgBV,CAAhB,CAAgC,IAAAS,MAAA3lB,OAAA,CAAkB,CAAlB,CALN,CAQ5B,KAAA6lB,eAAA,CAAsBC,QAAQ,CAACjnB,CAAD,CAAMknB,CAAN,CAAe,CAC3C,GAAIA,CAAJ,EAA8B,GAA9B,GAAeA,CAAA,CAAQ,CAAR,CAAf,CAIE,MADA,KAAA/oB,KAAA,CAAU+oB,CAAA9vC,MAAA,CAAc,CAAd,CAAV,CACO,CAAA,CAAA,CALkC,KAOvC+vC,CAPuC,CAO/BC,CAGR/uC,EAAA,CAAU8uC,CAAV,CAAmBpB,EAAA,CAAWK,CAAX,CAAoBpmB,CAApB,CAAnB,CAAJ,EACEonB,CAEE,CAFWD,CAEX,CAAAE,CAAA,CADEhvC,CAAA,CAAU8uC,CAAV,CAAmBpB,EAAA,CAAWO,CAAX,CAAuBa,CAAvB,CAAnB,CAAJ,CACiBd,CADjB,EACkCN,EAAA,CAAW,GAAX,CAAgBoB,CAAhB,CADlC,EAC6DA,CAD7D,EAGiBf,CAHjB,CAG2BgB,CAL7B,EAOW/uC,CAAA,CAAU8uC,CAAV,CAAmBpB,EAAA,CAAWM,CAAX,CAA0BrmB,CAA1B,CAAnB,CAAJ,CACLqnB,CADK,CACUhB,CADV,CAC0Bc,CAD1B,CAEId,CAFJ,EAEqBrmB,CAFrB,CAE2B,GAF3B,GAGLqnB,CAHK,CAGUhB,CAHV,CAKHgB,EAAJ,EACE,IAAAb,QAAA,CAAaa,CAAb,CAEF,OAAO,CAAEA,CAAAA,CAzBkC,CAvCe,CA+E9DC,QAASA,GAAmB,CAAClB,CAAD,CAAUC,CAAV,CAAyBkB,CAAzB,CAAqC,CAE/D1C,EAAA,CAAiBuB,CAAjB,CAA0B,IAA1B,CAQA;IAAAI,QAAA,CAAeC,QAAQ,CAACzmB,CAAD,CAAM,CAC3B,IAAIwnB,EAAiBzB,EAAA,CAAWK,CAAX,CAAoBpmB,CAApB,CAAjBwnB,EAA6CzB,EAAA,CAAWM,CAAX,CAA0BrmB,CAA1B,CAAjD,CACIynB,CAECrvC,EAAA,CAAYovC,CAAZ,CAAL,EAAiE,GAAjE,GAAoCA,CAAArsC,OAAA,CAAsB,CAAtB,CAApC,CAcM,IAAAorC,QAAJ,CACEkB,CADF,CACmBD,CADnB,EAGEC,CACA,CADiB,EACjB,CAAIrvC,CAAA,CAAYovC,CAAZ,CAAJ,GACEpB,CACA,CADUpmB,CACV,CAAA,IAAA/iB,QAAA,EAFF,CAJF,CAdF,EAIEwqC,CACA,CADiB1B,EAAA,CAAWwB,CAAX,CAAuBC,CAAvB,CACjB,CAAIpvC,CAAA,CAAYqvC,CAAZ,CAAJ,GAEEA,CAFF,CAEmBD,CAFnB,CALF,CAyBAjC,GAAA,CAAYkC,CAAZ,CAA4B,IAA5B,CAEqC/B,EAAAA,CAAAA,IAAAA,OAA6BU,KAAAA,EAAAA,CAAAA,CAoB5DsB,EAAqB,iBAKC,EAA1B,GAAI1nB,CAAArmB,QAAA,CAAYguC,CAAZ,CAAJ,GACE3nB,CADF,CACQA,CAAA/iB,QAAA,CAAY0qC,CAAZ,CAAkB,EAAlB,CADR,CAKID,EAAAj1B,KAAA,CAAwBuN,CAAxB,CAAJ,GAKA,CALA,CAKO,CADP4nB,CACO,CADiBF,CAAAj1B,KAAA,CAAwBxO,CAAxB,CACjB,EAAwB2jC,CAAA,CAAsB,CAAtB,CAAxB,CAAmD3jC,CAL1D,CA9BF,KAAAyhC,OAAA,CAAc,CAEd,KAAAkB,UAAA,EAjC2B,CA0E7B,KAAAA,UAAA,CAAiBC,QAAQ,EAAG,CAAA,IACtBhB,EAASjnC,EAAA,CAAW,IAAAgnC,SAAX,CADa,CAEtBznB,EAAO,IAAA2nB,OAAA,CAAc,GAAd,CAAoB7mC,EAAA,CAAiB,IAAA6mC,OAAjB,CAApB,CAAoD,EAE/D,KAAAgB,MAAA,CAAanC,EAAA,CAAW,IAAAe,OAAX,CAAb,EAAwCG,CAAA,CAAS,GAAT,CAAeA,CAAf,CAAwB,EAAhE,EAAsE1nB,CACtE,KAAA4oB,SAAA,CAAgBX,CAAhB,EAA2B,IAAAU,MAAA,CAAaS,CAAb,CAA0B,IAAAT,MAA1B,CAAuC,EAAlE,CAL0B,CAQ5B,KAAAE,eAAA;AAAsBC,QAAQ,CAACjnB,CAAD,CAAMknB,CAAN,CAAe,CAC3C,MAAIhmB,GAAA,CAAUklB,CAAV,CAAJ,EAA0BllB,EAAA,CAAUlB,CAAV,CAA1B,EACE,IAAAwmB,QAAA,CAAaxmB,CAAb,CACO,CAAA,CAAA,CAFT,EAIO,CAAA,CALoC,CA5FkB,CAgHjE6nB,QAASA,GAA0B,CAACzB,CAAD,CAAUC,CAAV,CAAyBkB,CAAzB,CAAqC,CACtE,IAAAhB,QAAA,CAAe,CAAA,CACfe,GAAAlrC,MAAA,CAA0B,IAA1B,CAAgC/E,SAAhC,CAEA,KAAA2vC,eAAA,CAAsBC,QAAQ,CAACjnB,CAAD,CAAMknB,CAAN,CAAe,CAC3C,GAAIA,CAAJ,EAA8B,GAA9B,GAAeA,CAAA,CAAQ,CAAR,CAAf,CAIE,MADA,KAAA/oB,KAAA,CAAU+oB,CAAA9vC,MAAA,CAAc,CAAd,CAAV,CACO,CAAA,CAAA,CAGT,KAAIiwC,CAAJ,CACIF,CAEAf,EAAJ,EAAellB,EAAA,CAAUlB,CAAV,CAAf,CACEqnB,CADF,CACiBrnB,CADjB,CAEO,CAAKmnB,CAAL,CAAcpB,EAAA,CAAWM,CAAX,CAA0BrmB,CAA1B,CAAd,EACLqnB,CADK,CACUjB,CADV,CACoBmB,CADpB,CACiCJ,CADjC,CAEId,CAFJ,GAEsBrmB,CAFtB,CAE4B,GAF5B,GAGLqnB,CAHK,CAGUhB,CAHV,CAKHgB,EAAJ,EACE,IAAAb,QAAA,CAAaa,CAAb,CAEF,OAAO,CAAEA,CAAAA,CArBkC,CAwB7C,KAAAT,UAAA,CAAiBC,QAAQ,EAAG,CAAA,IACtBhB,EAASjnC,EAAA,CAAW,IAAAgnC,SAAX,CADa,CAEtBznB,EAAO,IAAA2nB,OAAA,CAAc,GAAd,CAAoB7mC,EAAA,CAAiB,IAAA6mC,OAAjB,CAApB,CAAoD,EAE/D,KAAAgB,MAAA,CAAanC,EAAA,CAAW,IAAAe,OAAX,CAAb,EAAwCG,CAAA,CAAS,GAAT,CAAeA,CAAf,CAAwB,EAAhE,EAAsE1nB,CAEtE,KAAA4oB,SAAA,CAAgBX,CAAhB,CAA0BmB,CAA1B,CAAuC,IAAAT,MANb,CA5B0C,CA4WxEgB,QAASA,GAAc,CAACja,CAAD,CAAW,CAChC,MAAO,SAAQ,EAAG,CAChB,MAAO,KAAA,CAAKA,CAAL,CADS,CADc,CAOlCka,QAASA,GAAoB,CAACla,CAAD;AAAWma,CAAX,CAAuB,CAClD,MAAO,SAAQ,CAACpyC,CAAD,CAAQ,CACrB,GAAIwC,CAAA,CAAYxC,CAAZ,CAAJ,CACE,MAAO,KAAA,CAAKi4B,CAAL,CAGT,KAAA,CAAKA,CAAL,CAAA,CAAiBma,CAAA,CAAWpyC,CAAX,CACjB,KAAAgxC,UAAA,EAEA,OAAO,KARc,CAD2B,CA8CpDv3B,QAASA,GAAiB,EAAG,CAAA,IACvBk4B,EAAa,EADU,CAEvBU,EAAY,CACVlhB,QAAS,CAAA,CADC,CAEVmhB,YAAa,CAAA,CAFH,CAGVC,aAAc,CAAA,CAHJ,CAahB,KAAAZ,WAAA,CAAkBa,QAAQ,CAACvoC,CAAD,CAAS,CACjC,MAAIxH,EAAA,CAAUwH,CAAV,CAAJ,EACE0nC,CACO,CADM1nC,CACN,CAAA,IAFT,EAIS0nC,CALwB,CA4BnC,KAAAU,UAAA,CAAiBI,QAAQ,CAAC7jB,CAAD,CAAO,CAC9B,MAAI9rB,GAAA,CAAU8rB,CAAV,CAAJ,EACEyjB,CAAAlhB,QACO,CADavC,CACb,CAAA,IAFT,EAGWluB,CAAA,CAASkuB,CAAT,CAAJ,EAED9rB,EAAA,CAAU8rB,CAAAuC,QAAV,CAYG,GAXLkhB,CAAAlhB,QAWK,CAXevC,CAAAuC,QAWf,EARHruB,EAAA,CAAU8rB,CAAA0jB,YAAV,CAQG,GAPLD,CAAAC,YAOK,CAPmB1jB,CAAA0jB,YAOnB,EAJHxvC,EAAA,CAAU8rB,CAAA2jB,aAAV,CAIG,GAHLF,CAAAE,aAGK,CAHoB3jB,CAAA2jB,aAGpB,EAAA,IAdF,EAgBEF,CApBqB,CA+DhC,KAAApvB,KAAA,CAAY,CAAC,YAAD,CAAe,UAAf,CAA2B,UAA3B,CAAuC,cAAvC,CAAuD,SAAvD,CACR,QAAQ,CAACnJ,CAAD;AAAalC,CAAb,CAAuB4C,CAAvB,CAAiC+Y,CAAjC,CAA+CrY,CAA/C,CAAwD,CA2BlEw3B,QAASA,EAAyB,CAACtoB,CAAD,CAAM/iB,CAAN,CAAe2iB,CAAf,CAAsB,CACtD,IAAI2oB,EAASn5B,CAAA4Q,IAAA,EAAb,CACIwoB,EAAWp5B,CAAAq5B,QACf,IAAI,CACFj7B,CAAAwS,IAAA,CAAaA,CAAb,CAAkB/iB,CAAlB,CAA2B2iB,CAA3B,CAKA,CAAAxQ,CAAAq5B,QAAA,CAAoBj7B,CAAAoS,MAAA,EANlB,CAOF,MAAO5hB,CAAP,CAAU,CAKV,KAHAoR,EAAA4Q,IAAA,CAAcuoB,CAAd,CAGMvqC,CAFNoR,CAAAq5B,QAEMzqC,CAFcwqC,CAEdxqC,CAAAA,CAAN,CALU,CAV0C,CAqJxD0qC,QAASA,EAAmB,CAACH,CAAD,CAASC,CAAT,CAAmB,CAC7C94B,CAAAi5B,WAAA,CAAsB,wBAAtB,CAAgDv5B,CAAAw5B,OAAA,EAAhD,CAAoEL,CAApE,CACEn5B,CAAAq5B,QADF,CACqBD,CADrB,CAD6C,CAhLmB,IAC9Dp5B,CAD8D,CAE9Dy5B,CACAjnB,EAAAA,CAAWpU,CAAAoU,SAAA,EAHmD,KAI9DknB,EAAat7B,CAAAwS,IAAA,EAJiD,CAK9DomB,CAEJ,IAAI6B,CAAAlhB,QAAJ,CAAuB,CACrB,GAAKnF,CAAAA,CAAL,EAAiBqmB,CAAAC,YAAjB,CACE,KAAMvB,GAAA,CAAgB,QAAhB,CAAN,CAGFP,CAAA,CAAqB0C,CApuBlBnqC,UAAA,CAAc,CAAd,CAouBkBmqC,CApuBDnvC,QAAA,CAAY,GAAZ,CAouBCmvC,CApuBgBnvC,QAAA,CAAY,IAAZ,CAAjB,CAAqC,CAArC,CAAjB,CAouBH,EAAoCioB,CAApC,EAAgD,GAAhD,CACAinB,EAAA,CAAez4B,CAAAuP,QAAA,CAAmBwmB,EAAnB,CAAsC0B,EANhC,CAAvB,IAQEzB,EACA,CADUllB,EAAA,CAAU4nB,CAAV,CACV,CAAAD,CAAA,CAAevB,EAEjB,KAAIjB,EAA0BD,CA/uBzBjlB,OAAA,CAAW,CAAX,CAAcD,EAAA,CA+uBWklB,CA/uBX,CAAA2C,YAAA,CAA2B,GAA3B,CAAd,CAAgD,CAAhD,CAivBL35B,EAAA,CAAY,IAAIy5B,CAAJ,CAAiBzC,CAAjB,CAA0BC,CAA1B,CAAyC,GAAzC,CAA+CkB,CAA/C,CACZn4B,EAAA43B,eAAA,CAAyB8B,CAAzB,CAAqCA,CAArC,CAEA15B,EAAAq5B,QAAA,CAAoBj7B,CAAAoS,MAAA,EAEpB;IAAIopB,EAAoB,2BAqBxB7f,EAAAvmB,GAAA,CAAgB,OAAhB,CAAyB,QAAQ,CAAC2U,CAAD,CAAQ,CAIvC,GAAK0wB,CAAAE,aAAL,EAA+Bc,CAAA1xB,CAAA0xB,QAA/B,EAAgDC,CAAA3xB,CAAA2xB,QAAhD,EAAiEC,CAAA5xB,CAAA4xB,SAAjE,EAAkG,CAAlG,EAAmF5xB,CAAA6xB,MAAnF,EAAuH,CAAvH,EAAuG7xB,CAAA8xB,OAAvG,CAAA,CAKA,IAHA,IAAIjrB,EAAM7pB,CAAA,CAAOgjB,CAAAkB,OAAP,CAGV,CAA6B,GAA7B,GAAOpf,EAAA,CAAU+kB,CAAA,CAAI,CAAJ,CAAV,CAAP,CAAA,CAEE,GAAIA,CAAA,CAAI,CAAJ,CAAJ,GAAe+K,CAAA,CAAa,CAAb,CAAf,EAAmC,CAAA,CAAC/K,CAAD,CAAOA,CAAAzmB,OAAA,EAAP,EAAqB,CAArB,CAAnC,CAA4D,MAG9D,KAAI2xC,EAAUlrB,CAAArlB,KAAA,CAAS,MAAT,CAAd,CAGImuC,EAAU9oB,CAAAplB,KAAA,CAAS,MAAT,CAAVkuC,EAA8B9oB,CAAAplB,KAAA,CAAS,YAAT,CAE9B1C,EAAA,CAASgzC,CAAT,CAAJ,EAAgD,4BAAhD,GAAyBA,CAAAnxC,SAAA,EAAzB,GAGEmxC,CAHF,CAGYjI,EAAA,CAAWiI,CAAAtd,QAAX,CAAAnL,KAHZ,CAOImoB,EAAAnwC,KAAA,CAAuBywC,CAAvB,CAAJ,EAEIA,CAAAA,CAFJ,EAEgBlrB,CAAAplB,KAAA,CAAS,QAAT,CAFhB,EAEuCue,CAAAC,mBAAA,EAFvC,EAGM,CAAApI,CAAA43B,eAAA,CAAyBsC,CAAzB,CAAkCpC,CAAlC,CAHN,GAOI3vB,CAAAgyB,eAAA,EAEA,CAAIn6B,CAAAw5B,OAAA,EAAJ,EAA0Bp7B,CAAAwS,IAAA,EAA1B,GACEtQ,CAAAzO,OAAA,EAEA,CAAA6P,CAAAzP,QAAA,CAAgB,0BAAhB,CAAA;AAA8C,CAAA,CAHhD,CATJ,CAtBA,CAJuC,CAAzC,CA8CI6kC,GAAA,CAAc92B,CAAAw5B,OAAA,EAAd,CAAJ,EAAyC1C,EAAA,CAAc4C,CAAd,CAAzC,EACEt7B,CAAAwS,IAAA,CAAa5Q,CAAAw5B,OAAA,EAAb,CAAiC,CAAA,CAAjC,CAGF,KAAIY,EAAe,CAAA,CAGnBh8B,EAAA8T,YAAA,CAAqB,QAAQ,CAACmoB,CAAD,CAASC,CAAT,CAAmB,CAE1CtxC,CAAA,CAAY2tC,EAAA,CAAWM,CAAX,CAA0BoD,CAA1B,CAAZ,CAAJ,CAEE34B,CAAAnP,SAAAkf,KAFF,CAE0B4oB,CAF1B,EAMA/5B,CAAAlX,WAAA,CAAsB,QAAQ,EAAG,CAC/B,IAAI+vC,EAASn5B,CAAAw5B,OAAA,EAAb,CACIJ,EAAWp5B,CAAAq5B,QADf,CAEI/wB,CACJ+xB,EAAA,CAASvD,EAAA,CAAcuD,CAAd,CACTr6B,EAAAo3B,QAAA,CAAkBiD,CAAlB,CACAr6B,EAAAq5B,QAAA,CAAoBiB,CAEpBhyB,EAAA,CAAmBhI,CAAAi5B,WAAA,CAAsB,sBAAtB,CAA8Cc,CAA9C,CAAsDlB,CAAtD,CACfmB,CADe,CACLlB,CADK,CAAA9wB,iBAKftI,EAAAw5B,OAAA,EAAJ,GAA2Ba,CAA3B,GAEI/xB,CAAJ,EACEtI,CAAAo3B,QAAA,CAAkB+B,CAAlB,CAEA,CADAn5B,CAAAq5B,QACA,CADoBD,CACpB,CAAAF,CAAA,CAA0BC,CAA1B,CAAkC,CAAA,CAAlC,CAAyCC,CAAzC,CAHF,GAKEgB,CACA,CADe,CAAA,CACf,CAAAd,CAAA,CAAoBH,CAApB,CAA4BC,CAA5B,CANF,CAFA,CAb+B,CAAjC,CAwBA,CAAK94B,CAAAovB,QAAL,EAAyBpvB,CAAAi6B,QAAA,EA9BzB,CAF8C,CAAhD,CAoCAj6B,EAAAjX,OAAA,CAAkBmxC,QAAuB,EAAG,CAC1C,IAAIrB,EAASrC,EAAA,CAAc14B,CAAAwS,IAAA,EAAd,CAAb,CACIypB,EAASvD,EAAA,CAAc92B,CAAAw5B,OAAA,EAAd,CADb,CAEIJ,EAAWh7B,CAAAoS,MAAA,EAFf,CAGIiqB,EAAiBz6B,CAAA06B,UAHrB,CAIIC,EAAoBxB,CAApBwB,GAA+BN,CAA/BM,EACD36B,CAAAm3B,QADCwD,EACoB35B,CAAAuP,QADpBoqB,EACwCvB,CADxCuB,GACqD36B,CAAAq5B,QAEzD,IAAIe,CAAJ;AAAoBO,CAApB,CACEP,CAEA,CAFe,CAAA,CAEf,CAAA95B,CAAAlX,WAAA,CAAsB,QAAQ,EAAG,CAC/B,IAAIixC,EAASr6B,CAAAw5B,OAAA,EAAb,CACIlxB,EAAmBhI,CAAAi5B,WAAA,CAAsB,sBAAtB,CAA8Cc,CAA9C,CAAsDlB,CAAtD,CACnBn5B,CAAAq5B,QADmB,CACAD,CADA,CAAA9wB,iBAKnBtI,EAAAw5B,OAAA,EAAJ,GAA2Ba,CAA3B,GAEI/xB,CAAJ,EACEtI,CAAAo3B,QAAA,CAAkB+B,CAAlB,CACA,CAAAn5B,CAAAq5B,QAAA,CAAoBD,CAFtB,GAIMuB,CAIJ,EAHEzB,CAAA,CAA0BmB,CAA1B,CAAkCI,CAAlC,CAC0BrB,CAAA,GAAap5B,CAAAq5B,QAAb,CAAiC,IAAjC,CAAwCr5B,CAAAq5B,QADlE,CAGF,CAAAC,CAAA,CAAoBH,CAApB,CAA4BC,CAA5B,CARF,CAFA,CAP+B,CAAjC,CAsBFp5B,EAAA06B,UAAA,CAAsB,CAAA,CAjCoB,CAA5C,CAuCA,OAAO16B,EA9K2D,CADxD,CA1Ge,CA8U7BG,QAASA,GAAY,EAAG,CAAA,IAClBy6B,EAAQ,CAAA,CADU,CAElBhuC,EAAO,IASX,KAAAiuC,aAAA,CAAoBC,QAAQ,CAACC,CAAD,CAAO,CACjC,MAAI9xC,EAAA,CAAU8xC,CAAV,CAAJ,EACEH,CACK,CADGG,CACH,CAAA,IAFP,EAISH,CALwB,CASnC,KAAAnxB,KAAA,CAAY,CAAC,SAAD,CAAY,QAAQ,CAAC/H,CAAD,CAAU,CAwDxCs5B,QAASA,EAAW,CAACzmC,CAAD,CAAM,CACpBA,CAAJ,WAAmB0mC,MAAnB,GACM1mC,CAAA0X,MAAJ,CACE1X,CADF,CACSA,CAAAyX,QAAD,EAAoD,EAApD,GAAgBzX,CAAA0X,MAAA1hB,QAAA,CAAkBgK,CAAAyX,QAAlB,CAAhB,CACA,SADA,CACYzX,CAAAyX,QADZ,CAC0B,IAD1B,CACiCzX,CAAA0X,MADjC,CAEA1X,CAAA0X,MAHR,CAIW1X,CAAA2mC,UAJX;CAKE3mC,CALF,CAKQA,CAAAyX,QALR,CAKsB,IALtB,CAK6BzX,CAAA2mC,UAL7B,CAK6C,GAL7C,CAKmD3mC,CAAAm3B,KALnD,CADF,CASA,OAAOn3B,EAViB,CAa1B4mC,QAASA,EAAU,CAACj2B,CAAD,CAAO,CAAA,IACpBk2B,EAAU15B,CAAA05B,QAAVA,EAA6B,EADT,CAEpBC,EAAQD,CAAA,CAAQl2B,CAAR,CAARm2B,EAAyBD,CAAAE,IAAzBD,EAAwC3yC,CACxC6yC,EAAAA,CAAW,CAAA,CAIf,IAAI,CACFA,CAAA,CAAW,CAAEvuC,CAAAquC,CAAAruC,MADX,CAEF,MAAO4B,CAAP,CAAU,EAEZ,MAAI2sC,EAAJ,CACS,QAAQ,EAAG,CAChB,IAAI3wB,EAAO,EACXnlB,EAAA,CAAQwC,SAAR,CAAmB,QAAQ,CAACsM,CAAD,CAAM,CAC/BqW,CAAA/f,KAAA,CAAUmwC,CAAA,CAAYzmC,CAAZ,CAAV,CAD+B,CAAjC,CAGA,OAAO8mC,EAAAruC,MAAA,CAAYouC,CAAZ,CAAqBxwB,CAArB,CALS,CADpB,CAYO,QAAQ,CAAC4wB,CAAD,CAAOC,CAAP,CAAa,CAC1BJ,CAAA,CAAMG,CAAN,CAAoB,IAAR,EAAAC,CAAA,CAAe,EAAf,CAAoBA,CAAhC,CAD0B,CAvBJ,CApE1B,MAAO,CAQLH,IAAKH,CAAA,CAAW,KAAX,CARA,CAiBL3mB,KAAM2mB,CAAA,CAAW,MAAX,CAjBD,CA0BLO,KAAMP,CAAA,CAAW,MAAX,CA1BD,CAmCLjrB,MAAOirB,CAAA,CAAW,OAAX,CAnCF,CA4CLP,MAAQ,QAAQ,EAAG,CACjB,IAAI/tC,EAAKsuC,CAAA,CAAW,OAAX,CAET,OAAO,SAAQ,EAAG,CACZP,CAAJ,EACE/tC,CAAAG,MAAA,CAASJ,CAAT,CAAe3E,SAAf,CAFc,CAHD,CAAX,EA5CH,CADiC,CAA9B,CApBU,CA4JxB0zC,QAASA,GAAoB,CAACjrC,CAAD,CAAOkrC,CAAP,CAAuB,CAClD,GAAa,kBAAb,GAAIlrC,CAAJ,EAA4C,kBAA5C,GAAmCA,CAAnC,EACgB,kBADhB,GACOA,CADP,EAC+C,kBAD/C;AACsCA,CADtC,EAEgB,WAFhB,GAEOA,CAFP,CAGE,KAAMmrC,GAAA,CAAa,SAAb,CAEmBD,CAFnB,CAAN,CAIF,MAAOlrC,EAR2C,CAWpDorC,QAASA,GAAc,CAACprC,CAAD,CAAO,CAe5B,MAAOA,EAAP,CAAc,EAfc,CAkB9BqrC,QAASA,GAAgB,CAACh3C,CAAD,CAAM62C,CAAN,CAAsB,CAE7C,GAAI72C,CAAJ,CAAS,CACP,GAAIA,CAAAqG,YAAJ,GAAwBrG,CAAxB,CACE,KAAM82C,GAAA,CAAa,QAAb,CAEFD,CAFE,CAAN,CAGK,GACH72C,CAAAL,OADG,GACYK,CADZ,CAEL,KAAM82C,GAAA,CAAa,YAAb,CAEFD,CAFE,CAAN,CAGK,GACH72C,CAAAi3C,SADG,GACcj3C,CAAA4C,SADd,EAC+B5C,CAAA4E,KAD/B,EAC2C5E,CAAA6E,KAD3C,EACuD7E,CAAA8E,KADvD,EAEL,KAAMgyC,GAAA,CAAa,SAAb,CAEFD,CAFE,CAAN,CAGK,GACH72C,CADG,GACKM,MADL,CAEL,KAAMw2C,GAAA,CAAa,SAAb,CAEFD,CAFE,CAAN,CAjBK,CAsBT,MAAO72C,EAxBsC,CA+B/Ck3C,QAASA,GAAkB,CAACl3C,CAAD,CAAM62C,CAAN,CAAsB,CAC/C,GAAI72C,CAAJ,CAAS,CACP,GAAIA,CAAAqG,YAAJ,GAAwBrG,CAAxB,CACE,KAAM82C,GAAA,CAAa,QAAb,CAEJD,CAFI,CAAN,CAGK,GAAI72C,CAAJ,GAAYm3C,EAAZ,EAAoBn3C,CAApB,GAA4Bo3C,EAA5B,EAAqCp3C,CAArC,GAA6Cq3C,EAA7C,CACL,KAAMP,GAAA,CAAa,QAAb,CAEJD,CAFI,CAAN,CANK,CADsC,CAcjDS,QAASA,GAAuB,CAACt3C,CAAD,CAAM62C,CAAN,CAAsB,CACpD,GAAI72C,CAAJ,GACMA,CADN,GACcqG,CAAC,CAADA,aADd,EACiCrG,CADjC,GACyCqG,CAAC,CAAA,CAADA,aADzC,EACgErG,CADhE,GACwE,EAAAqG,YADxE;AAEMrG,CAFN,GAEc,EAAAqG,YAFd,EAEgCrG,CAFhC,GAEwC,EAAAqG,YAFxC,EAE0DrG,CAF1D,GAEkEgoB,QAAA3hB,YAFlE,EAGI,KAAMywC,GAAA,CAAa,QAAb,CACyDD,CADzD,CAAN,CAJgD,CAugBtDU,QAASA,GAAS,CAAC9R,CAAD,CAAI6B,CAAJ,CAAO,CACvB,MAAoB,WAAb,GAAA,MAAO7B,EAAP,CAA2BA,CAA3B,CAA+B6B,CADf,CAIzBkQ,QAASA,GAAM,CAACv3B,CAAD,CAAIw3B,CAAJ,CAAO,CACpB,MAAiB,WAAjB,GAAI,MAAOx3B,EAAX,CAAqCw3B,CAArC,CACiB,WAAjB,GAAI,MAAOA,EAAX,CAAqCx3B,CAArC,CACOA,CADP,CACWw3B,CAHS,CAWtBC,QAASA,EAA+B,CAACC,CAAD,CAAM59B,CAAN,CAAe,CACrD,IAAI69B,CAAJ,CACIC,CACJ,QAAQF,CAAAx3B,KAAR,EACA,KAAK23B,CAAAC,QAAL,CACEH,CAAA,CAAe,CAAA,CACfl3C,EAAA,CAAQi3C,CAAAtL,KAAR,CAAkB,QAAQ,CAAC2L,CAAD,CAAO,CAC/BN,CAAA,CAAgCM,CAAA9S,WAAhC,CAAiDnrB,CAAjD,CACA69B,EAAA,CAAeA,CAAf,EAA+BI,CAAA9S,WAAAnzB,SAFA,CAAjC,CAIA4lC,EAAA5lC,SAAA,CAAe6lC,CACf,MACF,MAAKE,CAAAG,QAAL,CACEN,CAAA5lC,SAAA,CAAe,CAAA,CACf4lC,EAAAO,QAAA,CAAc,EACd,MACF,MAAKJ,CAAAK,gBAAL,CACET,CAAA,CAAgCC,CAAAS,SAAhC,CAA8Cr+B,CAA9C,CACA49B,EAAA5lC,SAAA,CAAe4lC,CAAAS,SAAArmC,SACf4lC,EAAAO,QAAA,CAAcP,CAAAS,SAAAF,QACd;KACF,MAAKJ,CAAAO,iBAAL,CACEX,CAAA,CAAgCC,CAAAW,KAAhC,CAA0Cv+B,CAA1C,CACA29B,EAAA,CAAgCC,CAAAY,MAAhC,CAA2Cx+B,CAA3C,CACA49B,EAAA5lC,SAAA,CAAe4lC,CAAAW,KAAAvmC,SAAf,EAAoC4lC,CAAAY,MAAAxmC,SACpC4lC,EAAAO,QAAA,CAAcP,CAAAW,KAAAJ,QAAAzwC,OAAA,CAAwBkwC,CAAAY,MAAAL,QAAxB,CACd,MACF,MAAKJ,CAAAU,kBAAL,CACEd,CAAA,CAAgCC,CAAAW,KAAhC,CAA0Cv+B,CAA1C,CACA29B,EAAA,CAAgCC,CAAAY,MAAhC,CAA2Cx+B,CAA3C,CACA49B,EAAA5lC,SAAA,CAAe4lC,CAAAW,KAAAvmC,SAAf,EAAoC4lC,CAAAY,MAAAxmC,SACpC4lC,EAAAO,QAAA,CAAcP,CAAA5lC,SAAA,CAAe,EAAf,CAAoB,CAAC4lC,CAAD,CAClC,MACF,MAAKG,CAAAW,sBAAL,CACEf,CAAA,CAAgCC,CAAAjzC,KAAhC,CAA0CqV,CAA1C,CACA29B,EAAA,CAAgCC,CAAAe,UAAhC,CAA+C3+B,CAA/C,CACA29B,EAAA,CAAgCC,CAAAgB,WAAhC,CAAgD5+B,CAAhD,CACA49B,EAAA5lC,SAAA,CAAe4lC,CAAAjzC,KAAAqN,SAAf,EAAoC4lC,CAAAe,UAAA3mC,SAApC,EAA8D4lC,CAAAgB,WAAA5mC,SAC9D4lC,EAAAO,QAAA,CAAcP,CAAA5lC,SAAA,CAAe,EAAf,CAAoB,CAAC4lC,CAAD,CAClC,MACF,MAAKG,CAAAc,WAAL,CACEjB,CAAA5lC,SAAA,CAAe,CAAA,CACf4lC,EAAAO,QAAA;AAAc,CAACP,CAAD,CACd,MACF,MAAKG,CAAAe,iBAAL,CACEnB,CAAA,CAAgCC,CAAAmB,OAAhC,CAA4C/+B,CAA5C,CACI49B,EAAAoB,SAAJ,EACErB,CAAA,CAAgCC,CAAAje,SAAhC,CAA8C3f,CAA9C,CAEF49B,EAAA5lC,SAAA,CAAe4lC,CAAAmB,OAAA/mC,SAAf,GAAuC,CAAC4lC,CAAAoB,SAAxC,EAAwDpB,CAAAje,SAAA3nB,SAAxD,CACA4lC,EAAAO,QAAA,CAAc,CAACP,CAAD,CACd,MACF,MAAKG,CAAAkB,eAAL,CACEpB,CAAA,CAAeD,CAAAzlC,OAAA,CAxDV,CAwDmC6H,CAzDjCjS,CAyD0C6vC,CAAAsB,OAAAttC,KAzD1C7D,CACDk6B,UAwDS,CAAqD,CAAA,CACpE6V,EAAA,CAAc,EACdn3C,EAAA,CAAQi3C,CAAAz0C,UAAR,CAAuB,QAAQ,CAAC80C,CAAD,CAAO,CACpCN,CAAA,CAAgCM,CAAhC,CAAsCj+B,CAAtC,CACA69B,EAAA,CAAeA,CAAf,EAA+BI,CAAAjmC,SAC1BimC,EAAAjmC,SAAL,EACE8lC,CAAA/xC,KAAAmC,MAAA,CAAuB4vC,CAAvB,CAAoCG,CAAAE,QAApC,CAJkC,CAAtC,CAOAP,EAAA5lC,SAAA,CAAe6lC,CACfD,EAAAO,QAAA,CAAcP,CAAAzlC,OAAA,EAlER8vB,CAkEkCjoB,CAnEjCjS,CAmE0C6vC,CAAAsB,OAAAttC,KAnE1C7D,CACDk6B,UAkEQ,CAAsD6V,CAAtD,CAAoE,CAACF,CAAD,CAClF,MACF,MAAKG,CAAAoB,qBAAL,CACExB,CAAA,CAAgCC,CAAAW,KAAhC,CAA0Cv+B,CAA1C,CACA29B,EAAA,CAAgCC,CAAAY,MAAhC,CAA2Cx+B,CAA3C,CACA49B,EAAA5lC,SAAA,CAAe4lC,CAAAW,KAAAvmC,SAAf,EAAoC4lC,CAAAY,MAAAxmC,SACpC4lC,EAAAO,QAAA,CAAc,CAACP,CAAD,CACd;KACF,MAAKG,CAAAqB,gBAAL,CACEvB,CAAA,CAAe,CAAA,CACfC,EAAA,CAAc,EACdn3C,EAAA,CAAQi3C,CAAA71B,SAAR,CAAsB,QAAQ,CAACk2B,CAAD,CAAO,CACnCN,CAAA,CAAgCM,CAAhC,CAAsCj+B,CAAtC,CACA69B,EAAA,CAAeA,CAAf,EAA+BI,CAAAjmC,SAC1BimC,EAAAjmC,SAAL,EACE8lC,CAAA/xC,KAAAmC,MAAA,CAAuB4vC,CAAvB,CAAoCG,CAAAE,QAApC,CAJiC,CAArC,CAOAP,EAAA5lC,SAAA,CAAe6lC,CACfD,EAAAO,QAAA,CAAcL,CACd,MACF,MAAKC,CAAAsB,iBAAL,CACExB,CAAA,CAAe,CAAA,CACfC,EAAA,CAAc,EACdn3C,EAAA,CAAQi3C,CAAA0B,WAAR,CAAwB,QAAQ,CAAC3f,CAAD,CAAW,CACzCge,CAAA,CAAgChe,CAAAj4B,MAAhC,CAAgDsY,CAAhD,CACA69B,EAAA,CAAeA,CAAf,EAA+Ble,CAAAj4B,MAAAsQ,SAC1B2nB,EAAAj4B,MAAAsQ,SAAL,EACE8lC,CAAA/xC,KAAAmC,MAAA,CAAuB4vC,CAAvB,CAAoCne,CAAAj4B,MAAAy2C,QAApC,CAJuC,CAA3C,CAOAP,EAAA5lC,SAAA,CAAe6lC,CACfD,EAAAO,QAAA,CAAcL,CACd,MACF,MAAKC,CAAAwB,eAAL,CACE3B,CAAA5lC,SAAA,CAAe,CAAA,CACf4lC,EAAAO,QAAA,CAAc,EACd,MACF,MAAKJ,CAAAyB,iBAAL,CACE5B,CAAA5lC,SACA,CADe,CAAA,CACf,CAAA4lC,CAAAO,QAAA,CAAc,EApGhB,CAHqD,CA4GvDsB,QAASA,GAAS,CAACnN,CAAD,CAAO,CACvB,GAAmB,CAAnB,EAAIA,CAAAhsC,OAAJ,CAAA,CACIo5C,CAAAA,CAAiBpN,CAAA,CAAK,CAAL,CAAAnH,WACrB,KAAIr5B,EAAY4tC,CAAAvB,QAChB;MAAyB,EAAzB,GAAIrsC,CAAAxL,OAAJ,CAAmCwL,CAAnC,CACOA,CAAA,CAAU,CAAV,CAAA,GAAiB4tC,CAAjB,CAAkC5tC,CAAlC,CAA8ChM,CAJrD,CADuB,CAQzB65C,QAASA,GAAY,CAAC/B,CAAD,CAAM,CACzB,MAAOA,EAAAx3B,KAAP,GAAoB23B,CAAAc,WAApB,EAAsCjB,CAAAx3B,KAAtC,GAAmD23B,CAAAe,iBAD1B,CAI3Bc,QAASA,GAAa,CAAChC,CAAD,CAAM,CAC1B,GAAwB,CAAxB,GAAIA,CAAAtL,KAAAhsC,OAAJ,EAA6Bq5C,EAAA,CAAa/B,CAAAtL,KAAA,CAAS,CAAT,CAAAnH,WAAb,CAA7B,CACE,MAAO,CAAC/kB,KAAM23B,CAAAoB,qBAAP,CAAiCZ,KAAMX,CAAAtL,KAAA,CAAS,CAAT,CAAAnH,WAAvC,CAA+DqT,MAAO,CAACp4B,KAAM23B,CAAA8B,iBAAP,CAAtE,CAAoGC,SAAU,GAA9G,CAFiB,CAM5BC,QAASA,GAAS,CAACnC,CAAD,CAAM,CACtB,MAA2B,EAA3B,GAAOA,CAAAtL,KAAAhsC,OAAP,EACwB,CADxB,GACIs3C,CAAAtL,KAAAhsC,OADJ,GAEIs3C,CAAAtL,KAAA,CAAS,CAAT,CAAAnH,WAAA/kB,KAFJ,GAEoC23B,CAAAG,QAFpC,EAGIN,CAAAtL,KAAA,CAAS,CAAT,CAAAnH,WAAA/kB,KAHJ,GAGoC23B,CAAAqB,gBAHpC,EAIIxB,CAAAtL,KAAA,CAAS,CAAT,CAAAnH,WAAA/kB,KAJJ,GAIoC23B,CAAAsB,iBAJpC,CADsB,CAYxBW,QAASA,GAAW,CAACC,CAAD,CAAajgC,CAAb,CAAsB,CACxC,IAAAigC,WAAA;AAAkBA,CAClB,KAAAjgC,QAAA,CAAeA,CAFyB,CAmf1CkgC,QAASA,GAAc,CAACD,CAAD,CAAajgC,CAAb,CAAsB,CAC3C,IAAAigC,WAAA,CAAkBA,CAClB,KAAAjgC,QAAA,CAAeA,CAF4B,CAgZ7CmgC,QAASA,GAA6B,CAACvuC,CAAD,CAAO,CAC3C,MAAe,aAAf,EAAOA,CADoC,CAM7CwuC,QAASA,GAAU,CAAC14C,CAAD,CAAQ,CACzB,MAAOX,EAAA,CAAWW,CAAAgB,QAAX,CAAA,CAA4BhB,CAAAgB,QAAA,EAA5B,CAA8C23C,EAAAp5C,KAAA,CAAmBS,CAAnB,CAD5B,CAuD3B6Z,QAASA,GAAc,EAAG,CACxB,IAAI++B,EAAe7yC,CAAA,EAAnB,CACI8yC,EAAiB9yC,CAAA,EAErB,KAAAkd,KAAA,CAAY,CAAC,SAAD,CAAY,QAAQ,CAAC3K,CAAD,CAAU,CAkBxCsB,QAASA,EAAM,CAACqzB,CAAD,CAAM6L,CAAN,CAAqBC,CAArB,CAAsC,CAAA,IAC/CC,CAD+C,CAC7BC,CAD6B,CACpBC,CAE/BH,EAAA,CAAkBA,CAAlB,EAAqCI,CAErC,QAAQ,MAAOlM,EAAf,EACE,KAAK,QAAL,CAEEiM,CAAA,CADAjM,CACA,CADMA,CAAApvB,KAAA,EAGN,KAAI8H,EAASozB,CAAA,CAAkBF,CAAlB,CAAmCD,CAChDI,EAAA,CAAmBrzB,CAAA,CAAMuzB,CAAN,CAEnB,IAAKF,CAAAA,CAAL,CAAuB,CACC,GAAtB,GAAI/L,CAAA1nC,OAAA,CAAW,CAAX,CAAJ,EAA+C,GAA/C,GAA6B0nC,CAAA1nC,OAAA,CAAW,CAAX,CAA7B,GACE0zC,CACA,CADU,CAAA,CACV,CAAAhM,CAAA,CAAMA,CAAAlkC,UAAA,CAAc,CAAd,CAFR,CAIIqwC,EAAAA,CAAeL,CAAA,CAAkBM,CAAlB,CAA2CC,CAC9D,KAAIC,EAAQ,IAAIC,EAAJ,CAAUJ,CAAV,CAEZJ,EAAA,CAAmB/xC,CADNwyC,IAAIC,EAAJD,CAAWF,CAAXE,CAAkBnhC,CAAlBmhC,CAA2BL,CAA3BK,CACMxyC,OAAA,CAAagmC,CAAb,CACf+L,EAAA1oC,SAAJ,CACE0oC,CAAA9L,gBADF,CACqCZ,CADrC,CAEW2M,CAAJ,CACLD,CAAA9L,gBADK,CAC8B8L,CAAA7Y,QAAA;AAC/BwZ,CAD+B,CACDC,CAF7B,CAGIZ,CAAAa,OAHJ,GAILb,CAAA9L,gBAJK,CAI8B4M,CAJ9B,CAMHf,EAAJ,GACEC,CADF,CACqBe,CAAA,CAA2Bf,CAA3B,CADrB,CAGArzB,EAAA,CAAMuzB,CAAN,CAAA,CAAkBF,CApBG,CAsBvB,MAAOgB,EAAA,CAAehB,CAAf,CAAiCF,CAAjC,CAET,MAAK,UAAL,CACE,MAAOkB,EAAA,CAAe/M,CAAf,CAAoB6L,CAApB,CAET,SACE,MAAOkB,EAAA,CAAe93C,CAAf,CAAqB42C,CAArB,CApCX,CALmD,CA6CrDiB,QAASA,EAA0B,CAAC1zC,CAAD,CAAK,CAatC4zC,QAASA,EAAgB,CAAC9uC,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACvD,IAAIK,EAAyBf,CAC7BA,EAAA,CAAuB,CAAA,CACvB,IAAI,CACF,MAAO9yC,EAAA,CAAG8E,CAAH,CAAUgb,CAAV,CAAkBia,CAAlB,CAA0ByZ,CAA1B,CADL,CAAJ,OAEU,CACRV,CAAA,CAAuBe,CADf,CAL6C,CAZzD,GAAK7zC,CAAAA,CAAL,CAAS,MAAOA,EAChB4zC,EAAA/M,gBAAA,CAAmC7mC,CAAA6mC,gBACnC+M,EAAA7Z,OAAA,CAA0B2Z,CAAA,CAA2B1zC,CAAA+5B,OAA3B,CAC1B6Z,EAAA3pC,SAAA,CAA4BjK,CAAAiK,SAC5B2pC,EAAA9Z,QAAA,CAA2B95B,CAAA85B,QAC3B,KAAS,IAAAtgC,EAAI,CAAb,CAAgBwG,CAAAwzC,OAAhB,EAA6Bh6C,CAA7B,CAAiCwG,CAAAwzC,OAAAj7C,OAAjC,CAAmD,EAAEiB,CAArD,CACEwG,CAAAwzC,OAAA,CAAUh6C,CAAV,CAAA,CAAek6C,CAAA,CAA2B1zC,CAAAwzC,OAAA,CAAUh6C,CAAV,CAA3B,CAEjBo6C,EAAAJ,OAAA,CAA0BxzC,CAAAwzC,OAE1B,OAAOI,EAX+B,CAwBxCE,QAASA,EAAyB,CAAClb,CAAD,CAAWmb,CAAX,CAA4B,CAE5D,MAAgB,KAAhB,EAAInb,CAAJ,EAA2C,IAA3C,EAAwBmb,CAAxB,CACSnb,CADT,GACsBmb,CADtB,CAIwB,QAAxB,GAAI,MAAOnb,EAAX,GAKEA,CAEI,CAFOyZ,EAAA,CAAWzZ,CAAX,CAEP,CAAoB,QAApB;AAAA,MAAOA,EAPb,EASW,CAAA,CATX,CAgBOA,CAhBP,GAgBoBmb,CAhBpB,EAgBwCnb,CAhBxC,GAgBqDA,CAhBrD,EAgBiEmb,CAhBjE,GAgBqFA,CAtBzB,CAyB9DN,QAASA,EAAmB,CAAC3uC,CAAD,CAAQof,CAAR,CAAkBgiB,CAAlB,CAAkCyM,CAAlC,CAAoDqB,CAApD,CAA2E,CACrG,IAAIC,EAAmBtB,CAAAa,OAAvB,CACIU,CAEJ,IAAgC,CAAhC,GAAID,CAAA17C,OAAJ,CAAmC,CACjC,IAAI47C,EAAkBL,CAAtB,CACAG,EAAmBA,CAAA,CAAiB,CAAjB,CACnB,OAAOnvC,EAAAtI,OAAA,CAAa43C,QAA6B,CAACtvC,CAAD,CAAQ,CACvD,IAAIuvC,EAAgBJ,CAAA,CAAiBnvC,CAAjB,CACfgvC,EAAA,CAA0BO,CAA1B,CAAyCF,CAAzC,CAAL,GACED,CACA,CADavB,CAAA,CAAiB7tC,CAAjB,CAAwB/M,CAAxB,CAAmCA,CAAnC,CAA8C,CAACs8C,CAAD,CAA9C,CACb,CAAAF,CAAA,CAAkBE,CAAlB,EAAmChC,EAAA,CAAWgC,CAAX,CAFrC,CAIA,OAAOH,EANgD,CAAlD,CAOJhwB,CAPI,CAOMgiB,CAPN,CAOsB8N,CAPtB,CAH0B,CAenC,IAFA,IAAIM,EAAwB,EAA5B,CACIC,EAAiB,EADrB,CAES/6C,EAAI,CAFb,CAEgBY,EAAK65C,CAAA17C,OAArB,CAA8CiB,CAA9C,CAAkDY,CAAlD,CAAsDZ,CAAA,EAAtD,CACE86C,CAAA,CAAsB96C,CAAtB,CACA,CAD2Bs6C,CAC3B,CAAAS,CAAA,CAAe/6C,CAAf,CAAA,CAAoB,IAGtB,OAAOsL,EAAAtI,OAAA,CAAag4C,QAA8B,CAAC1vC,CAAD,CAAQ,CAGxD,IAFA,IAAI2vC,EAAU,CAAA,CAAd,CAESj7C,EAAI,CAFb,CAEgBY,EAAK65C,CAAA17C,OAArB,CAA8CiB,CAA9C,CAAkDY,CAAlD,CAAsDZ,CAAA,EAAtD,CAA2D,CACzD,IAAI66C,EAAgBJ,CAAA,CAAiBz6C,CAAjB,CAAA,CAAoBsL,CAApB,CACpB,IAAI2vC,CAAJ,GAAgBA,CAAhB,CAA0B,CAACX,CAAA,CAA0BO,CAA1B,CAAyCC,CAAA,CAAsB96C,CAAtB,CAAzC,CAA3B,EACE+6C,CAAA,CAAe/6C,CAAf,CACA,CADoB66C,CACpB,CAAAC,CAAA,CAAsB96C,CAAtB,CAAA,CAA2B66C,CAA3B,EAA4ChC,EAAA,CAAWgC,CAAX,CAJW,CAQvDI,CAAJ,GACEP,CADF,CACevB,CAAA,CAAiB7tC,CAAjB,CAAwB/M,CAAxB,CAAmCA,CAAnC,CAA8Cw8C,CAA9C,CADf,CAIA,OAAOL,EAfiD,CAAnD,CAgBJhwB,CAhBI,CAgBMgiB,CAhBN,CAgBsB8N,CAhBtB,CAxB8F,CA2CvGT,QAASA,EAAoB,CAACzuC,CAAD,CAAQof,CAAR,CAAkBgiB,CAAlB,CAAkCyM,CAAlC,CAAoD,CAAA,IAC3EvM,CAD2E,CAClE3M,CACb,OAAO2M,EAAP,CAAiBthC,CAAAtI,OAAA,CAAak4C,QAAqB,CAAC5vC,CAAD,CAAQ,CACzD,MAAO6tC,EAAA,CAAiB7tC,CAAjB,CADkD,CAA1C,CAEd6vC,QAAwB,CAACh7C,CAAD,CAAQi7C,CAAR,CAAa9vC,CAAb,CAAoB,CAC7C20B,CAAA,CAAY9/B,CACRX;CAAA,CAAWkrB,CAAX,CAAJ,EACEA,CAAA/jB,MAAA,CAAe,IAAf,CAAqB/E,SAArB,CAEEgB,EAAA,CAAUzC,CAAV,CAAJ,EACEmL,CAAA+vC,aAAA,CAAmB,QAAQ,EAAG,CACxBz4C,CAAA,CAAUq9B,CAAV,CAAJ,EACE2M,CAAA,EAF0B,CAA9B,CAN2C,CAF9B,CAcdF,CAdc,CAF8D,CAmBjFoN,QAASA,EAA2B,CAACxuC,CAAD,CAAQof,CAAR,CAAkBgiB,CAAlB,CAAkCyM,CAAlC,CAAoD,CAgBtFmC,QAASA,EAAY,CAACn7C,CAAD,CAAQ,CAC3B,IAAIo7C,EAAa,CAAA,CACjBn8C,EAAA,CAAQe,CAAR,CAAe,QAAQ,CAAC0G,CAAD,CAAM,CACtBjE,CAAA,CAAUiE,CAAV,CAAL,GAAqB00C,CAArB,CAAkC,CAAA,CAAlC,CAD2B,CAA7B,CAGA,OAAOA,EALoB,CAhByD,IAClF3O,CADkF,CACzE3M,CACb,OAAO2M,EAAP,CAAiBthC,CAAAtI,OAAA,CAAak4C,QAAqB,CAAC5vC,CAAD,CAAQ,CACzD,MAAO6tC,EAAA,CAAiB7tC,CAAjB,CADkD,CAA1C,CAEd6vC,QAAwB,CAACh7C,CAAD,CAAQi7C,CAAR,CAAa9vC,CAAb,CAAoB,CAC7C20B,CAAA,CAAY9/B,CACRX,EAAA,CAAWkrB,CAAX,CAAJ,EACEA,CAAAhrB,KAAA,CAAc,IAAd,CAAoBS,CAApB,CAA2Bi7C,CAA3B,CAAgC9vC,CAAhC,CAEEgwC,EAAA,CAAan7C,CAAb,CAAJ,EACEmL,CAAA+vC,aAAA,CAAmB,QAAQ,EAAG,CACxBC,CAAA,CAAarb,CAAb,CAAJ,EAA6B2M,CAAA,EADD,CAA9B,CAN2C,CAF9B,CAYdF,CAZc,CAFqE,CAyBxFD,QAASA,EAAqB,CAACnhC,CAAD,CAAQof,CAAR,CAAkBgiB,CAAlB,CAAkCyM,CAAlC,CAAoD,CAChF,IAAIvM,CACJ,OAAOA,EAAP,CAAiBthC,CAAAtI,OAAA,CAAaw4C,QAAsB,CAAClwC,CAAD,CAAQ,CAC1DshC,CAAA,EACA,OAAOuM,EAAA,CAAiB7tC,CAAjB,CAFmD,CAA3C,CAGdof,CAHc,CAGJgiB,CAHI,CAF+D,CAQlFyN,QAASA,EAAc,CAAChB,CAAD,CAAmBF,CAAnB,CAAkC,CACvD,GAAKA,CAAAA,CAAL,CAAoB,MAAOE,EAC3B,KAAIsC,EAAgBtC,CAAA9L,gBAApB,CACIqO,EAAY,CAAA,CADhB,CAOIl1C,EAHAi1C,CAGK,GAHa3B,CAGb,EAFL2B,CAEK,GAFa1B,CAEb,CAAe4B,QAAqC,CAACrwC,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACvF75C,CAAAA,CAAQu7C,CAAA,EAAa1B,CAAb,CAAsBA,CAAA,CAAO,CAAP,CAAtB,CAAkCb,CAAA,CAAiB7tC,CAAjB,CAAwBgb,CAAxB,CAAgCia,CAAhC,CAAwCyZ,CAAxC,CAC9C,OAAOf,EAAA,CAAc94C,CAAd;AAAqBmL,CAArB,CAA4Bgb,CAA5B,CAFoF,CAApF,CAGLs1B,QAAqC,CAACtwC,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACnE75C,CAAAA,CAAQg5C,CAAA,CAAiB7tC,CAAjB,CAAwBgb,CAAxB,CAAgCia,CAAhC,CAAwCyZ,CAAxC,CACR90B,EAAAA,CAAS+zB,CAAA,CAAc94C,CAAd,CAAqBmL,CAArB,CAA4Bgb,CAA5B,CAGb,OAAO1jB,EAAA,CAAUzC,CAAV,CAAA,CAAmB+kB,CAAnB,CAA4B/kB,CALoC,CASrEg5C,EAAA9L,gBAAJ,EACI8L,CAAA9L,gBADJ,GACyC4M,CADzC,CAEEzzC,CAAA6mC,gBAFF,CAEuB8L,CAAA9L,gBAFvB,CAGY4L,CAAAvY,UAHZ,GAMEl6B,CAAA6mC,gBAEA,CAFqB4M,CAErB,CADAyB,CACA,CADY,CAACvC,CAAAa,OACb,CAAAxzC,CAAAwzC,OAAA,CAAYb,CAAAa,OAAA,CAA0Bb,CAAAa,OAA1B,CAAoD,CAACb,CAAD,CARlE,CAWA,OAAO3yC,EAhCgD,CA9MzD,IAAIq1C,EAAexqC,EAAA,EAAAwqC,aAAnB,CACIpC,EAAgB,CACdpoC,IAAKwqC,CADS,CAEd3C,gBAAiB,CAAA,CAFH,CADpB,CAKIM,EAAyB,CACvBnoC,IAAKwqC,CADkB,CAEvB3C,gBAAiB,CAAA,CAFM,CAL7B,CASII,EAAuB,CAAA,CAE3Bv/B,EAAA+hC,yBAAA,CAAkCC,QAAQ,EAAG,CAC3C,MAAOzC,EADoC,CAI7C,OAAOv/B,EAhBiC,CAA9B,CAJY,CAgd1BK,QAASA,GAAU,EAAG,CAEpB,IAAAgJ,KAAA,CAAY,CAAC,YAAD,CAAe,mBAAf,CAAoC,QAAQ,CAACnJ,CAAD,CAAa1B,CAAb,CAAgC,CACtF,MAAOyjC,GAAA,CAAS,QAAQ,CAAC7wB,CAAD,CAAW,CACjClR,CAAAlX,WAAA,CAAsBooB,CAAtB,CADiC,CAA5B,CAEJ5S,CAFI,CAD+E,CAA5E,CAFQ,CAStB+B,QAASA,GAAW,EAAG,CACrB,IAAA8I,KAAA;AAAY,CAAC,UAAD,CAAa,mBAAb,CAAkC,QAAQ,CAACrL,CAAD,CAAWQ,CAAX,CAA8B,CAClF,MAAOyjC,GAAA,CAAS,QAAQ,CAAC7wB,CAAD,CAAW,CACjCpT,CAAAsU,MAAA,CAAelB,CAAf,CADiC,CAA5B,CAEJ5S,CAFI,CAD2E,CAAxE,CADS,CAgBvByjC,QAASA,GAAQ,CAACC,CAAD,CAAWC,CAAX,CAA6B,CAsB5CC,QAASA,EAAO,EAAG,CACjB,IAAAnJ,QAAA,CAAe,CAAErN,OAAQ,CAAV,CADE,CAgCnByW,QAASA,EAAU,CAAC98C,CAAD,CAAUkH,CAAV,CAAc,CAC/B,MAAO,SAAQ,CAACrG,CAAD,CAAQ,CACrBqG,CAAA9G,KAAA,CAAQJ,CAAR,CAAiBa,CAAjB,CADqB,CADQ,CA8BjCk8C,QAASA,EAAoB,CAAClyB,CAAD,CAAQ,CAC/BmyB,CAAAnyB,CAAAmyB,iBAAJ,EAA+BnyB,CAAAoyB,QAA/B,GACApyB,CAAAmyB,iBACA,CADyB,CAAA,CACzB,CAAAL,CAAA,CAAS,QAAQ,EAAG,CA3BO,IACvBz1C,CADuB,CACnB8iC,CADmB,CACTiT,CAElBA,EAAA,CAwBmCpyB,CAxBzBoyB,QAwByBpyB,EAvBnCmyB,iBAAA,CAAyB,CAAA,CAuBUnyB,EAtBnCoyB,QAAA,CAAgBh+C,CAChB,KAN2B,IAMlByB,EAAI,CANc,CAMXY,EAAK27C,CAAAx9C,OAArB,CAAqCiB,CAArC,CAAyCY,CAAzC,CAA6C,EAAEZ,CAA/C,CAAkD,CAChDspC,CAAA,CAAWiT,CAAA,CAAQv8C,CAAR,CAAA,CAAW,CAAX,CACXwG,EAAA,CAAK+1C,CAAA,CAAQv8C,CAAR,CAAA,CAmB4BmqB,CAnBjBwb,OAAX,CACL,IAAI,CACEnmC,CAAA,CAAWgH,CAAX,CAAJ,CACE8iC,CAAAC,QAAA,CAAiB/iC,CAAA,CAgBY2jB,CAhBThqB,MAAH,CAAjB,CADF,CAE4B,CAArB,GAewBgqB,CAfpBwb,OAAJ,CACL2D,CAAAC,QAAA,CAc6Bpf,CAdZhqB,MAAjB,CADK,CAGLmpC,CAAArC,OAAA,CAY6B9c,CAZbhqB,MAAhB,CANA,CAQF,MAAOoI,CAAP,CAAU,CACV+gC,CAAArC,OAAA,CAAgB1+B,CAAhB,CACA,CAAA2zC,CAAA,CAAiB3zC,CAAjB,CAFU,CAXoC,CAqB9B,CAApB,CAFA,CADmC,CAMrCi0C,QAASA,EAAQ,EAAG,CAClB,IAAAtU,QAAA;AAAe,IAAIiU,CADD,CAzFpB,IAAIM,EAAWj+C,CAAA,CAAO,IAAP,CAAak+C,SAAb,CAyBfh7C,EAAA,CAAOy6C,CAAAx1B,UAAP,CAA0B,CACxBwW,KAAMA,QAAQ,CAACwf,CAAD,CAAcC,CAAd,CAA0BC,CAA1B,CAAwC,CACpD,GAAIl6C,CAAA,CAAYg6C,CAAZ,CAAJ,EAAgCh6C,CAAA,CAAYi6C,CAAZ,CAAhC,EAA2Dj6C,CAAA,CAAYk6C,CAAZ,CAA3D,CACE,MAAO,KAET,KAAI33B,EAAS,IAAIs3B,CAEjB,KAAAxJ,QAAAuJ,QAAA,CAAuB,IAAAvJ,QAAAuJ,QAAvB,EAA+C,EAC/C,KAAAvJ,QAAAuJ,QAAA/3C,KAAA,CAA0B,CAAC0gB,CAAD,CAASy3B,CAAT,CAAsBC,CAAtB,CAAkCC,CAAlC,CAA1B,CAC0B,EAA1B,CAAI,IAAA7J,QAAArN,OAAJ,EAA6B0W,CAAA,CAAqB,IAAArJ,QAArB,CAE7B,OAAO9tB,EAAAgjB,QAV6C,CAD9B,CAcxB,QAAS4U,QAAQ,CAAC3xB,CAAD,CAAW,CAC1B,MAAO,KAAAgS,KAAA,CAAU,IAAV,CAAgBhS,CAAhB,CADmB,CAdJ,CAkBxB,UAAW4xB,QAAQ,CAAC5xB,CAAD,CAAW0xB,CAAX,CAAyB,CAC1C,MAAO,KAAA1f,KAAA,CAAU,QAAQ,CAACh9B,CAAD,CAAQ,CAC/B,MAAO68C,EAAA,CAAe78C,CAAf,CAAsB,CAAA,CAAtB,CAA4BgrB,CAA5B,CADwB,CAA1B,CAEJ,QAAQ,CAACtB,CAAD,CAAQ,CACjB,MAAOmzB,EAAA,CAAenzB,CAAf,CAAsB,CAAA,CAAtB,CAA6BsB,CAA7B,CADU,CAFZ,CAIJ0xB,CAJI,CADmC,CAlBpB,CAA1B,CAoEAn7C,EAAA,CAAO86C,CAAA71B,UAAP,CAA2B,CACzB4iB,QAASA,QAAQ,CAAC1iC,CAAD,CAAM,CACjB,IAAAqhC,QAAA8K,QAAArN,OAAJ,GACI9+B,CAAJ,GAAY,IAAAqhC,QAAZ,CACE,IAAA+U,SAAA,CAAcR,CAAA,CACZ,QADY;AAGZ51C,CAHY,CAAd,CADF,CAME,IAAAq2C,UAAA,CAAer2C,CAAf,CAPF,CADqB,CADE,CAczBq2C,UAAWA,QAAQ,CAACr2C,CAAD,CAAM,CAmBvBsiC,QAASA,EAAc,CAACtiC,CAAD,CAAM,CACvBkiC,CAAJ,GACAA,CACA,CADO,CAAA,CACP,CAAAoU,CAAAD,UAAA,CAAer2C,CAAf,CAFA,CAD2B,CAK7Bu2C,QAASA,EAAa,CAACv2C,CAAD,CAAM,CACtBkiC,CAAJ,GACAA,CACA,CADO,CAAA,CACP,CAAAoU,CAAAF,SAAA,CAAcp2C,CAAd,CAFA,CAD0B,CAvB5B,IAAIs2B,CAAJ,CACIggB,EAAO,IADX,CAEIpU,EAAO,CAAA,CACX,IAAI,CACF,GAAKloC,CAAA,CAASgG,CAAT,CAAL,EAAsBrH,CAAA,CAAWqH,CAAX,CAAtB,CAAwCs2B,CAAA,CAAOt2B,CAAP,EAAcA,CAAAs2B,KAClD39B,EAAA,CAAW29B,CAAX,CAAJ,EACE,IAAA+K,QAAA8K,QAAArN,OACA,CAD+B,EAC/B,CAAAxI,CAAAz9B,KAAA,CAAUmH,CAAV,CAAesiC,CAAf,CAA+BiU,CAA/B,CAA8ChB,CAAA,CAAW,IAAX,CAAiB,IAAArN,OAAjB,CAA9C,CAFF,GAIE,IAAA7G,QAAA8K,QAAA7yC,MAEA,CAF6B0G,CAE7B,CADA,IAAAqhC,QAAA8K,QAAArN,OACA,CAD8B,CAC9B,CAAA0W,CAAA,CAAqB,IAAAnU,QAAA8K,QAArB,CANF,CAFE,CAUF,MAAOzqC,CAAP,CAAU,CACV60C,CAAA,CAAc70C,CAAd,CACA,CAAA2zC,CAAA,CAAiB3zC,CAAjB,CAFU,CAdW,CAdA,CA6CzB0+B,OAAQA,QAAQ,CAAC94B,CAAD,CAAS,CACnB,IAAA+5B,QAAA8K,QAAArN,OAAJ,EACA,IAAAsX,SAAA,CAAc9uC,CAAd,CAFuB,CA7CA,CAkDzB8uC,SAAUA,QAAQ,CAAC9uC,CAAD,CAAS,CACzB,IAAA+5B,QAAA8K,QAAA7yC,MAAA,CAA6BgO,CAC7B,KAAA+5B,QAAA8K,QAAArN,OAAA,CAA8B,CAC9B0W,EAAA,CAAqB,IAAAnU,QAAA8K,QAArB,CAHyB,CAlDF;AAwDzBjE,OAAQA,QAAQ,CAACsO,CAAD,CAAW,CACzB,IAAI5S,EAAY,IAAAvC,QAAA8K,QAAAuJ,QAEoB,EAApC,EAAK,IAAArU,QAAA8K,QAAArN,OAAL,EAA0C8E,CAA1C,EAAuDA,CAAA1rC,OAAvD,EACEk9C,CAAA,CAAS,QAAQ,EAAG,CAElB,IAFkB,IACd9wB,CADc,CACJjG,CADI,CAETllB,EAAI,CAFK,CAEFY,EAAK6pC,CAAA1rC,OAArB,CAAuCiB,CAAvC,CAA2CY,CAA3C,CAA+CZ,CAAA,EAA/C,CAAoD,CAClDklB,CAAA,CAASulB,CAAA,CAAUzqC,CAAV,CAAA,CAAa,CAAb,CACTmrB,EAAA,CAAWsf,CAAA,CAAUzqC,CAAV,CAAA,CAAa,CAAb,CACX,IAAI,CACFklB,CAAA6pB,OAAA,CAAcvvC,CAAA,CAAW2rB,CAAX,CAAA,CAAuBA,CAAA,CAASkyB,CAAT,CAAvB,CAA4CA,CAA1D,CADE,CAEF,MAAO90C,CAAP,CAAU,CACV2zC,CAAA,CAAiB3zC,CAAjB,CADU,CALsC,CAFlC,CAApB,CAJuB,CAxDF,CAA3B,CAsHA,KAAI+0C,EAAcA,QAAoB,CAACn9C,CAAD,CAAQo9C,CAAR,CAAkB,CACtD,IAAIr4B,EAAS,IAAIs3B,CACbe,EAAJ,CACEr4B,CAAAqkB,QAAA,CAAeppC,CAAf,CADF,CAGE+kB,CAAA+hB,OAAA,CAAc9mC,CAAd,CAEF,OAAO+kB,EAAAgjB,QAP+C,CAAxD,CAUI8U,EAAiBA,QAAuB,CAAC78C,CAAD,CAAQq9C,CAAR,CAAoBryB,CAApB,CAA8B,CACxE,IAAIsyB,EAAiB,IACrB,IAAI,CACEj+C,CAAA,CAAW2rB,CAAX,CAAJ,GAA0BsyB,CAA1B,CAA2CtyB,CAAA,EAA3C,CADE,CAEF,MAAO5iB,CAAP,CAAU,CACV,MAAO+0C,EAAA,CAAY/0C,CAAZ,CAAe,CAAA,CAAf,CADG,CAGZ,MAAkBk1C,EAAlB,EAvodYj+C,CAAA,CAuodMi+C,CAvodKtgB,KAAX,CAuodZ,CACSsgB,CAAAtgB,KAAA,CAAoB,QAAQ,EAAG,CACpC,MAAOmgB,EAAA,CAAYn9C,CAAZ,CAAmBq9C,CAAnB,CAD6B,CAA/B,CAEJ,QAAQ,CAAC3zB,CAAD,CAAQ,CACjB,MAAOyzB,EAAA,CAAYzzB,CAAZ,CAAmB,CAAA,CAAnB,CADU,CAFZ,CADT,CAOSyzB,CAAA,CAAYn9C,CAAZ,CAAmBq9C,CAAnB,CAd+D,CAV1E,CA8CIrV,EAAOA,QAAQ,CAAChoC,CAAD,CAAQgrB,CAAR,CAAkBuyB,CAAlB,CAA2Bb,CAA3B,CAAyC,CAC1D,IAAI33B,EAAS,IAAIs3B,CACjBt3B,EAAAqkB,QAAA,CAAeppC,CAAf,CACA,OAAO+kB,EAAAgjB,QAAA/K,KAAA,CAAoBhS,CAApB;AAA8BuyB,CAA9B,CAAuCb,CAAvC,CAHmD,CA9C5D,CA4GIc,EAAKA,QAAU,CAACC,CAAD,CAAW,CAC5B,GAAK,CAAAp+C,CAAA,CAAWo+C,CAAX,CAAL,CACE,KAAMnB,EAAA,CAAS,SAAT,CAAsDmB,CAAtD,CAAN,CAGF,IAAItU,EAAW,IAAIkT,CAUnBoB,EAAA,CARAC,QAAkB,CAAC19C,CAAD,CAAQ,CACxBmpC,CAAAC,QAAA,CAAiBppC,CAAjB,CADwB,CAQ1B,CAJAuoC,QAAiB,CAACv6B,CAAD,CAAS,CACxBm7B,CAAArC,OAAA,CAAgB94B,CAAhB,CADwB,CAI1B,CAEA,OAAOm7B,EAAApB,QAjBqB,CAsB9ByV,EAAAh3B,UAAA,CAAew1B,CAAAx1B,UAEfg3B,EAAAtxB,MAAA,CA3UYA,QAAQ,EAAG,CACrB,IAAI2Z,EAAI,IAAIwW,CAEZxW,EAAAuD,QAAA,CAAY6S,CAAA,CAAWpW,CAAX,CAAcA,CAAAuD,QAAd,CACZvD,EAAAiB,OAAA,CAAWmV,CAAA,CAAWpW,CAAX,CAAcA,CAAAiB,OAAd,CACXjB,EAAA+I,OAAA,CAAWqN,CAAA,CAAWpW,CAAX,CAAcA,CAAA+I,OAAd,CACX,OAAO/I,EANc,CA4UvB2X,EAAA1W,OAAA,CA3IaA,QAAQ,CAAC94B,CAAD,CAAS,CAC5B,IAAI+W,EAAS,IAAIs3B,CACjBt3B,EAAA+hB,OAAA,CAAc94B,CAAd,CACA,OAAO+W,EAAAgjB,QAHqB,CA4I9ByV,EAAAxV,KAAA,CAAUA,CACVwV,EAAApU,QAAA,CArEcpB,CAsEdwV,EAAAG,IAAA,CApDAA,QAAY,CAACC,CAAD,CAAW,CAAA,IACjBzU,EAAW,IAAIkT,CADE,CAEjBprC,EAAU,CAFO,CAGjB4sC,EAAUp/C,CAAA,CAAQm/C,CAAR,CAAA,CAAoB,EAApB,CAAyB,EAEvC3+C,EAAA,CAAQ2+C,CAAR,CAAkB,QAAQ,CAAC7V,CAAD,CAAU3oC,CAAV,CAAe,CACvC6R,CAAA,EACA+2B,EAAA,CAAKD,CAAL,CAAA/K,KAAA,CAAmB,QAAQ,CAACh9B,CAAD,CAAQ,CAC7B69C,CAAAv+C,eAAA,CAAuBF,CAAvB,CAAJ,GACAy+C,CAAA,CAAQz+C,CAAR,CACA,CADeY,CACf,CAAM,EAAEiR,CAAR,EAAkBk4B,CAAAC,QAAA,CAAiByU,CAAjB,CAFlB,CADiC,CAAnC,CAIG,QAAQ,CAAC7vC,CAAD,CAAS,CACd6vC,CAAAv+C,eAAA,CAAuBF,CAAvB,CAAJ;AACA+pC,CAAArC,OAAA,CAAgB94B,CAAhB,CAFkB,CAJpB,CAFuC,CAAzC,CAYgB,EAAhB,GAAIiD,CAAJ,EACEk4B,CAAAC,QAAA,CAAiByU,CAAjB,CAGF,OAAO1U,EAAApB,QArBc,CAsDvB,OAAOyV,EA9VqC,CAiW9CniC,QAASA,GAAa,EAAG,CACvB,IAAA4H,KAAA,CAAY,CAAC,SAAD,CAAY,UAAZ,CAAwB,QAAQ,CAAC/H,CAAD,CAAUF,CAAV,CAAoB,CAC9D,IAAI8iC,EAAwB5iC,CAAA4iC,sBAAxBA,EACwB5iC,CAAA6iC,4BAD5B,CAGIC,EAAuB9iC,CAAA8iC,qBAAvBA,EACuB9iC,CAAA+iC,2BADvBD,EAEuB9iC,CAAAgjC,kCAL3B,CAOIC,EAAe,CAAEL,CAAAA,CAPrB,CAQIM,EAAMD,CAAA,CACN,QAAQ,CAAC93C,CAAD,CAAK,CACX,IAAIknB,EAAKuwB,CAAA,CAAsBz3C,CAAtB,CACT,OAAO,SAAQ,EAAG,CAChB23C,CAAA,CAAqBzwB,CAArB,CADgB,CAFP,CADP,CAON,QAAQ,CAAClnB,CAAD,CAAK,CACX,IAAIg4C,EAAQrjC,CAAA,CAAS3U,CAAT,CAAa,KAAb,CAAoB,CAAA,CAApB,CACZ,OAAO,SAAQ,EAAG,CAChB2U,CAAAsR,OAAA,CAAgB+xB,CAAhB,CADgB,CAFP,CAOjBD,EAAAE,UAAA,CAAgBH,CAEhB,OAAOC,EAzBuD,CAApD,CADW,CAiGzBrkC,QAASA,GAAkB,EAAG,CAa5BwkC,QAASA,EAAqB,CAACx8C,CAAD,CAAS,CACrCy8C,QAASA,EAAU,EAAG,CACpB,IAAAC,WAAA,CAAkB,IAAAC,cAAlB,CACI,IAAAC,YADJ;AACuB,IAAAC,YADvB,CAC0C,IAC1C,KAAAC,YAAA,CAAmB,EACnB,KAAAC,gBAAA,CAAuB,EACvB,KAAAC,gBAAA,CAAuB,CACvB,KAAAC,IAAA,CApteG,EAAE9+C,EAqteL,KAAA++C,aAAA,CAAoB,IAPA,CAStBT,CAAAh4B,UAAA,CAAuBzkB,CACvB,OAAOy8C,EAX8B,CAZvC,IAAIU,EAAM,EAAV,CACIC,EAAmB9gD,CAAA,CAAO,YAAP,CADvB,CAEI+gD,EAAiB,IAFrB,CAGIC,EAAe,IAEnB,KAAAC,UAAA,CAAiBC,QAAQ,CAACv/C,CAAD,CAAQ,CAC3ByB,SAAA7C,OAAJ,GACEsgD,CADF,CACQl/C,CADR,CAGA,OAAOk/C,EAJwB,CAqBjC,KAAAj8B,KAAA,CAAY,CAAC,mBAAD,CAAsB,QAAtB,CAAgC,UAAhC,CACR,QAAQ,CAAC7K,CAAD,CAAoBwB,CAApB,CAA4BhC,CAA5B,CAAsC,CAEhD4nC,QAASA,EAAiB,CAACC,CAAD,CAAS,CAC/BA,CAAAC,aAAAriB,YAAA,CAAkC,CAAA,CADH,CAInCsiB,QAASA,EAAY,CAACtnB,CAAD,CAAS,CAEf,CAAb,GAAI/R,EAAJ,GAME+R,CAAAsmB,YACA,EADsBgB,CAAA,CAAatnB,CAAAsmB,YAAb,CACtB,CAAAtmB,CAAAqmB,cAAA,EAAwBiB,CAAA,CAAatnB,CAAAqmB,cAAb,CAP1B,CAiBArmB,EAAA1F,QAAA,CAAiB0F,CAAAqmB,cAAjB,CAAwCrmB,CAAAunB,cAAxC,CAA+DvnB,CAAAsmB,YAA/D;AACItmB,CAAAumB,YADJ,CACyBvmB,CAAAwnB,MADzB,CACwCxnB,CAAAomB,WADxC,CAC4D,IApBhC,CA+D9BqB,QAASA,EAAK,EAAG,CACf,IAAAd,IAAA,CAlyeG,EAAE9+C,EAmyeL,KAAAgpC,QAAA,CAAe,IAAAvW,QAAf,CAA8B,IAAA8rB,WAA9B,CACe,IAAAC,cADf,CACoC,IAAAkB,cADpC,CAEe,IAAAjB,YAFf,CAEkC,IAAAC,YAFlC,CAEqD,IACrD,KAAAiB,MAAA,CAAa,IACb,KAAAxiB,YAAA,CAAmB,CAAA,CACnB,KAAAwhB,YAAA,CAAmB,EACnB,KAAAC,gBAAA,CAAuB,EACvB,KAAAC,gBAAA,CAAuB,CACvB,KAAA5uB,kBAAA,CAAyB,IAVV,CA4nCjB4vB,QAASA,EAAU,CAACC,CAAD,CAAQ,CACzB,GAAIlmC,CAAAovB,QAAJ,CACE,KAAMiW,EAAA,CAAiB,QAAjB,CAAsDrlC,CAAAovB,QAAtD,CAAN,CAGFpvB,CAAAovB,QAAA,CAAqB8W,CALI,CAY3BC,QAASA,EAAsB,CAACC,CAAD,CAAU/R,CAAV,CAAiB,CAC9C,EACE+R,EAAAnB,gBAAA,EAA2B5Q,CAD7B,OAEU+R,CAFV,CAEoBA,CAAAvtB,QAFpB,CAD8C,CAMhDwtB,QAASA,EAAsB,CAACD,CAAD,CAAU/R,CAAV,CAAiBjkC,CAAjB,CAAuB,CACpD,EACEg2C,EAAApB,gBAAA,CAAwB50C,CAAxB,CAEA,EAFiCikC,CAEjC,CAAsC,CAAtC,GAAI+R,CAAApB,gBAAA,CAAwB50C,CAAxB,CAAJ;AACE,OAAOg2C,CAAApB,gBAAA,CAAwB50C,CAAxB,CAJX,OAMUg2C,CANV,CAMoBA,CAAAvtB,QANpB,CADoD,CActDytB,QAASA,EAAY,EAAG,EAExBC,QAASA,EAAe,EAAG,CACzB,IAAA,CAAOC,CAAA1hD,OAAP,CAAA,CACE,GAAI,CACF0hD,CAAAr6B,MAAA,EAAA,EADE,CAEF,MAAO7d,CAAP,CAAU,CACVgQ,CAAA,CAAkBhQ,CAAlB,CADU,CAIdi3C,CAAA,CAAe,IARU,CAW3BkB,QAASA,EAAkB,EAAG,CACP,IAArB,GAAIlB,CAAJ,GACEA,CADF,CACiBznC,CAAAsU,MAAA,CAAe,QAAQ,EAAG,CACvCpS,CAAAzO,OAAA,CAAkBg1C,CAAlB,CADuC,CAA1B,CADjB,CAD4B,CApoC9BP,CAAAt5B,UAAA,CAAkB,CAChB5hB,YAAak7C,CADG,CA+BhBltB,KAAMA,QAAQ,CAAC4tB,CAAD,CAAUz+C,CAAV,CAAkB,CAC9B,IAAI0+C,CAEJ1+C,EAAA,CAASA,CAAT,EAAmB,IAEfy+C,EAAJ,EACEC,CACA,CADQ,IAAIX,CACZ,CAAAW,CAAAZ,MAAA,CAAc,IAAAA,MAFhB,GAMO,IAAAZ,aAGL,GAFE,IAAAA,aAEF,CAFsBV,CAAA,CAAsB,IAAtB,CAEtB,EAAAkC,CAAA,CAAQ,IAAI,IAAAxB,aATd,CAWAwB,EAAA9tB,QAAA,CAAgB5wB,CAChB0+C,EAAAb,cAAA,CAAsB79C,CAAA68C,YAClB78C,EAAA48C,YAAJ,EACE58C,CAAA68C,YAAAF,cACA,CADmC+B,CACnC,CAAA1+C,CAAA68C,YAAA,CAAqB6B,CAFvB,EAIE1+C,CAAA48C,YAJF,CAIuB58C,CAAA68C,YAJvB,CAI4C6B,CAQ5C,EAAID,CAAJ,EAAez+C,CAAf,EAAyB,IAAzB,GAA+B0+C,CAAAnnB,IAAA,CAAU,UAAV;AAAsBkmB,CAAtB,CAE/B,OAAOiB,EAhCuB,CA/BhB,CAsLhB59C,OAAQA,QAAQ,CAAC69C,CAAD,CAAWn2B,CAAX,CAAqBgiB,CAArB,CAAqC8N,CAArC,CAA4D,CAC1E,IAAIluC,EAAMyN,CAAA,CAAO8mC,CAAP,CAEV,IAAIv0C,CAAA+gC,gBAAJ,CACE,MAAO/gC,EAAA+gC,gBAAA,CAAoB,IAApB,CAA0B3iB,CAA1B,CAAoCgiB,CAApC,CAAoDpgC,CAApD,CAAyDu0C,CAAzD,CAJiE,KAMtEv1C,EAAQ,IAN8D,CAOtEtH,EAAQsH,CAAAszC,WAP8D,CAQtEkC,EAAU,CACRt6C,GAAIkkB,CADI,CAERq2B,KAAMR,CAFE,CAGRj0C,IAAKA,CAHG,CAIR8gC,IAAKoN,CAALpN,EAA8ByT,CAJtB,CAKRG,GAAI,CAAEtU,CAAAA,CALE,CAQd6S,EAAA,CAAiB,IAEZ//C,EAAA,CAAWkrB,CAAX,CAAL,GACEo2B,CAAAt6C,GADF,CACenE,CADf,CAIK2B,EAAL,GACEA,CADF,CACUsH,CAAAszC,WADV,CAC6B,EAD7B,CAKA56C,EAAA+G,QAAA,CAAc+1C,CAAd,CACAV,EAAA,CAAuB,IAAvB,CAA6B,CAA7B,CAEA,OAAOa,SAAwB,EAAG,CACG,CAAnC,EAAIl9C,EAAA,CAAYC,CAAZ,CAAmB88C,CAAnB,CAAJ,EACEV,CAAA,CAAuB90C,CAAvB,CAA+B,EAA/B,CAEFi0C,EAAA,CAAiB,IAJe,CA9BwC,CAtL5D,CAqPhBxR,YAAaA,QAAQ,CAACmT,CAAD,CAAmBx2B,CAAnB,CAA6B,CAwChDy2B,QAASA,EAAgB,EAAG,CAC1BC,CAAA,CAA0B,CAAA,CAEtBC,EAAJ,EACEA,CACA,CADW,CAAA,CACX,CAAA32B,CAAA,CAAS42B,CAAT,CAAoBA,CAApB,CAA+B/6C,CAA/B,CAFF,EAIEmkB,CAAA,CAAS42B,CAAT,CAAoBrT,CAApB,CAA+B1nC,CAA/B,CAPwB,CAvC5B,IAAI0nC,EAAgB/uC,KAAJ,CAAUgiD,CAAAniD,OAAV,CAAhB,CACIuiD,EAAgBpiD,KAAJ,CAAUgiD,CAAAniD,OAAV,CADhB,CAEIwiD,EAAgB,EAFpB,CAGIh7C,EAAO,IAHX,CAII66C,EAA0B,CAAA,CAJ9B,CAKIC,EAAW,CAAA,CAEf,IAAKtiD,CAAAmiD,CAAAniD,OAAL,CAA8B,CAE5B,IAAIyiD,EAAa,CAAA,CACjBj7C,EAAAxD,WAAA,CAAgB,QAAQ,EAAG,CACrBy+C,CAAJ,EAAgB92B,CAAA,CAAS42B,CAAT,CAAoBA,CAApB,CAA+B/6C,CAA/B,CADS,CAA3B,CAGA,OAAOk7C,SAA6B,EAAG,CACrCD,CAAA;AAAa,CAAA,CADwB,CANX,CAW9B,GAAgC,CAAhC,GAAIN,CAAAniD,OAAJ,CAEE,MAAO,KAAAiE,OAAA,CAAYk+C,CAAA,CAAiB,CAAjB,CAAZ,CAAiCC,QAAyB,CAAChhD,CAAD,CAAQo/B,CAAR,CAAkBj0B,CAAlB,CAAyB,CACxFg2C,CAAA,CAAU,CAAV,CAAA,CAAenhD,CACf8tC,EAAA,CAAU,CAAV,CAAA,CAAe1O,CACf7U,EAAA,CAAS42B,CAAT,CAAqBnhD,CAAD,GAAWo/B,CAAX,CAAuB+hB,CAAvB,CAAmCrT,CAAvD,CAAkE3iC,CAAlE,CAHwF,CAAnF,CAOTlM,EAAA,CAAQ8hD,CAAR,CAA0B,QAAQ,CAACxK,CAAD,CAAO12C,CAAP,CAAU,CAC1C,IAAI0hD,EAAYn7C,CAAAvD,OAAA,CAAY0zC,CAAZ,CAAkBiL,QAA4B,CAACxhD,CAAD,CAAQo/B,CAAR,CAAkB,CAC9E+hB,CAAA,CAAUthD,CAAV,CAAA,CAAeG,CACf8tC,EAAA,CAAUjuC,CAAV,CAAA,CAAeu/B,CACV6hB,EAAL,GACEA,CACA,CAD0B,CAAA,CAC1B,CAAA76C,CAAAxD,WAAA,CAAgBo+C,CAAhB,CAFF,CAH8E,CAAhE,CAQhBI,EAAA/8C,KAAA,CAAmBk9C,CAAnB,CAT0C,CAA5C,CAuBA,OAAOD,SAA6B,EAAG,CACrC,IAAA,CAAOF,CAAAxiD,OAAP,CAAA,CACEwiD,CAAAn7B,MAAA,EAAA,EAFmC,CAnDS,CArPlC,CAuWhBwa,iBAAkBA,QAAQ,CAACliC,CAAD,CAAMgsB,CAAN,CAAgB,CAoBxCk3B,QAASA,EAA2B,CAACC,CAAD,CAAS,CAC3CziB,CAAA,CAAWyiB,CADgC,KAE5BtiD,CAF4B,CAEvBuiD,CAFuB,CAEdC,CAFc,CAELC,CAGtC,IAAI,CAAAr/C,CAAA,CAAYy8B,CAAZ,CAAJ,CAAA,CAEA,GAAKv+B,CAAA,CAASu+B,CAAT,CAAL,CAKO,GAAI3gC,EAAA,CAAY2gC,CAAZ,CAAJ,CAgBL,IAfIG,CAeKv/B,GAfQiiD,CAeRjiD,GAbPu/B,CAEA,CAFW0iB,CAEX,CADAC,CACA,CADY3iB,CAAAxgC,OACZ,CAD8B,CAC9B,CAAAojD,CAAA,EAWOniD,EARToiD,CAQSpiD,CARGo/B,CAAArgC,OAQHiB,CANLkiD,CAMKliD,GANSoiD,CAMTpiD,GAJPmiD,CAAA,EACA,CAAA5iB,CAAAxgC,OAAA,CAAkBmjD,CAAlB,CAA8BE,CAGvBpiD,EAAAA,CAAAA,CAAI,CAAb,CAAgBA,CAAhB,CAAoBoiD,CAApB,CAA+BpiD,CAAA,EAA/B,CACEgiD,CAIA,CAJUziB,CAAA,CAASv/B,CAAT,CAIV,CAHA+hD,CAGA,CAHU3iB,CAAA,CAASp/B,CAAT,CAGV,CADA8hD,CACA,CADWE,CACX,GADuBA,CACvB,EADoCD,CACpC,GADgDA,CAChD,CAAKD,CAAL,EAAiBE,CAAjB,GAA6BD,CAA7B,GACEI,CAAA,EACA,CAAA5iB,CAAA,CAASv/B,CAAT,CAAA,CAAc+hD,CAFhB,CArBG,KA0BA,CACDxiB,CAAJ,GAAiB8iB,CAAjB,GAEE9iB,CAEA,CAFW8iB,CAEX,CAF4B,EAE5B,CADAH,CACA,CADY,CACZ,CAAAC,CAAA,EAJF,CAOAC,EAAA,CAAY,CACZ,KAAK7iD,CAAL,GAAY6/B,EAAZ,CACM3/B,EAAAC,KAAA,CAAoB0/B,CAApB;AAA8B7/B,CAA9B,CAAJ,GACE6iD,CAAA,EAIA,CAHAL,CAGA,CAHU3iB,CAAA,CAAS7/B,CAAT,CAGV,CAFAyiD,CAEA,CAFUziB,CAAA,CAAShgC,CAAT,CAEV,CAAIA,CAAJ,GAAWggC,EAAX,EACEuiB,CACA,CADWE,CACX,GADuBA,CACvB,EADoCD,CACpC,GADgDA,CAChD,CAAKD,CAAL,EAAiBE,CAAjB,GAA6BD,CAA7B,GACEI,CAAA,EACA,CAAA5iB,CAAA,CAAShgC,CAAT,CAAA,CAAgBwiD,CAFlB,CAFF,GAOEG,CAAA,EAEA,CADA3iB,CAAA,CAAShgC,CAAT,CACA,CADgBwiD,CAChB,CAAAI,CAAA,EATF,CALF,CAkBF,IAAID,CAAJ,CAAgBE,CAAhB,CAGE,IAAK7iD,CAAL,GADA4iD,EAAA,EACY5iB,CAAAA,CAAZ,CACO9/B,EAAAC,KAAA,CAAoB0/B,CAApB,CAA8B7/B,CAA9B,CAAL,GACE2iD,CAAA,EACA,CAAA,OAAO3iB,CAAA,CAAShgC,CAAT,CAFT,CAhCC,CA/BP,IACMggC,EAAJ,GAAiBH,CAAjB,GACEG,CACA,CADWH,CACX,CAAA+iB,CAAA,EAFF,CAqEF,OAAOA,EAxEP,CAL2C,CAnB7CP,CAAAlhB,UAAA,CAAwC,CAAA,CAExC,KAAIn6B,EAAO,IAAX,CAEI64B,CAFJ,CAKIG,CALJ,CAOI+iB,CAPJ,CASIC,EAAuC,CAAvCA,CAAqB73B,CAAA3rB,OATzB,CAUIojD,EAAiB,CAVrB,CAWIK,EAAiBzoC,CAAA,CAAOrb,CAAP,CAAYkjD,CAAZ,CAXrB,CAYIK,EAAgB,EAZpB,CAaII,EAAiB,EAbrB,CAcII,EAAU,CAAA,CAdd,CAeIP,EAAY,CA+GhB,OAAO,KAAAl/C,OAAA,CAAYw/C,CAAZ,CA7BPE,QAA+B,EAAG,CAC5BD,CAAJ,EACEA,CACA,CADU,CAAA,CACV,CAAA/3B,CAAA,CAAS0U,CAAT,CAAmBA,CAAnB,CAA6B74B,CAA7B,CAFF,EAIEmkB,CAAA,CAAS0U,CAAT,CAAmBkjB,CAAnB,CAAiC/7C,CAAjC,CAIF,IAAIg8C,CAAJ,CACE,GAAK1hD,CAAA,CAASu+B,CAAT,CAAL,CAGO,GAAI3gC,EAAA,CAAY2gC,CAAZ,CAAJ,CAA2B,CAChCkjB,CAAA,CAAmBpjD,KAAJ,CAAUkgC,CAAArgC,OAAV,CACf,KAAS,IAAAiB,EAAI,CAAb,CAAgBA,CAAhB,CAAoBo/B,CAAArgC,OAApB,CAAqCiB,CAAA,EAArC,CACEsiD,CAAA,CAAatiD,CAAb,CAAA,CAAkBo/B,CAAA,CAASp/B,CAAT,CAHY,CAA3B,IAOL,KAAST,CAAT,GADA+iD,EACgBljB,CADD,EACCA,CAAAA,CAAhB,CACM3/B,EAAAC,KAAA,CAAoB0/B,CAApB,CAA8B7/B,CAA9B,CAAJ,GACE+iD,CAAA,CAAa/iD,CAAb,CADF,CACsB6/B,CAAA,CAAS7/B,CAAT,CADtB,CAXJ,KAEE+iD,EAAA,CAAeljB,CAZa,CA6B3B,CAjIiC,CAvW1B,CA8hBhB8U,QAASA,QAAQ,EAAG,CAAA,IACdyO,CADc,CACPxiD,CADO,CACA4gD,CADA,CACMv6C,CADN,CACU8F,CADV,CAEds2C,CAFc,CAGd7jD,CAHc,CAId8jD,CAJc,CAIPC,EAAMzD,CAJC,CAKRgB,CALQ,CAMd0C,EAAW,EANG,CAOdC,CAPc,CAOEC,CAEpB/C;CAAA,CAAW,SAAX,CAEAnoC,EAAAmU,iBAAA,EAEI,KAAJ,GAAajS,CAAb,EAA4C,IAA5C,GAA2BulC,CAA3B,GAGEznC,CAAAsU,MAAAI,OAAA,CAAsB+yB,CAAtB,CACA,CAAAgB,CAAA,EAJF,CAOAjB,EAAA,CAAiB,IAEjB,GAAG,CACDsD,CAAA,CAAQ,CAAA,CAGR,KAFAxC,CAEA,CArB0Br9B,IAqB1B,CAAOkgC,CAAAnkD,OAAP,CAAA,CAA0B,CACxB,GAAI,CACFkkD,CACA,CADYC,CAAA98B,MAAA,EACZ,CAAA68B,CAAA33C,MAAA63C,MAAA,CAAsBF,CAAArf,WAAtB,CAA4Cqf,CAAA38B,OAA5C,CAFE,CAGF,MAAO/d,CAAP,CAAU,CACVgQ,CAAA,CAAkBhQ,CAAlB,CADU,CAGZg3C,CAAA,CAAiB,IAPO,CAU1B,CAAA,CACA,EAAG,CACD,GAAKqD,CAAL,CAAgBvC,CAAAzB,WAAhB,CAGE,IADA7/C,CACA,CADS6jD,CAAA7jD,OACT,CAAOA,CAAA,EAAP,CAAA,CACE,GAAI,CAIF,GAHA4jD,CAGA,CAHQC,CAAA,CAAS7jD,CAAT,CAGR,CAEE,GADAuN,CACI,CADEq2C,CAAAr2C,IACF,EAACnM,CAAD,CAASmM,CAAA,CAAI+zC,CAAJ,CAAT,KAA4BU,CAA5B,CAAmC4B,CAAA5B,KAAnC,GACE,EAAA4B,CAAA3B,GAAA,CACIr7C,EAAA,CAAOxF,CAAP,CAAc4gD,CAAd,CADJ,CAEsB,QAFtB,GAEK,MAAO5gD,EAFZ,EAEkD,QAFlD,GAEkC,MAAO4gD,EAFzC,EAGQp5C,KAAA,CAAMxH,CAAN,CAHR,EAGwBwH,KAAA,CAAMo5C,CAAN,CAHxB,CADN,CAKE8B,CAKA,CALQ,CAAA,CAKR,CAJAtD,CAIA,CAJiBoD,CAIjB,CAHAA,CAAA5B,KAGA,CAHa4B,CAAA3B,GAAA,CAAW58C,EAAA,CAAKjE,CAAL,CAAY,IAAZ,CAAX,CAA+BA,CAG5C,CAFAqG,CAEA,CAFKm8C,CAAAn8C,GAEL,CADAA,CAAA,CAAGrG,CAAH,CAAY4gD,CAAD,GAAUR,CAAV,CAA0BpgD,CAA1B,CAAkC4gD,CAA7C,CAAoDV,CAApD,CACA,CAAU,CAAV,CAAIyC,CAAJ,GACEE,CAEA,CAFS,CAET,CAFaF,CAEb,CADKC,CAAA,CAASC,CAAT,CACL,GADuBD,CAAA,CAASC,CAAT,CACvB,CAD0C,EAC1C,EAAAD,CAAA,CAASC,CAAT,CAAAx+C,KAAA,CAAsB,CACpB4+C,IAAK5jD,CAAA,CAAWmjD,CAAAvV,IAAX,CAAA,CAAwB,MAAxB,EAAkCuV,CAAAvV,IAAA/iC,KAAlC,EAAoDs4C,CAAAvV,IAAA1qC,SAAA,EAApD;AAA4EigD,CAAAvV,IAD7D,CAEpBpkB,OAAQ7oB,CAFY,CAGpB8oB,OAAQ83B,CAHY,CAAtB,CAHF,CAVF,KAmBO,IAAI4B,CAAJ,GAAcpD,CAAd,CAA8B,CAGnCsD,CAAA,CAAQ,CAAA,CACR,OAAM,CAJ6B,CAzBrC,CAgCF,MAAOt6C,CAAP,CAAU,CACVgQ,CAAA,CAAkBhQ,CAAlB,CADU,CAShB,GAAM,EAAA86C,CAAA,CAAShD,CAAAnB,gBAAT,EAAoCmB,CAAAvB,YAApC,EACDuB,CADC,GA9EkBr9B,IA8ElB,EACqBq9B,CAAAxB,cADrB,CAAN,CAEE,IAAA,CAAOwB,CAAP,GAhFsBr9B,IAgFtB,EAA+B,EAAAqgC,CAAA,CAAOhD,CAAAxB,cAAP,CAA/B,CAAA,CACEwB,CAAA,CAAUA,CAAAvtB,QAjDb,CAAH,MAoDUutB,CApDV,CAoDoBgD,CApDpB,CAwDA,KAAKR,CAAL,EAAcK,CAAAnkD,OAAd,GAAsC,CAAA+jD,CAAA,EAAtC,CAEE,KAmeN7oC,EAAAovB,QAneY,CAmeS,IAneT,CAAAiW,CAAA,CAAiB,QAAjB,CAGFD,CAHE,CAGG0D,CAHH,CAAN,CAzED,CAAH,MA+ESF,CA/ET,EA+EkBK,CAAAnkD,OA/ElB,CAmFA,KAydFkb,CAAAovB,QAzdE,CAydmB,IAzdnB,CAAOia,CAAAvkD,OAAP,CAAA,CACE,GAAI,CACFukD,CAAAl9B,MAAA,EAAA,EADE,CAEF,MAAO7d,CAAP,CAAU,CACVgQ,CAAA,CAAkBhQ,CAAlB,CADU,CA5GI,CA9hBJ,CAmrBhBuF,SAAUA,QAAQ,EAAG,CAEnB,GAAI0vB,CAAA,IAAAA,YAAJ,CAAA,CACA,IAAIt7B,EAAS,IAAA4wB,QAEb,KAAAogB,WAAA,CAAgB,UAAhB,CACA,KAAA1V,YAAA,CAAmB,CAAA,CAEf,KAAJ,GAAavjB,CAAb,EAEElC,CAAAgU,uBAAA,EAGFq0B,EAAA,CAAuB,IAAvB,CAA6B,CAAC,IAAAlB,gBAA9B,CACA;IAASqE,IAAAA,CAAT,GAAsB,KAAAtE,gBAAtB,CACEqB,CAAA,CAAuB,IAAvB,CAA6B,IAAArB,gBAAA,CAAqBsE,CAArB,CAA7B,CAA8DA,CAA9D,CAKErhD,EAAJ,EAAcA,CAAA48C,YAAd,EAAoC,IAApC,GAA0C58C,CAAA48C,YAA1C,CAA+D,IAAAD,cAA/D,CACI38C,EAAJ,EAAcA,CAAA68C,YAAd,EAAoC,IAApC,GAA0C78C,CAAA68C,YAA1C,CAA+D,IAAAgB,cAA/D,CACI,KAAAA,cAAJ,GAAwB,IAAAA,cAAAlB,cAAxB,CAA2D,IAAAA,cAA3D,CACI,KAAAA,cAAJ,GAAwB,IAAAA,cAAAkB,cAAxB,CAA2D,IAAAA,cAA3D,CAGA,KAAAjyC,SAAA,CAAgB,IAAAomC,QAAhB,CAA+B,IAAA1oC,OAA/B,CAA6C,IAAAzI,WAA7C,CAA+D,IAAAqmC,YAA/D,CAAkF/mC,CAClF,KAAAo3B,IAAA,CAAW,IAAAz2B,OAAX,CAAyB,IAAA+qC,YAAzB,CAA4CyV,QAAQ,EAAG,CAAE,MAAOnhD,EAAT,CACvD,KAAA28C,YAAA,CAAmB,EAGnB,KAAAH,cAAA;AAAqB,IACrBiB,EAAA,CAAa,IAAb,CA9BA,CAFmB,CAnrBL,CAkvBhBqD,MAAOA,QAAQ,CAACzM,CAAD,CAAOpwB,CAAP,CAAe,CAC5B,MAAOvM,EAAA,CAAO28B,CAAP,CAAA,CAAa,IAAb,CAAmBpwB,CAAnB,CADqB,CAlvBd,CAoxBhBvjB,WAAYA,QAAQ,CAAC2zC,CAAD,CAAOpwB,CAAP,CAAe,CAG5BrM,CAAAovB,QAAL,EAA4B6Z,CAAAnkD,OAA5B,EACEgZ,CAAAsU,MAAA,CAAe,QAAQ,EAAG,CACpB62B,CAAAnkD,OAAJ,EACEkb,CAAAi6B,QAAA,EAFsB,CAA1B,CAOFgP,EAAA1+C,KAAA,CAAgB,CAAC8G,MAAO,IAAR,CAAcs4B,WAAY7pB,CAAA,CAAO28B,CAAP,CAA1B,CAAwCpwB,OAAQA,CAAhD,CAAhB,CAXiC,CApxBnB,CAkyBhB+0B,aAAcA,QAAQ,CAAC70C,CAAD,CAAK,CACzB88C,CAAA9+C,KAAA,CAAqBgC,CAArB,CADyB,CAlyBX,CAm1BhBgF,OAAQA,QAAQ,CAACkrC,CAAD,CAAO,CACrB,GAAI,CACFwJ,CAAA,CAAW,QAAX,CACA,IAAI,CACF,MAAO,KAAAiD,MAAA,CAAWzM,CAAX,CADL,CAAJ,OAEU,CAwQdz8B,CAAAovB,QAAA,CAAqB,IAxQP,CAJR,CAOF,MAAO9gC,CAAP,CAAU,CACVgQ,CAAA,CAAkBhQ,CAAlB,CADU,CAPZ,OASU,CACR,GAAI,CACF0R,CAAAi6B,QAAA,EADE,CAEF,MAAO3rC,CAAP,CAAU,CAEV,KADAgQ,EAAA,CAAkBhQ,CAAlB,CACMA,CAAAA,CAAN,CAFU,CAHJ,CAVW,CAn1BP,CAw3BhB6gC,YAAaA,QAAQ,CAACsN,CAAD,CAAO,CAM1B+M,QAASA,EAAqB,EAAG,CAC/Bn4C,CAAA63C,MAAA,CAAYzM,CAAZ,CAD+B,CALjC,IAAIprC,EAAQ,IACZorC,EAAA,EAAQ+J,CAAAj8C,KAAA,CAAqBi/C,CAArB,CACR/M,EAAA,CAAO38B,CAAA,CAAO28B,CAAP,CACPgK,EAAA,EAJ0B,CAx3BZ,CA85BhBjnB,IAAKA,QAAQ,CAACpvB,CAAD,CAAOqgB,CAAP,CAAiB,CAC5B,IAAIg5B,EAAiB,IAAA1E,YAAA,CAAiB30C,CAAjB,CAChBq5C;CAAL,GACE,IAAA1E,YAAA,CAAiB30C,CAAjB,CADF,CAC2Bq5C,CAD3B,CAC4C,EAD5C,CAGAA,EAAAl/C,KAAA,CAAoBkmB,CAApB,CAEA,KAAI21B,EAAU,IACd,GACOA,EAAApB,gBAAA,CAAwB50C,CAAxB,CAGL,GAFEg2C,CAAApB,gBAAA,CAAwB50C,CAAxB,CAEF,CAFkC,CAElC,EAAAg2C,CAAApB,gBAAA,CAAwB50C,CAAxB,CAAA,EAJF,OAKUg2C,CALV,CAKoBA,CAAAvtB,QALpB,CAOA,KAAIvsB,EAAO,IACX,OAAO,SAAQ,EAAG,CAChB,IAAIo9C,EAAkBD,CAAAx/C,QAAA,CAAuBwmB,CAAvB,CACG,GAAzB,GAAIi5B,CAAJ,GACED,CAAA,CAAeC,CAAf,CACA,CADkC,IAClC,CAAArD,CAAA,CAAuB/5C,CAAvB,CAA6B,CAA7B,CAAgC8D,CAAhC,CAFF,CAFgB,CAhBU,CA95Bd,CA88BhBu5C,MAAOA,QAAQ,CAACv5C,CAAD,CAAOka,CAAP,CAAa,CAAA,IACtBjc,EAAQ,EADc,CAEtBo7C,CAFsB,CAGtBp4C,EAAQ,IAHc,CAItBkX,EAAkB,CAAA,CAJI,CAKtBV,EAAQ,CACNzX,KAAMA,CADA,CAENw5C,YAAav4C,CAFP,CAGNkX,gBAAiBA,QAAQ,EAAG,CAACA,CAAA,CAAkB,CAAA,CAAnB,CAHtB,CAINsxB,eAAgBA,QAAQ,EAAG,CACzBhyB,CAAAG,iBAAA,CAAyB,CAAA,CADA,CAJrB,CAONA,iBAAkB,CAAA,CAPZ,CALc,CActB6hC,EAAe39C,EAAA,CAAO,CAAC2b,CAAD,CAAP,CAAgBlgB,SAAhB,CAA2B,CAA3B,CAdO,CAetB5B,CAfsB,CAenBjB,CAEP,GAAG,CACD2kD,CAAA,CAAiBp4C,CAAA0zC,YAAA,CAAkB30C,CAAlB,CAAjB,EAA4C/B,CAC5CwZ,EAAA+9B,aAAA,CAAqBv0C,CAChBtL,EAAA,CAAI,CAAT,KAAYjB,CAAZ,CAAqB2kD,CAAA3kD,OAArB,CAA4CiB,CAA5C,CAAgDjB,CAAhD,CAAwDiB,CAAA,EAAxD,CAGE,GAAK0jD,CAAA,CAAe1jD,CAAf,CAAL,CAMA,GAAI,CAEF0jD,CAAA,CAAe1jD,CAAf,CAAA2G,MAAA,CAAwB,IAAxB;AAA8Bm9C,CAA9B,CAFE,CAGF,MAAOv7C,CAAP,CAAU,CACVgQ,CAAA,CAAkBhQ,CAAlB,CADU,CATZ,IACEm7C,EAAAv/C,OAAA,CAAsBnE,CAAtB,CAAyB,CAAzB,CAEA,CADAA,CAAA,EACA,CAAAjB,CAAA,EAWJ,IAAIyjB,CAAJ,CAEE,MADAV,EAAA+9B,aACO/9B,CADc,IACdA,CAAAA,CAGTxW,EAAA,CAAQA,CAAAwnB,QAzBP,CAAH,MA0BSxnB,CA1BT,CA4BAwW,EAAA+9B,aAAA,CAAqB,IAErB,OAAO/9B,EA/CmB,CA98BZ,CAshChBoxB,WAAYA,QAAQ,CAAC7oC,CAAD,CAAOka,CAAP,CAAa,CAAA,IAE3B87B,EADSr9B,IADkB,CAG3BqgC,EAFSrgC,IADkB,CAI3BlB,EAAQ,CACNzX,KAAMA,CADA,CAENw5C,YALO7gC,IAGD,CAGN8wB,eAAgBA,QAAQ,EAAG,CACzBhyB,CAAAG,iBAAA,CAAyB,CAAA,CADA,CAHrB,CAMNA,iBAAkB,CAAA,CANZ,CASZ,IAAK,CAZQe,IAYRi8B,gBAAA,CAAuB50C,CAAvB,CAAL,CAAmC,MAAOyX,EAM1C,KAnB+B,IAe3BgiC,EAAe39C,EAAA,CAAO,CAAC2b,CAAD,CAAP,CAAgBlgB,SAAhB,CAA2B,CAA3B,CAfY,CAgBhB5B,CAhBgB,CAgBbjB,CAGlB,CAAQshD,CAAR,CAAkBgD,CAAlB,CAAA,CAAyB,CACvBvhC,CAAA+9B,aAAA,CAAqBQ,CACrB9d,EAAA,CAAY8d,CAAArB,YAAA,CAAoB30C,CAApB,CAAZ,EAAyC,EACpCrK,EAAA,CAAI,CAAT,KAAYjB,CAAZ,CAAqBwjC,CAAAxjC,OAArB,CAAuCiB,CAAvC,CAA2CjB,CAA3C,CAAmDiB,CAAA,EAAnD,CAEE,GAAKuiC,CAAA,CAAUviC,CAAV,CAAL,CAOA,GAAI,CACFuiC,CAAA,CAAUviC,CAAV,CAAA2G,MAAA,CAAmB,IAAnB,CAAyBm9C,CAAzB,CADE,CAEF,MAAOv7C,CAAP,CAAU,CACVgQ,CAAA,CAAkBhQ,CAAlB,CADU,CATZ,IACEg6B,EAAAp+B,OAAA,CAAiBnE,CAAjB,CAAoB,CAApB,CAEA,CADAA,CAAA,EACA,CAAAjB,CAAA,EAeJ,IAAM,EAAAskD,CAAA,CAAShD,CAAApB,gBAAA,CAAwB50C,CAAxB,CAAT;AAA0Cg2C,CAAAvB,YAA1C,EACDuB,CADC,GAzCKr9B,IAyCL,EACqBq9B,CAAAxB,cADrB,CAAN,CAEE,IAAA,CAAOwB,CAAP,GA3CSr9B,IA2CT,EAA+B,EAAAqgC,CAAA,CAAOhD,CAAAxB,cAAP,CAA/B,CAAA,CACEwB,CAAA,CAAUA,CAAAvtB,QA1BS,CA+BzBhR,CAAA+9B,aAAA,CAAqB,IACrB,OAAO/9B,EAnDwB,CAthCjB,CA6kClB,KAAI7H,EAAa,IAAIgmC,CAArB,CAGIiD,EAAajpC,CAAA8pC,aAAbb,CAAuC,EAH3C,CAIII,EAAkBrpC,CAAA+pC,kBAAlBV,CAAiD,EAJrD,CAKI7C,EAAkBxmC,CAAAgqC,kBAAlBxD,CAAiD,EAErD,OAAOxmC,EA9rCyC,CADtC,CA3BgB,CAuyC9BxI,QAASA,GAAqB,EAAG,CAAA,IAC3Buf,EAA6B,mCADF,CAE7BG,EAA8B,4CAkBhC,KAAAH,2BAAA,CAAkCC,QAAQ,CAACC,CAAD,CAAS,CACjD,MAAItuB,EAAA,CAAUsuB,CAAV,CAAJ,EACEF,CACO,CADsBE,CACtB,CAAA,IAFT,EAIOF,CAL0C,CAyBnD,KAAAG,4BAAA,CAAmCC,QAAQ,CAACF,CAAD,CAAS,CAClD,MAAItuB,EAAA,CAAUsuB,CAAV,CAAJ,EACEC,CACO,CADuBD,CACvB,CAAA,IAFT,EAIOC,CAL2C,CAQpD,KAAA/N,KAAA,CAAYC,QAAQ,EAAG,CACrB,MAAO6gC,SAAoB,CAACC,CAAD,CAAMC,CAAN,CAAe,CACxC,IAAIC;AAAQD,CAAA,CAAUjzB,CAAV,CAAwCH,CAApD,CACIszB,CACJA,EAAA,CAAgB1Y,EAAA,CAAWuY,CAAX,CAAA/4B,KAChB,OAAsB,EAAtB,GAAIk5B,CAAJ,EAA6BA,CAAA/+C,MAAA,CAAoB8+C,CAApB,CAA7B,CAGOF,CAHP,CACS,SADT,CACqBG,CALmB,CADrB,CArDQ,CA2FjCC,QAASA,GAAa,CAACC,CAAD,CAAU,CAC9B,GAAgB,MAAhB,GAAIA,CAAJ,CACE,MAAOA,EACF,IAAI3lD,CAAA,CAAS2lD,CAAT,CAAJ,CAAuB,CAK5B,GAA8B,EAA9B,CAAIA,CAAAtgD,QAAA,CAAgB,KAAhB,CAAJ,CACE,KAAMugD,GAAA,CAAW,QAAX,CACsDD,CADtD,CAAN,CAGFA,CAAA,CAAUE,EAAA,CAAgBF,CAAhB,CAAAh9C,QAAA,CACY,QADZ,CACsB,IADtB,CAAAA,QAAA,CAEY,KAFZ,CAEmB,YAFnB,CAGV,OAAO,KAAInG,MAAJ,CAAW,GAAX,CAAiBmjD,CAAjB,CAA2B,GAA3B,CAZqB,CAavB,GAAIpjD,EAAA,CAASojD,CAAT,CAAJ,CAIL,MAAO,KAAInjD,MAAJ,CAAW,GAAX,CAAiBmjD,CAAAngD,OAAjB,CAAkC,GAAlC,CAEP,MAAMogD,GAAA,CAAW,UAAX,CAAN,CAtB4B,CA4BhCE,QAASA,GAAc,CAACC,CAAD,CAAW,CAChC,IAAIC,EAAmB,EACnBjiD,EAAA,CAAUgiD,CAAV,CAAJ,EACExlD,CAAA,CAAQwlD,CAAR,CAAkB,QAAQ,CAACJ,CAAD,CAAU,CAClCK,CAAArgD,KAAA,CAAsB+/C,EAAA,CAAcC,CAAd,CAAtB,CADkC,CAApC,CAIF,OAAOK,EAPyB,CA8ElCnqC,QAASA,GAAoB,EAAG,CAC9B,IAAAoqC,aAAA,CAAoBA,EADU,KAI1BC,EAAuB,CAAC,MAAD,CAJG,CAK1BC,EAAuB,EA0B3B,KAAAD,qBAAA,CAA4BE,QAAQ,CAAC9kD,CAAD,CAAQ,CACtCyB,SAAA7C,OAAJ,GACEgmD,CADF,CACyBJ,EAAA,CAAexkD,CAAf,CADzB,CAGA,OAAO4kD,EAJmC,CAkC5C;IAAAC,qBAAA,CAA4BE,QAAQ,CAAC/kD,CAAD,CAAQ,CACtCyB,SAAA7C,OAAJ,GACEimD,CADF,CACyBL,EAAA,CAAexkD,CAAf,CADzB,CAGA,OAAO6kD,EAJmC,CAO5C,KAAA5hC,KAAA,CAAY,CAAC,WAAD,CAAc,QAAQ,CAAC4D,CAAD,CAAY,CAW5Cm+B,QAASA,EAAQ,CAACX,CAAD,CAAUjV,CAAV,CAAqB,CACpC,MAAgB,MAAhB,GAAIiV,CAAJ,CACSza,EAAA,CAAgBwF,CAAhB,CADT,CAIS,CAAE,CAAAiV,CAAAxnC,KAAA,CAAauyB,CAAAnkB,KAAb,CALyB,CA+BtCg6B,QAASA,EAAkB,CAACC,CAAD,CAAO,CAChC,IAAIC,EAAaA,QAA+B,CAACC,CAAD,CAAe,CAC7D,IAAAC,qBAAA,CAA4BC,QAAQ,EAAG,CACrC,MAAOF,EAD8B,CADsB,CAK3DF,EAAJ,GACEC,CAAA3+B,UADF,CACyB,IAAI0+B,CAD7B,CAGAC,EAAA3+B,UAAAxlB,QAAA,CAA+BukD,QAAmB,EAAG,CACnD,MAAO,KAAAF,qBAAA,EAD4C,CAGrDF,EAAA3+B,UAAAjkB,SAAA,CAAgCijD,QAAoB,EAAG,CACrD,MAAO,KAAAH,qBAAA,EAAA9iD,SAAA,EAD8C,CAGvD,OAAO4iD,EAfyB,CAxClC,IAAIM,EAAgBA,QAAsB,CAACl9C,CAAD,CAAO,CAC/C,KAAM+7C,GAAA,CAAW,QAAX,CAAN,CAD+C,CAI7Cz9B,EAAAD,IAAA,CAAc,WAAd,CAAJ,GACE6+B,CADF,CACkB5+B,CAAA1a,IAAA,CAAc,WAAd,CADlB,CAN4C;IA4DxCu5C,EAAyBT,CAAA,EA5De,CA6DxCU,EAAS,EAEbA,EAAA,CAAOhB,EAAAhmB,KAAP,CAAA,CAA4BsmB,CAAA,CAAmBS,CAAnB,CAC5BC,EAAA,CAAOhB,EAAAiB,IAAP,CAAA,CAA2BX,CAAA,CAAmBS,CAAnB,CAC3BC,EAAA,CAAOhB,EAAAkB,IAAP,CAAA,CAA2BZ,CAAA,CAAmBS,CAAnB,CAC3BC,EAAA,CAAOhB,EAAAmB,GAAP,CAAA,CAA0Bb,CAAA,CAAmBS,CAAnB,CAC1BC,EAAA,CAAOhB,EAAA/lB,aAAP,CAAA,CAAoCqmB,CAAA,CAAmBU,CAAA,CAAOhB,EAAAkB,IAAP,CAAnB,CA8GpC,OAAO,CAAEE,QA3FTA,QAAgB,CAACrnC,CAAD,CAAO0mC,CAAP,CAAqB,CACnC,IAAIY,EAAeL,CAAArmD,eAAA,CAAsBof,CAAtB,CAAA,CAA8BinC,CAAA,CAAOjnC,CAAP,CAA9B,CAA6C,IAChE,IAAKsnC,CAAAA,CAAL,CACE,KAAM1B,GAAA,CAAW,UAAX,CAEF5lC,CAFE,CAEI0mC,CAFJ,CAAN,CAIF,GAAqB,IAArB,GAAIA,CAAJ,EAA6B5iD,CAAA,CAAY4iD,CAAZ,CAA7B,EAA2E,EAA3E,GAA0DA,CAA1D,CACE,MAAOA,EAIT,IAA4B,QAA5B,GAAI,MAAOA,EAAX,CACE,KAAMd,GAAA,CAAW,OAAX,CAEF5lC,CAFE,CAAN,CAIF,MAAO,KAAIsnC,CAAJ,CAAgBZ,CAAhB,CAjB4B,CA2F9B,CACEvY,WA1BTA,QAAmB,CAACnuB,CAAD,CAAOunC,CAAP,CAAqB,CACtC,GAAqB,IAArB,GAAIA,CAAJ,EAA6BzjD,CAAA,CAAYyjD,CAAZ,CAA7B,EAA2E,EAA3E,GAA0DA,CAA1D,CACE,MAAOA,EAET,KAAIrhD,EAAe+gD,CAAArmD,eAAA,CAAsBof,CAAtB,CAAA,CAA8BinC,CAAA,CAAOjnC,CAAP,CAA9B,CAA6C,IAChE,IAAI9Z,CAAJ,EAAmBqhD,CAAnB,WAA2CrhD,EAA3C,CACE,MAAOqhD,EAAAZ,qBAAA,EAKT,IAAI3mC,CAAJ,GAAaimC,EAAA/lB,aAAb,CAAwC,CA9IpCwQ,IAAAA,EAAY3D,EAAA,CA+ImBwa,CA/IR1jD,SAAA,EAAX,CAAZ6sC,CACAvvC,CADAuvC,CACGriB,CADHqiB,CACM8W,EAAU,CAAA,CAEfrmD;CAAA,CAAI,CAAT,KAAYktB,CAAZ,CAAgB63B,CAAAhmD,OAAhB,CAA6CiB,CAA7C,CAAiDktB,CAAjD,CAAoDltB,CAAA,EAApD,CACE,GAAImlD,CAAA,CAASJ,CAAA,CAAqB/kD,CAArB,CAAT,CAAkCuvC,CAAlC,CAAJ,CAAkD,CAChD8W,CAAA,CAAU,CAAA,CACV,MAFgD,CAKpD,GAAIA,CAAJ,CAEE,IAAKrmD,CAAO,CAAH,CAAG,CAAAktB,CAAA,CAAI83B,CAAAjmD,OAAhB,CAA6CiB,CAA7C,CAAiDktB,CAAjD,CAAoDltB,CAAA,EAApD,CACE,GAAImlD,CAAA,CAASH,CAAA,CAAqBhlD,CAArB,CAAT,CAAkCuvC,CAAlC,CAAJ,CAAkD,CAChD8W,CAAA,CAAU,CAAA,CACV,MAFgD,CAmIpD,GA7HKA,CA6HL,CACE,MAAOD,EAEP,MAAM3B,GAAA,CAAW,UAAX,CAEF2B,CAAA1jD,SAAA,EAFE,CAAN,CAJoC,CAQjC,GAAImc,CAAJ,GAAaimC,EAAAhmB,KAAb,CACL,MAAO8mB,EAAA,CAAcQ,CAAd,CAET,MAAM3B,GAAA,CAAW,QAAX,CAAN,CAtBsC,CAyBjC,CAEEtjD,QAvDTA,QAAgB,CAACilD,CAAD,CAAe,CAC7B,MAAIA,EAAJ,WAA4BP,EAA5B,CACSO,CAAAZ,qBAAA,EADT,CAGSY,CAJoB,CAqDxB,CAjLqC,CAAlC,CAxEkB,CAyhBhC5rC,QAASA,GAAY,EAAG,CACtB,IAAI8W,EAAU,CAAA,CAad,KAAAA,QAAA,CAAeg1B,QAAQ,CAACnmD,CAAD,CAAQ,CACzByB,SAAA7C,OAAJ,GACEuyB,CADF,CACY,CAAEnxB,CAAAA,CADd,CAGA,OAAOmxB,EAJsB,CAsD/B,KAAAlO,KAAA,CAAY,CAAC,QAAD,CAAW,cAAX,CAA2B,QAAQ,CACjCrJ,CADiC,CACvBU,CADuB,CACT,CAGpC,GAAI6W,CAAJ,EAAsB,CAAtB,CAAe7K,EAAf,CACE,KAAMg+B,GAAA,CAAW,UAAX,CAAN,CAMF,IAAI8B,EAAM9gD,EAAA,CAAYq/C,EAAZ,CAaVyB,EAAAC,UAAA,CAAgBC,QAAQ,EAAG,CACzB,MAAOn1B,EADkB,CAG3Bi1B,EAAAL,QAAA,CAAczrC,CAAAyrC,QACdK;CAAAvZ,WAAA,CAAiBvyB,CAAAuyB,WACjBuZ,EAAAplD,QAAA,CAAcsZ,CAAAtZ,QAETmwB,EAAL,GACEi1B,CAAAL,QACA,CADcK,CAAAvZ,WACd,CAD+B0Z,QAAQ,CAAC7nC,CAAD,CAAO1e,CAAP,CAAc,CAAE,MAAOA,EAAT,CACrD,CAAAomD,CAAAplD,QAAA,CAAcmB,EAFhB,CAwBAikD,EAAAI,QAAA,CAAcC,QAAmB,CAAC/nC,CAAD,CAAO63B,CAAP,CAAa,CAC5C,IAAIx4B,EAASnE,CAAA,CAAO28B,CAAP,CACb,OAAIx4B,EAAAoiB,QAAJ,EAAsBpiB,CAAAzN,SAAtB,CACSyN,CADT,CAGSnE,CAAA,CAAO28B,CAAP,CAAa,QAAQ,CAACv2C,CAAD,CAAQ,CAClC,MAAOomD,EAAAvZ,WAAA,CAAenuB,CAAf,CAAqB1e,CAArB,CAD2B,CAA7B,CALmC,CAtDV,KAoThCiH,EAAQm/C,CAAAI,QApTwB,CAqThC3Z,EAAauZ,CAAAvZ,WArTmB,CAsThCkZ,EAAUK,CAAAL,QAEd9mD,EAAA,CAAQ0lD,EAAR,CAAsB,QAAQ,CAAC+B,CAAD,CAAYx8C,CAAZ,CAAkB,CAC9C,IAAIy8C,EAAQhjD,CAAA,CAAUuG,CAAV,CACZk8C,EAAA,CAAIxqC,EAAA,CAAU,WAAV,CAAwB+qC,CAAxB,CAAJ,CAAA,CAAsC,QAAQ,CAACpQ,CAAD,CAAO,CACnD,MAAOtvC,EAAA,CAAMy/C,CAAN,CAAiBnQ,CAAjB,CAD4C,CAGrD6P,EAAA,CAAIxqC,EAAA,CAAU,cAAV,CAA2B+qC,CAA3B,CAAJ,CAAA,CAAyC,QAAQ,CAAC3mD,CAAD,CAAQ,CACvD,MAAO6sC,EAAA,CAAW6Z,CAAX,CAAsB1mD,CAAtB,CADgD,CAGzDomD,EAAA,CAAIxqC,EAAA,CAAU,WAAV,CAAwB+qC,CAAxB,CAAJ,CAAA,CAAsC,QAAQ,CAAC3mD,CAAD,CAAQ,CACpD,MAAO+lD,EAAA,CAAQW,CAAR,CAAmB1mD,CAAnB,CAD6C,CARR,CAAhD,CAaA,OAAOomD,EArU6B,CAD1B,CApEU,CA4ZxB3rC,QAASA,GAAgB,EAAG,CAC1B,IAAAwI,KAAA,CAAY,CAAC,SAAD,CAAY,WAAZ;AAAyB,QAAQ,CAAC/H,CAAD,CAAUhD,CAAV,CAAqB,CAAA,IAC5D0uC,EAAe,EAD6C,CAE5DC,EACEllD,EAAA,CAAM,CAAC,eAAAkb,KAAA,CAAqBlZ,CAAA,CAAUmjD,CAAC5rC,CAAA6rC,UAADD,EAAsB,EAAtBA,WAAV,CAArB,CAAD,EAAyE,EAAzE,EAA6E,CAA7E,CAAN,CAH0D,CAI5DE,EAAQ,QAAA/jD,KAAA,CAAc6jD,CAAC5rC,CAAA6rC,UAADD,EAAsB,EAAtBA,WAAd,CAJoD,CAK5D3oD,EAAW+Z,CAAA,CAAU,CAAV,CAAX/Z,EAA2B,EALiC,CAM5D8oD,CAN4D,CAO5DC,EAAc,2BAP8C,CAQ5DC,EAAYhpD,CAAAysC,KAAZuc,EAA6BhpD,CAAAysC,KAAAz4B,MAR+B,CAS5Di1C,EAAc,CAAA,CAT8C,CAU5DC,EAAa,CAAA,CAGjB,IAAIF,CAAJ,CAAe,CACb,IAAShkD,IAAAA,CAAT,GAAiBgkD,EAAjB,CACE,GAAI/hD,CAAJ,CAAY8hD,CAAArqC,KAAA,CAAiB1Z,CAAjB,CAAZ,CAAoC,CAClC8jD,CAAA,CAAe7hD,CAAA,CAAM,CAAN,CACf6hD,EAAA,CAAeA,CAAA17B,OAAA,CAAoB,CAApB,CAAuB,CAAvB,CAAAvP,YAAA,EAAf,CAAyDirC,CAAA17B,OAAA,CAAoB,CAApB,CACzD,MAHkC,CAOjC07B,CAAL,GACEA,CADF,CACkB,eADlB,EACqCE,EADrC,EACmD,QADnD,CAIAC,EAAA,CAAc,CAAG,EAAC,YAAD,EAAiBD,EAAjB,EAAgCF,CAAhC,CAA+C,YAA/C,EAA+DE,EAA/D,CACjBE,EAAA,CAAc,CAAG,EAAC,WAAD,EAAgBF,EAAhB,EAA+BF,CAA/B,CAA8C,WAA9C,EAA6DE,EAA7D,CAEbN,EAAAA,CAAJ,EAAiBO,CAAjB,EAAkCC,CAAlC,GACED,CACA,CADc1oD,CAAA,CAASyoD,CAAAG,iBAAT,CACd,CAAAD,CAAA,CAAa3oD,CAAA,CAASyoD,CAAAI,gBAAT,CAFf,CAhBa,CAuBf,MAAO,CAULx9B,QAAS,EAAGA,CAAA7O,CAAA6O,QAAH;AAAsBy9B,CAAAtsC,CAAA6O,QAAAy9B,UAAtB,EAA+D,CAA/D,CAAqDX,CAArD,EAAsEG,CAAtE,CAVJ,CAYLS,SAAUA,QAAQ,CAAC9lC,CAAD,CAAQ,CAMxB,GAAc,OAAd,GAAIA,CAAJ,EAAiC,EAAjC,EAAyB2E,EAAzB,CAAqC,MAAO,CAAA,CAE5C,IAAI9jB,CAAA,CAAYokD,CAAA,CAAajlC,CAAb,CAAZ,CAAJ,CAAsC,CACpC,IAAI+lC,EAASvpD,CAAAwe,cAAA,CAAuB,KAAvB,CACbiqC,EAAA,CAAajlC,CAAb,CAAA,CAAsB,IAAtB,CAA6BA,CAA7B,GAAsC+lC,EAFF,CAKtC,MAAOd,EAAA,CAAajlC,CAAb,CAbiB,CAZrB,CA2BLzQ,IAAKA,EAAA,EA3BA,CA4BL+1C,aAAcA,CA5BT,CA6BLG,YAAaA,CA7BR,CA8BLC,WAAYA,CA9BP,CA+BLR,QAASA,CA/BJ,CApCyD,CAAtD,CADc,CAoF5BhsC,QAASA,GAAwB,EAAG,CAElC,IAAI8sC,CAeJ,KAAAA,YAAA,CAAmBC,QAAQ,CAAClhD,CAAD,CAAM,CAC/B,MAAIA,EAAJ,EACEihD,CACO,CADOjhD,CACP,CAAA,IAFT,EAIOihD,CALwB,CA8BjC,KAAA1kC,KAAA,CAAY,CAAC,gBAAD,CAAmB,OAAnB,CAA4B,IAA5B,CAAkC,MAAlC,CAA0C,QAAQ,CAACvI,CAAD,CAAiB5B,CAAjB,CAAwBkB,CAAxB,CAA4BI,CAA5B,CAAkC,CAE9FytC,QAASA,EAAe,CAACC,CAAD,CAAMC,CAAN,CAA0B,CAChDF,CAAAG,qBAAA,EAOKtpD,EAAA,CAASopD,CAAT,CAAL,EAAuBptC,CAAAvO,IAAA,CAAmB27C,CAAnB,CAAvB,GACEA,CADF,CACQ1tC,CAAA6tC,sBAAA,CAA2BH,CAA3B,CADR,CAIA,KAAIniB,EAAoB7sB,CAAA4sB,SAApBC,EAAsC7sB,CAAA4sB,SAAAC,kBAEtClnC,EAAA,CAAQknC,CAAR,CAAJ,CACEA,CADF,CACsBA,CAAAl1B,OAAA,CAAyB,QAAQ,CAACy3C,CAAD,CAAc,CACjE,MAAOA,EAAP;AAAuBzjB,EAD0C,CAA/C,CADtB,CAIWkB,CAJX,GAIiClB,EAJjC,GAKEkB,CALF,CAKsB,IALtB,CAQA,OAAO7sB,EAAA3M,IAAA,CAAU27C,CAAV,CAAevmD,CAAA,CAAO,CACzBokB,MAAOjL,CADkB,CAEzBirB,kBAAmBA,CAFM,CAAP,CAGjBgiB,CAHiB,CAAf,CAAA,CAIJ,SAJI,CAAA,CAIO,QAAQ,EAAG,CACrBE,CAAAG,qBAAA,EADqB,CAJlB,CAAAhrB,KAAA,CAOC,QAAQ,CAAC4J,CAAD,CAAW,CACvBlsB,CAAAmJ,IAAA,CAAmBikC,CAAnB,CAAwBlhB,CAAAt7B,KAAxB,CACA,OAAOs7B,EAAAt7B,KAFgB,CAPpB,CAYP68C,QAAoB,CAACthB,CAAD,CAAO,CACzB,GAAKkhB,CAAAA,CAAL,CACE,KAAMp5B,GAAA,CAAe,QAAf,CACJm5B,CADI,CACCjhB,CAAArB,OADD,CACcqB,CAAAiC,WADd,CAAN,CAGF,MAAO9uB,EAAA8sB,OAAA,CAAUD,CAAV,CALkB,CAZpB,CAtByC,CA2ClDghB,CAAAG,qBAAA,CAAuC,CAEvC,OAAOH,EA/CuF,CAApF,CA/CsB,CAkGpC9sC,QAASA,GAAqB,EAAG,CAC/B,IAAAkI,KAAA,CAAY,CAAC,YAAD,CAAe,UAAf,CAA2B,WAA3B,CACP,QAAQ,CAACnJ,CAAD,CAAelC,CAAf,CAA2B4B,CAA3B,CAAsC,CA6GjD,MApGkB4uC,CAcN,aAAeC,QAAQ,CAAC3kD,CAAD,CAAU+/B,CAAV,CAAsB6kB,CAAtB,CAAsC,CACnE95B,CAAAA,CAAW9qB,CAAA6kD,uBAAA,CAA+B,YAA/B,CACf,KAAIC,EAAU,EACdvpD,EAAA,CAAQuvB,CAAR,CAAkB,QAAQ,CAAC+T,CAAD,CAAU,CAClC,IAAIkmB,EAAch9C,EAAA/H,QAAA,CAAgB6+B,CAAhB,CAAAj3B,KAAA,CAA8B,UAA9B,CACdm9C;CAAJ,EACExpD,CAAA,CAAQwpD,CAAR,CAAqB,QAAQ,CAACC,CAAD,CAAc,CACrCJ,CAAJ,CAEMrlD,CADUohD,IAAInjD,MAAJmjD,CAAW,SAAXA,CAAuBE,EAAA,CAAgB9gB,CAAhB,CAAvB4gB,CAAqD,aAArDA,CACVphD,MAAA,CAAaylD,CAAb,CAFN,EAGIF,CAAAnkD,KAAA,CAAak+B,CAAb,CAHJ,CAM0C,EAN1C,EAMMmmB,CAAA3kD,QAAA,CAAoB0/B,CAApB,CANN,EAOI+kB,CAAAnkD,KAAA,CAAak+B,CAAb,CARqC,CAA3C,CAHgC,CAApC,CAiBA,OAAOimB,EApBgE,CAdvDJ,CAiDN,WAAaO,QAAQ,CAACjlD,CAAD,CAAU+/B,CAAV,CAAsB6kB,CAAtB,CAAsC,CAErE,IADA,IAAIM,EAAW,CAAC,KAAD,CAAQ,UAAR,CAAoB,OAApB,CAAf,CACS37B,EAAI,CAAb,CAAgBA,CAAhB,CAAoB27B,CAAAhqD,OAApB,CAAqC,EAAEquB,CAAvC,CAA0C,CAGxC,IAAI5M,EAAW3c,CAAA4a,iBAAA,CADA,GACA,CADMsqC,CAAA,CAAS37B,CAAT,CACN,CADoB,OACpB,EAFOq7B,CAAAO,CAAiB,GAAjBA,CAAuB,IAE9B,EADgD,GAChD,CADsDplB,CACtD,CADmE,IACnE,CACf,IAAIpjB,CAAAzhB,OAAJ,CACE,MAAOyhB,EAL+B,CAF2B,CAjDrD+nC,CAoEN,YAAcU,QAAQ,EAAG,CACnC,MAAOtvC,EAAA4Q,IAAA,EAD4B,CApEnBg+B,CAiFN,YAAcW,QAAQ,CAAC3+B,CAAD,CAAM,CAClCA,CAAJ,GAAY5Q,CAAA4Q,IAAA,EAAZ,GACE5Q,CAAA4Q,IAAA,CAAcA,CAAd,CACA,CAAAtQ,CAAAi6B,QAAA,EAFF,CADsC,CAjFtBqU,CAgGN,WAAaY,QAAQ,CAACh+B,CAAD,CAAW,CAC1CpT,CAAAkT,gCAAA,CAAyCE,CAAzC,CAD0C,CAhG1Bo9B,CAT+B,CADvC,CADmB,CAmHjCntC,QAASA,GAAgB,EAAG,CAC1B,IAAAgI,KAAA,CAAY,CAAC,YAAD;AAAe,UAAf,CAA2B,IAA3B,CAAiC,KAAjC,CAAwC,mBAAxC,CACP,QAAQ,CAACnJ,CAAD,CAAelC,CAAf,CAA2BoC,CAA3B,CAAiCE,CAAjC,CAAwC9B,CAAxC,CAA2D,CAkCtEyxB,QAASA,EAAO,CAACxjC,CAAD,CAAK+lB,CAAL,CAAYgiB,CAAZ,CAAyB,CAClC/uC,CAAA,CAAWgH,CAAX,CAAL,GACE+nC,CAEA,CAFchiB,CAEd,CADAA,CACA,CADQ/lB,CACR,CAAAA,CAAA,CAAKnE,CAHP,CADuC,KAOnCkiB,EAjpiBD5iB,EAAAjC,KAAA,CAipiBkBkC,SAjpiBlB,CAipiB6B8E,CAjpiB7B,CA0oiBoC,CAQnCkoC,EAAahsC,CAAA,CAAU2rC,CAAV,CAAbK,EAAuC,CAACL,CARL,CASnCjF,EAAWjd,CAACuiB,CAAA,CAAYv0B,CAAZ,CAAkBF,CAAnBkS,OAAA,EATwB,CAUnC6b,EAAUoB,CAAApB,QAVyB,CAWnC1b,CAEJA,EAAA,CAAYzU,CAAAsU,MAAA,CAAe,QAAQ,EAAG,CACpC,GAAI,CACFid,CAAAC,QAAA,CAAiB/iC,CAAAG,MAAA,CAAS,IAAT,CAAe4d,CAAf,CAAjB,CADE,CAEF,MAAOhc,CAAP,CAAU,CACV+gC,CAAArC,OAAA,CAAgB1+B,CAAhB,CACA,CAAAgQ,CAAA,CAAkBhQ,CAAlB,CAFU,CAFZ,OAMQ,CACN,OAAO6gD,CAAA,CAAUlhB,CAAAmhB,YAAV,CADD,CAIHza,CAAL,EAAgB30B,CAAAzO,OAAA,EAXoB,CAA1B,CAYT+gB,CAZS,CAcZ2b,EAAAmhB,YAAA,CAAsB78B,CACtB48B,EAAA,CAAU58B,CAAV,CAAA,CAAuB8c,CAEvB,OAAOpB,EA9BgC,CAhCzC,IAAIkhB,EAAY,EA8EhBpf,EAAAvd,OAAA,CAAiB68B,QAAQ,CAACphB,CAAD,CAAU,CACjC,MAAIA,EAAJ,EAAeA,CAAAmhB,YAAf,GAAsCD,EAAtC,EACEA,CAAA,CAAUlhB,CAAAmhB,YAAV,CAAApiB,OAAA,CAAsC,UAAtC,CAEO,CADP,OAAOmiB,CAAA,CAAUlhB,CAAAmhB,YAAV,CACA,CAAAtxC,CAAAsU,MAAAI,OAAA,CAAsByb,CAAAmhB,YAAtB,CAHT,EAKO,CAAA,CAN0B,CASnC,OAAOrf,EAzF+D,CAD5D,CADc,CAuJ5B4B,QAASA,GAAU,CAACrhB,CAAD,CAAM,CAGnB9D,EAAJ;CAGE8iC,CAAAppC,aAAA,CAA4B,MAA5B,CAAoCiL,CAApC,CACA,CAAAA,CAAA,CAAOm+B,CAAAn+B,KAJT,CAOAm+B,EAAAppC,aAAA,CAA4B,MAA5B,CAAoCiL,CAApC,CAGA,OAAO,CACLA,KAAMm+B,CAAAn+B,KADD,CAELygB,SAAU0d,CAAA1d,SAAA,CAA0B0d,CAAA1d,SAAArkC,QAAA,CAAgC,IAAhC,CAAsC,EAAtC,CAA1B,CAAsE,EAF3E,CAGLsZ,KAAMyoC,CAAAzoC,KAHD,CAILsvB,OAAQmZ,CAAAnZ,OAAA,CAAwBmZ,CAAAnZ,OAAA5oC,QAAA,CAA8B,KAA9B,CAAqC,EAArC,CAAxB,CAAmE,EAJtE,CAKLkhB,KAAM6gC,CAAA7gC,KAAA,CAAsB6gC,CAAA7gC,KAAAlhB,QAAA,CAA4B,IAA5B,CAAkC,EAAlC,CAAtB,CAA8D,EAL/D,CAMLkoC,SAAU6Z,CAAA7Z,SANL,CAOLE,KAAM2Z,CAAA3Z,KAPD,CAQLM,SAAiD,GAAvC,GAACqZ,CAAArZ,SAAAxqC,OAAA,CAA+B,CAA/B,CAAD,CACN6jD,CAAArZ,SADM,CAEN,GAFM,CAEAqZ,CAAArZ,SAVL,CAbgB,CAkCzBnG,QAASA,GAAe,CAACyf,CAAD,CAAa,CAC/BtrC,CAAAA,CAAUrf,CAAA,CAAS2qD,CAAT,CAAD,CAAyB5d,EAAA,CAAW4d,CAAX,CAAzB,CAAkDA,CAC/D,OAAQtrC,EAAA2tB,SAAR,GAA4B4d,EAAA5d,SAA5B,EACQ3tB,CAAA4C,KADR,GACwB2oC,EAAA3oC,KAHW,CA+CrCxF,QAASA,GAAe,EAAG,CACzB,IAAA8H,KAAA,CAAY5gB,EAAA,CAAQnE,CAAR,CADa,CAa3BqrD,QAASA,GAAc,CAACrxC,CAAD,CAAY,CAKjCsxC,QAASA,EAAsB,CAAC5nD,CAAD,CAAM,CACnC,GAAI,CACF,MAAO+G,mBAAA,CAAmB/G,CAAnB,CADL,CAEF,MAAOwG,CAAP,CAAU,CACV,MAAOxG,EADG,CAHuB,CALJ;AACjC,IAAI4oC,EAActyB,CAAA,CAAU,CAAV,CAAdsyB,EAA8B,EAAlC,CACIif,EAAc,EADlB,CAEIC,EAAmB,EAUvB,OAAO,SAAQ,EAAG,CAAA,IACZC,CADY,CACCC,CADD,CACS/pD,CADT,CACYiE,CADZ,CACmBoG,CAC/B2/C,EAAAA,CAAsBrf,CAAAof,OAAtBC,EAA4C,EAEhD,IAAIA,CAAJ,GAA4BH,CAA5B,CAKE,IAJAA,CAIK,CAJcG,CAId,CAHLF,CAGK,CAHSD,CAAAlmD,MAAA,CAAuB,IAAvB,CAGT,CAFLimD,CAEK,CAFS,EAET,CAAA5pD,CAAA,CAAI,CAAT,CAAYA,CAAZ,CAAgB8pD,CAAA/qD,OAAhB,CAAoCiB,CAAA,EAApC,CACE+pD,CAEA,CAFSD,CAAA,CAAY9pD,CAAZ,CAET,CADAiE,CACA,CADQ8lD,CAAA7lD,QAAA,CAAe,GAAf,CACR,CAAY,CAAZ,CAAID,CAAJ,GACEoG,CAIA,CAJOs/C,CAAA,CAAuBI,CAAA7gD,UAAA,CAAiB,CAAjB,CAAoBjF,CAApB,CAAvB,CAIP,CAAItB,CAAA,CAAYinD,CAAA,CAAYv/C,CAAZ,CAAZ,CAAJ,GACEu/C,CAAA,CAAYv/C,CAAZ,CADF,CACsBs/C,CAAA,CAAuBI,CAAA7gD,UAAA,CAAiBjF,CAAjB,CAAyB,CAAzB,CAAvB,CADtB,CALF,CAWJ,OAAO2lD,EAvBS,CAbe,CA0CnC9tC,QAASA,GAAsB,EAAG,CAChC,IAAAsH,KAAA,CAAYsmC,EADoB,CAwGlChxC,QAASA,GAAe,CAAC1N,CAAD,CAAW,CAmBjCu4B,QAASA,EAAQ,CAACl5B,CAAD,CAAO8E,CAAP,CAAgB,CAC/B,GAAItO,CAAA,CAASwJ,CAAT,CAAJ,CAAoB,CAClB,IAAI4/C,EAAU,EACd7qD,EAAA,CAAQiL,CAAR,CAAc,QAAQ,CAACuG,CAAD,CAASrR,CAAT,CAAc,CAClC0qD,CAAA,CAAQ1qD,CAAR,CAAA,CAAegkC,CAAA,CAAShkC,CAAT,CAAcqR,CAAd,CADmB,CAApC,CAGA,OAAOq5C,EALW,CAOlB,MAAOj/C,EAAAmE,QAAA,CAAiB9E,CAAjB,CA1BE6/C,QA0BF,CAAgC/6C,CAAhC,CARsB,CAWjC,IAAAo0B,SAAA,CAAgBA,CAEhB,KAAAngB,KAAA,CAAY,CAAC,WAAD,CAAc,QAAQ,CAAC4D,CAAD,CAAY,CAC5C,MAAO,SAAQ,CAAC3c,CAAD,CAAO,CACpB,MAAO2c,EAAA1a,IAAA,CAAcjC,CAAd,CAjCE6/C,QAiCF,CADa,CADsB,CAAlC,CAoBZ3mB,EAAA,CAAS,UAAT,CAAqB4mB,EAArB,CACA5mB,EAAA,CAAS,MAAT,CAAiB6mB,EAAjB,CACA7mB;CAAA,CAAS,QAAT,CAAmB8mB,EAAnB,CACA9mB,EAAA,CAAS,MAAT,CAAiB+mB,EAAjB,CACA/mB,EAAA,CAAS,SAAT,CAAoBgnB,EAApB,CACAhnB,EAAA,CAAS,WAAT,CAAsBinB,EAAtB,CACAjnB,EAAA,CAAS,QAAT,CAAmBknB,EAAnB,CACAlnB,EAAA,CAAS,SAAT,CAAoBmnB,EAApB,CACAnnB,EAAA,CAAS,WAAT,CAAsBonB,EAAtB,CA5DiC,CA8LnCN,QAASA,GAAY,EAAG,CACtB,MAAO,SAAQ,CAACrmD,CAAD,CAAQ4/B,CAAR,CAAoBgnB,CAApB,CAAgC,CAC7C,GAAK,CAAAnsD,EAAA,CAAYuF,CAAZ,CAAL,CAAyB,CACvB,GAAa,IAAb,EAAIA,CAAJ,CACE,MAAOA,EAEP,MAAMxF,EAAA,CAAO,QAAP,CAAA,CAAiB,UAAjB,CAAiEwF,CAAjE,CAAN,CAJqB,CAUzB,IAAI6mD,CAEJ,QAJqBC,EAAAC,CAAiBnnB,CAAjBmnB,CAIrB,EACE,KAAK,UAAL,CAEE,KACF,MAAK,SAAL,CACA,KAAK,MAAL,CACA,KAAK,QAAL,CACA,KAAK,QAAL,CACEF,CAAA,CAAsB,CAAA,CAExB,MAAK,QAAL,CAEEG,CAAA,CAAcC,EAAA,CAAkBrnB,CAAlB,CAA8BgnB,CAA9B,CAA0CC,CAA1C,CACd,MACF,SACE,MAAO7mD,EAfX,CAkBA,MAAO9E,MAAAynB,UAAA/V,OAAAlR,KAAA,CAA4BsE,CAA5B,CAAmCgnD,CAAnC,CA/BsC,CADzB,CAqCxBC,QAASA,GAAiB,CAACrnB,CAAD,CAAagnB,CAAb,CAAyBC,CAAzB,CAA8C,CACtE,IAAIK,EAAwBrqD,CAAA,CAAS+iC,CAAT,CAAxBsnB,EAAiD,GAAjDA,EAAwDtnB,EAGzC,EAAA,CAAnB,GAAIgnB,CAAJ,CACEA,CADF,CACejlD,EADf,CAEYnG,CAAA,CAAWorD,CAAX,CAFZ,GAGEA,CAHF,CAGeA,QAAQ,CAACO,CAAD,CAASC,CAAT,CAAmB,CACtC,GAAIzoD,CAAA,CAAYwoD,CAAZ,CAAJ,CAEE,MAAO,CAAA,CAET,IAAgB,IAAhB;AAAKA,CAAL,EAAuC,IAAvC,GAA0BC,CAA1B,CAEE,MAAOD,EAAP,GAAkBC,CAEpB,IAAIvqD,CAAA,CAASuqD,CAAT,CAAJ,EAA2BvqD,CAAA,CAASsqD,CAAT,CAA3B,EAAgD,CAAA1oD,EAAA,CAAkB0oD,CAAlB,CAAhD,CAEE,MAAO,CAAA,CAGTA,EAAA,CAASrnD,CAAA,CAAU,EAAV,CAAeqnD,CAAf,CACTC,EAAA,CAAWtnD,CAAA,CAAU,EAAV,CAAesnD,CAAf,CACX,OAAqC,EAArC,GAAOD,CAAAjnD,QAAA,CAAeknD,CAAf,CAhB+B,CAH1C,CA8BA,OAPcJ,SAAQ,CAAC7rD,CAAD,CAAO,CAC3B,MAAI+rD,EAAJ,EAA8B,CAAArqD,CAAA,CAAS1B,CAAT,CAA9B,CACSksD,EAAA,CAAYlsD,CAAZ,CAAkBykC,CAAArhC,EAAlB,CAAgCqoD,CAAhC,CAA4C,CAAA,CAA5C,CADT,CAGOS,EAAA,CAAYlsD,CAAZ,CAAkBykC,CAAlB,CAA8BgnB,CAA9B,CAA0CC,CAA1C,CAJoB,CA3ByC,CAqCxEQ,QAASA,GAAW,CAACF,CAAD,CAASC,CAAT,CAAmBR,CAAnB,CAA+BC,CAA/B,CAAoDS,CAApD,CAA0E,CAC5F,IAAIC,EAAaT,EAAA,CAAiBK,CAAjB,CAAjB,CACIK,EAAeV,EAAA,CAAiBM,CAAjB,CAEnB,IAAsB,QAAtB,GAAKI,CAAL,EAA2D,GAA3D,GAAoCJ,CAAA1lD,OAAA,CAAgB,CAAhB,CAApC,CACE,MAAO,CAAC2lD,EAAA,CAAYF,CAAZ,CAAoBC,CAAAliD,UAAA,CAAmB,CAAnB,CAApB,CAA2C0hD,CAA3C,CAAuDC,CAAvD,CACH,IAAIjsD,CAAA,CAAQusD,CAAR,CAAJ,CAGL,MAAOA,EAAArjC,KAAA,CAAY,QAAQ,CAAC3oB,CAAD,CAAO,CAChC,MAAOksD,GAAA,CAAYlsD,CAAZ,CAAkBisD,CAAlB,CAA4BR,CAA5B,CAAwCC,CAAxC,CADyB,CAA3B,CAKT,QAAQU,CAAR,EACE,KAAK,QAAL,CACE,IAAIhsD,CACJ,IAAIsrD,CAAJ,CAAyB,CACvB,IAAKtrD,CAAL,GAAY4rD,EAAZ,CACE,GAAuB,GAAvB,GAAK5rD,CAAAmG,OAAA,CAAW,CAAX,CAAL,EAA+B2lD,EAAA,CAAYF,CAAA,CAAO5rD,CAAP,CAAZ,CAAyB6rD,CAAzB,CAAmCR,CAAnC,CAA+C,CAAA,CAA/C,CAA/B,CACE,MAAO,CAAA,CAGX,OAAOU,EAAA,CAAuB,CAAA,CAAvB,CAA+BD,EAAA,CAAYF,CAAZ,CAAoBC,CAApB,CAA8BR,CAA9B,CAA0C,CAAA,CAA1C,CANf,CAOlB,GAAqB,QAArB,GAAIY,CAAJ,CAA+B,CACpC,IAAKjsD,CAAL,GAAY6rD,EAAZ,CAEE,GADIK,CACA,CADcL,CAAA,CAAS7rD,CAAT,CACd,CAAA,CAAAC,CAAA,CAAWisD,CAAX,CAAA,EAA2B,CAAA9oD,CAAA,CAAY8oD,CAAZ,CAA3B;CAIAC,CAEC,CAF0B,GAE1B,GAFkBnsD,CAElB,CAAA,CAAA8rD,EAAA,CADWK,CAAAC,CAAmBR,CAAnBQ,CAA4BR,CAAA,CAAO5rD,CAAP,CACvC,CAAuBksD,CAAvB,CAAoCb,CAApC,CAAgDc,CAAhD,CAAkEA,CAAlE,CAND,CAAJ,CAOE,MAAO,CAAA,CAGX,OAAO,CAAA,CAb6B,CAepC,MAAOd,EAAA,CAAWO,CAAX,CAAmBC,CAAnB,CAGX,MAAK,UAAL,CACE,MAAO,CAAA,CACT,SACE,MAAOR,EAAA,CAAWO,CAAX,CAAmBC,CAAnB,CA/BX,CAd4F,CAkD9FN,QAASA,GAAgB,CAACjkD,CAAD,CAAM,CAC7B,MAAgB,KAAT,GAACA,CAAD,CAAiB,MAAjB,CAA0B,MAAOA,EADX,CA6D/BsjD,QAASA,GAAc,CAACyB,CAAD,CAAU,CAC/B,IAAIC,EAAUD,CAAAE,eACd,OAAO,SAAQ,CAACC,CAAD,CAASC,CAAT,CAAyBC,CAAzB,CAAuC,CAChDtpD,CAAA,CAAYqpD,CAAZ,CAAJ,GACEA,CADF,CACmBH,CAAAK,aADnB,CAIIvpD,EAAA,CAAYspD,CAAZ,CAAJ,GACEA,CADF,CACiBJ,CAAAM,SAAA,CAAiB,CAAjB,CAAAC,QADjB,CAKA,OAAkB,KAAX,EAACL,CAAD,CACDA,CADC,CAEDM,EAAA,CAAaN,CAAb,CAAqBF,CAAAM,SAAA,CAAiB,CAAjB,CAArB,CAA0CN,CAAAS,UAA1C,CAA6DT,CAAAU,YAA7D,CAAkFN,CAAlF,CAAAzkD,QAAA,CACU,SADV,CACqBwkD,CADrB,CAZ8C,CAFvB,CAwEjCvB,QAASA,GAAY,CAACmB,CAAD,CAAU,CAC7B,IAAIC,EAAUD,CAAAE,eACd,OAAO,SAAQ,CAACU,CAAD,CAASP,CAAT,CAAuB,CAGpC,MAAkB,KAAX,EAACO,CAAD,CACDA,CADC,CAEDH,EAAA,CAAaG,CAAb,CAAqBX,CAAAM,SAAA,CAAiB,CAAjB,CAArB,CAA0CN,CAAAS,UAA1C,CAA6DT,CAAAU,YAA7D,CACaN,CADb,CAL8B,CAFT,CAyB/B7kD,QAASA,GAAK,CAACqlD,CAAD,CAAS,CAAA,IACjBC;AAAW,CADM,CACHC,CADG,CACKC,CADL,CAEjB5sD,CAFiB,CAEdc,CAFc,CAEX+rD,CAGmD,GAA7D,EAAKD,CAAL,CAA6BH,CAAAvoD,QAAA,CAAeqoD,EAAf,CAA7B,IACEE,CADF,CACWA,CAAAjlD,QAAA,CAAe+kD,EAAf,CAA4B,EAA5B,CADX,CAKgC,EAAhC,EAAKvsD,CAAL,CAASysD,CAAArc,OAAA,CAAc,IAAd,CAAT,GAE8B,CAE5B,CAFIwc,CAEJ,GAF+BA,CAE/B,CAFuD5sD,CAEvD,EADA4sD,CACA,EADyB,CAACH,CAAA9qD,MAAA,CAAa3B,CAAb,CAAiB,CAAjB,CAC1B,CAAAysD,CAAA,CAASA,CAAAvjD,UAAA,CAAiB,CAAjB,CAAoBlJ,CAApB,CAJX,EAKmC,CALnC,CAKW4sD,CALX,GAOEA,CAPF,CAO0BH,CAAA1tD,OAP1B,CAWA,KAAKiB,CAAL,CAAS,CAAT,CAAYysD,CAAA/mD,OAAA,CAAc1F,CAAd,CAAZ,EAAgC8sD,EAAhC,CAA2C9sD,CAAA,EAA3C,EAEA,GAAIA,CAAJ,GAAU6sD,CAAV,CAAkBJ,CAAA1tD,OAAlB,EAEE4tD,CACA,CADS,CAAC,CAAD,CACT,CAAAC,CAAA,CAAwB,CAH1B,KAIO,CAGL,IADAC,CAAA,EACA,CAAOJ,CAAA/mD,OAAA,CAAcmnD,CAAd,CAAP,EAA+BC,EAA/B,CAAA,CAA0CD,CAAA,EAG1CD,EAAA,EAAyB5sD,CACzB2sD,EAAA,CAAS,EAET,KAAK7rD,CAAL,CAAS,CAAT,CAAYd,CAAZ,EAAiB6sD,CAAjB,CAAwB7sD,CAAA,EAAA,CAAKc,CAAA,EAA7B,CACE6rD,CAAA,CAAO7rD,CAAP,CAAA,CAAY,CAAC2rD,CAAA/mD,OAAA,CAAc1F,CAAd,CAVV,CAeH4sD,CAAJ,CAA4BG,EAA5B,GACEJ,CAEA,CAFSA,CAAAxoD,OAAA,CAAc,CAAd,CAAiB4oD,EAAjB,CAA8B,CAA9B,CAET,CADAL,CACA,CADWE,CACX,CADmC,CACnC,CAAAA,CAAA,CAAwB,CAH1B,CAMA,OAAO,CAAE5mB,EAAG2mB,CAAL,CAAapkD,EAAGmkD,CAAhB,CAA0B1sD,EAAG4sD,CAA7B,CAhDc,CAuDvBI,QAASA,GAAW,CAACC,CAAD,CAAehB,CAAf,CAA6BiB,CAA7B,CAAsCd,CAAtC,CAA+C,CAC/D,IAAIO,EAASM,CAAAjnB,EAAb,CACImnB,EAAcR,CAAA5tD,OAAdouD,CAA8BF,CAAAjtD,EAGlCisD,EAAA,CAAgBtpD,CAAA,CAAYspD,CAAZ,CAAD,CAA8B9vB,IAAAixB,IAAA,CAASjxB,IAAAC,IAAA,CAAS8wB,CAAT,CAAkBC,CAAlB,CAAT,CAAyCf,CAAzC,CAA9B,CAAkF,CAACH,CAG9FoB,EAAAA,CAAUpB,CAAVoB,CAAyBJ,CAAAjtD,EACzBstD,EAAAA,CAAQX,CAAA,CAAOU,CAAP,CAEZ,IAAc,CAAd,CAAIA,CAAJ,CACEV,CAAAxoD,OAAA,CAAckpD,CAAd,CADF,KAEO,CAELJ,CAAAjtD,EAAA,CAAiB,CACjB2sD,EAAA5tD,OAAA,CAAgBsuD,CAAhB,CAA0BpB,CAA1B,CAAyC,CACzC,KAAS,IAAAjsD,EAAE,CAAX,CAAcA,CAAd,CAAkBqtD,CAAlB,CAA2BrtD,CAAA,EAA3B,CAAgC2sD,CAAA,CAAO3sD,CAAP,CAAA;AAAY,CAJvC,CAUP,IAHa,CAGb,EAHIstD,CAGJ,EAHgBX,CAAA,CAAOU,CAAP,CAAiB,CAAjB,CAAA,EAGhB,CAAOF,CAAP,CAAqBlB,CAArB,CAAmCkB,CAAA,EAAnC,CAAkDR,CAAAnoD,KAAA,CAAY,CAAZ,CASlD,IALI+oD,CAKJ,CALYZ,CAAAa,YAAA,CAAmB,QAAQ,CAACD,CAAD,CAAQvnB,CAAR,CAAWhmC,CAAX,CAAc2sD,CAAd,CAAsB,CAC3D3mB,CAAA,EAAQunB,CACRZ,EAAA,CAAO3sD,CAAP,CAAA,CAAYgmC,CAAZ,CAAgB,EAChB,OAAO7J,KAAAgG,MAAA,CAAW6D,CAAX,CAAe,EAAf,CAHoD,CAAjD,CAIT,CAJS,CAKZ,CACE2mB,CAAA5hD,QAAA,CAAewiD,CAAf,CACA,CAAAN,CAAAjtD,EAAA,EAlC6D,CAwDnEqsD,QAASA,GAAY,CAACG,CAAD,CAAS12C,CAAT,CAAkB23C,CAAlB,CAA4BC,CAA5B,CAAwCzB,CAAxC,CAAsD,CAEzE,GAAM,CAAAptD,CAAA,CAAS2tD,CAAT,CAAN,EAA0B,CAAAvtD,CAAA,CAASutD,CAAT,CAA1B,EAA+C7kD,KAAA,CAAM6kD,CAAN,CAA/C,CAA8D,MAAO,EAErE,KAAImB,EAAa,CAACC,QAAA,CAASpB,CAAT,CAAlB,CACIqB,EAAS,CAAA,CADb,CAEIpB,EAAStwB,IAAA2xB,IAAA,CAAStB,CAAT,CAATC,CAA4B,EAFhC,CAGIsB,EAAgB,EAGpB,IAAIJ,CAAJ,CACEI,CAAA,CAAgB,QADlB,KAEO,CACLd,CAAA,CAAe7lD,EAAA,CAAMqlD,CAAN,CAEfO,GAAA,CAAYC,CAAZ,CAA0BhB,CAA1B,CAAwCn2C,CAAAo3C,QAAxC,CAAyDp3C,CAAAs2C,QAAzD,CAEIO,EAAAA,CAASM,CAAAjnB,EACTgoB,EAAAA,CAAaf,CAAAjtD,EACb0sD,EAAAA,CAAWO,CAAA1kD,EACX0lD,EAAAA,CAAW,EAIf,KAHAJ,CAGA,CAHSlB,CAAAuB,OAAA,CAAc,QAAQ,CAACL,CAAD,CAAS7nB,CAAT,CAAY,CAAE,MAAO6nB,EAAP,EAAiB,CAAC7nB,CAApB,CAAlC,CAA4D,CAAA,CAA5D,CAGT,CAAoB,CAApB,CAAOgoB,CAAP,CAAA,CACErB,CAAA5hD,QAAA,CAAe,CAAf,CACA,CAAAijD,CAAA,EAIe,EAAjB,CAAIA,CAAJ,CACEC,CADF,CACatB,CAAAxoD,OAAA,CAAc6pD,CAAd,CADb,EAGEC,CACA,CADWtB,CACX,CAAAA,CAAA,CAAS,CAAC,CAAD,CAJX,CAQIwB,EAAAA,CAAS,EAIb,KAHIxB,CAAA5tD,OAGJ,CAHoB+W,CAAAs4C,OAGpB,EAFED,CAAApjD,QAAA,CAAe4hD,CAAAxoD,OAAA,CAAc,CAAC2R,CAAAs4C,OAAf,CAAA7kD,KAAA,CAAoC,EAApC,CAAf,CAEF,CAAOojD,CAAA5tD,OAAP,CAAuB+W,CAAAu4C,MAAvB,CAAA,CACEF,CAAApjD,QAAA,CAAe4hD,CAAAxoD,OAAA,CAAc,CAAC2R,CAAAu4C,MAAf,CAAA9kD,KAAA,CAAmC,EAAnC,CAAf,CAEEojD;CAAA5tD,OAAJ,EACEovD,CAAApjD,QAAA,CAAe4hD,CAAApjD,KAAA,CAAY,EAAZ,CAAf,CAEFwkD,EAAA,CAAgBI,CAAA5kD,KAAA,CAAYkkD,CAAZ,CAGZQ,EAAAlvD,OAAJ,GACEgvD,CADF,EACmBL,CADnB,CACgCO,CAAA1kD,KAAA,CAAc,EAAd,CADhC,CAIImjD,EAAJ,GACEqB,CADF,EACmB,IADnB,CAC0BrB,CAD1B,CA3CK,CA+CP,MAAa,EAAb,CAAIF,CAAJ,EAAmBqB,CAAAA,CAAnB,CACS/3C,CAAAw4C,OADT,CAC0BP,CAD1B,CAC0Cj4C,CAAAy4C,OAD1C,CAGSz4C,CAAA04C,OAHT,CAG0BT,CAH1B,CAG0Cj4C,CAAA24C,OA9D+B,CAkE3EC,QAASA,GAAS,CAACC,CAAD,CAAMhC,CAAN,CAAc3uC,CAAd,CAAoB,CACpC,IAAI4wC,EAAM,EACA,EAAV,CAAID,CAAJ,GACEC,CACA,CADO,GACP,CAAAD,CAAA,CAAM,CAACA,CAFT,CAKA,KADAA,CACA,CADM,EACN,CADWA,CACX,CAAOA,CAAA5vD,OAAP,CAAoB4tD,CAApB,CAAA,CAA4BgC,CAAA,CAAM7B,EAAN,CAAkB6B,CAC1C3wC,EAAJ,GACE2wC,CADF,CACQA,CAAAjjC,OAAA,CAAWijC,CAAA5vD,OAAX,CAAwB4tD,CAAxB,CADR,CAGA,OAAOiC,EAAP,CAAaD,CAXuB,CAetCE,QAASA,GAAU,CAACxkD,CAAD,CAAOmjB,CAAP,CAAatR,CAAb,CAAqB8B,CAArB,CAA2B,CAC5C9B,CAAA,CAASA,CAAT,EAAmB,CACnB,OAAO,SAAQ,CAACrU,CAAD,CAAO,CAChB1H,CAAAA,CAAQ0H,CAAA,CAAK,KAAL,CAAawC,CAAb,CAAA,EACZ,IAAa,CAAb,CAAI6R,CAAJ,EAAkB/b,CAAlB,CAA0B,CAAC+b,CAA3B,CACE/b,CAAA,EAAS+b,CAEG,EAAd,GAAI/b,CAAJ,EAA8B,GAA9B,EAAmB+b,CAAnB,GAAkC/b,CAAlC,CAA0C,EAA1C,CACA,OAAOuuD,GAAA,CAAUvuD,CAAV,CAAiBqtB,CAAjB,CAAuBxP,CAAvB,CANa,CAFsB,CAY9C8wC,QAASA,GAAa,CAACzkD,CAAD,CAAO0kD,CAAP,CAAkB,CACtC,MAAO,SAAQ,CAAClnD,CAAD,CAAOgkD,CAAP,CAAgB,CAC7B,IAAI1rD,EAAQ0H,CAAA,CAAK,KAAL,CAAawC,CAAb,CAAA,EAAZ,CACIiC,EAAM6E,EAAA,CAAU49C,CAAA,CAAa,OAAb,CAAuB1kD,CAAvB,CAA+BA,CAAzC,CAEV,OAAOwhD,EAAA,CAAQv/C,CAAR,CAAA,CAAanM,CAAb,CAJsB,CADO,CAmBxC6uD,QAASA,GAAsB,CAACC,CAAD,CAAO,CAElC,IAAIC,EAAmBC,CAAC,IAAIjuD,IAAJ,CAAS+tD,CAAT;AAAe,CAAf,CAAkB,CAAlB,CAADE,QAAA,EAGvB,OAAO,KAAIjuD,IAAJ,CAAS+tD,CAAT,CAAe,CAAf,EAAwC,CAArB,EAACC,CAAD,CAA0B,CAA1B,CAA8B,EAAjD,EAAuDA,CAAvD,CAL2B,CActCE,QAASA,GAAU,CAAC5hC,CAAD,CAAO,CACvB,MAAO,SAAQ,CAAC3lB,CAAD,CAAO,CAAA,IACfwnD,EAAaL,EAAA,CAAuBnnD,CAAAynD,YAAA,EAAvB,CAGb1xB,EAAAA,CAAO,CAVN2xB,IAAIruD,IAAJquD,CAQ8B1nD,CARrBynD,YAAA,EAATC,CAQ8B1nD,CARG2nD,SAAA,EAAjCD,CAQ8B1nD,CANnC4nD,QAAA,EAFKF,EAEiB,CAFjBA,CAQ8B1nD,CANTsnD,OAAA,EAFrBI,EAUD3xB,CAAoB,CAACyxB,CACtBnqC,EAAAA,CAAS,CAATA,CAAaiX,IAAAuzB,MAAA,CAAW9xB,CAAX,CAAkB,MAAlB,CAEhB,OAAO8wB,GAAA,CAAUxpC,CAAV,CAAkBsI,CAAlB,CAPY,CADC,CAgB1BmiC,QAASA,GAAS,CAAC9nD,CAAD,CAAOgkD,CAAP,CAAgB,CAChC,MAA6B,EAAtB,EAAAhkD,CAAAynD,YAAA,EAAA,CAA0BzD,CAAA+D,KAAA,CAAa,CAAb,CAA1B,CAA4C/D,CAAA+D,KAAA,CAAa,CAAb,CADnB,CA0IlCxF,QAASA,GAAU,CAACwB,CAAD,CAAU,CAK3BiE,QAASA,EAAgB,CAACC,CAAD,CAAS,CAChC,IAAIvqD,CACJ,IAAIA,CAAJ,CAAYuqD,CAAAvqD,MAAA,CAAawqD,CAAb,CAAZ,CAAyC,CACnCloD,CAAAA,CAAO,IAAI3G,IAAJ,CAAS,CAAT,CAD4B,KAEnC8uD,EAAS,CAF0B,CAGnCC,EAAS,CAH0B,CAInCC,EAAa3qD,CAAA,CAAM,CAAN,CAAA,CAAWsC,CAAAsoD,eAAX,CAAiCtoD,CAAAuoD,YAJX,CAKnCC,EAAa9qD,CAAA,CAAM,CAAN,CAAA,CAAWsC,CAAAyoD,YAAX,CAA8BzoD,CAAA0oD,SAE3ChrD,EAAA,CAAM,CAAN,CAAJ,GACEyqD,CACA,CADSluD,EAAA,CAAMyD,CAAA,CAAM,CAAN,CAAN,CAAiBA,CAAA,CAAM,EAAN,CAAjB,CACT,CAAA0qD,CAAA,CAAQnuD,EAAA,CAAMyD,CAAA,CAAM,CAAN,CAAN,CAAiBA,CAAA,CAAM,EAAN,CAAjB,CAFV,CAIA2qD,EAAAxwD,KAAA,CAAgBmI,CAAhB,CAAsB/F,EAAA,CAAMyD,CAAA,CAAM,CAAN,CAAN,CAAtB,CAAuCzD,EAAA,CAAMyD,CAAA,CAAM,CAAN,CAAN,CAAvC;AAAyD,CAAzD,CAA4DzD,EAAA,CAAMyD,CAAA,CAAM,CAAN,CAAN,CAA5D,CACI7E,EAAAA,CAAIoB,EAAA,CAAMyD,CAAA,CAAM,CAAN,CAAN,EAAkB,CAAlB,CAAJ7E,CAA2BsvD,CAC3BQ,EAAAA,CAAI1uD,EAAA,CAAMyD,CAAA,CAAM,CAAN,CAAN,EAAkB,CAAlB,CAAJirD,CAA2BP,CAC3BQ,EAAAA,CAAI3uD,EAAA,CAAMyD,CAAA,CAAM,CAAN,CAAN,EAAkB,CAAlB,CACJmrD,EAAAA,CAAKv0B,IAAAuzB,MAAA,CAAgD,GAAhD,CAAWiB,UAAA,CAAW,IAAX,EAAmBprD,CAAA,CAAM,CAAN,CAAnB,EAA+B,CAA/B,EAAX,CACT8qD,EAAA3wD,KAAA,CAAgBmI,CAAhB,CAAsBnH,CAAtB,CAAyB8vD,CAAzB,CAA4BC,CAA5B,CAA+BC,CAA/B,CAhBuC,CAmBzC,MAAOZ,EArByB,CAFlC,IAAIC,EAAgB,sGA2BpB,OAAO,SAAQ,CAACloD,CAAD,CAAO+oD,CAAP,CAAetpD,CAAf,CAAyB,CAAA,IAClC22B,EAAO,EAD2B,CAElC70B,EAAQ,EAF0B,CAGlC5C,CAHkC,CAG9BjB,CAERqrD,EAAA,CAASA,CAAT,EAAmB,YACnBA,EAAA,CAAShF,CAAAiF,iBAAA,CAAyBD,CAAzB,CAAT,EAA6CA,CACzC/xD,EAAA,CAASgJ,CAAT,CAAJ,GACEA,CADF,CACSipD,EAAA1tD,KAAA,CAAmByE,CAAnB,CAAA,CAA2B/F,EAAA,CAAM+F,CAAN,CAA3B,CAAyCgoD,CAAA,CAAiBhoD,CAAjB,CADlD,CAII5I,EAAA,CAAS4I,CAAT,CAAJ,GACEA,CADF,CACS,IAAI3G,IAAJ,CAAS2G,CAAT,CADT,CAIA,IAAK,CAAA5G,CAAA,CAAO4G,CAAP,CAAL,EAAsB,CAAA+lD,QAAA,CAAS/lD,CAAA7B,QAAA,EAAT,CAAtB,CACE,MAAO6B,EAGT,KAAA,CAAO+oD,CAAP,CAAA,CAEE,CADArrD,CACA,CADQwrD,EAAA/zC,KAAA,CAAwB4zC,CAAxB,CACR,GACExnD,CACA,CADQjD,EAAA,CAAOiD,CAAP,CAAc7D,CAAd,CAAqB,CAArB,CACR,CAAAqrD,CAAA,CAASxnD,CAAAwgB,IAAA,EAFX,GAIExgB,CAAA5E,KAAA,CAAWosD,CAAX,CACA,CAAAA,CAAA,CAAS,IALX,CASF,KAAI7oD,EAAqBF,CAAAG,kBAAA,EACrBV;CAAJ,GACES,CACA,CADqBV,EAAA,CAAiBC,CAAjB,CAA2BS,CAA3B,CACrB,CAAAF,CAAA,CAAOD,EAAA,CAAuBC,CAAvB,CAA6BP,CAA7B,CAAuC,CAAA,CAAvC,CAFT,CAIAlI,EAAA,CAAQgK,CAAR,CAAe,QAAQ,CAACjJ,CAAD,CAAQ,CAC7BqG,CAAA,CAAKwqD,EAAA,CAAa7wD,CAAb,CACL89B,EAAA,EAAQz3B,CAAA,CAAKA,CAAA,CAAGqB,CAAH,CAAS+jD,CAAAiF,iBAAT,CAAmC9oD,CAAnC,CAAL,CACe,IAAV,GAAA5H,CAAA,CAAiB,GAAjB,CAAuBA,CAAAqH,QAAA,CAAc,UAAd,CAA0B,EAA1B,CAAAA,QAAA,CAAsC,KAAtC,CAA6C,GAA7C,CAHP,CAA/B,CAMA,OAAOy2B,EAzC+B,CA9Bb,CA2G7BqsB,QAASA,GAAU,EAAG,CACpB,MAAO,SAAQ,CAAC9S,CAAD,CAASyZ,CAAT,CAAkB,CAC3BtuD,CAAA,CAAYsuD,CAAZ,CAAJ,GACIA,CADJ,CACc,CADd,CAGA,OAAOnqD,GAAA,CAAO0wC,CAAP,CAAeyZ,CAAf,CAJwB,CADb,CAiItB1G,QAASA,GAAa,EAAG,CACvB,MAAO,SAAQ,CAAC14C,CAAD,CAAQq/C,CAAR,CAAe3gB,CAAf,CAAsB,CAEjC2gB,CAAA,CAD8BC,QAAhC,GAAIh1B,IAAA2xB,IAAA,CAASlgC,MAAA,CAAOsjC,CAAP,CAAT,CAAJ,CACUtjC,MAAA,CAAOsjC,CAAP,CADV,CAGUpvD,EAAA,CAAMovD,CAAN,CAEV,IAAIvpD,KAAA,CAAMupD,CAAN,CAAJ,CAAkB,MAAOr/C,EAErB5S,EAAA,CAAS4S,CAAT,CAAJ,GAAqBA,CAArB,CAA6BA,CAAAnP,SAAA,EAA7B,CACA,IAAK,CAAA9D,CAAA,CAAQiT,CAAR,CAAL,EAAwB,CAAAhT,CAAA,CAASgT,CAAT,CAAxB,CAAyC,MAAOA,EAEhD0+B,EAAA,CAAUA,CAAAA,CAAF,EAAW5oC,KAAA,CAAM4oC,CAAN,CAAX,CAA2B,CAA3B,CAA+BzuC,EAAA,CAAMyuC,CAAN,CACvCA,EAAA,CAAiB,CAAT,CAACA,CAAD,CAAcpU,IAAAC,IAAA,CAAS,CAAT,CAAYvqB,CAAA9S,OAAZ,CAA2BwxC,CAA3B,CAAd,CAAkDA,CAE1D,OAAa,EAAb,EAAI2gB,CAAJ,CACSr/C,CAAAlQ,MAAA,CAAY4uC,CAAZ,CAAmBA,CAAnB,CAA2B2gB,CAA3B,CADT,CAGgB,CAAd,GAAI3gB,CAAJ,CACS1+B,CAAAlQ,MAAA,CAAYuvD,CAAZ,CAAmBr/C,CAAA9S,OAAnB,CADT,CAGS8S,CAAAlQ,MAAA,CAAYw6B,IAAAC,IAAA,CAAS,CAAT,CAAYmU,CAAZ,CAAoB2gB,CAApB,CAAZ;AAAwC3gB,CAAxC,CApBwB,CADd,CA8NzBma,QAASA,GAAa,CAAC3wC,CAAD,CAAS,CA6C7Bq3C,QAASA,EAAiB,CAACC,CAAD,CAAgBC,CAAhB,CAA8B,CACtDA,CAAA,CAAeA,CAAA,CAAgB,EAAhB,CAAoB,CACnC,OAAOD,EAAAE,IAAA,CAAkB,QAAQ,CAACC,CAAD,CAAY,CAAA,IACvCC,EAAa,CAD0B,CACvBnlD,EAAMhK,EAE1B,IAAI9C,CAAA,CAAWgyD,CAAX,CAAJ,CACEllD,CAAA,CAAMklD,CADR,KAEO,IAAI3yD,CAAA,CAAS2yD,CAAT,CAAJ,CAAyB,CAC9B,GAA4B,GAA5B,EAAKA,CAAA9rD,OAAA,CAAiB,CAAjB,CAAL,EAA0D,GAA1D,EAAmC8rD,CAAA9rD,OAAA,CAAiB,CAAjB,CAAnC,CACE+rD,CACA,CADoC,GAAvB,EAAAD,CAAA9rD,OAAA,CAAiB,CAAjB,CAAA,CAA8B,EAA9B,CAAkC,CAC/C,CAAA8rD,CAAA,CAAYA,CAAAtoD,UAAA,CAAoB,CAApB,CAEd,IAAkB,EAAlB,GAAIsoD,CAAJ,GACEllD,CACImE,CADEsJ,CAAA,CAAOy3C,CAAP,CACF/gD,CAAAnE,CAAAmE,SAFN,EAGI,IAAIlR,EAAM+M,CAAA,EAAV,CACAA,EAAMA,QAAQ,CAACnM,CAAD,CAAQ,CAAE,MAAOA,EAAA,CAAMZ,CAAN,CAAT,CATI,CAahC,MAAO,CAAE+M,IAAKA,CAAP,CAAYmlD,WAAYA,CAAZA,CAAyBH,CAArC,CAlBoC,CAAtC,CAF+C,CAwBxD3xD,QAASA,EAAW,CAACQ,CAAD,CAAQ,CAC1B,OAAQ,MAAOA,EAAf,EACE,KAAK,QAAL,CACA,KAAK,SAAL,CACA,KAAK,QAAL,CACE,MAAO,CAAA,CACT,SACE,MAAO,CAAA,CANX,CAD0B,CApE5B,MAAO,SAAQ,CAAC6D,CAAD,CAAQqtD,CAAR,CAAuBC,CAAvB,CAAqC,CAElD,GAAa,IAAb,EAAIttD,CAAJ,CAAmB,MAAOA,EAC1B,IAAK,CAAAvF,EAAA,CAAYuF,CAAZ,CAAL,CACE,KAAMxF,EAAA,CAAO,SAAP,CAAA,CAAkB,UAAlB,CAAkEwF,CAAlE,CAAN,CAGGpF,CAAA,CAAQyyD,CAAR,CAAL,GAA+BA,CAA/B,CAA+C,CAACA,CAAD,CAA/C,CAC6B,EAA7B,GAAIA,CAAAtyD,OAAJ;CAAkCsyD,CAAlC,CAAkD,CAAC,GAAD,CAAlD,CAEA,KAAIK,EAAaN,CAAA,CAAkBC,CAAlB,CAAiCC,CAAjC,CAIjBI,EAAAltD,KAAA,CAAgB,CAAE8H,IAAKA,QAAQ,EAAG,CAAE,MAAO,EAAT,CAAlB,CAAkCmlD,WAAYH,CAAA,CAAgB,EAAhB,CAAoB,CAAlE,CAAhB,CAKIK,EAAAA,CAAgBzyD,KAAAynB,UAAA4qC,IAAA7xD,KAAA,CAAyBsE,CAAzB,CAMpB4tD,QAA4B,CAACzxD,CAAD,CAAQ8D,CAAR,CAAe,CACzC,MAAO,CACL9D,MAAOA,CADF,CAEL0xD,gBAAiBH,CAAAH,IAAA,CAAe,QAAQ,CAACC,CAAD,CAAY,CACzB,IAAA,EAAAA,CAAAllD,IAAA,CAAcnM,CAAd,CAkE3B0e,EAAAA,CAAO,MAAO1e,EAClB,IAAc,IAAd,GAAIA,CAAJ,CACE0e,CACA,CADO,QACP,CAAA1e,CAAA,CAAQ,MAFV,KAGO,IAAa,QAAb,GAAI0e,CAAJ,CACL1e,CAAA,CAAQA,CAAAyM,YAAA,EADH,KAEA,IAAa,QAAb,GAAIiS,CAAJ,CAtB0B,CAAA,CAAA,CAEjC,GAA6B,UAA7B,GAAI,MAAO1e,EAAAgB,QAAX,GACEhB,CACI,CADIA,CAAAgB,QAAA,EACJ,CAAAxB,CAAA,CAAYQ,CAAZ,CAFN,EAE0B,MAAA,CAG1B,IAAIsC,EAAA,CAAkBtC,CAAlB,CAAJ,GACEA,CACI,CADIA,CAAAuC,SAAA,EACJ,CAAA/C,CAAA,CAAYQ,CAAZ,CAFN,EAE0B,MAAA,CAG1B,EAAA,CA9DqD8D,CAkDpB,CAlD3B,MA2EC,CAAE9D,MAAOA,CAAT,CAAgB0e,KAAMA,CAAtB,CA5EiD,CAAnC,CAFZ,CADkC,CANvB,CACpB8yC,EAAA5xD,KAAA,CAcA+xD,QAAqB,CAACC,CAAD,CAAKC,CAAL,CAAS,CAE5B,IADA,IAAI9sC,EAAS,CAAb,CACSjhB,EAAM,CADf,CACkBlF,EAAS2yD,CAAA3yD,OAA3B,CAA8CkF,CAA9C,CAAsDlF,CAAtD,CAA8D,EAAEkF,CAAhE,CAAuE,CACpD,IAAA,EAAA8tD,CAAAF,gBAAA,CAAmB5tD,CAAnB,CAAA;AAA2B,EAAA+tD,CAAAH,gBAAA,CAAmB5tD,CAAnB,CAA3B,CAuEjBihB,EAAS,CACT6sC,EAAAlzC,KAAJ,GAAgBmzC,CAAAnzC,KAAhB,CACMkzC,CAAA5xD,MADN,GACmB6xD,CAAA7xD,MADnB,GAEI+kB,CAFJ,CAEa6sC,CAAA5xD,MAAA,CAAW6xD,CAAA7xD,MAAX,CAAuB,EAAvB,CAA2B,CAFxC,EAKE+kB,CALF,CAKW6sC,CAAAlzC,KAAA,CAAUmzC,CAAAnzC,KAAV,CAAqB,EAArB,CAAyB,CA5EhC,IADAqG,CACA,CA8EGA,CA9EH,CADyEwsC,CAAA,CAAWztD,CAAX,CAAAwtD,WACzE,CAAY,KAFyD,CAIvE,MAAOvsC,EANqB,CAd9B,CAGA,OAFAlhB,EAEA,CAFQ2tD,CAAAJ,IAAA,CAAkB,QAAQ,CAACpyD,CAAD,CAAO,CAAE,MAAOA,EAAAgB,MAAT,CAAjC,CArB0C,CADvB,CAyH/B8xD,QAASA,GAAW,CAACphD,CAAD,CAAY,CAC1BrR,CAAA,CAAWqR,CAAX,CAAJ,GACEA,CADF,CACc,CACVsc,KAAMtc,CADI,CADd,CAKAA,EAAAof,SAAA,CAAqBpf,CAAAof,SAArB,EAA2C,IAC3C,OAAOztB,GAAA,CAAQqO,CAAR,CAPuB,CAihBhCqhD,QAASA,GAAc,CAACruD,CAAD,CAAUywB,CAAV,CAAiBkE,CAAjB,CAAyBrhB,CAAzB,CAAmC0B,CAAnC,CAAiD,CAAA,IAClE7G,EAAO,IAD2D,CAElEmgD,EAAW,EAGfngD,EAAAogD,OAAA,CAAc,EACdpgD,EAAAqgD,UAAA,CAAiB,EACjBrgD,EAAAsgD,SAAA,CAAgB/zD,CAChByT,EAAAugD,MAAA,CAAa15C,CAAA,CAAayb,CAAAjqB,KAAb,EAA2BiqB,CAAA5gB,OAA3B,EAA2C,EAA3C,CAAA,CAA+C8kB,CAA/C,CACbxmB,EAAAwgD,OAAA,CAAc,CAAA,CACdxgD,EAAAygD,UAAA,CAAiB,CAAA,CACjBzgD,EAAA0gD,OAAA,CAAc,CAAA,CACd1gD,EAAA2gD,SAAA,CAAgB,CAAA,CAChB3gD,EAAA4gD,WAAA,CAAkB,CAAA,CAClB5gD,EAAA6gD,aAAA,CAAoBC,EAapB9gD,EAAA+gD,mBAAA,CAA0BC,QAAQ,EAAG,CACnC5zD,CAAA,CAAQ+yD,CAAR;AAAkB,QAAQ,CAACc,CAAD,CAAU,CAClCA,CAAAF,mBAAA,EADkC,CAApC,CADmC,CAiBrC/gD,EAAAkhD,iBAAA,CAAwBC,QAAQ,EAAG,CACjC/zD,CAAA,CAAQ+yD,CAAR,CAAkB,QAAQ,CAACc,CAAD,CAAU,CAClCA,CAAAC,iBAAA,EADkC,CAApC,CADiC,CA2BnClhD,EAAAohD,YAAA,CAAmBC,QAAQ,CAACJ,CAAD,CAAU,CAGnC3kD,EAAA,CAAwB2kD,CAAAV,MAAxB,CAAuC,OAAvC,CACAJ,EAAA3tD,KAAA,CAAcyuD,CAAd,CAEIA,EAAAV,MAAJ,GACEvgD,CAAA,CAAKihD,CAAAV,MAAL,CADF,CACwBU,CADxB,CAIAA,EAAAJ,aAAA,CAAuB7gD,CAVY,CAcrCA,EAAAshD,gBAAA,CAAuBC,QAAQ,CAACN,CAAD,CAAUO,CAAV,CAAmB,CAChD,IAAIC,EAAUR,CAAAV,MAEVvgD,EAAA,CAAKyhD,CAAL,CAAJ,GAAsBR,CAAtB,EACE,OAAOjhD,CAAA,CAAKyhD,CAAL,CAETzhD,EAAA,CAAKwhD,CAAL,CAAA,CAAgBP,CAChBA,EAAAV,MAAA,CAAgBiB,CAPgC,CA0BlDxhD,EAAA0hD,eAAA,CAAsBC,QAAQ,CAACV,CAAD,CAAU,CAClCA,CAAAV,MAAJ,EAAqBvgD,CAAA,CAAKihD,CAAAV,MAAL,CAArB,GAA6CU,CAA7C,EACE,OAAOjhD,CAAA,CAAKihD,CAAAV,MAAL,CAETnzD,EAAA,CAAQ4S,CAAAsgD,SAAR,CAAuB,QAAQ,CAACnyD,CAAD,CAAQkK,CAAR,CAAc,CAC3C2H,CAAA4hD,aAAA,CAAkBvpD,CAAlB,CAAwB,IAAxB,CAA8B4oD,CAA9B,CAD2C,CAA7C,CAGA7zD,EAAA,CAAQ4S,CAAAogD,OAAR,CAAqB,QAAQ,CAACjyD,CAAD,CAAQkK,CAAR,CAAc,CACzC2H,CAAA4hD,aAAA,CAAkBvpD,CAAlB,CAAwB,IAAxB,CAA8B4oD,CAA9B,CADyC,CAA3C,CAGA7zD,EAAA,CAAQ4S,CAAAqgD,UAAR,CAAwB,QAAQ,CAAClyD,CAAD,CAAQkK,CAAR,CAAc,CAC5C2H,CAAA4hD,aAAA,CAAkBvpD,CAAlB;AAAwB,IAAxB,CAA8B4oD,CAA9B,CAD4C,CAA9C,CAIAlvD,GAAA,CAAYouD,CAAZ,CAAsBc,CAAtB,CACAA,EAAAJ,aAAA,CAAuBC,EAfe,CA4BxCe,GAAA,CAAqB,CACnBC,KAAM,IADa,CAEnBnjC,SAAU9sB,CAFS,CAGnBuB,IAAKA,QAAQ,CAACoyC,CAAD,CAASpf,CAAT,CAAmB9qB,CAAnB,CAA+B,CAC1C,IAAIua,EAAO2vB,CAAA,CAAOpf,CAAP,CACNvQ,EAAL,CAIiB,EAJjB,GAGcA,CAAA3jB,QAAAD,CAAaqJ,CAAbrJ,CAHd,EAKI4jB,CAAArjB,KAAA,CAAU8I,CAAV,CALJ,CACEkqC,CAAA,CAAOpf,CAAP,CADF,CACqB,CAAC9qB,CAAD,CAHqB,CAHzB,CAcnBymD,MAAOA,QAAQ,CAACvc,CAAD,CAASpf,CAAT,CAAmB9qB,CAAnB,CAA+B,CAC5C,IAAIua,EAAO2vB,CAAA,CAAOpf,CAAP,CACNvQ,EAAL,GAGA9jB,EAAA,CAAY8jB,CAAZ,CAAkBva,CAAlB,CACA,CAAoB,CAApB,GAAIua,CAAA9oB,OAAJ,EACE,OAAOy4C,CAAA,CAAOpf,CAAP,CALT,CAF4C,CAd3B,CAwBnBjhB,SAAUA,CAxBS,CAArB,CAqCAnF,EAAAgiD,UAAA,CAAiBC,QAAQ,EAAG,CAC1B98C,CAAAsM,YAAA,CAAqB5f,CAArB,CAA8BqwD,EAA9B,CACA/8C,EAAAqM,SAAA,CAAkB3f,CAAlB,CAA2BswD,EAA3B,CACAniD,EAAAwgD,OAAA,CAAc,CAAA,CACdxgD,EAAAygD,UAAA,CAAiB,CAAA,CACjBzgD,EAAA6gD,aAAAmB,UAAA,EAL0B,CAsB5BhiD,EAAAoiD,aAAA,CAAoBC,QAAQ,EAAG,CAC7Bl9C,CAAAm9C,SAAA,CAAkBzwD,CAAlB,CAA2BqwD,EAA3B,CAA2CC,EAA3C,CAzPcI,eAyPd,CACAviD,EAAAwgD,OAAA,CAAc,CAAA,CACdxgD,EAAAygD,UAAA,CAAiB,CAAA,CACjBzgD,EAAA4gD,WAAA,CAAkB,CAAA,CAClBxzD,EAAA,CAAQ+yD,CAAR,CAAkB,QAAQ,CAACc,CAAD,CAAU,CAClCA,CAAAmB,aAAA,EADkC,CAApC,CAL6B,CAuB/BpiD,EAAAwiD,cAAA,CAAqBC,QAAQ,EAAG,CAC9Br1D,CAAA,CAAQ+yD,CAAR;AAAkB,QAAQ,CAACc,CAAD,CAAU,CAClCA,CAAAuB,cAAA,EADkC,CAApC,CAD8B,CAahCxiD,EAAA0iD,cAAA,CAAqBC,QAAQ,EAAG,CAC9Bx9C,CAAAqM,SAAA,CAAkB3f,CAAlB,CA7Rc0wD,cA6Rd,CACAviD,EAAA4gD,WAAA,CAAkB,CAAA,CAClB5gD,EAAA6gD,aAAA6B,cAAA,EAH8B,CA1OsC,CAuiDxEE,QAASA,GAAoB,CAACd,CAAD,CAAO,CAClCA,CAAAe,YAAArwD,KAAA,CAAsB,QAAQ,CAACrE,CAAD,CAAQ,CACpC,MAAO2zD,EAAAgB,SAAA,CAAc30D,CAAd,CAAA,CAAuBA,CAAvB,CAA+BA,CAAAuC,SAAA,EADF,CAAtC,CADkC,CAWpCqyD,QAASA,GAAa,CAACzpD,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBuwD,CAAvB,CAA6Bn5C,CAA7B,CAAuC5C,CAAvC,CAAiD,CACrE,IAAI8G,EAAO/a,CAAA,CAAUD,CAAA,CAAQ,CAAR,CAAAgb,KAAV,CAKX,IAAKmoC,CAAArsC,CAAAqsC,QAAL,CAAuB,CACrB,IAAIgO,EAAY,CAAA,CAEhBnxD,EAAAsJ,GAAA,CAAW,kBAAX,CAA+B,QAAQ,CAAC1B,CAAD,CAAO,CAC5CupD,CAAA,CAAY,CAAA,CADgC,CAA9C,CAIAnxD,EAAAsJ,GAAA,CAAW,gBAAX,CAA6B,QAAQ,EAAG,CACtC6nD,CAAA,CAAY,CAAA,CACZtqC,EAAA,EAFsC,CAAxC,CAPqB,CAavB,IAAIA,EAAWA,QAAQ,CAACuqC,CAAD,CAAK,CACtBjrB,CAAJ,GACEjyB,CAAAsU,MAAAI,OAAA,CAAsBud,CAAtB,CACA,CAAAA,CAAA,CAAU,IAFZ,CAIA,IAAIgrB,CAAAA,CAAJ,CAAA,CAL0B,IAMtB70D,EAAQ0D,CAAAgD,IAAA,EACRib,EAAAA,CAAQmzC,CAARnzC,EAAcmzC,CAAAp2C,KAKL,WAAb,GAAIA,CAAJ,EAA6Btb,CAAA2xD,OAA7B,EAA4D,OAA5D,GAA4C3xD,CAAA2xD,OAA5C;CACE/0D,CADF,CACU6d,CAAA,CAAK7d,CAAL,CADV,CAOA,EAAI2zD,CAAAqB,WAAJ,GAAwBh1D,CAAxB,EAA4C,EAA5C,GAAkCA,CAAlC,EAAkD2zD,CAAAsB,sBAAlD,GACEtB,CAAAuB,cAAA,CAAmBl1D,CAAnB,CAA0B2hB,CAA1B,CAfF,CAL0B,CA0B5B,IAAInH,CAAAitC,SAAA,CAAkB,OAAlB,CAAJ,CACE/jD,CAAAsJ,GAAA,CAAW,OAAX,CAAoBud,CAApB,CADF,KAEO,CACL,IAAIsf,CAAJ,CAEIsrB,EAAgBA,QAAQ,CAACL,CAAD,CAAKpjD,CAAL,CAAY0jD,CAAZ,CAAuB,CAC5CvrB,CAAL,GACEA,CADF,CACYjyB,CAAAsU,MAAA,CAAe,QAAQ,EAAG,CAClC2d,CAAA,CAAU,IACLn4B,EAAL,EAAcA,CAAA1R,MAAd,GAA8Bo1D,CAA9B,EACE7qC,CAAA,CAASuqC,CAAT,CAHgC,CAA1B,CADZ,CADiD,CAWnDpxD,EAAAsJ,GAAA,CAAW,SAAX,CAAsB,QAAQ,CAAC2U,CAAD,CAAQ,CACpC,IAAIviB,EAAMuiB,CAAA0zC,QAIE,GAAZ,GAAIj2D,CAAJ,EAAmB,EAAnB,CAAwBA,CAAxB,EAAqC,EAArC,CAA+BA,CAA/B,EAA6C,EAA7C,EAAmDA,CAAnD,EAAiE,EAAjE,EAA0DA,CAA1D,EAEA+1D,CAAA,CAAcxzC,CAAd,CAAqB,IAArB,CAA2B,IAAA3hB,MAA3B,CAPoC,CAAtC,CAWA,IAAIwa,CAAAitC,SAAA,CAAkB,OAAlB,CAAJ,CACE/jD,CAAAsJ,GAAA,CAAW,WAAX,CAAwBmoD,CAAxB,CA1BG,CAgCPzxD,CAAAsJ,GAAA,CAAW,QAAX,CAAqBud,CAArB,CAEAopC,EAAA2B,QAAA,CAAeC,QAAQ,EAAG,CAExB,IAAIv1D,EAAQ2zD,CAAAgB,SAAA,CAAchB,CAAAqB,WAAd,CAAA,CAAiC,EAAjC,CAAsCrB,CAAAqB,WAC9CtxD,EAAAgD,IAAA,EAAJ,GAAsB1G,CAAtB,EACE0D,CAAAgD,IAAA,CAAY1G,CAAZ,CAJsB,CAjF2C,CA0HvEw1D,QAASA,GAAgB,CAACzkC,CAAD,CAAS0kC,CAAT,CAAkB,CACzC,MAAO,SAAQ,CAACC,CAAD,CAAMhuD,CAAN,CAAY,CAAA,IACrBuB,CADqB;AACdmoD,CAEX,IAAItwD,CAAA,CAAO40D,CAAP,CAAJ,CACE,MAAOA,EAGT,IAAIh3D,CAAA,CAASg3D,CAAT,CAAJ,CAAmB,CAII,GAArB,EAAIA,CAAAnwD,OAAA,CAAW,CAAX,CAAJ,EAA0D,GAA1D,EAA4BmwD,CAAAnwD,OAAA,CAAWmwD,CAAA92D,OAAX,CAAwB,CAAxB,CAA5B,GACE82D,CADF,CACQA,CAAA3sD,UAAA,CAAc,CAAd,CAAiB2sD,CAAA92D,OAAjB,CAA8B,CAA9B,CADR,CAGA,IAAI+2D,EAAA1yD,KAAA,CAAqByyD,CAArB,CAAJ,CACE,MAAO,KAAI30D,IAAJ,CAAS20D,CAAT,CAET3kC,EAAA1rB,UAAA,CAAmB,CAGnB,IAFA4D,CAEA,CAFQ8nB,CAAAlU,KAAA,CAAY64C,CAAZ,CAER,CAqBE,MApBAzsD,EAAAgd,MAAA,EAoBO,CAlBLmrC,CAkBK,CAnBH1pD,CAAJ,CACQ,CACJkuD,KAAMluD,CAAAynD,YAAA,EADF,CAEJ0G,GAAInuD,CAAA2nD,SAAA,EAAJwG,CAAsB,CAFlB,CAGJC,GAAIpuD,CAAA4nD,QAAA,EAHA,CAIJyG,GAAIruD,CAAAsuD,SAAA,EAJA,CAKJC,GAAIvuD,CAAAM,WAAA,EALA,CAMJkuD,GAAIxuD,CAAAyuD,WAAA,EANA,CAOJC,IAAK1uD,CAAA2uD,gBAAA,EAALD,CAA8B,GAP1B,CADR,CAWQ,CAAER,KAAM,IAAR,CAAcC,GAAI,CAAlB,CAAqBC,GAAI,CAAzB,CAA4BC,GAAI,CAAhC,CAAmCE,GAAI,CAAvC,CAA0CC,GAAI,CAA9C,CAAiDE,IAAK,CAAtD,CAQD,CALPn3D,CAAA,CAAQgK,CAAR,CAAe,QAAQ,CAACqtD,CAAD,CAAOxyD,CAAP,CAAc,CAC/BA,CAAJ,CAAY2xD,CAAA72D,OAAZ,GACEwyD,CAAA,CAAIqE,CAAA,CAAQ3xD,CAAR,CAAJ,CADF,CACwB,CAACwyD,CADzB,CADmC,CAArC,CAKO,CAAA,IAAIv1D,IAAJ,CAASqwD,CAAAwE,KAAT,CAAmBxE,CAAAyE,GAAnB,CAA4B,CAA5B,CAA+BzE,CAAA0E,GAA/B,CAAuC1E,CAAA2E,GAAvC,CAA+C3E,CAAA6E,GAA/C,CAAuD7E,CAAA8E,GAAvD,EAAiE,CAAjE,CAA8E,GAA9E,CAAoE9E,CAAAgF,IAApE,EAAsF,CAAtF,CAlCQ,CAsCnB,MAAOG,IA7CkB,CADc,CAkD3CC,QAASA,GAAmB,CAAC93C,CAAD,CAAOqS,CAAP,CAAe0lC,CAAf,CAA0BhG,CAA1B,CAAkC,CAC5D,MAAOiG,SAA6B,CAACvrD,CAAD;AAAQzH,CAAR,CAAiBN,CAAjB,CAAuBuwD,CAAvB,CAA6Bn5C,CAA7B,CAAuC5C,CAAvC,CAAiDU,CAAjD,CAA0D,CA4D5Fq+C,QAASA,EAAW,CAAC32D,CAAD,CAAQ,CAE1B,MAAOA,EAAP,EAAgB,EAAEA,CAAA6F,QAAF,EAAmB7F,CAAA6F,QAAA,EAAnB,GAAuC7F,CAAA6F,QAAA,EAAvC,CAFU,CAK5B+wD,QAASA,EAAsB,CAAClwD,CAAD,CAAM,CACnC,MAAOjE,EAAA,CAAUiE,CAAV,CAAA,EAAmB,CAAA5F,CAAA,CAAO4F,CAAP,CAAnB,CAAiC+vD,CAAA,CAAU/vD,CAAV,CAAjC,EAAmDtI,CAAnD,CAA+DsI,CADnC,CAhErCmwD,EAAA,CAAgB1rD,CAAhB,CAAuBzH,CAAvB,CAAgCN,CAAhC,CAAsCuwD,CAAtC,CACAiB,GAAA,CAAczpD,CAAd,CAAqBzH,CAArB,CAA8BN,CAA9B,CAAoCuwD,CAApC,CAA0Cn5C,CAA1C,CAAoD5C,CAApD,CACA,KAAIzQ,EAAWwsD,CAAXxsD,EAAmBwsD,CAAAmD,SAAnB3vD,EAAoCwsD,CAAAmD,SAAA3vD,SAAxC,CACI4vD,CAEJpD,EAAAqD,aAAA,CAAoBt4C,CACpBi1C,EAAAsD,SAAA5yD,KAAA,CAAmB,QAAQ,CAACrE,CAAD,CAAQ,CACjC,MAAI2zD,EAAAgB,SAAA,CAAc30D,CAAd,CAAJ,CAAiC,IAAjC,CACI+wB,CAAA9tB,KAAA,CAAYjD,CAAZ,CAAJ,EAIMk3D,CAIGA,CAJUT,CAAA,CAAUz2D,CAAV,CAAiB+2D,CAAjB,CAIVG,CAHH/vD,CAGG+vD,GAFLA,CAEKA,CAFQzvD,EAAA,CAAuByvD,CAAvB,CAAmC/vD,CAAnC,CAER+vD,EAAAA,CART,EAUO94D,CAZ0B,CAAnC,CAeAu1D,EAAAe,YAAArwD,KAAA,CAAsB,QAAQ,CAACrE,CAAD,CAAQ,CACpC,GAAIA,CAAJ,EAAc,CAAAc,CAAA,CAAOd,CAAP,CAAd,CACE,KAAMm3D,GAAA,CAAc,SAAd,CAAwDn3D,CAAxD,CAAN,CAEF,GAAI22D,CAAA,CAAY32D,CAAZ,CAAJ,CAKE,MAAO,CAJP+2D,CAIO,CAJQ/2D,CAIR,GAHamH,CAGb,GAFL4vD,CAEK,CAFUtvD,EAAA,CAAuBsvD,CAAvB,CAAqC5vD,CAArC,CAA+C,CAAA,CAA/C,CAEV,EAAAmR,CAAA,CAAQ,MAAR,CAAA,CAAgBtY,CAAhB,CAAuBywD,CAAvB,CAA+BtpD,CAA/B,CAEP4vD,EAAA,CAAe,IACf,OAAO,EAZ2B,CAAtC,CAgBA,IAAIt0D,CAAA,CAAUW,CAAA6pD,IAAV,CAAJ,EAA2B7pD,CAAAg0D,MAA3B,CAAuC,CACrC,IAAIC,CACJ1D,EAAA2D,YAAArK,IAAA,CAAuBsK,QAAQ,CAACv3D,CAAD,CAAQ,CACrC,MAAO,CAAC22D,CAAA,CAAY32D,CAAZ,CAAR;AAA8BwC,CAAA,CAAY60D,CAAZ,CAA9B,EAAqDZ,CAAA,CAAUz2D,CAAV,CAArD,EAAyEq3D,CADpC,CAGvCj0D,EAAA88B,SAAA,CAAc,KAAd,CAAqB,QAAQ,CAACx5B,CAAD,CAAM,CACjC2wD,CAAA,CAAST,CAAA,CAAuBlwD,CAAvB,CACTitD,EAAA6D,UAAA,EAFiC,CAAnC,CALqC,CAWvC,GAAI/0D,CAAA,CAAUW,CAAA64B,IAAV,CAAJ,EAA2B74B,CAAAq0D,MAA3B,CAAuC,CACrC,IAAIC,CACJ/D,EAAA2D,YAAAr7B,IAAA,CAAuB07B,QAAQ,CAAC33D,CAAD,CAAQ,CACrC,MAAO,CAAC22D,CAAA,CAAY32D,CAAZ,CAAR,EAA8BwC,CAAA,CAAYk1D,CAAZ,CAA9B,EAAqDjB,CAAA,CAAUz2D,CAAV,CAArD,EAAyE03D,CADpC,CAGvCt0D,EAAA88B,SAAA,CAAc,KAAd,CAAqB,QAAQ,CAACx5B,CAAD,CAAM,CACjCgxD,CAAA,CAASd,CAAA,CAAuBlwD,CAAvB,CACTitD,EAAA6D,UAAA,EAFiC,CAAnC,CALqC,CAjDqD,CADlC,CAwE9DX,QAASA,GAAe,CAAC1rD,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBuwD,CAAvB,CAA6B,CAGnD,CADuBA,CAAAsB,sBACvB,CADoDv0D,CAAA,CADzCgD,CAAAR,CAAQ,CAARA,CACkD00D,SAAT,CACpD,GACEjE,CAAAsD,SAAA5yD,KAAA,CAAmB,QAAQ,CAACrE,CAAD,CAAQ,CACjC,IAAI43D,EAAWl0D,CAAAP,KAAA,CA7qsBS00D,UA6qsBT,CAAXD,EAAoD,EACxD,OAAOA,EAAAE,SAAA,EAAqBF,CAAAG,aAArB,CAA6C35D,CAA7C,CAAyD4B,CAF/B,CAAnC,CAJiD,CAiHrDg4D,QAASA,GAAiB,CAACp+C,CAAD,CAASza,CAAT,CAAkB+K,CAAlB,CAAwBu5B,CAAxB,CAAoCr8B,CAApC,CAA8C,CAEtE,GAAI3E,CAAA,CAAUghC,CAAV,CAAJ,CAA2B,CACzBw0B,CAAA,CAAUr+C,CAAA,CAAO6pB,CAAP,CACV,IAAKnzB,CAAA2nD,CAAA3nD,SAAL,CACE,KAAM6mD,GAAA,CAAc,WAAd,CACiCjtD,CADjC,CACuCu5B,CADvC,CAAN,CAGF,MAAOw0B,EAAA,CAAQ94D,CAAR,CANkB,CAQ3B,MAAOiI,EAV+D,CAolBxE8wD,QAASA,GAAc,CAAChuD,CAAD,CAAO2V,CAAP,CAAiB,CACtC3V,CAAA,CAAO,SAAP,CAAmBA,CACnB;MAAO,CAAC,UAAD,CAAa,QAAQ,CAAC8M,CAAD,CAAW,CAiFrCmhD,QAASA,EAAe,CAACt1B,CAAD,CAAUC,CAAV,CAAmB,CACzC,IAAIF,EAAS,EAAb,CAGS/iC,EAAI,CADb,EAAA,CACA,IAAA,CAAgBA,CAAhB,CAAoBgjC,CAAAjkC,OAApB,CAAoCiB,CAAA,EAApC,CAAyC,CAEvC,IADA,IAAIkjC,EAAQF,CAAA,CAAQhjC,CAAR,CAAZ,CACSc,EAAI,CAAb,CAAgBA,CAAhB,CAAoBmiC,CAAAlkC,OAApB,CAAoC+B,CAAA,EAApC,CACE,GAAIoiC,CAAJ,EAAaD,CAAA,CAAQniC,CAAR,CAAb,CAAyB,SAAS,CAEpCiiC,EAAAv+B,KAAA,CAAY0+B,CAAZ,CALuC,CAOzC,MAAOH,EAXkC,CAc3Cw1B,QAASA,EAAY,CAACn3B,CAAD,CAAW,CAC9B,IAAI7d,EAAU,EACd,OAAI3kB,EAAA,CAAQwiC,CAAR,CAAJ,EACEhiC,CAAA,CAAQgiC,CAAR,CAAkB,QAAQ,CAAC+C,CAAD,CAAI,CAC5B5gB,CAAA,CAAUA,CAAApd,OAAA,CAAeoyD,CAAA,CAAap0B,CAAb,CAAf,CADkB,CAA9B,CAGO5gB,CAAAA,CAJT,EAKW1kB,CAAA,CAASuiC,CAAT,CAAJ,CACEA,CAAAz9B,MAAA,CAAe,GAAf,CADF,CAEI9C,CAAA,CAASugC,CAAT,CAAJ,EACLhiC,CAAA,CAAQgiC,CAAR,CAAkB,QAAQ,CAAC+C,CAAD,CAAII,CAAJ,CAAO,CAC3BJ,CAAJ,GACE5gB,CADF,CACYA,CAAApd,OAAA,CAAeo+B,CAAA5gC,MAAA,CAAQ,GAAR,CAAf,CADZ,CAD+B,CAAjC,CAKO4f,CAAAA,CANF,EAQA6d,CAjBuB,CA9FhC,MAAO,CACLnR,SAAU,IADL,CAEL9C,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CAiCnCi1D,QAASA,EAAiB,CAACj1C,CAAD,CAAU+qB,CAAV,CAAiB,CAGzC,IAAImqB,EAAc50D,CAAA4H,KAAA,CAAa,cAAb,CAAdgtD,EAA8CvyD,CAAA,EAAlD,CACIwyD,EAAkB,EACtBt5D,EAAA,CAAQmkB,CAAR,CAAiB,QAAQ,CAACuO,CAAD,CAAY,CACnC,GAAY,CAAZ,CAAIwc,CAAJ,EAAiBmqB,CAAA,CAAY3mC,CAAZ,CAAjB,CACE2mC,CAAA,CAAY3mC,CAAZ,CACA,EAD0B2mC,CAAA,CAAY3mC,CAAZ,CAC1B,EADoD,CACpD,EADyDwc,CACzD,CAAImqB,CAAA,CAAY3mC,CAAZ,CAAJ,GAA+B,EAAU,CAAV,CAAEwc,CAAF,CAA/B,EACEoqB,CAAAl0D,KAAA,CAAqBstB,CAArB,CAJ+B,CAArC,CAQAjuB,EAAA4H,KAAA,CAAa,cAAb;AAA6BgtD,CAA7B,CACA,OAAOC,EAAAnvD,KAAA,CAAqB,GAArB,CAdkC,CA8B3CovD,QAASA,EAAkB,CAAC3vC,CAAD,CAAS,CAClC,GAAiB,CAAA,CAAjB,GAAIhJ,CAAJ,EAAyB1U,CAAAstD,OAAzB,CAAwC,CAAxC,GAA8C54C,CAA9C,CAAwD,CACtD,IAAIshB,EAAai3B,CAAA,CAAavvC,CAAb,EAAuB,EAAvB,CACjB,IAAKC,CAAAA,CAAL,CAAa,CA1Cf,IAAIqY,EAAak3B,CAAA,CA2CFl3B,CA3CE,CAA2B,CAA3B,CACjB/9B,EAAA49B,UAAA,CAAeG,CAAf,CAyCe,CAAb,IAEO,IAAK,CAAA37B,EAAA,CAAOqjB,CAAP,CAAcC,CAAd,CAAL,CAA4B,CAEnBwU,IAAAA,EADG86B,CAAA96B,CAAaxU,CAAbwU,CACHA,CAnBd8D,EAAQ+2B,CAAA,CAmBkBh3B,CAnBlB,CAA4B7D,CAA5B,CAmBMA,CAlBdgE,EAAW62B,CAAA,CAAgB76B,CAAhB,CAkBe6D,CAlBf,CAkBG7D,CAjBlB8D,EAAQi3B,CAAA,CAAkBj3B,CAAlB,CAAyB,CAAzB,CAiBU9D,CAhBlBgE,EAAW+2B,CAAA,CAAkB/2B,CAAlB,CAA6B,EAA7B,CACPF,EAAJ,EAAaA,CAAAxiC,OAAb,EACEoY,CAAAqM,SAAA,CAAkB3f,CAAlB,CAA2B09B,CAA3B,CAEEE,EAAJ,EAAgBA,CAAA1iC,OAAhB,EACEoY,CAAAsM,YAAA,CAAqB5f,CAArB,CAA8B49B,CAA9B,CASmC,CAJmB,CASxDxY,CAAA,CAASxjB,EAAA,CAAYujB,CAAZ,CAVyB,CA9DpC,IAAIC,CAEJ3d,EAAAtI,OAAA,CAAaO,CAAA,CAAK8G,CAAL,CAAb,CAAyBsuD,CAAzB,CAA6C,CAAA,CAA7C,CAEAp1D,EAAA88B,SAAA,CAAc,OAAd,CAAuB,QAAQ,CAAClgC,CAAD,CAAQ,CACrCw4D,CAAA,CAAmBrtD,CAAA63C,MAAA,CAAY5/C,CAAA,CAAK8G,CAAL,CAAZ,CAAnB,CADqC,CAAvC,CAKa,UAAb,GAAIA,CAAJ,EACEiB,CAAAtI,OAAA,CAAa,QAAb,CAAuB,QAAQ,CAAC41D,CAAD,CAASC,CAAT,CAAoB,CAEjD,IAAIC,EAAMF,CAANE,CAAe,CACnB,IAAIA,CAAJ,IAAaD,CAAb,CAAyB,CAAzB,EAA6B,CAC3B,IAAIt1C,EAAUg1C,CAAA,CAAajtD,CAAA63C,MAAA,CAAY5/C,CAAA,CAAK8G,CAAL,CAAZ,CAAb,CACdyuD,EAAA,GAAQ94C,CAAR,EAQAshB,CACJ,CADiBk3B,CAAA,CAPAj1C,CAOA,CAA2B,CAA3B,CACjB,CAAAhgB,CAAA49B,UAAA,CAAeG,CAAf,CATI,GAaAA,CACJ,CADiBk3B,CAAA,CAXGj1C,CAWH,CAA4B,EAA5B,CACjB,CAAAhgB,CAAA89B,aAAA,CAAkBC,CAAlB,CAdI,CAF2B,CAHoB,CAAnD,CAXiC,CAFhC,CAD8B,CAAhC,CAF+B,CAuvGxCuyB,QAASA,GAAoB,CAACv0D,CAAD,CAAU,CA4ErCy5D,QAASA,EAAiB,CAACjnC,CAAD;AAAYknC,CAAZ,CAAyB,CAC7CA,CAAJ,EAAoB,CAAAC,CAAA,CAAWnnC,CAAX,CAApB,EACE3a,CAAAqM,SAAA,CAAkBmN,CAAlB,CAA4BmB,CAA5B,CACA,CAAAmnC,CAAA,CAAWnnC,CAAX,CAAA,CAAwB,CAAA,CAF1B,EAGYknC,CAAAA,CAHZ,EAG2BC,CAAA,CAAWnnC,CAAX,CAH3B,GAIE3a,CAAAsM,YAAA,CAAqBkN,CAArB,CAA+BmB,CAA/B,CACA,CAAAmnC,CAAA,CAAWnnC,CAAX,CAAA,CAAwB,CAAA,CAL1B,CADiD,CAUnDonC,QAASA,EAAmB,CAACC,CAAD,CAAqBC,CAArB,CAA8B,CACxDD,CAAA,CAAqBA,CAAA,CAAqB,GAArB,CAA2B5sD,EAAA,CAAW4sD,CAAX,CAA+B,GAA/B,CAA3B,CAAiE,EAEtFJ,EAAA,CAAkBM,EAAlB,CAAgCF,CAAhC,CAAgE,CAAA,CAAhE,GAAoDC,CAApD,CACAL,EAAA,CAAkBO,EAAlB,CAAkCH,CAAlC,CAAkE,CAAA,CAAlE,GAAsDC,CAAtD,CAJwD,CAtFrB,IACjCtF,EAAOx0D,CAAAw0D,KAD0B,CAEjCnjC,EAAWrxB,CAAAqxB,SAFsB,CAGjCsoC,EAAa,EAHoB,CAIjC7zD,EAAM9F,CAAA8F,IAJ2B,CAKjC2uD,EAAQz0D,CAAAy0D,MALyB,CAMjC58C,EAAW7X,CAAA6X,SAEf8hD,EAAA,CAAWK,EAAX,CAAA,CAA4B,EAAEL,CAAA,CAAWI,EAAX,CAAF,CAA4B1oC,CAAArN,SAAA,CAAkB+1C,EAAlB,CAA5B,CAE5BvF,EAAAF,aAAA,CAEA2F,QAAoB,CAACJ,CAAD,CAAqBhvC,CAArB,CAA4B7c,CAA5B,CAAwC,CACtD3K,CAAA,CAAYwnB,CAAZ,CAAJ,EAgDK2pC,CAAA,SAGL,GAFEA,CAAA,SAEF,CAFe,EAEf,EAAA1uD,CAAA,CAAI0uD,CAAA,SAAJ,CAlD2BqF,CAkD3B,CAlD+C7rD,CAkD/C,CAnDA,GAuDIwmD,CAAA,SAGJ,EAFEC,CAAA,CAAMD,CAAA,SAAN,CArD4BqF,CAqD5B,CArDgD7rD,CAqDhD,CAEF,CAAIksD,EAAA,CAAc1F,CAAA,SAAd,CAAJ,GACEA,CAAA,SADF,CACev1D,CADf,CA1DA,CAKK0E,GAAA,CAAUknB,CAAV,CAAL,CAIMA,CAAJ,EACE4pC,CAAA,CAAMD,CAAA1B,OAAN,CAAmB+G,CAAnB,CAAuC7rD,CAAvC,CACA,CAAAlI,CAAA,CAAI0uD,CAAAzB,UAAJ,CAAoB8G,CAApB,CAAwC7rD,CAAxC,CAFF,GAIElI,CAAA,CAAI0uD,CAAA1B,OAAJ,CAAiB+G,CAAjB,CAAqC7rD,CAArC,CACA,CAAAymD,CAAA,CAAMD,CAAAzB,UAAN,CAAsB8G,CAAtB,CAA0C7rD,CAA1C,CALF,CAJF,EACEymD,CAAA,CAAMD,CAAA1B,OAAN,CAAmB+G,CAAnB,CAAuC7rD,CAAvC,CACA,CAAAymD,CAAA,CAAMD,CAAAzB,UAAN,CAAsB8G,CAAtB,CAA0C7rD,CAA1C,CAFF,CAYIwmD;CAAAxB,SAAJ,EACEyG,CAAA,CAAkBU,EAAlB,CAAiC,CAAA,CAAjC,CAEA,CADA3F,CAAApB,OACA,CADcoB,CAAAnB,SACd,CAD8Bp0D,CAC9B,CAAA26D,CAAA,CAAoB,EAApB,CAAwB,IAAxB,CAHF,GAKEH,CAAA,CAAkBU,EAAlB,CAAiC,CAAA,CAAjC,CAGA,CAFA3F,CAAApB,OAEA,CAFc8G,EAAA,CAAc1F,CAAA1B,OAAd,CAEd,CADA0B,CAAAnB,SACA,CADgB,CAACmB,CAAApB,OACjB,CAAAwG,CAAA,CAAoB,EAApB,CAAwBpF,CAAApB,OAAxB,CARF,CAiBEgH,EAAA,CADE5F,CAAAxB,SAAJ,EAAqBwB,CAAAxB,SAAA,CAAc6G,CAAd,CAArB,CACkB56D,CADlB,CAEWu1D,CAAA1B,OAAA,CAAY+G,CAAZ,CAAJ,CACW,CAAA,CADX,CAEIrF,CAAAzB,UAAA,CAAe8G,CAAf,CAAJ,CACW,CAAA,CADX,CAGW,IAGlBD,EAAA,CAAoBC,CAApB,CAAwCO,CAAxC,CACA5F,EAAAjB,aAAAe,aAAA,CAA+BuF,CAA/B,CAAmDO,CAAnD,CAAkE5F,CAAlE,CA7C0D,CAZvB,CA8FvC0F,QAASA,GAAa,CAAC96D,CAAD,CAAM,CAC1B,GAAIA,CAAJ,CACE,IAAS4E,IAAAA,CAAT,GAAiB5E,EAAjB,CACE,GAAIA,CAAAe,eAAA,CAAmB6D,CAAnB,CAAJ,CACE,MAAO,CAAA,CAIb,OAAO,CAAA,CARmB,CAts0B5B,IAAIq2D,GAAsB,oBAA1B,CAMIl6D,GAAiBT,MAAA2nB,UAAAlnB,eANrB,CAQIqE,EAAYA,QAAQ,CAACgsD,CAAD,CAAS,CAAC,MAAOjxD,EAAA,CAASixD,CAAT,CAAA,CAAmBA,CAAAljD,YAAA,EAAnB,CAA0CkjD,CAAlD,CARjC,CASI3+C,GAAYA,QAAQ,CAAC2+C,CAAD,CAAS,CAAC,MAAOjxD,EAAA,CAASixD,CAAT,CAAA,CAAmBA,CAAA3zC,YAAA,EAAnB,CAA0C2zC,CAAlD,CATjC,CAoCIrpC,EApCJ,CAqCI3nB,CArCJ,CAsCIoO,EAtCJ,CAuCIvL,GAAoB,EAAAA,MAvCxB,CAwCIwC,GAAoB,EAAAA,OAxCxB,CAyCIK;AAAoB,EAAAA,KAzCxB,CA0CI9B,GAAoB1D,MAAA2nB,UAAAjkB,SA1CxB,CA2CIG,GAAoB7D,MAAA6D,eA3CxB,CA4CI+B,GAAoBpG,CAAA,CAAO,IAAP,CA5CxB,CA+CIoN,GAAoBvN,CAAAuN,QAApBA,GAAuCvN,CAAAuN,QAAvCA,CAAwD,EAAxDA,CA/CJ,CAgDI0F,EAhDJ,CAiDIjR,GAAoB,CAMxBomB,GAAA,CAAOnoB,CAAAs7D,aAwQPv3D,EAAAkkB,QAAA,CAAe,EAsBfjkB,GAAAikB,QAAA,CAAmB,EAsInB,KAAI3nB,EAAUM,KAAAN,QAAd,CAuEIuE,GAAqB,yFAvEzB,CAiFI6a,EAAOA,QAAQ,CAAC7d,CAAD,CAAQ,CACzB,MAAOtB,EAAA,CAASsB,CAAT,CAAA,CAAkBA,CAAA6d,KAAA,EAAlB,CAAiC7d,CADf,CAjF3B,CAwFIukD,GAAkBA,QAAQ,CAAC+L,CAAD,CAAI,CAChC,MAAOA,EAAAjpD,QAAA,CAAU,+BAAV,CAA2C,MAA3C,CAAAA,QAAA,CACU,OADV,CACmB,OADnB,CADyB,CAxFlC,CA6aI6J,GAAMA,QAAQ,EAAG,CACnB,GAAK,CAAAzO,CAAA,CAAUyO,EAAAwoD,MAAV,CAAL,CAA2B,CAGzB,IAAIC,EAAgBx7D,CAAAkM,cAAA,CAAuB,UAAvB,CAAhBsvD,EACYx7D,CAAAkM,cAAA,CAAuB,eAAvB,CAEhB;GAAIsvD,CAAJ,CAAkB,CAChB,IAAIC,EAAiBD,CAAAhwD,aAAA,CAA0B,QAA1B,CAAjBiwD,EACUD,CAAAhwD,aAAA,CAA0B,aAA1B,CACduH,GAAAwoD,MAAA,CAAY,CACVhe,aAAc,CAACke,CAAfle,EAAgF,EAAhFA,GAAkCke,CAAA71D,QAAA,CAAuB,gBAAvB,CADxB,CAEV81D,cAAe,CAACD,CAAhBC,EAAkF,EAAlFA,GAAmCD,CAAA71D,QAAA,CAAuB,iBAAvB,CAFzB,CAHI,CAAlB,IAOO,CACLmN,CAAAA,CAAAA,EAUF,IAAI,CAEF,IAAIqV,QAAJ,CAAa,EAAb,CAEA,CAAA,CAAA,CAAO,CAAA,CAJL,CAKF,MAAOne,CAAP,CAAU,CACV,CAAA,CAAO,CAAA,CADG,CAfV8I,CAAAwoD,MAAA,CAAY,CACVhe,aAAc,CADJ,CAEVme,cAAe,CAAA,CAFL,CADP,CAbkB,CAqB3B,MAAO3oD,GAAAwoD,MAtBY,CA7arB,CAufI5sD,GAAKA,QAAQ,EAAG,CAClB,GAAIrK,CAAA,CAAUqK,EAAAgtD,MAAV,CAAJ,CAAyB,MAAOhtD,GAAAgtD,MAChC,KAAIC,CAAJ,CACIl6D,CADJ,CACOY,EAAKiJ,EAAA9K,OADZ,CACmCqL,CADnC,CAC2CC,CAC3C,KAAKrK,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgBY,CAAhB,CAAoB,EAAEZ,CAAtB,CAEE,GADAoK,CACI,CADKP,EAAA,CAAe7J,CAAf,CACL,CAAAk6D,CAAA,CAAK57D,CAAAkM,cAAA,CAAuB,GAAvB,CAA6BJ,CAAA5C,QAAA,CAAe,GAAf,CAAoB,KAApB,CAA7B,CAA0D,KAA1D,CAAT,CAA2E,CACzE6C,CAAA,CAAO6vD,CAAApwD,aAAA,CAAgBM,CAAhB,CAAyB,IAAzB,CACP,MAFyE,CAM7E,MAAQ6C,GAAAgtD,MAAR,CAAmB5vD,CAZD,CAvfpB,CAmnBI5C,GAAa,IAnnBjB,CA6wBIoC,GAAiB,CAAC,KAAD;AAAQ,UAAR,CAAoB,KAApB,CAA2B,OAA3B,CA7wBrB,CA4kCI4C,GAAoB,QA5kCxB,CAolCIM,GAAkB,CAAA,CAplCtB,CA2uCInE,GAAiB,CA3uCrB,CAsuDIsI,GAAU,CACZipD,KAAM,OADM,CAEZC,MAAO,CAFK,CAGZC,MAAO,CAHK,CAIZC,IAAK,CAJO,CAKZC,SAAU,0BALE,CA0QdvsD,EAAAwsD,QAAA,CAAiB,OA9nFsB,KAgoFnCh7C,GAAUxR,CAAA8X,MAAVtG,CAAyB,EAhoFU,CAioFnCE,GAAO,CAWX1R,EAAAH,MAAA,CAAe4sD,QAAQ,CAACp3D,CAAD,CAAO,CAE5B,MAAO,KAAAyiB,MAAA,CAAWziB,CAAA,CAAK,IAAAm3D,QAAL,CAAX,CAAP,EAAyC,EAFb,CAQ9B,KAAIx+C,GAAuB,iBAA3B,CACII,GAAkB,aADtB,CAEIiD,GAAiB,CAAEq7C,WAAY,UAAd,CAA0BC,WAAY,WAAtC,CAFrB,CAGI18C,GAAezf,CAAA,CAAO,QAAP,CAHnB,CAkBI2f,GAAoB,+BAlBxB,CAmBIvB,GAAc,WAnBlB,CAoBIG,GAAkB,YApBtB,CAqBIM,GAAmB,0EArBvB,CAuBIH,GAAU,CACZ,OAAU,CAAC,CAAD,CAAI,8BAAJ;AAAoC,WAApC,CADE,CAGZ,MAAS,CAAC,CAAD,CAAI,SAAJ,CAAe,UAAf,CAHG,CAIZ,IAAO,CAAC,CAAD,CAAI,mBAAJ,CAAyB,qBAAzB,CAJK,CAKZ,GAAM,CAAC,CAAD,CAAI,gBAAJ,CAAsB,kBAAtB,CALM,CAMZ,GAAM,CAAC,CAAD,CAAI,oBAAJ,CAA0B,uBAA1B,CANM,CAOZ,SAAY,CAAC,CAAD,CAAI,EAAJ,CAAQ,EAAR,CAPA,CAUdA,GAAA09C,SAAA,CAAmB19C,EAAA1K,OACnB0K,GAAA29C,MAAA,CAAgB39C,EAAA49C,MAAhB,CAAgC59C,EAAA69C,SAAhC,CAAmD79C,EAAA89C,QAAnD,CAAqE99C,EAAA+9C,MACrE/9C,GAAAg+C,GAAA,CAAah+C,EAAAi+C,GA2Fb,KAAIh4C,GAAiBi4C,IAAAz0C,UAAA00C,SAAjBl4C,EAA4C,QAAQ,CAACjV,CAAD,CAAM,CAE5D,MAAO,CAAG,EAAA,IAAAotD,wBAAA,CAA6BptD,CAA7B,CAAA,CAAoC,EAApC,CAFkD,CAA9D,CAqQId,GAAkBY,CAAA2Y,UAAlBvZ,CAAqC,CACvCmuD,MAAOA,QAAQ,CAAC/0D,CAAD,CAAK,CAGlBg1D,QAASA,EAAO,EAAG,CACbC,CAAJ,GACAA,CACA,CADQ,CAAA,CACR,CAAAj1D,CAAA,EAFA,CADiB,CAFnB,IAAIi1D,EAAQ,CAAA,CASgB,WAA5B,GAAIn9D,CAAAgjB,WAAJ,CACEC,UAAA,CAAWi6C,CAAX,CADF,EAGE,IAAAruD,GAAA,CAAQ,kBAAR;AAA4BquD,CAA5B,CAGA,CAAAxtD,CAAA,CAAO3P,CAAP,CAAA8O,GAAA,CAAkB,MAAlB,CAA0BquD,CAA1B,CANF,CAVkB,CADmB,CAqBvC94D,SAAUA,QAAQ,EAAG,CACnB,IAAIvC,EAAQ,EACZf,EAAA,CAAQ,IAAR,CAAc,QAAQ,CAACmJ,CAAD,CAAI,CAAEpI,CAAAqE,KAAA,CAAW,EAAX,CAAgB+D,CAAhB,CAAF,CAA1B,CACA,OAAO,GAAP,CAAapI,CAAAoJ,KAAA,CAAW,IAAX,CAAb,CAAgC,GAHb,CArBkB,CA2BvCy3C,GAAIA,QAAQ,CAAC/8C,CAAD,CAAQ,CAChB,MAAiB,EAAV,EAACA,CAAD,CAAenF,CAAA,CAAO,IAAA,CAAKmF,CAAL,CAAP,CAAf,CAAqCnF,CAAA,CAAO,IAAA,CAAK,IAAAC,OAAL,CAAmBkF,CAAnB,CAAP,CAD5B,CA3BmB,CA+BvClF,OAAQ,CA/B+B,CAgCvCyF,KAAMA,EAhCiC,CAiCvCzE,KAAM,EAAAA,KAjCiC,CAkCvCoE,OAAQ,EAAAA,OAlC+B,CArQzC,CA+SIud,GAAe,EACnBtiB,EAAA,CAAQ,2DAAA,MAAA,CAAA,GAAA,CAAR,CAAgF,QAAQ,CAACe,CAAD,CAAQ,CAC9FuhB,EAAA,CAAa5d,CAAA,CAAU3D,CAAV,CAAb,CAAA,CAAiCA,CAD6D,CAAhG,CAGA,KAAIwhB,GAAmB,EACvBviB,EAAA,CAAQ,kDAAA,MAAA,CAAA,GAAA,CAAR,CAAuE,QAAQ,CAACe,CAAD,CAAQ,CACrFwhB,EAAA,CAAiBxhB,CAAjB,CAAA,CAA0B,CAAA,CAD2D,CAAvF,CAGA,KAAI0hC,GAAe,CACjB,YAAe,WADE,CAEjB,YAAe,WAFE,CAGjB,MAAS,KAHQ,CAIjB,MAAS,KAJQ;AAKjB,UAAa,SALI,CAoBnBziC,EAAA,CAAQ,CACNqM,KAAMkU,EADA,CAEN+7C,WAAYl9C,EAFN,CAGNshB,QA3ZF67B,QAAsB,CAACt4D,CAAD,CAAO,CAC3B,IAAS9D,IAAAA,CAAT,GAAgBigB,GAAA,CAAQnc,CAAAkc,MAAR,CAAhB,CACE,MAAO,CAAA,CAET,OAAO,CAAA,CAJoB,CAwZrB,CAIN/R,UArZFouD,QAAwB,CAAC/sD,CAAD,CAAQ,CAC9B,IAD8B,IACrB7O,EAAI,CADiB,CACdY,EAAKiO,CAAA9P,OAArB,CAAmCiB,CAAnC,CAAuCY,CAAvC,CAA2CZ,CAAA,EAA3C,CACEwe,EAAA,CAAiB3P,CAAA,CAAM7O,CAAN,CAAjB,CAF4B,CAiZxB,CAAR,CAKG,QAAQ,CAACwG,CAAD,CAAK6D,CAAL,CAAW,CACpB2D,CAAA,CAAO3D,CAAP,CAAA,CAAe7D,CADK,CALtB,CASApH,EAAA,CAAQ,CACNqM,KAAMkU,EADA,CAENpS,cAAemT,EAFT,CAINpV,MAAOA,QAAQ,CAACzH,CAAD,CAAU,CAEvB,MAAO/E,EAAA2M,KAAA,CAAY5H,CAAZ,CAAqB,QAArB,CAAP,EAAyC6c,EAAA,CAAoB7c,CAAAga,WAApB,EAA0Cha,CAA1C,CAAmD,CAAC,eAAD,CAAkB,QAAlB,CAAnD,CAFlB,CAJnB,CASNwJ,aAAcA,QAAQ,CAACxJ,CAAD,CAAU,CAE9B,MAAO/E,EAAA2M,KAAA,CAAY5H,CAAZ,CAAqB,eAArB,CAAP,EAAgD/E,CAAA2M,KAAA,CAAY5H,CAAZ,CAAqB,yBAArB,CAFlB,CAT1B,CAcNyJ,WAAYmT,EAdN,CAgBN5V,SAAUA,QAAQ,CAAChH,CAAD,CAAU,CAC1B,MAAO6c,GAAA,CAAoB7c,CAApB,CAA6B,WAA7B,CADmB,CAhBtB,CAoBNy+B,WAAYA,QAAQ,CAACz+B,CAAD,CAAUwG,CAAV,CAAgB,CAClCxG,CAAAg4D,gBAAA,CAAwBxxD,CAAxB,CADkC,CApB9B;AAwBNiZ,SAAUvD,EAxBJ,CA0BN+7C,IAAKA,QAAQ,CAACj4D,CAAD,CAAUwG,CAAV,CAAgBlK,CAAhB,CAAuB,CAClCkK,CAAA,CAAO0R,EAAA,CAAU1R,CAAV,CAEP,IAAIzH,CAAA,CAAUzC,CAAV,CAAJ,CACE0D,CAAAyO,MAAA,CAAcjI,CAAd,CAAA,CAAsBlK,CADxB,KAGE,OAAO0D,EAAAyO,MAAA,CAAcjI,CAAd,CANyB,CA1B9B,CAoCN9G,KAAMA,QAAQ,CAACM,CAAD,CAAUwG,CAAV,CAAgBlK,CAAhB,CAAuB,CACnC,IAAIwI,EAAW9E,CAAA8E,SACf,IAAIA,CAAJ,GAAiBC,EAAjB,EApxCsBmzD,CAoxCtB,GAAmCpzD,CAAnC,EAlxCoB8tB,CAkxCpB,GAAuE9tB,CAAvE,CAIA,GADIqzD,CACA,CADiBl4D,CAAA,CAAUuG,CAAV,CACjB,CAAAqX,EAAA,CAAas6C,CAAb,CAAJ,CACE,GAAIp5D,CAAA,CAAUzC,CAAV,CAAJ,CACQA,CAAN,EACE0D,CAAA,CAAQwG,CAAR,CACA,CADgB,CAAA,CAChB,CAAAxG,CAAAsc,aAAA,CAAqB9V,CAArB,CAA2B2xD,CAA3B,CAFF,GAIEn4D,CAAA,CAAQwG,CAAR,CACA,CADgB,CAAA,CAChB,CAAAxG,CAAAg4D,gBAAA,CAAwBG,CAAxB,CALF,CADF,KASE,OAAQn4D,EAAA,CAAQwG,CAAR,CAAD,EACE4xD,CAACp4D,CAAA4tB,WAAAyqC,aAAA,CAAgC7xD,CAAhC,CAAD4xD,EAA0C55D,CAA1C45D,WADF,CAEED,CAFF,CAGEz9D,CAbb,KAeO,IAAIqE,CAAA,CAAUzC,CAAV,CAAJ,CACL0D,CAAAsc,aAAA,CAAqB9V,CAArB,CAA2BlK,CAA3B,CADK,KAEA,IAAI0D,CAAAiG,aAAJ,CAKL,MAFIqyD,EAEG,CAFGt4D,CAAAiG,aAAA,CAAqBO,CAArB,CAA2B,CAA3B,CAEH,CAAQ,IAAR,GAAA8xD,CAAA,CAAe59D,CAAf,CAA2B49D,CA5BD,CApC/B,CAoEN74D,KAAMA,QAAQ,CAACO,CAAD,CAAUwG,CAAV,CAAgBlK,CAAhB,CAAuB,CACnC,GAAIyC,CAAA,CAAUzC,CAAV,CAAJ,CACE0D,CAAA,CAAQwG,CAAR,CAAA,CAAgBlK,CADlB,KAGE,OAAO0D,EAAA,CAAQwG,CAAR,CAJ0B,CApE/B,CA4EN4zB,KAAO,QAAQ,EAAG,CAIhBm+B,QAASA,EAAO,CAACv4D,CAAD,CAAU1D,CAAV,CAAiB,CAC/B,GAAIwC,CAAA,CAAYxC,CAAZ,CAAJ,CAAwB,CACtB,IAAIwI,EAAW9E,CAAA8E,SACf;MAl0CgB2T,EAk0CT,GAAC3T,CAAD,EAAmCA,CAAnC,GAAgDC,EAAhD,CAAkE/E,CAAA4Z,YAAlE,CAAwF,EAFzE,CAIxB5Z,CAAA4Z,YAAA,CAAsBtd,CALS,CAHjCi8D,CAAAC,IAAA,CAAc,EACd,OAAOD,EAFS,CAAZ,EA5EA,CAyFNv1D,IAAKA,QAAQ,CAAChD,CAAD,CAAU1D,CAAV,CAAiB,CAC5B,GAAIwC,CAAA,CAAYxC,CAAZ,CAAJ,CAAwB,CACtB,GAAI0D,CAAAy4D,SAAJ,EAA+C,QAA/C,GAAwB14D,EAAA,CAAUC,CAAV,CAAxB,CAAyD,CACvD,IAAIqhB,EAAS,EACb9lB,EAAA,CAAQyE,CAAA0lB,QAAR,CAAyB,QAAQ,CAAC/W,CAAD,CAAS,CACpCA,CAAA+pD,SAAJ,EACEr3C,CAAA1gB,KAAA,CAAYgO,CAAArS,MAAZ,EAA4BqS,CAAAyrB,KAA5B,CAFsC,CAA1C,CAKA,OAAyB,EAAlB,GAAA/Y,CAAAnmB,OAAA,CAAsB,IAAtB,CAA6BmmB,CAPmB,CASzD,MAAOrhB,EAAA1D,MAVe,CAYxB0D,CAAA1D,MAAA,CAAgBA,CAbY,CAzFxB,CAyGNuI,KAAMA,QAAQ,CAAC7E,CAAD,CAAU1D,CAAV,CAAiB,CAC7B,GAAIwC,CAAA,CAAYxC,CAAZ,CAAJ,CACE,MAAO0D,EAAAuZ,UAETkB,GAAA,CAAaza,CAAb,CAAsB,CAAA,CAAtB,CACAA,EAAAuZ,UAAA,CAAoBjd,CALS,CAzGzB,CAiHNmI,MAAOyY,EAjHD,CAAR,CAkHG,QAAQ,CAACva,CAAD,CAAK6D,CAAL,CAAW,CAIpB2D,CAAA2Y,UAAA,CAAiBtc,CAAjB,CAAA,CAAyB,QAAQ,CAAC8qC,CAAD,CAAOC,CAAP,CAAa,CAAA,IACxCp1C,CADwC,CACrCT,CADqC,CAExCi9D,EAAY,IAAAz9D,OAKhB,IAAIyH,CAAJ,GAAWua,EAAX,EACKpe,CAAA,CAA0B,CAAd,EAAC6D,CAAAzH,OAAD,EAAoByH,CAApB,GAA2BuZ,EAA3B,EAA6CvZ,CAA7C,GAAoDia,EAApD,CAAyE00B,CAAzE,CAAgFC,CAA5F,CADL,CACyG,CACvG,GAAIv0C,CAAA,CAASs0C,CAAT,CAAJ,CAAoB,CAGlB,IAAKn1C,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgBw8D,CAAhB,CAA2Bx8D,CAAA,EAA3B,CACE,GAAIwG,CAAJ,GAAWmZ,EAAX,CAEEnZ,CAAA,CAAG,IAAA,CAAKxG,CAAL,CAAH,CAAYm1C,CAAZ,CAFF,KAIE,KAAK51C,CAAL,GAAY41C,EAAZ,CACE3uC,CAAA,CAAG,IAAA,CAAKxG,CAAL,CAAH;AAAYT,CAAZ,CAAiB41C,CAAA,CAAK51C,CAAL,CAAjB,CAKN,OAAO,KAdW,CAkBdY,CAAAA,CAAQqG,CAAA61D,IAERt7D,EAAAA,CAAM4B,CAAA,CAAYxC,CAAZ,CAAD,CAAuBg8B,IAAAixB,IAAA,CAASoP,CAAT,CAAoB,CAApB,CAAvB,CAAgDA,CACzD,KAAS17D,CAAT,CAAa,CAAb,CAAgBA,CAAhB,CAAoBC,CAApB,CAAwBD,CAAA,EAAxB,CAA6B,CAC3B,IAAIwxB,EAAY9rB,CAAA,CAAG,IAAA,CAAK1F,CAAL,CAAH,CAAYq0C,CAAZ,CAAkBC,CAAlB,CAChBj1C,EAAA,CAAQA,CAAA,CAAQA,CAAR,CAAgBmyB,CAAhB,CAA4BA,CAFT,CAI7B,MAAOnyB,EA1B8F,CA8BvG,IAAKH,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgBw8D,CAAhB,CAA2Bx8D,CAAA,EAA3B,CACEwG,CAAA,CAAG,IAAA,CAAKxG,CAAL,CAAH,CAAYm1C,CAAZ,CAAkBC,CAAlB,CAGF,OAAO,KA1CmC,CAJ1B,CAlHtB,CA8OAh2C,EAAA,CAAQ,CACNs8D,WAAYl9C,EADN,CAGNrR,GAAIsvD,QAAiB,CAAC54D,CAAD,CAAUgb,CAAV,CAAgBrY,CAAhB,CAAoBsY,CAApB,CAAiC,CACpD,GAAIlc,CAAA,CAAUkc,CAAV,CAAJ,CAA4B,KAAMb,GAAA,CAAa,QAAb,CAAN,CAG5B,GAAK5B,EAAA,CAAkBxY,CAAlB,CAAL,CAAA,CAIIkb,CAAAA,CAAeC,EAAA,CAAmBnb,CAAnB,CAA4B,CAAA,CAA5B,CACnB,KAAI8J,EAASoR,CAAApR,OAAb,CACIsR,EAASF,CAAAE,OAERA,EAAL,GACEA,CADF,CACWF,CAAAE,OADX,CACiC2C,EAAA,CAAmB/d,CAAnB,CAA4B8J,CAA5B,CADjC,CAKI+uD,EAAAA,CAA6B,CAArB,EAAA79C,CAAA3a,QAAA,CAAa,GAAb,CAAA,CAAyB2a,CAAAlb,MAAA,CAAW,GAAX,CAAzB,CAA2C,CAACkb,CAAD,CAiBvD,KAhBA,IAAI7e,EAAI08D,CAAA39D,OAAR,CAEI49D,EAAaA,QAAQ,CAAC99C,CAAD,CAAO+D,CAAP,CAA8Bg6C,CAA9B,CAA+C,CACtE,IAAI16C,EAAWvU,CAAA,CAAOkR,CAAP,CAEVqD,EAAL,GACEA,CAEA,CAFWvU,CAAA,CAAOkR,CAAP,CAEX,CAF0B,EAE1B,CADAqD,CAAAU,sBACA,CADiCA,CACjC,CAAa,UAAb,GAAI/D,CAAJ,EAA4B+9C,CAA5B,EACqB/4D,CA/uBvBonC,iBAAA,CA+uBgCpsB,CA/uBhC,CA+uBsCI,CA/uBtC,CAAmC,CAAA,CAAnC,CA2uBA,CAQAiD,EAAA1d,KAAA,CAAcgC,CAAd,CAXsE,CAcxE,CAAOxG,CAAA,EAAP,CAAA,CACE6e,CACA,CADO69C,CAAA,CAAM18D,CAAN,CACP,CAAIqf,EAAA,CAAgBR,CAAhB,CAAJ,EACE89C,CAAA,CAAWt9C,EAAA,CAAgBR,CAAhB,CAAX,CAAkCkE,EAAlC,CACA;AAAA45C,CAAA,CAAW99C,CAAX,CAAiBtgB,CAAjB,CAA4B,CAAA,CAA5B,CAFF,EAIEo+D,CAAA,CAAW99C,CAAX,CApCJ,CAJoD,CAHhD,CAgDNoN,IAAKrN,EAhDC,CAkDNi+C,IAAKA,QAAQ,CAACh5D,CAAD,CAAUgb,CAAV,CAAgBrY,CAAhB,CAAoB,CAC/B3C,CAAA,CAAU/E,CAAA,CAAO+E,CAAP,CAKVA,EAAAsJ,GAAA,CAAW0R,CAAX,CAAiBi+C,QAASA,EAAI,EAAG,CAC/Bj5D,CAAAooB,IAAA,CAAYpN,CAAZ,CAAkBrY,CAAlB,CACA3C,EAAAooB,IAAA,CAAYpN,CAAZ,CAAkBi+C,CAAlB,CAF+B,CAAjC,CAIAj5D,EAAAsJ,GAAA,CAAW0R,CAAX,CAAiBrY,CAAjB,CAV+B,CAlD3B,CA+DNy0B,YAAaA,QAAQ,CAACp3B,CAAD,CAAUk5D,CAAV,CAAuB,CAAA,IACtC94D,CADsC,CAC/B/B,EAAS2B,CAAAga,WACpBS,GAAA,CAAaza,CAAb,CACAzE,EAAA,CAAQ,IAAI4O,CAAJ,CAAW+uD,CAAX,CAAR,CAAiC,QAAQ,CAAC15D,CAAD,CAAO,CAC1CY,CAAJ,CACE/B,CAAA86D,aAAA,CAAoB35D,CAApB,CAA0BY,CAAA+K,YAA1B,CADF,CAGE9M,CAAA4b,aAAA,CAAoBza,CAApB,CAA0BQ,CAA1B,CAEFI,EAAA,CAAQZ,CANsC,CAAhD,CAH0C,CA/DtC,CA4ENsyC,SAAUA,QAAQ,CAAC9xC,CAAD,CAAU,CAC1B,IAAI8xC,EAAW,EACfv2C,EAAA,CAAQyE,CAAA0Z,WAAR,CAA4B,QAAQ,CAAC1Z,CAAD,CAAU,CA3iD1ByY,CA4iDlB,GAAIzY,CAAA8E,SAAJ,EACEgtC,CAAAnxC,KAAA,CAAcX,CAAd,CAF0C,CAA9C,CAKA,OAAO8xC,EAPmB,CA5EtB,CAsFNva,SAAUA,QAAQ,CAACv3B,CAAD,CAAU,CAC1B,MAAOA,EAAAo5D,gBAAP,EAAkCp5D,CAAA0Z,WAAlC,EAAwD,EAD9B,CAtFtB,CA0FN9U,OAAQA,QAAQ,CAAC5E,CAAD,CAAUR,CAAV,CAAgB,CAC9B,IAAIsF,EAAW9E,CAAA8E,SACf,IAzjDoB2T,CAyjDpB,GAAI3T,CAAJ,EApjD8BkY,EAojD9B,GAAsClY,CAAtC,CAAA,CAEAtF,CAAA,CAAO,IAAI2K,CAAJ,CAAW3K,CAAX,CAEP,KAASrD,IAAAA,EAAI,CAAJA,CAAOY,EAAKyC,CAAAtE,OAArB,CAAkCiB,CAAlC,CAAsCY,CAAtC,CAA0CZ,CAAA,EAA1C,CAEE6D,CAAAgZ,YAAA,CADYxZ,CAAAu9C,CAAK5gD,CAAL4gD,CACZ,CANF,CAF8B,CA1F1B;AAsGNsc,QAASA,QAAQ,CAACr5D,CAAD,CAAUR,CAAV,CAAgB,CAC/B,GApkDoBiZ,CAokDpB,GAAIzY,CAAA8E,SAAJ,CAA4C,CAC1C,IAAI1E,EAAQJ,CAAA2Z,WACZpe,EAAA,CAAQ,IAAI4O,CAAJ,CAAW3K,CAAX,CAAR,CAA0B,QAAQ,CAACu9C,CAAD,CAAQ,CACxC/8C,CAAAm5D,aAAA,CAAqBpc,CAArB,CAA4B38C,CAA5B,CADwC,CAA1C,CAF0C,CADb,CAtG3B,CA+GNgZ,KAAMA,QAAQ,CAACpZ,CAAD,CAAUs5D,CAAV,CAAoB,CAChCx/C,EAAA,CAAe9Z,CAAf,CAAwB/E,CAAA,CAAOq+D,CAAP,CAAAnc,GAAA,CAAoB,CAApB,CAAAv/C,MAAA,EAAA,CAA+B,CAA/B,CAAxB,CADgC,CA/G5B,CAmHNusB,OAAQ/M,EAnHF,CAqHNm8C,OAAQA,QAAQ,CAACv5D,CAAD,CAAU,CACxBod,EAAA,CAAapd,CAAb,CAAsB,CAAA,CAAtB,CADwB,CArHpB,CAyHNw5D,MAAOA,QAAQ,CAACx5D,CAAD,CAAUy5D,CAAV,CAAsB,CAAA,IAC/Br5D,EAAQJ,CADuB,CACd3B,EAAS2B,CAAAga,WAC9By/C,EAAA,CAAa,IAAItvD,CAAJ,CAAWsvD,CAAX,CAEb,KAJmC,IAI1Bt9D,EAAI,CAJsB,CAInBY,EAAK08D,CAAAv+D,OAArB,CAAwCiB,CAAxC,CAA4CY,CAA5C,CAAgDZ,CAAA,EAAhD,CAAqD,CACnD,IAAIqD,EAAOi6D,CAAA,CAAWt9D,CAAX,CACXkC,EAAA86D,aAAA,CAAoB35D,CAApB,CAA0BY,CAAA+K,YAA1B,CACA/K,EAAA,CAAQZ,CAH2C,CAJlB,CAzH/B,CAoINmgB,SAAUnD,EApIJ,CAqINoD,YAAaxD,EArIP,CAuINs9C,YAAaA,QAAQ,CAAC15D,CAAD,CAAUmc,CAAV,CAAoBw9C,CAApB,CAA+B,CAC9Cx9C,CAAJ,EACE5gB,CAAA,CAAQ4gB,CAAArc,MAAA,CAAe,GAAf,CAAR,CAA6B,QAAQ,CAACmuB,CAAD,CAAY,CAC/C,IAAI2rC,EAAiBD,CACjB76D,EAAA,CAAY86D,CAAZ,CAAJ,GACEA,CADF,CACmB,CAAC19C,EAAA,CAAelc,CAAf,CAAwBiuB,CAAxB,CADpB,CAGA,EAAC2rC,CAAA,CAAiBp9C,EAAjB,CAAkCJ,EAAnC,EAAsDpc,CAAtD,CAA+DiuB,CAA/D,CAL+C,CAAjD,CAFgD,CAvI9C,CAmJN5vB,OAAQA,QAAQ,CAAC2B,CAAD,CAAU,CAExB,MAAO,CADH3B,CACG,CADM2B,CAAAga,WACN;AA7mDuBgD,EA6mDvB,GAAU3e,CAAAyG,SAAV,CAA4DzG,CAA5D,CAAqE,IAFpD,CAnJpB,CAwJNmhD,KAAMA,QAAQ,CAACx/C,CAAD,CAAU,CACtB,MAAOA,EAAA65D,mBADe,CAxJlB,CA4JNl6D,KAAMA,QAAQ,CAACK,CAAD,CAAUmc,CAAV,CAAoB,CAChC,MAAInc,EAAA85D,qBAAJ,CACS95D,CAAA85D,qBAAA,CAA6B39C,CAA7B,CADT,CAGS,EAJuB,CA5J5B,CAoKNve,MAAO4c,EApKD,CAsKNtQ,eAAgBA,QAAQ,CAAClK,CAAD,CAAUie,CAAV,CAAiB87C,CAAjB,CAAkC,CAAA,IAEpDC,CAFoD,CAE1BC,CAF0B,CAGpDva,EAAYzhC,CAAAjD,KAAZ0kC,EAA0BzhC,CAH0B,CAIpD/C,EAAeC,EAAA,CAAmBnb,CAAnB,CAInB,IAFIqe,CAEJ,EAHIvU,CAGJ,CAHaoR,CAGb,EAH6BA,CAAApR,OAG7B,GAFyBA,CAAA,CAAO41C,CAAP,CAEzB,CAEEsa,CAmBA,CAnBa,CACX/pB,eAAgBA,QAAQ,EAAG,CAAE,IAAA7xB,iBAAA,CAAwB,CAAA,CAA1B,CADhB,CAEXF,mBAAoBA,QAAQ,EAAG,CAAE,MAAiC,CAAA,CAAjC,GAAO,IAAAE,iBAAT,CAFpB,CAGXK,yBAA0BA,QAAQ,EAAG,CAAE,IAAAF,4BAAA,CAAmC,CAAA,CAArC,CAH1B,CAIXK,8BAA+BA,QAAQ,EAAG,CAAE,MAA4C,CAAA,CAA5C,GAAO,IAAAL,4BAAT,CAJ/B;AAKXI,gBAAiBngB,CALN,CAMXwc,KAAM0kC,CANK,CAOXvgC,OAAQnf,CAPG,CAmBb,CARIie,CAAAjD,KAQJ,GAPEg/C,CAOF,CAPen8D,CAAA,CAAOm8D,CAAP,CAAmB/7C,CAAnB,CAOf,EAHAi8C,CAGA,CAHet4D,EAAA,CAAYyc,CAAZ,CAGf,CAFA47C,CAEA,CAFcF,CAAA,CAAkB,CAACC,CAAD,CAAA13D,OAAA,CAAoBy3D,CAApB,CAAlB,CAAyD,CAACC,CAAD,CAEvE,CAAAz+D,CAAA,CAAQ2+D,CAAR,CAAsB,QAAQ,CAACv3D,CAAD,CAAK,CAC5Bq3D,CAAAp7C,8BAAA,EAAL,EACEjc,CAAAG,MAAA,CAAS9C,CAAT,CAAkBi6D,CAAlB,CAF+B,CAAnC,CA7BsD,CAtKpD,CAAR,CA0MG,QAAQ,CAACt3D,CAAD,CAAK6D,CAAL,CAAW,CAIpB2D,CAAA2Y,UAAA,CAAiBtc,CAAjB,CAAA,CAAyB,QAAQ,CAAC8qC,CAAD,CAAOC,CAAP,CAAa4oB,CAAb,CAAmB,CAGlD,IAFA,IAAI79D,CAAJ,CAESH,EAAI,CAFb,CAEgBY,EAAK,IAAA7B,OAArB,CAAkCiB,CAAlC,CAAsCY,CAAtC,CAA0CZ,CAAA,EAA1C,CACM2C,CAAA,CAAYxC,CAAZ,CAAJ,EACEA,CACA,CADQqG,CAAA,CAAG,IAAA,CAAKxG,CAAL,CAAH,CAAYm1C,CAAZ,CAAkBC,CAAlB,CAAwB4oB,CAAxB,CACR,CAAIp7D,CAAA,CAAUzC,CAAV,CAAJ,GAEEA,CAFF,CAEUrB,CAAA,CAAOqB,CAAP,CAFV,CAFF,EAOEie,EAAA,CAAeje,CAAf,CAAsBqG,CAAA,CAAG,IAAA,CAAKxG,CAAL,CAAH,CAAYm1C,CAAZ,CAAkBC,CAAlB,CAAwB4oB,CAAxB,CAAtB,CAGJ,OAAOp7D,EAAA,CAAUzC,CAAV,CAAA,CAAmBA,CAAnB,CAA2B,IAdgB,CAkBpD6N,EAAA2Y,UAAArgB,KAAA,CAAwB0H,CAAA2Y,UAAAxZ,GACxBa,EAAA2Y,UAAAs3C,OAAA,CAA0BjwD,CAAA2Y,UAAAsF,IAvBN,CA1MtB,CAqSApI,GAAA8C,UAAA,CAAoB,CAMlB3C,IAAKA,QAAQ,CAACzkB,CAAD,CAAMY,CAAN,CAAa,CACxB,IAAA,CAAKujB,EAAA,CAAQnkB,CAAR,CAAa,IAAAa,QAAb,CAAL,CAAA,CAAmCD,CADX,CANR,CAclBmM,IAAKA,QAAQ,CAAC/M,CAAD,CAAM,CACjB,MAAO,KAAA,CAAKmkB,EAAA,CAAQnkB,CAAR,CAAa,IAAAa,QAAb,CAAL,CADU,CAdD,CAsBlB4tB,OAAQA,QAAQ,CAACzuB,CAAD,CAAM,CACpB,IAAIY;AAAQ,IAAA,CAAKZ,CAAL,CAAWmkB,EAAA,CAAQnkB,CAAR,CAAa,IAAAa,QAAb,CAAX,CACZ,QAAO,IAAA,CAAKb,CAAL,CACP,OAAOY,EAHa,CAtBJ,CA6BpB,KAAIyb,GAAoB,CAAC,QAAQ,EAAG,CAClC,IAAAwH,KAAA,CAAY,CAAC,QAAQ,EAAG,CACtB,MAAOS,GADe,CAAZ,CADsB,CAAZ,CAAxB,CAoEIO,GAAY,cApEhB,CAqEIC,GAAU,yBArEd,CAsEI65C,GAAe,GAtEnB,CAuEIC,GAAS,sBAvEb,CAwEIh6C,GAAiB,kCAxErB,CAyEI/U,GAAkB5Q,CAAA,CAAO,WAAP,CAszBtB2M,GAAAqb,WAAA,CApyBAM,QAAiB,CAACtgB,CAAD,CAAKiE,CAAL,CAAeJ,CAAf,CAAqB,CAAA,IAChCkc,CAIJ,IAAkB,UAAlB,GAAI,MAAO/f,EAAX,CACE,IAAM,EAAA+f,CAAA,CAAU/f,CAAA+f,QAAV,CAAN,CAA6B,CAC3BA,CAAA,CAAU,EACV,IAAI/f,CAAAzH,OAAJ,CAAe,CACb,GAAI0L,CAAJ,CAIE,KAHK5L,EAAA,CAASwL,CAAT,CAGC,EAHkBA,CAGlB,GAFJA,CAEI,CAFG7D,CAAA6D,KAEH,EAFcia,EAAA,CAAO9d,CAAP,CAEd,EAAA4I,EAAA,CAAgB,UAAhB,CACyE/E,CADzE,CAAN,CAGF+zD,CAAA,CAAUn6C,EAAA,CAAYzd,CAAZ,CACVpH,EAAA,CAAQg/D,CAAA,CAAQ,CAAR,CAAAz6D,MAAA,CAAiBu6D,EAAjB,CAAR,CAAwC,QAAQ,CAAChwD,CAAD,CAAM,CACpDA,CAAA1G,QAAA,CAAY22D,EAAZ,CAAoB,QAAQ,CAACrgB,CAAD,CAAMugB,CAAN,CAAkBh0D,CAAlB,CAAwB,CAClDkc,CAAA/hB,KAAA,CAAa6F,CAAb,CADkD,CAApD,CADoD,CAAtD,CATa,CAef7D,CAAA+f,QAAA,CAAaA,CAjBc,CAA7B,CADF,IAoBW3nB,EAAA,CAAQ4H,CAAR,CAAJ;CACLu6C,CAEA,CAFOv6C,CAAAzH,OAEP,CAFmB,CAEnB,CADAqP,EAAA,CAAY5H,CAAA,CAAGu6C,CAAH,CAAZ,CAAsB,IAAtB,CACA,CAAAx6B,CAAA,CAAU/f,CAAA7E,MAAA,CAAS,CAAT,CAAYo/C,CAAZ,CAHL,EAKL3yC,EAAA,CAAY5H,CAAZ,CAAgB,IAAhB,CAAsB,CAAA,CAAtB,CAEF,OAAO+f,EAhC6B,CAqjCtC,KAAI+3C,GAAiB9/D,CAAA,CAAO,UAAP,CAArB,CAqDIgZ,GAA0BA,QAAQ,EAAG,CACvC,IAAA4L,KAAA,CAAYC,QAAQ,EAAG,EADgB,CArDzC,CA2DI3L,GAA6BA,QAAQ,EAAG,CAC1C,IAAI4rC,EAAkB,IAAIz/B,EAA1B,CACI06C,EAAqB,EAEzB,KAAAn7C,KAAA,CAAY,CAAC,iBAAD,CAAoB,YAApB,CACP,QAAQ,CAACzL,CAAD,CAAoBsC,CAApB,CAAgC,CA4B3CukD,QAASA,EAAU,CAAC/yD,CAAD,CAAO8X,CAAP,CAAgBpjB,CAAhB,CAAuB,CACxC,IAAI86C,EAAU,CAAA,CACV13B,EAAJ,GACEA,CAEA,CAFU1kB,CAAA,CAAS0kB,CAAT,CAAA,CAAoBA,CAAA5f,MAAA,CAAc,GAAd,CAApB,CACA/E,CAAA,CAAQ2kB,CAAR,CAAA,CAAmBA,CAAnB,CAA6B,EACvC,CAAAnkB,CAAA,CAAQmkB,CAAR,CAAiB,QAAQ,CAACuO,CAAD,CAAY,CAC/BA,CAAJ,GACEmpB,CACA,CADU,CAAA,CACV,CAAAxvC,CAAA,CAAKqmB,CAAL,CAAA,CAAkB3xB,CAFpB,CADmC,CAArC,CAHF,CAUA,OAAO86C,EAZiC,CAe1CwjB,QAASA,EAAqB,EAAG,CAC/Br/D,CAAA,CAAQm/D,CAAR,CAA4B,QAAQ,CAAC16D,CAAD,CAAU,CAC5C,IAAI4H,EAAO63C,CAAAh3C,IAAA,CAAoBzI,CAApB,CACX,IAAI4H,CAAJ,CAAU,CACR,IAAIizD,EAAWt1C,EAAA,CAAavlB,CAAAN,KAAA,CAAa,OAAb,CAAb,CAAf,CACIg+B,EAAQ,EADZ,CAEIE,EAAW,EACfriC,EAAA,CAAQqM,CAAR,CAAc,QAAQ,CAACk6B,CAAD,CAAS7T,CAAT,CAAoB,CAEpC6T,CAAJ,GADeriB,CAAE,CAAAo7C,CAAA,CAAS5sC,CAAT,CACjB,GACM6T,CAAJ,CACEpE,CADF,GACYA,CAAAxiC,OAAA,CAAe,GAAf,CAAqB,EADjC,EACuC+yB,CADvC,CAGE2P,CAHF,GAGeA,CAAA1iC,OAAA,CAAkB,GAAlB,CAAwB,EAHvC,EAG6C+yB,CAJ/C,CAFwC,CAA1C,CAWA1yB,EAAA,CAAQyE,CAAR,CAAiB,QAAQ,CAAC8kB,CAAD,CAAM,CAC7B4Y,CAAA;AAAYlhB,EAAA,CAAesI,CAAf,CAAoB4Y,CAApB,CACZE,EAAA,EAAYxhB,EAAA,CAAkB0I,CAAlB,CAAuB8Y,CAAvB,CAFiB,CAA/B,CAIA6hB,EAAAt1B,OAAA,CAAuBnqB,CAAvB,CAnBQ,CAFkC,CAA9C,CAwBA06D,EAAAx/D,OAAA,CAA4B,CAzBG,CA1CjC,MAAO,CACLuyB,QAASjvB,CADJ,CAEL8K,GAAI9K,CAFC,CAGL4pB,IAAK5pB,CAHA,CAILs8D,IAAKt8D,CAJA,CAMLmC,KAAMA,QAAQ,CAACX,CAAD,CAAUie,CAAV,CAAiByH,CAAjB,CAA0Bq1C,CAA1B,CAAwC,CACpDA,CAAA,EAAuBA,CAAA,EAEvBr1C,EAAA,CAAUA,CAAV,EAAqB,EACrBA,EAAAs1C,KAAA,EAAuBh7D,CAAAi4D,IAAA,CAAYvyC,CAAAs1C,KAAZ,CACvBt1C,EAAAu1C,GAAA,EAAuBj7D,CAAAi4D,IAAA,CAAYvyC,CAAAu1C,GAAZ,CAEvB,IAAIv1C,CAAA/F,SAAJ,EAAwB+F,CAAA9F,YAAxB,CAgEF,GA/DwCD,CA+DpC,CA/DoC+F,CAAA/F,SA+DpC,CA/DsDC,CA+DtD,CA/DsD8F,CAAA9F,YA+DtD,CALAhY,CAKA,CALO63C,CAAAh3C,IAAA,CA1DoBzI,CA0DpB,CAKP,EALuC,EAKvC,CAHAk7D,CAGA,CAHeP,CAAA,CAAW/yD,CAAX,CAAiBuzD,CAAjB,CAAsB,CAAA,CAAtB,CAGf,CAFAC,CAEA,CAFiBT,CAAA,CAAW/yD,CAAX,CAAiBuiB,CAAjB,CAAyB,CAAA,CAAzB,CAEjB,CAAA+wC,CAAA,EAAgBE,CAApB,CAEE3b,CAAAt/B,IAAA,CAjE6BngB,CAiE7B,CAA6B4H,CAA7B,CAGA,CAFA8yD,CAAA/5D,KAAA,CAlE6BX,CAkE7B,CAEA,CAAkC,CAAlC,GAAI06D,CAAAx/D,OAAJ,EACEkb,CAAAohC,aAAA,CAAwBojB,CAAxB,CAlEES,EAAAA,CAAS,IAAIvnD,CAIjBunD,EAAAC,SAAA,EACA,OAAOD,EAhB6C,CANjD,CADoC,CADjC,CAJ8B,CA3D5C,CAuKI9nD,GAAmB,CAAC,UAAD,CAAa,QAAQ,CAACpM,CAAD,CAAW,CACrD,IAAIyE,EAAW,IAEf,KAAA2vD,uBAAA,CAA8BpgE,MAAAoD,OAAA,CAAc,IAAd,CAyC9B,KAAAmhC,SAAA,CAAgBC,QAAQ,CAACn5B,CAAD,CAAO8E,CAAP,CAAgB,CACtC,GAAI9E,CAAJ,EAA+B,GAA/B,GAAYA,CAAA3E,OAAA,CAAY,CAAZ,CAAZ,CACE,KAAM44D,GAAA,CAAe,SAAf;AAAmFj0D,CAAnF,CAAN,CAGF,IAAI9K,EAAM8K,CAAN9K,CAAa,YACjBkQ,EAAA2vD,uBAAA,CAAgC/0D,CAAAqhB,OAAA,CAAY,CAAZ,CAAhC,CAAA,CAAkDnsB,CAClDyL,EAAAmE,QAAA,CAAiB5P,CAAjB,CAAsB4P,CAAtB,CAPsC,CAwBxC,KAAAkwD,gBAAA,CAAuBC,QAAQ,CAAC17B,CAAD,CAAa,CAC1C,GAAyB,CAAzB,GAAIhiC,SAAA7C,OAAJ,GACE,IAAAwgE,kBADF,CAC4B37B,CAAD,WAAuBviC,OAAvB,CAAiCuiC,CAAjC,CAA8C,IADzE,GAGwB47B,4BAChBp8D,KAAA,CAAmB,IAAAm8D,kBAAA78D,SAAA,EAAnB,CAJR,CAKM,KAAM47D,GAAA,CAAe,SAAf,CA/OWmB,YA+OX,CAAN,CAKN,MAAO,KAAAF,kBAXmC,CAc5C,KAAAn8C,KAAA,CAAY,CAAC,gBAAD,CAAmB,QAAQ,CAAC3L,CAAD,CAAiB,CACtDioD,QAASA,EAAS,CAAC77D,CAAD,CAAU87D,CAAV,CAAyBC,CAAzB,CAAuC,CAIvD,GAAIA,CAAJ,CAAkB,CAChB,IAAIC,CAlPyB,EAAA,CAAA,CACnC,IAAS7/D,CAAT,CAAa,CAAb,CAAgBA,CAAhB,CAiPyC4/D,CAjPrB7gE,OAApB,CAAoCiB,CAAA,EAApC,CAAyC,CACvC,IAAI2oB,EAgPmCi3C,CAhP7B,CAAQ5/D,CAAR,CACV,IAfe8/D,CAef,GAAIn3C,CAAAhgB,SAAJ,CAAmC,CACjC,CAAA,CAAOggB,CAAP,OAAA,CADiC,CAFI,CADN,CAAA,CAAA,IAAA,EAAA,CAmPzBk3C,CAAAA,CAAJ,EAAkBA,CAAAhiD,WAAlB,EAA2CgiD,CAAAE,uBAA3C;CACEH,CADF,CACiB,IADjB,CAFgB,CAMlBA,CAAA,CAAeA,CAAAvC,MAAA,CAAmBx5D,CAAnB,CAAf,CAA6C87D,CAAAzC,QAAA,CAAsBr5D,CAAtB,CAVU,CAgCzD,MAAO,CA8BLsJ,GAAIsK,CAAAtK,GA9BC,CAwDL8e,IAAKxU,CAAAwU,IAxDA,CA0EL0yC,IAAKlnD,CAAAknD,IA1EA,CAyGLrtC,QAAS7Z,CAAA6Z,QAzGJ,CAmHL7E,OAAQA,QAAQ,CAACyyC,CAAD,CAAS,CACvBA,CAAAc,IAAA,EAAcd,CAAAc,IAAA,EADS,CAnHpB,CAyILC,MAAOA,QAAQ,CAACp8D,CAAD,CAAU3B,CAAV,CAAkBm7D,CAAlB,CAAyB9zC,CAAzB,CAAkC,CAC/CrnB,CAAA,CAASA,CAAT,EAAmBpD,CAAA,CAAOoD,CAAP,CACnBm7D,EAAA,CAAQA,CAAR,EAAiBv+D,CAAA,CAAOu+D,CAAP,CACjBn7D,EAAA,CAASA,CAAT,EAAmBm7D,CAAAn7D,OAAA,EACnBw9D,EAAA,CAAU77D,CAAV,CAAmB3B,CAAnB,CAA2Bm7D,CAA3B,CACA,OAAO5lD,EAAAjT,KAAA,CAAoBX,CAApB,CAA6B,OAA7B,CAAsCylB,EAAA,CAAsBC,CAAtB,CAAtC,CALwC,CAzI5C,CAmKL22C,KAAMA,QAAQ,CAACr8D,CAAD,CAAU3B,CAAV,CAAkBm7D,CAAlB,CAAyB9zC,CAAzB,CAAkC,CAC9CrnB,CAAA,CAASA,CAAT,EAAmBpD,CAAA,CAAOoD,CAAP,CACnBm7D,EAAA,CAAQA,CAAR,EAAiBv+D,CAAA,CAAOu+D,CAAP,CACjBn7D,EAAA,CAASA,CAAT,EAAmBm7D,CAAAn7D,OAAA,EACnBw9D,EAAA,CAAU77D,CAAV,CAAmB3B,CAAnB,CAA2Bm7D,CAA3B,CACA,OAAO5lD,EAAAjT,KAAA,CAAoBX,CAApB,CAA6B,MAA7B,CAAqCylB,EAAA,CAAsBC,CAAtB,CAArC,CALuC,CAnK3C,CAwLL42C,MAAOA,QAAQ,CAACt8D,CAAD,CAAU0lB,CAAV,CAAmB,CAChC,MAAO9R,EAAAjT,KAAA,CAAoBX,CAApB,CAA6B,OAA7B,CAAsCylB,EAAA,CAAsBC,CAAtB,CAAtC,CAAsE,QAAQ,EAAG,CACtF1lB,CAAAmqB,OAAA,EADsF,CAAjF,CADyB,CAxL7B,CAgNLxK,SAAUA,QAAQ,CAAC3f,CAAD,CAAUiuB,CAAV,CAAqBvI,CAArB,CAA8B,CAC9CA,CAAA,CAAUD,EAAA,CAAsBC,CAAtB,CACVA,EAAA/F,SAAA,CAAmB0F,EAAA,CAAaK,CAAA62C,SAAb,CAA+BtuC,CAA/B,CACnB,OAAOra,EAAAjT,KAAA,CAAoBX,CAApB,CAA6B,UAA7B,CAAyC0lB,CAAzC,CAHuC,CAhN3C,CAwOL9F,YAAaA,QAAQ,CAAC5f,CAAD;AAAUiuB,CAAV,CAAqBvI,CAArB,CAA8B,CACjDA,CAAA,CAAUD,EAAA,CAAsBC,CAAtB,CACVA,EAAA9F,YAAA,CAAsByF,EAAA,CAAaK,CAAA9F,YAAb,CAAkCqO,CAAlC,CACtB,OAAOra,EAAAjT,KAAA,CAAoBX,CAApB,CAA6B,aAA7B,CAA4C0lB,CAA5C,CAH0C,CAxO9C,CAiQL+qC,SAAUA,QAAQ,CAACzwD,CAAD,CAAUm7D,CAAV,CAAehxC,CAAf,CAAuBzE,CAAvB,CAAgC,CAChDA,CAAA,CAAUD,EAAA,CAAsBC,CAAtB,CACVA,EAAA/F,SAAA,CAAmB0F,EAAA,CAAaK,CAAA/F,SAAb,CAA+Bw7C,CAA/B,CACnBz1C,EAAA9F,YAAA,CAAsByF,EAAA,CAAaK,CAAA9F,YAAb,CAAkCuK,CAAlC,CACtB,OAAOvW,EAAAjT,KAAA,CAAoBX,CAApB,CAA6B,UAA7B,CAAyC0lB,CAAzC,CAJyC,CAjQ7C,CA0SL82C,QAASA,QAAQ,CAACx8D,CAAD,CAAUg7D,CAAV,CAAgBC,CAAhB,CAAoBhtC,CAApB,CAA+BvI,CAA/B,CAAwC,CACvDA,CAAA,CAAUD,EAAA,CAAsBC,CAAtB,CACVA,EAAAs1C,KAAA,CAAet1C,CAAAs1C,KAAA,CAAen9D,CAAA,CAAO6nB,CAAAs1C,KAAP,CAAqBA,CAArB,CAAf,CAA4CA,CAC3Dt1C,EAAAu1C,GAAA,CAAev1C,CAAAu1C,GAAA,CAAep9D,CAAA,CAAO6nB,CAAAu1C,GAAP,CAAmBA,CAAnB,CAAf,CAA4CA,CAG3Dv1C,EAAA+2C,YAAA,CAAsBp3C,EAAA,CAAaK,CAAA+2C,YAAb,CADVxuC,CACU,EADG,mBACH,CACtB,OAAOra,EAAAjT,KAAA,CAAoBX,CAApB,CAA6B,SAA7B,CAAwC0lB,CAAxC,CAPgD,CA1SpD,CAjC+C,CAA5C,CAlFyC,CAAhC,CAvKvB,CAilBIzR,GAAmCA,QAAQ,EAAG,CAChD,IAAAsL,KAAA,CAAY,CAAC,OAAD,CAAU,QAAQ,CAAC7H,CAAD,CAAQ,CAGpCglD,QAASA,EAAW,CAAC/5D,CAAD,CAAK,CACvBg6D,CAAAh8D,KAAA,CAAegC,CAAf,CACuB,EAAvB,CAAIg6D,CAAAzhE,OAAJ,EACAwc,CAAA,CAAM,QAAQ,EAAG,CACf,IAAS,IAAAvb,EAAI,CAAb,CAAgBA,CAAhB,CAAoBwgE,CAAAzhE,OAApB,CAAsCiB,CAAA,EAAtC,CACEwgE,CAAA,CAAUxgE,CAAV,CAAA,EAEFwgE;CAAA,CAAY,EAJG,CAAjB,CAHuB,CAFzB,IAAIA,EAAY,EAahB,OAAO,SAAQ,EAAG,CAChB,IAAIC,EAAS,CAAA,CACbF,EAAA,CAAY,QAAQ,EAAG,CACrBE,CAAA,CAAS,CAAA,CADY,CAAvB,CAGA,OAAO,SAAQ,CAACt1C,CAAD,CAAW,CACxBs1C,CAAA,CAASt1C,CAAA,EAAT,CAAsBo1C,CAAA,CAAYp1C,CAAZ,CADE,CALV,CAdkB,CAA1B,CADoC,CAjlBlD,CA4mBIvT,GAAiCA,QAAQ,EAAG,CAC9C,IAAAwL,KAAA,CAAY,CAAC,IAAD,CAAO,UAAP,CAAmB,mBAAnB,CAAwC,WAAxC,CAAqD,UAArD,CACP,QAAQ,CAACjJ,CAAD,CAAOQ,CAAP,CAAmB9C,CAAnB,CAAwCQ,CAAxC,CAAqD8C,CAArD,CAA+D,CA0C1EulD,QAASA,EAAa,CAAC5/C,CAAD,CAAO,CAC3B,IAAA6/C,QAAA,CAAa7/C,CAAb,CAEA,KAAI8/C,EAAU/oD,CAAA,EAKd,KAAAgpD,eAAA,CAAsB,EACtB,KAAAC,MAAA,CAAaC,QAAQ,CAACv6D,CAAD,CAAK,CACxB,IAAIw6D,EAAM3oD,CAAA,CAAU,CAAV,CAIN2oD,EAAJ,EAAWA,CAAAC,OAAX,CATA9lD,CAAA,CAUc3U,CAVd,CAAa,CAAb,CAAgB,CAAA,CAAhB,CASA,CAGEo6D,CAAA,CAAQp6D,CAAR,CARsB,CAW1B,KAAA06D,OAAA,CAAc,CApBa,CApC7BR,CAAA74B,MAAA,CAAsBs5B,QAAQ,CAACt5B,CAAD,CAAQ1c,CAAR,CAAkB,CAI9Ck4B,QAASA,EAAI,EAAG,CACd,GAAIp/C,CAAJ,GAAc4jC,CAAA9oC,OAAd,CACEosB,CAAA,CAAS,CAAA,CAAT,CADF,KAKA0c,EAAA,CAAM5jC,CAAN,CAAA,CAAa,QAAQ,CAAC8iC,CAAD,CAAW,CACb,CAAA,CAAjB,GAAIA,CAAJ,CACE5b,CAAA,CAAS,CAAA,CAAT,CADF,EAIAlnB,CAAA,EACA,CAAAo/C,CAAA,EALA,CAD8B,CAAhC,CANc,CAHhB,IAAIp/C,EAAQ,CAEZo/C,EAAA,EAH8C,CAqBhDqd,EAAA5iB,IAAA,CAAoBsjB,QAAQ,CAACC,CAAD,CAAUl2C,CAAV,CAAoB,CAO9Cm2C,QAASA,EAAU,CAACv6B,CAAD,CAAW,CAC5BpB,CAAA,CAASA,CAAT,EAAmBoB,CACf,GAAEuH,CAAN;AAAgB+yB,CAAAtiE,OAAhB,EACEosB,CAAA,CAASwa,CAAT,CAH0B,CAN9B,IAAI2I,EAAQ,CAAZ,CACI3I,EAAS,CAAA,CACbvmC,EAAA,CAAQiiE,CAAR,CAAiB,QAAQ,CAACnC,CAAD,CAAS,CAChCA,CAAAn2B,KAAA,CAAYu4B,CAAZ,CADgC,CAAlC,CAH8C,CAsChDZ,EAAA/5C,UAAA,CAA0B,CACxBg6C,QAASA,QAAQ,CAAC7/C,CAAD,CAAO,CACtB,IAAAA,KAAA,CAAYA,CAAZ,EAAoB,EADE,CADA,CAKxBioB,KAAMA,QAAQ,CAACviC,CAAD,CAAK,CAlEK+6D,CAmEtB,GAAI,IAAAL,OAAJ,CACE16D,CAAA,EADF,CAGE,IAAAq6D,eAAAr8D,KAAA,CAAyBgC,CAAzB,CAJe,CALK,CAaxB62C,SAAUh7C,CAbc,CAexBm/D,WAAYA,QAAQ,EAAG,CACrB,GAAKt5B,CAAA,IAAAA,QAAL,CAAmB,CACjB,IAAI3hC,EAAO,IACX,KAAA2hC,QAAA,CAAe/tB,CAAA,CAAG,QAAQ,CAACovB,CAAD,CAAUtC,CAAV,CAAkB,CAC1C1gC,CAAAwiC,KAAA,CAAU,QAAQ,CAACpD,CAAD,CAAS,CACd,CAAA,CAAX,GAAAA,CAAA,CAAmBsB,CAAA,EAAnB,CAA8BsC,CAAA,EADL,CAA3B,CAD0C,CAA7B,CAFE,CAQnB,MAAO,KAAArB,QATc,CAfC,CA2BxB/K,KAAMA,QAAQ,CAACskC,CAAD,CAAiBC,CAAjB,CAAgC,CAC5C,MAAO,KAAAF,WAAA,EAAArkC,KAAA,CAAuBskC,CAAvB,CAAuCC,CAAvC,CADqC,CA3BtB,CA+BxB,QAAS5kB,QAAQ,CAACh6B,CAAD,CAAU,CACzB,MAAO,KAAA0+C,WAAA,EAAA,CAAkB,OAAlB,CAAA,CAA2B1+C,CAA3B,CADkB,CA/BH,CAmCxB,UAAWi6B,QAAQ,CAACj6B,CAAD,CAAU,CAC3B,MAAO,KAAA0+C,WAAA,EAAA,CAAkB,SAAlB,CAAA,CAA6B1+C,CAA7B,CADoB,CAnCL,CAuCxB6+C,MAAOA,QAAQ,EAAG,CACZ,IAAA7gD,KAAA6gD,MAAJ;AACE,IAAA7gD,KAAA6gD,MAAA,EAFc,CAvCM,CA6CxBC,OAAQA,QAAQ,EAAG,CACb,IAAA9gD,KAAA8gD,OAAJ,EACE,IAAA9gD,KAAA8gD,OAAA,EAFe,CA7CK,CAmDxB5B,IAAKA,QAAQ,EAAG,CACV,IAAAl/C,KAAAk/C,IAAJ,EACE,IAAAl/C,KAAAk/C,IAAA,EAEF,KAAA6B,SAAA,CAAc,CAAA,CAAd,CAJc,CAnDQ,CA0DxBp1C,OAAQA,QAAQ,EAAG,CACb,IAAA3L,KAAA2L,OAAJ,EACE,IAAA3L,KAAA2L,OAAA,EAEF,KAAAo1C,SAAA,CAAc,CAAA,CAAd,CAJiB,CA1DK,CAiExB1C,SAAUA,QAAQ,CAACp4B,CAAD,CAAW,CAC3B,IAAIxgC,EAAO,IAjIKu7D,EAkIhB,GAAIv7D,CAAA26D,OAAJ,GACE36D,CAAA26D,OACA,CAnImBa,CAmInB,CAAAx7D,CAAAu6D,MAAA,CAAW,QAAQ,EAAG,CACpBv6D,CAAAs7D,SAAA,CAAc96B,CAAd,CADoB,CAAtB,CAFF,CAF2B,CAjEL,CA2ExB86B,SAAUA,QAAQ,CAAC96B,CAAD,CAAW,CAxILw6B,CAyItB,GAAI,IAAAL,OAAJ,GACE9hE,CAAA,CAAQ,IAAAyhE,eAAR,CAA6B,QAAQ,CAACr6D,CAAD,CAAK,CACxCA,CAAA,CAAGugC,CAAH,CADwC,CAA1C,CAIA,CADA,IAAA85B,eAAA9hE,OACA,CAD6B,CAC7B,CAAA,IAAAmiE,OAAA,CA9IoBK,CAyItB,CAD2B,CA3EL,CAsF1B,OAAOb,EAvJmE,CADhE,CADkC,CA5mBhD,CAoxBIppD,GAA0BA,QAAQ,EAAG,CACvC,IAAA8L,KAAA,CAAY,CAAC,OAAD,CAAU,IAAV,CAAgB,iBAAhB;AAAmC,QAAQ,CAAC7H,CAAD,CAAQpB,CAAR,CAAYxC,CAAZ,CAA6B,CAElF,MAAO,SAAQ,CAAC9T,CAAD,CAAUm+D,CAAV,CAA0B,CA6BvCjxD,QAASA,EAAG,EAAG,CACbwK,CAAA,CAAM,QAAQ,EAAG,CAWbgO,CAAA/F,SAAJ,GACE3f,CAAA2f,SAAA,CAAiB+F,CAAA/F,SAAjB,CACA,CAAA+F,CAAA/F,SAAA,CAAmB,IAFrB,CAII+F,EAAA9F,YAAJ,GACE5f,CAAA4f,YAAA,CAAoB8F,CAAA9F,YAApB,CACA,CAAA8F,CAAA9F,YAAA,CAAsB,IAFxB,CAII8F,EAAAu1C,GAAJ,GACEj7D,CAAAi4D,IAAA,CAAYvyC,CAAAu1C,GAAZ,CACA,CAAAv1C,CAAAu1C,GAAA,CAAa,IAFf,CAjBOmD,EAAL,EACE/C,CAAAC,SAAA,EAEF8C,EAAA,CAAS,CAAA,CALM,CAAjB,CAOA,OAAO/C,EARM,CAxBf,IAAI31C,EAAUy4C,CAAVz4C,EAA4B,EAC3BA,EAAA24C,WAAL,GACE34C,CADF,CACYnlB,EAAA,CAAKmlB,CAAL,CADZ,CAOIA,EAAA44C,cAAJ,GACE54C,CAAAs1C,KADF,CACiBt1C,CAAAu1C,GADjB,CAC8B,IAD9B,CAIIv1C,EAAAs1C,KAAJ,GACEh7D,CAAAi4D,IAAA,CAAYvyC,CAAAs1C,KAAZ,CACA,CAAAt1C,CAAAs1C,KAAA,CAAe,IAFjB,CAjBuC,KAuBnCoD,CAvBmC,CAuB3B/C,EAAS,IAAIvnD,CACzB,OAAO,CACLyqD,MAAOrxD,CADF,CAELivD,IAAKjvD,CAFA,CAxBgC,CAFyC,CAAxE,CAD2B,CApxBzC,CAy4EI+d,GAAiBtwB,CAAA,CAAO,UAAP,CAQrBkT,GAAA6U,QAAA,CAA2B,CAAC,UAAD,CAAa,uBAAb,CAqtE3B,KAAI0P,GAAgB,uBAApB,CAsGI6N,GAAoBtlC,CAAA,CAAO,aAAP,CAtGxB;AAyGI6kC,GAAY,4BAzGhB,CAgWIzqB,GAAwBA,QAAQ,EAAG,CACrC,IAAAwK,KAAA,CAAY,CAAC,WAAD,CAAc,QAAQ,CAAC/K,CAAD,CAAY,CAC5C,MAAO,SAAQ,CAACga,CAAD,CAAU,CASnBA,CAAJ,CACO1pB,CAAA0pB,CAAA1pB,SADP,EAC2B0pB,CAD3B,WAC8CvzB,EAD9C,GAEIuzB,CAFJ,CAEcA,CAAA,CAAQ,CAAR,CAFd,EAKEA,CALF,CAKYha,CAAA,CAAU,CAAV,CAAA0yB,KAEZ,OAAO1Y,EAAAgwC,YAAP,CAA6B,CAhBN,CADmB,CAAlC,CADyB,CAhWvC,CAuXIC,GAAmB,kBAvXvB,CAwXIp8B,GAAgC,CAAC,eAAgBo8B,EAAhB,CAAmC,gBAApC,CAxXpC,CAyXIp9B,GAAa,eAzXjB,CA0XIC,GAAY,CACd,IAAK,IADS,CAEd,IAAK,IAFS,CA1XhB,CA8XIJ,GAAyB,cA9X7B,CA+XIw9B,GAAc/jE,CAAA,CAAO,OAAP,CA/XlB,CAgYIsqC,GAAsBA,QAAQ,CAACp5B,CAAD,CAAS,CACzC,MAAO,SAAQ,EAAG,CAChB,KAAM6yD,GAAA,CAAY,QAAZ,CAAkG7yD,CAAlG,CAAN,CADgB,CADuB,CAhY3C,CAg2DIu9B,GAAqBrhC,EAAAqhC,mBAArBA,CAAkDzuC,CAAA,CAAO,cAAP,CACtDyuC,GAAAW,cAAA,CAAmC40B,QAAQ,CAACvkC,CAAD,CAAO,CAChD,KAAMgP,GAAA,CAAmB,UAAnB,CAGsDhP,CAHtD,CAAN,CADgD,CAOlDgP,GAAAC,OAAA,CAA4Bu1B,QAAQ,CAACxkC,CAAD,CAAO9X,CAAP,CAAY,CAC9C,MAAO8mB,GAAA,CAAmB,QAAnB;AAA4DhP,CAA5D,CAAkE9X,CAAAzjB,SAAA,EAAlE,CADuC,CApvWT,KA0zXnCggE,GAAa,iCA1zXsB,CA2zXnC7yB,GAAgB,CAAC,KAAQ,EAAT,CAAa,MAAS,GAAtB,CAA2B,IAAO,EAAlC,CA3zXmB,CA4zXnCqB,GAAkB1yC,CAAA,CAAO,WAAP,CA5zXiB,CA6nYnCmkE,GAAoB,CAMtB7xB,QAAS,CAAA,CANa,CAYtBuD,UAAW,CAAA,CAZW,CAiCtBlB,OAAQd,EAAA,CAAe,UAAf,CAjCc,CAwDtB9nB,IAAKA,QAAQ,CAACA,CAAD,CAAM,CACjB,GAAI5nB,CAAA,CAAY4nB,CAAZ,CAAJ,CACE,MAAO,KAAA8mB,MAGT,KAAI9rC,EAAQm9D,EAAA1lD,KAAA,CAAgBuN,CAAhB,CACZ,EAAIhlB,CAAA,CAAM,CAAN,CAAJ,EAAwB,EAAxB,GAAgBglB,CAAhB,GAA4B,IAAA/b,KAAA,CAAU1F,kBAAA,CAAmBvD,CAAA,CAAM,CAAN,CAAnB,CAAV,CAC5B,EAAIA,CAAA,CAAM,CAAN,CAAJ,EAAgBA,CAAA,CAAM,CAAN,CAAhB,EAAoC,EAApC,GAA4BglB,CAA5B,GAAwC,IAAA6lB,OAAA,CAAY7qC,CAAA,CAAM,CAAN,CAAZ,EAAwB,EAAxB,CACxC,KAAAmjB,KAAA,CAAUnjB,CAAA,CAAM,CAAN,CAAV,EAAsB,EAAtB,CAEA,OAAO,KAVU,CAxDG,CAuFtBsmC,SAAUwG,EAAA,CAAe,YAAf,CAvFY,CAmHtBvxB,KAAMuxB,EAAA,CAAe,QAAf,CAnHgB,CAuItBzC,KAAMyC,EAAA,CAAe,QAAf,CAvIgB,CAiKtB7jC,KAAM8jC,EAAA,CAAqB,QAArB,CAA+B,QAAQ,CAAC9jC,CAAD,CAAO,CAClDA,CAAA,CAAgB,IAAT,GAAAA,CAAA,CAAgBA,CAAA9L,SAAA,EAAhB,CAAkC,EACzC,OAAyB,GAAlB,EAAA8L,CAAA9I,OAAA,CAAY,CAAZ,CAAA,CAAwB8I,CAAxB,CAA+B,GAA/B,CAAqCA,CAFM,CAA9C,CAjKgB,CAmNtB4hC,OAAQA,QAAQ,CAACA,CAAD;AAASwyB,CAAT,CAAqB,CACnC,OAAQhhE,SAAA7C,OAAR,EACE,KAAK,CAAL,CACE,MAAO,KAAAoxC,SACT,MAAK,CAAL,CACE,GAAItxC,CAAA,CAASuxC,CAAT,CAAJ,EAAwBnxC,CAAA,CAASmxC,CAAT,CAAxB,CACEA,CACA,CADSA,CAAA1tC,SAAA,EACT,CAAA,IAAAytC,SAAA,CAAgBpnC,EAAA,CAAcqnC,CAAd,CAFlB,KAGO,IAAIvvC,CAAA,CAASuvC,CAAT,CAAJ,CACLA,CAMA,CANShsC,EAAA,CAAKgsC,CAAL,CAAa,EAAb,CAMT,CAJAhxC,CAAA,CAAQgxC,CAAR,CAAgB,QAAQ,CAACjwC,CAAD,CAAQZ,CAAR,CAAa,CACtB,IAAb,EAAIY,CAAJ,EAAmB,OAAOiwC,CAAA,CAAO7wC,CAAP,CADS,CAArC,CAIA,CAAA,IAAA4wC,SAAA,CAAgBC,CAPX,KASL,MAAMc,GAAA,CAAgB,UAAhB,CAAN,CAGF,KACF,SACMvuC,CAAA,CAAYigE,CAAZ,CAAJ,EAA8C,IAA9C,GAA+BA,CAA/B,CACE,OAAO,IAAAzyB,SAAA,CAAcC,CAAd,CADT,CAGE,IAAAD,SAAA,CAAcC,CAAd,CAHF,CAG0BwyB,CAxB9B,CA4BA,IAAAzxB,UAAA,EACA,OAAO,KA9B4B,CAnNf,CAyQtBzoB,KAAM4pB,EAAA,CAAqB,QAArB,CAA+B,QAAQ,CAAC5pB,CAAD,CAAO,CAClD,MAAgB,KAAT,GAAAA,CAAA,CAAgBA,CAAAhmB,SAAA,EAAhB,CAAkC,EADS,CAA9C,CAzQgB,CAqRtB8E,QAASA,QAAQ,EAAG,CAClB,IAAA6sC,UAAA,CAAiB,CAAA,CACjB,OAAO,KAFW,CArRE,CA2RxBj1C,EAAA,CAAQ,CAACgzC,EAAD,CAA6BP,EAA7B,CAAkDnB,EAAlD,CAAR,CAA6E,QAAQ,CAACmyB,CAAD,CAAW,CAC9FA,CAAAl8C,UAAA,CAAqB3nB,MAAAoD,OAAA,CAAcugE,EAAd,CAqBrBE,EAAAl8C,UAAAwD,MAAA;AAA2B24C,QAAQ,CAAC34C,CAAD,CAAQ,CACzC,GAAKprB,CAAA6C,SAAA7C,OAAL,CACE,MAAO,KAAAi0C,QAGT,IAAI6vB,CAAJ,GAAiBnyB,EAAjB,EAAsCI,CAAA,IAAAA,QAAtC,CACE,KAAMI,GAAA,CAAgB,SAAhB,CAAN,CAMF,IAAA8B,QAAA,CAAerwC,CAAA,CAAYwnB,CAAZ,CAAA,CAAqB,IAArB,CAA4BA,CAE3C,OAAO,KAdkC,CAtBmD,CAAhG,CA8iBA,KAAIqrB,GAAeh3C,CAAA,CAAO,QAAP,CAAnB,CAkFIq3C,GAAOnvB,QAAAC,UAAAjnB,KAlFX,CAmFIo2C,GAAQpvB,QAAAC,UAAAhgB,MAnFZ,CAoFIovC,GAAOrvB,QAAAC,UAAArgB,KApFX,CA8GIy8D,GAAY78D,CAAA,EAChB9G,EAAA,CAAQ,+CAAA,MAAA,CAAA,GAAA,CAAR,CAAoE,QAAQ,CAACm5C,CAAD,CAAW,CAAEwqB,EAAA,CAAUxqB,CAAV,CAAA,CAAsB,CAAA,CAAxB,CAAvF,CACA,KAAIyqB,GAAS,CAAC,EAAI,IAAL,CAAW,EAAI,IAAf,CAAqB,EAAI,IAAzB,CAA+B,EAAI,IAAnC,CAAyC,EAAI,IAA7C,CAAmD,IAAI,GAAvD,CAA4D,IAAI,GAAhE,CAAb,CASIrpB,GAAQA,QAAQ,CAACpwB,CAAD,CAAU,CAC5B,IAAAA,QAAA,CAAeA,CADa,CAI9BowB,GAAAhzB,UAAA,CAAkB,CAChB5hB,YAAa40C,EADG,CAGhBspB,IAAKA,QAAQ,CAAChlC,CAAD,CAAO,CAClB,IAAAA,KAAA,CAAYA,CACZ,KAAAh6B,MAAA,CAAa,CAGb,KAFA,IAAAi/D,OAEA;AAFc,EAEd,CAAO,IAAAj/D,MAAP,CAAoB,IAAAg6B,KAAAl/B,OAApB,CAAA,CAEE,GADIstC,CACA,CADK,IAAApO,KAAAv4B,OAAA,CAAiB,IAAAzB,MAAjB,CACL,CAAO,GAAP,GAAAooC,CAAA,EAAqB,GAArB,GAAcA,CAAlB,CACE,IAAA82B,WAAA,CAAgB92B,CAAhB,CADF,KAEO,IAAI,IAAAptC,SAAA,CAAcotC,CAAd,CAAJ,EAAgC,GAAhC,GAAyBA,CAAzB,EAAuC,IAAAptC,SAAA,CAAc,IAAAmkE,KAAA,EAAd,CAAvC,CACL,IAAAC,WAAA,EADK,KAEA,IAAI,IAAAC,QAAA,CAAaj3B,CAAb,CAAJ,CACL,IAAAk3B,UAAA,EADK,KAEA,IAAI,IAAAC,GAAA,CAAQn3B,CAAR,CAAY,aAAZ,CAAJ,CACL,IAAA62B,OAAA1+D,KAAA,CAAiB,CAACP,MAAO,IAAAA,MAAR,CAAoBg6B,KAAMoO,CAA1B,CAAjB,CACA,CAAA,IAAApoC,MAAA,EAFK,KAGA,IAAI,IAAAw/D,aAAA,CAAkBp3B,CAAlB,CAAJ,CACL,IAAApoC,MAAA,EADK,KAEA,CACL,IAAIy/D,EAAMr3B,CAANq3B,CAAW,IAAAN,KAAA,EAAf,CACIO,EAAMD,CAANC,CAAY,IAAAP,KAAA,CAAU,CAAV,CADhB,CAGIQ,EAAMb,EAAA,CAAUW,CAAV,CAHV,CAIIG,EAAMd,EAAA,CAAUY,CAAV,CAFAZ,GAAAe,CAAUz3B,CAAVy3B,CAGV,EAAWF,CAAX,EAAkBC,CAAlB,EACM3gC,CAEJ,CAFY2gC,CAAA,CAAMF,CAAN,CAAaC,CAAA,CAAMF,CAAN,CAAYr3B,CAErC,CADA,IAAA62B,OAAA1+D,KAAA,CAAiB,CAACP,MAAO,IAAAA,MAAR,CAAoBg6B,KAAMiF,CAA1B,CAAiCqV,SAAU,CAAA,CAA3C,CAAjB,CACA,CAAA,IAAAt0C,MAAA;AAAci/B,CAAAnkC,OAHhB,EAKE,IAAAglE,WAAA,CAAgB,4BAAhB,CAA8C,IAAA9/D,MAA9C,CAA0D,IAAAA,MAA1D,CAAuE,CAAvE,CAXG,CAeT,MAAO,KAAAi/D,OAjCW,CAHJ,CAuChBM,GAAIA,QAAQ,CAACn3B,CAAD,CAAK23B,CAAL,CAAY,CACtB,MAA8B,EAA9B,GAAOA,CAAA9/D,QAAA,CAAcmoC,CAAd,CADe,CAvCR,CA2ChB+2B,KAAMA,QAAQ,CAACpjE,CAAD,CAAI,CACZ2uD,CAAAA,CAAM3uD,CAAN2uD,EAAW,CACf,OAAQ,KAAA1qD,MAAD,CAAc0qD,CAAd,CAAoB,IAAA1wB,KAAAl/B,OAApB,CAAwC,IAAAk/B,KAAAv4B,OAAA,CAAiB,IAAAzB,MAAjB,CAA8B0qD,CAA9B,CAAxC,CAA6E,CAAA,CAFpE,CA3CF,CAgDhB1vD,SAAUA,QAAQ,CAACotC,CAAD,CAAK,CACrB,MAAQ,GAAR,EAAeA,CAAf,EAA2B,GAA3B,EAAqBA,CAArB,EAAiD,QAAjD,GAAmC,MAAOA,EADrB,CAhDP,CAoDhBo3B,aAAcA,QAAQ,CAACp3B,CAAD,CAAK,CAEzB,MAAe,GAAf,GAAQA,CAAR,EAA6B,IAA7B,GAAsBA,CAAtB,EAA4C,IAA5C,GAAqCA,CAArC,EACe,IADf,GACQA,CADR,EAC8B,IAD9B,GACuBA,CADvB,EAC6C,QAD7C,GACsCA,CAHb,CApDX,CA0DhBi3B,QAASA,QAAQ,CAACj3B,CAAD,CAAK,CACpB,MAAQ,GAAR,EAAeA,CAAf,EAA2B,GAA3B,EAAqBA,CAArB,EACQ,GADR,EACeA,CADf,EAC2B,GAD3B,EACqBA,CADrB,EAEQ,GAFR,GAEgBA,CAFhB,EAE6B,GAF7B,GAEsBA,CAHF,CA1DN,CAgEhB43B,cAAeA,QAAQ,CAAC53B,CAAD,CAAK,CAC1B,MAAe,GAAf;AAAQA,CAAR,EAA6B,GAA7B,GAAsBA,CAAtB,EAAoC,IAAAptC,SAAA,CAAcotC,CAAd,CADV,CAhEZ,CAoEhB03B,WAAYA,QAAQ,CAACl6C,CAAD,CAAQu4C,CAAR,CAAepC,CAAf,CAAoB,CACtCA,CAAA,CAAMA,CAAN,EAAa,IAAA/7D,MACTigE,EAAAA,CAAUthE,CAAA,CAAUw/D,CAAV,CAAA,CACJ,IADI,CACGA,CADH,CACY,GADZ,CACkB,IAAAn+D,MADlB,CAC+B,IAD/B,CACsC,IAAAg6B,KAAA/0B,UAAA,CAAoBk5D,CAApB,CAA2BpC,CAA3B,CADtC,CACwE,GADxE,CAEJ,GAFI,CAEEA,CAChB,MAAMxqB,GAAA,CAAa,QAAb,CACF3rB,CADE,CACKq6C,CADL,CACa,IAAAjmC,KADb,CAAN,CALsC,CApExB,CA6EhBolC,WAAYA,QAAQ,EAAG,CAGrB,IAFA,IAAI7W,EAAS,EAAb,CACI4V,EAAQ,IAAAn+D,MACZ,CAAO,IAAAA,MAAP,CAAoB,IAAAg6B,KAAAl/B,OAApB,CAAA,CAAsC,CACpC,IAAIstC,EAAKvoC,CAAA,CAAU,IAAAm6B,KAAAv4B,OAAA,CAAiB,IAAAzB,MAAjB,CAAV,CACT,IAAU,GAAV,EAAIooC,CAAJ,EAAiB,IAAAptC,SAAA,CAAcotC,CAAd,CAAjB,CACEmgB,CAAA,EAAUngB,CADZ,KAEO,CACL,IAAI83B,EAAS,IAAAf,KAAA,EACb,IAAU,GAAV,EAAI/2B,CAAJ,EAAiB,IAAA43B,cAAA,CAAmBE,CAAnB,CAAjB,CACE3X,CAAA,EAAUngB,CADZ,KAEO,IAAI,IAAA43B,cAAA,CAAmB53B,CAAnB,CAAJ,EACH83B,CADG,EACO,IAAAllE,SAAA,CAAcklE,CAAd,CADP,EAEiC,GAFjC,EAEH3X,CAAA9mD,OAAA,CAAc8mD,CAAAztD,OAAd,CAA8B,CAA9B,CAFG,CAGLytD,CAAA,EAAUngB,CAHL,KAIA,IAAI,CAAA,IAAA43B,cAAA,CAAmB53B,CAAnB,CAAJ;AACD83B,CADC,EACU,IAAAllE,SAAA,CAAcklE,CAAd,CADV,EAEiC,GAFjC,EAEH3X,CAAA9mD,OAAA,CAAc8mD,CAAAztD,OAAd,CAA8B,CAA9B,CAFG,CAKL,KALK,KAGL,KAAAglE,WAAA,CAAgB,kBAAhB,CAXG,CAgBP,IAAA9/D,MAAA,EApBoC,CAsBtC,IAAAi/D,OAAA1+D,KAAA,CAAiB,CACfP,MAAOm+D,CADQ,CAEfnkC,KAAMuuB,CAFS,CAGf/7C,SAAU,CAAA,CAHK,CAIftQ,MAAOytB,MAAA,CAAO4+B,CAAP,CAJQ,CAAjB,CAzBqB,CA7EP,CA8GhB+W,UAAWA,QAAQ,EAAG,CAEpB,IADA,IAAInB,EAAQ,IAAAn+D,MACZ,CAAO,IAAAA,MAAP,CAAoB,IAAAg6B,KAAAl/B,OAApB,CAAA,CAAsC,CACpC,IAAIstC,EAAK,IAAApO,KAAAv4B,OAAA,CAAiB,IAAAzB,MAAjB,CACT,IAAM,CAAA,IAAAq/D,QAAA,CAAaj3B,CAAb,CAAN,EAA0B,CAAA,IAAAptC,SAAA,CAAcotC,CAAd,CAA1B,CACE,KAEF,KAAApoC,MAAA,EALoC,CAOtC,IAAAi/D,OAAA1+D,KAAA,CAAiB,CACfP,MAAOm+D,CADQ,CAEfnkC,KAAM,IAAAA,KAAAt8B,MAAA,CAAgBygE,CAAhB,CAAuB,IAAAn+D,MAAvB,CAFS,CAGf01B,WAAY,CAAA,CAHG,CAAjB,CAToB,CA9GN,CA8HhBwpC,WAAYA,QAAQ,CAACiB,CAAD,CAAQ,CAC1B,IAAIhC,EAAQ,IAAAn+D,MACZ,KAAAA,MAAA,EAIA,KAHA,IAAI6rD,EAAS,EAAb,CACIuU,EAAYD,CADhB,CAEIh4B,EAAS,CAAA,CACb,CAAO,IAAAnoC,MAAP,CAAoB,IAAAg6B,KAAAl/B,OAApB,CAAA,CAAsC,CACpC,IAAIstC;AAAK,IAAApO,KAAAv4B,OAAA,CAAiB,IAAAzB,MAAjB,CAAT,CACAogE,EAAAA,CAAAA,CAAah4B,CACb,IAAID,CAAJ,CACa,GAAX,GAAIC,CAAJ,EACMi4B,CAKJ,CALU,IAAArmC,KAAA/0B,UAAA,CAAoB,IAAAjF,MAApB,CAAiC,CAAjC,CAAoC,IAAAA,MAApC,CAAiD,CAAjD,CAKV,CAJKqgE,CAAA/+D,MAAA,CAAU,aAAV,CAIL,EAHE,IAAAw+D,WAAA,CAAgB,6BAAhB,CAAgDO,CAAhD,CAAsD,GAAtD,CAGF,CADA,IAAArgE,MACA,EADc,CACd,CAAA6rD,CAAA,EAAUyU,MAAAC,aAAA,CAAoBxiE,QAAA,CAASsiE,CAAT,CAAc,EAAd,CAApB,CANZ,EASExU,CATF,EAQYkT,EAAAyB,CAAOp4B,CAAPo4B,CARZ,EAS4Bp4B,CAE5B,CAAAD,CAAA,CAAS,CAAA,CAZX,KAaO,IAAW,IAAX,GAAIC,CAAJ,CACLD,CAAA,CAAS,CAAA,CADJ,KAEA,CAAA,GAAIC,CAAJ,GAAW+3B,CAAX,CAAkB,CACvB,IAAAngE,MAAA,EACA,KAAAi/D,OAAA1+D,KAAA,CAAiB,CACfP,MAAOm+D,CADQ,CAEfnkC,KAAMomC,CAFS,CAGf5zD,SAAU,CAAA,CAHK,CAIftQ,MAAO2vD,CAJQ,CAAjB,CAMA,OARuB,CAUvBA,CAAA,EAAUzjB,CAVL,CAYP,IAAApoC,MAAA,EA9BoC,CAgCtC,IAAA8/D,WAAA,CAAgB,oBAAhB,CAAsC3B,CAAtC,CAtC0B,CA9HZ,CAwKlB,KAAI5rB,EAAMA,QAAQ,CAACkD,CAAD,CAAQnwB,CAAR,CAAiB,CACjC,IAAAmwB,MAAA,CAAaA,CACb,KAAAnwB,QAAA,CAAeA,CAFkB,CAKnCitB,EAAAC,QAAA,CAAc,SACdD,EAAAkuB,oBAAA;AAA0B,qBAC1BluB,EAAAoB,qBAAA,CAA2B,sBAC3BpB,EAAAW,sBAAA,CAA4B,uBAC5BX,EAAAU,kBAAA,CAAwB,mBACxBV,EAAAO,iBAAA,CAAuB,kBACvBP,EAAAK,gBAAA,CAAsB,iBACtBL,EAAAkB,eAAA,CAAqB,gBACrBlB,EAAAe,iBAAA,CAAuB,kBACvBf,EAAAc,WAAA,CAAiB,YACjBd,EAAAG,QAAA,CAAc,SACdH,EAAAqB,gBAAA,CAAsB,iBACtBrB,EAAAmuB,SAAA,CAAe,UACfnuB,EAAAsB,iBAAA,CAAuB,kBACvBtB,EAAAwB,eAAA,CAAqB,gBACrBxB,EAAAyB,iBAAA,CAAuB,kBAGvBzB;CAAA8B,iBAAA,CAAuB,kBAEvB9B,EAAA7vB,UAAA,CAAgB,CACd0vB,IAAKA,QAAQ,CAACpY,CAAD,CAAO,CAClB,IAAAA,KAAA,CAAYA,CACZ,KAAAilC,OAAA,CAAc,IAAAxpB,MAAAupB,IAAA,CAAehlC,CAAf,CAEV99B,EAAAA,CAAQ,IAAAykE,QAAA,EAEe,EAA3B,GAAI,IAAA1B,OAAAnkE,OAAJ,EACE,IAAAglE,WAAA,CAAgB,wBAAhB,CAA0C,IAAAb,OAAA,CAAY,CAAZ,CAA1C,CAGF,OAAO/iE,EAVW,CADN,CAcdykE,QAASA,QAAQ,EAAG,CAElB,IADA,IAAI75B,EAAO,EACX,CAAA,CAAA,CAGE,GAFyB,CAEpB,CAFD,IAAAm4B,OAAAnkE,OAEC,EAF0B,CAAA,IAAAqkE,KAAA,CAAU,GAAV,CAAe,GAAf,CAAoB,GAApB,CAAyB,GAAzB,CAE1B,EADHr4B,CAAAvmC,KAAA,CAAU,IAAAqgE,oBAAA,EAAV,CACG,CAAA,CAAA,IAAAC,OAAA,CAAY,GAAZ,CAAL,CACE,MAAO,CAAEjmD,KAAM23B,CAAAC,QAAR,CAAqB1L,KAAMA,CAA3B,CANO,CAdN,CAyBd85B,oBAAqBA,QAAQ,EAAG,CAC9B,MAAO,CAAEhmD,KAAM23B,CAAAkuB,oBAAR,CAAiC9gC,WAAY,IAAAmhC,YAAA,EAA7C,CADuB,CAzBlB,CA6BdA,YAAaA,QAAQ,EAAG,CAGtB,IAFA,IAAI/tB;AAAO,IAAApT,WAAA,EAEX,CAAgB,IAAAkhC,OAAA,CAAY,GAAZ,CAAhB,CAAA,CACE9tB,CAAA,CAAO,IAAApmC,OAAA,CAAYomC,CAAZ,CAET,OAAOA,EANe,CA7BV,CAsCdpT,WAAYA,QAAQ,EAAG,CACrB,MAAO,KAAAohC,WAAA,EADc,CAtCT,CA0CdA,WAAYA,QAAQ,EAAG,CACrB,IAAI9/C,EAAS,IAAA+/C,QAAA,EACT,KAAAH,OAAA,CAAY,GAAZ,CAAJ,GACE5/C,CADF,CACW,CAAErG,KAAM23B,CAAAoB,qBAAR,CAAkCZ,KAAM9xB,CAAxC,CAAgD+xB,MAAO,IAAA+tB,WAAA,EAAvD,CAA0EzsB,SAAU,GAApF,CADX,CAGA,OAAOrzB,EALc,CA1CT,CAkDd+/C,QAASA,QAAQ,EAAG,CAClB,IAAI7hE,EAAO,IAAA8hE,UAAA,EAAX,CACI9tB,CADJ,CAEIC,CACJ,OAAI,KAAAytB,OAAA,CAAY,GAAZ,CAAJ,GACE1tB,CACI,CADQ,IAAAxT,WAAA,EACR,CAAA,IAAAuhC,QAAA,CAAa,GAAb,CAFN,GAGI9tB,CACO,CADM,IAAAzT,WAAA,EACN,CAAA,CAAE/kB,KAAM23B,CAAAW,sBAAR,CAAmC/zC,KAAMA,CAAzC,CAA+Cg0C,UAAWA,CAA1D,CAAqEC,WAAYA,CAAjF,CAJX,EAOOj0C,CAXW,CAlDN,CAgEd8hE,UAAWA,QAAQ,EAAG,CAEpB,IADA,IAAIluB,EAAO,IAAAouB,WAAA,EACX,CAAO,IAAAN,OAAA,CAAY,IAAZ,CAAP,CAAA,CACE9tB,CAAA;AAAO,CAAEn4B,KAAM23B,CAAAU,kBAAR,CAA+BqB,SAAU,IAAzC,CAA+CvB,KAAMA,CAArD,CAA2DC,MAAO,IAAAmuB,WAAA,EAAlE,CAET,OAAOpuB,EALa,CAhER,CAwEdouB,WAAYA,QAAQ,EAAG,CAErB,IADA,IAAIpuB,EAAO,IAAAquB,SAAA,EACX,CAAO,IAAAP,OAAA,CAAY,IAAZ,CAAP,CAAA,CACE9tB,CAAA,CAAO,CAAEn4B,KAAM23B,CAAAU,kBAAR,CAA+BqB,SAAU,IAAzC,CAA+CvB,KAAMA,CAArD,CAA2DC,MAAO,IAAAouB,SAAA,EAAlE,CAET,OAAOruB,EALc,CAxET,CAgFdquB,SAAUA,QAAQ,EAAG,CAGnB,IAFA,IAAIruB,EAAO,IAAAsuB,WAAA,EAAX,CACIpiC,CACJ,CAAQA,CAAR,CAAgB,IAAA4hC,OAAA,CAAY,IAAZ,CAAiB,IAAjB,CAAsB,KAAtB,CAA4B,KAA5B,CAAhB,CAAA,CACE9tB,CAAA,CAAO,CAAEn4B,KAAM23B,CAAAO,iBAAR,CAA8BwB,SAAUrV,CAAAjF,KAAxC,CAAoD+Y,KAAMA,CAA1D,CAAgEC,MAAO,IAAAquB,WAAA,EAAvE,CAET,OAAOtuB,EANY,CAhFP,CAyFdsuB,WAAYA,QAAQ,EAAG,CAGrB,IAFA,IAAItuB,EAAO,IAAAuuB,SAAA,EAAX,CACIriC,CACJ,CAAQA,CAAR,CAAgB,IAAA4hC,OAAA,CAAY,GAAZ,CAAiB,GAAjB,CAAsB,IAAtB,CAA4B,IAA5B,CAAhB,CAAA,CACE9tB,CAAA,CAAO,CAAEn4B,KAAM23B,CAAAO,iBAAR;AAA8BwB,SAAUrV,CAAAjF,KAAxC,CAAoD+Y,KAAMA,CAA1D,CAAgEC,MAAO,IAAAsuB,SAAA,EAAvE,CAET,OAAOvuB,EANc,CAzFT,CAkGduuB,SAAUA,QAAQ,EAAG,CAGnB,IAFA,IAAIvuB,EAAO,IAAAwuB,eAAA,EAAX,CACItiC,CACJ,CAAQA,CAAR,CAAgB,IAAA4hC,OAAA,CAAY,GAAZ,CAAgB,GAAhB,CAAhB,CAAA,CACE9tB,CAAA,CAAO,CAAEn4B,KAAM23B,CAAAO,iBAAR,CAA8BwB,SAAUrV,CAAAjF,KAAxC,CAAoD+Y,KAAMA,CAA1D,CAAgEC,MAAO,IAAAuuB,eAAA,EAAvE,CAET,OAAOxuB,EANY,CAlGP,CA2GdwuB,eAAgBA,QAAQ,EAAG,CAGzB,IAFA,IAAIxuB,EAAO,IAAAyuB,MAAA,EAAX,CACIviC,CACJ,CAAQA,CAAR,CAAgB,IAAA4hC,OAAA,CAAY,GAAZ,CAAgB,GAAhB,CAAoB,GAApB,CAAhB,CAAA,CACE9tB,CAAA,CAAO,CAAEn4B,KAAM23B,CAAAO,iBAAR,CAA8BwB,SAAUrV,CAAAjF,KAAxC,CAAoD+Y,KAAMA,CAA1D,CAAgEC,MAAO,IAAAwuB,MAAA,EAAvE,CAET,OAAOzuB,EANkB,CA3Gb,CAoHdyuB,MAAOA,QAAQ,EAAG,CAChB,IAAIviC,CACJ,OAAA,CAAKA,CAAL,CAAa,IAAA4hC,OAAA,CAAY,GAAZ,CAAiB,GAAjB,CAAsB,GAAtB,CAAb,EACS,CAAEjmD,KAAM23B,CAAAK,gBAAR,CAA6B0B,SAAUrV,CAAAjF,KAAvC,CAAmD7zB,OAAQ,CAAA,CAA3D,CAAiE0sC,SAAU,IAAA2uB,MAAA,EAA3E,CADT;AAGS,IAAAC,QAAA,EALO,CApHJ,CA6HdA,QAASA,QAAQ,EAAG,CAClB,IAAIA,CACA,KAAAZ,OAAA,CAAY,GAAZ,CAAJ,EACEY,CACA,CADU,IAAAX,YAAA,EACV,CAAA,IAAAI,QAAA,CAAa,GAAb,CAFF,EAGW,IAAAL,OAAA,CAAY,GAAZ,CAAJ,CACLY,CADK,CACK,IAAAC,iBAAA,EADL,CAEI,IAAAb,OAAA,CAAY,GAAZ,CAAJ,CACLY,CADK,CACK,IAAAluB,OAAA,EADL,CAEI,IAAAouB,UAAAnmE,eAAA,CAA8B,IAAA2jE,KAAA,EAAAnlC,KAA9B,CAAJ,CACLynC,CADK,CACKthE,EAAA,CAAK,IAAAwhE,UAAA,CAAe,IAAAT,QAAA,EAAAlnC,KAAf,CAAL,CADL,CAEI,IAAAmlC,KAAA,EAAAzpC,WAAJ,CACL+rC,CADK,CACK,IAAA/rC,WAAA,EADL,CAEI,IAAAypC,KAAA,EAAA3yD,SAAJ,CACLi1D,CADK,CACK,IAAAj1D,SAAA,EADL,CAGL,IAAAszD,WAAA,CAAgB,0BAAhB,CAA4C,IAAAX,KAAA,EAA5C,CAIF,KADA,IAAI/f,CACJ,CAAQA,CAAR,CAAe,IAAAyhB,OAAA,CAAY,GAAZ,CAAiB,GAAjB,CAAsB,GAAtB,CAAf,CAAA,CACoB,GAAlB,GAAIzhB,CAAAplB,KAAJ,EACEynC,CACA,CADU,CAAC7mD,KAAM23B,CAAAkB,eAAP,CAA2BC,OAAQ+tB,CAAnC,CAA4C9jE,UAAW,IAAAikE,eAAA,EAAvD,CACV;AAAA,IAAAV,QAAA,CAAa,GAAb,CAFF,EAGyB,GAAlB,GAAI9hB,CAAAplB,KAAJ,EACLynC,CACA,CADU,CAAE7mD,KAAM23B,CAAAe,iBAAR,CAA8BC,OAAQkuB,CAAtC,CAA+CttC,SAAU,IAAAwL,WAAA,EAAzD,CAA4E6T,SAAU,CAAA,CAAtF,CACV,CAAA,IAAA0tB,QAAA,CAAa,GAAb,CAFK,EAGkB,GAAlB,GAAI9hB,CAAAplB,KAAJ,CACLynC,CADK,CACK,CAAE7mD,KAAM23B,CAAAe,iBAAR,CAA8BC,OAAQkuB,CAAtC,CAA+CttC,SAAU,IAAAuB,WAAA,EAAzD,CAA4E8d,SAAU,CAAA,CAAtF,CADL,CAGL,IAAAssB,WAAA,CAAgB,YAAhB,CAGJ,OAAO2B,EAjCW,CA7HN,CAiKd90D,OAAQA,QAAQ,CAACk1D,CAAD,CAAiB,CAC3BvhD,CAAAA,CAAO,CAACuhD,CAAD,CAGX,KAFA,IAAI5gD,EAAS,CAACrG,KAAM23B,CAAAkB,eAAP,CAA2BC,OAAQ,IAAAhe,WAAA,EAAnC,CAAsD/3B,UAAW2iB,CAAjE,CAAuE3T,OAAQ,CAAA,CAA/E,CAEb,CAAO,IAAAk0D,OAAA,CAAY,GAAZ,CAAP,CAAA,CACEvgD,CAAA/f,KAAA,CAAU,IAAAo/B,WAAA,EAAV,CAGF,OAAO1e,EARwB,CAjKnB,CA4Kd2gD,eAAgBA,QAAQ,EAAG,CACzB,IAAIthD,EAAO,EACX,IAA8B,GAA9B,GAAI,IAAAwhD,UAAA,EAAA9nC,KAAJ,EACE,EACE1Z,EAAA/f,KAAA,CAAU,IAAAo/B,WAAA,EAAV,CADF;MAES,IAAAkhC,OAAA,CAAY,GAAZ,CAFT,CADF,CAKA,MAAOvgD,EAPkB,CA5Kb,CAsLdoV,WAAYA,QAAQ,EAAG,CACrB,IAAIuJ,EAAQ,IAAAiiC,QAAA,EACPjiC,EAAAvJ,WAAL,EACE,IAAAoqC,WAAA,CAAgB,2BAAhB,CAA6C7gC,CAA7C,CAEF,OAAO,CAAErkB,KAAM23B,CAAAc,WAAR,CAAwBjtC,KAAM64B,CAAAjF,KAA9B,CALc,CAtLT,CA8LdxtB,SAAUA,QAAQ,EAAG,CAEnB,MAAO,CAAEoO,KAAM23B,CAAAG,QAAR,CAAqBx2C,MAAO,IAAAglE,QAAA,EAAAhlE,MAA5B,CAFY,CA9LP,CAmMdwlE,iBAAkBA,QAAQ,EAAG,CAC3B,IAAInlD,EAAW,EACf,IAA8B,GAA9B,GAAI,IAAAulD,UAAA,EAAA9nC,KAAJ,EACE,EAAG,CACD,GAAI,IAAAmlC,KAAA,CAAU,GAAV,CAAJ,CAEE,KAEF5iD,EAAAhc,KAAA,CAAc,IAAAo/B,WAAA,EAAd,CALC,CAAH,MAMS,IAAAkhC,OAAA,CAAY,GAAZ,CANT,CADF,CASA,IAAAK,QAAA,CAAa,GAAb,CAEA,OAAO,CAAEtmD,KAAM23B,CAAAqB,gBAAR,CAA6Br3B,SAAUA,CAAvC,CAboB,CAnMf,CAmNdg3B,OAAQA,QAAQ,EAAG,CAAA,IACbO,EAAa,EADA,CACI3f,CACrB,IAA8B,GAA9B,GAAI,IAAA2tC,UAAA,EAAA9nC,KAAJ,EACE,EAAG,CACD,GAAI,IAAAmlC,KAAA,CAAU,GAAV,CAAJ,CAEE,KAEFhrC;CAAA,CAAW,CAACvZ,KAAM23B,CAAAmuB,SAAP,CAAqBqB,KAAM,MAA3B,CACP,KAAA5C,KAAA,EAAA3yD,SAAJ,CACE2nB,CAAA74B,IADF,CACiB,IAAAkR,SAAA,EADjB,CAEW,IAAA2yD,KAAA,EAAAzpC,WAAJ,CACLvB,CAAA74B,IADK,CACU,IAAAo6B,WAAA,EADV,CAGL,IAAAoqC,WAAA,CAAgB,aAAhB,CAA+B,IAAAX,KAAA,EAA/B,CAEF,KAAA+B,QAAA,CAAa,GAAb,CACA/sC,EAAAj4B,MAAA,CAAiB,IAAAyjC,WAAA,EACjBmU,EAAAvzC,KAAA,CAAgB4zB,CAAhB,CAfC,CAAH,MAgBS,IAAA0sC,OAAA,CAAY,GAAZ,CAhBT,CADF,CAmBA,IAAAK,QAAA,CAAa,GAAb,CAEA,OAAO,CAACtmD,KAAM23B,CAAAsB,iBAAP,CAA6BC,WAAYA,CAAzC,CAvBU,CAnNL,CA6OdgsB,WAAYA,QAAQ,CAAC3gB,CAAD,CAAMlgB,CAAN,CAAa,CAC/B,KAAMsS,GAAA,CAAa,QAAb,CAEAtS,CAAAjF,KAFA,CAEYmlB,CAFZ,CAEkBlgB,CAAAj/B,MAFlB,CAEgC,CAFhC,CAEoC,IAAAg6B,KAFpC,CAE+C,IAAAA,KAAA/0B,UAAA,CAAoBg6B,CAAAj/B,MAApB,CAF/C,CAAN,CAD+B,CA7OnB,CAmPdkhE,QAASA,QAAQ,CAACc,CAAD,CAAK,CACpB,GAA2B,CAA3B,GAAI,IAAA/C,OAAAnkE,OAAJ,CACE,KAAMy2C,GAAA,CAAa,MAAb,CAA0D,IAAAvX,KAA1D,CAAN,CAGF,IAAIiF,EAAQ,IAAA4hC,OAAA,CAAYmB,CAAZ,CACP/iC;CAAL,EACE,IAAA6gC,WAAA,CAAgB,4BAAhB,CAA+CkC,CAA/C,CAAoD,GAApD,CAAyD,IAAA7C,KAAA,EAAzD,CAEF,OAAOlgC,EATa,CAnPR,CA+Pd6iC,UAAWA,QAAQ,EAAG,CACpB,GAA2B,CAA3B,GAAI,IAAA7C,OAAAnkE,OAAJ,CACE,KAAMy2C,GAAA,CAAa,MAAb,CAA0D,IAAAvX,KAA1D,CAAN,CAEF,MAAO,KAAAilC,OAAA,CAAY,CAAZ,CAJa,CA/PR,CAsQdE,KAAMA,QAAQ,CAAC6C,CAAD,CAAKC,CAAL,CAASC,CAAT,CAAaC,CAAb,CAAiB,CAC7B,MAAO,KAAAC,UAAA,CAAe,CAAf,CAAkBJ,CAAlB,CAAsBC,CAAtB,CAA0BC,CAA1B,CAA8BC,CAA9B,CADsB,CAtQjB,CA0QdC,UAAWA,QAAQ,CAACrmE,CAAD,CAAIimE,CAAJ,CAAQC,CAAR,CAAYC,CAAZ,CAAgBC,CAAhB,CAAoB,CACrC,GAAI,IAAAlD,OAAAnkE,OAAJ,CAAyBiB,CAAzB,CAA4B,CACtBkjC,CAAAA,CAAQ,IAAAggC,OAAA,CAAYljE,CAAZ,CACZ,KAAIsmE,EAAIpjC,CAAAjF,KACR,IAAIqoC,CAAJ,GAAUL,CAAV,EAAgBK,CAAhB,GAAsBJ,CAAtB,EAA4BI,CAA5B,GAAkCH,CAAlC,EAAwCG,CAAxC,GAA8CF,CAA9C,EACK,EAACH,CAAD,EAAQC,CAAR,EAAeC,CAAf,EAAsBC,CAAtB,CADL,CAEE,MAAOljC,EALiB,CAQ5B,MAAO,CAAA,CAT8B,CA1QzB,CAsRd4hC,OAAQA,QAAQ,CAACmB,CAAD,CAAKC,CAAL,CAASC,CAAT,CAAaC,CAAb,CAAiB,CAE/B,MAAA,CADIljC,CACJ,CADY,IAAAkgC,KAAA,CAAU6C,CAAV,CAAcC,CAAd,CAAkBC,CAAlB,CAAsBC,CAAtB,CACZ,GACE,IAAAlD,OAAA98C,MAAA,EACO8c,CAAAA,CAFT,EAIO,CAAA,CANwB,CAtRnB,CAmSd0iC,UAAW,CACT,OAAQ,CAAE/mD,KAAM23B,CAAAG,QAAR,CAAqBx2C,MAAO,CAAA,CAA5B,CADC;AAET,QAAS,CAAE0e,KAAM23B,CAAAG,QAAR,CAAqBx2C,MAAO,CAAA,CAA5B,CAFA,CAGT,OAAQ,CAAE0e,KAAM23B,CAAAG,QAAR,CAAqBx2C,MAAO,IAA5B,CAHC,CAIT,UAAa,CAAC0e,KAAM23B,CAAAG,QAAP,CAAoBx2C,MAAO5B,CAA3B,CAJJ,CAKT,OAAQ,CAACsgB,KAAM23B,CAAAwB,eAAP,CALC,CAMT,QAAW,CAACn5B,KAAM23B,CAAAyB,iBAAP,CANF,CAnSG,CA2chBQ,GAAA9xB,UAAA,CAAwB,CACtBpb,QAASA,QAAQ,CAACq4B,CAAD,CAAasV,CAAb,CAA8B,CAC7C,IAAI3yC,EAAO,IAAX,CACI8vC,EAAM,IAAAqC,WAAArC,IAAA,CAAoBzS,CAApB,CACV,KAAAzZ,MAAA,CAAa,CACXo8C,OAAQ,CADG,CAEXtc,QAAS,EAFE,CAGX/Q,gBAAiBA,CAHN,CAIX1yC,GAAI,CAACggE,KAAM,EAAP,CAAWz7B,KAAM,EAAjB,CAAqB07B,IAAK,EAA1B,CAJO,CAKXlmC,OAAQ,CAACimC,KAAM,EAAP,CAAWz7B,KAAM,EAAjB,CAAqB07B,IAAK,EAA1B,CALG,CAMXzsB,OAAQ,EANG,CAQb5D,EAAA,CAAgCC,CAAhC,CAAqC9vC,CAAAkS,QAArC,CACA,KAAItW,EAAQ,EAAZ,CACIukE,CACJ,KAAAC,MAAA,CAAa,QACb,IAAKD,CAAL,CAAkBruB,EAAA,CAAchC,CAAd,CAAlB,CACE,IAAAlsB,MAAAy8C,UAIA,CAJuB,QAIvB,CAHI1hD,CAGJ,CAHa,IAAAqhD,OAAA,EAGb,CAFA,IAAAM,QAAA,CAAaH,CAAb,CAAyBxhD,CAAzB,CAEA,CADA,IAAA4hD,QAAA,CAAa5hD,CAAb,CACA;AAAA/iB,CAAA,CAAQ,YAAR,CAAuB,IAAA4kE,iBAAA,CAAsB,QAAtB,CAAgC,OAAhC,CAErBnwB,EAAAA,CAAUsB,EAAA,CAAU7B,CAAAtL,KAAV,CACdxkC,EAAAogE,MAAA,CAAa,QACbvnE,EAAA,CAAQw3C,CAAR,CAAiB,QAAQ,CAAC+L,CAAD,CAAQpjD,CAAR,CAAa,CACpC,IAAIynE,EAAQ,IAARA,CAAeznE,CACnBgH,EAAA4jB,MAAA,CAAW68C,CAAX,CAAA,CAAoB,CAACR,KAAM,EAAP,CAAWz7B,KAAM,EAAjB,CAAqB07B,IAAK,EAA1B,CACpBlgE,EAAA4jB,MAAAy8C,UAAA,CAAuBI,CACvB,KAAIC,EAAS1gE,CAAAggE,OAAA,EACbhgE,EAAAsgE,QAAA,CAAalkB,CAAb,CAAoBskB,CAApB,CACA1gE,EAAAugE,QAAA,CAAaG,CAAb,CACA1gE,EAAA4jB,MAAA6vB,OAAAx1C,KAAA,CAAuBwiE,CAAvB,CACArkB,EAAAukB,QAAA,CAAgB3nE,CARoB,CAAtC,CAUA,KAAA4qB,MAAAy8C,UAAA,CAAuB,IACvB,KAAAD,MAAA,CAAa,MACb,KAAAE,QAAA,CAAaxwB,CAAb,CACI8wB,EAAAA,CAGF,GAHEA,CAGI,IAAAC,IAHJD,CAGe,GAHfA,CAGqB,IAAAE,OAHrBF,CAGmC,MAHnCA,CAIF,IAAAG,aAAA,EAJEH,CAKF,SALEA,CAKU,IAAAJ,iBAAA,CAAsB,IAAtB,CAA4B,SAA5B,CALVI,CAMFhlE,CANEglE,CAOF,IAAAI,SAAA,EAPEJ,CAQF,YAGE3gE,EAAAA,CAAK,CAAC,IAAIkgB,QAAJ,CAAa,SAAb,CACN,sBADM,CAEN,kBAFM;AAGN,oBAHM,CAIN,gBAJM,CAKN,yBALM,CAMN,WANM,CAON,MAPM,CAQN,MARM,CASNygD,CATM,CAAD,EAUH,IAAA1uD,QAVG,CAWH68B,EAXG,CAYHI,EAZG,CAaHE,EAbG,CAcHH,EAdG,CAeHO,EAfG,CAgBHC,EAhBG,CAiBHC,EAjBG,CAkBHtS,CAlBG,CAoBT,KAAAzZ,MAAA,CAAa,IAAAw8C,MAAb,CAA0BpoE,CAC1BiI,EAAA85B,QAAA,CAAakY,EAAA,CAAUnC,CAAV,CACb7vC,EAAAiK,SAAA,CAAyB4lC,CA/EpB5lC,SAgFL,OAAOjK,EAvEsC,CADzB,CA2EtB4gE,IAAK,KA3EiB,CA6EtBC,OAAQ,QA7Ec,CA+EtBE,SAAUA,QAAQ,EAAG,CACnB,IAAIriD,EAAS,EAAb,CACI0gB,EAAM,IAAAzb,MAAA6vB,OADV,CAEIzzC,EAAO,IACXnH,EAAA,CAAQwmC,CAAR,CAAa,QAAQ,CAACv7B,CAAD,CAAO,CAC1B6a,CAAA1gB,KAAA,CAAY,MAAZ,CAAqB6F,CAArB,CAA4B,GAA5B,CAAkC9D,CAAAwgE,iBAAA,CAAsB18D,CAAtB,CAA4B,GAA5B,CAAlC,CAD0B,CAA5B,CAGIu7B,EAAA7mC,OAAJ,EACEmmB,CAAA1gB,KAAA,CAAY,aAAZ,CAA4BohC,CAAAr8B,KAAA,CAAS,GAAT,CAA5B,CAA4C,IAA5C,CAEF,OAAO2b,EAAA3b,KAAA,CAAY,EAAZ,CAVY,CA/EC,CA4FtBw9D,iBAAkBA,QAAQ,CAAC18D,CAAD,CAAOi6B,CAAP,CAAe,CACvC,MAAO,WAAP,CAAqBA,CAArB,CAA8B,IAA9B,CACI,IAAAkjC,WAAA,CAAgBn9D,CAAhB,CADJ,CAEI,IAAA0gC,KAAA,CAAU1gC,CAAV,CAFJ;AAGI,IAJmC,CA5FnB,CAmGtBi9D,aAAcA,QAAQ,EAAG,CACvB,IAAIl+D,EAAQ,EAAZ,CACI7C,EAAO,IACXnH,EAAA,CAAQ,IAAA+qB,MAAA8/B,QAAR,CAA4B,QAAQ,CAACv8B,CAAD,CAAK9c,CAAL,CAAa,CAC/CxH,CAAA5E,KAAA,CAAWkpB,CAAX,CAAgB,WAAhB,CAA8BnnB,CAAA6lC,OAAA,CAAYx7B,CAAZ,CAA9B,CAAoD,GAApD,CAD+C,CAAjD,CAGA,OAAIxH,EAAArK,OAAJ,CAAyB,MAAzB,CAAkCqK,CAAAG,KAAA,CAAW,GAAX,CAAlC,CAAoD,GAApD,CACO,EAPgB,CAnGH,CA6GtBi+D,WAAYA,QAAQ,CAACC,CAAD,CAAU,CAC5B,MAAO,KAAAt9C,MAAA,CAAWs9C,CAAX,CAAAjB,KAAAznE,OAAA,CAAkC,MAAlC,CAA2C,IAAAorB,MAAA,CAAWs9C,CAAX,CAAAjB,KAAAj9D,KAAA,CAA8B,GAA9B,CAA3C,CAAgF,GAAhF,CAAsF,EADjE,CA7GR,CAiHtBwhC,KAAMA,QAAQ,CAAC08B,CAAD,CAAU,CACtB,MAAO,KAAAt9C,MAAA,CAAWs9C,CAAX,CAAA18B,KAAAxhC,KAAA,CAA8B,EAA9B,CADe,CAjHF,CAqHtBs9D,QAASA,QAAQ,CAACxwB,CAAD,CAAM4wB,CAAN,CAAcS,CAAd,CAAsBC,CAAtB,CAAmCvlE,CAAnC,CAA2CwlE,CAA3C,CAA6D,CAAA,IACxE5wB,CADwE,CAClEC,CADkE,CAC3D1wC,EAAO,IADoD,CAC9Cge,CAD8C,CACxCqf,CACpC+jC,EAAA,CAAcA,CAAd,EAA6BtlE,CAC7B,IAAKulE,CAAAA,CAAL,EAAyBhlE,CAAA,CAAUyzC,CAAA6wB,QAAV,CAAzB,CACED,CACA,CADSA,CACT,EADmB,IAAAV,OAAA,EACnB,CAAA,IAAAsB,IAAA,CAAS,GAAT,CACE,IAAAC,WAAA,CAAgBb,CAAhB,CAAwB,IAAAc,eAAA,CAAoB,GAApB,CAAyB1xB,CAAA6wB,QAAzB,CAAxB,CADF,CAEE,IAAAc,YAAA,CAAiB3xB,CAAjB,CAAsB4wB,CAAtB,CAA8BS,CAA9B;AAAsCC,CAAtC,CAAmDvlE,CAAnD,CAA2D,CAAA,CAA3D,CAFF,CAFF,KAQA,QAAQi0C,CAAAx3B,KAAR,EACA,KAAK23B,CAAAC,QAAL,CACEr3C,CAAA,CAAQi3C,CAAAtL,KAAR,CAAkB,QAAQ,CAACnH,CAAD,CAAaj3B,CAAb,CAAkB,CAC1CpG,CAAAsgE,QAAA,CAAajjC,CAAAA,WAAb,CAAoCrlC,CAApC,CAA+CA,CAA/C,CAA0D,QAAQ,CAACm4C,CAAD,CAAO,CAAEO,CAAA,CAAQP,CAAV,CAAzE,CACI/pC,EAAJ,GAAY0pC,CAAAtL,KAAAhsC,OAAZ,CAA8B,CAA9B,CACEwH,CAAA85C,QAAA,EAAAtV,KAAAvmC,KAAA,CAAyByyC,CAAzB,CAAgC,GAAhC,CADF,CAGE1wC,CAAAugE,QAAA,CAAa7vB,CAAb,CALwC,CAA5C,CAQA,MACF,MAAKT,CAAAG,QAAL,CACE/S,CAAA,CAAa,IAAAwI,OAAA,CAAYiK,CAAAl2C,MAAZ,CACb,KAAAogC,OAAA,CAAY0mC,CAAZ,CAAoBrjC,CAApB,CACA+jC,EAAA,CAAY/jC,CAAZ,CACA,MACF,MAAK4S,CAAAK,gBAAL,CACE,IAAAgwB,QAAA,CAAaxwB,CAAAS,SAAb,CAA2Bv4C,CAA3B,CAAsCA,CAAtC,CAAiD,QAAQ,CAACm4C,CAAD,CAAO,CAAEO,CAAA,CAAQP,CAAV,CAAhE,CACA9S,EAAA,CAAayS,CAAAkC,SAAb,CAA4B,GAA5B,CAAkC,IAAAtC,UAAA,CAAegB,CAAf,CAAsB,CAAtB,CAAlC,CAA6D,GAC7D,KAAA1W,OAAA,CAAY0mC,CAAZ,CAAoBrjC,CAApB,CACA+jC,EAAA,CAAY/jC,CAAZ,CACA,MACF,MAAK4S,CAAAO,iBAAL,CACE,IAAA8vB,QAAA,CAAaxwB,CAAAW,KAAb,CAAuBz4C,CAAvB,CAAkCA,CAAlC,CAA6C,QAAQ,CAACm4C,CAAD,CAAO,CAAEM,CAAA,CAAON,CAAT,CAA5D,CACA,KAAAmwB,QAAA,CAAaxwB,CAAAY,MAAb,CAAwB14C,CAAxB,CAAmCA,CAAnC,CAA8C,QAAQ,CAACm4C,CAAD,CAAO,CAAEO,CAAA,CAAQP,CAAV,CAA7D,CAEE9S,EAAA,CADmB,GAArB;AAAIyS,CAAAkC,SAAJ,CACe,IAAA0vB,KAAA,CAAUjxB,CAAV,CAAgBC,CAAhB,CADf,CAE4B,GAArB,GAAIZ,CAAAkC,SAAJ,CACQ,IAAAtC,UAAA,CAAee,CAAf,CAAqB,CAArB,CADR,CACkCX,CAAAkC,SADlC,CACiD,IAAAtC,UAAA,CAAegB,CAAf,CAAsB,CAAtB,CADjD,CAGQ,GAHR,CAGcD,CAHd,CAGqB,GAHrB,CAG2BX,CAAAkC,SAH3B,CAG0C,GAH1C,CAGgDtB,CAHhD,CAGwD,GAE/D,KAAA1W,OAAA,CAAY0mC,CAAZ,CAAoBrjC,CAApB,CACA+jC,EAAA,CAAY/jC,CAAZ,CACA,MACF,MAAK4S,CAAAU,kBAAL,CACE+vB,CAAA,CAASA,CAAT,EAAmB,IAAAV,OAAA,EACnBhgE,EAAAsgE,QAAA,CAAaxwB,CAAAW,KAAb,CAAuBiwB,CAAvB,CACA1gE,EAAAshE,IAAA,CAA0B,IAAjB,GAAAxxB,CAAAkC,SAAA,CAAwB0uB,CAAxB,CAAiC1gE,CAAA2hE,IAAA,CAASjB,CAAT,CAA1C,CAA4D1gE,CAAAyhE,YAAA,CAAiB3xB,CAAAY,MAAjB,CAA4BgwB,CAA5B,CAA5D,CACAU,EAAA,CAAYV,CAAZ,CACA,MACF,MAAKzwB,CAAAW,sBAAL,CACE8vB,CAAA,CAASA,CAAT,EAAmB,IAAAV,OAAA,EACnBhgE,EAAAsgE,QAAA,CAAaxwB,CAAAjzC,KAAb,CAAuB6jE,CAAvB,CACA1gE,EAAAshE,IAAA,CAASZ,CAAT,CAAiB1gE,CAAAyhE,YAAA,CAAiB3xB,CAAAe,UAAjB,CAAgC6vB,CAAhC,CAAjB,CAA0D1gE,CAAAyhE,YAAA,CAAiB3xB,CAAAgB,WAAjB,CAAiC4vB,CAAjC,CAA1D,CACAU,EAAA,CAAYV,CAAZ,CACA,MACF,MAAKzwB,CAAAc,WAAL,CACE2vB,CAAA,CAASA,CAAT,EAAmB,IAAAV,OAAA,EACfmB,EAAJ,GACEA,CAAApoE,QAEA,CAFgC,QAAf,GAAAiH,CAAAogE,MAAA;AAA0B,GAA1B,CAAgC,IAAApmC,OAAA,CAAY,IAAAgmC,OAAA,EAAZ,CAA2B,IAAA4B,kBAAA,CAAuB,GAAvB,CAA4B9xB,CAAAhsC,KAA5B,CAA3B,CAAmE,MAAnE,CAEjD,CADAq9D,CAAAjwB,SACA,CADkB,CAAA,CAClB,CAAAiwB,CAAAr9D,KAAA,CAAcgsC,CAAAhsC,KAHhB,CAKAirC,GAAA,CAAqBe,CAAAhsC,KAArB,CACA9D,EAAAshE,IAAA,CAAwB,QAAxB,GAASthE,CAAAogE,MAAT,EAAoCpgE,CAAA2hE,IAAA,CAAS3hE,CAAA4hE,kBAAA,CAAuB,GAAvB,CAA4B9xB,CAAAhsC,KAA5B,CAAT,CAApC,CACE,QAAQ,EAAG,CACT9D,CAAAshE,IAAA,CAAwB,QAAxB,GAASthE,CAAAogE,MAAT,EAAoC,GAApC,CAAyC,QAAQ,EAAG,CAC9CvkE,CAAJ,EAAyB,CAAzB,GAAcA,CAAd,EACEmE,CAAAshE,IAAA,CACEthE,CAAA2hE,IAAA,CAAS3hE,CAAA6hE,kBAAA,CAAuB,GAAvB,CAA4B/xB,CAAAhsC,KAA5B,CAAT,CADF,CAEE9D,CAAAuhE,WAAA,CAAgBvhE,CAAA6hE,kBAAA,CAAuB,GAAvB,CAA4B/xB,CAAAhsC,KAA5B,CAAhB,CAAuD,IAAvD,CAFF,CAIF9D,EAAAg6B,OAAA,CAAY0mC,CAAZ,CAAoB1gE,CAAA6hE,kBAAA,CAAuB,GAAvB,CAA4B/xB,CAAAhsC,KAA5B,CAApB,CANkD,CAApD,CADS,CADb,CAUK48D,CAVL,EAUe1gE,CAAAuhE,WAAA,CAAgBb,CAAhB,CAAwB1gE,CAAA6hE,kBAAA,CAAuB,GAAvB,CAA4B/xB,CAAAhsC,KAA5B,CAAxB,CAVf,CAYA,EAAI9D,CAAA4jB,MAAA+uB,gBAAJ,EAAkCN,EAAA,CAA8BvC,CAAAhsC,KAA9B,CAAlC,GACE9D,CAAA8hE,oBAAA,CAAyBpB,CAAzB,CAEFU,EAAA,CAAYV,CAAZ,CACA;KACF,MAAKzwB,CAAAe,iBAAL,CACEP,CAAA,CAAO0wB,CAAP,GAAkBA,CAAApoE,QAAlB,CAAmC,IAAAinE,OAAA,EAAnC,GAAqD,IAAAA,OAAA,EACrDU,EAAA,CAASA,CAAT,EAAmB,IAAAV,OAAA,EACnBhgE,EAAAsgE,QAAA,CAAaxwB,CAAAmB,OAAb,CAAyBR,CAAzB,CAA+Bz4C,CAA/B,CAA0C,QAAQ,EAAG,CACnDgI,CAAAshE,IAAA,CAASthE,CAAA+hE,QAAA,CAAatxB,CAAb,CAAT,CAA6B,QAAQ,EAAG,CAClC50C,CAAJ,EAAyB,CAAzB,GAAcA,CAAd,EACEmE,CAAAgiE,2BAAA,CAAgCvxB,CAAhC,CAEF,IAAIX,CAAAoB,SAAJ,CACER,CASA,CATQ1wC,CAAAggE,OAAA,EASR,CARAhgE,CAAAsgE,QAAA,CAAaxwB,CAAAje,SAAb,CAA2B6e,CAA3B,CAQA,CAPA1wC,CAAAkvC,eAAA,CAAoBwB,CAApB,CAOA,CANA1wC,CAAAiiE,wBAAA,CAA6BvxB,CAA7B,CAMA,CALI70C,CAKJ,EALyB,CAKzB,GALcA,CAKd,EAJEmE,CAAAshE,IAAA,CAASthE,CAAA2hE,IAAA,CAAS3hE,CAAAwhE,eAAA,CAAoB/wB,CAApB,CAA0BC,CAA1B,CAAT,CAAT,CAAqD1wC,CAAAuhE,WAAA,CAAgBvhE,CAAAwhE,eAAA,CAAoB/wB,CAApB,CAA0BC,CAA1B,CAAhB,CAAkD,IAAlD,CAArD,CAIF,CAFArT,CAEA,CAFar9B,CAAAmvC,iBAAA,CAAsBnvC,CAAAwhE,eAAA,CAAoB/wB,CAApB,CAA0BC,CAA1B,CAAtB,CAEb,CADA1wC,CAAAg6B,OAAA,CAAY0mC,CAAZ,CAAoBrjC,CAApB,CACA,CAAI8jC,CAAJ,GACEA,CAAAjwB,SACA,CADkB,CAAA,CAClB,CAAAiwB,CAAAr9D,KAAA,CAAc4sC,CAFhB,CAVF,KAcO,CACL3B,EAAA,CAAqBe,CAAAje,SAAA/tB,KAArB,CACIjI,EAAJ;AAAyB,CAAzB,GAAcA,CAAd,EACEmE,CAAAshE,IAAA,CAASthE,CAAA2hE,IAAA,CAAS3hE,CAAA6hE,kBAAA,CAAuBpxB,CAAvB,CAA6BX,CAAAje,SAAA/tB,KAA7B,CAAT,CAAT,CAAoE9D,CAAAuhE,WAAA,CAAgBvhE,CAAA6hE,kBAAA,CAAuBpxB,CAAvB,CAA6BX,CAAAje,SAAA/tB,KAA7B,CAAhB,CAAiE,IAAjE,CAApE,CAEFu5B,EAAA,CAAar9B,CAAA6hE,kBAAA,CAAuBpxB,CAAvB,CAA6BX,CAAAje,SAAA/tB,KAA7B,CACb,IAAI9D,CAAA4jB,MAAA+uB,gBAAJ,EAAkCN,EAAA,CAA8BvC,CAAAje,SAAA/tB,KAA9B,CAAlC,CACEu5B,CAAA,CAAar9B,CAAAmvC,iBAAA,CAAsB9R,CAAtB,CAEfr9B,EAAAg6B,OAAA,CAAY0mC,CAAZ,CAAoBrjC,CAApB,CACI8jC,EAAJ,GACEA,CAAAjwB,SACA,CADkB,CAAA,CAClB,CAAAiwB,CAAAr9D,KAAA,CAAcgsC,CAAAje,SAAA/tB,KAFhB,CAVK,CAlB+B,CAAxC,CAiCG,QAAQ,EAAG,CACZ9D,CAAAg6B,OAAA,CAAY0mC,CAAZ,CAAoB,WAApB,CADY,CAjCd,CAoCAU,EAAA,CAAYV,CAAZ,CArCmD,CAArD,CAsCG,CAAE7kE,CAAAA,CAtCL,CAuCA,MACF,MAAKo0C,CAAAkB,eAAL,CACEuvB,CAAA,CAASA,CAAT,EAAmB,IAAAV,OAAA,EACflwB,EAAAzlC,OAAJ,EACEqmC,CASA,CATQ1wC,CAAAqK,OAAA,CAAYylC,CAAAsB,OAAAttC,KAAZ,CASR,CARAka,CAQA,CARO,EAQP,CAPAnlB,CAAA,CAAQi3C,CAAAz0C,UAAR,CAAuB,QAAQ,CAAC80C,CAAD,CAAO,CACpC,IAAII,EAAWvwC,CAAAggE,OAAA,EACfhgE,EAAAsgE,QAAA,CAAanwB,CAAb,CAAmBI,CAAnB,CACAvyB,EAAA/f,KAAA,CAAUsyC,CAAV,CAHoC,CAAtC,CAOA,CAFAlT,CAEA,CAFaqT,CAEb,CAFqB,GAErB;AAF2B1yB,CAAAhb,KAAA,CAAU,GAAV,CAE3B,CAF4C,GAE5C,CADAhD,CAAAg6B,OAAA,CAAY0mC,CAAZ,CAAoBrjC,CAApB,CACA,CAAA+jC,CAAA,CAAYV,CAAZ,CAVF,GAYEhwB,CAGA,CAHQ1wC,CAAAggE,OAAA,EAGR,CAFAvvB,CAEA,CAFO,EAEP,CADAzyB,CACA,CADO,EACP,CAAAhe,CAAAsgE,QAAA,CAAaxwB,CAAAsB,OAAb,CAAyBV,CAAzB,CAAgCD,CAAhC,CAAsC,QAAQ,EAAG,CAC/CzwC,CAAAshE,IAAA,CAASthE,CAAA+hE,QAAA,CAAarxB,CAAb,CAAT,CAA8B,QAAQ,EAAG,CACvC1wC,CAAAkiE,sBAAA,CAA2BxxB,CAA3B,CACA73C,EAAA,CAAQi3C,CAAAz0C,UAAR,CAAuB,QAAQ,CAAC80C,CAAD,CAAO,CACpCnwC,CAAAsgE,QAAA,CAAanwB,CAAb,CAAmBnwC,CAAAggE,OAAA,EAAnB,CAAkChoE,CAAlC,CAA6C,QAAQ,CAACu4C,CAAD,CAAW,CAC9DvyB,CAAA/f,KAAA,CAAU+B,CAAAmvC,iBAAA,CAAsBoB,CAAtB,CAAV,CAD8D,CAAhE,CADoC,CAAtC,CAKIE,EAAA3sC,KAAJ,EACO9D,CAAA4jB,MAAA+uB,gBAGL,EAFE3yC,CAAA8hE,oBAAA,CAAyBrxB,CAAA13C,QAAzB,CAEF,CAAAskC,CAAA,CAAar9B,CAAAmiE,OAAA,CAAY1xB,CAAA13C,QAAZ,CAA0B03C,CAAA3sC,KAA1B,CAAqC2sC,CAAAS,SAArC,CAAb,CAAmE,GAAnE,CAAyElzB,CAAAhb,KAAA,CAAU,GAAV,CAAzE,CAA0F,GAJ5F,EAMEq6B,CANF,CAMeqT,CANf,CAMuB,GANvB,CAM6B1yB,CAAAhb,KAAA,CAAU,GAAV,CAN7B,CAM8C,GAE9Cq6B,EAAA,CAAar9B,CAAAmvC,iBAAA,CAAsB9R,CAAtB,CACbr9B,EAAAg6B,OAAA,CAAY0mC,CAAZ,CAAoBrjC,CAApB,CAhBuC,CAAzC,CAiBG,QAAQ,EAAG,CACZr9B,CAAAg6B,OAAA,CAAY0mC,CAAZ,CAAoB,WAApB,CADY,CAjBd,CAoBAU,EAAA,CAAYV,CAAZ,CArB+C,CAAjD,CAfF,CAuCA,MACF,MAAKzwB,CAAAoB,qBAAL,CACEX,CAAA;AAAQ,IAAAsvB,OAAA,EACRvvB,EAAA,CAAO,EACP,IAAK,CAAAoB,EAAA,CAAa/B,CAAAW,KAAb,CAAL,CACE,KAAMxB,GAAA,CAAa,MAAb,CAAN,CAEF,IAAAqxB,QAAA,CAAaxwB,CAAAW,KAAb,CAAuBz4C,CAAvB,CAAkCy4C,CAAlC,CAAwC,QAAQ,EAAG,CACjDzwC,CAAAshE,IAAA,CAASthE,CAAA+hE,QAAA,CAAatxB,CAAA13C,QAAb,CAAT,CAAqC,QAAQ,EAAG,CAC9CiH,CAAAsgE,QAAA,CAAaxwB,CAAAY,MAAb,CAAwBA,CAAxB,CACA1wC,EAAA8hE,oBAAA,CAAyB9hE,CAAAmiE,OAAA,CAAY1xB,CAAA13C,QAAZ,CAA0B03C,CAAA3sC,KAA1B,CAAqC2sC,CAAAS,SAArC,CAAzB,CACAlxC,EAAAgiE,2BAAA,CAAgCvxB,CAAA13C,QAAhC,CACAskC,EAAA,CAAar9B,CAAAmiE,OAAA,CAAY1xB,CAAA13C,QAAZ,CAA0B03C,CAAA3sC,KAA1B,CAAqC2sC,CAAAS,SAArC,CAAb,CAAmEpB,CAAAkC,SAAnE,CAAkFtB,CAClF1wC,EAAAg6B,OAAA,CAAY0mC,CAAZ,CAAoBrjC,CAApB,CACA+jC,EAAA,CAAYV,CAAZ,EAAsBrjC,CAAtB,CAN8C,CAAhD,CADiD,CAAnD,CASG,CATH,CAUA,MACF,MAAK4S,CAAAqB,gBAAL,CACEtzB,CAAA,CAAO,EACPnlB,EAAA,CAAQi3C,CAAA71B,SAAR,CAAsB,QAAQ,CAACk2B,CAAD,CAAO,CACnCnwC,CAAAsgE,QAAA,CAAanwB,CAAb,CAAmBnwC,CAAAggE,OAAA,EAAnB,CAAkChoE,CAAlC,CAA6C,QAAQ,CAACu4C,CAAD,CAAW,CAC9DvyB,CAAA/f,KAAA,CAAUsyC,CAAV,CAD8D,CAAhE,CADmC,CAArC,CAKAlT,EAAA,CAAa,GAAb,CAAmBrf,CAAAhb,KAAA,CAAU,GAAV,CAAnB,CAAoC,GACpC,KAAAg3B,OAAA,CAAY0mC,CAAZ,CAAoBrjC,CAApB,CACA+jC,EAAA,CAAY/jC,CAAZ,CACA,MACF,MAAK4S,CAAAsB,iBAAL,CACEvzB,CAAA;AAAO,EACPnlB,EAAA,CAAQi3C,CAAA0B,WAAR,CAAwB,QAAQ,CAAC3f,CAAD,CAAW,CACzC7xB,CAAAsgE,QAAA,CAAazuC,CAAAj4B,MAAb,CAA6BoG,CAAAggE,OAAA,EAA7B,CAA4ChoE,CAA5C,CAAuD,QAAQ,CAACm4C,CAAD,CAAO,CACpEnyB,CAAA/f,KAAA,CAAU+B,CAAA6lC,OAAA,CACNhU,CAAA74B,IAAAsf,KAAA,GAAsB23B,CAAAc,WAAtB,CAAuClf,CAAA74B,IAAA8K,KAAvC,CACG,EADH,CACQ+tB,CAAA74B,IAAAY,MAFF,CAAV,CAGI,GAHJ,CAGUu2C,CAHV,CADoE,CAAtE,CADyC,CAA3C,CAQA9S,EAAA,CAAa,GAAb,CAAmBrf,CAAAhb,KAAA,CAAU,GAAV,CAAnB,CAAoC,GACpC,KAAAg3B,OAAA,CAAY0mC,CAAZ,CAAoBrjC,CAApB,CACA+jC,EAAA,CAAY/jC,CAAZ,CACA,MACF,MAAK4S,CAAAwB,eAAL,CACE,IAAAzX,OAAA,CAAY0mC,CAAZ,CAAoB,GAApB,CACAU,EAAA,CAAY,GAAZ,CACA,MACF,MAAKnxB,CAAAyB,iBAAL,CACE,IAAA1X,OAAA,CAAY0mC,CAAZ,CAAoB,GAApB,CACAU,EAAA,CAAY,GAAZ,CACA,MACF,MAAKnxB,CAAA8B,iBAAL,CACE,IAAA/X,OAAA,CAAY0mC,CAAZ,CAAoB,GAApB,CACA,CAAAU,CAAA,CAAY,GAAZ,CAjNF,CAX4E,CArHxD,CAsVtBQ,kBAAmBA,QAAQ,CAACtkE,CAAD,CAAUu0B,CAAV,CAAoB,CAC7C,IAAI74B,EAAMsE,CAANtE,CAAgB,GAAhBA,CAAsB64B,CAA1B,CACIquC,EAAM,IAAApmB,QAAA,EAAAomB,IACLA,EAAAhnE,eAAA,CAAmBF,CAAnB,CAAL,GACEknE,CAAA,CAAIlnE,CAAJ,CADF,CACa,IAAAgnE,OAAA,CAAY,CAAA,CAAZ,CAAmB1iE,CAAnB,CAA6B,KAA7B,CAAqC,IAAAuoC,OAAA,CAAYhU,CAAZ,CAArC,CAA6D,MAA7D;AAAsEv0B,CAAtE,CAAgF,GAAhF,CADb,CAGA,OAAO4iE,EAAA,CAAIlnE,CAAJ,CANsC,CAtVzB,CA+VtBghC,OAAQA,QAAQ,CAAC7S,CAAD,CAAKvtB,CAAL,CAAY,CAC1B,GAAKutB,CAAL,CAEA,MADA,KAAA2yB,QAAA,EAAAtV,KAAAvmC,KAAA,CAAyBkpB,CAAzB,CAA6B,GAA7B,CAAkCvtB,CAAlC,CAAyC,GAAzC,CACOutB,CAAAA,CAHmB,CA/VN,CAqWtB9c,OAAQA,QAAQ,CAAC+3D,CAAD,CAAa,CACtB,IAAAx+C,MAAA8/B,QAAAxqD,eAAA,CAAkCkpE,CAAlC,CAAL,GACE,IAAAx+C,MAAA8/B,QAAA,CAAmB0e,CAAnB,CADF,CACmC,IAAApC,OAAA,CAAY,CAAA,CAAZ,CADnC,CAGA,OAAO,KAAAp8C,MAAA8/B,QAAA,CAAmB0e,CAAnB,CAJoB,CArWP,CA4WtB1yB,UAAWA,QAAQ,CAACvoB,CAAD,CAAKk7C,CAAL,CAAmB,CACpC,MAAO,YAAP,CAAsBl7C,CAAtB,CAA2B,GAA3B,CAAiC,IAAA0e,OAAA,CAAYw8B,CAAZ,CAAjC,CAA6D,GADzB,CA5WhB,CAgXtBX,KAAMA,QAAQ,CAACjxB,CAAD,CAAOC,CAAP,CAAc,CAC1B,MAAO,OAAP,CAAiBD,CAAjB,CAAwB,GAAxB,CAA8BC,CAA9B,CAAsC,GADZ,CAhXN,CAoXtB6vB,QAASA,QAAQ,CAACp5C,CAAD,CAAK,CACpB,IAAA2yB,QAAA,EAAAtV,KAAAvmC,KAAA,CAAyB,SAAzB,CAAoCkpB,CAApC,CAAwC,GAAxC,CADoB,CApXA,CAwXtBm6C,IAAKA,QAAQ,CAACzkE,CAAD,CAAOg0C,CAAP,CAAkBC,CAAlB,CAA8B,CACzC,GAAa,CAAA,CAAb,GAAIj0C,CAAJ,CACEg0C,CAAA,EADF,KAEO,CACL,IAAIrM,EAAO,IAAAsV,QAAA,EAAAtV,KACXA,EAAAvmC,KAAA,CAAU,KAAV,CAAiBpB,CAAjB,CAAuB,IAAvB,CACAg0C,EAAA,EACArM,EAAAvmC,KAAA,CAAU,GAAV,CACI6yC;CAAJ,GACEtM,CAAAvmC,KAAA,CAAU,OAAV,CAEA,CADA6yC,CAAA,EACA,CAAAtM,CAAAvmC,KAAA,CAAU,GAAV,CAHF,CALK,CAHkC,CAxXrB,CAwYtB0jE,IAAKA,QAAQ,CAACtkC,CAAD,CAAa,CACxB,MAAO,IAAP,CAAcA,CAAd,CAA2B,GADH,CAxYJ,CA4YtB0kC,QAASA,QAAQ,CAAC1kC,CAAD,CAAa,CAC5B,MAAOA,EAAP,CAAoB,QADQ,CA5YR,CAgZtBwkC,kBAAmBA,QAAQ,CAACpxB,CAAD,CAAOC,CAAP,CAAc,CACvC,MAAOD,EAAP,CAAc,GAAd,CAAoBC,CADmB,CAhZnB,CAoZtB8wB,eAAgBA,QAAQ,CAAC/wB,CAAD,CAAOC,CAAP,CAAc,CACpC,MAAOD,EAAP,CAAc,GAAd,CAAoBC,CAApB,CAA4B,GADQ,CApZhB,CAwZtByxB,OAAQA,QAAQ,CAAC1xB,CAAD,CAAOC,CAAP,CAAcQ,CAAd,CAAwB,CACtC,MAAIA,EAAJ,CAAqB,IAAAswB,eAAA,CAAoB/wB,CAApB,CAA0BC,CAA1B,CAArB,CACO,IAAAmxB,kBAAA,CAAuBpxB,CAAvB,CAA6BC,CAA7B,CAF+B,CAxZlB,CA6ZtBoxB,oBAAqBA,QAAQ,CAAClpE,CAAD,CAAO,CAClC,IAAAkhD,QAAA,EAAAtV,KAAAvmC,KAAA,CAAyB,IAAAkxC,iBAAA,CAAsBv2C,CAAtB,CAAzB,CAAsD,GAAtD,CADkC,CA7Zd,CAiatBqpE,wBAAyBA,QAAQ,CAACrpE,CAAD,CAAO,CACtC,IAAAkhD,QAAA,EAAAtV,KAAAvmC,KAAA,CAAyB,IAAA8wC,qBAAA,CAA0Bn2C,CAA1B,CAAzB,CAA0D,GAA1D,CADsC,CAjalB,CAqatBspE,sBAAuBA,QAAQ,CAACtpE,CAAD,CAAO,CACpC,IAAAkhD,QAAA,EAAAtV,KAAAvmC,KAAA,CAAyB,IAAAoxC,mBAAA,CAAwBz2C,CAAxB,CAAzB;AAAwD,GAAxD,CADoC,CArahB,CAyatBopE,2BAA4BA,QAAQ,CAACppE,CAAD,CAAO,CACzC,IAAAkhD,QAAA,EAAAtV,KAAAvmC,KAAA,CAAyB,IAAAwxC,wBAAA,CAA6B72C,CAA7B,CAAzB,CAA6D,GAA7D,CADyC,CAzarB,CA6atBu2C,iBAAkBA,QAAQ,CAACv2C,CAAD,CAAO,CAC/B,MAAO,mBAAP,CAA6BA,CAA7B,CAAoC,QADL,CA7aX,CAibtBm2C,qBAAsBA,QAAQ,CAACn2C,CAAD,CAAO,CACnC,MAAO,uBAAP,CAAiCA,CAAjC,CAAwC,QADL,CAjbf,CAqbtBy2C,mBAAoBA,QAAQ,CAACz2C,CAAD,CAAO,CACjC,MAAO,qBAAP,CAA+BA,CAA/B,CAAsC,QADL,CArbb,CAybtBs2C,eAAgBA,QAAQ,CAACt2C,CAAD,CAAO,CAC7B,IAAAohC,OAAA,CAAYphC,CAAZ,CAAkB,iBAAlB,CAAsCA,CAAtC,CAA6C,GAA7C,CAD6B,CAzbT,CA6btB62C,wBAAyBA,QAAQ,CAAC72C,CAAD,CAAO,CACtC,MAAO,0BAAP,CAAoCA,CAApC,CAA2C,QADL,CA7blB,CAictB6oE,YAAaA,QAAQ,CAAC3xB,CAAD,CAAM4wB,CAAN,CAAcS,CAAd,CAAsBC,CAAtB,CAAmCvlE,CAAnC,CAA2CwlE,CAA3C,CAA6D,CAChF,IAAIrhE;AAAO,IACX,OAAO,SAAQ,EAAG,CAChBA,CAAAsgE,QAAA,CAAaxwB,CAAb,CAAkB4wB,CAAlB,CAA0BS,CAA1B,CAAkCC,CAAlC,CAA+CvlE,CAA/C,CAAuDwlE,CAAvD,CADgB,CAF8D,CAjc5D,CAwctBE,WAAYA,QAAQ,CAACp6C,CAAD,CAAKvtB,CAAL,CAAY,CAC9B,IAAIoG,EAAO,IACX,OAAO,SAAQ,EAAG,CAChBA,CAAAg6B,OAAA,CAAY7S,CAAZ,CAAgBvtB,CAAhB,CADgB,CAFY,CAxcV,CA+ctB0oE,kBAAmB,gBA/cG,CAidtBC,eAAgBA,QAAQ,CAACC,CAAD,CAAI,CAC1B,MAAO,KAAP,CAAepnE,CAAC,MAADA,CAAUonE,CAAAC,WAAA,CAAa,CAAb,CAAAtmE,SAAA,CAAyB,EAAzB,CAAVf,OAAA,CAA+C,EAA/C,CADW,CAjdN,CAqdtByqC,OAAQA,QAAQ,CAACjsC,CAAD,CAAQ,CACtB,GAAItB,CAAA,CAASsB,CAAT,CAAJ,CAAqB,MAAO,GAAP,CAAaA,CAAAqH,QAAA,CAAc,IAAAqhE,kBAAd,CAAsC,IAAAC,eAAtC,CAAb,CAA0E,GAC/F,IAAI7pE,CAAA,CAASkB,CAAT,CAAJ,CAAqB,MAAOA,EAAAuC,SAAA,EAC5B,IAAc,CAAA,CAAd,GAAIvC,CAAJ,CAAoB,MAAO,MAC3B,IAAc,CAAA,CAAd,GAAIA,CAAJ,CAAqB,MAAO,OAC5B,IAAc,IAAd,GAAIA,CAAJ,CAAoB,MAAO,MAC3B,IAAqB,WAArB,GAAI,MAAOA,EAAX,CAAkC,MAAO,WAEzC,MAAMq1C,GAAA,CAAa,KAAb,CAAN,CARsB,CArdF,CAgetB+wB,OAAQA,QAAQ,CAAC0C,CAAD;AAAOC,CAAP,CAAa,CAC3B,IAAIx7C,EAAK,GAALA,CAAY,IAAAvD,MAAAo8C,OAAA,EACX0C,EAAL,EACE,IAAA5oB,QAAA,EAAAmmB,KAAAhiE,KAAA,CAAyBkpB,CAAzB,EAA+Bw7C,CAAA,CAAO,GAAP,CAAaA,CAAb,CAAoB,EAAnD,EAEF,OAAOx7C,EALoB,CAheP,CAwetB2yB,QAASA,QAAQ,EAAG,CAClB,MAAO,KAAAl2B,MAAA,CAAW,IAAAA,MAAAy8C,UAAX,CADW,CAxeE,CAmfxBjuB,GAAAhyB,UAAA,CAA2B,CACzBpb,QAASA,QAAQ,CAACq4B,CAAD,CAAasV,CAAb,CAA8B,CAC7C,IAAI3yC,EAAO,IAAX,CACI8vC,EAAM,IAAAqC,WAAArC,IAAA,CAAoBzS,CAApB,CACV,KAAAA,WAAA,CAAkBA,CAClB,KAAAsV,gBAAA,CAAuBA,CACvB9C,EAAA,CAAgCC,CAAhC,CAAqC9vC,CAAAkS,QAArC,CACA,KAAIiuD,CAAJ,CACInmC,CACJ,IAAKmmC,CAAL,CAAkBruB,EAAA,CAAchC,CAAd,CAAlB,CACE9V,CAAA,CAAS,IAAAsmC,QAAA,CAAaH,CAAb,CAEP9vB,EAAAA,CAAUsB,EAAA,CAAU7B,CAAAtL,KAAV,CACd,KAAIiP,CACApD,EAAJ,GACEoD,CACA,CADS,EACT,CAAA56C,CAAA,CAAQw3C,CAAR,CAAiB,QAAQ,CAAC+L,CAAD,CAAQpjD,CAAR,CAAa,CACpC,IAAIsS,EAAQtL,CAAAsgE,QAAA,CAAalkB,CAAb,CACZA,EAAA9wC,MAAA,CAAcA,CACdmoC,EAAAx1C,KAAA,CAAYqN,CAAZ,CACA8wC,EAAAukB,QAAA,CAAgB3nE,CAJoB,CAAtC,CAFF,CASA,KAAIm/B,EAAc,EAClBt/B,EAAA,CAAQi3C,CAAAtL,KAAR,CAAkB,QAAQ,CAACnH,CAAD,CAAa,CACrClF,CAAAl6B,KAAA,CAAiB+B,CAAAsgE,QAAA,CAAajjC,CAAAA,WAAb,CAAjB,CADqC,CAAvC,CAGIp9B,EAAAA,CAAyB,CAApB,GAAA6vC,CAAAtL,KAAAhsC,OAAA,CAAwB,QAAQ,EAAG,EAAnC;AACoB,CAApB,GAAAs3C,CAAAtL,KAAAhsC,OAAA,CAAwB2/B,CAAA,CAAY,CAAZ,CAAxB,CACA,QAAQ,CAACpzB,CAAD,CAAQgb,CAAR,CAAgB,CACtB,IAAI2Z,CACJ7gC,EAAA,CAAQs/B,CAAR,CAAqB,QAAQ,CAAC0O,CAAD,CAAM,CACjCnN,CAAA,CAAYmN,CAAA,CAAI9hC,CAAJ,CAAWgb,CAAX,CADqB,CAAnC,CAGA,OAAO2Z,EALe,CAO7BM,EAAJ,GACE/5B,CAAA+5B,OADF,CACc4oC,QAAQ,CAAC79D,CAAD,CAAQnL,CAAR,CAAemmB,CAAf,CAAuB,CACzC,MAAOia,EAAA,CAAOj1B,CAAP,CAAcgb,CAAd,CAAsBnmB,CAAtB,CADkC,CAD7C,CAKI65C,EAAJ,GACExzC,CAAAwzC,OADF,CACcA,CADd,CAGAxzC,EAAA85B,QAAA,CAAakY,EAAA,CAAUnC,CAAV,CACb7vC,EAAAiK,SAAA,CAAyB4lC,CAxiBpB5lC,SAyiBL,OAAOjK,EA7CsC,CADtB,CAiDzBqgE,QAASA,QAAQ,CAACxwB,CAAD,CAAM/2C,CAAN,CAAe8C,CAAf,CAAuB,CAAA,IAClC40C,CADkC,CAC5BC,CAD4B,CACrB1wC,EAAO,IADc,CACRge,CAC9B,IAAI8xB,CAAAxkC,MAAJ,CACE,MAAO,KAAAmoC,OAAA,CAAY3D,CAAAxkC,MAAZ,CAAuBwkC,CAAA6wB,QAAvB,CAET,QAAQ7wB,CAAAx3B,KAAR,EACA,KAAK23B,CAAAG,QAAL,CACE,MAAO,KAAAx2C,MAAA,CAAWk2C,CAAAl2C,MAAX,CAAsBb,CAAtB,CACT,MAAKk3C,CAAAK,gBAAL,CAEE,MADAI,EACO,CADC,IAAA4vB,QAAA,CAAaxwB,CAAAS,SAAb,CACD,CAAA,IAAA,CAAK,OAAL,CAAeT,CAAAkC,SAAf,CAAA,CAA6BtB,CAA7B,CAAoC33C,CAApC,CACT,MAAKk3C,CAAAO,iBAAL,CAGE,MAFAC,EAEO,CAFA,IAAA6vB,QAAA,CAAaxwB,CAAAW,KAAb,CAEA,CADPC,CACO,CADC,IAAA4vB,QAAA,CAAaxwB,CAAAY,MAAb,CACD;AAAA,IAAA,CAAK,QAAL,CAAgBZ,CAAAkC,SAAhB,CAAA,CAA8BvB,CAA9B,CAAoCC,CAApC,CAA2C33C,CAA3C,CACT,MAAKk3C,CAAAU,kBAAL,CAGE,MAFAF,EAEO,CAFA,IAAA6vB,QAAA,CAAaxwB,CAAAW,KAAb,CAEA,CADPC,CACO,CADC,IAAA4vB,QAAA,CAAaxwB,CAAAY,MAAb,CACD,CAAA,IAAA,CAAK,QAAL,CAAgBZ,CAAAkC,SAAhB,CAAA,CAA8BvB,CAA9B,CAAoCC,CAApC,CAA2C33C,CAA3C,CACT,MAAKk3C,CAAAW,sBAAL,CACE,MAAO,KAAA,CAAK,WAAL,CAAA,CACL,IAAA0vB,QAAA,CAAaxwB,CAAAjzC,KAAb,CADK,CAEL,IAAAyjE,QAAA,CAAaxwB,CAAAe,UAAb,CAFK,CAGL,IAAAyvB,QAAA,CAAaxwB,CAAAgB,WAAb,CAHK,CAIL/3C,CAJK,CAMT,MAAKk3C,CAAAc,WAAL,CAEE,MADAhC,GAAA,CAAqBe,CAAAhsC,KAArB,CAA+B9D,CAAAq9B,WAA/B,CACO,CAAAr9B,CAAAozB,WAAA,CAAgB0c,CAAAhsC,KAAhB,CACgB9D,CAAA2yC,gBADhB,EACwCN,EAAA,CAA8BvC,CAAAhsC,KAA9B,CADxC,CAEgB/K,CAFhB,CAEyB8C,CAFzB,CAEiCmE,CAAAq9B,WAFjC,CAGT,MAAK4S,CAAAe,iBAAL,CAOE,MANAP,EAMO,CANA,IAAA6vB,QAAA,CAAaxwB,CAAAmB,OAAb,CAAyB,CAAA,CAAzB,CAAgC,CAAEp1C,CAAAA,CAAlC,CAMA,CALFi0C,CAAAoB,SAKE,GAJLnC,EAAA,CAAqBe,CAAAje,SAAA/tB,KAArB,CAAwC9D,CAAAq9B,WAAxC,CACA;AAAAqT,CAAA,CAAQZ,CAAAje,SAAA/tB,KAGH,EADHgsC,CAAAoB,SACG,GADWR,CACX,CADmB,IAAA4vB,QAAA,CAAaxwB,CAAAje,SAAb,CACnB,EAAAie,CAAAoB,SAAA,CACL,IAAAswB,eAAA,CAAoB/wB,CAApB,CAA0BC,CAA1B,CAAiC33C,CAAjC,CAA0C8C,CAA1C,CAAkDmE,CAAAq9B,WAAlD,CADK,CAEL,IAAAwkC,kBAAA,CAAuBpxB,CAAvB,CAA6BC,CAA7B,CAAoC1wC,CAAA2yC,gBAApC,CAA0D55C,CAA1D,CAAmE8C,CAAnE,CAA2EmE,CAAAq9B,WAA3E,CACJ,MAAK4S,CAAAkB,eAAL,CAOE,MANAnzB,EAMO,CANA,EAMA,CALPnlB,CAAA,CAAQi3C,CAAAz0C,UAAR,CAAuB,QAAQ,CAAC80C,CAAD,CAAO,CACpCnyB,CAAA/f,KAAA,CAAU+B,CAAAsgE,QAAA,CAAanwB,CAAb,CAAV,CADoC,CAAtC,CAKO,CAFHL,CAAAzlC,OAEG,GAFSqmC,CAET,CAFiB,IAAAx+B,QAAA,CAAa49B,CAAAsB,OAAAttC,KAAb,CAEjB,EADFgsC,CAAAzlC,OACE,GADUqmC,CACV,CADkB,IAAA4vB,QAAA,CAAaxwB,CAAAsB,OAAb,CAAyB,CAAA,CAAzB,CAClB,EAAAtB,CAAAzlC,OAAA,CACL,QAAQ,CAACtF,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CAEtC,IADA,IAAIjX,EAAS,EAAb,CACS/iC,EAAI,CAAb,CAAgBA,CAAhB,CAAoBukB,CAAAxlB,OAApB,CAAiC,EAAEiB,CAAnC,CACE+iC,CAAAv+B,KAAA,CAAY+f,CAAA,CAAKvkB,CAAL,CAAA,CAAQsL,CAAR,CAAegb,CAAf,CAAuBia,CAAvB,CAA+ByZ,CAA/B,CAAZ,CAEE75C,EAAAA,CAAQ82C,CAAAtwC,MAAA,CAAYpI,CAAZ,CAAuBwkC,CAAvB,CAA+BiX,CAA/B,CACZ,OAAO16C,EAAA,CAAU,CAACA,QAASf,CAAV,CAAqB8L,KAAM9L,CAA3B,CAAsC4B,MAAOA,CAA7C,CAAV,CAAgEA,CANjC,CADnC,CASL,QAAQ,CAACmL,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACtC,IAAIovB;AAAMnyB,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CAAV,CACI75C,CACJ,IAAiB,IAAjB,EAAIipE,CAAAjpE,MAAJ,CAAuB,CACrBu1C,EAAA,CAAiB0zB,CAAA9pE,QAAjB,CAA8BiH,CAAAq9B,WAA9B,CACAgS,GAAA,CAAmBwzB,CAAAjpE,MAAnB,CAA8BoG,CAAAq9B,WAA9B,CACIb,EAAAA,CAAS,EACb,KAAS,IAAA/iC,EAAI,CAAb,CAAgBA,CAAhB,CAAoBukB,CAAAxlB,OAApB,CAAiC,EAAEiB,CAAnC,CACE+iC,CAAAv+B,KAAA,CAAYkxC,EAAA,CAAiBnxB,CAAA,CAAKvkB,CAAL,CAAA,CAAQsL,CAAR,CAAegb,CAAf,CAAuBia,CAAvB,CAA+ByZ,CAA/B,CAAjB,CAAyDzzC,CAAAq9B,WAAzD,CAAZ,CAEFzjC,EAAA,CAAQu1C,EAAA,CAAiB0zB,CAAAjpE,MAAAwG,MAAA,CAAgByiE,CAAA9pE,QAAhB,CAA6ByjC,CAA7B,CAAjB,CAAuDx8B,CAAAq9B,WAAvD,CAPa,CASvB,MAAOtkC,EAAA,CAAU,CAACa,MAAOA,CAAR,CAAV,CAA2BA,CAZI,CAc5C,MAAKq2C,CAAAoB,qBAAL,CAGE,MAFAZ,EAEO,CAFA,IAAA6vB,QAAA,CAAaxwB,CAAAW,KAAb,CAAuB,CAAA,CAAvB,CAA6B,CAA7B,CAEA,CADPC,CACO,CADC,IAAA4vB,QAAA,CAAaxwB,CAAAY,MAAb,CACD,CAAA,QAAQ,CAAC3rC,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CAC7C,IAAIqvB,EAAMryB,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CACNovB,EAAAA,CAAMnyB,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CACVtE,GAAA,CAAiB2zB,CAAAlpE,MAAjB,CAA4BoG,CAAAq9B,WAA5B,CACAoS,GAAA,CAAwBqzB,CAAA/pE,QAAxB,CACA+pE,EAAA/pE,QAAA,CAAY+pE,CAAAh/D,KAAZ,CAAA,CAAwB++D,CACxB,OAAO9pE,EAAA,CAAU,CAACa,MAAOipE,CAAR,CAAV,CAAyBA,CANa,CAQjD,MAAK5yB,CAAAqB,gBAAL,CAKE,MAJAtzB,EAIO,CAJA,EAIA,CAHPnlB,CAAA,CAAQi3C,CAAA71B,SAAR,CAAsB,QAAQ,CAACk2B,CAAD,CAAO,CACnCnyB,CAAA/f,KAAA,CAAU+B,CAAAsgE,QAAA,CAAanwB,CAAb,CAAV,CADmC,CAArC,CAGO;AAAA,QAAQ,CAACprC,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CAE7C,IADA,IAAI75C,EAAQ,EAAZ,CACSH,EAAI,CAAb,CAAgBA,CAAhB,CAAoBukB,CAAAxlB,OAApB,CAAiC,EAAEiB,CAAnC,CACEG,CAAAqE,KAAA,CAAW+f,CAAA,CAAKvkB,CAAL,CAAA,CAAQsL,CAAR,CAAegb,CAAf,CAAuBia,CAAvB,CAA+ByZ,CAA/B,CAAX,CAEF,OAAO16C,EAAA,CAAU,CAACa,MAAOA,CAAR,CAAV,CAA2BA,CALW,CAOjD,MAAKq2C,CAAAsB,iBAAL,CASE,MARAvzB,EAQO,CARA,EAQA,CAPPnlB,CAAA,CAAQi3C,CAAA0B,WAAR,CAAwB,QAAQ,CAAC3f,CAAD,CAAW,CACzC7T,CAAA/f,KAAA,CAAU,CAACjF,IAAK64B,CAAA74B,IAAAsf,KAAA,GAAsB23B,CAAAc,WAAtB,CACAlf,CAAA74B,IAAA8K,KADA,CAEC,EAFD,CAEM+tB,CAAA74B,IAAAY,MAFZ,CAGCA,MAAOoG,CAAAsgE,QAAA,CAAazuC,CAAAj4B,MAAb,CAHR,CAAV,CADyC,CAA3C,CAOO,CAAA,QAAQ,CAACmL,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CAE7C,IADA,IAAI75C,EAAQ,EAAZ,CACSH,EAAI,CAAb,CAAgBA,CAAhB,CAAoBukB,CAAAxlB,OAApB,CAAiC,EAAEiB,CAAnC,CACEG,CAAA,CAAMokB,CAAA,CAAKvkB,CAAL,CAAAT,IAAN,CAAA,CAAqBglB,CAAA,CAAKvkB,CAAL,CAAAG,MAAA,CAAcmL,CAAd,CAAqBgb,CAArB,CAA6Bia,CAA7B,CAAqCyZ,CAArC,CAEvB,OAAO16C,EAAA,CAAU,CAACa,MAAOA,CAAR,CAAV,CAA2BA,CALW,CAOjD,MAAKq2C,CAAAwB,eAAL,CACE,MAAO,SAAQ,CAAC1sC,CAAD,CAAQ,CACrB,MAAOhM,EAAA,CAAU,CAACa,MAAOmL,CAAR,CAAV,CAA2BA,CADb,CAGzB,MAAKkrC,CAAAyB,iBAAL,CACE,MAAO,SAAQ,CAAC3sC,CAAD,CAAQgb,CAAR,CAAgB,CAC7B,MAAOhnB,EAAA,CAAU,CAACa,MAAOmmB,CAAR,CAAV,CAA4BA,CADN,CAGjC,MAAKkwB,CAAA8B,iBAAL,CACE,MAAO,SAAQ,CAAChtC,CAAD;AAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CAC7C,MAAO16C,EAAA,CAAU,CAACa,MAAOogC,CAAR,CAAV,CAA4BA,CADU,CAlHjD,CALsC,CAjDf,CA8KzB,SAAU+oC,QAAQ,CAACxyB,CAAD,CAAWx3C,CAAX,CAAoB,CACpC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM4oC,CAAA,CAASxrC,CAAT,CAAgBgb,CAAhB,CAAwBia,CAAxB,CAAgCyZ,CAAhC,CAER9rC,EAAA,CADEtL,CAAA,CAAUsL,CAAV,CAAJ,CACQ,CAACA,CADT,CAGQ,CAER,OAAO5O,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAPa,CADX,CA9Kb,CAyLzB,SAAUq7D,QAAQ,CAACzyB,CAAD,CAAWx3C,CAAX,CAAoB,CACpC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM4oC,CAAA,CAASxrC,CAAT,CAAgBgb,CAAhB,CAAwBia,CAAxB,CAAgCyZ,CAAhC,CAER9rC,EAAA,CADEtL,CAAA,CAAUsL,CAAV,CAAJ,CACQ,CAACA,CADT,CAGQ,CAER,OAAO5O,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAPa,CADX,CAzLb,CAoMzB,SAAUs7D,QAAQ,CAAC1yB,CAAD,CAAWx3C,CAAX,CAAoB,CACpC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM,CAAC4oC,CAAA,CAASxrC,CAAT,CAAgBgb,CAAhB,CAAwBia,CAAxB,CAAgCyZ,CAAhC,CACX,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADX,CApMb,CA0MzB,UAAWu7D,QAAQ,CAACzyB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CACxC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CAC7C,IAAIqvB,EAAMryB,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CACNovB,EAAAA,CAAMnyB,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CACN9rC,EAAAA,CAAMgoC,EAAA,CAAOmzB,CAAP,CAAYD,CAAZ,CACV,OAAO9pE,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAJa,CADP,CA1MjB,CAkNzB,UAAWw7D,QAAQ,CAAC1yB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CACxC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CAC7C,IAAIqvB,EAAMryB,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CACNovB,EAAAA,CAAMnyB,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CACN9rC;CAAAA,EAAOtL,CAAA,CAAUymE,CAAV,CAAA,CAAiBA,CAAjB,CAAuB,CAA9Bn7D,GAAoCtL,CAAA,CAAUwmE,CAAV,CAAA,CAAiBA,CAAjB,CAAuB,CAA3Dl7D,CACJ,OAAO5O,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAJa,CADP,CAlNjB,CA0NzB,UAAWy7D,QAAQ,CAAC3yB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CACxC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM8oC,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAN9rC,CAA4C+oC,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CAChD,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADP,CA1NjB,CAgOzB,UAAW07D,QAAQ,CAAC5yB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CACxC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM8oC,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAN9rC,CAA4C+oC,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CAChD,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADP,CAhOjB,CAsOzB,UAAW27D,QAAQ,CAAC7yB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CACxC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM8oC,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAN9rC,CAA4C+oC,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CAChD,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADP,CAtOjB,CA4OzB,YAAa47D,QAAQ,CAAC9yB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CAC1C,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM8oC,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAN9rC,GAA8C+oC,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CAClD,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADL,CA5OnB,CAkPzB,YAAa67D,QAAQ,CAAC/yB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CAC1C,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM8oC,CAAA,CAAK1rC,CAAL;AAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAN9rC,GAA8C+oC,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CAClD,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADL,CAlPnB,CAwPzB,WAAY87D,QAAQ,CAAChzB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CACzC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM8oC,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAN9rC,EAA6C+oC,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CACjD,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADN,CAxPlB,CA8PzB,WAAY+7D,QAAQ,CAACjzB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CACzC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM8oC,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAN9rC,EAA6C+oC,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CACjD,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADN,CA9PlB,CAoQzB,UAAWg8D,QAAQ,CAAClzB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CACxC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM8oC,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAN9rC,CAA4C+oC,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CAChD,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADP,CApQjB,CA0QzB,UAAWi8D,QAAQ,CAACnzB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CACxC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM8oC,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAN9rC,CAA4C+oC,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CAChD,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADP,CA1QjB,CAgRzB,WAAYk8D,QAAQ,CAACpzB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CACzC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM8oC,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB;AAA4ByZ,CAA5B,CAAN9rC,EAA6C+oC,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CACjD,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADN,CAhRlB,CAsRzB,WAAYm8D,QAAQ,CAACrzB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CACzC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM8oC,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAN9rC,EAA6C+oC,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CACjD,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADN,CAtRlB,CA4RzB,WAAYo8D,QAAQ,CAACtzB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CACzC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM8oC,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAN9rC,EAA6C+oC,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CACjD,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADN,CA5RlB,CAkSzB,WAAYq8D,QAAQ,CAACvzB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB,CACzC,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM8oC,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAN9rC,EAA6C+oC,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CACjD,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADN,CAlSlB,CAwSzB,YAAas8D,QAAQ,CAACpnE,CAAD,CAAOg0C,CAAP,CAAkBC,CAAlB,CAA8B/3C,CAA9B,CAAuC,CAC1D,MAAO,SAAQ,CAACgM,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9rC,CAAAA,CAAM9K,CAAA,CAAKkI,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAA,CAAsC5C,CAAA,CAAU9rC,CAAV,CAAiBgb,CAAjB,CAAyBia,CAAzB,CAAiCyZ,CAAjC,CAAtC,CAAiF3C,CAAA,CAAW/rC,CAAX,CAAkBgb,CAAlB,CAA0Bia,CAA1B,CAAkCyZ,CAAlC,CAC3F,OAAO16C,EAAA,CAAU,CAACa,MAAO+N,CAAR,CAAV,CAAyBA,CAFa,CADW,CAxSnC,CA8SzB/N,MAAOA,QAAQ,CAACA,CAAD,CAAQb,CAAR,CAAiB,CAC9B,MAAO,SAAQ,EAAG,CAAE,MAAOA,EAAA,CAAU,CAACA,QAASf,CAAV;AAAqB8L,KAAM9L,CAA3B,CAAsC4B,MAAOA,CAA7C,CAAV,CAAgEA,CAAzE,CADY,CA9SP,CAiTzBw5B,WAAYA,QAAQ,CAACtvB,CAAD,CAAO6uC,CAAP,CAAwB55C,CAAxB,CAAiC8C,CAAjC,CAAyCwhC,CAAzC,CAAqD,CACvE,MAAO,SAAQ,CAACt4B,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzC9H,CAAAA,CAAO5rB,CAAA,EAAWjc,CAAX,GAAmBic,EAAnB,CAA6BA,CAA7B,CAAsChb,CAC7ClJ,EAAJ,EAAyB,CAAzB,GAAcA,CAAd,EAA8B8vC,CAA9B,EAAwC,CAAAA,CAAA,CAAK7nC,CAAL,CAAxC,GACE6nC,CAAA,CAAK7nC,CAAL,CADF,CACe,EADf,CAGIlK,EAAAA,CAAQ+xC,CAAA,CAAOA,CAAA,CAAK7nC,CAAL,CAAP,CAAoB9L,CAC5B26C,EAAJ,EACExD,EAAA,CAAiBv1C,CAAjB,CAAwByjC,CAAxB,CAEF,OAAItkC,EAAJ,CACS,CAACA,QAAS4yC,CAAV,CAAgB7nC,KAAMA,CAAtB,CAA4BlK,MAAOA,CAAnC,CADT,CAGSA,CAZoC,CADwB,CAjThD,CAkUzB4nE,eAAgBA,QAAQ,CAAC/wB,CAAD,CAAOC,CAAP,CAAc33C,CAAd,CAAuB8C,CAAvB,CAA+BwhC,CAA/B,CAA2C,CACjE,MAAO,SAAQ,CAACt4B,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CAC7C,IAAIqvB,EAAMryB,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CAAV,CACIovB,CADJ,CAEIjpE,CACO,KAAX,EAAIkpE,CAAJ,GACED,CAUA,CAVMnyB,CAAA,CAAM3rC,CAAN,CAAagb,CAAb,CAAqBia,CAArB,CAA6ByZ,CAA7B,CAUN,CATAovB,CASA,EA1hDQ,EA0hDR,CARA9zB,EAAA,CAAqB8zB,CAArB,CAA0BxlC,CAA1B,CAQA,CAPIxhC,CAOJ,EAPyB,CAOzB,GAPcA,CAOd,GANE4zC,EAAA,CAAwBqzB,CAAxB,CACA,CAAIA,CAAJ,EAAa,CAAAA,CAAA,CAAID,CAAJ,CAAb,GACEC,CAAA,CAAID,CAAJ,CADF,CACa,EADb,CAKF,EADAjpE,CACA,CADQkpE,CAAA,CAAID,CAAJ,CACR,CAAA1zB,EAAA,CAAiBv1C,CAAjB,CAAwByjC,CAAxB,CAXF,CAaA,OAAItkC,EAAJ,CACS,CAACA,QAAS+pE,CAAV,CAAeh/D,KAAM++D,CAArB,CAA0BjpE,MAAOA,CAAjC,CADT,CAGSA,CApBoC,CADkB,CAlU1C,CA2VzBioE,kBAAmBA,QAAQ,CAACpxB,CAAD,CAAOC,CAAP,CAAciC,CAAd,CAA+B55C,CAA/B,CAAwC8C,CAAxC,CAAgDwhC,CAAhD,CAA4D,CACrF,MAAO,SAAQ,CAACt4B,CAAD,CAAQgb,CAAR,CAAgBia,CAAhB,CAAwByZ,CAAxB,CAAgC,CACzCqvB,CAAAA,CAAMryB,CAAA,CAAK1rC,CAAL,CAAYgb,CAAZ,CAAoBia,CAApB,CAA4ByZ,CAA5B,CACN53C,EAAJ,EAAyB,CAAzB,GAAcA,CAAd,GACE4zC,EAAA,CAAwBqzB,CAAxB,CACA,CAAIA,CAAJ,EAAa,CAAAA,CAAA,CAAIpyB,CAAJ,CAAb;CACEoyB,CAAA,CAAIpyB,CAAJ,CADF,CACe,EADf,CAFF,CAMI92C,EAAAA,CAAe,IAAP,EAAAkpE,CAAA,CAAcA,CAAA,CAAIpyB,CAAJ,CAAd,CAA2B14C,CACvC,EAAI26C,CAAJ,EAAuBN,EAAA,CAA8B3B,CAA9B,CAAvB,GACEvB,EAAA,CAAiBv1C,CAAjB,CAAwByjC,CAAxB,CAEF,OAAItkC,EAAJ,CACS,CAACA,QAAS+pE,CAAV,CAAeh/D,KAAM4sC,CAArB,CAA4B92C,MAAOA,CAAnC,CADT,CAGSA,CAfoC,CADsC,CA3V9D,CA+WzB65C,OAAQA,QAAQ,CAACnoC,CAAD,CAAQq1D,CAAR,CAAiB,CAC/B,MAAO,SAAQ,CAAC57D,CAAD,CAAQnL,CAAR,CAAemmB,CAAf,CAAuB0zB,CAAvB,CAA+B,CAC5C,MAAIA,EAAJ,CAAmBA,CAAA,CAAOktB,CAAP,CAAnB,CACOr1D,CAAA,CAAMvG,CAAN,CAAanL,CAAb,CAAoBmmB,CAApB,CAFqC,CADf,CA/WR,CA0X3B,KAAIuzB,GAASA,QAAQ,CAACH,CAAD,CAAQjhC,CAAR,CAAiB8Q,CAAjB,CAA0B,CAC7C,IAAAmwB,MAAA,CAAaA,CACb,KAAAjhC,QAAA,CAAeA,CACf,KAAA8Q,QAAA,CAAeA,CACf,KAAA8sB,IAAA,CAAW,IAAIG,CAAJ,CAAQ,IAAAkD,MAAR,CACX,KAAA+wB,YAAA,CAAmBlhD,CAAAlY,IAAA,CAAc,IAAIsnC,EAAJ,CAAmB,IAAAtC,IAAnB,CAA6B59B,CAA7B,CAAd,CACc,IAAIggC,EAAJ,CAAgB,IAAApC,IAAhB,CAA0B59B,CAA1B,CANY,CAS/CohC,GAAAlzB,UAAA,CAAmB,CACjB5hB,YAAa80C,EADI,CAGjBzyC,MAAOA,QAAQ,CAAC62B,CAAD,CAAO,CACpB,MAAO,KAAAwsC,YAAAl/D,QAAA,CAAyB0yB,CAAzB,CAA+B,IAAA1U,QAAA2vB,gBAA/B,CADa,CAHL,CAYnB,KAAIJ,GAAgB95C,MAAA2nB,UAAAxlB,QAApB,CAw1EIsjD,GAAajmD,CAAA,CAAO,MAAP,CAx1EjB,CA01EIsmD,GAAe,CACjBhmB,KAAM,MADW,CAEjBinB,IAAK,KAFY,CAGjBC,IAAK,KAHY;AAMjBjnB,aAAc,aANG,CAOjBknB,GAAI,IAPa,CA11EnB,CA88GIn3B,GAAiBtwB,CAAA,CAAO,UAAP,CA98GrB,CAoxHI+qD,EAAiBjrD,CAAAwe,cAAA,CAAuB,GAAvB,CApxHrB,CAqxHI2sC,GAAY7d,EAAA,CAAWvtC,CAAA6N,SAAAkf,KAAX,CAsLhBs+B,GAAAnjC,QAAA,CAAyB,CAAC,WAAD,CAyGzB7N,GAAA6N,QAAA,CAA0B,CAAC,UAAD,CA+T1B,KAAIwmC,GAAa,EAAjB,CACIR,GAAc,GADlB,CAEIO,GAAY,GAsDhB3C,GAAA5jC,QAAA,CAAyB,CAAC,SAAD,CAwEzBkkC,GAAAlkC,QAAA,CAAuB,CAAC,SAAD,CA+RvB,KAAIyqC,GAAe,CACjB+E,KAAMlH,EAAA,CAAW,UAAX,CAAuB,CAAvB,CADW,CAEf6b,GAAI7b,EAAA,CAAW,UAAX,CAAuB,CAAvB,CAA0B,CAA1B,CAA6B,CAAA,CAA7B,CAFW,CAGd8b,EAAG9b,EAAA,CAAW,UAAX,CAAuB,CAAvB,CAHW,CAIjB+b,KAAM9b,EAAA,CAAc,OAAd,CAJW,CAKhB+b,IAAK/b,EAAA,CAAc,OAAd,CAAuB,CAAA,CAAvB,CALW,CAMfkH,GAAInH,EAAA,CAAW,OAAX,CAAoB,CAApB,CAAuB,CAAvB,CANW,CAOdic,EAAGjc,EAAA,CAAW,OAAX,CAAoB,CAApB,CAAuB,CAAvB,CAPW,CAQfoH,GAAIpH,EAAA,CAAW,MAAX,CAAmB,CAAnB,CARW,CASd7oB,EAAG6oB,EAAA,CAAW,MAAX,CAAmB,CAAnB,CATW,CAUfqH,GAAIrH,EAAA,CAAW,OAAX,CAAoB,CAApB,CAVW,CAWdkc,EAAGlc,EAAA,CAAW,OAAX,CAAoB,CAApB,CAXW,CAYfmc,GAAInc,EAAA,CAAW,OAAX,CAAoB,CAApB,CAAwB,GAAxB,CAZW,CAadnuD,EAAGmuD,EAAA,CAAW,OAAX,CAAoB,CAApB,CAAwB,GAAxB,CAbW,CAcfuH,GAAIvH,EAAA,CAAW,SAAX,CAAsB,CAAtB,CAdW,CAed2B,EAAG3B,EAAA,CAAW,SAAX;AAAsB,CAAtB,CAfW,CAgBfwH,GAAIxH,EAAA,CAAW,SAAX,CAAsB,CAAtB,CAhBW,CAiBd4B,EAAG5B,EAAA,CAAW,SAAX,CAAsB,CAAtB,CAjBW,CAoBhB0H,IAAK1H,EAAA,CAAW,cAAX,CAA2B,CAA3B,CApBW,CAqBjBoc,KAAMnc,EAAA,CAAc,KAAd,CArBW,CAsBhBoc,IAAKpc,EAAA,CAAc,KAAd,CAAqB,CAAA,CAArB,CAtBW,CAuBdn9C,EAnCLw5D,QAAmB,CAACtjE,CAAD,CAAOgkD,CAAP,CAAgB,CACjC,MAAyB,GAAlB,CAAAhkD,CAAAsuD,SAAA,EAAA,CAAuBtK,CAAAuf,MAAA,CAAc,CAAd,CAAvB,CAA0Cvf,CAAAuf,MAAA,CAAc,CAAd,CADhB,CAYhB,CAwBdC,EAxELC,QAAuB,CAACzjE,CAAD,CAAOgkD,CAAP,CAAgB3vC,CAAhB,CAAwB,CACzCqvD,CAAAA,CAAQ,EAARA,CAAYrvD,CAMhB,OAHAsvD,EAGA,EAL0B,CAATA,EAACD,CAADC,CAAc,GAAdA,CAAoB,EAKrC,GAHc9c,EAAA,CAAUvyB,IAAA,CAAY,CAAP,CAAAovC,CAAA,CAAW,OAAX,CAAqB,MAA1B,CAAA,CAAkCA,CAAlC,CAAyC,EAAzC,CAAV,CAAwD,CAAxD,CAGd,CAFc7c,EAAA,CAAUvyB,IAAA2xB,IAAA,CAASyd,CAAT,CAAgB,EAAhB,CAAV,CAA+B,CAA/B,CAEd,CAP6C,CAgD5B,CAyBfE,GAAIrc,EAAA,CAAW,CAAX,CAzBW,CA0Bdsc,EAAGtc,EAAA,CAAW,CAAX,CA1BW,CA2Bduc,EAAGhc,EA3BW,CA4Bdic,GAAIjc,EA5BU,CA6Bdkc,IAAKlc,EA7BS,CA8Bdmc,KAlCLC,QAAsB,CAAClkE,CAAD,CAAOgkD,CAAP,CAAgB,CACpC,MAA6B,EAAtB,EAAAhkD,CAAAynD,YAAA,EAAA,CAA0BzD,CAAAmgB,SAAA,CAAiB,CAAjB,CAA1B,CAAgDngB,CAAAmgB,SAAA,CAAiB,CAAjB,CADnB,CAInB,CAAnB,CAiCIjb,GAAqB,sFAjCzB,CAkCID,GAAgB,UA+FpB1G,GAAA7jC,QAAA,CAAqB,CAAC,SAAD,CA8HrB;IAAIikC,GAAkBhoD,EAAA,CAAQsB,CAAR,CAAtB,CAWI6mD,GAAkBnoD,EAAA,CAAQ2O,EAAR,CAiUtBu5C,GAAAnkC,QAAA,CAAwB,CAAC,QAAD,CAiJxB,KAAI3U,GAAsBpP,EAAA,CAAQ,CAChCytB,SAAU,GADsB,CAEhC1kB,QAASA,QAAQ,CAAC1H,CAAD,CAAUN,CAAV,CAAgB,CAC/B,GAAK6nB,CAAA7nB,CAAA6nB,KAAL,EAAmB6gD,CAAA1oE,CAAA0oE,UAAnB,CACE,MAAO,SAAQ,CAAC3gE,CAAD,CAAQzH,CAAR,CAAiB,CAE9B,GAA0C,GAA1C,GAAIA,CAAA,CAAQ,CAAR,CAAAvC,SAAAsL,YAAA,EAAJ,CAAA,CAGA,IAAIwe,EAA+C,4BAAxC,GAAA1oB,EAAAhD,KAAA,CAAcmE,CAAAP,KAAA,CAAa,MAAb,CAAd,CAAA,CACA,YADA,CACe,MAC1BO,EAAAsJ,GAAA,CAAW,OAAX,CAAoB,QAAQ,CAAC2U,CAAD,CAAQ,CAE7Bje,CAAAN,KAAA,CAAa6nB,CAAb,CAAL,EACEtJ,CAAAgyB,eAAA,EAHgC,CAApC,CALA,CAF8B,CAFH,CAFD,CAAR,CAA1B,CA6VI/8B,GAA6B,EAGjC3X,EAAA,CAAQsiB,EAAR,CAAsB,QAAQ,CAACwqD,CAAD,CAAWh9C,CAAX,CAAqB,CAIjDi9C,QAASA,EAAa,CAAC7gE,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CAC3C+H,CAAAtI,OAAA,CAAaO,CAAA,CAAK6oE,CAAL,CAAb,CAA+BC,QAAiC,CAAClsE,CAAD,CAAQ,CACtEoD,CAAAq5B,KAAA,CAAU1N,CAAV,CAAoB,CAAE/uB,CAAAA,CAAtB,CADsE,CAAxE,CAD2C,CAF7C,GAAgB,UAAhB,EAAI+rE,CAAJ,CAAA,CAQA,IAAIE,EAAa12C,EAAA,CAAmB,KAAnB,CAA2BxG,CAA3B,CAAjB,CACI8H,EAASm1C,CAEI,UAAjB,GAAID,CAAJ,GACEl1C,CADF,CACWA,QAAQ,CAAC1rB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CAElCA,CAAAiS,QAAJ,GAAqBjS,CAAA,CAAK6oE,CAAL,CAArB,EACED,CAAA,CAAc7gE,CAAd,CAAqBzH,CAArB;AAA8BN,CAA9B,CAHoC,CAD1C,CASAwT,GAAA,CAA2Bq1D,CAA3B,CAAA,CAAyC,QAAQ,EAAG,CAClD,MAAO,CACLn8C,SAAU,GADL,CAELF,SAAU,GAFL,CAGL5C,KAAM6J,CAHD,CAD2C,CApBpD,CAFiD,CAAnD,CAgCA53B,EAAA,CAAQyiC,EAAR,CAAsB,QAAQ,CAACyqC,CAAD,CAAW1iE,CAAX,CAAmB,CAC/CmN,EAAA,CAA2BnN,CAA3B,CAAA,CAAqC,QAAQ,EAAG,CAC9C,MAAO,CACLmmB,SAAU,GADL,CAEL5C,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CAGnC,GAAe,WAAf,GAAIqG,CAAJ,EAA0D,GAA1D,EAA8BrG,CAAAyS,UAAAtQ,OAAA,CAAsB,CAAtB,CAA9B,GACMH,CADN,CACchC,CAAAyS,UAAAzQ,MAAA,CAAqBo0D,EAArB,CADd,EAEa,CACTp2D,CAAAq5B,KAAA,CAAU,WAAV,CAAuB,IAAIv7B,MAAJ,CAAWkE,CAAA,CAAM,CAAN,CAAX,CAAqBA,CAAA,CAAM,CAAN,CAArB,CAAvB,CACA,OAFS,CAMb+F,CAAAtI,OAAA,CAAaO,CAAA,CAAKqG,CAAL,CAAb,CAA2B2iE,QAA+B,CAACpsE,CAAD,CAAQ,CAChEoD,CAAAq5B,KAAA,CAAUhzB,CAAV,CAAkBzJ,CAAlB,CADgE,CAAlE,CAXmC,CAFhC,CADuC,CADD,CAAjD,CAwBAf,EAAA,CAAQ,CAAC,KAAD,CAAQ,QAAR,CAAkB,MAAlB,CAAR,CAAmC,QAAQ,CAAC8vB,CAAD,CAAW,CACpD,IAAIk9C,EAAa12C,EAAA,CAAmB,KAAnB,CAA2BxG,CAA3B,CACjBnY,GAAA,CAA2Bq1D,CAA3B,CAAA,CAAyC,QAAQ,EAAG,CAClD,MAAO,CACLr8C,SAAU,EADL,CAEL5C,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CAAA,IAC/B2oE,EAAWh9C,CADoB,CAE/B7kB,EAAO6kB,CAEM,OAAjB,GAAIA,CAAJ,EAC4C,4BAD5C,GACIxsB,EAAAhD,KAAA,CAAcmE,CAAAP,KAAA,CAAa,MAAb,CAAd,CADJ;CAEE+G,CAEA,CAFO,WAEP,CADA9G,CAAAiyB,MAAA,CAAWnrB,CAAX,CACA,CADmB,YACnB,CAAA6hE,CAAA,CAAW,IAJb,CAOA3oE,EAAA88B,SAAA,CAAc+rC,CAAd,CAA0B,QAAQ,CAACjsE,CAAD,CAAQ,CACnCA,CAAL,EAOAoD,CAAAq5B,KAAA,CAAUvyB,CAAV,CAAgBlK,CAAhB,CAMA,CAAIsmB,EAAJ,EAAYylD,CAAZ,EAAsBroE,CAAAP,KAAA,CAAa4oE,CAAb,CAAuB3oE,CAAA,CAAK8G,CAAL,CAAvB,CAbtB,EACmB,MADnB,GACM6kB,CADN,EAEI3rB,CAAAq5B,KAAA,CAAUvyB,CAAV,CAAgB,IAAhB,CAHoC,CAA1C,CAXmC,CAFhC,CAD2C,CAFA,CAAtD,CAv9oBuC,KA8/oBnCyoD,GAAe,CACjBM,YAAa/wD,CADI,CAEjBixD,gBASFkZ,QAA8B,CAACvZ,CAAD,CAAU5oD,CAAV,CAAgB,CAC5C4oD,CAAAV,MAAA,CAAgBloD,CAD4B,CAX3B,CAGjBqpD,eAAgBrxD,CAHC,CAIjBuxD,aAAcvxD,CAJG,CAKjB2xD,UAAW3xD,CALM,CAMjB+xD,aAAc/xD,CANG,CAOjBqyD,cAAeryD,CAPE,CA0DnB6vD,GAAA3rC,QAAA,CAAyB,CAAC,UAAD,CAAa,QAAb,CAAuB,QAAvB,CAAiC,UAAjC,CAA6C,cAA7C,CAmZzB,KAAIkmD,GAAuBA,QAAQ,CAACC,CAAD,CAAW,CAC5C,MAAO,CAAC,UAAD,CAAa,QAAb,CAAuB,QAAQ,CAACvxD,CAAD,CAAWpB,CAAX,CAAmB,CAuEvD4yD,QAASA,EAAS,CAAC/oC,CAAD,CAAa,CAC7B,MAAmB,EAAnB,GAAIA,CAAJ,CAES7pB,CAAA,CAAO,UAAP,CAAAwmB,OAFT,CAIOxmB,CAAA,CAAO6pB,CAAP,CAAArD,OAJP,EAIoCl+B,CALP,CAF/B,MApEoB4P,CAClB5H,KAAM,MADY4H,CAElBge,SAAUy8C,CAAA;AAAW,KAAX,CAAmB,GAFXz6D,CAGlB+d,QAAS,CAAC,MAAD,CAAS,SAAT,CAHS/d,CAIlB3E,WAAY4kD,EAJMjgD,CAKlB1G,QAASqhE,QAAsB,CAACC,CAAD,CAActpE,CAAd,CAAoB,CAEjDspE,CAAArpD,SAAA,CAAqB0wC,EAArB,CAAA1wC,SAAA,CAA8C61C,EAA9C,CAEA,KAAIyT,EAAWvpE,CAAA8G,KAAA,CAAY,MAAZ,CAAsBqiE,CAAA,EAAYnpE,CAAAmQ,OAAZ,CAA0B,QAA1B,CAAqC,CAAA,CAE1E,OAAO,CACLikB,IAAKo1C,QAAsB,CAACzhE,CAAD,CAAQuhE,CAAR,CAAqBtpE,CAArB,CAA2BypE,CAA3B,CAAkC,CAC3D,IAAI1/D,EAAa0/D,CAAA,CAAM,CAAN,CAGjB,IAAM,EAAA,QAAA,EAAYzpE,EAAZ,CAAN,CAAyB,CAOvB,IAAI0pE,EAAuBA,QAAQ,CAACnrD,CAAD,CAAQ,CACzCxW,CAAAE,OAAA,CAAa,QAAQ,EAAG,CACtB8B,CAAA4lD,iBAAA,EACA5lD,EAAAonD,cAAA,EAFsB,CAAxB,CAKA5yC,EAAAgyB,eAAA,EANyC,CASxB+4B,EAAAhpE,CAAY,CAAZA,CA12kB3BonC,iBAAA,CA02kB2CpsB,QA12kB3C,CA02kBqDouD,CA12kBrD,CAAmC,CAAA,CAAnC,CA82kBQJ,EAAA1/D,GAAA,CAAe,UAAf,CAA2B,QAAQ,EAAG,CACpCgO,CAAA,CAAS,QAAQ,EAAG,CACI0xD,CAAAhpE,CAAY,CAAZA,CA72kBlCub,oBAAA,CA62kBkDP,QA72kBlD,CA62kB4DouD,CA72kB5D,CAAsC,CAAA,CAAtC,CA42kB8B,CAApB,CAEG,CAFH,CAEM,CAAA,CAFN,CADoC,CAAtC,CApBuB,CA4BzB7Z,CADqB4Z,CAAA,CAAM,CAAN,CACrB5Z,EADiC9lD,CAAAulD,aACjCO,aAAA,CAA2B9lD,CAA3B,CAEA,KAAI4/D,EAASJ,CAAA,CAAWH,CAAA,CAAUr/D,CAAAilD,MAAV,CAAX,CAAyClwD,CAElDyqE,EAAJ,GACEI,CAAA,CAAO5hE,CAAP,CAAcgC,CAAd,CACA,CAAA/J,CAAA88B,SAAA,CAAcysC,CAAd;AAAwB,QAAQ,CAAC1tC,CAAD,CAAW,CACrC9xB,CAAAilD,MAAJ,GAAyBnzB,CAAzB,GACA8tC,CAAA,CAAO5hE,CAAP,CAAc/M,CAAd,CAGA,CAFA+O,CAAAulD,aAAAS,gBAAA,CAAwChmD,CAAxC,CAAoD8xB,CAApD,CAEA,CADA8tC,CACA,CADSP,CAAA,CAAUr/D,CAAAilD,MAAV,CACT,CAAA2a,CAAA,CAAO5hE,CAAP,CAAcgC,CAAd,CAJA,CADyC,CAA3C,CAFF,CAUAu/D,EAAA1/D,GAAA,CAAe,UAAf,CAA2B,QAAQ,EAAG,CACpCG,CAAAulD,aAAAa,eAAA,CAAuCpmD,CAAvC,CACA4/D,EAAA,CAAO5hE,CAAP,CAAc/M,CAAd,CACAmD,EAAA,CAAO4L,CAAP,CAAmBwlD,EAAnB,CAHoC,CAAtC,CA9C2D,CADxD,CAN0C,CALjC7gD,CADmC,CAAlD,CADqC,CAA9C,CAkFIA,GAAgBw6D,EAAA,EAlFpB,CAmFI94D,GAAkB84D,EAAA,CAAqB,CAAA,CAArB,CAnFtB,CA+FI3W,GAAkB,0EA/FtB,CA4GIqX,GAAa,sHA5GjB,CA6GIC,GAAe,mGA7GnB,CA8GIC;AAAgB,mDA9GpB,CA+GIC,GAAc,2BA/GlB,CAgHIC,GAAuB,+DAhH3B,CAiHIC,GAAc,mBAjHlB,CAkHIC,GAAe,kBAlHnB,CAmHIC,GAAc,yCAnHlB,CAqHIC,GAAY,CAgGd,KAs8BFC,QAAsB,CAACtiE,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBuwD,CAAvB,CAA6Bn5C,CAA7B,CAAuC5C,CAAvC,CAAiD,CACrEg9C,EAAA,CAAczpD,CAAd,CAAqBzH,CAArB,CAA8BN,CAA9B,CAAoCuwD,CAApC,CAA0Cn5C,CAA1C,CAAoD5C,CAApD,CACA68C,GAAA,CAAqBd,CAArB,CAFqE,CAtiCvD,CAuMd,KAAQ6C,EAAA,CAAoB,MAApB,CAA4B2W,EAA5B,CACD3X,EAAA,CAAiB2X,EAAjB,CAA8B,CAAC,MAAD,CAAS,IAAT,CAAe,IAAf,CAA9B,CADC,CAED,YAFC,CAvMM,CA8Sd,iBAAkB3W,EAAA,CAAoB,eAApB,CAAqC4W,EAArC,CACd5X,EAAA,CAAiB4X,EAAjB,CAAuC,yBAAA,MAAA,CAAA,GAAA,CAAvC,CADc,CAEd,yBAFc,CA9SJ,CAsZd,KAAQ5W,EAAA,CAAoB,MAApB,CAA4B+W,EAA5B,CACJ/X,EAAA,CAAiB+X,EAAjB,CAA8B,CAAC,IAAD,CAAO,IAAP,CAAa,IAAb;AAAmB,KAAnB,CAA9B,CADI,CAEL,cAFK,CAtZM,CA+fd,KAAQ/W,EAAA,CAAoB,MAApB,CAA4B6W,EAA5B,CAsoBVK,QAAmB,CAACC,CAAD,CAAUC,CAAV,CAAwB,CACzC,GAAI9sE,CAAA,CAAO6sE,CAAP,CAAJ,CACE,MAAOA,EAGT,IAAIjvE,CAAA,CAASivE,CAAT,CAAJ,CAAuB,CACrBN,EAAAhoE,UAAA,CAAwB,CACxB,KAAI4D,EAAQokE,EAAAxwD,KAAA,CAAiB8wD,CAAjB,CACZ,IAAI1kE,CAAJ,CAAW,CAAA,IACL6lD,EAAO,CAAC7lD,CAAA,CAAM,CAAN,CADH,CAEL4kE,EAAO,CAAC5kE,CAAA,CAAM,CAAN,CAFH,CAILhB,EADA6lE,CACA7lE,CADQ,CAHH,CAKL8lE,EAAU,CALL,CAMLC,EAAe,CANV,CAOL9e,EAAaL,EAAA,CAAuBC,CAAvB,CAPR,CAQLmf,EAAuB,CAAvBA,EAAWJ,CAAXI,CAAkB,CAAlBA,CAEAL,EAAJ,GACEE,CAGA,CAHQF,CAAA5X,SAAA,EAGR,CAFA/tD,CAEA,CAFU2lE,CAAA5lE,WAAA,EAEV,CADA+lE,CACA,CADUH,CAAAzX,WAAA,EACV,CAAA6X,CAAA,CAAeJ,CAAAvX,gBAAA,EAJjB,CAOA,OAAO,KAAIt1D,IAAJ,CAAS+tD,CAAT,CAAe,CAAf,CAAkBI,CAAAI,QAAA,EAAlB,CAAyC2e,CAAzC,CAAkDH,CAAlD,CAAyD7lE,CAAzD,CAAkE8lE,CAAlE,CAA2EC,CAA3E,CAjBE,CAHU,CAwBvB,MAAOzX,IA7BkC,CAtoBjC,CAAqD,UAArD,CA/fM,CAumBd,MAASC,EAAA,CAAoB,OAApB,CAA6B8W,EAA7B,CACN9X,EAAA,CAAiB8X,EAAjB,CAA+B,CAAC,MAAD,CAAS,IAAT,CAA/B,CADM,CAEN,SAFM,CAvmBK,CAstBd,OAolBFY,QAAwB,CAAC/iE,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBuwD,CAAvB,CAA6Bn5C,CAA7B,CAAuC5C,CAAvC,CAAiD,CACvEi/C,EAAA,CAAgB1rD,CAAhB,CAAuBzH,CAAvB,CAAgCN,CAAhC,CAAsCuwD,CAAtC,CACAiB,GAAA,CAAczpD,CAAd,CAAqBzH,CAArB,CAA8BN,CAA9B,CAAoCuwD,CAApC,CAA0Cn5C,CAA1C,CAAoD5C,CAApD,CAEA+7C,EAAAqD,aAAA,CAAoB,QACpBrD,EAAAsD,SAAA5yD,KAAA,CAAmB,QAAQ,CAACrE,CAAD,CAAQ,CACjC,MAAI2zD,EAAAgB,SAAA,CAAc30D,CAAd,CAAJ,CAAsC,IAAtC;AACIktE,EAAAjqE,KAAA,CAAmBjD,CAAnB,CAAJ,CAAsCwwD,UAAA,CAAWxwD,CAAX,CAAtC,CACO5B,CAH0B,CAAnC,CAMAu1D,EAAAe,YAAArwD,KAAA,CAAsB,QAAQ,CAACrE,CAAD,CAAQ,CACpC,GAAK,CAAA2zD,CAAAgB,SAAA,CAAc30D,CAAd,CAAL,CAA2B,CACzB,GAAK,CAAAlB,CAAA,CAASkB,CAAT,CAAL,CACE,KAAMm3D,GAAA,CAAc,QAAd,CAAyDn3D,CAAzD,CAAN,CAEFA,CAAA,CAAQA,CAAAuC,SAAA,EAJiB,CAM3B,MAAOvC,EAP6B,CAAtC,CAUA,IAAIyC,CAAA,CAAUW,CAAA6pD,IAAV,CAAJ,EAA2B7pD,CAAAg0D,MAA3B,CAAuC,CACrC,IAAIC,CACJ1D,EAAA2D,YAAArK,IAAA,CAAuBsK,QAAQ,CAACv3D,CAAD,CAAQ,CACrC,MAAO2zD,EAAAgB,SAAA,CAAc30D,CAAd,CAAP,EAA+BwC,CAAA,CAAY60D,CAAZ,CAA/B,EAAsDr3D,CAAtD,EAA+Dq3D,CAD1B,CAIvCj0D,EAAA88B,SAAA,CAAc,KAAd,CAAqB,QAAQ,CAACx5B,CAAD,CAAM,CAC7BjE,CAAA,CAAUiE,CAAV,CAAJ,EAAuB,CAAA5H,CAAA,CAAS4H,CAAT,CAAvB,GACEA,CADF,CACQ8pD,UAAA,CAAW9pD,CAAX,CAAgB,EAAhB,CADR,CAGA2wD,EAAA,CAASv4D,CAAA,CAAS4H,CAAT,CAAA,EAAkB,CAAAc,KAAA,CAAMd,CAAN,CAAlB,CAA+BA,CAA/B,CAAqCtI,CAE9Cu1D,EAAA6D,UAAA,EANiC,CAAnC,CANqC,CAgBvC,GAAI/0D,CAAA,CAAUW,CAAA64B,IAAV,CAAJ,EAA2B74B,CAAAq0D,MAA3B,CAAuC,CACrC,IAAIC,CACJ/D,EAAA2D,YAAAr7B,IAAA,CAAuB07B,QAAQ,CAAC33D,CAAD,CAAQ,CACrC,MAAO2zD,EAAAgB,SAAA,CAAc30D,CAAd,CAAP,EAA+BwC,CAAA,CAAYk1D,CAAZ,CAA/B,EAAsD13D,CAAtD,EAA+D03D,CAD1B,CAIvCt0D,EAAA88B,SAAA,CAAc,KAAd,CAAqB,QAAQ,CAACx5B,CAAD,CAAM,CAC7BjE,CAAA,CAAUiE,CAAV,CAAJ,EAAuB,CAAA5H,CAAA,CAAS4H,CAAT,CAAvB,GACEA,CADF,CACQ8pD,UAAA,CAAW9pD,CAAX,CAAgB,EAAhB,CADR,CAGAgxD,EAAA,CAAS54D,CAAA,CAAS4H,CAAT,CAAA,EAAkB,CAAAc,KAAA,CAAMd,CAAN,CAAlB;AAA+BA,CAA/B,CAAqCtI,CAE9Cu1D,EAAA6D,UAAA,EANiC,CAAnC,CANqC,CArCgC,CA1yCzD,CAyzBd,IAuiBF2W,QAAqB,CAAChjE,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBuwD,CAAvB,CAA6Bn5C,CAA7B,CAAuC5C,CAAvC,CAAiD,CAGpEg9C,EAAA,CAAczpD,CAAd,CAAqBzH,CAArB,CAA8BN,CAA9B,CAAoCuwD,CAApC,CAA0Cn5C,CAA1C,CAAoD5C,CAApD,CACA68C,GAAA,CAAqBd,CAArB,CAEAA,EAAAqD,aAAA,CAAoB,KACpBrD,EAAA2D,YAAAltC,IAAA,CAAuBgkD,QAAQ,CAACC,CAAD,CAAaC,CAAb,CAAwB,CACrD,IAAItuE,EAAQquE,CAARruE,EAAsBsuE,CAC1B,OAAO3a,EAAAgB,SAAA,CAAc30D,CAAd,CAAP,EAA+BgtE,EAAA/pE,KAAA,CAAgBjD,CAAhB,CAFsB,CAPa,CAh2CtD,CA25Bd,MAkdFuuE,QAAuB,CAACpjE,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBuwD,CAAvB,CAA6Bn5C,CAA7B,CAAuC5C,CAAvC,CAAiD,CAGtEg9C,EAAA,CAAczpD,CAAd,CAAqBzH,CAArB,CAA8BN,CAA9B,CAAoCuwD,CAApC,CAA0Cn5C,CAA1C,CAAoD5C,CAApD,CACA68C,GAAA,CAAqBd,CAArB,CAEAA,EAAAqD,aAAA,CAAoB,OACpBrD,EAAA2D,YAAAkX,MAAA,CAAyBC,QAAQ,CAACJ,CAAD,CAAaC,CAAb,CAAwB,CACvD,IAAItuE,EAAQquE,CAARruE,EAAsBsuE,CAC1B,OAAO3a,EAAAgB,SAAA,CAAc30D,CAAd,CAAP,EAA+BitE,EAAAhqE,KAAA,CAAkBjD,CAAlB,CAFwB,CAPa,CA72CxD,CA69Bd,MA6ZF0uE,QAAuB,CAACvjE,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBuwD,CAAvB,CAA6B,CAE9CnxD,CAAA,CAAYY,CAAA8G,KAAZ,CAAJ,EACExG,CAAAN,KAAA,CAAa,MAAb,CAxksBK,EAAElD,EAwksBP,CASFwD,EAAAsJ,GAAA,CAAW,OAAX,CANeud,QAAQ,CAACuqC,CAAD,CAAK,CACtBpxD,CAAA,CAAQ,CAAR,CAAAirE,QAAJ,EACEhb,CAAAuB,cAAA,CAAmB9xD,CAAApD,MAAnB,CAA+B80D,CAA/B,EAAqCA,CAAAp2C,KAArC,CAFwB,CAM5B,CAEAi1C,EAAA2B,QAAA,CAAeC,QAAQ,EAAG,CAExB7xD,CAAA,CAAQ,CAAR,CAAAirE,QAAA,CADYvrE,CAAApD,MACZ,EAA+B2zD,CAAAqB,WAFP,CAK1B5xD;CAAA88B,SAAA,CAAc,OAAd,CAAuByzB,CAAA2B,QAAvB,CAnBkD,CA13CpC,CAuhCd,SAsYFsZ,QAA0B,CAACzjE,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBuwD,CAAvB,CAA6Bn5C,CAA7B,CAAuC5C,CAAvC,CAAiDU,CAAjD,CAA0DsB,CAA1D,CAAkE,CAC1F,IAAIi1D,EAAY7W,EAAA,CAAkBp+C,CAAlB,CAA0BzO,CAA1B,CAAiC,aAAjC,CAAgD/H,CAAA0rE,YAAhD,CAAkE,CAAA,CAAlE,CAAhB,CACIC,EAAa/W,EAAA,CAAkBp+C,CAAlB,CAA0BzO,CAA1B,CAAiC,cAAjC,CAAiD/H,CAAA4rE,aAAjD,CAAoE,CAAA,CAApE,CAMjBtrE,EAAAsJ,GAAA,CAAW,OAAX,CAJeud,QAAQ,CAACuqC,CAAD,CAAK,CAC1BnB,CAAAuB,cAAA,CAAmBxxD,CAAA,CAAQ,CAAR,CAAAirE,QAAnB,CAAuC7Z,CAAvC,EAA6CA,CAAAp2C,KAA7C,CAD0B,CAI5B,CAEAi1C,EAAA2B,QAAA,CAAeC,QAAQ,EAAG,CACxB7xD,CAAA,CAAQ,CAAR,CAAAirE,QAAA,CAAqBhb,CAAAqB,WADG,CAO1BrB,EAAAgB,SAAA,CAAgBsa,QAAQ,CAACjvE,CAAD,CAAQ,CAC9B,MAAiB,CAAA,CAAjB,GAAOA,CADuB,CAIhC2zD,EAAAe,YAAArwD,KAAA,CAAsB,QAAQ,CAACrE,CAAD,CAAQ,CACpC,MAAOwF,GAAA,CAAOxF,CAAP,CAAc6uE,CAAd,CAD6B,CAAtC,CAIAlb,EAAAsD,SAAA5yD,KAAA,CAAmB,QAAQ,CAACrE,CAAD,CAAQ,CACjC,MAAOA,EAAA,CAAQ6uE,CAAR,CAAoBE,CADM,CAAnC,CAzB0F,CA75C5E,CAyhCd,OAAU7sE,CAzhCI,CA0hCd,OAAUA,CA1hCI,CA2hCd,OAAUA,CA3hCI,CA4hCd,MAASA,CA5hCK,CA6hCd,KAAQA,CA7hCM,CArHhB,CA8tDIyP,GAAiB,CAAC,UAAD,CAAa,UAAb,CAAyB,SAAzB,CAAoC,QAApC,CACjB,QAAQ,CAACiG,CAAD,CAAW4C,CAAX,CAAqBlC,CAArB;AAA8BsB,CAA9B,CAAsC,CAChD,MAAO,CACLkW,SAAU,GADL,CAELD,QAAS,CAAC,UAAD,CAFJ,CAGL7C,KAAM,CACJwK,IAAKA,QAAQ,CAACrsB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBypE,CAAvB,CAA8B,CACrCA,CAAA,CAAM,CAAN,CAAJ,EACE,CAACW,EAAA,CAAU7pE,CAAA,CAAUP,CAAAsb,KAAV,CAAV,CAAD,EAAoC8uD,EAAA1vC,KAApC,EAAoD3yB,CAApD,CAA2DzH,CAA3D,CAAoEN,CAApE,CAA0EypE,CAAA,CAAM,CAAN,CAA1E,CAAoFryD,CAApF,CACoD5C,CADpD,CAC8DU,CAD9D,CACuEsB,CADvE,CAFuC,CADvC,CAHD,CADyC,CAD7B,CA9tDrB,CAgvDIs1D,GAAwB,oBAhvD5B,CA0yDI14D,GAAmBA,QAAQ,EAAG,CAChC,MAAO,CACLsZ,SAAU,GADL,CAELF,SAAU,GAFL,CAGLxkB,QAASA,QAAQ,CAAC08C,CAAD,CAAMqnB,CAAN,CAAe,CAC9B,MAAID,GAAAjsE,KAAA,CAA2BksE,CAAA54D,QAA3B,CAAJ,CACS64D,QAA4B,CAACjkE,CAAD,CAAQqd,CAAR,CAAaplB,CAAb,CAAmB,CACpDA,CAAAq5B,KAAA,CAAU,OAAV,CAAmBtxB,CAAA63C,MAAA,CAAY5/C,CAAAmT,QAAZ,CAAnB,CADoD,CADxD,CAKS84D,QAAoB,CAAClkE,CAAD,CAAQqd,CAAR,CAAaplB,CAAb,CAAmB,CAC5C+H,CAAAtI,OAAA,CAAaO,CAAAmT,QAAb,CAA2B+4D,QAAyB,CAACtvE,CAAD,CAAQ,CAC1DoD,CAAAq5B,KAAA,CAAU,OAAV,CAAmBz8B,CAAnB,CAD0D,CAA5D,CAD4C,CANlB,CAH3B,CADyB,CA1yDlC,CAi3DIwS,GAAkB,CAAC,UAAD,CAAa,QAAQ,CAAC+8D,CAAD,CAAW,CACpD,MAAO,CACLz/C,SAAU,IADL,CAEL1kB,QAASokE,QAAsB,CAACC,CAAD,CAAkB,CAC/CF,CAAAnxC,kBAAA,CAA2BqxC,CAA3B,CACA,OAAOC,SAAmB,CAACvkE,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CAC/CmsE,CAAAjxC,iBAAA,CAA0B56B,CAA1B;AAAmCN,CAAAmP,OAAnC,CACA7O,EAAA,CAAUA,CAAA,CAAQ,CAAR,CACVyH,EAAAtI,OAAA,CAAaO,CAAAmP,OAAb,CAA0Bo9D,QAA0B,CAAC3vE,CAAD,CAAQ,CAC1D0D,CAAA4Z,YAAA,CAAsB9a,CAAA,CAAYxC,CAAZ,CAAA,CAAqB,EAArB,CAA0BA,CADU,CAA5D,CAH+C,CAFF,CAF5C,CAD6C,CAAhC,CAj3DtB,CAq7DI4S,GAA0B,CAAC,cAAD,CAAiB,UAAjB,CAA6B,QAAQ,CAAC8F,CAAD,CAAe62D,CAAf,CAAyB,CAC1F,MAAO,CACLnkE,QAASwkE,QAA8B,CAACH,CAAD,CAAkB,CACvDF,CAAAnxC,kBAAA,CAA2BqxC,CAA3B,CACA,OAAOI,SAA2B,CAAC1kE,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CACnD26B,CAAAA,CAAgBrlB,CAAA,CAAahV,CAAAN,KAAA,CAAaA,CAAAiyB,MAAA1iB,eAAb,CAAb,CACpB48D,EAAAjxC,iBAAA,CAA0B56B,CAA1B,CAAmCq6B,CAAAQ,YAAnC,CACA76B,EAAA,CAAUA,CAAA,CAAQ,CAAR,CACVN,EAAA88B,SAAA,CAAc,gBAAd,CAAgC,QAAQ,CAAClgC,CAAD,CAAQ,CAC9C0D,CAAA4Z,YAAA,CAAsB9a,CAAA,CAAYxC,CAAZ,CAAA,CAAqB,EAArB,CAA0BA,CADF,CAAhD,CAJuD,CAFF,CADpD,CADmF,CAA9D,CAr7D9B,CAq/DI0S,GAAsB,CAAC,MAAD,CAAS,QAAT,CAAmB,UAAnB,CAA+B,QAAQ,CAAC0H,CAAD,CAAOR,CAAP,CAAe21D,CAAf,CAAyB,CACxF,MAAO,CACLz/C,SAAU,GADL,CAEL1kB,QAAS0kE,QAA0B,CAACx/C,CAAD,CAAWC,CAAX,CAAmB,CACpD,IAAIw/C,EAAmBn2D,CAAA,CAAO2W,CAAA9d,WAAP,CAAvB,CACIu9D,EAAkBp2D,CAAA,CAAO2W,CAAA9d,WAAP,CAA0B6iC,QAAuB,CAACt1C,CAAD,CAAQ,CAC7E,MAAOuC,CAACvC,CAADuC,EAAU,EAAVA,UAAA,EADsE,CAAzD,CAGtBgtE;CAAAnxC,kBAAA,CAA2B9N,CAA3B,CAEA,OAAO2/C,SAAuB,CAAC9kE,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CACnDmsE,CAAAjxC,iBAAA,CAA0B56B,CAA1B,CAAmCN,CAAAqP,WAAnC,CAEAtH,EAAAtI,OAAA,CAAamtE,CAAb,CAA8BE,QAA8B,EAAG,CAG7DxsE,CAAA6E,KAAA,CAAa6R,CAAA+1D,eAAA,CAAoBJ,CAAA,CAAiB5kE,CAAjB,CAApB,CAAb,EAA6D,EAA7D,CAH6D,CAA/D,CAHmD,CAPD,CAFjD,CADiF,CAAhE,CAr/D1B,CA+kEIuK,GAAoBrT,EAAA,CAAQ,CAC9BytB,SAAU,GADoB,CAE9BD,QAAS,SAFqB,CAG9B7C,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBuwD,CAAvB,CAA6B,CACzCA,CAAAyc,qBAAA/rE,KAAA,CAA+B,QAAQ,EAAG,CACxC8G,CAAA63C,MAAA,CAAY5/C,CAAAqS,SAAZ,CADwC,CAA1C,CADyC,CAHb,CAAR,CA/kExB,CAi4EI3C,GAAmBolD,EAAA,CAAe,EAAf,CAAmB,CAAA,CAAnB,CAj4EvB,CAi7EIhlD,GAAsBglD,EAAA,CAAe,KAAf,CAAsB,CAAtB,CAj7E1B,CAi+EIllD,GAAuBklD,EAAA,CAAe,MAAf,CAAuB,CAAvB,CAj+E3B,CAuhFI9kD,GAAmB0+C,EAAA,CAAY,CACjC1mD,QAASA,QAAQ,CAAC1H,CAAD,CAAUN,CAAV,CAAgB,CAC/BA,CAAAq5B,KAAA,CAAU,SAAV,CAAqBr+B,CAArB,CACAsF,EAAA4f,YAAA,CAAoB,UAApB,CAF+B,CADA,CAAZ,CAvhFvB,CAgwFIhQ,GAAwB,CAAC,QAAQ,EAAG,CACtC,MAAO,CACLwc,SAAU,GADL,CAEL3kB,MAAO,CAAA,CAFF,CAGLgC,WAAY,GAHP,CAILyiB,SAAU,GAJL,CAD+B,CAAZ,CAhwF5B,CAw/FI/Y,GAAoB,EAx/FxB,CA6/FIw5D,GAAmB,CACrB,KAAQ,CAAA,CADa,CAErB,MAAS,CAAA,CAFY,CAIvBpxE,EAAA,CACE,6IAAA,MAAA,CAAA,GAAA,CADF;AAEE,QAAQ,CAACmkD,CAAD,CAAY,CAClB,IAAI/0B,EAAgBkH,EAAA,CAAmB,KAAnB,CAA2B6tB,CAA3B,CACpBvsC,GAAA,CAAkBwX,CAAlB,CAAA,CAAmC,CAAC,QAAD,CAAW,YAAX,CAAyB,QAAQ,CAACzU,CAAD,CAASE,CAAT,CAAqB,CACvF,MAAO,CACLgW,SAAU,GADL,CAEL1kB,QAASA,QAAQ,CAAColB,CAAD,CAAWptB,CAAX,CAAiB,CAKhC,IAAIiD,EAAKuT,CAAA,CAAOxW,CAAA,CAAKirB,CAAL,CAAP,CAAgD,IAAhD,CAA4E,CAAA,CAA5E,CACT,OAAOiiD,SAAuB,CAACnlE,CAAD,CAAQzH,CAAR,CAAiB,CAC7CA,CAAAsJ,GAAA,CAAWo2C,CAAX,CAAsB,QAAQ,CAACzhC,CAAD,CAAQ,CACpC,IAAIqJ,EAAWA,QAAQ,EAAG,CACxB3kB,CAAA,CAAG8E,CAAH,CAAU,CAACs0C,OAAO99B,CAAR,CAAV,CADwB,CAGtB0uD,GAAA,CAAiBjtB,CAAjB,CAAJ,EAAmCtpC,CAAAovB,QAAnC,CACE/9B,CAAAvI,WAAA,CAAiBooB,CAAjB,CADF,CAGE7f,CAAAE,OAAA,CAAa2f,CAAb,CAPkC,CAAtC,CAD6C,CANf,CAF7B,CADgF,CAAtD,CAFjB,CAFtB,CAmgBA,KAAIpX,GAAgB,CAAC,UAAD,CAAa,QAAQ,CAACoD,CAAD,CAAW,CAClD,MAAO,CACLslB,aAAc,CAAA,CADT,CAEL1L,WAAY,SAFP,CAGLhB,SAAU,GAHL,CAIL6E,SAAU,CAAA,CAJL,CAKL3E,SAAU,GALL,CAML4K,MAAO,CAAA,CANF,CAOL1N,KAAMA,QAAQ,CAACqL,CAAD,CAAS7H,CAAT,CAAmB6E,CAAnB,CAA0Bs+B,CAA1B,CAAgCr7B,CAAhC,CAA6C,CAAA,IACnDznB,CADmD,CAC5C4iB,CAD4C,CAChC88C,CACvBl4C,EAAAx1B,OAAA,CAAcwyB,CAAA1hB,KAAd,CAA0B68D,QAAwB,CAACxwE,CAAD,CAAQ,CAEpDA,CAAJ,CACOyzB,CADP,EAEI6E,CAAA,CAAY,QAAQ,CAACh3B,CAAD,CAAQ46B,CAAR,CAAkB,CACpCzI,CAAA,CAAayI,CACb56B,EAAA,CAAMA,CAAA1C,OAAA,EAAN,CAAA,CAAwBT,CAAA08B,cAAA,CAAuB,aAAvB;AAAuCxF,CAAA1hB,KAAvC,CAAoD,GAApD,CAIxB9C,EAAA,CAAQ,CACNvP,MAAOA,CADD,CAGR0V,EAAA8oD,MAAA,CAAex+D,CAAf,CAAsBkvB,CAAAzuB,OAAA,EAAtB,CAAyCyuB,CAAzC,CAToC,CAAtC,CAFJ,EAeM+/C,CAQJ,GAPEA,CAAA1iD,OAAA,EACA,CAAA0iD,CAAA,CAAmB,IAMrB,EAJI98C,CAIJ,GAHEA,CAAA9lB,SAAA,EACA,CAAA8lB,CAAA,CAAa,IAEf,EAAI5iB,CAAJ,GACE0/D,CAIA,CAJmB9hE,EAAA,CAAcoC,CAAAvP,MAAd,CAInB,CAHA0V,CAAAgpD,MAAA,CAAeuQ,CAAf,CAAAvzC,KAAA,CAAsC,QAAQ,EAAG,CAC/CuzC,CAAA,CAAmB,IAD4B,CAAjD,CAGA,CAAA1/D,CAAA,CAAQ,IALV,CAvBF,CAFwD,CAA1D,CAFuD,CAPtD,CAD2C,CAAhC,CAApB,CAuOIiD,GAAqB,CAAC,kBAAD,CAAqB,eAArB,CAAsC,UAAtC,CACP,QAAQ,CAAC8G,CAAD,CAAqB9D,CAArB,CAAsCE,CAAtC,CAAgD,CACxE,MAAO,CACL8Y,SAAU,KADL,CAELF,SAAU,GAFL,CAGL6E,SAAU,CAAA,CAHL,CAIL7D,WAAY,SAJP,CAKLzjB,WAAY1B,EAAAvJ,KALP,CAMLkJ,QAASA,QAAQ,CAAC1H,CAAD,CAAUN,CAAV,CAAgB,CAAA,IAC3BqtE,EAASrtE,CAAAyQ,UAAT48D,EAA2BrtE,CAAAvC,IADA,CAE3B6vE,EAAYttE,CAAAkoC,OAAZolC,EAA2B,EAFA,CAG3BC,EAAgBvtE,CAAAwtE,WAEpB,OAAO,SAAQ,CAACzlE,CAAD,CAAQqlB,CAAR,CAAkB6E,CAAlB,CAAyBs+B,CAAzB,CAA+Br7B,CAA/B,CAA4C,CAAA,IACrDu4C,EAAgB,CADqC,CAErDnxB,CAFqD,CAGrDoxB,CAHqD,CAIrDC,CAJqD,CAMrDC,EAA4BA,QAAQ,EAAG,CACrCF,CAAJ,GACEA,CAAAjjD,OAAA,EACA,CAAAijD,CAAA,CAAkB,IAFpB,CAIIpxB,EAAJ,GACEA,CAAA/xC,SAAA,EACA,CAAA+xC,CAAA,CAAe,IAFjB,CAIIqxB,EAAJ;CACE/5D,CAAAgpD,MAAA,CAAe+Q,CAAf,CAAA/zC,KAAA,CAAoC,QAAQ,EAAG,CAC7C8zC,CAAA,CAAkB,IAD2B,CAA/C,CAIA,CADAA,CACA,CADkBC,CAClB,CAAAA,CAAA,CAAiB,IALnB,CATyC,CAkB3C5lE,EAAAtI,OAAA,CAAa4tE,CAAb,CAAqBQ,QAA6B,CAACpwE,CAAD,CAAM,CACtD,IAAIqwE,EAAiBA,QAAQ,EAAG,CAC1B,CAAAzuE,CAAA,CAAUkuE,CAAV,CAAJ,EAAkCA,CAAlC,EAAmD,CAAAxlE,CAAA63C,MAAA,CAAY2tB,CAAZ,CAAnD,EACE75D,CAAA,EAF4B,CAAhC,CAKIq6D,EAAe,EAAEN,CAEjBhwE,EAAJ,EAGE+Z,CAAA,CAAiB/Z,CAAjB,CAAsB,CAAA,CAAtB,CAAAm8B,KAAA,CAAiC,QAAQ,CAAC4J,CAAD,CAAW,CAClD,GAAIvJ,CAAAlyB,CAAAkyB,YAAJ,EAEI8zC,CAFJ,GAEqBN,CAFrB,CAEA,CACA,IAAI30C,EAAW/wB,CAAAynB,KAAA,EACf+gC,EAAAjjC,SAAA,CAAgBkW,CAQZtlC,EAAAA,CAAQg3B,CAAA,CAAY4D,CAAZ,CAAsB,QAAQ,CAAC56B,CAAD,CAAQ,CAChD0vE,CAAA,EACAh6D,EAAA8oD,MAAA,CAAex+D,CAAf,CAAsB,IAAtB,CAA4BkvB,CAA5B,CAAAwM,KAAA,CAA2Ck0C,CAA3C,CAFgD,CAAtC,CAKZxxB,EAAA,CAAexjB,CACf60C,EAAA,CAAiBzvE,CAEjBo+C,EAAA+D,MAAA,CAAmB,uBAAnB,CAA4C5iD,CAA5C,CACAsK,EAAA63C,MAAA,CAAY0tB,CAAZ,CAnBA,CAHkD,CAApD,CAuBG,QAAQ,EAAG,CACRvlE,CAAAkyB,YAAJ,EAEI8zC,CAFJ,GAEqBN,CAFrB,GAGEG,CAAA,EACA,CAAA7lE,CAAAs4C,MAAA,CAAY,sBAAZ,CAAoC5iD,CAApC,CAJF,CADY,CAvBd,CA+BA,CAAAsK,CAAAs4C,MAAA,CAAY,0BAAZ,CAAwC5iD,CAAxC,CAlCF,GAoCEmwE,CAAA,EACA,CAAArd,CAAAjjC,SAAA,CAAgB,IArClB,CARsD,CAAxD,CAxByD,CAL5B,CAN5B,CADiE,CADjD,CAvOzB,CAsUI/Z,GAAgC,CAAC,UAAD,CAClC,QAAQ,CAAC44D,CAAD,CAAW,CACjB,MAAO,CACLz/C,SAAU,KADL;AAELF,SAAW,IAFN,CAGLC,QAAS,WAHJ,CAIL7C,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQqlB,CAAR,CAAkB6E,CAAlB,CAAyBs+B,CAAzB,CAA+B,CACvCpxD,EAAAhD,KAAA,CAAcixB,CAAA,CAAS,CAAT,CAAd,CAAAprB,MAAA,CAAiC,KAAjC,CAAJ,EAIEorB,CAAAroB,MAAA,EACA,CAAAonE,CAAA,CAASlzD,EAAA,CAAoBs3C,CAAAjjC,SAApB,CAAmCvyB,CAAnC,CAAAif,WAAT,CAAA,CAAkEjS,CAAlE,CACIimE,QAA8B,CAAC9vE,CAAD,CAAQ,CACxCkvB,CAAAloB,OAAA,CAAgBhH,CAAhB,CADwC,CAD1C,CAGG,CAACyxB,oBAAqBvC,CAAtB,CAHH,CALF,GAYAA,CAAAjoB,KAAA,CAAcorD,CAAAjjC,SAAd,CACA,CAAA6+C,CAAA,CAAS/+C,CAAAyK,SAAA,EAAT,CAAA,CAA8B9vB,CAA9B,CAbA,CAD2C,CAJxC,CADU,CADe,CAtUpC,CAyZI6I,GAAkB89C,EAAA,CAAY,CAChCliC,SAAU,GADsB,CAEhCxkB,QAASA,QAAQ,EAAG,CAClB,MAAO,CACLosB,IAAKA,QAAQ,CAACrsB,CAAD,CAAQzH,CAAR,CAAiBywB,CAAjB,CAAwB,CACnChpB,CAAA63C,MAAA,CAAY7uB,CAAApgB,OAAZ,CADmC,CADhC,CADW,CAFY,CAAZ,CAzZtB,CAwfIyB,GAAkBA,QAAQ,EAAG,CAC/B,MAAO,CACLsa,SAAU,GADL,CAELF,SAAU,GAFL,CAGLC,QAAS,SAHJ,CAIL7C,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBuwD,CAAvB,CAA6B,CAGzC,IAAIp+C,EAAS7R,CAAAN,KAAA,CAAaA,CAAAiyB,MAAA9f,OAAb,CAATA,EAA4C,IAAhD,CACI87D,EAA6B,OAA7BA,GAAajuE,CAAA2xD,OADjB,CAEI1oD,EAAYglE,CAAA,CAAaxzD,CAAA,CAAKtI,CAAL,CAAb,CAA4BA,CAiB5Co+C,EAAAsD,SAAA5yD,KAAA,CAfY4C,QAAQ,CAACqnE,CAAD,CAAY,CAE9B,GAAI,CAAA9rE,CAAA,CAAY8rE,CAAZ,CAAJ,CAAA,CAEA,IAAI5mD;AAAO,EAEP4mD,EAAJ,EACErvE,CAAA,CAAQqvE,CAAA9qE,MAAA,CAAgB6I,CAAhB,CAAR,CAAoC,QAAQ,CAACrM,CAAD,CAAQ,CAC9CA,CAAJ,EAAW0nB,CAAArjB,KAAA,CAAUgtE,CAAA,CAAaxzD,CAAA,CAAK7d,CAAL,CAAb,CAA2BA,CAArC,CADuC,CAApD,CAKF,OAAO0nB,EAVP,CAF8B,CAehC,CACAisC,EAAAe,YAAArwD,KAAA,CAAsB,QAAQ,CAACrE,CAAD,CAAQ,CACpC,MAAIvB,EAAA,CAAQuB,CAAR,CAAJ,CACSA,CAAAoJ,KAAA,CAAWmM,CAAX,CADT,CAIOnX,CAL6B,CAAtC,CASAu1D,EAAAgB,SAAA,CAAgBsa,QAAQ,CAACjvE,CAAD,CAAQ,CAC9B,MAAO,CAACA,CAAR,EAAiB,CAACA,CAAApB,OADY,CAhCS,CAJtC,CADwB,CAxfjC,CA4iBIs6D,GAAc,UA5iBlB,CA6iBIC,GAAgB,YA7iBpB,CA8iBIpF,GAAiB,aA9iBrB,CA+iBIC,GAAc,UA/iBlB,CAkjBIsF,GAAgB,YAljBpB,CAsjBInC,GAAgB94D,CAAA,CAAO,SAAP,CAtjBpB,CAgwBIizE,GAAoB,CAAC,QAAD,CAAW,mBAAX,CAAgC,QAAhC,CAA0C,UAA1C,CAAsD,QAAtD,CAAgE,UAAhE,CAA4E,UAA5E,CAAwF,YAAxF,CAAsG,IAAtG,CAA4G,cAA5G,CACpB,QAAQ,CAACj5C,CAAD,CAASjgB,CAAT,CAA4Bid,CAA5B,CAAmC7E,CAAnC,CAA6C5W,CAA7C,CAAqD5C,CAArD,CAA+DgE,CAA/D,CAAyElB,CAAzE,CAAqFE,CAArF,CAAyFtB,CAAzF,CAAuG,CAEjH,IAAA64D,YAAA,CADA,IAAAvc,WACA,CADkBvnC,MAAA8oC,IAElB,KAAAib,gBAAA,CAAuBpzE,CACvB,KAAAk5D,YAAA,CAAmB,EACnB,KAAAma,iBAAA;AAAwB,EACxB,KAAAxa,SAAA,CAAgB,EAChB,KAAAvC,YAAA,CAAmB,EACnB,KAAA0b,qBAAA,CAA4B,EAC5B,KAAAsB,WAAA,CAAkB,CAAA,CAClB,KAAAC,SAAA,CAAgB,CAAA,CAChB,KAAArf,UAAA,CAAiB,CAAA,CACjB,KAAAD,OAAA,CAAc,CAAA,CACd,KAAAE,OAAA,CAAc,CAAA,CACd,KAAAC,SAAA,CAAgB,CAAA,CAChB,KAAAP,OAAA,CAAc,EACd,KAAAC,UAAA,CAAiB,EACjB,KAAAC,SAAA,CAAgB/zD,CAChB,KAAAg0D,MAAA,CAAa15C,CAAA,CAAa2c,CAAAnrB,KAAb,EAA2B,EAA3B,CAA+B,CAAA,CAA/B,CAAA,CAAsCmuB,CAAtC,CACb,KAAAq6B,aAAA,CAAoBC,EAnB6F,KAqB7Gif,EAAgBh4D,CAAA,CAAOyb,CAAAhgB,QAAP,CArB6F,CAsB7Gw8D,EAAsBD,CAAAxxC,OAtBuF,CAuB7G0xC,EAAaF,CAvBgG,CAwB7GG,EAAaF,CAxBgG,CAyB7GG,EAAkB,IAzB2F,CA0B7GC,CA1B6G,CA2B7Gte,EAAO,IAEX,KAAAue,aAAA,CAAoBC,QAAQ,CAAC/oD,CAAD,CAAU,CAEpC,IADAuqC,CAAAmD,SACA,CADgB1tC,CAChB,GAAeA,CAAAgpD,aAAf,CAAqC,CAAA,IAC/BC,EAAoBz4D,CAAA,CAAOyb,CAAAhgB,QAAP,CAAuB,IAAvB,CADW,CAE/Bi9D,EAAoB14D,CAAA,CAAOyb,CAAAhgB,QAAP,CAAuB,QAAvB,CAExBy8D,EAAA,CAAaA,QAAQ,CAACz5C,CAAD,CAAS,CAC5B,IAAIg2C,EAAauD,CAAA,CAAcv5C,CAAd,CACbh5B,EAAA,CAAWgvE,CAAX,CAAJ,GACEA,CADF,CACegE,CAAA,CAAkBh6C,CAAlB,CADf,CAGA,OAAOg2C,EALqB,CAO9B0D,EAAA,CAAaA,QAAQ,CAAC15C,CAAD;AAAS4G,CAAT,CAAmB,CAClC5/B,CAAA,CAAWuyE,CAAA,CAAcv5C,CAAd,CAAX,CAAJ,CACEi6C,CAAA,CAAkBj6C,CAAlB,CAA0B,CAACk6C,KAAM5e,CAAA4d,YAAP,CAA1B,CADF,CAGEM,CAAA,CAAoBx5C,CAApB,CAA4Bs7B,CAAA4d,YAA5B,CAJoC,CAXL,CAArC,IAkBO,IAAKnxC,CAAAwxC,CAAAxxC,OAAL,CACL,KAAM+2B,GAAA,CAAc,WAAd,CACF9hC,CAAAhgB,QADE,CACanN,EAAA,CAAYsoB,CAAZ,CADb,CAAN,CArBkC,CA8CtC,KAAA8kC,QAAA,CAAepzD,CAoBf,KAAAyyD,SAAA,CAAgB6d,QAAQ,CAACxyE,CAAD,CAAQ,CAC9B,MAAOwC,EAAA,CAAYxC,CAAZ,CAAP,EAAuC,EAAvC,GAA6BA,CAA7B,EAAuD,IAAvD,GAA6CA,CAA7C,EAA+DA,CAA/D,GAAyEA,CAD3C,CAIhC,KAAAyyE,qBAAA,CAA4BC,QAAQ,CAAC1yE,CAAD,CAAQ,CACtC2zD,CAAAgB,SAAA,CAAc30D,CAAd,CAAJ,EACEgX,CAAAsM,YAAA,CAAqBkN,CAArB,CAlTgBmiD,cAkThB,CACA,CAAA37D,CAAAqM,SAAA,CAAkBmN,CAAlB,CApTYoiD,UAoTZ,CAFF,GAIE57D,CAAAsM,YAAA,CAAqBkN,CAArB,CAtTYoiD,UAsTZ,CACA,CAAA57D,CAAAqM,SAAA,CAAkBmN,CAAlB,CAtTgBmiD,cAsThB,CALF,CAD0C,CAW5C,KAAIE,EAAyB,CAwB7Bnf,GAAA,CAAqB,CACnBC,KAAM,IADa,CAEnBnjC,SAAUA,CAFS,CAGnBvrB,IAAKA,QAAQ,CAACoyC,CAAD,CAASpf,CAAT,CAAmB,CAC9Bof,CAAA,CAAOpf,CAAP,CAAA,CAAmB,CAAA,CADW,CAHb,CAMnB27B,MAAOA,QAAQ,CAACvc,CAAD,CAASpf,CAAT,CAAmB,CAChC,OAAOof,CAAA,CAAOpf,CAAP,CADyB,CANf,CASnBjhB,SAAUA,CATS,CAArB,CAuBA,KAAAi9C,aAAA,CAAoB6e,QAAQ,EAAG,CAC7Bnf,CAAAtB,OAAA;AAAc,CAAA,CACdsB,EAAArB,UAAA,CAAiB,CAAA,CACjBt7C,EAAAsM,YAAA,CAAqBkN,CAArB,CAA+BwjC,EAA/B,CACAh9C,EAAAqM,SAAA,CAAkBmN,CAAlB,CAA4BujC,EAA5B,CAJ6B,CAkB/B,KAAAF,UAAA,CAAiBkf,QAAQ,EAAG,CAC1Bpf,CAAAtB,OAAA,CAAc,CAAA,CACdsB,EAAArB,UAAA,CAAiB,CAAA,CACjBt7C,EAAAsM,YAAA,CAAqBkN,CAArB,CAA+BujC,EAA/B,CACA/8C,EAAAqM,SAAA,CAAkBmN,CAAlB,CAA4BwjC,EAA5B,CACAL,EAAAjB,aAAAmB,UAAA,EAL0B,CAoB5B,KAAAQ,cAAA,CAAqB2e,QAAQ,EAAG,CAC9Brf,CAAAge,SAAA,CAAgB,CAAA,CAChBhe,EAAA+d,WAAA,CAAkB,CAAA,CAClB16D,EAAAm9C,SAAA,CAAkB3jC,CAAlB,CAvZkByiD,cAuZlB,CAtZgBC,YAsZhB,CAH8B,CAiBhC,KAAAC,YAAA,CAAmBC,QAAQ,EAAG,CAC5Bzf,CAAAge,SAAA,CAAgB,CAAA,CAChBhe,EAAA+d,WAAA,CAAkB,CAAA,CAClB16D,EAAAm9C,SAAA,CAAkB3jC,CAAlB,CAvagB0iD,YAuahB,CAxakBD,cAwalB,CAH4B,CA8F9B,KAAArgB,mBAAA,CAA0BygB,QAAQ,EAAG,CACnCr4D,CAAAsR,OAAA,CAAgB0lD,CAAhB,CACAre,EAAAqB,WAAA,CAAkBrB,CAAA2f,yBAClB3f,EAAA2B,QAAA,EAHmC,CAkBrC,KAAAkC,UAAA,CAAiB+b,QAAQ,EAAG,CAE1B,GAAI,CAAAz0E,CAAA,CAAS60D,CAAA4d,YAAT,CAAJ;AAAkC,CAAA/pE,KAAA,CAAMmsD,CAAA4d,YAAN,CAAlC,CAAA,CASA,IAAIlD,EAAa1a,CAAA6d,gBAAjB,CAEIgC,EAAY7f,CAAApB,OAFhB,CAGIkhB,EAAiB9f,CAAA4d,YAHrB,CAKImC,EAAe/f,CAAAmD,SAAf4c,EAAgC/f,CAAAmD,SAAA4c,aAEpC/f,EAAAggB,gBAAA,CAAqBtF,CAArB,CAZgB1a,CAAA2f,yBAYhB,CAA4C,QAAQ,CAACM,CAAD,CAAW,CAGxDF,CAAL,EAAqBF,CAArB,GAAmCI,CAAnC,GAKEjgB,CAAA4d,YAEA,CAFmBqC,CAAA,CAAWvF,CAAX,CAAwBjwE,CAE3C,CAAIu1D,CAAA4d,YAAJ,GAAyBkC,CAAzB,EACE9f,CAAAkgB,oBAAA,EARJ,CAH6D,CAA/D,CAhBA,CAF0B,CAoC5B,KAAAF,gBAAA,CAAuBG,QAAQ,CAACzF,CAAD,CAAaC,CAAb,CAAwByF,CAAxB,CAAsC,CAmCnEC,QAASA,EAAqB,EAAG,CAC/B,IAAIC,EAAsB,CAAA,CAC1Bh1E,EAAA,CAAQ00D,CAAA2D,YAAR,CAA0B,QAAQ,CAAC4c,CAAD,CAAYhqE,CAAZ,CAAkB,CAClD,IAAI6a,EAASmvD,CAAA,CAAU7F,CAAV,CAAsBC,CAAtB,CACb2F,EAAA,CAAsBA,CAAtB,EAA6ClvD,CAC7Cq0C,EAAA,CAAYlvD,CAAZ,CAAkB6a,CAAlB,CAHkD,CAApD,CAKA,OAAKkvD,EAAL,CAMO,CAAA,CANP,EACEh1E,CAAA,CAAQ00D,CAAA8d,iBAAR,CAA+B,QAAQ,CAACztC,CAAD,CAAI95B,CAAJ,CAAU,CAC/CkvD,CAAA,CAAYlvD,CAAZ,CAAkB,IAAlB,CAD+C,CAAjD,CAGO,CAAA,CAAA,CAJT,CAP+B,CAgBjCiqE,QAASA,EAAsB,EAAG,CAChC,IAAIC,EAAoB,EAAxB,CACIR,EAAW,CAAA,CACf30E,EAAA,CAAQ00D,CAAA8d,iBAAR,CAA+B,QAAQ,CAACyC,CAAD,CAAYhqE,CAAZ,CAAkB,CACvD,IAAI69B,EAAUmsC,CAAA,CAAU7F,CAAV;AAAsBC,CAAtB,CACd,IAAmBvmC,CAAAA,CAAnB,EA/5xBQ,CAAA1oC,CAAA,CA+5xBW0oC,CA/5xBA/K,KAAX,CA+5xBR,CACE,KAAMm6B,GAAA,CAAc,WAAd,CAC0EpvB,CAD1E,CAAN,CAGFqxB,CAAA,CAAYlvD,CAAZ,CAAkB9L,CAAlB,CACAg2E,EAAA/vE,KAAA,CAAuB0jC,CAAA/K,KAAA,CAAa,QAAQ,EAAG,CAC7Co8B,CAAA,CAAYlvD,CAAZ,CAAkB,CAAA,CAAlB,CAD6C,CAAxB,CAEpB,QAAQ,CAACwf,CAAD,CAAQ,CACjBkqD,CAAA,CAAW,CAAA,CACXxa,EAAA,CAAYlvD,CAAZ,CAAkB,CAAA,CAAlB,CAFiB,CAFI,CAAvB,CAPuD,CAAzD,CAcKkqE,EAAAx1E,OAAL,CAGEob,CAAA2jC,IAAA,CAAOy2B,CAAP,CAAAp3C,KAAA,CAA+B,QAAQ,EAAG,CACxCq3C,CAAA,CAAeT,CAAf,CADwC,CAA1C,CAEG1xE,CAFH,CAHF,CACEmyE,CAAA,CAAe,CAAA,CAAf,CAlB8B,CA0BlCjb,QAASA,EAAW,CAAClvD,CAAD,CAAO+uD,CAAP,CAAgB,CAC9Bqb,CAAJ,GAA6BzB,CAA7B,EACElf,CAAAF,aAAA,CAAkBvpD,CAAlB,CAAwB+uD,CAAxB,CAFgC,CAMpCob,QAASA,EAAc,CAACT,CAAD,CAAW,CAC5BU,CAAJ,GAA6BzB,CAA7B,EAEEkB,CAAA,CAAaH,CAAb,CAH8B,CAlFlCf,CAAA,EACA,KAAIyB,EAAuBzB,CAa3B0B,UAA2B,EAAG,CAC5B,IAAIC,EAAW7gB,CAAAqD,aAAXwd,EAAgC,OACpC,IAAIhyE,CAAA,CAAYyvE,CAAZ,CAAJ,CACE7Y,CAAA,CAAYob,CAAZ,CAAsB,IAAtB,CADF,KAaE,OAVKvC,EAUEA,GATLhzE,CAAA,CAAQ00D,CAAA2D,YAAR,CAA0B,QAAQ,CAACtzB,CAAD,CAAI95B,CAAJ,CAAU,CAC1CkvD,CAAA,CAAYlvD,CAAZ,CAAkB,IAAlB,CAD0C,CAA5C,CAGA,CAAAjL,CAAA,CAAQ00D,CAAA8d,iBAAR,CAA+B,QAAQ,CAACztC,CAAD,CAAI95B,CAAJ,CAAU,CAC/CkvD,CAAA,CAAYlvD,CAAZ,CAAkB,IAAlB,CAD+C,CAAjD,CAMK+nE,EADP7Y,CAAA,CAAYob,CAAZ,CAAsBvC,CAAtB,CACOA,CAAAA,CAET,OAAO,CAAA,CAjBqB,CAA9BsC,CAVK,EAAL,CAIKP,CAAA,EAAL,CAIAG,CAAA,EAJA,CACEE,CAAA,CAAe,CAAA,CAAf,CALF,CACEA,CAAA,CAAe,CAAA,CAAf,CANiE,CAsGrE,KAAAthB,iBAAA,CAAwB0hB,QAAQ,EAAG,CACjC,IAAInG,EAAY3a,CAAAqB,WAEhBh6C;CAAAsR,OAAA,CAAgB0lD,CAAhB,CAKA,IAAIre,CAAA2f,yBAAJ,GAAsChF,CAAtC,EAAkE,EAAlE,GAAoDA,CAApD,EAAyE3a,CAAAsB,sBAAzE,CAGAtB,CAAA8e,qBAAA,CAA0BnE,CAA1B,CAOA,CANA3a,CAAA2f,yBAMA,CANgChF,CAMhC,CAHI3a,CAAArB,UAGJ,EAFE,IAAAuB,UAAA,EAEF,CAAA,IAAA6gB,mBAAA,EAlBiC,CAqBnC,KAAAA,mBAAA,CAA0BC,QAAQ,EAAG,CAEnC,IAAItG,EADY1a,CAAA2f,yBAIhB,IAFArB,CAEA,CAFczvE,CAAA,CAAY6rE,CAAZ,CAAA,CAA0BjwE,CAA1B,CAAsC,CAAA,CAEpD,CACE,IAAS,IAAAyB,EAAI,CAAb,CAAgBA,CAAhB,CAAoB8zD,CAAAsD,SAAAr4D,OAApB,CAA0CiB,CAAA,EAA1C,CAEE,GADAwuE,CACI,CADS1a,CAAAsD,SAAA,CAAcp3D,CAAd,CAAA,CAAiBwuE,CAAjB,CACT,CAAA7rE,CAAA,CAAY6rE,CAAZ,CAAJ,CAA6B,CAC3B4D,CAAA,CAAc,CAAA,CACd,MAF2B,CAM7BnzE,CAAA,CAAS60D,CAAA4d,YAAT,CAAJ,EAAkC/pE,KAAA,CAAMmsD,CAAA4d,YAAN,CAAlC,GAEE5d,CAAA4d,YAFF,CAEqBO,CAAA,CAAWz5C,CAAX,CAFrB,CAIA,KAAIo7C,EAAiB9f,CAAA4d,YAArB,CACImC,EAAe/f,CAAAmD,SAAf4c,EAAgC/f,CAAAmD,SAAA4c,aACpC/f,EAAA6d,gBAAA,CAAuBnD,CAEnBqF,EAAJ,GACE/f,CAAA4d,YAkBA;AAlBmBlD,CAkBnB,CAAI1a,CAAA4d,YAAJ,GAAyBkC,CAAzB,EACE9f,CAAAkgB,oBAAA,EApBJ,CAOAlgB,EAAAggB,gBAAA,CAAqBtF,CAArB,CAAiC1a,CAAA2f,yBAAjC,CAAgE,QAAQ,CAACM,CAAD,CAAW,CAC5EF,CAAL,GAKE/f,CAAA4d,YAMF,CANqBqC,CAAA,CAAWvF,CAAX,CAAwBjwE,CAM7C,CAAIu1D,CAAA4d,YAAJ,GAAyBkC,CAAzB,EACE9f,CAAAkgB,oBAAA,EAZF,CADiF,CAAnF,CA7BmC,CA+CrC,KAAAA,oBAAA,CAA2Be,QAAQ,EAAG,CACpC7C,CAAA,CAAW15C,CAAX,CAAmBs7B,CAAA4d,YAAnB,CACAtyE,EAAA,CAAQ00D,CAAAyc,qBAAR,CAAmC,QAAQ,CAAC7lD,CAAD,CAAW,CACpD,GAAI,CACFA,CAAA,EADE,CAEF,MAAOniB,CAAP,CAAU,CACVgQ,CAAA,CAAkBhQ,CAAlB,CADU,CAHwC,CAAtD,CAFoC,CA6DtC,KAAA8sD,cAAA,CAAqB2f,QAAQ,CAAC70E,CAAD,CAAQq7D,CAAR,CAAiB,CAC5C1H,CAAAqB,WAAA,CAAkBh1D,CACb2zD,EAAAmD,SAAL,EAAsBge,CAAAnhB,CAAAmD,SAAAge,gBAAtB,EACEnhB,CAAAohB,0BAAA,CAA+B1Z,CAA/B,CAH0C,CAO9C,KAAA0Z,0BAAA,CAAiCC,QAAQ,CAAC3Z,CAAD,CAAU,CAAA,IAC7C4Z,EAAgB,CAD6B,CAE7C7rD,EAAUuqC,CAAAmD,SAGV1tC,EAAJ,EAAe3mB,CAAA,CAAU2mB,CAAA8rD,SAAV,CAAf,GACEA,CACA,CADW9rD,CAAA8rD,SACX;AAAIp2E,CAAA,CAASo2E,CAAT,CAAJ,CACED,CADF,CACkBC,CADlB,CAEWp2E,CAAA,CAASo2E,CAAA,CAAS7Z,CAAT,CAAT,CAAJ,CACL4Z,CADK,CACWC,CAAA,CAAS7Z,CAAT,CADX,CAEIv8D,CAAA,CAASo2E,CAAA,CAAS,SAAT,CAAT,CAFJ,GAGLD,CAHK,CAGWC,CAAA,CAAS,SAAT,CAHX,CAJT,CAWAl6D,EAAAsR,OAAA,CAAgB0lD,CAAhB,CACIiD,EAAJ,CACEjD,CADF,CACoBh3D,CAAA,CAAS,QAAQ,EAAG,CACpC24C,CAAAZ,iBAAA,EADoC,CAApB,CAEfkiB,CAFe,CADpB,CAIWn7D,CAAAovB,QAAJ,CACLyqB,CAAAZ,iBAAA,EADK,CAGL16B,CAAAhtB,OAAA,CAAc,QAAQ,EAAG,CACvBsoD,CAAAZ,iBAAA,EADuB,CAAzB,CAxB+C,CAsCnD16B,EAAAx1B,OAAA,CAAcsyE,QAAqB,EAAG,CACpC,IAAI9G,EAAayD,CAAA,CAAWz5C,CAAX,CAIjB,IAAIg2C,CAAJ,GAAmB1a,CAAA4d,YAAnB,GAEI5d,CAAA4d,YAFJ,GAEyB5d,CAAA4d,YAFzB,EAE6ClD,CAF7C,GAE4DA,CAF5D,EAGE,CACA1a,CAAA4d,YAAA,CAAmB5d,CAAA6d,gBAAnB,CAA0CnD,CAC1C4D,EAAA,CAAc7zE,CAMd,KARA,IAIIg3E,EAAazhB,CAAAe,YAJjB,CAKI5gC,EAAMshD,CAAAx2E,OALV,CAOI0vE,EAAYD,CAChB,CAAOv6C,CAAA,EAAP,CAAA,CACEw6C,CAAA,CAAY8G,CAAA,CAAWthD,CAAX,CAAA,CAAgBw6C,CAAhB,CAEV3a,EAAAqB,WAAJ,GAAwBsZ,CAAxB,GACE3a,CAAA8e,qBAAA,CAA0BnE,CAA1B,CAIA,CAHA3a,CAAAqB,WAGA,CAHkBrB,CAAA2f,yBAGlB,CAHkDhF,CAGlD,CAFA3a,CAAA2B,QAAA,EAEA,CAAA3B,CAAAggB,gBAAA,CAAqBtF,CAArB,CAAiCC,CAAjC,CAA4CpsE,CAA5C,CALF,CAXA,CAoBF,MAAOmsE,EA5B6B,CAAtC,CA5nBiH,CAD3F,CAhwBxB;AAylDI/4D,GAAmB,CAAC,YAAD,CAAe,QAAQ,CAACwE,CAAD,CAAa,CACzD,MAAO,CACLgW,SAAU,GADL,CAELD,QAAS,CAAC,SAAD,CAAY,QAAZ,CAAsB,kBAAtB,CAFJ,CAGL1iB,WAAYmkE,EAHP,CAOL1hD,SAAU,CAPL,CAQLxkB,QAASiqE,QAAuB,CAAC3xE,CAAD,CAAU,CAExCA,CAAA2f,SAAA,CAAiB0wC,EAAjB,CAAA1wC,SAAA,CApjCgB4vD,cAojChB,CAAA5vD,SAAA,CAAoE61C,EAApE,CAEA,OAAO,CACL1hC,IAAK89C,QAAuB,CAACnqE,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBypE,CAAvB,CAA8B,CAAA,IACpD0I,EAAY1I,CAAA,CAAM,CAAN,CACZ2I,EAAAA,CAAW3I,CAAA,CAAM,CAAN,CAAX2I,EAAuBD,CAAA7iB,aAE3B6iB,EAAArD,aAAA,CAAuBrF,CAAA,CAAM,CAAN,CAAvB,EAAmCA,CAAA,CAAM,CAAN,CAAA/V,SAAnC,CAGA0e,EAAAviB,YAAA,CAAqBsiB,CAArB,CAEAnyE,EAAA88B,SAAA,CAAc,MAAd,CAAsB,QAAQ,CAACjB,CAAD,CAAW,CACnCs2C,CAAAnjB,MAAJ,GAAwBnzB,CAAxB,EACEs2C,CAAA7iB,aAAAS,gBAAA,CAAuCoiB,CAAvC,CAAkDt2C,CAAlD,CAFqC,CAAzC,CAMA9zB,EAAAmuB,IAAA,CAAU,UAAV,CAAsB,QAAQ,EAAG,CAC/Bi8C,CAAA7iB,aAAAa,eAAA,CAAsCgiB,CAAtC,CAD+B,CAAjC,CAfwD,CADrD,CAoBL99C,KAAMg+C,QAAwB,CAACtqE,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBypE,CAAvB,CAA8B,CAC1D,IAAI0I,EAAY1I,CAAA,CAAM,CAAN,CAChB,IAAI0I,CAAAze,SAAJ;AAA0Bye,CAAAze,SAAA4e,SAA1B,CACEhyE,CAAAsJ,GAAA,CAAWuoE,CAAAze,SAAA4e,SAAX,CAAwC,QAAQ,CAAC5gB,CAAD,CAAK,CACnDygB,CAAAR,0BAAA,CAAoCjgB,CAApC,EAA0CA,CAAAp2C,KAA1C,CADmD,CAArD,CAKFhb,EAAAsJ,GAAA,CAAW,MAAX,CAAmB,QAAQ,CAAC8nD,CAAD,CAAK,CAC1BygB,CAAA5D,SAAJ,GAEI73D,CAAAovB,QAAJ,CACE/9B,CAAAvI,WAAA,CAAiB2yE,CAAApC,YAAjB,CADF,CAGEhoE,CAAAE,OAAA,CAAakqE,CAAApC,YAAb,CALF,CAD8B,CAAhC,CAR0D,CApBvD,CAJiC,CARrC,CADkD,CAApC,CAzlDvB,CAipDIwC,GAAiB,uBAjpDrB,CAozDIj/D,GAA0BA,QAAQ,EAAG,CACvC,MAAO,CACLoZ,SAAU,GADL,CAEL3iB,WAAY,CAAC,QAAD,CAAW,QAAX,CAAqB,QAAQ,CAACkrB,CAAD,CAAS5H,CAAT,CAAiB,CACxD,IAAIusB,EAAO,IACX,KAAA8Z,SAAA,CAAgB7yD,EAAA,CAAKo0B,CAAA2qB,MAAA,CAAavyB,CAAAha,eAAb,CAAL,CAEZhU,EAAA,CAAU,IAAAq0D,SAAA4e,SAAV,CAAJ,EACE,IAAA5e,SAAAge,gBAEA,CAFgC,CAAA,CAEhC,CAAA,IAAAhe,SAAA4e,SAAA,CAAyB73D,CAAA,CAAK,IAAAi5C,SAAA4e,SAAAruE,QAAA,CAA+BsuE,EAA/B,CAA+C,QAAQ,EAAG,CACtF34B,CAAA8Z,SAAAge,gBAAA;AAAgC,CAAA,CAChC,OAAO,GAF+E,CAA1D,CAAL,CAH3B,EAQE,IAAAhe,SAAAge,gBARF,CAQkC,CAAA,CAZsB,CAA9C,CAFP,CADgC,CApzDzC,CAq9DI5gE,GAAyB49C,EAAA,CAAY,CAAEr9B,SAAU,CAAA,CAAZ,CAAkB7E,SAAU,GAA5B,CAAZ,CAr9D7B,CAy9DIgmD,GAAkBv3E,CAAA,CAAO,WAAP,CAz9DtB,CA+rEIw3E,GAAoB,2OA/rExB,CA4sEI3gE,GAAqB,CAAC,UAAD,CAAa,QAAb,CAAuB,QAAQ,CAACq6D,CAAD,CAAW31D,CAAX,CAAmB,CAEzEk8D,QAASA,EAAsB,CAACC,CAAD,CAAaC,CAAb,CAA4B7qE,CAA5B,CAAmC,CAsDhE8qE,QAASA,EAAM,CAACC,CAAD,CAAc5H,CAAd,CAAyB6H,CAAzB,CAAgCC,CAAhC,CAAuCC,CAAvC,CAAiD,CAC9D,IAAAH,YAAA,CAAmBA,CACnB,KAAA5H,UAAA,CAAiBA,CACjB,KAAA6H,MAAA,CAAaA,CACb,KAAAC,MAAA,CAAaA,CACb,KAAAC,SAAA,CAAgBA,CAL8C,CAtDA;AA8DhEC,QAASA,EAAmB,CAACC,CAAD,CAAe,CACzC,IAAIC,CAEJ,IAAKC,CAAAA,CAAL,EAAgBn4E,EAAA,CAAYi4E,CAAZ,CAAhB,CACEC,CAAA,CAAmBD,CADrB,KAEO,CAELC,CAAA,CAAmB,EACnB,KAASE,IAAAA,CAAT,GAAoBH,EAApB,CACMA,CAAAj3E,eAAA,CAA4Bo3E,CAA5B,CAAJ,EAAkE,GAAlE,GAA4CA,CAAAnxE,OAAA,CAAe,CAAf,CAA5C,EACEixE,CAAAnyE,KAAA,CAAsBqyE,CAAtB,CALC,CASP,MAAOF,EAdkC,CA5D3C,IAAIpxE,EAAQ2wE,CAAA3wE,MAAA,CAAiBywE,EAAjB,CACZ,IAAMzwE,CAAAA,CAAN,CACE,KAAMwwE,GAAA,CAAgB,MAAhB,CAIJG,CAJI,CAIQ7tE,EAAA,CAAY8tE,CAAZ,CAJR,CAAN,CAUF,IAAIW,EAAYvxE,CAAA,CAAM,CAAN,CAAZuxE,EAAwBvxE,CAAA,CAAM,CAAN,CAA5B,CAEIqxE,EAAUrxE,CAAA,CAAM,CAAN,CAGVwxE,EAAAA,CAAW,MAAA3zE,KAAA,CAAYmC,CAAA,CAAM,CAAN,CAAZ,CAAXwxE,EAAoCxxE,CAAA,CAAM,CAAN,CAExC,KAAIyxE,EAAUzxE,CAAA,CAAM,CAAN,CAEV/C,EAAAA,CAAUuX,CAAA,CAAOxU,CAAA,CAAM,CAAN,CAAA,CAAWA,CAAA,CAAM,CAAN,CAAX,CAAsBuxE,CAA7B,CAEd,KAAIG,EADaF,CACbE,EADyBl9D,CAAA,CAAOg9D,CAAP,CACzBE,EAA4Bz0E,CAAhC,CACI00E,EAAYF,CAAZE,EAAuBn9D,CAAA,CAAOi9D,CAAP,CAD3B,CAMIG,EAAoBH,CAAA,CACE,QAAQ,CAAC72E,CAAD,CAAQmmB,CAAR,CAAgB,CAAE,MAAO4wD,EAAA,CAAU5rE,CAAV,CAAiBgb,CAAjB,CAAT,CAD1B,CAEE8wD,QAAuB,CAACj3E,CAAD,CAAQ,CAAE,MAAOujB,GAAA,CAAQvjB,CAAR,CAAT,CARzD,CASIk3E,EAAkBA,QAAQ,CAACl3E,CAAD,CAAQZ,CAAR,CAAa,CACzC,MAAO43E,EAAA,CAAkBh3E,CAAlB,CAAyBm3E,CAAA,CAAUn3E,CAAV,CAAiBZ,CAAjB,CAAzB,CADkC,CAT3C,CAaIg4E,EAAYx9D,CAAA,CAAOxU,CAAA,CAAM,CAAN,CAAP,EAAmBA,CAAA,CAAM,CAAN,CAAnB,CAbhB,CAcIiyE,EAAYz9D,CAAA,CAAOxU,CAAA,CAAM,CAAN,CAAP,EAAmB,EAAnB,CAdhB,CAeIkyE,EAAgB19D,CAAA,CAAOxU,CAAA,CAAM,CAAN,CAAP,EAAmB,EAAnB,CAfpB,CAgBImyE,EAAW39D,CAAA,CAAOxU,CAAA,CAAM,CAAN,CAAP,CAhBf,CAkBI+gB,EAAS,EAlBb,CAmBIgxD,EAAYV,CAAA,CAAU,QAAQ,CAACz2E,CAAD,CAAQZ,CAAR,CAAa,CAC7C+mB,CAAA,CAAOswD,CAAP,CAAA,CAAkBr3E,CAClB+mB,EAAA,CAAOwwD,CAAP,CAAA,CAAoB32E,CACpB,OAAOmmB,EAHsC,CAA/B,CAIZ,QAAQ,CAACnmB,CAAD,CAAQ,CAClBmmB,CAAA,CAAOwwD,CAAP,CAAA,CAAoB32E,CACpB,OAAOmmB,EAFW,CA+BpB,OAAO,CACL0wD,QAASA,CADJ;AAELK,gBAAiBA,CAFZ,CAGLM,cAAe59D,CAAA,CAAO29D,CAAP,CAAiB,QAAQ,CAAChB,CAAD,CAAe,CAIrD,IAAIkB,EAAe,EACnBlB,EAAA,CAAeA,CAAf,EAA+B,EAI/B,KAFA,IAAIC,EAAmBF,CAAA,CAAoBC,CAApB,CAAvB,CACImB,EAAqBlB,CAAA53E,OADzB,CAESkF,EAAQ,CAAjB,CAAoBA,CAApB,CAA4B4zE,CAA5B,CAAgD5zE,CAAA,EAAhD,CAAyD,CACvD,IAAI1E,EAAOm3E,CAAD,GAAkBC,CAAlB,CAAsC1yE,CAAtC,CAA8C0yE,CAAA,CAAiB1yE,CAAjB,CAAxD,CAGIqiB,EAASgxD,CAAA,CAAUZ,CAAA,CAAan3E,CAAb,CAAV,CAA6BA,CAA7B,CAHb,CAII82E,EAAcc,CAAA,CAAkBT,CAAA,CAAan3E,CAAb,CAAlB,CAAqC+mB,CAArC,CAClBsxD,EAAApzE,KAAA,CAAkB6xE,CAAlB,CAGA,IAAI9wE,CAAA,CAAM,CAAN,CAAJ,EAAgBA,CAAA,CAAM,CAAN,CAAhB,CACM+wE,CACJ,CADYiB,CAAA,CAAUjsE,CAAV,CAAiBgb,CAAjB,CACZ,CAAAsxD,CAAApzE,KAAA,CAAkB8xE,CAAlB,CAIE/wE,EAAA,CAAM,CAAN,CAAJ,GACMuyE,CACJ,CADkBL,CAAA,CAAcnsE,CAAd,CAAqBgb,CAArB,CAClB,CAAAsxD,CAAApzE,KAAA,CAAkBszE,CAAlB,CAFF,CAfuD,CAoBzD,MAAOF,EA7B8C,CAAxC,CAHV,CAmCLG,WAAYA,QAAQ,EAAG,CAWrB,IATA,IAAIC,EAAc,EAAlB,CACIC,EAAiB,EADrB,CAKIvB,EAAegB,CAAA,CAASpsE,CAAT,CAAforE,EAAkC,EALtC,CAMIC,EAAmBF,CAAA,CAAoBC,CAApB,CANvB,CAOImB,EAAqBlB,CAAA53E,OAPzB,CASSkF,EAAQ,CAAjB,CAAoBA,CAApB,CAA4B4zE,CAA5B,CAAgD5zE,CAAA,EAAhD,CAAyD,CACvD,IAAI1E,EAAOm3E,CAAD,GAAkBC,CAAlB,CAAsC1yE,CAAtC,CAA8C0yE,CAAA,CAAiB1yE,CAAjB,CAAxD,CAEIqiB,EAASgxD,CAAA,CADDZ,CAAAv2E,CAAaZ,CAAbY,CACC,CAAiBZ,CAAjB,CAFb,CAGIkvE,EAAYwI,CAAA,CAAY3rE,CAAZ,CAAmBgb,CAAnB,CAHhB,CAII+vD,EAAcc,CAAA,CAAkB1I,CAAlB,CAA6BnoD,CAA7B,CAJlB,CAKIgwD,EAAQiB,CAAA,CAAUjsE,CAAV,CAAiBgb,CAAjB,CALZ,CAMIiwD,EAAQiB,CAAA,CAAUlsE,CAAV,CAAiBgb,CAAjB,CANZ,CAOIkwD,EAAWiB,CAAA,CAAcnsE,CAAd,CAAqBgb,CAArB,CAPf,CAQI4xD,EAAa,IAAI9B,CAAJ,CAAWC,CAAX,CAAwB5H,CAAxB,CAAmC6H,CAAnC,CAA0CC,CAA1C,CAAiDC,CAAjD,CAEjBwB,EAAAxzE,KAAA,CAAiB0zE,CAAjB,CACAD,EAAA,CAAe5B,CAAf,CAAA,CAA8B6B,CAZyB,CAezD,MAAO,CACLx0E,MAAOs0E,CADF,CAELC,eAAgBA,CAFX,CAGLE,uBAAwBA,QAAQ,CAACh4E,CAAD,CAAQ,CACtC,MAAO83E,EAAA,CAAeZ,CAAA,CAAgBl3E,CAAhB,CAAf,CAD+B,CAHnC;AAMLi4E,uBAAwBA,QAAQ,CAAC5lE,CAAD,CAAS,CAGvC,MAAOwkE,EAAA,CAAUprE,EAAAxH,KAAA,CAAaoO,CAAAi8D,UAAb,CAAV,CAA2Cj8D,CAAAi8D,UAHX,CANpC,CA1Bc,CAnClB,CA/EyD,CAFO,IAiKrE4J,EAAiB/5E,CAAAwe,cAAA,CAAuB,QAAvB,CAjKoD,CAkKrEw7D,EAAmBh6E,CAAAwe,cAAA,CAAuB,UAAvB,CAgVvB,OAAO,CACLmT,SAAU,GADL,CAEL2E,SAAU,CAAA,CAFL,CAGL5E,QAAS,CAAC,QAAD,CAAW,SAAX,CAHJ,CAIL7C,KAAM,CACJwK,IAAK4gD,QAAyB,CAACjtE,CAAD,CAAQ6qE,CAAR,CAAuB5yE,CAAvB,CAA6BypE,CAA7B,CAAoC,CAIhEA,CAAA,CAAM,CAAN,CAAAwL,eAAA,CAA0Bn2E,CAJsC,CAD9D,CAOJu1B,KAzVF6gD,QAA0B,CAACntE,CAAD,CAAQ6qE,CAAR,CAAuB5yE,CAAvB,CAA6BypE,CAA7B,CAAoC,CAgL5D0L,QAASA,EAAmB,CAAClmE,CAAD,CAAS3O,CAAT,CAAkB,CAC5C2O,CAAA3O,QAAA,CAAiBA,CACjBA,EAAA2yE,SAAA,CAAmBhkE,CAAAgkE,SAMfhkE,EAAA8jE,MAAJ,GAAqBzyE,CAAAyyE,MAArB,GACEzyE,CAAAyyE,MACA,CADgB9jE,CAAA8jE,MAChB,CAAAzyE,CAAA4Z,YAAA,CAAsBjL,CAAA8jE,MAFxB,CAII9jE,EAAArS,MAAJ,GAAqB0D,CAAA1D,MAArB,GAAoC0D,CAAA1D,MAApC,CAAoDqS,CAAA6jE,YAApD,CAZ4C,CAe9CsC,QAASA,EAAiB,CAACz2E,CAAD,CAASm+C,CAAT,CAAkBxhC,CAAlB,CAAwB+wD,CAAxB,CAAyC,CAG7DvvB,CAAJ,EAAev8C,CAAA,CAAUu8C,CAAA/+C,SAAV,CAAf,GAA+Cud,CAA/C,CAEEhb,CAFF,CAEYw8C,CAFZ,EAKEx8C,CACA,CADU+rE,CAAAruE,UAAA,CAA0B,CAAA,CAA1B,CACV,CAAK8+C,CAAL,CAKEn+C,CAAA86D,aAAA,CAAoBn5D,CAApB;AAA6Bw8C,CAA7B,CALF,CAEEn+C,CAAA2a,YAAA,CAAmBhZ,CAAnB,CARJ,CAcA,OAAOA,EAjB0D,CAqBnE+0E,QAASA,EAAoB,CAACv4B,CAAD,CAAU,CAErC,IADA,IAAIgD,CACJ,CAAOhD,CAAP,CAAA,CACEgD,CAEA,CAFOhD,CAAArxC,YAEP,CADAiS,EAAA,CAAao/B,CAAb,CACA,CAAAA,CAAA,CAAUgD,CALyB,CAUvCw1B,QAASA,EAA0B,CAACx4B,CAAD,CAAU,CAC3C,IAAIy4B,EAAeC,CAAfD,EAA8BC,CAAA,CAAY,CAAZ,CAAlC,CACIC,EAAiBC,CAAjBD,EAAkCC,CAAA,CAAc,CAAd,CAKtC,IAAIH,CAAJ,EAAoBE,CAApB,CACE,IAAA,CAAO34B,CAAP,GACOA,CADP,GACmBy4B,CADnB,EAEMz4B,CAFN,GAEkB24B,CAFlB,EA3qyBcviD,CA2qyBd,GAGM4pB,CAAA13C,SAHN,EAI8B,QAJ9B,GAIO/E,EAAA,CAAUy8C,CAAV,CAJP,EAI4D,EAJ5D,GAI0CA,CAAAlgD,MAJ1C,EAAA,CAKEkgD,CAAA,CAAUA,CAAArxC,YAGd,OAAOqxC,EAhBoC,CAoB7C64B,QAASA,EAAa,EAAG,CAEvB,IAAIC,EAAgB5vD,CAAhB4vD,EAA2BC,CAAAC,UAAA,EAE/B9vD,EAAA,CAAUnU,CAAA2iE,WAAA,EAEV,KAAIuB,EAAW,EAAf,CACIpI,EAAiBiF,CAAA,CAAc,CAAd,CAAA34D,WAGjB+7D,EAAJ,EACEpD,CAAAjZ,QAAA,CAAsB6b,CAAtB,CAGF7H,EAAA,CAAiB2H,CAAA,CAA2B3H,CAA3B,CAEjB3nD,EAAA7lB,MAAAtE,QAAA,CAAsBo6E,QAAqB,CAAChnE,CAAD,CAAS,CAClD,IAAI+jE,CAAJ,CAEIkD,CAEA72E,EAAA,CAAU4P,CAAA+jE,MAAV,CAAJ,EAIEA,CA8BA,CA9BQ+C,CAAA,CAAS9mE,CAAA+jE,MAAT,CA8BR,CA5BKA,CA4BL,GAzBEmD,CAWA,CAXef,CAAA,CAAkBxC,CAAA,CAAc,CAAd,CAAlB,CACkBjF,CADlB,CAEkB,UAFlB,CAGkBoH,CAHlB,CAWf,CANApH,CAMA,CANiBwI,CAAA1qE,YAMjB,CAHA0qE,CAAApD,MAGA,CAHqB9jE,CAAA+jE,MAGrB,CAAAA,CAAA,CAAQ+C,CAAA,CAAS9mE,CAAA+jE,MAAT,CAAR,CAAiC,CAC/BmD,aAAcA,CADiB,CAE/BC,qBAAsBD,CAAAl8D,WAFS,CAcnC;AANAi8D,CAMA,CANgBd,CAAA,CAAkBpC,CAAAmD,aAAlB,CACkBnD,CAAAoD,qBADlB,CAEkB,QAFlB,CAGkBtB,CAHlB,CAMhB,CAFAK,CAAA,CAAoBlmE,CAApB,CAA4BinE,CAA5B,CAEA,CAAAlD,CAAAoD,qBAAA,CAA6BF,CAAAzqE,YAlC/B,GAuCEyqE,CAMA,CANgBd,CAAA,CAAkBxC,CAAA,CAAc,CAAd,CAAlB,CACkBjF,CADlB,CAEkB,QAFlB,CAGkBmH,CAHlB,CAMhB,CAFAK,CAAA,CAAoBlmE,CAApB,CAA4BinE,CAA5B,CAEA,CAAAvI,CAAA,CAAiBuI,CAAAzqE,YA7CnB,CALkD,CAApD,CAwDAhQ,OAAAc,KAAA,CAAYw5E,CAAZ,CAAAl6E,QAAA,CAA8B,QAAQ,CAACG,CAAD,CAAM,CAC1Cq5E,CAAA,CAAqBU,CAAA,CAAS/5E,CAAT,CAAAo6E,qBAArB,CAD0C,CAA5C,CAGAf,EAAA,CAAqB1H,CAArB,CAEA0I,EAAAnkB,QAAA,EAGA,IAAK,CAAAmkB,CAAA9kB,SAAA,CAAqBqkB,CAArB,CAAL,CAA0C,CACxC,IAAIU,EAAYT,CAAAC,UAAA,EAEhB,EADqBjkE,CAAA4hE,QACjB,EADsC1a,CACtC,CAAkB32D,EAAA,CAAOwzE,CAAP,CAAsBU,CAAtB,CAAlB,CAAqDV,CAArD,GAAuEU,CAA3E,IACED,CAAAvkB,cAAA,CAA0BwkB,CAA1B,CACA,CAAAD,CAAAnkB,QAAA,EAFF,CAHwC,CAhFnB,CAhPzB,IAAI2jB,EAAapM,CAAA,CAAM,CAAN,CAAjB,CACI4M,EAAc5M,CAAA,CAAM,CAAN,CADlB,CAEI1Q,EAAW/4D,CAAA+4D,SAFf,CAMIyc,CACK/4E,EAAAA,CAAI,CAAb,KAT4D,IAS5C21C,EAAWwgC,CAAAxgC,SAAA,EATiC,CASP/0C,EAAK+0C,CAAA52C,OAA1D,CAA2EiB,CAA3E,CAA+EY,CAA/E,CAAmFZ,CAAA,EAAnF,CACE,GAA0B,EAA1B,GAAI21C,CAAA,CAAS31C,CAAT,CAAAG,MAAJ,CAA8B,CAC5B44E,CAAA,CAAcpjC,CAAAqL,GAAA,CAAYhhD,CAAZ,CACd,MAF4B,CAMhC,IAAIu5E,EAAsB,CAAER,CAAAA,CAA5B,CAEIE,EAAgBn6E,CAAA,CAAOu5E,CAAA92E,UAAA,CAAyB,CAAA,CAAzB,CAAP,CACpB03E,EAAApyE,IAAA,CAAkB,GAAlB,CAEA,KAAI0iB,CAAJ,CACInU,EAAY6gE,CAAA,CAAuB1yE,CAAA6R,UAAvB;AAAuC+gE,CAAvC,CAAsD7qE,CAAtD,CA+BXgxD,EAAL,EAgDEsd,CAAA9kB,SAiCA,CAjCuBglB,QAAQ,CAAC35E,CAAD,CAAQ,CACrC,MAAO,CAACA,CAAR,EAAkC,CAAlC,GAAiBA,CAAApB,OADoB,CAiCvC,CA5BAq6E,CAAAW,WA4BA,CA5BwBC,QAA+B,CAAC75E,CAAD,CAAQ,CAC7DopB,CAAA7lB,MAAAtE,QAAA,CAAsB,QAAQ,CAACoT,CAAD,CAAS,CACrCA,CAAA3O,QAAA04D,SAAA,CAA0B,CAAA,CADW,CAAvC,CAIIp8D,EAAJ,EACEA,CAAAf,QAAA,CAAc,QAAQ,CAACD,CAAD,CAAO,CAE3B,CADIqT,CACJ,CADa+W,CAAA4uD,uBAAA,CAA+Bh5E,CAA/B,CACb,GAAeq3E,CAAAhkE,CAAAgkE,SAAf,GAAgChkE,CAAA3O,QAAA04D,SAAhC,CAA0D,CAAA,CAA1D,CAF2B,CAA7B,CAN2D,CA4B/D,CAdA6c,CAAAC,UAcA,CAduBY,QAA8B,EAAG,CAAA,IAClDC,EAAiB/D,CAAAtvE,IAAA,EAAjBqzE,EAAwC,EADU,CAElDC,EAAa,EAEjB/6E,EAAA,CAAQ86E,CAAR,CAAwB,QAAQ,CAAC/5E,CAAD,CAAQ,CAEtC,CADIqS,CACJ,CADa+W,CAAA0uD,eAAA,CAAuB93E,CAAvB,CACb,GAAeq2E,CAAAhkE,CAAAgkE,SAAf,EAAgC2D,CAAA31E,KAAA,CAAgB+kB,CAAA6uD,uBAAA,CAA+B5lE,CAA/B,CAAhB,CAFM,CAAxC,CAKA,OAAO2nE,EAT+C,CAcxD,CAAI/kE,CAAA4hE,QAAJ,EAEE1rE,CAAAs1B,iBAAA,CAAuB,QAAQ,EAAG,CAChC,GAAIhiC,CAAA,CAAQg7E,CAAAzkB,WAAR,CAAJ,CACE,MAAOykB,EAAAzkB,WAAA5D,IAAA,CAA2B,QAAQ,CAACpxD,CAAD,CAAQ,CAChD,MAAOiV,EAAAiiE,gBAAA,CAA0Bl3E,CAA1B,CADyC,CAA3C,CAFuB,CAAlC;AAMG,QAAQ,EAAG,CACZy5E,CAAAnkB,QAAA,EADY,CANd,CAnFJ,GAEE2jB,CAAAW,WAqCA,CArCwBC,QAA4B,CAAC75E,CAAD,CAAQ,CAC1D,IAAIqS,EAAS+W,CAAA4uD,uBAAA,CAA+Bh4E,CAA/B,CAETqS,EAAJ,EAAegkE,CAAAhkE,CAAAgkE,SAAf,CACML,CAAA,CAAc,CAAd,CAAAh2E,MADN,GACiCqS,CAAA6jE,YADjC,GATF4C,CAAAjrD,OAAA,EAgBM,CA9BDurD,CA8BC,EA7BJR,CAAA/qD,OAAA,EA6BI,CAFAmoD,CAAA,CAAc,CAAd,CAAAh2E,MAEA,CAFyBqS,CAAA6jE,YAEzB,CADA7jE,CAAA3O,QAAA04D,SACA,CAD0B,CAAA,CAC1B,CAAA/pD,CAAA3O,QAAAsc,aAAA,CAA4B,UAA5B,CAAwC,UAAxC,CAPJ,EAUgB,IAAd,GAAIhgB,CAAJ,EAAsBo5E,CAAtB,EAnBJN,CAAAjrD,OAAA,EAlBA,CALKurD,CAKL,EAJEpD,CAAAjZ,QAAA,CAAsB6b,CAAtB,CAIF,CAFA5C,CAAAtvE,IAAA,CAAkB,EAAlB,CAEA,CADAkyE,CAAAz1E,KAAA,CAAiB,UAAjB,CAA6B,CAAA,CAA7B,CACA,CAAAy1E,CAAAx1E,KAAA,CAAiB,UAAjB,CAA6B,CAAA,CAA7B,CAqCI,GAjCCg2E,CAUL,EATER,CAAA/qD,OAAA,EASF,CAHAmoD,CAAAjZ,QAAA,CAAsB+b,CAAtB,CAGA,CAFA9C,CAAAtvE,IAAA,CAAkB,GAAlB,CAEA,CADAoyE,CAAA31E,KAAA,CAAmB,UAAnB,CAA+B,CAAA,CAA/B,CACA,CAAA21E,CAAA11E,KAAA,CAAmB,UAAnB,CAA+B,CAAA,CAA/B,CAuBI,CAbwD,CAqC5D,CAdA61E,CAAAC,UAcA,CAduBY,QAA2B,EAAG,CAEnD,IAAIG,EAAiB7wD,CAAA0uD,eAAA,CAAuB9B,CAAAtvE,IAAA,EAAvB,CAErB,OAAIuzE,EAAJ,EAAuB5D,CAAA4D,CAAA5D,SAAvB;CA/CG+C,CAkDM,EAjDTR,CAAA/qD,OAAA,EAiDS,CApCXirD,CAAAjrD,OAAA,EAoCW,CAAAzE,CAAA6uD,uBAAA,CAA+BgC,CAA/B,CAHT,EAKO,IAT4C,CAcrD,CAAIhlE,CAAA4hE,QAAJ,EACE1rE,CAAAtI,OAAA,CACE,QAAQ,EAAG,CAAE,MAAOoS,EAAAiiE,gBAAA,CAA0BuC,CAAAzkB,WAA1B,CAAT,CADb,CAEE,QAAQ,EAAG,CAAEykB,CAAAnkB,QAAA,EAAF,CAFb,CAxCJ,CAiGI8jB,EAAJ,EAIER,CAAA/qD,OAAA,EAOA,CAJA0hD,CAAA,CAASqJ,CAAT,CAAA,CAAsBztE,CAAtB,CAIA,CAAAytE,CAAAt1D,YAAA,CAAwB,UAAxB,CAXF,EAaEs1D,CAbF,CAagBj6E,CAAA,CAAOu5E,CAAA92E,UAAA,CAAyB,CAAA,CAAzB,CAAP,CAKhB23E,EAAA,EAGA5tE,EAAAs1B,iBAAA,CAAuBxrB,CAAAuiE,cAAvB,CAAgDuB,CAAhD,CA3K4D,CAkVxD,CAJD,CAlfkE,CAAlD,CA5sEzB,CA63FI3kE,GAAuB,CAAC,SAAD,CAAY,cAAZ,CAA4B,MAA5B,CAAoC,QAAQ,CAACq3C,CAAD,CAAU/yC,CAAV,CAAwBgB,CAAxB,CAA8B,CAAA,IAC/FwgE,EAAQ,KADuF,CAE/FC,EAAU,oBAEd,OAAO,CACLntD,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CAoDnCg3E,QAASA,EAAiB,CAACC,CAAD,CAAU,CAClC32E,CAAAo6B,KAAA,CAAau8C,CAAb,EAAwB,EAAxB,CADkC,CApDD,IAC/BC,EAAYl3E,CAAA+qC,MADmB,CAE/BosC,EAAUn3E,CAAAiyB,MAAA2S,KAAVuyC,EAA6B72E,CAAAN,KAAA,CAAaA,CAAAiyB,MAAA2S,KAAb,CAFE,CAG/BjsB,EAAS3Y,CAAA2Y,OAATA,EAAwB,CAHO,CAI/By+D,EAAQrvE,CAAA63C,MAAA,CAAYu3B,CAAZ,CAARC,EAAgC,EAJD,CAK/BC;AAAc,EALiB,CAM/Bp4C,EAAc3pB,CAAA2pB,YAAA,EANiB,CAO/BC,EAAY5pB,CAAA4pB,UAAA,EAPmB,CAQ/Bo4C,EAAmBr4C,CAAnBq4C,CAAiCJ,CAAjCI,CAA6C,GAA7CA,CAAmD3+D,CAAnD2+D,CAA4Dp4C,CAR7B,CAS/Bq4C,EAAelvE,EAAAvJ,KATgB,CAU/B04E,CAEJ37E,EAAA,CAAQmE,CAAR,CAAc,QAAQ,CAACqgC,CAAD,CAAao3C,CAAb,CAA4B,CAChD,IAAIC,EAAWX,CAAAt9D,KAAA,CAAag+D,CAAb,CACXC,EAAJ,GACMC,CACJ,EADeD,CAAA,CAAS,CAAT,CAAA,CAAc,GAAd,CAAoB,EACnC,EADyCn3E,CAAA,CAAUm3E,CAAA,CAAS,CAAT,CAAV,CACzC,CAAAN,CAAA,CAAMO,CAAN,CAAA,CAAiBr3E,CAAAN,KAAA,CAAaA,CAAAiyB,MAAA,CAAWwlD,CAAX,CAAb,CAFnB,CAFgD,CAAlD,CAOA57E,EAAA,CAAQu7E,CAAR,CAAe,QAAQ,CAAC/2C,CAAD,CAAarkC,CAAb,CAAkB,CACvCq7E,CAAA,CAAYr7E,CAAZ,CAAA,CAAmBsZ,CAAA,CAAa+qB,CAAAp8B,QAAA,CAAmB6yE,CAAnB,CAA0BQ,CAA1B,CAAb,CADoB,CAAzC,CAKAvvE,EAAAtI,OAAA,CAAay3E,CAAb,CAAwBU,QAA+B,CAACnyD,CAAD,CAAS,CAC9D,IAAIslB,EAAQqiB,UAAA,CAAW3nC,CAAX,CAAZ,CACIoyD,EAAazzE,KAAA,CAAM2mC,CAAN,CAEZ8sC,EAAL,EAAqB9sC,CAArB,GAA8BqsC,EAA9B,GAGErsC,CAHF,CAGUsd,CAAAyvB,UAAA,CAAkB/sC,CAAlB,CAA0BpyB,CAA1B,CAHV,CAQKoyB,EAAL,GAAeysC,CAAf,EAA+BK,CAA/B,EAA6Cn8E,CAAA,CAAS87E,CAAT,CAA7C,EAAoEpzE,KAAA,CAAMozE,CAAN,CAApE,GACED,CAAA,EAWA,CAVIQ,CAUJ,CAVgBV,CAAA,CAAYtsC,CAAZ,CAUhB,CATI3rC,CAAA,CAAY24E,CAAZ,CAAJ,EACgB,IAId,EAJItyD,CAIJ,EAHEnP,CAAA06B,MAAA,CAAW,oCAAX,CAAkDjG,CAAlD,CAA0D,OAA1D,CAAoEosC,CAApE,CAGF,CADAI,CACA,CADez4E,CACf,CAAAk4E,CAAA,EALF,EAOEO,CAPF,CAOiBxvE,CAAAtI,OAAA,CAAas4E,CAAb,CAAwBf,CAAxB,CAEjB,CAAAQ,CAAA,CAAYzsC,CAZd,CAZ8D,CAAhE,CAxBmC,CADhC,CAJ4F,CAA1E,CA73F3B,CAyvGI75B,GAAoB,CAAC,QAAD,CAAW,UAAX,CAAuB,QAAQ,CAACsF,CAAD,CAAS5C,CAAT,CAAmB,CAExE,IAAIokE,EAAiB/8E,CAAA,CAAO,UAAP,CAArB,CAEIg9E,EAAcA,QAAQ,CAAClwE,CAAD,CAAQrH,CAAR;AAAew3E,CAAf,CAAgCt7E,CAAhC,CAAuCu7E,CAAvC,CAAsDn8E,CAAtD,CAA2Do8E,CAA3D,CAAwE,CAEhGrwE,CAAA,CAAMmwE,CAAN,CAAA,CAAyBt7E,CACrBu7E,EAAJ,GAAmBpwE,CAAA,CAAMowE,CAAN,CAAnB,CAA0Cn8E,CAA1C,CACA+L,EAAAstD,OAAA,CAAe30D,CACfqH,EAAAswE,OAAA,CAA0B,CAA1B,GAAgB33E,CAChBqH,EAAAuwE,MAAA,CAAe53E,CAAf,GAA0B03E,CAA1B,CAAwC,CACxCrwE,EAAAwwE,QAAA,CAAgB,EAAExwE,CAAAswE,OAAF,EAAkBtwE,CAAAuwE,MAAlB,CAEhBvwE,EAAAywE,KAAA,CAAa,EAAEzwE,CAAA0wE,MAAF,CAA8B,CAA9B,IAAiB/3E,CAAjB,CAAuB,CAAvB,EATmF,CAsBlG,OAAO,CACLgsB,SAAU,GADL,CAELwM,aAAc,CAAA,CAFT,CAGL1L,WAAY,SAHP,CAILhB,SAAU,GAJL,CAKL6E,SAAU,CAAA,CALL,CAMLiG,MAAO,CAAA,CANF,CAOLtvB,QAAS0wE,QAAwB,CAACtrD,CAAD,CAAW6E,CAAX,CAAkB,CACjD,IAAIoO,EAAapO,CAAAhhB,SAAjB,CACI0nE,EAAqB59E,CAAA08B,cAAA,CAAuB,iBAAvB,CAA2C4I,CAA3C,CAAwD,GAAxD,CADzB,CAGIr+B,EAAQq+B,CAAAr+B,MAAA,CAAiB,4FAAjB,CAEZ,IAAKA,CAAAA,CAAL,CACE,KAAMg2E,EAAA,CAAe,MAAf,CACF33C,CADE,CAAN,CAIF,IAAIylC,EAAM9jE,CAAA,CAAM,CAAN,CAAV,CACI6jE,EAAM7jE,CAAA,CAAM,CAAN,CADV,CAEI42E,EAAU52E,CAAA,CAAM,CAAN,CAFd,CAGI62E,EAAa72E,CAAA,CAAM,CAAN,CAHjB,CAKAA,EAAQ8jE,CAAA9jE,MAAA,CAAU,wDAAV,CAER;GAAKA,CAAAA,CAAL,CACE,KAAMg2E,EAAA,CAAe,QAAf,CACFlS,CADE,CAAN,CAGF,IAAIoS,EAAkBl2E,CAAA,CAAM,CAAN,CAAlBk2E,EAA8Bl2E,CAAA,CAAM,CAAN,CAAlC,CACIm2E,EAAgBn2E,CAAA,CAAM,CAAN,CAEpB,IAAI42E,CAAJ,GAAiB,CAAA,4BAAA/4E,KAAA,CAAkC+4E,CAAlC,CAAjB,EACI,2FAAA/4E,KAAA,CAAiG+4E,CAAjG,CADJ,EAEE,KAAMZ,EAAA,CAAe,UAAf,CACJY,CADI,CAAN,CA3B+C,IA+B7CE,CA/B6C,CA+B3BC,CA/B2B,CA+BXC,CA/BW,CA+BOC,CA/BP,CAgC7CC,EAAe,CAACt9B,IAAKz7B,EAAN,CAEf04D,EAAJ,CACEC,CADF,CACqBtiE,CAAA,CAAOqiE,CAAP,CADrB,EAGEG,CAGA,CAHmBA,QAAQ,CAACh9E,CAAD,CAAMY,CAAN,CAAa,CACtC,MAAOujB,GAAA,CAAQvjB,CAAR,CAD+B,CAGxC,CAAAq8E,CAAA,CAAiBA,QAAQ,CAACj9E,CAAD,CAAM,CAC7B,MAAOA,EADsB,CANjC,CAWA,OAAOm9E,SAAqB,CAAClkD,CAAD,CAAS7H,CAAT,CAAmB6E,CAAnB,CAA0Bs+B,CAA1B,CAAgCr7B,CAAhC,CAA6C,CAEnE4jD,CAAJ,GACEC,CADF,CACmBA,QAAQ,CAAC/8E,CAAD,CAAMY,CAAN,CAAa8D,CAAb,CAAoB,CAEvCy3E,CAAJ,GAAmBe,CAAA,CAAaf,CAAb,CAAnB,CAAiDn8E,CAAjD,CACAk9E,EAAA,CAAahB,CAAb,CAAA,CAAgCt7E,CAChCs8E,EAAA7jB,OAAA,CAAsB30D,CACtB,OAAOo4E,EAAA,CAAiB7jD,CAAjB,CAAyBikD,CAAzB,CALoC,CAD/C,CAkBA,KAAIE,EAAez2E,CAAA,EAGnBsyB,EAAAoI,iBAAA,CAAwBwoC,CAAxB,CAA6BwT,QAAuB,CAAC5tD,CAAD,CAAa,CAAA,IAC3D/qB,CAD2D,CACpDlF,CADoD,CAE3D89E,EAAelsD,CAAA,CAAS,CAAT,CAF4C,CAI3DmsD,CAJ2D,CAO3DC,EAAe72E,CAAA,EAP4C,CAQ3D82E,CAR2D,CAS3Dz9E,CAT2D,CAStDY,CATsD,CAU3D88E,CAV2D,CAY3DC,CAZ2D,CAa3DlsE,CAb2D,CAc3DmsE,CAGAhB,EAAJ,GACE3jD,CAAA,CAAO2jD,CAAP,CADF,CACoBntD,CADpB,CAIA,IAAIvwB,EAAA,CAAYuwB,CAAZ,CAAJ,CACEkuD,CACA;AADiBluD,CACjB,CAAAouD,CAAA,CAAcd,CAAd,EAAgCC,CAFlC,KAOE,KAAS1F,CAAT,GAHAuG,EAGoBpuD,CAHNstD,CAGMttD,EAHYwtD,CAGZxtD,CADpBkuD,CACoBluD,CADH,EACGA,CAAAA,CAApB,CACMvvB,EAAAC,KAAA,CAAoBsvB,CAApB,CAAgC6nD,CAAhC,CAAJ,EAAsE,GAAtE,GAAgDA,CAAAnxE,OAAA,CAAe,CAAf,CAAhD,EACEw3E,CAAA14E,KAAA,CAAoBqyE,CAApB,CAKNmG,EAAA,CAAmBE,CAAAn+E,OACnBo+E,EAAA,CAAqBj+E,KAAJ,CAAU89E,CAAV,CAGjB,KAAK/4E,CAAL,CAAa,CAAb,CAAgBA,CAAhB,CAAwB+4E,CAAxB,CAA0C/4E,CAAA,EAA1C,CAIE,GAHA1E,CAGI,CAHGyvB,CAAD,GAAgBkuD,CAAhB,CAAkCj5E,CAAlC,CAA0Ci5E,CAAA,CAAej5E,CAAf,CAG5C,CAFJ9D,CAEI,CAFI6uB,CAAA,CAAWzvB,CAAX,CAEJ,CADJ09E,CACI,CADQG,CAAA,CAAY79E,CAAZ,CAAiBY,CAAjB,CAAwB8D,CAAxB,CACR,CAAA04E,CAAA,CAAaM,CAAb,CAAJ,CAEEjsE,CAGA,CAHQ2rE,CAAA,CAAaM,CAAb,CAGR,CAFA,OAAON,CAAA,CAAaM,CAAb,CAEP,CADAF,CAAA,CAAaE,CAAb,CACA,CAD0BjsE,CAC1B,CAAAmsE,CAAA,CAAel5E,CAAf,CAAA,CAAwB+M,CAL1B,KAMO,CAAA,GAAI+rE,CAAA,CAAaE,CAAb,CAAJ,CAKL,KAHA79E,EAAA,CAAQ+9E,CAAR,CAAwB,QAAQ,CAACnsE,CAAD,CAAQ,CAClCA,CAAJ,EAAaA,CAAA1F,MAAb,GAA0BqxE,CAAA,CAAa3rE,CAAA0c,GAAb,CAA1B,CAAmD1c,CAAnD,CADsC,CAAxC,CAGM,CAAAuqE,CAAA,CAAe,OAAf,CAEF33C,CAFE,CAEUq5C,CAFV,CAEqB98E,CAFrB,CAAN,CAKAg9E,CAAA,CAAel5E,CAAf,CAAA,CAAwB,CAACypB,GAAIuvD,CAAL,CAAgB3xE,MAAO/M,CAAvB,CAAkCkD,MAAOlD,CAAzC,CACxBw+E,EAAA,CAAaE,CAAb,CAAA,CAA0B,CAAA,CAXrB,CAgBT,IAASI,CAAT,GAAqBV,EAArB,CAAmC,CACjC3rE,CAAA,CAAQ2rE,CAAA,CAAaU,CAAb,CACR59C,EAAA,CAAmB7wB,EAAA,CAAcoC,CAAAvP,MAAd,CACnB0V,EAAAgpD,MAAA,CAAe1gC,CAAf,CACA,IAAIA,CAAA,CAAiB,CAAjB,CAAA5hB,WAAJ,CAGE,IAAK5Z,CAAW,CAAH,CAAG,CAAAlF,CAAA,CAAS0gC,CAAA1gC,OAAzB,CAAkDkF,CAAlD,CAA0DlF,CAA1D,CAAkEkF,CAAA,EAAlE,CACEw7B,CAAA,CAAiBx7B,CAAjB,CAAA,aAAA,CAAsC,CAAA,CAG1C+M,EAAA1F,MAAAwC,SAAA,EAXiC,CAenC,IAAK7J,CAAL,CAAa,CAAb,CAAgBA,CAAhB,CAAwB+4E,CAAxB,CAA0C/4E,CAAA,EAA1C,CAKE,GAJA1E,CAII+L,CAJG0jB,CAAD,GAAgBkuD,CAAhB,CAAkCj5E,CAAlC,CAA0Ci5E,CAAA,CAAej5E,CAAf,CAI5CqH,CAHJnL,CAGImL,CAHI0jB,CAAA,CAAWzvB,CAAX,CAGJ+L,CAFJ0F,CAEI1F,CAFI6xE,CAAA,CAAel5E,CAAf,CAEJqH,CAAA0F,CAAA1F,MAAJ,CAAiB,CAIfwxE,CAAA,CAAWD,CAGX,GACEC,EAAA;AAAWA,CAAA9tE,YADb,OAES8tE,CAFT,EAEqBA,CAAA,aAFrB,CAIkB9rE,EAnLrBvP,MAAA,CAAY,CAAZ,CAmLG,EAA4Bq7E,CAA5B,EAEE3lE,CAAA+oD,KAAA,CAActxD,EAAA,CAAcoC,CAAAvP,MAAd,CAAd,CAA0C,IAA1C,CAAgD3C,CAAA,CAAO+9E,CAAP,CAAhD,CAEFA,EAAA,CAA2B7rE,CAnL9BvP,MAAA,CAmL8BuP,CAnLlBvP,MAAA1C,OAAZ,CAAiC,CAAjC,CAoLGy8E,EAAA,CAAYxqE,CAAA1F,MAAZ,CAAyBrH,CAAzB,CAAgCw3E,CAAhC,CAAiDt7E,CAAjD,CAAwDu7E,CAAxD,CAAuEn8E,CAAvE,CAA4Ey9E,CAA5E,CAhBe,CAAjB,IAmBEvkD,EAAA,CAAY6kD,QAA2B,CAAC77E,CAAD,CAAQ6J,CAAR,CAAe,CACpD0F,CAAA1F,MAAA,CAAcA,CAEd,KAAIwD,EAAUotE,CAAA36E,UAAA,CAA6B,CAAA,CAA7B,CACdE,EAAA,CAAMA,CAAA1C,OAAA,EAAN,CAAA,CAAwB+P,CAGxBqI,EAAA8oD,MAAA,CAAex+D,CAAf,CAAsB,IAAtB,CAA4B3C,CAAA,CAAO+9E,CAAP,CAA5B,CACAA,EAAA,CAAe/tE,CAIfkC,EAAAvP,MAAA,CAAcA,CACds7E,EAAA,CAAa/rE,CAAA0c,GAAb,CAAA,CAAyB1c,CACzBwqE,EAAA,CAAYxqE,CAAA1F,MAAZ,CAAyBrH,CAAzB,CAAgCw3E,CAAhC,CAAiDt7E,CAAjD,CAAwDu7E,CAAxD,CAAuEn8E,CAAvE,CAA4Ey9E,CAA5E,CAdoD,CAAtD,CAkBJL,EAAA,CAAeI,CA1HgD,CAAjE,CAvBuE,CA7CxB,CAP9C,CA1BiE,CAAlD,CAzvGxB,CA4nHIpoE,GAAkB,CAAC,UAAD,CAAa,QAAQ,CAACwC,CAAD,CAAW,CACpD,MAAO,CACL8Y,SAAU,GADL,CAELwM,aAAc,CAAA,CAFT,CAGLtP,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CACnC+H,CAAAtI,OAAA,CAAaO,CAAAmR,OAAb,CAA0B6oE,QAA0B,CAACp9E,CAAD,CAAQ,CAK1DgX,CAAA,CAAShX,CAAA,CAAQ,aAAR,CAAwB,UAAjC,CAAA,CAA6C0D,CAA7C,CAvKY25E,SAuKZ,CAAqE,CACnEld,YAvKsBmd,iBAsK6C,CAArE,CAL0D,CAA5D,CADmC,CAHhC,CAD6C,CAAhC,CA5nHtB,CA6xHI5pE,GAAkB,CAAC,UAAD,CAAa,QAAQ,CAACsD,CAAD,CAAW,CACpD,MAAO,CACL8Y,SAAU,GADL;AAELwM,aAAc,CAAA,CAFT,CAGLtP,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CACnC+H,CAAAtI,OAAA,CAAaO,CAAAqQ,OAAb,CAA0B8pE,QAA0B,CAACv9E,CAAD,CAAQ,CAG1DgX,CAAA,CAAShX,CAAA,CAAQ,UAAR,CAAqB,aAA9B,CAAA,CAA6C0D,CAA7C,CAtUY25E,SAsUZ,CAAoE,CAClEld,YAtUsBmd,iBAqU4C,CAApE,CAH0D,CAA5D,CADmC,CAHhC,CAD6C,CAAhC,CA7xHtB,CA21HI5oE,GAAmBo9C,EAAA,CAAY,QAAQ,CAAC3mD,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CAChE+H,CAAAtI,OAAA,CAAaO,CAAAqR,QAAb,CAA2B+oE,QAA2B,CAACC,CAAD,CAAYC,CAAZ,CAAuB,CACvEA,CAAJ,EAAkBD,CAAlB,GAAgCC,CAAhC,EACEz+E,CAAA,CAAQy+E,CAAR,CAAmB,QAAQ,CAACh3E,CAAD,CAAMyL,CAAN,CAAa,CAAEzO,CAAAi4D,IAAA,CAAYxpD,CAAZ,CAAmB,EAAnB,CAAF,CAAxC,CAEEsrE,EAAJ,EAAe/5E,CAAAi4D,IAAA,CAAY8hB,CAAZ,CAJ4D,CAA7E,CAKG,CAAA,CALH,CADgE,CAA3C,CA31HvB,CAm+HI7oE,GAAoB,CAAC,UAAD,CAAa,QAAQ,CAACoC,CAAD,CAAW,CACtD,MAAO,CACL6Y,QAAS,UADJ,CAIL1iB,WAAY,CAAC,QAAD,CAAWwwE,QAA2B,EAAG,CACpD,IAAAC,MAAA,CAAa,EADuC,CAAzC,CAJP,CAOL5wD,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBu6E,CAAvB,CAA2C,CAAA,IAEnDE,EAAsB,EAF6B,CAGnDC,EAAmB,EAHgC,CAInDC,EAA0B,EAJyB,CAKnDC,EAAiB,EALkC,CAOnDC,EAAgBA,QAAQ,CAACp6E,CAAD,CAAQC,CAAR,CAAe,CACvC,MAAO,SAAQ,EAAG,CAAED,CAAAG,OAAA,CAAaF,CAAb,CAAoB,CAApB,CAAF,CADqB,CAI3CqH,EAAAtI,OAAA,CAVgBO,CAAAuR,SAUhB,EAViCvR,CAAA4J,GAUjC,CAAwBkxE,QAA4B,CAACl+E,CAAD,CAAQ,CAAA,IACtDH,CADsD;AACnDY,CACFZ,EAAA,CAAI,CAAT,KAAYY,CAAZ,CAAiBs9E,CAAAn/E,OAAjB,CAAiDiB,CAAjD,CAAqDY,CAArD,CAAyD,EAAEZ,CAA3D,CACEmX,CAAAsV,OAAA,CAAgByxD,CAAA,CAAwBl+E,CAAxB,CAAhB,CAIGA,EAAA,CAFLk+E,CAAAn/E,OAEK,CAF4B,CAEjC,KAAY6B,CAAZ,CAAiBu9E,CAAAp/E,OAAjB,CAAwCiB,CAAxC,CAA4CY,CAA5C,CAAgD,EAAEZ,CAAlD,CAAqD,CACnD,IAAIu8D,EAAW3tD,EAAA,CAAcqvE,CAAA,CAAiBj+E,CAAjB,CAAAyB,MAAd,CACf08E,EAAA,CAAen+E,CAAf,CAAA8N,SAAA,EAEAqvB,EADc+gD,CAAA,CAAwBl+E,CAAxB,CACdm9B,CAD2ChmB,CAAAgpD,MAAA,CAAe5D,CAAf,CAC3Cp/B,MAAA,CAAaihD,CAAA,CAAcF,CAAd,CAAuCl+E,CAAvC,CAAb,CAJmD,CAOrDi+E,CAAAl/E,OAAA,CAA0B,CAC1Bo/E,EAAAp/E,OAAA,CAAwB,CAExB,EAAKi/E,CAAL,CAA2BF,CAAAC,MAAA,CAAyB,GAAzB,CAA+B59E,CAA/B,CAA3B,EAAoE29E,CAAAC,MAAA,CAAyB,GAAzB,CAApE,GACE3+E,CAAA,CAAQ4+E,CAAR,CAA6B,QAAQ,CAACM,CAAD,CAAqB,CACxDA,CAAAvtD,WAAA,CAA8B,QAAQ,CAACwtD,CAAD,CAAcC,CAAd,CAA6B,CACjEL,CAAA35E,KAAA,CAAoBg6E,CAApB,CACA,KAAIC,EAASH,CAAAz6E,QACb06E,EAAA,CAAYA,CAAAx/E,OAAA,EAAZ,CAAA,CAAoCT,CAAA08B,cAAA,CAAuB,qBAAvB,CAGpCijD,EAAAz5E,KAAA,CAFYwM,CAAEvP,MAAO88E,CAATvtE,CAEZ,CACAmG,EAAA8oD,MAAA,CAAese,CAAf,CAA4BE,CAAAv8E,OAAA,EAA5B,CAA6Cu8E,CAA7C,CAPiE,CAAnE,CADwD,CAA1D,CAlBwD,CAA5D,CAXuD,CAPpD,CAD+C,CAAhC,CAn+HxB,CAyhIIxpE,GAAwBg9C,EAAA,CAAY,CACtClhC,WAAY,SAD0B,CAEtChB,SAAU,IAF4B,CAGtCC,QAAS,WAH6B,CAItCyM,aAAc,CAAA,CAJwB,CAKtCtP,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQzH,CAAR,CAAiBywB,CAAjB,CAAwBw/B,CAAxB,CAA8Br7B,CAA9B,CAA2C,CACvDq7B,CAAAiqB,MAAA,CAAW,GAAX,CAAiBzpD,CAAAtf,aAAjB,CAAA;AAAwC8+C,CAAAiqB,MAAA,CAAW,GAAX,CAAiBzpD,CAAAtf,aAAjB,CAAxC,EAAgF,EAChF8+C,EAAAiqB,MAAA,CAAW,GAAX,CAAiBzpD,CAAAtf,aAAjB,CAAAxQ,KAAA,CAA0C,CAAEusB,WAAY0H,CAAd,CAA2B50B,QAASA,CAApC,CAA1C,CAFuD,CALnB,CAAZ,CAzhI5B,CAoiIIsR,GAA2B88C,EAAA,CAAY,CACzClhC,WAAY,SAD6B,CAEzChB,SAAU,IAF+B,CAGzCC,QAAS,WAHgC,CAIzCyM,aAAc,CAAA,CAJ2B,CAKzCtP,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBuwD,CAAvB,CAA6Br7B,CAA7B,CAA0C,CACtDq7B,CAAAiqB,MAAA,CAAW,GAAX,CAAA,CAAmBjqB,CAAAiqB,MAAA,CAAW,GAAX,CAAnB,EAAsC,EACtCjqB,EAAAiqB,MAAA,CAAW,GAAX,CAAAv5E,KAAA,CAAqB,CAAEusB,WAAY0H,CAAd,CAA2B50B,QAASA,CAApC,CAArB,CAFsD,CALf,CAAZ,CApiI/B,CA6sII66E,GAAqBlgF,CAAA,CAAO,cAAP,CA7sIzB,CA8sII+W,GAAwB08C,EAAA,CAAY,CACtChiC,SAAU,KAD4B,CAEtC9C,KAAMA,QAAQ,CAACqL,CAAD,CAAS7H,CAAT,CAAmBC,CAAnB,CAA2BtjB,CAA3B,CAAuCmrB,CAAvC,CAAoD,CAE5D7H,CAAAtb,aAAJ,GAA4Bsb,CAAA4E,MAAAlgB,aAA5B,GAGEsb,CAAAtb,aAHF,CAGwB,EAHxB,CAaA,IAAKmjB,CAAAA,CAAL,CACE,KAAMimD,GAAA,CAAmB,QAAnB,CAILr2E,EAAA,CAAYsoB,CAAZ,CAJK,CAAN,CAUF8H,CAAA,CAlBAkmD,QAAkC,CAACl9E,CAAD,CAAQ,CACpCA,CAAA1C,OAAJ,GACE4xB,CAAAroB,MAAA,EACA,CAAAqoB,CAAAloB,OAAA,CAAgBhH,CAAhB,CAFF,CADwC,CAkB1C,CAAuC,IAAvC,CADemvB,CAAAtb,aACf;AADsCsb,CAAAguD,iBACtC,CA1BgE,CAF5B,CAAZ,CA9sI5B,CA+wIIzsE,GAAkB,CAAC,gBAAD,CAAmB,QAAQ,CAAC0I,CAAD,CAAiB,CAChE,MAAO,CACLoV,SAAU,GADL,CAEL2E,SAAU,CAAA,CAFL,CAGLrpB,QAASA,QAAQ,CAAC1H,CAAD,CAAUN,CAAV,CAAgB,CACd,kBAAjB,EAAIA,CAAAsb,KAAJ,EAIEhE,CAAAmJ,IAAA,CAHkBzgB,CAAAmqB,GAGlB,CAFW7pB,CAAA,CAAQ,CAAR,CAAAo6B,KAEX,CAL6B,CAH5B,CADyD,CAA5C,CA/wItB,CA8xII4gD,GAAwB,CAAExpB,cAAehzD,CAAjB,CAAuBozD,QAASpzD,CAAhC,CA9xI5B,CAizIIy8E,GACI,CAAC,UAAD,CAAa,QAAb,CAAuB,QAAvB,CAAiC,QAAQ,CAACnuD,CAAD,CAAW6H,CAAX,CAAmB5H,CAAnB,CAA2B,CAAA,IAEtErqB,EAAO,IAF+D,CAGtEw4E,EAAa,IAAIl7D,EAGrBtd,EAAAqzE,YAAA,CAAmBiF,EAQnBt4E,EAAA0yE,cAAA,CAAqBn6E,CAAA,CAAOR,CAAAwe,cAAA,CAAuB,QAAvB,CAAP,CACrBvW,EAAAy4E,oBAAA,CAA2BC,QAAQ,CAACp4E,CAAD,CAAM,CACnCq4E,CAAAA,CAAa,IAAbA,CAAoBx7D,EAAA,CAAQ7c,CAAR,CAApBq4E,CAAmC,IACvC34E,EAAA0yE,cAAApyE,IAAA,CAAuBq4E,CAAvB,CACAvuD,EAAAusC,QAAA,CAAiB32D,CAAA0yE,cAAjB,CACAtoD,EAAA9pB,IAAA,CAAaq4E,CAAb,CAJuC,CAOzC1mD,EAAAiB,IAAA,CAAW,UAAX,CAAuB,QAAQ,EAAG,CAEhClzB,CAAAy4E,oBAAA,CAA2B38E,CAFK,CAAlC,CAKAkE,EAAA44E,oBAAA;AAA2BC,QAAQ,EAAG,CAChC74E,CAAA0yE,cAAA/2E,OAAA,EAAJ,EAAiCqE,CAAA0yE,cAAAjrD,OAAA,EADG,CAOtCznB,EAAA8yE,UAAA,CAAiBgG,QAAwB,EAAG,CAC1C94E,CAAA44E,oBAAA,EACA,OAAOxuD,EAAA9pB,IAAA,EAFmC,CAQ5CN,EAAAwzE,WAAA,CAAkBuF,QAAyB,CAACn/E,CAAD,CAAQ,CAC7CoG,CAAAg5E,UAAA,CAAep/E,CAAf,CAAJ,EACEoG,CAAA44E,oBAAA,EAEA,CADAxuD,CAAA9pB,IAAA,CAAa1G,CAAb,CACA,CAAc,EAAd,GAAIA,CAAJ,EAAkBoG,CAAAwyE,YAAAz1E,KAAA,CAAsB,UAAtB,CAAkC,CAAA,CAAlC,CAHpB,EAKe,IAAb,EAAInD,CAAJ,EAAqBoG,CAAAwyE,YAArB,EACExyE,CAAA44E,oBAAA,EACA,CAAAxuD,CAAA9pB,IAAA,CAAa,EAAb,CAFF,EAIEN,CAAAy4E,oBAAA,CAAyB7+E,CAAzB,CAV6C,CAiBnDoG,EAAAi5E,UAAA,CAAiBC,QAAQ,CAACt/E,CAAD,CAAQ0D,CAAR,CAAiB,CAExC,GAp81BoB4yB,CAo81BpB,GAAI5yB,CAAA,CAAQ,CAAR,CAAA8E,SAAJ,CAAA,CAEA2F,EAAA,CAAwBnO,CAAxB,CAA+B,gBAA/B,CACc,GAAd,GAAIA,CAAJ,GACEoG,CAAAwyE,YADF,CACqBl1E,CADrB,CAGA,KAAIyqC,EAAQywC,CAAAzyE,IAAA,CAAenM,CAAf,CAARmuC,EAAiC,CACrCywC,EAAA/6D,IAAA,CAAe7jB,CAAf,CAAsBmuC,CAAtB,CAA8B,CAA9B,CACA/nC,EAAAqzE,YAAAnkB,QAAA,EACW5xD,EApFT,CAAc,CAAd,CAAAyG,aAAA,CAA8B,UAA9B,CAAJ;CAoFazG,CAnFX,CAAc,CAAd,CAAA04D,SADF,CAC8B,CAAA,CAD9B,CA2EE,CAFwC,CAe1Ch2D,EAAAm5E,aAAA,CAAoBC,QAAQ,CAACx/E,CAAD,CAAQ,CAClC,IAAImuC,EAAQywC,CAAAzyE,IAAA,CAAenM,CAAf,CACRmuC,EAAJ,GACgB,CAAd,GAAIA,CAAJ,EACEywC,CAAA/wD,OAAA,CAAkB7tB,CAAlB,CACA,CAAc,EAAd,GAAIA,CAAJ,GACEoG,CAAAwyE,YADF,CACqBx6E,CADrB,CAFF,EAMEwgF,CAAA/6D,IAAA,CAAe7jB,CAAf,CAAsBmuC,CAAtB,CAA8B,CAA9B,CAPJ,CAFkC,CAepC/nC,EAAAg5E,UAAA,CAAiBK,QAAQ,CAACz/E,CAAD,CAAQ,CAC/B,MAAO,CAAE,CAAA4+E,CAAAzyE,IAAA,CAAenM,CAAf,CADsB,CAKjCoG,EAAAiyE,eAAA,CAAsBqH,QAAQ,CAACC,CAAD,CAAcrG,CAAd,CAA6BsG,CAA7B,CAA0CC,CAA1C,CAA8DC,CAA9D,CAAiF,CAE7G,GAAID,CAAJ,CAAwB,CAEtB,IAAI/2D,CACJ82D,EAAA1/C,SAAA,CAAqB,OAArB,CAA8B6/C,QAAoC,CAACl3D,CAAD,CAAS,CACrEpmB,CAAA,CAAUqmB,CAAV,CAAJ,EACE1iB,CAAAm5E,aAAA,CAAkBz2D,CAAlB,CAEFA,EAAA,CAASD,CACTziB,EAAAi5E,UAAA,CAAex2D,CAAf,CAAuBywD,CAAvB,CALyE,CAA3E,CAHsB,CAAxB,IAUWwG,EAAJ,CAELH,CAAA98E,OAAA,CAAmBi9E,CAAnB,CAAsCE,QAA+B,CAACn3D,CAAD,CAASC,CAAT,CAAiB,CACpF82D,CAAAnjD,KAAA,CAAiB,OAAjB,CAA0B5T,CAA1B,CACIC,EAAJ,GAAeD,CAAf,EACEziB,CAAAm5E,aAAA,CAAkBz2D,CAAlB,CAEF1iB,EAAAi5E,UAAA,CAAex2D,CAAf,CAAuBywD,CAAvB,CALoF,CAAtF,CAFK,CAWLlzE,CAAAi5E,UAAA,CAAeO,CAAA5/E,MAAf,CAAkCs5E,CAAlC,CAGFA,EAAAtsE,GAAA,CAAiB,UAAjB,CAA6B,QAAQ,EAAG,CACtC5G,CAAAm5E,aAAA,CAAkBK,CAAA5/E,MAAlB,CACAoG,EAAAqzE,YAAAnkB,QAAA,EAFsC,CAAxC,CA1B6G,CA9FrC,CAApE,CAlzIR,CA6nJIpjD,GAAkBA,QAAQ,EAAG,CAE/B,MAAO,CACL4d,SAAU,GADL;AAELD,QAAS,CAAC,QAAD,CAAW,UAAX,CAFJ,CAGL1iB,WAAYwxE,EAHP,CAIL/uD,SAAU,CAJL,CAKL5C,KAAM,CACJwK,IAKJyoD,QAAsB,CAAC90E,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuBypE,CAAvB,CAA8B,CAGhD,IAAI4M,EAAc5M,CAAA,CAAM,CAAN,CAClB,IAAK4M,CAAL,CAAA,CAEA,IAAIR,EAAapM,CAAA,CAAM,CAAN,CAEjBoM,EAAAQ,YAAA,CAAyBA,CAKzB/1E,EAAAsJ,GAAA,CAAW,QAAX,CAAqB,QAAQ,EAAG,CAC9B7B,CAAAE,OAAA,CAAa,QAAQ,EAAG,CACtBouE,CAAAvkB,cAAA,CAA0B+jB,CAAAC,UAAA,EAA1B,CADsB,CAAxB,CAD8B,CAAhC,CAUA,IAAI91E,CAAA+4D,SAAJ,CAAmB,CAGjB8c,CAAAC,UAAA,CAAuBY,QAA0B,EAAG,CAClD,IAAIj2E,EAAQ,EACZ5E,EAAA,CAAQyE,CAAAL,KAAA,CAAa,QAAb,CAAR,CAAgC,QAAQ,CAACgP,CAAD,CAAS,CAC3CA,CAAA+pD,SAAJ,EACEv4D,CAAAQ,KAAA,CAAWgO,CAAArS,MAAX,CAF6C,CAAjD,CAKA,OAAO6D,EAP2C,CAWpDo1E,EAAAW,WAAA,CAAwBC,QAA2B,CAAC75E,CAAD,CAAQ,CACzD,IAAIuD,EAAQ,IAAImgB,EAAJ,CAAY1jB,CAAZ,CACZf,EAAA,CAAQyE,CAAAL,KAAA,CAAa,QAAb,CAAR,CAAgC,QAAQ,CAACgP,CAAD,CAAS,CAC/CA,CAAA+pD,SAAA,CAAkB35D,CAAA,CAAUc,CAAA4I,IAAA,CAAUkG,CAAArS,MAAV,CAAV,CAD6B,CAAjD,CAFyD,CAd1C,KAuBbkgF,CAvBa,CAuBHC,EAAc5pB,GAC5BprD,EAAAtI,OAAA,CAAau9E,QAA4B,EAAG,CACtCD,CAAJ,GAAoB1G,CAAAzkB,WAApB,EAA+CxvD,EAAA,CAAO06E,CAAP,CAAiBzG,CAAAzkB,WAAjB,CAA/C,GACEkrB,CACA;AADW56E,EAAA,CAAYm0E,CAAAzkB,WAAZ,CACX,CAAAykB,CAAAnkB,QAAA,EAFF,CAIA6qB,EAAA,CAAc1G,CAAAzkB,WAL4B,CAA5C,CAUAykB,EAAA9kB,SAAA,CAAuBglB,QAAQ,CAAC35E,CAAD,CAAQ,CACrC,MAAO,CAACA,CAAR,EAAkC,CAAlC,GAAiBA,CAAApB,OADoB,CAlCtB,CAnBnB,CAJgD,CAN5C,CAEJ64B,KAoEF4oD,QAAuB,CAACl1E,CAAD,CAAQzH,CAAR,CAAiBywB,CAAjB,CAAwB04C,CAAxB,CAA+B,CAEpD,IAAI4M,EAAc5M,CAAA,CAAM,CAAN,CAClB,IAAK4M,CAAL,CAAA,CAEA,IAAIR,EAAapM,CAAA,CAAM,CAAN,CAOjB4M,EAAAnkB,QAAA,CAAsBgrB,QAAQ,EAAG,CAC/BrH,CAAAW,WAAA,CAAsBH,CAAAzkB,WAAtB,CAD+B,CATjC,CAHoD,CAtEhD,CALD,CAFwB,CA7nJjC,CAguJI1iD,GAAkB,CAAC,cAAD,CAAiB,QAAQ,CAACoG,CAAD,CAAe,CAC5D,MAAO,CACLoX,SAAU,GADL,CAELF,SAAU,GAFL,CAGLxkB,QAASA,QAAQ,CAAC1H,CAAD,CAAUN,CAAV,CAAgB,CAC/B,GAAIX,CAAA,CAAUW,CAAApD,MAAV,CAAJ,CAEE,IAAI6/E,EAAqBnnE,CAAA,CAAatV,CAAApD,MAAb,CAAyB,CAAA,CAAzB,CAF3B,KAGO,CAGL,IAAI8/E,EAAoBpnE,CAAA,CAAahV,CAAAo6B,KAAA,EAAb,CAA6B,CAAA,CAA7B,CACnBgiD,EAAL,EACE18E,CAAAq5B,KAAA,CAAU,OAAV,CAAmB/4B,CAAAo6B,KAAA,EAAnB,CALG,CASP,MAAO,SAAQ,CAAC3yB,CAAD,CAAQzH,CAAR,CAAiBN,CAAjB,CAAuB,CAAA,IAIhCrB,EAAS2B,CAAA3B,OAAA,EAIb,EAHIk3E,CAGJ,CAHiBl3E,CAAAuJ,KAAA,CAFIi1E,mBAEJ,CAGjB,EAFMx+E,CAAAA,OAAA,EAAAuJ,KAAA,CAHei1E,mBAGf,CAEN,GACEtH,CAAAZ,eAAA,CAA0BltE,CAA1B;AAAiCzH,CAAjC,CAA0CN,CAA1C,CAAgDy8E,CAAhD,CAAoEC,CAApE,CATkC,CAbP,CAH5B,CADqD,CAAxC,CAhuJtB,CAiwJI1tE,GAAiB/P,EAAA,CAAQ,CAC3BytB,SAAU,GADiB,CAE3B2E,SAAU,CAAA,CAFiB,CAAR,CAjwJrB,CAg0JI1e,GAAoBA,QAAQ,EAAG,CACjC,MAAO,CACL+Z,SAAU,GADL,CAELD,QAAS,UAFJ,CAGL7C,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQqd,CAAR,CAAaplB,CAAb,CAAmBuwD,CAAnB,CAAyB,CAChCA,CAAL,GACAvwD,CAAA0S,SAMA,CANgB,CAAA,CAMhB,CAJA69C,CAAA2D,YAAAxhD,SAIA,CAJ4B0qE,QAAQ,CAACnS,CAAD,CAAaC,CAAb,CAAwB,CAC1D,MAAO,CAAClrE,CAAA0S,SAAR,EAAyB,CAAC69C,CAAAgB,SAAA,CAAc2Z,CAAd,CADgC,CAI5D,CAAAlrE,CAAA88B,SAAA,CAAc,UAAd,CAA0B,QAAQ,EAAG,CACnCyzB,CAAA6D,UAAA,EADmC,CAArC,CAPA,CADqC,CAHlC,CAD0B,CAh0JnC,CA85JI5hD,GAAmBA,QAAQ,EAAG,CAChC,MAAO,CACLka,SAAU,GADL,CAELD,QAAS,UAFJ,CAGL7C,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQqd,CAAR,CAAaplB,CAAb,CAAmBuwD,CAAnB,CAAyB,CACrC,GAAKA,CAAL,CAAA,CADqC,IAGjC5iC,CAHiC,CAGzB0vD,EAAar9E,CAAAyS,UAAb4qE,EAA+Br9E,CAAAuS,QAC3CvS,EAAA88B,SAAA,CAAc,SAAd,CAAyB,QAAQ,CAACgkB,CAAD,CAAQ,CACnCxlD,CAAA,CAASwlD,CAAT,CAAJ,EAAsC,CAAtC,CAAuBA,CAAAtlD,OAAvB,GACEslD,CADF,CACU,IAAIhjD,MAAJ,CAAW,GAAX,CAAiBgjD,CAAjB,CAAyB,GAAzB,CADV,CAIA,IAAIA,CAAJ,EAAcjhD,CAAAihD,CAAAjhD,KAAd,CACE,KAAM5E,EAAA,CAAO,WAAP,CAAA,CAAoB,UAApB;AACqDoiF,CADrD,CAEJv8B,CAFI,CAEGh8C,EAAA,CAAYsgB,CAAZ,CAFH,CAAN,CAKFuI,CAAA,CAASmzB,CAAT,EAAkB9lD,CAClBu1D,EAAA6D,UAAA,EAZuC,CAAzC,CAeA7D,EAAA2D,YAAA3hD,QAAA,CAA2B+qE,QAAQ,CAACrS,CAAD,CAAaC,CAAb,CAAwB,CAEzD,MAAO3a,EAAAgB,SAAA,CAAc2Z,CAAd,CAAP,EAAmC9rE,CAAA,CAAYuuB,CAAZ,CAAnC,EAA0DA,CAAA9tB,KAAA,CAAYqrE,CAAZ,CAFD,CAlB3D,CADqC,CAHlC,CADyB,CA95JlC,CA+/JIj4D,GAAqBA,QAAQ,EAAG,CAClC,MAAO,CACLyZ,SAAU,GADL,CAELD,QAAS,UAFJ,CAGL7C,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQqd,CAAR,CAAaplB,CAAb,CAAmBuwD,CAAnB,CAAyB,CACrC,GAAKA,CAAL,CAAA,CAEA,IAAIv9C,EAAa,EACjBhT,EAAA88B,SAAA,CAAc,WAAd,CAA2B,QAAQ,CAAClgC,CAAD,CAAQ,CACrC2gF,CAAAA,CAASh/E,EAAA,CAAM3B,CAAN,CACboW,EAAA,CAAY5O,KAAA,CAAMm5E,CAAN,CAAA,CAAiB,EAAjB,CAAqBA,CACjChtB,EAAA6D,UAAA,EAHyC,CAA3C,CAKA7D,EAAA2D,YAAAlhD,UAAA,CAA6BwqE,QAAQ,CAACvS,CAAD,CAAaC,CAAb,CAAwB,CAC3D,MAAoB,EAApB,CAAQl4D,CAAR,EAA0Bu9C,CAAAgB,SAAA,CAAc2Z,CAAd,CAA1B,EAAuDA,CAAA1vE,OAAvD,EAA2EwX,CADhB,CAR7D,CADqC,CAHlC,CAD2B,CA//JpC,CAmlKIF,GAAqBA,QAAQ,EAAG,CAClC,MAAO,CACL4Z,SAAU,GADL,CAELD,QAAS,UAFJ,CAGL7C,KAAMA,QAAQ,CAAC7hB,CAAD,CAAQqd,CAAR,CAAaplB,CAAb,CAAmBuwD,CAAnB,CAAyB,CACrC,GAAKA,CAAL,CAAA,CAEA,IAAI19C,EAAY,CAChB7S,EAAA88B,SAAA,CAAc,WAAd,CAA2B,QAAQ,CAAClgC,CAAD,CAAQ,CACzCiW,CAAA,CAAYtU,EAAA,CAAM3B,CAAN,CAAZ,EAA4B,CAC5B2zD,EAAA6D,UAAA,EAFyC,CAA3C,CAIA7D;CAAA2D,YAAArhD,UAAA,CAA6B4qE,QAAQ,CAACxS,CAAD,CAAaC,CAAb,CAAwB,CAC3D,MAAO3a,EAAAgB,SAAA,CAAc2Z,CAAd,CAAP,EAAmCA,CAAA1vE,OAAnC,EAAuDqX,CADI,CAP7D,CADqC,CAHlC,CAD2B,CAmBhC/X,EAAAuN,QAAA5B,UAAJ,CAEE+qC,OAAAE,IAAA,CAAY,gDAAZ,CAFF,EAQApoC,EAAA,EAmJE,CAjJFoE,EAAA,CAAmBrF,EAAnB,CAiJE,CA/IFA,EAAA1B,OAAA,CAAe,UAAf,CAA2B,EAA3B,CAA+B,CAAC,UAAD,CAAa,QAAQ,CAACc,CAAD,CAAW,CAE/Di2E,QAASA,EAAW,CAAC/zD,CAAD,CAAI,CACtBA,CAAA,EAAQ,EACR,KAAIltB,EAAIktB,CAAAhpB,QAAA,CAAU,GAAV,CACR,OAAc,EAAP,EAAClE,CAAD,CAAY,CAAZ,CAAgBktB,CAAAnuB,OAAhB,CAA2BiB,CAA3B,CAA+B,CAHhB,CAkBxBgL,CAAA7K,MAAA,CAAe,SAAf,CAA0B,CACxB,iBAAoB,CAClB,MAAS,CACP,IADO,CAEP,IAFO,CADS,CAKlB,IAAO,0DAAA,MAAA,CAAA,GAAA,CALW,CAclB,SAAY,CACV,eADU,CAEV,aAFU,CAdM,CAkBlB,KAAQ,CACN,IADM,CAEN,IAFM,CAlBU,CAsBlB,eAAkB,CAtBA,CAuBlB,MAAS,uFAAA,MAAA,CAAA,GAAA,CAvBS;AAqClB,SAAY,6BAAA,MAAA,CAAA,GAAA,CArCM,CA8ClB,WAAc,iDAAA,MAAA,CAAA,GAAA,CA9CI,CA4DlB,gBAAmB,uFAAA,MAAA,CAAA,GAAA,CA5DD,CA0ElB,aAAgB,CACd,CADc,CAEd,CAFc,CA1EE,CA8ElB,SAAY,iBA9EM,CA+ElB,SAAY,WA/EM,CAgFlB,OAAU,oBAhFQ,CAiFlB,WAAc,UAjFI,CAkFlB,WAAc,WAlFI,CAmFlB,QAAS,eAnFS,CAoFlB,UAAa,QApFK,CAqFlB,UAAa,QArFK,CADI,CAwFxB,eAAkB,CAChB,aAAgB,GADA,CAEhB,YAAe,GAFC,CAGhB,UAAa,GAHG;AAIhB,SAAY,CACV,CACE,MAAS,CADX,CAEE,OAAU,CAFZ,CAGE,QAAW,CAHb,CAIE,QAAW,CAJb,CAKE,OAAU,CALZ,CAME,OAAU,GANZ,CAOE,OAAU,EAPZ,CAQE,OAAU,EARZ,CASE,OAAU,EATZ,CADU,CAYV,CACE,MAAS,CADX,CAEE,OAAU,CAFZ,CAGE,QAAW,CAHb,CAIE,QAAW,CAJb,CAKE,OAAU,CALZ,CAME,OAAU,SANZ,CAOE,OAAU,EAPZ,CAQE,OAAU,QARZ,CASE,OAAU,EATZ,CAZU,CAJI,CAxFM,CAqHxB,GAAM,OArHkB,CAsHxB,SAAY,OAtHY,CAuHxB,UAAak7E,QAAQ,CAACnuD,CAAD,CAAIg0D,CAAJ,CAAmB,CAAG,IAAIlhF,EAAIktB,CAAJltB,CAAQ,CAAZ,CAlIvCmkC,EAkIyE+8C,CAhIzE3iF,EAAJ,GAAkB4lC,CAAlB,GACEA,CADF,CACMhI,IAAAixB,IAAA,CAAS6zB,CAAA,CA+H2D/zD,CA/H3D,CAAT,CAAyB,CAAzB,CADN,CAIWiP,KAAAglD,IAAA,CAAS,EAAT,CAAah9C,CAAb,CA4HmF,OAAS,EAAT,EAAInkC,CAAJ,EAAsB,CAAtB,EA1HnFmkC,CA0HmF,CA1ItDi9C,KA0IsD,CA1IFC,OA0IpD,CAvHhB,CAA1B,CApB+D,CAAhC,CAA/B,CA+IE,CAAAviF,CAAA,CAAOR,CAAP,CAAAi9D,MAAA,CAAuB,QAAQ,EAAG,CAChCxxD,EAAA,CAAYzL,CAAZ,CAAsB0L,EAAtB,CADgC,CAAlC,CA3JF,CArj7BuC,CAAtC,CAAD,CAot7BG3L,MApt7BH,CAot7BWC,QApt7BX,CAst7BC07D,EAAA37D,MAAAuN,QAAA01E,MAAA,EAAAtnB,cAAD,EAAyC37D,MAAAuN,QAAA/H,QAAA,CAAuBvF,QAAAijF,KAAvB,CAAArkB,QAAA,CAA8C,gRAA9C;",
+"sources":["angular.js"],
+"names":["window","document","undefined","minErr","isArrayLike","obj","isWindow","isArray","isString","jqLite","length","Object","isNumber","Array","item","forEach","iterator","context","key","isFunction","hasOwnProperty","call","isPrimitive","isBlankObject","forEachSorted","keys","sort","i","reverseParams","iteratorFn","value","nextUid","uid","baseExtend","dst","objs","deep","h","$$hashKey","ii","isObject","j","jj","src","isDate","Date","valueOf","isRegExp","RegExp","nodeName","cloneNode","isElement","clone","extend","slice","arguments","merge","toInt","str","parseInt","inherit","parent","extra","create","noop","identity","$","valueFn","hasCustomToString","toString","isUndefined","isDefined","getPrototypeOf","isScope","$evalAsync","$watch","isBoolean","isTypedArray","TYPED_ARRAY_REGEXP","test","node","prop","attr","find","makeMap","items","split","nodeName_","element","lowercase","arrayRemove","array","index","indexOf","splice","copy","source","destination","copyRecurse","push","copyElement","stackSource","stackDest","ngMinErr","needsRecurse","copyType","constructor","buffer","copied","ArrayBuffer","byteLength","set","Uint8Array","re","match","lastIndex","shallowCopy","charAt","equals","o1","o2","t1","t2","getTime","keySet","createMap","concat","array1","array2","bind","self","fn","curryArgs","startIndex","apply","toJsonReplacer","val","toJson","pretty","JSON","stringify","fromJson","json","parse","timezoneToOffset","timezone","fallback","replace","ALL_COLONS","requestedTimezoneOffset","isNaN","convertTimezoneToLocal","date","reverse","dateTimezoneOffset","getTimezoneOffset","timezoneOffset","setMinutes","getMinutes","minutes","startingTag","empty","e","elemHtml","append","html","nodeType","NODE_TYPE_TEXT","tryDecodeURIComponent","decodeURIComponent","parseKeyValue","keyValue","splitPoint","substring","toKeyValue","parts","arrayValue","encodeUriQuery","join","encodeUriSegment","pctEncodeSpaces","encodeURIComponent","getNgAttribute","ngAttr","ngAttrPrefixes","getAttribute","angularInit","bootstrap","appElement","module","config","prefix","name","hasAttribute","candidate","querySelector","strictDi","modules","defaultConfig","doBootstrap","injector","tag","unshift","$provide","debugInfoEnabled","$compileProvider","createInjector","invoke","bootstrapApply","scope","compile","$apply","data","NG_ENABLE_DEBUG_INFO","NG_DEFER_BOOTSTRAP","angular","resumeBootstrap","angular.resumeBootstrap","extraModules","resumeDeferredBootstrap","reloadWithDebugInfo","location","reload","getTestability","rootElement","get","snake_case","separator","SNAKE_CASE_REGEXP","letter","pos","toLowerCase","bindJQuery","originalCleanData","bindJQueryFired","jqName","jq","jQuery","on","JQLitePrototype","isolateScope","controller","inheritedData","cleanData","jQuery.cleanData","elems","events","elem","_data","$destroy","triggerHandler","JQLite","assertArg","arg","reason","assertArgFn","acceptArrayAnnotation","assertNotHasOwnProperty","getter","path","bindFnToScope","lastInstance","len","getBlockNodes","nodes","endNode","blockNodes","nextSibling","setupModuleLoader","ensure","factory","$injectorMinErr","$$minErr","requires","configFn","invokeLater","provider","method","insertMethod","queue","invokeQueue","moduleInstance","invokeLaterAndSetModuleName","recipeName","factoryFunction","$$moduleName","configBlocks","runBlocks","_invokeQueue","_configBlocks","_runBlocks","service","constant","decorator","animation","filter","directive","component","run","block","publishExternalAPI","version","uppercase","counter","csp","angularModule","ngModule","$$sanitizeUri","$$SanitizeUriProvider","$CompileProvider","a","htmlAnchorDirective","input","inputDirective","textarea","form","formDirective","script","scriptDirective","select","selectDirective","style","styleDirective","option","optionDirective","ngBind","ngBindDirective","ngBindHtml","ngBindHtmlDirective","ngBindTemplate","ngBindTemplateDirective","ngClass","ngClassDirective","ngClassEven","ngClassEvenDirective","ngClassOdd","ngClassOddDirective","ngCloak","ngCloakDirective","ngController","ngControllerDirective","ngForm","ngFormDirective","ngHide","ngHideDirective","ngIf","ngIfDirective","ngInclude","ngIncludeDirective","ngInit","ngInitDirective","ngNonBindable","ngNonBindableDirective","ngPluralize","ngPluralizeDirective","ngRepeat","ngRepeatDirective","ngShow","ngShowDirective","ngStyle","ngStyleDirective","ngSwitch","ngSwitchDirective","ngSwitchWhen","ngSwitchWhenDirective","ngSwitchDefault","ngSwitchDefaultDirective","ngOptions","ngOptionsDirective","ngTransclude","ngTranscludeDirective","ngModel","ngModelDirective","ngList","ngListDirective","ngChange","ngChangeDirective","pattern","patternDirective","ngPattern","required","requiredDirective","ngRequired","minlength","minlengthDirective","ngMinlength","maxlength","maxlengthDirective","ngMaxlength","ngValue","ngValueDirective","ngModelOptions","ngModelOptionsDirective","ngIncludeFillContentDirective","ngAttributeAliasDirectives","ngEventDirectives","$anchorScroll","$AnchorScrollProvider","$animate","$AnimateProvider","$animateCss","$CoreAnimateCssProvider","$$animateJs","$$CoreAnimateJsProvider","$$animateQueue","$$CoreAnimateQueueProvider","$$AnimateRunner","$$AnimateRunnerFactoryProvider","$$animateAsyncRun","$$AnimateAsyncRunFactoryProvider","$browser","$BrowserProvider","$cacheFactory","$CacheFactoryProvider","$controller","$ControllerProvider","$document","$DocumentProvider","$exceptionHandler","$ExceptionHandlerProvider","$filter","$FilterProvider","$$forceReflow","$$ForceReflowProvider","$interpolate","$InterpolateProvider","$interval","$IntervalProvider","$http","$HttpProvider","$httpParamSerializer","$HttpParamSerializerProvider","$httpParamSerializerJQLike","$HttpParamSerializerJQLikeProvider","$httpBackend","$HttpBackendProvider","$xhrFactory","$xhrFactoryProvider","$location","$LocationProvider","$log","$LogProvider","$parse","$ParseProvider","$rootScope","$RootScopeProvider","$q","$QProvider","$$q","$$QProvider","$sce","$SceProvider","$sceDelegate","$SceDelegateProvider","$sniffer","$SnifferProvider","$templateCache","$TemplateCacheProvider","$templateRequest","$TemplateRequestProvider","$$testability","$$TestabilityProvider","$timeout","$TimeoutProvider","$window","$WindowProvider","$$rAF","$$RAFProvider","$$jqLite","$$jqLiteProvider","$$HashMap","$$HashMapProvider","$$cookieReader","$$CookieReaderProvider","camelCase","SPECIAL_CHARS_REGEXP","_","offset","toUpperCase","MOZ_HACK_REGEXP","jqLiteAcceptsData","NODE_TYPE_ELEMENT","NODE_TYPE_DOCUMENT","jqLiteBuildFragment","tmp","fragment","createDocumentFragment","HTML_REGEXP","appendChild","createElement","TAG_NAME_REGEXP","exec","wrap","wrapMap","_default","innerHTML","XHTML_TAG_REGEXP","lastChild","childNodes","firstChild","textContent","createTextNode","jqLiteWrapNode","wrapper","parentNode","replaceChild","argIsString","trim","jqLiteMinErr","parsed","SINGLE_TAG_REGEXP","jqLiteAddNodes","jqLiteClone","jqLiteDealoc","onlyDescendants","jqLiteRemoveData","querySelectorAll","descendants","l","jqLiteOff","type","unsupported","expandoStore","jqLiteExpandoStore","handle","removeHandler","listenerFns","removeEventListener","MOUSE_EVENT_MAP","expandoId","ng339","jqCache","createIfNecessary","jqId","jqLiteData","isSimpleSetter","isSimpleGetter","massGetter","jqLiteHasClass","selector","jqLiteRemoveClass","cssClasses","setAttribute","cssClass","jqLiteAddClass","existingClasses","root","elements","jqLiteController","jqLiteInheritedData","documentElement","names","NODE_TYPE_DOCUMENT_FRAGMENT","host","jqLiteEmpty","removeChild","jqLiteRemove","keepData","jqLiteDocumentLoaded","action","win","readyState","setTimeout","getBooleanAttrName","booleanAttr","BOOLEAN_ATTR","BOOLEAN_ELEMENTS","createEventHandler","eventHandler","event","isDefaultPrevented","event.isDefaultPrevented","defaultPrevented","eventFns","eventFnsLength","immediatePropagationStopped","originalStopImmediatePropagation","stopImmediatePropagation","event.stopImmediatePropagation","stopPropagation","isImmediatePropagationStopped","event.isImmediatePropagationStopped","handlerWrapper","specialHandlerWrapper","defaultHandlerWrapper","handler","specialMouseHandlerWrapper","target","related","relatedTarget","jqLiteContains","$get","this.$get","hasClass","classes","addClass","removeClass","hashKey","nextUidFn","objType","HashMap","isolatedUid","this.nextUid","put","extractArgs","fnText","STRIP_COMMENTS","ARROW_ARG","FN_ARGS","anonFn","args","modulesToLoad","supportObject","delegate","provider_","providerInjector","instantiate","providerCache","providerSuffix","enforceReturnValue","enforcedReturnValue","result","instanceInjector","factoryFn","enforce","loadModules","moduleFn","runInvokeQueue","invokeArgs","loadedModules","message","stack","createInternalInjector","cache","getService","serviceName","caller","INSTANTIATING","err","shift","injectionArgs","locals","$inject","$$annotate","msie","Function","prototype","Type","ctor","annotate","has","$injector","instanceCache","decorFn","origProvider","orig$get","origProvider.$get","origInstance","$delegate","protoInstanceInjector","autoScrollingEnabled","disableAutoScrolling","this.disableAutoScrolling","getFirstAnchor","list","some","scrollTo","scrollIntoView","scroll","yOffset","getComputedStyle","position","getBoundingClientRect","bottom","elemTop","top","scrollBy","hash","elm","getElementById","getElementsByName","autoScrollWatch","autoScrollWatchAction","newVal","oldVal","mergeClasses","b","splitClasses","klass","prepareAnimateOptions","options","Browser","completeOutstandingRequest","outstandingRequestCount","outstandingRequestCallbacks","pop","error","cacheStateAndFireUrlChange","pendingLocation","cacheState","fireUrlChange","history","state","cachedState","lastCachedState","lastBrowserUrl","url","lastHistoryState","urlChangeListeners","listener","clearTimeout","pendingDeferIds","isMock","$$completeOutstandingRequest","$$incOutstandingRequestCount","self.$$incOutstandingRequestCount","notifyWhenNoOutstandingRequests","self.notifyWhenNoOutstandingRequests","callback","href","baseElement","self.url","sameState","sameBase","stripHash","substr","self.state","urlChangeInit","onUrlChange","self.onUrlChange","$$applicationDestroyed","self.$$applicationDestroyed","off","$$checkUrlChange","baseHref","self.baseHref","defer","self.defer","delay","timeoutId","cancel","self.defer.cancel","deferId","cacheFactory","cacheId","refresh","entry","freshEnd","staleEnd","n","link","p","nextEntry","prevEntry","caches","size","stats","id","capacity","Number","MAX_VALUE","lruHash","lruEntry","remove","removeAll","destroy","info","cacheFactory.info","cacheFactory.get","$$sanitizeUriProvider","parseIsolateBindings","directiveName","isController","LOCAL_REGEXP","bindings","definition","scopeName","$compileMinErr","mode","collection","optional","attrName","assertValidDirectiveName","hasDirectives","COMMENT_DIRECTIVE_REGEXP","CLASS_DIRECTIVE_REGEXP","ALL_OR_NOTHING_ATTRS","REQUIRE_PREFIX_REGEXP","EVENT_HANDLER_ATTR_REGEXP","this.directive","registerDirective","directiveFactory","Suffix","directives","priority","require","restrict","bindToController","controllerAs","identifierForController","$$bindings","$$isolateBindings","this.component","makeInjectable","tElement","tAttrs","$element","$attrs","template","templateUrl","transclude","aHrefSanitizationWhitelist","this.aHrefSanitizationWhitelist","regexp","imgSrcSanitizationWhitelist","this.imgSrcSanitizationWhitelist","this.debugInfoEnabled","enabled","setSpecialAttr","specialAttrHolder","attributes","attribute","removeNamedItem","setNamedItem","safeAddClass","className","$compileNodes","transcludeFn","maxPriority","ignoreDirective","previousCompileContext","NOT_EMPTY","domNode","nodeValue","compositeLinkFn","compileNodes","$$addScopeClass","namespace","publicLinkFn","cloneConnectFn","needsNewScope","$parent","$new","parentBoundTranscludeFn","transcludeControllers","futureParentElement","$$boundTransclude","$linkNode","wrapTemplate","controllerName","instance","$$addScopeInfo","nodeList","$rootElement","childLinkFn","childScope","childBoundTranscludeFn","stableNodeList","nodeLinkFnFound","linkFns","idx","nodeLinkFn","transcludeOnThisElement","createBoundTranscludeFn","templateOnThisElement","attrs","linkFnFound","Attributes","collectDirectives","applyDirectivesToNode","$$element","terminal","previousBoundTranscludeFn","boundTranscludeFn","transcludedScope","cloneFn","controllers","containingScope","$$transcluded","boundSlots","$$slots","slotName","attrsMap","$attr","addDirective","directiveNormalize","isNgAttr","nAttrs","attrStartName","attrEndName","ngAttrName","NG_ATTR_BINDING","PREFIX_REGEXP","multiElementMatch","MULTI_ELEMENT_DIR_RE","directiveIsMultiElement","nName","addAttrInterpolateDirective","animVal","addTextInterpolateDirective","NODE_TYPE_COMMENT","byPriority","groupScan","attrStart","attrEnd","depth","groupElementsLinkFnWrapper","linkFn","compilationGenerator","eager","compiled","compileNode","templateAttrs","jqCollection","originalReplaceDirective","preLinkFns","postLinkFns","addLinkFns","pre","post","newIsolateScopeDirective","$$isolateScope","cloneAndAnnotateFn","getControllers","elementControllers","inheritType","dataName","property","setupControllers","controllerDirectives","controllerKey","$scope","$transclude","controllerInstance","hasElementTranscludeDirective","linkNode","controllersBoundTransclude","cloneAttachFn","slotTranscludeFn","scopeToChild","removeScopeBindingWatches","controllerScope","newScopeDirective","isSlotFilled","transcludeFn.isSlotFilled","templateDirective","$$originalDirective","initializeDirectiveBindings","$on","controllerDirective","identifier","removeControllerBindingWatches","controllerResult","$onInit","invokeLinkFn","terminalPriority","nonTlbTranscludeDirective","hasTranscludeDirective","hasTemplate","$compileNode","$template","childTranscludeFn","didScanForMultipleTransclusion","mightHaveMultipleTransclusionError","directiveValue","$$start","$$end","assertNoDuplicate","$$tlb","scanningIndex","candidateDirective","createComment","replaceWith","replaceDirective","slots","contents","slotMap","filledSlots","elementSelector","filled","$$newScope","denormalizeTemplate","removeComments","templateNamespace","newTemplateAttrs","templateDirectives","unprocessedDirectives","markDirectiveScope","mergeTemplateAttributes","compileTemplateUrl","Math","max","newScope","tDirectives","startAttrName","endAttrName","multiElement","srcAttr","dstAttr","$set","linkQueue","afterTemplateNodeLinkFn","afterTemplateChildLinkFn","beforeTemplateCompileNode","origAsyncDirective","derivedSyncDirective","then","content","tempTemplateAttrs","beforeTemplateLinkNode","linkRootElement","$$destroyed","oldClasses","delayedNodeLinkFn","ignoreChildLinkFn","diff","what","previousDirective","wrapModuleNameIfDefined","moduleName","text","interpolateFn","textInterpolateCompileFn","templateNode","templateNodeParent","hasCompileParent","$$addBindingClass","textInterpolateLinkFn","$$addBindingInfo","expressions","interpolateFnWatchAction","getTrustedContext","attrNormalizedName","HTML","RESOURCE_URL","allOrNothing","trustedContext","attrInterpolatePreLinkFn","$$observers","newValue","$$inter","$$scope","oldValue","$updateClass","elementsToRemove","newNode","firstElementToRemove","removeCount","j2","hasData","annotation","removeWatchCollection","lastValue","parentGet","parentSet","compare","$observe","literal","assign","parentValueWatch","parentValue","$stateful","removeWatch","$watchCollection","parentValueWatchAction","newParentValue","removeWatches","SIMPLE_ATTR_NAME","attributesToCopy","$normalize","$addClass","classVal","$removeClass","newClasses","toAdd","tokenDifference","toRemove","writeAttr","booleanKey","aliasedKey","ALIASED_ATTR","observer","trimmedSrcset","srcPattern","rawUris","nbrUrisWith2parts","floor","innerIdx","lastTuple","removeAttr","listeners","startSymbol","endSymbol","binding","isolated","noTemplate","str1","str2","values","tokens1","tokens2","token","jqNodes","ident","CNTRL_REG","globals","register","this.register","allowGlobals","this.allowGlobals","addIdentifier","expression","later","$controllerMinErr","controllerPrototype","exception","cause","serializeValue","v","toISOString","ngParamSerializer","params","k","jQueryLikeParamSerializer","serialize","toSerialize","topLevel","defaultHttpResponseTransform","headers","tempData","JSON_PROTECTION_PREFIX","contentType","jsonStart","JSON_START","JSON_ENDS","parseHeaders","line","headerVal","headerKey","headersGetter","headersObj","transformData","status","fns","defaults","transformResponse","transformRequest","d","common","CONTENT_TYPE_APPLICATION_JSON","patch","xsrfCookieName","xsrfHeaderName","paramSerializer","useApplyAsync","this.useApplyAsync","useLegacyPromise","useLegacyPromiseExtensions","this.useLegacyPromiseExtensions","interceptorFactories","interceptors","requestConfig","response","resp","reject","executeHeaderFns","headerContent","processedHeaders","headerFn","header","mergeHeaders","defHeaders","reqHeaders","defHeaderName","lowercaseDefHeaderName","reqHeaderName","chain","serverRequest","reqData","withCredentials","sendReq","promise","when","reversedInterceptors","interceptor","request","requestError","responseError","thenFn","rejectFn","success","promise.success","promise.error","$httpMinErrLegacyFn","done","headersString","statusText","resolveHttpPromise","resolvePromise","$applyAsync","$$phase","deferred","resolve","resolvePromiseWithResult","removePendingReq","pendingRequests","cachedResp","buildUrl","defaultCache","xsrfValue","urlIsSameOrigin","timeout","responseType","serializedParams","interceptorFactory","createShortMethods","createShortMethodsWithData","createXhr","XMLHttpRequest","createHttpBackend","callbacks","$browserDefer","rawDocument","jsonpReq","callbackId","async","body","called","addEventListener","timeoutRequest","jsonpDone","xhr","abort","completeRequest","open","setRequestHeader","onload","xhr.onload","responseText","urlResolve","protocol","getAllResponseHeaders","onerror","onabort","send","this.startSymbol","this.endSymbol","escape","ch","unescapeText","escapedStartRegexp","escapedEndRegexp","constantWatchDelegate","objectEquality","constantInterp","unwatch","constantInterpolateWatch","mustHaveExpression","parseStringifyInterceptor","getTrusted","$interpolateMinErr","interr","unescapedText","exp","$$watchDelegate","endIndex","parseFns","textLength","expressionPositions","startSymbolLength","endSymbolLength","throwNoconcat","compute","interpolationFn","$watchGroup","interpolateFnWatcher","oldValues","currValue","$interpolate.startSymbol","$interpolate.endSymbol","interval","count","invokeApply","hasParams","iteration","setInterval","clearInterval","skipApply","$$intervalId","tick","notify","intervals","interval.cancel","encodePath","segments","parseAbsoluteUrl","absoluteUrl","locationObj","parsedUrl","$$protocol","$$host","hostname","$$port","port","DEFAULT_PORTS","parseAppUrl","relativeUrl","prefixed","$$path","pathname","$$search","search","$$hash","beginsWith","begin","whole","trimEmptyHash","LocationHtml5Url","appBase","appBaseNoFile","basePrefix","$$html5","$$parse","this.$$parse","pathUrl","$locationMinErr","$$compose","this.$$compose","$$url","$$absUrl","$$parseLinkUrl","this.$$parseLinkUrl","relHref","appUrl","prevAppUrl","rewrittenUrl","LocationHashbangUrl","hashPrefix","withoutBaseUrl","withoutHashUrl","windowsFilePathExp","base","firstPathSegmentMatch","LocationHashbangInHtml5Url","locationGetter","locationGetterSetter","preprocess","html5Mode","requireBase","rewriteLinks","this.hashPrefix","this.html5Mode","setBrowserUrlWithFallback","oldUrl","oldState","$$state","afterLocationChange","$broadcast","absUrl","LocationMode","initialUrl","lastIndexOf","IGNORE_URI_REGEXP","ctrlKey","metaKey","shiftKey","which","button","absHref","preventDefault","initializing","newUrl","newState","$digest","$locationWatch","currentReplace","$$replace","urlOrStateChanged","debug","debugEnabled","this.debugEnabled","flag","formatError","Error","sourceURL","consoleLog","console","logFn","log","hasApply","arg1","arg2","warn","ensureSafeMemberName","fullExpression","$parseMinErr","getStringValue","ensureSafeObject","children","ensureSafeFunction","CALL","APPLY","BIND","ensureSafeAssignContext","ifDefined","plusFn","r","findConstantAndWatchExpressions","ast","allConstants","argsToWatch","AST","Program","expr","Literal","toWatch","UnaryExpression","argument","BinaryExpression","left","right","LogicalExpression","ConditionalExpression","alternate","consequent","Identifier","MemberExpression","object","computed","CallExpression","callee","AssignmentExpression","ArrayExpression","ObjectExpression","properties","ThisExpression","LocalsExpression","getInputs","lastExpression","isAssignable","assignableAST","NGValueParameter","operator","isLiteral","ASTCompiler","astBuilder","ASTInterpreter","isPossiblyDangerousMemberName","getValueOf","objectValueOf","cacheDefault","cacheExpensive","interceptorFn","expensiveChecks","parsedExpression","oneTime","cacheKey","runningChecksEnabled","parseOptions","$parseOptionsExpensive","$parseOptions","lexer","Lexer","parser","Parser","oneTimeLiteralWatchDelegate","oneTimeWatchDelegate","inputs","inputsWatchDelegate","expensiveChecksInterceptor","addInterceptor","expensiveCheckFn","expensiveCheckOldValue","expressionInputDirtyCheck","oldValueOfValue","prettyPrintExpression","inputExpressions","lastResult","oldInputValueOf","expressionInputWatch","newInputValue","oldInputValueOfValues","oldInputValues","expressionInputsWatch","changed","oneTimeWatch","oneTimeListener","old","$$postDigest","isAllDefined","allDefined","constantWatch","watchDelegate","useInputs","regularInterceptedExpression","oneTimeInterceptedExpression","noUnsafeEval","$$runningExpensiveChecks","$parse.$$runningExpensiveChecks","qFactory","nextTick","exceptionHandler","Promise","simpleBind","scheduleProcessQueue","processScheduled","pending","Deferred","$qMinErr","TypeError","onFulfilled","onRejected","progressBack","catch","finally","handleCallback","$$reject","$$resolve","that","rejectPromise","progress","makePromise","resolved","isResolved","callbackOutput","errback","$Q","resolver","resolveFn","all","promises","results","requestAnimationFrame","webkitRequestAnimationFrame","cancelAnimationFrame","webkitCancelAnimationFrame","webkitCancelRequestAnimationFrame","rafSupported","raf","timer","supported","createChildScopeClass","ChildScope","$$watchers","$$nextSibling","$$childHead","$$childTail","$$listeners","$$listenerCount","$$watchersCount","$id","$$ChildScope","TTL","$rootScopeMinErr","lastDirtyWatch","applyAsyncId","digestTtl","this.digestTtl","destroyChildScope","$event","currentScope","cleanUpScope","$$prevSibling","$root","Scope","beginPhase","phase","incrementWatchersCount","current","decrementListenerCount","initWatchVal","flushApplyAsync","applyAsyncQueue","scheduleApplyAsync","isolate","child","watchExp","watcher","last","eq","deregisterWatch","watchExpressions","watchGroupAction","changeReactionScheduled","firstRun","newValues","deregisterFns","shouldCall","deregisterWatchGroup","unwatchFn","watchGroupSubAction","$watchCollectionInterceptor","_value","bothNaN","newItem","oldItem","internalArray","oldLength","changeDetected","newLength","internalObject","veryOldValue","trackVeryOldValue","changeDetector","initRun","$watchCollectionAction","watch","watchers","dirty","ttl","watchLog","logIdx","asyncTask","asyncQueue","$eval","msg","next","postDigestQueue","eventName","this.$watchGroup","$applyAsyncExpression","namedListeners","indexOfListener","$emit","targetScope","listenerArgs","$$asyncQueue","$$postDigestQueue","$$applyAsyncQueue","sanitizeUri","uri","isImage","regex","normalizedVal","adjustMatcher","matcher","$sceMinErr","escapeForRegexp","adjustMatchers","matchers","adjustedMatchers","SCE_CONTEXTS","resourceUrlWhitelist","resourceUrlBlacklist","this.resourceUrlWhitelist","this.resourceUrlBlacklist","matchUrl","generateHolderType","Base","holderType","trustedValue","$$unwrapTrustedValue","this.$$unwrapTrustedValue","holderType.prototype.valueOf","holderType.prototype.toString","htmlSanitizer","trustedValueHolderBase","byType","CSS","URL","JS","trustAs","Constructor","maybeTrusted","allowed","this.enabled","sce","isEnabled","sce.isEnabled","sce.getTrusted","parseAs","sce.parseAs","enumValue","lName","eventSupport","android","userAgent","navigator","boxee","vendorPrefix","vendorRegex","bodyStyle","transitions","animations","webkitTransition","webkitAnimation","pushState","hasEvent","divElm","httpOptions","this.httpOptions","handleRequestFn","tpl","ignoreRequestError","totalPendingRequests","getTrustedResourceUrl","transformer","handleError","testability","testability.findBindings","opt_exactMatch","getElementsByClassName","matches","dataBinding","bindingName","testability.findModels","prefixes","attributeEquals","testability.getLocation","testability.setLocation","testability.whenStable","deferreds","$$timeoutId","timeout.cancel","urlParsingNode","requestUrl","originUrl","$$CookieReader","safeDecodeURIComponent","lastCookies","lastCookieString","cookieArray","cookie","currentCookieString","filters","suffix","currencyFilter","dateFilter","filterFilter","jsonFilter","limitToFilter","lowercaseFilter","numberFilter","orderByFilter","uppercaseFilter","comparator","matchAgainstAnyProp","getTypeForFilter","expressionType","predicateFn","createPredicateFn","shouldMatchPrimitives","actual","expected","deepCompare","dontMatchWholeObject","actualType","expectedType","expectedVal","matchAnyProperty","actualVal","$locale","formats","NUMBER_FORMATS","amount","currencySymbol","fractionSize","CURRENCY_SYM","PATTERNS","maxFrac","formatNumber","GROUP_SEP","DECIMAL_SEP","number","numStr","exponent","digits","numberOfIntegerDigits","zeros","ZERO_CHAR","MAX_DIGITS","roundNumber","parsedNumber","minFrac","fractionLen","min","roundAt","digit","carry","reduceRight","groupSep","decimalSep","isInfinity","isFinite","isZero","abs","formattedText","integerLen","decimals","reduce","groups","lgSize","gSize","negPre","negSuf","posPre","posSuf","padNumber","num","neg","dateGetter","dateStrGetter","shortForm","getFirstThursdayOfYear","year","dayOfWeekOnFirst","getDay","weekGetter","firstThurs","getFullYear","thisThurs","getMonth","getDate","round","eraGetter","ERAS","jsonStringToDate","string","R_ISO8601_STR","tzHour","tzMin","dateSetter","setUTCFullYear","setFullYear","timeSetter","setUTCHours","setHours","m","s","ms","parseFloat","format","DATETIME_FORMATS","NUMBER_STRING","DATE_FORMATS_SPLIT","DATE_FORMATS","spacing","limit","Infinity","processPredicates","sortPredicate","reverseOrder","map","predicate","descending","predicates","compareValues","getComparisonObject","predicateValues","doComparison","v1","v2","ngDirective","FormController","controls","$error","$$success","$pending","$name","$dirty","$pristine","$valid","$invalid","$submitted","$$parentForm","nullFormCtrl","$rollbackViewValue","form.$rollbackViewValue","control","$commitViewValue","form.$commitViewValue","$addControl","form.$addControl","$$renameControl","form.$$renameControl","newName","oldName","$removeControl","form.$removeControl","$setValidity","addSetValidityMethod","ctrl","unset","$setDirty","form.$setDirty","PRISTINE_CLASS","DIRTY_CLASS","$setPristine","form.$setPristine","setClass","SUBMITTED_CLASS","$setUntouched","form.$setUntouched","$setSubmitted","form.$setSubmitted","stringBasedInputType","$formatters","$isEmpty","baseInputType","composing","ev","ngTrim","$viewValue","$$hasNativeValidators","$setViewValue","deferListener","origValue","keyCode","$render","ctrl.$render","createDateParser","mapping","iso","ISO_DATE_REGEXP","yyyy","MM","dd","HH","getHours","mm","ss","getSeconds","sss","getMilliseconds","part","NaN","createDateInputType","parseDate","dynamicDateInputType","isValidDate","parseObservedDateValue","badInputChecker","$options","previousDate","$$parserName","$parsers","parsedDate","ngModelMinErr","ngMin","minVal","$validators","ctrl.$validators.min","$validate","ngMax","maxVal","ctrl.$validators.max","validity","VALIDITY_STATE_PROPERTY","badInput","typeMismatch","parseConstantExpr","parseFn","classDirective","arrayDifference","arrayClasses","digestClassCounts","classCounts","classesToUpdate","ngClassWatchAction","$index","old$index","mod","cachedToggleClass","switchValue","classCache","toggleValidationCss","validationErrorKey","isValid","VALID_CLASS","INVALID_CLASS","setValidity","isObjectEmpty","PENDING_CLASS","combinedState","REGEX_STRING_REGEXP","documentMode","rules","ngCspElement","ngCspAttribute","noInlineStyle","name_","el","full","major","minor","dot","codeName","expando","JQLite._data","mouseleave","mouseenter","optgroup","tbody","tfoot","colgroup","caption","thead","th","td","Node","contains","compareDocumentPosition","ready","trigger","fired","removeData","jqLiteHasData","jqLiteCleanData","removeAttribute","css","NODE_TYPE_ATTRIBUTE","lowercasedName","specified","getNamedItem","ret","getText","$dv","multiple","selected","nodeCount","jqLiteOn","types","addHandler","noEventListener","one","onFn","replaceNode","insertBefore","contentDocument","prepend","wrapNode","detach","after","newElement","toggleClass","condition","classCondition","nextElementSibling","getElementsByTagName","extraParameters","dummyEvent","handlerArgs","eventFnsCopy","arg3","unbind","FN_ARG_SPLIT","FN_ARG","argDecl","underscore","$animateMinErr","postDigestElements","updateData","handleCSSClassChanges","existing","pin","domOperation","from","to","classesAdded","add","classesRemoved","runner","complete","$$registeredAnimations","classNameFilter","this.classNameFilter","$$classNameFilter","reservedRegex","NG_ANIMATE_CLASSNAME","domInsert","parentElement","afterElement","afterNode","ELEMENT_NODE","previousElementSibling","end","enter","move","leave","addclass","animate","tempClasses","waitForTick","waitQueue","passed","AnimateRunner","setHost","rafTick","_doneCallbacks","_tick","this._tick","doc","hidden","_state","AnimateRunner.chain","AnimateRunner.all","runners","onProgress","DONE_COMPLETE_STATE","getPromise","resolveHandler","rejectHandler","pause","resume","_resolve","INITIAL_STATE","DONE_PENDING_STATE","initialOptions","closed","$$prepared","cleanupStyles","start","offsetWidth","APPLICATION_JSON","$httpMinErr","$interpolateMinErr.throwNoconcat","$interpolateMinErr.interr","PATH_MATCH","locationPrototype","paramValue","Location","Location.prototype.state","OPERATORS","ESCAPE","lex","tokens","readString","peek","readNumber","isIdent","readIdent","is","isWhitespace","ch2","ch3","op2","op3","op1","throwError","chars","isExpOperator","colStr","peekCh","quote","rawString","hex","String","fromCharCode","rep","ExpressionStatement","Property","program","expressionStatement","expect","filterChain","assignment","ternary","logicalOR","consume","logicalAND","equality","relational","additive","multiplicative","unary","primary","arrayDeclaration","constants","parseArguments","baseExpression","peekToken","kind","e1","e2","e3","e4","peekAhead","t","nextId","vars","own","assignable","stage","computing","recurse","return_","generateFunction","fnKey","intoId","watchId","fnString","USE","STRICT","filterPrefix","watchFns","varsPrefix","section","nameId","recursionFn","skipWatchIdCheck","if_","lazyAssign","computedMember","lazyRecurse","plus","not","getHasOwnProperty","nonComputedMember","addEnsureSafeObject","notNull","addEnsureSafeAssignContext","addEnsureSafeMemberName","addEnsureSafeFunction","member","filterName","defaultValue","stringEscapeRegex","stringEscapeFn","c","charCodeAt","skip","init","fn.assign","rhs","lhs","unary+","unary-","unary!","binary+","binary-","binary*","binary/","binary%","binary===","binary!==","binary==","binary!=","binary<","binary>","binary<=","binary>=","binary&&","binary||","ternary?:","astCompiler","yy","y","MMMM","MMM","M","H","hh","EEEE","EEE","ampmGetter","AMPMS","Z","timeZoneGetter","zone","paddedZone","ww","w","G","GG","GGG","GGGG","longEraGetter","ERANAMES","xlinkHref","propName","defaultLinkFn","normalized","ngBooleanAttrWatchAction","htmlAttr","ngAttrAliasWatchAction","nullFormRenameControl","formDirectiveFactory","isNgForm","getSetter","ngFormCompile","formElement","nameAttr","ngFormPreLink","ctrls","handleFormSubmission","setter","URL_REGEXP","EMAIL_REGEXP","NUMBER_REGEXP","DATE_REGEXP","DATETIMELOCAL_REGEXP","WEEK_REGEXP","MONTH_REGEXP","TIME_REGEXP","inputType","textInputType","weekParser","isoWeek","existingDate","week","hours","seconds","milliseconds","addDays","numberInputType","urlInputType","ctrl.$validators.url","modelValue","viewValue","emailInputType","email","ctrl.$validators.email","radioInputType","checked","checkboxInputType","trueValue","ngTrueValue","falseValue","ngFalseValue","ctrl.$isEmpty","CONSTANT_VALUE_REGEXP","tplAttr","ngValueConstantLink","ngValueLink","valueWatchAction","$compile","ngBindCompile","templateElement","ngBindLink","ngBindWatchAction","ngBindTemplateCompile","ngBindTemplateLink","ngBindHtmlCompile","ngBindHtmlGetter","ngBindHtmlWatch","ngBindHtmlLink","ngBindHtmlWatchAction","getTrustedHtml","$viewChangeListeners","forceAsyncEvents","ngEventHandler","previousElements","ngIfWatchAction","srcExp","onloadExp","autoScrollExp","autoscroll","changeCounter","previousElement","currentElement","cleanupLastIncludeContent","ngIncludeWatchAction","afterAnimation","thisChangeId","namespaceAdaptedClone","trimValues","NgModelController","$modelValue","$$rawModelValue","$asyncValidators","$untouched","$touched","parsedNgModel","parsedNgModelAssign","ngModelGet","ngModelSet","pendingDebounce","parserValid","$$setOptions","this.$$setOptions","getterSetter","invokeModelGetter","invokeModelSetter","$$$p","this.$isEmpty","$$updateEmptyClasses","this.$$updateEmptyClasses","NOT_EMPTY_CLASS","EMPTY_CLASS","currentValidationRunId","this.$setPristine","this.$setDirty","this.$setUntouched","UNTOUCHED_CLASS","TOUCHED_CLASS","$setTouched","this.$setTouched","this.$rollbackViewValue","$$lastCommittedViewValue","this.$validate","prevValid","prevModelValue","allowInvalid","$$runValidators","allValid","$$writeModelToScope","this.$$runValidators","doneCallback","processSyncValidators","syncValidatorsValid","validator","processAsyncValidators","validatorPromises","validationDone","localValidationRunId","processParseErrors","errorKey","this.$commitViewValue","$$parseAndValidate","this.$$parseAndValidate","this.$$writeModelToScope","this.$setViewValue","updateOnDefault","$$debounceViewValueCommit","this.$$debounceViewValueCommit","debounceDelay","debounce","ngModelWatch","formatters","ngModelCompile","ngModelPreLink","modelCtrl","formCtrl","ngModelPostLink","updateOn","DEFAULT_REGEXP","ngOptionsMinErr","NG_OPTIONS_REGEXP","parseOptionsExpression","optionsExp","selectElement","Option","selectValue","label","group","disabled","getOptionValuesKeys","optionValues","optionValuesKeys","keyName","itemKey","valueName","selectAs","trackBy","viewValueFn","trackByFn","getTrackByValueFn","getHashOfValue","getTrackByValue","getLocals","displayFn","groupByFn","disableWhenFn","valuesFn","getWatchables","watchedArray","optionValuesLength","disableWhen","getOptions","optionItems","selectValueMap","optionItem","getOptionFromViewValue","getViewValueFromOption","optionTemplate","optGroupTemplate","ngOptionsPreLink","registerOption","ngOptionsPostLink","updateOptionElement","addOrReuseElement","removeExcessElements","skipEmptyAndUnknownOptions","emptyOption_","emptyOption","unknownOption_","unknownOption","updateOptions","previousValue","selectCtrl","readValue","groupMap","providedEmptyOption","updateOption","optionElement","groupElement","currentOptionElement","ngModelCtrl","nextValue","ngModelCtrl.$isEmpty","writeValue","selectCtrl.writeValue","selectCtrl.readValue","selectedValues","selections","selectedOption","BRACE","IS_WHEN","updateElementText","newText","numberExp","whenExp","whens","whensExpFns","braceReplacement","watchRemover","lastCount","attributeName","tmpMatch","whenKey","ngPluralizeWatchAction","countIsNaN","pluralCat","whenExpFn","ngRepeatMinErr","updateScope","valueIdentifier","keyIdentifier","arrayLength","$first","$last","$middle","$odd","$even","ngRepeatCompile","ngRepeatEndComment","aliasAs","trackByExp","trackByExpGetter","trackByIdExpFn","trackByIdArrayFn","trackByIdObjFn","hashFnLocals","ngRepeatLink","lastBlockMap","ngRepeatAction","previousNode","nextNode","nextBlockMap","collectionLength","trackById","collectionKeys","nextBlockOrder","trackByIdFn","blockKey","ngRepeatTransclude","ngShowWatchAction","NG_HIDE_CLASS","NG_HIDE_IN_PROGRESS_CLASS","ngHideWatchAction","ngStyleWatchAction","newStyles","oldStyles","ngSwitchController","cases","selectedTranscludes","selectedElements","previousLeaveAnimations","selectedScopes","spliceFactory","ngSwitchWatchAction","selectedTransclude","caseElement","selectedScope","anchor","ngTranscludeMinErr","ngTranscludeCloneAttachFn","ngTranscludeSlot","noopNgModelController","SelectController","optionsMap","renderUnknownOption","self.renderUnknownOption","unknownVal","removeUnknownOption","self.removeUnknownOption","self.readValue","self.writeValue","hasOption","addOption","self.addOption","removeOption","self.removeOption","self.hasOption","self.registerOption","optionScope","optionAttrs","interpolateValueFn","interpolateTextFn","valueAttributeObserveAction","interpolateWatchAction","selectPreLink","lastView","lastViewRef","selectMultipleWatch","selectPostLink","ngModelCtrl.$render","selectCtrlName","ctrl.$validators.required","patternExp","ctrl.$validators.pattern","intVal","ctrl.$validators.maxlength","ctrl.$validators.minlength","getDecimals","opt_precision","pow","ONE","OTHER","$$csp","head"]
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/errors.json b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/errors.json
new file mode 100644
index 00000000..abb6b943
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/errors.json
@@ -0,0 +1 @@
+{"id":"ng","generated":"Fri Feb 05 2016 03:40:34 GMT-0800 (PST)","errors":{"ng":{"areq":"Argument '{0}' is {1}","cpta":"Can't copy! TypedArray destination cannot be mutated.","test":"no injector found for element argument to getTestability","cpws":"Can't copy! Making copies of Window or Scope instances is not supported.","btstrpd":"App Already Bootstrapped with this Element '{0}'","cpi":"Can't copy! Source and destination are identical.","badname":"hasOwnProperty is not a valid {0} name"},"$http":{"legacy":"The method `{0}` on the promise returned from `$http` has been disabled.","badreq":"Http request configuration url must be a string. Received: {0}"},"ngRepeat":{"badident":"alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.","iexp":"Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.","dupes":"Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}","iidexp":"'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'."},"$sce":{"imatcher":"Matchers may only be \"self\", string patterns or RegExp objects","icontext":"Attempted to trust a value in invalid context. Context: {0}; Value: {1}","iwcard":"Illegal sequence *** in string matcher. String: {0}","insecurl":"Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}","iequirks":"Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks mode. You can fix this by adding the text <!doctype html> to the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more information.","unsafe":"Attempting to use an unsafe value in a safe context.","itype":"Attempted to trust a non-string value in a content requiring a string: Context: {0}"},"ngPattern":{"noregexp":"Expected {0} to be a RegExp but was {1}. Element: {2}"},"$controller":{"ctrlfmt":"Badly formed controller string '{0}'. Must match `__name__ as __id__` or `__name__`.","noscp":"Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`."},"$parse":{"isecfn":"Referencing Function in Angular expressions is disallowed! Expression: {0}","isecwindow":"Referencing the Window in Angular expressions is disallowed! Expression: {0}","ueoe":"Unexpected end of expression: {0}","isecdom":"Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}","lexerr":"Lexer Error: {0} at column{1} in expression [{2}].","esc":"IMPOSSIBLE","isecobj":"Referencing Object in Angular expressions is disallowed! Expression: {0}","lval":"Trying to assign a value to a non l-value","isecff":"Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}","syntax":"Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}].","isecaf":"Assigning to a constructor is disallowed! Expression: {0}","isecfld":"Attempting to access a disallowed field in Angular expressions! Expression: {0}"},"orderBy":{"notarray":"Expected array but received: {0}"},"jqLite":{"offargs":"jqLite#off() does not support the `selector` argument","onargs":"jqLite#on() does not support the `selector` or `eventData` parameters","nosel":"Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element"},"$animate":{"notcsel":"Expecting class selector starting with '.' got '{0}'.","nongcls":"$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the \"{0}\" CSS class."},"$q":{"norslvr":"Expected resolverFn, got '{0}'","qcycle":"Expected promise to be resolved with value other than itself '{0}'"},"$injector":{"pget":"Provider '{0}' must define $get factory method.","cdep":"Circular dependency found: {0}","nomod":"Module '{0}' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.","strictdi":"{0} is not using explicit annotation and cannot be invoked in strict mode","modulerr":"Failed to instantiate module {0} due to:\n{1}","undef":"Provider '{0}' must return a value from $get factory method.","unpr":"Unknown provider: {0}","itkn":"Incorrect injection token! Expected service name as string, got {0}"},"filter":{"notarray":"Expected array but received: {0}"},"ngTransclude":{"orphan":"Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found. Element: {0}"},"ngModel":{"nopromise":"Expected asynchronous validator to return a promise but got '{0}' instead.","nonassign":"Expression '{0}' is non-assignable. Element: {1}","datefmt":"Expected `{0}` to be a date","constexpr":"Expected constant expression for `{0}`, but saw `{1}`.","numfmt":"Expected `{0}` to be a number"},"$location":{"nostate":"History API state support is available only in HTML5 mode and only in browsers supporting HTML5 History API","ipthprfx":"Invalid url \"{0}\", missing path prefix \"{1}\".","isrcharg":"The first argument of the `$location#search()` call must be a string or an object.","nobase":"$location in HTML5 mode requires a <base> tag to be present!"},"$cacheFactory":{"iid":"CacheId '{0}' is already taken!"},"$interpolate":{"noconcat":"Error while interpolating: {0}\nStrict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce","interr":"Can't interpolate: {0}\n{1}","nochgmustache":"angular-message-format.js currently does not allow you to use custom start and end symbols for interpolation.","reqcomma":"Expected a comma after the keyword “{0}†at line {1}, column {2} of text “{3}â€","untermstr":"The string beginning at line {0}, column {1} is unterminated in text “{2}â€","badexpr":"Unexpected operator “{0}†at line {1}, column {2} in text. Was expecting “{3}â€. Text: “{4}â€","dupvalue":"The choice “{0}†is specified more than once. Duplicate key is at line {1}, column {2} in text “{3}â€","unsafe":"Use of select/plural MessageFormat syntax is currently disallowed in a secure context ({0}). At line {1}, column {2} of text “{3}â€","reqother":"“other†is a required option.","reqendinterp":"Expecting end of interpolation symbol, “{0}â€, at line {1}, column {2} in text “{3}â€","reqarg":"Expected one of “plural†or “select†at line {0}, column {1} of text “{2}â€","wantstring":"Expected the beginning of a string at line {0}, column {1} in text “{2}â€","logicbug":"The messageformat parser has encountered an internal error. Please file a github issue against the AngularJS project and provide this message text that triggers the bug. Text: “{0}â€","reqopenbrace":"The plural choice “{0}†must be followed by a message in braces at line {1}, column {2} in text “{3}â€","unknarg":"Unsupported keyword “{0}†at line {0}, column {1}. Only “plural†and “select†are currently supported. Text: “{3}â€","reqendbrace":"The plural/select choice “{0}†message starting at line {1}, column {2} does not have an ending closing brace. Text “{3}â€"},"ngOptions":{"iexp":"Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '{0}'. Element: {1}"},"$rootScope":{"inprog":"{0} already in progress","infdig":"{0} $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: {1}"},"$compile":{"noident":"Cannot bind to controller without identifier for directive '{0}'.","selmulti":"Binding to the 'multiple' attribute is not supported. Element: {0}","ctreq":"Controller '{0}', required by directive '{1}', can't be found!","tplrt":"Template for directive '{0}' must have exactly one root element. {1}","iscp":"Invalid {3} for directive '{0}'. Definition: {... {1}: '{2}' ...}","baddir":"Directive name '{0}' is invalid. The name should not contain leading or trailing whitespaces","noctrl":"Cannot bind to controller without directive '{0}'s controller.","multidir":"Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}","tpload":"Failed to load template: {0} (HTTP status: {1} {2})","uterdir":"Unterminated attribute, found '{0}' but no matching '{1}' found.","reqslot":"Required transclusion slot `{0}` was not filled.","nodomevents":"Interpolations for HTML DOM event attributes are disallowed. Please use the ng- versions (such as ng-click instead of onclick) instead.","nonassign":"Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!","noslot":"No parent directive that requires a transclusion with slot name \"{0}\". Element: {1}"},"$resource":{"badargs":"Expected up to 4 arguments [params, data, success, error], got {0} arguments","badmember":"Dotted member path \"@{0}\" is invalid.","badname":"hasOwnProperty is not a valid parameter name.","badcfg":"Error in resource configuration for action `{0}`. Expected response to contain an {1} but got an {2} (Request: {3} {4})"},"$route":{"norout":"Tried updating route when with no current route"},"linky":{"notstring":"Expected string but received: {0}"},"$sanitize":{"noinert":"Can't create an inert html document","uinput":"Failed to sanitize html because the input is unstable"}}} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/version.json b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/version.json
new file mode 100644
index 00000000..ff1ac645
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/version.json
@@ -0,0 +1 @@
+{"raw":"v1.5.0","major":1,"minor":5,"patch":0,"prerelease":[],"build":[],"version":"1.5.0","codeName":"ennoblement-facilitation","full":"1.5.0","branch":"v1.5.x","cdn":{"raw":"v1.5.0-rc.2","major":1,"minor":5,"patch":0,"prerelease":["rc",2],"build":[],"version":"1.5.0-rc.2","docsUrl":"http://code.angularjs.org/1.5.0-rc.2/docs"}} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/version.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/version.txt
new file mode 100644
index 00000000..3e1ad720
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/version.txt
@@ -0,0 +1 @@
+1.5.0 \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js
new file mode 100644
index 00000000..b09fe5b7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js
@@ -0,0 +1,10 @@
+/*
+ * angular-ui-bootstrap
+ * http://angular-ui.github.io/bootstrap/
+
+ * Version: 1.1.2 - 2016-02-01
+ * License: MIT
+ */angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.collapse","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.isClass","ui.bootstrap.position","ui.bootstrap.datepicker","ui.bootstrap.debounce","ui.bootstrap.dropdown","ui.bootstrap.stackedMap","ui.bootstrap.modal","ui.bootstrap.paging","ui.bootstrap.pager","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]),angular.module("ui.bootstrap.tpls",["uib/template/accordion/accordion-group.html","uib/template/accordion/accordion.html","uib/template/alert/alert.html","uib/template/carousel/carousel.html","uib/template/carousel/slide.html","uib/template/datepicker/datepicker.html","uib/template/datepicker/day.html","uib/template/datepicker/month.html","uib/template/datepicker/popup.html","uib/template/datepicker/year.html","uib/template/modal/backdrop.html","uib/template/modal/window.html","uib/template/pager/pager.html","uib/template/pagination/pagination.html","uib/template/tooltip/tooltip-html-popup.html","uib/template/tooltip/tooltip-popup.html","uib/template/tooltip/tooltip-template-popup.html","uib/template/popover/popover-html.html","uib/template/popover/popover-template.html","uib/template/popover/popover.html","uib/template/progressbar/bar.html","uib/template/progressbar/progress.html","uib/template/progressbar/progressbar.html","uib/template/rating/rating.html","uib/template/tabs/tab.html","uib/template/tabs/tabset.html","uib/template/timepicker/timepicker.html","uib/template/typeahead/typeahead-match.html","uib/template/typeahead/typeahead-popup.html"]),angular.module("ui.bootstrap.collapse",[]).directive("uibCollapse",["$animate","$q","$parse","$injector",function(a,b,c,d){var e=d.has("$animateCss")?d.get("$animateCss"):null;return{link:function(d,f,g){function h(){f.hasClass("collapse")&&f.hasClass("in")||b.resolve(l(d)).then(function(){f.removeClass("collapse").addClass("collapsing").attr("aria-expanded",!0).attr("aria-hidden",!1),e?e(f,{addClass:"in",easing:"ease",to:{height:f[0].scrollHeight+"px"}}).start()["finally"](i):a.addClass(f,"in",{to:{height:f[0].scrollHeight+"px"}}).then(i)})}function i(){f.removeClass("collapsing").addClass("collapse").css({height:"auto"}),m(d)}function j(){return f.hasClass("collapse")||f.hasClass("in")?void b.resolve(n(d)).then(function(){f.css({height:f[0].scrollHeight+"px"}).removeClass("collapse").addClass("collapsing").attr("aria-expanded",!1).attr("aria-hidden",!0),e?e(f,{removeClass:"in",to:{height:"0"}}).start()["finally"](k):a.removeClass(f,"in",{to:{height:"0"}}).then(k)}):k()}function k(){f.css({height:"0"}),f.removeClass("collapsing").addClass("collapse"),o(d)}var l=c(g.expanding),m=c(g.expanded),n=c(g.collapsing),o=c(g.collapsed);d.$eval(g.uibCollapse)||f.addClass("in").addClass("collapse").attr("aria-expanded",!0).attr("aria-hidden",!1).css({height:"auto"}),d.$watch(g.uibCollapse,function(a){a?j():h()})}}}]),angular.module("ui.bootstrap.accordion",["ui.bootstrap.collapse"]).constant("uibAccordionConfig",{closeOthers:!0}).controller("UibAccordionController",["$scope","$attrs","uibAccordionConfig",function(a,b,c){this.groups=[],this.closeOthers=function(d){var e=angular.isDefined(b.closeOthers)?a.$eval(b.closeOthers):c.closeOthers;e&&angular.forEach(this.groups,function(a){a!==d&&(a.isOpen=!1)})},this.addGroup=function(a){var b=this;this.groups.push(a),a.$on("$destroy",function(c){b.removeGroup(a)})},this.removeGroup=function(a){var b=this.groups.indexOf(a);-1!==b&&this.groups.splice(b,1)}}]).directive("uibAccordion",function(){return{controller:"UibAccordionController",controllerAs:"accordion",transclude:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/accordion/accordion.html"}}}).directive("uibAccordionGroup",function(){return{require:"^uibAccordion",transclude:!0,replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/accordion/accordion-group.html"},scope:{heading:"@",isOpen:"=?",isDisabled:"=?"},controller:function(){this.setHeading=function(a){this.heading=a}},link:function(a,b,c,d){d.addGroup(a),a.openClass=c.openClass||"panel-open",a.panelClass=c.panelClass||"panel-default",a.$watch("isOpen",function(c){b.toggleClass(a.openClass,!!c),c&&d.closeOthers(a)}),a.toggleOpen=function(b){a.isDisabled||b&&32!==b.which||(a.isOpen=!a.isOpen)};var e="accordiongroup-"+a.$id+"-"+Math.floor(1e4*Math.random());a.headingId=e+"-tab",a.panelId=e+"-panel"}}}).directive("uibAccordionHeading",function(){return{transclude:!0,template:"",replace:!0,require:"^uibAccordionGroup",link:function(a,b,c,d,e){d.setHeading(e(a,angular.noop))}}}).directive("uibAccordionTransclude",function(){return{require:"^uibAccordionGroup",link:function(a,b,c,d){a.$watch(function(){return d[c.uibAccordionTransclude]},function(a){a&&(b.find("span").html(""),b.find("span").append(a))})}}}),angular.module("ui.bootstrap.alert",[]).controller("UibAlertController",["$scope","$attrs","$interpolate","$timeout",function(a,b,c,d){a.closeable=!!b.close;var e=angular.isDefined(b.dismissOnTimeout)?c(b.dismissOnTimeout)(a.$parent):null;e&&d(function(){a.close()},parseInt(e,10))}]).directive("uibAlert",function(){return{controller:"UibAlertController",controllerAs:"alert",templateUrl:function(a,b){return b.templateUrl||"uib/template/alert/alert.html"},transclude:!0,replace:!0,scope:{type:"@",close:"&"}}}),angular.module("ui.bootstrap.buttons",[]).constant("uibButtonConfig",{activeClass:"active",toggleEvent:"click"}).controller("UibButtonsController",["uibButtonConfig",function(a){this.activeClass=a.activeClass||"active",this.toggleEvent=a.toggleEvent||"click"}]).directive("uibBtnRadio",["$parse",function(a){return{require:["uibBtnRadio","ngModel"],controller:"UibButtonsController",controllerAs:"buttons",link:function(b,c,d,e){var f=e[0],g=e[1],h=a(d.uibUncheckable);c.find("input").css({display:"none"}),g.$render=function(){c.toggleClass(f.activeClass,angular.equals(g.$modelValue,b.$eval(d.uibBtnRadio)))},c.on(f.toggleEvent,function(){if(!d.disabled){var a=c.hasClass(f.activeClass);(!a||angular.isDefined(d.uncheckable))&&b.$apply(function(){g.$setViewValue(a?null:b.$eval(d.uibBtnRadio)),g.$render()})}}),d.uibUncheckable&&b.$watch(h,function(a){d.$set("uncheckable",a?"":null)})}}}]).directive("uibBtnCheckbox",function(){return{require:["uibBtnCheckbox","ngModel"],controller:"UibButtonsController",controllerAs:"button",link:function(a,b,c,d){function e(){return g(c.btnCheckboxTrue,!0)}function f(){return g(c.btnCheckboxFalse,!1)}function g(b,c){return angular.isDefined(b)?a.$eval(b):c}var h=d[0],i=d[1];b.find("input").css({display:"none"}),i.$render=function(){b.toggleClass(h.activeClass,angular.equals(i.$modelValue,e()))},b.on(h.toggleEvent,function(){c.disabled||a.$apply(function(){i.$setViewValue(b.hasClass(h.activeClass)?f():e()),i.$render()})})}}}),angular.module("ui.bootstrap.carousel",[]).controller("UibCarouselController",["$scope","$element","$interval","$timeout","$animate",function(a,b,c,d,e){function f(){for(;s.length;)s.shift()}function g(a){if(angular.isUndefined(p[a].index))return p[a];for(var b=0,c=p.length;c>b;++b)if(p[b].index===a)return p[b]}function h(c,d,g){t||(angular.extend(c,{direction:g,active:!0}),angular.extend(o.currentSlide||{},{direction:g,active:!1}),e.enabled(b)&&!a.$currentTransition&&c.$element&&o.slides.length>1&&(c.$element.data(q,c.direction),o.currentSlide&&o.currentSlide.$element&&o.currentSlide.$element.data(q,c.direction),a.$currentTransition=!0,e.on("addClass",c.$element,function(b,c){if("close"===c&&(a.$currentTransition=null,e.off("addClass",b),s.length)){var d=s.pop(),g=a.indexOfSlide(d),i=g>o.getCurrentIndex()?"next":"prev";f(),h(d,g,i)}})),o.currentSlide=c,r=d,k())}function i(){m&&(c.cancel(m),m=null)}function j(b){b.length||(a.$currentTransition=null,f())}function k(){i();var b=+a.interval;!isNaN(b)&&b>0&&(m=c(l,b))}function l(){var b=+a.interval;n&&!isNaN(b)&&b>0&&p.length?a.next():a.pause()}var m,n,o=this,p=o.slides=a.slides=[],q="uib-slideDirection",r=-1,s=[];o.currentSlide=null;var t=!1;o.addSlide=function(b,c){b.$element=c,p.push(b),1===p.length||b.active?(a.$currentTransition&&(a.$currentTransition=null),o.select(p[p.length-1]),1===p.length&&a.play()):b.active=!1},o.getCurrentIndex=function(){return o.currentSlide&&angular.isDefined(o.currentSlide.index)?+o.currentSlide.index:r},o.next=a.next=function(){var b=(o.getCurrentIndex()+1)%p.length;return 0===b&&a.noWrap()?void a.pause():o.select(g(b),"next")},o.prev=a.prev=function(){var b=o.getCurrentIndex()-1<0?p.length-1:o.getCurrentIndex()-1;return a.noWrap()&&b===p.length-1?void a.pause():o.select(g(b),"prev")},o.removeSlide=function(a){angular.isDefined(a.index)&&p.sort(function(a,b){return+a.index>+b.index});var b=s.indexOf(a);-1!==b&&s.splice(b,1);var c=p.indexOf(a);p.splice(c,1),d(function(){p.length>0&&a.active?c>=p.length?o.select(p[c-1]):o.select(p[c]):r>c&&r--}),0===p.length&&(o.currentSlide=null,f())},o.select=a.select=function(b,c){var d=a.indexOfSlide(b);void 0===c&&(c=d>o.getCurrentIndex()?"next":"prev"),b&&b!==o.currentSlide&&!a.$currentTransition?h(b,d,c):b&&b!==o.currentSlide&&a.$currentTransition&&(s.push(b),b.active=!1)},a.indexOfSlide=function(a){return angular.isDefined(a.index)?+a.index:p.indexOf(a)},a.isActive=function(a){return o.currentSlide===a},a.pause=function(){a.noPause||(n=!1,i())},a.play=function(){n||(n=!0,k())},a.$on("$destroy",function(){t=!0,i()}),a.$watch("noTransition",function(a){e.enabled(b,!a)}),a.$watch("interval",k),a.$watchCollection("slides",j)}]).directive("uibCarousel",function(){return{transclude:!0,replace:!0,controller:"UibCarouselController",controllerAs:"carousel",templateUrl:function(a,b){return b.templateUrl||"uib/template/carousel/carousel.html"},scope:{interval:"=",noTransition:"=",noPause:"=",noWrap:"&"}}}).directive("uibSlide",function(){return{require:"^uibCarousel",transclude:!0,replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/carousel/slide.html"},scope:{active:"=?",actual:"=?",index:"=?"},link:function(a,b,c,d){d.addSlide(a,b),a.$on("$destroy",function(){d.removeSlide(a)}),a.$watch("active",function(b){b&&d.select(a)})}}}).animation(".item",["$animateCss",function(a){function b(a,b,c){a.removeClass(b),c&&c()}var c="uib-slideDirection";return{beforeAddClass:function(d,e,f){if("active"===e){var g=!1,h=d.data(c),i="next"===h?"left":"right",j=b.bind(this,d,i+" "+h,f);return d.addClass(h),a(d,{addClass:i}).start().done(j),function(){g=!0}}f()},beforeRemoveClass:function(d,e,f){if("active"===e){var g=!1,h=d.data(c),i="next"===h?"left":"right",j=b.bind(this,d,i,f);return a(d,{addClass:i}).start().done(j),function(){g=!0}}f()}}}]),angular.module("ui.bootstrap.dateparser",[]).service("uibDateParser",["$log","$locale","dateFilter","orderByFilter",function(a,b,c,d){function e(a,b){var c=[],e=a.split(""),f=a.indexOf("'");if(f>-1){var g=!1;a=a.split("");for(var h=f;h<a.length;h++)g?("'"===a[h]&&(h+1<a.length&&"'"===a[h+1]?(a[h+1]="$",e[h+1]=""):(e[h]="",g=!1)),a[h]="$"):"'"===a[h]&&(a[h]="$",e[h]="",g=!0);a=a.join("")}return angular.forEach(n,function(d){var f=a.indexOf(d.key);if(f>-1){a=a.split(""),e[f]="("+d.regex+")",a[f]="$";for(var g=f+1,h=f+d.key.length;h>g;g++)e[g]="",a[g]="$";a=a.join(""),c.push({index:f,key:d.key,apply:d[b],matcher:d.regex})}}),{regex:new RegExp("^"+e.join("")+"$"),map:d(c,"index")}}function f(a,b,c){return 1>c?!1:1===b&&c>28?29===c&&(a%4===0&&a%100!==0||a%400===0):3===b||5===b||8===b||10===b?31>c:!0}function g(a){return parseInt(a,10)}function h(a,b){return a&&b?l(a,b):a}function i(a,b){return a&&b?l(a,b,!0):a}function j(a,b){var c=Date.parse("Jan 01, 1970 00:00:00 "+a)/6e4;return isNaN(c)?b:c}function k(a,b){return a=new Date(a.getTime()),a.setMinutes(a.getMinutes()+b),a}function l(a,b,c){c=c?-1:1;var d=j(b,a.getTimezoneOffset());return k(a,c*(d-a.getTimezoneOffset()))}var m,n,o=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;this.init=function(){m=b.id,this.parsers={},this.formatters={},n=[{key:"yyyy",regex:"\\d{4}",apply:function(a){this.year=+a},formatter:function(a){var b=new Date;return b.setFullYear(Math.abs(a.getFullYear())),c(b,"yyyy")}},{key:"yy",regex:"\\d{2}",apply:function(a){this.year=+a+2e3},formatter:function(a){var b=new Date;return b.setFullYear(Math.abs(a.getFullYear())),c(b,"yy")}},{key:"y",regex:"\\d{1,4}",apply:function(a){this.year=+a},formatter:function(a){var b=new Date;return b.setFullYear(Math.abs(a.getFullYear())),c(b,"y")}},{key:"M!",regex:"0?[1-9]|1[0-2]",apply:function(a){this.month=a-1},formatter:function(a){var b=a.getMonth();return/^[0-9]$/.test(b)?c(a,"MM"):c(a,"M")}},{key:"MMMM",regex:b.DATETIME_FORMATS.MONTH.join("|"),apply:function(a){this.month=b.DATETIME_FORMATS.MONTH.indexOf(a)},formatter:function(a){return c(a,"MMMM")}},{key:"MMM",regex:b.DATETIME_FORMATS.SHORTMONTH.join("|"),apply:function(a){this.month=b.DATETIME_FORMATS.SHORTMONTH.indexOf(a)},formatter:function(a){return c(a,"MMM")}},{key:"MM",regex:"0[1-9]|1[0-2]",apply:function(a){this.month=a-1},formatter:function(a){return c(a,"MM")}},{key:"M",regex:"[1-9]|1[0-2]",apply:function(a){this.month=a-1},formatter:function(a){return c(a,"M")}},{key:"d!",regex:"[0-2]?[0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a},formatter:function(a){var b=a.getDate();return/^[1-9]$/.test(b)?c(a,"dd"):c(a,"d")}},{key:"dd",regex:"[0-2][0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a},formatter:function(a){return c(a,"dd")}},{key:"d",regex:"[1-2]?[0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a},formatter:function(a){return c(a,"d")}},{key:"EEEE",regex:b.DATETIME_FORMATS.DAY.join("|"),formatter:function(a){return c(a,"EEEE")}},{key:"EEE",regex:b.DATETIME_FORMATS.SHORTDAY.join("|"),formatter:function(a){return c(a,"EEE")}},{key:"HH",regex:"(?:0|1)[0-9]|2[0-3]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"HH")}},{key:"hh",regex:"0[0-9]|1[0-2]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"hh")}},{key:"H",regex:"1?[0-9]|2[0-3]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"H")}},{key:"h",regex:"[0-9]|1[0-2]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"h")}},{key:"mm",regex:"[0-5][0-9]",apply:function(a){this.minutes=+a},formatter:function(a){return c(a,"mm")}},{key:"m",regex:"[0-9]|[1-5][0-9]",apply:function(a){this.minutes=+a},formatter:function(a){return c(a,"m")}},{key:"sss",regex:"[0-9][0-9][0-9]",apply:function(a){this.milliseconds=+a},formatter:function(a){return c(a,"sss")}},{key:"ss",regex:"[0-5][0-9]",apply:function(a){this.seconds=+a},formatter:function(a){return c(a,"ss")}},{key:"s",regex:"[0-9]|[1-5][0-9]",apply:function(a){this.seconds=+a},formatter:function(a){return c(a,"s")}},{key:"a",regex:b.DATETIME_FORMATS.AMPMS.join("|"),apply:function(a){12===this.hours&&(this.hours=0),"PM"===a&&(this.hours+=12)},formatter:function(a){return c(a,"a")}},{key:"Z",regex:"[+-]\\d{4}",apply:function(a){var b=a.match(/([+-])(\d{2})(\d{2})/),c=b[1],d=b[2],e=b[3];this.hours+=g(c+d),this.minutes+=g(c+e)},formatter:function(a){return c(a,"Z")}},{key:"ww",regex:"[0-4][0-9]|5[0-3]",formatter:function(a){return c(a,"ww")}},{key:"w",regex:"[0-9]|[1-4][0-9]|5[0-3]",formatter:function(a){return c(a,"w")}},{key:"GGGG",regex:b.DATETIME_FORMATS.ERANAMES.join("|").replace(/\s/g,"\\s"),formatter:function(a){return c(a,"GGGG")}},{key:"GGG",regex:b.DATETIME_FORMATS.ERAS.join("|"),formatter:function(a){return c(a,"GGG")}},{key:"GG",regex:b.DATETIME_FORMATS.ERAS.join("|"),formatter:function(a){return c(a,"GG")}},{key:"G",regex:b.DATETIME_FORMATS.ERAS.join("|"),formatter:function(a){return c(a,"G")}}]},this.init(),this.filter=function(a,c){if(!angular.isDate(a)||isNaN(a)||!c)return"";c=b.DATETIME_FORMATS[c]||c,b.id!==m&&this.init(),this.formatters[c]||(this.formatters[c]=e(c,"formatter"));var d=this.formatters[c],f=d.map,g=c;return f.reduce(function(b,c,d){var e=g.match(new RegExp("(.*)"+c.key));return e&&angular.isString(e[1])&&(b+=e[1],g=g.replace(e[1]+c.key,"")),c.apply?b+c.apply.call(null,a):b},"")},this.parse=function(c,d,g){if(!angular.isString(c)||!d)return c;d=b.DATETIME_FORMATS[d]||d,d=d.replace(o,"\\$&"),b.id!==m&&this.init(),this.parsers[d]||(this.parsers[d]=e(d,"apply"));var h=this.parsers[d],i=h.regex,j=h.map,k=c.match(i),l=!1;if(k&&k.length){var n,p;angular.isDate(g)&&!isNaN(g.getTime())?n={year:g.getFullYear(),month:g.getMonth(),date:g.getDate(),hours:g.getHours(),minutes:g.getMinutes(),seconds:g.getSeconds(),milliseconds:g.getMilliseconds()}:(g&&a.warn("dateparser:","baseDate is not a valid date"),n={year:1900,month:0,date:1,hours:0,minutes:0,seconds:0,milliseconds:0});for(var q=1,r=k.length;r>q;q++){var s=j[q-1];"Z"===s.matcher&&(l=!0),s.apply&&s.apply.call(n,k[q])}var t=l?Date.prototype.setUTCFullYear:Date.prototype.setFullYear,u=l?Date.prototype.setUTCHours:Date.prototype.setHours;return f(n.year,n.month,n.date)&&(!angular.isDate(g)||isNaN(g.getTime())||l?(p=new Date(0),t.call(p,n.year,n.month,n.date),u.call(p,n.hours||0,n.minutes||0,n.seconds||0,n.milliseconds||0)):(p=new Date(g),t.call(p,n.year,n.month,n.date),u.call(p,n.hours,n.minutes,n.seconds,n.milliseconds))),p}},this.toTimezone=h,this.fromTimezone=i,this.timezoneToOffset=j,this.addDateMinutes=k,this.convertTimezoneToLocal=l}]),angular.module("ui.bootstrap.isClass",[]).directive("uibIsClass",["$animate",function(a){var b=/^\s*([\s\S]+?)\s+on\s+([\s\S]+?)\s*$/,c=/^\s*([\s\S]+?)\s+for\s+([\s\S]+?)\s*$/;return{restrict:"A",compile:function(d,e){function f(a,b,c){i.push(a),j.push({scope:a,element:b}),o.forEach(function(b,c){g(b,a)}),a.$on("$destroy",h)}function g(b,d){var e=b.match(c),f=d.$eval(e[1]),g=e[2],h=k[b];if(!h){var i=function(b){var c=null;j.some(function(a){var d=a.scope.$eval(m);return d===b?(c=a,!0):void 0}),h.lastActivated!==c&&(h.lastActivated&&a.removeClass(h.lastActivated.element,f),c&&a.addClass(c.element,f),h.lastActivated=c)};k[b]=h={lastActivated:null,scope:d,watchFn:i,compareWithExp:g,watcher:d.$watch(g,i)}}h.watchFn(d.$eval(g))}function h(a){var b=a.targetScope,c=i.indexOf(b);if(i.splice(c,1),j.splice(c,1),i.length){var d=i[0];angular.forEach(k,function(a){a.scope===b&&(a.watcher=d.$watch(a.compareWithExp,a.watchFn),a.scope=d)})}else k={}}var i=[],j=[],k={},l=e.uibIsClass.match(b),m=l[2],n=l[1],o=n.split(",");return f}}}]),angular.module("ui.bootstrap.position",[]).factory("$uibPosition",["$document","$window",function(a,b){var c,d={normal:/(auto|scroll)/,hidden:/(auto|scroll|hidden)/},e={auto:/\s?auto?\s?/i,primary:/^(top|bottom|left|right)$/,secondary:/^(top|bottom|left|right|center)$/,vertical:/^(top|bottom)$/};return{getRawNode:function(a){return a[0]||a},parseStyle:function(a){return a=parseFloat(a),isFinite(a)?a:0},offsetParent:function(c){function d(a){return"static"===(b.getComputedStyle(a).position||"static")}c=this.getRawNode(c);for(var e=c.offsetParent||a[0].documentElement;e&&e!==a[0].documentElement&&d(e);)e=e.offsetParent;return e||a[0].documentElement},scrollbarWidth:function(){if(angular.isUndefined(c)){var b=angular.element('<div style="position: absolute; top: -9999px; width: 50px; height: 50px; overflow: scroll;"></div>');a.find("body").append(b),c=b[0].offsetWidth-b[0].clientWidth,c=isFinite(c)?c:0,b.remove()}return c},scrollParent:function(c,e){c=this.getRawNode(c);var f=e?d.hidden:d.normal,g=a[0].documentElement,h=b.getComputedStyle(c),i="absolute"===h.position,j=c.parentElement||g;if(j===g||"fixed"===h.position)return g;for(;j.parentElement&&j!==g;){var k=b.getComputedStyle(j);if(i&&"static"!==k.position&&(i=!1),!i&&f.test(k.overflow+k.overflowY+k.overflowX))break;j=j.parentElement}return j},position:function(c,d){c=this.getRawNode(c);var e=this.offset(c);if(d){var f=b.getComputedStyle(c);e.top-=this.parseStyle(f.marginTop),e.left-=this.parseStyle(f.marginLeft)}var g=this.offsetParent(c),h={top:0,left:0};return g!==a[0].documentElement&&(h=this.offset(g),h.top+=g.clientTop-g.scrollTop,h.left+=g.clientLeft-g.scrollLeft),{width:Math.round(angular.isNumber(e.width)?e.width:c.offsetWidth),height:Math.round(angular.isNumber(e.height)?e.height:c.offsetHeight),top:Math.round(e.top-h.top),left:Math.round(e.left-h.left)}},offset:function(c){c=this.getRawNode(c);var d=c.getBoundingClientRect();return{width:Math.round(angular.isNumber(d.width)?d.width:c.offsetWidth),height:Math.round(angular.isNumber(d.height)?d.height:c.offsetHeight),top:Math.round(d.top+(b.pageYOffset||a[0].documentElement.scrollTop)),left:Math.round(d.left+(b.pageXOffset||a[0].documentElement.scrollLeft))}},viewportOffset:function(c,d,e){c=this.getRawNode(c),e=e!==!1?!0:!1;var f=c.getBoundingClientRect(),g={top:0,left:0,bottom:0,right:0},h=d?a[0].documentElement:this.scrollParent(c),i=h.getBoundingClientRect();if(g.top=i.top+h.clientTop,g.left=i.left+h.clientLeft,h===a[0].documentElement&&(g.top+=b.pageYOffset,g.left+=b.pageXOffset),g.bottom=g.top+h.clientHeight,g.right=g.left+h.clientWidth,e){var j=b.getComputedStyle(h);g.top+=this.parseStyle(j.paddingTop),g.bottom-=this.parseStyle(j.paddingBottom),g.left+=this.parseStyle(j.paddingLeft),g.right-=this.parseStyle(j.paddingRight)}return{top:Math.round(f.top-g.top),bottom:Math.round(g.bottom-f.bottom),left:Math.round(f.left-g.left),right:Math.round(g.right-f.right)}},parsePlacement:function(a){var b=e.auto.test(a);return b&&(a=a.replace(e.auto,"")),a=a.split("-"),a[0]=a[0]||"top",e.primary.test(a[0])||(a[0]="top"),a[1]=a[1]||"center",e.secondary.test(a[1])||(a[1]="center"),b?a[2]=!0:a[2]=!1,a},positionElements:function(a,c,d,f){a=this.getRawNode(a),c=this.getRawNode(c);var g=angular.isDefined(c.offsetWidth)?c.offsetWidth:c.prop("offsetWidth"),h=angular.isDefined(c.offsetHeight)?c.offsetHeight:c.prop("offsetHeight");d=this.parsePlacement(d);var i=f?this.offset(a):this.position(a),j={top:0,left:0,placement:""};if(d[2]){var k=this.viewportOffset(a),l=b.getComputedStyle(c),m={width:g+Math.round(Math.abs(this.parseStyle(l.marginLeft)+this.parseStyle(l.marginRight))),height:h+Math.round(Math.abs(this.parseStyle(l.marginTop)+this.parseStyle(l.marginBottom)))};if(d[0]="top"===d[0]&&m.height>k.top&&m.height<=k.bottom?"bottom":"bottom"===d[0]&&m.height>k.bottom&&m.height<=k.top?"top":"left"===d[0]&&m.width>k.left&&m.width<=k.right?"right":"right"===d[0]&&m.width>k.right&&m.width<=k.left?"left":d[0],d[1]="top"===d[1]&&m.height-i.height>k.bottom&&m.height-i.height<=k.top?"bottom":"bottom"===d[1]&&m.height-i.height>k.top&&m.height-i.height<=k.bottom?"top":"left"===d[1]&&m.width-i.width>k.right&&m.width-i.width<=k.left?"right":"right"===d[1]&&m.width-i.width>k.left&&m.width-i.width<=k.right?"left":d[1],"center"===d[1])if(e.vertical.test(d[0])){var n=i.width/2-g/2;k.left+n<0&&m.width-i.width<=k.right?d[1]="left":k.right+n<0&&m.width-i.width<=k.left&&(d[1]="right")}else{var o=i.height/2-m.height/2;k.top+o<0&&m.height-i.height<=k.bottom?d[1]="top":k.bottom+o<0&&m.height-i.height<=k.top&&(d[1]="bottom")}}switch(d[0]){case"top":j.top=i.top-h;break;case"bottom":j.top=i.top+i.height;break;case"left":j.left=i.left-g;break;case"right":j.left=i.left+i.width}switch(d[1]){case"top":j.top=i.top;break;case"bottom":j.top=i.top+i.height-h;break;case"left":j.left=i.left;break;case"right":j.left=i.left+i.width-g;break;case"center":e.vertical.test(d[0])?j.left=i.left+i.width/2-g/2:j.top=i.top+i.height/2-h/2}return j.top=Math.round(j.top),j.left=Math.round(j.left),j.placement="center"===d[1]?d[0]:d[0]+"-"+d[1],j},positionArrow:function(a,c){a=this.getRawNode(a);var d=a.querySelector(".tooltip-inner, .popover-inner");if(d){var f=angular.element(d).hasClass("tooltip-inner"),g=f?a.querySelector(".tooltip-arrow"):a.querySelector(".arrow");if(g){if(c=this.parsePlacement(c),"center"===c[1])return void angular.element(g).css({top:"",bottom:"",right:"",left:"",margin:""});var h="border-"+c[0]+"-width",i=b.getComputedStyle(g)[h],j="border-";j+=e.vertical.test(c[0])?c[0]+"-"+c[1]:c[1]+"-"+c[0],j+="-radius";var k=b.getComputedStyle(f?d:a)[j],l={top:"auto",bottom:"auto",left:"auto",right:"auto",margin:0};switch(c[0]){case"top":l.bottom=f?"0":"-"+i;break;case"bottom":l.top=f?"0":"-"+i;break;case"left":l.right=f?"0":"-"+i;break;case"right":l.left=f?"0":"-"+i}l[c[1]]=k,angular.element(g).css(l)}}}}}]),angular.module("ui.bootstrap.datepicker",["ui.bootstrap.dateparser","ui.bootstrap.isClass","ui.bootstrap.position"]).value("$datepickerSuppressError",!1).constant("uibDatepickerConfig",{datepickerMode:"day",formatDay:"dd",formatMonth:"MMMM",formatYear:"yyyy",formatDayHeader:"EEE",formatDayTitle:"MMMM yyyy",formatMonthTitle:"yyyy",maxDate:null,maxMode:"year",minDate:null,minMode:"day",ngModelOptions:{},shortcutPropagation:!1,showWeeks:!0,yearColumns:5,yearRows:4}).controller("UibDatepickerController",["$scope","$attrs","$parse","$interpolate","$locale","$log","dateFilter","uibDatepickerConfig","$datepickerSuppressError","uibDateParser",function(a,b,c,d,e,f,g,h,i,j){var k=this,l={$setViewValue:angular.noop},m={},n=[];this.modes=["day","month","year"],b.datepickerOptions?angular.forEach(["formatDay","formatDayHeader","formatDayTitle","formatMonth","formatMonthTitle","formatYear","initDate","maxDate","maxMode","minDate","minMode","showWeeks","shortcutPropagation","startingDay","yearColumns","yearRows"],function(b){switch(b){case"formatDay":case"formatDayHeader":case"formatDayTitle":case"formatMonth":case"formatMonthTitle":case"formatYear":k[b]=angular.isDefined(a.datepickerOptions[b])?d(a.datepickerOptions[b])(a.$parent):h[b];break;case"showWeeks":case"shortcutPropagation":case"yearColumns":case"yearRows":k[b]=angular.isDefined(a.datepickerOptions[b])?a.datepickerOptions[b]:h[b];break;case"startingDay":angular.isDefined(a.datepickerOptions.startingDay)?k.startingDay=a.datepickerOptions.startingDay:angular.isNumber(h.startingDay)?k.startingDay=h.startingDay:k.startingDay=(e.DATETIME_FORMATS.FIRSTDAYOFWEEK+8)%7;break;case"maxDate":case"minDate":a.datepickerOptions[b]?a.$watch(function(){return a.datepickerOptions[b]},function(a){a?angular.isDate(a)?k[b]=j.fromTimezone(new Date(a),m.timezone):k[b]=new Date(g(a,"medium")):k[b]=null,k.refreshView()}):k[b]=h[b]?j.fromTimezone(new Date(h[b]),m.timezone):null;break;case"maxMode":case"minMode":a.datepickerOptions[b]?a.$watch(function(){return a.datepickerOptions[b]},function(c){k[b]=a[b]=angular.isDefined(c)?c:datepickerOptions[b],("minMode"===b&&k.modes.indexOf(a.datepickerMode)<k.modes.indexOf(k[b])||"maxMode"===b&&k.modes.indexOf(a.datepickerMode)>k.modes.indexOf(k[b]))&&(a.datepickerMode=k[b])}):k[b]=a[b]=h[b]||null;break;case"initDate":a.datepickerOptions.initDate?(this.activeDate=j.fromTimezone(a.datepickerOptions.initDate,m.timezone)||new Date,a.$watch(function(){return a.datepickerOptions.initDate},function(a){a&&(l.$isEmpty(l.$modelValue)||l.$invalid)&&(k.activeDate=j.fromTimezone(a,m.timezone),k.refreshView())})):this.activeDate=new Date}}):(angular.forEach(["formatDay","formatMonth","formatYear","formatDayHeader","formatDayTitle","formatMonthTitle"],function(c){k[c]=angular.isDefined(b[c])?d(b[c])(a.$parent):h[c]}),angular.forEach(["showWeeks","yearRows","yearColumns","shortcutPropagation"],function(c){k[c]=angular.isDefined(b[c])?a.$parent.$eval(b[c]):h[c]}),angular.isDefined(b.startingDay)?k.startingDay=a.$parent.$eval(b.startingDay):angular.isNumber(h.startingDay)?k.startingDay=h.startingDay:k.startingDay=(e.DATETIME_FORMATS.FIRSTDAYOFWEEK+8)%7,angular.forEach(["minDate","maxDate"],function(c){b[c]?n.push(a.$parent.$watch(b[c],function(a){a?angular.isDate(a)?k[c]=j.fromTimezone(new Date(a),m.timezone):k[c]=new Date(g(a,"medium")):k[c]=null,k.refreshView()})):k[c]=h[c]?j.fromTimezone(new Date(h[c]),m.timezone):null}),angular.forEach(["minMode","maxMode"],function(c){b[c]?n.push(a.$parent.$watch(b[c],function(d){k[c]=a[c]=angular.isDefined(d)?d:b[c],("minMode"===c&&k.modes.indexOf(a.datepickerMode)<k.modes.indexOf(k[c])||"maxMode"===c&&k.modes.indexOf(a.datepickerMode)>k.modes.indexOf(k[c]))&&(a.datepickerMode=k[c])})):k[c]=a[c]=h[c]||null}),angular.isDefined(b.initDate)?(this.activeDate=j.fromTimezone(a.$parent.$eval(b.initDate),m.timezone)||new Date,n.push(a.$parent.$watch(b.initDate,function(a){a&&(l.$isEmpty(l.$modelValue)||l.$invalid)&&(k.activeDate=j.fromTimezone(a,m.timezone),k.refreshView())}))):this.activeDate=new Date),a.datepickerMode=a.datepickerMode||h.datepickerMode,a.uniqueId="datepicker-"+a.$id+"-"+Math.floor(1e4*Math.random()),a.disabled=angular.isDefined(b.disabled)||!1,angular.isDefined(b.ngDisabled)&&n.push(a.$parent.$watch(b.ngDisabled,function(b){a.disabled=b,k.refreshView()})),a.isActive=function(b){return 0===k.compare(b.date,k.activeDate)?(a.activeDateId=b.uid,!0):!1},this.init=function(a){l=a,m=a.$options||h.ngModelOptions,l.$modelValue&&(this.activeDate=l.$modelValue),l.$render=function(){k.render()}},this.render=function(){if(l.$viewValue){var a=new Date(l.$viewValue),b=!isNaN(a);b?this.activeDate=j.fromTimezone(a,m.timezone):i||f.error('Datepicker directive: "ng-model" value must be a Date object')}this.refreshView()},this.refreshView=function(){if(this.element){a.selectedDt=null,this._refreshView(),a.activeDt&&(a.activeDateId=a.activeDt.uid);var b=l.$viewValue?new Date(l.$viewValue):null;b=j.fromTimezone(b,m.timezone),l.$setValidity("dateDisabled",!b||this.element&&!this.isDisabled(b))}},this.createDateObject=function(b,c){var d=l.$viewValue?new Date(l.$viewValue):null;d=j.fromTimezone(d,m.timezone);var e={date:b,label:j.filter(b,c),selected:d&&0===this.compare(b,d),disabled:this.isDisabled(b),current:0===this.compare(b,new Date),customClass:this.customClass(b)||null};return d&&0===this.compare(b,d)&&(a.selectedDt=e),k.activeDate&&0===this.compare(e.date,k.activeDate)&&(a.activeDt=e),e},this.isDisabled=function(c){return a.disabled||this.minDate&&this.compare(c,this.minDate)<0||this.maxDate&&this.compare(c,this.maxDate)>0||b.dateDisabled&&a.dateDisabled({date:c,mode:a.datepickerMode})},this.customClass=function(b){return a.customClass({date:b,mode:a.datepickerMode})},this.split=function(a,b){for(var c=[];a.length>0;)c.push(a.splice(0,b));return c},a.select=function(b){if(a.datepickerMode===k.minMode){var c=l.$viewValue?j.fromTimezone(new Date(l.$viewValue),m.timezone):new Date(0,0,0,0,0,0,0);c.setFullYear(b.getFullYear(),b.getMonth(),b.getDate()),c=j.toTimezone(c,m.timezone),l.$setViewValue(c),l.$render()}else k.activeDate=b,a.datepickerMode=k.modes[k.modes.indexOf(a.datepickerMode)-1]},a.move=function(a){var b=k.activeDate.getFullYear()+a*(k.step.years||0),c=k.activeDate.getMonth()+a*(k.step.months||0);k.activeDate.setFullYear(b,c,1),k.refreshView()},a.toggleMode=function(b){b=b||1,a.datepickerMode===k.maxMode&&1===b||a.datepickerMode===k.minMode&&-1===b||(a.datepickerMode=k.modes[k.modes.indexOf(a.datepickerMode)+b])},a.keys={13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down"};var o=function(){k.element[0].focus()};a.$on("uib:datepicker.focus",o),a.keydown=function(b){var c=a.keys[b.which];if(c&&!b.shiftKey&&!b.altKey&&!a.disabled)if(b.preventDefault(),k.shortcutPropagation||b.stopPropagation(),"enter"===c||"space"===c){if(k.isDisabled(k.activeDate))return;a.select(k.activeDate)}else!b.ctrlKey||"up"!==c&&"down"!==c?(k.handleKeyDown(c,b),k.refreshView()):a.toggleMode("up"===c?1:-1)},a.$on("$destroy",function(){for(;n.length;)n.shift()()})}]).controller("UibDaypickerController",["$scope","$element","dateFilter",function(a,b,c){function d(a,b){return 1!==b||a%4!==0||a%100===0&&a%400!==0?f[b]:29}function e(a){var b=new Date(a);b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1}var f=[31,28,31,30,31,30,31,31,30,31,30,31];this.step={months:1},this.element=b,this.init=function(b){angular.extend(b,this),a.showWeeks=b.showWeeks,b.refreshView()},this.getDates=function(a,b){for(var c,d=new Array(b),e=new Date(a),f=0;b>f;)c=new Date(e),d[f++]=c,e.setDate(e.getDate()+1);return d;
+},this._refreshView=function(){var b=this.activeDate.getFullYear(),d=this.activeDate.getMonth(),f=new Date(this.activeDate);f.setFullYear(b,d,1);var g=this.startingDay-f.getDay(),h=g>0?7-g:-g,i=new Date(f);h>0&&i.setDate(-h+1);for(var j=this.getDates(i,42),k=0;42>k;k++)j[k]=angular.extend(this.createDateObject(j[k],this.formatDay),{secondary:j[k].getMonth()!==d,uid:a.uniqueId+"-"+k});a.labels=new Array(7);for(var l=0;7>l;l++)a.labels[l]={abbr:c(j[l].date,this.formatDayHeader),full:c(j[l].date,"EEEE")};if(a.title=c(this.activeDate,this.formatDayTitle),a.rows=this.split(j,7),a.showWeeks){a.weekNumbers=[];for(var m=(11-this.startingDay)%7,n=a.rows.length,o=0;n>o;o++)a.weekNumbers.push(e(a.rows[o][m].date))}},this.compare=function(a,b){var c=new Date(a.getFullYear(),a.getMonth(),a.getDate()),d=new Date(b.getFullYear(),b.getMonth(),b.getDate());return c.setFullYear(a.getFullYear()),d.setFullYear(b.getFullYear()),c-d},this.handleKeyDown=function(a,b){var c=this.activeDate.getDate();if("left"===a)c-=1;else if("up"===a)c-=7;else if("right"===a)c+=1;else if("down"===a)c+=7;else if("pageup"===a||"pagedown"===a){var e=this.activeDate.getMonth()+("pageup"===a?-1:1);this.activeDate.setMonth(e,1),c=Math.min(d(this.activeDate.getFullYear(),this.activeDate.getMonth()),c)}else"home"===a?c=1:"end"===a&&(c=d(this.activeDate.getFullYear(),this.activeDate.getMonth()));this.activeDate.setDate(c)}}]).controller("UibMonthpickerController",["$scope","$element","dateFilter",function(a,b,c){this.step={years:1},this.element=b,this.init=function(a){angular.extend(a,this),a.refreshView()},this._refreshView=function(){for(var b,d=new Array(12),e=this.activeDate.getFullYear(),f=0;12>f;f++)b=new Date(this.activeDate),b.setFullYear(e,f,1),d[f]=angular.extend(this.createDateObject(b,this.formatMonth),{uid:a.uniqueId+"-"+f});a.title=c(this.activeDate,this.formatMonthTitle),a.rows=this.split(d,3)},this.compare=function(a,b){var c=new Date(a.getFullYear(),a.getMonth()),d=new Date(b.getFullYear(),b.getMonth());return c.setFullYear(a.getFullYear()),d.setFullYear(b.getFullYear()),c-d},this.handleKeyDown=function(a,b){var c=this.activeDate.getMonth();if("left"===a)c-=1;else if("up"===a)c-=3;else if("right"===a)c+=1;else if("down"===a)c+=3;else if("pageup"===a||"pagedown"===a){var d=this.activeDate.getFullYear()+("pageup"===a?-1:1);this.activeDate.setFullYear(d)}else"home"===a?c=0:"end"===a&&(c=11);this.activeDate.setMonth(c)}}]).controller("UibYearpickerController",["$scope","$element","dateFilter",function(a,b,c){function d(a){return parseInt((a-1)/f,10)*f+1}var e,f;this.element=b,this.yearpickerInit=function(){e=this.yearColumns,f=this.yearRows*e,this.step={years:f}},this._refreshView=function(){for(var b,c=new Array(f),g=0,h=d(this.activeDate.getFullYear());f>g;g++)b=new Date(this.activeDate),b.setFullYear(h+g,0,1),c[g]=angular.extend(this.createDateObject(b,this.formatYear),{uid:a.uniqueId+"-"+g});a.title=[c[0].label,c[f-1].label].join(" - "),a.rows=this.split(c,e),a.columns=e},this.compare=function(a,b){return a.getFullYear()-b.getFullYear()},this.handleKeyDown=function(a,b){var c=this.activeDate.getFullYear();"left"===a?c-=1:"up"===a?c-=e:"right"===a?c+=1:"down"===a?c+=e:"pageup"===a||"pagedown"===a?c+=("pageup"===a?-1:1)*f:"home"===a?c=d(this.activeDate.getFullYear()):"end"===a&&(c=d(this.activeDate.getFullYear())+f-1),this.activeDate.setFullYear(c)}}]).directive("uibDatepicker",function(){return{replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/datepicker.html"},scope:{datepickerMode:"=?",datepickerOptions:"=?",dateDisabled:"&",customClass:"&",shortcutPropagation:"&?"},require:["uibDatepicker","^ngModel"],controller:"UibDatepickerController",controllerAs:"datepicker",link:function(a,b,c,d){var e=d[0],f=d[1];e.init(f)}}}).directive("uibDaypicker",function(){return{replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/day.html"},require:["^uibDatepicker","uibDaypicker"],controller:"UibDaypickerController",link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("uibMonthpicker",function(){return{replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/month.html"},require:["^uibDatepicker","uibMonthpicker"],controller:"UibMonthpickerController",link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("uibYearpicker",function(){return{replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/year.html"},require:["^uibDatepicker","uibYearpicker"],controller:"UibYearpickerController",link:function(a,b,c,d){var e=d[0];angular.extend(e,d[1]),e.yearpickerInit(),e.refreshView()}}}).constant("uibDatepickerPopupConfig",{altInputFormats:[],appendToBody:!1,clearText:"Clear",closeOnDateSelection:!0,closeText:"Done",currentText:"Today",datepickerPopup:"yyyy-MM-dd",datepickerPopupTemplateUrl:"uib/template/datepicker/popup.html",datepickerTemplateUrl:"uib/template/datepicker/datepicker.html",html5Types:{date:"yyyy-MM-dd","datetime-local":"yyyy-MM-ddTHH:mm:ss.sss",month:"yyyy-MM"},onOpenFocus:!0,showButtonBar:!0}).controller("UibDatepickerPopupController",["$scope","$element","$attrs","$compile","$parse","$document","$rootScope","$uibPosition","dateFilter","uibDateParser","uibDatepickerPopupConfig","$timeout","uibDatepickerConfig",function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}function o(b){var c=j.parse(b,t,a.date);if(isNaN(c))for(var d=0;d<E.length;d++)if(c=j.parse(b,E[d],a.date),!isNaN(c))return c;return c}function p(a){if(angular.isNumber(a)&&(a=new Date(a)),!a)return null;if(angular.isDate(a)&&!isNaN(a))return a;if(angular.isString(a)){var b=o(a);if(!isNaN(b))return j.toTimezone(b,C.timezone)}return B.$options&&B.$options.allowInvalid?a:void 0}function q(a,b){var d=a||b;return c.ngRequired||d?(angular.isNumber(d)&&(d=new Date(d)),d?angular.isDate(d)&&!isNaN(d)?!0:angular.isString(d)?!isNaN(o(b)):!1:!0):!0}function r(c){if(a.isOpen||!a.disabled){var d=D[0],e=b[0].contains(c.target),f=void 0!==d.contains&&d.contains(c.target);!a.isOpen||e||f||a.$apply(function(){a.isOpen=!1})}}function s(c){27===c.which&&a.isOpen?(c.preventDefault(),c.stopPropagation(),a.$apply(function(){a.isOpen=!1}),b[0].focus()):40!==c.which||a.isOpen||(c.preventDefault(),c.stopPropagation(),a.$apply(function(){a.isOpen=!0}))}var t,u,v,w,x,y,z,A,B,C,D,E,F={},G=!1,H=[];a.watchData={},this.init=function(h){if(B=h,C=h.$options||m.ngModelOptions,u=angular.isDefined(c.closeOnDateSelection)?a.$parent.$eval(c.closeOnDateSelection):k.closeOnDateSelection,v=angular.isDefined(c.datepickerAppendToBody)?a.$parent.$eval(c.datepickerAppendToBody):k.appendToBody,w=angular.isDefined(c.onOpenFocus)?a.$parent.$eval(c.onOpenFocus):k.onOpenFocus,x=angular.isDefined(c.datepickerPopupTemplateUrl)?c.datepickerPopupTemplateUrl:k.datepickerPopupTemplateUrl,y=angular.isDefined(c.datepickerTemplateUrl)?c.datepickerTemplateUrl:k.datepickerTemplateUrl,E=angular.isDefined(c.altInputFormats)?a.$parent.$eval(c.altInputFormats):k.altInputFormats,a.showButtonBar=angular.isDefined(c.showButtonBar)?a.$parent.$eval(c.showButtonBar):k.showButtonBar,k.html5Types[c.type]?(t=k.html5Types[c.type],G=!0):(t=c.uibDatepickerPopup||k.datepickerPopup,c.$observe("uibDatepickerPopup",function(a,b){var c=a||k.datepickerPopup;if(c!==t&&(t=c,B.$modelValue=null,!t))throw new Error("uibDatepickerPopup must have a date format specified.")})),!t)throw new Error("uibDatepickerPopup must have a date format specified.");if(G&&c.uibDatepickerPopup)throw new Error("HTML5 date input types do not support custom formats.");z=angular.element("<div uib-datepicker-popup-wrap><div uib-datepicker></div></div>"),a.ngModelOptions=angular.copy(C),a.ngModelOptions.timezone=null,z.attr({"ng-model":"date","ng-model-options":"ngModelOptions","ng-change":"dateSelection(date)","template-url":x}),A=angular.element(z.children()[0]),A.attr("template-url",y),G&&"month"===c.type&&(A.attr("datepicker-mode",'"month"'),A.attr("min-mode","month")),a.datepickerOptions&&angular.forEach(a.datepickerOptions,function(a,b){-1===["minDate","maxDate","minMode","maxMode","initDate","datepickerMode"].indexOf(b)?A.attr(n(b),a):A.attr(n(b),"datepickerOptions."+b)}),angular.forEach(["minMode","maxMode","datepickerMode","shortcutPropagation"],function(b){if(c[b]){var d=e(c[b]),f={get:function(){return d(a.$parent)}};if(A.attr(n(b),"watchData."+b),"datepickerMode"===b){var g=d.assign;f.set=function(b){g(a.$parent,b)}}Object.defineProperty(a.watchData,b,f)}}),angular.forEach(["minDate","maxDate","initDate"],function(b){if(c[b]){var d=e(c[b]);H.push(a.$parent.$watch(d,function(c){"minDate"===b||"maxDate"===b?(null===c?F[b]=null:angular.isDate(c)?F[b]=j.fromTimezone(new Date(c),C.timezone):F[b]=new Date(i(c,"medium")),a.watchData[b]=null===c?null:F[b]):a.watchData[b]=j.fromTimezone(new Date(c),C.timezone)})),A.attr(n(b),"watchData."+b)}}),c.dateDisabled&&A.attr("date-disabled","dateDisabled({ date: date, mode: mode })"),angular.forEach(["formatDay","formatMonth","formatYear","formatDayHeader","formatDayTitle","formatMonthTitle","showWeeks","startingDay","yearRows","yearColumns"],function(a){angular.isDefined(c[a])&&A.attr(n(a),c[a])}),c.customClass&&A.attr("custom-class","customClass({ date: date, mode: mode })"),G?B.$formatters.push(function(b){return a.date=j.fromTimezone(b,C.timezone),b}):(B.$$parserName="date",B.$validators.date=q,B.$parsers.unshift(p),B.$formatters.push(function(b){return B.$isEmpty(b)?(a.date=b,b):(a.date=j.fromTimezone(b,C.timezone),angular.isNumber(a.date)&&(a.date=new Date(a.date)),j.filter(a.date,t))})),B.$viewChangeListeners.push(function(){a.date=o(B.$viewValue)}),b.on("keydown",s),D=d(z)(a),z.remove(),v?f.find("body").append(D):b.after(D),a.$on("$destroy",function(){for(a.isOpen===!0&&(g.$$phase||a.$apply(function(){a.isOpen=!1})),D.remove(),b.off("keydown",s),f.off("click",r);H.length;)H.shift()()})},a.getText=function(b){return a[b+"Text"]||k[b+"Text"]},a.isDisabled=function(b){return"today"===b&&(b=new Date),a.watchData.minDate&&a.compare(b,F.minDate)<0||a.watchData.maxDate&&a.compare(b,F.maxDate)>0},a.compare=function(a,b){return new Date(a.getFullYear(),a.getMonth(),a.getDate())-new Date(b.getFullYear(),b.getMonth(),b.getDate())},a.dateSelection=function(c){angular.isDefined(c)&&(a.date=c);var d=a.date?j.filter(a.date,t):null;b.val(d),B.$setViewValue(d),u&&(a.isOpen=!1,b[0].focus())},a.keydown=function(c){27===c.which&&(c.stopPropagation(),a.isOpen=!1,b[0].focus())},a.select=function(b){if("today"===b){var c=new Date;angular.isDate(a.date)?(b=new Date(a.date),b.setFullYear(c.getFullYear(),c.getMonth(),c.getDate())):b=new Date(c.setHours(0,0,0,0))}a.dateSelection(b)},a.close=function(){a.isOpen=!1,b[0].focus()},a.disabled=angular.isDefined(c.disabled)||!1,c.ngDisabled&&H.push(a.$parent.$watch(e(c.ngDisabled),function(b){a.disabled=b})),a.$watch("isOpen",function(c){c?a.disabled?a.isOpen=!1:(a.position=v?h.offset(b):h.position(b),a.position.top=a.position.top+b.prop("offsetHeight"),l(function(){w&&a.$broadcast("uib:datepicker.focus"),f.on("click",r)},0,!1)):f.off("click",r)})}]).directive("uibDatepickerPopup",function(){return{require:["ngModel","uibDatepickerPopup"],controller:"UibDatepickerPopupController",scope:{datepickerOptions:"=?",isOpen:"=?",currentText:"@",clearText:"@",closeText:"@",dateDisabled:"&",customClass:"&"},link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("uibDatepickerPopupWrap",function(){return{replace:!0,transclude:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/popup.html"}}}),angular.module("ui.bootstrap.debounce",[]).factory("$$debounce",["$timeout",function(a){return function(b,c){var d;return function(){var e=this,f=Array.prototype.slice.call(arguments);d&&a.cancel(d),d=a(function(){b.apply(e,f)},c)}}}]),angular.module("ui.bootstrap.dropdown",["ui.bootstrap.position"]).constant("uibDropdownConfig",{appendToOpenClass:"uib-dropdown-open",openClass:"open"}).service("uibDropdownService",["$document","$rootScope",function(a,b){var c=null;this.open=function(b){c||(a.on("click",d),a.on("keydown",e)),c&&c!==b&&(c.isOpen=!1),c=b},this.close=function(b){c===b&&(c=null,a.off("click",d),a.off("keydown",e))};var d=function(a){if(c&&!(a&&"disabled"===c.getAutoClose()||a&&3===a.which)){var d=c.getToggleElement();if(!(a&&d&&d[0].contains(a.target))){var e=c.getDropdownElement();a&&"outsideClick"===c.getAutoClose()&&e&&e[0].contains(a.target)||(c.isOpen=!1,b.$$phase||c.$apply())}}},e=function(a){27===a.which?(c.focusToggleElement(),d()):c.isKeynavEnabled()&&-1!==[38,40].indexOf(a.which)&&c.isOpen&&(a.preventDefault(),a.stopPropagation(),c.focusDropdownEntry(a.which))}}]).controller("UibDropdownController",["$scope","$element","$attrs","$parse","uibDropdownConfig","uibDropdownService","$animate","$uibPosition","$document","$compile","$templateRequest",function(a,b,c,d,e,f,g,h,i,j,k){var l,m,n=this,o=a.$new(),p=e.appendToOpenClass,q=e.openClass,r=angular.noop,s=c.onToggle?d(c.onToggle):angular.noop,t=!1,u=null,v=!1,w=i.find("body");b.addClass("dropdown"),this.init=function(){if(c.isOpen&&(m=d(c.isOpen),r=m.assign,a.$watch(m,function(a){o.isOpen=!!a})),angular.isDefined(c.dropdownAppendTo)){var e=d(c.dropdownAppendTo)(o);e&&(u=angular.element(e))}t=angular.isDefined(c.dropdownAppendToBody),v=angular.isDefined(c.keyboardNav),t&&!u&&(u=w),u&&n.dropdownMenu&&(u.append(n.dropdownMenu),b.on("$destroy",function(){n.dropdownMenu.remove()}))},this.toggle=function(a){return o.isOpen=arguments.length?!!a:!o.isOpen},this.isOpen=function(){return o.isOpen},o.getToggleElement=function(){return n.toggleElement},o.getAutoClose=function(){return c.autoClose||"always"},o.getElement=function(){return b},o.isKeynavEnabled=function(){return v},o.focusDropdownEntry=function(a){var c=n.dropdownMenu?angular.element(n.dropdownMenu).find("a"):b.find("ul").eq(0).find("a");switch(a){case 40:angular.isNumber(n.selectedOption)?n.selectedOption=n.selectedOption===c.length-1?n.selectedOption:n.selectedOption+1:n.selectedOption=0;break;case 38:angular.isNumber(n.selectedOption)?n.selectedOption=0===n.selectedOption?0:n.selectedOption-1:n.selectedOption=c.length-1}c[n.selectedOption].focus()},o.getDropdownElement=function(){return n.dropdownMenu},o.focusToggleElement=function(){n.toggleElement&&n.toggleElement[0].focus()},o.$watch("isOpen",function(c,d){if(u&&n.dropdownMenu){var e,i,m=h.positionElements(b,n.dropdownMenu,"bottom-left",!0);if(e={top:m.top+"px",display:c?"block":"none"},i=n.dropdownMenu.hasClass("dropdown-menu-right"),i?(e.left="auto",e.right=window.innerWidth-(m.left+b.prop("offsetWidth"))+"px"):(e.left=m.left+"px",e.right="auto"),!t){var v=h.offset(u);e.top=m.top-v.top+"px",i?e.right=window.innerWidth-(m.left-v.left+b.prop("offsetWidth"))+"px":e.left=m.left-v.left+"px"}n.dropdownMenu.css(e)}var w=u?u:b;if(g[c?"addClass":"removeClass"](w,u?p:q).then(function(){angular.isDefined(c)&&c!==d&&s(a,{open:!!c})}),c)n.dropdownMenuTemplateUrl&&k(n.dropdownMenuTemplateUrl).then(function(a){l=o.$new(),j(a.trim())(l,function(a){var b=a;n.dropdownMenu.replaceWith(b),n.dropdownMenu=b})}),o.focusToggleElement(),f.open(o);else{if(n.dropdownMenuTemplateUrl){l&&l.$destroy();var x=angular.element('<ul class="dropdown-menu"></ul>');n.dropdownMenu.replaceWith(x),n.dropdownMenu=x}f.close(o),n.selectedOption=null}angular.isFunction(r)&&r(a,c)}),a.$on("$locationChangeSuccess",function(){"disabled"!==o.getAutoClose()&&(o.isOpen=!1)})}]).directive("uibDropdown",function(){return{controller:"UibDropdownController",link:function(a,b,c,d){d.init()}}}).directive("uibDropdownMenu",function(){return{restrict:"A",require:"?^uibDropdown",link:function(a,b,c,d){if(d&&!angular.isDefined(c.dropdownNested)){b.addClass("dropdown-menu");var e=c.templateUrl;e&&(d.dropdownMenuTemplateUrl=e),d.dropdownMenu||(d.dropdownMenu=b)}}}}).directive("uibDropdownToggle",function(){return{require:"?^uibDropdown",link:function(a,b,c,d){if(d){b.addClass("dropdown-toggle"),d.toggleElement=b;var e=function(e){e.preventDefault(),b.hasClass("disabled")||c.disabled||a.$apply(function(){d.toggle()})};b.bind("click",e),b.attr({"aria-haspopup":!0,"aria-expanded":!1}),a.$watch(d.isOpen,function(a){b.attr("aria-expanded",!!a)}),a.$on("$destroy",function(){b.unbind("click",e)})}}}}),angular.module("ui.bootstrap.stackedMap",[]).factory("$$stackedMap",function(){return{createNew:function(){var a=[];return{add:function(b,c){a.push({key:b,value:c})},get:function(b){for(var c=0;c<a.length;c++)if(b===a[c].key)return a[c]},keys:function(){for(var b=[],c=0;c<a.length;c++)b.push(a[c].key);return b},top:function(){return a[a.length-1]},remove:function(b){for(var c=-1,d=0;d<a.length;d++)if(b===a[d].key){c=d;break}return a.splice(c,1)[0]},removeTop:function(){return a.splice(a.length-1,1)[0]},length:function(){return a.length}}}}}),angular.module("ui.bootstrap.modal",["ui.bootstrap.stackedMap"]).factory("$$multiMap",function(){return{createNew:function(){var a={};return{entries:function(){return Object.keys(a).map(function(b){return{key:b,value:a[b]}})},get:function(b){return a[b]},hasKey:function(b){return!!a[b]},keys:function(){return Object.keys(a)},put:function(b,c){a[b]||(a[b]=[]),a[b].push(c)},remove:function(b,c){var d=a[b];if(d){var e=d.indexOf(c);-1!==e&&d.splice(e,1),d.length||delete a[b]}}}}}}).provider("$uibResolve",function(){var a=this;this.resolver=null,this.setResolver=function(a){this.resolver=a},this.$get=["$injector","$q",function(b,c){var d=a.resolver?b.get(a.resolver):null;return{resolve:function(a,e,f,g){if(d)return d.resolve(a,e,f,g);var h=[];return angular.forEach(a,function(a){angular.isFunction(a)||angular.isArray(a)?h.push(c.resolve(b.invoke(a))):angular.isString(a)?h.push(c.resolve(b.get(a))):h.push(c.resolve(a))}),c.all(h).then(function(b){var c={},d=0;return angular.forEach(a,function(a,e){c[e]=b[d++]}),c})}}}]}).directive("uibModalBackdrop",["$animateCss","$injector","$uibModalStack",function(a,b,c){function d(b,d,e){e.modalInClass&&(a(d,{addClass:e.modalInClass}).start(),b.$on(c.NOW_CLOSING_EVENT,function(c,f){var g=f();b.modalOptions.animation?a(d,{removeClass:e.modalInClass}).start().then(g):g()}))}return{replace:!0,templateUrl:"uib/template/modal/backdrop.html",compile:function(a,b){return a.addClass(b.backdropClass),d}}}]).directive("uibModalWindow",["$uibModalStack","$q","$animate","$animateCss","$document",function(a,b,c,d,e){return{scope:{index:"@"},replace:!0,transclude:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/modal/window.html"},link:function(f,g,h){g.addClass(h.windowClass||""),g.addClass(h.windowTopClass||""),f.size=h.size,f.close=function(b){var c=a.getTop();c&&c.value.backdrop&&"static"!==c.value.backdrop&&b.target===b.currentTarget&&(b.preventDefault(),b.stopPropagation(),a.dismiss(c.key,"backdrop click"))},g.on("click",f.close),f.$isRendered=!0;var i=b.defer();h.$observe("modalRender",function(a){"true"===a&&i.resolve()}),i.promise.then(function(){var i=null;h.modalInClass&&(i=d(g,{addClass:h.modalInClass}).start(),f.$on(a.NOW_CLOSING_EVENT,function(a,b){var e=b();d?d(g,{removeClass:h.modalInClass}).start().then(e):c.removeClass(g,h.modalInClass).then(e)})),b.when(i).then(function(){if(!e[0].activeElement||!g[0].contains(e[0].activeElement)){var a=g[0].querySelector("[autofocus]");a?a.focus():g[0].focus()}});var j=a.getTop();j&&a.modalRendered(j.key)})}}}]).directive("uibModalAnimationClass",function(){return{compile:function(a,b){b.modalAnimation&&a.addClass(b.uibModalAnimationClass)}}}).directive("uibModalTransclude",function(){return{link:function(a,b,c,d,e){e(a.$parent,function(a){b.empty(),b.append(a)})}}}).factory("$uibModalStack",["$animate","$animateCss","$document","$compile","$rootScope","$q","$$multiMap","$$stackedMap",function(a,b,c,d,e,f,g,h){function i(){for(var a=-1,b=t.keys(),c=0;c<b.length;c++)t.get(b[c]).value.backdrop&&(a=c);return a}function j(a,b){var c=t.get(a).value,d=c.appendTo;t.remove(a),m(c.modalDomEl,c.modalScope,function(){var b=c.openedClass||s;u.remove(b,a),d.toggleClass(b,u.hasKey(b)),k(!0)},c.closedDeferred),l(),b&&b.focus?b.focus():d.focus&&d.focus()}function k(a){var b;t.length()>0&&(b=t.top().value,b.modalDomEl.toggleClass(b.windowTopClass||"",a))}function l(){if(p&&-1===i()){var a=q;m(p,q,function(){a=null}),p=void 0,q=void 0}}function m(a,c,d,e){function g(){g.done||(g.done=!0,b(a,{event:"leave"}).start().then(function(){a.remove(),e&&e.resolve()}),c.$destroy(),d&&d())}var h,i=null,j=function(){return h||(h=f.defer(),i=h.promise),function(){h.resolve()}};return c.$broadcast(v.NOW_CLOSING_EVENT,j),f.when(i).then(g)}function n(a){if(a.isDefaultPrevented())return a;var b=t.top();if(b)switch(a.which){case 27:b.value.keyboard&&(a.preventDefault(),e.$apply(function(){v.dismiss(b.key,"escape key press")}));break;case 9:v.loadFocusElementList(b);var c=!1;a.shiftKey?(v.isFocusInFirstItem(a)||v.isModalFocused(a,b))&&(c=v.focusLastFocusableElement()):v.isFocusInLastItem(a)&&(c=v.focusFirstFocusableElement()),c&&(a.preventDefault(),a.stopPropagation())}}function o(a,b,c){return!a.value.modalScope.$broadcast("modal.closing",b,c).defaultPrevented}var p,q,r,s="modal-open",t=h.createNew(),u=g.createNew(),v={NOW_CLOSING_EVENT:"modal.stack.now-closing"},w=0,x="a[href], area[href], input:not([disabled]), button:not([disabled]),select:not([disabled]), textarea:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable=true]";return e.$watch(i,function(a){q&&(q.index=a)}),c.on("keydown",n),e.$on("$destroy",function(){c.off("keydown",n)}),v.open=function(b,f){var g=c[0].activeElement,h=f.openedClass||s;k(!1),t.add(b,{deferred:f.deferred,renderDeferred:f.renderDeferred,closedDeferred:f.closedDeferred,modalScope:f.scope,backdrop:f.backdrop,keyboard:f.keyboard,openedClass:f.openedClass,windowTopClass:f.windowTopClass,animation:f.animation,appendTo:f.appendTo}),u.put(h,b);var j=f.appendTo,l=i();if(!j.length)throw new Error("appendTo element not found. Make sure that the element passed is in DOM.");l>=0&&!p&&(q=e.$new(!0),q.modalOptions=f,q.index=l,p=angular.element('<div uib-modal-backdrop="modal-backdrop"></div>'),p.attr("backdrop-class",f.backdropClass),f.animation&&p.attr("modal-animation","true"),d(p)(q),a.enter(p,j));var m=angular.element('<div uib-modal-window="modal-window"></div>');m.attr({"template-url":f.windowTemplateUrl,"window-class":f.windowClass,"window-top-class":f.windowTopClass,size:f.size,index:t.length()-1,animate:"animate"}).html(f.content),f.animation&&m.attr("modal-animation","true"),a.enter(d(m)(f.scope),j).then(function(){a.addClass(j,h)}),t.top().value.modalDomEl=m,t.top().value.modalOpener=g,v.clearFocusListCache()},v.close=function(a,b){var c=t.get(a);return c&&o(c,b,!0)?(c.value.modalScope.$$uibDestructionScheduled=!0,c.value.deferred.resolve(b),j(a,c.value.modalOpener),!0):!c},v.dismiss=function(a,b){var c=t.get(a);return c&&o(c,b,!1)?(c.value.modalScope.$$uibDestructionScheduled=!0,c.value.deferred.reject(b),j(a,c.value.modalOpener),!0):!c},v.dismissAll=function(a){for(var b=this.getTop();b&&this.dismiss(b.key,a);)b=this.getTop()},v.getTop=function(){return t.top()},v.modalRendered=function(a){var b=t.get(a);b&&b.value.renderDeferred.resolve()},v.focusFirstFocusableElement=function(){return r.length>0?(r[0].focus(),!0):!1},v.focusLastFocusableElement=function(){return r.length>0?(r[r.length-1].focus(),!0):!1},v.isModalFocused=function(a,b){if(a&&b){var c=b.value.modalDomEl;if(c&&c.length)return(a.target||a.srcElement)===c[0]}return!1},v.isFocusInFirstItem=function(a){return r.length>0?(a.target||a.srcElement)===r[0]:!1},v.isFocusInLastItem=function(a){return r.length>0?(a.target||a.srcElement)===r[r.length-1]:!1},v.clearFocusListCache=function(){r=[],w=0},v.loadFocusElementList=function(a){if((void 0===r||!r.length)&&a){var b=a.value.modalDomEl;b&&b.length&&(r=b[0].querySelectorAll(x))}},v}]).provider("$uibModal",function(){var a={options:{animation:!0,backdrop:!0,keyboard:!0},$get:["$rootScope","$q","$document","$templateRequest","$controller","$uibResolve","$uibModalStack",function(b,c,d,e,f,g,h){function i(a){return a.template?c.when(a.template):e(angular.isFunction(a.templateUrl)?a.templateUrl():a.templateUrl)}var j={},k=null;return j.getPromiseChain=function(){return k},j.open=function(e){function j(){return r}var l=c.defer(),m=c.defer(),n=c.defer(),o=c.defer(),p={result:l.promise,opened:m.promise,closed:n.promise,rendered:o.promise,close:function(a){return h.close(p,a)},dismiss:function(a){return h.dismiss(p,a)}};if(e=angular.extend({},a.options,e),e.resolve=e.resolve||{},e.appendTo=e.appendTo||d.find("body").eq(0),!e.template&&!e.templateUrl)throw new Error("One of template or templateUrl options is required.");var q,r=c.all([i(e),g.resolve(e.resolve,{},null,null)]);return q=k=c.all([k]).then(j,j).then(function(a){var c=e.scope||b,d=c.$new();d.$close=p.close,d.$dismiss=p.dismiss,d.$on("$destroy",function(){d.$$uibDestructionScheduled||d.$dismiss("$uibUnscheduledDestruction")});var g,i={};e.controller&&(i.$scope=d,i.$uibModalInstance=p,angular.forEach(a[1],function(a,b){i[b]=a}),g=f(e.controller,i),e.controllerAs&&(e.bindToController&&(g.$close=d.$close,g.$dismiss=d.$dismiss,angular.extend(g,c)),d[e.controllerAs]=g)),h.open(p,{scope:d,deferred:l,renderDeferred:o,closedDeferred:n,content:a[0],animation:e.animation,backdrop:e.backdrop,keyboard:e.keyboard,backdropClass:e.backdropClass,windowTopClass:e.windowTopClass,windowClass:e.windowClass,windowTemplateUrl:e.windowTemplateUrl,size:e.size,openedClass:e.openedClass,appendTo:e.appendTo}),m.resolve(!0)},function(a){m.reject(a),l.reject(a)})["finally"](function(){k===q&&(k=null)}),p},j}]};return a}),angular.module("ui.bootstrap.paging",[]).factory("uibPaging",["$parse",function(a){return{create:function(b,c,d){b.setNumPages=d.numPages?a(d.numPages).assign:angular.noop,b.ngModelCtrl={$setViewValue:angular.noop},b._watchers=[],b.init=function(e,f){b.ngModelCtrl=e,b.config=f,e.$render=function(){b.render()},d.itemsPerPage?b._watchers.push(c.$parent.$watch(a(d.itemsPerPage),function(a){b.itemsPerPage=parseInt(a,10),c.totalPages=b.calculateTotalPages(),b.updatePage()})):b.itemsPerPage=f.itemsPerPage,c.$watch("totalItems",function(a,d){(angular.isDefined(a)||a!==d)&&(c.totalPages=b.calculateTotalPages(),b.updatePage())})},b.calculateTotalPages=function(){var a=b.itemsPerPage<1?1:Math.ceil(c.totalItems/b.itemsPerPage);return Math.max(a||0,1)},b.render=function(){c.page=parseInt(b.ngModelCtrl.$viewValue,10)||1},c.selectPage=function(a,d){d&&d.preventDefault();var e=!c.ngDisabled||!d;e&&c.page!==a&&a>0&&a<=c.totalPages&&(d&&d.target&&d.target.blur(),b.ngModelCtrl.$setViewValue(a),b.ngModelCtrl.$render())},c.getText=function(a){return c[a+"Text"]||b.config[a+"Text"]},c.noPrevious=function(){return 1===c.page},c.noNext=function(){return c.page===c.totalPages},b.updatePage=function(){b.setNumPages(c.$parent,c.totalPages),c.page>c.totalPages?c.selectPage(c.totalPages):b.ngModelCtrl.$render()},c.$on("$destroy",function(){for(;b._watchers.length;)b._watchers.shift()()})}}}]),angular.module("ui.bootstrap.pager",["ui.bootstrap.paging"]).controller("UibPagerController",["$scope","$attrs","uibPaging","uibPagerConfig",function(a,b,c,d){a.align=angular.isDefined(b.align)?a.$parent.$eval(b.align):d.align,c.create(this,a,b)}]).constant("uibPagerConfig",{itemsPerPage:10,previousText:"« Previous",nextText:"Next »",align:!0}).directive("uibPager",["uibPagerConfig",function(a){return{scope:{totalItems:"=",previousText:"@",nextText:"@",ngDisabled:"="},require:["uibPager","?ngModel"],controller:"UibPagerController",controllerAs:"pager",templateUrl:function(a,b){return b.templateUrl||"uib/template/pager/pager.html"},replace:!0,link:function(b,c,d,e){var f=e[0],g=e[1];g&&f.init(g,a)}}}]),angular.module("ui.bootstrap.pagination",["ui.bootstrap.paging"]).controller("UibPaginationController",["$scope","$attrs","$parse","uibPaging","uibPaginationConfig",function(a,b,c,d,e){function f(a,b,c){return{number:a,text:b,active:c}}function g(a,b){var c=[],d=1,e=b,g=angular.isDefined(i)&&b>i;g&&(j?(d=Math.max(a-Math.floor(i/2),1),e=d+i-1,e>b&&(e=b,d=e-i+1)):(d=(Math.ceil(a/i)-1)*i+1,e=Math.min(d+i-1,b)));for(var h=d;e>=h;h++){var m=f(h,h,h===a);c.push(m)}if(g&&i>0&&(!j||k||l)){if(d>1){if(!l||d>3){var n=f(d-1,"...",!1);c.unshift(n)}if(l){if(3===d){var o=f(2,"2",!1);c.unshift(o)}var p=f(1,"1",!1);c.unshift(p)}}if(b>e){if(!l||b-2>e){var q=f(e+1,"...",!1);c.push(q)}if(l){if(e===b-2){var r=f(b-1,b-1,!1);c.push(r)}var s=f(b,b,!1);c.push(s)}}}return c}var h=this,i=angular.isDefined(b.maxSize)?a.$parent.$eval(b.maxSize):e.maxSize,j=angular.isDefined(b.rotate)?a.$parent.$eval(b.rotate):e.rotate,k=angular.isDefined(b.forceEllipses)?a.$parent.$eval(b.forceEllipses):e.forceEllipses,l=angular.isDefined(b.boundaryLinkNumbers)?a.$parent.$eval(b.boundaryLinkNumbers):e.boundaryLinkNumbers;a.boundaryLinks=angular.isDefined(b.boundaryLinks)?a.$parent.$eval(b.boundaryLinks):e.boundaryLinks,a.directionLinks=angular.isDefined(b.directionLinks)?a.$parent.$eval(b.directionLinks):e.directionLinks,d.create(this,a,b),b.maxSize&&h._watchers.push(a.$parent.$watch(c(b.maxSize),function(a){i=parseInt(a,10),h.render()}));var m=this.render;this.render=function(){m(),a.page>0&&a.page<=a.totalPages&&(a.pages=g(a.page,a.totalPages))}}]).constant("uibPaginationConfig",{itemsPerPage:10,boundaryLinks:!1,boundaryLinkNumbers:!1,directionLinks:!0,firstText:"First",previousText:"Previous",nextText:"Next",lastText:"Last",rotate:!0,forceEllipses:!1}).directive("uibPagination",["$parse","uibPaginationConfig",function(a,b){return{scope:{totalItems:"=",firstText:"@",previousText:"@",nextText:"@",lastText:"@",ngDisabled:"="},require:["uibPagination","?ngModel"],controller:"UibPaginationController",controllerAs:"pagination",templateUrl:function(a,b){return b.templateUrl||"uib/template/pagination/pagination.html"},replace:!0,link:function(a,c,d,e){var f=e[0],g=e[1];g&&f.init(g,b)}}}]),angular.module("ui.bootstrap.tooltip",["ui.bootstrap.position","ui.bootstrap.stackedMap"]).provider("$uibTooltip",function(){function a(a){var b=/[A-Z]/g,c="-";return a.replace(b,function(a,b){return(b?c:"")+a.toLowerCase()})}var b={placement:"top",placementClassPrefix:"",animation:!0,popupDelay:0,popupCloseDelay:0,useContentExp:!1},c={mouseenter:"mouseleave",click:"click",outsideClick:"outsideClick",focus:"blur",none:""},d={};this.options=function(a){angular.extend(d,a)},this.setTriggers=function(a){angular.extend(c,a)},this.$get=["$window","$compile","$timeout","$document","$uibPosition","$interpolate","$rootScope","$parse","$$stackedMap",function(e,f,g,h,i,j,k,l,m){function n(a){if(27===a.which){var b=o.top();b&&(b.value.close(),o.removeTop(),b=null)}}var o=m.createNew();return h.on("keypress",n),k.$on("$destroy",function(){h.off("keypress",n)}),function(e,k,m,n){function p(a){var b=(a||n.trigger||m).split(" "),d=b.map(function(a){return c[a]||a});return{show:b,hide:d}}n=angular.extend({},b,d,n);var q=a(e),r=j.startSymbol(),s=j.endSymbol(),t="<div "+q+'-popup title="'+r+"title"+s+'" '+(n.useContentExp?'content-exp="contentExp()" ':'content="'+r+"content"+s+'" ')+'placement="'+r+"placement"+s+'" popup-class="'+r+"popupClass"+s+'" animation="animation" is-open="isOpen"origin-scope="origScope" style="visibility: hidden; display: block; top: -9999px; left: -9999px;"></div>';return{compile:function(a,b){var c=f(t);return function(a,b,d,f){function j(){M.isOpen?q():m()}function m(){(!L||a.$eval(d[k+"Enable"]))&&(u(),x(),M.popupDelay?G||(G=g(r,M.popupDelay,!1)):r())}function q(){s(),M.popupCloseDelay?H||(H=g(t,M.popupCloseDelay,!1)):t()}function r(){return s(),u(),M.content?(v(),void M.$evalAsync(function(){M.isOpen=!0,y(!0),R()})):angular.noop}function s(){G&&(g.cancel(G),G=null),I&&(g.cancel(I),I=null)}function t(){M&&M.$evalAsync(function(){M&&(M.isOpen=!1,y(!1),M.animation?F||(F=g(w,150,!1)):w())})}function u(){H&&(g.cancel(H),H=null),F&&(g.cancel(F),F=null)}function v(){D||(E=M.$new(),D=c(E,function(a){J?h.find("body").append(a):b.after(a);
+}),z())}function w(){s(),u(),A(),D&&(D.remove(),D=null),E&&(E.$destroy(),E=null)}function x(){M.title=d[k+"Title"],P?M.content=P(a):M.content=d[e],M.popupClass=d[k+"Class"],M.placement=angular.isDefined(d[k+"Placement"])?d[k+"Placement"]:n.placement;var b=parseInt(d[k+"PopupDelay"],10),c=parseInt(d[k+"PopupCloseDelay"],10);M.popupDelay=isNaN(b)?n.popupDelay:b,M.popupCloseDelay=isNaN(c)?n.popupCloseDelay:c}function y(b){O&&angular.isFunction(O.assign)&&O.assign(a,b)}function z(){Q.length=0,P?(Q.push(a.$watch(P,function(a){M.content=a,!a&&M.isOpen&&t()})),Q.push(E.$watch(function(){N||(N=!0,E.$$postDigest(function(){N=!1,M&&M.isOpen&&R()}))}))):Q.push(d.$observe(e,function(a){M.content=a,!a&&M.isOpen?t():R()})),Q.push(d.$observe(k+"Title",function(a){M.title=a,M.isOpen&&R()})),Q.push(d.$observe(k+"Placement",function(a){M.placement=a?a:n.placement,M.isOpen&&R()}))}function A(){Q.length&&(angular.forEach(Q,function(a){a()}),Q.length=0)}function B(a){M&&M.isOpen&&D&&(b[0].contains(a.target)||D[0].contains(a.target)||q())}function C(){var a=d[k+"Trigger"];S(),K=p(a),"none"!==K.show&&K.show.forEach(function(a,c){"outsideClick"===a?(b.on("click",j),h.on("click",B)):a===K.hide[c]?b.on(a,j):a&&(b.on(a,m),b.on(K.hide[c],q)),b.on("keypress",function(a){27===a.which&&q()})})}var D,E,F,G,H,I,J=angular.isDefined(n.appendToBody)?n.appendToBody:!1,K=p(void 0),L=angular.isDefined(d[k+"Enable"]),M=a.$new(!0),N=!1,O=angular.isDefined(d[k+"IsOpen"])?l(d[k+"IsOpen"]):!1,P=n.useContentExp?l(d[e]):!1,Q=[],R=function(){D&&D.html()&&(I||(I=g(function(){D.css({top:0,left:0});var a=i.positionElements(b,D,M.placement,J);D.css({top:a.top+"px",left:a.left+"px",visibility:"visible"}),n.placementClassPrefix&&D.removeClass("top bottom left right"),D.removeClass(n.placementClassPrefix+"top "+n.placementClassPrefix+"top-left "+n.placementClassPrefix+"top-right "+n.placementClassPrefix+"bottom "+n.placementClassPrefix+"bottom-left "+n.placementClassPrefix+"bottom-right "+n.placementClassPrefix+"left "+n.placementClassPrefix+"left-top "+n.placementClassPrefix+"left-bottom "+n.placementClassPrefix+"right "+n.placementClassPrefix+"right-top "+n.placementClassPrefix+"right-bottom");var c=a.placement.split("-");D.addClass(c[0]+" "+n.placementClassPrefix+a.placement),i.positionArrow(D,a.placement),I=null},0,!1)))};M.origScope=a,M.isOpen=!1,o.add(M,{close:t}),M.contentExp=function(){return M.content},d.$observe("disabled",function(a){a&&s(),a&&M.isOpen&&t()}),O&&a.$watch(O,function(a){M&&!a===M.isOpen&&j()});var S=function(){K.show.forEach(function(a){"outsideClick"===a?b.off("click",j):(b.off(a,m),b.off(a,j))}),K.hide.forEach(function(a){"outsideClick"===a?h.off("click",B):b.off(a,q)})};C();var T=a.$eval(d[k+"Animation"]);M.animation=angular.isDefined(T)?!!T:n.animation;var U,V=k+"AppendToBody";U=V in d&&void 0===d[V]?!0:a.$eval(d[V]),J=angular.isDefined(U)?U:J,a.$on("$destroy",function(){S(),w(),o.remove(M),M=null})}}}}}]}).directive("uibTooltipTemplateTransclude",["$animate","$sce","$compile","$templateRequest",function(a,b,c,d){return{link:function(e,f,g){var h,i,j,k=e.$eval(g.tooltipTemplateTranscludeScope),l=0,m=function(){i&&(i.remove(),i=null),h&&(h.$destroy(),h=null),j&&(a.leave(j).then(function(){i=null}),i=j,j=null)};e.$watch(b.parseAsResourceUrl(g.uibTooltipTemplateTransclude),function(b){var g=++l;b?(d(b,!0).then(function(d){if(g===l){var e=k.$new(),i=d,n=c(i)(e,function(b){m(),a.enter(b,f)});h=e,j=n,h.$emit("$includeContentLoaded",b)}},function(){g===l&&(m(),e.$emit("$includeContentError",b))}),e.$emit("$includeContentRequested",b)):m()}),e.$on("$destroy",m)}}}]).directive("uibTooltipClasses",["$uibPosition",function(a){return{restrict:"A",link:function(b,c,d){if(b.placement){var e=a.parsePlacement(b.placement);c.addClass(e[0])}else c.addClass("top");b.popupClass&&c.addClass(b.popupClass),b.animation()&&c.addClass(d.tooltipAnimationClass)}}}]).directive("uibTooltipPopup",function(){return{replace:!0,scope:{content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/tooltip/tooltip-popup.html"}}).directive("uibTooltip",["$uibTooltip",function(a){return a("uibTooltip","tooltip","mouseenter")}]).directive("uibTooltipTemplatePopup",function(){return{replace:!0,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"uib/template/tooltip/tooltip-template-popup.html"}}).directive("uibTooltipTemplate",["$uibTooltip",function(a){return a("uibTooltipTemplate","tooltip","mouseenter",{useContentExp:!0})}]).directive("uibTooltipHtmlPopup",function(){return{replace:!0,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/tooltip/tooltip-html-popup.html"}}).directive("uibTooltipHtml",["$uibTooltip",function(a){return a("uibTooltipHtml","tooltip","mouseenter",{useContentExp:!0})}]),angular.module("ui.bootstrap.popover",["ui.bootstrap.tooltip"]).directive("uibPopoverTemplatePopup",function(){return{replace:!0,scope:{title:"@",contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"uib/template/popover/popover-template.html"}}).directive("uibPopoverTemplate",["$uibTooltip",function(a){return a("uibPopoverTemplate","popover","click",{useContentExp:!0})}]).directive("uibPopoverHtmlPopup",function(){return{replace:!0,scope:{contentExp:"&",title:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/popover/popover-html.html"}}).directive("uibPopoverHtml",["$uibTooltip",function(a){return a("uibPopoverHtml","popover","click",{useContentExp:!0})}]).directive("uibPopoverPopup",function(){return{replace:!0,scope:{title:"@",content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/popover/popover.html"}}).directive("uibPopover",["$uibTooltip",function(a){return a("uibPopover","popover","click")}]),angular.module("ui.bootstrap.progressbar",[]).constant("uibProgressConfig",{animate:!0,max:100}).controller("UibProgressController",["$scope","$attrs","uibProgressConfig",function(a,b,c){var d=this,e=angular.isDefined(b.animate)?a.$parent.$eval(b.animate):c.animate;this.bars=[],a.max=angular.isDefined(a.max)?a.max:c.max,this.addBar=function(b,c,f){e||c.css({transition:"none"}),this.bars.push(b),b.max=a.max,b.title=f&&angular.isDefined(f.title)?f.title:"progressbar",b.$watch("value",function(a){b.recalculatePercentage()}),b.recalculatePercentage=function(){var a=d.bars.reduce(function(a,b){return b.percent=+(100*b.value/b.max).toFixed(2),a+b.percent},0);a>100&&(b.percent-=a-100)},b.$on("$destroy",function(){c=null,d.removeBar(b)})},this.removeBar=function(a){this.bars.splice(this.bars.indexOf(a),1),this.bars.forEach(function(a){a.recalculatePercentage()})},a.$watch("max",function(b){d.bars.forEach(function(b){b.max=a.max,b.recalculatePercentage()})})}]).directive("uibProgress",function(){return{replace:!0,transclude:!0,controller:"UibProgressController",require:"uibProgress",scope:{max:"=?"},templateUrl:"uib/template/progressbar/progress.html"}}).directive("uibBar",function(){return{replace:!0,transclude:!0,require:"^uibProgress",scope:{value:"=",type:"@"},templateUrl:"uib/template/progressbar/bar.html",link:function(a,b,c,d){d.addBar(a,b,c)}}}).directive("uibProgressbar",function(){return{replace:!0,transclude:!0,controller:"UibProgressController",scope:{value:"=",max:"=?",type:"@"},templateUrl:"uib/template/progressbar/progressbar.html",link:function(a,b,c,d){d.addBar(a,angular.element(b.children()[0]),{title:c.title})}}}),angular.module("ui.bootstrap.rating",[]).constant("uibRatingConfig",{max:5,stateOn:null,stateOff:null,titles:["one","two","three","four","five"]}).controller("UibRatingController",["$scope","$attrs","uibRatingConfig",function(a,b,c){var d={$setViewValue:angular.noop};this.init=function(e){d=e,d.$render=this.render,d.$formatters.push(function(a){return angular.isNumber(a)&&a<<0!==a&&(a=Math.round(a)),a}),this.stateOn=angular.isDefined(b.stateOn)?a.$parent.$eval(b.stateOn):c.stateOn,this.stateOff=angular.isDefined(b.stateOff)?a.$parent.$eval(b.stateOff):c.stateOff;var f=angular.isDefined(b.titles)?a.$parent.$eval(b.titles):c.titles;this.titles=angular.isArray(f)&&f.length>0?f:c.titles;var g=angular.isDefined(b.ratingStates)?a.$parent.$eval(b.ratingStates):new Array(angular.isDefined(b.max)?a.$parent.$eval(b.max):c.max);a.range=this.buildTemplateObjects(g)},this.buildTemplateObjects=function(a){for(var b=0,c=a.length;c>b;b++)a[b]=angular.extend({index:b},{stateOn:this.stateOn,stateOff:this.stateOff,title:this.getTitle(b)},a[b]);return a},this.getTitle=function(a){return a>=this.titles.length?a+1:this.titles[a]},a.rate=function(b){!a.readonly&&b>=0&&b<=a.range.length&&(d.$setViewValue(d.$viewValue===b?0:b),d.$render())},a.enter=function(b){a.readonly||(a.value=b),a.onHover({value:b})},a.reset=function(){a.value=d.$viewValue,a.onLeave()},a.onKeydown=function(b){/(37|38|39|40)/.test(b.which)&&(b.preventDefault(),b.stopPropagation(),a.rate(a.value+(38===b.which||39===b.which?1:-1)))},this.render=function(){a.value=d.$viewValue}}]).directive("uibRating",function(){return{require:["uibRating","ngModel"],scope:{readonly:"=?",onHover:"&",onLeave:"&"},controller:"UibRatingController",templateUrl:"uib/template/rating/rating.html",replace:!0,link:function(a,b,c,d){var e=d[0],f=d[1];e.init(f)}}}),angular.module("ui.bootstrap.tabs",[]).controller("UibTabsetController",["$scope",function(a){var b=this,c=b.tabs=a.tabs=[];b.select=function(a){angular.forEach(c,function(b){b.active&&b!==a&&(b.active=!1,b.onDeselect(),a.selectCalled=!1)}),a.active=!0,a.selectCalled||(a.onSelect(),a.selectCalled=!0)},b.addTab=function(a){c.push(a),1===c.length&&a.active!==!1?a.active=!0:a.active?b.select(a):a.active=!1},b.removeTab=function(a){var e=c.indexOf(a);if(a.active&&c.length>1&&!d){var f=e===c.length-1?e-1:e+1;b.select(c[f])}c.splice(e,1)};var d;a.$on("$destroy",function(){d=!0})}]).directive("uibTabset",function(){return{transclude:!0,replace:!0,scope:{type:"@"},controller:"UibTabsetController",templateUrl:"uib/template/tabs/tabset.html",link:function(a,b,c){a.vertical=angular.isDefined(c.vertical)?a.$parent.$eval(c.vertical):!1,a.justified=angular.isDefined(c.justified)?a.$parent.$eval(c.justified):!1}}}).directive("uibTab",["$parse",function(a){return{require:"^uibTabset",replace:!0,templateUrl:"uib/template/tabs/tab.html",transclude:!0,scope:{active:"=?",heading:"@",onSelect:"&select",onDeselect:"&deselect"},controller:function(){},controllerAs:"tab",link:function(b,c,d,e,f){b.$watch("active",function(a){a&&e.select(b)}),b.disabled=!1,d.disable&&b.$parent.$watch(a(d.disable),function(a){b.disabled=!!a}),b.select=function(){b.disabled||(b.active=!0)},e.addTab(b),b.$on("$destroy",function(){e.removeTab(b)}),b.$transcludeFn=f}}}]).directive("uibTabHeadingTransclude",function(){return{restrict:"A",require:"^uibTab",link:function(a,b){a.$watch("headingElement",function(a){a&&(b.html(""),b.append(a))})}}}).directive("uibTabContentTransclude",function(){function a(a){return a.tagName&&(a.hasAttribute("uib-tab-heading")||a.hasAttribute("data-uib-tab-heading")||a.hasAttribute("x-uib-tab-heading")||"uib-tab-heading"===a.tagName.toLowerCase()||"data-uib-tab-heading"===a.tagName.toLowerCase()||"x-uib-tab-heading"===a.tagName.toLowerCase())}return{restrict:"A",require:"^uibTabset",link:function(b,c,d){var e=b.$eval(d.uibTabContentTransclude);e.$transcludeFn(e.$parent,function(b){angular.forEach(b,function(b){a(b)?e.headingElement=b:c.append(b)})})}}}),angular.module("ui.bootstrap.timepicker",[]).constant("uibTimepickerConfig",{hourStep:1,minuteStep:1,secondStep:1,showMeridian:!0,showSeconds:!1,meridians:null,readonlyInput:!1,mousewheel:!0,arrowkeys:!0,showSpinners:!0,templateUrl:"uib/template/timepicker/timepicker.html"}).controller("UibTimepickerController",["$scope","$element","$attrs","$parse","$log","$locale","uibTimepickerConfig",function(a,b,c,d,e,f,g){function h(){var b=+a.hours,c=a.showMeridian?b>0&&13>b:b>=0&&24>b;return c?(a.showMeridian&&(12===b&&(b=0),a.meridian===u[1]&&(b+=12)),b):void 0}function i(){var b=+a.minutes;return b>=0&&60>b?b:void 0}function j(){var b=+a.seconds;return b>=0&&60>b?b:void 0}function k(a){return null===a?"":angular.isDefined(a)&&a.toString().length<2?"0"+a:a.toString()}function l(a){m(),t.$setViewValue(new Date(r)),n(a)}function m(){t.$setValidity("time",!0),a.invalidHours=!1,a.invalidMinutes=!1,a.invalidSeconds=!1}function n(b){if(t.$modelValue){var c=r.getHours(),d=r.getMinutes(),e=r.getSeconds();a.showMeridian&&(c=0===c||12===c?12:c%12),a.hours="h"===b?c:k(c),"m"!==b&&(a.minutes=k(d)),a.meridian=r.getHours()<12?u[0]:u[1],"s"!==b&&(a.seconds=k(e)),a.meridian=r.getHours()<12?u[0]:u[1]}else a.hours=null,a.minutes=null,a.seconds=null,a.meridian=u[0]}function o(a){r=q(r,a),l()}function p(a,b){return q(a,60*b)}function q(a,b){var c=new Date(a.getTime()+1e3*b),d=new Date(a);return d.setHours(c.getHours(),c.getMinutes(),c.getSeconds()),d}var r=new Date,s=[],t={$setViewValue:angular.noop},u=angular.isDefined(c.meridians)?a.$parent.$eval(c.meridians):g.meridians||f.DATETIME_FORMATS.AMPMS;a.tabindex=angular.isDefined(c.tabindex)?c.tabindex:0,b.removeAttr("tabindex"),this.init=function(b,d){t=b,t.$render=this.render,t.$formatters.unshift(function(a){return a?new Date(a):null});var e=d.eq(0),f=d.eq(1),h=d.eq(2),i=angular.isDefined(c.mousewheel)?a.$parent.$eval(c.mousewheel):g.mousewheel;i&&this.setupMousewheelEvents(e,f,h);var j=angular.isDefined(c.arrowkeys)?a.$parent.$eval(c.arrowkeys):g.arrowkeys;j&&this.setupArrowkeyEvents(e,f,h),a.readonlyInput=angular.isDefined(c.readonlyInput)?a.$parent.$eval(c.readonlyInput):g.readonlyInput,this.setupInputEvents(e,f,h)};var v=g.hourStep;c.hourStep&&s.push(a.$parent.$watch(d(c.hourStep),function(a){v=+a}));var w=g.minuteStep;c.minuteStep&&s.push(a.$parent.$watch(d(c.minuteStep),function(a){w=+a}));var x;s.push(a.$parent.$watch(d(c.min),function(a){var b=new Date(a);x=isNaN(b)?void 0:b}));var y;s.push(a.$parent.$watch(d(c.max),function(a){var b=new Date(a);y=isNaN(b)?void 0:b}));var z=!1;c.ngDisabled&&s.push(a.$parent.$watch(d(c.ngDisabled),function(a){z=a})),a.noIncrementHours=function(){var a=p(r,60*v);return z||a>y||r>a&&x>a},a.noDecrementHours=function(){var a=p(r,60*-v);return z||x>a||a>r&&a>y},a.noIncrementMinutes=function(){var a=p(r,w);return z||a>y||r>a&&x>a},a.noDecrementMinutes=function(){var a=p(r,-w);return z||x>a||a>r&&a>y},a.noIncrementSeconds=function(){var a=q(r,A);return z||a>y||r>a&&x>a},a.noDecrementSeconds=function(){var a=q(r,-A);return z||x>a||a>r&&a>y},a.noToggleMeridian=function(){return r.getHours()<12?z||p(r,720)>y:z||p(r,-720)<x};var A=g.secondStep;c.secondStep&&s.push(a.$parent.$watch(d(c.secondStep),function(a){A=+a})),a.showSeconds=g.showSeconds,c.showSeconds&&s.push(a.$parent.$watch(d(c.showSeconds),function(b){a.showSeconds=!!b})),a.showMeridian=g.showMeridian,c.showMeridian&&s.push(a.$parent.$watch(d(c.showMeridian),function(b){if(a.showMeridian=!!b,t.$error.time){var c=h(),d=i();angular.isDefined(c)&&angular.isDefined(d)&&(r.setHours(c),l())}else n()})),this.setupMousewheelEvents=function(b,c,d){var e=function(a){a.originalEvent&&(a=a.originalEvent);var b=a.wheelDelta?a.wheelDelta:-a.deltaY;return a.detail||b>0};b.bind("mousewheel wheel",function(b){z||a.$apply(e(b)?a.incrementHours():a.decrementHours()),b.preventDefault()}),c.bind("mousewheel wheel",function(b){z||a.$apply(e(b)?a.incrementMinutes():a.decrementMinutes()),b.preventDefault()}),d.bind("mousewheel wheel",function(b){z||a.$apply(e(b)?a.incrementSeconds():a.decrementSeconds()),b.preventDefault()})},this.setupArrowkeyEvents=function(b,c,d){b.bind("keydown",function(b){z||(38===b.which?(b.preventDefault(),a.incrementHours(),a.$apply()):40===b.which&&(b.preventDefault(),a.decrementHours(),a.$apply()))}),c.bind("keydown",function(b){z||(38===b.which?(b.preventDefault(),a.incrementMinutes(),a.$apply()):40===b.which&&(b.preventDefault(),a.decrementMinutes(),a.$apply()))}),d.bind("keydown",function(b){z||(38===b.which?(b.preventDefault(),a.incrementSeconds(),a.$apply()):40===b.which&&(b.preventDefault(),a.decrementSeconds(),a.$apply()))})},this.setupInputEvents=function(b,c,d){if(a.readonlyInput)return a.updateHours=angular.noop,a.updateMinutes=angular.noop,void(a.updateSeconds=angular.noop);var e=function(b,c,d){t.$setViewValue(null),t.$setValidity("time",!1),angular.isDefined(b)&&(a.invalidHours=b),angular.isDefined(c)&&(a.invalidMinutes=c),angular.isDefined(d)&&(a.invalidSeconds=d)};a.updateHours=function(){var a=h(),b=i();t.$setDirty(),angular.isDefined(a)&&angular.isDefined(b)?(r.setHours(a),r.setMinutes(b),x>r||r>y?e(!0):l("h")):e(!0)},b.bind("blur",function(b){t.$setTouched(),null===a.hours||""===a.hours?e(!0):!a.invalidHours&&a.hours<10&&a.$apply(function(){a.hours=k(a.hours)})}),a.updateMinutes=function(){var a=i(),b=h();t.$setDirty(),angular.isDefined(a)&&angular.isDefined(b)?(r.setHours(b),r.setMinutes(a),x>r||r>y?e(void 0,!0):l("m")):e(void 0,!0)},c.bind("blur",function(b){t.$setTouched(),null===a.minutes?e(void 0,!0):!a.invalidMinutes&&a.minutes<10&&a.$apply(function(){a.minutes=k(a.minutes)})}),a.updateSeconds=function(){var a=j();t.$setDirty(),angular.isDefined(a)?(r.setSeconds(a),l("s")):e(void 0,void 0,!0)},d.bind("blur",function(b){!a.invalidSeconds&&a.seconds<10&&a.$apply(function(){a.seconds=k(a.seconds)})})},this.render=function(){var b=t.$viewValue;isNaN(b)?(t.$setValidity("time",!1),e.error('Timepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.')):(b&&(r=b),x>r||r>y?(t.$setValidity("time",!1),a.invalidHours=!0,a.invalidMinutes=!0):m(),n())},a.showSpinners=angular.isDefined(c.showSpinners)?a.$parent.$eval(c.showSpinners):g.showSpinners,a.incrementHours=function(){a.noIncrementHours()||o(60*v*60)},a.decrementHours=function(){a.noDecrementHours()||o(60*-v*60)},a.incrementMinutes=function(){a.noIncrementMinutes()||o(60*w)},a.decrementMinutes=function(){a.noDecrementMinutes()||o(60*-w)},a.incrementSeconds=function(){a.noIncrementSeconds()||o(A)},a.decrementSeconds=function(){a.noDecrementSeconds()||o(-A)},a.toggleMeridian=function(){var b=i(),c=h();a.noToggleMeridian()||(angular.isDefined(b)&&angular.isDefined(c)?o(720*(r.getHours()<12?60:-60)):a.meridian=a.meridian===u[0]?u[1]:u[0])},a.blur=function(){t.$setTouched()},a.$on("$destroy",function(){for(;s.length;)s.shift()()})}]).directive("uibTimepicker",["uibTimepickerConfig",function(a){return{require:["uibTimepicker","?^ngModel"],controller:"UibTimepickerController",controllerAs:"timepicker",replace:!0,scope:{},templateUrl:function(b,c){return c.templateUrl||a.templateUrl},link:function(a,b,c,d){var e=d[0],f=d[1];f&&e.init(f,b.find("input"))}}}]),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.debounce","ui.bootstrap.position"]).factory("uibTypeaheadParser",["$parse",function(a){var b=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(c){var d=c.match(b);if(!d)throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "'+c+'".');return{itemName:d[3],source:a(d[4]),viewMapper:a(d[2]||d[1]),modelMapper:a(d[1])}}}}]).controller("UibTypeaheadController",["$scope","$element","$attrs","$compile","$parse","$q","$timeout","$document","$window","$rootScope","$$debounce","$uibPosition","uibTypeaheadParser",function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(){N.moveInProgress||(N.moveInProgress=!0,N.$digest()),Y()}function o(){N.position=D?l.offset(b):l.position(b),N.position.top+=b.prop("offsetHeight")}var p,q,r=[9,13,27,38,40],s=200,t=a.$eval(c.typeaheadMinLength);t||0===t||(t=1);var u=a.$eval(c.typeaheadWaitMs)||0,v=a.$eval(c.typeaheadEditable)!==!1;a.$watch(c.typeaheadEditable,function(a){v=a!==!1});var w,x,y=e(c.typeaheadLoading).assign||angular.noop,z=e(c.typeaheadOnSelect),A=angular.isDefined(c.typeaheadSelectOnBlur)?a.$eval(c.typeaheadSelectOnBlur):!1,B=e(c.typeaheadNoResults).assign||angular.noop,C=c.typeaheadInputFormatter?e(c.typeaheadInputFormatter):void 0,D=c.typeaheadAppendToBody?a.$eval(c.typeaheadAppendToBody):!1,E=c.typeaheadAppendTo?a.$eval(c.typeaheadAppendTo):null,F=a.$eval(c.typeaheadFocusFirst)!==!1,G=c.typeaheadSelectOnExact?a.$eval(c.typeaheadSelectOnExact):!1,H=e(c.typeaheadIsOpen).assign||angular.noop,I=a.$eval(c.typeaheadShowHint)||!1,J=e(c.ngModel),K=e(c.ngModel+"($$$p)"),L=function(b,c){return angular.isFunction(J(a))&&q&&q.$options&&q.$options.getterSetter?K(b,{$$$p:c}):J.assign(b,c)},M=m.parse(c.uibTypeahead),N=a.$new(),O=a.$on("$destroy",function(){N.$destroy()});N.$on("$destroy",O);var P="typeahead-"+N.$id+"-"+Math.floor(1e4*Math.random());b.attr({"aria-autocomplete":"list","aria-expanded":!1,"aria-owns":P});var Q,R;I&&(Q=angular.element("<div></div>"),Q.css("position","relative"),b.after(Q),R=b.clone(),R.attr("placeholder",""),R.val(""),R.css({position:"absolute",top:"0px",left:"0px","border-color":"transparent","box-shadow":"none",opacity:1,background:"none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255)",color:"#999"}),b.css({position:"relative","vertical-align":"top","background-color":"transparent"}),Q.append(R),R.after(b));var S=angular.element("<div uib-typeahead-popup></div>");S.attr({id:P,matches:"matches",active:"activeIdx",select:"select(activeIdx, evt)","move-in-progress":"moveInProgress",query:"query",position:"position","assign-is-open":"assignIsOpen(isOpen)",debounce:"debounceUpdate"}),angular.isDefined(c.typeaheadTemplateUrl)&&S.attr("template-url",c.typeaheadTemplateUrl),angular.isDefined(c.typeaheadPopupTemplateUrl)&&S.attr("popup-template-url",c.typeaheadPopupTemplateUrl);var T=function(){I&&R.val("")},U=function(){N.matches=[],N.activeIdx=-1,b.attr("aria-expanded",!1),T()},V=function(a){return P+"-option-"+a};N.$watch("activeIdx",function(a){0>a?b.removeAttr("aria-activedescendant"):b.attr("aria-activedescendant",V(a))});var W=function(a,b){return N.matches.length>b&&a?a.toUpperCase()===N.matches[b].label.toUpperCase():!1},X=function(c,d){var e={$viewValue:c};y(a,!0),B(a,!1),f.when(M.source(a,e)).then(function(f){var g=c===p.$viewValue;if(g&&w)if(f&&f.length>0){N.activeIdx=F?0:-1,B(a,!1),N.matches.length=0;for(var h=0;h<f.length;h++)e[M.itemName]=f[h],N.matches.push({id:V(h),label:M.viewMapper(N,e),model:f[h]});if(N.query=c,o(),b.attr("aria-expanded",!0),G&&1===N.matches.length&&W(c,0)&&(angular.isNumber(N.debounceUpdate)||angular.isObject(N.debounceUpdate)?k(function(){N.select(0,d)},angular.isNumber(N.debounceUpdate)?N.debounceUpdate:N.debounceUpdate["default"]):N.select(0,d)),I){var i=N.matches[0].label;angular.isString(c)&&c.length>0&&i.slice(0,c.length).toUpperCase()===c.toUpperCase()?R.val(c+i.slice(c.length)):R.val("")}}else U(),B(a,!0);g&&y(a,!1)},function(){U(),y(a,!1),B(a,!0)})};D&&(angular.element(i).on("resize",n),h.find("body").on("scroll",n));var Y=k(function(){N.matches.length&&o(),N.moveInProgress=!1},s);N.moveInProgress=!1,N.query=void 0;var Z,$=function(a){Z=g(function(){X(a)},u)},_=function(){Z&&g.cancel(Z)};U(),N.assignIsOpen=function(b){H(a,b)},N.select=function(d,e){var f,h,i={};x=!0,i[M.itemName]=h=N.matches[d].model,f=M.modelMapper(a,i),L(a,f),p.$setValidity("editable",!0),p.$setValidity("parse",!0),z(a,{$item:h,$model:f,$label:M.viewMapper(a,i),$event:e}),U(),N.$eval(c.typeaheadFocusOnSelect)!==!1&&g(function(){b[0].focus()},0,!1)},b.on("keydown",function(a){if(0!==N.matches.length&&-1!==r.indexOf(a.which)){if(-1===N.activeIdx&&(9===a.which||13===a.which))return U(),void N.$digest();a.preventDefault();var b;switch(a.which){case 9:case 13:N.$apply(function(){angular.isNumber(N.debounceUpdate)||angular.isObject(N.debounceUpdate)?k(function(){N.select(N.activeIdx,a)},angular.isNumber(N.debounceUpdate)?N.debounceUpdate:N.debounceUpdate["default"]):N.select(N.activeIdx,a)});break;case 27:a.stopPropagation(),U(),N.$digest();break;case 38:N.activeIdx=(N.activeIdx>0?N.activeIdx:N.matches.length)-1,N.$digest(),b=S.find("li")[N.activeIdx],b.parentNode.scrollTop=b.offsetTop;break;case 40:N.activeIdx=(N.activeIdx+1)%N.matches.length,N.$digest(),b=S.find("li")[N.activeIdx],b.parentNode.scrollTop=b.offsetTop}}}),b.bind("focus",function(a){w=!0,0!==t||p.$viewValue||g(function(){X(p.$viewValue,a)},0)}),b.bind("blur",function(a){A&&N.matches.length&&-1!==N.activeIdx&&!x&&(x=!0,N.$apply(function(){angular.isObject(N.debounceUpdate)&&angular.isNumber(N.debounceUpdate.blur)?k(function(){N.select(N.activeIdx,a)},N.debounceUpdate.blur):N.select(N.activeIdx,a)})),!v&&p.$error.editable&&(p.$viewValue="",b.val("")),w=!1,x=!1});var aa=function(a){b[0]!==a.target&&3!==a.which&&0!==N.matches.length&&(U(),j.$$phase||N.$digest())};h.on("click",aa),a.$on("$destroy",function(){h.off("click",aa),(D||E)&&ba.remove(),D&&(angular.element(i).off("resize",n),h.find("body").off("scroll",n)),S.remove(),I&&Q.remove()});var ba=d(S)(N);D?h.find("body").append(ba):E?angular.element(E).eq(0).append(ba):b.after(ba),this.init=function(b,c){p=b,q=c,N.debounceUpdate=p.$options&&e(p.$options.debounce)(a),p.$parsers.unshift(function(b){return w=!0,0===t||b&&b.length>=t?u>0?(_(),$(b)):X(b):(y(a,!1),_(),U()),v?b:b?void p.$setValidity("editable",!1):(p.$setValidity("editable",!0),null)}),p.$formatters.push(function(b){var c,d,e={};return v||p.$setValidity("editable",!0),C?(e.$model=b,C(a,e)):(e[M.itemName]=b,c=M.viewMapper(a,e),e[M.itemName]=void 0,d=M.viewMapper(a,e),c!==d?c:b)})}}]).directive("uibTypeahead",function(){return{controller:"UibTypeaheadController",require:["ngModel","^?ngModelOptions","uibTypeahead"],link:function(a,b,c,d){d[2].init(d[0],d[1])}}}).directive("uibTypeaheadPopup",["$$debounce",function(a){return{scope:{matches:"=",query:"=",active:"=",position:"&",moveInProgress:"=",select:"&",assignIsOpen:"&",debounce:"&"},replace:!0,templateUrl:function(a,b){return b.popupTemplateUrl||"uib/template/typeahead/typeahead-popup.html"},link:function(b,c,d){b.templateUrl=d.templateUrl,b.isOpen=function(){var a=b.matches.length>0;return b.assignIsOpen({isOpen:a}),a},b.isActive=function(a){return b.active===a},b.selectActive=function(a){b.active=a},b.selectMatch=function(c,d){var e=b.debounce();angular.isNumber(e)||angular.isObject(e)?a(function(){b.select({activeIdx:c,evt:d})},angular.isNumber(e)?e:e["default"]):b.select({activeIdx:c,evt:d})}}}}]).directive("uibTypeaheadMatch",["$templateRequest","$compile","$parse",function(a,b,c){return{scope:{index:"=",match:"=",query:"="},link:function(d,e,f){var g=c(f.templateUrl)(d.$parent)||"uib/template/typeahead/typeahead-match.html";a(g).then(function(a){var c=angular.element(a.trim());e.replaceWith(c),b(c)(d)})}}}]).filter("uibTypeaheadHighlight",["$sce","$injector","$log",function(a,b,c){function d(a){return a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}function e(a){return/<.*>/g.test(a)}var f;return f=b.has("$sanitize"),function(b,g){return!f&&e(b)&&c.warn("Unsafe use of typeahead please use ngSanitize"),b=g?(""+b).replace(new RegExp(d(g),"gi"),"<strong>$&</strong>"):b,f||(b=a.trustAsHtml(b)),b}}]),angular.module("uib/template/accordion/accordion-group.html",[]).run(["$templateCache",function(a){a.put("uib/template/accordion/accordion-group.html",'<div class="panel" ng-class="panelClass || \'panel-default\'">\n <div role="tab" id="{{::headingId}}" aria-selected="{{isOpen}}" class="panel-heading" ng-keypress="toggleOpen($event)">\n <h4 class="panel-title">\n <a role="button" data-toggle="collapse" href aria-expanded="{{isOpen}}" aria-controls="{{::panelId}}" tabindex="0" class="accordion-toggle" ng-click="toggleOpen()" uib-accordion-transclude="heading"><span ng-class="{\'text-muted\': isDisabled}">{{heading}}</span></a>\n </h4>\n </div>\n <div id="{{::panelId}}" aria-labelledby="{{::headingId}}" aria-hidden="{{!isOpen}}" role="tabpanel" class="panel-collapse collapse" uib-collapse="!isOpen">\n <div class="panel-body" ng-transclude></div>\n </div>\n</div>\n')}]),angular.module("uib/template/accordion/accordion.html",[]).run(["$templateCache",function(a){a.put("uib/template/accordion/accordion.html",'<div role="tablist" class="panel-group" ng-transclude></div>')}]),angular.module("uib/template/alert/alert.html",[]).run(["$templateCache",function(a){a.put("uib/template/alert/alert.html",'<div class="alert" ng-class="[\'alert-\' + (type || \'warning\'), closeable ? \'alert-dismissible\' : null]" role="alert">\n <button ng-show="closeable" type="button" class="close" ng-click="close({$event: $event})">\n <span aria-hidden="true">&times;</span>\n <span class="sr-only">Close</span>\n </button>\n <div ng-transclude></div>\n</div>\n')}]),angular.module("uib/template/carousel/carousel.html",[]).run(["$templateCache",function(a){a.put("uib/template/carousel/carousel.html",'<div ng-mouseenter="pause()" ng-mouseleave="play()" class="carousel" ng-swipe-right="prev()" ng-swipe-left="next()">\n <div class="carousel-inner" ng-transclude></div>\n <a role="button" href class="left carousel-control" ng-click="prev()" ng-show="slides.length > 1">\n <span aria-hidden="true" class="glyphicon glyphicon-chevron-left"></span>\n <span class="sr-only">previous</span>\n </a>\n <a role="button" href class="right carousel-control" ng-click="next()" ng-show="slides.length > 1">\n <span aria-hidden="true" class="glyphicon glyphicon-chevron-right"></span>\n <span class="sr-only">next</span>\n </a>\n <ol class="carousel-indicators" ng-show="slides.length > 1">\n <li ng-repeat="slide in slides | orderBy:indexOfSlide track by $index" ng-class="{ active: isActive(slide) }" ng-click="select(slide)">\n <span class="sr-only">slide {{ $index + 1 }} of {{ slides.length }}<span ng-if="isActive(slide)">, currently active</span></span>\n </li>\n </ol>\n</div>')}]),angular.module("uib/template/carousel/slide.html",[]).run(["$templateCache",function(a){a.put("uib/template/carousel/slide.html",'<div ng-class="{\n \'active\': active\n }" class="item text-center" ng-transclude></div>\n')}]),angular.module("uib/template/datepicker/datepicker.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/datepicker.html",'<div class="uib-datepicker" ng-switch="datepickerMode" role="application" ng-keydown="keydown($event)">\n <uib-daypicker ng-switch-when="day" tabindex="0"></uib-daypicker>\n <uib-monthpicker ng-switch-when="month" tabindex="0"></uib-monthpicker>\n <uib-yearpicker ng-switch-when="year" tabindex="0"></uib-yearpicker>\n</div>')}]),angular.module("uib/template/datepicker/day.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/day.html",'<table class="uib-daypicker" role="grid" aria-labelledby="{{::uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n <thead>\n <tr>\n <th><button type="button" class="btn btn-default btn-sm pull-left uib-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n <th colspan="{{::5 + showWeeks}}"><button id="{{::uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1"><strong>{{title}}</strong></button></th>\n <th><button type="button" class="btn btn-default btn-sm pull-right uib-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n </tr>\n <tr>\n <th ng-if="showWeeks" class="text-center"></th>\n <th ng-repeat="label in ::labels track by $index" class="text-center"><small aria-label="{{::label.full}}">{{::label.abbr}}</small></th>\n </tr>\n </thead>\n <tbody>\n <tr class="uib-weeks" ng-repeat="row in rows track by $index">\n <td ng-if="showWeeks" class="text-center h6"><em>{{ weekNumbers[$index] }}</em></td>\n <td ng-repeat="dt in row" class="uib-day text-center" role="gridcell"\n id="{{::dt.uid}}"\n ng-class="::dt.customClass">\n <button type="button" class="btn btn-default btn-sm"\n uib-is-class="\n \'btn-info\' for selectedDt,\n \'active\' for activeDt\n on dt"\n ng-click="select(dt.date)"\n ng-disabled="::dt.disabled"\n tabindex="-1"><span ng-class="::{\'text-muted\': dt.secondary, \'text-info\': dt.current}">{{::dt.label}}</span></button>\n </td>\n </tr>\n </tbody>\n</table>\n');
+}]),angular.module("uib/template/datepicker/month.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/month.html",'<table class="uib-monthpicker" role="grid" aria-labelledby="{{::uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n <thead>\n <tr>\n <th><button type="button" class="btn btn-default btn-sm pull-left uib-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n <th><button id="{{::uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1"><strong>{{title}}</strong></button></th>\n <th><button type="button" class="btn btn-default btn-sm pull-right uib-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n </tr>\n </thead>\n <tbody>\n <tr class="uib-months" ng-repeat="row in rows track by $index">\n <td ng-repeat="dt in row" class="uib-month text-center" role="gridcell"\n id="{{::dt.uid}}"\n ng-class="::dt.customClass">\n <button type="button" class="btn btn-default"\n uib-is-class="\n \'btn-info\' for selectedDt,\n \'active\' for activeDt\n on dt"\n ng-click="select(dt.date)"\n ng-disabled="::dt.disabled"\n tabindex="-1"><span ng-class="::{\'text-info\': dt.current}">{{::dt.label}}</span></button>\n </td>\n </tr>\n </tbody>\n</table>\n')}]),angular.module("uib/template/datepicker/popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/popup.html",'<div>\n <ul class="uib-datepicker-popup dropdown-menu" dropdown-nested ng-if="isOpen" ng-style="{top: position.top+\'px\', left: position.left+\'px\'}" ng-keydown="keydown($event)" ng-click="$event.stopPropagation()">\n <li ng-transclude></li>\n <li ng-if="showButtonBar" class="uib-button-bar">\n <span class="btn-group pull-left">\n <button type="button" class="btn btn-sm btn-info uib-datepicker-current" ng-click="select(\'today\')" ng-disabled="isDisabled(\'today\')">{{ getText(\'current\') }}</button>\n <button type="button" class="btn btn-sm btn-danger uib-clear" ng-click="select(null)">{{ getText(\'clear\') }}</button>\n </span>\n <button type="button" class="btn btn-sm btn-success pull-right uib-close" ng-click="close()">{{ getText(\'close\') }}</button>\n </li>\n </ul>\n</div>\n')}]),angular.module("uib/template/datepicker/year.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/year.html",'<table class="uib-yearpicker" role="grid" aria-labelledby="{{::uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n <thead>\n <tr>\n <th><button type="button" class="btn btn-default btn-sm pull-left uib-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n <th colspan="{{::columns - 2}}"><button id="{{::uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1"><strong>{{title}}</strong></button></th>\n <th><button type="button" class="btn btn-default btn-sm pull-right uib-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n </tr>\n </thead>\n <tbody>\n <tr class="uib-years" ng-repeat="row in rows track by $index">\n <td ng-repeat="dt in row" class="uib-year text-center" role="gridcell"\n id="{{::dt.uid}}"\n ng-class="::dt.customClass">\n <button type="button" class="btn btn-default"\n uib-is-class="\n \'btn-info\' for selectedDt,\n \'active\' for activeDt\n on dt"\n ng-click="select(dt.date)"\n ng-disabled="::dt.disabled"\n tabindex="-1"><span ng-class="::{\'text-info\': dt.current}">{{::dt.label}}</span></button>\n </td>\n </tr>\n </tbody>\n</table>\n')}]),angular.module("uib/template/modal/backdrop.html",[]).run(["$templateCache",function(a){a.put("uib/template/modal/backdrop.html",'<div class="modal-backdrop"\n uib-modal-animation-class="fade"\n modal-in-class="in"\n ng-style="{\'z-index\': 1040 + (index && 1 || 0) + index*10}"\n></div>\n')}]),angular.module("uib/template/modal/window.html",[]).run(["$templateCache",function(a){a.put("uib/template/modal/window.html",'<div modal-render="{{$isRendered}}" tabindex="-1" role="dialog" class="modal"\n uib-modal-animation-class="fade"\n modal-in-class="in"\n ng-style="{\'z-index\': 1050 + index*10, display: \'block\'}">\n <div class="modal-dialog {{size ? \'modal-\' + size : \'\'}}"><div class="modal-content" uib-modal-transclude></div></div>\n</div>\n')}]),angular.module("uib/template/pager/pager.html",[]).run(["$templateCache",function(a){a.put("uib/template/pager/pager.html",'<ul class="pager">\n <li ng-class="{disabled: noPrevious()||ngDisabled, previous: align}"><a href ng-click="selectPage(page - 1, $event)">{{::getText(\'previous\')}}</a></li>\n <li ng-class="{disabled: noNext()||ngDisabled, next: align}"><a href ng-click="selectPage(page + 1, $event)">{{::getText(\'next\')}}</a></li>\n</ul>\n')}]),angular.module("uib/template/pagination/pagination.html",[]).run(["$templateCache",function(a){a.put("uib/template/pagination/pagination.html",'<ul class="pagination">\n <li ng-if="::boundaryLinks" ng-class="{disabled: noPrevious()||ngDisabled}" class="pagination-first"><a href ng-click="selectPage(1, $event)">{{::getText(\'first\')}}</a></li>\n <li ng-if="::directionLinks" ng-class="{disabled: noPrevious()||ngDisabled}" class="pagination-prev"><a href ng-click="selectPage(page - 1, $event)">{{::getText(\'previous\')}}</a></li>\n <li ng-repeat="page in pages track by $index" ng-class="{active: page.active,disabled: ngDisabled&&!page.active}" class="pagination-page"><a href ng-click="selectPage(page.number, $event)">{{page.text}}</a></li>\n <li ng-if="::directionLinks" ng-class="{disabled: noNext()||ngDisabled}" class="pagination-next"><a href ng-click="selectPage(page + 1, $event)">{{::getText(\'next\')}}</a></li>\n <li ng-if="::boundaryLinks" ng-class="{disabled: noNext()||ngDisabled}" class="pagination-last"><a href ng-click="selectPage(totalPages, $event)">{{::getText(\'last\')}}</a></li>\n</ul>\n')}]),angular.module("uib/template/tooltip/tooltip-html-popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/tooltip/tooltip-html-popup.html",'<div class="tooltip"\n tooltip-animation-class="fade"\n uib-tooltip-classes\n ng-class="{ in: isOpen() }">\n <div class="tooltip-arrow"></div>\n <div class="tooltip-inner" ng-bind-html="contentExp()"></div>\n</div>\n')}]),angular.module("uib/template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/tooltip/tooltip-popup.html",'<div class="tooltip"\n tooltip-animation-class="fade"\n uib-tooltip-classes\n ng-class="{ in: isOpen() }">\n <div class="tooltip-arrow"></div>\n <div class="tooltip-inner" ng-bind="content"></div>\n</div>\n')}]),angular.module("uib/template/tooltip/tooltip-template-popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/tooltip/tooltip-template-popup.html",'<div class="tooltip"\n tooltip-animation-class="fade"\n uib-tooltip-classes\n ng-class="{ in: isOpen() }">\n <div class="tooltip-arrow"></div>\n <div class="tooltip-inner"\n uib-tooltip-template-transclude="contentExp()"\n tooltip-template-transclude-scope="originScope()"></div>\n</div>\n')}]),angular.module("uib/template/popover/popover-html.html",[]).run(["$templateCache",function(a){a.put("uib/template/popover/popover-html.html",'<div class="popover"\n tooltip-animation-class="fade"\n uib-tooltip-classes\n ng-class="{ in: isOpen() }">\n <div class="arrow"></div>\n\n <div class="popover-inner">\n <h3 class="popover-title" ng-bind="title" ng-if="title"></h3>\n <div class="popover-content" ng-bind-html="contentExp()"></div>\n </div>\n</div>\n')}]),angular.module("uib/template/popover/popover-template.html",[]).run(["$templateCache",function(a){a.put("uib/template/popover/popover-template.html",'<div class="popover"\n tooltip-animation-class="fade"\n uib-tooltip-classes\n ng-class="{ in: isOpen() }">\n <div class="arrow"></div>\n\n <div class="popover-inner">\n <h3 class="popover-title" ng-bind="title" ng-if="title"></h3>\n <div class="popover-content"\n uib-tooltip-template-transclude="contentExp()"\n tooltip-template-transclude-scope="originScope()"></div>\n </div>\n</div>\n')}]),angular.module("uib/template/popover/popover.html",[]).run(["$templateCache",function(a){a.put("uib/template/popover/popover.html",'<div class="popover"\n tooltip-animation-class="fade"\n uib-tooltip-classes\n ng-class="{ in: isOpen() }">\n <div class="arrow"></div>\n\n <div class="popover-inner">\n <h3 class="popover-title" ng-bind="title" ng-if="title"></h3>\n <div class="popover-content" ng-bind="content"></div>\n </div>\n</div>\n')}]),angular.module("uib/template/progressbar/bar.html",[]).run(["$templateCache",function(a){a.put("uib/template/progressbar/bar.html",'<div class="progress-bar" ng-class="type && \'progress-bar-\' + type" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="{{max}}" ng-style="{width: (percent < 100 ? percent : 100) + \'%\'}" aria-valuetext="{{percent | number:0}}%" aria-labelledby="{{::title}}" ng-transclude></div>\n')}]),angular.module("uib/template/progressbar/progress.html",[]).run(["$templateCache",function(a){a.put("uib/template/progressbar/progress.html",'<div class="progress" ng-transclude aria-labelledby="{{::title}}"></div>')}]),angular.module("uib/template/progressbar/progressbar.html",[]).run(["$templateCache",function(a){a.put("uib/template/progressbar/progressbar.html",'<div class="progress">\n <div class="progress-bar" ng-class="type && \'progress-bar-\' + type" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="{{max}}" ng-style="{width: (percent < 100 ? percent : 100) + \'%\'}" aria-valuetext="{{percent | number:0}}%" aria-labelledby="{{::title}}" ng-transclude></div>\n</div>\n')}]),angular.module("uib/template/rating/rating.html",[]).run(["$templateCache",function(a){a.put("uib/template/rating/rating.html",'<span ng-mouseleave="reset()" ng-keydown="onKeydown($event)" tabindex="0" role="slider" aria-valuemin="0" aria-valuemax="{{range.length}}" aria-valuenow="{{value}}">\n <span ng-repeat-start="r in range track by $index" class="sr-only">({{ $index < value ? \'*\' : \' \' }})</span>\n <i ng-repeat-end ng-mouseenter="enter($index + 1)" ng-click="rate($index + 1)" class="glyphicon" ng-class="$index < value && (r.stateOn || \'glyphicon-star\') || (r.stateOff || \'glyphicon-star-empty\')" ng-attr-title="{{r.title}}" aria-valuetext="{{r.title}}"></i>\n</span>\n')}]),angular.module("uib/template/tabs/tab.html",[]).run(["$templateCache",function(a){a.put("uib/template/tabs/tab.html",'<li ng-class="{active: active, disabled: disabled}" class="uib-tab">\n <a href ng-click="select()" uib-tab-heading-transclude>{{heading}}</a>\n</li>\n')}]),angular.module("uib/template/tabs/tabset.html",[]).run(["$templateCache",function(a){a.put("uib/template/tabs/tabset.html",'<div>\n <ul class="nav nav-{{type || \'tabs\'}}" ng-class="{\'nav-stacked\': vertical, \'nav-justified\': justified}" ng-transclude></ul>\n <div class="tab-content">\n <div class="tab-pane" \n ng-repeat="tab in tabs" \n ng-class="{active: tab.active}"\n uib-tab-content-transclude="tab">\n </div>\n </div>\n</div>\n')}]),angular.module("uib/template/timepicker/timepicker.html",[]).run(["$templateCache",function(a){a.put("uib/template/timepicker/timepicker.html",'<table class="uib-timepicker">\n <tbody>\n <tr class="text-center" ng-show="::showSpinners">\n <td class="uib-increment hours"><a ng-click="incrementHours()" ng-class="{disabled: noIncrementHours()}" class="btn btn-link" ng-disabled="noIncrementHours()" tabindex="{{::tabindex}}"><span class="glyphicon glyphicon-chevron-up"></span></a></td>\n <td>&nbsp;</td>\n <td class="uib-increment minutes"><a ng-click="incrementMinutes()" ng-class="{disabled: noIncrementMinutes()}" class="btn btn-link" ng-disabled="noIncrementMinutes()" tabindex="{{::tabindex}}"><span class="glyphicon glyphicon-chevron-up"></span></a></td>\n <td ng-show="showSeconds">&nbsp;</td>\n <td ng-show="showSeconds" class="uib-increment seconds"><a ng-click="incrementSeconds()" ng-class="{disabled: noIncrementSeconds()}" class="btn btn-link" ng-disabled="noIncrementSeconds()" tabindex="{{::tabindex}}"><span class="glyphicon glyphicon-chevron-up"></span></a></td>\n <td ng-show="showMeridian"></td>\n </tr>\n <tr>\n <td class="form-group uib-time hours" ng-class="{\'has-error\': invalidHours}">\n <input style="width:50px;" type="text" placeholder="HH" ng-model="hours" ng-change="updateHours()" class="form-control text-center" ng-readonly="::readonlyInput" maxlength="2" tabindex="{{::tabindex}}" ng-disabled="noIncrementHours()" ng-blur="blur()">\n </td>\n <td class="uib-separator">:</td>\n <td class="form-group uib-time minutes" ng-class="{\'has-error\': invalidMinutes}">\n <input style="width:50px;" type="text" placeholder="MM" ng-model="minutes" ng-change="updateMinutes()" class="form-control text-center" ng-readonly="::readonlyInput" maxlength="2" tabindex="{{::tabindex}}" ng-disabled="noIncrementMinutes()" ng-blur="blur()">\n </td>\n <td ng-show="showSeconds" class="uib-separator">:</td>\n <td class="form-group uib-time seconds" ng-class="{\'has-error\': invalidSeconds}" ng-show="showSeconds">\n <input style="width:50px;" type="text" placeholder="SS" ng-model="seconds" ng-change="updateSeconds()" class="form-control text-center" ng-readonly="readonlyInput" maxlength="2" tabindex="{{::tabindex}}" ng-disabled="noIncrementSeconds()" ng-blur="blur()">\n </td>\n <td ng-show="showMeridian" class="uib-time am-pm"><button type="button" ng-class="{disabled: noToggleMeridian()}" class="btn btn-default text-center" ng-click="toggleMeridian()" ng-disabled="noToggleMeridian()" tabindex="{{::tabindex}}">{{meridian}}</button></td>\n </tr>\n <tr class="text-center" ng-show="::showSpinners">\n <td class="uib-decrement hours"><a ng-click="decrementHours()" ng-class="{disabled: noDecrementHours()}" class="btn btn-link" ng-disabled="noDecrementHours()" tabindex="{{::tabindex}}"><span class="glyphicon glyphicon-chevron-down"></span></a></td>\n <td>&nbsp;</td>\n <td class="uib-decrement minutes"><a ng-click="decrementMinutes()" ng-class="{disabled: noDecrementMinutes()}" class="btn btn-link" ng-disabled="noDecrementMinutes()" tabindex="{{::tabindex}}"><span class="glyphicon glyphicon-chevron-down"></span></a></td>\n <td ng-show="showSeconds">&nbsp;</td>\n <td ng-show="showSeconds" class="uib-decrement seconds"><a ng-click="decrementSeconds()" ng-class="{disabled: noDecrementSeconds()}" class="btn btn-link" ng-disabled="noDecrementSeconds()" tabindex="{{::tabindex}}"><span class="glyphicon glyphicon-chevron-down"></span></a></td>\n <td ng-show="showMeridian"></td>\n </tr>\n </tbody>\n</table>\n')}]),angular.module("uib/template/typeahead/typeahead-match.html",[]).run(["$templateCache",function(a){a.put("uib/template/typeahead/typeahead-match.html",'<a href\n tabindex="-1"\n ng-bind-html="match.label | uibTypeaheadHighlight:query"\n ng-attr-title="{{match.label}}"></a>\n')}]),angular.module("uib/template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/typeahead/typeahead-popup.html",'<ul class="dropdown-menu" ng-show="isOpen() && !moveInProgress" ng-style="{top: position().top+\'px\', left: position().left+\'px\'}" role="listbox" aria-hidden="{{!isOpen()}}">\n <li ng-repeat="match in matches track by $index" ng-class="{active: isActive($index) }" ng-mouseenter="selectActive($index)" ng-click="selectMatch($index, $event)" role="option" id="{{::match.id}}">\n <div uib-typeahead-match index="$index" match="match" query="query" template-url="templateUrl"></div>\n </li>\n</ul>\n')}]),angular.module("ui.bootstrap.carousel").run(function(){!angular.$$csp().noInlineStyle&&angular.element(document).find("head").prepend('<style type="text/css">.ng-animate.item:not(.left):not(.right){-webkit-transition:0s ease-in-out left;transition:0s ease-in-out left}</style>')}),angular.module("ui.bootstrap.datepicker").run(function(){!angular.$$csp().noInlineStyle&&angular.element(document).find("head").prepend('<style type="text/css">.uib-datepicker .uib-title{width:100%;}.uib-day button,.uib-month button,.uib-year button{min-width:100%;}.uib-datepicker-popup.dropdown-menu{display:block;}.uib-button-bar{padding:10px 9px 2px;}</style>')}),angular.module("ui.bootstrap.timepicker").run(function(){!angular.$$csp().noInlineStyle&&angular.element(document).find("head").prepend('<style type="text/css">.uib-time input{width:50px;}</style>')}),angular.module("ui.bootstrap.typeahead").run(function(){!angular.$$csp().noInlineStyle&&angular.element(document).find("head").prepend('<style type="text/css">[uib-typeahead-popup].dropdown-menu{display:block;}</style>')}); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-ui/ui-bootstrap-tpls-1.2.4.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-ui/ui-bootstrap-tpls-1.2.4.min.js
new file mode 100644
index 00000000..0eab2963
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-ui/ui-bootstrap-tpls-1.2.4.min.js
@@ -0,0 +1,10 @@
+/*
+ * angular-ui-bootstrap
+ * http://angular-ui.github.io/bootstrap/
+
+ * Version: 1.2.4 - 2016-03-06
+ * License: MIT
+ */angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.collapse","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.isClass","ui.bootstrap.position","ui.bootstrap.datepicker","ui.bootstrap.debounce","ui.bootstrap.dropdown","ui.bootstrap.stackedMap","ui.bootstrap.modal","ui.bootstrap.paging","ui.bootstrap.pager","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]),angular.module("ui.bootstrap.tpls",["uib/template/accordion/accordion-group.html","uib/template/accordion/accordion.html","uib/template/alert/alert.html","uib/template/carousel/carousel.html","uib/template/carousel/slide.html","uib/template/datepicker/datepicker.html","uib/template/datepicker/day.html","uib/template/datepicker/month.html","uib/template/datepicker/popup.html","uib/template/datepicker/year.html","uib/template/modal/backdrop.html","uib/template/modal/window.html","uib/template/pager/pager.html","uib/template/pagination/pagination.html","uib/template/tooltip/tooltip-html-popup.html","uib/template/tooltip/tooltip-popup.html","uib/template/tooltip/tooltip-template-popup.html","uib/template/popover/popover-html.html","uib/template/popover/popover-template.html","uib/template/popover/popover.html","uib/template/progressbar/bar.html","uib/template/progressbar/progress.html","uib/template/progressbar/progressbar.html","uib/template/rating/rating.html","uib/template/tabs/tab.html","uib/template/tabs/tabset.html","uib/template/timepicker/timepicker.html","uib/template/typeahead/typeahead-match.html","uib/template/typeahead/typeahead-popup.html"]),angular.module("ui.bootstrap.collapse",[]).directive("uibCollapse",["$animate","$q","$parse","$injector",function(a,b,c,d){var e=d.has("$animateCss")?d.get("$animateCss"):null;return{link:function(d,f,g){function h(){f.hasClass("collapse")&&f.hasClass("in")||b.resolve(l(d)).then(function(){f.removeClass("collapse").addClass("collapsing").attr("aria-expanded",!0).attr("aria-hidden",!1),e?e(f,{addClass:"in",easing:"ease",to:{height:f[0].scrollHeight+"px"}}).start()["finally"](i):a.addClass(f,"in",{to:{height:f[0].scrollHeight+"px"}}).then(i)})}function i(){f.removeClass("collapsing").addClass("collapse").css({height:"auto"}),m(d)}function j(){return f.hasClass("collapse")||f.hasClass("in")?void b.resolve(n(d)).then(function(){f.css({height:f[0].scrollHeight+"px"}).removeClass("collapse").addClass("collapsing").attr("aria-expanded",!1).attr("aria-hidden",!0),e?e(f,{removeClass:"in",to:{height:"0"}}).start()["finally"](k):a.removeClass(f,"in",{to:{height:"0"}}).then(k)}):k()}function k(){f.css({height:"0"}),f.removeClass("collapsing").addClass("collapse"),o(d)}var l=c(g.expanding),m=c(g.expanded),n=c(g.collapsing),o=c(g.collapsed);d.$eval(g.uibCollapse)||f.addClass("in").addClass("collapse").attr("aria-expanded",!0).attr("aria-hidden",!1).css({height:"auto"}),d.$watch(g.uibCollapse,function(a){a?j():h()})}}}]),angular.module("ui.bootstrap.accordion",["ui.bootstrap.collapse"]).constant("uibAccordionConfig",{closeOthers:!0}).controller("UibAccordionController",["$scope","$attrs","uibAccordionConfig",function(a,b,c){this.groups=[],this.closeOthers=function(d){var e=angular.isDefined(b.closeOthers)?a.$eval(b.closeOthers):c.closeOthers;e&&angular.forEach(this.groups,function(a){a!==d&&(a.isOpen=!1)})},this.addGroup=function(a){var b=this;this.groups.push(a),a.$on("$destroy",function(c){b.removeGroup(a)})},this.removeGroup=function(a){var b=this.groups.indexOf(a);-1!==b&&this.groups.splice(b,1)}}]).directive("uibAccordion",function(){return{controller:"UibAccordionController",controllerAs:"accordion",transclude:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/accordion/accordion.html"}}}).directive("uibAccordionGroup",function(){return{require:"^uibAccordion",transclude:!0,replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/accordion/accordion-group.html"},scope:{heading:"@",isOpen:"=?",isDisabled:"=?"},controller:function(){this.setHeading=function(a){this.heading=a}},link:function(a,b,c,d){d.addGroup(a),a.openClass=c.openClass||"panel-open",a.panelClass=c.panelClass||"panel-default",a.$watch("isOpen",function(c){b.toggleClass(a.openClass,!!c),c&&d.closeOthers(a)}),a.toggleOpen=function(b){a.isDisabled||b&&32!==b.which||(a.isOpen=!a.isOpen)};var e="accordiongroup-"+a.$id+"-"+Math.floor(1e4*Math.random());a.headingId=e+"-tab",a.panelId=e+"-panel"}}}).directive("uibAccordionHeading",function(){return{transclude:!0,template:"",replace:!0,require:"^uibAccordionGroup",link:function(a,b,c,d,e){d.setHeading(e(a,angular.noop))}}}).directive("uibAccordionTransclude",function(){return{require:"^uibAccordionGroup",link:function(a,b,c,d){a.$watch(function(){return d[c.uibAccordionTransclude]},function(a){if(a){var c=angular.element(b[0].querySelector("[uib-accordion-header]"));c.html(""),c.append(a)}})}}}),angular.module("ui.bootstrap.alert",[]).controller("UibAlertController",["$scope","$attrs","$interpolate","$timeout",function(a,b,c,d){a.closeable=!!b.close;var e=angular.isDefined(b.dismissOnTimeout)?c(b.dismissOnTimeout)(a.$parent):null;e&&d(function(){a.close()},parseInt(e,10))}]).directive("uibAlert",function(){return{controller:"UibAlertController",controllerAs:"alert",templateUrl:function(a,b){return b.templateUrl||"uib/template/alert/alert.html"},transclude:!0,replace:!0,scope:{type:"@",close:"&"}}}),angular.module("ui.bootstrap.buttons",[]).constant("uibButtonConfig",{activeClass:"active",toggleEvent:"click"}).controller("UibButtonsController",["uibButtonConfig",function(a){this.activeClass=a.activeClass||"active",this.toggleEvent=a.toggleEvent||"click"}]).directive("uibBtnRadio",["$parse",function(a){return{require:["uibBtnRadio","ngModel"],controller:"UibButtonsController",controllerAs:"buttons",link:function(b,c,d,e){var f=e[0],g=e[1],h=a(d.uibUncheckable);c.find("input").css({display:"none"}),g.$render=function(){c.toggleClass(f.activeClass,angular.equals(g.$modelValue,b.$eval(d.uibBtnRadio)))},c.on(f.toggleEvent,function(){if(!d.disabled){var a=c.hasClass(f.activeClass);(!a||angular.isDefined(d.uncheckable))&&b.$apply(function(){g.$setViewValue(a?null:b.$eval(d.uibBtnRadio)),g.$render()})}}),d.uibUncheckable&&b.$watch(h,function(a){d.$set("uncheckable",a?"":void 0)})}}}]).directive("uibBtnCheckbox",function(){return{require:["uibBtnCheckbox","ngModel"],controller:"UibButtonsController",controllerAs:"button",link:function(a,b,c,d){function e(){return g(c.btnCheckboxTrue,!0)}function f(){return g(c.btnCheckboxFalse,!1)}function g(b,c){return angular.isDefined(b)?a.$eval(b):c}var h=d[0],i=d[1];b.find("input").css({display:"none"}),i.$render=function(){b.toggleClass(h.activeClass,angular.equals(i.$modelValue,e()))},b.on(h.toggleEvent,function(){c.disabled||a.$apply(function(){i.$setViewValue(b.hasClass(h.activeClass)?f():e()),i.$render()})})}}}),angular.module("ui.bootstrap.carousel",[]).controller("UibCarouselController",["$scope","$element","$interval","$timeout","$animate",function(a,b,c,d,e){function f(){for(;t.length;)t.shift()}function g(a){for(var b=0;b<q.length;b++)q[b].slide.active=b===a}function h(c,d,i){if(!u){if(angular.extend(c,{direction:i}),angular.extend(q[s].slide||{},{direction:i}),e.enabled(b)&&!a.$currentTransition&&q[d].element&&p.slides.length>1){q[d].element.data(r,c.direction);var j=p.getCurrentIndex();angular.isNumber(j)&&q[j].element&&q[j].element.data(r,c.direction),a.$currentTransition=!0,e.on("addClass",q[d].element,function(b,c){if("close"===c&&(a.$currentTransition=null,e.off("addClass",b),t.length)){var d=t.pop().slide,g=d.index,i=g>p.getCurrentIndex()?"next":"prev";f(),h(d,g,i)}})}a.active=c.index,s=c.index,g(d),l()}}function i(a){for(var b=0;b<q.length;b++)if(q[b].slide===a)return b}function j(){n&&(c.cancel(n),n=null)}function k(b){b.length||(a.$currentTransition=null,f())}function l(){j();var b=+a.interval;!isNaN(b)&&b>0&&(n=c(m,b))}function m(){var b=+a.interval;o&&!isNaN(b)&&b>0&&q.length?a.next():a.pause()}var n,o,p=this,q=p.slides=a.slides=[],r="uib-slideDirection",s=a.active,t=[],u=!1;p.addSlide=function(b,c){q.push({slide:b,element:c}),q.sort(function(a,b){return+a.slide.index>+b.slide.index}),(b.index===a.active||1===q.length&&!angular.isNumber(a.active))&&(a.$currentTransition&&(a.$currentTransition=null),s=b.index,a.active=b.index,g(s),p.select(q[i(b)]),1===q.length&&a.play())},p.getCurrentIndex=function(){for(var a=0;a<q.length;a++)if(q[a].slide.index===s)return a},p.next=a.next=function(){var b=(p.getCurrentIndex()+1)%q.length;return 0===b&&a.noWrap()?void a.pause():p.select(q[b],"next")},p.prev=a.prev=function(){var b=p.getCurrentIndex()-1<0?q.length-1:p.getCurrentIndex()-1;return a.noWrap()&&b===q.length-1?void a.pause():p.select(q[b],"prev")},p.removeSlide=function(b){var c=i(b),d=t.indexOf(q[c]);-1!==d&&t.splice(d,1),q.splice(c,1),q.length>0&&s===c?c>=q.length?(s=q.length-1,a.active=s,g(s),p.select(q[q.length-1])):(s=c,a.active=s,g(s),p.select(q[c])):s>c&&(s--,a.active=s),0===q.length&&(s=null,a.active=null,f())},p.select=a.select=function(b,c){var d=i(b.slide);void 0===c&&(c=d>p.getCurrentIndex()?"next":"prev"),b.slide.index===s||a.$currentTransition?b&&b.slide.index!==s&&a.$currentTransition&&t.push(q[d]):h(b.slide,d,c)},a.indexOfSlide=function(a){return+a.slide.index},a.isActive=function(b){return a.active===b.slide.index},a.pause=function(){a.noPause||(o=!1,j())},a.play=function(){o||(o=!0,l())},a.$on("$destroy",function(){u=!0,j()}),a.$watch("noTransition",function(a){e.enabled(b,!a)}),a.$watch("interval",l),a.$watchCollection("slides",k),a.$watch("active",function(a){if(angular.isNumber(a)&&s!==a){for(var b=0;b<q.length;b++)if(q[b].slide.index===a){a=b;break}var c=q[a];c&&(s=a,g(a),p.select(q[a]))}})}]).directive("uibCarousel",function(){return{transclude:!0,replace:!0,controller:"UibCarouselController",controllerAs:"carousel",templateUrl:function(a,b){return b.templateUrl||"uib/template/carousel/carousel.html"},scope:{active:"=",interval:"=",noTransition:"=",noPause:"=",noWrap:"&"}}}).directive("uibSlide",function(){return{require:"^uibCarousel",transclude:!0,replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/carousel/slide.html"},scope:{actual:"=?",index:"=?"},link:function(a,b,c,d){d.addSlide(a,b),a.$on("$destroy",function(){d.removeSlide(a)})}}}).animation(".item",["$animateCss",function(a){function b(a,b,c){a.removeClass(b),c&&c()}var c="uib-slideDirection";return{beforeAddClass:function(d,e,f){if("active"===e){var g=!1,h=d.data(c),i="next"===h?"left":"right",j=b.bind(this,d,i+" "+h,f);return d.addClass(h),a(d,{addClass:i}).start().done(j),function(){g=!0}}f()},beforeRemoveClass:function(d,e,f){if("active"===e){var g=!1,h=d.data(c),i="next"===h?"left":"right",j=b.bind(this,d,i,f);return a(d,{addClass:i}).start().done(j),function(){g=!0}}f()}}}]),angular.module("ui.bootstrap.dateparser",[]).service("uibDateParser",["$log","$locale","dateFilter","orderByFilter",function(a,b,c,d){function e(a,b){var c=[],e=a.split(""),f=a.indexOf("'");if(f>-1){var g=!1;a=a.split("");for(var h=f;h<a.length;h++)g?("'"===a[h]&&(h+1<a.length&&"'"===a[h+1]?(a[h+1]="$",e[h+1]=""):(e[h]="",g=!1)),a[h]="$"):"'"===a[h]&&(a[h]="$",e[h]="",g=!0);a=a.join("")}return angular.forEach(n,function(d){var f=a.indexOf(d.key);if(f>-1){a=a.split(""),e[f]="("+d.regex+")",a[f]="$";for(var g=f+1,h=f+d.key.length;h>g;g++)e[g]="",a[g]="$";a=a.join(""),c.push({index:f,key:d.key,apply:d[b],matcher:d.regex})}}),{regex:new RegExp("^"+e.join("")+"$"),map:d(c,"index")}}function f(a,b,c){return 1>c?!1:1===b&&c>28?29===c&&(a%4===0&&a%100!==0||a%400===0):3===b||5===b||8===b||10===b?31>c:!0}function g(a){return parseInt(a,10)}function h(a,b){return a&&b?l(a,b):a}function i(a,b){return a&&b?l(a,b,!0):a}function j(a,b){var c=Date.parse("Jan 01, 1970 00:00:00 "+a)/6e4;return isNaN(c)?b:c}function k(a,b){return a=new Date(a.getTime()),a.setMinutes(a.getMinutes()+b),a}function l(a,b,c){c=c?-1:1;var d=j(b,a.getTimezoneOffset());return k(a,c*(d-a.getTimezoneOffset()))}var m,n,o=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;this.init=function(){m=b.id,this.parsers={},this.formatters={},n=[{key:"yyyy",regex:"\\d{4}",apply:function(a){this.year=+a},formatter:function(a){var b=new Date;return b.setFullYear(Math.abs(a.getFullYear())),c(b,"yyyy")}},{key:"yy",regex:"\\d{2}",apply:function(a){this.year=+a+2e3},formatter:function(a){var b=new Date;return b.setFullYear(Math.abs(a.getFullYear())),c(b,"yy")}},{key:"y",regex:"\\d{1,4}",apply:function(a){this.year=+a},formatter:function(a){var b=new Date;return b.setFullYear(Math.abs(a.getFullYear())),c(b,"y")}},{key:"M!",regex:"0?[1-9]|1[0-2]",apply:function(a){this.month=a-1},formatter:function(a){var b=a.getMonth();return/^[0-9]$/.test(b)?c(a,"MM"):c(a,"M")}},{key:"MMMM",regex:b.DATETIME_FORMATS.MONTH.join("|"),apply:function(a){this.month=b.DATETIME_FORMATS.MONTH.indexOf(a)},formatter:function(a){return c(a,"MMMM")}},{key:"MMM",regex:b.DATETIME_FORMATS.SHORTMONTH.join("|"),apply:function(a){this.month=b.DATETIME_FORMATS.SHORTMONTH.indexOf(a)},formatter:function(a){return c(a,"MMM")}},{key:"MM",regex:"0[1-9]|1[0-2]",apply:function(a){this.month=a-1},formatter:function(a){return c(a,"MM")}},{key:"M",regex:"[1-9]|1[0-2]",apply:function(a){this.month=a-1},formatter:function(a){return c(a,"M")}},{key:"d!",regex:"[0-2]?[0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a},formatter:function(a){var b=a.getDate();return/^[1-9]$/.test(b)?c(a,"dd"):c(a,"d")}},{key:"dd",regex:"[0-2][0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a},formatter:function(a){return c(a,"dd")}},{key:"d",regex:"[1-2]?[0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a},formatter:function(a){return c(a,"d")}},{key:"EEEE",regex:b.DATETIME_FORMATS.DAY.join("|"),formatter:function(a){return c(a,"EEEE")}},{key:"EEE",regex:b.DATETIME_FORMATS.SHORTDAY.join("|"),formatter:function(a){return c(a,"EEE")}},{key:"HH",regex:"(?:0|1)[0-9]|2[0-3]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"HH")}},{key:"hh",regex:"0[0-9]|1[0-2]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"hh")}},{key:"H",regex:"1?[0-9]|2[0-3]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"H")}},{key:"h",regex:"[0-9]|1[0-2]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"h")}},{key:"mm",regex:"[0-5][0-9]",apply:function(a){this.minutes=+a},formatter:function(a){return c(a,"mm")}},{key:"m",regex:"[0-9]|[1-5][0-9]",apply:function(a){this.minutes=+a},formatter:function(a){return c(a,"m")}},{key:"sss",regex:"[0-9][0-9][0-9]",apply:function(a){this.milliseconds=+a},formatter:function(a){return c(a,"sss")}},{key:"ss",regex:"[0-5][0-9]",apply:function(a){this.seconds=+a},formatter:function(a){return c(a,"ss")}},{key:"s",regex:"[0-9]|[1-5][0-9]",apply:function(a){this.seconds=+a},formatter:function(a){return c(a,"s")}},{key:"a",regex:b.DATETIME_FORMATS.AMPMS.join("|"),apply:function(a){12===this.hours&&(this.hours=0),"PM"===a&&(this.hours+=12)},formatter:function(a){return c(a,"a")}},{key:"Z",regex:"[+-]\\d{4}",apply:function(a){var b=a.match(/([+-])(\d{2})(\d{2})/),c=b[1],d=b[2],e=b[3];this.hours+=g(c+d),this.minutes+=g(c+e)},formatter:function(a){return c(a,"Z")}},{key:"ww",regex:"[0-4][0-9]|5[0-3]",formatter:function(a){return c(a,"ww")}},{key:"w",regex:"[0-9]|[1-4][0-9]|5[0-3]",formatter:function(a){return c(a,"w")}},{key:"GGGG",regex:b.DATETIME_FORMATS.ERANAMES.join("|").replace(/\s/g,"\\s"),formatter:function(a){return c(a,"GGGG")}},{key:"GGG",regex:b.DATETIME_FORMATS.ERAS.join("|"),formatter:function(a){return c(a,"GGG")}},{key:"GG",regex:b.DATETIME_FORMATS.ERAS.join("|"),formatter:function(a){return c(a,"GG")}},{key:"G",regex:b.DATETIME_FORMATS.ERAS.join("|"),formatter:function(a){return c(a,"G")}}]},this.init(),this.filter=function(a,c){if(!angular.isDate(a)||isNaN(a)||!c)return"";c=b.DATETIME_FORMATS[c]||c,b.id!==m&&this.init(),this.formatters[c]||(this.formatters[c]=e(c,"formatter"));var d=this.formatters[c],f=d.map,g=c;return f.reduce(function(b,c,d){var e=g.match(new RegExp("(.*)"+c.key));e&&angular.isString(e[1])&&(b+=e[1],g=g.replace(e[1]+c.key,""));var h=d===f.length-1?g:"";return c.apply?b+c.apply.call(null,a)+h:b+h},"")},this.parse=function(c,d,g){if(!angular.isString(c)||!d)return c;d=b.DATETIME_FORMATS[d]||d,d=d.replace(o,"\\$&"),b.id!==m&&this.init(),this.parsers[d]||(this.parsers[d]=e(d,"apply"));var h=this.parsers[d],i=h.regex,j=h.map,k=c.match(i),l=!1;if(k&&k.length){var n,p;angular.isDate(g)&&!isNaN(g.getTime())?n={year:g.getFullYear(),month:g.getMonth(),date:g.getDate(),hours:g.getHours(),minutes:g.getMinutes(),seconds:g.getSeconds(),milliseconds:g.getMilliseconds()}:(g&&a.warn("dateparser:","baseDate is not a valid date"),n={year:1900,month:0,date:1,hours:0,minutes:0,seconds:0,milliseconds:0});for(var q=1,r=k.length;r>q;q++){var s=j[q-1];"Z"===s.matcher&&(l=!0),s.apply&&s.apply.call(n,k[q])}var t=l?Date.prototype.setUTCFullYear:Date.prototype.setFullYear,u=l?Date.prototype.setUTCHours:Date.prototype.setHours;return f(n.year,n.month,n.date)&&(!angular.isDate(g)||isNaN(g.getTime())||l?(p=new Date(0),t.call(p,n.year,n.month,n.date),u.call(p,n.hours||0,n.minutes||0,n.seconds||0,n.milliseconds||0)):(p=new Date(g),t.call(p,n.year,n.month,n.date),u.call(p,n.hours,n.minutes,n.seconds,n.milliseconds))),p}},this.toTimezone=h,this.fromTimezone=i,this.timezoneToOffset=j,this.addDateMinutes=k,this.convertTimezoneToLocal=l}]),angular.module("ui.bootstrap.isClass",[]).directive("uibIsClass",["$animate",function(a){var b=/^\s*([\s\S]+?)\s+on\s+([\s\S]+?)\s*$/,c=/^\s*([\s\S]+?)\s+for\s+([\s\S]+?)\s*$/;return{restrict:"A",compile:function(d,e){function f(a,b,c){i.push(a),j.push({scope:a,element:b}),o.forEach(function(b,c){g(b,a)}),a.$on("$destroy",h)}function g(b,d){var e=b.match(c),f=d.$eval(e[1]),g=e[2],h=k[b];if(!h){var i=function(b){var c=null;j.some(function(a){var d=a.scope.$eval(m);return d===b?(c=a,!0):void 0}),h.lastActivated!==c&&(h.lastActivated&&a.removeClass(h.lastActivated.element,f),c&&a.addClass(c.element,f),h.lastActivated=c)};k[b]=h={lastActivated:null,scope:d,watchFn:i,compareWithExp:g,watcher:d.$watch(g,i)}}h.watchFn(d.$eval(g))}function h(a){var b=a.targetScope,c=i.indexOf(b);if(i.splice(c,1),j.splice(c,1),i.length){var d=i[0];angular.forEach(k,function(a){a.scope===b&&(a.watcher=d.$watch(a.compareWithExp,a.watchFn),a.scope=d)})}else k={}}var i=[],j=[],k={},l=e.uibIsClass.match(b),m=l[2],n=l[1],o=n.split(",");return f}}}]),angular.module("ui.bootstrap.position",[]).factory("$uibPosition",["$document","$window",function(a,b){var c,d={normal:/(auto|scroll)/,hidden:/(auto|scroll|hidden)/},e={auto:/\s?auto?\s?/i,primary:/^(top|bottom|left|right)$/,secondary:/^(top|bottom|left|right|center)$/,vertical:/^(top|bottom)$/};return{getRawNode:function(a){return a.nodeName?a:a[0]||a},parseStyle:function(a){return a=parseFloat(a),isFinite(a)?a:0},offsetParent:function(c){function d(a){return"static"===(b.getComputedStyle(a).position||"static")}c=this.getRawNode(c);for(var e=c.offsetParent||a[0].documentElement;e&&e!==a[0].documentElement&&d(e);)e=e.offsetParent;return e||a[0].documentElement},scrollbarWidth:function(){if(angular.isUndefined(c)){var b=angular.element('<div class="uib-position-scrollbar-measure"></div>');a.find("body").append(b),c=b[0].offsetWidth-b[0].clientWidth,c=isFinite(c)?c:0,b.remove()}return c},isScrollable:function(a,c){a=this.getRawNode(a);var e=c?d.hidden:d.normal,f=b.getComputedStyle(a);return e.test(f.overflow+f.overflowY+f.overflowX)},scrollParent:function(c,e){c=this.getRawNode(c);var f=e?d.hidden:d.normal,g=a[0].documentElement,h=b.getComputedStyle(c),i="absolute"===h.position,j=c.parentElement||g;if(j===g||"fixed"===h.position)return g;for(;j.parentElement&&j!==g;){var k=b.getComputedStyle(j);if(i&&"static"!==k.position&&(i=!1),!i&&f.test(k.overflow+k.overflowY+k.overflowX))break;j=j.parentElement}return j},position:function(c,d){c=this.getRawNode(c);var e=this.offset(c);if(d){var f=b.getComputedStyle(c);e.top-=this.parseStyle(f.marginTop),e.left-=this.parseStyle(f.marginLeft)}var g=this.offsetParent(c),h={top:0,left:0};return g!==a[0].documentElement&&(h=this.offset(g),h.top+=g.clientTop-g.scrollTop,h.left+=g.clientLeft-g.scrollLeft),{width:Math.round(angular.isNumber(e.width)?e.width:c.offsetWidth),height:Math.round(angular.isNumber(e.height)?e.height:c.offsetHeight),top:Math.round(e.top-h.top),left:Math.round(e.left-h.left)}},offset:function(c){c=this.getRawNode(c);var d=c.getBoundingClientRect();return{width:Math.round(angular.isNumber(d.width)?d.width:c.offsetWidth),height:Math.round(angular.isNumber(d.height)?d.height:c.offsetHeight),top:Math.round(d.top+(b.pageYOffset||a[0].documentElement.scrollTop)),left:Math.round(d.left+(b.pageXOffset||a[0].documentElement.scrollLeft))}},viewportOffset:function(c,d,e){c=this.getRawNode(c),e=e!==!1?!0:!1;var f=c.getBoundingClientRect(),g={top:0,left:0,bottom:0,right:0},h=d?a[0].documentElement:this.scrollParent(c),i=h.getBoundingClientRect();if(g.top=i.top+h.clientTop,g.left=i.left+h.clientLeft,h===a[0].documentElement&&(g.top+=b.pageYOffset,g.left+=b.pageXOffset),g.bottom=g.top+h.clientHeight,g.right=g.left+h.clientWidth,e){var j=b.getComputedStyle(h);g.top+=this.parseStyle(j.paddingTop),g.bottom-=this.parseStyle(j.paddingBottom),g.left+=this.parseStyle(j.paddingLeft),g.right-=this.parseStyle(j.paddingRight)}return{top:Math.round(f.top-g.top),bottom:Math.round(g.bottom-f.bottom),left:Math.round(f.left-g.left),right:Math.round(g.right-f.right)}},parsePlacement:function(a){var b=e.auto.test(a);return b&&(a=a.replace(e.auto,"")),a=a.split("-"),a[0]=a[0]||"top",e.primary.test(a[0])||(a[0]="top"),a[1]=a[1]||"center",e.secondary.test(a[1])||(a[1]="center"),b?a[2]=!0:a[2]=!1,a},positionElements:function(a,c,d,f){a=this.getRawNode(a),c=this.getRawNode(c);var g=angular.isDefined(c.offsetWidth)?c.offsetWidth:c.prop("offsetWidth"),h=angular.isDefined(c.offsetHeight)?c.offsetHeight:c.prop("offsetHeight");d=this.parsePlacement(d);var i=f?this.offset(a):this.position(a),j={top:0,left:0,placement:""};if(d[2]){var k=this.viewportOffset(a,f),l=b.getComputedStyle(c),m={width:g+Math.round(Math.abs(this.parseStyle(l.marginLeft)+this.parseStyle(l.marginRight))),height:h+Math.round(Math.abs(this.parseStyle(l.marginTop)+this.parseStyle(l.marginBottom)))};if(d[0]="top"===d[0]&&m.height>k.top&&m.height<=k.bottom?"bottom":"bottom"===d[0]&&m.height>k.bottom&&m.height<=k.top?"top":"left"===d[0]&&m.width>k.left&&m.width<=k.right?"right":"right"===d[0]&&m.width>k.right&&m.width<=k.left?"left":d[0],d[1]="top"===d[1]&&m.height-i.height>k.bottom&&m.height-i.height<=k.top?"bottom":"bottom"===d[1]&&m.height-i.height>k.top&&m.height-i.height<=k.bottom?"top":"left"===d[1]&&m.width-i.width>k.right&&m.width-i.width<=k.left?"right":"right"===d[1]&&m.width-i.width>k.left&&m.width-i.width<=k.right?"left":d[1],"center"===d[1])if(e.vertical.test(d[0])){var n=i.width/2-g/2;k.left+n<0&&m.width-i.width<=k.right?d[1]="left":k.right+n<0&&m.width-i.width<=k.left&&(d[1]="right")}else{var o=i.height/2-m.height/2;k.top+o<0&&m.height-i.height<=k.bottom?d[1]="top":k.bottom+o<0&&m.height-i.height<=k.top&&(d[1]="bottom")}}switch(d[0]){case"top":j.top=i.top-h;break;case"bottom":j.top=i.top+i.height;break;case"left":j.left=i.left-g;break;case"right":j.left=i.left+i.width}switch(d[1]){case"top":j.top=i.top;break;case"bottom":j.top=i.top+i.height-h;break;case"left":j.left=i.left;break;case"right":j.left=i.left+i.width-g;break;case"center":e.vertical.test(d[0])?j.left=i.left+i.width/2-g/2:j.top=i.top+i.height/2-h/2}return j.top=Math.round(j.top),j.left=Math.round(j.left),j.placement="center"===d[1]?d[0]:d[0]+"-"+d[1],j},positionArrow:function(a,c){a=this.getRawNode(a);var d=a.querySelector(".tooltip-inner, .popover-inner");if(d){var f=angular.element(d).hasClass("tooltip-inner"),g=f?a.querySelector(".tooltip-arrow"):a.querySelector(".arrow");if(g){var h={top:"",bottom:"",left:"",right:""};if(c=this.parsePlacement(c),"center"===c[1])return void angular.element(g).css(h);var i="border-"+c[0]+"-width",j=b.getComputedStyle(g)[i],k="border-";k+=e.vertical.test(c[0])?c[0]+"-"+c[1]:c[1]+"-"+c[0],k+="-radius";var l=b.getComputedStyle(f?d:a)[k];switch(c[0]){case"top":h.bottom=f?"0":"-"+j;break;case"bottom":h.top=f?"0":"-"+j;break;case"left":h.right=f?"0":"-"+j;break;case"right":h.left=f?"0":"-"+j}h[c[1]]=l,angular.element(g).css(h)}}}}}]),angular.module("ui.bootstrap.datepicker",["ui.bootstrap.dateparser","ui.bootstrap.isClass","ui.bootstrap.position"]).value("$datepickerSuppressError",!1).value("uibDatepickerAttributeWarning",!0).constant("uibDatepickerConfig",{datepickerMode:"day",formatDay:"dd",formatMonth:"MMMM",formatYear:"yyyy",formatDayHeader:"EEE",formatDayTitle:"MMMM yyyy",formatMonthTitle:"yyyy",maxDate:null,maxMode:"year",minDate:null,minMode:"day",ngModelOptions:{},shortcutPropagation:!1,showWeeks:!0,yearColumns:5,yearRows:4}).controller("UibDatepickerController",["$scope","$attrs","$parse","$interpolate","$locale","$log","dateFilter","uibDatepickerConfig","$datepickerSuppressError","uibDatepickerAttributeWarning","uibDateParser",function(a,b,c,d,e,f,g,h,i,j,k){function l(b){a.datepickerMode=b,q&&(a.datepickerOptions.datepickerMode=b)}var m=this,n={$setViewValue:angular.noop},o={},p=[],q=!!b.datepickerOptions;if(this.modes=["day","month","year"],q)["customClass","dateDisabled","datepickerMode","formatDay","formatDayHeader","formatDayTitle","formatMonth","formatMonthTitle","formatYear","initDate","maxDate","maxMode","minDate","minMode","showWeeks","shortcutPropagation","startingDay","yearColumns","yearRows"].forEach(function(b){switch(b){case"customClass":case"dateDisabled":a[b]=a.datepickerOptions[b]||angular.noop;break;case"datepickerMode":a.datepickerMode=angular.isDefined(a.datepickerOptions.datepickerMode)?a.datepickerOptions.datepickerMode:h.datepickerMode;break;case"formatDay":case"formatDayHeader":case"formatDayTitle":case"formatMonth":case"formatMonthTitle":case"formatYear":m[b]=angular.isDefined(a.datepickerOptions[b])?d(a.datepickerOptions[b])(a.$parent):h[b];break;case"showWeeks":case"shortcutPropagation":case"yearColumns":case"yearRows":m[b]=angular.isDefined(a.datepickerOptions[b])?a.datepickerOptions[b]:h[b];break;case"startingDay":angular.isDefined(a.datepickerOptions.startingDay)?m.startingDay=a.datepickerOptions.startingDay:angular.isNumber(h.startingDay)?m.startingDay=h.startingDay:m.startingDay=(e.DATETIME_FORMATS.FIRSTDAYOFWEEK+8)%7;break;case"maxDate":case"minDate":a.datepickerOptions[b]?a.$watch(function(){return a.datepickerOptions[b]},function(a){a?angular.isDate(a)?m[b]=k.fromTimezone(new Date(a),o.timezone):m[b]=new Date(g(a,"medium")):m[b]=null,m.refreshView()}):m[b]=h[b]?k.fromTimezone(new Date(h[b]),o.timezone):null;break;case"maxMode":case"minMode":a.datepickerOptions[b]?a.$watch(function(){return a.datepickerOptions[b]},function(c){m[b]=a[b]=angular.isDefined(c)?c:datepickerOptions[b],("minMode"===b&&m.modes.indexOf(a.datepickerOptions.datepickerMode)<m.modes.indexOf(m[b])||"maxMode"===b&&m.modes.indexOf(a.datepickerOptions.datepickerMode)>m.modes.indexOf(m[b]))&&(a.datepickerMode=m[b],a.datepickerOptions.datepickerMode=m[b])}):m[b]=a[b]=h[b]||null;break;case"initDate":a.datepickerOptions.initDate?(m.activeDate=k.fromTimezone(a.datepickerOptions.initDate,o.timezone)||new Date,a.$watch(function(){return a.datepickerOptions.initDate},function(a){a&&(n.$isEmpty(n.$modelValue)||n.$invalid)&&(m.activeDate=k.fromTimezone(a,o.timezone),m.refreshView())})):m.activeDate=new Date}});else{if(angular.forEach(["formatDay","formatMonth","formatYear","formatDayHeader","formatDayTitle","formatMonthTitle"],function(c){m[c]=angular.isDefined(b[c])?d(b[c])(a.$parent):h[c],angular.isDefined(b[c])&&j&&f.warn("uib-datepicker "+c+" attribute usage is deprecated, use datepicker-options attribute instead")}),angular.forEach(["showWeeks","yearRows","yearColumns","shortcutPropagation"],function(c){m[c]=angular.isDefined(b[c])?a.$parent.$eval(b[c]):h[c],angular.isDefined(b[c])&&j&&f.warn("uib-datepicker "+c+" attribute usage is deprecated, use datepicker-options attribute instead")}),angular.forEach(["dateDisabled","customClass"],function(a){angular.isDefined(b[a])&&j&&f.warn("uib-datepicker "+a+" attribute usage is deprecated, use datepicker-options attribute instead")}),angular.isDefined(b.startingDay)?(j&&f.warn("uib-datepicker startingDay attribute usage is deprecated, use datepicker-options attribute instead"),m.startingDay=a.$parent.$eval(b.startingDay)):angular.isNumber(h.startingDay)?m.startingDay=h.startingDay:m.startingDay=(e.DATETIME_FORMATS.FIRSTDAYOFWEEK+8)%7,angular.forEach(["minDate","maxDate"],function(c){b[c]?(j&&f.warn("uib-datepicker "+c+" attribute usage is deprecated, use datepicker-options attribute instead"),p.push(a.$parent.$watch(b[c],function(a){a?angular.isDate(a)?m[c]=k.fromTimezone(new Date(a),o.timezone):m[c]=new Date(g(a,"medium")):m[c]=null,m.refreshView()}))):m[c]=h[c]?k.fromTimezone(new Date(h[c]),o.timezone):null}),angular.forEach(["minMode","maxMode"],function(c){b[c]?(j&&f.warn("uib-datepicker "+c+" attribute usage is deprecated, use datepicker-options attribute instead"),p.push(a.$parent.$watch(b[c],function(d){m[c]=a[c]=angular.isDefined(d)?d:b[c],("minMode"===c&&m.modes.indexOf(a.datepickerMode)<m.modes.indexOf(m[c])||"maxMode"===c&&m.modes.indexOf(a.datepickerMode)>m.modes.indexOf(m[c]))&&(a.datepickerMode=m[c])}))):m[c]=a[c]=h[c]||null}),angular.isDefined(b.initDate)){j&&f.warn("uib-datepicker initDate attribute usage is deprecated, use datepicker-options attribute instead");var r=k.fromTimezone(a.$parent.$eval(b.initDate),o.timezone);this.activeDate=isNaN(r)?new Date:r,p.push(a.$parent.$watch(b.initDate,function(a){a&&(n.$isEmpty(n.$modelValue)||n.$invalid)&&(a=k.fromTimezone(a,o.timezone),m.activeDate=isNaN(a)?new Date:a,m.refreshView())}))}else this.activeDate=new Date;b.datepickerMode&&j&&f.warn("uib-datepicker datepickerMode attribute usage is deprecated, use datepicker-options attribute instead"),a.datepickerMode=a.datepickerMode||h.datepickerMode}a.uniqueId="datepicker-"+a.$id+"-"+Math.floor(1e4*Math.random()),a.disabled=angular.isDefined(b.disabled)||!1,angular.isDefined(b.ngDisabled)&&p.push(a.$parent.$watch(b.ngDisabled,function(b){a.disabled=b,m.refreshView()})),a.isActive=function(b){return 0===m.compare(b.date,m.activeDate)?(a.activeDateId=b.uid,!0):!1},this.init=function(a){n=a,o=a.$options||h.ngModelOptions,this.activeDate=n.$modelValue||new Date,n.$render=function(){m.render()}},this.render=function(){if(n.$viewValue){var a=new Date(n.$viewValue),b=!isNaN(a);b?this.activeDate=k.fromTimezone(a,o.timezone):i||f.error('Datepicker directive: "ng-model" value must be a Date object')}this.refreshView()},this.refreshView=function(){if(this.element){a.selectedDt=null,this._refreshView(),a.activeDt&&(a.activeDateId=a.activeDt.uid);var b=n.$viewValue?new Date(n.$viewValue):null;b=k.fromTimezone(b,o.timezone),n.$setValidity("dateDisabled",!b||this.element&&!this.isDisabled(b))}},this.createDateObject=function(b,c){var d=n.$viewValue?new Date(n.$viewValue):null;d=k.fromTimezone(d,o.timezone);var e=new Date;e=k.fromTimezone(e,o.timezone);var f=this.compare(b,e),g={date:b,label:k.filter(b,c),selected:d&&0===this.compare(b,d),disabled:this.isDisabled(b),past:0>f,current:0===f,future:f>0,customClass:this.customClass(b)||null};return d&&0===this.compare(b,d)&&(a.selectedDt=g),m.activeDate&&0===this.compare(g.date,m.activeDate)&&(a.activeDt=g),g},this.isDisabled=function(b){return a.disabled||this.minDate&&this.compare(b,this.minDate)<0||this.maxDate&&this.compare(b,this.maxDate)>0||a.dateDisabled&&a.dateDisabled({date:b,mode:a.datepickerMode})},this.customClass=function(b){return a.customClass({date:b,mode:a.datepickerMode})},this.split=function(a,b){for(var c=[];a.length>0;)c.push(a.splice(0,b));return c;
+},a.select=function(b){if(a.datepickerMode===m.minMode){var c=n.$viewValue?k.fromTimezone(new Date(n.$viewValue),o.timezone):new Date(0,0,0,0,0,0,0);c.setFullYear(b.getFullYear(),b.getMonth(),b.getDate()),c=k.toTimezone(c,o.timezone),n.$setViewValue(c),n.$render()}else m.activeDate=b,l(m.modes[m.modes.indexOf(a.datepickerMode)-1]),a.$emit("uib:datepicker.mode")},a.move=function(a){var b=m.activeDate.getFullYear()+a*(m.step.years||0),c=m.activeDate.getMonth()+a*(m.step.months||0);m.activeDate.setFullYear(b,c,1),m.refreshView()},a.toggleMode=function(b){b=b||1,a.datepickerMode===m.maxMode&&1===b||a.datepickerMode===m.minMode&&-1===b||(l(m.modes[m.modes.indexOf(a.datepickerMode)+b]),a.$emit("uib:datepicker.mode"))},a.keys={13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down"};var s=function(){m.element[0].focus()};a.$on("uib:datepicker.focus",s),a.keydown=function(b){var c=a.keys[b.which];if(c&&!b.shiftKey&&!b.altKey&&!a.disabled)if(b.preventDefault(),m.shortcutPropagation||b.stopPropagation(),"enter"===c||"space"===c){if(m.isDisabled(m.activeDate))return;a.select(m.activeDate)}else!b.ctrlKey||"up"!==c&&"down"!==c?(m.handleKeyDown(c,b),m.refreshView()):a.toggleMode("up"===c?1:-1)},a.$on("$destroy",function(){for(;p.length;)p.shift()()})}]).controller("UibDaypickerController",["$scope","$element","dateFilter",function(a,b,c){function d(a,b){return 1!==b||a%4!==0||a%100===0&&a%400!==0?f[b]:29}function e(a){var b=new Date(a);b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1}var f=[31,28,31,30,31,30,31,31,30,31,30,31];this.step={months:1},this.element=b,this.init=function(b){angular.extend(b,this),a.showWeeks=b.showWeeks,b.refreshView()},this.getDates=function(a,b){for(var c,d=new Array(b),e=new Date(a),f=0;b>f;)c=new Date(e),d[f++]=c,e.setDate(e.getDate()+1);return d},this._refreshView=function(){var b=this.activeDate.getFullYear(),d=this.activeDate.getMonth(),f=new Date(this.activeDate);f.setFullYear(b,d,1);var g=this.startingDay-f.getDay(),h=g>0?7-g:-g,i=new Date(f);h>0&&i.setDate(-h+1);for(var j=this.getDates(i,42),k=0;42>k;k++)j[k]=angular.extend(this.createDateObject(j[k],this.formatDay),{secondary:j[k].getMonth()!==d,uid:a.uniqueId+"-"+k});a.labels=new Array(7);for(var l=0;7>l;l++)a.labels[l]={abbr:c(j[l].date,this.formatDayHeader),full:c(j[l].date,"EEEE")};if(a.title=c(this.activeDate,this.formatDayTitle),a.rows=this.split(j,7),a.showWeeks){a.weekNumbers=[];for(var m=(11-this.startingDay)%7,n=a.rows.length,o=0;n>o;o++)a.weekNumbers.push(e(a.rows[o][m].date))}},this.compare=function(a,b){var c=new Date(a.getFullYear(),a.getMonth(),a.getDate()),d=new Date(b.getFullYear(),b.getMonth(),b.getDate());return c.setFullYear(a.getFullYear()),d.setFullYear(b.getFullYear()),c-d},this.handleKeyDown=function(a,b){var c=this.activeDate.getDate();if("left"===a)c-=1;else if("up"===a)c-=7;else if("right"===a)c+=1;else if("down"===a)c+=7;else if("pageup"===a||"pagedown"===a){var e=this.activeDate.getMonth()+("pageup"===a?-1:1);this.activeDate.setMonth(e,1),c=Math.min(d(this.activeDate.getFullYear(),this.activeDate.getMonth()),c)}else"home"===a?c=1:"end"===a&&(c=d(this.activeDate.getFullYear(),this.activeDate.getMonth()));this.activeDate.setDate(c)}}]).controller("UibMonthpickerController",["$scope","$element","dateFilter",function(a,b,c){this.step={years:1},this.element=b,this.init=function(a){angular.extend(a,this),a.refreshView()},this._refreshView=function(){for(var b,d=new Array(12),e=this.activeDate.getFullYear(),f=0;12>f;f++)b=new Date(this.activeDate),b.setFullYear(e,f,1),d[f]=angular.extend(this.createDateObject(b,this.formatMonth),{uid:a.uniqueId+"-"+f});a.title=c(this.activeDate,this.formatMonthTitle),a.rows=this.split(d,3)},this.compare=function(a,b){var c=new Date(a.getFullYear(),a.getMonth()),d=new Date(b.getFullYear(),b.getMonth());return c.setFullYear(a.getFullYear()),d.setFullYear(b.getFullYear()),c-d},this.handleKeyDown=function(a,b){var c=this.activeDate.getMonth();if("left"===a)c-=1;else if("up"===a)c-=3;else if("right"===a)c+=1;else if("down"===a)c+=3;else if("pageup"===a||"pagedown"===a){var d=this.activeDate.getFullYear()+("pageup"===a?-1:1);this.activeDate.setFullYear(d)}else"home"===a?c=0:"end"===a&&(c=11);this.activeDate.setMonth(c)}}]).controller("UibYearpickerController",["$scope","$element","dateFilter",function(a,b,c){function d(a){return parseInt((a-1)/f,10)*f+1}var e,f;this.element=b,this.yearpickerInit=function(){e=this.yearColumns,f=this.yearRows*e,this.step={years:f}},this._refreshView=function(){for(var b,c=new Array(f),g=0,h=d(this.activeDate.getFullYear());f>g;g++)b=new Date(this.activeDate),b.setFullYear(h+g,0,1),c[g]=angular.extend(this.createDateObject(b,this.formatYear),{uid:a.uniqueId+"-"+g});a.title=[c[0].label,c[f-1].label].join(" - "),a.rows=this.split(c,e),a.columns=e},this.compare=function(a,b){return a.getFullYear()-b.getFullYear()},this.handleKeyDown=function(a,b){var c=this.activeDate.getFullYear();"left"===a?c-=1:"up"===a?c-=e:"right"===a?c+=1:"down"===a?c+=e:"pageup"===a||"pagedown"===a?c+=("pageup"===a?-1:1)*f:"home"===a?c=d(this.activeDate.getFullYear()):"end"===a&&(c=d(this.activeDate.getFullYear())+f-1),this.activeDate.setFullYear(c)}}]).directive("uibDatepicker",function(){return{replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/datepicker.html"},scope:{datepickerMode:"=?",datepickerOptions:"=?",dateDisabled:"&",customClass:"&",shortcutPropagation:"&?"},require:["uibDatepicker","^ngModel"],controller:"UibDatepickerController",controllerAs:"datepicker",link:function(a,b,c,d){var e=d[0],f=d[1];e.init(f)}}}).directive("uibDaypicker",function(){return{replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/day.html"},require:["^uibDatepicker","uibDaypicker"],controller:"UibDaypickerController",link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("uibMonthpicker",function(){return{replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/month.html"},require:["^uibDatepicker","uibMonthpicker"],controller:"UibMonthpickerController",link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("uibYearpicker",function(){return{replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/year.html"},require:["^uibDatepicker","uibYearpicker"],controller:"UibYearpickerController",link:function(a,b,c,d){var e=d[0];angular.extend(e,d[1]),e.yearpickerInit(),e.refreshView()}}}).value("uibDatepickerPopupAttributeWarning",!0).constant("uibDatepickerPopupConfig",{altInputFormats:[],appendToBody:!1,clearText:"Clear",closeOnDateSelection:!0,closeText:"Done",currentText:"Today",datepickerPopup:"yyyy-MM-dd",datepickerPopupTemplateUrl:"uib/template/datepicker/popup.html",datepickerTemplateUrl:"uib/template/datepicker/datepicker.html",html5Types:{date:"yyyy-MM-dd","datetime-local":"yyyy-MM-ddTHH:mm:ss.sss",month:"yyyy-MM"},onOpenFocus:!0,showButtonBar:!0,placement:"auto bottom-left"}).controller("UibDatepickerPopupController",["$scope","$element","$attrs","$compile","$log","$parse","$window","$document","$rootScope","$uibPosition","dateFilter","uibDateParser","uibDatepickerPopupConfig","$timeout","uibDatepickerConfig","uibDatepickerPopupAttributeWarning",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){function q(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}function r(b){var c=l.parse(b,x,a.date);if(isNaN(c))for(var d=0;d<J.length;d++)if(c=l.parse(b,J[d],a.date),!isNaN(c))return c;return c}function s(a){if(angular.isNumber(a)&&(a=new Date(a)),!a)return null;if(angular.isDate(a)&&!isNaN(a))return a;if(angular.isString(a)){var b=r(a);if(!isNaN(b))return l.toTimezone(b,H.timezone)}return G.$options&&G.$options.allowInvalid?a:void 0}function t(a,b){var d=a||b;return c.ngRequired||d?(angular.isNumber(d)&&(d=new Date(d)),d?angular.isDate(d)&&!isNaN(d)?!0:angular.isString(d)?!isNaN(r(b)):!1:!0):!0}function u(c){if(a.isOpen||!a.disabled){var d=I[0],e=b[0].contains(c.target),f=void 0!==d.contains&&d.contains(c.target);!a.isOpen||e||f||a.$apply(function(){a.isOpen=!1})}}function v(c){27===c.which&&a.isOpen?(c.preventDefault(),c.stopPropagation(),a.$apply(function(){a.isOpen=!1}),b[0].focus()):40!==c.which||a.isOpen||(c.preventDefault(),c.stopPropagation(),a.$apply(function(){a.isOpen=!0}))}function w(){if(a.isOpen){var d=angular.element(I[0].querySelector(".uib-datepicker-popup")),e=c.popupPlacement?c.popupPlacement:m.placement,f=j.positionElements(b,d,e,z);d.css({top:f.top+"px",left:f.left+"px"}),d.hasClass("uib-position-measure")&&d.removeClass("uib-position-measure")}}var x,y,z,A,B,C,D,E,F,G,H,I,J,K={},L=!1,M=[];a.watchData={},this.init=function(j){if(G=j,H=j.$options||o.ngModelOptions,y=angular.isDefined(c.closeOnDateSelection)?a.$parent.$eval(c.closeOnDateSelection):m.closeOnDateSelection,z=angular.isDefined(c.datepickerAppendToBody)?a.$parent.$eval(c.datepickerAppendToBody):m.appendToBody,A=angular.isDefined(c.onOpenFocus)?a.$parent.$eval(c.onOpenFocus):m.onOpenFocus,B=angular.isDefined(c.datepickerPopupTemplateUrl)?c.datepickerPopupTemplateUrl:m.datepickerPopupTemplateUrl,C=angular.isDefined(c.datepickerTemplateUrl)?c.datepickerTemplateUrl:m.datepickerTemplateUrl,J=angular.isDefined(c.altInputFormats)?a.$parent.$eval(c.altInputFormats):m.altInputFormats,a.showButtonBar=angular.isDefined(c.showButtonBar)?a.$parent.$eval(c.showButtonBar):m.showButtonBar,m.html5Types[c.type]?(x=m.html5Types[c.type],L=!0):(x=c.uibDatepickerPopup||m.datepickerPopup,c.$observe("uibDatepickerPopup",function(a,b){var c=a||m.datepickerPopup;if(c!==x&&(x=c,G.$modelValue=null,!x))throw new Error("uibDatepickerPopup must have a date format specified.")})),!x)throw new Error("uibDatepickerPopup must have a date format specified.");if(L&&c.uibDatepickerPopup)throw new Error("HTML5 date input types do not support custom formats.");D=angular.element("<div uib-datepicker-popup-wrap><div uib-datepicker></div></div>"),a.ngModelOptions=angular.copy(H),a.ngModelOptions.timezone=null,a.ngModelOptions.updateOnDefault===!0&&(a.ngModelOptions.updateOn=a.ngModelOptions.updateOn?a.ngModelOptions.updateOn+" default":"default"),D.attr({"ng-model":"date","ng-model-options":"ngModelOptions","ng-change":"dateSelection(date)","template-url":B}),E=angular.element(D.children()[0]),E.attr("template-url",C),L&&"month"===c.type&&(E.attr("datepicker-mode",'"month"'),E.attr("min-mode","month")),a.datepickerOptions&&E.attr("datepicker-options","datepickerOptions"),angular.forEach(["minMode","maxMode","datepickerMode","shortcutPropagation"],function(b){if(c[b]){p&&e.warn("uib-datepicker settings via uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead");var d=f(c[b]),g={get:function(){return d(a.$parent)}};if(E.attr(q(b),"watchData."+b),"datepickerMode"===b){var h=d.assign;g.set=function(b){h(a.$parent,b)}}Object.defineProperty(a.watchData,b,g)}}),angular.forEach(["minDate","maxDate","initDate"],function(b){if(c[b]){p&&e.warn("uib-datepicker settings via uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead");var d=f(c[b]);M.push(a.$parent.$watch(d,function(c){if("minDate"===b||"maxDate"===b)null===c?K[b]=null:angular.isDate(c)?K[b]=l.fromTimezone(new Date(c),H.timezone):K[b]=new Date(k(c,"medium")),a.watchData[b]=null===c?null:K[b];else{var d=c?new Date(c):new Date;a.watchData[b]=l.fromTimezone(d,H.timezone)}})),E.attr(q(b),"watchData."+b)}}),c.dateDisabled&&(p&&e.warn("uib-datepicker settings via uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead"),E.attr("date-disabled","dateDisabled({ date: date, mode: mode })")),angular.forEach(["formatDay","formatMonth","formatYear","formatDayHeader","formatDayTitle","formatMonthTitle","showWeeks","startingDay","yearRows","yearColumns"],function(a){angular.isDefined(c[a])&&(p&&e.warn("uib-datepicker settings via uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead"),E.attr(q(a),c[a]))}),c.customClass&&(p&&e.warn("uib-datepicker settings via uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead"),E.attr("custom-class","customClass({ date: date, mode: mode })")),L?G.$formatters.push(function(b){return a.date=l.fromTimezone(b,H.timezone),b}):(G.$$parserName="date",G.$validators.date=t,G.$parsers.unshift(s),G.$formatters.push(function(b){return G.$isEmpty(b)?(a.date=b,b):(a.date=l.fromTimezone(b,H.timezone),angular.isNumber(a.date)&&(a.date=new Date(a.date)),l.filter(a.date,x))})),G.$viewChangeListeners.push(function(){a.date=r(G.$viewValue)}),b.on("keydown",v),I=d(D)(a),D.remove(),z?h.find("body").append(I):b.after(I),a.$on("$destroy",function(){for(a.isOpen===!0&&(i.$$phase||a.$apply(function(){a.isOpen=!1})),I.remove(),b.off("keydown",v),h.off("click",u),F&&F.off("scroll",w),angular.element(g).off("resize",w);M.length;)M.shift()()})},a.getText=function(b){return a[b+"Text"]||m[b+"Text"]},a.isDisabled=function(b){return"today"===b&&(b=new Date),a.watchData.minDate&&a.compare(b,K.minDate)<0||a.watchData.maxDate&&a.compare(b,K.maxDate)>0},a.compare=function(a,b){return new Date(a.getFullYear(),a.getMonth(),a.getDate())-new Date(b.getFullYear(),b.getMonth(),b.getDate())},a.dateSelection=function(c){angular.isDefined(c)&&(a.date=c);var d=a.date?l.filter(a.date,x):null;b.val(d),G.$setViewValue(d),y&&(a.isOpen=!1,b[0].focus())},a.keydown=function(c){27===c.which&&(c.stopPropagation(),a.isOpen=!1,b[0].focus())},a.select=function(b,c){if(c.stopPropagation(),"today"===b){var d=new Date;angular.isDate(a.date)?(b=new Date(a.date),b.setFullYear(d.getFullYear(),d.getMonth(),d.getDate())):b=new Date(d.setHours(0,0,0,0))}a.dateSelection(b)},a.close=function(c){c.stopPropagation(),a.isOpen=!1,b[0].focus()},a.disabled=angular.isDefined(c.disabled)||!1,c.ngDisabled&&M.push(a.$parent.$watch(f(c.ngDisabled),function(b){a.disabled=b})),a.$watch("isOpen",function(d){d?a.disabled?a.isOpen=!1:n(function(){w(),A&&a.$broadcast("uib:datepicker.focus"),h.on("click",u);var d=c.popupPlacement?c.popupPlacement:m.placement;z||j.parsePlacement(d)[2]?(F=F||angular.element(j.scrollParent(b)),F&&F.on("scroll",w)):F=null,angular.element(g).on("resize",w)},0,!1):(h.off("click",u),F&&F.off("scroll",w),angular.element(g).off("resize",w))}),a.$on("uib:datepicker.mode",function(){n(w,0,!1)})}]).directive("uibDatepickerPopup",function(){return{require:["ngModel","uibDatepickerPopup"],controller:"UibDatepickerPopupController",scope:{datepickerOptions:"=?",isOpen:"=?",currentText:"@",clearText:"@",closeText:"@",dateDisabled:"&",customClass:"&"},link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("uibDatepickerPopupWrap",function(){return{replace:!0,transclude:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/popup.html"}}}),angular.module("ui.bootstrap.debounce",[]).factory("$$debounce",["$timeout",function(a){return function(b,c){var d;return function(){var e=this,f=Array.prototype.slice.call(arguments);d&&a.cancel(d),d=a(function(){b.apply(e,f)},c)}}}]),angular.module("ui.bootstrap.dropdown",["ui.bootstrap.position"]).constant("uibDropdownConfig",{appendToOpenClass:"uib-dropdown-open",openClass:"open"}).service("uibDropdownService",["$document","$rootScope",function(a,b){var c=null;this.open=function(b){c||(a.on("click",d),a.on("keydown",e)),c&&c!==b&&(c.isOpen=!1),c=b},this.close=function(b){c===b&&(c=null,a.off("click",d),a.off("keydown",e))};var d=function(a){if(c&&!(a&&"disabled"===c.getAutoClose()||a&&3===a.which)){var d=c.getToggleElement();if(!(a&&d&&d[0].contains(a.target))){var e=c.getDropdownElement();a&&"outsideClick"===c.getAutoClose()&&e&&e[0].contains(a.target)||(c.isOpen=!1,b.$$phase||c.$apply())}}},e=function(a){27===a.which?(c.focusToggleElement(),d()):c.isKeynavEnabled()&&-1!==[38,40].indexOf(a.which)&&c.isOpen&&(a.preventDefault(),a.stopPropagation(),c.focusDropdownEntry(a.which))}}]).controller("UibDropdownController",["$scope","$element","$attrs","$parse","uibDropdownConfig","uibDropdownService","$animate","$uibPosition","$document","$compile","$templateRequest",function(a,b,c,d,e,f,g,h,i,j,k){var l,m,n=this,o=a.$new(),p=e.appendToOpenClass,q=e.openClass,r=angular.noop,s=c.onToggle?d(c.onToggle):angular.noop,t=!1,u=null,v=!1,w=i.find("body");b.addClass("dropdown"),this.init=function(){if(c.isOpen&&(m=d(c.isOpen),r=m.assign,a.$watch(m,function(a){o.isOpen=!!a})),angular.isDefined(c.dropdownAppendTo)){var e=d(c.dropdownAppendTo)(o);e&&(u=angular.element(e))}t=angular.isDefined(c.dropdownAppendToBody),v=angular.isDefined(c.keyboardNav),t&&!u&&(u=w),u&&n.dropdownMenu&&(u.append(n.dropdownMenu),b.on("$destroy",function(){n.dropdownMenu.remove()}))},this.toggle=function(a){return o.isOpen=arguments.length?!!a:!o.isOpen,angular.isFunction(r)&&r(o,o.isOpen),o.isOpen},this.isOpen=function(){return o.isOpen},o.getToggleElement=function(){return n.toggleElement},o.getAutoClose=function(){return c.autoClose||"always"},o.getElement=function(){return b},o.isKeynavEnabled=function(){return v},o.focusDropdownEntry=function(a){var c=n.dropdownMenu?angular.element(n.dropdownMenu).find("a"):b.find("ul").eq(0).find("a");switch(a){case 40:angular.isNumber(n.selectedOption)?n.selectedOption=n.selectedOption===c.length-1?n.selectedOption:n.selectedOption+1:n.selectedOption=0;break;case 38:angular.isNumber(n.selectedOption)?n.selectedOption=0===n.selectedOption?0:n.selectedOption-1:n.selectedOption=c.length-1}c[n.selectedOption].focus()},o.getDropdownElement=function(){return n.dropdownMenu},o.focusToggleElement=function(){n.toggleElement&&n.toggleElement[0].focus()},o.$watch("isOpen",function(c,d){if(u&&n.dropdownMenu){var e,i,m=h.positionElements(b,n.dropdownMenu,"bottom-left",!0);if(e={top:m.top+"px",display:c?"block":"none"},i=n.dropdownMenu.hasClass("dropdown-menu-right"),i?(e.left="auto",e.right=window.innerWidth-(m.left+b.prop("offsetWidth"))+"px"):(e.left=m.left+"px",e.right="auto"),!t){var v=h.offset(u);e.top=m.top-v.top+"px",i?e.right=window.innerWidth-(m.left-v.left+b.prop("offsetWidth"))+"px":e.left=m.left-v.left+"px"}n.dropdownMenu.css(e)}var w=u?u:b,x=w.hasClass(u?p:q);if(x===!c&&g[c?"addClass":"removeClass"](w,u?p:q).then(function(){angular.isDefined(c)&&c!==d&&s(a,{open:!!c})}),c)n.dropdownMenuTemplateUrl&&k(n.dropdownMenuTemplateUrl).then(function(a){l=o.$new(),j(a.trim())(l,function(a){var b=a;n.dropdownMenu.replaceWith(b),n.dropdownMenu=b})}),o.focusToggleElement(),f.open(o);else{if(n.dropdownMenuTemplateUrl){l&&l.$destroy();var y=angular.element('<ul class="dropdown-menu"></ul>');n.dropdownMenu.replaceWith(y),n.dropdownMenu=y}f.close(o),n.selectedOption=null}angular.isFunction(r)&&r(a,c)}),a.$on("$locationChangeSuccess",function(){"disabled"!==o.getAutoClose()&&(o.isOpen=!1)})}]).directive("uibDropdown",function(){return{controller:"UibDropdownController",link:function(a,b,c,d){d.init()}}}).directive("uibDropdownMenu",function(){return{restrict:"A",require:"?^uibDropdown",link:function(a,b,c,d){if(d&&!angular.isDefined(c.dropdownNested)){b.addClass("dropdown-menu");var e=c.templateUrl;e&&(d.dropdownMenuTemplateUrl=e),d.dropdownMenu||(d.dropdownMenu=b)}}}}).directive("uibDropdownToggle",function(){return{require:"?^uibDropdown",link:function(a,b,c,d){if(d){b.addClass("dropdown-toggle"),d.toggleElement=b;var e=function(e){e.preventDefault(),b.hasClass("disabled")||c.disabled||a.$apply(function(){d.toggle()})};b.bind("click",e),b.attr({"aria-haspopup":!0,"aria-expanded":!1}),a.$watch(d.isOpen,function(a){b.attr("aria-expanded",!!a)}),a.$on("$destroy",function(){b.unbind("click",e)})}}}}),angular.module("ui.bootstrap.stackedMap",[]).factory("$$stackedMap",function(){return{createNew:function(){var a=[];return{add:function(b,c){a.push({key:b,value:c})},get:function(b){for(var c=0;c<a.length;c++)if(b===a[c].key)return a[c]},keys:function(){for(var b=[],c=0;c<a.length;c++)b.push(a[c].key);return b},top:function(){return a[a.length-1]},remove:function(b){for(var c=-1,d=0;d<a.length;d++)if(b===a[d].key){c=d;break}return a.splice(c,1)[0]},removeTop:function(){return a.splice(a.length-1,1)[0]},length:function(){return a.length}}}}}),angular.module("ui.bootstrap.modal",["ui.bootstrap.stackedMap"]).factory("$$multiMap",function(){return{createNew:function(){var a={};return{entries:function(){return Object.keys(a).map(function(b){return{key:b,value:a[b]}})},get:function(b){return a[b]},hasKey:function(b){return!!a[b]},keys:function(){return Object.keys(a)},put:function(b,c){a[b]||(a[b]=[]),a[b].push(c)},remove:function(b,c){var d=a[b];if(d){var e=d.indexOf(c);-1!==e&&d.splice(e,1),d.length||delete a[b]}}}}}}).provider("$uibResolve",function(){var a=this;this.resolver=null,this.setResolver=function(a){this.resolver=a},this.$get=["$injector","$q",function(b,c){var d=a.resolver?b.get(a.resolver):null;return{resolve:function(a,e,f,g){if(d)return d.resolve(a,e,f,g);var h=[];return angular.forEach(a,function(a){angular.isFunction(a)||angular.isArray(a)?h.push(c.resolve(b.invoke(a))):angular.isString(a)?h.push(c.resolve(b.get(a))):h.push(c.resolve(a))}),c.all(h).then(function(b){var c={},d=0;return angular.forEach(a,function(a,e){c[e]=b[d++]}),c})}}}]}).directive("uibModalBackdrop",["$animate","$injector","$uibModalStack",function(a,b,c){function d(b,d,e){e.modalInClass&&(a.addClass(d,e.modalInClass),b.$on(c.NOW_CLOSING_EVENT,function(c,f){var g=f();b.modalOptions.animation?a.removeClass(d,e.modalInClass).then(g):g()}))}return{replace:!0,templateUrl:"uib/template/modal/backdrop.html",compile:function(a,b){return a.addClass(b.backdropClass),d}}}]).directive("uibModalWindow",["$uibModalStack","$q","$animateCss","$document",function(a,b,c,d){return{scope:{index:"@"},replace:!0,transclude:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/modal/window.html"},link:function(e,f,g){f.addClass(g.windowClass||""),f.addClass(g.windowTopClass||""),e.size=g.size,e.close=function(b){var c=a.getTop();c&&c.value.backdrop&&"static"!==c.value.backdrop&&b.target===b.currentTarget&&(b.preventDefault(),b.stopPropagation(),a.dismiss(c.key,"backdrop click"))},f.on("click",e.close),e.$isRendered=!0;var h=b.defer();g.$observe("modalRender",function(a){"true"===a&&h.resolve()}),h.promise.then(function(){var h=null;g.modalInClass&&(h=c(f,{addClass:g.modalInClass}).start(),e.$on(a.NOW_CLOSING_EVENT,function(a,b){var d=b();c(f,{removeClass:g.modalInClass}).start().then(d)})),b.when(h).then(function(){var b=a.getTop();if(b&&a.modalRendered(b.key),!d[0].activeElement||!f[0].contains(d[0].activeElement)){var c=f[0].querySelector("[autofocus]");c?c.focus():f[0].focus()}})})}}}]).directive("uibModalAnimationClass",function(){return{compile:function(a,b){b.modalAnimation&&a.addClass(b.uibModalAnimationClass)}}}).directive("uibModalTransclude",function(){return{link:function(a,b,c,d,e){e(a.$parent,function(a){b.empty(),b.append(a)})}}}).factory("$uibModalStack",["$animate","$animateCss","$document","$compile","$rootScope","$q","$$multiMap","$$stackedMap",function(a,b,c,d,e,f,g,h){function i(){for(var a=-1,b=t.keys(),c=0;c<b.length;c++)t.get(b[c]).value.backdrop&&(a=c);return a}function j(a,b){var c=t.get(a).value,d=c.appendTo;t.remove(a),m(c.modalDomEl,c.modalScope,function(){var b=c.openedClass||s;u.remove(b,a),d.toggleClass(b,u.hasKey(b)),k(!0)},c.closedDeferred),l(),b&&b.focus?b.focus():d.focus&&d.focus()}function k(a){var b;t.length()>0&&(b=t.top().value,b.modalDomEl.toggleClass(b.windowTopClass||"",a))}function l(){if(p&&-1===i()){var a=q;m(p,q,function(){a=null}),p=void 0,q=void 0}}function m(b,c,d,e){function g(){g.done||(g.done=!0,a.leave(b).then(function(){b.remove(),e&&e.resolve()}),c.$destroy(),d&&d())}var h,i=null,j=function(){return h||(h=f.defer(),i=h.promise),function(){h.resolve()}};return c.$broadcast(v.NOW_CLOSING_EVENT,j),f.when(i).then(g)}function n(a){if(a.isDefaultPrevented())return a;var b=t.top();if(b)switch(a.which){case 27:b.value.keyboard&&(a.preventDefault(),e.$apply(function(){v.dismiss(b.key,"escape key press")}));break;case 9:v.loadFocusElementList(b);var c=!1;a.shiftKey?(v.isFocusInFirstItem(a)||v.isModalFocused(a,b))&&(c=v.focusLastFocusableElement()):v.isFocusInLastItem(a)&&(c=v.focusFirstFocusableElement()),c&&(a.preventDefault(),a.stopPropagation())}}function o(a,b,c){return!a.value.modalScope.$broadcast("modal.closing",b,c).defaultPrevented}var p,q,r,s="modal-open",t=h.createNew(),u=g.createNew(),v={NOW_CLOSING_EVENT:"modal.stack.now-closing"},w=0,x="a[href], area[href], input:not([disabled]), button:not([disabled]),select:not([disabled]), textarea:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable=true]";return e.$watch(i,function(a){q&&(q.index=a)}),c.on("keydown",n),e.$on("$destroy",function(){c.off("keydown",n)}),v.open=function(b,f){var g=c[0].activeElement,h=f.openedClass||s;k(!1),t.add(b,{deferred:f.deferred,renderDeferred:f.renderDeferred,closedDeferred:f.closedDeferred,modalScope:f.scope,backdrop:f.backdrop,keyboard:f.keyboard,openedClass:f.openedClass,windowTopClass:f.windowTopClass,animation:f.animation,appendTo:f.appendTo}),u.put(h,b);var j=f.appendTo,l=i();if(!j.length)throw new Error("appendTo element not found. Make sure that the element passed is in DOM.");l>=0&&!p&&(q=e.$new(!0),q.modalOptions=f,q.index=l,p=angular.element('<div uib-modal-backdrop="modal-backdrop"></div>'),p.attr("backdrop-class",f.backdropClass),f.animation&&p.attr("modal-animation","true"),d(p)(q),a.enter(p,j));var m=angular.element('<div uib-modal-window="modal-window"></div>');m.attr({"template-url":f.windowTemplateUrl,"window-class":f.windowClass,"window-top-class":f.windowTopClass,size:f.size,index:t.length()-1,animate:"animate"}).html(f.content),f.animation&&m.attr("modal-animation","true"),a.enter(d(m)(f.scope),j).then(function(){f.scope.$$uibDestructionScheduled||a.addClass(j,h)}),t.top().value.modalDomEl=m,t.top().value.modalOpener=g,v.clearFocusListCache()},v.close=function(a,b){var c=t.get(a);return c&&o(c,b,!0)?(c.value.modalScope.$$uibDestructionScheduled=!0,c.value.deferred.resolve(b),j(a,c.value.modalOpener),!0):!c},v.dismiss=function(a,b){var c=t.get(a);return c&&o(c,b,!1)?(c.value.modalScope.$$uibDestructionScheduled=!0,c.value.deferred.reject(b),j(a,c.value.modalOpener),!0):!c},v.dismissAll=function(a){for(var b=this.getTop();b&&this.dismiss(b.key,a);)b=this.getTop()},v.getTop=function(){return t.top()},v.modalRendered=function(a){var b=t.get(a);b&&b.value.renderDeferred.resolve()},v.focusFirstFocusableElement=function(){return r.length>0?(r[0].focus(),!0):!1},v.focusLastFocusableElement=function(){return r.length>0?(r[r.length-1].focus(),!0):!1},v.isModalFocused=function(a,b){if(a&&b){var c=b.value.modalDomEl;if(c&&c.length)return(a.target||a.srcElement)===c[0]}return!1},v.isFocusInFirstItem=function(a){return r.length>0?(a.target||a.srcElement)===r[0]:!1},v.isFocusInLastItem=function(a){return r.length>0?(a.target||a.srcElement)===r[r.length-1]:!1},v.clearFocusListCache=function(){r=[],w=0},v.loadFocusElementList=function(a){if((void 0===r||!r.length)&&a){var b=a.value.modalDomEl;b&&b.length&&(r=b[0].querySelectorAll(x))}},v}]).provider("$uibModal",function(){var a={options:{animation:!0,backdrop:!0,keyboard:!0},$get:["$rootScope","$q","$document","$templateRequest","$controller","$uibResolve","$uibModalStack",function(b,c,d,e,f,g,h){function i(a){return a.template?c.when(a.template):e(angular.isFunction(a.templateUrl)?a.templateUrl():a.templateUrl)}var j={},k=null;return j.getPromiseChain=function(){return k},j.open=function(e){function j(){return r}var l=c.defer(),m=c.defer(),n=c.defer(),o=c.defer(),p={result:l.promise,opened:m.promise,closed:n.promise,rendered:o.promise,close:function(a){return h.close(p,a)},dismiss:function(a){return h.dismiss(p,a)}};if(e=angular.extend({},a.options,e),e.resolve=e.resolve||{},e.appendTo=e.appendTo||d.find("body").eq(0),!e.template&&!e.templateUrl)throw new Error("One of template or templateUrl options is required.");var q,r=c.all([i(e),g.resolve(e.resolve,{},null,null)]);return q=k=c.all([k]).then(j,j).then(function(a){var c=e.scope||b,d=c.$new();d.$close=p.close,d.$dismiss=p.dismiss,d.$on("$destroy",function(){d.$$uibDestructionScheduled||d.$dismiss("$uibUnscheduledDestruction")});var g,i,j={};e.controller&&(j.$scope=d,j.$uibModalInstance=p,angular.forEach(a[1],function(a,b){j[b]=a}),i=f(e.controller,j,!0),e.controllerAs?(g=i.instance,e.bindToController&&(g.$close=d.$close,g.$dismiss=d.$dismiss,angular.extend(g,c)),g=i(),d[e.controllerAs]=g):g=i(),angular.isFunction(g.$onInit)&&g.$onInit()),h.open(p,{scope:d,deferred:l,renderDeferred:o,closedDeferred:n,content:a[0],animation:e.animation,backdrop:e.backdrop,keyboard:e.keyboard,backdropClass:e.backdropClass,windowTopClass:e.windowTopClass,windowClass:e.windowClass,windowTemplateUrl:e.windowTemplateUrl,size:e.size,openedClass:e.openedClass,appendTo:e.appendTo}),m.resolve(!0)},function(a){m.reject(a),l.reject(a)})["finally"](function(){k===q&&(k=null)}),p},j}]};return a}),angular.module("ui.bootstrap.paging",[]).factory("uibPaging",["$parse",function(a){return{create:function(b,c,d){b.setNumPages=d.numPages?a(d.numPages).assign:angular.noop,b.ngModelCtrl={$setViewValue:angular.noop},b._watchers=[],b.init=function(a,e){b.ngModelCtrl=a,b.config=e,a.$render=function(){b.render()},d.itemsPerPage?b._watchers.push(c.$parent.$watch(d.itemsPerPage,function(a){b.itemsPerPage=parseInt(a,10),c.totalPages=b.calculateTotalPages(),b.updatePage()})):b.itemsPerPage=e.itemsPerPage,c.$watch("totalItems",function(a,d){(angular.isDefined(a)||a!==d)&&(c.totalPages=b.calculateTotalPages(),b.updatePage())})},b.calculateTotalPages=function(){var a=b.itemsPerPage<1?1:Math.ceil(c.totalItems/b.itemsPerPage);return Math.max(a||0,1)},b.render=function(){c.page=parseInt(b.ngModelCtrl.$viewValue,10)||1},c.selectPage=function(a,d){d&&d.preventDefault();var e=!c.ngDisabled||!d;e&&c.page!==a&&a>0&&a<=c.totalPages&&(d&&d.target&&d.target.blur(),b.ngModelCtrl.$setViewValue(a),b.ngModelCtrl.$render())},c.getText=function(a){return c[a+"Text"]||b.config[a+"Text"]},c.noPrevious=function(){return 1===c.page},c.noNext=function(){return c.page===c.totalPages},b.updatePage=function(){b.setNumPages(c.$parent,c.totalPages),c.page>c.totalPages?c.selectPage(c.totalPages):b.ngModelCtrl.$render()},c.$on("$destroy",function(){for(;b._watchers.length;)b._watchers.shift()()})}}}]),angular.module("ui.bootstrap.pager",["ui.bootstrap.paging"]).controller("UibPagerController",["$scope","$attrs","uibPaging","uibPagerConfig",function(a,b,c,d){a.align=angular.isDefined(b.align)?a.$parent.$eval(b.align):d.align,c.create(this,a,b)}]).constant("uibPagerConfig",{itemsPerPage:10,previousText:"« Previous",nextText:"Next »",align:!0}).directive("uibPager",["uibPagerConfig",function(a){return{scope:{totalItems:"=",previousText:"@",nextText:"@",ngDisabled:"="},require:["uibPager","?ngModel"],controller:"UibPagerController",controllerAs:"pager",templateUrl:function(a,b){return b.templateUrl||"uib/template/pager/pager.html"},replace:!0,link:function(b,c,d,e){var f=e[0],g=e[1];g&&f.init(g,a)}}}]),angular.module("ui.bootstrap.pagination",["ui.bootstrap.paging"]).controller("UibPaginationController",["$scope","$attrs","$parse","uibPaging","uibPaginationConfig",function(a,b,c,d,e){function f(a,b,c){return{number:a,text:b,active:c}}function g(a,b){var c=[],d=1,e=b,g=angular.isDefined(i)&&b>i;g&&(j?(d=Math.max(a-Math.floor(i/2),1),e=d+i-1,e>b&&(e=b,d=e-i+1)):(d=(Math.ceil(a/i)-1)*i+1,e=Math.min(d+i-1,b)));for(var h=d;e>=h;h++){var n=f(h,m(h),h===a);c.push(n)}if(g&&i>0&&(!j||k||l)){if(d>1){if(!l||d>3){var o=f(d-1,"...",!1);c.unshift(o)}if(l){if(3===d){var p=f(2,"2",!1);c.unshift(p)}var q=f(1,"1",!1);
+c.unshift(q)}}if(b>e){if(!l||b-2>e){var r=f(e+1,"...",!1);c.push(r)}if(l){if(e===b-2){var s=f(b-1,b-1,!1);c.push(s)}var t=f(b,b,!1);c.push(t)}}}return c}var h=this,i=angular.isDefined(b.maxSize)?a.$parent.$eval(b.maxSize):e.maxSize,j=angular.isDefined(b.rotate)?a.$parent.$eval(b.rotate):e.rotate,k=angular.isDefined(b.forceEllipses)?a.$parent.$eval(b.forceEllipses):e.forceEllipses,l=angular.isDefined(b.boundaryLinkNumbers)?a.$parent.$eval(b.boundaryLinkNumbers):e.boundaryLinkNumbers,m=angular.isDefined(b.pageLabel)?function(c){return a.$parent.$eval(b.pageLabel,{$page:c})}:angular.identity;a.boundaryLinks=angular.isDefined(b.boundaryLinks)?a.$parent.$eval(b.boundaryLinks):e.boundaryLinks,a.directionLinks=angular.isDefined(b.directionLinks)?a.$parent.$eval(b.directionLinks):e.directionLinks,d.create(this,a,b),b.maxSize&&h._watchers.push(a.$parent.$watch(c(b.maxSize),function(a){i=parseInt(a,10),h.render()}));var n=this.render;this.render=function(){n(),a.page>0&&a.page<=a.totalPages&&(a.pages=g(a.page,a.totalPages))}}]).constant("uibPaginationConfig",{itemsPerPage:10,boundaryLinks:!1,boundaryLinkNumbers:!1,directionLinks:!0,firstText:"First",previousText:"Previous",nextText:"Next",lastText:"Last",rotate:!0,forceEllipses:!1}).directive("uibPagination",["$parse","uibPaginationConfig",function(a,b){return{scope:{totalItems:"=",firstText:"@",previousText:"@",nextText:"@",lastText:"@",ngDisabled:"="},require:["uibPagination","?ngModel"],controller:"UibPaginationController",controllerAs:"pagination",templateUrl:function(a,b){return b.templateUrl||"uib/template/pagination/pagination.html"},replace:!0,link:function(a,c,d,e){var f=e[0],g=e[1];g&&f.init(g,b)}}}]),angular.module("ui.bootstrap.tooltip",["ui.bootstrap.position","ui.bootstrap.stackedMap"]).provider("$uibTooltip",function(){function a(a){var b=/[A-Z]/g,c="-";return a.replace(b,function(a,b){return(b?c:"")+a.toLowerCase()})}var b={placement:"top",placementClassPrefix:"",animation:!0,popupDelay:0,popupCloseDelay:0,useContentExp:!1},c={mouseenter:"mouseleave",click:"click",outsideClick:"outsideClick",focus:"blur",none:""},d={};this.options=function(a){angular.extend(d,a)},this.setTriggers=function(a){angular.extend(c,a)},this.$get=["$window","$compile","$timeout","$document","$uibPosition","$interpolate","$rootScope","$parse","$$stackedMap",function(e,f,g,h,i,j,k,l,m){function n(a){if(27===a.which){var b=o.top();b&&(b.value.close(),o.removeTop(),b=null)}}var o=m.createNew();return h.on("keypress",n),k.$on("$destroy",function(){h.off("keypress",n)}),function(e,k,m,n){function p(a){var b=(a||n.trigger||m).split(" "),d=b.map(function(a){return c[a]||a});return{show:b,hide:d}}n=angular.extend({},b,d,n);var q=a(e),r=j.startSymbol(),s=j.endSymbol(),t="<div "+q+'-popup title="'+r+"title"+s+'" '+(n.useContentExp?'content-exp="contentExp()" ':'content="'+r+"content"+s+'" ')+'placement="'+r+"placement"+s+'" popup-class="'+r+"popupClass"+s+'" animation="animation" is-open="isOpen"origin-scope="origScope" class="uib-position-measure"></div>';return{compile:function(a,b){var c=f(t);return function(a,b,d,f){function j(){N.isOpen?q():m()}function m(){(!M||a.$eval(d[k+"Enable"]))&&(u(),x(),N.popupDelay?G||(G=g(r,N.popupDelay,!1)):r())}function q(){s(),N.popupCloseDelay?H||(H=g(t,N.popupCloseDelay,!1)):t()}function r(){return s(),u(),N.content?(v(),void N.$evalAsync(function(){N.isOpen=!0,y(!0),S()})):angular.noop}function s(){G&&(g.cancel(G),G=null),I&&(g.cancel(I),I=null)}function t(){N&&N.$evalAsync(function(){N&&(N.isOpen=!1,y(!1),N.animation?F||(F=g(w,150,!1)):w())})}function u(){H&&(g.cancel(H),H=null),F&&(g.cancel(F),F=null)}function v(){D||(E=N.$new(),D=c(E,function(a){K?h.find("body").append(a):b.after(a)}),z())}function w(){s(),u(),A(),D&&(D.remove(),D=null),E&&(E.$destroy(),E=null)}function x(){N.title=d[k+"Title"],Q?N.content=Q(a):N.content=d[e],N.popupClass=d[k+"Class"],N.placement=angular.isDefined(d[k+"Placement"])?d[k+"Placement"]:n.placement;var b=i.parsePlacement(N.placement);J=b[1]?b[0]+"-"+b[1]:b[0];var c=parseInt(d[k+"PopupDelay"],10),f=parseInt(d[k+"PopupCloseDelay"],10);N.popupDelay=isNaN(c)?n.popupDelay:c,N.popupCloseDelay=isNaN(f)?n.popupCloseDelay:f}function y(b){P&&angular.isFunction(P.assign)&&P.assign(a,b)}function z(){R.length=0,Q?(R.push(a.$watch(Q,function(a){N.content=a,!a&&N.isOpen&&t()})),R.push(E.$watch(function(){O||(O=!0,E.$$postDigest(function(){O=!1,N&&N.isOpen&&S()}))}))):R.push(d.$observe(e,function(a){N.content=a,!a&&N.isOpen?t():S()})),R.push(d.$observe(k+"Title",function(a){N.title=a,N.isOpen&&S()})),R.push(d.$observe(k+"Placement",function(a){N.placement=a?a:n.placement;var b=i.parsePlacement(N.placement);J=b[1]?b[0]+"-"+b[1]:b[0],N.isOpen&&S()}))}function A(){R.length&&(angular.forEach(R,function(a){a()}),R.length=0)}function B(a){N&&N.isOpen&&D&&(b[0].contains(a.target)||D[0].contains(a.target)||q())}function C(){var a=d[k+"Trigger"];T(),L=p(a),"none"!==L.show&&L.show.forEach(function(a,c){"outsideClick"===a?(b.on("click",j),h.on("click",B)):a===L.hide[c]?b.on(a,j):a&&(b.on(a,m),b.on(L.hide[c],q)),b.on("keypress",function(a){27===a.which&&q()})})}var D,E,F,G,H,I,J,K=angular.isDefined(n.appendToBody)?n.appendToBody:!1,L=p(void 0),M=angular.isDefined(d[k+"Enable"]),N=a.$new(!0),O=!1,P=angular.isDefined(d[k+"IsOpen"])?l(d[k+"IsOpen"]):!1,Q=n.useContentExp?l(d[e]):!1,R=[],S=function(){D&&D.html()&&(I||(I=g(function(){var a=i.positionElements(b,D,N.placement,K);D.css({top:a.top+"px",left:a.left+"px"}),D.hasClass(a.placement.split("-")[0])||(D.removeClass(J.split("-")[0]),D.addClass(a.placement.split("-")[0])),D.hasClass(n.placementClassPrefix+a.placement)||(D.removeClass(n.placementClassPrefix+J),D.addClass(n.placementClassPrefix+a.placement)),D.hasClass("uib-position-measure")?(i.positionArrow(D,a.placement),D.removeClass("uib-position-measure")):J!==a.placement&&i.positionArrow(D,a.placement),J=a.placement,I=null},0,!1)))};N.origScope=a,N.isOpen=!1,o.add(N,{close:t}),N.contentExp=function(){return N.content},d.$observe("disabled",function(a){a&&s(),a&&N.isOpen&&t()}),P&&a.$watch(P,function(a){N&&!a===N.isOpen&&j()});var T=function(){L.show.forEach(function(a){"outsideClick"===a?b.off("click",j):(b.off(a,m),b.off(a,j))}),L.hide.forEach(function(a){"outsideClick"===a?h.off("click",B):b.off(a,q)})};C();var U=a.$eval(d[k+"Animation"]);N.animation=angular.isDefined(U)?!!U:n.animation;var V,W=k+"AppendToBody";V=W in d&&void 0===d[W]?!0:a.$eval(d[W]),K=angular.isDefined(V)?V:K,a.$on("$destroy",function(){T(),w(),o.remove(N),N=null})}}}}}]}).directive("uibTooltipTemplateTransclude",["$animate","$sce","$compile","$templateRequest",function(a,b,c,d){return{link:function(e,f,g){var h,i,j,k=e.$eval(g.tooltipTemplateTranscludeScope),l=0,m=function(){i&&(i.remove(),i=null),h&&(h.$destroy(),h=null),j&&(a.leave(j).then(function(){i=null}),i=j,j=null)};e.$watch(b.parseAsResourceUrl(g.uibTooltipTemplateTransclude),function(b){var g=++l;b?(d(b,!0).then(function(d){if(g===l){var e=k.$new(),i=d,n=c(i)(e,function(b){m(),a.enter(b,f)});h=e,j=n,h.$emit("$includeContentLoaded",b)}},function(){g===l&&(m(),e.$emit("$includeContentError",b))}),e.$emit("$includeContentRequested",b)):m()}),e.$on("$destroy",m)}}}]).directive("uibTooltipClasses",["$uibPosition",function(a){return{restrict:"A",link:function(b,c,d){if(b.placement){var e=a.parsePlacement(b.placement);c.addClass(e[0])}b.popupClass&&c.addClass(b.popupClass),b.animation()&&c.addClass(d.tooltipAnimationClass)}}}]).directive("uibTooltipPopup",function(){return{replace:!0,scope:{content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/tooltip/tooltip-popup.html"}}).directive("uibTooltip",["$uibTooltip",function(a){return a("uibTooltip","tooltip","mouseenter")}]).directive("uibTooltipTemplatePopup",function(){return{replace:!0,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"uib/template/tooltip/tooltip-template-popup.html"}}).directive("uibTooltipTemplate",["$uibTooltip",function(a){return a("uibTooltipTemplate","tooltip","mouseenter",{useContentExp:!0})}]).directive("uibTooltipHtmlPopup",function(){return{replace:!0,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/tooltip/tooltip-html-popup.html"}}).directive("uibTooltipHtml",["$uibTooltip",function(a){return a("uibTooltipHtml","tooltip","mouseenter",{useContentExp:!0})}]),angular.module("ui.bootstrap.popover",["ui.bootstrap.tooltip"]).directive("uibPopoverTemplatePopup",function(){return{replace:!0,scope:{title:"@",contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"uib/template/popover/popover-template.html"}}).directive("uibPopoverTemplate",["$uibTooltip",function(a){return a("uibPopoverTemplate","popover","click",{useContentExp:!0})}]).directive("uibPopoverHtmlPopup",function(){return{replace:!0,scope:{contentExp:"&",title:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/popover/popover-html.html"}}).directive("uibPopoverHtml",["$uibTooltip",function(a){return a("uibPopoverHtml","popover","click",{useContentExp:!0})}]).directive("uibPopoverPopup",function(){return{replace:!0,scope:{title:"@",content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/popover/popover.html"}}).directive("uibPopover",["$uibTooltip",function(a){return a("uibPopover","popover","click")}]),angular.module("ui.bootstrap.progressbar",[]).constant("uibProgressConfig",{animate:!0,max:100}).controller("UibProgressController",["$scope","$attrs","uibProgressConfig",function(a,b,c){function d(){return angular.isDefined(a.maxParam)?a.maxParam:c.max}var e=this,f=angular.isDefined(b.animate)?a.$parent.$eval(b.animate):c.animate;this.bars=[],a.max=d(),this.addBar=function(a,b,c){f||b.css({transition:"none"}),this.bars.push(a),a.max=d(),a.title=c&&angular.isDefined(c.title)?c.title:"progressbar",a.$watch("value",function(b){a.recalculatePercentage()}),a.recalculatePercentage=function(){var b=e.bars.reduce(function(a,b){return b.percent=+(100*b.value/b.max).toFixed(2),a+b.percent},0);b>100&&(a.percent-=b-100)},a.$on("$destroy",function(){b=null,e.removeBar(a)})},this.removeBar=function(a){this.bars.splice(this.bars.indexOf(a),1),this.bars.forEach(function(a){a.recalculatePercentage()})},a.$watch("maxParam",function(a){e.bars.forEach(function(a){a.max=d(),a.recalculatePercentage()})})}]).directive("uibProgress",function(){return{replace:!0,transclude:!0,controller:"UibProgressController",require:"uibProgress",scope:{maxParam:"=?max"},templateUrl:"uib/template/progressbar/progress.html"}}).directive("uibBar",function(){return{replace:!0,transclude:!0,require:"^uibProgress",scope:{value:"=",type:"@"},templateUrl:"uib/template/progressbar/bar.html",link:function(a,b,c,d){d.addBar(a,b,c)}}}).directive("uibProgressbar",function(){return{replace:!0,transclude:!0,controller:"UibProgressController",scope:{value:"=",maxParam:"=?max",type:"@"},templateUrl:"uib/template/progressbar/progressbar.html",link:function(a,b,c,d){d.addBar(a,angular.element(b.children()[0]),{title:c.title})}}}),angular.module("ui.bootstrap.rating",[]).constant("uibRatingConfig",{max:5,stateOn:null,stateOff:null,titles:["one","two","three","four","five"]}).controller("UibRatingController",["$scope","$attrs","uibRatingConfig",function(a,b,c){var d={$setViewValue:angular.noop},e=this;this.init=function(e){d=e,d.$render=this.render,d.$formatters.push(function(a){return angular.isNumber(a)&&a<<0!==a&&(a=Math.round(a)),a}),this.stateOn=angular.isDefined(b.stateOn)?a.$parent.$eval(b.stateOn):c.stateOn,this.stateOff=angular.isDefined(b.stateOff)?a.$parent.$eval(b.stateOff):c.stateOff;var f=angular.isDefined(b.titles)?a.$parent.$eval(b.titles):c.titles;this.titles=angular.isArray(f)&&f.length>0?f:c.titles;var g=angular.isDefined(b.ratingStates)?a.$parent.$eval(b.ratingStates):new Array(angular.isDefined(b.max)?a.$parent.$eval(b.max):c.max);a.range=this.buildTemplateObjects(g)},this.buildTemplateObjects=function(a){for(var b=0,c=a.length;c>b;b++)a[b]=angular.extend({index:b},{stateOn:this.stateOn,stateOff:this.stateOff,title:this.getTitle(b)},a[b]);return a},this.getTitle=function(a){return a>=this.titles.length?a+1:this.titles[a]},a.rate=function(b){!a.readonly&&b>=0&&b<=a.range.length&&(d.$setViewValue(d.$viewValue===b?0:b),d.$render())},a.enter=function(b){a.readonly||(a.value=b),a.onHover({value:b})},a.reset=function(){a.value=d.$viewValue,a.onLeave()},a.onKeydown=function(b){/(37|38|39|40)/.test(b.which)&&(b.preventDefault(),b.stopPropagation(),a.rate(a.value+(38===b.which||39===b.which?1:-1)))},this.render=function(){a.value=d.$viewValue,a.title=e.getTitle(a.value-1)}}]).directive("uibRating",function(){return{require:["uibRating","ngModel"],scope:{readonly:"=?readOnly",onHover:"&",onLeave:"&"},controller:"UibRatingController",templateUrl:"uib/template/rating/rating.html",replace:!0,link:function(a,b,c,d){var e=d[0],f=d[1];e.init(f)}}}),angular.module("ui.bootstrap.tabs",[]).controller("UibTabsetController",["$scope",function(a){function b(a){for(var b=0;b<d.tabs.length;b++)if(d.tabs[b].index===a)return b}var c,d=this;d.tabs=[],d.select=function(a){if(!e){var f=b(c),g=d.tabs[f];g&&(g.tab.onDeselect(),g.tab.active=!1);var h=d.tabs[a];h?(h.tab.onSelect(),h.tab.active=!0,d.active=h.index,c=h.index):!h&&angular.isNumber(c)&&(d.active=null,c=null)}},d.addTab=function(a){if(d.tabs.push({tab:a,index:a.index}),d.tabs.sort(function(a,b){return a.index>b.index?1:a.index<b.index?-1:0}),a.index===d.active||!angular.isNumber(d.active)&&1===d.tabs.length){var c=b(a.index);d.select(c)}},d.removeTab=function(a){var c=b(a.index);if(a.index===d.active){var e=c===d.tabs.length-1?c-1:c+1%d.tabs.length;d.select(e)}d.tabs.splice(c,1)},a.$watch("tabset.active",function(a){angular.isNumber(a)&&a!==c&&d.select(b(a))});var e;a.$on("$destroy",function(){e=!0})}]).directive("uibTabset",function(){return{transclude:!0,replace:!0,scope:{},bindToController:{active:"=?",type:"@"},controller:"UibTabsetController",controllerAs:"tabset",templateUrl:function(a,b){return b.templateUrl||"uib/template/tabs/tabset.html"},link:function(a,b,c){a.vertical=angular.isDefined(c.vertical)?a.$parent.$eval(c.vertical):!1,a.justified=angular.isDefined(c.justified)?a.$parent.$eval(c.justified):!1,angular.isUndefined(c.active)&&(a.active=0)}}}).directive("uibTab",["$parse",function(a){return{require:"^uibTabset",replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/tabs/tab.html"},transclude:!0,scope:{heading:"@",index:"=?",classes:"@?",onSelect:"&select",onDeselect:"&deselect"},controller:function(){},controllerAs:"tab",link:function(b,c,d,e,f){b.disabled=!1,d.disable&&b.$parent.$watch(a(d.disable),function(a){b.disabled=!!a}),angular.isUndefined(d.index)&&(e.tabs&&e.tabs.length?b.index=Math.max.apply(null,e.tabs.map(function(a){return a.index}))+1:b.index=0),angular.isUndefined(d.classes)&&(b.classes=""),b.select=function(){if(!b.disabled){for(var a,c=0;c<e.tabs.length;c++)if(e.tabs[c].tab===b){a=c;break}e.select(a)}},e.addTab(b),b.$on("$destroy",function(){e.removeTab(b)}),b.$transcludeFn=f}}}]).directive("uibTabHeadingTransclude",function(){return{restrict:"A",require:"^uibTab",link:function(a,b){a.$watch("headingElement",function(a){a&&(b.html(""),b.append(a))})}}}).directive("uibTabContentTransclude",function(){function a(a){return a.tagName&&(a.hasAttribute("uib-tab-heading")||a.hasAttribute("data-uib-tab-heading")||a.hasAttribute("x-uib-tab-heading")||"uib-tab-heading"===a.tagName.toLowerCase()||"data-uib-tab-heading"===a.tagName.toLowerCase()||"x-uib-tab-heading"===a.tagName.toLowerCase()||"uib:tab-heading"===a.tagName.toLowerCase())}return{restrict:"A",require:"^uibTabset",link:function(b,c,d){var e=b.$eval(d.uibTabContentTransclude).tab;e.$transcludeFn(e.$parent,function(b){angular.forEach(b,function(b){a(b)?e.headingElement=b:c.append(b)})})}}}),angular.module("ui.bootstrap.timepicker",[]).constant("uibTimepickerConfig",{hourStep:1,minuteStep:1,secondStep:1,showMeridian:!0,showSeconds:!1,meridians:null,readonlyInput:!1,mousewheel:!0,arrowkeys:!0,showSpinners:!0,templateUrl:"uib/template/timepicker/timepicker.html"}).controller("UibTimepickerController",["$scope","$element","$attrs","$parse","$log","$locale","uibTimepickerConfig",function(a,b,c,d,e,f,g){function h(){var b=+a.hours,c=a.showMeridian?b>0&&13>b:b>=0&&24>b;return c?(a.showMeridian&&(12===b&&(b=0),a.meridian===u[1]&&(b+=12)),b):void 0}function i(){var b=+a.minutes;return b>=0&&60>b?b:void 0}function j(){var b=+a.seconds;return b>=0&&60>b?b:void 0}function k(a){return null===a?"":angular.isDefined(a)&&a.toString().length<2?"0"+a:a.toString()}function l(a){m(),t.$setViewValue(new Date(r)),n(a)}function m(){t.$setValidity("time",!0),a.invalidHours=!1,a.invalidMinutes=!1,a.invalidSeconds=!1}function n(b){if(t.$modelValue){var c=r.getHours(),d=r.getMinutes(),e=r.getSeconds();a.showMeridian&&(c=0===c||12===c?12:c%12),a.hours="h"===b?c:k(c),"m"!==b&&(a.minutes=k(d)),a.meridian=r.getHours()<12?u[0]:u[1],"s"!==b&&(a.seconds=k(e)),a.meridian=r.getHours()<12?u[0]:u[1]}else a.hours=null,a.minutes=null,a.seconds=null,a.meridian=u[0]}function o(a){r=q(r,a),l()}function p(a,b){return q(a,60*b)}function q(a,b){var c=new Date(a.getTime()+1e3*b),d=new Date(a);return d.setHours(c.getHours(),c.getMinutes(),c.getSeconds()),d}var r=new Date,s=[],t={$setViewValue:angular.noop},u=angular.isDefined(c.meridians)?a.$parent.$eval(c.meridians):g.meridians||f.DATETIME_FORMATS.AMPMS;a.tabindex=angular.isDefined(c.tabindex)?c.tabindex:0,b.removeAttr("tabindex"),this.init=function(b,d){t=b,t.$render=this.render,t.$formatters.unshift(function(a){return a?new Date(a):null});var e=d.eq(0),f=d.eq(1),h=d.eq(2),i=angular.isDefined(c.mousewheel)?a.$parent.$eval(c.mousewheel):g.mousewheel;i&&this.setupMousewheelEvents(e,f,h);var j=angular.isDefined(c.arrowkeys)?a.$parent.$eval(c.arrowkeys):g.arrowkeys;j&&this.setupArrowkeyEvents(e,f,h),a.readonlyInput=angular.isDefined(c.readonlyInput)?a.$parent.$eval(c.readonlyInput):g.readonlyInput,this.setupInputEvents(e,f,h)};var v=g.hourStep;c.hourStep&&s.push(a.$parent.$watch(d(c.hourStep),function(a){v=+a}));var w=g.minuteStep;c.minuteStep&&s.push(a.$parent.$watch(d(c.minuteStep),function(a){w=+a}));var x;s.push(a.$parent.$watch(d(c.min),function(a){var b=new Date(a);x=isNaN(b)?void 0:b}));var y;s.push(a.$parent.$watch(d(c.max),function(a){var b=new Date(a);y=isNaN(b)?void 0:b}));var z=!1;c.ngDisabled&&s.push(a.$parent.$watch(d(c.ngDisabled),function(a){z=a})),a.noIncrementHours=function(){var a=p(r,60*v);return z||a>y||r>a&&x>a},a.noDecrementHours=function(){var a=p(r,60*-v);return z||x>a||a>r&&a>y},a.noIncrementMinutes=function(){var a=p(r,w);return z||a>y||r>a&&x>a},a.noDecrementMinutes=function(){var a=p(r,-w);return z||x>a||a>r&&a>y},a.noIncrementSeconds=function(){var a=q(r,A);return z||a>y||r>a&&x>a},a.noDecrementSeconds=function(){var a=q(r,-A);return z||x>a||a>r&&a>y},a.noToggleMeridian=function(){return r.getHours()<12?z||p(r,720)>y:z||p(r,-720)<x};var A=g.secondStep;c.secondStep&&s.push(a.$parent.$watch(d(c.secondStep),function(a){A=+a})),a.showSeconds=g.showSeconds,c.showSeconds&&s.push(a.$parent.$watch(d(c.showSeconds),function(b){a.showSeconds=!!b})),a.showMeridian=g.showMeridian,c.showMeridian&&s.push(a.$parent.$watch(d(c.showMeridian),function(b){if(a.showMeridian=!!b,t.$error.time){var c=h(),d=i();angular.isDefined(c)&&angular.isDefined(d)&&(r.setHours(c),l())}else n()})),this.setupMousewheelEvents=function(b,c,d){var e=function(a){a.originalEvent&&(a=a.originalEvent);var b=a.wheelDelta?a.wheelDelta:-a.deltaY;return a.detail||b>0};b.bind("mousewheel wheel",function(b){z||a.$apply(e(b)?a.incrementHours():a.decrementHours()),b.preventDefault()}),c.bind("mousewheel wheel",function(b){z||a.$apply(e(b)?a.incrementMinutes():a.decrementMinutes()),b.preventDefault()}),d.bind("mousewheel wheel",function(b){z||a.$apply(e(b)?a.incrementSeconds():a.decrementSeconds()),b.preventDefault()})},this.setupArrowkeyEvents=function(b,c,d){b.bind("keydown",function(b){z||(38===b.which?(b.preventDefault(),a.incrementHours(),a.$apply()):40===b.which&&(b.preventDefault(),a.decrementHours(),a.$apply()))}),c.bind("keydown",function(b){z||(38===b.which?(b.preventDefault(),a.incrementMinutes(),a.$apply()):40===b.which&&(b.preventDefault(),a.decrementMinutes(),a.$apply()))}),d.bind("keydown",function(b){z||(38===b.which?(b.preventDefault(),a.incrementSeconds(),a.$apply()):40===b.which&&(b.preventDefault(),a.decrementSeconds(),a.$apply()))})},this.setupInputEvents=function(b,c,d){if(a.readonlyInput)return a.updateHours=angular.noop,a.updateMinutes=angular.noop,void(a.updateSeconds=angular.noop);var e=function(b,c,d){t.$setViewValue(null),t.$setValidity("time",!1),angular.isDefined(b)&&(a.invalidHours=b),angular.isDefined(c)&&(a.invalidMinutes=c),angular.isDefined(d)&&(a.invalidSeconds=d)};a.updateHours=function(){var a=h(),b=i();t.$setDirty(),angular.isDefined(a)&&angular.isDefined(b)?(r.setHours(a),r.setMinutes(b),x>r||r>y?e(!0):l("h")):e(!0)},b.bind("blur",function(b){t.$setTouched(),null===a.hours||""===a.hours?e(!0):!a.invalidHours&&a.hours<10&&a.$apply(function(){a.hours=k(a.hours)})}),a.updateMinutes=function(){var a=i(),b=h();t.$setDirty(),angular.isDefined(a)&&angular.isDefined(b)?(r.setHours(b),r.setMinutes(a),x>r||r>y?e(void 0,!0):l("m")):e(void 0,!0)},c.bind("blur",function(b){t.$setTouched(),null===a.minutes?e(void 0,!0):!a.invalidMinutes&&a.minutes<10&&a.$apply(function(){a.minutes=k(a.minutes)})}),a.updateSeconds=function(){var a=j();t.$setDirty(),angular.isDefined(a)?(r.setSeconds(a),l("s")):e(void 0,void 0,!0)},d.bind("blur",function(b){!a.invalidSeconds&&a.seconds<10&&a.$apply(function(){a.seconds=k(a.seconds)})})},this.render=function(){var b=t.$viewValue;isNaN(b)?(t.$setValidity("time",!1),e.error('Timepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.')):(b&&(r=b),x>r||r>y?(t.$setValidity("time",!1),a.invalidHours=!0,a.invalidMinutes=!0):m(),n())},a.showSpinners=angular.isDefined(c.showSpinners)?a.$parent.$eval(c.showSpinners):g.showSpinners,a.incrementHours=function(){a.noIncrementHours()||o(60*v*60)},a.decrementHours=function(){a.noDecrementHours()||o(60*-v*60)},a.incrementMinutes=function(){a.noIncrementMinutes()||o(60*w)},a.decrementMinutes=function(){a.noDecrementMinutes()||o(60*-w)},a.incrementSeconds=function(){a.noIncrementSeconds()||o(A)},a.decrementSeconds=function(){a.noDecrementSeconds()||o(-A)},a.toggleMeridian=function(){var b=i(),c=h();a.noToggleMeridian()||(angular.isDefined(b)&&angular.isDefined(c)?o(720*(r.getHours()<12?60:-60)):a.meridian=a.meridian===u[0]?u[1]:u[0])},a.blur=function(){t.$setTouched()},a.$on("$destroy",function(){for(;s.length;)s.shift()()})}]).directive("uibTimepicker",["uibTimepickerConfig",function(a){return{require:["uibTimepicker","?^ngModel"],controller:"UibTimepickerController",controllerAs:"timepicker",replace:!0,scope:{},templateUrl:function(b,c){return c.templateUrl||a.templateUrl},link:function(a,b,c,d){var e=d[0],f=d[1];f&&e.init(f,b.find("input"))}}}]),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.debounce","ui.bootstrap.position"]).factory("uibTypeaheadParser",["$parse",function(a){var b=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(c){var d=c.match(b);if(!d)throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "'+c+'".');return{itemName:d[3],source:a(d[4]),viewMapper:a(d[2]||d[1]),modelMapper:a(d[1])}}}}]).controller("UibTypeaheadController",["$scope","$element","$attrs","$compile","$parse","$q","$timeout","$document","$window","$rootScope","$$debounce","$uibPosition","uibTypeaheadParser",function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(){N.moveInProgress||(N.moveInProgress=!0,N.$digest()),Y()}function o(){N.position=D?l.offset(b):l.position(b),N.position.top+=b.prop("offsetHeight")}var p,q,r=[9,13,27,38,40],s=200,t=a.$eval(c.typeaheadMinLength);t||0===t||(t=1),a.$watch(c.typeaheadMinLength,function(a){t=a||0===a?a:1});var u=a.$eval(c.typeaheadWaitMs)||0,v=a.$eval(c.typeaheadEditable)!==!1;a.$watch(c.typeaheadEditable,function(a){v=a!==!1});var w,x,y=e(c.typeaheadLoading).assign||angular.noop,z=e(c.typeaheadOnSelect),A=angular.isDefined(c.typeaheadSelectOnBlur)?a.$eval(c.typeaheadSelectOnBlur):!1,B=e(c.typeaheadNoResults).assign||angular.noop,C=c.typeaheadInputFormatter?e(c.typeaheadInputFormatter):void 0,D=c.typeaheadAppendToBody?a.$eval(c.typeaheadAppendToBody):!1,E=c.typeaheadAppendTo?a.$eval(c.typeaheadAppendTo):null,F=a.$eval(c.typeaheadFocusFirst)!==!1,G=c.typeaheadSelectOnExact?a.$eval(c.typeaheadSelectOnExact):!1,H=e(c.typeaheadIsOpen).assign||angular.noop,I=a.$eval(c.typeaheadShowHint)||!1,J=e(c.ngModel),K=e(c.ngModel+"($$$p)"),L=function(b,c){return angular.isFunction(J(a))&&q&&q.$options&&q.$options.getterSetter?K(b,{$$$p:c}):J.assign(b,c)},M=m.parse(c.uibTypeahead),N=a.$new(),O=a.$on("$destroy",function(){N.$destroy()});N.$on("$destroy",O);var P="typeahead-"+N.$id+"-"+Math.floor(1e4*Math.random());b.attr({"aria-autocomplete":"list","aria-expanded":!1,"aria-owns":P});var Q,R;I&&(Q=angular.element("<div></div>"),Q.css("position","relative"),b.after(Q),R=b.clone(),R.attr("placeholder",""),R.attr("tabindex","-1"),R.val(""),R.css({position:"absolute",top:"0px",left:"0px","border-color":"transparent","box-shadow":"none",opacity:1,background:"none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255)",color:"#999"}),b.css({position:"relative","vertical-align":"top","background-color":"transparent"}),Q.append(R),R.after(b));var S=angular.element("<div uib-typeahead-popup></div>");S.attr({id:P,matches:"matches",active:"activeIdx",select:"select(activeIdx, evt)","move-in-progress":"moveInProgress",query:"query",position:"position","assign-is-open":"assignIsOpen(isOpen)",debounce:"debounceUpdate"}),angular.isDefined(c.typeaheadTemplateUrl)&&S.attr("template-url",c.typeaheadTemplateUrl),angular.isDefined(c.typeaheadPopupTemplateUrl)&&S.attr("popup-template-url",c.typeaheadPopupTemplateUrl);var T=function(){I&&R.val("")},U=function(){N.matches=[],N.activeIdx=-1,b.attr("aria-expanded",!1),T()},V=function(a){return P+"-option-"+a};N.$watch("activeIdx",function(a){0>a?b.removeAttr("aria-activedescendant"):b.attr("aria-activedescendant",V(a))});var W=function(a,b){return N.matches.length>b&&a?a.toUpperCase()===N.matches[b].label.toUpperCase():!1},X=function(c,d){var e={$viewValue:c};y(a,!0),B(a,!1),f.when(M.source(a,e)).then(function(f){var g=c===p.$viewValue;if(g&&w)if(f&&f.length>0){N.activeIdx=F?0:-1,B(a,!1),N.matches.length=0;for(var h=0;h<f.length;h++)e[M.itemName]=f[h],N.matches.push({id:V(h),label:M.viewMapper(N,e),model:f[h]});if(N.query=c,o(),b.attr("aria-expanded",!0),G&&1===N.matches.length&&W(c,0)&&(angular.isNumber(N.debounceUpdate)||angular.isObject(N.debounceUpdate)?k(function(){N.select(0,d)},angular.isNumber(N.debounceUpdate)?N.debounceUpdate:N.debounceUpdate["default"]):N.select(0,d)),I){var i=N.matches[0].label;angular.isString(c)&&c.length>0&&i.slice(0,c.length).toUpperCase()===c.toUpperCase()?R.val(c+i.slice(c.length)):R.val("")}}else U(),B(a,!0);g&&y(a,!1)},function(){U(),y(a,!1),B(a,!0)})};D&&(angular.element(i).on("resize",n),h.find("body").on("scroll",n));var Y=k(function(){N.matches.length&&o(),N.moveInProgress=!1},s);N.moveInProgress=!1,N.query=void 0;var Z,$=function(a){Z=g(function(){X(a)},u)},_=function(){Z&&g.cancel(Z)};U(),N.assignIsOpen=function(b){H(a,b)},N.select=function(d,e){var f,h,i={};x=!0,i[M.itemName]=h=N.matches[d].model,f=M.modelMapper(a,i),L(a,f),p.$setValidity("editable",!0),p.$setValidity("parse",!0),z(a,{$item:h,$model:f,$label:M.viewMapper(a,i),$event:e}),U(),N.$eval(c.typeaheadFocusOnSelect)!==!1&&g(function(){b[0].focus()},0,!1)},b.on("keydown",function(b){if(0!==N.matches.length&&-1!==r.indexOf(b.which)){if(-1===N.activeIdx&&(9===b.which||13===b.which)||9===b.which&&b.shiftKey)return U(),void N.$digest();b.preventDefault();var c;switch(b.which){case 9:case 13:N.$apply(function(){angular.isNumber(N.debounceUpdate)||angular.isObject(N.debounceUpdate)?k(function(){N.select(N.activeIdx,b)},angular.isNumber(N.debounceUpdate)?N.debounceUpdate:N.debounceUpdate["default"]):N.select(N.activeIdx,b)});break;case 27:b.stopPropagation(),U(),a.$digest();break;case 38:N.activeIdx=(N.activeIdx>0?N.activeIdx:N.matches.length)-1,N.$digest(),c=S.find("li")[N.activeIdx],c.parentNode.scrollTop=c.offsetTop;break;case 40:N.activeIdx=(N.activeIdx+1)%N.matches.length,N.$digest(),c=S.find("li")[N.activeIdx],c.parentNode.scrollTop=c.offsetTop}}}),b.bind("focus",function(a){w=!0,0!==t||p.$viewValue||g(function(){X(p.$viewValue,a)},0)}),b.bind("blur",function(a){A&&N.matches.length&&-1!==N.activeIdx&&!x&&(x=!0,N.$apply(function(){angular.isObject(N.debounceUpdate)&&angular.isNumber(N.debounceUpdate.blur)?k(function(){N.select(N.activeIdx,a)},N.debounceUpdate.blur):N.select(N.activeIdx,a)})),!v&&p.$error.editable&&(p.$viewValue="",b.val("")),w=!1,x=!1});var aa=function(c){b[0]!==c.target&&3!==c.which&&0!==N.matches.length&&(U(),j.$$phase||a.$digest())};h.on("click",aa),a.$on("$destroy",function(){h.off("click",aa),(D||E)&&ba.remove(),D&&(angular.element(i).off("resize",n),h.find("body").off("scroll",n)),S.remove(),I&&Q.remove()});var ba=d(S)(N);D?h.find("body").append(ba):E?angular.element(E).eq(0).append(ba):b.after(ba),this.init=function(b,c){p=b,q=c,N.debounceUpdate=p.$options&&e(p.$options.debounce)(a),p.$parsers.unshift(function(b){return w=!0,0===t||b&&b.length>=t?u>0?(_(),$(b)):X(b):(y(a,!1),_(),U()),v?b:b?void p.$setValidity("editable",!1):(p.$setValidity("editable",!0),null)}),p.$formatters.push(function(b){var c,d,e={};return v||p.$setValidity("editable",!0),C?(e.$model=b,C(a,e)):(e[M.itemName]=b,c=M.viewMapper(a,e),e[M.itemName]=void 0,d=M.viewMapper(a,e),c!==d?c:b)})}}]).directive("uibTypeahead",function(){return{controller:"UibTypeaheadController",require:["ngModel","^?ngModelOptions","uibTypeahead"],link:function(a,b,c,d){d[2].init(d[0],d[1])}}}).directive("uibTypeaheadPopup",["$$debounce",function(a){return{scope:{matches:"=",query:"=",active:"=",position:"&",moveInProgress:"=",select:"&",assignIsOpen:"&",debounce:"&"},replace:!0,templateUrl:function(a,b){return b.popupTemplateUrl||"uib/template/typeahead/typeahead-popup.html"},link:function(b,c,d){b.templateUrl=d.templateUrl,b.isOpen=function(){var a=b.matches.length>0;return b.assignIsOpen({isOpen:a}),a},b.isActive=function(a){return b.active===a},b.selectActive=function(a){b.active=a},b.selectMatch=function(c,d){var e=b.debounce();angular.isNumber(e)||angular.isObject(e)?a(function(){b.select({activeIdx:c,evt:d})},angular.isNumber(e)?e:e["default"]):b.select({activeIdx:c,evt:d})}}}}]).directive("uibTypeaheadMatch",["$templateRequest","$compile","$parse",function(a,b,c){return{scope:{index:"=",match:"=",query:"="},link:function(d,e,f){var g=c(f.templateUrl)(d.$parent)||"uib/template/typeahead/typeahead-match.html";a(g).then(function(a){var c=angular.element(a.trim());e.replaceWith(c),b(c)(d)})}}}]).filter("uibTypeaheadHighlight",["$sce","$injector","$log",function(a,b,c){function d(a){return a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}function e(a){return/<.*>/g.test(a)}var f;return f=b.has("$sanitize"),function(b,g){return!f&&e(b)&&c.warn("Unsafe use of typeahead please use ngSanitize"),b=g?(""+b).replace(new RegExp(d(g),"gi"),"<strong>$&</strong>"):b,f||(b=a.trustAsHtml(b)),b}}]),angular.module("uib/template/accordion/accordion-group.html",[]).run(["$templateCache",function(a){a.put("uib/template/accordion/accordion-group.html",'<div class="panel" ng-class="panelClass || \'panel-default\'">\n <div role="tab" id="{{::headingId}}" aria-selected="{{isOpen}}" class="panel-heading" ng-keypress="toggleOpen($event)">\n <h4 class="panel-title">\n <a role="button" data-toggle="collapse" href aria-expanded="{{isOpen}}" aria-controls="{{::panelId}}" tabindex="0" class="accordion-toggle" ng-click="toggleOpen()" uib-accordion-transclude="heading"><span uib-accordion-header ng-class="{\'text-muted\': isDisabled}">{{heading}}</span></a>\n </h4>\n </div>\n <div id="{{::panelId}}" aria-labelledby="{{::headingId}}" aria-hidden="{{!isOpen}}" role="tabpanel" class="panel-collapse collapse" uib-collapse="!isOpen">\n <div class="panel-body" ng-transclude></div>\n </div>\n</div>\n');
+}]),angular.module("uib/template/accordion/accordion.html",[]).run(["$templateCache",function(a){a.put("uib/template/accordion/accordion.html",'<div role="tablist" class="panel-group" ng-transclude></div>')}]),angular.module("uib/template/alert/alert.html",[]).run(["$templateCache",function(a){a.put("uib/template/alert/alert.html",'<div class="alert" ng-class="[\'alert-\' + (type || \'warning\'), closeable ? \'alert-dismissible\' : null]" role="alert">\n <button ng-show="closeable" type="button" class="close" ng-click="close({$event: $event})">\n <span aria-hidden="true">&times;</span>\n <span class="sr-only">Close</span>\n </button>\n <div ng-transclude></div>\n</div>\n')}]),angular.module("uib/template/carousel/carousel.html",[]).run(["$templateCache",function(a){a.put("uib/template/carousel/carousel.html",'<div ng-mouseenter="pause()" ng-mouseleave="play()" class="carousel" ng-swipe-right="prev()" ng-swipe-left="next()">\n <div class="carousel-inner" ng-transclude></div>\n <a role="button" href class="left carousel-control" ng-click="prev()" ng-show="slides.length > 1">\n <span aria-hidden="true" class="glyphicon glyphicon-chevron-left"></span>\n <span class="sr-only">previous</span>\n </a>\n <a role="button" href class="right carousel-control" ng-click="next()" ng-show="slides.length > 1">\n <span aria-hidden="true" class="glyphicon glyphicon-chevron-right"></span>\n <span class="sr-only">next</span>\n </a>\n <ol class="carousel-indicators" ng-show="slides.length > 1">\n <li ng-repeat="slide in slides | orderBy:indexOfSlide track by $index" ng-class="{ active: isActive(slide) }" ng-click="select(slide)">\n <span class="sr-only">slide {{ $index + 1 }} of {{ slides.length }}<span ng-if="isActive(slide)">, currently active</span></span>\n </li>\n </ol>\n</div>\n')}]),angular.module("uib/template/carousel/slide.html",[]).run(["$templateCache",function(a){a.put("uib/template/carousel/slide.html",'<div ng-class="{\n \'active\': active\n }" class="item text-center" ng-transclude></div>\n')}]),angular.module("uib/template/datepicker/datepicker.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/datepicker.html",'<div class="uib-datepicker" ng-switch="datepickerMode" role="application" ng-keydown="keydown($event)">\n <uib-daypicker ng-switch-when="day" tabindex="0"></uib-daypicker>\n <uib-monthpicker ng-switch-when="month" tabindex="0"></uib-monthpicker>\n <uib-yearpicker ng-switch-when="year" tabindex="0"></uib-yearpicker>\n</div>\n')}]),angular.module("uib/template/datepicker/day.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/day.html",'<table class="uib-daypicker" role="grid" aria-labelledby="{{::uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n <thead>\n <tr>\n <th><button type="button" class="btn btn-default btn-sm pull-left uib-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n <th colspan="{{::5 + showWeeks}}"><button id="{{::uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1"><strong>{{title}}</strong></button></th>\n <th><button type="button" class="btn btn-default btn-sm pull-right uib-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n </tr>\n <tr>\n <th ng-if="showWeeks" class="text-center"></th>\n <th ng-repeat="label in ::labels track by $index" class="text-center"><small aria-label="{{::label.full}}">{{::label.abbr}}</small></th>\n </tr>\n </thead>\n <tbody>\n <tr class="uib-weeks" ng-repeat="row in rows track by $index">\n <td ng-if="showWeeks" class="text-center h6"><em>{{ weekNumbers[$index] }}</em></td>\n <td ng-repeat="dt in row" class="uib-day text-center" role="gridcell"\n id="{{::dt.uid}}"\n ng-class="::dt.customClass">\n <button type="button" class="btn btn-default btn-sm"\n uib-is-class="\n \'btn-info\' for selectedDt,\n \'active\' for activeDt\n on dt"\n ng-click="select(dt.date)"\n ng-disabled="::dt.disabled"\n tabindex="-1"><span ng-class="::{\'text-muted\': dt.secondary, \'text-info\': dt.current}">{{::dt.label}}</span></button>\n </td>\n </tr>\n </tbody>\n</table>\n')}]),angular.module("uib/template/datepicker/month.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/month.html",'<table class="uib-monthpicker" role="grid" aria-labelledby="{{::uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n <thead>\n <tr>\n <th><button type="button" class="btn btn-default btn-sm pull-left uib-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n <th><button id="{{::uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1"><strong>{{title}}</strong></button></th>\n <th><button type="button" class="btn btn-default btn-sm pull-right uib-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n </tr>\n </thead>\n <tbody>\n <tr class="uib-months" ng-repeat="row in rows track by $index">\n <td ng-repeat="dt in row" class="uib-month text-center" role="gridcell"\n id="{{::dt.uid}}"\n ng-class="::dt.customClass">\n <button type="button" class="btn btn-default"\n uib-is-class="\n \'btn-info\' for selectedDt,\n \'active\' for activeDt\n on dt"\n ng-click="select(dt.date)"\n ng-disabled="::dt.disabled"\n tabindex="-1"><span ng-class="::{\'text-info\': dt.current}">{{::dt.label}}</span></button>\n </td>\n </tr>\n </tbody>\n</table>\n')}]),angular.module("uib/template/datepicker/popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/popup.html",'<div>\n <ul class="uib-datepicker-popup dropdown-menu uib-position-measure" dropdown-nested ng-if="isOpen" ng-keydown="keydown($event)" ng-click="$event.stopPropagation()">\n <li ng-transclude></li>\n <li ng-if="showButtonBar" class="uib-button-bar">\n <span class="btn-group pull-left">\n <button type="button" class="btn btn-sm btn-info uib-datepicker-current" ng-click="select(\'today\', $event)" ng-disabled="isDisabled(\'today\')">{{ getText(\'current\') }}</button>\n <button type="button" class="btn btn-sm btn-danger uib-clear" ng-click="select(null, $event)">{{ getText(\'clear\') }}</button>\n </span>\n <button type="button" class="btn btn-sm btn-success pull-right uib-close" ng-click="close($event)">{{ getText(\'close\') }}</button>\n </li>\n </ul>\n</div>\n')}]),angular.module("uib/template/datepicker/year.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/year.html",'<table class="uib-yearpicker" role="grid" aria-labelledby="{{::uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n <thead>\n <tr>\n <th><button type="button" class="btn btn-default btn-sm pull-left uib-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n <th colspan="{{::columns - 2}}"><button id="{{::uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1"><strong>{{title}}</strong></button></th>\n <th><button type="button" class="btn btn-default btn-sm pull-right uib-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n </tr>\n </thead>\n <tbody>\n <tr class="uib-years" ng-repeat="row in rows track by $index">\n <td ng-repeat="dt in row" class="uib-year text-center" role="gridcell"\n id="{{::dt.uid}}"\n ng-class="::dt.customClass">\n <button type="button" class="btn btn-default"\n uib-is-class="\n \'btn-info\' for selectedDt,\n \'active\' for activeDt\n on dt"\n ng-click="select(dt.date)"\n ng-disabled="::dt.disabled"\n tabindex="-1"><span ng-class="::{\'text-info\': dt.current}">{{::dt.label}}</span></button>\n </td>\n </tr>\n </tbody>\n</table>\n')}]),angular.module("uib/template/modal/backdrop.html",[]).run(["$templateCache",function(a){a.put("uib/template/modal/backdrop.html",'<div class="modal-backdrop"\n uib-modal-animation-class="fade"\n modal-in-class="in"\n ng-style="{\'z-index\': 1040 + (index && 1 || 0) + index*10}"\n></div>\n')}]),angular.module("uib/template/modal/window.html",[]).run(["$templateCache",function(a){a.put("uib/template/modal/window.html",'<div modal-render="{{$isRendered}}" tabindex="-1" role="dialog" class="modal"\n uib-modal-animation-class="fade"\n modal-in-class="in"\n ng-style="{\'z-index\': 1050 + index*10, display: \'block\'}">\n <div class="modal-dialog {{size ? \'modal-\' + size : \'\'}}"><div class="modal-content" uib-modal-transclude></div></div>\n</div>\n')}]),angular.module("uib/template/pager/pager.html",[]).run(["$templateCache",function(a){a.put("uib/template/pager/pager.html",'<ul class="pager">\n <li ng-class="{disabled: noPrevious()||ngDisabled, previous: align}"><a href ng-click="selectPage(page - 1, $event)">{{::getText(\'previous\')}}</a></li>\n <li ng-class="{disabled: noNext()||ngDisabled, next: align}"><a href ng-click="selectPage(page + 1, $event)">{{::getText(\'next\')}}</a></li>\n</ul>\n')}]),angular.module("uib/template/pagination/pager.html",[]).run(["$templateCache",function(a){a.put("uib/template/pagination/pager.html",'<ul class="pager">\n <li ng-class="{disabled: noPrevious()||ngDisabled, previous: align}"><a href ng-click="selectPage(page - 1, $event)">{{::getText(\'previous\')}}</a></li>\n <li ng-class="{disabled: noNext()||ngDisabled, next: align}"><a href ng-click="selectPage(page + 1, $event)">{{::getText(\'next\')}}</a></li>\n</ul>\n')}]),angular.module("uib/template/pagination/pagination.html",[]).run(["$templateCache",function(a){a.put("uib/template/pagination/pagination.html",'<ul class="pagination">\n <li ng-if="::boundaryLinks" ng-class="{disabled: noPrevious()||ngDisabled}" class="pagination-first"><a href ng-click="selectPage(1, $event)">{{::getText(\'first\')}}</a></li>\n <li ng-if="::directionLinks" ng-class="{disabled: noPrevious()||ngDisabled}" class="pagination-prev"><a href ng-click="selectPage(page - 1, $event)">{{::getText(\'previous\')}}</a></li>\n <li ng-repeat="page in pages track by $index" ng-class="{active: page.active,disabled: ngDisabled&&!page.active}" class="pagination-page"><a href ng-click="selectPage(page.number, $event)">{{page.text}}</a></li>\n <li ng-if="::directionLinks" ng-class="{disabled: noNext()||ngDisabled}" class="pagination-next"><a href ng-click="selectPage(page + 1, $event)">{{::getText(\'next\')}}</a></li>\n <li ng-if="::boundaryLinks" ng-class="{disabled: noNext()||ngDisabled}" class="pagination-last"><a href ng-click="selectPage(totalPages, $event)">{{::getText(\'last\')}}</a></li>\n</ul>\n')}]),angular.module("uib/template/tooltip/tooltip-html-popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/tooltip/tooltip-html-popup.html",'<div class="tooltip"\n tooltip-animation-class="fade"\n uib-tooltip-classes\n ng-class="{ in: isOpen() }">\n <div class="tooltip-arrow"></div>\n <div class="tooltip-inner" ng-bind-html="contentExp()"></div>\n</div>\n')}]),angular.module("uib/template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/tooltip/tooltip-popup.html",'<div class="tooltip"\n tooltip-animation-class="fade"\n uib-tooltip-classes\n ng-class="{ in: isOpen() }">\n <div class="tooltip-arrow"></div>\n <div class="tooltip-inner" ng-bind="content"></div>\n</div>\n')}]),angular.module("uib/template/tooltip/tooltip-template-popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/tooltip/tooltip-template-popup.html",'<div class="tooltip"\n tooltip-animation-class="fade"\n uib-tooltip-classes\n ng-class="{ in: isOpen() }">\n <div class="tooltip-arrow"></div>\n <div class="tooltip-inner"\n uib-tooltip-template-transclude="contentExp()"\n tooltip-template-transclude-scope="originScope()"></div>\n</div>\n')}]),angular.module("uib/template/popover/popover-html.html",[]).run(["$templateCache",function(a){a.put("uib/template/popover/popover-html.html",'<div class="popover"\n tooltip-animation-class="fade"\n uib-tooltip-classes\n ng-class="{ in: isOpen() }">\n <div class="arrow"></div>\n\n <div class="popover-inner">\n <h3 class="popover-title" ng-bind="title" ng-if="title"></h3>\n <div class="popover-content" ng-bind-html="contentExp()"></div>\n </div>\n</div>\n')}]),angular.module("uib/template/popover/popover-template.html",[]).run(["$templateCache",function(a){a.put("uib/template/popover/popover-template.html",'<div class="popover"\n tooltip-animation-class="fade"\n uib-tooltip-classes\n ng-class="{ in: isOpen() }">\n <div class="arrow"></div>\n\n <div class="popover-inner">\n <h3 class="popover-title" ng-bind="title" ng-if="title"></h3>\n <div class="popover-content"\n uib-tooltip-template-transclude="contentExp()"\n tooltip-template-transclude-scope="originScope()"></div>\n </div>\n</div>\n')}]),angular.module("uib/template/popover/popover.html",[]).run(["$templateCache",function(a){a.put("uib/template/popover/popover.html",'<div class="popover"\n tooltip-animation-class="fade"\n uib-tooltip-classes\n ng-class="{ in: isOpen() }">\n <div class="arrow"></div>\n\n <div class="popover-inner">\n <h3 class="popover-title" ng-bind="title" ng-if="title"></h3>\n <div class="popover-content" ng-bind="content"></div>\n </div>\n</div>\n')}]),angular.module("uib/template/progressbar/bar.html",[]).run(["$templateCache",function(a){a.put("uib/template/progressbar/bar.html",'<div class="progress-bar" ng-class="type && \'progress-bar-\' + type" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="{{max}}" ng-style="{width: (percent < 100 ? percent : 100) + \'%\'}" aria-valuetext="{{percent | number:0}}%" aria-labelledby="{{::title}}" ng-transclude></div>\n')}]),angular.module("uib/template/progressbar/progress.html",[]).run(["$templateCache",function(a){a.put("uib/template/progressbar/progress.html",'<div class="progress" ng-transclude aria-labelledby="{{::title}}"></div>')}]),angular.module("uib/template/progressbar/progressbar.html",[]).run(["$templateCache",function(a){a.put("uib/template/progressbar/progressbar.html",'<div class="progress">\n <div class="progress-bar" ng-class="type && \'progress-bar-\' + type" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="{{max}}" ng-style="{width: (percent < 100 ? percent : 100) + \'%\'}" aria-valuetext="{{percent | number:0}}%" aria-labelledby="{{::title}}" ng-transclude></div>\n</div>\n')}]),angular.module("uib/template/rating/rating.html",[]).run(["$templateCache",function(a){a.put("uib/template/rating/rating.html",'<span ng-mouseleave="reset()" ng-keydown="onKeydown($event)" tabindex="0" role="slider" aria-valuemin="0" aria-valuemax="{{range.length}}" aria-valuenow="{{value}}" aria-valuetext="{{title}}">\n <span ng-repeat-start="r in range track by $index" class="sr-only">({{ $index < value ? \'*\' : \' \' }})</span>\n <i ng-repeat-end ng-mouseenter="enter($index + 1)" ng-click="rate($index + 1)" class="glyphicon" ng-class="$index < value && (r.stateOn || \'glyphicon-star\') || (r.stateOff || \'glyphicon-star-empty\')" ng-attr-title="{{r.title}}"></i>\n</span>\n')}]),angular.module("uib/template/tabs/tab.html",[]).run(["$templateCache",function(a){a.put("uib/template/tabs/tab.html",'<li ng-class="[{active: active, disabled: disabled}, classes]" class="uib-tab nav-item">\n <a href ng-click="select()" class="nav-link" uib-tab-heading-transclude>{{heading}}</a>\n</li>\n')}]),angular.module("uib/template/tabs/tabset.html",[]).run(["$templateCache",function(a){a.put("uib/template/tabs/tabset.html",'<div>\n <ul class="nav nav-{{tabset.type || \'tabs\'}}" ng-class="{\'nav-stacked\': vertical, \'nav-justified\': justified}" ng-transclude></ul>\n <div class="tab-content">\n <div class="tab-pane"\n ng-repeat="tab in tabset.tabs"\n ng-class="{active: tabset.active === tab.index}"\n uib-tab-content-transclude="tab">\n </div>\n </div>\n</div>\n')}]),angular.module("uib/template/timepicker/timepicker.html",[]).run(["$templateCache",function(a){a.put("uib/template/timepicker/timepicker.html",'<table class="uib-timepicker">\n <tbody>\n <tr class="text-center" ng-show="::showSpinners">\n <td class="uib-increment hours"><a ng-click="incrementHours()" ng-class="{disabled: noIncrementHours()}" class="btn btn-link" ng-disabled="noIncrementHours()" tabindex="{{::tabindex}}"><span class="glyphicon glyphicon-chevron-up"></span></a></td>\n <td>&nbsp;</td>\n <td class="uib-increment minutes"><a ng-click="incrementMinutes()" ng-class="{disabled: noIncrementMinutes()}" class="btn btn-link" ng-disabled="noIncrementMinutes()" tabindex="{{::tabindex}}"><span class="glyphicon glyphicon-chevron-up"></span></a></td>\n <td ng-show="showSeconds">&nbsp;</td>\n <td ng-show="showSeconds" class="uib-increment seconds"><a ng-click="incrementSeconds()" ng-class="{disabled: noIncrementSeconds()}" class="btn btn-link" ng-disabled="noIncrementSeconds()" tabindex="{{::tabindex}}"><span class="glyphicon glyphicon-chevron-up"></span></a></td>\n <td ng-show="showMeridian"></td>\n </tr>\n <tr>\n <td class="form-group uib-time hours" ng-class="{\'has-error\': invalidHours}">\n <input style="width:50px;" type="text" placeholder="HH" ng-model="hours" ng-change="updateHours()" class="form-control text-center" ng-readonly="::readonlyInput" maxlength="2" tabindex="{{::tabindex}}" ng-disabled="noIncrementHours()" ng-blur="blur()">\n </td>\n <td class="uib-separator">:</td>\n <td class="form-group uib-time minutes" ng-class="{\'has-error\': invalidMinutes}">\n <input style="width:50px;" type="text" placeholder="MM" ng-model="minutes" ng-change="updateMinutes()" class="form-control text-center" ng-readonly="::readonlyInput" maxlength="2" tabindex="{{::tabindex}}" ng-disabled="noIncrementMinutes()" ng-blur="blur()">\n </td>\n <td ng-show="showSeconds" class="uib-separator">:</td>\n <td class="form-group uib-time seconds" ng-class="{\'has-error\': invalidSeconds}" ng-show="showSeconds">\n <input style="width:50px;" type="text" placeholder="SS" ng-model="seconds" ng-change="updateSeconds()" class="form-control text-center" ng-readonly="readonlyInput" maxlength="2" tabindex="{{::tabindex}}" ng-disabled="noIncrementSeconds()" ng-blur="blur()">\n </td>\n <td ng-show="showMeridian" class="uib-time am-pm"><button type="button" ng-class="{disabled: noToggleMeridian()}" class="btn btn-default text-center" ng-click="toggleMeridian()" ng-disabled="noToggleMeridian()" tabindex="{{::tabindex}}">{{meridian}}</button></td>\n </tr>\n <tr class="text-center" ng-show="::showSpinners">\n <td class="uib-decrement hours"><a ng-click="decrementHours()" ng-class="{disabled: noDecrementHours()}" class="btn btn-link" ng-disabled="noDecrementHours()" tabindex="{{::tabindex}}"><span class="glyphicon glyphicon-chevron-down"></span></a></td>\n <td>&nbsp;</td>\n <td class="uib-decrement minutes"><a ng-click="decrementMinutes()" ng-class="{disabled: noDecrementMinutes()}" class="btn btn-link" ng-disabled="noDecrementMinutes()" tabindex="{{::tabindex}}"><span class="glyphicon glyphicon-chevron-down"></span></a></td>\n <td ng-show="showSeconds">&nbsp;</td>\n <td ng-show="showSeconds" class="uib-decrement seconds"><a ng-click="decrementSeconds()" ng-class="{disabled: noDecrementSeconds()}" class="btn btn-link" ng-disabled="noDecrementSeconds()" tabindex="{{::tabindex}}"><span class="glyphicon glyphicon-chevron-down"></span></a></td>\n <td ng-show="showMeridian"></td>\n </tr>\n </tbody>\n</table>\n')}]),angular.module("uib/template/typeahead/typeahead-match.html",[]).run(["$templateCache",function(a){a.put("uib/template/typeahead/typeahead-match.html",'<a href\n tabindex="-1"\n ng-bind-html="match.label | uibTypeaheadHighlight:query"\n ng-attr-title="{{match.label}}"></a>\n')}]),angular.module("uib/template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/typeahead/typeahead-popup.html",'<ul class="dropdown-menu" ng-show="isOpen() && !moveInProgress" ng-style="{top: position().top+\'px\', left: position().left+\'px\'}" role="listbox" aria-hidden="{{!isOpen()}}">\n <li ng-repeat="match in matches track by $index" ng-class="{active: isActive($index) }" ng-mouseenter="selectActive($index)" ng-click="selectMatch($index, $event)" role="option" id="{{::match.id}}">\n <div uib-typeahead-match index="$index" match="match" query="query" template-url="templateUrl"></div>\n </li>\n</ul>\n')}]),angular.module("ui.bootstrap.carousel").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibCarouselCss&&angular.element(document).find("head").prepend('<style type="text/css">.ng-animate.item:not(.left):not(.right){-webkit-transition:0s ease-in-out left;transition:0s ease-in-out left}</style>'),angular.$$uibCarouselCss=!0}),angular.module("ui.bootstrap.position").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibPositionCss&&angular.element(document).find("head").prepend('<style type="text/css">.uib-position-measure{display:block !important;visibility:hidden !important;position:absolute !important;top:-9999px !important;left:-9999px !important;}.uib-position-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll;}</style>'),angular.$$uibPositionCss=!0}),angular.module("ui.bootstrap.datepicker").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibDatepickerCss&&angular.element(document).find("head").prepend('<style type="text/css">.uib-datepicker .uib-title{width:100%;}.uib-day button,.uib-month button,.uib-year button{min-width:100%;}.uib-datepicker-popup.dropdown-menu{display:block;float:none;margin:0;}.uib-button-bar{padding:10px 9px 2px;}.uib-left,.uib-right{width:100%}</style>'),angular.$$uibDatepickerCss=!0}),angular.module("ui.bootstrap.tooltip").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibTooltipCss&&angular.element(document).find("head").prepend('<style type="text/css">[uib-tooltip-popup].tooltip.top-left > .tooltip-arrow,[uib-tooltip-popup].tooltip.top-right > .tooltip-arrow,[uib-tooltip-popup].tooltip.bottom-left > .tooltip-arrow,[uib-tooltip-popup].tooltip.bottom-right > .tooltip-arrow,[uib-tooltip-popup].tooltip.left-top > .tooltip-arrow,[uib-tooltip-popup].tooltip.left-bottom > .tooltip-arrow,[uib-tooltip-popup].tooltip.right-top > .tooltip-arrow,[uib-tooltip-popup].tooltip.right-bottom > .tooltip-arrow,[uib-popover-popup].popover.top-left > .arrow,[uib-popover-popup].popover.top-right > .arrow,[uib-popover-popup].popover.bottom-left > .arrow,[uib-popover-popup].popover.bottom-right > .arrow,[uib-popover-popup].popover.left-top > .arrow,[uib-popover-popup].popover.left-bottom > .arrow,[uib-popover-popup].popover.right-top > .arrow,[uib-popover-popup].popover.right-bottom > .arrow{top:auto;bottom:auto;left:auto;right:auto;margin:0;}[uib-popover-popup].popover,[uib-popover-template-popup].popover{display:block !important;}</style>'),angular.$$uibTooltipCss=!0}),angular.module("ui.bootstrap.timepicker").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibTimepickerCss&&angular.element(document).find("head").prepend('<style type="text/css">.uib-time input{width:50px;}</style>'),angular.$$uibTimepickerCss=!0}),angular.module("ui.bootstrap.typeahead").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibTypeaheadCss&&angular.element(document).find("head").prepend('<style type="text/css">[uib-typeahead-popup].dropdown-menu{display:block;}</style>'),angular.$$uibTypeaheadCss=!0}); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/bootstrap/bs.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/bootstrap/bs.css
new file mode 100644
index 00000000..f62911f2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/bootstrap/bs.css
@@ -0,0 +1,678 @@
+.fade {
+ opacity: 0;
+ -webkit-transition: opacity .15s linear;
+ -o-transition: opacity .15s linear;
+ transition: opacity .15s linear;
+}
+.fade.in {
+ opacity: 1;
+}
+.modal-open {
+ overflow: hidden;
+}
+.modal {
+ position: fixed;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ z-index: 99999;
+ display: none;
+ overflow: hidden;
+ -webkit-overflow-scrolling: touch;
+ outline: 0;
+}
+.modal.fade .modal-dialog {
+ -webkit-transition: -webkit-transform .3s ease-out;
+ -o-transition: -o-transform .3s ease-out;
+ transition: transform .3s ease-out;
+ -webkit-transform: translate(0, -25%);
+ -ms-transform: translate(0, -25%);
+ -o-transform: translate(0, -25%);
+ transform: translate(0, -25%);
+}
+.modal.in .modal-dialog {
+ -webkit-transform: translate(0, 0);
+ -ms-transform: translate(0, 0);
+ -o-transform: translate(0, 0);
+ transform: translate(0, 0);
+}
+.modal-open .modal {
+ overflow-x: hidden;
+ overflow-y: auto;
+}
+.modal-dialog {
+ position: relative;
+ width: auto;
+ margin: 10px;
+}
+.modal-content {
+ position: relative;
+ background-color: #fff;
+ -webkit-background-clip: padding-box;
+ background-clip: padding-box;
+ border: 1px solid #999;
+ border: 1px solid rgba(0, 0, 0, .2);
+ border-radius: 6px;
+ outline: 0;
+ -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
+ box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
+}
+.modal-backdrop {
+ position: fixed;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ z-index: 9997;
+ background-color: #000;
+}
+.modal-backdrop.fade {
+ filter: alpha(opacity=0);
+ opacity: 0;
+}
+.modal-backdrop.in {
+ filter: alpha(opacity=50);
+ opacity: .5;
+}
+.modal-header {
+ min-height: 16.42857143px;
+ padding: 15px;
+ border-bottom: 1px solid #e5e5e5;
+}
+.modal-header .close {
+ margin-top: -2px;
+}
+.modal-title {
+ margin: 0;
+ line-height: 1.42857143;
+}
+.modal-body {
+ position: relative;
+ padding: 15px;
+}
+.modal-footer {
+ padding: 15px;
+ text-align: right;
+ border-top: 1px solid #e5e5e5;
+}
+.modal-footer .btn + .btn {
+ margin-bottom: 0;
+ margin-left: 5px;
+}
+.modal-footer .btn-group .btn + .btn {
+ margin-left: -1px;
+}
+.modal-footer .btn-block + .btn-block {
+ margin-left: 0;
+}
+.modal-scrollbar-measure {
+ position: absolute;
+ top: -9999px;
+ width: 50px;
+ height: 50px;
+ overflow: scroll;
+}
+@media (min-width: 768px) {
+ .modal-dialog {
+ width: 600px;
+ margin: 30px auto;
+ }
+ .modal-content {
+ -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
+ box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
+ }
+ .modal-sm {
+ width: 300px;
+ }
+}
+@media (min-width: 992px) {
+ .modal-lg {
+ width: 1100px;
+/* width: 900px; */
+ }
+}
+.btn {
+ display: inline-block;
+ padding: 6px 12px;
+ margin-bottom: 0;
+ font-size: 14px;
+ font-weight: normal;
+ line-height: 1.42857143;
+ text-align: center;
+ white-space: nowrap;
+ vertical-align: middle;
+ -ms-touch-action: manipulation;
+ touch-action: manipulation;
+ cursor: pointer;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ background-image: none;
+ border: 1px solid transparent;
+ border-radius: 4px;
+}
+.btn:focus,
+.btn:active:focus,
+.btn.active:focus,
+.btn.focus,
+.btn:active.focus,
+.btn.active.focus {
+ outline: thin dotted;
+ outline: 5px auto -webkit-focus-ring-color;
+ outline-offset: -2px;
+}
+.btn:hover,
+.btn:focus,
+.btn.focus {
+ color: #333;
+ text-decoration: none;
+}
+.btn:active,
+.btn.active {
+ background-image: none;
+ outline: 0;
+ -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
+ box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
+}
+.btn.disabled,
+.btn[disabled],
+fieldset[disabled] .btn {
+ cursor: not-allowed;
+ filter: alpha(opacity=65);
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ opacity: .65;
+}
+a.btn.disabled,
+fieldset[disabled] a.btn {
+ pointer-events: none;
+}
+.btn-default {
+ color: #333;
+ background-color: #fff;
+ border-color: #ccc;
+}
+.btn-default:focus,
+.btn-default.focus {
+ color: #333;
+ background-color: #e6e6e6;
+ border-color: #8c8c8c;
+}
+.btn-default:hover {
+ color: #333;
+ background-color: #e6e6e6;
+ border-color: #adadad;
+}
+.btn-default:active,
+.btn-default.active,
+.open > .dropdown-toggle.btn-default {
+ color: #333;
+ background-color: #e6e6e6;
+ border-color: #adadad;
+}
+.btn-default:active:hover,
+.btn-default.active:hover,
+.open > .dropdown-toggle.btn-default:hover,
+.btn-default:active:focus,
+.btn-default.active:focus,
+.open > .dropdown-toggle.btn-default:focus,
+.btn-default:active.focus,
+.btn-default.active.focus,
+.open > .dropdown-toggle.btn-default.focus {
+ color: #333;
+ background-color: #d4d4d4;
+ border-color: #8c8c8c;
+}
+.btn-default:active,
+.btn-default.active,
+.open > .dropdown-toggle.btn-default {
+ background-image: none;
+}
+.btn-default.disabled,
+.btn-default[disabled],
+fieldset[disabled] .btn-default,
+.btn-default.disabled:hover,
+.btn-default[disabled]:hover,
+fieldset[disabled] .btn-default:hover,
+.btn-default.disabled:focus,
+.btn-default[disabled]:focus,
+fieldset[disabled] .btn-default:focus,
+.btn-default.disabled.focus,
+.btn-default[disabled].focus,
+fieldset[disabled] .btn-default.focus,
+.btn-default.disabled:active,
+.btn-default[disabled]:active,
+fieldset[disabled] .btn-default:active,
+.btn-default.disabled.active,
+.btn-default[disabled].active,
+fieldset[disabled] .btn-default.active {
+ background-color: #fff;
+ border-color: #ccc;
+}
+.btn-default .badge {
+ color: #fff;
+ background-color: #333;
+}
+.btn-primary {
+ color: #fff;
+ background-color: #337ab7;
+ border-color: #2e6da4;
+}
+.btn-primary:focus,
+.btn-primary.focus {
+ color: #fff;
+ background-color: #286090;
+ border-color: #122b40;
+}
+.btn-primary:hover {
+ color: #fff;
+ background-color: #286090;
+ border-color: #204d74;
+}
+.btn-primary:active,
+.btn-primary.active,
+.open > .dropdown-toggle.btn-primary {
+ color: #fff;
+ background-color: #286090;
+ border-color: #204d74;
+}
+.btn-primary:active:hover,
+.btn-primary.active:hover,
+.open > .dropdown-toggle.btn-primary:hover,
+.btn-primary:active:focus,
+.btn-primary.active:focus,
+.open > .dropdown-toggle.btn-primary:focus,
+.btn-primary:active.focus,
+.btn-primary.active.focus,
+.open > .dropdown-toggle.btn-primary.focus {
+ color: #fff;
+ background-color: #204d74;
+ border-color: #122b40;
+}
+.btn-primary:active,
+.btn-primary.active,
+.open > .dropdown-toggle.btn-primary {
+ background-image: none;
+}
+.btn-primary.disabled,
+.btn-primary[disabled],
+fieldset[disabled] .btn-primary,
+.btn-primary.disabled:hover,
+.btn-primary[disabled]:hover,
+fieldset[disabled] .btn-primary:hover,
+.btn-primary.disabled:focus,
+.btn-primary[disabled]:focus,
+fieldset[disabled] .btn-primary:focus,
+.btn-primary.disabled.focus,
+.btn-primary[disabled].focus,
+fieldset[disabled] .btn-primary.focus,
+.btn-primary.disabled:active,
+.btn-primary[disabled]:active,
+fieldset[disabled] .btn-primary:active,
+.btn-primary.disabled.active,
+.btn-primary[disabled].active,
+fieldset[disabled] .btn-primary.active {
+ background-color: #337ab7;
+ border-color: #2e6da4;
+}
+.btn-primary .badge {
+ color: #337ab7;
+ background-color: #fff;
+}
+.btn-success {
+ color: #fff;
+ background-color: #5cb85c;
+ border-color: #4cae4c;
+}
+.btn-success:focus,
+.btn-success.focus {
+ color: #fff;
+ background-color: #449d44;
+ border-color: #255625;
+}
+.btn-success:hover {
+ color: #fff;
+ background-color: #449d44;
+ border-color: #398439;
+}
+.btn-success:active,
+.btn-success.active,
+.open > .dropdown-toggle.btn-success {
+ color: #fff;
+ background-color: #449d44;
+ border-color: #398439;
+}
+.btn-success:active:hover,
+.btn-success.active:hover,
+.open > .dropdown-toggle.btn-success:hover,
+.btn-success:active:focus,
+.btn-success.active:focus,
+.open > .dropdown-toggle.btn-success:focus,
+.btn-success:active.focus,
+.btn-success.active.focus,
+.open > .dropdown-toggle.btn-success.focus {
+ color: #fff;
+ background-color: #398439;
+ border-color: #255625;
+}
+.btn-success:active,
+.btn-success.active,
+.open > .dropdown-toggle.btn-success {
+ background-image: none;
+}
+.btn-success.disabled,
+.btn-success[disabled],
+fieldset[disabled] .btn-success,
+.btn-success.disabled:hover,
+.btn-success[disabled]:hover,
+fieldset[disabled] .btn-success:hover,
+.btn-success.disabled:focus,
+.btn-success[disabled]:focus,
+fieldset[disabled] .btn-success:focus,
+.btn-success.disabled.focus,
+.btn-success[disabled].focus,
+fieldset[disabled] .btn-success.focus,
+.btn-success.disabled:active,
+.btn-success[disabled]:active,
+fieldset[disabled] .btn-success:active,
+.btn-success.disabled.active,
+.btn-success[disabled].active,
+fieldset[disabled] .btn-success.active {
+ background-color: #5cb85c;
+ border-color: #4cae4c;
+}
+.btn-success .badge {
+ color: #5cb85c;
+ background-color: #fff;
+}
+.btn-info {
+ color: #fff;
+ background-color: #5bc0de;
+ border-color: #46b8da;
+}
+.btn-info:focus,
+.btn-info.focus {
+ color: #fff;
+ background-color: #31b0d5;
+ border-color: #1b6d85;
+}
+.btn-info:hover {
+ color: #fff;
+ background-color: #31b0d5;
+ border-color: #269abc;
+}
+.btn-info:active,
+.btn-info.active,
+.open > .dropdown-toggle.btn-info {
+ color: #fff;
+ background-color: #31b0d5;
+ border-color: #269abc;
+}
+.btn-info:active:hover,
+.btn-info.active:hover,
+.open > .dropdown-toggle.btn-info:hover,
+.btn-info:active:focus,
+.btn-info.active:focus,
+.open > .dropdown-toggle.btn-info:focus,
+.btn-info:active.focus,
+.btn-info.active.focus,
+.open > .dropdown-toggle.btn-info.focus {
+ color: #fff;
+ background-color: #269abc;
+ border-color: #1b6d85;
+}
+.btn-info:active,
+.btn-info.active,
+.open > .dropdown-toggle.btn-info {
+ background-image: none;
+}
+.btn-info.disabled,
+.btn-info[disabled],
+fieldset[disabled] .btn-info,
+.btn-info.disabled:hover,
+.btn-info[disabled]:hover,
+fieldset[disabled] .btn-info:hover,
+.btn-info.disabled:focus,
+.btn-info[disabled]:focus,
+fieldset[disabled] .btn-info:focus,
+.btn-info.disabled.focus,
+.btn-info[disabled].focus,
+fieldset[disabled] .btn-info.focus,
+.btn-info.disabled:active,
+.btn-info[disabled]:active,
+fieldset[disabled] .btn-info:active,
+.btn-info.disabled.active,
+.btn-info[disabled].active,
+fieldset[disabled] .btn-info.active {
+ background-color: #5bc0de;
+ border-color: #46b8da;
+}
+.btn-info .badge {
+ color: #5bc0de;
+ background-color: #fff;
+}
+.btn-warning {
+ color: #fff;
+ background-color: #f0ad4e;
+ border-color: #eea236;
+}
+.btn-warning:focus,
+.btn-warning.focus {
+ color: #fff;
+ background-color: #ec971f;
+ border-color: #985f0d;
+}
+.btn-warning:hover {
+ color: #fff;
+ background-color: #ec971f;
+ border-color: #d58512;
+}
+.btn-warning:active,
+.btn-warning.active,
+.open > .dropdown-toggle.btn-warning {
+ color: #fff;
+ background-color: #ec971f;
+ border-color: #d58512;
+}
+.btn-warning:active:hover,
+.btn-warning.active:hover,
+.open > .dropdown-toggle.btn-warning:hover,
+.btn-warning:active:focus,
+.btn-warning.active:focus,
+.open > .dropdown-toggle.btn-warning:focus,
+.btn-warning:active.focus,
+.btn-warning.active.focus,
+.open > .dropdown-toggle.btn-warning.focus {
+ color: #fff;
+ background-color: #d58512;
+ border-color: #985f0d;
+}
+.btn-warning:active,
+.btn-warning.active,
+.open > .dropdown-toggle.btn-warning {
+ background-image: none;
+}
+.btn-warning.disabled,
+.btn-warning[disabled],
+fieldset[disabled] .btn-warning,
+.btn-warning.disabled:hover,
+.btn-warning[disabled]:hover,
+fieldset[disabled] .btn-warning:hover,
+.btn-warning.disabled:focus,
+.btn-warning[disabled]:focus,
+fieldset[disabled] .btn-warning:focus,
+.btn-warning.disabled.focus,
+.btn-warning[disabled].focus,
+fieldset[disabled] .btn-warning.focus,
+.btn-warning.disabled:active,
+.btn-warning[disabled]:active,
+fieldset[disabled] .btn-warning:active,
+.btn-warning.disabled.active,
+.btn-warning[disabled].active,
+fieldset[disabled] .btn-warning.active {
+ background-color: #f0ad4e;
+ border-color: #eea236;
+}
+.btn-warning .badge {
+ color: #f0ad4e;
+ background-color: #fff;
+}
+.btn-danger {
+ color: #fff;
+ background-color: #d9534f;
+ border-color: #d43f3a;
+}
+.btn-danger:focus,
+.btn-danger.focus {
+ color: #fff;
+ background-color: #c9302c;
+ border-color: #761c19;
+}
+.btn-danger:hover {
+ color: #fff;
+ background-color: #c9302c;
+ border-color: #ac2925;
+}
+.btn-danger:active,
+.btn-danger.active,
+.open > .dropdown-toggle.btn-danger {
+ color: #fff;
+ background-color: #c9302c;
+ border-color: #ac2925;
+}
+.btn-danger:active:hover,
+.btn-danger.active:hover,
+.open > .dropdown-toggle.btn-danger:hover,
+.btn-danger:active:focus,
+.btn-danger.active:focus,
+.open > .dropdown-toggle.btn-danger:focus,
+.btn-danger:active.focus,
+.btn-danger.active.focus,
+.open > .dropdown-toggle.btn-danger.focus {
+ color: #fff;
+ background-color: #ac2925;
+ border-color: #761c19;
+}
+.btn-danger:active,
+.btn-danger.active,
+.open > .dropdown-toggle.btn-danger {
+ background-image: none;
+}
+.btn-danger.disabled,
+.btn-danger[disabled],
+fieldset[disabled] .btn-danger,
+.btn-danger.disabled:hover,
+.btn-danger[disabled]:hover,
+fieldset[disabled] .btn-danger:hover,
+.btn-danger.disabled:focus,
+.btn-danger[disabled]:focus,
+fieldset[disabled] .btn-danger:focus,
+.btn-danger.disabled.focus,
+.btn-danger[disabled].focus,
+fieldset[disabled] .btn-danger.focus,
+.btn-danger.disabled:active,
+.btn-danger[disabled]:active,
+fieldset[disabled] .btn-danger:active,
+.btn-danger.disabled.active,
+.btn-danger[disabled].active,
+fieldset[disabled] .btn-danger.active {
+ background-color: #d9534f;
+ border-color: #d43f3a;
+}
+.btn-danger .badge {
+ color: #d9534f;
+ background-color: #fff;
+}
+.btn-link {
+ font-weight: normal;
+ color: #337ab7;
+ border-radius: 0;
+}
+.btn-link,
+.btn-link:active,
+.btn-link.active,
+.btn-link[disabled],
+fieldset[disabled] .btn-link {
+ background-color: transparent;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+}
+.btn-link,
+.btn-link:hover,
+.btn-link:focus,
+.btn-link:active {
+ border-color: transparent;
+}
+.btn-link:hover,
+.btn-link:focus {
+ color: #23527c;
+ text-decoration: underline;
+ background-color: transparent;
+}
+.btn-link[disabled]:hover,
+fieldset[disabled] .btn-link:hover,
+.btn-link[disabled]:focus,
+fieldset[disabled] .btn-link:focus {
+ color: #777;
+ text-decoration: none;
+}
+.btn-lg,
+.btn-group-lg > .btn {
+ padding: 10px 16px;
+ font-size: 18px;
+ line-height: 1.3333333;
+ border-radius: 6px;
+}
+.btn-sm,
+.btn-group-sm > .btn {
+ padding: 5px 10px;
+ font-size: 12px;
+ line-height: 1.5;
+ border-radius: 3px;
+}
+.btn-xs,
+.btn-group-xs > .btn {
+ padding: 1px 5px;
+ font-size: 12px;
+ line-height: 1.5;
+ border-radius: 3px;
+}
+.btn-block {
+ display: block;
+ width: 100%;
+}
+.btn-block + .btn-block {
+ margin-top: 5px;
+}
+input[type="submit"].btn-block,
+input[type="reset"].btn-block,
+input[type="button"].btn-block {
+ width: 100%;
+}
+.close {
+ float: right;
+ font-size: 21px;
+ font-weight: bold;
+ line-height: 1;
+ color: #000;
+ text-shadow: 0 1px 0 #fff;
+ filter: alpha(opacity=20);
+ opacity: .2;
+}
+.close:hover,
+.close:focus {
+ color: #000;
+ text-decoration: none;
+ cursor: pointer;
+ filter: alpha(opacity=50);
+ opacity: .5;
+}
+button.close {
+ -webkit-appearance: none;
+ padding: 0;
+ cursor: pointer;
+ background: transparent;
+ border: 0;
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/css/nv.d3.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/css/nv.d3.css
new file mode 100644
index 00000000..28ccd053
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/css/nv.d3.css
@@ -0,0 +1,656 @@
+
+/********************
+ * HTML CSS
+ */
+
+
+.chartWrap {
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+}
+
+
+/********************
+ * TOOLTIP CSS
+ */
+
+.nvtooltip {
+ position: absolute;
+ background-color: rgba(255,255,255,1);
+ padding: 10px;
+ border: 1px solid #ddd;
+ z-index: 10000;
+
+ font-family: Arial;
+ font-size: 13px;
+
+ transition: opacity 500ms linear;
+ -moz-transition: opacity 500ms linear;
+ -webkit-transition: opacity 500ms linear;
+
+ transition-delay: 500ms;
+ -moz-transition-delay: 500ms;
+ -webkit-transition-delay: 500ms;
+
+ -moz-box-shadow: 4px 4px 8px rgba(0,0,0,.5);
+ -webkit-box-shadow: 4px 4px 8px rgba(0,0,0,.5);
+ box-shadow: 4px 4px 8px rgba(0,0,0,.5);
+
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+
+ pointer-events: none;
+
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+.nvtooltip h3 {
+ margin: 0;
+ padding: 0;
+ text-align: center;
+}
+
+.nvtooltip p {
+ margin: 0;
+ padding: 0;
+ text-align: center;
+}
+
+.nvtooltip span {
+ display: inline-block;
+ margin: 2px 0;
+}
+
+.nvtooltip-pending-removal {
+ position: absolute;
+ pointer-events: none;
+}
+
+
+/********************
+ * SVG CSS
+ */
+
+
+svg {
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ /* Trying to get SVG to act like a greedy block in all browsers */
+ display: block;
+ width:100%;
+ height:100%;
+}
+
+
+svg text {
+ font: normal 12px Arial;
+}
+
+svg .title {
+ font: bold 14px Arial;
+}
+
+.nvd3 .nv-background {
+ fill: white;
+ fill-opacity: 0;
+ /*
+ pointer-events: none;
+ */
+}
+
+.nvd3.nv-noData {
+ font-size: 18px;
+ font-weight: bolf;
+}
+
+
+/**********
+* Brush
+*/
+
+.nv-brush .extent {
+ fill-opacity: .125;
+ shape-rendering: crispEdges;
+}
+
+
+
+/**********
+* Legend
+*/
+
+.nvd3 .nv-legend .nv-series {
+ cursor: pointer;
+}
+
+.nvd3 .nv-legend .disabled circle {
+ fill-opacity: 0;
+}
+
+
+
+/**********
+* Axes
+*/
+
+.nvd3 .nv-axis path {
+ fill: none;
+ stroke: #000;
+ stroke-opacity: .75;
+ shape-rendering: crispEdges;
+}
+
+.nvd3 .nv-axis path.domain {
+ stroke-opacity: .75;
+}
+
+.nvd3 .nv-axis.nv-x path.domain {
+ stroke-opacity: 0;
+}
+
+.nvd3 .nv-axis line {
+ fill: none;
+ stroke: #000;
+ stroke-opacity: .25;
+ shape-rendering: crispEdges;
+}
+
+.nvd3 .nv-axis line.zero {
+ stroke-opacity: .75;
+}
+
+.nvd3 .nv-axis .nv-axisMaxMin text {
+ font-weight: bold;
+}
+
+.nvd3 .x .nv-axis .nv-axisMaxMin text,
+.nvd3 .x2 .nv-axis .nv-axisMaxMin text,
+.nvd3 .x3 .nv-axis .nv-axisMaxMin text {
+ text-anchor: middle
+}
+
+
+
+/**********
+* Brush
+*/
+
+.nv-brush .resize path {
+ fill: #eee;
+ stroke: #666;
+}
+
+
+
+/**********
+* Bars
+*/
+
+.nvd3 .nv-bars .negative rect {
+ zfill: brown;
+}
+
+.nvd3 .nv-bars rect {
+ zfill: steelblue;
+ fill-opacity: .75;
+
+ transition: fill-opacity 250ms linear;
+ -moz-transition: fill-opacity 250ms linear;
+ -webkit-transition: fill-opacity 250ms linear;
+}
+
+.nvd3 .nv-bars rect:hover {
+ fill-opacity: 1;
+}
+
+.nvd3 .nv-bars .hover rect {
+ fill: lightblue;
+}
+
+.nvd3 .nv-bars text {
+ fill: rgba(0,0,0,0);
+}
+
+.nvd3 .nv-bars .hover text {
+ fill: rgba(0,0,0,1);
+}
+
+
+/**********
+* Bars
+*/
+
+.nvd3 .nv-multibar .nv-groups rect,
+.nvd3 .nv-multibarHorizontal .nv-groups rect,
+.nvd3 .nv-discretebar .nv-groups rect {
+ stroke-opacity: 0;
+
+ transition: fill-opacity 250ms linear;
+ -moz-transition: fill-opacity 250ms linear;
+ -webkit-transition: fill-opacity 250ms linear;
+}
+
+.nvd3 .nv-multibar .nv-groups rect:hover,
+.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,
+.nvd3 .nv-discretebar .nv-groups rect:hover {
+ fill-opacity: 1;
+}
+
+.nvd3 .nv-discretebar .nv-groups text,
+.nvd3 .nv-multibarHorizontal .nv-groups text {
+ font-weight: bold;
+ fill: rgba(0,0,0,1);
+ stroke: rgba(0,0,0,0);
+}
+
+/***********
+* Pie Chart
+*/
+
+.nvd3.nv-pie path {
+ stroke-opacity: 0;
+
+ transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
+ -moz-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
+ -webkit-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
+
+}
+
+.nvd3.nv-pie .nv-slice text {
+ stroke: #000;
+ stroke-width: 0;
+}
+
+.nvd3.nv-pie path {
+ stroke: #fff;
+ stroke-width: 1px;
+ stroke-opacity: 1;
+}
+
+.nvd3.nv-pie .hover path {
+ fill-opacity: .7;
+/*
+ stroke-width: 6px;
+ stroke-opacity: 1;
+*/
+}
+
+.nvd3.nv-pie .nv-label rect {
+ fill-opacity: 0;
+ stroke-opacity: 0;
+}
+
+/**********
+* Lines
+*/
+
+.nvd3 .nv-groups path.nv-line {
+ fill: none;
+ stroke-width: 2.5px;
+ /*
+ stroke-linecap: round;
+ shape-rendering: geometricPrecision;
+
+ transition: stroke-width 250ms linear;
+ -moz-transition: stroke-width 250ms linear;
+ -webkit-transition: stroke-width 250ms linear;
+
+ transition-delay: 250ms
+ -moz-transition-delay: 250ms;
+ -webkit-transition-delay: 250ms;
+ */
+}
+
+.nvd3 .nv-groups path.nv-area {
+ stroke: none;
+ /*
+ stroke-linecap: round;
+ shape-rendering: geometricPrecision;
+
+ stroke-width: 2.5px;
+ transition: stroke-width 250ms linear;
+ -moz-transition: stroke-width 250ms linear;
+ -webkit-transition: stroke-width 250ms linear;
+
+ transition-delay: 250ms
+ -moz-transition-delay: 250ms;
+ -webkit-transition-delay: 250ms;
+ */
+}
+
+.nvd3 .nv-line.hover path {
+ stroke-width: 6px;
+}
+
+/*
+.nvd3.scatter .groups .point {
+ fill-opacity: 0.1;
+ stroke-opacity: 0.1;
+}
+ */
+
+.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point {
+ fill-opacity: 0;
+ stroke-opacity: 0;
+}
+
+.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point {
+ fill-opacity: .5 !important;
+ stroke-opacity: .5 !important;
+}
+
+
+.nvd3 .nv-groups .nv-point {
+ transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
+ -moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
+ -webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
+}
+
+.nvd3.nv-scatter .nv-groups .nv-point.hover,
+.nvd3 .nv-groups .nv-point.hover {
+ stroke-width: 20px;
+ fill-opacity: .5 !important;
+ stroke-opacity: .5 !important;
+}
+
+
+.nvd3 .nv-point-paths path {
+ stroke: #aaa;
+ stroke-opacity: 0;
+ fill: #eee;
+ fill-opacity: 0;
+}
+
+
+
+.nvd3 .nv-indexLine {
+ cursor: ew-resize;
+}
+
+
+/**********
+* Distribution
+*/
+
+.nvd3 .nv-distribution {
+ pointer-events: none;
+}
+
+
+
+/**********
+* Scatter
+*/
+
+/* **Attempting to remove this for useVoronoi(false), need to see if it's required anywhere
+.nvd3 .nv-groups .nv-point {
+ pointer-events: none;
+}
+*/
+
+.nvd3 .nv-groups .nv-point.hover {
+ stroke-width: 20px;
+ stroke-opacity: .5;
+}
+
+.nvd3 .nv-scatter .nv-point.hover {
+ fill-opacity: 1;
+}
+
+/*
+.nv-group.hover .nv-point {
+ fill-opacity: 1;
+}
+*/
+
+
+/**********
+* Stacked Area
+*/
+
+.nvd3.nv-stackedarea path.nv-area {
+ fill-opacity: .7;
+ /*
+ stroke-opacity: .65;
+ fill-opacity: 1;
+ */
+ stroke-opacity: 0;
+
+ transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
+ -moz-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
+ -webkit-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
+
+ /*
+ transition-delay: 500ms;
+ -moz-transition-delay: 500ms;
+ -webkit-transition-delay: 500ms;
+ */
+
+}
+
+.nvd3.nv-stackedarea path.nv-area.hover {
+ fill-opacity: .9;
+ /*
+ stroke-opacity: .85;
+ */
+}
+/*
+.d3stackedarea .groups path {
+ stroke-opacity: 0;
+}
+ */
+
+
+
+.nvd3.nv-stackedarea .nv-groups .nv-point {
+ stroke-opacity: 0;
+ fill-opacity: 0;
+}
+
+.nvd3.nv-stackedarea .nv-groups .nv-point.hover {
+ stroke-width: 20px;
+ stroke-opacity: .75;
+ fill-opacity: 1;
+}
+
+
+
+/**********
+* Line Plus Bar
+*/
+
+.nvd3.nv-linePlusBar .nv-bar rect {
+ fill-opacity: .75;
+}
+
+.nvd3.nv-linePlusBar .nv-bar rect:hover {
+ fill-opacity: 1;
+}
+
+
+/**********
+* Bullet
+*/
+
+.nvd3.nv-bullet { font: 10px sans-serif; }
+.nvd3.nv-bullet .nv-measure { fill-opacity: .8; }
+.nvd3.nv-bullet .nv-measure:hover { fill-opacity: 1; }
+.nvd3.nv-bullet .nv-marker { stroke: #000; stroke-width: 2px; }
+.nvd3.nv-bullet .nv-markerTriangle { stroke: #000; fill: #fff; stroke-width: 1.5px; }
+.nvd3.nv-bullet .nv-tick line { stroke: #666; stroke-width: .5px; }
+.nvd3.nv-bullet .nv-range.nv-s0 { fill: #eee; }
+.nvd3.nv-bullet .nv-range.nv-s1 { fill: #ddd; }
+.nvd3.nv-bullet .nv-range.nv-s2 { fill: #ccc; }
+.nvd3.nv-bullet .nv-title { font-size: 14px; font-weight: bold; }
+.nvd3.nv-bullet .nv-subtitle { fill: #999; }
+
+
+.nvd3.nv-bullet .nv-range {
+ fill: #999;
+ fill-opacity: .4;
+}
+.nvd3.nv-bullet .nv-range:hover {
+ fill-opacity: .7;
+}
+
+
+
+/**********
+* Sparkline
+*/
+
+.nvd3.nv-sparkline path {
+ fill: none;
+}
+
+.nvd3.nv-sparklineplus g.nv-hoverValue {
+ pointer-events: none;
+}
+
+.nvd3.nv-sparklineplus .nv-hoverValue line {
+ stroke: #333;
+ stroke-width: 1.5px;
+ }
+
+.nvd3.nv-sparklineplus,
+.nvd3.nv-sparklineplus g {
+ pointer-events: all;
+}
+
+.nvd3 .nv-hoverArea {
+ fill-opacity: 0;
+ stroke-opacity: 0;
+}
+
+.nvd3.nv-sparklineplus .nv-xValue,
+.nvd3.nv-sparklineplus .nv-yValue {
+ /*
+ stroke: #666;
+ */
+ stroke-width: 0;
+ font-size: .9em;
+ font-weight: normal;
+}
+
+.nvd3.nv-sparklineplus .nv-yValue {
+ stroke: #f66;
+}
+
+.nvd3.nv-sparklineplus .nv-maxValue {
+ stroke: #2ca02c;
+ fill: #2ca02c;
+}
+
+.nvd3.nv-sparklineplus .nv-minValue {
+ stroke: #d62728;
+ fill: #d62728;
+}
+
+.nvd3.nv-sparklineplus .nv-currentValue {
+ /*
+ stroke: #444;
+ fill: #000;
+ */
+ font-weight: bold;
+ font-size: 1.1em;
+}
+
+/**********
+* historical stock
+*/
+
+.nvd3.nv-ohlcBar .nv-ticks .nv-tick {
+ stroke-width: 2px;
+}
+
+.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover {
+ stroke-width: 4px;
+}
+
+.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive {
+ stroke: #2ca02c;
+}
+
+.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative {
+ stroke: #d62728;
+}
+
+.nvd3.nv-historicalStockChart .nv-axis .nv-axislabel {
+ font-weight: bold;
+}
+
+.nvd3.nv-historicalStockChart .nv-dragTarget {
+ fill-opacity: 0;
+ stroke: none;
+ cursor: move;
+}
+
+.nvd3 .nv-brush .extent {
+ /*
+ cursor: ew-resize !important;
+ */
+ fill-opacity: 0 !important;
+}
+
+.nvd3 .nv-brushBackground rect {
+ stroke: #000;
+ stroke-width: .4;
+ fill: #fff;
+ fill-opacity: .7;
+}
+
+
+
+/**********
+* Indented Tree
+*/
+
+
+/**
+ * TODO: the following 3 selectors are based on classes used in the example. I should either make them standard and leave them here, or move to a CSS file not included in the library
+ */
+.nvd3.nv-indentedtree .name {
+ margin-left: 5px;
+}
+
+.nvd3.nv-indentedtree .clickable {
+ color: #08C;
+ cursor: pointer;
+}
+
+.nvd3.nv-indentedtree span.clickable:hover {
+ color: #005580;
+ text-decoration: underline;
+}
+
+
+.nvd3.nv-indentedtree .nv-childrenCount {
+ display: inline-block;
+ margin-left: 5px;
+}
+
+.nvd3.nv-indentedtree .nv-treeicon {
+ cursor: pointer;
+ /*
+ cursor: n-resize;
+ */
+}
+
+.nvd3.nv-indentedtree .nv-treeicon.nv-folded {
+ cursor: pointer;
+ /*
+ cursor: s-resize;
+ */
+}
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/cie.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/cie.js
new file mode 100644
index 00000000..45f01329
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/cie.js
@@ -0,0 +1,155 @@
+(function(d3) {
+ var cie = d3.cie = {};
+
+ cie.lab = function(l, a, b) {
+ return arguments.length === 1
+ ? (l instanceof Lab ? lab(l.l, l.a, l.b)
+ : (l instanceof Lch ? lch_lab(l.l, l.c, l.h)
+ : rgb_lab((l = d3.rgb(l)).r, l.g, l.b)))
+ : lab(+l, +a, +b);
+ };
+
+ cie.lch = function(l, c, h) {
+ return arguments.length === 1
+ ? (l instanceof Lch ? lch(l.l, l.c, l.h)
+ : (l instanceof Lab ? lab_lch(l.l, l.a, l.b)
+ : lab_lch((l = rgb_lab((l = d3.rgb(l)).r, l.g, l.b)).l, l.a, l.b)))
+ : lch(+l, +c, +h);
+ };
+
+ cie.interpolateLab = function(a, b) {
+ a = cie.lab(a);
+ b = cie.lab(b);
+ var al = a.l,
+ aa = a.a,
+ ab = a.b,
+ bl = b.l - al,
+ ba = b.a - aa,
+ bb = b.b - ab;
+ return function(t) {
+ return lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
+ };
+ };
+
+ cie.interpolateLch = function(a, b) {
+ a = cie.lch(a);
+ b = cie.lch(b);
+ var al = a.l,
+ ac = a.c,
+ ah = a.h,
+ bl = b.l - al,
+ bc = b.c - ac,
+ bh = b.h - ah;
+ if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; // shortest path
+ return function(t) {
+ return lch_lab(al + bl * t, ac + bc * t, ah + bh * t) + "";
+ };
+ };
+
+ function lab(l, a, b) {
+ return new Lab(l, a, b);
+ }
+
+ function Lab(l, a, b) {
+ this.l = l;
+ this.a = a;
+ this.b = b;
+ }
+
+ Lab.prototype.brighter = function(k) {
+ return lab(Math.min(100, this.l + K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+
+ Lab.prototype.darker = function(k) {
+ return lab(Math.max(0, this.l - K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+
+ Lab.prototype.rgb = function() {
+ return lab_rgb(this.l, this.a, this.b);
+ };
+
+ Lab.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+
+ function lch(l, c, h) {
+ return new Lch(l, c, h);
+ }
+
+ function Lch(l, c, h) {
+ this.l = l;
+ this.c = c;
+ this.h = h;
+ }
+
+ Lch.prototype.brighter = function(k) {
+ return lch(Math.min(100, this.l + K * (arguments.length ? k : 1)), this.c, this.h);
+ };
+
+ Lch.prototype.darker = function(k) {
+ return lch(Math.max(0, this.l - K * (arguments.length ? k : 1)), this.c, this.h);
+ };
+
+ Lch.prototype.rgb = function() {
+ return lch_lab(this.l, this.c, this.h).rgb();
+ };
+
+ Lch.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+
+ // Corresponds roughly to RGB brighter/darker
+ var K = 18;
+
+ // D65 standard referent
+ var X = 0.950470, Y = 1, Z = 1.088830;
+
+ function lab_rgb(l, a, b) {
+ var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
+ x = lab_xyz(x) * X;
+ y = lab_xyz(y) * Y;
+ z = lab_xyz(z) * Z;
+ return d3.rgb(
+ xyz_rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z),
+ xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
+ xyz_rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z)
+ );
+ }
+
+ function rgb_lab(r, g, b) {
+ r = rgb_xyz(r);
+ g = rgb_xyz(g);
+ b = rgb_xyz(b);
+ var x = xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / X),
+ y = xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / Y),
+ z = xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / Z);
+ return lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
+ }
+
+ function lab_lch(l, a, b) {
+ var c = Math.sqrt(a * a + b * b),
+ h = Math.atan2(b, a) / Math.PI * 180;
+ return lch(l, c, h);
+ }
+
+ function lch_lab(l, c, h) {
+ h = h * Math.PI / 180;
+ return lab(l, Math.cos(h) * c, Math.sin(h) * c);
+ }
+
+ function lab_xyz(x) {
+ return x > 0.206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
+ }
+
+ function xyz_lab(x) {
+ return x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
+ }
+
+ function xyz_rgb(r) {
+ return Math.round(255 * (r <= 0.00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055));
+ }
+
+ function rgb_xyz(r) {
+ return (r /= 255) <= 0.04045 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4);
+ }
+})(d3);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/colorbrewer.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/colorbrewer.js
new file mode 100644
index 00000000..2295527b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/colorbrewer.js
@@ -0,0 +1,302 @@
+// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).
+var colorbrewer = {YlGn: {
+3: ["#f7fcb9","#addd8e","#31a354"],
+4: ["#ffffcc","#c2e699","#78c679","#238443"],
+5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"],
+6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],
+7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
+8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
+9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]
+},YlGnBu: {
+3: ["#edf8b1","#7fcdbb","#2c7fb8"],
+4: ["#ffffcc","#a1dab4","#41b6c4","#225ea8"],
+5: ["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],
+6: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],
+7: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],
+8: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],
+9: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]
+},GnBu: {
+3: ["#e0f3db","#a8ddb5","#43a2ca"],
+4: ["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],
+5: ["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],
+6: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],
+7: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],
+8: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],
+9: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]
+},BuGn: {
+3: ["#e5f5f9","#99d8c9","#2ca25f"],
+4: ["#edf8fb","#b2e2e2","#66c2a4","#238b45"],
+5: ["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],
+6: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],
+7: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],
+8: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],
+9: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]
+},PuBuGn: {
+3: ["#ece2f0","#a6bddb","#1c9099"],
+4: ["#f6eff7","#bdc9e1","#67a9cf","#02818a"],
+5: ["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],
+6: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],
+7: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],
+8: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],
+9: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]
+},PuBu: {
+3: ["#ece7f2","#a6bddb","#2b8cbe"],
+4: ["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],
+5: ["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],
+6: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],
+7: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],
+8: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],
+9: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]
+},BuPu: {
+3: ["#e0ecf4","#9ebcda","#8856a7"],
+4: ["#edf8fb","#b3cde3","#8c96c6","#88419d"],
+5: ["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],
+6: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],
+7: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],
+8: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],
+9: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]
+},RdPu: {
+3: ["#fde0dd","#fa9fb5","#c51b8a"],
+4: ["#feebe2","#fbb4b9","#f768a1","#ae017e"],
+5: ["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],
+6: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],
+7: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],
+8: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],
+9: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]
+},PuRd: {
+3: ["#e7e1ef","#c994c7","#dd1c77"],
+4: ["#f1eef6","#d7b5d8","#df65b0","#ce1256"],
+5: ["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],
+6: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],
+7: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],
+8: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],
+9: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]
+},OrRd: {
+3: ["#fee8c8","#fdbb84","#e34a33"],
+4: ["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],
+5: ["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],
+6: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],
+7: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],
+8: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],
+9: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]
+},YlOrRd: {
+3: ["#ffeda0","#feb24c","#f03b20"],
+4: ["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],
+5: ["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],
+6: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],
+7: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],
+8: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],
+9: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]
+},YlOrBr: {
+3: ["#fff7bc","#fec44f","#d95f0e"],
+4: ["#ffffd4","#fed98e","#fe9929","#cc4c02"],
+5: ["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],
+6: ["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],
+7: ["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],
+8: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],
+9: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]
+},Purples: {
+3: ["#efedf5","#bcbddc","#756bb1"],
+4: ["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],
+5: ["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],
+6: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],
+7: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],
+8: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],
+9: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]
+},Blues: {
+3: ["#deebf7","#9ecae1","#3182bd"],
+4: ["#eff3ff","#bdd7e7","#6baed6","#2171b5"],
+5: ["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],
+6: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],
+7: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],
+8: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],
+9: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]
+},Greens: {
+3: ["#e5f5e0","#a1d99b","#31a354"],
+4: ["#edf8e9","#bae4b3","#74c476","#238b45"],
+5: ["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],
+6: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],
+7: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],
+8: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],
+9: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]
+},Oranges: {
+3: ["#fee6ce","#fdae6b","#e6550d"],
+4: ["#feedde","#fdbe85","#fd8d3c","#d94701"],
+5: ["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],
+6: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],
+7: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],
+8: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],
+9: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]
+},Reds: {
+3: ["#fee0d2","#fc9272","#de2d26"],
+4: ["#fee5d9","#fcae91","#fb6a4a","#cb181d"],
+5: ["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],
+6: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],
+7: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],
+8: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],
+9: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]
+},Greys: {
+3: ["#f0f0f0","#bdbdbd","#636363"],
+4: ["#f7f7f7","#cccccc","#969696","#525252"],
+5: ["#f7f7f7","#cccccc","#969696","#636363","#252525"],
+6: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],
+7: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],
+8: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],
+9: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]
+},PuOr: {
+3: ["#f1a340","#f7f7f7","#998ec3"],
+4: ["#e66101","#fdb863","#b2abd2","#5e3c99"],
+5: ["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],
+6: ["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],
+7: ["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],
+8: ["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],
+9: ["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],
+10: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],
+11: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]
+},BrBG: {
+3: ["#d8b365","#f5f5f5","#5ab4ac"],
+4: ["#a6611a","#dfc27d","#80cdc1","#018571"],
+5: ["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],
+6: ["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],
+7: ["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],
+8: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],
+9: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],
+10: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],
+11: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]
+},PRGn: {
+3: ["#af8dc3","#f7f7f7","#7fbf7b"],
+4: ["#7b3294","#c2a5cf","#a6dba0","#008837"],
+5: ["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],
+6: ["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],
+7: ["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],
+8: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],
+9: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],
+10: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],
+11: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]
+},PiYG: {
+3: ["#e9a3c9","#f7f7f7","#a1d76a"],
+4: ["#d01c8b","#f1b6da","#b8e186","#4dac26"],
+5: ["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],
+6: ["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],
+7: ["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],
+8: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],
+9: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],
+10: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],
+11: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]
+},RdBu: {
+3: ["#ef8a62","#f7f7f7","#67a9cf"],
+4: ["#ca0020","#f4a582","#92c5de","#0571b0"],
+5: ["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],
+6: ["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],
+7: ["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],
+8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],
+9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],
+10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],
+11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]
+},RdGy: {
+3: ["#ef8a62","#ffffff","#999999"],
+4: ["#ca0020","#f4a582","#bababa","#404040"],
+5: ["#ca0020","#f4a582","#ffffff","#bababa","#404040"],
+6: ["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],
+7: ["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],
+8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],
+9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],
+10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],
+11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]
+},RdYlBu: {
+3: ["#fc8d59","#ffffbf","#91bfdb"],
+4: ["#d7191c","#fdae61","#abd9e9","#2c7bb6"],
+5: ["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],
+6: ["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],
+7: ["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],
+8: ["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],
+9: ["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],
+10: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],
+11: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]
+},Spectral: {
+3: ["#fc8d59","#ffffbf","#99d594"],
+4: ["#d7191c","#fdae61","#abdda4","#2b83ba"],
+5: ["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],
+6: ["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],
+7: ["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],
+8: ["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],
+9: ["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],
+10: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],
+11: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]
+},RdYlGn: {
+3: ["#fc8d59","#ffffbf","#91cf60"],
+4: ["#d7191c","#fdae61","#a6d96a","#1a9641"],
+5: ["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],
+6: ["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],
+7: ["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],
+8: ["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],
+9: ["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],
+10: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],
+11: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]
+},Accent: {
+3: ["#7fc97f","#beaed4","#fdc086"],
+4: ["#7fc97f","#beaed4","#fdc086","#ffff99"],
+5: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],
+6: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],
+7: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],
+8: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]
+},Dark2: {
+3: ["#1b9e77","#d95f02","#7570b3"],
+4: ["#1b9e77","#d95f02","#7570b3","#e7298a"],
+5: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],
+6: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],
+7: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],
+8: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]
+},Paired: {
+3: ["#a6cee3","#1f78b4","#b2df8a"],
+4: ["#a6cee3","#1f78b4","#b2df8a","#33a02c"],
+5: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],
+6: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],
+7: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],
+8: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],
+9: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],
+10: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],
+11: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],
+12: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]
+},Pastel1: {
+3: ["#fbb4ae","#b3cde3","#ccebc5"],
+4: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],
+5: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],
+6: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],
+7: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],
+8: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],
+9: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]
+},Pastel2: {
+3: ["#b3e2cd","#fdcdac","#cbd5e8"],
+4: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],
+5: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],
+6: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],
+7: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],
+8: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]
+},Set1: {
+3: ["#e41a1c","#377eb8","#4daf4a"],
+4: ["#e41a1c","#377eb8","#4daf4a","#984ea3"],
+5: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],
+6: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],
+7: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],
+8: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],
+9: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]
+},Set2: {
+3: ["#66c2a5","#fc8d62","#8da0cb"],
+4: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],
+5: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],
+6: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],
+7: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],
+8: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"]
+},Set3: {
+3: ["#8dd3c7","#ffffb3","#bebada"],
+4: ["#8dd3c7","#ffffb3","#bebada","#fb8072"],
+5: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],
+6: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],
+7: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],
+8: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],
+9: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],
+10: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],
+11: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],
+12: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]
+}};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/core.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/core.js
new file mode 100644
index 00000000..912de8d8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/core.js
@@ -0,0 +1,122 @@
+
+var nv = window.nv || {};
+
+
+nv.version = '1.1.13b';
+nv.dev = true //set false when in production
+
+window.nv = nv;
+
+nv.tooltip = {}; // For the tooltip system
+nv.utils = nv.utils || {}; // Utility subsystem
+nv.models = {}; //stores all the possible models/components
+nv.charts = {}; //stores all the ready to use charts
+nv.graphs = []; //stores all the graphs currently on the page
+nv.logs = {}; //stores some statistics and potential error messages
+
+nv.dispatch = d3.dispatch('render_start', 'render_end');
+
+// *************************************************************************
+// Development render timers - disabled if dev = false
+
+if (nv.dev) {
+ nv.dispatch.on('render_start', function(e) {
+ nv.logs.startTime = +new Date();
+ });
+
+ nv.dispatch.on('render_end', function(e) {
+ nv.logs.endTime = +new Date();
+ nv.logs.totalTime = nv.logs.endTime - nv.logs.startTime;
+ nv.log('total', nv.logs.totalTime); // used for development, to keep track of graph generation times
+ });
+}
+
+// ********************************************
+// Public Core NV functions
+
+// Logs all arguments, and returns the last so you can test things in place
+// Note: in IE8 console.log is an object not a function, and if modernizr is used
+// then calling Function.prototype.bind with with anything other than a function
+// causes a TypeError to be thrown.
+nv.log = function() {
+ if (nv.dev && console.log && console.log.apply)
+ console.log.apply(console, arguments)
+ else if (nv.dev && typeof console.log == "function" && Function.prototype.bind) {
+ var log = Function.prototype.bind.call(console.log, console);
+ log.apply(console, arguments);
+ }
+ return arguments[arguments.length - 1];
+};
+
+
+nv.render = function render(step) {
+ step = step || 1; // number of graphs to generate in each timeout loop
+
+ nv.render.active = true;
+ nv.dispatch.render_start();
+
+ setTimeout(function() {
+ var chart, graph;
+
+ for (var i = 0; i < step && (graph = nv.render.queue[i]); i++) {
+ chart = graph.generate();
+ if (typeof graph.callback == typeof(Function)) graph.callback(chart);
+ nv.graphs.push(chart);
+ }
+
+ nv.render.queue.splice(0, i);
+
+ if (nv.render.queue.length) setTimeout(arguments.callee, 0);
+ else { nv.render.active = false; nv.dispatch.render_end(); }
+ }, 0);
+};
+
+nv.render.active = false;
+nv.render.queue = [];
+
+nv.addGraph = function(obj) {
+ if (typeof arguments[0] === typeof(Function))
+ obj = {generate: arguments[0], callback: arguments[1]};
+
+ nv.render.queue.push(obj);
+
+ if (!nv.render.active) nv.render();
+};
+
+nv.identity = function(d) { return d; };
+
+nv.strip = function(s) { return s.replace(/(\s|&)/g,''); };
+
+function daysInMonth(month,year) {
+ return (new Date(year, month+1, 0)).getDate();
+}
+
+function d3_time_range(floor, step, number) {
+ return function(t0, t1, dt) {
+ var time = floor(t0), times = [];
+ if (time < t0) step(time);
+ if (dt > 1) {
+ while (time < t1) {
+ var date = new Date(+time);
+ if ((number(date) % dt === 0)) times.push(date);
+ step(time);
+ }
+ } else {
+ while (time < t1) { times.push(new Date(+time)); step(time); }
+ }
+ return times;
+ };
+}
+
+d3.time.monthEnd = function(date) {
+ return new Date(date.getFullYear(), date.getMonth(), 0);
+};
+
+d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) {
+ date.setUTCDate(date.getUTCDate() + 1);
+ date.setDate(daysInMonth(date.getMonth() + 1, date.getFullYear()));
+ }, function(date) {
+ return date.getMonth();
+ }
+);
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/crossfilter.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/crossfilter.js
new file mode 100644
index 00000000..1aaabca2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/crossfilter.js
@@ -0,0 +1,1180 @@
+(function(exports){
+crossfilter.version = "1.0.3";
+function crossfilter_identity(d) {
+ return d;
+}
+crossfilter.permute = permute;
+
+function permute(array, index) {
+ for (var i = 0, n = index.length, copy = new Array(n); i < n; ++i) {
+ copy[i] = array[index[i]];
+ }
+ return copy;
+}
+var bisect = crossfilter.bisect = bisect_by(crossfilter_identity);
+
+bisect.by = bisect_by;
+
+function bisect_by(f) {
+
+ // Locate the insertion point for x in a to maintain sorted order. The
+ // arguments lo and hi may be used to specify a subset of the array which
+ // should be considered; by default the entire array is used. If x is already
+ // present in a, the insertion point will be before (to the left of) any
+ // existing entries. The return value is suitable for use as the first
+ // argument to `array.splice` assuming that a is already sorted.
+ //
+ // The returned insertion point i partitions the array a into two halves so
+ // that all v < x for v in a[lo:i] for the left side and all v >= x for v in
+ // a[i:hi] for the right side.
+ function bisectLeft(a, x, lo, hi) {
+ while (lo < hi) {
+ var mid = lo + hi >> 1;
+ if (f(a[mid]) < x) lo = mid + 1;
+ else hi = mid;
+ }
+ return lo;
+ }
+
+ // Similar to bisectLeft, but returns an insertion point which comes after (to
+ // the right of) any existing entries of x in a.
+ //
+ // The returned insertion point i partitions the array into two halves so that
+ // all v <= x for v in a[lo:i] for the left side and all v > x for v in
+ // a[i:hi] for the right side.
+ function bisectRight(a, x, lo, hi) {
+ while (lo < hi) {
+ var mid = lo + hi >> 1;
+ if (x < f(a[mid])) hi = mid;
+ else lo = mid + 1;
+ }
+ return lo;
+ }
+
+ bisectRight.right = bisectRight;
+ bisectRight.left = bisectLeft;
+ return bisectRight;
+}
+var heap = crossfilter.heap = heap_by(crossfilter_identity);
+
+heap.by = heap_by;
+
+function heap_by(f) {
+
+ // Builds a binary heap within the specified array a[lo:hi]. The heap has the
+ // property such that the parent a[lo+i] is always less than or equal to its
+ // two children: a[lo+2*i+1] and a[lo+2*i+2].
+ function heap(a, lo, hi) {
+ var n = hi - lo,
+ i = (n >>> 1) + 1;
+ while (--i > 0) sift(a, i, n, lo);
+ return a;
+ }
+
+ // Sorts the specified array a[lo:hi] in descending order, assuming it is
+ // already a heap.
+ function sort(a, lo, hi) {
+ var n = hi - lo,
+ t;
+ while (--n > 0) t = a[lo], a[lo] = a[lo + n], a[lo + n] = t, sift(a, 1, n, lo);
+ return a;
+ }
+
+ // Sifts the element a[lo+i-1] down the heap, where the heap is the contiguous
+ // slice of array a[lo:lo+n]. This method can also be used to update the heap
+ // incrementally, without incurring the full cost of reconstructing the heap.
+ function sift(a, i, n, lo) {
+ var d = a[--lo + i],
+ x = f(d),
+ child;
+ while ((child = i << 1) <= n) {
+ if (child < n && f(a[lo + child]) > f(a[lo + child + 1])) child++;
+ if (x <= f(a[lo + child])) break;
+ a[lo + i] = a[lo + child];
+ i = child;
+ }
+ a[lo + i] = d;
+ }
+
+ heap.sort = sort;
+ return heap;
+}
+var heapselect = crossfilter.heapselect = heapselect_by(crossfilter_identity);
+
+heapselect.by = heapselect_by;
+
+function heapselect_by(f) {
+ var heap = heap_by(f);
+
+ // Returns a new array containing the top k elements in the array a[lo:hi].
+ // The returned array is not sorted, but maintains the heap property. If k is
+ // greater than hi - lo, then fewer than k elements will be returned. The
+ // order of elements in a is unchanged by this operation.
+ function heapselect(a, lo, hi, k) {
+ var queue = new Array(k = Math.min(hi - lo, k)),
+ min,
+ i,
+ x,
+ d;
+
+ for (i = 0; i < k; ++i) queue[i] = a[lo++];
+ heap(queue, 0, k);
+
+ if (lo < hi) {
+ min = f(queue[0]);
+ do {
+ if (x = f(d = a[lo]) > min) {
+ queue[0] = d;
+ min = f(heap(queue, 0, k)[0]);
+ }
+ } while (++lo < hi);
+ }
+
+ return queue;
+ }
+
+ return heapselect;
+}
+var insertionsort = crossfilter.insertionsort = insertionsort_by(crossfilter_identity);
+
+insertionsort.by = insertionsort_by;
+
+function insertionsort_by(f) {
+
+ function insertionsort(a, lo, hi) {
+ for (var i = lo + 1; i < hi; ++i) {
+ for (var j = i, t = a[i], x = f(t); j > lo && f(a[j - 1]) > x; --j) {
+ a[j] = a[j - 1];
+ }
+ a[j] = t;
+ }
+ return a;
+ }
+
+ return insertionsort;
+}
+// Algorithm designed by Vladimir Yaroslavskiy.
+// Implementation based on the Dart project; see lib/dart/LICENSE for details.
+
+var quicksort = crossfilter.quicksort = quicksort_by(crossfilter_identity);
+
+quicksort.by = quicksort_by;
+
+function quicksort_by(f) {
+ var insertionsort = insertionsort_by(f);
+
+ function sort(a, lo, hi) {
+ return (hi - lo < quicksort_sizeThreshold
+ ? insertionsort
+ : quicksort)(a, lo, hi);
+ }
+
+ function quicksort(a, lo, hi) {
+
+ // Compute the two pivots by looking at 5 elements.
+ var sixth = (hi - lo) / 6 | 0,
+ i1 = lo + sixth,
+ i5 = hi - 1 - sixth,
+ i3 = lo + hi - 1 >> 1, // The midpoint.
+ i2 = i3 - sixth,
+ i4 = i3 + sixth;
+
+ var e1 = a[i1], x1 = f(e1),
+ e2 = a[i2], x2 = f(e2),
+ e3 = a[i3], x3 = f(e3),
+ e4 = a[i4], x4 = f(e4),
+ e5 = a[i5], x5 = f(e5);
+
+ var t;
+
+ // Sort the selected 5 elements using a sorting network.
+ if (x1 > x2) t = e1, e1 = e2, e2 = t, t = x1, x1 = x2, x2 = t;
+ if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;
+ if (x1 > x3) t = e1, e1 = e3, e3 = t, t = x1, x1 = x3, x3 = t;
+ if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;
+ if (x1 > x4) t = e1, e1 = e4, e4 = t, t = x1, x1 = x4, x4 = t;
+ if (x3 > x4) t = e3, e3 = e4, e4 = t, t = x3, x3 = x4, x4 = t;
+ if (x2 > x5) t = e2, e2 = e5, e5 = t, t = x2, x2 = x5, x5 = t;
+ if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;
+ if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;
+
+ var pivot1 = e2, pivotValue1 = x2,
+ pivot2 = e4, pivotValue2 = x4;
+
+ // e2 and e4 have been saved in the pivot variables. They will be written
+ // back, once the partitioning is finished.
+ a[i1] = e1;
+ a[i2] = a[lo];
+ a[i3] = e3;
+ a[i4] = a[hi - 1];
+ a[i5] = e5;
+
+ var less = lo + 1, // First element in the middle partition.
+ great = hi - 2; // Last element in the middle partition.
+
+ // Note that for value comparison, <, <=, >= and > coerce to a primitive via
+ // Object.prototype.valueOf; == and === do not, so in order to be consistent
+ // with natural order (such as for Date objects), we must do two compares.
+ var pivotsEqual = pivotValue1 <= pivotValue2 && pivotValue1 >= pivotValue2;
+ if (pivotsEqual) {
+
+ // Degenerated case where the partitioning becomes a dutch national flag
+ // problem.
+ //
+ // [ | < pivot | == pivot | unpartitioned | > pivot | ]
+ // ^ ^ ^ ^ ^
+ // left less k great right
+ //
+ // a[left] and a[right] are undefined and are filled after the
+ // partitioning.
+ //
+ // Invariants:
+ // 1) for x in ]left, less[ : x < pivot.
+ // 2) for x in [less, k[ : x == pivot.
+ // 3) for x in ]great, right[ : x > pivot.
+ for (var k = less; k <= great; ++k) {
+ var ek = a[k], xk = f(ek);
+ if (xk < pivotValue1) {
+ if (k !== less) {
+ a[k] = a[less];
+ a[less] = ek;
+ }
+ ++less;
+ } else if (xk > pivotValue1) {
+
+ // Find the first element <= pivot in the range [k - 1, great] and
+ // put [:ek:] there. We know that such an element must exist:
+ // When k == less, then el3 (which is equal to pivot) lies in the
+ // interval. Otherwise a[k - 1] == pivot and the search stops at k-1.
+ // Note that in the latter case invariant 2 will be violated for a
+ // short amount of time. The invariant will be restored when the
+ // pivots are put into their final positions.
+ while (true) {
+ var greatValue = f(a[great]);
+ if (greatValue > pivotValue1) {
+ great--;
+ // This is the only location in the while-loop where a new
+ // iteration is started.
+ continue;
+ } else if (greatValue < pivotValue1) {
+ // Triple exchange.
+ a[k] = a[less];
+ a[less++] = a[great];
+ a[great--] = ek;
+ break;
+ } else {
+ a[k] = a[great];
+ a[great--] = ek;
+ // Note: if great < k then we will exit the outer loop and fix
+ // invariant 2 (which we just violated).
+ break;
+ }
+ }
+ }
+ }
+ } else {
+
+ // We partition the list into three parts:
+ // 1. < pivot1
+ // 2. >= pivot1 && <= pivot2
+ // 3. > pivot2
+ //
+ // During the loop we have:
+ // [ | < pivot1 | >= pivot1 && <= pivot2 | unpartitioned | > pivot2 | ]
+ // ^ ^ ^ ^ ^
+ // left less k great right
+ //
+ // a[left] and a[right] are undefined and are filled after the
+ // partitioning.
+ //
+ // Invariants:
+ // 1. for x in ]left, less[ : x < pivot1
+ // 2. for x in [less, k[ : pivot1 <= x && x <= pivot2
+ // 3. for x in ]great, right[ : x > pivot2
+ for (var k = less; k <= great; k++) {
+ var ek = a[k], xk = f(ek);
+ if (xk < pivotValue1) {
+ if (k !== less) {
+ a[k] = a[less];
+ a[less] = ek;
+ }
+ ++less;
+ } else {
+ if (xk > pivotValue2) {
+ while (true) {
+ var greatValue = f(a[great]);
+ if (greatValue > pivotValue2) {
+ great--;
+ if (great < k) break;
+ // This is the only location inside the loop where a new
+ // iteration is started.
+ continue;
+ } else {
+ // a[great] <= pivot2.
+ if (greatValue < pivotValue1) {
+ // Triple exchange.
+ a[k] = a[less];
+ a[less++] = a[great];
+ a[great--] = ek;
+ } else {
+ // a[great] >= pivot1.
+ a[k] = a[great];
+ a[great--] = ek;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Move pivots into their final positions.
+ // We shrunk the list from both sides (a[left] and a[right] have
+ // meaningless values in them) and now we move elements from the first
+ // and third partition into these locations so that we can store the
+ // pivots.
+ a[lo] = a[less - 1];
+ a[less - 1] = pivot1;
+ a[hi - 1] = a[great + 1];
+ a[great + 1] = pivot2;
+
+ // The list is now partitioned into three partitions:
+ // [ < pivot1 | >= pivot1 && <= pivot2 | > pivot2 ]
+ // ^ ^ ^ ^
+ // left less great right
+
+ // Recursive descent. (Don't include the pivot values.)
+ sort(a, lo, less - 1);
+ sort(a, great + 2, hi);
+
+ if (pivotsEqual) {
+ // All elements in the second partition are equal to the pivot. No
+ // need to sort them.
+ return a;
+ }
+
+ // In theory it should be enough to call _doSort recursively on the second
+ // partition.
+ // The Android source however removes the pivot elements from the recursive
+ // call if the second partition is too large (more than 2/3 of the list).
+ if (less < i1 && great > i5) {
+ var lessValue, greatValue;
+ while ((lessValue = f(a[less])) <= pivotValue1 && lessValue >= pivotValue1) ++less;
+ while ((greatValue = f(a[great])) <= pivotValue2 && greatValue >= pivotValue2) --great;
+
+ // Copy paste of the previous 3-way partitioning with adaptions.
+ //
+ // We partition the list into three parts:
+ // 1. == pivot1
+ // 2. > pivot1 && < pivot2
+ // 3. == pivot2
+ //
+ // During the loop we have:
+ // [ == pivot1 | > pivot1 && < pivot2 | unpartitioned | == pivot2 ]
+ // ^ ^ ^
+ // less k great
+ //
+ // Invariants:
+ // 1. for x in [ *, less[ : x == pivot1
+ // 2. for x in [less, k[ : pivot1 < x && x < pivot2
+ // 3. for x in ]great, * ] : x == pivot2
+ for (var k = less; k <= great; k++) {
+ var ek = a[k], xk = f(ek);
+ if (xk <= pivotValue1 && xk >= pivotValue1) {
+ if (k !== less) {
+ a[k] = a[less];
+ a[less] = ek;
+ }
+ less++;
+ } else {
+ if (xk <= pivotValue2 && xk >= pivotValue2) {
+ while (true) {
+ var greatValue = f(a[great]);
+ if (greatValue <= pivotValue2 && greatValue >= pivotValue2) {
+ great--;
+ if (great < k) break;
+ // This is the only location inside the loop where a new
+ // iteration is started.
+ continue;
+ } else {
+ // a[great] < pivot2.
+ if (greatValue < pivotValue1) {
+ // Triple exchange.
+ a[k] = a[less];
+ a[less++] = a[great];
+ a[great--] = ek;
+ } else {
+ // a[great] == pivot1.
+ a[k] = a[great];
+ a[great--] = ek;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // The second partition has now been cleared of pivot elements and looks
+ // as follows:
+ // [ * | > pivot1 && < pivot2 | * ]
+ // ^ ^
+ // less great
+ // Sort the second partition using recursive descent.
+
+ // The second partition looks as follows:
+ // [ * | >= pivot1 && <= pivot2 | * ]
+ // ^ ^
+ // less great
+ // Simply sort it by recursive descent.
+
+ return sort(a, less, great + 1);
+ }
+
+ return sort;
+}
+
+var quicksort_sizeThreshold = 32;
+var crossfilter_array8 = crossfilter_arrayUntyped,
+ crossfilter_array16 = crossfilter_arrayUntyped,
+ crossfilter_array32 = crossfilter_arrayUntyped,
+ crossfilter_arrayLengthen = crossfilter_identity,
+ crossfilter_arrayWiden = crossfilter_identity;
+
+if (typeof Uint8Array !== "undefined") {
+ crossfilter_array8 = function(n) { return new Uint8Array(n); };
+ crossfilter_array16 = function(n) { return new Uint16Array(n); };
+ crossfilter_array32 = function(n) { return new Uint32Array(n); };
+
+ crossfilter_arrayLengthen = function(array, length) {
+ var copy = new array.constructor(length);
+ copy.set(array);
+ return copy;
+ };
+
+ crossfilter_arrayWiden = function(array, width) {
+ var copy;
+ switch (width) {
+ case 16: copy = crossfilter_array16(array.length); break;
+ case 32: copy = crossfilter_array32(array.length); break;
+ default: throw new Error("invalid array width!");
+ }
+ copy.set(array);
+ return copy;
+ };
+}
+
+function crossfilter_arrayUntyped(n) {
+ return new Array(n);
+}
+function crossfilter_filterExact(bisect, value) {
+ return function(values) {
+ var n = values.length;
+ return [bisect.left(values, value, 0, n), bisect.right(values, value, 0, n)];
+ };
+}
+
+function crossfilter_filterRange(bisect, range) {
+ var min = range[0],
+ max = range[1];
+ return function(values) {
+ var n = values.length;
+ return [bisect.left(values, min, 0, n), bisect.left(values, max, 0, n)];
+ };
+}
+
+function crossfilter_filterAll(values) {
+ return [0, values.length];
+}
+function crossfilter_null() {
+ return null;
+}
+function crossfilter_zero() {
+ return 0;
+}
+function crossfilter_reduceIncrement(p) {
+ return p + 1;
+}
+
+function crossfilter_reduceDecrement(p) {
+ return p - 1;
+}
+
+function crossfilter_reduceAdd(f) {
+ return function(p, v) {
+ return p + +f(v);
+ };
+}
+
+function crossfilter_reduceSubtract(f) {
+ return function(p, v) {
+ return p - f(v);
+ };
+}
+exports.crossfilter = crossfilter;
+
+function crossfilter() {
+ var crossfilter = {
+ add: add,
+ dimension: dimension,
+ groupAll: groupAll,
+ size: size
+ };
+
+ var data = [], // the records
+ n = 0, // the number of records; data.length
+ m = 0, // number of dimensions in use
+ M = 8, // number of dimensions that can fit in `filters`
+ filters = crossfilter_array8(0), // M bits per record; 1 is filtered out
+ filterListeners = [], // when the filters change
+ dataListeners = []; // when data is added
+
+ // Adds the specified new records to this crossfilter.
+ function add(newData) {
+ var n0 = n,
+ n1 = newData.length;
+
+ // If there's actually new data to add…
+ // Merge the new data into the existing data.
+ // Lengthen the filter bitset to handle the new records.
+ // Notify listeners (dimensions and groups) that new data is available.
+ if (n1) {
+ data = data.concat(newData);
+ filters = crossfilter_arrayLengthen(filters, n += n1);
+ dataListeners.forEach(function(l) { l(newData, n0, n1); });
+ }
+
+ return crossfilter;
+ }
+
+ // Adds a new dimension with the specified value accessor function.
+ function dimension(value) {
+ var dimension = {
+ filter: filter,
+ filterExact: filterExact,
+ filterRange: filterRange,
+ filterAll: filterAll,
+ top: top,
+ group: group,
+ groupAll: groupAll
+ };
+
+ var one = 1 << m++, // bit mask, e.g., 00001000
+ zero = ~one, // inverted one, e.g., 11110111
+ values, // sorted, cached array
+ index, // value rank ↦ object id
+ newValues, // temporary array storing newly-added values
+ newIndex, // temporary array storing newly-added index
+ sort = quicksort_by(function(i) { return newValues[i]; }),
+ refilter = crossfilter_filterAll, // for recomputing filter
+ indexListeners = [], // when data is added
+ lo0 = 0,
+ hi0 = 0;
+
+ // Updating a dimension is a two-stage process. First, we must update the
+ // associated filters for the newly-added records. Once all dimensions have
+ // updated their filters, the groups are notified to update.
+ dataListeners.unshift(preAdd);
+ dataListeners.push(postAdd);
+
+ // Incorporate any existing data into this dimension, and make sure that the
+ // filter bitset is wide enough to handle the new dimension.
+ if (m > M) filters = crossfilter_arrayWiden(filters, M <<= 1);
+ preAdd(data, 0, n);
+ postAdd(data, 0, n);
+
+ // Incorporates the specified new records into this dimension.
+ // This function is responsible for updating filters, values, and index.
+ function preAdd(newData, n0, n1) {
+
+ // Permute new values into natural order using a sorted index.
+ newValues = newData.map(value);
+ newIndex = sort(crossfilter_range(n1), 0, n1);
+ newValues = permute(newValues, newIndex);
+
+ // Bisect newValues to determine which new records are selected.
+ var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1], i;
+ for (i = 0; i < lo1; ++i) filters[newIndex[i] + n0] |= one;
+ for (i = hi1; i < n1; ++i) filters[newIndex[i] + n0] |= one;
+
+ // If this dimension previously had no data, then we don't need to do the
+ // more expensive merge operation; use the new values and index as-is.
+ if (!n0) {
+ values = newValues;
+ index = newIndex;
+ lo0 = lo1;
+ hi0 = hi1;
+ return;
+ }
+
+ var oldValues = values,
+ oldIndex = index,
+ i0 = 0,
+ i1 = 0;
+
+ // Otherwise, create new arrays into which to merge new and old.
+ values = new Array(n);
+ index = crossfilter_index(n, n);
+
+ // Merge the old and new sorted values, and old and new index.
+ for (i = 0; i0 < n0 && i1 < n1; ++i) {
+ if (oldValues[i0] < newValues[i1]) {
+ values[i] = oldValues[i0];
+ index[i] = oldIndex[i0++];
+ } else {
+ values[i] = newValues[i1];
+ index[i] = newIndex[i1++] + n0;
+ }
+ }
+
+ // Add any remaining old values.
+ for (; i0 < n0; ++i0, ++i) {
+ values[i] = oldValues[i0];
+ index[i] = oldIndex[i0];
+ }
+
+ // Add any remaining new values.
+ for (; i1 < n1; ++i1, ++i) {
+ values[i] = newValues[i1];
+ index[i] = newIndex[i1] + n0;
+ }
+
+ // Bisect again to recompute lo0 and hi0.
+ bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1];
+ }
+
+ // When all filters have updated, notify index listeners of the new values.
+ function postAdd(newData, n0, n1) {
+ indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); });
+ newValues = newIndex = null;
+ }
+
+ // Updates the selected values based on the specified bounds [lo, hi].
+ // This implementation is used by all the public filter methods.
+ function filterIndex(bounds) {
+ var i,
+ j,
+ k,
+ lo1 = bounds[0],
+ hi1 = bounds[1],
+ added = [],
+ removed = [];
+
+ // Fast incremental update based on previous lo index.
+ if (lo1 < lo0) {
+ for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {
+ filters[k = index[i]] ^= one;
+ added.push(k);
+ }
+ } else if (lo1 > lo0) {
+ for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {
+ filters[k = index[i]] ^= one;
+ removed.push(k);
+ }
+ }
+
+ // Fast incremental update based on previous hi index.
+ if (hi1 > hi0) {
+ for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {
+ filters[k = index[i]] ^= one;
+ added.push(k);
+ }
+ } else if (hi1 < hi0) {
+ for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {
+ filters[k = index[i]] ^= one;
+ removed.push(k);
+ }
+ }
+
+ lo0 = lo1;
+ hi0 = hi1;
+ filterListeners.forEach(function(l) { l(one, added, removed); });
+ return dimension;
+ }
+
+ // Filters this dimension using the specified range, value, or null.
+ // If the range is null, this is equivalent to filterAll.
+ // If the range is an array, this is equivalent to filterRange.
+ // Otherwise, this is equivalent to filterExact.
+ function filter(range) {
+ return range == null
+ ? filterAll() : Array.isArray(range)
+ ? filterRange(range)
+ : filterExact(range);
+ }
+
+ // Filters this dimension to select the exact value.
+ function filterExact(value) {
+ return filterIndex((refilter = crossfilter_filterExact(bisect, value))(values));
+ }
+
+ // Filters this dimension to select the specified range [lo, hi].
+ // The lower bound is inclusive, and the upper bound is exclusive.
+ function filterRange(range) {
+ return filterIndex((refilter = crossfilter_filterRange(bisect, range))(values));
+ }
+
+ // Clears any filters on this dimension.
+ function filterAll() {
+ return filterIndex((refilter = crossfilter_filterAll)(values));
+ }
+
+ // Returns the top K selected records, based on this dimension's order.
+ // Note: observes this dimension's filter, unlike group and groupAll.
+ function top(k) {
+ var array = [],
+ i = hi0,
+ j;
+
+ while (--i >= lo0 && k > 0) {
+ if (!filters[j = index[i]]) {
+ array.push(data[j]);
+ --k;
+ }
+ }
+
+ return array;
+ }
+
+ // Adds a new group to this dimension, using the specified key function.
+ function group(key) {
+ var group = {
+ top: top,
+ all: all,
+ reduce: reduce,
+ reduceCount: reduceCount,
+ reduceSum: reduceSum,
+ order: order,
+ orderNatural: orderNatural,
+ size: size
+ };
+
+ var groups, // array of {key, value}
+ groupIndex, // object id ↦ group id
+ groupWidth = 8,
+ groupCapacity = crossfilter_capacity(groupWidth),
+ k = 0, // cardinality
+ select,
+ heap,
+ reduceAdd,
+ reduceRemove,
+ reduceInitial,
+ update = crossfilter_null,
+ reset = crossfilter_null,
+ resetNeeded = true;
+
+ if (arguments.length < 1) key = crossfilter_identity;
+
+ // The group listens to the crossfilter for when any dimension changes, so
+ // that it can update the associated reduce values. It must also listen to
+ // the parent dimension for when data is added, and compute new keys.
+ filterListeners.push(update);
+ indexListeners.push(add);
+
+ // Incorporate any existing data into the grouping.
+ add(values, index, 0, n);
+
+ // Incorporates the specified new values into this group.
+ // This function is responsible for updating groups and groupIndex.
+ function add(newValues, newIndex, n0, n1) {
+ var oldGroups = groups,
+ reIndex = crossfilter_index(k, groupCapacity),
+ add = reduceAdd,
+ initial = reduceInitial,
+ k0 = k, // old cardinality
+ i0 = 0, // index of old group
+ i1 = 0, // index of new record
+ j, // object id
+ g0, // old group
+ x0, // old key
+ x1, // new key
+ g, // group to add
+ x; // key of group to add
+
+ // If a reset is needed, we don't need to update the reduce values.
+ if (resetNeeded) add = initial = crossfilter_null;
+
+ // Reset the new groups (k is a lower bound).
+ // Also, make sure that groupIndex exists and is long enough.
+ groups = new Array(k), k = 0;
+ groupIndex = k0 > 1 ? crossfilter_arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity);
+
+ // Get the first old key (x0 of g0), if it exists.
+ if (k0) x0 = (g0 = oldGroups[0]).key;
+
+ // Find the first new key (x1), skipping NaN keys.
+ while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;
+
+ // While new keys remain…
+ while (i1 < n1) {
+
+ // Determine the lesser of the two current keys; new and old.
+ // If there are no old keys remaining, then always add the new key.
+ if (g0 && x0 <= x1) {
+ g = g0, x = x0;
+
+ // Record the new index of the old group.
+ reIndex[i0] = k;
+
+ // Retrieve the next old key.
+ if (g0 = oldGroups[++i0]) x0 = g0.key;
+ } else {
+ g = {key: x1, value: initial()}, x = x1;
+ }
+
+ // Add the lesser group.
+ groups[k] = g;
+
+ // Add any selected records belonging to the added group, while
+ // advancing the new key and populating the associated group index.
+ while (!(x1 > x)) {
+ groupIndex[j = newIndex[i1] + n0] = k;
+ if (!(filters[j] & zero)) g.value = add(g.value, data[j]);
+ if (++i1 >= n1) break;
+ x1 = key(newValues[i1]);
+ }
+
+ groupIncrement();
+ }
+
+ // Add any remaining old groups that were greater than all new keys.
+ // No incremental reduce is needed; these groups have no new records.
+ // Also record the new index of the old group.
+ while (i0 < k0) {
+ groups[reIndex[i0] = k] = oldGroups[i0++];
+ groupIncrement();
+ }
+
+ // If we added any new groups before any old groups,
+ // update the group index of all the old records.
+ if (k > i0) for (i0 = 0; i0 < n0; ++i0) {
+ groupIndex[i0] = reIndex[groupIndex[i0]];
+ }
+
+ // Modify the update and reset behavior based on the cardinality.
+ // If the cardinality is less than or equal to one, then the groupIndex
+ // is not needed. If the cardinality is zero, then there are no records
+ // and therefore no groups to update or reset. Note that we also must
+ // change the registered listener to point to the new method.
+ j = filterListeners.indexOf(update);
+ if (k > 1) {
+ update = updateMany;
+ reset = resetMany;
+ } else {
+ if (k === 1) {
+ update = updateOne;
+ reset = resetOne;
+ } else {
+ update = crossfilter_null;
+ reset = crossfilter_null;
+ }
+ groupIndex = null;
+ }
+ filterListeners[j] = update;
+
+ // Count the number of added groups,
+ // and widen the group index as needed.
+ function groupIncrement() {
+ if (++k === groupCapacity) {
+ reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1);
+ groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth);
+ groupCapacity = crossfilter_capacity(groupWidth);
+ }
+ }
+ }
+
+ // Reduces the specified selected or deselected records.
+ // This function is only used when the cardinality is greater than 1.
+ function updateMany(filterOne, added, removed) {
+ if (filterOne === one || resetNeeded) return;
+
+ var i,
+ k,
+ n,
+ g;
+
+ // Add the added values.
+ for (i = 0, n = added.length; i < n; ++i) {
+ if (!(filters[k = added[i]] & zero)) {
+ g = groups[groupIndex[k]];
+ g.value = reduceAdd(g.value, data[k]);
+ }
+ }
+
+ // Remove the removed values.
+ for (i = 0, n = removed.length; i < n; ++i) {
+ if ((filters[k = removed[i]] & zero) === filterOne) {
+ g = groups[groupIndex[k]];
+ g.value = reduceRemove(g.value, data[k]);
+ }
+ }
+ }
+
+ // Reduces the specified selected or deselected records.
+ // This function is only used when the cardinality is 1.
+ function updateOne(filterOne, added, removed) {
+ if (filterOne === one || resetNeeded) return;
+
+ var i,
+ k,
+ n,
+ g = groups[0];
+
+ // Add the added values.
+ for (i = 0, n = added.length; i < n; ++i) {
+ if (!(filters[k = added[i]] & zero)) {
+ g.value = reduceAdd(g.value, data[k]);
+ }
+ }
+
+ // Remove the removed values.
+ for (i = 0, n = removed.length; i < n; ++i) {
+ if ((filters[k = removed[i]] & zero) === filterOne) {
+ g.value = reduceRemove(g.value, data[k]);
+ }
+ }
+ }
+
+ // Recomputes the group reduce values from scratch.
+ // This function is only used when the cardinality is greater than 1.
+ function resetMany() {
+ var i,
+ g;
+
+ // Reset all group values.
+ for (i = 0; i < k; ++i) {
+ groups[i].value = reduceInitial();
+ }
+
+ // Add any selected records.
+ for (i = 0; i < n; ++i) {
+ if (!(filters[i] & zero)) {
+ g = groups[groupIndex[i]];
+ g.value = reduceAdd(g.value, data[i]);
+ }
+ }
+ }
+
+ // Recomputes the group reduce values from scratch.
+ // This function is only used when the cardinality is 1.
+ function resetOne() {
+ var i,
+ g = groups[0];
+
+ // Reset the singleton group values.
+ g.value = reduceInitial();
+
+ // Add any selected records.
+ for (i = 0; i < n; ++i) {
+ if (!(filters[i] & zero)) {
+ g.value = reduceAdd(g.value, data[i]);
+ }
+ }
+ }
+
+ // Returns the array of group values, in the dimension's natural order.
+ function all() {
+ if (resetNeeded) reset(), resetNeeded = false;
+ return groups;
+ }
+
+ // Returns a new array containing the top K group values, in reduce order.
+ function top(k) {
+ var top = select(all(), 0, groups.length, k);
+ return heap.sort(top, 0, top.length);
+ }
+
+ // Sets the reduce behavior for this group to use the specified functions.
+ // This method lazily recomputes the reduce values, waiting until needed.
+ function reduce(add, remove, initial) {
+ reduceAdd = add;
+ reduceRemove = remove;
+ reduceInitial = initial;
+ resetNeeded = true;
+ return group;
+ }
+
+ // A convenience method for reducing by count.
+ function reduceCount() {
+ return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);
+ }
+
+ // A convenience method for reducing by sum(value).
+ function reduceSum(value) {
+ return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);
+ }
+
+ // Sets the reduce order, using the specified accessor.
+ function order(value) {
+ select = heapselect_by(valueOf);
+ heap = heap_by(valueOf);
+ function valueOf(d) { return value(d.value); }
+ return group;
+ }
+
+ // A convenience method for natural ordering by reduce value.
+ function orderNatural() {
+ return order(crossfilter_identity);
+ }
+
+ // Returns the cardinality of this group, irrespective of any filters.
+ function size() {
+ return k;
+ }
+
+ return reduceCount().orderNatural();
+ }
+
+ // A convenience function for generating a singleton group.
+ function groupAll() {
+ var g = group(crossfilter_null), all = g.all;
+ delete g.all;
+ delete g.top;
+ delete g.order;
+ delete g.orderNatural;
+ delete g.size;
+ g.value = function() { return all()[0].value; };
+ return g;
+ }
+
+ return dimension;
+ }
+
+ // A convenience method for groupAll on a dummy dimension.
+ // This implementation can be optimized since it is always cardinality 1.
+ function groupAll() {
+ var group = {
+ reduce: reduce,
+ reduceCount: reduceCount,
+ reduceSum: reduceSum,
+ value: value
+ };
+
+ var reduceValue,
+ reduceAdd,
+ reduceRemove,
+ reduceInitial,
+ resetNeeded = true;
+
+ // The group listens to the crossfilter for when any dimension changes, so
+ // that it can update the reduce value. It must also listen to the parent
+ // dimension for when data is added.
+ filterListeners.push(update);
+ dataListeners.push(add);
+
+ // For consistency; actually a no-op since resetNeeded is true.
+ add(data, 0, n);
+
+ // Incorporates the specified new values into this group.
+ function add(newData, n0, n1) {
+ var i;
+
+ if (resetNeeded) return;
+
+ // Add the added values.
+ for (i = n0; i < n; ++i) {
+ if (!filters[i]) {
+ reduceValue = reduceAdd(reduceValue, data[i]);
+ }
+ }
+ }
+
+ // Reduces the specified selected or deselected records.
+ function update(filterOne, added, removed) {
+ var i,
+ k,
+ n;
+
+ if (resetNeeded) return;
+
+ // Add the added values.
+ for (i = 0, n = added.length; i < n; ++i) {
+ if (!filters[k = added[i]]) {
+ reduceValue = reduceAdd(reduceValue, data[k]);
+ }
+ }
+
+ // Remove the removed values.
+ for (i = 0, n = removed.length; i < n; ++i) {
+ if (filters[k = removed[i]] === filterOne) {
+ reduceValue = reduceRemove(reduceValue, data[k]);
+ }
+ }
+ }
+
+ // Recomputes the group reduce value from scratch.
+ function reset() {
+ var i;
+
+ reduceValue = reduceInitial();
+
+ for (i = 0; i < n; ++i) {
+ if (!filters[i]) {
+ reduceValue = reduceAdd(reduceValue, data[i]);
+ }
+ }
+ }
+
+ // Sets the reduce behavior for this group to use the specified functions.
+ // This method lazily recomputes the reduce value, waiting until needed.
+ function reduce(add, remove, initial) {
+ reduceAdd = add;
+ reduceRemove = remove;
+ reduceInitial = initial;
+ resetNeeded = true;
+ return group;
+ }
+
+ // A convenience method for reducing by count.
+ function reduceCount() {
+ return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);
+ }
+
+ // A convenience method for reducing by sum(value).
+ function reduceSum(value) {
+ return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);
+ }
+
+ // Returns the computed reduce value.
+ function value() {
+ if (resetNeeded) reset(), resetNeeded = false;
+ return reduceValue;
+ }
+
+ return reduceCount();
+ }
+
+ // Returns the number of records in this crossfilter, irrespective of any filters.
+ function size() {
+ return n;
+ }
+
+ return arguments.length
+ ? add(arguments[0])
+ : crossfilter;
+}
+
+// Returns an array of size n, big enough to store ids up to m.
+function crossfilter_index(n, m) {
+ return (m < 0x101
+ ? crossfilter_array8 : m < 0x10001
+ ? crossfilter_array16
+ : crossfilter_array32)(n);
+}
+
+// Constructs a new array of size n, with sequential values from 0 to n - 1.
+function crossfilter_range(n) {
+ var range = crossfilter_index(n, n);
+ for (var i = -1; ++i < n;) range[i] = i;
+ return range;
+}
+
+function crossfilter_capacity(w) {
+ return w === 8
+ ? 0x100 : w === 16
+ ? 0x10000
+ : 0x100000000;
+}
+})(this);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/crossfilter.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/crossfilter.min.js
new file mode 100644
index 00000000..981f0d64
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/crossfilter.min.js
@@ -0,0 +1 @@
+(function(a){function b(a){return a}function c(a,b){for(var c=0,d=b.length,e=new Array(d);c<d;++c)e[c]=a[b[c]];return e}function e(a){function b(b,c,d,e){while(d<e){var f=d+e>>1;a(b[f])<c?d=f+1:e=f}return d}function c(b,c,d,e){while(d<e){var f=d+e>>1;c<a(b[f])?e=f:d=f+1}return d}return c.right=c,c.left=b,c}function g(a){function b(a,b,c){var e=c-b,f=(e>>>1)+1;while(--f>0)d(a,f,e,b);return a}function c(a,b,c){var e=c-b,f;while(--e>0)f=a[b],a[b]=a[b+e],a[b+e]=f,d(a,1,e,b);return a}function d(b,c,d,e){var f=b[--e+c],g=a(f),h;while((h=c<<1)<=d){h<d&&a(b[e+h])>a(b[e+h+1])&&h++;if(g<=a(b[e+h]))break;b[e+c]=b[e+h],c=h}b[e+c]=f}return b.sort=c,b}function i(a){function c(c,d,e,f){var g=new Array(f=Math.min(e-d,f)),h,i,j,k;for(i=0;i<f;++i)g[i]=c[d++];b(g,0,f);if(d<e){h=a(g[0]);do if(j=a(k=c[d])>h)g[0]=k,h=a(b(g,0,f)[0]);while(++d<e)}return g}var b=g(a);return c}function k(a){function b(b,c,d){for(var e=c+1;e<d;++e){for(var f=e,g=b[e],h=a(g);f>c&&a(b[f-1])>h;--f)b[f]=b[f-1];b[f]=g}return b}return b}function m(a){function c(a,c,e){return(e-c<n?b:d)(a,c,e)}function d(b,d,e){var f=(e-d)/6|0,g=d+f,h=e-1-f,i=d+e-1>>1,j=i-f,k=i+f,l=b[g],m=a(l),n=b[j],o=a(n),p=b[i],q=a(p),r=b[k],s=a(r),t=b[h],u=a(t),v;m>o&&(v=l,l=n,n=v,v=m,m=o,o=v),s>u&&(v=r,r=t,t=v,v=s,s=u,u=v),m>q&&(v=l,l=p,p=v,v=m,m=q,q=v),o>q&&(v=n,n=p,p=v,v=o,o=q,q=v),m>s&&(v=l,l=r,r=v,v=m,m=s,s=v),q>s&&(v=p,p=r,r=v,v=q,q=s,s=v),o>u&&(v=n,n=t,t=v,v=o,o=u,u=v),o>q&&(v=n,n=p,p=v,v=o,o=q,q=v),s>u&&(v=r,r=t,t=v,v=s,s=u,u=v);var w=n,x=o,y=r,z=s;b[g]=l,b[j]=b[d],b[i]=p,b[k]=b[e-1],b[h]=t;var A=d+1,B=e-2,C=x<=z&&x>=z;if(C)for(var D=A;D<=B;++D){var E=b[D],F=a(E);if(F<x)D!==A&&(b[D]=b[A],b[A]=E),++A;else if(F>x)for(;;){var G=a(b[B]);if(G>x){B--;continue}if(G<x){b[D]=b[A],b[A++]=b[B],b[B--]=E;break}b[D]=b[B],b[B--]=E;break}}else for(var D=A;D<=B;D++){var E=b[D],F=a(E);if(F<x)D!==A&&(b[D]=b[A],b[A]=E),++A;else if(F>z)for(;;){var G=a(b[B]);if(G>z){B--;if(B<D)break;continue}G<x?(b[D]=b[A],b[A++]=b[B],b[B--]=E):(b[D]=b[B],b[B--]=E);break}}b[d]=b[A-1],b[A-1]=w,b[e-1]=b[B+1],b[B+1]=y,c(b,d,A-1),c(b,B+2,e);if(C)return b;if(A<g&&B>h){var H,G;while((H=a(b[A]))<=x&&H>=x)++A;while((G=a(b[B]))<=z&&G>=z)--B;for(var D=A;D<=B;D++){var E=b[D],F=a(E);if(F<=x&&F>=x)D!==A&&(b[D]=b[A],b[A]=E),A++;else if(F<=z&&F>=z)for(;;){var G=a(b[B]);if(G<=z&&G>=z){B--;if(B<D)break;continue}G<x?(b[D]=b[A],b[A++]=b[B],b[B--]=E):(b[D]=b[B],b[B--]=E);break}}}return c(b,A,B+1)}var b=k(a);return c}function t(a){return new Array(a)}function u(a,b){return function(c){var d=c.length;return[a.left(c,b,0,d),a.right(c,b,0,d)]}}function v(a,b){var c=b[0],d=b[1];return function(b){var e=b.length;return[a.left(b,c,0,e),a.left(b,d,0,e)]}}function w(a){return[0,a.length]}function x(){return null}function y(){return 0}function z(a){return a+1}function A(a){return a-1}function B(a){return function(b,c){return b+ +a(c)}}function C(a){return function(b,c){return b-a(c)}}function D(){function p(b){var c=f,d=b.length;return d&&(e=e.concat(b),k=r(k,f+=d),n.forEach(function(a){a(b,c,d)})),a}function q(a){function P(b,d,e){H=b.map(a),I=J(F(e),0,e),H=c(H,I);var g=K(H),h=g[0],i=g[1],j;for(j=0;j<h;++j)k[I[j]+d]|=p;for(j=i;j<e;++j)k[I[j]+d]|=p;if(!d){t=H,D=I,N=h,O=i;return}var l=t,m=D,n=0,o=0;t=new Array(f),D=E(f,f);for(j=0;n<d&&o<e;++j)l[n]<H[o]?(t[j]=l[n],D[j]=m[n++]):(t[j]=H[o],D[j]=I[o++]+d);for(;n<d;++n,++j)t[j]=l[n],D[j]=m[n];for(;o<e;++o,++j)t[j]=H[o],D[j]=I[o]+d;g=K(t),N=g[0],O=g[1]}function Q(a,b,c){L.forEach(function(a){a(H,I,b,c)}),H=I=null}function R(a){var b,c,d,e=a[0],f=a[1],g=[],h=[];if(e<N)for(b=e,c=Math.min(N,f);b<c;++b)k[d=D[b]]^=p,g.push(d);else if(e>N)for(b=N,c=Math.min(e,O);b<c;++b)k[d=D[b]]^=p,h.push(d);if(f>O)for(b=Math.max(e,O),c=f;b<c;++b)k[d=D[b]]^=p,g.push(d);else if(f<O)for(b=Math.max(N,f),c=O;b<c;++b)k[d=D[b]]^=p,h.push(d);return N=e,O=f,l.forEach(function(a){a(p,g,h)}),o}function S(a){return a==null?V():Array.isArray(a)?U(a):T(a)}function T(a){return R((K=u(d,a))(t))}function U(a){return R((K=v(d,a))(t))}function V(){return R((K=w)(t))}function W(a){var b=[],c=O,d;while(--c>=N&&a>0)k[d=D[c]]||(b.push(e[d]),--a);return b}function X(a){function K(b,c,g,i){function Q(){++n===m&&(p=s(p,j<<=1),h=s(h,j),m=G(j))}var o=d,p=E(n,m),t=v,u=F,w=n,y=0,z=0,A,B,C,D,K,L;J&&(t=u=x),d=new Array(n),n=0,h=w>1?r(h,f):E(f,m),w&&(C=(B=o[0]).key);while(z<i&&!((D=a(b[z]))>=D))++z;while(z<i){if(B&&C<=D){K=B,L=C,p[y]=n;if(B=o[++y])C=B.key}else K={key:D,value:u()},L=D;d[n]=K;while(!(D>L)){h[A=c[z]+g]=n,k[A]&q||(K.value=t(K.value,e[A]));if(++z>=i)break;D=a(b[z])}Q()}while(y<w)d[p[y]=n]=o[y++],Q();if(n>y)for(y=0;y<g;++y)h[y]=p[h[y]];A=l.indexOf(H),n>1?(H=M,I=O):(n===1?(H=N,I=P):(H=x,I=x),h=null),l[A]=H}function M(a,b,c){if(a===p||J)return;var f,g,i,j;for(f=0,i=b.length;f<i;++f)k[g=b[f]]&q||(j=d[h[g]],j.value=v(j.value,e[g]));for(f=0,i=c.length;f<i;++f)(k[g=c[f]]&q)===a&&(j=d[h[g]],j.value=w(j.value,e[g]))}function N(a,b,c){if(a===p||J)return;var f,g,h,i=d[0];for(f=0,h=b.length;f<h;++f)k[g=b[f]]&q||(i.value=v(i.value,e[g]));for(f=0,h=c.length;f<h;++f)(k[g=c[f]]&q)===a&&(i.value=w(i.value,e[g]))}function O(){var a,b;for(a=0;a<n;++a)d[a].value=F();for(a=0;a<f;++a)k[a]&q||(b=d[h[a]],b.value=v(b.value,e[a]))}function P(){var a,b=d[0];b.value=F();for(a=0;a<f;++a)k[a]&q||(b.value=v(b.value,e[a]))}function Q(){return J&&(I(),J=!1),d}function R(a){var b=o(Q(),0,d.length,a);return u.sort(b,0,b.length)}function S(a,b,d){return v=a,w=b,F=d,J=!0,c}function T(){return S(z,A,y)}function U(a){return S(B(a),C(a),y)}function V(a){function b(b){return a(b.value)}return o=i(b),u=g(b),c}function W(){return V(b)}function X(){return n}var c={top:R,all:Q,reduce:S,reduceCount:T,reduceSum:U,order:V,orderNatural:W,size:X},d,h,j=8,m=G(j),n=0,o,u,v,w,F,H=x,I=x,J=!0;return arguments.length<1&&(a=b),l.push(H),L.push(K),K(t,D,0,f),T().orderNatural()}function Y(){var a=X(x),b=a.all;return delete a.all,delete a.top,delete a.order,delete a.orderNatural,delete a.size,a.value=function(){return b()[0].value},a}var o={filter:S,filterExact:T,filterRange:U,filterAll:V,top:W,group:X,groupAll:Y},p=1<<h++,q=~p,t,D,H,I,J=m(function(a){return H[a]}),K=w,L=[],N=0,O=0;return n.unshift(P),n.push(Q),h>j&&(k=s(k,j<<=1)),P(e,0,f),Q(e,0,f),o}function t(){function i(a,d,g){var i;if(h)return;for(i=d;i<f;++i)k[i]||(b=c(b,e[i]))}function j(a,f,g){var i,j,l;if(h)return;for(i=0,l=f.length;i<l;++i)k[j=f[i]]||(b=c(b,e[j]));for(i=0,l=g.length;i<l;++i)k[j=g[i]]===a&&(b=d(b,e[j]))}function m(){var a;b=g();for(a=0;a<f;++a)k[a]||(b=c(b,e[a]))}function o(b,e,f){return c=b,d=e,g=f,h=!0,a}function p(){return o(z,A,y)}function q(a){return o(B(a),C(a),y)}function r(){return h&&(m(),h=!1),b}var a={reduce:o,reduceCount:p,reduceSum:q,value:r},b,c,d,g,h=!0;return l.push(j),n.push(i),i(e,0,f),p()}function D(){return f}var a={add:p,dimension:q,groupAll:t,size:D},e=[],f=0,h=0,j=8,k=o(0),l=[],n=[];return arguments.length?p(arguments[0]):a}function E(a,b){return(b<257?o:b<65537?p:q)(a)}function F(a){var b=E(a,a);for(var c=-1;++c<a;)b[c]=c;return b}function G(a){return a===8?256:a===16?65536:4294967296}D.version="1.0.3",D.permute=c;var d=D.bisect=e(b);d.by=e;var f=D.heap=g(b);f.by=g;var h=D.heapselect=i(b);h.by=i;var j=D.insertionsort=k(b);j.by=k;var l=D.quicksort=m(b);l.by=m;var n=32,o=t,p=t,q=t,r=b,s=b;typeof Uint8Array!="undefined"&&(o=function(a){return new Uint8Array(a)},p=function(a){return new Uint16Array(a)},q=function(a){return new Uint32Array(a)},r=function(a,b){var c=new a.constructor(b);return c.set(a),c},s=function(a,b){var c;switch(b){case 16:c=p(a.length);break;case 32:c=q(a.length);break;default:throw new Error("invalid array width!")}return c.set(a),c}),a.crossfilter=D})(this); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.geom.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.geom.js
new file mode 100644
index 00000000..a19bb16e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.geom.js
@@ -0,0 +1,816 @@
+(function(){d3.geom = {};
+/**
+ * Computes a contour for a given input grid function using the <a
+ * href="http://en.wikipedia.org/wiki/Marching_squares">marching
+ * squares</a> algorithm. Returns the contour polygon as an array of points.
+ *
+ * @param grid a two-input function(x, y) that returns true for values
+ * inside the contour and false for values outside the contour.
+ * @param start an optional starting point [x, y] on the grid.
+ * @returns polygon [[x1, y1], [x2, y2], …]
+ */
+d3.geom.contour = function(grid, start) {
+ var s = start || d3_geom_contourStart(grid), // starting point
+ c = [], // contour polygon
+ x = s[0], // current x position
+ y = s[1], // current y position
+ dx = 0, // next x direction
+ dy = 0, // next y direction
+ pdx = NaN, // previous x direction
+ pdy = NaN, // previous y direction
+ i = 0;
+
+ do {
+ // determine marching squares index
+ i = 0;
+ if (grid(x-1, y-1)) i += 1;
+ if (grid(x, y-1)) i += 2;
+ if (grid(x-1, y )) i += 4;
+ if (grid(x, y )) i += 8;
+
+ // determine next direction
+ if (i == 6) {
+ dx = pdy == -1 ? -1 : 1;
+ dy = 0;
+ } else if (i == 9) {
+ dx = 0;
+ dy = pdx == 1 ? -1 : 1;
+ } else {
+ dx = d3_geom_contourDx[i];
+ dy = d3_geom_contourDy[i];
+ }
+
+ // update contour polygon
+ if (dx != pdx && dy != pdy) {
+ c.push([x, y]);
+ pdx = dx;
+ pdy = dy;
+ }
+
+ x += dx;
+ y += dy;
+ } while (s[0] != x || s[1] != y);
+
+ return c;
+};
+
+// lookup tables for marching directions
+var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN],
+ d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN];
+
+function d3_geom_contourStart(grid) {
+ var x = 0,
+ y = 0;
+
+ // search for a starting point; begin at origin
+ // and proceed along outward-expanding diagonals
+ while (true) {
+ if (grid(x,y)) {
+ return [x,y];
+ }
+ if (x == 0) {
+ x = y + 1;
+ y = 0;
+ } else {
+ x = x - 1;
+ y = y + 1;
+ }
+ }
+}/**
+ * Computes the 2D convex hull of a set of points using Graham's scanning
+ * algorithm. The algorithm has been implemented as described in Cormen,
+ * Leiserson, and Rivest's Introduction to Algorithms. The running time of
+ * this algorithm is O(n log n), where n is the number of input points.
+ *
+ * @param vertices [[x1, y1], [x2, y2], …]
+ * @returns polygon [[x1, y1], [x2, y2], …]
+ */
+d3.geom.hull = function(vertices) {
+ if (vertices.length < 3) return [];
+
+ var len = vertices.length,
+ plen = len - 1,
+ points = [],
+ stack = [],
+ i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
+
+ // find the starting ref point: leftmost point with the minimum y coord
+ for (i=1; i<len; ++i) {
+ if (vertices[i][1] < vertices[h][1]) {
+ h = i;
+ } else if (vertices[i][1] == vertices[h][1]) {
+ h = (vertices[i][0] < vertices[h][0] ? i : h);
+ }
+ }
+
+ // calculate polar angles from ref point and sort
+ for (i=0; i<len; ++i) {
+ if (i == h) continue;
+ y1 = vertices[i][1] - vertices[h][1];
+ x1 = vertices[i][0] - vertices[h][0];
+ points.push({angle: Math.atan2(y1, x1), index: i});
+ }
+ points.sort(function(a, b) { return a.angle - b.angle; });
+
+ // toss out duplicate angles
+ a = points[0].angle;
+ v = points[0].index;
+ u = 0;
+ for (i=1; i<plen; ++i) {
+ j = points[i].index;
+ if (a == points[i].angle) {
+ // keep angle for point most distant from the reference
+ x1 = vertices[v][0] - vertices[h][0];
+ y1 = vertices[v][1] - vertices[h][1];
+ x2 = vertices[j][0] - vertices[h][0];
+ y2 = vertices[j][1] - vertices[h][1];
+ if ((x1*x1 + y1*y1) >= (x2*x2 + y2*y2)) {
+ points[i].index = -1;
+ } else {
+ points[u].index = -1;
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ } else {
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ }
+
+ // initialize the stack
+ stack.push(h);
+ for (i=0, j=0; i<2; ++j) {
+ if (points[j].index != -1) {
+ stack.push(points[j].index);
+ i++;
+ }
+ }
+ sp = stack.length;
+
+ // do graham's scan
+ for (; j<plen; ++j) {
+ if (points[j].index == -1) continue; // skip tossed out points
+ while (!d3_geom_hullCCW(stack[sp-2], stack[sp-1], points[j].index, vertices)) {
+ --sp;
+ }
+ stack[sp++] = points[j].index;
+ }
+
+ // construct the hull
+ var poly = [];
+ for (i=0; i<sp; ++i) {
+ poly.push(vertices[stack[i]]);
+ }
+ return poly;
+}
+
+// are three points in counter-clockwise order?
+function d3_geom_hullCCW(i1, i2, i3, v) {
+ var t, a, b, c, d, e, f;
+ t = v[i1]; a = t[0]; b = t[1];
+ t = v[i2]; c = t[0]; d = t[1];
+ t = v[i3]; e = t[0]; f = t[1];
+ return ((f-b)*(c-a) - (d-b)*(e-a)) > 0;
+}// Note: requires coordinates to be counterclockwise and convex!
+d3.geom.polygon = function(coordinates) {
+
+ coordinates.area = function() {
+ var i = 0,
+ n = coordinates.length,
+ a = coordinates[n - 1][0] * coordinates[0][1],
+ b = coordinates[n - 1][1] * coordinates[0][0];
+ while (++i < n) {
+ a += coordinates[i - 1][0] * coordinates[i][1];
+ b += coordinates[i - 1][1] * coordinates[i][0];
+ }
+ return (b - a) * .5;
+ };
+
+ coordinates.centroid = function(k) {
+ var i = -1,
+ n = coordinates.length - 1,
+ x = 0,
+ y = 0,
+ a,
+ b,
+ c;
+ if (!arguments.length) k = 1 / (6 * coordinates.area());
+ while (++i < n) {
+ a = coordinates[i];
+ b = coordinates[i + 1];
+ c = a[0] * b[1] - b[0] * a[1];
+ x += (a[0] + b[0]) * c;
+ y += (a[1] + b[1]) * c;
+ }
+ return [x * k, y * k];
+ };
+
+ // The Sutherland-Hodgman clipping algorithm.
+ coordinates.clip = function(subject) {
+ var input,
+ i = -1,
+ n = coordinates.length,
+ j,
+ m,
+ a = coordinates[n - 1],
+ b,
+ c,
+ d;
+ while (++i < n) {
+ input = subject.slice();
+ subject.length = 0;
+ b = coordinates[i];
+ c = input[(m = input.length) - 1];
+ j = -1;
+ while (++j < m) {
+ d = input[j];
+ if (d3_geom_polygonInside(d, a, b)) {
+ if (!d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ subject.push(d);
+ } else if (d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ c = d;
+ }
+ a = b;
+ }
+ return subject;
+ };
+
+ return coordinates;
+};
+
+function d3_geom_polygonInside(p, a, b) {
+ return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
+}
+
+// Intersect two infinite lines cd and ab.
+function d3_geom_polygonIntersect(c, d, a, b) {
+ var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0],
+ y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1],
+ x13 = x1 - x3,
+ x21 = x2 - x1,
+ x43 = x4 - x3,
+ y13 = y1 - y3,
+ y21 = y2 - y1,
+ y43 = y4 - y3,
+ ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21);
+ return [x1 + ua * x21, y1 + ua * y21];
+}
+// Adapted from Nicolas Garcia Belmonte's JIT implementation:
+// http://blog.thejit.org/2010/02/12/voronoi-tessellation/
+// http://blog.thejit.org/assets/voronoijs/voronoi.js
+// See lib/jit/LICENSE for details.
+
+/**
+ * @param vertices [[x1, y1], [x2, y2], …]
+ * @returns polygons [[[x1, y1], [x2, y2], …], …]
+ */
+d3.geom.voronoi = function(vertices) {
+ var polygons = vertices.map(function() { return []; });
+
+ // Note: we expect the caller to clip the polygons, if needed.
+ d3_voronoi_tessellate(vertices, function(e) {
+ var s1,
+ s2,
+ x1,
+ x2,
+ y1,
+ y2;
+ if (e.a == 1 && e.b >= 0) {
+ s1 = e.ep.r;
+ s2 = e.ep.l;
+ } else {
+ s1 = e.ep.l;
+ s2 = e.ep.r;
+ }
+ if (e.a == 1) {
+ y1 = s1 ? s1.y : -1e6;
+ x1 = e.c - e.b * y1;
+ y2 = s2 ? s2.y : 1e6;
+ x2 = e.c - e.b * y2;
+ } else {
+ x1 = s1 ? s1.x : -1e6;
+ y1 = e.c - e.a * x1;
+ x2 = s2 ? s2.x : 1e6;
+ y2 = e.c - e.a * x2;
+ }
+ var v1 = [x1, y1],
+ v2 = [x2, y2];
+ polygons[e.region.l.index].push(v1, v2);
+ polygons[e.region.r.index].push(v1, v2);
+ });
+
+ // Reconnect the polygon segments into counterclockwise loops.
+ return polygons.map(function(polygon, i) {
+ var cx = vertices[i][0],
+ cy = vertices[i][1];
+ polygon.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ return polygon.sort(function(a, b) {
+ return a.angle - b.angle;
+ }).filter(function(d, i) {
+ return !i || (d.angle - polygon[i - 1].angle > 1e-10);
+ });
+ });
+};
+
+var d3_voronoi_opposite = {"l": "r", "r": "l"};
+
+function d3_voronoi_tessellate(vertices, callback) {
+
+ var Sites = {
+ list: vertices
+ .map(function(v, i) {
+ return {
+ index: i,
+ x: v[0],
+ y: v[1]
+ };
+ })
+ .sort(function(a, b) {
+ return a.y < b.y ? -1
+ : a.y > b.y ? 1
+ : a.x < b.x ? -1
+ : a.x > b.x ? 1
+ : 0;
+ }),
+ bottomSite: null
+ };
+
+ var EdgeList = {
+ list: [],
+ leftEnd: null,
+ rightEnd: null,
+
+ init: function() {
+ EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.leftEnd.r = EdgeList.rightEnd;
+ EdgeList.rightEnd.l = EdgeList.leftEnd;
+ EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
+ },
+
+ createHalfEdge: function(edge, side) {
+ return {
+ edge: edge,
+ side: side,
+ vertex: null,
+ "l": null,
+ "r": null
+ };
+ },
+
+ insert: function(lb, he) {
+ he.l = lb;
+ he.r = lb.r;
+ lb.r.l = he;
+ lb.r = he;
+ },
+
+ leftBound: function(p) {
+ var he = EdgeList.leftEnd;
+ do {
+ he = he.r;
+ } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
+ he = he.l;
+ return he;
+ },
+
+ del: function(he) {
+ he.l.r = he.r;
+ he.r.l = he.l;
+ he.edge = null;
+ },
+
+ right: function(he) {
+ return he.r;
+ },
+
+ left: function(he) {
+ return he.l;
+ },
+
+ leftRegion: function(he) {
+ return he.edge == null
+ ? Sites.bottomSite
+ : he.edge.region[he.side];
+ },
+
+ rightRegion: function(he) {
+ return he.edge == null
+ ? Sites.bottomSite
+ : he.edge.region[d3_voronoi_opposite[he.side]];
+ }
+ };
+
+ var Geom = {
+
+ bisect: function(s1, s2) {
+ var newEdge = {
+ region: {"l": s1, "r": s2},
+ ep: {"l": null, "r": null}
+ };
+
+ var dx = s2.x - s1.x,
+ dy = s2.y - s1.y,
+ adx = dx > 0 ? dx : -dx,
+ ady = dy > 0 ? dy : -dy;
+
+ newEdge.c = s1.x * dx + s1.y * dy
+ + (dx * dx + dy * dy) * .5;
+
+ if (adx > ady) {
+ newEdge.a = 1;
+ newEdge.b = dy / dx;
+ newEdge.c /= dx;
+ } else {
+ newEdge.b = 1;
+ newEdge.a = dx / dy;
+ newEdge.c /= dy;
+ }
+
+ return newEdge;
+ },
+
+ intersect: function(el1, el2) {
+ var e1 = el1.edge,
+ e2 = el2.edge;
+ if (!e1 || !e2 || (e1.region.r == e2.region.r)) {
+ return null;
+ }
+ var d = (e1.a * e2.b) - (e1.b * e2.a);
+ if (Math.abs(d) < 1e-10) {
+ return null;
+ }
+ var xint = (e1.c * e2.b - e2.c * e1.b) / d,
+ yint = (e2.c * e1.a - e1.c * e2.a) / d,
+ e1r = e1.region.r,
+ e2r = e2.region.r,
+ el,
+ e;
+ if ((e1r.y < e2r.y) ||
+ (e1r.y == e2r.y && e1r.x < e2r.x)) {
+ el = el1;
+ e = e1;
+ } else {
+ el = el2;
+ e = e2;
+ }
+ var rightOfSite = (xint >= e.region.r.x);
+ if ((rightOfSite && (el.side == "l")) ||
+ (!rightOfSite && (el.side == "r"))) {
+ return null;
+ }
+ return {
+ x: xint,
+ y: yint
+ };
+ },
+
+ rightOf: function(he, p) {
+ var e = he.edge,
+ topsite = e.region.r,
+ rightOfSite = (p.x > topsite.x);
+
+ if (rightOfSite && (he.side == "l")) {
+ return 1;
+ }
+ if (!rightOfSite && (he.side == "r")) {
+ return 0;
+ }
+ if (e.a == 1) {
+ var dyp = p.y - topsite.y,
+ dxp = p.x - topsite.x,
+ fast = 0,
+ above = 0;
+
+ if ((!rightOfSite && (e.b < 0)) ||
+ (rightOfSite && (e.b >= 0))) {
+ above = fast = (dyp >= e.b * dxp);
+ } else {
+ above = ((p.x + p.y * e.b) > e.c);
+ if (e.b < 0) {
+ above = !above;
+ }
+ if (!above) {
+ fast = 1;
+ }
+ }
+ if (!fast) {
+ var dxs = topsite.x - e.region.l.x;
+ above = (e.b * (dxp * dxp - dyp * dyp)) <
+ (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b));
+
+ if (e.b < 0) {
+ above = !above;
+ }
+ }
+ } else /* e.b == 1 */ {
+ var yl = e.c - e.a * p.x,
+ t1 = p.y - yl,
+ t2 = p.x - topsite.x,
+ t3 = yl - topsite.y;
+
+ above = (t1 * t1) > (t2 * t2 + t3 * t3);
+ }
+ return he.side == "l" ? above : !above;
+ },
+
+ endPoint: function(edge, side, site) {
+ edge.ep[side] = site;
+ if (!edge.ep[d3_voronoi_opposite[side]]) return;
+ callback(edge);
+ },
+
+ distance: function(s, t) {
+ var dx = s.x - t.x,
+ dy = s.y - t.y;
+ return Math.sqrt(dx * dx + dy * dy);
+ }
+ };
+
+ var EventQueue = {
+ list: [],
+
+ insert: function(he, site, offset) {
+ he.vertex = site;
+ he.ystar = site.y + offset;
+ for (var i=0, list=EventQueue.list, l=list.length; i<l; i++) {
+ var next = list[i];
+ if (he.ystar > next.ystar ||
+ (he.ystar == next.ystar &&
+ site.x > next.vertex.x)) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ list.splice(i, 0, he);
+ },
+
+ del: function(he) {
+ for (var i=0, ls=EventQueue.list, l=ls.length; i<l && (ls[i] != he); ++i) {}
+ ls.splice(i, 1);
+ },
+
+ empty: function() { return EventQueue.list.length == 0; },
+
+ nextEvent: function(he) {
+ for (var i=0, ls=EventQueue.list, l=ls.length; i<l; ++i) {
+ if (ls[i] == he) return ls[i+1];
+ }
+ return null;
+ },
+
+ min: function() {
+ var elem = EventQueue.list[0];
+ return {
+ x: elem.vertex.x,
+ y: elem.ystar
+ };
+ },
+
+ extractMin: function() {
+ return EventQueue.list.shift();
+ }
+ };
+
+ EdgeList.init();
+ Sites.bottomSite = Sites.list.shift();
+
+ var newSite = Sites.list.shift(), newIntStar;
+ var lbnd, rbnd, llbnd, rrbnd, bisector;
+ var bot, top, temp, p, v;
+ var e, pm;
+
+ while (true) {
+ if (!EventQueue.empty()) {
+ newIntStar = EventQueue.min();
+ }
+ if (newSite && (EventQueue.empty()
+ || newSite.y < newIntStar.y
+ || (newSite.y == newIntStar.y
+ && newSite.x < newIntStar.x))) { //new site is smallest
+ lbnd = EdgeList.leftBound(newSite);
+ rbnd = EdgeList.right(lbnd);
+ bot = EdgeList.rightRegion(lbnd);
+ e = Geom.bisect(bot, newSite);
+ bisector = EdgeList.createHalfEdge(e, "l");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(lbnd, bisector);
+ if (p) {
+ EventQueue.del(lbnd);
+ EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
+ }
+ lbnd = bisector;
+ bisector = EdgeList.createHalfEdge(e, "r");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(bisector, rbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, newSite));
+ }
+ newSite = Sites.list.shift();
+ } else if (!EventQueue.empty()) { //intersection is smallest
+ lbnd = EventQueue.extractMin();
+ llbnd = EdgeList.left(lbnd);
+ rbnd = EdgeList.right(lbnd);
+ rrbnd = EdgeList.right(rbnd);
+ bot = EdgeList.leftRegion(lbnd);
+ top = EdgeList.rightRegion(rbnd);
+ v = lbnd.vertex;
+ Geom.endPoint(lbnd.edge, lbnd.side, v);
+ Geom.endPoint(rbnd.edge, rbnd.side, v);
+ EdgeList.del(lbnd);
+ EventQueue.del(rbnd);
+ EdgeList.del(rbnd);
+ pm = "l";
+ if (bot.y > top.y) {
+ temp = bot;
+ bot = top;
+ top = temp;
+ pm = "r";
+ }
+ e = Geom.bisect(bot, top);
+ bisector = EdgeList.createHalfEdge(e, pm);
+ EdgeList.insert(llbnd, bisector);
+ Geom.endPoint(e, d3_voronoi_opposite[pm], v);
+ p = Geom.intersect(llbnd, bisector);
+ if (p) {
+ EventQueue.del(llbnd);
+ EventQueue.insert(llbnd, p, Geom.distance(p, bot));
+ }
+ p = Geom.intersect(bisector, rrbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, bot));
+ }
+ } else {
+ break;
+ }
+ }//end while
+
+ for (lbnd = EdgeList.right(EdgeList.leftEnd);
+ lbnd != EdgeList.rightEnd;
+ lbnd = EdgeList.right(lbnd)) {
+ callback(lbnd.edge);
+ }
+}
+/**
+* @param vertices [[x1, y1], [x2, y2], …]
+* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …]
+ */
+d3.geom.delaunay = function(vertices) {
+ var edges = vertices.map(function() { return []; }),
+ triangles = [];
+
+ // Use the Voronoi tessellation to determine Delaunay edges.
+ d3_voronoi_tessellate(vertices, function(e) {
+ edges[e.region.l.index].push(vertices[e.region.r.index]);
+ });
+
+ // Reconnect the edges into counterclockwise triangles.
+ edges.forEach(function(edge, i) {
+ var v = vertices[i],
+ cx = v[0],
+ cy = v[1];
+ edge.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ edge.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ for (var j = 0, m = edge.length - 1; j < m; j++) {
+ triangles.push([v, edge[j], edge[j + 1]]);
+ }
+ });
+
+ return triangles;
+};
+/**
+ * Constructs a new quadtree for the specified array of points. A quadtree is a
+ * two-dimensional recursive spatial subdivision. This implementation uses
+ * square partitions, dividing each square into four equally-sized squares. Each
+ * point exists in a unique node; if multiple points are in the same position,
+ * some points may be stored on internal nodes rather than leaf nodes. Quadtrees
+ * can be used to accelerate various spatial operations, such as the Barnes-Hut
+ * approximation for computing n-body forces, or collision detection.
+ *
+ * @param points [[x1, y1], [x2, y2], …]
+ * @return quadtree root {left: boolean, nodes: […], point: [x, y]}
+ */
+d3.geom.quadtree = function(points) {
+ var p,
+ i = -1,
+ n = points.length;
+
+ /* Compute bounds. */
+ var x1 = Number.POSITIVE_INFINITY, y1 = x1,
+ x2 = Number.NEGATIVE_INFINITY, y2 = x2;
+ while (++i < n) {
+ p = points[i];
+ if (p[0] < x1) x1 = p[0];
+ if (p[1] < y1) y1 = p[1];
+ if (p[0] > x2) x2 = p[0];
+ if (p[1] > y2) y2 = p[1];
+ }
+
+ /* Squarify the bounds. */
+ var dx = x2 - x1,
+ dy = y2 - y1;
+ if (dx > dy) y2 = y1 + dx;
+ else x2 = x1 + dy;
+
+ /**
+ * @ignore Recursively inserts the specified point <i>p</i> at the node
+ * <i>n</i> or one of its descendants. The bounds are defined by [<i>x1</i>,
+ * <i>x2</i>] and [<i>y1</i>, <i>y2</i>].
+ */
+ function insert(n, p, x1, y1, x2, y2) {
+ if (isNaN(p[0]) || isNaN(p[1])) return; // ignore invalid points
+ if (n.leaf) {
+ var v = n.point;
+ if (v) {
+ /*
+ * If the point at this leaf node is at the same position as the new
+ * point we are adding, we leave the point associated with the
+ * internal node while adding the new point to a child node. This
+ * avoids infinite recursion.
+ */
+ if ((Math.abs(v[0] - p[0]) + Math.abs(v[1] - p[1])) < .01) {
+ insertChild(n, p, x1, y1, x2, y2);
+ } else {
+ n.point = null;
+ insertChild(n, v, x1, y1, x2, y2);
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ } else {
+ n.point = p;
+ }
+ } else {
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ }
+
+ /**
+ * @ignore Recursively inserts the specified point <i>p</i> into a
+ * descendant of node <i>n</i>. The bounds are defined by [<i>x1</i>,
+ * <i>x2</i>] and [<i>y1</i>, <i>y2</i>].
+ */
+ function insertChild(n, p, x1, y1, x2, y2) {
+ /* Compute the split point, and the quadrant in which to insert p. */
+ var sx = (x1 + x2) * .5,
+ sy = (y1 + y2) * .5,
+ right = p[0] >= sx,
+ bottom = p[1] >= sy,
+ i = (bottom << 1) + right;
+
+ /* Recursively insert into the child node. */
+ n.leaf = false;
+ n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
+
+ /* Update the bounds as we recurse. */
+ if (right) x1 = sx; else x2 = sx;
+ if (bottom) y1 = sy; else y2 = sy;
+ insert(n, p, x1, y1, x2, y2);
+ }
+
+ /* Create the root node. */
+ var root = d3_geom_quadtreeNode();
+
+ /* Insert all points. */
+ i = -1;
+ while (++i < n) insert(root, points[i], x1, y1, x2, y2);
+
+ /* Register a visitor function for the root. */
+ root.visit = function(f) {
+ d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
+ };
+
+ return root;
+};
+
+function d3_geom_quadtreeNode() {
+ return {
+ leaf: true,
+ nodes: [],
+ point: null
+ };
+}
+
+function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
+ if (!f(node, x1, y1, x2, y2)) {
+ var sx = (x1 + x2) * .5,
+ sy = (y1 + y2) * .5,
+ children = node.nodes;
+ if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
+ if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
+ if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
+ if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
+ }
+}
+})() \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.js
new file mode 100644
index 00000000..7655eb78
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.js
@@ -0,0 +1,5 @@
+!function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null===n?0/0:+n}function e(n){return!isNaN(n)}function r(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function u(n){return n.length}function i(n){for(var t=1;n*t%1;)t*=10;return t}function o(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function a(){this._=Object.create(null)}function c(n){return(n+="")===da||n[0]===ma?ma+n:n}function l(n){return(n+="")[0]===ma?n.slice(1):n}function s(n){return c(n)in this._}function f(n){return(n=c(n))in this._&&delete this._[n]}function h(){var n=[];for(var t in this._)n.push(l(t));return n}function g(){var n=0;for(var t in this._)++n;return n}function p(){for(var n in this._)return!1;return!0}function v(){this._=Object.create(null)}function d(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function m(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=ya.length;r>e;++e){var u=ya[e]+t;if(u in n)return u}}function y(){}function M(){}function x(n){function t(){for(var t,r=e,u=-1,i=r.length;++u<i;)(t=r[u].on)&&t.apply(this,arguments);return n}var e=[],r=new a;return t.on=function(t,u){var i,o=r.get(t);return arguments.length<2?o&&o.on:(o&&(o.on=null,e=e.slice(0,i=e.indexOf(o)).concat(e.slice(i+1)),r.remove(t)),u&&e.push(r.set(t,{on:u})),n)},t}function b(){ta.event.preventDefault()}function _(){for(var n,t=ta.event;n=t.sourceEvent;)t=n;return t}function w(n){for(var t=new M,e=0,r=arguments.length;++e<r;)t[arguments[e]]=x(t);return t.of=function(e,r){return function(u){try{var i=u.sourceEvent=ta.event;u.target=n,ta.event=u,t[u.type].apply(e,r)}finally{ta.event=i}}},t}function S(n){return xa(n,ka),n}function k(n){return"function"==typeof n?n:function(){return ba(n,this)}}function E(n){return"function"==typeof n?n:function(){return _a(n,this)}}function A(n,t){function e(){this.removeAttribute(n)}function r(){this.removeAttributeNS(n.space,n.local)}function u(){this.setAttribute(n,t)}function i(){this.setAttributeNS(n.space,n.local,t)}function o(){var e=t.apply(this,arguments);null==e?this.removeAttribute(n):this.setAttribute(n,e)}function a(){var e=t.apply(this,arguments);null==e?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}return n=ta.ns.qualify(n),null==t?n.local?r:e:"function"==typeof t?n.local?a:o:n.local?i:u}function N(n){return n.trim().replace(/\s+/g," ")}function C(n){return new RegExp("(?:^|\\s+)"+ta.requote(n)+"(?:\\s+|$)","g")}function z(n){return(n+"").trim().split(/^|\s+/)}function q(n,t){function e(){for(var e=-1;++e<u;)n[e](this,t)}function r(){for(var e=-1,r=t.apply(this,arguments);++e<u;)n[e](this,r)}n=z(n).map(L);var u=n.length;return"function"==typeof t?r:e}function L(n){var t=C(n);return function(e,r){if(u=e.classList)return r?u.add(n):u.remove(n);var u=e.getAttribute("class")||"";r?(t.lastIndex=0,t.test(u)||e.setAttribute("class",N(u+" "+n))):e.setAttribute("class",N(u.replace(t," ")))}}function T(n,t,e){function r(){this.style.removeProperty(n)}function u(){this.style.setProperty(n,t,e)}function i(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,e)}return null==t?r:"function"==typeof t?i:u}function R(n,t){function e(){delete this[n]}function r(){this[n]=t}function u(){var e=t.apply(this,arguments);null==e?delete this[n]:this[n]=e}return null==t?e:"function"==typeof t?u:r}function D(n){return"function"==typeof n?n:(n=ta.ns.qualify(n)).local?function(){return this.ownerDocument.createElementNS(n.space,n.local)}:function(){return this.ownerDocument.createElementNS(this.namespaceURI,n)}}function P(){var n=this.parentNode;n&&n.removeChild(this)}function U(n){return{__data__:n}}function j(n){return function(){return Sa(this,n)}}function F(t){return arguments.length||(t=n),function(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}}function H(n,t){for(var e=0,r=n.length;r>e;e++)for(var u,i=n[e],o=0,a=i.length;a>o;o++)(u=i[o])&&t(u,o,e);return n}function O(n){return xa(n,Aa),n}function Y(n){var t,e;return function(r,u,i){var o,a=n[i].update,c=a.length;for(i!=e&&(e=i,t=0),u>=t&&(t=u+1);!(o=a[t])&&++t<c;);return o}}function I(n){var t=n.__transition__;t&&++t.active}function Z(n,t,e){function r(){var t=this[o];t&&(this.removeEventListener(n,t,t.$),delete this[o])}function u(){var u=c(t,ra(arguments));r.call(this),this.addEventListener(n,this[o]=u,u.$=e),u._=t}function i(){var t,e=new RegExp("^__on([^.]+)"+ta.requote(n)+"$");for(var r in this)if(t=r.match(e)){var u=this[r];this.removeEventListener(t[1],u,u.$),delete this[r]}}var o="__on"+n,a=n.indexOf("."),c=V;a>0&&(n=n.slice(0,a));var l=Ca.get(n);return l&&(n=l,c=X),a?t?u:r:t?y:i}function V(n,t){return function(e){var r=ta.event;ta.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{ta.event=r}}}function X(n,t){var e=V(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function $(){var n=".dragsuppress-"+ ++qa,t="click"+n,e=ta.select(oa).on("touchmove"+n,b).on("dragstart"+n,b).on("selectstart"+n,b);if(za){var r=ia.style,u=r[za];r[za]="none"}return function(i){if(e.on(n,null),za&&(r[za]=u),i){var o=function(){e.on(t,null)};e.on(t,function(){b(),o()},!0),setTimeout(o,0)}}}function B(n,t){t.changedTouches&&(t=t.changedTouches[0]);var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>La&&(oa.scrollX||oa.scrollY)){e=ta.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e[0][0].getScreenCTM();La=!(u.f||u.e),e.remove()}return La?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}function W(){return ta.event.changedTouches[0].identifier}function J(){return ta.event.target}function G(){return oa}function K(n){return n>0?1:0>n?-1:0}function Q(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function nt(n){return n>1?0:-1>n?Da:Math.acos(n)}function tt(n){return n>1?ja:-1>n?-ja:Math.asin(n)}function et(n){return((n=Math.exp(n))-1/n)/2}function rt(n){return((n=Math.exp(n))+1/n)/2}function ut(n){return((n=Math.exp(2*n))-1)/(n+1)}function it(n){return(n=Math.sin(n/2))*n}function ot(){}function at(n,t,e){return this instanceof at?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof at?new at(n.h,n.s,n.l):bt(""+n,_t,at):new at(n,t,e)}function ct(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?i+(o-i)*n/60:180>n?o:240>n?i+(o-i)*(240-n)/60:i}function u(n){return Math.round(255*r(n))}var i,o;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,i=2*e-o,new mt(u(n+120),u(n),u(n-120))}function lt(n,t,e){return this instanceof lt?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof lt?new lt(n.h,n.c,n.l):n instanceof ft?gt(n.l,n.a,n.b):gt((n=wt((n=ta.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new lt(n,t,e)}function st(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new ft(e,Math.cos(n*=Fa)*t,Math.sin(n)*t)}function ft(n,t,e){return this instanceof ft?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof ft?new ft(n.l,n.a,n.b):n instanceof lt?st(n.h,n.c,n.l):wt((n=mt(n)).r,n.g,n.b):new ft(n,t,e)}function ht(n,t,e){var r=(n+16)/116,u=r+t/500,i=r-e/200;return u=pt(u)*Ja,r=pt(r)*Ga,i=pt(i)*Ka,new mt(dt(3.2404542*u-1.5371385*r-.4985314*i),dt(-.969266*u+1.8760108*r+.041556*i),dt(.0556434*u-.2040259*r+1.0572252*i))}function gt(n,t,e){return n>0?new lt(Math.atan2(e,t)*Ha,Math.sqrt(t*t+e*e),n):new lt(0/0,0/0,n)}function pt(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function vt(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function dt(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function mt(n,t,e){return this instanceof mt?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof mt?new mt(n.r,n.g,n.b):bt(""+n,mt,ct):new mt(n,t,e)}function yt(n){return new mt(n>>16,255&n>>8,255&n)}function Mt(n){return yt(n)+""}function xt(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function bt(n,t,e){var r,u,i,o=0,a=0,c=0;if(r=/([a-z]+)\((.*)\)/i.exec(n))switch(u=r[2].split(","),r[1]){case"hsl":return e(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(kt(u[0]),kt(u[1]),kt(u[2]))}return(i=tc.get(n))?t(i.r,i.g,i.b):(null==n||"#"!==n.charAt(0)||isNaN(i=parseInt(n.slice(1),16))||(4===n.length?(o=(3840&i)>>4,o=o>>4|o,a=240&i,a=a>>4|a,c=15&i,c=c<<4|c):7===n.length&&(o=(16711680&i)>>16,a=(65280&i)>>8,c=255&i)),t(o,a,c))}function _t(n,t,e){var r,u,i=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-i,c=(o+i)/2;return a?(u=.5>c?a/(o+i):a/(2-o-i),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=0/0,u=c>0&&1>c?0:r),new at(r,u,c)}function wt(n,t,e){n=St(n),t=St(t),e=St(e);var r=vt((.4124564*n+.3575761*t+.1804375*e)/Ja),u=vt((.2126729*n+.7151522*t+.072175*e)/Ga),i=vt((.0193339*n+.119192*t+.9503041*e)/Ka);return ft(116*u-16,500*(r-u),200*(u-i))}function St(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function kt(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function Et(n){return"function"==typeof n?n:function(){return n}}function At(n){return n}function Nt(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Ct(t,e,n,r)}}function Ct(n,t,e,r){function u(){var n,t=c.status;if(!t&&qt(c)||t>=200&&300>t||304===t){try{n=e.call(i,c)}catch(r){return o.error.call(i,r),void 0}o.load.call(i,n)}else o.error.call(i,c)}var i={},o=ta.dispatch("beforesend","progress","load","error"),a={},c=new XMLHttpRequest,l=null;return!oa.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=u:c.onreadystatechange=function(){c.readyState>3&&u()},c.onprogress=function(n){var t=ta.event;ta.event=n;try{o.progress.call(i,c)}finally{ta.event=t}},i.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",i)},i.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",i):t},i.responseType=function(n){return arguments.length?(l=n,i):l},i.response=function(n){return e=n,i},["get","post"].forEach(function(n){i[n]=function(){return i.send.apply(i,[n].concat(ra(arguments)))}}),i.send=function(e,r,u){if(2===arguments.length&&"function"==typeof r&&(u=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var s in a)c.setRequestHeader(s,a[s]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=u&&i.on("error",u).on("load",function(n){u(null,n)}),o.beforesend.call(i,c),c.send(null==r?null:r),i},i.abort=function(){return c.abort(),i},ta.rebind(i,o,"on"),null==r?i:i.get(zt(r))}function zt(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function qt(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function Lt(){var n=Tt(),t=Rt()-n;t>24?(isFinite(t)&&(clearTimeout(ic),ic=setTimeout(Lt,t)),uc=0):(uc=1,ac(Lt))}function Tt(){var n=Date.now();for(oc=ec;oc;)n>=oc.t&&(oc.f=oc.c(n-oc.t)),oc=oc.n;return n}function Rt(){for(var n,t=ec,e=1/0;t;)t.f?t=n?n.n=t.n:ec=t.n:(t.t<e&&(e=t.t),t=(n=t).n);return rc=n,e}function Dt(n,t){return t-(n?Math.ceil(Math.log(n)/Math.LN10):1)}function Pt(n,t){var e=Math.pow(10,3*va(8-t));return{scale:t>8?function(n){return n/e}:function(n){return n*e},symbol:n}}function Ut(n){var t=n.decimal,e=n.thousands,r=n.grouping,u=n.currency,i=r&&e?function(n,t){for(var u=n.length,i=[],o=0,a=r[0],c=0;u>0&&a>0&&(c+a+1>t&&(a=Math.max(1,t-c)),i.push(n.substring(u-=a,u+a)),!((c+=a+1)>t));)a=r[o=(o+1)%r.length];return i.reverse().join(e)}:At;return function(n){var e=lc.exec(n),r=e[1]||" ",o=e[2]||">",a=e[3]||"-",c=e[4]||"",l=e[5],s=+e[6],f=e[7],h=e[8],g=e[9],p=1,v="",d="",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(l||"0"===r&&"="===o)&&(l=r="0",o="="),g){case"n":f=!0,g="g";break;case"%":p=100,d="%",g="f";break;case"p":p=100,d="%",g="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+g.toLowerCase());case"c":y=!1;case"d":m=!0,h=0;break;case"s":p=-1,g="r"}"$"===c&&(v=u[0],d=u[1]),"r"!=g||h||(g="g"),null!=h&&("g"==g?h=Math.max(1,Math.min(21,h)):("e"==g||"f"==g)&&(h=Math.max(0,Math.min(20,h)))),g=sc.get(g)||jt;var M=l&&f;return function(n){var e=d;if(m&&n%1)return"";var u=0>n||0===n&&0>1/n?(n=-n,"-"):"-"===a?"":a;if(0>p){var c=ta.formatPrefix(n,h);n=c.scale(n),e=c.symbol+d}else n*=p;n=g(n,h);var x,b,_=n.lastIndexOf(".");if(0>_){var w=y?n.lastIndexOf("e"):-1;0>w?(x=n,b=""):(x=n.substring(0,w),b=n.substring(w))}else x=n.substring(0,_),b=t+n.substring(_+1);!l&&f&&(x=i(x,1/0));var S=v.length+x.length+b.length+(M?0:u.length),k=s>S?new Array(S=s-S+1).join(r):"";return M&&(x=i(k+x,k.length?s-b.length:1/0)),u+=v,n=x+b,("<"===o?u+n+k:">"===o?k+u+n:"^"===o?k.substring(0,S>>=1)+u+n+k.substring(S):u+(M?n:k+n))+e}}}function jt(n){return n+""}function Ft(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(n,t,e){function r(t){var e=n(t),r=i(e,1);return r-t>t-e?e:r}function u(e){return t(e=n(new hc(e-1)),1),e}function i(n,e){return t(n=new hc(+n),e),n}function o(n,r,i){var o=u(n),a=[];if(i>1)for(;r>o;)e(o)%i||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{hc=Ft;var r=new Ft;return r._=n,o(r,t,e)}finally{hc=Date}}n.floor=n,n.round=r,n.ceil=u,n.offset=i,n.range=o;var c=n.utc=Ot(n);return c.floor=c,c.round=Ot(r),c.ceil=Ot(u),c.offset=Ot(i),c.range=a,n}function Ot(n){return function(t,e){try{hc=Ft;var r=new Ft;return r._=t,n(r,e)._}finally{hc=Date}}}function Yt(n){function t(n){function t(t){for(var e,u,i,o=[],a=-1,c=0;++a<r;)37===n.charCodeAt(a)&&(o.push(n.slice(c,a)),null!=(u=pc[e=n.charAt(++a)])&&(e=n.charAt(++a)),(i=N[e])&&(e=i(t,null==u?"e"===e?" ":"0":u)),o.push(e),c=a+1);return o.push(n.slice(c,a)),o.join("")}var r=n.length;return t.parse=function(t){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},u=e(r,n,t,0);if(u!=t.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var i=null!=r.Z&&hc!==Ft,o=new(i?Ft:hc);return"j"in r?o.setFullYear(r.y,0,r.j):"w"in r&&("W"in r||"U"in r)?(o.setFullYear(r.y,0,1),o.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(o.getDay()+5)%7:r.w+7*r.U-(o.getDay()+6)%7)):o.setFullYear(r.y,r.m,r.d),o.setHours(r.H+(0|r.Z/100),r.M+r.Z%100,r.S,r.L),i?o._:o},t.toString=function(){return n},t}function e(n,t,e,r){for(var u,i,o,a=0,c=t.length,l=e.length;c>a;){if(r>=l)return-1;if(u=t.charCodeAt(a++),37===u){if(o=t.charAt(a++),i=C[o in pc?t.charAt(a++):o],!i||(r=i(n,e,r))<0)return-1}else if(u!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){_.lastIndex=0;var r=_.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){x.lastIndex=0;var r=x.exec(t.slice(e));return r?(n.w=b.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){E.lastIndex=0;var r=E.exec(t.slice(e));return r?(n.m=A.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.slice(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,N.c.toString(),t,r)}function c(n,t,r){return e(n,N.x.toString(),t,r)}function l(n,t,r){return e(n,N.X.toString(),t,r)}function s(n,t,e){var r=M.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,g=n.time,p=n.periods,v=n.days,d=n.shortDays,m=n.months,y=n.shortMonths;t.utc=function(n){function e(n){try{hc=Ft;var t=new hc;return t._=n,r(t)}finally{hc=Date}}var r=t(n);return e.parse=function(n){try{hc=Ft;var t=r.parse(n);return t&&t._}finally{hc=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ce;var M=ta.map(),x=Zt(v),b=Vt(v),_=Zt(d),w=Vt(d),S=Zt(m),k=Vt(m),E=Zt(y),A=Vt(y);p.forEach(function(n,t){M.set(n.toLowerCase(),t)});var N={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return y[n.getMonth()]},B:function(n){return m[n.getMonth()]},c:t(f),d:function(n,t){return It(n.getDate(),t,2)},e:function(n,t){return It(n.getDate(),t,2)},H:function(n,t){return It(n.getHours(),t,2)},I:function(n,t){return It(n.getHours()%12||12,t,2)},j:function(n,t){return It(1+fc.dayOfYear(n),t,3)},L:function(n,t){return It(n.getMilliseconds(),t,3)},m:function(n,t){return It(n.getMonth()+1,t,2)},M:function(n,t){return It(n.getMinutes(),t,2)},p:function(n){return p[+(n.getHours()>=12)]},S:function(n,t){return It(n.getSeconds(),t,2)},U:function(n,t){return It(fc.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return It(fc.mondayOfYear(n),t,2)},x:t(h),X:t(g),y:function(n,t){return It(n.getFullYear()%100,t,2)},Y:function(n,t){return It(n.getFullYear()%1e4,t,4)},Z:oe,"%":function(){return"%"}},C={a:r,A:u,b:i,B:o,c:a,d:ne,e:ne,H:ee,I:ee,j:te,L:ie,m:Qt,M:re,p:s,S:ue,U:$t,w:Xt,W:Bt,x:c,X:l,y:Jt,Y:Wt,Z:Gt,"%":ae};return t}function It(n,t,e){var r=0>n?"-":"",u=(r?-n:n)+"",i=u.length;return r+(e>i?new Array(e-i+1).join(t)+u:u)}function Zt(n){return new RegExp("^(?:"+n.map(ta.requote).join("|")+")","i")}function Vt(n){for(var t=new a,e=-1,r=n.length;++e<r;)t.set(n[e].toLowerCase(),e);return t}function Xt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+1));return r?(n.w=+r[0],e+r[0].length):-1}function $t(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e));return r?(n.U=+r[0],e+r[0].length):-1}function Bt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e));return r?(n.W=+r[0],e+r[0].length):-1}function Wt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+4));return r?(n.y=+r[0],e+r[0].length):-1}function Jt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.y=Kt(+r[0]),e+r[0].length):-1}function Gt(n,t,e){return/^[+-]\d{4}$/.test(t=t.slice(e,e+5))?(n.Z=-t,e+5):-1}function Kt(n){return n+(n>68?1900:2e3)}function Qt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function ne(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function te(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function ee(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function re(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function ue(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ie(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function oe(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=0|va(t)/60,u=va(t)%60;return e+It(r,"0",2)+It(u,"0",2)}function ae(n,t,e){dc.lastIndex=0;var r=dc.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ce(n){for(var t=n.length,e=-1;++e<t;)n[e][0]=this(n[e][0]);return function(t){for(var e=0,r=n[e];!r[1](t);)r=n[++e];return r[0](t)}}function le(){}function se(n,t,e){var r=e.s=n+t,u=r-n,i=r-u;e.t=n-i+(t-u)}function fe(n,t){n&&xc.hasOwnProperty(n.type)&&xc[n.type](n,t)}function he(n,t,e){var r,u=-1,i=n.length-e;for(t.lineStart();++u<i;)r=n[u],t.point(r[0],r[1],r[2]);t.lineEnd()}function ge(n,t){var e=-1,r=n.length;for(t.polygonStart();++e<r;)he(n[e],t,1);t.polygonEnd()}function pe(){function n(n,t){n*=Fa,t=t*Fa/2+Da/4;var e=n-r,o=e>=0?1:-1,a=o*e,c=Math.cos(t),l=Math.sin(t),s=i*l,f=u*c+s*Math.cos(a),h=s*o*Math.sin(a);_c.add(Math.atan2(h,f)),r=n,u=c,i=l}var t,e,r,u,i;wc.point=function(o,a){wc.point=n,r=(t=o)*Fa,u=Math.cos(a=(e=a)*Fa/2+Da/4),i=Math.sin(a)},wc.lineEnd=function(){n(t,e)}}function ve(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function de(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function me(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function ye(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function Me(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function xe(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function be(n){return[Math.atan2(n[1],n[0]),tt(n[2])]}function _e(n,t){return va(n[0]-t[0])<Ta&&va(n[1]-t[1])<Ta}function we(n,t){n*=Fa;var e=Math.cos(t*=Fa);Se(e*Math.cos(n),e*Math.sin(n),Math.sin(t))}function Se(n,t,e){++Sc,Ec+=(n-Ec)/Sc,Ac+=(t-Ac)/Sc,Nc+=(e-Nc)/Sc}function ke(){function n(n,u){n*=Fa;var i=Math.cos(u*=Fa),o=i*Math.cos(n),a=i*Math.sin(n),c=Math.sin(u),l=Math.atan2(Math.sqrt((l=e*c-r*a)*l+(l=r*o-t*c)*l+(l=t*a-e*o)*l),t*o+e*a+r*c);kc+=l,Cc+=l*(t+(t=o)),zc+=l*(e+(e=a)),qc+=l*(r+(r=c)),Se(t,e,r)}var t,e,r;Dc.point=function(u,i){u*=Fa;var o=Math.cos(i*=Fa);t=o*Math.cos(u),e=o*Math.sin(u),r=Math.sin(i),Dc.point=n,Se(t,e,r)}}function Ee(){Dc.point=we}function Ae(){function n(n,t){n*=Fa;var e=Math.cos(t*=Fa),o=e*Math.cos(n),a=e*Math.sin(n),c=Math.sin(t),l=u*c-i*a,s=i*o-r*c,f=r*a-u*o,h=Math.sqrt(l*l+s*s+f*f),g=r*o+u*a+i*c,p=h&&-nt(g)/h,v=Math.atan2(h,g);Lc+=p*l,Tc+=p*s,Rc+=p*f,kc+=v,Cc+=v*(r+(r=o)),zc+=v*(u+(u=a)),qc+=v*(i+(i=c)),Se(r,u,i)}var t,e,r,u,i;Dc.point=function(o,a){t=o,e=a,Dc.point=n,o*=Fa;var c=Math.cos(a*=Fa);r=c*Math.cos(o),u=c*Math.sin(o),i=Math.sin(a),Se(r,u,i)},Dc.lineEnd=function(){n(t,e),Dc.lineEnd=Ee,Dc.point=we}}function Ne(n,t){function e(e,r){return e=n(e,r),t(e[0],e[1])}return n.invert&&t.invert&&(e.invert=function(e,r){return e=t.invert(e,r),e&&n.invert(e[0],e[1])}),e}function Ce(){return!0}function ze(n,t,e,r,u){var i=[],o=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,e=n[0],r=n[t];if(_e(e,r)){u.lineStart();for(var a=0;t>a;++a)u.point((e=n[a])[0],e[1]);return u.lineEnd(),void 0}var c=new Le(e,n,null,!0),l=new Le(e,null,c,!1);c.o=l,i.push(c),o.push(l),c=new Le(r,n,null,!1),l=new Le(r,null,c,!0),c.o=l,i.push(c),o.push(l)}}),o.sort(t),qe(i),qe(o),i.length){for(var a=0,c=e,l=o.length;l>a;++a)o[a].e=c=!c;for(var s,f,h=i[0];;){for(var g=h,p=!0;g.v;)if((g=g.n)===h)return;s=g.z,u.lineStart();do{if(g.v=g.o.v=!0,g.e){if(p)for(var a=0,l=s.length;l>a;++a)u.point((f=s[a])[0],f[1]);else r(g.x,g.n.x,1,u);g=g.n}else{if(p){s=g.p.z;for(var a=s.length-1;a>=0;--a)u.point((f=s[a])[0],f[1])}else r(g.x,g.p.x,-1,u);g=g.p}g=g.o,s=g.z,p=!p}while(!g.v);u.lineEnd()}}}function qe(n){if(t=n.length){for(var t,e,r=0,u=n[0];++r<t;)u.n=e=n[r],e.p=u,u=e;u.n=e=n[0],e.p=u}}function Le(n,t,e,r){this.x=n,this.z=t,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function Te(n,t,e,r){return function(u,i){function o(t,e){var r=u(t,e);n(t=r[0],e=r[1])&&i.point(t,e)}function a(n,t){var e=u(n,t);d.point(e[0],e[1])}function c(){y.point=a,d.lineStart()}function l(){y.point=o,d.lineEnd()}function s(n,t){v.push([n,t]);var e=u(n,t);x.point(e[0],e[1])}function f(){x.lineStart(),v=[]}function h(){s(v[0][0],v[0][1]),x.lineEnd();var n,t=x.clean(),e=M.buffer(),r=e.length;if(v.pop(),p.push(v),v=null,r)if(1&t){n=e[0];var u,r=n.length-1,o=-1;if(r>0){for(b||(i.polygonStart(),b=!0),i.lineStart();++o<r;)i.point((u=n[o])[0],u[1]);i.lineEnd()}}else r>1&&2&t&&e.push(e.pop().concat(e.shift())),g.push(e.filter(Re))}var g,p,v,d=t(i),m=u.invert(r[0],r[1]),y={point:o,lineStart:c,lineEnd:l,polygonStart:function(){y.point=s,y.lineStart=f,y.lineEnd=h,g=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=c,y.lineEnd=l,g=ta.merge(g);var n=He(m,p);g.length?(b||(i.polygonStart(),b=!0),ze(g,Pe,n,e,i)):n&&(b||(i.polygonStart(),b=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),g=p=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}},M=De(),x=t(M),b=!1;return y}}function Re(n){return n.length>1}function De(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:y,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Pe(n,t){return((n=n.x)[0]<0?n[1]-ja-Ta:ja-n[1])-((t=t.x)[0]<0?t[1]-ja-Ta:ja-t[1])}function Ue(n){var t,e=0/0,r=0/0,u=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(i,o){var a=i>0?Da:-Da,c=va(i-e);va(c-Da)<Ta?(n.point(e,r=(r+o)/2>0?ja:-ja),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(i,r),t=0):u!==a&&c>=Da&&(va(e-u)<Ta&&(e-=u*Ta),va(i-a)<Ta&&(i-=a*Ta),r=je(e,r,i,o),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),t=0),n.point(e=i,r=o),u=a},lineEnd:function(){n.lineEnd(),e=r=0/0},clean:function(){return 2-t}}}function je(n,t,e,r){var u,i,o=Math.sin(n-e);return va(o)>Ta?Math.atan((Math.sin(t)*(i=Math.cos(r))*Math.sin(e)-Math.sin(r)*(u=Math.cos(t))*Math.sin(n))/(u*i*o)):(t+r)/2}function Fe(n,t,e,r){var u;if(null==n)u=e*ja,r.point(-Da,u),r.point(0,u),r.point(Da,u),r.point(Da,0),r.point(Da,-u),r.point(0,-u),r.point(-Da,-u),r.point(-Da,0),r.point(-Da,u);else if(va(n[0]-t[0])>Ta){var i=n[0]<t[0]?Da:-Da;u=e*i/2,r.point(-i,u),r.point(0,u),r.point(i,u)}else r.point(t[0],t[1])}function He(n,t){var e=n[0],r=n[1],u=[Math.sin(e),-Math.cos(e),0],i=0,o=0;_c.reset();for(var a=0,c=t.length;c>a;++a){var l=t[a],s=l.length;if(s)for(var f=l[0],h=f[0],g=f[1]/2+Da/4,p=Math.sin(g),v=Math.cos(g),d=1;;){d===s&&(d=0),n=l[d];var m=n[0],y=n[1]/2+Da/4,M=Math.sin(y),x=Math.cos(y),b=m-h,_=b>=0?1:-1,w=_*b,S=w>Da,k=p*M;if(_c.add(Math.atan2(k*_*Math.sin(w),v*x+k*Math.cos(w))),i+=S?b+_*Pa:b,S^h>=e^m>=e){var E=me(ve(f),ve(n));xe(E);var A=me(u,E);xe(A);var N=(S^b>=0?-1:1)*tt(A[2]);(r>N||r===N&&(E[0]||E[1]))&&(o+=S^b>=0?1:-1)}if(!d++)break;h=m,p=M,v=x,f=n}}return(-Ta>i||Ta>i&&0>_c)^1&o}function Oe(n){function t(n,t){return Math.cos(n)*Math.cos(t)>i}function e(n){var e,i,c,l,s;return{lineStart:function(){l=c=!1,s=1},point:function(f,h){var g,p=[f,h],v=t(f,h),d=o?v?0:u(f,h):v?u(f+(0>f?Da:-Da),h):0;if(!e&&(l=c=v)&&n.lineStart(),v!==c&&(g=r(e,p),(_e(e,g)||_e(p,g))&&(p[0]+=Ta,p[1]+=Ta,v=t(p[0],p[1]))),v!==c)s=0,v?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(a&&e&&o^v){var m;d&i||!(m=r(p,e,!0))||(s=0,o?(n.lineStart(),n.point(m[0][0],m[0][1]),n.point(m[1][0],m[1][1]),n.lineEnd()):(n.point(m[1][0],m[1][1]),n.lineEnd(),n.lineStart(),n.point(m[0][0],m[0][1])))}!v||e&&_e(e,p)||n.point(p[0],p[1]),e=p,c=v,i=d},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return s|(l&&c)<<1}}}function r(n,t,e){var r=ve(n),u=ve(t),o=[1,0,0],a=me(r,u),c=de(a,a),l=a[0],s=c-l*l;if(!s)return!e&&n;var f=i*c/s,h=-i*l/s,g=me(o,a),p=Me(o,f),v=Me(a,h);ye(p,v);var d=g,m=de(p,d),y=de(d,d),M=m*m-y*(de(p,p)-1);if(!(0>M)){var x=Math.sqrt(M),b=Me(d,(-m-x)/y);if(ye(b,p),b=be(b),!e)return b;var _,w=n[0],S=t[0],k=n[1],E=t[1];w>S&&(_=w,w=S,S=_);var A=S-w,N=va(A-Da)<Ta,C=N||Ta>A;if(!N&&k>E&&(_=k,k=E,E=_),C?N?k+E>0^b[1]<(va(b[0]-w)<Ta?k:E):k<=b[1]&&b[1]<=E:A>Da^(w<=b[0]&&b[0]<=S)){var z=Me(d,(-m+x)/y);return ye(z,p),[b,be(z)]}}}function u(t,e){var r=o?n:Da-n,u=0;return-r>t?u|=1:t>r&&(u|=2),-r>e?u|=4:e>r&&(u|=8),u}var i=Math.cos(n),o=i>0,a=va(i)>Ta,c=pr(n,6*Fa);return Te(t,e,c,o?[0,-n]:[-Da,n-Da])}function Ye(n,t,e,r){return function(u){var i,o=u.a,a=u.b,c=o.x,l=o.y,s=a.x,f=a.y,h=0,g=1,p=s-c,v=f-l;if(i=n-c,p||!(i>0)){if(i/=p,0>p){if(h>i)return;g>i&&(g=i)}else if(p>0){if(i>g)return;i>h&&(h=i)}if(i=e-c,p||!(0>i)){if(i/=p,0>p){if(i>g)return;i>h&&(h=i)}else if(p>0){if(h>i)return;g>i&&(g=i)}if(i=t-l,v||!(i>0)){if(i/=v,0>v){if(h>i)return;g>i&&(g=i)}else if(v>0){if(i>g)return;i>h&&(h=i)}if(i=r-l,v||!(0>i)){if(i/=v,0>v){if(i>g)return;i>h&&(h=i)}else if(v>0){if(h>i)return;g>i&&(g=i)}return h>0&&(u.a={x:c+h*p,y:l+h*v}),1>g&&(u.b={x:c+g*p,y:l+g*v}),u}}}}}}function Ie(n,t,e,r){function u(r,u){return va(r[0]-n)<Ta?u>0?0:3:va(r[0]-e)<Ta?u>0?2:1:va(r[1]-t)<Ta?u>0?1:0:u>0?3:2}function i(n,t){return o(n.x,t.x)}function o(n,t){var e=u(n,1),r=u(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function c(n){for(var t=0,e=d.length,r=n[1],u=0;e>u;++u)for(var i,o=1,a=d[u],c=a.length,l=a[0];c>o;++o)i=a[o],l[1]<=r?i[1]>r&&Q(l,i,n)>0&&++t:i[1]<=r&&Q(l,i,n)<0&&--t,l=i;return 0!==t}function l(i,a,c,l){var s=0,f=0;if(null==i||(s=u(i,c))!==(f=u(a,c))||o(i,a)<0^c>0){do l.point(0===s||3===s?n:e,s>1?r:t);while((s=(s+c+4)%4)!==f)}else l.point(a[0],a[1])}function s(u,i){return u>=n&&e>=u&&i>=t&&r>=i}function f(n,t){s(n,t)&&a.point(n,t)}function h(){C.point=p,d&&d.push(m=[]),S=!0,w=!1,b=_=0/0}function g(){v&&(p(y,M),x&&w&&A.rejoin(),v.push(A.buffer())),C.point=f,w&&a.lineEnd()}function p(n,t){n=Math.max(-Uc,Math.min(Uc,n)),t=Math.max(-Uc,Math.min(Uc,t));var e=s(n,t);if(d&&m.push([n,t]),S)y=n,M=t,x=e,S=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&w)a.point(n,t);else{var r={a:{x:b,y:_},b:{x:n,y:t}};N(r)?(w||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),k=!1):e&&(a.lineStart(),a.point(n,t),k=!1)}b=n,_=t,w=e}var v,d,m,y,M,x,b,_,w,S,k,E=a,A=De(),N=Ye(n,t,e,r),C={point:f,lineStart:h,lineEnd:g,polygonStart:function(){a=A,v=[],d=[],k=!0},polygonEnd:function(){a=E,v=ta.merge(v);var t=c([n,r]),e=k&&t,u=v.length;(e||u)&&(a.polygonStart(),e&&(a.lineStart(),l(null,null,1,a),a.lineEnd()),u&&ze(v,i,t,l,a),a.polygonEnd()),v=d=m=null}};return C}}function Ze(n){var t=0,e=Da/3,r=or(n),u=r(t,e);return u.parallels=function(n){return arguments.length?r(t=n[0]*Da/180,e=n[1]*Da/180):[180*(t/Da),180*(e/Da)]},u}function Ve(n,t){function e(n,t){var e=Math.sqrt(i-2*u*Math.sin(t))/u;return[e*Math.sin(n*=u),o-e*Math.cos(n)]}var r=Math.sin(n),u=(r+Math.sin(t))/2,i=1+r*(2*u-r),o=Math.sqrt(i)/u;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/u,tt((i-(n*n+e*e)*u*u)/(2*u))]},e}function Xe(){function n(n,t){Fc+=u*n-r*t,r=n,u=t}var t,e,r,u;Zc.point=function(i,o){Zc.point=n,t=r=i,e=u=o},Zc.lineEnd=function(){n(t,e)}}function $e(n,t){Hc>n&&(Hc=n),n>Yc&&(Yc=n),Oc>t&&(Oc=t),t>Ic&&(Ic=t)}function Be(){function n(n,t){o.push("M",n,",",t,i)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function u(){o.push("Z")}var i=We(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return i=We(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function We(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Je(n,t){Ec+=n,Ac+=t,++Nc}function Ge(){function n(n,r){var u=n-t,i=r-e,o=Math.sqrt(u*u+i*i);Cc+=o*(t+n)/2,zc+=o*(e+r)/2,qc+=o,Je(t=n,e=r)}var t,e;Xc.point=function(r,u){Xc.point=n,Je(t=r,e=u)}}function Ke(){Xc.point=Je}function Qe(){function n(n,t){var e=n-r,i=t-u,o=Math.sqrt(e*e+i*i);Cc+=o*(r+n)/2,zc+=o*(u+t)/2,qc+=o,o=u*n-r*t,Lc+=o*(r+n),Tc+=o*(u+t),Rc+=3*o,Je(r=n,u=t)}var t,e,r,u;Xc.point=function(i,o){Xc.point=n,Je(t=r=i,e=u=o)},Xc.lineEnd=function(){n(t,e)}}function nr(n){function t(t,e){n.moveTo(t+o,e),n.arc(t,e,o,0,Pa)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function u(){a.point=t}function i(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:u,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=u,a.point=t},pointRadius:function(n){return o=n,a},result:y};return a}function tr(n){function t(n){return(a?r:e)(n)}function e(t){return ur(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){M=0/0,S.point=i,t.lineStart()}function i(e,r){var i=ve([e,r]),o=n(e,r);u(M,x,y,b,_,w,M=o[0],x=o[1],y=e,b=i[0],_=i[1],w=i[2],a,t),t.point(M,x)}function o(){S.point=e,t.lineEnd()}function c(){r(),S.point=l,S.lineEnd=s}function l(n,t){i(f=n,h=t),g=M,p=x,v=b,d=_,m=w,S.point=i}function s(){u(M,x,y,b,_,w,g,p,f,v,d,m,a,t),S.lineEnd=o,o()}var f,h,g,p,v,d,m,y,M,x,b,_,w,S={point:e,lineStart:r,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=c},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function u(t,e,r,a,c,l,s,f,h,g,p,v,d,m){var y=s-t,M=f-e,x=y*y+M*M;if(x>4*i&&d--){var b=a+g,_=c+p,w=l+v,S=Math.sqrt(b*b+_*_+w*w),k=Math.asin(w/=S),E=va(va(w)-1)<Ta||va(r-h)<Ta?(r+h)/2:Math.atan2(_,b),A=n(E,k),N=A[0],C=A[1],z=N-t,q=C-e,L=M*z-y*q;
+(L*L/x>i||va((y*z+M*q)/x-.5)>.3||o>a*g+c*p+l*v)&&(u(t,e,r,a,c,l,N,C,E,b/=S,_/=S,w,d,m),m.point(N,C),u(N,C,E,b,_,w,s,f,h,g,p,v,d,m))}}var i=.5,o=Math.cos(30*Fa),a=16;return t.precision=function(n){return arguments.length?(a=(i=n*n)>0&&16,t):Math.sqrt(i)},t}function er(n){var t=tr(function(t,e){return n([t*Ha,e*Ha])});return function(n){return ar(t(n))}}function rr(n){this.stream=n}function ur(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ir(n){return or(function(){return n})()}function or(n){function t(n){return n=a(n[0]*Fa,n[1]*Fa),[n[0]*h+c,l-n[1]*h]}function e(n){return n=a.invert((n[0]-c)/h,(l-n[1])/h),n&&[n[0]*Ha,n[1]*Ha]}function r(){a=Ne(o=sr(m,y,M),i);var n=i(v,d);return c=g-n[0]*h,l=p+n[1]*h,u()}function u(){return s&&(s.valid=!1,s=null),t}var i,o,a,c,l,s,f=tr(function(n,t){return n=i(n,t),[n[0]*h+c,l-n[1]*h]}),h=150,g=480,p=250,v=0,d=0,m=0,y=0,M=0,x=Pc,b=At,_=null,w=null;return t.stream=function(n){return s&&(s.valid=!1),s=ar(x(o,f(b(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(x=null==n?(_=n,Pc):Oe((_=+n)*Fa),u()):_},t.clipExtent=function(n){return arguments.length?(w=n,b=n?Ie(n[0][0],n[0][1],n[1][0],n[1][1]):At,u()):w},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(v=n[0]%360*Fa,d=n[1]%360*Fa,r()):[v*Ha,d*Ha]},t.rotate=function(n){return arguments.length?(m=n[0]%360*Fa,y=n[1]%360*Fa,M=n.length>2?n[2]%360*Fa:0,r()):[m*Ha,y*Ha,M*Ha]},ta.rebind(t,f,"precision"),function(){return i=n.apply(this,arguments),t.invert=i.invert&&e,r()}}function ar(n){return ur(n,function(t,e){n.point(t*Fa,e*Fa)})}function cr(n,t){return[n,t]}function lr(n,t){return[n>Da?n-Pa:-Da>n?n+Pa:n,t]}function sr(n,t,e){return n?t||e?Ne(hr(n),gr(t,e)):hr(n):t||e?gr(t,e):lr}function fr(n){return function(t,e){return t+=n,[t>Da?t-Pa:-Da>t?t+Pa:t,e]}}function hr(n){var t=fr(n);return t.invert=fr(-n),t}function gr(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*r+a*u;return[Math.atan2(c*i-s*o,a*r-l*u),tt(s*i+c*o)]}var r=Math.cos(n),u=Math.sin(n),i=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*i-c*o;return[Math.atan2(c*i+l*o,a*r+s*u),tt(s*r-a*u)]},e}function pr(n,t){var e=Math.cos(n),r=Math.sin(n);return function(u,i,o,a){var c=o*t;null!=u?(u=vr(e,u),i=vr(e,i),(o>0?i>u:u>i)&&(u+=o*Pa)):(u=n+o*Pa,i=n-.5*c);for(var l,s=u;o>0?s>i:i>s;s-=c)a.point((l=be([e,-r*Math.cos(s),-r*Math.sin(s)]))[0],l[1])}}function vr(n,t){var e=ve(t);e[0]-=n,xe(e);var r=nt(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Ta)%(2*Math.PI)}function dr(n,t,e){var r=ta.range(n,t-Ta,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function mr(n,t,e){var r=ta.range(n,t-Ta,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function yr(n){return n.source}function Mr(n){return n.target}function xr(n,t,e,r){var u=Math.cos(t),i=Math.sin(t),o=Math.cos(r),a=Math.sin(r),c=u*Math.cos(n),l=u*Math.sin(n),s=o*Math.cos(e),f=o*Math.sin(e),h=2*Math.asin(Math.sqrt(it(r-t)+u*o*it(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*c+t*s,u=e*l+t*f,o=e*i+t*a;return[Math.atan2(u,r)*Ha,Math.atan2(o,Math.sqrt(r*r+u*u))*Ha]}:function(){return[n*Ha,t*Ha]};return p.distance=h,p}function br(){function n(n,u){var i=Math.sin(u*=Fa),o=Math.cos(u),a=va((n*=Fa)-t),c=Math.cos(a);$c+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*i-e*o*c)*a),e*i+r*o*c),t=n,e=i,r=o}var t,e,r;Bc.point=function(u,i){t=u*Fa,e=Math.sin(i*=Fa),r=Math.cos(i),Bc.point=n},Bc.lineEnd=function(){Bc.point=Bc.lineEnd=y}}function _r(n,t){function e(t,e){var r=Math.cos(t),u=Math.cos(e),i=n(r*u);return[i*u*Math.sin(t),i*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),u=t(r),i=Math.sin(u),o=Math.cos(u);return[Math.atan2(n*i,r*o),Math.asin(r&&e*i/r)]},e}function wr(n,t){function e(n,t){o>0?-ja+Ta>t&&(t=-ja+Ta):t>ja-Ta&&(t=ja-Ta);var e=o/Math.pow(u(t),i);return[e*Math.sin(i*n),o-e*Math.cos(i*n)]}var r=Math.cos(n),u=function(n){return Math.tan(Da/4+n/2)},i=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(u(t)/u(n)),o=r*Math.pow(u(n),i)/i;return i?(e.invert=function(n,t){var e=o-t,r=K(i)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/i,2*Math.atan(Math.pow(o/r,1/i))-ja]},e):kr}function Sr(n,t){function e(n,t){var e=i-t;return[e*Math.sin(u*n),i-e*Math.cos(u*n)]}var r=Math.cos(n),u=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),i=r/u+n;return va(u)<Ta?cr:(e.invert=function(n,t){var e=i-t;return[Math.atan2(n,e)/u,i-K(u)*Math.sqrt(n*n+e*e)]},e)}function kr(n,t){return[n,Math.log(Math.tan(Da/4+t/2))]}function Er(n){var t,e=ir(n),r=e.scale,u=e.translate,i=e.clipExtent;return e.scale=function(){var n=r.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.translate=function(){var n=u.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.clipExtent=function(n){var o=i.apply(e,arguments);if(o===e){if(t=null==n){var a=Da*r(),c=u();i([[c[0]-a,c[1]-a],[c[0]+a,c[1]+a]])}}else t&&(o=null);return o},e.clipExtent(null)}function Ar(n,t){return[Math.log(Math.tan(Da/4+t/2)),-n]}function Nr(n){return n[0]}function Cr(n){return n[1]}function zr(n){for(var t=n.length,e=[0,1],r=2,u=2;t>u;u++){for(;r>1&&Q(n[e[r-2]],n[e[r-1]],n[u])<=0;)--r;e[r++]=u}return e.slice(0,r)}function qr(n,t){return n[0]-t[0]||n[1]-t[1]}function Lr(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Tr(n,t,e,r){var u=n[0],i=e[0],o=t[0]-u,a=r[0]-i,c=n[1],l=e[1],s=t[1]-c,f=r[1]-l,h=(a*(c-l)-f*(u-i))/(f*o-a*s);return[u+h*o,c+h*s]}function Rr(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Dr(){eu(this),this.edge=this.site=this.circle=null}function Pr(n){var t=ol.pop()||new Dr;return t.site=n,t}function Ur(n){$r(n),rl.remove(n),ol.push(n),eu(n)}function jr(n){var t=n.circle,e=t.x,r=t.cy,u={x:e,y:r},i=n.P,o=n.N,a=[n];Ur(n);for(var c=i;c.circle&&va(e-c.circle.x)<Ta&&va(r-c.circle.cy)<Ta;)i=c.P,a.unshift(c),Ur(c),c=i;a.unshift(c),$r(c);for(var l=o;l.circle&&va(e-l.circle.x)<Ta&&va(r-l.circle.cy)<Ta;)o=l.N,a.push(l),Ur(l),l=o;a.push(l),$r(l);var s,f=a.length;for(s=1;f>s;++s)l=a[s],c=a[s-1],Qr(l.edge,c.site,l.site,u);c=a[0],l=a[f-1],l.edge=Gr(c.site,l.site,null,u),Xr(c),Xr(l)}function Fr(n){for(var t,e,r,u,i=n.x,o=n.y,a=rl._;a;)if(r=Hr(a,o)-i,r>Ta)a=a.L;else{if(u=i-Or(a,o),!(u>Ta)){r>-Ta?(t=a.P,e=a):u>-Ta?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var c=Pr(n);if(rl.insert(t,c),t||e){if(t===e)return $r(t),e=Pr(t.site),rl.insert(c,e),c.edge=e.edge=Gr(t.site,c.site),Xr(t),Xr(e),void 0;if(!e)return c.edge=Gr(t.site,c.site),void 0;$r(t),$r(e);var l=t.site,s=l.x,f=l.y,h=n.x-s,g=n.y-f,p=e.site,v=p.x-s,d=p.y-f,m=2*(h*d-g*v),y=h*h+g*g,M=v*v+d*d,x={x:(d*y-g*M)/m+s,y:(h*M-v*y)/m+f};Qr(e.edge,l,p,x),c.edge=Gr(l,n,null,x),e.edge=Gr(n,p,null,x),Xr(t),Xr(e)}}function Hr(n,t){var e=n.site,r=e.x,u=e.y,i=u-t;if(!i)return r;var o=n.P;if(!o)return-1/0;e=o.site;var a=e.x,c=e.y,l=c-t;if(!l)return a;var s=a-r,f=1/i-1/l,h=s/l;return f?(-h+Math.sqrt(h*h-2*f*(s*s/(-2*l)-c+l/2+u-i/2)))/f+r:(r+a)/2}function Or(n,t){var e=n.N;if(e)return Hr(e,t);var r=n.site;return r.y===t?r.x:1/0}function Yr(n){this.site=n,this.edges=[]}function Ir(n){for(var t,e,r,u,i,o,a,c,l,s,f=n[0][0],h=n[1][0],g=n[0][1],p=n[1][1],v=el,d=v.length;d--;)if(i=v[d],i&&i.prepare())for(a=i.edges,c=a.length,o=0;c>o;)s=a[o].end(),r=s.x,u=s.y,l=a[++o%c].start(),t=l.x,e=l.y,(va(r-t)>Ta||va(u-e)>Ta)&&(a.splice(o,0,new nu(Kr(i.site,s,va(r-f)<Ta&&p-u>Ta?{x:f,y:va(t-f)<Ta?e:p}:va(u-p)<Ta&&h-r>Ta?{x:va(e-p)<Ta?t:h,y:p}:va(r-h)<Ta&&u-g>Ta?{x:h,y:va(t-h)<Ta?e:g}:va(u-g)<Ta&&r-f>Ta?{x:va(e-g)<Ta?t:f,y:g}:null),i.site,null)),++c)}function Zr(n,t){return t.angle-n.angle}function Vr(){eu(this),this.x=this.y=this.arc=this.site=this.cy=null}function Xr(n){var t=n.P,e=n.N;if(t&&e){var r=t.site,u=n.site,i=e.site;if(r!==i){var o=u.x,a=u.y,c=r.x-o,l=r.y-a,s=i.x-o,f=i.y-a,h=2*(c*f-l*s);if(!(h>=-Ra)){var g=c*c+l*l,p=s*s+f*f,v=(f*g-l*p)/h,d=(c*p-s*g)/h,f=d+a,m=al.pop()||new Vr;m.arc=n,m.site=u,m.x=v+o,m.y=f+Math.sqrt(v*v+d*d),m.cy=f,n.circle=m;for(var y=null,M=il._;M;)if(m.y<M.y||m.y===M.y&&m.x<=M.x){if(!M.L){y=M.P;break}M=M.L}else{if(!M.R){y=M;break}M=M.R}il.insert(y,m),y||(ul=m)}}}}function $r(n){var t=n.circle;t&&(t.P||(ul=t.N),il.remove(t),al.push(t),eu(t),n.circle=null)}function Br(n){for(var t,e=tl,r=Ye(n[0][0],n[0][1],n[1][0],n[1][1]),u=e.length;u--;)t=e[u],(!Wr(t,n)||!r(t)||va(t.a.x-t.b.x)<Ta&&va(t.a.y-t.b.y)<Ta)&&(t.a=t.b=null,e.splice(u,1))}function Wr(n,t){var e=n.b;if(e)return!0;var r,u,i=n.a,o=t[0][0],a=t[1][0],c=t[0][1],l=t[1][1],s=n.l,f=n.r,h=s.x,g=s.y,p=f.x,v=f.y,d=(h+p)/2,m=(g+v)/2;if(v===g){if(o>d||d>=a)return;if(h>p){if(i){if(i.y>=l)return}else i={x:d,y:c};e={x:d,y:l}}else{if(i){if(i.y<c)return}else i={x:d,y:l};e={x:d,y:c}}}else if(r=(h-p)/(v-g),u=m-r*d,-1>r||r>1)if(h>p){if(i){if(i.y>=l)return}else i={x:(c-u)/r,y:c};e={x:(l-u)/r,y:l}}else{if(i){if(i.y<c)return}else i={x:(l-u)/r,y:l};e={x:(c-u)/r,y:c}}else if(v>g){if(i){if(i.x>=a)return}else i={x:o,y:r*o+u};e={x:a,y:r*a+u}}else{if(i){if(i.x<o)return}else i={x:a,y:r*a+u};e={x:o,y:r*o+u}}return n.a=i,n.b=e,!0}function Jr(n,t){this.l=n,this.r=t,this.a=this.b=null}function Gr(n,t,e,r){var u=new Jr(n,t);return tl.push(u),e&&Qr(u,n,t,e),r&&Qr(u,t,n,r),el[n.i].edges.push(new nu(u,n,t)),el[t.i].edges.push(new nu(u,t,n)),u}function Kr(n,t,e){var r=new Jr(n,null);return r.a=t,r.b=e,tl.push(r),r}function Qr(n,t,e,r){n.a||n.b?n.l===e?n.b=r:n.a=r:(n.a=r,n.l=t,n.r=e)}function nu(n,t,e){var r=n.a,u=n.b;this.edge=n,this.site=t,this.angle=e?Math.atan2(e.y-t.y,e.x-t.x):n.l===t?Math.atan2(u.x-r.x,r.y-u.y):Math.atan2(r.x-u.x,u.y-r.y)}function tu(){this._=null}function eu(n){n.U=n.C=n.L=n.R=n.P=n.N=null}function ru(n,t){var e=t,r=t.R,u=e.U;u?u.L===e?u.L=r:u.R=r:n._=r,r.U=u,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function uu(n,t){var e=t,r=t.L,u=e.U;u?u.L===e?u.L=r:u.R=r:n._=r,r.U=u,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function iu(n){for(;n.L;)n=n.L;return n}function ou(n,t){var e,r,u,i=n.sort(au).pop();for(tl=[],el=new Array(n.length),rl=new tu,il=new tu;;)if(u=ul,i&&(!u||i.y<u.y||i.y===u.y&&i.x<u.x))(i.x!==e||i.y!==r)&&(el[i.i]=new Yr(i),Fr(i),e=i.x,r=i.y),i=n.pop();else{if(!u)break;jr(u.arc)}t&&(Br(t),Ir(t));var o={cells:el,edges:tl};return rl=il=tl=el=null,o}function au(n,t){return t.y-n.y||t.x-n.x}function cu(n,t,e){return(n.x-e.x)*(t.y-n.y)-(n.x-t.x)*(e.y-n.y)}function lu(n){return n.x}function su(n){return n.y}function fu(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function hu(n,t,e,r,u,i){if(!n(t,e,r,u,i)){var o=.5*(e+u),a=.5*(r+i),c=t.nodes;c[0]&&hu(n,c[0],e,r,o,a),c[1]&&hu(n,c[1],o,r,u,a),c[2]&&hu(n,c[2],e,a,o,i),c[3]&&hu(n,c[3],o,a,u,i)}}function gu(n,t,e,r,u,i,o){var a,c=1/0;return function l(n,s,f,h,g){if(!(s>i||f>o||r>h||u>g)){if(p=n.point){var p,v=t-p[0],d=e-p[1],m=v*v+d*d;if(c>m){var y=Math.sqrt(c=m);r=t-y,u=e-y,i=t+y,o=e+y,a=p}}for(var M=n.nodes,x=.5*(s+h),b=.5*(f+g),_=t>=x,w=e>=b,S=w<<1|_,k=S+4;k>S;++S)if(n=M[3&S])switch(3&S){case 0:l(n,s,f,x,b);break;case 1:l(n,x,f,h,b);break;case 2:l(n,s,b,x,g);break;case 3:l(n,x,b,h,g)}}}(n,r,u,i,o),a}function pu(n,t){n=ta.rgb(n),t=ta.rgb(t);var e=n.r,r=n.g,u=n.b,i=t.r-e,o=t.g-r,a=t.b-u;return function(n){return"#"+xt(Math.round(e+i*n))+xt(Math.round(r+o*n))+xt(Math.round(u+a*n))}}function vu(n,t){var e,r={},u={};for(e in n)e in t?r[e]=yu(n[e],t[e]):u[e]=n[e];for(e in t)e in n||(u[e]=t[e]);return function(n){for(e in r)u[e]=r[e](n);return u}}function du(n,t){return n=+n,t=+t,function(e){return n*(1-e)+t*e}}function mu(n,t){var e,r,u,i=ll.lastIndex=sl.lastIndex=0,o=-1,a=[],c=[];for(n+="",t+="";(e=ll.exec(n))&&(r=sl.exec(t));)(u=r.index)>i&&(u=t.slice(i,u),a[o]?a[o]+=u:a[++o]=u),(e=e[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,c.push({i:o,x:du(e,r)})),i=sl.lastIndex;return i<t.length&&(u=t.slice(i),a[o]?a[o]+=u:a[++o]=u),a.length<2?c[0]?(t=c[0].x,function(n){return t(n)+""}):function(){return t}:(t=c.length,function(n){for(var e,r=0;t>r;++r)a[(e=c[r]).i]=e.x(n);return a.join("")})}function yu(n,t){for(var e,r=ta.interpolators.length;--r>=0&&!(e=ta.interpolators[r](n,t)););return e}function Mu(n,t){var e,r=[],u=[],i=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(yu(n[e],t[e]));for(;i>e;++e)u[e]=n[e];for(;o>e;++e)u[e]=t[e];return function(n){for(e=0;a>e;++e)u[e]=r[e](n);return u}}function xu(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function bu(n){return function(t){return 1-n(1-t)}}function _u(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function wu(n){return n*n}function Su(n){return n*n*n}function ku(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function Eu(n){return function(t){return Math.pow(t,n)}}function Au(n){return 1-Math.cos(n*ja)}function Nu(n){return Math.pow(2,10*(n-1))}function Cu(n){return 1-Math.sqrt(1-n*n)}function zu(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Pa*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Pa/t)}}function qu(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Lu(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Tu(n,t){n=ta.hcl(n),t=ta.hcl(t);var e=n.h,r=n.c,u=n.l,i=t.h-e,o=t.c-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return st(e+i*n,r+o*n,u+a*n)+""}}function Ru(n,t){n=ta.hsl(n),t=ta.hsl(t);var e=n.h,r=n.s,u=n.l,i=t.h-e,o=t.s-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return ct(e+i*n,r+o*n,u+a*n)+""}}function Du(n,t){n=ta.lab(n),t=ta.lab(t);var e=n.l,r=n.a,u=n.b,i=t.l-e,o=t.a-r,a=t.b-u;return function(n){return ht(e+i*n,r+o*n,u+a*n)+""}}function Pu(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Uu(n){var t=[n.a,n.b],e=[n.c,n.d],r=Fu(t),u=ju(t,e),i=Fu(Hu(e,t,-u))||0;t[0]*e[1]<e[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,u*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-e[0],e[1]))*Ha,this.translate=[n.e,n.f],this.scale=[r,i],this.skew=i?Math.atan2(u,i)*Ha:0}function ju(n,t){return n[0]*t[0]+n[1]*t[1]}function Fu(n){var t=Math.sqrt(ju(n,n));return t&&(n[0]/=t,n[1]/=t),t}function Hu(n,t,e){return n[0]+=e*t[0],n[1]+=e*t[1],n}function Ou(n,t){var e,r=[],u=[],i=ta.transform(n),o=ta.transform(t),a=i.translate,c=o.translate,l=i.rotate,s=o.rotate,f=i.skew,h=o.skew,g=i.scale,p=o.scale;return a[0]!=c[0]||a[1]!=c[1]?(r.push("translate(",null,",",null,")"),u.push({i:1,x:du(a[0],c[0])},{i:3,x:du(a[1],c[1])})):c[0]||c[1]?r.push("translate("+c+")"):r.push(""),l!=s?(l-s>180?s+=360:s-l>180&&(l+=360),u.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:du(l,s)})):s&&r.push(r.pop()+"rotate("+s+")"),f!=h?u.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:du(f,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),u.push({i:e-4,x:du(g[0],p[0])},{i:e-2,x:du(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=u.length,function(n){for(var t,i=-1;++i<e;)r[(t=u[i]).i]=t.x(n);return r.join("")}}function Yu(n,t){return t=(t-=n=+n)||1/t,function(e){return(e-n)/t}}function Iu(n,t){return t=(t-=n=+n)||1/t,function(e){return Math.max(0,Math.min(1,(e-n)/t))}}function Zu(n){for(var t=n.source,e=n.target,r=Xu(t,e),u=[t];t!==r;)t=t.parent,u.push(t);for(var i=u.length;e!==r;)u.splice(i,0,e),e=e.parent;return u}function Vu(n){for(var t=[],e=n.parent;null!=e;)t.push(n),n=e,e=e.parent;return t.push(n),t}function Xu(n,t){if(n===t)return n;for(var e=Vu(n),r=Vu(t),u=e.pop(),i=r.pop(),o=null;u===i;)o=u,u=e.pop(),i=r.pop();return o}function $u(n){n.fixed|=2}function Bu(n){n.fixed&=-7}function Wu(n){n.fixed|=4,n.px=n.x,n.py=n.y}function Ju(n){n.fixed&=-5}function Gu(n,t,e){var r=0,u=0;if(n.charge=0,!n.leaf)for(var i,o=n.nodes,a=o.length,c=-1;++c<a;)i=o[c],null!=i&&(Gu(i,t,e),n.charge+=i.charge,r+=i.charge*i.cx,u+=i.charge*i.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var l=t*e[n.point.index];n.charge+=n.pointCharge=l,r+=l*n.point.x,u+=l*n.point.y}n.cx=r/n.charge,n.cy=u/n.charge}function Ku(n,t){return ta.rebind(n,t,"sort","children","value"),n.nodes=n,n.links=ui,n}function Qu(n,t){for(var e=[n];null!=(n=e.pop());)if(t(n),(u=n.children)&&(r=u.length))for(var r,u;--r>=0;)e.push(u[r])}function ni(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(i=n.children)&&(u=i.length))for(var u,i,o=-1;++o<u;)e.push(i[o]);for(;null!=(n=r.pop());)t(n)}function ti(n){return n.children}function ei(n){return n.value}function ri(n,t){return t.value-n.value}function ui(n){return ta.merge(n.map(function(n){return(n.children||[]).map(function(t){return{source:n,target:t}})}))}function ii(n){return n.x}function oi(n){return n.y}function ai(n,t,e){n.y0=t,n.y=e}function ci(n){return ta.range(n.length)}function li(n){for(var t=-1,e=n[0].length,r=[];++t<e;)r[t]=0;return r}function si(n){for(var t,e=1,r=0,u=n[0][1],i=n.length;i>e;++e)(t=n[e][1])>u&&(r=e,u=t);return r}function fi(n){return n.reduce(hi,0)}function hi(n,t){return n+t[1]}function gi(n,t){return pi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function pi(n,t){for(var e=-1,r=+n[0],u=(n[1]-r)/t,i=[];++e<=t;)i[e]=u*e+r;return i}function vi(n){return[ta.min(n),ta.max(n)]}function di(n,t){return n.value-t.value}function mi(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function yi(n,t){n._pack_next=t,t._pack_prev=n}function Mi(n,t){var e=t.x-n.x,r=t.y-n.y,u=n.r+t.r;return.999*u*u>e*e+r*r}function xi(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(l=e.length)){var e,r,u,i,o,a,c,l,s=1/0,f=-1/0,h=1/0,g=-1/0;if(e.forEach(bi),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(u=e[1],u.x=u.r,u.y=0,t(u),l>2))for(i=e[2],Si(r,u,i),t(i),mi(r,i),r._pack_prev=i,mi(i,u),u=r._pack_next,o=3;l>o;o++){Si(r,u,i=e[o]);var p=0,v=1,d=1;for(a=u._pack_next;a!==u;a=a._pack_next,v++)if(Mi(a,i)){p=1;break}if(1==p)for(c=r._pack_prev;c!==a._pack_prev&&!Mi(c,i);c=c._pack_prev,d++);p?(d>v||v==d&&u.r<r.r?yi(r,u=a):yi(r=c,u),o--):(mi(r,i),u=i,t(i))}var m=(s+f)/2,y=(h+g)/2,M=0;for(o=0;l>o;o++)i=e[o],i.x-=m,i.y-=y,M=Math.max(M,i.r+Math.sqrt(i.x*i.x+i.y*i.y));n.r=M,e.forEach(_i)}}function bi(n){n._pack_next=n._pack_prev=n}function _i(n){delete n._pack_next,delete n._pack_prev}function wi(n,t,e,r){var u=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,u)for(var i=-1,o=u.length;++i<o;)wi(u[i],t,e,r)}function Si(n,t,e){var r=n.r+e.r,u=t.x-n.x,i=t.y-n.y;if(r&&(u||i)){var o=t.r+e.r,a=u*u+i*i;o*=o,r*=r;var c=.5+(r-o)/(2*a),l=Math.sqrt(Math.max(0,2*o*(r+a)-(r-=a)*r-o*o))/(2*a);e.x=n.x+c*u+l*i,e.y=n.y+c*i-l*u}else e.x=n.x+r,e.y=n.y}function ki(n,t){return n.parent==t.parent?1:2}function Ei(n){var t=n.children;return t.length?t[0]:n.t}function Ai(n){var t,e=n.children;return(t=e.length)?e[t-1]:n.t}function Ni(n,t,e){var r=e/(t.i-n.i);t.c-=r,t.s+=e,n.c+=r,t.z+=e,t.m+=e}function Ci(n){for(var t,e=0,r=0,u=n.children,i=u.length;--i>=0;)t=u[i],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function zi(n,t,e){return n.a.parent===t.parent?n.a:e}function qi(n){return 1+ta.max(n,function(n){return n.y})}function Li(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Ti(n){var t=n.children;return t&&t.length?Ti(t[0]):n}function Ri(n){var t,e=n.children;return e&&(t=e.length)?Ri(e[t-1]):n}function Di(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Pi(n,t){var e=n.x+t[3],r=n.y+t[0],u=n.dx-t[1]-t[3],i=n.dy-t[0]-t[2];return 0>u&&(e+=u/2,u=0),0>i&&(r+=i/2,i=0),{x:e,y:r,dx:u,dy:i}}function Ui(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function ji(n){return n.rangeExtent?n.rangeExtent():Ui(n.range())}function Fi(n,t,e,r){var u=e(n[0],n[1]),i=r(t[0],t[1]);return function(n){return i(u(n))}}function Hi(n,t){var e,r=0,u=n.length-1,i=n[r],o=n[u];return i>o&&(e=r,r=u,u=e,e=i,i=o,o=e),n[r]=t.floor(i),n[u]=t.ceil(o),n}function Oi(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:bl}function Yi(n,t,e,r){var u=[],i=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++o<=a;)u.push(e(n[o-1],n[o])),i.push(r(t[o-1],t[o]));return function(t){var e=ta.bisect(n,t,1,a)-1;return i[e](u[e](t))}}function Ii(n,t,e,r){function u(){var u=Math.min(n.length,t.length)>2?Yi:Fi,c=r?Iu:Yu;return o=u(n,t,c,e),a=u(t,n,c,yu),i}function i(n){return o(n)}var o,a;return i.invert=function(n){return a(n)},i.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},i.range=function(n){return arguments.length?(t=n,u()):t},i.rangeRound=function(n){return i.range(n).interpolate(Pu)},i.clamp=function(n){return arguments.length?(r=n,u()):r},i.interpolate=function(n){return arguments.length?(e=n,u()):e},i.ticks=function(t){return $i(n,t)},i.tickFormat=function(t,e){return Bi(n,t,e)},i.nice=function(t){return Vi(n,t),u()},i.copy=function(){return Ii(n,t,e,r)},u()}function Zi(n,t){return ta.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Vi(n,t){return Hi(n,Oi(Xi(n,t)[2]))}function Xi(n,t){null==t&&(t=10);var e=Ui(n),r=e[1]-e[0],u=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),i=t/r*u;return.15>=i?u*=10:.35>=i?u*=5:.75>=i&&(u*=2),e[0]=Math.ceil(e[0]/u)*u,e[1]=Math.floor(e[1]/u)*u+.5*u,e[2]=u,e}function $i(n,t){return ta.range.apply(ta,Xi(n,t))}function Bi(n,t,e){var r=Xi(n,t);if(e){var u=lc.exec(e);if(u.shift(),"s"===u[8]){var i=ta.formatPrefix(Math.max(va(r[0]),va(r[1])));return u[7]||(u[7]="."+Wi(i.scale(r[2]))),u[8]="f",e=ta.format(u.join("")),function(n){return e(i.scale(n))+i.symbol}}u[7]||(u[7]="."+Ji(u[8],r)),e=u.join("")}else e=",."+Wi(r[2])+"f";return ta.format(e)}function Wi(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function Ji(n,t){var e=Wi(t[2]);return n in _l?Math.abs(e-Wi(Math.max(va(t[0]),va(t[1]))))+ +("e"!==n):e-2*("%"===n)}function Gi(n,t,e,r){function u(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function i(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(u(t))}return o.invert=function(t){return i(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(u)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(u)),o):t},o.nice=function(){var t=Hi(r.map(u),e?Math:Sl);return n.domain(t),r=t.map(i),o},o.ticks=function(){var n=Ui(r),o=[],a=n[0],c=n[1],l=Math.floor(u(a)),s=Math.ceil(u(c)),f=t%1?2:t;if(isFinite(s-l)){if(e){for(;s>l;l++)for(var h=1;f>h;h++)o.push(i(l)*h);o.push(i(l))}else for(o.push(i(l));l++<s;)for(var h=f-1;h>0;h--)o.push(i(l)*h);for(l=0;o[l]<a;l++);for(s=o.length;o[s-1]>c;s--);o=o.slice(l,s)}return o},o.tickFormat=function(n,t){if(!arguments.length)return wl;arguments.length<2?t=wl:"function"!=typeof t&&(t=ta.format(t));var r,a=Math.max(.1,n/o.ticks().length),c=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(n){return n/i(c(u(n)+r))<=a?t(n):""}},o.copy=function(){return Gi(n.copy(),t,e,r)},Zi(o,n)}function Ki(n,t,e){function r(t){return n(u(t))}var u=Qi(t),i=Qi(1/t);return r.invert=function(t){return i(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(u)),r):e},r.ticks=function(n){return $i(e,n)},r.tickFormat=function(n,t){return Bi(e,n,t)},r.nice=function(n){return r.domain(Vi(e,n))},r.exponent=function(o){return arguments.length?(u=Qi(t=o),i=Qi(1/t),n.domain(e.map(u)),r):t},r.copy=function(){return Ki(n.copy(),t,e)},Zi(r,n)}function Qi(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function no(n,t){function e(e){return i[((u.get(e)||("range"===t.t?u.set(e,n.push(e)):0/0))-1)%i.length]}function r(t,e){return ta.range(n.length).map(function(n){return t+e*n})}var u,i,o;return e.domain=function(r){if(!arguments.length)return n;n=[],u=new a;for(var i,o=-1,c=r.length;++o<c;)u.has(i=r[o])||u.set(i,n.push(i));return e[t.t].apply(e,t.a)},e.range=function(n){return arguments.length?(i=n,o=0,t={t:"range",a:arguments},e):i},e.rangePoints=function(u,a){arguments.length<2&&(a=0);var c=u[0],l=u[1],s=n.length<2?(c=(c+l)/2,0):(l-c)/(n.length-1+a);return i=r(c+s*a/2,s),o=0,t={t:"rangePoints",a:arguments},e},e.rangeRoundPoints=function(u,a){arguments.length<2&&(a=0);var c=u[0],l=u[1],s=n.length<2?(c=l=Math.round((c+l)/2),0):0|(l-c)/(n.length-1+a);return i=r(c+Math.round(s*a/2+(l-c-(n.length-1+a)*s)/2),s),o=0,t={t:"rangeRoundPoints",a:arguments},e},e.rangeBands=function(u,a,c){arguments.length<2&&(a=0),arguments.length<3&&(c=a);var l=u[1]<u[0],s=u[l-0],f=u[1-l],h=(f-s)/(n.length-a+2*c);return i=r(s+h*c,h),l&&i.reverse(),o=h*(1-a),t={t:"rangeBands",a:arguments},e},e.rangeRoundBands=function(u,a,c){arguments.length<2&&(a=0),arguments.length<3&&(c=a);var l=u[1]<u[0],s=u[l-0],f=u[1-l],h=Math.floor((f-s)/(n.length-a+2*c));return i=r(s+Math.round((f-s-(n.length-a)*h)/2),h),l&&i.reverse(),o=Math.round(h*(1-a)),t={t:"rangeRoundBands",a:arguments},e},e.rangeBand=function(){return o},e.rangeExtent=function(){return Ui(t.a[0])},e.copy=function(){return no(n,t)},e.domain(n)}function to(r,u){function i(){var n=0,t=u.length;for(a=[];++n<t;)a[n-1]=ta.quantile(r,n/t);return o}function o(n){return isNaN(n=+n)?void 0:u[ta.bisect(a,n)]}var a;return o.domain=function(u){return arguments.length?(r=u.map(t).filter(e).sort(n),i()):r},o.range=function(n){return arguments.length?(u=n,i()):u},o.quantiles=function(){return a},o.invertExtent=function(n){return n=u.indexOf(n),0>n?[0/0,0/0]:[n>0?a[n-1]:r[0],n<a.length?a[n]:r[r.length-1]]},o.copy=function(){return to(r,u)},i()}function eo(n,t,e){function r(t){return e[Math.max(0,Math.min(o,Math.floor(i*(t-n))))]}function u(){return i=e.length/(t-n),o=e.length-1,r}var i,o;return r.domain=function(e){return arguments.length?(n=+e[0],t=+e[e.length-1],u()):[n,t]},r.range=function(n){return arguments.length?(e=n,u()):e},r.invertExtent=function(t){return t=e.indexOf(t),t=0>t?0/0:t/i+n,[t,t+1/i]},r.copy=function(){return eo(n,t,e)},u()}function ro(n,t){function e(e){return e>=e?t[ta.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return ro(n,t)},e}function uo(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return $i(n,t)},t.tickFormat=function(t,e){return Bi(n,t,e)},t.copy=function(){return uo(n)},t}function io(){return 0}function oo(n){return n.innerRadius}function ao(n){return n.outerRadius}function co(n){return n.startAngle}function lo(n){return n.endAngle}function so(n){return n&&n.padAngle}function fo(n,t,e,r){return(n-e)*t-(t-r)*n>0?0:1}function ho(n,t,e,r,u){var i=n[0]-t[0],o=n[1]-t[1],a=(u?r:-r)/Math.sqrt(i*i+o*o),c=a*o,l=-a*i,s=n[0]+c,f=n[1]+l,h=t[0]+c,g=t[1]+l,p=(s+h)/2,v=(f+g)/2,d=h-s,m=g-f,y=d*d+m*m,M=e-r,x=s*g-h*f,b=(0>m?-1:1)*Math.sqrt(M*M*y-x*x),_=(x*m-d*b)/y,w=(-x*d-m*b)/y,S=(x*m+d*b)/y,k=(-x*d+m*b)/y,E=_-p,A=w-v,N=S-p,C=k-v;return E*E+A*A>N*N+C*C&&(_=S,w=k),[[_-c,w-l],[_*e/M,w*e/M]]}function go(n){function t(t){function o(){l.push("M",i(n(s),a))}for(var c,l=[],s=[],f=-1,h=t.length,g=Et(e),p=Et(r);++f<h;)u.call(this,c=t[f],f)?s.push([+g.call(this,c,f),+p.call(this,c,f)]):s.length&&(o(),s=[]);return s.length&&o(),l.length?l.join(""):null}var e=Nr,r=Cr,u=Ce,i=po,o=i.key,a=.7;return t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.defined=function(n){return arguments.length?(u=n,t):u},t.interpolate=function(n){return arguments.length?(o="function"==typeof n?i=n:(i=zl.get(n)||po).key,t):o},t.tension=function(n){return arguments.length?(a=n,t):a},t}function po(n){return n.join("L")}function vo(n){return po(n)+"Z"}function mo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("H",(r[0]+(r=n[t])[0])/2,"V",r[1]);return e>1&&u.push("H",r[0]),u.join("")}function yo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("V",(r=n[t])[1],"H",r[0]);return u.join("")}function Mo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("H",(r=n[t])[0],"V",r[1]);return u.join("")}function xo(n,t){return n.length<4?po(n):n[1]+wo(n.slice(1,-1),So(n,t))}function bo(n,t){return n.length<3?po(n):n[0]+wo((n.push(n[0]),n),So([n[n.length-2]].concat(n,[n[1]]),t))}function _o(n,t){return n.length<3?po(n):n[0]+wo(n,So(n,t))}function wo(n,t){if(t.length<1||n.length!=t.length&&n.length!=t.length+2)return po(n);var e=n.length!=t.length,r="",u=n[0],i=n[1],o=t[0],a=o,c=1;if(e&&(r+="Q"+(i[0]-2*o[0]/3)+","+(i[1]-2*o[1]/3)+","+i[0]+","+i[1],u=n[1],c=2),t.length>1){a=t[1],i=n[c],c++,r+="C"+(u[0]+o[0])+","+(u[1]+o[1])+","+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1];for(var l=2;l<t.length;l++,c++)i=n[c],a=t[l],r+="S"+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1]}if(e){var s=n[c];r+="Q"+(i[0]+2*a[0]/3)+","+(i[1]+2*a[1]/3)+","+s[0]+","+s[1]}return r}function So(n,t){for(var e,r=[],u=(1-t)/2,i=n[0],o=n[1],a=1,c=n.length;++a<c;)e=i,i=o,o=n[a],r.push([u*(o[0]-e[0]),u*(o[1]-e[1])]);return r}function ko(n){if(n.length<3)return po(n);var t=1,e=n.length,r=n[0],u=r[0],i=r[1],o=[u,u,u,(r=n[1])[0]],a=[i,i,i,r[1]],c=[u,",",i,"L",Co(Tl,o),",",Co(Tl,a)];for(n.push(n[e-1]);++t<=e;)r=n[t],o.shift(),o.push(r[0]),a.shift(),a.push(r[1]),zo(c,o,a);return n.pop(),c.push("L",r),c.join("")}function Eo(n){if(n.length<4)return po(n);for(var t,e=[],r=-1,u=n.length,i=[0],o=[0];++r<3;)t=n[r],i.push(t[0]),o.push(t[1]);for(e.push(Co(Tl,i)+","+Co(Tl,o)),--r;++r<u;)t=n[r],i.shift(),i.push(t[0]),o.shift(),o.push(t[1]),zo(e,i,o);return e.join("")}function Ao(n){for(var t,e,r=-1,u=n.length,i=u+4,o=[],a=[];++r<4;)e=n[r%u],o.push(e[0]),a.push(e[1]);for(t=[Co(Tl,o),",",Co(Tl,a)],--r;++r<i;)e=n[r%u],o.shift(),o.push(e[0]),a.shift(),a.push(e[1]),zo(t,o,a);return t.join("")}function No(n,t){var e=n.length-1;if(e)for(var r,u,i=n[0][0],o=n[0][1],a=n[e][0]-i,c=n[e][1]-o,l=-1;++l<=e;)r=n[l],u=l/e,r[0]=t*r[0]+(1-t)*(i+u*a),r[1]=t*r[1]+(1-t)*(o+u*c);return ko(n)}function Co(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function zo(n,t,e){n.push("C",Co(ql,t),",",Co(ql,e),",",Co(Ll,t),",",Co(Ll,e),",",Co(Tl,t),",",Co(Tl,e))}function qo(n,t){return(t[1]-n[1])/(t[0]-n[0])}function Lo(n){for(var t=0,e=n.length-1,r=[],u=n[0],i=n[1],o=r[0]=qo(u,i);++t<e;)r[t]=(o+(o=qo(u=i,i=n[t+1])))/2;return r[t]=o,r}function To(n){for(var t,e,r,u,i=[],o=Lo(n),a=-1,c=n.length-1;++a<c;)t=qo(n[a],n[a+1]),va(t)<Ta?o[a]=o[a+1]=0:(e=o[a]/t,r=o[a+1]/t,u=e*e+r*r,u>9&&(u=3*t/Math.sqrt(u),o[a]=u*e,o[a+1]=u*r));for(a=-1;++a<=c;)u=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),i.push([u||0,o[a]*u||0]);return i}function Ro(n){return n.length<3?po(n):n[0]+wo(n,To(n))}function Do(n){for(var t,e,r,u=-1,i=n.length;++u<i;)t=n[u],e=t[0],r=t[1]-ja,t[0]=e*Math.cos(r),t[1]=e*Math.sin(r);return n}function Po(n){function t(t){function c(){v.push("M",a(n(m),f),s,l(n(d.reverse()),f),"Z")}for(var h,g,p,v=[],d=[],m=[],y=-1,M=t.length,x=Et(e),b=Et(u),_=e===r?function(){return g}:Et(r),w=u===i?function(){return p}:Et(i);++y<M;)o.call(this,h=t[y],y)?(d.push([g=+x.call(this,h,y),p=+b.call(this,h,y)]),m.push([+_.call(this,h,y),+w.call(this,h,y)])):d.length&&(c(),d=[],m=[]);return d.length&&c(),v.length?v.join(""):null}var e=Nr,r=Nr,u=0,i=Cr,o=Ce,a=po,c=a.key,l=a,s="L",f=.7;return t.x=function(n){return arguments.length?(e=r=n,t):r},t.x0=function(n){return arguments.length?(e=n,t):e},t.x1=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(u=i=n,t):i},t.y0=function(n){return arguments.length?(u=n,t):u},t.y1=function(n){return arguments.length?(i=n,t):i},t.defined=function(n){return arguments.length?(o=n,t):o},t.interpolate=function(n){return arguments.length?(c="function"==typeof n?a=n:(a=zl.get(n)||po).key,l=a.reverse||a,s=a.closed?"M":"L",t):c
+},t.tension=function(n){return arguments.length?(f=n,t):f},t}function Uo(n){return n.radius}function jo(n){return[n.x,n.y]}function Fo(n){return function(){var t=n.apply(this,arguments),e=t[0],r=t[1]-ja;return[e*Math.cos(r),e*Math.sin(r)]}}function Ho(){return 64}function Oo(){return"circle"}function Yo(n){var t=Math.sqrt(n/Da);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+-t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function Io(n,t,e){return xa(n,Fl),n.namespace=t,n.id=e,n}function Zo(n,t,e,r){var u=n.id,i=n.namespace;return H(n,"function"==typeof e?function(n,o,a){n[i][u].tween.set(t,r(e.call(n,n.__data__,o,a)))}:(e=r(e),function(n){n[i][u].tween.set(t,e)}))}function Vo(n){return null==n&&(n=""),function(){this.textContent=n}}function Xo(n){return null==n?"__transition__":"__transition_"+n+"__"}function $o(n,t,e,r,u){var i=n[e]||(n[e]={active:0,count:0}),o=i[r];if(!o){var c=u.time;o=i[r]={tween:new a,time:c,ease:u.ease,delay:u.delay,duration:u.duration},u=null,++i.count,ta.timer(function(u){function a(e){return i.active>r?s(!1):(i.active=r,o.event&&o.event.start.call(n,f,t),o.tween.forEach(function(e,r){(r=r.call(n,f,t))&&d.push(r)}),ta.timer(function(){return v.c=l(e||1)?Ce:l,1},0,c),void 0)}function l(t){if(i.active!==r)return s(!1);for(var e=t/p,u=h(e),o=d.length;o>0;)d[--o].call(n,u);return e>=1?s(!0):void 0}function s(u){return o.event&&o.event[u?"end":"interrupt"].call(n,f,t),--i.count?delete i[r]:delete n[e],1}var f=n.__data__,h=o.ease,g=o.delay,p=o.duration,v=oc,d=[];return v.t=g+c,u>=g?a(u-g):(v.c=a,void 0)},0,c)}}function Bo(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function Wo(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function Jo(n){return n.toISOString()}function Go(n,t,e){function r(t){return n(t)}function u(n,e){var r=n[1]-n[0],u=r/e,i=ta.bisect(Bl,u);return i==Bl.length?[t.year,Xi(n.map(function(n){return n/31536e6}),e)[2]]:i?t[u/Bl[i-1]<Bl[i]/u?i-1:i]:[Gl,Xi(n,e)[2]]}return r.invert=function(t){return Ko(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain(t),r):n.domain().map(Ko)},r.nice=function(n,t){function e(e){return!isNaN(e)&&!n.range(e,Ko(+e+1),t).length}var i=r.domain(),o=Ui(i),a=null==n?u(o,10):"number"==typeof n&&u(o,n);return a&&(n=a[0],t=a[1]),r.domain(Hi(i,t>1?{floor:function(t){for(;e(t=n.floor(t));)t=Ko(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=Ko(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Ui(r.domain()),i=null==n?u(e,10):"number"==typeof n?u(e,n):!n.range&&[{range:n},t];return i&&(n=i[0],t=i[1]),n.range(e[0],Ko(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return Go(n.copy(),t,e)},Zi(r,n)}function Ko(n){return new Date(n)}function Qo(n){return JSON.parse(n.responseText)}function na(n){var t=ua.createRange();return t.selectNode(ua.body),t.createContextualFragment(n.responseText)}var ta={version:"3.5.0pre"};Date.now||(Date.now=function(){return+new Date});var ea=[].slice,ra=function(n){return ea.call(n)},ua=document,ia=ua.documentElement,oa=window;try{ra(ia.childNodes)[0].nodeType}catch(aa){ra=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}try{ua.createElement("div").style.setProperty("opacity",0,"")}catch(ca){var la=oa.Element.prototype,sa=la.setAttribute,fa=la.setAttributeNS,ha=oa.CSSStyleDeclaration.prototype,ga=ha.setProperty;la.setAttribute=function(n,t){sa.call(this,n,t+"")},la.setAttributeNS=function(n,t,e){fa.call(this,n,t,e+"")},ha.setProperty=function(n,t,e){ga.call(this,n,t+"",e)}}ta.ascending=n,ta.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},ta.min=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u<i;)if(null!=(r=n[u])&&r>=r){e=r;break}for(;++u<i;)null!=(r=n[u])&&e>r&&(e=r)}else{for(;++u<i;)if(null!=(r=t.call(n,n[u],u))&&r>=r){e=r;break}for(;++u<i;)null!=(r=t.call(n,n[u],u))&&e>r&&(e=r)}return e},ta.max=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u<i;)if(null!=(r=n[u])&&r>=r){e=r;break}for(;++u<i;)null!=(r=n[u])&&r>e&&(e=r)}else{for(;++u<i;)if(null!=(r=t.call(n,n[u],u))&&r>=r){e=r;break}for(;++u<i;)null!=(r=t.call(n,n[u],u))&&r>e&&(e=r)}return e},ta.extent=function(n,t){var e,r,u,i=-1,o=n.length;if(1===arguments.length){for(;++i<o;)if(null!=(r=n[i])&&r>=r){e=u=r;break}for(;++i<o;)null!=(r=n[i])&&(e>r&&(e=r),r>u&&(u=r))}else{for(;++i<o;)if(null!=(r=t.call(n,n[i],i))&&r>=r){e=u=r;break}for(;++i<o;)null!=(r=t.call(n,n[i],i))&&(e>r&&(e=r),r>u&&(u=r))}return[e,u]},ta.sum=function(n,t){var r,u=0,i=n.length,o=-1;if(1===arguments.length)for(;++o<i;)e(r=+n[o])&&(u+=r);else for(;++o<i;)e(r=+t.call(n,n[o],o))&&(u+=r);return u},ta.mean=function(n,r){var u,i=0,o=n.length,a=-1,c=o;if(1===arguments.length)for(;++a<o;)e(u=t(n[a]))?i+=u:--c;else for(;++a<o;)e(u=t(r.call(n,n[a],a)))?i+=u:--c;return c?i/c:void 0},ta.quantile=function(n,t){var e=(n.length-1)*t+1,r=Math.floor(e),u=+n[r-1],i=e-r;return i?u+i*(n[r]-u):u},ta.median=function(r,u){var i,o=[],a=r.length,c=-1;if(1===arguments.length)for(;++c<a;)e(i=t(r[c]))&&o.push(i);else for(;++c<a;)e(i=t(u.call(r,r[c],c)))&&o.push(i);return o.length?ta.quantile(o.sort(n),.5):void 0};var pa=r(n);ta.bisectLeft=pa.left,ta.bisect=ta.bisectRight=pa.right,ta.bisector=function(t){return r(1===t.length?function(e,r){return n(t(e),r)}:t)},ta.shuffle=function(n,t,e){(i=arguments.length)<3&&(e=n.length,2>i&&(t=0));for(var r,u,i=e-t;i;)u=0|Math.random()*i--,r=n[i+t],n[i+t]=n[u+t],n[u+t]=r;return n},ta.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},ta.pairs=function(n){for(var t,e=0,r=n.length-1,u=n[0],i=new Array(0>r?0:r);r>e;)i[e]=[t=u,u=n[++e]];return i},ta.zip=function(){if(!(r=arguments.length))return[];for(var n=-1,t=ta.min(arguments,u),e=new Array(t);++n<t;)for(var r,i=-1,o=e[n]=new Array(r);++i<r;)o[i]=arguments[i][n];return e},ta.transpose=function(n){return ta.zip.apply(ta,n)},ta.keys=function(n){var t=[];for(var e in n)t.push(e);return t},ta.values=function(n){var t=[];for(var e in n)t.push(n[e]);return t},ta.entries=function(n){var t=[];for(var e in n)t.push({key:e,value:n[e]});return t},ta.merge=function(n){for(var t,e,r,u=n.length,i=-1,o=0;++i<u;)o+=n[i].length;for(e=new Array(o);--u>=0;)for(r=n[u],t=r.length;--t>=0;)e[--o]=r[t];return e};var va=Math.abs;ta.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),1/0===(t-n)/e)throw new Error("infinite range");var r,u=[],o=i(va(e)),a=-1;if(n*=o,t*=o,e*=o,0>e)for(;(r=n+e*++a)>t;)u.push(r/o);else for(;(r=n+e*++a)<t;)u.push(r/o);return u},ta.map=function(n,t){var e=new a;if(n instanceof a)n.forEach(function(n,t){e.set(n,t)});else if(Array.isArray(n)){var r,u=-1,i=n.length;if(1===arguments.length)for(;++u<i;)e.set(u,n[u]);else for(;++u<i;)e.set(t.call(n,r=n[u],u),r)}else for(var o in n)e.set(o,n[o]);return e};var da="__proto__",ma="\x00";o(a,{has:s,get:function(n){return this._[c(n)]},set:function(n,t){return this._[c(n)]=t},remove:f,keys:h,values:function(){var n=[];for(var t in this._)n.push(this._[t]);return n},entries:function(){var n=[];for(var t in this._)n.push({key:l(t),value:this._[t]});return n},size:g,empty:p,forEach:function(n){for(var t in this._)n.call(this,l(t),this._[t])}}),ta.nest=function(){function n(t,o,c){if(c>=i.length)return r?r.call(u,o):e?o.sort(e):o;for(var l,s,f,h,g=-1,p=o.length,v=i[c++],d=new a;++g<p;)(h=d.get(l=v(s=o[g])))?h.push(s):d.set(l,[s]);return t?(s=t(),f=function(e,r){s.set(e,n(t,r,c))}):(s={},f=function(e,r){s[e]=n(t,r,c)}),d.forEach(f),s}function t(n,e){if(e>=i.length)return n;var r=[],u=o[e++];return n.forEach(function(n,u){r.push({key:n,values:t(u,e)})}),u?r.sort(function(n,t){return u(n.key,t.key)}):r}var e,r,u={},i=[],o=[];return u.map=function(t,e){return n(e,t,0)},u.entries=function(e){return t(n(ta.map,e,0),0)},u.key=function(n){return i.push(n),u},u.sortKeys=function(n){return o[i.length-1]=n,u},u.sortValues=function(n){return e=n,u},u.rollup=function(n){return r=n,u},u},ta.set=function(n){var t=new v;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},o(v,{has:s,add:function(n){return this._[c(n+="")]=!0,n},remove:f,values:h,size:g,empty:p,forEach:function(n){for(var t in this._)n.call(this,l(t))}}),ta.behavior={},ta.rebind=function(n,t){for(var e,r=1,u=arguments.length;++r<u;)n[e=arguments[r]]=d(n,t,t[e]);return n};var ya=["webkit","ms","moz","Moz","o","O"];ta.dispatch=function(){for(var n=new M,t=-1,e=arguments.length;++t<e;)n[arguments[t]]=x(n);return n},M.prototype.on=function(n,t){var e=n.indexOf("."),r="";if(e>=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},ta.event=null,ta.requote=function(n){return n.replace(Ma,"\\$&")};var Ma=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,xa={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},ba=function(n,t){return t.querySelector(n)},_a=function(n,t){return t.querySelectorAll(n)},wa=ia.matches||ia[m(ia,"matchesSelector")],Sa=function(n,t){return wa.call(n,t)};"function"==typeof Sizzle&&(ba=function(n,t){return Sizzle(n,t)[0]||null},_a=Sizzle,Sa=Sizzle.matchesSelector),ta.selection=function(){return Na};var ka=ta.selection.prototype=[];ka.select=function(n){var t,e,r,u,i=[];n=k(n);for(var o=-1,a=this.length;++o<a;){i.push(t=[]),t.parentNode=(r=this[o]).parentNode;for(var c=-1,l=r.length;++c<l;)(u=r[c])?(t.push(e=n.call(u,u.__data__,c,o)),e&&"__data__"in u&&(e.__data__=u.__data__)):t.push(null)}return S(i)},ka.selectAll=function(n){var t,e,r=[];n=E(n);for(var u=-1,i=this.length;++u<i;)for(var o=this[u],a=-1,c=o.length;++a<c;)(e=o[a])&&(r.push(t=ra(n.call(e,e.__data__,a,u))),t.parentNode=e);return S(r)};var Ea={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};ta.ns={prefix:Ea,qualify:function(n){var t=n.indexOf(":"),e=n;return t>=0&&(e=n.slice(0,t),n=n.slice(t+1)),Ea.hasOwnProperty(e)?{space:Ea[e],local:n}:n}},ka.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=ta.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(A(t,n[t]));return this}return this.each(A(n,t))},ka.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=z(n)).length,u=-1;if(t=e.classList){for(;++u<r;)if(!t.contains(n[u]))return!1}else for(t=e.getAttribute("class");++u<r;)if(!C(n[u]).test(t))return!1;return!0}for(t in n)this.each(q(t,n[t]));return this}return this.each(q(n,t))},ka.style=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t="");for(e in n)this.each(T(e,n[e],t));return this}if(2>r)return oa.getComputedStyle(this.node(),null).getPropertyValue(n);e=""}return this.each(T(n,t,e))},ka.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(R(t,n[t]));return this}return this.each(R(n,t))},ka.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},ka.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},ka.append=function(n){return n=D(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},ka.insert=function(n,t){return n=D(n),t=k(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},ka.remove=function(){return this.each(P)},ka.data=function(n,t){function e(n,e){var r,u,i,o=n.length,f=e.length,h=Math.min(o,f),g=new Array(f),p=new Array(f),v=new Array(o);if(t){var d,m=new a,y=new Array(o);for(r=-1;++r<o;)m.has(d=t.call(u=n[r],u.__data__,r))?v[r]=u:m.set(d,u),y[r]=d;for(r=-1;++r<f;)(u=m.get(d=t.call(e,i=e[r],r)))?u!==!0&&(g[r]=u,u.__data__=i):p[r]=U(i),m.set(d,!0);for(r=-1;++r<o;)m.get(y[r])!==!0&&(v[r]=n[r])}else{for(r=-1;++r<h;)u=n[r],i=e[r],u?(u.__data__=i,g[r]=u):p[r]=U(i);for(;f>r;++r)p[r]=U(e[r]);for(;o>r;++r)v[r]=n[r]}p.update=g,p.parentNode=g.parentNode=v.parentNode=n.parentNode,c.push(p),l.push(g),s.push(v)}var r,u,i=-1,o=this.length;if(!arguments.length){for(n=new Array(o=(r=this[0]).length);++i<o;)(u=r[i])&&(n[i]=u.__data__);return n}var c=O([]),l=S([]),s=S([]);if("function"==typeof n)for(;++i<o;)e(r=this[i],n.call(r,r.parentNode.__data__,i));else for(;++i<o;)e(r=this[i],n);return l.enter=function(){return c},l.exit=function(){return s},l},ka.datum=function(n){return arguments.length?this.property("__data__",n):this.property("__data__")},ka.filter=function(n){var t,e,r,u=[];"function"!=typeof n&&(n=j(n));for(var i=0,o=this.length;o>i;i++){u.push(t=[]),t.parentNode=(e=this[i]).parentNode;for(var a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return S(u)},ka.order=function(){for(var n=-1,t=this.length;++n<t;)for(var e,r=this[n],u=r.length-1,i=r[u];--u>=0;)(e=r[u])&&(i&&i!==e.nextSibling&&i.parentNode.insertBefore(e,i),i=e);return this},ka.sort=function(n){n=F.apply(this,arguments);for(var t=-1,e=this.length;++t<e;)this[t].sort(n);return this.order()},ka.each=function(n){return H(this,function(t,e,r){n.call(t,t.__data__,e,r)})},ka.call=function(n){var t=ra(arguments);return n.apply(t[0]=this,t),this},ka.empty=function(){return!this.node()},ka.node=function(){for(var n=0,t=this.length;t>n;n++)for(var e=this[n],r=0,u=e.length;u>r;r++){var i=e[r];if(i)return i}return null},ka.size=function(){var n=0;return H(this,function(){++n}),n};var Aa=[];ta.selection.enter=O,ta.selection.enter.prototype=Aa,Aa.append=ka.append,Aa.empty=ka.empty,Aa.node=ka.node,Aa.call=ka.call,Aa.size=ka.size,Aa.select=function(n){for(var t,e,r,u,i,o=[],a=-1,c=this.length;++a<c;){r=(u=this[a]).update,o.push(t=[]),t.parentNode=u.parentNode;for(var l=-1,s=u.length;++l<s;)(i=u[l])?(t.push(r[l]=e=n.call(u.parentNode,i.__data__,l,a)),e.__data__=i.__data__):t.push(null)}return S(o)},Aa.insert=function(n,t){return arguments.length<2&&(t=Y(this)),ka.insert.call(this,n,t)},ka.transition=function(n){for(var t,e,r=Dl||++Hl,u=Xo(n),i=[],o=Pl||{time:Date.now(),ease:ku,delay:0,duration:250},a=-1,c=this.length;++a<c;){i.push(t=[]);for(var l=this[a],s=-1,f=l.length;++s<f;)(e=l[s])&&$o(e,s,u,r,o),t.push(e)}return Io(i,u,r)},ka.interrupt=function(n){var t=Xo(n);return this.each(function(){var n=this[t];n&&++n.active})},ta.select=function(n){var t=["string"==typeof n?ba(n,ua):n];return t.parentNode=ia,S([t])},ta.selectAll=function(n){var t=ra("string"==typeof n?_a(n,ua):n);return t.parentNode=ia,S([t])};var Na=ta.select(ia);ka.on=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(Z(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(Z(n,t,e))};var Ca=ta.map({mouseenter:"mouseover",mouseleave:"mouseout"});Ca.forEach(function(n){"on"+n in ua&&Ca.remove(n)});var za="onselectstart"in ua?null:m(ia.style,"userSelect"),qa=0;ta.mouse=function(n){return B(n,_())};var La=/WebKit/.test(oa.navigator.userAgent)?-1:0;ta.touch=function(n,t,e){if(arguments.length<3&&(e=t,t=_().changedTouches),t)for(var r,u=0,i=t.length;i>u;++u)if((r=t[u]).identifier===e)return B(n,r)},ta.behavior.drag=function(){function n(){this.on("mousedown.drag",u).on("touchstart.drag",i)}function t(n,t,u,i,o){return function(){function a(){var n,e,r=t(h,v);r&&(n=r[0]-M[0],e=r[1]-M[1],p|=n|e,M=r,g({type:"drag",x:r[0]+l[0],y:r[1]+l[1],dx:n,dy:e}))}function c(){t(h,v)&&(m.on(i+d,null).on(o+d,null),y(p&&ta.event.target===f),g({type:"dragend"}))}var l,s=this,f=ta.event.target,h=s.parentNode,g=e.of(s,arguments),p=0,v=n(),d=".drag"+(null==v?"":"-"+v),m=ta.select(u()).on(i+d,a).on(o+d,c),y=$(),M=t(h,v);r?(l=r.apply(s,arguments),l=[l.x-M[0],l.y-M[1]]):l=[0,0],g({type:"dragstart"})}}var e=w(n,"drag","dragstart","dragend"),r=null,u=t(y,ta.mouse,G,"mousemove","mouseup"),i=t(W,ta.touch,J,"touchmove","touchend");return n.origin=function(t){return arguments.length?(r=t,n):r},ta.rebind(n,e,"on")},ta.touches=function(n,t){return arguments.length<2&&(t=_().touches),t?ra(t).map(function(t){var e=B(n,t);return e.identifier=t.identifier,e}):[]};var Ta=1e-6,Ra=Ta*Ta,Da=Math.PI,Pa=2*Da,Ua=Pa-Ta,ja=Da/2,Fa=Da/180,Ha=180/Da,Oa=Math.SQRT2,Ya=2,Ia=4;ta.interpolateZoom=function(n,t){function e(n){var t=n*y;if(m){var e=rt(v),o=i/(Ya*h)*(e*ut(Oa*t+v)-et(v));return[r+o*l,u+o*s,i*e/rt(Oa*t+v)]}return[r+n*l,u+n*s,i*Math.exp(Oa*t)]}var r=n[0],u=n[1],i=n[2],o=t[0],a=t[1],c=t[2],l=o-r,s=a-u,f=l*l+s*s,h=Math.sqrt(f),g=(c*c-i*i+Ia*f)/(2*i*Ya*h),p=(c*c-i*i-Ia*f)/(2*c*Ya*h),v=Math.log(Math.sqrt(g*g+1)-g),d=Math.log(Math.sqrt(p*p+1)-p),m=d-v,y=(m||Math.log(c/i))/Oa;return e.duration=1e3*y,e},ta.behavior.zoom=function(){function n(n){n.on(C,s).on(Xa+".zoom",h).on("dblclick.zoom",g).on(L,f)}function t(n){return[(n[0]-k.x)/k.k,(n[1]-k.y)/k.k]}function e(n){return[n[0]*k.k+k.x,n[1]*k.k+k.y]}function r(n){k.k=Math.max(A[0],Math.min(A[1],n))}function u(n,t){t=e(t),k.x+=n[0]-t[0],k.y+=n[1]-t[1]}function i(t,e,i,o){t.__chart__={x:k.x,y:k.y,k:k.k},r(Math.pow(2,o)),u(v=e,i),ta.select(t).transition().duration(350).call(n.event)}function o(){x&&x.domain(M.range().map(function(n){return(n-k.x)/k.k}).map(M.invert)),S&&S.domain(_.range().map(function(n){return(n-k.y)/k.k}).map(_.invert))}function a(n){N++||n({type:"zoomstart"})}function c(n){o(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function l(n){--N||n({type:"zoomend"}),v=null}function s(){function n(){s=1,u(ta.mouse(r),h),c(o)}function e(){f.on(z,null).on(q,null),g(s&&ta.event.target===i),l(o)}var r=this,i=ta.event.target,o=T.of(r,arguments),s=0,f=ta.select(oa).on(z,n).on(q,e),h=t(ta.mouse(r)),g=$();I(r),a(o)}function f(){function n(){var n=ta.touches(p);return g=k.k,n.forEach(function(n){n.identifier in d&&(d[n.identifier]=t(n))}),n}function e(){var t=ta.event.target;ta.select(t).on(x,o).on(_,h),w.push(t);for(var e=ta.event.changedTouches,r=0,u=e.length;u>r;++r)d[e[r].identifier]=null;var a=n(),c=Date.now();if(1===a.length){if(500>c-y){var l=a[0];i(p,l,d[l.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),b()}y=c}else if(a.length>1){var l=a[0],s=a[1],f=l[0]-s[0],g=l[1]-s[1];m=f*f+g*g}}function o(){var n,t,e,i,o=ta.touches(p);I(p);for(var a=0,l=o.length;l>a;++a,i=null)if(e=o[a],i=d[e.identifier]){if(t)break;n=e,t=i}if(i){var s=(s=e[0]-n[0])*s+(s=e[1]-n[1])*s,f=m&&Math.sqrt(s/m);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+i[0])/2,(t[1]+i[1])/2],r(f*g)}y=null,u(n,t),c(v)}function h(){if(ta.event.touches.length){for(var t=ta.event.changedTouches,e=0,r=t.length;r>e;++e)delete d[t[e].identifier];for(var u in d)return void n()}ta.selectAll(w).on(M,null),S.on(C,s).on(L,f),E(),l(v)}var g,p=this,v=T.of(p,arguments),d={},m=0,M=".zoom-"+ta.event.changedTouches[0].identifier,x="touchmove"+M,_="touchend"+M,w=[],S=ta.select(p),E=$();e(),a(v),S.on(C,null).on(L,e)}function h(){var n=T.of(this,arguments);m?clearTimeout(m):(p=t(v=d||ta.mouse(this)),I(this),a(n)),m=setTimeout(function(){m=null,l(n)},50),b(),r(Math.pow(2,.002*Za())*k.k),u(v,p),c(n)}function g(){var n=ta.mouse(this),e=Math.log(k.k)/Math.LN2;i(this,n,t(n),ta.event.shiftKey?Math.ceil(e)-1:Math.floor(e)+1)}var p,v,d,m,y,M,x,_,S,k={x:0,y:0,k:1},E=[960,500],A=Va,N=0,C="mousedown.zoom",z="mousemove.zoom",q="mouseup.zoom",L="touchstart.zoom",T=w(n,"zoomstart","zoom","zoomend");return n.event=function(n){n.each(function(){var n=T.of(this,arguments),t=k;Dl?ta.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},a(n)}).tween("zoom:zoom",function(){var e=E[0],r=E[1],u=v?v[0]:e/2,i=v?v[1]:r/2,o=ta.interpolateZoom([(u-k.x)/k.k,(i-k.y)/k.k,e/k.k],[(u-t.x)/t.k,(i-t.y)/t.k,e/t.k]);return function(t){var r=o(t),a=e/r[2];this.__chart__=k={x:u-r[0]*a,y:i-r[1]*a,k:a},c(n)}}).each("interrupt.zoom",function(){l(n)}).each("end.zoom",function(){l(n)}):(this.__chart__=k,a(n),c(n),l(n))})},n.translate=function(t){return arguments.length?(k={x:+t[0],y:+t[1],k:k.k},o(),n):[k.x,k.y]},n.scale=function(t){return arguments.length?(k={x:k.x,y:k.y,k:+t},o(),n):k.k},n.scaleExtent=function(t){return arguments.length?(A=null==t?Va:[+t[0],+t[1]],n):A},n.center=function(t){return arguments.length?(d=t&&[+t[0],+t[1]],n):d},n.size=function(t){return arguments.length?(E=t&&[+t[0],+t[1]],n):E},n.x=function(t){return arguments.length?(x=t,M=t.copy(),k={x:0,y:0,k:1},n):x},n.y=function(t){return arguments.length?(S=t,_=t.copy(),k={x:0,y:0,k:1},n):S},ta.rebind(n,T,"on")};var Za,Va=[0,1/0],Xa="onwheel"in ua?(Za=function(){return-ta.event.deltaY*(ta.event.deltaMode?120:1)},"wheel"):"onmousewheel"in ua?(Za=function(){return ta.event.wheelDelta},"mousewheel"):(Za=function(){return-ta.event.detail},"MozMousePixelScroll");ta.color=ot,ot.prototype.toString=function(){return this.rgb()+""},ta.hsl=at;var $a=at.prototype=new ot;$a.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new at(this.h,this.s,this.l/n)},$a.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new at(this.h,this.s,n*this.l)},$a.rgb=function(){return ct(this.h,this.s,this.l)},ta.hcl=lt;var Ba=lt.prototype=new ot;Ba.brighter=function(n){return new lt(this.h,this.c,Math.min(100,this.l+Wa*(arguments.length?n:1)))},Ba.darker=function(n){return new lt(this.h,this.c,Math.max(0,this.l-Wa*(arguments.length?n:1)))},Ba.rgb=function(){return st(this.h,this.c,this.l).rgb()},ta.lab=ft;var Wa=18,Ja=.95047,Ga=1,Ka=1.08883,Qa=ft.prototype=new ot;Qa.brighter=function(n){return new ft(Math.min(100,this.l+Wa*(arguments.length?n:1)),this.a,this.b)},Qa.darker=function(n){return new ft(Math.max(0,this.l-Wa*(arguments.length?n:1)),this.a,this.b)},Qa.rgb=function(){return ht(this.l,this.a,this.b)},ta.rgb=mt;var nc=mt.prototype=new ot;nc.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,u=30;return t||e||r?(t&&u>t&&(t=u),e&&u>e&&(e=u),r&&u>r&&(r=u),new mt(Math.min(255,t/n),Math.min(255,e/n),Math.min(255,r/n))):new mt(u,u,u)},nc.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new mt(n*this.r,n*this.g,n*this.b)},nc.hsl=function(){return _t(this.r,this.g,this.b)},nc.toString=function(){return"#"+xt(this.r)+xt(this.g)+xt(this.b)};var tc=ta.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});tc.forEach(function(n,t){tc.set(n,yt(t))}),ta.functor=Et,ta.xhr=Nt(At),ta.dsv=function(n,t){function e(n,e,i){arguments.length<3&&(i=e,e=null);var o=Ct(n,t,null==e?r:u(e),i);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:u(n)):e},o}function r(n){return e.parse(n.responseText)}function u(n){return function(t){return e.parse(t.responseText,n)}}function i(t){return t.map(o).join(n)}function o(n){return a.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var a=new RegExp('["'+n+"\n]"),c=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var u=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(u(n),e)}:u})},e.parseRows=function(n,t){function e(){if(s>=l)return o;if(u)return u=!1,i;var t=s;if(34===n.charCodeAt(t)){for(var e=t;e++<l;)if(34===n.charCodeAt(e)){if(34!==n.charCodeAt(e+1))break;++e}s=e+2;var r=n.charCodeAt(e+1);return 13===r?(u=!0,10===n.charCodeAt(e+2)&&++s):10===r&&(u=!0),n.slice(t+1,e).replace(/""/g,'"')}for(;l>s;){var r=n.charCodeAt(s++),a=1;if(10===r)u=!0;else if(13===r)u=!0,10===n.charCodeAt(s)&&(++s,++a);else if(r!==c)continue;return n.slice(t,s-a)}return n.slice(t)}for(var r,u,i={},o={},a=[],l=n.length,s=0,f=0;(r=e())!==o;){for(var h=[];r!==i&&r!==o;)h.push(r),r=e();t&&null==(h=t(h,f++))||a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new v,u=[];return t.forEach(function(n){for(var t in n)r.has(t)||u.push(r.add(t))}),[u.map(o).join(n)].concat(t.map(function(t){return u.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(i).join("\n")},e},ta.csv=ta.dsv(",","text/csv"),ta.tsv=ta.dsv(" ","text/tab-separated-values");var ec,rc,uc,ic,oc,ac=oa[m(oa,"requestAnimationFrame")]||function(n){setTimeout(n,17)};ta.timer=function(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var u=e+t,i={c:n,t:u,f:!1,n:null};rc?rc.n=i:ec=i,rc=i,uc||(ic=clearTimeout(ic),uc=1,ac(Lt))},ta.timer.flush=function(){Tt(),Rt()},ta.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var cc=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Pt);ta.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=ta.round(n,Dt(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),cc[8+e/3]};var lc=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,sc=ta.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=ta.round(n,Dt(n,t))).toFixed(Math.max(0,Math.min(20,Dt(n*(1+1e-15),t))))}}),fc=ta.time={},hc=Date;Ft.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){gc.setUTCDate.apply(this._,arguments)},setDay:function(){gc.setUTCDay.apply(this._,arguments)},setFullYear:function(){gc.setUTCFullYear.apply(this._,arguments)},setHours:function(){gc.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){gc.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){gc.setUTCMinutes.apply(this._,arguments)},setMonth:function(){gc.setUTCMonth.apply(this._,arguments)},setSeconds:function(){gc.setUTCSeconds.apply(this._,arguments)},setTime:function(){gc.setTime.apply(this._,arguments)}};var gc=Date.prototype;fc.year=Ht(function(n){return n=fc.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),fc.years=fc.year.range,fc.years.utc=fc.year.utc.range,fc.day=Ht(function(n){var t=new hc(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),fc.days=fc.day.range,fc.days.utc=fc.day.utc.range,fc.dayOfYear=function(n){var t=fc.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=fc[n]=Ht(function(n){return(n=fc.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=fc.year(n).getDay();return Math.floor((fc.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});fc[n+"s"]=e.range,fc[n+"s"].utc=e.utc.range,fc[n+"OfYear"]=function(n){var e=fc.year(n).getDay();return Math.floor((fc.dayOfYear(n)+(e+t)%7)/7)}}),fc.week=fc.sunday,fc.weeks=fc.sunday.range,fc.weeks.utc=fc.sunday.utc.range,fc.weekOfYear=fc.sundayOfYear;var pc={"-":"",_:" ",0:"0"},vc=/^\s*\d+/,dc=/^%/;ta.locale=function(n){return{numberFormat:Ut(n),timeFormat:Yt(n)}};var mc=ta.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});ta.format=mc.numberFormat,ta.geo={},le.prototype={s:0,t:0,add:function(n){se(n,this.t,yc),se(yc.s,this.s,this),this.s?this.t+=yc.t:this.s=yc.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var yc=new le;ta.geo.stream=function(n,t){n&&Mc.hasOwnProperty(n.type)?Mc[n.type](n,t):fe(n,t)};var Mc={Feature:function(n,t){fe(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,u=e.length;++r<u;)fe(e[r].geometry,t)}},xc={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)n=e[r],t.point(n[0],n[1],n[2])},LineString:function(n,t){he(n.coordinates,t,0)},MultiLineString:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)he(e[r],t,0)},Polygon:function(n,t){ge(n.coordinates,t)},MultiPolygon:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)ge(e[r],t)},GeometryCollection:function(n,t){for(var e=n.geometries,r=-1,u=e.length;++r<u;)fe(e[r],t)
+}};ta.geo.area=function(n){return bc=0,ta.geo.stream(n,wc),bc};var bc,_c=new le,wc={sphere:function(){bc+=4*Da},point:y,lineStart:y,lineEnd:y,polygonStart:function(){_c.reset(),wc.lineStart=pe},polygonEnd:function(){var n=2*_c;bc+=0>n?4*Da+n:n,wc.lineStart=wc.lineEnd=wc.point=y}};ta.geo.bounds=function(){function n(n,t){M.push(x=[s=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=ve([t*Fa,e*Fa]);if(m){var u=me(m,r),i=[u[1],-u[0],0],o=me(i,u);xe(o),o=be(o);var c=t-p,l=c>0?1:-1,v=o[0]*Ha*l,d=va(c)>180;if(d^(v>l*p&&l*t>v)){var y=o[1]*Ha;y>g&&(g=y)}else if(v=(v+360)%360-180,d^(v>l*p&&l*t>v)){var y=-o[1]*Ha;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);d?p>t?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t):h>=s?(s>t&&(s=t),t>h&&(h=t)):t>p?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t)}else n(t,e);m=r,p=t}function e(){b.point=t}function r(){x[0]=s,x[1]=h,b.point=n,m=null}function u(n,e){if(m){var r=n-p;y+=va(r)>180?r+(r>0?360:-360):r}else v=n,d=e;wc.point(n,e),t(n,e)}function i(){wc.lineStart()}function o(){u(v,d),wc.lineEnd(),va(y)>Ta&&(s=-(h=180)),x[0]=s,x[1]=h,m=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var s,f,h,g,p,v,d,m,y,M,x,b={point:n,lineStart:e,lineEnd:r,polygonStart:function(){b.point=u,b.lineStart=i,b.lineEnd=o,y=0,wc.polygonStart()},polygonEnd:function(){wc.polygonEnd(),b.point=n,b.lineStart=e,b.lineEnd=r,0>_c?(s=-(h=180),f=-(g=90)):y>Ta?g=90:-Ta>y&&(f=-90),x[0]=s,x[1]=h}};return function(n){g=h=-(s=f=1/0),M=[],ta.geo.stream(n,b);var t=M.length;if(t){M.sort(c);for(var e,r=1,u=M[0],i=[u];t>r;++r)e=M[r],l(e[0],u)||l(e[1],u)?(a(u[0],e[1])>a(u[0],u[1])&&(u[1]=e[1]),a(e[0],u[1])>a(u[0],u[1])&&(u[0]=e[0])):i.push(u=e);for(var o,e,p=-1/0,t=i.length-1,r=0,u=i[t];t>=r;u=e,++r)e=i[r],(o=a(u[1],e[0]))>p&&(p=o,s=e[0],h=u[1])}return M=x=null,1/0===s||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[s,f],[h,g]]}}(),ta.geo.centroid=function(n){Sc=kc=Ec=Ac=Nc=Cc=zc=qc=Lc=Tc=Rc=0,ta.geo.stream(n,Dc);var t=Lc,e=Tc,r=Rc,u=t*t+e*e+r*r;return Ra>u&&(t=Cc,e=zc,r=qc,Ta>kc&&(t=Ec,e=Ac,r=Nc),u=t*t+e*e+r*r,Ra>u)?[0/0,0/0]:[Math.atan2(e,t)*Ha,tt(r/Math.sqrt(u))*Ha]};var Sc,kc,Ec,Ac,Nc,Cc,zc,qc,Lc,Tc,Rc,Dc={sphere:y,point:we,lineStart:ke,lineEnd:Ee,polygonStart:function(){Dc.lineStart=Ae},polygonEnd:function(){Dc.lineStart=ke}},Pc=Te(Ce,Ue,Fe,[-Da,-Da/2]),Uc=1e9;ta.geo.clipExtent=function(){var n,t,e,r,u,i,o={stream:function(n){return u&&(u.valid=!1),u=i(n),u.valid=!0,u},extent:function(a){return arguments.length?(i=Ie(n=+a[0][0],t=+a[0][1],e=+a[1][0],r=+a[1][1]),u&&(u.valid=!1,u=null),o):[[n,t],[e,r]]}};return o.extent([[0,0],[960,500]])},(ta.geo.conicEqualArea=function(){return Ze(Ve)}).raw=Ve,ta.geo.albers=function(){return ta.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ta.geo.albersUsa=function(){function n(n){var i=n[0],o=n[1];return t=null,e(i,o),t||(r(i,o),t)||u(i,o),t}var t,e,r,u,i=ta.geo.albers(),o=ta.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=ta.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=i.scale(),e=i.translate(),r=(n[0]-e[0])/t,u=(n[1]-e[1])/t;return(u>=.12&&.234>u&&r>=-.425&&-.214>r?o:u>=.166&&.234>u&&r>=-.214&&-.115>r?a:i).invert(n)},n.stream=function(n){var t=i.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,u){t.point(n,u),e.point(n,u),r.point(n,u)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(i.precision(t),o.precision(t),a.precision(t),n):i.precision()},n.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),a.scale(t),n.translate(i.translate())):i.scale()},n.translate=function(t){if(!arguments.length)return i.translate();var l=i.scale(),s=+t[0],f=+t[1];return e=i.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,r=o.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+Ta,f+.12*l+Ta],[s-.214*l-Ta,f+.234*l-Ta]]).stream(c).point,u=a.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+Ta,f+.166*l+Ta],[s-.115*l-Ta,f+.234*l-Ta]]).stream(c).point,n},n.scale(1070)};var jc,Fc,Hc,Oc,Yc,Ic,Zc={point:y,lineStart:y,lineEnd:y,polygonStart:function(){Fc=0,Zc.lineStart=Xe},polygonEnd:function(){Zc.lineStart=Zc.lineEnd=Zc.point=y,jc+=va(Fc/2)}},Vc={point:$e,lineStart:y,lineEnd:y,polygonStart:y,polygonEnd:y},Xc={point:Je,lineStart:Ge,lineEnd:Ke,polygonStart:function(){Xc.lineStart=Qe},polygonEnd:function(){Xc.point=Je,Xc.lineStart=Ge,Xc.lineEnd=Ke}};ta.geo.path=function(){function n(n){return n&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=u(i)),ta.geo.stream(n,o)),i.result()}function t(){return o=null,n}var e,r,u,i,o,a=4.5;return n.area=function(n){return jc=0,ta.geo.stream(n,u(Zc)),jc},n.centroid=function(n){return Ec=Ac=Nc=Cc=zc=qc=Lc=Tc=Rc=0,ta.geo.stream(n,u(Xc)),Rc?[Lc/Rc,Tc/Rc]:qc?[Cc/qc,zc/qc]:Nc?[Ec/Nc,Ac/Nc]:[0/0,0/0]},n.bounds=function(n){return Yc=Ic=-(Hc=Oc=1/0),ta.geo.stream(n,u(Vc)),[[Hc,Oc],[Yc,Ic]]},n.projection=function(n){return arguments.length?(u=(e=n)?n.stream||er(n):At,t()):e},n.context=function(n){return arguments.length?(i=null==(r=n)?new Be:new nr(n),"function"!=typeof a&&i.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(i.pointRadius(+t),+t),n):a},n.projection(ta.geo.albersUsa()).context(null)},ta.geo.transform=function(n){return{stream:function(t){var e=new rr(t);for(var r in n)e[r]=n[r];return e}}},rr.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ta.geo.projection=ir,ta.geo.projectionMutator=or,(ta.geo.equirectangular=function(){return ir(cr)}).raw=cr.invert=cr,ta.geo.rotation=function(n){function t(t){return t=n(t[0]*Fa,t[1]*Fa),t[0]*=Ha,t[1]*=Ha,t}return n=sr(n[0]%360*Fa,n[1]*Fa,n.length>2?n[2]*Fa:0),t.invert=function(t){return t=n.invert(t[0]*Fa,t[1]*Fa),t[0]*=Ha,t[1]*=Ha,t},t},lr.invert=cr,ta.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=sr(-n[0]*Fa,-n[1]*Fa,0).invert,u=[];return e(null,null,1,{point:function(n,e){u.push(n=t(n,e)),n[0]*=Ha,n[1]*=Ha}}),{type:"Polygon",coordinates:[u]}}var t,e,r=[0,0],u=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=pr((t=+r)*Fa,u*Fa),n):t},n.precision=function(r){return arguments.length?(e=pr(t*Fa,(u=+r)*Fa),n):u},n.angle(90)},ta.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Fa,u=n[1]*Fa,i=t[1]*Fa,o=Math.sin(r),a=Math.cos(r),c=Math.sin(u),l=Math.cos(u),s=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((e=f*o)*e+(e=l*s-c*f*a)*e),c*s+l*f*a)},ta.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return ta.range(Math.ceil(i/d)*d,u,d).map(h).concat(ta.range(Math.ceil(l/m)*m,c,m).map(g)).concat(ta.range(Math.ceil(r/p)*p,e,p).filter(function(n){return va(n%d)>Ta}).map(s)).concat(ta.range(Math.ceil(a/v)*v,o,v).filter(function(n){return va(n%m)>Ta}).map(f))}var e,r,u,i,o,a,c,l,s,f,h,g,p=10,v=p,d=90,m=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(g(c).slice(1),h(u).reverse().slice(1),g(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(i=+t[0][0],u=+t[1][0],l=+t[0][1],c=+t[1][1],i>u&&(t=i,i=u,u=t),l>c&&(t=l,l=c,c=t),n.precision(y)):[[i,l],[u,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(y)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],m=+t[1],n):[d,m]},n.minorStep=function(t){return arguments.length?(p=+t[0],v=+t[1],n):[p,v]},n.precision=function(t){return arguments.length?(y=+t,s=dr(a,o,90),f=mr(r,e,y),h=dr(l,c,90),g=mr(i,u,y),n):y},n.majorExtent([[-180,-90+Ta],[180,90-Ta]]).minorExtent([[-180,-80-Ta],[180,80+Ta]])},ta.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||u.apply(this,arguments)]}}var t,e,r=yr,u=Mr;return n.distance=function(){return ta.geo.distance(t||r.apply(this,arguments),e||u.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(u=t,e="function"==typeof t?null:t,n):u},n.precision=function(){return arguments.length?n:0},n},ta.geo.interpolate=function(n,t){return xr(n[0]*Fa,n[1]*Fa,t[0]*Fa,t[1]*Fa)},ta.geo.length=function(n){return $c=0,ta.geo.stream(n,Bc),$c};var $c,Bc={sphere:y,point:y,lineStart:br,lineEnd:y,polygonStart:y,polygonEnd:y},Wc=_r(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(ta.geo.azimuthalEqualArea=function(){return ir(Wc)}).raw=Wc;var Jc=_r(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},At);(ta.geo.azimuthalEquidistant=function(){return ir(Jc)}).raw=Jc,(ta.geo.conicConformal=function(){return Ze(wr)}).raw=wr,(ta.geo.conicEquidistant=function(){return Ze(Sr)}).raw=Sr;var Gc=_r(function(n){return 1/n},Math.atan);(ta.geo.gnomonic=function(){return ir(Gc)}).raw=Gc,kr.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-ja]},(ta.geo.mercator=function(){return Er(kr)}).raw=kr;var Kc=_r(function(){return 1},Math.asin);(ta.geo.orthographic=function(){return ir(Kc)}).raw=Kc;var Qc=_r(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(ta.geo.stereographic=function(){return ir(Qc)}).raw=Qc,Ar.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-ja]},(ta.geo.transverseMercator=function(){var n=Er(Ar),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Ar,ta.geom={},ta.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,u=Et(e),i=Et(r),o=n.length,a=[],c=[];for(t=0;o>t;t++)a.push([+u.call(this,n[t],t),+i.call(this,n[t],t),t]);for(a.sort(qr),t=0;o>t;t++)c.push([a[t][0],-a[t][1]]);var l=zr(a),s=zr(c),f=s[0]===l[0],h=s[s.length-1]===l[l.length-1],g=[];for(t=l.length-1;t>=0;--t)g.push(n[a[l[t]][2]]);for(t=+f;t<s.length-h;++t)g.push(n[a[s[t]][2]]);return g}var e=Nr,r=Cr;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t)},ta.geom.polygon=function(n){return xa(n,nl),n};var nl=ta.geom.polygon.prototype=[];nl.area=function(){for(var n,t=-1,e=this.length,r=this[e-1],u=0;++t<e;)n=r,r=this[t],u+=n[1]*r[0]-n[0]*r[1];return.5*u},nl.centroid=function(n){var t,e,r=-1,u=this.length,i=0,o=0,a=this[u-1];for(arguments.length||(n=-1/(6*this.area()));++r<u;)t=a,a=this[r],e=t[0]*a[1]-a[0]*t[1],i+=(t[0]+a[0])*e,o+=(t[1]+a[1])*e;return[i*n,o*n]},nl.clip=function(n){for(var t,e,r,u,i,o,a=Rr(n),c=-1,l=this.length-Rr(this),s=this[l-1];++c<l;){for(t=n.slice(),n.length=0,u=this[c],i=t[(r=t.length-a)-1],e=-1;++e<r;)o=t[e],Lr(o,s,u)?(Lr(i,s,u)||n.push(Tr(i,o,s,u)),n.push(o)):Lr(i,s,u)&&n.push(Tr(i,o,s,u)),i=o;a&&n.push(n[0]),s=u}return n};var tl,el,rl,ul,il,ol=[],al=[];Yr.prototype.prepare=function(){for(var n,t=this.edges,e=t.length;e--;)n=t[e].edge,n.b&&n.a||t.splice(e,1);return t.sort(Zr),t.length},nu.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},tu.prototype={insert:function(n,t){var e,r,u;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=iu(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)r=e.U,e===r.L?(u=r.R,u&&u.C?(e.C=u.C=!1,r.C=!0,n=r):(n===e.R&&(ru(this,e),n=e,e=n.U),e.C=!1,r.C=!0,uu(this,r))):(u=r.L,u&&u.C?(e.C=u.C=!1,r.C=!0,n=r):(n===e.L&&(uu(this,e),n=e,e=n.U),e.C=!1,r.C=!0,ru(this,r))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t,e,r,u=n.U,i=n.L,o=n.R;if(e=i?o?iu(o):i:o,u?u.L===n?u.L=e:u.R=e:this._=e,i&&o?(r=e.C,e.C=n.C,e.L=i,i.U=e,e!==o?(u=e.U,e.U=n.U,n=e.R,u.L=n,e.R=o,o.U=e):(e.U=u,u=e,n=e.R)):(r=n.C,n=e),n&&(n.U=u),!r){if(n&&n.C)return n.C=!1,void 0;do{if(n===this._)break;if(n===u.L){if(t=u.R,t.C&&(t.C=!1,u.C=!0,ru(this,u),t=u.R),t.L&&t.L.C||t.R&&t.R.C){t.R&&t.R.C||(t.L.C=!1,t.C=!0,uu(this,t),t=u.R),t.C=u.C,u.C=t.R.C=!1,ru(this,u),n=this._;break}}else if(t=u.L,t.C&&(t.C=!1,u.C=!0,uu(this,u),t=u.L),t.L&&t.L.C||t.R&&t.R.C){t.L&&t.L.C||(t.R.C=!1,t.C=!0,ru(this,t),t=u.L),t.C=u.C,u.C=t.L.C=!1,uu(this,u),n=this._;break}t.C=!0,n=u,u=u.U}while(!n.C);n&&(n.C=!1)}}},ta.geom.voronoi=function(n){function t(n){var t=new Array(n.length),r=a[0][0],u=a[0][1],i=a[1][0],o=a[1][1];return ou(e(n),a).cells.forEach(function(e,a){var c=e.edges,l=e.site,s=t[a]=c.length?c.map(function(n){var t=n.start();return[t.x,t.y]}):l.x>=r&&l.x<=i&&l.y>=u&&l.y<=o?[[r,o],[i,o],[i,u],[r,u]]:[];s.point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(i(n,t)/Ta)*Ta,y:Math.round(o(n,t)/Ta)*Ta,i:t}})}var r=Nr,u=Cr,i=r,o=u,a=cl;return n?t(n):(t.links=function(n){return ou(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return ou(e(n)).cells.forEach(function(e,r){for(var u,i,o=e.site,a=e.edges.sort(Zr),c=-1,l=a.length,s=a[l-1].edge,f=s.l===o?s.r:s.l;++c<l;)u=s,i=f,s=a[c].edge,f=s.l===o?s.r:s.l,r<i.i&&r<f.i&&cu(o,i,f)<0&&t.push([n[r],n[i.i],n[f.i]])}),t},t.x=function(n){return arguments.length?(i=Et(r=n),t):r},t.y=function(n){return arguments.length?(o=Et(u=n),t):u},t.clipExtent=function(n){return arguments.length?(a=null==n?cl:n,t):a===cl?null:a},t.size=function(n){return arguments.length?t.clipExtent(n&&[[0,0],n]):a===cl?null:a&&a[1]},t)};var cl=[[-1e6,-1e6],[1e6,1e6]];ta.geom.delaunay=function(n){return ta.geom.voronoi().triangles(n)},ta.geom.quadtree=function(n,t,e,r,u){function i(n){function i(n,t,e,r,u,i,o,a){if(!isNaN(e)&&!isNaN(r))if(n.leaf){var c=n.x,s=n.y;if(null!=c)if(va(c-e)+va(s-r)<.01)l(n,t,e,r,u,i,o,a);else{var f=n.point;n.x=n.y=n.point=null,l(n,f,c,s,u,i,o,a),l(n,t,e,r,u,i,o,a)}else n.x=e,n.y=r,n.point=t}else l(n,t,e,r,u,i,o,a)}function l(n,t,e,r,u,o,a,c){var l=.5*(u+a),s=.5*(o+c),f=e>=l,h=r>=s,g=h<<1|f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=fu()),f?u=l:a=l,h?o=s:c=s,i(n,t,e,r,u,o,a,c)}var s,f,h,g,p,v,d,m,y,M=Et(a),x=Et(c);if(null!=t)v=t,d=e,m=r,y=u;else if(m=y=-(v=d=1/0),f=[],h=[],p=n.length,o)for(g=0;p>g;++g)s=n[g],s.x<v&&(v=s.x),s.y<d&&(d=s.y),s.x>m&&(m=s.x),s.y>y&&(y=s.y),f.push(s.x),h.push(s.y);else for(g=0;p>g;++g){var b=+M(s=n[g],g),_=+x(s,g);v>b&&(v=b),d>_&&(d=_),b>m&&(m=b),_>y&&(y=_),f.push(b),h.push(_)}var w=m-v,S=y-d;w>S?y=d+w:m=v+S;var k=fu();if(k.add=function(n){i(k,n,+M(n,++g),+x(n,g),v,d,m,y)},k.visit=function(n){hu(n,k,v,d,m,y)},k.find=function(n){return gu(k,n[0],n[1],v,d,m,y)},g=-1,null==t){for(;++g<p;)i(k,n[g],f[g],h[g],v,d,m,y);--g}else n.forEach(k.add);return f=h=n=s=null,k}var o,a=Nr,c=Cr;return(o=arguments.length)?(a=lu,c=su,3===o&&(u=e,r=t,e=t=0),i(n)):(i.x=function(n){return arguments.length?(a=n,i):a},i.y=function(n){return arguments.length?(c=n,i):c},i.extent=function(n){return arguments.length?(null==n?t=e=r=u=null:(t=+n[0][0],e=+n[0][1],r=+n[1][0],u=+n[1][1]),i):null==t?null:[[t,e],[r,u]]},i.size=function(n){return arguments.length?(null==n?t=e=r=u=null:(t=e=0,r=+n[0],u=+n[1]),i):null==t?null:[r-t,u-e]},i)},ta.interpolateRgb=pu,ta.interpolateObject=vu,ta.interpolateNumber=du,ta.interpolateString=mu;var ll=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sl=new RegExp(ll.source,"g");ta.interpolate=yu,ta.interpolators=[function(n,t){var e=typeof t;return("string"===e?tc.has(t)||/^(#|rgb\(|hsl\()/.test(t)?pu:mu:t instanceof ot?pu:Array.isArray(t)?Mu:"object"===e&&isNaN(t)?vu:du)(n,t)}],ta.interpolateArray=Mu;var fl=function(){return At},hl=ta.map({linear:fl,poly:Eu,quad:function(){return wu},cubic:function(){return Su},sin:function(){return Au},exp:function(){return Nu},circle:function(){return Cu},elastic:zu,back:qu,bounce:function(){return Lu}}),gl=ta.map({"in":At,out:bu,"in-out":_u,"out-in":function(n){return _u(bu(n))}});ta.ease=function(n){var t=n.indexOf("-"),e=t>=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=hl.get(e)||fl,r=gl.get(r)||At,xu(r(e.apply(null,ea.call(arguments,1))))},ta.interpolateHcl=Tu,ta.interpolateHsl=Ru,ta.interpolateLab=Du,ta.interpolateRound=Pu,ta.transform=function(n){var t=ua.createElementNS(ta.ns.prefix.svg,"g");return(ta.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Uu(e?e.matrix:pl)})(n)},Uu.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var pl={a:1,b:0,c:0,d:1,e:0,f:0};ta.interpolateTransform=Ou,ta.layout={},ta.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e<r;)t.push(Zu(n[e]));return t}},ta.layout.chord=function(){function n(){var n,l,f,h,g,p={},v=[],d=ta.range(i),m=[];for(e=[],r=[],n=0,h=-1;++h<i;){for(l=0,g=-1;++g<i;)l+=u[h][g];v.push(l),m.push(ta.range(i)),n+=l}for(o&&d.sort(function(n,t){return o(v[n],v[t])}),a&&m.forEach(function(n,t){n.sort(function(n,e){return a(u[t][n],u[t][e])})}),n=(Pa-s*i)/n,l=0,h=-1;++h<i;){for(f=l,g=-1;++g<i;){var y=d[h],M=m[y][g],x=u[y][M],b=l,_=l+=x*n;p[y+"-"+M]={index:y,subindex:M,startAngle:b,endAngle:_,value:x}}r[y]={index:y,startAngle:f,endAngle:l,value:(l-f)/n},l+=s}for(h=-1;++h<i;)for(g=h-1;++g<i;){var w=p[h+"-"+g],S=p[g+"-"+h];(w.value||S.value)&&e.push(w.value<S.value?{source:S,target:w}:{source:w,target:S})}c&&t()}function t(){e.sort(function(n,t){return c((n.source.value+n.target.value)/2,(t.source.value+t.target.value)/2)})}var e,r,u,i,o,a,c,l={},s=0;return l.matrix=function(n){return arguments.length?(i=(u=n)&&u.length,e=r=null,l):u},l.padding=function(n){return arguments.length?(s=n,e=r=null,l):s},l.sortGroups=function(n){return arguments.length?(o=n,e=r=null,l):o},l.sortSubgroups=function(n){return arguments.length?(a=n,e=null,l):a},l.sortChords=function(n){return arguments.length?(c=n,e&&t(),l):c},l.chords=function(){return e||n(),e},l.groups=function(){return r||n(),r},l},ta.layout.force=function(){function n(n){return function(t,e,r,u){if(t.point!==n){var i=t.cx-n.x,o=t.cy-n.y,a=u-e,c=i*i+o*o;if(c>a*a/d){if(p>c){var l=t.charge/c;n.px-=i*l,n.py-=o*l}return!0}if(t.point&&c&&p>c){var l=t.pointCharge/c;n.px-=i*l,n.py-=o*l}}return!t.charge}}function t(n){n.px=ta.event.x,n.py=ta.event.y,a.resume()}var e,r,u,i,o,a={},c=ta.dispatch("start","tick","end"),l=[1,1],s=.9,f=vl,h=dl,g=-30,p=ml,v=.1,d=.64,m=[],y=[];return a.tick=function(){if((r*=.99)<.005)return c.end({type:"end",alpha:r=0}),!0;var t,e,a,f,h,p,d,M,x,b=m.length,_=y.length;for(e=0;_>e;++e)a=y[e],f=a.source,h=a.target,M=h.x-f.x,x=h.y-f.y,(p=M*M+x*x)&&(p=r*i[e]*((p=Math.sqrt(p))-u[e])/p,M*=p,x*=p,h.x-=M*(d=f.weight/(h.weight+f.weight)),h.y-=x*d,f.x+=M*(d=1-d),f.y+=x*d);if((d=r*v)&&(M=l[0]/2,x=l[1]/2,e=-1,d))for(;++e<b;)a=m[e],a.x+=(M-a.x)*d,a.y+=(x-a.y)*d;if(g)for(Gu(t=ta.geom.quadtree(m),r,o),e=-1;++e<b;)(a=m[e]).fixed||t.visit(n(a));for(e=-1;++e<b;)a=m[e],a.fixed?(a.x=a.px,a.y=a.py):(a.x-=(a.px-(a.px=a.x))*s,a.y-=(a.py-(a.py=a.y))*s);c.tick({type:"tick",alpha:r})},a.nodes=function(n){return arguments.length?(m=n,a):m},a.links=function(n){return arguments.length?(y=n,a):y},a.size=function(n){return arguments.length?(l=n,a):l},a.linkDistance=function(n){return arguments.length?(f="function"==typeof n?n:+n,a):f},a.distance=a.linkDistance,a.linkStrength=function(n){return arguments.length?(h="function"==typeof n?n:+n,a):h},a.friction=function(n){return arguments.length?(s=+n,a):s},a.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,a):g},a.chargeDistance=function(n){return arguments.length?(p=n*n,a):Math.sqrt(p)},a.gravity=function(n){return arguments.length?(v=+n,a):v},a.theta=function(n){return arguments.length?(d=n*n,a):Math.sqrt(d)},a.alpha=function(n){return arguments.length?(n=+n,r?r=n>0?n:0:n>0&&(c.start({type:"start",alpha:r=n}),ta.timer(a.tick)),a):r},a.start=function(){function n(n,r){if(!e){for(e=new Array(c),a=0;c>a;++a)e[a]=[];for(a=0;l>a;++a){var u=y[a];e[u.source.index].push(u.target),e[u.target.index].push(u.source)}}for(var i,o=e[t],a=-1,l=o.length;++a<l;)if(!isNaN(i=o[a][n]))return i;return Math.random()*r}var t,e,r,c=m.length,s=y.length,p=l[0],v=l[1];for(t=0;c>t;++t)(r=m[t]).index=t,r.weight=0;for(t=0;s>t;++t)r=y[t],"number"==typeof r.source&&(r.source=m[r.source]),"number"==typeof r.target&&(r.target=m[r.target]),++r.source.weight,++r.target.weight;for(t=0;c>t;++t)r=m[t],isNaN(r.x)&&(r.x=n("x",p)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(u=[],"function"==typeof f)for(t=0;s>t;++t)u[t]=+f.call(this,y[t],t);else for(t=0;s>t;++t)u[t]=f;if(i=[],"function"==typeof h)for(t=0;s>t;++t)i[t]=+h.call(this,y[t],t);else for(t=0;s>t;++t)i[t]=h;if(o=[],"function"==typeof g)for(t=0;c>t;++t)o[t]=+g.call(this,m[t],t);else for(t=0;c>t;++t)o[t]=g;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){return e||(e=ta.behavior.drag().origin(At).on("dragstart.force",$u).on("drag.force",t).on("dragend.force",Bu)),arguments.length?(this.on("mouseover.force",Wu).on("mouseout.force",Ju).call(e),void 0):e},ta.rebind(a,c,"on")};var vl=20,dl=1,ml=1/0;ta.layout.hierarchy=function(){function n(u){var i,o=[u],a=[];for(u.depth=0;null!=(i=o.pop());)if(a.push(i),(l=e.call(n,i,i.depth))&&(c=l.length)){for(var c,l,s;--c>=0;)o.push(s=l[c]),s.parent=i,s.depth=i.depth+1;r&&(i.value=0),i.children=l}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return ni(u,function(n){var e,u;t&&(e=n.children)&&e.sort(t),r&&(u=n.parent)&&(u.value+=n.value)}),a}var t=ri,e=ti,r=ei;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(Qu(t,function(n){n.children&&(n.value=0)}),ni(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},ta.layout.partition=function(){function n(t,e,r,u){var i=t.children;if(t.x=e,t.y=t.depth*u,t.dx=r,t.dy=u,i&&(o=i.length)){var o,a,c,l=-1;for(r=t.value?r/t.value:0;++l<o;)n(a=i[l],e,c=a.value*r,u),e+=c}}function t(n){var e=n.children,r=0;if(e&&(u=e.length))for(var u,i=-1;++i<u;)r=Math.max(r,t(e[i]));return 1+r}function e(e,i){var o=r.call(this,e,i);return n(o[0],0,u[0],u[1]/t(o[0])),o}var r=ta.layout.hierarchy(),u=[1,1];return e.size=function(n){return arguments.length?(u=n,e):u},Ku(e,r)},ta.layout.pie=function(){function n(o){var a,c=o.length,l=o.map(function(e,r){return+t.call(n,e,r)}),s=+("function"==typeof r?r.apply(this,arguments):r),f=("function"==typeof u?u.apply(this,arguments):u)-s,h=Math.min(Math.abs(f)/c,+("function"==typeof i?i.apply(this,arguments):i)),g=h*(0>f?-1:1),p=(f-c*g)/ta.sum(l),v=ta.range(c),d=[];return null!=e&&v.sort(e===yl?function(n,t){return l[t]-l[n]}:function(n,t){return e(o[n],o[t])}),v.forEach(function(n){d[n]={data:o[n],value:a=l[n],startAngle:s,endAngle:s+=a*p+g,padAngle:h}}),d}var t=Number,e=yl,r=0,u=Pa,i=0;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(u=t,n):u},n.padAngle=function(t){return arguments.length?(i=t,n):i},n};var yl={};ta.layout.stack=function(){function n(a,c){if(!(h=a.length))return a;var l=a.map(function(e,r){return t.call(n,e,r)}),s=l.map(function(t){return t.map(function(t,e){return[i.call(n,t,e),o.call(n,t,e)]})}),f=e.call(n,s,c);l=ta.permute(l,f),s=ta.permute(s,f);var h,g,p,v,d=r.call(n,s,c),m=l[0].length;for(p=0;m>p;++p)for(u.call(n,l[0][p],v=d[p],s[0][p][1]),g=1;h>g;++g)u.call(n,l[g][p],v+=s[g-1][p][1],s[g][p][1]);return a}var t=At,e=ci,r=li,u=ai,i=ii,o=oi;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:Ml.get(t)||ci,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:xl.get(t)||li,n):r},n.x=function(t){return arguments.length?(i=t,n):i},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(u=t,n):u},n};var Ml=ta.map({"inside-out":function(n){var t,e,r=n.length,u=n.map(si),i=n.map(fi),o=ta.range(r).sort(function(n,t){return u[n]-u[t]}),a=0,c=0,l=[],s=[];for(t=0;r>t;++t)e=o[t],c>a?(a+=i[e],l.push(e)):(c+=i[e],s.push(e));return s.reverse().concat(l)},reverse:function(n){return ta.range(n.length).reverse()},"default":ci}),xl=ta.map({silhouette:function(n){var t,e,r,u=n.length,i=n[0].length,o=[],a=0,c=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;i>e;++e)c[e]=(a-o[e])/2;return c},wiggle:function(n){var t,e,r,u,i,o,a,c,l,s=n.length,f=n[0],h=f.length,g=[];for(g[0]=c=l=0,e=1;h>e;++e){for(t=0,u=0;s>t;++t)u+=n[t][e][1];for(t=0,i=0,a=f[e][0]-f[e-1][0];s>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;i+=o*n[t][e][1]}g[e]=c-=u?i/u*a:0,l>c&&(l=c)}for(e=0;h>e;++e)g[e]-=l;return g},expand:function(n){var t,e,r,u=n.length,i=n[0].length,o=1/u,a=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];if(r)for(t=0;u>t;t++)n[t][e][1]/=r;else for(t=0;u>t;t++)n[t][e][1]=o}for(e=0;i>e;++e)a[e]=0;return a},zero:li});ta.layout.histogram=function(){function n(n,i){for(var o,a,c=[],l=n.map(e,this),s=r.call(this,l,i),f=u.call(this,s,l,i),i=-1,h=l.length,g=f.length-1,p=t?1:1/h;++i<g;)o=c[i]=[],o.dx=f[i+1]-(o.x=f[i]),o.y=0;if(g>0)for(i=-1;++i<h;)a=l[i],a>=s[0]&&a<=s[1]&&(o=c[ta.bisect(f,a,1,g)-1],o.y+=p,o.push(n[i]));return c}var t=!0,e=Number,r=vi,u=gi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=Et(t),n):r},n.bins=function(t){return arguments.length?(u="number"==typeof t?function(n){return pi(n,t)}:Et(t),n):u},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},ta.layout.pack=function(){function n(n,i){var o=e.call(this,n,i),a=o[0],c=u[0],l=u[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,ni(a,function(n){n.r=+s(n.value)}),ni(a,xi),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/l))/2;ni(a,function(n){n.r+=f}),ni(a,xi),ni(a,function(n){n.r-=f})}return wi(a,c/2,l/2,t?1:1/Math.max(2*a.r/c,2*a.r/l)),o}var t,e=ta.layout.hierarchy().sort(di),r=0,u=[1,1];return n.size=function(t){return arguments.length?(u=t,n):u},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},Ku(n,e)},ta.layout.tree=function(){function n(n,u){var s=o.call(this,n,u),f=s[0],h=t(f);if(ni(h,e),h.parent.m=-h.z,Qu(h,r),l)Qu(f,i);else{var g=f,p=f,v=f;Qu(f,function(n){n.x<g.x&&(g=n),n.x>p.x&&(p=n),n.depth>v.depth&&(v=n)});var d=a(g,p)/2-g.x,m=c[0]/(p.x+a(p,g)/2+d),y=c[1]/(v.depth||1);Qu(f,function(n){n.x=(n.x+d)*m,n.y=n.depth*y})}return s}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var u,i=t.children,o=0,a=i.length;a>o;++o)r.push((i[o]=u={_:i[o],parent:t,children:(u=i[o].children)&&u.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=u);return e.children[0]}function e(n){var t=n.children,e=n.parent.children,r=n.i?e[n.i-1]:null;if(t.length){Ci(n);var i=(t[0].z+t[t.length-1].z)/2;r?(n.z=r.z+a(n._,r._),n.m=n.z-i):n.z=i}else r&&(n.z=r.z+a(n._,r._));n.parent.A=u(n,r,n.parent.A||e[0])}function r(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function u(n,t,e){if(t){for(var r,u=n,i=n,o=t,c=u.parent.children[0],l=u.m,s=i.m,f=o.m,h=c.m;o=Ai(o),u=Ei(u),o&&u;)c=Ei(c),i=Ai(i),i.a=n,r=o.z+f-u.z-l+a(o._,u._),r>0&&(Ni(zi(o,n,e),n,r),l+=r,s+=r),f+=o.m,l+=u.m,h+=c.m,s+=i.m;o&&!Ai(i)&&(i.t=o,i.m+=f-s),u&&!Ei(c)&&(c.t=u,c.m+=l-h,e=n)}return e}function i(n){n.x*=c[0],n.y=n.depth*c[1]}var o=ta.layout.hierarchy().sort(null).value(null),a=ki,c=[1,1],l=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(l=null==(c=t)?i:null,n):l?null:c},n.nodeSize=function(t){return arguments.length?(l=null==(c=t)?null:i,n):l?c:null},Ku(n,o)},ta.layout.cluster=function(){function n(n,i){var o,a=t.call(this,n,i),c=a[0],l=0;ni(c,function(n){var t=n.children;t&&t.length?(n.x=Li(t),n.y=qi(t)):(n.x=o?l+=e(n,o):0,n.y=0,o=n)});var s=Ti(c),f=Ri(c),h=s.x-e(s,f)/2,g=f.x+e(f,s)/2;return ni(c,u?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=ta.layout.hierarchy().sort(null).value(null),e=ki,r=[1,1],u=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(u=null==(r=t),n):u?null:r},n.nodeSize=function(t){return arguments.length?(u=null!=(r=t),n):u?r:null},Ku(n,t)},ta.layout.treemap=function(){function n(n,t){for(var e,r,u=-1,i=n.length;++u<i;)r=(e=n[u]).value*(0>t?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var i=e.children;if(i&&i.length){var o,a,c,l=f(e),s=[],h=i.slice(),p=1/0,v="slice"===g?l.dx:"dice"===g?l.dy:"slice-dice"===g?1&e.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(n(h,l.dx*l.dy/e.value),s.area=0;(c=h.length)>0;)s.push(o=h[c-1]),s.area+=o.area,"squarify"!==g||(a=r(s,v))<=p?(h.pop(),p=a):(s.area-=s.pop().area,u(s,v,l,!1),v=Math.min(l.dx,l.dy),s.length=s.area=0,p=1/0);s.length&&(u(s,v,l,!0),s.length=s.area=0),i.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var i,o=f(t),a=r.slice(),c=[];for(n(a,o.dx*o.dy/t.value),c.area=0;i=a.pop();)c.push(i),c.area+=i.area,null!=i.z&&(u(c,i.z?o.dx:o.dy,o,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,u=0,i=1/0,o=-1,a=n.length;++o<a;)(e=n[o].area)&&(i>e&&(i=e),e>u&&(u=e));return r*=r,t*=t,r?Math.max(t*u*p/r,r/(t*i*p)):1/0}function u(n,t,e,r){var u,i=-1,o=n.length,a=e.x,l=e.y,s=t?c(n.area/t):0;if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);++i<o;)u=n[i],u.x=a,u.y=l,u.dy=s,a+=u.dx=Math.min(e.x+e.dx-a,s?c(u.area/s):0);u.z=!0,u.dx+=e.x+e.dx-a,e.y+=s,e.dy-=s}else{for((r||s>e.dx)&&(s=e.dx);++i<o;)u=n[i],u.x=a,u.y=l,u.dx=s,l+=u.dy=Math.min(e.y+e.dy-l,s?c(u.area/s):0);u.z=!1,u.dy+=e.y+e.dy-l,e.x+=s,e.dx-=s}}function i(r){var u=o||a(r),i=u[0];return i.x=0,i.y=0,i.dx=l[0],i.dy=l[1],o&&a.revalue(i),n([i],i.dx*i.dy/i.value),(o?e:t)(i),h&&(o=u),u}var o,a=ta.layout.hierarchy(),c=Math.round,l=[1,1],s=null,f=Di,h=!1,g="squarify",p=.5*(1+Math.sqrt(5));return i.size=function(n){return arguments.length?(l=n,i):l},i.padding=function(n){function t(t){var e=n.call(i,t,t.depth);return null==e?Di(t):Pi(t,"number"==typeof e?[e,e,e,e]:e)}function e(t){return Pi(t,n)}if(!arguments.length)return s;var r;return f=null==(s=n)?Di:"function"==(r=typeof n)?t:"number"===r?(n=[n,n,n,n],e):e,i},i.round=function(n){return arguments.length?(c=n?Math.round:Number,i):c!=Number},i.sticky=function(n){return arguments.length?(h=n,o=null,i):h},i.ratio=function(n){return arguments.length?(p=n,i):p},i.mode=function(n){return arguments.length?(g=n+"",i):g},Ku(i,a)},ta.random={normal:function(n,t){var e=arguments.length;return 2>e&&(t=1),1>e&&(n=0),function(){var e,r,u;do e=2*Math.random()-1,r=2*Math.random()-1,u=e*e+r*r;while(!u||u>1);return n+t*e*Math.sqrt(-2*Math.log(u)/u)
+}},logNormal:function(){var n=ta.random.normal.apply(ta,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=ta.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},ta.scale={};var bl={floor:At,ceil:At};ta.scale.linear=function(){return Ii([0,1],[0,1],yu,!1)};var _l={s:1,g:1,p:1,r:1,e:1};ta.scale.log=function(){return Gi(ta.scale.linear().domain([0,1]),10,!0,[1,10])};var wl=ta.format(".0e"),Sl={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};ta.scale.pow=function(){return Ki(ta.scale.linear(),1,[0,1])},ta.scale.sqrt=function(){return ta.scale.pow().exponent(.5)},ta.scale.ordinal=function(){return no([],{t:"range",a:[[]]})},ta.scale.category10=function(){return ta.scale.ordinal().range(kl)},ta.scale.category20=function(){return ta.scale.ordinal().range(El)},ta.scale.category20b=function(){return ta.scale.ordinal().range(Al)},ta.scale.category20c=function(){return ta.scale.ordinal().range(Nl)};var kl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(Mt),El=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(Mt),Al=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(Mt),Nl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(Mt);ta.scale.quantile=function(){return to([],[])},ta.scale.quantize=function(){return eo(0,1,[0,1])},ta.scale.threshold=function(){return ro([.5],[0,1])},ta.scale.identity=function(){return uo([0,1])},ta.svg={},ta.svg.arc=function(){function n(){var n=Math.max(0,+e.apply(this,arguments)),l=Math.max(0,+r.apply(this,arguments)),s=o.apply(this,arguments)-ja,f=a.apply(this,arguments)-ja,h=Math.abs(f-s),g=s>f?0:1;if(n>l&&(p=l,l=n,n=p),h>=Ua)return t(l,g)+(n?t(n,1-g):"")+"Z";var p,v,d,m,y,M,x,b,_,w,S,k,E=0,A=0,N=[];if((m=(+c.apply(this,arguments)||0)/2)&&(d=i===Cl?Math.sqrt(n*n+l*l):+i.apply(this,arguments),g||(A*=-1),l&&(A=tt(d/l*Math.sin(m))),n&&(E=tt(d/n*Math.sin(m)))),l){y=l*Math.cos(s+A),M=l*Math.sin(s+A),x=l*Math.cos(f-A),b=l*Math.sin(f-A);var C=Math.abs(f-s-2*A)<=Da?0:1;if(A&&fo(y,M,x,b)===g^C){var z=(s+f)/2;y=l*Math.cos(z),M=l*Math.sin(z),x=b=null}}else y=M=0;if(n){_=n*Math.cos(f-E),w=n*Math.sin(f-E),S=n*Math.cos(s+E),k=n*Math.sin(s+E);var q=Math.abs(s-f+2*E)<=Da?0:1;if(E&&fo(_,w,S,k)===1-g^q){var L=(s+f)/2;_=n*Math.cos(L),w=n*Math.sin(L),S=k=null}}else _=w=0;if((p=Math.min(Math.abs(l-n)/2,+u.apply(this,arguments)))>.001){v=l>n^g?0:1;var T=null==S?[_,w]:null==x?[y,M]:Tr([y,M],[S,k],[x,b],[_,w]),R=y-T[0],D=M-T[1],P=x-T[0],U=b-T[1],j=1/Math.sin(Math.acos((R*P+D*U)/(Math.sqrt(R*R+D*D)*Math.sqrt(P*P+U*U)))/2),F=Math.sqrt(T[0]*T[0]+T[1]*T[1]);if(null!=x){var H=Math.min(p,(l-F)/(j+1)),O=ho(null==S?[_,w]:[S,k],[y,M],l,H,g),Y=ho([x,b],[_,w],l,H,g);p===H?N.push("M",O[0],"A",H,",",H," 0 0,",v," ",O[1],"A",l,",",l," 0 ",1-g^fo(O[1][0],O[1][1],Y[1][0],Y[1][1]),",",g," ",Y[1],"A",H,",",H," 0 0,",v," ",Y[0]):N.push("M",O[0],"A",H,",",H," 0 1,",v," ",Y[0])}else N.push("M",y,",",M);if(null!=S){var I=Math.min(p,(n-F)/(j-1)),Z=ho([y,M],[S,k],n,-I,g),V=ho([_,w],null==x?[y,M]:[x,b],n,-I,g);p===I?N.push("L",V[0],"A",I,",",I," 0 0,",v," ",V[1],"A",n,",",n," 0 ",g^fo(V[1][0],V[1][1],Z[1][0],Z[1][1]),",",1-g," ",Z[1],"A",I,",",I," 0 0,",v," ",Z[0]):N.push("L",V[0],"A",I,",",I," 0 0,",v," ",Z[0])}else N.push("L",_,",",w)}else N.push("M",y,",",M),null!=x&&N.push("A",l,",",l," 0 ",C,",",g," ",x,",",b),N.push("L",_,",",w),null!=S&&N.push("A",n,",",n," 0 ",q,",",1-g," ",S,",",k);return N.push("Z"),N.join("")}function t(n,t){return"M0,"+n+"A"+n+","+n+" 0 1,"+t+" 0,"+-n+"A"+n+","+n+" 0 1,"+t+" 0,"+n}var e=oo,r=ao,u=io,i=Cl,o=co,a=lo,c=so;return n.innerRadius=function(t){return arguments.length?(e=Et(t),n):e},n.outerRadius=function(t){return arguments.length?(r=Et(t),n):r},n.cornerRadius=function(t){return arguments.length?(u=Et(t),n):u},n.padRadius=function(t){return arguments.length?(i=t==Cl?Cl:Et(t),n):i},n.startAngle=function(t){return arguments.length?(o=Et(t),n):o},n.endAngle=function(t){return arguments.length?(a=Et(t),n):a},n.padAngle=function(t){return arguments.length?(c=Et(t),n):c},n.centroid=function(){var n=(+e.apply(this,arguments)+ +r.apply(this,arguments))/2,t=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-ja;return[Math.cos(t)*n,Math.sin(t)*n]},n};var Cl="auto";ta.svg.line=function(){return go(At)};var zl=ta.map({linear:po,"linear-closed":vo,step:mo,"step-before":yo,"step-after":Mo,basis:ko,"basis-open":Eo,"basis-closed":Ao,bundle:No,cardinal:_o,"cardinal-open":xo,"cardinal-closed":bo,monotone:Ro});zl.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var ql=[0,2/3,1/3,0],Ll=[0,1/3,2/3,0],Tl=[0,1/6,2/3,1/6];ta.svg.line.radial=function(){var n=go(Do);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},yo.reverse=Mo,Mo.reverse=yo,ta.svg.area=function(){return Po(At)},ta.svg.area.radial=function(){var n=Po(Do);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},ta.svg.chord=function(){function n(n,a){var c=t(this,i,n,a),l=t(this,o,n,a);return"M"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(e(c,l)?u(c.r,c.p1,c.r,c.p0):u(c.r,c.p1,l.r,l.p0)+r(l.r,l.p1,l.a1-l.a0)+u(l.r,l.p1,c.r,c.p0))+"Z"}function t(n,t,e,r){var u=t.call(n,e,r),i=a.call(n,u,r),o=c.call(n,u,r)-ja,s=l.call(n,u,r)-ja;return{r:i,a0:o,a1:s,p0:[i*Math.cos(o),i*Math.sin(o)],p1:[i*Math.cos(s),i*Math.sin(s)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>Da)+",1 "+t}function u(n,t,e,r){return"Q 0,0 "+r}var i=yr,o=Mr,a=Uo,c=co,l=lo;return n.radius=function(t){return arguments.length?(a=Et(t),n):a},n.source=function(t){return arguments.length?(i=Et(t),n):i},n.target=function(t){return arguments.length?(o=Et(t),n):o},n.startAngle=function(t){return arguments.length?(c=Et(t),n):c},n.endAngle=function(t){return arguments.length?(l=Et(t),n):l},n},ta.svg.diagonal=function(){function n(n,u){var i=t.call(this,n,u),o=e.call(this,n,u),a=(i.y+o.y)/2,c=[i,{x:i.x,y:a},{x:o.x,y:a},o];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=yr,e=Mr,r=jo;return n.source=function(e){return arguments.length?(t=Et(e),n):t},n.target=function(t){return arguments.length?(e=Et(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},ta.svg.diagonal.radial=function(){var n=ta.svg.diagonal(),t=jo,e=n.projection;return n.projection=function(n){return arguments.length?e(Fo(t=n)):t},n},ta.svg.symbol=function(){function n(n,r){return(Rl.get(t.call(this,n,r))||Yo)(e.call(this,n,r))}var t=Oo,e=Ho;return n.type=function(e){return arguments.length?(t=Et(e),n):t},n.size=function(t){return arguments.length?(e=Et(t),n):e},n};var Rl=ta.map({circle:Yo,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*jl)),e=t*jl;return"M0,"+-t+"L"+e+",0"+" 0,"+t+" "+-e+",0"+"Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/Ul),e=t*Ul/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/Ul),e=t*Ul/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});ta.svg.symbolTypes=Rl.keys();var Dl,Pl,Ul=Math.sqrt(3),jl=Math.tan(30*Fa),Fl=[],Hl=0;Fl.call=ka.call,Fl.empty=ka.empty,Fl.node=ka.node,Fl.size=ka.size,ta.transition=function(n){return arguments.length?Dl?n.transition():n:Na.transition()},ta.transition.prototype=Fl,Fl.select=function(n){var t,e,r,u=this.id,i=this.namespace,o=[];n=k(n);for(var a=-1,c=this.length;++a<c;){o.push(t=[]);for(var l=this[a],s=-1,f=l.length;++s<f;)(r=l[s])&&(e=n.call(r,r.__data__,s,a))?("__data__"in r&&(e.__data__=r.__data__),$o(e,s,i,u,r[i][u]),t.push(e)):t.push(null)}return Io(o,i,u)},Fl.selectAll=function(n){var t,e,r,u,i,o=this.id,a=this.namespace,c=[];n=E(n);for(var l=-1,s=this.length;++l<s;)for(var f=this[l],h=-1,g=f.length;++h<g;)if(r=f[h]){i=r[a][o],e=n.call(r,r.__data__,h,l),c.push(t=[]);for(var p=-1,v=e.length;++p<v;)(u=e[p])&&$o(u,p,a,o,i),t.push(u)}return Io(c,a,o)},Fl.filter=function(n){var t,e,r,u=[];"function"!=typeof n&&(n=j(n));for(var i=0,o=this.length;o>i;i++){u.push(t=[]);for(var e=this[i],a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return Io(u,this.namespace,this.id)},Fl.tween=function(n,t){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(n):H(this,null==t?function(t){t[r][e].tween.remove(n)}:function(u){u[r][e].tween.set(n,t)})},Fl.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function u(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function i(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?Ou:yu,a=ta.ns.qualify(n);return Zo(this,"attr."+n,t,a.local?i:u)},Fl.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(u));return r&&function(n){this.setAttribute(u,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(u.space,u.local));return r&&function(n){this.setAttributeNS(u.space,u.local,r(n))}}var u=ta.ns.qualify(n);return this.tween("attr."+n,u.local?r:e)},Fl.style=function(n,t,e){function r(){this.style.removeProperty(n)}function u(t){return null==t?r:(t+="",function(){var r,u=oa.getComputedStyle(this,null).getPropertyValue(n);return u!==t&&(r=yu(u,t),function(t){this.style.setProperty(n,r(t),e)})})}var i=arguments.length;if(3>i){if("string"!=typeof n){2>i&&(t="");for(e in n)this.style(e,n[e],t);return this}e=""}return Zo(this,"style."+n,t,u)},Fl.styleTween=function(n,t,e){function r(r,u){var i=t.call(this,r,u,oa.getComputedStyle(this,null).getPropertyValue(n));return i&&function(t){this.style.setProperty(n,i(t),e)}}return arguments.length<3&&(e=""),this.tween("style."+n,r)},Fl.text=function(n){return Zo(this,"text",n,Vo)},Fl.remove=function(){var n=this.namespace;return this.each("end.transition",function(){var t;this[n].count<2&&(t=this.parentNode)&&t.removeChild(this)})},Fl.ease=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].ease:("function"!=typeof n&&(n=ta.ease.apply(ta,arguments)),H(this,function(r){r[e][t].ease=n}))},Fl.delay=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].delay:H(this,"function"==typeof n?function(r,u,i){r[e][t].delay=+n.call(r,r.__data__,u,i)}:(n=+n,function(r){r[e][t].delay=n}))},Fl.duration=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].duration:H(this,"function"==typeof n?function(r,u,i){r[e][t].duration=Math.max(1,n.call(r,r.__data__,u,i))}:(n=Math.max(1,n),function(r){r[e][t].duration=n}))},Fl.each=function(n,t){var e=this.id,r=this.namespace;if(arguments.length<2){var u=Pl,i=Dl;Dl=e,H(this,function(t,u,i){Pl=t[r][e],n.call(t,t.__data__,u,i)}),Pl=u,Dl=i}else H(this,function(u){var i=u[r][e];(i.event||(i.event=ta.dispatch("start","end","interrupt"))).on(n,t)});return this},Fl.transition=function(){for(var n,t,e,r,u=this.id,i=++Hl,o=this.namespace,a=[],c=0,l=this.length;l>c;c++){a.push(n=[]);for(var t=this[c],s=0,f=t.length;f>s;s++)(e=t[s])&&(r=e[o][u],$o(e,s,o,i,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),n.push(e)}return Io(a,o,i)},ta.svg.axis=function(){function n(n){n.each(function(){var n,l=ta.select(this),s=this.__chart__||e,f=this.__chart__=e.copy(),h=null==c?f.ticks?f.ticks.apply(f,a):f.domain():c,g=null==t?f.tickFormat?f.tickFormat.apply(f,a):At:t,p=l.selectAll(".tick").data(h,f),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Ta),d=ta.transition(p.exit()).style("opacity",Ta).remove(),m=ta.transition(p.order()).style("opacity",1),y=Math.max(u,0)+o,M=ji(f),x=l.selectAll(".domain").data([0]),b=(x.enter().append("path").attr("class","domain"),ta.transition(x));v.append("line"),v.append("text");var _,w,S,k,E=v.select("line"),A=m.select("line"),N=p.select("text").text(g),C=v.select("text"),z=m.select("text"),q="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(n=Bo,_="x",S="y",w="x2",k="y2",N.attr("dy",0>q?"0em":".71em").style("text-anchor","middle"),b.attr("d","M"+M[0]+","+q*i+"V0H"+M[1]+"V"+q*i)):(n=Wo,_="y",S="x",w="y2",k="x2",N.attr("dy",".32em").style("text-anchor",0>q?"end":"start"),b.attr("d","M"+q*i+","+M[0]+"H0V"+M[1]+"H"+q*i)),E.attr(k,q*u),C.attr(S,q*y),A.attr(w,0).attr(k,q*u),z.attr(_,0).attr(S,q*y),f.rangeBand){var L=f,T=L.rangeBand()/2;s=f=function(n){return L(n)+T}}else s.rangeBand?s=f:d.call(n,f,s);v.call(n,s,f),m.call(n,f,f)})}var t,e=ta.scale.linear(),r=Ol,u=6,i=6,o=3,a=[10],c=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Yl?t+"":Ol,n):r},n.ticks=function(){return arguments.length?(a=arguments,n):a},n.tickValues=function(t){return arguments.length?(c=t,n):c},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(u=+t,i=+arguments[e-1],n):u},n.innerTickSize=function(t){return arguments.length?(u=+t,n):u},n.outerTickSize=function(t){return arguments.length?(i=+t,n):i},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var Ol="bottom",Yl={top:1,right:1,bottom:1,left:1};ta.svg.brush=function(){function n(i){i.each(function(){var i=ta.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",u).on("touchstart.brush",u),o=i.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),i.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=i.selectAll(".resize").data(p,At);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return Il[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var s,f=ta.transition(i),h=ta.transition(o);c&&(s=ji(c),h.attr("x",s[0]).attr("width",s[1]-s[0]),e(f)),l&&(s=ji(l),h.attr("y",s[0]).attr("height",s[1]-s[0]),r(f)),t(f)})}function t(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+s[+/e$/.test(n)]+","+f[+/^s/.test(n)]+")"})}function e(n){n.select(".extent").attr("x",s[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",s[1]-s[0])}function r(n){n.select(".extent").attr("y",f[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function u(){function u(){32==ta.event.keyCode&&(N||(y=null,z[0]-=s[1],z[1]-=f[1],N=2),b())}function p(){32==ta.event.keyCode&&2==N&&(z[0]+=s[1],z[1]+=f[1],N=0,b())}function v(){var n=ta.mouse(x),u=!1;M&&(n[0]+=M[0],n[1]+=M[1]),N||(ta.event.altKey?(y||(y=[(s[0]+s[1])/2,(f[0]+f[1])/2]),z[0]=s[+(n[0]<y[0])],z[1]=f[+(n[1]<y[1])]):y=null),E&&d(n,c,0)&&(e(S),u=!0),A&&d(n,l,1)&&(r(S),u=!0),u&&(t(S),w({type:"brush",mode:N?"move":"resize"}))}function d(n,t,e){var r,u,a=ji(t),c=a[0],l=a[1],p=z[e],v=e?f:s,d=v[1]-v[0];return N&&(c-=p,l-=d+p),r=(e?g:h)?Math.max(c,Math.min(l,n[e])):n[e],N?u=(r+=p)+d:(y&&(p=Math.max(c,Math.min(l,2*y[e]-r))),r>p?(u=r,r=p):u=p),v[0]!=r||v[1]!=u?(e?o=null:i=null,v[0]=r,v[1]=u,!0):void 0}function m(){v(),S.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),ta.select("body").style("cursor",null),q.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),C(),w({type:"brushend"})}var y,M,x=this,_=ta.select(ta.event.target),w=a.of(x,arguments),S=ta.select(x),k=_.datum(),E=!/^(n|s)$/.test(k)&&c,A=!/^(e|w)$/.test(k)&&l,N=_.classed("extent"),C=$(),z=ta.mouse(x),q=ta.select(oa).on("keydown.brush",u).on("keyup.brush",p);if(ta.event.changedTouches?q.on("touchmove.brush",v).on("touchend.brush",m):q.on("mousemove.brush",v).on("mouseup.brush",m),S.interrupt().selectAll("*").interrupt(),N)z[0]=s[0]-z[0],z[1]=f[0]-z[1];else if(k){var L=+/w$/.test(k),T=+/^n/.test(k);M=[s[1-L]-z[0],f[1-T]-z[1]],z[0]=s[L],z[1]=f[T]}else ta.event.altKey&&(y=z.slice());S.style("pointer-events","none").selectAll(".resize").style("display",null),ta.select("body").style("cursor",_.style("cursor")),w({type:"brushstart"}),v()}var i,o,a=w(n,"brushstart","brush","brushend"),c=null,l=null,s=[0,0],f=[0,0],h=!0,g=!0,p=Zl[0];return n.event=function(n){n.each(function(){var n=a.of(this,arguments),t={x:s,y:f,i:i,j:o},e=this.__chart__||t;this.__chart__=t,Dl?ta.select(this).transition().each("start.brush",function(){i=e.i,o=e.j,s=e.x,f=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=Mu(s,t.x),r=Mu(f,t.y);return i=o=null,function(u){s=t.x=e(u),f=t.y=r(u),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){i=t.i,o=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,p=Zl[!c<<1|!l],n):c},n.y=function(t){return arguments.length?(l=t,p=Zl[!c<<1|!l],n):l},n.clamp=function(t){return arguments.length?(c&&l?(h=!!t[0],g=!!t[1]):c?h=!!t:l&&(g=!!t),n):c&&l?[h,g]:c?h:l?g:null},n.extent=function(t){var e,r,u,a,h;return arguments.length?(c&&(e=t[0],r=t[1],l&&(e=e[0],r=r[0]),i=[e,r],c.invert&&(e=c(e),r=c(r)),e>r&&(h=e,e=r,r=h),(e!=s[0]||r!=s[1])&&(s=[e,r])),l&&(u=t[0],a=t[1],c&&(u=u[1],a=a[1]),o=[u,a],l.invert&&(u=l(u),a=l(a)),u>a&&(h=u,u=a,a=h),(u!=f[0]||a!=f[1])&&(f=[u,a])),n):(c&&(i?(e=i[0],r=i[1]):(e=s[0],r=s[1],c.invert&&(e=c.invert(e),r=c.invert(r)),e>r&&(h=e,e=r,r=h))),l&&(o?(u=o[0],a=o[1]):(u=f[0],a=f[1],l.invert&&(u=l.invert(u),a=l.invert(a)),u>a&&(h=u,u=a,a=h))),c&&l?[[e,u],[r,a]]:c?[e,r]:l&&[u,a])},n.clear=function(){return n.empty()||(s=[0,0],f=[0,0],i=o=null),n},n.empty=function(){return!!c&&s[0]==s[1]||!!l&&f[0]==f[1]},ta.rebind(n,a,"on")};var Il={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Zl=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Vl=fc.format=mc.timeFormat,Xl=Vl.utc,$l=Xl("%Y-%m-%dT%H:%M:%S.%LZ");Vl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Jo:$l,Jo.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},Jo.toString=$l.toString,fc.second=Ht(function(n){return new hc(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),fc.seconds=fc.second.range,fc.seconds.utc=fc.second.utc.range,fc.minute=Ht(function(n){return new hc(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),fc.minutes=fc.minute.range,fc.minutes.utc=fc.minute.utc.range,fc.hour=Ht(function(n){var t=n.getTimezoneOffset()/60;return new hc(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),fc.hours=fc.hour.range,fc.hours.utc=fc.hour.utc.range,fc.month=Ht(function(n){return n=fc.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),fc.months=fc.month.range,fc.months.utc=fc.month.utc.range;var Bl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Wl=[[fc.second,1],[fc.second,5],[fc.second,15],[fc.second,30],[fc.minute,1],[fc.minute,5],[fc.minute,15],[fc.minute,30],[fc.hour,1],[fc.hour,3],[fc.hour,6],[fc.hour,12],[fc.day,1],[fc.day,2],[fc.week,1],[fc.month,1],[fc.month,3],[fc.year,1]],Jl=Vl.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",Ce]]),Gl={range:function(n,t,e){return ta.range(Math.ceil(n/e)*e,+t,e).map(Ko)},floor:At,ceil:At};Wl.year=fc.year,fc.scale=function(){return Go(ta.scale.linear(),Wl,Jl)};var Kl=Wl.map(function(n){return[n[0].utc,n[1]]}),Ql=Xl.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",Ce]]);Kl.year=fc.year.utc,fc.scale.utc=function(){return Go(ta.scale.linear(),Kl,Ql)},ta.text=Nt(function(n){return n.responseText}),ta.json=function(n,t){return Ct(n,"application/json",Qo,t)},ta.html=function(n,t){return Ct(n,"text/html",na,t)},ta.xml=Nt(function(n){return n.responseXML}),"function"==typeof define&&define.amd?define(ta):"object"==typeof module&&module.exports&&(module.exports=ta),this.d3=ta}(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.layout.cloud.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.layout.cloud.js
new file mode 100644
index 00000000..44c4f7de
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.layout.cloud.js
@@ -0,0 +1,433 @@
+// Word cloud layout by Jason Davies, http://www.jasondavies.com/word-cloud/
+// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf
+(function() {
+ function cloud() {
+ var size = [256, 256],
+ text = cloudText,
+ font = cloudFont,
+ fontSize = cloudFontSize,
+ fontStyle = cloudFontNormal,
+ fontWeight = cloudFontNormal,
+ rotate = cloudRotate,
+ padding = cloudPadding,
+ spiral = archimedeanSpiral,
+ words = [],
+ timeInterval = Infinity,
+ event = d3.dispatch("word", "end"),
+ timer = null,
+ cloud = {};
+
+ cloud.start = function() {
+ var board = zeroArray((size[0] >> 5) * size[1]),
+ bounds = null,
+ n = words.length,
+ i = -1,
+ tags = [],
+ data = words.map(function(d, i) {
+ d.text = text.call(this, d, i);
+ d.font = font.call(this, d, i);
+ d.style = fontStyle.call(this, d, i);
+ d.weight = fontWeight.call(this, d, i);
+ d.rotate = rotate.call(this, d, i);
+ d.size = ~~fontSize.call(this, d, i);
+ d.padding = padding.call(this, d, i);
+ return d;
+ }).sort(function(a, b) { return b.size - a.size; });
+// createMask();
+/* var bd = 3000;
+ while (bd < 4000) {
+ board[bd] = -1;
+ bd++
+ }
+ */
+ function createMask()
+ {
+ d3.select("body").append("canvas").attr("id", "maskCanvas")
+ maskCanvas = document.getElementById('maskCanvas'),
+ maskCanvas.width = 85;
+ maskCanvas.height = 85;
+ maskContext = maskCanvas.getContext('2d');
+ maskImage = new Image();
+ maskImage.src = 'mask.png';
+ maskImage.onload = function(){
+ maskContext.drawImage(maskImage,0,0,85,85 * maskImage.height / maskImage.width);
+ maskData = maskContext.getImageData(0,0,85,85).data;
+/*
+ var hh = 0;
+ while (hh < maskData.length) {
+ if (hh%4 == 0) {
+ if (maskData[hh] == 0) {
+ board[~~(hh/4)] = -1;
+ }
+ }
+ hh++;
+ }
+ */
+
+ }
+ }
+ if (timer) clearInterval(timer);
+ timer = setInterval(step, 0);
+ step();
+
+ return cloud;
+
+ function step() {
+ var start = +new Date,
+ d;
+ while (+new Date - start < timeInterval && ++i < n && timer) {
+ d = data[i];
+ d.x = (size[0] * (Math.random() + .5)) >> 1;
+ d.y = (size[1] * (Math.random() + .5)) >> 1;
+ cloudSprite(d, data, i);
+ if (d.hasText && place(board, d, bounds)) {
+ tags.push(d);
+ event.word(d);
+ if (bounds) cloudBounds(bounds, d);
+ else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: d.y + d.y1}];
+ // Temporary hack
+ d.x -= size[0] >> 1;
+ d.y -= size[1] >> 1;
+ }
+ }
+ if (i >= n) {
+ cloud.stop();
+ event.end(tags, bounds);
+ }
+ }
+ }
+
+ cloud.stop = function() {
+ if (timer) {
+ clearInterval(timer);
+ timer = null;
+ }
+ return cloud;
+ };
+
+ cloud.timeInterval = function(x) {
+ if (!arguments.length) return timeInterval;
+ timeInterval = x == null ? Infinity : x;
+ return cloud;
+ };
+
+ function place(board, tag, bounds) {
+ var perimeter = [{x: 0, y: 0}, {x: size[0], y: size[1]}],
+ startX = tag.x,
+ startY = tag.y,
+ maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]),
+ s = spiral(size),
+ dt = Math.random() < .5 ? 1 : -1,
+ t = -dt,
+ dxdy,
+ dx,
+ dy;
+
+ while (dxdy = s(t += dt)) {
+ dx = ~~dxdy[0];
+ dy = ~~dxdy[1];
+
+ if (Math.min(dx, dy) > maxDelta) break;
+
+ tag.x = startX + dx;
+ tag.y = startY + dy;
+
+ if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 ||
+ tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue;
+ // TODO only check for collisions within current bounds.
+ if (!bounds || !cloudCollide(tag, board, size[0])) {
+ if (!bounds || collideRects(tag, bounds)) {
+ var sprite = tag.sprite,
+ w = tag.width >> 5,
+ sw = size[0] >> 5,
+ lx = tag.x - (w << 4),
+ sx = lx & 0x7f,
+ msx = 32 - sx,
+ h = tag.y1 - tag.y0,
+ x = (tag.y + tag.y0) * sw + (lx >> 5),
+ last;
+ for (var j = 0; j < h; j++) {
+ last = 0;
+ for (var i = 0; i <= w; i++) {
+ board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0);
+ }
+ x += sw;
+ }
+ delete tag.sprite;
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ cloud.words = function(x) {
+ if (!arguments.length) return words;
+ words = x;
+ return cloud;
+ };
+
+ cloud.size = function(x) {
+ if (!arguments.length) return size;
+ size = [+x[0], +x[1]];
+ return cloud;
+ };
+
+ cloud.font = function(x) {
+ if (!arguments.length) return font;
+ font = d3.functor(x);
+ return cloud;
+ };
+
+ cloud.fontStyle = function(x) {
+ if (!arguments.length) return fontStyle;
+ fontStyle = d3.functor(x);
+ return cloud;
+ };
+
+ cloud.fontWeight = function(x) {
+ if (!arguments.length) return fontWeight;
+ fontWeight = d3.functor(x);
+ return cloud;
+ };
+
+ cloud.rotate = function(x) {
+ if (!arguments.length) return rotate;
+ rotate = d3.functor(x);
+ return cloud;
+ };
+
+ cloud.text = function(x) {
+ if (!arguments.length) return text;
+ text = d3.functor(x);
+ return cloud;
+ };
+
+ cloud.spiral = function(x) {
+ if (!arguments.length) return spiral;
+ spiral = spirals[x + ""] || x;
+ return cloud;
+ };
+
+ cloud.fontSize = function(x) {
+ if (!arguments.length) return fontSize;
+ fontSize = d3.functor(x);
+ return cloud;
+ };
+
+ cloud.padding = function(x) {
+ if (!arguments.length) return padding;
+ padding = d3.functor(x);
+ return cloud;
+ };
+
+ return d3.rebind(cloud, event, "on");
+ }
+
+ function cloudText(d) {
+ return d.text;
+ }
+
+ function cloudFont() {
+ return "serif";
+ }
+
+ function cloudFontNormal() {
+ return "normal";
+ }
+
+ function cloudFontSize(d) {
+ return Math.sqrt(d.value);
+ }
+
+ function cloudRotate() {
+ return (~~(Math.random() * 6) - 3) * 30;
+ }
+
+ function cloudPadding() {
+ return 1;
+ }
+
+ // Fetches a monochrome sprite bitmap for the specified text.
+ // Load in batches for speed.
+ function cloudSprite(d, data, di) {
+ if (d.sprite) return;
+ c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio);
+ var x = 0,
+ y = 0,
+ maxh = 0,
+ n = data.length;
+ --di;
+ while (++di < n) {
+ d = data[di];
+ c.save();
+ c.font = d.style + " " + d.weight + " " + ~~((d.size + 1) / ratio) + "px " + d.font;
+ var w = c.measureText(d.text + "m").width * ratio,
+ h = d.size << 1;
+ if (d.rotate) {
+ var sr = Math.sin(d.rotate * cloudRadians),
+ cr = Math.cos(d.rotate * cloudRadians),
+ wcr = w * cr,
+ wsr = w * sr,
+ hcr = h * cr,
+ hsr = h * sr;
+ w = (Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5 << 5;
+ h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr));
+ } else {
+ w = (w + 0x1f) >> 5 << 5;
+ }
+ if (h > maxh) maxh = h;
+ if (x + w >= (cw << 5)) {
+ x = 0;
+ y += maxh;
+ maxh = 0;
+ }
+ if (y + h >= ch) break;
+ c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio);
+ if (d.rotate) c.rotate(d.rotate * cloudRadians);
+ c.fillText(d.text, 0, 0);
+ if (d.padding) c.lineWidth = 2 * d.padding, c.strokeText(d.text, 0, 0);
+ c.restore();
+ d.width = w;
+ d.height = h;
+ d.xoff = x;
+ d.yoff = y;
+ d.x1 = w >> 1;
+ d.y1 = h >> 1;
+ d.x0 = -d.x1;
+ d.y0 = -d.y1;
+ d.hasText = true;
+ x += w;
+ }
+ var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data,
+ sprite = [];
+ while (--di >= 0) {
+ d = data[di];
+ if (!d.hasText) continue;
+ var w = d.width,
+ w32 = w >> 5,
+ h = d.y1 - d.y0;
+ // Zero the buffer
+ for (var i = 0; i < h * w32; i++) sprite[i] = 0;
+ x = d.xoff;
+ if (x == null) return;
+ y = d.yoff;
+ var seen = 0,
+ seenRow = -1;
+ for (var j = 0; j < h; j++) {
+ for (var i = 0; i < w; i++) {
+ var k = w32 * j + (i >> 5),
+ m = pixels[((y + j) * (cw << 5) + (x + i)) << 2] ? 1 << (31 - (i % 32)) : 0;
+ sprite[k] |= m;
+ seen |= m;
+ }
+ if (seen) seenRow = j;
+ else {
+ d.y0++;
+ h--;
+ j--;
+ y++;
+ }
+ }
+ d.y1 = d.y0 + seenRow;
+ d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32);
+ }
+ }
+
+ // Use mask-based collision detection.
+ function cloudCollide(tag, board, sw) {
+ sw >>= 5;
+ var sprite = tag.sprite,
+ w = tag.width >> 5,
+ lx = tag.x - (w << 4),
+ sx = lx & 0x7f,
+ msx = 32 - sx,
+ h = tag.y1 - tag.y0,
+ x = (tag.y + tag.y0) * sw + (lx >> 5),
+ last;
+ for (var j = 0; j < h; j++) {
+ last = 0;
+ for (var i = 0; i <= w; i++) {
+ if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0))
+ & board[x + i]) return true;
+ }
+ x += sw;
+ }
+ return false;
+ }
+
+ function cloudBounds(bounds, d) {
+ var b0 = bounds[0],
+ b1 = bounds[1];
+ if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0;
+ if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0;
+ if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1;
+ if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1;
+ }
+
+ function collideRects(a, b) {
+ return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y;
+ }
+
+ function archimedeanSpiral(size) {
+ var e = size[0] / size[1];
+ return function(t) {
+ return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)];
+ };
+ }
+
+ function rectangularSpiral(size) {
+ var dy = 4,
+ dx = dy * size[0] / size[1],
+ x = 0,
+ y = 0;
+ return function(t) {
+ var sign = t < 0 ? -1 : 1;
+ // See triangular numbers: T_n = n * (n + 1) / 2.
+ switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) {
+ case 0: x += dx; break;
+ case 1: y += dy; break;
+ case 2: x -= dx; break;
+ default: y -= dy; break;
+ }
+ return [x, y];
+ };
+ }
+
+ // TODO reuse arrays?
+ function zeroArray(n) {
+ var a = [],
+ i = -1;
+ while (++i < n) a[i] = 0;
+ return a;
+ }
+
+ var cloudRadians = Math.PI / 180,
+ cw = 1 << 11 >> 5,
+ ch = 1 << 11,
+ canvas,
+ ratio = 1;
+
+ if (typeof document !== "undefined") {
+ canvas = document.createElement("canvas");
+ canvas.width = 1;
+ canvas.height = 1;
+ ratio = Math.sqrt(canvas.getContext("2d").getImageData(0, 0, 1, 1).data.length >> 2);
+ canvas.width = (cw << 5) / ratio;
+ canvas.height = ch / ratio;
+ } else {
+ // Attempt to use node-canvas.
+ canvas = new Canvas(cw << 5, ch);
+ }
+
+ var c = canvas.getContext("2d"),
+ spirals = {
+ archimedean: archimedeanSpiral,
+ rectangular: rectangularSpiral
+ };
+ c.fillStyle = c.strokeStyle = "red";
+ c.textAlign = "center";
+
+ if (typeof module === "object" && module.exports) module.exports = cloud;
+ else (d3.layout || (d3.layout = {})).cloud = cloud;
+})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.layout.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.layout.js
new file mode 100644
index 00000000..abc5ebef
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.layout.js
@@ -0,0 +1,908 @@
+(function(){d3.layout = {};
+d3.layout.chord = function() {
+ var chord = {},
+ chords,
+ groups,
+ matrix,
+ n,
+ padding = 0,
+ sortGroups,
+ sortSubgroups,
+ sortChords;
+
+ function relayout() {
+ var subgroups = {},
+ groupSums = [],
+ groupIndex = d3.range(n),
+ subgroupIndex = [],
+ k,
+ x,
+ x0,
+ i,
+ j;
+
+ chords = [];
+ groups = [];
+
+ // Compute the sum.
+ k = 0, i = -1; while (++i < n) {
+ x = 0, j = -1; while (++j < n) {
+ x += matrix[i][j];
+ }
+ groupSums.push(x);
+ subgroupIndex.push(d3.range(n));
+ k += x;
+ }
+
+ // Sort groups…
+ if (sortGroups) {
+ groupIndex.sort(function(a, b) {
+ return sortGroups(groupSums[a], groupSums[b]);
+ });
+ }
+
+ // Sort subgroups…
+ if (sortSubgroups) {
+ subgroupIndex.forEach(function(d, i) {
+ d.sort(function(a, b) {
+ return sortSubgroups(matrix[i][a], matrix[i][b]);
+ });
+ });
+ }
+
+ // Convert the sum to scaling factor for [0, 2pi].
+ // TODO Allow start and end angle to be specified.
+ // TODO Allow padding to be specified as percentage?
+ k = (2 * Math.PI - padding * n) / k;
+
+ // Compute the start and end angle for each group and subgroup.
+ x = 0, i = -1; while (++i < n) {
+ x0 = x, j = -1; while (++j < n) {
+ var di = groupIndex[i],
+ dj = subgroupIndex[i][j],
+ v = matrix[di][dj];
+ subgroups[di + "-" + dj] = {
+ index: di,
+ subindex: dj,
+ startAngle: x,
+ endAngle: x += v * k,
+ value: v
+ };
+ }
+ groups.push({
+ index: di,
+ startAngle: x0,
+ endAngle: x,
+ value: (x - x0) / k
+ });
+ x += padding;
+ }
+
+ // Generate chords for each (non-empty) subgroup-subgroup link.
+ i = -1; while (++i < n) {
+ j = i - 1; while (++j < n) {
+ var source = subgroups[i + "-" + j],
+ target = subgroups[j + "-" + i];
+ if (source.value || target.value) {
+ chords.push({
+ source: source,
+ target: target
+ })
+ }
+ }
+ }
+
+ if (sortChords) resort();
+ }
+
+ function resort() {
+ chords.sort(function(a, b) {
+ a = Math.min(a.source.value, a.target.value);
+ b = Math.min(b.source.value, b.target.value);
+ return sortChords(a, b);
+ });
+ }
+
+ chord.matrix = function(x) {
+ if (!arguments.length) return matrix;
+ n = (matrix = x) && matrix.length;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.padding = function(x) {
+ if (!arguments.length) return padding;
+ padding = x;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.sortGroups = function(x) {
+ if (!arguments.length) return sortGroups;
+ sortGroups = x;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.sortSubgroups = function(x) {
+ if (!arguments.length) return sortSubgroups;
+ sortSubgroups = x;
+ chords = null;
+ return chord;
+ };
+
+ chord.sortChords = function(x) {
+ if (!arguments.length) return sortChords;
+ sortChords = x;
+ if (chords) resort();
+ return chord;
+ };
+
+ chord.chords = function() {
+ if (!chords) relayout();
+ return chords;
+ };
+
+ chord.groups = function() {
+ if (!groups) relayout();
+ return groups;
+ };
+
+ return chord;
+};
+// A rudimentary force layout using Gauss-Seidel.
+d3.layout.force = function() {
+ var force = {},
+ event = d3.dispatch("tick"),
+ size = [1, 1],
+ alpha = .5,
+ distance = 30,
+ interval,
+ nodes,
+ links,
+ distances;
+
+ function tick() {
+ var n = distances.length,
+ i, // current index
+ o, // current link
+ s, // current source
+ t, // current target
+ l, // current distance
+ x, // x-distance
+ y; // y-distance
+
+ // gauss-seidel relaxation
+ for (i = 0; i < n; ++i) {
+ o = distances[i];
+ s = o.source;
+ t = o.target;
+ x = t.x - s.x;
+ y = t.y - s.y;
+ if (l = Math.sqrt(x * x + y * y)) {
+ l = alpha / (o.distance * o.distance) * (l - distance * o.distance) / l;
+ x *= l;
+ y *= l;
+ if (!t.fixed) {
+ t.x -= x;
+ t.y -= y;
+ }
+ if (!s.fixed) {
+ s.x += x;
+ s.y += y;
+ }
+ }
+ }
+
+ event.tick.dispatch({type: "tick"});
+
+ // simulated annealing, basically
+ return (alpha *= .99) < .005;
+ }
+
+ force.on = function(type, listener) {
+ event[type].add(listener);
+ return force;
+ };
+
+ force.nodes = function(x) {
+ if (!arguments.length) return nodes;
+ nodes = x;
+ return force;
+ };
+
+ force.links = function(x) {
+ if (!arguments.length) return links;
+ links = x;
+ return force;
+ };
+
+ force.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return force;
+ };
+
+ force.distance = function(d) {
+ if (!arguments.length) return distance;
+ distance = d;
+ return force;
+ };
+
+ force.start = function() {
+ var i,
+ j,
+ k,
+ n = nodes.length,
+ m = links.length,
+ w = size[0],
+ h = size[1],
+ o;
+
+ var paths = [];
+ for (i = 0; i < n; ++i) {
+ o = nodes[i];
+ o.x = o.x || Math.random() * w;
+ o.y = o.y || Math.random() * h;
+ o.fixed = 0;
+ paths[i] = [];
+ for (j = 0; j < n; ++j) {
+ paths[i][j] = Infinity;
+ }
+ paths[i][i] = 0;
+ }
+
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ paths[o.source][o.target] = 1;
+ paths[o.target][o.source] = 1;
+ o.source = nodes[o.source];
+ o.target = nodes[o.target];
+ }
+
+ // Floyd-Warshall
+ for (k = 0; k < n; ++k) {
+ for (i = 0; i < n; ++i) {
+ for (j = 0; j < n; ++j) {
+ paths[i][j] = Math.min(paths[i][j], paths[i][k] + paths[k][j]);
+ }
+ }
+ }
+
+ distances = [];
+ for (i = 0; i < n; ++i) {
+ for (j = i + 1; j < n; ++j) {
+ distances.push({
+ source: nodes[i],
+ target: nodes[j],
+ distance: paths[i][j] * paths[i][j]
+ });
+ }
+ }
+
+ distances.sort(function(a, b) {
+ return a.distance - b.distance;
+ });
+
+ d3.timer(tick);
+ return force;
+ };
+
+ force.resume = function() {
+ alpha = .1;
+ d3.timer(tick);
+ return force;
+ };
+
+ force.stop = function() {
+ alpha = 0;
+ return force;
+ };
+
+ // use `node.call(force.drag)` to make nodes draggable
+ force.drag = function() {
+ var node, element;
+
+ this
+ .on("mouseover", function(d) { d.fixed = true; })
+ .on("mouseout", function(d) { if (d != node) d.fixed = false; })
+ .on("mousedown", mousedown);
+
+ d3.select(window)
+ .on("mousemove", mousemove)
+ .on("mouseup", mouseup);
+
+ function mousedown(d) {
+ (node = d).fixed = true;
+ element = this;
+ d3.event.preventDefault();
+ }
+
+ function mousemove() {
+ if (!node) return;
+ var m = d3.svg.mouse(element);
+ node.x = m[0];
+ node.y = m[1];
+ force.resume(); // restart annealing
+ }
+
+ function mouseup() {
+ if (!node) return;
+ mousemove();
+ node.fixed = false;
+ node = element = null;
+ }
+
+ return force;
+ };
+
+ return force;
+};
+d3.layout.partition = function() {
+ var hierarchy = d3.layout.hierarchy(),
+ size = [1, 1]; // width, height
+
+ function position(node, x, dx, dy) {
+ var children = node.children;
+ node.x = x;
+ node.y = node.depth * dy;
+ node.dx = dx;
+ node.dy = dy;
+ if (children) {
+ var i = -1,
+ n = children.length,
+ c,
+ d;
+ dx /= node.value;
+ while (++i < n) {
+ position(c = children[i], x, d = c.value * dx, dy);
+ x += d;
+ }
+ }
+ }
+
+ function depth(node) {
+ var children = node.children,
+ d = 0;
+ if (children) {
+ var i = -1,
+ n = children.length;
+ while (++i < n) d = Math.max(d, depth(children[i]));
+ }
+ return 1 + d;
+ }
+
+ function partition(d, i) {
+ var nodes = hierarchy.call(this, d, i);
+ position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
+ return nodes;
+ }
+
+ partition.sort = d3.rebind(partition, hierarchy.sort);
+ partition.children = d3.rebind(partition, hierarchy.children);
+ partition.value = d3.rebind(partition, hierarchy.value);
+
+ partition.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return partition;
+ };
+
+ return partition;
+};
+d3.layout.pie = function() {
+ var value = Number,
+ sort = null,
+ startAngle = 0,
+ endAngle = 2 * Math.PI;
+
+ function pie(data, i) {
+
+ // Compute the start angle.
+ var a = +(typeof startAngle == "function"
+ ? startAngle.apply(this, arguments)
+ : startAngle);
+
+ // Compute the angular range (end - start).
+ var k = (typeof endAngle == "function"
+ ? endAngle.apply(this, arguments)
+ : endAngle) - startAngle;
+
+ // Optionally sort the data.
+ var index = d3.range(data.length);
+ if (sort != null) index.sort(function(i, j) {
+ return sort(data[i], data[j]);
+ });
+
+ // Compute the numeric values for each data element.
+ var values = data.map(value);
+
+ // Convert k into a scale factor from value to angle, using the sum.
+ k /= values.reduce(function(p, d) { return p + d; }, 0);
+
+ // Compute the arcs!
+ var arcs = index.map(function(i) {
+ return {
+ value: d = values[i],
+ startAngle: a,
+ endAngle: a += d * k
+ };
+ });
+
+ // Return the arcs in the original data's order.
+ return data.map(function(d, i) {
+ return arcs[index[i]];
+ });
+ }
+
+ /**
+ * Specifies the value function *x*, which returns a nonnegative numeric value
+ * for each datum. The default value function is `Number`. The value function
+ * is passed two arguments: the current datum and the current index.
+ */
+ pie.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return pie;
+ };
+
+ /**
+ * Specifies a sort comparison operator *x*. The comparator is passed two data
+ * elements from the data array, a and b; it returns a negative value if a is
+ * less than b, a positive value if a is greater than b, and zero if a equals
+ * b.
+ */
+ pie.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return pie;
+ };
+
+ /**
+ * Specifies the overall start angle of the pie chart. Defaults to 0. The
+ * start angle can be specified either as a constant or as a function; in the
+ * case of a function, it is evaluated once per array (as opposed to per
+ * element).
+ */
+ pie.startAngle = function(x) {
+ if (!arguments.length) return startAngle;
+ startAngle = x;
+ return pie;
+ };
+
+ /**
+ * Specifies the overall end angle of the pie chart. Defaults to 2Ï€. The
+ * end angle can be specified either as a constant or as a function; in the
+ * case of a function, it is evaluated once per array (as opposed to per
+ * element).
+ */
+ pie.endAngle = function(x) {
+ if (!arguments.length) return endAngle;
+ endAngle = x;
+ return pie;
+ };
+
+ return pie;
+};
+// data is two-dimensional array of x,y; we populate y0
+// TODO perhaps make the `x`, `y` and `y0` structure customizable
+d3.layout.stack = function() {
+ var order = "default",
+ offset = "zero";
+
+ function stack(data) {
+ var n = data.length,
+ m = data[0].length,
+ i,
+ j,
+ y0;
+
+ // compute the order of series
+ var index = d3_layout_stackOrders[order](data);
+
+ // set y0 on the baseline
+ d3_layout_stackOffsets[offset](data, index);
+
+ // propagate offset to other series
+ for (j = 0; j < m; ++j) {
+ for (i = 1, y0 = data[index[0]][j].y0; i < n; ++i) {
+ data[index[i]][j].y0 = y0 += data[index[i - 1]][j].y;
+ }
+ }
+
+ return data;
+ }
+
+ stack.order = function(x) {
+ if (!arguments.length) return order;
+ order = x;
+ return stack;
+ };
+
+ stack.offset = function(x) {
+ if (!arguments.length) return offset;
+ offset = x;
+ return stack;
+ };
+
+ return stack;
+}
+
+var d3_layout_stackOrders = {
+
+ "inside-out": function(data) {
+ var n = data.length,
+ i,
+ j,
+ max = data.map(d3_layout_stackMaxIndex),
+ sums = data.map(d3_layout_stackReduceSum),
+ index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }),
+ top = 0,
+ bottom = 0,
+ tops = [],
+ bottoms = [];
+ for (i = 0; i < n; i++) {
+ j = index[i];
+ if (top < bottom) {
+ top += sums[j];
+ tops.push(j);
+ } else {
+ bottom += sums[j];
+ bottoms.push(j);
+ }
+ }
+ return bottoms.reverse().concat(tops);
+ },
+
+ "reverse": function(data) {
+ return d3.range(data.length).reverse();
+ },
+
+ "default": function(data) {
+ return d3.range(data.length);
+ }
+
+};
+
+var d3_layout_stackOffsets = {
+
+ "silhouette": function(data, index) {
+ var n = data.length,
+ m = data[0].length,
+ sums = [],
+ max = 0,
+ i,
+ j,
+ o;
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j].y;
+ if (o > max) max = o;
+ sums.push(o);
+ }
+ for (j = 0, i = index[0]; j < m; ++j) {
+ data[i][j].y0 = (max - sums[j]) / 2;
+ }
+ },
+
+ "wiggle": function(data, index) {
+ var n = data.length,
+ x = data[0],
+ m = x.length,
+ max = 0,
+ i,
+ j,
+ k,
+ ii,
+ ik,
+ i0 = index[0],
+ s1,
+ s2,
+ s3,
+ dx,
+ o,
+ o0;
+ data[i0][0].y0 = o = o0 = 0;
+ for (j = 1; j < m; ++j) {
+ for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j].y;
+ for (i = 0, s2 = 0, dx = x[j].x - x[j - 1].x; i < n; ++i) {
+ for (k = 0, ii = index[i], s3 = (data[ii][j].y - data[ii][j - 1].y) / (2 * dx); k < i; ++k) {
+ s3 += (data[ik = index[k]][j].y - data[ik][j - 1].y) / dx;
+ }
+ s2 += s3 * data[ii][j].y;
+ }
+ data[i0][j].y0 = o -= s1 ? s2 / s1 * dx : 0;
+ if (o < o0) o0 = o;
+ }
+ for (j = 0; j < m; ++j) data[i0][j].y0 -= o0;
+ },
+
+ "zero": function(data, index) {
+ var j = 0,
+ m = data[0].length,
+ i0 = index[0];
+ for (; j < m; ++j) data[i0][j].y0 = 0;
+ }
+
+};
+
+function d3_layout_stackReduceSum(d) {
+ return d.reduce(d3_layout_stackSum, 0);
+}
+
+function d3_layout_stackMaxIndex(array) {
+ var i = 1,
+ j = 0,
+ v = array[0].y,
+ k,
+ n = array.length;
+ for (; i < n; ++i) {
+ if ((k = array[i].y) > v) {
+ j = i;
+ v = k;
+ }
+ }
+ return j;
+}
+
+function d3_layout_stackSum(p, d) {
+ return p + d.y;
+}
+d3.layout.hierarchy = function() {
+ var sort = d3_layout_hierarchySort,
+ children = d3_layout_hierarchyChildren,
+ value = d3_layout_hierarchyValue;
+
+ // Recursively compute the node depth and value.
+ // Also converts the data representation into a standard hierarchy structure.
+ function recurse(data, depth, nodes) {
+ var datas = children.call(hierarchy, data, depth),
+ node = {depth: depth, data: data};
+ nodes.push(node);
+ if (datas) {
+ var i = -1,
+ n = datas.length,
+ c = node.children = [],
+ v = 0,
+ j = depth + 1;
+ while (++i < n) {
+ d = recurse(datas[i], j, nodes);
+ if (d.value > 0) { // ignore NaN, negative, etc.
+ c.push(d);
+ v += d.value;
+ d.parent = node;
+ }
+ }
+ if (sort) c.sort(sort);
+ node.value = v;
+ } else {
+ node.value = value.call(hierarchy, data, depth);
+ }
+ return node;
+ }
+
+ // Recursively re-evaluates the node value.
+ function revalue(node, depth) {
+ var children = node.children,
+ v = 0;
+ if (children) {
+ var i = -1,
+ n = children.length,
+ j = depth + 1;
+ while (++i < n) v += revalue(children[i], j);
+ } else {
+ v = value.call(hierarchy, node.data, depth);
+ }
+ return node.value = v;
+ }
+
+ function hierarchy(d) {
+ var nodes = [];
+ recurse(d, 0, nodes);
+ return nodes;
+ }
+
+ hierarchy.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return hierarchy;
+ };
+
+ hierarchy.children = function(x) {
+ if (!arguments.length) return children;
+ children = x;
+ return hierarchy;
+ };
+
+ hierarchy.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return hierarchy;
+ };
+
+ // Re-evaluates the `value` property for the specified hierarchy.
+ hierarchy.revalue = function(root) {
+ revalue(root, 0);
+ return root;
+ };
+
+ return hierarchy;
+}
+
+function d3_layout_hierarchyChildren(d) {
+ return d.children;
+}
+
+function d3_layout_hierarchyValue(d) {
+ return d.value;
+}
+
+function d3_layout_hierarchySort(a, b) {
+ return b.value - a.value;
+}
+// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk
+d3.layout.treemap = function() {
+ var hierarchy = d3.layout.hierarchy(),
+ round = Math.round,
+ size = [1, 1], // width, height
+ sticky = false,
+ stickies;
+
+ // Recursively compute the node area based on value & scale.
+ function scale(node, k) {
+ var children = node.children;
+ node.area = node.value * k;
+ if (children) {
+ var i = -1,
+ n = children.length;
+ while (++i < n) scale(children[i], k);
+ }
+ }
+
+ // Recursively arranges the specified node's children into squarified rows.
+ function squarify(node) {
+ if (!node.children) return;
+ var rect = {x: node.x, y: node.y, dx: node.dx, dy: node.dy},
+ row = [],
+ children = node.children.slice(), // copy-on-write
+ child,
+ best = Infinity, // the best row score so far
+ score, // the current row score
+ u = Math.min(rect.dx, rect.dy), // initial orientation
+ n;
+ row.area = 0;
+ while ((n = children.length) > 0) {
+ row.push(child = children[n - 1]);
+ row.area += child.area;
+ if ((score = worst(row, u)) <= best) { // continue with this orientation
+ children.pop();
+ best = score;
+ } else { // abort, and try a different orientation
+ row.area -= row.pop().area;
+ position(row, u, rect, false);
+ u = Math.min(rect.dx, rect.dy);
+ row.length = row.area = 0;
+ best = Infinity;
+ }
+ }
+ if (row.length) {
+ position(row, u, rect, true);
+ row.length = row.area = 0;
+ }
+ node.children.forEach(squarify);
+ }
+
+ // Recursively resizes the specified node's children into existing rows.
+ // Preserves the existing layout!
+ function stickify(node) {
+ if (!node.children) return;
+ var rect = {x: node.x, y: node.y, dx: node.dx, dy: node.dy},
+ children = node.children.slice(), // copy-on-write
+ child,
+ row = [];
+ row.area = 0;
+ while (child = children.pop()) {
+ row.push(child);
+ row.area += child.area;
+ if (child.z != null) {
+ position(row, child.z ? rect.dx : rect.dy, rect, !children.length);
+ row.length = row.area = 0;
+ }
+ }
+ node.children.forEach(stickify);
+ }
+
+ // Computes the score for the specified row, as the worst aspect ratio.
+ function worst(row, u) {
+ var s = row.area,
+ r,
+ rmax = 0,
+ rmin = Infinity,
+ i = -1,
+ n = row.length;
+ while (++i < n) {
+ r = row[i].area;
+ if (r < rmin) rmin = r;
+ if (r > rmax) rmax = r;
+ }
+ s *= s;
+ u *= u;
+ return Math.max((u * rmax) / s, s / (u * rmin));
+ }
+
+ // Positions the specified row of nodes. Modifies `rect`.
+ function position(row, u, rect, flush) {
+ var i = -1,
+ n = row.length,
+ x = rect.x,
+ y = rect.y,
+ v = u ? round(row.area / u) : 0,
+ o;
+ if (u == rect.dx) { // horizontal subdivision
+ if (flush || v > rect.dy) v = rect.dy; // over+underflow
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dy = v;
+ x += o.dx = round(o.area / v);
+ }
+ o.z = true;
+ o.dx += rect.x + rect.dx - x; // rounding error
+ rect.y += v;
+ rect.dy -= v;
+ } else { // vertical subdivision
+ if (flush || v > rect.dx) v = rect.dx; // over+underflow
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dx = v;
+ y += o.dy = round(o.area / v);
+ }
+ o.z = false;
+ o.dy += rect.y + rect.dy - y; // rounding error
+ rect.x += v;
+ rect.dx -= v;
+ }
+ }
+
+ function treemap(d) {
+ var nodes = stickies || hierarchy(d),
+ root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ root.dx = size[0];
+ root.dy = size[1];
+ if (stickies) hierarchy.revalue(root);
+ scale(root, size[0] * size[1] / root.value);
+ (stickies ? stickify : squarify)(root);
+ if (sticky) stickies = nodes;
+ return nodes;
+ }
+
+ treemap.sort = d3.rebind(treemap, hierarchy.sort);
+ treemap.children = d3.rebind(treemap, hierarchy.children);
+ treemap.value = d3.rebind(treemap, hierarchy.value);
+
+ treemap.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return treemap;
+ };
+
+ treemap.round = function(x) {
+ if (!arguments.length) return round != Number;
+ round = x ? Math.round : Number;
+ return treemap;
+ };
+
+ treemap.sticky = function(x) {
+ if (!arguments.length) return sticky;
+ sticky = x;
+ stickies = null;
+ return treemap;
+ };
+
+ return treemap;
+};
+})() \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v2.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v2.js
new file mode 100644
index 00000000..78c4dbca
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v2.js
@@ -0,0 +1,7037 @@
+(function() {
+ function d3_class(ctor, properties) {
+ try {
+ for (var key in properties) {
+ Object.defineProperty(ctor.prototype, key, {
+ value: properties[key],
+ enumerable: false
+ });
+ }
+ } catch (e) {
+ ctor.prototype = properties;
+ }
+ }
+ function d3_arrayCopy(pseudoarray) {
+ var i = -1, n = pseudoarray.length, array = [];
+ while (++i < n) array.push(pseudoarray[i]);
+ return array;
+ }
+ function d3_arraySlice(pseudoarray) {
+ return Array.prototype.slice.call(pseudoarray);
+ }
+ function d3_Map() {}
+ function d3_identity(d) {
+ return d;
+ }
+ function d3_this() {
+ return this;
+ }
+ function d3_true() {
+ return true;
+ }
+ function d3_functor(v) {
+ return typeof v === "function" ? v : function() {
+ return v;
+ };
+ }
+ function d3_rebind(target, source, method) {
+ return function() {
+ var value = method.apply(source, arguments);
+ return arguments.length ? target : value;
+ };
+ }
+ function d3_number(x) {
+ return x != null && !isNaN(x);
+ }
+ function d3_zipLength(d) {
+ return d.length;
+ }
+ function d3_splitter(d) {
+ return d == null;
+ }
+ function d3_collapse(s) {
+ return s.trim().replace(/\s+/g, " ");
+ }
+ function d3_range_integerScale(x) {
+ var k = 1;
+ while (x * k % 1) k *= 10;
+ return k;
+ }
+ function d3_dispatch() {}
+ function d3_dispatch_event(dispatch) {
+ function event() {
+ var z = listeners, i = -1, n = z.length, l;
+ while (++i < n) if (l = z[i].on) l.apply(this, arguments);
+ return dispatch;
+ }
+ var listeners = [], listenerByName = new d3_Map;
+ event.on = function(name, listener) {
+ var l = listenerByName.get(name), i;
+ if (arguments.length < 2) return l && l.on;
+ if (l) {
+ l.on = null;
+ listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
+ listenerByName.remove(name);
+ }
+ if (listener) listeners.push(listenerByName.set(name, {
+ on: listener
+ }));
+ return dispatch;
+ };
+ return event;
+ }
+ function d3_format_precision(x, p) {
+ return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1);
+ }
+ function d3_format_typeDefault(x) {
+ return x + "";
+ }
+ function d3_format_group(value) {
+ var i = value.lastIndexOf("."), f = i >= 0 ? value.substring(i) : (i = value.length, ""), t = [];
+ while (i > 0) t.push(value.substring(i -= 3, i + 3));
+ return t.reverse().join(",") + f;
+ }
+ function d3_formatPrefix(d, i) {
+ var k = Math.pow(10, Math.abs(8 - i) * 3);
+ return {
+ scale: i > 8 ? function(d) {
+ return d / k;
+ } : function(d) {
+ return d * k;
+ },
+ symbol: d
+ };
+ }
+ function d3_ease_clamp(f) {
+ return function(t) {
+ return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
+ };
+ }
+ function d3_ease_reverse(f) {
+ return function(t) {
+ return 1 - f(1 - t);
+ };
+ }
+ function d3_ease_reflect(f) {
+ return function(t) {
+ return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));
+ };
+ }
+ function d3_ease_identity(t) {
+ return t;
+ }
+ function d3_ease_poly(e) {
+ return function(t) {
+ return Math.pow(t, e);
+ };
+ }
+ function d3_ease_sin(t) {
+ return 1 - Math.cos(t * Math.PI / 2);
+ }
+ function d3_ease_exp(t) {
+ return Math.pow(2, 10 * (t - 1));
+ }
+ function d3_ease_circle(t) {
+ return 1 - Math.sqrt(1 - t * t);
+ }
+ function d3_ease_elastic(a, p) {
+ var s;
+ if (arguments.length < 2) p = .45;
+ if (arguments.length < 1) {
+ a = 1;
+ s = p / 4;
+ } else s = p / (2 * Math.PI) * Math.asin(1 / a);
+ return function(t) {
+ return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p);
+ };
+ }
+ function d3_ease_back(s) {
+ if (!s) s = 1.70158;
+ return function(t) {
+ return t * t * ((s + 1) * t - s);
+ };
+ }
+ function d3_ease_bounce(t) {
+ return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
+ }
+ function d3_eventCancel() {
+ d3.event.stopPropagation();
+ d3.event.preventDefault();
+ }
+ function d3_eventSource() {
+ var e = d3.event, s;
+ while (s = e.sourceEvent) e = s;
+ return e;
+ }
+ function d3_eventDispatch(target) {
+ var dispatch = new d3_dispatch, i = 0, n = arguments.length;
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
+ dispatch.of = function(thiz, argumentz) {
+ return function(e1) {
+ try {
+ var e0 = e1.sourceEvent = d3.event;
+ e1.target = target;
+ d3.event = e1;
+ dispatch[e1.type].apply(thiz, argumentz);
+ } finally {
+ d3.event = e0;
+ }
+ };
+ };
+ return dispatch;
+ }
+ function d3_transform(m) {
+ var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
+ if (r0[0] * r1[1] < r1[0] * r0[1]) {
+ r0[0] *= -1;
+ r0[1] *= -1;
+ kx *= -1;
+ kz *= -1;
+ }
+ this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees;
+ this.translate = [ m.e, m.f ];
+ this.scale = [ kx, ky ];
+ this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0;
+ }
+ function d3_transformDot(a, b) {
+ return a[0] * b[0] + a[1] * b[1];
+ }
+ function d3_transformNormalize(a) {
+ var k = Math.sqrt(d3_transformDot(a, a));
+ if (k) {
+ a[0] /= k;
+ a[1] /= k;
+ }
+ return k;
+ }
+ function d3_transformCombine(a, b, k) {
+ a[0] += k * b[0];
+ a[1] += k * b[1];
+ return a;
+ }
+ function d3_interpolateByName(name) {
+ return name == "transform" ? d3.interpolateTransform : d3.interpolate;
+ }
+ function d3_uninterpolateNumber(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) {
+ return (x - a) * b;
+ };
+ }
+ function d3_uninterpolateClamp(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) {
+ return Math.max(0, Math.min(1, (x - a) * b));
+ };
+ }
+ function d3_rgb(r, g, b) {
+ return new d3_Rgb(r, g, b);
+ }
+ function d3_Rgb(r, g, b) {
+ this.r = r;
+ this.g = g;
+ this.b = b;
+ }
+ function d3_rgb_hex(v) {
+ return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
+ }
+ function d3_rgb_parse(format, rgb, hsl) {
+ var r = 0, g = 0, b = 0, m1, m2, name;
+ m1 = /([a-z]+)\((.*)\)/i.exec(format);
+ if (m1) {
+ m2 = m1[2].split(",");
+ switch (m1[1]) {
+ case "hsl":
+ {
+ return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);
+ }
+ case "rgb":
+ {
+ return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));
+ }
+ }
+ }
+ if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
+ if (format != null && format.charAt(0) === "#") {
+ if (format.length === 4) {
+ r = format.charAt(1);
+ r += r;
+ g = format.charAt(2);
+ g += g;
+ b = format.charAt(3);
+ b += b;
+ } else if (format.length === 7) {
+ r = format.substring(1, 3);
+ g = format.substring(3, 5);
+ b = format.substring(5, 7);
+ }
+ r = parseInt(r, 16);
+ g = parseInt(g, 16);
+ b = parseInt(b, 16);
+ }
+ return rgb(r, g, b);
+ }
+ function d3_rgb_hsl(r, g, b) {
+ var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2;
+ if (d) {
+ s = l < .5 ? d / (max + min) : d / (2 - max - min);
+ if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4;
+ h *= 60;
+ } else {
+ s = h = 0;
+ }
+ return d3_hsl(h, s, l);
+ }
+ function d3_rgb_lab(r, g, b) {
+ r = d3_rgb_xyz(r);
+ g = d3_rgb_xyz(g);
+ b = d3_rgb_xyz(b);
+ var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z);
+ return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
+ }
+ function d3_rgb_xyz(r) {
+ return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);
+ }
+ function d3_rgb_parseNumber(c) {
+ var f = parseFloat(c);
+ return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
+ }
+ function d3_hsl(h, s, l) {
+ return new d3_Hsl(h, s, l);
+ }
+ function d3_Hsl(h, s, l) {
+ this.h = h;
+ this.s = s;
+ this.l = l;
+ }
+ function d3_hsl_rgb(h, s, l) {
+ function v(h) {
+ if (h > 360) h -= 360; else if (h < 0) h += 360;
+ if (h < 60) return m1 + (m2 - m1) * h / 60;
+ if (h < 180) return m2;
+ if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
+ return m1;
+ }
+ function vv(h) {
+ return Math.round(v(h) * 255);
+ }
+ var m1, m2;
+ h = h % 360;
+ if (h < 0) h += 360;
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
+ l = l < 0 ? 0 : l > 1 ? 1 : l;
+ m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
+ m1 = 2 * l - m2;
+ return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
+ }
+ function d3_hcl(h, c, l) {
+ return new d3_Hcl(h, c, l);
+ }
+ function d3_Hcl(h, c, l) {
+ this.h = h;
+ this.c = c;
+ this.l = l;
+ }
+ function d3_hcl_lab(h, c, l) {
+ return d3_lab(l, Math.cos(h *= Math.PI / 180) * c, Math.sin(h) * c);
+ }
+ function d3_lab(l, a, b) {
+ return new d3_Lab(l, a, b);
+ }
+ function d3_Lab(l, a, b) {
+ this.l = l;
+ this.a = a;
+ this.b = b;
+ }
+ function d3_lab_rgb(l, a, b) {
+ var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
+ x = d3_lab_xyz(x) * d3_lab_X;
+ y = d3_lab_xyz(y) * d3_lab_Y;
+ z = d3_lab_xyz(z) * d3_lab_Z;
+ return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z));
+ }
+ function d3_lab_hcl(l, a, b) {
+ return d3_hcl(Math.atan2(b, a) / Math.PI * 180, Math.sqrt(a * a + b * b), l);
+ }
+ function d3_lab_xyz(x) {
+ return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
+ }
+ function d3_xyz_lab(x) {
+ return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
+ }
+ function d3_xyz_rgb(r) {
+ return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));
+ }
+ function d3_selection(groups) {
+ d3_arraySubclass(groups, d3_selectionPrototype);
+ return groups;
+ }
+ function d3_selection_selector(selector) {
+ return function() {
+ return d3_select(selector, this);
+ };
+ }
+ function d3_selection_selectorAll(selector) {
+ return function() {
+ return d3_selectAll(selector, this);
+ };
+ }
+ function d3_selection_attr(name, value) {
+ function attrNull() {
+ this.removeAttribute(name);
+ }
+ function attrNullNS() {
+ this.removeAttributeNS(name.space, name.local);
+ }
+ function attrConstant() {
+ this.setAttribute(name, value);
+ }
+ function attrConstantNS() {
+ this.setAttributeNS(name.space, name.local, value);
+ }
+ function attrFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);
+ }
+ function attrFunctionNS() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);
+ }
+ name = d3.ns.qualify(name);
+ return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;
+ }
+ function d3_selection_classedRe(name) {
+ return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");
+ }
+ function d3_selection_classed(name, value) {
+ function classedConstant() {
+ var i = -1;
+ while (++i < n) name[i](this, value);
+ }
+ function classedFunction() {
+ var i = -1, x = value.apply(this, arguments);
+ while (++i < n) name[i](this, x);
+ }
+ name = name.trim().split(/\s+/).map(d3_selection_classedName);
+ var n = name.length;
+ return typeof value === "function" ? classedFunction : classedConstant;
+ }
+ function d3_selection_classedName(name) {
+ var re = d3_selection_classedRe(name);
+ return function(node, value) {
+ if (c = node.classList) return value ? c.add(name) : c.remove(name);
+ var c = node.className, cb = c.baseVal != null, cv = cb ? c.baseVal : c;
+ if (value) {
+ re.lastIndex = 0;
+ if (!re.test(cv)) {
+ cv = d3_collapse(cv + " " + name);
+ if (cb) c.baseVal = cv; else node.className = cv;
+ }
+ } else if (cv) {
+ cv = d3_collapse(cv.replace(re, " "));
+ if (cb) c.baseVal = cv; else node.className = cv;
+ }
+ };
+ }
+ function d3_selection_style(name, value, priority) {
+ function styleNull() {
+ this.style.removeProperty(name);
+ }
+ function styleConstant() {
+ this.style.setProperty(name, value, priority);
+ }
+ function styleFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);
+ }
+ return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;
+ }
+ function d3_selection_property(name, value) {
+ function propertyNull() {
+ delete this[name];
+ }
+ function propertyConstant() {
+ this[name] = value;
+ }
+ function propertyFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) delete this[name]; else this[name] = x;
+ }
+ return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;
+ }
+ function d3_selection_dataNode(data) {
+ return {
+ __data__: data
+ };
+ }
+ function d3_selection_filter(selector) {
+ return function() {
+ return d3_selectMatches(this, selector);
+ };
+ }
+ function d3_selection_sortComparator(comparator) {
+ if (!arguments.length) comparator = d3.ascending;
+ return function(a, b) {
+ return comparator(a && a.__data__, b && b.__data__);
+ };
+ }
+ function d3_selection_on(type, listener, capture) {
+ function onRemove() {
+ var wrapper = this[name];
+ if (wrapper) {
+ this.removeEventListener(type, wrapper, wrapper.$);
+ delete this[name];
+ }
+ }
+ function onAdd() {
+ function wrapper(e) {
+ var o = d3.event;
+ d3.event = e;
+ args[0] = node.__data__;
+ try {
+ listener.apply(node, args);
+ } finally {
+ d3.event = o;
+ }
+ }
+ var node = this, args = arguments;
+ onRemove.call(this);
+ this.addEventListener(type, this[name] = wrapper, wrapper.$ = capture);
+ wrapper._ = listener;
+ }
+ var name = "__on" + type, i = type.indexOf(".");
+ if (i > 0) type = type.substring(0, i);
+ return listener ? onAdd : onRemove;
+ }
+ function d3_selection_each(groups, callback) {
+ for (var j = 0, m = groups.length; j < m; j++) {
+ for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {
+ if (node = group[i]) callback(node, i, j);
+ }
+ }
+ return groups;
+ }
+ function d3_selection_enter(selection) {
+ d3_arraySubclass(selection, d3_selection_enterPrototype);
+ return selection;
+ }
+ function d3_transition(groups, id, time) {
+ d3_arraySubclass(groups, d3_transitionPrototype);
+ var tweens = new d3_Map, event = d3.dispatch("start", "end"), ease = d3_transitionEase;
+ groups.id = id;
+ groups.time = time;
+ groups.tween = function(name, tween) {
+ if (arguments.length < 2) return tweens.get(name);
+ if (tween == null) tweens.remove(name); else tweens.set(name, tween);
+ return groups;
+ };
+ groups.ease = function(value) {
+ if (!arguments.length) return ease;
+ ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments);
+ return groups;
+ };
+ groups.each = function(type, listener) {
+ if (arguments.length < 2) return d3_transition_each.call(groups, type);
+ event.on(type, listener);
+ return groups;
+ };
+ d3.timer(function(elapsed) {
+ return d3_selection_each(groups, function(node, i, j) {
+ function start(elapsed) {
+ if (lock.active > id) return stop();
+ lock.active = id;
+ tweens.forEach(function(key, value) {
+ if (value = value.call(node, d, i)) {
+ tweened.push(value);
+ }
+ });
+ event.start.call(node, d, i);
+ if (!tick(elapsed)) d3.timer(tick, 0, time);
+ return 1;
+ }
+ function tick(elapsed) {
+ if (lock.active !== id) return stop();
+ var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length;
+ while (n > 0) {
+ tweened[--n].call(node, e);
+ }
+ if (t >= 1) {
+ stop();
+ d3_transitionId = id;
+ event.end.call(node, d, i);
+ d3_transitionId = 0;
+ return 1;
+ }
+ }
+ function stop() {
+ if (!--lock.count) delete node.__transition__;
+ return 1;
+ }
+ var tweened = [], delay = node.delay, duration = node.duration, lock = (node = node.node).__transition__ || (node.__transition__ = {
+ active: 0,
+ count: 0
+ }), d = node.__data__;
+ ++lock.count;
+ delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time);
+ });
+ }, 0, time);
+ return groups;
+ }
+ function d3_transition_each(callback) {
+ var id = d3_transitionId, ease = d3_transitionEase, delay = d3_transitionDelay, duration = d3_transitionDuration;
+ d3_transitionId = this.id;
+ d3_transitionEase = this.ease();
+ d3_selection_each(this, function(node, i, j) {
+ d3_transitionDelay = node.delay;
+ d3_transitionDuration = node.duration;
+ callback.call(node = node.node, node.__data__, i, j);
+ });
+ d3_transitionId = id;
+ d3_transitionEase = ease;
+ d3_transitionDelay = delay;
+ d3_transitionDuration = duration;
+ return this;
+ }
+ function d3_tweenNull(d, i, a) {
+ return a != "" && d3_tweenRemove;
+ }
+ function d3_tweenByName(b, name) {
+ return d3.tween(b, d3_interpolateByName(name));
+ }
+ function d3_timer_step() {
+ var elapsed, now = Date.now(), t1 = d3_timer_queue;
+ while (t1) {
+ elapsed = now - t1.then;
+ if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+ var delay = d3_timer_flush() - now;
+ if (delay > 24) {
+ if (isFinite(delay)) {
+ clearTimeout(d3_timer_timeout);
+ d3_timer_timeout = setTimeout(d3_timer_step, delay);
+ }
+ d3_timer_interval = 0;
+ } else {
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+ }
+ function d3_timer_flush() {
+ var t0 = null, t1 = d3_timer_queue, then = Infinity;
+ while (t1) {
+ if (t1.flush) {
+ t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
+ } else {
+ then = Math.min(then, t1.then + t1.delay);
+ t1 = (t0 = t1).next;
+ }
+ }
+ return then;
+ }
+ function d3_mousePoint(container, e) {
+ var svg = container.ownerSVGElement || container;
+ if (svg.createSVGPoint) {
+ var point = svg.createSVGPoint();
+ if (d3_mouse_bug44083 < 0 && (window.scrollX || window.scrollY)) {
+ svg = d3.select(document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0);
+ var ctm = svg[0][0].getScreenCTM();
+ d3_mouse_bug44083 = !(ctm.f || ctm.e);
+ svg.remove();
+ }
+ if (d3_mouse_bug44083) {
+ point.x = e.pageX;
+ point.y = e.pageY;
+ } else {
+ point.x = e.clientX;
+ point.y = e.clientY;
+ }
+ point = point.matrixTransform(container.getScreenCTM().inverse());
+ return [ point.x, point.y ];
+ }
+ var rect = container.getBoundingClientRect();
+ return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
+ }
+ function d3_noop() {}
+ function d3_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [ start, stop ] : [ stop, start ];
+ }
+ function d3_scaleRange(scale) {
+ return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
+ }
+ function d3_scale_nice(domain, nice) {
+ var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;
+ if (x1 < x0) {
+ dx = i0, i0 = i1, i1 = dx;
+ dx = x0, x0 = x1, x1 = dx;
+ }
+ if (nice = nice(x1 - x0)) {
+ domain[i0] = nice.floor(x0);
+ domain[i1] = nice.ceil(x1);
+ }
+ return domain;
+ }
+ function d3_scale_niceDefault() {
+ return Math;
+ }
+ function d3_scale_linear(domain, range, interpolate, clamp) {
+ function rescale() {
+ var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
+ output = linear(domain, range, uninterpolate, interpolate);
+ input = linear(range, domain, uninterpolate, d3.interpolate);
+ return scale;
+ }
+ function scale(x) {
+ return output(x);
+ }
+ var output, input;
+ scale.invert = function(y) {
+ return input(y);
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.map(Number);
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.rangeRound = function(x) {
+ return scale.range(x).interpolate(d3.interpolateRound);
+ };
+ scale.clamp = function(x) {
+ if (!arguments.length) return clamp;
+ clamp = x;
+ return rescale();
+ };
+ scale.interpolate = function(x) {
+ if (!arguments.length) return interpolate;
+ interpolate = x;
+ return rescale();
+ };
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(domain, m);
+ };
+ scale.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(domain, m);
+ };
+ scale.nice = function() {
+ d3_scale_nice(domain, d3_scale_linearNice);
+ return rescale();
+ };
+ scale.copy = function() {
+ return d3_scale_linear(domain, range, interpolate, clamp);
+ };
+ return rescale();
+ }
+ function d3_scale_linearRebind(scale, linear) {
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+ }
+ function d3_scale_linearNice(dx) {
+ dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
+ return dx && {
+ floor: function(x) {
+ return Math.floor(x / dx) * dx;
+ },
+ ceil: function(x) {
+ return Math.ceil(x / dx) * dx;
+ }
+ };
+ }
+ function d3_scale_linearTickRange(domain, m) {
+ var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step;
+ if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
+ extent[0] = Math.ceil(extent[0] / step) * step;
+ extent[1] = Math.floor(extent[1] / step) * step + step * .5;
+ extent[2] = step;
+ return extent;
+ }
+ function d3_scale_linearTicks(domain, m) {
+ return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
+ }
+ function d3_scale_linearTickFormat(domain, m) {
+ return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");
+ }
+ function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
+ var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);
+ return function(x) {
+ return i(u(x));
+ };
+ }
+ function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
+ var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;
+ if (domain[k] < domain[0]) {
+ domain = domain.slice().reverse();
+ range = range.slice().reverse();
+ }
+ while (++j <= k) {
+ u.push(uninterpolate(domain[j - 1], domain[j]));
+ i.push(interpolate(range[j - 1], range[j]));
+ }
+ return function(x) {
+ var j = d3.bisect(domain, x, 1, k) - 1;
+ return i[j](u[j](x));
+ };
+ }
+ function d3_scale_log(linear, log) {
+ function scale(x) {
+ return linear(log(x));
+ }
+ var pow = log.pow;
+ scale.invert = function(x) {
+ return pow(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(pow);
+ log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;
+ pow = log.pow;
+ linear.domain(x.map(log));
+ return scale;
+ };
+ scale.nice = function() {
+ linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));
+ return scale;
+ };
+ scale.ticks = function() {
+ var extent = d3_scaleExtent(linear.domain()), ticks = [];
+ if (extent.every(isFinite)) {
+ var i = Math.floor(extent[0]), j = Math.ceil(extent[1]), u = pow(extent[0]), v = pow(extent[1]);
+ if (log === d3_scale_logn) {
+ ticks.push(pow(i));
+ for (; i++ < j; ) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
+ } else {
+ for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
+ ticks.push(pow(i));
+ }
+ for (i = 0; ticks[i] < u; i++) {}
+ for (j = ticks.length; ticks[j - 1] > v; j--) {}
+ ticks = ticks.slice(i, j);
+ }
+ return ticks;
+ };
+ scale.tickFormat = function(n, format) {
+ if (arguments.length < 2) format = d3_scale_logFormat;
+ if (arguments.length < 1) return format;
+ var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), e;
+ return function(d) {
+ return d / pow(f(log(d) + e)) <= k ? format(d) : "";
+ };
+ };
+ scale.copy = function() {
+ return d3_scale_log(linear.copy(), log);
+ };
+ return d3_scale_linearRebind(scale, linear);
+ }
+ function d3_scale_logp(x) {
+ return Math.log(x < 0 ? 0 : x) / Math.LN10;
+ }
+ function d3_scale_logn(x) {
+ return -Math.log(x > 0 ? 0 : -x) / Math.LN10;
+ }
+ function d3_scale_pow(linear, exponent) {
+ function scale(x) {
+ return linear(powp(x));
+ }
+ var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);
+ scale.invert = function(x) {
+ return powb(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(powb);
+ linear.domain(x.map(powp));
+ return scale;
+ };
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(scale.domain(), m);
+ };
+ scale.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(scale.domain(), m);
+ };
+ scale.nice = function() {
+ return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
+ };
+ scale.exponent = function(x) {
+ if (!arguments.length) return exponent;
+ var domain = scale.domain();
+ powp = d3_scale_powPow(exponent = x);
+ powb = d3_scale_powPow(1 / exponent);
+ return scale.domain(domain);
+ };
+ scale.copy = function() {
+ return d3_scale_pow(linear.copy(), exponent);
+ };
+ return d3_scale_linearRebind(scale, linear);
+ }
+ function d3_scale_powPow(e) {
+ return function(x) {
+ return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
+ };
+ }
+ function d3_scale_ordinal(domain, ranger) {
+ function scale(x) {
+ return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length];
+ }
+ function steps(start, step) {
+ return d3.range(domain.length).map(function(i) {
+ return start + step * i;
+ });
+ }
+ var index, range, rangeBand;
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = [];
+ index = new d3_Map;
+ var i = -1, n = x.length, xi;
+ while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
+ return scale[ranger.t].apply(scale, ranger.a);
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ rangeBand = 0;
+ ranger = {
+ t: "range",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangePoints = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding);
+ range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
+ rangeBand = 0;
+ ranger = {
+ t: "rangePoints",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeBands = function(x, padding, outerPadding) {
+ if (arguments.length < 2) padding = 0;
+ if (arguments.length < 3) outerPadding = padding;
+ var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);
+ range = steps(start + step * outerPadding, step);
+ if (reverse) range.reverse();
+ rangeBand = step * (1 - padding);
+ ranger = {
+ t: "rangeBands",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeRoundBands = function(x, padding, outerPadding) {
+ if (arguments.length < 2) padding = 0;
+ if (arguments.length < 3) outerPadding = padding;
+ var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step;
+ range = steps(start + Math.round(error / 2), step);
+ if (reverse) range.reverse();
+ rangeBand = Math.round(step * (1 - padding));
+ ranger = {
+ t: "rangeRoundBands",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeBand = function() {
+ return rangeBand;
+ };
+ scale.rangeExtent = function() {
+ return d3_scaleExtent(ranger.a[0]);
+ };
+ scale.copy = function() {
+ return d3_scale_ordinal(domain, ranger);
+ };
+ return scale.domain(domain);
+ }
+ function d3_scale_quantile(domain, range) {
+ function rescale() {
+ var k = 0, n = domain.length, q = range.length;
+ thresholds = [];
+ while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
+ return scale;
+ }
+ function scale(x) {
+ if (isNaN(x = +x)) return NaN;
+ return range[d3.bisect(thresholds, x)];
+ }
+ var thresholds;
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.filter(function(d) {
+ return !isNaN(d);
+ }).sort(d3.ascending);
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.quantiles = function() {
+ return thresholds;
+ };
+ scale.copy = function() {
+ return d3_scale_quantile(domain, range);
+ };
+ return rescale();
+ }
+ function d3_scale_quantize(x0, x1, range) {
+ function scale(x) {
+ return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
+ }
+ function rescale() {
+ kx = range.length / (x1 - x0);
+ i = range.length - 1;
+ return scale;
+ }
+ var kx, i;
+ scale.domain = function(x) {
+ if (!arguments.length) return [ x0, x1 ];
+ x0 = +x[0];
+ x1 = +x[x.length - 1];
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.copy = function() {
+ return d3_scale_quantize(x0, x1, range);
+ };
+ return rescale();
+ }
+ function d3_scale_threshold(domain, range) {
+ function scale(x) {
+ return range[d3.bisect(domain, x)];
+ }
+ scale.domain = function(_) {
+ if (!arguments.length) return domain;
+ domain = _;
+ return scale;
+ };
+ scale.range = function(_) {
+ if (!arguments.length) return range;
+ range = _;
+ return scale;
+ };
+ scale.copy = function() {
+ return d3_scale_threshold(domain, range);
+ };
+ return scale;
+ }
+ function d3_scale_identity(domain) {
+ function identity(x) {
+ return +x;
+ }
+ identity.invert = identity;
+ identity.domain = identity.range = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.map(identity);
+ return identity;
+ };
+ identity.ticks = function(m) {
+ return d3_scale_linearTicks(domain, m);
+ };
+ identity.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(domain, m);
+ };
+ identity.copy = function() {
+ return d3_scale_identity(domain);
+ };
+ return identity;
+ }
+ function d3_svg_arcInnerRadius(d) {
+ return d.innerRadius;
+ }
+ function d3_svg_arcOuterRadius(d) {
+ return d.outerRadius;
+ }
+ function d3_svg_arcStartAngle(d) {
+ return d.startAngle;
+ }
+ function d3_svg_arcEndAngle(d) {
+ return d.endAngle;
+ }
+ function d3_svg_line(projection) {
+ function line(data) {
+ function segment() {
+ segments.push("M", interpolate(projection(points), tension));
+ }
+ var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
+ while (++i < n) {
+ if (defined.call(this, d = data[i], i)) {
+ points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
+ } else if (points.length) {
+ segment();
+ points = [];
+ }
+ }
+ if (points.length) segment();
+ return segments.length ? segments.join("") : null;
+ }
+ var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
+ line.x = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return line;
+ };
+ line.y = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return line;
+ };
+ line.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return line;
+ };
+ line.interpolate = function(_) {
+ if (!arguments.length) return interpolateKey;
+ if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
+ return line;
+ };
+ line.tension = function(_) {
+ if (!arguments.length) return tension;
+ tension = _;
+ return line;
+ };
+ return line;
+ }
+ function d3_svg_lineX(d) {
+ return d[0];
+ }
+ function d3_svg_lineY(d) {
+ return d[1];
+ }
+ function d3_svg_lineLinear(points) {
+ return points.join("L");
+ }
+ function d3_svg_lineLinearClosed(points) {
+ return d3_svg_lineLinear(points) + "Z";
+ }
+ function d3_svg_lineStepBefore(points) {
+ var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
+ while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
+ return path.join("");
+ }
+ function d3_svg_lineStepAfter(points) {
+ var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
+ while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
+ return path.join("");
+ }
+ function d3_svg_lineCardinalOpen(points, tension) {
+ return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));
+ }
+ function d3_svg_lineCardinalClosed(points, tension) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
+ }
+ function d3_svg_lineCardinal(points, tension, closed) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
+ }
+ function d3_svg_lineHermite(points, tangents) {
+ if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
+ return d3_svg_lineLinear(points);
+ }
+ var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
+ if (quad) {
+ path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
+ p0 = points[1];
+ pi = 2;
+ }
+ if (tangents.length > 1) {
+ t = tangents[1];
+ p = points[pi];
+ pi++;
+ path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
+ for (var i = 2; i < tangents.length; i++, pi++) {
+ p = points[pi];
+ t = tangents[i];
+ path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
+ }
+ }
+ if (quad) {
+ var lp = points[pi];
+ path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
+ }
+ return path;
+ }
+ function d3_svg_lineCardinalTangents(points, tension) {
+ var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
+ while (++i < n) {
+ p0 = p1;
+ p1 = p2;
+ p2 = points[i];
+ tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
+ }
+ return tangents;
+ }
+ function d3_svg_lineBasis(points) {
+ if (points.length < 3) return d3_svg_lineLinear(points);
+ var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ];
+ d3_svg_lineBasisBezier(path, px, py);
+ while (++i < n) {
+ pi = points[i];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ i = -1;
+ while (++i < 2) {
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBasisOpen(points) {
+ if (points.length < 4) return d3_svg_lineLinear(points);
+ var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
+ while (++i < 3) {
+ pi = points[i];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
+ --i;
+ while (++i < n) {
+ pi = points[i];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBasisClosed(points) {
+ var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
+ while (++i < 4) {
+ pi = points[i % n];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
+ --i;
+ while (++i < m) {
+ pi = points[i % n];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBundle(points, tension) {
+ var n = points.length - 1;
+ if (n) {
+ var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
+ while (++i <= n) {
+ p = points[i];
+ t = i / n;
+ p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
+ p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
+ }
+ }
+ return d3_svg_lineBasis(points);
+ }
+ function d3_svg_lineDot4(a, b) {
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
+ }
+ function d3_svg_lineBasisBezier(path, x, y) {
+ path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
+ }
+ function d3_svg_lineSlope(p0, p1) {
+ return (p1[1] - p0[1]) / (p1[0] - p0[0]);
+ }
+ function d3_svg_lineFiniteDifferences(points) {
+ var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
+ while (++i < j) {
+ m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
+ }
+ m[i] = d;
+ return m;
+ }
+ function d3_svg_lineMonotoneTangents(points) {
+ var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
+ while (++i < j) {
+ d = d3_svg_lineSlope(points[i], points[i + 1]);
+ if (Math.abs(d) < 1e-6) {
+ m[i] = m[i + 1] = 0;
+ } else {
+ a = m[i] / d;
+ b = m[i + 1] / d;
+ s = a * a + b * b;
+ if (s > 9) {
+ s = d * 3 / Math.sqrt(s);
+ m[i] = s * a;
+ m[i + 1] = s * b;
+ }
+ }
+ }
+ i = -1;
+ while (++i <= j) {
+ s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
+ tangents.push([ s || 0, m[i] * s || 0 ]);
+ }
+ return tangents;
+ }
+ function d3_svg_lineMonotone(points) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
+ }
+ function d3_svg_lineRadial(points) {
+ var point, i = -1, n = points.length, r, a;
+ while (++i < n) {
+ point = points[i];
+ r = point[0];
+ a = point[1] + d3_svg_arcOffset;
+ point[0] = r * Math.cos(a);
+ point[1] = r * Math.sin(a);
+ }
+ return points;
+ }
+ function d3_svg_area(projection) {
+ function area(data) {
+ function segment() {
+ segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
+ }
+ var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
+ return x;
+ } : d3_functor(x1), fy1 = y0 === y1 ? function() {
+ return y;
+ } : d3_functor(y1), x, y;
+ while (++i < n) {
+ if (defined.call(this, d = data[i], i)) {
+ points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
+ points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
+ } else if (points0.length) {
+ segment();
+ points0 = [];
+ points1 = [];
+ }
+ }
+ if (points0.length) segment();
+ return segments.length ? segments.join("") : null;
+ }
+ var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
+ area.x = function(_) {
+ if (!arguments.length) return x1;
+ x0 = x1 = _;
+ return area;
+ };
+ area.x0 = function(_) {
+ if (!arguments.length) return x0;
+ x0 = _;
+ return area;
+ };
+ area.x1 = function(_) {
+ if (!arguments.length) return x1;
+ x1 = _;
+ return area;
+ };
+ area.y = function(_) {
+ if (!arguments.length) return y1;
+ y0 = y1 = _;
+ return area;
+ };
+ area.y0 = function(_) {
+ if (!arguments.length) return y0;
+ y0 = _;
+ return area;
+ };
+ area.y1 = function(_) {
+ if (!arguments.length) return y1;
+ y1 = _;
+ return area;
+ };
+ area.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return area;
+ };
+ area.interpolate = function(_) {
+ if (!arguments.length) return interpolateKey;
+ if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
+ interpolateReverse = interpolate.reverse || interpolate;
+ L = interpolate.closed ? "M" : "L";
+ return area;
+ };
+ area.tension = function(_) {
+ if (!arguments.length) return tension;
+ tension = _;
+ return area;
+ };
+ return area;
+ }
+ function d3_svg_chordSource(d) {
+ return d.source;
+ }
+ function d3_svg_chordTarget(d) {
+ return d.target;
+ }
+ function d3_svg_chordRadius(d) {
+ return d.radius;
+ }
+ function d3_svg_chordStartAngle(d) {
+ return d.startAngle;
+ }
+ function d3_svg_chordEndAngle(d) {
+ return d.endAngle;
+ }
+ function d3_svg_diagonalProjection(d) {
+ return [ d.x, d.y ];
+ }
+ function d3_svg_diagonalRadialProjection(projection) {
+ return function() {
+ var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset;
+ return [ r * Math.cos(a), r * Math.sin(a) ];
+ };
+ }
+ function d3_svg_symbolSize() {
+ return 64;
+ }
+ function d3_svg_symbolType() {
+ return "circle";
+ }
+ function d3_svg_symbolCircle(size) {
+ var r = Math.sqrt(size / Math.PI);
+ return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
+ }
+ function d3_svg_axisX(selection, x) {
+ selection.attr("transform", function(d) {
+ return "translate(" + x(d) + ",0)";
+ });
+ }
+ function d3_svg_axisY(selection, y) {
+ selection.attr("transform", function(d) {
+ return "translate(0," + y(d) + ")";
+ });
+ }
+ function d3_svg_axisSubdivide(scale, ticks, m) {
+ subticks = [];
+ if (m && ticks.length > 1) {
+ var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v;
+ while (++i < n) {
+ for (j = m; --j > 0; ) {
+ if ((v = +ticks[i] - j * d) >= extent[0]) {
+ subticks.push(v);
+ }
+ }
+ }
+ for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) {
+ subticks.push(v);
+ }
+ }
+ return subticks;
+ }
+ function d3_behavior_zoomDelta() {
+ if (!d3_behavior_zoomDiv) {
+ d3_behavior_zoomDiv = d3.select("body").append("div").style("visibility", "hidden").style("top", 0).style("height", 0).style("width", 0).style("overflow-y", "scroll").append("div").style("height", "2000px").node().parentNode;
+ }
+ var e = d3.event, delta;
+ try {
+ d3_behavior_zoomDiv.scrollTop = 1e3;
+ d3_behavior_zoomDiv.dispatchEvent(e);
+ delta = 1e3 - d3_behavior_zoomDiv.scrollTop;
+ } catch (error) {
+ delta = e.wheelDelta || -e.detail * 5;
+ }
+ return delta;
+ }
+ function d3_layout_bundlePath(link) {
+ var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];
+ while (start !== lca) {
+ start = start.parent;
+ points.push(start);
+ }
+ var k = points.length;
+ while (end !== lca) {
+ points.splice(k, 0, end);
+ end = end.parent;
+ }
+ return points;
+ }
+ function d3_layout_bundleAncestors(node) {
+ var ancestors = [], parent = node.parent;
+ while (parent != null) {
+ ancestors.push(node);
+ node = parent;
+ parent = parent.parent;
+ }
+ ancestors.push(node);
+ return ancestors;
+ }
+ function d3_layout_bundleLeastCommonAncestor(a, b) {
+ if (a === b) return a;
+ var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;
+ while (aNode === bNode) {
+ sharedNode = aNode;
+ aNode = aNodes.pop();
+ bNode = bNodes.pop();
+ }
+ return sharedNode;
+ }
+ function d3_layout_forceDragstart(d) {
+ d.fixed |= 2;
+ }
+ function d3_layout_forceDragend(d) {
+ d.fixed &= 1;
+ }
+ function d3_layout_forceMouseover(d) {
+ d.fixed |= 4;
+ }
+ function d3_layout_forceMouseout(d) {
+ d.fixed &= 3;
+ }
+ function d3_layout_forceAccumulate(quad, alpha, charges) {
+ var cx = 0, cy = 0;
+ quad.charge = 0;
+ if (!quad.leaf) {
+ var nodes = quad.nodes, n = nodes.length, i = -1, c;
+ while (++i < n) {
+ c = nodes[i];
+ if (c == null) continue;
+ d3_layout_forceAccumulate(c, alpha, charges);
+ quad.charge += c.charge;
+ cx += c.charge * c.cx;
+ cy += c.charge * c.cy;
+ }
+ }
+ if (quad.point) {
+ if (!quad.leaf) {
+ quad.point.x += Math.random() - .5;
+ quad.point.y += Math.random() - .5;
+ }
+ var k = alpha * charges[quad.point.index];
+ quad.charge += quad.pointCharge = k;
+ cx += k * quad.point.x;
+ cy += k * quad.point.y;
+ }
+ quad.cx = cx / quad.charge;
+ quad.cy = cy / quad.charge;
+ }
+ function d3_layout_forceLinkDistance(link) {
+ return 20;
+ }
+ function d3_layout_forceLinkStrength(link) {
+ return 1;
+ }
+ function d3_layout_stackX(d) {
+ return d.x;
+ }
+ function d3_layout_stackY(d) {
+ return d.y;
+ }
+ function d3_layout_stackOut(d, y0, y) {
+ d.y0 = y0;
+ d.y = y;
+ }
+ function d3_layout_stackOrderDefault(data) {
+ return d3.range(data.length);
+ }
+ function d3_layout_stackOffsetZero(data) {
+ var j = -1, m = data[0].length, y0 = [];
+ while (++j < m) y0[j] = 0;
+ return y0;
+ }
+ function d3_layout_stackMaxIndex(array) {
+ var i = 1, j = 0, v = array[0][1], k, n = array.length;
+ for (; i < n; ++i) {
+ if ((k = array[i][1]) > v) {
+ j = i;
+ v = k;
+ }
+ }
+ return j;
+ }
+ function d3_layout_stackReduceSum(d) {
+ return d.reduce(d3_layout_stackSum, 0);
+ }
+ function d3_layout_stackSum(p, d) {
+ return p + d[1];
+ }
+ function d3_layout_histogramBinSturges(range, values) {
+ return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
+ }
+ function d3_layout_histogramBinFixed(range, n) {
+ var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];
+ while (++x <= n) f[x] = m * x + b;
+ return f;
+ }
+ function d3_layout_histogramRange(values) {
+ return [ d3.min(values), d3.max(values) ];
+ }
+ function d3_layout_hierarchyRebind(object, hierarchy) {
+ d3.rebind(object, hierarchy, "sort", "children", "value");
+ object.links = d3_layout_hierarchyLinks;
+ object.nodes = function(d) {
+ d3_layout_hierarchyInline = true;
+ return (object.nodes = object)(d);
+ };
+ return object;
+ }
+ function d3_layout_hierarchyChildren(d) {
+ return d.children;
+ }
+ function d3_layout_hierarchyValue(d) {
+ return d.value;
+ }
+ function d3_layout_hierarchySort(a, b) {
+ return b.value - a.value;
+ }
+ function d3_layout_hierarchyLinks(nodes) {
+ return d3.merge(nodes.map(function(parent) {
+ return (parent.children || []).map(function(child) {
+ return {
+ source: parent,
+ target: child
+ };
+ });
+ }));
+ }
+ function d3_layout_packSort(a, b) {
+ return a.value - b.value;
+ }
+ function d3_layout_packInsert(a, b) {
+ var c = a._pack_next;
+ a._pack_next = b;
+ b._pack_prev = a;
+ b._pack_next = c;
+ c._pack_prev = b;
+ }
+ function d3_layout_packSplice(a, b) {
+ a._pack_next = b;
+ b._pack_prev = a;
+ }
+ function d3_layout_packIntersects(a, b) {
+ var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;
+ return dr * dr - dx * dx - dy * dy > .001;
+ }
+ function d3_layout_packSiblings(node) {
+ function bound(node) {
+ xMin = Math.min(node.x - node.r, xMin);
+ xMax = Math.max(node.x + node.r, xMax);
+ yMin = Math.min(node.y - node.r, yMin);
+ yMax = Math.max(node.y + node.r, yMax);
+ }
+ if (!(nodes = node.children) || !(n = nodes.length)) return;
+ var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;
+ nodes.forEach(d3_layout_packLink);
+ a = nodes[0];
+ a.x = -a.r;
+ a.y = 0;
+ bound(a);
+ if (n > 1) {
+ b = nodes[1];
+ b.x = b.r;
+ b.y = 0;
+ bound(b);
+ if (n > 2) {
+ c = nodes[2];
+ d3_layout_packPlace(a, b, c);
+ bound(c);
+ d3_layout_packInsert(a, c);
+ a._pack_prev = c;
+ d3_layout_packInsert(c, b);
+ b = a._pack_next;
+ for (i = 3; i < n; i++) {
+ d3_layout_packPlace(a, b, c = nodes[i]);
+ var isect = 0, s1 = 1, s2 = 1;
+ for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
+ if (d3_layout_packIntersects(j, c)) {
+ isect = 1;
+ break;
+ }
+ }
+ if (isect == 1) {
+ for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
+ if (d3_layout_packIntersects(k, c)) {
+ break;
+ }
+ }
+ }
+ if (isect) {
+ if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);
+ i--;
+ } else {
+ d3_layout_packInsert(a, c);
+ b = c;
+ bound(c);
+ }
+ }
+ }
+ }
+ var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;
+ for (i = 0; i < n; i++) {
+ c = nodes[i];
+ c.x -= cx;
+ c.y -= cy;
+ cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));
+ }
+ node.r = cr;
+ nodes.forEach(d3_layout_packUnlink);
+ }
+ function d3_layout_packLink(node) {
+ node._pack_next = node._pack_prev = node;
+ }
+ function d3_layout_packUnlink(node) {
+ delete node._pack_next;
+ delete node._pack_prev;
+ }
+ function d3_layout_packTransform(node, x, y, k) {
+ var children = node.children;
+ node.x = x += k * node.x;
+ node.y = y += k * node.y;
+ node.r *= k;
+ if (children) {
+ var i = -1, n = children.length;
+ while (++i < n) d3_layout_packTransform(children[i], x, y, k);
+ }
+ }
+ function d3_layout_packPlace(a, b, c) {
+ var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;
+ if (db && (dx || dy)) {
+ var da = b.r + c.r, dc = dx * dx + dy * dy;
+ da *= da;
+ db *= db;
+ var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
+ c.x = a.x + x * dx + y * dy;
+ c.y = a.y + x * dy - y * dx;
+ } else {
+ c.x = a.x + db;
+ c.y = a.y;
+ }
+ }
+ function d3_layout_clusterY(children) {
+ return 1 + d3.max(children, function(child) {
+ return child.y;
+ });
+ }
+ function d3_layout_clusterX(children) {
+ return children.reduce(function(x, child) {
+ return x + child.x;
+ }, 0) / children.length;
+ }
+ function d3_layout_clusterLeft(node) {
+ var children = node.children;
+ return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
+ }
+ function d3_layout_clusterRight(node) {
+ var children = node.children, n;
+ return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
+ }
+ function d3_layout_treeSeparation(a, b) {
+ return a.parent == b.parent ? 1 : 2;
+ }
+ function d3_layout_treeLeft(node) {
+ var children = node.children;
+ return children && children.length ? children[0] : node._tree.thread;
+ }
+ function d3_layout_treeRight(node) {
+ var children = node.children, n;
+ return children && (n = children.length) ? children[n - 1] : node._tree.thread;
+ }
+ function d3_layout_treeSearch(node, compare) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child, n, i = -1;
+ while (++i < n) {
+ if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
+ node = child;
+ }
+ }
+ }
+ return node;
+ }
+ function d3_layout_treeRightmost(a, b) {
+ return a.x - b.x;
+ }
+ function d3_layout_treeLeftmost(a, b) {
+ return b.x - a.x;
+ }
+ function d3_layout_treeDeepest(a, b) {
+ return a.depth - b.depth;
+ }
+ function d3_layout_treeVisitAfter(node, callback) {
+ function visit(node, previousSibling) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child, previousChild = null, i = -1, n;
+ while (++i < n) {
+ child = children[i];
+ visit(child, previousChild);
+ previousChild = child;
+ }
+ }
+ callback(node, previousSibling);
+ }
+ visit(node, null);
+ }
+ function d3_layout_treeShift(node) {
+ var shift = 0, change = 0, children = node.children, i = children.length, child;
+ while (--i >= 0) {
+ child = children[i]._tree;
+ child.prelim += shift;
+ child.mod += shift;
+ shift += child.shift + (change += child.change);
+ }
+ }
+ function d3_layout_treeMove(ancestor, node, shift) {
+ ancestor = ancestor._tree;
+ node = node._tree;
+ var change = shift / (node.number - ancestor.number);
+ ancestor.change += change;
+ node.change -= change;
+ node.shift += shift;
+ node.prelim += shift;
+ node.mod += shift;
+ }
+ function d3_layout_treeAncestor(vim, node, ancestor) {
+ return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor;
+ }
+ function d3_layout_treemapPadNull(node) {
+ return {
+ x: node.x,
+ y: node.y,
+ dx: node.dx,
+ dy: node.dy
+ };
+ }
+ function d3_layout_treemapPad(node, padding) {
+ var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2];
+ if (dx < 0) {
+ x += dx / 2;
+ dx = 0;
+ }
+ if (dy < 0) {
+ y += dy / 2;
+ dy = 0;
+ }
+ return {
+ x: x,
+ y: y,
+ dx: dx,
+ dy: dy
+ };
+ }
+ function d3_dsv(delimiter, mimeType) {
+ function dsv(url, callback) {
+ d3.text(url, mimeType, function(text) {
+ callback(text && dsv.parse(text));
+ });
+ }
+ function formatRow(row) {
+ return row.map(formatValue).join(delimiter);
+ }
+ function formatValue(text) {
+ return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text;
+ }
+ var reParse = new RegExp("\r\n|[" + delimiter + "\r\n]", "g"), reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
+ dsv.parse = function(text) {
+ var header;
+ return dsv.parseRows(text, function(row, i) {
+ if (i) {
+ var o = {}, j = -1, m = header.length;
+ while (++j < m) o[header[j]] = row[j];
+ return o;
+ } else {
+ header = row;
+ return null;
+ }
+ });
+ };
+ dsv.parseRows = function(text, f) {
+ function token() {
+ if (reParse.lastIndex >= text.length) return EOF;
+ if (eol) {
+ eol = false;
+ return EOL;
+ }
+ var j = reParse.lastIndex;
+ if (text.charCodeAt(j) === 34) {
+ var i = j;
+ while (i++ < text.length) {
+ if (text.charCodeAt(i) === 34) {
+ if (text.charCodeAt(i + 1) !== 34) break;
+ i++;
+ }
+ }
+ reParse.lastIndex = i + 2;
+ var c = text.charCodeAt(i + 1);
+ if (c === 13) {
+ eol = true;
+ if (text.charCodeAt(i + 2) === 10) reParse.lastIndex++;
+ } else if (c === 10) {
+ eol = true;
+ }
+ return text.substring(j + 1, i).replace(/""/g, '"');
+ }
+ var m = reParse.exec(text);
+ if (m) {
+ eol = m[0].charCodeAt(0) !== delimiterCode;
+ return text.substring(j, m.index);
+ }
+ reParse.lastIndex = text.length;
+ return text.substring(j);
+ }
+ var EOL = {}, EOF = {}, rows = [], n = 0, t, eol;
+ reParse.lastIndex = 0;
+ while ((t = token()) !== EOF) {
+ var a = [];
+ while (t !== EOL && t !== EOF) {
+ a.push(t);
+ t = token();
+ }
+ if (f && !(a = f(a, n++))) continue;
+ rows.push(a);
+ }
+ return rows;
+ };
+ dsv.format = function(rows) {
+ return rows.map(formatRow).join("\n");
+ };
+ return dsv;
+ }
+ function d3_geo_type(types, defaultValue) {
+ return function(object) {
+ return object && types.hasOwnProperty(object.type) ? types[object.type](object) : defaultValue;
+ };
+ }
+ function d3_path_circle(radius) {
+ return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z";
+ }
+ function d3_geo_bounds(o, f) {
+ if (d3_geo_boundsTypes.hasOwnProperty(o.type)) d3_geo_boundsTypes[o.type](o, f);
+ }
+ function d3_geo_boundsFeature(o, f) {
+ d3_geo_bounds(o.geometry, f);
+ }
+ function d3_geo_boundsFeatureCollection(o, f) {
+ for (var a = o.features, i = 0, n = a.length; i < n; i++) {
+ d3_geo_bounds(a[i].geometry, f);
+ }
+ }
+ function d3_geo_boundsGeometryCollection(o, f) {
+ for (var a = o.geometries, i = 0, n = a.length; i < n; i++) {
+ d3_geo_bounds(a[i], f);
+ }
+ }
+ function d3_geo_boundsLineString(o, f) {
+ for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
+ f.apply(null, a[i]);
+ }
+ }
+ function d3_geo_boundsMultiLineString(o, f) {
+ for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
+ for (var b = a[i], j = 0, m = b.length; j < m; j++) {
+ f.apply(null, b[j]);
+ }
+ }
+ }
+ function d3_geo_boundsMultiPolygon(o, f) {
+ for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
+ for (var b = a[i][0], j = 0, m = b.length; j < m; j++) {
+ f.apply(null, b[j]);
+ }
+ }
+ }
+ function d3_geo_boundsPoint(o, f) {
+ f.apply(null, o.coordinates);
+ }
+ function d3_geo_boundsPolygon(o, f) {
+ for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) {
+ f.apply(null, a[i]);
+ }
+ }
+ function d3_geo_greatArcSource(d) {
+ return d.source;
+ }
+ function d3_geo_greatArcTarget(d) {
+ return d.target;
+ }
+ function d3_geo_greatArcInterpolator() {
+ function interpolate(t) {
+ var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;
+ return [ Math.atan2(y, x) / d3_geo_radians, Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians ];
+ }
+ var x0, y0, cy0, sy0, kx0, ky0, x1, y1, cy1, sy1, kx1, ky1, d, k;
+ interpolate.distance = function() {
+ if (d == null) k = 1 / Math.sin(d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))));
+ return d;
+ };
+ interpolate.source = function(_) {
+ var cx0 = Math.cos(x0 = _[0] * d3_geo_radians), sx0 = Math.sin(x0);
+ cy0 = Math.cos(y0 = _[1] * d3_geo_radians);
+ sy0 = Math.sin(y0);
+ kx0 = cy0 * cx0;
+ ky0 = cy0 * sx0;
+ d = null;
+ return interpolate;
+ };
+ interpolate.target = function(_) {
+ var cx1 = Math.cos(x1 = _[0] * d3_geo_radians), sx1 = Math.sin(x1);
+ cy1 = Math.cos(y1 = _[1] * d3_geo_radians);
+ sy1 = Math.sin(y1);
+ kx1 = cy1 * cx1;
+ ky1 = cy1 * sx1;
+ d = null;
+ return interpolate;
+ };
+ return interpolate;
+ }
+ function d3_geo_greatArcInterpolate(a, b) {
+ var i = d3_geo_greatArcInterpolator().source(a).target(b);
+ i.distance();
+ return i;
+ }
+ function d3_geom_contourStart(grid) {
+ var x = 0, y = 0;
+ while (true) {
+ if (grid(x, y)) {
+ return [ x, y ];
+ }
+ if (x === 0) {
+ x = y + 1;
+ y = 0;
+ } else {
+ x = x - 1;
+ y = y + 1;
+ }
+ }
+ }
+ function d3_geom_hullCCW(i1, i2, i3, v) {
+ var t, a, b, c, d, e, f;
+ t = v[i1];
+ a = t[0];
+ b = t[1];
+ t = v[i2];
+ c = t[0];
+ d = t[1];
+ t = v[i3];
+ e = t[0];
+ f = t[1];
+ return (f - b) * (c - a) - (d - b) * (e - a) > 0;
+ }
+ function d3_geom_polygonInside(p, a, b) {
+ return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
+ }
+ function d3_geom_polygonIntersect(c, d, a, b) {
+ var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], x13 = x1 - x3, x21 = x2 - x1, x43 = x4 - x3, y13 = y1 - y3, y21 = y2 - y1, y43 = y4 - y3, ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21);
+ return [ x1 + ua * x21, y1 + ua * y21 ];
+ }
+ function d3_voronoi_tessellate(vertices, callback) {
+ var Sites = {
+ list: vertices.map(function(v, i) {
+ return {
+ index: i,
+ x: v[0],
+ y: v[1]
+ };
+ }).sort(function(a, b) {
+ return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0;
+ }),
+ bottomSite: null
+ };
+ var EdgeList = {
+ list: [],
+ leftEnd: null,
+ rightEnd: null,
+ init: function() {
+ EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.leftEnd.r = EdgeList.rightEnd;
+ EdgeList.rightEnd.l = EdgeList.leftEnd;
+ EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
+ },
+ createHalfEdge: function(edge, side) {
+ return {
+ edge: edge,
+ side: side,
+ vertex: null,
+ l: null,
+ r: null
+ };
+ },
+ insert: function(lb, he) {
+ he.l = lb;
+ he.r = lb.r;
+ lb.r.l = he;
+ lb.r = he;
+ },
+ leftBound: function(p) {
+ var he = EdgeList.leftEnd;
+ do {
+ he = he.r;
+ } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
+ he = he.l;
+ return he;
+ },
+ del: function(he) {
+ he.l.r = he.r;
+ he.r.l = he.l;
+ he.edge = null;
+ },
+ right: function(he) {
+ return he.r;
+ },
+ left: function(he) {
+ return he.l;
+ },
+ leftRegion: function(he) {
+ return he.edge == null ? Sites.bottomSite : he.edge.region[he.side];
+ },
+ rightRegion: function(he) {
+ return he.edge == null ? Sites.bottomSite : he.edge.region[d3_voronoi_opposite[he.side]];
+ }
+ };
+ var Geom = {
+ bisect: function(s1, s2) {
+ var newEdge = {
+ region: {
+ l: s1,
+ r: s2
+ },
+ ep: {
+ l: null,
+ r: null
+ }
+ };
+ var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy;
+ newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5;
+ if (adx > ady) {
+ newEdge.a = 1;
+ newEdge.b = dy / dx;
+ newEdge.c /= dx;
+ } else {
+ newEdge.b = 1;
+ newEdge.a = dx / dy;
+ newEdge.c /= dy;
+ }
+ return newEdge;
+ },
+ intersect: function(el1, el2) {
+ var e1 = el1.edge, e2 = el2.edge;
+ if (!e1 || !e2 || e1.region.r == e2.region.r) {
+ return null;
+ }
+ var d = e1.a * e2.b - e1.b * e2.a;
+ if (Math.abs(d) < 1e-10) {
+ return null;
+ }
+ var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e;
+ if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) {
+ el = el1;
+ e = e1;
+ } else {
+ el = el2;
+ e = e2;
+ }
+ var rightOfSite = xint >= e.region.r.x;
+ if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") {
+ return null;
+ }
+ return {
+ x: xint,
+ y: yint
+ };
+ },
+ rightOf: function(he, p) {
+ var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x;
+ if (rightOfSite && he.side === "l") {
+ return 1;
+ }
+ if (!rightOfSite && he.side === "r") {
+ return 0;
+ }
+ if (e.a === 1) {
+ var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0;
+ if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) {
+ above = fast = dyp >= e.b * dxp;
+ } else {
+ above = p.x + p.y * e.b > e.c;
+ if (e.b < 0) {
+ above = !above;
+ }
+ if (!above) {
+ fast = 1;
+ }
+ }
+ if (!fast) {
+ var dxs = topsite.x - e.region.l.x;
+ above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b);
+ if (e.b < 0) {
+ above = !above;
+ }
+ }
+ } else {
+ var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y;
+ above = t1 * t1 > t2 * t2 + t3 * t3;
+ }
+ return he.side === "l" ? above : !above;
+ },
+ endPoint: function(edge, side, site) {
+ edge.ep[side] = site;
+ if (!edge.ep[d3_voronoi_opposite[side]]) return;
+ callback(edge);
+ },
+ distance: function(s, t) {
+ var dx = s.x - t.x, dy = s.y - t.y;
+ return Math.sqrt(dx * dx + dy * dy);
+ }
+ };
+ var EventQueue = {
+ list: [],
+ insert: function(he, site, offset) {
+ he.vertex = site;
+ he.ystar = site.y + offset;
+ for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) {
+ var next = list[i];
+ if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ list.splice(i, 0, he);
+ },
+ del: function(he) {
+ for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {}
+ ls.splice(i, 1);
+ },
+ empty: function() {
+ return EventQueue.list.length === 0;
+ },
+ nextEvent: function(he) {
+ for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) {
+ if (ls[i] == he) return ls[i + 1];
+ }
+ return null;
+ },
+ min: function() {
+ var elem = EventQueue.list[0];
+ return {
+ x: elem.vertex.x,
+ y: elem.ystar
+ };
+ },
+ extractMin: function() {
+ return EventQueue.list.shift();
+ }
+ };
+ EdgeList.init();
+ Sites.bottomSite = Sites.list.shift();
+ var newSite = Sites.list.shift(), newIntStar;
+ var lbnd, rbnd, llbnd, rrbnd, bisector;
+ var bot, top, temp, p, v;
+ var e, pm;
+ while (true) {
+ if (!EventQueue.empty()) {
+ newIntStar = EventQueue.min();
+ }
+ if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) {
+ lbnd = EdgeList.leftBound(newSite);
+ rbnd = EdgeList.right(lbnd);
+ bot = EdgeList.rightRegion(lbnd);
+ e = Geom.bisect(bot, newSite);
+ bisector = EdgeList.createHalfEdge(e, "l");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(lbnd, bisector);
+ if (p) {
+ EventQueue.del(lbnd);
+ EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
+ }
+ lbnd = bisector;
+ bisector = EdgeList.createHalfEdge(e, "r");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(bisector, rbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, newSite));
+ }
+ newSite = Sites.list.shift();
+ } else if (!EventQueue.empty()) {
+ lbnd = EventQueue.extractMin();
+ llbnd = EdgeList.left(lbnd);
+ rbnd = EdgeList.right(lbnd);
+ rrbnd = EdgeList.right(rbnd);
+ bot = EdgeList.leftRegion(lbnd);
+ top = EdgeList.rightRegion(rbnd);
+ v = lbnd.vertex;
+ Geom.endPoint(lbnd.edge, lbnd.side, v);
+ Geom.endPoint(rbnd.edge, rbnd.side, v);
+ EdgeList.del(lbnd);
+ EventQueue.del(rbnd);
+ EdgeList.del(rbnd);
+ pm = "l";
+ if (bot.y > top.y) {
+ temp = bot;
+ bot = top;
+ top = temp;
+ pm = "r";
+ }
+ e = Geom.bisect(bot, top);
+ bisector = EdgeList.createHalfEdge(e, pm);
+ EdgeList.insert(llbnd, bisector);
+ Geom.endPoint(e, d3_voronoi_opposite[pm], v);
+ p = Geom.intersect(llbnd, bisector);
+ if (p) {
+ EventQueue.del(llbnd);
+ EventQueue.insert(llbnd, p, Geom.distance(p, bot));
+ }
+ p = Geom.intersect(bisector, rrbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, bot));
+ }
+ } else {
+ break;
+ }
+ }
+ for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) {
+ callback(lbnd.edge);
+ }
+ }
+ function d3_geom_quadtreeNode() {
+ return {
+ leaf: true,
+ nodes: [],
+ point: null
+ };
+ }
+ function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
+ if (!f(node, x1, y1, x2, y2)) {
+ var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;
+ if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
+ if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
+ if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
+ if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
+ }
+ }
+ function d3_geom_quadtreePoint(p) {
+ return {
+ x: p[0],
+ y: p[1]
+ };
+ }
+ function d3_time_utc() {
+ this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);
+ }
+ function d3_time_formatAbbreviate(name) {
+ return name.substring(0, 3);
+ }
+ function d3_time_parse(date, template, string, j) {
+ var c, p, i = 0, n = template.length, m = string.length;
+ while (i < n) {
+ if (j >= m) return -1;
+ c = template.charCodeAt(i++);
+ if (c == 37) {
+ p = d3_time_parsers[template.charAt(i++)];
+ if (!p || (j = p(date, string, j)) < 0) return -1;
+ } else if (c != string.charCodeAt(j++)) {
+ return -1;
+ }
+ }
+ return j;
+ }
+ function d3_time_formatRe(names) {
+ return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i");
+ }
+ function d3_time_formatLookup(names) {
+ var map = new d3_Map, i = -1, n = names.length;
+ while (++i < n) map.set(names[i].toLowerCase(), i);
+ return map;
+ }
+ function d3_time_parseWeekdayAbbrev(date, string, i) {
+ d3_time_dayAbbrevRe.lastIndex = 0;
+ var n = d3_time_dayAbbrevRe.exec(string.substring(i));
+ return n ? i += n[0].length : -1;
+ }
+ function d3_time_parseWeekday(date, string, i) {
+ d3_time_dayRe.lastIndex = 0;
+ var n = d3_time_dayRe.exec(string.substring(i));
+ return n ? i += n[0].length : -1;
+ }
+ function d3_time_parseMonthAbbrev(date, string, i) {
+ d3_time_monthAbbrevRe.lastIndex = 0;
+ var n = d3_time_monthAbbrevRe.exec(string.substring(i));
+ return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
+ }
+ function d3_time_parseMonth(date, string, i) {
+ d3_time_monthRe.lastIndex = 0;
+ var n = d3_time_monthRe.exec(string.substring(i));
+ return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
+ }
+ function d3_time_parseLocaleFull(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
+ }
+ function d3_time_parseLocaleDate(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
+ }
+ function d3_time_parseLocaleTime(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
+ }
+ function d3_time_parseFullYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 4));
+ return n ? (date.y = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1;
+ }
+ function d3_time_expandYear(d) {
+ return d + (d > 68 ? 1900 : 2e3);
+ }
+ function d3_time_parseMonthNumber(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.m = n[0] - 1, i += n[0].length) : -1;
+ }
+ function d3_time_parseDay(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.d = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseHour24(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.H = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseMinutes(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.M = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseSeconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.S = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseMilliseconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 3));
+ return n ? (date.L = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseAmPm(date, string, i) {
+ var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
+ return n == null ? -1 : (date.p = n, i);
+ }
+ function d3_time_zone(d) {
+ var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60;
+ return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm);
+ }
+ function d3_time_formatIsoNative(date) {
+ return date.toISOString();
+ }
+ function d3_time_interval(local, step, number) {
+ function round(date) {
+ var d0 = local(date), d1 = offset(d0, 1);
+ return date - d0 < d1 - date ? d0 : d1;
+ }
+ function ceil(date) {
+ step(date = local(new d3_time(date - 1)), 1);
+ return date;
+ }
+ function offset(date, k) {
+ step(date = new d3_time(+date), k);
+ return date;
+ }
+ function range(t0, t1, dt) {
+ var time = ceil(t0), times = [];
+ if (dt > 1) {
+ while (time < t1) {
+ if (!(number(time) % dt)) times.push(new Date(+time));
+ step(time, 1);
+ }
+ } else {
+ while (time < t1) times.push(new Date(+time)), step(time, 1);
+ }
+ return times;
+ }
+ function range_utc(t0, t1, dt) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time_utc;
+ utc._ = t0;
+ return range(utc, t1, dt);
+ } finally {
+ d3_time = Date;
+ }
+ }
+ local.floor = local;
+ local.round = round;
+ local.ceil = ceil;
+ local.offset = offset;
+ local.range = range;
+ var utc = local.utc = d3_time_interval_utc(local);
+ utc.floor = utc;
+ utc.round = d3_time_interval_utc(round);
+ utc.ceil = d3_time_interval_utc(ceil);
+ utc.offset = d3_time_interval_utc(offset);
+ utc.range = range_utc;
+ return local;
+ }
+ function d3_time_interval_utc(method) {
+ return function(date, k) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time_utc;
+ utc._ = date;
+ return method(utc, k)._;
+ } finally {
+ d3_time = Date;
+ }
+ };
+ }
+ function d3_time_scale(linear, methods, format) {
+ function scale(x) {
+ return linear(x);
+ }
+ scale.invert = function(x) {
+ return d3_time_scaleDate(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
+ linear.domain(x);
+ return scale;
+ };
+ scale.nice = function(m) {
+ return scale.domain(d3_scale_nice(scale.domain(), function() {
+ return m;
+ }));
+ };
+ scale.ticks = function(m, k) {
+ var extent = d3_time_scaleExtent(scale.domain());
+ if (typeof m !== "function") {
+ var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target);
+ if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
+ if (!i) return linear.ticks(m).map(d3_time_scaleDate);
+ if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
+ m = methods[i];
+ k = m[1];
+ m = m[0].range;
+ }
+ return m(extent[0], new Date(+extent[1] + 1), k);
+ };
+ scale.tickFormat = function() {
+ return format;
+ };
+ scale.copy = function() {
+ return d3_time_scale(linear.copy(), methods, format);
+ };
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+ }
+ function d3_time_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [ start, stop ] : [ stop, start ];
+ }
+ function d3_time_scaleDate(t) {
+ return new Date(t);
+ }
+ function d3_time_scaleFormat(formats) {
+ return function(date) {
+ var i = formats.length - 1, f = formats[i];
+ while (!f[1](date)) f = formats[--i];
+ return f[0](date);
+ };
+ }
+ function d3_time_scaleSetYear(y) {
+ var d = new Date(y, 0, 1);
+ d.setFullYear(y);
+ return d;
+ }
+ function d3_time_scaleGetYear(d) {
+ var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1);
+ return y + (d - d0) / (d1 - d0);
+ }
+ function d3_time_scaleUTCSetYear(y) {
+ var d = new Date(Date.UTC(y, 0, 1));
+ d.setUTCFullYear(y);
+ return d;
+ }
+ function d3_time_scaleUTCGetYear(d) {
+ var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1);
+ return y + (d - d0) / (d1 - d0);
+ }
+ if (!Date.now) Date.now = function() {
+ return +(new Date);
+ };
+ try {
+ document.createElement("div").style.setProperty("opacity", 0, "");
+ } catch (error) {
+ var d3_style_prototype = CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
+ d3_style_prototype.setProperty = function(name, value, priority) {
+ d3_style_setProperty.call(this, name, value + "", priority);
+ };
+ }
+ d3 = {
+ version: "2.10.2"
+ };
+ var d3_array = d3_arraySlice;
+ try {
+ d3_array(document.documentElement.childNodes)[0].nodeType;
+ } catch (e) {
+ d3_array = d3_arrayCopy;
+ }
+ var d3_arraySubclass = [].__proto__ ? function(array, prototype) {
+ array.__proto__ = prototype;
+ } : function(array, prototype) {
+ for (var property in prototype) array[property] = prototype[property];
+ };
+ d3.map = function(object) {
+ var map = new d3_Map;
+ for (var key in object) map.set(key, object[key]);
+ return map;
+ };
+ d3_class(d3_Map, {
+ has: function(key) {
+ return d3_map_prefix + key in this;
+ },
+ get: function(key) {
+ return this[d3_map_prefix + key];
+ },
+ set: function(key, value) {
+ return this[d3_map_prefix + key] = value;
+ },
+ remove: function(key) {
+ key = d3_map_prefix + key;
+ return key in this && delete this[key];
+ },
+ keys: function() {
+ var keys = [];
+ this.forEach(function(key) {
+ keys.push(key);
+ });
+ return keys;
+ },
+ values: function() {
+ var values = [];
+ this.forEach(function(key, value) {
+ values.push(value);
+ });
+ return values;
+ },
+ entries: function() {
+ var entries = [];
+ this.forEach(function(key, value) {
+ entries.push({
+ key: key,
+ value: value
+ });
+ });
+ return entries;
+ },
+ forEach: function(f) {
+ for (var key in this) {
+ if (key.charCodeAt(0) === d3_map_prefixCode) {
+ f.call(this, key.substring(1), this[key]);
+ }
+ }
+ }
+ });
+ var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
+ d3.functor = d3_functor;
+ d3.rebind = function(target, source) {
+ var i = 1, n = arguments.length, method;
+ while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
+ return target;
+ };
+ d3.ascending = function(a, b) {
+ return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
+ };
+ d3.descending = function(a, b) {
+ return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
+ };
+ d3.mean = function(array, f) {
+ var n = array.length, a, m = 0, i = -1, j = 0;
+ if (arguments.length === 1) {
+ while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
+ } else {
+ while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
+ }
+ return j ? m : undefined;
+ };
+ d3.median = function(array, f) {
+ if (arguments.length > 1) array = array.map(f);
+ array = array.filter(d3_number);
+ return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
+ };
+ d3.min = function(array, f) {
+ var i = -1, n = array.length, a, b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && a > b) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
+ }
+ return a;
+ };
+ d3.max = function(array, f) {
+ var i = -1, n = array.length, a, b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && b > a) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
+ }
+ return a;
+ };
+ d3.extent = function(array, f) {
+ var i = -1, n = array.length, a, b, c;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
+ while (++i < n) if ((b = array[i]) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ } else {
+ while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ }
+ return [ a, c ];
+ };
+ d3.random = {
+ normal: function(µ, σ) {
+ var n = arguments.length;
+ if (n < 2) σ = 1;
+ if (n < 1) µ = 0;
+ return function() {
+ var x, y, r;
+ do {
+ x = Math.random() * 2 - 1;
+ y = Math.random() * 2 - 1;
+ r = x * x + y * y;
+ } while (!r || r > 1);
+ return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
+ };
+ },
+ logNormal: function(µ, σ) {
+ var n = arguments.length;
+ if (n < 2) σ = 1;
+ if (n < 1) µ = 0;
+ var random = d3.random.normal();
+ return function() {
+ return Math.exp(µ + σ * random());
+ };
+ },
+ irwinHall: function(m) {
+ return function() {
+ for (var s = 0, j = 0; j < m; j++) s += Math.random();
+ return s / m;
+ };
+ }
+ };
+ d3.sum = function(array, f) {
+ var s = 0, n = array.length, a, i = -1;
+ if (arguments.length === 1) {
+ while (++i < n) if (!isNaN(a = +array[i])) s += a;
+ } else {
+ while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
+ }
+ return s;
+ };
+ d3.quantile = function(values, p) {
+ var H = (values.length - 1) * p + 1, h = Math.floor(H), v = values[h - 1], e = H - h;
+ return e ? v + e * (values[h] - v) : v;
+ };
+ d3.transpose = function(matrix) {
+ return d3.zip.apply(d3, matrix);
+ };
+ d3.zip = function() {
+ if (!(n = arguments.length)) return [];
+ for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) {
+ for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) {
+ zip[j] = arguments[j][i];
+ }
+ }
+ return zips;
+ };
+ d3.bisector = function(f) {
+ return {
+ left: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >>> 1;
+ if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid;
+ }
+ return lo;
+ },
+ right: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >>> 1;
+ if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1;
+ }
+ return lo;
+ }
+ };
+ };
+ var d3_bisector = d3.bisector(function(d) {
+ return d;
+ });
+ d3.bisectLeft = d3_bisector.left;
+ d3.bisect = d3.bisectRight = d3_bisector.right;
+ d3.first = function(array, f) {
+ var i = 0, n = array.length, a = array[0], b;
+ if (arguments.length === 1) f = d3.ascending;
+ while (++i < n) {
+ if (f.call(array, a, b = array[i]) > 0) {
+ a = b;
+ }
+ }
+ return a;
+ };
+ d3.last = function(array, f) {
+ var i = 0, n = array.length, a = array[0], b;
+ if (arguments.length === 1) f = d3.ascending;
+ while (++i < n) {
+ if (f.call(array, a, b = array[i]) <= 0) {
+ a = b;
+ }
+ }
+ return a;
+ };
+ d3.nest = function() {
+ function map(array, depth) {
+ if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
+ var i = -1, n = array.length, key = keys[depth++], keyValue, object, valuesByKey = new d3_Map, values, o = {};
+ while (++i < n) {
+ if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
+ values.push(object);
+ } else {
+ valuesByKey.set(keyValue, [ object ]);
+ }
+ }
+ valuesByKey.forEach(function(keyValue, values) {
+ o[keyValue] = map(values, depth);
+ });
+ return o;
+ }
+ function entries(map, depth) {
+ if (depth >= keys.length) return map;
+ var a = [], sortKey = sortKeys[depth++], key;
+ for (key in map) {
+ a.push({
+ key: key,
+ values: entries(map[key], depth)
+ });
+ }
+ if (sortKey) a.sort(function(a, b) {
+ return sortKey(a.key, b.key);
+ });
+ return a;
+ }
+ var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
+ nest.map = function(array) {
+ return map(array, 0);
+ };
+ nest.entries = function(array) {
+ return entries(map(array, 0), 0);
+ };
+ nest.key = function(d) {
+ keys.push(d);
+ return nest;
+ };
+ nest.sortKeys = function(order) {
+ sortKeys[keys.length - 1] = order;
+ return nest;
+ };
+ nest.sortValues = function(order) {
+ sortValues = order;
+ return nest;
+ };
+ nest.rollup = function(f) {
+ rollup = f;
+ return nest;
+ };
+ return nest;
+ };
+ d3.keys = function(map) {
+ var keys = [];
+ for (var key in map) keys.push(key);
+ return keys;
+ };
+ d3.values = function(map) {
+ var values = [];
+ for (var key in map) values.push(map[key]);
+ return values;
+ };
+ d3.entries = function(map) {
+ var entries = [];
+ for (var key in map) entries.push({
+ key: key,
+ value: map[key]
+ });
+ return entries;
+ };
+ d3.permute = function(array, indexes) {
+ var permutes = [], i = -1, n = indexes.length;
+ while (++i < n) permutes[i] = array[indexes[i]];
+ return permutes;
+ };
+ d3.merge = function(arrays) {
+ return Array.prototype.concat.apply([], arrays);
+ };
+ d3.split = function(array, f) {
+ var arrays = [], values = [], value, i = -1, n = array.length;
+ if (arguments.length < 2) f = d3_splitter;
+ while (++i < n) {
+ if (f.call(values, value = array[i], i)) {
+ values = [];
+ } else {
+ if (!values.length) arrays.push(values);
+ values.push(value);
+ }
+ }
+ return arrays;
+ };
+ d3.range = function(start, stop, step) {
+ if (arguments.length < 3) {
+ step = 1;
+ if (arguments.length < 2) {
+ stop = start;
+ start = 0;
+ }
+ }
+ if ((stop - start) / step === Infinity) throw new Error("infinite range");
+ var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j;
+ start *= k, stop *= k, step *= k;
+ if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);
+ return range;
+ };
+ d3.requote = function(s) {
+ return s.replace(d3_requote_re, "\\$&");
+ };
+ var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
+ d3.round = function(x, n) {
+ return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);
+ };
+ d3.xhr = function(url, mime, callback) {
+ var req = new XMLHttpRequest;
+ if (arguments.length < 3) callback = mime, mime = null; else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
+ req.open("GET", url, true);
+ if (mime) req.setRequestHeader("Accept", mime);
+ req.onreadystatechange = function() {
+ if (req.readyState === 4) {
+ var s = req.status;
+ callback(!s && req.response || s >= 200 && s < 300 || s === 304 ? req : null);
+ }
+ };
+ req.send(null);
+ };
+ d3.text = function(url, mime, callback) {
+ function ready(req) {
+ callback(req && req.responseText);
+ }
+ if (arguments.length < 3) {
+ callback = mime;
+ mime = null;
+ }
+ d3.xhr(url, mime, ready);
+ };
+ d3.json = function(url, callback) {
+ d3.text(url, "application/json", function(text) {
+ callback(text ? JSON.parse(text) : null);
+ });
+ };
+ d3.html = function(url, callback) {
+ d3.text(url, "text/html", function(text) {
+ if (text != null) {
+ var range = document.createRange();
+ range.selectNode(document.body);
+ text = range.createContextualFragment(text);
+ }
+ callback(text);
+ });
+ };
+ d3.xml = function(url, mime, callback) {
+ function ready(req) {
+ callback(req && req.responseXML);
+ }
+ if (arguments.length < 3) {
+ callback = mime;
+ mime = null;
+ }
+ d3.xhr(url, mime, ready);
+ };
+ var d3_nsPrefix = {
+ svg: "http://www.w3.org/2000/svg",
+ xhtml: "http://www.w3.org/1999/xhtml",
+ xlink: "http://www.w3.org/1999/xlink",
+ xml: "http://www.w3.org/XML/1998/namespace",
+ xmlns: "http://www.w3.org/2000/xmlns/"
+ };
+ d3.ns = {
+ prefix: d3_nsPrefix,
+ qualify: function(name) {
+ var i = name.indexOf(":"), prefix = name;
+ if (i >= 0) {
+ prefix = name.substring(0, i);
+ name = name.substring(i + 1);
+ }
+ return d3_nsPrefix.hasOwnProperty(prefix) ? {
+ space: d3_nsPrefix[prefix],
+ local: name
+ } : name;
+ }
+ };
+ d3.dispatch = function() {
+ var dispatch = new d3_dispatch, i = -1, n = arguments.length;
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
+ return dispatch;
+ };
+ d3_dispatch.prototype.on = function(type, listener) {
+ var i = type.indexOf("."), name = "";
+ if (i > 0) {
+ name = type.substring(i + 1);
+ type = type.substring(0, i);
+ }
+ return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);
+ };
+ d3.format = function(specifier) {
+ var match = d3_format_re.exec(specifier), fill = match[1] || " ", sign = match[3] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false;
+ if (precision) precision = +precision.substring(1);
+ if (zfill) {
+ fill = "0";
+ if (comma) width -= Math.floor((width - 1) / 4);
+ }
+ switch (type) {
+ case "n":
+ comma = true;
+ type = "g";
+ break;
+ case "%":
+ scale = 100;
+ suffix = "%";
+ type = "f";
+ break;
+ case "p":
+ scale = 100;
+ suffix = "%";
+ type = "r";
+ break;
+ case "d":
+ integer = true;
+ precision = 0;
+ break;
+ case "s":
+ scale = -1;
+ type = "r";
+ break;
+ }
+ if (type == "r" && !precision) type = "g";
+ type = d3_format_types.get(type) || d3_format_typeDefault;
+ return function(value) {
+ if (integer && value % 1) return "";
+ var negative = value < 0 && (value = -value) ? "-" : sign;
+ if (scale < 0) {
+ var prefix = d3.formatPrefix(value, precision);
+ value = prefix.scale(value);
+ suffix = prefix.symbol;
+ } else {
+ value *= scale;
+ }
+ value = type(value, precision);
+ if (zfill) {
+ var length = value.length + negative.length;
+ if (length < width) value = (new Array(width - length + 1)).join(fill) + value;
+ if (comma) value = d3_format_group(value);
+ value = negative + value;
+ } else {
+ if (comma) value = d3_format_group(value);
+ value = negative + value;
+ var length = value.length;
+ if (length < width) value = (new Array(width - length + 1)).join(fill) + value;
+ }
+ return value + suffix;
+ };
+ };
+ var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
+ var d3_format_types = d3.map({
+ g: function(x, p) {
+ return x.toPrecision(p);
+ },
+ e: function(x, p) {
+ return x.toExponential(p);
+ },
+ f: function(x, p) {
+ return x.toFixed(p);
+ },
+ r: function(x, p) {
+ return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p)));
+ }
+ });
+ var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "μ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
+ d3.formatPrefix = function(value, precision) {
+ var i = 0;
+ if (value) {
+ if (value < 0) value *= -1;
+ if (precision) value = d3.round(value, d3_format_precision(value, precision));
+ i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
+ i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
+ }
+ return d3_formatPrefixes[8 + i / 3];
+ };
+ var d3_ease_quad = d3_ease_poly(2), d3_ease_cubic = d3_ease_poly(3), d3_ease_default = function() {
+ return d3_ease_identity;
+ };
+ var d3_ease = d3.map({
+ linear: d3_ease_default,
+ poly: d3_ease_poly,
+ quad: function() {
+ return d3_ease_quad;
+ },
+ cubic: function() {
+ return d3_ease_cubic;
+ },
+ sin: function() {
+ return d3_ease_sin;
+ },
+ exp: function() {
+ return d3_ease_exp;
+ },
+ circle: function() {
+ return d3_ease_circle;
+ },
+ elastic: d3_ease_elastic,
+ back: d3_ease_back,
+ bounce: function() {
+ return d3_ease_bounce;
+ }
+ });
+ var d3_ease_mode = d3.map({
+ "in": d3_ease_identity,
+ out: d3_ease_reverse,
+ "in-out": d3_ease_reflect,
+ "out-in": function(f) {
+ return d3_ease_reflect(d3_ease_reverse(f));
+ }
+ });
+ d3.ease = function(name) {
+ var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in";
+ t = d3_ease.get(t) || d3_ease_default;
+ m = d3_ease_mode.get(m) || d3_ease_identity;
+ return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1))));
+ };
+ d3.event = null;
+ d3.transform = function(string) {
+ var g = document.createElementNS(d3.ns.prefix.svg, "g");
+ return (d3.transform = function(string) {
+ g.setAttribute("transform", string);
+ var t = g.transform.baseVal.consolidate();
+ return new d3_transform(t ? t.matrix : d3_transformIdentity);
+ })(string);
+ };
+ d3_transform.prototype.toString = function() {
+ return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
+ };
+ var d3_transformDegrees = 180 / Math.PI, d3_transformIdentity = {
+ a: 1,
+ b: 0,
+ c: 0,
+ d: 1,
+ e: 0,
+ f: 0
+ };
+ d3.interpolate = function(a, b) {
+ var i = d3.interpolators.length, f;
+ while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;
+ return f;
+ };
+ d3.interpolateNumber = function(a, b) {
+ b -= a;
+ return function(t) {
+ return a + b * t;
+ };
+ };
+ d3.interpolateRound = function(a, b) {
+ b -= a;
+ return function(t) {
+ return Math.round(a + b * t);
+ };
+ };
+ d3.interpolateString = function(a, b) {
+ var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;
+ d3_interpolate_number.lastIndex = 0;
+ for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
+ if (m.index) s.push(b.substring(s0, s1 = m.index));
+ q.push({
+ i: s.length,
+ x: m[0]
+ });
+ s.push(null);
+ s0 = d3_interpolate_number.lastIndex;
+ }
+ if (s0 < b.length) s.push(b.substring(s0));
+ for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
+ o = q[i];
+ if (o.x == m[0]) {
+ if (o.i) {
+ if (s[o.i + 1] == null) {
+ s[o.i - 1] += o.x;
+ s.splice(o.i, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ } else {
+ s[o.i - 1] += o.x + s[o.i + 1];
+ s.splice(o.i, 2);
+ for (j = i + 1; j < n; ++j) q[j].i -= 2;
+ }
+ } else {
+ if (s[o.i + 1] == null) {
+ s[o.i] = o.x;
+ } else {
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ }
+ }
+ q.splice(i, 1);
+ n--;
+ i--;
+ } else {
+ o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
+ }
+ }
+ while (i < n) {
+ o = q.pop();
+ if (s[o.i + 1] == null) {
+ s[o.i] = o.x;
+ } else {
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ }
+ n--;
+ }
+ if (s.length === 1) {
+ return s[0] == null ? q[0].x : function() {
+ return b;
+ };
+ }
+ return function(t) {
+ for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+ };
+ d3.interpolateTransform = function(a, b) {
+ var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale;
+ if (ta[0] != tb[0] || ta[1] != tb[1]) {
+ s.push("translate(", null, ",", null, ")");
+ q.push({
+ i: 1,
+ x: d3.interpolateNumber(ta[0], tb[0])
+ }, {
+ i: 3,
+ x: d3.interpolateNumber(ta[1], tb[1])
+ });
+ } else if (tb[0] || tb[1]) {
+ s.push("translate(" + tb + ")");
+ } else {
+ s.push("");
+ }
+ if (ra != rb) {
+ if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
+ q.push({
+ i: s.push(s.pop() + "rotate(", null, ")") - 2,
+ x: d3.interpolateNumber(ra, rb)
+ });
+ } else if (rb) {
+ s.push(s.pop() + "rotate(" + rb + ")");
+ }
+ if (wa != wb) {
+ q.push({
+ i: s.push(s.pop() + "skewX(", null, ")") - 2,
+ x: d3.interpolateNumber(wa, wb)
+ });
+ } else if (wb) {
+ s.push(s.pop() + "skewX(" + wb + ")");
+ }
+ if (ka[0] != kb[0] || ka[1] != kb[1]) {
+ n = s.push(s.pop() + "scale(", null, ",", null, ")");
+ q.push({
+ i: n - 4,
+ x: d3.interpolateNumber(ka[0], kb[0])
+ }, {
+ i: n - 2,
+ x: d3.interpolateNumber(ka[1], kb[1])
+ });
+ } else if (kb[0] != 1 || kb[1] != 1) {
+ s.push(s.pop() + "scale(" + kb + ")");
+ }
+ n = q.length;
+ return function(t) {
+ var i = -1, o;
+ while (++i < n) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+ };
+ d3.interpolateRgb = function(a, b) {
+ a = d3.rgb(a);
+ b = d3.rgb(b);
+ var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
+ return function(t) {
+ return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));
+ };
+ };
+ d3.interpolateHsl = function(a, b) {
+ a = d3.hsl(a);
+ b = d3.hsl(b);
+ var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0;
+ if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360;
+ return function(t) {
+ return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + "";
+ };
+ };
+ d3.interpolateLab = function(a, b) {
+ a = d3.lab(a);
+ b = d3.lab(b);
+ var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
+ return function(t) {
+ return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
+ };
+ };
+ d3.interpolateHcl = function(a, b) {
+ a = d3.hcl(a);
+ b = d3.hcl(b);
+ var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;
+ if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
+ return function(t) {
+ return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
+ };
+ };
+ d3.interpolateArray = function(a, b) {
+ var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;
+ for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
+ for (; i < na; ++i) c[i] = a[i];
+ for (; i < nb; ++i) c[i] = b[i];
+ return function(t) {
+ for (i = 0; i < n0; ++i) c[i] = x[i](t);
+ return c;
+ };
+ };
+ d3.interpolateObject = function(a, b) {
+ var i = {}, c = {}, k;
+ for (k in a) {
+ if (k in b) {
+ i[k] = d3_interpolateByName(k)(a[k], b[k]);
+ } else {
+ c[k] = a[k];
+ }
+ }
+ for (k in b) {
+ if (!(k in a)) {
+ c[k] = b[k];
+ }
+ }
+ return function(t) {
+ for (k in i) c[k] = i[k](t);
+ return c;
+ };
+ };
+ var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
+ d3.interpolators = [ d3.interpolateObject, function(a, b) {
+ return b instanceof Array && d3.interpolateArray(a, b);
+ }, function(a, b) {
+ return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + "");
+ }, function(a, b) {
+ return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b);
+ }, function(a, b) {
+ return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b);
+ } ];
+ d3.rgb = function(r, g, b) {
+ return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b);
+ };
+ d3_Rgb.prototype.brighter = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ var r = this.r, g = this.g, b = this.b, i = 30;
+ if (!r && !g && !b) return d3_rgb(i, i, i);
+ if (r && r < i) r = i;
+ if (g && g < i) g = i;
+ if (b && b < i) b = i;
+ return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k)));
+ };
+ d3_Rgb.prototype.darker = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b));
+ };
+ d3_Rgb.prototype.hsl = function() {
+ return d3_rgb_hsl(this.r, this.g, this.b);
+ };
+ d3_Rgb.prototype.toString = function() {
+ return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
+ };
+ var d3_rgb_names = d3.map({
+ aliceblue: "#f0f8ff",
+ antiquewhite: "#faebd7",
+ aqua: "#00ffff",
+ aquamarine: "#7fffd4",
+ azure: "#f0ffff",
+ beige: "#f5f5dc",
+ bisque: "#ffe4c4",
+ black: "#000000",
+ blanchedalmond: "#ffebcd",
+ blue: "#0000ff",
+ blueviolet: "#8a2be2",
+ brown: "#a52a2a",
+ burlywood: "#deb887",
+ cadetblue: "#5f9ea0",
+ chartreuse: "#7fff00",
+ chocolate: "#d2691e",
+ coral: "#ff7f50",
+ cornflowerblue: "#6495ed",
+ cornsilk: "#fff8dc",
+ crimson: "#dc143c",
+ cyan: "#00ffff",
+ darkblue: "#00008b",
+ darkcyan: "#008b8b",
+ darkgoldenrod: "#b8860b",
+ darkgray: "#a9a9a9",
+ darkgreen: "#006400",
+ darkgrey: "#a9a9a9",
+ darkkhaki: "#bdb76b",
+ darkmagenta: "#8b008b",
+ darkolivegreen: "#556b2f",
+ darkorange: "#ff8c00",
+ darkorchid: "#9932cc",
+ darkred: "#8b0000",
+ darksalmon: "#e9967a",
+ darkseagreen: "#8fbc8f",
+ darkslateblue: "#483d8b",
+ darkslategray: "#2f4f4f",
+ darkslategrey: "#2f4f4f",
+ darkturquoise: "#00ced1",
+ darkviolet: "#9400d3",
+ deeppink: "#ff1493",
+ deepskyblue: "#00bfff",
+ dimgray: "#696969",
+ dimgrey: "#696969",
+ dodgerblue: "#1e90ff",
+ firebrick: "#b22222",
+ floralwhite: "#fffaf0",
+ forestgreen: "#228b22",
+ fuchsia: "#ff00ff",
+ gainsboro: "#dcdcdc",
+ ghostwhite: "#f8f8ff",
+ gold: "#ffd700",
+ goldenrod: "#daa520",
+ gray: "#808080",
+ green: "#008000",
+ greenyellow: "#adff2f",
+ grey: "#808080",
+ honeydew: "#f0fff0",
+ hotpink: "#ff69b4",
+ indianred: "#cd5c5c",
+ indigo: "#4b0082",
+ ivory: "#fffff0",
+ khaki: "#f0e68c",
+ lavender: "#e6e6fa",
+ lavenderblush: "#fff0f5",
+ lawngreen: "#7cfc00",
+ lemonchiffon: "#fffacd",
+ lightblue: "#add8e6",
+ lightcoral: "#f08080",
+ lightcyan: "#e0ffff",
+ lightgoldenrodyellow: "#fafad2",
+ lightgray: "#d3d3d3",
+ lightgreen: "#90ee90",
+ lightgrey: "#d3d3d3",
+ lightpink: "#ffb6c1",
+ lightsalmon: "#ffa07a",
+ lightseagreen: "#20b2aa",
+ lightskyblue: "#87cefa",
+ lightslategray: "#778899",
+ lightslategrey: "#778899",
+ lightsteelblue: "#b0c4de",
+ lightyellow: "#ffffe0",
+ lime: "#00ff00",
+ limegreen: "#32cd32",
+ linen: "#faf0e6",
+ magenta: "#ff00ff",
+ maroon: "#800000",
+ mediumaquamarine: "#66cdaa",
+ mediumblue: "#0000cd",
+ mediumorchid: "#ba55d3",
+ mediumpurple: "#9370db",
+ mediumseagreen: "#3cb371",
+ mediumslateblue: "#7b68ee",
+ mediumspringgreen: "#00fa9a",
+ mediumturquoise: "#48d1cc",
+ mediumvioletred: "#c71585",
+ midnightblue: "#191970",
+ mintcream: "#f5fffa",
+ mistyrose: "#ffe4e1",
+ moccasin: "#ffe4b5",
+ navajowhite: "#ffdead",
+ navy: "#000080",
+ oldlace: "#fdf5e6",
+ olive: "#808000",
+ olivedrab: "#6b8e23",
+ orange: "#ffa500",
+ orangered: "#ff4500",
+ orchid: "#da70d6",
+ palegoldenrod: "#eee8aa",
+ palegreen: "#98fb98",
+ paleturquoise: "#afeeee",
+ palevioletred: "#db7093",
+ papayawhip: "#ffefd5",
+ peachpuff: "#ffdab9",
+ peru: "#cd853f",
+ pink: "#ffc0cb",
+ plum: "#dda0dd",
+ powderblue: "#b0e0e6",
+ purple: "#800080",
+ red: "#ff0000",
+ rosybrown: "#bc8f8f",
+ royalblue: "#4169e1",
+ saddlebrown: "#8b4513",
+ salmon: "#fa8072",
+ sandybrown: "#f4a460",
+ seagreen: "#2e8b57",
+ seashell: "#fff5ee",
+ sienna: "#a0522d",
+ silver: "#c0c0c0",
+ skyblue: "#87ceeb",
+ slateblue: "#6a5acd",
+ slategray: "#708090",
+ slategrey: "#708090",
+ snow: "#fffafa",
+ springgreen: "#00ff7f",
+ steelblue: "#4682b4",
+ tan: "#d2b48c",
+ teal: "#008080",
+ thistle: "#d8bfd8",
+ tomato: "#ff6347",
+ turquoise: "#40e0d0",
+ violet: "#ee82ee",
+ wheat: "#f5deb3",
+ white: "#ffffff",
+ whitesmoke: "#f5f5f5",
+ yellow: "#ffff00",
+ yellowgreen: "#9acd32"
+ });
+ d3_rgb_names.forEach(function(key, value) {
+ d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
+ });
+ d3.hsl = function(h, s, l) {
+ return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l);
+ };
+ d3_Hsl.prototype.brighter = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, this.l / k);
+ };
+ d3_Hsl.prototype.darker = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, k * this.l);
+ };
+ d3_Hsl.prototype.rgb = function() {
+ return d3_hsl_rgb(this.h, this.s, this.l);
+ };
+ d3_Hsl.prototype.toString = function() {
+ return this.rgb().toString();
+ };
+ d3.hcl = function(h, c, l) {
+ return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l);
+ };
+ d3_Hcl.prototype.brighter = function(k) {
+ return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
+ };
+ d3_Hcl.prototype.darker = function(k) {
+ return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
+ };
+ d3_Hcl.prototype.rgb = function() {
+ return d3_hcl_lab(this.h, this.c, this.l).rgb();
+ };
+ d3_Hcl.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+ d3.lab = function(l, a, b) {
+ return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b);
+ };
+ var d3_lab_K = 18;
+ var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
+ d3_Lab.prototype.brighter = function(k) {
+ return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+ d3_Lab.prototype.darker = function(k) {
+ return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+ d3_Lab.prototype.rgb = function() {
+ return d3_lab_rgb(this.l, this.a, this.b);
+ };
+ d3_Lab.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+ var d3_select = function(s, n) {
+ return n.querySelector(s);
+ }, d3_selectAll = function(s, n) {
+ return n.querySelectorAll(s);
+ }, d3_selectRoot = document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) {
+ return d3_selectMatcher.call(n, s);
+ };
+ if (typeof Sizzle === "function") {
+ d3_select = function(s, n) {
+ return Sizzle(s, n)[0] || null;
+ };
+ d3_selectAll = function(s, n) {
+ return Sizzle.uniqueSort(Sizzle(s, n));
+ };
+ d3_selectMatches = Sizzle.matchesSelector;
+ }
+ var d3_selectionPrototype = [];
+ d3.selection = function() {
+ return d3_selectionRoot;
+ };
+ d3.selection.prototype = d3_selectionPrototype;
+ d3_selectionPrototype.select = function(selector) {
+ var subgroups = [], subgroup, subnode, group, node;
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroup.push(subnode = selector.call(node, node.__data__, i));
+ if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ d3_selectionPrototype.selectAll = function(selector) {
+ var subgroups = [], subgroup, node;
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
+ subgroup.parentNode = node;
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ d3_selectionPrototype.attr = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") {
+ var node = this.node();
+ name = d3.ns.qualify(name);
+ return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);
+ }
+ for (value in name) this.each(d3_selection_attr(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_attr(name, value));
+ };
+ d3_selectionPrototype.classed = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") {
+ var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1;
+ if (value = node.classList) {
+ while (++i < n) if (!value.contains(name[i])) return false;
+ } else {
+ value = node.className;
+ if (value.baseVal != null) value = value.baseVal;
+ while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;
+ }
+ return true;
+ }
+ for (value in name) this.each(d3_selection_classed(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_classed(name, value));
+ };
+ d3_selectionPrototype.style = function(name, value, priority) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof name !== "string") {
+ if (n < 2) value = "";
+ for (priority in name) this.each(d3_selection_style(priority, name[priority], value));
+ return this;
+ }
+ if (n < 2) return window.getComputedStyle(this.node(), null).getPropertyValue(name);
+ priority = "";
+ }
+ return this.each(d3_selection_style(name, value, priority));
+ };
+ d3_selectionPrototype.property = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") return this.node()[name];
+ for (value in name) this.each(d3_selection_property(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_property(name, value));
+ };
+ d3_selectionPrototype.text = function(value) {
+ return arguments.length < 1 ? this.node().textContent : this.each(typeof value === "function" ? function() {
+ var v = value.apply(this, arguments);
+ this.textContent = v == null ? "" : v;
+ } : value == null ? function() {
+ this.textContent = "";
+ } : function() {
+ this.textContent = value;
+ });
+ };
+ d3_selectionPrototype.html = function(value) {
+ return arguments.length < 1 ? this.node().innerHTML : this.each(typeof value === "function" ? function() {
+ var v = value.apply(this, arguments);
+ this.innerHTML = v == null ? "" : v;
+ } : value == null ? function() {
+ this.innerHTML = "";
+ } : function() {
+ this.innerHTML = value;
+ });
+ };
+ d3_selectionPrototype.append = function(name) {
+ function append() {
+ return this.appendChild(document.createElementNS(this.namespaceURI, name));
+ }
+ function appendNS() {
+ return this.appendChild(document.createElementNS(name.space, name.local));
+ }
+ name = d3.ns.qualify(name);
+ return this.select(name.local ? appendNS : append);
+ };
+ d3_selectionPrototype.insert = function(name, before) {
+ function insert() {
+ return this.insertBefore(document.createElementNS(this.namespaceURI, name), d3_select(before, this));
+ }
+ function insertNS() {
+ return this.insertBefore(document.createElementNS(name.space, name.local), d3_select(before, this));
+ }
+ name = d3.ns.qualify(name);
+ return this.select(name.local ? insertNS : insert);
+ };
+ d3_selectionPrototype.remove = function() {
+ return this.each(function() {
+ var parent = this.parentNode;
+ if (parent) parent.removeChild(this);
+ });
+ };
+ d3_selectionPrototype.data = function(value, key) {
+ function bind(group, groupData) {
+ var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), n1 = Math.max(n, m), updateNodes = [], enterNodes = [], exitNodes = [], node, nodeData;
+ if (key) {
+ var nodeByKeyValue = new d3_Map, keyValues = [], keyValue, j = groupData.length;
+ for (i = -1; ++i < n; ) {
+ keyValue = key.call(node = group[i], node.__data__, i);
+ if (nodeByKeyValue.has(keyValue)) {
+ exitNodes[j++] = node;
+ } else {
+ nodeByKeyValue.set(keyValue, node);
+ }
+ keyValues.push(keyValue);
+ }
+ for (i = -1; ++i < m; ) {
+ keyValue = key.call(groupData, nodeData = groupData[i], i);
+ if (nodeByKeyValue.has(keyValue)) {
+ updateNodes[i] = node = nodeByKeyValue.get(keyValue);
+ node.__data__ = nodeData;
+ enterNodes[i] = exitNodes[i] = null;
+ } else {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ nodeByKeyValue.remove(keyValue);
+ }
+ for (i = -1; ++i < n; ) {
+ if (nodeByKeyValue.has(keyValues[i])) {
+ exitNodes[i] = group[i];
+ }
+ }
+ } else {
+ for (i = -1; ++i < n0; ) {
+ node = group[i];
+ nodeData = groupData[i];
+ if (node) {
+ node.__data__ = nodeData;
+ updateNodes[i] = node;
+ enterNodes[i] = exitNodes[i] = null;
+ } else {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ }
+ for (; i < m; ++i) {
+ enterNodes[i] = d3_selection_dataNode(groupData[i]);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ for (; i < n1; ++i) {
+ exitNodes[i] = group[i];
+ enterNodes[i] = updateNodes[i] = null;
+ }
+ }
+ enterNodes.update = updateNodes;
+ enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;
+ enter.push(enterNodes);
+ update.push(updateNodes);
+ exit.push(exitNodes);
+ }
+ var i = -1, n = this.length, group, node;
+ if (!arguments.length) {
+ value = new Array(n = (group = this[0]).length);
+ while (++i < n) {
+ if (node = group[i]) {
+ value[i] = node.__data__;
+ }
+ }
+ return value;
+ }
+ var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);
+ if (typeof value === "function") {
+ while (++i < n) {
+ bind(group = this[i], value.call(group, group.parentNode.__data__, i));
+ }
+ } else {
+ while (++i < n) {
+ bind(group = this[i], value);
+ }
+ }
+ update.enter = function() {
+ return enter;
+ };
+ update.exit = function() {
+ return exit;
+ };
+ return update;
+ };
+ d3_selectionPrototype.datum = d3_selectionPrototype.map = function(value) {
+ return arguments.length < 1 ? this.property("__data__") : this.property("__data__", value);
+ };
+ d3_selectionPrototype.filter = function(filter) {
+ var subgroups = [], subgroup, group, node;
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = 0, n = group.length; i < n; i++) {
+ if ((node = group[i]) && filter.call(node, node.__data__, i)) {
+ subgroup.push(node);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ d3_selectionPrototype.order = function() {
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
+ if (node = group[i]) {
+ if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
+ next = node;
+ }
+ }
+ }
+ return this;
+ };
+ d3_selectionPrototype.sort = function(comparator) {
+ comparator = d3_selection_sortComparator.apply(this, arguments);
+ for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);
+ return this.order();
+ };
+ d3_selectionPrototype.on = function(type, listener, capture) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof type !== "string") {
+ if (n < 2) listener = false;
+ for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
+ return this;
+ }
+ if (n < 2) return (n = this.node()["__on" + type]) && n._;
+ capture = false;
+ }
+ return this.each(d3_selection_on(type, listener, capture));
+ };
+ d3_selectionPrototype.each = function(callback) {
+ return d3_selection_each(this, function(node, i, j) {
+ callback.call(node, node.__data__, i, j);
+ });
+ };
+ d3_selectionPrototype.call = function(callback) {
+ callback.apply(this, (arguments[0] = this, arguments));
+ return this;
+ };
+ d3_selectionPrototype.empty = function() {
+ return !this.node();
+ };
+ d3_selectionPrototype.node = function(callback) {
+ for (var j = 0, m = this.length; j < m; j++) {
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ var node = group[i];
+ if (node) return node;
+ }
+ }
+ return null;
+ };
+ d3_selectionPrototype.transition = function() {
+ var subgroups = [], subgroup, node;
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ subgroup.push((node = group[i]) ? {
+ node: node,
+ delay: d3_transitionDelay,
+ duration: d3_transitionDuration
+ } : null);
+ }
+ }
+ return d3_transition(subgroups, d3_transitionId || ++d3_transitionNextId, Date.now());
+ };
+ var d3_selectionRoot = d3_selection([ [ document ] ]);
+ d3_selectionRoot[0].parentNode = d3_selectRoot;
+ d3.select = function(selector) {
+ return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]);
+ };
+ d3.selectAll = function(selector) {
+ return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]);
+ };
+ var d3_selection_enterPrototype = [];
+ d3.selection.enter = d3_selection_enter;
+ d3.selection.enter.prototype = d3_selection_enterPrototype;
+ d3_selection_enterPrototype.append = d3_selectionPrototype.append;
+ d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
+ d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
+ d3_selection_enterPrototype.node = d3_selectionPrototype.node;
+ d3_selection_enterPrototype.select = function(selector) {
+ var subgroups = [], subgroup, subnode, upgroup, group, node;
+ for (var j = -1, m = this.length; ++j < m; ) {
+ upgroup = (group = this[j]).update;
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = group.parentNode;
+ for (var i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
+ subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ var d3_transitionPrototype = [], d3_transitionNextId = 0, d3_transitionId = 0, d3_transitionDefaultDelay = 0, d3_transitionDefaultDuration = 250, d3_transitionDefaultEase = d3.ease("cubic-in-out"), d3_transitionDelay = d3_transitionDefaultDelay, d3_transitionDuration = d3_transitionDefaultDuration, d3_transitionEase = d3_transitionDefaultEase;
+ d3_transitionPrototype.call = d3_selectionPrototype.call;
+ d3.transition = function(selection) {
+ return arguments.length ? d3_transitionId ? selection.transition() : selection : d3_selectionRoot.transition();
+ };
+ d3.transition.prototype = d3_transitionPrototype;
+ d3_transitionPrototype.select = function(selector) {
+ var subgroups = [], subgroup, subnode, node;
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) {
+ if ("__data__" in node.node) subnode.__data__ = node.node.__data__;
+ subgroup.push({
+ node: subnode,
+ delay: node.delay,
+ duration: node.duration
+ });
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+ };
+ d3_transitionPrototype.selectAll = function(selector) {
+ var subgroups = [], subgroup, subnodes, node;
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subnodes = selector.call(node.node, node.node.__data__, i);
+ subgroups.push(subgroup = []);
+ for (var k = -1, o = subnodes.length; ++k < o; ) {
+ subgroup.push({
+ node: subnodes[k],
+ delay: node.delay,
+ duration: node.duration
+ });
+ }
+ }
+ }
+ }
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+ };
+ d3_transitionPrototype.filter = function(filter) {
+ var subgroups = [], subgroup, group, node;
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ if ((node = group[i]) && filter.call(node.node, node.node.__data__, i)) {
+ subgroup.push(node);
+ }
+ }
+ }
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+ };
+ d3_transitionPrototype.attr = function(name, value) {
+ if (arguments.length < 2) {
+ for (value in name) this.attrTween(value, d3_tweenByName(name[value], value));
+ return this;
+ }
+ return this.attrTween(name, d3_tweenByName(value, name));
+ };
+ d3_transitionPrototype.attrTween = function(nameNS, tween) {
+ function attrTween(d, i) {
+ var f = tween.call(this, d, i, this.getAttribute(name));
+ return f === d3_tweenRemove ? (this.removeAttribute(name), null) : f && function(t) {
+ this.setAttribute(name, f(t));
+ };
+ }
+ function attrTweenNS(d, i) {
+ var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
+ return f === d3_tweenRemove ? (this.removeAttributeNS(name.space, name.local), null) : f && function(t) {
+ this.setAttributeNS(name.space, name.local, f(t));
+ };
+ }
+ var name = d3.ns.qualify(nameNS);
+ return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
+ };
+ d3_transitionPrototype.style = function(name, value, priority) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof name !== "string") {
+ if (n < 2) value = "";
+ for (priority in name) this.styleTween(priority, d3_tweenByName(name[priority], priority), value);
+ return this;
+ }
+ priority = "";
+ }
+ return this.styleTween(name, d3_tweenByName(value, name), priority);
+ };
+ d3_transitionPrototype.styleTween = function(name, tween, priority) {
+ if (arguments.length < 3) priority = "";
+ return this.tween("style." + name, function(d, i) {
+ var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name));
+ return f === d3_tweenRemove ? (this.style.removeProperty(name), null) : f && function(t) {
+ this.style.setProperty(name, f(t), priority);
+ };
+ });
+ };
+ d3_transitionPrototype.text = function(value) {
+ return this.tween("text", function(d, i) {
+ this.textContent = typeof value === "function" ? value.call(this, d, i) : value;
+ });
+ };
+ d3_transitionPrototype.remove = function() {
+ return this.each("end.transition", function() {
+ var p;
+ if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
+ });
+ };
+ d3_transitionPrototype.delay = function(value) {
+ return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
+ node.delay = value.call(node = node.node, node.__data__, i, j) | 0;
+ } : (value = value | 0, function(node) {
+ node.delay = value;
+ }));
+ };
+ d3_transitionPrototype.duration = function(value) {
+ return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
+ node.duration = Math.max(1, value.call(node = node.node, node.__data__, i, j) | 0);
+ } : (value = Math.max(1, value | 0), function(node) {
+ node.duration = value;
+ }));
+ };
+ d3_transitionPrototype.transition = function() {
+ return this.select(d3_this);
+ };
+ d3.tween = function(b, interpolate) {
+ function tweenFunction(d, i, a) {
+ var v = b.call(this, d, i);
+ return v == null ? a != "" && d3_tweenRemove : a != v && interpolate(a, v);
+ }
+ function tweenString(d, i, a) {
+ return a != b && interpolate(a, b);
+ }
+ return typeof b === "function" ? tweenFunction : b == null ? d3_tweenNull : (b += "", tweenString);
+ };
+ var d3_tweenRemove = {};
+ var d3_timer_queue = null, d3_timer_interval, d3_timer_timeout;
+ d3.timer = function(callback, delay, then) {
+ var found = false, t0, t1 = d3_timer_queue;
+ if (arguments.length < 3) {
+ if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return;
+ then = Date.now();
+ }
+ while (t1) {
+ if (t1.callback === callback) {
+ t1.then = then;
+ t1.delay = delay;
+ found = true;
+ break;
+ }
+ t0 = t1;
+ t1 = t1.next;
+ }
+ if (!found) d3_timer_queue = {
+ callback: callback,
+ then: then,
+ delay: delay,
+ next: d3_timer_queue
+ };
+ if (!d3_timer_interval) {
+ d3_timer_timeout = clearTimeout(d3_timer_timeout);
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+ };
+ d3.timer.flush = function() {
+ var elapsed, now = Date.now(), t1 = d3_timer_queue;
+ while (t1) {
+ elapsed = now - t1.then;
+ if (!t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+ d3_timer_flush();
+ };
+ var d3_timer_frame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) {
+ setTimeout(callback, 17);
+ };
+ d3.mouse = function(container) {
+ return d3_mousePoint(container, d3_eventSource());
+ };
+ var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;
+ d3.touches = function(container, touches) {
+ if (arguments.length < 2) touches = d3_eventSource().touches;
+ return touches ? d3_array(touches).map(function(touch) {
+ var point = d3_mousePoint(container, touch);
+ point.identifier = touch.identifier;
+ return point;
+ }) : [];
+ };
+ d3.scale = {};
+ d3.scale.linear = function() {
+ return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3.interpolate, false);
+ };
+ d3.scale.log = function() {
+ return d3_scale_log(d3.scale.linear(), d3_scale_logp);
+ };
+ var d3_scale_logFormat = d3.format(".0e");
+ d3_scale_logp.pow = function(x) {
+ return Math.pow(10, x);
+ };
+ d3_scale_logn.pow = function(x) {
+ return -Math.pow(10, -x);
+ };
+ d3.scale.pow = function() {
+ return d3_scale_pow(d3.scale.linear(), 1);
+ };
+ d3.scale.sqrt = function() {
+ return d3.scale.pow().exponent(.5);
+ };
+ d3.scale.ordinal = function() {
+ return d3_scale_ordinal([], {
+ t: "range",
+ a: [ [] ]
+ });
+ };
+ d3.scale.category10 = function() {
+ return d3.scale.ordinal().range(d3_category10);
+ };
+ d3.scale.category20 = function() {
+ return d3.scale.ordinal().range(d3_category20);
+ };
+ d3.scale.category20b = function() {
+ return d3.scale.ordinal().range(d3_category20b);
+ };
+ d3.scale.category20c = function() {
+ return d3.scale.ordinal().range(d3_category20c);
+ };
+ d3.scale.category50 = function() {
+ return d3.scale.ordinal().range(d3_category50);
+ };
+ var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ];
+ var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ];
+ var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ];
+ var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ];
+ var d3_category50 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#8c864b", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf","#DC143C","#800080","#0000FF","#008000","#D2691E","#FF0000","#000000","#DB7093","#FF00FF","#7B68EE","#1f77b6", "#9edae5", "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#aec7e8", "#e7ba52", "#ffbb78", "#e7cb94", "#98df8a", "#843c39", "#ff9896", "#ad494a", "#c5b0d5", "#d6616b", "#c49c94", "#e7969c", "#f7b6d2", "#fd8d3c", "#c7c7c7", "#7b4173", "#dbdb8d", "#a55194", ];
+ d3.scale.quantile = function() {
+ return d3_scale_quantile([], []);
+ };
+ d3.scale.quantize = function() {
+ return d3_scale_quantize(0, 1, [ 0, 1 ]);
+ };
+ d3.scale.threshold = function() {
+ return d3_scale_threshold([ .5 ], [ 0, 1 ]);
+ };
+ d3.scale.identity = function() {
+ return d3_scale_identity([ 0, 1 ]);
+ };
+ d3.svg = {};
+ d3.svg.arc = function() {
+ function arc() {
+ var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), df = da < Math.PI ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1);
+ return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z";
+ }
+ var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
+ arc.innerRadius = function(v) {
+ if (!arguments.length) return innerRadius;
+ innerRadius = d3_functor(v);
+ return arc;
+ };
+ arc.outerRadius = function(v) {
+ if (!arguments.length) return outerRadius;
+ outerRadius = d3_functor(v);
+ return arc;
+ };
+ arc.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return arc;
+ };
+ arc.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return arc;
+ };
+ arc.centroid = function() {
+ var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
+ return [ Math.cos(a) * r, Math.sin(a) * r ];
+ };
+ return arc;
+ };
+ var d3_svg_arcOffset = -Math.PI / 2, d3_svg_arcMax = 2 * Math.PI - 1e-6;
+ d3.svg.line = function() {
+ return d3_svg_line(d3_identity);
+ };
+ var d3_svg_lineInterpolators = d3.map({
+ linear: d3_svg_lineLinear,
+ "linear-closed": d3_svg_lineLinearClosed,
+ "step-before": d3_svg_lineStepBefore,
+ "step-after": d3_svg_lineStepAfter,
+ basis: d3_svg_lineBasis,
+ "basis-open": d3_svg_lineBasisOpen,
+ "basis-closed": d3_svg_lineBasisClosed,
+ bundle: d3_svg_lineBundle,
+ cardinal: d3_svg_lineCardinal,
+ "cardinal-open": d3_svg_lineCardinalOpen,
+ "cardinal-closed": d3_svg_lineCardinalClosed,
+ monotone: d3_svg_lineMonotone
+ });
+ d3_svg_lineInterpolators.forEach(function(key, value) {
+ value.key = key;
+ value.closed = /-closed$/.test(key);
+ });
+ var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ];
+ d3.svg.line.radial = function() {
+ var line = d3_svg_line(d3_svg_lineRadial);
+ line.radius = line.x, delete line.x;
+ line.angle = line.y, delete line.y;
+ return line;
+ };
+ d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
+ d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
+ d3.svg.area = function() {
+ return d3_svg_area(d3_identity);
+ };
+ d3.svg.area.radial = function() {
+ var area = d3_svg_area(d3_svg_lineRadial);
+ area.radius = area.x, delete area.x;
+ area.innerRadius = area.x0, delete area.x0;
+ area.outerRadius = area.x1, delete area.x1;
+ area.angle = area.y, delete area.y;
+ area.startAngle = area.y0, delete area.y0;
+ area.endAngle = area.y1, delete area.y1;
+ return area;
+ };
+ d3.svg.chord = function() {
+ function chord(d, i) {
+ var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
+ return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z";
+ }
+ function subgroup(self, f, d, i) {
+ var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
+ return {
+ r: r,
+ a0: a0,
+ a1: a1,
+ p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
+ p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
+ };
+ }
+ function equals(a, b) {
+ return a.a0 == b.a0 && a.a1 == b.a1;
+ }
+ function arc(r, p, a) {
+ return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;
+ }
+ function curve(r0, p0, r1, p1) {
+ return "Q 0,0 " + p1;
+ }
+ var source = d3_svg_chordSource, target = d3_svg_chordTarget, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
+ chord.radius = function(v) {
+ if (!arguments.length) return radius;
+ radius = d3_functor(v);
+ return chord;
+ };
+ chord.source = function(v) {
+ if (!arguments.length) return source;
+ source = d3_functor(v);
+ return chord;
+ };
+ chord.target = function(v) {
+ if (!arguments.length) return target;
+ target = d3_functor(v);
+ return chord;
+ };
+ chord.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return chord;
+ };
+ chord.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return chord;
+ };
+ return chord;
+ };
+ d3.svg.diagonal = function() {
+ function diagonal(d, i) {
+ var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
+ x: p0.x,
+ y: m
+ }, {
+ x: p3.x,
+ y: m
+ }, p3 ];
+ p = p.map(projection);
+ return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
+ }
+ var source = d3_svg_chordSource, target = d3_svg_chordTarget, projection = d3_svg_diagonalProjection;
+ diagonal.source = function(x) {
+ if (!arguments.length) return source;
+ source = d3_functor(x);
+ return diagonal;
+ };
+ diagonal.target = function(x) {
+ if (!arguments.length) return target;
+ target = d3_functor(x);
+ return diagonal;
+ };
+ diagonal.projection = function(x) {
+ if (!arguments.length) return projection;
+ projection = x;
+ return diagonal;
+ };
+ return diagonal;
+ };
+ d3.svg.diagonal.radial = function() {
+ var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;
+ diagonal.projection = function(x) {
+ return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;
+ };
+ return diagonal;
+ };
+ d3.svg.mouse = d3.mouse;
+ d3.svg.touches = d3.touches;
+ d3.svg.symbol = function() {
+ function symbol(d, i) {
+ return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));
+ }
+ var type = d3_svg_symbolType, size = d3_svg_symbolSize;
+ symbol.type = function(x) {
+ if (!arguments.length) return type;
+ type = d3_functor(x);
+ return symbol;
+ };
+ symbol.size = function(x) {
+ if (!arguments.length) return size;
+ size = d3_functor(x);
+ return symbol;
+ };
+ return symbol;
+ };
+ var d3_svg_symbols = d3.map({
+ circle: d3_svg_symbolCircle,
+ cross: function(size) {
+ var r = Math.sqrt(size / 5) / 2;
+ return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z";
+ },
+ diamond: function(size) {
+ var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;
+ return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
+ },
+ square: function(size) {
+ var r = Math.sqrt(size) / 2;
+ return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
+ },
+ "triangle-down": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
+ },
+ "triangle-up": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
+ }
+ });
+ d3.svg.symbolTypes = d3_svg_symbols.keys();
+ var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180);
+ d3.svg.axis = function() {
+ function axis(g) {
+ g.each(function() {
+ var g = d3.select(this);
+ var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_;
+ var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1);
+ var tick = g.selectAll("g").data(ticks, String), tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform;
+ var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathEnter = path.enter().append("path").attr("class", "domain"), pathUpdate = d3.transition(path);
+ var scale1 = scale.copy(), scale0 = this.__chart__ || scale1;
+ this.__chart__ = scale1;
+ tickEnter.append("line").attr("class", "tick");
+ tickEnter.append("text");
+ var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
+ switch (orient) {
+ case "bottom":
+ {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
+ lineEnter.attr("y2", tickMajorSize);
+ textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding);
+ lineUpdate.attr("x2", 0).attr("y2", tickMajorSize);
+ textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding);
+ text.attr("dy", ".71em").attr("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
+ break;
+ }
+ case "top":
+ {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", -tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
+ lineEnter.attr("y2", -tickMajorSize);
+ textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
+ lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize);
+ textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
+ text.attr("dy", "0em").attr("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
+ break;
+ }
+ case "left":
+ {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", -tickMinorSize);
+ subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
+ lineEnter.attr("x2", -tickMajorSize);
+ textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
+ lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0);
+ textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0);
+ text.attr("dy", ".32em").attr("text-anchor", "end");
+ pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
+ break;
+ }
+ case "right":
+ {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", tickMinorSize);
+ subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
+ lineEnter.attr("x2", tickMajorSize);
+ textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding);
+ lineUpdate.attr("x2", tickMajorSize).attr("y2", 0);
+ textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0);
+ text.attr("dy", ".32em").attr("text-anchor", "start");
+ pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
+ break;
+ }
+ }
+ if (scale.ticks) {
+ tickEnter.call(tickTransform, scale0);
+ tickUpdate.call(tickTransform, scale1);
+ tickExit.call(tickTransform, scale1);
+ subtickEnter.call(tickTransform, scale0);
+ subtickUpdate.call(tickTransform, scale1);
+ subtickExit.call(tickTransform, scale1);
+ } else {
+ var dx = scale1.rangeBand() / 2, x = function(d) {
+ return scale1(d) + dx;
+ };
+ tickEnter.call(tickTransform, x);
+ tickUpdate.call(tickTransform, x);
+ }
+ });
+ }
+ var scale = d3.scale.linear(), orient = "bottom", tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0;
+ axis.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = x;
+ return axis;
+ };
+ axis.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ return axis;
+ };
+ axis.ticks = function() {
+ if (!arguments.length) return tickArguments_;
+ tickArguments_ = arguments;
+ return axis;
+ };
+ axis.tickValues = function(x) {
+ if (!arguments.length) return tickValues;
+ tickValues = x;
+ return axis;
+ };
+ axis.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat_;
+ tickFormat_ = x;
+ return axis;
+ };
+ axis.tickSize = function(x, y, z) {
+ if (!arguments.length) return tickMajorSize;
+ var n = arguments.length - 1;
+ tickMajorSize = +x;
+ tickMinorSize = n > 1 ? +y : tickMajorSize;
+ tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
+ return axis;
+ };
+ axis.tickPadding = function(x) {
+ if (!arguments.length) return tickPadding;
+ tickPadding = +x;
+ return axis;
+ };
+ axis.tickSubdivide = function(x) {
+ if (!arguments.length) return tickSubdivide;
+ tickSubdivide = +x;
+ return axis;
+ };
+ return axis;
+ };
+ d3.svg.brush = function() {
+ function brush(g) {
+ g.each(function() {
+ var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e;
+ g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
+ bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
+ fg.enter().append("rect").attr("class", "extent").style("cursor", "move");
+ tz.enter().append("g").attr("class", function(d) {
+ return "resize " + d;
+ }).style("cursor", function(d) {
+ return d3_svg_brushCursor[d];
+ }).append("rect").attr("x", function(d) {
+ return /[ew]$/.test(d) ? -3 : null;
+ }).attr("y", function(d) {
+ return /^[ns]/.test(d) ? -3 : null;
+ }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
+ tz.style("display", brush.empty() ? "none" : null);
+ tz.exit().remove();
+ if (x) {
+ e = d3_scaleRange(x);
+ bg.attr("x", e[0]).attr("width", e[1] - e[0]);
+ redrawX(g);
+ }
+ if (y) {
+ e = d3_scaleRange(y);
+ bg.attr("y", e[0]).attr("height", e[1] - e[0]);
+ redrawY(g);
+ }
+ redraw(g);
+ });
+ }
+ function redraw(g) {
+ g.selectAll(".resize").attr("transform", function(d) {
+ return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";
+ });
+ }
+ function redrawX(g) {
+ g.select(".extent").attr("x", extent[0][0]);
+ g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);
+ }
+ function redrawY(g) {
+ g.select(".extent").attr("y", extent[0][1]);
+ g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
+ }
+ function brushstart() {
+ function mouse() {
+ var touches = d3.event.changedTouches;
+ return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
+ }
+ function keydown() {
+ if (d3.event.keyCode == 32) {
+ if (!dragging) {
+ center = null;
+ origin[0] -= extent[1][0];
+ origin[1] -= extent[1][1];
+ dragging = 2;
+ }
+ d3_eventCancel();
+ }
+ }
+ function keyup() {
+ if (d3.event.keyCode == 32 && dragging == 2) {
+ origin[0] += extent[1][0];
+ origin[1] += extent[1][1];
+ dragging = 0;
+ d3_eventCancel();
+ }
+ }
+ function brushmove() {
+ var point = mouse(), moved = false;
+ if (offset) {
+ point[0] += offset[0];
+ point[1] += offset[1];
+ }
+ if (!dragging) {
+ if (d3.event.altKey) {
+ if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ];
+ origin[0] = extent[+(point[0] < center[0])][0];
+ origin[1] = extent[+(point[1] < center[1])][1];
+ } else center = null;
+ }
+ if (resizingX && move1(point, x, 0)) {
+ redrawX(g);
+ moved = true;
+ }
+ if (resizingY && move1(point, y, 1)) {
+ redrawY(g);
+ moved = true;
+ }
+ if (moved) {
+ redraw(g);
+ event_({
+ type: "brush",
+ mode: dragging ? "move" : "resize"
+ });
+ }
+ }
+ function move1(point, scale, i) {
+ var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max;
+ if (dragging) {
+ r0 -= position;
+ r1 -= size + position;
+ }
+ min = Math.max(r0, Math.min(r1, point[i]));
+ if (dragging) {
+ max = (min += position) + size;
+ } else {
+ if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
+ if (position < min) {
+ max = min;
+ min = position;
+ } else {
+ max = position;
+ }
+ }
+ if (extent[0][i] !== min || extent[1][i] !== max) {
+ extentDomain = null;
+ extent[0][i] = min;
+ extent[1][i] = max;
+ return true;
+ }
+ }
+ function brushend() {
+ brushmove();
+ g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
+ d3.select("body").style("cursor", null);
+ w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null);
+ event_({
+ type: "brushend"
+ });
+ d3_eventCancel();
+ }
+ var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset;
+ var w = d3.select(window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup);
+ if (dragging) {
+ origin[0] = extent[0][0] - origin[0];
+ origin[1] = extent[0][1] - origin[1];
+ } else if (resizing) {
+ var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);
+ offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ];
+ origin[0] = extent[ex][0];
+ origin[1] = extent[ey][1];
+ } else if (d3.event.altKey) center = origin.slice();
+ g.style("pointer-events", "none").selectAll(".resize").style("display", null);
+ d3.select("body").style("cursor", eventTarget.style("cursor"));
+ event_({
+ type: "brushstart"
+ });
+ brushmove();
+ d3_eventCancel();
+ }
+ var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain;
+ brush.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ resizes = d3_svg_brushResizes[!x << 1 | !y];
+ return brush;
+ };
+ brush.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ resizes = d3_svg_brushResizes[!x << 1 | !y];
+ return brush;
+ };
+ brush.extent = function(z) {
+ var x0, x1, y0, y1, t;
+ if (!arguments.length) {
+ z = extentDomain || extent;
+ if (x) {
+ x0 = z[0][0], x1 = z[1][0];
+ if (!extentDomain) {
+ x0 = extent[0][0], x1 = extent[1][0];
+ if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ }
+ }
+ if (y) {
+ y0 = z[0][1], y1 = z[1][1];
+ if (!extentDomain) {
+ y0 = extent[0][1], y1 = extent[1][1];
+ if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ }
+ }
+ return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];
+ }
+ extentDomain = [ [ 0, 0 ], [ 0, 0 ] ];
+ if (x) {
+ x0 = z[0], x1 = z[1];
+ if (y) x0 = x0[0], x1 = x1[0];
+ extentDomain[0][0] = x0, extentDomain[1][0] = x1;
+ if (x.invert) x0 = x(x0), x1 = x(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
+ }
+ if (y) {
+ y0 = z[0], y1 = z[1];
+ if (x) y0 = y0[1], y1 = y1[1];
+ extentDomain[0][1] = y0, extentDomain[1][1] = y1;
+ if (y.invert) y0 = y(y0), y1 = y(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
+ }
+ return brush;
+ };
+ brush.clear = function() {
+ extentDomain = null;
+ extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0;
+ return brush;
+ };
+ brush.empty = function() {
+ return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1];
+ };
+ return d3.rebind(brush, event, "on");
+ };
+ var d3_svg_brushCursor = {
+ n: "ns-resize",
+ e: "ew-resize",
+ s: "ns-resize",
+ w: "ew-resize",
+ nw: "nwse-resize",
+ ne: "nesw-resize",
+ se: "nwse-resize",
+ sw: "nesw-resize"
+ };
+ var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];
+ d3.behavior = {};
+ d3.behavior.drag = function() {
+ function drag() {
+ this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);
+ }
+ function mousedown() {
+ function point() {
+ var p = target.parentNode;
+ return touchId ? d3.touches(p).filter(function(p) {
+ return p.identifier === touchId;
+ })[0] : d3.mouse(p);
+ }
+ function dragmove() {
+ if (!target.parentNode) return dragend();
+ var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
+ moved |= dx | dy;
+ origin_ = p;
+ d3_eventCancel();
+ event_({
+ type: "drag",
+ x: p[0] + offset[0],
+ y: p[1] + offset[1],
+ dx: dx,
+ dy: dy
+ });
+ }
+ function dragend() {
+ event_({
+ type: "dragend"
+ });
+ if (moved) {
+ d3_eventCancel();
+ if (d3.event.target === eventTarget) w.on("click.drag", click, true);
+ }
+ w.on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", null);
+ }
+ function click() {
+ d3_eventCancel();
+ w.on("click.drag", null);
+ }
+ var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches && d3.event.changedTouches[0].identifier, offset, origin_ = point(), moved = 0;
+ var w = d3.select(window).on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true);
+ if (origin) {
+ offset = origin.apply(target, arguments);
+ offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
+ } else {
+ offset = [ 0, 0 ];
+ }
+ if (!touchId) d3_eventCancel();
+ event_({
+ type: "dragstart"
+ });
+ }
+ var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null;
+ drag.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ return drag;
+ };
+ return d3.rebind(drag, event, "on");
+ };
+ d3.behavior.zoom = function() {
+ function zoom() {
+ this.on("mousedown.zoom", mousedown).on("mousewheel.zoom", mousewheel).on("mousemove.zoom", mousemove).on("DOMMouseScroll.zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart);
+ }
+ function location(p) {
+ return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ];
+ }
+ function point(l) {
+ return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ];
+ }
+ function scaleTo(s) {
+ scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
+ }
+ function translateTo(p, l) {
+ l = point(l);
+ translate[0] += p[0] - l[0];
+ translate[1] += p[1] - l[1];
+ }
+ function dispatch(event) {
+ if (x1) x1.domain(x0.range().map(function(x) {
+ return (x - translate[0]) / scale;
+ }).map(x0.invert));
+ if (y1) y1.domain(y0.range().map(function(y) {
+ return (y - translate[1]) / scale;
+ }).map(y0.invert));
+ d3.event.preventDefault();
+ event({
+ type: "zoom",
+ scale: scale,
+ translate: translate
+ });
+ }
+ function mousedown() {
+ function mousemove() {
+ moved = 1;
+ translateTo(d3.mouse(target), l);
+ dispatch(event_);
+ }
+ function mouseup() {
+ if (moved) d3_eventCancel();
+ w.on("mousemove.zoom", null).on("mouseup.zoom", null);
+ if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true);
+ }
+ function click() {
+ d3_eventCancel();
+ w.on("click.zoom", null);
+ }
+ var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target));
+ window.focus();
+ d3_eventCancel();
+ }
+ function mousewheel() {
+ if (!translate0) translate0 = location(d3.mouse(this));
+ scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);
+ translateTo(d3.mouse(this), translate0);
+ dispatch(event.of(this, arguments));
+ }
+ function mousemove() {
+ translate0 = null;
+ }
+ function dblclick() {
+ var p = d3.mouse(this), l = location(p);
+ scaleTo(d3.event.shiftKey ? scale / 2 : scale * 2);
+ translateTo(p, l);
+ dispatch(event.of(this, arguments));
+ }
+ function touchstart() {
+ var touches = d3.touches(this), now = Date.now();
+ scale0 = scale;
+ translate0 = {};
+ touches.forEach(function(t) {
+ translate0[t.identifier] = location(t);
+ });
+ d3_eventCancel();
+ if (touches.length === 1) {
+ if (now - touchtime < 500) {
+ var p = touches[0], l = location(touches[0]);
+ scaleTo(scale * 2);
+ translateTo(p, l);
+ dispatch(event.of(this, arguments));
+ }
+ touchtime = now;
+ }
+ }
+ function touchmove() {
+ var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier];
+ if (p1 = touches[1]) {
+ var p1, l1 = translate0[p1.identifier];
+ p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];
+ l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
+ scaleTo(d3.event.scale * scale0);
+ }
+ translateTo(p0, l0);
+ touchtime = null;
+ dispatch(event.of(this, arguments));
+ }
+ var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
+ zoom.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = x.map(Number);
+ return zoom;
+ };
+ zoom.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return zoom;
+ };
+ zoom.scaleExtent = function(x) {
+ if (!arguments.length) return scaleExtent;
+ scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);
+ return zoom;
+ };
+ zoom.x = function(z) {
+ if (!arguments.length) return x1;
+ x1 = z;
+ x0 = z.copy();
+ return zoom;
+ };
+ zoom.y = function(z) {
+ if (!arguments.length) return y1;
+ y1 = z;
+ y0 = z.copy();
+ return zoom;
+ };
+ return d3.rebind(zoom, event, "on");
+ };
+ var d3_behavior_zoomDiv, d3_behavior_zoomInfinity = [ 0, Infinity ];
+ d3.layout = {};
+ d3.layout.bundle = function() {
+ return function(links) {
+ var paths = [], i = -1, n = links.length;
+ while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
+ return paths;
+ };
+ };
+ d3.layout.chord = function() {
+ function relayout() {
+ var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;
+ chords = [];
+ groups = [];
+ k = 0, i = -1;
+ while (++i < n) {
+ x = 0, j = -1;
+ while (++j < n) {
+ x += matrix[i][j];
+ }
+ groupSums.push(x);
+ subgroupIndex.push(d3.range(n));
+ k += x;
+ }
+ if (sortGroups) {
+ groupIndex.sort(function(a, b) {
+ return sortGroups(groupSums[a], groupSums[b]);
+ });
+ }
+ if (sortSubgroups) {
+ subgroupIndex.forEach(function(d, i) {
+ d.sort(function(a, b) {
+ return sortSubgroups(matrix[i][a], matrix[i][b]);
+ });
+ });
+ }
+ k = (2 * Math.PI - padding * n) / k;
+ x = 0, i = -1;
+ while (++i < n) {
+ x0 = x, j = -1;
+ while (++j < n) {
+ var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
+ subgroups[di + "-" + dj] = {
+ index: di,
+ subindex: dj,
+ startAngle: a0,
+ endAngle: a1,
+ value: v
+ };
+ }
+ groups[di] = {
+ index: di,
+ startAngle: x0,
+ endAngle: x,
+ value: (x - x0) / k
+ };
+ x += padding;
+ }
+ i = -1;
+ while (++i < n) {
+ j = i - 1;
+ while (++j < n) {
+ var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
+ if (source.value || target.value) {
+ chords.push(source.value < target.value ? {
+ source: target,
+ target: source
+ } : {
+ source: source,
+ target: target
+ });
+ }
+ }
+ }
+ if (sortChords) resort();
+ }
+ function resort() {
+ chords.sort(function(a, b) {
+ return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
+ });
+ }
+ var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
+ chord.matrix = function(x) {
+ if (!arguments.length) return matrix;
+ n = (matrix = x) && matrix.length;
+ chords = groups = null;
+ return chord;
+ };
+ chord.padding = function(x) {
+ if (!arguments.length) return padding;
+ padding = x;
+ chords = groups = null;
+ return chord;
+ };
+ chord.sortGroups = function(x) {
+ if (!arguments.length) return sortGroups;
+ sortGroups = x;
+ chords = groups = null;
+ return chord;
+ };
+ chord.sortSubgroups = function(x) {
+ if (!arguments.length) return sortSubgroups;
+ sortSubgroups = x;
+ chords = null;
+ return chord;
+ };
+ chord.sortChords = function(x) {
+ if (!arguments.length) return sortChords;
+ sortChords = x;
+ if (chords) resort();
+ return chord;
+ };
+ chord.chords = function() {
+ if (!chords) relayout();
+ return chords;
+ };
+ chord.groups = function() {
+ if (!groups) relayout();
+ return groups;
+ };
+ return chord;
+ };
+ d3.layout.force = function() {
+ function repulse(node) {
+ return function(quad, x1, y1, x2, y2) {
+ if (quad.point !== node) {
+ var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy);
+ if ((x2 - x1) * dn < theta) {
+ var k = quad.charge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ return true;
+ }
+ if (quad.point && isFinite(dn)) {
+ var k = quad.pointCharge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ }
+ }
+ return !quad.charge;
+ };
+ }
+ function dragmove(d) {
+ d.px = d3.event.x;
+ d.py = d3.event.y;
+ force.resume();
+ }
+ var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, interval, nodes = [], links = [], distances, strengths, charges;
+ force.tick = function() {
+ if ((alpha *= .99) < .005) {
+ event.end({
+ type: "end",
+ alpha: alpha = 0
+ });
+ return true;
+ }
+ var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ s = o.source;
+ t = o.target;
+ x = t.x - s.x;
+ y = t.y - s.y;
+ if (l = x * x + y * y) {
+ l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
+ x *= l;
+ y *= l;
+ t.x -= x * (k = s.weight / (t.weight + s.weight));
+ t.y -= y * k;
+ s.x += x * (k = 1 - k);
+ s.y += y * k;
+ }
+ }
+ if (k = alpha * gravity) {
+ x = size[0] / 2;
+ y = size[1] / 2;
+ i = -1;
+ if (k) while (++i < n) {
+ o = nodes[i];
+ o.x += (x - o.x) * k;
+ o.y += (y - o.y) * k;
+ }
+ }
+ if (charge) {
+ d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
+ i = -1;
+ while (++i < n) {
+ if (!(o = nodes[i]).fixed) {
+ q.visit(repulse(o));
+ }
+ }
+ }
+ i = -1;
+ while (++i < n) {
+ o = nodes[i];
+ if (o.fixed) {
+ o.x = o.px;
+ o.y = o.py;
+ } else {
+ o.x -= (o.px - (o.px = o.x)) * friction;
+ o.y -= (o.py - (o.py = o.y)) * friction;
+ }
+ }
+ event.tick({
+ type: "tick",
+ alpha: alpha
+ });
+ };
+ force.nodes = function(x) {
+ if (!arguments.length) return nodes;
+ nodes = x;
+ return force;
+ };
+ force.links = function(x) {
+ if (!arguments.length) return links;
+ links = x;
+ return force;
+ };
+ force.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return force;
+ };
+ force.linkDistance = function(x) {
+ if (!arguments.length) return linkDistance;
+ linkDistance = d3_functor(x);
+ return force;
+ };
+ force.distance = force.linkDistance;
+ force.linkStrength = function(x) {
+ if (!arguments.length) return linkStrength;
+ linkStrength = d3_functor(x);
+ return force;
+ };
+ force.friction = function(x) {
+ if (!arguments.length) return friction;
+ friction = x;
+ return force;
+ };
+ force.charge = function(x) {
+ if (!arguments.length) return charge;
+ charge = typeof x === "function" ? x : +x;
+ return force;
+ };
+ force.gravity = function(x) {
+ if (!arguments.length) return gravity;
+ gravity = x;
+ return force;
+ };
+ force.theta = function(x) {
+ if (!arguments.length) return theta;
+ theta = x;
+ return force;
+ };
+ force.alpha = function(x) {
+ if (!arguments.length) return alpha;
+ if (alpha) {
+ if (x > 0) alpha = x; else alpha = 0;
+ } else if (x > 0) {
+ event.start({
+ type: "start",
+ alpha: alpha = x
+ });
+ d3.timer(force.tick);
+ }
+ return force;
+ };
+ force.start = function() {
+ function position(dimension, size) {
+ var neighbors = neighbor(i), j = -1, m = neighbors.length, x;
+ while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
+ return Math.random() * size;
+ }
+ function neighbor() {
+ if (!neighbors) {
+ neighbors = [];
+ for (j = 0; j < n; ++j) {
+ neighbors[j] = [];
+ }
+ for (j = 0; j < m; ++j) {
+ var o = links[j];
+ neighbors[o.source.index].push(o.target);
+ neighbors[o.target.index].push(o.source);
+ }
+ }
+ return neighbors[i];
+ }
+ var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;
+ for (i = 0; i < n; ++i) {
+ (o = nodes[i]).index = i;
+ o.weight = 0;
+ }
+ distances = [];
+ strengths = [];
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ if (typeof o.source == "number") o.source = nodes[o.source];
+ if (typeof o.target == "number") o.target = nodes[o.target];
+ distances[i] = linkDistance.call(this, o, i);
+ strengths[i] = linkStrength.call(this, o, i);
+ ++o.source.weight;
+ ++o.target.weight;
+ }
+ for (i = 0; i < n; ++i) {
+ o = nodes[i];
+ if (isNaN(o.x)) o.x = position("x", w);
+ if (isNaN(o.y)) o.y = position("y", h);
+ if (isNaN(o.px)) o.px = o.x;
+ if (isNaN(o.py)) o.py = o.y;
+ }
+ charges = [];
+ if (typeof charge === "function") {
+ for (i = 0; i < n; ++i) {
+ charges[i] = +charge.call(this, nodes[i], i);
+ }
+ } else {
+ for (i = 0; i < n; ++i) {
+ charges[i] = charge;
+ }
+ }
+ return force.resume();
+ };
+ force.resume = function() {
+ return force.alpha(.1);
+ };
+ force.stop = function() {
+ return force.alpha(0);
+ };
+ force.drag = function() {
+ if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart", d3_layout_forceDragstart).on("drag", dragmove).on("dragend", d3_layout_forceDragend);
+ this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);
+ };
+ return d3.rebind(force, event, "on");
+ };
+ d3.layout.partition = function() {
+ function position(node, x, dx, dy) {
+ var children = node.children;
+ node.x = x;
+ node.y = node.depth * dy;
+ node.dx = dx;
+ node.dy = dy;
+ if (children && (n = children.length)) {
+ var i = -1, n, c, d;
+ dx = node.value ? dx / node.value : 0;
+ while (++i < n) {
+ position(c = children[i], x, d = c.value * dx, dy);
+ x += d;
+ }
+ }
+ }
+ function depth(node) {
+ var children = node.children, d = 0;
+ if (children && (n = children.length)) {
+ var i = -1, n;
+ while (++i < n) d = Math.max(d, depth(children[i]));
+ }
+ return 1 + d;
+ }
+ function partition(d, i) {
+ var nodes = hierarchy.call(this, d, i);
+ position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];
+ partition.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return partition;
+ };
+ return d3_layout_hierarchyRebind(partition, hierarchy);
+ };
+ d3.layout.pie = function() {
+ function pie(data, i) {
+ var values = data.map(function(d, i) {
+ return +value.call(pie, d, i);
+ });
+ var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle);
+ var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - startAngle) / d3.sum(values);
+ var index = d3.range(data.length);
+ if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
+ return values[j] - values[i];
+ } : function(i, j) {
+ return sort(data[i], data[j]);
+ });
+ var arcs = [];
+ index.forEach(function(i) {
+ var d;
+ arcs[i] = {
+ data: data[i],
+ value: d = values[i],
+ startAngle: a,
+ endAngle: a += d * k
+ };
+ });
+ return arcs;
+ }
+ var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * Math.PI;
+ pie.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return pie;
+ };
+ pie.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return pie;
+ };
+ pie.startAngle = function(x) {
+ if (!arguments.length) return startAngle;
+ startAngle = x;
+ return pie;
+ };
+ pie.endAngle = function(x) {
+ if (!arguments.length) return endAngle;
+ endAngle = x;
+ return pie;
+ };
+ return pie;
+ };
+ var d3_layout_pieSortByValue = {};
+ d3.layout.stack = function() {
+ function stack(data, index) {
+ var series = data.map(function(d, i) {
+ return values.call(stack, d, i);
+ });
+ var points = series.map(function(d, i) {
+ return d.map(function(v, i) {
+ return [ x.call(stack, v, i), y.call(stack, v, i) ];
+ });
+ });
+ var orders = order.call(stack, points, index);
+ series = d3.permute(series, orders);
+ points = d3.permute(points, orders);
+ var offsets = offset.call(stack, points, index);
+ var n = series.length, m = series[0].length, i, j, o;
+ for (j = 0; j < m; ++j) {
+ out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
+ for (i = 1; i < n; ++i) {
+ out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
+ }
+ }
+ return data;
+ }
+ var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
+ stack.values = function(x) {
+ if (!arguments.length) return values;
+ values = x;
+ return stack;
+ };
+ stack.order = function(x) {
+ if (!arguments.length) return order;
+ order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
+ return stack;
+ };
+ stack.offset = function(x) {
+ if (!arguments.length) return offset;
+ offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
+ return stack;
+ };
+ stack.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ return stack;
+ };
+ stack.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ return stack;
+ };
+ stack.out = function(z) {
+ if (!arguments.length) return out;
+ out = z;
+ return stack;
+ };
+ return stack;
+ };
+ var d3_layout_stackOrders = d3.map({
+ "inside-out": function(data) {
+ var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) {
+ return max[a] - max[b];
+ }), top = 0, bottom = 0, tops = [], bottoms = [];
+ for (i = 0; i < n; ++i) {
+ j = index[i];
+ if (top < bottom) {
+ top += sums[j];
+ tops.push(j);
+ } else {
+ bottom += sums[j];
+ bottoms.push(j);
+ }
+ }
+ return bottoms.reverse().concat(tops);
+ },
+ reverse: function(data) {
+ return d3.range(data.length).reverse();
+ },
+ "default": d3_layout_stackOrderDefault
+ });
+ var d3_layout_stackOffsets = d3.map({
+ silhouette: function(data) {
+ var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o > max) max = o;
+ sums.push(o);
+ }
+ for (j = 0; j < m; ++j) {
+ y0[j] = (max - sums[j]) / 2;
+ }
+ return y0;
+ },
+ wiggle: function(data) {
+ var n = data.length, x = data[0], m = x.length, max = 0, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];
+ y0[0] = o = o0 = 0;
+ for (j = 1; j < m; ++j) {
+ for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
+ for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
+ for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
+ s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
+ }
+ s2 += s3 * data[i][j][1];
+ }
+ y0[j] = o -= s1 ? s2 / s1 * dx : 0;
+ if (o < o0) o0 = o;
+ }
+ for (j = 0; j < m; ++j) y0[j] -= o0;
+ return y0;
+ },
+ expand: function(data) {
+ var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k;
+ }
+ for (j = 0; j < m; ++j) y0[j] = 0;
+ return y0;
+ },
+ zero: d3_layout_stackOffsetZero
+ });
+ d3.layout.histogram = function() {
+ function histogram(data, i) {
+ var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x;
+ while (++i < m) {
+ bin = bins[i] = [];
+ bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
+ bin.y = 0;
+ }
+ if (m > 0) {
+ i = -1;
+ while (++i < n) {
+ x = values[i];
+ if (x >= range[0] && x <= range[1]) {
+ bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
+ bin.y += k;
+ bin.push(data[i]);
+ }
+ }
+ }
+ return bins;
+ }
+ var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;
+ histogram.value = function(x) {
+ if (!arguments.length) return valuer;
+ valuer = x;
+ return histogram;
+ };
+ histogram.range = function(x) {
+ if (!arguments.length) return ranger;
+ ranger = d3_functor(x);
+ return histogram;
+ };
+ histogram.bins = function(x) {
+ if (!arguments.length) return binner;
+ binner = typeof x === "number" ? function(range) {
+ return d3_layout_histogramBinFixed(range, x);
+ } : d3_functor(x);
+ return histogram;
+ };
+ histogram.frequency = function(x) {
+ if (!arguments.length) return frequency;
+ frequency = !!x;
+ return histogram;
+ };
+ return histogram;
+ };
+ d3.layout.hierarchy = function() {
+ function recurse(data, depth, nodes) {
+ var childs = children.call(hierarchy, data, depth), node = d3_layout_hierarchyInline ? data : {
+ data: data
+ };
+ node.depth = depth;
+ nodes.push(node);
+ if (childs && (n = childs.length)) {
+ var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d;
+ while (++i < n) {
+ d = recurse(childs[i], j, nodes);
+ d.parent = node;
+ c.push(d);
+ v += d.value;
+ }
+ if (sort) c.sort(sort);
+ if (value) node.value = v;
+ } else if (value) {
+ node.value = +value.call(hierarchy, data, depth) || 0;
+ }
+ return node;
+ }
+ function revalue(node, depth) {
+ var children = node.children, v = 0;
+ if (children && (n = children.length)) {
+ var i = -1, n, j = depth + 1;
+ while (++i < n) v += revalue(children[i], j);
+ } else if (value) {
+ v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0;
+ }
+ if (value) node.value = v;
+ return v;
+ }
+ function hierarchy(d) {
+ var nodes = [];
+ recurse(d, 0, nodes);
+ return nodes;
+ }
+ var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;
+ hierarchy.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return hierarchy;
+ };
+ hierarchy.children = function(x) {
+ if (!arguments.length) return children;
+ children = x;
+ return hierarchy;
+ };
+ hierarchy.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return hierarchy;
+ };
+ hierarchy.revalue = function(root) {
+ revalue(root, 0);
+ return root;
+ };
+ return hierarchy;
+ };
+ var d3_layout_hierarchyInline = false;
+ d3.layout.pack = function() {
+ function pack(d, i) {
+ var nodes = hierarchy.call(this, d, i), root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r = Math.sqrt(d.value);
+ });
+ d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
+ var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h);
+ if (padding > 0) {
+ var dr = padding * k / 2;
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r += dr;
+ });
+ d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r -= dr;
+ });
+ k = Math.max(2 * root.r / w, 2 * root.r / h);
+ }
+ d3_layout_packTransform(root, w / 2, h / 2, 1 / k);
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ];
+ pack.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return pack;
+ };
+ pack.padding = function(_) {
+ if (!arguments.length) return padding;
+ padding = +_;
+ return pack;
+ };
+ return d3_layout_hierarchyRebind(pack, hierarchy);
+ };
+ d3.layout.cluster = function() {
+ function cluster(d, i) {
+ var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0, kx, ky;
+ d3_layout_treeVisitAfter(root, function(node) {
+ var children = node.children;
+ if (children && children.length) {
+ node.x = d3_layout_clusterX(children);
+ node.y = d3_layout_clusterY(children);
+ } else {
+ node.x = previousNode ? x += separation(node, previousNode) : 0;
+ node.y = 0;
+ previousNode = node;
+ }
+ });
+ var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
+ });
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
+ cluster.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return cluster;
+ };
+ cluster.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return cluster;
+ };
+ return d3_layout_hierarchyRebind(cluster, hierarchy);
+ };
+ d3.layout.tree = function() {
+ function tree(d, i) {
+ function firstWalk(node, previousSibling) {
+ var children = node.children, layout = node._tree;
+ if (children && (n = children.length)) {
+ var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;
+ while (++i < n) {
+ child = children[i];
+ firstWalk(child, previousChild);
+ ancestor = apportion(child, previousChild, ancestor);
+ previousChild = child;
+ }
+ d3_layout_treeShift(node);
+ var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ layout.mod = layout.prelim - midpoint;
+ } else {
+ layout.prelim = midpoint;
+ }
+ } else {
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ }
+ }
+ }
+ function secondWalk(node, x) {
+ node.x = node._tree.prelim + x;
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var i = -1, n;
+ x += node._tree.mod;
+ while (++i < n) {
+ secondWalk(children[i], x);
+ }
+ }
+ }
+ function apportion(node, previousSibling, ancestor) {
+ if (previousSibling) {
+ var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift;
+ while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
+ vom = d3_layout_treeLeft(vom);
+ vop = d3_layout_treeRight(vop);
+ vop._tree.ancestor = node;
+ shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
+ if (shift > 0) {
+ d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
+ sip += shift;
+ sop += shift;
+ }
+ sim += vim._tree.mod;
+ sip += vip._tree.mod;
+ som += vom._tree.mod;
+ sop += vop._tree.mod;
+ }
+ if (vim && !d3_layout_treeRight(vop)) {
+ vop._tree.thread = vim;
+ vop._tree.mod += sim - sop;
+ }
+ if (vip && !d3_layout_treeLeft(vom)) {
+ vom._tree.thread = vip;
+ vom._tree.mod += sip - som;
+ ancestor = node;
+ }
+ }
+ return ancestor;
+ }
+ var nodes = hierarchy.call(this, d, i), root = nodes[0];
+ d3_layout_treeVisitAfter(root, function(node, previousSibling) {
+ node._tree = {
+ ancestor: node,
+ prelim: 0,
+ mod: 0,
+ change: 0,
+ shift: 0,
+ number: previousSibling ? previousSibling._tree.number + 1 : 0
+ };
+ });
+ firstWalk(root);
+ secondWalk(root, -root._tree.prelim);
+ var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1;
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = node.depth / y1 * size[1];
+ delete node._tree;
+ });
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
+ tree.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return tree;
+ };
+ tree.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return tree;
+ };
+ return d3_layout_hierarchyRebind(tree, hierarchy);
+ };
+ d3.layout.treemap = function() {
+ function scale(children, k) {
+ var i = -1, n = children.length, child, area;
+ while (++i < n) {
+ area = (child = children[i]).value * (k < 0 ? 0 : k);
+ child.area = isNaN(area) || area <= 0 ? 0 : area;
+ }
+ }
+ function squarify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = Math.min(rect.dx, rect.dy), n;
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while ((n = remaining.length) > 0) {
+ row.push(child = remaining[n - 1]);
+ row.area += child.area;
+ if ((score = worst(row, u)) <= best) {
+ remaining.pop();
+ best = score;
+ } else {
+ row.area -= row.pop().area;
+ position(row, u, rect, false);
+ u = Math.min(rect.dx, rect.dy);
+ row.length = row.area = 0;
+ best = Infinity;
+ }
+ }
+ if (row.length) {
+ position(row, u, rect, true);
+ row.length = row.area = 0;
+ }
+ children.forEach(squarify);
+ }
+ }
+ function stickify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node), remaining = children.slice(), child, row = [];
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while (child = remaining.pop()) {
+ row.push(child);
+ row.area += child.area;
+ if (child.z != null) {
+ position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
+ row.length = row.area = 0;
+ }
+ }
+ children.forEach(stickify);
+ }
+ }
+ function worst(row, u) {
+ var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;
+ while (++i < n) {
+ if (!(r = row[i].area)) continue;
+ if (r < rmin) rmin = r;
+ if (r > rmax) rmax = r;
+ }
+ s *= s;
+ u *= u;
+ return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;
+ }
+ function position(row, u, rect, flush) {
+ var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
+ if (u == rect.dx) {
+ if (flush || v > rect.dy) v = rect.dy;
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dy = v;
+ x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
+ }
+ o.z = true;
+ o.dx += rect.x + rect.dx - x;
+ rect.y += v;
+ rect.dy -= v;
+ } else {
+ if (flush || v > rect.dx) v = rect.dx;
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dx = v;
+ y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
+ }
+ o.z = false;
+ o.dy += rect.y + rect.dy - y;
+ rect.x += v;
+ rect.dx -= v;
+ }
+ }
+ function treemap(d) {
+ var nodes = stickies || hierarchy(d), root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ root.dx = size[0];
+ root.dy = size[1];
+ if (stickies) hierarchy.revalue(root);
+ scale([ root ], root.dx * root.dy / root.value);
+ (stickies ? stickify : squarify)(root);
+ if (sticky) stickies = nodes;
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, ratio = .5 * (1 + Math.sqrt(5));
+ treemap.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return treemap;
+ };
+ treemap.padding = function(x) {
+ function padFunction(node) {
+ var p = x.call(treemap, node, node.depth);
+ return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);
+ }
+ function padConstant(node) {
+ return d3_layout_treemapPad(node, x);
+ }
+ if (!arguments.length) return padding;
+ var type;
+ pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], padConstant) : padConstant;
+ return treemap;
+ };
+ treemap.round = function(x) {
+ if (!arguments.length) return round != Number;
+ round = x ? Math.round : Number;
+ return treemap;
+ };
+ treemap.sticky = function(x) {
+ if (!arguments.length) return sticky;
+ sticky = x;
+ stickies = null;
+ return treemap;
+ };
+ treemap.ratio = function(x) {
+ if (!arguments.length) return ratio;
+ ratio = x;
+ return treemap;
+ };
+ return d3_layout_hierarchyRebind(treemap, hierarchy);
+ };
+ d3.csv = d3_dsv(",", "text/csv");
+ d3.tsv = d3_dsv(" ", "text/tab-separated-values");
+ d3.geo = {};
+ var d3_geo_radians = Math.PI / 180;
+ d3.geo.azimuthal = function() {
+ function azimuthal(coordinates) {
+ var x1 = coordinates[0] * d3_geo_radians - x0, y1 = coordinates[1] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1), cy1 = Math.cos(y1), sy1 = Math.sin(y1), cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null, c, k = mode === "stereographic" ? 1 / (1 + cc) : mode === "gnomonic" ? 1 / cc : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0) : mode === "equalarea" ? Math.sqrt(2 / (1 + cc)) : 1, x = k * cy1 * sx1, y = k * (sy0 * cy1 * cx1 - cy0 * sy1);
+ return [ scale * x + translate[0], scale * y + translate[1] ];
+ }
+ var mode = "orthographic", origin, scale = 200, translate = [ 480, 250 ], x0, y0, cy0, sy0;
+ azimuthal.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p = Math.sqrt(x * x + y * y), c = mode === "stereographic" ? 2 * Math.atan(p) : mode === "gnomonic" ? Math.atan(p) : mode === "equidistant" ? p : mode === "equalarea" ? 2 * Math.asin(.5 * p) : Math.asin(p), sc = Math.sin(c), cc = Math.cos(c);
+ return [ (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians, Math.asin(cc * sy0 - (p ? y * sc * cy0 / p : 0)) / d3_geo_radians ];
+ };
+ azimuthal.mode = function(x) {
+ if (!arguments.length) return mode;
+ mode = x + "";
+ return azimuthal;
+ };
+ azimuthal.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ x0 = origin[0] * d3_geo_radians;
+ y0 = origin[1] * d3_geo_radians;
+ cy0 = Math.cos(y0);
+ sy0 = Math.sin(y0);
+ return azimuthal;
+ };
+ azimuthal.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return azimuthal;
+ };
+ azimuthal.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return azimuthal;
+ };
+ return azimuthal.origin([ 0, 0 ]);
+ };
+ d3.geo.albers = function() {
+ function albers(coordinates) {
+ var t = n * (d3_geo_radians * coordinates[0] - lng0), p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n;
+ return [ scale * p * Math.sin(t) + translate[0], scale * (p * Math.cos(t) - p0) + translate[1] ];
+ }
+ function reload() {
+ var phi1 = d3_geo_radians * parallels[0], phi2 = d3_geo_radians * parallels[1], lat0 = d3_geo_radians * origin[1], s = Math.sin(phi1), c = Math.cos(phi1);
+ lng0 = d3_geo_radians * origin[0];
+ n = .5 * (s + Math.sin(phi2));
+ C = c * c + 2 * n * s;
+ p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n;
+ return albers;
+ }
+ var origin = [ -98, 38 ], parallels = [ 29.5, 45.5 ], scale = 1e3, translate = [ 480, 250 ], lng0, n, C, p0;
+ albers.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p0y = p0 + y, t = Math.atan2(x, p0y), p = Math.sqrt(x * x + p0y * p0y);
+ return [ (lng0 + t / n) / d3_geo_radians, Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians ];
+ };
+ albers.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = [ +x[0], +x[1] ];
+ return reload();
+ };
+ albers.parallels = function(x) {
+ if (!arguments.length) return parallels;
+ parallels = [ +x[0], +x[1] ];
+ return reload();
+ };
+ albers.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return albers;
+ };
+ albers.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return albers;
+ };
+ return reload();
+ };
+ d3.geo.albersUsa = function() {
+ function albersUsa(coordinates) {
+ var lon = coordinates[0], lat = coordinates[1];
+ return (lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48)(coordinates);
+ }
+ var lower48 = d3.geo.albers();
+ var alaska = d3.geo.albers().origin([ -160, 60 ]).parallels([ 55, 65 ]);
+ var hawaii = d3.geo.albers().origin([ -160, 20 ]).parallels([ 8, 18 ]);
+ var puertoRico = d3.geo.albers().origin([ -60, 10 ]).parallels([ 8, 18 ]);
+ albersUsa.scale = function(x) {
+ if (!arguments.length) return lower48.scale();
+ lower48.scale(x);
+ alaska.scale(x * .6);
+ hawaii.scale(x);
+ puertoRico.scale(x * 1.5);
+ return albersUsa.translate(lower48.translate());
+ };
+ albersUsa.translate = function(x) {
+ if (!arguments.length) return lower48.translate();
+ var dz = lower48.scale() / 1e3, dx = x[0], dy = x[1];
+ lower48.translate(x);
+ alaska.translate([ dx - 400 * dz, dy + 170 * dz ]);
+ hawaii.translate([ dx - 190 * dz, dy + 200 * dz ]);
+ puertoRico.translate([ dx + 580 * dz, dy + 430 * dz ]);
+ return albersUsa;
+ };
+ return albersUsa.scale(lower48.scale());
+ };
+ d3.geo.bonne = function() {
+ function bonne(coordinates) {
+ var x = coordinates[0] * d3_geo_radians - x0, y = coordinates[1] * d3_geo_radians - y0;
+ if (y1) {
+ var p = c1 + y1 - y, E = x * Math.cos(y) / p;
+ x = p * Math.sin(E);
+ y = p * Math.cos(E) - c1;
+ } else {
+ x *= Math.cos(y);
+ y *= -1;
+ }
+ return [ scale * x + translate[0], scale * y + translate[1] ];
+ }
+ var scale = 200, translate = [ 480, 250 ], x0, y0, y1, c1;
+ bonne.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
+ if (y1) {
+ var c = c1 + y, p = Math.sqrt(x * x + c * c);
+ y = c1 + y1 - p;
+ x = x0 + p * Math.atan2(x, c) / Math.cos(y);
+ } else {
+ y *= -1;
+ x /= Math.cos(y);
+ }
+ return [ x / d3_geo_radians, y / d3_geo_radians ];
+ };
+ bonne.parallel = function(x) {
+ if (!arguments.length) return y1 / d3_geo_radians;
+ c1 = 1 / Math.tan(y1 = x * d3_geo_radians);
+ return bonne;
+ };
+ bonne.origin = function(x) {
+ if (!arguments.length) return [ x0 / d3_geo_radians, y0 / d3_geo_radians ];
+ x0 = x[0] * d3_geo_radians;
+ y0 = x[1] * d3_geo_radians;
+ return bonne;
+ };
+ bonne.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return bonne;
+ };
+ bonne.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return bonne;
+ };
+ return bonne.origin([ 0, 0 ]).parallel(45);
+ };
+ d3.geo.equirectangular = function() {
+ function equirectangular(coordinates) {
+ var x = coordinates[0] / 360, y = -coordinates[1] / 360;
+ return [ scale * x + translate[0], scale * y + translate[1] ];
+ }
+ var scale = 500, translate = [ 480, 250 ];
+ equirectangular.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
+ return [ 360 * x, -360 * y ];
+ };
+ equirectangular.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return equirectangular;
+ };
+ equirectangular.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return equirectangular;
+ };
+ return equirectangular;
+ };
+ d3.geo.mercator = function() {
+ function mercator(coordinates) {
+ var x = coordinates[0] / 360, y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360;
+ return [ scale * x + translate[0], scale * Math.max(-.5, Math.min(.5, y)) + translate[1] ];
+ }
+ var scale = 500, translate = [ 480, 250 ];
+ mercator.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
+ return [ 360 * x, 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90 ];
+ };
+ mercator.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return mercator;
+ };
+ mercator.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return mercator;
+ };
+ return mercator;
+ };
+ d3.geo.path = function() {
+ function path(d, i) {
+ if (typeof pointRadius === "function") pointCircle = d3_path_circle(pointRadius.apply(this, arguments));
+ pathType(d);
+ var result = buffer.length ? buffer.join("") : null;
+ buffer = [];
+ return result;
+ }
+ function project(coordinates) {
+ return projection(coordinates).join(",");
+ }
+ function polygonArea(coordinates) {
+ var sum = area(coordinates[0]), i = 0, n = coordinates.length;
+ while (++i < n) sum -= area(coordinates[i]);
+ return sum;
+ }
+ function polygonCentroid(coordinates) {
+ var polygon = d3.geom.polygon(coordinates[0].map(projection)), area = polygon.area(), centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1), x = centroid[0], y = centroid[1], z = area, i = 0, n = coordinates.length;
+ while (++i < n) {
+ polygon = d3.geom.polygon(coordinates[i].map(projection));
+ area = polygon.area();
+ centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1);
+ x -= centroid[0];
+ y -= centroid[1];
+ z -= area;
+ }
+ return [ x, y, 6 * z ];
+ }
+ function area(coordinates) {
+ return Math.abs(d3.geom.polygon(coordinates.map(projection)).area());
+ }
+ var pointRadius = 4.5, pointCircle = d3_path_circle(pointRadius), projection = d3.geo.albersUsa(), buffer = [];
+ var pathType = d3_geo_type({
+ FeatureCollection: function(o) {
+ var features = o.features, i = -1, n = features.length;
+ while (++i < n) buffer.push(pathType(features[i].geometry));
+ },
+ Feature: function(o) {
+ pathType(o.geometry);
+ },
+ Point: function(o) {
+ buffer.push("M", project(o.coordinates), pointCircle);
+ },
+ MultiPoint: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length;
+ while (++i < n) buffer.push("M", project(coordinates[i]), pointCircle);
+ },
+ LineString: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length;
+ buffer.push("M");
+ while (++i < n) buffer.push(project(coordinates[i]), "L");
+ buffer.pop();
+ },
+ MultiLineString: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;
+ while (++i < n) {
+ subcoordinates = coordinates[i];
+ j = -1;
+ m = subcoordinates.length;
+ buffer.push("M");
+ while (++j < m) buffer.push(project(subcoordinates[j]), "L");
+ buffer.pop();
+ }
+ },
+ Polygon: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;
+ while (++i < n) {
+ subcoordinates = coordinates[i];
+ j = -1;
+ if ((m = subcoordinates.length - 1) > 0) {
+ buffer.push("M");
+ while (++j < m) buffer.push(project(subcoordinates[j]), "L");
+ buffer[buffer.length - 1] = "Z";
+ }
+ }
+ },
+ MultiPolygon: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m, subsubcoordinates, k, p;
+ while (++i < n) {
+ subcoordinates = coordinates[i];
+ j = -1;
+ m = subcoordinates.length;
+ while (++j < m) {
+ subsubcoordinates = subcoordinates[j];
+ k = -1;
+ if ((p = subsubcoordinates.length - 1) > 0) {
+ buffer.push("M");
+ while (++k < p) buffer.push(project(subsubcoordinates[k]), "L");
+ buffer[buffer.length - 1] = "Z";
+ }
+ }
+ }
+ },
+ GeometryCollection: function(o) {
+ var geometries = o.geometries, i = -1, n = geometries.length;
+ while (++i < n) buffer.push(pathType(geometries[i]));
+ }
+ });
+ var areaType = path.area = d3_geo_type({
+ FeatureCollection: function(o) {
+ var area = 0, features = o.features, i = -1, n = features.length;
+ while (++i < n) area += areaType(features[i]);
+ return area;
+ },
+ Feature: function(o) {
+ return areaType(o.geometry);
+ },
+ Polygon: function(o) {
+ return polygonArea(o.coordinates);
+ },
+ MultiPolygon: function(o) {
+ var sum = 0, coordinates = o.coordinates, i = -1, n = coordinates.length;
+ while (++i < n) sum += polygonArea(coordinates[i]);
+ return sum;
+ },
+ GeometryCollection: function(o) {
+ var sum = 0, geometries = o.geometries, i = -1, n = geometries.length;
+ while (++i < n) sum += areaType(geometries[i]);
+ return sum;
+ }
+ }, 0);
+ var centroidType = path.centroid = d3_geo_type({
+ Feature: function(o) {
+ return centroidType(o.geometry);
+ },
+ Polygon: function(o) {
+ var centroid = polygonCentroid(o.coordinates);
+ return [ centroid[0] / centroid[2], centroid[1] / centroid[2] ];
+ },
+ MultiPolygon: function(o) {
+ var area = 0, coordinates = o.coordinates, centroid, x = 0, y = 0, z = 0, i = -1, n = coordinates.length;
+ while (++i < n) {
+ centroid = polygonCentroid(coordinates[i]);
+ x += centroid[0];
+ y += centroid[1];
+ z += centroid[2];
+ }
+ return [ x / z, y / z ];
+ }
+ });
+ path.projection = function(x) {
+ projection = x;
+ return path;
+ };
+ path.pointRadius = function(x) {
+ if (typeof x === "function") pointRadius = x; else {
+ pointRadius = +x;
+ pointCircle = d3_path_circle(pointRadius);
+ }
+ return path;
+ };
+ return path;
+ };
+ d3.geo.bounds = function(feature) {
+ var left = Infinity, bottom = Infinity, right = -Infinity, top = -Infinity;
+ d3_geo_bounds(feature, function(x, y) {
+ if (x < left) left = x;
+ if (x > right) right = x;
+ if (y < bottom) bottom = y;
+ if (y > top) top = y;
+ });
+ return [ [ left, bottom ], [ right, top ] ];
+ };
+ var d3_geo_boundsTypes = {
+ Feature: d3_geo_boundsFeature,
+ FeatureCollection: d3_geo_boundsFeatureCollection,
+ GeometryCollection: d3_geo_boundsGeometryCollection,
+ LineString: d3_geo_boundsLineString,
+ MultiLineString: d3_geo_boundsMultiLineString,
+ MultiPoint: d3_geo_boundsLineString,
+ MultiPolygon: d3_geo_boundsMultiPolygon,
+ Point: d3_geo_boundsPoint,
+ Polygon: d3_geo_boundsPolygon
+ };
+ d3.geo.circle = function() {
+ function circle() {}
+ function visible(point) {
+ return arc.distance(point) < radians;
+ }
+ function clip(coordinates) {
+ var i = -1, n = coordinates.length, clipped = [], p0, p1, p2, d0, d1;
+ while (++i < n) {
+ d1 = arc.distance(p2 = coordinates[i]);
+ if (d1 < radians) {
+ if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));
+ clipped.push(p2);
+ p0 = p1 = null;
+ } else {
+ p1 = p2;
+ if (!p0 && clipped.length) {
+ clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0)));
+ p0 = p1;
+ }
+ }
+ d0 = d1;
+ }
+ p0 = coordinates[0];
+ p1 = clipped[0];
+ if (p1 && p2[0] === p0[0] && p2[1] === p0[1] && !(p2[0] === p1[0] && p2[1] === p1[1])) {
+ clipped.push(p1);
+ }
+ return resample(clipped);
+ }
+ function resample(coordinates) {
+ var i = 0, n = coordinates.length, j, m, resampled = n ? [ coordinates[0] ] : coordinates, resamples, origin = arc.source();
+ while (++i < n) {
+ resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates;
+ for (j = 0, m = resamples.length; ++j < m; ) resampled.push(resamples[j]);
+ }
+ arc.source(origin);
+ return resampled;
+ }
+ var origin = [ 0, 0 ], degrees = 90 - .01, radians = degrees * d3_geo_radians, arc = d3.geo.greatArc().source(origin).target(d3_identity);
+ circle.clip = function(d) {
+ if (typeof origin === "function") arc.source(origin.apply(this, arguments));
+ return clipType(d) || null;
+ };
+ var clipType = d3_geo_type({
+ FeatureCollection: function(o) {
+ var features = o.features.map(clipType).filter(d3_identity);
+ return features && (o = Object.create(o), o.features = features, o);
+ },
+ Feature: function(o) {
+ var geometry = clipType(o.geometry);
+ return geometry && (o = Object.create(o), o.geometry = geometry, o);
+ },
+ Point: function(o) {
+ return visible(o.coordinates) && o;
+ },
+ MultiPoint: function(o) {
+ var coordinates = o.coordinates.filter(visible);
+ return coordinates.length && {
+ type: o.type,
+ coordinates: coordinates
+ };
+ },
+ LineString: function(o) {
+ var coordinates = clip(o.coordinates);
+ return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+ MultiLineString: function(o) {
+ var coordinates = o.coordinates.map(clip).filter(function(d) {
+ return d.length;
+ });
+ return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+ Polygon: function(o) {
+ var coordinates = o.coordinates.map(clip);
+ return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+ MultiPolygon: function(o) {
+ var coordinates = o.coordinates.map(function(d) {
+ return d.map(clip);
+ }).filter(function(d) {
+ return d[0].length;
+ });
+ return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+ GeometryCollection: function(o) {
+ var geometries = o.geometries.map(clipType).filter(d3_identity);
+ return geometries.length && (o = Object.create(o), o.geometries = geometries, o);
+ }
+ });
+ circle.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ if (typeof origin !== "function") arc.source(origin);
+ return circle;
+ };
+ circle.angle = function(x) {
+ if (!arguments.length) return degrees;
+ radians = (degrees = +x) * d3_geo_radians;
+ return circle;
+ };
+ return d3.rebind(circle, arc, "precision");
+ };
+ d3.geo.greatArc = function() {
+ function greatArc() {
+ var d = greatArc.distance.apply(this, arguments), t = 0, dt = precision / d, coordinates = [ p0 ];
+ while ((t += dt) < 1) coordinates.push(interpolate(t));
+ coordinates.push(p1);
+ return {
+ type: "LineString",
+ coordinates: coordinates
+ };
+ }
+ var source = d3_geo_greatArcSource, p0, target = d3_geo_greatArcTarget, p1, precision = 6 * d3_geo_radians, interpolate = d3_geo_greatArcInterpolator();
+ greatArc.distance = function() {
+ if (typeof source === "function") interpolate.source(p0 = source.apply(this, arguments));
+ if (typeof target === "function") interpolate.target(p1 = target.apply(this, arguments));
+ return interpolate.distance();
+ };
+ greatArc.source = function(_) {
+ if (!arguments.length) return source;
+ source = _;
+ if (typeof source !== "function") interpolate.source(p0 = source);
+ return greatArc;
+ };
+ greatArc.target = function(_) {
+ if (!arguments.length) return target;
+ target = _;
+ if (typeof target !== "function") interpolate.target(p1 = target);
+ return greatArc;
+ };
+ greatArc.precision = function(_) {
+ if (!arguments.length) return precision / d3_geo_radians;
+ precision = _ * d3_geo_radians;
+ return greatArc;
+ };
+ return greatArc;
+ };
+ d3.geo.greatCircle = d3.geo.circle;
+ d3.geom = {};
+ d3.geom.contour = function(grid, start) {
+ var s = start || d3_geom_contourStart(grid), c = [], x = s[0], y = s[1], dx = 0, dy = 0, pdx = NaN, pdy = NaN, i = 0;
+ do {
+ i = 0;
+ if (grid(x - 1, y - 1)) i += 1;
+ if (grid(x, y - 1)) i += 2;
+ if (grid(x - 1, y)) i += 4;
+ if (grid(x, y)) i += 8;
+ if (i === 6) {
+ dx = pdy === -1 ? -1 : 1;
+ dy = 0;
+ } else if (i === 9) {
+ dx = 0;
+ dy = pdx === 1 ? -1 : 1;
+ } else {
+ dx = d3_geom_contourDx[i];
+ dy = d3_geom_contourDy[i];
+ }
+ if (dx != pdx && dy != pdy) {
+ c.push([ x, y ]);
+ pdx = dx;
+ pdy = dy;
+ }
+ x += dx;
+ y += dy;
+ } while (s[0] != x || s[1] != y);
+ return c;
+ };
+ var d3_geom_contourDx = [ 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 0, 0, -1, 0, -1, NaN ], d3_geom_contourDy = [ 0, -1, 0, 0, 0, -1, 0, 0, 1, -1, 1, 1, 0, -1, 0, NaN ];
+ d3.geom.hull = function(vertices) {
+ if (vertices.length < 3) return [];
+ var len = vertices.length, plen = len - 1, points = [], stack = [], i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
+ for (i = 1; i < len; ++i) {
+ if (vertices[i][1] < vertices[h][1]) {
+ h = i;
+ } else if (vertices[i][1] == vertices[h][1]) {
+ h = vertices[i][0] < vertices[h][0] ? i : h;
+ }
+ }
+ for (i = 0; i < len; ++i) {
+ if (i === h) continue;
+ y1 = vertices[i][1] - vertices[h][1];
+ x1 = vertices[i][0] - vertices[h][0];
+ points.push({
+ angle: Math.atan2(y1, x1),
+ index: i
+ });
+ }
+ points.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ a = points[0].angle;
+ v = points[0].index;
+ u = 0;
+ for (i = 1; i < plen; ++i) {
+ j = points[i].index;
+ if (a == points[i].angle) {
+ x1 = vertices[v][0] - vertices[h][0];
+ y1 = vertices[v][1] - vertices[h][1];
+ x2 = vertices[j][0] - vertices[h][0];
+ y2 = vertices[j][1] - vertices[h][1];
+ if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) {
+ points[i].index = -1;
+ } else {
+ points[u].index = -1;
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ } else {
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ }
+ stack.push(h);
+ for (i = 0, j = 0; i < 2; ++j) {
+ if (points[j].index !== -1) {
+ stack.push(points[j].index);
+ i++;
+ }
+ }
+ sp = stack.length;
+ for (; j < plen; ++j) {
+ if (points[j].index === -1) continue;
+ while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) {
+ --sp;
+ }
+ stack[sp++] = points[j].index;
+ }
+ var poly = [];
+ for (i = 0; i < sp; ++i) {
+ poly.push(vertices[stack[i]]);
+ }
+ return poly;
+ };
+ d3.geom.polygon = function(coordinates) {
+ coordinates.area = function() {
+ var i = 0, n = coordinates.length, a = coordinates[n - 1][0] * coordinates[0][1], b = coordinates[n - 1][1] * coordinates[0][0];
+ while (++i < n) {
+ a += coordinates[i - 1][0] * coordinates[i][1];
+ b += coordinates[i - 1][1] * coordinates[i][0];
+ }
+ return (b - a) * .5;
+ };
+ coordinates.centroid = function(k) {
+ var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c;
+ if (!arguments.length) k = -1 / (6 * coordinates.area());
+ while (++i < n) {
+ a = b;
+ b = coordinates[i];
+ c = a[0] * b[1] - b[0] * a[1];
+ x += (a[0] + b[0]) * c;
+ y += (a[1] + b[1]) * c;
+ }
+ return [ x * k, y * k ];
+ };
+ coordinates.clip = function(subject) {
+ var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d;
+ while (++i < n) {
+ input = subject.slice();
+ subject.length = 0;
+ b = coordinates[i];
+ c = input[(m = input.length) - 1];
+ j = -1;
+ while (++j < m) {
+ d = input[j];
+ if (d3_geom_polygonInside(d, a, b)) {
+ if (!d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ subject.push(d);
+ } else if (d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ c = d;
+ }
+ a = b;
+ }
+ return subject;
+ };
+ return coordinates;
+ };
+ d3.geom.voronoi = function(vertices) {
+ var polygons = vertices.map(function() {
+ return [];
+ });
+ d3_voronoi_tessellate(vertices, function(e) {
+ var s1, s2, x1, x2, y1, y2;
+ if (e.a === 1 && e.b >= 0) {
+ s1 = e.ep.r;
+ s2 = e.ep.l;
+ } else {
+ s1 = e.ep.l;
+ s2 = e.ep.r;
+ }
+ if (e.a === 1) {
+ y1 = s1 ? s1.y : -1e6;
+ x1 = e.c - e.b * y1;
+ y2 = s2 ? s2.y : 1e6;
+ x2 = e.c - e.b * y2;
+ } else {
+ x1 = s1 ? s1.x : -1e6;
+ y1 = e.c - e.a * x1;
+ x2 = s2 ? s2.x : 1e6;
+ y2 = e.c - e.a * x2;
+ }
+ var v1 = [ x1, y1 ], v2 = [ x2, y2 ];
+ polygons[e.region.l.index].push(v1, v2);
+ polygons[e.region.r.index].push(v1, v2);
+ });
+ return polygons.map(function(polygon, i) {
+ var cx = vertices[i][0], cy = vertices[i][1];
+ polygon.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ return polygon.sort(function(a, b) {
+ return a.angle - b.angle;
+ }).filter(function(d, i) {
+ return !i || d.angle - polygon[i - 1].angle > 1e-10;
+ });
+ });
+ };
+ var d3_voronoi_opposite = {
+ l: "r",
+ r: "l"
+ };
+ d3.geom.delaunay = function(vertices) {
+ var edges = vertices.map(function() {
+ return [];
+ }), triangles = [];
+ d3_voronoi_tessellate(vertices, function(e) {
+ edges[e.region.l.index].push(vertices[e.region.r.index]);
+ });
+ edges.forEach(function(edge, i) {
+ var v = vertices[i], cx = v[0], cy = v[1];
+ edge.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ edge.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ for (var j = 0, m = edge.length - 1; j < m; j++) {
+ triangles.push([ v, edge[j], edge[j + 1] ]);
+ }
+ });
+ return triangles;
+ };
+ d3.geom.quadtree = function(points, x1, y1, x2, y2) {
+ function insert(n, p, x1, y1, x2, y2) {
+ if (isNaN(p.x) || isNaN(p.y)) return;
+ if (n.leaf) {
+ var v = n.point;
+ if (v) {
+ if (Math.abs(v.x - p.x) + Math.abs(v.y - p.y) < .01) {
+ insertChild(n, p, x1, y1, x2, y2);
+ } else {
+ n.point = null;
+ insertChild(n, v, x1, y1, x2, y2);
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ } else {
+ n.point = p;
+ }
+ } else {
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ }
+ function insertChild(n, p, x1, y1, x2, y2) {
+ var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = p.x >= sx, bottom = p.y >= sy, i = (bottom << 1) + right;
+ n.leaf = false;
+ n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
+ if (right) x1 = sx; else x2 = sx;
+ if (bottom) y1 = sy; else y2 = sy;
+ insert(n, p, x1, y1, x2, y2);
+ }
+ var p, i = -1, n = points.length;
+ if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint);
+ if (arguments.length < 5) {
+ if (arguments.length === 3) {
+ y2 = x2 = y1;
+ y1 = x1;
+ } else {
+ x1 = y1 = Infinity;
+ x2 = y2 = -Infinity;
+ while (++i < n) {
+ p = points[i];
+ if (p.x < x1) x1 = p.x;
+ if (p.y < y1) y1 = p.y;
+ if (p.x > x2) x2 = p.x;
+ if (p.y > y2) y2 = p.y;
+ }
+ var dx = x2 - x1, dy = y2 - y1;
+ if (dx > dy) y2 = y1 + dx; else x2 = x1 + dy;
+ }
+ }
+ var root = d3_geom_quadtreeNode();
+ root.add = function(p) {
+ insert(root, p, x1, y1, x2, y2);
+ };
+ root.visit = function(f) {
+ d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
+ };
+ points.forEach(root.add);
+ return root;
+ };
+ d3.time = {};
+ var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
+ d3_time_utc.prototype = {
+ getDate: function() {
+ return this._.getUTCDate();
+ },
+ getDay: function() {
+ return this._.getUTCDay();
+ },
+ getFullYear: function() {
+ return this._.getUTCFullYear();
+ },
+ getHours: function() {
+ return this._.getUTCHours();
+ },
+ getMilliseconds: function() {
+ return this._.getUTCMilliseconds();
+ },
+ getMinutes: function() {
+ return this._.getUTCMinutes();
+ },
+ getMonth: function() {
+ return this._.getUTCMonth();
+ },
+ getSeconds: function() {
+ return this._.getUTCSeconds();
+ },
+ getTime: function() {
+ return this._.getTime();
+ },
+ getTimezoneOffset: function() {
+ return 0;
+ },
+ valueOf: function() {
+ return this._.valueOf();
+ },
+ setDate: function() {
+ d3_time_prototype.setUTCDate.apply(this._, arguments);
+ },
+ setDay: function() {
+ d3_time_prototype.setUTCDay.apply(this._, arguments);
+ },
+ setFullYear: function() {
+ d3_time_prototype.setUTCFullYear.apply(this._, arguments);
+ },
+ setHours: function() {
+ d3_time_prototype.setUTCHours.apply(this._, arguments);
+ },
+ setMilliseconds: function() {
+ d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);
+ },
+ setMinutes: function() {
+ d3_time_prototype.setUTCMinutes.apply(this._, arguments);
+ },
+ setMonth: function() {
+ d3_time_prototype.setUTCMonth.apply(this._, arguments);
+ },
+ setSeconds: function() {
+ d3_time_prototype.setUTCSeconds.apply(this._, arguments);
+ },
+ setTime: function() {
+ d3_time_prototype.setTime.apply(this._, arguments);
+ }
+ };
+ var d3_time_prototype = Date.prototype;
+ var d3_time_formatDateTime = "%a %b %e %H:%M:%S %Y", d3_time_formatDate = "%m/%d/%y", d3_time_formatTime = "%H:%M:%S";
+ var d3_time_days = d3_time_daySymbols, d3_time_dayAbbreviations = d3_time_days.map(d3_time_formatAbbreviate), d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = d3_time_months.map(d3_time_formatAbbreviate);
+ d3.time.format = function(template) {
+ function format(date) {
+ var string = [], i = -1, j = 0, c, f;
+ while (++i < n) {
+ if (template.charCodeAt(i) == 37) {
+ string.push(template.substring(j, i), (f = d3_time_formats[c = template.charAt(++i)]) ? f(date) : c);
+ j = i + 1;
+ }
+ }
+ string.push(template.substring(j, i));
+ return string.join("");
+ }
+ var n = template.length;
+ format.parse = function(string) {
+ var d = {
+ y: 1900,
+ m: 0,
+ d: 1,
+ H: 0,
+ M: 0,
+ S: 0,
+ L: 0
+ }, i = d3_time_parse(d, template, string, 0);
+ if (i != string.length) return null;
+ if ("p" in d) d.H = d.H % 12 + d.p * 12;
+ var date = new d3_time;
+ date.setFullYear(d.y, d.m, d.d);
+ date.setHours(d.H, d.M, d.S, d.L);
+ return date;
+ };
+ format.toString = function() {
+ return template;
+ };
+ return format;
+ };
+ var d3_time_zfill2 = d3.format("02d"), d3_time_zfill3 = d3.format("03d"), d3_time_zfill4 = d3.format("04d"), d3_time_sfill2 = d3.format("2d");
+ var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations);
+ var d3_time_formats = {
+ a: function(d) {
+ return d3_time_dayAbbreviations[d.getDay()];
+ },
+ A: function(d) {
+ return d3_time_days[d.getDay()];
+ },
+ b: function(d) {
+ return d3_time_monthAbbreviations[d.getMonth()];
+ },
+ B: function(d) {
+ return d3_time_months[d.getMonth()];
+ },
+ c: d3.time.format(d3_time_formatDateTime),
+ d: function(d) {
+ return d3_time_zfill2(d.getDate());
+ },
+ e: function(d) {
+ return d3_time_sfill2(d.getDate());
+ },
+ H: function(d) {
+ return d3_time_zfill2(d.getHours());
+ },
+ I: function(d) {
+ return d3_time_zfill2(d.getHours() % 12 || 12);
+ },
+ j: function(d) {
+ return d3_time_zfill3(1 + d3.time.dayOfYear(d));
+ },
+ L: function(d) {
+ return d3_time_zfill3(d.getMilliseconds());
+ },
+ m: function(d) {
+ return d3_time_zfill2(d.getMonth() + 1);
+ },
+ M: function(d) {
+ return d3_time_zfill2(d.getMinutes());
+ },
+ p: function(d) {
+ return d.getHours() >= 12 ? "PM" : "AM";
+ },
+ S: function(d) {
+ return d3_time_zfill2(d.getSeconds());
+ },
+ U: function(d) {
+ return d3_time_zfill2(d3.time.sundayOfYear(d));
+ },
+ w: function(d) {
+ return d.getDay();
+ },
+ W: function(d) {
+ return d3_time_zfill2(d3.time.mondayOfYear(d));
+ },
+ x: d3.time.format(d3_time_formatDate),
+ X: d3.time.format(d3_time_formatTime),
+ y: function(d) {
+ return d3_time_zfill2(d.getFullYear() % 100);
+ },
+ Y: function(d) {
+ return d3_time_zfill4(d.getFullYear() % 1e4);
+ },
+ Z: d3_time_zone,
+ "%": function(d) {
+ return "%";
+ }
+ };
+ var d3_time_parsers = {
+ a: d3_time_parseWeekdayAbbrev,
+ A: d3_time_parseWeekday,
+ b: d3_time_parseMonthAbbrev,
+ B: d3_time_parseMonth,
+ c: d3_time_parseLocaleFull,
+ d: d3_time_parseDay,
+ e: d3_time_parseDay,
+ H: d3_time_parseHour24,
+ I: d3_time_parseHour24,
+ L: d3_time_parseMilliseconds,
+ m: d3_time_parseMonthNumber,
+ M: d3_time_parseMinutes,
+ p: d3_time_parseAmPm,
+ S: d3_time_parseSeconds,
+ x: d3_time_parseLocaleDate,
+ X: d3_time_parseLocaleTime,
+ y: d3_time_parseYear,
+ Y: d3_time_parseFullYear
+ };
+ var d3_time_numberRe = /^\s*\d+/;
+ var d3_time_amPmLookup = d3.map({
+ am: 0,
+ pm: 1
+ });
+ d3.time.format.utc = function(template) {
+ function format(date) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time;
+ utc._ = date;
+ return local(utc);
+ } finally {
+ d3_time = Date;
+ }
+ }
+ var local = d3.time.format(template);
+ format.parse = function(string) {
+ try {
+ d3_time = d3_time_utc;
+ var date = local.parse(string);
+ return date && date._;
+ } finally {
+ d3_time = Date;
+ }
+ };
+ format.toString = local.toString;
+ return format;
+ };
+ var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
+ d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso;
+ d3_time_formatIsoNative.parse = function(string) {
+ var date = new Date(string);
+ return isNaN(date) ? null : date;
+ };
+ d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
+ d3.time.second = d3_time_interval(function(date) {
+ return new d3_time(Math.floor(date / 1e3) * 1e3);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 1e3);
+ }, function(date) {
+ return date.getSeconds();
+ });
+ d3.time.seconds = d3.time.second.range;
+ d3.time.seconds.utc = d3.time.second.utc.range;
+ d3.time.minute = d3_time_interval(function(date) {
+ return new d3_time(Math.floor(date / 6e4) * 6e4);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 6e4);
+ }, function(date) {
+ return date.getMinutes();
+ });
+ d3.time.minutes = d3.time.minute.range;
+ d3.time.minutes.utc = d3.time.minute.utc.range;
+ d3.time.hour = d3_time_interval(function(date) {
+ var timezone = date.getTimezoneOffset() / 60;
+ return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 36e5);
+ }, function(date) {
+ return date.getHours();
+ });
+ d3.time.hours = d3.time.hour.range;
+ d3.time.hours.utc = d3.time.hour.utc.range;
+ d3.time.day = d3_time_interval(function(date) {
+ var day = new d3_time(1970, 0);
+ day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
+ return day;
+ }, function(date, offset) {
+ date.setDate(date.getDate() + offset);
+ }, function(date) {
+ return date.getDate() - 1;
+ });
+ d3.time.days = d3.time.day.range;
+ d3.time.days.utc = d3.time.day.utc.range;
+ d3.time.dayOfYear = function(date) {
+ var year = d3.time.year(date);
+ return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
+ };
+ d3_time_daySymbols.forEach(function(day, i) {
+ day = day.toLowerCase();
+ i = 7 - i;
+ var interval = d3.time[day] = d3_time_interval(function(date) {
+ (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
+ return date;
+ }, function(date, offset) {
+ date.setDate(date.getDate() + Math.floor(offset) * 7);
+ }, function(date) {
+ var day = d3.time.year(date).getDay();
+ return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
+ });
+ d3.time[day + "s"] = interval.range;
+ d3.time[day + "s"].utc = interval.utc.range;
+ d3.time[day + "OfYear"] = function(date) {
+ var day = d3.time.year(date).getDay();
+ return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7);
+ };
+ });
+ d3.time.week = d3.time.sunday;
+ d3.time.weeks = d3.time.sunday.range;
+ d3.time.weeks.utc = d3.time.sunday.utc.range;
+ d3.time.weekOfYear = d3.time.sundayOfYear;
+ d3.time.month = d3_time_interval(function(date) {
+ date = d3.time.day(date);
+ date.setDate(1);
+ return date;
+ }, function(date, offset) {
+ date.setMonth(date.getMonth() + offset);
+ }, function(date) {
+ return date.getMonth();
+ });
+ d3.time.months = d3.time.month.range;
+ d3.time.months.utc = d3.time.month.utc.range;
+ d3.time.year = d3_time_interval(function(date) {
+ date = d3.time.day(date);
+ date.setMonth(0, 1);
+ return date;
+ }, function(date, offset) {
+ date.setFullYear(date.getFullYear() + offset);
+ }, function(date) {
+ return date.getFullYear();
+ });
+ d3.time.years = d3.time.year.range;
+ d3.time.years.utc = d3.time.year.utc.range;
+ var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];
+ var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ];
+ var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), function(d) {
+ return true;
+ } ], [ d3.time.format("%B"), function(d) {
+ return d.getMonth();
+ } ], [ d3.time.format("%b %d"), function(d) {
+ return d.getDate() != 1;
+ } ], [ d3.time.format("%a %d"), function(d) {
+ return d.getDay() && d.getDate() != 1;
+ } ], [ d3.time.format("%I %p"), function(d) {
+ return d.getHours();
+ } ], [ d3.time.format("%I:%M"), function(d) {
+ return d.getMinutes();
+ } ], [ d3.time.format(":%S"), function(d) {
+ return d.getSeconds();
+ } ], [ d3.time.format(".%L"), function(d) {
+ return d.getMilliseconds();
+ } ] ];
+ var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
+ d3_time_scaleLocalMethods.year = function(extent, m) {
+ return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);
+ };
+ d3.time.scale = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
+ };
+ var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
+ return [ m[0].utc, m[1] ];
+ });
+ var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), function(d) {
+ return true;
+ } ], [ d3.time.format.utc("%B"), function(d) {
+ return d.getUTCMonth();
+ } ], [ d3.time.format.utc("%b %d"), function(d) {
+ return d.getUTCDate() != 1;
+ } ], [ d3.time.format.utc("%a %d"), function(d) {
+ return d.getUTCDay() && d.getUTCDate() != 1;
+ } ], [ d3.time.format.utc("%I %p"), function(d) {
+ return d.getUTCHours();
+ } ], [ d3.time.format.utc("%I:%M"), function(d) {
+ return d.getUTCMinutes();
+ } ], [ d3.time.format.utc(":%S"), function(d) {
+ return d.getUTCSeconds();
+ } ], [ d3.time.format.utc(".%L"), function(d) {
+ return d.getUTCMilliseconds();
+ } ] ];
+ var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
+ d3_time_scaleUTCMethods.year = function(extent, m) {
+ return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);
+ };
+ d3.time.scale.utc = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
+ };
+})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v2.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v2.min.js
new file mode 100644
index 00000000..cc47f1ea
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v2.min.js
@@ -0,0 +1,4 @@
+(function(){function e(e,t){try{for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}catch(r){e.prototype=t}}function t(e){var t=-1,n=e.length,r=[];while(++t<n)r.push(e[t]);return r}function n(e){return Array.prototype.slice.call(e)}function r(){}function i(e){return e}function s(){return this}function o(){return!0}function u(e){return typeof e=="function"?e:function(){return e}}function a(e,t,n){return function(){var r=n.apply(t,arguments);return arguments.length?e:r}}function f(e){return e!=null&&!isNaN(e)}function l(e){return e.length}function c(e){return e==null}function h(e){return e.trim().replace(/\s+/g," ")}function p(e){var t=1;while(e*t%1)t*=10;return t}function d(){}function v(e){function t(){var t=n,r=-1,i=t.length,s;while(++r<i)(s=t[r].on)&&s.apply(this,arguments);return e}var n=[],i=new r;return t.on=function(t,r){var s=i.get(t),o;return arguments.length<2?s&&s.on:(s&&(s.on=null,n=n.slice(0,o=n.indexOf(s)).concat(n.slice(o+1)),i.remove(t)),r&&n.push(i.set(t,{on:r})),e)},t}function m(e,t){return t-(e?1+Math.floor(Math.log(e+Math.pow(10,1+Math.floor(Math.log(e)/Math.LN10)-t))/Math.LN10):1)}function g(e){return e+""}function y(e){var t=e.lastIndexOf("."),n=t>=0?e.substring(t):(t=e.length,""),r=[];while(t>0)r.push(e.substring(t-=3,t+3));return r.reverse().join(",")+n}function b(e,t){var n=Math.pow(10,Math.abs(8-t)*3);return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}function w(e){return function(t){return t<=0?0:t>=1?1:e(t)}}function E(e){return function(t){return 1-e(1-t)}}function S(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function x(e){return e}function T(e){return function(t){return Math.pow(t,e)}}function N(e){return 1-Math.cos(e*Math.PI/2)}function C(e){return Math.pow(2,10*(e-1))}function k(e){return 1-Math.sqrt(1-e*e)}function L(e,t){var n;return arguments.length<2&&(t=.45),arguments.length<1?(e=1,n=t/4):n=t/(2*Math.PI)*Math.asin(1/e),function(r){return 1+e*Math.pow(2,10*-r)*Math.sin((r-n)*2*Math.PI/t)}}function A(e){return e||(e=1.70158),function(t){return t*t*((e+1)*t-e)}}function O(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function M(){d3.event.stopPropagation(),d3.event.preventDefault()}function _(){var e=d3.event,t;while(t=e.sourceEvent)e=t;return e}function D(e){var t=new d,n=0,r=arguments.length;while(++n<r)t[arguments[n]]=v(t);return t.of=function(n,r){return function(i){try{var s=i.sourceEvent=d3.event;i.target=e,d3.event=i,t[i.type].apply(n,r)}finally{d3.event=s}}},t}function P(e){var t=[e.a,e.b],n=[e.c,e.d],r=B(t),i=H(t,n),s=B(j(n,t,-i))||0;t[0]*n[1]<n[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,i*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-n[0],n[1]))*fs,this.translate=[e.e,e.f],this.scale=[r,s],this.skew=s?Math.atan2(i,s)*fs:0}function H(e,t){return e[0]*t[0]+e[1]*t[1]}function B(e){var t=Math.sqrt(H(e,e));return t&&(e[0]/=t,e[1]/=t),t}function j(e,t,n){return e[0]+=n*t[0],e[1]+=n*t[1],e}function F(e){return e=="transform"?d3.interpolateTransform:d3.interpolate}function I(e,t){return t=t-(e=+e)?1/(t-e):0,function(n){return(n-e)*t}}function q(e,t){return t=t-(e=+e)?1/(t-e):0,function(n){return Math.max(0,Math.min(1,(n-e)*t))}}function R(e,t,n){return new U(e,t,n)}function U(e,t,n){this.r=e,this.g=t,this.b=n}function z(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function W(e,t,n){var r=0,i=0,s=0,o,u,a;o=/([a-z]+)\((.*)\)/i.exec(e);if(o){u=o[2].split(",");switch(o[1]){case"hsl":return n(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(J(u[0]),J(u[1]),J(u[2]))}}return(a=hs.get(e))?t(a.r,a.g,a.b):(e!=null&&e.charAt(0)==="#"&&(e.length===4?(r=e.charAt(1),r+=r,i=e.charAt(2),i+=i,s=e.charAt(3),s+=s):e.length===7&&(r=e.substring(1,3),i=e.substring(3,5),s=e.substring(5,7)),r=parseInt(r,16),i=parseInt(i,16),s=parseInt(s,16)),t(r,i,s))}function X(e,t,n){var r=Math.min(e/=255,t/=255,n/=255),i=Math.max(e,t,n),s=i-r,o,u,a=(i+r)/2;return s?(u=a<.5?s/(i+r):s/(2-i-r),e==i?o=(t-n)/s+(t<n?6:0):t==i?o=(n-e)/s+2:o=(e-t)/s+4,o*=60):u=o=0,K(o,u,a)}function V(e,t,n){e=$(e),t=$(t),n=$(n);var r=ot((.4124564*e+.3575761*t+.1804375*n)/ds),i=ot((.2126729*e+.7151522*t+.072175*n)/vs),s=ot((.0193339*e+.119192*t+.9503041*n)/ms);return tt(116*i-16,500*(r-i),200*(i-s))}function $(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function J(e){var t=parseFloat(e);return e.charAt(e.length-1)==="%"?Math.round(t*2.55):t}function K(e,t,n){return new Q(e,t,n)}function Q(e,t,n){this.h=e,this.s=t,this.l=n}function G(e,t,n){function r(e){return e>360?e-=360:e<0&&(e+=360),e<60?s+(o-s)*e/60:e<180?o:e<240?s+(o-s)*(240-e)/60:s}function i(e){return Math.round(r(e)*255)}var s,o;return e%=360,e<0&&(e+=360),t=t<0?0:t>1?1:t,n=n<0?0:n>1?1:n,o=n<=.5?n*(1+t):n+t-n*t,s=2*n-o,R(i(e+120),i(e),i(e-120))}function Y(e,t,n){return new Z(e,t,n)}function Z(e,t,n){this.h=e,this.c=t,this.l=n}function et(e,t,n){return tt(n,Math.cos(e*=Math.PI/180)*t,Math.sin(e)*t)}function tt(e,t,n){return new nt(e,t,n)}function nt(e,t,n){this.l=e,this.a=t,this.b=n}function rt(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;return i=st(i)*ds,r=st(r)*vs,s=st(s)*ms,R(ut(3.2404542*i-1.5371385*r-.4985314*s),ut(-0.969266*i+1.8760108*r+.041556*s),ut(.0556434*i-.2040259*r+1.0572252*s))}function it(e,t,n){return Y(Math.atan2(n,t)/Math.PI*180,Math.sqrt(t*t+n*n),e)}function st(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function ot(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function ut(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function at(e){return Ki(e,Ss),e}function ft(e){return function(){return gs(e,this)}}function lt(e){return function(){return ys(e,this)}}function ct(e,t){function n(){this.removeAttribute(e)}function r(){this.removeAttributeNS(e.space,e.local)}function i(){this.setAttribute(e,t)}function s(){this.setAttributeNS(e.space,e.local,t)}function o(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}function u(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}return e=d3.ns.qualify(e),t==null?e.local?r:n:typeof t=="function"?e.local?u:o:e.local?s:i}function ht(e){return new RegExp("(?:^|\\s+)"+d3.requote(e)+"(?:\\s+|$)","g")}function pt(e,t){function n(){var n=-1;while(++n<i)e[n](this,t)}function r(){var n=-1,r=t.apply(this,arguments);while(++n<i)e[n](this,r)}e=e.trim().split(/\s+/).map(dt);var i=e.length;return typeof t=="function"?r:n}function dt(e){var t=ht(e);return function(n,r){if(i=n.classList)return r?i.add(e):i.remove(e);var i=n.className,s=i.baseVal!=null,o=s?i.baseVal:i;r?(t.lastIndex=0,t.test(o)||(o=h(o+" "+e),s?i.baseVal=o:n.className=o)):o&&(o=h(o.replace(t," ")),s?i.baseVal=o:n.className=o)}}function vt(e,t,n){function r(){this.style.removeProperty(e)}function i(){this.style.setProperty(e,t,n)}function s(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}return t==null?r:typeof t=="function"?s:i}function mt(e,t){function n(){delete this[e]}function r(){this[e]=t}function i(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}return t==null?n:typeof t=="function"?i:r}function gt(e){return{__data__:e}}function yt(e){return function(){return Es(this,e)}}function bt(e){return arguments.length||(e=d3.ascending),function(t,n){return e(t&&t.__data__,n&&n.__data__)}}function wt(e,t,n){function r(){var t=this[s];t&&(this.removeEventListener(e,t,t.$),delete this[s])}function i(){function i(e){var n=d3.event;d3.event=e,u[0]=o.__data__;try{t.apply(o,u)}finally{d3.event=n}}var o=this,u=arguments;r.call(this),this.addEventListener(e,this[s]=i,i.$=n),i._=t}var s="__on"+e,o=e.indexOf(".");return o>0&&(e=e.substring(0,o)),t?i:r}function Et(e,t){for(var n=0,r=e.length;n<r;n++)for(var i=e[n],s=0,o=i.length,u;s<o;s++)(u=i[s])&&t(u,s,n);return e}function St(e){return Ki(e,Ts),e}function xt(e,t,n){Ki(e,Ns);var i=new r,s=d3.dispatch("start","end"),o=Ds;return e.id=t,e.time=n,e.tween=function(t,n){return arguments.length<2?i.get(t):(n==null?i.remove(t):i.set(t,n),e)},e.ease=function(t){return arguments.length?(o=typeof t=="function"?t:d3.ease.apply(d3,arguments),e):o},e.each=function(t,n){return arguments.length<2?Tt.call(e,t):(s.on(t,n),e)},d3.timer(function(r){return Et(e,function(e,u,a){function f(r){return v.active>t?c():(v.active=t,i.forEach(function(t,n){(n=n.call(e,m,u))&&h.push(n)}),s.start.call(e,m,u),l(r)||d3.timer(l,0,n),1)}function l(n){if(v.active!==t)return c();var r=(n-p)/d,i=o(r),a=h.length;while(a>0)h[--a].call(e,i);if(r>=1)return c(),ks=t,s.end.call(e,m,u),ks=0,1}function c(){return--v.count||delete e.__transition__,1}var h=[],p=e.delay,d=e.duration,v=(e=e.node).__transition__||(e.__transition__={active:0,count:0}),m=e.__data__;++v.count,p<=r?f(r):d3.timer(f,p,n)})},0,n),e}function Tt(e){var t=ks,n=Ds,r=Ms,i=_s;return ks=this.id,Ds=this.ease(),Et(this,function(t,n,r){Ms=t.delay,_s=t.duration,e.call(t=t.node,t.__data__,n,r)}),ks=t,Ds=n,Ms=r,_s=i,this}function Nt(e,t,n){return n!=""&&Ps}function Ct(e,t){return d3.tween(e,F(t))}function kt(){var e,t=Date.now(),n=Hs;while(n)e=t-n.then,e>=n.delay&&(n.flush=n.callback(e)),n=n.next;var r=Lt()-t;r>24?(isFinite(r)&&(clearTimeout(js),js=setTimeout(kt,r)),Bs=0):(Bs=1,Fs(kt))}function Lt(){var e=null,t=Hs,n=Infinity;while(t)t.flush?t=e?e.next=t.next:Hs=t.next:(n=Math.min(n,t.then+t.delay),t=(e=t).next);return n}function At(e,t){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();if(Is<0&&(window.scrollX||window.scrollY)){n=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0);var i=n[0][0].getScreenCTM();Is=!i.f&&!i.e,n.remove()}return Is?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}function Ot(){}function Mt(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function _t(e){return e.rangeExtent?e.rangeExtent():Mt(e.range())}function Dt(e,t){var n=0,r=e.length-1,i=e[n],s=e[r],o;s<i&&(o=n,n=r,r=o,o=i,i=s,s=o);if(t=t(s-i))e[n]=t.floor(i),e[r]=t.ceil(s);return e}function Pt(){return Math}function Ht(e,t,n,r){function i(){var i=Math.min(e.length,t.length)>2?Ut:Rt,a=r?q:I;return o=i(e,t,a,n),u=i(t,e,a,d3.interpolate),s}function s(e){return o(e)}var o,u;return s.invert=function(e){return u(e)},s.domain=function(t){return arguments.length?(e=t.map(Number),i()):e},s.range=function(e){return arguments.length?(t=e,i()):t},s.rangeRound=function(e){return s.range(e).interpolate(d3.interpolateRound)},s.clamp=function(e){return arguments.length?(r=e,i()):r},s.interpolate=function(e){return arguments.length?(n=e,i()):n},s.ticks=function(t){return It(e,t)},s.tickFormat=function(t){return qt(e,t)},s.nice=function(){return Dt(e,jt),i()},s.copy=function(){return Ht(e,t,n,r)},i()}function Bt(e,t){return d3.rebind(e,t,"range","rangeRound","interpolate","clamp")}function jt(e){return e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1),e&&{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}}function Ft(e,t){var n=Mt(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;return s<=.15?i*=10:s<=.35?i*=5:s<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+i*.5,n[2]=i,n}function It(e,t){return d3.range.apply(d3,Ft(e,t))}function qt(e,t){return d3.format(",."+Math.max(0,-Math.floor(Math.log(Ft(e,t)[2])/Math.LN10+.01))+"f")}function Rt(e,t,n,r){var i=n(e[0],e[1]),s=r(t[0],t[1]);return function(e){return s(i(e))}}function Ut(e,t,n,r){var i=[],s=[],o=0,u=Math.min(e.length,t.length)-1;e[u]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());while(++o<=u)i.push(n(e[o-1],e[o])),s.push(r(t[o-1],t[o]));return function(t){var n=d3.bisect(e,t,1,u)-1;return s[n](i[n](t))}}function zt(e,t){function n(n){return e(t(n))}var r=t.pow;return n.invert=function(t){return r(e.invert(t))},n.domain=function(i){return arguments.length?(t=i[0]<0?Xt:Wt,r=t.pow,e.domain(i.map(t)),n):e.domain().map(r)},n.nice=function(){return e.domain(Dt(e.domain(),Pt)),n},n.ticks=function(){var n=Mt(e.domain()),i=[];if(n.every(isFinite)){var s=Math.floor(n[0]),o=Math.ceil(n[1]),u=r(n[0]),a=r(n[1]);if(t===Xt){i.push(r(s));for(;s++<o;)for(var f=9;f>0;f--)i.push(r(s)*f)}else{for(;s<o;s++)for(var f=1;f<10;f++)i.push(r(s)*f);i.push(r(s))}for(s=0;i[s]<u;s++);for(o=i.length;i[o-1]>a;o--);i=i.slice(s,o)}return i},n.tickFormat=function(e,i){arguments.length<2&&(i=qs);if(arguments.length<1)return i;var s=Math.max(.1,e/n.ticks().length),o=t===Xt?(u=-1e-12,Math.floor):(u=1e-12,Math.ceil),u;return function(e){return e/r(o(t(e)+u))<=s?i(e):""}},n.copy=function(){return zt(e.copy(),t)},Bt(n,e)}function Wt(e){return Math.log(e<0?0:e)/Math.LN10}function Xt(e){return-Math.log(e>0?0:-e)/Math.LN10}function Vt(e,t){function n(t){return e(r(t))}var r=$t(t),i=$t(1/t);return n.invert=function(t){return i(e.invert(t))},n.domain=function(t){return arguments.length?(e.domain(t.map(r)),n):e.domain().map(i)},n.ticks=function(e){return It(n.domain(),e)},n.tickFormat=function(e){return qt(n.domain(),e)},n.nice=function(){return n.domain(Dt(n.domain(),jt))},n.exponent=function(e){if(!arguments.length)return t;var s=n.domain();return r=$t(t=e),i=$t(1/t),n.domain(s)},n.copy=function(){return Vt(e.copy(),t)},Bt(n,e)}function $t(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Jt(e,t){function n(t){return o[((s.get(t)||s.set(t,e.push(t)))-1)%o.length]}function i(t,n){return d3.range(e.length).map(function(e){return t+n*e})}var s,o,u;return n.domain=function(i){if(!arguments.length)return e;e=[],s=new r;var o=-1,u=i.length,a;while(++o<u)s.has(a=i[o])||s.set(a,e.push(a));return n[t.t].apply(n,t.a)},n.range=function(e){return arguments.length?(o=e,u=0,t={t:"range",a:arguments},n):o},n.rangePoints=function(r,s){arguments.length<2&&(s=0);var a=r[0],f=r[1],l=(f-a)/(Math.max(1,e.length-1)+s);return o=i(e.length<2?(a+f)/2:a+l*s/2,l),u=0,t={t:"rangePoints",a:arguments},n},n.rangeBands=function(r,s,a){arguments.length<2&&(s=0),arguments.length<3&&(a=s);var f=r[1]<r[0],l=r[f-0],c=r[1-f],h=(c-l)/(e.length-s+2*a);return o=i(l+h*a,h),f&&o.reverse(),u=h*(1-s),t={t:"rangeBands",a:arguments},n},n.rangeRoundBands=function(r,s,a){arguments.length<2&&(s=0),arguments.length<3&&(a=s);var f=r[1]<r[0],l=r[f-0],c=r[1-f],h=Math.floor((c-l)/(e.length-s+2*a)),p=c-l-(e.length-s)*h;return o=i(l+Math.round(p/2),h),f&&o.reverse(),u=Math.round(h*(1-s)),t={t:"rangeRoundBands",a:arguments},n},n.rangeBand=function(){return u},n.rangeExtent=function(){return Mt(t.a[0])},n.copy=function(){return Jt(e,t)},n.domain(e)}function Kt(e,t){function n(){var n=0,s=e.length,o=t.length;i=[];while(++n<o)i[n-1]=d3.quantile(e,n/o);return r}function r(e){return isNaN(e=+e)?NaN:t[d3.bisect(i,e)]}var i;return r.domain=function(t){return arguments.length?(e=t.filter(function(e){return!isNaN(e)}).sort(d3.ascending),n()):e},r.range=function(e){return arguments.length?(t=e,n()):t},r.quantiles=function(){return i},r.copy=function(){return Kt(e,t)},n()}function Qt(e,t,n){function r(t){return n[Math.max(0,Math.min(o,Math.floor(s*(t-e))))]}function i(){return s=n.length/(t-e),o=n.length-1,r}var s,o;return r.domain=function(n){return arguments.length?(e=+n[0],t=+n[n.length-1],i()):[e,t]},r.range=function(e){return arguments.length?(n=e,i()):n},r.copy=function(){return Qt(e,t,n)},i()}function Gt(e,t){function n(n){return t[d3.bisect(e,n)]}return n.domain=function(t){return arguments.length?(e=t,n):e},n.range=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return Gt(e,t)},n}function Yt(e){function t(e){return+e}return t.invert=t,t.domain=t.range=function(n){return arguments.length?(e=n.map(t),t):e},t.ticks=function(t){return It(e,t)},t.tickFormat=function(t){return qt(e,t)},t.copy=function(){return Yt(e)},t}function Zt(e){return e.innerRadius}function en(e){return e.outerRadius}function tn(e){return e.startAngle}function nn(e){return e.endAngle}function rn(e){function t(t){function o(){a.push("M",s(e(l),f))}var a=[],l=[],c=-1,h=t.length,p,d=u(n),v=u(r);while(++c<h)i.call(this,p=t[c],c)?l.push([+d.call(this,p,c),+v.call(this,p,c)]):l.length&&(o(),l=[]);return l.length&&o(),a.length?a.join(""):null}var n=sn,r=on,i=o,s=un,a=s.key,f=.7;return t.x=function(e){return arguments.length?(n=e,t):n},t.y=function(e){return arguments.length?(r=e,t):r},t.defined=function(e){return arguments.length?(i=e,t):i},t.interpolate=function(e){return arguments.length?(typeof e=="function"?a=s=e:a=(s=$s.get(e)||un).key,t):a},t.tension=function(e){return arguments.length?(f=e,t):f},t}function sn(e){return e[0]}function on(e){return e[1]}function un(e){return e.join("L")}function an(e){return un(e)+"Z"}function fn(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("V",(r=e[t])[1],"H",r[0]);return i.join("")}function ln(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("H",(r=e[t])[0],"V",r[1]);return i.join("")}function cn(e,t){return e.length<4?un(e):e[1]+dn(e.slice(1,e.length-1),vn(e,t))}function hn(e,t){return e.length<3?un(e):e[0]+dn((e.push(e[0]),e),vn([e[e.length-2]].concat(e,[e[1]]),t))}function pn(e,t,n){return e.length<3?un(e):e[0]+dn(e,vn(e,t))}function dn(e,t){if(t.length<1||e.length!=t.length&&e.length!=t.length+2)return un(e);var n=e.length!=t.length,r="",i=e[0],s=e[1],o=t[0],u=o,a=1;n&&(r+="Q"+(s[0]-o[0]*2/3)+","+(s[1]-o[1]*2/3)+","+s[0]+","+s[1],i=e[1],a=2);if(t.length>1){u=t[1],s=e[a],a++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f<t.length;f++,a++)s=e[a],u=t[f],r+="S"+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1]}if(n){var l=e[a];r+="Q"+(s[0]+u[0]*2/3)+","+(s[1]+u[1]*2/3)+","+l[0]+","+l[1]}return r}function vn(e,t){var n=[],r=(1-t)/2,i,s=e[0],o=e[1],u=1,a=e.length;while(++u<a)i=s,s=o,o=e[u],n.push([r*(o[0]-i[0]),r*(o[1]-i[1])]);return n}function mn(e){if(e.length<3)return un(e);var t=1,n=e.length,r=e[0],i=r[0],s=r[1],o=[i,i,i,(r=e[1])[0]],u=[s,s,s,r[1]],a=[i,",",s];En(a,o,u);while(++t<n)r=e[t],o.shift(),o.push(r[0]),u.shift(),u.push(r[1]),En(a,o,u);t=-1;while(++t<2)o.shift(),o.push(r[0]),u.shift(),u.push(r[1]),En(a,o,u);return a.join("")}function gn(e){if(e.length<4)return un(e);var t=[],n=-1,r=e.length,i,s=[0],o=[0];while(++n<3)i=e[n],s.push(i[0]),o.push(i[1]);t.push(wn(Qs,s)+","+wn(Qs,o)),--n;while(++n<r)i=e[n],s.shift(),s.push(i[0]),o.shift(),o.push(i[1]),En(t,s,o);return t.join("")}function yn(e){var t,n=-1,r=e.length,i=r+4,s,o=[],u=[];while(++n<4)s=e[n%r],o.push(s[0]),u.push(s[1]);t=[wn(Qs,o),",",wn(Qs,u)],--n;while(++n<i)s=e[n%r],o.shift(),o.push(s[0]),u.shift(),u.push(s[1]),En(t,o,u);return t.join("")}function bn(e,t){var n=e.length-1;if(n){var r=e[0][0],i=e[0][1],s=e[n][0]-r,o=e[n][1]-i,u=-1,a,f;while(++u<=n)a=e[u],f=u/n,a[0]=t*a[0]+(1-t)*(r+f*s),a[1]=t*a[1]+(1-t)*(i+f*o)}return mn(e)}function wn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function En(e,t,n){e.push("C",wn(Js,t),",",wn(Js,n),",",wn(Ks,t),",",wn(Ks,n),",",wn(Qs,t),",",wn(Qs,n))}function Sn(e,t){return(t[1]-e[1])/(t[0]-e[0])}function xn(e){var t=0,n=e.length-1,r=[],i=e[0],s=e[1],o=r[0]=Sn(i,s);while(++t<n)r[t]=(o+(o=Sn(i=s,s=e[t+1])))/2;return r[t]=o,r}function Tn(e){var t=[],n,r,i,s,o=xn(e),u=-1,a=e.length-1;while(++u<a)n=Sn(e[u],e[u+1]),Math.abs(n)<1e-6?o[u]=o[u+1]=0:(r=o[u]/n,i=o[u+1]/n,s=r*r+i*i,s>9&&(s=n*3/Math.sqrt(s),o[u]=s*r,o[u+1]=s*i));u=-1;while(++u<=a)s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u])),t.push([s||0,o[u]*s||0]);return t}function Nn(e){return e.length<3?un(e):e[0]+dn(e,Tn(e))}function Cn(e){var t,n=-1,r=e.length,i,s;while(++n<r)t=e[n],i=t[0],s=t[1]+Xs,t[0]=i*Math.cos(s),t[1]=i*Math.sin(s);return e}function kn(e){function t(t){function o(){l.push("M",f(e(v),p),h,c(e(d.reverse()),p),"Z")}var l=[],d=[],v=[],m=-1,g=t.length,y,b=u(n),w=u(i),E=n===r?function(){return x}:u(r),S=i===s?function(){return T}:u(s),x,T;while(++m<g)a.call(this,y=t[m],m)?(d.push([x=+b.call(this,y,m),T=+w.call(this,y,m)]),v.push([+E.call(this,y,m),+S.call(this,y,m)])):d.length&&(o(),d=[],v=[]);return d.length&&o(),l.length?l.join(""):null}var n=sn,r=sn,i=0,s=on,a=o,f=un,l=f.key,c=f,h="L",p=.7;return t.x=function(e){return arguments.length?(n=r=e,t):r},t.x0=function(e){return arguments.length?(n=e,t):n},t.x1=function(e){return arguments.length?(r=e,t):r},t.y=function(e){return arguments.length?(i=s=e,t):s},t.y0=function(e){return arguments.length?(i=e,t):i},t.y1=function(e){return arguments.length?(s=e,t):s},t.defined=function(e){return arguments.length?(a=e,t):a},t.interpolate=function(e){return arguments.length?(typeof e=="function"?l=f=e:l=(f=$s.get(e)||un).key,c=f.reverse||f,h=f.closed?"M":"L",t):l},t.tension=function(e){return arguments.length?(p=e,t):p},t}function Ln(e){return e.source}function An(e){return e.target}function On(e){return e.radius}function Mn(e){return e.startAngle}function _n(e){return e.endAngle}function Dn(e){return[e.x,e.y]}function Pn(e){return function(){var t=e.apply(this,arguments),n=t[0],r=t[1]+Xs;return[n*Math.cos(r),n*Math.sin(r)]}}function Hn(){return 64}function Bn(){return"circle"}function jn(e){var t=Math.sqrt(e/Math.PI);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+ -t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function Fn(e,t){e.attr("transform",function(e){return"translate("+t(e)+",0)"})}function In(e,t){e.attr("transform",function(e){return"translate(0,"+t(e)+")"})}function qn(e,t,n){i=[];if(n&&t.length>1){var r=Mt(e.domain()),i,s=-1,o=t.length,u=(t[1]-t[0])/++n,a,f;while(++s<o)for(a=n;--a>0;)(f=+t[s]-a*u)>=r[0]&&i.push(f);for(--s,a=0;++a<n&&(f=+t[s]+a*u)<r[1];)i.push(f)}return i}function Rn(){no||(no=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var e=d3.event,t;try{no.scrollTop=1e3,no.dispatchEvent(e),t=1e3-no.scrollTop}catch(n){t=e.wheelDelta||-e.detail*5}return t}function Un(e){var t=e.source,n=e.target,r=Wn(t,n),i=[t];while(t!==r)t=t.parent,i.push(t);var s=i.length;while(n!==r)i.splice(s,0,n),n=n.parent;return i}function zn(e){var t=[],n=e.parent;while(n!=null)t.push(e),e=n,n=n.parent;return t.push(e),t}function Wn(e,t){if(e===t)return e;var n=zn(e),r=zn(t),i=n.pop(),s=r.pop(),o=null;while(i===s)o=i,i=n.pop(),s=r.pop();return o}function Xn(e){e.fixed|=2}function Vn(e){e.fixed&=1}function $n(e){e.fixed|=4}function Jn(e){e.fixed&=3}function Kn(e,t,n){var r=0,i=0;e.charge=0;if(!e.leaf){var s=e.nodes,o=s.length,u=-1,a;while(++u<o){a=s[u];if(a==null)continue;Kn(a,t,n),e.charge+=a.charge,r+=a.charge*a.cx,i+=a.charge*a.cy}}if(e.point){e.leaf||(e.point.x+=Math.random()-.5,e.point.y+=Math.random()-.5);var f=t*n[e.point.index];e.charge+=e.pointCharge=f,r+=f*e.point.x,i+=f*e.point.y}e.cx=r/e.charge,e.cy=i/e.charge}function Qn(e){return 20}function Gn(e){return 1}function Yn(e){return e.x}function Zn(e){return e.y}function er(e,t,n){e.y0=t,e.y=n}function tr(e){return d3.range(e.length)}function nr(e){var t=-1,n=e[0].length,r=[];while(++t<n)r[t]=0;return r}function rr(e){var t=1,n=0,r=e[0][1],i,s=e.length;for(;t<s;++t)(i=e[t][1])>r&&(n=t,r=i);return n}function ir(e){return e.reduce(sr,0)}function sr(e,t){return e+t[1]}function or(e,t){return ur(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function ur(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function ar(e){return[d3.min(e),d3.max(e)]}function fr(e,t){return d3.rebind(e,t,"sort","children","value"),e.links=pr,e.nodes=function(t){return uo=!0,(e.nodes=e)(t)},e}function lr(e){return e.children}function cr(e){return e.value}function hr(e,t){return t.value-e.value}function pr(e){return d3.merge(e.map(function(e){return(e.children||[]).map(function(t){return{source:e,target:t}})}))}function dr(e,t){return e.value-t.value}function vr(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function mr(e,t){e._pack_next=t,t._pack_prev=e}function gr(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return i*i-n*n-r*r>.001}function yr(e){function t(e){r=Math.min(e.x-e.r,r),i=Math.max(e.x+e.r,i),s=Math.min(e.y-e.r,s),o=Math.max(e.y+e.r,o)}if(!(n=e.children)||!(p=n.length))return;var n,r=Infinity,i=-Infinity,s=Infinity,o=-Infinity,u,a,f,l,c,h,p;n.forEach(br),u=n[0],u.x=-u.r,u.y=0,t(u);if(p>1){a=n[1],a.x=a.r,a.y=0,t(a);if(p>2){f=n[2],Sr(u,a,f),t(f),vr(u,f),u._pack_prev=f,vr(f,a),a=u._pack_next;for(l=3;l<p;l++){Sr(u,a,f=n[l]);var d=0,v=1,m=1;for(c=a._pack_next;c!==a;c=c._pack_next,v++)if(gr(c,f)){d=1;break}if(d==1)for(h=u._pack_prev;h!==c._pack_prev;h=h._pack_prev,m++)if(gr(h,f))break;d?(v<m||v==m&&a.r<u.r?mr(u,a=c):mr(u=h,a),l--):(vr(u,f),a=f,t(f))}}}var g=(r+i)/2,y=(s+o)/2,b=0;for(l=0;l<p;l++)f=n[l],f.x-=g,f.y-=y,b=Math.max(b,f.r+Math.sqrt(f.x*f.x+f.y*f.y));e.r=b,n.forEach(wr)}function br(e){e._pack_next=e._pack_prev=e}function wr(e){delete e._pack_next,delete e._pack_prev}function Er(e,t,n,r){var i=e.children;e.x=t+=r*e.x,e.y=n+=r*e.y,e.r*=r;if(i){var s=-1,o=i.length;while(++s<o)Er(i[s],t,n,r)}}function Sr(e,t,n){var r=e.r+n.r,i=t.x-e.x,s=t.y-e.y;if(r&&(i||s)){var o=t.r+n.r,u=i*i+s*s;o*=o,r*=r;var a=.5+(r-o)/(2*u),f=Math.sqrt(Math.max(0,2*o*(r+u)-(r-=u)*r-o*o))/(2*u);n.x=e.x+a*i+f*s,n.y=e.y+a*s-f*i}else n.x=e.x+r,n.y=e.y}function xr(e){return 1+d3.max(e,function(e){return e.y})}function Tr(e){return e.reduce(function(e,t){return e+t.x},0)/e.length}function Nr(e){var t=e.children;return t&&t.length?Nr(t[0]):e}function Cr(e){var t=e.children,n;return t&&(n=t.length)?Cr(t[n-1]):e}function kr(e,t){return e.parent==t.parent?1:2}function Lr(e){var t=e.children;return t&&t.length?t[0]:e._tree.thread}function Ar(e){var t=e.children,n;return t&&(n=t.length)?t[n-1]:e._tree.thread}function Or(e,t){var n=e.children;if(n&&(i=n.length)){var r,i,s=-1;while(++s<i)t(r=Or(n[s],t),e)>0&&(e=r)}return e}function Mr(e,t){return e.x-t.x}function _r(e,t){return t.x-e.x}function Dr(e,t){return e.depth-t.depth}function Pr(e,t){function n(e,r){var i=e.children;if(i&&(a=i.length)){var s,o=null,u=-1,a;while(++u<a)s=i[u],n(s,o),o=s}t(e,r)}n(e,null)}function Hr(e){var t=0,n=0,r=e.children,i=r.length,s;while(--i>=0)s=r[i]._tree,s.prelim+=t,s.mod+=t,t+=s.shift+(n+=s.change)}function Br(e,t,n){e=e._tree,t=t._tree;var r=n/(t.number-e.number);e.change+=r,t.change-=r,t.shift+=n,t.prelim+=n,t.mod+=n}function jr(e,t,n){return e._tree.ancestor.parent==t.parent?e._tree.ancestor:n}function Fr(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function Ir(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],s=e.dy-t[0]-t[2];return i<0&&(n+=i/2,i=0),s<0&&(r+=s/2,s=0),{x:n,y:r,dx:i,dy:s}}function qr(e,t){function n(e,r){d3.text(e,t,function(e){r(e&&n.parse(e))})}function r(t){return t.map(i).join(e)}function i(e){return o.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var s=new RegExp("\r\n|["+e+"\r\n]","g"),o=new RegExp('["'+e+"\n]"),u=e.charCodeAt(0);return n.parse=function(e){var t;return n.parseRows(e,function(e,n){if(n){var r={},i=-1,s=t.length;while(++i<s)r[t[i]]=e[i];return r}return t=e,null})},n.parseRows=function(e,t){function n(){if(s.lastIndex>=e.length)return i;if(l)return l=!1,r;var t=s.lastIndex;if(e.charCodeAt(t)===34){var n=t;while(n++<e.length)if(e.charCodeAt(n)===34){if(e.charCodeAt(n+1)!==34)break;n++}s.lastIndex=n+2;var o=e.charCodeAt(n+1);return o===13?(l=!0,e.charCodeAt(n+2)===10&&s.lastIndex++):o===10&&(l=!0),e.substring(t+1,n).replace(/""/g,'"')}var a=s.exec(e);return a?(l=a[0].charCodeAt(0)!==u,e.substring(t,a.index)):(s.lastIndex=e.length,e.substring(t))}var r={},i={},o=[],a=0,f,l;s.lastIndex=0;while((f=n())!==i){var c=[];while(f!==r&&f!==i)c.push(f),f=n();if(t&&!(c=t(c,a++)))continue;o.push(c)}return o},n.format=function(e){return e.map(r).join("\n")},n}function Rr(e,t){return function(n){return n&&e.hasOwnProperty(n.type)?e[n.type](n):t}}function Ur(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+ -2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}function zr(e,t){fo.hasOwnProperty(e.type)&&fo[e.type](e,t)}function Wr(e,t){zr(e.geometry,t)}function Xr(e,t){for(var n=e.features,r=0,i=n.length;r<i;r++)zr(n[r].geometry,t)}function Vr(e,t){for(var n=e.geometries,r=0,i=n.length;r<i;r++)zr(n[r],t)}function $r(e,t){for(var n=e.coordinates,r=0,i=n.length;r<i;r++)t.apply(null,n[r])}function Jr(e,t){for(var n=e.coordinates,r=0,i=n.length;r<i;r++)for(var s=n[r],o=0,u=s.length;o<u;o++)t.apply(null,s[o])}function Kr(e,t){for(var n=e.coordinates,r=0,i=n.length;r<i;r++)for(var s=n[r][0],o=0,u=s.length;o<u;o++)t.apply(null,s[o])}function Qr(e,t){t.apply(null,e.coordinates)}function Gr(e,t){for(var n=e.coordinates[0],r=0,i=n.length;r<i;r++)t.apply(null,n[r])}function Yr(e){return e.source}function Zr(e){return e.target}function ei(){function e(e){var t=Math.sin(e*=p)*d,n=Math.sin(p-e)*d,r=n*s+t*c,u=n*o+t*h,a=n*i+t*l;return[Math.atan2(u,r)/ao,Math.atan2(a,Math.sqrt(r*r+u*u))/ao]}var t,n,r,i,s,o,u,a,f,l,c,h,p,d;return e.distance=function(){return p==null&&(d=1/Math.sin(p=Math.acos(Math.max(-1,Math.min(1,i*l+r*f*Math.cos(u-t)))))),p},e.source=function(u){var a=Math.cos(t=u[0]*ao),f=Math.sin(t);return r=Math.cos(n=u[1]*ao),i=Math.sin(n),s=r*a,o=r*f,p=null,e},e.target=function(t){var n=Math.cos(u=t[0]*ao),r=Math.sin(u);return f=Math.cos(a=t[1]*ao),l=Math.sin(a),c=f*n,h=f*r,p=null,e},e}function ti(e,t){var n=ei().source(e).target(t);return n.distance(),n}function ni(e){var t=0,n=0;for(;;){if(e(t,n))return[t,n];t===0?(t=n+1,n=0):(t-=1,n+=1)}}function ri(e,t,n,r){var i,s,o,u,a,f,l;return i=r[e],s=i[0],o=i[1],i=r[t],u=i[0],a=i[1],i=r[n],f=i[0],l=i[1],(l-o)*(u-s)-(a-o)*(f-s)>0}function ii(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function si(e,t,n,r){var i=e[0],s=t[0],o=n[0],u=r[0],a=e[1],f=t[1],l=n[1],c=r[1],h=i-o,p=s-i,d=u-o,v=a-l,m=f-a,g=c-l,y=(d*v-g*h)/(g*p-d*m);return[i+y*p,a+y*m]}function oi(e,t){var n={list:e.map(function(e,t){return{index:t,x:e[0],y:e[1]}}).sort(function(e,t){return e.y<t.y?-1:e.y>t.y?1:e.x<t.x?-1:e.x>t.x?1:0}),bottomSite:null},r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l"),r.rightEnd=r.createHalfEdge(null,"l"),r.leftEnd.r=r.rightEnd,r.rightEnd.l=r.leftEnd,r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(e,t){return{edge:e,side:t,vertex:null,l:null,r:null}},insert:function(e,t){t.l=e,t.r=e.r,e.r.l=t,e.r=t},leftBound:function(e){var t=r.leftEnd;do t=t.r;while(t!=r.rightEnd&&i.rightOf(t,e));return t=t.l,t},del:function(e){e.l.r=e.r,e.r.l=e.l,e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[ho[e.side]]}},i={bisect:function(e,t){var n={region:{l:e,r:t},ep:{l:null,r:null}},r=t.x-e.x,i=t.y-e.y,s=r>0?r:-r,o=i>0?i:-i;return n.c=e.x*r+e.y*i+(r*r+i*i)*.5,s>o?(n.a=1,n.b=i/r,n.c/=r):(n.b=1,n.a=r/i,n.c/=i),n},intersect:function(e,t){var n=e.edge,r=t.edge;if(!n||!r||n.region.r==r.region.r)return null;var i=n.a*r.b-n.b*r.a;if(Math.abs(i)<1e-10)return null;var s=(n.c*r.b-r.c*n.b)/i,o=(r.c*n.a-n.c*r.a)/i,u=n.region.r,a=r.region.r,f,l;u.y<a.y||u.y==a.y&&u.x<a.x?(f=e,l=n):(f=t,l=r);var c=s>=l.region.r.x;return c&&f.side==="l"||!c&&f.side==="r"?null:{x:s,y:o}},rightOf:function(e,t){var n=e.edge,r=n.region.r,i=t.x>r.x;if(i&&e.side==="l")return 1;if(!i&&e.side==="r")return 0;if(n.a===1){var s=t.y-r.y,o=t.x-r.x,u=0,a=0;!i&&n.b<0||i&&n.b>=0?a=u=s>=n.b*o:(a=t.x+t.y*n.b>n.c,n.b<0&&(a=!a),a||(u=1));if(!u){var f=r.x-n.region.l.x;a=n.b*(o*o-s*s)<f*s*(1+2*o/f+n.b*n.b),n.b<0&&(a=!a)}}else{var l=n.c-n.a*t.x,c=t.y-l,h=t.x-r.x,p=l-r.y;a=c*c>h*h+p*p}return e.side==="l"?a:!a},endPoint:function(e,n,r){e.ep[n]=r;if(!e.ep[ho[n]])return;t(e)},distance:function(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}},s={list:[],insert:function(e,t,n){e.vertex=t,e.ystar=t.y+n;for(var r=0,i=s.list,o=i.length;r<o;r++){var u=i[r];if(e.ystar>u.ystar||e.ystar==u.ystar&&t.x>u.vertex.x)continue;break}i.splice(r,0,e)},del:function(e){for(var t=0,n=s.list,r=n.length;t<r&&n[t]!=e;++t);n.splice(t,1)},empty:function(){return s.list.length===0},nextEvent:function(e){for(var t=0,n=s.list,r=n.length;t<r;++t)if(n[t]==e)return n[t+1];return null},min:function(){var e=s.list[0];return{x:e.vertex.x,y:e.ystar}},extractMin:function(){return s.list.shift()}};r.init(),n.bottomSite=n.list.shift();var o=n.list.shift(),u,a,f,l,c,h,p,d,v,m,g,y,b;for(;;){s.empty()||(u=s.min());if(o&&(s.empty()||o.y<u.y||o.y==u.y&&o.x<u.x))a=r.leftBound(o),f=r.right(a),p=r.rightRegion(a),y=i.bisect(p,o),h=r.createHalfEdge(y,"l"),r.insert(a,h),m=i.intersect(a,h),m&&(s.del(a),s.insert(a,m,i.distance(m,o))),a=h,h=r.createHalfEdge(y,"r"
+),r.insert(a,h),m=i.intersect(h,f),m&&s.insert(h,m,i.distance(m,o)),o=n.list.shift();else{if(!!s.empty())break;a=s.extractMin(),l=r.left(a),f=r.right(a),c=r.right(f),p=r.leftRegion(a),d=r.rightRegion(f),g=a.vertex,i.endPoint(a.edge,a.side,g),i.endPoint(f.edge,f.side,g),r.del(a),s.del(f),r.del(f),b="l",p.y>d.y&&(v=p,p=d,d=v,b="r"),y=i.bisect(p,d),h=r.createHalfEdge(y,b),r.insert(l,h),i.endPoint(y,ho[b],g),m=i.intersect(l,h),m&&(s.del(l),s.insert(l,m,i.distance(m,p))),m=i.intersect(h,c),m&&s.insert(h,m,i.distance(m,p))}}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a))t(a.edge)}function ui(){return{leaf:!0,nodes:[],point:null}}function ai(e,t,n,r,i,s){if(!e(t,n,r,i,s)){var o=(n+i)*.5,u=(r+s)*.5,a=t.nodes;a[0]&&ai(e,a[0],n,r,o,u),a[1]&&ai(e,a[1],o,r,i,u),a[2]&&ai(e,a[2],n,u,o,s),a[3]&&ai(e,a[3],o,u,i,s)}}function fi(e){return{x:e[0],y:e[1]}}function li(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function ci(e){return e.substring(0,3)}function hi(e,t,n,r){var i,s,o=0,u=t.length,a=n.length;while(o<u){if(r>=a)return-1;i=t.charCodeAt(o++);if(i==37){s=Ho[t.charAt(o++)];if(!s||(r=s(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function pi(e){return new RegExp("^(?:"+e.map(d3.requote).join("|")+")","i")}function di(e){var t=new r,n=-1,i=e.length;while(++n<i)t.set(e[n].toLowerCase(),n);return t}function vi(e,t,n){Ao.lastIndex=0;var r=Ao.exec(t.substring(n));return r?n+=r[0].length:-1}function mi(e,t,n){Lo.lastIndex=0;var r=Lo.exec(t.substring(n));return r?n+=r[0].length:-1}function gi(e,t,n){_o.lastIndex=0;var r=_o.exec(t.substring(n));return r?(e.m=Do.get(r[0].toLowerCase()),n+=r[0].length):-1}function yi(e,t,n){Oo.lastIndex=0;var r=Oo.exec(t.substring(n));return r?(e.m=Mo.get(r[0].toLowerCase()),n+=r[0].length):-1}function bi(e,t,n){return hi(e,Po.c.toString(),t,n)}function wi(e,t,n){return hi(e,Po.x.toString(),t,n)}function Ei(e,t,n){return hi(e,Po.X.toString(),t,n)}function Si(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+4));return r?(e.y=+r[0],n+=r[0].length):-1}function xi(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.y=Ti(+r[0]),n+=r[0].length):-1}function Ti(e){return e+(e>68?1900:2e3)}function Ni(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.m=r[0]-1,n+=r[0].length):-1}function Ci(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.d=+r[0],n+=r[0].length):-1}function ki(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.H=+r[0],n+=r[0].length):-1}function Li(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.M=+r[0],n+=r[0].length):-1}function Ai(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.S=+r[0],n+=r[0].length):-1}function Oi(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+3));return r?(e.L=+r[0],n+=r[0].length):-1}function Mi(e,t,n){var r=jo.get(t.substring(n,n+=2).toLowerCase());return r==null?-1:(e.p=r,n)}function _i(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return n+To(r)+To(i)}function Di(e){return e.toISOString()}function Pi(e,t,n){function r(t){var n=e(t),r=s(n,1);return t-n<r-t?n:r}function i(n){return t(n=e(new po(n-1)),1),n}function s(e,n){return t(e=new po(+e),n),e}function o(e,r,s){var o=i(e),u=[];if(s>1)while(o<r)n(o)%s||u.push(new Date(+o)),t(o,1);else while(o<r)u.push(new Date(+o)),t(o,1);return u}function u(e,t,n){try{po=li;var r=new li;return r._=e,o(r,t,n)}finally{po=Date}}e.floor=e,e.round=r,e.ceil=i,e.offset=s,e.range=o;var a=e.utc=Hi(e);return a.floor=a,a.round=Hi(r),a.ceil=Hi(i),a.offset=Hi(s),a.range=u,e}function Hi(e){return function(t,n){try{po=li;var r=new li;return r._=t,e(r,n)._}finally{po=Date}}}function Bi(e,t,n){function r(t){return e(t)}return r.invert=function(t){return Fi(e.invert(t))},r.domain=function(t){return arguments.length?(e.domain(t),r):e.domain().map(Fi)},r.nice=function(e){return r.domain(Dt(r.domain(),function(){return e}))},r.ticks=function(n,i){var s=ji(r.domain());if(typeof n!="function"){var o=s[1]-s[0],u=o/n,a=d3.bisect(Io,u);if(a==Io.length)return t.year(s,n);if(!a)return e.ticks(n).map(Fi);Math.log(u/Io[a-1])<Math.log(Io[a]/u)&&--a,n=t[a],i=n[1],n=n[0].range}return n(s[0],new Date(+s[1]+1),i)},r.tickFormat=function(){return n},r.copy=function(){return Bi(e.copy(),t,n)},d3.rebind(r,e,"range","rangeRound","interpolate","clamp")}function ji(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function Fi(e){return new Date(e)}function Ii(e){return function(t){var n=e.length-1,r=e[n];while(!r[1](t))r=e[--n];return r[0](t)}}function qi(e){var t=new Date(e,0,1);return t.setFullYear(e),t}function Ri(e){var t=e.getFullYear(),n=qi(t),r=qi(t+1);return t+(e-n)/(r-n)}function Ui(e){var t=new Date(Date.UTC(e,0,1));return t.setUTCFullYear(e),t}function zi(e){var t=e.getUTCFullYear(),n=Ui(t),r=Ui(t+1);return t+(e-n)/(r-n)}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(Wi){var Xi=CSSStyleDeclaration.prototype,Vi=Xi.setProperty;Xi.setProperty=function(e,t,n){Vi.call(this,e,t+"",n)}}d3={version:"2.10.2"};var $i=n;try{$i(document.documentElement.childNodes)[0].nodeType}catch(Ji){$i=t}var Ki=[].__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]};d3.map=function(e){var t=new r;for(var n in e)t.set(n,e[n]);return t},e(r,{has:function(e){return Qi+e in this},get:function(e){return this[Qi+e]},set:function(e,t){return this[Qi+e]=t},remove:function(e){return e=Qi+e,e in this&&delete this[e]},keys:function(){var e=[];return this.forEach(function(t){e.push(t)}),e},values:function(){var e=[];return this.forEach(function(t,n){e.push(n)}),e},entries:function(){var e=[];return this.forEach(function(t,n){e.push({key:t,value:n})}),e},forEach:function(e){for(var t in this)t.charCodeAt(0)===Gi&&e.call(this,t.substring(1),this[t])}});var Qi="\0",Gi=Qi.charCodeAt(0);d3.functor=u,d3.rebind=function(e,t){var n=1,r=arguments.length,i;while(++n<r)e[i=arguments[n]]=a(e,t,t[i]);return e},d3.ascending=function(e,t){return e<t?-1:e>t?1:e>=t?0:NaN},d3.descending=function(e,t){return t<e?-1:t>e?1:t>=e?0:NaN},d3.mean=function(e,t){var n=e.length,r,i=0,s=-1,o=0;if(arguments.length===1)while(++s<n)f(r=e[s])&&(i+=(r-i)/++o);else while(++s<n)f(r=t.call(e,e[s],s))&&(i+=(r-i)/++o);return o?i:undefined},d3.median=function(e,t){return arguments.length>1&&(e=e.map(t)),e=e.filter(f),e.length?d3.quantile(e.sort(d3.ascending),.5):undefined},d3.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)(s=e[n])!=null&&i>s&&(i=s)}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)(s=t.call(e,e[n],n))!=null&&i>s&&(i=s)}return i},d3.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)(s=e[n])!=null&&s>i&&(i=s)}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)(s=t.call(e,e[n],n))!=null&&s>i&&(i=s)}return i},d3.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++n<r&&((i=o=e[n])==null||i!=i))i=o=undefined;while(++n<r)(s=e[n])!=null&&(i>s&&(i=s),o<s&&(o=s))}else{while(++n<r&&((i=o=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)(s=t.call(e,e[n],n))!=null&&(i>s&&(i=s),o<s&&(o=s))}return[i,o]},d3.random={normal:function(e,t){var n=arguments.length;return n<2&&(t=1),n<1&&(e=0),function(){var n,r,i;do n=Math.random()*2-1,r=Math.random()*2-1,i=n*n+r*r;while(!i||i>1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(e,t){var n=arguments.length;n<2&&(t=1),n<1&&(e=0);var r=d3.random.normal();return function(){return Math.exp(e+t*r())}},irwinHall:function(e){return function(){for(var t=0,n=0;n<e;n++)t+=Math.random();return t/e}}},d3.sum=function(e,t){var n=0,r=e.length,i,s=-1;if(arguments.length===1)while(++s<r)isNaN(i=+e[s])||(n+=i);else while(++s<r)isNaN(i=+t.call(e,e[s],s))||(n+=i);return n},d3.quantile=function(e,t){var n=(e.length-1)*t+1,r=Math.floor(n),i=e[r-1],s=n-r;return s?i+s*(e[r]-i):i},d3.transpose=function(e){return d3.zip.apply(d3,e)},d3.zip=function(){if(!(i=arguments.length))return[];for(var e=-1,t=d3.min(arguments,l),n=new Array(t);++e<t;)for(var r=-1,i,s=n[e]=new Array(i);++r<i;)s[r]=arguments[r][e];return n},d3.bisector=function(e){return{left:function(t,n,r,i){arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);while(r<i){var s=r+i>>>1;e.call(t,t[s],s)<n?r=s+1:i=s}return r},right:function(t,n,r,i){arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);while(r<i){var s=r+i>>>1;n<e.call(t,t[s],s)?i=s:r=s+1}return r}}};var Yi=d3.bisector(function(e){return e});d3.bisectLeft=Yi.left,d3.bisect=d3.bisectRight=Yi.right,d3.first=function(e,t){var n=0,r=e.length,i=e[0],s;arguments.length===1&&(t=d3.ascending);while(++n<r)t.call(e,i,s=e[n])>0&&(i=s);return i},d3.last=function(e,t){var n=0,r=e.length,i=e[0],s;arguments.length===1&&(t=d3.ascending);while(++n<r)t.call(e,i,s=e[n])<=0&&(i=s);return i},d3.nest=function(){function e(t,s){if(s>=i.length)return u?u.call(n,t):o?t.sort(o):t;var a=-1,f=t.length,l=i[s++],c,h,p=new r,d,v={};while(++a<f)(d=p.get(c=l(h=t[a])))?d.push(h):p.set(c,[h]);return p.forEach(function(t,n){v[t]=e(n,s)}),v}function t(e,n){if(n>=i.length)return e;var r=[],o=s[n++],u;for(u in e)r.push({key:u,values:t(e[u],n)});return o&&r.sort(function(e,t){return o(e.key,t.key)}),r}var n={},i=[],s=[],o,u;return n.map=function(t){return e(t,0)},n.entries=function(n){return t(e(n,0),0)},n.key=function(e){return i.push(e),n},n.sortKeys=function(e){return s[i.length-1]=e,n},n.sortValues=function(e){return o=e,n},n.rollup=function(e){return u=e,n},n},d3.keys=function(e){var t=[];for(var n in e)t.push(n);return t},d3.values=function(e){var t=[];for(var n in e)t.push(e[n]);return t},d3.entries=function(e){var t=[];for(var n in e)t.push({key:n,value:e[n]});return t},d3.permute=function(e,t){var n=[],r=-1,i=t.length;while(++r<i)n[r]=e[t[r]];return n},d3.merge=function(e){return Array.prototype.concat.apply([],e)},d3.split=function(e,t){var n=[],r=[],i,s=-1,o=e.length;arguments.length<2&&(t=c);while(++s<o)t.call(r,i=e[s],s)?r=[]:(r.length||n.push(r),r.push(i));return n},d3.range=function(e,t,n){arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0));if((t-e)/n===Infinity)throw new Error("infinite range");var r=[],i=p(Math.abs(n)),s=-1,o;e*=i,t*=i,n*=i;if(n<0)while((o=e+n*++s)>t)r.push(o/i);else while((o=e+n*++s)<t)r.push(o/i);return r},d3.requote=function(e){return e.replace(Zi,"\\$&")};var Zi=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)},d3.xhr=function(e,t,n){var r=new XMLHttpRequest;arguments.length<3?(n=t,t=null):t&&r.overrideMimeType&&r.overrideMimeType(t),r.open("GET",e,!0),t&&r.setRequestHeader("Accept",t),r.onreadystatechange=function(){if(r.readyState===4){var e=r.status;n(!e&&r.response||e>=200&&e<300||e===304?r:null)}},r.send(null)},d3.text=function(e,t,n){function r(e){n(e&&e.responseText)}arguments.length<3&&(n=t,t=null),d3.xhr(e,t,r)},d3.json=function(e,t){d3.text(e,"application/json",function(e){t(e?JSON.parse(e):null)})},d3.html=function(e,t){d3.text(e,"text/html",function(e){if(e!=null){var n=document.createRange();n.selectNode(document.body),e=n.createContextualFragment(e)}t(e)})},d3.xml=function(e,t,n){function r(e){n(e&&e.responseXML)}arguments.length<3&&(n=t,t=null),d3.xhr(e,t,r)};var es={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:es,qualify:function(e){var t=e.indexOf(":"),n=e;return t>=0&&(n=e.substring(0,t),e=e.substring(t+1)),es.hasOwnProperty(n)?{space:es[n],local:e}:e}},d3.dispatch=function(){var e=new d,t=-1,n=arguments.length;while(++t<n)e[arguments[t]]=v(e);return e},d.prototype.on=function(e,t){var n=e.indexOf("."),r="";return n>0&&(r=e.substring(n+1),e=e.substring(0,n)),arguments.length<2?this[e].on(r):this[e].on(r,t)},d3.format=function(e){var t=ts.exec(e),n=t[1]||" ",r=t[3]||"",i=t[5],s=+t[6],o=t[7],u=t[8],a=t[9],f=1,l="",c=!1;u&&(u=+u.substring(1)),i&&(n="0",o&&(s-=Math.floor((s-1)/4)));switch(a){case"n":o=!0,a="g";break;case"%":f=100,l="%",a="f";break;case"p":f=100,l="%",a="r";break;case"d":c=!0,u=0;break;case"s":f=-1,a="r"}return a=="r"&&!u&&(a="g"),a=ns.get(a)||g,function(e){if(c&&e%1)return"";var t=e<0&&(e=-e)?"-":r;if(f<0){var h=d3.formatPrefix(e,u);e=h.scale(e),l=h.symbol}else e*=f;e=a(e,u);if(i){var p=e.length+t.length;p<s&&(e=(new Array(s-p+1)).join(n)+e),o&&(e=y(e)),e=t+e}else{o&&(e=y(e)),e=t+e;var p=e.length;p<s&&(e=(new Array(s-p+1)).join(n)+e)}return e+l}};var ts=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,ns=d3.map({g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(e,t){return d3.round(e,t=m(e,t)).toFixed(Math.max(0,Math.min(20,t)))}}),rs=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(b);d3.formatPrefix=function(e,t){var n=0;return e&&(e<0&&(e*=-1),t&&(e=d3.round(e,m(e,t))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,Math.floor((n<=0?n+1:n-1)/3)*3))),rs[8+n/3]};var is=T(2),ss=T(3),os=function(){return x},us=d3.map({linear:os,poly:T,quad:function(){return is},cubic:function(){return ss},sin:function(){return N},exp:function(){return C},circle:function(){return k},elastic:L,back:A,bounce:function(){return O}}),as=d3.map({"in":x,out:E,"in-out":S,"out-in":function(e){return S(E(e))}});d3.ease=function(e){var t=e.indexOf("-"),n=t>=0?e.substring(0,t):e,r=t>=0?e.substring(t+1):"in";return n=us.get(n)||os,r=as.get(r)||x,w(r(n.apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.transform=function(e){var t=document.createElementNS(d3.ns.prefix.svg,"g");return(d3.transform=function(e){t.setAttribute("transform",e);var n=t.transform.baseVal.consolidate();return new P(n?n.matrix:ls)})(e)},P.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var fs=180/Math.PI,ls={a:1,b:0,c:0,d:1,e:0,f:0};d3.interpolate=function(e,t){var n=d3.interpolators.length,r;while(--n>=0&&!(r=d3.interpolators[n](e,t)));return r},d3.interpolateNumber=function(e,t){return t-=e,function(n){return e+t*n}},d3.interpolateRound=function(e,t){return t-=e,function(n){return Math.round(e+t*n)}},d3.interpolateString=function(e,t){var n,r,i,s=0,o=0,u=[],a=[],f,l;cs.lastIndex=0;for(r=0;n=cs.exec(t);++r)n.index&&u.push(t.substring(s,o=n.index)),a.push({i:u.length,x:n[0]}),u.push(null),s=cs.lastIndex;s<t.length&&u.push(t.substring(s));for(r=0,f=a.length;(n=cs.exec(e))&&r<f;++r){l=a[r];if(l.x==n[0]){if(l.i)if(u[l.i+1]==null){u[l.i-1]+=l.x,u.splice(l.i,1);for(i=r+1;i<f;++i)a[i].i--}else{u[l.i-1]+=l.x+u[l.i+1],u.splice(l.i,2);for(i=r+1;i<f;++i)a[i].i-=2}else if(u[l.i+1]==null)u[l.i]=l.x;else{u[l.i]=l.x+u[l.i+1],u.splice(l.i+1,1);for(i=r+1;i<f;++i)a[i].i--}a.splice(r,1),f--,r--}else l.x=d3.interpolateNumber(parseFloat(n[0]),parseFloat(l.x))}while(r<f)l=a.pop(),u[l.i+1]==null?u[l.i]=l.x:(u[l.i]=l.x+u[l.i+1],u.splice(l.i+1,1)),f--;return u.length===1?u[0]==null?a[0].x:function(){return t}:function(e){for(r=0;r<f;++r)u[(l=a[r]).i]=l.x(e);return u.join("")}},d3.interpolateTransform=function(e,t){var n=[],r=[],i,s=d3.transform(e),o=d3.transform(t),u=s.translate,a=o.translate,f=s.rotate,l=o.rotate,c=s.skew,h=o.skew,p=s.scale,d=o.scale;return u[0]!=a[0]||u[1]!=a[1]?(n.push("translate(",null,",",null,")"),r.push({i:1,x:d3.interpolateNumber(u[0],a[0])},{i:3,x:d3.interpolateNumber(u[1],a[1])})):a[0]||a[1]?n.push("translate("+a+")"):n.push(""),f!=l?(f-l>180?l+=360:l-f>180&&(f+=360),r.push({i:n.push(n.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(f,l)})):l&&n.push(n.pop()+"rotate("+l+")"),c!=h?r.push({i:n.push(n.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(c,h)}):h&&n.push(n.pop()+"skewX("+h+")"),p[0]!=d[0]||p[1]!=d[1]?(i=n.push(n.pop()+"scale(",null,",",null,")"),r.push({i:i-4,x:d3.interpolateNumber(p[0],d[0])},{i:i-2,x:d3.interpolateNumber(p[1],d[1])})):(d[0]!=1||d[1]!=1)&&n.push(n.pop()+"scale("+d+")"),i=r.length,function(e){var t=-1,s;while(++t<i)n[(s=r[t]).i]=s.x(e);return n.join("")}},d3.interpolateRgb=function(e,t){e=d3.rgb(e),t=d3.rgb(t);var n=e.r,r=e.g,i=e.b,s=t.r-n,o=t.g-r,u=t.b-i;return function(e){return"#"+z(Math.round(n+s*e))+z(Math.round(r+o*e))+z(Math.round(i+u*e))}},d3.interpolateHsl=function(e,t){e=d3.hsl(e),t=d3.hsl(t);var n=e.h,r=e.s,i=e.l,s=t.h-n,o=t.s-r,u=t.l-i;return s>180?s-=360:s<-180&&(s+=360),function(e){return G(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateLab=function(e,t){e=d3.lab(e),t=d3.lab(t);var n=e.l,r=e.a,i=e.b,s=t.l-n,o=t.a-r,u=t.b-i;return function(e){return rt(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateHcl=function(e,t){e=d3.hcl(e),t=d3.hcl(t);var n=e.h,r=e.c,i=e.l,s=t.h-n,o=t.c-r,u=t.l-i;return s>180?s-=360:s<-180&&(s+=360),function(e){return et(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateArray=function(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u<o;++u)n.push(d3.interpolate(e[u],t[u]));for(;u<i;++u)r[u]=e[u];for(;u<s;++u)r[u]=t[u];return function(e){for(u=0;u<o;++u)r[u]=n[u](e);return r}},d3.interpolateObject=function(e,t){var n={},r={},i;for(i in e)i in t?n[i]=F(i)(e[i],t[i]):r[i]=e[i];for(i in t)i in e||(r[i]=t[i]);return function(e){for(i in n)r[i]=n[i](e);return r}};var cs=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;d3.interpolators=[d3.interpolateObject,function(e,t){return t instanceof Array&&d3.interpolateArray(e,t)},function(e,t){return(typeof e=="string"||typeof t=="string")&&d3.interpolateString(e+"",t+"")},function(e,t){return(typeof t=="string"?hs.has(t)||/^(#|rgb\(|hsl\()/.test(t):t instanceof U||t instanceof Q)&&d3.interpolateRgb(e,t)},function(e,t){return!isNaN(e=+e)&&!isNaN(t=+t)&&d3.interpolateNumber(e,t)}],d3.rgb=function(e,t,n){return arguments.length===1?e instanceof U?R(e.r,e.g,e.b):W(""+e,R,G):R(~~e,~~t,~~n)},U.prototype.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,n=this.g,r=this.b,i=30;return!t&&!n&&!r?R(i,i,i):(t&&t<i&&(t=i),n&&n<i&&(n=i),r&&r<i&&(r=i),R(Math.min(255,Math.floor(t/e)),Math.min(255,Math.floor(n/e)),Math.min(255,Math.floor(r/e))))},U.prototype.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),R(Math.floor(e*this.r),Math.floor(e*this.g),Math.floor(e*this.b))},U.prototype.hsl=function(){return X(this.r,this.g,this.b)},U.prototype.toString=function(){return"#"+z(this.r)+z(this.g)+z(this.b)};var hs=d3.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});hs.forEach(function(e,t){hs.set(e,W(t,R,G))}),d3.hsl=function(e,t,n){return arguments.length===1?e instanceof Q?K(e.h,e.s,e.l):W(""+e,X,K):K(+e,+t,+n)},Q.prototype.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),K(this.h,this.s,this.l/e)},Q.prototype.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),K(this.h,this.s,e*this.l)},Q.prototype.rgb=function(){return G(this.h,this.s,this.l)},Q.prototype.toString=function(){return this.rgb().toString()},d3.hcl=function(e,t,n){return arguments.length===1?e instanceof Z?Y(e.h,e.c,e.l):e instanceof nt?it(e.l,e.a,e.b):it((e=V((e=d3.rgb(e)).r,e.g,e.b)).l,e.a,e.b):Y(+e,+t,+n)},Z.prototype.brighter=function(e){return Y(this.h,this.c,Math.min(100,this.l+ps*(arguments.length?e:1)))},Z.prototype.darker=function(e){return Y(this.h,this.c,Math.max(0,this.l-ps*(arguments.length?e:1)))},Z.prototype.rgb=function(){return et(this.h,this.c,this.l).rgb()},Z.prototype.toString=function(){return this.rgb()+""},d3.lab=function(e,t,n){return arguments.length===1?e instanceof nt?tt(e.l,e.a,e.b):e instanceof Z?et(e.l,e.c,e.h):V((e=d3.rgb(e)).r,e.g,e.b):tt(+e,+t,+n)};var ps=18,ds=.95047,vs=1,ms=1.08883;nt.prototype.brighter=function(e){return tt(Math.min(100,this.l+ps*(arguments.length?e:1)),this.a,this.b)},nt.prototype.darker=function(e){return tt(Math.max(0,this.l-ps*(arguments.length?e:1)),this.a,this.b)},nt.prototype.rgb=function(){return rt(this.l,this.a,this.b)},nt.prototype.toString=function(){return this.rgb()+""};var gs=function(e,t){return t.querySelector(e)},ys=function(e,t){return t.querySelectorAll(e)},bs=document.documentElement,ws=bs.matchesSelector||bs.webkitMatchesSelector||bs.mozMatchesSelector||bs.msMatchesSelector||bs.oMatchesSelector,Es=function(e,t){return ws.call(e,t)};typeof Sizzle=="function"&&(gs=function(e,t){return Sizzle(e,t)[0]||null},ys=function(e,t){return Sizzle.uniqueSort(Sizzle(e,t))},Es=Sizzle.matchesSelector);var Ss=[];d3.selection=function(){return xs},d3.selection.prototype=Ss,Ss.select=function(e){var t=[],n,r,i,s;typeof e!="function"&&(e=ft(e));for(var o=-1,u=this.length;++o<u;){t.push(n=[]),n.parentNode=(i=this[o]).parentNode;for(var a=-1,f=i.length;++a<f;)(s=i[a])?(n.push(r=e.call(s,s.__data__,a)),r&&"__data__"in s&&(r.__data__=s.__data__)):n.push(null)}return at(t)},Ss.selectAll=function(e){var t=[],n,r;typeof e!="function"&&(e=lt(e));for(var i=-1,s=this.length;++i<s;)for(var o=this[i],u=-1,a=o.length;++u<a;)if(r=o[u])t.push(n=$i(e.call(r,r.__data__,u))),n.parentNode=r;return at(t)},Ss.attr=function(e,t){if(arguments.length<2){if(typeof e=="string"){var n=this.node();return e=d3.ns.qualify(e),e.local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(t in e)this.each(ct(t,e[t]));return this}return this.each(ct(e,t))},Ss.classed=function(e,t){if(arguments.length<2){if(typeof e=="string"){var n=this.node(),r=(e=e.trim().split(/^|\s+/g)).length,i=-1;if(t=n.classList){while(++i<r)if(!t.contains(e[i]))return!1}else{t=n.className,t.baseVal!=null&&(t=t.baseVal);while(++i<r)if(!ht(e[i]).test(t))return!1}return!0}for(t in e)this.each(pt(t,e[t]));return this}return this.each(pt(e,t))},Ss.style=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t="");for(n in e)this.each(vt(n,e[n],t));return this}if(r<2)return window.getComputedStyle(this.node(),null).getPropertyValue(e);n=""}return this.each(vt(e,t,n))},Ss.property=function(e,t){if(arguments.length<2){if(typeof e=="string")return this.node()[e];for(t in e)this.each(mt(t,e[t]));return this}return this.each(mt(e,t))},Ss.text=function(e){return arguments.length<1?this.node().textContent:this.each(typeof e=="function"?function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}:e==null?function(){this.textContent=""}:function(){this.textContent=e})},Ss.html=function(e){return arguments.length<1?this.node().innerHTML:this.each(typeof e=="function"?function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}:e==null?function(){this.innerHTML=""}:function(){this.innerHTML=e})},Ss.append=function(e){function t(){return this.appendChild(document.createElementNS(this.namespaceURI,e))}function n(){return this.appendChild(document.createElementNS(e.space,e.local))}return e=d3.ns.qualify(e),this.select(e.local?n:t)},Ss.insert=function(e,t){function n(){return this.insertBefore(document.createElementNS(this.namespaceURI,e),gs(t,this))}function r(){return this.insertBefore(document.createElementNS(e.space,e.local),gs(t,this))}return e=d3.ns.qualify(e),this.select(e.local?r:n)},Ss.remove=function(){return this.each(function(){var e=this.parentNode;e&&e.removeChild(this)})},Ss.data=function(e,t){function n(e,n){var i,s=e.length,o=n.length,u=Math.min(s,o),c=Math.max(s,o),h=[],p=[],d=[],v,m;if(t){var g=new r,y=[],b,w=n.length;for(i=-1;++i<s;)b=t.call(v=e[i],v.__data__,i),g.has(b)?d[w++]=v:g.set(b,v),y.push(b);for(i=-1;++i<o;)b=t.call(n,m=n[i],i),g.has(b)?(h[i]=v=g.get(b),v.__data__=m,p[i]=d[i]=null):(p[i]=gt(m),h[i]=d[i]=null),g.remove(b);for(i=-1;++i<s;)g.has(y[i])&&(d[i]=e[i])}else{for(i=-1;++i<u;)v=e[i],m=n[i],v?(v.__data__=m,h[i]=v,p[i]=d[i]=null):(p[i]=gt(m),h[i]=d[i]=null);for(;i<o;++i)p[i]=gt(n[i]),h[i]=d[i]=null;for(;i<c;++i)d[i]=e[i],p[i]=h[i]=null}p.update=h,p.parentNode=h.parentNode=d.parentNode=e.parentNode,a.push(p),f.push(h),l.push(d)}var i=-1,s=this.length,o,u;if(!arguments.length){e=new Array(s=(o=this[0]).length);while(++i<s)if(u=o[i])e[i]=u.__data__;return e}var a=St([]),f=at([]),l=at([]);if(typeof e=="function")while(++i<s)n(o=this[i],e.call(o,o.parentNode.__data__,i));else while(++i<s)n(o=this[i],e);return f.enter=function(){return a},f.exit=function(){return l},f},Ss.datum=Ss.map=function(e){return arguments.length<1?this.property("__data__"):this.property("__data__",e)},Ss.filter=function(e){var t=[],n,r,i;typeof e!="function"&&(e=yt(e));for(var s=0,o=this.length;s<o;s++){t.push(n=[]),n.parentNode=(r=this[s]).parentNode;for(var u=0,a=r.length;u<a;u++)(i=r[u])&&e.call(i,i.__data__,u)&&n.push(i)}return at(t)},Ss.order=function(){for(var e=-1,t=this.length;++e<t;)for(var n=this[e],r=n.length-1,i=n[r],s;--r>=0;)if(s=n[r])i&&i!==s.nextSibling&&i.parentNode.insertBefore(s,i),i=s;return this},Ss.sort=function(e){e=bt.apply(this,arguments);for(var t=-1,n=this.length;++t<n;)this[t].sort(e);return this.order()},Ss.on=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t=!1);for(n in e)this.each(wt(n,e[n],t));return this}if(r<2)return(r=this.node()["__on"+e])&&r._;n=!1}return this.each(wt(e,t,n))},Ss.each=function(e){return Et(this,function(t,n,r){e.call(t,t.__data__,n,r)})},Ss.call=function(e){return e.apply(this,(arguments[0]=this,arguments)),this},Ss.empty=function(){return!this.node()},Ss.node=function(e){for(var t=0,n=this.length;t<n;t++)for(var r=this[t],i=0,s=r.length;i<s;i++){var o=r[i];if(o)return o}return null},Ss.transition=function(){var e=[],t,n;for(var r=-1,i=this.length;++r<i;){e.push(t=[]);for(var s=this[r],o=-1,u=s.length;++o<u;)t.push((n=s[o])?{node:n,delay:Ms,duration:_s}:null)}return xt(e,ks||++Cs,Date.now())};var xs=at([[document]]);xs[0].parentNode=bs,d3.select=function(e){return typeof e=="string"?xs.select(e):at([[e]])},d3.selectAll=function(e){return typeof e=="string"?xs.selectAll(e):at([$i(e)])};var Ts=[];d3.selection.enter=St,d3.selection.enter.prototype=Ts,Ts.append=Ss.append,Ts.insert=Ss.insert,Ts.empty=Ss.empty,Ts.node=Ss.node,Ts.select=function(e){var t=[],n,r,i,s,o;for(var u=-1,a=this.length;++u<a;){i=(s=this[u]).update,t.push(n=[]),n.parentNode=s.parentNode;for(var f=-1,l=s.length;++f<l;)(o=s[f])?(n.push(i[f]=r=e.call(s.parentNode,o.__data__,f)),r.__data__=o.__data__):n.push(null)}return at(t)};var Ns=[],Cs=0,ks=0,Ls=0,As=250,Os=d3.ease("cubic-in-out"),Ms=Ls,_s=As,Ds=Os;Ns.call=Ss.call,d3.transition=function(e){return arguments.length?ks?e.transition():e:xs.transition()},d3.transition.prototype=Ns,Ns.select=function(e){var t=[],n,r,i;typeof e!="function"&&(e=ft(e));for(var s=-1,o=this.length;++s<o;){t.push(n=[]);for(var u=this[s],a=-1,f=u.length;++a<f;)(i=u[a])&&(r=e.call(i.node,i.node.__data__,a))?("__data__"in i.node&&(r.__data__=i.node.__data__),n.push({node:r,delay:i.delay,duration:i.duration})):n.push(null)}return xt(t,this.id,this.time).ease(this.ease())},Ns.selectAll=function(e){var t=[],n,r,i;typeof e!="function"&&(e=lt(e));for(var s=-1,o=this.length;++s<o;)for(var u=this[s],a=-1,f=u.length;++a<f;)if(i=u[a]){r=e.call(i.node,i.node.__data__,a),t.push(n=[]);for(var l=-1,c=r.length;++l<c;)n.push({node:r[l],delay:i.delay,duration:i.duration})}return xt(t,this.id,this.time).ease(this.ease())},Ns.filter=function(e){var t=[],n,r,i;typeof e!="function"&&(e=yt(e));for(var s=0,o=this.length;s<o;s++){t.push(n=[]);for(var r=this[s],u=0,a=r.length;u<a;u++)(i=r[u])&&e.call(i.node,i.node.__data__,u)&&n.push(i)}return xt(t,this.id,this.time).ease(this.ease())},Ns.attr=function(e,t){if(arguments.length<2){for(t in e)this.attrTween(t,Ct(e[t],t));return this}return this.attrTween(e,Ct(t,e))},Ns.attrTween=function(e,t){function n(e,n){var r=t.call(this,e,n,this.getAttribute(i));return r===Ps?(this.removeAttribute(i),null):r&&function(e){this.setAttribute(i,r(e))}}function r(e,n){var r=t.call(this,e,n,this.getAttributeNS(i.space,i.local));return r===Ps?(this.removeAttributeNS(i.space,i.local),null):r&&function(e){this.setAttributeNS(i.space,i.local,r(e))}}var i=d3.ns.qualify(e);return this.tween("attr."+e,i.local?r:n)},Ns.style=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t="");for(n in e)this.styleTween(n,Ct(e[n],n),t);return this}n=""}return this.styleTween(e,Ct(t,e),n)},Ns.styleTween=function(e,t,n){return arguments.length<3&&(n=""),this.tween("style."+e,function(r,i){var s=t.call(this,r,i,window.getComputedStyle(this,null).getPropertyValue(e));return s===Ps?(this.style.removeProperty(e),null):s&&function(t){this.style.setProperty(e,s(t),n)}})},Ns.text=function(e){return this.tween("text",function(t,n){this.textContent=typeof e=="function"?e.call(this,t,n):e})},Ns.remove=function(){return this.each("end.transition",function(){var e;!this.__transition__&&(e=this.parentNode)&&e.removeChild(this)})},Ns.delay=function(e){return Et(this,typeof e=="function"?function(t,n,r){t.delay=e.call(t=t.node,t.__data__,n,r)|0}:(e|=0,function(t){t.delay=e}))},Ns.duration=function(e){return Et(this,typeof e=="function"?function(t,n,r){t.duration=Math.max(1,e.call(t=t.node,t.__data__,n,r)|0)}:(e=Math.max(1,e|0),function(t){t.duration=e}))},Ns.transition=function(){return this.select(s)},d3.tween=function(e,t){function n(n,r,i){var s=e.call(this,n,r);return s==null?i!=""&&Ps:i!=s&&t(i,s)}function r(n,r,i){return i!=e&&t(i,e)}return typeof e=="function"?n:e==null?Nt:(e+="",r)};var Ps={},Hs=null,Bs,js;d3.timer=function(e,t,n){var r=!1,i,s=Hs;if(arguments.length<3){if(arguments.length<2)t=0;else if(!isFinite(t))return;n=Date.now()}while(s){if(s.callback===e){s.then=n,s.delay=t,r=!0;break}i=s,s=s.next}r||(Hs={callback:e,then:n,delay:t,next:Hs}),Bs||(js=clearTimeout(js),Bs=1,Fs(kt))},d3.timer.flush=function(){var e,t=Date.now(),n=Hs;while(n)e=t-n.then,n.delay||(n.flush=n.callback(e)),n=n.next;Lt()};var Fs=window.requestAnimationFrame||window.webkitRequestAnimationFrame||
+window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,17)};d3.mouse=function(e){return At(e,_())};var Is=/WebKit/.test(navigator.userAgent)?-1:0;d3.touches=function(e,t){return arguments.length<2&&(t=_().touches),t?$i(t).map(function(t){var n=At(e,t);return n.identifier=t.identifier,n}):[]},d3.scale={},d3.scale.linear=function(){return Ht([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return zt(d3.scale.linear(),Wt)};var qs=d3.format(".0e");Wt.pow=function(e){return Math.pow(10,e)},Xt.pow=function(e){return-Math.pow(10,-e)},d3.scale.pow=function(){return Vt(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return Jt([],{t:"range",a:[[]]})},d3.scale.category10=function(){return d3.scale.ordinal().range(Rs)},d3.scale.category20=function(){return d3.scale.ordinal().range(Us)},d3.scale.category20b=function(){return d3.scale.ordinal().range(zs)},d3.scale.category20c=function(){return d3.scale.ordinal().range(Ws)};var Rs=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Us=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],zs=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],Ws=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return Kt([],[])},d3.scale.quantize=function(){return Qt(0,1,[0,1])},d3.scale.threshold=function(){return Gt([.5],[0,1])},d3.scale.identity=function(){return Yt([0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=t.apply(this,arguments),s=n.apply(this,arguments),o=r.apply(this,arguments)+Xs,u=i.apply(this,arguments)+Xs,a=(u<o&&(a=o,o=u,u=a),u-o),f=a<Math.PI?"0":"1",l=Math.cos(o),c=Math.sin(o),h=Math.cos(u),p=Math.sin(u);return a>=Vs?e?"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"Z":e?"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L"+e*h+","+e*p+"A"+e+","+e+" 0 "+f+",0 "+e*l+","+e*c+"Z":"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L0,0"+"Z"}var t=Zt,n=en,r=tn,i=nn;return e.innerRadius=function(n){return arguments.length?(t=u(n),e):t},e.outerRadius=function(t){return arguments.length?(n=u(t),e):n},e.startAngle=function(t){return arguments.length?(r=u(t),e):r},e.endAngle=function(t){return arguments.length?(i=u(t),e):i},e.centroid=function(){var e=(t.apply(this,arguments)+n.apply(this,arguments))/2,s=(r.apply(this,arguments)+i.apply(this,arguments))/2+Xs;return[Math.cos(s)*e,Math.sin(s)*e]},e};var Xs=-Math.PI/2,Vs=2*Math.PI-1e-6;d3.svg.line=function(){return rn(i)};var $s=d3.map({linear:un,"linear-closed":an,"step-before":fn,"step-after":ln,basis:mn,"basis-open":gn,"basis-closed":yn,bundle:bn,cardinal:pn,"cardinal-open":cn,"cardinal-closed":hn,monotone:Nn});$s.forEach(function(e,t){t.key=e,t.closed=/-closed$/.test(e)});var Js=[0,2/3,1/3,0],Ks=[0,1/3,2/3,0],Qs=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var e=rn(Cn);return e.radius=e.x,delete e.x,e.angle=e.y,delete e.y,e},fn.reverse=ln,ln.reverse=fn,d3.svg.area=function(){return kn(i)},d3.svg.area.radial=function(){var e=kn(Cn);return e.radius=e.x,delete e.x,e.innerRadius=e.x0,delete e.x0,e.outerRadius=e.x1,delete e.x1,e.angle=e.y,delete e.y,e.startAngle=e.y0,delete e.y0,e.endAngle=e.y1,delete e.y1,e},d3.svg.chord=function(){function e(e,u){var a=t(this,s,e,u),f=t(this,o,e,u);return"M"+a.p0+r(a.r,a.p1,a.a1-a.a0)+(n(a,f)?i(a.r,a.p1,a.r,a.p0):i(a.r,a.p1,f.r,f.p0)+r(f.r,f.p1,f.a1-f.a0)+i(f.r,f.p1,a.r,a.p0))+"Z"}function t(e,t,n,r){var i=t.call(e,n,r),s=a.call(e,i,r),o=f.call(e,i,r)+Xs,u=l.call(e,i,r)+Xs;return{r:s,a0:o,a1:u,p0:[s*Math.cos(o),s*Math.sin(o)],p1:[s*Math.cos(u),s*Math.sin(u)]}}function n(e,t){return e.a0==t.a0&&e.a1==t.a1}function r(e,t,n){return"A"+e+","+e+" 0 "+ +(n>Math.PI)+",1 "+t}function i(e,t,n,r){return"Q 0,0 "+r}var s=Ln,o=An,a=On,f=tn,l=nn;return e.radius=function(t){return arguments.length?(a=u(t),e):a},e.source=function(t){return arguments.length?(s=u(t),e):s},e.target=function(t){return arguments.length?(o=u(t),e):o},e.startAngle=function(t){return arguments.length?(f=u(t),e):f},e.endAngle=function(t){return arguments.length?(l=u(t),e):l},e},d3.svg.diagonal=function(){function e(e,i){var s=t.call(this,e,i),o=n.call(this,e,i),u=(s.y+o.y)/2,a=[s,{x:s.x,y:u},{x:o.x,y:u},o];return a=a.map(r),"M"+a[0]+"C"+a[1]+" "+a[2]+" "+a[3]}var t=Ln,n=An,r=Dn;return e.source=function(n){return arguments.length?(t=u(n),e):t},e.target=function(t){return arguments.length?(n=u(t),e):n},e.projection=function(t){return arguments.length?(r=t,e):r},e},d3.svg.diagonal.radial=function(){var e=d3.svg.diagonal(),t=Dn,n=e.projection;return e.projection=function(e){return arguments.length?n(Pn(t=e)):t},e},d3.svg.mouse=d3.mouse,d3.svg.touches=d3.touches,d3.svg.symbol=function(){function e(e,r){return(Gs.get(t.call(this,e,r))||jn)(n.call(this,e,r))}var t=Bn,n=Hn;return e.type=function(n){return arguments.length?(t=u(n),e):t},e.size=function(t){return arguments.length?(n=u(t),e):n},e};var Gs=d3.map({circle:jn,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+ -3*t+","+ -t+"H"+ -t+"V"+ -3*t+"H"+t+"V"+ -t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+ -t+"V"+t+"H"+ -3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*Zs)),n=t*Zs;return"M0,"+ -t+"L"+n+",0"+" 0,"+t+" "+ -n+",0"+"Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+ -t+","+ -t+"L"+t+","+ -t+" "+t+","+t+" "+ -t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/Ys),n=t*Ys/2;return"M0,"+n+"L"+t+","+ -n+" "+ -t+","+ -n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/Ys),n=t*Ys/2;return"M0,"+ -n+"L"+t+","+n+" "+ -t+","+n+"Z"}});d3.svg.symbolTypes=Gs.keys();var Ys=Math.sqrt(3),Zs=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function e(e){e.each(function(){var e=d3.select(this),c=a==null?t.ticks?t.ticks.apply(t,u):t.domain():a,h=f==null?t.tickFormat?t.tickFormat.apply(t,u):String:f,p=qn(t,c,l),d=e.selectAll(".minor").data(p,String),v=d.enter().insert("line","g").attr("class","tick minor").style("opacity",1e-6),m=d3.transition(d.exit()).style("opacity",1e-6).remove(),g=d3.transition(d).style("opacity",1),y=e.selectAll("g").data(c,String),b=y.enter().insert("g","path").style("opacity",1e-6),w=d3.transition(y.exit()).style("opacity",1e-6).remove(),E=d3.transition(y).style("opacity",1),S,x=_t(t),T=e.selectAll(".domain").data([0]),N=T.enter().append("path").attr("class","domain"),C=d3.transition(T),k=t.copy(),L=this.__chart__||k;this.__chart__=k,b.append("line").attr("class","tick"),b.append("text");var A=b.select("line"),O=E.select("line"),M=y.select("text").text(h),_=b.select("text"),D=E.select("text");switch(n){case"bottom":S=Fn,v.attr("y2",i),g.attr("x2",0).attr("y2",i),A.attr("y2",r),_.attr("y",Math.max(r,0)+o),O.attr("x2",0).attr("y2",r),D.attr("x",0).attr("y",Math.max(r,0)+o),M.attr("dy",".71em").attr("text-anchor","middle"),C.attr("d","M"+x[0]+","+s+"V0H"+x[1]+"V"+s);break;case"top":S=Fn,v.attr("y2",-i),g.attr("x2",0).attr("y2",-i),A.attr("y2",-r),_.attr("y",-(Math.max(r,0)+o)),O.attr("x2",0).attr("y2",-r),D.attr("x",0).attr("y",-(Math.max(r,0)+o)),M.attr("dy","0em").attr("text-anchor","middle"),C.attr("d","M"+x[0]+","+ -s+"V0H"+x[1]+"V"+ -s);break;case"left":S=In,v.attr("x2",-i),g.attr("x2",-i).attr("y2",0),A.attr("x2",-r),_.attr("x",-(Math.max(r,0)+o)),O.attr("x2",-r).attr("y2",0),D.attr("x",-(Math.max(r,0)+o)).attr("y",0),M.attr("dy",".32em").attr("text-anchor","end"),C.attr("d","M"+ -s+","+x[0]+"H0V"+x[1]+"H"+ -s);break;case"right":S=In,v.attr("x2",i),g.attr("x2",i).attr("y2",0),A.attr("x2",r),_.attr("x",Math.max(r,0)+o),O.attr("x2",r).attr("y2",0),D.attr("x",Math.max(r,0)+o).attr("y",0),M.attr("dy",".32em").attr("text-anchor","start"),C.attr("d","M"+s+","+x[0]+"H0V"+x[1]+"H"+s)}if(t.ticks)b.call(S,L),E.call(S,k),w.call(S,k),v.call(S,L),g.call(S,k),m.call(S,k);else{var P=k.rangeBand()/2,H=function(e){return k(e)+P};b.call(S,H),E.call(S,H)}})}var t=d3.scale.linear(),n="bottom",r=6,i=6,s=6,o=3,u=[10],a=null,f,l=0;return e.scale=function(n){return arguments.length?(t=n,e):t},e.orient=function(t){return arguments.length?(n=t,e):n},e.ticks=function(){return arguments.length?(u=arguments,e):u},e.tickValues=function(t){return arguments.length?(a=t,e):a},e.tickFormat=function(t){return arguments.length?(f=t,e):f},e.tickSize=function(t,n,o){if(!arguments.length)return r;var u=arguments.length-1;return r=+t,i=u>1?+n:r,s=u>0?+arguments[u]:r,e},e.tickPadding=function(t){return arguments.length?(o=+t,e):o},e.tickSubdivide=function(t){return arguments.length?(l=+t,e):l},e},d3.svg.brush=function(){function e(s){s.each(function(){var s=d3.select(this),f=s.selectAll(".background").data([0]),l=s.selectAll(".extent").data([0]),c=s.selectAll(".resize").data(a,String),h;s.style("pointer-events","all").on("mousedown.brush",i).on("touchstart.brush",i),f.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),l.enter().append("rect").attr("class","extent").style("cursor","move"),c.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return eo[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),c.style("display",e.empty()?"none":null),c.exit().remove(),o&&(h=_t(o),f.attr("x",h[0]).attr("width",h[1]-h[0]),n(s)),u&&(h=_t(u),f.attr("y",h[0]).attr("height",h[1]-h[0]),r(s)),t(s)})}function t(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+f[+/e$/.test(e)][0]+","+f[+/^s/.test(e)][1]+")"})}function n(e){e.select(".extent").attr("x",f[0][0]),e.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1][0]-f[0][0])}function r(e){e.select(".extent").attr("y",f[0][1]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1][1]-f[0][1])}function i(){function i(){var e=d3.event.changedTouches;return e?d3.touches(v,e)[0]:d3.mouse(v)}function a(){d3.event.keyCode==32&&(S||(x=null,T[0]-=f[1][0],T[1]-=f[1][1],S=2),M())}function c(){d3.event.keyCode==32&&S==2&&(T[0]+=f[1][0],T[1]+=f[1][1],S=0,M())}function h(){var e=i(),s=!1;N&&(e[0]+=N[0],e[1]+=N[1]),S||(d3.event.altKey?(x||(x=[(f[0][0]+f[1][0])/2,(f[0][1]+f[1][1])/2]),T[0]=f[+(e[0]<x[0])][0],T[1]=f[+(e[1]<x[1])][1]):x=null),w&&p(e,o,0)&&(n(y),s=!0),E&&p(e,u,1)&&(r(y),s=!0),s&&(t(y),g({type:"brush",mode:S?"move":"resize"}))}function p(e,t,n){var r=_t(t),i=r[0],s=r[1],o=T[n],u=f[1][n]-f[0][n],a,c;S&&(i-=o,s-=u+o),a=Math.max(i,Math.min(s,e[n])),S?c=(a+=o)+u:(x&&(o=Math.max(i,Math.min(s,2*x[n]-a))),o<a?(c=a,a=o):c=o);if(f[0][n]!==a||f[1][n]!==c)return l=null,f[0][n]=a,f[1][n]=c,!0}function d(){h(),y.style("pointer-events","all").selectAll(".resize").style("display",e.empty()?"none":null),d3.select("body").style("cursor",null),C.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),g({type:"brushend"}),M()}var v=this,m=d3.select(d3.event.target),g=s.of(v,arguments),y=d3.select(v),b=m.datum(),w=!/^(n|s)$/.test(b)&&o,E=!/^(e|w)$/.test(b)&&u,S=m.classed("extent"),x,T=i(),N,C=d3.select(window).on("mousemove.brush",h).on("mouseup.brush",d).on("touchmove.brush",h).on("touchend.brush",d).on("keydown.brush",a).on("keyup.brush",c);if(S)T[0]=f[0][0]-T[0],T[1]=f[0][1]-T[1];else if(b){var k=+/w$/.test(b),L=+/^n/.test(b);N=[f[1-k][0]-T[0],f[1-L][1]-T[1]],T[0]=f[k][0],T[1]=f[L][1]}else d3.event.altKey&&(x=T.slice());y.style("pointer-events","none").selectAll(".resize").style("display",null),d3.select("body").style("cursor",m.style("cursor")),g({type:"brushstart"}),h(),M()}var s=D(e,"brushstart","brush","brushend"),o=null,u=null,a=to[0],f=[[0,0],[0,0]],l;return e.x=function(t){return arguments.length?(o=t,a=to[!o<<1|!u],e):o},e.y=function(t){return arguments.length?(u=t,a=to[!o<<1|!u],e):u},e.extent=function(t){var n,r,i,s,a;return arguments.length?(l=[[0,0],[0,0]],o&&(n=t[0],r=t[1],u&&(n=n[0],r=r[0]),l[0][0]=n,l[1][0]=r,o.invert&&(n=o(n),r=o(r)),r<n&&(a=n,n=r,r=a),f[0][0]=n|0,f[1][0]=r|0),u&&(i=t[0],s=t[1],o&&(i=i[1],s=s[1]),l[0][1]=i,l[1][1]=s,u.invert&&(i=u(i),s=u(s)),s<i&&(a=i,i=s,s=a),f[0][1]=i|0,f[1][1]=s|0),e):(t=l||f,o&&(n=t[0][0],r=t[1][0],l||(n=f[0][0],r=f[1][0],o.invert&&(n=o.invert(n),r=o.invert(r)),r<n&&(a=n,n=r,r=a))),u&&(i=t[0][1],s=t[1][1],l||(i=f[0][1],s=f[1][1],u.invert&&(i=u.invert(i),s=u.invert(s)),s<i&&(a=i,i=s,s=a))),o&&u?[[n,i],[r,s]]:o?[n,r]:u&&[i,s])},e.clear=function(){return l=null,f[0][0]=f[0][1]=f[1][0]=f[1][1]=0,e},e.empty=function(){return o&&f[0][0]===f[1][0]||u&&f[0][1]===f[1][1]},d3.rebind(e,s,"on")};var eo={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},to=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];d3.behavior={},d3.behavior.drag=function(){function e(){this.on("mousedown.drag",t).on("touchstart.drag",t)}function t(){function e(){var e=o.parentNode;return f?d3.touches(e).filter(function(e){return e.identifier===f})[0]:d3.mouse(e)}function t(){if(!o.parentNode)return i();var t=e(),n=t[0]-c[0],r=t[1]-c[1];h|=n|r,c=t,M(),u({type:"drag",x:t[0]+l[0],y:t[1]+l[1],dx:n,dy:r})}function i(){u({type:"dragend"}),h&&(M(),d3.event.target===a&&p.on("click.drag",s,!0)),p.on(f?"touchmove.drag-"+f:"mousemove.drag",null).on(f?"touchend.drag-"+f:"mouseup.drag",null)}function s(){M(),p.on("click.drag",null)}var o=this,u=n.of(o,arguments),a=d3.event.target,f=d3.event.touches&&d3.event.changedTouches[0].identifier,l,c=e(),h=0,p=d3.select(window).on(f?"touchmove.drag-"+f:"mousemove.drag",t).on(f?"touchend.drag-"+f:"mouseup.drag",i,!0);r?(l=r.apply(o,arguments),l=[l.x-c[0],l.y-c[1]]):l=[0,0],f||M(),u({type:"dragstart"})}var n=D(e,"drag","dragstart","dragend"),r=null;return e.origin=function(t){return arguments.length?(r=t,e):r},d3.rebind(e,n,"on")},d3.behavior.zoom=function(){function e(){this.on("mousedown.zoom",o).on("mousewheel.zoom",u).on("mousemove.zoom",a).on("DOMMouseScroll.zoom",u).on("dblclick.zoom",f).on("touchstart.zoom",l).on("touchmove.zoom",c).on("touchend.zoom",l)}function t(e){return[(e[0]-h[0])/d,(e[1]-h[1])/d]}function n(e){return[e[0]*d+h[0],e[1]*d+h[1]]}function r(e){d=Math.max(m[0],Math.min(m[1],e))}function i(e,t){t=n(t),h[0]+=e[0]-t[0],h[1]+=e[1]-t[1]}function s(e){b&&b.domain(y.range().map(function(e){return(e-h[0])/d}).map(y.invert)),E&&E.domain(w.range().map(function(e){return(e-h[1])/d}).map(w.invert)),d3.event.preventDefault(),e({type:"zoom",scale:d,translate:h})}function o(){function e(){f=1,i(d3.mouse(o),c),s(u)}function n(){f&&M(),l.on("mousemove.zoom",null).on("mouseup.zoom",null),f&&d3.event.target===a&&l.on("click.zoom",r,!0)}function r(){M(),l.on("click.zoom",null)}var o=this,u=g.of(o,arguments),a=d3.event.target,f=0,l=d3.select(window).on("mousemove.zoom",e).on("mouseup.zoom",n),c=t(d3.mouse(o));window.focus(),M()}function u(){p||(p=t(d3.mouse(this))),r(Math.pow(2,Rn()*.002)*d),i(d3.mouse(this),p),s(g.of(this,arguments))}function a(){p=null}function f(){var e=d3.mouse(this),n=t(e);r(d3.event.shiftKey?d/2:d*2),i(e,n),s(g.of(this,arguments))}function l(){var e=d3.touches(this),n=Date.now();v=d,p={},e.forEach(function(e){p[e.identifier]=t(e)}),M();if(e.length===1){if(n-S<500){var o=e[0],u=t(e[0]);r(d*2),i(o,u),s(g.of(this,arguments))}S=n}}function c(){var e=d3.touches(this),t=e[0],n=p[t.identifier];if(o=e[1]){var o,u=p[o.identifier];t=[(t[0]+o[0])/2,(t[1]+o[1])/2],n=[(n[0]+u[0])/2,(n[1]+u[1])/2],r(d3.event.scale*v)}i(t,n),S=null,s(g.of(this,arguments))}var h=[0,0],p,d=1,v,m=ro,g=D(e,"zoom"),y,b,w,E,S;return e.translate=function(t){return arguments.length?(h=t.map(Number),e):h},e.scale=function(t){return arguments.length?(d=+t,e):d},e.scaleExtent=function(t){return arguments.length?(m=t==null?ro:t.map(Number),e):m},e.x=function(t){return arguments.length?(b=t,y=t.copy(),e):b},e.y=function(t){return arguments.length?(E=t,w=t.copy(),e):E},d3.rebind(e,g,"on")};var no,ro=[0,Infinity];d3.layout={},d3.layout.bundle=function(){return function(e){var t=[],n=-1,r=e.length;while(++n<r)t.push(Un(e[n]));return t}},d3.layout.chord=function(){function e(){var e={},n=[],c=d3.range(o),h=[],p,d,v,m,g;r=[],i=[],p=0,m=-1;while(++m<o){d=0,g=-1;while(++g<o)d+=s[m][g];n.push(d),h.push(d3.range(o)),p+=d}a&&c.sort(function(e,t){return a(n[e],n[t])}),f&&h.forEach(function(e,t){e.sort(function(e,n){return f(s[t][e],s[t][n])})}),p=(2*Math.PI-u*o)/p,d=0,m=-1;while(++m<o){v=d,g=-1;while(++g<o){var y=c[m],b=h[y][g],w=s[y][b],E=d,S=d+=w*p;e[y+"-"+b]={index:y,subindex:b,startAngle:E,endAngle:S,value:w}}i[y]={index:y,startAngle:v,endAngle:d,value:(d-v)/p},d+=u}m=-1;while(++m<o){g=m-1;while(++g<o){var x=e[m+"-"+g],T=e[g+"-"+m];(x.value||T.value)&&r.push(x.value<T.value?{source:T,target:x}:{source:x,target:T})}}l&&t()}function t(){r.sort(function(e,t){return l((e.source.value+e.target.value)/2,(t.source.value+t.target.value)/2)})}var n={},r,i,s,o,u=0,a,f,l;return n.matrix=function(e){return arguments.length?(o=(s=e)&&s.length,r=i=null,n):s},n.padding=function(e){return arguments.length?(u=e,r=i=null,n):u},n.sortGroups=function(e){return arguments.length?(a=e,r=i=null,n):a},n.sortSubgroups=function(e){return arguments.length?(f=e,r=null,n):f},n.sortChords=function(e){return arguments.length?(l=e,r&&t(),n):l},n.chords=function(){return r||e(),r},n.groups=function(){return i||e(),i},n},d3.layout.force=function(){function e(e){return function(t,n,r,i,s){if(t.point!==e){var o=t.cx-e.x,u=t.cy-e.y,a=1/Math.sqrt(o*o+u*u);if((i-n)*a<d){var f=t.charge*a*a;return e.px-=o*f,e.py-=u*f,!0}if(t.point&&isFinite(a)){var f=t.pointCharge*a*a;e.px-=o*f,e.py-=u*f}}return!t.charge}}function t(e){e.px=d3.event.x,e.py=d3.event.y,n.resume()}var n={},r=d3.dispatch("start","tick","end"),s=[1,1],o,a,f=.9,l=Qn,c=Gn,h=-30,p=.1,d=.8,v,m=[],g=[],y,b,w;return n.tick=function(){if((a*=.99)<.005)return r.end({type:"end",alpha:a=0}),!0;var t=m.length,n=g.length,i,o,u,l,c,d,v,E,S;for(o=0;o<n;++o){u=g[o],l=u.source,c=u.target,E=c.x-l.x,S=c.y-l.y;if(d=E*E+S*S)d=a*b[o]*((d=Math.sqrt(d))-y[o])/d,E*=d,S*=d,c.x-=E*(v=l.weight/(c.weight+l.weight)),c.y-=S*v,l.x+=E*(v=1-v),l.y+=S*v}if(v=a*p){E=s[0]/2,S=s[1]/2,o=-1;if(v)while(++o<t)u=m[o],u.x+=(E-u.x)*v,u.y+=(S-u.y)*v}if(h){Kn(i=d3.geom.quadtree(m),a,w),o=-1;while(++o<t)(u=m[o]).fixed||i.visit(e(u))}o=-1;while(++o<t)u=m[o],u.fixed?(u.x=u.px,u.y=u.py):(u.x-=(u.px-(u.px=u.x))*f,u.y-=(u.py-(u.py=u.y))*f);r.tick({type:"tick",alpha:a})},n.nodes=function(e){return arguments.length?(m=e,n):m},n.links=function(e){return arguments.length?(g=e,n):g},n.size=function(e){return arguments.length?(s=e,n):s},n.linkDistance=function(e){return arguments.length?(l=u(e),n):l},n.distance=n.linkDistance,n.linkStrength=function(e){return arguments.length?(c=u(e),n):c},n.friction=function(e){return arguments.length?(f=e,n):f},n.charge=function(e){return arguments.length?(h=typeof e=="function"?e:+e,n):h},n.gravity=function(e){return arguments.length?(p=e,n):p},n.theta=function(e){return arguments.length?(d=e,n):d},n.alpha=function(e){return arguments.length?(a?e>0?a=e:a=0:e>0&&(r.start({type:"start",alpha:a=e}),d3.timer(n.tick)),n):a},n.start=function(){function e(e,n){var i=t(r),s=-1,o=i.length,u;while(++s<o)if(!isNaN(u=i[s][e]))return u;return Math.random()*n}function t(){if(!p){p=[];for(i=0;i<o;++i)p[i]=[];for(i=0;i<u;++i){var e=g[i];p[e.source.index].push(e.target),p[e.target.index].push(e.source)}}return p[r]}var r,i,o=m.length,u=g.length,a=s[0],f=s[1],p,d;for(r=0;r<o;++r)(d=m[r]).index=r,d.weight=0;y=[],b=[];for(r=0;r<u;++r)d=g[r],typeof d.source=="number"&&(d.source=m[d.source]),typeof d.target=="number"&&(d.target=m[d.target]),y[r]=l.call(this,d,r),b[r]=c.call(this,d,r),++d.source.weight,++d.target.weight;for(r=0;r<o;++r)d=m[r],isNaN(d.x)&&(d.x=e("x",a)),isNaN(d.y)&&(d.y=e("y",f)),isNaN(d.px)&&(d.px=d.x),isNaN(d.py)&&(d.py=d.y);w=[];if(typeof h=="function")for(r=0;r<o;++r)w[r]=+h.call(this,m[r],r);else for(r=0;r<o;++r)w[r]=h;return n.resume()},n.resume=function(){return n.alpha(.1)},n.stop=function(){return n.alpha(0)},n.drag=function(){o||(o=d3.behavior.drag().origin(i).on("dragstart",Xn).on("drag",t).on("dragend",Vn)),this.on("mouseover.force",$n).on("mouseout.force",Jn).call(o)},d3.rebind(n,r,"on")},d3.layout.partition=function(){function e(t,n,r,i){var s=t.children;t.x=n,t.y=t.depth*i,t.dx=r,t.dy=i;if(s&&(u=s.length)){var o=-1,u,a,f;r=t.value?r/t.value:0;while(++o<u)e(a=s[o],n,f=a.value*r,i),n+=f}}function t(e){var n=e.children,r=0;if(n&&(s=n.length)){var i=-1,s;while(++i<s)r=Math.max(r,t(n[i]))}return 1+r}function n(n,s){var o=r.call(this,n,s);return e(o[0],0,i[0],i[1]/t(o[0])),o}var r=d3.layout.hierarchy(),i=[1,1];return n.size=function(e){return arguments.length?(i=e,n):i},fr(n,r)},d3.layout.pie=function(){function e(s,o){var u=s.map(function(n,r){return+t.call(e,n,r)}),a=+(typeof r=="function"?r.apply(this,arguments):r),f=((typeof i=="function"?i.apply(this,arguments):i)-r)/d3.sum(u),l=d3.range(s.length);n!=null&&l.sort(n===io?function(e,t){return u[t]-u[e]}:function(e,t){return n(s[e],s[t])});var c=[];return l.forEach(function(e){var t;c[e]={data:s[e],value:t=u[e],startAngle:a,endAngle:a+=t*f}}),c}var t=Number,n=io,r=0,i=2*Math.PI;return e.value=function(n){return arguments.length?(t=n,e):t},e.sort=function(t){return arguments.length?(n=t,e):n},e.startAngle=function(t){return arguments.length?(r=t,e):r},e.endAngle=function(t){return arguments.length?(i=t,e):i},e};var io={};d3.layout.stack=function(){function e(i,a){var f=i.map(function(n,r){return t.call(e,n,r)}),l=f.map(function(t,n){return t.map(function(t,n){return[o.call(e,t,n),u.call(e,t,n)]})}),c=n.call(e,l,a);f=d3.permute(f,c),l=d3.permute(l,c);var h=r.call(e,l,a),p=f.length,d=f[0].length,v,m,g;for(m=0;m<d;++m){s.call(e,f[0][m],g=h[m],l[0][m][1]);for(v=1;v<p;++v)s.call(e,f[v][m],g+=l[v-1][m][1],l[v][m][1])}return i}var t=i,n=tr,r=nr,s=er,o=Yn,u=Zn;return e.values=function(n){return arguments.length?(t=n,e):t},e.order=function(t){return arguments.length?(n=typeof t=="function"?t:so.get(t)||tr,e):n},e.offset=function(t){return arguments.length?(r=typeof t=="function"?t:oo.get(t)||nr,e):r},e.x=function(t){return arguments.length?(o=t,e):o},e.y=function(t){return arguments.length?(u=t,e):u},e.out=function(t){return arguments.length?(s=t,e):s},e};var so=d3.map({"inside-out":function(e){var t=e.length,n,r,i=e.map(rr),s=e.map(ir),o=d3.range(t).sort(function(e,t){return i[e]-i[t]}),u=0,a=0,f=[],l=[];for(n=0;n<t;++n)r=o[n],u<a?(u+=s[r],f.push(r)):(a+=s[r],l.push(r));return l.reverse().concat(f)},reverse:function(e){return d3.range(e.length).reverse()},"default":tr}),oo=d3.map({silhouette:function(e){var t=e.length,n=e[0].length,r=[],i=0,s,o,u,a=[];for(o=0;o<n;++o){for(s=0,u=0;s<t;s++)u+=e[s][o][1];u>i&&(i=u),r.push(u)}for(o=0;o<n;++o)a[o]=(i-r[o])/2;return a},wiggle:function(e){var t=e.length,n=e[0],r=n.length,i=0,s,o,u,a,f,l,c,h,p,d=[];d[0]=h=p=0;for(o=1;o<r;++o){for(s=0,a=0;s<t;++s)a+=e[s][o][1];for(s=0,f=0,c=n[o][0]-n[o-1][0];s<t;++s){for(u=0,l=(e[s][o][1]-e[s][o-1][1])/(2*c);u<s;++u)l+=(e[u][o][1]-e[u][o-1][1])/c;f+=l*e[s][o][1]}d[o]=h-=a?f/a*c:0,h<p&&(p=h)}for(o=0;o<r;++o)d[o]-=p;return d},expand:function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,u=[];for(s=0;s<n;++s){for(i=0,o=0;i<t;i++)o+=e[i][s][1];if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)u[s]=0;return u},zero:nr});d3.layout.histogram=function(){function e(e,s){var o=[],u=e.map(n,this),a=r.call(this,u,s),f=i.call(this,a,u,s),l,s=-1,c=u.length,h=f.length-1,p=t?1:1/c,d;while(++s<h)l=o[s]=[],l.dx=f[s+1]-(l.x=f[s]),l.y=0;if(h>0){s=-1;while(++s<c)d=u[s],d>=a[0]&&d<=a[1]&&(l=o[d3.bisect(f,d,1,h)-1],l.y+=p,l.push(e[s]))}return o}var t=!0,n=Number,r=ar,i=or;return e.value=function(t){return arguments.length?(n=t,e):n},e.range=function(t){return arguments.length?(r=u(t),e):r},e.bins=function(t){return arguments.length?(i=typeof t=="number"?function(e){return ur(e,t)}:u(t),e):i},e.frequency=function(n){return arguments.length?(t=!!n,e):t},e},d3.layout.hierarchy=function(){function e(t,o,u){var a=i.call(n,t,o),f=uo?t:{data:t};f.depth=o,u.push(f);if(a&&(c=a.length)){var l=-1,c,h=f.children=[],p=0,d=o+1,v;while(++l<c)v=e(a[l],d,u),v.parent=f,h.push(v),p+=v.value;r&&h.sort(r),s&&(f.value=p)}else s&&(f.value=+s.call(n,t,o)||0);return f}function t(e,r){var i=e.children,o=0;if(i&&(a=i.length)){var u=-1,a,f=r+1;while(++u<a)o+=t(i[u],f)}else s&&(o=+s.call(n,uo?e:e.data,r)||0);return s&&(e.value=o),o}function n(t){var n=[];return e(t,0,n),n}var r=hr,i=lr,s=cr;return n.sort=function(e){return arguments.length?(r=e,n):r},n.children=function(e){return arguments.length?(i=e,n):i},n.value=function(e){return arguments.length?(s=e,n):s},n.revalue=function(e){return t(e,0),e},n};var uo=!1;d3.layout.pack=function(){function e(e,i){var s=t.call(this,e,i),o=s[0];o.x=0,o.y=0,Pr(o,function(e){e.r=Math.sqrt(e.value)}),Pr(o,yr);var u=r[0],a=r[1],f=Math.max(2*o.r/u,2*o.r/a);if(n>0){var l=n*f/2;Pr(o,function(e){e.r+=l}),Pr(o,yr),Pr(o,function(e){e.r-=l}),f=Math.max(2*o.r/u,2*o.r/a)}return Er(o,u/2,a/2,1/f),s}var t=d3.layout.hierarchy().sort(dr),n=0,r=[1,1];return e.size=function(t){return arguments.length?(r=t,e):r},e.padding=function(t){return arguments.length?(n=+t,e):n},fr(e,t)},d3.layout.cluster=function(){function e(e,i){var s=t.call(this,e,i),o=s[0],u,a=0,f,l;Pr(o,function(e){var t=e.children;t&&t.length?(e.x=Tr(t),e.y=xr(t)):(e.x=u?a+=n(e,u):0,e.y=0,u=e)});var c=Nr(o),h=Cr(o),p=c.x-n(c,h)/2,d=h.x+n(h,c)/2;return Pr(o,function(e){e.x=(e.x-p)/(d-p)*r[0],e.y=(1-(o.y?e.y/o.y:1))*r[1]}),s}var t=d3.layout.hierarchy().sort(null).value(null),n=kr,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},fr(e,t)},d3.layout.tree=function(){function e(e,i){function s(e,t){var r=e.children,i=e._tree;if(r&&(o=r.length)){var o,a=r[0],f,l=a,c,h=-1;while(++h<o)c=r[h],s(c,f),l=u(c,f,l),f=c;Hr(e);var p=.5*(a._tree.prelim+c._tree.prelim);t?(i.prelim=t._tree.prelim+n(e,t),i.mod=i.prelim-p):i.prelim=p}else t&&(i.prelim=t._tree.prelim+n(e,t))}function o(e,t){e.x=e._tree.prelim+t;var n=e.children;if(n&&(i=n.length)){var r=-1,i;t+=e._tree.mod;while(++r<i)o(n[r],t)}}function u(e,t,r){if(t){var i=e,s=e,o=t,u=e.parent.children[0],a=i._tree.mod,f=s._tree.mod,l=o._tree.mod,c=u._tree.mod,h;while(o=Ar(o),i=Lr(i),o&&i)u=Lr(u),s=Ar(s),s._tree.ancestor=e,h=o._tree.prelim+l-i._tree.prelim-a+n(o,i),h>0&&(Br(jr(o,e,r),e,h),a+=h,f+=h),l+=o._tree.mod,a+=i._tree.mod,c+=u._tree.mod,f+=s._tree.mod;o&&!Ar(s)&&(s._tree.thread=o,s._tree.mod+=l-f),i&&!Lr(u)&&(u._tree.thread=i,u._tree.mod+=a-c,r=e)}return r}var a=t.call(this,e,i),f=a[0];Pr(f,function(e,t){e._tree={ancestor:e,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),s(f),o(f,-f._tree.prelim);var l=Or(f,_r),c=Or(f,Mr),h=Or(f,Dr),p=l.x-n(l,c)/2,d=c.x+n(c,l)/2,v=h.depth||1;return Pr(f,function(e){e.x=(e.x-p)/(d-p)*r[0],e.y=e.depth/v*r[1],delete e._tree}),a}var t=d3.layout.hierarchy().sort(null).value(null),n=kr,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},fr(e,t)},d3.layout.treemap=function(){function e(e,t){var n=-1,r=e.length,i,s;while(++n<r)s=(i=e[n]).value*(t<0?0:t),i.area=isNaN(s)||s<=0?0:s}function t(n){var s=n.children;if(s&&s.length){var o=l(n),u=[],a=s.slice(),f,c=Infinity,h,p=Math.min(o.dx,o.dy),d;e(a,o.dx*o.dy/n.value),u.area=0;while((d=a.length)>0)u.push(f=a[d-1]),u.area+=f.area,(h=r(u,p))<=c?(a.pop(),c=h):(u.area-=u.pop().area,i(u,p,o,!1),p=Math.min(o.dx,o.dy),u.length=u.area=0,c=Infinity);u.length&&(i(u,p,o,!0),u.length=u.area=0),s.forEach(t)}}function n(t){var r=t.children;if(r&&r.length){var s=l(t),o=r.slice(),u,a=[];e(o,s.dx*s.dy/t.value),a.area=0;while(u=o.pop())a.push(u),a.area+=u.area,u.z!=null&&(i(a,u.z?s.dx:s.dy,s,!o.length),a.length=a.area=0);r.forEach(n)}}function r(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++o<u){if(!(r=e[o].area))continue;r<s&&(s=r),r>i&&(i=r)}return n*=n,t*=t,n?Math.max(t*i*p/n,n/(t*s*p)):Infinity}function i(e,t,n,r){var i=-1,s=e.length,o=n.x,a=n.y,f=t?u(e.area/t):0,l;if(t==n.dx){if(r||f>n.dy)f=n.dy;while(++i<s)l=e[i],l.x=o,l.y=a,l.dy=f,o+=l.dx=Math.min(n.x+n.dx-o,f?u(l.area/f):0);l.z=!0,l.dx+=n.x+n.dx-o,n.y+=f,n.dy-=f}else{if(r||f>n.dx)f=n.dx;while(++i<s)l=e[i],l.x=o,l.y=a,l.dx=f,a+=l.dy=Math.min(n.y+n.dy-a,f?u(l.area/f):0);l.z=!1,l.dy+=n.y+n.dy-a,n.x+=f,n.dx-=f}}function s(r){var i=h||o(r),s=i[0];return s.x=0,s.y=0,s.dx=a[0],s.dy=a[1],h&&o.revalue(s),e([s],s.dx*s.dy/s.value),(h?n:t)(s),c&&(h=i),i}var o=d3.layout.hierarchy(),u=Math.round,a=[1,1],f=null,l=Fr,c=!1,h,p=.5*(1+Math.sqrt(5));return s.size=function(e){return arguments.length?(a=e,s):a},s.padding=function(e){function t(t){var n=e.call(s,t,t.depth);return n==null?Fr(t):Ir(t,typeof n=="number"?[n,n,n,n]:n)}function n(t){return Ir(t,e)}if(!arguments.length)return f;var r;return l=(f=e)==null?Fr:(r=typeof e)==="function"?t:r==="number"?(e=[e,e,e,e],n):n,s},s.round=function(e){return arguments.length?(u=e?Math.round:Number,s):u!=Number},s.sticky=function(e){return arguments.length?(c=e,h=null,s):c},s.ratio=function(e){return arguments.length?(p=e,s):p},fr(s,o)},d3.csv=qr(",","text/csv"),d3.tsv=qr(" ","text/tab-separated-values"),d3.geo={};var ao=Math.PI/180;d3.geo.azimuthal=function(){function e(e){var n=e[0]*ao-s,o=e[1]*ao,f=Math.cos(n),l=Math.sin(n),c=Math.cos(o),h=Math.sin(o),p=t!=="orthographic"?a*h+u*c*f:null,d,v=t==="stereographic"?1/(1+p):t==="gnomonic"?1/p:t==="equidistant"?(d=Math.acos(p),d?d/Math.sin(d):0):t==="equalarea"?Math.sqrt(2/(1+p)):1,m=v*c*l,g=v*(a*c*f-u*h);return[r*m+i[0],r*g+i[1]]}var t="orthographic",n,r=200,i=[480,250],s,o,u,a;return e.invert=function(e){var n=(e[0]-i[0])/r,o=(e[1]-i[1])/r,f=Math.sqrt(n*n+o*o),l=t==="stereographic"?2*Math.atan(f):t==="gnomonic"?Math.atan(f):t==="equidistant"?f:t==="equalarea"?2*Math.asin(.5*f):Math.asin(f),c=Math.sin(l),h=Math.cos(l);return[(s+Math.atan2(n*c,f*u*h+o*a*c))/ao,Math.asin(h*a-(f?o*c*u/f:0))/ao]},e.mode=function(n){return arguments.length?(t=n+"",e):t},e.origin=function(t){return arguments.length?(n=t,s=n[0]*ao,o=n[1]*ao,u=Math.cos(o),a=Math.sin(o),e):n},e.scale=function(t){return arguments.length?(r=+t,e):r},e.translate=function(t){return arguments.length?(i=[+t[0],+t[1]],e):i},e.origin([0,0])},d3.geo.albers=function(){function e(e){var t=u*(ao*e[0]-o),n=Math.sqrt(a-2*u*Math.sin(ao*e[1]))/u;return[i*n*Math.sin(t)+s[0],i*(n*Math.cos(t)-f)+s[1]]}function t(){var t=ao*r[0],i=ao*r[1],s=ao*n[1],l=Math.sin(t),c=Math.cos(t);return o=ao*n[0],u=.5*(l+Math.sin(i)),a=c*c+2*u*l,f=Math.sqrt(a-2*u*Math.sin(s))/u,e}var n=[-98,38],r=[29.5,45.5],i=1e3,s=[480,250],o,u,a,f;return e.invert=function(e){var t=(e[0]-s[0])/i,n=(e[1]-s[1])/i,r=f+n,l=Math.atan2(t,r),c=Math.sqrt(t*t+r*r);return[(o+l/u)/ao,Math.asin((a-c*c*u*u)/(2*u))/ao]},e.origin=function(e){return arguments.length?(n=[+e[0],+e[1]],t()):n},e.parallels=function(e){return arguments.length?(r=[+e[0],+e[1]],t()):r},e.scale=function(t){return arguments.length?(i=+t,e):i},e.translate=function(t){return arguments.length?(s=[+t[0],+t[1]],e):s},t()},d3.geo.albersUsa=function(){function e(e){var s=e[0],o=e[1];return(o>50?n:s<-140?r:o<21?i:t)(e)}var t=d3.geo.albers(),n=d3.geo.albers().origin([-160,60]).parallels([55,65]),r=d3.geo.albers().origin([-160,20]).parallels([8,18]),i=d3.geo.albers().origin([-60,10]).parallels([8,18]);return e.scale=function(s){return arguments.length?(t.scale(s),n.scale(s*.6),r.scale(s),i.scale(s*1.5),e.translate(t.translate())):t.scale()},e.translate=function(s){if(!arguments.length)return t.translate();var o=t.scale()/1e3,u=s[0],a=s[1];return t.translate(s),n.translate([u-400*o,a+170*o]),r.translate([u-190*o,a+200*o]),i.translate([u+580*o,a+430*o]),e},e.scale(t.scale())},d3.geo.bonne=function(){function e(e){var u=e[0]*ao-r,a=e[1]*ao-i;if(s){var f=o+s-a,l=u*Math.cos(a)/f;u=f*Math.sin(l),a=f*Math.cos(l)-o}else u*=Math.cos(a),a*=-1;return[t*u+n[0],t*a+n[1]]}var t=200,n=[480,250],r,i,s,o;return e.invert=function(e){var i=(e[0]-n[0])/t,u=(e[1]-n[1])/t;if(s){var a=o+u,f=Math.sqrt(i*i+a*a);u=o+s-f,i=r+f*Math.atan2(i,a)/Math.cos(u)}else u*=-1,i/=Math.cos(u);return[i/ao,u/ao]},e.parallel=function(t){return arguments.length?(o=1/Math.tan
+(s=t*ao),e):s/ao},e.origin=function(t){return arguments.length?(r=t[0]*ao,i=t[1]*ao,e):[r/ao,i/ao]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e.origin([0,0]).parallel(45)},d3.geo.equirectangular=function(){function e(e){var r=e[0]/360,i=-e[1]/360;return[t*r+n[0],t*i+n[1]]}var t=500,n=[480,250];return e.invert=function(e){var r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return[360*r,-360*i]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e},d3.geo.mercator=function(){function e(e){var r=e[0]/360,i=-(Math.log(Math.tan(Math.PI/4+e[1]*ao/2))/ao)/360;return[t*r+n[0],t*Math.max(-0.5,Math.min(.5,i))+n[1]]}var t=500,n=[480,250];return e.invert=function(e){var r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return[360*r,2*Math.atan(Math.exp(-360*i*ao))/ao-90]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e},d3.geo.path=function(){function e(e,t){typeof s=="function"&&(o=Ur(s.apply(this,arguments))),f(e);var n=a.length?a.join(""):null;return a=[],n}function t(e){return u(e).join(",")}function n(e){var t=i(e[0]),n=0,r=e.length;while(++n<r)t-=i(e[n]);return t}function r(e){var t=d3.geom.polygon(e[0].map(u)),n=t.area(),r=t.centroid(n<0?(n*=-1,1):-1),i=r[0],s=r[1],o=n,a=0,f=e.length;while(++a<f)t=d3.geom.polygon(e[a].map(u)),n=t.area(),r=t.centroid(n<0?(n*=-1,1):-1),i-=r[0],s-=r[1],o-=n;return[i,s,6*o]}function i(e){return Math.abs(d3.geom.polygon(e.map(u)).area())}var s=4.5,o=Ur(s),u=d3.geo.albersUsa(),a=[],f=Rr({FeatureCollection:function(e){var t=e.features,n=-1,r=t.length;while(++n<r)a.push(f(t[n].geometry))},Feature:function(e){f(e.geometry)},Point:function(e){a.push("M",t(e.coordinates),o)},MultiPoint:function(e){var n=e.coordinates,r=-1,i=n.length;while(++r<i)a.push("M",t(n[r]),o)},LineString:function(e){var n=e.coordinates,r=-1,i=n.length;a.push("M");while(++r<i)a.push(t(n[r]),"L");a.pop()},MultiLineString:function(e){var n=e.coordinates,r=-1,i=n.length,s,o,u;while(++r<i){s=n[r],o=-1,u=s.length,a.push("M");while(++o<u)a.push(t(s[o]),"L");a.pop()}},Polygon:function(e){var n=e.coordinates,r=-1,i=n.length,s,o,u;while(++r<i){s=n[r],o=-1;if((u=s.length-1)>0){a.push("M");while(++o<u)a.push(t(s[o]),"L");a[a.length-1]="Z"}}},MultiPolygon:function(e){var n=e.coordinates,r=-1,i=n.length,s,o,u,f,l,c;while(++r<i){s=n[r],o=-1,u=s.length;while(++o<u){f=s[o],l=-1;if((c=f.length-1)>0){a.push("M");while(++l<c)a.push(t(f[l]),"L");a[a.length-1]="Z"}}}},GeometryCollection:function(e){var t=e.geometries,n=-1,r=t.length;while(++n<r)a.push(f(t[n]))}}),l=e.area=Rr({FeatureCollection:function(e){var t=0,n=e.features,r=-1,i=n.length;while(++r<i)t+=l(n[r]);return t},Feature:function(e){return l(e.geometry)},Polygon:function(e){return n(e.coordinates)},MultiPolygon:function(e){var t=0,r=e.coordinates,i=-1,s=r.length;while(++i<s)t+=n(r[i]);return t},GeometryCollection:function(e){var t=0,n=e.geometries,r=-1,i=n.length;while(++r<i)t+=l(n[r]);return t}},0),c=e.centroid=Rr({Feature:function(e){return c(e.geometry)},Polygon:function(e){var t=r(e.coordinates);return[t[0]/t[2],t[1]/t[2]]},MultiPolygon:function(e){var t=0,n=e.coordinates,i,s=0,o=0,u=0,a=-1,f=n.length;while(++a<f)i=r(n[a]),s+=i[0],o+=i[1],u+=i[2];return[s/u,o/u]}});return e.projection=function(t){return u=t,e},e.pointRadius=function(t){return typeof t=="function"?s=t:(s=+t,o=Ur(s)),e},e},d3.geo.bounds=function(e){var t=Infinity,n=Infinity,r=-Infinity,i=-Infinity;return zr(e,function(e,s){e<t&&(t=e),e>r&&(r=e),s<n&&(n=s),s>i&&(i=s)}),[[t,n],[r,i]]};var fo={Feature:Wr,FeatureCollection:Xr,GeometryCollection:Vr,LineString:$r,MultiLineString:Jr,MultiPoint:$r,MultiPolygon:Kr,Point:Qr,Polygon:Gr};d3.geo.circle=function(){function e(){}function t(e){return a.distance(e)<u}function n(e){var t=-1,n=e.length,i=[],s,o,f,l,c;while(++t<n)c=a.distance(f=e[t]),c<u?(o&&i.push(ti(o,f)((l-u)/(l-c))),i.push(f),s=o=null):(o=f,!s&&i.length&&(i.push(ti(i[i.length-1],o)((u-l)/(c-l))),s=o)),l=c;return s=e[0],o=i[0],o&&f[0]===s[0]&&f[1]===s[1]&&(f[0]!==o[0]||f[1]!==o[1])&&i.push(o),r(i)}function r(e){var t=0,n=e.length,r,i,s=n?[e[0]]:e,o,u=a.source();while(++t<n){o=a.source(e[t-1])(e[t]).coordinates;for(r=0,i=o.length;++r<i;)s.push(o[r])}return a.source(u),s}var s=[0,0],o=89.99,u=o*ao,a=d3.geo.greatArc().source(s).target(i);e.clip=function(e){return typeof s=="function"&&a.source(s.apply(this,arguments)),f(e)||null};var f=Rr({FeatureCollection:function(e){var t=e.features.map(f).filter(i);return t&&(e=Object.create(e),e.features=t,e)},Feature:function(e){var t=f(e.geometry);return t&&(e=Object.create(e),e.geometry=t,e)},Point:function(e){return t(e.coordinates)&&e},MultiPoint:function(e){var n=e.coordinates.filter(t);return n.length&&{type:e.type,coordinates:n}},LineString:function(e){var t=n(e.coordinates);return t.length&&(e=Object.create(e),e.coordinates=t,e)},MultiLineString:function(e){var t=e.coordinates.map(n).filter(function(e){return e.length});return t.length&&(e=Object.create(e),e.coordinates=t,e)},Polygon:function(e){var t=e.coordinates.map(n);return t[0].length&&(e=Object.create(e),e.coordinates=t,e)},MultiPolygon:function(e){var t=e.coordinates.map(function(e){return e.map(n)}).filter(function(e){return e[0].length});return t.length&&(e=Object.create(e),e.coordinates=t,e)},GeometryCollection:function(e){var t=e.geometries.map(f).filter(i);return t.length&&(e=Object.create(e),e.geometries=t,e)}});return e.origin=function(t){return arguments.length?(s=t,typeof s!="function"&&a.source(s),e):s},e.angle=function(t){return arguments.length?(u=(o=+t)*ao,e):o},d3.rebind(e,a,"precision")},d3.geo.greatArc=function(){function e(){var t=e.distance.apply(this,arguments),r=0,u=s/t,a=[n];while((r+=u)<1)a.push(o(r));return a.push(i),{type:"LineString",coordinates:a}}var t=Yr,n,r=Zr,i,s=6*ao,o=ei();return e.distance=function(){return typeof t=="function"&&o.source(n=t.apply(this,arguments)),typeof r=="function"&&o.target(i=r.apply(this,arguments)),o.distance()},e.source=function(r){return arguments.length?(t=r,typeof t!="function"&&o.source(n=t),e):t},e.target=function(t){return arguments.length?(r=t,typeof r!="function"&&o.target(i=r),e):r},e.precision=function(t){return arguments.length?(s=t*ao,e):s/ao},e},d3.geo.greatCircle=d3.geo.circle,d3.geom={},d3.geom.contour=function(e,t){var n=t||ni(e),r=[],i=n[0],s=n[1],o=0,u=0,a=NaN,f=NaN,l=0;do l=0,e(i-1,s-1)&&(l+=1),e(i,s-1)&&(l+=2),e(i-1,s)&&(l+=4),e(i,s)&&(l+=8),l===6?(o=f===-1?-1:1,u=0):l===9?(o=0,u=a===1?-1:1):(o=lo[l],u=co[l]),o!=a&&u!=f&&(r.push([i,s]),a=o,f=u),i+=o,s+=u;while(n[0]!=i||n[1]!=s);return r};var lo=[1,0,1,1,-1,0,-1,1,0,0,0,0,-1,0,-1,NaN],co=[0,-1,0,0,0,-1,0,0,1,-1,1,1,0,-1,0,NaN];d3.geom.hull=function(e){if(e.length<3)return[];var t=e.length,n=t-1,r=[],i=[],s,o,u=0,a,f,l,c,h,p,d,v;for(s=1;s<t;++s)e[s][1]<e[u][1]?u=s:e[s][1]==e[u][1]&&(u=e[s][0]<e[u][0]?s:u);for(s=0;s<t;++s){if(s===u)continue;f=e[s][1]-e[u][1],a=e[s][0]-e[u][0],r.push({angle:Math.atan2(f,a),index:s})}r.sort(function(e,t){return e.angle-t.angle}),d=r[0].angle,p=r[0].index,h=0;for(s=1;s<n;++s)o=r[s].index,d==r[s].angle?(a=e[p][0]-e[u][0],f=e[p][1]-e[u][1],l=e[o][0]-e[u][0],c=e[o][1]-e[u][1],a*a+f*f>=l*l+c*c?r[s].index=-1:(r[h].index=-1,d=r[s].angle,h=s,p=o)):(d=r[s].angle,h=s,p=o);i.push(u);for(s=0,o=0;s<2;++o)r[o].index!==-1&&(i.push(r[o].index),s++);v=i.length;for(;o<n;++o){if(r[o].index===-1)continue;while(!ri(i[v-2],i[v-1],r[o].index,e))--v;i[v++]=r[o].index}var m=[];for(s=0;s<v;++s)m.push(e[i[s]]);return m},d3.geom.polygon=function(e){return e.area=function(){var t=0,n=e.length,r=e[n-1][0]*e[0][1],i=e[n-1][1]*e[0][0];while(++t<n)r+=e[t-1][0]*e[t][1],i+=e[t-1][1]*e[t][0];return(i-r)*.5},e.centroid=function(t){var n=-1,r=e.length,i=0,s=0,o,u=e[r-1],a;arguments.length||(t=-1/(6*e.area()));while(++n<r)o=u,u=e[n],a=o[0]*u[1]-u[0]*o[1],i+=(o[0]+u[0])*a,s+=(o[1]+u[1])*a;return[i*t,s*t]},e.clip=function(t){var n,r=-1,i=e.length,s,o,u=e[i-1],a,f,l;while(++r<i){n=t.slice(),t.length=0,a=e[r],f=n[(o=n.length)-1],s=-1;while(++s<o)l=n[s],ii(l,u,a)?(ii(f,u,a)||t.push(si(f,l,u,a)),t.push(l)):ii(f,u,a)&&t.push(si(f,l,u,a)),f=l;u=a}return t},e},d3.geom.voronoi=function(e){var t=e.map(function(){return[]});return oi(e,function(e){var n,r,i,s,o,u;e.a===1&&e.b>=0?(n=e.ep.r,r=e.ep.l):(n=e.ep.l,r=e.ep.r),e.a===1?(o=n?n.y:-1e6,i=e.c-e.b*o,u=r?r.y:1e6,s=e.c-e.b*u):(i=n?n.x:-1e6,o=e.c-e.a*i,s=r?r.x:1e6,u=e.c-e.a*s);var a=[i,o],f=[s,u];t[e.region.l.index].push(a,f),t[e.region.r.index].push(a,f)}),t.map(function(t,n){var r=e[n][0],i=e[n][1];return t.forEach(function(e){e.angle=Math.atan2(e[0]-r,e[1]-i)}),t.sort(function(e,t){return e.angle-t.angle}).filter(function(e,n){return!n||e.angle-t[n-1].angle>1e-10})})};var ho={l:"r",r:"l"};d3.geom.delaunay=function(e){var t=e.map(function(){return[]}),n=[];return oi(e,function(n){t[n.region.l.index].push(e[n.region.r.index])}),t.forEach(function(t,r){var i=e[r],s=i[0],o=i[1];t.forEach(function(e){e.angle=Math.atan2(e[0]-s,e[1]-o)}),t.sort(function(e,t){return e.angle-t.angle});for(var u=0,a=t.length-1;u<a;u++)n.push([i,t[u],t[u+1]])}),n},d3.geom.quadtree=function(e,t,n,r,i){function s(e,t,n,r,i,s){if(isNaN(t.x)||isNaN(t.y))return;if(e.leaf){var u=e.point;u?Math.abs(u.x-t.x)+Math.abs(u.y-t.y)<.01?o(e,t,n,r,i,s):(e.point=null,o(e,u,n,r,i,s),o(e,t,n,r,i,s)):e.point=t}else o(e,t,n,r,i,s)}function o(e,t,n,r,i,o){var u=(n+i)*.5,a=(r+o)*.5,f=t.x>=u,l=t.y>=a,c=(l<<1)+f;e.leaf=!1,e=e.nodes[c]||(e.nodes[c]=ui()),f?n=u:i=u,l?r=a:o=a,s(e,t,n,r,i,o)}var u,a=-1,f=e.length;f&&isNaN(e[0].x)&&(e=e.map(fi));if(arguments.length<5)if(arguments.length===3)i=r=n,n=t;else{t=n=Infinity,r=i=-Infinity;while(++a<f)u=e[a],u.x<t&&(t=u.x),u.y<n&&(n=u.y),u.x>r&&(r=u.x),u.y>i&&(i=u.y);var l=r-t,c=i-n;l>c?i=n+l:r=t+c}var h=ui();return h.add=function(e){s(h,e,t,n,r,i)},h.visit=function(e){ai(e,h,t,n,r,i)},e.forEach(h.add),h},d3.time={};var po=Date,vo=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];li.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){mo.setUTCDate.apply(this._,arguments)},setDay:function(){mo.setUTCDay.apply(this._,arguments)},setFullYear:function(){mo.setUTCFullYear.apply(this._,arguments)},setHours:function(){mo.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){mo.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){mo.setUTCMinutes.apply(this._,arguments)},setMonth:function(){mo.setUTCMonth.apply(this._,arguments)},setSeconds:function(){mo.setUTCSeconds.apply(this._,arguments)},setTime:function(){mo.setTime.apply(this._,arguments)}};var mo=Date.prototype,go="%a %b %e %H:%M:%S %Y",yo="%m/%d/%y",bo="%H:%M:%S",wo=vo,Eo=wo.map(ci),So=["January","February","March","April","May","June","July","August","September","October","November","December"],xo=So.map(ci);d3.time.format=function(e){function t(t){var r=[],i=-1,s=0,o,u;while(++i<n)e.charCodeAt(i)==37&&(r.push(e.substring(s,i),(u=Po[o=e.charAt(++i)])?u(t):o),s=i+1);return r.push(e.substring(s,i)),r.join("")}var n=e.length;return t.parse=function(t){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},r=hi(n,e,t,0);if(r!=t.length)return null;"p"in n&&(n.H=n.H%12+n.p*12);var i=new po;return i.setFullYear(n.y,n.m,n.d),i.setHours(n.H,n.M,n.S,n.L),i},t.toString=function(){return e},t};var To=d3.format("02d"),No=d3.format("03d"),Co=d3.format("04d"),ko=d3.format("2d"),Lo=pi(wo),Ao=pi(Eo),Oo=pi(So),Mo=di(So),_o=pi(xo),Do=di(xo),Po={a:function(e){return Eo[e.getDay()]},A:function(e){return wo[e.getDay()]},b:function(e){return xo[e.getMonth()]},B:function(e){return So[e.getMonth()]},c:d3.time.format(go),d:function(e){return To(e.getDate())},e:function(e){return ko(e.getDate())},H:function(e){return To(e.getHours())},I:function(e){return To(e.getHours()%12||12)},j:function(e){return No(1+d3.time.dayOfYear(e))},L:function(e){return No(e.getMilliseconds())},m:function(e){return To(e.getMonth()+1)},M:function(e){return To(e.getMinutes())},p:function(e){return e.getHours()>=12?"PM":"AM"},S:function(e){return To(e.getSeconds())},U:function(e){return To(d3.time.sundayOfYear(e))},w:function(e){return e.getDay()},W:function(e){return To(d3.time.mondayOfYear(e))},x:d3.time.format(yo),X:d3.time.format(bo),y:function(e){return To(e.getFullYear()%100)},Y:function(e){return Co(e.getFullYear()%1e4)},Z:_i,"%":function(e){return"%"}},Ho={a:vi,A:mi,b:gi,B:yi,c:bi,d:Ci,e:Ci,H:ki,I:ki,L:Oi,m:Ni,M:Li,p:Mi,S:Ai,x:wi,X:Ei,y:xi,Y:Si},Bo=/^\s*\d+/,jo=d3.map({am:0,pm:1});d3.time.format.utc=function(e){function t(e){try{po=li;var t=new po;return t._=e,n(t)}finally{po=Date}}var n=d3.time.format(e);return t.parse=function(e){try{po=li;var t=n.parse(e);return t&&t._}finally{po=Date}},t.toString=n.toString,t};var Fo=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?Di:Fo,Di.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Di.toString=Fo.toString,d3.time.second=Pi(function(e){return new po(Math.floor(e/1e3)*1e3)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*1e3)},function(e){return e.getSeconds()}),d3.time.seconds=d3.time.second.range,d3.time.seconds.utc=d3.time.second.utc.range,d3.time.minute=Pi(function(e){return new po(Math.floor(e/6e4)*6e4)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*6e4)},function(e){return e.getMinutes()}),d3.time.minutes=d3.time.minute.range,d3.time.minutes.utc=d3.time.minute.utc.range,d3.time.hour=Pi(function(e){var t=e.getTimezoneOffset()/60;return new po((Math.floor(e/36e5-t)+t)*36e5)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*36e5)},function(e){return e.getHours()}),d3.time.hours=d3.time.hour.range,d3.time.hours.utc=d3.time.hour.utc.range,d3.time.day=Pi(function(e){var t=new po(1970,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1}),d3.time.days=d3.time.day.range,d3.time.days.utc=d3.time.day.utc.range,d3.time.dayOfYear=function(e){var t=d3.time.year(e);return Math.floor((e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5)},vo.forEach(function(e,t){e=e.toLowerCase(),t=7-t;var n=d3.time[e]=Pi(function(e){return(e=d3.time.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e},function(e,t){e.setDate(e.getDate()+Math.floor(t)*7)},function(e){var n=d3.time.year(e).getDay();return Math.floor((d3.time.dayOfYear(e)+(n+t)%7)/7)-(n!==t)});d3.time[e+"s"]=n.range,d3.time[e+"s"].utc=n.utc.range,d3.time[e+"OfYear"]=function(e){var n=d3.time.year(e).getDay();return Math.floor((d3.time.dayOfYear(e)+(n+t)%7)/7)}}),d3.time.week=d3.time.sunday,d3.time.weeks=d3.time.sunday.range,d3.time.weeks.utc=d3.time.sunday.utc.range,d3.time.weekOfYear=d3.time.sundayOfYear,d3.time.month=Pi(function(e){return e=d3.time.day(e),e.setDate(1),e},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()}),d3.time.months=d3.time.month.range,d3.time.months.utc=d3.time.month.utc.range,d3.time.year=Pi(function(e){return e=d3.time.day(e),e.setMonth(0,1),e},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()}),d3.time.years=d3.time.year.range,d3.time.years.utc=d3.time.year.utc.range;var Io=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],qo=[[d3.time.second,1],[d3.time.second,5],[d3.time.second,15],[d3.time.second,30],[d3.time.minute,1],[d3.time.minute,5],[d3.time.minute,15],[d3.time.minute,30],[d3.time.hour,1],[d3.time.hour,3],[d3.time.hour,6],[d3.time.hour,12],[d3.time.day,1],[d3.time.day,2],[d3.time.week,1],[d3.time.month,1],[d3.time.month,3],[d3.time.year,1]],Ro=[[d3.time.format("%Y"),function(e){return!0}],[d3.time.format("%B"),function(e){return e.getMonth()}],[d3.time.format("%b %d"),function(e){return e.getDate()!=1}],[d3.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[d3.time.format("%I %p"),function(e){return e.getHours()}],[d3.time.format("%I:%M"),function(e){return e.getMinutes()}],[d3.time.format(":%S"),function(e){return e.getSeconds()}],[d3.time.format(".%L"),function(e){return e.getMilliseconds()}]],Uo=d3.scale.linear(),zo=Ii(Ro);qo.year=function(e,t){return Uo.domain(e.map(Ri)).ticks(t).map(qi)},d3.time.scale=function(){return Bi(d3.scale.linear(),qo,zo)};var Wo=qo.map(function(e){return[e[0].utc,e[1]]}),Xo=[[d3.time.format.utc("%Y"),function(e){return!0}],[d3.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[d3.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[d3.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[d3.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[d3.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[d3.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[d3.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]],Vo=Ii(Xo);Wo.year=function(e,t){return Uo.domain(e.map(zi)).ticks(t).map(Ui)},d3.time.scale.utc=function(){return Bi(d3.scale.linear(),Wo,Vo)}})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v3.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v3.min.js
new file mode 100644
index 00000000..7975878f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v3.min.js
@@ -0,0 +1 @@
+d3=function(){function o(e){return e!=null&&!isNaN(e)}function a(e){return e.length}function f(e){var t=1;while(e*t%1)t*=10;return t}function l(e,t){try{for(var n in t){Object.defineProperty(e.prototype,n,{value:t[n],enumerable:false})}}catch(r){e.prototype=t}}function c(){}function d(){}function v(e,t,n){return function(){var r=n.apply(t,arguments);return r===t?e:r}}function m(){}function g(e){function r(){var n=t,r=-1,i=n.length,s;while(++r<i)if(s=n[r].on)s.apply(this,arguments);return e}var t=[],n=new c;r.on=function(r,i){var s=n.get(r),o;if(arguments.length<2)return s&&s.on;if(s){s.on=null;t=t.slice(0,o=t.indexOf(s)).concat(t.slice(o+1));n.remove(r)}if(i)t.push(n.set(r,{on:i}));return e};return r}function y(){e.event.stopPropagation();e.event.preventDefault()}function w(){var t=e.event,n;while(n=t.sourceEvent)t=n;return t}function E(e,t){function n(){e.on(t,null)}e.on(t,function(){y();n()},true);setTimeout(n,0)}function S(t){var n=new m,r=0,i=arguments.length;while(++r<i)n[arguments[r]]=g(n);n.of=function(r,i){return function(s){try{var o=s.sourceEvent=e.event;s.target=t;e.event=s;n[s.type].apply(r,i)}finally{e.event=o}}};return n}function T(r,i){var s=r.ownerSVGElement||r;if(s.createSVGPoint){var o=s.createSVGPoint();if(x<0&&(n.scrollX||n.scrollY)){s=e.select(t.body).append("svg").style("position","absolute").style("top",0).style("left",0);var u=s[0][0].getScreenCTM();x=!(u.f||u.e);s.remove()}if(x){o.x=i.pageX;o.y=i.pageY}else{o.x=i.clientX;o.y=i.clientY}o=o.matrixTransform(r.getScreenCTM().inverse());return[o.x,o.y]}var a=r.getBoundingClientRect();return[i.clientX-a.left-r.clientLeft,i.clientY-a.top-r.clientTop]}function C(e){var t=-1,n=e.length,r=[];while(++t<n)r.push(e[t]);return r}function k(e){return Array.prototype.slice.call(e)}function O(e){A(e,B);return e}function j(e){return function(){return M(e,this)}}function F(e){return function(){return _(e,this)}}function q(t,n){function r(){this.removeAttribute(t)}function i(){this.removeAttributeNS(t.space,t.local)}function s(){this.setAttribute(t,n)}function o(){this.setAttributeNS(t.space,t.local,n)}function u(){var e=n.apply(this,arguments);if(e==null)this.removeAttribute(t);else this.setAttribute(t,e)}function a(){var e=n.apply(this,arguments);if(e==null)this.removeAttributeNS(t.space,t.local);else this.setAttributeNS(t.space,t.local,e)}t=e.ns.qualify(t);return n==null?t.local?i:r:typeof n==="function"?t.local?a:u:t.local?o:s}function R(e){return e.trim().replace(/\s+/g," ")}function z(t){return new RegExp("(?:^|\\s+)"+e.requote(t)+"(?:\\s+|$)","g")}function W(e,t){function r(){var r=-1;while(++r<n)e[r](this,t)}function i(){var r=-1,i=t.apply(this,arguments);while(++r<n)e[r](this,i)}e=e.trim().split(/\s+/).map(X);var n=e.length;return typeof t==="function"?i:r}function X(e){var t=z(e);return function(n,r){if(i=n.classList)return r?i.add(e):i.remove(e);var i=n.getAttribute("class")||"";if(r){t.lastIndex=0;if(!t.test(i))n.setAttribute("class",R(i+" "+e))}else{n.setAttribute("class",R(i.replace(t," ")))}}}function V(e,t,n){function r(){this.style.removeProperty(e)}function i(){this.style.setProperty(e,t,n)}function s(){var r=t.apply(this,arguments);if(r==null)this.style.removeProperty(e);else this.style.setProperty(e,r,n)}return t==null?r:typeof t==="function"?s:i}function $(e,t){function n(){delete this[e]}function r(){this[e]=t}function i(){var n=t.apply(this,arguments);if(n==null)delete this[e];else this[e]=n}return t==null?n:typeof t==="function"?i:r}function J(e){return{__data__:e}}function K(e){return function(){return H(this,e)}}function Q(t){if(!arguments.length)t=e.ascending;return function(e,n){return!e-!n||t(e.__data__,n.__data__)}}function G(){}function Y(t,n,r){function a(){var e=this[i];if(e){this.removeEventListener(t,e,e.$);delete this[i]}}function f(){var e=o(n,N(arguments));a.call(this);this.addEventListener(t,this[i]=e,e.$=r);e._=n}function l(){var n=new RegExp("^__on([^.]+)"+e.requote(t)+"$"),r;for(var i in this){if(r=i.match(n)){var s=this[i];this.removeEventListener(r[1],s,s.$);delete this[i]}}}var i="__on"+t,s=t.indexOf("."),o=et;if(s>0)t=t.substring(0,s);var u=Z.get(t);if(u)t=u,o=tt;return s?n?f:a:n?G:l}function et(t,n){return function(r){var i=e.event;e.event=r;n[0]=this.__data__;try{t.apply(this,n)}finally{e.event=i}}}function tt(e,t){var n=et(e,t);return function(e){var t=this,r=e.relatedTarget;if(!r||r!==t&&!(r.compareDocumentPosition(t)&8)){n.call(t,e)}}}function nt(e,t){for(var n=0,r=e.length;n<r;n++){for(var i=e[n],s=0,o=i.length,u;s<o;s++){if(u=i[s])t(u,s,n)}}return e}function rt(e){A(e,it);return e}function ft(){}function lt(e,t,n){return new ct(e,t,n)}function ct(e,t,n){this.h=e;this.s=t;this.l=n}function pt(e,t,n){function s(e){if(e>360)e-=360;else if(e<0)e+=360;if(e<60)return r+(i-r)*e/60;if(e<180)return i;if(e<240)return r+(i-r)*(240-e)/60;return r}function o(e){return Math.round(s(e)*255)}var r,i;e=e%360;if(e<0)e+=360;t=t<0?0:t>1?1:t;n=n<0?0:n>1?1:n;i=n<=.5?n*(1+t):n+t-n*t;r=2*n-i;return qt(o(e+120),o(e),o(e-120))}function yt(e){return e>0?1:e<0?-1:0}function bt(e){return Math.acos(Math.max(-1,Math.min(1,e)))}function wt(e){return e>1?dt/2:e<-1?-dt/2:Math.asin(e)}function Et(e){return(Math.exp(e)-Math.exp(-e))/2}function St(e){return(Math.exp(e)+Math.exp(-e))/2}function xt(e){return(e=Math.sin(e/2))*e}function Tt(e,t,n){return new Nt(e,t,n)}function Nt(e,t,n){this.h=e;this.c=t;this.l=n}function kt(e,t,n){return Lt(n,Math.cos(e*=mt)*t,Math.sin(e)*t)}function Lt(e,t,n){return new At(e,t,n)}function At(e,t,n){this.l=e;this.a=t;this.b=n}function Ht(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;i=jt(i)*Mt;r=jt(r)*_t;s=jt(s)*Dt;return qt(It(3.2404542*i-1.5371385*r-.4985314*s),It(-.969266*i+1.8760108*r+.041556*s),It(.0556434*i-.2040259*r+1.0572252*s))}function Bt(e,t,n){return Tt(Math.atan2(n,t)*gt,Math.sqrt(t*t+n*n),e)}function jt(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function Ft(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function It(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function qt(e,t,n){return new Rt(e,t,n)}function Rt(e,t,n){this.r=e;this.g=t;this.b=n}function zt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function Wt(e,t,n){var r=0,i=0,s=0,o,u,a;o=/([a-z]+)\((.*)\)/i.exec(e);if(o){u=o[2].split(",");switch(o[1]){case"hsl":{return n(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100)};case"rgb":{return t(Jt(u[0]),Jt(u[1]),Jt(u[2]))}}}if(a=Kt.get(e))return t(a.r,a.g,a.b);if(e!=null&&e.charAt(0)==="#"){if(e.length===4){r=e.charAt(1);r+=r;i=e.charAt(2);i+=i;s=e.charAt(3);s+=s}else if(e.length===7){r=e.substring(1,3);i=e.substring(3,5);s=e.substring(5,7)}r=parseInt(r,16);i=parseInt(i,16);s=parseInt(s,16)}return t(r,i,s)}function Xt(e,t,n){var r=Math.min(e/=255,t/=255,n/=255),i=Math.max(e,t,n),s=i-r,o,u,a=(i+r)/2;if(s){u=a<.5?s/(i+r):s/(2-i-r);if(e==i)o=(t-n)/s+(t<n?6:0);else if(t==i)o=(n-e)/s+2;else o=(e-t)/s+4;o*=60}else{u=o=0}return lt(o,u,a)}function Vt(e,t,n){e=$t(e);t=$t(t);n=$t(n);var r=Ft((.4124564*e+.3575761*t+.1804375*n)/Mt),i=Ft((.2126729*e+.7151522*t+.072175*n)/_t),s=Ft((.0193339*e+.119192*t+.9503041*n)/Dt);return Lt(116*i-16,500*(r-i),200*(i-s))}function $t(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Jt(e){var t=parseFloat(e);return e.charAt(e.length-1)==="%"?Math.round(t*2.55):t}function Qt(e){return typeof e==="function"?e:function(){return e}}function Gt(e){return e}function Yt(e){return e.length===1?function(t,n){e(t==null?n:null)}:e}function Zt(t,n){function s(t,r,i){if(arguments.length<3)i=r,r=null;var s=e.xhr(t,n,i);s.row=function(e){return arguments.length?s.response((r=e)==null?o:u(e)):r};return s.row(r)}function o(e){return s.parse(e.responseText)}function u(e){return function(t){return s.parse(t.responseText,e)}}function a(e){return e.map(f).join(t)}function f(e){return r.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var r=new RegExp('["'+t+"\n]"),i=t.charCodeAt(0);s.parse=function(e,t){var n;return s.parseRows(e,function(e,r){if(n)return n(e,r-1);var i=new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}");n=t?function(e,n){return t(i(e),n)}:i})};s.parseRows=function(e,t){function c(){if(u>=o)return r;if(l)return l=false,n;var t=u;if(e.charCodeAt(t)===34){var s=t;while(s++<o){if(e.charCodeAt(s)===34){if(e.charCodeAt(s+1)!==34)break;++s}}u=s+2;var a=e.charCodeAt(s+1);if(a===13){l=true;if(e.charCodeAt(s+2)===10)++u}else if(a===10){l=true}return e.substring(t+1,s).replace(/""/g,'"')}while(u<o){var a=e.charCodeAt(u++),f=1;if(a===10)l=true;else if(a===13){l=true;if(e.charCodeAt(u)===10)++u,++f}else if(a!==i)continue;return e.substring(t,u-f)}return e.substring(t)}var n={},r={},s=[],o=e.length,u=0,a=0,f,l;while((f=c())!==r){var h=[];while(f!==n&&f!==r){h.push(f);f=c()}if(t&&!(h=t(h,a++)))continue;s.push(h)}return s};s.format=function(e){if(Array.isArray(e[0]))return s.formatRows(e);var n=new d,r=[];e.forEach(function(e){for(var t in e){if(!n.has(t)){r.push(n.add(t))}}});return[r.map(f).join(t)].concat(e.map(function(e){return r.map(function(t){return f(e[t])}).join(t)})).join("\n")};s.formatRows=function(e){return e.map(a).join("\n")};return s}function on(){var e,t=Date.now(),n=nn;while(n){e=t-n.then;if(e>=n.delay)n.flush=n.callback(e);n=n.next}var r=un()-t;if(r>24){if(isFinite(r)){clearTimeout(sn);sn=setTimeout(on,r)}rn=0}else{rn=1;an(on)}}function un(){var e=null,t=nn,n=Infinity;while(t){if(t.flush){delete tn[t.callback.id];t=e?e.next=t.next:nn=t.next}else{n=Math.min(n,t.then+t.delay);t=(e=t).next}}return n}function pn(e,t){var n=Math.pow(10,Math.abs(8-t)*3);return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}function mn(e,t){return t-(e?Math.ceil(Math.log(e)/Math.LN10):1)}function gn(e){return e+""}function wn(e,t){if(e&&Sn.hasOwnProperty(e.type)){Sn[e.type](e,t)}}function xn(e,t,n){var r=-1,i=e.length-n,s;t.lineStart();while(++r<i)s=e[r],t.point(s[0],s[1]);t.lineEnd()}function Tn(e,t){var n=-1,r=e.length;t.polygonStart();while(++n<r)xn(e[n],t,1);t.polygonEnd()}function An(){function s(e,t){e*=mt;t=t*mt/2+dt/4;var s=e-n,o=Math.cos(t),u=Math.sin(t),a=i*u,f=Cn,l=kn,c=r*o+a*Math.cos(s),h=a*Math.sin(s);Cn=f*c-l*h;kn=l*c+f*h;n=e,r=o,i=u}var e,t,n,r,i;Ln.point=function(o,u){Ln.point=s;n=(e=o)*mt,r=Math.cos(u=(t=u)*mt/2+dt/4),i=Math.sin(u)};Ln.lineEnd=function(){s(e,t)}}function On(t){function u(e,t){if(e<n)n=e;if(e>i)i=e;if(t<r)r=t;if(t>s)s=t}function a(){o.point=o.lineEnd=G}var n,r,i,s;var o={point:u,lineStart:G,lineEnd:G,polygonStart:function(){o.lineEnd=a},polygonEnd:function(){o.point=u}};return function(u){s=i=-(n=r=Infinity);e.geo.stream(u,t(o));return[[n,r],[i,s]]}}function jn(e,t){if(Mn)return;++_n;e*=mt;var n=Math.cos(t*=mt);Dn+=(n*Math.cos(e)-Dn)/_n;Pn+=(n*Math.sin(e)-Pn)/_n;Hn+=(Math.sin(t)-Hn)/_n}function Fn(){var e,t;Mn=1;In();Mn=2;var n=Bn.point;Bn.point=function(r,i){n(e=r,t=i)};Bn.lineEnd=function(){Bn.point(e,t);qn();Bn.lineEnd=qn}}function In(){function r(r,i){r*=mt;var s=Math.cos(i*=mt),o=s*Math.cos(r),u=s*Math.sin(r),a=Math.sin(i),f=Math.atan2(Math.sqrt((f=t*a-n*u)*f+(f=n*o-e*a)*f+(f=e*u-t*o)*f),e*o+t*u+n*a);_n+=f;Dn+=f*(e+(e=o));Pn+=f*(t+(t=u));Hn+=f*(n+(n=a))}var e,t,n;if(Mn>1)return;if(Mn<1){Mn=1;_n=Dn=Pn=Hn=0}Bn.point=function(i,s){i*=mt;var o=Math.cos(s*=mt);e=o*Math.cos(i);t=o*Math.sin(i);n=Math.sin(s);Bn.point=r}}function qn(){Bn.point=jn}function Rn(e){var t=e[0],n=e[1],r=Math.cos(n);return[r*Math.cos(t),r*Math.sin(t),Math.sin(n)]}function Un(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function zn(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Wn(e,t){e[0]+=t[0];e[1]+=t[1];e[2]+=t[2]}function Xn(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Vn(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t;e[1]/=t;e[2]/=t}function $n(){return true}function Jn(e){return[Math.atan2(e[1],e[0]),Math.asin(Math.max(-1,Math.min(1,e[2])))]}function Kn(e,t){return Math.abs(e[0]-t[0])<vt&&Math.abs(e[1]-t[1])<vt}function Qn(e,t,n,r,i){var s=[],o=[];e.forEach(function(e){if((t=e.length-1)<=0)return;var t,n=e[0],r=e[t];if(Kn(n,r)){i.lineStart();for(var u=0;u<t;++u)i.point((n=e[u])[0],n[1]);i.lineEnd();return}var a={point:n,points:e,other:null,visited:false,entry:true,subject:true},f={point:n,points:[n],other:a,visited:false,entry:false,subject:false};a.other=f;s.push(a);o.push(f);a={point:r,points:[r],other:null,visited:false,entry:false,subject:true};f={point:r,points:[r],other:a,visited:false,entry:true,subject:false};a.other=f;s.push(a);o.push(f)});o.sort(t);Gn(s);Gn(o);if(!s.length)return;if(n)for(var u=1,a=!n(o[0].point),f=o.length;u<f;++u){o[u].entry=a=!a}var l=s[0],c,h,p;while(1){c=l;while(c.visited)if((c=c.next)===l)return;h=c.points;i.lineStart();do{c.visited=c.other.visited=true;if(c.entry){if(c.subject){for(var u=0;u<h.length;u++)i.point((p=h[u])[0],p[1])}else{r(c.point,c.next.point,1,i)}c=c.next}else{if(c.subject){h=c.prev.points;for(var u=h.length;--u>=0;)i.point((p=h[u])[0],p[1])}else{r(c.point,c.prev.point,-1,i)}c=c.prev}c=c.other;h=c.points}while(!c.visited);i.lineEnd()}}function Gn(e){if(!(t=e.length))return;var t,n=0,r=e[0],i;while(++n<t){r.next=i=e[n];i.prev=r;r=i}r.next=i=e[0];i.prev=r}function Yn(t,n,r){return function(i){function u(e,n){if(t(e,n))i.point(e,n)}function a(e,t){s.point(e,t)}function f(){o.point=a;s.lineStart()}function l(){o.point=u;s.lineEnd()}function y(e,t){m.point(e,t);g.push([e,t])}function b(){m.lineStart();g=[]}function w(){y(g[0][0],g[0][1]);m.lineEnd();var e=m.clean(),t=v.buffer(),n,r=t.length;if(!r){d=true;p+=tr(g,-1);g=null;return}g=null;if(e&1){n=t[0];h+=tr(n,1);var r=n.length-1,s=-1,o;i.lineStart();while(++s<r)i.point((o=n[s])[0],o[1]);i.lineEnd();return}if(r>1&&e&2)t.push(t.pop().concat(t.shift()));c.push(t.filter(Zn))}var s=n(i);var o={point:u,lineStart:f,lineEnd:l,polygonStart:function(){o.point=y;o.lineStart=b;o.lineEnd=w;d=false;p=h=0;c=[];i.polygonStart()},polygonEnd:function(){o.point=u;o.lineStart=f;o.lineEnd=l;c=e.merge(c);if(c.length){Qn(c,nr,null,r,i)}else if(h<-vt||d&&p<-vt){i.lineStart();r(null,null,1,i);i.lineEnd()}i.polygonEnd();c=null},sphere:function(){i.polygonStart();i.lineStart();r(null,null,1,i);i.lineEnd();i.polygonEnd()}};var c,h,p,d;var v=er(),m=n(v),g;return o}}function Zn(e){return e.length>1}function er(){var e=[],t;return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:G,buffer:function(){var n=e;e=[];t=null;return n},rejoin:function(){if(e.length>1)e.push(e.pop().concat(e.shift()))}}}function tr(e,t){if(!(n=e.length))return 0;var n,r=0,i=0,s=e[0],o=s[0],u=s[1],a=Math.cos(u),f=Math.atan2(t*Math.sin(o)*a,Math.sin(u)),l=1-t*Math.cos(o)*a,c=f,h,p;while(++r<n){s=e[r];a=Math.cos(u=s[1]);h=Math.atan2(t*Math.sin(o=s[0])*a,Math.sin(u));p=1-t*Math.cos(o)*a;if(Math.abs(l-2)<vt&&Math.abs(p-2)<vt)continue;if(Math.abs(p)<vt||Math.abs(l)<vt){}else if(Math.abs(Math.abs(h-f)-dt)<vt){if(p+l>2)i+=4*(h-f)}else if(Math.abs(l-2)<vt)i+=4*(h-c);else i+=((3*dt+h-f)%(2*dt)-dt)*(l+p);c=f,f=h,l=p}return i}function nr(e,t){return((e=e.point)[0]<0?e[1]-dt/2-vt:dt/2-e[1])-((t=t.point)[0]<0?t[1]-dt/2-vt:dt/2-t[1])}function ir(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart();i=1},point:function(s,o){var u=s>0?dt:-dt,a=Math.abs(s-t);if(Math.abs(a-dt)<vt){e.point(t,n=(n+o)/2>0?dt/2:-dt/2);e.point(r,n);e.lineEnd();e.lineStart();e.point(u,n);e.point(s,n);i=0}else if(r!==u&&a>=dt){if(Math.abs(t-r)<vt)t-=r*vt;if(Math.abs(s-u)<vt)s-=u*vt;n=sr(t,n,s,o);e.point(r,n);e.lineEnd();e.lineStart();e.point(u,n);i=0}e.point(t=s,n=o);r=u},lineEnd:function(){e.lineEnd();t=n=NaN},clean:function(){return 2-i}}}function sr(e,t,n,r){var i,s,o=Math.sin(e-n);return Math.abs(o)>vt?Math.atan((Math.sin(t)*(s=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(t))*Math.sin(e))/(i*s*o)):(t+r)/2}function or(e,t,n,r){var i;if(e==null){i=n*dt/2;r.point(-dt,i);r.point(0,i);r.point(dt,i);r.point(dt,0);r.point(dt,-i);r.point(0,-i);r.point(-dt,-i);r.point(-dt,0);r.point(-dt,i)}else if(Math.abs(e[0]-t[0])>vt){var s=(e[0]<t[0]?1:-1)*dt;i=n*s/2;r.point(-s,i);r.point(0,i);r.point(s,i)}else{r.point(t[0],t[1])}}function ur(e){function s(e,n){return Math.cos(e)*Math.cos(n)>t}function o(e){var t,i,o,f,l;return{lineStart:function(){f=o=false;l=1},point:function(c,h){var p=[c,h],d,v=s(c,h),m=n?v?0:a(c,h):v?a(c+(c<0?dt:-dt),h):0;if(!t&&(f=o=v))e.lineStart();if(v!==o){d=u(t,p);if(Kn(t,d)||Kn(p,d)){p[0]+=vt;p[1]+=vt;v=s(p[0],p[1])}}if(v!==o){l=0;if(v){e.lineStart();d=u(p,t);e.point(d[0],d[1])}else{d=u(t,p);e.point(d[0],d[1]);e.lineEnd()}t=d}else if(r&&t&&n^v){var g;if(!(m&i)&&(g=u(p,t,true))){l=0;if(n){e.lineStart();e.point(g[0][0],g[0][1]);e.point(g[1][0],g[1][1]);e.lineEnd()}else{e.point(g[1][0],g[1][1]);e.lineEnd();e.lineStart();e.point(g[0][0],g[0][1])}}}if(v&&(!t||!Kn(t,p))){e.point(p[0],p[1])}t=p,o=v,i=m},lineEnd:function(){if(o)e.lineEnd();t=null},clean:function(){return l|(f&&o)<<1}}}function u(e,n,r){var i=Rn(e),s=Rn(n);var o=[1,0,0],u=zn(i,s),a=Un(u,u),f=u[0],l=a-f*f;if(!l)return!r&&e;var c=t*a/l,h=-t*f/l,p=zn(o,u),d=Xn(o,c),v=Xn(u,h);Wn(d,v);var m=p,g=Un(d,m),y=Un(m,m),b=g*g-y*(Un(d,d)-1);if(b<0)return;var w=Math.sqrt(b),E=Xn(m,(-g-w)/y);Wn(E,d);E=Jn(E);if(!r)return E;var S=e[0],x=n[0],T=e[1],N=n[1],C;if(x<S)C=S,S=x,x=C;var k=x-S,L=Math.abs(k-dt)<vt,A=L||k<vt;if(!L&&N<T)C=T,T=N,N=C;if(A?L?T+N>0^E[1]<(Math.abs(E[0]-S)<vt?T:N):T<=E[1]&&E[1]<=N:k>dt^(S<=E[0]&&E[0]<=x)){var O=Xn(m,(-g+w)/y);Wn(O,d);return[E,Jn(O)]}}function a(t,r){var i=n?e:dt-e,s=0;if(t<-i)s|=1;else if(t>i)s|=2;if(r<-i)s|=4;else if(r>i)s|=8;return s}var t=Math.cos(e),n=t>0,r=Math.abs(t)>vt,i=Er(e,6*mt);return Yn(s,o,i)}function fr(t,n,r,i){function s(e,i){return Math.abs(e[0]-t)<vt?i>0?0:3:Math.abs(e[0]-r)<vt?i>0?2:1:Math.abs(e[1]-n)<vt?i>0?1:0:i>0?3:2}function o(e,t){return u(e.point,t.point)}function u(e,t){var n=s(e,1),r=s(t,1);return n!==r?n-r:n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]}function a(e,s){var o=s[0]-e[0],u=s[1]-e[1],a=[0,1];if(Math.abs(o)<vt&&Math.abs(u)<vt)return t<=e[0]&&e[0]<=r&&n<=e[1]&&e[1]<=i;if(lr(t-e[0],o,a)&&lr(e[0]-r,-o,a)&&lr(n-e[1],u,a)&&lr(e[1]-i,-u,a)){if(a[1]<1){s[0]=e[0]+a[1]*o;s[1]=e[1]+a[1]*u}if(a[0]>0){e[0]+=a[0]*o;e[1]+=a[0]*u}return true}return false}return function(f){function m(e){var o=s(e,-1),u=g([o===0||o===3?t:r,o>1?i:n]);return u}function g(e){var t=0,n=p.length,r=e[1];for(var i=0;i<n;++i){for(var s=1,o=p[i],u=o.length,a=o[0];s<u;++s){b=o[s];if(a[1]<=r){if(b[1]>r&&y(a,b,e)>0)++t}else{if(b[1]<=r&&y(a,b,e)<0)--t}a=b}}return t!==0}function y(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1])}function w(e,o,a,f){var l=0,c=0;if(e==null||(l=s(e,a))!==(c=s(o,a))||u(e,o)<0^a>0){do{f.point(l===0||l===3?t:r,l>1?i:n)}while((l=(l+a+4)%4)!==c)}else{f.point(o[0],o[1])}}function E(e,s){return t<=e&&e<=r&&n<=s&&s<=i}function S(e,t){if(E(e,t))f.point(e,t)}function O(){v.point=_;if(p)p.push(d=[]);A=true;L=false;C=k=NaN}function M(){if(h){_(x,T);if(N&&L)c.rejoin();h.push(c.buffer())}v.point=S;if(L)f.lineEnd()}function _(e,t){e=Math.max(-ar,Math.min(ar,e));t=Math.max(-ar,Math.min(ar,t));var n=E(e,t);if(p)d.push([e,t]);if(A){x=e,T=t,N=n;A=false;if(n){f.lineStart();f.point(e,t)}}else{if(n&&L)f.point(e,t);else{var r=[C,k],i=[e,t];if(a(r,i)){if(!L){f.lineStart();f.point(r[0],r[1])}f.point(i[0],i[1]);if(!n)f.lineEnd()}else{f.lineStart();f.point(e,t)}}}C=e,k=t,L=n}var l=f,c=er(),h,p,d;var v={point:S,lineStart:O,lineEnd:M,polygonStart:function(){f=c;h=[];p=[]},polygonEnd:function(){f=l;if((h=e.merge(h)).length){f.polygonStart();Qn(h,o,m,w,f);f.polygonEnd()}else if(g([t,n])){f.polygonStart(),f.lineStart();w(null,null,1,f);f.lineEnd(),f.polygonEnd()}h=p=d=null}};var x,T,N,C,k,L,A;return v}}function lr(e,t,n){if(Math.abs(t)<vt)return e<=0;var r=e/t;if(t>0){if(r>n[1])return false;if(r>n[0])n[0]=r}else{if(r<n[0])return false;if(r<n[1])n[1]=r}return true}function cr(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}if(e.invert&&t.invert)n.invert=function(n,r){return n=t.invert(n,r),n&&e.invert(n[0],n[1])};return n}function hr(e){function r(t){function c(n,r){n=e(n,r);t.point(n[0],n[1])}function h(){s=NaN;l.point=p;t.lineStart()}function p(l,c){var h=Rn([l,c]),p=e(l,c);i(s,o,r,u,a,f,s=p[0],o=p[1],r=l,u=h[0],a=h[1],f=h[2],n,t);t.point(s,o)}function d(){l.point=c;t.lineEnd()}function v(){var e,c,v,m,g,y,b;h();l.point=function(t,n){p(e=t,c=n),v=s,m=o,g=u,y=a,b=f;l.point=p};l.lineEnd=function(){i(s,o,r,u,a,f,v,m,e,g,y,b,n,t);l.lineEnd=d;d()}}var r,s,o,u,a,f;var l={point:c,lineStart:h,lineEnd:d,polygonStart:function(){t.polygonStart();l.lineStart=v},polygonEnd:function(){t.polygonEnd();l.lineStart=h}};return l}function i(n,r,s,o,u,a,f,l,c,h,p,d,v,m){var g=f-n,y=l-r,b=g*g+y*y;if(b>4*t&&v--){var w=o+h,E=u+p,S=a+d,x=Math.sqrt(w*w+E*E+S*S),T=Math.asin(S/=x),N=Math.abs(Math.abs(S)-1)<vt?(s+c)/2:Math.atan2(E,w),C=e(N,T),k=C[0],L=C[1],A=k-n,O=L-r,M=y*A-g*O;if(M*M/b>t||Math.abs((g*A+y*O)/b-.5)>.3){i(n,r,s,o,u,a,k,L,N,w/=x,E/=x,S,v,m);m.point(k,L);i(k,L,N,w,E,S,f,l,c,h,p,d,v,m)}}}var t=.5,n=16;r.precision=function(e){if(!arguments.length)return Math.sqrt(t);n=(t=e*e)>0&&16;return r};return r}function pr(e){return dr(function(){return e})()}function dr(t){function w(e){e=i(e[0]*mt,e[1]*mt);return[e[0]*o+d,v-e[1]*o]}function E(e){e=i.invert((e[0]-d)/o,(v-e[1])/o);return e&&[e[0]*gt,e[1]*gt]}function S(){i=cr(r=gr(c,h,p),n);var e=n(f,l);d=u-e[0]*o;v=a+e[1]*o;return w}var n,r,i,s=hr(function(e,t){e=n(e,t);return[e[0]*o+d,v-e[1]*o]}),o=150,u=480,a=250,f=0,l=0,c=0,h=0,p=0,d,v,m=rr,g=Gt,y=null,b=null;w.stream=function(e){return vr(r,m(s(g(e))))};w.clipAngle=function(e){if(!arguments.length)return y;m=e==null?(y=e,rr):ur((y=+e)*mt);return w};w.clipExtent=function(e){if(!arguments.length)return b;b=e;g=e==null?Gt:fr(e[0][0],e[0][1],e[1][0],e[1][1]);return w};w.scale=function(e){if(!arguments.length)return o;o=+e;return S()};w.translate=function(e){if(!arguments.length)return[u,a];u=+e[0];a=+e[1];return S()};w.center=function(e){if(!arguments.length)return[f*gt,l*gt];f=e[0]%360*mt;l=e[1]%360*mt;return S()};w.rotate=function(e){if(!arguments.length)return[c*gt,h*gt,p*gt];c=e[0]%360*mt;h=e[1]%360*mt;p=e.length>2?e[2]%360*mt:0;return S()};e.rebind(w,s,"precision");return function(){n=t.apply(this,arguments);w.invert=n.invert&&E;return S()}}function vr(e,t){return{point:function(n,r){r=e(n*mt,r*mt),n=r[0];t.point(n>dt?n-2*dt:n<-dt?n+2*dt:n,r[1])},sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function mr(e,t){return[e,t]}function gr(e,t,n){return e?t||n?cr(br(e),wr(t,n)):br(e):t||n?wr(t,n):mr}function yr(e){return function(t,n){return t+=e,[t>dt?t-2*dt:t<-dt?t+2*dt:t,n]}}function br(e){var t=yr(e);t.invert=yr(-e);return t}function wr(e,t){function o(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*n+u*r;return[Math.atan2(a*i-l*s,u*n-f*r),Math.asin(Math.max(-1,Math.min(1,l*i+a*s)))]}var n=Math.cos(e),r=Math.sin(e),i=Math.cos(t),s=Math.sin(t);o.invert=function(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*i-a*s;return[Math.atan2(a*i+f*s,u*n+l*r),Math.asin(Math.max(-1,Math.min(1,l*n-u*r)))]};return o}function Er(e,t){var n=Math.cos(e),r=Math.sin(e);return function(i,s,o,u){if(i!=null){i=Sr(n,i);s=Sr(n,s);if(o>0?i<s:i>s)i+=o*2*dt}else{i=e+o*2*dt;s=e}var a;for(var f=o*t,l=i;o>0?l>s:l<s;l-=f){u.point((a=Jn([n,-r*Math.cos(l),-r*Math.sin(l)]))[0],a[1])}}}function Sr(e,t){var n=Rn(t);n[0]-=e;Vn(n);var r=bt(-n[1]);return((-n[2]<0?-r:r)+2*Math.PI-vt)%(2*Math.PI)}function xr(t,n,r){var i=e.range(t,n-vt,r).concat(n);return function(e){return i.map(function(t){return[e,t]})}}function Tr(t,n,r){var i=e.range(t,n-vt,r).concat(n);return function(e){return i.map(function(t){return[t,e]})}}function Nr(e){return e.source}function Cr(e){return e.target}function kr(e,t,n,r){var i=Math.cos(t),s=Math.sin(t),o=Math.cos(r),u=Math.sin(r),a=i*Math.cos(e),f=i*Math.sin(e),l=o*Math.cos(n),c=o*Math.sin(n),h=2*Math.asin(Math.sqrt(xt(r-t)+i*o*xt(n-e))),p=1/Math.sin(h);var d=h?function(e){var t=Math.sin(e*=h)*p,n=Math.sin(h-e)*p,r=n*a+t*l,i=n*f+t*c,o=n*s+t*u;return[Math.atan2(i,r)*gt,Math.atan2(o,Math.sqrt(r*r+i*i))*gt]}:function(){return[e*gt,t*gt]};d.distance=h;return d}function Or(){function r(r,i){var s=Math.sin(i*=mt),o=Math.cos(i),u=Math.abs((r*=mt)-e),a=Math.cos(u);Lr+=Math.atan2(Math.sqrt((u=o*Math.sin(u))*u+(u=n*s-t*o*a)*u),t*s+n*o*a);e=r,t=s,n=o}var e,t,n;Ar.point=function(i,s){e=i*mt,t=Math.sin(s*=mt),n=Math.cos(s);Ar.point=r};Ar.lineEnd=function(){Ar.point=Ar.lineEnd=G}}function Mr(e){var t=0,n=dt/3,r=dr(e),i=r(t,n);i.parallels=function(e){if(!arguments.length)return[t/dt*180,n/dt*180];return r(t=e[0]*dt/180,n=e[1]*dt/180)};return i}function _r(e,t){function o(e,t){var n=Math.sqrt(i-2*r*Math.sin(t))/r;return[n*Math.sin(e*=r),s-n*Math.cos(e)]}var n=Math.sin(e),r=(n+Math.sin(t))/2,i=1+n*(2*r-n),s=Math.sqrt(i)/r;o.invert=function(e,t){var n=s-t;return[Math.atan2(e,n)/r,Math.asin((i-(e*e+n*n)*r*r)/(2*r))]};return o}function Dr(e,t){var n=e(t[0]),r=e([.5*(t[0][0]+t[1][0]),t[0][1]]),i=e([t[1][0],t[0][1]]),s=e(t[1]);var o=r[1]-n[1],u=r[0]-n[0],a=i[1]-r[1],f=i[0]-r[0];var l=o/u,c=a/f;var h=.5*(l*c*(n[1]-i[1])+c*(n[0]+r[0])-l*(r[0]+i[0]))/(c-l),p=(.5*(n[0]+r[0])-h)/l+.5*(n[1]+r[1]);var d=s[0]-h,v=s[1]-p,m=n[0]-h,g=n[1]-p,y=d*d+v*v,b=m*m+g*g;var w=Math.atan2(v,d),E=Math.atan2(g,m);return function(t){var n=t[0]-h,r=t[1]-p,i=n*n+r*r,s=Math.atan2(r,n);if(y<i&&i<b&&w<s&&s<E)return e.invert(t)}}function jr(){function i(e,t){Hr+=r*e-n*t;n=e,r=t}var e,t,n,r;Br.point=function(s,o){Br.point=i;e=n=s,t=r=o};Br.lineEnd=function(){i(e,t)}}function Fr(){function r(n,r){t.push("M",n,",",r,e)}function i(e,r){t.push("M",e,",",r);n.point=s}function s(e,n){t.push("L",e,",",n)}function o(){n.point=r}function u(){t.push("Z")}var e=Xr(4.5),t=[];var n={point:r,lineStart:function(){n.point=i},lineEnd:o,polygonStart:function(){n.lineEnd=u},polygonEnd:function(){n.lineEnd=o;n.point=r},pointRadius:function(t){e=Xr(t);return n},result:function(){if(t.length){var e=t.join("");t=[];return e}}};return n}function qr(e,t){if(Mn)return;Dn+=e;Pn+=t;++Hn}function Rr(){function n(n,r){var i=n-e,s=r-t,o=Math.sqrt(i*i+s*s);Dn+=o*(e+n)/2;Pn+=o*(t+r)/2;Hn+=o;e=n,t=r}var e,t;if(Mn!==1){if(Mn<1){Mn=1;Dn=Pn=Hn=0}else return}Ir.point=function(r,i){Ir.point=n;e=r,t=i}}function Ur(){Ir.point=qr}function zr(){function i(e,t){var i=r*e-n*t;Dn+=i*(n+e);Pn+=i*(r+t);Hn+=i*3;n=e,r=t}var e,t,n,r;if(Mn<2){Mn=2;Dn=Pn=Hn=0}Ir.point=function(s,o){Ir.point=i;e=n=s,t=r=o};Ir.lineEnd=function(){i(e,t)}}function Wr(e){function r(n,r){e.moveTo(n,r);e.arc(n,r,t,0,2*dt)}function i(t,r){e.moveTo(t,r);n.point=s}function s(t,n){e.lineTo(t,n)}function o(){n.point=r}function u(){e.closePath()}var t=4.5;var n={point:r,lineStart:function(){n.point=i},lineEnd:o,polygonStart:function(){n.lineEnd=u},polygonEnd:function(){n.lineEnd=o;n.point=r},pointRadius:function(e){t=e;return n},result:G};return n}function Xr(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+ -2*e+"a"+e+","+e+" 0 1,1 0,"+ +2*e+"z"}function Vr(e){var t=hr(function(t,n){return e([t*gt,n*gt])});return function(e){e=t(e);return{point:function(t,n){e.point(t*mt,n*mt)},sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}}function $r(e,t){function n(t,n){var r=Math.cos(t),i=Math.cos(n),s=e(r*i);return[s*i*Math.sin(t),s*Math.sin(n)]}n.invert=function(e,n){var r=Math.sqrt(e*e+n*n),i=t(r),s=Math.sin(i),o=Math.cos(i);return[Math.atan2(e*s,r*o),Math.asin(r&&n*s/r)]};return n}function Qr(e,t){function o(e,t){var n=Math.abs(Math.abs(t)-dt/2)<vt?0:s/Math.pow(r(t),i);return[n*Math.sin(i*e),s-n*Math.cos(i*e)]}var n=Math.cos(e),r=function(e){return Math.tan(dt/4+e/2)},i=e===t?Math.sin(e):Math.log(n/Math.cos(t))/Math.log(r(t)/r(e)),s=n*Math.pow(r(e),i)/i;if(!i)return Zr;o.invert=function(e,t){var n=s-t,r=yt(i)*Math.sqrt(e*e+n*n);return[Math.atan2(e,n)/i,2*Math.atan(Math.pow(s/r,1/i))-dt/2]};return o}function Gr(e,t){function s(e,t){var n=i-t;return[n*Math.sin(r*e),i-n*Math.cos(r*e)]}var n=Math.cos(e),r=e===t?Math.sin(e):(n-Math.cos(t))/(t-e),i=n/r+e;if(Math.abs(r)<vt)return mr;s.invert=function(e,t){var n=i-t;return[Math.atan2(e,n)/r,i-yt(r)*Math.sqrt(e*e+n*n)]};return s}function Zr(e,t){return[e,Math.log(Math.tan(dt/4+t/2))]}function ei(e){var t=pr(e),n=t.scale,r=t.translate,i=t.clipExtent,s;t.scale=function(){var e=n.apply(t,arguments);return e===t?s?t.clipExtent(null):t:e};t.translate=function(){var e=r.apply(t,arguments);return e===t?s?t.clipExtent(null):t:e};t.clipExtent=function(e){var o=i.apply(t,arguments);if(o===t){if(s=e==null){var u=dt*n(),a=r();i([[a[0]-u,a[1]-u],[a[0]+u,a[1]+u]])}}else if(s){o=null}return o};return t.clipExtent(null)}function ri(e,t){var n=Math.cos(t)*Math.sin(e);return[Math.log((1+n)/(1-n))/2,Math.atan2(Math.tan(t),Math.cos(e))]}function ii(e){function u(s){function d(){u.push("M",i(e(a),o))}var u=[],a=[],f=-1,l=s.length,c,h=Qt(t),p=Qt(n);while(++f<l){if(r.call(this,c=s[f],f)){a.push([+h.call(this,c,f),+p.call(this,c,f)])}else if(a.length){d();a=[]}}if(a.length)d();return u.length?u.join(""):null}var t=si,n=oi,r=$n,i=ai,s=i.key,o=.7;u.x=function(e){if(!arguments.length)return t;t=e;return u};u.y=function(e){if(!arguments.length)return n;n=e;return u};u.defined=function(e){if(!arguments.length)return r;r=e;return u};u.interpolate=function(e){if(!arguments.length)return s;if(typeof e==="function")s=i=e;else s=(i=ui.get(e)||ai).key;return u};u.tension=function(e){if(!arguments.length)return o;o=e;return u};return u}function si(e){return e[0]}function oi(e){return e[1]}function ai(e){return e.join("L")}function fi(e){return ai(e)+"Z"}function li(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("V",(r=e[t])[1],"H",r[0]);return i.join("")}function ci(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("H",(r=e[t])[0],"V",r[1]);return i.join("")}function hi(e,t){return e.length<4?ai(e):e[1]+vi(e.slice(1,e.length-1),mi(e,t))}function pi(e,t){return e.length<3?ai(e):e[0]+vi((e.push(e[0]),e),mi([e[e.length-2]].concat(e,[e[1]]),t))}function di(e,t){return e.length<3?ai(e):e[0]+vi(e,mi(e,t))}function vi(e,t){if(t.length<1||e.length!=t.length&&e.length!=t.length+2){return ai(e)}var n=e.length!=t.length,r="",i=e[0],s=e[1],o=t[0],u=o,a=1;if(n){r+="Q"+(s[0]-o[0]*2/3)+","+(s[1]-o[1]*2/3)+","+s[0]+","+s[1];i=e[1];a=2}if(t.length>1){u=t[1];s=e[a];a++;r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f<t.length;f++,a++){s=e[a];u=t[f];r+="S"+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1]}}if(n){var l=e[a];r+="Q"+(s[0]+u[0]*2/3)+","+(s[1]+u[1]*2/3)+","+l[0]+","+l[1]}return r}function mi(e,t){var n=[],r=(1-t)/2,i,s=e[0],o=e[1],u=1,a=e.length;while(++u<a){i=s;s=o;o=e[u];n.push([r*(o[0]-i[0]),r*(o[1]-i[1])])}return n}function gi(e){if(e.length<3)return ai(e);var t=1,n=e.length,r=e[0],i=r[0],s=r[1],o=[i,i,i,(r=e[1])[0]],u=[s,s,s,r[1]],a=[i,",",s];Ni(a,o,u);while(++t<n){r=e[t];o.shift();o.push(r[0]);u.shift();u.push(r[1]);Ni(a,o,u)}t=-1;while(++t<2){o.shift();o.push(r[0]);u.shift();u.push(r[1]);Ni(a,o,u)}return a.join("")}function yi(e){if(e.length<4)return ai(e);var t=[],n=-1,r=e.length,i,s=[0],o=[0];while(++n<3){i=e[n];s.push(i[0]);o.push(i[1])}t.push(Ei(Ti,s)+","+Ei(Ti,o));--n;while(++n<r){i=e[n];s.shift();s.push(i[0]);o.shift();o.push(i[1]);Ni(t,s,o)}return t.join("")}function bi(e){var t,n=-1,r=e.length,i=r+4,s,o=[],u=[];while(++n<4){s=e[n%r];o.push(s[0]);u.push(s[1])}t=[Ei(Ti,o),",",Ei(Ti,u)];--n;while(++n<i){s=e[n%r];o.shift();o.push(s[0]);u.shift();u.push(s[1]);Ni(t,o,u)}return t.join("")}function wi(e,t){var n=e.length-1;if(n){var r=e[0][0],i=e[0][1],s=e[n][0]-r,o=e[n][1]-i,u=-1,a,f;while(++u<=n){a=e[u];f=u/n;a[0]=t*a[0]+(1-t)*(r+f*s);a[1]=t*a[1]+(1-t)*(i+f*o)}}return gi(e)}function Ei(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Ni(e,t,n){e.push("C",Ei(Si,t),",",Ei(Si,n),",",Ei(xi,t),",",Ei(xi,n),",",Ei(Ti,t),",",Ei(Ti,n))}function Ci(e,t){return(t[1]-e[1])/(t[0]-e[0])}function ki(e){var t=0,n=e.length-1,r=[],i=e[0],s=e[1],o=r[0]=Ci(i,s);while(++t<n){r[t]=(o+(o=Ci(i=s,s=e[t+1])))/2}r[t]=o;return r}function Li(e){var t=[],n,r,i,s,o=ki(e),u=-1,a=e.length-1;while(++u<a){n=Ci(e[u],e[u+1]);if(Math.abs(n)<1e-6){o[u]=o[u+1]=0}else{r=o[u]/n;i=o[u+1]/n;s=r*r+i*i;if(s>9){s=n*3/Math.sqrt(s);o[u]=s*r;o[u+1]=s*i}}}u=-1;while(++u<=a){s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u]));t.push([s||0,o[u]*s||0])}return t}function Ai(e){return e.length<3?ai(e):e[0]+vi(e,Li(e))}function Oi(e,t,n,r){var i,s,o,u,a,f,l;i=r[e];s=i[0];o=i[1];i=r[t];u=i[0];a=i[1];i=r[n];f=i[0];l=i[1];return(l-o)*(u-s)-(a-o)*(f-s)>0}function Mi(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function _i(e,t,n,r){var i=e[0],s=n[0],o=t[0]-i,u=r[0]-s,a=e[1],f=n[1],l=t[1]-a,c=r[1]-f,h=(u*(a-f)-c*(i-s))/(c*o-u*l);return[i+h*o,a+h*l]}function Pi(e,t){var n={list:e.map(function(e,t){return{index:t,x:e[0],y:e[1]}}).sort(function(e,t){return e.y<t.y?-1:e.y>t.y?1:e.x<t.x?-1:e.x>t.x?1:0}),bottomSite:null};var r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l");r.rightEnd=r.createHalfEdge(null,"l");r.leftEnd.r=r.rightEnd;r.rightEnd.l=r.leftEnd;r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(e,t){return{edge:e,side:t,vertex:null,l:null,r:null}},insert:function(e,t){t.l=e;t.r=e.r;e.r.l=t;e.r=t},leftBound:function(e){var t=r.leftEnd;do{t=t.r}while(t!=r.rightEnd&&i.rightOf(t,e));t=t.l;return t},del:function(e){e.l.r=e.r;e.r.l=e.l;e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[Di[e.side]]}};var i={bisect:function(e,t){var n={region:{l:e,r:t},ep:{l:null,r:null}};var r=t.x-e.x,i=t.y-e.y,s=r>0?r:-r,o=i>0?i:-i;n.c=e.x*r+e.y*i+(r*r+i*i)*.5;if(s>o){n.a=1;n.b=i/r;n.c/=r}else{n.b=1;n.a=r/i;n.c/=i}return n},intersect:function(e,t){var n=e.edge,r=t.edge;if(!n||!r||n.region.r==r.region.r){return null}var i=n.a*r.b-n.b*r.a;if(Math.abs(i)<1e-10){return null}var s=(n.c*r.b-r.c*n.b)/i,o=(r.c*n.a-n.c*r.a)/i,u=n.region.r,a=r.region.r,f,l;if(u.y<a.y||u.y==a.y&&u.x<a.x){f=e;l=n}else{f=t;l=r}var c=s>=l.region.r.x;if(c&&f.side==="l"||!c&&f.side==="r"){return null}return{x:s,y:o}},rightOf:function(e,t){var n=e.edge,r=n.region.r,i=t.x>r.x;if(i&&e.side==="l"){return 1}if(!i&&e.side==="r"){return 0}if(n.a===1){var s=t.y-r.y,o=t.x-r.x,u=0,a=0;if(!i&&n.b<0||i&&n.b>=0){a=u=s>=n.b*o}else{a=t.x+t.y*n.b>n.c;if(n.b<0){a=!a}if(!a){u=1}}if(!u){var f=r.x-n.region.l.x;a=n.b*(o*o-s*s)<f*s*(1+2*o/f+n.b*n.b);if(n.b<0){a=!a}}}else{var l=n.c-n.a*t.x,c=t.y-l,h=t.x-r.x,p=l-r.y;a=c*c>h*h+p*p}return e.side==="l"?a:!a},endPoint:function(e,n,r){e.ep[n]=r;if(!e.ep[Di[n]])return;t(e)},distance:function(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}};var s={list:[],insert:function(e,t,n){e.vertex=t;e.ystar=t.y+n;for(var r=0,i=s.list,o=i.length;r<o;r++){var u=i[r];if(e.ystar>u.ystar||e.ystar==u.ystar&&t.x>u.vertex.x){continue}else{break}}i.splice(r,0,e)},del:function(e){for(var t=0,n=s.list,r=n.length;t<r&&n[t]!=e;++t){}n.splice(t,1)},empty:function(){return s.list.length===0},nextEvent:function(e){for(var t=0,n=s.list,r=n.length;t<r;++t){if(n[t]==e)return n[t+1]}return null},min:function(){var e=s.list[0];return{x:e.vertex.x,y:e.ystar}},extractMin:function(){return s.list.shift()}};r.init();n.bottomSite=n.list.shift();var o=n.list.shift(),u;var a,f,l,c,h;var p,d,v,m,g;var y,b;while(true){if(!s.empty()){u=s.min()}if(o&&(s.empty()||o.y<u.y||o.y==u.y&&o.x<u.x)){a=r.leftBound(o);f=r.right(a);p=r.rightRegion(a);y=i.bisect(p,o);h=r.createHalfEdge(y,"l");r.insert(a,h);m=i.intersect(a,h);if(m){s.del(a);s.insert(a,m,i.distance(m,o))}a=h;h=r.createHalfEdge(y,"r");r.insert(a,h);m=i.intersect(h,f);if(m){s.insert(h,m,i.distance(m,o))}o=n.list.shift()}else if(!s.empty()){a=s.extractMin();l=r.left(a);f=r.right(a);c=r.right(f);p=r.leftRegion(a);d=r.rightRegion(f);g=a.vertex;i.endPoint(a.edge,a.side,g);i.endPoint(f.edge,f.side,g);r.del(a);s.del(f);r.del(f);b="l";if(p.y>d.y){v=p;p=d;d=v;b="r"}y=i.bisect(p,d);h=r.createHalfEdge(y,b);r.insert(l,h);i.endPoint(y,Di[b],g);m=i.intersect(l,h);if(m){s.del(l);s.insert(l,m,i.distance(m,p))}m=i.intersect(h,c);if(m){s.insert(h,m,i.distance(m,p))}}else{break}}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a)){t(a.edge)}}function Hi(e){return e.x}function Bi(e){return e.y}function ji(){return{leaf:true,nodes:[],point:null,x:null,y:null}}function Fi(e,t,n,r,i,s){if(!e(t,n,r,i,s)){var o=(n+i)*.5,u=(r+s)*.5,a=t.nodes;if(a[0])Fi(e,a[0],n,r,o,u);if(a[1])Fi(e,a[1],o,r,i,u);if(a[2])Fi(e,a[2],n,u,o,s);if(a[3])Fi(e,a[3],o,u,i,s)}}function Ii(t,n){t=e.rgb(t);n=e.rgb(n);var r=t.r,i=t.g,s=t.b,o=n.r-r,u=n.g-i,a=n.b-s;return function(e){return"#"+zt(Math.round(r+o*e))+zt(Math.round(i+u*e))+zt(Math.round(s+a*e))}}function qi(e){var t=[e.a,e.b],n=[e.c,e.d],r=Ui(t),i=Ri(t,n),s=Ui(zi(n,t,-i))||0;if(t[0]*n[1]<n[0]*t[1]){t[0]*=-1;t[1]*=-1;r*=-1;i*=-1}this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-n[0],n[1]))*gt;this.translate=[e.e,e.f];this.scale=[r,s];this.skew=s?Math.atan2(i,s)*gt:0}function Ri(e,t){return e[0]*t[0]+e[1]*t[1]}function Ui(e){var t=Math.sqrt(Ri(e,e));if(t){e[0]/=t;e[1]/=t}return t}function zi(e,t,n){e[0]+=n*t[0];e[1]+=n*t[1];return e}function Xi(e,t){t-=e=+e;return function(n){return e+t*n}}function Vi(t,n){var r=[],i=[],s,o=e.transform(t),u=e.transform(n),a=o.translate,f=u.translate,l=o.rotate,c=u.rotate,h=o.skew,p=u.skew,d=o.scale,v=u.scale;if(a[0]!=f[0]||a[1]!=f[1]){r.push("translate(",null,",",null,")");i.push({i:1,x:Xi(a[0],f[0])},{i:3,x:Xi(a[1],f[1])})}else if(f[0]||f[1]){r.push("translate("+f+")")}else{r.push("")}if(l!=c){if(l-c>180)c+=360;else if(c-l>180)l+=360;i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:Xi(l,c)})}else if(c){r.push(r.pop()+"rotate("+c+")")}if(h!=p){i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:Xi(h,p)})}else if(p){r.push(r.pop()+"skewX("+p+")")}if(d[0]!=v[0]||d[1]!=v[1]){s=r.push(r.pop()+"scale(",null,",",null,")");i.push({i:s-4,x:Xi(d[0],v[0])},{i:s-2,x:Xi(d[1],v[1])})}else if(v[0]!=1||v[1]!=1){r.push(r.pop()+"scale("+v+")")}s=i.length;return function(e){var t=-1,n;while(++t<s)r[(n=i[t]).i]=n.x(e);return r.join("")}}function $i(e,t){var n={},r={},i;for(i in e){if(i in t){n[i]=Gi(i)(e[i],t[i])}else{r[i]=e[i]}}for(i in t){if(!(i in e)){r[i]=t[i]}}return function(e){for(i in n)r[i]=n[i](e);return r}}function Ji(e,t){var n,r,i,s=0,o=0,u=[],a=[],f,l;e=e+"",t=t+"";Ki.lastIndex=0;for(r=0;n=Ki.exec(t);++r){if(n.index)u.push(t.substring(s,o=n.index));a.push({i:u.length,x:n[0]});u.push(null);s=Ki.lastIndex}if(s<t.length)u.push(t.substring(s));for(r=0,f=a.length;(n=Ki.exec(e))&&r<f;++r){l=a[r];if(l.x==n[0]){if(l.i){if(u[l.i+1]==null){u[l.i-1]+=l.x;u.splice(l.i,1);for(i=r+1;i<f;++i)a[i].i--}else{u[l.i-1]+=l.x+u[l.i+1];u.splice(l.i,2);for(i=r+1;i<f;++i)a[i].i-=2}}else{if(u[l.i+1]==null){u[l.i]=l.x}else{u[l.i]=l.x+u[l.i+1];u.splice(l.i+1,1);for(i=r+1;i<f;++i)a[i].i--}}a.splice(r,1);f--;r--}else{l.x=Xi(parseFloat(n[0]),parseFloat(l.x))}}while(r<f){l=a.pop();if(u[l.i+1]==null){u[l.i]=l.x}else{u[l.i]=l.x+u[l.i+1];u.splice(l.i+1,1)}f--}if(u.length===1){return u[0]==null?a[0].x:function(){return t}}return function(e){for(r=0;r<f;++r)u[(l=a[r]).i]=l.x(e);return u.join("")}}function Qi(t,n){var r=e.interpolators.length,i;while(--r>=0&&!(i=e.interpolators[r](t,n)));return i}function Gi(e){return e=="transform"?Vi:Qi}function Yi(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u<o;++u)n.push(Qi(e[u],t[u]));for(;u<i;++u)r[u]=e[u];for(;u<s;++u)r[u]=t[u];return function(e){for(u=0;u<o;++u)r[u]=n[u](e);return r}}function ns(e){return function(t){return t<=0?0:t>=1?1:e(t)}}function rs(e){return function(t){return 1-e(1-t)}}function is(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function ss(e){return e*e}function os(e){return e*e*e}function us(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function as(e){return function(t){return Math.pow(t,e)}}function fs(e){return 1-Math.cos(e*dt/2)}function ls(e){return Math.pow(2,10*(e-1))}function cs(e){return 1-Math.sqrt(1-e*e)}function hs(e,t){var n;if(arguments.length<2)t=.45;if(arguments.length)n=t/(2*dt)*Math.asin(1/e);else e=1,n=t/4;return function(r){return 1+e*Math.pow(2,10*-r)*Math.sin((r-n)*2*dt/t)}}function ps(e){if(!e)e=1.70158;return function(t){return t*t*((e+1)*t-e)}}function ds(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function vs(t,n){t=e.hcl(t);n=e.hcl(n);var r=t.h,i=t.c,s=t.l,o=n.h-r,u=n.c-i,a=n.l-s;if(o>180)o-=360;else if(o<-180)o+=360;return function(e){return kt(r+o*e,i+u*e,s+a*e)+""}}function ms(t,n){t=e.hsl(t);n=e.hsl(n);var r=t.h,i=t.s,s=t.l,o=n.h-r,u=n.s-i,a=n.l-s;if(o>180)o-=360;else if(o<-180)o+=360;return function(e){return pt(r+o*e,i+u*e,s+a*e)+""}}function gs(t,n){t=e.lab(t);n=e.lab(n);var r=t.l,i=t.a,s=t.b,o=n.l-r,u=n.a-i,a=n.b-s;return function(e){return Ht(r+o*e,i+u*e,s+a*e)+""}}function ys(e,t){t-=e;return function(n){return Math.round(e+t*n)}}function bs(e,t){t=t-(e=+e)?1/(t-e):0;return function(n){return(n-e)*t}}function ws(e,t){t=t-(e=+e)?1/(t-e):0;return function(n){return Math.max(0,Math.min(1,(n-e)*t))}}function Es(e){var t=e.source,n=e.target,r=xs(t,n),i=[t];while(t!==r){t=t.parent;i.push(t)}var s=i.length;while(n!==r){i.splice(s,0,n);n=n.parent}return i}function Ss(e){var t=[],n=e.parent;while(n!=null){t.push(e);e=n;n=n.parent}t.push(e);return t}function xs(e,t){if(e===t)return e;var n=Ss(e),r=Ss(t),i=n.pop(),s=r.pop(),o=null;while(i===s){o=i;i=n.pop();s=r.pop()}return o}function Ts(e){e.fixed|=2}function Ns(e){e.fixed&=~6}function Cs(e){e.fixed|=4;e.px=e.x,e.py=e.y}function ks(e){e.fixed&=~4}function Ls(e,t,n){var r=0,i=0;e.charge=0;if(!e.leaf){var s=e.nodes,o=s.length,u=-1,a;while(++u<o){a=s[u];if(a==null)continue;Ls(a,t,n);e.charge+=a.charge;r+=a.charge*a.cx;i+=a.charge*a.cy}}if(e.point){if(!e.leaf){e.point.x+=Math.random()-.5;e.point.y+=Math.random()-.5}var f=t*n[e.point.index];e.charge+=e.pointCharge=f;r+=f*e.point.x;i+=f*e.point.y}e.cx=r/e.charge;e.cy=i/e.charge}function Ms(t,n){e.rebind(t,n,"sort","children","value");t.nodes=t;t.links=Hs;return t}function _s(e){return e.children}function Ds(e){return e.value}function Ps(e,t){return t.value-e.value}function Hs(t){return e.merge(t.map(function(e){return(e.children||[]).map(function(t){return{source:e,target:t}})}))}function js(e){return e.x}function Fs(e){return e.y}function Is(e,t,n){e.y0=t;e.y=n}function Us(t){return e.range(t.length)}function zs(e){var t=-1,n=e[0].length,r=[];while(++t<n)r[t]=0;return r}function Ws(e){var t=1,n=0,r=e[0][1],i,s=e.length;for(;t<s;++t){if((i=e[t][1])>r){n=t;r=i}}return n}function Xs(e){return e.reduce(Vs,0)}function Vs(e,t){return e+t[1]}function $s(e,t){return Js(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Js(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function Ks(t){return[e.min(t),e.max(t)]}function Qs(e,t){return e.parent==t.parent?1:2}function Gs(e){var t=e.children;return t&&t.length?t[0]:e._tree.thread}function Ys(e){var t=e.children,n;return t&&(n=t.length)?t[n-1]:e._tree.thread}function Zs(e,t){var n=e.children;if(n&&(i=n.length)){var r,i,s=-1;while(++s<i){if(t(r=Zs(n[s],t),e)>0){e=r}}}return e}function eo(e,t){return e.x-t.x}function to(e,t){return t.x-e.x}function no(e,t){return e.depth-t.depth}function ro(e,t){function n(e,r){var i=e.children;if(i&&(a=i.length)){var s,o=null,u=-1,a;while(++u<a){s=i[u];n(s,o);o=s}}t(e,r)}n(e,null)}function io(e){var t=0,n=0,r=e.children,i=r.length,s;while(--i>=0){s=r[i]._tree;s.prelim+=t;s.mod+=t;t+=s.shift+(n+=s.change)}}function so(e,t,n){e=e._tree;t=t._tree;var r=n/(t.number-e.number);e.change+=r;t.change-=r;t.shift+=n;t.prelim+=n;t.mod+=n}function oo(e,t,n){return e._tree.ancestor.parent==t.parent?e._tree.ancestor:n}function uo(e,t){return e.value-t.value}function ao(e,t){var n=e._pack_next;e._pack_next=t;t._pack_prev=e;t._pack_next=n;n._pack_prev=t}function fo(e,t){e._pack_next=t;t._pack_prev=e}function lo(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return i*i-n*n-r*r>.001}function co(e){function p(e){n=Math.min(e.x-e.r,n);r=Math.max(e.x+e.r,r);i=Math.min(e.y-e.r,i);s=Math.max(e.y+e.r,s)}if(!(t=e.children)||!(h=t.length))return;var t,n=Infinity,r=-Infinity,i=Infinity,s=-Infinity,o,u,a,f,l,c,h;t.forEach(ho);o=t[0];o.x=-o.r;o.y=0;p(o);if(h>1){u=t[1];u.x=u.r;u.y=0;p(u);if(h>2){a=t[2];mo(o,u,a);p(a);ao(o,a);o._pack_prev=a;ao(a,u);u=o._pack_next;for(f=3;f<h;f++){mo(o,u,a=t[f]);var d=0,v=1,m=1;for(l=u._pack_next;l!==u;l=l._pack_next,v++){if(lo(l,a)){d=1;break}}if(d==1){for(c=o._pack_prev;c!==l._pack_prev;c=c._pack_prev,m++){if(lo(c,a)){break}}}if(d){if(v<m||v==m&&u.r<o.r)fo(o,u=l);else fo(o=c,u);f--}else{ao(o,a);u=a;p(a)}}}}var g=(n+r)/2,y=(i+s)/2,b=0;for(f=0;f<h;f++){a=t[f];a.x-=g;a.y-=y;b=Math.max(b,a.r+Math.sqrt(a.x*a.x+a.y*a.y))}e.r=b;t.forEach(po)}function ho(e){e._pack_next=e._pack_prev=e}function po(e){delete e._pack_next;delete e._pack_prev}function vo(e,t,n,r){var i=e.children;e.x=t+=r*e.x;e.y=n+=r*e.y;e.r*=r;if(i){var s=-1,o=i.length;while(++s<o)vo(i[s],t,n,r)}}function mo(e,t,n){var r=e.r+n.r,i=t.x-e.x,s=t.y-e.y;if(r&&(i||s)){var o=t.r+n.r,u=i*i+s*s;o*=o;r*=r;var a=.5+(r-o)/(2*u),f=Math.sqrt(Math.max(0,2*o*(r+u)-(r-=u)*r-o*o))/(2*u);n.x=e.x+a*i+f*s;n.y=e.y+a*s-f*i}else{n.x=e.x+r;n.y=e.y}}function go(t){return 1+e.max(t,function(e){return e.y})}function yo(e){return e.reduce(function(e,t){return e+t.x},0)/e.length}function bo(e){var t=e.children;return t&&t.length?bo(t[0]):e}function wo(e){var t=e.children,n;return t&&(n=t.length)?wo(t[n-1]):e}function Eo(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function So(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],s=e.dy-t[0]-t[2];if(i<0){n+=i/2;i=0}if(s<0){r+=s/2;s=0}return{x:n,y:r,dx:i,dy:s}}function xo(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function To(e){return e.rangeExtent?e.rangeExtent():xo(e.range())}function No(e,t,n,r){var i=n(e[0],e[1]),s=r(t[0],t[1]);return function(e){return s(i(e))}}function Co(e,t){var n=0,r=e.length-1,i=e[n],s=e[r],o;if(s<i){o=n,n=r,r=o;o=i,i=s,s=o}if(t=t(s-i)){e[n]=t.floor(i);e[r]=t.ceil(s)}return e}function ko(t,n,r,i){var s=[],o=[],u=0,a=Math.min(t.length,n.length)-1;if(t[a]<t[0]){t=t.slice().reverse();n=n.slice().reverse()}while(++u<=a){s.push(r(t[u-1],t[u]));o.push(i(n[u-1],n[u]))}return function(n){var r=e.bisect(t,n,1,a)-1;return o[r](s[r](n))}}function Lo(e,t,n,r){function o(){var o=Math.min(e.length,t.length)>2?ko:No,a=r?ws:bs;i=o(e,t,a,n);s=o(t,e,a,Qi);return u}function u(e){return i(e)}var i,s;u.invert=function(e){return s(e)};u.domain=function(t){if(!arguments.length)return e;e=t.map(Number);return o()};u.range=function(e){if(!arguments.length)return t;t=e;return o()};u.rangeRound=function(e){return u.range(e).interpolate(ys)};u.clamp=function(e){if(!arguments.length)return r;r=e;return o()};u.interpolate=function(e){if(!arguments.length)return n;n=e;return o()};u.ticks=function(t){return _o(e,t)};u.tickFormat=function(t,n){return Do(e,t,n)};u.nice=function(){Co(e,Oo);return o()};u.copy=function(){return Lo(e,t,n,r)};return o()}function Ao(t,n){return e.rebind(t,n,"range","rangeRound","interpolate","clamp")}function Oo(e){e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1);return e&&{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}}function Mo(e,t){var n=xo(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;if(s<=.15)i*=10;else if(s<=.35)i*=5;else if(s<=.75)i*=2;n[0]=Math.ceil(n[0]/i)*i;n[1]=Math.floor(n[1]/i)*i+i*.5;n[2]=i;return n}function _o(t,n){return e.range.apply(e,Mo(t,n))}function Do(t,n,r){var i=-Math.floor(Math.log(Mo(t,n)[2])/Math.LN10+.01);return e.format(r?r.replace(dn,function(e,t,n,r,s,o,u,a,f,l){return[t,n,r,s,o,u,a,f||"."+(i-(l==="%")*2),l].join("")}):",."+i+"f")}function Po(e,t,n,r){function i(t){return e(n(t))}i.invert=function(t){return r(e.invert(t))};i.domain=function(t){if(!arguments.length)return e.domain().map(r);if(t[0]<0)n=Fo,r=Io;else n=Bo,r=jo;e.domain(t.map(n));return i};i.base=function(e){if(!arguments.length)return t;t=+e;return i};i.nice=function(){e.domain(Co(e.domain(),qo(t)));return i};i.ticks=function(){var i=xo(e.domain()),s=[];if(i.every(isFinite)){var o=Math.log(t),u=Math.floor(i[0]/o),a=Math.ceil(i[1]/o),f=r(i[0]),l=r(i[1]),c=t%1?2:t;if(n===Fo){s.push(-Math.pow(t,-u));for(;u++<a;)for(var h=c-1;h>0;h--)s.push(-Math.pow(t,-u)*h)}else{for(;u<a;u++)for(var h=1;h<c;h++)s.push(Math.pow(t,u)*h);s.push(Math.pow(t,u))}for(u=0;s[u]<f;u++){}for(a=s.length;s[a-1]>l;a--){}s=s.slice(u,a)}return s};i.tickFormat=function(e,s){if(arguments.length<2)s=Ho;if(!arguments.length)return s;var o=Math.log(t),u=Math.max(.1,e/i.ticks().length),a=n===Fo?(f=-1e-12,Math.floor):(f=1e-12,Math.ceil),f;return function(e){return e/r(o*a(n(e)/o+f))<=u?s(e):""}};i.copy=function(){return Po(e.copy(),t,n,r)};return Ao(i,e)}function Bo(e){return Math.log(e<0?0:e)}function jo(e){return Math.exp(e)}function Fo(e){return-Math.log(e>0?0:-e)}function Io(e){return-Math.exp(-e)}function qo(e){e=Math.log(e);var t={floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}};return function(){return t}}function Ro(e,t){function i(t){return e(n(t))}var n=Uo(t),r=Uo(1/t);i.invert=function(t){return r(e.invert(t))};i.domain=function(t){if(!arguments.length)return e.domain().map(r);e.domain(t.map(n));return i};i.ticks=function(e){return _o(i.domain(),e)};i.tickFormat=function(e,t){return Do(i.domain(),e,t)};i.nice=function(){return i.domain(Co(i.domain(),Oo))};i.exponent=function(e){if(!arguments.length)return t;var s=i.domain();n=Uo(t=e);r=Uo(1/t);return i.domain(s)};i.copy=function(){return Ro(e.copy(),t)};return Ao(i,e)}function Uo(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function zo(t,n){function o(e){return i[((r.get(e)||r.set(e,t.push(e)))-1)%i.length]}function u(n,r){return e.range(t.length).map(function(e){return n+r*e})}var r,i,s;o.domain=function(e){if(!arguments.length)return t;t=[];r=new c;var i=-1,s=e.length,u;while(++i<s)if(!r.has(u=e[i]))r.set(u,t.push(u));return o[n.t].apply(o,n.a)};o.range=function(e){if(!arguments.length)return i;i=e;s=0;n={t:"range",a:arguments};return o};o.rangePoints=function(e,r){if(arguments.length<2)r=0;var a=e[0],f=e[1],l=(f-a)/(Math.max(1,t.length-1)+r);i=u(t.length<2?(a+f)/2:a+l*r/2,l);s=0;n={t:"rangePoints",a:arguments};return o};o.rangeBands=function(e,r,a){if(arguments.length<2)r=0;if(arguments.length<3)a=r;var f=e[1]<e[0],l=e[f-0],c=e[1-f],h=(c-l)/(t.length-r+2*a);i=u(l+h*a,h);if(f)i.reverse();s=h*(1-r);n={t:"rangeBands",a:arguments};return o};o.rangeRoundBands=function(e,r,a){if(arguments.length<2)r=0;if(arguments.length<3)a=r;var f=e[1]<e[0],l=e[f-0],c=e[1-f],h=Math.floor((c-l)/(t.length-r+2*a)),p=c-l-(t.length-r)*h;i=u(l+Math.round(p/2),h);if(f)i.reverse();s=Math.round(h*(1-r));n={t:"rangeRoundBands",a:arguments};return o};o.rangeBand=function(){if(s<=50)return s;else return 50};o.rangeExtent=function(){return xo(n.a[0])};o.copy=function(){return zo(t,n)};return o.domain(t)}function Ko(t,n){function i(){var i=0,o=n.length;r=[];while(++i<o)r[i-1]=e.quantile(t,i/o);return s}function s(t){if(isNaN(t=+t))return NaN;return n[e.bisect(r,t)]}var r;s.domain=function(n){if(!arguments.length)return t;t=n.filter(function(e){return!isNaN(e)}).sort(e.ascending);return i()};s.range=function(e){if(!arguments.length)return n;n=e;return i()};s.quantiles=function(){return r};s.copy=function(){return Ko(t,n)};return i()}function Qo(e,t,n){function s(t){return n[Math.max(0,Math.min(i,Math.floor(r*(t-e))))]}function o(){r=n.length/(t-e);i=n.length-1;return s}var r,i;s.domain=function(n){if(!arguments.length)return[e,t];e=+n[0];t=+n[n.length-1];return o()};s.range=function(e){if(!arguments.length)return n;n=e;return o()};s.copy=function(){return Qo(e,t,n)};return o()}function Go(t,n){function r(r){return n[e.bisect(t,r)]}r.domain=function(e){if(!arguments.length)return t;t=e;return r};r.range=function(e){if(!arguments.length)return n;n=e;return r};r.copy=function(){return Go(t,n)};return r}function Yo(e){function t(e){return+e}t.invert=t;t.domain=t.range=function(n){if(!arguments.length)return e;e=n.map(t);return t};t.ticks=function(t){return _o(e,t)};t.tickFormat=function(t,n){return Do(e,t,n)};t.copy=function(){return Yo(e)};return t}function tu(e){return e.innerRadius}function nu(e){return e.outerRadius}function ru(e){return e.startAngle}function iu(e){return e.endAngle}function su(e){var t,n=-1,r=e.length,i,s;while(++n<r){t=e[n];i=t[0];s=t[1]+Zo;t[0]=i*Math.cos(s);t[1]=i*Math.sin(s)}return e}function ou(e){function c(u){function x(){c.push("M",o(e(p),l),f,a(e(h.reverse()),l),"Z")}var c=[],h=[],p=[],d=-1,v=u.length,m,g=Qt(t),y=Qt(r),b=t===n?function(){return E}:Qt(n),w=r===i?function(){return S}:Qt(i),E,S;while(++d<v){if(s.call(this,m=u[d],d)){h.push([E=+g.call(this,m,d),S=+y.call(this,m,d)]);p.push([+b.call(this,m,d),+w.call(this,m,d)])}else if(h.length){x();h=[];p=[]}}if(h.length)x();return c.length?c.join(""):null}var t=si,n=si,r=0,i=oi,s=$n,o=ai,u=o.key,a=o,f="L",l=.7;c.x=function(e){if(!arguments.length)return n;t=n=e;return c};c.x0=function(e){if(!arguments.length)return t;t=e;return c};c.x1=function(e){if(!arguments.length)return n;n=e;return c};c.y=function(e){if(!arguments.length)return i;r=i=e;return c};c.y0=function(e){if(!arguments.length)return r;r=e;return c};c.y1=function(e){if(!arguments.length)return i;i=e;return c};c.defined=function(e){if(!arguments.length)return s;s=e;return c};c.interpolate=function(e){if(!arguments.length)return u;if(typeof e==="function")u=o=e;else u=(o=ui.get(e)||ai).key;a=o.reverse||o;f=o.closed?"M":"L";return c};c.tension=function(e){if(!arguments.length)return l;l=e;return c};return c}function uu(e){return e.radius}function au(e){return[e.x,e.y]}function fu(e){return function(){var t=e.apply(this,arguments),n=t[0],r=t[1]+Zo;return[n*Math.cos(r),n*Math.sin(r)]}}function lu(){return 64}function cu(){return"circle"}function hu(e){var t=Math.sqrt(e/dt);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+ -t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function mu(e,t){A(e,gu);e.id=t;return e}function Eu(e,t,n,r){var i=e.id;return nt(e,typeof n==="function"?function(e,s,o){e.__transition__[i].tween.set(t,r(n.call(e,e.__data__,s,o)))}:(n=r(n),function(e){e.__transition__[i].tween.set(t,n)}))}function Su(e){if(e==null)e="";return function(){this.textContent=e}}function xu(t,n,r,i){var s=t.__transition__||(t.__transition__={active:0,count:0}),o=s[r];if(!o){var u=i.time;o=s[r]={tween:new c,event:e.dispatch("start","end"),time:u,ease:i.ease,delay:i.delay,duration:i.duration};++s.count;e.timer(function(i){function d(i){if(s.active>r)return m();s.active=r;l.start.call(t,a,n);o.tween.forEach(function(e,r){if(r=r.call(t,a,n)){p.push(r)}});if(!v(i))e.timer(v,0,u);return 1}function v(e){if(s.active!==r)return m();var i=(e-c)/h,o=f(i),u=p.length;while(u>0){p[--u].call(t,o)}if(i>=1){m();l.end.call(t,a,n);return 1}}function m(){if(--s.count)delete s[r];else delete t.__transition__;return 1}var a=t.__data__,f=o.ease,l=o.event,c=o.delay,h=o.duration,p=[];return c<=i?d(i):e.timer(d,c,u),1},0,u);return o}}function Cu(e,t){e.attr("transform",function(e){return"translate("+t(e)+",0)"})}function ku(e,t){e.attr("transform",function(e){return"translate(0,"+t(e)+")"})}function Lu(e,t,n){i=[];if(n&&t.length>1){var r=xo(e.domain()),i,s=-1,o=t.length,u=(t[1]-t[0])/++n,a,f;while(++s<o){for(a=n;--a>0;){if((f=+t[s]-a*u)>=r[0]){i.push(f)}}}for(--s,a=0;++a<n&&(f=+t[s]+a*u)<r[1];){i.push(f)}}return i}function Du(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Uu(e,t,n){function r(t){var n=e(t),r=s(n,1);return t-n<r-t?n:r}function i(n){t(n=e(new Mu(n-1)),1);return n}function s(e,n){t(e=new Mu(+e),n);return e}function o(e,r,s){var o=i(e),u=[];if(s>1){while(o<r){if(!(n(o)%s))u.push(new Date(+o));t(o,1)}}else{while(o<r)u.push(new Date(+o)),t(o,1)}return u}function u(e,t,n){try{Mu=Du;var r=new Du;r._=e;return o(r,t,n)}finally{Mu=Date}}e.floor=e;e.round=r;e.ceil=i;e.offset=s;e.range=o;var a=e.utc=zu(e);a.floor=a;a.round=zu(r);a.ceil=zu(i);a.offset=zu(s);a.range=u;return e}function zu(e){return function(t,n){try{Mu=Du;var r=new Du;r._=t;return e(r,n)._}finally{Mu=Date}}}function Wu(e,t,n,r){var i,s,o=0,u=t.length,a=n.length;while(o<u){if(r>=a)return-1;i=t.charCodeAt(o++);if(i===37){s=na[t.charAt(o++)];if(!s||(r=s(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++)){return-1}}return r}function Xu(t){return new RegExp("^(?:"+t.map(e.requote).join("|")+")","i")}function Vu(e){var t=new c,n=-1,r=e.length;while(++n<r)t.set(e[n].toLowerCase(),n);return t}function $u(e,t,n){e+="";var r=e.length;return r<n?(new Array(n-r+1)).join(t)+e:e}function ra(e,t,n){Ku.lastIndex=0;var r=Ku.exec(t.substring(n));return r?n+=r[0].length:-1}function ia(e,t,n){Ju.lastIndex=0;var r=Ju.exec(t.substring(n));return r?n+=r[0].length:-1}function sa(e,t,n){Yu.lastIndex=0;var r=Yu.exec(t.substring(n));return r?(e.m=Zu.get(r[0].toLowerCase()),n+=r[0].length):-1}function oa(e,t,n){Qu.lastIndex=0;var r=Qu.exec(t.substring(n));return r?(e.m=Gu.get(r[0].toLowerCase()),n+=r[0].length):-1}function ua(e,t,n){return Wu(e,ta.c.toString(),t,n)}function aa(e,t,n){return Wu(e,ta.x.toString(),t,n)}function fa(e,t,n){return Wu(e,ta.X.toString(),t,n)}function la(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+4));return r?(e.y=+r[0],n+=r[0].length):-1}function ca(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.y=ha(+r[0]),n+=r[0].length):-1}function ha(e){return e+(e>68?1900:2e3)}function pa(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.m=r[0]-1,n+=r[0].length):-1}function da(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.d=+r[0],n+=r[0].length):-1}function va(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.H=+r[0],n+=r[0].length):-1}function ma(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.M=+r[0],n+=r[0].length):-1}function ga(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.S=+r[0],n+=r[0].length):-1}function ya(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+3));return r?(e.L=+r[0],n+=r[0].length):-1}function wa(e,t,n){var r=Ea.get(t.substring(n,n+=2).toLowerCase());return r==null?-1:(e.p=r,n)}function Sa(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return n+$u(r,"0",2)+$u(i,"0",2)}function Ta(e){return e.toISOString()}function Na(t,n,r){function i(e){return t(e)}i.invert=function(e){return ka(t.invert(e))};i.domain=function(e){if(!arguments.length)return t.domain().map(ka);t.domain(e);return i};i.nice=function(e){return i.domain(Co(i.domain(),function(){return e}))};i.ticks=function(r,s){var o=Ca(i.domain());if(typeof r!=="function"){var u=o[1]-o[0],a=u/r,f=e.bisect(Ma,a);if(f==Ma.length)return n.year(o,r);if(!f)return t.ticks(r).map(ka);if(Math.log(a/Ma[f-1])<Math.log(Ma[f]/a))--f;r=n[f];s=r[1];r=r[0].range}return r(o[0],new Date(+o[1]+1),s)};i.tickFormat=function(){return r};i.copy=function(){return Na(t.copy(),n,r)};return e.rebind(i,t,"range","rangeRound","interpolate","clamp")}function Ca(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function ka(e){return new Date(e)}function La(e){return function(t){var n=e.length-1,r=e[n];while(!r[1](t))r=e[--n];return r[0](t)}}function Aa(e){var t=new Date(e,0,1);t.setFullYear(e);return t}function Oa(e){var t=e.getFullYear(),n=Aa(t),r=Aa(t+1);return t+(e-n)/(r-n)}function Ia(e){var t=new Date(Date.UTC(e,0,1));t.setUTCFullYear(e);return t}function qa(e){var t=e.getUTCFullYear(),n=Ia(t),r=Ia(t+1);return t+(e-n)/(r-n)}function Ra(e){return e.responseText}function Ua(e){return JSON.parse(e.responseText)}function za(e){var n=t.createRange();n.selectNode(t.body);return n.createContextualFragment(e.responseText)}function Wa(e){return e.responseXML}var e={version:"3.1.5"};if(!Date.now)Date.now=function(){return+(new Date)};var t=document,n=window;try{t.createElement("div").style.setProperty("opacity",0,"")}catch(r){var i=n.CSSStyleDeclaration.prototype,s=i.setProperty;i.setProperty=function(e,t,n){s.call(this,e,t+"",n)}}e.ascending=function(e,t){return e<t?-1:e>t?1:e>=t?0:NaN};e.descending=function(e,t){return t<e?-1:t>e?1:t>=e?0:NaN};e.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)if((s=e[n])!=null&&i>s)i=s}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)if((s=t.call(e,e[n],n))!=null&&i>s)i=s}return i};e.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)if((s=e[n])!=null&&s>i)i=s}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)if((s=t.call(e,e[n],n))!=null&&s>i)i=s}return i};e.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++n<r&&((i=o=e[n])==null||i!=i))i=o=undefined;while(++n<r)if((s=e[n])!=null){if(i>s)i=s;if(o<s)o=s}}else{while(++n<r&&((i=o=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)if((s=t.call(e,e[n],n))!=null){if(i>s)i=s;if(o<s)o=s}}return[i,o]};e.sum=function(e,t){var n=0,r=e.length,i,s=-1;if(arguments.length===1){while(++s<r)if(!isNaN(i=+e[s]))n+=i}else{while(++s<r)if(!isNaN(i=+t.call(e,e[s],s)))n+=i}return n};e.mean=function(e,t){var n=e.length,r,i=0,s=-1,u=0;if(arguments.length===1){while(++s<n)if(o(r=e[s]))i+=(r-i)/++u}else{while(++s<n)if(o(r=t.call(e,e[s],s)))i+=(r-i)/++u}return u?i:undefined};e.quantile=function(e,t){var n=(e.length-1)*t+1,r=Math.floor(n),i=+e[r-1],s=n-r;return s?i+s*(e[r]-i):i};e.median=function(t,n){if(arguments.length>1)t=t.map(n);t=t.filter(o);return t.length?e.quantile(t.sort(e.ascending),.5):undefined};e.bisector=function(e){return{left:function(t,n,r,i){if(arguments.length<3)r=0;if(arguments.length<4)i=t.length;while(r<i){var s=r+i>>>1;if(e.call(t,t[s],s)<n)r=s+1;else i=s}return r},right:function(t,n,r,i){if(arguments.length<3)r=0;if(arguments.length<4)i=t.length;while(r<i){var s=r+i>>>1;if(n<e.call(t,t[s],s))i=s;else r=s+1}return r}}};var u=e.bisector(function(e){return e});e.bisectLeft=u.left;e.bisect=e.bisectRight=u.right;e.shuffle=function(e){var t=e.length,n,r;while(t){r=Math.random()*t--|0;n=e[t],e[t]=e[r],e[r]=n}return e};e.permute=function(e,t){var n=[],r=-1,i=t.length;while(++r<i)n[r]=e[t[r]];return n};e.zip=function(){if(!(s=arguments.length))return[];for(var t=-1,n=e.min(arguments,a),r=new Array(n);++t<n;){for(var i=-1,s,o=r[t]=new Array(s);++i<s;){o[i]=arguments[i][t]}}return r};e.transpose=function(t){return e.zip.apply(e,t)};e.keys=function(e){var t=[];for(var n in e)t.push(n);return t};e.values=function(e){var t=[];for(var n in e)t.push(e[n]);return t};e.entries=function(e){var t=[];for(var n in e)t.push({key:n,value:e[n]});return t};e.merge=function(e){return Array.prototype.concat.apply([],e)};e.range=function(e,t,n){if(arguments.length<3){n=1;if(arguments.length<2){t=e;e=0}}if((t-e)/n===Infinity)throw new Error("infinite range");var r=[],i=f(Math.abs(n)),s=-1,o;e*=i,t*=i,n*=i;if(n<0)while((o=e+n*++s)>t)r.push(o/i);else while((o=e+n*++s)<t)r.push(o/i);return r};e.map=function(e){var t=new c;for(var n in e)t.set(n,e[n]);return t};l(c,{has:function(e){return h+e in this},get:function(e){return this[h+e]},set:function(e,t){return this[h+e]=t},remove:function(e){e=h+e;return e in this&&delete this[e]},keys:function(){var e=[];this.forEach(function(t){e.push(t)});return e},values:function(){var e=[];this.forEach(function(t,n){e.push(n)});return e},entries:function(){var e=[];this.forEach(function(t,n){e.push({key:t,value:n})});return e},forEach:function(e){for(var t in this){if(t.charCodeAt(0)===p){e.call(this,t.substring(1),this[t])}}}});var h="\0",p=h.charCodeAt(0);e.nest=function(){function o(e,r,u){if(u>=n.length)return s?s.call(t,r):i?r.sort(i):r;var a=-1,f=r.length,l=n[u++],h,p,d,v=new c,m;while(++a<f){if(m=v.get(h=l(p=r[a]))){m.push(p)}else{v.set(h,[p])}}if(e){p=e();d=function(t,n){p.set(t,o(e,n,u))}}else{p={};d=function(t,n){p[t]=o(e,n,u)}}v.forEach(d);return p}function u(e,t){if(t>=n.length)return e;var i=[],s=r[t++];e.forEach(function(e,n){i.push({key:e,values:u(n,t)})});return s?i.sort(function(e,t){return s(e.key,t.key)}):i}var t={},n=[],r=[],i,s;t.map=function(e,t){return o(t,e,0)};t.entries=function(t){return u(o(e.map,t,0),0)};t.key=function(e){n.push(e);return t};t.sortKeys=function(e){r[n.length-1]=e;return t};t.sortValues=function(e){i=e;return t};t.rollup=function(e){s=e;return t};return t};e.set=function(e){var t=new d;if(e)for(var n=0;n<e.length;n++)t.add(e[n]);return t};l(d,{has:function(e){return h+e in this},add:function(e){this[h+e]=true;return e},remove:function(e){e=h+e;return e in this&&delete this[e]},values:function(){var e=[];this.forEach(function(t){e.push(t)});return e},forEach:function(e){for(var t in this){if(t.charCodeAt(0)===p){e.call(this,t.substring(1))}}}});e.behavior={};e.rebind=function(e,t){var n=1,r=arguments.length,i;while(++n<r)e[i=arguments[n]]=v(e,t,t[i]);return e};e.dispatch=function(){var e=new m,t=-1,n=arguments.length;while(++t<n)e[arguments[t]]=g(e);return e};m.prototype.on=function(e,t){var n=e.indexOf("."),r="";if(n>=0){r=e.substring(n+1);e=e.substring(0,n)}if(e)return arguments.length<2?this[e].on(r):this[e].on(r,t);if(arguments.length===2){if(t==null)for(e in this){if(this.hasOwnProperty(e))this[e].on(r,null)}return this}};e.event=null;e.mouse=function(e){return T(e,w())};var x=/WebKit/.test(n.navigator.userAgent)?-1:0;var N=k;try{N(t.documentElement.childNodes)[0].nodeType}catch(L){N=C}var A=[].__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]};e.touches=function(e,t){if(arguments.length<2)t=w().touches;return t?N(t).map(function(t){var n=T(e,t);n.identifier=t.identifier;return n}):[]};e.behavior.drag=function(){function i(){this.on("mousedown.drag",s).on("touchstart.drag",s)}function s(){function h(){var t=i.parentNode;return u!=null?e.touches(t).filter(function(e){return e.identifier===u})[0]:e.mouse(t)}function p(){if(!i.parentNode)return d();var e=h(),t=e[0]-f[0],n=e[1]-f[1];l|=t|n;f=e;y();s({type:"drag",x:e[0]+a[0],y:e[1]+a[1],dx:t,dy:n})}function d(){s({type:"dragend"});if(l){y();if(e.event.target===o)E(c,"click")}c.on(u!=null?"touchmove.drag-"+u:"mousemove.drag",null).on(u!=null?"touchend.drag-"+u:"mouseup.drag",null)}var i=this,s=t.of(i,arguments),o=e.event.target,u=e.event.touches?e.event.changedTouches[0].identifier:null,a,f=h(),l=0;var c=e.select(n).on(u!=null?"touchmove.drag-"+u:"mousemove.drag",p).on(u!=null?"touchend.drag-"+u:"mouseup.drag",d,true);if(r){a=r.apply(i,arguments);a=[a.x-f[0],a.y-f[1]]}else{a=[0,0]}if(u==null)y();s({type:"dragstart"})}var t=S(i,"drag","dragstart","dragend"),r=null;i.origin=function(e){if(!arguments.length)return r;r=e;return i};return e.rebind(i,t,"on")};var M=function(e,t){return t.querySelector(e)},_=function(e,t){return t.querySelectorAll(e)},D=t.documentElement,P=D.matchesSelector||D.webkitMatchesSelector||D.mozMatchesSelector||D.msMatchesSelector||D.oMatchesSelector,H=function(e,t){return P.call(e,t)};if(typeof Sizzle==="function"){M=function(e,t){return Sizzle(e,t)[0]||null};_=function(e,t){return Sizzle.uniqueSort(Sizzle(e,t))};H=Sizzle.matchesSelector}var B=[];e.selection=function(){return st};e.selection.prototype=B;B.select=function(e){var t=[],n,r,i,s;if(typeof e!=="function")e=j(e);for(var o=-1,u=this.length;++o<u;){t.push(n=[]);n.parentNode=(i=this[o]).parentNode;for(var a=-1,f=i.length;++a<f;){if(s=i[a]){n.push(r=e.call(s,s.__data__,a));if(r&&"__data__"in s)r.__data__=s.__data__}else{n.push(null)}}}return O(t)};B.selectAll=function(e){var t=[],n,r;if(typeof e!=="function")e=F(e);for(var i=-1,s=this.length;++i<s;){for(var o=this[i],u=-1,a=o.length;++u<a;){if(r=o[u]){t.push(n=N(e.call(r,r.__data__,u)));n.parentNode=r}}}return O(t)};var I={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};e.ns={prefix:I,qualify:function(e){var t=e.indexOf(":"),n=e;if(t>=0){n=e.substring(0,t);e=e.substring(t+1)}return I.hasOwnProperty(n)?{space:I[n],local:e}:e}};B.attr=function(t,n){if(arguments.length<2){if(typeof t==="string"){var r=this.node();t=e.ns.qualify(t);return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(n in t)this.each(q(n,t[n]));return this}return this.each(q(t,n))};e.requote=function(e){return e.replace(U,"\\$&")};var U=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;B.classed=function(e,t){if(arguments.length<2){if(typeof e==="string"){var n=this.node(),r=(e=e.trim().split(/^|\s+/g)).length,i=-1;if(t=n.classList){while(++i<r)if(!t.contains(e[i]))return false}else{t=n.getAttribute("class");while(++i<r)if(!z(e[i]).test(t))return false}return true}for(t in e)this.each(W(t,e[t]));return this}return this.each(W(e,t))};B.style=function(e,t,r){var i=arguments.length;if(i<3){if(typeof e!=="string"){if(i<2)t="";for(r in e)this.each(V(r,e[r],t));return this}if(i<2)return n.getComputedStyle(this.node(),null).getPropertyValue(e);r=""}return this.each(V(e,t,r))};B.property=function(e,t){if(arguments.length<2){if(typeof e==="string")return this.node()[e];for(t in e)this.each($(t,e[t]));return this}return this.each($(e,t))};B.text=function(e){return arguments.length?this.each(typeof e==="function"?function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}:e==null?function(){this.textContent=""}:function(){this.textContent=e}):this.node().textContent};B.html=function(e){return arguments.length?this.each(typeof e==="function"?function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}:e==null?function(){this.innerHTML=""}:function(){this.innerHTML=e}):this.node().innerHTML};B.append=function(n){function r(){return this.appendChild(t.createElementNS(this.namespaceURI,n))}function i(){return this.appendChild(t.createElementNS(n.space,n.local))}n=e.ns.qualify(n);return this.select(n.local?i:r)};B.insert=function(n,r){function i(e,i){return this.insertBefore(t.createElementNS(this.namespaceURI,n),r.call(this,e,i))}function s(e,i){return this.insertBefore(t.createElementNS(n.space,n.local),r.call(this,e,i))}n=e.ns.qualify(n);if(typeof r!=="function")r=j(r);return this.select(n.local?s:i)};B.remove=function(){return this.each(function(){var e=this.parentNode;if(e)e.removeChild(this)})};B.data=function(e,t){function o(e,n){var r,i=e.length,s=n.length,o=Math.min(i,s),l=new Array(s),h=new Array(s),p=new Array(i),d,v;if(t){var m=new c,g=new c,y=[],b;for(r=-1;++r<i;){b=t.call(d=e[r],d.__data__,r);if(m.has(b)){p[r]=d}else{m.set(b,d)}y.push(b)}for(r=-1;++r<s;){b=t.call(n,v=n[r],r);if(d=m.get(b)){l[r]=d;d.__data__=v}else if(!g.has(b)){h[r]=J(v)}g.set(b,v);m.remove(b)}for(r=-1;++r<i;){if(m.has(y[r])){p[r]=e[r]}}}else{for(r=-1;++r<o;){d=e[r];v=n[r];if(d){d.__data__=v;l[r]=d}else{h[r]=J(v)}}for(;r<s;++r){h[r]=J(n[r])}for(;r<i;++r){p[r]=e[r]}}h.update=l;h.parentNode=l.parentNode=p.parentNode=e.parentNode;u.push(h);a.push(l);f.push(p)}var n=-1,r=this.length,i,s;if(!arguments.length){e=new Array(r=(i=this[0]).length);while(++n<r){if(s=i[n]){e[n]=s.__data__}}return e}var u=rt([]),a=O([]),f=O([]);if(typeof e==="function"){while(++n<r){o(i=this[n],e.call(i,i.parentNode.__data__,n))}}else{while(++n<r){o(i=this[n],e)}}a.enter=function(){return u};a.exit=function(){return f};return a};B.datum=function(e){return arguments.length?this.property("__data__",e):this.property("__data__")};B.filter=function(e){var t=[],n,r,i;if(typeof e!=="function")e=K(e);for(var s=0,o=this.length;s<o;s++){t.push(n=[]);n.parentNode=(r=this[s]).parentNode;for(var u=0,a=r.length;u<a;u++){if((i=r[u])&&e.call(i,i.__data__,u)){n.push(i)}}}return O(t)};B.order=function(){for(var e=-1,t=this.length;++e<t;){for(var n=this[e],r=n.length-1,i=n[r],s;--r>=0;){if(s=n[r]){if(i&&i!==s.nextSibling)i.parentNode.insertBefore(s,i);i=s}}}return this};B.sort=function(e){e=Q.apply(this,arguments);for(var t=-1,n=this.length;++t<n;)this[t].sort(e);return this.order()};B.on=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!=="string"){if(r<2)t=false;for(n in e)this.each(Y(n,e[n],t));return this}if(r<2)return(r=this.node()["__on"+e])&&r._;n=false}return this.each(Y(e,t,n))};var Z=e.map({mouseenter:"mouseover",mouseleave:"mouseout"});Z.forEach(function(e){if("on"+e in t)Z.remove(e)});B.each=function(e){return nt(this,function(t,n,r){e.call(t,t.__data__,n,r)})};B.call=function(e){var t=N(arguments);e.apply(t[0]=this,t);return this};B.empty=function(){return!this.node()};B.node=function(){for(var e=0,t=this.length;e<t;e++){for(var n=this[e],r=0,i=n.length;r<i;r++){var s=n[r];if(s)return s}}return null};var it=[];e.selection.enter=rt;e.selection.enter.prototype=it;it.append=B.append;it.insert=B.insert;it.empty=B.empty;it.node=B.node;it.select=function(e){var t=[],n,r,i,s,o;for(var u=-1,a=this.length;++u<a;){i=(s=this[u]).update;t.push(n=[]);n.parentNode=s.parentNode;for(var f=-1,l=s.length;++f<l;){if(o=s[f]){n.push(i[f]=r=e.call(s.parentNode,o.__data__,f));r.__data__=o.__data__}else{n.push(null)}}}return O(t)};B.transition=function(){var e=bu||++yu,t=[],n,r,i=Object.create(wu);i.time=Date.now();for(var s=-1,o=this.length;++s<o;){t.push(n=[]);for(var u=this[s],a=-1,f=u.length;++a<f;){if(r=u[a])xu(r,a,e,i);n.push(r)}}return mu(t,e)};var st=O([[t]]);st[0].parentNode=D;e.select=function(e){return typeof e==="string"?st.select(e):O([[e]])};e.selectAll=function(e){return typeof e==="string"?st.selectAll(e):O([N(e)])};e.behavior.zoom=function(){function p(){this.on("mousedown.zoom",x).on("mousemove.zoom",N).on(at+".zoom",T).on("dblclick.zoom",C).on("touchstart.zoom",k).on("touchmove.zoom",L).on("touchend.zoom",k)}function d(e){return[(e[0]-t[0])/i,(e[1]-t[1])/i]}function v(e){return[e[0]*i+t[0],e[1]*i+t[1]]}function m(e){i=Math.max(o[0],Math.min(o[1],e))}function g(e,n){n=v(n);t[0]+=e[0]-n[0];t[1]+=e[1]-n[1]}function b(){if(f)f.domain(a.range().map(function(e){return(e-t[0])/i}).map(a.invert));if(c)c.domain(l.range().map(function(e){return(e-t[1])/i}).map(l.invert))}function w(n){b();e.event.preventDefault();n({type:"zoom",scale:i,translate:t})}function x(){function f(){s=1;g(e.mouse(t),a);w(r)}function l(){if(s)y();o.on("mousemove.zoom",null).on("mouseup.zoom",null);if(s&&e.event.target===i)E(o,"click.zoom")}var t=this,r=u.of(t,arguments),i=e.event.target,s=0,o=e.select(n).on("mousemove.zoom",f).on("mouseup.zoom",l),a=d(e.mouse(t));n.focus();y()}function T(){if(!r)r=d(e.mouse(this));m(Math.pow(2,ut()*.002)*i);g(e.mouse(this),r);w(u.of(this,arguments))}function N(){r=null}function C(){var t=e.mouse(this),n=d(t),r=Math.log(i)/Math.LN2;m(Math.pow(2,e.event.shiftKey?Math.ceil(r)-1:Math.floor(r)+1));g(t,n);w(u.of(this,arguments))}function k(){var t=e.touches(this),n=Date.now();s=i;r={};t.forEach(function(e){r[e.identifier]=d(e)});y();if(t.length===1){if(n-h<500){var o=t[0],a=d(t[0]);m(i*2);g(o,a);w(u.of(this,arguments))}h=n}}function L(){var t=e.touches(this),n=t[0],i=r[n.identifier];if(o=t[1]){var o,a=r[o.identifier];n=[(n[0]+o[0])/2,(n[1]+o[1])/2];i=[(i[0]+a[0])/2,(i[1]+a[1])/2];m(e.event.scale*s)}g(n,i);h=null;w(u.of(this,arguments))}var t=[0,0],r,i=1,s,o=ot,u=S(p,"zoom"),a,f,l,c,h;p.translate=function(e){if(!arguments.length)return t;t=e.map(Number);b();return p};p.scale=function(e){if(!arguments.length)return i;i=+e;b();return p};p.scaleExtent=function(e){if(!arguments.length)return o;o=e==null?ot:e.map(Number);return p};p.x=function(e){if(!arguments.length)return f;f=e;a=e.copy();t=[0,0];i=1;return p};p.y=function(e){if(!arguments.length)return c;c=e;l=e.copy();t=[0,0];i=1;return p};return e.rebind(p,u,"on")};var ot=[0,Infinity];var ut,at="onwheel"in t?(ut=function(){return-e.event.deltaY*(e.event.deltaMode?120:1)},"wheel"):"onmousewheel"in t?(ut=function(){return e.event.wheelDelta},"mousewheel"):(ut=function(){return-e.event.detail},"MozMousePixelScroll");ft.prototype.toString=function(){return this.rgb()+""};e.hsl=function(e,t,n){return arguments.length===1?e instanceof ct?lt(e.h,e.s,e.l):Wt(""+e,Xt,lt):lt(+e,+t,+n)};var ht=ct.prototype=new ft;ht.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);return lt(this.h,this.s,this.l/e)};ht.darker=function(e){e=Math.pow(.7,arguments.length?e:1);return lt(this.h,this.s,e*this.l)};ht.rgb=function(){return pt(this.h,this.s,this.l)};var dt=Math.PI,vt=1e-6,mt=dt/180,gt=180/dt;e.hcl=function(t,n,r){return arguments.length===1?t instanceof Nt?Tt(t.h,t.c,t.l):t instanceof At?Bt(t.l,t.a,t.b):Bt((t=Vt((t=e.rgb(t)).r,t.g,t.b)).l,t.a,t.b):Tt(+t,+n,+r)};var Ct=Nt.prototype=new ft;Ct.brighter=function(e){return Tt(this.h,this.c,Math.min(100,this.l+Ot*(arguments.length?e:1)))};Ct.darker=function(e){return Tt(this.h,this.c,Math.max(0,this.l-Ot*(arguments.length?e:1)))};Ct.rgb=function(){return kt(this.h,this.c,this.l).rgb()};e.lab=function(t,n,r){return arguments.length===1?t instanceof At?Lt(t.l,t.a,t.b):t instanceof Nt?kt(t.l,t.c,t.h):Vt((t=e.rgb(t)).r,t.g,t.b):Lt(+t,+n,+r)};var Ot=18;var Mt=.95047,_t=1,Dt=1.08883;var Pt=At.prototype=new ft;Pt.brighter=function(e){return Lt(Math.min(100,this.l+Ot*(arguments.length?e:1)),this.a,this.b)};Pt.darker=function(e){return Lt(Math.max(0,this.l-Ot*(arguments.length?e:1)),this.a,this.b)};Pt.rgb=function(){return Ht(this.l,this.a,this.b)};e.rgb=function(e,t,n){return arguments.length===1?e instanceof Rt?qt(e.r,e.g,e.b):Wt(""+e,qt,pt):qt(~~e,~~t,~~n)};var Ut=Rt.prototype=new ft;Ut.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,n=this.g,r=this.b,i=30;if(!t&&!n&&!r)return qt(i,i,i);if(t&&t<i)t=i;if(n&&n<i)n=i;if(r&&r<i)r=i;return qt(Math.min(255,Math.floor(t/e)),Math.min(255,Math.floor(n/e)),Math.min(255,Math.floor(r/e)))};Ut.darker=function(e){e=Math.pow(.7,arguments.length?e:1);return qt(Math.floor(e*this.r),Math.floor(e*this.g),Math.floor(e*this.b))};Ut.hsl=function(){return Xt(this.r,this.g,this.b)};Ut.toString=function(){return"#"+zt(this.r)+zt(this.g)+zt(this.b)};var Kt=e.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});Kt.forEach(function(e,t){Kt.set(e,Wt(t,qt,pt))});e.functor=Qt;e.xhr=function(t,r,i){function l(){var e=f.status;!e&&f.responseText||e>=200&&e<300||e===304?o.load.call(s,a.call(s,f)):o.error.call(s,f)}var s={},o=e.dispatch("progress","load","error"),u={},a=Gt,f=new(n.XDomainRequest&&/^(http(s)?:)?\/\//.test(t)?XDomainRequest:XMLHttpRequest);"onload"in f?f.onload=f.onerror=l:f.onreadystatechange=function(){f.readyState>3&&l()};f.onprogress=function(t){var n=e.event;e.event=t;try{o.progress.call(s,f)}finally{e.event=n}};s.header=function(e,t){e=(e+"").toLowerCase();if(arguments.length<2)return u[e];if(t==null)delete u[e];else u[e]=t+"";return s};s.mimeType=function(e){if(!arguments.length)return r;r=e==null?null:e+"";return s};s.response=function(e){a=e;return s};["get","post"].forEach(function(e){s[e]=function(){return s.send.apply(s,[e].concat(N(arguments)))}});s.send=function(e,n,i){if(arguments.length===2&&typeof n==="function")i=n,n=null;f.open(e,t,true);if(r!=null&&!("accept"in u))u["accept"]=r+",*/*";if(f.setRequestHeader)for(var o in u)f.setRequestHeader(o,u[o]);if(r!=null&&f.overrideMimeType)f.overrideMimeType(r);if(i!=null)s.on("error",i).on("load",function(e){i(null,e)});f.send(n==null?null:n);return s};s.abort=function(){f.abort();return s};e.rebind(s,o,"on");if(arguments.length===2&&typeof r==="function")i=r,r=null;return i==null?s:s.get(Yt(i))};e.csv=Zt(",","text/csv");e.tsv=Zt(" ","text/tab-separated-values");var en=0,tn={},nn=null,rn,sn;e.timer=function(e,t,n){if(arguments.length<3){if(arguments.length<2)t=0;else if(!isFinite(t))return;n=Date.now()}var r=tn[e.id];if(r&&r.callback===e){r.then=n;r.delay=t}else tn[e.id=++en]=nn={callback:e,then:n,delay:t,next:nn};if(!rn){sn=clearTimeout(sn);rn=1;an(on)}};e.timer.flush=function(){var e,t=Date.now(),n=nn;while(n){e=t-n.then;if(!n.delay)n.flush=n.callback(e);n=n.next}un()};var an=n.requestAnimationFrame||n.webkitRequestAnimationFrame||n.mozRequestAnimationFrame||n.oRequestAnimationFrame||n.msRequestAnimationFrame||function(e){setTimeout(e,17)};var fn=".",ln=",",cn=[3,3];var hn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(pn);e.formatPrefix=function(t,n){var r=0;if(t){if(t<0)t*=-1;if(n)t=e.round(t,mn(t,n));r=1+Math.floor(1e-12+Math.log(t)/Math.LN10);r=Math.max(-24,Math.min(24,Math.floor((r<=0?r+1:r-1)/3)*3))}return hn[8+r/3]};e.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)};e.format=function(t){var n=dn.exec(t),r=n[1]||" ",i=n[2]||">",s=n[3]||"",o=n[4]||"",u=n[5],a=+n[6],f=n[7],l=n[8],c=n[9],h=1,p="",d=false;if(l)l=+l.substring(1);if(u||r==="0"&&i==="="){u=r="0";i="=";if(f)a-=Math.floor((a-1)/4)}switch(c){case"n":f=true;c="g";break;case"%":h=100;p="%";c="f";break;case"p":h=100;p="%";c="r";break;case"b":case"o":case"x":case"X":if(o)o="0"+c.toLowerCase();case"c":case"d":d=true;l=0;break;case"s":h=-1;c="r";break}if(o==="#")o="";if(c=="r"&&!l)c="g";if(l!=null){if(c=="g")l=Math.max(1,Math.min(21,l));else if(c=="e"||c=="f")l=Math.max(0,Math.min(20,l))}c=vn.get(c)||gn;var v=u&&f;return function(t){if(d&&t%1)return"";var n=t<0||t===0&&1/t<0?(t=-t,"-"):s;if(h<0){var m=e.formatPrefix(t,l);t=m.scale(t);p=m.symbol}else{t*=h}t=c(t,l);if(!u&&f)t=yn(t);var g=o.length+t.length+(v?0:n.length),y=g<a?(new Array(g=a-g+1)).join(r):"";if(v)t=yn(y+t);if(fn)t.replace(".",fn);n+=o;return(i==="<"?n+t+y:i===">"?y+n+t:i==="^"?y.substring(0,g>>=1)+n+t+y.substring(g):n+(v?t:y+t))+p}};var dn=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i;var vn=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,n){return(t=e.round(t,mn(t,n))).toFixed(Math.max(0,Math.min(20,mn(t*(1+1e-15),n))))}});var yn=Gt;if(cn){var bn=cn.length;yn=function(e){var t=e.lastIndexOf("."),n=t>=0?"."+e.substring(t+1):(t=e.length,""),r=[],i=0,s=cn[0];while(t>0&&s>0){r.push(e.substring(t-=s,t+s));s=cn[i=(i+1)%bn]}return r.reverse().join(ln||"")+n}}e.geo={};e.geo.stream=function(e,t){if(e&&En.hasOwnProperty(e.type)){En[e.type](e,t)}else{wn(e,t)}};var En={Feature:function(e,t){wn(e.geometry,t)},FeatureCollection:function(e,t){var n=e.features,r=-1,i=n.length;while(++r<i)wn(n[r].geometry,t)}};var Sn={Sphere:function(e,t){t.sphere()},Point:function(e,t){var n=e.coordinates;t.point(n[0],n[1])},MultiPoint:function(e,t){var n=e.coordinates,r=-1,i=n.length,s;while(++r<i)s=n[r],t.point(s[0],s[1])},LineString:function(e,t){xn(e.coordinates,t,0)},MultiLineString:function(e,t){var n=e.coordinates,r=-1,i=n.length;while(++r<i)xn(n[r],t,0)},Polygon:function(e,t){Tn(e.coordinates,t)},MultiPolygon:function(e,t){var n=e.coordinates,r=-1,i=n.length;while(++r<i)Tn(n[r],t)},GeometryCollection:function(e,t){var n=e.geometries,r=-1,i=n.length;while(++r<i)wn(n[r],t)}};e.geo.area=function(t){Nn=0;e.geo.stream(t,Ln);return Nn};var Nn,Cn,kn;var Ln={sphere:function(){Nn+=4*dt},point:G,lineStart:G,lineEnd:G,polygonStart:function(){Cn=1,kn=0;Ln.lineStart=An},polygonEnd:function(){var e=2*Math.atan2(kn,Cn);Nn+=e<0?4*dt+e:e;Ln.lineStart=Ln.lineEnd=Ln.point=G}};e.geo.bounds=On(Gt);e.geo.centroid=function(t){Mn=_n=Dn=Pn=Hn=0;e.geo.stream(t,Bn);var n;if(_n&&Math.abs(n=Math.sqrt(Dn*Dn+Pn*Pn+Hn*Hn))>vt){return[Math.atan2(Pn,Dn)*gt,Math.asin(Math.max(-1,Math.min(1,Hn/n)))*gt]}};var Mn,_n,Dn,Pn,Hn;var Bn={sphere:function(){if(Mn<2){Mn=2;_n=Dn=Pn=Hn=0}},point:jn,lineStart:In,lineEnd:qn,polygonStart:function(){if(Mn<2){Mn=2;_n=Dn=Pn=Hn=0}Bn.lineStart=Fn},polygonEnd:function(){Bn.lineStart=In}};var rr=Yn($n,ir,or);var ar=1e9;e.geo.projection=pr;e.geo.projectionMutator=dr;(e.geo.equirectangular=function(){return pr(mr)}).raw=mr.invert=mr;e.geo.rotation=function(e){function t(t){t=e(t[0]*mt,t[1]*mt);return t[0]*=gt,t[1]*=gt,t}e=gr(e[0]%360*mt,e[1]*mt,e.length>2?e[2]*mt:0);t.invert=function(t){t=e.invert(t[0]*mt,t[1]*mt);return t[0]*=gt,t[1]*=gt,t};return t};e.geo.circle=function(){function i(){var t=typeof e==="function"?e.apply(this,arguments):e,n=gr(-t[0]*mt,-t[1]*mt,0).invert,i=[];r(null,null,1,{point:function(e,t){i.push(e=n(e,t));e[0]*=gt,e[1]*=gt}});return{type:"Polygon",coordinates:[i]}}var e=[0,0],t,n=6,r;i.origin=function(t){if(!arguments.length)return e;e=t;return i};i.angle=function(e){if(!arguments.length)return t;r=Er((t=+e)*mt,n*mt);return i};i.precision=function(e){if(!arguments.length)return n;r=Er(t*mt,(n=+e)*mt);return i};return i.angle(90)};e.geo.distance=function(e,t){var n=(t[0]-e[0])*mt,r=e[1]*mt,i=t[1]*mt,s=Math.sin(n),o=Math.cos(n),u=Math.sin(r),a=Math.cos(r),f=Math.sin(i),l=Math.cos(i),c;return Math.atan2(Math.sqrt((c=l*s)*c+(c=a*f-u*l*o)*c),u*f+a*l*o)};e.geo.graticule=function(){function y(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(i/c)*c,r,c).map(v).concat(e.range(Math.ceil(a/h)*h,u,h).map(m)).concat(e.range(Math.ceil(n/f)*f,t,f).filter(function(e){return Math.abs(e%c)>vt}).map(p)).concat(e.range(Math.ceil(o/l)*l,s,l).filter(function(e){return Math.abs(e%h)>vt}).map(d))}var t,n,r,i,s,o,u,a,f=10,l=f,c=90,h=360,p,d,v,m,g=2.5;y.lines=function(){return b().map(function(e){return{type:"LineString",coordinates:e}})};y.outline=function(){return{type:"Polygon",coordinates:[v(i).concat(m(u).slice(1),v(r).reverse().slice(1),m(a).reverse().slice(1))]}};y.extent=function(e){if(!arguments.length)return y.minorExtent();return y.majorExtent(e).minorExtent(e)};y.majorExtent=function(e){if(!arguments.length)return[[i,a],[r,u]];i=+e[0][0],r=+e[1][0];a=+e[0][1],u=+e[1][1];if(i>r)e=i,i=r,r=e;if(a>u)e=a,a=u,u=e;return y.precision(g)};y.minorExtent=function(e){if(!arguments.length)return[[n,o],[t,s]];n=+e[0][0],t=+e[1][0];o=+e[0][1],s=+e[1][1];if(n>t)e=n,n=t,t=e;if(o>s)e=o,o=s,s=e;return y.precision(g)};y.step=function(e){if(!arguments.length)return y.minorStep();return y.majorStep(e).minorStep(e)};y.majorStep=function(e){if(!arguments.length)return[c,h];c=+e[0],h=+e[1];return y};y.minorStep=function(e){if(!arguments.length)return[f,l];f=+e[0],l=+e[1];return y};y.precision=function(e){if(!arguments.length)return g;g=+e;p=xr(o,s,90);d=Tr(n,t,g);v=xr(a,u,90);m=Tr(i,r,g);return y};return y.majorExtent([[-180,-90+vt],[180,90-vt]]).minorExtent([[-180,-80-vt],[180,80+vt]])};e.geo.greatArc=function(){function s(){return{type:"LineString",coordinates:[n||t.apply(this,arguments),i||r.apply(this,arguments)]}}var t=Nr,n,r=Cr,i;s.distance=function(){return e.geo.distance(n||t.apply(this,arguments),i||r.apply(this,arguments))};s.source=function(e){if(!arguments.length)return t;t=e,n=typeof e==="function"?null:e;return s};s.target=function(e){if(!arguments.length)return r;r=e,i=typeof e==="function"?null:e;return s};s.precision=function(){return arguments.length?s:0};return s};e.geo.interpolate=function(e,t){return kr(e[0]*mt,e[1]*mt,t[0]*mt,t[1]*mt)};e.geo.length=function(t){Lr=0;e.geo.stream(t,Ar);return Lr};var Lr;var Ar={sphere:G,point:G,lineStart:Or,lineEnd:G,polygonStart:G,polygonEnd:G};(e.geo.conicEqualArea=function(){return Mr(_r)}).raw=_r;e.geo.albersUsa=function(){function a(e){return f(e)(e)}function f(e){var s=e[0],o=e[1];return o>50?n:s<-140?r:o<21?i:t}var t=e.geo.conicEqualArea().rotate([98,0]).center([0,38]).parallels([29.5,45.5]);var n=e.geo.conicEqualArea().rotate([160,0]).center([0,60]).parallels([55,65]);var r=e.geo.conicEqualArea().rotate([160,0]).center([0,20]).parallels([8,18]);var i=e.geo.conicEqualArea().rotate([60,0]).center([0,10]).parallels([8,18]);var s,o,u;a.invert=function(e){return s(e)||o(e)||u(e)||t.invert(e)};a.scale=function(e){if(!arguments.length)return t.scale();t.scale(e);n.scale(e*.6);r.scale(e);i.scale(e*1.5);return a.translate(t.translate())};a.translate=function(e){if(!arguments.length)return t.translate();var f=t.scale(),l=e[0],c=e[1];t.translate(e);n.translate([l-.4*f,c+.17*f]);r.translate([l-.19*f,c+.2*f]);i.translate([l+.58*f,c+.43*f]);s=Dr(n,[[-180,50],[-130,72]]);o=Dr(r,[[-164,18],[-154,24]]);u=Dr(i,[[-67.5,17.5],[-65,19]]);return a};return a.scale(1e3)};var Pr,Hr,Br={point:G,lineStart:G,lineEnd:G,polygonStart:function(){Hr=0;Br.lineStart=jr},polygonEnd:function(){Br.lineStart=Br.lineEnd=Br.point=G;Pr+=Math.abs(Hr/2)}};var Ir={point:qr,lineStart:Rr,lineEnd:Ur,polygonStart:function(){Ir.lineStart=zr},polygonEnd:function(){Ir.point=qr;Ir.lineStart=Rr;Ir.lineEnd=Ur}};e.geo.path=function(){function o(n){if(n)e.geo.stream(n,i(s.pointRadius(typeof t==="function"?+t.apply(this,arguments):t)));return s.result()}var t=4.5,n,r,i,s;o.area=function(t){Pr=0;e.geo.stream(t,i(Br));return Pr};o.centroid=function(t){Mn=Dn=Pn=Hn=0;e.geo.stream(t,i(Ir));return Hn?[Dn/Hn,Pn/Hn]:undefined};o.bounds=function(e){return On(i)(e)};o.projection=function(e){if(!arguments.length)return n;i=(n=e)?e.stream||Vr(e):Gt;return o};o.context=function(e){if(!arguments.length)return r;s=(r=e)==null?new Fr:new Wr(e);return o};o.pointRadius=function(e){if(!arguments.length)return t;t=typeof e==="function"?e:+e;return o};return o.projection(e.geo.albersUsa()).context(null)};e.geo.albers=function(){return e.geo.conicEqualArea().parallels([29.5,45.5]).rotate([98,0]).center([0,38]).scale(1e3)};var Jr=$r(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(e.geo.azimuthalEqualArea=function(){return pr(Jr)}).raw=Jr;var Kr=$r(function(e){var t=Math.acos(e);return t&&t/Math.sin(t)},Gt);(e.geo.azimuthalEquidistant=function(){return pr(Kr)}).raw=Kr;(e.geo.conicConformal=function(){return Mr(Qr)}).raw=Qr;(e.geo.conicEquidistant=function(){return Mr(Gr)}).raw=Gr;var Yr=$r(function(e){return 1/e},Math.atan);(e.geo.gnomonic=function(){return pr(Yr)}).raw=Yr;Zr.invert=function(e,t){return[e,2*Math.atan(Math.exp(t))-dt/2]};(e.geo.mercator=function(){return ei(Zr)}).raw=Zr;var ti=$r(function(){return 1},Math.asin);(e.geo.orthographic=function(){return pr(ti)}).raw=ti;var ni=$r(function(e){return 1/(1+e)},function(e){return 2*Math.atan(e)});(e.geo.stereographic=function(){return pr(ni)}).raw=ni;ri.invert=function(e,t){return[Math.atan2(Et(e),Math.cos(t)),wt(Math.sin(t)/St(e))]};(e.geo.transverseMercator=function(){return ei(ri)}).raw=ri;e.geom={};e.svg={};e.svg.line=function(){return ii(Gt)};var ui=e.map({linear:ai,"linear-closed":fi,"step-before":li,"step-after":ci,basis:gi,"basis-open":yi,"basis-closed":bi,bundle:wi,cardinal:di,"cardinal-open":hi,"cardinal-closed":pi,monotone:Ai});ui.forEach(function(e,t){t.key=e;t.closed=/-closed$/.test(e)});var Si=[0,2/3,1/3,0],xi=[0,1/3,2/3,0],Ti=[0,1/6,2/3,1/6];e.geom.hull=function(e){function r(e){if(e.length<3)return[];var r=Qt(t),i=Qt(n),s=e.length,o,u=s-1,a=[],f=[],l,c,h,p=0,d,v,m,g,y,b,w,E;if(r===si&&n===oi)o=e;else for(c=0,o=[];c<s;++c){o.push([+r.call(this,l=e[c],c),+i.call(this,l,c)])}for(c=1;c<s;++c){if(o[c][1]<o[p][1]){p=c}else if(o[c][1]==o[p][1]){p=o[c][0]<o[p][0]?c:p}}for(c=0;c<s;++c){if(c===p)continue;v=o[c][1]-o[p][1];d=o[c][0]-o[p][0];a.push({angle:Math.atan2(v,d),index:c})}a.sort(function(e,t){return e.angle-t.angle});w=a[0].angle;b=a[0].index;y=0;for(c=1;c<u;++c){h=a[c].index;if(w==a[c].angle){d=o[b][0]-o[p][0];v=o[b][1]-o[p][1];m=o[h][0]-o[p][0];g=o[h][1]-o[p][1];if(d*d+v*v>=m*m+g*g){a[c].index=-1}else{a[y].index=-1;w=a[c].angle;y=c;b=h}}else{w=a[c].angle;y=c;b=h}}f.push(p);for(c=0,h=0;c<2;++h){if(a[h].index!==-1){f.push(a[h].index);c++}}E=f.length;for(;h<u;++h){if(a[h].index===-1)continue;while(!Oi(f[E-2],f[E-1],a[h].index,o)){--E}f[E++]=a[h].index}var S=[];for(c=0;c<E;++c){S.push(e[f[c]])}return S}var t=si,n=oi;if(arguments.length)return r(e);r.x=function(e){return arguments.length?(t=e,r):t};r.y=function(e){return arguments.length?(n=e,r):n};return r};e.geom.polygon=function(e){e.area=function(){var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];while(++t<n){r+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1]}return r*.5};e.centroid=function(t){var n=-1,r=e.length,i=0,s=0,o,u=e[r-1],a;if(!arguments.length)t=-1/(6*e.area());while(++n<r){o=u;u=e[n];a=o[0]*u[1]-u[0]*o[1];i+=(o[0]+u[0])*a;s+=(o[1]+u[1])*a}return[i*t,s*t]};e.clip=function(t){var n,r=-1,i=e.length,s,o,u=e[i-1],a,f,l;while(++r<i){n=t.slice();t.length=0;a=e[r];f=n[(o=n.length)-1];s=-1;while(++s<o){l=n[s];if(Mi(l,u,a)){if(!Mi(f,u,a)){t.push(_i(f,l,u,a))}t.push(l)}else if(Mi(f,u,a)){t.push(_i(f,l,u,a))}f=l}u=a}return t};return e};e.geom.delaunay=function(e){var t=e.map(function(){return[]}),n=[];Pi(e,function(n){t[n.region.l.index].push(e[n.region.r.index])});t.forEach(function(t,r){var i=e[r],s=i[0],o=i[1];t.forEach(function(e){e.angle=Math.atan2(e[0]-s,e[1]-o)});t.sort(function(e,t){return e.angle-t.angle});for(var u=0,a=t.length-1;u<a;u++){n.push([i,t[u],t[u+1]])}});return n};e.geom.voronoi=function(t){function o(t){var n,o=t.map(function(){return[]}),u=Qt(r),a=Qt(i),f,l,c=t.length,h=1e6;if(u===si&&a===oi)n=t;else for(n=[],l=0;l<c;++l){n.push([+u.call(this,f=t[l],l),+a.call(this,f,l)])}Pi(n,function(e){var t,n,r,i,s,u;if(e.a===1&&e.b>=0){t=e.ep.r;n=e.ep.l}else{t=e.ep.l;n=e.ep.r}if(e.a===1){s=t?t.y:-h;r=e.c-e.b*s;u=n?n.y:h;i=e.c-e.b*u}else{r=t?t.x:-h;s=e.c-e.a*r;i=n?n.x:h;u=e.c-e.a*i}var a=[r,s],f=[i,u];o[e.region.l.index].push(a,f);o[e.region.r.index].push(a,f)});o=o.map(function(t,r){var i=n[r][0],s=n[r][1],o=t.map(function(e){return Math.atan2(e[0]-i,e[1]-s)}),u=e.range(t.length).sort(function(e,t){return o[e]-o[t]});return u.filter(function(e,t){return!t||o[e]-o[u[t-1]]>vt}).map(function(e){return t[e]})});o.forEach(function(e,t){var r=e.length;if(!r)return e.push([-h,-h],[-h,h],[h,h],[h,-h]);if(r>2)return;var i=n[t],s=e[0],o=e[1],u=i[0],a=i[1],f=s[0],l=s[1],c=o[0],p=o[1],d=Math.abs(c-f),v=p-l;if(Math.abs(v)<vt){var m=a<l?-h:h;e.push([-h,m],[h,m])}else if(d<vt){var g=u<f?-h:h;e.push([g,-h],[g,h])}else{var m=(c-f)*(l-a)<(f-u)*(p-l)?h:-h,y=Math.abs(v)-d;if(Math.abs(y)<vt){e.push([v<0?m:-m,m])}else{if(y>0)m*=-1;e.push([-h,m],[h,m])}}});if(s)for(l=0;l<c;++l)s(o[l]);for(l=0;l<c;++l)o[l].point=t[l];return o}var n=null,r=si,i=oi,s;if(arguments.length)return o(t);o.x=function(e){return arguments.length?(r=e,o):r};o.y=function(e){return arguments.length?(i=e,o):i};o.size=function(t){if(!arguments.length)return n;if(t==null){s=null}else{n=[+t[0],+t[1]];s=e.geom.polygon([[0,0],[0,n[1]],n,[n[0],0]]).clip}return o};o.links=function(e){var t,n=e.map(function(){return[]}),s=[],o=Qt(r),u=Qt(i),a,f,l=e.length;if(o===si&&u===oi)t=e;else for(f=0;f<l;++f){t.push([+o.call(this,a=e[f],f),+u.call(this,a,f)])}Pi(t,function(t){var r=t.region.l.index,i=t.region.r.index;if(n[r][i])return;n[r][i]=n[i][r]=true;s.push({source:e[r],target:e[i]})});return s};o.triangles=function(t){if(r===si&&i===oi)return e.geom.delaunay(t);var n,s,o=Qt(r),u=Qt(i),a,f,l;for(f=0,n=[],l=t.length;f<l;++f){s=[+o.call(this,a=t[f],f),+u.call(this,a,f)];s.data=a;n.push(s)}return e.geom.delaunay(n).map(function(e){return e.map(function(e){return e.data})})};return o};var Di={l:"r",r:"l"};e.geom.quadtree=function(e,t,n,r,i){function a(e){function x(e,t,n,r,i,s,o,u){if(isNaN(n)||isNaN(r))return;if(e.leaf){var a=e.x,f=e.y;if(a!=null){if(Math.abs(a-n)+Math.abs(f-r)<.01){T(e,t,n,r,i,s,o,u)}else{var l=e.point;e.x=e.y=e.point=null;T(e,l,a,f,i,s,o,u);T(e,t,n,r,i,s,o,u)}}else{e.x=n,e.y=r,e.point=t}}else{T(e,t,n,r,i,s,o,u)}}function T(e,t,n,r,i,s,o,u){var a=(i+o)*.5,f=(s+u)*.5,l=n>=a,c=r>=f,h=(c<<1)+l;e.leaf=false;e=e.nodes[h]||(e.nodes[h]=ji());if(l)i=a;else o=a;if(c)s=f;else u=f;x(e,t,n,r,i,s,o,u)}var a,f=Qt(s),l=Qt(o),c,h,p,d,v,m,g,y;if(t!=null){v=t,m=n,g=r,y=i}else{g=y=-(v=m=Infinity);c=[],h=[];d=e.length;if(u)for(p=0;p<d;++p){a=e[p];if(a.x<v)v=a.x;if(a.y<m)m=a.y;if(a.x>g)g=a.x;if(a.y>y)y=a.y;c.push(a.x);h.push(a.y)}else for(p=0;p<d;++p){var b=+f(a=e[p],p),w=+l(a,p);if(b<v)v=b;if(w<m)m=w;if(b>g)g=b;if(w>y)y=w;c.push(b);h.push(w)}}var E=g-v,S=y-m;if(E>S)y=m+E;else g=v+S;var N=ji();N.add=function(e){x(N,e,+f(e,++p),+l(e,p),v,m,g,y)};N.visit=function(e){Fi(e,N,v,m,g,y)};p=-1;if(t==null){while(++p<d){x(N,e[p],c[p],h[p],v,m,g,y)}--p}else e.forEach(N.add);c=h=e=a=null;return N}var s=si,o=oi,u;if(u=arguments.length){s=Hi;o=Bi;if(u===3){i=n;r=t;n=t=0}return a(e)}a.x=function(e){return arguments.length?(s=e,a):s};a.y=function(e){return arguments.length?(o=e,a):o};a.size=function(e){if(!arguments.length)return t==null?null:[r,i];if(e==null){t=n=r=i=null}else{t=n=0;r=+e[0],i=+e[1]}return a};return a};e.interpolateRgb=Ii;e.transform=function(n){var r=t.createElementNS(e.ns.prefix.svg,"g");return(e.transform=function(e){r.setAttribute("transform",e);var t=r.transform.baseVal.consolidate();return new qi(t?t.matrix:Wi)})(n)};qi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var Wi={a:1,b:0,c:0,d:1,e:0,f:0};e.interpolateNumber=Xi;e.interpolateTransform=Vi;e.interpolateObject=$i;e.interpolateString=Ji;var Ki=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;e.interpolate=Qi;e.interpolators=[function(e,t){var n=typeof t;return(n==="string"||n!==typeof e?Kt.has(t)||/^(#|rgb\(|hsl\()/.test(t)?Ii:Ji:t instanceof ft?Ii:n==="object"?Array.isArray(t)?Yi:$i:Xi)(e,t)}];e.interpolateArray=Yi;var Zi=function(){return Gt};var es=e.map({linear:Zi,poly:as,quad:function(){return ss},cubic:function(){return os},sin:function(){return fs},exp:function(){return ls},circle:function(){return cs},elastic:hs,back:ps,bounce:function(){return ds}});var ts=e.map({"in":Gt,out:rs,"in-out":is,"out-in":function(e){return is(rs(e))}});e.ease=function(e){var t=e.indexOf("-"),n=t>=0?e.substring(0,t):e,r=t>=0?e.substring(t+1):"in";n=es.get(n)||Zi;r=ts.get(r)||Gt;return ns(r(n.apply(null,Array.prototype.slice.call(arguments,1))))};e.interpolateHcl=vs;e.interpolateHsl=ms;e.interpolateLab=gs;e.interpolateRound=ys;e.layout={};e.layout.bundle=function(){return function(e){var t=[],n=-1,r=e.length;while(++n<r)t.push(Es(e[n]));return t}};e.layout.chord=function(){function l(){var t={},l=[],h=e.range(s),p=[],d,v,m,g,y;n=[];r=[];d=0,g=-1;while(++g<s){v=0,y=-1;while(++y<s){v+=i[g][y]}l.push(v);p.push(e.range(s));d+=v}if(u){h.sort(function(e,t){return u(l[e],l[t])})}if(a){p.forEach(function(e,t){e.sort(function(e,n){return a(i[t][e],i[t][n])})})}d=(2*dt-o*s)/d;v=0,g=-1;while(++g<s){m=v,y=-1;while(++y<s){var b=h[g],w=p[b][y],E=i[b][w],S=v,x=v+=E*d;t[b+"-"+w]={index:b,subindex:w,startAngle:S,endAngle:x,value:E}}r[b]={index:b,startAngle:m,endAngle:v,value:(v-m)/d};v+=o}g=-1;while(++g<s){y=g-1;while(++y<s){var T=t[g+"-"+y],N=t[y+"-"+g];if(T.value||N.value){n.push(T.value<N.value?{source:N,target:T}:{source:T,target:N})}}}if(f)c()}function c(){n.sort(function(e,t){return f((e.source.value+e.target.value)/2,(t.source.value+t.target.value)/2)})}var t={},n,r,i,s,o=0,u,a,f;t.matrix=function(e){if(!arguments.length)return i;s=(i=e)&&i.length;n=r=null;return t};t.padding=function(e){if(!arguments.length)return o;o=e;n=r=null;return t};t.sortGroups=function(e){if(!arguments.length)return u;u=e;n=r=null;return t};t.sortSubgroups=function(e){if(!arguments.length)return a;a=e;n=null;return t};t.sortChords=function(e){if(!arguments.length)return f;f=e;if(n)c();return t};t.chords=function(){if(!n)l();return n};t.groups=function(){if(!r)l();return r};return t};e.layout.force=function(){function g(e){return function(t,n,r,i){if(t.point!==e){var s=t.cx-e.x,o=t.cy-e.y,u=1/Math.sqrt(s*s+o*o);if((i-n)*u<c){var a=t.charge*u*u;e.px-=s*a;e.py-=o*a;return true}if(t.point&&isFinite(u)){var a=t.pointCharge*u*u;e.px-=s*a;e.py-=o*a}}return!t.charge}}function y(n){n.px=e.event.x,n.py=e.event.y;t.resume()}var t={},n=e.dispatch("start","tick","end"),r=[1,1],i,s,o=.9,u=As,a=Os,f=-30,l=.1,c=.8,h=[],p=[],d,v,m;t.tick=function(){if((s*=.99)<.005){n.end({type:"end",alpha:s=0});return true}var t=h.length,i=p.length,u,a,c,y,b,w,E,S,x;for(a=0;a<i;++a){c=p[a];y=c.source;b=c.target;S=b.x-y.x;x=b.y-y.y;if(w=S*S+x*x){w=s*v[a]*((w=Math.sqrt(w))-d[a])/w;S*=w;x*=w;b.x-=S*(E=y.weight/(b.weight+y.weight));b.y-=x*E;y.x+=S*(E=1-E);y.y+=x*E}}if(E=s*l){S=r[0]/2;x=r[1]/2;a=-1;if(E)while(++a<t){c=h[a];c.x+=(S-c.x)*E;c.y+=(x-c.y)*E}}if(f){Ls(u=e.geom.quadtree(h),s,m);a=-1;while(++a<t){if(!(c=h[a]).fixed){u.visit(g(c))}}}a=-1;while(++a<t){c=h[a];if(c.fixed){c.x=c.px;c.y=c.py}else{c.x-=(c.px-(c.px=c.x))*o;c.y-=(c.py-(c.py=c.y))*o}}n.tick({type:"tick",alpha:s})};t.nodes=function(e){if(!arguments.length)return h;h=e;return t};t.links=function(e){if(!arguments.length)return p;p=e;return t};t.size=function(e){if(!arguments.length)return r;r=e;return t};t.linkDistance=function(e){if(!arguments.length)return u;u=typeof e==="function"?e:+e;return t};t.distance=t.linkDistance;t.linkStrength=function(e){if(!arguments.length)return a;a=typeof e==="function"?e:+e;return t};t.friction=function(e){if(!arguments.length)return o;o=+e;return t};t.charge=function(e){if(!arguments.length)return f;f=typeof e==="function"?e:+e;return t};t.gravity=function(e){if(!arguments.length)return l;l=+e;return t};t.theta=function(e){if(!arguments.length)return c;c=+e;return t};t.alpha=function(r){if(!arguments.length)return s;r=+r;if(s){if(r>0)s=r;else s=0}else if(r>0){n.start({type:"start",alpha:s=r});e.timer(t.tick)}return t};t.start=function(){function y(t,n){var r=b(e),i=-1,s=r.length,o;while(++i<s)if(!isNaN(o=r[i][t]))return o;return Math.random()*n}function b(){if(!c){c=[];for(n=0;n<i;++n){c[n]=[]}for(n=0;n<s;++n){var t=p[n];c[t.source.index].push(t.target);c[t.target.index].push(t.source)}}return c[e]}var e,n,i=h.length,s=p.length,o=r[0],l=r[1],c,g;for(e=0;e<i;++e){(g=h[e]).index=e;g.weight=0}for(e=0;e<s;++e){g=p[e];if(typeof g.source=="number")g.source=h[g.source];if(typeof g.target=="number")g.target=h[g.target];++g.source.weight;++g.target.weight}for(e=0;e<i;++e){g=h[e];if(isNaN(g.x))g.x=y("x",o);if(isNaN(g.y))g.y=y("y",l);if(isNaN(g.px))g.px=g.x;if(isNaN(g.py))g.py=g.y}d=[];if(typeof u==="function")for(e=0;e<s;++e)d[e]=+u.call(this,p[e],e);else for(e=0;e<s;++e)d[e]=u;v=[];if(typeof a==="function")for(e=0;e<s;++e)v[e]=+a.call(this,p[e],e);else for(e=0;e<s;++e)v[e]=a;m=[];if(typeof f==="function")for(e=0;e<i;++e)m[e]=+f.call(this,h[e],e);else for(e=0;e<i;++e)m[e]=f;return t.resume()};t.resume=function(){return t.alpha(.1)};t.stop=function(){return t.alpha(0)};t.drag=function(){if(!i)i=e.behavior.drag().origin(Gt).on("dragstart.force",Ts).on("drag.force",y).on("dragend.force",Ns);if(!arguments.length)return i;this.on("mouseover.force",Cs).on("mouseout.force",ks).call(i)};return e.rebind(t,n,"on")};var As=20,Os=1;e.layout.hierarchy=function(){function r(i,o,u){var a=t.call(s,i,o);i.depth=o;u.push(i);if(a&&(l=a.length)){var f=-1,l,c=i.children=[],h=0,p=o+1,d;while(++f<l){d=r(a[f],p,u);d.parent=i;c.push(d);h+=d.value}if(e)c.sort(e);if(n)i.value=h}else if(n){i.value=+n.call(s,i,o)||0}return i}function i(e,t){var r=e.children,o=0;if(r&&(a=r.length)){var u=-1,a,f=t+1;while(++u<a)o+=i(r[u],f)}else if(n){o=+n.call(s,e,t)||0}if(n)e.value=o;return o}function s(e){var t=[];r(e,0,t);return t}var e=Ps,t=_s,n=Ds;s.sort=function(t){if(!arguments.length)return e;e=t;return s};s.children=function(e){if(!arguments.length)return t;t=e;return s};s.value=function(e){if(!arguments.length)return n;n=e;return s};s.revalue=function(e){i(e,0);return e};return s};e.layout.partition=function(){function r(e,t,n,i){var s=e.children;e.x=t;e.y=e.depth*i;e.dx=n;e.dy=i;if(s&&(u=s.length)){var o=-1,u,a,f;n=e.value?n/e.value:0;while(++o<u){r(a=s[o],t,f=a.value*n,i);t+=f}}}function i(e){var t=e.children,n=0;if(t&&(s=t.length)){var r=-1,s;while(++r<s)n=Math.max(n,i(t[r]))}return 1+n}function s(e,s){var o=t.call(this,e,s);r(o[0],0,n[0],n[1]/i(o[0]));return o}var t=e.layout.hierarchy(),n=[1,1];s.size=function(e){if(!arguments.length)return n;n=e;return s};return Ms(s,t)};e.layout.pie=function(){function s(o){var u=o.map(function(e,n){return+t.call(s,e,n)});var a=+(typeof r==="function"?r.apply(this,arguments):r);var f=((typeof i==="function"?i.apply(this,arguments):i)-a)/e.sum(u);var l=e.range(o.length);if(n!=null)l.sort(n===Bs?function(e,t){return u[t]-u[e]}:function(e,t){return n(o[e],o[t])});var c=[];l.forEach(function(e){var t;c[e]={data:o[e],value:t=u[e],startAngle:a,endAngle:a+=t*f}});return c}var t=Number,n=Bs,r=0,i=2*dt;s.value=function(e){if(!arguments.length)return t;t=e;return s};s.sort=function(e){if(!arguments.length)return n;n=e;return s};s.startAngle=function(e){if(!arguments.length)return r;r=e;return s};s.endAngle=function(e){if(!arguments.length)return i;i=e;return s};return s};var Bs={};e.layout.stack=function(){function u(a,f){var l=a.map(function(e,n){return t.call(u,e,n)});var c=l.map(function(e){return e.map(function(e,t){return[s.call(u,e,t),o.call(u,e,t)]})});var h=n.call(u,c,f);l=e.permute(l,h);c=e.permute(c,h);var p=r.call(u,c,f);var d=l.length,v=l[0].length,m,g,y;for(g=0;g<v;++g){i.call(u,l[0][g],y=p[g],c[0][g][1]);for(m=1;m<d;++m){i.call(u,l[m][g],y+=c[m-1][g][1],c[m][g][1])}}return a}var t=Gt,n=Us,r=zs,i=Is,s=js,o=Fs;u.values=function(e){if(!arguments.length)return t;t=e;return u};u.order=function(e){if(!arguments.length)return n;n=typeof e==="function"?e:qs.get(e)||Us;return u};u.offset=function(e){if(!arguments.length)return r;r=typeof e==="function"?e:Rs.get(e)||zs;return u};u.x=function(e){if(!arguments.length)return s;s=e;return u};u.y=function(e){if(!arguments.length)return o;o=e;return u};u.out=function(e){if(!arguments.length)return i;i=e;return u};return u};var qs=e.map({"inside-out":function(t){var n=t.length,r,i,s=t.map(Ws),o=t.map(Xs),u=e.range(n).sort(function(e,t){return s[e]-s[t]}),a=0,f=0,l=[],c=[];for(r=0;r<n;++r){i=u[r];if(a<f){a+=o[i];l.push(i)}else{f+=o[i];c.push(i)}}return c.reverse().concat(l)},reverse:function(t){return e.range(t.length).reverse()},"default":Us});var Rs=e.map({silhouette:function(e){var t=e.length,n=e[0].length,r=[],i=0,s,o,u,a=[];for(o=0;o<n;++o){for(s=0,u=0;s<t;s++)u+=e[s][o][1];if(u>i)i=u;r.push(u)}for(o=0;o<n;++o){a[o]=(i-r[o])/2}return a},wiggle:function(e){var t=e.length,n=e[0],r=n.length,i,s,o,u,a,f,l,c,h,p=[];p[0]=c=h=0;for(s=1;s<r;++s){for(i=0,u=0;i<t;++i)u+=e[i][s][1];for(i=0,a=0,l=n[s][0]-n[s-1][0];i<t;++i){for(o=0,f=(e[i][s][1]-e[i][s-1][1])/(2*l);o<i;++o){f+=(e[o][s][1]-e[o][s-1][1])/l}a+=f*e[i][s][1]}p[s]=c-=u?a/u*l:0;if(c<h)h=c}for(s=0;s<r;++s)p[s]-=h;return p},expand:function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,u=[];for(s=0;s<n;++s){for(i=0,o=0;i<t;i++)o+=e[i][s][1];if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)u[s]=0;return u},zero:zs});e.layout.histogram=function(){function s(s,o){var u=[],a=s.map(n,this),f=r.call(this,a,o),l=i.call(this,f,a,o),c,o=-1,h=a.length,p=l.length-1,d=t?1:1/h,v;while(++o<p){c=u[o]=[];c.dx=l[o+1]-(c.x=l[o]);c.y=0}if(p>0){o=-1;while(++o<h){v=a[o];if(v>=f[0]&&v<=f[1]){c=u[e.bisect(l,v,1,p)-1];c.y+=d;c.push(s[o])}}}return u}var t=true,n=Number,r=Ks,i=$s;s.value=function(e){if(!arguments.length)return n;n=e;return s};s.range=function(e){if(!arguments.length)return r;r=Qt(e);return s};s.bins=function(e){if(!arguments.length)return i;i=typeof e==="number"?function(t){return Js(t,e)}:Qt(e);return s};s.frequency=function(e){if(!arguments.length)return t;t=!!e;return s};return s};e.layout.tree=function(){function i(e,i){function u(e,t){var r=e.children,i=e._tree;if(r&&(s=r.length)){var s,o=r[0],a,l=o,c,h=-1;while(++h<s){c=r[h];u(c,a);l=f(c,a,l);a=c}io(e);var p=.5*(o._tree.prelim+c._tree.prelim);if(t){i.prelim=t._tree.prelim+n(e,t);i.mod=i.prelim-p}else{i.prelim=p}}else{if(t){i.prelim=t._tree.prelim+n(e,t)}}}function a(e,t){e.x=e._tree.prelim+t;var n=e.children;if(n&&(i=n.length)){var r=-1,i;t+=e._tree.mod;while(++r<i){a(n[r],t)}}}function f(e,t,r){if(t){var i=e,s=e,o=t,u=e.parent.children[0],a=i._tree.mod,f=s._tree.mod,l=o._tree.mod,c=u._tree.mod,h;while(o=Ys(o),i=Gs(i),o&&i){u=Gs(u);s=Ys(s);s._tree.ancestor=e;h=o._tree.prelim+l-i._tree.prelim-a+n(o,i);if(h>0){so(oo(o,e,r),e,h);a+=h;f+=h}l+=o._tree.mod;a+=i._tree.mod;c+=u._tree.mod;f+=s._tree.mod}if(o&&!Ys(s)){s._tree.thread=o;s._tree.mod+=l-f}if(i&&!Gs(u)){u._tree.thread=i;u._tree.mod+=a-c;r=e}}return r}var s=t.call(this,e,i),o=s[0];ro(o,function(e,t){e._tree={ancestor:e,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}});u(o);a(o,-o._tree.prelim);var l=Zs(o,to),c=Zs(o,eo),h=Zs(o,no),p=l.x-n(l,c)/2,d=c.x+n(c,l)/2,v=h.depth||1;ro(o,function(e){e.x=(e.x-p)/(d-p)*r[0];e.y=e.depth/v*r[1];delete e._tree});return s}var t=e.layout.hierarchy().sort(null).value(null),n=Qs,r=[1,1];i.separation=function(e){if(!arguments.length)return n;n=e;return i};i.size=function(e){if(!arguments.length)return r;r=e;return i};return Ms(i,t)};e.layout.pack=function(){function i(e,i){var s=t.call(this,e,i),o=s[0];o.x=0;o.y=0;ro(o,function(e){e.r=Math.sqrt(e.value)});ro(o,co);var u=r[0],a=r[1],f=Math.max(2*o.r/u,2*o.r/a);if(n>0){var l=n*f/2;ro(o,function(e){e.r+=l});ro(o,co);ro(o,function(e){e.r-=l});f=Math.max(2*o.r/u,2*o.r/a)}vo(o,u/2,a/2,1/f);return s}var t=e.layout.hierarchy().sort(uo),n=0,r=[1,1];i.size=function(e){if(!arguments.length)return r;r=e;return i};i.padding=function(e){if(!arguments.length)return n;n=+e;return i};return Ms(i,t)};e.layout.cluster=function(){function i(e,i){var s=t.call(this,e,i),o=s[0],u,a=0;ro(o,function(e){var t=e.children;if(t&&t.length){e.x=yo(t);e.y=go(t)}else{e.x=u?a+=n(e,u):0;e.y=0;u=e}});var f=bo(o),l=wo(o),c=f.x-n(f,l)/2,h=l.x+n(l,f)/2;ro(o,function(e){e.x=(e.x-c)/(h-c)*r[0];e.y=(1-(o.y?e.y/o.y:1))*r[1]});return s}var t=e.layout.hierarchy().sort(null).value(null),n=Qs,r=[1,1];i.separation=function(e){if(!arguments.length)return n;n=e;return i};i.size=function(e){if(!arguments.length)return r;r=e;return i};return Ms(i,t)};e.layout.treemap=function(){function l(e,t){var n=-1,r=e.length,i,s;while(++n<r){s=(i=e[n]).value*(t<0?0:t);i.area=isNaN(s)||s<=0?0:s}}function c(e){var t=e.children;if(t&&t.length){var n=s(e),r=[],i=t.slice(),o,u=Infinity,f,h=a==="slice"?n.dx:a==="dice"?n.dy:a==="slice-dice"?e.depth&1?n.dy:n.dx:Math.min(n.dx,n.dy),v;l(i,n.dx*n.dy/e.value);r.area=0;while((v=i.length)>0){r.push(o=i[v-1]);r.area+=o.area;if(a!=="squarify"||(f=p(r,h))<=u){i.pop();u=f}else{r.area-=r.pop().area;d(r,h,n,false);h=Math.min(n.dx,n.dy);r.length=r.area=0;u=Infinity}}if(r.length){d(r,h,n,true);r.length=r.area=0}t.forEach(c)}}function h(e){var t=e.children;if(t&&t.length){var n=s(e),r=t.slice(),i,o=[];l(r,n.dx*n.dy/e.value);o.area=0;while(i=r.pop()){o.push(i);o.area+=i.area;if(i.z!=null){d(o,i.z?n.dx:n.dy,n,!r.length);o.length=o.area=0}}t.forEach(h)}}function p(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++o<u){if(!(r=e[o].area))continue;if(r<s)s=r;if(r>i)i=r}n*=n;t*=t;return n?Math.max(t*i*f/n,n/(t*s*f)):Infinity}function d(e,t,r,i){var s=-1,o=e.length,u=r.x,a=r.y,f=t?n(e.area/t):0,l;if(t==r.dx){if(i||f>r.dy)f=r.dy;while(++s<o){l=e[s];l.x=u;l.y=a;l.dy=f;u+=l.dx=Math.min(r.x+r.dx-u,f?n(l.area/f):0)}l.z=true;l.dx+=r.x+r.dx-u;r.y+=f;r.dy-=f}else{if(i||f>r.dx)f=r.dx;while(++s<o){l=e[s];l.x=u;l.y=a;l.dx=f;a+=l.dy=Math.min(r.y+r.dy-a,f?n(l.area/f):0)}l.z=false;l.dy+=r.y+r.dy-a;r.x+=f;r.dx-=f}}function v(e){var n=u||t(e),i=n[0];i.x=0;i.y=0;i.dx=r[0];i.dy=r[1];if(u)t.revalue(i);l([i],i.dx*i.dy/i.value);(u?h:c)(i);if(o)u=n;return n}var t=e.layout.hierarchy(),n=Math.round,r=[1,1],i=null,s=Eo,o=false,u,a="squarify",f=.5*(1+Math.sqrt(5));v.size=function(e){if(!arguments.length)return r;r=e;return v};v.padding=function(e){function t(t){var n=e.call(v,t,t.depth);return n==null?Eo(t):So(t,typeof n==="number"?[n,n,n,n]:n)}function n(t){return So(t,e)}if(!arguments.length)return i;var r;s=(i=e)==null?Eo:(r=typeof e)==="function"?t:r==="number"?(e=[e,e,e,e],n):n;return v};v.round=function(e){if(!arguments.length)return n!=Number;n=e?Math.round:Number;return v};v.sticky=function(e){if(!arguments.length)return o;o=e;u=null;return v};v.ratio=function(e){if(!arguments.length)return f;f=e;return v};v.mode=function(e){if(!arguments.length)return a;a=e+"";return v};return Ms(v,t)};e.random={normal:function(e,t){var n=arguments.length;if(n<2)t=1;if(n<1)e=0;return function(){var n,r,i;do{n=Math.random()*2-1;r=Math.random()*2-1;i=n*n+r*r}while(!i||i>1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},irwinHall:function(e){return function(){for(var t=0,n=0;n<e;n++)t+=Math.random();return t/e}}};e.scale={};e.scale.linear=function(){return Lo([0,1],[0,1],Qi,false)};e.scale.log=function(){return Po(e.scale.linear().domain([0,Math.LN10]),10,Bo,jo)};var Ho=e.format(".0e");e.scale.pow=function(){return Ro(e.scale.linear(),1)};e.scale.sqrt=function(){return e.scale.pow().exponent(.5)};e.scale.ordinal=function(){return zo([],{t:"range",a:[[]]})};e.scale.category10=function(){return e.scale.ordinal().range(Wo)};e.scale.category20=function(){return e.scale.ordinal().range(Xo)};e.scale.category20b=function(){return e.scale.ordinal().range(Vo)};e.scale.category20c=function(){return e.scale.ordinal().range($o)};e.scale.category50=function(){return e.scale.ordinal().range(Jo)};var Wo=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var Xo=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];var Vo=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"];var $o=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];var Jo=["#1f77b4","#ff7f0e","#2ca02c","#8c864b","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf","#DC143C","#800080","#0000FF","#008000","#D2691E","#FF0000","#000000","#DB7093","#FF00FF","#7B68EE","#1f77b6","#9edae5","#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#aec7e8","#e7ba52","#ffbb78","#e7cb94","#98df8a","#843c39","#ff9896","#ad494a","#c5b0d5","#d6616b","#c49c94","#e7969c","#f7b6d2","#fd8d3c","#c7c7c7","#7b4173","#dbdb8d","#a55194"];e.scale.quantile=function(){return Ko([],[])};e.scale.quantize=function(){return Qo(0,1,[0,1])};e.scale.threshold=function(){return Go([.5],[0,1])};e.scale.identity=function(){return Yo([0,1])};e.svg.arc=function(){function i(){var i=e.apply(this,arguments),s=t.apply(this,arguments),o=n.apply(this,arguments)+Zo,u=r.apply(this,arguments)+Zo,a=(u<o&&(a=o,o=u,u=a),u-o),f=a<dt?"0":"1",l=Math.cos(o),c=Math.sin(o),h=Math.cos(u),p=Math.sin(u);return a>=eu?i?"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"M0,"+i+"A"+i+","+i+" 0 1,0 0,"+ -i+"A"+i+","+i+" 0 1,0 0,"+i+"Z":"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"Z":i?"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L"+i*h+","+i*p+"A"+i+","+i+" 0 "+f+",0 "+i*l+","+i*c+"Z":"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L0,0"+"Z"}var e=tu,t=nu,n=ru,r=iu;i.innerRadius=function(t){if(!arguments.length)return e;e=Qt(t);return i};i.outerRadius=function(e){if(!arguments.length)return t;t=Qt(e);return i};i.startAngle=function(e){if(!arguments.length)return n;n=Qt(e);return i};i.endAngle=function(e){if(!arguments.length)return r;r=Qt(e);return i};i.centroid=function(){var i=(e.apply(this,arguments)+t.apply(this,arguments))/2,s=(n.apply(this,arguments)+r.apply(this,arguments))/2+Zo;return[Math.cos(s)*i,Math.sin(s)*i]};return i};var Zo=-dt/2,eu=2*dt-1e-6;e.svg.line.radial=function(){var e=ii(su);e.radius=e.x,delete e.x;e.angle=e.y,delete e.y;return e};li.reverse=ci;ci.reverse=li;e.svg.area=function(){return ou(Gt)};e.svg.area.radial=function(){var e=ou(su);e.radius=e.x,delete e.x;e.innerRadius=e.x0,delete e.x0;e.outerRadius=e.x1,delete e.x1;e.angle=e.y,delete e.y;e.startAngle=e.y0,delete e.y0;e.endAngle=e.y1,delete e.y1;return e};e.svg.chord=function(){function s(n,r){var i=o(this,e,n,r),s=o(this,t,n,r);return"M"+i.p0+a(i.r,i.p1,i.a1-i.a0)+(u(i,s)?f(i.r,i.p1,i.r,i.p0):f(i.r,i.p1,s.r,s.p0)+a(s.r,s.p1,s.a1-s.a0)+f(s.r,s.p1,i.r,i.p0))+"Z"}function o(e,t,s,o){var u=t.call(e,s,o),a=n.call(e,u,o),f=r.call(e,u,o)+Zo,l=i.call(e,u,o)+Zo;return{r:a,a0:f,a1:l,p0:[a*Math.cos(f),a*Math.sin(f)],p1:[a*Math.cos(l),a*Math.sin(l)]}}function u(e,t){return e.a0==t.a0&&e.a1==t.a1}function a(e,t,n){return"A"+e+","+e+" 0 "+ +(n>dt)+",1 "+t}function f(e,t,n,r){return"Q 0,0 "+r}var e=Nr,t=Cr,n=uu,r=ru,i=iu;s.radius=function(e){if(!arguments.length)return n;n=Qt(e);return s};s.source=function(t){if(!arguments.length)return e;e=Qt(t);return s};s.target=function(e){if(!arguments.length)return t;t=Qt(e);return s};s.startAngle=function(e){if(!arguments.length)return r;r=Qt(e);return s};s.endAngle=function(e){if(!arguments.length)return i;i=Qt(e);return s};return s};e.svg.diagonal=function(){function r(r,i){var s=e.call(this,r,i),o=t.call(this,r,i),u=(s.y+o.y)/2,a=[s,{x:s.x,y:u},{x:o.x,y:u},o];a=a.map(n);return"M"+a[0]+"C"+a[1]+" "+a[2]+" "+a[3]}var e=Nr,t=Cr,n=au;r.source=function(t){if(!arguments.length)return e;e=Qt(t);return r};r.target=function(e){if(!arguments.length)return t;t=Qt(e);return r};r.projection=function(e){if(!arguments.length)return n;n=e;return r};return r};e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),n=au,r=t.projection;t.projection=function(e){return arguments.length?r(fu(n=e)):n};return t};e.svg.symbol=function(){function n(n,r){return(pu.get(e.call(this,n,r))||hu)(t.call(this,n,r))}var e=cu,t=lu;n.type=function(t){if(!arguments.length)return e;e=Qt(t);return n};n.size=function(e){if(!arguments.length)return t;t=Qt(e);return n};return n};var pu=e.map({circle:hu,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+ -3*t+","+ -t+"H"+ -t+"V"+ -3*t+"H"+t+"V"+ -t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+ -t+"V"+t+"H"+ -3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vu)),n=t*vu;return"M0,"+ -t+"L"+n+",0"+" 0,"+t+" "+ -n+",0"+"Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+ -t+","+ -t+"L"+t+","+ -t+" "+t+","+t+" "+ -t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/du),n=t*du/2;return"M0,"+n+"L"+t+","+ -n+" "+ -t+","+ -n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/du),n=t*du/2;return"M0,"+ -n+"L"+t+","+n+" "+ -t+","+n+"Z"}});e.svg.symbolTypes=pu.keys();var du=Math.sqrt(3),vu=Math.tan(30*mt);var gu=[],yu=0,bu,wu={ease:us,delay:0,duration:250};gu.call=B.call;gu.empty=B.empty;gu.node=B.node;e.transition=function(e){return arguments.length?bu?e.transition():e:st.transition()};e.transition.prototype=gu;gu.select=function(e){var t=this.id,n=[],r,i,s;if(typeof e!=="function")e=j(e);for(var o=-1,u=this.length;++o<u;){n.push(r=[]);for(var a=this[o],f=-1,l=a.length;++f<l;){if((s=a[f])&&(i=e.call(s,s.__data__,f))){if("__data__"in s)i.__data__=s.__data__;xu(i,f,t,s.__transition__[t]);r.push(i)}else{r.push(null)}}}return mu(n,t)};gu.selectAll=function(e){var t=this.id,n=[],r,i,s,o,u;if(typeof e!=="function")e=F(e);for(var a=-1,f=this.length;++a<f;){for(var l=this[a],c=-1,h=l.length;++c<h;){if(s=l[c]){u=s.__transition__[t];i=e.call(s,s.__data__,c);n.push(r=[]);for(var p=-1,d=i.length;++p<d;){xu(o=i[p],p,t,u);r.push(o)}}}}return mu(n,t)};gu.filter=function(e){var t=[],n,r,i;if(typeof e!=="function")e=K(e);for(var s=0,o=this.length;s<o;s++){t.push(n=[]);for(var r=this[s],u=0,a=r.length;u<a;u++){if((i=r[u])&&e.call(i,i.__data__,u)){n.push(i)}}}return mu(t,this.id,this.time).ease(this.ease())};gu.tween=function(e,t){var n=this.id;if(arguments.length<2)return this.node().__transition__[n].tween.get(e);return nt(this,t==null?function(t){t.__transition__[n].tween.remove(e)}:function(r){r.__transition__[n].tween.set(e,t)})};gu.attr=function(t,n){function s(){this.removeAttribute(i)}function o(){this.removeAttributeNS(i.space,i.local)}if(arguments.length<2){for(n in t)this.attr(n,t[n]);return this}var r=Gi(t),i=e.ns.qualify(t);return Eu(this,"attr."+t,n,function(e){function t(){var t=this.getAttribute(i),n;return t!==e&&(n=r(t,e),function(e){this.setAttribute(i,n(e))})}function n(){var t=this.getAttributeNS(i.space,i.local),n;return t!==e&&(n=r(t,e),function(e){this.setAttributeNS(i.space,i.local,n(e))})}return e==null?i.local?o:s:(e+="",i.local?n:t)})};gu.attrTween=function(t,n){function i(e,t){var i=n.call(this,e,t,this.getAttribute(r));return i&&function(e){this.setAttribute(r,i(e))}}function s(e,t){var i=n.call(this,e,t,this.getAttributeNS(r.space,r.local));return i&&function(e){this.setAttributeNS(r.space,r.local,i(e))}}var r=e.ns.qualify(t);return this.tween("attr."+t,r.local?s:i)};gu.style=function(e,t,r){function o(){this.style.removeProperty(e)}var i=arguments.length;if(i<3){if(typeof e!=="string"){if(i<2)t="";for(r in e)this.style(r,e[r],t);return this}r=""}var s=Gi(e);return Eu(this,"style."+e,t,function(t){function i(){var i=n.getComputedStyle(this,null).getPropertyValue(e),o;return i!==t&&(o=s(i,t),function(t){this.style.setProperty(e,o(t),r)})}return t==null?o:(t+="",i)})};gu.styleTween=function(e,t,r){if(arguments.length<3)r="";return this.tween("style."+e,function(i,s){var o=t.call(this,i,s,n.getComputedStyle(this,null).getPropertyValue(e));return o&&function(t){this.style.setProperty(e,o(t),r)}})};gu.text=function(e){return Eu(this,"text",e,Su)};gu.remove=function(){return this.each("end.transition",function(){var e;if(!this.__transition__&&(e=this.parentNode))e.removeChild(this)})};gu.ease=function(t){var n=this.id;if(arguments.length<1)return this.node().__transition__[n].ease;if(typeof t!=="function")t=e.ease.apply(e,arguments);return nt(this,function(e){e.__transition__[n].ease=t})};gu.delay=function(e){var t=this.id;return nt(this,typeof e==="function"?function(n,r,i){n.__transition__[t].delay=e.call(n,n.__data__,r,i)|0}:(e|=0,function(n){n.__transition__[t].delay=e}))};gu.duration=function(e){var t=this.id;return nt(this,typeof e==="function"?function(n,r,i){n.__transition__[t].duration=Math.max(1,e.call(n,n.__data__,r,i)|0)}:(e=Math.max(1,e|0),function(n){n.__transition__[t].duration=e}))};gu.each=function(e,t){var n=this.id;if(arguments.length<2){var r=wu,i=bu;bu=n;nt(this,function(t,r,i){wu=t.__transition__[n];e.call(t,t.__data__,r,i)});wu=r;bu=i}else{nt(this,function(r){r.__transition__[n].event.on(e,t)})}return this};gu.transition=function(){var e=this.id,t=++yu,n=[],r,i,s,o;for(var u=0,a=this.length;u<a;u++){n.push(r=[]);for(var i=this[u],f=0,l=i.length;f<l;f++){if(s=i[f]){o=Object.create(s.__transition__[e]);o.delay+=o.duration;xu(s,f,t,o)}r.push(s)}}return mu(n,t)};e.svg.axis=function(){function c(c){c.each(function(){var c=e.select(this);var h=a==null?t.ticks?t.ticks.apply(t,u):t.domain():a,p=f==null?t.tickFormat?t.tickFormat.apply(t,u):String:f;var d=Lu(t,h,l),v=c.selectAll(".tick.minor").data(d,String),m=v.enter().insert("line",".tick").attr("class","tick minor").style("opacity",1e-6),g=e.transition(v.exit()).style("opacity",1e-6).remove(),y=e.transition(v).style("opacity",1);var b=c.selectAll(".tick.major").data(h,String),w=b.enter().insert("g","path").attr("class","tick major").style("opacity",1e-6),E=e.transition(b.exit()).style("opacity",1e-6).remove(),S=e.transition(b).style("opacity",1),x;var T=To(t),N=c.selectAll(".domain").data([0]),C=(N.enter().append("path").attr("class","domain"),e.transition(N));var k=t.copy(),L=this.__chart__||k;this.__chart__=k;w.append("line");w.append("text");var A=w.select("line"),O=S.select("line"),M=b.select("text").text(p),_=w.select("text"),D=S.select("text");switch(n){case"bottom":{x=Cu;m.attr("y2",i);y.attr("x2",0).attr("y2",i);A.attr("y2",r);_.attr("y",Math.max(r,0)+o);O.attr("x2",0).attr("y2",r);D.attr("x",0).attr("y",Math.max(r,0)+o);M.attr("dy",".71em").style("text-anchor","middle");C.attr("d","M"+T[0]+","+s+"V0H"+T[1]+"V"+s);break};case"top":{x=Cu;m.attr("y2",-i);y.attr("x2",0).attr("y2",-i);A.attr("y2",-r);_.attr("y",-(Math.max(r,0)+o));O.attr("x2",0).attr("y2",-r);D.attr("x",0).attr("y",-(Math.max(r,0)+o));M.attr("dy","0em").style("text-anchor","middle");C.attr("d","M"+T[0]+","+ -s+"V0H"+T[1]+"V"+ -s);break};case"left":{x=ku;m.attr("x2",-i);y.attr("x2",-i).attr("y2",0);A.attr("x2",-r);_.attr("x",-(Math.max(r,0)+o));O.attr("x2",-r).attr("y2",0);D.attr("x",-(Math.max(r,0)+o)).attr("y",0);M.attr("dy",".32em").style("text-anchor","end");C.attr("d","M"+ -s+","+T[0]+"H0V"+T[1]+"H"+ -s);break};case"right":{x=ku;m.attr("x2",i);y.attr("x2",i).attr("y2",0);A.attr("x2",r);_.attr("x",Math.max(r,0)+o);O.attr("x2",r).attr("y2",0);D.attr("x",Math.max(r,0)+o).attr("y",0);M.attr("dy",".32em").style("text-anchor","start");C.attr("d","M"+s+","+T[0]+"H0V"+T[1]+"H"+s);break}}if(t.ticks){w.call(x,L);S.call(x,k);E.call(x,k);m.call(x,L);y.call(x,k);g.call(x,k)}else{var P=k.rangeBand()/2,H=function(e){return k(e)+P};w.call(x,H);S.call(x,H)}})}var t=e.scale.linear(),n=Tu,r=6,i=6,s=6,o=3,u=[10],a=null,f,l=0;c.scale=function(e){if(!arguments.length)return t;t=e;return c};c.orient=function(e){if(!arguments.length)return n;n=e in Nu?e+"":Tu;return c};c.ticks=function(){if(!arguments.length)return u;u=arguments;return c};c.tickValues=function(e){if(!arguments.length)return a;a=e;return c};c.tickFormat=function(e){if(!arguments.length)return f;f=e;return c};c.tickSize=function(e,t){if(!arguments.length)return r;var n=arguments.length-1;r=+e;i=n>1?+t:r;s=n>0?+arguments[n]:r;return c};c.tickPadding=function(e){if(!arguments.length)return o;o=+e;return c};c.tickSubdivide=function(e){if(!arguments.length)return l;l=+e;return c};return c};var Tu="bottom",Nu={top:1,right:1,bottom:1,left:1};e.svg.brush=function(){function a(t){t.each(function(){var t=e.select(this),n=t.selectAll(".background").data([0]),o=t.selectAll(".extent").data([0]),u=t.selectAll(".resize").data(s,String),p;t.style("pointer-events","all").on("mousedown.brush",h).on("touchstart.brush",h);n.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");o.enter().append("rect").attr("class","extent").style("cursor","move");u.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return Au[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");u.style("display",a.empty()?"none":null);u.exit().remove();if(r){p=To(r);n.attr("x",p[0]).attr("width",p[1]-p[0]);l(t)}if(i){p=To(i);n.attr("y",p[0]).attr("height",p[1]-p[0]);c(t)}f(t)})}function f(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+o[+/e$/.test(e)][0]+","+o[+/^s/.test(e)][1]+")"})}function l(e){e.select(".extent").attr("x",o[0][0]);e.selectAll(".extent,.n>rect,.s>rect").attr("width",o[1][0]-o[0][0])}function c(e){e.select(".extent").attr("y",o[0][1]);e.selectAll(".extent,.e>rect,.w>rect").attr("height",o[1][1]-o[0][1])}function h(){function C(){var t=e.event.changedTouches;return t?e.touches(s,t)[0]:e.mouse(s)}function k(){if(e.event.keyCode==32){if(!b){w=null;E[0]-=o[1][0];E[1]-=o[1][1];b=2}y()}}function L(){if(e.event.keyCode==32&&b==2){E[0]+=o[1][0];E[1]+=o[1][1];b=0;y()}}function A(){var t=C(),n=false;if(S){t[0]+=S[0];t[1]+=S[1]}if(!b){if(e.event.altKey){if(!w)w=[(o[0][0]+o[1][0])/2,(o[0][1]+o[1][1])/2];E[0]=o[+(t[0]<w[0])][0];E[1]=o[+(t[1]<w[1])][1]}else w=null}if(m&&O(t,r,0)){l(d);n=true}if(g&&O(t,i,1)){c(d);n=true}if(n){f(d);p({type:"brush",mode:b?"move":"resize"})}}function O(e,t,n){var r=To(t),i=r[0],s=r[1],a=E[n],f=o[1][n]-o[0][n],l,c;if(b){i-=a;s-=f+a}l=Math.max(i,Math.min(s,e[n]));if(b){c=(l+=a)+f}else{if(w)a=Math.max(i,Math.min(s,2*w[n]-l));if(a<l){c=l;l=a}else{c=a}}if(o[0][n]!==l||o[1][n]!==c){u=null;o[0][n]=l;o[1][n]=c;return true}}function M(){A();d.style("pointer-events","all").selectAll(".resize").style("display",a.empty()?"none":null);e.select("body").style("cursor",null);x.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null);p({type:"brushend"});y()}var s=this,h=e.select(e.event.target),p=t.of(s,arguments),d=e.select(s),v=h.datum(),m=!/^(n|s)$/.test(v)&&r,g=!/^(e|w)$/.test(v)&&i,b=h.classed("extent"),w,E=C(),S;var x=e.select(n).on("mousemove.brush",A).on("mouseup.brush",M).on("touchmove.brush",A).on("touchend.brush",M).on("keydown.brush",k).on("keyup.brush",L);if(b){E[0]=o[0][0]-E[0];E[1]=o[0][1]-E[1]}else if(v){var T=+/w$/.test(v),N=+/^n/.test(v);S=[o[1-T][0]-E[0],o[1-N][1]-E[1]];E[0]=o[T][0];E[1]=o[N][1]}else if(e.event.altKey)w=E.slice();d.style("pointer-events","none").selectAll(".resize").style("display",null);e.select("body").style("cursor",h.style("cursor"));p({type:"brushstart"});A();y()}var t=S(a,"brushstart","brush","brushend"),r=null,i=null,s=Ou[0],o=[[0,0],[0,0]],u;a.x=function(e){if(!arguments.length)return r;r=e;s=Ou[!r<<1|!i];return a};a.y=function(e){if(!arguments.length)return i;i=e;s=Ou[!r<<1|!i];return a};a.extent=function(e){var t,n,s,f,l;if(!arguments.length){e=u||o;if(r){t=e[0][0],n=e[1][0];if(!u){t=o[0][0],n=o[1][0];if(r.invert)t=r.invert(t),n=r.invert(n);if(n<t)l=t,t=n,n=l}}if(i){s=e[0][1],f=e[1][1];if(!u){s=o[0][1],f=o[1][1];if(i.invert)s=i.invert(s),f=i.invert(f);if(f<s)l=s,s=f,f=l}}return r&&i?[[t,s],[n,f]]:r?[t,n]:i&&[s,f]}u=[[0,0],[0,0]];if(r){t=e[0],n=e[1];if(i)t=t[0],n=n[0];u[0][0]=t,u[1][0]=n;if(r.invert)t=r(t),n=r(n);if(n<t)l=t,t=n,n=l;o[0][0]=t|0,o[1][0]=n|0}if(i){s=e[0],f=e[1];if(r)s=s[1],f=f[1];u[0][1]=s,u[1][1]=f;if(i.invert)s=i(s),f=i(f);if(f<s)l=s,s=f,f=l;o[0][1]=s|0,o[1][1]=f|0}return a};a.clear=function(){u=null;o[0][0]=o[0][1]=o[1][0]=o[1][1]=0;return a};a.empty=function(){return r&&o[0][0]===o[1][0]||i&&o[0][1]===o[1][1]};return e.rebind(a,t,"on")};var Au={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"};var Ou=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];e.time={};var Mu=Date,_u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Du.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Pu.setUTCDate.apply(this._,arguments)},setDay:function(){Pu.setUTCDay.apply(this._,arguments)},setFullYear:function(){Pu.setUTCFullYear.apply(this._,arguments)},setHours:function(){Pu.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Pu.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Pu.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Pu.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Pu.setUTCSeconds.apply(this._,arguments)},setTime:function(){Pu.setTime.apply(this._,arguments)}};var Pu=Date.prototype;var Hu="%a %b %e %X %Y",Bu="%m/%d/%Y",ju="%H:%M:%S";var Fu=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Iu=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],qu=["January","February","March","April","May","June","July","August","September","October","November","December"],Ru=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];e.time.year=Uu(function(t){t=e.time.day(t);t.setMonth(0,1);return t},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()});e.time.years=e.time.year.range;e.time.years.utc=e.time.year.utc.range;e.time.day=Uu(function(e){var t=new Mu(1970,0);t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate());return t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1});e.time.days=e.time.day.range;e.time.days.utc=e.time.day.utc.range;e.time.dayOfYear=function(t){var n=e.time.year(t);return Math.floor((t-n-(t.getTimezoneOffset()-n.getTimezoneOffset())*6e4)/864e5)};_u.forEach(function(t,n){t=t.toLowerCase();n=7-n;var r=e.time[t]=Uu(function(t){(t=e.time.day(t)).setDate(t.getDate()-(t.getDay()+n)%7);return t},function(e,t){e.setDate(e.getDate()+Math.floor(t)*7)},function(t){var r=e.time.year(t).getDay();return Math.floor((e.time.dayOfYear(t)+(r+n)%7)/7)-(r!==n)});e.time[t+"s"]=r.range;e.time[t+"s"].utc=r.utc.range;e.time[t+"OfYear"]=function(t){var r=e.time.year(t).getDay();return Math.floor((e.time.dayOfYear(t)+(r+n)%7)/7)}});e.time.week=e.time.sunday;e.time.weeks=e.time.sunday.range;e.time.weeks.utc=e.time.sunday.utc.range;e.time.weekOfYear=e.time.sundayOfYear;e.time.format=function(e){function n(n){var r=[],i=-1,s=0,o,u,a;while(++i<t){if(e.charCodeAt(i)===37){r.push(e.substring(s,i));if((u=ea[o=e.charAt(++i)])!=null)o=e.charAt(++i);if(a=ta[o])o=a(n,u==null?o==="e"?" ":"0":u);r.push(o);s=i+1}}r.push(e.substring(s,i));return r.join("")}var t=e.length;n.parse=function(t){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},r=Wu(n,e,t,0);if(r!=t.length)return null;if("p"in n)n.H=n.H%12+n.p*12;var i=new Mu;i.setFullYear(n.y,n.m,n.d);i.setHours(n.H,n.M,n.S,n.L);return i};n.toString=function(){return e};return n};var Ju=Xu(Fu),Ku=Xu(Iu),Qu=Xu(qu),Gu=Vu(qu),Yu=Xu(Ru),Zu=Vu(Ru);var ea={"-":"",_:" ",0:"0"};var ta={a:function(e){return Iu[e.getDay()]},A:function(e){return Fu[e.getDay()]},b:function(e){return Ru[e.getMonth()]},B:function(e){return qu[e.getMonth()]},c:e.time.format(Hu),d:function(e,t){return $u(e.getDate(),t,2)},e:function(e,t){return $u(e.getDate(),t,2)},H:function(e,t){return $u(e.getHours(),t,2)},I:function(e,t){return $u(e.getHours()%12||12,t,2)},j:function(t,n){return $u(1+e.time.dayOfYear(t),n,3)},L:function(e,t){return $u(e.getMilliseconds(),t,3)},m:function(e,t){return $u(e.getMonth()+1,t,2)},M:function(e,t){return $u(e.getMinutes(),t,2)},p:function(e){return e.getHours()>=12?"PM":"AM"},S:function(e,t){return $u(e.getSeconds(),t,2)},U:function(t,n){return $u(e.time.sundayOfYear(t),n,2)},w:function(e){return e.getDay()},W:function(t,n){return $u(e.time.mondayOfYear(t),n,2)},x:e.time.format(Bu),X:e.time.format(ju),y:function(e,t){return $u(e.getFullYear()%100,t,2)},Y:function(e,t){return $u(e.getFullYear()%1e4,t,4)},Z:Sa,"%":function(){return"%"}};var na={a:ra,A:ia,b:sa,B:oa,c:ua,d:da,e:da,H:va,I:va,L:ya,m:pa,M:ma,p:wa,S:ga,x:aa,X:fa,y:ca,Y:la};var ba=/^\s*\d+/;var Ea=e.map({am:0,pm:1});e.time.format.utc=function(t){function r(e){try{Mu=Du;var t=new Mu;t._=e;return n(t)}finally{Mu=Date}}var n=e.time.format(t);r.parse=function(e){try{Mu=Du;var t=n.parse(e);return t&&t._}finally{Mu=Date}};r.toString=n.toString;return r};var xa=e.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");e.time.format.iso=Date.prototype.toISOString&&+(new Date("2000-01-01T00:00:00.000Z"))?Ta:xa;Ta.parse=function(e){var t=new Date(e);return isNaN(t)?null:t};Ta.toString=xa.toString;e.time.second=Uu(function(e){return new Mu(Math.floor(e/1e3)*1e3)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*1e3)},function(e){return e.getSeconds()});e.time.seconds=e.time.second.range;e.time.seconds.utc=e.time.second.utc.range;e.time.minute=Uu(function(e){return new Mu(Math.floor(e/6e4)*6e4)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*6e4)},function(e){return e.getMinutes()});e.time.minutes=e.time.minute.range;e.time.minutes.utc=e.time.minute.utc.range;e.time.hour=Uu(function(e){var t=e.getTimezoneOffset()/60;return new Mu((Math.floor(e/36e5-t)+t)*36e5)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*36e5)},function(e){return e.getHours()});e.time.hours=e.time.hour.range;e.time.hours.utc=e.time.hour.utc.range;e.time.month=Uu(function(t){t=e.time.day(t);t.setDate(1);return t},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()});e.time.months=e.time.month.range;e.time.months.utc=e.time.month.utc.range;var Ma=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6];var _a=[[e.time.second,1],[e.time.second,5],[e.time.second,15],[e.time.second,30],[e.time.minute,1],[e.time.minute,5],[e.time.minute,15],[e.time.minute,30],[e.time.hour,1],[e.time.hour,3],[e.time.hour,6],[e.time.hour,12],[e.time.day,1],[e.time.day,2],[e.time.week,1],[e.time.month,1],[e.time.month,3],[e.time.year,1]];var Da=[[e.time.format("%Y"),$n],[e.time.format("%B"),function(e){return e.getMonth()}],[e.time.format("%b %d"),function(e){return e.getDate()!=1}],[e.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[e.time.format("%I %p"),function(e){return e.getHours()}],[e.time.format("%I:%M"),function(e){return e.getMinutes()}],[e.time.format(":%S"),function(e){return e.getSeconds()}],[e.time.format(".%L"),function(e){return e.getMilliseconds()}]];var Pa=e.scale.linear(),Ha=La(Da);_a.year=function(e,t){return Pa.domain(e.map(Oa)).ticks(t).map(Aa)};e.time.scale=function(){return Na(e.scale.linear(),_a,Ha)};var Ba=_a.map(function(e){return[e[0].utc,e[1]]});var ja=[[e.time.format.utc("%Y"),$n],[e.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[e.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[e.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[e.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[e.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[e.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[e.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]];var Fa=La(ja);Ba.year=function(e,t){return Pa.domain(e.map(qa)).ticks(t).map(Ia)};e.time.scale.utc=function(){return Na(e.scale.linear(),Ba,Fa)};e.text=function(){return e.xhr.apply(e,arguments).response(Ra)};e.json=function(t,n){return e.xhr(t,"application/json",n).response(Ua)};e.html=function(t,n){return e.xhr(t,"text/html",n).response(za)};e.xml=function(){return e.xhr.apply(e,arguments).response(Wa)};return e}() \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/fisheye.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/fisheye.js
new file mode 100644
index 00000000..e1addd7b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/fisheye.js
@@ -0,0 +1,86 @@
+(function() {
+ d3.fisheye = {
+ scale: function(scaleType) {
+ return d3_fisheye_scale(scaleType(), 3, 0);
+ },
+ circular: function() {
+ var radius = 200,
+ distortion = 2,
+ k0,
+ k1,
+ focus = [0, 0];
+
+ function fisheye(d) {
+ var dx = d.x - focus[0],
+ dy = d.y - focus[1],
+ dd = Math.sqrt(dx * dx + dy * dy);
+ if (!dd || dd >= radius) return {x: d.x, y: d.y, z: 1};
+ var k = k0 * (1 - Math.exp(-dd * k1)) / dd * .75 + .25;
+ return {x: focus[0] + dx * k, y: focus[1] + dy * k, z: Math.min(k, 10)};
+ }
+
+ function rescale() {
+ k0 = Math.exp(distortion);
+ k0 = k0 / (k0 - 1) * radius;
+ k1 = distortion / radius;
+ return fisheye;
+ }
+
+ fisheye.radius = function(_) {
+ if (!arguments.length) return radius;
+ radius = +_;
+ return rescale();
+ };
+
+ fisheye.distortion = function(_) {
+ if (!arguments.length) return distortion;
+ distortion = +_;
+ return rescale();
+ };
+
+ fisheye.focus = function(_) {
+ if (!arguments.length) return focus;
+ focus = _;
+ return fisheye;
+ };
+
+ return rescale();
+ }
+ };
+
+ function d3_fisheye_scale(scale, d, a) {
+
+ function fisheye(_) {
+ var x = scale(_),
+ left = x < a,
+ v,
+ range = d3.extent(scale.range()),
+ min = range[0],
+ max = range[1],
+ m = left ? a - min : max - a;
+ if (m == 0) m = max - min;
+ return (left ? -1 : 1) * m * (d + 1) / (d + (m / Math.abs(x - a))) + a;
+ }
+
+ fisheye.distortion = function(_) {
+ if (!arguments.length) return d;
+ d = +_;
+ return fisheye;
+ };
+
+ fisheye.focus = function(_) {
+ if (!arguments.length) return a;
+ a = +_;
+ return fisheye;
+ };
+
+ fisheye.copy = function() {
+ return d3_fisheye_scale(scale.copy(), d, a);
+ };
+
+ fisheye.nice = scale.nice;
+ fisheye.ticks = scale.ticks;
+ fisheye.tickFormat = scale.tickFormat;
+ return d3.rebind(fisheye, scale, "domain", "range");
+ }
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/hive.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/hive.js
new file mode 100644
index 00000000..06e53aed
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/hive.js
@@ -0,0 +1,80 @@
+d3.hive = {};
+
+d3.hive.link = function() {
+ var source = function(d) { return d.source; },
+ target = function(d) { return d.target; },
+ angle = function(d) { return d.angle; },
+ startRadius = function(d) { return d.radius; },
+ endRadius = startRadius,
+ arcOffset = -Math.PI / 2;
+
+ function link(d, i) {
+ var s = node(source, this, d, i),
+ t = node(target, this, d, i),
+ x;
+ if (t.a < s.a) x = t, t = s, s = x;
+ if (t.a - s.a > Math.PI) s.a += 2 * Math.PI;
+ var a1 = s.a + (t.a - s.a) / 3,
+ a2 = t.a - (t.a - s.a) / 3;
+ return s.r0 - s.r1 || t.r0 - t.r1
+ ? "M" + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0
+ + "L" + Math.cos(s.a) * s.r1 + "," + Math.sin(s.a) * s.r1
+ + "C" + Math.cos(a1) * s.r1 + "," + Math.sin(a1) * s.r1
+ + " " + Math.cos(a2) * t.r1 + "," + Math.sin(a2) * t.r1
+ + " " + Math.cos(t.a) * t.r1 + "," + Math.sin(t.a) * t.r1
+ + "L" + Math.cos(t.a) * t.r0 + "," + Math.sin(t.a) * t.r0
+ + "C" + Math.cos(a2) * t.r0 + "," + Math.sin(a2) * t.r0
+ + " " + Math.cos(a1) * s.r0 + "," + Math.sin(a1) * s.r0
+ + " " + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0
+ : "M" + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0
+ + "C" + Math.cos(a1) * s.r1 + "," + Math.sin(a1) * s.r1
+ + " " + Math.cos(a2) * t.r1 + "," + Math.sin(a2) * t.r1
+ + " " + Math.cos(t.a) * t.r1 + "," + Math.sin(t.a) * t.r1;
+ }
+
+ function node(method, thiz, d, i) {
+ var node = method.call(thiz, d, i),
+ a = +(typeof angle === "function" ? angle.call(thiz, node, i) : angle) + arcOffset,
+ r0 = +(typeof startRadius === "function" ? startRadius.call(thiz, node, i) : startRadius),
+ r1 = (startRadius === endRadius ? r0 : +(typeof endRadius === "function" ? endRadius.call(thiz, node, i) : endRadius));
+ return {r0: r0, r1: r1, a: a};
+ }
+
+ link.source = function(_) {
+ if (!arguments.length) return source;
+ source = _;
+ return link;
+ };
+
+ link.target = function(_) {
+ if (!arguments.length) return target;
+ target = _;
+ return link;
+ };
+
+ link.angle = function(_) {
+ if (!arguments.length) return angle;
+ angle = _;
+ return link;
+ };
+
+ link.radius = function(_) {
+ if (!arguments.length) return startRadius;
+ startRadius = endRadius = _;
+ return link;
+ };
+
+ link.startRadius = function(_) {
+ if (!arguments.length) return startRadius;
+ startRadius = _;
+ return link;
+ };
+
+ link.endRadius = function(_) {
+ if (!arguments.length) return endRadius;
+ endRadius = _;
+ return link;
+ };
+
+ return link;
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/horizon.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/horizon.js
new file mode 100644
index 00000000..d84c6567
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/horizon.js
@@ -0,0 +1,192 @@
+(function() {
+ d3.horizon = function() {
+ var bands = 1, // between 1 and 5, typically
+ mode = "offset", // or mirror
+ interpolate = "linear", // or basis, monotone, step-before, etc.
+ x = d3_horizonX,
+ y = d3_horizonY,
+ w = 960,
+ h = 40,
+ duration = 0;
+
+ var color = d3.scale.linear()
+ .domain([-1, 0, 1])
+ .range(["#d62728", "#fff", "#1f77b4"]);
+
+ // For each small multiple…
+ function horizon(g) {
+ g.each(function(d, i) {
+ var g = d3.select(this),
+ n = 2 * bands + 1,
+ xMin = Infinity,
+ xMax = -Infinity,
+ yMax = -Infinity,
+ x0, // old x-scale
+ y0, // old y-scale
+ id; // unique id for paths
+
+ // Compute x- and y-values along with extents.
+ var data = d.map(function(d, i) {
+ var xv = x.call(this, d, i),
+ yv = y.call(this, d, i);
+ if (xv < xMin) xMin = xv;
+ if (xv > xMax) xMax = xv;
+ if (-yv > yMax) yMax = -yv;
+ if (yv > yMax) yMax = yv;
+ return [xv, yv];
+ });
+
+ // Compute the new x- and y-scales, and transform.
+ var x1 = d3.scale.linear().domain([xMin, xMax]).range([0, w]),
+ y1 = d3.scale.linear().domain([0, yMax]).range([0, h * bands]),
+ t1 = d3_horizonTransform(bands, h, mode);
+
+ // Retrieve the old scales, if this is an update.
+ if (this.__chart__) {
+ x0 = this.__chart__.x;
+ y0 = this.__chart__.y;
+ t0 = this.__chart__.t;
+ id = this.__chart__.id;
+ } else {
+ x0 = x1.copy();
+ y0 = y1.copy();
+ t0 = t1;
+ id = ++d3_horizonId;
+ }
+
+ // We'll use a defs to store the area path and the clip path.
+ var defs = g.selectAll("defs")
+ .data([null]);
+
+ // The clip path is a simple rect.
+ defs.enter().append("defs").append("clipPath")
+ .attr("id", "d3_horizon_clip" + id)
+ .append("rect")
+ .attr("width", w)
+ .attr("height", h);
+
+ defs.select("rect").transition()
+ .duration(duration)
+ .attr("width", w)
+ .attr("height", h);
+
+ // We'll use a container to clip all horizon layers at once.
+ g.selectAll("g")
+ .data([null])
+ .enter().append("g")
+ .attr("clip-path", "url(#d3_horizon_clip" + id + ")");
+
+ // Instantiate each copy of the path with different transforms.
+ var path = g.select("g").selectAll("path")
+ .data(d3.range(-1, -bands - 1, -1).concat(d3.range(1, bands + 1)), Number);
+
+ var d0 = d3_horizonArea
+ .interpolate(interpolate)
+ .x(function(d) { return x0(d[0]); })
+ .y0(h * bands)
+ .y1(function(d) { return h * bands - y0(d[1]); })
+ (data);
+
+ var d1 = d3_horizonArea
+ .x(function(d) { return x1(d[0]); })
+ .y1(function(d) { return h * bands - y1(d[1]); })
+ (data);
+
+ path.enter().append("path")
+ .style("fill", color)
+ .attr("transform", t0)
+ .attr("d", d0);
+
+ path.transition()
+ .duration(duration)
+ .style("fill", color)
+ .attr("transform", t1)
+ .attr("d", d1);
+
+ path.exit().transition()
+ .duration(duration)
+ .attr("transform", t1)
+ .attr("d", d1)
+ .remove();
+
+ // Stash the new scales.
+ this.__chart__ = {x: x1, y: y1, t: t1, id: id};
+ });
+ d3.timer.flush();
+ }
+
+ horizon.duration = function(x) {
+ if (!arguments.length) return duration;
+ duration = +x;
+ return horizon;
+ };
+
+ horizon.bands = function(x) {
+ if (!arguments.length) return bands;
+ bands = +x;
+ color.domain([-bands, 0, bands]);
+ return horizon;
+ };
+
+ horizon.mode = function(x) {
+ if (!arguments.length) return mode;
+ mode = x + "";
+ return horizon;
+ };
+
+ horizon.colors = function(x) {
+ if (!arguments.length) return color.range();
+ color.range(x);
+ return horizon;
+ };
+
+ horizon.interpolate = function(x) {
+ if (!arguments.length) return interpolate;
+ interpolate = x + "";
+ return horizon;
+ };
+
+ horizon.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ return horizon;
+ };
+
+ horizon.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ return horizon;
+ };
+
+ horizon.width = function(x) {
+ if (!arguments.length) return w;
+ w = +x;
+ return horizon;
+ };
+
+ horizon.height = function(x) {
+ if (!arguments.length) return h;
+ h = +x;
+ return horizon;
+ };
+
+ return horizon;
+ };
+
+ var d3_horizonArea = d3.svg.area(),
+ d3_horizonId = 0;
+
+ function d3_horizonX(d) {
+ return d[0];
+ }
+
+ function d3_horizonY(d) {
+ return d[1];
+ }
+
+ function d3_horizonTransform(bands, h, mode) {
+ return mode == "offset"
+ ? function(d) { return "translate(0," + (d + (d < 0) - bands) * h + ")"; }
+ : function(d) { return (d < 0 ? "scale(1,-1)" : "") + "translate(0," + (d - bands) * h + ")"; };
+ }
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/interactiveLayer.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/interactiveLayer.js
new file mode 100644
index 00000000..4dfb68dc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/interactiveLayer.js
@@ -0,0 +1,251 @@
+/* Utility class to handle creation of an interactive layer.
+This places a rectangle on top of the chart. When you mouse move over it, it sends a dispatch
+containing the X-coordinate. It can also render a vertical line where the mouse is located.
+
+dispatch.elementMousemove is the important event to latch onto. It is fired whenever the mouse moves over
+the rectangle. The dispatch is given one object which contains the mouseX/Y location.
+It also has 'pointXValue', which is the conversion of mouseX to the x-axis scale.
+*/
+nv.interactiveGuideline = function() {
+ "use strict";
+ var tooltip = nv.models.tooltip();
+ //Public settings
+ var width = null
+ , height = null
+ //Please pass in the bounding chart's top and left margins
+ //This is important for calculating the correct mouseX/Y positions.
+ , margin = {left: 0, top: 0}
+ , xScale = d3.scale.linear()
+ , yScale = d3.scale.linear()
+ , dispatch = d3.dispatch('elementMousemove', 'elementMouseout','elementDblclick')
+ , showGuideLine = true
+ , svgContainer = null
+ //Must pass in the bounding chart's <svg> container.
+ //The mousemove event is attached to this container.
+ ;
+
+ //Private variables
+ var isMSIE = navigator.userAgent.indexOf("MSIE") !== -1 //Check user-agent for Microsoft Internet Explorer.
+ ;
+
+
+ function layer(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || 960), availableHeight = (height || 400);
+
+ var wrap = container.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([data]);
+ var wrapEnter = wrap.enter()
+ .append("g").attr("class", " nv-wrap nv-interactiveLineLayer");
+
+
+ wrapEnter.append("g").attr("class","nv-interactiveGuideLine");
+
+ if (!svgContainer) {
+ return;
+ }
+
+ function mouseHandler() {
+ var d3mouse = d3.mouse(this);
+ var mouseX = d3mouse[0];
+ var mouseY = d3mouse[1];
+ var subtractMargin = true;
+ var mouseOutAnyReason = false;
+ if (isMSIE) {
+ /*
+ D3.js (or maybe SVG.getScreenCTM) has a nasty bug in Internet Explorer 10.
+ d3.mouse() returns incorrect X,Y mouse coordinates when mouse moving
+ over a rect in IE 10.
+ However, d3.event.offsetX/Y also returns the mouse coordinates
+ relative to the triggering <rect>. So we use offsetX/Y on IE.
+ */
+ mouseX = d3.event.offsetX;
+ mouseY = d3.event.offsetY;
+
+ /*
+ On IE, if you attach a mouse event listener to the <svg> container,
+ it will actually trigger it for all the child elements (like <path>, <circle>, etc).
+ When this happens on IE, the offsetX/Y is set to where ever the child element
+ is located.
+ As a result, we do NOT need to subtract margins to figure out the mouse X/Y
+ position under this scenario. Removing the line below *will* cause
+ the interactive layer to not work right on IE.
+ */
+ if(d3.event.target.tagName !== "svg")
+ subtractMargin = false;
+
+ if (d3.event.target.className.baseVal.match("nv-legend"))
+ mouseOutAnyReason = true;
+
+ }
+
+ if(subtractMargin) {
+ mouseX -= margin.left;
+ mouseY -= margin.top;
+ }
+
+ /* If mouseX/Y is outside of the chart's bounds,
+ trigger a mouseOut event.
+ */
+ if (mouseX < 0 || mouseY < 0
+ || mouseX > availableWidth || mouseY > availableHeight
+ || (d3.event.relatedTarget && d3.event.relatedTarget.ownerSVGElement === undefined)
+ || mouseOutAnyReason
+ )
+ {
+ if (isMSIE) {
+ if (d3.event.relatedTarget
+ && d3.event.relatedTarget.ownerSVGElement === undefined
+ && d3.event.relatedTarget.className.match(tooltip.nvPointerEventsClass)) {
+ return;
+ }
+ }
+ dispatch.elementMouseout({
+ mouseX: mouseX,
+ mouseY: mouseY
+ });
+ layer.renderGuideLine(null); //hide the guideline
+ return;
+ }
+
+ var pointXValue = xScale.invert(mouseX);
+ dispatch.elementMousemove({
+ mouseX: mouseX,
+ mouseY: mouseY,
+ pointXValue: pointXValue
+ });
+
+ //If user double clicks the layer, fire a elementDblclick dispatch.
+ if (d3.event.type === "dblclick") {
+ dispatch.elementDblclick({
+ mouseX: mouseX,
+ mouseY: mouseY,
+ pointXValue: pointXValue
+ });
+ }
+ }
+
+ svgContainer
+ .on("mousemove",mouseHandler, true)
+ .on("mouseout" ,mouseHandler,true)
+ .on("dblclick" ,mouseHandler)
+ ;
+
+ //Draws a vertical guideline at the given X postion.
+ layer.renderGuideLine = function(x) {
+ if (!showGuideLine) return;
+ var line = wrap.select(".nv-interactiveGuideLine")
+ .selectAll("line")
+ .data((x != null) ? [nv.utils.NaNtoZero(x)] : [], String);
+
+ line.enter()
+ .append("line")
+ .attr("class", "nv-guideline")
+ .attr("x1", function(d) { return d;})
+ .attr("x2", function(d) { return d;})
+ .attr("y1", availableHeight)
+ .attr("y2",0)
+ ;
+ line.exit().remove();
+
+ }
+ });
+ }
+
+ layer.dispatch = dispatch;
+ layer.tooltip = tooltip;
+
+ layer.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return layer;
+ };
+
+ layer.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return layer;
+ };
+
+ layer.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return layer;
+ };
+
+ layer.xScale = function(_) {
+ if (!arguments.length) return xScale;
+ xScale = _;
+ return layer;
+ };
+
+ layer.showGuideLine = function(_) {
+ if (!arguments.length) return showGuideLine;
+ showGuideLine = _;
+ return layer;
+ };
+
+ layer.svgContainer = function(_) {
+ if (!arguments.length) return svgContainer;
+ svgContainer = _;
+ return layer;
+ };
+
+
+ return layer;
+};
+
+/* Utility class that uses d3.bisect to find the index in a given array, where a search value can be inserted.
+This is different from normal bisectLeft; this function finds the nearest index to insert the search value.
+
+For instance, lets say your array is [1,2,3,5,10,30], and you search for 28.
+Normal d3.bisectLeft will return 4, because 28 is inserted after the number 10. But interactiveBisect will return 5
+because 28 is closer to 30 than 10.
+
+Unit tests can be found in: interactiveBisectTest.html
+
+Has the following known issues:
+ * Will not work if the data points move backwards (ie, 10,9,8,7, etc) or if the data points are in random order.
+ * Won't work if there are duplicate x coordinate values.
+*/
+nv.interactiveBisect = function (values, searchVal, xAccessor) {
+ "use strict";
+ if (! values instanceof Array) return null;
+ if (typeof xAccessor !== 'function') xAccessor = function(d,i) { return d.x;}
+
+ var bisect = d3.bisector(xAccessor).left;
+ var index = d3.max([0, bisect(values,searchVal) - 1]);
+ var currentValue = xAccessor(values[index], index);
+ if (typeof currentValue === 'undefined') currentValue = index;
+
+ if (currentValue === searchVal) return index; //found exact match
+
+ var nextIndex = d3.min([index+1, values.length - 1]);
+ var nextValue = xAccessor(values[nextIndex], nextIndex);
+ if (typeof nextValue === 'undefined') nextValue = nextIndex;
+
+ if (Math.abs(nextValue - searchVal) >= Math.abs(currentValue - searchVal))
+ return index;
+ else
+ return nextIndex
+};
+
+/*
+Returns the index in the array "values" that is closest to searchVal.
+Only returns an index if searchVal is within some "threshold".
+Otherwise, returns null.
+*/
+nv.nearestValueIndex = function (values, searchVal, threshold) {
+ "use strict";
+ var yDistMax = Infinity, indexToHighlight = null;
+ values.forEach(function(d,i) {
+ var delta = Math.abs(searchVal - d);
+ if ( delta <= yDistMax && delta < threshold) {
+ yDistMax = delta;
+ indexToHighlight = i;
+ }
+ });
+ return indexToHighlight;
+}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/intro.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/intro.js
new file mode 100644
index 00000000..af50383e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/intro.js
@@ -0,0 +1 @@
+(function(){
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis-min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis-min.js
new file mode 100644
index 00000000..1101dde5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis-min.js
@@ -0,0 +1 @@
+nv.models.axis=function(){function o(d){return d.each(function(d){var o=d3.select(this),p=o.selectAll("g.nv-wrap.nv-axis").data([d]),q=p.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");q.append("g");var s=p.select("g");null!==m?a.ticks(m):("top"==a.orient()||"bottom"==a.orient())&&a.ticks(Math.abs(e.range()[1]-e.range()[0])/100),d3.transition(s).call(a),n=n||a.scale();var t=a.tickFormat();null==t&&(t=n.tickFormat());var u=s.selectAll("text.nv-axislabel").data([f||null]);switch(u.exit().remove(),a.orient()){case"top":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",0);var v=2==e.range().length?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);if(u.attr("x",v/2),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a){return"translate("+e(a)+",0)"}).select("text").attr("dy","0em").attr("y",-a.tickPadding()).attr("text-anchor","middle").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+e.range()[b]+",0)"})}break;case"bottom":var x=36,y=30,z=s.selectAll("g").select("text");if(i%360){z.each(function(){var c=this.getBBox().width;c>y&&(y=c)});var A=Math.abs(Math.sin(i*Math.PI/180)),x=(A?A*y:y)+30;z.attr("transform",function(){return"rotate("+i+" 0,0)"}).attr("text-anchor",i%360>0?"start":"end")}u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",x);var v=2==e.range().length?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);if(u.attr("x",v/2),g){var w=p.selectAll("g.nv-axisMaxMin").data([e.domain()[0],e.domain()[e.domain().length-1]]);w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",a.tickPadding()).attr("transform",function(){return"rotate("+i+" 0,0)"}).attr("text-anchor",i?i%360>0?"start":"end":"middle").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"})}k&&z.attr("transform",function(a,b){return"translate(0,"+(0==b%2?"0":"12")+")"});break;case"right":if(u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(90)":"").attr("y",j?-Math.max(b.right,c)+30:-10),u.attr("x",j?e.range()[0]/2:a.tickPadding()),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",a.tickPadding()).attr("text-anchor","start").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":if(u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(-90)":"").attr("y",j?-Math.max(b.left,c)+0:-10),u.attr("x",j?-e.range()[0]/2:-a.tickPadding()),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-a.tickPadding()).attr("text-anchor","start").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}}if(u.text(function(a){return a}),!g||"left"!==a.orient()&&"right"!==a.orient()||(s.selectAll("g").each(function(a){d3.select(this).select("text").attr("opacity",1),(e(a)<e.range()[1]+10||e(a)>e.range()[0]-10)&&((a>1e-10||-1e-10>a)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0))}),e.domain()[0]==e.domain()[1]&&0==e.domain()[0]&&p.selectAll("g.nv-axisMaxMin").style("opacity",function(a,b){return b?0:1})),g&&("top"===a.orient()||"bottom"===a.orient())){var B=[];p.selectAll("g.nv-axisMaxMin").each(function(a,b){try{b?B.push(e(a)-this.getBBox().width-4):B.push(e(a)+this.getBBox().width+4)}catch(c){b?B.push(e(a)-4):B.push(e(a)+4)}}),s.selectAll("g").each(function(a){(e(a)<B[0]||e(a)>B[1])&&(a>1e-10||-1e-10>a?d3.select(this).remove():d3.select(this).select("text").remove())})}h&&s.selectAll("line.tick").filter(function(a){return!parseFloat(Math.round(1e5*a)/1e6)}).classed("zero",!0),n=e.copy()}),o}var a=d3.svg.axis(),b={top:0,right:0,bottom:0,left:0},c=75,d=60,e=d3.scale.linear(),f=null,g=!1,h=!0,i=0,j=!0,k=!1,l=!1,m=null;a.scale(e).orient("bottom").tickFormat(function(a){return a});var n;return o.axis=a,d3.rebind(o,a,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o.margin=function(a){return arguments.length?(b.top=a.top!==void 0?a.top:b.top,b.right=a.right!==void 0?a.right:b.right,b.bottom=a.bottom!==void 0?a.bottom:b.bottom,b.left=a.left!==void 0?a.left:b.left,o):b},o.width=function(a){return arguments.length?(c=a,o):c},o.ticks=function(a){return arguments.length?(m=a,o):m},o.height=function(a){return arguments.length?(d=a,o):d},o.axisLabel=function(a){return arguments.length?(f=a,o):f},o.showMaxMin=function(a){return arguments.length?(g=a,o):g},o.highlightZero=function(a){return arguments.length?(h=a,o):h},o.scale=function(b){return arguments.length?(e=b,a.scale(e),l="function"==typeof e.rangeBands,d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o):e},o.rotateYLabel=function(a){return arguments.length?(j=a,o):j},o.rotateLabels=function(a){return arguments.length?(i=a,o):i},o.staggerLabels=function(a){return arguments.length?(k=a,o):k},o}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis.js
new file mode 100644
index 00000000..9895c3f0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis.js
@@ -0,0 +1,470 @@
+nv.models.axis = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var axis = d3.svg.axis()
+ ;
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 75 //only used for tickLabel currently
+ , height = 60 //only used for tickLabel currently
+ , scale = d3.scale.linear()
+ , axisLabelText = null
+ , showMaxMin = true //TODO: showMaxMin should be disabled on all ordinal scaled axes
+ , highlightZero = true
+ , rotateLabels = 0
+ , rotateYLabel = true
+ , staggerLabels = false
+ , isOrdinal = false
+ , ticks = null
+ , logScale = false
+ , axisLabelDistance = 12 //The larger this number is, the closer the axis label is to the axis.
+ ;
+
+ axis
+ .scale(scale)
+ .orient('bottom')
+ .tickFormat(function(d) { return d })
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var scale0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-axis').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-axis');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ //------------------------------------------------------------
+
+
+ if (ticks !== null)
+ axis.ticks(ticks);
+ else if (axis.orient() == 'top' || axis.orient() == 'bottom')
+ axis.ticks(Math.abs(scale.range()[1] - scale.range()[0]) / 100);
+
+
+ //TODO: consider calculating width/height based on whether or not label is added, for reference in charts using this component
+
+
+ g.transition().call(axis);
+
+ scale0 = scale0 || axis.scale();
+
+ var fmt = axis.tickFormat();
+ if (fmt == null) {
+ fmt = scale0.tickFormat();
+ }
+
+ var axisLabel = g.selectAll('text.nv-axislabel')
+ .data([axisLabelText || null]);
+ axisLabel.exit().remove();
+ switch (axis.orient()) {
+ case 'top':
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0]));
+ axisLabel
+ .attr('text-anchor', 'middle')
+ .attr('y', 0)
+ .attr('x', w/2);
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text');
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(' + scale(d) + ',0)'
+ })
+ .select('text')
+ .attr('dy', '0em')
+ .attr('y', -axis.tickPadding())
+ .attr('text-anchor', 'middle')
+ .text(function(d,i) {
+ //var v = fmt(d);
+ var v = d;
+ if(logScale) {
+ v = Math.pow(10,v);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else
+ v = fmt(v);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ axisMaxMin.transition()
+ .attr('transform', function(d,i) {
+ return 'translate(' + scale.range()[i] + ',0)'
+ });
+ }
+ break;
+ case 'bottom':
+ var xLabelMargin = 36;
+ var maxTextWidth = 30;
+ var xTicks = g.selectAll('g').select("text");
+ if (rotateLabels%360) {
+ //Calculate the longest xTick width
+ xTicks.each(function(d,i){
+ var width = this.getBBox().width;
+ if(width > maxTextWidth) maxTextWidth = width;
+ });
+ //Convert to radians before calculating sin. Add 30 to margin for healthy padding.
+ var sin = Math.abs(Math.sin(rotateLabels*Math.PI/180));
+ var xLabelMargin = (sin ? sin*maxTextWidth : maxTextWidth)+30;
+ //Rotate all xTicks
+ xTicks
+ .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' })
+ .style('text-anchor', rotateLabels%360 > 0 ? 'start' : 'end');
+ }
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0]));
+ axisLabel
+ .attr('text-anchor', 'middle')
+ .attr('y', xLabelMargin)
+ .attr('x', w/2);
+ if (showMaxMin) {
+ //if (showMaxMin && !isOrdinal) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ //.data(scale.domain())
+ .data([scale.domain()[0], scale.domain()[scale.domain().length - 1]]);
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text');
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)'
+ })
+ .select('text')
+ .attr('dy', '.71em')
+ .attr('y', axis.tickPadding())
+ .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' })
+ .style('text-anchor', rotateLabels ? (rotateLabels%360 > 0 ? 'start' : 'end') : 'middle')
+ .text(function(d,i) {
+ //var v = fmt(d);
+ var v = d;
+ if(logScale) {
+ v = Math.pow(10,v);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else
+ v = fmt(v);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ axisMaxMin.transition()
+ .attr('transform', function(d,i) {
+ //return 'translate(' + scale.range()[i] + ',0)'
+ //return 'translate(' + scale(d) + ',0)'
+ return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)'
+ });
+ }
+ if (staggerLabels)
+ xTicks
+ .attr('transform', function(d,i) { return 'translate(0,' + (i % 2 == 0 ? '0' : '12') + ')' });
+
+ break;
+ case 'right':
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ axisLabel
+ .style('text-anchor', rotateYLabel ? 'middle' : 'begin')
+ .attr('transform', rotateYLabel ? 'rotate(90)' : '')
+ .attr('y', rotateYLabel ? (-Math.max(margin.right,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart
+ .attr('x', rotateYLabel ? (scale.range()[0] / 2) : axis.tickPadding());
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text')
+ .style('opacity', 0);
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale(d) + ')'
+ })
+ .select('text')
+ .attr('dy', '.32em')
+ .attr('y', 0)
+ .attr('x', axis.tickPadding())
+ .style('text-anchor', 'start')
+ .text(function(d,i) {
+ //var v = fmt(d);
+ var v = d;
+ if(logScale) {
+ v = Math.pow(10,v);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else
+ v = fmt(v);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ axisMaxMin.transition()
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale.range()[i] + ')'
+ })
+ .select('text')
+ .style('opacity', 1);
+ }
+ break;
+ case 'left':
+ /*
+ //For dynamically placing the label. Can be used with dynamically-sized chart axis margins
+ var yTicks = g.selectAll('g').select("text");
+ yTicks.each(function(d,i){
+ var labelPadding = this.getBBox().width + axis.tickPadding() + 16;
+ if(labelPadding > width) width = labelPadding;
+ });
+ */
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ axisLabel
+ .style('text-anchor', rotateYLabel ? 'middle' : 'end')
+ .attr('transform', rotateYLabel ? 'rotate(-90)' : '')
+ .attr('y', rotateYLabel ? (-Math.max(margin.left,width) + axisLabelDistance) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart
+ .attr('x', rotateYLabel ? (-scale.range()[0] / 2) : -axis.tickPadding());
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text')
+ .style('opacity', 0);
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale0(d) + ')'
+ })
+ .select('text')
+ .attr('dy', '.32em')
+ .attr('y', 0)
+ .attr('x', -axis.tickPadding())
+ .attr('text-anchor', 'end')
+ .text(function(d,i) {
+ //var v = fmt(d);
+ var v = d;
+ if(logScale) {
+ v = Math.pow(10,v);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else
+ v = fmt(v);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ axisMaxMin.transition()
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale.range()[i] + ')'
+ })
+ .select('text')
+ .style('opacity', 1);
+ }
+ break;
+ }
+ axisLabel
+ .text(function(d) { return d });
+
+
+ if (showMaxMin && (axis.orient() === 'left' || axis.orient() === 'right')) {
+ //check if max and min overlap other values, if so, hide the values that overlap
+ g.selectAll('g') // the g's wrapping each tick
+ .each(function(d,i) {
+ d3.select(this).select('text').attr('opacity', 1);
+ var v;
+ if(logScale) {
+ v = Math.pow(10,d);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else {
+ v = fmt(d);
+ }
+
+ //d3.select(this).select('text').text(fmt(Math.pow(10,d)));
+ d3.select(this).select('text').text(v);
+ if (scale(d) < scale.range()[1] + 10 || scale(d) > scale.range()[0] - 10) { // 10 is assuming text height is 16... if d is 0, leave it!
+ if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL
+ d3.select(this).attr('opacity', 0);
+
+ d3.select(this).select('text').attr('opacity', 0); // Don't remove the ZERO line!!
+ }
+ });
+
+ //if Max and Min = 0 only show min, Issue #281
+ if (scale.domain()[0] == scale.domain()[1] && scale.domain()[0] == 0)
+ wrap.selectAll('g.nv-axisMaxMin')
+ .style('opacity', function(d,i) { return !i ? 1 : 0 });
+
+ }
+
+ if (showMaxMin && (axis.orient() === 'top' || axis.orient() === 'bottom')) {
+ var maxMinRange = [];
+ wrap.selectAll('g.nv-axisMaxMin')
+ .each(function(d,i) {
+ try {
+ if (i) // i== 1, max position
+ maxMinRange.push(scale(d) - this.getBBox().width - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
+ else // i==0, min position
+ maxMinRange.push(scale(d) + this.getBBox().width + 4)
+ }catch (err) {
+ if (i) // i== 1, max position
+ maxMinRange.push(scale(d) - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
+ else // i==0, min position
+ maxMinRange.push(scale(d) + 4)
+ }
+ });
+ g.selectAll('g') // the g's wrapping each tick
+ .each(function(d,i) {
+ var v;
+ if(logScale) {
+ v = Math.pow(10,d);
+ //v = fmt(v);
+ //fmt = d3.format(',.2f');
+ v = fmt(v);
+ } else {
+ v = fmt(d);
+ }
+ //alert(v);
+
+ //d3.select(this).select('text').text(fmt(Math.pow(10,d)));
+ d3.select(this).select('text').text(v);
+
+ if (scale(d) < maxMinRange[0] || scale(d) > maxMinRange[1]) {
+ if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL
+ d3.select(this).remove();
+ else
+ d3.select(this).select('text').remove(); // Don't remove the ZERO line!!
+ }
+ });
+ }
+
+
+ //highlight zero line ... Maybe should not be an option and should just be in CSS?
+ if (highlightZero)
+ g.selectAll('.tick')
+ .filter(function(d) { return !parseFloat(Math.round(d.__data__*100000)/1000000) && (d.__data__ !== undefined) }) //this is because sometimes the 0 tick is a very small fraction, TODO: think of cleaner technique
+ .classed('zero', true);
+
+ //store old scales for use in transitions on update
+ scale0 = scale.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.axis = axis;
+
+ d3.rebind(chart, axis, 'orient', 'tickValues', 'tickSubdivide', 'tickSize', 'tickPadding', 'tickFormat');
+ d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands'); //these are also accessible by chart.scale(), but added common ones directly for ease of use
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if(!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ }
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.ticks = function(_) {
+ if (!arguments.length) return ticks;
+ ticks = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.axisLabel = function(_) {
+ if (!arguments.length) return axisLabelText;
+ axisLabelText = _;
+ return chart;
+ }
+
+ chart.showMaxMin = function(_) {
+ if (!arguments.length) return showMaxMin;
+ showMaxMin = _;
+ return chart;
+ }
+
+ chart.logScale = function(_) {
+ if (!arguments.length) return logScale;
+ logScale = _;
+ return chart;
+ }
+
+ chart.highlightZero = function(_) {
+ if (!arguments.length) return highlightZero;
+ highlightZero = _;
+ return chart;
+ }
+
+ chart.scale = function(_) {
+ if (!arguments.length) return scale;
+ scale = _;
+ axis.scale(scale);
+ isOrdinal = typeof scale.rangeBands === 'function';
+ d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands');
+ return chart;
+ }
+
+ chart.rotateYLabel = function(_) {
+ if(!arguments.length) return rotateYLabel;
+ rotateYLabel = _;
+ return chart;
+ }
+
+ chart.rotateLabels = function(_) {
+ if(!arguments.length) return rotateLabels;
+ rotateLabels = _;
+ return chart;
+ }
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+ chart.axisLabelDistance = function(_) {
+ if (!arguments.length) return axisLabelDistance;
+ axisLabelDistance = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis.min.js
new file mode 100644
index 00000000..6c8ad6ab
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis.min.js
@@ -0,0 +1 @@
+nv.models.axis=function(){"use strict";function m(r){r.each(function(r){var m=d3.select(this);var g=m.selectAll("g.nv-wrap.nv-axis").data([r]);var y=g.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");var b=y.append("g");var w=g.select("g");if(h!==null)e.ticks(h);else if(e.orient()=="top"||e.orient()=="bottom")e.ticks(Math.abs(i.range()[1]-i.range()[0])/100);w.transition().call(e);v=v||e.scale();var E=e.tickFormat();if(E==null){E=v.tickFormat()}var S=w.selectAll("text.nv-axislabel").data([s||null]);S.exit().remove();switch(e.orient()){case"top":S.enter().append("text").attr("class","nv-axislabel");var x=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);S.attr("text-anchor","middle").attr("y",0).attr("x",x/2);if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+i(e)+",0)"}).select("text").attr("dy","0em").attr("y",-e.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+i.range()[t]+",0)"})}break;case"bottom":var N=36;var C=30;var k=w.selectAll("g").select("text");if(a%360){k.each(function(e,t){var n=this.getBBox().width;if(n>C)C=n});var L=Math.abs(Math.sin(a*Math.PI/180));var N=(L?L*C:C)+30;k.attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).style("text-anchor",a%360>0?"start":"end")}S.enter().append("text").attr("class","nv-axislabel");var x=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);S.attr("text-anchor","middle").attr("y",N).attr("x",x/2);if(o){var T=g.selectAll("g.nv-axisMaxMin").data([i.domain()[0],i.domain()[i.domain().length-1]]);T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",e.tickPadding()).attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).style("text-anchor",a?a%360>0?"start":"end":"middle").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"})}if(l)k.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",f?"middle":"begin").attr("transform",f?"rotate(90)":"").attr("y",f?-Math.max(t.right,n)+12:-10).attr("x",f?i.range()[0]/2:e.tickPadding());if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+i(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",e.tickPadding()).style("text-anchor","start").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",f?"middle":"end").attr("transform",f?"rotate(-90)":"").attr("y",f?-Math.max(t.left,n)+d:-10).attr("x",f?-i.range()[0]/2:-e.tickPadding());if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+v(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-e.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}break}S.text(function(e){return e});if(o&&(e.orient()==="left"||e.orient()==="right")){w.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);var n;if(p){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(i(e)<i.range()[1]+10||i(e)>i.range()[0]-10){if(e>1e-10||e<-1e-10)d3.select(this).attr("opacity",0);d3.select(this).select("text").attr("opacity",0)}});if(i.domain()[0]==i.domain()[1]&&i.domain()[0]==0)g.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return!t?1:0})}if(o&&(e.orient()==="top"||e.orient()==="bottom")){var A=[];g.selectAll("g.nv-axisMaxMin").each(function(e,t){try{if(t)A.push(i(e)-this.getBBox().width-4);else A.push(i(e)+this.getBBox().width+4)}catch(n){if(t)A.push(i(e)-4);else A.push(i(e)+4)}});w.selectAll("g").each(function(e,t){var n;if(p){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(i(e)<A[0]||i(e)>A[1]){if(e>1e-10||e<-1e-10)d3.select(this).remove();else d3.select(this).select("text").remove()}})}if(u)w.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",true);v=i.copy()});return m}var e=d3.svg.axis();var t={top:0,right:0,bottom:0,left:0},n=75,r=60,i=d3.scale.linear(),s=null,o=true,u=true,a=0,f=true,l=false,c=false,h=null,p=false,d=12;e.scale(i).orient("bottom").tickFormat(function(e){return e});var v;m.axis=e;d3.rebind(m,e,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat");d3.rebind(m,i,"domain","range","rangeBand","rangeBands");m.options=nv.utils.optionsFunc.bind(m);m.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return m};m.width=function(e){if(!arguments.length)return n;n=e;return m};m.ticks=function(e){if(!arguments.length)return h;h=e;return m};m.height=function(e){if(!arguments.length)return r;r=e;return m};m.axisLabel=function(e){if(!arguments.length)return s;s=e;return m};m.showMaxMin=function(e){if(!arguments.length)return o;o=e;return m};m.logScale=function(e){if(!arguments.length)return p;p=e;return m};m.highlightZero=function(e){if(!arguments.length)return u;u=e;return m};m.scale=function(t){if(!arguments.length)return i;i=t;e.scale(i);c=typeof i.rangeBands==="function";d3.rebind(m,i,"domain","range","rangeBand","rangeBands");return m};m.rotateYLabel=function(e){if(!arguments.length)return f;f=e;return m};m.rotateLabels=function(e){if(!arguments.length)return a;a=e;return m};m.staggerLabels=function(e){if(!arguments.length)return l;l=e;return m};m.axisLabelDistance=function(e){if(!arguments.length)return d;d=e;return m};return m} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/backup/bullet.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/backup/bullet.js
new file mode 100644
index 00000000..86ebeb0f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/backup/bullet.js
@@ -0,0 +1,250 @@
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+
+nv.models.bullet = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , orient = 'left' // TODO top & bottom
+ , reverse = false
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , forceX = [0] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.)
+ , width = 380
+ , height = 30
+ , tickFormat = null
+ , dispatch = d3.dispatch('elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this),
+ mainGroup = nv.log(this.parentNode.parentNode).getAttribute('transform'),
+ heightFromTop = nv.log(parseInt(mainGroup.replace(/.*,(\d+)\)/,"$1"))); //TODO: There should be a smarter way to get this value
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // Compute the new x-scale.
+ var MaxX = Math.max(rangez[0] ? rangez[0]:0 , markerz[0] ? markerz[0] : 0 , measurez[0] ? measurez[0] : 0)
+ var x1 = d3.scale.linear()
+ .domain([0, MaxX]).nice() // TODO: need to allow forceX and forceY, and xDomain, yDomain
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bullet').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bullet');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+
+
+ // Update the range rects.
+ var range = g.selectAll('rect.nv-range')
+ .data(rangez);
+
+ range.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-range nv-s' + i; })
+ .attr('width', w0)
+ .attr('height', availableHeight)
+ .attr('x', reverse ? x0 : 0)
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: (i <= 0) ? 'Maximum' : (i > 1) ? 'Minimum' : 'Mean', //TODO: make these labels a variable
+ pos: [x1(d), heightFromTop]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: (i <= 0) ? 'Minimum' : (i >=1) ? 'Maximum' : 'Mean' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(range)
+ .attr('x', reverse ? x1 : 0)
+ .attr('width', w1)
+ .attr('height', availableHeight);
+
+
+ // Update the measure rects.
+ var measure = g.selectAll('rect.nv-measure')
+ .data(measurez);
+
+ measure.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-measure nv-s' + i; })
+ .attr('width', w0)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x0 : 0)
+ .attr('y', availableHeight / 3)
+ .on('mouseover', function(d) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Current', //TODO: make these labels a variable
+ pos: [x1(d), heightFromTop]
+ })
+ })
+ .on('mouseout', function(d) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Current' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(measure)
+ .attr('width', w1)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x1 : 0)
+ .attr('y', availableHeight / 3);
+
+
+
+ // Update the marker lines.
+ var marker = g.selectAll('path.nv-markerTriangle')
+ .data(markerz);
+
+ var h3 = availableHeight / 6;
+ marker.enter().append('path')
+ .attr('class', 'nv-markerTriangle')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',' + (availableHeight / 2) + ')' })
+ .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Previous',
+ pos: [x1(d), heightFromTop]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Previous'
+ })
+ });
+
+ d3.transition(marker)
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',' + (availableHeight / 2) + ')' });
+
+ marker.exit().remove();
+
+ });
+
+ d3.timer.flush();
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ // left, right, top, bottom
+ chart.orient = function(_) {
+ if (!arguments.length) return orient;
+ orient = _;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(_) {
+ if (!arguments.length) return ranges;
+ ranges = _;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(_) {
+ if (!arguments.length) return markers;
+ markers = _;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(_) {
+ if (!arguments.length) return measures;
+ measures = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(_) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/backup/bulletChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/backup/bulletChart.js
new file mode 100644
index 00000000..a2a0f077
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/backup/bulletChart.js
@@ -0,0 +1,349 @@
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+nv.models.bulletChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var bullet = nv.models.bullet()
+ ;
+
+ var orient = 'left' // TODO top & bottom
+ , reverse = false
+ , margin = {top: 5, right: 40, bottom: 20, left: 120}
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , width = null
+ , height = 55
+ , tickFormat = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + e.label + '</h3>' +
+ '<p>' + e.value + '</p>'
+ }
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, parentElement) {
+ var offsetElement = parentElement.parentNode.parentNode,
+ left = e.pos[0] + offsetElement.offsetLeft + margin.left,
+ top = e.pos[1] + offsetElement.offsetTop + margin.top;
+
+ var content = '<h3>' + e.label + '</h3>' +
+ '<p>' + e.value + '</p>';
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement.parentNode);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ that = this;
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ /*
+ // Disabled until I figure out a better way to check for no data with the bullet chart
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+ */
+
+ //------------------------------------------------------------
+
+
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bulletChart').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bulletChart');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-bulletWrap');
+ gEnter.append('g').attr('class', 'nv-titles');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + ( margin.top + i*height )+ ')');
+
+ //------------------------------------------------------------
+
+
+ // Compute the new x-scale.
+ var MaxX = Math.max(rangez[0] ? rangez[0]:0 , markerz[0] ? markerz[0] : 0 , measurez[0] ? measurez[0] : 0)
+ var x1 = d3.scale.linear()
+ .domain([0, MaxX]).nice() // TODO: need to allow forceX and forceY, and xDomain, yDomain
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+ /*
+ // Derive width-scales from the x-scales.
+ var w0 = bulletWidth(x0),
+ w1 = bulletWidth(x1);
+
+ function bulletWidth(x) {
+ var x0 = x(0);
+ return function(d) {
+ return Math.abs(x(d) - x(0));
+ };
+ }
+
+ function bulletTranslate(x) {
+ return function(d) {
+ return 'translate(' + x(d) + ',0)';
+ };
+ }
+ */
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+
+
+ var title = gEnter.select('.nv-titles').append("g")
+ .attr("text-anchor", "end")
+ .attr("transform", "translate(-6," + (height - margin.top - margin.bottom) / 2 + ")");
+ title.append("text")
+ .attr("class", "nv-title")
+ .text(function(d) { return d.title; });
+
+ title.append("text")
+ .attr("class", "nv-subtitle")
+ .attr("dy", "1em")
+ .text(function(d) { return d.subtitle; });
+
+
+
+ bullet
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var bulletWrap = g.select('.nv-bulletWrap');
+
+ d3.transition(bulletWrap).call(bullet);
+
+
+
+ // Compute the tick format.
+ var format = tickFormat || x1.tickFormat(8);
+
+ // Update the tick groups.
+ var tick = g.selectAll('g.nv-tick')
+ .data(x1.ticks(8), function(d) {
+ return this.textContent || format(d);
+ });
+
+ // Initialize the ticks with the old scale, x0.
+ var tickEnter = tick.enter().append('g')
+ .attr('class', 'nv-tick')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',0)' })
+ .style('opacity', 1e-6);
+
+ tickEnter.append('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickEnter.append('text')
+ .attr('text-anchor', 'middle')
+ .attr('dy', '1em')
+ .attr('y', availableHeight * 7 / 6)
+ .text(format);
+
+ // Transition the entering ticks to the new scale, x1.
+ d3.transition(tickEnter)
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1);
+
+ // Transition the updating ticks to the new scale, x1.
+ var tickUpdate = d3.transition(tick)
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1);
+
+ tickUpdate.select('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickUpdate.select('text')
+ .attr('y', availableHeight * 7 / 6);
+
+ // Transition the exiting ticks to the new scale, x1.
+ d3.transition(tick.exit())
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1e-6)
+ .remove();
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+ });
+
+ d3.timer.flush();
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ bullet.dispatch.on('elementMouseover.tooltip', function(e) {
+ dispatch.tooltipShow(e);
+ });
+
+ bullet.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.bullet = bullet;
+
+ // left, right, top, bottom
+ chart.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(x) {
+ if (!arguments.length) return ranges;
+ ranges = x;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(x) {
+ if (!arguments.length) return markers;
+ markers = x;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(x) {
+ if (!arguments.length) return measures;
+ measures = x;
+ return chart;
+ };
+
+ chart.width = function(x) {
+ if (!arguments.length) return width;
+ width = x;
+ return chart;
+ };
+
+ chart.height = function(x) {
+ if (!arguments.length) return height;
+ height = x;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = x;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/boilerplate.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/boilerplate.js
new file mode 100644
index 00000000..3d2360a6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/boilerplate.js
@@ -0,0 +1,104 @@
+
+nv.models.chartName = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+
+ var margin = {top: 30, right: 10, bottom: 10, left: 10}
+ , width = 960
+ , height = 500
+ , color = nv.utils.getColor(d3.scale.category20c().range())
+ , dispatch = d3.dispatch('stateChange', 'changeState')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-chartName').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-chartName');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-mainWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_)
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/bullet.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/bullet.js
new file mode 100644
index 00000000..9b9bf4d1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/bullet.js
@@ -0,0 +1,385 @@
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+
+nv.models.bullet = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , orient = 'left' // TODO top & bottom
+ , reverse = false
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , rangeLabels = function(d) { return d.rangeLabels ? d.rangeLabels : [] }
+ , markerLabels = function(d) { return d.markerLabels ? d.markerLabels : [] }
+ , measureLabels = function(d) { return d.measureLabels ? d.measureLabels : [] }
+ , forceX = [0] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.)
+ , width = 380
+ , height = 30
+ , tickFormat = null
+ , color = nv.utils.getColor(['#1f77b4'])
+ , dispatch = d3.dispatch('elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending),
+ rangeLabelz = rangeLabels.call(this, d, i).slice(),
+ markerLabelz = markerLabels.call(this, d, i).slice(),
+ measureLabelz = measureLabels.call(this, d, i).slice();
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain( d3.extent(d3.merge([forceX, rangez])) )
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+
+ var rangeMin = d3.min(rangez), //rangez[2]
+ rangeMax = d3.max(rangez), //rangez[0]
+ rangeAvg = rangez[1];
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bullet').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bullet');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeMax');
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeAvg');
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeMin');
+ gEnter.append('rect').attr('class', 'nv-measure');
+ gEnter.append('path').attr('class', 'nv-markerTriangle');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+ var xp0 = function(d) { return d < 0 ? x0(d) : x0(0) },
+ xp1 = function(d) { return d < 0 ? x1(d) : x1(0) };
+
+
+ g.select('rect.nv-rangeMax')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeMax > 0 ? rangeMax : rangeMin))
+ .attr('x', xp1(rangeMax > 0 ? rangeMax : rangeMin))
+ .datum(rangeMax > 0 ? rangeMax : rangeMin)
+ /*
+ .attr('x', rangeMin < 0 ?
+ rangeMax > 0 ?
+ x1(rangeMin)
+ : x1(rangeMax)
+ : x1(0))
+ */
+
+ g.select('rect.nv-rangeAvg')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeAvg))
+ .attr('x', xp1(rangeAvg))
+ .datum(rangeAvg)
+ /*
+ .attr('width', rangeMax <= 0 ?
+ x1(rangeMax) - x1(rangeAvg)
+ : x1(rangeAvg) - x1(rangeMin))
+ .attr('x', rangeMax <= 0 ?
+ x1(rangeAvg)
+ : x1(rangeMin))
+ */
+
+ g.select('rect.nv-rangeMin')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeMax))
+ .attr('x', xp1(rangeMax))
+ .attr('width', w1(rangeMax > 0 ? rangeMin : rangeMax))
+ .attr('x', xp1(rangeMax > 0 ? rangeMin : rangeMax))
+ .datum(rangeMax > 0 ? rangeMin : rangeMax)
+ /*
+ .attr('width', rangeMax <= 0 ?
+ x1(rangeAvg) - x1(rangeMin)
+ : x1(rangeMax) - x1(rangeAvg))
+ .attr('x', rangeMax <= 0 ?
+ x1(rangeMin)
+ : x1(rangeAvg))
+ */
+
+ g.select('rect.nv-measure')
+ .style('fill', color)
+ .attr('height', availableHeight / 3)
+ .attr('y', availableHeight / 3)
+ .attr('width', measurez < 0 ?
+ x1(0) - x1(measurez[0])
+ : x1(measurez[0]) - x1(0))
+ .attr('x', xp1(measurez))
+ .on('mouseover', function() {
+ dispatch.elementMouseover({
+ value: measurez[0],
+ label: measureLabelz[0] || 'Current',
+ pos: [x1(measurez[0]), availableHeight/2]
+ })
+ })
+ .on('mouseout', function() {
+ dispatch.elementMouseout({
+ value: measurez[0],
+ label: measureLabelz[0] || 'Current'
+ })
+ })
+
+ var h3 = availableHeight / 6;
+ if (markerz[0]) {
+ g.selectAll('path.nv-markerTriangle')
+ .attr('transform', function(d) { return 'translate(' + x1(markerz[0]) + ',' + (availableHeight / 2) + ')' })
+ .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
+ .on('mouseover', function() {
+ dispatch.elementMouseover({
+ value: markerz[0],
+ label: markerLabelz[0] || 'Previous',
+ pos: [x1(markerz[0]), availableHeight/2]
+ })
+ })
+ .on('mouseout', function() {
+ dispatch.elementMouseout({
+ value: markerz[0],
+ label: markerLabelz[0] || 'Previous'
+ })
+ });
+ } else {
+ g.selectAll('path.nv-markerTriangle').remove();
+ }
+
+
+ wrap.selectAll('.nv-range')
+ .on('mouseover', function(d,i) {
+ var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum");
+
+ dispatch.elementMouseover({
+ value: d,
+ label: label,
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum");
+
+ dispatch.elementMouseout({
+ value: d,
+ label: label
+ })
+ })
+
+/* // THIS IS THE PREVIOUS BULLET IMPLEMENTATION, WILL REMOVE SHORTLY
+ // Update the range rects.
+ var range = g.selectAll('rect.nv-range')
+ .data(rangez);
+
+ range.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-range nv-s' + i; })
+ .attr('width', w0)
+ .attr('height', availableHeight)
+ .attr('x', reverse ? x0 : 0)
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: (i <= 0) ? 'Maximum' : (i > 1) ? 'Minimum' : 'Mean', //TODO: make these labels a variable
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: (i <= 0) ? 'Minimum' : (i >=1) ? 'Maximum' : 'Mean' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(range)
+ .attr('x', reverse ? x1 : 0)
+ .attr('width', w1)
+ .attr('height', availableHeight);
+
+
+ // Update the measure rects.
+ var measure = g.selectAll('rect.nv-measure')
+ .data(measurez);
+
+ measure.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-measure nv-s' + i; })
+ .style('fill', function(d,i) { return color(d,i ) })
+ .attr('width', w0)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x0 : 0)
+ .attr('y', availableHeight / 3)
+ .on('mouseover', function(d) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Current', //TODO: make these labels a variable
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Current' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(measure)
+ .attr('width', w1)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x1 : 0)
+ .attr('y', availableHeight / 3);
+
+
+
+ // Update the marker lines.
+ var marker = g.selectAll('path.nv-markerTriangle')
+ .data(markerz);
+
+ var h3 = availableHeight / 6;
+ marker.enter().append('path')
+ .attr('class', 'nv-markerTriangle')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',' + (availableHeight / 2) + ')' })
+ .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Previous',
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Previous'
+ })
+ });
+
+ d3.transition(marker)
+ .attr('transform', function(d) { return 'translate(' + (x1(d) - x1(0)) + ',' + (availableHeight / 2) + ')' });
+
+ marker.exit().remove();
+*/
+
+ });
+
+ // d3.timer.flush(); // Not needed?
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ // left, right, top, bottom
+ chart.orient = function(_) {
+ if (!arguments.length) return orient;
+ orient = _;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(_) {
+ if (!arguments.length) return ranges;
+ ranges = _;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(_) {
+ if (!arguments.length) return markers;
+ markers = _;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(_) {
+ if (!arguments.length) return measures;
+ measures = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(_) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/bulletChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/bulletChart.js
new file mode 100644
index 00000000..fa5bd596
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/bulletChart.js
@@ -0,0 +1,343 @@
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+nv.models.bulletChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var bullet = nv.models.bullet()
+ ;
+
+ var orient = 'left' // TODO top & bottom
+ , reverse = false
+ , margin = {top: 5, right: 40, bottom: 20, left: 120}
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , width = null
+ , height = 55
+ , tickFormat = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ) + margin.left,
+ top = e.pos[1] + ( offsetElement.offsetTop || 0) + margin.top,
+ content = tooltip(e.key, e.label, e.value, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ that = this;
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!d || !ranges.call(this, d, i)) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', 18 + margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bulletChart').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bulletChart');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-bulletWrap');
+ gEnter.append('g').attr('class', 'nv-titles');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) // TODO: need to allow forceX and forceY, and xDomain, yDomain
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+ /*
+ // Derive width-scales from the x-scales.
+ var w0 = bulletWidth(x0),
+ w1 = bulletWidth(x1);
+
+ function bulletWidth(x) {
+ var x0 = x(0);
+ return function(d) {
+ return Math.abs(x(d) - x(0));
+ };
+ }
+
+ function bulletTranslate(x) {
+ return function(d) {
+ return 'translate(' + x(d) + ',0)';
+ };
+ }
+ */
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+
+
+ var title = gEnter.select('.nv-titles').append('g')
+ .attr('text-anchor', 'end')
+ .attr('transform', 'translate(-6,' + (height - margin.top - margin.bottom) / 2 + ')');
+ title.append('text')
+ .attr('class', 'nv-title')
+ .text(function(d) { return d.title; });
+
+ title.append('text')
+ .attr('class', 'nv-subtitle')
+ .attr('dy', '1em')
+ .text(function(d) { return d.subtitle; });
+
+
+
+ bullet
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var bulletWrap = g.select('.nv-bulletWrap');
+
+ d3.transition(bulletWrap).call(bullet);
+
+
+
+ // Compute the tick format.
+ var format = tickFormat || x1.tickFormat( availableWidth / 100 );
+
+ // Update the tick groups.
+ var tick = g.selectAll('g.nv-tick')
+ .data(x1.ticks( availableWidth / 50 ), function(d) {
+ return this.textContent || format(d);
+ });
+
+ // Initialize the ticks with the old scale, x0.
+ var tickEnter = tick.enter().append('g')
+ .attr('class', 'nv-tick')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',0)' })
+ .style('opacity', 1e-6);
+
+ tickEnter.append('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickEnter.append('text')
+ .attr('text-anchor', 'middle')
+ .attr('dy', '1em')
+ .attr('y', availableHeight * 7 / 6)
+ .text(format);
+
+
+ // Transition the updating ticks to the new scale, x1.
+ var tickUpdate = d3.transition(tick)
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1);
+
+ tickUpdate.select('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickUpdate.select('text')
+ .attr('y', availableHeight * 7 / 6);
+
+ // Transition the exiting ticks to the new scale, x1.
+ d3.transition(tick.exit())
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1e-6)
+ .remove();
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('tooltipShow', function(e) {
+ e.key = d.title;
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+ });
+
+ d3.timer.flush();
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ bullet.dispatch.on('elementMouseover.tooltip', function(e) {
+ dispatch.tooltipShow(e);
+ });
+
+ bullet.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.bullet = bullet;
+
+ d3.rebind(chart, bullet, 'color');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ // left, right, top, bottom
+ chart.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(x) {
+ if (!arguments.length) return ranges;
+ ranges = x;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(x) {
+ if (!arguments.length) return markers;
+ markers = x;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(x) {
+ if (!arguments.length) return measures;
+ measures = x;
+ return chart;
+ };
+
+ chart.width = function(x) {
+ if (!arguments.length) return width;
+ width = x;
+ return chart;
+ };
+
+ chart.height = function(x) {
+ if (!arguments.length) return height;
+ height = x;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = x;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/cumulativeLineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/cumulativeLineChart.js
new file mode 100644
index 00000000..00f193cf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/cumulativeLineChart.js
@@ -0,0 +1,782 @@
+
+nv.models.cumulativeLineChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , interactiveLayer = nv.interactiveGuideline()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 50, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , tooltips = true
+ , showControls = true
+ , useInteractiveGuideline = false
+ , rescaleY = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , id = lines.id()
+ , state = { index: 0, rescaleY: rescaleY }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , average = function(d) { return d.average }
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ //============================================================
+ controls.updateState(false);
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var dx = d3.scale.linear()
+ , index = {i: 0, x: 0}
+ ;
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+/*
+ //Moved to see if we can get better behavior to fix issue #315
+ var indexDrag = d3.behavior.drag()
+ .on('dragstart', dragStart)
+ .on('drag', dragMove)
+ .on('dragend', dragEnd);
+
+ function dragStart(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'ew-resize');
+ }
+
+ function dragMove(d,i) {
+ d.x += d3.event.dx;
+ d.i = Math.round(dx.invert(d.x));
+
+ d3.select(this).attr('transform', 'translate(' + dx(d.i) + ',0)');
+ chart.update();
+ }
+
+ function dragEnd(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'auto');
+ chart.update();
+ }
+*/
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this).classed('nv-chart-' + id, true),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ var indexDrag = d3.behavior.drag()
+ .on('dragstart', dragStart)
+ .on('drag', dragMove)
+ .on('dragend', dragEnd);
+
+
+ function dragStart(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'ew-resize');
+ }
+
+ function dragMove(d,i) {
+ index.x = d3.event.x;
+ index.i = Math.round(dx.invert(index.x));
+ updateZero();
+ }
+
+ function dragEnd(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'auto');
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+
+
+ if (!rescaleY) {
+ var seriesDomains = data
+ .filter(function(series) { return !series.disabled })
+ .map(function(series,i) {
+ var initialDomain = d3.extent(series.values, lines.y());
+
+ //account for series being disabled when losing 95% or more
+ if (initialDomain[0] < -.95) initialDomain[0] = -.95;
+
+ return [
+ (initialDomain[0] - initialDomain[1]) / (1 + initialDomain[1]),
+ (initialDomain[1] - initialDomain[0]) / (1 + initialDomain[0])
+ ];
+ });
+
+ var completeDomain = [
+ d3.min(seriesDomains, function(d) { return d[0] }),
+ d3.max(seriesDomains, function(d) { return d[1] })
+ ]
+
+ lines.yDomain(completeDomain);
+ } else {
+ lines.yDomain(null);
+ }
+
+
+ dx .domain([0, data[0].values.length - 1]) //Assumes all series have same length
+ .range([0, availableWidth])
+ .clamp(true);
+
+ //------------------------------------------------------------
+
+
+ var data = indexify(index.i, data);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+ var interactivePointerEvents = (useInteractiveGuideline) ? "none" : "all";
+ var wrap = container.selectAll('g.nv-wrap.nv-cumulativeLine').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-cumulativeLine').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-interactive');
+ gEnter.append('g').attr('class', 'nv-x nv-axis').style("pointer-events","none");
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-background');
+ gEnter.append('g').attr('class', 'nv-linesWrap').style("pointer-events",interactivePointerEvents);
+ gEnter.append('g').attr('class', 'nv-avgLinesWrap').style("pointer-events","none");
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Re-scale y-axis', disabled: !rescaleY }
+ ];
+
+ controls.width(140).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ // Show error if series goes below 100%
+ var tempDisabled = data.filter(function(d) { return d.tempDisabled });
+
+ wrap.select('.tempDisabled').remove(); //clean-up and prevent duplicates
+ if (tempDisabled.length) {
+ wrap.append('text').attr('class', 'tempDisabled')
+ .attr('x', availableWidth / 2)
+ .attr('y', '-.71em')
+ .style('text-anchor', 'end')
+ .text(tempDisabled.map(function(d) { return d.key }).join(', ') + ' values cannot be calculated for this time period.');
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ //------------------------------------------------------------
+ //Set up interactive layer
+ if (useInteractiveGuideline) {
+ interactiveLayer
+ .width(availableWidth)
+ .height(availableHeight)
+ .margin({left:margin.left,top:margin.top})
+ .svgContainer(container)
+ .xScale(x);
+ wrap.select(".nv-interactive").call(interactiveLayer);
+ }
+
+ gEnter.select('.nv-background')
+ .append('rect');
+
+ g.select('.nv-background rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ lines
+ //.x(function(d) { return d.x })
+ .y(function(d) { return d.display.y })
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].tempDisabled; }));
+
+
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled && !d.tempDisabled }));
+
+ //d3.transition(linesWrap).call(lines);
+ linesWrap.call(lines);
+
+ /*Handle average lines [AN-612] ----------------------------*/
+
+ //Store a series index number in the data array.
+ data.forEach(function(d,i) {
+ d.seriesIndex = i;
+ });
+
+ var avgLineData = data.filter(function(d) {
+ return !d.disabled && !!average(d);
+ });
+
+ var avgLines = g.select(".nv-avgLinesWrap").selectAll("line")
+ .data(avgLineData, function(d) { return d.key; });
+
+ var getAvgLineY = function(d) {
+ //If average lines go off the svg element, clamp them to the svg bounds.
+ var yVal = y(average(d));
+ if (yVal < 0) return 0;
+ if (yVal > availableHeight) return availableHeight;
+ return yVal;
+ };
+
+ avgLines.enter()
+ .append('line')
+ .style('stroke-width',2)
+ .style('stroke-dasharray','10,10')
+ .style('stroke',function (d,i) {
+ return lines.color()(d,d.seriesIndex);
+ })
+ .attr('x1',0)
+ .attr('x2',availableWidth)
+ .attr('y1', getAvgLineY)
+ .attr('y2', getAvgLineY);
+
+ avgLines
+ .style('stroke-opacity',function(d){
+ //If average lines go offscreen, make them transparent
+ var yVal = y(average(d));
+ if (yVal < 0 || yVal > availableHeight) return 0;
+ return 1;
+ })
+ .attr('x1',0)
+ .attr('x2',availableWidth)
+ .attr('y1', getAvgLineY)
+ .attr('y2', getAvgLineY);
+
+ avgLines.exit().remove();
+
+ //Create index line -----------------------------------------
+
+ var indexLine = linesWrap.selectAll('.nv-indexLine')
+ .data([index]);
+ indexLine.enter().append('rect').attr('class', 'nv-indexLine')
+ .attr('width', 3)
+ .attr('x', -2)
+ .attr('fill', 'red')
+ .attr('fill-opacity', .5)
+ .style("pointer-events","all")
+ .call(indexDrag)
+
+ indexLine
+ .attr('transform', function(d) { return 'translate(' + dx(d.i) + ',0)' })
+ .attr('height', availableHeight)
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ //Suggest how many ticks based on the chart width and D3 should listen (70 is the optimal number for MM/DD/YY dates)
+ .ticks( Math.min(data[0].values.length,availableWidth/70) )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+ }
+
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+ }
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+
+ function updateZero() {
+ indexLine
+ .data([index]);
+
+ //When dragging the index line, turn off line transitions.
+ // Then turn them back on when done dragging.
+ var oldDuration = chart.transitionDuration();
+ chart.transitionDuration(0);
+ chart.update();
+ chart.transitionDuration(oldDuration);
+ }
+
+ g.select('.nv-background rect')
+ .on('click', function() {
+ index.x = d3.mouse(this)[0];
+ index.i = Math.round(dx.invert(index.x));
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+
+ updateZero();
+ });
+
+ lines.dispatch.on('elementClick', function(e) {
+ index.i = e.pointIndex;
+ index.x = dx(index.i);
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+
+ updateZero();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+ rescaleY = !d.disabled;
+
+ state.rescaleY = rescaleY;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state.disabled = newState.disabled;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ interactiveLayer.dispatch.on('elementMousemove', function(e) {
+ lines.clearHighlights();
+ var singlePoint, pointIndex, pointXLocation, allData = [];
+
+
+ data
+ .filter(function(series, i) {
+ series.seriesIndex = i;
+ return !series.disabled;
+ })
+ .forEach(function(series,i) {
+ pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x());
+ lines.highlightPoint(i, pointIndex, true);
+ var point = series.values[pointIndex];
+ if (typeof point === 'undefined') return;
+ if (typeof singlePoint === 'undefined') singlePoint = point;
+ if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex));
+ allData.push({
+ key: series.key,
+ value: chart.y()(point, pointIndex),
+ color: color(series,series.seriesIndex)
+ });
+ });
+
+ //Highlight the tooltip entry based on which point the mouse is closest to.
+ if (allData.length > 2) {
+ var yValue = chart.yScale().invert(e.mouseY);
+ var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]);
+ var threshold = 0.03 * domainExtent;
+ var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold);
+ if (indexToHighlight !== null)
+ allData[indexToHighlight].highlight = true;
+ }
+
+ var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex), pointIndex);
+ interactiveLayer.tooltip
+ .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
+ .chartContainer(that.parentNode)
+ .enabled(tooltips)
+ .valueFormatter(function(d,i) {
+ return yAxis.tickFormat()(d);
+ })
+ .data(
+ {
+ value: xValue,
+ series: allData
+ }
+ )();
+
+ interactiveLayer.renderGuideLine(pointXLocation);
+
+ });
+
+ interactiveLayer.dispatch.on("elementMouseout",function(e) {
+ dispatch.tooltipHide();
+ lines.clearHighlights();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+
+ if (typeof e.index !== 'undefined') {
+ index.i = e.index;
+ index.x = dx(index.i);
+
+ state.index = e.index;
+
+ indexLine
+ .data([index]);
+ }
+
+
+ if (typeof e.rescaleY !== 'undefined') {
+ rescaleY = e.rescaleY;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.lines = lines;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.interactiveLayer = interactiveLayer;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'xScale','yScale', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi','useVoronoi', 'id');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.rescaleY = function(_) {
+ if (!arguments.length) return rescaleY;
+ rescaleY = _;
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.useInteractiveGuideline = function(_) {
+ if(!arguments.length) return useInteractiveGuideline;
+ useInteractiveGuideline = _;
+ if (_ === true) {
+ chart.interactive(false);
+ chart.useVoronoi(false);
+ }
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.average = function(_) {
+ if(!arguments.length) return average;
+ average = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ /* Normalize the data according to an index point. */
+ function indexify(idx, data) {
+ return data.map(function(line, i) {
+ if (!line.values) {
+ return line;
+ }
+ var v = lines.y()(line.values[idx], idx);
+
+ //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue
+ if (v < -.95) {
+ //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100)
+ line.tempDisabled = true;
+ return line;
+ }
+
+ line.tempDisabled = false;
+
+ line.values = line.values.map(function(point, pointIndex) {
+ point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) };
+ return point;
+ })
+
+ return line;
+ })
+ }
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/discreteBar.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/discreteBar.js
new file mode 100644
index 00000000..a20f5829
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/discreteBar.js
@@ -0,0 +1,349 @@
+//TODO: consider deprecating by adding necessary features to multiBar model
+nv.models.discreteBar = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , color = nv.utils.defaultColor()
+ , showValues = false
+ , valueFormat = d3.format(',.2f')
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ , rectClass = 'discreteBar'
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0 }
+ })
+ });
+
+ x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands(xRange || [0, availableWidth], .1);
+
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y }).concat(forceY)));
+
+
+ // If showValues, pad the Y axis range to account for label height
+ if (showValues) y.range(yRange || [availableHeight - (y.domain()[0] < 0 ? 12 : 0), y.domain()[1] > 0 ? 12 : 0]);
+ else y.range(yRange || [availableHeight, 0]);
+
+ //store old scales if they exist
+ x0 = x0 || x;
+ y0 = y0 || y.copy().range([y(0),y(0)]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-discretebar').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discretebar');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ //TODO: by definition, the discrete bar should not have multiple groups, will modify/remove later
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit()
+ .transition()
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover });
+ groups
+ .transition()
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('g.nv-bar')
+ .data(function(d) { return d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('g')
+ .attr('transform', function(d,i,j) {
+ return 'translate(' + (x(getX(d,i)) + x.rangeBand() * .05 ) + ', ' + y(0) + ')'
+ })
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+
+ barsEnter.append('rect')
+ .attr('height', 0)
+ .attr('width', x.rangeBand() * .9 / data.length )
+
+ if (showValues) {
+ barsEnter.append('text')
+ .attr('text-anchor', 'middle')
+ ;
+
+ bars.select('text')
+ .text(function(d,i) { return valueFormat(getY(d,i)) })
+ .transition()
+ .attr('x', x.rangeBand() * .9 / 2)
+ .attr('y', function(d,i) { return getY(d,i) < 0 ? y(getY(d,i)) - y(0) + 12 : -4 })
+
+ ;
+ } else {
+ bars.selectAll('text').remove();
+ }
+
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive' })
+ .style('fill', function(d,i) { return d.color || color(d,i) })
+ .style('stroke', function(d,i) { return d.color || color(d,i) })
+ .select('rect')
+ .attr('class', rectClass)
+ .transition()
+ .attr('width', x.rangeBand() * .9 / data.length);
+ bars.transition()
+ //.delay(function(d,i) { return i * 1200 / data[0].values.length })
+ .attr('transform', function(d,i) {
+ var left = x(getX(d,i)) + x.rangeBand() * .05,
+ top = getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 : //make 1 px positive bars show up above y=0
+ y(getY(d,i));
+
+ return 'translate(' + left + ', ' + top + ')'
+ })
+ .select('rect')
+ .attr('height', function(d,i) {
+ return Math.max(Math.abs(y(getY(d,i)) - y((yDomain && yDomain[0]) || 0)) || 1)
+ });
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.showValues = function(_) {
+ if (!arguments.length) return showValues;
+ showValues = _;
+ return chart;
+ };
+
+ chart.valueFormat= function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.rectClass= function(_) {
+ if (!arguments.length) return rectClass;
+ rectClass = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/discreteBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/discreteBarChart.js
new file mode 100644
index 00000000..48a48164
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/discreteBarChart.js
@@ -0,0 +1,333 @@
+
+nv.models.discreteBarChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var discretebar = nv.models.discreteBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ ;
+
+ var margin = {top: 15, right: 10, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.getColor()
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , staggerLabels = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , x
+ , y
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'beforeUpdate')
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .highlightZero(false)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(discretebar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(discretebar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() {
+ dispatch.beforeUpdate();
+ container.transition().duration(transitionDuration).call(chart);
+ };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = discretebar.xScale();
+ y = discretebar.yScale().clamp(true);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-discreteBarWithAxes').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discreteBarWithAxes').append('g');
+ var defsEnter = gEnter.append('defs');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+
+ g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ discretebar
+ .width(availableWidth)
+ .height(availableHeight);
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ barsWrap.transition().call(discretebar);
+
+ //------------------------------------------------------------
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-x-label-clip-' + discretebar.id())
+ .append('rect');
+
+ g.select('#nv-x-label-clip-' + discretebar.id() + ' rect')
+ .attr('width', x.rangeBand() * (staggerLabels ? 2 : 1))
+ .attr('height', 16)
+ .attr('x', -x.rangeBand() / (staggerLabels ? 1 : 2 ));
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + (y.range()[0] + ((discretebar.showValues() && y.domain()[0] < 0) ? 16 : 0)) + ')');
+ //d3.transition(g.select('.nv-x.nv-axis'))
+ g.select('.nv-x.nv-axis').transition()
+ .call(xAxis);
+
+
+ var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
+
+ if (staggerLabels) {
+ xTicks
+ .selectAll('text')
+ .attr('transform', function(d,i,j) { return 'translate(0,' + (j % 2 == 0 ? '5' : '17') + ')' })
+ }
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis').transition()
+ .call(yAxis);
+ }
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ discretebar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ discretebar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.discretebar = discretebar;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, discretebar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'id', 'showValues', 'valueFormat');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ discretebar.color(color);
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/distribution.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/distribution.js
new file mode 100644
index 00000000..62a74655
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/distribution.js
@@ -0,0 +1,148 @@
+
+nv.models.distribution = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 400 //technically width or height depending on x or y....
+ , size = 8
+ , axis = 'x' // 'x' or 'y'... horizontal or vertical
+ , getData = function(d) { return d[axis] } // defaults d.x or d.y
+ , color = nv.utils.defaultColor()
+ , scale = d3.scale.linear()
+ , domain
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var scale0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableLength = width - (axis === 'x' ? margin.left + margin.right : margin.top + margin.bottom),
+ naxis = axis == 'x' ? 'y' : 'x',
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ scale0 = scale0 || scale;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-distribution').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-distribution');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
+
+ //------------------------------------------------------------
+
+
+ var distWrap = g.selectAll('g.nv-dist')
+ .data(function(d) { return d }, function(d) { return d.key });
+
+ distWrap.enter().append('g');
+ distWrap
+ .attr('class', function(d,i) { return 'nv-dist nv-series-' + i })
+ .style('stroke', function(d,i) { return color(d, i) });
+
+ var dist = distWrap.selectAll('line.nv-dist' + axis)
+ .data(function(d) { return d.values })
+ dist.enter().append('line')
+ .attr(axis + '1', function(d,i) { return scale0(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale0(getData(d,i)) })
+ distWrap.exit().selectAll('line.nv-dist' + axis)
+ .transition()
+ .attr(axis + '1', function(d,i) { return scale(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale(getData(d,i)) })
+ .style('stroke-opacity', 0)
+ .remove();
+ dist
+ .attr('class', function(d,i) { return 'nv-dist' + axis + ' nv-dist' + axis + '-' + i })
+ .attr(naxis + '1', 0)
+ .attr(naxis + '2', size);
+ dist
+ .transition()
+ .attr(axis + '1', function(d,i) { return scale(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale(getData(d,i)) })
+
+
+ scale0 = scale.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.axis = function(_) {
+ if (!arguments.length) return axis;
+ axis = _;
+ return chart;
+ };
+
+ chart.size = function(_) {
+ if (!arguments.length) return size;
+ size = _;
+ return chart;
+ };
+
+ chart.getData = function(_) {
+ if (!arguments.length) return getData;
+ getData = d3.functor(_);
+ return chart;
+ };
+
+ chart.scale = function(_) {
+ if (!arguments.length) return scale;
+ scale = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/historicalBar.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/historicalBar.js
new file mode 100644
index 00000000..2a6c644d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/historicalBar.js
@@ -0,0 +1,331 @@
+//TODO: consider deprecating and using multibar with single series for this
+nv.models.historicalBar = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceX = []
+ , forceY = [0]
+ , padData = false
+ , clipEdge = true
+ , color = nv.utils.defaultColor()
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ , interactive = true
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) ))
+
+ if (padData)
+ x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(data[0].values.map(getY).concat(forceY) ))
+ .range(yRange || [availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-historicalBar-' + id).data([data[0].values]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBar-' + id);
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-bars');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-chart-clip-path-' + id)
+ .append('rect');
+
+ wrap.select('#nv-chart-clip-path-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : '');
+
+
+
+ var bars = wrap.select('.nv-bars').selectAll('.nv-bar')
+ .data(function(d) { return d }, function(d,i) {return getX(d,i)});
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('rect')
+ //.attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i })
+ .attr('x', 0 )
+ .attr('y', function(d,i) { return nv.utils.NaNtoZero(y(Math.max(0, getY(d,i)))) })
+ .attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.abs(y(getY(d,i)) - y(0))) })
+ .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; })
+ .on('mouseover', function(d,i) {
+ if (!interactive) return;
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ point: d,
+ series: data[0],
+ pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+
+ })
+ .on('mouseout', function(d,i) {
+ if (!interactive) return;
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ point: d,
+ series: data[0],
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ if (!interactive) return;
+ dispatch.elementClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ if (!interactive) return;
+ dispatch.elementDblClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ bars
+ .attr('fill', function(d,i) { return color(d, i); })
+ .attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i })
+ .transition()
+ .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; })
+ //TODO: better width calculations that don't assume always uniform data spacing;w
+ .attr('width', (availableWidth / data[0].values.length) * .9 );
+
+
+ bars.transition()
+ .attr('y', function(d,i) {
+ var rval = getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 :
+ y(getY(d,i));
+ return nv.utils.NaNtoZero(rval);
+ })
+ .attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.max(Math.abs(y(getY(d,i)) - y(0)),1)) });
+
+ });
+
+ return chart;
+ }
+
+ //Create methods to allow outside functions to highlight a specific bar.
+ chart.highlightPoint = function(pointIndex, isHoverOver) {
+ d3.select(".nv-historicalBar-" + id)
+ .select(".nv-bars .nv-bar-0-" + pointIndex)
+ .classed("hover", isHoverOver)
+ ;
+ };
+
+ chart.clearHighlights = function() {
+ d3.select(".nv-historicalBar-" + id)
+ .select(".nv-bars .nv-bar.hover")
+ .classed("hover", false)
+ ;
+ };
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.interactive = function(_) {
+ if(!arguments.length) return interactive;
+ interactive = false;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/historicalBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/historicalBarChart.js
new file mode 100644
index 00000000..a5b4a097
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/historicalBarChart.js
@@ -0,0 +1,419 @@
+
+nv.models.historicalBarChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var bars = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ ;
+
+
+ var margin = {top: 30, right: 90, bottom: 50, left: 90}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = false
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x
+ , y
+ , state = {}
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient( (rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+
+ // New addition to calculate position if SVG is scaled with viewBox, may move TODO: consider implementing everywhere else
+ if (offsetElement) {
+ var svg = d3.select(offsetElement).select('svg');
+ var viewBox = (svg.node()) ? svg.attr('viewBox') : null;
+ if (viewBox) {
+ viewBox = viewBox.split(' ');
+ var ratio = parseInt(svg.style('width')) / viewBox[2];
+ e.pos[0] = e.pos[0] * ratio;
+ e.pos[1] = e.pos[1] * ratio;
+ }
+ }
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(bars.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(bars.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = bars.xScale();
+ y = bars.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-historicalBarChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBarChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ barsWrap.transition().call(bars);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ g.select('.nv-x.nv-axis')
+ .transition()
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .transition()
+ .call(yAxis);
+ }
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ selection.transition().call(chart);
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ selection.call(chart);
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.bars = bars;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, bars, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale',
+ 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate','highlightPoint','clearHighlights', 'interactive');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/indentedTree.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/indentedTree.js
new file mode 100644
index 00000000..18c2700f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/indentedTree.js
@@ -0,0 +1,337 @@
+nv.models.indentedTree = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor()
+ , id = Math.floor(Math.random() * 10000)
+ , header = true
+ , filterZero = false
+ , noData = "No Data Available."
+ , childIndent = 20
+ , columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this
+ , tableClass = null
+ , iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images
+ , iconClose = 'images/grey-minus.png'
+ , dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout')
+ , getUrl = function(d) { return d.url }
+ ;
+
+ //============================================================
+
+ var idx = 0;
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var depth = 1,
+ container = d3.select(this);
+
+ var tree = d3.layout.tree()
+ .children(function(d) { return d.values })
+ .size([height, childIndent]); //Not sure if this is needed now that the result is HTML
+
+ chart.update = function() { container.transition().duration(600).call(chart) };
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+ if (!data[0]) data[0] = {key: noData};
+
+ //------------------------------------------------------------
+
+
+ var nodes = tree.nodes(data[0]);
+
+ // nodes.map(function(d) {
+ // d.id = i++;
+ // })
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('div').data([[nodes]]);
+ var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree');
+ var tableEnter = wrapEnter.append('table');
+ var table = wrap.select('table').attr('width', '100%').attr('class', tableClass);
+
+ //------------------------------------------------------------
+
+
+ if (header) {
+ var thead = tableEnter.append('thead');
+
+ var theadRow1 = thead.append('tr');
+
+ columns.forEach(function(column) {
+ theadRow1
+ .append('th')
+ .attr('width', column.width ? column.width : '10%')
+ .style('text-align', column.type == 'numeric' ? 'right' : 'left')
+ .append('span')
+ .text(column.label);
+ });
+ }
+
+
+ var tbody = table.selectAll('tbody')
+ .data(function(d) { return d });
+ tbody.enter().append('tbody');
+
+
+
+ //compute max generations
+ depth = d3.max(nodes, function(node) { return node.depth });
+ tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all
+
+
+ // Update the nodes…
+ var node = tbody.selectAll('tr')
+ // .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)});
+ .data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)});
+ //.style('display', 'table-row'); //TODO: see if this does anything
+
+ node.exit().remove();
+
+ node.select('img.nv-treeicon')
+ .attr('src', icon)
+ .classed('folded', folded);
+
+ var nodeEnter = node.enter().append('tr');
+
+
+ columns.forEach(function(column, index) {
+
+ var nodeName = nodeEnter.append('td')
+ .style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here
+ .style('text-align', column.type == 'numeric' ? 'right' : 'left');
+
+
+ if (index == 0) {
+ nodeName.append('img')
+ .classed('nv-treeicon', true)
+ .classed('nv-folded', folded)
+ .attr('src', icon)
+ .style('width', '14px')
+ .style('height', '14px')
+ .style('padding', '0 1px')
+ .style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; })
+ .on('click', click);
+ }
+
+
+ nodeName.each(function(d) {
+ if (!index && getUrl(d))
+ d3.select(this)
+ .append('a')
+ .attr('href',getUrl)
+ .attr('class', d3.functor(column.classes))
+ .append('span')
+ else
+ d3.select(this)
+ .append('span')
+
+ d3.select(this).select('span')
+ .attr('class', d3.functor(column.classes) )
+ .text(function(d) { return column.format ? column.format(d) :
+ (d[column.key] || '-') });
+ });
+
+ if (column.showCount) {
+ nodeName.append('span')
+ .attr('class', 'nv-childrenCount');
+
+ node.selectAll('span.nv-childrenCount').text(function(d) {
+ return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent
+ '(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter
+ || (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values...
+ || 0) + ')' //This is the catch-all in case there are no children after a filter
+ : '' //If this is not a parent, just give an empty string
+ });
+ }
+
+ // if (column.click)
+ // nodeName.select('span').on('click', column.click);
+
+ });
+
+ node
+ .order()
+ .on('click', function(d) {
+ dispatch.elementClick({
+ row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href)
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('dblclick', function(d) {
+ dispatch.elementDblclick({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('mouseover', function(d) {
+ dispatch.elementMouseover({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('mouseout', function(d) {
+ dispatch.elementMouseout({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ });
+
+
+
+
+ // Toggle children on click.
+ function click(d, _, unshift) {
+ d3.event.stopPropagation();
+
+ if(d3.event.shiftKey && !unshift) {
+ //If you shift-click, it'll toggle fold all the children, instead of itself
+ d3.event.shiftKey = false;
+ d.values && d.values.forEach(function(node){
+ if (node.values || node._values) {
+ click(node, 0, true);
+ }
+ });
+ return true;
+ }
+ if(!hasChildren(d)) {
+ //download file
+ //window.location.href = d.url;
+ return true;
+ }
+ if (d.values) {
+ d._values = d.values;
+ d.values = null;
+ } else {
+ d.values = d._values;
+ d._values = null;
+ }
+ chart.update();
+ }
+
+
+ function icon(d) {
+ return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : '';
+ }
+
+ function folded(d) {
+ return (d._values && d._values.length);
+ }
+
+ function hasChildren(d) {
+ var values = d.values || d._values;
+
+ return (values && values.length);
+ }
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ scatter.color(color);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.header = function(_) {
+ if (!arguments.length) return header;
+ header = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.filterZero = function(_) {
+ if (!arguments.length) return filterZero;
+ filterZero = _;
+ return chart;
+ };
+
+ chart.columns = function(_) {
+ if (!arguments.length) return columns;
+ columns = _;
+ return chart;
+ };
+
+ chart.tableClass = function(_) {
+ if (!arguments.length) return tableClass;
+ tableClass = _;
+ return chart;
+ };
+
+ chart.iconOpen = function(_){
+ if (!arguments.length) return iconOpen;
+ iconOpen = _;
+ return chart;
+ }
+
+ chart.iconClose = function(_){
+ if (!arguments.length) return iconClose;
+ iconClose = _;
+ return chart;
+ }
+
+ chart.getUrl = function(_){
+ if (!arguments.length) return getUrl;
+ getUrl = _;
+ return chart;
+ }
+
+ //============================================================
+
+
+ return chart;
+}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/legend.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/legend.js
new file mode 100644
index 00000000..21f9f9a4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/legend.js
@@ -0,0 +1,270 @@
+nv.models.legend = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 5, right: 0, bottom: 5, left: 0}
+ , width = 400
+ , height = 20
+ , getKey = function(d) { return d.key }
+ , color = nv.utils.defaultColor()
+ , align = true
+ , rightAlign = true
+ , updateState = true //If true, legend will update data.disabled and trigger a 'stateChange' dispatch.
+ , radioButtonMode = false //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at a time)
+ , dispatch = d3.dispatch('legendClick', 'legendDblclick', 'legendMouseover', 'legendMouseout', 'stateChange')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-legend').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-legend').append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ var series = g.selectAll('.nv-series')
+ .data(function(d) { return d });
+ var seriesEnter = series.enter().append('g').attr('class', 'nv-series')
+ .on('mouseover', function(d,i) {
+ dispatch.legendMouseover(d,i); //TODO: Make consistent with other event objects
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.legendMouseout(d,i);
+ })
+ .on('click', function(d,i) {
+ dispatch.legendClick(d,i);
+ if (updateState) {
+ if (radioButtonMode) {
+ //Radio button mode: set every series to disabled,
+ // and enable the clicked series.
+ data.forEach(function(series) { series.disabled = true});
+ d.disabled = false;
+ }
+ else {
+ d.disabled = !d.disabled;
+ if (data.every(function(series) { return series.disabled})) {
+ //the default behavior of NVD3 legends is, if every single series
+ // is disabled, turn all series' back on.
+ data.forEach(function(series) { series.disabled = false});
+ }
+ }
+ dispatch.stateChange({
+ disabled: data.map(function(d) { return !!d.disabled })
+ });
+ }
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.legendDblclick(d,i);
+ if (updateState) {
+ //the default behavior of NVD3 legends, when double clicking one,
+ // is to set all other series' to false, and make the double clicked series enabled.
+ data.forEach(function(series) {
+ series.disabled = true;
+ });
+ d.disabled = false;
+ dispatch.stateChange({
+ disabled: data.map(function(d) { return !!d.disabled })
+ });
+ }
+ });
+ seriesEnter.append('circle')
+ .style('stroke-width', 2)
+ .attr('class','nv-legend-symbol')
+ .attr('r', 5);
+ seriesEnter.append('text')
+ .attr('text-anchor', 'start')
+ .attr('class','nv-legend-text')
+ .attr('dy', '.32em')
+ .attr('dx', '8');
+ series.classed('disabled', function(d) { return d.disabled });
+ series.exit().remove();
+ series.select('circle')
+ .style('fill', function(d,i) { return d.color || color(d,i)})
+ .style('stroke', function(d,i) { return d.color || color(d, i) });
+ series.select('text').text(getKey);
+
+
+ //TODO: implement fixed-width and max-width options (max-width is especially useful with the align option)
+
+ // NEW ALIGNING CODE, TODO: clean up
+ if (align) {
+
+ var seriesWidths = [];
+ series.each(function(d,i) {
+ var legendText = d3.select(this).select('text');
+ var nodeTextLength;
+ try {
+ nodeTextLength = legendText.node().getComputedTextLength();
+ }
+ catch(e) {
+ nodeTextLength = nv.utils.calcApproxTextWidth(legendText);
+ }
+
+ seriesWidths.push(nodeTextLength + 28); // 28 is ~ the width of the circle plus some padding
+ });
+
+ var seriesPerRow = 0;
+ var legendWidth = 0;
+ var columnWidths = [];
+
+ while ( legendWidth < availableWidth && seriesPerRow < seriesWidths.length) {
+ columnWidths[seriesPerRow] = seriesWidths[seriesPerRow];
+ legendWidth += seriesWidths[seriesPerRow++];
+ }
+ if (seriesPerRow === 0) seriesPerRow = 1; //minimum of one series per row
+
+
+ while ( legendWidth > availableWidth && seriesPerRow > 1 ) {
+ columnWidths = [];
+ seriesPerRow--;
+
+ for (var k = 0; k < seriesWidths.length; k++) {
+ if (seriesWidths[k] > (columnWidths[k % seriesPerRow] || 0) )
+ columnWidths[k % seriesPerRow] = seriesWidths[k];
+ }
+
+ legendWidth = columnWidths.reduce(function(prev, cur, index, array) {
+ return prev + cur;
+ });
+ }
+
+ var xPositions = [];
+ for (var i = 0, curX = 0; i < seriesPerRow; i++) {
+ xPositions[i] = curX;
+ curX += columnWidths[i];
+ }
+
+ series
+ .attr('transform', function(d, i) {
+ return 'translate(' + xPositions[i % seriesPerRow] + ',' + (5 + Math.floor(i / seriesPerRow) * 20) + ')';
+ });
+
+ //position legend as far right as possible within the total width
+ if (rightAlign) {
+ g.attr('transform', 'translate(' + (width - margin.right - legendWidth) + ',' + margin.top + ')');
+ }
+ else {
+ g.attr('transform', 'translate(0' + ',' + margin.top + ')');
+ }
+
+ height = margin.top + margin.bottom + (Math.ceil(seriesWidths.length / seriesPerRow) * 20);
+
+ } else {
+
+ var ypos = 5,
+ newxpos = 5,
+ maxwidth = 0,
+ xpos;
+ series
+ .attr('transform', function(d, i) {
+ var length = d3.select(this).select('text').node().getComputedTextLength() + 28;
+ xpos = newxpos;
+
+ if (width < margin.left + margin.right + xpos + length) {
+ newxpos = xpos = 5;
+ ypos += 20;
+ }
+
+ newxpos += length;
+ if (newxpos > maxwidth) maxwidth = newxpos;
+
+ return 'translate(' + xpos + ',' + ypos + ')';
+ });
+
+ //position legend as far right as possible within the total width
+ g.attr('transform', 'translate(' + (width - margin.right - maxwidth) + ',' + margin.top + ')');
+
+ height = margin.top + margin.bottom + ypos + 15;
+
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.key = function(_) {
+ if (!arguments.length) return getKey;
+ getKey = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.align = function(_) {
+ if (!arguments.length) return align;
+ align = _;
+ return chart;
+ };
+
+ chart.rightAlign = function(_) {
+ if (!arguments.length) return rightAlign;
+ rightAlign = _;
+ return chart;
+ };
+
+ chart.updateState = function(_) {
+ if (!arguments.length) return updateState;
+ updateState = _;
+ return chart;
+ };
+
+ chart.radioButtonMode = function(_) {
+ if (!arguments.length) return radioButtonMode;
+ radioButtonMode = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/line.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/line.js
new file mode 100644
index 00000000..855cc541
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/line.js
@@ -0,0 +1,284 @@
+
+nv.models.line = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ ;
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // a function that returns a color
+ , getX = function(d) { return d.x } // accessor to get the x value from a data point
+ , getY = function(d) { return d.y } // accessor to get the y value from a data point
+ , defined = function(d,i) { return !isNaN(getY(d,i)) && getY(d,i) !== null } // allows a line to be not continuous when it is not defined
+ , isArea = function(d) { return d.area } // decides if a line is an area or just a line
+ , clipEdge = false // if true, masks lines within x and y scale
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , interpolate = "linear" // controls the line interpolation
+ ;
+
+ scatter
+ .size(16) // default size
+ .sizeDomain([16,256]) //set to speed up calculation, needs to be unset if there is a custom size accessor
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-line').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-groups');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var scatterWrap = wrap.select('.nv-scatterWrap');
+ //.datum(data); // Data automatically trickles down from the wrap
+
+ scatterWrap.transition().call(scatter);
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + scatter.id())
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + scatter.id() + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : '');
+ scatterWrap
+ .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : '');
+
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit()
+ .transition()
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i)});
+ groups
+ .transition()
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .5);
+
+
+
+ var areaPaths = groups.selectAll('path.nv-area')
+ .data(function(d) { return isArea(d) ? [d] : [] }); // this is done differently than lines because I need to check if series is an area
+ areaPaths.enter().append('path')
+ .attr('class', 'nv-area')
+ .attr('d', function(d) {
+ return d3.svg.area()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) })
+ .y0(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) })
+ .y1(function(d,i) { return y0( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
+ //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
+ .apply(this, [d.values])
+ });
+ groups.exit().selectAll('path.nv-area')
+ .remove();
+
+ areaPaths
+ .transition()
+ .attr('d', function(d) {
+ return d3.svg.area()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .y0(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ .y1(function(d,i) { return y( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
+ //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
+ .apply(this, [d.values])
+ });
+
+
+
+ var linePaths = groups.selectAll('path.nv-line')
+ .data(function(d) { return [d.values] });
+ linePaths.enter().append('path')
+ .attr('class', 'nv-line')
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) })
+ .y(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) })
+ );
+ groups.exit().selectAll('path.nv-line')
+ .transition()
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .y(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ );
+ linePaths
+ .transition()
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .y(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ );
+
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = scatter.dispatch;
+ chart.scatter = scatter;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange',
+ 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'useVoronoi', 'clipRadius', 'padData','highlightPoint','clearHighlights');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ scatter.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ scatter.y(_);
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ scatter.color(color);
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ interpolate = _;
+ return chart;
+ };
+
+ chart.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return chart;
+ };
+
+ chart.isArea = function(_) {
+ if (!arguments.length) return isArea;
+ isArea = d3.functor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineChart.js
new file mode 100644
index 00000000..a4ffcf6a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineChart.js
@@ -0,0 +1,465 @@
+
+nv.models.lineChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , interactiveLayer = nv.interactiveGuideline()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , useInteractiveGuideline = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x
+ , y
+ , state = {}
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append("rect").style("opacity",0);
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-interactive');
+
+ g.select("rect").attr("width",availableWidth).attr("height",availableHeight);
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+
+ //------------------------------------------------------------
+ //Set up interactive layer
+ if (useInteractiveGuideline) {
+ interactiveLayer
+ .width(availableWidth)
+ .height(availableHeight)
+ .margin({left:margin.left, top:margin.top})
+ .svgContainer(container)
+ .xScale(x);
+ wrap.select(".nv-interactive").call(interactiveLayer);
+ }
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ linesWrap.transition().call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ g.select('.nv-x.nv-axis')
+ .transition()
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .transition()
+ .call(yAxis);
+ }
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ interactiveLayer.dispatch.on('elementMousemove', function(e) {
+ lines.clearHighlights();
+ var singlePoint, pointIndex, pointXLocation, allData = [];
+ data
+ .filter(function(series, i) {
+ series.seriesIndex = i;
+ return !series.disabled;
+ })
+ .forEach(function(series,i) {
+ pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x());
+ lines.highlightPoint(i, pointIndex, true);
+ var point = series.values[pointIndex];
+ if (typeof point === 'undefined') return;
+ if (typeof singlePoint === 'undefined') singlePoint = point;
+ if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex));
+ allData.push({
+ key: series.key,
+ value: chart.y()(point, pointIndex),
+ color: color(series,series.seriesIndex)
+ });
+ });
+ //Highlight the tooltip entry based on which point the mouse is closest to.
+ if (allData.length > 2) {
+ var yValue = chart.yScale().invert(e.mouseY);
+ var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]);
+ var threshold = 0.03 * domainExtent;
+ var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold);
+ if (indexToHighlight !== null)
+ allData[indexToHighlight].highlight = true;
+ }
+
+ var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));
+ interactiveLayer.tooltip
+ .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
+ .chartContainer(that.parentNode)
+ .enabled(tooltips)
+ .valueFormatter(function(d,i) {
+ return yAxis.tickFormat()(d);
+ })
+ .data(
+ {
+ value: xValue,
+ series: allData
+ }
+ )();
+
+ interactiveLayer.renderGuideLine(pointXLocation);
+
+ });
+
+ interactiveLayer.dispatch.on("elementMouseout",function(e) {
+ dispatch.tooltipHide();
+ lines.clearHighlights();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.lines = lines;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.interactiveLayer = interactiveLayer;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'xRange', 'yRange'
+ , 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'useVoronoi','id', 'interpolate');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.useInteractiveGuideline = function(_) {
+ if(!arguments.length) return useInteractiveGuideline;
+ useInteractiveGuideline = _;
+ if (_ === true) {
+ chart.interactive(false);
+ chart.useVoronoi(false);
+ }
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/linePlusBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/linePlusBarChart.js
new file mode 100644
index 00000000..77fcbab7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/linePlusBarChart.js
@@ -0,0 +1,433 @@
+
+nv.models.linePlusBarChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , bars = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , y1Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 60, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.defaultColor()
+ , showLegend = true
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>';
+ }
+ , x
+ , y1
+ , y2
+ , state = {}
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ bars
+ .padData(true)
+ ;
+ lines
+ .clipEdge(false)
+ .padData(true)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ .highlightZero(false)
+ ;
+ y1Axis
+ .orient('left')
+ ;
+ y2Axis
+ .orient('right')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ }
+ ;
+
+ //------------------------------------------------------------
+
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ // chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ var dataBars = data.filter(function(d) { return !d.disabled && d.bar });
+ var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240
+
+ //x = xAxis.scale();
+ x = dataLines.filter(function(d) { return !d.disabled; }).length && dataLines.filter(function(d) { return !d.disabled; })[0].values.length ? lines.xScale() : bars.xScale();
+ //x = dataLines.filter(function(d) { return !d.disabled; }).length ? lines.xScale() : bars.xScale(); //old code before change above
+ y1 = bars.yScale();
+ y2 = lines.yScale();
+
+ //------------------------------------------------------------
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-linePlusBar').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ gEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.nv-legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }))
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }))
+
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(dataBars.length ? dataBars : [{values:[]}])
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(dataLines[0] && !dataLines[0].disabled ? dataLines : [{values:[]}] );
+ //.datum(!dataLines[0].disabled ? dataLines : [{values:dataLines[0].values.map(function(d) { return [d[0], null] }) }] );
+
+ d3.transition(barsWrap).call(bars);
+ d3.transition(linesWrap).call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y1.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+
+ y1Axis
+ .scale(y1)
+ .ticks( availableHeight / 36 )
+ .tickSize(-availableWidth, 0);
+
+ d3.transition(g.select('.nv-y1.nv-axis'))
+ .style('opacity', dataBars.length ? 1 : 0)
+ .call(y1Axis);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + availableWidth + ',0)');
+ //.attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ d3.transition(g.select('.nv-y2.nv-axis'))
+ .call(y2Axis);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.bars = bars;
+ chart.xAxis = xAxis;
+ chart.y1Axis = y1Axis;
+ chart.y2Axis = y2Axis;
+
+ d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate');
+ //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc.
+ //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines.x(_);
+ bars.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines.y(_);
+ bars.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/linePlusBarWithFocusChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/linePlusBarWithFocusChart.js
new file mode 100644
index 00000000..2ef31137
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/linePlusBarWithFocusChart.js
@@ -0,0 +1,658 @@
+
+nv.models.linePlusBarWithFocusChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , lines2 = nv.models.line()
+ , bars = nv.models.historicalBar()
+ , bars2 = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , x2Axis = nv.models.axis()
+ , y1Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , y3Axis = nv.models.axis()
+ , y4Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ , brush = d3.svg.brush()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 30, left: 60}
+ , margin2 = {top: 0, right: 30, bottom: 20, left: 60}
+ , width = null
+ , height = null
+ , height2 = 100
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.defaultColor()
+ , showLegend = true
+ , extent
+ , brushExtent = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>';
+ }
+ , x
+ , x2
+ , y1
+ , y2
+ , y3
+ , y4
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
+ , transitionDuration = 0
+ ;
+
+ lines
+ .clipEdge(true)
+ ;
+ lines2
+ .interactive(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y1Axis
+ .orient('left')
+ ;
+ y2Axis
+ .orient('right')
+ ;
+ x2Axis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y3Axis
+ .orient('left')
+ ;
+ y4Axis
+ .orient('right')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ if (extent) {
+ e.pointIndex += Math.ceil(extent[0]);
+ }
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //------------------------------------------------------------
+
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2,
+ availableHeight2 = height2 - margin2.top - margin2.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight1 / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ var dataBars = data.filter(function(d) { return !d.disabled && d.bar });
+ var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240
+
+ x = bars.xScale();
+ x2 = x2Axis.scale();
+ y1 = bars.yScale();
+ y2 = lines.yScale();
+ y3 = bars2.yScale();
+ y4 = lines2.yScale();
+
+ var series1 = data
+ .filter(function(d) { return !d.disabled && d.bar })
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i) }
+ })
+ });
+
+ var series2 = data
+ .filter(function(d) { return !d.disabled && !d.bar })
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i) }
+ })
+ });
+
+ x .range([0, availableWidth]);
+
+ x2 .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } ))
+ .range([0, availableWidth]);
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-linePlusBar').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ var focusEnter = gEnter.append('g').attr('class', 'nv-focus');
+ focusEnter.append('g').attr('class', 'nv-x nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ focusEnter.append('g').attr('class', 'nv-barsWrap');
+ focusEnter.append('g').attr('class', 'nv-linesWrap');
+
+ var contextEnter = gEnter.append('g').attr('class', 'nv-context');
+ contextEnter.append('g').attr('class', 'nv-x nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ contextEnter.append('g').attr('class', 'nv-barsWrap');
+ contextEnter.append('g').attr('class', 'nv-linesWrap');
+ contextEnter.append('g').attr('class', 'nv-brushBackground');
+ contextEnter.append('g').attr('class', 'nv-x nv-brush');
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.nv-legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Context Components
+
+ bars2
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }));
+
+ lines2
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }));
+
+ var bars2Wrap = g.select('.nv-context .nv-barsWrap')
+ .datum(dataBars.length ? dataBars : [{values:[]}]);
+
+ var lines2Wrap = g.select('.nv-context .nv-linesWrap')
+ .datum(!dataLines[0].disabled ? dataLines : [{values:[]}]);
+
+ g.select('.nv-context')
+ .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')')
+
+ bars2Wrap.transition().call(bars2);
+ lines2Wrap.transition().call(lines2);
+
+ //------------------------------------------------------------
+
+
+
+ //------------------------------------------------------------
+ // Setup Brush
+
+ brush
+ .x(x2)
+ .on('brush', onBrush);
+
+ if (brushExtent) brush.extent(brushExtent);
+
+ var brushBG = g.select('.nv-brushBackground').selectAll('g')
+ .data([brushExtent || brush.extent()])
+
+ var brushBGenter = brushBG.enter()
+ .append('g');
+
+ brushBGenter.append('rect')
+ .attr('class', 'left')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ brushBGenter.append('rect')
+ .attr('class', 'right')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ var gBrush = g.select('.nv-x.nv-brush')
+ .call(brush);
+ gBrush.selectAll('rect')
+ //.attr('y', -5)
+ .attr('height', availableHeight2);
+ gBrush.selectAll('.resize').append('path').attr('d', resizePath);
+
+ //------------------------------------------------------------
+
+ //------------------------------------------------------------
+ // Setup Secondary (Context) Axes
+
+ x2Axis
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight2, 0);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y3.range()[0] + ')');
+ g.select('.nv-context .nv-x.nv-axis').transition()
+ .call(x2Axis);
+
+
+ y3Axis
+ .scale(y3)
+ .ticks( availableHeight2 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-context .nv-y1.nv-axis')
+ .style('opacity', dataBars.length ? 1 : 0)
+ .attr('transform', 'translate(0,' + x2.range()[0] + ')');
+
+ g.select('.nv-context .nv-y1.nv-axis').transition()
+ .call(y3Axis);
+
+
+ y4Axis
+ .scale(y4)
+ .ticks( availableHeight2 / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-context .nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + x2.range()[1] + ',0)');
+
+ g.select('.nv-context .nv-y2.nv-axis').transition()
+ .call(y4Axis);
+
+ //------------------------------------------------------------
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ // Taken from crossfilter (http://square.github.com/crossfilter/)
+ function resizePath(d) {
+ var e = +(d == 'e'),
+ x = e ? 1 : -1,
+ y = availableHeight2 / 3;
+ return 'M' + (.5 * x) + ',' + y
+ + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6)
+ + 'V' + (2 * y - 6)
+ + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y)
+ + 'Z'
+ + 'M' + (2.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8)
+ + 'M' + (4.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8);
+ }
+
+
+ function updateBrushBG() {
+ if (!brush.empty()) brush.extent(brushExtent);
+ brushBG
+ .data([brush.empty() ? x2.domain() : brushExtent])
+ .each(function(d,i) {
+ var leftWidth = x2(d[0]) - x2.range()[0],
+ rightWidth = x2.range()[1] - x2(d[1]);
+ d3.select(this).select('.left')
+ .attr('width', leftWidth < 0 ? 0 : leftWidth);
+
+ d3.select(this).select('.right')
+ .attr('x', x2(d[1]))
+ .attr('width', rightWidth < 0 ? 0 : rightWidth);
+ });
+ }
+
+
+ function onBrush() {
+ brushExtent = brush.empty() ? null : brush.extent();
+ extent = brush.empty() ? x2.domain() : brush.extent();
+
+
+ dispatch.brush({extent: extent, brush: brush});
+
+ updateBrushBG();
+
+
+ //------------------------------------------------------------
+ // Prepare Main (Focus) Bars and Lines
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }));
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }));
+
+ var focusBarsWrap = g.select('.nv-focus .nv-barsWrap')
+ .datum(!dataBars.length ? [{values:[]}] :
+ dataBars
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return bars.x()(d,i) >= extent[0] && bars.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(dataLines[0].disabled ? [{values:[]}] :
+ dataLines
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Update Main (Focus) X Axis
+
+ if (dataBars.length) {
+ x = bars.xScale();
+ } else {
+ x = lines.xScale();
+ }
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight1, 0);
+
+ xAxis.domain([Math.ceil(extent[0]), Math.floor(extent[1])]);
+
+ g.select('.nv-x.nv-axis').transition().duration(transitionDuration)
+ .call(xAxis);
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Update Main (Focus) Bars and Lines
+
+ focusBarsWrap.transition().duration(transitionDuration).call(bars);
+ focusLinesWrap.transition().duration(transitionDuration).call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup and Update Main (Focus) Y Axes
+
+ g.select('.nv-focus .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y1.range()[0] + ')');
+
+
+ y1Axis
+ .scale(y1)
+ .ticks( availableHeight1 / 36 )
+ .tickSize(-availableWidth, 0);
+
+ g.select('.nv-focus .nv-y1.nv-axis')
+ .style('opacity', dataBars.length ? 1 : 0);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight1 / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-focus .nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ g.select('.nv-focus .nv-y1.nv-axis').transition().duration(transitionDuration)
+ .call(y1Axis);
+ g.select('.nv-focus .nv-y2.nv-axis').transition().duration(transitionDuration)
+ .call(y2Axis);
+ }
+
+ //============================================================
+
+ onBrush();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.lines2 = lines2;
+ chart.bars = bars;
+ chart.bars2 = bars2;
+ chart.xAxis = xAxis;
+ chart.x2Axis = x2Axis;
+ chart.y1Axis = y1Axis;
+ chart.y2Axis = y2Axis;
+ chart.y3Axis = y3Axis;
+ chart.y4Axis = y4Axis;
+
+ d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate');
+ //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc.
+ //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines.x(_);
+ bars.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines.y(_);
+ bars.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.brushExtent = function(_) {
+ if (!arguments.length) return brushExtent;
+ brushExtent = _;
+ return chart;
+ };
+
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFisheye.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFisheye.js
new file mode 100644
index 00000000..2b411672
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFisheye.js
@@ -0,0 +1,200 @@
+
+nv.models.line = function() {
+ "use strict";
+ //Default Settings
+ var margin = {top: 0, right: 0, bottom: 0, left: 0},
+ width = 960,
+ height = 500,
+ color = nv.utils.defaultColor(), // function that returns colors
+ id = Math.floor(Math.random() * 10000), //Create semi-unique ID incase user doesn't select one
+ getX = function(d) { return d.x }, // accessor to get the x value from a data point
+ getY = function(d) { return d.y }, // accessor to get the y value from a data point
+ clipEdge = false, // if true, masks lines within x and y scale
+ interpolate = "linear"; // controls the line interpolation
+
+
+ var scatter = nv.models.scatter()
+ .id(id)
+ .size(16) // default size
+ .sizeDomain([16,256]), //set to speed up calculation, needs to be unset if there is a custom size accessor
+ //x = scatter.xScale(),
+ //y = scatter.yScale(),
+ x, y,
+ x0, y0, timeoutID;
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom;
+
+ //get the scales inscase scatter scale was set manually
+ x = x || scatter.xScale();
+ y = y || scatter.yScale();
+
+ //store old scales if they exist
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-line').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ wrapEnter.append('g').attr('class', 'nv-scatterWrap');
+ var scatterWrap = wrap.select('.nv-scatterWrap').datum(data);
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+
+ d3.transition(scatterWrap).call(scatter);
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+ scatterWrap
+ .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) })
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .5)
+
+
+ var paths = groups.selectAll('path')
+ .data(function(d, i) { return [d.values] });
+ paths.enter().append('path')
+ .attr('class', 'nv-line')
+ .attr('d', d3.svg.line()
+ .interpolate(interpolate)
+ .x(function(d,i) { return x0(getX(d,i)) })
+ .y(function(d,i) { return y0(getY(d,i)) })
+ );
+ d3.transition(groups.exit().selectAll('path'))
+ .attr('d', d3.svg.line()
+ .interpolate(interpolate)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ )
+ .remove(); // redundant? line is already being removed
+ d3.transition(paths)
+ .attr('d', d3.svg.line()
+ .interpolate(interpolate)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ );
+
+
+ //store old scales for use in transitions on update, to animate from old to new positions
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ chart.dispatch = scatter.dispatch;
+
+ d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ scatter.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ scatter.y(_);
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ scatter.color(color);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ interpolate = _;
+ return chart;
+ };
+
+ chart.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return chart;
+ };
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFisheyeChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFisheyeChart.js
new file mode 100644
index 00000000..ad894190
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFisheyeChart.js
@@ -0,0 +1,297 @@
+
+nv.models.lineChart = function() {
+ "use strict";
+ var margin = {top: 30, right: 20, bottom: 50, left: 60},
+ color = nv.utils.defaultColor(),
+ width = null,
+ height = null,
+ showLegend = true,
+ showControls = true,
+ fisheye = 0,
+ pauseFisheye = false,
+ tooltips = true,
+ tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ },
+ noData = "No Data Available."
+ ;
+
+
+ var x = d3.fisheye.scale(d3.scale.linear).distortion(0);
+
+ var lines = nv.models.line().xScale(x),
+ //x = lines.xScale(),
+ y = lines.yScale(),
+ xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5),
+ yAxis = nv.models.axis().scale(y).orient('left'),
+ legend = nv.models.legend().height(30),
+ controls = nv.models.legend().height(30).updateState(false),
+ dispatch = d3.dispatch('tooltipShow', 'tooltipHide');
+
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+
+ var controlsData = [
+ { key: 'Magnify', disabled: true }
+ ];
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart) };
+ chart.container = this; // I need a reference to the container in order to have outside code check if the chart is visible or not
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ container.append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('x', availableWidth / 2)
+ .attr('y', availableHeight / 2)
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle')
+ .text(noData);
+ return chart;
+ } else {
+ container.select('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g');
+
+
+ gEnter.append('rect')
+ .attr('class', 'nvd3 nv-background')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+
+ var g = wrap.select('g');
+
+
+
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ if (showControls) {
+ controls.width(180).color(['#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+
+ g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(linesWrap).call(lines);
+
+
+
+ xAxis
+ //.scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+
+ yAxis
+ //.scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+
+
+ g.select('.nv-background').on('mousemove', updateFisheye);
+ g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye; });
+ //g.select('.point-paths').on('mousemove', updateFisheye);
+
+
+ function updateFisheye() {
+ if (pauseFisheye) {
+ //g.select('.background') .style('pointer-events', 'none');
+ g.select('.nv-point-paths').style('pointer-events', 'all');
+ return false;
+ }
+
+ g.select('.nv-background') .style('pointer-events', 'all');
+ g.select('.nv-point-paths').style('pointer-events', 'none' );
+
+ var mouse = d3.mouse(this);
+ linesWrap.call(lines);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ x.distortion(fisheye).focus(mouse[0]);
+ }
+
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ fisheye = d.disabled ? 0 : 5;
+ g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all');
+ g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' );
+
+ //scatter.interactive(d.disabled);
+ //tooltips = d.disabled;
+
+ if (d.disabled) {
+ x.distortion(fisheye).focus(0);
+
+ linesWrap.call(lines);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ } else {
+ pauseFisheye = false;
+ }
+
+ chart.update();
+ });
+
+
+ legend.dispatch.on('stateChange', function(newState) {
+ chart.update();
+ });
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+ if (tooltips) dispatch.on('tooltipShow', function(e) { showTooltip(e, that.parentNode) } ); // TODO: maybe merge with above?
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ if (tooltips) dispatch.on('tooltipHide', nv.tooltip.cleanup);
+
+ });
+
+ return chart;
+ }
+
+
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, lines, 'defined', 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFocusChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFocusChart.js
new file mode 100644
index 00000000..0afd28bd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFocusChart.js
@@ -0,0 +1,574 @@
+nv.models.lineWithFocusChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , lines2 = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , x2Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ , brush = d3.svg.brush()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 30, left: 60}
+ , margin2 = {top: 0, right: 30, bottom: 20, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , height2 = 100
+ , x
+ , y
+ , x2
+ , y2
+ , showLegend = true
+ , brushExtent = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
+ , transitionDuration = 250
+ ;
+
+ lines
+ .clipEdge(true)
+ ;
+ lines2
+ .interactive(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ yAxis
+ .orient('left')
+ ;
+ x2Axis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y2Axis
+ .orient('left')
+ ;
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2,
+ availableHeight2 = height2 - margin2.top - margin2.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight1 / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+ x2 = lines2.xScale();
+ y2 = lines2.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineWithFocusChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineWithFocusChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ var focusEnter = gEnter.append('g').attr('class', 'nv-focus');
+ focusEnter.append('g').attr('class', 'nv-x nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y nv-axis');
+ focusEnter.append('g').attr('class', 'nv-linesWrap');
+
+ var contextEnter = gEnter.append('g').attr('class', 'nv-context');
+ contextEnter.append('g').attr('class', 'nv-x nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y nv-axis');
+ contextEnter.append('g').attr('class', 'nv-linesWrap');
+ contextEnter.append('g').attr('class', 'nv-brushBackground');
+ contextEnter.append('g').attr('class', 'nv-x nv-brush');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(
+ data
+ .map(function(d,i) {
+ return d.color || color(d, i);
+ })
+ .filter(function(d,i) {
+ return !data[i].disabled;
+ })
+ );
+
+ lines2
+ .defined(lines.defined())
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(
+ data
+ .map(function(d,i) {
+ return d.color || color(d, i);
+ })
+ .filter(function(d,i) {
+ return !data[i].disabled;
+ })
+ );
+
+ g.select('.nv-context')
+ .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')')
+
+ var contextLinesWrap = g.select('.nv-context .nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(contextLinesWrap).call(lines2);
+
+ //------------------------------------------------------------
+
+
+ /*
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(focusLinesWrap).call(lines);
+ */
+
+
+ //------------------------------------------------------------
+ // Setup Main (Focus) Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight1, 0);
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight1 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-focus .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight1 + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Brush
+
+ brush
+ .x(x2)
+ .on('brush', function() {
+ //When brushing, turn off transitions because chart needs to change immediately.
+ var oldTransition = chart.transitionDuration();
+ chart.transitionDuration(0);
+ onBrush();
+ chart.transitionDuration(oldTransition);
+ });
+
+ if (brushExtent) brush.extent(brushExtent);
+
+ var brushBG = g.select('.nv-brushBackground').selectAll('g')
+ .data([brushExtent || brush.extent()])
+
+ var brushBGenter = brushBG.enter()
+ .append('g');
+
+ brushBGenter.append('rect')
+ .attr('class', 'left')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ brushBGenter.append('rect')
+ .attr('class', 'right')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ var gBrush = g.select('.nv-x.nv-brush')
+ .call(brush);
+ gBrush.selectAll('rect')
+ //.attr('y', -5)
+ .attr('height', availableHeight2);
+ gBrush.selectAll('.resize').append('path').attr('d', resizePath);
+
+ onBrush();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Secondary (Context) Axes
+
+ x2Axis
+ .scale(x2)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight2, 0);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y2.range()[0] + ')');
+ d3.transition(g.select('.nv-context .nv-x.nv-axis'))
+ .call(x2Axis);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight2 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-context .nv-y.nv-axis'))
+ .call(y2Axis);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y2.range()[0] + ')');
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ // Taken from crossfilter (http://square.github.com/crossfilter/)
+ function resizePath(d) {
+ var e = +(d == 'e'),
+ x = e ? 1 : -1,
+ y = availableHeight2 / 3;
+ return 'M' + (.5 * x) + ',' + y
+ + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6)
+ + 'V' + (2 * y - 6)
+ + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y)
+ + 'Z'
+ + 'M' + (2.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8)
+ + 'M' + (4.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8);
+ }
+
+
+ function updateBrushBG() {
+ if (!brush.empty()) brush.extent(brushExtent);
+ brushBG
+ .data([brush.empty() ? x2.domain() : brushExtent])
+ .each(function(d,i) {
+ var leftWidth = x2(d[0]) - x.range()[0],
+ rightWidth = x.range()[1] - x2(d[1]);
+ d3.select(this).select('.left')
+ .attr('width', leftWidth < 0 ? 0 : leftWidth);
+
+ d3.select(this).select('.right')
+ .attr('x', x2(d[1]))
+ .attr('width', rightWidth < 0 ? 0 : rightWidth);
+ });
+ }
+
+
+ function onBrush() {
+ brushExtent = brush.empty() ? null : brush.extent();
+ var extent = brush.empty() ? x2.domain() : brush.extent();
+
+ //The brush extent cannot be less than one. If it is, don't update the line chart.
+ if (Math.abs(extent[0] - extent[1]) <= 1) {
+ return;
+ }
+
+ dispatch.brush({extent: extent, brush: brush});
+
+
+ updateBrushBG();
+
+ // Update Main (Focus)
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(
+ data
+ .filter(function(d) { return !d.disabled })
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+ focusLinesWrap.transition().duration(transitionDuration).call(lines);
+
+
+ // Update Main (Focus) Axes
+ g.select('.nv-focus .nv-x.nv-axis').transition().duration(transitionDuration)
+ .call(xAxis);
+ g.select('.nv-focus .nv-y.nv-axis').transition().duration(transitionDuration)
+ .call(yAxis);
+ }
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.lines2 = lines2;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.x2Axis = x2Axis;
+ chart.y2Axis = y2Axis;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return lines.x;
+ lines.x(_);
+ lines2.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return lines.y;
+ lines.y(_);
+ lines2.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.margin2 = function(_) {
+ if (!arguments.length) return margin2;
+ margin2 = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.height2 = function(_) {
+ if (!arguments.length) return height2;
+ height2 = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color =nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return lines.interpolate();
+ lines.interpolate(_);
+ lines2.interpolate(_);
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ // Chart has multiple similar Axes, to prevent code duplication, probably need to link all axis functions manually like below
+ chart.xTickFormat = function(_) {
+ if (!arguments.length) return xAxis.tickFormat();
+ xAxis.tickFormat(_);
+ x2Axis.tickFormat(_);
+ return chart;
+ };
+
+ chart.yTickFormat = function(_) {
+ if (!arguments.length) return yAxis.tickFormat();
+ yAxis.tickFormat(_);
+ y2Axis.tickFormat(_);
+ return chart;
+ };
+
+ chart.brushExtent = function(_) {
+ if (!arguments.length) return brushExtent;
+ brushExtent = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBar.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBar.js
new file mode 100644
index 00000000..1085919b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBar.js
@@ -0,0 +1,461 @@
+
+nv.models.multiBar = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , clipEdge = true
+ , stacked = false
+ , stackOffset = 'zero' // options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function
+ , color = nv.utils.defaultColor()
+ , hideable = false
+ , barColor = null // adding the ability to set the color for each rather than the whole group
+ , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled
+ , delay = 1200
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , groupSpacing = 0.1
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ if(hideable && data.length) hideable = [{
+ values: data[0].values.map(function(d) {
+ return {
+ x: d.x,
+ y: 0,
+ series: d.series,
+ size: 0.01
+ };}
+ )}];
+
+ if (stacked)
+ data = d3.layout.stack()
+ .offset(stackOffset)
+ .values(function(d){ return d.values })
+ .y(getY)
+ (!data.length && hideable ? hideable : data);
+
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+
+ //------------------------------------------------------------
+ // HACK for negative value stacking
+ if (stacked)
+ data[0].values.map(function(d,i) {
+ var posBase = 0, negBase = 0;
+ data.map(function(d) {
+ var f = d.values[i]
+ f.size = Math.abs(f.y);
+ if (f.y<0) {
+ f.y1 = negBase;
+ negBase = negBase - f.size;
+ } else
+ {
+ f.y1 = f.size + posBase;
+ posBase = posBase + f.size;
+ }
+ });
+ });
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 }
+ })
+ });
+
+ x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands(xRange || [0, availableWidth], groupSpacing);
+
+ //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y1 : 0) }).concat(forceY)))
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 : d.y1 + d.y ) : d.y }).concat(forceY)))
+ .range(yRange || [availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d,i) { return i });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit()
+ .transition()
+ .selectAll('rect.nv-bar')
+ .delay(function(d,i) {
+ return i * delay/ data[0].values.length;
+ })
+ .attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) })
+ .attr('height', 0)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) });
+ groups
+ .transition()
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('rect.nv-bar')
+ .data(function(d) { return (hideable && !data.length) ? hideable.values : d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('rect')
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .attr('x', function(d,i,j) {
+ return stacked ? 0 : (j * x.rangeBand() / data.length )
+ })
+ .attr('y', function(d) { return y0(stacked ? d.y0 : 0) })
+ .attr('height', 0)
+ .attr('width', x.rangeBand() / (stacked ? 1 : data.length) )
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; })
+ ;
+ bars
+ .style('fill', function(d,i,j){ return color(d, j, i); })
+ .style('stroke', function(d,i,j){ return color(d, j, i); })
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .transition()
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; })
+
+ if (barColor) {
+ if (!disabled) disabled = data.map(function() { return true });
+ bars
+ .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); })
+ .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); });
+ }
+
+
+ if (stacked)
+ bars.transition()
+ .delay(function(d,i) {
+
+ return i * delay / data[0].values.length;
+ })
+ .attr('y', function(d,i) {
+
+ return y((stacked ? d.y1 : 0));
+ })
+ .attr('height', function(d,i) {
+ return Math.max(Math.abs(y(d.y + (stacked ? d.y0 : 0)) - y((stacked ? d.y0 : 0))),1);
+ })
+ .attr('x', function(d,i) {
+ return stacked ? 0 : (d.series * x.rangeBand() / data.length )
+ })
+ .attr('width', x.rangeBand() / (stacked ? 1 : data.length) );
+ else
+ bars.transition()
+ .delay(function(d,i) {
+ return i * delay/ data[0].values.length;
+ })
+ .attr('x', function(d,i) {
+ return d.series * x.rangeBand() / data.length
+ })
+ .attr('width', x.rangeBand() / data.length)
+ .attr('y', function(d,i) {
+ return getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 :
+ y(getY(d,i)) || 0;
+ })
+ .attr('height', function(d,i) {
+ return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) || 0;
+ });
+
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.stacked = function(_) {
+ if (!arguments.length) return stacked;
+ stacked = _;
+ return chart;
+ };
+
+ chart.stackOffset = function(_) {
+ if (!arguments.length) return stackOffset;
+ stackOffset = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.barColor = function(_) {
+ if (!arguments.length) return barColor;
+ barColor = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.disabled = function(_) {
+ if (!arguments.length) return disabled;
+ disabled = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.hideable = function(_) {
+ if (!arguments.length) return hideable;
+ hideable = _;
+ return chart;
+ };
+
+ chart.delay = function(_) {
+ if (!arguments.length) return delay;
+ delay = _;
+ return chart;
+ };
+
+ chart.groupSpacing = function(_) {
+ if (!arguments.length) return groupSpacing;
+ groupSpacing = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarChart.js
new file mode 100644
index 00000000..0323063f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarChart.js
@@ -0,0 +1,524 @@
+
+nv.models.multiBarChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var multibar = nv.models.multiBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , showControls = true
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , reduceXTicks = true // if false a tick will show for every data point
+ , staggerLabels = false
+ , rotateLabels = 0
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' on ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , state = { stacked: false }
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = function() { return showControls ? 180 : 0 }
+ , transitionDuration = 250
+ ;
+
+ multibar
+ .stacked(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ .highlightZero(true)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ controls.updateState(false);
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = multibar.xScale();
+ y = multibar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth - controlWidth());
+
+ if (multibar.barColor())
+ data.forEach(function(series,i) {
+ series.color = d3.rgb('#ccc').darker(i * 1.5).toString();
+ })
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Grouped', disabled: multibar.stacked() },
+ { key: 'Stacked', disabled: !multibar.stacked() }
+ ];
+
+ controls.width(controlWidth()).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ multibar
+ .disabled(data.map(function(series) { return series.disabled }))
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ barsWrap.transition().call(multibar);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ g.select('.nv-x.nv-axis').transition()
+ .call(xAxis);
+
+ var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g');
+
+ xTicks
+ .selectAll('line, text')
+ .style('opacity', 1)
+
+ if (staggerLabels) {
+ var getTranslate = function(x,y) {
+ return "translate(" + x + "," + y + ")";
+ };
+
+ var staggerUp = 5, staggerDown = 17; //pixels to stagger by
+ // Issue #140
+ xTicks
+ .selectAll("text")
+ .attr('transform', function(d,i,j) {
+ return getTranslate(0, (j % 2 == 0 ? staggerUp : staggerDown));
+ });
+
+ var totalInBetweenTicks = d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;
+ g.selectAll(".nv-x.nv-axis .nv-axisMaxMin text")
+ .attr("transform", function(d,i) {
+ return getTranslate(0, (i === 0 || totalInBetweenTicks % 2 !== 0) ? staggerDown : staggerUp);
+ });
+ }
+
+ if (reduceXTicks)
+ xTicks
+ .filter(function(d,i) {
+ return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0;
+ })
+ .selectAll('text, line')
+ .style('opacity', 0);
+
+ if(rotateLabels)
+ xTicks
+ .selectAll('.tick text')
+ .attr('transform', 'rotate(' + rotateLabels + ' 0,0)')
+ .style('text-anchor', rotateLabels > 0 ? 'start' : 'end');
+
+ g.select('.nv-x.nv-axis').selectAll('g.nv-axisMaxMin text')
+ .style('opacity', 1);
+ }
+
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis').transition()
+ .call(yAxis);
+ }
+
+
+ //------------------------------------------------------------
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Grouped':
+ multibar.stacked(false);
+ break;
+ case 'Stacked':
+ multibar.stacked(true);
+ break;
+ }
+
+ state.stacked = multibar.stacked();
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode)
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.stacked !== 'undefined') {
+ multibar.stacked(e.stacked);
+ state.stacked = e.stacked;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ multibar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ multibar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.multibar = multibar;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge',
+ 'id', 'stacked', 'stackOffset', 'delay', 'barColor','groupSpacing');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.reduceXTicks= function(_) {
+ if (!arguments.length) return reduceXTicks;
+ reduceXTicks = _;
+ return chart;
+ };
+
+ chart.rotateLabels = function(_) {
+ if (!arguments.length) return rotateLabels;
+ rotateLabels = _;
+ return chart;
+ }
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarHorizontal.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarHorizontal.js
new file mode 100644
index 00000000..d16d4605
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarHorizontal.js
@@ -0,0 +1,424 @@
+
+nv.models.multiBarHorizontal = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , color = nv.utils.defaultColor()
+ , barColor = null // adding the ability to set the color for each rather than the whole group
+ , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled
+ , stacked = false
+ , showValues = false
+ , valuePadding = 60
+ , valueFormat = d3.format(',.2f')
+ , delay = 1200
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ if (stacked)
+ data = d3.layout.stack()
+ .offset('zero')
+ .values(function(d){ return d.values })
+ .y(getY)
+ (data);
+
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+
+
+ //------------------------------------------------------------
+ // HACK for negative value stacking
+ if (stacked)
+ data[0].values.map(function(d,i) {
+ var posBase = 0, negBase = 0;
+ data.map(function(d) {
+ var f = d.values[i]
+ f.size = Math.abs(f.y);
+ if (f.y<0) {
+ f.y1 = negBase - f.size;
+ negBase = negBase - f.size;
+ } else
+ {
+ f.y1 = posBase;
+ posBase = posBase + f.size;
+ }
+ });
+ });
+
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 }
+ })
+ });
+
+ x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands(xRange || [0, availableHeight], .1);
+
+ //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY)))
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 + d.y : d.y1 ) : d.y }).concat(forceY)))
+
+ if (showValues && !stacked)
+ y.range(yRange || [(y.domain()[0] < 0 ? valuePadding : 0), availableWidth - (y.domain()[1] > 0 ? valuePadding : 0) ]);
+ else
+ y.range(yRange || [0, availableWidth]);
+
+ x0 = x0 || x;
+ y0 = y0 || d3.scale.linear().domain(y.domain()).range([y(0),y(0)]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-multibarHorizontal').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibarHorizontal');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d,i) { return i });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit().transition()
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) });
+ groups.transition()
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('g.nv-bar')
+ .data(function(d) { return d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('g')
+ .attr('transform', function(d,i,j) {
+ return 'translate(' + y0(stacked ? d.y0 : 0) + ',' + (stacked ? 0 : (j * x.rangeBand() / data.length ) + x(getX(d,i))) + ')'
+ });
+
+ barsEnter.append('rect')
+ .attr('width', 0)
+ .attr('height', x.rangeBand() / (stacked ? 1 : data.length) )
+
+ bars
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [ y(getY(d,i) + (stacked ? d.y0 : 0)), x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length) ],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+
+
+ barsEnter.append('text');
+
+ if (showValues && !stacked) {
+ bars.select('text')
+ .attr('text-anchor', function(d,i) { return getY(d,i) < 0 ? 'end' : 'start' })
+ .attr('y', x.rangeBand() / (data.length * 2))
+ .attr('dy', '.32em')
+ .text(function(d,i) { return valueFormat(getY(d,i)) })
+ bars.transition()
+ .select('text')
+ .attr('x', function(d,i) { return getY(d,i) < 0 ? -4 : y(getY(d,i)) - y(0) + 4 })
+ } else {
+ bars.selectAll('text').text('');
+ }
+
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+
+ if (barColor) {
+ if (!disabled) disabled = data.map(function() { return true });
+ bars
+ .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); })
+ .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); });
+ }
+
+ if (stacked)
+ bars.transition()
+ .attr('transform', function(d,i) {
+ return 'translate(' + y(d.y1) + ',' + x(getX(d,i)) + ')'
+ })
+ .select('rect')
+ .attr('width', function(d,i) {
+ return Math.abs(y(getY(d,i) + d.y0) - y(d.y0))
+ })
+ .attr('height', x.rangeBand() );
+ else
+ bars.transition()
+ .attr('transform', function(d,i) {
+ //TODO: stacked must be all positive or all negative, not both?
+ return 'translate(' +
+ (getY(d,i) < 0 ? y(getY(d,i)) : y(0))
+ + ',' +
+ (d.series * x.rangeBand() / data.length
+ +
+ x(getX(d,i)) )
+ + ')'
+ })
+ .select('rect')
+ .attr('height', x.rangeBand() / data.length )
+ .attr('width', function(d,i) {
+ return Math.max(Math.abs(y(getY(d,i)) - y(0)),1)
+ });
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.stacked = function(_) {
+ if (!arguments.length) return stacked;
+ stacked = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.barColor = function(_) {
+ if (!arguments.length) return barColor;
+ barColor = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.disabled = function(_) {
+ if (!arguments.length) return disabled;
+ disabled = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.delay = function(_) {
+ if (!arguments.length) return delay;
+ delay = _;
+ return chart;
+ };
+
+ chart.showValues = function(_) {
+ if (!arguments.length) return showValues;
+ showValues = _;
+ return chart;
+ };
+
+ chart.valueFormat= function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.valuePadding = function(_) {
+ if (!arguments.length) return valuePadding;
+ valuePadding = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarHorizontalChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarHorizontalChart.js
new file mode 100644
index 00000000..02aa6fa4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarHorizontalChart.js
@@ -0,0 +1,434 @@
+
+nv.models.multiBarHorizontalChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var multibar = nv.models.multiBarHorizontal()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend().height(30)
+ , controls = nv.models.legend().height(30)
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , showControls = true
+ , showLegend = true
+ , stacked = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + ' - ' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , state = { stacked: stacked }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = function() { return showControls ? 180 : 0 }
+ , transitionDuration = 250
+ ;
+
+ multibar
+ .stacked(stacked)
+ ;
+ xAxis
+ .orient('left')
+ .tickPadding(5)
+ .highlightZero(false)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient('bottom')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ controls.updateState(false);
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = multibar.xScale();
+ y = multibar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multiBarHorizontalChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarHorizontalChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth - controlWidth());
+
+ if (multibar.barColor())
+ data.forEach(function(series,i) {
+ series.color = d3.rgb('#ccc').darker(i * 1.5).toString();
+ })
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Grouped', disabled: multibar.stacked() },
+ { key: 'Stacked', disabled: !multibar.stacked() }
+ ];
+
+ controls.width(controlWidth()).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ multibar
+ .disabled(data.map(function(series) { return series.disabled }))
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ barsWrap.transition().call(multibar);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableHeight / 24 )
+ .tickSize(-availableWidth, 0);
+
+ g.select('.nv-x.nv-axis').transition()
+ .call(xAxis);
+
+ var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
+
+ xTicks
+ .selectAll('line, text')
+ .style('opacity', 1)
+
+
+ yAxis
+ .scale(y)
+ .ticks( availableWidth / 100 )
+ .tickSize( -availableHeight, 0);
+
+ g.select('.nv-y.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+ g.select('.nv-y.nv-axis').transition()
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Grouped':
+ multibar.stacked(false);
+ break;
+ case 'Stacked':
+ multibar.stacked(true);
+ break;
+ }
+
+ state.stacked = multibar.stacked();
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.stacked !== 'undefined') {
+ multibar.stacked(e.stacked);
+ state.stacked = e.stacked;
+ }
+
+ selection.call(chart);
+ });
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ multibar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ multibar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.multibar = multibar;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge', 'id', 'delay', 'showValues', 'valueFormat', 'stacked', 'barColor');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarTimeSeries.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarTimeSeries.js
new file mode 100644
index 00000000..abc062c3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarTimeSeries.js
@@ -0,0 +1,384 @@
+nv.models.multiBarTimeSeries = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , x = d3.time.scale()
+ , y = d3.scale.linear()
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , clipEdge = true
+ , stacked = false
+ , color = nv.utils.defaultColor()
+ , delay = 1200
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ if (stacked)
+ data = d3.layout.stack()
+ .offset('zero')
+ .values(function(d){ return d.values })
+ .y(getY)
+ (data);
+
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0 }
+ })
+ });
+
+ x .domain(xDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.x })))
+ .range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY)))
+ .range(yRange || [availableHeight, 0]);
+
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ //.style('stroke-opacity', 1e-6)
+ //.style('fill-opacity', 1e-6)
+ .selectAll('rect.nv-bar')
+ .delay(function(d,i) { return i * delay/ data[0].values.length })
+ .attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) })
+ .attr('height', 0)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) });
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('rect.nv-bar')
+ .data(function(d) { return d.values });
+
+ bars.exit().remove();
+
+ var maxElements = 0;
+ for(var ei=0; ei<seriesData.length; ei+=1) {
+ maxElements = Math.max(seriesData[ei].length, maxElements);
+ }
+
+ var bandWidth = (availableWidth / maxElements)-0.1;
+ var barWidth = bandWidth / data.length;
+
+ var barsEnter = bars.enter().append('rect')
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .attr('x', function(d,i,j) {
+ return stacked ? 0 : (i * bandWidth) + ( j * barWidth )
+ })
+ .attr('y', function(d) { return y0(stacked ? d.y0 : 0) })
+ .attr('height', 0)
+ .attr('width', stacked ? bandWidth : barWidth );
+ bars
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (barWidth * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (barWidth * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (barWidth * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; })
+ if (stacked)
+ d3.transition(bars)
+ .delay(function(d,i) { return i * delay / data[0].values.length })
+ .attr('y', function(d,i) {
+ return y(getY(d,i) + (stacked ? d.y0 : 0));
+ })
+ .attr('height', function(d,i) {
+ return Math.abs(y(d.y + (stacked ? d.y0 : 0)) - y((stacked ? d.y0 : 0)))
+ })
+ .each('end', function() {
+ d3.transition(d3.select(this))
+ .attr('x', function(d,i) {
+ return stacked ? 0 : (i * bandWidth) + ( j * barWidth )
+ })
+ .attr('width', stacked ? bandWidth : barWidth );
+ })
+ else
+ d3.transition(bars)
+ .delay(function(d,i) { return i * delay/ data[0].values.length })
+ .attr('x', function(d,i) {
+ return d.series * barWidth
+ })
+ .attr('width', barWidth)
+ .each('end', function() {
+ d3.transition(d3.select(this))
+ .attr('y', function(d,i) {
+ return getY(d,i) < 0 ?
+ y(0) :
+ y(getY(d,i))
+ })
+ .attr('height', function(d,i) {
+ return Math.abs(y(getY(d,i)) - y(0))
+ });
+ })
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.stacked = function(_) {
+ if (!arguments.length) return stacked;
+ stacked = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.delay = function(_) {
+ if (!arguments.length) return delay;
+ delay = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarTimeSeriesChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarTimeSeriesChart.js
new file mode 100644
index 00000000..5aebafa7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarTimeSeriesChart.js
@@ -0,0 +1,405 @@
+nv.models.multiBarTimeSeriesChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var multibar = nv.models.multiBarTimeSeries()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , showControls = true
+ , showLegend = true
+ , reduceXTicks = true // if false a tick will show for every data point
+ , rotateLabels = 0
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' on ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
+ ;
+
+ multibar
+ .stacked(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ .highlightZero(false)
+ .showMaxMin(false)
+ ;
+ yAxis
+ .orient('left')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { selection.transition().call(chart) };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = multibar.xScale();
+ y = multibar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth / 2);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Grouped', disabled: multibar.stacked() },
+ { key: 'Stacked', disabled: !multibar.stacked() }
+ ];
+
+ controls.width(180).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ multibar
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(barsWrap).call(multibar);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks(availableWidth / 100)
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+ var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g');
+
+ xTicks
+ .selectAll('line, text')
+ .style('opacity', 1)
+
+ if (reduceXTicks)
+ xTicks
+ .filter(function(d,i) {
+ return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0;
+ })
+ .selectAll('text, line')
+ .style('opacity', 0);
+
+ if(rotateLabels)
+ xTicks
+ .selectAll('text')
+ .attr('transform', function(d,i,j) { return 'rotate('+rotateLabels+' 0,0)' })
+ .attr('text-transform', rotateLabels > 0 ? 'start' : 'end');
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ selection.transition().call(chart);
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Grouped':
+ multibar.stacked(false);
+ break;
+ case 'Stacked':
+ multibar.stacked(true);
+ break;
+ }
+
+ selection.transition().call(chart);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode)
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ multibar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ multibar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.multibar = multibar;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge', 'id', 'stacked', 'delay');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.reduceXTicks= function(_) {
+ if (!arguments.length) return reduceXTicks;
+ reduceXTicks = _;
+ return chart;
+ };
+
+ chart.rotateLabels = function(_) {
+ if (!arguments.length) return rotateLabels;
+ rotateLabels = _;
+ return chart;
+ }
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiChart.js
new file mode 100644
index 00000000..e3e2c5e8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiChart.js
@@ -0,0 +1,452 @@
+nv.models.multiChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60},
+ color = d3.scale.category20().range(),
+ width = null,
+ height = null,
+ showLegend = true,
+ tooltips = true,
+ tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ },
+ x,
+ y,
+ yDomain1,
+ yDomain2
+ ; //can be accessed via chart.lines.[x/y]Scale()
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x = d3.scale.linear(),
+ yScale1 = d3.scale.linear(),
+ yScale2 = d3.scale.linear(),
+
+ lines1 = nv.models.line().yScale(yScale1),
+ lines2 = nv.models.line().yScale(yScale2),
+
+ bars1 = nv.models.multiBar().stacked(false).yScale(yScale1),
+ bars2 = nv.models.multiBar().stacked(false).yScale(yScale2),
+
+ stack1 = nv.models.stackedArea().yScale(yScale1),
+ stack2 = nv.models.stackedArea().yScale(yScale2),
+
+ xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5),
+ yAxis1 = nv.models.axis().scale(yScale1).orient('left'),
+ yAxis2 = nv.models.axis().scale(yScale2).orient('right'),
+
+ legend = nv.models.legend().height(30),
+ dispatch = d3.dispatch('tooltipShow', 'tooltipHide');
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines1.x()(e.point, e.pointIndex)),
+ y = ((e.series.yAxis == 2) ? yAxis2 : yAxis1).tickFormat()(lines1.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, undefined, undefined, offsetElement.offsetParent);
+ };
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ var dataLines1 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 1})
+ var dataLines2 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 2})
+ var dataBars1 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 1})
+ var dataBars2 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 2})
+ var dataStack1 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 1})
+ var dataStack2 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 2})
+
+ var series1 = data.filter(function(d) {return !d.disabled && d.yAxis == 1})
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: d.x, y: d.y }
+ })
+ })
+
+ var series2 = data.filter(function(d) {return !d.disabled && d.yAxis == 2})
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: d.x, y: d.y }
+ })
+ })
+
+ x .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } ))
+ .range([0, availableWidth]);
+
+ var wrap = container.selectAll('g.wrap.multiChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 multiChart').append('g');
+
+ gEnter.append('g').attr('class', 'x axis');
+ gEnter.append('g').attr('class', 'y1 axis');
+ gEnter.append('g').attr('class', 'y2 axis');
+ gEnter.append('g').attr('class', 'lines1Wrap');
+ gEnter.append('g').attr('class', 'lines2Wrap');
+ gEnter.append('g').attr('class', 'bars1Wrap');
+ gEnter.append('g').attr('class', 'bars2Wrap');
+ gEnter.append('g').attr('class', 'stack1Wrap');
+ gEnter.append('g').attr('class', 'stack2Wrap');
+ gEnter.append('g').attr('class', 'legendWrap');
+
+ var g = wrap.select('g');
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.yAxis == 1 ? '' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+
+ lines1
+ .width(availableWidth)
+ .height(availableHeight)
+ .interpolate("monotone")
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'line'}));
+
+ lines2
+ .width(availableWidth)
+ .height(availableHeight)
+ .interpolate("monotone")
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'line'}));
+
+ bars1
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'bar'}));
+
+ bars2
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'bar'}));
+
+ stack1
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'area'}));
+
+ stack2
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'area'}));
+
+ g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ var lines1Wrap = g.select('.lines1Wrap')
+ .datum(dataLines1)
+ var bars1Wrap = g.select('.bars1Wrap')
+ .datum(dataBars1)
+ var stack1Wrap = g.select('.stack1Wrap')
+ .datum(dataStack1)
+
+ var lines2Wrap = g.select('.lines2Wrap')
+ .datum(dataLines2)
+ var bars2Wrap = g.select('.bars2Wrap')
+ .datum(dataBars2)
+ var stack2Wrap = g.select('.stack2Wrap')
+ .datum(dataStack2)
+
+ var extraValue1 = dataStack1.length ? dataStack1.map(function(a){return a.values}).reduce(function(a,b){
+ return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}})
+ }).concat([{x:0, y:0}]) : []
+ var extraValue2 = dataStack2.length ? dataStack2.map(function(a){return a.values}).reduce(function(a,b){
+ return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}})
+ }).concat([{x:0, y:0}]) : []
+
+ yScale1 .domain(yDomain1 || d3.extent(d3.merge(series1).concat(extraValue1), function(d) { return d.y } ))
+ .range([0, availableHeight])
+
+ yScale2 .domain(yDomain2 || d3.extent(d3.merge(series2).concat(extraValue2), function(d) { return d.y } ))
+ .range([0, availableHeight])
+
+ lines1.yDomain(yScale1.domain())
+ bars1.yDomain(yScale1.domain())
+ stack1.yDomain(yScale1.domain())
+
+ lines2.yDomain(yScale2.domain())
+ bars2.yDomain(yScale2.domain())
+ stack2.yDomain(yScale2.domain())
+
+ if(dataStack1.length){d3.transition(stack1Wrap).call(stack1);}
+ if(dataStack2.length){d3.transition(stack2Wrap).call(stack2);}
+
+ if(dataBars1.length){d3.transition(bars1Wrap).call(bars1);}
+ if(dataBars2.length){d3.transition(bars2Wrap).call(bars2);}
+
+ if(dataLines1.length){d3.transition(lines1Wrap).call(lines1);}
+ if(dataLines2.length){d3.transition(lines2Wrap).call(lines2);}
+
+
+
+ xAxis
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.x.axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+ d3.transition(g.select('.x.axis'))
+ .call(xAxis);
+
+ yAxis1
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+
+ d3.transition(g.select('.y1.axis'))
+ .call(yAxis1);
+
+ yAxis2
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.y2.axis'))
+ .call(yAxis2);
+
+ g.select('.y2.axis')
+ .style('opacity', series2.length ? 1 : 0)
+ .attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ legend.dispatch.on('stateChange', function(newState) {
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ stack1.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ if (!Math.round(stack1.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stack1.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ stack2.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ if (!Math.round(stack2.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stack2.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+
+
+ //============================================================
+ // Global getters and setters
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.lines1 = lines1;
+ chart.lines2 = lines2;
+ chart.bars1 = bars1;
+ chart.bars2 = bars2;
+ chart.stack1 = stack1;
+ chart.stack2 = stack2;
+ chart.xAxis = xAxis;
+ chart.yAxis1 = yAxis1;
+ chart.yAxis2 = yAxis2;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines1.x(_);
+ bars1.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines1.y(_);
+ bars1.y(_);
+ return chart;
+ };
+
+ chart.yDomain1 = function(_) {
+ if (!arguments.length) return yDomain1;
+ yDomain1 = _;
+ return chart;
+ };
+
+ chart.yDomain2 = function(_) {
+ if (!arguments.length) return yDomain2;
+ yDomain2 = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = _;
+ legend.color(_);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ return chart;
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/ohlcBar.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/ohlcBar.js
new file mode 100644
index 00000000..46f2b60c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/ohlcBar.js
@@ -0,0 +1,380 @@
+
+nv.models.ohlcBar = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , getOpen = function(d) { return d.open }
+ , getClose = function(d) { return d.close }
+ , getHigh = function(d) { return d.high }
+ , getLow = function(d) { return d.low }
+ , forceX = []
+ , forceY = []
+ , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart
+ , clipEdge = true
+ , color = nv.utils.defaultColor()
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ //TODO: store old scales for transitions
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) ));
+
+ if (padData)
+ x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || [
+ d3.min(data[0].values.map(getLow).concat(forceY)),
+ d3.max(data[0].values.map(getHigh).concat(forceY))
+ ])
+ .range(yRange || [availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-ohlcBar').data([data[0].values]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-ohlcBar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-ticks');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-chart-clip-path-' + id)
+ .append('rect');
+
+ wrap.select('#nv-chart-clip-path-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : '');
+
+
+
+ var ticks = wrap.select('.nv-ticks').selectAll('.nv-tick')
+ .data(function(d) { return d });
+
+ ticks.exit().remove();
+
+
+ var ticksEnter = ticks.enter().append('path')
+ .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i })
+ .attr('d', function(d,i) {
+ var w = (availableWidth / data[0].values.length) * .9;
+ return 'm0,0l0,'
+ + (y(getOpen(d,i))
+ - y(getHigh(d,i)))
+ + 'l'
+ + (-w/2)
+ + ',0l'
+ + (w/2)
+ + ',0l0,'
+ + (y(getLow(d,i)) - y(getOpen(d,i)))
+ + 'l0,'
+ + (y(getClose(d,i))
+ - y(getLow(d,i)))
+ + 'l'
+ + (w/2)
+ + ',0l'
+ + (-w/2)
+ + ',0z';
+ })
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; })
+ //.attr('fill', function(d,i) { return color[0]; })
+ //.attr('stroke', function(d,i) { return color[0]; })
+ //.attr('x', 0 )
+ //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) })
+ .on('mouseover', function(d,i) {
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ point: d,
+ series: data[0],
+ pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ point: d,
+ series: data[0],
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ ticks
+ .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i })
+ d3.transition(ticks)
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; })
+ .attr('d', function(d,i) {
+ var w = (availableWidth / data[0].values.length) * .9;
+ return 'm0,0l0,'
+ + (y(getOpen(d,i))
+ - y(getHigh(d,i)))
+ + 'l'
+ + (-w/2)
+ + ',0l'
+ + (w/2)
+ + ',0l0,'
+ + (y(getLow(d,i))
+ - y(getOpen(d,i)))
+ + 'l0,'
+ + (y(getClose(d,i))
+ - y(getLow(d,i)))
+ + 'l'
+ + (w/2)
+ + ',0l'
+ + (-w/2)
+ + ',0z';
+ })
+ //.attr('width', (availableWidth / data[0].values.length) * .9 )
+
+
+ //d3.transition(ticks)
+ //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) });
+ //.order(); // not sure if this makes any sense for this model
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.open = function(_) {
+ if (!arguments.length) return getOpen;
+ getOpen = _;
+ return chart;
+ };
+
+ chart.close = function(_) {
+ if (!arguments.length) return getClose;
+ getClose = _;
+ return chart;
+ };
+
+ chart.high = function(_) {
+ if (!arguments.length) return getHigh;
+ getHigh = _;
+ return chart;
+ };
+
+ chart.low = function(_) {
+ if (!arguments.length) return getLow;
+ getLow = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/parallelCoordinates.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/parallelCoordinates.js
new file mode 100644
index 00000000..107154f7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/parallelCoordinates.js
@@ -0,0 +1,239 @@
+
+//Code adapted from Jason Davies' "Parallel Coordinates"
+// http://bl.ocks.org/jasondavies/1341281
+
+nv.models.parallelCoordinates = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+
+ var margin = {top: 30, right: 10, bottom: 10, left: 10}
+ , width = 960
+ , height = 500
+ , x = d3.scale.ordinal()
+ , y = {}
+ , dimensions = []
+ , color = nv.utils.getColor(d3.scale.category20c().range())
+ , axisLabel = function(d) { return d; }
+ , filters = []
+ , active = []
+ , dispatch = d3.dispatch('brush')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ active = data; //set all active before first brush call
+
+ chart.update = function() { }; //This is a placeholder until this chart is made resizeable
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x
+ .rangePoints([0, availableWidth], 1)
+ .domain(dimensions);
+
+ // Extract the list of dimensions and create a scale for each.
+ dimensions.forEach(function(d) {
+ y[d] = d3.scale.linear()
+ .domain(d3.extent(data, function(p) { return +p[d]; }))
+ .range([availableHeight, 0]);
+
+ y[d].brush = d3.svg.brush().y(y[d]).on('brush', brush);
+
+ return d != 'name';
+ })
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-parallelCoordinates').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-parallelCoordinates');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-parallelCoordinatesWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ var line = d3.svg.line(),
+ axis = d3.svg.axis().orient('left'),
+ background,
+ foreground;
+
+
+ // Add grey background lines for context.
+ background = gEnter.append('g')
+ .attr('class', 'background')
+ .selectAll('path')
+ .data(data)
+ .enter().append('path')
+ .attr('d', path)
+ ;
+
+ // Add blue foreground lines for focus.
+ foreground = gEnter.append('g')
+ .attr('class', 'foreground')
+ .selectAll('path')
+ .data(data)
+ .enter().append('path')
+ .attr('d', path)
+ ;
+
+ // Add a group element for each dimension.
+ var dimension = g.selectAll('.dimension')
+ .data(dimensions)
+ .enter().append('g')
+ .attr('class', 'dimension')
+ .attr('transform', function(d) { return 'translate(' + x(d) + ',0)'; });
+
+ // Add an axis and title.
+ dimension.append('g')
+ .attr('class', 'axis')
+ .each(function(d) { d3.select(this).call(axis.scale(y[d])); })
+ .append('text')
+ .attr('text-anchor', 'middle')
+ .attr('y', -9)
+ .text(String);
+
+ // Add and store a brush for each axis.
+ dimension.append('g')
+ .attr('class', 'brush')
+ .each(function(d) { d3.select(this).call(y[d].brush); })
+ .selectAll('rect')
+ .attr('x', -8)
+ .attr('width', 16);
+
+
+ // Returns the path for a given data point.
+ function path(d) {
+ return line(dimensions.map(function(p) { return [x(p), y[p](d[p])]; }));
+ }
+
+ // Handles a brush event, toggling the display of foreground lines.
+ function brush() {
+ var actives = dimensions.filter(function(p) { return !y[p].brush.empty(); }),
+ extents = actives.map(function(p) { return y[p].brush.extent(); });
+
+ filters = []; //erase current filters
+ actives.forEach(function(d,i) {
+ filters[i] = {
+ dimension: d,
+ extent: extents[i]
+ }
+ });
+
+ active = []; //erase current active list
+ foreground.style('display', function(d) {
+ var isActive = actives.every(function(p, i) {
+ return extents[i][0] <= d[p] && d[p] <= extents[i][1];
+ });
+ if (isActive) active.push(d);
+ return isActive ? null : 'none';
+ });
+
+ dispatch.brush({
+ filters: filters,
+ active: active
+ });
+
+ }
+
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+
+ chart.dispatch = dispatch;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_)
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.dimensions = function(_) {
+ if (!arguments.length) return dimensions;
+ dimensions = _;
+ return chart;
+ };
+
+ chart.filters = function() {
+ return filters;
+ };
+
+ chart.active = function() {
+ return active;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/pie.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/pie.js
new file mode 100644
index 00000000..2099c8f3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/pie.js
@@ -0,0 +1,400 @@
+nv.models.pie = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 500
+ , height = 500
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , getDescription = function(d) { return d.description }
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , color = nv.utils.defaultColor()
+ , valueFormat = d3.format(',.2f')
+ , showLabels = true
+ , pieLabelsOutside = true
+ , donutLabelsOutside = false
+ , labelType = "key"
+ , labelThreshold = .02 //if slice percentage is under this, don't show label
+ , donut = false
+ , labelSunbeamLayout = false
+ , startAngle = false
+ , endAngle = false
+ , donutRatio = 0.5
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ radius = Math.min(availableWidth, availableHeight) / 2,
+ arcRadius = radius-(radius / 5),
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ //var wrap = container.selectAll('.nv-wrap.nv-pie').data([data]);
+ var wrap = container.selectAll('.nv-wrap.nv-pie').data(data);
+ var wrapEnter = wrap.enter().append('g').attr('class','nvd3 nv-wrap nv-pie nv-chart-' + id);
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-pie');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+ g.select('.nv-pie').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ var arc = d3.svg.arc()
+ .outerRadius(arcRadius);
+
+ if (startAngle) arc.startAngle(startAngle)
+ if (endAngle) arc.endAngle(endAngle);
+ if (donut) arc.innerRadius(radius * donutRatio);
+
+ // Setup the Pie chart and choose the data element
+ var pie = d3.layout.pie()
+ .sort(null)
+ .value(function(d) { return d.disabled ? 0 : getY(d) });
+
+ var slices = wrap.select('.nv-pie').selectAll('.nv-slice')
+ .data(pie);
+
+ slices.exit().remove();
+
+ var ae = slices.enter().append('g')
+ .attr('class', 'nv-slice')
+ .on('mouseover', function(d,i){
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ pointIndex: i,
+ pos: [d3.event.pageX, d3.event.pageY],
+ id: id
+ });
+ })
+ .on('mouseout', function(d,i){
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ id: id
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ slices
+ .attr('fill', function(d,i) { return color(d, i); })
+ .attr('stroke', function(d,i) { return color(d, i); });
+
+ var paths = ae.append('path')
+ .each(function(d) { this._current = d; });
+ //.attr('d', arc);
+
+ d3.transition(slices.select('path'))
+ .attr('d', arc);
+ //.attrTween('d', arcTween);
+
+ if (showLabels) {
+ // This does the normal label
+ var labelsArc = d3.svg.arc().innerRadius(0);
+
+ if (pieLabelsOutside){ labelsArc = arc; }
+
+ if (donutLabelsOutside) { labelsArc = d3.svg.arc().outerRadius(arc.outerRadius()); }
+
+ ae.append("g").classed("nv-label", true)
+ .each(function(d, i) {
+ var group = d3.select(this);
+
+ group
+ .attr('transform', function(d) {
+ if (labelSunbeamLayout) {
+ d.outerRadius = arcRadius + 10; // Set Outer Coordinate
+ d.innerRadius = arcRadius + 15; // Set Inner Coordinate
+ var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
+ if ((d.startAngle+d.endAngle)/2 < Math.PI) {
+ rotateAngle -= 90;
+ } else {
+ rotateAngle += 90;
+ }
+ return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
+ } else {
+ d.outerRadius = radius + 10; // Set Outer Coordinate
+ d.innerRadius = radius + 15; // Set Inner Coordinate
+ return 'translate(' + labelsArc.centroid(d) + ')'
+ }
+ });
+
+ group.append('rect')
+ .style('stroke', '#fff')
+ .style('fill', '#fff')
+ .attr("rx", 3)
+ .attr("ry", 3);
+
+ group.append('text')
+ .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
+ .style('fill', '#000')
+
+
+ });
+
+ slices.select(".nv-label").transition()
+ .attr('transform', function(d) {
+ if (labelSunbeamLayout) {
+ d.outerRadius = arcRadius + 10; // Set Outer Coordinate
+ d.innerRadius = arcRadius + 15; // Set Inner Coordinate
+ var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
+ if ((d.startAngle+d.endAngle)/2 < Math.PI) {
+ rotateAngle -= 90;
+ } else {
+ rotateAngle += 90;
+ }
+ return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
+ } else {
+ d.outerRadius = radius + 10; // Set Outer Coordinate
+ d.innerRadius = radius + 15; // Set Inner Coordinate
+ return 'translate(' + labelsArc.centroid(d) + ')'
+ }
+ });
+
+ slices.each(function(d, i) {
+ var slice = d3.select(this);
+
+ slice
+ .select(".nv-label text")
+ .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
+ .text(function(d, i) {
+ var percent = (d.endAngle - d.startAngle) / (2 * Math.PI);
+ return Math.round(percent*1001/10)+"%";
+ /*var labelTypes = {
+ "key" : getX(d.data),
+ "value": getY(d.data),
+ "percent": d3.format('%')(percent)
+ };
+ return (d.value && percent > labelThreshold) ? labelTypes[labelType] : '';
+ */
+ });
+
+ var textBox = slice.select('text').node().getBBox();
+ slice.select(".nv-label rect")
+ .attr("width", textBox.width + 10)
+ .attr("height", textBox.height + 10)
+ .attr("transform", function() {
+ return "translate(" + [textBox.x - 5, textBox.y - 5] + ")";
+ });
+ });
+ }
+
+
+ // Computes the angle of an arc, converting from radians to degrees.
+ function angle(d) {
+ var a = (d.startAngle + d.endAngle) * 90 / Math.PI - 90;
+ return a > 90 ? a - 180 : a;
+ }
+
+ function arcTween(a) {
+ a.endAngle = isNaN(a.endAngle) ? 0 : a.endAngle;
+ a.startAngle = isNaN(a.startAngle) ? 0 : a.startAngle;
+ if (!donut) a.innerRadius = 0;
+ var i = d3.interpolate(this._current, a);
+ this._current = i(0);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+
+ function tweenPie(b) {
+ b.innerRadius = 0;
+ var i = d3.interpolate({startAngle: 0, endAngle: 0}, b);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.values = function(_) {
+ nv.log("pie.values() is no longer supported.");
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.description = function(_) {
+ if (!arguments.length) return getDescription;
+ getDescription = _;
+ return chart;
+ };
+
+ chart.showLabels = function(_) {
+ if (!arguments.length) return showLabels;
+ showLabels = _;
+ return chart;
+ };
+
+ chart.labelSunbeamLayout = function(_) {
+ if (!arguments.length) return labelSunbeamLayout;
+ labelSunbeamLayout = _;
+ return chart;
+ };
+
+ chart.donutLabelsOutside = function(_) {
+ if (!arguments.length) return donutLabelsOutside;
+ donutLabelsOutside = _;
+ return chart;
+ };
+
+ chart.pieLabelsOutside = function(_) {
+ if (!arguments.length) return pieLabelsOutside;
+ pieLabelsOutside = _;
+ return chart;
+ };
+
+ chart.labelType = function(_) {
+ if (!arguments.length) return labelType;
+ labelType = _;
+ labelType = labelType || "key";
+ return chart;
+ };
+
+ chart.donut = function(_) {
+ if (!arguments.length) return donut;
+ donut = _;
+ return chart;
+ };
+
+ chart.donutRatio = function(_) {
+ if (!arguments.length) return donutRatio;
+ donutRatio = _;
+ return chart;
+ };
+
+ chart.startAngle = function(_) {
+ if (!arguments.length) return startAngle;
+ startAngle = _;
+ return chart;
+ };
+
+ chart.endAngle = function(_) {
+ if (!arguments.length) return endAngle;
+ endAngle = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.valueFormat = function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.labelThreshold = function(_) {
+ if (!arguments.length) return labelThreshold;
+ labelThreshold = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/pieChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/pieChart.js
new file mode 100644
index 00000000..b4303fd6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/pieChart.js
@@ -0,0 +1,292 @@
+nv.models.pieChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var pie = nv.models.pie()
+ , legend = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 20, left: 20}
+ , width = null
+ , height = null
+ , showLegend = true
+ , color = nv.utils.defaultColor()
+ , tooltips = false
+ , tooltip = function(key, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , state = {}
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var tooltipLabel = pie.description()(e.point) || pie.x()(e.point)
+ var left = e.pos[0] + ( (offsetElement && offsetElement.offsetLeft) || 0 ),
+ top = e.pos[1] + ( (offsetElement && offsetElement.offsetTop) || 0),
+ y = pie.valueFormat()(pie.y()(e.point)),
+ content = tooltip(tooltipLabel, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-pieChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-pieChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-pieWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend
+ .width( availableWidth )
+ .key(pie.x());
+
+ wrap.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ pie
+ .width(availableWidth)
+ .height(availableHeight);
+
+
+ var pieWrap = g.select('.nv-pieWrap')
+ .datum([data]);
+
+ d3.transition(pieWrap).call(pie);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ /*legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });*/
+
+ pie.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ pie.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.legend = legend;
+ chart.dispatch = dispatch;
+ chart.pie = pie;
+
+ d3.rebind(chart, pie, 'valueFormat', 'values', 'x', 'y', 'description', 'id', 'showLabels', 'donutLabelsOutside', 'pieLabelsOutside', 'labelType', 'donut', 'donutRatio', 'labelThreshold');
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ pie.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatter.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatter.js
new file mode 100644
index 00000000..16cbee65
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatter.js
@@ -0,0 +1,674 @@
+
+nv.models.scatter = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // chooses color
+ , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , z = d3.scale.linear() //linear because d3.svg.shape.size is treated as area
+ , getX = function(d) { return d.x } // accessor to get the x value
+ , getY = function(d) { return d.y } // accessor to get the y value
+ , getSize = function(d) { return d.size || 1} // accessor to get the point size
+ , getShape = function(d) { return d.shape || 'circle' } // accessor to get point shape
+ , onlyCircles = true // Set to false to use shapes
+ , forceX = [] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.)
+ , forceY = [] // List of numbers to Force into the Y scale
+ , forceSize = [] // List of numbers to Force into the Size scale
+ , interactive = true // If true, plots a voronoi overlay for advanced point intersection
+ , pointKey = null
+ , pointActive = function(d) { return !d.notActive } // any points that return false will be filtered out
+ , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart
+ , padDataOuter = .1 //outerPadding to imitate ordinal scale outer padding
+ , clipEdge = false // if true, masks points within x and y scale
+ , clipVoronoi = true // if true, masks each point with a circle... can turn off to slightly increase performance
+ , clipRadius = function() { return 25 } // function to get the radius for voronoi point clips
+ , xDomain = null // Override x domain (skips the calculation from data)
+ , yDomain = null // Override y domain
+ , xRange = null // Override x range
+ , yRange = null // Override y range
+ , sizeDomain = null // Override point size domain
+ , sizeRange = null
+ , singlePoint = false
+ , dispatch = d3.dispatch('elementClick', 'elementMouseover', 'elementMouseout')
+ , useVoronoi = true
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0, z0 // used to store previous scales
+ , timeoutID
+ , needsUpdate = false // Flag for when the points are visually updating, but the interactive layer is behind, to disable tooltips
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain && sizeDomain) ? [] : // if we know xDomain and yDomain and sizeDomain, no need to calculate.... if Size is constant remember to set sizeDomain to speed up performance
+ d3.merge(
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), size: getSize(d,i) }
+ })
+ })
+ );
+
+ x .domain(xDomain || d3.extent(seriesData.map(function(d) { return d.x; }).concat(forceX)))
+
+ if (padData && data[0])
+ x.range(xRange || [(availableWidth * padDataOuter + availableWidth) / (2 *data[0].values.length), availableWidth - availableWidth * (1 + padDataOuter) / (2 * data[0].values.length) ]);
+ //x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(seriesData.map(function(d) { return d.y }).concat(forceY)))
+ .range(yRange || [availableHeight, 0]);
+
+ z .domain(sizeDomain || d3.extent(seriesData.map(function(d) { return d.size }).concat(forceSize)))
+ .range(sizeRange || [16, 256]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] - y.domain()[0] * 0.01, y.domain()[1] + y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ if ( isNaN(x.domain()[0])) {
+ x.domain([-1,1]);
+ }
+
+ if ( isNaN(y.domain()[0])) {
+ y.domain([-1,1]);
+ }
+
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+ z0 = z0 || z;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatter').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatter nv-chart-' + id + (singlePoint ? ' nv-single-point' : ''));
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+ gEnter.append('g').attr('class', 'nv-point-paths');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+ function updateInteractiveLayer() {
+
+ if (!interactive) return false;
+
+ var eventElements;
+
+ var vertices = d3.merge(data.map(function(group, groupIndex) {
+ return group.values
+ .map(function(point, pointIndex) {
+ // *Adding noise to make duplicates very unlikely
+ // *Injecting series and point index for reference
+ /* *Adding a 'jitter' to the points, because there's an issue in d3.geom.voronoi.
+ */
+ var pX = getX(point,pointIndex);
+ var pY = getY(point,pointIndex);
+
+ return [x(pX)+ Math.random() * 1e-7,
+ y(pY)+ Math.random() * 1e-7,
+ groupIndex,
+ pointIndex, point]; //temp hack to add noise untill I think of a better way so there are no duplicates
+ })
+ .filter(function(pointArray, pointIndex) {
+ return pointActive(pointArray[4], pointIndex); // Issue #237.. move filter to after map, so pointIndex is correct!
+ })
+ })
+ );
+
+
+
+ //inject series and point index for reference into voronoi
+ if (useVoronoi === true) {
+
+ if (clipVoronoi) {
+ var pointClipsEnter = wrap.select('defs').selectAll('.nv-point-clips')
+ .data([id])
+ .enter();
+
+ pointClipsEnter.append('clipPath')
+ .attr('class', 'nv-point-clips')
+ .attr('id', 'nv-points-clip-' + id);
+
+ var pointClips = wrap.select('#nv-points-clip-' + id).selectAll('circle')
+ .data(vertices);
+ pointClips.enter().append('circle')
+ .attr('r', clipRadius);
+ pointClips.exit().remove();
+ pointClips
+ .attr('cx', function(d) { return d[0] })
+ .attr('cy', function(d) { return d[1] });
+
+ wrap.select('.nv-point-paths')
+ .attr('clip-path', 'url(#nv-points-clip-' + id + ')');
+ }
+
+
+ if(vertices.length) {
+ // Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work
+ vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]);
+ vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]);
+ vertices.push([x.range()[0] - 20, y.range()[0] + 20, null, null]);
+ vertices.push([x.range()[1] + 20, y.range()[1] - 20, null, null]);
+ }
+
+ var bounds = d3.geom.polygon([
+ [-10,-10],
+ [-10,height + 10],
+ [width + 10,height + 10],
+ [width + 10,-10]
+ ]);
+
+ var voronoi = d3.geom.voronoi(vertices).map(function(d, i) {
+ return {
+ 'data': bounds.clip(d),
+ 'series': vertices[i][2],
+ 'point': vertices[i][3]
+ }
+ });
+
+
+ var pointPaths = wrap.select('.nv-point-paths').selectAll('path')
+ .data(voronoi);
+ pointPaths.enter().append('path')
+ .attr('class', function(d,i) { return 'nv-path-'+i; });
+ pointPaths.exit().remove();
+ pointPaths
+ .attr('d', function(d) {
+ if (d.data.length === 0)
+ return 'M 0 0'
+ else
+ return 'M' + d.data.join('L') + 'Z';
+ });
+
+ var mouseEventCallback = function(d,mDispatch) {
+ if (needsUpdate) return 0;
+ var series = data[d.series];
+ if (typeof series === 'undefined') return;
+
+ var point = series.values[d.point];
+
+ mDispatch({
+ point: point,
+ series: series,
+ pos: [x(getX(point, d.point)) + margin.left, y(getY(point, d.point)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: d.point
+ });
+ };
+
+ pointPaths
+ .on('click', function(d) {
+ mouseEventCallback(d, dispatch.elementClick);
+ })
+ .on('mouseover', function(d) {
+ mouseEventCallback(d, dispatch.elementMouseover);
+ })
+ .on('mouseout', function(d, i) {
+ mouseEventCallback(d, dispatch.elementMouseout);
+ });
+
+
+ } else {
+ /*
+ // bring data in form needed for click handlers
+ var dataWithPoints = vertices.map(function(d, i) {
+ return {
+ 'data': d,
+ 'series': vertices[i][2],
+ 'point': vertices[i][3]
+ }
+ });
+ */
+
+ // add event handlers to points instead voronoi paths
+ wrap.select('.nv-groups').selectAll('.nv-group')
+ .selectAll('.nv-point')
+ //.data(dataWithPoints)
+ //.style('pointer-events', 'auto') // recativate events, disabled by css
+ .on('click', function(d,i) {
+ //nv.log('test', d, i);
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementClick({
+ point: point,
+ series: series,
+ pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ })
+ .on('mouseover', function(d,i) {
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementMouseover({
+ point: point,
+ series: series,
+ pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ })
+ .on('mouseout', function(d,i) {
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementMouseout({
+ point: point,
+ series: series,
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ });
+ }
+
+ needsUpdate = false;
+ }
+
+ needsUpdate = true;
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit()
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover });
+ groups
+ .transition()
+ .style('fill', function(d,i) { return color(d, i) })
+ .style('stroke', function(d,i) { return color(d, i) })
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .5);
+
+
+ if (onlyCircles) {
+
+ var points = groups.selectAll('circle.nv-point')
+ .data(function(d) { return d.values }, pointKey);
+ points.enter().append('circle')
+ .style('fill', function (d,i) { return d.color })
+ .style('stroke', function (d,i) { return d.color })
+ .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) })
+ .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) })
+ .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) });
+ points.exit().remove();
+ groups.exit().selectAll('path.nv-point').transition()
+ .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ .remove();
+ points.each(function(d,i) {
+ d3.select(this)
+ .classed('nv-point', true)
+ .classed('nv-point-' + i, true)
+ .classed('hover',false)
+ ;
+ });
+ points.transition()
+ .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) });
+
+ } else {
+
+ var points = groups.selectAll('path.nv-point')
+ .data(function(d) { return d.values });
+ points.enter().append('path')
+ .style('fill', function (d,i) { return d.color })
+ .style('stroke', function (d,i) { return d.color })
+ .attr('transform', function(d,i) {
+ return 'translate(' + x0(getX(d,i)) + ',' + y0(getY(d,i)) + ')'
+ })
+ .attr('d',
+ d3.svg.symbol()
+ .type(getShape)
+ .size(function(d,i) { return z(getSize(d,i)) })
+ );
+ points.exit().remove();
+ groups.exit().selectAll('path.nv-point')
+ .transition()
+ .attr('transform', function(d,i) {
+ return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
+ })
+ .remove();
+ points.each(function(d,i) {
+ d3.select(this)
+ .classed('nv-point', true)
+ .classed('nv-point-' + i, true)
+ .classed('hover',false)
+ ;
+ });
+ points.transition()
+ .attr('transform', function(d,i) {
+ //nv.log(d,i,getX(d,i), x(getX(d,i)));
+ return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
+ })
+ .attr('d',
+ d3.svg.symbol()
+ .type(getShape)
+ .size(function(d,i) { return z(getSize(d,i)) })
+ );
+ }
+
+
+ // Delay updating the invisible interactive layer for smoother animation
+ clearTimeout(timeoutID); // stop repeat calls to updateInteractiveLayer
+ timeoutID = setTimeout(updateInteractiveLayer, 300);
+ //updateInteractiveLayer();
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+ z0 = z.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+ chart.clearHighlights = function() {
+ //Remove the 'hover' class from all highlighted points.
+ d3.selectAll(".nv-chart-" + id + " .nv-point.hover").classed("hover",false);
+ };
+
+ chart.highlightPoint = function(seriesIndex,pointIndex,isHoverOver) {
+ d3.select(".nv-chart-" + id + " .nv-series-" + seriesIndex + " .nv-point-" + pointIndex)
+ .classed("hover",isHoverOver);
+ };
+
+
+ dispatch.on('elementMouseover.point', function(d) {
+ if (interactive) chart.highlightPoint(d.seriesIndex,d.pointIndex,true);
+ });
+
+ dispatch.on('elementMouseout.point', function(d) {
+ if (interactive) chart.highlightPoint(d.seriesIndex,d.pointIndex,false);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.size = function(_) {
+ if (!arguments.length) return getSize;
+ getSize = d3.functor(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.zScale = function(_) {
+ if (!arguments.length) return z;
+ z = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.sizeDomain = function(_) {
+ if (!arguments.length) return sizeDomain;
+ sizeDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.sizeRange = function(_) {
+ if (!arguments.length) return sizeRange;
+ sizeRange = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.forceSize = function(_) {
+ if (!arguments.length) return forceSize;
+ forceSize = _;
+ return chart;
+ };
+
+ chart.interactive = function(_) {
+ if (!arguments.length) return interactive;
+ interactive = _;
+ return chart;
+ };
+
+ chart.pointKey = function(_) {
+ if (!arguments.length) return pointKey;
+ pointKey = _;
+ return chart;
+ };
+
+ chart.pointActive = function(_) {
+ if (!arguments.length) return pointActive;
+ pointActive = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.padDataOuter = function(_) {
+ if (!arguments.length) return padDataOuter;
+ padDataOuter = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.clipVoronoi= function(_) {
+ if (!arguments.length) return clipVoronoi;
+ clipVoronoi = _;
+ return chart;
+ };
+
+ chart.useVoronoi= function(_) {
+ if (!arguments.length) return useVoronoi;
+ useVoronoi = _;
+ if (useVoronoi === false) {
+ clipVoronoi = false;
+ }
+ return chart;
+ };
+
+ chart.clipRadius = function(_) {
+ if (!arguments.length) return clipRadius;
+ clipRadius = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.shape = function(_) {
+ if (!arguments.length) return getShape;
+ getShape = _;
+ return chart;
+ };
+
+ chart.onlyCircles = function(_) {
+ if (!arguments.length) return onlyCircles;
+ onlyCircles = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.singlePoint = function(_) {
+ if (!arguments.length) return singlePoint;
+ singlePoint = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatterChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatterChart.js
new file mode 100644
index 00000000..65b6e387
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatterChart.js
@@ -0,0 +1,628 @@
+nv.models.scatterChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , distX = nv.models.distribution()
+ , distY = nv.models.distribution()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 75}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale()
+ , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale()
+ , xPadding = 0
+ , yPadding = 0
+ , showDistX = false
+ , showDistY = false
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , showControls = !!d3.fisheye
+ , fisheye = 0
+ , pauseFisheye = false
+ , tooltips = true
+ , tooltipX = function(key, x, y) { return '<strong>' + x + '</strong>' }
+ , tooltipY = function(key, x, y) { return '<strong>' + y + '</strong>' }
+ , tooltip = null
+ , state = {}
+ , defaultState = null
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , noData = "No Data Available."
+ , transitionDuration = 250
+ ;
+
+ scatter
+ .xScale(x)
+ .yScale(y)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(10)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ .tickPadding(10)
+ ;
+ distX
+ .axis('x')
+ ;
+ distY
+ .axis('y')
+ ;
+
+ controls.updateState(false);
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ var showTooltip = function(e, offsetElement) {
+ //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?)
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0),
+ leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ),
+ topY = e.pos[1] + ( offsetElement.offsetTop || 0),
+ xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)),
+ yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex));
+
+ if( tooltipX != null )
+ nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip');
+ if( tooltipY != null )
+ nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip');
+ if( tooltip != null )
+ nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ var controlsData = [
+ { key: 'Magnify', disabled: true }
+ ];
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id());
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ // background for pointer events
+ gEnter.append('rect').attr('class', 'nvd3 nv-background');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+ gEnter.append('g').attr('class', 'nv-distWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ var legendWidth = (showControls) ? availableWidth / 2 : availableWidth;
+ legend.width(legendWidth);
+
+ wrap.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth - legendWidth) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ controls.width(180).color(['#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+ if (xPadding !== 0)
+ scatter.xDomain(null);
+
+ if (yPadding !== 0)
+ scatter.yDomain(null);
+
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+ //Adjust for x and y padding
+ if (xPadding !== 0) {
+ var xRange = x.domain()[1] - x.domain()[0];
+ scatter.xDomain([x.domain()[0] - (xPadding * xRange), x.domain()[1] + (xPadding * xRange)]);
+ }
+
+ if (yPadding !== 0) {
+ var yRange = y.domain()[1] - y.domain()[0];
+ scatter.yDomain([y.domain()[0] - (yPadding * yRange), y.domain()[1] + (yPadding * yRange)]);
+ }
+
+ //Only need to update the scatter again if x/yPadding changed the domain.
+ if (yPadding !== 0 || xPadding !== 0) {
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( xAxis.ticks() && xAxis.ticks().length ? xAxis.ticks() : availableWidth / 100 )
+ .tickSize( -availableHeight , 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .call(xAxis);
+
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( yAxis.ticks() && yAxis.ticks().length ? yAxis.ticks() : availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .call(yAxis);
+ }
+
+
+ if (showDistX) {
+ distX
+ .getData(scatter.x())
+ .scale(x)
+ .width(availableWidth)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionX');
+ g.select('.nv-distributionX')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ }
+
+ if (showDistY) {
+ distY
+ .getData(scatter.y())
+ .scale(y)
+ .width(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionY');
+ g.select('.nv-distributionY')
+ .attr('transform',
+ 'translate(' + (rightAlignYAxis ? availableWidth : -distY.size() ) + ',0)')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+ //------------------------------------------------------------
+
+
+
+
+ if (d3.fisheye) {
+ g.select('.nv-background')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g.select('.nv-background').on('mousemove', updateFisheye);
+ g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;});
+ scatter.dispatch.on('elementClick.freezeFisheye', function() {
+ pauseFisheye = !pauseFisheye;
+ });
+ }
+
+
+ function updateFisheye() {
+ if (pauseFisheye) {
+ g.select('.nv-point-paths').style('pointer-events', 'all');
+ return false;
+ }
+
+ g.select('.nv-point-paths').style('pointer-events', 'none' );
+
+ var mouse = d3.mouse(this);
+ x.distortion(fisheye).focus(mouse[0]);
+ y.distortion(fisheye).focus(mouse[1]);
+
+ g.select('.nv-scatterWrap')
+ .call(scatter);
+
+ if (showXAxis)
+ g.select('.nv-x.nv-axis').call(xAxis);
+
+ if (showYAxis)
+ g.select('.nv-y.nv-axis').call(yAxis);
+
+ g.select('.nv-distributionX')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ g.select('.nv-distributionY')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ fisheye = d.disabled ? 0 : 2.5;
+ g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all');
+ g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' );
+
+ if (d.disabled) {
+ x.distortion(fisheye).focus(0);
+ y.distortion(fisheye).focus(0);
+
+ g.select('.nv-scatterWrap').call(scatter);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ } else {
+ pauseFisheye = false;
+ }
+
+ chart.update();
+ });
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state.disabled = newState.disabled;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', function(d,i) { return e.pos[1] - availableHeight;});
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', e.pos[0] + distX.size());
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', 0);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', distY.size());
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.distX = distX;
+ chart.distY = distY;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ distX.color(color);
+ distY.color(color);
+ return chart;
+ };
+
+ chart.showDistX = function(_) {
+ if (!arguments.length) return showDistX;
+ showDistX = _;
+ return chart;
+ };
+
+ chart.showDistY = function(_) {
+ if (!arguments.length) return showDistY;
+ showDistY = _;
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+
+ chart.fisheye = function(_) {
+ if (!arguments.length) return fisheye;
+ fisheye = _;
+ return chart;
+ };
+
+ chart.xPadding = function(_) {
+ if (!arguments.length) return xPadding;
+ xPadding = _;
+ return chart;
+ };
+
+ chart.yPadding = function(_) {
+ if (!arguments.length) return yPadding;
+ yPadding = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltipXContent = function(_) {
+ if (!arguments.length) return tooltipX;
+ tooltipX = _;
+ return chart;
+ };
+
+ chart.tooltipYContent = function(_) {
+ if (!arguments.length) return tooltipY;
+ tooltipY = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatterPlusLineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatterPlusLineChart.js
new file mode 100644
index 00000000..23c87853
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatterPlusLineChart.js
@@ -0,0 +1,620 @@
+
+nv.models.scatterPlusLineChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , distX = nv.models.distribution()
+ , distY = nv.models.distribution()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 75}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale()
+ , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale()
+ , showDistX = false
+ , showDistY = false
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , showControls = !!d3.fisheye
+ , fisheye = 0
+ , pauseFisheye = false
+ , tooltips = true
+ , tooltipX = function(key, x, y) { return '<strong>' + x + '</strong>' }
+ , tooltipY = function(key, x, y) { return '<strong>' + y + '</strong>' }
+ , tooltip = function(key, x, y, date) { return '<h3>' + key + '</h3>'
+ + '<p>' + date + '</p>' }
+ , state = {}
+ , defaultState = null
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , noData = "No Data Available."
+ , transitionDuration = 250
+ ;
+
+ scatter
+ .xScale(x)
+ .yScale(y)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(10)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ .tickPadding(10)
+ ;
+ distX
+ .axis('x')
+ ;
+ distY
+ .axis('y')
+ ;
+
+ controls.updateState(false);
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ var showTooltip = function(e, offsetElement) {
+ //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?)
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0),
+ leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ),
+ topY = e.pos[1] + ( offsetElement.offsetTop || 0),
+ xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)),
+ yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex));
+
+ if( tooltipX != null )
+ nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip');
+ if( tooltipY != null )
+ nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip');
+ if( tooltip != null )
+ nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e.point.tooltip, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ var controlsData = [
+ { key: 'Magnify', disabled: true }
+ ];
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id());
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ // background for pointer events
+ gEnter.append('rect').attr('class', 'nvd3 nv-background').style("pointer-events","none");
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+ gEnter.append('g').attr('class', 'nv-regressionLinesWrap');
+ gEnter.append('g').attr('class', 'nv-distWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ wrap.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ controls.width(180).color(['#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+ wrap.select('.nv-regressionLinesWrap')
+ .attr('clip-path', 'url(#nv-edge-clip-' + scatter.id() + ')');
+
+ var regWrap = wrap.select('.nv-regressionLinesWrap').selectAll('.nv-regLines')
+ .data(function(d) {return d });
+
+ regWrap.enter().append('g').attr('class', 'nv-regLines');
+
+ var regLine = regWrap.selectAll('.nv-regLine').data(function(d){return [d]});
+ var regLineEnter = regLine.enter()
+ .append('line').attr('class', 'nv-regLine')
+ .style('stroke-opacity', 0);
+
+ regLine
+ .transition()
+ .attr('x1', x.range()[0])
+ .attr('x2', x.range()[1])
+ .attr('y1', function(d,i) {return y(x.domain()[0] * d.slope + d.intercept) })
+ .attr('y2', function(d,i) { return y(x.domain()[1] * d.slope + d.intercept) })
+ .style('stroke', function(d,i,j) { return color(d,j) })
+ .style('stroke-opacity', function(d,i) {
+ return (d.disabled || typeof d.slope === 'undefined' || typeof d.intercept === 'undefined') ? 0 : 1
+ });
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( xAxis.ticks() ? xAxis.ticks() : availableWidth / 100 )
+ .tickSize( -availableHeight , 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( yAxis.ticks() ? yAxis.ticks() : availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .call(yAxis);
+ }
+
+
+ if (showDistX) {
+ distX
+ .getData(scatter.x())
+ .scale(x)
+ .width(availableWidth)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionX');
+ g.select('.nv-distributionX')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ }
+
+ if (showDistY) {
+ distY
+ .getData(scatter.y())
+ .scale(y)
+ .width(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionY');
+ g.select('.nv-distributionY')
+ .attr('transform', 'translate(' + (rightAlignYAxis ? availableWidth : -distY.size() ) + ',0)')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+ //------------------------------------------------------------
+
+
+
+
+ if (d3.fisheye) {
+ g.select('.nv-background')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight)
+ ;
+
+ g.select('.nv-background').on('mousemove', updateFisheye);
+ g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;});
+ scatter.dispatch.on('elementClick.freezeFisheye', function() {
+ pauseFisheye = !pauseFisheye;
+ });
+ }
+
+
+ function updateFisheye() {
+ if (pauseFisheye) {
+ g.select('.nv-point-paths').style('pointer-events', 'all');
+ return false;
+ }
+
+ g.select('.nv-point-paths').style('pointer-events', 'none' );
+
+ var mouse = d3.mouse(this);
+ x.distortion(fisheye).focus(mouse[0]);
+ y.distortion(fisheye).focus(mouse[1]);
+
+ g.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+ if (showXAxis)
+ g.select('.nv-x.nv-axis').call(xAxis);
+
+ if (showYAxis)
+ g.select('.nv-y.nv-axis').call(yAxis);
+
+ g.select('.nv-distributionX')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ g.select('.nv-distributionY')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ fisheye = d.disabled ? 0 : 2.5;
+ g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all');
+ g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' );
+
+ if (d.disabled) {
+ x.distortion(fisheye).focus(0);
+ y.distortion(fisheye).focus(0);
+
+ g.select('.nv-scatterWrap').call(scatter);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ } else {
+ pauseFisheye = false;
+ }
+
+ chart.update();
+ });
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', e.pos[1] - availableHeight);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', e.pos[0] + distX.size());
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', 0);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', distY.size());
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.distX = distX;
+ chart.distY = distY;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ distX.color(color);
+ distY.color(color);
+ return chart;
+ };
+
+ chart.showDistX = function(_) {
+ if (!arguments.length) return showDistX;
+ showDistX = _;
+ return chart;
+ };
+
+ chart.showDistY = function(_) {
+ if (!arguments.length) return showDistY;
+ showDistY = _;
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.fisheye = function(_) {
+ if (!arguments.length) return fisheye;
+ fisheye = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltipXContent = function(_) {
+ if (!arguments.length) return tooltipX;
+ tooltipX = _;
+ return chart;
+ };
+
+ chart.tooltipYContent = function(_) {
+ if (!arguments.length) return tooltipY;
+ tooltipY = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/sparkline.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/sparkline.js
new file mode 100644
index 00000000..e4c2e87b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/sparkline.js
@@ -0,0 +1,194 @@
+
+nv.models.sparkline = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 2, right: 0, bottom: 2, left: 0}
+ , width = 400
+ , height = 32
+ , animate = true
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.getColor(['#000'])
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data, getX ))
+ .range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(data, getY ))
+ .range(yRange || [availableHeight, 0]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-sparkline').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparkline');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
+
+ //------------------------------------------------------------
+
+
+ var paths = wrap.selectAll('path')
+ .data(function(d) { return [d] });
+ paths.enter().append('path');
+ paths.exit().remove();
+ paths
+ .style('stroke', function(d,i) { return d.color || color(d, i) })
+ .attr('d', d3.svg.line()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ );
+
+
+ // TODO: Add CURRENT data point (Need Min, Mac, Current / Most recent)
+ var points = wrap.selectAll('circle.nv-point')
+ .data(function(data) {
+ var yValues = data.map(function(d, i) { return getY(d,i); });
+ function pointIndex(index) {
+ if (index != -1) {
+ var result = data[index];
+ result.pointIndex = index;
+ return result;
+ } else {
+ return null;
+ }
+ }
+ var maxPoint = pointIndex(yValues.lastIndexOf(y.domain()[1])),
+ minPoint = pointIndex(yValues.indexOf(y.domain()[0])),
+ currentPoint = pointIndex(yValues.length - 1);
+ return [minPoint, maxPoint, currentPoint].filter(function (d) {return d != null;});
+ });
+ points.enter().append('circle');
+ points.exit().remove();
+ points
+ .attr('cx', function(d,i) { return x(getX(d,d.pointIndex)) })
+ .attr('cy', function(d,i) { return y(getY(d,d.pointIndex)) })
+ .attr('r', 2)
+ .attr('class', function(d,i) {
+ return getX(d, d.pointIndex) == x.domain()[1] ? 'nv-point nv-currentValue' :
+ getY(d, d.pointIndex) == y.domain()[0] ? 'nv-point nv-minValue' : 'nv-point nv-maxValue'
+ });
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.animate = function(_) {
+ if (!arguments.length) return animate;
+ animate = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/sparklinePlus.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/sparklinePlus.js
new file mode 100644
index 00000000..1535f8af
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/sparklinePlus.js
@@ -0,0 +1,295 @@
+
+nv.models.sparklinePlus = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var sparkline = nv.models.sparkline();
+
+ var margin = {top: 15, right: 100, bottom: 10, left: 50}
+ , width = null
+ , height = null
+ , x
+ , y
+ , index = []
+ , paused = false
+ , xTickFormat = d3.format(',r')
+ , yTickFormat = d3.format(',.2f')
+ , showValue = true
+ , alignValue = true
+ , rightAlignValue = false
+ , noData = "No Data Available."
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ var currentValue = sparkline.y()(data[data.length-1], data.length-1);
+
+ //------------------------------------------------------------
+
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = sparkline.xScale();
+ y = sparkline.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-sparklineplus').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparklineplus');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-sparklineWrap');
+ gEnter.append('g').attr('class', 'nv-valueWrap');
+ gEnter.append('g').attr('class', 'nv-hoverArea');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ var sparklineWrap = g.select('.nv-sparklineWrap');
+
+ sparkline
+ .width(availableWidth)
+ .height(availableHeight);
+
+ sparklineWrap
+ .call(sparkline);
+
+ //------------------------------------------------------------
+
+
+ var valueWrap = g.select('.nv-valueWrap');
+
+ var value = valueWrap.selectAll('.nv-currentValue')
+ .data([currentValue]);
+
+ value.enter().append('text').attr('class', 'nv-currentValue')
+ .attr('dx', rightAlignValue ? -8 : 8)
+ .attr('dy', '.9em')
+ .style('text-anchor', rightAlignValue ? 'end' : 'start');
+
+ value
+ .attr('x', availableWidth + (rightAlignValue ? margin.right : 0))
+ .attr('y', alignValue ? function(d) { return y(d) } : 0)
+ .style('fill', sparkline.color()(data[data.length-1], data.length-1))
+ .text(yTickFormat(currentValue));
+
+
+
+ gEnter.select('.nv-hoverArea').append('rect')
+ .on('mousemove', sparklineHover)
+ .on('click', function() { paused = !paused })
+ .on('mouseout', function() { index = []; updateValueLine(); });
+ //.on('mouseout', function() { index = null; updateValueLine(); });
+
+ g.select('.nv-hoverArea rect')
+ .attr('transform', function(d) { return 'translate(' + -margin.left + ',' + -margin.top + ')' })
+ .attr('width', availableWidth + margin.left + margin.right)
+ .attr('height', availableHeight + margin.top);
+
+
+
+ function updateValueLine() { //index is currently global (within the chart), may or may not keep it that way
+ if (paused) return;
+
+ var hoverValue = g.selectAll('.nv-hoverValue').data(index)
+
+ var hoverEnter = hoverValue.enter()
+ .append('g').attr('class', 'nv-hoverValue')
+ .style('stroke-opacity', 0)
+ .style('fill-opacity', 0);
+
+ hoverValue.exit()
+ .transition().duration(250)
+ .style('stroke-opacity', 0)
+ .style('fill-opacity', 0)
+ .remove();
+
+ hoverValue
+ .attr('transform', function(d) { return 'translate(' + x(sparkline.x()(data[d],d)) + ',0)' })
+ .transition().duration(250)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', 1);
+
+ if (!index.length) return;
+
+ hoverEnter.append('line')
+ .attr('x1', 0)
+ .attr('y1', -margin.top)
+ .attr('x2', 0)
+ .attr('y2', availableHeight);
+
+
+ hoverEnter.append('text').attr('class', 'nv-xValue')
+ .attr('x', -6)
+ .attr('y', -margin.top)
+ .attr('text-anchor', 'end')
+ .attr('dy', '.9em')
+
+
+ g.select('.nv-hoverValue .nv-xValue')
+ .text(xTickFormat(sparkline.x()(data[index[0]], index[0])));
+
+ hoverEnter.append('text').attr('class', 'nv-yValue')
+ .attr('x', 6)
+ .attr('y', -margin.top)
+ .attr('text-anchor', 'start')
+ .attr('dy', '.9em')
+
+ g.select('.nv-hoverValue .nv-yValue')
+ .text(yTickFormat(sparkline.y()(data[index[0]], index[0])));
+
+ }
+
+
+ function sparklineHover() {
+ if (paused) return;
+
+ var pos = d3.mouse(this)[0] - margin.left;
+
+ function getClosestIndex(data, x) {
+ var distance = Math.abs(sparkline.x()(data[0], 0) - x);
+ var closestIndex = 0;
+ for (var i = 0; i < data.length; i++){
+ if (Math.abs(sparkline.x()(data[i], i) - x) < distance) {
+ distance = Math.abs(sparkline.x()(data[i], i) - x);
+ closestIndex = i;
+ }
+ }
+ return closestIndex;
+ }
+
+ index = [getClosestIndex(data, Math.round(x.invert(pos)))];
+
+ updateValueLine();
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.sparkline = sparkline;
+
+ d3.rebind(chart, sparkline, 'x', 'y', 'xScale', 'yScale', 'color');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xTickFormat = function(_) {
+ if (!arguments.length) return xTickFormat;
+ xTickFormat = _;
+ return chart;
+ };
+
+ chart.yTickFormat = function(_) {
+ if (!arguments.length) return yTickFormat;
+ yTickFormat = _;
+ return chart;
+ };
+
+ chart.showValue = function(_) {
+ if (!arguments.length) return showValue;
+ showValue = _;
+ return chart;
+ };
+
+ chart.alignValue = function(_) {
+ if (!arguments.length) return alignValue;
+ alignValue = _;
+ return chart;
+ };
+
+ chart.rightAlignValue = function(_) {
+ if (!arguments.length) return rightAlignValue;
+ rightAlignValue = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/stackedArea.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/stackedArea.js
new file mode 100644
index 00000000..eefeb8fb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/stackedArea.js
@@ -0,0 +1,368 @@
+
+nv.models.stackedArea = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // a function that computes the color
+ , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't selet one
+ , getX = function(d) { return d.x } // accessor to get the x value from a data point
+ , getY = function(d) { return d.y } // accessor to get the y value from a data point
+ , style = 'stack'
+ , offset = 'zero'
+ , order = 'default'
+ , interpolate = 'linear' // controls the line interpolation
+ , clipEdge = false // if true, masks lines within x and y scale
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , scatter = nv.models.scatter()
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'areaClick', 'areaMouseover', 'areaMouseout')
+ ;
+
+ scatter
+ .size(2.2) // default size
+ .sizeDomain([2.2,2.2]) // all the same size by default
+ ;
+
+ /************************************
+ * offset:
+ * 'wiggle' (stream)
+ * 'zero' (stacked)
+ * 'expand' (normalize to 100%)
+ * 'silhouette' (simple centered)
+ *
+ * order:
+ * 'inside-out' (stream)
+ * 'default' (input order)
+ ************************************/
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ //------------------------------------------------------------
+
+ var dataRaw = data;
+ // Injecting point index into each point because d3.layout.stack().out does not give index
+ data.forEach(function(aseries, i) {
+ aseries.seriesIndex = i;
+ aseries.values = aseries.values.map(function(d, j) {
+ d.index = j;
+ d.seriesIndex = i;
+ return d;
+ });
+ });
+
+ var dataFiltered = data.filter(function(series) {
+ return !series.disabled;
+ });
+
+ data = d3.layout.stack()
+ .order(order)
+ .offset(offset)
+ .values(function(d) { return d.values }) //TODO: make values customizeable in EVERY model in this fashion
+ .x(getX)
+ .y(getY)
+ .out(function(d, y0, y) {
+ var yHeight = (getY(d) === 0) ? 0 : y;
+ d.display = {
+ y: yHeight,
+ y0: y0
+ };
+ })
+ (dataFiltered);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-stackedarea').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedarea');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-areaWrap');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .x(getX)
+ .y(function(d) { return d.display.y + d.display.y0 })
+ .forceY([0])
+ .color(data.map(function(d,i) {
+ return d.color || color(d, d.seriesIndex);
+ }));
+
+
+ var scatterWrap = g.select('.nv-scatterWrap')
+ .datum(data);
+
+ scatterWrap.call(scatter);
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+ var area = d3.svg.area()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d) {
+ return y(d.display.y0)
+ })
+ .y1(function(d) {
+ return y(d.display.y + d.display.y0)
+ })
+ .interpolate(interpolate);
+
+ var zeroArea = d3.svg.area()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d) { return y(d.display.y0) })
+ .y1(function(d) { return y(d.display.y0) });
+
+
+ var path = g.select('.nv-areaWrap').selectAll('path.nv-area')
+ .data(function(d) { return d });
+
+ path.enter().append('path').attr('class', function(d,i) { return 'nv-area nv-area-' + i })
+ .attr('d', function(d,i){
+ return zeroArea(d.values, d.seriesIndex);
+ })
+ .on('mouseover', function(d,i) {
+ d3.select(this).classed('hover', true);
+ dispatch.areaMouseover({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.areaMouseout({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ .on('click', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.areaClick({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ path.exit().transition()
+ .attr('d', function(d,i) { return zeroArea(d.values,i) })
+ .remove();
+ path
+ .style('fill', function(d,i){
+ return d.color || color(d, d.seriesIndex)
+ })
+ .style('stroke', function(d,i){ return d.color || color(d, d.seriesIndex) });
+ path.transition()
+ .attr('d', function(d,i) {
+ return area(d.values,i)
+ });
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseover.area', function(e) {
+ g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', true);
+ });
+ scatter.dispatch.on('elementMouseout.area', function(e) {
+ g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', false);
+ });
+
+ //============================================================
+ //Special offset functions
+ chart.d3_stackedOffset_stackPercent = function(stackData) {
+ var n = stackData.length, //How many series
+ m = stackData[0].length, //how many points per series
+ k = 1 / n,
+ i,
+ j,
+ o,
+ y0 = [];
+
+ for (j = 0; j < m; ++j) { //Looping through all points
+ for (i = 0, o = 0; i < dataRaw.length; i++) //looping through series'
+ o += getY(dataRaw[i].values[j]) //total value of all points at a certian point in time.
+
+ if (o) for (i = 0; i < n; i++)
+ stackData[i][j][1] /= o;
+ else
+ for (i = 0; i < n; i++)
+ stackData[i][j][1] = k;
+ }
+ for (j = 0; j < m; ++j) y0[j] = 0;
+ return y0;
+ };
+
+ });
+
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementClick.area', function(e) {
+ dispatch.areaClick(e);
+ })
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ //============================================================
+
+ //============================================================
+ // Global getters and setters
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+
+ d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange',
+ 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'useVoronoi','clipRadius','highlightPoint','clearHighlights');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ }
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.offset = function(_) {
+ if (!arguments.length) return offset;
+ offset = _;
+ return chart;
+ };
+
+ chart.order = function(_) {
+ if (!arguments.length) return order;
+ order = _;
+ return chart;
+ };
+
+ //shortcut for offset + order
+ chart.style = function(_) {
+ if (!arguments.length) return style;
+ style = _;
+
+ switch (style) {
+ case 'stack':
+ chart.offset('zero');
+ chart.order('default');
+ break;
+ case 'stream':
+ chart.offset('wiggle');
+ chart.order('inside-out');
+ break;
+ case 'stream-center':
+ chart.offset('silhouette');
+ chart.order('inside-out');
+ break;
+ case 'expand':
+ chart.offset('expand');
+ chart.order('default');
+ break;
+ case 'stack_percent':
+ chart.offset(chart.d3_stackedOffset_stackPercent);
+ chart.order('default');
+ break;
+ }
+
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ interpolate = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/stackedAreaChart.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/stackedAreaChart.js
new file mode 100644
index 00000000..a036b8b0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/stackedAreaChart.js
@@ -0,0 +1,629 @@
+
+nv.models.stackedAreaChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var stacked = nv.models.stackedArea()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , interactiveLayer = nv.interactiveGuideline()
+ ;
+
+ var margin = {top: 30, right: 25, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor() // a function that takes in d, i and returns color
+ , showControls = true
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , useInteractiveGuideline = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' on ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , yAxisTickFormat = d3.format(',.2f')
+ , state = { style: stacked.style() }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = 250
+ , cData = ['Stacked','Stream','Expanded']
+ , controlLabels = {}
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ controls.updateState(false);
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(stacked.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(stacked.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = stacked.xScale();
+ y = stacked.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-stackedAreaChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedAreaChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append("rect").style("opacity",0);
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-stackedWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+ gEnter.append('g').attr('class', 'nv-interactive');
+
+ g.select("rect").attr("width",availableWidth).attr("height",availableHeight);
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ var legendWidth = (showControls) ? availableWidth - controlWidth : availableWidth;
+ legend
+ .width(legendWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth-legendWidth) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ {
+ key: controlLabels.stacked || 'Stacked',
+ metaKey: 'Stacked',
+ disabled: stacked.style() != 'stack',
+ style: 'stack'
+ },
+ {
+ key: controlLabels.stream || 'Stream',
+ metaKey: 'Stream',
+ disabled: stacked.style() != 'stream',
+ style: 'stream'
+ },
+ {
+ key: controlLabels.expanded || 'Expanded',
+ metaKey: 'Expanded',
+ disabled: stacked.style() != 'expand',
+ style: 'expand'
+ },
+ {
+ key: controlLabels.stack_percent || 'Stack %',
+ metaKey: 'Stack_Percent',
+ disabled: stacked.style() != 'stack_percent',
+ style: 'stack_percent'
+ }
+ ];
+
+ controlWidth = (cData.length/3) * 260;
+
+ controlsData = controlsData.filter(function(d) {
+ return cData.indexOf(d.metaKey) !== -1;
+ })
+
+ controls
+ .width( controlWidth )
+ .color(['#444', '#444', '#444']);
+
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .call(controls);
+
+
+ if ( margin.top != Math.max(controls.height(), legend.height()) ) {
+ margin.top = Math.max(controls.height(), legend.height());
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+
+ g.select('.nv-controlsWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ //------------------------------------------------------------
+ //Set up interactive layer
+ if (useInteractiveGuideline) {
+ interactiveLayer
+ .width(availableWidth)
+ .height(availableHeight)
+ .margin({left: margin.left, top: margin.top})
+ .svgContainer(container)
+ .xScale(x);
+ wrap.select(".nv-interactive").call(interactiveLayer);
+ }
+
+ stacked
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var stackedWrap = g.select('.nv-stackedWrap')
+ .datum(data);
+
+ stackedWrap.transition().call(stacked);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize( -availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+
+ g.select('.nv-x.nv-axis')
+ .transition().duration(0)
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks(stacked.offset() == 'wiggle' ? 0 : availableHeight / 36)
+ .tickSize(-availableWidth, 0)
+ .setTickFormat( (stacked.style() == 'expand' || stacked.style() == 'stack_percent')
+ ? d3.format('%') : yAxisTickFormat);
+
+ g.select('.nv-y.nv-axis')
+ .transition().duration(0)
+ .call(yAxis);
+ }
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ stacked.dispatch.on('areaClick.toggle', function(e) {
+ if (data.filter(function(d) { return !d.disabled }).length === 1)
+ data.forEach(function(d) {
+ d.disabled = false;
+ });
+ else
+ data.forEach(function(d,i) {
+ d.disabled = (i != e.seriesIndex);
+ });
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state.disabled = newState.disabled;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ stacked.style(d.style);
+
+
+ state.style = stacked.style();
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+
+ interactiveLayer.dispatch.on('elementMousemove', function(e) {
+ stacked.clearHighlights();
+ var singlePoint, pointIndex, pointXLocation, allData = [];
+ data
+ .filter(function(series, i) {
+ series.seriesIndex = i;
+ return !series.disabled;
+ })
+ .forEach(function(series,i) {
+ pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x());
+ stacked.highlightPoint(i, pointIndex, true);
+ var point = series.values[pointIndex];
+ if (typeof point === 'undefined') return;
+ if (typeof singlePoint === 'undefined') singlePoint = point;
+ if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex));
+
+ //If we are in 'expand' mode, use the stacked percent value instead of raw value.
+ var tooltipValue = (stacked.style() == 'expand') ? point.display.y : chart.y()(point,pointIndex);
+ allData.push({
+ key: series.key,
+ value: tooltipValue,
+ color: color(series,series.seriesIndex),
+ stackedValue: point.display
+ });
+ });
+
+ allData.reverse();
+
+ //Highlight the tooltip entry based on which stack the mouse is closest to.
+ if (allData.length > 2) {
+ var yValue = chart.yScale().invert(e.mouseY);
+ var yDistMax = Infinity, indexToHighlight = null;
+ allData.forEach(function(series,i) {
+ if ( yValue >= series.stackedValue.y0 && yValue <= (series.stackedValue.y0 + series.stackedValue.y))
+ {
+ indexToHighlight = i;
+ return;
+ }
+ });
+ if (indexToHighlight != null)
+ allData[indexToHighlight].highlight = true;
+ }
+
+ var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));
+
+ //If we are in 'expand' mode, force the format to be a percentage.
+ var valueFormatter = (stacked.style() == 'expand') ?
+ function(d,i) {return d3.format(".1%")(d);} :
+ function(d,i) {return yAxis.tickFormat()(d); };
+ interactiveLayer.tooltip
+ .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
+ .chartContainer(that.parentNode)
+ .enabled(tooltips)
+ .valueFormatter(valueFormatter)
+ .data(
+ {
+ value: xValue,
+ series: allData
+ }
+ )();
+
+ interactiveLayer.renderGuideLine(pointXLocation);
+
+ });
+
+ interactiveLayer.dispatch.on("elementMouseout",function(e) {
+ dispatch.tooltipHide();
+ stacked.clearHighlights();
+ });
+
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.style !== 'undefined') {
+ stacked.style(e.style);
+ }
+
+ chart.update();
+ });
+
+ });
+
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ stacked.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ /*
+ if (!Math.round(stacked.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+ */
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stacked.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.stacked = stacked;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.interactiveLayer = interactiveLayer;
+
+ d3.rebind(chart, stacked, 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'interactive', 'useVoronoi', 'offset', 'order', 'style', 'clipEdge', 'forceX', 'forceY', 'forceSize', 'interpolate');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ stacked.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.useInteractiveGuideline = function(_) {
+ if(!arguments.length) return useInteractiveGuideline;
+ useInteractiveGuideline = _;
+ if (_ === true) {
+ chart.interactive(false);
+ chart.useVoronoi(false);
+ }
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ chart.controlsData = function(_) {
+ if (!arguments.length) return cData;
+ cData = _;
+ return chart;
+ };
+
+ chart.controlLabels = function(_) {
+ if (!arguments.length) return controlLabels;
+ if (typeof _ !== 'object') return controlLabels;
+ controlLabels = _;
+ return chart;
+ };
+
+ yAxis.setTickFormat = yAxis.tickFormat;
+
+ yAxis.tickFormat = function(_) {
+ if (!arguments.length) return yAxisTickFormat;
+ yAxisTickFormat = _;
+ return yAxis;
+ };
+
+
+ //============================================================
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/nv.d3.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/nv.d3.js
new file mode 100644
index 00000000..78586667
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/nv.d3.js
@@ -0,0 +1,13097 @@
+(function(){
+
+var nv = window.nv || {};
+
+nv.version = '0.0.1a';
+nv.dev = true //set false when in production
+
+window.nv = nv;
+
+nv.tooltip = {}; // For the tooltip system
+nv.utils = {}; // Utility subsystem
+nv.models = {}; //stores all the possible models/components
+nv.charts = {}; //stores all the ready to use charts
+nv.graphs = []; //stores all the graphs currently on the page
+nv.logs = {}; //stores some statistics and potential error messages
+
+nv.dispatch = d3.dispatch('render_start', 'render_end');
+
+// *************************************************************************
+// Development render timers - disabled if dev = false
+
+if (nv.dev) {
+ nv.dispatch.on('render_start', function(e) {
+ nv.logs.startTime = +new Date();
+ });
+
+ nv.dispatch.on('render_end', function(e) {
+ nv.logs.endTime = +new Date();
+ nv.logs.totalTime = nv.logs.endTime - nv.logs.startTime;
+ nv.log('total', nv.logs.totalTime); // used for development, to keep track of graph generation times
+ });
+}
+
+// ********************************************
+// Public Core NV functions
+
+// Logs all arguments, and returns the last so you can test things in place
+nv.log = function() {
+ if (nv.dev && console.log && console.log.apply)
+ console.log.apply(console, arguments)
+ else if (nv.dev && console.log && Function.prototype.bind) {
+ var log = Function.prototype.bind.call(console.log, console);
+ log.apply(console, arguments);
+ }
+ return arguments[arguments.length - 1];
+};
+
+
+nv.render = function render(step) {
+ step = step || 1; // number of graphs to generate in each timeout loop
+
+ nv.render.active = true;
+ nv.dispatch.render_start();
+
+ setTimeout(function() {
+ var chart, graph;
+
+ for (var i = 0; i < step && (graph = nv.render.queue[i]); i++) {
+ chart = graph.generate();
+ if (typeof graph.callback == typeof(Function)) graph.callback(chart);
+ nv.graphs.push(chart);
+ }
+
+ nv.render.queue.splice(0, i);
+
+ if (nv.render.queue.length) setTimeout(arguments.callee, 0);
+ else { nv.render.active = false; nv.dispatch.render_end(); }
+ }, 0);
+};
+
+nv.render.active = false;
+nv.render.queue = [];
+
+nv.addGraph = function(obj) {
+ if (typeof arguments[0] === typeof(Function))
+ obj = {generate: arguments[0], callback: arguments[1]};
+
+ nv.render.queue.push(obj);
+
+ if (!nv.render.active) nv.render();
+};
+
+nv.identity = function(d) { return d; };
+
+nv.strip = function(s) { return s.replace(/(\s|&)/g,''); };
+
+function daysInMonth(month,year) {
+ return (new Date(year, month+1, 0)).getDate();
+}
+
+function d3_time_range(floor, step, number) {
+ return function(t0, t1, dt) {
+ var time = floor(t0), times = [];
+ if (time < t0) step(time);
+ if (dt > 1) {
+ while (time < t1) {
+ var date = new Date(+time);
+ if ((number(date) % dt === 0)) times.push(date);
+ step(time);
+ }
+ } else {
+ while (time < t1) { times.push(new Date(+time)); step(time); }
+ }
+ return times;
+ };
+}
+
+d3.time.monthEnd = function(date) {
+ return new Date(date.getFullYear(), date.getMonth(), 0);
+};
+
+d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) {
+ date.setUTCDate(date.getUTCDate() + 1);
+ date.setDate(daysInMonth(date.getMonth() + 1, date.getFullYear()));
+ }, function(date) {
+ return date.getMonth();
+ }
+);
+
+
+/*****
+ * A no-frills tooltip implementation.
+ *****/
+
+
+(function() {
+
+ var nvtooltip = window.nv.tooltip = {};
+
+ nvtooltip.show = function(pos, content, gravity, dist, parentContainer, classes) {
+
+ var container = document.createElement('div');
+ container.className = 'nvtooltip ' + (classes ? classes : 'xy-tooltip');
+
+ gravity = gravity || 's';
+ dist = dist || 20;
+
+ var body = parentContainer;
+ if ( !parentContainer || parentContainer.tagName.match(/g|svg/i)) {
+ //If the parent element is an SVG element, place tooltip in the <body> element.
+ body = document.getElementsByTagName('body')[0];
+ }
+
+ container.innerHTML = content;
+ container.style.left = 0;
+ container.style.top = 0;
+ container.style.opacity = 0;
+
+ body.appendChild(container);
+
+ var height = parseInt(container.offsetHeight),
+ width = parseInt(container.offsetWidth),
+ windowWidth = nv.utils.windowSize().width,
+ windowHeight = nv.utils.windowSize().height,
+ scrollTop = window.scrollY,
+ scrollLeft = window.scrollX,
+ left, top;
+
+ windowHeight = window.innerWidth >= document.body.scrollWidth ? windowHeight : windowHeight - 16;
+ windowWidth = window.innerHeight >= document.body.scrollHeight ? windowWidth : windowWidth - 16;
+
+ var tooltipTop = function ( Elem ) {
+ var offsetTop = top;
+ do {
+ if( !isNaN( Elem.offsetTop ) ) {
+ offsetTop += (Elem.offsetTop);
+ }
+ } while( Elem = Elem.offsetParent );
+ return offsetTop;
+ }
+
+ var tooltipLeft = function ( Elem ) {
+ var offsetLeft = left;
+ do {
+ if( !isNaN( Elem.offsetLeft ) ) {
+ offsetLeft += (Elem.offsetLeft);
+ }
+ } while( Elem = Elem.offsetParent );
+ return offsetLeft;
+ }
+
+ switch (gravity) {
+ case 'e':
+ left = pos[0] - width - dist;
+ top = pos[1] - (height / 2);
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = pos[0] + dist > scrollLeft ? pos[0] + dist : scrollLeft - tLeft + left;
+ if (tTop < scrollTop) top = scrollTop - tTop + top;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
+ break;
+ case 'w':
+ left = pos[0] + dist;
+ top = pos[1] - (height / 2);
+ if (tLeft + width > windowWidth) left = pos[0] - width - dist;
+ if (tTop < scrollTop) top = scrollTop + 5;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop - height - 5;
+ break;
+ case 'n':
+ left = pos[0] - (width / 2) - 5;
+ top = pos[1] + dist;
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = scrollLeft + 5;
+ if (tLeft + width > windowWidth) left = left - width/2 + 5;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
+ break;
+ case 's':
+ left = pos[0] - (width / 2);
+ top = pos[1] - height - dist;
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = scrollLeft + 5;
+ if (tLeft + width > windowWidth) left = left - width/2 + 5;
+ if (scrollTop > tTop) top = scrollTop;
+ break;
+ }
+
+
+ container.style.left = left+'px';
+ container.style.top = top+'px';
+ container.style.opacity = 1;
+ container.style.position = 'absolute'; //fix scroll bar issue
+ container.style.pointerEvents = 'none'; //fix scroll bar issue
+
+ return container;
+ };
+
+ nvtooltip.cleanup = function() {
+
+ // Find the tooltips, mark them for removal by this class (so others cleanups won't find it)
+ var tooltips = document.getElementsByClassName('nvtooltip');
+ var purging = [];
+ while(tooltips.length) {
+ purging.push(tooltips[0]);
+ tooltips[0].style.transitionDelay = '0 !important';
+ tooltips[0].style.opacity = 0;
+ tooltips[0].className = 'nvtooltip-pending-removal';
+ }
+
+
+ setTimeout(function() {
+
+ while (purging.length) {
+ var removeMe = purging.pop();
+ removeMe.parentNode.removeChild(removeMe);
+ }
+ }, 500);
+ };
+
+
+})();
+
+nv.utils.windowSize = function() {
+ // Sane defaults
+ var size = {width: 640, height: 480};
+
+ // Earlier IE uses Doc.body
+ if (document.body && document.body.offsetWidth) {
+ size.width = document.body.offsetWidth;
+ size.height = document.body.offsetHeight;
+ }
+
+ // IE can use depending on mode it is in
+ if (document.compatMode=='CSS1Compat' &&
+ document.documentElement &&
+ document.documentElement.offsetWidth ) {
+ size.width = document.documentElement.offsetWidth;
+ size.height = document.documentElement.offsetHeight;
+ }
+
+ // Most recent browsers use
+ if (window.innerWidth && window.innerHeight) {
+ size.width = window.innerWidth;
+ size.height = window.innerHeight;
+ }
+ return (size);
+};
+
+
+
+// Easy way to bind multiple functions to window.onresize
+// TODO: give a way to remove a function after its bound, other than removing all of them
+nv.utils.windowResize = function(fun){
+ var oldresize = window.onresize;
+
+ window.onresize = function(e) {
+ if (typeof oldresize == 'function') oldresize(e);
+ fun(e);
+ }
+}
+
+// Backwards compatible way to implement more d3-like coloring of graphs.
+// If passed an array, wrap it in a function which implements the old default
+// behavior
+nv.utils.getColor = function(color) {
+ if (!arguments.length) return nv.utils.defaultColor(); //if you pass in nothing, get default colors back
+
+ if( Object.prototype.toString.call( color ) === '[object Array]' )
+ return function(d, i) { return d.color || color[i % color.length]; };
+ else
+ return color;
+ //can't really help it if someone passes rubbish as color
+}
+
+// Default color chooser uses the index of an object as before.
+nv.utils.defaultColor = function() {
+ var colors = d3.scale.category20().range();
+ return function(d, i) { return d.color || colors[i % colors.length] };
+}
+
+
+// Returns a color function that takes the result of 'getKey' for each series and
+// looks for a corresponding color from the dictionary,
+nv.utils.customTheme = function(dictionary, getKey, defaultColors) {
+ getKey = getKey || function(series) { return series.key }; // use default series.key if getKey is undefined
+ defaultColors = defaultColors || d3.scale.category20().range(); //default color function
+
+ var defIndex = defaultColors.length; //current default color (going in reverse)
+
+ return function(series, index) {
+ var key = getKey(series);
+
+ if (!defIndex) defIndex = defaultColors.length; //used all the default colors, start over
+
+ if (typeof dictionary[key] !== "undefined")
+ return (typeof dictionary[key] === "function") ? dictionary[key]() : dictionary[key];
+ else
+ return defaultColors[--defIndex]; // no match in dictionary, use default color
+ }
+}
+
+
+
+// From the PJAX example on d3js.org, while this is not really directly needed
+// it's a very cool method for doing pjax, I may expand upon it a little bit,
+// open to suggestions on anything that may be useful
+nv.utils.pjax = function(links, content) {
+ d3.selectAll(links).on("click", function() {
+ history.pushState(this.href, this.textContent, this.href);
+ load(this.href);
+ d3.event.preventDefault();
+ });
+
+ function load(href) {
+ d3.html(href, function(fragment) {
+ var target = d3.select(content).node();
+ target.parentNode.replaceChild(d3.select(fragment).select(content).node(), target);
+ nv.utils.pjax(links, content);
+ });
+ }
+
+ d3.select(window).on("popstate", function() {
+ if (d3.event.state) load(d3.event.state);
+ });
+}
+
+/* For situations where we want to approximate the width in pixels for an SVG:text element.
+Most common instance is when the element is in a display:none; container.
+Forumla is : text.length * font-size * constant_factor
+*/
+nv.utils.calcApproxTextWidth = function (svgTextElem) {
+ if (svgTextElem instanceof d3.selection) {
+ var fontSize = parseInt(svgTextElem.style("font-size").replace("px",""));
+ var textLength = svgTextElem.text().length;
+
+ return textLength * fontSize * 0.5;
+ }
+ return 0;
+};
+nv.models.axis = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var axis = d3.svg.axis()
+ ;
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 75 //only used for tickLabel currently
+ , height = 60 //only used for tickLabel currently
+ , scale = d3.scale.linear()
+ , axisLabelText = null
+ , showMaxMin = true //TODO: showMaxMin should be disabled on all ordinal scaled axes
+ , highlightZero = true
+ , rotateLabels = 0
+ , rotateYLabel = true
+ , staggerLabels = false
+ , isOrdinal = false
+ , ticks = null
+ , logScale=false
+ ;
+
+ axis
+ .scale(scale)
+ .orient('bottom')
+ .tickFormat(function(d) { return d })
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var scale0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-axis').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-axis');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ //------------------------------------------------------------
+
+
+ if (ticks !== null)
+ axis.ticks(ticks);
+ else if (axis.orient() == 'top' || axis.orient() == 'bottom')
+ axis.ticks(Math.abs(scale.range()[1] - scale.range()[0]) / 100);
+
+
+ //TODO: consider calculating width/height based on whether or not label is added, for reference in charts using this component
+
+
+ d3.transition(g)
+ .call(axis);
+
+ scale0 = scale0 || axis.scale();
+
+ var fmt = axis.tickFormat();
+ if (fmt == null) {
+ fmt = scale0.tickFormat();
+ }
+
+ var axisLabel = g.selectAll('text.nv-axislabel')
+ .data([axisLabelText || null]);
+ axisLabel.exit().remove();
+ switch (axis.orient()) {
+ case 'top':
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0]));
+ axisLabel
+ .attr('text-anchor', 'middle')
+ .attr('y', 0)
+ .attr('x', w/2);
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text');
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(' + scale(d) + ',0)'
+ })
+ .select('text')
+ .attr('dy', '0em')
+ .attr('y', -axis.tickPadding())
+ .attr('text-anchor', 'middle')
+ .text(function(d,i) {
+ var v = fmt(d);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ d3.transition(axisMaxMin)
+ .attr('transform', function(d,i) {
+ return 'translate(' + scale.range()[i] + ',0)'
+ });
+ }
+ break;
+ case 'bottom':
+ var xLabelMargin = 36;
+ var maxTextWidth = 30;
+ var xTicks = g.selectAll('g').select("text");
+ if (rotateLabels%360) {
+ //Calculate the longest xTick width
+ xTicks.each(function(d,i){
+ var width = this.getBBox().width;
+ if(width > maxTextWidth) maxTextWidth = width;
+ });
+ //Convert to radians before calculating sin. Add 30 to margin for healthy padding.
+ var sin = Math.abs(Math.sin(rotateLabels*Math.PI/180));
+ var xLabelMargin = (sin ? sin*maxTextWidth : maxTextWidth)+30;
+ //Rotate all xTicks
+ xTicks
+ .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' })
+ .attr('text-anchor', rotateLabels%360 > 0 ? 'start' : 'end');
+ }
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0]));
+ axisLabel
+ .attr('text-anchor', 'middle')
+ .attr('y', xLabelMargin)
+ .attr('x', w/2);
+ if (showMaxMin) {
+ //if (showMaxMin && !isOrdinal) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ //.data(scale.domain())
+ .data([scale.domain()[0], scale.domain()[scale.domain().length - 1]]);
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text');
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)'
+ })
+ .select('text')
+ .attr('dy', '.71em')
+ .attr('y', axis.tickPadding())
+ .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' })
+ .attr('text-anchor', rotateLabels ? (rotateLabels%360 > 0 ? 'start' : 'end') : 'middle')
+ .text(function(d,i) {
+ var v = fmt(d);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ d3.transition(axisMaxMin)
+ .attr('transform', function(d,i) {
+ //return 'translate(' + scale.range()[i] + ',0)'
+ //return 'translate(' + scale(d) + ',0)'
+ return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)'
+ });
+ }
+ if (staggerLabels)
+ xTicks
+ .attr('transform', function(d,i) { return 'translate(0,' + (i % 2 == 0 ? '0' : '12') + ')' });
+
+ break;
+ case 'right':
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ axisLabel
+ .attr('text-anchor', rotateYLabel ? 'middle' : 'begin')
+ .attr('transform', rotateYLabel ? 'rotate(90)' : '')
+ .attr('y', rotateYLabel ? (-Math.max(margin.right,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart
+ .attr('x', rotateYLabel ? (scale.range()[0] / 2) : axis.tickPadding());
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text')
+ .style('opacity', 0);
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale(d) + ')'
+ })
+ .select('text')
+ .attr('dy', '.32em')
+ .attr('y', 0)
+ .attr('x', axis.tickPadding())
+ .attr('text-anchor', 'start')
+ .text(function(d,i) {
+ var v = fmt(d);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ d3.transition(axisMaxMin)
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale.range()[i] + ')'
+ })
+ .select('text')
+ .style('opacity', 1);
+ }
+ break;
+ case 'left':
+ /*
+ //For dynamically placing the label. Can be used with dynamically-sized chart axis margins
+ var yTicks = g.selectAll('g').select("text");
+ yTicks.each(function(d,i){
+ var labelPadding = this.getBBox().width + axis.tickPadding() + 16;
+ if(labelPadding > width) width = labelPadding;
+ });
+ */
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ axisLabel
+ .attr('text-anchor', rotateYLabel ? 'middle' : 'end')
+ .attr('transform', rotateYLabel ? 'rotate(-90)' : '')
+ .attr('y', rotateYLabel ? (-Math.max(margin.left,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart
+ .attr('x', rotateYLabel ? (-scale.range()[0] / 2) : -axis.tickPadding());
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text')
+ .style('opacity', 0);
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale0(d) + ')'
+ })
+ .select('text')
+ .attr('dy', '.32em')
+ .attr('y', 0)
+ .attr('x', -axis.tickPadding())
+ .attr('text-anchor', 'end')
+ .text(function(d,i) {
+ var v = fmt(d);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ d3.transition(axisMaxMin)
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale.range()[i] + ')'
+ })
+ .select('text')
+ .style('opacity', 1);
+ }
+ break;
+ }
+ axisLabel
+ .text(function(d) { return d });
+
+
+ if (showMaxMin && (axis.orient() === 'left' || axis.orient() === 'right')) {
+ //check if max and min overlap other values, if so, hide the values that overlap
+ g.selectAll('g') // the g's wrapping each tick
+ .each(function(d,i) {
+ d3.select(this).select('text').attr('opacity', 1);
+ if (scale(d) < scale.range()[1] + 10 || scale(d) > scale.range()[0] - 10) { // 10 is assuming text height is 16... if d is 0, leave it!
+ if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL
+ d3.select(this).attr('opacity', 0);
+
+ d3.select(this).select('text').attr('opacity', 0); // Don't remove the ZERO line!!
+ }
+ });
+
+ //if Max and Min = 0 only show min, Issue #281
+ if (scale.domain()[0] == scale.domain()[1] && scale.domain()[0] == 0)
+ wrap.selectAll('g.nv-axisMaxMin')
+ .style('opacity', function(d,i) { return !i ? 1 : 0 });
+
+ }
+
+ if (showMaxMin && (axis.orient() === 'top' || axis.orient() === 'bottom')) {
+ var maxMinRange = [];
+ wrap.selectAll('g.nv-axisMaxMin')
+ .each(function(d,i) {
+ try {
+ if (i) // i== 1, max position
+ maxMinRange.push(scale(d) - this.getBBox().width - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
+ else // i==0, min position
+ maxMinRange.push(scale(d) + this.getBBox().width + 4)
+ }catch (err) {
+ if (i) // i== 1, max position
+ maxMinRange.push(scale(d) - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
+ else // i==0, min position
+ maxMinRange.push(scale(d) + 4)
+ }
+ });
+ g.selectAll('g') // the g's wrapping each tick
+ .each(function(d,i) {
+ if (scale(d) < maxMinRange[0] || scale(d) > maxMinRange[1]) {
+ if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL
+ d3.select(this).remove();
+ else
+ d3.select(this).select('text').remove(); // Don't remove the ZERO line!!
+ }
+ });
+ }
+
+
+ //highlight zero line ... Maybe should not be an option and should just be in CSS?
+ if (highlightZero)
+ g.selectAll('.tick')
+ .filter(function(d) { return !parseFloat(Math.round(d.__data__*100000)/1000000) && (d.__data__ !== undefined) }) //this is because sometimes the 0 tick is a very small fraction, TODO: think of cleaner technique
+ .classed('zero', true);
+
+ //store old scales for use in transitions on update
+ scale0 = scale.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.axis = axis;
+
+ d3.rebind(chart, axis, 'orient', 'tickValues', 'tickSubdivide', 'tickSize', 'tickPadding', 'tickFormat');
+ d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands'); //these are also accessible by chart.scale(), but added common ones directly for ease of use
+
+ chart.margin = function(_) {
+ if(!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ }
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.ticks = function(_) {
+ if (!arguments.length) return ticks;
+ ticks = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.axisLabel = function(_) {
+ if (!arguments.length) return axisLabelText;
+ axisLabelText = _;
+ return chart;
+ }
+
+ chart.showMaxMin = function(_) {
+ if (!arguments.length) return showMaxMin;
+ showMaxMin = _;
+ return chart;
+ }
+
+ chart.highlightZero = function(_) {
+ if (!arguments.length) return highlightZero;
+ highlightZero = _;
+ return chart;
+ }
+
+ chart.scale = function(_) {
+ if (!arguments.length) return scale;
+ scale = _;
+ axis.scale(scale);
+ isOrdinal = typeof scale.rangeBands === 'function';
+ d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands');
+ return chart;
+ }
+
+ chart.rotateYLabel = function(_) {
+ if(!arguments.length) return rotateYLabel;
+ rotateYLabel = _;
+ return chart;
+ }
+
+ chart.rotateLabels = function(_) {
+ if(!arguments.length) return rotateLabels;
+ rotateLabels = _;
+ return chart;
+ }
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+
+ //============================================================
+
+
+ return chart;
+}
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+
+nv.models.bullet = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , orient = 'left' // TODO top & bottom
+ , reverse = false
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , forceX = [0] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.)
+ , width = 380
+ , height = 30
+ , tickFormat = null
+ , color = nv.utils.getColor(['#1f77b4'])
+ , dispatch = d3.dispatch('elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain( d3.extent(d3.merge([forceX, rangez])) )
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+
+ var rangeMin = d3.min(rangez), //rangez[2]
+ rangeMax = d3.max(rangez), //rangez[0]
+ rangeAvg = rangez[1];
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bullet').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bullet');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeMax');
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeAvg');
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeMin');
+ gEnter.append('rect').attr('class', 'nv-measure');
+ gEnter.append('path').attr('class', 'nv-markerTriangle');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+ var xp0 = function(d) { return d < 0 ? x0(d) : x0(0) },
+ xp1 = function(d) { return d < 0 ? x1(d) : x1(0) };
+
+
+ g.select('rect.nv-rangeMax')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeMax > 0 ? rangeMax : rangeMin))
+ .attr('x', xp1(rangeMax > 0 ? rangeMax : rangeMin))
+ .datum(rangeMax > 0 ? rangeMax : rangeMin)
+ /*
+ .attr('x', rangeMin < 0 ?
+ rangeMax > 0 ?
+ x1(rangeMin)
+ : x1(rangeMax)
+ : x1(0))
+ */
+
+ g.select('rect.nv-rangeAvg')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeAvg))
+ .attr('x', xp1(rangeAvg))
+ .datum(rangeAvg)
+ /*
+ .attr('width', rangeMax <= 0 ?
+ x1(rangeMax) - x1(rangeAvg)
+ : x1(rangeAvg) - x1(rangeMin))
+ .attr('x', rangeMax <= 0 ?
+ x1(rangeAvg)
+ : x1(rangeMin))
+ */
+
+ g.select('rect.nv-rangeMin')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeMax))
+ .attr('x', xp1(rangeMax))
+ .attr('width', w1(rangeMax > 0 ? rangeMin : rangeMax))
+ .attr('x', xp1(rangeMax > 0 ? rangeMin : rangeMax))
+ .datum(rangeMax > 0 ? rangeMin : rangeMax)
+ /*
+ .attr('width', rangeMax <= 0 ?
+ x1(rangeAvg) - x1(rangeMin)
+ : x1(rangeMax) - x1(rangeAvg))
+ .attr('x', rangeMax <= 0 ?
+ x1(rangeMin)
+ : x1(rangeAvg))
+ */
+
+ g.select('rect.nv-measure')
+ .style('fill', color)
+ .attr('height', availableHeight / 3)
+ .attr('y', availableHeight / 3)
+ .attr('width', measurez < 0 ?
+ x1(0) - x1(measurez[0])
+ : x1(measurez[0]) - x1(0))
+ .attr('x', xp1(measurez))
+ .on('mouseover', function() {
+ dispatch.elementMouseover({
+ value: measurez[0],
+ label: 'Current',
+ pos: [x1(measurez[0]), availableHeight/2]
+ })
+ })
+ .on('mouseout', function() {
+ dispatch.elementMouseout({
+ value: measurez[0],
+ label: 'Current'
+ })
+ })
+
+ var h3 = availableHeight / 6;
+ if (markerz[0]) {
+ g.selectAll('path.nv-markerTriangle')
+ .attr('transform', function(d) { return 'translate(' + x1(markerz[0]) + ',' + (availableHeight / 2) + ')' })
+ .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
+ .on('mouseover', function() {
+ dispatch.elementMouseover({
+ value: markerz[0],
+ label: 'Previous',
+ pos: [x1(markerz[0]), availableHeight/2]
+ })
+ })
+ .on('mouseout', function() {
+ dispatch.elementMouseout({
+ value: markerz[0],
+ label: 'Previous'
+ })
+ });
+ } else {
+ g.selectAll('path.nv-markerTriangle').remove();
+ }
+
+
+ wrap.selectAll('.nv-range')
+ .on('mouseover', function(d,i) {
+ var label = !i ? "Maximum" : i == 1 ? "Mean" : "Minimum";
+
+ dispatch.elementMouseover({
+ value: d,
+ label: label,
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ var label = !i ? "Maximum" : i == 1 ? "Mean" : "Minimum";
+
+ dispatch.elementMouseout({
+ value: d,
+ label: label
+ })
+ })
+
+/* // THIS IS THE PREVIOUS BULLET IMPLEMENTATION, WILL REMOVE SHORTLY
+ // Update the range rects.
+ var range = g.selectAll('rect.nv-range')
+ .data(rangez);
+
+ range.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-range nv-s' + i; })
+ .attr('width', w0)
+ .attr('height', availableHeight)
+ .attr('x', reverse ? x0 : 0)
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: (i <= 0) ? 'Maximum' : (i > 1) ? 'Minimum' : 'Mean', //TODO: make these labels a variable
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: (i <= 0) ? 'Minimum' : (i >=1) ? 'Maximum' : 'Mean' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(range)
+ .attr('x', reverse ? x1 : 0)
+ .attr('width', w1)
+ .attr('height', availableHeight);
+
+
+ // Update the measure rects.
+ var measure = g.selectAll('rect.nv-measure')
+ .data(measurez);
+
+ measure.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-measure nv-s' + i; })
+ .style('fill', function(d,i) { return color(d,i ) })
+ .attr('width', w0)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x0 : 0)
+ .attr('y', availableHeight / 3)
+ .on('mouseover', function(d) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Current', //TODO: make these labels a variable
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Current' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(measure)
+ .attr('width', w1)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x1 : 0)
+ .attr('y', availableHeight / 3);
+
+
+
+ // Update the marker lines.
+ var marker = g.selectAll('path.nv-markerTriangle')
+ .data(markerz);
+
+ var h3 = availableHeight / 6;
+ marker.enter().append('path')
+ .attr('class', 'nv-markerTriangle')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',' + (availableHeight / 2) + ')' })
+ .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Previous',
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Previous'
+ })
+ });
+
+ d3.transition(marker)
+ .attr('transform', function(d) { return 'translate(' + (x1(d) - x1(0)) + ',' + (availableHeight / 2) + ')' });
+
+ marker.exit().remove();
+*/
+
+ });
+
+ // d3.timer.flush(); // Not needed?
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ // left, right, top, bottom
+ chart.orient = function(_) {
+ if (!arguments.length) return orient;
+ orient = _;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(_) {
+ if (!arguments.length) return ranges;
+ ranges = _;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(_) {
+ if (!arguments.length) return markers;
+ markers = _;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(_) {
+ if (!arguments.length) return measures;
+ measures = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(_) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+nv.models.bulletChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var bullet = nv.models.bullet()
+ ;
+
+ var orient = 'left' // TODO top & bottom
+ , reverse = false
+ , margin = {top: 5, right: 40, bottom: 20, left: 120}
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , width = null
+ , height = 55
+ , tickFormat = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ) + margin.left,
+ top = e.pos[1] + ( offsetElement.offsetTop || 0) + margin.top,
+ content = tooltip(e.key, e.label, e.value, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ that = this;
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!d || !ranges.call(this, d, i)) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', 18 + margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bulletChart').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bulletChart');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-bulletWrap');
+ gEnter.append('g').attr('class', 'nv-titles');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) // TODO: need to allow forceX and forceY, and xDomain, yDomain
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+ /*
+ // Derive width-scales from the x-scales.
+ var w0 = bulletWidth(x0),
+ w1 = bulletWidth(x1);
+
+ function bulletWidth(x) {
+ var x0 = x(0);
+ return function(d) {
+ return Math.abs(x(d) - x(0));
+ };
+ }
+
+ function bulletTranslate(x) {
+ return function(d) {
+ return 'translate(' + x(d) + ',0)';
+ };
+ }
+ */
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+
+
+ var title = gEnter.select('.nv-titles').append('g')
+ .attr('text-anchor', 'end')
+ .attr('transform', 'translate(-6,' + (height - margin.top - margin.bottom) / 2 + ')');
+ title.append('text')
+ .attr('class', 'nv-title')
+ .text(function(d) { return d.title; });
+
+ title.append('text')
+ .attr('class', 'nv-subtitle')
+ .attr('dy', '1em')
+ .text(function(d) { return d.subtitle; });
+
+
+
+ bullet
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var bulletWrap = g.select('.nv-bulletWrap');
+
+ d3.transition(bulletWrap).call(bullet);
+
+
+
+ // Compute the tick format.
+ var format = tickFormat || x1.tickFormat( availableWidth / 100 );
+
+ // Update the tick groups.
+ var tick = g.selectAll('g.nv-tick')
+ .data(x1.ticks( availableWidth / 50 ), function(d) {
+ return this.textContent || format(d);
+ });
+
+ // Initialize the ticks with the old scale, x0.
+ var tickEnter = tick.enter().append('g')
+ .attr('class', 'nv-tick')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',0)' })
+ .style('opacity', 1e-6);
+
+ tickEnter.append('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickEnter.append('text')
+ .attr('text-anchor', 'middle')
+ .attr('dy', '1em')
+ .attr('y', availableHeight * 7 / 6)
+ .text(format);
+
+
+ // Transition the updating ticks to the new scale, x1.
+ var tickUpdate = d3.transition(tick)
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1);
+
+ tickUpdate.select('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickUpdate.select('text')
+ .attr('y', availableHeight * 7 / 6);
+
+ // Transition the exiting ticks to the new scale, x1.
+ d3.transition(tick.exit())
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1e-6)
+ .remove();
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('tooltipShow', function(e) {
+ e.key = d.title;
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+ });
+
+ d3.timer.flush();
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ bullet.dispatch.on('elementMouseover.tooltip', function(e) {
+ dispatch.tooltipShow(e);
+ });
+
+ bullet.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.bullet = bullet;
+
+ d3.rebind(chart, bullet, 'color');
+
+ // left, right, top, bottom
+ chart.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(x) {
+ if (!arguments.length) return ranges;
+ ranges = x;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(x) {
+ if (!arguments.length) return markers;
+ markers = x;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(x) {
+ if (!arguments.length) return measures;
+ measures = x;
+ return chart;
+ };
+
+ chart.width = function(x) {
+ if (!arguments.length) return width;
+ width = x;
+ return chart;
+ };
+
+ chart.height = function(x) {
+ if (!arguments.length) return height;
+ height = x;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = x;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
+
+nv.models.cumulativeLineChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 50, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = true
+ , tooltips = true
+ , showControls = true
+ , rescaleY = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , id = lines.id()
+ , state = { index: 0, rescaleY: rescaleY }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , average = function(d) { return d.average }
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient('left')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var dx = d3.scale.linear()
+ , index = {i: 0, x: 0}
+ ;
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+/*
+ //Moved to see if we can get better behavior to fix issue #315
+ var indexDrag = d3.behavior.drag()
+ .on('dragstart', dragStart)
+ .on('drag', dragMove)
+ .on('dragend', dragEnd);
+
+ function dragStart(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'ew-resize');
+ }
+
+ function dragMove(d,i) {
+ d.x += d3.event.dx;
+ d.i = Math.round(dx.invert(d.x));
+
+ d3.select(this).attr('transform', 'translate(' + dx(d.i) + ',0)');
+ chart.update();
+ }
+
+ function dragEnd(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'auto');
+ chart.update();
+ }
+*/
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this).classed('nv-chart-' + id, true),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { container.transition().call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ var indexDrag = d3.behavior.drag()
+ .on('dragstart', dragStart)
+ .on('drag', dragMove)
+ .on('dragend', dragEnd);
+
+
+ function dragStart(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'ew-resize');
+ }
+
+ function dragMove(d,i) {
+ index.x = d3.event.x;
+ index.i = Math.round(dx.invert(index.x));
+ updateZero();
+ }
+
+ function dragEnd(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'auto');
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+ }
+
+
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+
+
+ if (!rescaleY) {
+ var seriesDomains = data
+ .filter(function(series) { return !series.disabled })
+ .map(function(series,i) {
+ var initialDomain = d3.extent(series.values, lines.y());
+
+ //account for series being disabled when losing 95% or more
+ if (initialDomain[0] < -.95) initialDomain[0] = -.95;
+
+ return [
+ (initialDomain[0] - initialDomain[1]) / (1 + initialDomain[1]),
+ (initialDomain[1] - initialDomain[0]) / (1 + initialDomain[0])
+ ];
+ });
+
+ var completeDomain = [
+ d3.min(seriesDomains, function(d) { return d[0] }),
+ d3.max(seriesDomains, function(d) { return d[1] })
+ ]
+
+ lines.yDomain(completeDomain);
+ } else {
+ lines.yDomain(null);
+ }
+
+
+ dx .domain([0, data[0].values.length - 1]) //Assumes all series have same length
+ .range([0, availableWidth])
+ .clamp(true);
+
+ //------------------------------------------------------------
+
+
+ var data = indexify(index.i, data);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-cumulativeLine').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-cumulativeLine').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-background');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-avgLinesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Re-scale y-axis', disabled: !rescaleY }
+ ];
+
+ controls.width(140).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ // Show error if series goes below 100%
+ var tempDisabled = data.filter(function(d) { return d.tempDisabled });
+
+ wrap.select('.tempDisabled').remove(); //clean-up and prevent duplicates
+ if (tempDisabled.length) {
+ wrap.append('text').attr('class', 'tempDisabled')
+ .attr('x', availableWidth / 2)
+ .attr('y', '-.71em')
+ .style('text-anchor', 'end')
+ .text(tempDisabled.map(function(d) { return d.key }).join(', ') + ' values cannot be calculated for this time period.');
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ gEnter.select('.nv-background')
+ .append('rect');
+
+ g.select('.nv-background rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ lines
+ //.x(function(d) { return d.x })
+ .y(function(d) { return d.display.y })
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].tempDisabled; }));
+
+
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled && !d.tempDisabled }));
+
+ //d3.transition(linesWrap).call(lines);
+ linesWrap.call(lines);
+
+ /*Handle average lines [AN-612] ----------------------------*/
+
+ //Store a series index number in the data array.
+ data.forEach(function(d,i) {
+ d.seriesIndex = i;
+ });
+
+ var avgLineData = data.filter(function(d) {
+ return !d.disabled && !!average(d);
+ });
+
+ var avgLines = g.select(".nv-avgLinesWrap").selectAll("line")
+ .data(avgLineData, function(d) { return d.key; });
+
+ avgLines.enter()
+ .append('line')
+ .style('stroke-width',2)
+ .style('stroke-dasharray','10,10')
+ .style('stroke',function (d,i) {
+ return lines.color()(d,d.seriesIndex);
+ })
+ .attr('x1',0)
+ .attr('x2',availableWidth)
+ .attr('y1', function(d) { return y(average(d)); })
+ .attr('y2', function(d) { return y(average(d)); });
+
+ avgLines
+ .attr('x1',0)
+ .attr('x2',availableWidth)
+ .attr('y1', function(d) { return y(average(d)); })
+ .attr('y2', function(d) { return y(average(d)); });
+
+ avgLines.exit().remove();
+
+ //Create index line -----------------------------------------
+
+ var indexLine = linesWrap.selectAll('.nv-indexLine')
+ .data([index]);
+ indexLine.enter().append('rect').attr('class', 'nv-indexLine')
+ .attr('width', 3)
+ .attr('x', -2)
+ .attr('fill', 'red')
+ .attr('fill-opacity', .5)
+ .call(indexDrag)
+
+ indexLine
+ .attr('transform', function(d) { return 'translate(' + dx(d.i) + ',0)' })
+ .attr('height', availableHeight)
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ //Suggest how many ticks based on the chart width and D3 should listen (70 is the optimal number for MM/DD/YY dates)
+ .ticks( Math.min(data[0].values.length,availableWidth/70) )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+
+ function updateZero() {
+ indexLine
+ .data([index]);
+
+ container.call(chart);
+ }
+
+ g.select('.nv-background rect')
+ .on('click', function() {
+ index.x = d3.mouse(this)[0];
+ index.i = Math.round(dx.invert(index.x));
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+
+ updateZero();
+ });
+
+ lines.dispatch.on('elementClick', function(e) {
+ index.i = e.pointIndex;
+ index.x = dx(index.i);
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+
+ updateZero();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+ rescaleY = !d.disabled;
+
+ state.rescaleY = rescaleY;
+ dispatch.stateChange(state);
+
+ //selection.transition().call(chart);
+ chart.update();
+ });
+
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ //selection.transition().call(chart);
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+/*
+ //
+ legend.dispatch.on('legendMouseover', function(d, i) {
+ d.hover = true;
+ selection.transition().call(chart)
+ });
+
+ legend.dispatch.on('legendMouseout', function(d, i) {
+ d.hover = false;
+ selection.transition().call(chart)
+ });
+*/
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+
+ if (typeof e.index !== 'undefined') {
+ index.i = e.index;
+ index.x = dx(index.i);
+
+ state.index = e.index;
+
+ indexLine
+ .data([index]);
+ }
+
+
+ if (typeof e.rescaleY !== 'undefined') {
+ rescaleY = e.rescaleY;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.lines = lines;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.rescaleY = function(_) {
+ if (!arguments.length) return rescaleY;
+ rescaleY = _
+ return rescaleY;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.average = function(_) {
+ if(!arguments.length) return average;
+ average = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ /* Normalize the data according to an index point. */
+ function indexify(idx, data) {
+ return data.map(function(line, i) {
+ if (!line.values) {
+ return line;
+ }
+ var v = lines.y()(line.values[idx], idx);
+
+ //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue
+ if (v < -.95) {
+ //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100)
+ line.tempDisabled = true;
+ return line;
+ }
+
+ line.tempDisabled = false;
+
+ line.values = line.values.map(function(point, pointIndex) {
+ point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) };
+ return point;
+ })
+
+ return line;
+ })
+ }
+
+ //============================================================
+
+
+ return chart;
+}
+//TODO: consider deprecating by adding necessary features to multiBar model
+nv.models.discreteBar = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , color = nv.utils.defaultColor()
+ , showValues = false
+ , valueFormat = d3.format(',.2f')
+ , xDomain
+ , yDomain
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ , rectClass = 'discreteBar'
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //add series index to each data point for reference
+ data = data.map(function(series, i) {
+ series.values = series.values.map(function(point) {
+ point.series = i;
+ return point;
+ });
+ return series;
+ });
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0 }
+ })
+ });
+
+ x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands([0, availableWidth], .1);
+
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y }).concat(forceY)));
+
+
+ // If showValues, pad the Y axis range to account for label height
+ if (showValues) y.range([availableHeight - (y.domain()[0] < 0 ? 12 : 0), y.domain()[1] > 0 ? 12 : 0]);
+ else y.range([availableHeight, 0]);
+
+ //store old scales if they exist
+ x0 = x0 || x;
+ y0 = y0 || y.copy().range([y(0),y(0)]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-discretebar').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discretebar');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ //TODO: by definition, the discrete bar should not have multiple groups, will modify/remove later
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover });
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('g.nv-bar')
+ .data(function(d) { return d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('g')
+ .attr('transform', function(d,i,j) {
+ return 'translate(' + (x(getX(d,i)) + x.rangeBand() * .05 ) + ', ' + y(0) + ')'
+ })
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+
+ barsEnter.append('rect')
+ .attr('height', 0)
+ .attr('width', x.rangeBand() * .9 / data.length )
+
+ if (showValues) {
+ barsEnter.append('text')
+ .attr('text-anchor', 'middle')
+ bars.select('text')
+ .attr('x', x.rangeBand() * .9 / 2)
+ .attr('y', function(d,i) { return getY(d,i) < 0 ? y(getY(d,i)) - y(0) + 12 : -4 })
+ .text(function(d,i) { return valueFormat(getY(d,i)) });
+ } else {
+ bars.selectAll('text').remove();
+ }
+
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive' })
+ .style('fill', function(d,i) { return d.color || color(d,i) })
+ .style('stroke', function(d,i) { return d.color || color(d,i) })
+ .select('rect')
+ .attr('class', rectClass)
+ .attr('width', x.rangeBand() * .9 / data.length);
+ d3.transition(bars)
+ //.delay(function(d,i) { return i * 1200 / data[0].values.length })
+ .attr('transform', function(d,i) {
+ var left = x(getX(d,i)) + x.rangeBand() * .05,
+ top = getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 : //make 1 px positive bars show up above y=0
+ y(getY(d,i));
+
+ return 'translate(' + left + ', ' + top + ')'
+ })
+ .select('rect')
+ .attr('height', function(d,i) {
+ return Math.max(Math.abs(y(getY(d,i)) - y(0)) || 1)
+ });
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.showValues = function(_) {
+ if (!arguments.length) return showValues;
+ showValues = _;
+ return chart;
+ };
+
+ chart.valueFormat= function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.rectClass= function(_) {
+ if (!arguments.length) return rectClass;
+ rectClass = _;
+ return chart;
+ }
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.discreteBarChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var discretebar = nv.models.discreteBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ ;
+
+ var margin = {top: 15, right: 10, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.getColor()
+ , staggerLabels = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , x
+ , y
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'beforeUpdate')
+ ;
+
+ xAxis
+ .orient('bottom')
+ .highlightZero(false)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient('left')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(discretebar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(discretebar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { dispatch.beforeUpdate(); container.transition().call(chart); };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = discretebar.xScale();
+ y = discretebar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-discreteBarWithAxes').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discreteBarWithAxes').append('g');
+ var defsEnter = gEnter.append('defs');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+
+ g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ discretebar
+ .width(availableWidth)
+ .height(availableHeight);
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(barsWrap).call(discretebar);
+
+ //------------------------------------------------------------
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-x-label-clip-' + discretebar.id())
+ .append('rect');
+
+ g.select('#nv-x-label-clip-' + discretebar.id() + ' rect')
+ .attr('width', x.rangeBand() * (staggerLabels ? 2 : 1))
+ .attr('height', 16)
+ .attr('x', -x.rangeBand() / (staggerLabels ? 1 : 2 ));
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + (y.range()[0] + ((discretebar.showValues() && y.domain()[0] < 0) ? 16 : 0)) + ')');
+ //d3.transition(g.select('.nv-x.nv-axis'))
+ g.select('.nv-x.nv-axis').transition().duration(0)
+ .call(xAxis);
+
+
+ var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
+
+ if (staggerLabels) {
+ xTicks
+ .selectAll('text')
+ .attr('transform', function(d,i,j) { return 'translate(0,' + (j % 2 == 0 ? '5' : '17') + ')' })
+ }
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ discretebar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ discretebar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.discretebar = discretebar;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, discretebar, 'x', 'y', 'xDomain', 'yDomain', 'forceX', 'forceY', 'id', 'showValues', 'valueFormat');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ discretebar.color(color);
+ return chart;
+ };
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.distribution = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 400 //technically width or height depending on x or y....
+ , size = 8
+ , axis = 'x' // 'x' or 'y'... horizontal or vertical
+ , getData = function(d) { return d[axis] } // defaults d.x or d.y
+ , color = nv.utils.defaultColor()
+ , scale = d3.scale.linear()
+ , domain
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var scale0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableLength = width - (axis === 'x' ? margin.left + margin.right : margin.top + margin.bottom),
+ naxis = axis == 'x' ? 'y' : 'x',
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ scale0 = scale0 || scale;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-distribution').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-distribution');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
+
+ //------------------------------------------------------------
+
+
+ var distWrap = g.selectAll('g.nv-dist')
+ .data(function(d) { return d }, function(d) { return d.key });
+
+ distWrap.enter().append('g');
+ distWrap
+ .attr('class', function(d,i) { return 'nv-dist nv-series-' + i })
+ .style('stroke', function(d,i) { return color(d, i) });
+
+ var dist = distWrap.selectAll('line.nv-dist' + axis)
+ .data(function(d) { return d.values })
+ dist.enter().append('line')
+ .attr(axis + '1', function(d,i) { return scale0(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale0(getData(d,i)) })
+ d3.transition(distWrap.exit().selectAll('line.nv-dist' + axis))
+ .attr(axis + '1', function(d,i) { return scale(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale(getData(d,i)) })
+ .style('stroke-opacity', 0)
+ .remove();
+ dist
+ .attr('class', function(d,i) { return 'nv-dist' + axis + ' nv-dist' + axis + '-' + i })
+ .attr(naxis + '1', 0)
+ .attr(naxis + '2', size);
+ d3.transition(dist)
+ .attr(axis + '1', function(d,i) { return scale(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale(getData(d,i)) })
+
+
+ scale0 = scale.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.axis = function(_) {
+ if (!arguments.length) return axis;
+ axis = _;
+ return chart;
+ };
+
+ chart.size = function(_) {
+ if (!arguments.length) return size;
+ size = _;
+ return chart;
+ };
+
+ chart.getData = function(_) {
+ if (!arguments.length) return getData;
+ getData = d3.functor(_);
+ return chart;
+ };
+
+ chart.scale = function(_) {
+ if (!arguments.length) return scale;
+ scale = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+//TODO: consider deprecating and using multibar with single series for this
+nv.models.historicalBar = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceX = []
+ , forceY = [0]
+ , padData = false
+ , clipEdge = true
+ , color = nv.utils.defaultColor()
+ , xDomain
+ , yDomain
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) ))
+
+ if (padData)
+ x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range([0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(data[0].values.map(getY).concat(forceY) ))
+ .range([availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bar').data([data[0].values]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-bars');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-chart-clip-path-' + id)
+ .append('rect');
+
+ wrap.select('#nv-chart-clip-path-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : '');
+
+
+
+ var bars = wrap.select('.nv-bars').selectAll('.nv-bar')
+ .data(function(d) { return d });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('rect')
+ //.attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i })
+ .attr('x', 0 )
+ .attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ .attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) })
+ .on('mouseover', function(d,i) {
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ point: d,
+ series: data[0],
+ pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ point: d,
+ series: data[0],
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ bars
+ .attr('fill', function(d,i) { return color(d, i); })
+ .attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i })
+ .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; }) //TODO: better width calculations that don't assume always uniform data spacing;w
+ .attr('width', (availableWidth / data[0].values.length) * .9 )
+
+
+ d3.transition(bars)
+ //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ .attr('y', function(d,i) {
+ return getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 :
+ y(getY(d,i))
+ })
+ .attr('height', function(d,i) { return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) });
+ //.order(); // not sure if this makes any sense for this model
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.historicalBarChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var bars = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 90, bottom: 50, left: 90}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = false
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x
+ , y
+ , state = {}
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient( (rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+
+ // New addition to calculate position if SVG is scaled with viewBox, may move TODO: consider implementing everywhere else
+ if (offsetElement) {
+ var svg = d3.select(offsetElement).select('svg');
+ var viewBox = (svg.node()) ? svg.attr('viewBox') : null;
+ if (viewBox) {
+ viewBox = viewBox.split(' ');
+ var ratio = parseInt(svg.style('width')) / viewBox[2];
+ e.pos[0] = e.pos[0] * ratio;
+ e.pos[1] = e.pos[1] * ratio;
+ }
+ }
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(bars.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(bars.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = bars.xScale();
+ y = bars.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(barsWrap).call(bars);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ g.select('.nv-x.nv-axis')
+ .transition()
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .transition().duration(0)
+ .call(yAxis);
+ }
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ selection.transition().call(chart);
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+/*
+ legend.dispatch.on('legendMouseover', function(d, i) {
+ d.hover = true;
+ selection.transition().call(chart)
+ });
+
+ legend.dispatch.on('legendMouseout', function(d, i) {
+ d.hover = false;
+ selection.transition().call(chart)
+ });
+*/
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ selection.call(chart);
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.bars = bars;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, bars, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+nv.models.indentedTree = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor()
+ , id = Math.floor(Math.random() * 10000)
+ , header = true
+ , filterZero = false
+ , noData = "No Data Available."
+ , childIndent = 20
+ , columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this
+ , tableClass = null
+ , iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images
+ , iconClose = 'images/grey-minus.png'
+ , dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+ var idx = 0;
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var depth = 1,
+ container = d3.select(this);
+
+ var tree = d3.layout.tree()
+ .children(function(d) { return d.values })
+ .size([height, childIndent]); //Not sure if this is needed now that the result is HTML
+
+ chart.update = function() { container.transition().duration(600).call(chart) };
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+ if (!data[0]) data[0] = {key: noData};
+
+ //------------------------------------------------------------
+
+
+ var nodes = tree.nodes(data[0]);
+
+ // nodes.map(function(d) {
+ // d.id = i++;
+ // })
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('div').data([[nodes]]);
+ var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree');
+ var tableEnter = wrapEnter.append('table');
+ var table = wrap.select('table').attr('width', '100%').attr('class', tableClass);
+
+ //------------------------------------------------------------
+
+
+ if (header) {
+ var thead = tableEnter.append('thead');
+
+ var theadRow1 = thead.append('tr');
+
+ columns.forEach(function(column) {
+ theadRow1
+ .append('th')
+ .attr('width', column.width ? column.width : '10%')
+ .style('text-align', column.type == 'numeric' ? 'right' : 'left')
+ .append('span')
+ .text(column.label);
+ });
+ }
+
+
+ var tbody = table.selectAll('tbody')
+ .data(function(d) { return d });
+ tbody.enter().append('tbody');
+
+
+
+ //compute max generations
+ depth = d3.max(nodes, function(node) { return node.depth });
+ tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all
+
+
+ // Update the nodes…
+ var node = tbody.selectAll('tr')
+ // .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)});
+ .data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)});
+ //.style('display', 'table-row'); //TODO: see if this does anything
+
+ node.exit().remove();
+
+ node.select('img.nv-treeicon')
+ .attr('src', icon)
+ .classed('folded', folded);
+
+ var nodeEnter = node.enter().append('tr');
+
+
+ columns.forEach(function(column, index) {
+
+ var nodeName = nodeEnter.append('td')
+ .style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here
+ .style('text-align', column.type == 'numeric' ? 'right' : 'left');
+
+
+ if (index == 0) {
+ nodeName.append('img')
+ .classed('nv-treeicon', true)
+ .classed('nv-folded', folded)
+ .attr('src', icon)
+ .style('width', '14px')
+ .style('height', '14px')
+ .style('padding', '0 1px')
+ .style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; })
+ .on('click', click);
+ }
+
+
+ nodeName.append('span')
+ .attr('class', d3.functor(column.classes) )
+ .text(function(d) { return column.format ? column.format(d) :
+ (d[column.key] || '-') });
+
+ if (column.showCount) {
+ nodeName.append('span')
+ .attr('class', 'nv-childrenCount');
+
+ node.selectAll('span.nv-childrenCount').text(function(d) {
+ return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent
+ '(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter
+ || (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values...
+ || 0) + ')' //This is the catch-all in case there are no children after a filter
+ : '' //If this is not a parent, just give an empty string
+ });
+ }
+
+ if (column.click)
+ nodeName.select('span').on('click', column.click);
+
+ });
+
+ node
+ .order()
+ .on('click', function(d) {
+ dispatch.elementClick({
+ row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href)
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('dblclick', function(d) {
+ dispatch.elementDblclick({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('mouseover', function(d) {
+ dispatch.elementMouseover({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('mouseout', function(d) {
+ dispatch.elementMouseout({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ });
+
+
+
+
+ // Toggle children on click.
+ function click(d, _, unshift) {
+ d3.event.stopPropagation();
+
+ if(d3.event.shiftKey && !unshift) {
+ //If you shift-click, it'll toggle fold all the children, instead of itself
+ d3.event.shiftKey = false;
+ d.values && d.values.forEach(function(node){
+ if (node.values || node._values) {
+ click(node, 0, true);
+ }
+ });
+ return true;
+ }
+ if(!hasChildren(d)) {
+ //download file
+ //window.location.href = d.url;
+ return true;
+ }
+ if (d.values) {
+ d._values = d.values;
+ d.values = null;
+ } else {
+ d.values = d._values;
+ d._values = null;
+ }
+ chart.update();
+ }
+
+
+ function icon(d) {
+ return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : '';
+ }
+
+ function folded(d) {
+ return (d._values && d._values.length);
+ }
+
+ function hasChildren(d) {
+ var values = d.values || d._values;
+
+ return (values && values.length);
+ }
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ scatter.color(color);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.header = function(_) {
+ if (!arguments.length) return header;
+ header = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.filterZero = function(_) {
+ if (!arguments.length) return filterZero;
+ filterZero = _;
+ return chart;
+ };
+
+ chart.columns = function(_) {
+ if (!arguments.length) return columns;
+ columns = _;
+ return chart;
+ };
+
+ chart.tableClass = function(_) {
+ if (!arguments.length) return tableClass;
+ tableClass = _;
+ return chart;
+ };
+
+ chart.iconOpen = function(_){
+ if (!arguments.length) return iconOpen;
+ iconOpen = _;
+ return chart;
+ }
+
+ chart.iconClose = function(_){
+ if (!arguments.length) return iconClose;
+ iconClose = _;
+ return chart;
+ }
+
+ //============================================================
+
+
+ return chart;
+};nv.models.legend = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 5, right: 0, bottom: 5, left: 0}
+ , width = 400
+ , height = 20
+ , getKey = function(d) { return d.key }
+ , color = nv.utils.defaultColor()
+ , align = true
+ , dispatch = d3.dispatch('legendClick', 'legendDblclick', 'legendMouseover', 'legendMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-legend').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-legend').append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ var series = g.selectAll('.nv-series')
+ .data(function(d) { return d });
+ var seriesEnter = series.enter().append('g').attr('class', 'nv-series')
+ .on('mouseover', function(d,i) {
+ dispatch.legendMouseover(d,i); //TODO: Make consistent with other event objects
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.legendMouseout(d,i);
+ })
+ .on('click', function(d,i) {
+ dispatch.legendClick(d,i);
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.legendDblclick(d,i);
+ });
+ seriesEnter.append('circle')
+ .style('stroke-width', 2)
+ .attr('r', 5);
+ seriesEnter.append('text')
+ .attr('text-anchor', 'start')
+ .attr('dy', '.32em')
+ .attr('dx', '8');
+ series.classed('disabled', function(d) { return d.disabled });
+ series.exit().remove();
+ series.select('circle')
+ .style('fill', function(d,i) { return d.color || color(d,i)})
+ .style('stroke', function(d,i) { return d.color || color(d, i) });
+ series.select('text').text(getKey);
+
+
+ //TODO: implement fixed-width and max-width options (max-width is especially useful with the align option)
+
+ // NEW ALIGNING CODE, TODO: clean up
+ if (align) {
+
+ var seriesWidths = [];
+ series.each(function(d,i) {
+ var legendText = d3.select(this).select('text');
+ var svgComputedTextLength = legendText.node().getComputedTextLength()
+ || nv.utils.calcApproxTextWidth(legendText);
+ seriesWidths.push(svgComputedTextLength + 28); // 28 is ~ the width of the circle plus some padding
+ });
+
+ //nv.log('Series Widths: ', JSON.stringify(seriesWidths));
+
+ var seriesPerRow = 0;
+ var legendWidth = 0;
+ var columnWidths = [];
+
+ while ( legendWidth < availableWidth && seriesPerRow < seriesWidths.length) {
+ columnWidths[seriesPerRow] = seriesWidths[seriesPerRow];
+ legendWidth += seriesWidths[seriesPerRow++];
+ }
+
+
+ while ( legendWidth > availableWidth && seriesPerRow > 1 ) {
+ columnWidths = [];
+ seriesPerRow--;
+
+ for (k = 0; k < seriesWidths.length; k++) {
+ if (seriesWidths[k] > (columnWidths[k % seriesPerRow] || 0) )
+ columnWidths[k % seriesPerRow] = seriesWidths[k];
+ }
+
+ legendWidth = columnWidths.reduce(function(prev, cur, index, array) {
+ return prev + cur;
+ });
+ }
+ //console.log(columnWidths, legendWidth, seriesPerRow);
+
+ var xPositions = [];
+ for (var i = 0, curX = 0; i < seriesPerRow; i++) {
+ xPositions[i] = curX;
+ curX += columnWidths[i];
+ }
+
+ series
+ .attr('transform', function(d, i) {
+ return 'translate(' + xPositions[i % seriesPerRow] + ',' + (5 + Math.floor(i / seriesPerRow) * 20) + ')';
+ });
+
+ //position legend as far right as possible within the total width
+ g.attr('transform', 'translate(' + (width - margin.right - legendWidth) + ',' + margin.top + ')');
+
+ height = margin.top + margin.bottom + (Math.ceil(seriesWidths.length / seriesPerRow) * 20);
+
+ } else {
+
+ var ypos = 5,
+ newxpos = 5,
+ maxwidth = 0,
+ xpos;
+ series
+ .attr('transform', function(d, i) {
+ var length = d3.select(this).select('text').node().getComputedTextLength() + 28;
+ xpos = newxpos;
+
+ if (width < margin.left + margin.right + xpos + length) {
+ newxpos = xpos = 5;
+ ypos += 20;
+ }
+
+ newxpos += length;
+ if (newxpos > maxwidth) maxwidth = newxpos;
+
+ return 'translate(' + xpos + ',' + ypos + ')';
+ });
+
+ //position legend as far right as possible within the total width
+ g.attr('transform', 'translate(' + (width - margin.right - maxwidth) + ',' + margin.top + ')');
+
+ height = margin.top + margin.bottom + ypos + 15;
+
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.key = function(_) {
+ if (!arguments.length) return getKey;
+ getKey = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.align = function(_) {
+ if (!arguments.length) return align;
+ align = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.line = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ ;
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // a function that returns a color
+ , getX = function(d) { return d.x } // accessor to get the x value from a data point
+ , getY = function(d) { return d.y } // accessor to get the y value from a data point
+ , defined = function(d,i) { return !isNaN(getY(d,i)) && getY(d,i) !== null } // allows a line to be not continuous when it is not defined
+ , isArea = function(d) { return d.area } // decides if a line is an area or just a line
+ , clipEdge = false // if true, masks lines within x and y scale
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , interpolate = "linear" // controls the line interpolation
+ ;
+
+ scatter
+ .size(16) // default size
+ .sizeDomain([16,256]) //set to speed up calculation, needs to be unset if there is a custom size accessor
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-line').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-groups');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var scatterWrap = wrap.select('.nv-scatterWrap');
+ //.datum(data); // Data automatically trickles down from the wrap
+
+ d3.transition(scatterWrap).call(scatter);
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + scatter.id())
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + scatter.id() + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : '');
+ scatterWrap
+ .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : '');
+
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i)});
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .5);
+
+
+
+ var areaPaths = groups.selectAll('path.nv-area')
+ .data(function(d) { return isArea(d) ? [d] : [] }); // this is done differently than lines because I need to check if series is an area
+ areaPaths.enter().append('path')
+ .attr('class', 'nv-area')
+ .attr('d', function(d) {
+ return d3.svg.area()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return x0(getX(d,i)) })
+ .y0(function(d,i) { return y0(getY(d,i)) })
+ .y1(function(d,i) { return y0( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
+ //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
+ .apply(this, [d.values])
+ });
+ d3.transition(groups.exit().selectAll('path.nv-area'))
+ .attr('d', function(d) {
+ return d3.svg.area()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d,i) { return y(getY(d,i)) })
+ .y1(function(d,i) { return y( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
+ //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
+ .apply(this, [d.values])
+ });
+ d3.transition(areaPaths)
+ .attr('d', function(d) {
+ return d3.svg.area()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d,i) { return y(getY(d,i)) })
+ .y1(function(d,i) { return y( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
+ //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
+ .apply(this, [d.values])
+ });
+
+
+
+ var linePaths = groups.selectAll('path.nv-line')
+ .data(function(d) { return [d.values] });
+ linePaths.enter().append('path')
+ .attr('class', 'nv-line')
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return x0(getX(d,i)) })
+ .y(function(d,i) { return y0(getY(d,i)) })
+ );
+ d3.transition(groups.exit().selectAll('path.nv-line'))
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ );
+ d3.transition(linePaths)
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ );
+
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = scatter.dispatch;
+ chart.scatter = scatter;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'padData');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ scatter.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ scatter.y(_);
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ scatter.color(color);
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ interpolate = _;
+ return chart;
+ };
+
+ chart.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return chart;
+ };
+
+ chart.isArea = function(_) {
+ if (!arguments.length) return isArea;
+ isArea = d3.functor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.lineChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ ;
+
+//set margin.right to 23 to fit dates on the x-axis within the chart
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x
+ , y
+ , state = {}
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+
+ // New addition to calculate position if SVG is scaled with viewBox, may move TODO: consider implementing everywhere else
+ if (offsetElement) {
+ var svg = d3.select(offsetElement).select('svg');
+ var viewBox = (svg.node()) ? svg.attr('viewBox') : null;
+ if (viewBox) {
+ viewBox = viewBox.split(' ');
+ var ratio = parseInt(svg.style('width')) / viewBox[2];
+ e.pos[0] = e.pos[0] * ratio;
+ e.pos[1] = e.pos[1] * ratio;
+ }
+ }
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { container.transition().call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(linesWrap).call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+ }
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ // container.transition().call(chart);
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+/*
+ legend.dispatch.on('legendMouseover', function(d, i) {
+ d.hover = true;
+ selection.transition().call(chart)
+ });
+
+ legend.dispatch.on('legendMouseout', function(d, i) {
+ d.hover = false;
+ selection.transition().call(chart)
+ });
+*/
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.lines = lines;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.linePlusBarChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , bars = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , y1Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 60, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.defaultColor()
+ , showLegend = true
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>';
+ }
+ , x
+ , y1
+ , y2
+ , state = {}
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ bars
+ .padData(true)
+ ;
+ lines
+ .clipEdge(false)
+ .padData(true)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ .highlightZero(false)
+ ;
+ y1Axis
+ .orient('left')
+ ;
+ y2Axis
+ .orient('right')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ }
+ ;
+
+ //------------------------------------------------------------
+
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ // chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ var dataBars = data.filter(function(d) { return !d.disabled && d.bar });
+ var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240
+
+ //x = xAxis.scale();
+ x = dataLines.filter(function(d) { return !d.disabled; }).length && dataLines.filter(function(d) { return !d.disabled; })[0].values.length ? lines.xScale() : bars.xScale();
+ //x = dataLines.filter(function(d) { return !d.disabled; }).length ? lines.xScale() : bars.xScale(); //old code before change above
+ y1 = bars.yScale();
+ y2 = lines.yScale();
+
+ //------------------------------------------------------------
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-linePlusBar').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ gEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.nv-legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }))
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }))
+
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(dataBars.length ? dataBars : [{values:[]}])
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(dataLines[0] && !dataLines[0].disabled ? dataLines : [{values:[]}] );
+ //.datum(!dataLines[0].disabled ? dataLines : [{values:dataLines[0].values.map(function(d) { return [d[0], null] }) }] );
+
+ d3.transition(barsWrap).call(bars);
+ d3.transition(linesWrap).call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y1.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+
+ y1Axis
+ .scale(y1)
+ .ticks( availableHeight / 36 )
+ .tickSize(-availableWidth, 0);
+
+ d3.transition(g.select('.nv-y1.nv-axis'))
+ .style('opacity', dataBars.length ? 1 : 0)
+ .call(y1Axis);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + availableWidth + ',0)');
+ //.attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ d3.transition(g.select('.nv-y2.nv-axis'))
+ .call(y2Axis);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.bars = bars;
+ chart.xAxis = xAxis;
+ chart.y1Axis = y1Axis;
+ chart.y2Axis = y2Axis;
+
+ d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate');
+ //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc.
+ //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines.x(_);
+ bars.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines.y(_);
+ bars.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.lineWithFocusChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , lines2 = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , x2Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ , brush = d3.svg.brush()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 30, left: 60}
+ , margin2 = {top: 0, right: 30, bottom: 20, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , height2 = 100
+ , x
+ , y
+ , x2
+ , y2
+ , showLegend = true
+ , brushExtent = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
+ ;
+
+ lines
+ .clipEdge(true)
+ ;
+ lines2
+ .interactive(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ yAxis
+ .orient('left')
+ ;
+ x2Axis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y2Axis
+ .orient('left')
+ ;
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2,
+ availableHeight2 = height2 - margin2.top - margin2.bottom;
+
+ chart.update = function() { container.transition().call(chart) };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight1 / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+ x2 = lines2.xScale();
+ y2 = lines2.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineWithFocusChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineWithFocusChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ var focusEnter = gEnter.append('g').attr('class', 'nv-focus');
+ focusEnter.append('g').attr('class', 'nv-x nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y nv-axis');
+ focusEnter.append('g').attr('class', 'nv-linesWrap');
+
+ var contextEnter = gEnter.append('g').attr('class', 'nv-context');
+ contextEnter.append('g').attr('class', 'nv-x nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y nv-axis');
+ contextEnter.append('g').attr('class', 'nv-linesWrap');
+ contextEnter.append('g').attr('class', 'nv-brushBackground');
+ contextEnter.append('g').attr('class', 'nv-x nv-brush');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(
+ data
+ .map(function(d,i) {
+ return d.color || color(d, i);
+ })
+ .filter(function(d,i) {
+ return !data[i].disabled;
+ })
+ );
+
+ lines2
+ .defined(lines.defined())
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(
+ data
+ .map(function(d,i) {
+ return d.color || color(d, i);
+ })
+ .filter(function(d,i) {
+ return !data[i].disabled;
+ })
+ );
+
+ g.select('.nv-context')
+ .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')')
+
+ var contextLinesWrap = g.select('.nv-context .nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(contextLinesWrap).call(lines2);
+
+ //------------------------------------------------------------
+
+
+ /*
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(focusLinesWrap).call(lines);
+ */
+
+
+ //------------------------------------------------------------
+ // Setup Main (Focus) Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight1, 0);
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight1 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-focus .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight1 + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Brush
+
+ brush
+ .x(x2)
+ .on('brush', onBrush);
+
+ if (brushExtent) brush.extent(brushExtent);
+
+ var brushBG = g.select('.nv-brushBackground').selectAll('g')
+ .data([brushExtent || brush.extent()])
+
+ var brushBGenter = brushBG.enter()
+ .append('g');
+
+ brushBGenter.append('rect')
+ .attr('class', 'left')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ brushBGenter.append('rect')
+ .attr('class', 'right')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ gBrush = g.select('.nv-x.nv-brush')
+ .call(brush);
+ gBrush.selectAll('rect')
+ //.attr('y', -5)
+ .attr('height', availableHeight2);
+ gBrush.selectAll('.resize').append('path').attr('d', resizePath);
+
+ onBrush();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Secondary (Context) Axes
+
+ x2Axis
+ .scale(x2)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight2, 0);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y2.range()[0] + ')');
+ d3.transition(g.select('.nv-context .nv-x.nv-axis'))
+ .call(x2Axis);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight2 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-context .nv-y.nv-axis'))
+ .call(y2Axis);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y2.range()[0] + ')');
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ container.transition().call(chart);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ // Taken from crossfilter (http://square.github.com/crossfilter/)
+ function resizePath(d) {
+ var e = +(d == 'e'),
+ x = e ? 1 : -1,
+ y = availableHeight2 / 3;
+ return 'M' + (.5 * x) + ',' + y
+ + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6)
+ + 'V' + (2 * y - 6)
+ + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y)
+ + 'Z'
+ + 'M' + (2.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8)
+ + 'M' + (4.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8);
+ }
+
+
+ function updateBrushBG() {
+ if (!brush.empty()) brush.extent(brushExtent);
+ brushBG
+ .data([brush.empty() ? x2.domain() : brushExtent])
+ .each(function(d,i) {
+ var leftWidth = x2(d[0]) - x.range()[0],
+ rightWidth = x.range()[1] - x2(d[1]);
+ d3.select(this).select('.left')
+ .attr('width', leftWidth < 0 ? 0 : leftWidth);
+
+ d3.select(this).select('.right')
+ .attr('x', x2(d[1]))
+ .attr('width', rightWidth < 0 ? 0 : rightWidth);
+ });
+ }
+
+
+ function onBrush() {
+ brushExtent = brush.empty() ? null : brush.extent();
+ extent = brush.empty() ? x2.domain() : brush.extent();
+
+
+ dispatch.brush({extent: extent, brush: brush});
+
+
+ updateBrushBG();
+
+ // Update Main (Focus)
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(
+ data
+ .filter(function(d) { return !d.disabled })
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+ d3.transition(focusLinesWrap).call(lines);
+
+
+ // Update Main (Focus) Axes
+ d3.transition(g.select('.nv-focus .nv-x.nv-axis'))
+ .call(xAxis);
+ d3.transition(g.select('.nv-focus .nv-y.nv-axis'))
+ .call(yAxis);
+ }
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.lines2 = lines2;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.x2Axis = x2Axis;
+ chart.y2Axis = y2Axis;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.x = function(_) {
+ if (!arguments.length) return lines.x;
+ lines.x(_);
+ lines2.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return lines.y;
+ lines.y(_);
+ lines2.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.margin2 = function(_) {
+ if (!arguments.length) return margin2;
+ margin2 = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.height2 = function(_) {
+ if (!arguments.length) return height2;
+ height2 = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color =nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return lines.interpolate();
+ lines.interpolate(_);
+ lines2.interpolate(_);
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ // Chart has multiple similar Axes, to prevent code duplication, probably need to link all axis functions manually like below
+ chart.xTickFormat = function(_) {
+ if (!arguments.length) return xAxis.tickFormat();
+ xAxis.tickFormat(_);
+ x2Axis.tickFormat(_);
+ return chart;
+ };
+
+ chart.yTickFormat = function(_) {
+ if (!arguments.length) return yAxis.tickFormat();
+ yAxis.tickFormat(_);
+ y2Axis.tickFormat(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.linePlusBarWithFocusChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , lines2 = nv.models.line()
+ , bars = nv.models.historicalBar()
+ , bars2 = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , x2Axis = nv.models.axis()
+ , y1Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , y3Axis = nv.models.axis()
+ , y4Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ , brush = d3.svg.brush()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 30, left: 60}
+ , margin2 = {top: 0, right: 30, bottom: 20, left: 60}
+ , width = null
+ , height = null
+ , height2 = 100
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.defaultColor()
+ , showLegend = true
+ , extent
+ , brushExtent = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>';
+ }
+ , x
+ , x2
+ , y1
+ , y2
+ , y3
+ , y4
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
+ ;
+
+ lines
+ .clipEdge(true)
+ ;
+ lines2
+ .interactive(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y1Axis
+ .orient('left')
+ ;
+ y2Axis
+ .orient('right')
+ ;
+ x2Axis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y3Axis
+ .orient('left')
+ ;
+ y4Axis
+ .orient('right')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ if (extent) {
+ e.pointIndex += Math.ceil(extent[0]);
+ }
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //------------------------------------------------------------
+
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2,
+ availableHeight2 = height2 - margin2.top - margin2.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight1 / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ var dataBars = data.filter(function(d) { return !d.disabled && d.bar });
+ var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240
+
+ x = bars.xScale();
+ x2 = x2Axis.scale();
+ y1 = bars.yScale();
+ y2 = lines.yScale();
+ y3 = bars2.yScale();
+ y4 = lines2.yScale();
+
+ var series1 = data
+ .filter(function(d) { return !d.disabled && d.bar })
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i) }
+ })
+ });
+
+ var series2 = data
+ .filter(function(d) { return !d.disabled && !d.bar })
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i) }
+ })
+ });
+
+ x .range([0, availableWidth]);
+
+ x2 .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } ))
+ .range([0, availableWidth]);
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-linePlusBar').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ var focusEnter = gEnter.append('g').attr('class', 'nv-focus');
+ focusEnter.append('g').attr('class', 'nv-x nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ focusEnter.append('g').attr('class', 'nv-barsWrap');
+ focusEnter.append('g').attr('class', 'nv-linesWrap');
+
+ var contextEnter = gEnter.append('g').attr('class', 'nv-context');
+ contextEnter.append('g').attr('class', 'nv-x nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ contextEnter.append('g').attr('class', 'nv-barsWrap');
+ contextEnter.append('g').attr('class', 'nv-linesWrap');
+ contextEnter.append('g').attr('class', 'nv-brushBackground');
+ contextEnter.append('g').attr('class', 'nv-x nv-brush');
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.nv-legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Context Components
+
+ bars2
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }));
+
+ lines2
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }));
+
+ var bars2Wrap = g.select('.nv-context .nv-barsWrap')
+ .datum(dataBars.length ? dataBars : [{values:[]}]);
+
+ var lines2Wrap = g.select('.nv-context .nv-linesWrap')
+ .datum(!dataLines[0].disabled ? dataLines : [{values:[]}]);
+
+ g.select('.nv-context')
+ .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')')
+
+ d3.transition(bars2Wrap).call(bars2);
+ d3.transition(lines2Wrap).call(lines2);
+
+ //------------------------------------------------------------
+
+
+
+ //------------------------------------------------------------
+ // Setup Brush
+
+ brush
+ .x(x2)
+ .on('brush', onBrush);
+
+ if (brushExtent) brush.extent(brushExtent);
+
+ var brushBG = g.select('.nv-brushBackground').selectAll('g')
+ .data([brushExtent || brush.extent()])
+
+ var brushBGenter = brushBG.enter()
+ .append('g');
+
+ brushBGenter.append('rect')
+ .attr('class', 'left')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ brushBGenter.append('rect')
+ .attr('class', 'right')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ var gBrush = g.select('.nv-x.nv-brush')
+ .call(brush);
+ gBrush.selectAll('rect')
+ //.attr('y', -5)
+ .attr('height', availableHeight2);
+ gBrush.selectAll('.resize').append('path').attr('d', resizePath);
+
+ //------------------------------------------------------------
+
+ //------------------------------------------------------------
+ // Setup Secondary (Context) Axes
+
+ x2Axis
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight2, 0);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y3.range()[0] + ')');
+ d3.transition(g.select('.nv-context .nv-x.nv-axis'))
+ .call(x2Axis);
+
+
+ y3Axis
+ .scale(y3)
+ .ticks( availableHeight2 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-context .nv-y1.nv-axis')
+ .style('opacity', dataBars.length ? 1 : 0)
+ .attr('transform', 'translate(0,' + x2.range()[0] + ')');
+
+ d3.transition(g.select('.nv-context .nv-y1.nv-axis'))
+ .call(y3Axis);
+
+
+ y4Axis
+ .scale(y4)
+ .ticks( availableHeight2 / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-context .nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + x2.range()[1] + ',0)');
+
+ d3.transition(g.select('.nv-context .nv-y2.nv-axis'))
+ .call(y4Axis);
+
+ //------------------------------------------------------------
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ // Taken from crossfilter (http://square.github.com/crossfilter/)
+ function resizePath(d) {
+ var e = +(d == 'e'),
+ x = e ? 1 : -1,
+ y = availableHeight2 / 3;
+ return 'M' + (.5 * x) + ',' + y
+ + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6)
+ + 'V' + (2 * y - 6)
+ + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y)
+ + 'Z'
+ + 'M' + (2.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8)
+ + 'M' + (4.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8);
+ }
+
+
+ function updateBrushBG() {
+ if (!brush.empty()) brush.extent(brushExtent);
+ brushBG
+ .data([brush.empty() ? x2.domain() : brushExtent])
+ .each(function(d,i) {
+ var leftWidth = x2(d[0]) - x2.range()[0],
+ rightWidth = x2.range()[1] - x2(d[1]);
+ d3.select(this).select('.left')
+ .attr('width', leftWidth < 0 ? 0 : leftWidth);
+
+ d3.select(this).select('.right')
+ .attr('x', x2(d[1]))
+ .attr('width', rightWidth < 0 ? 0 : rightWidth);
+ });
+ }
+
+
+ function onBrush() {
+ brushExtent = brush.empty() ? null : brush.extent();
+ extent = brush.empty() ? x2.domain() : brush.extent();
+
+
+ dispatch.brush({extent: extent, brush: brush});
+
+ updateBrushBG();
+
+
+ //------------------------------------------------------------
+ // Prepare Main (Focus) Bars and Lines
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }));
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }));
+
+ var focusBarsWrap = g.select('.nv-focus .nv-barsWrap')
+ .datum(!dataBars.length ? [{values:[]}] :
+ dataBars
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return bars.x()(d,i) >= extent[0] && bars.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(dataLines[0].disabled ? [{values:[]}] :
+ dataLines
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Update Main (Focus) X Axis
+
+ if (dataBars.length) {
+ x = bars.xScale();
+ } else {
+ x = lines.xScale();
+ }
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight1, 0);
+
+ xAxis.domain([Math.ceil(extent[0]), Math.floor(extent[1])]);
+
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Update Main (Focus) Bars and Lines
+
+ d3.transition(focusBarsWrap).call(bars);
+ d3.transition(focusLinesWrap).call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup and Update Main (Focus) Y Axes
+
+ g.select('.nv-focus .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y1.range()[0] + ')');
+
+
+ y1Axis
+ .scale(y1)
+ .ticks( availableHeight1 / 36 )
+ .tickSize(-availableWidth, 0);
+
+ g.select('.nv-focus .nv-y1.nv-axis')
+ .style('opacity', dataBars.length ? 1 : 0);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight1 / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-focus .nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ d3.transition(g.select('.nv-focus .nv-y1.nv-axis'))
+ .call(y1Axis);
+ d3.transition(g.select('.nv-focus .nv-y2.nv-axis'))
+ .call(y2Axis);
+ }
+
+ //============================================================
+
+ onBrush();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.lines2 = lines2;
+ chart.bars = bars;
+ chart.bars2 = bars2;
+ chart.xAxis = xAxis;
+ chart.x2Axis = x2Axis;
+ chart.y1Axis = y1Axis;
+ chart.y2Axis = y2Axis;
+ chart.y3Axis = y3Axis;
+ chart.y4Axis = y4Axis;
+
+ d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate');
+ //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc.
+ //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines.x(_);
+ bars.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines.y(_);
+ bars.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.brushExtent = function(_) {
+ if (!arguments.length) return brushExtent;
+ brushExtent = _;
+ return chart;
+ };
+
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.multiBar = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , clipEdge = true
+ , stacked = false
+ , color = nv.utils.defaultColor()
+ , hideable = false
+ , barColor = null // adding the ability to set the color for each rather than the whole group
+ , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled
+ , delay = 1200
+ , drawTime = 500
+ , xDomain
+ , yDomain
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ if(hideable && data.length) hideable = [{
+ values: data[0].values.map(function(d) {
+ return {
+ x: d.x,
+ y: 0,
+ series: d.series,
+ size: 0.01
+ };}
+ )}];
+
+ if (stacked)
+ data = d3.layout.stack()
+ .offset('zero')
+ .values(function(d){ return d.values })
+ .y(getY)
+ (!data.length && hideable ? hideable : data);
+
+
+ //add series index to each data point for reference
+ data = data.map(function(series, i) {
+ series.values = series.values.map(function(point) {
+ point.series = i;
+ return point;
+ });
+ return series;
+ });
+
+
+ //------------------------------------------------------------
+ // HACK for negative value stacking
+ if (stacked)
+ data[0].values.map(function(d,i) {
+ var posBase = 0, negBase = 0;
+ data.map(function(d) {
+ var f = d.values[i]
+ f.size = Math.abs(f.y);
+ if (f.y<0) {
+ f.y1 = negBase;
+ negBase = negBase - f.size;
+ } else
+ {
+ f.y1 = f.size + posBase;
+ posBase = posBase + f.size;
+ }
+ });
+ });
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 }
+ })
+ });
+
+ x .domain(d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands([0, availableWidth], .1);
+
+ //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y1 : 0) }).concat(forceY)))
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 : d.y1 + d.y ) : d.y }).concat(forceY)))
+ .range([availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+
+
+ groups.exit()
+ .selectAll('rect.nv-bar')
+ .transition()
+ .delay(function(d,i) { return i * delay/ data[0].values.length })
+ .attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) })
+ .attr('height', 0)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) });
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('rect.nv-bar')
+ .data(function(d) { return (hideable && !data.length) ? hideable.values : d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('rect')
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .attr('x', function(d,i,j) {
+ return stacked ? 0 : (j * x.rangeBand() / data.length )
+ })
+ .attr('y', function(d) { return y0(stacked ? d.y0 : 0) })
+ .attr('height', 0)
+ .attr('width', x.rangeBand() / (stacked ? 1 : data.length) );
+ bars
+ .style('fill', function(d,i,j){ return color(d, j, i); })
+ .style('stroke', function(d,i,j){ return color(d, j, i); })
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; })
+
+ if (barColor) {
+ if (!disabled) disabled = data.map(function() { return true });
+ bars
+ //.style('fill', barColor)
+ //.style('stroke', barColor)
+ //.style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); })
+ //.style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); })
+ .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); })
+ .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); });
+ }
+
+
+ if (stacked)
+ bars.transition()
+
+ .delay(function(d,i) { return i * delay / data[0].values.length })
+ .attr('y', function(d,i) {
+
+ return y((stacked ? d.y1 : 0));
+ })
+ .attr('height', function(d,i) {
+ if(d.y == null) return 0;
+ return Math.max(Math.abs(y(d.y + (stacked ? d.y0 : 0)) - y((stacked ? d.y0 : 0))),1);
+ })
+ .each('end', function() {
+ d3.select(this).transition().duration(drawTime)
+ .attr('x', function(d,i) {
+ return stacked ? 0 : (d.series * x.rangeBand() / data.length )
+ })
+ .attr('width', x.rangeBand() / (stacked ? 1 : data.length) );
+ })
+ else
+ d3.transition(bars).duration(drawTime)
+ .delay(function(d,i) { return i * delay/ data[0].values.length })
+ .attr('x', function(d,i) {
+ return d.series * x.rangeBand() / data.length
+ })
+ .attr('width', x.rangeBand() / data.length)
+ .each('end', function() {
+ d3.select(this).transition().duration(drawTime)
+ .attr('y', function(d,i) {
+ return getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 :
+ y(getY(d,i)) || 0;
+ })
+ .attr('height', function(d,i) {
+ if(d.y == null) return 0;
+ return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) || 0;
+ });
+ })
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.stacked = function(_) {
+ if (!arguments.length) return stacked;
+ stacked = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.barColor = function(_) {
+ if (!arguments.length) return barColor;
+ barColor = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.disabled = function(_) {
+ if (!arguments.length) return disabled;
+ disabled = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.hideable = function(_) {
+ if (!arguments.length) return hideable;
+ hideable = _;
+ return chart;
+ };
+
+ chart.delay = function(_) {
+ if (!arguments.length) return delay;
+ delay = _;
+ return chart;
+ };
+
+ chart.drawTime = function(_) {
+ if (!arguments.length) return drawTime;
+ drawTime = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.multiBarChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var multibar = nv.models.multiBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , showControls = true
+ , showLegend = true
+ , logScale = false
+ , reduceXTicks = true // if false a tick will show for every data point
+ , staggerLabels = false
+ , rotateLabels = 0
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph, logScale) {
+ //alert(y+ " " + logScale);
+ if(logScale) {
+ var fmt = d3.format(',.2f');
+ return '<h3>' + key + '</h3>' +
+ '<p>' + fmt(Math.pow(10,y)) + ' on ' + x + '</p>'
+ } else {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' on ' + x + '</p>'
+ }
+
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , state = { stacked: false }
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = function() { return showControls ? 180 : 0 }
+ ;
+ multibar
+ .stacked(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ .highlightZero(true)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient('left')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart, logScale);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = multibar.xScale();
+ y = multibar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth - controlWidth());
+
+ if (multibar.barColor())
+ data.forEach(function(series,i) {
+ series.color = d3.rgb('#ccc').darker(i * 1.5).toString();
+ })
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Grouped', disabled: multibar.stacked() },
+ { key: 'Stacked', disabled: !multibar.stacked() }
+ ];
+
+ controls.width(controlWidth()).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ multibar
+ .disabled(data.map(function(series) { return series.disabled }))
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(barsWrap).call(multibar);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+ var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g');
+
+ xTicks
+ .selectAll('line, text')
+ .style('opacity', 1)
+
+ if (staggerLabels) {
+ var getTranslate = function(x,y) {
+ return "translate(" + x + "," + y + ")";
+ };
+
+ var staggerUp = 5, staggerDown = 17; //pixels to stagger by
+ // Issue #140
+ xTicks
+ .selectAll("text")
+ .attr('transform', function(d,i,j) {
+ return getTranslate(0, (j % 2 == 0 ? staggerUp : staggerDown));
+ });
+
+ var totalInBetweenTicks = d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;
+ g.selectAll(".nv-x.nv-axis .nv-axisMaxMin text")
+ .attr("transform", function(d,i) {
+ return getTranslate(0, (i === 0 || totalInBetweenTicks % 2 !== 0) ? staggerDown : staggerUp);
+ });
+ }
+
+
+ if (reduceXTicks)
+ xTicks
+ .filter(function(d,i) {
+ return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0;
+ })
+ .selectAll('text, line')
+ .style('opacity', 0);
+
+ if(rotateLabels)
+ xTicks
+ .selectAll('text')
+ .attr('transform', 'rotate(' + rotateLabels + ' 0,0)')
+ .attr('text-anchor', rotateLabels > 0 ? 'start' : 'end');
+
+ g.select('.nv-x.nv-axis').selectAll('g.nv-axisMaxMin text')
+ .style('opacity', 1);
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Grouped':
+ multibar.stacked(false);
+ break;
+ case 'Stacked':
+ multibar.stacked(true);
+ break;
+ }
+
+ state.stacked = multibar.stacked();
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode)
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.stacked !== 'undefined') {
+ multibar.stacked(e.stacked);
+ state.stacked = e.stacked;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ multibar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ multibar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.multibar = multibar;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'forceX', 'forceY', 'clipEdge', 'id', 'stacked', 'delay', 'barColor');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.logScale = function(_) {
+ if (!arguments.length) return logScale;
+ logScale = _;
+ return chart;
+ };
+
+ chart.reduceXTicks= function(_) {
+ if (!arguments.length) return reduceXTicks;
+ reduceXTicks = _;
+ return chart;
+ };
+
+ chart.rotateLabels = function(_) {
+ if (!arguments.length) return rotateLabels;
+ rotateLabels = _;
+ return chart;
+ }
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.multiBarHorizontal = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , color = nv.utils.defaultColor()
+ , barColor = null // adding the ability to set the color for each rather than the whole group
+ , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled
+ , stacked = false
+ , showValues = false
+ , valuePadding = 60
+ , valueFormat = d3.format(',.2f')
+ , delay = 1200
+ , xDomain
+ , yDomain
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ if (stacked)
+ data = d3.layout.stack()
+ .offset('zero')
+ .values(function(d){ return d.values })
+ .y(getY)
+ (data);
+
+
+ //add series index to each data point for reference
+ data = data.map(function(series, i) {
+ series.values = series.values.map(function(point) {
+ point.series = i;
+ return point;
+ });
+ return series;
+ });
+
+
+
+ //------------------------------------------------------------
+ // HACK for negative value stacking
+ if (stacked)
+ data[0].values.map(function(d,i) {
+ var posBase = 0, negBase = 0;
+ data.map(function(d) {
+ var f = d.values[i]
+ f.size = Math.abs(f.y);
+ if (f.y<0) {
+ f.y1 = negBase - f.size;
+ negBase = negBase - f.size;
+ } else
+ {
+ f.y1 = posBase;
+ posBase = posBase + f.size;
+ }
+ });
+ });
+
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 }
+ })
+ });
+
+ x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands([0, availableHeight], .1);
+
+ //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY)))
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 + d.y : d.y1 ) : d.y }).concat(forceY)))
+
+ if (showValues && !stacked)
+ y.range([(y.domain()[0] < 0 ? valuePadding : 0), availableWidth - (y.domain()[1] > 0 ? valuePadding : 0) ]);
+ else
+ y.range([0, availableWidth]);
+
+ x0 = x0 || x;
+ y0 = y0 || d3.scale.linear().domain(y.domain()).range([y(0),y(0)]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-multibarHorizontal').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibarHorizontal');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) });
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('g.nv-bar')
+ .data(function(d) { return d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('g')
+ .attr('transform', function(d,i,j) {
+ return 'translate(' + y0(stacked ? d.y0 : 0) + ',' + (stacked ? 0 : (j * x.rangeBand() / data.length ) + x(getX(d,i))) + ')'
+ });
+
+ barsEnter.append('rect')
+ .attr('width', 0)
+ .attr('height', x.rangeBand() / (stacked ? 1 : data.length) )
+
+ bars
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [ y(getY(d,i) + (stacked ? d.y0 : 0)), x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length) ],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+
+
+ barsEnter.append('text');
+
+ if (showValues && !stacked) {
+ bars.select('text')
+ .attr('text-anchor', function(d,i) { return getY(d,i) < 0 ? 'end' : 'start' })
+ .attr('y', x.rangeBand() / (data.length * 2))
+ .attr('dy', '.32em')
+ .text(function(d,i) { return valueFormat(getY(d,i)) })
+ d3.transition(bars)
+ //.delay(function(d,i) { return i * delay / data[0].values.length })
+ .select('text')
+ .attr('x', function(d,i) { return getY(d,i) < 0 ? -4 : y(getY(d,i)) - y(0) + 4 })
+ } else {
+ //bars.selectAll('text').remove();
+ bars.selectAll('text').text('');
+ }
+
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+
+ if (barColor) {
+ if (!disabled) disabled = data.map(function() { return true });
+ bars
+ //.style('fill', barColor)
+ //.style('stroke', barColor)
+ //.style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); })
+ //.style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); })
+ .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); })
+ .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); });
+ }
+
+ if (stacked)
+ d3.transition(bars)
+ //.delay(function(d,i) { return i * delay / data[0].values.length })
+ .attr('transform', function(d,i) {
+ //return 'translate(' + y(d.y0) + ',0)'
+ //return 'translate(' + y(d.y0) + ',' + x(getX(d,i)) + ')'
+ return 'translate(' + y(d.y1) + ',' + x(getX(d,i)) + ')'
+ })
+ .select('rect')
+ .attr('width', function(d,i) {
+ return Math.abs(y(getY(d,i) + d.y0) - y(d.y0))
+ })
+ .attr('height', x.rangeBand() );
+ else
+ d3.transition(bars)
+ //.delay(function(d,i) { return i * delay / data[0].values.length })
+ .attr('transform', function(d,i) {
+ //TODO: stacked must be all positive or all negative, not both?
+ return 'translate(' +
+ (getY(d,i) < 0 ? y(getY(d,i)) : y(0))
+ + ',' +
+ (d.series * x.rangeBand() / data.length
+ +
+ x(getX(d,i)) )
+ + ')'
+ })
+ .select('rect')
+ .attr('height', x.rangeBand() / data.length )
+ .attr('width', function(d,i) {
+ return Math.max(Math.abs(y(getY(d,i)) - y(0)),1)
+ });
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.stacked = function(_) {
+ if (!arguments.length) return stacked;
+ stacked = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.barColor = function(_) {
+ if (!arguments.length) return barColor;
+ barColor = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.disabled = function(_) {
+ if (!arguments.length) return disabled;
+ disabled = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.delay = function(_) {
+ if (!arguments.length) return delay;
+ delay = _;
+ return chart;
+ };
+
+ chart.showValues = function(_) {
+ if (!arguments.length) return showValues;
+ showValues = _;
+ return chart;
+ };
+
+ chart.valueFormat= function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.valuePadding = function(_) {
+ if (!arguments.length) return valuePadding;
+ valuePadding = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.multiBarHorizontalChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var multibar = nv.models.multiBarHorizontal()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend().height(30)
+ , controls = nv.models.legend().height(30)
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , showControls = true
+ , showLegend = true
+ , logScale = false
+ , stacked = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph, logScale) {
+ //alert(y+ " " + logScale + " " + Math.pow(10,y) + " " + Math.pow(10,y).toFixed(0));
+ if(logScale) {
+ //var fmt = d3.format(',.2f');
+ return '<h3>' + key + ' - ' + x + '</h3>' +
+ '<p>' + yAxis.tickFormat()(Math.pow(10,y)) + '</p>'
+ } else {
+ return '<h3>' + key + ' - ' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , state = { stacked: stacked }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = function() { return showControls ? 180 : 0 }
+ ;
+
+ multibar
+ .stacked(stacked)
+ ;
+ xAxis
+ .orient('left')
+ .tickPadding(5)
+ .highlightZero(false)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient('bottom')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ //var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ //alert(offsetElement.offsetLeft + " " + e.pos[0]);
+ var leftPos = 0;
+ if(e.pos[0] >=200) leftPos = 200;
+ else leftPos = e.pos[0];
+ if(logScale)
+ y = multibar.y()(e.point, e.pointIndex);
+ else
+ y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex))
+ var left = leftPos + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart, logScale);
+ //alert("from tooltip " + multibar.y()(e.point, e.pointIndex));
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = multibar.xScale();
+ y = multibar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multiBarHorizontalChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarHorizontalChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth - controlWidth());
+
+ if (multibar.barColor())
+ data.forEach(function(series,i) {
+ series.color = d3.rgb('#ccc').darker(i * 1.5).toString();
+ })
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Grouped', disabled: multibar.stacked() },
+ { key: 'Stacked', disabled: !multibar.stacked() }
+ ];
+
+ controls.width(controlWidth()).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ multibar
+ .disabled(data.map(function(series) { return series.disabled }))
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(barsWrap).call(multibar);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableHeight / 24 )
+ .tickSize(-availableWidth, 0);
+
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+ var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
+
+ xTicks
+ .selectAll('line, text')
+ .style('opacity', 1)
+
+
+ yAxis
+ .scale(y)
+ .ticks( availableWidth / 100 )
+ .tickSize( -availableHeight, 0);
+
+ g.select('.nv-y.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Grouped':
+ multibar.stacked(false);
+ break;
+ case 'Stacked':
+ multibar.stacked(true);
+ break;
+ }
+
+ state.stacked = multibar.stacked();
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.stacked !== 'undefined') {
+ multibar.stacked(e.stacked);
+ state.stacked = e.stacked;
+ }
+
+ selection.call(chart);
+ });
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ multibar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ multibar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.multibar = multibar;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'forceX', 'forceY', 'clipEdge', 'id', 'delay', 'showValues', 'valueFormat', 'stacked', 'barColor');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.logScale = function(_) {
+ if (!arguments.length) return logScale;
+ logScale = _;
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+nv.models.multiChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60},
+ color = d3.scale.category20().range(),
+ width = null,
+ height = null,
+ showLegend = true,
+ tooltips = true,
+ tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ },
+ x, y; //can be accessed via chart.lines.[x/y]Scale()
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x = d3.scale.linear(),
+ yScale1 = d3.scale.linear(),
+ yScale2 = d3.scale.linear(),
+
+ lines1 = nv.models.line().yScale(yScale1),
+ lines2 = nv.models.line().yScale(yScale2),
+
+ bars1 = nv.models.multiBar().stacked(false).yScale(yScale1),
+ bars2 = nv.models.multiBar().stacked(false).yScale(yScale2),
+
+ stack1 = nv.models.stackedArea().yScale(yScale1),
+ stack2 = nv.models.stackedArea().yScale(yScale2),
+
+ xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5),
+ yAxis1 = nv.models.axis().scale(yScale1).orient('left'),
+ yAxis2 = nv.models.axis().scale(yScale2).orient('right'),
+
+ legend = nv.models.legend().height(30),
+ dispatch = d3.dispatch('tooltipShow', 'tooltipHide');
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines1.x()(e.point, e.pointIndex)),
+ y = ((e.series.yAxis == 2) ? yAxis2 : yAxis1).tickFormat()(lines1.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, undefined, undefined, offsetElement.offsetParent);
+ };
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ var dataLines1 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 1})
+ var dataLines2 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 2})
+ var dataBars1 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 1})
+ var dataBars2 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 2})
+ var dataStack1 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 1})
+ var dataStack2 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 2})
+
+ var series1 = data.filter(function(d) {return !d.disabled && d.yAxis == 1})
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: d.x, y: d.y }
+ })
+ })
+
+ var series2 = data.filter(function(d) {return !d.disabled && d.yAxis == 2})
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: d.x, y: d.y }
+ })
+ })
+
+ x .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } ))
+ .range([0, availableWidth]);
+
+ var wrap = container.selectAll('g.wrap.multiChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 multiChart').append('g');
+
+ gEnter.append('g').attr('class', 'x axis');
+ gEnter.append('g').attr('class', 'y1 axis');
+ gEnter.append('g').attr('class', 'y2 axis');
+ gEnter.append('g').attr('class', 'lines1Wrap');
+ gEnter.append('g').attr('class', 'lines2Wrap');
+ gEnter.append('g').attr('class', 'bars1Wrap');
+ gEnter.append('g').attr('class', 'bars2Wrap');
+ gEnter.append('g').attr('class', 'stack1Wrap');
+ gEnter.append('g').attr('class', 'stack2Wrap');
+ gEnter.append('g').attr('class', 'legendWrap');
+
+ var g = wrap.select('g');
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.yAxis == 1 ? '' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+
+ lines1
+ .width(availableWidth)
+ .height(availableHeight)
+ .interpolate("monotone")
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'line'}));
+
+ lines2
+ .width(availableWidth)
+ .height(availableHeight)
+ .interpolate("monotone")
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'line'}));
+
+ bars1
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'bar'}));
+
+ bars2
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'bar'}));
+
+ stack1
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'area'}));
+
+ stack2
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'area'}));
+
+ g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ var lines1Wrap = g.select('.lines1Wrap')
+ .datum(dataLines1)
+ var bars1Wrap = g.select('.bars1Wrap')
+ .datum(dataBars1)
+ var stack1Wrap = g.select('.stack1Wrap')
+ .datum(dataStack1)
+
+ var lines2Wrap = g.select('.lines2Wrap')
+ .datum(dataLines2)
+ var bars2Wrap = g.select('.bars2Wrap')
+ .datum(dataBars2)
+ var stack2Wrap = g.select('.stack2Wrap')
+ .datum(dataStack2)
+
+ var extraValue1 = dataStack1.length ? dataStack1.map(function(a){return a.values}).reduce(function(a,b){
+ return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}})
+ }).concat([{x:0, y:0}]) : []
+ var extraValue2 = dataStack2.length ? dataStack2.map(function(a){return a.values}).reduce(function(a,b){
+ return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}})
+ }).concat([{x:0, y:0}]) : []
+
+ yScale1 .domain(d3.extent(d3.merge(series1).concat(extraValue1), function(d) { return d.y } ))
+ .range([0, availableHeight])
+
+ yScale2 .domain(d3.extent(d3.merge(series2).concat(extraValue2), function(d) { return d.y } ))
+ .range([0, availableHeight])
+
+ lines1.yDomain(yScale1.domain())
+ bars1.yDomain(yScale1.domain())
+ stack1.yDomain(yScale1.domain())
+
+ lines2.yDomain(yScale2.domain())
+ bars2.yDomain(yScale2.domain())
+ stack2.yDomain(yScale2.domain())
+
+ if(dataStack1.length){d3.transition(stack1Wrap).call(stack1);}
+ if(dataStack2.length){d3.transition(stack2Wrap).call(stack2);}
+
+ if(dataBars1.length){d3.transition(bars1Wrap).call(bars1);}
+ if(dataBars2.length){d3.transition(bars2Wrap).call(bars2);}
+
+ if(dataLines1.length){d3.transition(lines1Wrap).call(lines1);}
+ if(dataLines2.length){d3.transition(lines2Wrap).call(lines2);}
+
+
+
+ xAxis
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.x.axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+ d3.transition(g.select('.x.axis'))
+ .call(xAxis);
+
+ yAxis1
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+
+ d3.transition(g.select('.y1.axis'))
+ .call(yAxis1);
+
+ yAxis2
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.y2.axis'))
+ .call(yAxis2);
+
+ g.select('.y2.axis')
+ .style('opacity', series2.length ? 1 : 0)
+ .attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+ if (series2.length <= 0) {
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.series').classed('disabled', false);
+ return d;
+ });
+ }
+ chart.update();
+ }
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ stack1.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ if (!Math.round(stack1.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stack1.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ stack2.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ if (!Math.round(stack2.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stack2.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+
+
+ //============================================================
+ // Global getters and setters
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.lines1 = lines1;
+ chart.lines2 = lines2;
+ chart.bars1 = bars1;
+ chart.bars2 = bars2;
+ chart.stack1 = stack1;
+ chart.stack2 = stack2;
+ chart.xAxis = xAxis;
+ chart.yAxis1 = yAxis1;
+ chart.yAxis2 = yAxis2;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines1.x(_);
+ bars1.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines1.y(_);
+ bars1.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = _;
+ legend.color(_);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ return chart;
+}
+
+
+nv.models.ohlcBar = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , getOpen = function(d) { return d.open }
+ , getClose = function(d) { return d.close }
+ , getHigh = function(d) { return d.high }
+ , getLow = function(d) { return d.low }
+ , forceX = []
+ , forceY = []
+ , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart
+ , clipEdge = true
+ , color = nv.utils.defaultColor()
+ , xDomain
+ , yDomain
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ //TODO: store old scales for transitions
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) ));
+
+ if (padData)
+ x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range([0, availableWidth]);
+
+ y .domain(yDomain || [
+ d3.min(data[0].values.map(getLow).concat(forceY)),
+ d3.max(data[0].values.map(getHigh).concat(forceY))
+ ])
+ .range([availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-ohlcBar').data([data[0].values]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-ohlcBar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-ticks');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-chart-clip-path-' + id)
+ .append('rect');
+
+ wrap.select('#nv-chart-clip-path-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : '');
+
+
+
+ var ticks = wrap.select('.nv-ticks').selectAll('.nv-tick')
+ .data(function(d) { return d });
+
+ ticks.exit().remove();
+
+
+ var ticksEnter = ticks.enter().append('path')
+ .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i })
+ .attr('d', function(d,i) {
+ var w = (availableWidth / data[0].values.length) * .9;
+ return 'm0,0l0,'
+ + (y(getOpen(d,i))
+ - y(getHigh(d,i)))
+ + 'l'
+ + (-w/2)
+ + ',0l'
+ + (w/2)
+ + ',0l0,'
+ + (y(getLow(d,i)) - y(getOpen(d,i)))
+ + 'l0,'
+ + (y(getClose(d,i))
+ - y(getLow(d,i)))
+ + 'l'
+ + (w/2)
+ + ',0l'
+ + (-w/2)
+ + ',0z';
+ })
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; })
+ //.attr('fill', function(d,i) { return color[0]; })
+ //.attr('stroke', function(d,i) { return color[0]; })
+ //.attr('x', 0 )
+ //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) })
+ .on('mouseover', function(d,i) {
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ point: d,
+ series: data[0],
+ pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ point: d,
+ series: data[0],
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ ticks
+ .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i })
+ d3.transition(ticks)
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; })
+ .attr('d', function(d,i) {
+ var w = (availableWidth / data[0].values.length) * .9;
+ return 'm0,0l0,'
+ + (y(getOpen(d,i))
+ - y(getHigh(d,i)))
+ + 'l'
+ + (-w/2)
+ + ',0l'
+ + (w/2)
+ + ',0l0,'
+ + (y(getLow(d,i))
+ - y(getOpen(d,i)))
+ + 'l0,'
+ + (y(getClose(d,i))
+ - y(getLow(d,i)))
+ + 'l'
+ + (w/2)
+ + ',0l'
+ + (-w/2)
+ + ',0z';
+ })
+ //.attr('width', (availableWidth / data[0].values.length) * .9 )
+
+
+ //d3.transition(ticks)
+ //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) });
+ //.order(); // not sure if this makes any sense for this model
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.open = function(_) {
+ if (!arguments.length) return getOpen;
+ getOpen = _;
+ return chart;
+ };
+
+ chart.close = function(_) {
+ if (!arguments.length) return getClose;
+ getClose = _;
+ return chart;
+ };
+
+ chart.high = function(_) {
+ if (!arguments.length) return getHigh;
+ getHigh = _;
+ return chart;
+ };
+
+ chart.low = function(_) {
+ if (!arguments.length) return getLow;
+ getLow = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+nv.models.pie = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 500
+ , height = 500
+ , getValues = function(d) { return d.values }
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , getDescription = function(d) { return d.description }
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , color = nv.utils.defaultColor()
+ , valueFormat = d3.format(',.2f')
+ , showLabels = true
+ , pieLabelsOutside = true
+ , donutLabelsOutside = false
+ , labelThreshold = .02 //if slice percentage is under this, don't show label
+ , donut = false
+ , labelSunbeamLayout = false
+ , startAngle = false
+ , endAngle = false
+ , donutRatio = 0.5
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ radius = Math.min(availableWidth, availableHeight) / 2,
+ arcRadius = radius-(radius / 5),
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ //var wrap = container.selectAll('.nv-wrap.nv-pie').data([data]);
+ var wrap = container.selectAll('.nv-wrap.nv-pie').data([getValues(data[0])]);
+ var wrapEnter = wrap.enter().append('g').attr('class','nvd3 nv-wrap nv-pie nv-chart-' + id);
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-pie');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+ g.select('.nv-pie').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ var arc = d3.svg.arc()
+ .outerRadius(arcRadius);
+
+ if (startAngle) arc.startAngle(startAngle)
+ if (endAngle) arc.endAngle(endAngle);
+ if (donut) arc.innerRadius(radius * donutRatio);
+
+ // Setup the Pie chart and choose the data element
+ var pie = d3.layout.pie()
+ .sort(null)
+ .value(function(d) { return d.disabled ? 0 : getY(d) });
+
+ var slices = wrap.select('.nv-pie').selectAll('.nv-slice')
+ .data(pie);
+
+ slices.exit().remove();
+
+ var ae = slices.enter().append('g')
+ .attr('class', 'nv-slice')
+ .on('mouseover', function(d,i){
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ pointIndex: i,
+ pos: [d3.event.pageX, d3.event.pageY],
+ id: id
+ });
+ })
+ .on('mouseout', function(d,i){
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ id: id
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ slices
+ .attr('fill', function(d,i) { return color(d, i); })
+ .attr('stroke', function(d,i) { return color(d, i); });
+
+ var paths = ae.append('path')
+ .each(function(d) { this._current = d; });
+ //.attr('d', arc);
+
+ d3.transition(slices.select('path'))
+ .attr('d', arc)
+ .attrTween('d', arcTween);
+
+ if (showLabels) {
+ // This does the normal label
+ var labelsArc = d3.svg.arc().innerRadius(0);
+
+ if (pieLabelsOutside){ labelsArc = arc; }
+
+ if (donutLabelsOutside) { labelsArc = d3.svg.arc().outerRadius(arc.outerRadius()); }
+
+ ae.append("g").classed("nv-label", true)
+ .each(function(d, i) {
+ var group = d3.select(this);
+
+ group
+ .attr('transform', function(d) {
+ if (labelSunbeamLayout) {
+ d.outerRadius = arcRadius + 10; // Set Outer Coordinate
+ d.innerRadius = arcRadius + 15; // Set Inner Coordinate
+ var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
+ if ((d.startAngle+d.endAngle)/2 < Math.PI) {
+ rotateAngle -= 90;
+ } else {
+ rotateAngle += 90;
+ }
+ return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
+ } else {
+ d.outerRadius = radius + 10; // Set Outer Coordinate
+ d.innerRadius = radius + 15; // Set Inner Coordinate
+ return 'translate(' + labelsArc.centroid(d) + ')'
+ }
+ });
+
+ group.append('rect')
+ .style('stroke', '#fff')
+ .style('fill', '#fff')
+ .attr("rx", 3)
+ .attr("ry", 3);
+
+ group.append('text')
+ .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
+ .style('fill', '#000')
+
+
+ });
+
+ slices.select(".nv-label").transition()
+ .attr('transform', function(d) {
+ if (labelSunbeamLayout) {
+ d.outerRadius = arcRadius + 10; // Set Outer Coordinate
+ d.innerRadius = arcRadius + 15; // Set Inner Coordinate
+ var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
+ if ((d.startAngle+d.endAngle)/2 < Math.PI) {
+ rotateAngle -= 90;
+ } else {
+ rotateAngle += 90;
+ }
+ return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
+ } else {
+ d.outerRadius = radius + 10; // Set Outer Coordinate
+ d.innerRadius = radius + 15; // Set Inner Coordinate
+ return 'translate(' + labelsArc.centroid(d) + ')'
+ }
+ });
+
+ slices.each(function(d, i) {
+ var slice = d3.select(this);
+
+ slice
+ .select(".nv-label text")
+ .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
+ .text(function(d, i) {
+ var percent = (d.endAngle - d.startAngle) / (2 * Math.PI);
+ return (d.value && percent > labelThreshold) ? getX(d.data) : '';
+ });
+
+ var textBox = slice.select('text').node().getBBox();
+ slice.select(".nv-label rect")
+ .attr("width", textBox.width + 10)
+ .attr("height", textBox.height + 10)
+ .attr("transform", function() {
+ return "translate(" + [textBox.x - 5, textBox.y - 5] + ")";
+ });
+ });
+ }
+
+
+ // Computes the angle of an arc, converting from radians to degrees.
+ function angle(d) {
+ var a = (d.startAngle + d.endAngle) * 90 / Math.PI - 90;
+ return a > 90 ? a - 180 : a;
+ }
+
+ function arcTween(a) {
+ a.endAngle = isNaN(a.endAngle) ? 0 : a.endAngle;
+ a.startAngle = isNaN(a.startAngle) ? 0 : a.startAngle;
+ if (!donut) a.innerRadius = 0;
+ var i = d3.interpolate(this._current, a);
+ this._current = i(0);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+
+ function tweenPie(b) {
+ b.innerRadius = 0;
+ var i = d3.interpolate({startAngle: 0, endAngle: 0}, b);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.values = function(_) {
+ if (!arguments.length) return getValues;
+ getValues = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.description = function(_) {
+ if (!arguments.length) return getDescription;
+ getDescription = _;
+ return chart;
+ };
+
+ chart.showLabels = function(_) {
+ if (!arguments.length) return showLabels;
+ showLabels = _;
+ return chart;
+ };
+
+ chart.labelSunbeamLayout = function(_) {
+ if (!arguments.length) return labelSunbeamLayout;
+ labelSunbeamLayout = _;
+ return chart;
+ };
+
+ chart.donutLabelsOutside = function(_) {
+ if (!arguments.length) return donutLabelsOutside;
+ donutLabelsOutside = _;
+ return chart;
+ };
+
+ chart.pieLabelsOutside = function(_) {
+ if (!arguments.length) return pieLabelsOutside;
+ pieLabelsOutside = _;
+ return chart;
+ };
+
+ chart.donut = function(_) {
+ if (!arguments.length) return donut;
+ donut = _;
+ return chart;
+ };
+
+ chart.donutRatio = function(_) {
+ if (!arguments.length) return donutRatio;
+ donutRatio = _;
+ return chart;
+ };
+
+ chart.startAngle = function(_) {
+ if (!arguments.length) return startAngle;
+ startAngle = _;
+ return chart;
+ };
+
+ chart.endAngle = function(_) {
+ if (!arguments.length) return endAngle;
+ endAngle = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.valueFormat = function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.labelThreshold = function(_) {
+ if (!arguments.length) return labelThreshold;
+ labelThreshold = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
+nv.models.pieChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var pie = nv.models.pie()
+ , legend = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 20, left: 20}
+ , width = null
+ , height = null
+ , showLegend = true
+ , color = nv.utils.defaultColor()
+ , tooltips = true
+ , tooltip = function(key, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , state = {}
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var tooltipLabel = pie.description()(e.point) || pie.x()(e.point)
+ var left = e.pos[0] + ( (offsetElement && offsetElement.offsetLeft) || 0 ),
+ top = e.pos[1] + ( (offsetElement && offsetElement.offsetTop) || 0),
+ y = pie.valueFormat()(pie.y()(e.point)),
+ content = tooltip(tooltipLabel, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data[0].map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data[0] || !data[0].length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-pieChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-pieChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-pieWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend
+ .width( availableWidth )
+ .key(pie.x());
+
+ wrap.select('.nv-legendWrap')
+ .datum(pie.values()(data[0]))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ pie
+ .width(availableWidth)
+ .height(availableHeight);
+
+
+ var pieWrap = g.select('.nv-pieWrap')
+ .datum(data);
+
+ d3.transition(pieWrap).call(pie);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i, that) {
+ d.disabled = !d.disabled;
+
+ if (!pie.values()(data[0]).filter(function(d) { return !d.disabled }).length) {
+ pie.values()(data[0]).map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data[0].map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ pie.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data[0].forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ pie.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.legend = legend;
+ chart.dispatch = dispatch;
+ chart.pie = pie;
+
+ d3.rebind(chart, pie, 'valueFormat', 'values', 'x', 'y', 'description', 'id', 'showLabels', 'donutLabelsOutside', 'pieLabelsOutside', 'donut', 'donutRatio', 'labelThreshold');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ pie.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.scatter = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // chooses color
+ , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , z = d3.scale.linear() //linear because d3.svg.shape.size is treated as area
+ , getX = function(d) { return d.x } // accessor to get the x value
+ , getY = function(d) { return d.y } // accessor to get the y value
+ , getSize = function(d) { return d.size || 1} // accessor to get the point size
+ , getShape = function(d) { return d.shape || 'circle' } // accessor to get point shape
+ , onlyCircles = true // Set to false to use shapes
+ , forceX = [] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.)
+ , forceY = [] // List of numbers to Force into the Y scale
+ , forceSize = [] // List of numbers to Force into the Size scale
+ , interactive = true // If true, plots a voronoi overlay for advanced point intersection
+ , pointKey = null
+ , pointActive = function(d) { return !d.notActive } // any points that return false will be filtered out
+ , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart
+ , padDataOuter = .1 //outerPadding to imitate ordinal scale outer padding
+ , clipEdge = false // if true, masks points within x and y scale
+ , clipVoronoi = true // if true, masks each point with a circle... can turn off to slightly increase performance
+ , clipRadius = function() { return 25 } // function to get the radius for voronoi point clips
+ , xDomain = null // Override x domain (skips the calculation from data)
+ , yDomain = null // Override y domain
+ , sizeDomain = null // Override point size domain
+ , sizeRange = null
+ , singlePoint = false
+ , dispatch = d3.dispatch('elementClick', 'elementMouseover', 'elementMouseout')
+ , useVoronoi = true
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0, z0 // used to store previous scales
+ , timeoutID
+ , needsUpdate = false // Flag for when the points are visually updating, but the interactive layer is behind, to disable tooltips
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //add series index to each data point for reference
+ data = data.map(function(series, i) {
+ series.values = series.values.map(function(point) {
+ point.series = i;
+ return point;
+ });
+ return series;
+ });
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain && sizeDomain) ? [] : // if we know xDomain and yDomain and sizeDomain, no need to calculate.... if Size is constant remember to set sizeDomain to speed up performance
+ d3.merge(
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), size: getSize(d,i) }
+ })
+ })
+ );
+
+ x .domain(xDomain || d3.extent(seriesData.map(function(d) { return d.x; }).concat(forceX)))
+
+ if (padData && data[0])
+ x.range([(availableWidth * padDataOuter + availableWidth) / (2 *data[0].values.length), availableWidth - availableWidth * (1 + padDataOuter) / (2 * data[0].values.length) ]);
+ //x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range([0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(seriesData.map(function(d) { return d.y }).concat(forceY)))
+ .range([availableHeight, 0]);
+
+ z .domain(sizeDomain || d3.extent(seriesData.map(function(d) { return d.size }).concat(forceSize)))
+ .range(sizeRange || [16, 256]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ if ( isNaN(x.domain()[0])) {
+ x.domain([-1,1]);
+ }
+
+ if ( isNaN(y.domain()[0])) {
+ y.domain([-1,1]);
+ }
+
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+ z0 = z0 || z;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatter').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatter nv-chart-' + id + (singlePoint ? ' nv-single-point' : ''));
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+ gEnter.append('g').attr('class', 'nv-point-paths');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+ function updateInteractiveLayer() {
+
+ if (!interactive) return false;
+
+ var eventElements;
+
+ var vertices = d3.merge(data.map(function(group, groupIndex) {
+ return group.values
+ .map(function(point, pointIndex) {
+ // *Adding noise to make duplicates very unlikely
+ // *Injecting series and point index for reference
+ /* *Adding a 'jitter' to the points, because there's an issue in d3.geom.voronoi.
+ */
+ var pX = getX(point,pointIndex) + Math.random() * 1e-7;
+ var pY = getY(point,pointIndex) + Math.random() * 1e-7;
+
+ return [x(pX),
+ y(pY),
+ groupIndex,
+ pointIndex, point]; //temp hack to add noise untill I think of a better way so there are no duplicates
+ })
+ .filter(function(pointArray, pointIndex) {
+ return pointActive(pointArray[4], pointIndex); // Issue #237.. move filter to after map, so pointIndex is correct!
+ })
+ })
+ );
+
+
+
+ //inject series and point index for reference into voronoi
+ if (useVoronoi === true) {
+
+ if (clipVoronoi) {
+ var pointClipsEnter = wrap.select('defs').selectAll('.nv-point-clips')
+ .data([id])
+ .enter();
+
+ pointClipsEnter.append('clipPath')
+ .attr('class', 'nv-point-clips')
+ .attr('id', 'nv-points-clip-' + id);
+
+ var pointClips = wrap.select('#nv-points-clip-' + id).selectAll('circle')
+ .data(vertices);
+ pointClips.enter().append('circle')
+ .attr('r', clipRadius);
+ pointClips.exit().remove();
+ pointClips
+ .attr('cx', function(d) { return d[0] })
+ .attr('cy', function(d) { return d[1] });
+
+ wrap.select('.nv-point-paths')
+ .attr('clip-path', 'url(#nv-points-clip-' + id + ')');
+ }
+
+
+ if(vertices.length) {
+ // Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work
+ vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]);
+ vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]);
+ vertices.push([x.range()[0] - 20, y.range()[0] + 20, null, null]);
+ vertices.push([x.range()[1] + 20, y.range()[1] - 20, null, null]);
+ }
+
+ var bounds = d3.geom.polygon([
+ [-10,-10],
+ [-10,height + 10],
+ [width + 10,height + 10],
+ [width + 10,-10]
+ ]);
+
+ var voronoi = d3.geom.voronoi(vertices).map(function(d, i) {
+ return {
+ 'data': bounds.clip(d),
+ 'series': vertices[i][2],
+ 'point': vertices[i][3]
+ }
+ });
+
+
+ var pointPaths = wrap.select('.nv-point-paths').selectAll('path')
+ .data(voronoi);
+ pointPaths.enter().append('path')
+ .attr('class', function(d,i) { return 'nv-path-'+i; });
+ pointPaths.exit().remove();
+ pointPaths
+ .attr('d', function(d) {
+ if (d.data.length === 0)
+ return 'M 0 0'
+ else
+ return 'M' + d.data.join('L') + 'Z';
+ });
+
+ pointPaths
+ .on('click', function(d) {
+ if (needsUpdate) return 0;
+ var series = data[d.series],
+ point = series.values[d.point];
+
+ dispatch.elementClick({
+ point: point,
+ series: series,
+ pos: [x(getX(point, d.point)) + margin.left, y(getY(point, d.point)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: d.point
+ });
+ })
+ .on('mouseover', function(d) {
+ if (needsUpdate) return 0;
+ var series = data[d.series],
+ point = series.values[d.point];
+
+ dispatch.elementMouseover({
+ point: point,
+ series: series,
+ pos: [x(getX(point, d.point)) + margin.left, y(getY(point, d.point)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: d.point
+ });
+ })
+ .on('mouseout', function(d, i) {
+ if (needsUpdate) return 0;
+ var series = data[d.series],
+ point = series.values[d.point];
+
+ dispatch.elementMouseout({
+ point: point,
+ series: series,
+ seriesIndex: d.series,
+ pointIndex: d.point
+ });
+ });
+
+
+ } else {
+ /*
+ // bring data in form needed for click handlers
+ var dataWithPoints = vertices.map(function(d, i) {
+ return {
+ 'data': d,
+ 'series': vertices[i][2],
+ 'point': vertices[i][3]
+ }
+ });
+ */
+
+ // add event handlers to points instead voronoi paths
+ wrap.select('.nv-groups').selectAll('.nv-group')
+ .selectAll('.nv-point')
+ //.data(dataWithPoints)
+ //.style('pointer-events', 'auto') // recativate events, disabled by css
+ .on('click', function(d,i) {
+ //nv.log('test', d, i);
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementClick({
+ point: point,
+ series: series,
+ pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ })
+ .on('mouseover', function(d,i) {
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementMouseover({
+ point: point,
+ series: series,
+ pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ })
+ .on('mouseout', function(d,i) {
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementMouseout({
+ point: point,
+ series: series,
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ });
+ }
+
+ needsUpdate = false;
+ }
+
+ needsUpdate = true;
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover });
+ d3.transition(groups)
+ .style('fill', function(d,i) { return color(d, i) })
+ .style('stroke', function(d,i) { return color(d, i) })
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .5);
+
+
+ if (onlyCircles) {
+
+ var points = groups.selectAll('circle.nv-point')
+ .data(function(d) { return d.values }, pointKey);
+ points.enter().append('circle')
+ .attr('cx', function(d,i) { return x0(getX(d,i)) })
+ .attr('cy', function(d,i) { return y0(getY(d,i)) })
+ .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) });
+ points.exit().remove();
+ groups.exit().selectAll('path.nv-point').transition()
+ .attr('cx', function(d,i) { return x(getX(d,i)) })
+ .attr('cy', function(d,i) { return y(getY(d,i)) })
+ .remove();
+ points.each(function(d,i) {
+ d3.select(this)
+ .classed('nv-point', true)
+ .classed('nv-point-' + i, true);
+ });
+ points.transition()
+ .attr('cx', function(d,i) { return x(getX(d,i)) })
+ .attr('cy', function(d,i) { return y(getY(d,i)) })
+ .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) });
+
+ } else {
+
+ var points = groups.selectAll('path.nv-point')
+ .data(function(d) { return d.values });
+ points.enter().append('path')
+ .attr('transform', function(d,i) {
+ return 'translate(' + x0(getX(d,i)) + ',' + y0(getY(d,i)) + ')'
+ })
+ .attr('d',
+ d3.svg.symbol()
+ .type(getShape)
+ .size(function(d,i) { return z(getSize(d,i)) })
+ );
+ points.exit().remove();
+ d3.transition(groups.exit().selectAll('path.nv-point'))
+ .attr('transform', function(d,i) {
+ return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
+ })
+ .remove();
+ points.each(function(d,i) {
+ d3.select(this)
+ .classed('nv-point', true)
+ .classed('nv-point-' + i, true);
+ });
+ points.transition()
+ .attr('transform', function(d,i) {
+ //nv.log(d,i,getX(d,i), x(getX(d,i)));
+ return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
+ })
+ .attr('d',
+ d3.svg.symbol()
+ .type(getShape)
+ .size(function(d,i) { return z(getSize(d,i)) })
+ );
+ }
+
+
+ // Delay updating the invisible interactive layer for smoother animation
+ clearTimeout(timeoutID); // stop repeat calls to updateInteractiveLayer
+ timeoutID = setTimeout(updateInteractiveLayer, 300);
+ //updateInteractiveLayer();
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+ z0 = z.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('elementMouseover.point', function(d) {
+ if (interactive)
+ d3.select('.nv-chart-' + id + ' .nv-series-' + d.seriesIndex + ' .nv-point-' + d.pointIndex)
+ .classed('hover', true);
+ });
+
+ dispatch.on('elementMouseout.point', function(d) {
+ if (interactive)
+ d3.select('.nv-chart-' + id + ' .nv-series-' + d.seriesIndex + ' .nv-point-' + d.pointIndex)
+ .classed('hover', false);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.size = function(_) {
+ if (!arguments.length) return getSize;
+ getSize = d3.functor(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.zScale = function(_) {
+ if (!arguments.length) return z;
+ z = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.sizeDomain = function(_) {
+ if (!arguments.length) return sizeDomain;
+ sizeDomain = _;
+ return chart;
+ };
+
+ chart.sizeRange = function(_) {
+ if (!arguments.length) return sizeRange;
+ sizeRange = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.forceSize = function(_) {
+ if (!arguments.length) return forceSize;
+ forceSize = _;
+ return chart;
+ };
+
+ chart.interactive = function(_) {
+ if (!arguments.length) return interactive;
+ interactive = _;
+ return chart;
+ };
+
+ chart.pointKey = function(_) {
+ if (!arguments.length) return pointKey;
+ pointKey = _;
+ return chart;
+ };
+
+ chart.pointActive = function(_) {
+ if (!arguments.length) return pointActive;
+ pointActive = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.padDataOuter = function(_) {
+ if (!arguments.length) return padDataOuter;
+ padDataOuter = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.clipVoronoi= function(_) {
+ if (!arguments.length) return clipVoronoi;
+ clipVoronoi = _;
+ return chart;
+ };
+
+ chart.useVoronoi= function(_) {
+ if (!arguments.length) return useVoronoi;
+ useVoronoi = _;
+ if (useVoronoi === false) {
+ clipVoronoi = false;
+ }
+ return chart;
+ };
+
+ chart.clipRadius = function(_) {
+ if (!arguments.length) return clipRadius;
+ clipRadius = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.shape = function(_) {
+ if (!arguments.length) return getShape;
+ getShape = _;
+ return chart;
+ };
+
+ chart.onlyCircles = function(_) {
+ if (!arguments.length) return onlyCircles;
+ onlyCircles = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.singlePoint = function(_) {
+ if (!arguments.length) return singlePoint;
+ singlePoint = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.scatterChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , distX = nv.models.distribution()
+ , distY = nv.models.distribution()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 75}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale()
+ , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale()
+ , xPadding = 0
+ , yPadding = 0
+ , showDistX = false
+ , showDistY = false
+ , showLegend = true
+ , showControls = !!d3.fisheye
+ , fisheye = 0
+ , pauseFisheye = false
+ , tooltips = true
+ , tooltipX = function(key, x, y) { return '<strong>' + x + '</strong>' }
+ , tooltipY = function(key, x, y) { return '<strong>' + y + '</strong>' }
+ //, tooltip = function(key, x, y) { return '<h3>' + key + '</h3>' }
+ , tooltip = null
+ , state = {}
+ , defaultState = null
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , noData = "No Data Available."
+ ;
+
+ scatter
+ .xScale(x)
+ .yScale(y)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(10)
+ ;
+ yAxis
+ .orient('left')
+ .tickPadding(10)
+ ;
+ distX
+ .axis('x')
+ ;
+ distY
+ .axis('y')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ var showTooltip = function(e, offsetElement) {
+ //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?)
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0),
+ leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ),
+ topY = e.pos[1] + ( offsetElement.offsetTop || 0),
+ xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)),
+ yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex));
+
+ if( tooltipX != null )
+ nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip');
+ if( tooltipY != null )
+ nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip');
+ if( tooltip != null )
+ nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ var controlsData = [
+ { key: 'Magnify', disabled: true }
+ ];
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ // chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id());
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ // background for pointer events
+ gEnter.append('rect').attr('class', 'nvd3 nv-background');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+ gEnter.append('g').attr('class', 'nv-distWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ wrap.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ controls.width(180).color(['#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+ .xDomain(null)
+ .yDomain(null)
+
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+
+ //Adjust for x and y padding
+ if (xPadding) {
+ var xRange = x.domain()[1] - x.domain()[0];
+ scatter.xDomain([x.domain()[0] - (xPadding * xRange), x.domain()[1] + (xPadding * xRange)]);
+ }
+
+ if (yPadding) {
+ var yRange = y.domain()[1] - y.domain()[0];
+ scatter.yDomain([y.domain()[0] - (yPadding * yRange), y.domain()[1] + (yPadding * yRange)]);
+ }
+
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( xAxis.ticks() && xAxis.ticks().length ? xAxis.ticks() : availableWidth / 100 )
+ .tickSize( -availableHeight , 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .call(xAxis);
+
+
+ yAxis
+ .scale(y)
+ .ticks( yAxis.ticks() && yAxis.ticks().length ? yAxis.ticks() : availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .call(yAxis);
+
+
+ if (showDistX) {
+ distX
+ .getData(scatter.x())
+ .scale(x)
+ .width(availableWidth)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionX');
+ g.select('.nv-distributionX')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ }
+
+ if (showDistY) {
+ distY
+ .getData(scatter.y())
+ .scale(y)
+ .width(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionY');
+ g.select('.nv-distributionY')
+ .attr('transform', 'translate(-' + distY.size() + ',0)')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+ //------------------------------------------------------------
+
+
+
+
+ if (d3.fisheye) {
+ g.select('.nv-background')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g.select('.nv-background').on('mousemove', updateFisheye);
+ g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;});
+ scatter.dispatch.on('elementClick.freezeFisheye', function() {
+ pauseFisheye = !pauseFisheye;
+ });
+ }
+
+
+ function updateFisheye() {
+ if (pauseFisheye) {
+ g.select('.nv-point-paths').style('pointer-events', 'all');
+ return false;
+ }
+
+ g.select('.nv-point-paths').style('pointer-events', 'none' );
+
+ var mouse = d3.mouse(this);
+ x.distortion(fisheye).focus(mouse[0]);
+ y.distortion(fisheye).focus(mouse[1]);
+
+ g.select('.nv-scatterWrap')
+ .call(scatter);
+
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ g.select('.nv-distributionX')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ g.select('.nv-distributionY')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ fisheye = d.disabled ? 0 : 2.5;
+ g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all');
+ g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' );
+
+ if (d.disabled) {
+ x.distortion(fisheye).focus(0);
+ y.distortion(fisheye).focus(0);
+
+ g.select('.nv-scatterWrap').call(scatter);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ } else {
+ pauseFisheye = false;
+ }
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendClick', function(d,i, that) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ /*
+ legend.dispatch.on('legendMouseover', function(d, i) {
+ d.hover = true;
+ chart(selection);
+ });
+
+ legend.dispatch.on('legendMouseout', function(d, i) {
+ d.hover = false;
+ chart(selection);
+ });
+ */
+
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', function(d,i) { return e.pos[1] - availableHeight;});
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', e.pos[0] + distX.size());
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', 0);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', distY.size());
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.distX = distX;
+ chart.distY = distY;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ distX.color(color);
+ distY.color(color);
+ return chart;
+ };
+
+ chart.showDistX = function(_) {
+ if (!arguments.length) return showDistX;
+ showDistX = _;
+ return chart;
+ };
+
+ chart.showDistY = function(_) {
+ if (!arguments.length) return showDistY;
+ showDistY = _;
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.fisheye = function(_) {
+ if (!arguments.length) return fisheye;
+ fisheye = _;
+ return chart;
+ };
+
+ chart.xPadding = function(_) {
+ if (!arguments.length) return xPadding;
+ xPadding = _;
+ return chart;
+ };
+
+ chart.yPadding = function(_) {
+ if (!arguments.length) return yPadding;
+ yPadding = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltipXContent = function(_) {
+ if (!arguments.length) return tooltipX;
+ tooltipX = _;
+ return chart;
+ };
+
+ chart.tooltipYContent = function(_) {
+ if (!arguments.length) return tooltipY;
+ tooltipY = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.scatterPlusLineChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , distX = nv.models.distribution()
+ , distY = nv.models.distribution()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 75}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale()
+ , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale()
+ , showDistX = false
+ , showDistY = false
+ , showLegend = true
+ , showControls = !!d3.fisheye
+ , fisheye = 0
+ , pauseFisheye = false
+ , tooltips = true
+ , tooltipX = function(key, x, y) { return '<strong>' + x + '</strong>' }
+ , tooltipY = function(key, x, y) { return '<strong>' + y + '</strong>' }
+ , tooltip = function(key, x, y, date) { return '<h3>' + key + '</h3>'
+ + '<p>' + date + '</p>' }
+ //, tooltip = null
+ , state = {}
+ , defaultState = null
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , noData = "No Data Available."
+ ;
+
+ scatter
+ .xScale(x)
+ .yScale(y)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(10)
+ ;
+ yAxis
+ .orient('left')
+ .tickPadding(10)
+ ;
+ distX
+ .axis('x')
+ ;
+ distY
+ .axis('y')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ var showTooltip = function(e, offsetElement) {
+ //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?)
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0),
+ leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ),
+ topY = e.pos[1] + ( offsetElement.offsetTop || 0),
+ xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)),
+ yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex));
+
+ if( tooltipX != null )
+ nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip');
+ if( tooltipY != null )
+ nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip');
+ if( tooltip != null )
+ nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e.point.tooltip, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ var controlsData = [
+ { key: 'Magnify', disabled: true }
+ ];
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id());
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ // background for pointer events
+ gEnter.append('rect').attr('class', 'nvd3 nv-background')
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+ gEnter.append('g').attr('class', 'nv-regressionLinesWrap');
+ gEnter.append('g').attr('class', 'nv-distWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ wrap.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ controls.width(180).color(['#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+
+ wrap.select('.nv-regressionLinesWrap')
+ .attr('clip-path', 'url(#nv-edge-clip-' + scatter.id() + ')');
+
+ var regWrap = wrap.select('.nv-regressionLinesWrap').selectAll('.nv-regLines')
+ .data(function(d) { return d });
+
+ var reglines = regWrap.enter()
+ .append('g').attr('class', 'nv-regLines')
+ .append('line').attr('class', 'nv-regLine')
+ .style('stroke-opacity', 0);
+
+ //d3.transition(regWrap.selectAll('.nv-regLines line'))
+ regWrap.selectAll('.nv-regLines line')
+ .attr('x1', x.range()[0])
+ .attr('x2', x.range()[1])
+ .attr('y1', function(d,i) { return y(x.domain()[0] * d.slope + d.intercept) })
+ .attr('y2', function(d,i) { return y(x.domain()[1] * d.slope + d.intercept) })
+ .style('stroke', function(d,i,j) { return color(d,j) })
+ .style('stroke-opacity', function(d,i) {
+ return (d.disabled || typeof d.slope === 'undefined' || typeof d.intercept === 'undefined') ? 0 : 1
+ });
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( xAxis.ticks() ? xAxis.ticks() : availableWidth / 100 )
+ .tickSize( -availableHeight , 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .call(xAxis);
+
+
+ yAxis
+ .scale(y)
+ .ticks( yAxis.ticks() ? yAxis.ticks() : availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .call(yAxis);
+
+
+ if (showDistX) {
+ distX
+ .getData(scatter.x())
+ .scale(x)
+ .width(availableWidth)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionX');
+ g.select('.nv-distributionX')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ }
+
+ if (showDistY) {
+ distY
+ .getData(scatter.y())
+ .scale(y)
+ .width(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionY');
+ g.select('.nv-distributionY')
+ .attr('transform', 'translate(-' + distY.size() + ',0)')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+ //------------------------------------------------------------
+
+
+
+
+ if (d3.fisheye) {
+ g.select('.nv-background')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g.select('.nv-background').on('mousemove', updateFisheye);
+ g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;});
+ scatter.dispatch.on('elementClick.freezeFisheye', function() {
+ pauseFisheye = !pauseFisheye;
+ });
+ }
+
+
+ function updateFisheye() {
+ if (pauseFisheye) {
+ g.select('.nv-point-paths').style('pointer-events', 'all');
+ return false;
+ }
+
+ g.select('.nv-point-paths').style('pointer-events', 'none' );
+
+ var mouse = d3.mouse(this);
+ x.distortion(fisheye).focus(mouse[0]);
+ y.distortion(fisheye).focus(mouse[1]);
+
+ g.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ g.select('.nv-distributionX')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ g.select('.nv-distributionY')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ fisheye = d.disabled ? 0 : 2.5;
+ g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all');
+ g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' );
+
+ if (d.disabled) {
+ x.distortion(fisheye).focus(0);
+ y.distortion(fisheye).focus(0);
+
+ g.select('.nv-scatterWrap').call(scatter);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ } else {
+ pauseFisheye = false;
+ }
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendClick', function(d,i, that) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ /*
+ legend.dispatch.on('legendMouseover', function(d, i) {
+ d.hover = true;
+ chart(selection);
+ });
+
+ legend.dispatch.on('legendMouseout', function(d, i) {
+ d.hover = false;
+ chart(selection);
+ });
+ */
+
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', e.pos[1] - availableHeight);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', e.pos[0] + distX.size());
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', 0);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', distY.size());
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.distX = distX;
+ chart.distY = distY;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ distX.color(color);
+ distY.color(color);
+ return chart;
+ };
+
+ chart.showDistX = function(_) {
+ if (!arguments.length) return showDistX;
+ showDistX = _;
+ return chart;
+ };
+
+ chart.showDistY = function(_) {
+ if (!arguments.length) return showDistY;
+ showDistY = _;
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.fisheye = function(_) {
+ if (!arguments.length) return fisheye;
+ fisheye = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltipXContent = function(_) {
+ if (!arguments.length) return tooltipX;
+ tooltipX = _;
+ return chart;
+ };
+
+ chart.tooltipYContent = function(_) {
+ if (!arguments.length) return tooltipY;
+ tooltipY = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.sparkline = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 2, right: 0, bottom: 2, left: 0}
+ , width = 400
+ , height = 32
+ , animate = true
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.getColor(['#000'])
+ , xDomain
+ , yDomain
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data, getX ))
+ .range([0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(data, getY ))
+ .range([availableHeight, 0]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-sparkline').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparkline');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
+
+ //------------------------------------------------------------
+
+
+ var paths = wrap.selectAll('path')
+ .data(function(d) { return [d] });
+ paths.enter().append('path');
+ paths.exit().remove();
+ paths
+ .style('stroke', function(d,i) { return d.color || color(d, i) })
+ .attr('d', d3.svg.line()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ );
+
+
+ // TODO: Add CURRENT data point (Need Min, Mac, Current / Most recent)
+ var points = wrap.selectAll('circle.nv-point')
+ .data(function(data) {
+ var yValues = data.map(function(d, i) { return getY(d,i); });
+ function pointIndex(index) {
+ if (index != -1) {
+ var result = data[index];
+ result.pointIndex = index;
+ return result;
+ } else {
+ return null;
+ }
+ }
+ var maxPoint = pointIndex(yValues.lastIndexOf(y.domain()[1])),
+ minPoint = pointIndex(yValues.indexOf(y.domain()[0])),
+ currentPoint = pointIndex(yValues.length - 1);
+ return [minPoint, maxPoint, currentPoint].filter(function (d) {return d != null;});
+ });
+ points.enter().append('circle');
+ points.exit().remove();
+ points
+ .attr('cx', function(d,i) { return x(getX(d,d.pointIndex)) })
+ .attr('cy', function(d,i) { return y(getY(d,d.pointIndex)) })
+ .attr('r', 2)
+ .attr('class', function(d,i) {
+ return getX(d, d.pointIndex) == x.domain()[1] ? 'nv-point nv-currentValue' :
+ getY(d, d.pointIndex) == y.domain()[0] ? 'nv-point nv-minValue' : 'nv-point nv-maxValue'
+ });
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.animate = function(_) {
+ if (!arguments.length) return animate;
+ animate = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.sparklinePlus = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var sparkline = nv.models.sparkline();
+
+ var margin = {top: 15, right: 100, bottom: 10, left: 50}
+ , width = null
+ , height = null
+ , x
+ , y
+ , index = []
+ , paused = false
+ , xTickFormat = d3.format(',r')
+ , yTickFormat = d3.format(',.2f')
+ , showValue = true
+ , alignValue = true
+ , rightAlignValue = false
+ , noData = "No Data Available."
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ var currentValue = sparkline.y()(data[data.length-1], data.length-1);
+
+ //------------------------------------------------------------
+
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = sparkline.xScale();
+ y = sparkline.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-sparklineplus').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparklineplus');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-sparklineWrap');
+ gEnter.append('g').attr('class', 'nv-valueWrap');
+ gEnter.append('g').attr('class', 'nv-hoverArea');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ var sparklineWrap = g.select('.nv-sparklineWrap');
+
+ sparkline
+ .width(availableWidth)
+ .height(availableHeight);
+
+ sparklineWrap
+ .call(sparkline);
+
+ //------------------------------------------------------------
+
+
+ var valueWrap = g.select('.nv-valueWrap');
+
+ var value = valueWrap.selectAll('.nv-currentValue')
+ .data([currentValue]);
+
+ value.enter().append('text').attr('class', 'nv-currentValue')
+ .attr('dx', rightAlignValue ? -8 : 8)
+ .attr('dy', '.9em')
+ .style('text-anchor', rightAlignValue ? 'end' : 'start');
+
+ value
+ .attr('x', availableWidth + (rightAlignValue ? margin.right : 0))
+ .attr('y', alignValue ? function(d) { return y(d) } : 0)
+ .style('fill', sparkline.color()(data[data.length-1], data.length-1))
+ .text(yTickFormat(currentValue));
+
+
+
+ gEnter.select('.nv-hoverArea').append('rect')
+ .on('mousemove', sparklineHover)
+ .on('click', function() { paused = !paused })
+ .on('mouseout', function() { index = []; updateValueLine(); });
+ //.on('mouseout', function() { index = null; updateValueLine(); });
+
+ g.select('.nv-hoverArea rect')
+ .attr('transform', function(d) { return 'translate(' + -margin.left + ',' + -margin.top + ')' })
+ .attr('width', availableWidth + margin.left + margin.right)
+ .attr('height', availableHeight + margin.top);
+
+
+
+ function updateValueLine() { //index is currently global (within the chart), may or may not keep it that way
+ if (paused) return;
+
+ var hoverValue = g.selectAll('.nv-hoverValue').data(index)
+
+ var hoverEnter = hoverValue.enter()
+ .append('g').attr('class', 'nv-hoverValue')
+ .style('stroke-opacity', 0)
+ .style('fill-opacity', 0);
+
+ hoverValue.exit()
+ .transition().duration(250)
+ .style('stroke-opacity', 0)
+ .style('fill-opacity', 0)
+ .remove();
+
+ hoverValue
+ .attr('transform', function(d) { return 'translate(' + x(sparkline.x()(data[d],d)) + ',0)' })
+ .transition().duration(250)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', 1);
+
+ if (!index.length) return;
+
+ hoverEnter.append('line')
+ .attr('x1', 0)
+ .attr('y1', -margin.top)
+ .attr('x2', 0)
+ .attr('y2', availableHeight);
+
+
+ hoverEnter.append('text').attr('class', 'nv-xValue')
+ .attr('x', -6)
+ .attr('y', -margin.top)
+ .attr('text-anchor', 'end')
+ .attr('dy', '.9em')
+
+
+ g.select('.nv-hoverValue .nv-xValue')
+ .text(xTickFormat(sparkline.x()(data[index[0]], index[0])));
+
+ hoverEnter.append('text').attr('class', 'nv-yValue')
+ .attr('x', 6)
+ .attr('y', -margin.top)
+ .attr('text-anchor', 'start')
+ .attr('dy', '.9em')
+
+ g.select('.nv-hoverValue .nv-yValue')
+ .text(yTickFormat(sparkline.y()(data[index[0]], index[0])));
+
+ }
+
+
+ function sparklineHover() {
+ if (paused) return;
+
+ var pos = d3.mouse(this)[0] - margin.left;
+
+ function getClosestIndex(data, x) {
+ var distance = Math.abs(sparkline.x()(data[0], 0) - x);
+ var closestIndex = 0;
+ for (var i = 0; i < data.length; i++){
+ if (Math.abs(sparkline.x()(data[i], i) - x) < distance) {
+ distance = Math.abs(sparkline.x()(data[i], i) - x);
+ closestIndex = i;
+ }
+ }
+ return closestIndex;
+ }
+
+ index = [getClosestIndex(data, Math.round(x.invert(pos)))];
+
+ updateValueLine();
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.sparkline = sparkline;
+
+ d3.rebind(chart, sparkline, 'x', 'y', 'xScale', 'yScale', 'color');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xTickFormat = function(_) {
+ if (!arguments.length) return xTickFormat;
+ xTickFormat = _;
+ return chart;
+ };
+
+ chart.yTickFormat = function(_) {
+ if (!arguments.length) return yTickFormat;
+ yTickFormat = _;
+ return chart;
+ };
+
+ chart.showValue = function(_) {
+ if (!arguments.length) return showValue;
+ showValue = _;
+ return chart;
+ };
+
+ chart.alignValue = function(_) {
+ if (!arguments.length) return alignValue;
+ alignValue = _;
+ return chart;
+ };
+
+ chart.rightAlignValue = function(_) {
+ if (!arguments.length) return rightAlignValue;
+ rightAlignValue = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.stackedArea = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // a function that computes the color
+ , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't selet one
+ , getX = function(d) { return d.x } // accessor to get the x value from a data point
+ , getY = function(d) { return d.y } // accessor to get the y value from a data point
+ , style = 'stack'
+ , offset = 'zero'
+ , order = 'default'
+ , interpolate = 'linear' // controls the line interpolation
+ , clipEdge = false // if true, masks lines within x and y scale
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , yAxisTooltipFormat = d3.format(',.3f')
+ , scatter = nv.models.scatter()
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'areaClick', 'areaMouseover', 'areaMouseout')
+ ;
+
+ scatter
+ .size(2.2) // default size
+ .sizeDomain([2.2,2.2]) // all the same size by default
+ ;
+
+ /************************************
+ * offset:
+ * 'wiggle' (stream)
+ * 'zero' (stacked)
+ * 'expand' (normalize to 100%)
+ * 'silhouette' (simple centered)
+ *
+ * order:
+ * 'inside-out' (stream)
+ * 'default' (input order)
+ ************************************/
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ //------------------------------------------------------------
+
+
+ // Injecting point index into each point because d3.layout.stack().out does not give index
+ // ***Also storing getY(d,i) as stackedY so that it can be set to 0 if series is disabled
+ data = data.map(function(aseries, i) {
+ aseries.values = aseries.values.map(function(d, j) {
+ d.index = j;
+ d.stackedY = aseries.disabled ? 0 : getY(d,j);
+ return d;
+ })
+ return aseries;
+ });
+
+
+ data = d3.layout.stack()
+ .order(order)
+ .offset(offset)
+ .values(function(d) { return d.values }) //TODO: make values customizeable in EVERY model in this fashion
+ .x(getX)
+ .y(function(d) { return d.stackedY })
+ .out(function(d, y0, y) {
+ d.display = {
+ y: y,
+ y0: y0
+ };
+ })
+ (data);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-stackedarea').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedarea');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-areaWrap');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .x(getX)
+ .y(function(d) { return d.display.y + d.display.y0 })
+ .forceY([0])
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+ var scatterWrap = g.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ //d3.transition(scatterWrap).call(scatter);
+ scatterWrap.call(scatter);
+
+
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+
+
+ var area = d3.svg.area()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d) { return y(d.display.y0) })
+ .y1(function(d) { return y(d.display.y + d.display.y0) })
+ .interpolate(interpolate);
+
+ var zeroArea = d3.svg.area()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d) { return y(d.display.y0) })
+ .y1(function(d) { return y(d.display.y0) });
+
+
+ var path = g.select('.nv-areaWrap').selectAll('path.nv-area')
+ .data(function(d) { return d });
+ //.data(function(d) { return d }, function(d) { return d.key });
+ path.enter().append('path').attr('class', function(d,i) { return 'nv-area nv-area-' + i })
+ .on('mouseover', function(d,i) {
+ d3.select(this).classed('hover', true);
+ dispatch.areaMouseover({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.areaMouseout({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ .on('click', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.areaClick({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ //d3.transition(path.exit())
+ path.exit()
+ .attr('d', function(d,i) { return zeroArea(d.values,i) })
+ .remove();
+ path
+ .style('fill', function(d,i){ return d.color || color(d, i) })
+ .style('stroke', function(d,i){ return d.color || color(d, i) });
+ //d3.transition(path)
+ path
+ .attr('d', function(d,i) { return area(d.values,i) })
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseover.area', function(e) {
+ g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', true);
+ });
+ scatter.dispatch.on('elementMouseout.area', function(e) {
+ g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', false);
+ });
+
+ //============================================================
+
+ });
+
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementClick.area', function(e) {
+ dispatch.areaClick(e);
+ })
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Global getters and setters
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+
+ d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius');
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ }
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.offset = function(_) {
+ if (!arguments.length) return offset;
+ offset = _;
+ return chart;
+ };
+
+ chart.order = function(_) {
+ if (!arguments.length) return order;
+ order = _;
+ return chart;
+ };
+
+ //shortcut for offset + order
+ chart.style = function(_) {
+ if (!arguments.length) return style;
+ style = _;
+
+ switch (style) {
+ case 'stack':
+ chart.offset('zero');
+ chart.order('default');
+ break;
+ case 'stream':
+ chart.offset('wiggle');
+ chart.order('inside-out');
+ break;
+ case 'stream-center':
+ chart.offset('silhouette');
+ chart.order('inside-out');
+ break;
+ case 'expand':
+ chart.offset('expand');
+ chart.order('default');
+ break;
+ }
+
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ interpolate = _;
+ return interpolate;
+
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.stackedAreaChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var stacked = nv.models.stackedArea()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 25, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor() // a function that takes in d, i and returns color
+ , showControls = true
+ , showLegend = true
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' on ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , yAxisTickFormat = d3.format(',.2f')
+ , yAxisTooltipFormat = d3.format(',.3f')
+ , state = { style: stacked.style() }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient('left')
+ ;
+ stacked.scatter
+ .pointActive(function(d) {
+ //console.log(stacked.y()(d), !!Math.round(stacked.y()(d) * 100));
+ return !!Math.round(stacked.y()(d) * 100);
+ })
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(stacked.x()(e.point, e.pointIndex)),
+ //y = yAxis.tickFormat()(stacked.y()(e.point, e.pointIndex)),
+ y = yAxisTooltipFormat(stacked.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = stacked.xScale();
+ y = stacked.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-stackedAreaChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedAreaChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-stackedWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend
+ .width( availableWidth - controlWidth );
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + controlWidth + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Stacked', disabled: stacked.offset() != 'zero' },
+ { key: 'Stream', disabled: stacked.offset() != 'wiggle' },
+ { key: 'Expanded', disabled: stacked.offset() != 'expand' }
+ ];
+
+ controls
+ .width( controlWidth )
+ .color(['#444', '#444', '#444']);
+
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .call(controls);
+
+
+ if ( margin.top != Math.max(controls.height(), legend.height()) ) {
+ margin.top = Math.max(controls.height(), legend.height());
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+
+ g.select('.nv-controlsWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ stacked
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var stackedWrap = g.select('.nv-stackedWrap')
+ .datum(data);
+ //d3.transition(stackedWrap).call(stacked);
+ stackedWrap.call(stacked);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize( -availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+ //d3.transition(g.select('.nv-x.nv-axis'))
+ g.select('.nv-x.nv-axis')
+ .transition().duration(0)
+ .call(xAxis);
+
+ yAxis
+ .scale(y)
+ .ticks(stacked.offset() == 'wiggle' ? 0 : availableHeight / 36)
+ .tickSize(-availableWidth, 0)
+ .setTickFormat(stacked.offset() == 'expand' ? d3.format('%') : yAxisTickFormat);
+
+ //d3.transition(g.select('.nv-y.nv-axis'))
+ g.select('.nv-y.nv-axis')
+ .transition().duration(0)
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ stacked.dispatch.on('areaClick.toggle', function(e) {
+ if (data.filter(function(d) { return !d.disabled }).length === 1)
+ data = data.map(function(d) {
+ d.disabled = false;
+ return d
+ });
+ else
+ data = data.map(function(d,i) {
+ d.disabled = (i != e.seriesIndex);
+ return d
+ });
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ //selection.transition().call(chart);
+ chart.update();
+ });
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ //selection.transition().call(chart);
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Stacked':
+ stacked.style('stack');
+ break;
+ case 'Stream':
+ stacked.style('stream');
+ break;
+ case 'Expanded':
+ stacked.style('expand');
+ break;
+ }
+
+ state.style = stacked.style();
+ dispatch.stateChange(state);
+
+ //selection.transition().call(chart);
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.style !== 'undefined') {
+ stacked.style(e.style);
+ }
+
+ chart.update();
+ });
+
+ });
+
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ stacked.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ /*
+ if (!Math.round(stacked.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+ */
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stacked.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.stacked = stacked;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, stacked, 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'sizeDomain', 'interactive', 'offset', 'order', 'style', 'clipEdge', 'forceX', 'forceY', 'forceSize', 'interpolate');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return getWidth;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return getHeight;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ stacked.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.yAxisTooltipFormat = function(_) {
+ if (!arguments.length) return yAxisTooltipFormat;
+ yAxisTooltipFormat = _;
+ return chart;
+ };
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ yAxis.setTickFormat = yAxis.tickFormat;
+
+ yAxis.tickFormat = function(_) {
+ if (!arguments.length) return yAxisTickFormat;
+ yAxisTickFormat = _;
+ return yAxis;
+ };
+
+ //============================================================
+
+ return chart;
+}
+})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/nv.d3.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/nv.d3.min.js
new file mode 100644
index 00000000..892379c4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/nv.d3.min.js
@@ -0,0 +1 @@
+(function(){function t(e,t){return(new Date(t,e+1,0)).getDate()}function n(e,t,n){return function(r,i,s){var o=e(r),u=[];if(o<r)t(o);if(s>1){while(o<i){var a=new Date(+o);if(n(a)%s===0)u.push(a);t(o)}}else{while(o<i){u.push(new Date(+o));t(o)}}return u}}var e=window.nv||{};e.version="1.1.13b";e.dev=true;window.nv=e;e.tooltip={};e.utils=e.utils||{};e.models={};e.charts={};e.graphs=[];e.logs={};e.dispatch=d3.dispatch("render_start","render_end");if(e.dev){e.dispatch.on("render_start",function(t){e.logs.startTime=+(new Date)});e.dispatch.on("render_end",function(t){e.logs.endTime=+(new Date);e.logs.totalTime=e.logs.endTime-e.logs.startTime;e.log("total",e.logs.totalTime)})}e.log=function(){if(e.dev&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(e.dev&&typeof console.log=="function"&&Function.prototype.bind){var t=Function.prototype.bind.call(console.log,console);t.apply(console,arguments)}return arguments[arguments.length-1]};e.render=function(n){n=n||1;e.render.active=true;e.dispatch.render_start();setTimeout(function(){var t,r;for(var i=0;i<n&&(r=e.render.queue[i]);i++){t=r.generate();if(typeof r.callback==typeof Function)r.callback(t);e.graphs.push(t)}e.render.queue.splice(0,i);if(e.render.queue.length)setTimeout(arguments.callee,0);else{e.render.active=false;e.dispatch.render_end()}},0)};e.render.active=false;e.render.queue=[];e.addGraph=function(t){if(typeof arguments[0]===typeof Function)t={generate:arguments[0],callback:arguments[1]};e.render.queue.push(t);if(!e.render.active)e.render()};e.identity=function(e){return e};e.strip=function(e){return e.replace(/(\s|&)/g,"")};d3.time.monthEnd=function(e){return new Date(e.getFullYear(),e.getMonth(),0)};d3.time.monthEnds=n(d3.time.monthEnd,function(e){e.setUTCDate(e.getUTCDate()+1);e.setDate(t(e.getMonth()+1,e.getFullYear()))},function(e){return e.getMonth()});e.interactiveGuideline=function(){"use strict";function c(o){o.each(function(o){function g(){var e=d3.mouse(this);var n=e[0];var r=e[1];var o=true;var a=false;if(l){n=d3.event.offsetX;r=d3.event.offsetY;if(d3.event.target.tagName!=="svg")o=false;if(d3.event.target.className.baseVal.match("nv-legend"))a=true}if(o){n-=i.left;r-=i.top}if(n<0||r<0||n>p||r>d||d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined||a){if(l){if(d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined&&d3.event.relatedTarget.className.match(t.nvPointerEventsClass)){return}}u.elementMouseout({mouseX:n,mouseY:r});c.renderGuideLine(null);return}var f=s.invert(n);u.elementMousemove({mouseX:n,mouseY:r,pointXValue:f});if(d3.event.type==="dblclick"){u.elementDblclick({mouseX:n,mouseY:r,pointXValue:f})}}var h=d3.select(this);var p=n||960,d=r||400;var v=h.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([o]);var m=v.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");m.append("g").attr("class","nv-interactiveGuideLine");if(!f){return}f.on("mousemove",g,true).on("mouseout",g,true).on("dblclick",g);c.renderGuideLine=function(t){if(!a)return;var n=v.select(".nv-interactiveGuideLine").selectAll("line").data(t!=null?[e.utils.NaNtoZero(t)]:[],String);n.enter().append("line").attr("class","nv-guideline").attr("x1",function(e){return e}).attr("x2",function(e){return e}).attr("y1",d).attr("y2",0);n.exit().remove()}})}var t=e.models.tooltip();var n=null,r=null,i={left:0,top:0},s=d3.scale.linear(),o=d3.scale.linear(),u=d3.dispatch("elementMousemove","elementMouseout","elementDblclick"),a=true,f=null;var l=navigator.userAgent.indexOf("MSIE")!==-1;c.dispatch=u;c.tooltip=t;c.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.left=typeof e.left!="undefined"?e.left:i.left;return c};c.width=function(e){if(!arguments.length)return n;n=e;return c};c.height=function(e){if(!arguments.length)return r;r=e;return c};c.xScale=function(e){if(!arguments.length)return s;s=e;return c};c.showGuideLine=function(e){if(!arguments.length)return a;a=e;return c};c.svgContainer=function(e){if(!arguments.length)return f;f=e;return c};return c};e.interactiveBisect=function(e,t,n){"use strict";if(!e instanceof Array)return null;if(typeof n!=="function")n=function(e,t){return e.x};var r=d3.bisector(n).left;var i=d3.max([0,r(e,t)-1]);var s=n(e[i],i);if(typeof s==="undefined")s=i;if(s===t)return i;var o=d3.min([i+1,e.length-1]);var u=n(e[o],o);if(typeof u==="undefined")u=o;if(Math.abs(u-t)>=Math.abs(s-t))return i;else return o};e.nearestValueIndex=function(e,t,n){"use strict";var r=Infinity,i=null;e.forEach(function(e,s){var o=Math.abs(t-e);if(o<=r&&o<n){r=o;i=s}});return i};(function(){"use strict";window.nv.tooltip={};window.nv.models.tooltip=function(){function y(){if(a){var e=d3.select(a);if(e.node().tagName!=="svg"){e=e.select("svg")}var t=e.node()?e.attr("viewBox"):null;if(t){t=t.split(" ");var n=parseInt(e.style("width"))/t[2];l.left=l.left*n;l.top=l.top*n}}}function b(e){var t;if(a)t=d3.select(a);else t=d3.select("body");var n=t.select(".nvtooltip");if(n.node()===null){n=t.append("div").attr("class","nvtooltip "+(u?u:"xy-tooltip")).attr("id",h)}n.node().innerHTML=e;n.style("top",0).style("left",0).style("opacity",0);n.selectAll("div, table, td, tr").classed(p,true);n.classed(p,true);return n.node()}function w(){if(!c)return;if(!g(n))return;y();var t=l.left;var u=o!=null?o:l.top;var h=b(m(n));f=h;if(a){var p=a.getElementsByTagName("svg")[0];var d=p?p.getBoundingClientRect():a.getBoundingClientRect();var v={left:0,top:0};if(p){var E=p.getBoundingClientRect();var S=a.getBoundingClientRect();var x=E.top;if(x<0){var T=a.getBoundingClientRect();x=Math.abs(x)>T.height?0:x}v.top=Math.abs(x-S.top);v.left=Math.abs(E.left-S.left)}t+=a.offsetLeft+v.left-2*a.scrollLeft;u+=a.offsetTop+v.top-2*a.scrollTop}if(s&&s>0){u=Math.floor(u/s)*s}e.tooltip.calcTooltipPosition([t,u],r,i,h);return w}var t=null,n=null,r="w",i=50,s=25,o=null,u=null,a=null,f=null,l={left:null,top:null},c=true,h="nvtooltip-"+Math.floor(Math.random()*1e5);var p="nv-pointer-events-none";var d=function(e,t){return e};var v=function(e){return e};var m=function(e){if(t!=null)return t;if(e==null)return"";var n=d3.select(document.createElement("table"));var r=n.selectAll("thead").data([e]).enter().append("thead");r.append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",true).html(v(e.value));var i=n.selectAll("tbody").data([e]).enter().append("tbody");var s=i.selectAll("tr").data(function(e){return e.series}).enter().append("tr").classed("highlight",function(e){return e.highlight});s.append("td").classed("legend-color-guide",true).append("div").style("background-color",function(e){return e.color});s.append("td").classed("key",true).html(function(e){return e.key});s.append("td").classed("value",true).html(function(e,t){return d(e.value,t)});s.selectAll("td").each(function(e){if(e.highlight){var t=d3.scale.linear().domain([0,1]).range(["#fff",e.color]);var n=.6;d3.select(this).style("border-bottom-color",t(n)).style("border-top-color",t(n))}});var o=n.node().outerHTML;if(e.footer!==undefined)o+="<div class='footer'>"+e.footer+"</div>";return o};var g=function(e){if(e&&e.series&&e.series.length>0)return true;return false};w.nvPointerEventsClass=p;w.content=function(e){if(!arguments.length)return t;t=e;return w};w.tooltipElem=function(){return f};w.contentGenerator=function(e){if(!arguments.length)return m;if(typeof e==="function"){m=e}return w};w.data=function(e){if(!arguments.length)return n;n=e;return w};w.gravity=function(e){if(!arguments.length)return r;r=e;return w};w.distance=function(e){if(!arguments.length)return i;i=e;return w};w.snapDistance=function(e){if(!arguments.length)return s;s=e;return w};w.classes=function(e){if(!arguments.length)return u;u=e;return w};w.chartContainer=function(e){if(!arguments.length)return a;a=e;return w};w.position=function(e){if(!arguments.length)return l;l.left=typeof e.left!=="undefined"?e.left:l.left;l.top=typeof e.top!=="undefined"?e.top:l.top;return w};w.fixedTop=function(e){if(!arguments.length)return o;o=e;return w};w.enabled=function(e){if(!arguments.length)return c;c=e;return w};w.valueFormatter=function(e){if(!arguments.length)return d;if(typeof e==="function"){d=e}return w};w.headerFormatter=function(e){if(!arguments.length)return v;if(typeof e==="function"){v=e}return w};w.id=function(){return h};return w};e.tooltip.show=function(t,n,r,i,s,o){var u=document.createElement("div");u.className="nvtooltip "+(o?o:"xy-tooltip");var a=s;if(!s||s.tagName.match(/g|svg/i)){a=document.getElementsByTagName("body")[0]}u.style.left=0;u.style.top=0;u.style.opacity=0;u.innerHTML=n;a.appendChild(u);if(s){t[0]=t[0]-s.scrollLeft;t[1]=t[1]-s.scrollTop}e.tooltip.calcTooltipPosition(t,r,i,u)};e.tooltip.findFirstNonSVGParent=function(e){while(e.tagName.match(/^g|svg$/i)!==null){e=e.parentNode}return e};e.tooltip.findTotalOffsetTop=function(e,t){var n=t;do{if(!isNaN(e.offsetTop)){n+=e.offsetTop}}while(e=e.offsetParent);return n};e.tooltip.findTotalOffsetLeft=function(e,t){var n=t;do{if(!isNaN(e.offsetLeft)){n+=e.offsetLeft}}while(e=e.offsetParent);return n};e.tooltip.calcTooltipPosition=function(t,n,r,i){var s=parseInt(i.offsetHeight),o=parseInt(i.offsetWidth),u=e.utils.windowSize().width,a=e.utils.windowSize().height,f=window.pageYOffset,l=window.pageXOffset,c,h;a=window.innerWidth>=document.body.scrollWidth?a:a-16;u=window.innerHeight>=document.body.scrollHeight?u:u-16;n=n||"s";r=r||20;var p=function(t){return e.tooltip.findTotalOffsetTop(t,h)};var d=function(t){return e.tooltip.findTotalOffsetLeft(t,c)};switch(n){case"e":c=t[0]-o-r;h=t[1]-s/2;var v=d(i);var m=p(i);if(v<l)c=t[0]+r>l?t[0]+r:l-v+c;if(m<f)h=f-m+h;if(m+s>f+a)h=f+a-m+h-s;break;case"w":c=t[0]+r;h=t[1]-s/2;var v=d(i);var m=p(i);if(v+o>u)c=t[0]-o-r;if(m<f)h=f+5;if(m+s>f+a)h=f+a-m+h-s;break;case"n":c=t[0]-o/2-5;h=t[1]+r;var v=d(i);var m=p(i);if(v<l)c=l+5;if(v+o>u)c=c-o/2+5;if(m+s>f+a)h=f+a-m+h-s;break;case"s":c=t[0]-o/2;h=t[1]-s-r;var v=d(i);var m=p(i);if(v<l)c=l+5;if(v+o>u)c=c-o/2+5;if(f>m)h=f;break;case"none":c=t[0];h=t[1]-r;var v=d(i);var m=p(i);break}i.style.left=c+"px";i.style.top=h+"px";i.style.opacity=1;i.style.position="absolute";return i};e.tooltip.cleanup=function(){var e=document.getElementsByClassName("nvtooltip");var t=[];while(e.length){t.push(e[0]);e[0].style.transitionDelay="0 !important";e[0].style.opacity=0;e[0].className="nvtooltip-pending-removal"}setTimeout(function(){while(t.length){var e=t.pop();e.parentNode.removeChild(e)}},500)}})();e.utils.windowSize=function(){var e={width:640,height:480};if(document.body&&document.body.offsetWidth){e.width=document.body.offsetWidth;e.height=document.body.offsetHeight}if(document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth){e.width=document.documentElement.offsetWidth;e.height=document.documentElement.offsetHeight}if(window.innerWidth&&window.innerHeight){e.width=window.innerWidth;e.height=window.innerHeight}return e};e.utils.windowResize=function(e){if(e===undefined)return;var t=window.onresize;window.onresize=function(n){if(typeof t=="function")t(n);e(n)}};e.utils.getColor=function(t){if(!arguments.length)return e.utils.defaultColor();if(Object.prototype.toString.call(t)==="[object Array]")return function(e,n){return e.color||t[n%t.length]};else return t};e.utils.defaultColor=function(){var e=d3.scale.category20().range();return function(t,n){return t.color||e[n%e.length]}};e.utils.customTheme=function(e,t,n){t=t||function(e){return e.key};n=n||d3.scale.category20().range();var r=n.length;return function(i,s){var o=t(i);if(!r)r=n.length;if(typeof e[o]!=="undefined")return typeof e[o]==="function"?e[o]():e[o];else return n[--r]}};e.utils.pjax=function(t,n){function r(r){d3.html(r,function(r){var i=d3.select(n).node();i.parentNode.replaceChild(d3.select(r).select(n).node(),i);e.utils.pjax(t,n)})}d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href);r(this.href);d3.event.preventDefault()});d3.select(window).on("popstate",function(){if(d3.event.state)r(d3.event.state)})};e.utils.calcApproxTextWidth=function(e){if(e instanceof d3.selection){var t=parseInt(e.style("font-size").replace("px",""));var n=e.text().length;return n*t*.5}return 0};e.utils.NaNtoZero=function(e){if(typeof e!=="number"||isNaN(e)||e===null||e===Infinity)return 0;return e};e.utils.optionsFunc=function(e){if(e){d3.map(e).forEach(function(e,t){if(typeof this[e]==="function"){this[e](t)}}.bind(this))}return this};e.models.axis=function(){"use strict";function g(e){e.each(function(e){var i=d3.select(this);var g=i.selectAll("g.nv-wrap.nv-axis").data([e]);var y=g.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");var b=y.append("g");var w=g.select("g");if(p!==null)t.ticks(p);else if(t.orient()=="top"||t.orient()=="bottom")t.ticks(Math.abs(s.range()[1]-s.range()[0])/100);w.transition().call(t);m=m||t.scale();var E=t.tickFormat();if(E==null){E=m.tickFormat()}var S=w.selectAll("text.nv-axislabel").data([o||null]);S.exit().remove();switch(t.orient()){case"top":S.enter().append("text").attr("class","nv-axislabel");var x=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);S.attr("text-anchor","middle").attr("y",0).attr("x",x/2);if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+s(e)+",0)"}).select("text").attr("dy","0em").attr("y",-t.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+s.range()[t]+",0)"})}break;case"bottom":var N=36;var C=30;var k=w.selectAll("g").select("text");if(f%360){k.each(function(e,t){var n=this.getBBox().width;if(n>C)C=n});var L=Math.abs(Math.sin(f*Math.PI/180));var N=(L?L*C:C)+30;k.attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f%360>0?"start":"end")}S.enter().append("text").attr("class","nv-axislabel");var x=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);S.attr("text-anchor","middle").attr("y",N).attr("x",x/2);if(u){var T=g.selectAll("g.nv-axisMaxMin").data([s.domain()[0],s.domain()[s.domain().length-1]]);T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",t.tickPadding()).attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f?f%360>0?"start":"end":"middle").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"})}if(c)k.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",l?"middle":"begin").attr("transform",l?"rotate(90)":"").attr("y",l?-Math.max(n.right,r)+12:-10).attr("x",l?s.range()[0]/2:t.tickPadding());if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+s(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",t.tickPadding()).style("text-anchor","start").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",l?"middle":"end").attr("transform",l?"rotate(-90)":"").attr("y",l?-Math.max(n.left,r)+v:-10).attr("x",l?-s.range()[0]/2:-t.tickPadding());if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+m(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-t.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break}S.text(function(e){return e});if(u&&(t.orient()==="left"||t.orient()==="right")){w.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);var n;if(d){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(s(e)<s.range()[1]+10||s(e)>s.range()[0]-10){if(e>1e-10||e<-1e-10)d3.select(this).attr("opacity",0);d3.select(this).select("text").attr("opacity",0)}});if(s.domain()[0]==s.domain()[1]&&s.domain()[0]==0)g.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return!t?1:0})}if(u&&(t.orient()==="top"||t.orient()==="bottom")){var A=[];g.selectAll("g.nv-axisMaxMin").each(function(e,t){try{if(t)A.push(s(e)-this.getBBox().width-4);else A.push(s(e)+this.getBBox().width+4)}catch(n){if(t)A.push(s(e)-4);else A.push(s(e)+4)}});w.selectAll("g").each(function(e,t){var n;if(d){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(s(e)<A[0]||s(e)>A[1]){if(e>1e-10||e<-1e-10)d3.select(this).remove();else d3.select(this).select("text").remove()}})}if(a)w.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",true);m=s.copy()});return g}var t=d3.svg.axis();var n={top:0,right:0,bottom:0,left:0},r=75,i=60,s=d3.scale.linear(),o=null,u=true,a=true,f=0,l=true,c=false,h=false,p=null,d=false,v=12;t.scale(s).orient("bottom").tickFormat(function(e){return e});var m;g.axis=t;d3.rebind(g,t,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat");d3.rebind(g,s,"domain","range","rangeBand","rangeBands");g.options=e.utils.optionsFunc.bind(g);g.margin=function(e){if(!arguments.length)return n;n.top=typeof e.top!="undefined"?e.top:n.top;n.right=typeof e.right!="undefined"?e.right:n.right;n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom;n.left=typeof e.left!="undefined"?e.left:n.left;return g};g.width=function(e){if(!arguments.length)return r;r=e;return g};g.ticks=function(e){if(!arguments.length)return p;p=e;return g};g.height=function(e){if(!arguments.length)return i;i=e;return g};g.axisLabel=function(e){if(!arguments.length)return o;o=e;return g};g.showMaxMin=function(e){if(!arguments.length)return u;u=e;return g};g.logScale=function(e){if(!arguments.length)return d;d=e;return g};g.highlightZero=function(e){if(!arguments.length)return a;a=e;return g};g.scale=function(e){if(!arguments.length)return s;s=e;t.scale(s);h=typeof s.rangeBands==="function";d3.rebind(g,s,"domain","range","rangeBand","rangeBands");return g};g.rotateYLabel=function(e){if(!arguments.length)return l;l=e;return g};g.rotateLabels=function(e){if(!arguments.length)return f;f=e;return g};g.staggerLabels=function(e){if(!arguments.length)return c;c=e;return g};g.axisLabelDistance=function(e){if(!arguments.length)return v;v=e;return g};return g};e.models.bullet=function(){"use strict";function m(e){e.each(function(e,n){var p=c-t.left-t.right,m=h-t.top-t.bottom,g=d3.select(this);var y=i.call(this,e,n).slice().sort(d3.descending),b=s.call(this,e,n).slice().sort(d3.descending),w=o.call(this,e,n).slice().sort(d3.descending),E=u.call(this,e,n).slice(),S=a.call(this,e,n).slice(),x=f.call(this,e,n).slice();var T=d3.scale.linear().domain(d3.extent(d3.merge([l,y]))).range(r?[p,0]:[0,p]);var N=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(T.range());this.__chart__=T;var C=d3.min(y),k=d3.max(y),L=y[1];var A=g.selectAll("g.nv-wrap.nv-bullet").data([e]);var O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet");var M=O.append("g");var _=A.select("g");M.append("rect").attr("class","nv-range nv-rangeMax");M.append("rect").attr("class","nv-range nv-rangeAvg");M.append("rect").attr("class","nv-range nv-rangeMin");M.append("rect").attr("class","nv-measure");M.append("path").attr("class","nv-markerTriangle");A.attr("transform","translate("+t.left+","+t.top+")");var D=function(e){return Math.abs(N(e)-N(0))},P=function(e){return Math.abs(T(e)-T(0))};var H=function(e){return e<0?N(e):N(0)},B=function(e){return e<0?T(e):T(0)};_.select("rect.nv-rangeMax").attr("height",m).attr("width",P(k>0?k:C)).attr("x",B(k>0?k:C)).datum(k>0?k:C);_.select("rect.nv-rangeAvg").attr("height",m).attr("width",P(L)).attr("x",B(L)).datum(L);_.select("rect.nv-rangeMin").attr("height",m).attr("width",P(k)).attr("x",B(k)).attr("width",P(k>0?C:k)).attr("x",B(k>0?C:k)).datum(k>0?C:k);_.select("rect.nv-measure").style("fill",d).attr("height",m/3).attr("y",m/3).attr("width",w<0?T(0)-T(w[0]):T(w[0])-T(0)).attr("x",B(w)).on("mouseover",function(){v.elementMouseover({value:w[0],label:x[0]||"Current",pos:[T(w[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:w[0],label:x[0]||"Current"})});var j=m/6;if(b[0]){_.selectAll("path.nv-markerTriangle").attr("transform",function(e){return"translate("+T(b[0])+","+m/2+")"}).attr("d","M0,"+j+"L"+j+","+ -j+" "+ -j+","+ -j+"Z").on("mouseover",function(){v.elementMouseover({value:b[0],label:S[0]||"Previous",pos:[T(b[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:b[0],label:S[0]||"Previous"})})}else{_.selectAll("path.nv-markerTriangle").remove()}A.selectAll(".nv-range").on("mouseover",function(e,t){var n=E[t]||(!t?"Maximum":t==1?"Mean":"Minimum");v.elementMouseover({value:e,label:n,pos:[T(e),m/2]})}).on("mouseout",function(e,t){var n=E[t]||(!t?"Maximum":t==1?"Mean":"Minimum");v.elementMouseout({value:e,label:n})})});return m}var t={top:0,right:0,bottom:0,left:0},n="left",r=false,i=function(e){return e.ranges},s=function(e){return e.markers},o=function(e){return e.measures},u=function(e){return e.rangeLabels?e.rangeLabels:[]},a=function(e){return e.markerLabels?e.markerLabels:[]},f=function(e){return e.measureLabels?e.measureLabels:[]},l=[0],c=380,h=30,p=null,d=e.utils.getColor(["#1f77b4"]),v=d3.dispatch("elementMouseover","elementMouseout");m.dispatch=v;m.options=e.utils.optionsFunc.bind(m);m.orient=function(e){if(!arguments.length)return n;n=e;r=n=="right"||n=="bottom";return m};m.ranges=function(e){if(!arguments.length)return i;i=e;return m};m.markers=function(e){if(!arguments.length)return s;s=e;return m};m.measures=function(e){if(!arguments.length)return o;o=e;return m};m.forceX=function(e){if(!arguments.length)return l;l=e;return m};m.width=function(e){if(!arguments.length)return c;c=e;return m};m.height=function(e){if(!arguments.length)return h;h=e;return m};m.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return m};m.tickFormat=function(e){if(!arguments.length)return p;p=e;return m};m.color=function(t){if(!arguments.length)return d;d=e.utils.getColor(t);return m};return m};e.models.bulletChart=function(){"use strict";function m(e){e.each(function(n,h){var g=d3.select(this);var y=(a||parseInt(g.style("width"))||960)-i.left-i.right,b=f-i.top-i.bottom,w=this;m.update=function(){m(e)};m.container=this;if(!n||!s.call(this,n,h)){var E=g.selectAll(".nv-noData").data([p]);E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");E.attr("x",i.left+y/2).attr("y",18+i.top+b/2).text(function(e){return e});return m}else{g.selectAll(".nv-noData").remove()}var S=s.call(this,n,h).slice().sort(d3.descending),x=o.call(this,n,h).slice().sort(d3.descending),T=u.call(this,n,h).slice().sort(d3.descending);var N=g.selectAll("g.nv-wrap.nv-bulletChart").data([n]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart");var k=C.append("g");var L=N.select("g");k.append("g").attr("class","nv-bulletWrap");k.append("g").attr("class","nv-titles");N.attr("transform","translate("+i.left+","+i.top+")");var A=d3.scale.linear().domain([0,Math.max(S[0],x[0],T[0])]).range(r?[y,0]:[0,y]);var O=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(A.range());this.__chart__=A;var M=function(e){return Math.abs(O(e)-O(0))},_=function(e){return Math.abs(A(e)-A(0))};var D=k.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(f-i.top-i.bottom)/2+")");D.append("text").attr("class","nv-title").text(function(e){return e.title});D.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(e){return e.subtitle});t.width(y).height(b);var P=L.select(".nv-bulletWrap");d3.transition(P).call(t);var H=l||A.tickFormat(y/100);var B=L.selectAll("g.nv-tick").data(A.ticks(y/50),function(e){return this.textContent||H(e)});var j=B.enter().append("g").attr("class","nv-tick").attr("transform",function(e){return"translate("+O(e)+",0)"}).style("opacity",1e-6);j.append("line").attr("y1",b).attr("y2",b*7/6);j.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",b*7/6).text(H);var F=d3.transition(B).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1);F.select("line").attr("y1",b).attr("y2",b*7/6);F.select("text").attr("y",b*7/6);d3.transition(B.exit()).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1e-6).remove();d.on("tooltipShow",function(e){e.key=n.title;if(c)v(e,w.parentNode)})});d3.timer.flush();return m}var t=e.models.bullet();var n="left",r=false,i={top:5,right:40,bottom:20,left:120},s=function(e){return e.ranges},o=function(e){return e.markers},u=function(e){return e.measures},a=null,f=55,l=null,c=true,h=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},p="No Data Available.",d=d3.dispatch("tooltipShow","tooltipHide");var v=function(t,n){var r=t.pos[0]+(n.offsetLeft||0)+i.left,s=t.pos[1]+(n.offsetTop||0)+i.top,o=h(t.key,t.label,t.value,t,m);e.tooltip.show([r,s],o,t.value<0?"e":"w",null,n)};t.dispatch.on("elementMouseover.tooltip",function(e){d.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){d.tooltipHide(e)});d.on("tooltipHide",function(){if(c)e.tooltip.cleanup()});m.dispatch=d;m.bullet=t;d3.rebind(m,t,"color");m.options=e.utils.optionsFunc.bind(m);m.orient=function(e){if(!arguments.length)return n;n=e;r=n=="right"||n=="bottom";return m};m.ranges=function(e){if(!arguments.length)return s;s=e;return m};m.markers=function(e){if(!arguments.length)return o;o=e;return m};m.measures=function(e){if(!arguments.length)return u;u=e;return m};m.width=function(e){if(!arguments.length)return a;a=e;return m};m.height=function(e){if(!arguments.length)return f;f=e;return m};m.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.right=typeof e.right!="undefined"?e.right:i.right;i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom;i.left=typeof e.left!="undefined"?e.left:i.left;return m};m.tickFormat=function(e){if(!arguments.length)return l;l=e;return m};m.tooltips=function(e){if(!arguments.length)return c;c=e;return m};m.tooltipContent=function(e){if(!arguments.length)return h;h=e;return m};m.noData=function(e){if(!arguments.length)return p;p=e;return m};return m};e.models.cumulativeLineChart=function(){"use strict";function _(b){b.each(function(b){function q(e,t){d3.select(_.container).style("cursor","ew-resize")}function R(e,t){O.x=d3.event.x;O.i=Math.round(A.invert(O.x));rt()}function U(e,t){d3.select(_.container).style("cursor","auto");x.index=O.i;k.stateChange(x)}function rt(){nt.data([O]);var e=_.transitionDuration();_.transitionDuration(0);_.update();_.transitionDuration(e)}var P=d3.select(this).classed("nv-chart-"+S,true),H=this;var B=(f||parseInt(P.style("width"))||960)-u.left-u.right,j=(l||parseInt(P.style("height"))||400)-u.top-u.bottom;_.update=function(){P.transition().duration(L).call(_)};_.container=this;x.disabled=b.map(function(e){return!!e.disabled});if(!T){var F;T={};for(F in x){if(x[F]instanceof Array)T[F]=x[F].slice(0);else T[F]=x[F]}}var I=d3.behavior.drag().on("dragstart",q).on("drag",R).on("dragend",U);if(!b||!b.length||!b.filter(function(e){return e.values.length}).length){var z=P.selectAll(".nv-noData").data([N]);z.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");z.attr("x",u.left+B/2).attr("y",u.top+j/2).text(function(e){return e});return _}else{P.selectAll(".nv-noData").remove()}w=t.xScale();E=t.yScale();if(!y){var W=b.filter(function(e){return!e.disabled}).map(function(e,n){var r=d3.extent(e.values,t.y());if(r[0]<-.95)r[0]=-.95;return[(r[0]-r[1])/(1+r[1]),(r[1]-r[0])/(1+r[0])]});var X=[d3.min(W,function(e){return e[0]}),d3.max(W,function(e){return e[1]})];t.yDomain(X)}else{t.yDomain(null)}A.domain([0,b[0].values.length-1]).range([0,B]).clamp(true);var b=D(O.i,b);var V=g?"none":"all";var $=P.selectAll("g.nv-wrap.nv-cumulativeLine").data([b]);var J=$.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g");var K=$.select("g");J.append("g").attr("class","nv-interactive");J.append("g").attr("class","nv-x nv-axis").style("pointer-events","none");J.append("g").attr("class","nv-y nv-axis");J.append("g").attr("class","nv-background");J.append("g").attr("class","nv-linesWrap").style("pointer-events",V);J.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none");J.append("g").attr("class","nv-legendWrap");J.append("g").attr("class","nv-controlsWrap");if(c){i.width(B);K.select(".nv-legendWrap").datum(b).call(i);if(u.top!=i.height()){u.top=i.height();j=(l||parseInt(P.style("height"))||400)-u.top-u.bottom}K.select(".nv-legendWrap").attr("transform","translate(0,"+ -u.top+")")}if(m){var Q=[{key:"Re-scale y-axis",disabled:!y}];s.width(140).color(["#444","#444","#444"]);K.select(".nv-controlsWrap").datum(Q).attr("transform","translate(0,"+ -u.top+")").call(s)}$.attr("transform","translate("+u.left+","+u.top+")");if(d){K.select(".nv-y.nv-axis").attr("transform","translate("+B+",0)")}var G=b.filter(function(e){return e.tempDisabled});$.select(".tempDisabled").remove();if(G.length){$.append("text").attr("class","tempDisabled").attr("x",B/2).attr("y","-.71em").style("text-anchor","end").text(G.map(function(e){return e.key}).join(", ")+" values cannot be calculated for this time period.")}if(g){o.width(B).height(j).margin({left:u.left,top:u.top}).svgContainer(P).xScale(w);$.select(".nv-interactive").call(o)}J.select(".nv-background").append("rect");K.select(".nv-background rect").attr("width",B).attr("height",j);t.y(function(e){return e.display.y}).width(B).height(j).color(b.map(function(e,t){return e.color||a(e,t)}).filter(function(e,t){return!b[t].disabled&&!b[t].tempDisabled}));var Y=K.select(".nv-linesWrap").datum(b.filter(function(e){return!e.disabled&&!e.tempDisabled}));Y.call(t);b.forEach(function(e,t){e.seriesIndex=t});var Z=b.filter(function(e){return!e.disabled&&!!C(e)});var et=K.select(".nv-avgLinesWrap").selectAll("line").data(Z,function(e){return e.key});var tt=function(e){var t=E(C(e));if(t<0)return 0;if(t>j)return j;return t};et.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(e,n){return t.color()(e,e.seriesIndex)}).attr("x1",0).attr("x2",B).attr("y1",tt).attr("y2",tt);et.style("stroke-opacity",function(e){var t=E(C(e));if(t<0||t>j)return 0;return 1}).attr("x1",0).attr("x2",B).attr("y1",tt).attr("y2",tt);et.exit().remove();var nt=Y.selectAll(".nv-indexLine").data([O]);nt.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(I);nt.attr("transform",function(e){return"translate("+A(e.i)+",0)"}).attr("height",j);if(h){n.scale(w).ticks(Math.min(b[0].values.length,B/70)).tickSize(-j,0);K.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")");d3.transition(K.select(".nv-x.nv-axis")).call(n)}if(p){r.scale(E).ticks(j/36).tickSize(-B,0);d3.transition(K.select(".nv-y.nv-axis")).call(r)}K.select(".nv-background rect").on("click",function(){O.x=d3.mouse(this)[0];O.i=Math.round(A.invert(O.x));x.index=O.i;k.stateChange(x);rt()});t.dispatch.on("elementClick",function(e){O.i=e.pointIndex;O.x=A(O.i);x.index=O.i;k.stateChange(x);rt()});s.dispatch.on("legendClick",function(e,t){e.disabled=!e.disabled;y=!e.disabled;x.rescaleY=y;k.stateChange(x);_.update()});i.dispatch.on("stateChange",function(e){x.disabled=e.disabled;k.stateChange(x);_.update()});o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,f,l,c=[];b.filter(function(e,t){e.seriesIndex=t;return!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,_.x());t.highlightPoint(r,f,true);var o=n.values[f];if(typeof o==="undefined")return;if(typeof s==="undefined")s=o;if(typeof l==="undefined")l=_.xScale()(_.x()(o,f));c.push({key:n.key,value:_.y()(o,f),color:a(n,n.seriesIndex)})});if(c.length>2){var h=_.yScale().invert(i.mouseY);var p=Math.abs(_.yScale().domain()[0]-_.yScale().domain()[1]);var d=.03*p;var m=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);if(m!==null)c[m].highlight=true}var g=n.tickFormat()(_.x()(s,f),f);o.tooltip.position({left:l+u.left,top:i.mouseY+u.top}).chartContainer(H.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:g,series:c})();o.renderGuideLine(l)});o.dispatch.on("elementMouseout",function(e){k.tooltipHide();t.clearHighlights()});k.on("tooltipShow",function(e){if(v)M(e,H.parentNode)});k.on("changeState",function(e){if(typeof e.disabled!=="undefined"){b.forEach(function(t,n){t.disabled=e.disabled[n]});x.disabled=e.disabled}if(typeof e.index!=="undefined"){O.i=e.index;O.x=A(O.i);x.index=e.index;nt.data([O])}if(typeof e.rescaleY!=="undefined"){y=e.rescaleY}_.update()})});return _}function D(e,n){return n.map(function(n,r){if(!n.values){return n}var i=t.y()(n.values[e],e);if(i<-.95){n.tempDisabled=true;return n}n.tempDisabled=false;n.values=n.values.map(function(e,n){e.display={y:(t.y()(e,n)-i)/(1+i)};return e});return n})}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline();var u={top:30,right:30,bottom:50,left:60},a=e.utils.defaultColor(),f=null,l=null,c=true,h=true,p=true,d=false,v=true,m=true,g=false,y=true,b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},w,E,S=t.id(),x={index:0,rescaleY:y},T=null,N="No Data Available.",C=function(e){return e.average},k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=250;n.orient("bottom").tickPadding(7);r.orient(d?"right":"left");s.updateState(false);var A=d3.scale.linear(),O={i:0,x:0};var M=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=b(i.series.key,a,f,i,_);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];k.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(v)e.tooltip.cleanup()});_.dispatch=k;_.lines=t;_.legend=i;_.xAxis=n;_.yAxis=r;_.interactiveLayer=o;d3.rebind(_,t,"defined","isArea","x","y","xScale","yScale","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id");_.options=e.utils.optionsFunc.bind(_);_.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return _};_.width=function(e){if(!arguments.length)return f;f=e;return _};_.height=function(e){if(!arguments.length)return l;l=e;return _};_.color=function(t){if(!arguments.length)return a;a=e.utils.getColor(t);i.color(a);return _};_.rescaleY=function(e){if(!arguments.length)return y;y=e;return _};_.showControls=function(e){if(!arguments.length)return m;m=e;return _};_.useInteractiveGuideline=function(e){if(!arguments.length)return g;g=e;if(e===true){_.interactive(false);_.useVoronoi(false)}return _};_.showLegend=function(e){if(!arguments.length)return c;c=e;return _};_.showXAxis=function(e){if(!arguments.length)return h;h=e;return _};_.showYAxis=function(e){if(!arguments.length)return p;p=e;return _};_.rightAlignYAxis=function(e){if(!arguments.length)return d;d=e;r.orient(e?"right":"left");return _};_.tooltips=function(e){if(!arguments.length)return v;v=e;return _};_.tooltipContent=function(e){if(!arguments.length)return b;b=e;return _};_.state=function(e){if(!arguments.length)return x;x=e;return _};_.defaultState=function(e){if(!arguments.length)return T;T=e;return _};_.noData=function(e){if(!arguments.length)return N;N=e;return _};_.average=function(e){if(!arguments.length)return C;C=e;return _};_.transitionDuration=function(e){if(!arguments.length)return L;L=e;return _};return _};e.models.discreteBar=function(){"use strict";function E(e){e.each(function(e){var i=n-t.left-t.right,E=r-t.top-t.bottom,S=d3.select(this);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});var T=p&&d?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0}})});s.domain(p||d3.merge(T).map(function(e){return e.x})).rangeBands(v||[0,i],.1);o.domain(d||d3.extent(d3.merge(T).map(function(e){return e.y}).concat(f)));if(c)o.range(m||[E-(o.domain()[0]<0?12:0),o.domain()[1]>0?12:0]);else o.range(m||[E,0]);b=b||s;w=w||o.copy().range([o(0),o(0)]);var N=S.selectAll("g.nv-wrap.nv-discretebar").data([e]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar");var k=C.append("g");var L=N.select("g");k.append("g").attr("class","nv-groups");N.attr("transform","translate("+t.left+","+t.top+")");var A=N.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);A.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();A.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover});A.transition().style("stroke-opacity",1).style("fill-opacity",.75);var O=A.selectAll("g.nv-bar").data(function(e){return e.values});O.exit().remove();var M=O.enter().append("g").attr("transform",function(e,t,n){return"translate("+(s(u(e,t))+s.rangeBand()*.05)+", "+o(0)+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);g.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);g.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){g.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){g.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});M.append("rect").attr("height",0).attr("width",s.rangeBand()*.9/e.length);if(c){M.append("text").attr("text-anchor","middle");O.select("text").text(function(e,t){return h(a(e,t))}).transition().attr("x",s.rangeBand()*.9/2).attr("y",function(e,t){return a(e,t)<0?o(a(e,t))-o(0)+12:-4})}else{O.selectAll("text").remove()}O.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(e,t){return e.color||l(e,t)}).style("stroke",function(e,t){return e.color||l(e,t)}).select("rect").attr("class",y).transition().attr("width",s.rangeBand()*.9/e.length);O.transition().attr("transform",function(e,t){var n=s(u(e,t))+s.rangeBand()*.05,r=a(e,t)<0?o(0):o(0)-o(a(e,t))<1?o(0)-1:o(a(e,t));return"translate("+n+", "+r+")"}).select("rect").attr("height",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(d&&d[0]||0))||1)});b=s.copy();w=o.copy()});return E}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=false,h=d3.format(",.2f"),p,d,v,m,g=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),y="discreteBar";var b,w;E.dispatch=g;E.options=e.utils.optionsFunc.bind(E);E.x=function(e){if(!arguments.length)return u;u=e;return E};E.y=function(e){if(!arguments.length)return a;a=e;return E};E.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return E};E.width=function(e){if(!arguments.length)return n;n=e;return E};E.height=function(e){if(!arguments.length)return r;r=e;return E};E.xScale=function(e){if(!arguments.length)return s;s=e;return E};E.yScale=function(e){if(!arguments.length)return o;o=e;return E};E.xDomain=function(e){if(!arguments.length)return p;p=e;return E};E.yDomain=function(e){if(!arguments.length)return d;d=e;return E};E.xRange=function(e){if(!arguments.length)return v;v=e;return E};E.yRange=function(e){if(!arguments.length)return m;m=e;return E};E.forceY=function(e){if(!arguments.length)return f;f=e;return E};E.color=function(t){if(!arguments.length)return l;l=e.utils.getColor(t);return E};E.id=function(e){if(!arguments.length)return i;i=e;return E};E.showValues=function(e){if(!arguments.length)return c;c=e;return E};E.valueFormat=function(e){if(!arguments.length)return h;h=e;return E};E.rectClass=function(e){if(!arguments.length)return y;y=e;return E};return E};e.models.discreteBarChart=function(){"use strict";function w(e){e.each(function(e){var u=d3.select(this),p=this;var E=(s||parseInt(u.style("width"))||960)-i.left-i.right,S=(o||parseInt(u.style("height"))||400)-i.top-i.bottom;w.update=function(){g.beforeUpdate();u.transition().duration(y).call(w)};w.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var T=u.selectAll(".nv-noData").data([m]);T.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");T.attr("x",i.left+E/2).attr("y",i.top+S/2).text(function(e){return e});return w}else{u.selectAll(".nv-noData").remove()}d=t.xScale();v=t.yScale().clamp(true);var N=u.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([e]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g");var k=C.append("defs");var L=N.select("g");C.append("g").attr("class","nv-x nv-axis");C.append("g").attr("class","nv-y nv-axis");C.append("g").attr("class","nv-barsWrap");L.attr("transform","translate("+i.left+","+i.top+")");if(l){L.select(".nv-y.nv-axis").attr("transform","translate("+E+",0)")}t.width(E).height(S);var A=L.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));A.transition().call(t);k.append("clipPath").attr("id","nv-x-label-clip-"+t.id()).append("rect");L.select("#nv-x-label-clip-"+t.id()+" rect").attr("width",d.rangeBand()*(c?2:1)).attr("height",16).attr("x",-d.rangeBand()/(c?1:2));if(a){n.scale(d).ticks(E/100).tickSize(-S,0);L.select(".nv-x.nv-axis").attr("transform","translate(0,"+(v.range()[0]+(t.showValues()&&v.domain()[0]<0?16:0))+")");L.select(".nv-x.nv-axis").transition().call(n);var O=L.select(".nv-x.nv-axis").selectAll("g");if(c){O.selectAll("text").attr("transform",function(e,t,n){return"translate(0,"+(n%2==0?"5":"17")+")"})}}if(f){r.scale(v).ticks(S/36).tickSize(-E,0);L.select(".nv-y.nv-axis").transition().call(r)}g.on("tooltipShow",function(e){if(h)b(e,p.parentNode)})});return w}var t=e.models.discreteBar(),n=e.models.axis(),r=e.models.axis();var i={top:15,right:10,bottom:50,left:60},s=null,o=null,u=e.utils.getColor(),a=true,f=true,l=false,c=false,h=true,p=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},d,v,m="No Data Available.",g=d3.dispatch("tooltipShow","tooltipHide","beforeUpdate"),y=250;n.orient("bottom").highlightZero(false).showMaxMin(false).tickFormat(function(e){return e});r.orient(l?"right":"left").tickFormat(d3.format(",.1f"));var b=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=p(i.series.key,a,f,i,w);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+i.left,e.pos[1]+i.top];g.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){g.tooltipHide(e)});g.on("tooltipHide",function(){if(h)e.tooltip.cleanup()});w.dispatch=g;w.discretebar=t;w.xAxis=n;w.yAxis=r;d3.rebind(w,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","id","showValues","valueFormat");w.options=e.utils.optionsFunc.bind(w);w.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.right=typeof e.right!="undefined"?e.right:i.right;i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom;i.left=typeof e.left!="undefined"?e.left:i.left;return w};w.width=function(e){if(!arguments.length)return s;s=e;return w};w.height=function(e){if(!arguments.length)return o;o=e;return w};w.color=function(n){if(!arguments.length)return u;u=e.utils.getColor(n);t.color(u);return w};w.showXAxis=function(e){if(!arguments.length)return a;a=e;return w};w.showYAxis=function(e){if(!arguments.length)return f;f=e;return w};w.rightAlignYAxis=function(e){if(!arguments.length)return l;l=e;r.orient(e?"right":"left");return w};w.staggerLabels=function(e){if(!arguments.length)return c;c=e;return w};w.tooltips=function(e){if(!arguments.length)return h;h=e;return w};w.tooltipContent=function(e){if(!arguments.length)return p;p=e;return w};w.noData=function(e){if(!arguments.length)return m;m=e;return w};w.transitionDuration=function(e){if(!arguments.length)return y;y=e;return w};return w};e.models.distribution=function(){"use strict";function l(e){e.each(function(e){var a=n-(i==="x"?t.left+t.right:t.top+t.bottom),l=i=="x"?"y":"x",c=d3.select(this);f=f||u;var h=c.selectAll("g.nv-distribution").data([e]);var p=h.enter().append("g").attr("class","nvd3 nv-distribution");var d=p.append("g");var v=h.select("g");h.attr("transform","translate("+t.left+","+t.top+")");var m=v.selectAll("g.nv-dist").data(function(e){return e},function(e){return e.key});m.enter().append("g");m.attr("class",function(e,t){return"nv-dist nv-series-"+t}).style("stroke",function(e,t){return o(e,t)});var g=m.selectAll("line.nv-dist"+i).data(function(e){return e.values});g.enter().append("line").attr(i+"1",function(e,t){return f(s(e,t))}).attr(i+"2",function(e,t){return f(s(e,t))});m.exit().selectAll("line.nv-dist"+i).transition().attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}).style("stroke-opacity",0).remove();g.attr("class",function(e,t){return"nv-dist"+i+" nv-dist"+i+"-"+t}).attr(l+"1",0).attr(l+"2",r);g.transition().attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))});f=u.copy()});return l}var t={top:0,right:0,bottom:0,left:0},n=400,r=8,i="x",s=function(e){return e[i]},o=e.utils.defaultColor(),u=d3.scale.linear(),a;var f;l.options=e.utils.optionsFunc.bind(l);l.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return l};l.width=function(e){if(!arguments.length)return n;n=e;return l};l.axis=function(e){if(!arguments.length)return i;i=e;return l};l.size=function(e){if(!arguments.length)return r;r=e;return l};l.getData=function(e){if(!arguments.length)return s;s=d3.functor(e);return l};l.scale=function(e){if(!arguments.length)return u;u=e;return l};l.color=function(t){if(!arguments.length)return o;o=e.utils.getColor(t);return l};return l};e.models.historicalBar=function(){"use strict";function w(E){E.each(function(w){var E=n-t.left-t.right,S=r-t.top-t.bottom,T=d3.select(this);s.domain(d||d3.extent(w[0].values.map(u).concat(f)));if(c)s.range(m||[E*.5/w[0].values.length,E*(w[0].values.length-.5)/w[0].values.length]);else s.range(m||[0,E]);o.domain(v||d3.extent(w[0].values.map(a).concat(l))).range(g||[S,0]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1]);if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]);var N=T.selectAll("g.nv-wrap.nv-historicalBar-"+i).data([w[0].values]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+i);var k=C.append("defs");var L=C.append("g");var A=N.select("g");L.append("g").attr("class","nv-bars");N.attr("transform","translate("+t.left+","+t.top+")");T.on("click",function(e,t){y.chartClick({data:e,index:t,pos:d3.event,id:i})});k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect");N.select("#nv-chart-clip-path-"+i+" rect").attr("width",E).attr("height",S);A.attr("clip-path",h?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-bars").selectAll(".nv-bar").data(function(e){return e},function(e,t){return u(e,t)});O.exit().remove();var M=O.enter().append("rect").attr("x",0).attr("y",function(t,n){return e.utils.NaNtoZero(o(Math.max(0,a(t,n))))}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.abs(o(a(t,n))-o(0)))}).attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).on("mouseover",function(e,t){if(!b)return;d3.select(this).classed("hover",true);y.elementMouseover({point:e,series:w[0],pos:[s(u(e,t)),o(a(e,t))],pointIndex:t,seriesIndex:0,e:d3.event})}).on("mouseout",function(e,t){if(!b)return;d3.select(this).classed("hover",false);y.elementMouseout({point:e,series:w[0],pointIndex:t,seriesIndex:0,e:d3.event})}).on("click",function(e,t){if(!b)return;y.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()}).on("dblclick",function(e,t){if(!b)return;y.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()});O.attr("fill",function(e,t){return p(e,t)}).attr("class",function(e,t,n){return(a(e,t)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+t}).transition().attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).attr("width",E/w[0].values.length*.9);O.transition().attr("y",function(t,n){var r=a(t,n)<0?o(0):o(0)-o(a(t,n))<1?o(0)-1:o(a(t,n));return e.utils.NaNtoZero(r)}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.max(Math.abs(o(a(t,n))-o(0)),1))})});return w}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[],l=[0],c=false,h=true,p=e.utils.defaultColor(),d,v,m,g,y=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),b=true;w.highlightPoint=function(e,t){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar-0-"+e).classed("hover",t)};w.clearHighlights=function(){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar.hover").classed("hover",false)};w.dispatch=y;w.options=e.utils.optionsFunc.bind(w);w.x=function(e){if(!arguments.length)return u;u=e;return w};w.y=function(e){if(!arguments.length)return a;a=e;return w};w.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return w};w.width=function(e){if(!arguments.length)return n;n=e;return w};w.height=function(e){if(!arguments.length)return r;r=e;return w};w.xScale=function(e){if(!arguments.length)return s;s=e;return w};w.yScale=function(e){if(!arguments.length)return o;o=e;return w};w.xDomain=function(e){if(!arguments.length)return d;d=e;return w};w.yDomain=function(e){if(!arguments.length)return v;v=e;return w};w.xRange=function(e){if(!arguments.length)return m;m=e;return w};w.yRange=function(e){if(!arguments.length)return g;g=e;return w};w.forceX=function(e){if(!arguments.length)return f;f=e;return w};w.forceY=function(e){if(!arguments.length)return l;l=e;return w};w.padData=function(e){if(!arguments.length)return c;c=e;return w};w.clipEdge=function(e){if(!arguments.length)return h;h=e;return w};w.color=function(t){if(!arguments.length)return p;p=e.utils.getColor(t);return w};w.id=function(e){if(!arguments.length)return i;i=e;return w};w.interactive=function(e){if(!arguments.length)return b;b=false;return w};return w};e.models.historicalBarChart=function(){"use strict";function x(e){e.each(function(d){var T=d3.select(this),N=this;var C=(u||parseInt(T.style("width"))||960)-s.left-s.right,k=(a||parseInt(T.style("height"))||400)-s.top-s.bottom;x.update=function(){T.transition().duration(E).call(x)};x.container=this;g.disabled=d.map(function(e){return!!e.disabled});if(!y){var L;y={};for(L in g){if(g[L]instanceof Array)y[L]=g[L].slice(0);else y[L]=g[L]}}if(!d||!d.length||!d.filter(function(e){return e.values.length}).length){var A=T.selectAll(".nv-noData").data([b]);A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");A.attr("x",s.left+C/2).attr("y",s.top+k/2).text(function(e){return e});return x}else{T.selectAll(".nv-noData").remove()}v=t.xScale();m=t.yScale();var O=T.selectAll("g.nv-wrap.nv-historicalBarChart").data([d]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g");var _=O.select("g");M.append("g").attr("class","nv-x nv-axis");M.append("g").attr("class","nv-y nv-axis");M.append("g").attr("class","nv-barsWrap");M.append("g").attr("class","nv-legendWrap");if(f){i.width(C);_.select(".nv-legendWrap").datum(d).call(i);if(s.top!=i.height()){s.top=i.height();k=(a||parseInt(T.style("height"))||400)-s.top-s.bottom}O.select(".nv-legendWrap").attr("transform","translate(0,"+ -s.top+")")}O.attr("transform","translate("+s.left+","+s.top+")");if(h){_.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)")}t.width(C).height(k).color(d.map(function(e,t){return e.color||o(e,t)}).filter(function(e,t){return!d[t].disabled}));var D=_.select(".nv-barsWrap").datum(d.filter(function(e){return!e.disabled}));D.transition().call(t);if(l){n.scale(v).tickSize(-k,0);_.select(".nv-x.nv-axis").attr("transform","translate(0,"+m.range()[0]+")");_.select(".nv-x.nv-axis").transition().call(n)}if(c){r.scale(m).ticks(k/36).tickSize(-C,0);_.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled;if(!d.filter(function(e){return!e.disabled}).length){d.map(function(e){e.disabled=false;O.selectAll(".nv-series").classed("disabled",false);return e})}g.disabled=d.map(function(e){return!!e.disabled});w.stateChange(g);e.transition().call(x)});i.dispatch.on("legendDblclick",function(e){d.forEach(function(e){e.disabled=true});e.disabled=false;g.disabled=d.map(function(e){return!!e.disabled});w.stateChange(g);x.update()});w.on("tooltipShow",function(e){if(p)S(e,N.parentNode)});w.on("changeState",function(t){if(typeof t.disabled!=="undefined"){d.forEach(function(e,n){e.disabled=t.disabled[n]});g.disabled=t.disabled}e.call(x)})});return x}var t=e.models.historicalBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend();var s={top:30,right:90,bottom:50,left:90},o=e.utils.defaultColor(),u=null,a=null,f=false,l=true,c=true,h=false,p=true,d=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},v,m,g={},y=null,b="No Data Available.",w=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),E=250;n.orient("bottom").tickPadding(7);r.orient(h?"right":"left");var S=function(i,s){if(s){var o=d3.select(s).select("svg");var u=o.node()?o.attr("viewBox"):null;if(u){u=u.split(" ");var a=parseInt(o.style("width"))/u[2];i.pos[0]=i.pos[0]*a;i.pos[1]=i.pos[1]*a}}var f=i.pos[0]+(s.offsetLeft||0),l=i.pos[1]+(s.offsetTop||0),c=n.tickFormat()(t.x()(i.point,i.pointIndex)),h=r.tickFormat()(t.y()(i.point,i.pointIndex)),p=d(i.series.key,c,h,i,x);e.tooltip.show([f,l],p,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+s.left,e.pos[1]+s.top];w.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){w.tooltipHide(e)});w.on("tooltipHide",function(){if(p)e.tooltip.cleanup()});x.dispatch=w;x.bars=t;x.legend=i;x.xAxis=n;x.yAxis=r;d3.rebind(x,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate","highlightPoint","clearHighlights","interactive");x.options=e.utils.optionsFunc.bind(x);x.margin=function(e){if(!arguments.length)return s;s.top=typeof e.top!="undefined"?e.top:s.top;s.right=typeof e.right!="undefined"?e.right:s.right;s.bottom=typeof e.bottom!="undefined"?e.bottom:s.bottom;s.left=typeof e.left!="undefined"?e.left:s.left;return x};x.width=function(e){if(!arguments.length)return u;u=e;return x};x.height=function(e){if(!arguments.length)return a;a=e;return x};x.color=function(t){if(!arguments.length)return o;o=e.utils.getColor(t);i.color(o);return x};x.showLegend=function(e){if(!arguments.length)return f;f=e;return x};x.showXAxis=function(e){if(!arguments.length)return l;l=e;return x};x.showYAxis=function(e){if(!arguments.length)return c;c=e;return x};x.rightAlignYAxis=function(e){if(!arguments.length)return h;h=e;r.orient(e?"right":"left");return x};x.tooltips=function(e){if(!arguments.length)return p;p=e;return x};x.tooltipContent=function(e){if(!arguments.length)return d;d=e;return x};x.state=function(e){if(!arguments.length)return g;g=e;return x};x.defaultState=function(e){if(!arguments.length)return y;y=e;return x};x.noData=function(e){if(!arguments.length)return b;b=e;return x};x.transitionDuration=function(e){if(!arguments.length)return E;E=e;return x};return x};e.models.indentedTree=function(){"use strict";function g(e){e.each(function(e){function k(e,t,n){d3.event.stopPropagation();if(d3.event.shiftKey&&!n){d3.event.shiftKey=false;e.values&&e.values.forEach(function(e){if(e.values||e._values){k(e,0,true)}});return true}if(!O(e)){return true}if(e.values){e._values=e.values;e.values=null}else{e.values=e._values;e._values=null}g.update()}function L(e){return e._values&&e._values.length?h:e.values&&e.values.length?p:""}function A(e){return e._values&&e._values.length}function O(e){var t=e.values||e._values;return t&&t.length}var t=1,n=d3.select(this);var i=d3.layout.tree().children(function(e){return e.values}).size([r,f]);g.update=function(){n.transition().duration(600).call(g)};if(!e[0])e[0]={key:a};var s=i.nodes(e[0]);var y=d3.select(this).selectAll("div").data([[s]]);var b=y.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree");var w=b.append("table");var E=y.select("table").attr("width","100%").attr("class",c);if(o){var S=w.append("thead");var x=S.append("tr");l.forEach(function(e){x.append("th").attr("width",e.width?e.width:"10%").style("text-align",e.type=="numeric"?"right":"left").append("span").text(e.label)})}var T=E.selectAll("tbody").data(function(e){return e});T.enter().append("tbody");t=d3.max(s,function(e){return e.depth});i.size([r,t*f]);var N=T.selectAll("tr").data(function(e){return e.filter(function(e){return u&&!e.children?u(e):true})},function(e,t){return e.id||e.id||++m});N.exit().remove();N.select("img.nv-treeicon").attr("src",L).classed("folded",A);var C=N.enter().append("tr");l.forEach(function(e,t){var n=C.append("td").style("padding-left",function(e){return(t?0:e.depth*f+12+(L(e)?0:16))+"px"},"important").style("text-align",e.type=="numeric"?"right":"left");if(t==0){n.append("img").classed("nv-treeicon",true).classed("nv-folded",A).attr("src",L).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(e){return L(e)?"inline-block":"none"}).on("click",k)}n.each(function(n){if(!t&&v(n))d3.select(this).append("a").attr("href",v).attr("class",d3.functor(e.classes)).append("span");else d3.select(this).append("span");d3.select(this).select("span").attr("class",d3.functor(e.classes)).text(function(t){return e.format?e.format(t):t[e.key]||"-"})});if(e.showCount){n.append("span").attr("class","nv-childrenCount");N.selectAll("span.nv-childrenCount").text(function(e){return e.values&&e.values.length||e._values&&e._values.length?"("+(e.values&&e.values.filter(function(e){return u?u(e):true}).length||e._values&&e._values.filter(function(e){return u?u(e):true}).length||0)+")":""})}});N.order().on("click",function(e){d.elementClick({row:this,data:e,pos:[e.x,e.y]})}).on("dblclick",function(e){d.elementDblclick({row:this,data:e,pos:[e.x,e.y]})}).on("mouseover",function(e){d.elementMouseover({row:this,data:e,pos:[e.x,e.y]})}).on("mouseout",function(e){d.elementMouseout({row:this,data:e,pos:[e.x,e.y]})})});return g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e4),o=true,u=false,a="No Data Available.",f=20,l=[{key:"key",label:"Name",type:"text"}],c=null,h="images/grey-plus.png",p="images/grey-minus.png",d=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout"),v=function(e){return e.url};var m=0;g.options=e.utils.optionsFunc.bind(g);g.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return g};g.width=function(e){if(!arguments.length)return n;n=e;return g};g.height=function(e){if(!arguments.length)return r;r=e;return g};g.color=function(t){if(!arguments.length)return i;i=e.utils.getColor(t);scatter.color(i);return g};g.id=function(e){if(!arguments.length)return s;s=e;return g};g.header=function(e){if(!arguments.length)return o;o=e;return g};g.noData=function(e){if(!arguments.length)return a;a=e;return g};g.filterZero=function(e){if(!arguments.length)return u;u=e;return g};g.columns=function(e){if(!arguments.length)return l;l=e;return g};g.tableClass=function(e){if(!arguments.length)return c;c=e;return g};g.iconOpen=function(e){if(!arguments.length)return h;h=e;return g};g.iconClose=function(e){if(!arguments.length)return p;p=e;return g};g.getUrl=function(e){if(!arguments.length)return v;v=e;return g};return g};e.models.legend=function(){"use strict";function h(p){p.each(function(h){var p=n-t.left-t.right,d=d3.select(this);var v=d.selectAll("g.nv-legend").data([h]);var m=v.enter().append("g").attr("class","nvd3 nv-legend").append("g");var g=v.select("g");v.attr("transform","translate("+t.left+","+t.top+")");var y=g.selectAll(".nv-series").data(function(e){return e});var b=y.enter().append("g").attr("class","nv-series").on("mouseover",function(e,t){l.legendMouseover(e,t)}).on("mouseout",function(e,t){l.legendMouseout(e,t)}).on("click",function(e,t){if(!c){l.legendClick(e,t);if(a){if(f){h.forEach(function(e){e.disabled=true});e.disabled=false}else{e.disabled=!e.disabled;if(h.every(function(e){return e.disabled})){h.forEach(function(e){e.disabled=false})}}l.stateChange({disabled:h.map(function(e){return!!e.disabled})})}}}).on("dblclick",function(e,t){if(!c){l.legendDblclick(e,t);if(a){h.forEach(function(e){e.disabled=true});e.disabled=false;l.stateChange({disabled:h.map(function(e){return!!e.disabled})})}}});b.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5);b.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");y.classed("disabled",function(e){return e.disabled});y.exit().remove();y.select("circle").style("fill",function(e,t){return e.color||s(e,t)}).style("stroke",function(e,t){return e.color||s(e,t)});y.select("text").text(i);if(o){var w=[];y.each(function(t,n){var r=d3.select(this).select("text");var i=r.node().getComputedTextLength()||e.utils.calcApproxTextWidth(r);w.push(i+28)});var E=0;var S=0;var x=[];while(S<p&&E<w.length){x[E]=w[E];S+=w[E++]}if(E===0)E=1;while(S>p&&E>1){x=[];E--;for(var T=0;T<w.length;T++){if(w[T]>(x[T%E]||0))x[T%E]=w[T]}S=x.reduce(function(e,t,n,r){return e+t})}var N=[];for(var C=0,k=0;C<E;C++){N[C]=k;k+=x[C]}y.attr("transform",function(e,t){return"translate("+N[t%E]+","+(5+Math.floor(t/E)*20)+")"});if(u){g.attr("transform","translate("+(n-t.right-S)+","+t.top+")")}else{g.attr("transform","translate(0"+","+t.top+")")}r=t.top+t.bottom+Math.ceil(w.length/E)*20}else{var L=5,A=5,O=0,M;y.attr("transform",function(e,r){var i=d3.select(this).select("text").node().getComputedTextLength()+28;M=A;if(n<t.left+t.right+M+i){A=M=5;L+=20}A+=i;if(A>O)O=A;return"translate("+M+","+L+")"});g.attr("transform","translate("+(n-t.right-O)+","+t.top+")");r=t.top+t.bottom+L+15}});return h}var t={top:5,right:0,bottom:5,left:0},n=400,r=20,i=function(e){return e.key},s=e.utils.defaultColor(),o=true,u=true,a=true,f=false,l=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange"),c=false;h.dispatch=l;h.options=e.utils.optionsFunc.bind(h);h.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return h};h.width=function(e){if(!arguments.length)return n;n=e;return h};h.height=function(e){if(!arguments.length)return r;r=e;return h};h.key=function(e){if(!arguments.length)return i;i=e;return h};h.color=function(t){if(!arguments.length)return s;s=e.utils.getColor(t);return h};h.align=function(e){if(!arguments.length)return o;o=e;return h};h.rightAlign=function(e){if(!arguments.length)return u;u=e;return h};h.dualaxis=function(e){if(!arguments.length)return c;c=e;return h};h.updateState=function(e){if(!arguments.length)return a;a=e;return h};h.radioButtonMode=function(e){if(!arguments.length)return f;f=e;return h};return h};e.models.line=function(){"use strict";function m(g){g.each(function(m){var g=r-n.left-n.right,b=i-n.top-n.bottom,w=d3.select(this);c=t.xScale();h=t.yScale();d=d||c;v=v||h;var E=w.selectAll("g.nv-wrap.nv-line").data([m]);var S=E.enter().append("g").attr("class","nvd3 nv-wrap nv-line");var T=S.append("defs");var N=S.append("g");var C=E.select("g");N.append("g").attr("class","nv-groups");N.append("g").attr("class","nv-scatterWrap");E.attr("transform","translate("+n.left+","+n.top+")");t.width(g).height(b);var k=E.select(".nv-scatterWrap");k.transition().call(t);T.append("clipPath").attr("id","nv-edge-clip-"+t.id()).append("rect");E.select("#nv-edge-clip-"+t.id()+" rect").attr("width",g).attr("height",b);C.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");k.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");var L=E.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});L.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);L.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();L.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return s(e,t)}).style("stroke",function(e,t){return s(e,t)});L.transition().style("stroke-opacity",1).style("fill-opacity",.5);var A=L.selectAll("path.nv-area").data(function(e){return f(e)?[e]:[]});A.enter().append("path").attr("class","nv-area").attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}).y1(function(e,t){return v(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});L.exit().selectAll("path.nv-area").remove();A.transition().attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}).y1(function(e,t){return h(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});var O=L.selectAll("path.nv-line").data(function(e){return[e.values]});O.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}));L.exit().selectAll("path.nv-line").transition().attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}));O.transition().attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}));d=c.copy();v=h.copy()});return m}var t=e.models.scatter();var n={top:0,right:0,bottom:0,left:0},r=960,i=500,s=e.utils.defaultColor(),o=function(e){return e.x},u=function(e){return e.y},a=function(e,t){return!isNaN(u(e,t))&&u(e,t)!==null},f=function(e){return e.area},l=false,c,h,p="linear";t.size(16).sizeDomain([16,256]);var d,v;m.dispatch=t.dispatch;m.scatter=t;d3.rebind(m,t,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","padData","highlightPoint","clearHighlights");m.options=e.utils.optionsFunc.bind(m);m.margin=function(e){if(!arguments.length)return n;n.top=typeof e.top!="undefined"?e.top:n.top;n.right=typeof e.right!="undefined"?e.right:n.right;n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom;n.left=typeof e.left!="undefined"?e.left:n.left;return m};m.width=function(e){if(!arguments.length)return r;r=e;return m};m.height=function(e){if(!arguments.length)return i;i=e;return m};m.x=function(e){if(!arguments.length)return o;o=e;t.x(e);return m};m.y=function(e){if(!arguments.length)return u;u=e;t.y(e);return m};m.clipEdge=function(e){if(!arguments.length)return l;l=e;return m};m.color=function(n){if(!arguments.length)return s;s=e.utils.getColor(n);t.color(s);return m};m.interpolate=function(e){if(!arguments.length)return p;p=e;return m};m.defined=function(e){if(!arguments.length)return a;a=e;return m};m.isArea=function(e){if(!arguments.length)return f;f=d3.functor(e);return m};return m};e.models.lineChart=function(){"use strict";function N(m){m.each(function(m){var C=d3.select(this),k=this;var L=(a||parseInt(C.style("width"))||960)-o.left-o.right,A=(f||parseInt(C.style("height"))||400)-o.top-o.bottom;N.update=function(){C.transition().duration(x).call(N)};N.container=this;b.disabled=m.map(function(e){return!!e.disabled});if(!w){var O;w={};for(O in b){if(b[O]instanceof Array)w[O]=b[O].slice(0);else w[O]=b[O]}}if(!m||!m.length||!m.filter(function(e){return e.values.length}).length){var M=C.selectAll(".nv-noData").data([E]);M.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");M.attr("x",o.left+L/2).attr("y",o.top+A/2).text(function(e){return e});return N}else{C.selectAll(".nv-noData").remove()}g=t.xScale();y=t.yScale();var _=C.selectAll("g.nv-wrap.nv-lineChart").data([m]);var D=_.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g");var P=_.select("g");D.append("rect").style("opacity",0);D.append("g").attr("class","nv-x nv-axis");D.append("g").attr("class","nv-y nv-axis");D.append("g").attr("class","nv-linesWrap");D.append("g").attr("class","nv-legendWrap");D.append("g").attr("class","nv-interactive");P.select("rect").attr("width",L).attr("height",A);if(l){i.width(L);P.select(".nv-legendWrap").datum(m).call(i);if(o.top!=i.height()){o.top=i.height();A=(f||parseInt(C.style("height"))||400)-o.top-o.bottom}_.select(".nv-legendWrap").attr("transform","translate(0,"+ -o.top+")")}_.attr("transform","translate("+o.left+","+o.top+")");if(p){P.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)")}if(d){s.width(L).height(A).margin({left:o.left,top:o.top}).svgContainer(C).xScale(g);_.select(".nv-interactive").call(s)}t.width(L).height(A).color(m.map(function(e,t){return e.color||u(e,t)}).filter(function(e,t){return!m[t].disabled}));var H=P.select(".nv-linesWrap").datum(m.filter(function(e){return!e.disabled}));H.transition().call(t);if(c){n.scale(g).ticks(L/100).tickSize(-A,0);P.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");P.select(".nv-x.nv-axis").transition().call(n)}if(h){r.scale(y).ticks(A/36).tickSize(-L,0);P.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);N.update()});s.dispatch.on("elementMousemove",function(i){t.clearHighlights();var a,f,l,c=[];m.filter(function(e,t){e.seriesIndex=t;return!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,N.x());t.highlightPoint(r,f,true);var s=n.values[f];if(typeof s==="undefined")return;if(typeof a==="undefined")a=s;if(typeof l==="undefined")l=N.xScale()(N.x()(s,f));c.push({key:n.key,value:N.y()(s,f),color:u(n,n.seriesIndex)})});if(c.length>2){var h=N.yScale().invert(i.mouseY);var p=Math.abs(N.yScale().domain()[0]-N.yScale().domain()[1]);var d=.03*p;var g=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);if(g!==null)c[g].highlight=true}var y=n.tickFormat()(N.x()(a,f));s.tooltip.position({left:l+o.left,top:i.mouseY+o.top}).chartContainer(k.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:y,series:c})();s.renderGuideLine(l)});s.dispatch.on("elementMouseout",function(e){S.tooltipHide();t.clearHighlights()});S.on("tooltipShow",function(e){if(v)T(e,k.parentNode)});S.on("changeState",function(e){if(typeof e.disabled!=="undefined"){m.forEach(function(t,n){t.disabled=e.disabled[n]});b.disabled=e.disabled}N.update()})});return N}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.interactiveGuideline();var o={top:30,right:20,bottom:50,left:60},u=e.utils.defaultColor(),a=null,f=null,l=true,c=true,h=true,p=false,d=false,v=true,m=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=250;n.orient("bottom").tickPadding(7);r.orient(p?"right":"left");var T=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=m(i.series.key,a,f,i,N);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(v)e.tooltip.cleanup()});N.dispatch=S;N.lines=t;N.legend=i;N.xAxis=n;N.yAxis=r;N.interactiveLayer=s;d3.rebind(N,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id","interpolate");N.options=e.utils.optionsFunc.bind(N);N.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return N};N.width=function(e){if(!arguments.length)return a;a=e;return N};N.height=function(e){if(!arguments.length)return f;f=e;return N};N.color=function(t){if(!arguments.length)return u;u=e.utils.getColor(t);i.color(u);return N};N.showLegend=function(e){if(!arguments.length)return l;l=e;return N};N.showXAxis=function(e){if(!arguments.length)return c;c=e;return N};N.showYAxis=function(e){if(!arguments.length)return h;h=e;return N};N.rightAlignYAxis=function(e){if(!arguments.length)return p;p=e;r.orient(e?"right":"left");return N};N.useInteractiveGuideline=function(e){if(!arguments.length)return d;d=e;if(e===true){N.interactive(false);N.useVoronoi(false)}return N};N.tooltips=function(e){if(!arguments.length)return v;v=e;return N};N.tooltipContent=function(e){if(!arguments.length)return m;m=e;return N};N.state=function(e){if(!arguments.length)return b;b=e;return N};N.defaultState=function(e){if(!arguments.length)return w;w=e;return N};N.noData=function(e){if(!arguments.length)return E;E=e;return N};N.transitionDuration=function(e){if(!arguments.length)return x;x=e;return N};return N};e.models.linePlusBarChart=function(){"use strict";function T(e){e.each(function(e){var l=d3.select(this),c=this;var v=(a||parseInt(l.style("width"))||960)-u.left-u.right,N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom;T.update=function(){l.transition().call(T)};b.disabled=e.map(function(e){return!!e.disabled});if(!w){var C;w={};for(C in b){if(b[C]instanceof Array)w[C]=b[C].slice(0);else w[C]=b[C]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var k=l.selectAll(".nv-noData").data([E]);k.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");k.attr("x",u.left+v/2).attr("y",u.top+N/2).text(function(e){return e});return T}else{l.selectAll(".nv-noData").remove()}var L=e.filter(function(e){return!e.disabled&&e.bar});var A=e.filter(function(e){return!e.bar});m=A.filter(function(e){return!e.disabled}).length&&A.filter(function(e){return!e.disabled})[0].values.length?t.xScale():n.xScale();g=n.yScale();y=t.yScale();var O=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([e]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");var _=O.select("g");M.append("g").attr("class","nv-x nv-axis");M.append("g").attr("class","nv-y1 nv-axis");M.append("g").attr("class","nv-y2 nv-axis");M.append("g").attr("class","nv-barsWrap");M.append("g").attr("class","nv-linesWrap");M.append("g").attr("class","nv-legendWrap");if(p){o.width(v/2);_.select(".nv-legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)");return e})).call(o);if(u.top!=o.height()){u.top=o.height();N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom}_.select(".nv-legendWrap").attr("transform","translate("+v/2+","+ -u.top+")")}O.attr("transform","translate("+u.left+","+u.top+")");t.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));n.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));var D=_.select(".nv-barsWrap").datum(L.length?L:[{values:[]}]);var P=_.select(".nv-linesWrap").datum(A[0]&&!A[0].disabled?A:[{values:[]}]);d3.transition(D).call(n);d3.transition(P).call(t);r.scale(m).ticks(v/100).tickSize(-N,0);_.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")");d3.transition(_.select(".nv-x.nv-axis")).call(r);i.scale(g).ticks(N/36).tickSize(-v,0);d3.transition(_.select(".nv-y1.nv-axis")).style("opacity",L.length?1:0).call(i);s.scale(y).ticks(N/36).tickSize(L.length?0:-v,0);_.select(".nv-y2.nv-axis").style("opacity",A.length?1:0).attr("transform","translate("+v+",0)");d3.transition(_.select(".nv-y2.nv-axis")).call(s);o.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);T.update()});S.on("tooltipShow",function(e){if(d)x(e,c.parentNode)});S.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});b.disabled=t.disabled}T.update()})});return T}var t=e.models.line(),n=e.models.historicalBar(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.legend();var u={top:30,right:60,bottom:50,left:60},a=null,f=null,l=function(e){return e.x},c=function(e){return e.y},h=e.utils.defaultColor(),p=true,d=true,v=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},m,g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");n.padData(true);t.clipEdge(false).padData(true);r.orient("bottom").tickPadding(7).highlightZero(false);i.orient("left");s.orient("right");var x=function(n,o){var u=n.pos[0]+(o.offsetLeft||0),a=n.pos[1]+(o.offsetTop||0),f=r.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?i:s).tickFormat()(t.y()(n.point,n.pointIndex)),c=v(n.series.key,f,l,n,T);e.tooltip.show([u,a],c,n.value<0?"n":"s",null,o)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});n.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];S.tooltipShow(e)});n.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(d)e.tooltip.cleanup()});T.dispatch=S;T.legend=o;T.lines=t;T.bars=n;T.xAxis=r;T.y1Axis=i;T.y2Axis=s;d3.rebind(T,t,"defined","size","clipVoronoi","interpolate");T.options=e.utils.optionsFunc.bind(T);T.x=function(e){if(!arguments.length)return l;l=e;t.x(e);n.x(e);return T};T.y=function(e){if(!arguments.length)return c;c=e;t.y(e);n.y(e);return T};T.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return T};T.width=function(e){if(!arguments.length)return a;a=e;return T};T.height=function(e){if(!arguments.length)return f;f=e;return T};T.color=function(t){if(!arguments.length)return h;h=e.utils.getColor(t);o.color(h);return T};T.showLegend=function(e){if(!arguments.length)return p;p=e;return T};T.tooltips=function(e){if(!arguments.length)return d;d=e;return T};T.tooltipContent=function(e){if(!arguments.length)return v;v=e;return T};T.state=function(e){if(!arguments.length)return b;b=e;return T};T.defaultState=function(e){if(!arguments.length)return w;w=e;return T};T.noData=function(e){if(!arguments.length)return E;E=e;return T};return T};e.models.lineWithFocusChart=function(){"use strict";function k(e){e.each(function(e){function U(e){var t=+(e=="e"),n=t?1:-1,r=M/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function z(){if(!a.empty())a.extent(w);I.data([a.empty()?g.domain():w]).each(function(e,t){var n=g(e[0])-v.range()[0],r=v.range()[1]-g(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n);d3.select(this).select(".right").attr("x",g(e[1])).attr("width",r<0?0:r)})}function W(){w=a.empty()?null:a.extent();var n=a.empty()?g.domain():a.extent();if(Math.abs(n[0]-n[1])<=1){return}T.brush({extent:n,brush:a});z();var s=H.select(".nv-focus .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}).map(function(e,r){return{key:e.key,values:e.values.filter(function(e,r){return t.x()(e,r)>=n[0]&&t.x()(e,r)<=n[1]})}}));s.transition().duration(N).call(t);H.select(".nv-focus .nv-x.nv-axis").transition().duration(N).call(r);H.select(".nv-focus .nv-y.nv-axis").transition().duration(N).call(i)}var S=d3.select(this),L=this;var A=(h||parseInt(S.style("width"))||960)-f.left-f.right,O=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d,M=d-l.top-l.bottom;k.update=function(){S.transition().duration(N).call(k)};k.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var _=S.selectAll(".nv-noData").data([x]);_.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");_.attr("x",f.left+A/2).attr("y",f.top+O/2).text(function(e){return e});return k}else{S.selectAll(".nv-noData").remove()}v=t.xScale();m=t.yScale();g=n.xScale();y=n.yScale();var D=S.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([e]);var P=D.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g");var H=D.select("g");P.append("g").attr("class","nv-legendWrap");var B=P.append("g").attr("class","nv-focus");B.append("g").attr("class","nv-x nv-axis");B.append("g").attr("class","nv-y nv-axis");B.append("g").attr("class","nv-linesWrap");var j=P.append("g").attr("class","nv-context");j.append("g").attr("class","nv-x nv-axis");j.append("g").attr("class","nv-y nv-axis");j.append("g").attr("class","nv-linesWrap");j.append("g").attr("class","nv-brushBackground");j.append("g").attr("class","nv-x nv-brush");if(b){u.width(A);H.select(".nv-legendWrap").datum(e).call(u);if(f.top!=u.height()){f.top=u.height();O=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d}H.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")}D.attr("transform","translate("+f.left+","+f.top+")");t.width(A).height(O).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));n.defined(t.defined()).width(A).height(M).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));H.select(".nv-context").attr("transform","translate(0,"+(O+f.bottom+l.top)+")");var F=H.select(".nv-context .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}));d3.transition(F).call(n);r.scale(v).ticks(A/100).tickSize(-O,0);i.scale(m).ticks(O/36).tickSize(-A,0);H.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+O+")");a.x(g).on("brush",function(){var e=k.transitionDuration();k.transitionDuration(0);W();k.transitionDuration(e)});if(w)a.extent(w);var I=H.select(".nv-brushBackground").selectAll("g").data([w||a.extent()]);var q=I.enter().append("g");q.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",M);q.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",M);var R=H.select(".nv-x.nv-brush").call(a);R.selectAll("rect").attr("height",M);R.selectAll(".resize").append("path").attr("d",U);W();s.scale(g).ticks(A/100).tickSize(-M,0);H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");d3.transition(H.select(".nv-context .nv-x.nv-axis")).call(s);o.scale(y).ticks(M/36).tickSize(-A,0);d3.transition(H.select(".nv-context .nv-y.nv-axis")).call(o);H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");u.dispatch.on("stateChange",function(e){k.update()});T.on("tooltipShow",function(e){if(E)C(e,L.parentNode)})});return k}var t=e.models.line(),n=e.models.line(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.axis(),u=e.models.legend(),a=d3.svg.brush();var f={top:30,right:30,bottom:30,left:60},l={top:0,right:30,bottom:20,left:60},c=e.utils.defaultColor(),h=null,p=null,d=100,v,m,g,y,b=true,w=null,E=true,S=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},x="No Data Available.",T=d3.dispatch("tooltipShow","tooltipHide","brush"),N=250;t.clipEdge(true);n.interactive(false);r.orient("bottom").tickPadding(5);i.orient("left");s.orient("bottom").tickPadding(5);o.orient("left");var C=function(n,s){var o=n.pos[0]+(s.offsetLeft||0),u=n.pos[1]+(s.offsetTop||0),a=r.tickFormat()(t.x()(n.point,n.pointIndex)),f=i.tickFormat()(t.y()(n.point,n.pointIndex)),l=S(n.series.key,a,f,n,k);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+f.left,e.pos[1]+f.top];T.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)});T.on("tooltipHide",function(){if(E)e.tooltip.cleanup()});k.dispatch=T;k.legend=u;k.lines=t;k.lines2=n;k.xAxis=r;k.yAxis=i;k.x2Axis=s;k.y2Axis=o;d3.rebind(k,t,"defined","isArea","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id");k.options=e.utils.optionsFunc.bind(k);k.x=function(e){if(!arguments.length)return t.x;t.x(e);n.x(e);return k};k.y=function(e){if(!arguments.length)return t.y;t.y(e);n.y(e);return k};k.margin=function(e){if(!arguments.length)return f;f.top=typeof e.top!="undefined"?e.top:f.top;f.right=typeof e.right!="undefined"?e.right:f.right;f.bottom=typeof e.bottom!="undefined"?e.bottom:f.bottom;f.left=typeof e.left!="undefined"?e.left:f.left;return k};k.margin2=function(e){if(!arguments.length)return l;l=e;return k};k.width=function(e){if(!arguments.length)return h;h=e;return k};k.height=function(e){if(!arguments.length)return p;p=e;return k};k.height2=function(e){if(!arguments.length)return d;d=e;return k};k.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);u.color(c);return k};k.showLegend=function(e){if(!arguments.length)return b;b=e;return k};k.tooltips=function(e){if(!arguments.length)return E;E=e;return k};k.tooltipContent=function(e){if(!arguments.length)return S;S=e;return k};k.interpolate=function(e){if(!arguments.length)return t.interpolate();t.interpolate(e);n.interpolate(e);return k};k.noData=function(e){if(!arguments.length)return x;x=e;return k};k.xTickFormat=function(e){if(!arguments.length)return r.tickFormat();r.tickFormat(e);s.tickFormat(e);return k};k.yTickFormat=function(e){if(!arguments.length)return i.tickFormat();i.tickFormat(e);o.tickFormat(e);return k};k.brushExtent=function(e){if(!arguments.length)return w;w=e;return k};k.transitionDuration=function(e){if(!arguments.length)return N;N=e;return k};return k};e.models.linePlusBarWithFocusChart=function(){"use strict";function B(e){e.each(function(e){function nt(e){var t=+(e=="e"),n=t?1:-1,r=q/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function rt(){if(!h.empty())h.extent(x);Z.data([h.empty()?k.domain():x]).each(function(e,t){var n=k(e[0])-k.range()[0],r=k.range()[1]-k(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n);d3.select(this).select(".right").attr("x",k(e[1])).attr("width",r<0?0:r)})}function it(){x=h.empty()?null:h.extent();S=h.empty()?k.domain():h.extent();D.brush({extent:S,brush:h});rt();r.width(F).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));t.width(F).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var n=J.select(".nv-focus .nv-barsWrap").datum(!U.length?[{values:[]}]:U.map(function(e,t){return{key:e.key,values:e.values.filter(function(e,t){return r.x()(e,t)>=S[0]&&r.x()(e,t)<=S[1]})}}));var i=J.select(".nv-focus .nv-linesWrap").datum(z[0].disabled?[{values:[]}]:z.map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return t.x()(e,n)>=S[0]&&t.x()(e,n)<=S[1]})}}));if(U.length){C=r.xScale()}else{C=t.xScale()}s.scale(C).ticks(F/100).tickSize(-I,0);s.domain([Math.ceil(S[0]),Math.floor(S[1])]);J.select(".nv-x.nv-axis").transition().duration(P).call(s);n.transition().duration(P).call(r);i.transition().duration(P).call(t);J.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+L.range()[0]+")");u.scale(L).ticks(I/36).tickSize(-F,0);J.select(".nv-focus .nv-y1.nv-axis").style("opacity",U.length?1:0);a.scale(A).ticks(I/36).tickSize(U.length?0:-F,0);J.select(".nv-focus .nv-y2.nv-axis").style("opacity",z.length?1:0).attr("transform","translate("+C.range()[1]+",0)");J.select(".nv-focus .nv-y1.nv-axis").transition().duration(P).call(u);J.select(".nv-focus .nv-y2.nv-axis").transition().duration(P).call(a)}var N=d3.select(this),j=this;var F=(v||parseInt(N.style("width"))||960)-p.left-p.right,I=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g,q=g-d.top-d.bottom;B.update=function(){N.transition().duration(P).call(B)};B.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var R=N.selectAll(".nv-noData").data([_]);R.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");R.attr("x",p.left+F/2).attr("y",p.top+I/2).text(function(e){return e});return B}else{N.selectAll(".nv-noData").remove()}var U=e.filter(function(e){return!e.disabled&&e.bar});var z=e.filter(function(e){return!e.bar});C=r.xScale();k=o.scale();L=r.yScale();A=t.yScale();O=i.yScale();M=n.yScale();var W=e.filter(function(e){return!e.disabled&&e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});var X=e.filter(function(e){return!e.disabled&&!e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});C.range([0,F]);k.domain(d3.extent(d3.merge(W.concat(X)),function(e){return e.x})).range([0,F]);var V=N.selectAll("g.nv-wrap.nv-linePlusBar").data([e]);var $=V.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");var J=V.select("g");$.append("g").attr("class","nv-legendWrap");var K=$.append("g").attr("class","nv-focus");K.append("g").attr("class","nv-x nv-axis");K.append("g").attr("class","nv-y1 nv-axis");K.append("g").attr("class","nv-y2 nv-axis");K.append("g").attr("class","nv-barsWrap");K.append("g").attr("class","nv-linesWrap");var Q=$.append("g").attr("class","nv-context");Q.append("g").attr("class","nv-x nv-axis");Q.append("g").attr("class","nv-y1 nv-axis");Q.append("g").attr("class","nv-y2 nv-axis");Q.append("g").attr("class","nv-barsWrap");Q.append("g").attr("class","nv-linesWrap");Q.append("g").attr("class","nv-brushBackground");Q.append("g").attr("class","nv-x nv-brush");if(E){c.width(F/2);J.select(".nv-legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)");return e})).call(c);if(p.top!=c.height()){p.top=c.height();I=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g}J.select(".nv-legendWrap").attr("transform","translate("+F/2+","+ -p.top+")")}V.attr("transform","translate("+p.left+","+p.top+")");i.width(F).height(q).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));n.width(F).height(q).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var G=J.select(".nv-context .nv-barsWrap").datum(U.length?U:[{values:[]}]);var Y=J.select(".nv-context .nv-linesWrap").datum(!z[0].disabled?z:[{values:[]}]);J.select(".nv-context").attr("transform","translate(0,"+(I+p.bottom+d.top)+")");G.transition().call(i);Y.transition().call(n);h.x(k).on("brush",it);if(x)h.extent(x);var Z=J.select(".nv-brushBackground").selectAll("g").data([x||h.extent()]);var et=Z.enter().append("g");et.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",q);et.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",q);var tt=J.select(".nv-x.nv-brush").call(h);tt.selectAll("rect").attr("height",q);tt.selectAll(".resize").append("path").attr("d",nt);o.ticks(F/100).tickSize(-q,0);J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+O.range()[0]+")");J.select(".nv-context .nv-x.nv-axis").transition().call(o);f.scale(O).ticks(q/36).tickSize(-F,0);J.select(".nv-context .nv-y1.nv-axis").style("opacity",U.length?1:0).attr("transform","translate(0,"+k.range()[0]+")");J.select(".nv-context .nv-y1.nv-axis").transition().call(f);l.scale(M).ticks(q/36).tickSize(U.length?0:-F,0);J.select(".nv-context .nv-y2.nv-axis").style("opacity",z.length?1:0).attr("transform","translate("+k.range()[1]+",0)");J.select(".nv-context .nv-y2.nv-axis").transition().call(l);c.dispatch.on("stateChange",function(e){B.update()});D.on("tooltipShow",function(e){if(T)H(e,j.parentNode)});it()});return B}var t=e.models.line(),n=e.models.line(),r=e.models.historicalBar(),i=e.models.historicalBar(),s=e.models.axis(),o=e.models.axis(),u=e.models.axis(),a=e.models.axis(),f=e.models.axis(),l=e.models.axis(),c=e.models.legend(),h=d3.svg.brush();var p={top:30,right:30,bottom:30,left:60},d={top:0,right:30,bottom:20,left:60},v=null,m=null,g=100,y=function(e){return e.x},b=function(e){return e.y},w=e.utils.defaultColor(),E=true,S,x=null,T=true,N=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},C,k,L,A,O,M,_="No Data Available.",D=d3.dispatch("tooltipShow","tooltipHide","brush"),P=0;t.clipEdge(true);n.interactive(false);s.orient("bottom").tickPadding(5);u.orient("left");a.orient("right");o.orient("bottom").tickPadding(5);f.orient("left");l.orient("right");var H=function(n,r){if(S){n.pointIndex+=Math.ceil(S[0])}var i=n.pos[0]+(r.offsetLeft||0),o=n.pos[1]+(r.offsetTop||0),f=s.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?u:a).tickFormat()(t.y()(n.point,n.pointIndex)),c=N(n.series.key,f,l,n,B);e.tooltip.show([i,o],c,n.value<0?"n":"s",null,r)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top];D.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)});r.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top];D.tooltipShow(e)});r.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)});D.on("tooltipHide",function(){if(T)e.tooltip.cleanup()});B.dispatch=D;B.legend=c;B.lines=t;B.lines2=n;B.bars=r;B.bars2=i;B.xAxis=s;B.x2Axis=o;B.y1Axis=u;B.y2Axis=a;B.y3Axis=f;B.y4Axis=l;d3.rebind(B,t,"defined","size","clipVoronoi","interpolate");B.options=e.utils.optionsFunc.bind(B);B.x=function(e){if(!arguments.length)return y;y=e;t.x(e);r.x(e);return B};B.y=function(e){if(!arguments.length)return b;b=e;t.y(e);r.y(e);return B};B.margin=function(e){if(!arguments.length)return p;p.top=typeof e.top!="undefined"?e.top:p.top;p.right=typeof e.right!="undefined"?e.right:p.right;p.bottom=typeof e.bottom!="undefined"?e.bottom:p.bottom;p.left=typeof e.left!="undefined"?e.left:p.left;return B};B.width=function(e){if(!arguments.length)return v;v=e;return B};B.height=function(e){if(!arguments.length)return m;m=e;return B};B.color=function(t){if(!arguments.length)return w;w=e.utils.getColor(t);c.color(w);return B};B.showLegend=function(e){if(!arguments.length)return E;E=e;return B};B.tooltips=function(e){if(!arguments.length)return T;T=e;return B};B.tooltipContent=function(e){if(!arguments.length)return N;N=e;return B};B.noData=function(e){if(!arguments.length)return _;_=e;return B};B.brushExtent=function(e){if(!arguments.length)return x;x=e;return B};return B};e.models.multiBar=function(){"use strict";function C(e){e.each(function(e){var C=n-t.left-t.right,k=r-t.top-t.bottom,L=d3.select(this);if(d&&e.length)d=[{values:e[0].values.map(function(e){return{x:e.x,y:0,series:e.series,size:.01}})}];if(c)e=d3.layout.stack().offset(h).values(function(e){return e.values}).y(a)(!e.length&&d?d:e);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});if(c)e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y);if(t.y<0){t.y1=i;i=i-t.size}else{t.y1=t.size+r;r=r+t.size}})});var A=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});i.domain(y||d3.merge(A).map(function(e){return e.x})).rangeBands(w||[0,C],S);s.domain(b||d3.extent(d3.merge(A).map(function(e){return c?e.y>0?e.y1:e.y1+e.y:e.y}).concat(f))).range(E||[k,0]);if(i.domain()[0]===i.domain()[1])i.domain()[0]?i.domain([i.domain()[0]-i.domain()[0]*.01,i.domain()[1]+i.domain()[1]*.01]):i.domain([-1,1]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]+s.domain()[0]*.01,s.domain()[1]-s.domain()[1]*.01]):s.domain([-1,1]);T=T||i;N=N||s;var O=L.selectAll("g.nv-wrap.nv-multibar").data([e]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar");var _=M.append("defs");var D=M.append("g");var P=O.select("g");D.append("g").attr("class","nv-groups");O.attr("transform","translate("+t.left+","+t.top+")");_.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect");O.select("#nv-edge-clip-"+o+" rect").attr("width",C).attr("height",k);P.attr("clip-path",l?"url(#nv-edge-clip-"+o+")":"");var H=O.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});H.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);H.exit().transition().selectAll("rect.nv-bar").delay(function(t,n){return n*g/e[0].values.length}).attr("y",function(e){return c?N(e.y0):N(0)}).attr("height",0).remove();H.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return p(e,t)}).style("stroke",function(e,t){return p(e,t)});H.transition().style("stroke-opacity",1).style("fill-opacity",.75);var B=H.selectAll("rect.nv-bar").data(function(t){return d&&!e.length?d.values:t.values});B.exit().remove();var j=B.enter().append("rect").attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,n,r){return c?0:r*i.rangeBand()/e.length}).attr("y",function(e){return N(c?e.y0:0)}).attr("height",0).attr("width",i.rangeBand()/(c?1:e.length)).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});B.style("fill",function(e,t,n){return p(e,n,t)}).style("stroke",function(e,t,n){return p(e,n,t)}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);x.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);x.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){x.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){x.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});B.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).transition().attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});if(v){if(!m)m=e.map(function(){return true});B.style("fill",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()})}if(c)B.transition().delay(function(t,n){return n*g/e[0].values.length}).attr("y",function(e,t){return s(c?e.y1:0)}).attr("height",function(e,t){if(e.y==null)return 0;return Math.max(Math.abs(s(e.y+(c?e.y0:0))-s(c?e.y0:0)),1)}).attr("x",function(t,n){return c?0:t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/(c?1:e.length));else B.transition().delay(function(t,n){return n*g/e[0].values.length}).attr("x",function(t,n){return t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/e.length).attr("y",function(e,t){return a(e,t)<0?s(0):s(0)-s(a(e,t))<1?s(0)-1:s(a(e,t))||0}).attr("height",function(e,t){if(e.y==null)return 0;return Math.max(Math.abs(s(a(e,t))-s(0)),1)||0});T=i.copy();N=s.copy()});return C}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=d3.scale.ordinal(),s=d3.scale.linear(),o=Math.floor(Math.random()*1e4),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=true,c=false,h="zero",p=e.utils.defaultColor(),d=false,v=null,m,g=1200,y,b,w,E,S=.1,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var T,N;C.dispatch=x;C.options=e.utils.optionsFunc.bind(C);C.x=function(e){if(!arguments.length)return u;u=e;return C};C.y=function(e){if(!arguments.length)return a;a=e;return C};C.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return C};C.width=function(e){if(!arguments.length)return n;n=e;return C};C.height=function(e){if(!arguments.length)return r;r=e;return C};C.xScale=function(e){if(!arguments.length)return i;i=e;return C};C.yScale=function(e){if(!arguments.length)return s;s=e;return C};C.xDomain=function(e){if(!arguments.length)return y;y=e;return C};C.yDomain=function(e){if(!arguments.length)return b;b=e;return C};C.xRange=function(e){if(!arguments.length)return w;w=e;return C};C.yRange=function(e){if(!arguments.length)return E;E=e;return C};C.forceY=function(e){if(!arguments.length)return f;f=e;return C};C.stacked=function(e){if(!arguments.length)return c;c=e;return C};C.stackOffset=function(e){if(!arguments.length)return h;h=e;return C};C.clipEdge=function(e){if(!arguments.length)return l;l=e;return C};C.color=function(t){if(!arguments.length)return p;p=e.utils.getColor(t);return C};C.barColor=function(t){if(!arguments.length)return v;v=e.utils.getColor(t);return C};C.disabled=function(e){if(!arguments.length)return m;m=e;return C};C.id=function(e){if(!arguments.length)return o;o=e;return C};C.hideable=function(e){if(!arguments.length)return d;d=e;return C};C.delay=function(e){if(!arguments.length)return g;g=e;return C};C.groupSpacing=function(e){if(!arguments.length)return S;S=e;return C};return C};e.models.multiBarChart=function(){"use strict";function M(e){e.each(function(e){var h=d3.select(this),E=this;var _=(u||parseInt(h.style("width"))||960)-o.left-o.right,D=(a||parseInt(h.style("height"))||400)-o.top-o.bottom;M.update=function(){h.transition().duration(A).call(M)};M.container=this;if(w=="right")_=_-250;T.disabled=e.map(function(e){return!!e.disabled});if(!N){var P;N={};for(P in T){if(T[P]instanceof Array)N[P]=T[P].slice(0);else N[P]=T[P]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var H=h.selectAll(".nv-noData").data([C]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");H.attr("x",o.left+_/2).attr("y",o.top+D/2).text(function(e){return e});return M}else{h.selectAll(".nv-noData").remove()}S=t.xScale();x=t.yScale();var B=h.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([e]);var j=B.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g");var F=B.select("g");j.append("g").attr("class","nv-x nv-axis");j.append("g").attr("class","nv-y nv-axis");j.append("g").attr("class","nv-barsWrap");j.append("g").attr("class","nv-legendWrap");j.append("g").attr("class","nv-controlsWrap");if(c){i.width(_-L());if(t.barColor())e.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()});F.select(".nv-legendWrap").datum(e).call(i);if(o.top!=i.height()){o.top=i.height();D=(a||parseInt(h.style("height"))||400)-o.top-o.bottom}if(w=="right"){F.select(".nv-legendWrap").attr("transform","translate("+_+","+(-o.top+20+30)+")")}else{F.select(".nv-legendWrap").attr("transform","translate("+L()+","+ -o.top+")")}}if(l){var I=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(L()).color(["#444","#444","#444"]);F.select(".nv-controlsWrap").datum(I).call(s);if(w=="right"){F.select(".nv-controlsWrap").attr("transform","translate("+_+","+(-o.top+20)+")")}else{F.select(".nv-controlsWrap").attr("transform","translate("+0+","+ -o.top+")")}}B.attr("transform","translate("+o.left+","+o.top+")");if(v){F.select(".nv-y.nv-axis").attr("transform","translate("+_+",0)")}t.disabled(e.map(function(e){return e.disabled})).width(_).height(D).color(e.map(function(e,t){return e.color||f(e,t)}).filter(function(t,n){return!e[n].disabled}));var q=F.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));q.transition().call(t);if(p){n.scale(S).ticks(_/100).tickSize(-D,0);F.select(".nv-x.nv-axis").attr("transform","translate(0,"+x.range()[0]+")");F.select(".nv-x.nv-axis").transition().call(n);var R=F.select(".nv-x.nv-axis > g").selectAll("g");R.selectAll("line, text").style("opacity",1);if(g){var U=function(e,t){return"translate("+e+","+t+")"};var z=5,W=17;R.selectAll("text").attr("transform",function(e,t,n){return U(0,n%2==0?z:W)});var X=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;F.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(e,t){return U(0,t===0||X%2!==0?W:z)})}if(m)R.filter(function(t,n){return n%Math.ceil(e[0].values.length/(_/100))!==0}).selectAll("text, line").style("opacity",0);if(y)R.selectAll(".tick text").attr("transform","rotate("+y+" 0,0)").style("text-anchor",y>0?"start":"end");F.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}if(d){r.scale(x).ticks(D/36).tickSize(-_,0);F.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("stateChange",function(e){T=e;k.stateChange(T);M.update()});s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;I=I.map(function(e){e.disabled=true;return e});e.disabled=false;switch(e.key){case"Grouped":t.stacked(false);break;case"Stacked":t.stacked(true);break}T.stacked=t.stacked();k.stateChange(T);M.update()});k.on("tooltipShow",function(e){if(b)O(e,E.parentNode)});k.on("changeState",function(n){if(typeof n.disabled!=="undefined"){e.forEach(function(e,t){e.disabled=n.disabled[t]});T.disabled=n.disabled}if(typeof n.stacked!=="undefined"){t.stacked(n.stacked);T.stacked=n.stacked}M.update()})});return M}var t=e.models.multiBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend();var o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=true,c=true,h=false,p=true,d=true,v=false,m=true,g=false,y=0,b=true,w="top",E=function(e,t,n,r,i,s){if(s){var o=d3.format(",.2f");return"<h3>"+e+"</h3>"+"<p>"+o(Math.pow(10,n))+" on "+t+"</p>"}else{return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"}},S,x,T={stacked:false},N=null,C="No Data Available.",k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=function(){return l?180:0},A=250;t.stacked(false);n.orient("bottom").tickPadding(7).highlightZero(true).showMaxMin(false).tickFormat(function(e){return e});r.orient(v?"right":"left").tickFormat(d3.format(",.1f"));s.updateState(false);var O=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=E(i.series.key,a,f,i,M,h);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];k.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(b)e.tooltip.cleanup()});M.dispatch=k;M.multibar=t;M.legend=i;M.xAxis=n;M.yAxis=r;d3.rebind(M,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","stacked","stackOffset","delay","barColor","groupSpacing");M.options=e.utils.optionsFunc.bind(M);M.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return M};M.width=function(e){if(!arguments.length)return u;u=e;return M};M.height=function(e){if(!arguments.length)return a;a=e;return M};M.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);i.color(f);return M};M.showControls=function(e){if(!arguments.length)return l;l=e;return M};M.showLegend=function(e){if(!arguments.length)return c;c=e;return M};M.logScale=function(e){if(!arguments.length)return h;h=e;return M};M.showXAxis=function(e){if(!arguments.length)return p;p=e;return M};M.showYAxis=function(e){if(!arguments.length)return d;d=e;return M};M.rightAlignYAxis=function(e){if(!arguments.length)return v;v=e;r.orient(e?"right":"left");return M};M.reduceXTicks=function(e){if(!arguments.length)return m;m=e;return M};M.rotateLabels=function(e){if(!arguments.length)return y;y=e;return M};M.staggerLabels=function(e){if(!arguments.length)return g;g=e;return M};M.tooltip=function(e){if(!arguments.length)return E;E=e;return M};M.tooltips=function(e){if(!arguments.length)return b;b=e;return M};M.legendPos=function(e){if(!arguments.length)return w;w=e;return M};M.tooltipContent=function(e){if(!arguments.length)return E;E=e;return M};M.state=function(e){if(!arguments.length)return T;T=e;return M};M.defaultState=function(e){if(!arguments.length)return N;N=e;return M};M.noData=function(e){if(!arguments.length)return C;C=e;return M};M.transitionDuration=function(e){if(!arguments.length)return A;A=e;return M};return M};e.models.multiBarHorizontal=function(){"use strict";function N(e){e.each(function(e){var i=n-t.left-t.right,g=r-t.top-t.bottom,N=d3.select(this);if(p)e=d3.layout.stack().offset("zero").values(function(e){return e.values}).y(a)(e);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});if(p)e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y);if(t.y<0){t.y1=i-t.size;i=i-t.size}else{t.y1=r;r=r+t.size}})});var C=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});s.domain(y||d3.merge(C).map(function(e){return e.x})).rangeBands(w||[0,g],.1);o.domain(b||d3.extent(d3.merge(C).map(function(e){return p?e.y>0?e.y1+e.y:e.y1:e.y}).concat(f)));if(d&&!p)o.range(E||[o.domain()[0]<0?v:0,i-(o.domain()[1]>0?v:0)]);else o.range(E||[0,i]);x=x||s;T=T||d3.scale.linear().domain(o.domain()).range([o(0),o(0)]);var k=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([e]);var L=k.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal");var A=L.append("defs");var O=L.append("g");var M=k.select("g");O.append("g").attr("class","nv-groups");k.attr("transform","translate("+t.left+","+t.top+")");var _=k.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});_.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);_.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();_.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return l(e,t)}).style("stroke",function(e,t){return l(e,t)});_.transition().style("stroke-opacity",1).style("fill-opacity",.75);var D=_.selectAll("g.nv-bar").data(function(e){return e.values});D.exit().remove();var P=D.enter().append("g").attr("transform",function(t,n,r){return"translate("+T(p?t.y0:0)+","+(p?0:r*s.rangeBand()/e.length+s(u(t,n)))+")"});P.append("rect").attr("width",0).attr("height",s.rangeBand()/(p?1:e.length));D.on("mouseover",function(t,n){d3.select(this).classed("hover",true);S.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[o(a(t,n)+(p?t.y0:0)),s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);S.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){S.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){S.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});P.append("text");if(d&&!p){D.select("text").attr("text-anchor",function(e,t){return a(e,t)<0?"end":"start"}).attr("y",s.rangeBand()/(e.length*2)).attr("dy",".32em").text(function(e,t){return m(a(e,t))});D.transition().select("text").attr("x",function(e,t){return a(e,t)<0?-4:o(a(e,t))-o(0)+4})}else{D.selectAll("text").text("")}D.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"});if(c){if(!h)h=e.map(function(){return true});D.style("fill",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()})}if(p)D.transition().attr("transform",function(e,t){return"translate("+o(e.y1)+","+s(u(e,t))+")"}).select("rect").attr("width",function(e,t){return Math.abs(o(a(e,t)+e.y0)-o(e.y0))}).attr("height",s.rangeBand());else D.transition().attr("transform",function(t,n){return"translate("+(a(t,n)<0?o(a(t,n)):o(0))+","+(t.series*s.rangeBand()/e.length+s(u(t,n)))+")"}).select("rect").attr("height",s.rangeBand()/e.length).attr("width",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(0)),1)});x=s.copy();T=o.copy()});return N}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=null,h,p=false,d=false,v=60,m=d3.format(",.2f"),g=1200,y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var x,T;N.dispatch=S;N.options=e.utils.optionsFunc.bind(N);N.x=function(e){if(!arguments.length)return u;u=e;return N};N.y=function(e){if(!arguments.length)return a;a=e;return N};N.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return N};N.width=function(e){if(!arguments.length)return n;n=e;return N};N.height=function(e){if(!arguments.length)return r;r=e;return N};N.xScale=function(e){if(!arguments.length)return s;s=e;return N};N.yScale=function(e){if(!arguments.length)return o;o=e;return N};N.xDomain=function(e){if(!arguments.length)return y;y=e;return N};N.yDomain=function(e){if(!arguments.length)return b;b=e;return N};N.xRange=function(e){if(!arguments.length)return w;w=e;return N};N.yRange=function(e){if(!arguments.length)return E;E=e;return N};N.forceY=function(e){if(!arguments.length)return f;f=e;return N};N.stacked=function(e){if(!arguments.length)return p;p=e;return N};N.color=function(t){if(!arguments.length)return l;l=e.utils.getColor(t);return N};N.barColor=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);return N};N.disabled=function(e){if(!arguments.length)return h;h=e;return N};N.id=function(e){if(!arguments.length)return i;i=e;return N};N.delay=function(e){if(!arguments.length)return g;g=e;return N};N.showValues=function(e){if(!arguments.length)return d;d=e;return N};N.valueFormat=function(e){if(!arguments.length)return m;m=e;return N};N.valuePadding=function(e){if(!arguments.length)return v;v=e;return N};return N};e.models.multiBarHorizontalChart=function(){"use strict";function C(e){e.each(function(h){var p=d3.select(this),m=this;var k=(u||parseInt(p.style("width"))||960)-o.left-o.right,L=(a||parseInt(p.style("height"))||400)-o.top-o.bottom;C.update=function(){p.transition().duration(T).call(C)};C.container=this;if(v=="right")k=k-250;b.disabled=h.map(function(e){return!!e.disabled});if(!w){var A;w={};for(A in b){if(b[A]instanceof Array)w[A]=b[A].slice(0);else w[A]=b[A]}}if(!h||!h.length||!h.filter(function(e){return e.values.length}).length){var O=p.selectAll(".nv-noData").data([E]);O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");O.attr("x",o.left+k/2).attr("y",o.top+L/2).text(function(e){return e});return C}else{p.selectAll(".nv-noData").remove()}g=t.xScale();y=t.yScale();var M=p.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([h]);var _=M.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g");var D=M.select("g");_.append("g").attr("class","nv-x nv-axis");_.append("g").attr("class","nv-y nv-axis");_.append("g").attr("class","nv-barsWrap");_.append("g").attr("class","nv-legendWrap");_.append("g").attr("class","nv-controlsWrap");if(c){i.width(k-x());if(t.barColor())h.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()});D.select(".nv-legendWrap").datum(h).call(i);if(o.top!=i.height()){o.top=i.height();L=(a||parseInt(p.style("height"))||400)-o.top-o.bottom}if(v=="right"){D.select(".nv-legendWrap").attr("transform","translate("+x()+","+20+")")}else{D.select(".nv-legendWrap").attr("transform","translate("+x()+","+ -o.top+")")}}if(l){var P=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(x()).color(["#444","#444","#444"]);D.select(".nv-controlsWrap").datum(P).attr("transform","translate(0,"+ -o.top+")").call(s)}M.attr("transform","translate("+o.left+","+o.top+")");t.disabled(h.map(function(e){return e.disabled})).width(k).height(L).color(h.map(function(e,t){return e.color||f(e,t)}).filter(function(e,t){return!h[t].disabled}));var H=D.select(".nv-barsWrap").datum(h.filter(function(e){return!e.disabled}));H.transition().call(t);n.scale(g).ticks(L/24).tickSize(-k,0);D.select(".nv-x.nv-axis").transition().call(n);var B=D.select(".nv-x.nv-axis").selectAll("g");B.selectAll("line, text").style("opacity",1);r.scale(y).ticks(k/100).tickSize(-L,0);D.select(".nv-y.nv-axis").attr("transform","translate(0,"+L+")");D.select(".nv-y.nv-axis").transition().call(r);i.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);C.update()});s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;P=P.map(function(e){e.disabled=true;return e});e.disabled=false;switch(e.key){case"Grouped":t.stacked(false);break;case"Stacked":t.stacked(true);break}b.stacked=t.stacked();S.stateChange(b);C.update()});S.on("tooltipShow",function(e){if(d)N(e,m.parentNode)});S.on("changeState",function(n){if(typeof n.disabled!=="undefined"){h.forEach(function(e,t){e.disabled=n.disabled[t]});b.disabled=n.disabled}if(typeof n.stacked!=="undefined"){t.stacked(n.stacked);b.stacked=n.stacked}e.call(C)})});return C}var t=e.models.multiBarHorizontal(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend().height(30),s=e.models.legend().height(30);var o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=true,c=true,h=false,p=false,d=true,v="top",m=function(e,t,n,i,s,o){if(o){return"<h3>"+e+" - "+t+"</h3>"+"<p>"+r.tickFormat()(Math.pow(10,n))+"</p>"}else{return"<h3>"+e+" - "+t+"</h3>"+"<p>"+n+"</p>"}},g,y,b={stacked:p},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=function(){return l?180:0},T=250;t.stacked(p);n.orient("left").tickPadding(5).highlightZero(false).showMaxMin(false).tickFormat(function(e){return e});r.orient("bottom").tickFormat(d3.format(",.1f"));s.updateState(false);var N=function(i,s){var o=0;if(i.pos[0]>=200)o=200;else o=i.pos[0];if(h)l=t.y()(i.point,i.pointIndex);else l=r.tickFormat()(t.y()(i.point,i.pointIndex));var u=o+(s.offsetLeft||0),a=i.pos[1]+(s.offsetTop||0),f=n.tickFormat()(t.x()(i.point,i.pointIndex)),l=r.tickFormat()(t.y()(i.point,i.pointIndex)),c=m(i.series.key,f,l,i,C,h);e.tooltip.show([u,a],c,i.value<0?"e":"w",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(d)e.tooltip.cleanup()});C.dispatch=S;C.multibar=t;C.legend=i;C.xAxis=n;C.yAxis=r;d3.rebind(C,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked","barColor");C.options=e.utils.optionsFunc.bind(C);C.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return C};C.width=function(e){if(!arguments.length)return u;u=e;return C};C.height=function(e){if(!arguments.length)return a;a=e;return C};C.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);i.color(f);return C};C.showControls=function(e){if(!arguments.length)return l;l=e;return C};C.showLegend=function(e){if(!arguments.length)return c;c=e;return C};C.logScale=function(e){if(!arguments.length)return h;h=e;return C};C.tooltip=function(e){if(!arguments.length)return m;m=e;return C};C.tooltips=function(e){if(!arguments.length)return d;d=e;return C};C.legendPos=function(e){if(!arguments.length)return v;v=e;return C};C.tooltipContent=function(e){if(!arguments.length)return m;m=e;return C};C.state=function(e){if(!arguments.length)return b;b=e;return C};C.defaultState=function(e){if(!arguments.length)return w;w=e;return C};C.noData=function(e){if(!arguments.length)return E;E=e;return C};C.transitionDuration=function(e){if(!arguments.length)return T;T=e;return C};return C};e.models.multiChart=function(){"use strict";function L(e){e.each(function(e){var f=d3.select(this),c=this;L.update=function(){f.transition().call(L)};L.container=this;var h=(r||parseInt(f.style("width"))||960)-t.left-t.right,p=(i||parseInt(f.style("height"))||400)-t.top-t.bottom;if(a=="right")h=h-250;var A=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==1});var O=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==2});var M=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==1});var _=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==2});var D=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==1});var P=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==2});var H=e.filter(function(e){return!e.disabled&&e.yAxis==1}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});var B=e.filter(function(e){return!e.disabled&&e.yAxis==2}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});l.domain(d3.extent(d3.merge(H.concat(B)),function(e){return e.x})).range([0,h]);var j=f.selectAll("g.wrap.multiChart").data([e]);var F=j.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");F.append("g").attr("class","x axis");F.append("g").attr("class","y1 axis");F.append("g").attr("class","y2 axis");F.append("g").attr("class","lines1Wrap");F.append("g").attr("class","lines2Wrap");F.append("g").attr("class","bars1Wrap");F.append("g").attr("class","bars2Wrap");F.append("g").attr("class","stack1Wrap");F.append("g").attr("class","stack2Wrap");F.append("g").attr("class","legendWrap");var I=j.select("g");if(s){N.width(h/2);I.select(".legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.yAxis==1?"":" (right axis)");return e})).call(N);if(t.top!=N.height()){t.top=N.height();p=(i||parseInt(f.style("height"))||400)-t.top-t.bottom}if(a=="right"){I.select(".legendWrap").attr("transform","translate("+h+","+20+")")}else{I.select(".legendWrap").attr("transform","translate("+h/2+","+ -t.top+")")}}m.width(h).height(p).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="line"}));g.width(h).height(p).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="line"}));y.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="bar"}));b.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="bar"}));w.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="area"}));E.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="area"}));if(a=="right"){I.attr("transform","translate("+t.left+","+"20"+")")}else{I.attr("transform","translate("+t.left+","+t.top+")")}var q=I.select(".lines1Wrap").datum(A);var R=I.select(".bars1Wrap").datum(M);var U=I.select(".stack1Wrap").datum(D);var z=I.select(".lines2Wrap").datum(O);var W=I.select(".bars2Wrap").datum(_);var X=I.select(".stack2Wrap").datum(P);var V=D.length?D.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];var $=P.length?P.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];d.domain(d3.extent(d3.extent(d3.merge(H).concat(V),function(e){return e.y}).concat(m.forceY()))).range([0,p]);v.domain(d3.extent(d3.extent(d3.merge(B).concat($),function(e){return e.y}).concat(g.forceY()))).range([0,p]);m.yDomain(d.domain());y.yDomain(d.domain());w.yDomain(d.domain());g.yDomain(v.domain());b.yDomain(v.domain());E.yDomain(v.domain());if(D.length){d3.transition(U).call(w)}if(P.length){d3.transition(X).call(E)}if(M.length){d3.transition(R).call(y)}if(_.length){d3.transition(W).call(b)}if(A.length){d3.transition(q).call(m)}if(O.length){d3.transition(z).call(g)}S.ticks(h/100).tickSize(-p,0);I.select(".x.axis").attr("transform","translate(0,"+p+")");d3.transition(I.select(".x.axis")).call(S);x.ticks(p/36).tickSize(-h,0);d3.transition(I.select(".y1.axis")).call(x);T.ticks(p/36).tickSize(-h,0);d3.transition(I.select(".y2.axis")).call(T);I.select(".y2.axis").style("opacity",B.length?1:0).attr("transform","translate("+l.range()[1]+",0)");N.dispatch.on("stateChange",function(e){L.update()});if(u){N.dualaxis(true)}else{N.dualaxis(false)}C.on("tooltipShow",function(e){if(o)k(e,c.parentNode)})});return L}var t={top:30,right:20,bottom:50,left:60},n=d3.scale.category20().range(),r=null,i=null,s=true,o=true,u=false,a="top",f=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},l,c,h,p;var l=d3.scale.linear(),d=d3.scale.linear(),v=d3.scale.linear(),m=e.models.line().yScale(d),g=e.models.line().yScale(v),y=e.models.multiBar().stacked(false).yScale(d),b=e.models.multiBar().stacked(false).yScale(v),w=e.models.stackedArea().yScale(d),E=e.models.stackedArea().yScale(v),S=e.models.axis().scale(l).orient("bottom").tickPadding(5),x=e.models.axis().scale(d).orient("left"),T=e.models.axis().scale(v).orient("right"),N=e.models.legend().height(30),C=d3.dispatch("tooltipShow","tooltipHide");var k=function(t,n){var r=t.pos[0]+(n.offsetLeft||0),i=t.pos[1]+(n.offsetTop||0),s=S.tickFormat()(m.x()(t.point,t.pointIndex)),o=(t.series.yAxis==2?T:x).tickFormat()(m.y()(t.point,t.pointIndex)),u=f(t.series.key,s,o,t,L);e.tooltip.show([r,i],u,undefined,undefined,n.offsetParent)};m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});m.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});g.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});y.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});y.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});b.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});b.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});w.dispatch.on("tooltipShow",function(e){if(!Math.round(w.y()(e.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],C.tooltipShow(e)});w.dispatch.on("tooltipHide",function(e){C.tooltipHide(e)});E.dispatch.on("tooltipShow",function(e){if(!Math.round(E.y()(e.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],C.tooltipShow(e)});E.dispatch.on("tooltipHide",function(e){C.tooltipHide(e)});m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});m.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});g.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});C.on("tooltipHide",function(){if(o)e.tooltip.cleanup()});L.dispatch=C;L.lines1=m;L.lines2=g;L.bars1=y;L.bars2=b;L.stack1=w;L.stack2=E;L.xAxis=S;L.yAxis1=x;L.yAxis2=T;L.options=e.utils.optionsFunc.bind(L);L.x=function(e){if(!arguments.length)return getX;getX=e;m.x(e);y.x(e);return L};L.y=function(e){if(!arguments.length)return getY;getY=e;m.y(e);y.y(e);return L};L.yDomain1=function(e){if(!arguments.length)return h;h=e;return L};L.yDomain2=function(e){if(!arguments.length)return p;p=e;return L};L.margin=function(e){if(!arguments.length)return t;t=e;return L};L.width=function(e){if(!arguments.length)return r;r=e;return L};L.height=function(e){if(!arguments.length)return i;i=e;return L};L.color=function(e){if(!arguments.length)return n;n=e;N.color(e);return L};L.showLegend=function(e){if(!arguments.length)return s;s=e;return L};L.tooltips=function(e){if(!arguments.length)return o;o=e;return L};L.dualaxis=function(e){if(!arguments.length)return u;u=e;return L};L.legendPos=function(e){if(!arguments.length)return a;a=e;return L};L.tooltipContent=function(e){if(!arguments.length)return f;f=e;return L};return L};e.models.ohlcBar=function(){"use strict";function x(e){e.each(function(e){var g=n-t.left-t.right,x=r-t.top-t.bottom,T=d3.select(this);s.domain(y||d3.extent(e[0].values.map(u).concat(p)));if(v)s.range(w||[g*.5/e[0].values.length,g*(e[0].values.length-.5)/e[0].values.length]);else s.range(w||[0,g]);o.domain(b||[d3.min(e[0].values.map(h).concat(d)),d3.max(e[0].values.map(c).concat(d))]).range(E||[x,0]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1]);if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]);var N=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([e[0].values]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar");var k=C.append("defs");var L=C.append("g");var A=N.select("g");L.append("g").attr("class","nv-ticks");N.attr("transform","translate("+t.left+","+t.top+")");T.on("click",function(e,t){S.chartClick({data:e,index:t,pos:d3.event,id:i})});k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect");N.select("#nv-chart-clip-path-"+i+" rect").attr("width",g).attr("height",x);A.attr("clip-path",m?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-ticks").selectAll(".nv-tick").data(function(e){return e});O.exit().remove();var M=O.enter().append("path").attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"}).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);S.elementMouseover({point:t,series:e[0],pos:[s(u(t,n)),o(a(t,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);S.elementMouseout({point:t,series:e[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(e,t){S.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()}).on("dblclick",function(e,t){S.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()});O.attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t});d3.transition(O).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"})});return x}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=function(e){return e.open},l=function(e){return e.close},c=function(e){return e.high},h=function(e){return e.low},p=[],d=[],v=false,m=true,g=e.utils.defaultColor(),y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");x.dispatch=S;x.options=e.utils.optionsFunc.bind(x);x.x=function(e){if(!arguments.length)return u;u=e;return x};x.y=function(e){if(!arguments.length)return a;a=e;return x};x.open=function(e){if(!arguments.length)return f;f=e;return x};x.close=function(e){if(!arguments.length)return l;l=e;return x};x.high=function(e){if(!arguments.length)return c;c=e;return x};x.low=function(e){if(!arguments.length)return h;h=e;return x};x.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return x};x.width=function(e){if(!arguments.length)return n;n=e;return x};x.height=function(e){if(!arguments.length)return r;r=e;return x};x.xScale=function(e){if(!arguments.length)return s;s=e;return x};x.yScale=function(e){if(!arguments.length)return o;o=e;return x};x.xDomain=function(e){if(!arguments.length)return y;y=e;return x};x.yDomain=function(e){if(!arguments.length)return b;b=e;return x};x.xRange=function(e){if(!arguments.length)return w;w=e;return x};x.yRange=function(e){if(!arguments.length)return E;E=e;return x};x.forceX=function(e){if(!arguments.length)return p;p=e;return x};x.forceY=function(e){if(!arguments.length)return d;d=e;return x};x.padData=function(e){if(!arguments.length)return v;v=e;return x};x.clipEdge=function(e){if(!arguments.length)return m;m=e;return x};x.color=function(t){if(!arguments.length)return g;g=e.utils.getColor(t);return x};x.id=function(e){if(!arguments.length)return i;i=e;return x};return x};e.models.pie=function(){"use strict";function E(e){e.each(function(e){function P(e){var t=(e.startAngle+e.endAngle)*90/Math.PI-90;return t>90?t-180:t}function H(e){e.endAngle=isNaN(e.endAngle)?0:e.endAngle;e.startAngle=isNaN(e.startAngle)?0:e.startAngle;if(!v)e.innerRadius=0;var t=d3.interpolate(this._current,e);this._current=t(0);return function(e){return L(t(e))}}function B(e){e.innerRadius=0;var t=d3.interpolate({startAngle:0,endAngle:0},e);return function(e){return L(t(e))}}var o=n-t.left-t.right,f=r-t.top-t.bottom,E=Math.min(o,f)/2,S=E-E/5,x=d3.select(this);var T=x.selectAll(".nv-wrap.nv-pie").data(e);var N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+u);var C=N.append("g");var k=T.select("g");C.append("g").attr("class","nv-pie");T.attr("transform","translate("+t.left+","+t.top+")");k.select(".nv-pie").attr("transform","translate("+o/2+","+f/2+")");x.on("click",function(e,t){w.chartClick({data:e,index:t,pos:d3.event,id:u})});var L=d3.svg.arc().outerRadius(S);if(g)L.startAngle(g);if(y)L.endAngle(y);if(v)L.innerRadius(E*b);var A=d3.layout.pie().sort(null).value(function(e){return e.disabled?0:s(e)});var O=T.select(".nv-pie").selectAll(".nv-slice").data(A);O.exit().remove();var M=O.enter().append("g").attr("class","nv-slice").on("mouseover",function(e,t){d3.select(this).classed("hover",true);w.elementMouseover({label:i(e.data),value:s(e.data),point:e.data,pointIndex:t,pos:[d3.event.pageX,d3.event.pageY],id:u})}).on("mouseout",function(e,t){d3.select(this).classed("hover",false);w.elementMouseout({label:i(e.data),value:s(e.data),point:e.data,index:t,id:u})}).on("click",function(e,t){w.elementClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u});d3.event.stopPropagation()}).on("dblclick",function(e,t){w.elementDblClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u});d3.event.stopPropagation()});O.attr("fill",function(e,t){return a(e,t)}).attr("stroke",function(e,t){return a(e,t)});var _=M.append("path").each(function(e){this._current=e});d3.transition(O.select("path")).attr("d",L).attrTween("d",H);if(l){var D=d3.svg.arc().innerRadius(0);if(c){D=L}if(h){D=d3.svg.arc().outerRadius(L.outerRadius())}M.append("g").classed("nv-label",true).each(function(e,t){var n=d3.select(this);n.attr("transform",function(e){if(m){e.outerRadius=S+10;e.innerRadius=S+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);if((e.startAngle+e.endAngle)/2<Math.PI){t-=90}else{t+=90}return"translate("+D.centroid(e)+") rotate("+t+")"}else{e.outerRadius=E+10;e.innerRadius=E+15;return"translate("+D.centroid(e)+")"}});n.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3);n.append("text").style("text-anchor",m?(e.startAngle+e.endAngle)/2<Math.PI?"start":"end":"middle").style("fill","#000")});O.select(".nv-label").transition().attr("transform",function(e){if(m){e.outerRadius=S+10;e.innerRadius=S+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);if((e.startAngle+e.endAngle)/2<Math.PI){t-=90}else{t+=90}return"translate("+D.centroid(e)+") rotate("+t+")"}else{e.outerRadius=E+10;e.innerRadius=E+15;return"translate("+D.centroid(e)+")"}});O.each(function(e,t){var n=d3.select(this);n.select(".nv-label text").style("text-anchor",m?(e.startAngle+e.endAngle)/2<Math.PI?"start":"end":"middle").text(function(e,t){var n=(e.endAngle-e.startAngle)/(2*Math.PI);var r={key:i(e.data),value:s(e.data),percent:d3.format("%")(n)};return e.value&&n>d?r[p]:""});var r=n.select("text").node().getBBox();n.select(".nv-label rect").attr("width",r.width+10).attr("height",r.height+10).attr("transform",function(){return"translate("+[r.x-5,r.y-5]+")"})})}});return E}var t={top:0,right:0,bottom:0,left:0},n=500,r=500,i=function(e){return e.x},s=function(e){return e.y},o=function(e){return e.description},u=Math.floor(Math.random()*1e4),a=e.utils.defaultColor(),f=d3.format(",.2f"),l=true,c=true,h=false,p="key",d=.02,v=false,m=false,g=false,y=false,b=.5,w=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");E.dispatch=w;E.options=e.utils.optionsFunc.bind(E);E.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return E};E.width=function(e){if(!arguments.length)return n;n=e;return E};E.height=function(e){if(!arguments.length)return r;r=e;return E};E.values=function(t){e.log("pie.values() is no longer supported.");return E};E.x=function(e){if(!arguments.length)return i;i=e;return E};E.y=function(e){if(!arguments.length)return s;s=d3.functor(e);return E};E.description=function(e){if(!arguments.length)return o;o=e;return E};E.showLabels=function(e){if(!arguments.length)return l;l=e;return E};E.labelSunbeamLayout=function(e){if(!arguments.length)return m;m=e;return E};E.donutLabelsOutside=function(e){if(!arguments.length)return h;h=e;return E};E.pieLabelsOutside=function(e){if(!arguments.length)return c;c=e;return E};E.labelType=function(e){if(!arguments.length)return p;p=e;p=p||"key";return E};E.donut=function(e){if(!arguments.length)return v;v=e;return E};E.donutRatio=function(e){if(!arguments.length)return b;b=e;return E};E.startAngle=function(e){if(!arguments.length)return g;g=e;return E};E.endAngle=function(e){if(!arguments.length)return y;y=e;return E};E.id=function(e){if(!arguments.length)return u;u=e;return E};E.color=function(t){if(!arguments.length)return a;a=e.utils.getColor(t);return E};E.valueFormat=function(e){if(!arguments.length)return f;f=e;return E};E.labelThreshold=function(e){if(!arguments.length)return d;d=e;return E};return E};e.models.pieChart=function(){"use strict";function v(e){e.each(function(e){var u=d3.select(this),a=this;var f=(i||parseInt(u.style("width"))||960)-r.left-r.right,d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom;v.update=function(){u.transition().call(v)};v.container=this;l.disabled=e.map(function(e){return!!e.disabled});if(!c){var m;c={};for(m in l){if(l[m]instanceof Array)c[m]=l[m].slice(0);else c[m]=l[m]}}if(!e||!e.length){var g=u.selectAll(".nv-noData").data([h]);g.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");g.attr("x",r.left+f/2).attr("y",r.top+d/2).text(function(e){return e});return v}else{u.selectAll(".nv-noData").remove()}var y=u.selectAll("g.nv-wrap.nv-pieChart").data([e]);var b=y.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g");var w=y.select("g");b.append("g").attr("class","nv-pieWrap");b.append("g").attr("class","nv-legendWrap");if(o){n.width(f).key(t.x());y.select(".nv-legendWrap").datum(e).call(n);if(r.top!=n.height()){r.top=n.height();d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom}y.select(".nv-legendWrap").attr("transform","translate(0,"+ -r.top+")")}y.attr("transform","translate("+r.left+","+r.top+")");t.width(f).height(d);var E=w.select(".nv-pieWrap").datum([e]);d3.transition(E).call(t);n.dispatch.on("stateChange",function(e){l=e;p.stateChange(l);v.update()});t.dispatch.on("elementMouseout.tooltip",function(e){p.tooltipHide(e)});p.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});l.disabled=t.disabled}v.update()})});return v}var t=e.models.pie(),n=e.models.legend();var r={top:30,right:20,bottom:20,left:20},i=null,s=null,o=true,u=e.utils.defaultColor(),a=true,f=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+t+"</p>"},l={},c=null,h="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");var d=function(n,r){var i=t.description()(n.point)||t.x()(n.point);var s=n.pos[0]+(r&&r.offsetLeft||0),o=n.pos[1]+(r&&r.offsetTop||0),u=t.valueFormat()(t.y()(n.point)),a=f(i,u,n,v);e.tooltip.show([s,o],a,n.value<0?"n":"s",null,r)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+r.left,e.pos[1]+r.top];p.tooltipShow(e)});p.on("tooltipShow",function(e){if(a)d(e)});p.on("tooltipHide",function(){if(a)e.tooltip.cleanup()});v.legend=n;v.dispatch=p;v.pie=t;d3.rebind(v,t,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","labelType","donut","donutRatio","labelThreshold");v.options=e.utils.optionsFunc.bind(v);v.margin=function(e){if(!arguments.length)return r;r.top=typeof e.top!="undefined"?e.top:r.top;r.right=typeof e.right!="undefined"?e.right:r.right;r.bottom=typeof e.bottom!="undefined"?e.bottom:r.bottom;r.left=typeof e.left!="undefined"?e.left:r.left;return v};v.width=function(e){if(!arguments.length)return i;i=e;return v};v.height=function(e){if(!arguments.length)return s;s=e;return v};v.color=function(r){if(!arguments.length)return u;u=e.utils.getColor(r);n.color(u);t.color(u);return v};v.showLegend=function(e){if(!arguments.length)return o;o=e;return v};v.tooltips=function(e){if(!arguments.length)return a;a=e;return v};v.tooltipContent=function(e){if(!arguments.length)return f;f=e;return v};v.state=function(e){if(!arguments.length)return l;l=e;return v};v.defaultState=function(e){if(!arguments.length)return c;c=e;return v};v.noData=function(e){if(!arguments.length)return h;h=e;return v};return v};e.models.scatter=function(){"use strict";function I(q){q.each(function(I){function Q(){if(!g)return false;var e;var i=d3.merge(I.map(function(e,t){return e.values.map(function(e,n){var r=f(e,n);var i=l(e,n);return[o(r)+Math.random()*1e-7,u(i)+Math.random()*1e-7,t,n,e]}).filter(function(e,t){return b(e[4],t)})}));if(D===true){if(x){var a=X.select("defs").selectAll(".nv-point-clips").data([s]).enter();a.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+s);var c=X.select("#nv-points-clip-"+s).selectAll("circle").data(i);c.enter().append("circle").attr("r",T);c.exit().remove();c.attr("cx",function(e){return e[0]}).attr("cy",function(e){return e[1]});X.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+s+")")}if(i.length){i.push([o.range()[0]-20,u.range()[0]-20,null,null]);i.push([o.range()[1]+20,u.range()[1]+20,null,null]);i.push([o.range()[0]-20,u.range()[0]+20,null,null]);i.push([o.range()[1]+20,u.range()[1]-20,null,null])}var h=d3.geom.polygon([[-10,-10],[-10,r+10],[n+10,r+10],[n+10,-10]]);var p=d3.geom.voronoi(i).map(function(e,t){return{data:h.clip(e),series:i[t][2],point:i[t][3]}});var d=X.select(".nv-point-paths").selectAll("path").data(p);d.enter().append("path").attr("class",function(e,t){return"nv-path-"+t});d.exit().remove();d.attr("d",function(e){if(e.data.length===0)return"M 0 0";else return"M"+e.data.join("L")+"Z"});var v=function(e,n){if(F)return 0;var r=I[e.series];if(typeof r==="undefined")return;var i=r.values[e.point];n({point:i,series:r,pos:[o(f(i,e.point))+t.left,u(l(i,e.point))+t.top],seriesIndex:e.series,pointIndex:e.point})};d.on("click",function(e){v(e,_.elementClick)}).on("mouseover",function(e){v(e,_.elementMouseover)}).on("mouseout",function(e,t){v(e,_.elementMouseout)})}else{X.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementClick({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseover",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementMouseover({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseout",function(e,t){if(F||!I[e.series])return 0;var n=I[e.series],r=n.values[t];_.elementMouseout({point:r,series:n,seriesIndex:e.series,pointIndex:t})})}F=false}var q=n-t.left-t.right,R=r-t.top-t.bottom,U=d3.select(this);I.forEach(function(e,t){e.values.forEach(function(e){e.series=t})});var W=N&&C&&A?[]:d3.merge(I.map(function(e){return e.values.map(function(e,t){return{x:f(e,t),y:l(e,t),size:c(e,t)}})}));o.domain(N||d3.extent(W.map(function(e){return e.x}).concat(d)));if(w&&I[0])o.range(k||[(q*E+q)/(2*I[0].values.length),q-q*(1+E)/(2*I[0].values.length)]);else o.range(k||[0,q]);u.domain(C||d3.extent(W.map(function(e){return e.y}).concat(v))).range(L||[R,0]);a.domain(A||d3.extent(W.map(function(e){return e.size}).concat(m))).range(O||[16,256]);if(o.domain()[0]===o.domain()[1]||u.domain()[0]===u.domain()[1])M=true;if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]-o.domain()[0]*.01,o.domain()[1]+o.domain()[1]*.01]):o.domain([-1,1]);if(u.domain()[0]===u.domain()[1])u.domain()[0]?u.domain([u.domain()[0]-u.domain()[0]*.01,u.domain()[1]+u.domain()[1]*.01]):u.domain([-1,1]);if(isNaN(o.domain()[0])){o.domain([-1,1])}if(isNaN(u.domain()[0])){u.domain([-1,1])}P=P||o;H=H||u;B=B||a;var X=U.selectAll("g.nv-wrap.nv-scatter").data([I]);var V=X.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+s+(M?" nv-single-point":""));var $=V.append("defs");var J=V.append("g");var K=X.select("g");J.append("g").attr("class","nv-groups");J.append("g").attr("class","nv-point-paths");X.attr("transform","translate("+t.left+","+t.top+")");$.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect");X.select("#nv-edge-clip-"+s+" rect").attr("width",q).attr("height",R);K.attr("clip-path",S?"url(#nv-edge-clip-"+s+")":"");F=true;var G=X.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});G.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);G.exit().remove();G.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover});G.transition().style("fill",function(e,t){return i(e,t)}).style("stroke",function(e,t){return i(e,t)}).style("stroke-opacity",1).style("fill-opacity",.5);if(p){var Y=G.selectAll("circle.nv-point").data(function(e){return e.values},y);Y.enter().append("circle").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("cx",function(t,n){return e.utils.NaNtoZero(P(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(H(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)});Y.exit().remove();G.exit().selectAll("path.nv-point").transition().attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).remove();Y.each(function(e,t){d3.select(this).classed("nv-point",true).classed("nv-point-"+t,true).classed("hover",false)});Y.transition().attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)})}else{var Y=G.selectAll("path.nv-point").data(function(e){return e.values});Y.enter().append("path").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("transform",function(e,t){return"translate("+P(f(e,t))+","+H(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}));Y.exit().remove();G.exit().selectAll("path.nv-point").transition().attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).remove();Y.each(function(e,t){d3.select(this).classed("nv-point",true).classed("nv-point-"+t,true).classed("hover",false)});Y.transition().attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}))}clearTimeout(j);j=setTimeout(Q,300);P=o.copy();H=u.copy();B=a.copy()});return I}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=d3.scale.linear(),u=d3.scale.linear(),a=d3.scale.linear(),f=function(e){return e.x},l=function(e){return e.y},c=function(e){return e.size||1},h=function(e){return e.shape||"circle"},p=true,d=[],v=[],m=[],g=true,y=null,b=function(e){return!e.notActive},w=false,E=.1,S=false,x=true,T=function(){return 25},N=null,C=null,k=null,L=null,A=null,O=null,M=false,_=d3.dispatch("elementClick","elementMouseover","elementMouseout"),D=true;var P,H,B,j,F=false;I.clearHighlights=function(){d3.selectAll(".nv-chart-"+s+" .nv-point.hover").classed("hover",false)};I.highlightPoint=function(e,t,n){d3.select(".nv-chart-"+s+" .nv-series-"+e+" .nv-point-"+t).classed("hover",n)};_.on("elementMouseover.point",function(e){if(g)I.highlightPoint(e.seriesIndex,e.pointIndex,true)});_.on("elementMouseout.point",function(e){if(g)I.highlightPoint(e.seriesIndex,e.pointIndex,false)});I.dispatch=_;I.options=e.utils.optionsFunc.bind(I);I.x=function(e){if(!arguments.length)return f;f=d3.functor(e);return I};I.y=function(e){if(!arguments.length)return l;l=d3.functor(e);return I};I.size=function(e){if(!arguments.length)return c;c=d3.functor(e);return I};I.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return I};I.width=function(e){if(!arguments.length)return n;n=e;return I};I.height=function(e){if(!arguments.length)return r;r=e;return I};I.xScale=function(e){if(!arguments.length)return o;o=e;return I};I.yScale=function(e){if(!arguments.length)return u;u=e;return I};I.zScale=function(e){if(!arguments.length)return a;a=e;return I};I.xDomain=function(e){if(!arguments.length)return N;N=e;return I};I.yDomain=function(e){if(!arguments.length)return C;C=e;return I};I.sizeDomain=function(e){if(!arguments.length)return A;A=e;return I};I.xRange=function(e){if(!arguments.length)return k;k=e;return I};I.yRange=function(e){if(!arguments.length)return L;L=e;return I};I.sizeRange=function(e){if(!arguments.length)return O;O=e;return I};I.forceX=function(e){if(!arguments.length)return d;d=e;return I};I.forceY=function(e){if(!arguments.length)return v;v=e;return I};I.forceSize=function(e){if(!arguments.length)return m;m=e;return I};I.interactive=function(e){if(!arguments.length)return g;g=e;return I};I.pointKey=function(e){if(!arguments.length)return y;y=e;return I};I.pointActive=function(e){if(!arguments.length)return b;b=e;return I};I.padData=function(e){if(!arguments.length)return w;w=e;return I};I.padDataOuter=function(e){if(!arguments.length)return E;E=e;return I};I.clipEdge=function(e){if(!arguments.length)return S;S=e;return I};I.clipVoronoi=function(e){if(!arguments.length)return x;x=e;return I};I.useVoronoi=function(e){if(!arguments.length)return D;D=e;if(D===false){x=false}return I};I.clipRadius=function(e){if(!arguments.length)return T;T=e;return I};I.color=function(t){if(!arguments.length)return i;i=e.utils.getColor(t);return I};I.shape=function(e){if(!arguments.length)return h;h=e;return I};I.onlyCircles=function(e){if(!arguments.length)return p;p=e;return I};I.id=function(e){if(!arguments.length)return s;s=e;return I};I.singlePoint=function(e){if(!arguments.length)return M;M=e;return I};return I};e.models.scatterChart=function(){"use strict";function F(e){e.each(function(e){function K(){if(T){X.select(".nv-point-paths").style("pointer-events","all");return false}X.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(x).focus(i[0]);p.distortion(x).focus(i[1]);X.select(".nv-scatterWrap").call(t);if(b)X.select(".nv-x.nv-axis").call(n);if(w)X.select(".nv-y.nv-axis").call(r);X.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o);X.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var C=d3.select(this),k=this;var L=(f||parseInt(C.style("width"))||960)-a.left-a.right,I=(l||parseInt(C.style("height"))||400)-a.top-a.bottom;F.update=function(){C.transition().duration(D).call(F)};F.container=this;A.disabled=e.map(function(e){return!!e.disabled});if(!O){var q;O={};for(q in A){if(A[q]instanceof Array)O[q]=A[q].slice(0);else O[q]=A[q]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var R=C.selectAll(".nv-noData").data([_]);R.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");R.attr("x",a.left+L/2).attr("y",a.top+I/2).text(function(e){return e});return F}else{C.selectAll(".nv-noData").remove()}P=P||h;H=H||p;var U=C.selectAll("g.nv-wrap.nv-scatterChart").data([e]);var z=U.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id());var W=z.append("g");var X=U.select("g");W.append("rect").attr("class","nvd3 nv-background");W.append("g").attr("class","nv-x nv-axis");W.append("g").attr("class","nv-y nv-axis");W.append("g").attr("class","nv-scatterWrap");W.append("g").attr("class","nv-distWrap");W.append("g").attr("class","nv-legendWrap");W.append("g").attr("class","nv-controlsWrap");if(y){var V=S?L/2:L;i.width(V);U.select(".nv-legendWrap").datum(e).call(i);if(a.top!=i.height()){a.top=i.height();I=(l||parseInt(C.style("height"))||400)-a.top-a.bottom}U.select(".nv-legendWrap").attr("transform","translate("+(L-V)+","+ -a.top+")")}if(S){s.width(180).color(["#444"]);X.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+ -a.top+")").call(s)}U.attr("transform","translate("+a.left+","+a.top+")");if(E){X.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)")}t.width(L).height(I).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));if(d!==0)t.xDomain(null);if(v!==0)t.yDomain(null);U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(d!==0){var $=h.domain()[1]-h.domain()[0];t.xDomain([h.domain()[0]-d*$,h.domain()[1]+d*$])}if(v!==0){var J=p.domain()[1]-p.domain()[0];t.yDomain([p.domain()[0]-v*J,p.domain()[1]+v*J])}if(v!==0||d!==0){U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t)}if(b){n.scale(h).ticks(n.ticks()&&n.ticks().length?n.ticks():L/100).tickSize(-I,0);X.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)}if(w){r.scale(p).ticks(r.ticks()&&r.ticks().length?r.ticks():I/36).tickSize(-L,0);X.select(".nv-y.nv-axis").call(r)}if(m){o.getData(t.x()).scale(h).width(L).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));W.select(".nv-distWrap").append("g").attr("class","nv-distributionX");X.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)}if(g){u.getData(t.y()).scale(p).width(I).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));W.select(".nv-distWrap").append("g").attr("class","nv-distributionY");X.select(".nv-distributionY").attr("transform","translate("+(E?L:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)}if(d3.fisheye){X.select(".nv-background").attr("width",L).attr("height",I);X.select(".nv-background").on("mousemove",K);X.select(".nv-background").on("click",function(){T=!T});t.dispatch.on("elementClick.freezeFisheye",function(){T=!T})}s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled;x=e.disabled?0:2.5;X.select(".nv-background").style("pointer-events",e.disabled?"none":"all");X.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none");if(e.disabled){h.distortion(x).focus(0);p.distortion(x).focus(0);X.select(".nv-scatterWrap").call(t);X.select(".nv-x.nv-axis").call(n);X.select(".nv-y.nv-axis").call(r)}else{T=false}F.update()});i.dispatch.on("stateChange",function(e){A.disabled=e.disabled;M.stateChange(A);F.update()});t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",function(t,n){return e.pos[1]-I});d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size());e.pos=[e.pos[0]+a.left,e.pos[1]+a.top];M.tooltipShow(e)});M.on("tooltipShow",function(e){if(N)B(e,k.parentNode)});M.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});A.disabled=t.disabled}F.update()});P=h.copy();H=p.copy()});return F}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution();var a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=0,v=0,m=false,g=false,y=true,b=true,w=true,E=false,S=!!d3.fisheye,x=0,T=false,N=true,C=function(e,t,n){return"<strong>"+t+"</strong>"},k=function(e,t,n){return"<strong>"+n+"</strong>"},L=null,A={},O=null,M=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),_="No Data Available.",D=250;t.xScale(h).yScale(p);n.orient("bottom").tickPadding(10);r.orient(E?"right":"left").tickPadding(10);o.axis("x");u.axis("y");s.updateState(false);var P,H;var B=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));if(C!=null)e.tooltip.show([f,l],C(i.series.key,v,m,i,F),"n",1,s,"x-nvtooltip");if(k!=null)e.tooltip.show([c,d],k(i.series.key,v,m,i,F),"e",1,s,"y-nvtooltip");if(L!=null)e.tooltip.show([o,u],L(i.series.key,v,m,i,F),i.value<0?"n":"s",null,s)};var j=[{key:"Magnify",disabled:true}];t.dispatch.on("elementMouseout.tooltip",function(e){M.tooltipHide(e);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())});M.on("tooltipHide",function(){if(N)e.tooltip.cleanup()});F.dispatch=M;F.scatter=t;F.legend=i;F.controls=s;F.xAxis=n;F.yAxis=r;F.distX=o;F.distY=u;d3.rebind(F,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");F.options=e.utils.optionsFunc.bind(F);F.margin=function(e){if(!arguments.length)return a;a.top=typeof e.top!="undefined"?e.top:a.top;a.right=typeof e.right!="undefined"?e.right:a.right;a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom;a.left=typeof e.left!="undefined"?e.left:a.left;return F};F.width=function(e){if(!arguments.length)return f;f=e;return F};F.height=function(e){if(!arguments.length)return l;l=e;return F};F.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);i.color(c);o.color(c);u.color(c);return F};F.showDistX=function(e){if(!arguments.length)return m;m=e;return F};F.showDistY=function(e){if(!arguments.length)return g;g=e;return F};F.showControls=function(e){if(!arguments.length)return S;S=e;return F};F.showLegend=function(e){if(!arguments.length)return y;y=e;return F};F.showXAxis=function(e){if(!arguments.length)return b;b=e;return F};F.showYAxis=function(e){if(!arguments.length)return w;w=e;return F};F.rightAlignYAxis=function(e){if(!arguments.length)return E;E=e;r.orient(e?"right":"left");return F};F.fisheye=function(e){if(!arguments.length)return x;x=e;return F};F.xPadding=function(e){if(!arguments.length)return d;d=e;return F};F.yPadding=function(e){if(!arguments.length)return v;v=e;return F};F.tooltips=function(e){if(!arguments.length)return N;N=e;return F};F.tooltipContent=function(e){if(!arguments.length)return L;L=e;return F};F.tooltipXContent=function(e){if(!arguments.length)return C;C=e;return F};F.tooltipYContent=function(e){if(!arguments.length)return k;k=e;return F};F.state=function(e){if(!arguments.length)return A;A=e;return F};F.defaultState=function(e){if(!arguments.length)return O;O=e;return F};F.noData=function(e){if(!arguments.length)return _;_=e;return F};F.transitionDuration=function(e){if(!arguments.length)return D;D=e;return F};return F};e.models.scatterPlusLineChart=function(){"use strict";function B(e){e.each(function(e){function $(){if(S){z.select(".nv-point-paths").style("pointer-events","all");return false}z.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(E).focus(i[0]);p.distortion(E).focus(i[1]);z.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(g)z.select(".nv-x.nv-axis").call(n);if(y)z.select(".nv-y.nv-axis").call(r);z.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o);z.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var T=d3.select(this),N=this;var C=(f||parseInt(T.style("width"))||960)-a.left-a.right,j=(l||parseInt(T.style("height"))||400)-a.top-a.bottom;B.update=function(){T.transition().duration(M).call(B)};B.container=this;k.disabled=e.map(function(e){return!!e.disabled});if(!L){var F;L={};for(F in k){if(k[F]instanceof Array)L[F]=k[F].slice(0);else L[F]=k[F]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var I=T.selectAll(".nv-noData").data([O]);I.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");I.attr("x",a.left+C/2).attr("y",a.top+j/2).text(function(e){return e});return B}else{T.selectAll(".nv-noData").remove()}h=t.xScale();p=t.yScale();_=_||h;D=D||p;var q=T.selectAll("g.nv-wrap.nv-scatterChart").data([e]);var R=q.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id());var U=R.append("g");var z=q.select("g");U.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none");U.append("g").attr("class","nv-x nv-axis");U.append("g").attr("class","nv-y nv-axis");U.append("g").attr("class","nv-scatterWrap");U.append("g").attr("class","nv-regressionLinesWrap");U.append("g").attr("class","nv-distWrap");U.append("g").attr("class","nv-legendWrap");U.append("g").attr("class","nv-controlsWrap");q.attr("transform","translate("+a.left+","+a.top+")");if(b){z.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)")}if(m){i.width(C/2);q.select(".nv-legendWrap").datum(e).call(i);if(a.top!=i.height()){a.top=i.height();j=(l||parseInt(T.style("height"))||400)-a.top-a.bottom}q.select(".nv-legendWrap").attr("transform","translate("+C/2+","+ -a.top+")")}if(w){s.width(180).color(["#444"]);z.select(".nv-controlsWrap").datum(H).attr("transform","translate(0,"+ -a.top+")").call(s)}t.width(C).height(j).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));q.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);q.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+t.id()+")");var W=q.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(e){return e});W.enter().append("g").attr("class","nv-regLines");var X=W.selectAll(".nv-regLine").data(function(e){return[e]});var V=X.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);X.transition().attr("x1",h.range()[0]).attr("x2",h.range()[1]).attr("y1",function(e,t){return p(h.domain()[0]*e.slope+e.intercept)}).attr("y2",function(e,t){return p(h.domain()[1]*e.slope+e.intercept)}).style("stroke",function(e,t,n){return c(e,n)}).style("stroke-opacity",function(e,t){return e.disabled||typeof e.slope==="undefined"||typeof e.intercept==="undefined"?0:1});if(g){n.scale(h).ticks(n.ticks()?n.ticks():C/100).tickSize(-j,0);z.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)}if(y){r.scale(p).ticks(r.ticks()?r.ticks():j/36).tickSize(-C,0);z.select(".nv-y.nv-axis").call(r)}if(d){o.getData(t.x()).scale(h).width(C).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));U.select(".nv-distWrap").append("g").attr("class","nv-distributionX");z.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)}if(v){u.getData(t.y()).scale(p).width(j).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));U.select(".nv-distWrap").append("g").attr("class","nv-distributionY");z.select(".nv-distributionY").attr("transform","translate("+(b?C:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)}if(d3.fisheye){z.select(".nv-background").attr("width",C).attr("height",j);z.select(".nv-background").on("mousemove",$);z.select(".nv-background").on("click",function(){S=!S});t.dispatch.on("elementClick.freezeFisheye",function(){S=!S})}s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled;E=e.disabled?0:2.5;z.select(".nv-background").style("pointer-events",e.disabled?"none":"all");z.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none");if(e.disabled){h.distortion(E).focus(0);p.distortion(E).focus(0);z.select(".nv-scatterWrap").call(t);z.select(".nv-x.nv-axis").call(n);z.select(".nv-y.nv-axis").call(r)}else{S=false}B.update()});i.dispatch.on("stateChange",function(e){k=e;A.stateChange(k);B.update()});t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-j);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size());e.pos=[e.pos[0]+a.left,e.pos[1]+a.top];A.tooltipShow(e)});A.on("tooltipShow",function(e){if(x)P(e,N.parentNode)});A.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});k.disabled=t.disabled}B.update()});_=h.copy();D=p.copy()});return B}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution();var a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=false,v=false,m=true,g=true,y=true,b=false,w=!!d3.fisheye,E=0,S=false,x=true,T=function(e,t,n){return"<strong>"+t+"</strong>"},N=function(e,t,n){return"<strong>"+n+"</strong>"},C=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+r+"</p>"},k={},L=null,A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),O="No Data Available.",M=250;t.xScale(h).yScale(p);n.orient("bottom").tickPadding(10);r.orient(b?"right":"left").tickPadding(10);o.axis("x");u.axis("y");s.updateState(false);var _,D;var P=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));if(T!=null)e.tooltip.show([f,l],T(i.series.key,v,m,i,B),"n",1,s,"x-nvtooltip");if(N!=null)e.tooltip.show([c,d],N(i.series.key,v,m,i,B),"e",1,s,"y-nvtooltip");if(C!=null)e.tooltip.show([o,u],C(i.series.key,v,m,i.point.tooltip,i,B),i.value<0?"n":"s",null,s)};var H=[{key:"Magnify",disabled:true}];t.dispatch.on("elementMouseout.tooltip",function(e){A.tooltipHide(e);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())});A.on("tooltipHide",function(){if(x)e.tooltip.cleanup()});B.dispatch=A;B.scatter=t;B.legend=i;B.controls=s;B.xAxis=n;B.yAxis=r;B.distX=o;B.distY=u;d3.rebind(B,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");B.options=e.utils.optionsFunc.bind(B);B.margin=function(e){if(!arguments.length)return a;a.top=typeof e.top!="undefined"?e.top:a.top;a.right=typeof e.right!="undefined"?e.right:a.right;a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom;a.left=typeof e.left!="undefined"?e.left:a.left;return B};B.width=function(e){if(!arguments.length)return f;f=e;return B};B.height=function(e){if(!arguments.length)return l;l=e;return B};B.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);i.color(c);o.color(c);u.color(c);return B};B.showDistX=function(e){if(!arguments.length)return d;d=e;return B};B.showDistY=function(e){if(!arguments.length)return v;v=e;return B};B.showControls=function(e){if(!arguments.length)return w;w=e;return B};B.showLegend=function(e){if(!arguments.length)return m;m=e;return B};B.showXAxis=function(e){if(!arguments.length)return g;g=e;return B};B.showYAxis=function(e){if(!arguments.length)return y;y=e;return B};B.rightAlignYAxis=function(e){if(!arguments.length)return b;b=e;r.orient(e?"right":"left");return B};B.fisheye=function(e){if(!arguments.length)return E;E=e;return B};B.tooltips=function(e){if(!arguments.length)return x;x=e;return B};B.tooltipContent=function(e){if(!arguments.length)return C;C=e;return B};B.tooltipXContent=function(e){if(!arguments.length)return T;T=e;return B};B.tooltipYContent=function(e){if(!arguments.length)return N;N=e;return B};B.state=function(e){if(!arguments.length)return k;k=e;return B};B.defaultState=function(e){if(!arguments.length)return L;L=e;return B};B.noData=function(e){if(!arguments.length)return O;O=e;return B};B.transitionDuration=function(e){if(!arguments.length)return M;M=e;return B};return B};e.models.sparkline=function(){"use strict";function d(e){e.each(function(e){var i=n-t.left-t.right,d=r-t.top-t.bottom,v=d3.select(this);s.domain(l||d3.extent(e,u)).range(h||[0,i]);o.domain(c||d3.extent(e,a)).range(p||[d,0]);var m=v.selectAll("g.nv-wrap.nv-sparkline").data([e]);var g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");var b=g.append("g");var w=m.select("g");m.attr("transform","translate("+t.left+","+t.top+")");var E=m.selectAll("path").data(function(e){return[e]});E.enter().append("path");E.exit().remove();E.style("stroke",function(e,t){return e.color||f(e,t)}).attr("d",d3.svg.line().x(function(e,t){return s(u(e,t))}).y(function(e,t){return o(a(e,t))}));var S=m.selectAll("circle.nv-point").data(function(e){function n(t){if(t!=-1){var n=e[t];n.pointIndex=t;return n}else{return null}}var t=e.map(function(e,t){return a(e,t)});var r=n(t.lastIndexOf(o.domain()[1])),i=n(t.indexOf(o.domain()[0])),s=n(t.length-1);return[i,r,s].filter(function(e){return e!=null})});S.enter().append("circle");S.exit().remove();S.attr("cx",function(e,t){return s(u(e,e.pointIndex))}).attr("cy",function(e,t){return o(a(e,e.pointIndex))}).attr("r",2).attr("class",function(e,t){return u(e,e.pointIndex)==s.domain()[1]?"nv-point nv-currentValue":a(e,e.pointIndex)==o.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})});return d}var t={top:2,right:0,bottom:2,left:0},n=400,r=32,i=true,s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=e.utils.getColor(["#000"]),l,c,h,p;d.options=e.utils.optionsFunc.bind(d);d.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return d};d.width=function(e){if(!arguments.length)return n;n=e;return d};d.height=function(e){if(!arguments.length)return r;r=e;return d};d.x=function(e){if(!arguments.length)return u;u=d3.functor(e);return d};d.y=function(e){if(!arguments.length)return a;a=d3.functor(e);return d};d.xScale=function(e){if(!arguments.length)return s;s=e;return d};d.yScale=function(e){if(!arguments.length)return o;o=e;return d};d.xDomain=function(e){if(!arguments.length)return l;l=e;return d};d.yDomain=function(e){if(!arguments.length)return c;c=e;return d};d.xRange=function(e){if(!arguments.length)return h;h=e;return d};d.yRange=function(e){if(!arguments.length)return p;p=e;return d};d.animate=function(e){if(!arguments.length)return i;i=e;return d};d.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);return d};return d};e.models.sparklinePlus=function(){"use strict";function v(e){e.each(function(c){function O(){if(a)return;var e=C.selectAll(".nv-hoverValue").data(u);var r=e.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);e.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove();e.attr("transform",function(e){return"translate("+s(t.x()(c[e],e))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1);if(!u.length)return;r.append("line").attr("x1",0).attr("y1",-n.top).attr("x2",0).attr("y2",b);r.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-n.top).attr("text-anchor","end").attr("dy",".9em");C.select(".nv-hoverValue .nv-xValue").text(f(t.x()(c[u[0]],u[0])));r.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-n.top).attr("text-anchor","start").attr("dy",".9em");C.select(".nv-hoverValue .nv-yValue").text(l(t.y()(c[u[0]],u[0])))}function M(){function r(e,n){var r=Math.abs(t.x()(e[0],0)-n);var i=0;for(var s=0;s<e.length;s++){if(Math.abs(t.x()(e[s],s)-n)<r){r=Math.abs(t.x()(e[s],s)-n);i=s}}return i}if(a)return;var e=d3.mouse(this)[0]-n.left;u=[r(c,Math.round(s.invert(e)))];O()}var m=d3.select(this);var g=(r||parseInt(m.style("width"))||960)-n.left-n.right,b=(i||parseInt(m.style("height"))||400)-n.top-n.bottom;v.update=function(){v(e)};v.container=this;if(!c||!c.length){var w=m.selectAll(".nv-noData").data([d]);w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");w.attr("x",n.left+g/2).attr("y",n.top+b/2).text(function(e){return e});return v}else{m.selectAll(".nv-noData").remove()}var E=t.y()(c[c.length-1],c.length-1);s=t.xScale();o=t.yScale();var S=m.selectAll("g.nv-wrap.nv-sparklineplus").data([c]);var T=S.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus");var N=T.append("g");var C=S.select("g");N.append("g").attr("class","nv-sparklineWrap");N.append("g").attr("class","nv-valueWrap");N.append("g").attr("class","nv-hoverArea");S.attr("transform","translate("+n.left+","+n.top+")");var k=C.select(".nv-sparklineWrap");t.width(g).height(b);k.call(t);var L=C.select(".nv-valueWrap");var A=L.selectAll(".nv-currentValue").data([E]);A.enter().append("text").attr("class","nv-currentValue").attr("dx",p?-8:8).attr("dy",".9em").style("text-anchor",p?"end":"start");A.attr("x",g+(p?n.right:0)).attr("y",h?function(e){return o(e)}:0).style("fill",t.color()(c[c.length-1],c.length-1)).text(l(E));N.select(".nv-hoverArea").append("rect").on("mousemove",M).on("click",function(){a=!a}).on("mouseout",function(){u=[];O()});C.select(".nv-hoverArea rect").attr("transform",function(e){return"translate("+ -n.left+","+ -n.top+")"}).attr("width",g+n.left+n.right).attr("height",b+n.top)});return v}var t=e.models.sparkline();var n={top:15,right:100,bottom:10,left:50},r=null,i=null,s,o,u=[],a=false,f=d3.format(",r"),l=d3.format(",.2f"),c=true,h=true,p=false,d="No Data Available.";v.sparkline=t;d3.rebind(v,t,"x","y","xScale","yScale","color");v.options=e.utils.optionsFunc.bind(v);v.margin=function(e){if(!arguments.length)return n;n.top=typeof e.top!="undefined"?e.top:n.top;n.right=typeof e.right!="undefined"?e.right:n.right;n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom;n.left=typeof e.left!="undefined"?e.left:n.left;return v};v.width=function(e){if(!arguments.length)return r;r=e;return v};v.height=function(e){if(!arguments.length)return i;i=e;return v};v.xTickFormat=function(e){if(!arguments.length)return f;f=e;return v};v.yTickFormat=function(e){if(!arguments.length)return l;l=e;return v};v.showValue=function(e){if(!arguments.length)return c;c=e;return v};v.alignValue=function(e){if(!arguments.length)return h;h=e;return v};v.rightAlignValue=function(e){if(!arguments.length)return p;p=e;return v};v.noData=function(e){if(!arguments.length)return d;d=e;return v};return v};e.models.stackedArea=function(){"use strict";function y(e){e.each(function(e){var a=n-t.left-t.right,v=r-t.top-t.bottom,b=d3.select(this);p=m.xScale();d=m.yScale();var w=e;e=e.map(function(e,t){e.seriesIndex=t;e.values=e.values.map(function(e,n){e.index=n;e.seriesIndex=t;return e});return e});var E=e.filter(function(e){return!e.disabled});e=d3.layout.stack().order(l).offset(f).values(function(e){return e.values}).x(o).y(u).out(function(e,t,n){var r=u(e)===0?0:n;e.display={y:r,y0:t}})(E);var S=b.selectAll("g.nv-wrap.nv-stackedarea").data([e]);var T=S.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea");var N=T.append("defs");var C=T.append("g");var k=S.select("g");C.append("g").attr("class","nv-areaWrap");C.append("g").attr("class","nv-scatterWrap");S.attr("transform","translate("+t.left+","+t.top+")");m.width(a).height(v).x(o).y(function(e){return e.display.y+e.display.y0}).forceY([0]).color(e.map(function(e,t){return e.color||i(e,e.seriesIndex)}));var L=k.select(".nv-scatterWrap").datum(e);L.call(m);N.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect");S.select("#nv-edge-clip-"+s+" rect").attr("width",a).attr("height",v);k.attr("clip-path",h?"url(#nv-edge-clip-"+s+")":"");var A=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y+e.display.y0)}).interpolate(c);var O=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y0)});var M=k.select(".nv-areaWrap").selectAll("path.nv-area").data(function(e){return e});M.enter().append("path").attr("class",function(e,t){return"nv-area nv-area-"+t}).attr("d",function(e,t){return O(e.values,e.seriesIndex)}).on("mouseover",function(e,t){d3.select(this).classed("hover",true);g.areaMouseover({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t})}).on("mouseout",function(e,t){d3.select(this).classed("hover",false);g.areaMouseout({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t})}).on("click",function(e,t){d3.select(this).classed("hover",false);g.areaClick({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t})});M.exit().transition().attr("d",function(e,t){return O(e.values,t)}).remove();M.style("fill",function(e,t){return e.color||i(e,e.seriesIndex)}).style("stroke",function(e,t){return e.color||i(e,e.seriesIndex)});M.transition().attr("d",function(e,t){return A(e.values,t)});m.dispatch.on("elementMouseover.area",function(e){k.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",true)});m.dispatch.on("elementMouseout.area",function(e){k.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",false)});y.d3_stackedOffset_stackPercent=function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,a=[];for(s=0;s<n;++s){for(i=0,o=0;i<w.length;i++)o+=u(w[i].values[s]);if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)a[s]=0;return a}});return y}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=function(e){return e.x},u=function(e){return e.y},a="stack",f="zero",l="default",c="linear",h=false,p,d,v=d3.format(",.3f"),m=e.models.scatter(),g=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");m.size(2.2).sizeDomain([2.2,2.2]);m.dispatch.on("elementClick.area",function(e){g.areaClick(e)});m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],g.tooltipShow(e)});m.dispatch.on("elementMouseout.tooltip",function(e){g.tooltipHide(e)});y.dispatch=g;y.scatter=m;d3.rebind(y,m,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","highlightPoint","clearHighlights");y.options=e.utils.optionsFunc.bind(y);y.x=function(e){if(!arguments.length)return o;o=d3.functor(e);return y};y.y=function(e){if(!arguments.length)return u;u=d3.functor(e);return y};y.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return y};y.width=function(e){if(!arguments.length)return n;n=e;return y};y.height=function(e){if(!arguments.length)return r;r=e;return y};y.clipEdge=function(e){if(!arguments.length)return h;h=e;return y};y.color=function(t){if(!arguments.length)return i;i=e.utils.getColor(t);return y};y.offset=function(e){if(!arguments.length)return f;f=e;return y};y.order=function(e){if(!arguments.length)return l;l=e;return y};y.style=function(e){if(!arguments.length)return a;a=e;switch(a){case"stack":y.offset("zero");y.order("default");break;case"stream":y.offset("wiggle");y.order("inside-out");break;case"stream-center":y.offset("silhouette");y.order("inside-out");break;case"expand":y.offset("expand");y.order("default");break;case"stack_percent":y.offset(y.d3_stackedOffset_stackPercent);y.order("default");break}return y};y.interpolate=function(e){if(!arguments.length)return c;c=e;return y};return y};e.models.stackedAreaChart=function(){"use strict";function D(b){b.each(function(b){var x=d3.select(this),P=this;var H=(a||parseInt(x.style("width"))||960)-u.left-u.right,B=(f||parseInt(x.style("height"))||400)-u.top-u.bottom;D.update=function(){x.transition().duration(M).call(D)};D.container=this;if(y=="right")H=H-250;T.disabled=b.map(function(e){return!!e.disabled});if(!N){var j;N={};for(j in T){if(T[j]instanceof Array)N[j]=T[j].slice(0);else N[j]=T[j]}}if(!b||!b.length||!b.filter(function(e){return e.values.length}).length){var F=x.selectAll(".nv-noData").data([C]);F.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");F.attr("x",u.left+H/2).attr("y",u.top+B/2).text(function(e){return e});return D}else{x.selectAll(".nv-noData").remove()}w=t.xScale();E=t.yScale();var I=x.selectAll("g.nv-wrap.nv-stackedAreaChart").data([b]);var q=I.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g");var R=I.select("g");q.append("rect").style("opacity",0);q.append("g").attr("class","nv-x nv-axis");q.append("g").attr("class","nv-y nv-axis");q.append("g").attr("class","nv-stackedWrap");q.append("g").attr("class","nv-legendWrap");q.append("g").attr("class","nv-controlsWrap");q.append("g").attr("class","nv-interactive");R.select("rect").attr("width",H).attr("height",B);if(h){var U=c?H-L:H;i.width(U);R.select(".nv-legendWrap").datum(b).call(i);if(u.top!=i.height()){u.top=i.height();B=(f||parseInt(x.style("height"))||400)-u.top-u.bottom}if(y=="right"){R.select(".nv-legendWrap").attr("transform","translate("+H+","+20+")")}else{R.select(".nv-legendWrap").attr("transform","translate("+(H-U)+","+ -u.top+")")}}if(c){var z=[{key:O.stacked||"Stacked",metaKey:"Stacked",disabled:t.style()!="stack",style:"stack"},{key:O.stream||"Stream",metaKey:"Stream",disabled:t.style()!="stream",style:"stream"},{key:O.expanded||"Expanded",metaKey:"Expanded",disabled:t.style()!="expand",style:"expand"},{key:O.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:t.style()!="stack_percent",style:"stack_percent"}];L=A.length/3*260;z=z.filter(function(e){return A.indexOf(e.metaKey)!==-1});s.width(L).color(["#444","#444","#444"]);R.select(".nv-controlsWrap").datum(z).call(s);if(u.top!=Math.max(s.height(),i.height())){u.top=Math.max(s.height(),i.height());B=(f||parseInt(x.style("height"))||400)-u.top-u.bottom}R.select(".nv-controlsWrap").attr("transform","translate(0,"+ -u.top+")")}I.attr("transform","translate("+u.left+","+u.top+")");if(v){R.select(".nv-y.nv-axis").attr("transform","translate("+H+",0)")}if(m){o.width(H).height(B).margin({left:u.left,top:u.top}).svgContainer(x).xScale(w);I.select(".nv-interactive").call(o)}t.width(H).height(B);var W=R.select(".nv-stackedWrap").datum(b);W.transition().call(t);if(p){n.scale(w).ticks(H/100).tickSize(-B,0);R.select(".nv-x.nv-axis").attr("transform","translate(0,"+B+")");R.select(".nv-x.nv-axis").transition().duration(0).call(n)}if(d){r.scale(E).ticks(t.offset()=="wiggle"?0:B/36).tickSize(-H,0).setTickFormat(t.style()=="expand"||t.style()=="stack_percent"?d3.format("%"):S);R.select(".nv-y.nv-axis").transition().duration(0).call(r)}t.dispatch.on("areaClick.toggle",function(e){if(b.filter(function(e){return!e.disabled}).length===1)b=b.map(function(e){e.disabled=false;return e});else b=b.map(function(t,n){t.disabled=n!=e.seriesIndex;return t});T.disabled=b.map(function(e){return!!e.disabled});k.stateChange(T);D.update()});i.dispatch.on("stateChange",function(e){T.disabled=e.disabled;k.stateChange(T);D.update()});s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;z=z.map(function(e){e.disabled=true;return e});e.disabled=false;t.style(e.style);T.style=t.style();k.stateChange(T);D.update()});o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,a,f,c=[];b.filter(function(e,t){e.seriesIndex=t;return!e.disabled}).forEach(function(n,r){a=e.interactiveBisect(n.values,i.pointXValue,D.x());t.highlightPoint(r,a,true);var o=n.values[a];if(typeof o==="undefined")return;if(typeof s==="undefined")s=o;if(typeof f==="undefined")f=D.xScale()(D.x()(o,a));var u=t.style()=="expand"?o.display.y:D.y()(o,a);c.push({key:n.key,value:u,color:l(n,n.seriesIndex),stackedValue:o.display})});c.reverse();if(c.length>2){var h=D.yScale().invert(i.mouseY);var p=Infinity,d=null;c.forEach(function(e,t){if(h>=e.stackedValue.y0&&h<=e.stackedValue.y0+e.stackedValue.y){d=t;return}});if(d!=null)c[d].highlight=true}var v=n.tickFormat()(D.x()(s,a));var m=t.style()=="expand"?function(e,t){return d3.format(".1%")(e)}:function(e,t){return r.tickFormat()(e)};o.tooltip.position({left:f+u.left,top:i.mouseY+u.top}).chartContainer(P.parentNode).enabled(g).valueFormatter(m).data({value:v,series:c})();o.renderGuideLine(f)});o.dispatch.on("elementMouseout",function(e){k.tooltipHide();t.clearHighlights()});k.on("tooltipShow",function(e){if(g)_(e,P.parentNode)});k.on("changeState",function(e){if(typeof e.disabled!=="undefined"){b.forEach(function(t,n){t.disabled=e.disabled[n]});T.disabled=e.disabled}if(typeof e.style!=="undefined"){t.style(e.style)}D.update()})});return D}var t=e.models.stackedArea(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline();var u={top:30,right:25,bottom:50,left:60},a=null,f=null,l=e.utils.defaultColor(),c=true,h=true,p=true,d=true,v=false,m=false,g=true,y="top",b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"},w,E,S=d3.format(",.2f"),x=d3.format(",.3f"),T={style:t.style()},N=null,C="No Data Available.",k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=250,A=["Stacked","Stream","Expanded"],O={},M=250;n.orient("bottom").tickPadding(7);r.orient(v?"right":"left");s.updateState(false);var _=function(r,i){var s=r.pos[0]+(i.offsetLeft||0),o=r.pos[1]+(i.offsetTop||0),u=n.tickFormat()(t.x()(r.point,r.pointIndex)),a=x(t.y()(r.point,r.pointIndex)),f=b(r.series.key,u,a,r,D);e.tooltip.show([s,o],f,r.value<0?"n":"s",null,i)};t.dispatch.on("tooltipShow",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],k.tooltipShow(e)});t.dispatch.on("tooltipHide",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(g)e.tooltip.cleanup()});D.dispatch=k;D.stacked=t;D.legend=i;D.controls=s;D.xAxis=n;D.yAxis=r;D.interactiveLayer=o;d3.rebind(D,t,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate");D.options=e.utils.optionsFunc.bind(D);D.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return D};D.width=function(e){if(!arguments.length)return a;a=e;return D};D.height=function(e){if(!arguments.length)return f;f=e;return D};D.color=function(n){if(!arguments.length)return l;l=e.utils.getColor(n);i.color(l);t.color(l);return D};D.showControls=function(e){if(!arguments.length)return c;c=e;return D};D.showLegend=function(e){if(!arguments.length)return h;h=e;return D};D.showXAxis=function(e){if(!arguments.length)return p;p=e;return D};D.showYAxis=function(e){if(!arguments.length)return d;d=e;return D};D.rightAlignYAxis=function(e){if(!arguments.length)return v;v=e;r.orient(e?"right":"left");return D};D.useInteractiveGuideline=function(e){if(!arguments.length)return m;m=e;if(e===true){D.interactive(false);D.useVoronoi(false)}return D};D.tooltip=function(e){if(!arguments.length)return b;b=e;return D};D.tooltips=function(e){if(!arguments.length)return g;g=e;return D};D.legendPos=function(e){if(!arguments.length)return y;y=e;return D};D.tooltipContent=function(e){if(!arguments.length)return b;b=e;return D};D.yAxisTooltipFormat=function(e){if(!arguments.length)return x;x=e;return D};D.state=function(e){if(!arguments.length)return T;T=e;return D};D.defaultState=function(e){if(!arguments.length)return N;N=e;return D};D.noData=function(e){if(!arguments.length)return C;C=e;return D};D.transitionDuration=function(e){if(!arguments.length)return M;M=e;return D};D.controlsData=function(e){if(!arguments.length)return A;A=e;return D};D.controlLabels=function(e){if(!arguments.length)return O;if(typeof e!=="object")return O;O=e;return D};r.setTickFormat=r.tickFormat;r.tickFormat=function(e){if(!arguments.length)return S;S=e;return r};return D}})() \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/outro.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/outro.js
new file mode 100644
index 00000000..158693a0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/outro.js
@@ -0,0 +1 @@
+})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/sankey.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/sankey.js
new file mode 100644
index 00000000..c3bc59fb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/sankey.js
@@ -0,0 +1,292 @@
+d3.sankey = function() {
+ var sankey = {},
+ nodeWidth = 24,
+ nodePadding = 8,
+ size = [1, 1],
+ nodes = [],
+ links = [];
+
+ sankey.nodeWidth = function(_) {
+ if (!arguments.length) return nodeWidth;
+ nodeWidth = +_;
+ return sankey;
+ };
+
+ sankey.nodePadding = function(_) {
+ if (!arguments.length) return nodePadding;
+ nodePadding = +_;
+ return sankey;
+ };
+
+ sankey.nodes = function(_) {
+ if (!arguments.length) return nodes;
+ nodes = _;
+ return sankey;
+ };
+
+ sankey.links = function(_) {
+ if (!arguments.length) return links;
+ links = _;
+ return sankey;
+ };
+
+ sankey.size = function(_) {
+ if (!arguments.length) return size;
+ size = _;
+ return sankey;
+ };
+
+ sankey.layout = function(iterations) {
+ computeNodeLinks();
+ computeNodeValues();
+ computeNodeBreadths();
+ computeNodeDepths(iterations);
+ computeLinkDepths();
+ return sankey;
+ };
+
+ sankey.relayout = function() {
+ computeLinkDepths();
+ return sankey;
+ };
+
+ sankey.link = function() {
+ var curvature = .5;
+
+ function link(d) {
+ var x0 = d.source.x + d.source.dx,
+ x1 = d.target.x,
+ xi = d3.interpolateNumber(x0, x1),
+ x2 = xi(curvature),
+ x3 = xi(1 - curvature),
+ y0 = d.source.y + d.sy + d.dy / 2,
+ y1 = d.target.y + d.ty + d.dy / 2;
+ return "M" + x0 + "," + y0
+ + "C" + x2 + "," + y0
+ + " " + x3 + "," + y1
+ + " " + x1 + "," + y1;
+ }
+
+ link.curvature = function(_) {
+ if (!arguments.length) return curvature;
+ curvature = +_;
+ return link;
+ };
+
+ return link;
+ };
+
+ // Populate the sourceLinks and targetLinks for each node.
+ // Also, if the source and target are not objects, assume they are indices.
+ function computeNodeLinks() {
+ nodes.forEach(function(node) {
+ node.sourceLinks = [];
+ node.targetLinks = [];
+ });
+ links.forEach(function(link) {
+ var source = link.source,
+ target = link.target;
+ if (typeof source === "number") source = link.source = nodes[link.source];
+ if (typeof target === "number") target = link.target = nodes[link.target];
+ source.sourceLinks.push(link);
+ target.targetLinks.push(link);
+ });
+ }
+
+ // Compute the value (size) of each node by summing the associated links.
+ function computeNodeValues() {
+ nodes.forEach(function(node) {
+ node.value = Math.max(
+ d3.sum(node.sourceLinks, value),
+ d3.sum(node.targetLinks, value)
+ );
+ });
+ }
+
+ // Iteratively assign the breadth (x-position) for each node.
+ // Nodes are assigned the maximum breadth of incoming neighbors plus one;
+ // nodes with no incoming links are assigned breadth zero, while
+ // nodes with no outgoing links are assigned the maximum breadth.
+ function computeNodeBreadths() {
+ var remainingNodes = nodes,
+ nextNodes,
+ x = 0;
+
+ while (remainingNodes.length) {
+ nextNodes = [];
+ remainingNodes.forEach(function(node) {
+ node.x = x;
+ node.dx = nodeWidth;
+ node.sourceLinks.forEach(function(link) {
+ nextNodes.push(link.target);
+ });
+ });
+ remainingNodes = nextNodes;
+ ++x;
+ }
+
+ //
+ moveSinksRight(x);
+ scaleNodeBreadths((size[0] - nodeWidth) / (x - 1));
+ }
+
+ function moveSourcesRight() {
+ nodes.forEach(function(node) {
+ if (!node.targetLinks.length) {
+ node.x = d3.min(node.sourceLinks, function(d) { return d.target.x; }) - 1;
+ }
+ });
+ }
+
+ function moveSinksRight(x) {
+ nodes.forEach(function(node) {
+ if (!node.sourceLinks.length) {
+ node.x = x - 1;
+ }
+ });
+ }
+
+ function scaleNodeBreadths(kx) {
+ nodes.forEach(function(node) {
+ node.x *= kx;
+ });
+ }
+
+ function computeNodeDepths(iterations) {
+ var nodesByBreadth = d3.nest()
+ .key(function(d) { return d.x; })
+ .sortKeys(d3.ascending)
+ .entries(nodes)
+ .map(function(d) { return d.values; });
+
+ //
+ initializeNodeDepth();
+ resolveCollisions();
+ for (var alpha = 1; iterations > 0; --iterations) {
+ relaxRightToLeft(alpha *= .99);
+ resolveCollisions();
+ relaxLeftToRight(alpha);
+ resolveCollisions();
+ }
+
+ function initializeNodeDepth() {
+ var ky = d3.min(nodesByBreadth, function(nodes) {
+ return (size[1] - (nodes.length - 1) * nodePadding) / d3.sum(nodes, value);
+ });
+
+ nodesByBreadth.forEach(function(nodes) {
+ nodes.forEach(function(node, i) {
+ node.y = i;
+ node.dy = node.value * ky;
+ });
+ });
+
+ links.forEach(function(link) {
+ link.dy = link.value * ky;
+ });
+ }
+
+ function relaxLeftToRight(alpha) {
+ nodesByBreadth.forEach(function(nodes, breadth) {
+ nodes.forEach(function(node) {
+ if (node.targetLinks.length) {
+ var y = d3.sum(node.targetLinks, weightedSource) / d3.sum(node.targetLinks, value);
+ node.y += (y - center(node)) * alpha;
+ }
+ });
+ });
+
+ function weightedSource(link) {
+ return center(link.source) * link.value;
+ }
+ }
+
+ function relaxRightToLeft(alpha) {
+ nodesByBreadth.slice().reverse().forEach(function(nodes) {
+ nodes.forEach(function(node) {
+ if (node.sourceLinks.length) {
+ var y = d3.sum(node.sourceLinks, weightedTarget) / d3.sum(node.sourceLinks, value);
+ node.y += (y - center(node)) * alpha;
+ }
+ });
+ });
+
+ function weightedTarget(link) {
+ return center(link.target) * link.value;
+ }
+ }
+
+ function resolveCollisions() {
+ nodesByBreadth.forEach(function(nodes) {
+ var node,
+ dy,
+ y0 = 0,
+ n = nodes.length,
+ i;
+
+ // Push any overlapping nodes down.
+ nodes.sort(ascendingDepth);
+ for (i = 0; i < n; ++i) {
+ node = nodes[i];
+ dy = y0 - node.y;
+ if (dy > 0) node.y += dy;
+ y0 = node.y + node.dy + nodePadding;
+ }
+
+ // If the bottommost node goes outside the bounds, push it back up.
+ dy = y0 - nodePadding - size[1];
+ if (dy > 0) {
+ y0 = node.y -= dy;
+
+ // Push any overlapping nodes back up.
+ for (i = n - 2; i >= 0; --i) {
+ node = nodes[i];
+ dy = node.y + node.dy + nodePadding - y0;
+ if (dy > 0) node.y -= dy;
+ y0 = node.y;
+ }
+ }
+ });
+ }
+
+ function ascendingDepth(a, b) {
+ return a.y - b.y;
+ }
+ }
+
+ function computeLinkDepths() {
+ nodes.forEach(function(node) {
+ node.sourceLinks.sort(ascendingTargetDepth);
+ node.targetLinks.sort(ascendingSourceDepth);
+ });
+ nodes.forEach(function(node) {
+ var sy = 0, ty = 0;
+ node.sourceLinks.forEach(function(link) {
+ link.sy = sy;
+ sy += link.dy;
+ });
+ node.targetLinks.forEach(function(link) {
+ link.ty = ty;
+ ty += link.dy;
+ });
+ });
+
+ function ascendingSourceDepth(a, b) {
+ return a.source.y - b.source.y;
+ }
+
+ function ascendingTargetDepth(a, b) {
+ return a.target.y - b.target.y;
+ }
+ }
+
+ function center(node) {
+ return node.y + node.dy / 2;
+ }
+
+ function value(link) {
+ return link.value;
+ }
+
+ return sankey;
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/tooltip.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/tooltip.js
new file mode 100644
index 00000000..46e5a816
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/tooltip.js
@@ -0,0 +1,490 @@
+/* Tooltip rendering model for nvd3 charts.
+window.nv.models.tooltip is the updated,new way to render tooltips.
+
+window.nv.tooltip.show is the old tooltip code.
+window.nv.tooltip.* also has various helper methods.
+*/
+(function() {
+ "use strict";
+ window.nv.tooltip = {};
+
+ /* Model which can be instantiated to handle tooltip rendering.
+ Example usage:
+ var tip = nv.models.tooltip().gravity('w').distance(23)
+ .data(myDataObject);
+
+ tip(); //just invoke the returned function to render tooltip.
+ */
+ window.nv.models.tooltip = function() {
+ var content = null //HTML contents of the tooltip. If null, the content is generated via the data variable.
+ , data = null /* Tooltip data. If data is given in the proper format, a consistent tooltip is generated.
+ Format of data:
+ {
+ key: "Date",
+ value: "August 2009",
+ series: [
+ {
+ key: "Series 1",
+ value: "Value 1",
+ color: "#000"
+ },
+ {
+ key: "Series 2",
+ value: "Value 2",
+ color: "#00f"
+ }
+ ]
+
+ }
+
+ */
+ , gravity = 'w' //Can be 'n','s','e','w'. Determines how tooltip is positioned.
+ , distance = 50 //Distance to offset tooltip from the mouse location.
+ , snapDistance = 25 //Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect)
+ , fixedTop = null //If not null, this fixes the top position of the tooltip.
+ , classes = null //Attaches additional CSS classes to the tooltip DIV that is created.
+ , chartContainer = null //Parent DIV, of the SVG Container that holds the chart.
+ , tooltipElem = null //actual DOM element representing the tooltip.
+ , position = {left: null, top: null} //Relative position of the tooltip inside chartContainer.
+ , enabled = true //True -> tooltips are rendered. False -> don't render tooltips.
+ //Generates a unique id when you create a new tooltip() object
+ , id = "nvtooltip-" + Math.floor(Math.random() * 100000)
+ ;
+
+ //CSS class to specify whether element should not have mouse events.
+ var nvPointerEventsClass = "nv-pointer-events-none";
+
+ //Format function for the tooltip values column
+ var valueFormatter = function(d,i) {
+ return d;
+ };
+
+ //Format function for the tooltip header value.
+ var headerFormatter = function(d) {
+ return d;
+ };
+
+ //By default, the tooltip model renders a beautiful table inside a DIV.
+ //You can override this function if a custom tooltip is desired.
+ var contentGenerator = function(d) {
+ if (content != null) return content;
+
+ if (d == null) return '';
+
+ var table = d3.select(document.createElement("table"));
+ var theadEnter = table.selectAll("thead")
+ .data([d])
+ .enter().append("thead");
+ theadEnter.append("tr")
+ .append("td")
+ .attr("colspan",3)
+ .append("strong")
+ .classed("x-value",true)
+ .html(headerFormatter(d.value));
+
+ var tbodyEnter = table.selectAll("tbody")
+ .data([d])
+ .enter().append("tbody");
+ var trowEnter = tbodyEnter.selectAll("tr")
+ .data(function(p) { return p.series})
+ .enter()
+ .append("tr")
+ .classed("highlight", function(p) { return p.highlight})
+ ;
+
+ trowEnter.append("td")
+ .classed("legend-color-guide",true)
+ .append("div")
+ .style("background-color", function(p) { return p.color});
+ trowEnter.append("td")
+ .classed("key",true)
+ .html(function(p) {return p.key});
+ trowEnter.append("td")
+ .classed("value",true)
+ .html(function(p,i) { return valueFormatter(p.value,i) });
+
+
+ trowEnter.selectAll("td").each(function(p) {
+ if (p.highlight) {
+ var opacityScale = d3.scale.linear().domain([0,1]).range(["#fff",p.color]);
+ var opacity = 0.6;
+ d3.select(this)
+ .style("border-bottom-color", opacityScale(opacity))
+ .style("border-top-color", opacityScale(opacity))
+ ;
+ }
+ });
+
+ var html = table.node().outerHTML;
+ if (d.footer !== undefined)
+ html += "<div class='footer'>" + d.footer + "</div>";
+ return html;
+
+ };
+
+ var dataSeriesExists = function(d) {
+ if (d && d.series && d.series.length > 0) return true;
+
+ return false;
+ };
+
+ //In situations where the chart is in a 'viewBox', re-position the tooltip based on how far chart is zoomed.
+ function convertViewBoxRatio() {
+ if (chartContainer) {
+ var svg = d3.select(chartContainer);
+ if (svg.node().tagName !== "svg") {
+ svg = svg.select("svg");
+ }
+ var viewBox = (svg.node()) ? svg.attr('viewBox') : null;
+ if (viewBox) {
+ viewBox = viewBox.split(' ');
+ var ratio = parseInt(svg.style('width')) / viewBox[2];
+
+ position.left = position.left * ratio;
+ position.top = position.top * ratio;
+ }
+ }
+ }
+
+ //Creates new tooltip container, or uses existing one on DOM.
+ function getTooltipContainer(newContent) {
+ var body;
+ if (chartContainer)
+ body = d3.select(chartContainer);
+ else
+ body = d3.select("body");
+
+ var container = body.select(".nvtooltip");
+ if (container.node() === null) {
+ //Create new tooltip div if it doesn't exist on DOM.
+ container = body.append("div")
+ .attr("class", "nvtooltip " + (classes? classes: "xy-tooltip"))
+ .attr("id",id)
+ ;
+ }
+
+
+ container.node().innerHTML = newContent;
+ container.style("top",0).style("left",0).style("opacity",0);
+ container.selectAll("div, table, td, tr").classed(nvPointerEventsClass,true)
+ container.classed(nvPointerEventsClass,true);
+ return container.node();
+ }
+
+
+
+ //Draw the tooltip onto the DOM.
+ function nvtooltip() {
+ if (!enabled) return;
+ if (!dataSeriesExists(data)) return;
+
+ convertViewBoxRatio();
+
+ var left = position.left;
+ var top = (fixedTop != null) ? fixedTop : position.top;
+ var container = getTooltipContainer(contentGenerator(data));
+ tooltipElem = container;
+ if (chartContainer) {
+ var svgComp = chartContainer.getElementsByTagName("svg")[0];
+ var boundRect = (svgComp) ? svgComp.getBoundingClientRect() : chartContainer.getBoundingClientRect();
+ var svgOffset = {left:0,top:0};
+ if (svgComp) {
+ var svgBound = svgComp.getBoundingClientRect();
+ var chartBound = chartContainer.getBoundingClientRect();
+ var svgBoundTop = svgBound.top;
+
+ //Defensive code. Sometimes, svgBoundTop can be a really negative
+ // number, like -134254. That's a bug.
+ // If such a number is found, use zero instead. FireFox bug only
+ if (svgBoundTop < 0) {
+ var containerBound = chartContainer.getBoundingClientRect();
+ svgBoundTop = (Math.abs(svgBoundTop) > containerBound.height) ? 0 : svgBoundTop;
+ }
+ svgOffset.top = Math.abs(svgBoundTop - chartBound.top);
+ svgOffset.left = Math.abs(svgBound.left - chartBound.left);
+ }
+ //If the parent container is an overflow <div> with scrollbars, subtract the scroll offsets.
+ //You need to also add any offset between the <svg> element and its containing <div>
+ //Finally, add any offset of the containing <div> on the whole page.
+ left += chartContainer.offsetLeft + svgOffset.left - 2*chartContainer.scrollLeft;
+ top += chartContainer.offsetTop + svgOffset.top - 2*chartContainer.scrollTop;
+ }
+
+ if (snapDistance && snapDistance > 0) {
+ top = Math.floor(top/snapDistance) * snapDistance;
+ }
+
+ nv.tooltip.calcTooltipPosition([left,top], gravity, distance, container);
+ return nvtooltip;
+ };
+
+ nvtooltip.nvPointerEventsClass = nvPointerEventsClass;
+
+ nvtooltip.content = function(_) {
+ if (!arguments.length) return content;
+ content = _;
+ return nvtooltip;
+ };
+
+ //Returns tooltipElem...not able to set it.
+ nvtooltip.tooltipElem = function() {
+ return tooltipElem;
+ };
+
+ nvtooltip.contentGenerator = function(_) {
+ if (!arguments.length) return contentGenerator;
+ if (typeof _ === 'function') {
+ contentGenerator = _;
+ }
+ return nvtooltip;
+ };
+
+ nvtooltip.data = function(_) {
+ if (!arguments.length) return data;
+ data = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.gravity = function(_) {
+ if (!arguments.length) return gravity;
+ gravity = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.distance = function(_) {
+ if (!arguments.length) return distance;
+ distance = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.snapDistance = function(_) {
+ if (!arguments.length) return snapDistance;
+ snapDistance = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.classes = function(_) {
+ if (!arguments.length) return classes;
+ classes = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.chartContainer = function(_) {
+ if (!arguments.length) return chartContainer;
+ chartContainer = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.position = function(_) {
+ if (!arguments.length) return position;
+ position.left = (typeof _.left !== 'undefined') ? _.left : position.left;
+ position.top = (typeof _.top !== 'undefined') ? _.top : position.top;
+ return nvtooltip;
+ };
+
+ nvtooltip.fixedTop = function(_) {
+ if (!arguments.length) return fixedTop;
+ fixedTop = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.enabled = function(_) {
+ if (!arguments.length) return enabled;
+ enabled = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.valueFormatter = function(_) {
+ if (!arguments.length) return valueFormatter;
+ if (typeof _ === 'function') {
+ valueFormatter = _;
+ }
+ return nvtooltip;
+ };
+
+ nvtooltip.headerFormatter = function(_) {
+ if (!arguments.length) return headerFormatter;
+ if (typeof _ === 'function') {
+ headerFormatter = _;
+ }
+ return nvtooltip;
+ };
+
+ //id() is a read-only function. You can't use it to set the id.
+ nvtooltip.id = function() {
+ return id;
+ };
+
+
+ return nvtooltip;
+ };
+
+
+ //Original tooltip.show function. Kept for backward compatibility.
+ // pos = [left,top]
+ nv.tooltip.show = function(pos, content, gravity, dist, parentContainer, classes) {
+
+ //Create new tooltip div if it doesn't exist on DOM.
+ var container = document.createElement('div');
+ container.className = 'nvtooltip ' + (classes ? classes : 'xy-tooltip');
+
+ var body = parentContainer;
+ if ( !parentContainer || parentContainer.tagName.match(/g|svg/i)) {
+ //If the parent element is an SVG element, place tooltip in the <body> element.
+ body = document.getElementsByTagName('body')[0];
+ }
+
+ container.style.left = 0;
+ container.style.top = 0;
+ container.style.opacity = 0;
+ container.innerHTML = content;
+ body.appendChild(container);
+
+ //If the parent container is an overflow <div> with scrollbars, subtract the scroll offsets.
+ if (parentContainer) {
+ pos[0] = pos[0] - parentContainer.scrollLeft;
+ pos[1] = pos[1] - parentContainer.scrollTop;
+ }
+ nv.tooltip.calcTooltipPosition(pos, gravity, dist, container);
+ };
+
+ //Looks up the ancestry of a DOM element, and returns the first NON-svg node.
+ nv.tooltip.findFirstNonSVGParent = function(Elem) {
+ while(Elem.tagName.match(/^g|svg$/i) !== null) {
+ Elem = Elem.parentNode;
+ }
+ return Elem;
+ };
+
+ //Finds the total offsetTop of a given DOM element.
+ //Looks up the entire ancestry of an element, up to the first relatively positioned element.
+ nv.tooltip.findTotalOffsetTop = function ( Elem, initialTop ) {
+ var offsetTop = initialTop;
+
+ do {
+ if( !isNaN( Elem.offsetTop ) ) {
+ offsetTop += (Elem.offsetTop);
+ }
+ } while( Elem = Elem.offsetParent );
+ return offsetTop;
+ };
+
+ //Finds the total offsetLeft of a given DOM element.
+ //Looks up the entire ancestry of an element, up to the first relatively positioned element.
+ nv.tooltip.findTotalOffsetLeft = function ( Elem, initialLeft) {
+ var offsetLeft = initialLeft;
+
+ do {
+ if( !isNaN( Elem.offsetLeft ) ) {
+ offsetLeft += (Elem.offsetLeft);
+ }
+ } while( Elem = Elem.offsetParent );
+ return offsetLeft;
+ };
+
+ //Global utility function to render a tooltip on the DOM.
+ //pos = [left,top] coordinates of where to place the tooltip, relative to the SVG chart container.
+ //gravity = how to orient the tooltip
+ //dist = how far away from the mouse to place tooltip
+ //container = tooltip DIV
+ nv.tooltip.calcTooltipPosition = function(pos, gravity, dist, container) {
+
+ var height = parseInt(container.offsetHeight),
+ width = parseInt(container.offsetWidth),
+ windowWidth = nv.utils.windowSize().width,
+ windowHeight = nv.utils.windowSize().height,
+ scrollTop = window.pageYOffset,
+ scrollLeft = window.pageXOffset,
+ left, top;
+
+ windowHeight = window.innerWidth >= document.body.scrollWidth ? windowHeight : windowHeight - 16;
+ windowWidth = window.innerHeight >= document.body.scrollHeight ? windowWidth : windowWidth - 16;
+
+ gravity = gravity || 's';
+ dist = dist || 20;
+
+ var tooltipTop = function ( Elem ) {
+ return nv.tooltip.findTotalOffsetTop(Elem, top);
+ };
+
+ var tooltipLeft = function ( Elem ) {
+ return nv.tooltip.findTotalOffsetLeft(Elem,left);
+ };
+
+ switch (gravity) {
+ case 'e':
+ left = pos[0] - width - dist;
+ top = pos[1] - (height / 2);
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = pos[0] + dist > scrollLeft ? pos[0] + dist : scrollLeft - tLeft + left;
+ if (tTop < scrollTop) top = scrollTop - tTop + top;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
+ break;
+ case 'w':
+ left = pos[0] + dist;
+ top = pos[1] - (height / 2);
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft + width > windowWidth) left = pos[0] - width - dist;
+ if (tTop < scrollTop) top = scrollTop + 5;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
+ break;
+ case 'n':
+ left = pos[0] - (width / 2) - 5;
+ top = pos[1] + dist;
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = scrollLeft + 5;
+ if (tLeft + width > windowWidth) left = left - width/2 + 5;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
+ break;
+ case 's':
+ left = pos[0] - (width / 2);
+ top = pos[1] - height - dist;
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = scrollLeft + 5;
+ if (tLeft + width > windowWidth) left = left - width/2 + 5;
+ if (scrollTop > tTop) top = scrollTop;
+ break;
+ case 'none':
+ left = pos[0];
+ top = pos[1] - dist;
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ break;
+ }
+
+
+ container.style.left = left+'px';
+ container.style.top = top+'px';
+ container.style.opacity = 1;
+ container.style.position = 'absolute';
+
+ return container;
+ };
+
+ //Global utility function to remove tooltips from the DOM.
+ nv.tooltip.cleanup = function() {
+
+ // Find the tooltips, mark them for removal by this class (so others cleanups won't find it)
+ var tooltips = document.getElementsByClassName('nvtooltip');
+ var purging = [];
+ while(tooltips.length) {
+ purging.push(tooltips[0]);
+ tooltips[0].style.transitionDelay = '0 !important';
+ tooltips[0].style.opacity = 0;
+ tooltips[0].className = 'nvtooltip-pending-removal';
+ }
+
+ setTimeout(function() {
+
+ while (purging.length) {
+ var removeMe = purging.pop();
+ removeMe.parentNode.removeChild(removeMe);
+ }
+ }, 500);
+ };
+
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/utils.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/utils.js
new file mode 100644
index 00000000..7b99e1da
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/utils.js
@@ -0,0 +1,152 @@
+
+nv.utils.windowSize = function() {
+ // Sane defaults
+ var size = {width: 640, height: 480};
+
+ // Earlier IE uses Doc.body
+ if (document.body && document.body.offsetWidth) {
+ size.width = document.body.offsetWidth;
+ size.height = document.body.offsetHeight;
+ }
+
+ // IE can use depending on mode it is in
+ if (document.compatMode=='CSS1Compat' &&
+ document.documentElement &&
+ document.documentElement.offsetWidth ) {
+ size.width = document.documentElement.offsetWidth;
+ size.height = document.documentElement.offsetHeight;
+ }
+
+ // Most recent browsers use
+ if (window.innerWidth && window.innerHeight) {
+ size.width = window.innerWidth;
+ size.height = window.innerHeight;
+ }
+ return (size);
+};
+
+
+
+// Easy way to bind multiple functions to window.onresize
+// TODO: give a way to remove a function after its bound, other than removing all of them
+nv.utils.windowResize = function(fun){
+ if (fun === undefined) return;
+ var oldresize = window.onresize;
+
+ window.onresize = function(e) {
+ if (typeof oldresize == 'function') oldresize(e);
+ fun(e);
+ }
+}
+
+// Backwards compatible way to implement more d3-like coloring of graphs.
+// If passed an array, wrap it in a function which implements the old default
+// behavior
+nv.utils.getColor = function(color) {
+ if (!arguments.length) return nv.utils.defaultColor(); //if you pass in nothing, get default colors back
+
+ if( Object.prototype.toString.call( color ) === '[object Array]' )
+ return function(d, i) { return d.color || color[i % color.length]; };
+ else
+ return color;
+ //can't really help it if someone passes rubbish as color
+}
+
+// Default color chooser uses the index of an object as before.
+nv.utils.defaultColor = function() {
+ var colors = d3.scale.category20().range();
+ return function(d, i) { return d.color || colors[i % colors.length] };
+}
+
+
+// Returns a color function that takes the result of 'getKey' for each series and
+// looks for a corresponding color from the dictionary,
+nv.utils.customTheme = function(dictionary, getKey, defaultColors) {
+ getKey = getKey || function(series) { return series.key }; // use default series.key if getKey is undefined
+ defaultColors = defaultColors || d3.scale.category20().range(); //default color function
+
+ var defIndex = defaultColors.length; //current default color (going in reverse)
+
+ return function(series, index) {
+ var key = getKey(series);
+
+ if (!defIndex) defIndex = defaultColors.length; //used all the default colors, start over
+
+ if (typeof dictionary[key] !== "undefined")
+ return (typeof dictionary[key] === "function") ? dictionary[key]() : dictionary[key];
+ else
+ return defaultColors[--defIndex]; // no match in dictionary, use default color
+ }
+}
+
+
+
+// From the PJAX example on d3js.org, while this is not really directly needed
+// it's a very cool method for doing pjax, I may expand upon it a little bit,
+// open to suggestions on anything that may be useful
+nv.utils.pjax = function(links, content) {
+ d3.selectAll(links).on("click", function() {
+ history.pushState(this.href, this.textContent, this.href);
+ load(this.href);
+ d3.event.preventDefault();
+ });
+
+ function load(href) {
+ d3.html(href, function(fragment) {
+ var target = d3.select(content).node();
+ target.parentNode.replaceChild(d3.select(fragment).select(content).node(), target);
+ nv.utils.pjax(links, content);
+ });
+ }
+
+ d3.select(window).on("popstate", function() {
+ if (d3.event.state) load(d3.event.state);
+ });
+}
+
+/* For situations where we want to approximate the width in pixels for an SVG:text element.
+Most common instance is when the element is in a display:none; container.
+Forumla is : text.length * font-size * constant_factor
+*/
+nv.utils.calcApproxTextWidth = function (svgTextElem) {
+ if (svgTextElem instanceof d3.selection) {
+ var fontSize = parseInt(svgTextElem.style("font-size").replace("px",""));
+ var textLength = svgTextElem.text().length;
+
+ return textLength * fontSize * 0.5;
+ }
+ return 0;
+};
+
+/* Numbers that are undefined, null or NaN, convert them to zeros.
+*/
+nv.utils.NaNtoZero = function(n) {
+ if (typeof n !== 'number'
+ || isNaN(n)
+ || n === null
+ || n === Infinity) return 0;
+
+ return n;
+};
+
+/*
+Snippet of code you can insert into each nv.models.* to give you the ability to
+do things like:
+chart.options({
+ showXAxis: true,
+ tooltips: true
+});
+
+To enable in the chart:
+chart.options = nv.utils.optionsFunc.bind(chart);
+*/
+nv.utils.optionsFunc = function(args) {
+ if (args) {
+ d3.map(args).forEach((function(key,value) {
+ if (typeof this[key] === "function") {
+ this[key](value);
+ }
+ }).bind(this));
+ }
+ return this;
+}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-animate.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-animate.js
new file mode 100644
index 00000000..fc0e217f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-animate.js
@@ -0,0 +1,3721 @@
+/**
+ * @license AngularJS v1.4.3
+ * (c) 2010-2015 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+/* jshint ignore:start */
+var noop = angular.noop;
+var extend = angular.extend;
+var jqLite = angular.element;
+var forEach = angular.forEach;
+var isArray = angular.isArray;
+var isString = angular.isString;
+var isObject = angular.isObject;
+var isUndefined = angular.isUndefined;
+var isDefined = angular.isDefined;
+var isFunction = angular.isFunction;
+var isElement = angular.isElement;
+
+var ELEMENT_NODE = 1;
+var COMMENT_NODE = 8;
+
+var NG_ANIMATE_CLASSNAME = 'ng-animate';
+var NG_ANIMATE_CHILDREN_DATA = '$$ngAnimateChildren';
+
+var isPromiseLike = function(p) {
+ return p && p.then ? true : false;
+}
+
+function assertArg(arg, name, reason) {
+ if (!arg) {
+ throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
+ }
+ return arg;
+}
+
+function mergeClasses(a,b) {
+ if (!a && !b) return '';
+ if (!a) return b;
+ if (!b) return a;
+ if (isArray(a)) a = a.join(' ');
+ if (isArray(b)) b = b.join(' ');
+ return a + ' ' + b;
+}
+
+function packageStyles(options) {
+ var styles = {};
+ if (options && (options.to || options.from)) {
+ styles.to = options.to;
+ styles.from = options.from;
+ }
+ return styles;
+}
+
+function pendClasses(classes, fix, isPrefix) {
+ var className = '';
+ classes = isArray(classes)
+ ? classes
+ : classes && isString(classes) && classes.length
+ ? classes.split(/\s+/)
+ : [];
+ forEach(classes, function(klass, i) {
+ if (klass && klass.length > 0) {
+ className += (i > 0) ? ' ' : '';
+ className += isPrefix ? fix + klass
+ : klass + fix;
+ }
+ });
+ return className;
+}
+
+function removeFromArray(arr, val) {
+ var index = arr.indexOf(val);
+ if (val >= 0) {
+ arr.splice(index, 1);
+ }
+}
+
+function stripCommentsFromElement(element) {
+ if (element instanceof jqLite) {
+ switch (element.length) {
+ case 0:
+ return [];
+ break;
+
+ case 1:
+ // there is no point of stripping anything if the element
+ // is the only element within the jqLite wrapper.
+ // (it's important that we retain the element instance.)
+ if (element[0].nodeType === ELEMENT_NODE) {
+ return element;
+ }
+ break;
+
+ default:
+ return jqLite(extractElementNode(element));
+ break;
+ }
+ }
+
+ if (element.nodeType === ELEMENT_NODE) {
+ return jqLite(element);
+ }
+}
+
+function extractElementNode(element) {
+ if (!element[0]) return element;
+ for (var i = 0; i < element.length; i++) {
+ var elm = element[i];
+ if (elm.nodeType == ELEMENT_NODE) {
+ return elm;
+ }
+ }
+}
+
+function $$addClass($$jqLite, element, className) {
+ forEach(element, function(elm) {
+ $$jqLite.addClass(elm, className);
+ });
+}
+
+function $$removeClass($$jqLite, element, className) {
+ forEach(element, function(elm) {
+ $$jqLite.removeClass(elm, className);
+ });
+}
+
+function applyAnimationClassesFactory($$jqLite) {
+ return function(element, options) {
+ if (options.addClass) {
+ $$addClass($$jqLite, element, options.addClass);
+ options.addClass = null;
+ }
+ if (options.removeClass) {
+ $$removeClass($$jqLite, element, options.removeClass);
+ options.removeClass = null;
+ }
+ }
+}
+
+function prepareAnimationOptions(options) {
+ options = options || {};
+ if (!options.$$prepared) {
+ var domOperation = options.domOperation || noop;
+ options.domOperation = function() {
+ options.$$domOperationFired = true;
+ domOperation();
+ domOperation = noop;
+ };
+ options.$$prepared = true;
+ }
+ return options;
+}
+
+function applyAnimationStyles(element, options) {
+ applyAnimationFromStyles(element, options);
+ applyAnimationToStyles(element, options);
+}
+
+function applyAnimationFromStyles(element, options) {
+ if (options.from) {
+ element.css(options.from);
+ options.from = null;
+ }
+}
+
+function applyAnimationToStyles(element, options) {
+ if (options.to) {
+ element.css(options.to);
+ options.to = null;
+ }
+}
+
+function mergeAnimationOptions(element, target, newOptions) {
+ var toAdd = (target.addClass || '') + ' ' + (newOptions.addClass || '');
+ var toRemove = (target.removeClass || '') + ' ' + (newOptions.removeClass || '');
+ var classes = resolveElementClasses(element.attr('class'), toAdd, toRemove);
+
+ extend(target, newOptions);
+
+ if (classes.addClass) {
+ target.addClass = classes.addClass;
+ } else {
+ target.addClass = null;
+ }
+
+ if (classes.removeClass) {
+ target.removeClass = classes.removeClass;
+ } else {
+ target.removeClass = null;
+ }
+
+ return target;
+}
+
+function resolveElementClasses(existing, toAdd, toRemove) {
+ var ADD_CLASS = 1;
+ var REMOVE_CLASS = -1;
+
+ var flags = {};
+ existing = splitClassesToLookup(existing);
+
+ toAdd = splitClassesToLookup(toAdd);
+ forEach(toAdd, function(value, key) {
+ flags[key] = ADD_CLASS;
+ });
+
+ toRemove = splitClassesToLookup(toRemove);
+ forEach(toRemove, function(value, key) {
+ flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS;
+ });
+
+ var classes = {
+ addClass: '',
+ removeClass: ''
+ };
+
+ forEach(flags, function(val, klass) {
+ var prop, allow;
+ if (val === ADD_CLASS) {
+ prop = 'addClass';
+ allow = !existing[klass];
+ } else if (val === REMOVE_CLASS) {
+ prop = 'removeClass';
+ allow = existing[klass];
+ }
+ if (allow) {
+ if (classes[prop].length) {
+ classes[prop] += ' ';
+ }
+ classes[prop] += klass;
+ }
+ });
+
+ function splitClassesToLookup(classes) {
+ if (isString(classes)) {
+ classes = classes.split(' ');
+ }
+
+ var obj = {};
+ forEach(classes, function(klass) {
+ // sometimes the split leaves empty string values
+ // incase extra spaces were applied to the options
+ if (klass.length) {
+ obj[klass] = true;
+ }
+ });
+ return obj;
+ }
+
+ return classes;
+}
+
+function getDomNode(element) {
+ return (element instanceof angular.element) ? element[0] : element;
+}
+
+var $$rAFSchedulerFactory = ['$$rAF', function($$rAF) {
+ var tickQueue = [];
+ var cancelFn;
+
+ function scheduler(tasks) {
+ // we make a copy since RAFScheduler mutates the state
+ // of the passed in array variable and this would be difficult
+ // to track down on the outside code
+ tickQueue.push([].concat(tasks));
+ nextTick();
+ }
+
+ /* waitUntilQuiet does two things:
+ * 1. It will run the FINAL `fn` value only when an uncancelled RAF has passed through
+ * 2. It will delay the next wave of tasks from running until the quiet `fn` has run.
+ *
+ * The motivation here is that animation code can request more time from the scheduler
+ * before the next wave runs. This allows for certain DOM properties such as classes to
+ * be resolved in time for the next animation to run.
+ */
+ scheduler.waitUntilQuiet = function(fn) {
+ if (cancelFn) cancelFn();
+
+ cancelFn = $$rAF(function() {
+ cancelFn = null;
+ fn();
+ nextTick();
+ });
+ };
+
+ return scheduler;
+
+ function nextTick() {
+ if (!tickQueue.length) return;
+
+ var updatedQueue = [];
+ for (var i = 0; i < tickQueue.length; i++) {
+ var innerQueue = tickQueue[i];
+ runNextTask(innerQueue);
+ if (innerQueue.length) {
+ updatedQueue.push(innerQueue);
+ }
+ }
+ tickQueue = updatedQueue;
+
+ if (!cancelFn) {
+ $$rAF(function() {
+ if (!cancelFn) nextTick();
+ });
+ }
+ }
+
+ function runNextTask(tasks) {
+ var nextTask = tasks.shift();
+ nextTask();
+ }
+}];
+
+var $$AnimateChildrenDirective = [function() {
+ return function(scope, element, attrs) {
+ var val = attrs.ngAnimateChildren;
+ if (angular.isString(val) && val.length === 0) { //empty attribute
+ element.data(NG_ANIMATE_CHILDREN_DATA, true);
+ } else {
+ attrs.$observe('ngAnimateChildren', function(value) {
+ value = value === 'on' || value === 'true';
+ element.data(NG_ANIMATE_CHILDREN_DATA, value);
+ });
+ }
+ };
+}];
+
+/**
+ * @ngdoc service
+ * @name $animateCss
+ * @kind object
+ *
+ * @description
+ * The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes
+ * from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT
+ * to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or
+ * directives to create more complex animations that can be purely driven using CSS code.
+ *
+ * Note that only browsers that support CSS transitions and/or keyframe animations are capable of
+ * rendering animations triggered via `$animateCss` (bad news for IE9 and lower).
+ *
+ * ## Usage
+ * Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that
+ * is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however,
+ * any automatic control over cancelling animations and/or preventing animations from being run on
+ * child elements will not be handled by Angular. For this to work as expected, please use `$animate` to
+ * trigger the animation and then setup a JavaScript animation that injects `$animateCss` to trigger
+ * the CSS animation.
+ *
+ * The example below shows how we can create a folding animation on an element using `ng-if`:
+ *
+ * ```html
+ * <!-- notice the `fold-animation` CSS class -->
+ * <div ng-if="onOff" class="fold-animation">
+ * This element will go BOOM
+ * </div>
+ * <button ng-click="onOff=true">Fold In</button>
+ * ```
+ *
+ * Now we create the **JavaScript animation** that will trigger the CSS transition:
+ *
+ * ```js
+ * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {
+ * return {
+ * enter: function(element, doneFn) {
+ * var height = element[0].offsetHeight;
+ * return $animateCss(element, {
+ * from: { height:'0px' },
+ * to: { height:height + 'px' },
+ * duration: 1 // one second
+ * });
+ * }
+ * }
+ * }]);
+ * ```
+ *
+ * ## More Advanced Uses
+ *
+ * `$animateCss` is the underlying code that ngAnimate uses to power **CSS-based animations** behind the scenes. Therefore CSS hooks
+ * like `.ng-EVENT`, `.ng-EVENT-active`, `.ng-EVENT-stagger` are all features that can be triggered using `$animateCss` via JavaScript code.
+ *
+ * This also means that just about any combination of adding classes, removing classes, setting styles, dynamically setting a keyframe animation,
+ * applying a hardcoded duration or delay value, changing the animation easing or applying a stagger animation are all options that work with
+ * `$animateCss`. The service itself is smart enough to figure out the combination of options and examine the element styling properties in order
+ * to provide a working animation that will run in CSS.
+ *
+ * The example below showcases a more advanced version of the `.fold-animation` from the example above:
+ *
+ * ```js
+ * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {
+ * return {
+ * enter: function(element, doneFn) {
+ * var height = element[0].offsetHeight;
+ * return $animateCss(element, {
+ * addClass: 'red large-text pulse-twice',
+ * easing: 'ease-out',
+ * from: { height:'0px' },
+ * to: { height:height + 'px' },
+ * duration: 1 // one second
+ * });
+ * }
+ * }
+ * }]);
+ * ```
+ *
+ * Since we're adding/removing CSS classes then the CSS transition will also pick those up:
+ *
+ * ```css
+ * /&#42; since a hardcoded duration value of 1 was provided in the JavaScript animation code,
+ * the CSS classes below will be transitioned despite them being defined as regular CSS classes &#42;/
+ * .red { background:red; }
+ * .large-text { font-size:20px; }
+ *
+ * /&#42; we can also use a keyframe animation and $animateCss will make it work alongside the transition &#42;/
+ * .pulse-twice {
+ * animation: 0.5s pulse linear 2;
+ * -webkit-animation: 0.5s pulse linear 2;
+ * }
+ *
+ * @keyframes pulse {
+ * from { transform: scale(0.5); }
+ * to { transform: scale(1.5); }
+ * }
+ *
+ * @-webkit-keyframes pulse {
+ * from { -webkit-transform: scale(0.5); }
+ * to { -webkit-transform: scale(1.5); }
+ * }
+ * ```
+ *
+ * Given this complex combination of CSS classes, styles and options, `$animateCss` will figure everything out and make the animation happen.
+ *
+ * ## How the Options are handled
+ *
+ * `$animateCss` is very versatile and intelligent when it comes to figuring out what configurations to apply to the element to ensure the animation
+ * works with the options provided. Say for example we were adding a class that contained a keyframe value and we wanted to also animate some inline
+ * styles using the `from` and `to` properties.
+ *
+ * ```js
+ * var animator = $animateCss(element, {
+ * from: { background:'red' },
+ * to: { background:'blue' }
+ * });
+ * animator.start();
+ * ```
+ *
+ * ```css
+ * .rotating-animation {
+ * animation:0.5s rotate linear;
+ * -webkit-animation:0.5s rotate linear;
+ * }
+ *
+ * @keyframes rotate {
+ * from { transform: rotate(0deg); }
+ * to { transform: rotate(360deg); }
+ * }
+ *
+ * @-webkit-keyframes rotate {
+ * from { -webkit-transform: rotate(0deg); }
+ * to { -webkit-transform: rotate(360deg); }
+ * }
+ * ```
+ *
+ * The missing pieces here are that we do not have a transition set (within the CSS code nor within the `$animateCss` options) and the duration of the animation is
+ * going to be detected from what the keyframe styles on the CSS class are. In this event, `$animateCss` will automatically create an inline transition
+ * style matching the duration detected from the keyframe style (which is present in the CSS class that is being added) and then prepare both the transition
+ * and keyframe animations to run in parallel on the element. Then when the animation is underway the provided `from` and `to` CSS styles will be applied
+ * and spread across the transition and keyframe animation.
+ *
+ * ## What is returned
+ *
+ * `$animateCss` works in two stages: a preparation phase and an animation phase. Therefore when `$animateCss` is first called it will NOT actually
+ * start the animation. All that is going on here is that the element is being prepared for the animation (which means that the generated CSS classes are
+ * added and removed on the element). Once `$animateCss` is called it will return an object with the following properties:
+ *
+ * ```js
+ * var animator = $animateCss(element, { ... });
+ * ```
+ *
+ * Now what do the contents of our `animator` variable look like:
+ *
+ * ```js
+ * {
+ * // starts the animation
+ * start: Function,
+ *
+ * // ends (aborts) the animation
+ * end: Function
+ * }
+ * ```
+ *
+ * To actually start the animation we need to run `animation.start()` which will then return a promise that we can hook into to detect when the animation ends.
+ * If we choose not to run the animation then we MUST run `animation.end()` to perform a cleanup on the element (since some CSS classes and stlyes may have been
+ * applied to the element during the preparation phase). Note that all other properties such as duration, delay, transitions and keyframes are just properties
+ * and that changing them will not reconfigure the parameters of the animation.
+ *
+ * ### runner.done() vs runner.then()
+ * It is documented that `animation.start()` will return a promise object and this is true, however, there is also an additional method available on the
+ * runner called `.done(callbackFn)`. The done method works the same as `.finally(callbackFn)`, however, it does **not trigger a digest to occur**.
+ * Therefore, for performance reasons, it's always best to use `runner.done(callback)` instead of `runner.then()`, `runner.catch()` or `runner.finally()`
+ * unless you really need a digest to kick off afterwards.
+ *
+ * Keep in mind that, to make this easier, ngAnimate has tweaked the JS animations API to recognize when a runner instance is returned from $animateCss
+ * (so there is no need to call `runner.done(doneFn)` inside of your JavaScript animation code).
+ * Check the {@link ngAnimate.$animateCss#usage animation code above} to see how this works.
+ *
+ * @param {DOMElement} element the element that will be animated
+ * @param {object} options the animation-related options that will be applied during the animation
+ *
+ * * `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied
+ * to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.)
+ * * `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both).
+ * * `transition` - The raw CSS transition style that will be used (e.g. `1s linear all`).
+ * * `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`).
+ * * `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation.
+ * * `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition.
+ * * `addClass` - A space separated list of CSS classes that will be added to the element and spread across the animation.
+ * * `removeClass` - A space separated list of CSS classes that will be removed from the element and spread across the animation.
+ * * `duration` - A number value representing the total duration of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `0`
+ * is provided then the animation will be skipped entirely.
+ * * `delay` - A number value representing the total delay of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `true` is
+ * used then whatever delay value is detected from the CSS classes will be mirrored on the elements styles (e.g. by setting delay true then the style value
+ * of the element will be `transition-delay: DETECTED_VALUE`). Using `true` is useful when you want the CSS classes and inline styles to all share the same
+ * CSS delay value.
+ * * `stagger` - A numeric time value representing the delay between successively animated elements
+ * ({@link ngAnimate#css-staggering-animations Click here to learn how CSS-based staggering works in ngAnimate.})
+ * * `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a
+ * `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`)
+ * `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occuring on the classes being added and removed.)
+ *
+ * @return {object} an object with start and end methods and details about the animation.
+ *
+ * * `start` - The method to start the animation. This will return a `Promise` when called.
+ * * `end` - This method will cancel the animation and remove all applied CSS classes and styles.
+ */
+
+// Detect proper transitionend/animationend event names.
+var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT;
+
+// If unprefixed events are not supported but webkit-prefixed are, use the latter.
+// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.
+// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`
+// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.
+// Register both events in case `window.onanimationend` is not supported because of that,
+// do the same for `transitionend` as Safari is likely to exhibit similar behavior.
+// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit
+// therefore there is no reason to test anymore for other vendor prefixes:
+// http://caniuse.com/#search=transition
+if (window.ontransitionend === undefined && window.onwebkittransitionend !== undefined) {
+ CSS_PREFIX = '-webkit-';
+ TRANSITION_PROP = 'WebkitTransition';
+ TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';
+} else {
+ TRANSITION_PROP = 'transition';
+ TRANSITIONEND_EVENT = 'transitionend';
+}
+
+if (window.onanimationend === undefined && window.onwebkitanimationend !== undefined) {
+ CSS_PREFIX = '-webkit-';
+ ANIMATION_PROP = 'WebkitAnimation';
+ ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend';
+} else {
+ ANIMATION_PROP = 'animation';
+ ANIMATIONEND_EVENT = 'animationend';
+}
+
+var DURATION_KEY = 'Duration';
+var PROPERTY_KEY = 'Property';
+var DELAY_KEY = 'Delay';
+var TIMING_KEY = 'TimingFunction';
+var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount';
+var ANIMATION_PLAYSTATE_KEY = 'PlayState';
+var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;
+var CLOSING_TIME_BUFFER = 1.5;
+var ONE_SECOND = 1000;
+var BASE_TEN = 10;
+
+var SAFE_FAST_FORWARD_DURATION_VALUE = 9999;
+
+var ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY;
+var ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY;
+
+var TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY;
+var TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;
+
+var DETECT_CSS_PROPERTIES = {
+ transitionDuration: TRANSITION_DURATION_PROP,
+ transitionDelay: TRANSITION_DELAY_PROP,
+ transitionProperty: TRANSITION_PROP + PROPERTY_KEY,
+ animationDuration: ANIMATION_DURATION_PROP,
+ animationDelay: ANIMATION_DELAY_PROP,
+ animationIterationCount: ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY
+};
+
+var DETECT_STAGGER_CSS_PROPERTIES = {
+ transitionDuration: TRANSITION_DURATION_PROP,
+ transitionDelay: TRANSITION_DELAY_PROP,
+ animationDuration: ANIMATION_DURATION_PROP,
+ animationDelay: ANIMATION_DELAY_PROP
+};
+
+function computeCssStyles($window, element, properties) {
+ var styles = Object.create(null);
+ var detectedStyles = $window.getComputedStyle(element) || {};
+ forEach(properties, function(formalStyleName, actualStyleName) {
+ var val = detectedStyles[formalStyleName];
+ if (val) {
+ var c = val.charAt(0);
+
+ // only numerical-based values have a negative sign or digit as the first value
+ if (c === '-' || c === '+' || c >= 0) {
+ val = parseMaxTime(val);
+ }
+
+ // by setting this to null in the event that the delay is not set or is set directly as 0
+ // then we can still allow for zegative values to be used later on and not mistake this
+ // value for being greater than any other negative value.
+ if (val === 0) {
+ val = null;
+ }
+ styles[actualStyleName] = val;
+ }
+ });
+
+ return styles;
+}
+
+function parseMaxTime(str) {
+ var maxValue = 0;
+ var values = str.split(/\s*,\s*/);
+ forEach(values, function(value) {
+ // it's always safe to consider only second values and omit `ms` values since
+ // getComputedStyle will always handle the conversion for us
+ if (value.charAt(value.length - 1) == 's') {
+ value = value.substring(0, value.length - 1);
+ }
+ value = parseFloat(value) || 0;
+ maxValue = maxValue ? Math.max(value, maxValue) : value;
+ });
+ return maxValue;
+}
+
+function truthyTimingValue(val) {
+ return val === 0 || val != null;
+}
+
+function getCssTransitionDurationStyle(duration, applyOnlyDuration) {
+ var style = TRANSITION_PROP;
+ var value = duration + 's';
+ if (applyOnlyDuration) {
+ style += DURATION_KEY;
+ } else {
+ value += ' linear all';
+ }
+ return [style, value];
+}
+
+function getCssKeyframeDurationStyle(duration) {
+ return [ANIMATION_DURATION_PROP, duration + 's'];
+}
+
+function getCssDelayStyle(delay, isKeyframeAnimation) {
+ var prop = isKeyframeAnimation ? ANIMATION_DELAY_PROP : TRANSITION_DELAY_PROP;
+ return [prop, delay + 's'];
+}
+
+function blockTransitions(node, duration) {
+ // we use a negative delay value since it performs blocking
+ // yet it doesn't kill any existing transitions running on the
+ // same element which makes this safe for class-based animations
+ var value = duration ? '-' + duration + 's' : '';
+ applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]);
+ return [TRANSITION_DELAY_PROP, value];
+}
+
+function blockKeyframeAnimations(node, applyBlock) {
+ var value = applyBlock ? 'paused' : '';
+ var key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY;
+ applyInlineStyle(node, [key, value]);
+ return [key, value];
+}
+
+function applyInlineStyle(node, styleTuple) {
+ var prop = styleTuple[0];
+ var value = styleTuple[1];
+ node.style[prop] = value;
+}
+
+function createLocalCacheLookup() {
+ var cache = Object.create(null);
+ return {
+ flush: function() {
+ cache = Object.create(null);
+ },
+
+ count: function(key) {
+ var entry = cache[key];
+ return entry ? entry.total : 0;
+ },
+
+ get: function(key) {
+ var entry = cache[key];
+ return entry && entry.value;
+ },
+
+ put: function(key, value) {
+ if (!cache[key]) {
+ cache[key] = { total: 1, value: value };
+ } else {
+ cache[key].total++;
+ }
+ }
+ };
+}
+
+var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
+ var gcsLookup = createLocalCacheLookup();
+ var gcsStaggerLookup = createLocalCacheLookup();
+
+ this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout',
+ '$document', '$sniffer', '$$rAFScheduler',
+ function($window, $$jqLite, $$AnimateRunner, $timeout,
+ $document, $sniffer, $$rAFScheduler) {
+
+ var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+
+ var parentCounter = 0;
+ function gcsHashFn(node, extraClasses) {
+ var KEY = "$$ngAnimateParentKey";
+ var parentNode = node.parentNode;
+ var parentID = parentNode[KEY] || (parentNode[KEY] = ++parentCounter);
+ return parentID + '-' + node.getAttribute('class') + '-' + extraClasses;
+ }
+
+ function computeCachedCssStyles(node, className, cacheKey, properties) {
+ var timings = gcsLookup.get(cacheKey);
+
+ if (!timings) {
+ timings = computeCssStyles($window, node, properties);
+ if (timings.animationIterationCount === 'infinite') {
+ timings.animationIterationCount = 1;
+ }
+ }
+
+ // we keep putting this in multiple times even though the value and the cacheKey are the same
+ // because we're keeping an interal tally of how many duplicate animations are detected.
+ gcsLookup.put(cacheKey, timings);
+ return timings;
+ }
+
+ function computeCachedCssStaggerStyles(node, className, cacheKey, properties) {
+ var stagger;
+
+ // if we have one or more existing matches of matching elements
+ // containing the same parent + CSS styles (which is how cacheKey works)
+ // then staggering is possible
+ if (gcsLookup.count(cacheKey) > 0) {
+ stagger = gcsStaggerLookup.get(cacheKey);
+
+ if (!stagger) {
+ var staggerClassName = pendClasses(className, '-stagger');
+
+ $$jqLite.addClass(node, staggerClassName);
+
+ stagger = computeCssStyles($window, node, properties);
+
+ // force the conversion of a null value to zero incase not set
+ stagger.animationDuration = Math.max(stagger.animationDuration, 0);
+ stagger.transitionDuration = Math.max(stagger.transitionDuration, 0);
+
+ $$jqLite.removeClass(node, staggerClassName);
+
+ gcsStaggerLookup.put(cacheKey, stagger);
+ }
+ }
+
+ return stagger || {};
+ }
+
+ var bod = getDomNode($document).body;
+ var rafWaitQueue = [];
+ function waitUntilQuiet(callback) {
+ rafWaitQueue.push(callback);
+ $$rAFScheduler.waitUntilQuiet(function() {
+ gcsLookup.flush();
+ gcsStaggerLookup.flush();
+
+ //the line below will force the browser to perform a repaint so
+ //that all the animated elements within the animation frame will
+ //be properly updated and drawn on screen. This is required to
+ //ensure that the preparation animation is properly flushed so that
+ //the active state picks up from there. DO NOT REMOVE THIS LINE.
+ //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH
+ //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND
+ //WILL TAKE YEARS AWAY FROM YOUR LIFE.
+ var width = bod.offsetWidth + 1;
+
+ // we use a for loop to ensure that if the queue is changed
+ // during this looping then it will consider new requests
+ for (var i = 0; i < rafWaitQueue.length; i++) {
+ rafWaitQueue[i](width);
+ }
+ rafWaitQueue.length = 0;
+ });
+ }
+
+ return init;
+
+ function computeTimings(node, className, cacheKey) {
+ var timings = computeCachedCssStyles(node, className, cacheKey, DETECT_CSS_PROPERTIES);
+ var aD = timings.animationDelay;
+ var tD = timings.transitionDelay;
+ timings.maxDelay = aD && tD
+ ? Math.max(aD, tD)
+ : (aD || tD);
+ timings.maxDuration = Math.max(
+ timings.animationDuration * timings.animationIterationCount,
+ timings.transitionDuration);
+
+ return timings;
+ }
+
+ function init(element, options) {
+ var node = getDomNode(element);
+ if (!node || !node.parentNode) {
+ return closeAndReturnNoopAnimator();
+ }
+
+ options = prepareAnimationOptions(options);
+
+ var temporaryStyles = [];
+ var classes = element.attr('class');
+ var styles = packageStyles(options);
+ var animationClosed;
+ var animationPaused;
+ var animationCompleted;
+ var runner;
+ var runnerHost;
+ var maxDelay;
+ var maxDelayTime;
+ var maxDuration;
+ var maxDurationTime;
+
+ if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) {
+ return closeAndReturnNoopAnimator();
+ }
+
+ var method = options.event && isArray(options.event)
+ ? options.event.join(' ')
+ : options.event;
+
+ var isStructural = method && options.structural;
+ var structuralClassName = '';
+ var addRemoveClassName = '';
+
+ if (isStructural) {
+ structuralClassName = pendClasses(method, 'ng-', true);
+ } else if (method) {
+ structuralClassName = method;
+ }
+
+ if (options.addClass) {
+ addRemoveClassName += pendClasses(options.addClass, '-add');
+ }
+
+ if (options.removeClass) {
+ if (addRemoveClassName.length) {
+ addRemoveClassName += ' ';
+ }
+ addRemoveClassName += pendClasses(options.removeClass, '-remove');
+ }
+
+ // there may be a situation where a structural animation is combined together
+ // with CSS classes that need to resolve before the animation is computed.
+ // However this means that there is no explicit CSS code to block the animation
+ // from happening (by setting 0s none in the class name). If this is the case
+ // we need to apply the classes before the first rAF so we know to continue if
+ // there actually is a detected transition or keyframe animation
+ if (options.applyClassesEarly && addRemoveClassName.length) {
+ applyAnimationClasses(element, options);
+ addRemoveClassName = '';
+ }
+
+ var setupClasses = [structuralClassName, addRemoveClassName].join(' ').trim();
+ var fullClassName = classes + ' ' + setupClasses;
+ var activeClasses = pendClasses(setupClasses, '-active');
+ var hasToStyles = styles.to && Object.keys(styles.to).length > 0;
+ var containsKeyframeAnimation = (options.keyframeStyle || '').length > 0;
+
+ // there is no way we can trigger an animation if no styles and
+ // no classes are being applied which would then trigger a transition,
+ // unless there a is raw keyframe value that is applied to the element.
+ if (!containsKeyframeAnimation
+ && !hasToStyles
+ && !setupClasses) {
+ return closeAndReturnNoopAnimator();
+ }
+
+ var cacheKey, stagger;
+ if (options.stagger > 0) {
+ var staggerVal = parseFloat(options.stagger);
+ stagger = {
+ transitionDelay: staggerVal,
+ animationDelay: staggerVal,
+ transitionDuration: 0,
+ animationDuration: 0
+ };
+ } else {
+ cacheKey = gcsHashFn(node, fullClassName);
+ stagger = computeCachedCssStaggerStyles(node, setupClasses, cacheKey, DETECT_STAGGER_CSS_PROPERTIES);
+ }
+
+ $$jqLite.addClass(element, setupClasses);
+
+ var applyOnlyDuration;
+
+ if (options.transitionStyle) {
+ var transitionStyle = [TRANSITION_PROP, options.transitionStyle];
+ applyInlineStyle(node, transitionStyle);
+ temporaryStyles.push(transitionStyle);
+ }
+
+ if (options.duration >= 0) {
+ applyOnlyDuration = node.style[TRANSITION_PROP].length > 0;
+ var durationStyle = getCssTransitionDurationStyle(options.duration, applyOnlyDuration);
+
+ // we set the duration so that it will be picked up by getComputedStyle later
+ applyInlineStyle(node, durationStyle);
+ temporaryStyles.push(durationStyle);
+ }
+
+ if (options.keyframeStyle) {
+ var keyframeStyle = [ANIMATION_PROP, options.keyframeStyle];
+ applyInlineStyle(node, keyframeStyle);
+ temporaryStyles.push(keyframeStyle);
+ }
+
+ var itemIndex = stagger
+ ? options.staggerIndex >= 0
+ ? options.staggerIndex
+ : gcsLookup.count(cacheKey)
+ : 0;
+
+ var isFirst = itemIndex === 0;
+
+ // this is a pre-emptive way of forcing the setup classes to be added and applied INSTANTLY
+ // without causing any combination of transitions to kick in. By adding a negative delay value
+ // it forces the setup class' transition to end immediately. We later then remove the negative
+ // transition delay to allow for the transition to naturally do it's thing. The beauty here is
+ // that if there is no transition defined then nothing will happen and this will also allow
+ // other transitions to be stacked on top of each other without any chopping them out.
+ if (isFirst) {
+ blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE);
+ }
+
+ var timings = computeTimings(node, fullClassName, cacheKey);
+ var relativeDelay = timings.maxDelay;
+ maxDelay = Math.max(relativeDelay, 0);
+ maxDuration = timings.maxDuration;
+
+ var flags = {};
+ flags.hasTransitions = timings.transitionDuration > 0;
+ flags.hasAnimations = timings.animationDuration > 0;
+ flags.hasTransitionAll = flags.hasTransitions && timings.transitionProperty == 'all';
+ flags.applyTransitionDuration = hasToStyles && (
+ (flags.hasTransitions && !flags.hasTransitionAll)
+ || (flags.hasAnimations && !flags.hasTransitions));
+ flags.applyAnimationDuration = options.duration && flags.hasAnimations;
+ flags.applyTransitionDelay = truthyTimingValue(options.delay) && (flags.applyTransitionDuration || flags.hasTransitions);
+ flags.applyAnimationDelay = truthyTimingValue(options.delay) && flags.hasAnimations;
+ flags.recalculateTimingStyles = addRemoveClassName.length > 0;
+
+ if (flags.applyTransitionDuration || flags.applyAnimationDuration) {
+ maxDuration = options.duration ? parseFloat(options.duration) : maxDuration;
+
+ if (flags.applyTransitionDuration) {
+ flags.hasTransitions = true;
+ timings.transitionDuration = maxDuration;
+ applyOnlyDuration = node.style[TRANSITION_PROP + PROPERTY_KEY].length > 0;
+ temporaryStyles.push(getCssTransitionDurationStyle(maxDuration, applyOnlyDuration));
+ }
+
+ if (flags.applyAnimationDuration) {
+ flags.hasAnimations = true;
+ timings.animationDuration = maxDuration;
+ temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration));
+ }
+ }
+
+ if (maxDuration === 0 && !flags.recalculateTimingStyles) {
+ return closeAndReturnNoopAnimator();
+ }
+
+ // we need to recalculate the delay value since we used a pre-emptive negative
+ // delay value and the delay value is required for the final event checking. This
+ // property will ensure that this will happen after the RAF phase has passed.
+ if (options.duration == null && timings.transitionDuration > 0) {
+ flags.recalculateTimingStyles = flags.recalculateTimingStyles || isFirst;
+ }
+
+ maxDelayTime = maxDelay * ONE_SECOND;
+ maxDurationTime = maxDuration * ONE_SECOND;
+ if (!options.skipBlocking) {
+ flags.blockTransition = timings.transitionDuration > 0;
+ flags.blockKeyframeAnimation = timings.animationDuration > 0 &&
+ stagger.animationDelay > 0 &&
+ stagger.animationDuration === 0;
+ }
+
+ applyAnimationFromStyles(element, options);
+ if (!flags.blockTransition) {
+ blockTransitions(node, false);
+ }
+
+ applyBlocking(maxDuration);
+
+ // TODO(matsko): for 1.5 change this code to have an animator object for better debugging
+ return {
+ $$willAnimate: true,
+ end: endFn,
+ start: function() {
+ if (animationClosed) return;
+
+ runnerHost = {
+ end: endFn,
+ cancel: cancelFn,
+ resume: null, //this will be set during the start() phase
+ pause: null
+ };
+
+ runner = new $$AnimateRunner(runnerHost);
+
+ waitUntilQuiet(start);
+
+ // we don't have access to pause/resume the animation
+ // since it hasn't run yet. AnimateRunner will therefore
+ // set noop functions for resume and pause and they will
+ // later be overridden once the animation is triggered
+ return runner;
+ }
+ };
+
+ function endFn() {
+ close();
+ }
+
+ function cancelFn() {
+ close(true);
+ }
+
+ function close(rejected) { // jshint ignore:line
+ // if the promise has been called already then we shouldn't close
+ // the animation again
+ if (animationClosed || (animationCompleted && animationPaused)) return;
+ animationClosed = true;
+ animationPaused = false;
+
+ $$jqLite.removeClass(element, setupClasses);
+ $$jqLite.removeClass(element, activeClasses);
+
+ blockKeyframeAnimations(node, false);
+ blockTransitions(node, false);
+
+ forEach(temporaryStyles, function(entry) {
+ // There is only one way to remove inline style properties entirely from elements.
+ // By using `removeProperty` this works, but we need to convert camel-cased CSS
+ // styles down to hyphenated values.
+ node.style[entry[0]] = '';
+ });
+
+ applyAnimationClasses(element, options);
+ applyAnimationStyles(element, options);
+
+ // the reason why we have this option is to allow a synchronous closing callback
+ // that is fired as SOON as the animation ends (when the CSS is removed) or if
+ // the animation never takes off at all. A good example is a leave animation since
+ // the element must be removed just after the animation is over or else the element
+ // will appear on screen for one animation frame causing an overbearing flicker.
+ if (options.onDone) {
+ options.onDone();
+ }
+
+ // if the preparation function fails then the promise is not setup
+ if (runner) {
+ runner.complete(!rejected);
+ }
+ }
+
+ function applyBlocking(duration) {
+ if (flags.blockTransition) {
+ blockTransitions(node, duration);
+ }
+
+ if (flags.blockKeyframeAnimation) {
+ blockKeyframeAnimations(node, !!duration);
+ }
+ }
+
+ function closeAndReturnNoopAnimator() {
+ runner = new $$AnimateRunner({
+ end: endFn,
+ cancel: cancelFn
+ });
+
+ close();
+
+ return {
+ $$willAnimate: false,
+ start: function() {
+ return runner;
+ },
+ end: endFn
+ };
+ }
+
+ function start() {
+ if (animationClosed) return;
+ if (!node.parentNode) {
+ close();
+ return;
+ }
+
+ var startTime, events = [];
+
+ // even though we only pause keyframe animations here the pause flag
+ // will still happen when transitions are used. Only the transition will
+ // not be paused since that is not possible. If the animation ends when
+ // paused then it will not complete until unpaused or cancelled.
+ var playPause = function(playAnimation) {
+ if (!animationCompleted) {
+ animationPaused = !playAnimation;
+ if (timings.animationDuration) {
+ var value = blockKeyframeAnimations(node, animationPaused);
+ animationPaused
+ ? temporaryStyles.push(value)
+ : removeFromArray(temporaryStyles, value);
+ }
+ } else if (animationPaused && playAnimation) {
+ animationPaused = false;
+ close();
+ }
+ };
+
+ // checking the stagger duration prevents an accidently cascade of the CSS delay style
+ // being inherited from the parent. If the transition duration is zero then we can safely
+ // rely that the delay value is an intential stagger delay style.
+ var maxStagger = itemIndex > 0
+ && ((timings.transitionDuration && stagger.transitionDuration === 0) ||
+ (timings.animationDuration && stagger.animationDuration === 0))
+ && Math.max(stagger.animationDelay, stagger.transitionDelay);
+ if (maxStagger) {
+ $timeout(triggerAnimationStart,
+ Math.floor(maxStagger * itemIndex * ONE_SECOND),
+ false);
+ } else {
+ triggerAnimationStart();
+ }
+
+ // this will decorate the existing promise runner with pause/resume methods
+ runnerHost.resume = function() {
+ playPause(true);
+ };
+
+ runnerHost.pause = function() {
+ playPause(false);
+ };
+
+ function triggerAnimationStart() {
+ // just incase a stagger animation kicks in when the animation
+ // itself was cancelled entirely
+ if (animationClosed) return;
+
+ applyBlocking(false);
+
+ forEach(temporaryStyles, function(entry) {
+ var key = entry[0];
+ var value = entry[1];
+ node.style[key] = value;
+ });
+
+ applyAnimationClasses(element, options);
+ $$jqLite.addClass(element, activeClasses);
+
+ if (flags.recalculateTimingStyles) {
+ fullClassName = node.className + ' ' + setupClasses;
+ cacheKey = gcsHashFn(node, fullClassName);
+
+ timings = computeTimings(node, fullClassName, cacheKey);
+ relativeDelay = timings.maxDelay;
+ maxDelay = Math.max(relativeDelay, 0);
+ maxDuration = timings.maxDuration;
+
+ if (maxDuration === 0) {
+ close();
+ return;
+ }
+
+ flags.hasTransitions = timings.transitionDuration > 0;
+ flags.hasAnimations = timings.animationDuration > 0;
+ }
+
+ if (flags.applyTransitionDelay || flags.applyAnimationDelay) {
+ relativeDelay = typeof options.delay !== "boolean" && truthyTimingValue(options.delay)
+ ? parseFloat(options.delay)
+ : relativeDelay;
+
+ maxDelay = Math.max(relativeDelay, 0);
+
+ var delayStyle;
+ if (flags.applyTransitionDelay) {
+ timings.transitionDelay = relativeDelay;
+ delayStyle = getCssDelayStyle(relativeDelay);
+ temporaryStyles.push(delayStyle);
+ node.style[delayStyle[0]] = delayStyle[1];
+ }
+
+ if (flags.applyAnimationDelay) {
+ timings.animationDelay = relativeDelay;
+ delayStyle = getCssDelayStyle(relativeDelay, true);
+ temporaryStyles.push(delayStyle);
+ node.style[delayStyle[0]] = delayStyle[1];
+ }
+ }
+
+ maxDelayTime = maxDelay * ONE_SECOND;
+ maxDurationTime = maxDuration * ONE_SECOND;
+
+ if (options.easing) {
+ var easeProp, easeVal = options.easing;
+ if (flags.hasTransitions) {
+ easeProp = TRANSITION_PROP + TIMING_KEY;
+ temporaryStyles.push([easeProp, easeVal]);
+ node.style[easeProp] = easeVal;
+ }
+ if (flags.hasAnimations) {
+ easeProp = ANIMATION_PROP + TIMING_KEY;
+ temporaryStyles.push([easeProp, easeVal]);
+ node.style[easeProp] = easeVal;
+ }
+ }
+
+ if (timings.transitionDuration) {
+ events.push(TRANSITIONEND_EVENT);
+ }
+
+ if (timings.animationDuration) {
+ events.push(ANIMATIONEND_EVENT);
+ }
+
+ startTime = Date.now();
+ element.on(events.join(' '), onAnimationProgress);
+ $timeout(onAnimationExpired, maxDelayTime + CLOSING_TIME_BUFFER * maxDurationTime);
+
+ applyAnimationToStyles(element, options);
+ }
+
+ function onAnimationExpired() {
+ // although an expired animation is a failed animation, getting to
+ // this outcome is very easy if the CSS code screws up. Therefore we
+ // should still continue normally as if the animation completed correctly.
+ close();
+ }
+
+ function onAnimationProgress(event) {
+ event.stopPropagation();
+ var ev = event.originalEvent || event;
+ var timeStamp = ev.$manualTimeStamp || ev.timeStamp || Date.now();
+
+ /* Firefox (or possibly just Gecko) likes to not round values up
+ * when a ms measurement is used for the animation */
+ var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));
+
+ /* $manualTimeStamp is a mocked timeStamp value which is set
+ * within browserTrigger(). This is only here so that tests can
+ * mock animations properly. Real events fallback to event.timeStamp,
+ * or, if they don't, then a timeStamp is automatically created for them.
+ * We're checking to see if the timeStamp surpasses the expected delay,
+ * but we're using elapsedTime instead of the timeStamp on the 2nd
+ * pre-condition since animations sometimes close off early */
+ if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) {
+ // we set this flag to ensure that if the transition is paused then, when resumed,
+ // the animation will automatically close itself since transitions cannot be paused.
+ animationCompleted = true;
+ close();
+ }
+ }
+ }
+ }
+ }];
+}];
+
+var $$AnimateCssDriverProvider = ['$$animationProvider', function($$animationProvider) {
+ $$animationProvider.drivers.push('$$animateCssDriver');
+
+ var NG_ANIMATE_SHIM_CLASS_NAME = 'ng-animate-shim';
+ var NG_ANIMATE_ANCHOR_CLASS_NAME = 'ng-anchor';
+
+ var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out';
+ var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in';
+
+ this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$document', '$sniffer',
+ function($animateCss, $rootScope, $$AnimateRunner, $rootElement, $document, $sniffer) {
+
+ // only browsers that support these properties can render animations
+ if (!$sniffer.animations && !$sniffer.transitions) return noop;
+
+ var bodyNode = getDomNode($document).body;
+ var rootNode = getDomNode($rootElement);
+
+ var rootBodyElement = jqLite(bodyNode.parentNode === rootNode ? bodyNode : rootNode);
+
+ return function initDriverFn(animationDetails) {
+ return animationDetails.from && animationDetails.to
+ ? prepareFromToAnchorAnimation(animationDetails.from,
+ animationDetails.to,
+ animationDetails.classes,
+ animationDetails.anchors)
+ : prepareRegularAnimation(animationDetails);
+ };
+
+ function filterCssClasses(classes) {
+ //remove all the `ng-` stuff
+ return classes.replace(/\bng-\S+\b/g, '');
+ }
+
+ function getUniqueValues(a, b) {
+ if (isString(a)) a = a.split(' ');
+ if (isString(b)) b = b.split(' ');
+ return a.filter(function(val) {
+ return b.indexOf(val) === -1;
+ }).join(' ');
+ }
+
+ function prepareAnchoredAnimation(classes, outAnchor, inAnchor) {
+ var clone = jqLite(getDomNode(outAnchor).cloneNode(true));
+ var startingClasses = filterCssClasses(getClassVal(clone));
+
+ outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);
+ inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);
+
+ clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME);
+
+ rootBodyElement.append(clone);
+
+ var animatorIn, animatorOut = prepareOutAnimation();
+
+ // the user may not end up using the `out` animation and
+ // only making use of the `in` animation or vice-versa.
+ // In either case we should allow this and not assume the
+ // animation is over unless both animations are not used.
+ if (!animatorOut) {
+ animatorIn = prepareInAnimation();
+ if (!animatorIn) {
+ return end();
+ }
+ }
+
+ var startingAnimator = animatorOut || animatorIn;
+
+ return {
+ start: function() {
+ var runner;
+
+ var currentAnimation = startingAnimator.start();
+ currentAnimation.done(function() {
+ currentAnimation = null;
+ if (!animatorIn) {
+ animatorIn = prepareInAnimation();
+ if (animatorIn) {
+ currentAnimation = animatorIn.start();
+ currentAnimation.done(function() {
+ currentAnimation = null;
+ end();
+ runner.complete();
+ });
+ return currentAnimation;
+ }
+ }
+ // in the event that there is no `in` animation
+ end();
+ runner.complete();
+ });
+
+ runner = new $$AnimateRunner({
+ end: endFn,
+ cancel: endFn
+ });
+
+ return runner;
+
+ function endFn() {
+ if (currentAnimation) {
+ currentAnimation.end();
+ }
+ }
+ }
+ };
+
+ function calculateAnchorStyles(anchor) {
+ var styles = {};
+
+ var coords = getDomNode(anchor).getBoundingClientRect();
+
+ // we iterate directly since safari messes up and doesn't return
+ // all the keys for the coods object when iterated
+ forEach(['width','height','top','left'], function(key) {
+ var value = coords[key];
+ switch (key) {
+ case 'top':
+ value += bodyNode.scrollTop;
+ break;
+ case 'left':
+ value += bodyNode.scrollLeft;
+ break;
+ }
+ styles[key] = Math.floor(value) + 'px';
+ });
+ return styles;
+ }
+
+ function prepareOutAnimation() {
+ var animator = $animateCss(clone, {
+ addClass: NG_OUT_ANCHOR_CLASS_NAME,
+ delay: true,
+ from: calculateAnchorStyles(outAnchor)
+ });
+
+ // read the comment within `prepareRegularAnimation` to understand
+ // why this check is necessary
+ return animator.$$willAnimate ? animator : null;
+ }
+
+ function getClassVal(element) {
+ return element.attr('class') || '';
+ }
+
+ function prepareInAnimation() {
+ var endingClasses = filterCssClasses(getClassVal(inAnchor));
+ var toAdd = getUniqueValues(endingClasses, startingClasses);
+ var toRemove = getUniqueValues(startingClasses, endingClasses);
+
+ var animator = $animateCss(clone, {
+ to: calculateAnchorStyles(inAnchor),
+ addClass: NG_IN_ANCHOR_CLASS_NAME + ' ' + toAdd,
+ removeClass: NG_OUT_ANCHOR_CLASS_NAME + ' ' + toRemove,
+ delay: true
+ });
+
+ // read the comment within `prepareRegularAnimation` to understand
+ // why this check is necessary
+ return animator.$$willAnimate ? animator : null;
+ }
+
+ function end() {
+ clone.remove();
+ outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);
+ inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);
+ }
+ }
+
+ function prepareFromToAnchorAnimation(from, to, classes, anchors) {
+ var fromAnimation = prepareRegularAnimation(from);
+ var toAnimation = prepareRegularAnimation(to);
+
+ var anchorAnimations = [];
+ forEach(anchors, function(anchor) {
+ var outElement = anchor['out'];
+ var inElement = anchor['in'];
+ var animator = prepareAnchoredAnimation(classes, outElement, inElement);
+ if (animator) {
+ anchorAnimations.push(animator);
+ }
+ });
+
+ // no point in doing anything when there are no elements to animate
+ if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return;
+
+ return {
+ start: function() {
+ var animationRunners = [];
+
+ if (fromAnimation) {
+ animationRunners.push(fromAnimation.start());
+ }
+
+ if (toAnimation) {
+ animationRunners.push(toAnimation.start());
+ }
+
+ forEach(anchorAnimations, function(animation) {
+ animationRunners.push(animation.start());
+ });
+
+ var runner = new $$AnimateRunner({
+ end: endFn,
+ cancel: endFn // CSS-driven animations cannot be cancelled, only ended
+ });
+
+ $$AnimateRunner.all(animationRunners, function(status) {
+ runner.complete(status);
+ });
+
+ return runner;
+
+ function endFn() {
+ forEach(animationRunners, function(runner) {
+ runner.end();
+ });
+ }
+ }
+ };
+ }
+
+ function prepareRegularAnimation(animationDetails) {
+ var element = animationDetails.element;
+ var options = animationDetails.options || {};
+
+ if (animationDetails.structural) {
+ // structural animations ensure that the CSS classes are always applied
+ // before the detection starts.
+ options.structural = options.applyClassesEarly = true;
+
+ // we special case the leave animation since we want to ensure that
+ // the element is removed as soon as the animation is over. Otherwise
+ // a flicker might appear or the element may not be removed at all
+ options.event = animationDetails.event;
+ if (options.event === 'leave') {
+ options.onDone = options.domOperation;
+ }
+ } else {
+ options.event = null;
+ }
+
+ var animator = $animateCss(element, options);
+
+ // the driver lookup code inside of $$animation attempts to spawn a
+ // driver one by one until a driver returns a.$$willAnimate animator object.
+ // $animateCss will always return an object, however, it will pass in
+ // a flag as a hint as to whether an animation was detected or not
+ return animator.$$willAnimate ? animator : null;
+ }
+ }];
+}];
+
+// TODO(matsko): use caching here to speed things up for detection
+// TODO(matsko): add documentation
+// by the time...
+
+var $$AnimateJsProvider = ['$animateProvider', function($animateProvider) {
+ this.$get = ['$injector', '$$AnimateRunner', '$$rAFMutex', '$$jqLite',
+ function($injector, $$AnimateRunner, $$rAFMutex, $$jqLite) {
+
+ var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+ // $animateJs(element, 'enter');
+ return function(element, event, classes, options) {
+ // the `classes` argument is optional and if it is not used
+ // then the classes will be resolved from the element's className
+ // property as well as options.addClass/options.removeClass.
+ if (arguments.length === 3 && isObject(classes)) {
+ options = classes;
+ classes = null;
+ }
+
+ options = prepareAnimationOptions(options);
+ if (!classes) {
+ classes = element.attr('class') || '';
+ if (options.addClass) {
+ classes += ' ' + options.addClass;
+ }
+ if (options.removeClass) {
+ classes += ' ' + options.removeClass;
+ }
+ }
+
+ var classesToAdd = options.addClass;
+ var classesToRemove = options.removeClass;
+
+ // the lookupAnimations function returns a series of animation objects that are
+ // matched up with one or more of the CSS classes. These animation objects are
+ // defined via the module.animation factory function. If nothing is detected then
+ // we don't return anything which then makes $animation query the next driver.
+ var animations = lookupAnimations(classes);
+ var before, after;
+ if (animations.length) {
+ var afterFn, beforeFn;
+ if (event == 'leave') {
+ beforeFn = 'leave';
+ afterFn = 'afterLeave'; // TODO(matsko): get rid of this
+ } else {
+ beforeFn = 'before' + event.charAt(0).toUpperCase() + event.substr(1);
+ afterFn = event;
+ }
+
+ if (event !== 'enter' && event !== 'move') {
+ before = packageAnimations(element, event, options, animations, beforeFn);
+ }
+ after = packageAnimations(element, event, options, animations, afterFn);
+ }
+
+ // no matching animations
+ if (!before && !after) return;
+
+ function applyOptions() {
+ options.domOperation();
+ applyAnimationClasses(element, options);
+ }
+
+ return {
+ start: function() {
+ var closeActiveAnimations;
+ var chain = [];
+
+ if (before) {
+ chain.push(function(fn) {
+ closeActiveAnimations = before(fn);
+ });
+ }
+
+ if (chain.length) {
+ chain.push(function(fn) {
+ applyOptions();
+ fn(true);
+ });
+ } else {
+ applyOptions();
+ }
+
+ if (after) {
+ chain.push(function(fn) {
+ closeActiveAnimations = after(fn);
+ });
+ }
+
+ var animationClosed = false;
+ var runner = new $$AnimateRunner({
+ end: function() {
+ endAnimations();
+ },
+ cancel: function() {
+ endAnimations(true);
+ }
+ });
+
+ $$AnimateRunner.chain(chain, onComplete);
+ return runner;
+
+ function onComplete(success) {
+ animationClosed = true;
+ applyOptions();
+ applyAnimationStyles(element, options);
+ runner.complete(success);
+ }
+
+ function endAnimations(cancelled) {
+ if (!animationClosed) {
+ (closeActiveAnimations || noop)(cancelled);
+ onComplete(cancelled);
+ }
+ }
+ }
+ };
+
+ function executeAnimationFn(fn, element, event, options, onDone) {
+ var args;
+ switch (event) {
+ case 'animate':
+ args = [element, options.from, options.to, onDone];
+ break;
+
+ case 'setClass':
+ args = [element, classesToAdd, classesToRemove, onDone];
+ break;
+
+ case 'addClass':
+ args = [element, classesToAdd, onDone];
+ break;
+
+ case 'removeClass':
+ args = [element, classesToRemove, onDone];
+ break;
+
+ default:
+ args = [element, onDone];
+ break;
+ }
+
+ args.push(options);
+
+ var value = fn.apply(fn, args);
+ if (value) {
+ if (isFunction(value.start)) {
+ value = value.start();
+ }
+
+ if (value instanceof $$AnimateRunner) {
+ value.done(onDone);
+ } else if (isFunction(value)) {
+ // optional onEnd / onCancel callback
+ return value;
+ }
+ }
+
+ return noop;
+ }
+
+ function groupEventedAnimations(element, event, options, animations, fnName) {
+ var operations = [];
+ forEach(animations, function(ani) {
+ var animation = ani[fnName];
+ if (!animation) return;
+
+ // note that all of these animations will run in parallel
+ operations.push(function() {
+ var runner;
+ var endProgressCb;
+
+ var resolved = false;
+ var onAnimationComplete = function(rejected) {
+ if (!resolved) {
+ resolved = true;
+ (endProgressCb || noop)(rejected);
+ runner.complete(!rejected);
+ }
+ };
+
+ runner = new $$AnimateRunner({
+ end: function() {
+ onAnimationComplete();
+ },
+ cancel: function() {
+ onAnimationComplete(true);
+ }
+ });
+
+ endProgressCb = executeAnimationFn(animation, element, event, options, function(result) {
+ var cancelled = result === false;
+ onAnimationComplete(cancelled);
+ });
+
+ return runner;
+ });
+ });
+
+ return operations;
+ }
+
+ function packageAnimations(element, event, options, animations, fnName) {
+ var operations = groupEventedAnimations(element, event, options, animations, fnName);
+ if (operations.length === 0) {
+ var a,b;
+ if (fnName === 'beforeSetClass') {
+ a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass');
+ b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass');
+ } else if (fnName === 'setClass') {
+ a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass');
+ b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass');
+ }
+
+ if (a) {
+ operations = operations.concat(a);
+ }
+ if (b) {
+ operations = operations.concat(b);
+ }
+ }
+
+ if (operations.length === 0) return;
+
+ // TODO(matsko): add documentation
+ return function startAnimation(callback) {
+ var runners = [];
+ if (operations.length) {
+ forEach(operations, function(animateFn) {
+ runners.push(animateFn());
+ });
+ }
+
+ runners.length ? $$AnimateRunner.all(runners, callback) : callback();
+
+ return function endFn(reject) {
+ forEach(runners, function(runner) {
+ reject ? runner.cancel() : runner.end();
+ });
+ };
+ };
+ }
+ };
+
+ function lookupAnimations(classes) {
+ classes = isArray(classes) ? classes : classes.split(' ');
+ var matches = [], flagMap = {};
+ for (var i=0; i < classes.length; i++) {
+ var klass = classes[i],
+ animationFactory = $animateProvider.$$registeredAnimations[klass];
+ if (animationFactory && !flagMap[klass]) {
+ matches.push($injector.get(animationFactory));
+ flagMap[klass] = true;
+ }
+ }
+ return matches;
+ }
+ }];
+}];
+
+var $$AnimateJsDriverProvider = ['$$animationProvider', function($$animationProvider) {
+ $$animationProvider.drivers.push('$$animateJsDriver');
+ this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) {
+ return function initDriverFn(animationDetails) {
+ if (animationDetails.from && animationDetails.to) {
+ var fromAnimation = prepareAnimation(animationDetails.from);
+ var toAnimation = prepareAnimation(animationDetails.to);
+ if (!fromAnimation && !toAnimation) return;
+
+ return {
+ start: function() {
+ var animationRunners = [];
+
+ if (fromAnimation) {
+ animationRunners.push(fromAnimation.start());
+ }
+
+ if (toAnimation) {
+ animationRunners.push(toAnimation.start());
+ }
+
+ $$AnimateRunner.all(animationRunners, done);
+
+ var runner = new $$AnimateRunner({
+ end: endFnFactory(),
+ cancel: endFnFactory()
+ });
+
+ return runner;
+
+ function endFnFactory() {
+ return function() {
+ forEach(animationRunners, function(runner) {
+ // at this point we cannot cancel animations for groups just yet. 1.5+
+ runner.end();
+ });
+ };
+ }
+
+ function done(status) {
+ runner.complete(status);
+ }
+ }
+ };
+ } else {
+ return prepareAnimation(animationDetails);
+ }
+ };
+
+ function prepareAnimation(animationDetails) {
+ // TODO(matsko): make sure to check for grouped animations and delegate down to normal animations
+ var element = animationDetails.element;
+ var event = animationDetails.event;
+ var options = animationDetails.options;
+ var classes = animationDetails.classes;
+ return $$animateJs(element, event, classes, options);
+ }
+ }];
+}];
+
+var NG_ANIMATE_ATTR_NAME = 'data-ng-animate';
+var NG_ANIMATE_PIN_DATA = '$ngAnimatePin';
+var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
+ var PRE_DIGEST_STATE = 1;
+ var RUNNING_STATE = 2;
+
+ var rules = this.rules = {
+ skip: [],
+ cancel: [],
+ join: []
+ };
+
+ function isAllowed(ruleType, element, currentAnimation, previousAnimation) {
+ return rules[ruleType].some(function(fn) {
+ return fn(element, currentAnimation, previousAnimation);
+ });
+ }
+
+ function hasAnimationClasses(options, and) {
+ options = options || {};
+ var a = (options.addClass || '').length > 0;
+ var b = (options.removeClass || '').length > 0;
+ return and ? a && b : a || b;
+ }
+
+ rules.join.push(function(element, newAnimation, currentAnimation) {
+ // if the new animation is class-based then we can just tack that on
+ return !newAnimation.structural && hasAnimationClasses(newAnimation.options);
+ });
+
+ rules.skip.push(function(element, newAnimation, currentAnimation) {
+ // there is no need to animate anything if no classes are being added and
+ // there is no structural animation that will be triggered
+ return !newAnimation.structural && !hasAnimationClasses(newAnimation.options);
+ });
+
+ rules.skip.push(function(element, newAnimation, currentAnimation) {
+ // why should we trigger a new structural animation if the element will
+ // be removed from the DOM anyway?
+ return currentAnimation.event == 'leave' && newAnimation.structural;
+ });
+
+ rules.skip.push(function(element, newAnimation, currentAnimation) {
+ // if there is a current animation then skip the class-based animation
+ return currentAnimation.structural && !newAnimation.structural;
+ });
+
+ rules.cancel.push(function(element, newAnimation, currentAnimation) {
+ // there can never be two structural animations running at the same time
+ return currentAnimation.structural && newAnimation.structural;
+ });
+
+ rules.cancel.push(function(element, newAnimation, currentAnimation) {
+ // if the previous animation is already running, but the new animation will
+ // be triggered, but the new animation is structural
+ return currentAnimation.state === RUNNING_STATE && newAnimation.structural;
+ });
+
+ rules.cancel.push(function(element, newAnimation, currentAnimation) {
+ var nO = newAnimation.options;
+ var cO = currentAnimation.options;
+
+ // if the exact same CSS class is added/removed then it's safe to cancel it
+ return (nO.addClass && nO.addClass === cO.removeClass) || (nO.removeClass && nO.removeClass === cO.addClass);
+ });
+
+ this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$HashMap',
+ '$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite',
+ function($$rAF, $rootScope, $rootElement, $document, $$HashMap,
+ $$animation, $$AnimateRunner, $templateRequest, $$jqLite) {
+
+ var activeAnimationsLookup = new $$HashMap();
+ var disabledElementsLookup = new $$HashMap();
+
+ var animationsEnabled = null;
+
+ // Wait until all directive and route-related templates are downloaded and
+ // compiled. The $templateRequest.totalPendingRequests variable keeps track of
+ // all of the remote templates being currently downloaded. If there are no
+ // templates currently downloading then the watcher will still fire anyway.
+ var deregisterWatch = $rootScope.$watch(
+ function() { return $templateRequest.totalPendingRequests === 0; },
+ function(isEmpty) {
+ if (!isEmpty) return;
+ deregisterWatch();
+
+ // Now that all templates have been downloaded, $animate will wait until
+ // the post digest queue is empty before enabling animations. By having two
+ // calls to $postDigest calls we can ensure that the flag is enabled at the
+ // very end of the post digest queue. Since all of the animations in $animate
+ // use $postDigest, it's important that the code below executes at the end.
+ // This basically means that the page is fully downloaded and compiled before
+ // any animations are triggered.
+ $rootScope.$$postDigest(function() {
+ $rootScope.$$postDigest(function() {
+ // we check for null directly in the event that the application already called
+ // .enabled() with whatever arguments that it provided it with
+ if (animationsEnabled === null) {
+ animationsEnabled = true;
+ }
+ });
+ });
+ }
+ );
+
+ var bodyElement = jqLite($document[0].body);
+
+ var callbackRegistry = {};
+
+ // remember that the classNameFilter is set during the provider/config
+ // stage therefore we can optimize here and setup a helper function
+ var classNameFilter = $animateProvider.classNameFilter();
+ var isAnimatableClassName = !classNameFilter
+ ? function() { return true; }
+ : function(className) {
+ return classNameFilter.test(className);
+ };
+
+ var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+
+ function normalizeAnimationOptions(element, options) {
+ return mergeAnimationOptions(element, options, {});
+ }
+
+ function findCallbacks(element, event) {
+ var targetNode = getDomNode(element);
+
+ var matches = [];
+ var entries = callbackRegistry[event];
+ if (entries) {
+ forEach(entries, function(entry) {
+ if (entry.node.contains(targetNode)) {
+ matches.push(entry.callback);
+ }
+ });
+ }
+
+ return matches;
+ }
+
+ function triggerCallback(event, element, phase, data) {
+ $$rAF(function() {
+ forEach(findCallbacks(element, event), function(callback) {
+ callback(element, phase, data);
+ });
+ });
+ }
+
+ return {
+ on: function(event, container, callback) {
+ var node = extractElementNode(container);
+ callbackRegistry[event] = callbackRegistry[event] || [];
+ callbackRegistry[event].push({
+ node: node,
+ callback: callback
+ });
+ },
+
+ off: function(event, container, callback) {
+ var entries = callbackRegistry[event];
+ if (!entries) return;
+
+ callbackRegistry[event] = arguments.length === 1
+ ? null
+ : filterFromRegistry(entries, container, callback);
+
+ function filterFromRegistry(list, matchContainer, matchCallback) {
+ var containerNode = extractElementNode(matchContainer);
+ return list.filter(function(entry) {
+ var isMatch = entry.node === containerNode &&
+ (!matchCallback || entry.callback === matchCallback);
+ return !isMatch;
+ });
+ }
+ },
+
+ pin: function(element, parentElement) {
+ assertArg(isElement(element), 'element', 'not an element');
+ assertArg(isElement(parentElement), 'parentElement', 'not an element');
+ element.data(NG_ANIMATE_PIN_DATA, parentElement);
+ },
+
+ push: function(element, event, options, domOperation) {
+ options = options || {};
+ options.domOperation = domOperation;
+ return queueAnimation(element, event, options);
+ },
+
+ // this method has four signatures:
+ // () - global getter
+ // (bool) - global setter
+ // (element) - element getter
+ // (element, bool) - element setter<F37>
+ enabled: function(element, bool) {
+ var argCount = arguments.length;
+
+ if (argCount === 0) {
+ // () - Global getter
+ bool = !!animationsEnabled;
+ } else {
+ var hasElement = isElement(element);
+
+ if (!hasElement) {
+ // (bool) - Global setter
+ bool = animationsEnabled = !!element;
+ } else {
+ var node = getDomNode(element);
+ var recordExists = disabledElementsLookup.get(node);
+
+ if (argCount === 1) {
+ // (element) - Element getter
+ bool = !recordExists;
+ } else {
+ // (element, bool) - Element setter
+ bool = !!bool;
+ if (!bool) {
+ disabledElementsLookup.put(node, true);
+ } else if (recordExists) {
+ disabledElementsLookup.remove(node);
+ }
+ }
+ }
+ }
+
+ return bool;
+ }
+ };
+
+ function queueAnimation(element, event, options) {
+ var node, parent;
+ element = stripCommentsFromElement(element);
+ if (element) {
+ node = getDomNode(element);
+ parent = element.parent();
+ }
+
+ options = prepareAnimationOptions(options);
+
+ // we create a fake runner with a working promise.
+ // These methods will become available after the digest has passed
+ var runner = new $$AnimateRunner();
+
+ // there are situations where a directive issues an animation for
+ // a jqLite wrapper that contains only comment nodes... If this
+ // happens then there is no way we can perform an animation
+ if (!node) {
+ close();
+ return runner;
+ }
+
+ if (isArray(options.addClass)) {
+ options.addClass = options.addClass.join(' ');
+ }
+
+ if (isArray(options.removeClass)) {
+ options.removeClass = options.removeClass.join(' ');
+ }
+
+ if (options.from && !isObject(options.from)) {
+ options.from = null;
+ }
+
+ if (options.to && !isObject(options.to)) {
+ options.to = null;
+ }
+
+ var className = [node.className, options.addClass, options.removeClass].join(' ');
+ if (!isAnimatableClassName(className)) {
+ close();
+ return runner;
+ }
+
+ var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0;
+
+ // this is a hard disable of all animations for the application or on
+ // the element itself, therefore there is no need to continue further
+ // past this point if not enabled
+ var skipAnimations = !animationsEnabled || disabledElementsLookup.get(node);
+ var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {};
+ var hasExistingAnimation = !!existingAnimation.state;
+
+ // there is no point in traversing the same collection of parent ancestors if a followup
+ // animation will be run on the same element that already did all that checking work
+ if (!skipAnimations && (!hasExistingAnimation || existingAnimation.state != PRE_DIGEST_STATE)) {
+ skipAnimations = !areAnimationsAllowed(element, parent, event);
+ }
+
+ if (skipAnimations) {
+ close();
+ return runner;
+ }
+
+ if (isStructural) {
+ closeChildAnimations(element);
+ }
+
+ var newAnimation = {
+ structural: isStructural,
+ element: element,
+ event: event,
+ close: close,
+ options: options,
+ runner: runner
+ };
+
+ if (hasExistingAnimation) {
+ var skipAnimationFlag = isAllowed('skip', element, newAnimation, existingAnimation);
+ if (skipAnimationFlag) {
+ if (existingAnimation.state === RUNNING_STATE) {
+ close();
+ return runner;
+ } else {
+ mergeAnimationOptions(element, existingAnimation.options, options);
+ return existingAnimation.runner;
+ }
+ }
+
+ var cancelAnimationFlag = isAllowed('cancel', element, newAnimation, existingAnimation);
+ if (cancelAnimationFlag) {
+ if (existingAnimation.state === RUNNING_STATE) {
+ // this will end the animation right away and it is safe
+ // to do so since the animation is already running and the
+ // runner callback code will run in async
+ existingAnimation.runner.end();
+ } else if (existingAnimation.structural) {
+ // this means that the animation is queued into a digest, but
+ // hasn't started yet. Therefore it is safe to run the close
+ // method which will call the runner methods in async.
+ existingAnimation.close();
+ } else {
+ // this will merge the existing animation options into this new follow-up animation
+ mergeAnimationOptions(element, newAnimation.options, existingAnimation.options);
+ }
+ } else {
+ // a joined animation means that this animation will take over the existing one
+ // so an example would involve a leave animation taking over an enter. Then when
+ // the postDigest kicks in the enter will be ignored.
+ var joinAnimationFlag = isAllowed('join', element, newAnimation, existingAnimation);
+ if (joinAnimationFlag) {
+ if (existingAnimation.state === RUNNING_STATE) {
+ normalizeAnimationOptions(element, options);
+ } else {
+ event = newAnimation.event = existingAnimation.event;
+ options = mergeAnimationOptions(element, existingAnimation.options, newAnimation.options);
+ return runner;
+ }
+ }
+ }
+ } else {
+ // normalization in this case means that it removes redundant CSS classes that
+ // already exist (addClass) or do not exist (removeClass) on the element
+ normalizeAnimationOptions(element, options);
+ }
+
+ // when the options are merged and cleaned up we may end up not having to do
+ // an animation at all, therefore we should check this before issuing a post
+ // digest callback. Structural animations will always run no matter what.
+ var isValidAnimation = newAnimation.structural;
+ if (!isValidAnimation) {
+ // animate (from/to) can be quickly checked first, otherwise we check if any classes are present
+ isValidAnimation = (newAnimation.event === 'animate' && Object.keys(newAnimation.options.to || {}).length > 0)
+ || hasAnimationClasses(newAnimation.options);
+ }
+
+ if (!isValidAnimation) {
+ close();
+ clearElementAnimationState(element);
+ return runner;
+ }
+
+ if (isStructural) {
+ closeParentClassBasedAnimations(parent);
+ }
+
+ // the counter keeps track of cancelled animations
+ var counter = (existingAnimation.counter || 0) + 1;
+ newAnimation.counter = counter;
+
+ markElementAnimationState(element, PRE_DIGEST_STATE, newAnimation);
+
+ $rootScope.$$postDigest(function() {
+ var animationDetails = activeAnimationsLookup.get(node);
+ var animationCancelled = !animationDetails;
+ animationDetails = animationDetails || {};
+
+ // if addClass/removeClass is called before something like enter then the
+ // registered parent element may not be present. The code below will ensure
+ // that a final value for parent element is obtained
+ var parentElement = element.parent() || [];
+
+ // animate/structural/class-based animations all have requirements. Otherwise there
+ // is no point in performing an animation. The parent node must also be set.
+ var isValidAnimation = parentElement.length > 0
+ && (animationDetails.event === 'animate'
+ || animationDetails.structural
+ || hasAnimationClasses(animationDetails.options));
+
+ // this means that the previous animation was cancelled
+ // even if the follow-up animation is the same event
+ if (animationCancelled || animationDetails.counter !== counter || !isValidAnimation) {
+ // if another animation did not take over then we need
+ // to make sure that the domOperation and options are
+ // handled accordingly
+ if (animationCancelled) {
+ applyAnimationClasses(element, options);
+ applyAnimationStyles(element, options);
+ }
+
+ // if the event changed from something like enter to leave then we do
+ // it, otherwise if it's the same then the end result will be the same too
+ if (animationCancelled || (isStructural && animationDetails.event !== event)) {
+ options.domOperation();
+ runner.end();
+ }
+
+ // in the event that the element animation was not cancelled or a follow-up animation
+ // isn't allowed to animate from here then we need to clear the state of the element
+ // so that any future animations won't read the expired animation data.
+ if (!isValidAnimation) {
+ clearElementAnimationState(element);
+ }
+
+ return;
+ }
+
+ // this combined multiple class to addClass / removeClass into a setClass event
+ // so long as a structural event did not take over the animation
+ event = !animationDetails.structural && hasAnimationClasses(animationDetails.options, true)
+ ? 'setClass'
+ : animationDetails.event;
+
+ if (animationDetails.structural) {
+ closeParentClassBasedAnimations(parentElement);
+ }
+
+ markElementAnimationState(element, RUNNING_STATE);
+ var realRunner = $$animation(element, event, animationDetails.options);
+ realRunner.done(function(status) {
+ close(!status);
+ var animationDetails = activeAnimationsLookup.get(node);
+ if (animationDetails && animationDetails.counter === counter) {
+ clearElementAnimationState(getDomNode(element));
+ }
+ notifyProgress(runner, event, 'close', {});
+ });
+
+ // this will update the runner's flow-control events based on
+ // the `realRunner` object.
+ runner.setHost(realRunner);
+ notifyProgress(runner, event, 'start', {});
+ });
+
+ return runner;
+
+ function notifyProgress(runner, event, phase, data) {
+ triggerCallback(event, element, phase, data);
+ runner.progress(event, phase, data);
+ }
+
+ function close(reject) { // jshint ignore:line
+ applyAnimationClasses(element, options);
+ applyAnimationStyles(element, options);
+ options.domOperation();
+ runner.complete(!reject);
+ }
+ }
+
+ function closeChildAnimations(element) {
+ var node = getDomNode(element);
+ var children = node.querySelectorAll('[' + NG_ANIMATE_ATTR_NAME + ']');
+ forEach(children, function(child) {
+ var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME));
+ var animationDetails = activeAnimationsLookup.get(child);
+ switch (state) {
+ case RUNNING_STATE:
+ animationDetails.runner.end();
+ /* falls through */
+ case PRE_DIGEST_STATE:
+ if (animationDetails) {
+ activeAnimationsLookup.remove(child);
+ }
+ break;
+ }
+ });
+ }
+
+ function clearElementAnimationState(element) {
+ var node = getDomNode(element);
+ node.removeAttribute(NG_ANIMATE_ATTR_NAME);
+ activeAnimationsLookup.remove(node);
+ }
+
+ function isMatchingElement(nodeOrElmA, nodeOrElmB) {
+ return getDomNode(nodeOrElmA) === getDomNode(nodeOrElmB);
+ }
+
+ function closeParentClassBasedAnimations(startingElement) {
+ var parentNode = getDomNode(startingElement);
+ do {
+ if (!parentNode || parentNode.nodeType !== ELEMENT_NODE) break;
+
+ var animationDetails = activeAnimationsLookup.get(parentNode);
+ if (animationDetails) {
+ examineParentAnimation(parentNode, animationDetails);
+ }
+
+ parentNode = parentNode.parentNode;
+ } while (true);
+
+ // since animations are detected from CSS classes, we need to flush all parent
+ // class-based animations so that the parent classes are all present for child
+ // animations to properly function (otherwise any CSS selectors may not work)
+ function examineParentAnimation(node, animationDetails) {
+ // enter/leave/move always have priority
+ if (animationDetails.structural || !hasAnimationClasses(animationDetails.options)) return;
+
+ if (animationDetails.state === RUNNING_STATE) {
+ animationDetails.runner.end();
+ }
+ clearElementAnimationState(node);
+ }
+ }
+
+ function areAnimationsAllowed(element, parentElement, event) {
+ var bodyElementDetected = false;
+ var rootElementDetected = false;
+ var parentAnimationDetected = false;
+ var animateChildren;
+
+ var parentHost = element.data(NG_ANIMATE_PIN_DATA);
+ if (parentHost) {
+ parentElement = parentHost;
+ }
+
+ while (parentElement && parentElement.length) {
+ if (!rootElementDetected) {
+ // angular doesn't want to attempt to animate elements outside of the application
+ // therefore we need to ensure that the rootElement is an ancestor of the current element
+ rootElementDetected = isMatchingElement(parentElement, $rootElement);
+ }
+
+ var parentNode = parentElement[0];
+ if (parentNode.nodeType !== ELEMENT_NODE) {
+ // no point in inspecting the #document element
+ break;
+ }
+
+ var details = activeAnimationsLookup.get(parentNode) || {};
+ // either an enter, leave or move animation will commence
+ // therefore we can't allow any animations to take place
+ // but if a parent animation is class-based then that's ok
+ if (!parentAnimationDetected) {
+ parentAnimationDetected = details.structural || disabledElementsLookup.get(parentNode);
+ }
+
+ if (isUndefined(animateChildren) || animateChildren === true) {
+ var value = parentElement.data(NG_ANIMATE_CHILDREN_DATA);
+ if (isDefined(value)) {
+ animateChildren = value;
+ }
+ }
+
+ // there is no need to continue traversing at this point
+ if (parentAnimationDetected && animateChildren === false) break;
+
+ if (!rootElementDetected) {
+ // angular doesn't want to attempt to animate elements outside of the application
+ // therefore we need to ensure that the rootElement is an ancestor of the current element
+ rootElementDetected = isMatchingElement(parentElement, $rootElement);
+ if (!rootElementDetected) {
+ parentHost = parentElement.data(NG_ANIMATE_PIN_DATA);
+ if (parentHost) {
+ parentElement = parentHost;
+ }
+ }
+ }
+
+ if (!bodyElementDetected) {
+ // we also need to ensure that the element is or will be apart of the body element
+ // otherwise it is pointless to even issue an animation to be rendered
+ bodyElementDetected = isMatchingElement(parentElement, bodyElement);
+ }
+
+ parentElement = parentElement.parent();
+ }
+
+ var allowAnimation = !parentAnimationDetected || animateChildren;
+ return allowAnimation && rootElementDetected && bodyElementDetected;
+ }
+
+ function markElementAnimationState(element, state, details) {
+ details = details || {};
+ details.state = state;
+
+ var node = getDomNode(element);
+ node.setAttribute(NG_ANIMATE_ATTR_NAME, state);
+
+ var oldValue = activeAnimationsLookup.get(node);
+ var newValue = oldValue
+ ? extend(oldValue, details)
+ : details;
+ activeAnimationsLookup.put(node, newValue);
+ }
+ }];
+}];
+
+var $$rAFMutexFactory = ['$$rAF', function($$rAF) {
+ return function() {
+ var passed = false;
+ $$rAF(function() {
+ passed = true;
+ });
+ return function(fn) {
+ passed ? fn() : $$rAF(fn);
+ };
+ };
+}];
+
+var $$AnimateRunnerFactory = ['$q', '$$rAFMutex', function($q, $$rAFMutex) {
+ var INITIAL_STATE = 0;
+ var DONE_PENDING_STATE = 1;
+ var DONE_COMPLETE_STATE = 2;
+
+ AnimateRunner.chain = function(chain, callback) {
+ var index = 0;
+
+ next();
+ function next() {
+ if (index === chain.length) {
+ callback(true);
+ return;
+ }
+
+ chain[index](function(response) {
+ if (response === false) {
+ callback(false);
+ return;
+ }
+ index++;
+ next();
+ });
+ }
+ };
+
+ AnimateRunner.all = function(runners, callback) {
+ var count = 0;
+ var status = true;
+ forEach(runners, function(runner) {
+ runner.done(onProgress);
+ });
+
+ function onProgress(response) {
+ status = status && response;
+ if (++count === runners.length) {
+ callback(status);
+ }
+ }
+ };
+
+ function AnimateRunner(host) {
+ this.setHost(host);
+
+ this._doneCallbacks = [];
+ this._runInAnimationFrame = $$rAFMutex();
+ this._state = 0;
+ }
+
+ AnimateRunner.prototype = {
+ setHost: function(host) {
+ this.host = host || {};
+ },
+
+ done: function(fn) {
+ if (this._state === DONE_COMPLETE_STATE) {
+ fn();
+ } else {
+ this._doneCallbacks.push(fn);
+ }
+ },
+
+ progress: noop,
+
+ getPromise: function() {
+ if (!this.promise) {
+ var self = this;
+ this.promise = $q(function(resolve, reject) {
+ self.done(function(status) {
+ status === false ? reject() : resolve();
+ });
+ });
+ }
+ return this.promise;
+ },
+
+ then: function(resolveHandler, rejectHandler) {
+ return this.getPromise().then(resolveHandler, rejectHandler);
+ },
+
+ 'catch': function(handler) {
+ return this.getPromise()['catch'](handler);
+ },
+
+ 'finally': function(handler) {
+ return this.getPromise()['finally'](handler);
+ },
+
+ pause: function() {
+ if (this.host.pause) {
+ this.host.pause();
+ }
+ },
+
+ resume: function() {
+ if (this.host.resume) {
+ this.host.resume();
+ }
+ },
+
+ end: function() {
+ if (this.host.end) {
+ this.host.end();
+ }
+ this._resolve(true);
+ },
+
+ cancel: function() {
+ if (this.host.cancel) {
+ this.host.cancel();
+ }
+ this._resolve(false);
+ },
+
+ complete: function(response) {
+ var self = this;
+ if (self._state === INITIAL_STATE) {
+ self._state = DONE_PENDING_STATE;
+ self._runInAnimationFrame(function() {
+ self._resolve(response);
+ });
+ }
+ },
+
+ _resolve: function(response) {
+ if (this._state !== DONE_COMPLETE_STATE) {
+ forEach(this._doneCallbacks, function(fn) {
+ fn(response);
+ });
+ this._doneCallbacks.length = 0;
+ this._state = DONE_COMPLETE_STATE;
+ }
+ }
+ };
+
+ return AnimateRunner;
+}];
+
+var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
+ var NG_ANIMATE_REF_ATTR = 'ng-animate-ref';
+
+ var drivers = this.drivers = [];
+
+ var RUNNER_STORAGE_KEY = '$$animationRunner';
+
+ function setRunner(element, runner) {
+ element.data(RUNNER_STORAGE_KEY, runner);
+ }
+
+ function removeRunner(element) {
+ element.removeData(RUNNER_STORAGE_KEY);
+ }
+
+ function getRunner(element) {
+ return element.data(RUNNER_STORAGE_KEY);
+ }
+
+ this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner', '$$rAFScheduler',
+ function($$jqLite, $rootScope, $injector, $$AnimateRunner, $$rAFScheduler) {
+
+ var animationQueue = [];
+ var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+
+ var totalPendingClassBasedAnimations = 0;
+ var totalActiveClassBasedAnimations = 0;
+ var classBasedAnimationsQueue = [];
+
+ // TODO(matsko): document the signature in a better way
+ return function(element, event, options) {
+ options = prepareAnimationOptions(options);
+ var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0;
+
+ // there is no animation at the current moment, however
+ // these runner methods will get later updated with the
+ // methods leading into the driver's end/cancel methods
+ // for now they just stop the animation from starting
+ var runner = new $$AnimateRunner({
+ end: function() { close(); },
+ cancel: function() { close(true); }
+ });
+
+ if (!drivers.length) {
+ close();
+ return runner;
+ }
+
+ setRunner(element, runner);
+
+ var classes = mergeClasses(element.attr('class'), mergeClasses(options.addClass, options.removeClass));
+ var tempClasses = options.tempClasses;
+ if (tempClasses) {
+ classes += ' ' + tempClasses;
+ options.tempClasses = null;
+ }
+
+ var classBasedIndex;
+ if (!isStructural) {
+ classBasedIndex = totalPendingClassBasedAnimations;
+ totalPendingClassBasedAnimations += 1;
+ }
+
+ animationQueue.push({
+ // this data is used by the postDigest code and passed into
+ // the driver step function
+ element: element,
+ classes: classes,
+ event: event,
+ classBasedIndex: classBasedIndex,
+ structural: isStructural,
+ options: options,
+ beforeStart: beforeStart,
+ close: close
+ });
+
+ element.on('$destroy', handleDestroyedElement);
+
+ // we only want there to be one function called within the post digest
+ // block. This way we can group animations for all the animations that
+ // were apart of the same postDigest flush call.
+ if (animationQueue.length > 1) return runner;
+
+ $rootScope.$$postDigest(function() {
+ totalActiveClassBasedAnimations = totalPendingClassBasedAnimations;
+ totalPendingClassBasedAnimations = 0;
+ classBasedAnimationsQueue.length = 0;
+
+ var animations = [];
+ forEach(animationQueue, function(entry) {
+ // the element was destroyed early on which removed the runner
+ // form its storage. This means we can't animate this element
+ // at all and it already has been closed due to destruction.
+ if (getRunner(entry.element)) {
+ animations.push(entry);
+ }
+ });
+
+ // now any future animations will be in another postDigest
+ animationQueue.length = 0;
+
+ forEach(groupAnimations(animations), function(animationEntry) {
+ if (animationEntry.structural) {
+ triggerAnimationStart();
+ } else {
+ classBasedAnimationsQueue.push({
+ node: getDomNode(animationEntry.element),
+ fn: triggerAnimationStart
+ });
+
+ if (animationEntry.classBasedIndex === totalActiveClassBasedAnimations - 1) {
+ // we need to sort each of the animations in order of parent to child
+ // relationships. This ensures that the child classes are applied at the
+ // right time.
+ classBasedAnimationsQueue = classBasedAnimationsQueue.sort(function(a,b) {
+ return b.node.contains(a.node);
+ }).map(function(entry) {
+ return entry.fn;
+ });
+
+ $$rAFScheduler(classBasedAnimationsQueue);
+ }
+ }
+
+ function triggerAnimationStart() {
+ // it's important that we apply the `ng-animate` CSS class and the
+ // temporary classes before we do any driver invoking since these
+ // CSS classes may be required for proper CSS detection.
+ animationEntry.beforeStart();
+
+ var startAnimationFn, closeFn = animationEntry.close;
+
+ // in the event that the element was removed before the digest runs or
+ // during the RAF sequencing then we should not trigger the animation.
+ var targetElement = animationEntry.anchors
+ ? (animationEntry.from.element || animationEntry.to.element)
+ : animationEntry.element;
+
+ if (getRunner(targetElement) && getDomNode(targetElement).parentNode) {
+ var operation = invokeFirstDriver(animationEntry);
+ if (operation) {
+ startAnimationFn = operation.start;
+ }
+ }
+
+ if (!startAnimationFn) {
+ closeFn();
+ } else {
+ var animationRunner = startAnimationFn();
+ animationRunner.done(function(status) {
+ closeFn(!status);
+ });
+ updateAnimationRunners(animationEntry, animationRunner);
+ }
+ }
+ });
+ });
+
+ return runner;
+
+ // TODO(matsko): change to reference nodes
+ function getAnchorNodes(node) {
+ var SELECTOR = '[' + NG_ANIMATE_REF_ATTR + ']';
+ var items = node.hasAttribute(NG_ANIMATE_REF_ATTR)
+ ? [node]
+ : node.querySelectorAll(SELECTOR);
+ var anchors = [];
+ forEach(items, function(node) {
+ var attr = node.getAttribute(NG_ANIMATE_REF_ATTR);
+ if (attr && attr.length) {
+ anchors.push(node);
+ }
+ });
+ return anchors;
+ }
+
+ function groupAnimations(animations) {
+ var preparedAnimations = [];
+ var refLookup = {};
+ forEach(animations, function(animation, index) {
+ var element = animation.element;
+ var node = getDomNode(element);
+ var event = animation.event;
+ var enterOrMove = ['enter', 'move'].indexOf(event) >= 0;
+ var anchorNodes = animation.structural ? getAnchorNodes(node) : [];
+
+ if (anchorNodes.length) {
+ var direction = enterOrMove ? 'to' : 'from';
+
+ forEach(anchorNodes, function(anchor) {
+ var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR);
+ refLookup[key] = refLookup[key] || {};
+ refLookup[key][direction] = {
+ animationID: index,
+ element: jqLite(anchor)
+ };
+ });
+ } else {
+ preparedAnimations.push(animation);
+ }
+ });
+
+ var usedIndicesLookup = {};
+ var anchorGroups = {};
+ forEach(refLookup, function(operations, key) {
+ var from = operations.from;
+ var to = operations.to;
+
+ if (!from || !to) {
+ // only one of these is set therefore we can't have an
+ // anchor animation since all three pieces are required
+ var index = from ? from.animationID : to.animationID;
+ var indexKey = index.toString();
+ if (!usedIndicesLookup[indexKey]) {
+ usedIndicesLookup[indexKey] = true;
+ preparedAnimations.push(animations[index]);
+ }
+ return;
+ }
+
+ var fromAnimation = animations[from.animationID];
+ var toAnimation = animations[to.animationID];
+ var lookupKey = from.animationID.toString();
+ if (!anchorGroups[lookupKey]) {
+ var group = anchorGroups[lookupKey] = {
+ structural: true,
+ beforeStart: function() {
+ fromAnimation.beforeStart();
+ toAnimation.beforeStart();
+ },
+ close: function() {
+ fromAnimation.close();
+ toAnimation.close();
+ },
+ classes: cssClassesIntersection(fromAnimation.classes, toAnimation.classes),
+ from: fromAnimation,
+ to: toAnimation,
+ anchors: [] // TODO(matsko): change to reference nodes
+ };
+
+ // the anchor animations require that the from and to elements both have at least
+ // one shared CSS class which effictively marries the two elements together to use
+ // the same animation driver and to properly sequence the anchor animation.
+ if (group.classes.length) {
+ preparedAnimations.push(group);
+ } else {
+ preparedAnimations.push(fromAnimation);
+ preparedAnimations.push(toAnimation);
+ }
+ }
+
+ anchorGroups[lookupKey].anchors.push({
+ 'out': from.element, 'in': to.element
+ });
+ });
+
+ return preparedAnimations;
+ }
+
+ function cssClassesIntersection(a,b) {
+ a = a.split(' ');
+ b = b.split(' ');
+ var matches = [];
+
+ for (var i = 0; i < a.length; i++) {
+ var aa = a[i];
+ if (aa.substring(0,3) === 'ng-') continue;
+
+ for (var j = 0; j < b.length; j++) {
+ if (aa === b[j]) {
+ matches.push(aa);
+ break;
+ }
+ }
+ }
+
+ return matches.join(' ');
+ }
+
+ function invokeFirstDriver(animationDetails) {
+ // we loop in reverse order since the more general drivers (like CSS and JS)
+ // may attempt more elements, but custom drivers are more particular
+ for (var i = drivers.length - 1; i >= 0; i--) {
+ var driverName = drivers[i];
+ if (!$injector.has(driverName)) continue; // TODO(matsko): remove this check
+
+ var factory = $injector.get(driverName);
+ var driver = factory(animationDetails);
+ if (driver) {
+ return driver;
+ }
+ }
+ }
+
+ function beforeStart() {
+ element.addClass(NG_ANIMATE_CLASSNAME);
+ if (tempClasses) {
+ $$jqLite.addClass(element, tempClasses);
+ }
+ }
+
+ function updateAnimationRunners(animation, newRunner) {
+ if (animation.from && animation.to) {
+ update(animation.from.element);
+ update(animation.to.element);
+ } else {
+ update(animation.element);
+ }
+
+ function update(element) {
+ getRunner(element).setHost(newRunner);
+ }
+ }
+
+ function handleDestroyedElement() {
+ var runner = getRunner(element);
+ if (runner && (event !== 'leave' || !options.$$domOperationFired)) {
+ runner.end();
+ }
+ }
+
+ function close(rejected) { // jshint ignore:line
+ element.off('$destroy', handleDestroyedElement);
+ removeRunner(element);
+
+ applyAnimationClasses(element, options);
+ applyAnimationStyles(element, options);
+ options.domOperation();
+
+ if (tempClasses) {
+ $$jqLite.removeClass(element, tempClasses);
+ }
+
+ element.removeClass(NG_ANIMATE_CLASSNAME);
+ runner.complete(!rejected);
+ }
+ };
+ }];
+}];
+
+/* global angularAnimateModule: true,
+
+ $$rAFMutexFactory,
+ $$rAFSchedulerFactory,
+ $$AnimateChildrenDirective,
+ $$AnimateRunnerFactory,
+ $$AnimateQueueProvider,
+ $$AnimationProvider,
+ $AnimateCssProvider,
+ $$AnimateCssDriverProvider,
+ $$AnimateJsProvider,
+ $$AnimateJsDriverProvider,
+*/
+
+/**
+ * @ngdoc module
+ * @name ngAnimate
+ * @description
+ *
+ * The `ngAnimate` module provides support for CSS-based animations (keyframes and transitions) as well as JavaScript-based animations via
+ * callback hooks. Animations are not enabled by default, however, by including `ngAnimate` then the animation hooks are enabled for an Angular app.
+ *
+ * <div doc-module-components="ngAnimate"></div>
+ *
+ * # Usage
+ * Simply put, there are two ways to make use of animations when ngAnimate is used: by using **CSS** and **JavaScript**. The former works purely based
+ * using CSS (by using matching CSS selectors/styles) and the latter triggers animations that are registered via `module.animation()`. For
+ * both CSS and JS animations the sole requirement is to have a matching `CSS class` that exists both in the registered animation and within
+ * the HTML element that the animation will be triggered on.
+ *
+ * ## Directive Support
+ * The following directives are "animation aware":
+ *
+ * | Directive | Supported Animations |
+ * |----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
+ * | {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave and move |
+ * | {@link ngRoute.directive:ngView#animations ngView} | enter and leave |
+ * | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave |
+ * | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave |
+ * | {@link ng.directive:ngIf#animations ngIf} | enter and leave |
+ * | {@link ng.directive:ngClass#animations ngClass} | add and remove (the CSS class(es) present) |
+ * | {@link ng.directive:ngShow#animations ngShow} & {@link ng.directive:ngHide#animations ngHide} | add and remove (the ng-hide class value) |
+ * | {@link ng.directive:form#animation-hooks form} & {@link ng.directive:ngModel#animation-hooks ngModel} | add and remove (dirty, pristine, valid, invalid & all other validations) |
+ * | {@link module:ngMessages#animations ngMessages} | add and remove (ng-active & ng-inactive) |
+ * | {@link module:ngMessages#animations ngMessage} | enter and leave |
+ *
+ * (More information can be found by visiting each the documentation associated with each directive.)
+ *
+ * ## CSS-based Animations
+ *
+ * CSS-based animations with ngAnimate are unique since they require no JavaScript code at all. By using a CSS class that we reference between our HTML
+ * and CSS code we can create an animation that will be picked up by Angular when an the underlying directive performs an operation.
+ *
+ * The example below shows how an `enter` animation can be made possible on a element using `ng-if`:
+ *
+ * ```html
+ * <div ng-if="bool" class="fade">
+ * Fade me in out
+ * </div>
+ * <button ng-click="bool=true">Fade In!</button>
+ * <button ng-click="bool=false">Fade Out!</button>
+ * ```
+ *
+ * Notice the CSS class **fade**? We can now create the CSS transition code that references this class:
+ *
+ * ```css
+ * /&#42; The starting CSS styles for the enter animation &#42;/
+ * .fade.ng-enter {
+ * transition:0.5s linear all;
+ * opacity:0;
+ * }
+ *
+ * /&#42; The finishing CSS styles for the enter animation &#42;/
+ * .fade.ng-enter.ng-enter-active {
+ * opacity:1;
+ * }
+ * ```
+ *
+ * The key thing to remember here is that, depending on the animation event (which each of the directives above trigger depending on what's going on) two
+ * generated CSS classes will be applied to the element; in the example above we have `.ng-enter` and `.ng-enter-active`. For CSS transitions, the transition
+ * code **must** be defined within the starting CSS class (in this case `.ng-enter`). The destination class is what the transition will animate towards.
+ *
+ * If for example we wanted to create animations for `leave` and `move` (ngRepeat triggers move) then we can do so using the same CSS naming conventions:
+ *
+ * ```css
+ * /&#42; now the element will fade out before it is removed from the DOM &#42;/
+ * .fade.ng-leave {
+ * transition:0.5s linear all;
+ * opacity:1;
+ * }
+ * .fade.ng-leave.ng-leave-active {
+ * opacity:0;
+ * }
+ * ```
+ *
+ * We can also make use of **CSS Keyframes** by referencing the keyframe animation within the starting CSS class:
+ *
+ * ```css
+ * /&#42; there is no need to define anything inside of the destination
+ * CSS class since the keyframe will take charge of the animation &#42;/
+ * .fade.ng-leave {
+ * animation: my_fade_animation 0.5s linear;
+ * -webkit-animation: my_fade_animation 0.5s linear;
+ * }
+ *
+ * @keyframes my_fade_animation {
+ * from { opacity:1; }
+ * to { opacity:0; }
+ * }
+ *
+ * @-webkit-keyframes my_fade_animation {
+ * from { opacity:1; }
+ * to { opacity:0; }
+ * }
+ * ```
+ *
+ * Feel free also mix transitions and keyframes together as well as any other CSS classes on the same element.
+ *
+ * ### CSS Class-based Animations
+ *
+ * Class-based animations (animations that are triggered via `ngClass`, `ngShow`, `ngHide` and some other directives) have a slightly different
+ * naming convention. Class-based animations are basic enough that a standard transition or keyframe can be referenced on the class being added
+ * and removed.
+ *
+ * For example if we wanted to do a CSS animation for `ngHide` then we place an animation on the `.ng-hide` CSS class:
+ *
+ * ```html
+ * <div ng-show="bool" class="fade">
+ * Show and hide me
+ * </div>
+ * <button ng-click="bool=true">Toggle</button>
+ *
+ * <style>
+ * .fade.ng-hide {
+ * transition:0.5s linear all;
+ * opacity:0;
+ * }
+ * </style>
+ * ```
+ *
+ * All that is going on here with ngShow/ngHide behind the scenes is the `.ng-hide` class is added/removed (when the hidden state is valid). Since
+ * ngShow and ngHide are animation aware then we can match up a transition and ngAnimate handles the rest.
+ *
+ * In addition the addition and removal of the CSS class, ngAnimate also provides two helper methods that we can use to further decorate the animation
+ * with CSS styles.
+ *
+ * ```html
+ * <div ng-class="{on:onOff}" class="highlight">
+ * Highlight this box
+ * </div>
+ * <button ng-click="onOff=!onOff">Toggle</button>
+ *
+ * <style>
+ * .highlight {
+ * transition:0.5s linear all;
+ * }
+ * .highlight.on-add {
+ * background:white;
+ * }
+ * .highlight.on {
+ * background:yellow;
+ * }
+ * .highlight.on-remove {
+ * background:black;
+ * }
+ * </style>
+ * ```
+ *
+ * We can also make use of CSS keyframes by placing them within the CSS classes.
+ *
+ *
+ * ### CSS Staggering Animations
+ * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a
+ * curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be
+ * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for
+ * the animation. The style property expected within the stagger class can either be a **transition-delay** or an
+ * **animation-delay** property (or both if your animation contains both transitions and keyframe animations).
+ *
+ * ```css
+ * .my-animation.ng-enter {
+ * /&#42; standard transition code &#42;/
+ * transition: 1s linear all;
+ * opacity:0;
+ * }
+ * .my-animation.ng-enter-stagger {
+ * /&#42; this will have a 100ms delay between each successive leave animation &#42;/
+ * transition-delay: 0.1s;
+ *
+ * /&#42; in case the stagger doesn't work then the duration value
+ * must be set to 0 to avoid an accidental CSS inheritance &#42;/
+ * transition-duration: 0s;
+ * }
+ * .my-animation.ng-enter.ng-enter-active {
+ * /&#42; standard transition styles &#42;/
+ * opacity:1;
+ * }
+ * ```
+ *
+ * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations
+ * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this
+ * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation
+ * will also be reset if one or more animation frames have passed since the multiple calls to `$animate` were fired.
+ *
+ * The following code will issue the **ng-leave-stagger** event on the element provided:
+ *
+ * ```js
+ * var kids = parent.children();
+ *
+ * $animate.leave(kids[0]); //stagger index=0
+ * $animate.leave(kids[1]); //stagger index=1
+ * $animate.leave(kids[2]); //stagger index=2
+ * $animate.leave(kids[3]); //stagger index=3
+ * $animate.leave(kids[4]); //stagger index=4
+ *
+ * window.requestAnimationFrame(function() {
+ * //stagger has reset itself
+ * $animate.leave(kids[5]); //stagger index=0
+ * $animate.leave(kids[6]); //stagger index=1
+ *
+ * $scope.$digest();
+ * });
+ * ```
+ *
+ * Stagger animations are currently only supported within CSS-defined animations.
+ *
+ * ### The `ng-animate` CSS class
+ *
+ * When ngAnimate is animating an element it will apply the `ng-animate` CSS class to the element for the duration of the animation.
+ * This is a temporary CSS class and it will be removed once the animation is over (for both JavaScript and CSS-based animations).
+ *
+ * Therefore, animations can be applied to an element using this temporary class directly via CSS.
+ *
+ * ```css
+ * .zipper.ng-animate {
+ * transition:0.5s linear all;
+ * }
+ * .zipper.ng-enter {
+ * opacity:0;
+ * }
+ * .zipper.ng-enter.ng-enter-active {
+ * opacity:1;
+ * }
+ * .zipper.ng-leave {
+ * opacity:1;
+ * }
+ * .zipper.ng-leave.ng-leave-active {
+ * opacity:0;
+ * }
+ * ```
+ *
+ * (Note that the `ng-animate` CSS class is reserved and it cannot be applied on an element directly since ngAnimate will always remove
+ * the CSS class once an animation has completed.)
+ *
+ *
+ * ## JavaScript-based Animations
+ *
+ * ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared
+ * CSS class that is referenced in our HTML code) but in addition we need to register the JavaScript animation on the module. By making use of the
+ * `module.animation()` module function we can register the ainmation.
+ *
+ * Let's see an example of a enter/leave animation using `ngRepeat`:
+ *
+ * ```html
+ * <div ng-repeat="item in items" class="slide">
+ * {{ item }}
+ * </div>
+ * ```
+ *
+ * See the **slide** CSS class? Let's use that class to define an animation that we'll structure in our module code by using `module.animation`:
+ *
+ * ```js
+ * myModule.animation('.slide', [function() {
+ * return {
+ * // make note that other events (like addClass/removeClass)
+ * // have different function input parameters
+ * enter: function(element, doneFn) {
+ * jQuery(element).fadeIn(1000, doneFn);
+ *
+ * // remember to call doneFn so that angular
+ * // knows that the animation has concluded
+ * },
+ *
+ * move: function(element, doneFn) {
+ * jQuery(element).fadeIn(1000, doneFn);
+ * },
+ *
+ * leave: function(element, doneFn) {
+ * jQuery(element).fadeOut(1000, doneFn);
+ * }
+ * }
+ * }]
+ * ```
+ *
+ * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as
+ * greensock.js and velocity.js.
+ *
+ * If our animation code class-based (meaning that something like `ngClass`, `ngHide` and `ngShow` triggers it) then we can still define
+ * our animations inside of the same registered animation, however, the function input arguments are a bit different:
+ *
+ * ```html
+ * <div ng-class="color" class="colorful">
+ * this box is moody
+ * </div>
+ * <button ng-click="color='red'">Change to red</button>
+ * <button ng-click="color='blue'">Change to blue</button>
+ * <button ng-click="color='green'">Change to green</button>
+ * ```
+ *
+ * ```js
+ * myModule.animation('.colorful', [function() {
+ * return {
+ * addClass: function(element, className, doneFn) {
+ * // do some cool animation and call the doneFn
+ * },
+ * removeClass: function(element, className, doneFn) {
+ * // do some cool animation and call the doneFn
+ * },
+ * setClass: function(element, addedClass, removedClass, doneFn) {
+ * // do some cool animation and call the doneFn
+ * }
+ * }
+ * }]
+ * ```
+ *
+ * ## CSS + JS Animations Together
+ *
+ * AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of Angular,
+ * defining CSS and JS animations to work off of the same CSS class will not work anymore. Therefore the example below will only result in **JS animations taking
+ * charge of the animation**:
+ *
+ * ```html
+ * <div ng-if="bool" class="slide">
+ * Slide in and out
+ * </div>
+ * ```
+ *
+ * ```js
+ * myModule.animation('.slide', [function() {
+ * return {
+ * enter: function(element, doneFn) {
+ * jQuery(element).slideIn(1000, doneFn);
+ * }
+ * }
+ * }]
+ * ```
+ *
+ * ```css
+ * .slide.ng-enter {
+ * transition:0.5s linear all;
+ * transform:translateY(-100px);
+ * }
+ * .slide.ng-enter.ng-enter-active {
+ * transform:translateY(0);
+ * }
+ * ```
+ *
+ * Does this mean that CSS and JS animations cannot be used together? Do JS-based animations always have higher priority? We can make up for the
+ * lack of CSS animations by using the `$animateCss` service to trigger our own tweaked-out, CSS-based animations directly from
+ * our own JS-based animation code:
+ *
+ * ```js
+ * myModule.animation('.slide', ['$animateCss', function($animateCss) {
+ * return {
+ * enter: function(element, doneFn) {
+* // this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`.
+ * var runner = $animateCss(element, {
+ * event: 'enter',
+ * structural: true
+ * }).start();
+* runner.done(doneFn);
+ * }
+ * }
+ * }]
+ * ```
+ *
+ * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework.
+ *
+ * The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or
+ * keyframe animation. For example if we wanted to animate the height of an element while adding and removing classes then we can do so by providing that
+ * data into `$animateCss` directly:
+ *
+ * ```js
+ * myModule.animation('.slide', ['$animateCss', function($animateCss) {
+ * return {
+ * enter: function(element, doneFn) {
+ * var runner = $animateCss(element, {
+ * event: 'enter',
+ * addClass: 'maroon-setting',
+ * from: { height:0 },
+ * to: { height: 200 }
+ * }).start();
+ *
+ * runner.done(doneFn);
+ * }
+ * }
+ * }]
+ * ```
+ *
+ * Now we can fill in the rest via our transition CSS code:
+ *
+ * ```css
+ * /&#42; the transition tells ngAnimate to make the animation happen &#42;/
+ * .slide.ng-enter { transition:0.5s linear all; }
+ *
+ * /&#42; this extra CSS class will be absorbed into the transition
+ * since the $animateCss code is adding the class &#42;/
+ * .maroon-setting { background:red; }
+ * ```
+ *
+ * And `$animateCss` will figure out the rest. Just make sure to have the `done()` callback fire the `doneFn` function to signal when the animation is over.
+ *
+ * To learn more about what's possible be sure to visit the {@link ngAnimate.$animateCss $animateCss service}.
+ *
+ * ## Animation Anchoring (via `ng-animate-ref`)
+ *
+ * ngAnimate in AngularJS 1.4 comes packed with the ability to cross-animate elements between
+ * structural areas of an application (like views) by pairing up elements using an attribute
+ * called `ng-animate-ref`.
+ *
+ * Let's say for example we have two views that are managed by `ng-view` and we want to show
+ * that there is a relationship between two components situated in within these views. By using the
+ * `ng-animate-ref` attribute we can identify that the two components are paired together and we
+ * can then attach an animation, which is triggered when the view changes.
+ *
+ * Say for example we have the following template code:
+ *
+ * ```html
+ * <!-- index.html -->
+ * <div ng-view class="view-animation">
+ * </div>
+ *
+ * <!-- home.html -->
+ * <a href="#/banner-page">
+ * <img src="./banner.jpg" class="banner" ng-animate-ref="banner">
+ * </a>
+ *
+ * <!-- banner-page.html -->
+ * <img src="./banner.jpg" class="banner" ng-animate-ref="banner">
+ * ```
+ *
+ * Now, when the view changes (once the link is clicked), ngAnimate will examine the
+ * HTML contents to see if there is a match reference between any components in the view
+ * that is leaving and the view that is entering. It will scan both the view which is being
+ * removed (leave) and inserted (enter) to see if there are any paired DOM elements that
+ * contain a matching ref value.
+ *
+ * The two images match since they share the same ref value. ngAnimate will now create a
+ * transport element (which is a clone of the first image element) and it will then attempt
+ * to animate to the position of the second image element in the next view. For the animation to
+ * work a special CSS class called `ng-anchor` will be added to the transported element.
+ *
+ * We can now attach a transition onto the `.banner.ng-anchor` CSS class and then
+ * ngAnimate will handle the entire transition for us as well as the addition and removal of
+ * any changes of CSS classes between the elements:
+ *
+ * ```css
+ * .banner.ng-anchor {
+ * /&#42; this animation will last for 1 second since there are
+ * two phases to the animation (an `in` and an `out` phase) &#42;/
+ * transition:0.5s linear all;
+ * }
+ * ```
+ *
+ * We also **must** include animations for the views that are being entered and removed
+ * (otherwise anchoring wouldn't be possible since the new view would be inserted right away).
+ *
+ * ```css
+ * .view-animation.ng-enter, .view-animation.ng-leave {
+ * transition:0.5s linear all;
+ * position:fixed;
+ * left:0;
+ * top:0;
+ * width:100%;
+ * }
+ * .view-animation.ng-enter {
+ * transform:translateX(100%);
+ * }
+ * .view-animation.ng-leave,
+ * .view-animation.ng-enter.ng-enter-active {
+ * transform:translateX(0%);
+ * }
+ * .view-animation.ng-leave.ng-leave-active {
+ * transform:translateX(-100%);
+ * }
+ * ```
+ *
+ * Now we can jump back to the anchor animation. When the animation happens, there are two stages that occur:
+ * an `out` and an `in` stage. The `out` stage happens first and that is when the element is animated away
+ * from its origin. Once that animation is over then the `in` stage occurs which animates the
+ * element to its destination. The reason why there are two animations is to give enough time
+ * for the enter animation on the new element to be ready.
+ *
+ * The example above sets up a transition for both the in and out phases, but we can also target the out or
+ * in phases directly via `ng-anchor-out` and `ng-anchor-in`.
+ *
+ * ```css
+ * .banner.ng-anchor-out {
+ * transition: 0.5s linear all;
+ *
+ * /&#42; the scale will be applied during the out animation,
+ * but will be animated away when the in animation runs &#42;/
+ * transform: scale(1.2);
+ * }
+ *
+ * .banner.ng-anchor-in {
+ * transition: 1s linear all;
+ * }
+ * ```
+ *
+ *
+ *
+ *
+ * ### Anchoring Demo
+ *
+ <example module="anchoringExample"
+ name="anchoringExample"
+ id="anchoringExample"
+ deps="angular-animate.js;angular-route.js"
+ animations="true">
+ <file name="index.html">
+ <a href="#/">Home</a>
+ <hr />
+ <div class="view-container">
+ <div ng-view class="view"></div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('anchoringExample', ['ngAnimate', 'ngRoute'])
+ .config(['$routeProvider', function($routeProvider) {
+ $routeProvider.when('/', {
+ templateUrl: 'home.html',
+ controller: 'HomeController as home'
+ });
+ $routeProvider.when('/profile/:id', {
+ templateUrl: 'profile.html',
+ controller: 'ProfileController as profile'
+ });
+ }])
+ .run(['$rootScope', function($rootScope) {
+ $rootScope.records = [
+ { id:1, title: "Miss Beulah Roob" },
+ { id:2, title: "Trent Morissette" },
+ { id:3, title: "Miss Ava Pouros" },
+ { id:4, title: "Rod Pouros" },
+ { id:5, title: "Abdul Rice" },
+ { id:6, title: "Laurie Rutherford Sr." },
+ { id:7, title: "Nakia McLaughlin" },
+ { id:8, title: "Jordon Blanda DVM" },
+ { id:9, title: "Rhoda Hand" },
+ { id:10, title: "Alexandrea Sauer" }
+ ];
+ }])
+ .controller('HomeController', [function() {
+ //empty
+ }])
+ .controller('ProfileController', ['$rootScope', '$routeParams', function($rootScope, $routeParams) {
+ var index = parseInt($routeParams.id, 10);
+ var record = $rootScope.records[index - 1];
+
+ this.title = record.title;
+ this.id = record.id;
+ }]);
+ </file>
+ <file name="home.html">
+ <h2>Welcome to the home page</h1>
+ <p>Please click on an element</p>
+ <a class="record"
+ ng-href="#/profile/{{ record.id }}"
+ ng-animate-ref="{{ record.id }}"
+ ng-repeat="record in records">
+ {{ record.title }}
+ </a>
+ </file>
+ <file name="profile.html">
+ <div class="profile record" ng-animate-ref="{{ profile.id }}">
+ {{ profile.title }}
+ </div>
+ </file>
+ <file name="animations.css">
+ .record {
+ display:block;
+ font-size:20px;
+ }
+ .profile {
+ background:black;
+ color:white;
+ font-size:100px;
+ }
+ .view-container {
+ position:relative;
+ }
+ .view-container > .view.ng-animate {
+ position:absolute;
+ top:0;
+ left:0;
+ width:100%;
+ min-height:500px;
+ }
+ .view.ng-enter, .view.ng-leave,
+ .record.ng-anchor {
+ transition:0.5s linear all;
+ }
+ .view.ng-enter {
+ transform:translateX(100%);
+ }
+ .view.ng-enter.ng-enter-active, .view.ng-leave {
+ transform:translateX(0%);
+ }
+ .view.ng-leave.ng-leave-active {
+ transform:translateX(-100%);
+ }
+ .record.ng-anchor-out {
+ background:red;
+ }
+ </file>
+ </example>
+ *
+ * ### How is the element transported?
+ *
+ * When an anchor animation occurs, ngAnimate will clone the starting element and position it exactly where the starting
+ * element is located on screen via absolute positioning. The cloned element will be placed inside of the root element
+ * of the application (where ng-app was defined) and all of the CSS classes of the starting element will be applied. The
+ * element will then animate into the `out` and `in` animations and will eventually reach the coordinates and match
+ * the dimensions of the destination element. During the entire animation a CSS class of `.ng-animate-shim` will be applied
+ * to both the starting and destination elements in order to hide them from being visible (the CSS styling for the class
+ * is: `visibility:hidden`). Once the anchor reaches its destination then it will be removed and the destination element
+ * will become visible since the shim class will be removed.
+ *
+ * ### How is the morphing handled?
+ *
+ * CSS Anchoring relies on transitions and keyframes and the internal code is intelligent enough to figure out
+ * what CSS classes differ between the starting element and the destination element. These different CSS classes
+ * will be added/removed on the anchor element and a transition will be applied (the transition that is provided
+ * in the anchor class). Long story short, ngAnimate will figure out what classes to add and remove which will
+ * make the transition of the element as smooth and automatic as possible. Be sure to use simple CSS classes that
+ * do not rely on DOM nesting structure so that the anchor element appears the same as the starting element (since
+ * the cloned element is placed inside of root element which is likely close to the body element).
+ *
+ * Note that if the root element is on the `<html>` element then the cloned node will be placed inside of body.
+ *
+ *
+ * ## Using $animate in your directive code
+ *
+ * So far we've explored how to feed in animations into an Angular application, but how do we trigger animations within our own directives in our application?
+ * By injecting the `$animate` service into our directive code, we can trigger structural and class-based hooks which can then be consumed by animations. Let's
+ * imagine we have a greeting box that shows and hides itself when the data changes
+ *
+ * ```html
+ * <greeting-box active="onOrOff">Hi there</greeting-box>
+ * ```
+ *
+ * ```js
+ * ngModule.directive('greetingBox', ['$animate', function($animate) {
+ * return function(scope, element, attrs) {
+ * attrs.$observe('active', function(value) {
+ * value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on');
+ * });
+ * });
+ * }]);
+ * ```
+ *
+ * Now the `on` CSS class is added and removed on the greeting box component. Now if we add a CSS class on top of the greeting box element
+ * in our HTML code then we can trigger a CSS or JS animation to happen.
+ *
+ * ```css
+ * /&#42; normally we would create a CSS class to reference on the element &#42;/
+ * greeting-box.on { transition:0.5s linear all; background:green; color:white; }
+ * ```
+ *
+ * The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's
+ * possible be sure to visit the {@link ng.$animate $animate service API page}.
+ *
+ *
+ * ### Preventing Collisions With Third Party Libraries
+ *
+ * Some third-party frameworks place animation duration defaults across many element or className
+ * selectors in order to make their code small and reuseable. This can lead to issues with ngAnimate, which
+ * is expecting actual animations on these elements and has to wait for their completion.
+ *
+ * You can prevent this unwanted behavior by using a prefix on all your animation classes:
+ *
+ * ```css
+ * /&#42; prefixed with animate- &#42;/
+ * .animate-fade-add.animate-fade-add-active {
+ * transition:1s linear all;
+ * opacity:0;
+ * }
+ * ```
+ *
+ * You then configure `$animate` to enforce this prefix:
+ *
+ * ```js
+ * $animateProvider.classNameFilter(/animate-/);
+ * ```
+ *
+ * This also may provide your application with a speed boost since only specific elements containing CSS class prefix
+ * will be evaluated for animation when any DOM changes occur in the application.
+ *
+ * ## Callbacks and Promises
+ *
+ * When `$animate` is called it returns a promise that can be used to capture when the animation has ended. Therefore if we were to trigger
+ * an animation (within our directive code) then we can continue performing directive and scope related activities after the animation has
+ * ended by chaining onto the returned promise that animation method returns.
+ *
+ * ```js
+ * // somewhere within the depths of the directive
+ * $animate.enter(element, parent).then(function() {
+ * //the animation has completed
+ * });
+ * ```
+ *
+ * (Note that earlier versions of Angular prior to v1.4 required the promise code to be wrapped using `$scope.$apply(...)`. This is not the case
+ * anymore.)
+ *
+ * In addition to the animation promise, we can also make use of animation-related callbacks within our directives and controller code by registering
+ * an event listener using the `$animate` service. Let's say for example that an animation was triggered on our view
+ * routing controller to hook into that:
+ *
+ * ```js
+ * ngModule.controller('HomePageController', ['$animate', function($animate) {
+ * $animate.on('enter', ngViewElement, function(element) {
+ * // the animation for this route has completed
+ * }]);
+ * }])
+ * ```
+ *
+ * (Note that you will need to trigger a digest within the callback to get angular to notice any scope-related changes.)
+ */
+
+/**
+ * @ngdoc service
+ * @name $animate
+ * @kind object
+ *
+ * @description
+ * The ngAnimate `$animate` service documentation is the same for the core `$animate` service.
+ *
+ * Click here {@link ng.$animate $animate to learn more about animations with `$animate`}.
+ */
+angular.module('ngAnimate', [])
+ .directive('ngAnimateChildren', $$AnimateChildrenDirective)
+
+ .factory('$$rAFMutex', $$rAFMutexFactory)
+ .factory('$$rAFScheduler', $$rAFSchedulerFactory)
+
+ .factory('$$AnimateRunner', $$AnimateRunnerFactory)
+
+ .provider('$$animateQueue', $$AnimateQueueProvider)
+ .provider('$$animation', $$AnimationProvider)
+
+ .provider('$animateCss', $AnimateCssProvider)
+ .provider('$$animateCssDriver', $$AnimateCssDriverProvider)
+
+ .provider('$$animateJs', $$AnimateJsProvider)
+ .provider('$$animateJsDriver', $$AnimateJsDriverProvider);
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-cookies.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-cookies.js
new file mode 100644
index 00000000..c50d54c5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-cookies.js
@@ -0,0 +1,206 @@
+/**
+ * @license AngularJS v1.2.25
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+/**
+ * @ngdoc module
+ * @name ngCookies
+ * @description
+ *
+ * # ngCookies
+ *
+ * The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies.
+ *
+ *
+ * <div doc-module-components="ngCookies"></div>
+ *
+ * See {@link ngCookies.$cookies `$cookies`} and
+ * {@link ngCookies.$cookieStore `$cookieStore`} for usage.
+ */
+
+
+angular.module('ngCookies', ['ng']).
+ /**
+ * @ngdoc service
+ * @name $cookies
+ *
+ * @description
+ * Provides read/write access to browser's cookies.
+ *
+ * Only a simple Object is exposed and by adding or removing properties to/from this object, new
+ * cookies are created/deleted at the end of current $eval.
+ * The object's properties can only be strings.
+ *
+ * Requires the {@link ngCookies `ngCookies`} module to be installed.
+ *
+ * @example
+ *
+ * ```js
+ * angular.module('cookiesExample', ['ngCookies'])
+ * .controller('ExampleController', ['$cookies', function($cookies) {
+ * // Retrieving a cookie
+ * var favoriteCookie = $cookies.myFavorite;
+ * // Setting a cookie
+ * $cookies.myFavorite = 'oatmeal';
+ * }]);
+ * ```
+ */
+ factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) {
+ var cookies = {},
+ lastCookies = {},
+ lastBrowserCookies,
+ runEval = false,
+ copy = angular.copy,
+ isUndefined = angular.isUndefined;
+
+ //creates a poller fn that copies all cookies from the $browser to service & inits the service
+ $browser.addPollFn(function() {
+ var currentCookies = $browser.cookies();
+ if (lastBrowserCookies != currentCookies) { //relies on browser.cookies() impl
+ lastBrowserCookies = currentCookies;
+ copy(currentCookies, lastCookies);
+ copy(currentCookies, cookies);
+ if (runEval) $rootScope.$apply();
+ }
+ })();
+
+ runEval = true;
+
+ //at the end of each eval, push cookies
+ //TODO: this should happen before the "delayed" watches fire, because if some cookies are not
+ // strings or browser refuses to store some cookies, we update the model in the push fn.
+ $rootScope.$watch(push);
+
+ return cookies;
+
+
+ /**
+ * Pushes all the cookies from the service to the browser and verifies if all cookies were
+ * stored.
+ */
+ function push() {
+ var name,
+ value,
+ browserCookies,
+ updated;
+
+ //delete any cookies deleted in $cookies
+ for (name in lastCookies) {
+ if (isUndefined(cookies[name])) {
+ $browser.cookies(name, undefined);
+ }
+ }
+
+ //update all cookies updated in $cookies
+ for(name in cookies) {
+ value = cookies[name];
+ if (!angular.isString(value)) {
+ value = '' + value;
+ cookies[name] = value;
+ }
+ if (value !== lastCookies[name]) {
+ $browser.cookies(name, value);
+ updated = true;
+ }
+ }
+
+ //verify what was actually stored
+ if (updated){
+ updated = false;
+ browserCookies = $browser.cookies();
+
+ for (name in cookies) {
+ if (cookies[name] !== browserCookies[name]) {
+ //delete or reset all cookies that the browser dropped from $cookies
+ if (isUndefined(browserCookies[name])) {
+ delete cookies[name];
+ } else {
+ cookies[name] = browserCookies[name];
+ }
+ updated = true;
+ }
+ }
+ }
+ }
+ }]).
+
+
+ /**
+ * @ngdoc service
+ * @name $cookieStore
+ * @requires $cookies
+ *
+ * @description
+ * Provides a key-value (string-object) storage, that is backed by session cookies.
+ * Objects put or retrieved from this storage are automatically serialized or
+ * deserialized by angular's toJson/fromJson.
+ *
+ * Requires the {@link ngCookies `ngCookies`} module to be installed.
+ *
+ * @example
+ *
+ * ```js
+ * angular.module('cookieStoreExample', ['ngCookies'])
+ * .controller('ExampleController', ['$cookieStore', function($cookieStore) {
+ * // Put cookie
+ * $cookieStore.put('myFavorite','oatmeal');
+ * // Get cookie
+ * var favoriteCookie = $cookieStore.get('myFavorite');
+ * // Removing a cookie
+ * $cookieStore.remove('myFavorite');
+ * }]);
+ * ```
+ */
+ factory('$cookieStore', ['$cookies', function($cookies) {
+
+ return {
+ /**
+ * @ngdoc method
+ * @name $cookieStore#get
+ *
+ * @description
+ * Returns the value of given cookie key
+ *
+ * @param {string} key Id to use for lookup.
+ * @returns {Object} Deserialized cookie value.
+ */
+ get: function(key) {
+ var value = $cookies[key];
+ return value ? angular.fromJson(value) : value;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $cookieStore#put
+ *
+ * @description
+ * Sets a value for given cookie key
+ *
+ * @param {string} key Id for the `value`.
+ * @param {Object} value Value to be stored.
+ */
+ put: function(key, value) {
+ $cookies[key] = angular.toJson(value);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $cookieStore#remove
+ *
+ * @description
+ * Remove given cookie
+ *
+ * @param {string} key Id of the key-value pair to delete.
+ */
+ remove: function(key) {
+ delete $cookies[key];
+ }
+ };
+
+ }]);
+
+
+})(window, window.angular); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-route.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-route.js
new file mode 100644
index 00000000..dbe6eca1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-route.js
@@ -0,0 +1,911 @@
+/**
+ * @license AngularJS v1.2.5
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+/**
+ * @ngdoc overview
+ * @name ngRoute
+ * @description
+ *
+ * # ngRoute
+ *
+ * The `ngRoute` module provides routing and deeplinking services and directives for angular apps.
+ *
+ * ## Example
+ * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
+ *
+ * {@installModule route}
+ *
+ * <div doc-module-components="ngRoute"></div>
+ */
+ /* global -ngRouteModule */
+var ngRouteModule = angular.module('ngRoute', ['ng']).
+ provider('$route', $RouteProvider);
+
+/**
+ * @ngdoc object
+ * @name ngRoute.$routeProvider
+ * @function
+ *
+ * @description
+ *
+ * Used for configuring routes.
+ *
+ * ## Example
+ * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
+ *
+ * ## Dependencies
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
+ */
+function $RouteProvider(){
+ function inherit(parent, extra) {
+ return angular.extend(new (angular.extend(function() {}, {prototype:parent}))(), extra);
+ }
+
+ var routes = {};
+
+ /**
+ * @ngdoc method
+ * @name ngRoute.$routeProvider#when
+ * @methodOf ngRoute.$routeProvider
+ *
+ * @param {string} path Route path (matched against `$location.path`). If `$location.path`
+ * contains redundant trailing slash or is missing one, the route will still match and the
+ * `$location.path` will be updated to add or drop the trailing slash to exactly match the
+ * route definition.
+ *
+ * * `path` can contain named groups starting with a colon: e.g. `:name`. All characters up
+ * to the next slash are matched and stored in `$routeParams` under the given `name`
+ * when the route matches.
+ * * `path` can contain named groups starting with a colon and ending with a star:
+ * e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name`
+ * when the route matches.
+ * * `path` can contain optional named groups with a question mark: e.g.`:name?`.
+ *
+ * For example, routes like `/color/:color/largecode/:largecode*\/edit` will match
+ * `/color/brown/largecode/code/with/slashs/edit` and extract:
+ *
+ * * `color: brown`
+ * * `largecode: code/with/slashs`.
+ *
+ *
+ * @param {Object} route Mapping information to be assigned to `$route.current` on route
+ * match.
+ *
+ * Object properties:
+ *
+ * - `controller` – `{(string|function()=}` – Controller fn that should be associated with
+ * newly created scope or the name of a {@link angular.Module#controller registered
+ * controller} if passed as a string.
+ * - `controllerAs` – `{string=}` – A controller alias name. If present the controller will be
+ * published to scope under the `controllerAs` name.
+ * - `template` – `{string=|function()=}` – html template as a string or a function that
+ * returns an html template as a string which should be used by {@link
+ * ngRoute.directive:ngView ngView} or {@link ng.directive:ngInclude ngInclude} directives.
+ * This property takes precedence over `templateUrl`.
+ *
+ * If `template` is a function, it will be called with the following parameters:
+ *
+ * - `{Array.<Object>}` - route parameters extracted from the current
+ * `$location.path()` by applying the current route
+ *
+ * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
+ * template that should be used by {@link ngRoute.directive:ngView ngView}.
+ *
+ * If `templateUrl` is a function, it will be called with the following parameters:
+ *
+ * - `{Array.<Object>}` - route parameters extracted from the current
+ * `$location.path()` by applying the current route
+ *
+ * - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
+ * be injected into the controller. If any of these dependencies are promises, the router
+ * will wait for them all to be resolved or one to be rejected before the controller is
+ * instantiated.
+ * If all the promises are resolved successfully, the values of the resolved promises are
+ * injected and {@link ngRoute.$route#$routeChangeSuccess $routeChangeSuccess} event is
+ * fired. If any of the promises are rejected the
+ * {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired. The map object
+ * is:
+ *
+ * - `key` – `{string}`: a name of a dependency to be injected into the controller.
+ * - `factory` - `{string|function}`: If `string` then it is an alias for a service.
+ * Otherwise if function, then it is {@link api/AUTO.$injector#invoke injected}
+ * and the return value is treated as the dependency. If the result is a promise, it is
+ * resolved before its value is injected into the controller. Be aware that
+ * `ngRoute.$routeParams` will still refer to the previous route within these resolve
+ * functions. Use `$route.current.params` to access the new route parameters, instead.
+ *
+ * - `redirectTo` – {(string|function())=} – value to update
+ * {@link ng.$location $location} path with and trigger route redirection.
+ *
+ * If `redirectTo` is a function, it will be called with the following parameters:
+ *
+ * - `{Object.<string>}` - route parameters extracted from the current
+ * `$location.path()` by applying the current route templateUrl.
+ * - `{string}` - current `$location.path()`
+ * - `{Object}` - current `$location.search()`
+ *
+ * The custom `redirectTo` function is expected to return a string which will be used
+ * to update `$location.path()` and `$location.search()`.
+ *
+ * - `[reloadOnSearch=true]` - {boolean=} - reload route when only `$location.search()`
+ * or `$location.hash()` changes.
+ *
+ * If the option is set to `false` and url in the browser changes, then
+ * `$routeUpdate` event is broadcasted on the root scope.
+ *
+ * - `[caseInsensitiveMatch=false]` - {boolean=} - match routes without being case sensitive
+ *
+ * If the option is set to `true`, then the particular route can be matched without being
+ * case sensitive
+ *
+ * @returns {Object} self
+ *
+ * @description
+ * Adds a new route definition to the `$route` service.
+ */
+ this.when = function(path, route) {
+ routes[path] = angular.extend(
+ {reloadOnSearch: true},
+ route,
+ path && pathRegExp(path, route)
+ );
+
+ // create redirection for trailing slashes
+ if (path) {
+ var redirectPath = (path[path.length-1] == '/')
+ ? path.substr(0, path.length-1)
+ : path +'/';
+
+ routes[redirectPath] = angular.extend(
+ {redirectTo: path},
+ pathRegExp(redirectPath, route)
+ );
+ }
+
+ return this;
+ };
+
+ /**
+ * @param path {string} path
+ * @param opts {Object} options
+ * @return {?Object}
+ *
+ * @description
+ * Normalizes the given path, returning a regular expression
+ * and the original path.
+ *
+ * Inspired by pathRexp in visionmedia/express/lib/utils.js.
+ */
+ function pathRegExp(path, opts) {
+ var insensitive = opts.caseInsensitiveMatch,
+ ret = {
+ originalPath: path,
+ regexp: path
+ },
+ keys = ret.keys = [];
+
+ path = path
+ .replace(/([().])/g, '\\$1')
+ .replace(/(\/)?:(\w+)([\?|\*])?/g, function(_, slash, key, option){
+ var optional = option === '?' ? option : null;
+ var star = option === '*' ? option : null;
+ keys.push({ name: key, optional: !!optional });
+ slash = slash || '';
+ return ''
+ + (optional ? '' : slash)
+ + '(?:'
+ + (optional ? slash : '')
+ + (star && '(.+?)' || '([^/]+)')
+ + (optional || '')
+ + ')'
+ + (optional || '');
+ })
+ .replace(/([\/$\*])/g, '\\$1');
+
+ ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : '');
+ return ret;
+ }
+
+ /**
+ * @ngdoc method
+ * @name ngRoute.$routeProvider#otherwise
+ * @methodOf ngRoute.$routeProvider
+ *
+ * @description
+ * Sets route definition that will be used on route change when no other route definition
+ * is matched.
+ *
+ * @param {Object} params Mapping information to be assigned to `$route.current`.
+ * @returns {Object} self
+ */
+ this.otherwise = function(params) {
+ this.when(null, params);
+ return this;
+ };
+
+
+ this.$get = ['$rootScope',
+ '$location',
+ '$routeParams',
+ '$q',
+ '$injector',
+ '$http',
+ '$templateCache',
+ '$sce',
+ function($rootScope, $location, $routeParams, $q, $injector, $http, $templateCache, $sce) {
+
+ /**
+ * @ngdoc object
+ * @name ngRoute.$route
+ * @requires $location
+ * @requires $routeParams
+ *
+ * @property {Object} current Reference to the current route definition.
+ * The route definition contains:
+ *
+ * - `controller`: The controller constructor as define in route definition.
+ * - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for
+ * controller instantiation. The `locals` contain
+ * the resolved values of the `resolve` map. Additionally the `locals` also contain:
+ *
+ * - `$scope` - The current route scope.
+ * - `$template` - The current route template HTML.
+ *
+ * @property {Array.<Object>} routes Array of all configured routes.
+ *
+ * @description
+ * `$route` is used for deep-linking URLs to controllers and views (HTML partials).
+ * It watches `$location.url()` and tries to map the path to an existing route definition.
+ *
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
+ *
+ * You can define routes through {@link ngRoute.$routeProvider $routeProvider}'s API.
+ *
+ * The `$route` service is typically used in conjunction with the
+ * {@link ngRoute.directive:ngView `ngView`} directive and the
+ * {@link ngRoute.$routeParams `$routeParams`} service.
+ *
+ * @example
+ This example shows how changing the URL hash causes the `$route` to match a route against the
+ URL, and the `ngView` pulls in the partial.
+
+ Note that this example is using {@link ng.directive:script inlined templates}
+ to get it working on jsfiddle as well.
+
+ <example module="ngViewExample" deps="angular-route.js">
+ <file name="index.html">
+ <div ng-controller="MainCntl">
+ Choose:
+ <a href="Book/Moby">Moby</a> |
+ <a href="Book/Moby/ch/1">Moby: Ch1</a> |
+ <a href="Book/Gatsby">Gatsby</a> |
+ <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
+ <a href="Book/Scarlet">Scarlet Letter</a><br/>
+
+ <div ng-view></div>
+ <hr />
+
+ <pre>$location.path() = {{$location.path()}}</pre>
+ <pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
+ <pre>$route.current.params = {{$route.current.params}}</pre>
+ <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
+ <pre>$routeParams = {{$routeParams}}</pre>
+ </div>
+ </file>
+
+ <file name="book.html">
+ controller: {{name}}<br />
+ Book Id: {{params.bookId}}<br />
+ </file>
+
+ <file name="chapter.html">
+ controller: {{name}}<br />
+ Book Id: {{params.bookId}}<br />
+ Chapter Id: {{params.chapterId}}
+ </file>
+
+ <file name="script.js">
+ angular.module('ngViewExample', ['ngRoute'])
+
+ .config(function($routeProvider, $locationProvider) {
+ $routeProvider.when('/Book/:bookId', {
+ templateUrl: 'book.html',
+ controller: BookCntl,
+ resolve: {
+ // I will cause a 1 second delay
+ delay: function($q, $timeout) {
+ var delay = $q.defer();
+ $timeout(delay.resolve, 1000);
+ return delay.promise;
+ }
+ }
+ });
+ $routeProvider.when('/Book/:bookId/ch/:chapterId', {
+ templateUrl: 'chapter.html',
+ controller: ChapterCntl
+ });
+
+ // configure html5 to get links working on jsfiddle
+ $locationProvider.html5Mode(true);
+ });
+
+ function MainCntl($scope, $route, $routeParams, $location) {
+ $scope.$route = $route;
+ $scope.$location = $location;
+ $scope.$routeParams = $routeParams;
+ }
+
+ function BookCntl($scope, $routeParams) {
+ $scope.name = "BookCntl";
+ $scope.params = $routeParams;
+ }
+
+ function ChapterCntl($scope, $routeParams) {
+ $scope.name = "ChapterCntl";
+ $scope.params = $routeParams;
+ }
+ </file>
+
+ <file name="scenario.js">
+ it('should load and compile correct template', function() {
+ element('a:contains("Moby: Ch1")').click();
+ var content = element('.doc-example-live [ng-view]').text();
+ expect(content).toMatch(/controller\: ChapterCntl/);
+ expect(content).toMatch(/Book Id\: Moby/);
+ expect(content).toMatch(/Chapter Id\: 1/);
+
+ element('a:contains("Scarlet")').click();
+ sleep(2); // promises are not part of scenario waiting
+ content = element('.doc-example-live [ng-view]').text();
+ expect(content).toMatch(/controller\: BookCntl/);
+ expect(content).toMatch(/Book Id\: Scarlet/);
+ });
+ </file>
+ </example>
+ */
+
+ /**
+ * @ngdoc event
+ * @name ngRoute.$route#$routeChangeStart
+ * @eventOf ngRoute.$route
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted before a route change. At this point the route services starts
+ * resolving all of the dependencies needed for the route change to occurs.
+ * Typically this involves fetching the view template as well as any dependencies
+ * defined in `resolve` route property. Once all of the dependencies are resolved
+ * `$routeChangeSuccess` is fired.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {Route} next Future route information.
+ * @param {Route} current Current route information.
+ */
+
+ /**
+ * @ngdoc event
+ * @name ngRoute.$route#$routeChangeSuccess
+ * @eventOf ngRoute.$route
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted after a route dependencies are resolved.
+ * {@link ngRoute.directive:ngView ngView} listens for the directive
+ * to instantiate the controller and render the view.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {Route} current Current route information.
+ * @param {Route|Undefined} previous Previous route information, or undefined if current is
+ * first route entered.
+ */
+
+ /**
+ * @ngdoc event
+ * @name ngRoute.$route#$routeChangeError
+ * @eventOf ngRoute.$route
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted if any of the resolve promises are rejected.
+ *
+ * @param {Object} angularEvent Synthetic event object
+ * @param {Route} current Current route information.
+ * @param {Route} previous Previous route information.
+ * @param {Route} rejection Rejection of the promise. Usually the error of the failed promise.
+ */
+
+ /**
+ * @ngdoc event
+ * @name ngRoute.$route#$routeUpdate
+ * @eventOf ngRoute.$route
+ * @eventType broadcast on root scope
+ * @description
+ *
+ * The `reloadOnSearch` property has been set to false, and we are reusing the same
+ * instance of the Controller.
+ */
+
+ var forceReload = false,
+ $route = {
+ routes: routes,
+
+ /**
+ * @ngdoc method
+ * @name ngRoute.$route#reload
+ * @methodOf ngRoute.$route
+ *
+ * @description
+ * Causes `$route` service to reload the current route even if
+ * {@link ng.$location $location} hasn't changed.
+ *
+ * As a result of that, {@link ngRoute.directive:ngView ngView}
+ * creates new scope, reinstantiates the controller.
+ */
+ reload: function() {
+ forceReload = true;
+ $rootScope.$evalAsync(updateRoute);
+ }
+ };
+
+ $rootScope.$on('$locationChangeSuccess', updateRoute);
+
+ return $route;
+
+ /////////////////////////////////////////////////////
+
+ /**
+ * @param on {string} current url
+ * @param route {Object} route regexp to match the url against
+ * @return {?Object}
+ *
+ * @description
+ * Check if the route matches the current url.
+ *
+ * Inspired by match in
+ * visionmedia/express/lib/router/router.js.
+ */
+ function switchRouteMatcher(on, route) {
+ var keys = route.keys,
+ params = {};
+
+ if (!route.regexp) return null;
+
+ var m = route.regexp.exec(on);
+ if (!m) return null;
+
+ for (var i = 1, len = m.length; i < len; ++i) {
+ var key = keys[i - 1];
+
+ var val = 'string' == typeof m[i]
+ ? decodeURIComponent(m[i])
+ : m[i];
+
+ if (key && val) {
+ params[key.name] = val;
+ }
+ }
+ return params;
+ }
+
+ function updateRoute() {
+ var next = parseRoute(),
+ last = $route.current;
+
+ if (next && last && next.$$route === last.$$route
+ && angular.equals(next.pathParams, last.pathParams)
+ && !next.reloadOnSearch && !forceReload) {
+ last.params = next.params;
+ angular.copy(last.params, $routeParams);
+ $rootScope.$broadcast('$routeUpdate', last);
+ } else if (next || last) {
+ forceReload = false;
+ $rootScope.$broadcast('$routeChangeStart', next, last);
+ $route.current = next;
+ if (next) {
+ if (next.redirectTo) {
+ if (angular.isString(next.redirectTo)) {
+ $location.path(interpolate(next.redirectTo, next.params)).search(next.params)
+ .replace();
+ } else {
+ $location.url(next.redirectTo(next.pathParams, $location.path(), $location.search()))
+ .replace();
+ }
+ }
+ }
+
+ $q.when(next).
+ then(function() {
+ if (next) {
+ var locals = angular.extend({}, next.resolve),
+ template, templateUrl;
+
+ angular.forEach(locals, function(value, key) {
+ locals[key] = angular.isString(value) ?
+ $injector.get(value) : $injector.invoke(value);
+ });
+
+ if (angular.isDefined(template = next.template)) {
+ if (angular.isFunction(template)) {
+ template = template(next.params);
+ }
+ } else if (angular.isDefined(templateUrl = next.templateUrl)) {
+ if (angular.isFunction(templateUrl)) {
+ templateUrl = templateUrl(next.params);
+ }
+ templateUrl = $sce.getTrustedResourceUrl(templateUrl);
+ if (angular.isDefined(templateUrl)) {
+ next.loadedTemplateUrl = templateUrl;
+ template = $http.get(templateUrl, {cache: $templateCache}).
+ then(function(response) { return response.data; });
+ }
+ }
+ if (angular.isDefined(template)) {
+ locals['$template'] = template;
+ }
+ return $q.all(locals);
+ }
+ }).
+ // after route change
+ then(function(locals) {
+ if (next == $route.current) {
+ if (next) {
+ next.locals = locals;
+ angular.copy(next.params, $routeParams);
+ }
+ $rootScope.$broadcast('$routeChangeSuccess', next, last);
+ }
+ }, function(error) {
+ if (next == $route.current) {
+ $rootScope.$broadcast('$routeChangeError', next, last, error);
+ }
+ });
+ }
+ }
+
+
+ /**
+ * @returns the current active route, by matching it against the URL
+ */
+ function parseRoute() {
+ // Match a route
+ var params, match;
+ angular.forEach(routes, function(route, path) {
+ if (!match && (params = switchRouteMatcher($location.path(), route))) {
+ match = inherit(route, {
+ params: angular.extend({}, $location.search(), params),
+ pathParams: params});
+ match.$$route = route;
+ }
+ });
+ // No route matched; fallback to "otherwise" route
+ return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}});
+ }
+
+ /**
+ * @returns interpolation of the redirect path with the parameters
+ */
+ function interpolate(string, params) {
+ var result = [];
+ angular.forEach((string||'').split(':'), function(segment, i) {
+ if (i === 0) {
+ result.push(segment);
+ } else {
+ var segmentMatch = segment.match(/(\w+)(.*)/);
+ var key = segmentMatch[1];
+ result.push(params[key]);
+ result.push(segmentMatch[2] || '');
+ delete params[key];
+ }
+ });
+ return result.join('');
+ }
+ }];
+}
+
+ngRouteModule.provider('$routeParams', $RouteParamsProvider);
+
+
+/**
+ * @ngdoc object
+ * @name ngRoute.$routeParams
+ * @requires $route
+ *
+ * @description
+ * The `$routeParams` service allows you to retrieve the current set of route parameters.
+ *
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
+ *
+ * The route parameters are a combination of {@link ng.$location `$location`}'s
+ * {@link ng.$location#methods_search `search()`} and {@link ng.$location#methods_path `path()`}.
+ * The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched.
+ *
+ * In case of parameter name collision, `path` params take precedence over `search` params.
+ *
+ * The service guarantees that the identity of the `$routeParams` object will remain unchanged
+ * (but its properties will likely change) even when a route change occurs.
+ *
+ * Note that the `$routeParams` are only updated *after* a route change completes successfully.
+ * This means that you cannot rely on `$routeParams` being correct in route resolve functions.
+ * Instead you can use `$route.current.params` to access the new route's parameters.
+ *
+ * @example
+ * <pre>
+ * // Given:
+ * // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
+ * // Route: /Chapter/:chapterId/Section/:sectionId
+ * //
+ * // Then
+ * $routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
+ * </pre>
+ */
+function $RouteParamsProvider() {
+ this.$get = function() { return {}; };
+}
+
+ngRouteModule.directive('ngView', ngViewFactory);
+ngRouteModule.directive('ngView', ngViewFillContentFactory);
+
+
+/**
+ * @ngdoc directive
+ * @name ngRoute.directive:ngView
+ * @restrict ECA
+ *
+ * @description
+ * # Overview
+ * `ngView` is a directive that complements the {@link ngRoute.$route $route} service by
+ * including the rendered template of the current route into the main layout (`index.html`) file.
+ * Every time the current route changes, the included view changes with it according to the
+ * configuration of the `$route` service.
+ *
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
+ *
+ * @animations
+ * enter - animation is used to bring new content into the browser.
+ * leave - animation is used to animate existing content away.
+ *
+ * The enter and leave animation occur concurrently.
+ *
+ * @scope
+ * @priority 400
+ * @example
+ <example module="ngViewExample" deps="angular-route.js" animations="true">
+ <file name="index.html">
+ <div ng-controller="MainCntl as main">
+ Choose:
+ <a href="Book/Moby">Moby</a> |
+ <a href="Book/Moby/ch/1">Moby: Ch1</a> |
+ <a href="Book/Gatsby">Gatsby</a> |
+ <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
+ <a href="Book/Scarlet">Scarlet Letter</a><br/>
+
+ <div class="view-animate-container">
+ <div ng-view class="view-animate"></div>
+ </div>
+ <hr />
+
+ <pre>$location.path() = {{main.$location.path()}}</pre>
+ <pre>$route.current.templateUrl = {{main.$route.current.templateUrl}}</pre>
+ <pre>$route.current.params = {{main.$route.current.params}}</pre>
+ <pre>$route.current.scope.name = {{main.$route.current.scope.name}}</pre>
+ <pre>$routeParams = {{main.$routeParams}}</pre>
+ </div>
+ </file>
+
+ <file name="book.html">
+ <div>
+ controller: {{book.name}}<br />
+ Book Id: {{book.params.bookId}}<br />
+ </div>
+ </file>
+
+ <file name="chapter.html">
+ <div>
+ controller: {{chapter.name}}<br />
+ Book Id: {{chapter.params.bookId}}<br />
+ Chapter Id: {{chapter.params.chapterId}}
+ </div>
+ </file>
+
+ <file name="animations.css">
+ .view-animate-container {
+ position:relative;
+ height:100px!important;
+ position:relative;
+ background:white;
+ border:1px solid black;
+ height:40px;
+ overflow:hidden;
+ }
+
+ .view-animate {
+ padding:10px;
+ }
+
+ .view-animate.ng-enter, .view-animate.ng-leave {
+ -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
+
+ display:block;
+ width:100%;
+ border-left:1px solid black;
+
+ position:absolute;
+ top:0;
+ left:0;
+ right:0;
+ bottom:0;
+ padding:10px;
+ }
+
+ .view-animate.ng-enter {
+ left:100%;
+ }
+ .view-animate.ng-enter.ng-enter-active {
+ left:0;
+ }
+ .view-animate.ng-leave.ng-leave-active {
+ left:-100%;
+ }
+ </file>
+
+ <file name="script.js">
+ angular.module('ngViewExample', ['ngRoute', 'ngAnimate'],
+ function($routeProvider, $locationProvider) {
+ $routeProvider.when('/Book/:bookId', {
+ templateUrl: 'book.html',
+ controller: BookCntl,
+ controllerAs: 'book'
+ });
+ $routeProvider.when('/Book/:bookId/ch/:chapterId', {
+ templateUrl: 'chapter.html',
+ controller: ChapterCntl,
+ controllerAs: 'chapter'
+ });
+
+ // configure html5 to get links working on jsfiddle
+ $locationProvider.html5Mode(true);
+ });
+
+ function MainCntl($route, $routeParams, $location) {
+ this.$route = $route;
+ this.$location = $location;
+ this.$routeParams = $routeParams;
+ }
+
+ function BookCntl($routeParams) {
+ this.name = "BookCntl";
+ this.params = $routeParams;
+ }
+
+ function ChapterCntl($routeParams) {
+ this.name = "ChapterCntl";
+ this.params = $routeParams;
+ }
+ </file>
+
+ <file name="scenario.js">
+ it('should load and compile correct template', function() {
+ element('a:contains("Moby: Ch1")').click();
+ var content = element('.doc-example-live [ng-view]').text();
+ expect(content).toMatch(/controller\: ChapterCntl/);
+ expect(content).toMatch(/Book Id\: Moby/);
+ expect(content).toMatch(/Chapter Id\: 1/);
+
+ element('a:contains("Scarlet")').click();
+ content = element('.doc-example-live [ng-view]').text();
+ expect(content).toMatch(/controller\: BookCntl/);
+ expect(content).toMatch(/Book Id\: Scarlet/);
+ });
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngRoute.directive:ngView#$viewContentLoaded
+ * @eventOf ngRoute.directive:ngView
+ * @eventType emit on the current ngView scope
+ * @description
+ * Emitted every time the ngView content is reloaded.
+ */
+ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate'];
+function ngViewFactory( $route, $anchorScroll, $animate) {
+ return {
+ restrict: 'ECA',
+ terminal: true,
+ priority: 400,
+ transclude: 'element',
+ link: function(scope, $element, attr, ctrl, $transclude) {
+ var currentScope,
+ currentElement,
+ autoScrollExp = attr.autoscroll,
+ onloadExp = attr.onload || '';
+
+ scope.$on('$routeChangeSuccess', update);
+ update();
+
+ function cleanupLastView() {
+ if (currentScope) {
+ currentScope.$destroy();
+ currentScope = null;
+ }
+ if(currentElement) {
+ $animate.leave(currentElement);
+ currentElement = null;
+ }
+ }
+
+ function update() {
+ var locals = $route.current && $route.current.locals,
+ template = locals && locals.$template;
+
+ if (template) {
+ var newScope = scope.$new();
+ var current = $route.current;
+
+ // Note: This will also link all children of ng-view that were contained in the original
+ // html. If that content contains controllers, ... they could pollute/change the scope.
+ // However, using ng-view on an element with additional content does not make sense...
+ // Note: We can't remove them in the cloneAttchFn of $transclude as that
+ // function is called before linking the content, which would apply child
+ // directives to non existing elements.
+ var clone = $transclude(newScope, function(clone) {
+ $animate.enter(clone, null, currentElement || $element, function onNgViewEnter () {
+ if (angular.isDefined(autoScrollExp)
+ && (!autoScrollExp || scope.$eval(autoScrollExp))) {
+ $anchorScroll();
+ }
+ });
+ cleanupLastView();
+ });
+
+ currentElement = clone;
+ currentScope = current.scope = newScope;
+ currentScope.$emit('$viewContentLoaded');
+ currentScope.$eval(onloadExp);
+ } else {
+ cleanupLastView();
+ }
+ }
+ }
+ };
+}
+
+// This directive is called during the $transclude call of the first `ngView` directive.
+// It will replace and compile the content of the element with the loaded template.
+// We need this directive so that the element content is already filled when
+// the link function of another directive on the same element as ngView
+// is called.
+ngViewFillContentFactory.$inject = ['$compile', '$controller', '$route'];
+function ngViewFillContentFactory($compile, $controller, $route) {
+ return {
+ restrict: 'ECA',
+ priority: -400,
+ link: function(scope, $element) {
+ var current = $route.current,
+ locals = current.locals;
+
+ $element.html(locals.$template);
+
+ var link = $compile($element.contents());
+
+ if (current.controller) {
+ locals.$scope = scope;
+ var controller = $controller(current.controller, locals);
+ if (current.controllerAs) {
+ scope[current.controllerAs] = controller;
+ }
+ $element.data('$ngControllerController', controller);
+ $element.children().data('$ngControllerController', controller);
+ }
+
+ link(scope);
+ }
+ };
+}
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-route.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-route.min.js
new file mode 100644
index 00000000..67158fbf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-route.min.js
@@ -0,0 +1,14 @@
+/*
+ AngularJS v1.2.25
+ (c) 2010-2014 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(n,e,A){'use strict';function x(s,g,h){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(a,c,b,f,w){function y(){p&&(p.remove(),p=null);k&&(k.$destroy(),k=null);l&&(h.leave(l,function(){p=null}),p=l,l=null)}function v(){var b=s.current&&s.current.locals;if(e.isDefined(b&&b.$template)){var b=a.$new(),d=s.current;l=w(b,function(d){h.enter(d,null,l||c,function(){!e.isDefined(t)||t&&!a.$eval(t)||g()});y()});k=d.scope=b;k.$emit("$viewContentLoaded");k.$eval(u)}else y()}
+var k,l,p,t=b.autoscroll,u=b.onload||"";a.$on("$routeChangeSuccess",v);v()}}}function z(e,g,h){return{restrict:"ECA",priority:-400,link:function(a,c){var b=h.current,f=b.locals;c.html(f.$template);var w=e(c.contents());b.controller&&(f.$scope=a,f=g(b.controller,f),b.controllerAs&&(a[b.controllerAs]=f),c.data("$ngControllerController",f),c.children().data("$ngControllerController",f));w(a)}}}n=e.module("ngRoute",["ng"]).provider("$route",function(){function s(a,c){return e.extend(new (e.extend(function(){},
+{prototype:a})),c)}function g(a,e){var b=e.caseInsensitiveMatch,f={originalPath:a,regexp:a},h=f.keys=[];a=a.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?\*])?/g,function(a,e,b,c){a="?"===c?c:null;c="*"===c?c:null;h.push({name:b,optional:!!a});e=e||"";return""+(a?"":e)+"(?:"+(a?e:"")+(c&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([\/$\*])/g,"\\$1");f.regexp=RegExp("^"+a+"$",b?"i":"");return f}var h={};this.when=function(a,c){h[a]=e.extend({reloadOnSearch:!0},c,a&&g(a,c));if(a){var b=
+"/"==a[a.length-1]?a.substr(0,a.length-1):a+"/";h[b]=e.extend({redirectTo:a},g(b,c))}return this};this.otherwise=function(a){this.when(null,a);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$http","$templateCache","$sce",function(a,c,b,f,g,n,v,k){function l(){var d=p(),m=r.current;if(d&&m&&d.$$route===m.$$route&&e.equals(d.pathParams,m.pathParams)&&!d.reloadOnSearch&&!u)m.params=d.params,e.copy(m.params,b),a.$broadcast("$routeUpdate",m);else if(d||m)u=!1,a.$broadcast("$routeChangeStart",
+d,m),(r.current=d)&&d.redirectTo&&(e.isString(d.redirectTo)?c.path(t(d.redirectTo,d.params)).search(d.params).replace():c.url(d.redirectTo(d.pathParams,c.path(),c.search())).replace()),f.when(d).then(function(){if(d){var a=e.extend({},d.resolve),c,b;e.forEach(a,function(d,c){a[c]=e.isString(d)?g.get(d):g.invoke(d)});e.isDefined(c=d.template)?e.isFunction(c)&&(c=c(d.params)):e.isDefined(b=d.templateUrl)&&(e.isFunction(b)&&(b=b(d.params)),b=k.getTrustedResourceUrl(b),e.isDefined(b)&&(d.loadedTemplateUrl=
+b,c=n.get(b,{cache:v}).then(function(a){return a.data})));e.isDefined(c)&&(a.$template=c);return f.all(a)}}).then(function(c){d==r.current&&(d&&(d.locals=c,e.copy(d.params,b)),a.$broadcast("$routeChangeSuccess",d,m))},function(c){d==r.current&&a.$broadcast("$routeChangeError",d,m,c)})}function p(){var a,b;e.forEach(h,function(f,h){var q;if(q=!b){var g=c.path();q=f.keys;var l={};if(f.regexp)if(g=f.regexp.exec(g)){for(var k=1,p=g.length;k<p;++k){var n=q[k-1],r=g[k];n&&r&&(l[n.name]=r)}q=l}else q=null;
+else q=null;q=a=q}q&&(b=s(f,{params:e.extend({},c.search(),a),pathParams:a}),b.$$route=f)});return b||h[null]&&s(h[null],{params:{},pathParams:{}})}function t(a,c){var b=[];e.forEach((a||"").split(":"),function(a,d){if(0===d)b.push(a);else{var e=a.match(/(\w+)(.*)/),f=e[1];b.push(c[f]);b.push(e[2]||"");delete c[f]}});return b.join("")}var u=!1,r={routes:h,reload:function(){u=!0;a.$evalAsync(l)}};a.$on("$locationChangeSuccess",l);return r}]});n.provider("$routeParams",function(){this.$get=function(){return{}}});
+n.directive("ngView",x);n.directive("ngView",z);x.$inject=["$route","$anchorScroll","$animate"];z.$inject=["$compile","$controller","$route"]})(window,window.angular);
+//# sourceMappingURL=angular-route.min.js.map \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-sanitize.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-sanitize.js
new file mode 100644
index 00000000..87100fdb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-sanitize.js
@@ -0,0 +1,647 @@
+/**
+ * @license AngularJS v1.2.25
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+var $sanitizeMinErr = angular.$$minErr('$sanitize');
+
+/**
+ * @ngdoc module
+ * @name ngSanitize
+ * @description
+ *
+ * # ngSanitize
+ *
+ * The `ngSanitize` module provides functionality to sanitize HTML.
+ *
+ *
+ * <div doc-module-components="ngSanitize"></div>
+ *
+ * See {@link ngSanitize.$sanitize `$sanitize`} for usage.
+ */
+
+/*
+ * HTML Parser By Misko Hevery (misko@hevery.com)
+ * based on: HTML Parser By John Resig (ejohn.org)
+ * Original code by Erik Arvidsson, Mozilla Public License
+ * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
+ *
+ * // Use like so:
+ * htmlParser(htmlString, {
+ * start: function(tag, attrs, unary) {},
+ * end: function(tag) {},
+ * chars: function(text) {},
+ * comment: function(text) {}
+ * });
+ *
+ */
+
+
+/**
+ * @ngdoc service
+ * @name $sanitize
+ * @kind function
+ *
+ * @description
+ * The input is sanitized by parsing the html into tokens. All safe tokens (from a whitelist) are
+ * then serialized back to properly escaped html string. This means that no unsafe input can make
+ * it into the returned string, however, since our parser is more strict than a typical browser
+ * parser, it's possible that some obscure input, which would be recognized as valid HTML by a
+ * browser, won't make it through the sanitizer.
+ * The whitelist is configured using the functions `aHrefSanitizationWhitelist` and
+ * `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider `$compileProvider`}.
+ *
+ * @param {string} html Html input.
+ * @returns {string} Sanitized html.
+ *
+ * @example
+ <example module="sanitizeExample" deps="angular-sanitize.js">
+ <file name="index.html">
+ <script>
+ angular.module('sanitizeExample', ['ngSanitize'])
+ .controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
+ $scope.snippet =
+ '<p style="color:blue">an html\n' +
+ '<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
+ 'snippet</p>';
+ $scope.deliberatelyTrustDangerousSnippet = function() {
+ return $sce.trustAsHtml($scope.snippet);
+ };
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
+ <table>
+ <tr>
+ <td>Directive</td>
+ <td>How</td>
+ <td>Source</td>
+ <td>Rendered</td>
+ </tr>
+ <tr id="bind-html-with-sanitize">
+ <td>ng-bind-html</td>
+ <td>Automatically uses $sanitize</td>
+ <td><pre>&lt;div ng-bind-html="snippet"&gt;<br/>&lt;/div&gt;</pre></td>
+ <td><div ng-bind-html="snippet"></div></td>
+ </tr>
+ <tr id="bind-html-with-trust">
+ <td>ng-bind-html</td>
+ <td>Bypass $sanitize by explicitly trusting the dangerous value</td>
+ <td>
+ <pre>&lt;div ng-bind-html="deliberatelyTrustDangerousSnippet()"&gt;
+&lt;/div&gt;</pre>
+ </td>
+ <td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td>
+ </tr>
+ <tr id="bind-default">
+ <td>ng-bind</td>
+ <td>Automatically escapes</td>
+ <td><pre>&lt;div ng-bind="snippet"&gt;<br/>&lt;/div&gt;</pre></td>
+ <td><div ng-bind="snippet"></div></td>
+ </tr>
+ </table>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should sanitize the html snippet by default', function() {
+ expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
+ toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
+ });
+
+ it('should inline raw snippet if bound to a trusted value', function() {
+ expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).
+ toBe("<p style=\"color:blue\">an html\n" +
+ "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
+ "snippet</p>");
+ });
+
+ it('should escape snippet without any filter', function() {
+ expect(element(by.css('#bind-default div')).getInnerHtml()).
+ toBe("&lt;p style=\"color:blue\"&gt;an html\n" +
+ "&lt;em onmouseover=\"this.textContent='PWN3D!'\"&gt;click here&lt;/em&gt;\n" +
+ "snippet&lt;/p&gt;");
+ });
+
+ it('should update', function() {
+ element(by.model('snippet')).clear();
+ element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>');
+ expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
+ toBe('new <b>text</b>');
+ expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(
+ 'new <b onclick="alert(1)">text</b>');
+ expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(
+ "new &lt;b onclick=\"alert(1)\"&gt;text&lt;/b&gt;");
+ });
+ </file>
+ </example>
+ */
+function $SanitizeProvider() {
+ this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
+ return function(html) {
+ var buf = [];
+ htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {
+ return !/^unsafe/.test($$sanitizeUri(uri, isImage));
+ }));
+ return buf.join('');
+ };
+ }];
+}
+
+function sanitizeText(chars) {
+ var buf = [];
+ var writer = htmlSanitizeWriter(buf, angular.noop);
+ writer.chars(chars);
+ return buf.join('');
+}
+
+
+// Regular Expressions for parsing tags and attributes
+var START_TAG_REGEXP =
+ /^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/,
+ END_TAG_REGEXP = /^<\/\s*([\w:-]+)[^>]*>/,
+ ATTR_REGEXP = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,
+ BEGIN_TAG_REGEXP = /^</,
+ BEGING_END_TAGE_REGEXP = /^<\//,
+ COMMENT_REGEXP = /<!--(.*?)-->/g,
+ DOCTYPE_REGEXP = /<!DOCTYPE([^>]*?)>/i,
+ CDATA_REGEXP = /<!\[CDATA\[(.*?)]]>/g,
+ SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
+ // Match everything outside of normal chars and " (quote character)
+ NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g;
+
+
+// Good source of info about elements and attributes
+// http://dev.w3.org/html5/spec/Overview.html#semantics
+// http://simon.html5.org/html-elements
+
+// Safe Void Elements - HTML5
+// http://dev.w3.org/html5/spec/Overview.html#void-elements
+var voidElements = makeMap("area,br,col,hr,img,wbr");
+
+// Elements that you can, intentionally, leave open (and which close themselves)
+// http://dev.w3.org/html5/spec/Overview.html#optional-tags
+var optionalEndTagBlockElements = makeMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),
+ optionalEndTagInlineElements = makeMap("rp,rt"),
+ optionalEndTagElements = angular.extend({},
+ optionalEndTagInlineElements,
+ optionalEndTagBlockElements);
+
+// Safe Block Elements - HTML5
+var blockElements = angular.extend({}, optionalEndTagBlockElements, makeMap("address,article," +
+ "aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," +
+ "h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul"));
+
+// Inline Elements - HTML5
+var inlineElements = angular.extend({}, optionalEndTagInlineElements, makeMap("a,abbr,acronym,b," +
+ "bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," +
+ "samp,small,span,strike,strong,sub,sup,time,tt,u,var"));
+
+
+// Special Elements (can contain anything)
+var specialElements = makeMap("script,style");
+
+var validElements = angular.extend({},
+ voidElements,
+ blockElements,
+ inlineElements,
+ optionalEndTagElements);
+
+//Attributes that have href and hence need to be sanitized
+var uriAttrs = makeMap("background,cite,href,longdesc,src,usemap");
+var validAttrs = angular.extend({}, uriAttrs, makeMap(
+ 'abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,'+
+ 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,'+
+ 'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,'+
+ 'scope,scrolling,shape,size,span,start,summary,target,title,type,'+
+ 'valign,value,vspace,width'));
+
+function makeMap(str) {
+ var obj = {}, items = str.split(','), i;
+ for (i = 0; i < items.length; i++) obj[items[i]] = true;
+ return obj;
+}
+
+
+/**
+ * @example
+ * htmlParser(htmlString, {
+ * start: function(tag, attrs, unary) {},
+ * end: function(tag) {},
+ * chars: function(text) {},
+ * comment: function(text) {}
+ * });
+ *
+ * @param {string} html string
+ * @param {object} handler
+ */
+function htmlParser( html, handler ) {
+ if (typeof html !== 'string') {
+ if (html === null || typeof html === 'undefined') {
+ html = '';
+ } else {
+ html = '' + html;
+ }
+ }
+ var index, chars, match, stack = [], last = html, text;
+ stack.last = function() { return stack[ stack.length - 1 ]; };
+
+ while ( html ) {
+ text = '';
+ chars = true;
+
+ // Make sure we're not in a script or style element
+ if ( !stack.last() || !specialElements[ stack.last() ] ) {
+
+ // Comment
+ if ( html.indexOf("<!--") === 0 ) {
+ // comments containing -- are not allowed unless they terminate the comment
+ index = html.indexOf("--", 4);
+
+ if ( index >= 0 && html.lastIndexOf("-->", index) === index) {
+ if (handler.comment) handler.comment( html.substring( 4, index ) );
+ html = html.substring( index + 3 );
+ chars = false;
+ }
+ // DOCTYPE
+ } else if ( DOCTYPE_REGEXP.test(html) ) {
+ match = html.match( DOCTYPE_REGEXP );
+
+ if ( match ) {
+ html = html.replace( match[0], '');
+ chars = false;
+ }
+ // end tag
+ } else if ( BEGING_END_TAGE_REGEXP.test(html) ) {
+ match = html.match( END_TAG_REGEXP );
+
+ if ( match ) {
+ html = html.substring( match[0].length );
+ match[0].replace( END_TAG_REGEXP, parseEndTag );
+ chars = false;
+ }
+
+ // start tag
+ } else if ( BEGIN_TAG_REGEXP.test(html) ) {
+ match = html.match( START_TAG_REGEXP );
+
+ if ( match ) {
+ // We only have a valid start-tag if there is a '>'.
+ if ( match[4] ) {
+ html = html.substring( match[0].length );
+ match[0].replace( START_TAG_REGEXP, parseStartTag );
+ }
+ chars = false;
+ } else {
+ // no ending tag found --- this piece should be encoded as an entity.
+ text += '<';
+ html = html.substring(1);
+ }
+ }
+
+ if ( chars ) {
+ index = html.indexOf("<");
+
+ text += index < 0 ? html : html.substring( 0, index );
+ html = index < 0 ? "" : html.substring( index );
+
+ if (handler.chars) handler.chars( decodeEntities(text) );
+ }
+
+ } else {
+ html = html.replace(new RegExp("(.*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'),
+ function(all, text){
+ text = text.replace(COMMENT_REGEXP, "$1").replace(CDATA_REGEXP, "$1");
+
+ if (handler.chars) handler.chars( decodeEntities(text) );
+
+ return "";
+ });
+
+ parseEndTag( "", stack.last() );
+ }
+
+ if ( html == last ) {
+ throw $sanitizeMinErr('badparse', "The sanitizer was unable to parse the following block " +
+ "of html: {0}", html);
+ }
+ last = html;
+ }
+
+ // Clean up any remaining tags
+ parseEndTag();
+
+ function parseStartTag( tag, tagName, rest, unary ) {
+ tagName = angular.lowercase(tagName);
+ if ( blockElements[ tagName ] ) {
+ while ( stack.last() && inlineElements[ stack.last() ] ) {
+ parseEndTag( "", stack.last() );
+ }
+ }
+
+ if ( optionalEndTagElements[ tagName ] && stack.last() == tagName ) {
+ parseEndTag( "", tagName );
+ }
+
+ unary = voidElements[ tagName ] || !!unary;
+
+ if ( !unary )
+ stack.push( tagName );
+
+ var attrs = {};
+
+ rest.replace(ATTR_REGEXP,
+ function(match, name, doubleQuotedValue, singleQuotedValue, unquotedValue) {
+ var value = doubleQuotedValue
+ || singleQuotedValue
+ || unquotedValue
+ || '';
+
+ attrs[name] = decodeEntities(value);
+ });
+ if (handler.start) handler.start( tagName, attrs, unary );
+ }
+
+ function parseEndTag( tag, tagName ) {
+ var pos = 0, i;
+ tagName = angular.lowercase(tagName);
+ if ( tagName )
+ // Find the closest opened tag of the same type
+ for ( pos = stack.length - 1; pos >= 0; pos-- )
+ if ( stack[ pos ] == tagName )
+ break;
+
+ if ( pos >= 0 ) {
+ // Close all the open elements, up the stack
+ for ( i = stack.length - 1; i >= pos; i-- )
+ if (handler.end) handler.end( stack[ i ] );
+
+ // Remove the open elements from the stack
+ stack.length = pos;
+ }
+ }
+}
+
+var hiddenPre=document.createElement("pre");
+var spaceRe = /^(\s*)([\s\S]*?)(\s*)$/;
+/**
+ * decodes all entities into regular string
+ * @param value
+ * @returns {string} A string with decoded entities.
+ */
+function decodeEntities(value) {
+ if (!value) { return ''; }
+
+ // Note: IE8 does not preserve spaces at the start/end of innerHTML
+ // so we must capture them and reattach them afterward
+ var parts = spaceRe.exec(value);
+ var spaceBefore = parts[1];
+ var spaceAfter = parts[3];
+ var content = parts[2];
+ if (content) {
+ hiddenPre.innerHTML=content.replace(/</g,"&lt;");
+ // innerText depends on styling as it doesn't display hidden elements.
+ // Therefore, it's better to use textContent not to cause unnecessary
+ // reflows. However, IE<9 don't support textContent so the innerText
+ // fallback is necessary.
+ content = 'textContent' in hiddenPre ?
+ hiddenPre.textContent : hiddenPre.innerText;
+ }
+ return spaceBefore + content + spaceAfter;
+}
+
+/**
+ * Escapes all potentially dangerous characters, so that the
+ * resulting string can be safely inserted into attribute or
+ * element text.
+ * @param value
+ * @returns {string} escaped text
+ */
+function encodeEntities(value) {
+ return value.
+ replace(/&/g, '&amp;').
+ replace(SURROGATE_PAIR_REGEXP, function (value) {
+ var hi = value.charCodeAt(0);
+ var low = value.charCodeAt(1);
+ return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
+ }).
+ replace(NON_ALPHANUMERIC_REGEXP, function(value){
+ return '&#' + value.charCodeAt(0) + ';';
+ }).
+ replace(/</g, '&lt;').
+ replace(/>/g, '&gt;');
+}
+
+/**
+ * create an HTML/XML writer which writes to buffer
+ * @param {Array} buf use buf.jain('') to get out sanitized html string
+ * @returns {object} in the form of {
+ * start: function(tag, attrs, unary) {},
+ * end: function(tag) {},
+ * chars: function(text) {},
+ * comment: function(text) {}
+ * }
+ */
+function htmlSanitizeWriter(buf, uriValidator){
+ var ignore = false;
+ var out = angular.bind(buf, buf.push);
+ return {
+ start: function(tag, attrs, unary){
+ tag = angular.lowercase(tag);
+ if (!ignore && specialElements[tag]) {
+ ignore = tag;
+ }
+ if (!ignore && validElements[tag] === true) {
+ out('<');
+ out(tag);
+ angular.forEach(attrs, function(value, key){
+ var lkey=angular.lowercase(key);
+ var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');
+ if (validAttrs[lkey] === true &&
+ (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
+ out(' ');
+ out(key);
+ out('="');
+ out(encodeEntities(value));
+ out('"');
+ }
+ });
+ out(unary ? '/>' : '>');
+ }
+ },
+ end: function(tag){
+ tag = angular.lowercase(tag);
+ if (!ignore && validElements[tag] === true) {
+ out('</');
+ out(tag);
+ out('>');
+ }
+ if (tag == ignore) {
+ ignore = false;
+ }
+ },
+ chars: function(chars){
+ if (!ignore) {
+ out(encodeEntities(chars));
+ }
+ }
+ };
+}
+
+
+// define ngSanitize module and register $sanitize service
+angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
+
+/* global sanitizeText: false */
+
+/**
+ * @ngdoc filter
+ * @name linky
+ * @kind function
+ *
+ * @description
+ * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and
+ * plain email address links.
+ *
+ * Requires the {@link ngSanitize `ngSanitize`} module to be installed.
+ *
+ * @param {string} text Input text.
+ * @param {string} target Window (_blank|_self|_parent|_top) or named frame to open links in.
+ * @returns {string} Html-linkified text.
+ *
+ * @usage
+ <span ng-bind-html="linky_expression | linky"></span>
+ *
+ * @example
+ <example module="linkyExample" deps="angular-sanitize.js">
+ <file name="index.html">
+ <script>
+ angular.module('linkyExample', ['ngSanitize'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.snippet =
+ 'Pretty text with some links:\n'+
+ 'http://angularjs.org/,\n'+
+ 'mailto:us@somewhere.org,\n'+
+ 'another@somewhere.org,\n'+
+ 'and one more: ftp://127.0.0.1/.';
+ $scope.snippetWithTarget = 'http://angularjs.org/';
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
+ <table>
+ <tr>
+ <td>Filter</td>
+ <td>Source</td>
+ <td>Rendered</td>
+ </tr>
+ <tr id="linky-filter">
+ <td>linky filter</td>
+ <td>
+ <pre>&lt;div ng-bind-html="snippet | linky"&gt;<br>&lt;/div&gt;</pre>
+ </td>
+ <td>
+ <div ng-bind-html="snippet | linky"></div>
+ </td>
+ </tr>
+ <tr id="linky-target">
+ <td>linky target</td>
+ <td>
+ <pre>&lt;div ng-bind-html="snippetWithTarget | linky:'_blank'"&gt;<br>&lt;/div&gt;</pre>
+ </td>
+ <td>
+ <div ng-bind-html="snippetWithTarget | linky:'_blank'"></div>
+ </td>
+ </tr>
+ <tr id="escaped-html">
+ <td>no filter</td>
+ <td><pre>&lt;div ng-bind="snippet"&gt;<br>&lt;/div&gt;</pre></td>
+ <td><div ng-bind="snippet"></div></td>
+ </tr>
+ </table>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should linkify the snippet with urls', function() {
+ expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
+ toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +
+ 'another@somewhere.org, and one more: ftp://127.0.0.1/.');
+ expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
+ });
+
+ it('should not linkify snippet without the linky filter', function() {
+ expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
+ toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +
+ 'another@somewhere.org, and one more: ftp://127.0.0.1/.');
+ expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
+ });
+
+ it('should update', function() {
+ element(by.model('snippet')).clear();
+ element(by.model('snippet')).sendKeys('new http://link.');
+ expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
+ toBe('new http://link.');
+ expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
+ expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
+ .toBe('new http://link.');
+ });
+
+ it('should work with the target property', function() {
+ expect(element(by.id('linky-target')).
+ element(by.binding("snippetWithTarget | linky:'_blank'")).getText()).
+ toBe('http://angularjs.org/');
+ expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
+ });
+ </file>
+ </example>
+ */
+angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
+ var LINKY_URL_REGEXP =
+ /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"]/,
+ MAILTO_REGEXP = /^mailto:/;
+
+ return function(text, target) {
+ if (!text) return text;
+ var match;
+ var raw = text;
+ var html = [];
+ var url;
+ var i;
+ while ((match = raw.match(LINKY_URL_REGEXP))) {
+ // We can not end in these as they are sometimes found at the end of the sentence
+ url = match[0];
+ // if we did not match ftp/http/mailto then assume mailto
+ if (match[2] == match[3]) url = 'mailto:' + url;
+ i = match.index;
+ addText(raw.substr(0, i));
+ addLink(url, match[0].replace(MAILTO_REGEXP, ''));
+ raw = raw.substring(i + match[0].length);
+ }
+ addText(raw);
+ return $sanitize(html.join(''));
+
+ function addText(text) {
+ if (!text) {
+ return;
+ }
+ html.push(sanitizeText(text));
+ }
+
+ function addLink(url, text) {
+ html.push('<a ');
+ if (angular.isDefined(target)) {
+ html.push('target="');
+ html.push(target);
+ html.push('" ');
+ }
+ html.push('href="');
+ html.push(url);
+ html.push('">');
+ addText(text);
+ html.push('</a>');
+ }
+ };
+}]);
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-touch.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-touch.js
new file mode 100644
index 00000000..fd416a35
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-touch.js
@@ -0,0 +1,628 @@
+/**
+ * @license AngularJS v1.4.3
+ * (c) 2010-2015 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+/**
+ * @ngdoc module
+ * @name ngTouch
+ * @description
+ *
+ * # ngTouch
+ *
+ * The `ngTouch` module provides touch events and other helpers for touch-enabled devices.
+ * The implementation is based on jQuery Mobile touch event handling
+ * ([jquerymobile.com](http://jquerymobile.com/)).
+ *
+ *
+ * See {@link ngTouch.$swipe `$swipe`} for usage.
+ *
+ * <div doc-module-components="ngTouch"></div>
+ *
+ */
+
+// define ngTouch module
+/* global -ngTouch */
+var ngTouch = angular.module('ngTouch', []);
+
+function nodeName_(element) {
+ return angular.lowercase(element.nodeName || (element[0] && element[0].nodeName));
+}
+
+/* global ngTouch: false */
+
+ /**
+ * @ngdoc service
+ * @name $swipe
+ *
+ * @description
+ * The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe
+ * behavior, to make implementing swipe-related directives more convenient.
+ *
+ * Requires the {@link ngTouch `ngTouch`} module to be installed.
+ *
+ * `$swipe` is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngTouch`, and by
+ * `ngCarousel` in a separate component.
+ *
+ * # Usage
+ * The `$swipe` service is an object with a single method: `bind`. `bind` takes an element
+ * which is to be watched for swipes, and an object with four handler functions. See the
+ * documentation for `bind` below.
+ */
+
+ngTouch.factory('$swipe', [function() {
+ // The total distance in any direction before we make the call on swipe vs. scroll.
+ var MOVE_BUFFER_RADIUS = 10;
+
+ var POINTER_EVENTS = {
+ 'mouse': {
+ start: 'mousedown',
+ move: 'mousemove',
+ end: 'mouseup'
+ },
+ 'touch': {
+ start: 'touchstart',
+ move: 'touchmove',
+ end: 'touchend',
+ cancel: 'touchcancel'
+ }
+ };
+
+ function getCoordinates(event) {
+ var originalEvent = event.originalEvent || event;
+ var touches = originalEvent.touches && originalEvent.touches.length ? originalEvent.touches : [originalEvent];
+ var e = (originalEvent.changedTouches && originalEvent.changedTouches[0]) || touches[0];
+
+ return {
+ x: e.clientX,
+ y: e.clientY
+ };
+ }
+
+ function getEvents(pointerTypes, eventType) {
+ var res = [];
+ angular.forEach(pointerTypes, function(pointerType) {
+ var eventName = POINTER_EVENTS[pointerType][eventType];
+ if (eventName) {
+ res.push(eventName);
+ }
+ });
+ return res.join(' ');
+ }
+
+ return {
+ /**
+ * @ngdoc method
+ * @name $swipe#bind
+ *
+ * @description
+ * The main method of `$swipe`. It takes an element to be watched for swipe motions, and an
+ * object containing event handlers.
+ * The pointer types that should be used can be specified via the optional
+ * third argument, which is an array of strings `'mouse'` and `'touch'`. By default,
+ * `$swipe` will listen for `mouse` and `touch` events.
+ *
+ * The four events are `start`, `move`, `end`, and `cancel`. `start`, `move`, and `end`
+ * receive as a parameter a coordinates object of the form `{ x: 150, y: 310 }` and the raw
+ * `event`. `cancel` receives the raw `event` as its single parameter.
+ *
+ * `start` is called on either `mousedown` or `touchstart`. After this event, `$swipe` is
+ * watching for `touchmove` or `mousemove` events. These events are ignored until the total
+ * distance moved in either dimension exceeds a small threshold.
+ *
+ * Once this threshold is exceeded, either the horizontal or vertical delta is greater.
+ * - If the horizontal distance is greater, this is a swipe and `move` and `end` events follow.
+ * - If the vertical distance is greater, this is a scroll, and we let the browser take over.
+ * A `cancel` event is sent.
+ *
+ * `move` is called on `mousemove` and `touchmove` after the above logic has determined that
+ * a swipe is in progress.
+ *
+ * `end` is called when a swipe is successfully completed with a `touchend` or `mouseup`.
+ *
+ * `cancel` is called either on a `touchcancel` from the browser, or when we begin scrolling
+ * as described above.
+ *
+ */
+ bind: function(element, eventHandlers, pointerTypes) {
+ // Absolute total movement, used to control swipe vs. scroll.
+ var totalX, totalY;
+ // Coordinates of the start position.
+ var startCoords;
+ // Last event's position.
+ var lastPos;
+ // Whether a swipe is active.
+ var active = false;
+
+ pointerTypes = pointerTypes || ['mouse', 'touch'];
+ element.on(getEvents(pointerTypes, 'start'), function(event) {
+ startCoords = getCoordinates(event);
+ active = true;
+ totalX = 0;
+ totalY = 0;
+ lastPos = startCoords;
+ eventHandlers['start'] && eventHandlers['start'](startCoords, event);
+ });
+ var events = getEvents(pointerTypes, 'cancel');
+ if (events) {
+ element.on(events, function(event) {
+ active = false;
+ eventHandlers['cancel'] && eventHandlers['cancel'](event);
+ });
+ }
+
+ element.on(getEvents(pointerTypes, 'move'), function(event) {
+ if (!active) return;
+
+ // Android will send a touchcancel if it thinks we're starting to scroll.
+ // So when the total distance (+ or - or both) exceeds 10px in either direction,
+ // we either:
+ // - On totalX > totalY, we send preventDefault() and treat this as a swipe.
+ // - On totalY > totalX, we let the browser handle it as a scroll.
+
+ if (!startCoords) return;
+ var coords = getCoordinates(event);
+
+ totalX += Math.abs(coords.x - lastPos.x);
+ totalY += Math.abs(coords.y - lastPos.y);
+
+ lastPos = coords;
+
+ if (totalX < MOVE_BUFFER_RADIUS && totalY < MOVE_BUFFER_RADIUS) {
+ return;
+ }
+
+ // One of totalX or totalY has exceeded the buffer, so decide on swipe vs. scroll.
+ if (totalY > totalX) {
+ // Allow native scrolling to take over.
+ active = false;
+ eventHandlers['cancel'] && eventHandlers['cancel'](event);
+ return;
+ } else {
+ // Prevent the browser from scrolling.
+ event.preventDefault();
+ eventHandlers['move'] && eventHandlers['move'](coords, event);
+ }
+ });
+
+ element.on(getEvents(pointerTypes, 'end'), function(event) {
+ if (!active) return;
+ active = false;
+ eventHandlers['end'] && eventHandlers['end'](getCoordinates(event), event);
+ });
+ }
+ };
+}]);
+
+/* global ngTouch: false,
+ nodeName_: false
+*/
+
+/**
+ * @ngdoc directive
+ * @name ngClick
+ *
+ * @description
+ * A more powerful replacement for the default ngClick designed to be used on touchscreen
+ * devices. Most mobile browsers wait about 300ms after a tap-and-release before sending
+ * the click event. This version handles them immediately, and then prevents the
+ * following click event from propagating.
+ *
+ * Requires the {@link ngTouch `ngTouch`} module to be installed.
+ *
+ * This directive can fall back to using an ordinary click event, and so works on desktop
+ * browsers as well as mobile.
+ *
+ * This directive also sets the CSS class `ng-click-active` while the element is being held
+ * down (by a mouse click or touch) so you can restyle the depressed element if you wish.
+ *
+ * @element ANY
+ * @param {expression} ngClick {@link guide/expression Expression} to evaluate
+ * upon tap. (Event object is available as `$event`)
+ *
+ * @example
+ <example module="ngClickExample" deps="angular-touch.js">
+ <file name="index.html">
+ <button ng-click="count = count + 1" ng-init="count=0">
+ Increment
+ </button>
+ count: {{ count }}
+ </file>
+ <file name="script.js">
+ angular.module('ngClickExample', ['ngTouch']);
+ </file>
+ </example>
+ */
+
+ngTouch.config(['$provide', function($provide) {
+ $provide.decorator('ngClickDirective', ['$delegate', function($delegate) {
+ // drop the default ngClick directive
+ $delegate.shift();
+ return $delegate;
+ }]);
+}]);
+
+ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
+ function($parse, $timeout, $rootElement) {
+ var TAP_DURATION = 750; // Shorter than 750ms is a tap, longer is a taphold or drag.
+ var MOVE_TOLERANCE = 12; // 12px seems to work in most mobile browsers.
+ var PREVENT_DURATION = 2500; // 2.5 seconds maximum from preventGhostClick call to click
+ var CLICKBUSTER_THRESHOLD = 25; // 25 pixels in any dimension is the limit for busting clicks.
+
+ var ACTIVE_CLASS_NAME = 'ng-click-active';
+ var lastPreventedTime;
+ var touchCoordinates;
+ var lastLabelClickCoordinates;
+
+
+ // TAP EVENTS AND GHOST CLICKS
+ //
+ // Why tap events?
+ // Mobile browsers detect a tap, then wait a moment (usually ~300ms) to see if you're
+ // double-tapping, and then fire a click event.
+ //
+ // This delay sucks and makes mobile apps feel unresponsive.
+ // So we detect touchstart, touchcancel and touchend ourselves and determine when
+ // the user has tapped on something.
+ //
+ // What happens when the browser then generates a click event?
+ // The browser, of course, also detects the tap and fires a click after a delay. This results in
+ // tapping/clicking twice. We do "clickbusting" to prevent it.
+ //
+ // How does it work?
+ // We attach global touchstart and click handlers, that run during the capture (early) phase.
+ // So the sequence for a tap is:
+ // - global touchstart: Sets an "allowable region" at the point touched.
+ // - element's touchstart: Starts a touch
+ // (- touchcancel ends the touch, no click follows)
+ // - element's touchend: Determines if the tap is valid (didn't move too far away, didn't hold
+ // too long) and fires the user's tap handler. The touchend also calls preventGhostClick().
+ // - preventGhostClick() removes the allowable region the global touchstart created.
+ // - The browser generates a click event.
+ // - The global click handler catches the click, and checks whether it was in an allowable region.
+ // - If preventGhostClick was called, the region will have been removed, the click is busted.
+ // - If the region is still there, the click proceeds normally. Therefore clicks on links and
+ // other elements without ngTap on them work normally.
+ //
+ // This is an ugly, terrible hack!
+ // Yeah, tell me about it. The alternatives are using the slow click events, or making our users
+ // deal with the ghost clicks, so I consider this the least of evils. Fortunately Angular
+ // encapsulates this ugly logic away from the user.
+ //
+ // Why not just put click handlers on the element?
+ // We do that too, just to be sure. If the tap event caused the DOM to change,
+ // it is possible another element is now in that position. To take account for these possibly
+ // distinct elements, the handlers are global and care only about coordinates.
+
+ // Checks if the coordinates are close enough to be within the region.
+ function hit(x1, y1, x2, y2) {
+ return Math.abs(x1 - x2) < CLICKBUSTER_THRESHOLD && Math.abs(y1 - y2) < CLICKBUSTER_THRESHOLD;
+ }
+
+ // Checks a list of allowable regions against a click location.
+ // Returns true if the click should be allowed.
+ // Splices out the allowable region from the list after it has been used.
+ function checkAllowableRegions(touchCoordinates, x, y) {
+ for (var i = 0; i < touchCoordinates.length; i += 2) {
+ if (hit(touchCoordinates[i], touchCoordinates[i + 1], x, y)) {
+ touchCoordinates.splice(i, i + 2);
+ return true; // allowable region
+ }
+ }
+ return false; // No allowable region; bust it.
+ }
+
+ // Global click handler that prevents the click if it's in a bustable zone and preventGhostClick
+ // was called recently.
+ function onClick(event) {
+ if (Date.now() - lastPreventedTime > PREVENT_DURATION) {
+ return; // Too old.
+ }
+
+ var touches = event.touches && event.touches.length ? event.touches : [event];
+ var x = touches[0].clientX;
+ var y = touches[0].clientY;
+ // Work around desktop Webkit quirk where clicking a label will fire two clicks (on the label
+ // and on the input element). Depending on the exact browser, this second click we don't want
+ // to bust has either (0,0), negative coordinates, or coordinates equal to triggering label
+ // click event
+ if (x < 1 && y < 1) {
+ return; // offscreen
+ }
+ if (lastLabelClickCoordinates &&
+ lastLabelClickCoordinates[0] === x && lastLabelClickCoordinates[1] === y) {
+ return; // input click triggered by label click
+ }
+ // reset label click coordinates on first subsequent click
+ if (lastLabelClickCoordinates) {
+ lastLabelClickCoordinates = null;
+ }
+ // remember label click coordinates to prevent click busting of trigger click event on input
+ if (nodeName_(event.target) === 'label') {
+ lastLabelClickCoordinates = [x, y];
+ }
+
+ // Look for an allowable region containing this click.
+ // If we find one, that means it was created by touchstart and not removed by
+ // preventGhostClick, so we don't bust it.
+ if (checkAllowableRegions(touchCoordinates, x, y)) {
+ return;
+ }
+
+ // If we didn't find an allowable region, bust the click.
+ event.stopPropagation();
+ event.preventDefault();
+
+ // Blur focused form elements
+ event.target && event.target.blur && event.target.blur();
+ }
+
+
+ // Global touchstart handler that creates an allowable region for a click event.
+ // This allowable region can be removed by preventGhostClick if we want to bust it.
+ function onTouchStart(event) {
+ var touches = event.touches && event.touches.length ? event.touches : [event];
+ var x = touches[0].clientX;
+ var y = touches[0].clientY;
+ touchCoordinates.push(x, y);
+
+ $timeout(function() {
+ // Remove the allowable region.
+ for (var i = 0; i < touchCoordinates.length; i += 2) {
+ if (touchCoordinates[i] == x && touchCoordinates[i + 1] == y) {
+ touchCoordinates.splice(i, i + 2);
+ return;
+ }
+ }
+ }, PREVENT_DURATION, false);
+ }
+
+ // On the first call, attaches some event handlers. Then whenever it gets called, it creates a
+ // zone around the touchstart where clicks will get busted.
+ function preventGhostClick(x, y) {
+ if (!touchCoordinates) {
+ $rootElement[0].addEventListener('click', onClick, true);
+ $rootElement[0].addEventListener('touchstart', onTouchStart, true);
+ touchCoordinates = [];
+ }
+
+ lastPreventedTime = Date.now();
+
+ checkAllowableRegions(touchCoordinates, x, y);
+ }
+
+ // Actual linking function.
+ return function(scope, element, attr) {
+ var clickHandler = $parse(attr.ngClick),
+ tapping = false,
+ tapElement, // Used to blur the element after a tap.
+ startTime, // Used to check if the tap was held too long.
+ touchStartX,
+ touchStartY;
+
+ function resetState() {
+ tapping = false;
+ element.removeClass(ACTIVE_CLASS_NAME);
+ }
+
+ element.on('touchstart', function(event) {
+ tapping = true;
+ tapElement = event.target ? event.target : event.srcElement; // IE uses srcElement.
+ // Hack for Safari, which can target text nodes instead of containers.
+ if (tapElement.nodeType == 3) {
+ tapElement = tapElement.parentNode;
+ }
+
+ element.addClass(ACTIVE_CLASS_NAME);
+
+ startTime = Date.now();
+
+ // Use jQuery originalEvent
+ var originalEvent = event.originalEvent || event;
+ var touches = originalEvent.touches && originalEvent.touches.length ? originalEvent.touches : [originalEvent];
+ var e = touches[0];
+ touchStartX = e.clientX;
+ touchStartY = e.clientY;
+ });
+
+ element.on('touchcancel', function(event) {
+ resetState();
+ });
+
+ element.on('touchend', function(event) {
+ var diff = Date.now() - startTime;
+
+ // Use jQuery originalEvent
+ var originalEvent = event.originalEvent || event;
+ var touches = (originalEvent.changedTouches && originalEvent.changedTouches.length) ?
+ originalEvent.changedTouches :
+ ((originalEvent.touches && originalEvent.touches.length) ? originalEvent.touches : [originalEvent]);
+ var e = touches[0];
+ var x = e.clientX;
+ var y = e.clientY;
+ var dist = Math.sqrt(Math.pow(x - touchStartX, 2) + Math.pow(y - touchStartY, 2));
+
+ if (tapping && diff < TAP_DURATION && dist < MOVE_TOLERANCE) {
+ // Call preventGhostClick so the clickbuster will catch the corresponding click.
+ preventGhostClick(x, y);
+
+ // Blur the focused element (the button, probably) before firing the callback.
+ // This doesn't work perfectly on Android Chrome, but seems to work elsewhere.
+ // I couldn't get anything to work reliably on Android Chrome.
+ if (tapElement) {
+ tapElement.blur();
+ }
+
+ if (!angular.isDefined(attr.disabled) || attr.disabled === false) {
+ element.triggerHandler('click', [event]);
+ }
+ }
+
+ resetState();
+ });
+
+ // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click
+ // something else nearby.
+ element.onclick = function(event) { };
+
+ // Actual click handler.
+ // There are three different kinds of clicks, only two of which reach this point.
+ // - On desktop browsers without touch events, their clicks will always come here.
+ // - On mobile browsers, the simulated "fast" click will call this.
+ // - But the browser's follow-up slow click will be "busted" before it reaches this handler.
+ // Therefore it's safe to use this directive on both mobile and desktop.
+ element.on('click', function(event, touchend) {
+ scope.$apply(function() {
+ clickHandler(scope, {$event: (touchend || event)});
+ });
+ });
+
+ element.on('mousedown', function(event) {
+ element.addClass(ACTIVE_CLASS_NAME);
+ });
+
+ element.on('mousemove mouseup', function(event) {
+ element.removeClass(ACTIVE_CLASS_NAME);
+ });
+
+ };
+}]);
+
+/* global ngTouch: false */
+
+/**
+ * @ngdoc directive
+ * @name ngSwipeLeft
+ *
+ * @description
+ * Specify custom behavior when an element is swiped to the left on a touchscreen device.
+ * A leftward swipe is a quick, right-to-left slide of the finger.
+ * Though ngSwipeLeft is designed for touch-based devices, it will work with a mouse click and drag
+ * too.
+ *
+ * To disable the mouse click and drag functionality, add `ng-swipe-disable-mouse` to
+ * the `ng-swipe-left` or `ng-swipe-right` DOM Element.
+ *
+ * Requires the {@link ngTouch `ngTouch`} module to be installed.
+ *
+ * @element ANY
+ * @param {expression} ngSwipeLeft {@link guide/expression Expression} to evaluate
+ * upon left swipe. (Event object is available as `$event`)
+ *
+ * @example
+ <example module="ngSwipeLeftExample" deps="angular-touch.js">
+ <file name="index.html">
+ <div ng-show="!showActions" ng-swipe-left="showActions = true">
+ Some list content, like an email in the inbox
+ </div>
+ <div ng-show="showActions" ng-swipe-right="showActions = false">
+ <button ng-click="reply()">Reply</button>
+ <button ng-click="delete()">Delete</button>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('ngSwipeLeftExample', ['ngTouch']);
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngSwipeRight
+ *
+ * @description
+ * Specify custom behavior when an element is swiped to the right on a touchscreen device.
+ * A rightward swipe is a quick, left-to-right slide of the finger.
+ * Though ngSwipeRight is designed for touch-based devices, it will work with a mouse click and drag
+ * too.
+ *
+ * Requires the {@link ngTouch `ngTouch`} module to be installed.
+ *
+ * @element ANY
+ * @param {expression} ngSwipeRight {@link guide/expression Expression} to evaluate
+ * upon right swipe. (Event object is available as `$event`)
+ *
+ * @example
+ <example module="ngSwipeRightExample" deps="angular-touch.js">
+ <file name="index.html">
+ <div ng-show="!showActions" ng-swipe-left="showActions = true">
+ Some list content, like an email in the inbox
+ </div>
+ <div ng-show="showActions" ng-swipe-right="showActions = false">
+ <button ng-click="reply()">Reply</button>
+ <button ng-click="delete()">Delete</button>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('ngSwipeRightExample', ['ngTouch']);
+ </file>
+ </example>
+ */
+
+function makeSwipeDirective(directiveName, direction, eventName) {
+ ngTouch.directive(directiveName, ['$parse', '$swipe', function($parse, $swipe) {
+ // The maximum vertical delta for a swipe should be less than 75px.
+ var MAX_VERTICAL_DISTANCE = 75;
+ // Vertical distance should not be more than a fraction of the horizontal distance.
+ var MAX_VERTICAL_RATIO = 0.3;
+ // At least a 30px lateral motion is necessary for a swipe.
+ var MIN_HORIZONTAL_DISTANCE = 30;
+
+ return function(scope, element, attr) {
+ var swipeHandler = $parse(attr[directiveName]);
+
+ var startCoords, valid;
+
+ function validSwipe(coords) {
+ // Check that it's within the coordinates.
+ // Absolute vertical distance must be within tolerances.
+ // Horizontal distance, we take the current X - the starting X.
+ // This is negative for leftward swipes and positive for rightward swipes.
+ // After multiplying by the direction (-1 for left, +1 for right), legal swipes
+ // (ie. same direction as the directive wants) will have a positive delta and
+ // illegal ones a negative delta.
+ // Therefore this delta must be positive, and larger than the minimum.
+ if (!startCoords) return false;
+ var deltaY = Math.abs(coords.y - startCoords.y);
+ var deltaX = (coords.x - startCoords.x) * direction;
+ return valid && // Short circuit for already-invalidated swipes.
+ deltaY < MAX_VERTICAL_DISTANCE &&
+ deltaX > 0 &&
+ deltaX > MIN_HORIZONTAL_DISTANCE &&
+ deltaY / deltaX < MAX_VERTICAL_RATIO;
+ }
+
+ var pointerTypes = ['touch'];
+ if (!angular.isDefined(attr['ngSwipeDisableMouse'])) {
+ pointerTypes.push('mouse');
+ }
+ $swipe.bind(element, {
+ 'start': function(coords, event) {
+ startCoords = coords;
+ valid = true;
+ },
+ 'cancel': function(event) {
+ valid = false;
+ },
+ 'end': function(coords, event) {
+ if (validSwipe(coords)) {
+ scope.$apply(function() {
+ element.triggerHandler(eventName);
+ swipeHandler(scope, {$event: event});
+ });
+ }
+ }
+ }, pointerTypes);
+ };
+ }]);
+}
+
+// Left is negative X-coordinate, right is positive.
+makeSwipeDirective('ngSwipeLeft', -1, 'swipeleft');
+makeSwipeDirective('ngSwipeRight', 1, 'swiperight');
+
+
+
+})(window, window.angular);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular.js
new file mode 100644
index 00000000..132234b6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular.js
@@ -0,0 +1,22024 @@
+/**
+ * @license AngularJS v1.2.25
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, document, undefined) {'use strict';
+
+/**
+ * @description
+ *
+ * This object provides a utility for producing rich Error messages within
+ * Angular. It can be called as follows:
+ *
+ * var exampleMinErr = minErr('example');
+ * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
+ *
+ * The above creates an instance of minErr in the example namespace. The
+ * resulting error will have a namespaced error code of example.one. The
+ * resulting error will replace {0} with the value of foo, and {1} with the
+ * value of bar. The object is not restricted in the number of arguments it can
+ * take.
+ *
+ * If fewer arguments are specified than necessary for interpolation, the extra
+ * interpolation markers will be preserved in the final string.
+ *
+ * Since data will be parsed statically during a build step, some restrictions
+ * are applied with respect to how minErr instances are created and called.
+ * Instances should have names of the form namespaceMinErr for a minErr created
+ * using minErr('namespace') . Error codes, namespaces and template strings
+ * should all be static strings, not variables or general expressions.
+ *
+ * @param {string} module The namespace to use for the new minErr instance.
+ * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
+ */
+
+function minErr(module) {
+ return function () {
+ var code = arguments[0],
+ prefix = '[' + (module ? module + ':' : '') + code + '] ',
+ template = arguments[1],
+ templateArgs = arguments,
+ stringify = function (obj) {
+ if (typeof obj === 'function') {
+ return obj.toString().replace(/ \{[\s\S]*$/, '');
+ } else if (typeof obj === 'undefined') {
+ return 'undefined';
+ } else if (typeof obj !== 'string') {
+ return JSON.stringify(obj);
+ }
+ return obj;
+ },
+ message, i;
+
+ message = prefix + template.replace(/\{\d+\}/g, function (match) {
+ var index = +match.slice(1, -1), arg;
+
+ if (index + 2 < templateArgs.length) {
+ arg = templateArgs[index + 2];
+ if (typeof arg === 'function') {
+ return arg.toString().replace(/ ?\{[\s\S]*$/, '');
+ } else if (typeof arg === 'undefined') {
+ return 'undefined';
+ } else if (typeof arg !== 'string') {
+ return toJson(arg);
+ }
+ return arg;
+ }
+ return match;
+ });
+
+ message = message + '\nhttp://errors.angularjs.org/1.2.25/' +
+ (module ? module + '/' : '') + code;
+ for (i = 2; i < arguments.length; i++) {
+ message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
+ encodeURIComponent(stringify(arguments[i]));
+ }
+
+ return new Error(message);
+ };
+}
+
+/* We need to tell jshint what variables are being exported */
+/* global angular: true,
+ msie: true,
+ jqLite: true,
+ jQuery: true,
+ slice: true,
+ push: true,
+ toString: true,
+ ngMinErr: true,
+ angularModule: true,
+ nodeName_: true,
+ uid: true,
+ VALIDITY_STATE_PROPERTY: true,
+
+ lowercase: true,
+ uppercase: true,
+ manualLowercase: true,
+ manualUppercase: true,
+ nodeName_: true,
+ isArrayLike: true,
+ forEach: true,
+ sortedKeys: true,
+ forEachSorted: true,
+ reverseParams: true,
+ nextUid: true,
+ setHashKey: true,
+ extend: true,
+ int: true,
+ inherit: true,
+ noop: true,
+ identity: true,
+ valueFn: true,
+ isUndefined: true,
+ isDefined: true,
+ isObject: true,
+ isString: true,
+ isNumber: true,
+ isDate: true,
+ isArray: true,
+ isFunction: true,
+ isRegExp: true,
+ isWindow: true,
+ isScope: true,
+ isFile: true,
+ isBlob: true,
+ isBoolean: true,
+ isPromiseLike: true,
+ trim: true,
+ isElement: true,
+ makeMap: true,
+ map: true,
+ size: true,
+ includes: true,
+ indexOf: true,
+ arrayRemove: true,
+ isLeafNode: true,
+ copy: true,
+ shallowCopy: true,
+ equals: true,
+ csp: true,
+ concat: true,
+ sliceArgs: true,
+ bind: true,
+ toJsonReplacer: true,
+ toJson: true,
+ fromJson: true,
+ toBoolean: true,
+ startingTag: true,
+ tryDecodeURIComponent: true,
+ parseKeyValue: true,
+ toKeyValue: true,
+ encodeUriSegment: true,
+ encodeUriQuery: true,
+ angularInit: true,
+ bootstrap: true,
+ snake_case: true,
+ bindJQuery: true,
+ assertArg: true,
+ assertArgFn: true,
+ assertNotHasOwnProperty: true,
+ getter: true,
+ getBlockElements: true,
+ hasOwnProperty: true,
+*/
+
+////////////////////////////////////
+
+/**
+ * @ngdoc module
+ * @name ng
+ * @module ng
+ * @description
+ *
+ * # ng (core module)
+ * The ng module is loaded by default when an AngularJS application is started. The module itself
+ * contains the essential components for an AngularJS application to function. The table below
+ * lists a high level breakdown of each of the services/factories, filters, directives and testing
+ * components available within this core module.
+ *
+ * <div doc-module-components="ng"></div>
+ */
+
+// The name of a form control's ValidityState property.
+// This is used so that it's possible for internal tests to create mock ValidityStates.
+var VALIDITY_STATE_PROPERTY = 'validity';
+
+/**
+ * @ngdoc function
+ * @name angular.lowercase
+ * @module ng
+ * @kind function
+ *
+ * @description Converts the specified string to lowercase.
+ * @param {string} string String to be converted to lowercase.
+ * @returns {string} Lowercased string.
+ */
+var lowercase = function(string){return isString(string) ? string.toLowerCase() : string;};
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * @ngdoc function
+ * @name angular.uppercase
+ * @module ng
+ * @kind function
+ *
+ * @description Converts the specified string to uppercase.
+ * @param {string} string String to be converted to uppercase.
+ * @returns {string} Uppercased string.
+ */
+var uppercase = function(string){return isString(string) ? string.toUpperCase() : string;};
+
+
+var manualLowercase = function(s) {
+ /* jshint bitwise: false */
+ return isString(s)
+ ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})
+ : s;
+};
+var manualUppercase = function(s) {
+ /* jshint bitwise: false */
+ return isString(s)
+ ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})
+ : s;
+};
+
+
+// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish
+// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods
+// with correct but slower alternatives.
+if ('i' !== 'I'.toLowerCase()) {
+ lowercase = manualLowercase;
+ uppercase = manualUppercase;
+}
+
+
+var /** holds major version number for IE or NaN for real browsers */
+ msie,
+ jqLite, // delay binding since jQuery could be loaded after us.
+ jQuery, // delay binding
+ slice = [].slice,
+ push = [].push,
+ toString = Object.prototype.toString,
+ ngMinErr = minErr('ng'),
+
+ /** @name angular */
+ angular = window.angular || (window.angular = {}),
+ angularModule,
+ nodeName_,
+ uid = ['0', '0', '0'];
+
+/**
+ * IE 11 changed the format of the UserAgent string.
+ * See http://msdn.microsoft.com/en-us/library/ms537503.aspx
+ */
+msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]);
+if (isNaN(msie)) {
+ msie = int((/trident\/.*; rv:(\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]);
+}
+
+
+/**
+ * @private
+ * @param {*} obj
+ * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments,
+ * String ...)
+ */
+function isArrayLike(obj) {
+ if (obj == null || isWindow(obj)) {
+ return false;
+ }
+
+ var length = obj.length;
+
+ if (obj.nodeType === 1 && length) {
+ return true;
+ }
+
+ return isString(obj) || isArray(obj) || length === 0 ||
+ typeof length === 'number' && length > 0 && (length - 1) in obj;
+}
+
+/**
+ * @ngdoc function
+ * @name angular.forEach
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Invokes the `iterator` function once for each item in `obj` collection, which can be either an
+ * object or an array. The `iterator` function is invoked with `iterator(value, key)`, where `value`
+ * is the value of an object property or an array element and `key` is the object property key or
+ * array element index. Specifying a `context` for the function is optional.
+ *
+ * It is worth noting that `.forEach` does not iterate over inherited properties because it filters
+ * using the `hasOwnProperty` method.
+ *
+ ```js
+ var values = {name: 'misko', gender: 'male'};
+ var log = [];
+ angular.forEach(values, function(value, key) {
+ this.push(key + ': ' + value);
+ }, log);
+ expect(log).toEqual(['name: misko', 'gender: male']);
+ ```
+ *
+ * @param {Object|Array} obj Object to iterate over.
+ * @param {Function} iterator Iterator function.
+ * @param {Object=} context Object to become context (`this`) for the iterator function.
+ * @returns {Object|Array} Reference to `obj`.
+ */
+function forEach(obj, iterator, context) {
+ var key;
+ if (obj) {
+ if (isFunction(obj)) {
+ for (key in obj) {
+ // Need to check if hasOwnProperty exists,
+ // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
+ if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {
+ iterator.call(context, obj[key], key);
+ }
+ }
+ } else if (isArray(obj) || isArrayLike(obj)) {
+ for (key = 0; key < obj.length; key++) {
+ iterator.call(context, obj[key], key);
+ }
+ } else if (obj.forEach && obj.forEach !== forEach) {
+ obj.forEach(iterator, context);
+ } else {
+ for (key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ iterator.call(context, obj[key], key);
+ }
+ }
+ }
+ }
+ return obj;
+}
+
+function sortedKeys(obj) {
+ var keys = [];
+ for (var key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ keys.push(key);
+ }
+ }
+ return keys.sort();
+}
+
+function forEachSorted(obj, iterator, context) {
+ var keys = sortedKeys(obj);
+ for ( var i = 0; i < keys.length; i++) {
+ iterator.call(context, obj[keys[i]], keys[i]);
+ }
+ return keys;
+}
+
+
+/**
+ * when using forEach the params are value, key, but it is often useful to have key, value.
+ * @param {function(string, *)} iteratorFn
+ * @returns {function(*, string)}
+ */
+function reverseParams(iteratorFn) {
+ return function(value, key) { iteratorFn(key, value); };
+}
+
+/**
+ * A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric
+ * characters such as '012ABC'. The reason why we are not using simply a number counter is that
+ * the number string gets longer over time, and it can also overflow, where as the nextId
+ * will grow much slower, it is a string, and it will never overflow.
+ *
+ * @returns {string} an unique alpha-numeric string
+ */
+function nextUid() {
+ var index = uid.length;
+ var digit;
+
+ while(index) {
+ index--;
+ digit = uid[index].charCodeAt(0);
+ if (digit == 57 /*'9'*/) {
+ uid[index] = 'A';
+ return uid.join('');
+ }
+ if (digit == 90 /*'Z'*/) {
+ uid[index] = '0';
+ } else {
+ uid[index] = String.fromCharCode(digit + 1);
+ return uid.join('');
+ }
+ }
+ uid.unshift('0');
+ return uid.join('');
+}
+
+
+/**
+ * Set or clear the hashkey for an object.
+ * @param obj object
+ * @param h the hashkey (!truthy to delete the hashkey)
+ */
+function setHashKey(obj, h) {
+ if (h) {
+ obj.$$hashKey = h;
+ }
+ else {
+ delete obj.$$hashKey;
+ }
+}
+
+/**
+ * @ngdoc function
+ * @name angular.extend
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Extends the destination object `dst` by copying all of the properties from the `src` object(s)
+ * to `dst`. You can specify multiple `src` objects.
+ *
+ * @param {Object} dst Destination object.
+ * @param {...Object} src Source object(s).
+ * @returns {Object} Reference to `dst`.
+ */
+function extend(dst) {
+ var h = dst.$$hashKey;
+ forEach(arguments, function(obj) {
+ if (obj !== dst) {
+ forEach(obj, function(value, key) {
+ dst[key] = value;
+ });
+ }
+ });
+
+ setHashKey(dst,h);
+ return dst;
+}
+
+function int(str) {
+ return parseInt(str, 10);
+}
+
+
+function inherit(parent, extra) {
+ return extend(new (extend(function() {}, {prototype:parent}))(), extra);
+}
+
+/**
+ * @ngdoc function
+ * @name angular.noop
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * A function that performs no operations. This function can be useful when writing code in the
+ * functional style.
+ ```js
+ function foo(callback) {
+ var result = calculateResult();
+ (callback || angular.noop)(result);
+ }
+ ```
+ */
+function noop() {}
+noop.$inject = [];
+
+
+/**
+ * @ngdoc function
+ * @name angular.identity
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * A function that returns its first argument. This function is useful when writing code in the
+ * functional style.
+ *
+ ```js
+ function transformer(transformationFn, value) {
+ return (transformationFn || angular.identity)(value);
+ };
+ ```
+ */
+function identity($) {return $;}
+identity.$inject = [];
+
+
+function valueFn(value) {return function() {return value;};}
+
+/**
+ * @ngdoc function
+ * @name angular.isUndefined
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is undefined.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is undefined.
+ */
+function isUndefined(value){return typeof value === 'undefined';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isDefined
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is defined.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is defined.
+ */
+function isDefined(value){return typeof value !== 'undefined';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isObject
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not
+ * considered to be objects. Note that JavaScript arrays are objects.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is an `Object` but not `null`.
+ */
+function isObject(value){return value != null && typeof value === 'object';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isString
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `String`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `String`.
+ */
+function isString(value){return typeof value === 'string';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isNumber
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `Number`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Number`.
+ */
+function isNumber(value){return typeof value === 'number';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isDate
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a value is a date.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Date`.
+ */
+function isDate(value) {
+ return toString.call(value) === '[object Date]';
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isArray
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is an `Array`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is an `Array`.
+ */
+var isArray = (function() {
+ if (!isFunction(Array.isArray)) {
+ return function(value) {
+ return toString.call(value) === '[object Array]';
+ };
+ }
+ return Array.isArray;
+})();
+
+/**
+ * @ngdoc function
+ * @name angular.isFunction
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `Function`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Function`.
+ */
+function isFunction(value){return typeof value === 'function';}
+
+
+/**
+ * Determines if a value is a regular expression object.
+ *
+ * @private
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `RegExp`.
+ */
+function isRegExp(value) {
+ return toString.call(value) === '[object RegExp]';
+}
+
+
+/**
+ * Checks if `obj` is a window object.
+ *
+ * @private
+ * @param {*} obj Object to check
+ * @returns {boolean} True if `obj` is a window obj.
+ */
+function isWindow(obj) {
+ return obj && obj.document && obj.location && obj.alert && obj.setInterval;
+}
+
+
+function isScope(obj) {
+ return obj && obj.$evalAsync && obj.$watch;
+}
+
+
+function isFile(obj) {
+ return toString.call(obj) === '[object File]';
+}
+
+
+function isBlob(obj) {
+ return toString.call(obj) === '[object Blob]';
+}
+
+
+function isBoolean(value) {
+ return typeof value === 'boolean';
+}
+
+
+function isPromiseLike(obj) {
+ return obj && isFunction(obj.then);
+}
+
+
+var trim = (function() {
+ // native trim is way faster: http://jsperf.com/angular-trim-test
+ // but IE doesn't have it... :-(
+ // TODO: we should move this into IE/ES5 polyfill
+ if (!String.prototype.trim) {
+ return function(value) {
+ return isString(value) ? value.replace(/^\s\s*/, '').replace(/\s\s*$/, '') : value;
+ };
+ }
+ return function(value) {
+ return isString(value) ? value.trim() : value;
+ };
+})();
+
+
+/**
+ * @ngdoc function
+ * @name angular.isElement
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a DOM element (or wrapped jQuery element).
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).
+ */
+function isElement(node) {
+ return !!(node &&
+ (node.nodeName // we are a direct element
+ || (node.prop && node.attr && node.find))); // we have an on and find method part of jQuery API
+}
+
+/**
+ * @param str 'key1,key2,...'
+ * @returns {object} in the form of {key1:true, key2:true, ...}
+ */
+function makeMap(str) {
+ var obj = {}, items = str.split(","), i;
+ for ( i = 0; i < items.length; i++ )
+ obj[ items[i] ] = true;
+ return obj;
+}
+
+
+if (msie < 9) {
+ nodeName_ = function(element) {
+ element = element.nodeName ? element : element[0];
+ return (element.scopeName && element.scopeName != 'HTML')
+ ? uppercase(element.scopeName + ':' + element.nodeName) : element.nodeName;
+ };
+} else {
+ nodeName_ = function(element) {
+ return element.nodeName ? element.nodeName : element[0].nodeName;
+ };
+}
+
+
+function map(obj, iterator, context) {
+ var results = [];
+ forEach(obj, function(value, index, list) {
+ results.push(iterator.call(context, value, index, list));
+ });
+ return results;
+}
+
+
+/**
+ * @description
+ * Determines the number of elements in an array, the number of properties an object has, or
+ * the length of a string.
+ *
+ * Note: This function is used to augment the Object type in Angular expressions. See
+ * {@link angular.Object} for more information about Angular arrays.
+ *
+ * @param {Object|Array|string} obj Object, array, or string to inspect.
+ * @param {boolean} [ownPropsOnly=false] Count only "own" properties in an object
+ * @returns {number} The size of `obj` or `0` if `obj` is neither an object nor an array.
+ */
+function size(obj, ownPropsOnly) {
+ var count = 0, key;
+
+ if (isArray(obj) || isString(obj)) {
+ return obj.length;
+ } else if (isObject(obj)) {
+ for (key in obj)
+ if (!ownPropsOnly || obj.hasOwnProperty(key))
+ count++;
+ }
+
+ return count;
+}
+
+
+function includes(array, obj) {
+ return indexOf(array, obj) != -1;
+}
+
+function indexOf(array, obj) {
+ if (array.indexOf) return array.indexOf(obj);
+
+ for (var i = 0; i < array.length; i++) {
+ if (obj === array[i]) return i;
+ }
+ return -1;
+}
+
+function arrayRemove(array, value) {
+ var index = indexOf(array, value);
+ if (index >=0)
+ array.splice(index, 1);
+ return value;
+}
+
+function isLeafNode (node) {
+ if (node) {
+ switch (node.nodeName) {
+ case "OPTION":
+ case "PRE":
+ case "TITLE":
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+ * @ngdoc function
+ * @name angular.copy
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Creates a deep copy of `source`, which should be an object or an array.
+ *
+ * * If no destination is supplied, a copy of the object or array is created.
+ * * If a destination is provided, all of its elements (for array) or properties (for objects)
+ * are deleted and then all elements/properties from the source are copied to it.
+ * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.
+ * * If `source` is identical to 'destination' an exception will be thrown.
+ *
+ * @param {*} source The source that will be used to make a copy.
+ * Can be any type, including primitives, `null`, and `undefined`.
+ * @param {(Object|Array)=} destination Destination into which the source is copied. If
+ * provided, must be of the same type as `source`.
+ * @returns {*} The copy or updated `destination`, if `destination` was specified.
+ *
+ * @example
+ <example module="copyExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form novalidate class="simple-form">
+ Name: <input type="text" ng-model="user.name" /><br />
+ E-mail: <input type="email" ng-model="user.email" /><br />
+ Gender: <input type="radio" ng-model="user.gender" value="male" />male
+ <input type="radio" ng-model="user.gender" value="female" />female<br />
+ <button ng-click="reset()">RESET</button>
+ <button ng-click="update(user)">SAVE</button>
+ </form>
+ <pre>form = {{user | json}}</pre>
+ <pre>master = {{master | json}}</pre>
+ </div>
+
+ <script>
+ angular.module('copyExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.master= {};
+
+ $scope.update = function(user) {
+ // Example with 1 argument
+ $scope.master= angular.copy(user);
+ };
+
+ $scope.reset = function() {
+ // Example with 2 arguments
+ angular.copy($scope.master, $scope.user);
+ };
+
+ $scope.reset();
+ }]);
+ </script>
+ </file>
+ </example>
+ */
+function copy(source, destination, stackSource, stackDest) {
+ if (isWindow(source) || isScope(source)) {
+ throw ngMinErr('cpws',
+ "Can't copy! Making copies of Window or Scope instances is not supported.");
+ }
+
+ if (!destination) {
+ destination = source;
+ if (source) {
+ if (isArray(source)) {
+ destination = copy(source, [], stackSource, stackDest);
+ } else if (isDate(source)) {
+ destination = new Date(source.getTime());
+ } else if (isRegExp(source)) {
+ destination = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
+ destination.lastIndex = source.lastIndex;
+ } else if (isObject(source)) {
+ destination = copy(source, {}, stackSource, stackDest);
+ }
+ }
+ } else {
+ if (source === destination) throw ngMinErr('cpi',
+ "Can't copy! Source and destination are identical.");
+
+ stackSource = stackSource || [];
+ stackDest = stackDest || [];
+
+ if (isObject(source)) {
+ var index = indexOf(stackSource, source);
+ if (index !== -1) return stackDest[index];
+
+ stackSource.push(source);
+ stackDest.push(destination);
+ }
+
+ var result;
+ if (isArray(source)) {
+ destination.length = 0;
+ for ( var i = 0; i < source.length; i++) {
+ result = copy(source[i], null, stackSource, stackDest);
+ if (isObject(source[i])) {
+ stackSource.push(source[i]);
+ stackDest.push(result);
+ }
+ destination.push(result);
+ }
+ } else {
+ var h = destination.$$hashKey;
+ if (isArray(destination)) {
+ destination.length = 0;
+ } else {
+ forEach(destination, function(value, key) {
+ delete destination[key];
+ });
+ }
+ for ( var key in source) {
+ result = copy(source[key], null, stackSource, stackDest);
+ if (isObject(source[key])) {
+ stackSource.push(source[key]);
+ stackDest.push(result);
+ }
+ destination[key] = result;
+ }
+ setHashKey(destination,h);
+ }
+
+ }
+ return destination;
+}
+
+/**
+ * Creates a shallow copy of an object, an array or a primitive
+ */
+function shallowCopy(src, dst) {
+ if (isArray(src)) {
+ dst = dst || [];
+
+ for ( var i = 0; i < src.length; i++) {
+ dst[i] = src[i];
+ }
+ } else if (isObject(src)) {
+ dst = dst || {};
+
+ for (var key in src) {
+ if (hasOwnProperty.call(src, key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
+ dst[key] = src[key];
+ }
+ }
+ }
+
+ return dst || src;
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.equals
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if two objects or two values are equivalent. Supports value types, regular
+ * expressions, arrays and objects.
+ *
+ * Two objects or values are considered equivalent if at least one of the following is true:
+ *
+ * * Both objects or values pass `===` comparison.
+ * * Both objects or values are of the same type and all of their properties are equal by
+ * comparing them with `angular.equals`.
+ * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal)
+ * * Both values represent the same regular expression (In JavaScript,
+ * /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual
+ * representation matches).
+ *
+ * During a property comparison, properties of `function` type and properties with names
+ * that begin with `$` are ignored.
+ *
+ * Scope and DOMWindow objects are being compared only by identify (`===`).
+ *
+ * @param {*} o1 Object or value to compare.
+ * @param {*} o2 Object or value to compare.
+ * @returns {boolean} True if arguments are equal.
+ */
+function equals(o1, o2) {
+ if (o1 === o2) return true;
+ if (o1 === null || o2 === null) return false;
+ if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
+ var t1 = typeof o1, t2 = typeof o2, length, key, keySet;
+ if (t1 == t2) {
+ if (t1 == 'object') {
+ if (isArray(o1)) {
+ if (!isArray(o2)) return false;
+ if ((length = o1.length) == o2.length) {
+ for(key=0; key<length; key++) {
+ if (!equals(o1[key], o2[key])) return false;
+ }
+ return true;
+ }
+ } else if (isDate(o1)) {
+ if (!isDate(o2)) return false;
+ return (isNaN(o1.getTime()) && isNaN(o2.getTime())) || (o1.getTime() === o2.getTime());
+ } else if (isRegExp(o1) && isRegExp(o2)) {
+ return o1.toString() == o2.toString();
+ } else {
+ if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || isArray(o2)) return false;
+ keySet = {};
+ for(key in o1) {
+ if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
+ if (!equals(o1[key], o2[key])) return false;
+ keySet[key] = true;
+ }
+ for(key in o2) {
+ if (!keySet.hasOwnProperty(key) &&
+ key.charAt(0) !== '$' &&
+ o2[key] !== undefined &&
+ !isFunction(o2[key])) return false;
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+var csp = function() {
+ if (isDefined(csp.isActive_)) return csp.isActive_;
+
+ var active = !!(document.querySelector('[ng-csp]') ||
+ document.querySelector('[data-ng-csp]'));
+
+ if (!active) {
+ try {
+ /* jshint -W031, -W054 */
+ new Function('');
+ /* jshint +W031, +W054 */
+ } catch (e) {
+ active = true;
+ }
+ }
+
+ return (csp.isActive_ = active);
+};
+
+
+
+function concat(array1, array2, index) {
+ return array1.concat(slice.call(array2, index));
+}
+
+function sliceArgs(args, startIndex) {
+ return slice.call(args, startIndex || 0);
+}
+
+
+/* jshint -W101 */
+/**
+ * @ngdoc function
+ * @name angular.bind
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for
+ * `fn`). You can supply optional `args` that are prebound to the function. This feature is also
+ * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as
+ * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application).
+ *
+ * @param {Object} self Context which `fn` should be evaluated in.
+ * @param {function()} fn Function to be bound.
+ * @param {...*} args Optional arguments to be prebound to the `fn` function call.
+ * @returns {function()} Function that wraps the `fn` with all the specified bindings.
+ */
+/* jshint +W101 */
+function bind(self, fn) {
+ var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
+ if (isFunction(fn) && !(fn instanceof RegExp)) {
+ return curryArgs.length
+ ? function() {
+ return arguments.length
+ ? fn.apply(self, curryArgs.concat(slice.call(arguments, 0)))
+ : fn.apply(self, curryArgs);
+ }
+ : function() {
+ return arguments.length
+ ? fn.apply(self, arguments)
+ : fn.call(self);
+ };
+ } else {
+ // in IE, native methods are not functions so they cannot be bound (note: they don't need to be)
+ return fn;
+ }
+}
+
+
+function toJsonReplacer(key, value) {
+ var val = value;
+
+ if (typeof key === 'string' && key.charAt(0) === '$') {
+ val = undefined;
+ } else if (isWindow(value)) {
+ val = '$WINDOW';
+ } else if (value && document === value) {
+ val = '$DOCUMENT';
+ } else if (isScope(value)) {
+ val = '$SCOPE';
+ }
+
+ return val;
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.toJson
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Serializes input into a JSON-formatted string. Properties with leading $ characters will be
+ * stripped since angular uses this notation internally.
+ *
+ * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.
+ * @param {boolean=} pretty If set to true, the JSON output will contain newlines and whitespace.
+ * @returns {string|undefined} JSON-ified string representing `obj`.
+ */
+function toJson(obj, pretty) {
+ if (typeof obj === 'undefined') return undefined;
+ return JSON.stringify(obj, toJsonReplacer, pretty ? ' ' : null);
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.fromJson
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Deserializes a JSON string.
+ *
+ * @param {string} json JSON string to deserialize.
+ * @returns {Object|Array|string|number} Deserialized thingy.
+ */
+function fromJson(json) {
+ return isString(json)
+ ? JSON.parse(json)
+ : json;
+}
+
+
+function toBoolean(value) {
+ if (typeof value === 'function') {
+ value = true;
+ } else if (value && value.length !== 0) {
+ var v = lowercase("" + value);
+ value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]');
+ } else {
+ value = false;
+ }
+ return value;
+}
+
+/**
+ * @returns {string} Returns the string representation of the element.
+ */
+function startingTag(element) {
+ element = jqLite(element).clone();
+ try {
+ // turns out IE does not let you set .html() on elements which
+ // are not allowed to have children. So we just ignore it.
+ element.empty();
+ } catch(e) {}
+ // As Per DOM Standards
+ var TEXT_NODE = 3;
+ var elemHtml = jqLite('<div>').append(element).html();
+ try {
+ return element[0].nodeType === TEXT_NODE ? lowercase(elemHtml) :
+ elemHtml.
+ match(/^(<[^>]+>)/)[1].
+ replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });
+ } catch(e) {
+ return lowercase(elemHtml);
+ }
+
+}
+
+
+/////////////////////////////////////////////////
+
+/**
+ * Tries to decode the URI component without throwing an exception.
+ *
+ * @private
+ * @param str value potential URI component to check.
+ * @returns {boolean} True if `value` can be decoded
+ * with the decodeURIComponent function.
+ */
+function tryDecodeURIComponent(value) {
+ try {
+ return decodeURIComponent(value);
+ } catch(e) {
+ // Ignore any invalid uri component
+ }
+}
+
+
+/**
+ * Parses an escaped url query string into key-value pairs.
+ * @returns {Object.<string,boolean|Array>}
+ */
+function parseKeyValue(/**string*/keyValue) {
+ var obj = {}, key_value, key;
+ forEach((keyValue || "").split('&'), function(keyValue) {
+ if ( keyValue ) {
+ key_value = keyValue.replace(/\+/g,'%20').split('=');
+ key = tryDecodeURIComponent(key_value[0]);
+ if ( isDefined(key) ) {
+ var val = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true;
+ if (!hasOwnProperty.call(obj, key)) {
+ obj[key] = val;
+ } else if(isArray(obj[key])) {
+ obj[key].push(val);
+ } else {
+ obj[key] = [obj[key],val];
+ }
+ }
+ }
+ });
+ return obj;
+}
+
+function toKeyValue(obj) {
+ var parts = [];
+ forEach(obj, function(value, key) {
+ if (isArray(value)) {
+ forEach(value, function(arrayValue) {
+ parts.push(encodeUriQuery(key, true) +
+ (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));
+ });
+ } else {
+ parts.push(encodeUriQuery(key, true) +
+ (value === true ? '' : '=' + encodeUriQuery(value, true)));
+ }
+ });
+ return parts.length ? parts.join('&') : '';
+}
+
+
+/**
+ * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
+ * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
+ * segments:
+ * segment = *pchar
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+function encodeUriSegment(val) {
+ return encodeUriQuery(val, true).
+ replace(/%26/gi, '&').
+ replace(/%3D/gi, '=').
+ replace(/%2B/gi, '+');
+}
+
+
+/**
+ * This method is intended for encoding *key* or *value* parts of query component. We need a custom
+ * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be
+ * encoded per http://tools.ietf.org/html/rfc3986:
+ * query = *( pchar / "/" / "?" )
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+function encodeUriQuery(val, pctEncodeSpaces) {
+ return encodeURIComponent(val).
+ replace(/%40/gi, '@').
+ replace(/%3A/gi, ':').
+ replace(/%24/g, '$').
+ replace(/%2C/gi, ',').
+ replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
+}
+
+
+/**
+ * @ngdoc directive
+ * @name ngApp
+ * @module ng
+ *
+ * @element ANY
+ * @param {angular.Module} ngApp an optional application
+ * {@link angular.module module} name to load.
+ *
+ * @description
+ *
+ * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive
+ * designates the **root element** of the application and is typically placed near the root element
+ * of the page - e.g. on the `<body>` or `<html>` tags.
+ *
+ * Only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`
+ * found in the document will be used to define the root element to auto-bootstrap as an
+ * application. To run multiple applications in an HTML document you must manually bootstrap them using
+ * {@link angular.bootstrap} instead. AngularJS applications cannot be nested within each other.
+ *
+ * You can specify an **AngularJS module** to be used as the root module for the application. This
+ * module will be loaded into the {@link auto.$injector} when the application is bootstrapped and
+ * should contain the application code needed or have dependencies on other modules that will
+ * contain the code. See {@link angular.module} for more information.
+ *
+ * In the example below if the `ngApp` directive were not placed on the `html` element then the
+ * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`
+ * would not be resolved to `3`.
+ *
+ * `ngApp` is the easiest, and most common, way to bootstrap an application.
+ *
+ <example module="ngAppDemo">
+ <file name="index.html">
+ <div ng-controller="ngAppDemoController">
+ I can add: {{a}} + {{b}} = {{ a+b }}
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {
+ $scope.a = 1;
+ $scope.b = 2;
+ });
+ </file>
+ </example>
+ *
+ */
+function angularInit(element, bootstrap) {
+ var elements = [element],
+ appElement,
+ module,
+ names = ['ng:app', 'ng-app', 'x-ng-app', 'data-ng-app'],
+ NG_APP_CLASS_REGEXP = /\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;
+
+ function append(element) {
+ element && elements.push(element);
+ }
+
+ forEach(names, function(name) {
+ names[name] = true;
+ append(document.getElementById(name));
+ name = name.replace(':', '\\:');
+ if (element.querySelectorAll) {
+ forEach(element.querySelectorAll('.' + name), append);
+ forEach(element.querySelectorAll('.' + name + '\\:'), append);
+ forEach(element.querySelectorAll('[' + name + ']'), append);
+ }
+ });
+
+ forEach(elements, function(element) {
+ if (!appElement) {
+ var className = ' ' + element.className + ' ';
+ var match = NG_APP_CLASS_REGEXP.exec(className);
+ if (match) {
+ appElement = element;
+ module = (match[2] || '').replace(/\s+/g, ',');
+ } else {
+ forEach(element.attributes, function(attr) {
+ if (!appElement && names[attr.name]) {
+ appElement = element;
+ module = attr.value;
+ }
+ });
+ }
+ }
+ });
+ if (appElement) {
+ bootstrap(appElement, module ? [module] : []);
+ }
+}
+
+/**
+ * @ngdoc function
+ * @name angular.bootstrap
+ * @module ng
+ * @description
+ * Use this function to manually start up angular application.
+ *
+ * See: {@link guide/bootstrap Bootstrap}
+ *
+ * Note that ngScenario-based end-to-end tests cannot use this function to bootstrap manually.
+ * They must use {@link ng.directive:ngApp ngApp}.
+ *
+ * Angular will detect if it has been loaded into the browser more than once and only allow the
+ * first loaded script to be bootstrapped and will report a warning to the browser console for
+ * each of the subsequent scripts. This prevents strange results in applications, where otherwise
+ * multiple instances of Angular try to work on the DOM.
+ *
+ * <example name="multi-bootstrap" module="multi-bootstrap">
+ * <file name="index.html">
+ * <script src="../../../angular.js"></script>
+ * <div ng-controller="BrokenTable">
+ * <table>
+ * <tr>
+ * <th ng-repeat="heading in headings">{{heading}}</th>
+ * </tr>
+ * <tr ng-repeat="filling in fillings">
+ * <td ng-repeat="fill in filling">{{fill}}</td>
+ * </tr>
+ * </table>
+ * </div>
+ * </file>
+ * <file name="controller.js">
+ * var app = angular.module('multi-bootstrap', [])
+ *
+ * .controller('BrokenTable', function($scope) {
+ * $scope.headings = ['One', 'Two', 'Three'];
+ * $scope.fillings = [[1, 2, 3], ['A', 'B', 'C'], [7, 8, 9]];
+ * });
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should only insert one table cell for each item in $scope.fillings', function() {
+ * expect(element.all(by.css('td')).count())
+ * .toBe(9);
+ * });
+ * </file>
+ * </example>
+ *
+ * @param {DOMElement} element DOM element which is the root of angular application.
+ * @param {Array<String|Function|Array>=} modules an array of modules to load into the application.
+ * Each item in the array should be the name of a predefined module or a (DI annotated)
+ * function that will be invoked by the injector as a run block.
+ * See: {@link angular.module modules}
+ * @returns {auto.$injector} Returns the newly created injector for this app.
+ */
+function bootstrap(element, modules) {
+ var doBootstrap = function() {
+ element = jqLite(element);
+
+ if (element.injector()) {
+ var tag = (element[0] === document) ? 'document' : startingTag(element);
+ //Encode angle brackets to prevent input from being sanitized to empty string #8683
+ throw ngMinErr(
+ 'btstrpd',
+ "App Already Bootstrapped with this Element '{0}'",
+ tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
+ }
+
+ modules = modules || [];
+ modules.unshift(['$provide', function($provide) {
+ $provide.value('$rootElement', element);
+ }]);
+ modules.unshift('ng');
+ var injector = createInjector(modules);
+ injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector', '$animate',
+ function(scope, element, compile, injector, animate) {
+ scope.$apply(function() {
+ element.data('$injector', injector);
+ compile(element)(scope);
+ });
+ }]
+ );
+ return injector;
+ };
+
+ var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
+
+ if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
+ return doBootstrap();
+ }
+
+ window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
+ angular.resumeBootstrap = function(extraModules) {
+ forEach(extraModules, function(module) {
+ modules.push(module);
+ });
+ doBootstrap();
+ };
+}
+
+var SNAKE_CASE_REGEXP = /[A-Z]/g;
+function snake_case(name, separator) {
+ separator = separator || '_';
+ return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
+ return (pos ? separator : '') + letter.toLowerCase();
+ });
+}
+
+function bindJQuery() {
+ // bind to jQuery if present;
+ jQuery = window.jQuery;
+ // Use jQuery if it exists with proper functionality, otherwise default to us.
+ // Angular 1.2+ requires jQuery 1.7.1+ for on()/off() support.
+ if (jQuery && jQuery.fn.on) {
+ jqLite = jQuery;
+ extend(jQuery.fn, {
+ scope: JQLitePrototype.scope,
+ isolateScope: JQLitePrototype.isolateScope,
+ controller: JQLitePrototype.controller,
+ injector: JQLitePrototype.injector,
+ inheritedData: JQLitePrototype.inheritedData
+ });
+ // Method signature:
+ // jqLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments)
+ jqLitePatchJQueryRemove('remove', true, true, false);
+ jqLitePatchJQueryRemove('empty', false, false, false);
+ jqLitePatchJQueryRemove('html', false, false, true);
+ } else {
+ jqLite = JQLite;
+ }
+ angular.element = jqLite;
+}
+
+/**
+ * throw error if the argument is falsy.
+ */
+function assertArg(arg, name, reason) {
+ if (!arg) {
+ throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
+ }
+ return arg;
+}
+
+function assertArgFn(arg, name, acceptArrayAnnotation) {
+ if (acceptArrayAnnotation && isArray(arg)) {
+ arg = arg[arg.length - 1];
+ }
+
+ assertArg(isFunction(arg), name, 'not a function, got ' +
+ (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg));
+ return arg;
+}
+
+/**
+ * throw error if the name given is hasOwnProperty
+ * @param {String} name the name to test
+ * @param {String} context the context in which the name is used, such as module or directive
+ */
+function assertNotHasOwnProperty(name, context) {
+ if (name === 'hasOwnProperty') {
+ throw ngMinErr('badname', "hasOwnProperty is not a valid {0} name", context);
+ }
+}
+
+/**
+ * Return the value accessible from the object by path. Any undefined traversals are ignored
+ * @param {Object} obj starting object
+ * @param {String} path path to traverse
+ * @param {boolean} [bindFnToScope=true]
+ * @returns {Object} value as accessible by path
+ */
+//TODO(misko): this function needs to be removed
+function getter(obj, path, bindFnToScope) {
+ if (!path) return obj;
+ var keys = path.split('.');
+ var key;
+ var lastInstance = obj;
+ var len = keys.length;
+
+ for (var i = 0; i < len; i++) {
+ key = keys[i];
+ if (obj) {
+ obj = (lastInstance = obj)[key];
+ }
+ }
+ if (!bindFnToScope && isFunction(obj)) {
+ return bind(lastInstance, obj);
+ }
+ return obj;
+}
+
+/**
+ * Return the DOM siblings between the first and last node in the given array.
+ * @param {Array} array like object
+ * @returns {DOMElement} object containing the elements
+ */
+function getBlockElements(nodes) {
+ var startNode = nodes[0],
+ endNode = nodes[nodes.length - 1];
+ if (startNode === endNode) {
+ return jqLite(startNode);
+ }
+
+ var element = startNode;
+ var elements = [element];
+
+ do {
+ element = element.nextSibling;
+ if (!element) break;
+ elements.push(element);
+ } while (element !== endNode);
+
+ return jqLite(elements);
+}
+
+/**
+ * @ngdoc type
+ * @name angular.Module
+ * @module ng
+ * @description
+ *
+ * Interface for configuring angular {@link angular.module modules}.
+ */
+
+function setupModuleLoader(window) {
+
+ var $injectorMinErr = minErr('$injector');
+ var ngMinErr = minErr('ng');
+
+ function ensure(obj, name, factory) {
+ return obj[name] || (obj[name] = factory());
+ }
+
+ var angular = ensure(window, 'angular', Object);
+
+ // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
+ angular.$$minErr = angular.$$minErr || minErr;
+
+ return ensure(angular, 'module', function() {
+ /** @type {Object.<string, angular.Module>} */
+ var modules = {};
+
+ /**
+ * @ngdoc function
+ * @name angular.module
+ * @module ng
+ * @description
+ *
+ * The `angular.module` is a global place for creating, registering and retrieving Angular
+ * modules.
+ * All modules (angular core or 3rd party) that should be available to an application must be
+ * registered using this mechanism.
+ *
+ * When passed two or more arguments, a new module is created. If passed only one argument, an
+ * existing module (the name passed as the first argument to `module`) is retrieved.
+ *
+ *
+ * # Module
+ *
+ * A module is a collection of services, directives, controllers, filters, and configuration information.
+ * `angular.module` is used to configure the {@link auto.$injector $injector}.
+ *
+ * ```js
+ * // Create a new module
+ * var myModule = angular.module('myModule', []);
+ *
+ * // register a new service
+ * myModule.value('appName', 'MyCoolApp');
+ *
+ * // configure existing services inside initialization blocks.
+ * myModule.config(['$locationProvider', function($locationProvider) {
+ * // Configure existing providers
+ * $locationProvider.hashPrefix('!');
+ * }]);
+ * ```
+ *
+ * Then you can create an injector and load your modules like this:
+ *
+ * ```js
+ * var injector = angular.injector(['ng', 'myModule'])
+ * ```
+ *
+ * However it's more likely that you'll just use
+ * {@link ng.directive:ngApp ngApp} or
+ * {@link angular.bootstrap} to simplify this process for you.
+ *
+ * @param {!string} name The name of the module to create or retrieve.
+ * @param {!Array.<string>=} requires If specified then new module is being created. If
+ * unspecified then the module is being retrieved for further configuration.
+ * @param {Function=} configFn Optional configuration function for the module. Same as
+ * {@link angular.Module#config Module#config()}.
+ * @returns {module} new module with the {@link angular.Module} api.
+ */
+ return function module(name, requires, configFn) {
+ var assertNotHasOwnProperty = function(name, context) {
+ if (name === 'hasOwnProperty') {
+ throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
+ }
+ };
+
+ assertNotHasOwnProperty(name, 'module');
+ if (requires && modules.hasOwnProperty(name)) {
+ modules[name] = null;
+ }
+ return ensure(modules, name, function() {
+ if (!requires) {
+ throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " +
+ "the module name or forgot to load it. If registering a module ensure that you " +
+ "specify the dependencies as the second argument.", name);
+ }
+
+ /** @type {!Array.<Array.<*>>} */
+ var invokeQueue = [];
+
+ /** @type {!Array.<Function>} */
+ var runBlocks = [];
+
+ var config = invokeLater('$injector', 'invoke');
+
+ /** @type {angular.Module} */
+ var moduleInstance = {
+ // Private state
+ _invokeQueue: invokeQueue,
+ _runBlocks: runBlocks,
+
+ /**
+ * @ngdoc property
+ * @name angular.Module#requires
+ * @module ng
+ *
+ * @description
+ * Holds the list of modules which the injector will load before the current module is
+ * loaded.
+ */
+ requires: requires,
+
+ /**
+ * @ngdoc property
+ * @name angular.Module#name
+ * @module ng
+ *
+ * @description
+ * Name of the module.
+ */
+ name: name,
+
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#provider
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} providerType Construction function for creating new instance of the
+ * service.
+ * @description
+ * See {@link auto.$provide#provider $provide.provider()}.
+ */
+ provider: invokeLater('$provide', 'provider'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#factory
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} providerFunction Function for creating new instance of the service.
+ * @description
+ * See {@link auto.$provide#factory $provide.factory()}.
+ */
+ factory: invokeLater('$provide', 'factory'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#service
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} constructor A constructor function that will be instantiated.
+ * @description
+ * See {@link auto.$provide#service $provide.service()}.
+ */
+ service: invokeLater('$provide', 'service'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#value
+ * @module ng
+ * @param {string} name service name
+ * @param {*} object Service instance object.
+ * @description
+ * See {@link auto.$provide#value $provide.value()}.
+ */
+ value: invokeLater('$provide', 'value'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#constant
+ * @module ng
+ * @param {string} name constant name
+ * @param {*} object Constant value.
+ * @description
+ * Because the constant are fixed, they get applied before other provide methods.
+ * See {@link auto.$provide#constant $provide.constant()}.
+ */
+ constant: invokeLater('$provide', 'constant', 'unshift'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#animation
+ * @module ng
+ * @param {string} name animation name
+ * @param {Function} animationFactory Factory function for creating new instance of an
+ * animation.
+ * @description
+ *
+ * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
+ *
+ *
+ * Defines an animation hook that can be later used with
+ * {@link ngAnimate.$animate $animate} service and directives that use this service.
+ *
+ * ```js
+ * module.animation('.animation-name', function($inject1, $inject2) {
+ * return {
+ * eventName : function(element, done) {
+ * //code to run the animation
+ * //once complete, then run done()
+ * return function cancellationFunction(element) {
+ * //code to cancel the animation
+ * }
+ * }
+ * }
+ * })
+ * ```
+ *
+ * See {@link ngAnimate.$animateProvider#register $animateProvider.register()} and
+ * {@link ngAnimate ngAnimate module} for more information.
+ */
+ animation: invokeLater('$animateProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#filter
+ * @module ng
+ * @param {string} name Filter name.
+ * @param {Function} filterFactory Factory function for creating new instance of filter.
+ * @description
+ * See {@link ng.$filterProvider#register $filterProvider.register()}.
+ */
+ filter: invokeLater('$filterProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#controller
+ * @module ng
+ * @param {string|Object} name Controller name, or an object map of controllers where the
+ * keys are the names and the values are the constructors.
+ * @param {Function} constructor Controller constructor function.
+ * @description
+ * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
+ */
+ controller: invokeLater('$controllerProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#directive
+ * @module ng
+ * @param {string|Object} name Directive name, or an object map of directives where the
+ * keys are the names and the values are the factories.
+ * @param {Function} directiveFactory Factory function for creating new instance of
+ * directives.
+ * @description
+ * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
+ */
+ directive: invokeLater('$compileProvider', 'directive'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#config
+ * @module ng
+ * @param {Function} configFn Execute this function on module load. Useful for service
+ * configuration.
+ * @description
+ * Use this method to register work which needs to be performed on module loading.
+ * For more about how to configure services, see
+ * {@link providers#providers_provider-recipe Provider Recipe}.
+ */
+ config: config,
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#run
+ * @module ng
+ * @param {Function} initializationFn Execute this function after injector creation.
+ * Useful for application initialization.
+ * @description
+ * Use this method to register work which should be performed when the injector is done
+ * loading all modules.
+ */
+ run: function(block) {
+ runBlocks.push(block);
+ return this;
+ }
+ };
+
+ if (configFn) {
+ config(configFn);
+ }
+
+ return moduleInstance;
+
+ /**
+ * @param {string} provider
+ * @param {string} method
+ * @param {String=} insertMethod
+ * @returns {angular.Module}
+ */
+ function invokeLater(provider, method, insertMethod) {
+ return function() {
+ invokeQueue[insertMethod || 'push']([provider, method, arguments]);
+ return moduleInstance;
+ };
+ }
+ });
+ };
+ });
+
+}
+
+/* global angularModule: true,
+ version: true,
+
+ $LocaleProvider,
+ $CompileProvider,
+
+ htmlAnchorDirective,
+ inputDirective,
+ inputDirective,
+ formDirective,
+ scriptDirective,
+ selectDirective,
+ styleDirective,
+ optionDirective,
+ ngBindDirective,
+ ngBindHtmlDirective,
+ ngBindTemplateDirective,
+ ngClassDirective,
+ ngClassEvenDirective,
+ ngClassOddDirective,
+ ngCspDirective,
+ ngCloakDirective,
+ ngControllerDirective,
+ ngFormDirective,
+ ngHideDirective,
+ ngIfDirective,
+ ngIncludeDirective,
+ ngIncludeFillContentDirective,
+ ngInitDirective,
+ ngNonBindableDirective,
+ ngPluralizeDirective,
+ ngRepeatDirective,
+ ngShowDirective,
+ ngStyleDirective,
+ ngSwitchDirective,
+ ngSwitchWhenDirective,
+ ngSwitchDefaultDirective,
+ ngOptionsDirective,
+ ngTranscludeDirective,
+ ngModelDirective,
+ ngListDirective,
+ ngChangeDirective,
+ requiredDirective,
+ requiredDirective,
+ ngValueDirective,
+ ngAttributeAliasDirectives,
+ ngEventDirectives,
+
+ $AnchorScrollProvider,
+ $AnimateProvider,
+ $BrowserProvider,
+ $CacheFactoryProvider,
+ $ControllerProvider,
+ $DocumentProvider,
+ $ExceptionHandlerProvider,
+ $FilterProvider,
+ $InterpolateProvider,
+ $IntervalProvider,
+ $HttpProvider,
+ $HttpBackendProvider,
+ $LocationProvider,
+ $LogProvider,
+ $ParseProvider,
+ $RootScopeProvider,
+ $QProvider,
+ $$SanitizeUriProvider,
+ $SceProvider,
+ $SceDelegateProvider,
+ $SnifferProvider,
+ $TemplateCacheProvider,
+ $TimeoutProvider,
+ $$RAFProvider,
+ $$AsyncCallbackProvider,
+ $WindowProvider
+*/
+
+
+/**
+ * @ngdoc object
+ * @name angular.version
+ * @module ng
+ * @description
+ * An object that contains information about the current AngularJS version. This object has the
+ * following properties:
+ *
+ * - `full` – `{string}` – Full version string, such as "0.9.18".
+ * - `major` – `{number}` – Major version number, such as "0".
+ * - `minor` – `{number}` – Minor version number, such as "9".
+ * - `dot` – `{number}` – Dot version number, such as "18".
+ * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
+ */
+var version = {
+ full: '1.2.25', // all of these placeholder strings will be replaced by grunt's
+ major: 1, // package task
+ minor: 2,
+ dot: 25,
+ codeName: 'hypnotic-gesticulation'
+};
+
+
+function publishExternalAPI(angular){
+ extend(angular, {
+ 'bootstrap': bootstrap,
+ 'copy': copy,
+ 'extend': extend,
+ 'equals': equals,
+ 'element': jqLite,
+ 'forEach': forEach,
+ 'injector': createInjector,
+ 'noop': noop,
+ 'bind': bind,
+ 'toJson': toJson,
+ 'fromJson': fromJson,
+ 'identity': identity,
+ 'isUndefined': isUndefined,
+ 'isDefined': isDefined,
+ 'isString': isString,
+ 'isFunction': isFunction,
+ 'isObject': isObject,
+ 'isNumber': isNumber,
+ 'isElement': isElement,
+ 'isArray': isArray,
+ 'version': version,
+ 'isDate': isDate,
+ 'lowercase': lowercase,
+ 'uppercase': uppercase,
+ 'callbacks': {counter: 0},
+ '$$minErr': minErr,
+ '$$csp': csp
+ });
+
+ angularModule = setupModuleLoader(window);
+ try {
+ angularModule('ngLocale');
+ } catch (e) {
+ angularModule('ngLocale', []).provider('$locale', $LocaleProvider);
+ }
+
+ angularModule('ng', ['ngLocale'], ['$provide',
+ function ngModule($provide) {
+ // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
+ $provide.provider({
+ $$sanitizeUri: $$SanitizeUriProvider
+ });
+ $provide.provider('$compile', $CompileProvider).
+ directive({
+ a: htmlAnchorDirective,
+ input: inputDirective,
+ textarea: inputDirective,
+ form: formDirective,
+ script: scriptDirective,
+ select: selectDirective,
+ style: styleDirective,
+ option: optionDirective,
+ ngBind: ngBindDirective,
+ ngBindHtml: ngBindHtmlDirective,
+ ngBindTemplate: ngBindTemplateDirective,
+ ngClass: ngClassDirective,
+ ngClassEven: ngClassEvenDirective,
+ ngClassOdd: ngClassOddDirective,
+ ngCloak: ngCloakDirective,
+ ngController: ngControllerDirective,
+ ngForm: ngFormDirective,
+ ngHide: ngHideDirective,
+ ngIf: ngIfDirective,
+ ngInclude: ngIncludeDirective,
+ ngInit: ngInitDirective,
+ ngNonBindable: ngNonBindableDirective,
+ ngPluralize: ngPluralizeDirective,
+ ngRepeat: ngRepeatDirective,
+ ngShow: ngShowDirective,
+ ngStyle: ngStyleDirective,
+ ngSwitch: ngSwitchDirective,
+ ngSwitchWhen: ngSwitchWhenDirective,
+ ngSwitchDefault: ngSwitchDefaultDirective,
+ ngOptions: ngOptionsDirective,
+ ngTransclude: ngTranscludeDirective,
+ ngModel: ngModelDirective,
+ ngList: ngListDirective,
+ ngChange: ngChangeDirective,
+ required: requiredDirective,
+ ngRequired: requiredDirective,
+ ngValue: ngValueDirective
+ }).
+ directive({
+ ngInclude: ngIncludeFillContentDirective
+ }).
+ directive(ngAttributeAliasDirectives).
+ directive(ngEventDirectives);
+ $provide.provider({
+ $anchorScroll: $AnchorScrollProvider,
+ $animate: $AnimateProvider,
+ $browser: $BrowserProvider,
+ $cacheFactory: $CacheFactoryProvider,
+ $controller: $ControllerProvider,
+ $document: $DocumentProvider,
+ $exceptionHandler: $ExceptionHandlerProvider,
+ $filter: $FilterProvider,
+ $interpolate: $InterpolateProvider,
+ $interval: $IntervalProvider,
+ $http: $HttpProvider,
+ $httpBackend: $HttpBackendProvider,
+ $location: $LocationProvider,
+ $log: $LogProvider,
+ $parse: $ParseProvider,
+ $rootScope: $RootScopeProvider,
+ $q: $QProvider,
+ $sce: $SceProvider,
+ $sceDelegate: $SceDelegateProvider,
+ $sniffer: $SnifferProvider,
+ $templateCache: $TemplateCacheProvider,
+ $timeout: $TimeoutProvider,
+ $window: $WindowProvider,
+ $$rAF: $$RAFProvider,
+ $$asyncCallback : $$AsyncCallbackProvider
+ });
+ }
+ ]);
+}
+
+/* global JQLitePrototype: true,
+ addEventListenerFn: true,
+ removeEventListenerFn: true,
+ BOOLEAN_ATTR: true
+*/
+
+//////////////////////////////////
+//JQLite
+//////////////////////////////////
+
+/**
+ * @ngdoc function
+ * @name angular.element
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.
+ *
+ * If jQuery is available, `angular.element` is an alias for the
+ * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element`
+ * delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite."
+ *
+ * <div class="alert alert-success">jqLite is a tiny, API-compatible subset of jQuery that allows
+ * Angular to manipulate the DOM in a cross-browser compatible way. **jqLite** implements only the most
+ * commonly needed functionality with the goal of having a very small footprint.</div>
+ *
+ * To use jQuery, simply load it before `DOMContentLoaded` event fired.
+ *
+ * <div class="alert">**Note:** all element references in Angular are always wrapped with jQuery or
+ * jqLite; they are never raw DOM references.</div>
+ *
+ * ## Angular's jqLite
+ * jqLite provides only the following jQuery methods:
+ *
+ * - [`addClass()`](http://api.jquery.com/addClass/)
+ * - [`after()`](http://api.jquery.com/after/)
+ * - [`append()`](http://api.jquery.com/append/)
+ * - [`attr()`](http://api.jquery.com/attr/)
+ * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData
+ * - [`children()`](http://api.jquery.com/children/) - Does not support selectors
+ * - [`clone()`](http://api.jquery.com/clone/)
+ * - [`contents()`](http://api.jquery.com/contents/)
+ * - [`css()`](http://api.jquery.com/css/)
+ * - [`data()`](http://api.jquery.com/data/)
+ * - [`empty()`](http://api.jquery.com/empty/)
+ * - [`eq()`](http://api.jquery.com/eq/)
+ * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name
+ * - [`hasClass()`](http://api.jquery.com/hasClass/)
+ * - [`html()`](http://api.jquery.com/html/)
+ * - [`next()`](http://api.jquery.com/next/) - Does not support selectors
+ * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData
+ * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces or selectors
+ * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors
+ * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors
+ * - [`prepend()`](http://api.jquery.com/prepend/)
+ * - [`prop()`](http://api.jquery.com/prop/)
+ * - [`ready()`](http://api.jquery.com/ready/)
+ * - [`remove()`](http://api.jquery.com/remove/)
+ * - [`removeAttr()`](http://api.jquery.com/removeAttr/)
+ * - [`removeClass()`](http://api.jquery.com/removeClass/)
+ * - [`removeData()`](http://api.jquery.com/removeData/)
+ * - [`replaceWith()`](http://api.jquery.com/replaceWith/)
+ * - [`text()`](http://api.jquery.com/text/)
+ * - [`toggleClass()`](http://api.jquery.com/toggleClass/)
+ * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers.
+ * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces
+ * - [`val()`](http://api.jquery.com/val/)
+ * - [`wrap()`](http://api.jquery.com/wrap/)
+ *
+ * ## jQuery/jqLite Extras
+ * Angular also provides the following additional methods and events to both jQuery and jqLite:
+ *
+ * ### Events
+ * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event
+ * on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM
+ * element before it is removed.
+ *
+ * ### Methods
+ * - `controller(name)` - retrieves the controller of the current element or its parent. By default
+ * retrieves controller associated with the `ngController` directive. If `name` is provided as
+ * camelCase directive name, then the controller for this directive will be retrieved (e.g.
+ * `'ngModel'`).
+ * - `injector()` - retrieves the injector of the current element or its parent.
+ * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current
+ * element or its parent.
+ * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the
+ * current element. This getter should be used only on elements that contain a directive which starts a new isolate
+ * scope. Calling `scope()` on this element always returns the original non-isolate scope.
+ * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top
+ * parent element is reached.
+ *
+ * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.
+ * @returns {Object} jQuery object.
+ */
+
+JQLite.expando = 'ng339';
+
+var jqCache = JQLite.cache = {},
+ jqId = 1,
+ addEventListenerFn = (window.document.addEventListener
+ ? function(element, type, fn) {element.addEventListener(type, fn, false);}
+ : function(element, type, fn) {element.attachEvent('on' + type, fn);}),
+ removeEventListenerFn = (window.document.removeEventListener
+ ? function(element, type, fn) {element.removeEventListener(type, fn, false); }
+ : function(element, type, fn) {element.detachEvent('on' + type, fn); });
+
+/*
+ * !!! This is an undocumented "private" function !!!
+ */
+var jqData = JQLite._data = function(node) {
+ //jQuery always returns an object on cache miss
+ return this.cache[node[this.expando]] || {};
+};
+
+function jqNextId() { return ++jqId; }
+
+
+var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
+var MOZ_HACK_REGEXP = /^moz([A-Z])/;
+var jqLiteMinErr = minErr('jqLite');
+
+/**
+ * Converts snake_case to camelCase.
+ * Also there is special case for Moz prefix starting with upper case letter.
+ * @param name Name to normalize
+ */
+function camelCase(name) {
+ return name.
+ replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
+ return offset ? letter.toUpperCase() : letter;
+ }).
+ replace(MOZ_HACK_REGEXP, 'Moz$1');
+}
+
+/////////////////////////////////////////////
+// jQuery mutation patch
+//
+// In conjunction with bindJQuery intercepts all jQuery's DOM destruction apis and fires a
+// $destroy event on all DOM nodes being removed.
+//
+/////////////////////////////////////////////
+
+function jqLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments) {
+ var originalJqFn = jQuery.fn[name];
+ originalJqFn = originalJqFn.$original || originalJqFn;
+ removePatch.$original = originalJqFn;
+ jQuery.fn[name] = removePatch;
+
+ function removePatch(param) {
+ // jshint -W040
+ var list = filterElems && param ? [this.filter(param)] : [this],
+ fireEvent = dispatchThis,
+ set, setIndex, setLength,
+ element, childIndex, childLength, children;
+
+ if (!getterIfNoArguments || param != null) {
+ while(list.length) {
+ set = list.shift();
+ for(setIndex = 0, setLength = set.length; setIndex < setLength; setIndex++) {
+ element = jqLite(set[setIndex]);
+ if (fireEvent) {
+ element.triggerHandler('$destroy');
+ } else {
+ fireEvent = !fireEvent;
+ }
+ for(childIndex = 0, childLength = (children = element.children()).length;
+ childIndex < childLength;
+ childIndex++) {
+ list.push(jQuery(children[childIndex]));
+ }
+ }
+ }
+ }
+ return originalJqFn.apply(this, arguments);
+ }
+}
+
+var SINGLE_TAG_REGEXP = /^<(\w+)\s*\/?>(?:<\/\1>|)$/;
+var HTML_REGEXP = /<|&#?\w+;/;
+var TAG_NAME_REGEXP = /<([\w:]+)/;
+var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi;
+
+var wrapMap = {
+ 'option': [1, '<select multiple="multiple">', '</select>'],
+
+ 'thead': [1, '<table>', '</table>'],
+ 'col': [2, '<table><colgroup>', '</colgroup></table>'],
+ 'tr': [2, '<table><tbody>', '</tbody></table>'],
+ 'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],
+ '_default': [0, "", ""]
+};
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+function jqLiteIsTextNode(html) {
+ return !HTML_REGEXP.test(html);
+}
+
+function jqLiteBuildFragment(html, context) {
+ var elem, tmp, tag, wrap,
+ fragment = context.createDocumentFragment(),
+ nodes = [], i, j, jj;
+
+ if (jqLiteIsTextNode(html)) {
+ // Convert non-html into a text node
+ nodes.push(context.createTextNode(html));
+ } else {
+ tmp = fragment.appendChild(context.createElement('div'));
+ // Convert html into DOM nodes
+ tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase();
+ wrap = wrapMap[tag] || wrapMap._default;
+ tmp.innerHTML = '<div>&#160;</div>' +
+ wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2];
+ tmp.removeChild(tmp.firstChild);
+
+ // Descend through wrappers to the right content
+ i = wrap[0];
+ while (i--) {
+ tmp = tmp.lastChild;
+ }
+
+ for (j=0, jj=tmp.childNodes.length; j<jj; ++j) nodes.push(tmp.childNodes[j]);
+
+ tmp = fragment.firstChild;
+ tmp.textContent = "";
+ }
+
+ // Remove wrapper from fragment
+ fragment.textContent = "";
+ fragment.innerHTML = ""; // Clear inner HTML
+ return nodes;
+}
+
+function jqLiteParseHTML(html, context) {
+ context = context || document;
+ var parsed;
+
+ if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {
+ return [context.createElement(parsed[1])];
+ }
+
+ return jqLiteBuildFragment(html, context);
+}
+
+/////////////////////////////////////////////
+function JQLite(element) {
+ if (element instanceof JQLite) {
+ return element;
+ }
+ if (isString(element)) {
+ element = trim(element);
+ }
+ if (!(this instanceof JQLite)) {
+ if (isString(element) && element.charAt(0) != '<') {
+ throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');
+ }
+ return new JQLite(element);
+ }
+
+ if (isString(element)) {
+ jqLiteAddNodes(this, jqLiteParseHTML(element));
+ var fragment = jqLite(document.createDocumentFragment());
+ fragment.append(this);
+ } else {
+ jqLiteAddNodes(this, element);
+ }
+}
+
+function jqLiteClone(element) {
+ return element.cloneNode(true);
+}
+
+function jqLiteDealoc(element){
+ jqLiteRemoveData(element);
+ for ( var i = 0, children = element.childNodes || []; i < children.length; i++) {
+ jqLiteDealoc(children[i]);
+ }
+}
+
+function jqLiteOff(element, type, fn, unsupported) {
+ if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');
+
+ var events = jqLiteExpandoStore(element, 'events'),
+ handle = jqLiteExpandoStore(element, 'handle');
+
+ if (!handle) return; //no listeners registered
+
+ if (isUndefined(type)) {
+ forEach(events, function(eventHandler, type) {
+ removeEventListenerFn(element, type, eventHandler);
+ delete events[type];
+ });
+ } else {
+ forEach(type.split(' '), function(type) {
+ if (isUndefined(fn)) {
+ removeEventListenerFn(element, type, events[type]);
+ delete events[type];
+ } else {
+ arrayRemove(events[type] || [], fn);
+ }
+ });
+ }
+}
+
+function jqLiteRemoveData(element, name) {
+ var expandoId = element.ng339,
+ expandoStore = jqCache[expandoId];
+
+ if (expandoStore) {
+ if (name) {
+ delete jqCache[expandoId].data[name];
+ return;
+ }
+
+ if (expandoStore.handle) {
+ expandoStore.events.$destroy && expandoStore.handle({}, '$destroy');
+ jqLiteOff(element);
+ }
+ delete jqCache[expandoId];
+ element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it
+ }
+}
+
+function jqLiteExpandoStore(element, key, value) {
+ var expandoId = element.ng339,
+ expandoStore = jqCache[expandoId || -1];
+
+ if (isDefined(value)) {
+ if (!expandoStore) {
+ element.ng339 = expandoId = jqNextId();
+ expandoStore = jqCache[expandoId] = {};
+ }
+ expandoStore[key] = value;
+ } else {
+ return expandoStore && expandoStore[key];
+ }
+}
+
+function jqLiteData(element, key, value) {
+ var data = jqLiteExpandoStore(element, 'data'),
+ isSetter = isDefined(value),
+ keyDefined = !isSetter && isDefined(key),
+ isSimpleGetter = keyDefined && !isObject(key);
+
+ if (!data && !isSimpleGetter) {
+ jqLiteExpandoStore(element, 'data', data = {});
+ }
+
+ if (isSetter) {
+ data[key] = value;
+ } else {
+ if (keyDefined) {
+ if (isSimpleGetter) {
+ // don't create data in this case.
+ return data && data[key];
+ } else {
+ extend(data, key);
+ }
+ } else {
+ return data;
+ }
+ }
+}
+
+function jqLiteHasClass(element, selector) {
+ if (!element.getAttribute) return false;
+ return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " ").
+ indexOf( " " + selector + " " ) > -1);
+}
+
+function jqLiteRemoveClass(element, cssClasses) {
+ if (cssClasses && element.setAttribute) {
+ forEach(cssClasses.split(' '), function(cssClass) {
+ element.setAttribute('class', trim(
+ (" " + (element.getAttribute('class') || '') + " ")
+ .replace(/[\n\t]/g, " ")
+ .replace(" " + trim(cssClass) + " ", " "))
+ );
+ });
+ }
+}
+
+function jqLiteAddClass(element, cssClasses) {
+ if (cssClasses && element.setAttribute) {
+ var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')
+ .replace(/[\n\t]/g, " ");
+
+ forEach(cssClasses.split(' '), function(cssClass) {
+ cssClass = trim(cssClass);
+ if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {
+ existingClasses += cssClass + ' ';
+ }
+ });
+
+ element.setAttribute('class', trim(existingClasses));
+ }
+}
+
+function jqLiteAddNodes(root, elements) {
+ if (elements) {
+ elements = (!elements.nodeName && isDefined(elements.length) && !isWindow(elements))
+ ? elements
+ : [ elements ];
+ for(var i=0; i < elements.length; i++) {
+ root.push(elements[i]);
+ }
+ }
+}
+
+function jqLiteController(element, name) {
+ return jqLiteInheritedData(element, '$' + (name || 'ngController' ) + 'Controller');
+}
+
+function jqLiteInheritedData(element, name, value) {
+ // if element is the document object work with the html element instead
+ // this makes $(document).scope() possible
+ if(element.nodeType == 9) {
+ element = element.documentElement;
+ }
+ var names = isArray(name) ? name : [name];
+
+ while (element) {
+ for (var i = 0, ii = names.length; i < ii; i++) {
+ if ((value = jqLite.data(element, names[i])) !== undefined) return value;
+ }
+
+ // If dealing with a document fragment node with a host element, and no parent, use the host
+ // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM
+ // to lookup parent controllers.
+ element = element.parentNode || (element.nodeType === 11 && element.host);
+ }
+}
+
+function jqLiteEmpty(element) {
+ for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) {
+ jqLiteDealoc(childNodes[i]);
+ }
+ while (element.firstChild) {
+ element.removeChild(element.firstChild);
+ }
+}
+
+//////////////////////////////////////////
+// Functions which are declared directly.
+//////////////////////////////////////////
+var JQLitePrototype = JQLite.prototype = {
+ ready: function(fn) {
+ var fired = false;
+
+ function trigger() {
+ if (fired) return;
+ fired = true;
+ fn();
+ }
+
+ // check if document already is loaded
+ if (document.readyState === 'complete'){
+ setTimeout(trigger);
+ } else {
+ this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9
+ // we can not use jqLite since we are not done loading and jQuery could be loaded later.
+ // jshint -W064
+ JQLite(window).on('load', trigger); // fallback to window.onload for others
+ // jshint +W064
+ }
+ },
+ toString: function() {
+ var value = [];
+ forEach(this, function(e){ value.push('' + e);});
+ return '[' + value.join(', ') + ']';
+ },
+
+ eq: function(index) {
+ return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);
+ },
+
+ length: 0,
+ push: push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+//////////////////////////////////////////
+// Functions iterating getter/setters.
+// these functions return self on setter and
+// value on get.
+//////////////////////////////////////////
+var BOOLEAN_ATTR = {};
+forEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) {
+ BOOLEAN_ATTR[lowercase(value)] = value;
+});
+var BOOLEAN_ELEMENTS = {};
+forEach('input,select,option,textarea,button,form,details'.split(','), function(value) {
+ BOOLEAN_ELEMENTS[uppercase(value)] = true;
+});
+
+function getBooleanAttrName(element, name) {
+ // check dom last since we will most likely fail on name
+ var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];
+
+ // booleanAttr is here twice to minimize DOM access
+ return booleanAttr && BOOLEAN_ELEMENTS[element.nodeName] && booleanAttr;
+}
+
+forEach({
+ data: jqLiteData,
+ removeData: jqLiteRemoveData
+}, function(fn, name) {
+ JQLite[name] = fn;
+});
+
+forEach({
+ data: jqLiteData,
+ inheritedData: jqLiteInheritedData,
+
+ scope: function(element) {
+ // Can't use jqLiteData here directly so we stay compatible with jQuery!
+ return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);
+ },
+
+ isolateScope: function(element) {
+ // Can't use jqLiteData here directly so we stay compatible with jQuery!
+ return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate');
+ },
+
+ controller: jqLiteController,
+
+ injector: function(element) {
+ return jqLiteInheritedData(element, '$injector');
+ },
+
+ removeAttr: function(element,name) {
+ element.removeAttribute(name);
+ },
+
+ hasClass: jqLiteHasClass,
+
+ css: function(element, name, value) {
+ name = camelCase(name);
+
+ if (isDefined(value)) {
+ element.style[name] = value;
+ } else {
+ var val;
+
+ if (msie <= 8) {
+ // this is some IE specific weirdness that jQuery 1.6.4 does not sure why
+ val = element.currentStyle && element.currentStyle[name];
+ if (val === '') val = 'auto';
+ }
+
+ val = val || element.style[name];
+
+ if (msie <= 8) {
+ // jquery weirdness :-/
+ val = (val === '') ? undefined : val;
+ }
+
+ return val;
+ }
+ },
+
+ attr: function(element, name, value){
+ var lowercasedName = lowercase(name);
+ if (BOOLEAN_ATTR[lowercasedName]) {
+ if (isDefined(value)) {
+ if (!!value) {
+ element[name] = true;
+ element.setAttribute(name, lowercasedName);
+ } else {
+ element[name] = false;
+ element.removeAttribute(lowercasedName);
+ }
+ } else {
+ return (element[name] ||
+ (element.attributes.getNamedItem(name)|| noop).specified)
+ ? lowercasedName
+ : undefined;
+ }
+ } else if (isDefined(value)) {
+ element.setAttribute(name, value);
+ } else if (element.getAttribute) {
+ // the extra argument "2" is to get the right thing for a.href in IE, see jQuery code
+ // some elements (e.g. Document) don't have get attribute, so return undefined
+ var ret = element.getAttribute(name, 2);
+ // normalize non-existing attributes to undefined (as jQuery)
+ return ret === null ? undefined : ret;
+ }
+ },
+
+ prop: function(element, name, value) {
+ if (isDefined(value)) {
+ element[name] = value;
+ } else {
+ return element[name];
+ }
+ },
+
+ text: (function() {
+ var NODE_TYPE_TEXT_PROPERTY = [];
+ if (msie < 9) {
+ NODE_TYPE_TEXT_PROPERTY[1] = 'innerText'; /** Element **/
+ NODE_TYPE_TEXT_PROPERTY[3] = 'nodeValue'; /** Text **/
+ } else {
+ NODE_TYPE_TEXT_PROPERTY[1] = /** Element **/
+ NODE_TYPE_TEXT_PROPERTY[3] = 'textContent'; /** Text **/
+ }
+ getText.$dv = '';
+ return getText;
+
+ function getText(element, value) {
+ var textProp = NODE_TYPE_TEXT_PROPERTY[element.nodeType];
+ if (isUndefined(value)) {
+ return textProp ? element[textProp] : '';
+ }
+ element[textProp] = value;
+ }
+ })(),
+
+ val: function(element, value) {
+ if (isUndefined(value)) {
+ if (nodeName_(element) === 'SELECT' && element.multiple) {
+ var result = [];
+ forEach(element.options, function (option) {
+ if (option.selected) {
+ result.push(option.value || option.text);
+ }
+ });
+ return result.length === 0 ? null : result;
+ }
+ return element.value;
+ }
+ element.value = value;
+ },
+
+ html: function(element, value) {
+ if (isUndefined(value)) {
+ return element.innerHTML;
+ }
+ for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) {
+ jqLiteDealoc(childNodes[i]);
+ }
+ element.innerHTML = value;
+ },
+
+ empty: jqLiteEmpty
+}, function(fn, name){
+ /**
+ * Properties: writes return selection, reads return first value
+ */
+ JQLite.prototype[name] = function(arg1, arg2) {
+ var i, key;
+ var nodeCount = this.length;
+
+ // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it
+ // in a way that survives minification.
+ // jqLiteEmpty takes no arguments but is a setter.
+ if (fn !== jqLiteEmpty &&
+ (((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2) === undefined)) {
+ if (isObject(arg1)) {
+
+ // we are a write, but the object properties are the key/values
+ for (i = 0; i < nodeCount; i++) {
+ if (fn === jqLiteData) {
+ // data() takes the whole object in jQuery
+ fn(this[i], arg1);
+ } else {
+ for (key in arg1) {
+ fn(this[i], key, arg1[key]);
+ }
+ }
+ }
+ // return self for chaining
+ return this;
+ } else {
+ // we are a read, so read the first child.
+ // TODO: do we still need this?
+ var value = fn.$dv;
+ // Only if we have $dv do we iterate over all, otherwise it is just the first element.
+ var jj = (value === undefined) ? Math.min(nodeCount, 1) : nodeCount;
+ for (var j = 0; j < jj; j++) {
+ var nodeValue = fn(this[j], arg1, arg2);
+ value = value ? value + nodeValue : nodeValue;
+ }
+ return value;
+ }
+ } else {
+ // we are a write, so apply to all children
+ for (i = 0; i < nodeCount; i++) {
+ fn(this[i], arg1, arg2);
+ }
+ // return self for chaining
+ return this;
+ }
+ };
+});
+
+function createEventHandler(element, events) {
+ var eventHandler = function (event, type) {
+ if (!event.preventDefault) {
+ event.preventDefault = function() {
+ event.returnValue = false; //ie
+ };
+ }
+
+ if (!event.stopPropagation) {
+ event.stopPropagation = function() {
+ event.cancelBubble = true; //ie
+ };
+ }
+
+ if (!event.target) {
+ event.target = event.srcElement || document;
+ }
+
+ if (isUndefined(event.defaultPrevented)) {
+ var prevent = event.preventDefault;
+ event.preventDefault = function() {
+ event.defaultPrevented = true;
+ prevent.call(event);
+ };
+ event.defaultPrevented = false;
+ }
+
+ event.isDefaultPrevented = function() {
+ return event.defaultPrevented || event.returnValue === false;
+ };
+
+ // Copy event handlers in case event handlers array is modified during execution.
+ var eventHandlersCopy = shallowCopy(events[type || event.type] || []);
+
+ forEach(eventHandlersCopy, function(fn) {
+ fn.call(element, event);
+ });
+
+ // Remove monkey-patched methods (IE),
+ // as they would cause memory leaks in IE8.
+ if (msie <= 8) {
+ // IE7/8 does not allow to delete property on native object
+ event.preventDefault = null;
+ event.stopPropagation = null;
+ event.isDefaultPrevented = null;
+ } else {
+ // It shouldn't affect normal browsers (native methods are defined on prototype).
+ delete event.preventDefault;
+ delete event.stopPropagation;
+ delete event.isDefaultPrevented;
+ }
+ };
+ eventHandler.elem = element;
+ return eventHandler;
+}
+
+//////////////////////////////////////////
+// Functions iterating traversal.
+// These functions chain results into a single
+// selector.
+//////////////////////////////////////////
+forEach({
+ removeData: jqLiteRemoveData,
+
+ dealoc: jqLiteDealoc,
+
+ on: function onFn(element, type, fn, unsupported){
+ if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');
+
+ var events = jqLiteExpandoStore(element, 'events'),
+ handle = jqLiteExpandoStore(element, 'handle');
+
+ if (!events) jqLiteExpandoStore(element, 'events', events = {});
+ if (!handle) jqLiteExpandoStore(element, 'handle', handle = createEventHandler(element, events));
+
+ forEach(type.split(' '), function(type){
+ var eventFns = events[type];
+
+ if (!eventFns) {
+ if (type == 'mouseenter' || type == 'mouseleave') {
+ var contains = document.body.contains || document.body.compareDocumentPosition ?
+ function( a, b ) {
+ // jshint bitwise: false
+ var adown = a.nodeType === 9 ? a.documentElement : a,
+ bup = b && b.parentNode;
+ return a === bup || !!( bup && bup.nodeType === 1 && (
+ adown.contains ?
+ adown.contains( bup ) :
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
+ ));
+ } :
+ function( a, b ) {
+ if ( b ) {
+ while ( (b = b.parentNode) ) {
+ if ( b === a ) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ events[type] = [];
+
+ // Refer to jQuery's implementation of mouseenter & mouseleave
+ // Read about mouseenter and mouseleave:
+ // http://www.quirksmode.org/js/events_mouse.html#link8
+ var eventmap = { mouseleave : "mouseout", mouseenter : "mouseover"};
+
+ onFn(element, eventmap[type], function(event) {
+ var target = this, related = event.relatedTarget;
+ // For mousenter/leave call the handler if related is outside the target.
+ // NB: No relatedTarget if the mouse left/entered the browser window
+ if ( !related || (related !== target && !contains(target, related)) ){
+ handle(event, type);
+ }
+ });
+
+ } else {
+ addEventListenerFn(element, type, handle);
+ events[type] = [];
+ }
+ eventFns = events[type];
+ }
+ eventFns.push(fn);
+ });
+ },
+
+ off: jqLiteOff,
+
+ one: function(element, type, fn) {
+ element = jqLite(element);
+
+ //add the listener twice so that when it is called
+ //you can remove the original function and still be
+ //able to call element.off(ev, fn) normally
+ element.on(type, function onFn() {
+ element.off(type, fn);
+ element.off(type, onFn);
+ });
+ element.on(type, fn);
+ },
+
+ replaceWith: function(element, replaceNode) {
+ var index, parent = element.parentNode;
+ jqLiteDealoc(element);
+ forEach(new JQLite(replaceNode), function(node){
+ if (index) {
+ parent.insertBefore(node, index.nextSibling);
+ } else {
+ parent.replaceChild(node, element);
+ }
+ index = node;
+ });
+ },
+
+ children: function(element) {
+ var children = [];
+ forEach(element.childNodes, function(element){
+ if (element.nodeType === 1)
+ children.push(element);
+ });
+ return children;
+ },
+
+ contents: function(element) {
+ return element.contentDocument || element.childNodes || [];
+ },
+
+ append: function(element, node) {
+ forEach(new JQLite(node), function(child){
+ if (element.nodeType === 1 || element.nodeType === 11) {
+ element.appendChild(child);
+ }
+ });
+ },
+
+ prepend: function(element, node) {
+ if (element.nodeType === 1) {
+ var index = element.firstChild;
+ forEach(new JQLite(node), function(child){
+ element.insertBefore(child, index);
+ });
+ }
+ },
+
+ wrap: function(element, wrapNode) {
+ wrapNode = jqLite(wrapNode)[0];
+ var parent = element.parentNode;
+ if (parent) {
+ parent.replaceChild(wrapNode, element);
+ }
+ wrapNode.appendChild(element);
+ },
+
+ remove: function(element) {
+ jqLiteDealoc(element);
+ var parent = element.parentNode;
+ if (parent) parent.removeChild(element);
+ },
+
+ after: function(element, newElement) {
+ var index = element, parent = element.parentNode;
+ forEach(new JQLite(newElement), function(node){
+ parent.insertBefore(node, index.nextSibling);
+ index = node;
+ });
+ },
+
+ addClass: jqLiteAddClass,
+ removeClass: jqLiteRemoveClass,
+
+ toggleClass: function(element, selector, condition) {
+ if (selector) {
+ forEach(selector.split(' '), function(className){
+ var classCondition = condition;
+ if (isUndefined(classCondition)) {
+ classCondition = !jqLiteHasClass(element, className);
+ }
+ (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);
+ });
+ }
+ },
+
+ parent: function(element) {
+ var parent = element.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+
+ next: function(element) {
+ if (element.nextElementSibling) {
+ return element.nextElementSibling;
+ }
+
+ // IE8 doesn't have nextElementSibling
+ var elm = element.nextSibling;
+ while (elm != null && elm.nodeType !== 1) {
+ elm = elm.nextSibling;
+ }
+ return elm;
+ },
+
+ find: function(element, selector) {
+ if (element.getElementsByTagName) {
+ return element.getElementsByTagName(selector);
+ } else {
+ return [];
+ }
+ },
+
+ clone: jqLiteClone,
+
+ triggerHandler: function(element, event, extraParameters) {
+
+ var dummyEvent, eventFnsCopy, handlerArgs;
+ var eventName = event.type || event;
+ var eventFns = (jqLiteExpandoStore(element, 'events') || {})[eventName];
+
+ if (eventFns) {
+
+ // Create a dummy event to pass to the handlers
+ dummyEvent = {
+ preventDefault: function() { this.defaultPrevented = true; },
+ isDefaultPrevented: function() { return this.defaultPrevented === true; },
+ stopPropagation: noop,
+ type: eventName,
+ target: element
+ };
+
+ // If a custom event was provided then extend our dummy event with it
+ if (event.type) {
+ dummyEvent = extend(dummyEvent, event);
+ }
+
+ // Copy event handlers in case event handlers array is modified during execution.
+ eventFnsCopy = shallowCopy(eventFns);
+ handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent];
+
+ forEach(eventFnsCopy, function(fn) {
+ fn.apply(element, handlerArgs);
+ });
+
+ }
+ }
+}, function(fn, name){
+ /**
+ * chaining functions
+ */
+ JQLite.prototype[name] = function(arg1, arg2, arg3) {
+ var value;
+ for(var i=0; i < this.length; i++) {
+ if (isUndefined(value)) {
+ value = fn(this[i], arg1, arg2, arg3);
+ if (isDefined(value)) {
+ // any function which returns a value needs to be wrapped
+ value = jqLite(value);
+ }
+ } else {
+ jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));
+ }
+ }
+ return isDefined(value) ? value : this;
+ };
+
+ // bind legacy bind/unbind to on/off
+ JQLite.prototype.bind = JQLite.prototype.on;
+ JQLite.prototype.unbind = JQLite.prototype.off;
+});
+
+/**
+ * Computes a hash of an 'obj'.
+ * Hash of a:
+ * string is string
+ * number is number as string
+ * object is either result of calling $$hashKey function on the object or uniquely generated id,
+ * that is also assigned to the $$hashKey property of the object.
+ *
+ * @param obj
+ * @returns {string} hash string such that the same input will have the same hash string.
+ * The resulting string key is in 'type:hashKey' format.
+ */
+function hashKey(obj, nextUidFn) {
+ var objType = typeof obj,
+ key;
+
+ if (objType == 'function' || (objType == 'object' && obj !== null)) {
+ if (typeof (key = obj.$$hashKey) == 'function') {
+ // must invoke on object to keep the right this
+ key = obj.$$hashKey();
+ } else if (key === undefined) {
+ key = obj.$$hashKey = (nextUidFn || nextUid)();
+ }
+ } else {
+ key = obj;
+ }
+
+ return objType + ':' + key;
+}
+
+/**
+ * HashMap which can use objects as keys
+ */
+function HashMap(array, isolatedUid) {
+ if (isolatedUid) {
+ var uid = 0;
+ this.nextUid = function() {
+ return ++uid;
+ };
+ }
+ forEach(array, this.put, this);
+}
+HashMap.prototype = {
+ /**
+ * Store key value pair
+ * @param key key to store can be any type
+ * @param value value to store can be any type
+ */
+ put: function(key, value) {
+ this[hashKey(key, this.nextUid)] = value;
+ },
+
+ /**
+ * @param key
+ * @returns {Object} the value for the key
+ */
+ get: function(key) {
+ return this[hashKey(key, this.nextUid)];
+ },
+
+ /**
+ * Remove the key/value pair
+ * @param key
+ */
+ remove: function(key) {
+ var value = this[key = hashKey(key, this.nextUid)];
+ delete this[key];
+ return value;
+ }
+};
+
+/**
+ * @ngdoc function
+ * @module ng
+ * @name angular.injector
+ * @kind function
+ *
+ * @description
+ * Creates an injector function that can be used for retrieving services as well as for
+ * dependency injection (see {@link guide/di dependency injection}).
+ *
+
+ * @param {Array.<string|Function>} modules A list of module functions or their aliases. See
+ * {@link angular.module}. The `ng` module must be explicitly added.
+ * @returns {function()} Injector function. See {@link auto.$injector $injector}.
+ *
+ * @example
+ * Typical usage
+ * ```js
+ * // create an injector
+ * var $injector = angular.injector(['ng']);
+ *
+ * // use the injector to kick off your application
+ * // use the type inference to auto inject arguments, or use implicit injection
+ * $injector.invoke(function($rootScope, $compile, $document){
+ * $compile($document)($rootScope);
+ * $rootScope.$digest();
+ * });
+ * ```
+ *
+ * Sometimes you want to get access to the injector of a currently running Angular app
+ * from outside Angular. Perhaps, you want to inject and compile some markup after the
+ * application has been bootstrapped. You can do this using the extra `injector()` added
+ * to JQuery/jqLite elements. See {@link angular.element}.
+ *
+ * *This is fairly rare but could be the case if a third party library is injecting the
+ * markup.*
+ *
+ * In the following example a new block of HTML containing a `ng-controller`
+ * directive is added to the end of the document body by JQuery. We then compile and link
+ * it into the current AngularJS scope.
+ *
+ * ```js
+ * var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>');
+ * $(document.body).append($div);
+ *
+ * angular.element(document).injector().invoke(function($compile) {
+ * var scope = angular.element($div).scope();
+ * $compile($div)(scope);
+ * });
+ * ```
+ */
+
+
+/**
+ * @ngdoc module
+ * @name auto
+ * @description
+ *
+ * Implicit module which gets automatically added to each {@link auto.$injector $injector}.
+ */
+
+var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
+var FN_ARG_SPLIT = /,/;
+var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
+var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
+var $injectorMinErr = minErr('$injector');
+function annotate(fn) {
+ var $inject,
+ fnText,
+ argDecl,
+ last;
+
+ if (typeof fn === 'function') {
+ if (!($inject = fn.$inject)) {
+ $inject = [];
+ if (fn.length) {
+ fnText = fn.toString().replace(STRIP_COMMENTS, '');
+ argDecl = fnText.match(FN_ARGS);
+ forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){
+ arg.replace(FN_ARG, function(all, underscore, name){
+ $inject.push(name);
+ });
+ });
+ }
+ fn.$inject = $inject;
+ }
+ } else if (isArray(fn)) {
+ last = fn.length - 1;
+ assertArgFn(fn[last], 'fn');
+ $inject = fn.slice(0, last);
+ } else {
+ assertArgFn(fn, 'fn', true);
+ }
+ return $inject;
+}
+
+///////////////////////////////////////
+
+/**
+ * @ngdoc service
+ * @name $injector
+ * @kind function
+ *
+ * @description
+ *
+ * `$injector` is used to retrieve object instances as defined by
+ * {@link auto.$provide provider}, instantiate types, invoke methods,
+ * and load modules.
+ *
+ * The following always holds true:
+ *
+ * ```js
+ * var $injector = angular.injector();
+ * expect($injector.get('$injector')).toBe($injector);
+ * expect($injector.invoke(function($injector){
+ * return $injector;
+ * }).toBe($injector);
+ * ```
+ *
+ * # Injection Function Annotation
+ *
+ * JavaScript does not have annotations, and annotations are needed for dependency injection. The
+ * following are all valid ways of annotating function with injection arguments and are equivalent.
+ *
+ * ```js
+ * // inferred (only works if code not minified/obfuscated)
+ * $injector.invoke(function(serviceA){});
+ *
+ * // annotated
+ * function explicit(serviceA) {};
+ * explicit.$inject = ['serviceA'];
+ * $injector.invoke(explicit);
+ *
+ * // inline
+ * $injector.invoke(['serviceA', function(serviceA){}]);
+ * ```
+ *
+ * ## Inference
+ *
+ * In JavaScript calling `toString()` on a function returns the function definition. The definition
+ * can then be parsed and the function arguments can be extracted. *NOTE:* This does not work with
+ * minification, and obfuscation tools since these tools change the argument names.
+ *
+ * ## `$inject` Annotation
+ * By adding an `$inject` property onto a function the injection parameters can be specified.
+ *
+ * ## Inline
+ * As an array of injection names, where the last item in the array is the function to call.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#get
+ *
+ * @description
+ * Return an instance of the service.
+ *
+ * @param {string} name The name of the instance to retrieve.
+ * @return {*} The instance.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#invoke
+ *
+ * @description
+ * Invoke the method and supply the method arguments from the `$injector`.
+ *
+ * @param {!Function} fn The function to invoke. Function parameters are injected according to the
+ * {@link guide/di $inject Annotation} rules.
+ * @param {Object=} self The `this` for the invoked method.
+ * @param {Object=} locals Optional object. If preset then any argument names are read from this
+ * object first, before the `$injector` is consulted.
+ * @returns {*} the value returned by the invoked `fn` function.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#has
+ *
+ * @description
+ * Allows the user to query if the particular service exists.
+ *
+ * @param {string} Name of the service to query.
+ * @returns {boolean} returns true if injector has given service.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#instantiate
+ * @description
+ * Create a new instance of JS type. The method takes a constructor function, invokes the new
+ * operator, and supplies all of the arguments to the constructor function as specified by the
+ * constructor annotation.
+ *
+ * @param {Function} Type Annotated constructor function.
+ * @param {Object=} locals Optional object. If preset then any argument names are read from this
+ * object first, before the `$injector` is consulted.
+ * @returns {Object} new instance of `Type`.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#annotate
+ *
+ * @description
+ * Returns an array of service names which the function is requesting for injection. This API is
+ * used by the injector to determine which services need to be injected into the function when the
+ * function is invoked. There are three ways in which the function can be annotated with the needed
+ * dependencies.
+ *
+ * # Argument names
+ *
+ * The simplest form is to extract the dependencies from the arguments of the function. This is done
+ * by converting the function into a string using `toString()` method and extracting the argument
+ * names.
+ * ```js
+ * // Given
+ * function MyController($scope, $route) {
+ * // ...
+ * }
+ *
+ * // Then
+ * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+ * ```
+ *
+ * This method does not work with code minification / obfuscation. For this reason the following
+ * annotation strategies are supported.
+ *
+ * # The `$inject` property
+ *
+ * If a function has an `$inject` property and its value is an array of strings, then the strings
+ * represent names of services to be injected into the function.
+ * ```js
+ * // Given
+ * var MyController = function(obfuscatedScope, obfuscatedRoute) {
+ * // ...
+ * }
+ * // Define function dependencies
+ * MyController['$inject'] = ['$scope', '$route'];
+ *
+ * // Then
+ * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+ * ```
+ *
+ * # The array notation
+ *
+ * It is often desirable to inline Injected functions and that's when setting the `$inject` property
+ * is very inconvenient. In these situations using the array notation to specify the dependencies in
+ * a way that survives minification is a better choice:
+ *
+ * ```js
+ * // We wish to write this (not minification / obfuscation safe)
+ * injector.invoke(function($compile, $rootScope) {
+ * // ...
+ * });
+ *
+ * // We are forced to write break inlining
+ * var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {
+ * // ...
+ * };
+ * tmpFn.$inject = ['$compile', '$rootScope'];
+ * injector.invoke(tmpFn);
+ *
+ * // To better support inline function the inline annotation is supported
+ * injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {
+ * // ...
+ * }]);
+ *
+ * // Therefore
+ * expect(injector.annotate(
+ * ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
+ * ).toEqual(['$compile', '$rootScope']);
+ * ```
+ *
+ * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to
+ * be retrieved as described above.
+ *
+ * @returns {Array.<string>} The names of the services which the function requires.
+ */
+
+
+
+
+/**
+ * @ngdoc service
+ * @name $provide
+ *
+ * @description
+ *
+ * The {@link auto.$provide $provide} service has a number of methods for registering components
+ * with the {@link auto.$injector $injector}. Many of these functions are also exposed on
+ * {@link angular.Module}.
+ *
+ * An Angular **service** is a singleton object created by a **service factory**. These **service
+ * factories** are functions which, in turn, are created by a **service provider**.
+ * The **service providers** are constructor functions. When instantiated they must contain a
+ * property called `$get`, which holds the **service factory** function.
+ *
+ * When you request a service, the {@link auto.$injector $injector} is responsible for finding the
+ * correct **service provider**, instantiating it and then calling its `$get` **service factory**
+ * function to get the instance of the **service**.
+ *
+ * Often services have no configuration options and there is no need to add methods to the service
+ * provider. The provider will be no more than a constructor function with a `$get` property. For
+ * these cases the {@link auto.$provide $provide} service has additional helper methods to register
+ * services without specifying a provider.
+ *
+ * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the
+ * {@link auto.$injector $injector}
+ * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by
+ * providers and services.
+ * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by
+ * services, not providers.
+ * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`,
+ * that will be wrapped in a **service provider** object, whose `$get` property will contain the
+ * given factory function.
+ * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class`
+ * that will be wrapped in a **service provider** object, whose `$get` property will instantiate
+ * a new object using the given constructor function.
+ *
+ * See the individual methods for more information and examples.
+ */
+
+/**
+ * @ngdoc method
+ * @name $provide#provider
+ * @description
+ *
+ * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions
+ * are constructor functions, whose instances are responsible for "providing" a factory for a
+ * service.
+ *
+ * Service provider names start with the name of the service they provide followed by `Provider`.
+ * For example, the {@link ng.$log $log} service has a provider called
+ * {@link ng.$logProvider $logProvider}.
+ *
+ * Service provider objects can have additional methods which allow configuration of the provider
+ * and its service. Importantly, you can configure what kind of service is created by the `$get`
+ * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a
+ * method {@link ng.$logProvider#debugEnabled debugEnabled}
+ * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the
+ * console or not.
+ *
+ * @param {string} name The name of the instance. NOTE: the provider will be available under `name +
+ 'Provider'` key.
+ * @param {(Object|function())} provider If the provider is:
+ *
+ * - `Object`: then it should have a `$get` method. The `$get` method will be invoked using
+ * {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created.
+ * - `Constructor`: a new instance of the provider will be created using
+ * {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`.
+ *
+ * @returns {Object} registered provider instance
+
+ * @example
+ *
+ * The following example shows how to create a simple event tracking service and register it using
+ * {@link auto.$provide#provider $provide.provider()}.
+ *
+ * ```js
+ * // Define the eventTracker provider
+ * function EventTrackerProvider() {
+ * var trackingUrl = '/track';
+ *
+ * // A provider method for configuring where the tracked events should been saved
+ * this.setTrackingUrl = function(url) {
+ * trackingUrl = url;
+ * };
+ *
+ * // The service factory function
+ * this.$get = ['$http', function($http) {
+ * var trackedEvents = {};
+ * return {
+ * // Call this to track an event
+ * event: function(event) {
+ * var count = trackedEvents[event] || 0;
+ * count += 1;
+ * trackedEvents[event] = count;
+ * return count;
+ * },
+ * // Call this to save the tracked events to the trackingUrl
+ * save: function() {
+ * $http.post(trackingUrl, trackedEvents);
+ * }
+ * };
+ * }];
+ * }
+ *
+ * describe('eventTracker', function() {
+ * var postSpy;
+ *
+ * beforeEach(module(function($provide) {
+ * // Register the eventTracker provider
+ * $provide.provider('eventTracker', EventTrackerProvider);
+ * }));
+ *
+ * beforeEach(module(function(eventTrackerProvider) {
+ * // Configure eventTracker provider
+ * eventTrackerProvider.setTrackingUrl('/custom-track');
+ * }));
+ *
+ * it('tracks events', inject(function(eventTracker) {
+ * expect(eventTracker.event('login')).toEqual(1);
+ * expect(eventTracker.event('login')).toEqual(2);
+ * }));
+ *
+ * it('saves to the tracking url', inject(function(eventTracker, $http) {
+ * postSpy = spyOn($http, 'post');
+ * eventTracker.event('login');
+ * eventTracker.save();
+ * expect(postSpy).toHaveBeenCalled();
+ * expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');
+ * expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');
+ * expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });
+ * }));
+ * });
+ * ```
+ */
+
+/**
+ * @ngdoc method
+ * @name $provide#factory
+ * @description
+ *
+ * Register a **service factory**, which will be called to return the service instance.
+ * This is short for registering a service where its provider consists of only a `$get` property,
+ * which is the given service factory function.
+ * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to
+ * configure your service in a provider.
+ *
+ * @param {string} name The name of the instance.
+ * @param {function()} $getFn The $getFn for the instance creation. Internally this is a short hand
+ * for `$provide.provider(name, {$get: $getFn})`.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here is an example of registering a service
+ * ```js
+ * $provide.factory('ping', ['$http', function($http) {
+ * return function ping() {
+ * return $http.send('/ping');
+ * };
+ * }]);
+ * ```
+ * You would then inject and use this service like this:
+ * ```js
+ * someModule.controller('Ctrl', ['ping', function(ping) {
+ * ping();
+ * }]);
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#service
+ * @description
+ *
+ * Register a **service constructor**, which will be invoked with `new` to create the service
+ * instance.
+ * This is short for registering a service where its provider's `$get` property is the service
+ * constructor function that will be used to instantiate the service instance.
+ *
+ * You should use {@link auto.$provide#service $provide.service(class)} if you define your service
+ * as a type/class.
+ *
+ * @param {string} name The name of the instance.
+ * @param {Function} constructor A class (constructor function) that will be instantiated.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here is an example of registering a service using
+ * {@link auto.$provide#service $provide.service(class)}.
+ * ```js
+ * var Ping = function($http) {
+ * this.$http = $http;
+ * };
+ *
+ * Ping.$inject = ['$http'];
+ *
+ * Ping.prototype.send = function() {
+ * return this.$http.get('/ping');
+ * };
+ * $provide.service('ping', Ping);
+ * ```
+ * You would then inject and use this service like this:
+ * ```js
+ * someModule.controller('Ctrl', ['ping', function(ping) {
+ * ping.send();
+ * }]);
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#value
+ * @description
+ *
+ * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a
+ * number, an array, an object or a function. This is short for registering a service where its
+ * provider's `$get` property is a factory function that takes no arguments and returns the **value
+ * service**.
+ *
+ * Value services are similar to constant services, except that they cannot be injected into a
+ * module configuration function (see {@link angular.Module#config}) but they can be overridden by
+ * an Angular
+ * {@link auto.$provide#decorator decorator}.
+ *
+ * @param {string} name The name of the instance.
+ * @param {*} value The value.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here are some examples of creating value services.
+ * ```js
+ * $provide.value('ADMIN_USER', 'admin');
+ *
+ * $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });
+ *
+ * $provide.value('halfOf', function(value) {
+ * return value / 2;
+ * });
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#constant
+ * @description
+ *
+ * Register a **constant service**, such as a string, a number, an array, an object or a function,
+ * with the {@link auto.$injector $injector}. Unlike {@link auto.$provide#value value} it can be
+ * injected into a module configuration function (see {@link angular.Module#config}) and it cannot
+ * be overridden by an Angular {@link auto.$provide#decorator decorator}.
+ *
+ * @param {string} name The name of the constant.
+ * @param {*} value The constant value.
+ * @returns {Object} registered instance
+ *
+ * @example
+ * Here a some examples of creating constants:
+ * ```js
+ * $provide.constant('SHARD_HEIGHT', 306);
+ *
+ * $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);
+ *
+ * $provide.constant('double', function(value) {
+ * return value * 2;
+ * });
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#decorator
+ * @description
+ *
+ * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator
+ * intercepts the creation of a service, allowing it to override or modify the behaviour of the
+ * service. The object returned by the decorator may be the original service, or a new service
+ * object which replaces or wraps and delegates to the original service.
+ *
+ * @param {string} name The name of the service to decorate.
+ * @param {function()} decorator This function will be invoked when the service needs to be
+ * instantiated and should return the decorated service instance. The function is called using
+ * the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.
+ * Local injection arguments:
+ *
+ * * `$delegate` - The original service instance, which can be monkey patched, configured,
+ * decorated or delegated to.
+ *
+ * @example
+ * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting
+ * calls to {@link ng.$log#error $log.warn()}.
+ * ```js
+ * $provide.decorator('$log', ['$delegate', function($delegate) {
+ * $delegate.warn = $delegate.error;
+ * return $delegate;
+ * }]);
+ * ```
+ */
+
+
+function createInjector(modulesToLoad) {
+ var INSTANTIATING = {},
+ providerSuffix = 'Provider',
+ path = [],
+ loadedModules = new HashMap([], true),
+ providerCache = {
+ $provide: {
+ provider: supportObject(provider),
+ factory: supportObject(factory),
+ service: supportObject(service),
+ value: supportObject(value),
+ constant: supportObject(constant),
+ decorator: decorator
+ }
+ },
+ providerInjector = (providerCache.$injector =
+ createInternalInjector(providerCache, function() {
+ throw $injectorMinErr('unpr', "Unknown provider: {0}", path.join(' <- '));
+ })),
+ instanceCache = {},
+ instanceInjector = (instanceCache.$injector =
+ createInternalInjector(instanceCache, function(servicename) {
+ var provider = providerInjector.get(servicename + providerSuffix);
+ return instanceInjector.invoke(provider.$get, provider);
+ }));
+
+
+ forEach(loadModules(modulesToLoad), function(fn) { instanceInjector.invoke(fn || noop); });
+
+ return instanceInjector;
+
+ ////////////////////////////////////
+ // $provider
+ ////////////////////////////////////
+
+ function supportObject(delegate) {
+ return function(key, value) {
+ if (isObject(key)) {
+ forEach(key, reverseParams(delegate));
+ } else {
+ return delegate(key, value);
+ }
+ };
+ }
+
+ function provider(name, provider_) {
+ assertNotHasOwnProperty(name, 'service');
+ if (isFunction(provider_) || isArray(provider_)) {
+ provider_ = providerInjector.instantiate(provider_);
+ }
+ if (!provider_.$get) {
+ throw $injectorMinErr('pget', "Provider '{0}' must define $get factory method.", name);
+ }
+ return providerCache[name + providerSuffix] = provider_;
+ }
+
+ function factory(name, factoryFn) { return provider(name, { $get: factoryFn }); }
+
+ function service(name, constructor) {
+ return factory(name, ['$injector', function($injector) {
+ return $injector.instantiate(constructor);
+ }]);
+ }
+
+ function value(name, val) { return factory(name, valueFn(val)); }
+
+ function constant(name, value) {
+ assertNotHasOwnProperty(name, 'constant');
+ providerCache[name] = value;
+ instanceCache[name] = value;
+ }
+
+ function decorator(serviceName, decorFn) {
+ var origProvider = providerInjector.get(serviceName + providerSuffix),
+ orig$get = origProvider.$get;
+
+ origProvider.$get = function() {
+ var origInstance = instanceInjector.invoke(orig$get, origProvider);
+ return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});
+ };
+ }
+
+ ////////////////////////////////////
+ // Module Loading
+ ////////////////////////////////////
+ function loadModules(modulesToLoad){
+ var runBlocks = [], moduleFn, invokeQueue, i, ii;
+ forEach(modulesToLoad, function(module) {
+ if (loadedModules.get(module)) return;
+ loadedModules.put(module, true);
+
+ try {
+ if (isString(module)) {
+ moduleFn = angularModule(module);
+ runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
+
+ for(invokeQueue = moduleFn._invokeQueue, i = 0, ii = invokeQueue.length; i < ii; i++) {
+ var invokeArgs = invokeQueue[i],
+ provider = providerInjector.get(invokeArgs[0]);
+
+ provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
+ }
+ } else if (isFunction(module)) {
+ runBlocks.push(providerInjector.invoke(module));
+ } else if (isArray(module)) {
+ runBlocks.push(providerInjector.invoke(module));
+ } else {
+ assertArgFn(module, 'module');
+ }
+ } catch (e) {
+ if (isArray(module)) {
+ module = module[module.length - 1];
+ }
+ if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {
+ // Safari & FF's stack traces don't contain error.message content
+ // unlike those of Chrome and IE
+ // So if stack doesn't contain message, we create a new string that contains both.
+ // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
+ /* jshint -W022 */
+ e = e.message + '\n' + e.stack;
+ }
+ throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
+ module, e.stack || e.message || e);
+ }
+ });
+ return runBlocks;
+ }
+
+ ////////////////////////////////////
+ // internal Injector
+ ////////////////////////////////////
+
+ function createInternalInjector(cache, factory) {
+
+ function getService(serviceName) {
+ if (cache.hasOwnProperty(serviceName)) {
+ if (cache[serviceName] === INSTANTIATING) {
+ throw $injectorMinErr('cdep', 'Circular dependency found: {0}',
+ serviceName + ' <- ' + path.join(' <- '));
+ }
+ return cache[serviceName];
+ } else {
+ try {
+ path.unshift(serviceName);
+ cache[serviceName] = INSTANTIATING;
+ return cache[serviceName] = factory(serviceName);
+ } catch (err) {
+ if (cache[serviceName] === INSTANTIATING) {
+ delete cache[serviceName];
+ }
+ throw err;
+ } finally {
+ path.shift();
+ }
+ }
+ }
+
+ function invoke(fn, self, locals){
+ var args = [],
+ $inject = annotate(fn),
+ length, i,
+ key;
+
+ for(i = 0, length = $inject.length; i < length; i++) {
+ key = $inject[i];
+ if (typeof key !== 'string') {
+ throw $injectorMinErr('itkn',
+ 'Incorrect injection token! Expected service name as string, got {0}', key);
+ }
+ args.push(
+ locals && locals.hasOwnProperty(key)
+ ? locals[key]
+ : getService(key)
+ );
+ }
+ if (isArray(fn)) {
+ fn = fn[length];
+ }
+
+ // http://jsperf.com/angularjs-invoke-apply-vs-switch
+ // #5388
+ return fn.apply(self, args);
+ }
+
+ function instantiate(Type, locals) {
+ var Constructor = function() {},
+ instance, returnedValue;
+
+ // Check if Type is annotated and use just the given function at n-1 as parameter
+ // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
+ Constructor.prototype = (isArray(Type) ? Type[Type.length - 1] : Type).prototype;
+ instance = new Constructor();
+ returnedValue = invoke(Type, instance, locals);
+
+ return isObject(returnedValue) || isFunction(returnedValue) ? returnedValue : instance;
+ }
+
+ return {
+ invoke: invoke,
+ instantiate: instantiate,
+ get: getService,
+ annotate: annotate,
+ has: function(name) {
+ return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);
+ }
+ };
+ }
+}
+
+/**
+ * @ngdoc service
+ * @name $anchorScroll
+ * @kind function
+ * @requires $window
+ * @requires $location
+ * @requires $rootScope
+ *
+ * @description
+ * When called, it checks current value of `$location.hash()` and scrolls to the related element,
+ * according to rules specified in
+ * [Html5 spec](http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document).
+ *
+ * It also watches the `$location.hash()` and scrolls whenever it changes to match any anchor.
+ * This can be disabled by calling `$anchorScrollProvider.disableAutoScrolling()`.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <div id="scrollArea" ng-controller="ScrollCtrl">
+ <a ng-click="gotoBottom()">Go to bottom</a>
+ <a id="bottom"></a> You're at the bottom!
+ </div>
+ </file>
+ <file name="script.js">
+ function ScrollCtrl($scope, $location, $anchorScroll) {
+ $scope.gotoBottom = function (){
+ // set the location.hash to the id of
+ // the element you wish to scroll to.
+ $location.hash('bottom');
+
+ // call $anchorScroll()
+ $anchorScroll();
+ };
+ }
+ </file>
+ <file name="style.css">
+ #scrollArea {
+ height: 350px;
+ overflow: auto;
+ }
+
+ #bottom {
+ display: block;
+ margin-top: 2000px;
+ }
+ </file>
+ </example>
+ */
+function $AnchorScrollProvider() {
+
+ var autoScrollingEnabled = true;
+
+ this.disableAutoScrolling = function() {
+ autoScrollingEnabled = false;
+ };
+
+ this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {
+ var document = $window.document;
+
+ // helper function to get first anchor from a NodeList
+ // can't use filter.filter, as it accepts only instances of Array
+ // and IE can't convert NodeList to an array using [].slice
+ // TODO(vojta): use filter if we change it to accept lists as well
+ function getFirstAnchor(list) {
+ var result = null;
+ forEach(list, function(element) {
+ if (!result && lowercase(element.nodeName) === 'a') result = element;
+ });
+ return result;
+ }
+
+ function scroll() {
+ var hash = $location.hash(), elm;
+
+ // empty hash, scroll to the top of the page
+ if (!hash) $window.scrollTo(0, 0);
+
+ // element with given id
+ else if ((elm = document.getElementById(hash))) elm.scrollIntoView();
+
+ // first anchor with given name :-D
+ else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView();
+
+ // no element and hash == 'top', scroll to the top of the page
+ else if (hash === 'top') $window.scrollTo(0, 0);
+ }
+
+ // does not scroll when user clicks on anchor link that is currently on
+ // (no url change, no $location.hash() change), browser native does scroll
+ if (autoScrollingEnabled) {
+ $rootScope.$watch(function autoScrollWatch() {return $location.hash();},
+ function autoScrollWatchAction() {
+ $rootScope.$evalAsync(scroll);
+ });
+ }
+
+ return scroll;
+ }];
+}
+
+var $animateMinErr = minErr('$animate');
+
+/**
+ * @ngdoc provider
+ * @name $animateProvider
+ *
+ * @description
+ * Default implementation of $animate that doesn't perform any animations, instead just
+ * synchronously performs DOM
+ * updates and calls done() callbacks.
+ *
+ * In order to enable animations the ngAnimate module has to be loaded.
+ *
+ * To see the functional implementation check out src/ngAnimate/animate.js
+ */
+var $AnimateProvider = ['$provide', function($provide) {
+
+
+ this.$$selectors = {};
+
+
+ /**
+ * @ngdoc method
+ * @name $animateProvider#register
+ *
+ * @description
+ * Registers a new injectable animation factory function. The factory function produces the
+ * animation object which contains callback functions for each event that is expected to be
+ * animated.
+ *
+ * * `eventFn`: `function(Element, doneFunction)` The element to animate, the `doneFunction`
+ * must be called once the element animation is complete. If a function is returned then the
+ * animation service will use this function to cancel the animation whenever a cancel event is
+ * triggered.
+ *
+ *
+ * ```js
+ * return {
+ * eventFn : function(element, done) {
+ * //code to run the animation
+ * //once complete, then run done()
+ * return function cancellationFunction() {
+ * //code to cancel the animation
+ * }
+ * }
+ * }
+ * ```
+ *
+ * @param {string} name The name of the animation.
+ * @param {Function} factory The factory function that will be executed to return the animation
+ * object.
+ */
+ this.register = function(name, factory) {
+ var key = name + '-animation';
+ if (name && name.charAt(0) != '.') throw $animateMinErr('notcsel',
+ "Expecting class selector starting with '.' got '{0}'.", name);
+ this.$$selectors[name.substr(1)] = key;
+ $provide.factory(key, factory);
+ };
+
+ /**
+ * @ngdoc method
+ * @name $animateProvider#classNameFilter
+ *
+ * @description
+ * Sets and/or returns the CSS class regular expression that is checked when performing
+ * an animation. Upon bootstrap the classNameFilter value is not set at all and will
+ * therefore enable $animate to attempt to perform an animation on any element.
+ * When setting the classNameFilter value, animations will only be performed on elements
+ * that successfully match the filter expression. This in turn can boost performance
+ * for low-powered devices as well as applications containing a lot of structural operations.
+ * @param {RegExp=} expression The className expression which will be checked against all animations
+ * @return {RegExp} The current CSS className expression value. If null then there is no expression value
+ */
+ this.classNameFilter = function(expression) {
+ if(arguments.length === 1) {
+ this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;
+ }
+ return this.$$classNameFilter;
+ };
+
+ this.$get = ['$timeout', '$$asyncCallback', function($timeout, $$asyncCallback) {
+
+ function async(fn) {
+ fn && $$asyncCallback(fn);
+ }
+
+ /**
+ *
+ * @ngdoc service
+ * @name $animate
+ * @description The $animate service provides rudimentary DOM manipulation functions to
+ * insert, remove and move elements within the DOM, as well as adding and removing classes.
+ * This service is the core service used by the ngAnimate $animator service which provides
+ * high-level animation hooks for CSS and JavaScript.
+ *
+ * $animate is available in the AngularJS core, however, the ngAnimate module must be included
+ * to enable full out animation support. Otherwise, $animate will only perform simple DOM
+ * manipulation operations.
+ *
+ * To learn more about enabling animation support, click here to visit the {@link ngAnimate
+ * ngAnimate module page} as well as the {@link ngAnimate.$animate ngAnimate $animate service
+ * page}.
+ */
+ return {
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#enter
+ * @kind function
+ * @description Inserts the element into the DOM either after the `after` element or within
+ * the `parent` element. Once complete, the done() callback will be fired (if provided).
+ * @param {DOMElement} element the element which will be inserted into the DOM
+ * @param {DOMElement} parent the parent element which will append the element as
+ * a child (if the after element is not present)
+ * @param {DOMElement} after the sibling element which will append the element
+ * after itself
+ * @param {Function=} done callback function that will be called after the element has been
+ * inserted into the DOM
+ */
+ enter : function(element, parent, after, done) {
+ if (after) {
+ after.after(element);
+ } else {
+ if (!parent || !parent[0]) {
+ parent = after.parent();
+ }
+ parent.append(element);
+ }
+ async(done);
+ },
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#leave
+ * @kind function
+ * @description Removes the element from the DOM. Once complete, the done() callback will be
+ * fired (if provided).
+ * @param {DOMElement} element the element which will be removed from the DOM
+ * @param {Function=} done callback function that will be called after the element has been
+ * removed from the DOM
+ */
+ leave : function(element, done) {
+ element.remove();
+ async(done);
+ },
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#move
+ * @kind function
+ * @description Moves the position of the provided element within the DOM to be placed
+ * either after the `after` element or inside of the `parent` element. Once complete, the
+ * done() callback will be fired (if provided).
+ *
+ * @param {DOMElement} element the element which will be moved around within the
+ * DOM
+ * @param {DOMElement} parent the parent element where the element will be
+ * inserted into (if the after element is not present)
+ * @param {DOMElement} after the sibling element where the element will be
+ * positioned next to
+ * @param {Function=} done the callback function (if provided) that will be fired after the
+ * element has been moved to its new position
+ */
+ move : function(element, parent, after, done) {
+ // Do not remove element before insert. Removing will cause data associated with the
+ // element to be dropped. Insert will implicitly do the remove.
+ this.enter(element, parent, after, done);
+ },
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#addClass
+ * @kind function
+ * @description Adds the provided className CSS class value to the provided element. Once
+ * complete, the done() callback will be fired (if provided).
+ * @param {DOMElement} element the element which will have the className value
+ * added to it
+ * @param {string} className the CSS class which will be added to the element
+ * @param {Function=} done the callback function (if provided) that will be fired after the
+ * className value has been added to the element
+ */
+ addClass : function(element, className, done) {
+ className = isString(className) ?
+ className :
+ isArray(className) ? className.join(' ') : '';
+ forEach(element, function (element) {
+ jqLiteAddClass(element, className);
+ });
+ async(done);
+ },
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#removeClass
+ * @kind function
+ * @description Removes the provided className CSS class value from the provided element.
+ * Once complete, the done() callback will be fired (if provided).
+ * @param {DOMElement} element the element which will have the className value
+ * removed from it
+ * @param {string} className the CSS class which will be removed from the element
+ * @param {Function=} done the callback function (if provided) that will be fired after the
+ * className value has been removed from the element
+ */
+ removeClass : function(element, className, done) {
+ className = isString(className) ?
+ className :
+ isArray(className) ? className.join(' ') : '';
+ forEach(element, function (element) {
+ jqLiteRemoveClass(element, className);
+ });
+ async(done);
+ },
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#setClass
+ * @kind function
+ * @description Adds and/or removes the given CSS classes to and from the element.
+ * Once complete, the done() callback will be fired (if provided).
+ * @param {DOMElement} element the element which will have its CSS classes changed
+ * removed from it
+ * @param {string} add the CSS classes which will be added to the element
+ * @param {string} remove the CSS class which will be removed from the element
+ * @param {Function=} done the callback function (if provided) that will be fired after the
+ * CSS classes have been set on the element
+ */
+ setClass : function(element, add, remove, done) {
+ forEach(element, function (element) {
+ jqLiteAddClass(element, add);
+ jqLiteRemoveClass(element, remove);
+ });
+ async(done);
+ },
+
+ enabled : noop
+ };
+ }];
+}];
+
+function $$AsyncCallbackProvider(){
+ this.$get = ['$$rAF', '$timeout', function($$rAF, $timeout) {
+ return $$rAF.supported
+ ? function(fn) { return $$rAF(fn); }
+ : function(fn) {
+ return $timeout(fn, 0, false);
+ };
+ }];
+}
+
+/**
+ * ! This is a private undocumented service !
+ *
+ * @name $browser
+ * @requires $log
+ * @description
+ * This object has two goals:
+ *
+ * - hide all the global state in the browser caused by the window object
+ * - abstract away all the browser specific features and inconsistencies
+ *
+ * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`
+ * service, which can be used for convenient testing of the application without the interaction with
+ * the real browser apis.
+ */
+/**
+ * @param {object} window The global window object.
+ * @param {object} document jQuery wrapped document.
+ * @param {function()} XHR XMLHttpRequest constructor.
+ * @param {object} $log console.log or an object with the same interface.
+ * @param {object} $sniffer $sniffer service
+ */
+function Browser(window, document, $log, $sniffer) {
+ var self = this,
+ rawDocument = document[0],
+ location = window.location,
+ history = window.history,
+ setTimeout = window.setTimeout,
+ clearTimeout = window.clearTimeout,
+ pendingDeferIds = {};
+
+ self.isMock = false;
+
+ var outstandingRequestCount = 0;
+ var outstandingRequestCallbacks = [];
+
+ // TODO(vojta): remove this temporary api
+ self.$$completeOutstandingRequest = completeOutstandingRequest;
+ self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };
+
+ /**
+ * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`
+ * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.
+ */
+ function completeOutstandingRequest(fn) {
+ try {
+ fn.apply(null, sliceArgs(arguments, 1));
+ } finally {
+ outstandingRequestCount--;
+ if (outstandingRequestCount === 0) {
+ while(outstandingRequestCallbacks.length) {
+ try {
+ outstandingRequestCallbacks.pop()();
+ } catch (e) {
+ $log.error(e);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @private
+ * Note: this method is used only by scenario runner
+ * TODO(vojta): prefix this method with $$ ?
+ * @param {function()} callback Function that will be called when no outstanding request
+ */
+ self.notifyWhenNoOutstandingRequests = function(callback) {
+ // force browser to execute all pollFns - this is needed so that cookies and other pollers fire
+ // at some deterministic time in respect to the test runner's actions. Leaving things up to the
+ // regular poller would result in flaky tests.
+ forEach(pollFns, function(pollFn){ pollFn(); });
+
+ if (outstandingRequestCount === 0) {
+ callback();
+ } else {
+ outstandingRequestCallbacks.push(callback);
+ }
+ };
+
+ //////////////////////////////////////////////////////////////
+ // Poll Watcher API
+ //////////////////////////////////////////////////////////////
+ var pollFns = [],
+ pollTimeout;
+
+ /**
+ * @name $browser#addPollFn
+ *
+ * @param {function()} fn Poll function to add
+ *
+ * @description
+ * Adds a function to the list of functions that poller periodically executes,
+ * and starts polling if not started yet.
+ *
+ * @returns {function()} the added function
+ */
+ self.addPollFn = function(fn) {
+ if (isUndefined(pollTimeout)) startPoller(100, setTimeout);
+ pollFns.push(fn);
+ return fn;
+ };
+
+ /**
+ * @param {number} interval How often should browser call poll functions (ms)
+ * @param {function()} setTimeout Reference to a real or fake `setTimeout` function.
+ *
+ * @description
+ * Configures the poller to run in the specified intervals, using the specified
+ * setTimeout fn and kicks it off.
+ */
+ function startPoller(interval, setTimeout) {
+ (function check() {
+ forEach(pollFns, function(pollFn){ pollFn(); });
+ pollTimeout = setTimeout(check, interval);
+ })();
+ }
+
+ //////////////////////////////////////////////////////////////
+ // URL API
+ //////////////////////////////////////////////////////////////
+
+ var lastBrowserUrl = location.href,
+ baseElement = document.find('base'),
+ newLocation = null;
+
+ /**
+ * @name $browser#url
+ *
+ * @description
+ * GETTER:
+ * Without any argument, this method just returns current value of location.href.
+ *
+ * SETTER:
+ * With at least one argument, this method sets url to new value.
+ * If html5 history api supported, pushState/replaceState is used, otherwise
+ * location.href/location.replace is used.
+ * Returns its own instance to allow chaining
+ *
+ * NOTE: this api is intended for use only by the $location service. Please use the
+ * {@link ng.$location $location service} to change url.
+ *
+ * @param {string} url New url (when used as setter)
+ * @param {boolean=} replace Should new url replace current history record ?
+ */
+ self.url = function(url, replace) {
+ // Android Browser BFCache causes location, history reference to become stale.
+ if (location !== window.location) location = window.location;
+ if (history !== window.history) history = window.history;
+
+ // setter
+ if (url) {
+ if (lastBrowserUrl == url) return;
+ lastBrowserUrl = url;
+ if ($sniffer.history) {
+ if (replace) history.replaceState(null, '', url);
+ else {
+ history.pushState(null, '', url);
+ // Crazy Opera Bug: http://my.opera.com/community/forums/topic.dml?id=1185462
+ baseElement.attr('href', baseElement.attr('href'));
+ }
+ } else {
+ newLocation = url;
+ if (replace) {
+ location.replace(url);
+ } else {
+ location.href = url;
+ }
+ }
+ return self;
+ // getter
+ } else {
+ // - newLocation is a workaround for an IE7-9 issue with location.replace and location.href
+ // methods not updating location.href synchronously.
+ // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172
+ return newLocation || location.href.replace(/%27/g,"'");
+ }
+ };
+
+ var urlChangeListeners = [],
+ urlChangeInit = false;
+
+ function fireUrlChange() {
+ newLocation = null;
+ if (lastBrowserUrl == self.url()) return;
+
+ lastBrowserUrl = self.url();
+ forEach(urlChangeListeners, function(listener) {
+ listener(self.url());
+ });
+ }
+
+ /**
+ * @name $browser#onUrlChange
+ *
+ * @description
+ * Register callback function that will be called, when url changes.
+ *
+ * It's only called when the url is changed from outside of angular:
+ * - user types different url into address bar
+ * - user clicks on history (forward/back) button
+ * - user clicks on a link
+ *
+ * It's not called when url is changed by $browser.url() method
+ *
+ * The listener gets called with new url as parameter.
+ *
+ * NOTE: this api is intended for use only by the $location service. Please use the
+ * {@link ng.$location $location service} to monitor url changes in angular apps.
+ *
+ * @param {function(string)} listener Listener function to be called when url changes.
+ * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.
+ */
+ self.onUrlChange = function(callback) {
+ // TODO(vojta): refactor to use node's syntax for events
+ if (!urlChangeInit) {
+ // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)
+ // don't fire popstate when user change the address bar and don't fire hashchange when url
+ // changed by push/replaceState
+
+ // html5 history api - popstate event
+ if ($sniffer.history) jqLite(window).on('popstate', fireUrlChange);
+ // hashchange event
+ if ($sniffer.hashchange) jqLite(window).on('hashchange', fireUrlChange);
+ // polling
+ else self.addPollFn(fireUrlChange);
+
+ urlChangeInit = true;
+ }
+
+ urlChangeListeners.push(callback);
+ return callback;
+ };
+
+ /**
+ * Checks whether the url has changed outside of Angular.
+ * Needs to be exported to be able to check for changes that have been done in sync,
+ * as hashchange/popstate events fire in async.
+ */
+ self.$$checkUrlChange = fireUrlChange;
+
+ //////////////////////////////////////////////////////////////
+ // Misc API
+ //////////////////////////////////////////////////////////////
+
+ /**
+ * @name $browser#baseHref
+ *
+ * @description
+ * Returns current <base href>
+ * (always relative - without domain)
+ *
+ * @returns {string} The current base href
+ */
+ self.baseHref = function() {
+ var href = baseElement.attr('href');
+ return href ? href.replace(/^(https?\:)?\/\/[^\/]*/, '') : '';
+ };
+
+ //////////////////////////////////////////////////////////////
+ // Cookies API
+ //////////////////////////////////////////////////////////////
+ var lastCookies = {};
+ var lastCookieString = '';
+ var cookiePath = self.baseHref();
+
+ /**
+ * @name $browser#cookies
+ *
+ * @param {string=} name Cookie name
+ * @param {string=} value Cookie value
+ *
+ * @description
+ * The cookies method provides a 'private' low level access to browser cookies.
+ * It is not meant to be used directly, use the $cookie service instead.
+ *
+ * The return values vary depending on the arguments that the method was called with as follows:
+ *
+ * - cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify
+ * it
+ * - cookies(name, value) -> set name to value, if value is undefined delete the cookie
+ * - cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that
+ * way)
+ *
+ * @returns {Object} Hash of all cookies (if called without any parameter)
+ */
+ self.cookies = function(name, value) {
+ /* global escape: false, unescape: false */
+ var cookieLength, cookieArray, cookie, i, index;
+
+ if (name) {
+ if (value === undefined) {
+ rawDocument.cookie = escape(name) + "=;path=" + cookiePath +
+ ";expires=Thu, 01 Jan 1970 00:00:00 GMT";
+ } else {
+ if (isString(value)) {
+ cookieLength = (rawDocument.cookie = escape(name) + '=' + escape(value) +
+ ';path=' + cookiePath).length + 1;
+
+ // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:
+ // - 300 cookies
+ // - 20 cookies per unique domain
+ // - 4096 bytes per cookie
+ if (cookieLength > 4096) {
+ $log.warn("Cookie '"+ name +
+ "' possibly not set or overflowed because it was too large ("+
+ cookieLength + " > 4096 bytes)!");
+ }
+ }
+ }
+ } else {
+ if (rawDocument.cookie !== lastCookieString) {
+ lastCookieString = rawDocument.cookie;
+ cookieArray = lastCookieString.split("; ");
+ lastCookies = {};
+
+ for (i = 0; i < cookieArray.length; i++) {
+ cookie = cookieArray[i];
+ index = cookie.indexOf('=');
+ if (index > 0) { //ignore nameless cookies
+ name = unescape(cookie.substring(0, index));
+ // the first value that is seen for a cookie is the most
+ // specific one. values for the same cookie name that
+ // follow are for less specific paths.
+ if (lastCookies[name] === undefined) {
+ lastCookies[name] = unescape(cookie.substring(index + 1));
+ }
+ }
+ }
+ }
+ return lastCookies;
+ }
+ };
+
+
+ /**
+ * @name $browser#defer
+ * @param {function()} fn A function, who's execution should be deferred.
+ * @param {number=} [delay=0] of milliseconds to defer the function execution.
+ * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.
+ *
+ * @description
+ * Executes a fn asynchronously via `setTimeout(fn, delay)`.
+ *
+ * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using
+ * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed
+ * via `$browser.defer.flush()`.
+ *
+ */
+ self.defer = function(fn, delay) {
+ var timeoutId;
+ outstandingRequestCount++;
+ timeoutId = setTimeout(function() {
+ delete pendingDeferIds[timeoutId];
+ completeOutstandingRequest(fn);
+ }, delay || 0);
+ pendingDeferIds[timeoutId] = true;
+ return timeoutId;
+ };
+
+
+ /**
+ * @name $browser#defer.cancel
+ *
+ * @description
+ * Cancels a deferred task identified with `deferId`.
+ *
+ * @param {*} deferId Token returned by the `$browser.defer` function.
+ * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
+ * canceled.
+ */
+ self.defer.cancel = function(deferId) {
+ if (pendingDeferIds[deferId]) {
+ delete pendingDeferIds[deferId];
+ clearTimeout(deferId);
+ completeOutstandingRequest(noop);
+ return true;
+ }
+ return false;
+ };
+
+}
+
+function $BrowserProvider(){
+ this.$get = ['$window', '$log', '$sniffer', '$document',
+ function( $window, $log, $sniffer, $document){
+ return new Browser($window, $document, $log, $sniffer);
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $cacheFactory
+ *
+ * @description
+ * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to
+ * them.
+ *
+ * ```js
+ *
+ * var cache = $cacheFactory('cacheId');
+ * expect($cacheFactory.get('cacheId')).toBe(cache);
+ * expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
+ *
+ * cache.put("key", "value");
+ * cache.put("another key", "another value");
+ *
+ * // We've specified no options on creation
+ * expect(cache.info()).toEqual({id: 'cacheId', size: 2});
+ *
+ * ```
+ *
+ *
+ * @param {string} cacheId Name or id of the newly created cache.
+ * @param {object=} options Options object that specifies the cache behavior. Properties:
+ *
+ * - `{number=}` `capacity` — turns the cache into LRU cache.
+ *
+ * @returns {object} Newly created cache object with the following set of methods:
+ *
+ * - `{object}` `info()` — Returns id, size, and options of cache.
+ * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns
+ * it.
+ * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.
+ * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.
+ * - `{void}` `removeAll()` — Removes all cached values.
+ * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.
+ *
+ * @example
+ <example module="cacheExampleApp">
+ <file name="index.html">
+ <div ng-controller="CacheController">
+ <input ng-model="newCacheKey" placeholder="Key">
+ <input ng-model="newCacheValue" placeholder="Value">
+ <button ng-click="put(newCacheKey, newCacheValue)">Cache</button>
+
+ <p ng-if="keys.length">Cached Values</p>
+ <div ng-repeat="key in keys">
+ <span ng-bind="key"></span>
+ <span>: </span>
+ <b ng-bind="cache.get(key)"></b>
+ </div>
+
+ <p>Cache Info</p>
+ <div ng-repeat="(key, value) in cache.info()">
+ <span ng-bind="key"></span>
+ <span>: </span>
+ <b ng-bind="value"></b>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('cacheExampleApp', []).
+ controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {
+ $scope.keys = [];
+ $scope.cache = $cacheFactory('cacheId');
+ $scope.put = function(key, value) {
+ if ($scope.cache.get(key) === undefined) {
+ $scope.keys.push(key);
+ }
+ $scope.cache.put(key, value === undefined ? null : value);
+ };
+ }]);
+ </file>
+ <file name="style.css">
+ p {
+ margin: 10px 0 3px;
+ }
+ </file>
+ </example>
+ */
+function $CacheFactoryProvider() {
+
+ this.$get = function() {
+ var caches = {};
+
+ function cacheFactory(cacheId, options) {
+ if (cacheId in caches) {
+ throw minErr('$cacheFactory')('iid', "CacheId '{0}' is already taken!", cacheId);
+ }
+
+ var size = 0,
+ stats = extend({}, options, {id: cacheId}),
+ data = {},
+ capacity = (options && options.capacity) || Number.MAX_VALUE,
+ lruHash = {},
+ freshEnd = null,
+ staleEnd = null;
+
+ /**
+ * @ngdoc type
+ * @name $cacheFactory.Cache
+ *
+ * @description
+ * A cache object used to store and retrieve data, primarily used by
+ * {@link $http $http} and the {@link ng.directive:script script} directive to cache
+ * templates and other data.
+ *
+ * ```js
+ * angular.module('superCache')
+ * .factory('superCache', ['$cacheFactory', function($cacheFactory) {
+ * return $cacheFactory('super-cache');
+ * }]);
+ * ```
+ *
+ * Example test:
+ *
+ * ```js
+ * it('should behave like a cache', inject(function(superCache) {
+ * superCache.put('key', 'value');
+ * superCache.put('another key', 'another value');
+ *
+ * expect(superCache.info()).toEqual({
+ * id: 'super-cache',
+ * size: 2
+ * });
+ *
+ * superCache.remove('another key');
+ * expect(superCache.get('another key')).toBeUndefined();
+ *
+ * superCache.removeAll();
+ * expect(superCache.info()).toEqual({
+ * id: 'super-cache',
+ * size: 0
+ * });
+ * }));
+ * ```
+ */
+ return caches[cacheId] = {
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#put
+ * @kind function
+ *
+ * @description
+ * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be
+ * retrieved later, and incrementing the size of the cache if the key was not already
+ * present in the cache. If behaving like an LRU cache, it will also remove stale
+ * entries from the set.
+ *
+ * It will not insert undefined values into the cache.
+ *
+ * @param {string} key the key under which the cached data is stored.
+ * @param {*} value the value to store alongside the key. If it is undefined, the key
+ * will not be stored.
+ * @returns {*} the value stored.
+ */
+ put: function(key, value) {
+ if (capacity < Number.MAX_VALUE) {
+ var lruEntry = lruHash[key] || (lruHash[key] = {key: key});
+
+ refresh(lruEntry);
+ }
+
+ if (isUndefined(value)) return;
+ if (!(key in data)) size++;
+ data[key] = value;
+
+ if (size > capacity) {
+ this.remove(staleEnd.key);
+ }
+
+ return value;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#get
+ * @kind function
+ *
+ * @description
+ * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object.
+ *
+ * @param {string} key the key of the data to be retrieved
+ * @returns {*} the value stored.
+ */
+ get: function(key) {
+ if (capacity < Number.MAX_VALUE) {
+ var lruEntry = lruHash[key];
+
+ if (!lruEntry) return;
+
+ refresh(lruEntry);
+ }
+
+ return data[key];
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#remove
+ * @kind function
+ *
+ * @description
+ * Removes an entry from the {@link $cacheFactory.Cache Cache} object.
+ *
+ * @param {string} key the key of the entry to be removed
+ */
+ remove: function(key) {
+ if (capacity < Number.MAX_VALUE) {
+ var lruEntry = lruHash[key];
+
+ if (!lruEntry) return;
+
+ if (lruEntry == freshEnd) freshEnd = lruEntry.p;
+ if (lruEntry == staleEnd) staleEnd = lruEntry.n;
+ link(lruEntry.n,lruEntry.p);
+
+ delete lruHash[key];
+ }
+
+ delete data[key];
+ size--;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#removeAll
+ * @kind function
+ *
+ * @description
+ * Clears the cache object of any entries.
+ */
+ removeAll: function() {
+ data = {};
+ size = 0;
+ lruHash = {};
+ freshEnd = staleEnd = null;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#destroy
+ * @kind function
+ *
+ * @description
+ * Destroys the {@link $cacheFactory.Cache Cache} object entirely,
+ * removing it from the {@link $cacheFactory $cacheFactory} set.
+ */
+ destroy: function() {
+ data = null;
+ stats = null;
+ lruHash = null;
+ delete caches[cacheId];
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#info
+ * @kind function
+ *
+ * @description
+ * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}.
+ *
+ * @returns {object} an object with the following properties:
+ * <ul>
+ * <li>**id**: the id of the cache instance</li>
+ * <li>**size**: the number of entries kept in the cache instance</li>
+ * <li>**...**: any additional properties from the options object when creating the
+ * cache.</li>
+ * </ul>
+ */
+ info: function() {
+ return extend({}, stats, {size: size});
+ }
+ };
+
+
+ /**
+ * makes the `entry` the freshEnd of the LRU linked list
+ */
+ function refresh(entry) {
+ if (entry != freshEnd) {
+ if (!staleEnd) {
+ staleEnd = entry;
+ } else if (staleEnd == entry) {
+ staleEnd = entry.n;
+ }
+
+ link(entry.n, entry.p);
+ link(entry, freshEnd);
+ freshEnd = entry;
+ freshEnd.n = null;
+ }
+ }
+
+
+ /**
+ * bidirectionally links two entries of the LRU linked list
+ */
+ function link(nextEntry, prevEntry) {
+ if (nextEntry != prevEntry) {
+ if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify
+ if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify
+ }
+ }
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory#info
+ *
+ * @description
+ * Get information about all the caches that have been created
+ *
+ * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info`
+ */
+ cacheFactory.info = function() {
+ var info = {};
+ forEach(caches, function(cache, cacheId) {
+ info[cacheId] = cache.info();
+ });
+ return info;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory#get
+ *
+ * @description
+ * Get access to a cache object by the `cacheId` used when it was created.
+ *
+ * @param {string} cacheId Name or id of a cache to access.
+ * @returns {object} Cache object identified by the cacheId or undefined if no such cache.
+ */
+ cacheFactory.get = function(cacheId) {
+ return caches[cacheId];
+ };
+
+
+ return cacheFactory;
+ };
+}
+
+/**
+ * @ngdoc service
+ * @name $templateCache
+ *
+ * @description
+ * The first time a template is used, it is loaded in the template cache for quick retrieval. You
+ * can load templates directly into the cache in a `script` tag, or by consuming the
+ * `$templateCache` service directly.
+ *
+ * Adding via the `script` tag:
+ *
+ * ```html
+ * <script type="text/ng-template" id="templateId.html">
+ * <p>This is the content of the template</p>
+ * </script>
+ * ```
+ *
+ * **Note:** the `script` tag containing the template does not need to be included in the `head` of
+ * the document, but it must be below the `ng-app` definition.
+ *
+ * Adding via the $templateCache service:
+ *
+ * ```js
+ * var myApp = angular.module('myApp', []);
+ * myApp.run(function($templateCache) {
+ * $templateCache.put('templateId.html', 'This is the content of the template');
+ * });
+ * ```
+ *
+ * To retrieve the template later, simply use it in your HTML:
+ * ```html
+ * <div ng-include=" 'templateId.html' "></div>
+ * ```
+ *
+ * or get it via Javascript:
+ * ```js
+ * $templateCache.get('templateId.html')
+ * ```
+ *
+ * See {@link ng.$cacheFactory $cacheFactory}.
+ *
+ */
+function $TemplateCacheProvider() {
+ this.$get = ['$cacheFactory', function($cacheFactory) {
+ return $cacheFactory('templates');
+ }];
+}
+
+/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!
+ *
+ * DOM-related variables:
+ *
+ * - "node" - DOM Node
+ * - "element" - DOM Element or Node
+ * - "$node" or "$element" - jqLite-wrapped node or element
+ *
+ *
+ * Compiler related stuff:
+ *
+ * - "linkFn" - linking fn of a single directive
+ * - "nodeLinkFn" - function that aggregates all linking fns for a particular node
+ * - "childLinkFn" - function that aggregates all linking fns for child nodes of a particular node
+ * - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList)
+ */
+
+
+/**
+ * @ngdoc service
+ * @name $compile
+ * @kind function
+ *
+ * @description
+ * Compiles an HTML string or DOM into a template and produces a template function, which
+ * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together.
+ *
+ * The compilation is a process of walking the DOM tree and matching DOM elements to
+ * {@link ng.$compileProvider#directive directives}.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** This document is an in-depth reference of all directive options.
+ * For a gentle introduction to directives with examples of common use cases,
+ * see the {@link guide/directive directive guide}.
+ * </div>
+ *
+ * ## Comprehensive Directive API
+ *
+ * There are many different options for a directive.
+ *
+ * The difference resides in the return value of the factory function.
+ * You can either return a "Directive Definition Object" (see below) that defines the directive properties,
+ * or just the `postLink` function (all other properties will have the default values).
+ *
+ * <div class="alert alert-success">
+ * **Best Practice:** It's recommended to use the "directive definition object" form.
+ * </div>
+ *
+ * Here's an example directive declared with a Directive Definition Object:
+ *
+ * ```js
+ * var myModule = angular.module(...);
+ *
+ * myModule.directive('directiveName', function factory(injectables) {
+ * var directiveDefinitionObject = {
+ * priority: 0,
+ * template: '<div></div>', // or // function(tElement, tAttrs) { ... },
+ * // or
+ * // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... },
+ * transclude: false,
+ * restrict: 'A',
+ * scope: false,
+ * controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },
+ * controllerAs: 'stringAlias',
+ * require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],
+ * compile: function compile(tElement, tAttrs, transclude) {
+ * return {
+ * pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ * post: function postLink(scope, iElement, iAttrs, controller) { ... }
+ * }
+ * // or
+ * // return function postLink( ... ) { ... }
+ * },
+ * // or
+ * // link: {
+ * // pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ * // post: function postLink(scope, iElement, iAttrs, controller) { ... }
+ * // }
+ * // or
+ * // link: function postLink( ... ) { ... }
+ * };
+ * return directiveDefinitionObject;
+ * });
+ * ```
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Any unspecified options will use the default value. You can see the default values below.
+ * </div>
+ *
+ * Therefore the above can be simplified as:
+ *
+ * ```js
+ * var myModule = angular.module(...);
+ *
+ * myModule.directive('directiveName', function factory(injectables) {
+ * var directiveDefinitionObject = {
+ * link: function postLink(scope, iElement, iAttrs) { ... }
+ * };
+ * return directiveDefinitionObject;
+ * // or
+ * // return function postLink(scope, iElement, iAttrs) { ... }
+ * });
+ * ```
+ *
+ *
+ *
+ * ### Directive Definition Object
+ *
+ * The directive definition object provides instructions to the {@link ng.$compile
+ * compiler}. The attributes are:
+ *
+ * #### `priority`
+ * When there are multiple directives defined on a single DOM element, sometimes it
+ * is necessary to specify the order in which the directives are applied. The `priority` is used
+ * to sort the directives before their `compile` functions get called. Priority is defined as a
+ * number. Directives with greater numerical `priority` are compiled first. Pre-link functions
+ * are also run in priority order, but post-link functions are run in reverse order. The order
+ * of directives with the same priority is undefined. The default priority is `0`.
+ *
+ * #### `terminal`
+ * If set to true then the current `priority` will be the last set of directives
+ * which will execute (any directives at the current priority will still execute
+ * as the order of execution on same `priority` is undefined).
+ *
+ * #### `scope`
+ * **If set to `true`,** then a new scope will be created for this directive. If multiple directives on the
+ * same element request a new scope, only one new scope is created. The new scope rule does not
+ * apply for the root of the template since the root of the template always gets a new scope.
+ *
+ * **If set to `{}` (object hash),** then a new "isolate" scope is created. The 'isolate' scope differs from
+ * normal scope in that it does not prototypically inherit from the parent scope. This is useful
+ * when creating reusable components, which should not accidentally read or modify data in the
+ * parent scope.
+ *
+ * The 'isolate' scope takes an object hash which defines a set of local scope properties
+ * derived from the parent scope. These local properties are useful for aliasing values for
+ * templates. Locals definition is a hash of local scope property to its source:
+ *
+ * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is
+ * always a string since DOM attributes are strings. If no `attr` name is specified then the
+ * attribute name is assumed to be the same as the local name.
+ * Given `<widget my-attr="hello {{name}}">` and widget definition
+ * of `scope: { localName:'@myAttr' }`, then widget scope property `localName` will reflect
+ * the interpolated value of `hello {{name}}`. As the `name` attribute changes so will the
+ * `localName` property on the widget scope. The `name` is read from the parent scope (not
+ * component scope).
+ *
+ * * `=` or `=attr` - set up bi-directional binding between a local scope property and the
+ * parent scope property of name defined via the value of the `attr` attribute. If no `attr`
+ * name is specified then the attribute name is assumed to be the same as the local name.
+ * Given `<widget my-attr="parentModel">` and widget definition of
+ * `scope: { localModel:'=myAttr' }`, then widget scope property `localModel` will reflect the
+ * value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected
+ * in `localModel` and any changes in `localModel` will reflect in `parentModel`. If the parent
+ * scope property doesn't exist, it will throw a NON_ASSIGNABLE_MODEL_EXPRESSION exception. You
+ * can avoid this behavior using `=?` or `=?attr` in order to flag the property as optional.
+ *
+ * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope.
+ * If no `attr` name is specified then the attribute name is assumed to be the same as the
+ * local name. Given `<widget my-attr="count = count + value">` and widget definition of
+ * `scope: { localFn:'&myAttr' }`, then isolate scope property `localFn` will point to
+ * a function wrapper for the `count = count + value` expression. Often it's desirable to
+ * pass data from the isolated scope via an expression to the parent scope, this can be
+ * done by passing a map of local variable names and values into the expression wrapper fn.
+ * For example, if the expression is `increment(amount)` then we can specify the amount value
+ * by calling the `localFn` as `localFn({amount: 22})`.
+ *
+ *
+ *
+ * #### `controller`
+ * Controller constructor function. The controller is instantiated before the
+ * pre-linking phase and it is shared with other directives (see
+ * `require` attribute). This allows the directives to communicate with each other and augment
+ * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals:
+ *
+ * * `$scope` - Current scope associated with the element
+ * * `$element` - Current element
+ * * `$attrs` - Current attributes object for the element
+ * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope.
+ * The scope can be overridden by an optional first argument.
+ * `function([scope], cloneLinkingFn)`.
+ *
+ *
+ * #### `require`
+ * Require another directive and inject its controller as the fourth argument to the linking function. The
+ * `require` takes a string name (or array of strings) of the directive(s) to pass in. If an array is used, the
+ * injected argument will be an array in corresponding order. If no such directive can be
+ * found, or if the directive does not have a controller, then an error is raised. The name can be prefixed with:
+ *
+ * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.
+ * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.
+ * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found.
+ * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass
+ * `null` to the `link` fn if not found.
+ *
+ *
+ * #### `controllerAs`
+ * Controller alias at the directive scope. An alias for the controller so it
+ * can be referenced at the directive template. The directive needs to define a scope for this
+ * configuration to be used. Useful in the case when directive is used as component.
+ *
+ *
+ * #### `restrict`
+ * String of subset of `EACM` which restricts the directive to a specific directive
+ * declaration style. If omitted, the default (attributes only) is used.
+ *
+ * * `E` - Element name: `<my-directive></my-directive>`
+ * * `A` - Attribute (default): `<div my-directive="exp"></div>`
+ * * `C` - Class: `<div class="my-directive: exp;"></div>`
+ * * `M` - Comment: `<!-- directive: my-directive exp -->`
+ *
+ *
+ * #### `template`
+ * HTML markup that may:
+ * * Replace the contents of the directive's element (default).
+ * * Replace the directive's element itself (if `replace` is true - DEPRECATED).
+ * * Wrap the contents of the directive's element (if `transclude` is true).
+ *
+ * Value may be:
+ *
+ * * A string. For example `<div red-on-hover>{{delete_str}}</div>`.
+ * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile`
+ * function api below) and returns a string value.
+ *
+ *
+ * #### `templateUrl`
+ * Same as `template` but the template is loaded from the specified URL. Because
+ * the template loading is asynchronous the compilation/linking is suspended until the template
+ * is loaded.
+ *
+ * You can specify `templateUrl` as a string representing the URL or as a function which takes two
+ * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns
+ * a string value representing the url. In either case, the template URL is passed through {@link
+ * api/ng.$sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}.
+ *
+ *
+ * #### `replace` ([*DEPRECATED*!], will be removed in next major release)
+ * specify what the template should replace. Defaults to `false`.
+ *
+ * * `true` - the template will replace the directive's element.
+ * * `false` - the template will replace the contents of the directive's element.
+ *
+ * The replacement process migrates all of the attributes / classes from the old element to the new
+ * one. See the {@link guide/directive#creating-custom-directives_creating-directives_template-expanding-directive
+ * Directives Guide} for an example.
+ *
+ * #### `transclude`
+ * compile the content of the element and make it available to the directive.
+ * Typically used with {@link ng.directive:ngTransclude
+ * ngTransclude}. The advantage of transclusion is that the linking function receives a
+ * transclusion function which is pre-bound to the correct scope. In a typical setup the widget
+ * creates an `isolate` scope, but the transclusion is not a child, but a sibling of the `isolate`
+ * scope. This makes it possible for the widget to have private state, and the transclusion to
+ * be bound to the parent (pre-`isolate`) scope.
+ *
+ * * `true` - transclude the content of the directive.
+ * * `'element'` - transclude the whole element including any directives defined at lower priority.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** When testing an element transclude directive you must not place the directive at the root of the
+ * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives
+ * Testing Transclusion Directives}.
+ * </div>
+ *
+ * #### `compile`
+ *
+ * ```js
+ * function compile(tElement, tAttrs, transclude) { ... }
+ * ```
+ *
+ * The compile function deals with transforming the template DOM. Since most directives do not do
+ * template transformation, it is not used often. The compile function takes the following arguments:
+ *
+ * * `tElement` - template element - The element where the directive has been declared. It is
+ * safe to do template transformation on the element and child elements only.
+ *
+ * * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared
+ * between all directive compile functions.
+ *
+ * * `transclude` - [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`
+ *
+ * <div class="alert alert-warning">
+ * **Note:** The template instance and the link instance may be different objects if the template has
+ * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that
+ * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration
+ * should be done in a linking function rather than in a compile function.
+ * </div>
+
+ * <div class="alert alert-warning">
+ * **Note:** The compile function cannot handle directives that recursively use themselves in their
+ * own templates or compile functions. Compiling these directives results in an infinite loop and a
+ * stack overflow errors.
+ *
+ * This can be avoided by manually using $compile in the postLink function to imperatively compile
+ * a directive's template instead of relying on automatic template compilation via `template` or
+ * `templateUrl` declaration or manual compilation inside the compile function.
+ * </div>
+ *
+ * <div class="alert alert-error">
+ * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it
+ * e.g. does not know about the right outer scope. Please use the transclude function that is passed
+ * to the link function instead.
+ * </div>
+
+ * A compile function can have a return value which can be either a function or an object.
+ *
+ * * returning a (post-link) function - is equivalent to registering the linking function via the
+ * `link` property of the config object when the compile function is empty.
+ *
+ * * returning an object with function(s) registered via `pre` and `post` properties - allows you to
+ * control when a linking function should be called during the linking phase. See info about
+ * pre-linking and post-linking functions below.
+ *
+ *
+ * #### `link`
+ * This property is used only if the `compile` property is not defined.
+ *
+ * ```js
+ * function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }
+ * ```
+ *
+ * The link function is responsible for registering DOM listeners as well as updating the DOM. It is
+ * executed after the template has been cloned. This is where most of the directive logic will be
+ * put.
+ *
+ * * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the
+ * directive for registering {@link ng.$rootScope.Scope#$watch watches}.
+ *
+ * * `iElement` - instance element - The element where the directive is to be used. It is safe to
+ * manipulate the children of the element only in `postLink` function since the children have
+ * already been linked.
+ *
+ * * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared
+ * between all directive linking functions.
+ *
+ * * `controller` - a controller instance - A controller instance if at least one directive on the
+ * element defines a controller. The controller is shared among all the directives, which allows
+ * the directives to use the controllers as a communication channel.
+ *
+ * * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.
+ * The scope can be overridden by an optional first argument. This is the same as the `$transclude`
+ * parameter of directive controllers.
+ * `function([scope], cloneLinkingFn)`.
+ *
+ *
+ * #### Pre-linking function
+ *
+ * Executed before the child elements are linked. Not safe to do DOM transformation since the
+ * compiler linking function will fail to locate the correct elements for linking.
+ *
+ * #### Post-linking function
+ *
+ * Executed after the child elements are linked. It is safe to do DOM transformation in the post-linking function.
+ *
+ * <a name="Attributes"></a>
+ * ### Attributes
+ *
+ * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the
+ * `link()` or `compile()` functions. It has a variety of uses.
+ *
+ * accessing *Normalized attribute names:*
+ * Directives like 'ngBind' can be expressed in many ways: 'ng:bind', `data-ng-bind`, or 'x-ng-bind'.
+ * the attributes object allows for normalized access to
+ * the attributes.
+ *
+ * * *Directive inter-communication:* All directives share the same instance of the attributes
+ * object which allows the directives to use the attributes object as inter directive
+ * communication.
+ *
+ * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object
+ * allowing other directives to read the interpolated value.
+ *
+ * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes
+ * that contain interpolation (e.g. `src="{{bar}}"`). Not only is this very efficient but it's also
+ * the only way to easily get the actual value because during the linking phase the interpolation
+ * hasn't been evaluated yet and so the value is at this time set to `undefined`.
+ *
+ * ```js
+ * function linkingFn(scope, elm, attrs, ctrl) {
+ * // get the attribute value
+ * console.log(attrs.ngModel);
+ *
+ * // change the attribute
+ * attrs.$set('ngModel', 'new value');
+ *
+ * // observe changes to interpolated attribute
+ * attrs.$observe('ngModel', function(value) {
+ * console.log('ngModel has changed value to ' + value);
+ * });
+ * }
+ * ```
+ *
+ * Below is an example using `$compileProvider`.
+ *
+ * <div class="alert alert-warning">
+ * **Note**: Typically directives are registered with `module.directive`. The example below is
+ * to illustrate how `$compile` works.
+ * </div>
+ *
+ <example module="compileExample">
+ <file name="index.html">
+ <script>
+ angular.module('compileExample', [], function($compileProvider) {
+ // configure new 'compile' directive by passing a directive
+ // factory function. The factory function injects the '$compile'
+ $compileProvider.directive('compile', function($compile) {
+ // directive factory creates a link function
+ return function(scope, element, attrs) {
+ scope.$watch(
+ function(scope) {
+ // watch the 'compile' expression for changes
+ return scope.$eval(attrs.compile);
+ },
+ function(value) {
+ // when the 'compile' expression changes
+ // assign it into the current DOM
+ element.html(value);
+
+ // compile the new DOM and link it to the current
+ // scope.
+ // NOTE: we only compile .childNodes so that
+ // we don't get into infinite loop compiling ourselves
+ $compile(element.contents())(scope);
+ }
+ );
+ };
+ });
+ })
+ .controller('GreeterController', ['$scope', function($scope) {
+ $scope.name = 'Angular';
+ $scope.html = 'Hello {{name}}';
+ }]);
+ </script>
+ <div ng-controller="GreeterController">
+ <input ng-model="name"> <br>
+ <textarea ng-model="html"></textarea> <br>
+ <div compile="html"></div>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should auto compile', function() {
+ var textarea = $('textarea');
+ var output = $('div[compile]');
+ // The initial state reads 'Hello Angular'.
+ expect(output.getText()).toBe('Hello Angular');
+ textarea.clear();
+ textarea.sendKeys('{{name}}!');
+ expect(output.getText()).toBe('Angular!');
+ });
+ </file>
+ </example>
+
+ *
+ *
+ * @param {string|DOMElement} element Element or HTML string to compile into a template function.
+ * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives.
+ * @param {number} maxPriority only apply directives lower than given priority (Only effects the
+ * root element(s), not their children)
+ * @returns {function(scope, cloneAttachFn=)} a link function which is used to bind template
+ * (a DOM element/tree) to a scope. Where:
+ *
+ * * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.
+ * * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the
+ * `template` and call the `cloneAttachFn` function allowing the caller to attach the
+ * cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is
+ * called as: <br> `cloneAttachFn(clonedElement, scope)` where:
+ *
+ * * `clonedElement` - is a clone of the original `element` passed into the compiler.
+ * * `scope` - is the current scope with which the linking function is working with.
+ *
+ * Calling the linking function returns the element of the template. It is either the original
+ * element passed in, or the clone of the element if the `cloneAttachFn` is provided.
+ *
+ * After linking the view is not updated until after a call to $digest which typically is done by
+ * Angular automatically.
+ *
+ * If you need access to the bound view, there are two ways to do it:
+ *
+ * - If you are not asking the linking function to clone the template, create the DOM element(s)
+ * before you send them to the compiler and keep this reference around.
+ * ```js
+ * var element = $compile('<p>{{total}}</p>')(scope);
+ * ```
+ *
+ * - if on the other hand, you need the element to be cloned, the view reference from the original
+ * example would not point to the clone, but rather to the original template that was cloned. In
+ * this case, you can access the clone via the cloneAttachFn:
+ * ```js
+ * var templateElement = angular.element('<p>{{total}}</p>'),
+ * scope = ....;
+ *
+ * var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {
+ * //attach the clone to DOM document at the right place
+ * });
+ *
+ * //now we have reference to the cloned DOM via `clonedElement`
+ * ```
+ *
+ *
+ * For information on how the compiler works, see the
+ * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.
+ */
+
+var $compileMinErr = minErr('$compile');
+
+/**
+ * @ngdoc provider
+ * @name $compileProvider
+ * @kind function
+ *
+ * @description
+ */
+$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
+function $CompileProvider($provide, $$sanitizeUriProvider) {
+ var hasDirectives = {},
+ Suffix = 'Directive',
+ COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w_\-]+)\s+(.*)$/,
+ CLASS_DIRECTIVE_REGEXP = /(([\d\w_\-]+)(?:\:([^;]+))?;?)/;
+
+ // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes
+ // The assumption is that future DOM event attribute names will begin with
+ // 'on' and be composed of only English letters.
+ var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#directive
+ * @kind function
+ *
+ * @description
+ * Register a new directive with the compiler.
+ *
+ * @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which
+ * will match as <code>ng-bind</code>), or an object map of directives where the keys are the
+ * names and the values are the factories.
+ * @param {Function|Array} directiveFactory An injectable directive factory function. See
+ * {@link guide/directive} for more info.
+ * @returns {ng.$compileProvider} Self for chaining.
+ */
+ this.directive = function registerDirective(name, directiveFactory) {
+ assertNotHasOwnProperty(name, 'directive');
+ if (isString(name)) {
+ assertArg(directiveFactory, 'directiveFactory');
+ if (!hasDirectives.hasOwnProperty(name)) {
+ hasDirectives[name] = [];
+ $provide.factory(name + Suffix, ['$injector', '$exceptionHandler',
+ function($injector, $exceptionHandler) {
+ var directives = [];
+ forEach(hasDirectives[name], function(directiveFactory, index) {
+ try {
+ var directive = $injector.invoke(directiveFactory);
+ if (isFunction(directive)) {
+ directive = { compile: valueFn(directive) };
+ } else if (!directive.compile && directive.link) {
+ directive.compile = valueFn(directive.link);
+ }
+ directive.priority = directive.priority || 0;
+ directive.index = index;
+ directive.name = directive.name || name;
+ directive.require = directive.require || (directive.controller && directive.name);
+ directive.restrict = directive.restrict || 'A';
+ directives.push(directive);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ });
+ return directives;
+ }]);
+ }
+ hasDirectives[name].push(directiveFactory);
+ } else {
+ forEach(name, reverseParams(registerDirective));
+ }
+ return this;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#aHrefSanitizationWhitelist
+ * @kind function
+ *
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during a[href] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to a[href] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.aHrefSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp);
+ return this;
+ } else {
+ return $$sanitizeUriProvider.aHrefSanitizationWhitelist();
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#imgSrcSanitizationWhitelist
+ * @kind function
+ *
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during img[src] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to img[src] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.imgSrcSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp);
+ return this;
+ } else {
+ return $$sanitizeUriProvider.imgSrcSanitizationWhitelist();
+ }
+ };
+
+ this.$get = [
+ '$injector', '$interpolate', '$exceptionHandler', '$http', '$templateCache', '$parse',
+ '$controller', '$rootScope', '$document', '$sce', '$animate', '$$sanitizeUri',
+ function($injector, $interpolate, $exceptionHandler, $http, $templateCache, $parse,
+ $controller, $rootScope, $document, $sce, $animate, $$sanitizeUri) {
+
+ var Attributes = function(element, attr) {
+ this.$$element = element;
+ this.$attr = attr || {};
+ };
+
+ Attributes.prototype = {
+ $normalize: directiveNormalize,
+
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$addClass
+ * @kind function
+ *
+ * @description
+ * Adds the CSS class value specified by the classVal parameter to the element. If animations
+ * are enabled then an animation will be triggered for the class addition.
+ *
+ * @param {string} classVal The className value that will be added to the element
+ */
+ $addClass : function(classVal) {
+ if(classVal && classVal.length > 0) {
+ $animate.addClass(this.$$element, classVal);
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$removeClass
+ * @kind function
+ *
+ * @description
+ * Removes the CSS class value specified by the classVal parameter from the element. If
+ * animations are enabled then an animation will be triggered for the class removal.
+ *
+ * @param {string} classVal The className value that will be removed from the element
+ */
+ $removeClass : function(classVal) {
+ if(classVal && classVal.length > 0) {
+ $animate.removeClass(this.$$element, classVal);
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$updateClass
+ * @kind function
+ *
+ * @description
+ * Adds and removes the appropriate CSS class values to the element based on the difference
+ * between the new and old CSS class values (specified as newClasses and oldClasses).
+ *
+ * @param {string} newClasses The current CSS className value
+ * @param {string} oldClasses The former CSS className value
+ */
+ $updateClass : function(newClasses, oldClasses) {
+ var toAdd = tokenDifference(newClasses, oldClasses);
+ var toRemove = tokenDifference(oldClasses, newClasses);
+
+ if(toAdd.length === 0) {
+ $animate.removeClass(this.$$element, toRemove);
+ } else if(toRemove.length === 0) {
+ $animate.addClass(this.$$element, toAdd);
+ } else {
+ $animate.setClass(this.$$element, toAdd, toRemove);
+ }
+ },
+
+ /**
+ * Set a normalized attribute on the element in a way such that all directives
+ * can share the attribute. This function properly handles boolean attributes.
+ * @param {string} key Normalized key. (ie ngAttribute)
+ * @param {string|boolean} value The value to set. If `null` attribute will be deleted.
+ * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.
+ * Defaults to true.
+ * @param {string=} attrName Optional none normalized name. Defaults to key.
+ */
+ $set: function(key, value, writeAttr, attrName) {
+ // TODO: decide whether or not to throw an error if "class"
+ //is set through this function since it may cause $updateClass to
+ //become unstable.
+
+ var booleanKey = getBooleanAttrName(this.$$element[0], key),
+ normalizedVal,
+ nodeName;
+
+ if (booleanKey) {
+ this.$$element.prop(key, value);
+ attrName = booleanKey;
+ }
+
+ this[key] = value;
+
+ // translate normalized key to actual key
+ if (attrName) {
+ this.$attr[key] = attrName;
+ } else {
+ attrName = this.$attr[key];
+ if (!attrName) {
+ this.$attr[key] = attrName = snake_case(key, '-');
+ }
+ }
+
+ nodeName = nodeName_(this.$$element);
+
+ // sanitize a[href] and img[src] values
+ if ((nodeName === 'A' && key === 'href') ||
+ (nodeName === 'IMG' && key === 'src')) {
+ this[key] = value = $$sanitizeUri(value, key === 'src');
+ }
+
+ if (writeAttr !== false) {
+ if (value === null || value === undefined) {
+ this.$$element.removeAttr(attrName);
+ } else {
+ this.$$element.attr(attrName, value);
+ }
+ }
+
+ // fire observers
+ var $$observers = this.$$observers;
+ $$observers && forEach($$observers[key], function(fn) {
+ try {
+ fn(value);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ });
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$observe
+ * @kind function
+ *
+ * @description
+ * Observes an interpolated attribute.
+ *
+ * The observer function will be invoked once during the next `$digest` following
+ * compilation. The observer is then invoked whenever the interpolated value
+ * changes.
+ *
+ * @param {string} key Normalized key. (ie ngAttribute) .
+ * @param {function(interpolatedValue)} fn Function that will be called whenever
+ the interpolated value of the attribute changes.
+ * See the {@link guide/directive#Attributes Directives} guide for more info.
+ * @returns {function()} the `fn` parameter.
+ */
+ $observe: function(key, fn) {
+ var attrs = this,
+ $$observers = (attrs.$$observers || (attrs.$$observers = {})),
+ listeners = ($$observers[key] || ($$observers[key] = []));
+
+ listeners.push(fn);
+ $rootScope.$evalAsync(function() {
+ if (!listeners.$$inter) {
+ // no one registered attribute interpolation function, so lets call it manually
+ fn(attrs[key]);
+ }
+ });
+ return fn;
+ }
+ };
+
+ var startSymbol = $interpolate.startSymbol(),
+ endSymbol = $interpolate.endSymbol(),
+ denormalizeTemplate = (startSymbol == '{{' || endSymbol == '}}')
+ ? identity
+ : function denormalizeTemplate(template) {
+ return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
+ },
+ NG_ATTR_BINDING = /^ngAttr[A-Z]/;
+
+
+ return compile;
+
+ //================================
+
+ function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,
+ previousCompileContext) {
+ if (!($compileNodes instanceof jqLite)) {
+ // jquery always rewraps, whereas we need to preserve the original selector so that we can
+ // modify it.
+ $compileNodes = jqLite($compileNodes);
+ }
+ // We can not compile top level text elements since text nodes can be merged and we will
+ // not be able to attach scope data to them, so we will wrap them in <span>
+ forEach($compileNodes, function(node, index){
+ if (node.nodeType == 3 /* text node */ && node.nodeValue.match(/\S+/) /* non-empty */ ) {
+ $compileNodes[index] = node = jqLite(node).wrap('<span></span>').parent()[0];
+ }
+ });
+ var compositeLinkFn =
+ compileNodes($compileNodes, transcludeFn, $compileNodes,
+ maxPriority, ignoreDirective, previousCompileContext);
+ safeAddClass($compileNodes, 'ng-scope');
+ return function publicLinkFn(scope, cloneConnectFn, transcludeControllers, parentBoundTranscludeFn){
+ assertArg(scope, 'scope');
+ // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart
+ // and sometimes changes the structure of the DOM.
+ var $linkNode = cloneConnectFn
+ ? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!!
+ : $compileNodes;
+
+ forEach(transcludeControllers, function(instance, name) {
+ $linkNode.data('$' + name + 'Controller', instance);
+ });
+
+ // Attach scope only to non-text nodes.
+ for(var i = 0, ii = $linkNode.length; i<ii; i++) {
+ var node = $linkNode[i],
+ nodeType = node.nodeType;
+ if (nodeType === 1 /* element */ || nodeType === 9 /* document */) {
+ $linkNode.eq(i).data('$scope', scope);
+ }
+ }
+
+ if (cloneConnectFn) cloneConnectFn($linkNode, scope);
+ if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn);
+ return $linkNode;
+ };
+ }
+
+ function safeAddClass($element, className) {
+ try {
+ $element.addClass(className);
+ } catch(e) {
+ // ignore, since it means that we are trying to set class on
+ // SVG element, where class name is read-only.
+ }
+ }
+
+ /**
+ * Compile function matches each node in nodeList against the directives. Once all directives
+ * for a particular node are collected their compile functions are executed. The compile
+ * functions return values - the linking functions - are combined into a composite linking
+ * function, which is the a linking function for the node.
+ *
+ * @param {NodeList} nodeList an array of nodes or NodeList to compile
+ * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the
+ * scope argument is auto-generated to the new child of the transcluded parent scope.
+ * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then
+ * the rootElement must be set the jqLite collection of the compile root. This is
+ * needed so that the jqLite collection items can be replaced with widgets.
+ * @param {number=} maxPriority Max directive priority.
+ * @returns {Function} A composite linking function of all of the matched directives or null.
+ */
+ function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,
+ previousCompileContext) {
+ var linkFns = [],
+ attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound;
+
+ for (var i = 0; i < nodeList.length; i++) {
+ attrs = new Attributes();
+
+ // we must always refer to nodeList[i] since the nodes can be replaced underneath us.
+ directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,
+ ignoreDirective);
+
+ nodeLinkFn = (directives.length)
+ ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement,
+ null, [], [], previousCompileContext)
+ : null;
+
+ if (nodeLinkFn && nodeLinkFn.scope) {
+ safeAddClass(attrs.$$element, 'ng-scope');
+ }
+
+ childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||
+ !(childNodes = nodeList[i].childNodes) ||
+ !childNodes.length)
+ ? null
+ : compileNodes(childNodes,
+ nodeLinkFn ? (
+ (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement)
+ && nodeLinkFn.transclude) : transcludeFn);
+
+ linkFns.push(nodeLinkFn, childLinkFn);
+ linkFnFound = linkFnFound || nodeLinkFn || childLinkFn;
+ //use the previous context only for the first element in the virtual group
+ previousCompileContext = null;
+ }
+
+ // return a linking function if we have found anything, null otherwise
+ return linkFnFound ? compositeLinkFn : null;
+
+ function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {
+ var nodeLinkFn, childLinkFn, node, childScope, i, ii, n, childBoundTranscludeFn;
+
+ // copy nodeList so that linking doesn't break due to live list updates.
+ var nodeListLength = nodeList.length,
+ stableNodeList = new Array(nodeListLength);
+ for (i = 0; i < nodeListLength; i++) {
+ stableNodeList[i] = nodeList[i];
+ }
+
+ for(i = 0, n = 0, ii = linkFns.length; i < ii; n++) {
+ node = stableNodeList[n];
+ nodeLinkFn = linkFns[i++];
+ childLinkFn = linkFns[i++];
+
+ if (nodeLinkFn) {
+ if (nodeLinkFn.scope) {
+ childScope = scope.$new();
+ jqLite.data(node, '$scope', childScope);
+ } else {
+ childScope = scope;
+ }
+
+ if ( nodeLinkFn.transcludeOnThisElement ) {
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, nodeLinkFn.transclude, parentBoundTranscludeFn);
+
+ } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {
+ childBoundTranscludeFn = parentBoundTranscludeFn;
+
+ } else if (!parentBoundTranscludeFn && transcludeFn) {
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);
+
+ } else {
+ childBoundTranscludeFn = null;
+ }
+
+ nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn);
+
+ } else if (childLinkFn) {
+ childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);
+ }
+ }
+ }
+ }
+
+ function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {
+
+ var boundTranscludeFn = function(transcludedScope, cloneFn, controllers) {
+ var scopeCreated = false;
+
+ if (!transcludedScope) {
+ transcludedScope = scope.$new();
+ transcludedScope.$$transcluded = true;
+ scopeCreated = true;
+ }
+
+ var clone = transcludeFn(transcludedScope, cloneFn, controllers, previousBoundTranscludeFn);
+ if (scopeCreated) {
+ clone.on('$destroy', function() { transcludedScope.$destroy(); });
+ }
+ return clone;
+ };
+
+ return boundTranscludeFn;
+ }
+
+ /**
+ * Looks for directives on the given node and adds them to the directive collection which is
+ * sorted.
+ *
+ * @param node Node to search.
+ * @param directives An array to which the directives are added to. This array is sorted before
+ * the function returns.
+ * @param attrs The shared attrs object which is used to populate the normalized attributes.
+ * @param {number=} maxPriority Max directive priority.
+ */
+ function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {
+ var nodeType = node.nodeType,
+ attrsMap = attrs.$attr,
+ match,
+ className;
+
+ switch(nodeType) {
+ case 1: /* Element */
+ // use the node name: <directive>
+ addDirective(directives,
+ directiveNormalize(nodeName_(node).toLowerCase()), 'E', maxPriority, ignoreDirective);
+
+ // iterate over the attributes
+ for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes,
+ j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {
+ var attrStartName = false;
+ var attrEndName = false;
+
+ attr = nAttrs[j];
+ if (!msie || msie >= 8 || attr.specified) {
+ name = attr.name;
+ value = trim(attr.value);
+
+ // support ngAttr attribute binding
+ ngAttrName = directiveNormalize(name);
+ if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) {
+ name = snake_case(ngAttrName.substr(6), '-');
+ }
+
+ var directiveNName = ngAttrName.replace(/(Start|End)$/, '');
+ if (ngAttrName === directiveNName + 'Start') {
+ attrStartName = name;
+ attrEndName = name.substr(0, name.length - 5) + 'end';
+ name = name.substr(0, name.length - 6);
+ }
+
+ nName = directiveNormalize(name.toLowerCase());
+ attrsMap[nName] = name;
+ if (isNgAttr || !attrs.hasOwnProperty(nName)) {
+ attrs[nName] = value;
+ if (getBooleanAttrName(node, nName)) {
+ attrs[nName] = true; // presence means true
+ }
+ }
+ addAttrInterpolateDirective(node, directives, value, nName);
+ addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,
+ attrEndName);
+ }
+ }
+
+ // use class as directive
+ className = node.className;
+ if (isString(className) && className !== '') {
+ while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {
+ nName = directiveNormalize(match[2]);
+ if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {
+ attrs[nName] = trim(match[3]);
+ }
+ className = className.substr(match.index + match[0].length);
+ }
+ }
+ break;
+ case 3: /* Text Node */
+ addTextInterpolateDirective(directives, node.nodeValue);
+ break;
+ case 8: /* Comment */
+ try {
+ match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
+ if (match) {
+ nName = directiveNormalize(match[1]);
+ if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {
+ attrs[nName] = trim(match[2]);
+ }
+ }
+ } catch (e) {
+ // turns out that under some circumstances IE9 throws errors when one attempts to read
+ // comment's node value.
+ // Just ignore it and continue. (Can't seem to reproduce in test case.)
+ }
+ break;
+ }
+
+ directives.sort(byPriority);
+ return directives;
+ }
+
+ /**
+ * Given a node with an directive-start it collects all of the siblings until it finds
+ * directive-end.
+ * @param node
+ * @param attrStart
+ * @param attrEnd
+ * @returns {*}
+ */
+ function groupScan(node, attrStart, attrEnd) {
+ var nodes = [];
+ var depth = 0;
+ if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {
+ var startNode = node;
+ do {
+ if (!node) {
+ throw $compileMinErr('uterdir',
+ "Unterminated attribute, found '{0}' but no matching '{1}' found.",
+ attrStart, attrEnd);
+ }
+ if (node.nodeType == 1 /** Element **/) {
+ if (node.hasAttribute(attrStart)) depth++;
+ if (node.hasAttribute(attrEnd)) depth--;
+ }
+ nodes.push(node);
+ node = node.nextSibling;
+ } while (depth > 0);
+ } else {
+ nodes.push(node);
+ }
+
+ return jqLite(nodes);
+ }
+
+ /**
+ * Wrapper for linking function which converts normal linking function into a grouped
+ * linking function.
+ * @param linkFn
+ * @param attrStart
+ * @param attrEnd
+ * @returns {Function}
+ */
+ function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {
+ return function(scope, element, attrs, controllers, transcludeFn) {
+ element = groupScan(element[0], attrStart, attrEnd);
+ return linkFn(scope, element, attrs, controllers, transcludeFn);
+ };
+ }
+
+ /**
+ * Once the directives have been collected, their compile functions are executed. This method
+ * is responsible for inlining directive templates as well as terminating the application
+ * of the directives if the terminal directive has been reached.
+ *
+ * @param {Array} directives Array of collected directives to execute their compile function.
+ * this needs to be pre-sorted by priority order.
+ * @param {Node} compileNode The raw DOM node to apply the compile functions to
+ * @param {Object} templateAttrs The shared attribute function
+ * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the
+ * scope argument is auto-generated to the new
+ * child of the transcluded parent scope.
+ * @param {JQLite} jqCollection If we are working on the root of the compile tree then this
+ * argument has the root jqLite array so that we can replace nodes
+ * on it.
+ * @param {Object=} originalReplaceDirective An optional directive that will be ignored when
+ * compiling the transclusion.
+ * @param {Array.<Function>} preLinkFns
+ * @param {Array.<Function>} postLinkFns
+ * @param {Object} previousCompileContext Context used for previous compilation of the current
+ * node
+ * @returns {Function} linkFn
+ */
+ function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
+ jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
+ previousCompileContext) {
+ previousCompileContext = previousCompileContext || {};
+
+ var terminalPriority = -Number.MAX_VALUE,
+ newScopeDirective,
+ controllerDirectives = previousCompileContext.controllerDirectives,
+ newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
+ templateDirective = previousCompileContext.templateDirective,
+ nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
+ hasTranscludeDirective = false,
+ hasTemplate = false,
+ hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
+ $compileNode = templateAttrs.$$element = jqLite(compileNode),
+ directive,
+ directiveName,
+ $template,
+ replaceDirective = originalReplaceDirective,
+ childTranscludeFn = transcludeFn,
+ linkFn,
+ directiveValue;
+
+ // executes all directives on the current element
+ for(var i = 0, ii = directives.length; i < ii; i++) {
+ directive = directives[i];
+ var attrStart = directive.$$start;
+ var attrEnd = directive.$$end;
+
+ // collect multiblock sections
+ if (attrStart) {
+ $compileNode = groupScan(compileNode, attrStart, attrEnd);
+ }
+ $template = undefined;
+
+ if (terminalPriority > directive.priority) {
+ break; // prevent further processing of directives
+ }
+
+ if (directiveValue = directive.scope) {
+ newScopeDirective = newScopeDirective || directive;
+
+ // skip the check for directives with async templates, we'll check the derived sync
+ // directive when the template arrives
+ if (!directive.templateUrl) {
+ assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,
+ $compileNode);
+ if (isObject(directiveValue)) {
+ newIsolateScopeDirective = directive;
+ }
+ }
+ }
+
+ directiveName = directive.name;
+
+ if (!directive.templateUrl && directive.controller) {
+ directiveValue = directive.controller;
+ controllerDirectives = controllerDirectives || {};
+ assertNoDuplicate("'" + directiveName + "' controller",
+ controllerDirectives[directiveName], directive, $compileNode);
+ controllerDirectives[directiveName] = directive;
+ }
+
+ if (directiveValue = directive.transclude) {
+ hasTranscludeDirective = true;
+
+ // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.
+ // This option should only be used by directives that know how to safely handle element transclusion,
+ // where the transcluded nodes are added or replaced after linking.
+ if (!directive.$$tlb) {
+ assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);
+ nonTlbTranscludeDirective = directive;
+ }
+
+ if (directiveValue == 'element') {
+ hasElementTranscludeDirective = true;
+ terminalPriority = directive.priority;
+ $template = $compileNode;
+ $compileNode = templateAttrs.$$element =
+ jqLite(document.createComment(' ' + directiveName + ': ' +
+ templateAttrs[directiveName] + ' '));
+ compileNode = $compileNode[0];
+ replaceWith(jqCollection, sliceArgs($template), compileNode);
+
+ childTranscludeFn = compile($template, transcludeFn, terminalPriority,
+ replaceDirective && replaceDirective.name, {
+ // Don't pass in:
+ // - controllerDirectives - otherwise we'll create duplicates controllers
+ // - newIsolateScopeDirective or templateDirective - combining templates with
+ // element transclusion doesn't make sense.
+ //
+ // We need only nonTlbTranscludeDirective so that we prevent putting transclusion
+ // on the same element more than once.
+ nonTlbTranscludeDirective: nonTlbTranscludeDirective
+ });
+ } else {
+ $template = jqLite(jqLiteClone(compileNode)).contents();
+ $compileNode.empty(); // clear contents
+ childTranscludeFn = compile($template, transcludeFn);
+ }
+ }
+
+ if (directive.template) {
+ hasTemplate = true;
+ assertNoDuplicate('template', templateDirective, directive, $compileNode);
+ templateDirective = directive;
+
+ directiveValue = (isFunction(directive.template))
+ ? directive.template($compileNode, templateAttrs)
+ : directive.template;
+
+ directiveValue = denormalizeTemplate(directiveValue);
+
+ if (directive.replace) {
+ replaceDirective = directive;
+ if (jqLiteIsTextNode(directiveValue)) {
+ $template = [];
+ } else {
+ $template = jqLite(trim(directiveValue));
+ }
+ compileNode = $template[0];
+
+ if ($template.length != 1 || compileNode.nodeType !== 1) {
+ throw $compileMinErr('tplrt',
+ "Template for directive '{0}' must have exactly one root element. {1}",
+ directiveName, '');
+ }
+
+ replaceWith(jqCollection, $compileNode, compileNode);
+
+ var newTemplateAttrs = {$attr: {}};
+
+ // combine directives from the original node and from the template:
+ // - take the array of directives for this element
+ // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed)
+ // - collect directives from the template and sort them by priority
+ // - combine directives as: processed + template + unprocessed
+ var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs);
+ var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));
+
+ if (newIsolateScopeDirective) {
+ markDirectivesAsIsolate(templateDirectives);
+ }
+ directives = directives.concat(templateDirectives).concat(unprocessedDirectives);
+ mergeTemplateAttributes(templateAttrs, newTemplateAttrs);
+
+ ii = directives.length;
+ } else {
+ $compileNode.html(directiveValue);
+ }
+ }
+
+ if (directive.templateUrl) {
+ hasTemplate = true;
+ assertNoDuplicate('template', templateDirective, directive, $compileNode);
+ templateDirective = directive;
+
+ if (directive.replace) {
+ replaceDirective = directive;
+ }
+
+ nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,
+ templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, {
+ controllerDirectives: controllerDirectives,
+ newIsolateScopeDirective: newIsolateScopeDirective,
+ templateDirective: templateDirective,
+ nonTlbTranscludeDirective: nonTlbTranscludeDirective
+ });
+ ii = directives.length;
+ } else if (directive.compile) {
+ try {
+ linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);
+ if (isFunction(linkFn)) {
+ addLinkFns(null, linkFn, attrStart, attrEnd);
+ } else if (linkFn) {
+ addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd);
+ }
+ } catch (e) {
+ $exceptionHandler(e, startingTag($compileNode));
+ }
+ }
+
+ if (directive.terminal) {
+ nodeLinkFn.terminal = true;
+ terminalPriority = Math.max(terminalPriority, directive.priority);
+ }
+
+ }
+
+ nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;
+ nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective;
+ nodeLinkFn.templateOnThisElement = hasTemplate;
+ nodeLinkFn.transclude = childTranscludeFn;
+
+ previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective;
+
+ // might be normal or delayed nodeLinkFn depending on if templateUrl is present
+ return nodeLinkFn;
+
+ ////////////////////
+
+ function addLinkFns(pre, post, attrStart, attrEnd) {
+ if (pre) {
+ if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);
+ pre.require = directive.require;
+ pre.directiveName = directiveName;
+ if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
+ pre = cloneAndAnnotateFn(pre, {isolateScope: true});
+ }
+ preLinkFns.push(pre);
+ }
+ if (post) {
+ if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);
+ post.require = directive.require;
+ post.directiveName = directiveName;
+ if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
+ post = cloneAndAnnotateFn(post, {isolateScope: true});
+ }
+ postLinkFns.push(post);
+ }
+ }
+
+
+ function getControllers(directiveName, require, $element, elementControllers) {
+ var value, retrievalMethod = 'data', optional = false;
+ if (isString(require)) {
+ while((value = require.charAt(0)) == '^' || value == '?') {
+ require = require.substr(1);
+ if (value == '^') {
+ retrievalMethod = 'inheritedData';
+ }
+ optional = optional || value == '?';
+ }
+ value = null;
+
+ if (elementControllers && retrievalMethod === 'data') {
+ value = elementControllers[require];
+ }
+ value = value || $element[retrievalMethod]('$' + require + 'Controller');
+
+ if (!value && !optional) {
+ throw $compileMinErr('ctreq',
+ "Controller '{0}', required by directive '{1}', can't be found!",
+ require, directiveName);
+ }
+ return value;
+ } else if (isArray(require)) {
+ value = [];
+ forEach(require, function(require) {
+ value.push(getControllers(directiveName, require, $element, elementControllers));
+ });
+ }
+ return value;
+ }
+
+
+ function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
+ var attrs, $element, i, ii, linkFn, controller, isolateScope, elementControllers = {}, transcludeFn;
+
+ attrs = (compileNode === linkNode)
+ ? templateAttrs
+ : shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr));
+ $element = attrs.$$element;
+
+ if (newIsolateScopeDirective) {
+ var LOCAL_REGEXP = /^\s*([@=&])(\??)\s*(\w*)\s*$/;
+
+ isolateScope = scope.$new(true);
+
+ if (templateDirective && (templateDirective === newIsolateScopeDirective ||
+ templateDirective === newIsolateScopeDirective.$$originalDirective)) {
+ $element.data('$isolateScope', isolateScope);
+ } else {
+ $element.data('$isolateScopeNoTemplate', isolateScope);
+ }
+
+
+
+ safeAddClass($element, 'ng-isolate-scope');
+
+ forEach(newIsolateScopeDirective.scope, function(definition, scopeName) {
+ var match = definition.match(LOCAL_REGEXP) || [],
+ attrName = match[3] || scopeName,
+ optional = (match[2] == '?'),
+ mode = match[1], // @, =, or &
+ lastValue,
+ parentGet, parentSet, compare;
+
+ isolateScope.$$isolateBindings[scopeName] = mode + attrName;
+
+ switch (mode) {
+
+ case '@':
+ attrs.$observe(attrName, function(value) {
+ isolateScope[scopeName] = value;
+ });
+ attrs.$$observers[attrName].$$scope = scope;
+ if( attrs[attrName] ) {
+ // If the attribute has been provided then we trigger an interpolation to ensure
+ // the value is there for use in the link fn
+ isolateScope[scopeName] = $interpolate(attrs[attrName])(scope);
+ }
+ break;
+
+ case '=':
+ if (optional && !attrs[attrName]) {
+ return;
+ }
+ parentGet = $parse(attrs[attrName]);
+ if (parentGet.literal) {
+ compare = equals;
+ } else {
+ compare = function(a,b) { return a === b || (a !== a && b !== b); };
+ }
+ parentSet = parentGet.assign || function() {
+ // reset the change, or we will throw this exception on every $digest
+ lastValue = isolateScope[scopeName] = parentGet(scope);
+ throw $compileMinErr('nonassign',
+ "Expression '{0}' used with directive '{1}' is non-assignable!",
+ attrs[attrName], newIsolateScopeDirective.name);
+ };
+ lastValue = isolateScope[scopeName] = parentGet(scope);
+ isolateScope.$watch(function parentValueWatch() {
+ var parentValue = parentGet(scope);
+ if (!compare(parentValue, isolateScope[scopeName])) {
+ // we are out of sync and need to copy
+ if (!compare(parentValue, lastValue)) {
+ // parent changed and it has precedence
+ isolateScope[scopeName] = parentValue;
+ } else {
+ // if the parent can be assigned then do so
+ parentSet(scope, parentValue = isolateScope[scopeName]);
+ }
+ }
+ return lastValue = parentValue;
+ }, null, parentGet.literal);
+ break;
+
+ case '&':
+ parentGet = $parse(attrs[attrName]);
+ isolateScope[scopeName] = function(locals) {
+ return parentGet(scope, locals);
+ };
+ break;
+
+ default:
+ throw $compileMinErr('iscp',
+ "Invalid isolate scope definition for directive '{0}'." +
+ " Definition: {... {1}: '{2}' ...}",
+ newIsolateScopeDirective.name, scopeName, definition);
+ }
+ });
+ }
+ transcludeFn = boundTranscludeFn && controllersBoundTransclude;
+ if (controllerDirectives) {
+ forEach(controllerDirectives, function(directive) {
+ var locals = {
+ $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,
+ $element: $element,
+ $attrs: attrs,
+ $transclude: transcludeFn
+ }, controllerInstance;
+
+ controller = directive.controller;
+ if (controller == '@') {
+ controller = attrs[directive.name];
+ }
+
+ controllerInstance = $controller(controller, locals);
+ // For directives with element transclusion the element is a comment,
+ // but jQuery .data doesn't support attaching data to comment nodes as it's hard to
+ // clean up (http://bugs.jquery.com/ticket/8335).
+ // Instead, we save the controllers for the element in a local hash and attach to .data
+ // later, once we have the actual element.
+ elementControllers[directive.name] = controllerInstance;
+ if (!hasElementTranscludeDirective) {
+ $element.data('$' + directive.name + 'Controller', controllerInstance);
+ }
+
+ if (directive.controllerAs) {
+ locals.$scope[directive.controllerAs] = controllerInstance;
+ }
+ });
+ }
+
+ // PRELINKING
+ for(i = 0, ii = preLinkFns.length; i < ii; i++) {
+ try {
+ linkFn = preLinkFns[i];
+ linkFn(linkFn.isolateScope ? isolateScope : scope, $element, attrs,
+ linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), transcludeFn);
+ } catch (e) {
+ $exceptionHandler(e, startingTag($element));
+ }
+ }
+
+ // RECURSION
+ // We only pass the isolate scope, if the isolate directive has a template,
+ // otherwise the child elements do not belong to the isolate directive.
+ var scopeToChild = scope;
+ if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {
+ scopeToChild = isolateScope;
+ }
+ childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);
+
+ // POSTLINKING
+ for(i = postLinkFns.length - 1; i >= 0; i--) {
+ try {
+ linkFn = postLinkFns[i];
+ linkFn(linkFn.isolateScope ? isolateScope : scope, $element, attrs,
+ linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), transcludeFn);
+ } catch (e) {
+ $exceptionHandler(e, startingTag($element));
+ }
+ }
+
+ // This is the function that is injected as `$transclude`.
+ function controllersBoundTransclude(scope, cloneAttachFn) {
+ var transcludeControllers;
+
+ // no scope passed
+ if (arguments.length < 2) {
+ cloneAttachFn = scope;
+ scope = undefined;
+ }
+
+ if (hasElementTranscludeDirective) {
+ transcludeControllers = elementControllers;
+ }
+
+ return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers);
+ }
+ }
+ }
+
+ function markDirectivesAsIsolate(directives) {
+ // mark all directives as needing isolate scope.
+ for (var j = 0, jj = directives.length; j < jj; j++) {
+ directives[j] = inherit(directives[j], {$$isolateScope: true});
+ }
+ }
+
+ /**
+ * looks up the directive and decorates it with exception handling and proper parameters. We
+ * call this the boundDirective.
+ *
+ * @param {string} name name of the directive to look up.
+ * @param {string} location The directive must be found in specific format.
+ * String containing any of theses characters:
+ *
+ * * `E`: element name
+ * * `A': attribute
+ * * `C`: class
+ * * `M`: comment
+ * @returns {boolean} true if directive was added.
+ */
+ function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,
+ endAttrName) {
+ if (name === ignoreDirective) return null;
+ var match = null;
+ if (hasDirectives.hasOwnProperty(name)) {
+ for(var directive, directives = $injector.get(name + Suffix),
+ i = 0, ii = directives.length; i<ii; i++) {
+ try {
+ directive = directives[i];
+ if ( (maxPriority === undefined || maxPriority > directive.priority) &&
+ directive.restrict.indexOf(location) != -1) {
+ if (startAttrName) {
+ directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});
+ }
+ tDirectives.push(directive);
+ match = directive;
+ }
+ } catch(e) { $exceptionHandler(e); }
+ }
+ }
+ return match;
+ }
+
+
+ /**
+ * When the element is replaced with HTML template then the new attributes
+ * on the template need to be merged with the existing attributes in the DOM.
+ * The desired effect is to have both of the attributes present.
+ *
+ * @param {object} dst destination attributes (original DOM)
+ * @param {object} src source attributes (from the directive template)
+ */
+ function mergeTemplateAttributes(dst, src) {
+ var srcAttr = src.$attr,
+ dstAttr = dst.$attr,
+ $element = dst.$$element;
+
+ // reapply the old attributes to the new element
+ forEach(dst, function(value, key) {
+ if (key.charAt(0) != '$') {
+ if (src[key] && src[key] !== value) {
+ value += (key === 'style' ? ';' : ' ') + src[key];
+ }
+ dst.$set(key, value, true, srcAttr[key]);
+ }
+ });
+
+ // copy the new attributes on the old attrs object
+ forEach(src, function(value, key) {
+ if (key == 'class') {
+ safeAddClass($element, value);
+ dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;
+ } else if (key == 'style') {
+ $element.attr('style', $element.attr('style') + ';' + value);
+ dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;
+ // `dst` will never contain hasOwnProperty as DOM parser won't let it.
+ // You will get an "InvalidCharacterError: DOM Exception 5" error if you
+ // have an attribute like "has-own-property" or "data-has-own-property", etc.
+ } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {
+ dst[key] = value;
+ dstAttr[key] = srcAttr[key];
+ }
+ });
+ }
+
+
+ function compileTemplateUrl(directives, $compileNode, tAttrs,
+ $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {
+ var linkQueue = [],
+ afterTemplateNodeLinkFn,
+ afterTemplateChildLinkFn,
+ beforeTemplateCompileNode = $compileNode[0],
+ origAsyncDirective = directives.shift(),
+ // The fact that we have to copy and patch the directive seems wrong!
+ derivedSyncDirective = extend({}, origAsyncDirective, {
+ templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective
+ }),
+ templateUrl = (isFunction(origAsyncDirective.templateUrl))
+ ? origAsyncDirective.templateUrl($compileNode, tAttrs)
+ : origAsyncDirective.templateUrl;
+
+ $compileNode.empty();
+
+ $http.get($sce.getTrustedResourceUrl(templateUrl), {cache: $templateCache}).
+ success(function(content) {
+ var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;
+
+ content = denormalizeTemplate(content);
+
+ if (origAsyncDirective.replace) {
+ if (jqLiteIsTextNode(content)) {
+ $template = [];
+ } else {
+ $template = jqLite(trim(content));
+ }
+ compileNode = $template[0];
+
+ if ($template.length != 1 || compileNode.nodeType !== 1) {
+ throw $compileMinErr('tplrt',
+ "Template for directive '{0}' must have exactly one root element. {1}",
+ origAsyncDirective.name, templateUrl);
+ }
+
+ tempTemplateAttrs = {$attr: {}};
+ replaceWith($rootElement, $compileNode, compileNode);
+ var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);
+
+ if (isObject(origAsyncDirective.scope)) {
+ markDirectivesAsIsolate(templateDirectives);
+ }
+ directives = templateDirectives.concat(directives);
+ mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
+ } else {
+ compileNode = beforeTemplateCompileNode;
+ $compileNode.html(content);
+ }
+
+ directives.unshift(derivedSyncDirective);
+
+ afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,
+ childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,
+ previousCompileContext);
+ forEach($rootElement, function(node, i) {
+ if (node == compileNode) {
+ $rootElement[i] = $compileNode[0];
+ }
+ });
+ afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);
+
+ while(linkQueue.length) {
+ var scope = linkQueue.shift(),
+ beforeTemplateLinkNode = linkQueue.shift(),
+ linkRootElement = linkQueue.shift(),
+ boundTranscludeFn = linkQueue.shift(),
+ linkNode = $compileNode[0];
+
+ if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {
+ var oldClasses = beforeTemplateLinkNode.className;
+
+ if (!(previousCompileContext.hasElementTranscludeDirective &&
+ origAsyncDirective.replace)) {
+ // it was cloned therefore we have to clone as well.
+ linkNode = jqLiteClone(compileNode);
+ }
+
+ replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);
+
+ // Copy in CSS classes from original node
+ safeAddClass(jqLite(linkNode), oldClasses);
+ }
+ if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);
+ } else {
+ childBoundTranscludeFn = boundTranscludeFn;
+ }
+ afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,
+ childBoundTranscludeFn);
+ }
+ linkQueue = null;
+ }).
+ error(function(response, code, headers, config) {
+ throw $compileMinErr('tpload', 'Failed to load template: {0}', config.url);
+ });
+
+ return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {
+ var childBoundTranscludeFn = boundTranscludeFn;
+ if (linkQueue) {
+ linkQueue.push(scope);
+ linkQueue.push(node);
+ linkQueue.push(rootElement);
+ linkQueue.push(childBoundTranscludeFn);
+ } else {
+ if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);
+ }
+ afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn);
+ }
+ };
+ }
+
+
+ /**
+ * Sorting function for bound directives.
+ */
+ function byPriority(a, b) {
+ var diff = b.priority - a.priority;
+ if (diff !== 0) return diff;
+ if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;
+ return a.index - b.index;
+ }
+
+
+ function assertNoDuplicate(what, previousDirective, directive, element) {
+ if (previousDirective) {
+ throw $compileMinErr('multidir', 'Multiple directives [{0}, {1}] asking for {2} on: {3}',
+ previousDirective.name, directive.name, what, startingTag(element));
+ }
+ }
+
+
+ function addTextInterpolateDirective(directives, text) {
+ var interpolateFn = $interpolate(text, true);
+ if (interpolateFn) {
+ directives.push({
+ priority: 0,
+ compile: function textInterpolateCompileFn(templateNode) {
+ // when transcluding a template that has bindings in the root
+ // then we don't have a parent and should do this in the linkFn
+ var parent = templateNode.parent(), hasCompileParent = parent.length;
+ if (hasCompileParent) safeAddClass(templateNode.parent(), 'ng-binding');
+
+ return function textInterpolateLinkFn(scope, node) {
+ var parent = node.parent(),
+ bindings = parent.data('$binding') || [];
+ bindings.push(interpolateFn);
+ parent.data('$binding', bindings);
+ if (!hasCompileParent) safeAddClass(parent, 'ng-binding');
+ scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {
+ node[0].nodeValue = value;
+ });
+ };
+ }
+ });
+ }
+ }
+
+
+ function getTrustedContext(node, attrNormalizedName) {
+ if (attrNormalizedName == "srcdoc") {
+ return $sce.HTML;
+ }
+ var tag = nodeName_(node);
+ // maction[xlink:href] can source SVG. It's not limited to <maction>.
+ if (attrNormalizedName == "xlinkHref" ||
+ (tag == "FORM" && attrNormalizedName == "action") ||
+ (tag != "IMG" && (attrNormalizedName == "src" ||
+ attrNormalizedName == "ngSrc"))) {
+ return $sce.RESOURCE_URL;
+ }
+ }
+
+
+ function addAttrInterpolateDirective(node, directives, value, name) {
+ var interpolateFn = $interpolate(value, true);
+
+ // no interpolation found -> ignore
+ if (!interpolateFn) return;
+
+
+ if (name === "multiple" && nodeName_(node) === "SELECT") {
+ throw $compileMinErr("selmulti",
+ "Binding to the 'multiple' attribute is not supported. Element: {0}",
+ startingTag(node));
+ }
+
+ directives.push({
+ priority: 100,
+ compile: function() {
+ return {
+ pre: function attrInterpolatePreLinkFn(scope, element, attr) {
+ var $$observers = (attr.$$observers || (attr.$$observers = {}));
+
+ if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {
+ throw $compileMinErr('nodomevents',
+ "Interpolations for HTML DOM event attributes are disallowed. Please use the " +
+ "ng- versions (such as ng-click instead of onclick) instead.");
+ }
+
+ // we need to interpolate again, in case the attribute value has been updated
+ // (e.g. by another directive's compile function)
+ interpolateFn = $interpolate(attr[name], true, getTrustedContext(node, name));
+
+ // if attribute was updated so that there is no interpolation going on we don't want to
+ // register any observers
+ if (!interpolateFn) return;
+
+ // TODO(i): this should likely be attr.$set(name, iterpolateFn(scope) so that we reset the
+ // actual attr value
+ attr[name] = interpolateFn(scope);
+ ($$observers[name] || ($$observers[name] = [])).$$inter = true;
+ (attr.$$observers && attr.$$observers[name].$$scope || scope).
+ $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {
+ //special case for class attribute addition + removal
+ //so that class changes can tap into the animation
+ //hooks provided by the $animate service. Be sure to
+ //skip animations when the first digest occurs (when
+ //both the new and the old values are the same) since
+ //the CSS classes are the non-interpolated values
+ if(name === 'class' && newValue != oldValue) {
+ attr.$updateClass(newValue, oldValue);
+ } else {
+ attr.$set(name, newValue);
+ }
+ });
+ }
+ };
+ }
+ });
+ }
+
+
+ /**
+ * This is a special jqLite.replaceWith, which can replace items which
+ * have no parents, provided that the containing jqLite collection is provided.
+ *
+ * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
+ * in the root of the tree.
+ * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep
+ * the shell, but replace its DOM node reference.
+ * @param {Node} newNode The new DOM node.
+ */
+ function replaceWith($rootElement, elementsToRemove, newNode) {
+ var firstElementToRemove = elementsToRemove[0],
+ removeCount = elementsToRemove.length,
+ parent = firstElementToRemove.parentNode,
+ i, ii;
+
+ if ($rootElement) {
+ for(i = 0, ii = $rootElement.length; i < ii; i++) {
+ if ($rootElement[i] == firstElementToRemove) {
+ $rootElement[i++] = newNode;
+ for (var j = i, j2 = j + removeCount - 1,
+ jj = $rootElement.length;
+ j < jj; j++, j2++) {
+ if (j2 < jj) {
+ $rootElement[j] = $rootElement[j2];
+ } else {
+ delete $rootElement[j];
+ }
+ }
+ $rootElement.length -= removeCount - 1;
+ break;
+ }
+ }
+ }
+
+ if (parent) {
+ parent.replaceChild(newNode, firstElementToRemove);
+ }
+ var fragment = document.createDocumentFragment();
+ fragment.appendChild(firstElementToRemove);
+ newNode[jqLite.expando] = firstElementToRemove[jqLite.expando];
+ for (var k = 1, kk = elementsToRemove.length; k < kk; k++) {
+ var element = elementsToRemove[k];
+ jqLite(element).remove(); // must do this way to clean up expando
+ fragment.appendChild(element);
+ delete elementsToRemove[k];
+ }
+
+ elementsToRemove[0] = newNode;
+ elementsToRemove.length = 1;
+ }
+
+
+ function cloneAndAnnotateFn(fn, annotation) {
+ return extend(function() { return fn.apply(null, arguments); }, fn, annotation);
+ }
+ }];
+}
+
+var PREFIX_REGEXP = /^(x[\:\-_]|data[\:\-_])/i;
+/**
+ * Converts all accepted directives format into proper directive name.
+ * All of these will become 'myDirective':
+ * my:Directive
+ * my-directive
+ * x-my-directive
+ * data-my:directive
+ *
+ * Also there is special case for Moz prefix starting with upper case letter.
+ * @param name Name to normalize
+ */
+function directiveNormalize(name) {
+ return camelCase(name.replace(PREFIX_REGEXP, ''));
+}
+
+/**
+ * @ngdoc type
+ * @name $compile.directive.Attributes
+ *
+ * @description
+ * A shared object between directive compile / linking functions which contains normalized DOM
+ * element attributes. The values reflect current binding state `{{ }}`. The normalization is
+ * needed since all of these are treated as equivalent in Angular:
+ *
+ * ```
+ * <span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a">
+ * ```
+ */
+
+/**
+ * @ngdoc property
+ * @name $compile.directive.Attributes#$attr
+ *
+ * @description
+ * A map of DOM element attribute names to the normalized name. This is
+ * needed to do reverse lookup from normalized name back to actual name.
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$set
+ * @kind function
+ *
+ * @description
+ * Set DOM element attribute value.
+ *
+ *
+ * @param {string} name Normalized element attribute name of the property to modify. The name is
+ * reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}
+ * property to the original name.
+ * @param {string} value Value to set the attribute to. The value can be an interpolated string.
+ */
+
+
+
+/**
+ * Closure compiler type information
+ */
+
+function nodesetLinkingFn(
+ /* angular.Scope */ scope,
+ /* NodeList */ nodeList,
+ /* Element */ rootElement,
+ /* function(Function) */ boundTranscludeFn
+){}
+
+function directiveLinkingFn(
+ /* nodesetLinkingFn */ nodesetLinkingFn,
+ /* angular.Scope */ scope,
+ /* Node */ node,
+ /* Element */ rootElement,
+ /* function(Function) */ boundTranscludeFn
+){}
+
+function tokenDifference(str1, str2) {
+ var values = '',
+ tokens1 = str1.split(/\s+/),
+ tokens2 = str2.split(/\s+/);
+
+ outer:
+ for(var i = 0; i < tokens1.length; i++) {
+ var token = tokens1[i];
+ for(var j = 0; j < tokens2.length; j++) {
+ if(token == tokens2[j]) continue outer;
+ }
+ values += (values.length > 0 ? ' ' : '') + token;
+ }
+ return values;
+}
+
+/**
+ * @ngdoc provider
+ * @name $controllerProvider
+ * @description
+ * The {@link ng.$controller $controller service} is used by Angular to create new
+ * controllers.
+ *
+ * This provider allows controller registration via the
+ * {@link ng.$controllerProvider#register register} method.
+ */
+function $ControllerProvider() {
+ var controllers = {},
+ CNTRL_REG = /^(\S+)(\s+as\s+(\w+))?$/;
+
+
+ /**
+ * @ngdoc method
+ * @name $controllerProvider#register
+ * @param {string|Object} name Controller name, or an object map of controllers where the keys are
+ * the names and the values are the constructors.
+ * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI
+ * annotations in the array notation).
+ */
+ this.register = function(name, constructor) {
+ assertNotHasOwnProperty(name, 'controller');
+ if (isObject(name)) {
+ extend(controllers, name);
+ } else {
+ controllers[name] = constructor;
+ }
+ };
+
+
+ this.$get = ['$injector', '$window', function($injector, $window) {
+
+ /**
+ * @ngdoc service
+ * @name $controller
+ * @requires $injector
+ *
+ * @param {Function|string} constructor If called with a function then it's considered to be the
+ * controller constructor function. Otherwise it's considered to be a string which is used
+ * to retrieve the controller constructor using the following steps:
+ *
+ * * check if a controller with given name is registered via `$controllerProvider`
+ * * check if evaluating the string on the current scope returns a constructor
+ * * check `window[constructor]` on the global `window` object
+ *
+ * @param {Object} locals Injection locals for Controller.
+ * @return {Object} Instance of given controller.
+ *
+ * @description
+ * `$controller` service is responsible for instantiating controllers.
+ *
+ * It's just a simple call to {@link auto.$injector $injector}, but extracted into
+ * a service, so that one can override this service with [BC version](https://gist.github.com/1649788).
+ */
+ return function(expression, locals) {
+ var instance, match, constructor, identifier;
+
+ if(isString(expression)) {
+ match = expression.match(CNTRL_REG),
+ constructor = match[1],
+ identifier = match[3];
+ expression = controllers.hasOwnProperty(constructor)
+ ? controllers[constructor]
+ : getter(locals.$scope, constructor, true) || getter($window, constructor, true);
+
+ assertArgFn(expression, constructor, true);
+ }
+
+ instance = $injector.instantiate(expression, locals);
+
+ if (identifier) {
+ if (!(locals && typeof locals.$scope === 'object')) {
+ throw minErr('$controller')('noscp',
+ "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",
+ constructor || expression.name, identifier);
+ }
+
+ locals.$scope[identifier] = instance;
+ }
+
+ return instance;
+ };
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $document
+ * @requires $window
+ *
+ * @description
+ * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.
+ *
+ * @example
+ <example module="documentExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <p>$document title: <b ng-bind="title"></b></p>
+ <p>window.document title: <b ng-bind="windowTitle"></b></p>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('documentExample', [])
+ .controller('ExampleController', ['$scope', '$document', function($scope, $document) {
+ $scope.title = $document[0].title;
+ $scope.windowTitle = angular.element(window.document)[0].title;
+ }]);
+ </file>
+ </example>
+ */
+function $DocumentProvider(){
+ this.$get = ['$window', function(window){
+ return jqLite(window.document);
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $exceptionHandler
+ * @requires ng.$log
+ *
+ * @description
+ * Any uncaught exception in angular expressions is delegated to this service.
+ * The default implementation simply delegates to `$log.error` which logs it into
+ * the browser console.
+ *
+ * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by
+ * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.
+ *
+ * ## Example:
+ *
+ * ```js
+ * angular.module('exceptionOverride', []).factory('$exceptionHandler', function () {
+ * return function (exception, cause) {
+ * exception.message += ' (caused by "' + cause + '")';
+ * throw exception;
+ * };
+ * });
+ * ```
+ *
+ * This example will override the normal action of `$exceptionHandler`, to make angular
+ * exceptions fail hard when they happen, instead of just logging to the console.
+ *
+ * @param {Error} exception Exception associated with the error.
+ * @param {string=} cause optional information about the context in which
+ * the error was thrown.
+ *
+ */
+function $ExceptionHandlerProvider() {
+ this.$get = ['$log', function($log) {
+ return function(exception, cause) {
+ $log.error.apply($log, arguments);
+ };
+ }];
+}
+
+/**
+ * Parse headers into key value object
+ *
+ * @param {string} headers Raw headers as a string
+ * @returns {Object} Parsed headers as key value object
+ */
+function parseHeaders(headers) {
+ var parsed = {}, key, val, i;
+
+ if (!headers) return parsed;
+
+ forEach(headers.split('\n'), function(line) {
+ i = line.indexOf(':');
+ key = lowercase(trim(line.substr(0, i)));
+ val = trim(line.substr(i + 1));
+
+ if (key) {
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
+ }
+ });
+
+ return parsed;
+}
+
+
+/**
+ * Returns a function that provides access to parsed headers.
+ *
+ * Headers are lazy parsed when first requested.
+ * @see parseHeaders
+ *
+ * @param {(string|Object)} headers Headers to provide access to.
+ * @returns {function(string=)} Returns a getter function which if called with:
+ *
+ * - if called with single an argument returns a single header value or null
+ * - if called with no arguments returns an object containing all headers.
+ */
+function headersGetter(headers) {
+ var headersObj = isObject(headers) ? headers : undefined;
+
+ return function(name) {
+ if (!headersObj) headersObj = parseHeaders(headers);
+
+ if (name) {
+ return headersObj[lowercase(name)] || null;
+ }
+
+ return headersObj;
+ };
+}
+
+
+/**
+ * Chain all given functions
+ *
+ * This function is used for both request and response transforming
+ *
+ * @param {*} data Data to transform.
+ * @param {function(string=)} headers Http headers getter fn.
+ * @param {(Function|Array.<Function>)} fns Function or an array of functions.
+ * @returns {*} Transformed data.
+ */
+function transformData(data, headers, fns) {
+ if (isFunction(fns))
+ return fns(data, headers);
+
+ forEach(fns, function(fn) {
+ data = fn(data, headers);
+ });
+
+ return data;
+}
+
+
+function isSuccess(status) {
+ return 200 <= status && status < 300;
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $httpProvider
+ * @description
+ * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
+ * */
+function $HttpProvider() {
+ var JSON_START = /^\s*(\[|\{[^\{])/,
+ JSON_END = /[\}\]]\s*$/,
+ PROTECTION_PREFIX = /^\)\]\}',?\n/,
+ CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': 'application/json;charset=utf-8'};
+
+ /**
+ * @ngdoc property
+ * @name $httpProvider#defaults
+ * @description
+ *
+ * Object containing default values for all {@link ng.$http $http} requests.
+ *
+ * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
+ * Defaults value is `'XSRF-TOKEN'`.
+ *
+ * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
+ * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
+ *
+ * - **`defaults.headers`** - {Object} - Default headers for all $http requests.
+ * Refer to {@link ng.$http#setting-http-headers $http} for documentation on
+ * setting default headers.
+ * - **`defaults.headers.common`**
+ * - **`defaults.headers.post`**
+ * - **`defaults.headers.put`**
+ * - **`defaults.headers.patch`**
+ **/
+ var defaults = this.defaults = {
+ // transform incoming response data
+ transformResponse: [function(data) {
+ if (isString(data)) {
+ // strip json vulnerability protection prefix
+ data = data.replace(PROTECTION_PREFIX, '');
+ if (JSON_START.test(data) && JSON_END.test(data))
+ data = fromJson(data);
+ }
+ return data;
+ }],
+
+ // transform outgoing request data
+ transformRequest: [function(d) {
+ return isObject(d) && !isFile(d) && !isBlob(d) ? toJson(d) : d;
+ }],
+
+ // default headers
+ headers: {
+ common: {
+ 'Accept': 'application/json, text/plain, */*'
+ },
+ post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
+ put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
+ patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON)
+ },
+
+ xsrfCookieName: 'XSRF-TOKEN',
+ xsrfHeaderName: 'X-XSRF-TOKEN'
+ };
+
+ /**
+ * Are ordered by request, i.e. they are applied in the same order as the
+ * array, on request, but reverse order, on response.
+ */
+ var interceptorFactories = this.interceptors = [];
+
+ /**
+ * For historical reasons, response interceptors are ordered by the order in which
+ * they are applied to the response. (This is the opposite of interceptorFactories)
+ */
+ var responseInterceptorFactories = this.responseInterceptors = [];
+
+ this.$get = ['$httpBackend', '$browser', '$cacheFactory', '$rootScope', '$q', '$injector',
+ function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector) {
+
+ var defaultCache = $cacheFactory('$http');
+
+ /**
+ * Interceptors stored in reverse order. Inner interceptors before outer interceptors.
+ * The reversal is needed so that we can build up the interception chain around the
+ * server request.
+ */
+ var reversedInterceptors = [];
+
+ forEach(interceptorFactories, function(interceptorFactory) {
+ reversedInterceptors.unshift(isString(interceptorFactory)
+ ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));
+ });
+
+ forEach(responseInterceptorFactories, function(interceptorFactory, index) {
+ var responseFn = isString(interceptorFactory)
+ ? $injector.get(interceptorFactory)
+ : $injector.invoke(interceptorFactory);
+
+ /**
+ * Response interceptors go before "around" interceptors (no real reason, just
+ * had to pick one.) But they are already reversed, so we can't use unshift, hence
+ * the splice.
+ */
+ reversedInterceptors.splice(index, 0, {
+ response: function(response) {
+ return responseFn($q.when(response));
+ },
+ responseError: function(response) {
+ return responseFn($q.reject(response));
+ }
+ });
+ });
+
+
+ /**
+ * @ngdoc service
+ * @kind function
+ * @name $http
+ * @requires ng.$httpBackend
+ * @requires $cacheFactory
+ * @requires $rootScope
+ * @requires $q
+ * @requires $injector
+ *
+ * @description
+ * The `$http` service is a core Angular service that facilitates communication with the remote
+ * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest)
+ * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP).
+ *
+ * For unit testing applications that use `$http` service, see
+ * {@link ngMock.$httpBackend $httpBackend mock}.
+ *
+ * For a higher level of abstraction, please check out the {@link ngResource.$resource
+ * $resource} service.
+ *
+ * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by
+ * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage
+ * it is important to familiarize yourself with these APIs and the guarantees they provide.
+ *
+ *
+ * # General usage
+ * The `$http` service is a function which takes a single argument — a configuration object —
+ * that is used to generate an HTTP request and returns a {@link ng.$q promise}
+ * with two $http specific methods: `success` and `error`.
+ *
+ * ```js
+ * $http({method: 'GET', url: '/someUrl'}).
+ * success(function(data, status, headers, config) {
+ * // this callback will be called asynchronously
+ * // when the response is available
+ * }).
+ * error(function(data, status, headers, config) {
+ * // called asynchronously if an error occurs
+ * // or server returns response with an error status.
+ * });
+ * ```
+ *
+ * Since the returned value of calling the $http function is a `promise`, you can also use
+ * the `then` method to register callbacks, and these callbacks will receive a single argument –
+ * an object representing the response. See the API signature and type info below for more
+ * details.
+ *
+ * A response status code between 200 and 299 is considered a success status and
+ * will result in the success callback being called. Note that if the response is a redirect,
+ * XMLHttpRequest will transparently follow it, meaning that the error callback will not be
+ * called for such responses.
+ *
+ * # Writing Unit Tests that use $http
+ * When unit testing (using {@link ngMock ngMock}), it is necessary to call
+ * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending
+ * request using trained responses.
+ *
+ * ```
+ * $httpBackend.expectGET(...);
+ * $http.get(...);
+ * $httpBackend.flush();
+ * ```
+ *
+ * # Shortcut methods
+ *
+ * Shortcut methods are also available. All shortcut methods require passing in the URL, and
+ * request data must be passed in for POST/PUT requests.
+ *
+ * ```js
+ * $http.get('/someUrl').success(successCallback);
+ * $http.post('/someUrl', data).success(successCallback);
+ * ```
+ *
+ * Complete list of shortcut methods:
+ *
+ * - {@link ng.$http#get $http.get}
+ * - {@link ng.$http#head $http.head}
+ * - {@link ng.$http#post $http.post}
+ * - {@link ng.$http#put $http.put}
+ * - {@link ng.$http#delete $http.delete}
+ * - {@link ng.$http#jsonp $http.jsonp}
+ * - {@link ng.$http#patch $http.patch}
+ *
+ *
+ * # Setting HTTP Headers
+ *
+ * The $http service will automatically add certain HTTP headers to all requests. These defaults
+ * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration
+ * object, which currently contains this default configuration:
+ *
+ * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):
+ * - `Accept: application/json, text/plain, * / *`
+ * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)
+ * - `Content-Type: application/json`
+ * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)
+ * - `Content-Type: application/json`
+ *
+ * To add or overwrite these defaults, simply add or remove a property from these configuration
+ * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object
+ * with the lowercased HTTP method name as the key, e.g.
+ * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }.
+ *
+ * The defaults can also be set at runtime via the `$http.defaults` object in the same
+ * fashion. For example:
+ *
+ * ```
+ * module.run(function($http) {
+ * $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w'
+ * });
+ * ```
+ *
+ * In addition, you can supply a `headers` property in the config object passed when
+ * calling `$http(config)`, which overrides the defaults without changing them globally.
+ *
+ *
+ * # Transforming Requests and Responses
+ *
+ * Both requests and responses can be transformed using transform functions. By default, Angular
+ * applies these transformations:
+ *
+ * Request transformations:
+ *
+ * - If the `data` property of the request configuration object contains an object, serialize it
+ * into JSON format.
+ *
+ * Response transformations:
+ *
+ * - If XSRF prefix is detected, strip it (see Security Considerations section below).
+ * - If JSON response is detected, deserialize it using a JSON parser.
+ *
+ * To globally augment or override the default transforms, modify the
+ * `$httpProvider.defaults.transformRequest` and `$httpProvider.defaults.transformResponse`
+ * properties. These properties are by default an array of transform functions, which allows you
+ * to `push` or `unshift` a new transformation function into the transformation chain. You can
+ * also decide to completely override any default transformations by assigning your
+ * transformation functions to these properties directly without the array wrapper. These defaults
+ * are again available on the $http factory at run-time, which may be useful if you have run-time
+ * services you wish to be involved in your transformations.
+ *
+ * Similarly, to locally override the request/response transforms, augment the
+ * `transformRequest` and/or `transformResponse` properties of the configuration object passed
+ * into `$http`.
+ *
+ *
+ * # Caching
+ *
+ * To enable caching, set the request configuration `cache` property to `true` (to use default
+ * cache) or to a custom cache object (built with {@link ng.$cacheFactory `$cacheFactory`}).
+ * When the cache is enabled, `$http` stores the response from the server in the specified
+ * cache. The next time the same request is made, the response is served from the cache without
+ * sending a request to the server.
+ *
+ * Note that even if the response is served from cache, delivery of the data is asynchronous in
+ * the same way that real requests are.
+ *
+ * If there are multiple GET requests for the same URL that should be cached using the same
+ * cache, but the cache is not populated yet, only one request to the server will be made and
+ * the remaining requests will be fulfilled using the response from the first request.
+ *
+ * You can change the default cache to a new object (built with
+ * {@link ng.$cacheFactory `$cacheFactory`}) by updating the
+ * {@link ng.$http#properties_defaults `$http.defaults.cache`} property. All requests who set
+ * their `cache` property to `true` will now use this cache object.
+ *
+ * If you set the default cache to `false` then only requests that specify their own custom
+ * cache object will be cached.
+ *
+ * # Interceptors
+ *
+ * Before you start creating interceptors, be sure to understand the
+ * {@link ng.$q $q and deferred/promise APIs}.
+ *
+ * For purposes of global error handling, authentication, or any kind of synchronous or
+ * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be
+ * able to intercept requests before they are handed to the server and
+ * responses before they are handed over to the application code that
+ * initiated these requests. The interceptors leverage the {@link ng.$q
+ * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing.
+ *
+ * The interceptors are service factories that are registered with the `$httpProvider` by
+ * adding them to the `$httpProvider.interceptors` array. The factory is called and
+ * injected with dependencies (if specified) and returns the interceptor.
+ *
+ * There are two kinds of interceptors (and two kinds of rejection interceptors):
+ *
+ * * `request`: interceptors get called with a http `config` object. The function is free to
+ * modify the `config` object or create a new one. The function needs to return the `config`
+ * object directly, or a promise containing the `config` or a new `config` object.
+ * * `requestError`: interceptor gets called when a previous interceptor threw an error or
+ * resolved with a rejection.
+ * * `response`: interceptors get called with http `response` object. The function is free to
+ * modify the `response` object or create a new one. The function needs to return the `response`
+ * object directly, or as a promise containing the `response` or a new `response` object.
+ * * `responseError`: interceptor gets called when a previous interceptor threw an error or
+ * resolved with a rejection.
+ *
+ *
+ * ```js
+ * // register the interceptor as a service
+ * $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
+ * return {
+ * // optional method
+ * 'request': function(config) {
+ * // do something on success
+ * return config;
+ * },
+ *
+ * // optional method
+ * 'requestError': function(rejection) {
+ * // do something on error
+ * if (canRecover(rejection)) {
+ * return responseOrNewPromise
+ * }
+ * return $q.reject(rejection);
+ * },
+ *
+ *
+ *
+ * // optional method
+ * 'response': function(response) {
+ * // do something on success
+ * return response;
+ * },
+ *
+ * // optional method
+ * 'responseError': function(rejection) {
+ * // do something on error
+ * if (canRecover(rejection)) {
+ * return responseOrNewPromise
+ * }
+ * return $q.reject(rejection);
+ * }
+ * };
+ * });
+ *
+ * $httpProvider.interceptors.push('myHttpInterceptor');
+ *
+ *
+ * // alternatively, register the interceptor via an anonymous factory
+ * $httpProvider.interceptors.push(function($q, dependency1, dependency2) {
+ * return {
+ * 'request': function(config) {
+ * // same as above
+ * },
+ *
+ * 'response': function(response) {
+ * // same as above
+ * }
+ * };
+ * });
+ * ```
+ *
+ * # Response interceptors (DEPRECATED)
+ *
+ * Before you start creating interceptors, be sure to understand the
+ * {@link ng.$q $q and deferred/promise APIs}.
+ *
+ * For purposes of global error handling, authentication or any kind of synchronous or
+ * asynchronous preprocessing of received responses, it is desirable to be able to intercept
+ * responses for http requests before they are handed over to the application code that
+ * initiated these requests. The response interceptors leverage the {@link ng.$q
+ * promise apis} to fulfil this need for both synchronous and asynchronous preprocessing.
+ *
+ * The interceptors are service factories that are registered with the $httpProvider by
+ * adding them to the `$httpProvider.responseInterceptors` array. The factory is called and
+ * injected with dependencies (if specified) and returns the interceptor — a function that
+ * takes a {@link ng.$q promise} and returns the original or a new promise.
+ *
+ * ```js
+ * // register the interceptor as a service
+ * $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
+ * return function(promise) {
+ * return promise.then(function(response) {
+ * // do something on success
+ * return response;
+ * }, function(response) {
+ * // do something on error
+ * if (canRecover(response)) {
+ * return responseOrNewPromise
+ * }
+ * return $q.reject(response);
+ * });
+ * }
+ * });
+ *
+ * $httpProvider.responseInterceptors.push('myHttpInterceptor');
+ *
+ *
+ * // register the interceptor via an anonymous factory
+ * $httpProvider.responseInterceptors.push(function($q, dependency1, dependency2) {
+ * return function(promise) {
+ * // same as above
+ * }
+ * });
+ * ```
+ *
+ *
+ * # Security Considerations
+ *
+ * When designing web applications, consider security threats from:
+ *
+ * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)
+ * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
+ *
+ * Both server and the client must cooperate in order to eliminate these threats. Angular comes
+ * pre-configured with strategies that address these issues, but for this to work backend server
+ * cooperation is required.
+ *
+ * ## JSON Vulnerability Protection
+ *
+ * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)
+ * allows third party website to turn your JSON resource URL into
+ * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To
+ * counter this your server can prefix all JSON requests with following string `")]}',\n"`.
+ * Angular will automatically strip the prefix before processing it as JSON.
+ *
+ * For example if your server needs to return:
+ * ```js
+ * ['one','two']
+ * ```
+ *
+ * which is vulnerable to attack, your server can return:
+ * ```js
+ * )]}',
+ * ['one','two']
+ * ```
+ *
+ * Angular will strip the prefix, before processing the JSON.
+ *
+ *
+ * ## Cross Site Request Forgery (XSRF) Protection
+ *
+ * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is a technique by which
+ * an unauthorized site can gain your user's private data. Angular provides a mechanism
+ * to counter XSRF. When performing XHR requests, the $http service reads a token from a cookie
+ * (by default, `XSRF-TOKEN`) and sets it as an HTTP header (`X-XSRF-TOKEN`). Since only
+ * JavaScript that runs on your domain could read the cookie, your server can be assured that
+ * the XHR came from JavaScript running on your domain. The header will not be set for
+ * cross-domain requests.
+ *
+ * To take advantage of this, your server needs to set a token in a JavaScript readable session
+ * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the
+ * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure
+ * that only JavaScript running on your domain could have sent the request. The token must be
+ * unique for each user and must be verifiable by the server (to prevent the JavaScript from
+ * making up its own tokens). We recommend that the token is a digest of your site's
+ * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography&#41;)
+ * for added security.
+ *
+ * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName
+ * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,
+ * or the per-request config object.
+ *
+ *
+ * @param {object} config Object describing the request to be made and how it should be
+ * processed. The object has following properties:
+ *
+ * - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)
+ * - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.
+ * - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be turned
+ * to `?key1=value1&key2=value2` after the url. If the value is not a string, it will be
+ * JSONified.
+ * - **data** – `{string|Object}` – Data to be sent as the request message data.
+ * - **headers** – `{Object}` – Map of strings or functions which return strings representing
+ * HTTP headers to send to the server. If the return value of a function is null, the
+ * header will not be sent.
+ * - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token.
+ * - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token.
+ * - **transformRequest** –
+ * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
+ * transform function or an array of such functions. The transform function takes the http
+ * request body and headers and returns its transformed (typically serialized) version.
+ * - **transformResponse** –
+ * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
+ * transform function or an array of such functions. The transform function takes the http
+ * response body and headers and returns its transformed (typically deserialized) version.
+ * - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
+ * GET request, otherwise if a cache instance built with
+ * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
+ * caching.
+ * - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}
+ * that should abort the request when resolved.
+ * - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the
+ * XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials)
+ * for more information.
+ * - **responseType** - `{string}` - see
+ * [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).
+ *
+ * @returns {HttpPromise} Returns a {@link ng.$q promise} object with the
+ * standard `then` method and two http specific methods: `success` and `error`. The `then`
+ * method takes two arguments a success and an error callback which will be called with a
+ * response object. The `success` and `error` methods take a single argument - a function that
+ * will be called when the request succeeds or fails respectively. The arguments passed into
+ * these functions are destructured representation of the response object passed into the
+ * `then` method. The response object has these properties:
+ *
+ * - **data** – `{string|Object}` – The response body transformed with the transform
+ * functions.
+ * - **status** – `{number}` – HTTP status code of the response.
+ * - **headers** – `{function([headerName])}` – Header getter function.
+ * - **config** – `{Object}` – The configuration object that was used to generate the request.
+ * - **statusText** – `{string}` – HTTP status text of the response.
+ *
+ * @property {Array.<Object>} pendingRequests Array of config objects for currently pending
+ * requests. This is primarily meant to be used for debugging purposes.
+ *
+ *
+ * @example
+<example module="httpExample">
+<file name="index.html">
+ <div ng-controller="FetchController">
+ <select ng-model="method">
+ <option>GET</option>
+ <option>JSONP</option>
+ </select>
+ <input type="text" ng-model="url" size="80"/>
+ <button id="fetchbtn" ng-click="fetch()">fetch</button><br>
+ <button id="samplegetbtn" ng-click="updateModel('GET', 'http-hello.html')">Sample GET</button>
+ <button id="samplejsonpbtn"
+ ng-click="updateModel('JSONP',
+ 'https://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">
+ Sample JSONP
+ </button>
+ <button id="invalidjsonpbtn"
+ ng-click="updateModel('JSONP', 'https://angularjs.org/doesntexist&callback=JSON_CALLBACK')">
+ Invalid JSONP
+ </button>
+ <pre>http status code: {{status}}</pre>
+ <pre>http response data: {{data}}</pre>
+ </div>
+</file>
+<file name="script.js">
+ angular.module('httpExample', [])
+ .controller('FetchController', ['$scope', '$http', '$templateCache',
+ function($scope, $http, $templateCache) {
+ $scope.method = 'GET';
+ $scope.url = 'http-hello.html';
+
+ $scope.fetch = function() {
+ $scope.code = null;
+ $scope.response = null;
+
+ $http({method: $scope.method, url: $scope.url, cache: $templateCache}).
+ success(function(data, status) {
+ $scope.status = status;
+ $scope.data = data;
+ }).
+ error(function(data, status) {
+ $scope.data = data || "Request failed";
+ $scope.status = status;
+ });
+ };
+
+ $scope.updateModel = function(method, url) {
+ $scope.method = method;
+ $scope.url = url;
+ };
+ }]);
+</file>
+<file name="http-hello.html">
+ Hello, $http!
+</file>
+<file name="protractor.js" type="protractor">
+ var status = element(by.binding('status'));
+ var data = element(by.binding('data'));
+ var fetchBtn = element(by.id('fetchbtn'));
+ var sampleGetBtn = element(by.id('samplegetbtn'));
+ var sampleJsonpBtn = element(by.id('samplejsonpbtn'));
+ var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));
+
+ it('should make an xhr GET request', function() {
+ sampleGetBtn.click();
+ fetchBtn.click();
+ expect(status.getText()).toMatch('200');
+ expect(data.getText()).toMatch(/Hello, \$http!/);
+ });
+
+ it('should make a JSONP request to angularjs.org', function() {
+ sampleJsonpBtn.click();
+ fetchBtn.click();
+ expect(status.getText()).toMatch('200');
+ expect(data.getText()).toMatch(/Super Hero!/);
+ });
+
+ it('should make JSONP request to invalid URL and invoke the error handler',
+ function() {
+ invalidJsonpBtn.click();
+ fetchBtn.click();
+ expect(status.getText()).toMatch('0');
+ expect(data.getText()).toMatch('Request failed');
+ });
+</file>
+</example>
+ */
+ function $http(requestConfig) {
+ var config = {
+ method: 'get',
+ transformRequest: defaults.transformRequest,
+ transformResponse: defaults.transformResponse
+ };
+ var headers = mergeHeaders(requestConfig);
+
+ extend(config, requestConfig);
+ config.headers = headers;
+ config.method = uppercase(config.method);
+
+ var serverRequest = function(config) {
+ headers = config.headers;
+ var reqData = transformData(config.data, headersGetter(headers), config.transformRequest);
+
+ // strip content-type if data is undefined
+ if (isUndefined(reqData)) {
+ forEach(headers, function(value, header) {
+ if (lowercase(header) === 'content-type') {
+ delete headers[header];
+ }
+ });
+ }
+
+ if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {
+ config.withCredentials = defaults.withCredentials;
+ }
+
+ // send request
+ return sendReq(config, reqData, headers).then(transformResponse, transformResponse);
+ };
+
+ var chain = [serverRequest, undefined];
+ var promise = $q.when(config);
+
+ // apply interceptors
+ forEach(reversedInterceptors, function(interceptor) {
+ if (interceptor.request || interceptor.requestError) {
+ chain.unshift(interceptor.request, interceptor.requestError);
+ }
+ if (interceptor.response || interceptor.responseError) {
+ chain.push(interceptor.response, interceptor.responseError);
+ }
+ });
+
+ while(chain.length) {
+ var thenFn = chain.shift();
+ var rejectFn = chain.shift();
+
+ promise = promise.then(thenFn, rejectFn);
+ }
+
+ promise.success = function(fn) {
+ promise.then(function(response) {
+ fn(response.data, response.status, response.headers, config);
+ });
+ return promise;
+ };
+
+ promise.error = function(fn) {
+ promise.then(null, function(response) {
+ fn(response.data, response.status, response.headers, config);
+ });
+ return promise;
+ };
+
+ return promise;
+
+ function transformResponse(response) {
+ // make a copy since the response must be cacheable
+ var resp = extend({}, response, {
+ data: transformData(response.data, response.headers, config.transformResponse)
+ });
+ return (isSuccess(response.status))
+ ? resp
+ : $q.reject(resp);
+ }
+
+ function mergeHeaders(config) {
+ var defHeaders = defaults.headers,
+ reqHeaders = extend({}, config.headers),
+ defHeaderName, lowercaseDefHeaderName, reqHeaderName;
+
+ defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);
+
+ // using for-in instead of forEach to avoid unecessary iteration after header has been found
+ defaultHeadersIteration:
+ for (defHeaderName in defHeaders) {
+ lowercaseDefHeaderName = lowercase(defHeaderName);
+
+ for (reqHeaderName in reqHeaders) {
+ if (lowercase(reqHeaderName) === lowercaseDefHeaderName) {
+ continue defaultHeadersIteration;
+ }
+ }
+
+ reqHeaders[defHeaderName] = defHeaders[defHeaderName];
+ }
+
+ // execute if header value is a function for merged headers
+ execHeaders(reqHeaders);
+ return reqHeaders;
+
+ function execHeaders(headers) {
+ var headerContent;
+
+ forEach(headers, function(headerFn, header) {
+ if (isFunction(headerFn)) {
+ headerContent = headerFn();
+ if (headerContent != null) {
+ headers[header] = headerContent;
+ } else {
+ delete headers[header];
+ }
+ }
+ });
+ }
+ }
+ }
+
+ $http.pendingRequests = [];
+
+ /**
+ * @ngdoc method
+ * @name $http#get
+ *
+ * @description
+ * Shortcut method to perform `GET` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#delete
+ *
+ * @description
+ * Shortcut method to perform `DELETE` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#head
+ *
+ * @description
+ * Shortcut method to perform `HEAD` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#jsonp
+ *
+ * @description
+ * Shortcut method to perform `JSONP` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request.
+ * The name of the callback should be the string `JSON_CALLBACK`.
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+ createShortMethods('get', 'delete', 'head', 'jsonp');
+
+ /**
+ * @ngdoc method
+ * @name $http#post
+ *
+ * @description
+ * Shortcut method to perform `POST` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {*} data Request content
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#put
+ *
+ * @description
+ * Shortcut method to perform `PUT` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {*} data Request content
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+ createShortMethodsWithData('post', 'put');
+
+ /**
+ * @ngdoc property
+ * @name $http#defaults
+ *
+ * @description
+ * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of
+ * default headers, withCredentials as well as request and response transformations.
+ *
+ * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above.
+ */
+ $http.defaults = defaults;
+
+
+ return $http;
+
+
+ function createShortMethods(names) {
+ forEach(arguments, function(name) {
+ $http[name] = function(url, config) {
+ return $http(extend(config || {}, {
+ method: name,
+ url: url
+ }));
+ };
+ });
+ }
+
+
+ function createShortMethodsWithData(name) {
+ forEach(arguments, function(name) {
+ $http[name] = function(url, data, config) {
+ return $http(extend(config || {}, {
+ method: name,
+ url: url,
+ data: data
+ }));
+ };
+ });
+ }
+
+
+ /**
+ * Makes the request.
+ *
+ * !!! ACCESSES CLOSURE VARS:
+ * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests
+ */
+ function sendReq(config, reqData, reqHeaders) {
+ var deferred = $q.defer(),
+ promise = deferred.promise,
+ cache,
+ cachedResp,
+ url = buildUrl(config.url, config.params);
+
+ $http.pendingRequests.push(config);
+ promise.then(removePendingReq, removePendingReq);
+
+
+ if ((config.cache || defaults.cache) && config.cache !== false &&
+ (config.method === 'GET' || config.method === 'JSONP')) {
+ cache = isObject(config.cache) ? config.cache
+ : isObject(defaults.cache) ? defaults.cache
+ : defaultCache;
+ }
+
+ if (cache) {
+ cachedResp = cache.get(url);
+ if (isDefined(cachedResp)) {
+ if (isPromiseLike(cachedResp)) {
+ // cached request has already been sent, but there is no response yet
+ cachedResp.then(removePendingReq, removePendingReq);
+ return cachedResp;
+ } else {
+ // serving from cache
+ if (isArray(cachedResp)) {
+ resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);
+ } else {
+ resolvePromise(cachedResp, 200, {}, 'OK');
+ }
+ }
+ } else {
+ // put the promise for the non-transformed response into cache as a placeholder
+ cache.put(url, promise);
+ }
+ }
+
+
+ // if we won't have the response in cache, set the xsrf headers and
+ // send the request to the backend
+ if (isUndefined(cachedResp)) {
+ var xsrfValue = urlIsSameOrigin(config.url)
+ ? $browser.cookies()[config.xsrfCookieName || defaults.xsrfCookieName]
+ : undefined;
+ if (xsrfValue) {
+ reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;
+ }
+
+ $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,
+ config.withCredentials, config.responseType);
+ }
+
+ return promise;
+
+
+ /**
+ * Callback registered to $httpBackend():
+ * - caches the response if desired
+ * - resolves the raw $http promise
+ * - calls $apply
+ */
+ function done(status, response, headersString, statusText) {
+ if (cache) {
+ if (isSuccess(status)) {
+ cache.put(url, [status, response, parseHeaders(headersString), statusText]);
+ } else {
+ // remove promise from the cache
+ cache.remove(url);
+ }
+ }
+
+ resolvePromise(response, status, headersString, statusText);
+ if (!$rootScope.$$phase) $rootScope.$apply();
+ }
+
+
+ /**
+ * Resolves the raw $http promise.
+ */
+ function resolvePromise(response, status, headers, statusText) {
+ // normalize internal statuses to 0
+ status = Math.max(status, 0);
+
+ (isSuccess(status) ? deferred.resolve : deferred.reject)({
+ data: response,
+ status: status,
+ headers: headersGetter(headers),
+ config: config,
+ statusText : statusText
+ });
+ }
+
+
+ function removePendingReq() {
+ var idx = indexOf($http.pendingRequests, config);
+ if (idx !== -1) $http.pendingRequests.splice(idx, 1);
+ }
+ }
+
+
+ function buildUrl(url, params) {
+ if (!params) return url;
+ var parts = [];
+ forEachSorted(params, function(value, key) {
+ if (value === null || isUndefined(value)) return;
+ if (!isArray(value)) value = [value];
+
+ forEach(value, function(v) {
+ if (isObject(v)) {
+ if (isDate(v)){
+ v = v.toISOString();
+ } else {
+ v = toJson(v);
+ }
+ }
+ parts.push(encodeUriQuery(key) + '=' +
+ encodeUriQuery(v));
+ });
+ });
+ if(parts.length > 0) {
+ url += ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&');
+ }
+ return url;
+ }
+ }];
+}
+
+function createXhr(method) {
+ //if IE and the method is not RFC2616 compliant, or if XMLHttpRequest
+ //is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest
+ //if it is available
+ if (msie <= 8 && (!method.match(/^(get|post|head|put|delete|options)$/i) ||
+ !window.XMLHttpRequest)) {
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
+ } else if (window.XMLHttpRequest) {
+ return new window.XMLHttpRequest();
+ }
+
+ throw minErr('$httpBackend')('noxhr', "This browser does not support XMLHttpRequest.");
+}
+
+/**
+ * @ngdoc service
+ * @name $httpBackend
+ * @requires $window
+ * @requires $document
+ *
+ * @description
+ * HTTP backend used by the {@link ng.$http service} that delegates to
+ * XMLHttpRequest object or JSONP and deals with browser incompatibilities.
+ *
+ * You should never need to use this service directly, instead use the higher-level abstractions:
+ * {@link ng.$http $http} or {@link ngResource.$resource $resource}.
+ *
+ * During testing this implementation is swapped with {@link ngMock.$httpBackend mock
+ * $httpBackend} which can be trained with responses.
+ */
+function $HttpBackendProvider() {
+ this.$get = ['$browser', '$window', '$document', function($browser, $window, $document) {
+ return createHttpBackend($browser, createXhr, $browser.defer, $window.angular.callbacks, $document[0]);
+ }];
+}
+
+function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {
+ var ABORTED = -1;
+
+ // TODO(vojta): fix the signature
+ return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {
+ var status;
+ $browser.$$incOutstandingRequestCount();
+ url = url || $browser.url();
+
+ if (lowercase(method) == 'jsonp') {
+ var callbackId = '_' + (callbacks.counter++).toString(36);
+ callbacks[callbackId] = function(data) {
+ callbacks[callbackId].data = data;
+ callbacks[callbackId].called = true;
+ };
+
+ var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),
+ callbackId, function(status, text) {
+ completeRequest(callback, status, callbacks[callbackId].data, "", text);
+ callbacks[callbackId] = noop;
+ });
+ } else {
+
+ var xhr = createXhr(method);
+
+ xhr.open(method, url, true);
+ forEach(headers, function(value, key) {
+ if (isDefined(value)) {
+ xhr.setRequestHeader(key, value);
+ }
+ });
+
+ // In IE6 and 7, this might be called synchronously when xhr.send below is called and the
+ // response is in the cache. the promise api will ensure that to the app code the api is
+ // always async
+ xhr.onreadystatechange = function() {
+ // onreadystatechange might get called multiple times with readyState === 4 on mobile webkit caused by
+ // xhrs that are resolved while the app is in the background (see #5426).
+ // since calling completeRequest sets the `xhr` variable to null, we just check if it's not null before
+ // continuing
+ //
+ // we can't set xhr.onreadystatechange to undefined or delete it because that breaks IE8 (method=PATCH) and
+ // Safari respectively.
+ if (xhr && xhr.readyState == 4) {
+ var responseHeaders = null,
+ response = null,
+ statusText = '';
+
+ if(status !== ABORTED) {
+ responseHeaders = xhr.getAllResponseHeaders();
+
+ // responseText is the old-school way of retrieving response (supported by IE8 & 9)
+ // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)
+ response = ('response' in xhr) ? xhr.response : xhr.responseText;
+ }
+
+ // Accessing statusText on an aborted xhr object will
+ // throw an 'c00c023f error' in IE9 and lower, don't touch it.
+ if (!(status === ABORTED && msie < 10)) {
+ statusText = xhr.statusText;
+ }
+
+ completeRequest(callback,
+ status || xhr.status,
+ response,
+ responseHeaders,
+ statusText);
+ }
+ };
+
+ if (withCredentials) {
+ xhr.withCredentials = true;
+ }
+
+ if (responseType) {
+ try {
+ xhr.responseType = responseType;
+ } catch (e) {
+ // WebKit added support for the json responseType value on 09/03/2013
+ // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are
+ // known to throw when setting the value "json" as the response type. Other older
+ // browsers implementing the responseType
+ //
+ // The json response type can be ignored if not supported, because JSON payloads are
+ // parsed on the client-side regardless.
+ if (responseType !== 'json') {
+ throw e;
+ }
+ }
+ }
+
+ xhr.send(post || null);
+ }
+
+ if (timeout > 0) {
+ var timeoutId = $browserDefer(timeoutRequest, timeout);
+ } else if (isPromiseLike(timeout)) {
+ timeout.then(timeoutRequest);
+ }
+
+
+ function timeoutRequest() {
+ status = ABORTED;
+ jsonpDone && jsonpDone();
+ xhr && xhr.abort();
+ }
+
+ function completeRequest(callback, status, response, headersString, statusText) {
+ // cancel timeout and subsequent timeout promise resolution
+ timeoutId && $browserDefer.cancel(timeoutId);
+ jsonpDone = xhr = null;
+
+ // fix status code when it is 0 (0 status is undocumented).
+ // Occurs when accessing file resources or on Android 4.1 stock browser
+ // while retrieving files from application cache.
+ if (status === 0) {
+ status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;
+ }
+
+ // normalize IE bug (http://bugs.jquery.com/ticket/1450)
+ status = status === 1223 ? 204 : status;
+ statusText = statusText || '';
+
+ callback(status, response, headersString, statusText);
+ $browser.$$completeOutstandingRequest(noop);
+ }
+ };
+
+ function jsonpReq(url, callbackId, done) {
+ // we can't use jQuery/jqLite here because jQuery does crazy shit with script elements, e.g.:
+ // - fetches local scripts via XHR and evals them
+ // - adds and immediately removes script elements from the document
+ var script = rawDocument.createElement('script'), callback = null;
+ script.type = "text/javascript";
+ script.src = url;
+ script.async = true;
+
+ callback = function(event) {
+ removeEventListenerFn(script, "load", callback);
+ removeEventListenerFn(script, "error", callback);
+ rawDocument.body.removeChild(script);
+ script = null;
+ var status = -1;
+ var text = "unknown";
+
+ if (event) {
+ if (event.type === "load" && !callbacks[callbackId].called) {
+ event = { type: "error" };
+ }
+ text = event.type;
+ status = event.type === "error" ? 404 : 200;
+ }
+
+ if (done) {
+ done(status, text);
+ }
+ };
+
+ addEventListenerFn(script, "load", callback);
+ addEventListenerFn(script, "error", callback);
+
+ if (msie <= 8) {
+ script.onreadystatechange = function() {
+ if (isString(script.readyState) && /loaded|complete/.test(script.readyState)) {
+ script.onreadystatechange = null;
+ callback({
+ type: 'load'
+ });
+ }
+ };
+ }
+
+ rawDocument.body.appendChild(script);
+ return callback;
+ }
+}
+
+var $interpolateMinErr = minErr('$interpolate');
+
+/**
+ * @ngdoc provider
+ * @name $interpolateProvider
+ * @kind function
+ *
+ * @description
+ *
+ * Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
+ *
+ * @example
+<example module="customInterpolationApp">
+<file name="index.html">
+<script>
+ var customInterpolationApp = angular.module('customInterpolationApp', []);
+
+ customInterpolationApp.config(function($interpolateProvider) {
+ $interpolateProvider.startSymbol('//');
+ $interpolateProvider.endSymbol('//');
+ });
+
+
+ customInterpolationApp.controller('DemoController', function() {
+ this.label = "This binding is brought you by // interpolation symbols.";
+ });
+</script>
+<div ng-app="App" ng-controller="DemoController as demo">
+ //demo.label//
+</div>
+</file>
+<file name="protractor.js" type="protractor">
+ it('should interpolate binding with custom symbols', function() {
+ expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.');
+ });
+</file>
+</example>
+ */
+function $InterpolateProvider() {
+ var startSymbol = '{{';
+ var endSymbol = '}}';
+
+ /**
+ * @ngdoc method
+ * @name $interpolateProvider#startSymbol
+ * @description
+ * Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
+ *
+ * @param {string=} value new value to set the starting symbol to.
+ * @returns {string|self} Returns the symbol when used as getter and self if used as setter.
+ */
+ this.startSymbol = function(value){
+ if (value) {
+ startSymbol = value;
+ return this;
+ } else {
+ return startSymbol;
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $interpolateProvider#endSymbol
+ * @description
+ * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
+ *
+ * @param {string=} value new value to set the ending symbol to.
+ * @returns {string|self} Returns the symbol when used as getter and self if used as setter.
+ */
+ this.endSymbol = function(value){
+ if (value) {
+ endSymbol = value;
+ return this;
+ } else {
+ return endSymbol;
+ }
+ };
+
+
+ this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {
+ var startSymbolLength = startSymbol.length,
+ endSymbolLength = endSymbol.length;
+
+ /**
+ * @ngdoc service
+ * @name $interpolate
+ * @kind function
+ *
+ * @requires $parse
+ * @requires $sce
+ *
+ * @description
+ *
+ * Compiles a string with markup into an interpolation function. This service is used by the
+ * HTML {@link ng.$compile $compile} service for data binding. See
+ * {@link ng.$interpolateProvider $interpolateProvider} for configuring the
+ * interpolation markup.
+ *
+ *
+ * ```js
+ * var $interpolate = ...; // injected
+ * var exp = $interpolate('Hello {{name | uppercase}}!');
+ * expect(exp({name:'Angular'}).toEqual('Hello ANGULAR!');
+ * ```
+ *
+ *
+ * @param {string} text The text with markup to interpolate.
+ * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have
+ * embedded expression in order to return an interpolation function. Strings with no
+ * embedded expression will return null for the interpolation function.
+ * @param {string=} trustedContext when provided, the returned function passes the interpolated
+ * result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult,
+ * trustedContext)} before returning it. Refer to the {@link ng.$sce $sce} service that
+ * provides Strict Contextual Escaping for details.
+ * @returns {function(context)} an interpolation function which is used to compute the
+ * interpolated string. The function has these parameters:
+ *
+ * * `context`: an object against which any expressions embedded in the strings are evaluated
+ * against.
+ *
+ */
+ function $interpolate(text, mustHaveExpression, trustedContext) {
+ var startIndex,
+ endIndex,
+ index = 0,
+ parts = [],
+ length = text.length,
+ hasInterpolation = false,
+ fn,
+ exp,
+ concat = [];
+
+ while(index < length) {
+ if ( ((startIndex = text.indexOf(startSymbol, index)) != -1) &&
+ ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1) ) {
+ (index != startIndex) && parts.push(text.substring(index, startIndex));
+ parts.push(fn = $parse(exp = text.substring(startIndex + startSymbolLength, endIndex)));
+ fn.exp = exp;
+ index = endIndex + endSymbolLength;
+ hasInterpolation = true;
+ } else {
+ // we did not find anything, so we have to add the remainder to the parts array
+ (index != length) && parts.push(text.substring(index));
+ index = length;
+ }
+ }
+
+ if (!(length = parts.length)) {
+ // we added, nothing, must have been an empty string.
+ parts.push('');
+ length = 1;
+ }
+
+ // Concatenating expressions makes it hard to reason about whether some combination of
+ // concatenated values are unsafe to use and could easily lead to XSS. By requiring that a
+ // single expression be used for iframe[src], object[src], etc., we ensure that the value
+ // that's used is assigned or constructed by some JS code somewhere that is more testable or
+ // make it obvious that you bound the value to some user controlled value. This helps reduce
+ // the load when auditing for XSS issues.
+ if (trustedContext && parts.length > 1) {
+ throw $interpolateMinErr('noconcat',
+ "Error while interpolating: {0}\nStrict Contextual Escaping disallows " +
+ "interpolations that concatenate multiple expressions when a trusted value is " +
+ "required. See http://docs.angularjs.org/api/ng.$sce", text);
+ }
+
+ if (!mustHaveExpression || hasInterpolation) {
+ concat.length = length;
+ fn = function(context) {
+ try {
+ for(var i = 0, ii = length, part; i<ii; i++) {
+ if (typeof (part = parts[i]) == 'function') {
+ part = part(context);
+ if (trustedContext) {
+ part = $sce.getTrusted(trustedContext, part);
+ } else {
+ part = $sce.valueOf(part);
+ }
+ if (part == null) { // null || undefined
+ part = '';
+ } else {
+ switch (typeof part) {
+ case 'string':
+ {
+ break;
+ }
+ case 'number':
+ {
+ part = '' + part;
+ break;
+ }
+ default:
+ {
+ part = toJson(part);
+ }
+ }
+ }
+ }
+ concat[i] = part;
+ }
+ return concat.join('');
+ }
+ catch(err) {
+ var newErr = $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text,
+ err.toString());
+ $exceptionHandler(newErr);
+ }
+ };
+ fn.exp = text;
+ fn.parts = parts;
+ return fn;
+ }
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $interpolate#startSymbol
+ * @description
+ * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
+ *
+ * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change
+ * the symbol.
+ *
+ * @returns {string} start symbol.
+ */
+ $interpolate.startSymbol = function() {
+ return startSymbol;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $interpolate#endSymbol
+ * @description
+ * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
+ *
+ * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change
+ * the symbol.
+ *
+ * @returns {string} end symbol.
+ */
+ $interpolate.endSymbol = function() {
+ return endSymbol;
+ };
+
+ return $interpolate;
+ }];
+}
+
+function $IntervalProvider() {
+ this.$get = ['$rootScope', '$window', '$q',
+ function($rootScope, $window, $q) {
+ var intervals = {};
+
+
+ /**
+ * @ngdoc service
+ * @name $interval
+ *
+ * @description
+ * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay`
+ * milliseconds.
+ *
+ * The return value of registering an interval function is a promise. This promise will be
+ * notified upon each tick of the interval, and will be resolved after `count` iterations, or
+ * run indefinitely if `count` is not defined. The value of the notification will be the
+ * number of iterations that have run.
+ * To cancel an interval, call `$interval.cancel(promise)`.
+ *
+ * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to
+ * move forward by `millis` milliseconds and trigger any functions scheduled to run in that
+ * time.
+ *
+ * <div class="alert alert-warning">
+ * **Note**: Intervals created by this service must be explicitly destroyed when you are finished
+ * with them. In particular they are not automatically destroyed when a controller's scope or a
+ * directive's element are destroyed.
+ * You should take this into consideration and make sure to always cancel the interval at the
+ * appropriate moment. See the example below for more details on how and when to do this.
+ * </div>
+ *
+ * @param {function()} fn A function that should be called repeatedly.
+ * @param {number} delay Number of milliseconds between each function call.
+ * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat
+ * indefinitely.
+ * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
+ * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
+ * @returns {promise} A promise which will be notified on each iteration.
+ *
+ * @example
+ * <example module="intervalExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('intervalExample', [])
+ * .controller('ExampleController', ['$scope', '$interval',
+ * function($scope, $interval) {
+ * $scope.format = 'M/d/yy h:mm:ss a';
+ * $scope.blood_1 = 100;
+ * $scope.blood_2 = 120;
+ *
+ * var stop;
+ * $scope.fight = function() {
+ * // Don't start a new fight if we are already fighting
+ * if ( angular.isDefined(stop) ) return;
+ *
+ * stop = $interval(function() {
+ * if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {
+ * $scope.blood_1 = $scope.blood_1 - 3;
+ * $scope.blood_2 = $scope.blood_2 - 4;
+ * } else {
+ * $scope.stopFight();
+ * }
+ * }, 100);
+ * };
+ *
+ * $scope.stopFight = function() {
+ * if (angular.isDefined(stop)) {
+ * $interval.cancel(stop);
+ * stop = undefined;
+ * }
+ * };
+ *
+ * $scope.resetFight = function() {
+ * $scope.blood_1 = 100;
+ * $scope.blood_2 = 120;
+ * };
+ *
+ * $scope.$on('$destroy', function() {
+ * // Make sure that the interval is destroyed too
+ * $scope.stopFight();
+ * });
+ * }])
+ * // Register the 'myCurrentTime' directive factory method.
+ * // We inject $interval and dateFilter service since the factory method is DI.
+ * .directive('myCurrentTime', ['$interval', 'dateFilter',
+ * function($interval, dateFilter) {
+ * // return the directive link function. (compile function not needed)
+ * return function(scope, element, attrs) {
+ * var format, // date format
+ * stopTime; // so that we can cancel the time updates
+ *
+ * // used to update the UI
+ * function updateTime() {
+ * element.text(dateFilter(new Date(), format));
+ * }
+ *
+ * // watch the expression, and update the UI on change.
+ * scope.$watch(attrs.myCurrentTime, function(value) {
+ * format = value;
+ * updateTime();
+ * });
+ *
+ * stopTime = $interval(updateTime, 1000);
+ *
+ * // listen on DOM destroy (removal) event, and cancel the next UI update
+ * // to prevent updating time after the DOM element was removed.
+ * element.bind('$destroy', function() {
+ * $interval.cancel(stopTime);
+ * });
+ * }
+ * }]);
+ * </script>
+ *
+ * <div>
+ * <div ng-controller="ExampleController">
+ * Date format: <input ng-model="format"> <hr/>
+ * Current time is: <span my-current-time="format"></span>
+ * <hr/>
+ * Blood 1 : <font color='red'>{{blood_1}}</font>
+ * Blood 2 : <font color='red'>{{blood_2}}</font>
+ * <button type="button" data-ng-click="fight()">Fight</button>
+ * <button type="button" data-ng-click="stopFight()">StopFight</button>
+ * <button type="button" data-ng-click="resetFight()">resetFight</button>
+ * </div>
+ * </div>
+ *
+ * </file>
+ * </example>
+ */
+ function interval(fn, delay, count, invokeApply) {
+ var setInterval = $window.setInterval,
+ clearInterval = $window.clearInterval,
+ deferred = $q.defer(),
+ promise = deferred.promise,
+ iteration = 0,
+ skipApply = (isDefined(invokeApply) && !invokeApply);
+
+ count = isDefined(count) ? count : 0;
+
+ promise.then(null, null, fn);
+
+ promise.$$intervalId = setInterval(function tick() {
+ deferred.notify(iteration++);
+
+ if (count > 0 && iteration >= count) {
+ deferred.resolve(iteration);
+ clearInterval(promise.$$intervalId);
+ delete intervals[promise.$$intervalId];
+ }
+
+ if (!skipApply) $rootScope.$apply();
+
+ }, delay);
+
+ intervals[promise.$$intervalId] = deferred;
+
+ return promise;
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $interval#cancel
+ *
+ * @description
+ * Cancels a task associated with the `promise`.
+ *
+ * @param {promise} promise returned by the `$interval` function.
+ * @returns {boolean} Returns `true` if the task was successfully canceled.
+ */
+ interval.cancel = function(promise) {
+ if (promise && promise.$$intervalId in intervals) {
+ intervals[promise.$$intervalId].reject('canceled');
+ $window.clearInterval(promise.$$intervalId);
+ delete intervals[promise.$$intervalId];
+ return true;
+ }
+ return false;
+ };
+
+ return interval;
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $locale
+ *
+ * @description
+ * $locale service provides localization rules for various Angular components. As of right now the
+ * only public api is:
+ *
+ * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)
+ */
+function $LocaleProvider(){
+ this.$get = function() {
+ return {
+ id: 'en-us',
+
+ NUMBER_FORMATS: {
+ DECIMAL_SEP: '.',
+ GROUP_SEP: ',',
+ PATTERNS: [
+ { // Decimal Pattern
+ minInt: 1,
+ minFrac: 0,
+ maxFrac: 3,
+ posPre: '',
+ posSuf: '',
+ negPre: '-',
+ negSuf: '',
+ gSize: 3,
+ lgSize: 3
+ },{ //Currency Pattern
+ minInt: 1,
+ minFrac: 2,
+ maxFrac: 2,
+ posPre: '\u00A4',
+ posSuf: '',
+ negPre: '(\u00A4',
+ negSuf: ')',
+ gSize: 3,
+ lgSize: 3
+ }
+ ],
+ CURRENCY_SYM: '$'
+ },
+
+ DATETIME_FORMATS: {
+ MONTH:
+ 'January,February,March,April,May,June,July,August,September,October,November,December'
+ .split(','),
+ SHORTMONTH: 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','),
+ DAY: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','),
+ SHORTDAY: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(','),
+ AMPMS: ['AM','PM'],
+ medium: 'MMM d, y h:mm:ss a',
+ short: 'M/d/yy h:mm a',
+ fullDate: 'EEEE, MMMM d, y',
+ longDate: 'MMMM d, y',
+ mediumDate: 'MMM d, y',
+ shortDate: 'M/d/yy',
+ mediumTime: 'h:mm:ss a',
+ shortTime: 'h:mm a'
+ },
+
+ pluralCat: function(num) {
+ if (num === 1) {
+ return 'one';
+ }
+ return 'other';
+ }
+ };
+ };
+}
+
+var PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/,
+ DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
+var $locationMinErr = minErr('$location');
+
+
+/**
+ * Encode path using encodeUriSegment, ignoring forward slashes
+ *
+ * @param {string} path Path to encode
+ * @returns {string}
+ */
+function encodePath(path) {
+ var segments = path.split('/'),
+ i = segments.length;
+
+ while (i--) {
+ segments[i] = encodeUriSegment(segments[i]);
+ }
+
+ return segments.join('/');
+}
+
+function parseAbsoluteUrl(absoluteUrl, locationObj, appBase) {
+ var parsedUrl = urlResolve(absoluteUrl, appBase);
+
+ locationObj.$$protocol = parsedUrl.protocol;
+ locationObj.$$host = parsedUrl.hostname;
+ locationObj.$$port = int(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;
+}
+
+
+function parseAppUrl(relativeUrl, locationObj, appBase) {
+ var prefixed = (relativeUrl.charAt(0) !== '/');
+ if (prefixed) {
+ relativeUrl = '/' + relativeUrl;
+ }
+ var match = urlResolve(relativeUrl, appBase);
+ locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?
+ match.pathname.substring(1) : match.pathname);
+ locationObj.$$search = parseKeyValue(match.search);
+ locationObj.$$hash = decodeURIComponent(match.hash);
+
+ // make sure path starts with '/';
+ if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') {
+ locationObj.$$path = '/' + locationObj.$$path;
+ }
+}
+
+
+/**
+ *
+ * @param {string} begin
+ * @param {string} whole
+ * @returns {string} returns text from whole after begin or undefined if it does not begin with
+ * expected string.
+ */
+function beginsWith(begin, whole) {
+ if (whole.indexOf(begin) === 0) {
+ return whole.substr(begin.length);
+ }
+}
+
+
+function stripHash(url) {
+ var index = url.indexOf('#');
+ return index == -1 ? url : url.substr(0, index);
+}
+
+
+function stripFile(url) {
+ return url.substr(0, stripHash(url).lastIndexOf('/') + 1);
+}
+
+/* return the server only (scheme://host:port) */
+function serverBase(url) {
+ return url.substring(0, url.indexOf('/', url.indexOf('//') + 2));
+}
+
+
+/**
+ * LocationHtml5Url represents an url
+ * This object is exposed as $location service when HTML5 mode is enabled and supported
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} basePrefix url path prefix
+ */
+function LocationHtml5Url(appBase, basePrefix) {
+ this.$$html5 = true;
+ basePrefix = basePrefix || '';
+ var appBaseNoFile = stripFile(appBase);
+ parseAbsoluteUrl(appBase, this, appBase);
+
+
+ /**
+ * Parse given html5 (regular) url string into properties
+ * @param {string} newAbsoluteUrl HTML5 url
+ * @private
+ */
+ this.$$parse = function(url) {
+ var pathUrl = beginsWith(appBaseNoFile, url);
+ if (!isString(pathUrl)) {
+ throw $locationMinErr('ipthprfx', 'Invalid url "{0}", missing path prefix "{1}".', url,
+ appBaseNoFile);
+ }
+
+ parseAppUrl(pathUrl, this, appBase);
+
+ if (!this.$$path) {
+ this.$$path = '/';
+ }
+
+ this.$$compose();
+ };
+
+ /**
+ * Compose url and update `absUrl` property
+ * @private
+ */
+ this.$$compose = function() {
+ var search = toKeyValue(this.$$search),
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+ this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'
+ };
+
+ this.$$rewrite = function(url) {
+ var appUrl, prevAppUrl;
+
+ if ( (appUrl = beginsWith(appBase, url)) !== undefined ) {
+ prevAppUrl = appUrl;
+ if ( (appUrl = beginsWith(basePrefix, appUrl)) !== undefined ) {
+ return appBaseNoFile + (beginsWith('/', appUrl) || appUrl);
+ } else {
+ return appBase + prevAppUrl;
+ }
+ } else if ( (appUrl = beginsWith(appBaseNoFile, url)) !== undefined ) {
+ return appBaseNoFile + appUrl;
+ } else if (appBaseNoFile == url + '/') {
+ return appBaseNoFile;
+ }
+ };
+}
+
+
+/**
+ * LocationHashbangUrl represents url
+ * This object is exposed as $location service when developer doesn't opt into html5 mode.
+ * It also serves as the base class for html5 mode fallback on legacy browsers.
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} hashPrefix hashbang prefix
+ */
+function LocationHashbangUrl(appBase, hashPrefix) {
+ var appBaseNoFile = stripFile(appBase);
+
+ parseAbsoluteUrl(appBase, this, appBase);
+
+
+ /**
+ * Parse given hashbang url into properties
+ * @param {string} url Hashbang url
+ * @private
+ */
+ this.$$parse = function(url) {
+ var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);
+ var withoutHashUrl = withoutBaseUrl.charAt(0) == '#'
+ ? beginsWith(hashPrefix, withoutBaseUrl)
+ : (this.$$html5)
+ ? withoutBaseUrl
+ : '';
+
+ if (!isString(withoutHashUrl)) {
+ throw $locationMinErr('ihshprfx', 'Invalid url "{0}", missing hash prefix "{1}".', url,
+ hashPrefix);
+ }
+ parseAppUrl(withoutHashUrl, this, appBase);
+
+ this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);
+
+ this.$$compose();
+
+ /*
+ * In Windows, on an anchor node on documents loaded from
+ * the filesystem, the browser will return a pathname
+ * prefixed with the drive name ('/C:/path') when a
+ * pathname without a drive is set:
+ * * a.setAttribute('href', '/foo')
+ * * a.pathname === '/C:/foo' //true
+ *
+ * Inside of Angular, we're always using pathnames that
+ * do not include drive names for routing.
+ */
+ function removeWindowsDriveName (path, url, base) {
+ /*
+ Matches paths for file protocol on windows,
+ such as /C:/foo/bar, and captures only /foo/bar.
+ */
+ var windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
+
+ var firstPathSegmentMatch;
+
+ //Get the relative path from the input URL.
+ if (url.indexOf(base) === 0) {
+ url = url.replace(base, '');
+ }
+
+ // The input URL intentionally contains a first path segment that ends with a colon.
+ if (windowsFilePathExp.exec(url)) {
+ return path;
+ }
+
+ firstPathSegmentMatch = windowsFilePathExp.exec(path);
+ return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
+ }
+ };
+
+ /**
+ * Compose hashbang url and update `absUrl` property
+ * @private
+ */
+ this.$$compose = function() {
+ var search = toKeyValue(this.$$search),
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+ this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');
+ };
+
+ this.$$rewrite = function(url) {
+ if(stripHash(appBase) == stripHash(url)) {
+ return url;
+ }
+ };
+}
+
+
+/**
+ * LocationHashbangUrl represents url
+ * This object is exposed as $location service when html5 history api is enabled but the browser
+ * does not support it.
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} hashPrefix hashbang prefix
+ */
+function LocationHashbangInHtml5Url(appBase, hashPrefix) {
+ this.$$html5 = true;
+ LocationHashbangUrl.apply(this, arguments);
+
+ var appBaseNoFile = stripFile(appBase);
+
+ this.$$rewrite = function(url) {
+ var appUrl;
+
+ if ( appBase == stripHash(url) ) {
+ return url;
+ } else if ( (appUrl = beginsWith(appBaseNoFile, url)) ) {
+ return appBase + hashPrefix + appUrl;
+ } else if ( appBaseNoFile === url + '/') {
+ return appBaseNoFile;
+ }
+ };
+
+ this.$$compose = function() {
+ var search = toKeyValue(this.$$search),
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+ // include hashPrefix in $$absUrl when $$url is empty so IE8 & 9 do not reload page because of removal of '#'
+ this.$$absUrl = appBase + hashPrefix + this.$$url;
+ };
+
+}
+
+
+LocationHashbangInHtml5Url.prototype =
+ LocationHashbangUrl.prototype =
+ LocationHtml5Url.prototype = {
+
+ /**
+ * Are we in html5 mode?
+ * @private
+ */
+ $$html5: false,
+
+ /**
+ * Has any change been replacing ?
+ * @private
+ */
+ $$replace: false,
+
+ /**
+ * @ngdoc method
+ * @name $location#absUrl
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return full url representation with all segments encoded according to rules specified in
+ * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
+ *
+ * @return {string} full url
+ */
+ absUrl: locationGetter('$$absUrl'),
+
+ /**
+ * @ngdoc method
+ * @name $location#url
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return url (e.g. `/path?a=b#hash`) when called without any parameter.
+ *
+ * Change path, search and hash, when called with parameter and return `$location`.
+ *
+ * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)
+ * @return {string} url
+ */
+ url: function(url) {
+ if (isUndefined(url))
+ return this.$$url;
+
+ var match = PATH_MATCH.exec(url);
+ if (match[1]) this.path(decodeURIComponent(match[1]));
+ if (match[2] || match[1]) this.search(match[3] || '');
+ this.hash(match[5] || '');
+
+ return this;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $location#protocol
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return protocol of current url.
+ *
+ * @return {string} protocol of current url
+ */
+ protocol: locationGetter('$$protocol'),
+
+ /**
+ * @ngdoc method
+ * @name $location#host
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return host of current url.
+ *
+ * @return {string} host of current url.
+ */
+ host: locationGetter('$$host'),
+
+ /**
+ * @ngdoc method
+ * @name $location#port
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return port of current url.
+ *
+ * @return {Number} port
+ */
+ port: locationGetter('$$port'),
+
+ /**
+ * @ngdoc method
+ * @name $location#path
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return path of current url when called without any parameter.
+ *
+ * Change path when called with parameter and return `$location`.
+ *
+ * Note: Path should always begin with forward slash (/), this method will add the forward slash
+ * if it is missing.
+ *
+ * @param {(string|number)=} path New path
+ * @return {string} path
+ */
+ path: locationGetterSetter('$$path', function(path) {
+ path = path ? path.toString() : '';
+ return path.charAt(0) == '/' ? path : '/' + path;
+ }),
+
+ /**
+ * @ngdoc method
+ * @name $location#search
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return search part (as object) of current url when called without any parameter.
+ *
+ * Change search part when called with parameter and return `$location`.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var searchObject = $location.search();
+ * // => {foo: 'bar', baz: 'xoxo'}
+ *
+ *
+ * // set foo to 'yipee'
+ * $location.search('foo', 'yipee');
+ * // => $location
+ * ```
+ *
+ * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or
+ * hash object.
+ *
+ * When called with a single argument the method acts as a setter, setting the `search` component
+ * of `$location` to the specified value.
+ *
+ * If the argument is a hash object containing an array of values, these values will be encoded
+ * as duplicate search parameters in the url.
+ *
+ * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`
+ * will override only a single search property.
+ *
+ * If `paramValue` is an array, it will override the property of the `search` component of
+ * `$location` specified via the first argument.
+ *
+ * If `paramValue` is `null`, the property specified via the first argument will be deleted.
+ *
+ * If `paramValue` is `true`, the property specified via the first argument will be added with no
+ * value nor trailing equal sign.
+ *
+ * @return {Object} If called with no arguments returns the parsed `search` object. If called with
+ * one or more arguments returns `$location` object itself.
+ */
+ search: function(search, paramValue) {
+ switch (arguments.length) {
+ case 0:
+ return this.$$search;
+ case 1:
+ if (isString(search) || isNumber(search)) {
+ search = search.toString();
+ this.$$search = parseKeyValue(search);
+ } else if (isObject(search)) {
+ // remove object undefined or null properties
+ forEach(search, function(value, key) {
+ if (value == null) delete search[key];
+ });
+
+ this.$$search = search;
+ } else {
+ throw $locationMinErr('isrcharg',
+ 'The first argument of the `$location#search()` call must be a string or an object.');
+ }
+ break;
+ default:
+ if (isUndefined(paramValue) || paramValue === null) {
+ delete this.$$search[search];
+ } else {
+ this.$$search[search] = paramValue;
+ }
+ }
+
+ this.$$compose();
+ return this;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $location#hash
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return hash fragment when called without any parameter.
+ *
+ * Change hash fragment when called with parameter and return `$location`.
+ *
+ * @param {(string|number)=} hash New hash fragment
+ * @return {string} hash
+ */
+ hash: locationGetterSetter('$$hash', function(hash) {
+ return hash ? hash.toString() : '';
+ }),
+
+ /**
+ * @ngdoc method
+ * @name $location#replace
+ *
+ * @description
+ * If called, all changes to $location during current `$digest` will be replacing current history
+ * record, instead of adding new one.
+ */
+ replace: function() {
+ this.$$replace = true;
+ return this;
+ }
+};
+
+function locationGetter(property) {
+ return function() {
+ return this[property];
+ };
+}
+
+
+function locationGetterSetter(property, preprocess) {
+ return function(value) {
+ if (isUndefined(value))
+ return this[property];
+
+ this[property] = preprocess(value);
+ this.$$compose();
+
+ return this;
+ };
+}
+
+
+/**
+ * @ngdoc service
+ * @name $location
+ *
+ * @requires $rootElement
+ *
+ * @description
+ * The $location service parses the URL in the browser address bar (based on the
+ * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL
+ * available to your application. Changes to the URL in the address bar are reflected into
+ * $location service and changes to $location are reflected into the browser address bar.
+ *
+ * **The $location service:**
+ *
+ * - Exposes the current URL in the browser address bar, so you can
+ * - Watch and observe the URL.
+ * - Change the URL.
+ * - Synchronizes the URL with the browser when the user
+ * - Changes the address bar.
+ * - Clicks the back or forward button (or clicks a History link).
+ * - Clicks on a link.
+ * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
+ *
+ * For more information see {@link guide/$location Developer Guide: Using $location}
+ */
+
+/**
+ * @ngdoc provider
+ * @name $locationProvider
+ * @description
+ * Use the `$locationProvider` to configure how the application deep linking paths are stored.
+ */
+function $LocationProvider(){
+ var hashPrefix = '',
+ html5Mode = false;
+
+ /**
+ * @ngdoc method
+ * @name $locationProvider#hashPrefix
+ * @description
+ * @param {string=} prefix Prefix for hash part (containing path and search)
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ */
+ this.hashPrefix = function(prefix) {
+ if (isDefined(prefix)) {
+ hashPrefix = prefix;
+ return this;
+ } else {
+ return hashPrefix;
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $locationProvider#html5Mode
+ * @description
+ * @param {boolean=} mode Use HTML5 strategy if available.
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ */
+ this.html5Mode = function(mode) {
+ if (isDefined(mode)) {
+ html5Mode = mode;
+ return this;
+ } else {
+ return html5Mode;
+ }
+ };
+
+ /**
+ * @ngdoc event
+ * @name $location#$locationChangeStart
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted before a URL will change. This change can be prevented by calling
+ * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more
+ * details about event object. Upon successful change
+ * {@link ng.$location#events_$locationChangeSuccess $locationChangeSuccess} is fired.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {string} newUrl New URL
+ * @param {string=} oldUrl URL that was before it was changed.
+ */
+
+ /**
+ * @ngdoc event
+ * @name $location#$locationChangeSuccess
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted after a URL was changed.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {string} newUrl New URL
+ * @param {string=} oldUrl URL that was before it was changed.
+ */
+
+ this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement',
+ function( $rootScope, $browser, $sniffer, $rootElement) {
+ var $location,
+ LocationMode,
+ baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to ''
+ initialUrl = $browser.url(),
+ appBase;
+
+ if (html5Mode) {
+ appBase = serverBase(initialUrl) + (baseHref || '/');
+ LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;
+ } else {
+ appBase = stripHash(initialUrl);
+ LocationMode = LocationHashbangUrl;
+ }
+ $location = new LocationMode(appBase, '#' + hashPrefix);
+ $location.$$parse($location.$$rewrite(initialUrl));
+
+ var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
+
+ $rootElement.on('click', function(event) {
+ // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
+ // currently we open nice url link and redirect then
+
+ if (event.ctrlKey || event.metaKey || event.which == 2) return;
+
+ var elm = jqLite(event.target);
+
+ // traverse the DOM up to find first A tag
+ while (lowercase(elm[0].nodeName) !== 'a') {
+ // ignore rewriting if no A tag (reached root element, or no parent - removed from document)
+ if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;
+ }
+
+ var absHref = elm.prop('href');
+
+ if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {
+ // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during
+ // an animation.
+ absHref = urlResolve(absHref.animVal).href;
+ }
+
+ // Ignore when url is started with javascript: or mailto:
+ if (IGNORE_URI_REGEXP.test(absHref)) return;
+
+ // Make relative links work in HTML5 mode for legacy browsers (or at least IE8 & 9)
+ // The href should be a regular url e.g. /link/somewhere or link/somewhere or ../somewhere or
+ // somewhere#anchor or http://example.com/somewhere
+ if (LocationMode === LocationHashbangInHtml5Url) {
+ // get the actual href attribute - see
+ // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx
+ var href = elm.attr('href') || elm.attr('xlink:href');
+
+ if (href && href.indexOf('://') < 0) { // Ignore absolute URLs
+ var prefix = '#' + hashPrefix;
+ if (href[0] == '/') {
+ // absolute path - replace old path
+ absHref = appBase + prefix + href;
+ } else if (href[0] == '#') {
+ // local anchor
+ absHref = appBase + prefix + ($location.path() || '/') + href;
+ } else {
+ // relative path - join with current path
+ var stack = $location.path().split("/"),
+ parts = href.split("/");
+ if (stack.length === 2 && !stack[1]) stack.length = 1;
+ for (var i=0; i<parts.length; i++) {
+ if (parts[i] == ".")
+ continue;
+ else if (parts[i] == "..")
+ stack.pop();
+ else if (parts[i].length)
+ stack.push(parts[i]);
+ }
+ absHref = appBase + prefix + stack.join('/');
+ }
+ }
+ }
+
+ var rewrittenUrl = $location.$$rewrite(absHref);
+
+ if (absHref && !elm.attr('target') && rewrittenUrl && !event.isDefaultPrevented()) {
+ event.preventDefault();
+ if (rewrittenUrl != $browser.url()) {
+ // update location manually
+ $location.$$parse(rewrittenUrl);
+ $rootScope.$apply();
+ // hack to work around FF6 bug 684208 when scenario runner clicks on links
+ window.angular['ff-684208-preventDefault'] = true;
+ }
+ }
+ });
+
+
+ // rewrite hashbang url <> html5 url
+ if ($location.absUrl() != initialUrl) {
+ $browser.url($location.absUrl(), true);
+ }
+
+ // update $location when $browser url changes
+ $browser.onUrlChange(function(newUrl) {
+ if ($location.absUrl() != newUrl) {
+ $rootScope.$evalAsync(function() {
+ var oldUrl = $location.absUrl();
+
+ $location.$$parse(newUrl);
+ if ($rootScope.$broadcast('$locationChangeStart', newUrl,
+ oldUrl).defaultPrevented) {
+ $location.$$parse(oldUrl);
+ $browser.url(oldUrl);
+ } else {
+ afterLocationChange(oldUrl);
+ }
+ });
+ if (!$rootScope.$$phase) $rootScope.$digest();
+ }
+ });
+
+ // update browser
+ var changeCounter = 0;
+ $rootScope.$watch(function $locationWatch() {
+ var oldUrl = $browser.url();
+ var currentReplace = $location.$$replace;
+
+ if (!changeCounter || oldUrl != $location.absUrl()) {
+ changeCounter++;
+ $rootScope.$evalAsync(function() {
+ if ($rootScope.$broadcast('$locationChangeStart', $location.absUrl(), oldUrl).
+ defaultPrevented) {
+ $location.$$parse(oldUrl);
+ } else {
+ $browser.url($location.absUrl(), currentReplace);
+ afterLocationChange(oldUrl);
+ }
+ });
+ }
+ $location.$$replace = false;
+
+ return changeCounter;
+ });
+
+ return $location;
+
+ function afterLocationChange(oldUrl) {
+ $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl);
+ }
+}];
+}
+
+/**
+ * @ngdoc service
+ * @name $log
+ * @requires $window
+ *
+ * @description
+ * Simple service for logging. Default implementation safely writes the message
+ * into the browser's console (if present).
+ *
+ * The main purpose of this service is to simplify debugging and troubleshooting.
+ *
+ * The default is to log `debug` messages. You can use
+ * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.
+ *
+ * @example
+ <example module="logExample">
+ <file name="script.js">
+ angular.module('logExample', [])
+ .controller('LogController', ['$scope', '$log', function($scope, $log) {
+ $scope.$log = $log;
+ $scope.message = 'Hello World!';
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="LogController">
+ <p>Reload this page with open console, enter text and hit the log button...</p>
+ Message:
+ <input type="text" ng-model="message"/>
+ <button ng-click="$log.log(message)">log</button>
+ <button ng-click="$log.warn(message)">warn</button>
+ <button ng-click="$log.info(message)">info</button>
+ <button ng-click="$log.error(message)">error</button>
+ </div>
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc provider
+ * @name $logProvider
+ * @description
+ * Use the `$logProvider` to configure how the application logs messages
+ */
+function $LogProvider(){
+ var debug = true,
+ self = this;
+
+ /**
+ * @ngdoc method
+ * @name $logProvider#debugEnabled
+ * @description
+ * @param {boolean=} flag enable or disable debug level messages
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ */
+ this.debugEnabled = function(flag) {
+ if (isDefined(flag)) {
+ debug = flag;
+ return this;
+ } else {
+ return debug;
+ }
+ };
+
+ this.$get = ['$window', function($window){
+ return {
+ /**
+ * @ngdoc method
+ * @name $log#log
+ *
+ * @description
+ * Write a log message
+ */
+ log: consoleLog('log'),
+
+ /**
+ * @ngdoc method
+ * @name $log#info
+ *
+ * @description
+ * Write an information message
+ */
+ info: consoleLog('info'),
+
+ /**
+ * @ngdoc method
+ * @name $log#warn
+ *
+ * @description
+ * Write a warning message
+ */
+ warn: consoleLog('warn'),
+
+ /**
+ * @ngdoc method
+ * @name $log#error
+ *
+ * @description
+ * Write an error message
+ */
+ error: consoleLog('error'),
+
+ /**
+ * @ngdoc method
+ * @name $log#debug
+ *
+ * @description
+ * Write a debug message
+ */
+ debug: (function () {
+ var fn = consoleLog('debug');
+
+ return function() {
+ if (debug) {
+ fn.apply(self, arguments);
+ }
+ };
+ }())
+ };
+
+ function formatError(arg) {
+ if (arg instanceof Error) {
+ if (arg.stack) {
+ arg = (arg.message && arg.stack.indexOf(arg.message) === -1)
+ ? 'Error: ' + arg.message + '\n' + arg.stack
+ : arg.stack;
+ } else if (arg.sourceURL) {
+ arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line;
+ }
+ }
+ return arg;
+ }
+
+ function consoleLog(type) {
+ var console = $window.console || {},
+ logFn = console[type] || console.log || noop,
+ hasApply = false;
+
+ // Note: reading logFn.apply throws an error in IE11 in IE8 document mode.
+ // The reason behind this is that console.log has type "object" in IE8...
+ try {
+ hasApply = !!logFn.apply;
+ } catch (e) {}
+
+ if (hasApply) {
+ return function() {
+ var args = [];
+ forEach(arguments, function(arg) {
+ args.push(formatError(arg));
+ });
+ return logFn.apply(console, args);
+ };
+ }
+
+ // we are IE which either doesn't have window.console => this is noop and we do nothing,
+ // or we are IE where console.log doesn't have apply so we log at least first 2 args
+ return function(arg1, arg2) {
+ logFn(arg1, arg2 == null ? '' : arg2);
+ };
+ }
+ }];
+}
+
+var $parseMinErr = minErr('$parse');
+var promiseWarningCache = {};
+var promiseWarning;
+
+// Sandboxing Angular Expressions
+// ------------------------------
+// Angular expressions are generally considered safe because these expressions only have direct
+// access to $scope and locals. However, one can obtain the ability to execute arbitrary JS code by
+// obtaining a reference to native JS functions such as the Function constructor.
+//
+// As an example, consider the following Angular expression:
+//
+// {}.toString.constructor('alert("evil JS code")')
+//
+// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits
+// against the expression language, but not to prevent exploits that were enabled by exposing
+// sensitive JavaScript or browser apis on Scope. Exposing such objects on a Scope is never a good
+// practice and therefore we are not even trying to protect against interaction with an object
+// explicitly exposed in this way.
+//
+// In general, it is not possible to access a Window object from an angular expression unless a
+// window or some DOM object that has a reference to window is published onto a Scope.
+// Similarly we prevent invocations of function known to be dangerous, as well as assignments to
+// native objects.
+
+
+function ensureSafeMemberName(name, fullExpression) {
+ if (name === "__defineGetter__" || name === "__defineSetter__"
+ || name === "__lookupGetter__" || name === "__lookupSetter__"
+ || name === "__proto__") {
+ throw $parseMinErr('isecfld',
+ 'Attempting to access a disallowed field in Angular expressions! '
+ +'Expression: {0}', fullExpression);
+ }
+ return name;
+}
+
+function ensureSafeObject(obj, fullExpression) {
+ // nifty check if obj is Function that is fast and works across iframes and other contexts
+ if (obj) {
+ if (obj.constructor === obj) {
+ throw $parseMinErr('isecfn',
+ 'Referencing Function in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (// isWindow(obj)
+ obj.document && obj.location && obj.alert && obj.setInterval) {
+ throw $parseMinErr('isecwindow',
+ 'Referencing the Window in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (// isElement(obj)
+ obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) {
+ throw $parseMinErr('isecdom',
+ 'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (// block Object so that we can't get hold of dangerous Object.* methods
+ obj === Object) {
+ throw $parseMinErr('isecobj',
+ 'Referencing Object in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ }
+ }
+ return obj;
+}
+
+var CALL = Function.prototype.call;
+var APPLY = Function.prototype.apply;
+var BIND = Function.prototype.bind;
+
+function ensureSafeFunction(obj, fullExpression) {
+ if (obj) {
+ if (obj.constructor === obj) {
+ throw $parseMinErr('isecfn',
+ 'Referencing Function in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (obj === CALL || obj === APPLY || (BIND && obj === BIND)) {
+ throw $parseMinErr('isecff',
+ 'Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ }
+ }
+}
+
+var OPERATORS = {
+ /* jshint bitwise : false */
+ 'null':function(){return null;},
+ 'true':function(){return true;},
+ 'false':function(){return false;},
+ undefined:noop,
+ '+':function(self, locals, a,b){
+ a=a(self, locals); b=b(self, locals);
+ if (isDefined(a)) {
+ if (isDefined(b)) {
+ return a + b;
+ }
+ return a;
+ }
+ return isDefined(b)?b:undefined;},
+ '-':function(self, locals, a,b){
+ a=a(self, locals); b=b(self, locals);
+ return (isDefined(a)?a:0)-(isDefined(b)?b:0);
+ },
+ '*':function(self, locals, a,b){return a(self, locals)*b(self, locals);},
+ '/':function(self, locals, a,b){return a(self, locals)/b(self, locals);},
+ '%':function(self, locals, a,b){return a(self, locals)%b(self, locals);},
+ '^':function(self, locals, a,b){return a(self, locals)^b(self, locals);},
+ '=':noop,
+ '===':function(self, locals, a, b){return a(self, locals)===b(self, locals);},
+ '!==':function(self, locals, a, b){return a(self, locals)!==b(self, locals);},
+ '==':function(self, locals, a,b){return a(self, locals)==b(self, locals);},
+ '!=':function(self, locals, a,b){return a(self, locals)!=b(self, locals);},
+ '<':function(self, locals, a,b){return a(self, locals)<b(self, locals);},
+ '>':function(self, locals, a,b){return a(self, locals)>b(self, locals);},
+ '<=':function(self, locals, a,b){return a(self, locals)<=b(self, locals);},
+ '>=':function(self, locals, a,b){return a(self, locals)>=b(self, locals);},
+ '&&':function(self, locals, a,b){return a(self, locals)&&b(self, locals);},
+ '||':function(self, locals, a,b){return a(self, locals)||b(self, locals);},
+ '&':function(self, locals, a,b){return a(self, locals)&b(self, locals);},
+// '|':function(self, locals, a,b){return a|b;},
+ '|':function(self, locals, a,b){return b(self, locals)(self, locals, a(self, locals));},
+ '!':function(self, locals, a){return !a(self, locals);}
+};
+/* jshint bitwise: true */
+var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'};
+
+
+/////////////////////////////////////////
+
+
+/**
+ * @constructor
+ */
+var Lexer = function (options) {
+ this.options = options;
+};
+
+Lexer.prototype = {
+ constructor: Lexer,
+
+ lex: function (text) {
+ this.text = text;
+
+ this.index = 0;
+ this.ch = undefined;
+ this.lastCh = ':'; // can start regexp
+
+ this.tokens = [];
+
+ while (this.index < this.text.length) {
+ this.ch = this.text.charAt(this.index);
+ if (this.is('"\'')) {
+ this.readString(this.ch);
+ } else if (this.isNumber(this.ch) || this.is('.') && this.isNumber(this.peek())) {
+ this.readNumber();
+ } else if (this.isIdent(this.ch)) {
+ this.readIdent();
+ } else if (this.is('(){}[].,;:?')) {
+ this.tokens.push({
+ index: this.index,
+ text: this.ch
+ });
+ this.index++;
+ } else if (this.isWhitespace(this.ch)) {
+ this.index++;
+ continue;
+ } else {
+ var ch2 = this.ch + this.peek();
+ var ch3 = ch2 + this.peek(2);
+ var fn = OPERATORS[this.ch];
+ var fn2 = OPERATORS[ch2];
+ var fn3 = OPERATORS[ch3];
+ if (fn3) {
+ this.tokens.push({index: this.index, text: ch3, fn: fn3});
+ this.index += 3;
+ } else if (fn2) {
+ this.tokens.push({index: this.index, text: ch2, fn: fn2});
+ this.index += 2;
+ } else if (fn) {
+ this.tokens.push({
+ index: this.index,
+ text: this.ch,
+ fn: fn
+ });
+ this.index += 1;
+ } else {
+ this.throwError('Unexpected next character ', this.index, this.index + 1);
+ }
+ }
+ this.lastCh = this.ch;
+ }
+ return this.tokens;
+ },
+
+ is: function(chars) {
+ return chars.indexOf(this.ch) !== -1;
+ },
+
+ was: function(chars) {
+ return chars.indexOf(this.lastCh) !== -1;
+ },
+
+ peek: function(i) {
+ var num = i || 1;
+ return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;
+ },
+
+ isNumber: function(ch) {
+ return ('0' <= ch && ch <= '9');
+ },
+
+ isWhitespace: function(ch) {
+ // IE treats non-breaking space as \u00A0
+ return (ch === ' ' || ch === '\r' || ch === '\t' ||
+ ch === '\n' || ch === '\v' || ch === '\u00A0');
+ },
+
+ isIdent: function(ch) {
+ return ('a' <= ch && ch <= 'z' ||
+ 'A' <= ch && ch <= 'Z' ||
+ '_' === ch || ch === '$');
+ },
+
+ isExpOperator: function(ch) {
+ return (ch === '-' || ch === '+' || this.isNumber(ch));
+ },
+
+ throwError: function(error, start, end) {
+ end = end || this.index;
+ var colStr = (isDefined(start)
+ ? 's ' + start + '-' + this.index + ' [' + this.text.substring(start, end) + ']'
+ : ' ' + end);
+ throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].',
+ error, colStr, this.text);
+ },
+
+ readNumber: function() {
+ var number = '';
+ var start = this.index;
+ while (this.index < this.text.length) {
+ var ch = lowercase(this.text.charAt(this.index));
+ if (ch == '.' || this.isNumber(ch)) {
+ number += ch;
+ } else {
+ var peekCh = this.peek();
+ if (ch == 'e' && this.isExpOperator(peekCh)) {
+ number += ch;
+ } else if (this.isExpOperator(ch) &&
+ peekCh && this.isNumber(peekCh) &&
+ number.charAt(number.length - 1) == 'e') {
+ number += ch;
+ } else if (this.isExpOperator(ch) &&
+ (!peekCh || !this.isNumber(peekCh)) &&
+ number.charAt(number.length - 1) == 'e') {
+ this.throwError('Invalid exponent');
+ } else {
+ break;
+ }
+ }
+ this.index++;
+ }
+ number = 1 * number;
+ this.tokens.push({
+ index: start,
+ text: number,
+ literal: true,
+ constant: true,
+ fn: function() { return number; }
+ });
+ },
+
+ readIdent: function() {
+ var parser = this;
+
+ var ident = '';
+ var start = this.index;
+
+ var lastDot, peekIndex, methodName, ch;
+
+ while (this.index < this.text.length) {
+ ch = this.text.charAt(this.index);
+ if (ch === '.' || this.isIdent(ch) || this.isNumber(ch)) {
+ if (ch === '.') lastDot = this.index;
+ ident += ch;
+ } else {
+ break;
+ }
+ this.index++;
+ }
+
+ //check if this is not a method invocation and if it is back out to last dot
+ if (lastDot) {
+ peekIndex = this.index;
+ while (peekIndex < this.text.length) {
+ ch = this.text.charAt(peekIndex);
+ if (ch === '(') {
+ methodName = ident.substr(lastDot - start + 1);
+ ident = ident.substr(0, lastDot - start);
+ this.index = peekIndex;
+ break;
+ }
+ if (this.isWhitespace(ch)) {
+ peekIndex++;
+ } else {
+ break;
+ }
+ }
+ }
+
+
+ var token = {
+ index: start,
+ text: ident
+ };
+
+ // OPERATORS is our own object so we don't need to use special hasOwnPropertyFn
+ if (OPERATORS.hasOwnProperty(ident)) {
+ token.fn = OPERATORS[ident];
+ token.literal = true;
+ token.constant = true;
+ } else {
+ var getter = getterFn(ident, this.options, this.text);
+ token.fn = extend(function(self, locals) {
+ return (getter(self, locals));
+ }, {
+ assign: function(self, value) {
+ return setter(self, ident, value, parser.text, parser.options);
+ }
+ });
+ }
+
+ this.tokens.push(token);
+
+ if (methodName) {
+ this.tokens.push({
+ index:lastDot,
+ text: '.'
+ });
+ this.tokens.push({
+ index: lastDot + 1,
+ text: methodName
+ });
+ }
+ },
+
+ readString: function(quote) {
+ var start = this.index;
+ this.index++;
+ var string = '';
+ var rawString = quote;
+ var escape = false;
+ while (this.index < this.text.length) {
+ var ch = this.text.charAt(this.index);
+ rawString += ch;
+ if (escape) {
+ if (ch === 'u') {
+ var hex = this.text.substring(this.index + 1, this.index + 5);
+ if (!hex.match(/[\da-f]{4}/i))
+ this.throwError('Invalid unicode escape [\\u' + hex + ']');
+ this.index += 4;
+ string += String.fromCharCode(parseInt(hex, 16));
+ } else {
+ var rep = ESCAPE[ch];
+ string = string + (rep || ch);
+ }
+ escape = false;
+ } else if (ch === '\\') {
+ escape = true;
+ } else if (ch === quote) {
+ this.index++;
+ this.tokens.push({
+ index: start,
+ text: rawString,
+ string: string,
+ literal: true,
+ constant: true,
+ fn: function() { return string; }
+ });
+ return;
+ } else {
+ string += ch;
+ }
+ this.index++;
+ }
+ this.throwError('Unterminated quote', start);
+ }
+};
+
+
+/**
+ * @constructor
+ */
+var Parser = function (lexer, $filter, options) {
+ this.lexer = lexer;
+ this.$filter = $filter;
+ this.options = options;
+};
+
+Parser.ZERO = extend(function () {
+ return 0;
+}, {
+ constant: true
+});
+
+Parser.prototype = {
+ constructor: Parser,
+
+ parse: function (text) {
+ this.text = text;
+
+ this.tokens = this.lexer.lex(text);
+
+ var value = this.statements();
+
+ if (this.tokens.length !== 0) {
+ this.throwError('is an unexpected token', this.tokens[0]);
+ }
+
+ value.literal = !!value.literal;
+ value.constant = !!value.constant;
+
+ return value;
+ },
+
+ primary: function () {
+ var primary;
+ if (this.expect('(')) {
+ primary = this.filterChain();
+ this.consume(')');
+ } else if (this.expect('[')) {
+ primary = this.arrayDeclaration();
+ } else if (this.expect('{')) {
+ primary = this.object();
+ } else {
+ var token = this.expect();
+ primary = token.fn;
+ if (!primary) {
+ this.throwError('not a primary expression', token);
+ }
+ primary.literal = !!token.literal;
+ primary.constant = !!token.constant;
+ }
+
+ var next, context;
+ while ((next = this.expect('(', '[', '.'))) {
+ if (next.text === '(') {
+ primary = this.functionCall(primary, context);
+ context = null;
+ } else if (next.text === '[') {
+ context = primary;
+ primary = this.objectIndex(primary);
+ } else if (next.text === '.') {
+ context = primary;
+ primary = this.fieldAccess(primary);
+ } else {
+ this.throwError('IMPOSSIBLE');
+ }
+ }
+ return primary;
+ },
+
+ throwError: function(msg, token) {
+ throw $parseMinErr('syntax',
+ 'Syntax Error: Token \'{0}\' {1} at column {2} of the expression [{3}] starting at [{4}].',
+ token.text, msg, (token.index + 1), this.text, this.text.substring(token.index));
+ },
+
+ peekToken: function() {
+ if (this.tokens.length === 0)
+ throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);
+ return this.tokens[0];
+ },
+
+ peek: function(e1, e2, e3, e4) {
+ if (this.tokens.length > 0) {
+ var token = this.tokens[0];
+ var t = token.text;
+ if (t === e1 || t === e2 || t === e3 || t === e4 ||
+ (!e1 && !e2 && !e3 && !e4)) {
+ return token;
+ }
+ }
+ return false;
+ },
+
+ expect: function(e1, e2, e3, e4){
+ var token = this.peek(e1, e2, e3, e4);
+ if (token) {
+ this.tokens.shift();
+ return token;
+ }
+ return false;
+ },
+
+ consume: function(e1){
+ if (!this.expect(e1)) {
+ this.throwError('is unexpected, expecting [' + e1 + ']', this.peek());
+ }
+ },
+
+ unaryFn: function(fn, right) {
+ return extend(function(self, locals) {
+ return fn(self, locals, right);
+ }, {
+ constant:right.constant
+ });
+ },
+
+ ternaryFn: function(left, middle, right){
+ return extend(function(self, locals){
+ return left(self, locals) ? middle(self, locals) : right(self, locals);
+ }, {
+ constant: left.constant && middle.constant && right.constant
+ });
+ },
+
+ binaryFn: function(left, fn, right) {
+ return extend(function(self, locals) {
+ return fn(self, locals, left, right);
+ }, {
+ constant:left.constant && right.constant
+ });
+ },
+
+ statements: function() {
+ var statements = [];
+ while (true) {
+ if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']'))
+ statements.push(this.filterChain());
+ if (!this.expect(';')) {
+ // optimize for the common case where there is only one statement.
+ // TODO(size): maybe we should not support multiple statements?
+ return (statements.length === 1)
+ ? statements[0]
+ : function(self, locals) {
+ var value;
+ for (var i = 0; i < statements.length; i++) {
+ var statement = statements[i];
+ if (statement) {
+ value = statement(self, locals);
+ }
+ }
+ return value;
+ };
+ }
+ }
+ },
+
+ filterChain: function() {
+ var left = this.expression();
+ var token;
+ while (true) {
+ if ((token = this.expect('|'))) {
+ left = this.binaryFn(left, token.fn, this.filter());
+ } else {
+ return left;
+ }
+ }
+ },
+
+ filter: function() {
+ var token = this.expect();
+ var fn = this.$filter(token.text);
+ var argsFn = [];
+ while (true) {
+ if ((token = this.expect(':'))) {
+ argsFn.push(this.expression());
+ } else {
+ var fnInvoke = function(self, locals, input) {
+ var args = [input];
+ for (var i = 0; i < argsFn.length; i++) {
+ args.push(argsFn[i](self, locals));
+ }
+ return fn.apply(self, args);
+ };
+ return function() {
+ return fnInvoke;
+ };
+ }
+ }
+ },
+
+ expression: function() {
+ return this.assignment();
+ },
+
+ assignment: function() {
+ var left = this.ternary();
+ var right;
+ var token;
+ if ((token = this.expect('='))) {
+ if (!left.assign) {
+ this.throwError('implies assignment but [' +
+ this.text.substring(0, token.index) + '] can not be assigned to', token);
+ }
+ right = this.ternary();
+ return function(scope, locals) {
+ return left.assign(scope, right(scope, locals), locals);
+ };
+ }
+ return left;
+ },
+
+ ternary: function() {
+ var left = this.logicalOR();
+ var middle;
+ var token;
+ if ((token = this.expect('?'))) {
+ middle = this.assignment();
+ if ((token = this.expect(':'))) {
+ return this.ternaryFn(left, middle, this.assignment());
+ } else {
+ this.throwError('expected :', token);
+ }
+ } else {
+ return left;
+ }
+ },
+
+ logicalOR: function() {
+ var left = this.logicalAND();
+ var token;
+ while (true) {
+ if ((token = this.expect('||'))) {
+ left = this.binaryFn(left, token.fn, this.logicalAND());
+ } else {
+ return left;
+ }
+ }
+ },
+
+ logicalAND: function() {
+ var left = this.equality();
+ var token;
+ if ((token = this.expect('&&'))) {
+ left = this.binaryFn(left, token.fn, this.logicalAND());
+ }
+ return left;
+ },
+
+ equality: function() {
+ var left = this.relational();
+ var token;
+ if ((token = this.expect('==','!=','===','!=='))) {
+ left = this.binaryFn(left, token.fn, this.equality());
+ }
+ return left;
+ },
+
+ relational: function() {
+ var left = this.additive();
+ var token;
+ if ((token = this.expect('<', '>', '<=', '>='))) {
+ left = this.binaryFn(left, token.fn, this.relational());
+ }
+ return left;
+ },
+
+ additive: function() {
+ var left = this.multiplicative();
+ var token;
+ while ((token = this.expect('+','-'))) {
+ left = this.binaryFn(left, token.fn, this.multiplicative());
+ }
+ return left;
+ },
+
+ multiplicative: function() {
+ var left = this.unary();
+ var token;
+ while ((token = this.expect('*','/','%'))) {
+ left = this.binaryFn(left, token.fn, this.unary());
+ }
+ return left;
+ },
+
+ unary: function() {
+ var token;
+ if (this.expect('+')) {
+ return this.primary();
+ } else if ((token = this.expect('-'))) {
+ return this.binaryFn(Parser.ZERO, token.fn, this.unary());
+ } else if ((token = this.expect('!'))) {
+ return this.unaryFn(token.fn, this.unary());
+ } else {
+ return this.primary();
+ }
+ },
+
+ fieldAccess: function(object) {
+ var parser = this;
+ var field = this.expect().text;
+ var getter = getterFn(field, this.options, this.text);
+
+ return extend(function(scope, locals, self) {
+ return getter(self || object(scope, locals));
+ }, {
+ assign: function(scope, value, locals) {
+ var o = object(scope, locals);
+ if (!o) object.assign(scope, o = {});
+ return setter(o, field, value, parser.text, parser.options);
+ }
+ });
+ },
+
+ objectIndex: function(obj) {
+ var parser = this;
+
+ var indexFn = this.expression();
+ this.consume(']');
+
+ return extend(function(self, locals) {
+ var o = obj(self, locals),
+ i = indexFn(self, locals),
+ v, p;
+
+ ensureSafeMemberName(i, parser.text);
+ if (!o) return undefined;
+ v = ensureSafeObject(o[i], parser.text);
+ if (v && v.then && parser.options.unwrapPromises) {
+ p = v;
+ if (!('$$v' in v)) {
+ p.$$v = undefined;
+ p.then(function(val) { p.$$v = val; });
+ }
+ v = v.$$v;
+ }
+ return v;
+ }, {
+ assign: function(self, value, locals) {
+ var key = ensureSafeMemberName(indexFn(self, locals), parser.text);
+ // prevent overwriting of Function.constructor which would break ensureSafeObject check
+ var o = ensureSafeObject(obj(self, locals), parser.text);
+ if (!o) obj.assign(self, o = {});
+ return o[key] = value;
+ }
+ });
+ },
+
+ functionCall: function(fn, contextGetter) {
+ var argsFn = [];
+ if (this.peekToken().text !== ')') {
+ do {
+ argsFn.push(this.expression());
+ } while (this.expect(','));
+ }
+ this.consume(')');
+
+ var parser = this;
+
+ return function(scope, locals) {
+ var args = [];
+ var context = contextGetter ? contextGetter(scope, locals) : scope;
+
+ for (var i = 0; i < argsFn.length; i++) {
+ args.push(ensureSafeObject(argsFn[i](scope, locals), parser.text));
+ }
+ var fnPtr = fn(scope, locals, context) || noop;
+
+ ensureSafeObject(context, parser.text);
+ ensureSafeFunction(fnPtr, parser.text);
+
+ // IE stupidity! (IE doesn't have apply for some native functions)
+ var v = fnPtr.apply
+ ? fnPtr.apply(context, args)
+ : fnPtr(args[0], args[1], args[2], args[3], args[4]);
+
+ return ensureSafeObject(v, parser.text);
+ };
+ },
+
+ // This is used with json array declaration
+ arrayDeclaration: function () {
+ var elementFns = [];
+ var allConstant = true;
+ if (this.peekToken().text !== ']') {
+ do {
+ if (this.peek(']')) {
+ // Support trailing commas per ES5.1.
+ break;
+ }
+ var elementFn = this.expression();
+ elementFns.push(elementFn);
+ if (!elementFn.constant) {
+ allConstant = false;
+ }
+ } while (this.expect(','));
+ }
+ this.consume(']');
+
+ return extend(function(self, locals) {
+ var array = [];
+ for (var i = 0; i < elementFns.length; i++) {
+ array.push(elementFns[i](self, locals));
+ }
+ return array;
+ }, {
+ literal: true,
+ constant: allConstant
+ });
+ },
+
+ object: function () {
+ var keyValues = [];
+ var allConstant = true;
+ if (this.peekToken().text !== '}') {
+ do {
+ if (this.peek('}')) {
+ // Support trailing commas per ES5.1.
+ break;
+ }
+ var token = this.expect(),
+ key = token.string || token.text;
+ this.consume(':');
+ var value = this.expression();
+ keyValues.push({key: key, value: value});
+ if (!value.constant) {
+ allConstant = false;
+ }
+ } while (this.expect(','));
+ }
+ this.consume('}');
+
+ return extend(function(self, locals) {
+ var object = {};
+ for (var i = 0; i < keyValues.length; i++) {
+ var keyValue = keyValues[i];
+ object[keyValue.key] = keyValue.value(self, locals);
+ }
+ return object;
+ }, {
+ literal: true,
+ constant: allConstant
+ });
+ }
+};
+
+
+//////////////////////////////////////////////////
+// Parser helper functions
+//////////////////////////////////////////////////
+
+function setter(obj, path, setValue, fullExp, options) {
+ ensureSafeObject(obj, fullExp);
+
+ //needed?
+ options = options || {};
+
+ var element = path.split('.'), key;
+ for (var i = 0; element.length > 1; i++) {
+ key = ensureSafeMemberName(element.shift(), fullExp);
+ var propertyObj = ensureSafeObject(obj[key], fullExp);
+ if (!propertyObj) {
+ propertyObj = {};
+ obj[key] = propertyObj;
+ }
+ obj = propertyObj;
+ if (obj.then && options.unwrapPromises) {
+ promiseWarning(fullExp);
+ if (!("$$v" in obj)) {
+ (function(promise) {
+ promise.then(function(val) { promise.$$v = val; }); }
+ )(obj);
+ }
+ if (obj.$$v === undefined) {
+ obj.$$v = {};
+ }
+ obj = obj.$$v;
+ }
+ }
+ key = ensureSafeMemberName(element.shift(), fullExp);
+ ensureSafeObject(obj[key], fullExp);
+ obj[key] = setValue;
+ return setValue;
+}
+
+var getterFnCache = {};
+
+/**
+ * Implementation of the "Black Hole" variant from:
+ * - http://jsperf.com/angularjs-parse-getter/4
+ * - http://jsperf.com/path-evaluation-simplified/7
+ */
+function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
+ ensureSafeMemberName(key0, fullExp);
+ ensureSafeMemberName(key1, fullExp);
+ ensureSafeMemberName(key2, fullExp);
+ ensureSafeMemberName(key3, fullExp);
+ ensureSafeMemberName(key4, fullExp);
+
+ return !options.unwrapPromises
+ ? function cspSafeGetter(scope, locals) {
+ var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope;
+
+ if (pathVal == null) return pathVal;
+ pathVal = pathVal[key0];
+
+ if (!key1) return pathVal;
+ if (pathVal == null) return undefined;
+ pathVal = pathVal[key1];
+
+ if (!key2) return pathVal;
+ if (pathVal == null) return undefined;
+ pathVal = pathVal[key2];
+
+ if (!key3) return pathVal;
+ if (pathVal == null) return undefined;
+ pathVal = pathVal[key3];
+
+ if (!key4) return pathVal;
+ if (pathVal == null) return undefined;
+ pathVal = pathVal[key4];
+
+ return pathVal;
+ }
+ : function cspSafePromiseEnabledGetter(scope, locals) {
+ var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope,
+ promise;
+
+ if (pathVal == null) return pathVal;
+
+ pathVal = pathVal[key0];
+ if (pathVal && pathVal.then) {
+ promiseWarning(fullExp);
+ if (!("$$v" in pathVal)) {
+ promise = pathVal;
+ promise.$$v = undefined;
+ promise.then(function(val) { promise.$$v = val; });
+ }
+ pathVal = pathVal.$$v;
+ }
+
+ if (!key1) return pathVal;
+ if (pathVal == null) return undefined;
+ pathVal = pathVal[key1];
+ if (pathVal && pathVal.then) {
+ promiseWarning(fullExp);
+ if (!("$$v" in pathVal)) {
+ promise = pathVal;
+ promise.$$v = undefined;
+ promise.then(function(val) { promise.$$v = val; });
+ }
+ pathVal = pathVal.$$v;
+ }
+
+ if (!key2) return pathVal;
+ if (pathVal == null) return undefined;
+ pathVal = pathVal[key2];
+ if (pathVal && pathVal.then) {
+ promiseWarning(fullExp);
+ if (!("$$v" in pathVal)) {
+ promise = pathVal;
+ promise.$$v = undefined;
+ promise.then(function(val) { promise.$$v = val; });
+ }
+ pathVal = pathVal.$$v;
+ }
+
+ if (!key3) return pathVal;
+ if (pathVal == null) return undefined;
+ pathVal = pathVal[key3];
+ if (pathVal && pathVal.then) {
+ promiseWarning(fullExp);
+ if (!("$$v" in pathVal)) {
+ promise = pathVal;
+ promise.$$v = undefined;
+ promise.then(function(val) { promise.$$v = val; });
+ }
+ pathVal = pathVal.$$v;
+ }
+
+ if (!key4) return pathVal;
+ if (pathVal == null) return undefined;
+ pathVal = pathVal[key4];
+ if (pathVal && pathVal.then) {
+ promiseWarning(fullExp);
+ if (!("$$v" in pathVal)) {
+ promise = pathVal;
+ promise.$$v = undefined;
+ promise.then(function(val) { promise.$$v = val; });
+ }
+ pathVal = pathVal.$$v;
+ }
+ return pathVal;
+ };
+}
+
+function getterFn(path, options, fullExp) {
+ // Check whether the cache has this getter already.
+ // We can use hasOwnProperty directly on the cache because we ensure,
+ // see below, that the cache never stores a path called 'hasOwnProperty'
+ if (getterFnCache.hasOwnProperty(path)) {
+ return getterFnCache[path];
+ }
+
+ var pathKeys = path.split('.'),
+ pathKeysLength = pathKeys.length,
+ fn;
+
+ // http://jsperf.com/angularjs-parse-getter/6
+ if (options.csp) {
+ if (pathKeysLength < 6) {
+ fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp,
+ options);
+ } else {
+ fn = function(scope, locals) {
+ var i = 0, val;
+ do {
+ val = cspSafeGetterFn(pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++],
+ pathKeys[i++], fullExp, options)(scope, locals);
+
+ locals = undefined; // clear after first iteration
+ scope = val;
+ } while (i < pathKeysLength);
+ return val;
+ };
+ }
+ } else {
+ var code = 'var p;\n';
+ forEach(pathKeys, function(key, index) {
+ ensureSafeMemberName(key, fullExp);
+ code += 'if(s == null) return undefined;\n' +
+ 's='+ (index
+ // we simply dereference 's' on any .dot notation
+ ? 's'
+ // but if we are first then we check locals first, and if so read it first
+ : '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"]' + ';\n' +
+ (options.unwrapPromises
+ ? 'if (s && s.then) {\n' +
+ ' pw("' + fullExp.replace(/(["\r\n])/g, '\\$1') + '");\n' +
+ ' if (!("$$v" in s)) {\n' +
+ ' p=s;\n' +
+ ' p.$$v = undefined;\n' +
+ ' p.then(function(v) {p.$$v=v;});\n' +
+ '}\n' +
+ ' s=s.$$v\n' +
+ '}\n'
+ : '');
+ });
+ code += 'return s;';
+
+ /* jshint -W054 */
+ var evaledFnGetter = new Function('s', 'k', 'pw', code); // s=scope, k=locals, pw=promiseWarning
+ /* jshint +W054 */
+ evaledFnGetter.toString = valueFn(code);
+ fn = options.unwrapPromises ? function(scope, locals) {
+ return evaledFnGetter(scope, locals, promiseWarning);
+ } : evaledFnGetter;
+ }
+
+ // Only cache the value if it's not going to mess up the cache object
+ // This is more performant that using Object.prototype.hasOwnProperty.call
+ if (path !== 'hasOwnProperty') {
+ getterFnCache[path] = fn;
+ }
+ return fn;
+}
+
+///////////////////////////////////
+
+/**
+ * @ngdoc service
+ * @name $parse
+ * @kind function
+ *
+ * @description
+ *
+ * Converts Angular {@link guide/expression expression} into a function.
+ *
+ * ```js
+ * var getter = $parse('user.name');
+ * var setter = getter.assign;
+ * var context = {user:{name:'angular'}};
+ * var locals = {user:{name:'local'}};
+ *
+ * expect(getter(context)).toEqual('angular');
+ * setter(context, 'newValue');
+ * expect(context.user.name).toEqual('newValue');
+ * expect(getter(context, locals)).toEqual('local');
+ * ```
+ *
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ *
+ * The returned function also has the following properties:
+ * * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript
+ * literal.
+ * * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript
+ * constant literals.
+ * * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be
+ * set to a function to change its value on the given context.
+ *
+ */
+
+
+/**
+ * @ngdoc provider
+ * @name $parseProvider
+ * @kind function
+ *
+ * @description
+ * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}
+ * service.
+ */
+function $ParseProvider() {
+ var cache = {};
+
+ var $parseOptions = {
+ csp: false,
+ unwrapPromises: false,
+ logPromiseWarnings: true
+ };
+
+
+ /**
+ * @deprecated Promise unwrapping via $parse is deprecated and will be removed in the future.
+ *
+ * @ngdoc method
+ * @name $parseProvider#unwrapPromises
+ * @description
+ *
+ * **This feature is deprecated, see deprecation notes below for more info**
+ *
+ * If set to true (default is false), $parse will unwrap promises automatically when a promise is
+ * found at any part of the expression. In other words, if set to true, the expression will always
+ * result in a non-promise value.
+ *
+ * While the promise is unresolved, it's treated as undefined, but once resolved and fulfilled,
+ * the fulfillment value is used in place of the promise while evaluating the expression.
+ *
+ * **Deprecation notice**
+ *
+ * This is a feature that didn't prove to be wildly useful or popular, primarily because of the
+ * dichotomy between data access in templates (accessed as raw values) and controller code
+ * (accessed as promises).
+ *
+ * In most code we ended up resolving promises manually in controllers anyway and thus unifying
+ * the model access there.
+ *
+ * Other downsides of automatic promise unwrapping:
+ *
+ * - when building components it's often desirable to receive the raw promises
+ * - adds complexity and slows down expression evaluation
+ * - makes expression code pre-generation unattractive due to the amount of code that needs to be
+ * generated
+ * - makes IDE auto-completion and tool support hard
+ *
+ * **Warning Logs**
+ *
+ * If the unwrapping is enabled, Angular will log a warning about each expression that unwraps a
+ * promise (to reduce the noise, each expression is logged only once). To disable this logging use
+ * `$parseProvider.logPromiseWarnings(false)` api.
+ *
+ *
+ * @param {boolean=} value New value.
+ * @returns {boolean|self} Returns the current setting when used as getter and self if used as
+ * setter.
+ */
+ this.unwrapPromises = function(value) {
+ if (isDefined(value)) {
+ $parseOptions.unwrapPromises = !!value;
+ return this;
+ } else {
+ return $parseOptions.unwrapPromises;
+ }
+ };
+
+
+ /**
+ * @deprecated Promise unwrapping via $parse is deprecated and will be removed in the future.
+ *
+ * @ngdoc method
+ * @name $parseProvider#logPromiseWarnings
+ * @description
+ *
+ * Controls whether Angular should log a warning on any encounter of a promise in an expression.
+ *
+ * The default is set to `true`.
+ *
+ * This setting applies only if `$parseProvider.unwrapPromises` setting is set to true as well.
+ *
+ * @param {boolean=} value New value.
+ * @returns {boolean|self} Returns the current setting when used as getter and self if used as
+ * setter.
+ */
+ this.logPromiseWarnings = function(value) {
+ if (isDefined(value)) {
+ $parseOptions.logPromiseWarnings = value;
+ return this;
+ } else {
+ return $parseOptions.logPromiseWarnings;
+ }
+ };
+
+
+ this.$get = ['$filter', '$sniffer', '$log', function($filter, $sniffer, $log) {
+ $parseOptions.csp = $sniffer.csp;
+
+ promiseWarning = function promiseWarningFn(fullExp) {
+ if (!$parseOptions.logPromiseWarnings || promiseWarningCache.hasOwnProperty(fullExp)) return;
+ promiseWarningCache[fullExp] = true;
+ $log.warn('[$parse] Promise found in the expression `' + fullExp + '`. ' +
+ 'Automatic unwrapping of promises in Angular expressions is deprecated.');
+ };
+
+ return function(exp) {
+ var parsedExpression;
+
+ switch (typeof exp) {
+ case 'string':
+
+ if (cache.hasOwnProperty(exp)) {
+ return cache[exp];
+ }
+
+ var lexer = new Lexer($parseOptions);
+ var parser = new Parser(lexer, $filter, $parseOptions);
+ parsedExpression = parser.parse(exp);
+
+ if (exp !== 'hasOwnProperty') {
+ // Only cache the value if it's not going to mess up the cache object
+ // This is more performant that using Object.prototype.hasOwnProperty.call
+ cache[exp] = parsedExpression;
+ }
+
+ return parsedExpression;
+
+ case 'function':
+ return exp;
+
+ default:
+ return noop;
+ }
+ };
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $q
+ * @requires $rootScope
+ *
+ * @description
+ * A promise/deferred implementation inspired by [Kris Kowal's Q](https://github.com/kriskowal/q).
+ *
+ * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an
+ * interface for interacting with an object that represents the result of an action that is
+ * performed asynchronously, and may or may not be finished at any given point in time.
+ *
+ * From the perspective of dealing with error handling, deferred and promise APIs are to
+ * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.
+ *
+ * ```js
+ * // for the purpose of this example let's assume that variables `$q`, `scope` and `okToGreet`
+ * // are available in the current lexical scope (they could have been injected or passed in).
+ *
+ * function asyncGreet(name) {
+ * var deferred = $q.defer();
+ *
+ * setTimeout(function() {
+ * deferred.notify('About to greet ' + name + '.');
+ *
+ * if (okToGreet(name)) {
+ * deferred.resolve('Hello, ' + name + '!');
+ * } else {
+ * deferred.reject('Greeting ' + name + ' is not allowed.');
+ * }
+ * }, 1000);
+ *
+ * return deferred.promise;
+ * }
+ *
+ * var promise = asyncGreet('Robin Hood');
+ * promise.then(function(greeting) {
+ * alert('Success: ' + greeting);
+ * }, function(reason) {
+ * alert('Failed: ' + reason);
+ * }, function(update) {
+ * alert('Got notification: ' + update);
+ * });
+ * ```
+ *
+ * At first it might not be obvious why this extra complexity is worth the trouble. The payoff
+ * comes in the way of guarantees that promise and deferred APIs make, see
+ * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md.
+ *
+ * Additionally the promise api allows for composition that is very hard to do with the
+ * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.
+ * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the
+ * section on serial or parallel joining of promises.
+ *
+ *
+ * # The Deferred API
+ *
+ * A new instance of deferred is constructed by calling `$q.defer()`.
+ *
+ * The purpose of the deferred object is to expose the associated Promise instance as well as APIs
+ * that can be used for signaling the successful or unsuccessful completion, as well as the status
+ * of the task.
+ *
+ * **Methods**
+ *
+ * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection
+ * constructed via `$q.reject`, the promise will be rejected instead.
+ * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to
+ * resolving it with a rejection constructed via `$q.reject`.
+ * - `notify(value)` - provides updates on the status of the promise's execution. This may be called
+ * multiple times before the promise is either resolved or rejected.
+ *
+ * **Properties**
+ *
+ * - promise – `{Promise}` – promise object associated with this deferred.
+ *
+ *
+ * # The Promise API
+ *
+ * A new promise instance is created when a deferred instance is created and can be retrieved by
+ * calling `deferred.promise`.
+ *
+ * The purpose of the promise object is to allow for interested parties to get access to the result
+ * of the deferred task when it completes.
+ *
+ * **Methods**
+ *
+ * - `then(successCallback, errorCallback, notifyCallback)` – regardless of when the promise was or
+ * will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously
+ * as soon as the result is available. The callbacks are called with a single argument: the result
+ * or rejection reason. Additionally, the notify callback may be called zero or more times to
+ * provide a progress indication, before the promise is resolved or rejected.
+ *
+ * This method *returns a new promise* which is resolved or rejected via the return value of the
+ * `successCallback`, `errorCallback`. It also notifies via the return value of the
+ * `notifyCallback` method. The promise can not be resolved or rejected from the notifyCallback
+ * method.
+ *
+ * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`
+ *
+ * - `finally(callback)` – allows you to observe either the fulfillment or rejection of a promise,
+ * but to do so without modifying the final value. This is useful to release resources or do some
+ * clean-up that needs to be done whether the promise was rejected or resolved. See the [full
+ * specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for
+ * more information.
+ *
+ * Because `finally` is a reserved word in JavaScript and reserved keywords are not supported as
+ * property names by ES3, you'll need to invoke the method like `promise['finally'](callback)` to
+ * make your code IE8 and Android 2.x compatible.
+ *
+ * # Chaining promises
+ *
+ * Because calling the `then` method of a promise returns a new derived promise, it is easily
+ * possible to create a chain of promises:
+ *
+ * ```js
+ * promiseB = promiseA.then(function(result) {
+ * return result + 1;
+ * });
+ *
+ * // promiseB will be resolved immediately after promiseA is resolved and its value
+ * // will be the result of promiseA incremented by 1
+ * ```
+ *
+ * It is possible to create chains of any length and since a promise can be resolved with another
+ * promise (which will defer its resolution further), it is possible to pause/defer resolution of
+ * the promises at any point in the chain. This makes it possible to implement powerful APIs like
+ * $http's response interceptors.
+ *
+ *
+ * # Differences between Kris Kowal's Q and $q
+ *
+ * There are two main differences:
+ *
+ * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation
+ * mechanism in angular, which means faster propagation of resolution or rejection into your
+ * models and avoiding unnecessary browser repaints, which would result in flickering UI.
+ * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains
+ * all the important functionality needed for common async tasks.
+ *
+ * # Testing
+ *
+ * ```js
+ * it('should simulate promise', inject(function($q, $rootScope) {
+ * var deferred = $q.defer();
+ * var promise = deferred.promise;
+ * var resolvedValue;
+ *
+ * promise.then(function(value) { resolvedValue = value; });
+ * expect(resolvedValue).toBeUndefined();
+ *
+ * // Simulate resolving of promise
+ * deferred.resolve(123);
+ * // Note that the 'then' function does not get called synchronously.
+ * // This is because we want the promise API to always be async, whether or not
+ * // it got called synchronously or asynchronously.
+ * expect(resolvedValue).toBeUndefined();
+ *
+ * // Propagate promise resolution to 'then' functions using $apply().
+ * $rootScope.$apply();
+ * expect(resolvedValue).toEqual(123);
+ * }));
+ * ```
+ */
+function $QProvider() {
+
+ this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {
+ return qFactory(function(callback) {
+ $rootScope.$evalAsync(callback);
+ }, $exceptionHandler);
+ }];
+}
+
+
+/**
+ * Constructs a promise manager.
+ *
+ * @param {function(Function)} nextTick Function for executing functions in the next turn.
+ * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for
+ * debugging purposes.
+ * @returns {object} Promise manager.
+ */
+function qFactory(nextTick, exceptionHandler) {
+
+ /**
+ * @ngdoc method
+ * @name $q#defer
+ * @kind function
+ *
+ * @description
+ * Creates a `Deferred` object which represents a task which will finish in the future.
+ *
+ * @returns {Deferred} Returns a new instance of deferred.
+ */
+ var defer = function() {
+ var pending = [],
+ value, deferred;
+
+ deferred = {
+
+ resolve: function(val) {
+ if (pending) {
+ var callbacks = pending;
+ pending = undefined;
+ value = ref(val);
+
+ if (callbacks.length) {
+ nextTick(function() {
+ var callback;
+ for (var i = 0, ii = callbacks.length; i < ii; i++) {
+ callback = callbacks[i];
+ value.then(callback[0], callback[1], callback[2]);
+ }
+ });
+ }
+ }
+ },
+
+
+ reject: function(reason) {
+ deferred.resolve(createInternalRejectedPromise(reason));
+ },
+
+
+ notify: function(progress) {
+ if (pending) {
+ var callbacks = pending;
+
+ if (pending.length) {
+ nextTick(function() {
+ var callback;
+ for (var i = 0, ii = callbacks.length; i < ii; i++) {
+ callback = callbacks[i];
+ callback[2](progress);
+ }
+ });
+ }
+ }
+ },
+
+
+ promise: {
+ then: function(callback, errback, progressback) {
+ var result = defer();
+
+ var wrappedCallback = function(value) {
+ try {
+ result.resolve((isFunction(callback) ? callback : defaultCallback)(value));
+ } catch(e) {
+ result.reject(e);
+ exceptionHandler(e);
+ }
+ };
+
+ var wrappedErrback = function(reason) {
+ try {
+ result.resolve((isFunction(errback) ? errback : defaultErrback)(reason));
+ } catch(e) {
+ result.reject(e);
+ exceptionHandler(e);
+ }
+ };
+
+ var wrappedProgressback = function(progress) {
+ try {
+ result.notify((isFunction(progressback) ? progressback : defaultCallback)(progress));
+ } catch(e) {
+ exceptionHandler(e);
+ }
+ };
+
+ if (pending) {
+ pending.push([wrappedCallback, wrappedErrback, wrappedProgressback]);
+ } else {
+ value.then(wrappedCallback, wrappedErrback, wrappedProgressback);
+ }
+
+ return result.promise;
+ },
+
+ "catch": function(callback) {
+ return this.then(null, callback);
+ },
+
+ "finally": function(callback) {
+
+ function makePromise(value, resolved) {
+ var result = defer();
+ if (resolved) {
+ result.resolve(value);
+ } else {
+ result.reject(value);
+ }
+ return result.promise;
+ }
+
+ function handleCallback(value, isResolved) {
+ var callbackOutput = null;
+ try {
+ callbackOutput = (callback ||defaultCallback)();
+ } catch(e) {
+ return makePromise(e, false);
+ }
+ if (isPromiseLike(callbackOutput)) {
+ return callbackOutput.then(function() {
+ return makePromise(value, isResolved);
+ }, function(error) {
+ return makePromise(error, false);
+ });
+ } else {
+ return makePromise(value, isResolved);
+ }
+ }
+
+ return this.then(function(value) {
+ return handleCallback(value, true);
+ }, function(error) {
+ return handleCallback(error, false);
+ });
+ }
+ }
+ };
+
+ return deferred;
+ };
+
+
+ var ref = function(value) {
+ if (isPromiseLike(value)) return value;
+ return {
+ then: function(callback) {
+ var result = defer();
+ nextTick(function() {
+ result.resolve(callback(value));
+ });
+ return result.promise;
+ }
+ };
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $q#reject
+ * @kind function
+ *
+ * @description
+ * Creates a promise that is resolved as rejected with the specified `reason`. This api should be
+ * used to forward rejection in a chain of promises. If you are dealing with the last promise in
+ * a promise chain, you don't need to worry about it.
+ *
+ * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of
+ * `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via
+ * a promise error callback and you want to forward the error to the promise derived from the
+ * current promise, you have to "rethrow" the error by returning a rejection constructed via
+ * `reject`.
+ *
+ * ```js
+ * promiseB = promiseA.then(function(result) {
+ * // success: do something and resolve promiseB
+ * // with the old or a new result
+ * return result;
+ * }, function(reason) {
+ * // error: handle the error if possible and
+ * // resolve promiseB with newPromiseOrValue,
+ * // otherwise forward the rejection to promiseB
+ * if (canHandle(reason)) {
+ * // handle the error and recover
+ * return newPromiseOrValue;
+ * }
+ * return $q.reject(reason);
+ * });
+ * ```
+ *
+ * @param {*} reason Constant, message, exception or an object representing the rejection reason.
+ * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.
+ */
+ var reject = function(reason) {
+ var result = defer();
+ result.reject(reason);
+ return result.promise;
+ };
+
+ var createInternalRejectedPromise = function(reason) {
+ return {
+ then: function(callback, errback) {
+ var result = defer();
+ nextTick(function() {
+ try {
+ result.resolve((isFunction(errback) ? errback : defaultErrback)(reason));
+ } catch(e) {
+ result.reject(e);
+ exceptionHandler(e);
+ }
+ });
+ return result.promise;
+ }
+ };
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $q#when
+ * @kind function
+ *
+ * @description
+ * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.
+ * This is useful when you are dealing with an object that might or might not be a promise, or if
+ * the promise comes from a source that can't be trusted.
+ *
+ * @param {*} value Value or a promise
+ * @returns {Promise} Returns a promise of the passed value or promise
+ */
+ var when = function(value, callback, errback, progressback) {
+ var result = defer(),
+ done;
+
+ var wrappedCallback = function(value) {
+ try {
+ return (isFunction(callback) ? callback : defaultCallback)(value);
+ } catch (e) {
+ exceptionHandler(e);
+ return reject(e);
+ }
+ };
+
+ var wrappedErrback = function(reason) {
+ try {
+ return (isFunction(errback) ? errback : defaultErrback)(reason);
+ } catch (e) {
+ exceptionHandler(e);
+ return reject(e);
+ }
+ };
+
+ var wrappedProgressback = function(progress) {
+ try {
+ return (isFunction(progressback) ? progressback : defaultCallback)(progress);
+ } catch (e) {
+ exceptionHandler(e);
+ }
+ };
+
+ nextTick(function() {
+ ref(value).then(function(value) {
+ if (done) return;
+ done = true;
+ result.resolve(ref(value).then(wrappedCallback, wrappedErrback, wrappedProgressback));
+ }, function(reason) {
+ if (done) return;
+ done = true;
+ result.resolve(wrappedErrback(reason));
+ }, function(progress) {
+ if (done) return;
+ result.notify(wrappedProgressback(progress));
+ });
+ });
+
+ return result.promise;
+ };
+
+
+ function defaultCallback(value) {
+ return value;
+ }
+
+
+ function defaultErrback(reason) {
+ return reject(reason);
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $q#all
+ * @kind function
+ *
+ * @description
+ * Combines multiple promises into a single promise that is resolved when all of the input
+ * promises are resolved.
+ *
+ * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.
+ * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values,
+ * each value corresponding to the promise at the same index/key in the `promises` array/hash.
+ * If any of the promises is resolved with a rejection, this resulting promise will be rejected
+ * with the same rejection value.
+ */
+ function all(promises) {
+ var deferred = defer(),
+ counter = 0,
+ results = isArray(promises) ? [] : {};
+
+ forEach(promises, function(promise, key) {
+ counter++;
+ ref(promise).then(function(value) {
+ if (results.hasOwnProperty(key)) return;
+ results[key] = value;
+ if (!(--counter)) deferred.resolve(results);
+ }, function(reason) {
+ if (results.hasOwnProperty(key)) return;
+ deferred.reject(reason);
+ });
+ });
+
+ if (counter === 0) {
+ deferred.resolve(results);
+ }
+
+ return deferred.promise;
+ }
+
+ return {
+ defer: defer,
+ reject: reject,
+ when: when,
+ all: all
+ };
+}
+
+function $$RAFProvider(){ //rAF
+ this.$get = ['$window', '$timeout', function($window, $timeout) {
+ var requestAnimationFrame = $window.requestAnimationFrame ||
+ $window.webkitRequestAnimationFrame ||
+ $window.mozRequestAnimationFrame;
+
+ var cancelAnimationFrame = $window.cancelAnimationFrame ||
+ $window.webkitCancelAnimationFrame ||
+ $window.mozCancelAnimationFrame ||
+ $window.webkitCancelRequestAnimationFrame;
+
+ var rafSupported = !!requestAnimationFrame;
+ var raf = rafSupported
+ ? function(fn) {
+ var id = requestAnimationFrame(fn);
+ return function() {
+ cancelAnimationFrame(id);
+ };
+ }
+ : function(fn) {
+ var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666
+ return function() {
+ $timeout.cancel(timer);
+ };
+ };
+
+ raf.supported = rafSupported;
+
+ return raf;
+ }];
+}
+
+/**
+ * DESIGN NOTES
+ *
+ * The design decisions behind the scope are heavily favored for speed and memory consumption.
+ *
+ * The typical use of scope is to watch the expressions, which most of the time return the same
+ * value as last time so we optimize the operation.
+ *
+ * Closures construction is expensive in terms of speed as well as memory:
+ * - No closures, instead use prototypical inheritance for API
+ * - Internal state needs to be stored on scope directly, which means that private state is
+ * exposed as $$____ properties
+ *
+ * Loop operations are optimized by using while(count--) { ... }
+ * - this means that in order to keep the same order of execution as addition we have to add
+ * items to the array at the beginning (unshift) instead of at the end (push)
+ *
+ * Child scopes are created and removed often
+ * - Using an array would be slow since inserts in middle are expensive so we use linked list
+ *
+ * There are few watches then a lot of observers. This is why you don't want the observer to be
+ * implemented in the same way as watch. Watch requires return of initialization function which
+ * are expensive to construct.
+ */
+
+
+/**
+ * @ngdoc provider
+ * @name $rootScopeProvider
+ * @description
+ *
+ * Provider for the $rootScope service.
+ */
+
+/**
+ * @ngdoc method
+ * @name $rootScopeProvider#digestTtl
+ * @description
+ *
+ * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and
+ * assuming that the model is unstable.
+ *
+ * The current default is 10 iterations.
+ *
+ * In complex applications it's possible that the dependencies between `$watch`s will result in
+ * several digest iterations. However if an application needs more than the default 10 digest
+ * iterations for its model to stabilize then you should investigate what is causing the model to
+ * continuously change during the digest.
+ *
+ * Increasing the TTL could have performance implications, so you should not change it without
+ * proper justification.
+ *
+ * @param {number} limit The number of digest iterations.
+ */
+
+
+/**
+ * @ngdoc service
+ * @name $rootScope
+ * @description
+ *
+ * Every application has a single root {@link ng.$rootScope.Scope scope}.
+ * All other scopes are descendant scopes of the root scope. Scopes provide separation
+ * between the model and the view, via a mechanism for watching the model for changes.
+ * They also provide an event emission/broadcast and subscription facility. See the
+ * {@link guide/scope developer guide on scopes}.
+ */
+function $RootScopeProvider(){
+ var TTL = 10;
+ var $rootScopeMinErr = minErr('$rootScope');
+ var lastDirtyWatch = null;
+
+ this.digestTtl = function(value) {
+ if (arguments.length) {
+ TTL = value;
+ }
+ return TTL;
+ };
+
+ this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser',
+ function( $injector, $exceptionHandler, $parse, $browser) {
+
+ /**
+ * @ngdoc type
+ * @name $rootScope.Scope
+ *
+ * @description
+ * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the
+ * {@link auto.$injector $injector}. Child scopes are created using the
+ * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
+ * compiled HTML template is executed.)
+ *
+ * Here is a simple scope snippet to show how you can interact with the scope.
+ * ```html
+ * <file src="./test/ng/rootScopeSpec.js" tag="docs1" />
+ * ```
+ *
+ * # Inheritance
+ * A scope can inherit from a parent scope, as in this example:
+ * ```js
+ var parent = $rootScope;
+ var child = parent.$new();
+
+ parent.salutation = "Hello";
+ child.name = "World";
+ expect(child.salutation).toEqual('Hello');
+
+ child.salutation = "Welcome";
+ expect(child.salutation).toEqual('Welcome');
+ expect(parent.salutation).toEqual('Hello');
+ * ```
+ *
+ *
+ * @param {Object.<string, function()>=} providers Map of service factory which need to be
+ * provided for the current scope. Defaults to {@link ng}.
+ * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should
+ * append/override services provided by `providers`. This is handy
+ * when unit-testing and having the need to override a default
+ * service.
+ * @returns {Object} Newly created scope.
+ *
+ */
+ function Scope() {
+ this.$id = nextUid();
+ this.$$phase = this.$parent = this.$$watchers =
+ this.$$nextSibling = this.$$prevSibling =
+ this.$$childHead = this.$$childTail = null;
+ this['this'] = this.$root = this;
+ this.$$destroyed = false;
+ this.$$asyncQueue = [];
+ this.$$postDigestQueue = [];
+ this.$$listeners = {};
+ this.$$listenerCount = {};
+ this.$$isolateBindings = {};
+ }
+
+ /**
+ * @ngdoc property
+ * @name $rootScope.Scope#$id
+ *
+ * @description
+ * Unique scope ID (monotonically increasing) useful for debugging.
+ */
+
+ /**
+ * @ngdoc property
+ * @name $rootScope.Scope#$parent
+ *
+ * @description
+ * Reference to the parent scope.
+ */
+
+ /**
+ * @ngdoc property
+ * @name $rootScope.Scope#$root
+ *
+ * @description
+ * Reference to the root scope.
+ */
+
+ Scope.prototype = {
+ constructor: Scope,
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$new
+ * @kind function
+ *
+ * @description
+ * Creates a new child {@link ng.$rootScope.Scope scope}.
+ *
+ * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event.
+ * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.
+ *
+ * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is
+ * desired for the scope and its child scopes to be permanently detached from the parent and
+ * thus stop participating in model change detection and listener notification by invoking.
+ *
+ * @param {boolean} isolate If true, then the scope does not prototypically inherit from the
+ * parent scope. The scope is isolated, as it can not see parent scope properties.
+ * When creating widgets, it is useful for the widget to not accidentally read parent
+ * state.
+ *
+ * @returns {Object} The newly created child scope.
+ *
+ */
+ $new: function(isolate) {
+ var ChildScope,
+ child;
+
+ if (isolate) {
+ child = new Scope();
+ child.$root = this.$root;
+ // ensure that there is just one async queue per $rootScope and its children
+ child.$$asyncQueue = this.$$asyncQueue;
+ child.$$postDigestQueue = this.$$postDigestQueue;
+ } else {
+ // Only create a child scope class if somebody asks for one,
+ // but cache it to allow the VM to optimize lookups.
+ if (!this.$$childScopeClass) {
+ this.$$childScopeClass = function() {
+ this.$$watchers = this.$$nextSibling =
+ this.$$childHead = this.$$childTail = null;
+ this.$$listeners = {};
+ this.$$listenerCount = {};
+ this.$id = nextUid();
+ this.$$childScopeClass = null;
+ };
+ this.$$childScopeClass.prototype = this;
+ }
+ child = new this.$$childScopeClass();
+ }
+ child['this'] = child;
+ child.$parent = this;
+ child.$$prevSibling = this.$$childTail;
+ if (this.$$childHead) {
+ this.$$childTail.$$nextSibling = child;
+ this.$$childTail = child;
+ } else {
+ this.$$childHead = this.$$childTail = child;
+ }
+ return child;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$watch
+ * @kind function
+ *
+ * @description
+ * Registers a `listener` callback to be executed whenever the `watchExpression` changes.
+ *
+ * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest
+ * $digest()} and should return the value that will be watched. (Since
+ * {@link ng.$rootScope.Scope#$digest $digest()} reruns when it detects changes the
+ * `watchExpression` can execute multiple times per
+ * {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.)
+ * - The `listener` is called only when the value from the current `watchExpression` and the
+ * previous call to `watchExpression` are not equal (with the exception of the initial run,
+ * see below). Inequality is determined according to reference inequality,
+ * [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators)
+ * via the `!==` Javascript operator, unless `objectEquality == true`
+ * (see next point)
+ * - When `objectEquality == true`, inequality of the `watchExpression` is determined
+ * according to the {@link angular.equals} function. To save the value of the object for
+ * later comparison, the {@link angular.copy} function is used. This therefore means that
+ * watching complex objects will have adverse memory and performance implications.
+ * - The watch `listener` may change the model, which may trigger other `listener`s to fire.
+ * This is achieved by rerunning the watchers until no changes are detected. The rerun
+ * iteration limit is 10 to prevent an infinite loop deadlock.
+ *
+ *
+ * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,
+ * you can register a `watchExpression` function with no `listener`. (Since `watchExpression`
+ * can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a
+ * change is detected, be prepared for multiple calls to your listener.)
+ *
+ * After a watcher is registered with the scope, the `listener` fn is called asynchronously
+ * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the
+ * watcher. In rare cases, this is undesirable because the listener is called when the result
+ * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you
+ * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the
+ * listener was called due to initialization.
+ *
+ * The example below contains an illustration of using a function as your $watch listener
+ *
+ *
+ * # Example
+ * ```js
+ // let's assume that scope was dependency injected as the $rootScope
+ var scope = $rootScope;
+ scope.name = 'misko';
+ scope.counter = 0;
+
+ expect(scope.counter).toEqual(0);
+ scope.$watch('name', function(newValue, oldValue) {
+ scope.counter = scope.counter + 1;
+ });
+ expect(scope.counter).toEqual(0);
+
+ scope.$digest();
+ // the listener is always called during the first $digest loop after it was registered
+ expect(scope.counter).toEqual(1);
+
+ scope.$digest();
+ // but now it will not be called unless the value changes
+ expect(scope.counter).toEqual(1);
+
+ scope.name = 'adam';
+ scope.$digest();
+ expect(scope.counter).toEqual(2);
+
+
+
+ // Using a listener function
+ var food;
+ scope.foodCounter = 0;
+ expect(scope.foodCounter).toEqual(0);
+ scope.$watch(
+ // This is the listener function
+ function() { return food; },
+ // This is the change handler
+ function(newValue, oldValue) {
+ if ( newValue !== oldValue ) {
+ // Only increment the counter if the value changed
+ scope.foodCounter = scope.foodCounter + 1;
+ }
+ }
+ );
+ // No digest has been run so the counter will be zero
+ expect(scope.foodCounter).toEqual(0);
+
+ // Run the digest but since food has not changed count will still be zero
+ scope.$digest();
+ expect(scope.foodCounter).toEqual(0);
+
+ // Update food and run digest. Now the counter will increment
+ food = 'cheeseburger';
+ scope.$digest();
+ expect(scope.foodCounter).toEqual(1);
+
+ * ```
+ *
+ *
+ *
+ * @param {(function()|string)} watchExpression Expression that is evaluated on each
+ * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers
+ * a call to the `listener`.
+ *
+ * - `string`: Evaluated as {@link guide/expression expression}
+ * - `function(scope)`: called with current `scope` as a parameter.
+ * @param {(function()|string)=} listener Callback called whenever the return value of
+ * the `watchExpression` changes.
+ *
+ * - `string`: Evaluated as {@link guide/expression expression}
+ * - `function(newValue, oldValue, scope)`: called with current and previous values as
+ * parameters.
+ *
+ * @param {boolean=} objectEquality Compare for object equality using {@link angular.equals} instead of
+ * comparing for reference equality.
+ * @returns {function()} Returns a deregistration function for this listener.
+ */
+ $watch: function(watchExp, listener, objectEquality) {
+ var scope = this,
+ get = compileToFn(watchExp, 'watch'),
+ array = scope.$$watchers,
+ watcher = {
+ fn: listener,
+ last: initWatchVal,
+ get: get,
+ exp: watchExp,
+ eq: !!objectEquality
+ };
+
+ lastDirtyWatch = null;
+
+ // in the case user pass string, we need to compile it, do we really need this ?
+ if (!isFunction(listener)) {
+ var listenFn = compileToFn(listener || noop, 'listener');
+ watcher.fn = function(newVal, oldVal, scope) {listenFn(scope);};
+ }
+
+ if (typeof watchExp == 'string' && get.constant) {
+ var originalFn = watcher.fn;
+ watcher.fn = function(newVal, oldVal, scope) {
+ originalFn.call(this, newVal, oldVal, scope);
+ arrayRemove(array, watcher);
+ };
+ }
+
+ if (!array) {
+ array = scope.$$watchers = [];
+ }
+ // we use unshift since we use a while loop in $digest for speed.
+ // the while loop reads in reverse order.
+ array.unshift(watcher);
+
+ return function deregisterWatch() {
+ arrayRemove(array, watcher);
+ lastDirtyWatch = null;
+ };
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$watchCollection
+ * @kind function
+ *
+ * @description
+ * Shallow watches the properties of an object and fires whenever any of the properties change
+ * (for arrays, this implies watching the array items; for object maps, this implies watching
+ * the properties). If a change is detected, the `listener` callback is fired.
+ *
+ * - The `obj` collection is observed via standard $watch operation and is examined on every
+ * call to $digest() to see if any items have been added, removed, or moved.
+ * - The `listener` is called whenever anything within the `obj` has changed. Examples include
+ * adding, removing, and moving items belonging to an object or array.
+ *
+ *
+ * # Example
+ * ```js
+ $scope.names = ['igor', 'matias', 'misko', 'james'];
+ $scope.dataCount = 4;
+
+ $scope.$watchCollection('names', function(newNames, oldNames) {
+ $scope.dataCount = newNames.length;
+ });
+
+ expect($scope.dataCount).toEqual(4);
+ $scope.$digest();
+
+ //still at 4 ... no changes
+ expect($scope.dataCount).toEqual(4);
+
+ $scope.names.pop();
+ $scope.$digest();
+
+ //now there's been a change
+ expect($scope.dataCount).toEqual(3);
+ * ```
+ *
+ *
+ * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The
+ * expression value should evaluate to an object or an array which is observed on each
+ * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the
+ * collection will trigger a call to the `listener`.
+ *
+ * @param {function(newCollection, oldCollection, scope)} listener a callback function called
+ * when a change is detected.
+ * - The `newCollection` object is the newly modified data obtained from the `obj` expression
+ * - The `oldCollection` object is a copy of the former collection data.
+ * Due to performance considerations, the`oldCollection` value is computed only if the
+ * `listener` function declares two or more arguments.
+ * - The `scope` argument refers to the current scope.
+ *
+ * @returns {function()} Returns a de-registration function for this listener. When the
+ * de-registration function is executed, the internal watch operation is terminated.
+ */
+ $watchCollection: function(obj, listener) {
+ var self = this;
+ // the current value, updated on each dirty-check run
+ var newValue;
+ // a shallow copy of the newValue from the last dirty-check run,
+ // updated to match newValue during dirty-check run
+ var oldValue;
+ // a shallow copy of the newValue from when the last change happened
+ var veryOldValue;
+ // only track veryOldValue if the listener is asking for it
+ var trackVeryOldValue = (listener.length > 1);
+ var changeDetected = 0;
+ var objGetter = $parse(obj);
+ var internalArray = [];
+ var internalObject = {};
+ var initRun = true;
+ var oldLength = 0;
+
+ function $watchCollectionWatch() {
+ newValue = objGetter(self);
+ var newLength, key, bothNaN;
+
+ if (!isObject(newValue)) { // if primitive
+ if (oldValue !== newValue) {
+ oldValue = newValue;
+ changeDetected++;
+ }
+ } else if (isArrayLike(newValue)) {
+ if (oldValue !== internalArray) {
+ // we are transitioning from something which was not an array into array.
+ oldValue = internalArray;
+ oldLength = oldValue.length = 0;
+ changeDetected++;
+ }
+
+ newLength = newValue.length;
+
+ if (oldLength !== newLength) {
+ // if lengths do not match we need to trigger change notification
+ changeDetected++;
+ oldValue.length = oldLength = newLength;
+ }
+ // copy the items to oldValue and look for changes.
+ for (var i = 0; i < newLength; i++) {
+ bothNaN = (oldValue[i] !== oldValue[i]) &&
+ (newValue[i] !== newValue[i]);
+ if (!bothNaN && (oldValue[i] !== newValue[i])) {
+ changeDetected++;
+ oldValue[i] = newValue[i];
+ }
+ }
+ } else {
+ if (oldValue !== internalObject) {
+ // we are transitioning from something which was not an object into object.
+ oldValue = internalObject = {};
+ oldLength = 0;
+ changeDetected++;
+ }
+ // copy the items to oldValue and look for changes.
+ newLength = 0;
+ for (key in newValue) {
+ if (newValue.hasOwnProperty(key)) {
+ newLength++;
+ if (oldValue.hasOwnProperty(key)) {
+ bothNaN = (oldValue[key] !== oldValue[key]) &&
+ (newValue[key] !== newValue[key]);
+ if (!bothNaN && (oldValue[key] !== newValue[key])) {
+ changeDetected++;
+ oldValue[key] = newValue[key];
+ }
+ } else {
+ oldLength++;
+ oldValue[key] = newValue[key];
+ changeDetected++;
+ }
+ }
+ }
+ if (oldLength > newLength) {
+ // we used to have more keys, need to find them and destroy them.
+ changeDetected++;
+ for(key in oldValue) {
+ if (oldValue.hasOwnProperty(key) && !newValue.hasOwnProperty(key)) {
+ oldLength--;
+ delete oldValue[key];
+ }
+ }
+ }
+ }
+ return changeDetected;
+ }
+
+ function $watchCollectionAction() {
+ if (initRun) {
+ initRun = false;
+ listener(newValue, newValue, self);
+ } else {
+ listener(newValue, veryOldValue, self);
+ }
+
+ // make a copy for the next time a collection is changed
+ if (trackVeryOldValue) {
+ if (!isObject(newValue)) {
+ //primitive
+ veryOldValue = newValue;
+ } else if (isArrayLike(newValue)) {
+ veryOldValue = new Array(newValue.length);
+ for (var i = 0; i < newValue.length; i++) {
+ veryOldValue[i] = newValue[i];
+ }
+ } else { // if object
+ veryOldValue = {};
+ for (var key in newValue) {
+ if (hasOwnProperty.call(newValue, key)) {
+ veryOldValue[key] = newValue[key];
+ }
+ }
+ }
+ }
+ }
+
+ return this.$watch($watchCollectionWatch, $watchCollectionAction);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$digest
+ * @kind function
+ *
+ * @description
+ * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and
+ * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change
+ * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}
+ * until no more listeners are firing. This means that it is possible to get into an infinite
+ * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of
+ * iterations exceeds 10.
+ *
+ * Usually, you don't call `$digest()` directly in
+ * {@link ng.directive:ngController controllers} or in
+ * {@link ng.$compileProvider#directive directives}.
+ * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within
+ * a {@link ng.$compileProvider#directive directives}), which will force a `$digest()`.
+ *
+ * If you want to be notified whenever `$digest()` is called,
+ * you can register a `watchExpression` function with
+ * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.
+ *
+ * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
+ *
+ * # Example
+ * ```js
+ var scope = ...;
+ scope.name = 'misko';
+ scope.counter = 0;
+
+ expect(scope.counter).toEqual(0);
+ scope.$watch('name', function(newValue, oldValue) {
+ scope.counter = scope.counter + 1;
+ });
+ expect(scope.counter).toEqual(0);
+
+ scope.$digest();
+ // the listener is always called during the first $digest loop after it was registered
+ expect(scope.counter).toEqual(1);
+
+ scope.$digest();
+ // but now it will not be called unless the value changes
+ expect(scope.counter).toEqual(1);
+
+ scope.name = 'adam';
+ scope.$digest();
+ expect(scope.counter).toEqual(2);
+ * ```
+ *
+ */
+ $digest: function() {
+ var watch, value, last,
+ watchers,
+ asyncQueue = this.$$asyncQueue,
+ postDigestQueue = this.$$postDigestQueue,
+ length,
+ dirty, ttl = TTL,
+ next, current, target = this,
+ watchLog = [],
+ logIdx, logMsg, asyncTask;
+
+ beginPhase('$digest');
+ // Check for changes to browser url that happened in sync before the call to $digest
+ $browser.$$checkUrlChange();
+
+ lastDirtyWatch = null;
+
+ do { // "while dirty" loop
+ dirty = false;
+ current = target;
+
+ while(asyncQueue.length) {
+ try {
+ asyncTask = asyncQueue.shift();
+ asyncTask.scope.$eval(asyncTask.expression);
+ } catch (e) {
+ clearPhase();
+ $exceptionHandler(e);
+ }
+ lastDirtyWatch = null;
+ }
+
+ traverseScopesLoop:
+ do { // "traverse the scopes" loop
+ if ((watchers = current.$$watchers)) {
+ // process our watches
+ length = watchers.length;
+ while (length--) {
+ try {
+ watch = watchers[length];
+ // Most common watches are on primitives, in which case we can short
+ // circuit it with === operator, only when === fails do we use .equals
+ if (watch) {
+ if ((value = watch.get(current)) !== (last = watch.last) &&
+ !(watch.eq
+ ? equals(value, last)
+ : (typeof value === 'number' && typeof last === 'number'
+ && isNaN(value) && isNaN(last)))) {
+ dirty = true;
+ lastDirtyWatch = watch;
+ watch.last = watch.eq ? copy(value, null) : value;
+ watch.fn(value, ((last === initWatchVal) ? value : last), current);
+ if (ttl < 5) {
+ logIdx = 4 - ttl;
+ if (!watchLog[logIdx]) watchLog[logIdx] = [];
+ logMsg = (isFunction(watch.exp))
+ ? 'fn: ' + (watch.exp.name || watch.exp.toString())
+ : watch.exp;
+ logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last);
+ watchLog[logIdx].push(logMsg);
+ }
+ } else if (watch === lastDirtyWatch) {
+ // If the most recently dirty watcher is now clean, short circuit since the remaining watchers
+ // have already been tested.
+ dirty = false;
+ break traverseScopesLoop;
+ }
+ }
+ } catch (e) {
+ clearPhase();
+ $exceptionHandler(e);
+ }
+ }
+ }
+
+ // Insanity Warning: scope depth-first traversal
+ // yes, this code is a bit crazy, but it works and we have tests to prove it!
+ // this piece should be kept in sync with the traversal in $broadcast
+ if (!(next = (current.$$childHead ||
+ (current !== target && current.$$nextSibling)))) {
+ while(current !== target && !(next = current.$$nextSibling)) {
+ current = current.$parent;
+ }
+ }
+ } while ((current = next));
+
+ // `break traverseScopesLoop;` takes us to here
+
+ if((dirty || asyncQueue.length) && !(ttl--)) {
+ clearPhase();
+ throw $rootScopeMinErr('infdig',
+ '{0} $digest() iterations reached. Aborting!\n' +
+ 'Watchers fired in the last 5 iterations: {1}',
+ TTL, toJson(watchLog));
+ }
+
+ } while (dirty || asyncQueue.length);
+
+ clearPhase();
+
+ while(postDigestQueue.length) {
+ try {
+ postDigestQueue.shift()();
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ },
+
+
+ /**
+ * @ngdoc event
+ * @name $rootScope.Scope#$destroy
+ * @eventType broadcast on scope being destroyed
+ *
+ * @description
+ * Broadcasted when a scope and its children are being destroyed.
+ *
+ * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
+ * clean up DOM bindings before an element is removed from the DOM.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$destroy
+ * @kind function
+ *
+ * @description
+ * Removes the current scope (and all of its children) from the parent scope. Removal implies
+ * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer
+ * propagate to the current scope and its children. Removal also implies that the current
+ * scope is eligible for garbage collection.
+ *
+ * The `$destroy()` is usually used by directives such as
+ * {@link ng.directive:ngRepeat ngRepeat} for managing the
+ * unrolling of the loop.
+ *
+ * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.
+ * Application code can register a `$destroy` event handler that will give it a chance to
+ * perform any necessary cleanup.
+ *
+ * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
+ * clean up DOM bindings before an element is removed from the DOM.
+ */
+ $destroy: function() {
+ // we can't destroy the root scope or a scope that has been already destroyed
+ if (this.$$destroyed) return;
+ var parent = this.$parent;
+
+ this.$broadcast('$destroy');
+ this.$$destroyed = true;
+ if (this === $rootScope) return;
+
+ forEach(this.$$listenerCount, bind(null, decrementListenerCount, this));
+
+ // sever all the references to parent scopes (after this cleanup, the current scope should
+ // not be retained by any of our references and should be eligible for garbage collection)
+ if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
+ if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
+ if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
+ if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
+
+
+ // All of the code below is bogus code that works around V8's memory leak via optimized code
+ // and inline caches.
+ //
+ // see:
+ // - https://code.google.com/p/v8/issues/detail?id=2073#c26
+ // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
+ // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
+
+ this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead =
+ this.$$childTail = this.$root = null;
+
+ // don't reset these to null in case some async task tries to register a listener/watch/task
+ this.$$listeners = {};
+ this.$$watchers = this.$$asyncQueue = this.$$postDigestQueue = [];
+
+ // prevent NPEs since these methods have references to properties we nulled out
+ this.$destroy = this.$digest = this.$apply = noop;
+ this.$on = this.$watch = function() { return noop; };
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$eval
+ * @kind function
+ *
+ * @description
+ * Executes the `expression` on the current scope and returns the result. Any exceptions in
+ * the expression are propagated (uncaught). This is useful when evaluating Angular
+ * expressions.
+ *
+ * # Example
+ * ```js
+ var scope = ng.$rootScope.Scope();
+ scope.a = 1;
+ scope.b = 2;
+
+ expect(scope.$eval('a+b')).toEqual(3);
+ expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
+ * ```
+ *
+ * @param {(string|function())=} expression An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with the current `scope` parameter.
+ *
+ * @param {(object)=} locals Local variables object, useful for overriding values in scope.
+ * @returns {*} The result of evaluating the expression.
+ */
+ $eval: function(expr, locals) {
+ return $parse(expr)(this, locals);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$evalAsync
+ * @kind function
+ *
+ * @description
+ * Executes the expression on the current scope at a later point in time.
+ *
+ * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only
+ * that:
+ *
+ * - it will execute after the function that scheduled the evaluation (preferably before DOM
+ * rendering).
+ * - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after
+ * `expression` execution.
+ *
+ * Any exceptions from the execution of the expression are forwarded to the
+ * {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle
+ * will be scheduled. However, it is encouraged to always call code that changes the model
+ * from within an `$apply` call. That includes code evaluated via `$evalAsync`.
+ *
+ * @param {(string|function())=} expression An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with the current `scope` parameter.
+ *
+ */
+ $evalAsync: function(expr) {
+ // if we are outside of an $digest loop and this is the first time we are scheduling async
+ // task also schedule async auto-flush
+ if (!$rootScope.$$phase && !$rootScope.$$asyncQueue.length) {
+ $browser.defer(function() {
+ if ($rootScope.$$asyncQueue.length) {
+ $rootScope.$digest();
+ }
+ });
+ }
+
+ this.$$asyncQueue.push({scope: this, expression: expr});
+ },
+
+ $$postDigest : function(fn) {
+ this.$$postDigestQueue.push(fn);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$apply
+ * @kind function
+ *
+ * @description
+ * `$apply()` is used to execute an expression in angular from outside of the angular
+ * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).
+ * Because we are calling into the angular framework we need to perform proper scope life
+ * cycle of {@link ng.$exceptionHandler exception handling},
+ * {@link ng.$rootScope.Scope#$digest executing watches}.
+ *
+ * ## Life cycle
+ *
+ * # Pseudo-Code of `$apply()`
+ * ```js
+ function $apply(expr) {
+ try {
+ return $eval(expr);
+ } catch (e) {
+ $exceptionHandler(e);
+ } finally {
+ $root.$digest();
+ }
+ }
+ * ```
+ *
+ *
+ * Scope's `$apply()` method transitions through the following stages:
+ *
+ * 1. The {@link guide/expression expression} is executed using the
+ * {@link ng.$rootScope.Scope#$eval $eval()} method.
+ * 2. Any exceptions from the execution of the expression are forwarded to the
+ * {@link ng.$exceptionHandler $exceptionHandler} service.
+ * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the
+ * expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.
+ *
+ *
+ * @param {(string|function())=} exp An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with current `scope` parameter.
+ *
+ * @returns {*} The result of evaluating the expression.
+ */
+ $apply: function(expr) {
+ try {
+ beginPhase('$apply');
+ return this.$eval(expr);
+ } catch (e) {
+ $exceptionHandler(e);
+ } finally {
+ clearPhase();
+ try {
+ $rootScope.$digest();
+ } catch (e) {
+ $exceptionHandler(e);
+ throw e;
+ }
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$on
+ * @kind function
+ *
+ * @description
+ * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for
+ * discussion of event life cycle.
+ *
+ * The event listener function format is: `function(event, args...)`. The `event` object
+ * passed into the listener has the following attributes:
+ *
+ * - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or
+ * `$broadcast`-ed.
+ * - `currentScope` - `{Scope}`: the current scope which is handling the event.
+ * - `name` - `{string}`: name of the event.
+ * - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel
+ * further event propagation (available only for events that were `$emit`-ed).
+ * - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag
+ * to true.
+ * - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
+ *
+ * @param {string} name Event name to listen on.
+ * @param {function(event, ...args)} listener Function to call when the event is emitted.
+ * @returns {function()} Returns a deregistration function for this listener.
+ */
+ $on: function(name, listener) {
+ var namedListeners = this.$$listeners[name];
+ if (!namedListeners) {
+ this.$$listeners[name] = namedListeners = [];
+ }
+ namedListeners.push(listener);
+
+ var current = this;
+ do {
+ if (!current.$$listenerCount[name]) {
+ current.$$listenerCount[name] = 0;
+ }
+ current.$$listenerCount[name]++;
+ } while ((current = current.$parent));
+
+ var self = this;
+ return function() {
+ namedListeners[indexOf(namedListeners, listener)] = null;
+ decrementListenerCount(self, 1, name);
+ };
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$emit
+ * @kind function
+ *
+ * @description
+ * Dispatches an event `name` upwards through the scope hierarchy notifying the
+ * registered {@link ng.$rootScope.Scope#$on} listeners.
+ *
+ * The event life cycle starts at the scope on which `$emit` was called. All
+ * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
+ * notified. Afterwards, the event traverses upwards toward the root scope and calls all
+ * registered listeners along the way. The event will stop propagating if one of the listeners
+ * cancels it.
+ *
+ * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
+ * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * @param {string} name Event name to emit.
+ * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
+ * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).
+ */
+ $emit: function(name, args) {
+ var empty = [],
+ namedListeners,
+ scope = this,
+ stopPropagation = false,
+ event = {
+ name: name,
+ targetScope: scope,
+ stopPropagation: function() {stopPropagation = true;},
+ preventDefault: function() {
+ event.defaultPrevented = true;
+ },
+ defaultPrevented: false
+ },
+ listenerArgs = concat([event], arguments, 1),
+ i, length;
+
+ do {
+ namedListeners = scope.$$listeners[name] || empty;
+ event.currentScope = scope;
+ for (i=0, length=namedListeners.length; i<length; i++) {
+
+ // if listeners were deregistered, defragment the array
+ if (!namedListeners[i]) {
+ namedListeners.splice(i, 1);
+ i--;
+ length--;
+ continue;
+ }
+ try {
+ //allow all listeners attached to the current scope to run
+ namedListeners[i].apply(null, listenerArgs);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ //if any listener on the current scope stops propagation, prevent bubbling
+ if (stopPropagation) return event;
+ //traverse upwards
+ scope = scope.$parent;
+ } while (scope);
+
+ return event;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$broadcast
+ * @kind function
+ *
+ * @description
+ * Dispatches an event `name` downwards to all child scopes (and their children) notifying the
+ * registered {@link ng.$rootScope.Scope#$on} listeners.
+ *
+ * The event life cycle starts at the scope on which `$broadcast` was called. All
+ * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
+ * notified. Afterwards, the event propagates to all direct and indirect scopes of the current
+ * scope and calls all registered listeners along the way. The event cannot be canceled.
+ *
+ * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
+ * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * @param {string} name Event name to broadcast.
+ * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
+ * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
+ */
+ $broadcast: function(name, args) {
+ var target = this,
+ current = target,
+ next = target,
+ event = {
+ name: name,
+ targetScope: target,
+ preventDefault: function() {
+ event.defaultPrevented = true;
+ },
+ defaultPrevented: false
+ },
+ listenerArgs = concat([event], arguments, 1),
+ listeners, i, length;
+
+ //down while you can, then up and next sibling or up and next sibling until back at root
+ while ((current = next)) {
+ event.currentScope = current;
+ listeners = current.$$listeners[name] || [];
+ for (i=0, length = listeners.length; i<length; i++) {
+ // if listeners were deregistered, defragment the array
+ if (!listeners[i]) {
+ listeners.splice(i, 1);
+ i--;
+ length--;
+ continue;
+ }
+
+ try {
+ listeners[i].apply(null, listenerArgs);
+ } catch(e) {
+ $exceptionHandler(e);
+ }
+ }
+
+ // Insanity Warning: scope depth-first traversal
+ // yes, this code is a bit crazy, but it works and we have tests to prove it!
+ // this piece should be kept in sync with the traversal in $digest
+ // (though it differs due to having the extra check for $$listenerCount)
+ if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||
+ (current !== target && current.$$nextSibling)))) {
+ while(current !== target && !(next = current.$$nextSibling)) {
+ current = current.$parent;
+ }
+ }
+ }
+
+ return event;
+ }
+ };
+
+ var $rootScope = new Scope();
+
+ return $rootScope;
+
+
+ function beginPhase(phase) {
+ if ($rootScope.$$phase) {
+ throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);
+ }
+
+ $rootScope.$$phase = phase;
+ }
+
+ function clearPhase() {
+ $rootScope.$$phase = null;
+ }
+
+ function compileToFn(exp, name) {
+ var fn = $parse(exp);
+ assertArgFn(fn, name);
+ return fn;
+ }
+
+ function decrementListenerCount(current, count, name) {
+ do {
+ current.$$listenerCount[name] -= count;
+
+ if (current.$$listenerCount[name] === 0) {
+ delete current.$$listenerCount[name];
+ }
+ } while ((current = current.$parent));
+ }
+
+ /**
+ * function used as an initial value for watchers.
+ * because it's unique we can easily tell it apart from other values
+ */
+ function initWatchVal() {}
+ }];
+}
+
+/**
+ * @description
+ * Private service to sanitize uris for links and images. Used by $compile and $sanitize.
+ */
+function $$SanitizeUriProvider() {
+ var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/,
+ imgSrcSanitizationWhitelist = /^\s*((https?|ftp|file):|data:image\/)/;
+
+ /**
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during a[href] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to a[href] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.aHrefSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ aHrefSanitizationWhitelist = regexp;
+ return this;
+ }
+ return aHrefSanitizationWhitelist;
+ };
+
+
+ /**
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during img[src] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to img[src] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.imgSrcSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ imgSrcSanitizationWhitelist = regexp;
+ return this;
+ }
+ return imgSrcSanitizationWhitelist;
+ };
+
+ this.$get = function() {
+ return function sanitizeUri(uri, isImage) {
+ var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;
+ var normalizedVal;
+ // NOTE: urlResolve() doesn't support IE < 8 so we don't sanitize for that case.
+ if (!msie || msie >= 8 ) {
+ normalizedVal = urlResolve(uri).href;
+ if (normalizedVal !== '' && !normalizedVal.match(regex)) {
+ return 'unsafe:'+normalizedVal;
+ }
+ }
+ return uri;
+ };
+ };
+}
+
+var $sceMinErr = minErr('$sce');
+
+var SCE_CONTEXTS = {
+ HTML: 'html',
+ CSS: 'css',
+ URL: 'url',
+ // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a
+ // url. (e.g. ng-include, script src, templateUrl)
+ RESOURCE_URL: 'resourceUrl',
+ JS: 'js'
+};
+
+// Helper functions follow.
+
+// Copied from:
+// http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962
+// Prereq: s is a string.
+function escapeForRegexp(s) {
+ return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1').
+ replace(/\x08/g, '\\x08');
+}
+
+
+function adjustMatcher(matcher) {
+ if (matcher === 'self') {
+ return matcher;
+ } else if (isString(matcher)) {
+ // Strings match exactly except for 2 wildcards - '*' and '**'.
+ // '*' matches any character except those from the set ':/.?&'.
+ // '**' matches any character (like .* in a RegExp).
+ // More than 2 *'s raises an error as it's ill defined.
+ if (matcher.indexOf('***') > -1) {
+ throw $sceMinErr('iwcard',
+ 'Illegal sequence *** in string matcher. String: {0}', matcher);
+ }
+ matcher = escapeForRegexp(matcher).
+ replace('\\*\\*', '.*').
+ replace('\\*', '[^:/.?&;]*');
+ return new RegExp('^' + matcher + '$');
+ } else if (isRegExp(matcher)) {
+ // The only other type of matcher allowed is a Regexp.
+ // Match entire URL / disallow partial matches.
+ // Flags are reset (i.e. no global, ignoreCase or multiline)
+ return new RegExp('^' + matcher.source + '$');
+ } else {
+ throw $sceMinErr('imatcher',
+ 'Matchers may only be "self", string patterns or RegExp objects');
+ }
+}
+
+
+function adjustMatchers(matchers) {
+ var adjustedMatchers = [];
+ if (isDefined(matchers)) {
+ forEach(matchers, function(matcher) {
+ adjustedMatchers.push(adjustMatcher(matcher));
+ });
+ }
+ return adjustedMatchers;
+}
+
+
+/**
+ * @ngdoc service
+ * @name $sceDelegate
+ * @kind function
+ *
+ * @description
+ *
+ * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict
+ * Contextual Escaping (SCE)} services to AngularJS.
+ *
+ * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of
+ * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS. This is
+ * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to
+ * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things
+ * work because `$sce` delegates to `$sceDelegate` for these operations.
+ *
+ * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.
+ *
+ * The default instance of `$sceDelegate` should work out of the box with little pain. While you
+ * can override it completely to change the behavior of `$sce`, the common case would
+ * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting
+ * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as
+ * templates. Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist
+ * $sceDelegateProvider.resourceUrlWhitelist} and {@link
+ * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+ */
+
+/**
+ * @ngdoc provider
+ * @name $sceDelegateProvider
+ * @description
+ *
+ * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate
+ * $sceDelegate} service. This allows one to get/set the whitelists and blacklists used to ensure
+ * that the URLs used for sourcing Angular templates are safe. Refer {@link
+ * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and
+ * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+ *
+ * For the general details about this service in Angular, read the main page for {@link ng.$sce
+ * Strict Contextual Escaping (SCE)}.
+ *
+ * **Example**: Consider the following case. <a name="example"></a>
+ *
+ * - your app is hosted at url `http://myapp.example.com/`
+ * - but some of your templates are hosted on other domains you control such as
+ * `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.
+ * - and you have an open redirect at `http://myapp.example.com/clickThru?...`.
+ *
+ * Here is what a secure configuration for this scenario might look like:
+ *
+ * ```
+ * angular.module('myApp', []).config(function($sceDelegateProvider) {
+ * $sceDelegateProvider.resourceUrlWhitelist([
+ * // Allow same origin resource loads.
+ * 'self',
+ * // Allow loading from our assets domain. Notice the difference between * and **.
+ * 'http://srv*.assets.example.com/**'
+ * ]);
+ *
+ * // The blacklist overrides the whitelist so the open redirect here is blocked.
+ * $sceDelegateProvider.resourceUrlBlacklist([
+ * 'http://myapp.example.com/clickThru**'
+ * ]);
+ * });
+ * ```
+ */
+
+function $SceDelegateProvider() {
+ this.SCE_CONTEXTS = SCE_CONTEXTS;
+
+ // Resource URLs can also be trusted by policy.
+ var resourceUrlWhitelist = ['self'],
+ resourceUrlBlacklist = [];
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegateProvider#resourceUrlWhitelist
+ * @kind function
+ *
+ * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
+ * provided. This must be an array or null. A snapshot of this array is used so further
+ * changes to the array are ignored.
+ *
+ * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+ * allowed in this array.
+ *
+ * Note: **an empty whitelist array will block all URLs**!
+ *
+ * @return {Array} the currently set whitelist array.
+ *
+ * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
+ * same origin resource requests.
+ *
+ * @description
+ * Sets/Gets the whitelist of trusted resource URLs.
+ */
+ this.resourceUrlWhitelist = function (value) {
+ if (arguments.length) {
+ resourceUrlWhitelist = adjustMatchers(value);
+ }
+ return resourceUrlWhitelist;
+ };
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegateProvider#resourceUrlBlacklist
+ * @kind function
+ *
+ * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
+ * provided. This must be an array or null. A snapshot of this array is used so further
+ * changes to the array are ignored.
+ *
+ * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+ * allowed in this array.
+ *
+ * The typical usage for the blacklist is to **block
+ * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
+ * these would otherwise be trusted but actually return content from the redirected domain.
+ *
+ * Finally, **the blacklist overrides the whitelist** and has the final say.
+ *
+ * @return {Array} the currently set blacklist array.
+ *
+ * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there
+ * is no blacklist.)
+ *
+ * @description
+ * Sets/Gets the blacklist of trusted resource URLs.
+ */
+
+ this.resourceUrlBlacklist = function (value) {
+ if (arguments.length) {
+ resourceUrlBlacklist = adjustMatchers(value);
+ }
+ return resourceUrlBlacklist;
+ };
+
+ this.$get = ['$injector', function($injector) {
+
+ var htmlSanitizer = function htmlSanitizer(html) {
+ throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
+ };
+
+ if ($injector.has('$sanitize')) {
+ htmlSanitizer = $injector.get('$sanitize');
+ }
+
+
+ function matchUrl(matcher, parsedUrl) {
+ if (matcher === 'self') {
+ return urlIsSameOrigin(parsedUrl);
+ } else {
+ // definitely a regex. See adjustMatchers()
+ return !!matcher.exec(parsedUrl.href);
+ }
+ }
+
+ function isResourceUrlAllowedByPolicy(url) {
+ var parsedUrl = urlResolve(url.toString());
+ var i, n, allowed = false;
+ // Ensure that at least one item from the whitelist allows this url.
+ for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) {
+ if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {
+ allowed = true;
+ break;
+ }
+ }
+ if (allowed) {
+ // Ensure that no item from the blacklist blocked this url.
+ for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) {
+ if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {
+ allowed = false;
+ break;
+ }
+ }
+ }
+ return allowed;
+ }
+
+ function generateHolderType(Base) {
+ var holderType = function TrustedValueHolderType(trustedValue) {
+ this.$$unwrapTrustedValue = function() {
+ return trustedValue;
+ };
+ };
+ if (Base) {
+ holderType.prototype = new Base();
+ }
+ holderType.prototype.valueOf = function sceValueOf() {
+ return this.$$unwrapTrustedValue();
+ };
+ holderType.prototype.toString = function sceToString() {
+ return this.$$unwrapTrustedValue().toString();
+ };
+ return holderType;
+ }
+
+ var trustedValueHolderBase = generateHolderType(),
+ byType = {};
+
+ byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]);
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegate#trustAs
+ *
+ * @description
+ * Returns an object that is trusted by angular for use in specified strict
+ * contextual escaping contexts (such as ng-bind-html, ng-include, any src
+ * attribute interpolation, any dom event binding attribute interpolation
+ * such as for onclick, etc.) that uses the provided value.
+ * See {@link ng.$sce $sce} for enabling strict contextual escaping.
+ *
+ * @param {string} type The kind of context in which this value is safe for use. e.g. url,
+ * resourceUrl, html, js and css.
+ * @param {*} value The value that that should be considered trusted/safe.
+ * @returns {*} A value that can be used to stand in for the provided `value` in places
+ * where Angular expects a $sce.trustAs() return value.
+ */
+ function trustAs(type, trustedValue) {
+ var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
+ if (!Constructor) {
+ throw $sceMinErr('icontext',
+ 'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',
+ type, trustedValue);
+ }
+ if (trustedValue === null || trustedValue === undefined || trustedValue === '') {
+ return trustedValue;
+ }
+ // All the current contexts in SCE_CONTEXTS happen to be strings. In order to avoid trusting
+ // mutable objects, we ensure here that the value passed in is actually a string.
+ if (typeof trustedValue !== 'string') {
+ throw $sceMinErr('itype',
+ 'Attempted to trust a non-string value in a content requiring a string: Context: {0}',
+ type);
+ }
+ return new Constructor(trustedValue);
+ }
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegate#valueOf
+ *
+ * @description
+ * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link
+ * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.
+ *
+ * If the passed parameter is not a value that had been returned by {@link
+ * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.
+ *
+ * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}
+ * call or anything else.
+ * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`} if `value` is the result of such a call. Otherwise, returns
+ * `value` unchanged.
+ */
+ function valueOf(maybeTrusted) {
+ if (maybeTrusted instanceof trustedValueHolderBase) {
+ return maybeTrusted.$$unwrapTrustedValue();
+ } else {
+ return maybeTrusted;
+ }
+ }
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegate#getTrusted
+ *
+ * @description
+ * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and
+ * returns the originally supplied value if the queried context type is a supertype of the
+ * created type. If this condition isn't satisfied, throws an exception.
+ *
+ * @param {string} type The kind of context in which this value is to be used.
+ * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`} call.
+ * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`} if valid in this context. Otherwise, throws an exception.
+ */
+ function getTrusted(type, maybeTrusted) {
+ if (maybeTrusted === null || maybeTrusted === undefined || maybeTrusted === '') {
+ return maybeTrusted;
+ }
+ var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
+ if (constructor && maybeTrusted instanceof constructor) {
+ return maybeTrusted.$$unwrapTrustedValue();
+ }
+ // If we get here, then we may only take one of two actions.
+ // 1. sanitize the value for the requested type, or
+ // 2. throw an exception.
+ if (type === SCE_CONTEXTS.RESOURCE_URL) {
+ if (isResourceUrlAllowedByPolicy(maybeTrusted)) {
+ return maybeTrusted;
+ } else {
+ throw $sceMinErr('insecurl',
+ 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}',
+ maybeTrusted.toString());
+ }
+ } else if (type === SCE_CONTEXTS.HTML) {
+ return htmlSanitizer(maybeTrusted);
+ }
+ throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
+ }
+
+ return { trustAs: trustAs,
+ getTrusted: getTrusted,
+ valueOf: valueOf };
+ }];
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $sceProvider
+ * @description
+ *
+ * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.
+ * - enable/disable Strict Contextual Escaping (SCE) in a module
+ * - override the default implementation with a custom delegate
+ *
+ * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}.
+ */
+
+/* jshint maxlen: false*/
+
+/**
+ * @ngdoc service
+ * @name $sce
+ * @kind function
+ *
+ * @description
+ *
+ * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS.
+ *
+ * # Strict Contextual Escaping
+ *
+ * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain
+ * contexts to result in a value that is marked as safe to use for that context. One example of
+ * such a context is binding arbitrary html controlled by the user via `ng-bind-html`. We refer
+ * to these contexts as privileged or SCE contexts.
+ *
+ * As of version 1.2, Angular ships with SCE enabled by default.
+ *
+ * Note: When enabled (the default), IE8 in quirks mode is not supported. In this mode, IE8 allows
+ * one to execute arbitrary javascript by the use of the expression() syntax. Refer
+ * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them.
+ * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>`
+ * to the top of your HTML document.
+ *
+ * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for
+ * security vulnerabilities such as XSS, clickjacking, etc. a lot easier.
+ *
+ * Here's an example of a binding in a privileged context:
+ *
+ * ```
+ * <input ng-model="userHtml">
+ * <div ng-bind-html="userHtml"></div>
+ * ```
+ *
+ * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user. With SCE
+ * disabled, this application allows the user to render arbitrary HTML into the DIV.
+ * In a more realistic example, one may be rendering user comments, blog articles, etc. via
+ * bindings. (HTML is just one example of a context where rendering user controlled input creates
+ * security vulnerabilities.)
+ *
+ * For the case of HTML, you might use a library, either on the client side, or on the server side,
+ * to sanitize unsafe HTML before binding to the value and rendering it in the document.
+ *
+ * How would you ensure that every place that used these types of bindings was bound to a value that
+ * was sanitized by your library (or returned as safe for rendering by your server?) How can you
+ * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some
+ * properties/fields and forgot to update the binding to the sanitized value?
+ *
+ * To be secure by default, you want to ensure that any such bindings are disallowed unless you can
+ * determine that something explicitly says it's safe to use a value for binding in that
+ * context. You can then audit your code (a simple grep would do) to ensure that this is only done
+ * for those values that you can easily tell are safe - because they were received from your server,
+ * sanitized by your library, etc. You can organize your codebase to help with this - perhaps
+ * allowing only the files in a specific directory to do this. Ensuring that the internal API
+ * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.
+ *
+ * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}
+ * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to
+ * obtain values that will be accepted by SCE / privileged contexts.
+ *
+ *
+ * ## How does it work?
+ *
+ * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted
+ * $sce.getTrusted(context, value)} rather than to the value directly. Directives use {@link
+ * ng.$sce#parse $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the
+ * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.
+ *
+ * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link
+ * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly
+ * simplified):
+ *
+ * ```
+ * var ngBindHtmlDirective = ['$sce', function($sce) {
+ * return function(scope, element, attr) {
+ * scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {
+ * element.html(value || '');
+ * });
+ * };
+ * }];
+ * ```
+ *
+ * ## Impact on loading templates
+ *
+ * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as
+ * `templateUrl`'s specified by {@link guide/directive directives}.
+ *
+ * By default, Angular only loads templates from the same domain and protocol as the application
+ * document. This is done by calling {@link ng.$sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl} on the template URL. To load templates from other domains and/or
+ * protocols, you may either either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist
+ * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.
+ *
+ * *Please note*:
+ * The browser's
+ * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+ * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
+ * policy apply in addition to this and may further restrict whether the template is successfully
+ * loaded. This means that without the right CORS policy, loading templates from a different domain
+ * won't work on all browsers. Also, loading templates from `file://` URL does not work on some
+ * browsers.
+ *
+ * ## This feels like too much overhead for the developer?
+ *
+ * It's important to remember that SCE only applies to interpolation expressions.
+ *
+ * If your expressions are constant literals, they're automatically trusted and you don't need to
+ * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g.
+ * `<div ng-bind-html="'<b>implicitly trusted</b>'"></div>`) just works.
+ *
+ * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them
+ * through {@link ng.$sce#getTrusted $sce.getTrusted}. SCE doesn't play a role here.
+ *
+ * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load
+ * templates in `ng-include` from your application's domain without having to even know about SCE.
+ * It blocks loading templates from other domains or loading templates over http from an https
+ * served document. You can change these by setting your own custom {@link
+ * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link
+ * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs.
+ *
+ * This significantly reduces the overhead. It is far easier to pay the small overhead and have an
+ * application that's secure and can be audited to verify that with much more ease than bolting
+ * security onto an application later.
+ *
+ * <a name="contexts"></a>
+ * ## What trusted context types are supported?
+ *
+ * | Context | Notes |
+ * |---------------------|----------------|
+ * | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. |
+ * | `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. |
+ * | `$sce.URL` | For URLs that are safe to follow as links. Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |
+ * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application. Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.) <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |
+ * | `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. |
+ *
+ * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name="resourceUrlPatternItem"></a>
+ *
+ * Each element in these arrays must be one of the following:
+ *
+ * - **'self'**
+ * - The special **string**, `'self'`, can be used to match against all URLs of the **same
+ * domain** as the application document using the **same protocol**.
+ * - **String** (except the special value `'self'`)
+ * - The string is matched against the full *normalized / absolute URL* of the resource
+ * being tested (substring matches are not good enough.)
+ * - There are exactly **two wildcard sequences** - `*` and `**`. All other characters
+ * match themselves.
+ * - `*`: matches zero or more occurrences of any character other than one of the following 6
+ * characters: '`:`', '`/`', '`.`', '`?`', '`&`' and ';'. It's a useful wildcard for use
+ * in a whitelist.
+ * - `**`: matches zero or more occurrences of *any* character. As such, it's not
+ * not appropriate to use in for a scheme, domain, etc. as it would match too much. (e.g.
+ * http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might
+ * not have been the intention.) Its usage at the very end of the path is ok. (e.g.
+ * http://foo.example.com/templates/**).
+ * - **RegExp** (*see caveat below*)
+ * - *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax
+ * (and all the inevitable escaping) makes them *harder to maintain*. It's easy to
+ * accidentally introduce a bug when one updates a complex expression (imho, all regexes should
+ * have good test coverage.). For instance, the use of `.` in the regex is correct only in a
+ * small number of cases. A `.` character in the regex used when matching the scheme or a
+ * subdomain could be matched against a `:` or literal `.` that was likely not intended. It
+ * is highly recommended to use the string patterns and only fall back to regular expressions
+ * if they as a last resort.
+ * - The regular expression must be an instance of RegExp (i.e. not a string.) It is
+ * matched against the **entire** *normalized / absolute URL* of the resource being tested
+ * (even when the RegExp did not have the `^` and `$` codes.) In addition, any flags
+ * present on the RegExp (such as multiline, global, ignoreCase) are ignored.
+ * - If you are generating your JavaScript from some other templating engine (not
+ * recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)),
+ * remember to escape your regular expression (and be aware that you might need more than
+ * one level of escaping depending on your templating engine and the way you interpolated
+ * the value.) Do make use of your platform's escaping mechanism as it might be good
+ * enough before coding your own. e.g. Ruby has
+ * [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape)
+ * and Python has [re.escape](http://docs.python.org/library/re.html#re.escape).
+ * Javascript lacks a similar built in function for escaping. Take a look at Google
+ * Closure library's [goog.string.regExpEscape(s)](
+ * http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962).
+ *
+ * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example.
+ *
+ * ## Show me an example using SCE.
+ *
+ * <example module="mySceApp" deps="angular-sanitize.js">
+ * <file name="index.html">
+ * <div ng-controller="myAppController as myCtrl">
+ * <i ng-bind-html="myCtrl.explicitlyTrustedHtml" id="explicitlyTrustedHtml"></i><br><br>
+ * <b>User comments</b><br>
+ * By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when
+ * $sanitize is available. If $sanitize isn't available, this results in an error instead of an
+ * exploit.
+ * <div class="well">
+ * <div ng-repeat="userComment in myCtrl.userComments">
+ * <b>{{userComment.name}}</b>:
+ * <span ng-bind-html="userComment.htmlComment" class="htmlComment"></span>
+ * <br>
+ * </div>
+ * </div>
+ * </div>
+ * </file>
+ *
+ * <file name="script.js">
+ * var mySceApp = angular.module('mySceApp', ['ngSanitize']);
+ *
+ * mySceApp.controller("myAppController", function myAppController($http, $templateCache, $sce) {
+ * var self = this;
+ * $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) {
+ * self.userComments = userComments;
+ * });
+ * self.explicitlyTrustedHtml = $sce.trustAsHtml(
+ * '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
+ * 'sanitization.&quot;">Hover over this text.</span>');
+ * });
+ * </file>
+ *
+ * <file name="test_data.json">
+ * [
+ * { "name": "Alice",
+ * "htmlComment":
+ * "<span onmouseover='this.textContent=\"PWN3D!\"'>Is <i>anyone</i> reading this?</span>"
+ * },
+ * { "name": "Bob",
+ * "htmlComment": "<i>Yes!</i> Am I the only other one?"
+ * }
+ * ]
+ * </file>
+ *
+ * <file name="protractor.js" type="protractor">
+ * describe('SCE doc demo', function() {
+ * it('should sanitize untrusted values', function() {
+ * expect(element.all(by.css('.htmlComment')).first().getInnerHtml())
+ * .toBe('<span>Is <i>anyone</i> reading this?</span>');
+ * });
+ *
+ * it('should NOT sanitize explicitly trusted values', function() {
+ * expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(
+ * '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
+ * 'sanitization.&quot;">Hover over this text.</span>');
+ * });
+ * });
+ * </file>
+ * </example>
+ *
+ *
+ *
+ * ## Can I disable SCE completely?
+ *
+ * Yes, you can. However, this is strongly discouraged. SCE gives you a lot of security benefits
+ * for little coding overhead. It will be much harder to take an SCE disabled application and
+ * either secure it on your own or enable SCE at a later stage. It might make sense to disable SCE
+ * for cases where you have a lot of existing code that was written before SCE was introduced and
+ * you're migrating them a module at a time.
+ *
+ * That said, here's how you can completely disable SCE:
+ *
+ * ```
+ * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
+ * // Completely disable SCE. For demonstration purposes only!
+ * // Do not use in new projects.
+ * $sceProvider.enabled(false);
+ * });
+ * ```
+ *
+ */
+/* jshint maxlen: 100 */
+
+function $SceProvider() {
+ var enabled = true;
+
+ /**
+ * @ngdoc method
+ * @name $sceProvider#enabled
+ * @kind function
+ *
+ * @param {boolean=} value If provided, then enables/disables SCE.
+ * @return {boolean} true if SCE is enabled, false otherwise.
+ *
+ * @description
+ * Enables/disables SCE and returns the current value.
+ */
+ this.enabled = function (value) {
+ if (arguments.length) {
+ enabled = !!value;
+ }
+ return enabled;
+ };
+
+
+ /* Design notes on the default implementation for SCE.
+ *
+ * The API contract for the SCE delegate
+ * -------------------------------------
+ * The SCE delegate object must provide the following 3 methods:
+ *
+ * - trustAs(contextEnum, value)
+ * This method is used to tell the SCE service that the provided value is OK to use in the
+ * contexts specified by contextEnum. It must return an object that will be accepted by
+ * getTrusted() for a compatible contextEnum and return this value.
+ *
+ * - valueOf(value)
+ * For values that were not produced by trustAs(), return them as is. For values that were
+ * produced by trustAs(), return the corresponding input value to trustAs. Basically, if
+ * trustAs is wrapping the given values into some type, this operation unwraps it when given
+ * such a value.
+ *
+ * - getTrusted(contextEnum, value)
+ * This function should return the a value that is safe to use in the context specified by
+ * contextEnum or throw and exception otherwise.
+ *
+ * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be
+ * opaque or wrapped in some holder object. That happens to be an implementation detail. For
+ * instance, an implementation could maintain a registry of all trusted objects by context. In
+ * such a case, trustAs() would return the same object that was passed in. getTrusted() would
+ * return the same object passed in if it was found in the registry under a compatible context or
+ * throw an exception otherwise. An implementation might only wrap values some of the time based
+ * on some criteria. getTrusted() might return a value and not throw an exception for special
+ * constants or objects even if not wrapped. All such implementations fulfill this contract.
+ *
+ *
+ * A note on the inheritance model for SCE contexts
+ * ------------------------------------------------
+ * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types. This
+ * is purely an implementation details.
+ *
+ * The contract is simply this:
+ *
+ * getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value)
+ * will also succeed.
+ *
+ * Inheritance happens to capture this in a natural way. In some future, we
+ * may not use inheritance anymore. That is OK because no code outside of
+ * sce.js and sceSpecs.js would need to be aware of this detail.
+ */
+
+ this.$get = ['$parse', '$sniffer', '$sceDelegate', function(
+ $parse, $sniffer, $sceDelegate) {
+ // Prereq: Ensure that we're not running in IE8 quirks mode. In that mode, IE allows
+ // the "expression(javascript expression)" syntax which is insecure.
+ if (enabled && $sniffer.msie && $sniffer.msieDocumentMode < 8) {
+ throw $sceMinErr('iequirks',
+ 'Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks ' +
+ 'mode. You can fix this by adding the text <!doctype html> to the top of your HTML ' +
+ 'document. See http://docs.angularjs.org/api/ng.$sce for more information.');
+ }
+
+ var sce = shallowCopy(SCE_CONTEXTS);
+
+ /**
+ * @ngdoc method
+ * @name $sce#isEnabled
+ * @kind function
+ *
+ * @return {Boolean} true if SCE is enabled, false otherwise. If you want to set the value, you
+ * have to do it at module config time on {@link ng.$sceProvider $sceProvider}.
+ *
+ * @description
+ * Returns a boolean indicating if SCE is enabled.
+ */
+ sce.isEnabled = function () {
+ return enabled;
+ };
+ sce.trustAs = $sceDelegate.trustAs;
+ sce.getTrusted = $sceDelegate.getTrusted;
+ sce.valueOf = $sceDelegate.valueOf;
+
+ if (!enabled) {
+ sce.trustAs = sce.getTrusted = function(type, value) { return value; };
+ sce.valueOf = identity;
+ }
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAs
+ *
+ * @description
+ * Converts Angular {@link guide/expression expression} into a function. This is like {@link
+ * ng.$parse $parse} and is identical when the expression is a literal constant. Otherwise, it
+ * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,
+ * *result*)}
+ *
+ * @param {string} type The kind of SCE context in which this result will be used.
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+ sce.parseAs = function sceParseAs(type, expr) {
+ var parsed = $parse(expr);
+ if (parsed.literal && parsed.constant) {
+ return parsed;
+ } else {
+ return function sceParseAsTrusted(self, locals) {
+ return sce.getTrusted(type, parsed(self, locals));
+ };
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAs
+ *
+ * @description
+ * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. As such,
+ * returns an object that is trusted by angular for use in specified strict contextual
+ * escaping contexts (such as ng-bind-html, ng-include, any src attribute
+ * interpolation, any dom event binding attribute interpolation such as for onclick, etc.)
+ * that uses the provided value. See * {@link ng.$sce $sce} for enabling strict contextual
+ * escaping.
+ *
+ * @param {string} type The kind of context in which this value is safe for use. e.g. url,
+ * resource_url, html, js and css.
+ * @param {*} value The value that that should be considered trusted/safe.
+ * @returns {*} A value that can be used to stand in for the provided `value` in places
+ * where Angular expects a $sce.trustAs() return value.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsHtml
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsHtml(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml
+ * $sce.getTrustedHtml(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsUrl
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsUrl(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl
+ * $sce.getTrustedUrl(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsResourceUrl
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsResourceUrl(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the return
+ * value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsJs
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsJs(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs
+ * $sce.getTrustedJs(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrusted
+ *
+ * @description
+ * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}. As such,
+ * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the
+ * originally supplied value if the queried context type is a supertype of the created type.
+ * If this condition isn't satisfied, throws an exception.
+ *
+ * @param {string} type The kind of context in which this value is to be used.
+ * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}
+ * call.
+ * @returns {*} The value the was originally provided to
+ * {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.
+ * Otherwise, throws an exception.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedHtml
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedHtml(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedCss
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedCss(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedUrl
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedUrl(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedResourceUrl
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedResourceUrl(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}
+ *
+ * @param {*} value The value to pass to `$sceDelegate.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedJs
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedJs(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsHtml
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsHtml(expression string)` →
+ * {@link ng.$sce#parse `$sce.parseAs($sce.HTML, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsCss
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsCss(value)` →
+ * {@link ng.$sce#parse `$sce.parseAs($sce.CSS, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsUrl
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsUrl(value)` →
+ * {@link ng.$sce#parse `$sce.parseAs($sce.URL, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsResourceUrl
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsResourceUrl(value)` →
+ * {@link ng.$sce#parse `$sce.parseAs($sce.RESOURCE_URL, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsJs
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsJs(value)` →
+ * {@link ng.$sce#parse `$sce.parseAs($sce.JS, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ // Shorthand delegations.
+ var parse = sce.parseAs,
+ getTrusted = sce.getTrusted,
+ trustAs = sce.trustAs;
+
+ forEach(SCE_CONTEXTS, function (enumValue, name) {
+ var lName = lowercase(name);
+ sce[camelCase("parse_as_" + lName)] = function (expr) {
+ return parse(enumValue, expr);
+ };
+ sce[camelCase("get_trusted_" + lName)] = function (value) {
+ return getTrusted(enumValue, value);
+ };
+ sce[camelCase("trust_as_" + lName)] = function (value) {
+ return trustAs(enumValue, value);
+ };
+ });
+
+ return sce;
+ }];
+}
+
+/**
+ * !!! This is an undocumented "private" service !!!
+ *
+ * @name $sniffer
+ * @requires $window
+ * @requires $document
+ *
+ * @property {boolean} history Does the browser support html5 history api ?
+ * @property {boolean} hashchange Does the browser support hashchange event ?
+ * @property {boolean} transitions Does the browser support CSS transition events ?
+ * @property {boolean} animations Does the browser support CSS animation events ?
+ *
+ * @description
+ * This is very simple implementation of testing browser's features.
+ */
+function $SnifferProvider() {
+ this.$get = ['$window', '$document', function($window, $document) {
+ var eventSupport = {},
+ android =
+ int((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
+ boxee = /Boxee/i.test(($window.navigator || {}).userAgent),
+ document = $document[0] || {},
+ documentMode = document.documentMode,
+ vendorPrefix,
+ vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/,
+ bodyStyle = document.body && document.body.style,
+ transitions = false,
+ animations = false,
+ match;
+
+ if (bodyStyle) {
+ for(var prop in bodyStyle) {
+ if(match = vendorRegex.exec(prop)) {
+ vendorPrefix = match[0];
+ vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);
+ break;
+ }
+ }
+
+ if(!vendorPrefix) {
+ vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';
+ }
+
+ transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));
+ animations = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));
+
+ if (android && (!transitions||!animations)) {
+ transitions = isString(document.body.style.webkitTransition);
+ animations = isString(document.body.style.webkitAnimation);
+ }
+ }
+
+
+ return {
+ // Android has history.pushState, but it does not update location correctly
+ // so let's not use the history API at all.
+ // http://code.google.com/p/android/issues/detail?id=17471
+ // https://github.com/angular/angular.js/issues/904
+
+ // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has
+ // so let's not use the history API also
+ // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined
+ // jshint -W018
+ history: !!($window.history && $window.history.pushState && !(android < 4) && !boxee),
+ // jshint +W018
+ hashchange: 'onhashchange' in $window &&
+ // IE8 compatible mode lies
+ (!documentMode || documentMode > 7),
+ hasEvent: function(event) {
+ // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
+ // it. In particular the event is not fired when backspace or delete key are pressed or
+ // when cut operation is performed.
+ if (event == 'input' && msie == 9) return false;
+
+ if (isUndefined(eventSupport[event])) {
+ var divElm = document.createElement('div');
+ eventSupport[event] = 'on' + event in divElm;
+ }
+
+ return eventSupport[event];
+ },
+ csp: csp(),
+ vendorPrefix: vendorPrefix,
+ transitions : transitions,
+ animations : animations,
+ android: android,
+ msie : msie,
+ msieDocumentMode: documentMode
+ };
+ }];
+}
+
+function $TimeoutProvider() {
+ this.$get = ['$rootScope', '$browser', '$q', '$exceptionHandler',
+ function($rootScope, $browser, $q, $exceptionHandler) {
+ var deferreds = {};
+
+
+ /**
+ * @ngdoc service
+ * @name $timeout
+ *
+ * @description
+ * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch
+ * block and delegates any exceptions to
+ * {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * The return value of registering a timeout function is a promise, which will be resolved when
+ * the timeout is reached and the timeout function is executed.
+ *
+ * To cancel a timeout request, call `$timeout.cancel(promise)`.
+ *
+ * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to
+ * synchronously flush the queue of deferred functions.
+ *
+ * @param {function()} fn A function, whose execution should be delayed.
+ * @param {number=} [delay=0] Delay in milliseconds.
+ * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
+ * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
+ * @returns {Promise} Promise that will be resolved when the timeout is reached. The value this
+ * promise will be resolved with is the return value of the `fn` function.
+ *
+ */
+ function timeout(fn, delay, invokeApply) {
+ var deferred = $q.defer(),
+ promise = deferred.promise,
+ skipApply = (isDefined(invokeApply) && !invokeApply),
+ timeoutId;
+
+ timeoutId = $browser.defer(function() {
+ try {
+ deferred.resolve(fn());
+ } catch(e) {
+ deferred.reject(e);
+ $exceptionHandler(e);
+ }
+ finally {
+ delete deferreds[promise.$$timeoutId];
+ }
+
+ if (!skipApply) $rootScope.$apply();
+ }, delay);
+
+ promise.$$timeoutId = timeoutId;
+ deferreds[timeoutId] = deferred;
+
+ return promise;
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $timeout#cancel
+ *
+ * @description
+ * Cancels a task associated with the `promise`. As a result of this, the promise will be
+ * resolved with a rejection.
+ *
+ * @param {Promise=} promise Promise returned by the `$timeout` function.
+ * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
+ * canceled.
+ */
+ timeout.cancel = function(promise) {
+ if (promise && promise.$$timeoutId in deferreds) {
+ deferreds[promise.$$timeoutId].reject('canceled');
+ delete deferreds[promise.$$timeoutId];
+ return $browser.defer.cancel(promise.$$timeoutId);
+ }
+ return false;
+ };
+
+ return timeout;
+ }];
+}
+
+// NOTE: The usage of window and document instead of $window and $document here is
+// deliberate. This service depends on the specific behavior of anchor nodes created by the
+// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and
+// cause us to break tests. In addition, when the browser resolves a URL for XHR, it
+// doesn't know about mocked locations and resolves URLs to the real document - which is
+// exactly the behavior needed here. There is little value is mocking these out for this
+// service.
+var urlParsingNode = document.createElement("a");
+var originUrl = urlResolve(window.location.href, true);
+
+
+/**
+ *
+ * Implementation Notes for non-IE browsers
+ * ----------------------------------------
+ * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,
+ * results both in the normalizing and parsing of the URL. Normalizing means that a relative
+ * URL will be resolved into an absolute URL in the context of the application document.
+ * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related
+ * properties are all populated to reflect the normalized URL. This approach has wide
+ * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See
+ * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
+ *
+ * Implementation Notes for IE
+ * ---------------------------
+ * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other
+ * browsers. However, the parsed components will not be set if the URL assigned did not specify
+ * them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We
+ * work around that by performing the parsing in a 2nd step by taking a previously normalized
+ * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the
+ * properties such as protocol, hostname, port, etc.
+ *
+ * IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one
+ * uses the inner HTML approach to assign the URL as part of an HTML snippet -
+ * http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL.
+ * Unfortunately, setting img[src] to something like "javascript:foo" on IE throws an exception.
+ * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that
+ * method and IE < 8 is unsupported.
+ *
+ * References:
+ * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement
+ * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
+ * http://url.spec.whatwg.org/#urlutils
+ * https://github.com/angular/angular.js/pull/2902
+ * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
+ *
+ * @kind function
+ * @param {string} url The URL to be parsed.
+ * @description Normalizes and parses a URL.
+ * @returns {object} Returns the normalized URL as a dictionary.
+ *
+ * | member name | Description |
+ * |---------------|----------------|
+ * | href | A normalized version of the provided URL if it was not an absolute URL |
+ * | protocol | The protocol including the trailing colon |
+ * | host | The host and port (if the port is non-default) of the normalizedUrl |
+ * | search | The search params, minus the question mark |
+ * | hash | The hash string, minus the hash symbol
+ * | hostname | The hostname
+ * | port | The port, without ":"
+ * | pathname | The pathname, beginning with "/"
+ *
+ */
+function urlResolve(url, base) {
+ var href = url;
+
+ if (msie) {
+ // Normalize before parse. Refer Implementation Notes on why this is
+ // done in two steps on IE.
+ urlParsingNode.setAttribute("href", href);
+ href = urlParsingNode.href;
+ }
+
+ urlParsingNode.setAttribute('href', href);
+
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
+ return {
+ href: urlParsingNode.href,
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
+ host: urlParsingNode.host,
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
+ hostname: urlParsingNode.hostname,
+ port: urlParsingNode.port,
+ pathname: (urlParsingNode.pathname.charAt(0) === '/')
+ ? urlParsingNode.pathname
+ : '/' + urlParsingNode.pathname
+ };
+}
+
+/**
+ * Parse a request URL and determine whether this is a same-origin request as the application document.
+ *
+ * @param {string|object} requestUrl The url of the request as a string that will be resolved
+ * or a parsed URL object.
+ * @returns {boolean} Whether the request is for the same origin as the application document.
+ */
+function urlIsSameOrigin(requestUrl) {
+ var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;
+ return (parsed.protocol === originUrl.protocol &&
+ parsed.host === originUrl.host);
+}
+
+/**
+ * @ngdoc service
+ * @name $window
+ *
+ * @description
+ * A reference to the browser's `window` object. While `window`
+ * is globally available in JavaScript, it causes testability problems, because
+ * it is a global variable. In angular we always refer to it through the
+ * `$window` service, so it may be overridden, removed or mocked for testing.
+ *
+ * Expressions, like the one defined for the `ngClick` directive in the example
+ * below, are evaluated with respect to the current scope. Therefore, there is
+ * no risk of inadvertently coding in a dependency on a global value in such an
+ * expression.
+ *
+ * @example
+ <example module="windowExample">
+ <file name="index.html">
+ <script>
+ angular.module('windowExample', [])
+ .controller('ExampleController', ['$scope', '$window', function ($scope, $window) {
+ $scope.greeting = 'Hello, World!';
+ $scope.doGreeting = function(greeting) {
+ $window.alert(greeting);
+ };
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <input type="text" ng-model="greeting" />
+ <button ng-click="doGreeting(greeting)">ALERT</button>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should display the greeting in the input box', function() {
+ element(by.model('greeting')).sendKeys('Hello, E2E Tests');
+ // If we click the button it will block the test runner
+ // element(':button').click();
+ });
+ </file>
+ </example>
+ */
+function $WindowProvider(){
+ this.$get = valueFn(window);
+}
+
+/* global currencyFilter: true,
+ dateFilter: true,
+ filterFilter: true,
+ jsonFilter: true,
+ limitToFilter: true,
+ lowercaseFilter: true,
+ numberFilter: true,
+ orderByFilter: true,
+ uppercaseFilter: true,
+ */
+
+/**
+ * @ngdoc provider
+ * @name $filterProvider
+ * @description
+ *
+ * Filters are just functions which transform input to an output. However filters need to be
+ * Dependency Injected. To achieve this a filter definition consists of a factory function which is
+ * annotated with dependencies and is responsible for creating a filter function.
+ *
+ * ```js
+ * // Filter registration
+ * function MyModule($provide, $filterProvider) {
+ * // create a service to demonstrate injection (not always needed)
+ * $provide.value('greet', function(name){
+ * return 'Hello ' + name + '!';
+ * });
+ *
+ * // register a filter factory which uses the
+ * // greet service to demonstrate DI.
+ * $filterProvider.register('greet', function(greet){
+ * // return the filter function which uses the greet service
+ * // to generate salutation
+ * return function(text) {
+ * // filters need to be forgiving so check input validity
+ * return text && greet(text) || text;
+ * };
+ * });
+ * }
+ * ```
+ *
+ * The filter function is registered with the `$injector` under the filter name suffix with
+ * `Filter`.
+ *
+ * ```js
+ * it('should be the same instance', inject(
+ * function($filterProvider) {
+ * $filterProvider.register('reverse', function(){
+ * return ...;
+ * });
+ * },
+ * function($filter, reverseFilter) {
+ * expect($filter('reverse')).toBe(reverseFilter);
+ * });
+ * ```
+ *
+ *
+ * For more information about how angular filters work, and how to create your own filters, see
+ * {@link guide/filter Filters} in the Angular Developer Guide.
+ */
+
+/**
+ * @ngdoc service
+ * @name $filter
+ * @kind function
+ * @description
+ * Filters are used for formatting data displayed to the user.
+ *
+ * The general syntax in templates is as follows:
+ *
+ * {{ expression [| filter_name[:parameter_value] ... ] }}
+ *
+ * @param {String} name Name of the filter function to retrieve
+ * @return {Function} the filter function
+ * @example
+ <example name="$filter" module="filterExample">
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <h3>{{ originalText }}</h3>
+ <h3>{{ filteredText }}</h3>
+ </div>
+ </file>
+
+ <file name="script.js">
+ angular.module('filterExample', [])
+ .controller('MainCtrl', function($scope, $filter) {
+ $scope.originalText = 'hello';
+ $scope.filteredText = $filter('uppercase')($scope.originalText);
+ });
+ </file>
+ </example>
+ */
+$FilterProvider.$inject = ['$provide'];
+function $FilterProvider($provide) {
+ var suffix = 'Filter';
+
+ /**
+ * @ngdoc method
+ * @name $filterProvider#register
+ * @param {string|Object} name Name of the filter function, or an object map of filters where
+ * the keys are the filter names and the values are the filter factories.
+ * @returns {Object} Registered filter instance, or if a map of filters was provided then a map
+ * of the registered filter instances.
+ */
+ function register(name, factory) {
+ if(isObject(name)) {
+ var filters = {};
+ forEach(name, function(filter, key) {
+ filters[key] = register(key, filter);
+ });
+ return filters;
+ } else {
+ return $provide.factory(name + suffix, factory);
+ }
+ }
+ this.register = register;
+
+ this.$get = ['$injector', function($injector) {
+ return function(name) {
+ return $injector.get(name + suffix);
+ };
+ }];
+
+ ////////////////////////////////////////
+
+ /* global
+ currencyFilter: false,
+ dateFilter: false,
+ filterFilter: false,
+ jsonFilter: false,
+ limitToFilter: false,
+ lowercaseFilter: false,
+ numberFilter: false,
+ orderByFilter: false,
+ uppercaseFilter: false,
+ */
+
+ register('currency', currencyFilter);
+ register('date', dateFilter);
+ register('filter', filterFilter);
+ register('json', jsonFilter);
+ register('limitTo', limitToFilter);
+ register('lowercase', lowercaseFilter);
+ register('number', numberFilter);
+ register('orderBy', orderByFilter);
+ register('uppercase', uppercaseFilter);
+}
+
+/**
+ * @ngdoc filter
+ * @name filter
+ * @kind function
+ *
+ * @description
+ * Selects a subset of items from `array` and returns it as a new array.
+ *
+ * @param {Array} array The source array.
+ * @param {string|Object|function()} expression The predicate to be used for selecting items from
+ * `array`.
+ *
+ * Can be one of:
+ *
+ * - `string`: The string is evaluated as an expression and the resulting value is used for substring match against
+ * the contents of the `array`. All strings or objects with string properties in `array` that contain this string
+ * will be returned. The predicate can be negated by prefixing the string with `!`.
+ *
+ * - `Object`: A pattern object can be used to filter specific properties on objects contained
+ * by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items
+ * which have property `name` containing "M" and property `phone` containing "1". A special
+ * property name `$` can be used (as in `{$:"text"}`) to accept a match against any
+ * property of the object. That's equivalent to the simple substring match with a `string`
+ * as described above. The predicate can be negated by prefixing the string with `!`.
+ * For Example `{name: "!M"}` predicate will return an array of items which have property `name`
+ * not containing "M".
+ *
+ * - `function(value)`: A predicate function can be used to write arbitrary filters. The function is
+ * called for each element of `array`. The final result is an array of those elements that
+ * the predicate returned true for.
+ *
+ * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in
+ * determining if the expected value (from the filter expression) and actual value (from
+ * the object in the array) should be considered a match.
+ *
+ * Can be one of:
+ *
+ * - `function(actual, expected)`:
+ * The function will be given the object value and the predicate value to compare and
+ * should return true if the item should be included in filtered result.
+ *
+ * - `true`: A shorthand for `function(actual, expected) { return angular.equals(expected, actual)}`.
+ * this is essentially strict comparison of expected and actual.
+ *
+ * - `false|undefined`: A short hand for a function which will look for a substring match in case
+ * insensitive way.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <div ng-init="friends = [{name:'John', phone:'555-1276'},
+ {name:'Mary', phone:'800-BIG-MARY'},
+ {name:'Mike', phone:'555-4321'},
+ {name:'Adam', phone:'555-5678'},
+ {name:'Julie', phone:'555-8765'},
+ {name:'Juliette', phone:'555-5678'}]"></div>
+
+ Search: <input ng-model="searchText">
+ <table id="searchTextResults">
+ <tr><th>Name</th><th>Phone</th></tr>
+ <tr ng-repeat="friend in friends | filter:searchText">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ </tr>
+ </table>
+ <hr>
+ Any: <input ng-model="search.$"> <br>
+ Name only <input ng-model="search.name"><br>
+ Phone only <input ng-model="search.phone"><br>
+ Equality <input type="checkbox" ng-model="strict"><br>
+ <table id="searchObjResults">
+ <tr><th>Name</th><th>Phone</th></tr>
+ <tr ng-repeat="friendObj in friends | filter:search:strict">
+ <td>{{friendObj.name}}</td>
+ <td>{{friendObj.phone}}</td>
+ </tr>
+ </table>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var expectFriendNames = function(expectedNames, key) {
+ element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) {
+ arr.forEach(function(wd, i) {
+ expect(wd.getText()).toMatch(expectedNames[i]);
+ });
+ });
+ };
+
+ it('should search across all fields when filtering with a string', function() {
+ var searchText = element(by.model('searchText'));
+ searchText.clear();
+ searchText.sendKeys('m');
+ expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend');
+
+ searchText.clear();
+ searchText.sendKeys('76');
+ expectFriendNames(['John', 'Julie'], 'friend');
+ });
+
+ it('should search in specific fields when filtering with a predicate object', function() {
+ var searchAny = element(by.model('search.$'));
+ searchAny.clear();
+ searchAny.sendKeys('i');
+ expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj');
+ });
+ it('should use a equal comparison when comparator is true', function() {
+ var searchName = element(by.model('search.name'));
+ var strict = element(by.model('strict'));
+ searchName.clear();
+ searchName.sendKeys('Julie');
+ strict.click();
+ expectFriendNames(['Julie'], 'friendObj');
+ });
+ </file>
+ </example>
+ */
+function filterFilter() {
+ return function(array, expression, comparator) {
+ if (!isArray(array)) return array;
+
+ var comparatorType = typeof(comparator),
+ predicates = [];
+
+ predicates.check = function(value) {
+ for (var j = 0; j < predicates.length; j++) {
+ if(!predicates[j](value)) {
+ return false;
+ }
+ }
+ return true;
+ };
+
+ if (comparatorType !== 'function') {
+ if (comparatorType === 'boolean' && comparator) {
+ comparator = function(obj, text) {
+ return angular.equals(obj, text);
+ };
+ } else {
+ comparator = function(obj, text) {
+ if (obj && text && typeof obj === 'object' && typeof text === 'object') {
+ for (var objKey in obj) {
+ if (objKey.charAt(0) !== '$' && hasOwnProperty.call(obj, objKey) &&
+ comparator(obj[objKey], text[objKey])) {
+ return true;
+ }
+ }
+ return false;
+ }
+ text = (''+text).toLowerCase();
+ return (''+obj).toLowerCase().indexOf(text) > -1;
+ };
+ }
+ }
+
+ var search = function(obj, text){
+ if (typeof text == 'string' && text.charAt(0) === '!') {
+ return !search(obj, text.substr(1));
+ }
+ switch (typeof obj) {
+ case "boolean":
+ case "number":
+ case "string":
+ return comparator(obj, text);
+ case "object":
+ switch (typeof text) {
+ case "object":
+ return comparator(obj, text);
+ default:
+ for ( var objKey in obj) {
+ if (objKey.charAt(0) !== '$' && search(obj[objKey], text)) {
+ return true;
+ }
+ }
+ break;
+ }
+ return false;
+ case "array":
+ for ( var i = 0; i < obj.length; i++) {
+ if (search(obj[i], text)) {
+ return true;
+ }
+ }
+ return false;
+ default:
+ return false;
+ }
+ };
+ switch (typeof expression) {
+ case "boolean":
+ case "number":
+ case "string":
+ // Set up expression object and fall through
+ expression = {$:expression};
+ // jshint -W086
+ case "object":
+ // jshint +W086
+ for (var key in expression) {
+ (function(path) {
+ if (typeof expression[path] === 'undefined') return;
+ predicates.push(function(value) {
+ return search(path == '$' ? value : (value && value[path]), expression[path]);
+ });
+ })(key);
+ }
+ break;
+ case 'function':
+ predicates.push(expression);
+ break;
+ default:
+ return array;
+ }
+ var filtered = [];
+ for ( var j = 0; j < array.length; j++) {
+ var value = array[j];
+ if (predicates.check(value)) {
+ filtered.push(value);
+ }
+ }
+ return filtered;
+ };
+}
+
+/**
+ * @ngdoc filter
+ * @name currency
+ * @kind function
+ *
+ * @description
+ * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default
+ * symbol for current locale is used.
+ *
+ * @param {number} amount Input to filter.
+ * @param {string=} symbol Currency symbol or identifier to be displayed.
+ * @returns {string} Formatted number.
+ *
+ *
+ * @example
+ <example module="currencyExample">
+ <file name="index.html">
+ <script>
+ angular.module('currencyExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.amount = 1234.56;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <input type="number" ng-model="amount"> <br>
+ default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br>
+ custom currency identifier (USD$): <span>{{amount | currency:"USD$"}}</span>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should init with 1234.56', function() {
+ expect(element(by.id('currency-default')).getText()).toBe('$1,234.56');
+ expect(element(by.binding('amount | currency:"USD$"')).getText()).toBe('USD$1,234.56');
+ });
+ it('should update', function() {
+ if (browser.params.browser == 'safari') {
+ // Safari does not understand the minus key. See
+ // https://github.com/angular/protractor/issues/481
+ return;
+ }
+ element(by.model('amount')).clear();
+ element(by.model('amount')).sendKeys('-1234');
+ expect(element(by.id('currency-default')).getText()).toBe('($1,234.00)');
+ expect(element(by.binding('amount | currency:"USD$"')).getText()).toBe('(USD$1,234.00)');
+ });
+ </file>
+ </example>
+ */
+currencyFilter.$inject = ['$locale'];
+function currencyFilter($locale) {
+ var formats = $locale.NUMBER_FORMATS;
+ return function(amount, currencySymbol){
+ if (isUndefined(currencySymbol)) currencySymbol = formats.CURRENCY_SYM;
+ return formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, 2).
+ replace(/\u00A4/g, currencySymbol);
+ };
+}
+
+/**
+ * @ngdoc filter
+ * @name number
+ * @kind function
+ *
+ * @description
+ * Formats a number as text.
+ *
+ * If the input is not a number an empty string is returned.
+ *
+ * @param {number|string} number Number to format.
+ * @param {(number|string)=} fractionSize Number of decimal places to round the number to.
+ * If this is not provided then the fraction size is computed from the current locale's number
+ * formatting pattern. In the case of the default locale, it will be 3.
+ * @returns {string} Number rounded to decimalPlaces and places a “,†after each third digit.
+ *
+ * @example
+ <example module="numberFilterExample">
+ <file name="index.html">
+ <script>
+ angular.module('numberFilterExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.val = 1234.56789;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ Enter number: <input ng-model='val'><br>
+ Default formatting: <span id='number-default'>{{val | number}}</span><br>
+ No fractions: <span>{{val | number:0}}</span><br>
+ Negative number: <span>{{-val | number:4}}</span>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should format numbers', function() {
+ expect(element(by.id('number-default')).getText()).toBe('1,234.568');
+ expect(element(by.binding('val | number:0')).getText()).toBe('1,235');
+ expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');
+ });
+
+ it('should update', function() {
+ element(by.model('val')).clear();
+ element(by.model('val')).sendKeys('3374.333');
+ expect(element(by.id('number-default')).getText()).toBe('3,374.333');
+ expect(element(by.binding('val | number:0')).getText()).toBe('3,374');
+ expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330');
+ });
+ </file>
+ </example>
+ */
+
+
+numberFilter.$inject = ['$locale'];
+function numberFilter($locale) {
+ var formats = $locale.NUMBER_FORMATS;
+ return function(number, fractionSize) {
+ return formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,
+ fractionSize);
+ };
+}
+
+var DECIMAL_SEP = '.';
+function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
+ if (number == null || !isFinite(number) || isObject(number)) return '';
+
+ var isNegative = number < 0;
+ number = Math.abs(number);
+ var numStr = number + '',
+ formatedText = '',
+ parts = [];
+
+ var hasExponent = false;
+ if (numStr.indexOf('e') !== -1) {
+ var match = numStr.match(/([\d\.]+)e(-?)(\d+)/);
+ if (match && match[2] == '-' && match[3] > fractionSize + 1) {
+ numStr = '0';
+ number = 0;
+ } else {
+ formatedText = numStr;
+ hasExponent = true;
+ }
+ }
+
+ if (!hasExponent) {
+ var fractionLen = (numStr.split(DECIMAL_SEP)[1] || '').length;
+
+ // determine fractionSize if it is not specified
+ if (isUndefined(fractionSize)) {
+ fractionSize = Math.min(Math.max(pattern.minFrac, fractionLen), pattern.maxFrac);
+ }
+
+ // safely round numbers in JS without hitting imprecisions of floating-point arithmetics
+ // inspired by:
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round
+ number = +(Math.round(+(number.toString() + 'e' + fractionSize)).toString() + 'e' + -fractionSize);
+
+ if (number === 0) {
+ isNegative = false;
+ }
+
+ var fraction = ('' + number).split(DECIMAL_SEP);
+ var whole = fraction[0];
+ fraction = fraction[1] || '';
+
+ var i, pos = 0,
+ lgroup = pattern.lgSize,
+ group = pattern.gSize;
+
+ if (whole.length >= (lgroup + group)) {
+ pos = whole.length - lgroup;
+ for (i = 0; i < pos; i++) {
+ if ((pos - i)%group === 0 && i !== 0) {
+ formatedText += groupSep;
+ }
+ formatedText += whole.charAt(i);
+ }
+ }
+
+ for (i = pos; i < whole.length; i++) {
+ if ((whole.length - i)%lgroup === 0 && i !== 0) {
+ formatedText += groupSep;
+ }
+ formatedText += whole.charAt(i);
+ }
+
+ // format fraction part.
+ while(fraction.length < fractionSize) {
+ fraction += '0';
+ }
+
+ if (fractionSize && fractionSize !== "0") formatedText += decimalSep + fraction.substr(0, fractionSize);
+ } else {
+
+ if (fractionSize > 0 && number > -1 && number < 1) {
+ formatedText = number.toFixed(fractionSize);
+ }
+ }
+
+ parts.push(isNegative ? pattern.negPre : pattern.posPre);
+ parts.push(formatedText);
+ parts.push(isNegative ? pattern.negSuf : pattern.posSuf);
+ return parts.join('');
+}
+
+function padNumber(num, digits, trim) {
+ var neg = '';
+ if (num < 0) {
+ neg = '-';
+ num = -num;
+ }
+ num = '' + num;
+ while(num.length < digits) num = '0' + num;
+ if (trim)
+ num = num.substr(num.length - digits);
+ return neg + num;
+}
+
+
+function dateGetter(name, size, offset, trim) {
+ offset = offset || 0;
+ return function(date) {
+ var value = date['get' + name]();
+ if (offset > 0 || value > -offset)
+ value += offset;
+ if (value === 0 && offset == -12 ) value = 12;
+ return padNumber(value, size, trim);
+ };
+}
+
+function dateStrGetter(name, shortForm) {
+ return function(date, formats) {
+ var value = date['get' + name]();
+ var get = uppercase(shortForm ? ('SHORT' + name) : name);
+
+ return formats[get][value];
+ };
+}
+
+function timeZoneGetter(date) {
+ var zone = -1 * date.getTimezoneOffset();
+ var paddedZone = (zone >= 0) ? "+" : "";
+
+ paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
+ padNumber(Math.abs(zone % 60), 2);
+
+ return paddedZone;
+}
+
+function ampmGetter(date, formats) {
+ return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];
+}
+
+var DATE_FORMATS = {
+ yyyy: dateGetter('FullYear', 4),
+ yy: dateGetter('FullYear', 2, 0, true),
+ y: dateGetter('FullYear', 1),
+ MMMM: dateStrGetter('Month'),
+ MMM: dateStrGetter('Month', true),
+ MM: dateGetter('Month', 2, 1),
+ M: dateGetter('Month', 1, 1),
+ dd: dateGetter('Date', 2),
+ d: dateGetter('Date', 1),
+ HH: dateGetter('Hours', 2),
+ H: dateGetter('Hours', 1),
+ hh: dateGetter('Hours', 2, -12),
+ h: dateGetter('Hours', 1, -12),
+ mm: dateGetter('Minutes', 2),
+ m: dateGetter('Minutes', 1),
+ ss: dateGetter('Seconds', 2),
+ s: dateGetter('Seconds', 1),
+ // while ISO 8601 requires fractions to be prefixed with `.` or `,`
+ // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions
+ sss: dateGetter('Milliseconds', 3),
+ EEEE: dateStrGetter('Day'),
+ EEE: dateStrGetter('Day', true),
+ a: ampmGetter,
+ Z: timeZoneGetter
+};
+
+var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,
+ NUMBER_STRING = /^\-?\d+$/;
+
+/**
+ * @ngdoc filter
+ * @name date
+ * @kind function
+ *
+ * @description
+ * Formats `date` to a string based on the requested `format`.
+ *
+ * `format` string can be composed of the following elements:
+ *
+ * * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)
+ * * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
+ * * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)
+ * * `'MMMM'`: Month in year (January-December)
+ * * `'MMM'`: Month in year (Jan-Dec)
+ * * `'MM'`: Month in year, padded (01-12)
+ * * `'M'`: Month in year (1-12)
+ * * `'dd'`: Day in month, padded (01-31)
+ * * `'d'`: Day in month (1-31)
+ * * `'EEEE'`: Day in Week,(Sunday-Saturday)
+ * * `'EEE'`: Day in Week, (Sun-Sat)
+ * * `'HH'`: Hour in day, padded (00-23)
+ * * `'H'`: Hour in day (0-23)
+ * * `'hh'`: Hour in am/pm, padded (01-12)
+ * * `'h'`: Hour in am/pm, (1-12)
+ * * `'mm'`: Minute in hour, padded (00-59)
+ * * `'m'`: Minute in hour (0-59)
+ * * `'ss'`: Second in minute, padded (00-59)
+ * * `'s'`: Second in minute (0-59)
+ * * `'.sss' or ',sss'`: Millisecond in second, padded (000-999)
+ * * `'a'`: am/pm marker
+ * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)
+ *
+ * `format` string can also be one of the following predefined
+ * {@link guide/i18n localizable formats}:
+ *
+ * * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale
+ * (e.g. Sep 3, 2010 12:05:08 pm)
+ * * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 pm)
+ * * `'fullDate'`: equivalent to `'EEEE, MMMM d,y'` for en_US locale
+ * (e.g. Friday, September 3, 2010)
+ * * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010)
+ * * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010)
+ * * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)
+ * * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 pm)
+ * * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 pm)
+ *
+ * `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g.
+ * `"h 'in the morning'"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence
+ * (e.g. `"h 'o''clock'"`).
+ *
+ * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
+ * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its
+ * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is
+ * specified in the string input, the time is considered to be in the local timezone.
+ * @param {string=} format Formatting rules (see Description). If not specified,
+ * `mediumDate` is used.
+ * @returns {string} Formatted string or the input if input is not recognized as date/millis.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:
+ <span>{{1288323623006 | date:'medium'}}</span><br>
+ <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:
+ <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>
+ <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:
+ <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>
+ <span ng-non-bindable>{{1288323623006 | date:"MM/dd/yyyy 'at' h:mma"}}</span>:
+ <span>{{'1288323623006' | date:"MM/dd/yyyy 'at' h:mma"}}</span><br>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should format date', function() {
+ expect(element(by.binding("1288323623006 | date:'medium'")).getText()).
+ toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/);
+ expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()).
+ toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/);
+ expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()).
+ toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
+ expect(element(by.binding("'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"")).getText()).
+ toMatch(/10\/2\d\/2010 at \d{1,2}:\d{2}(AM|PM)/);
+ });
+ </file>
+ </example>
+ */
+dateFilter.$inject = ['$locale'];
+function dateFilter($locale) {
+
+
+ var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
+ // 1 2 3 4 5 6 7 8 9 10 11
+ function jsonStringToDate(string) {
+ var match;
+ if (match = string.match(R_ISO8601_STR)) {
+ var date = new Date(0),
+ tzHour = 0,
+ tzMin = 0,
+ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,
+ timeSetter = match[8] ? date.setUTCHours : date.setHours;
+
+ if (match[9]) {
+ tzHour = int(match[9] + match[10]);
+ tzMin = int(match[9] + match[11]);
+ }
+ dateSetter.call(date, int(match[1]), int(match[2]) - 1, int(match[3]));
+ var h = int(match[4]||0) - tzHour;
+ var m = int(match[5]||0) - tzMin;
+ var s = int(match[6]||0);
+ var ms = Math.round(parseFloat('0.' + (match[7]||0)) * 1000);
+ timeSetter.call(date, h, m, s, ms);
+ return date;
+ }
+ return string;
+ }
+
+
+ return function(date, format) {
+ var text = '',
+ parts = [],
+ fn, match;
+
+ format = format || 'mediumDate';
+ format = $locale.DATETIME_FORMATS[format] || format;
+ if (isString(date)) {
+ date = NUMBER_STRING.test(date) ? int(date) : jsonStringToDate(date);
+ }
+
+ if (isNumber(date)) {
+ date = new Date(date);
+ }
+
+ if (!isDate(date)) {
+ return date;
+ }
+
+ while(format) {
+ match = DATE_FORMATS_SPLIT.exec(format);
+ if (match) {
+ parts = concat(parts, match, 1);
+ format = parts.pop();
+ } else {
+ parts.push(format);
+ format = null;
+ }
+ }
+
+ forEach(parts, function(value){
+ fn = DATE_FORMATS[value];
+ text += fn ? fn(date, $locale.DATETIME_FORMATS)
+ : value.replace(/(^'|'$)/g, '').replace(/''/g, "'");
+ });
+
+ return text;
+ };
+}
+
+
+/**
+ * @ngdoc filter
+ * @name json
+ * @kind function
+ *
+ * @description
+ * Allows you to convert a JavaScript object into JSON string.
+ *
+ * This filter is mostly useful for debugging. When using the double curly {{value}} notation
+ * the binding is automatically converted to JSON.
+ *
+ * @param {*} object Any JavaScript object (including arrays and primitive types) to filter.
+ * @returns {string} JSON string.
+ *
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <pre>{{ {'name':'value'} | json }}</pre>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should jsonify filtered objects', function() {
+ expect(element(by.binding("{'name':'value'}")).getText()).toMatch(/\{\n "name": ?"value"\n}/);
+ });
+ </file>
+ </example>
+ *
+ */
+function jsonFilter() {
+ return function(object) {
+ return toJson(object, true);
+ };
+}
+
+
+/**
+ * @ngdoc filter
+ * @name lowercase
+ * @kind function
+ * @description
+ * Converts string to lowercase.
+ * @see angular.lowercase
+ */
+var lowercaseFilter = valueFn(lowercase);
+
+
+/**
+ * @ngdoc filter
+ * @name uppercase
+ * @kind function
+ * @description
+ * Converts string to uppercase.
+ * @see angular.uppercase
+ */
+var uppercaseFilter = valueFn(uppercase);
+
+/**
+ * @ngdoc filter
+ * @name limitTo
+ * @kind function
+ *
+ * @description
+ * Creates a new array or string containing only a specified number of elements. The elements
+ * are taken from either the beginning or the end of the source array or string, as specified by
+ * the value and sign (positive or negative) of `limit`.
+ *
+ * @param {Array|string} input Source array or string to be limited.
+ * @param {string|number} limit The length of the returned array or string. If the `limit` number
+ * is positive, `limit` number of items from the beginning of the source array/string are copied.
+ * If the number is negative, `limit` number of items from the end of the source array/string
+ * are copied. The `limit` will be trimmed if it exceeds `array.length`
+ * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array
+ * had less than `limit` elements.
+ *
+ * @example
+ <example module="limitToExample">
+ <file name="index.html">
+ <script>
+ angular.module('limitToExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.numbers = [1,2,3,4,5,6,7,8,9];
+ $scope.letters = "abcdefghi";
+ $scope.numLimit = 3;
+ $scope.letterLimit = 3;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ Limit {{numbers}} to: <input type="integer" ng-model="numLimit">
+ <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>
+ Limit {{letters}} to: <input type="integer" ng-model="letterLimit">
+ <p>Output letters: {{ letters | limitTo:letterLimit }}</p>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var numLimitInput = element(by.model('numLimit'));
+ var letterLimitInput = element(by.model('letterLimit'));
+ var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));
+ var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));
+
+ it('should limit the number array to first three items', function() {
+ expect(numLimitInput.getAttribute('value')).toBe('3');
+ expect(letterLimitInput.getAttribute('value')).toBe('3');
+ expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');
+ expect(limitedLetters.getText()).toEqual('Output letters: abc');
+ });
+
+ it('should update the output when -3 is entered', function() {
+ numLimitInput.clear();
+ numLimitInput.sendKeys('-3');
+ letterLimitInput.clear();
+ letterLimitInput.sendKeys('-3');
+ expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');
+ expect(limitedLetters.getText()).toEqual('Output letters: ghi');
+ });
+
+ it('should not exceed the maximum size of input array', function() {
+ numLimitInput.clear();
+ numLimitInput.sendKeys('100');
+ letterLimitInput.clear();
+ letterLimitInput.sendKeys('100');
+ expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');
+ expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');
+ });
+ </file>
+ </example>
+ */
+function limitToFilter(){
+ return function(input, limit) {
+ if (!isArray(input) && !isString(input)) return input;
+
+ if (Math.abs(Number(limit)) === Infinity) {
+ limit = Number(limit);
+ } else {
+ limit = int(limit);
+ }
+
+ if (isString(input)) {
+ //NaN check on limit
+ if (limit) {
+ return limit >= 0 ? input.slice(0, limit) : input.slice(limit, input.length);
+ } else {
+ return "";
+ }
+ }
+
+ var out = [],
+ i, n;
+
+ // if abs(limit) exceeds maximum length, trim it
+ if (limit > input.length)
+ limit = input.length;
+ else if (limit < -input.length)
+ limit = -input.length;
+
+ if (limit > 0) {
+ i = 0;
+ n = limit;
+ } else {
+ i = input.length + limit;
+ n = input.length;
+ }
+
+ for (; i<n; i++) {
+ out.push(input[i]);
+ }
+
+ return out;
+ };
+}
+
+/**
+ * @ngdoc filter
+ * @name orderBy
+ * @kind function
+ *
+ * @description
+ * Orders a specified `array` by the `expression` predicate. It is ordered alphabetically
+ * for strings and numerically for numbers. Note: if you notice numbers are not being sorted
+ * correctly, make sure they are actually being saved as numbers and not strings.
+ *
+ * @param {Array} array The array to sort.
+ * @param {function(*)|string|Array.<(function(*)|string)>} expression A predicate to be
+ * used by the comparator to determine the order of elements.
+ *
+ * Can be one of:
+ *
+ * - `function`: Getter function. The result of this function will be sorted using the
+ * `<`, `=`, `>` operator.
+ * - `string`: An Angular expression. The result of this expression is used to compare elements
+ * (for example `name` to sort by a property called `name` or `name.substr(0, 3)` to sort by
+ * 3 first characters of a property called `name`). The result of a constant expression
+ * is interpreted as a property name to be used in comparisons (for example `"special name"`
+ * to sort object by the value of their `special name` property). An expression can be
+ * optionally prefixed with `+` or `-` to control ascending or descending sort order
+ * (for example, `+name` or `-name`).
+ * - `Array`: An array of function or string predicates. The first predicate in the array
+ * is used for sorting, but when two items are equivalent, the next predicate is used.
+ *
+ * @param {boolean=} reverse Reverse the order of the array.
+ * @returns {Array} Sorted copy of the source array.
+ *
+ * @example
+ <example module="orderByExample">
+ <file name="index.html">
+ <script>
+ angular.module('orderByExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.friends =
+ [{name:'John', phone:'555-1212', age:10},
+ {name:'Mary', phone:'555-9876', age:19},
+ {name:'Mike', phone:'555-4321', age:21},
+ {name:'Adam', phone:'555-5678', age:35},
+ {name:'Julie', phone:'555-8765', age:29}];
+ $scope.predicate = '-age';
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
+ <hr/>
+ [ <a href="" ng-click="predicate=''">unsorted</a> ]
+ <table class="friend">
+ <tr>
+ <th><a href="" ng-click="predicate = 'name'; reverse=false">Name</a>
+ (<a href="" ng-click="predicate = '-name'; reverse=false">^</a>)</th>
+ <th><a href="" ng-click="predicate = 'phone'; reverse=!reverse">Phone Number</a></th>
+ <th><a href="" ng-click="predicate = 'age'; reverse=!reverse">Age</a></th>
+ </tr>
+ <tr ng-repeat="friend in friends | orderBy:predicate:reverse">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ <td>{{friend.age}}</td>
+ </tr>
+ </table>
+ </div>
+ </file>
+ </example>
+ *
+ * It's also possible to call the orderBy filter manually, by injecting `$filter`, retrieving the
+ * filter routine with `$filter('orderBy')`, and calling the returned filter routine with the
+ * desired parameters.
+ *
+ * Example:
+ *
+ * @example
+ <example module="orderByExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <table class="friend">
+ <tr>
+ <th><a href="" ng-click="reverse=false;order('name', false)">Name</a>
+ (<a href="" ng-click="order('-name',false)">^</a>)</th>
+ <th><a href="" ng-click="reverse=!reverse;order('phone', reverse)">Phone Number</a></th>
+ <th><a href="" ng-click="reverse=!reverse;order('age',reverse)">Age</a></th>
+ </tr>
+ <tr ng-repeat="friend in friends">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ <td>{{friend.age}}</td>
+ </tr>
+ </table>
+ </div>
+ </file>
+
+ <file name="script.js">
+ angular.module('orderByExample', [])
+ .controller('ExampleController', ['$scope', '$filter', function($scope, $filter) {
+ var orderBy = $filter('orderBy');
+ $scope.friends = [
+ { name: 'John', phone: '555-1212', age: 10 },
+ { name: 'Mary', phone: '555-9876', age: 19 },
+ { name: 'Mike', phone: '555-4321', age: 21 },
+ { name: 'Adam', phone: '555-5678', age: 35 },
+ { name: 'Julie', phone: '555-8765', age: 29 }
+ ];
+ $scope.order = function(predicate, reverse) {
+ $scope.friends = orderBy($scope.friends, predicate, reverse);
+ };
+ $scope.order('-age',false);
+ }]);
+ </file>
+</example>
+ */
+orderByFilter.$inject = ['$parse'];
+function orderByFilter($parse){
+ return function(array, sortPredicate, reverseOrder) {
+ if (!(isArrayLike(array))) return array;
+ if (!sortPredicate) return array;
+ sortPredicate = isArray(sortPredicate) ? sortPredicate: [sortPredicate];
+ sortPredicate = map(sortPredicate, function(predicate){
+ var descending = false, get = predicate || identity;
+ if (isString(predicate)) {
+ if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {
+ descending = predicate.charAt(0) == '-';
+ predicate = predicate.substring(1);
+ }
+ get = $parse(predicate);
+ if (get.constant) {
+ var key = get();
+ return reverseComparator(function(a,b) {
+ return compare(a[key], b[key]);
+ }, descending);
+ }
+ }
+ return reverseComparator(function(a,b){
+ return compare(get(a),get(b));
+ }, descending);
+ });
+ var arrayCopy = [];
+ for ( var i = 0; i < array.length; i++) { arrayCopy.push(array[i]); }
+ return arrayCopy.sort(reverseComparator(comparator, reverseOrder));
+
+ function comparator(o1, o2){
+ for ( var i = 0; i < sortPredicate.length; i++) {
+ var comp = sortPredicate[i](o1, o2);
+ if (comp !== 0) return comp;
+ }
+ return 0;
+ }
+ function reverseComparator(comp, descending) {
+ return toBoolean(descending)
+ ? function(a,b){return comp(b,a);}
+ : comp;
+ }
+ function compare(v1, v2){
+ var t1 = typeof v1;
+ var t2 = typeof v2;
+ if (t1 == t2) {
+ if (isDate(v1) && isDate(v2)) {
+ v1 = v1.valueOf();
+ v2 = v2.valueOf();
+ }
+ if (t1 == "string") {
+ v1 = v1.toLowerCase();
+ v2 = v2.toLowerCase();
+ }
+ if (v1 === v2) return 0;
+ return v1 < v2 ? -1 : 1;
+ } else {
+ return t1 < t2 ? -1 : 1;
+ }
+ }
+ };
+}
+
+function ngDirective(directive) {
+ if (isFunction(directive)) {
+ directive = {
+ link: directive
+ };
+ }
+ directive.restrict = directive.restrict || 'AC';
+ return valueFn(directive);
+}
+
+/**
+ * @ngdoc directive
+ * @name a
+ * @restrict E
+ *
+ * @description
+ * Modifies the default behavior of the html A tag so that the default action is prevented when
+ * the href attribute is empty.
+ *
+ * This change permits the easy creation of action links with the `ngClick` directive
+ * without changing the location or causing page reloads, e.g.:
+ * `<a href="" ng-click="list.addItem()">Add Item</a>`
+ */
+var htmlAnchorDirective = valueFn({
+ restrict: 'E',
+ compile: function(element, attr) {
+
+ if (msie <= 8) {
+
+ // turn <a href ng-click="..">link</a> into a stylable link in IE
+ // but only if it doesn't have name attribute, in which case it's an anchor
+ if (!attr.href && !attr.name) {
+ attr.$set('href', '');
+ }
+
+ // add a comment node to anchors to workaround IE bug that causes element content to be reset
+ // to new attribute content if attribute is updated with value containing @ and element also
+ // contains value with @
+ // see issue #1949
+ element.append(document.createComment('IE fix'));
+ }
+
+ if (!attr.href && !attr.xlinkHref && !attr.name) {
+ return function(scope, element) {
+ // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.
+ var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?
+ 'xlink:href' : 'href';
+ element.on('click', function(event){
+ // if we have no href url, then don't navigate anywhere.
+ if (!element.attr(href)) {
+ event.preventDefault();
+ }
+ });
+ };
+ }
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngHref
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in an href attribute will
+ * make the link go to the wrong URL if the user clicks it before
+ * Angular has a chance to replace the `{{hash}}` markup with its
+ * value. Until Angular replaces the markup the link will be broken
+ * and will most likely return a 404 error.
+ *
+ * The `ngHref` directive solves this problem.
+ *
+ * The wrong way to write it:
+ * ```html
+ * <a href="http://www.gravatar.com/avatar/{{hash}}"/>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <a ng-href="http://www.gravatar.com/avatar/{{hash}}"/>
+ * ```
+ *
+ * @element A
+ * @param {template} ngHref any string which can contain `{{}}` markup.
+ *
+ * @example
+ * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes
+ * in links and their different behaviors:
+ <example>
+ <file name="index.html">
+ <input ng-model="value" /><br />
+ <a id="link-1" href ng-click="value = 1">link 1</a> (link, don't reload)<br />
+ <a id="link-2" href="" ng-click="value = 2">link 2</a> (link, don't reload)<br />
+ <a id="link-3" ng-href="/{{'123'}}">link 3</a> (link, reload!)<br />
+ <a id="link-4" href="" name="xx" ng-click="value = 4">anchor</a> (link, don't reload)<br />
+ <a id="link-5" name="xxx" ng-click="value = 5">anchor</a> (no link)<br />
+ <a id="link-6" ng-href="{{value}}">link</a> (link, change location)
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should execute ng-click but not reload when href without value', function() {
+ element(by.id('link-1')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('1');
+ expect(element(by.id('link-1')).getAttribute('href')).toBe('');
+ });
+
+ it('should execute ng-click but not reload when href empty string', function() {
+ element(by.id('link-2')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('2');
+ expect(element(by.id('link-2')).getAttribute('href')).toBe('');
+ });
+
+ it('should execute ng-click and change url when ng-href specified', function() {
+ expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\/123$/);
+
+ element(by.id('link-3')).click();
+
+ // At this point, we navigate away from an Angular page, so we need
+ // to use browser.driver to get the base webdriver.
+
+ browser.wait(function() {
+ return browser.driver.getCurrentUrl().then(function(url) {
+ return url.match(/\/123$/);
+ });
+ }, 5000, 'page should navigate to /123');
+ });
+
+ xit('should execute ng-click but not reload when href empty string and name specified', function() {
+ element(by.id('link-4')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('4');
+ expect(element(by.id('link-4')).getAttribute('href')).toBe('');
+ });
+
+ it('should execute ng-click but not reload when no href but name specified', function() {
+ element(by.id('link-5')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('5');
+ expect(element(by.id('link-5')).getAttribute('href')).toBe(null);
+ });
+
+ it('should only change url when only ng-href', function() {
+ element(by.model('value')).clear();
+ element(by.model('value')).sendKeys('6');
+ expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\/6$/);
+
+ element(by.id('link-6')).click();
+
+ // At this point, we navigate away from an Angular page, so we need
+ // to use browser.driver to get the base webdriver.
+ browser.wait(function() {
+ return browser.driver.getCurrentUrl().then(function(url) {
+ return url.match(/\/6$/);
+ });
+ }, 5000, 'page should navigate to /6');
+ });
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngSrc
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in a `src` attribute doesn't
+ * work right: The browser will fetch from the URL with the literal
+ * text `{{hash}}` until Angular replaces the expression inside
+ * `{{hash}}`. The `ngSrc` directive solves this problem.
+ *
+ * The buggy way to write it:
+ * ```html
+ * <img src="http://www.gravatar.com/avatar/{{hash}}"/>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <img ng-src="http://www.gravatar.com/avatar/{{hash}}"/>
+ * ```
+ *
+ * @element IMG
+ * @param {template} ngSrc any string which can contain `{{}}` markup.
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngSrcset
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't
+ * work right: The browser will fetch from the URL with the literal
+ * text `{{hash}}` until Angular replaces the expression inside
+ * `{{hash}}`. The `ngSrcset` directive solves this problem.
+ *
+ * The buggy way to write it:
+ * ```html
+ * <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x"/>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x"/>
+ * ```
+ *
+ * @element IMG
+ * @param {template} ngSrcset any string which can contain `{{}}` markup.
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngDisabled
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * We shouldn't do this, because it will make the button enabled on Chrome/Firefox but not on IE8 and older IEs:
+ * ```html
+ * <div ng-init="scope = { isDisabled: false }">
+ * <button disabled="{{scope.isDisabled}}">Disabled</button>
+ * </div>
+ * ```
+ *
+ * The HTML specification does not require browsers to preserve the values of boolean attributes
+ * such as disabled. (Their presence means true and their absence means false.)
+ * If we put an Angular interpolation expression into such an attribute then the
+ * binding information would be lost when the browser removes the attribute.
+ * The `ngDisabled` directive solves this problem for the `disabled` attribute.
+ * This complementary directive is not removed by the browser and so provides
+ * a permanent reliable place to store the binding information.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ Click me to toggle: <input type="checkbox" ng-model="checked"><br/>
+ <button ng-model="button" ng-disabled="checked">Button</button>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should toggle button', function() {
+ expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();
+ element(by.model('checked')).click();
+ expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element INPUT
+ * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy,
+ * then special attribute "disabled" will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngChecked
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ * The HTML specification does not require browsers to preserve the values of boolean attributes
+ * such as checked. (Their presence means true and their absence means false.)
+ * If we put an Angular interpolation expression into such an attribute then the
+ * binding information would be lost when the browser removes the attribute.
+ * The `ngChecked` directive solves this problem for the `checked` attribute.
+ * This complementary directive is not removed by the browser and so provides
+ * a permanent reliable place to store the binding information.
+ * @example
+ <example>
+ <file name="index.html">
+ Check me to check both: <input type="checkbox" ng-model="master"><br/>
+ <input id="checkSlave" type="checkbox" ng-checked="master">
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check both checkBoxes', function() {
+ expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy();
+ element(by.model('master')).click();
+ expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element INPUT
+ * @param {expression} ngChecked If the {@link guide/expression expression} is truthy,
+ * then special attribute "checked" will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngReadonly
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ * The HTML specification does not require browsers to preserve the values of boolean attributes
+ * such as readonly. (Their presence means true and their absence means false.)
+ * If we put an Angular interpolation expression into such an attribute then the
+ * binding information would be lost when the browser removes the attribute.
+ * The `ngReadonly` directive solves this problem for the `readonly` attribute.
+ * This complementary directive is not removed by the browser and so provides
+ * a permanent reliable place to store the binding information.
+ * @example
+ <example>
+ <file name="index.html">
+ Check me to make text readonly: <input type="checkbox" ng-model="checked"><br/>
+ <input type="text" ng-readonly="checked" value="I'm Angular"/>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should toggle readonly attr', function() {
+ expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeFalsy();
+ element(by.model('checked')).click();
+ expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element INPUT
+ * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy,
+ * then special attribute "readonly" will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngSelected
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ * The HTML specification does not require browsers to preserve the values of boolean attributes
+ * such as selected. (Their presence means true and their absence means false.)
+ * If we put an Angular interpolation expression into such an attribute then the
+ * binding information would be lost when the browser removes the attribute.
+ * The `ngSelected` directive solves this problem for the `selected` attribute.
+ * This complementary directive is not removed by the browser and so provides
+ * a permanent reliable place to store the binding information.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ Check me to select: <input type="checkbox" ng-model="selected"><br/>
+ <select>
+ <option>Hello!</option>
+ <option id="greet" ng-selected="selected">Greetings!</option>
+ </select>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should select Greetings!', function() {
+ expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();
+ element(by.model('selected')).click();
+ expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element OPTION
+ * @param {expression} ngSelected If the {@link guide/expression expression} is truthy,
+ * then special attribute "selected" will be set on the element
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngOpen
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ * The HTML specification does not require browsers to preserve the values of boolean attributes
+ * such as open. (Their presence means true and their absence means false.)
+ * If we put an Angular interpolation expression into such an attribute then the
+ * binding information would be lost when the browser removes the attribute.
+ * The `ngOpen` directive solves this problem for the `open` attribute.
+ * This complementary directive is not removed by the browser and so provides
+ * a permanent reliable place to store the binding information.
+ * @example
+ <example>
+ <file name="index.html">
+ Check me check multiple: <input type="checkbox" ng-model="open"><br/>
+ <details id="details" ng-open="open">
+ <summary>Show/Hide me</summary>
+ </details>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should toggle open', function() {
+ expect(element(by.id('details')).getAttribute('open')).toBeFalsy();
+ element(by.model('open')).click();
+ expect(element(by.id('details')).getAttribute('open')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element DETAILS
+ * @param {expression} ngOpen If the {@link guide/expression expression} is truthy,
+ * then special attribute "open" will be set on the element
+ */
+
+var ngAttributeAliasDirectives = {};
+
+
+// boolean attrs are evaluated
+forEach(BOOLEAN_ATTR, function(propName, attrName) {
+ // binding to multiple is not supported
+ if (propName == "multiple") return;
+
+ var normalized = directiveNormalize('ng-' + attrName);
+ ngAttributeAliasDirectives[normalized] = function() {
+ return {
+ priority: 100,
+ link: function(scope, element, attr) {
+ scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
+ attr.$set(attrName, !!value);
+ });
+ }
+ };
+ };
+});
+
+
+// ng-src, ng-srcset, ng-href are interpolated
+forEach(['src', 'srcset', 'href'], function(attrName) {
+ var normalized = directiveNormalize('ng-' + attrName);
+ ngAttributeAliasDirectives[normalized] = function() {
+ return {
+ priority: 99, // it needs to run after the attributes are interpolated
+ link: function(scope, element, attr) {
+ var propName = attrName,
+ name = attrName;
+
+ if (attrName === 'href' &&
+ toString.call(element.prop('href')) === '[object SVGAnimatedString]') {
+ name = 'xlinkHref';
+ attr.$attr[name] = 'xlink:href';
+ propName = null;
+ }
+
+ attr.$observe(normalized, function(value) {
+ if (!value) {
+ if (attrName === 'href') {
+ attr.$set(name, null);
+ }
+ return;
+ }
+
+ attr.$set(name, value);
+
+ // on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist
+ // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need
+ // to set the property as well to achieve the desired effect.
+ // we use attr[attrName] value since $set can sanitize the url.
+ if (msie && propName) element.prop(propName, attr[name]);
+ });
+ }
+ };
+ };
+});
+
+/* global -nullFormCtrl */
+var nullFormCtrl = {
+ $addControl: noop,
+ $removeControl: noop,
+ $setValidity: noop,
+ $setDirty: noop,
+ $setPristine: noop
+};
+
+/**
+ * @ngdoc type
+ * @name form.FormController
+ *
+ * @property {boolean} $pristine True if user has not interacted with the form yet.
+ * @property {boolean} $dirty True if user has already interacted with the form.
+ * @property {boolean} $valid True if all of the containing forms and controls are valid.
+ * @property {boolean} $invalid True if at least one containing control or form is invalid.
+ *
+ * @property {Object} $error Is an object hash, containing references to all invalid controls or
+ * forms, where:
+ *
+ * - keys are validation tokens (error names),
+ * - values are arrays of controls or forms that are invalid for given error name.
+ *
+ *
+ * Built-in validation tokens:
+ *
+ * - `email`
+ * - `max`
+ * - `maxlength`
+ * - `min`
+ * - `minlength`
+ * - `number`
+ * - `pattern`
+ * - `required`
+ * - `url`
+ *
+ * @description
+ * `FormController` keeps track of all its controls and nested forms as well as the state of them,
+ * such as being valid/invalid or dirty/pristine.
+ *
+ * Each {@link ng.directive:form form} directive creates an instance
+ * of `FormController`.
+ *
+ */
+//asks for $scope to fool the BC controller module
+FormController.$inject = ['$element', '$attrs', '$scope', '$animate'];
+function FormController(element, attrs, $scope, $animate) {
+ var form = this,
+ parentForm = element.parent().controller('form') || nullFormCtrl,
+ invalidCount = 0, // used to easily determine if we are valid
+ errors = form.$error = {},
+ controls = [];
+
+ // init state
+ form.$name = attrs.name || attrs.ngForm;
+ form.$dirty = false;
+ form.$pristine = true;
+ form.$valid = true;
+ form.$invalid = false;
+
+ parentForm.$addControl(form);
+
+ // Setup initial state of the control
+ element.addClass(PRISTINE_CLASS);
+ toggleValidCss(true);
+
+ // convenience method for easy toggling of classes
+ function toggleValidCss(isValid, validationErrorKey) {
+ validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
+ $animate.setClass(element,
+ (isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey,
+ (isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey);
+ }
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$addControl
+ *
+ * @description
+ * Register a control with the form.
+ *
+ * Input elements using ngModelController do this automatically when they are linked.
+ */
+ form.$addControl = function(control) {
+ // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored
+ // and not added to the scope. Now we throw an error.
+ assertNotHasOwnProperty(control.$name, 'input');
+ controls.push(control);
+
+ if (control.$name) {
+ form[control.$name] = control;
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$removeControl
+ *
+ * @description
+ * Deregister a control from the form.
+ *
+ * Input elements using ngModelController do this automatically when they are destroyed.
+ */
+ form.$removeControl = function(control) {
+ if (control.$name && form[control.$name] === control) {
+ delete form[control.$name];
+ }
+ forEach(errors, function(queue, validationToken) {
+ form.$setValidity(validationToken, true, control);
+ });
+
+ arrayRemove(controls, control);
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setValidity
+ *
+ * @description
+ * Sets the validity of a form control.
+ *
+ * This method will also propagate to parent forms.
+ */
+ form.$setValidity = function(validationToken, isValid, control) {
+ var queue = errors[validationToken];
+
+ if (isValid) {
+ if (queue) {
+ arrayRemove(queue, control);
+ if (!queue.length) {
+ invalidCount--;
+ if (!invalidCount) {
+ toggleValidCss(isValid);
+ form.$valid = true;
+ form.$invalid = false;
+ }
+ errors[validationToken] = false;
+ toggleValidCss(true, validationToken);
+ parentForm.$setValidity(validationToken, true, form);
+ }
+ }
+
+ } else {
+ if (!invalidCount) {
+ toggleValidCss(isValid);
+ }
+ if (queue) {
+ if (includes(queue, control)) return;
+ } else {
+ errors[validationToken] = queue = [];
+ invalidCount++;
+ toggleValidCss(false, validationToken);
+ parentForm.$setValidity(validationToken, false, form);
+ }
+ queue.push(control);
+
+ form.$valid = false;
+ form.$invalid = true;
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setDirty
+ *
+ * @description
+ * Sets the form to a dirty state.
+ *
+ * This method can be called to add the 'ng-dirty' class and set the form to a dirty
+ * state (ng-dirty class). This method will also propagate to parent forms.
+ */
+ form.$setDirty = function() {
+ $animate.removeClass(element, PRISTINE_CLASS);
+ $animate.addClass(element, DIRTY_CLASS);
+ form.$dirty = true;
+ form.$pristine = false;
+ parentForm.$setDirty();
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setPristine
+ *
+ * @description
+ * Sets the form to its pristine state.
+ *
+ * This method can be called to remove the 'ng-dirty' class and set the form to its pristine
+ * state (ng-pristine class). This method will also propagate to all the controls contained
+ * in this form.
+ *
+ * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after
+ * saving or resetting it.
+ */
+ form.$setPristine = function () {
+ $animate.removeClass(element, DIRTY_CLASS);
+ $animate.addClass(element, PRISTINE_CLASS);
+ form.$dirty = false;
+ form.$pristine = true;
+ forEach(controls, function(control) {
+ control.$setPristine();
+ });
+ };
+}
+
+
+/**
+ * @ngdoc directive
+ * @name ngForm
+ * @restrict EAC
+ *
+ * @description
+ * Nestable alias of {@link ng.directive:form `form`} directive. HTML
+ * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a
+ * sub-group of controls needs to be determined.
+ *
+ * Note: the purpose of `ngForm` is to group controls,
+ * but not to be a replacement for the `<form>` tag with all of its capabilities
+ * (e.g. posting to the server, ...).
+ *
+ * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into
+ * related scope, under this name.
+ *
+ */
+
+ /**
+ * @ngdoc directive
+ * @name form
+ * @restrict E
+ *
+ * @description
+ * Directive that instantiates
+ * {@link form.FormController FormController}.
+ *
+ * If the `name` attribute is specified, the form controller is published onto the current scope under
+ * this name.
+ *
+ * # Alias: {@link ng.directive:ngForm `ngForm`}
+ *
+ * In Angular forms can be nested. This means that the outer form is valid when all of the child
+ * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so
+ * Angular provides the {@link ng.directive:ngForm `ngForm`} directive which behaves identically to
+ * `<form>` but can be nested. This allows you to have nested forms, which is very useful when
+ * using Angular validation directives in forms that are dynamically generated using the
+ * {@link ng.directive:ngRepeat `ngRepeat`} directive. Since you cannot dynamically generate the `name`
+ * attribute of input elements using interpolation, you have to wrap each set of repeated inputs in an
+ * `ngForm` directive and nest these in an outer `form` element.
+ *
+ *
+ * # CSS classes
+ * - `ng-valid` is set if the form is valid.
+ * - `ng-invalid` is set if the form is invalid.
+ * - `ng-pristine` is set if the form is pristine.
+ * - `ng-dirty` is set if the form is dirty.
+ *
+ * Keep in mind that ngAnimate can detect each of these classes when added and removed.
+ *
+ *
+ * # Submitting a form and preventing the default action
+ *
+ * Since the role of forms in client-side Angular applications is different than in classical
+ * roundtrip apps, it is desirable for the browser not to translate the form submission into a full
+ * page reload that sends the data to the server. Instead some javascript logic should be triggered
+ * to handle the form submission in an application-specific way.
+ *
+ * For this reason, Angular prevents the default action (form submission to the server) unless the
+ * `<form>` element has an `action` attribute specified.
+ *
+ * You can use one of the following two ways to specify what javascript method should be called when
+ * a form is submitted:
+ *
+ * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element
+ * - {@link ng.directive:ngClick ngClick} directive on the first
+ * button or input field of type submit (input[type=submit])
+ *
+ * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}
+ * or {@link ng.directive:ngClick ngClick} directives.
+ * This is because of the following form submission rules in the HTML specification:
+ *
+ * - If a form has only one input field then hitting enter in this field triggers form submit
+ * (`ngSubmit`)
+ * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter
+ * doesn't trigger submit
+ * - if a form has one or more input fields and one or more buttons or input[type=submit] then
+ * hitting enter in any of the input fields will trigger the click handler on the *first* button or
+ * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)
+ *
+ *
+ * ## Animation Hooks
+ *
+ * Animations in ngForm are triggered when any of the associated CSS classes are added and removed.
+ * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any
+ * other validations that are performed within the form. Animations in ngForm are similar to how
+ * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well
+ * as JS animations.
+ *
+ * The following example shows a simple way to utilize CSS transitions to style a form element
+ * that has been rendered as invalid after it has been validated:
+ *
+ * <pre>
+ * //be sure to include ngAnimate as a module to hook into more
+ * //advanced animations
+ * .my-form {
+ * transition:0.5s linear all;
+ * background: white;
+ * }
+ * .my-form.ng-invalid {
+ * background: red;
+ * color:white;
+ * }
+ * </pre>
+ *
+ * @example
+ <example deps="angular-animate.js" animations="true" fixBase="true" module="formExample">
+ <file name="index.html">
+ <script>
+ angular.module('formExample', [])
+ .controller('FormController', ['$scope', function($scope) {
+ $scope.userType = 'guest';
+ }]);
+ </script>
+ <style>
+ .my-form {
+ -webkit-transition:all linear 0.5s;
+ transition:all linear 0.5s;
+ background: transparent;
+ }
+ .my-form.ng-invalid {
+ background: red;
+ }
+ </style>
+ <form name="myForm" ng-controller="FormController" class="my-form">
+ userType: <input name="input" ng-model="userType" required>
+ <span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
+ <tt>userType = {{userType}}</tt><br>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should initialize to model', function() {
+ var userType = element(by.binding('userType'));
+ var valid = element(by.binding('myForm.input.$valid'));
+
+ expect(userType.getText()).toContain('guest');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ var userType = element(by.binding('userType'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var userInput = element(by.model('userType'));
+
+ userInput.clear();
+ userInput.sendKeys('');
+
+ expect(userType.getText()).toEqual('userType =');
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ *
+ * @param {string=} name Name of the form. If specified, the form controller will be published into
+ * related scope, under this name.
+ */
+var formDirectiveFactory = function(isNgForm) {
+ return ['$timeout', function($timeout) {
+ var formDirective = {
+ name: 'form',
+ restrict: isNgForm ? 'EAC' : 'E',
+ controller: FormController,
+ compile: function() {
+ return {
+ pre: function(scope, formElement, attr, controller) {
+ if (!attr.action) {
+ // we can't use jq events because if a form is destroyed during submission the default
+ // action is not prevented. see #1238
+ //
+ // IE 9 is not affected because it doesn't fire a submit event and try to do a full
+ // page reload if the form was destroyed by submission of the form via a click handler
+ // on a button in the form. Looks like an IE9 specific bug.
+ var preventDefaultListener = function(event) {
+ event.preventDefault
+ ? event.preventDefault()
+ : event.returnValue = false; // IE
+ };
+
+ addEventListenerFn(formElement[0], 'submit', preventDefaultListener);
+
+ // unregister the preventDefault listener so that we don't not leak memory but in a
+ // way that will achieve the prevention of the default action.
+ formElement.on('$destroy', function() {
+ $timeout(function() {
+ removeEventListenerFn(formElement[0], 'submit', preventDefaultListener);
+ }, 0, false);
+ });
+ }
+
+ var parentFormCtrl = formElement.parent().controller('form'),
+ alias = attr.name || attr.ngForm;
+
+ if (alias) {
+ setter(scope, alias, controller, alias);
+ }
+ if (parentFormCtrl) {
+ formElement.on('$destroy', function() {
+ parentFormCtrl.$removeControl(controller);
+ if (alias) {
+ setter(scope, alias, undefined, alias);
+ }
+ extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
+ });
+ }
+ }
+ };
+ }
+ };
+
+ return formDirective;
+ }];
+};
+
+var formDirective = formDirectiveFactory();
+var ngFormDirective = formDirectiveFactory(true);
+
+/* global VALID_CLASS: true,
+ INVALID_CLASS: true,
+ PRISTINE_CLASS: true,
+ DIRTY_CLASS: true
+*/
+
+var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
+var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
+var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
+
+var inputType = {
+
+ /**
+ * @ngdoc input
+ * @name input[text]
+ *
+ * @description
+ * Standard HTML text input with angular data binding, inherited by most of the `input` elements.
+ *
+ * *NOTE* Not every feature offered is available for all input types.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Adds `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
+ * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
+ * patterns defined as scope expressions.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ * This parameter is ignored for input[type=password] controls, which will never trim the
+ * input.
+ *
+ * @example
+ <example name="text-input-directive" module="textInputExample">
+ <file name="index.html">
+ <script>
+ angular.module('textInputExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.text = 'guest';
+ $scope.word = /^\s*\w*\s*$/;
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ Single word: <input type="text" name="input" ng-model="text"
+ ng-pattern="word" required ng-trim="false">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.pattern">
+ Single word only!</span>
+
+ <tt>text = {{text}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var text = element(by.binding('text'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('text'));
+
+ it('should initialize to model', function() {
+ expect(text.getText()).toContain('guest');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+
+ expect(text.getText()).toEqual('text =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if multi word', function() {
+ input.clear();
+ input.sendKeys('hello world');
+
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'text': textInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[number]
+ *
+ * @description
+ * Text input with number validation and transformation. Sets the `number` validation
+ * error if not a valid number.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
+ * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
+ * patterns defined as scope expressions.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="number-input-directive" module="numberExample">
+ <file name="index.html">
+ <script>
+ angular.module('numberExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.value = 12;
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ Number: <input type="number" name="input" ng-model="value"
+ min="0" max="99" required>
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.number">
+ Not valid number!</span>
+ <tt>value = {{value}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('value'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('value'));
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('12');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if over max', function() {
+ input.clear();
+ input.sendKeys('123');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'number': numberInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[url]
+ *
+ * @description
+ * Text input with URL validation. Sets the `url` validation error key if the content is not a
+ * valid URL.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
+ * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
+ * patterns defined as scope expressions.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="url-input-directive" module="urlExample">
+ <file name="index.html">
+ <script>
+ angular.module('urlExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.text = 'http://google.com';
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ URL: <input type="url" name="input" ng-model="text" required>
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.url">
+ Not valid url!</span>
+ <tt>text = {{text}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var text = element(by.binding('text'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('text'));
+
+ it('should initialize to model', function() {
+ expect(text.getText()).toContain('http://google.com');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+
+ expect(text.getText()).toEqual('text =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if not url', function() {
+ input.clear();
+ input.sendKeys('box');
+
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'url': urlInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[email]
+ *
+ * @description
+ * Text input with email validation. Sets the `email` validation error key if not a valid email
+ * address.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
+ * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
+ * patterns defined as scope expressions.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="email-input-directive" module="emailExample">
+ <file name="index.html">
+ <script>
+ angular.module('emailExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.text = 'me@example.com';
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ Email: <input type="email" name="input" ng-model="text" required>
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.email">
+ Not valid email!</span>
+ <tt>text = {{text}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var text = element(by.binding('text'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('text'));
+
+ it('should initialize to model', function() {
+ expect(text.getText()).toContain('me@example.com');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+ expect(text.getText()).toEqual('text =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if not email', function() {
+ input.clear();
+ input.sendKeys('xxx');
+
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'email': emailInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[radio]
+ *
+ * @description
+ * HTML radio button.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string} value The value to which the expression should be set when selected.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {string} ngValue Angular expression which sets the value to which the expression should
+ * be set when selected.
+ *
+ * @example
+ <example name="radio-input-directive" module="radioExample">
+ <file name="index.html">
+ <script>
+ angular.module('radioExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.color = 'blue';
+ $scope.specialValue = {
+ "id": "12345",
+ "value": "green"
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <input type="radio" ng-model="color" value="red"> Red <br/>
+ <input type="radio" ng-model="color" ng-value="specialValue"> Green <br/>
+ <input type="radio" ng-model="color" value="blue"> Blue <br/>
+ <tt>color = {{color | json}}</tt><br/>
+ </form>
+ Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`.
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should change state', function() {
+ var color = element(by.binding('color'));
+
+ expect(color.getText()).toContain('blue');
+
+ element.all(by.model('color')).get(0).click();
+
+ expect(color.getText()).toContain('red');
+ });
+ </file>
+ </example>
+ */
+ 'radio': radioInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[checkbox]
+ *
+ * @description
+ * HTML checkbox.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} ngTrueValue The value to which the expression should be set when selected.
+ * @param {string=} ngFalseValue The value to which the expression should be set when not selected.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="checkbox-input-directive" module="checkboxExample">
+ <file name="index.html">
+ <script>
+ angular.module('checkboxExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.value1 = true;
+ $scope.value2 = 'YES'
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ Value1: <input type="checkbox" ng-model="value1"> <br/>
+ Value2: <input type="checkbox" ng-model="value2"
+ ng-true-value="YES" ng-false-value="NO"> <br/>
+ <tt>value1 = {{value1}}</tt><br/>
+ <tt>value2 = {{value2}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should change state', function() {
+ var value1 = element(by.binding('value1'));
+ var value2 = element(by.binding('value2'));
+
+ expect(value1.getText()).toContain('true');
+ expect(value2.getText()).toContain('YES');
+
+ element(by.model('value1')).click();
+ element(by.model('value2')).click();
+
+ expect(value1.getText()).toContain('false');
+ expect(value2.getText()).toContain('NO');
+ });
+ </file>
+ </example>
+ */
+ 'checkbox': checkboxInputType,
+
+ 'hidden': noop,
+ 'button': noop,
+ 'submit': noop,
+ 'reset': noop,
+ 'file': noop
+};
+
+// A helper function to call $setValidity and return the value / undefined,
+// a pattern that is repeated a lot in the input validation logic.
+function validate(ctrl, validatorName, validity, value){
+ ctrl.$setValidity(validatorName, validity);
+ return validity ? value : undefined;
+}
+
+function testFlags(validity, flags) {
+ var i, flag;
+ if (flags) {
+ for (i=0; i<flags.length; ++i) {
+ flag = flags[i];
+ if (validity[flag]) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+// Pass validity so that behaviour can be mocked easier.
+function addNativeHtml5Validators(ctrl, validatorName, badFlags, ignoreFlags, validity) {
+ if (isObject(validity)) {
+ ctrl.$$hasNativeValidators = true;
+ var validator = function(value) {
+ // Don't overwrite previous validation, don't consider valueMissing to apply (ng-required can
+ // perform the required validation)
+ if (!ctrl.$error[validatorName] &&
+ !testFlags(validity, ignoreFlags) &&
+ testFlags(validity, badFlags)) {
+ ctrl.$setValidity(validatorName, false);
+ return;
+ }
+ return value;
+ };
+ ctrl.$parsers.push(validator);
+ }
+}
+
+function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ var validity = element.prop(VALIDITY_STATE_PROPERTY);
+ var placeholder = element[0].placeholder, noevent = {};
+ var type = lowercase(element[0].type);
+ ctrl.$$validityState = validity;
+
+ // In composition mode, users are still inputing intermediate text buffer,
+ // hold the listener until composition is done.
+ // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent
+ if (!$sniffer.android) {
+ var composing = false;
+
+ element.on('compositionstart', function(data) {
+ composing = true;
+ });
+
+ element.on('compositionend', function() {
+ composing = false;
+ listener();
+ });
+ }
+
+ var listener = function(ev) {
+ if (composing) return;
+ var value = element.val();
+
+ // IE (11 and under) seem to emit an 'input' event if the placeholder value changes.
+ // We don't want to dirty the value when this happens, so we abort here. Unfortunately,
+ // IE also sends input events for other non-input-related things, (such as focusing on a
+ // form control), so this change is not entirely enough to solve this.
+ if (msie && (ev || noevent).type === 'input' && element[0].placeholder !== placeholder) {
+ placeholder = element[0].placeholder;
+ return;
+ }
+
+ // By default we will trim the value
+ // If the attribute ng-trim exists we will avoid trimming
+ // If input type is 'password', the value is never trimmed
+ if (type !== 'password' && (toBoolean(attr.ngTrim || 'T'))) {
+ value = trim(value);
+ }
+
+ // If a control is suffering from bad input, browsers discard its value, so it may be
+ // necessary to revalidate even if the control's value is the same empty value twice in
+ // a row.
+ var revalidate = validity && ctrl.$$hasNativeValidators;
+ if (ctrl.$viewValue !== value || (value === '' && revalidate)) {
+ if (scope.$root.$$phase) {
+ ctrl.$setViewValue(value);
+ } else {
+ scope.$apply(function() {
+ ctrl.$setViewValue(value);
+ });
+ }
+ }
+ };
+
+ // if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the
+ // input event on backspace, delete or cut
+ if ($sniffer.hasEvent('input')) {
+ element.on('input', listener);
+ } else {
+ var timeout;
+
+ var deferListener = function() {
+ if (!timeout) {
+ timeout = $browser.defer(function() {
+ listener();
+ timeout = null;
+ });
+ }
+ };
+
+ element.on('keydown', function(event) {
+ var key = event.keyCode;
+
+ // ignore
+ // command modifiers arrows
+ if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;
+
+ deferListener();
+ });
+
+ // if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it
+ if ($sniffer.hasEvent('paste')) {
+ element.on('paste cut', deferListener);
+ }
+ }
+
+ // if user paste into input using mouse on older browser
+ // or form autocomplete on newer browser, we need "change" event to catch it
+ element.on('change', listener);
+
+ ctrl.$render = function() {
+ element.val(ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue);
+ };
+
+ // pattern validator
+ var pattern = attr.ngPattern,
+ patternValidator,
+ match;
+
+ if (pattern) {
+ var validateRegex = function(regexp, value) {
+ return validate(ctrl, 'pattern', ctrl.$isEmpty(value) || regexp.test(value), value);
+ };
+ match = pattern.match(/^\/(.*)\/([gim]*)$/);
+ if (match) {
+ pattern = new RegExp(match[1], match[2]);
+ patternValidator = function(value) {
+ return validateRegex(pattern, value);
+ };
+ } else {
+ patternValidator = function(value) {
+ var patternObj = scope.$eval(pattern);
+
+ if (!patternObj || !patternObj.test) {
+ throw minErr('ngPattern')('noregexp',
+ 'Expected {0} to be a RegExp but was {1}. Element: {2}', pattern,
+ patternObj, startingTag(element));
+ }
+ return validateRegex(patternObj, value);
+ };
+ }
+
+ ctrl.$formatters.push(patternValidator);
+ ctrl.$parsers.push(patternValidator);
+ }
+
+ // min length validator
+ if (attr.ngMinlength) {
+ var minlength = int(attr.ngMinlength);
+ var minLengthValidator = function(value) {
+ return validate(ctrl, 'minlength', ctrl.$isEmpty(value) || value.length >= minlength, value);
+ };
+
+ ctrl.$parsers.push(minLengthValidator);
+ ctrl.$formatters.push(minLengthValidator);
+ }
+
+ // max length validator
+ if (attr.ngMaxlength) {
+ var maxlength = int(attr.ngMaxlength);
+ var maxLengthValidator = function(value) {
+ return validate(ctrl, 'maxlength', ctrl.$isEmpty(value) || value.length <= maxlength, value);
+ };
+
+ ctrl.$parsers.push(maxLengthValidator);
+ ctrl.$formatters.push(maxLengthValidator);
+ }
+}
+
+var numberBadFlags = ['badInput'];
+
+function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ textInputType(scope, element, attr, ctrl, $sniffer, $browser);
+
+ ctrl.$parsers.push(function(value) {
+ var empty = ctrl.$isEmpty(value);
+ if (empty || NUMBER_REGEXP.test(value)) {
+ ctrl.$setValidity('number', true);
+ return value === '' ? null : (empty ? value : parseFloat(value));
+ } else {
+ ctrl.$setValidity('number', false);
+ return undefined;
+ }
+ });
+
+ addNativeHtml5Validators(ctrl, 'number', numberBadFlags, null, ctrl.$$validityState);
+
+ ctrl.$formatters.push(function(value) {
+ return ctrl.$isEmpty(value) ? '' : '' + value;
+ });
+
+ if (attr.min) {
+ var minValidator = function(value) {
+ var min = parseFloat(attr.min);
+ return validate(ctrl, 'min', ctrl.$isEmpty(value) || value >= min, value);
+ };
+
+ ctrl.$parsers.push(minValidator);
+ ctrl.$formatters.push(minValidator);
+ }
+
+ if (attr.max) {
+ var maxValidator = function(value) {
+ var max = parseFloat(attr.max);
+ return validate(ctrl, 'max', ctrl.$isEmpty(value) || value <= max, value);
+ };
+
+ ctrl.$parsers.push(maxValidator);
+ ctrl.$formatters.push(maxValidator);
+ }
+
+ ctrl.$formatters.push(function(value) {
+ return validate(ctrl, 'number', ctrl.$isEmpty(value) || isNumber(value), value);
+ });
+}
+
+function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ textInputType(scope, element, attr, ctrl, $sniffer, $browser);
+
+ var urlValidator = function(value) {
+ return validate(ctrl, 'url', ctrl.$isEmpty(value) || URL_REGEXP.test(value), value);
+ };
+
+ ctrl.$formatters.push(urlValidator);
+ ctrl.$parsers.push(urlValidator);
+}
+
+function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ textInputType(scope, element, attr, ctrl, $sniffer, $browser);
+
+ var emailValidator = function(value) {
+ return validate(ctrl, 'email', ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value), value);
+ };
+
+ ctrl.$formatters.push(emailValidator);
+ ctrl.$parsers.push(emailValidator);
+}
+
+function radioInputType(scope, element, attr, ctrl) {
+ // make the name unique, if not defined
+ if (isUndefined(attr.name)) {
+ element.attr('name', nextUid());
+ }
+
+ element.on('click', function() {
+ if (element[0].checked) {
+ scope.$apply(function() {
+ ctrl.$setViewValue(attr.value);
+ });
+ }
+ });
+
+ ctrl.$render = function() {
+ var value = attr.value;
+ element[0].checked = (value == ctrl.$viewValue);
+ };
+
+ attr.$observe('value', ctrl.$render);
+}
+
+function checkboxInputType(scope, element, attr, ctrl) {
+ var trueValue = attr.ngTrueValue,
+ falseValue = attr.ngFalseValue;
+
+ if (!isString(trueValue)) trueValue = true;
+ if (!isString(falseValue)) falseValue = false;
+
+ element.on('click', function() {
+ scope.$apply(function() {
+ ctrl.$setViewValue(element[0].checked);
+ });
+ });
+
+ ctrl.$render = function() {
+ element[0].checked = ctrl.$viewValue;
+ };
+
+ // Override the standard `$isEmpty` because a value of `false` means empty in a checkbox.
+ ctrl.$isEmpty = function(value) {
+ return value !== trueValue;
+ };
+
+ ctrl.$formatters.push(function(value) {
+ return value === trueValue;
+ });
+
+ ctrl.$parsers.push(function(value) {
+ return value ? trueValue : falseValue;
+ });
+}
+
+
+/**
+ * @ngdoc directive
+ * @name textarea
+ * @restrict E
+ *
+ * @description
+ * HTML textarea element control with angular data-binding. The data-binding and validation
+ * properties of this element are exactly the same as those of the
+ * {@link ng.directive:input input element}.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
+ * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
+ * patterns defined as scope expressions.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name input
+ * @restrict E
+ *
+ * @description
+ * HTML input element control with angular data-binding. Input control follows HTML5 input types
+ * and polyfills the HTML5 validation behavior for older browsers.
+ *
+ * *NOTE* Not every feature offered is available for all input types.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {boolean=} ngRequired Sets `required` attribute if set to true
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
+ * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
+ * patterns defined as scope expressions.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ * This parameter is ignored for input[type=password] controls, which will never trim the
+ * input.
+ *
+ * @example
+ <example name="input-directive" module="inputExample">
+ <file name="index.html">
+ <script>
+ angular.module('inputExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.user = {name: 'guest', last: 'visitor'};
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <form name="myForm">
+ User name: <input type="text" name="userName" ng-model="user.name" required>
+ <span class="error" ng-show="myForm.userName.$error.required">
+ Required!</span><br>
+ Last name: <input type="text" name="lastName" ng-model="user.last"
+ ng-minlength="3" ng-maxlength="10">
+ <span class="error" ng-show="myForm.lastName.$error.minlength">
+ Too short!</span>
+ <span class="error" ng-show="myForm.lastName.$error.maxlength">
+ Too long!</span><br>
+ </form>
+ <hr>
+ <tt>user = {{user}}</tt><br/>
+ <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br>
+ <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br>
+ <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br>
+ <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>
+ <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br>
+ <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var user = element(by.binding('{{user}}'));
+ var userNameValid = element(by.binding('myForm.userName.$valid'));
+ var lastNameValid = element(by.binding('myForm.lastName.$valid'));
+ var lastNameError = element(by.binding('myForm.lastName.$error'));
+ var formValid = element(by.binding('myForm.$valid'));
+ var userNameInput = element(by.model('user.name'));
+ var userLastInput = element(by.model('user.last'));
+
+ it('should initialize to model', function() {
+ expect(user.getText()).toContain('{"name":"guest","last":"visitor"}');
+ expect(userNameValid.getText()).toContain('true');
+ expect(formValid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty when required', function() {
+ userNameInput.clear();
+ userNameInput.sendKeys('');
+
+ expect(user.getText()).toContain('{"last":"visitor"}');
+ expect(userNameValid.getText()).toContain('false');
+ expect(formValid.getText()).toContain('false');
+ });
+
+ it('should be valid if empty when min length is set', function() {
+ userLastInput.clear();
+ userLastInput.sendKeys('');
+
+ expect(user.getText()).toContain('{"name":"guest","last":""}');
+ expect(lastNameValid.getText()).toContain('true');
+ expect(formValid.getText()).toContain('true');
+ });
+
+ it('should be invalid if less than required min length', function() {
+ userLastInput.clear();
+ userLastInput.sendKeys('xx');
+
+ expect(user.getText()).toContain('{"name":"guest"}');
+ expect(lastNameValid.getText()).toContain('false');
+ expect(lastNameError.getText()).toContain('minlength');
+ expect(formValid.getText()).toContain('false');
+ });
+
+ it('should be invalid if longer than max length', function() {
+ userLastInput.clear();
+ userLastInput.sendKeys('some ridiculously long name');
+
+ expect(user.getText()).toContain('{"name":"guest"}');
+ expect(lastNameValid.getText()).toContain('false');
+ expect(lastNameError.getText()).toContain('maxlength');
+ expect(formValid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+var inputDirective = ['$browser', '$sniffer', function($browser, $sniffer) {
+ return {
+ restrict: 'E',
+ require: '?ngModel',
+ link: function(scope, element, attr, ctrl) {
+ if (ctrl) {
+ (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrl, $sniffer,
+ $browser);
+ }
+ }
+ };
+}];
+
+var VALID_CLASS = 'ng-valid',
+ INVALID_CLASS = 'ng-invalid',
+ PRISTINE_CLASS = 'ng-pristine',
+ DIRTY_CLASS = 'ng-dirty';
+
+/**
+ * @ngdoc type
+ * @name ngModel.NgModelController
+ *
+ * @property {string} $viewValue Actual string value in the view.
+ * @property {*} $modelValue The value in the model, that the control is bound to.
+ * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever
+ the control reads value from the DOM. Each function is called, in turn, passing the value
+ through to the next. The last return value is used to populate the model.
+ Used to sanitize / convert the value as well as validation. For validation,
+ the parsers should update the validity state using
+ {@link ngModel.NgModelController#$setValidity $setValidity()},
+ and return `undefined` for invalid values.
+
+ *
+ * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever
+ the model value changes. Each function is called, in turn, passing the value through to the
+ next. Used to format / convert values for display in the control and validation.
+ * ```js
+ * function formatter(value) {
+ * if (value) {
+ * return value.toUpperCase();
+ * }
+ * }
+ * ngModel.$formatters.push(formatter);
+ * ```
+ *
+ * @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the
+ * view value has changed. It is called with no arguments, and its return value is ignored.
+ * This can be used in place of additional $watches against the model value.
+ *
+ * @property {Object} $error An object hash with all errors as keys.
+ *
+ * @property {boolean} $pristine True if user has not interacted with the control yet.
+ * @property {boolean} $dirty True if user has already interacted with the control.
+ * @property {boolean} $valid True if there is no error.
+ * @property {boolean} $invalid True if at least one error on the control.
+ *
+ * @description
+ *
+ * `NgModelController` provides API for the `ng-model` directive. The controller contains
+ * services for data-binding, validation, CSS updates, and value formatting and parsing. It
+ * purposefully does not contain any logic which deals with DOM rendering or listening to
+ * DOM events. Such DOM related logic should be provided by other directives which make use of
+ * `NgModelController` for data-binding.
+ *
+ * ## Custom Control Example
+ * This example shows how to use `NgModelController` with a custom control to achieve
+ * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)
+ * collaborate together to achieve the desired result.
+ *
+ * Note that `contenteditable` is an HTML5 attribute, which tells the browser to let the element
+ * contents be edited in place by the user. This will not work on older browsers.
+ *
+ * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize}
+ * module to automatically remove "bad" content like inline event listener (e.g. `<span onclick="...">`).
+ * However, as we are using `$sce` the model can still decide to to provide unsafe content if it marks
+ * that content using the `$sce` service.
+ *
+ * <example name="NgModelController" module="customControl" deps="angular-sanitize.js">
+ <file name="style.css">
+ [contenteditable] {
+ border: 1px solid black;
+ background-color: white;
+ min-height: 20px;
+ }
+
+ .ng-invalid {
+ border: 1px solid red;
+ }
+
+ </file>
+ <file name="script.js">
+ angular.module('customControl', ['ngSanitize']).
+ directive('contenteditable', ['$sce', function($sce) {
+ return {
+ restrict: 'A', // only activate on element attribute
+ require: '?ngModel', // get a hold of NgModelController
+ link: function(scope, element, attrs, ngModel) {
+ if(!ngModel) return; // do nothing if no ng-model
+
+ // Specify how UI should be updated
+ ngModel.$render = function() {
+ element.html($sce.getTrustedHtml(ngModel.$viewValue || ''));
+ };
+
+ // Listen for change events to enable binding
+ element.on('blur keyup change', function() {
+ scope.$apply(read);
+ });
+ read(); // initialize
+
+ // Write data to the model
+ function read() {
+ var html = element.html();
+ // When we clear the content editable the browser leaves a <br> behind
+ // If strip-br attribute is provided then we strip this out
+ if( attrs.stripBr && html == '<br>' ) {
+ html = '';
+ }
+ ngModel.$setViewValue(html);
+ }
+ }
+ };
+ }]);
+ </file>
+ <file name="index.html">
+ <form name="myForm">
+ <div contenteditable
+ name="myWidget" ng-model="userContent"
+ strip-br="true"
+ required>Change me!</div>
+ <span ng-show="myForm.myWidget.$error.required">Required!</span>
+ <hr>
+ <textarea ng-model="userContent"></textarea>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should data-bind and become invalid', function() {
+ if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') {
+ // SafariDriver can't handle contenteditable
+ // and Firefox driver can't clear contenteditables very well
+ return;
+ }
+ var contentEditable = element(by.css('[contenteditable]'));
+ var content = 'Change me!';
+
+ expect(contentEditable.getText()).toEqual(content);
+
+ contentEditable.clear();
+ contentEditable.sendKeys(protractor.Key.BACK_SPACE);
+ expect(contentEditable.getText()).toEqual('');
+ expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/);
+ });
+ </file>
+ * </example>
+ *
+ *
+ */
+var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate',
+ function($scope, $exceptionHandler, $attr, $element, $parse, $animate) {
+ this.$viewValue = Number.NaN;
+ this.$modelValue = Number.NaN;
+ this.$parsers = [];
+ this.$formatters = [];
+ this.$viewChangeListeners = [];
+ this.$pristine = true;
+ this.$dirty = false;
+ this.$valid = true;
+ this.$invalid = false;
+ this.$name = $attr.name;
+
+ var ngModelGet = $parse($attr.ngModel),
+ ngModelSet = ngModelGet.assign;
+
+ if (!ngModelSet) {
+ throw minErr('ngModel')('nonassign', "Expression '{0}' is non-assignable. Element: {1}",
+ $attr.ngModel, startingTag($element));
+ }
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$render
+ *
+ * @description
+ * Called when the view needs to be updated. It is expected that the user of the ng-model
+ * directive will implement this method.
+ */
+ this.$render = noop;
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$isEmpty
+ *
+ * @description
+ * This is called when we need to determine if the value of the input is empty.
+ *
+ * For instance, the required directive does this to work out if the input has data or not.
+ * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.
+ *
+ * You can override this for input directives whose concept of being empty is different to the
+ * default. The `checkboxInputType` directive does this because in its case a value of `false`
+ * implies empty.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is empty.
+ */
+ this.$isEmpty = function(value) {
+ return isUndefined(value) || value === '' || value === null || value !== value;
+ };
+
+ var parentForm = $element.inheritedData('$formController') || nullFormCtrl,
+ invalidCount = 0, // used to easily determine if we are valid
+ $error = this.$error = {}; // keep invalid keys here
+
+
+ // Setup initial state of the control
+ $element.addClass(PRISTINE_CLASS);
+ toggleValidCss(true);
+
+ // convenience method for easy toggling of classes
+ function toggleValidCss(isValid, validationErrorKey) {
+ validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
+ $animate.removeClass($element, (isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey);
+ $animate.addClass($element, (isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey);
+ }
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setValidity
+ *
+ * @description
+ * Change the validity state, and notifies the form when the control changes validity. (i.e. it
+ * does not notify form if given validator is already marked as invalid).
+ *
+ * This method should be called by validators - i.e. the parser or formatter functions.
+ *
+ * @param {string} validationErrorKey Name of the validator. the `validationErrorKey` will assign
+ * to `$error[validationErrorKey]=!isValid` so that it is available for data-binding.
+ * The `validationErrorKey` should be in camelCase and will get converted into dash-case
+ * for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`
+ * class and can be bound to as `{{someForm.someControl.$error.myError}}` .
+ * @param {boolean} isValid Whether the current state is valid (true) or invalid (false).
+ */
+ this.$setValidity = function(validationErrorKey, isValid) {
+ // Purposeful use of ! here to cast isValid to boolean in case it is undefined
+ // jshint -W018
+ if ($error[validationErrorKey] === !isValid) return;
+ // jshint +W018
+
+ if (isValid) {
+ if ($error[validationErrorKey]) invalidCount--;
+ if (!invalidCount) {
+ toggleValidCss(true);
+ this.$valid = true;
+ this.$invalid = false;
+ }
+ } else {
+ toggleValidCss(false);
+ this.$invalid = true;
+ this.$valid = false;
+ invalidCount++;
+ }
+
+ $error[validationErrorKey] = !isValid;
+ toggleValidCss(isValid, validationErrorKey);
+
+ parentForm.$setValidity(validationErrorKey, isValid, this);
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setPristine
+ *
+ * @description
+ * Sets the control to its pristine state.
+ *
+ * This method can be called to remove the 'ng-dirty' class and set the control to its pristine
+ * state (ng-pristine class).
+ */
+ this.$setPristine = function () {
+ this.$dirty = false;
+ this.$pristine = true;
+ $animate.removeClass($element, DIRTY_CLASS);
+ $animate.addClass($element, PRISTINE_CLASS);
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setViewValue
+ *
+ * @description
+ * Update the view value.
+ *
+ * This method should be called when the view value changes, typically from within a DOM event handler.
+ * For example {@link ng.directive:input input} and
+ * {@link ng.directive:select select} directives call it.
+ *
+ * It will update the $viewValue, then pass this value through each of the functions in `$parsers`,
+ * which includes any validators. The value that comes out of this `$parsers` pipeline, be applied to
+ * `$modelValue` and the **expression** specified in the `ng-model` attribute.
+ *
+ * Lastly, all the registered change listeners, in the `$viewChangeListeners` list, are called.
+ *
+ * Note that calling this function does not trigger a `$digest`.
+ *
+ * @param {string} value Value from the view.
+ */
+ this.$setViewValue = function(value) {
+ this.$viewValue = value;
+
+ // change to dirty
+ if (this.$pristine) {
+ this.$dirty = true;
+ this.$pristine = false;
+ $animate.removeClass($element, PRISTINE_CLASS);
+ $animate.addClass($element, DIRTY_CLASS);
+ parentForm.$setDirty();
+ }
+
+ forEach(this.$parsers, function(fn) {
+ value = fn(value);
+ });
+
+ if (this.$modelValue !== value) {
+ this.$modelValue = value;
+ ngModelSet($scope, value);
+ forEach(this.$viewChangeListeners, function(listener) {
+ try {
+ listener();
+ } catch(e) {
+ $exceptionHandler(e);
+ }
+ });
+ }
+ };
+
+ // model -> value
+ var ctrl = this;
+
+ $scope.$watch(function ngModelWatch() {
+ var value = ngModelGet($scope);
+
+ // if scope model value and ngModel value are out of sync
+ if (ctrl.$modelValue !== value) {
+
+ var formatters = ctrl.$formatters,
+ idx = formatters.length;
+
+ ctrl.$modelValue = value;
+ while(idx--) {
+ value = formatters[idx](value);
+ }
+
+ if (ctrl.$viewValue !== value) {
+ ctrl.$viewValue = value;
+ ctrl.$render();
+ }
+ }
+
+ return value;
+ });
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngModel
+ *
+ * @element input
+ *
+ * @description
+ * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a
+ * property on the scope using {@link ngModel.NgModelController NgModelController},
+ * which is created and exposed by this directive.
+ *
+ * `ngModel` is responsible for:
+ *
+ * - Binding the view into the model, which other directives such as `input`, `textarea` or `select`
+ * require.
+ * - Providing validation behavior (i.e. required, number, email, url).
+ * - Keeping the state of the control (valid/invalid, dirty/pristine, validation errors).
+ * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`) including animations.
+ * - Registering the control with its parent {@link ng.directive:form form}.
+ *
+ * Note: `ngModel` will try to bind to the property given by evaluating the expression on the
+ * current scope. If the property doesn't already exist on this scope, it will be created
+ * implicitly and added to the scope.
+ *
+ * For best practices on using `ngModel`, see:
+ *
+ * - [https://github.com/angular/angular.js/wiki/Understanding-Scopes]
+ *
+ * For basic examples, how to use `ngModel`, see:
+ *
+ * - {@link ng.directive:input input}
+ * - {@link input[text] text}
+ * - {@link input[checkbox] checkbox}
+ * - {@link input[radio] radio}
+ * - {@link input[number] number}
+ * - {@link input[email] email}
+ * - {@link input[url] url}
+ * - {@link ng.directive:select select}
+ * - {@link ng.directive:textarea textarea}
+ *
+ * # CSS classes
+ * The following CSS classes are added and removed on the associated input/select/textarea element
+ * depending on the validity of the model.
+ *
+ * - `ng-valid` is set if the model is valid.
+ * - `ng-invalid` is set if the model is invalid.
+ * - `ng-pristine` is set if the model is pristine.
+ * - `ng-dirty` is set if the model is dirty.
+ *
+ * Keep in mind that ngAnimate can detect each of these classes when added and removed.
+ *
+ * ## Animation Hooks
+ *
+ * Animations within models are triggered when any of the associated CSS classes are added and removed
+ * on the input element which is attached to the model. These classes are: `.ng-pristine`, `.ng-dirty`,
+ * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.
+ * The animations that are triggered within ngModel are similar to how they work in ngClass and
+ * animations can be hooked into using CSS transitions, keyframes as well as JS animations.
+ *
+ * The following example shows a simple way to utilize CSS transitions to style an input element
+ * that has been rendered as invalid after it has been validated:
+ *
+ * <pre>
+ * //be sure to include ngAnimate as a module to hook into more
+ * //advanced animations
+ * .my-input {
+ * transition:0.5s linear all;
+ * background: white;
+ * }
+ * .my-input.ng-invalid {
+ * background: red;
+ * color:white;
+ * }
+ * </pre>
+ *
+ * @example
+ * <example deps="angular-animate.js" animations="true" fixBase="true" module="inputExample">
+ <file name="index.html">
+ <script>
+ angular.module('inputExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.val = '1';
+ }]);
+ </script>
+ <style>
+ .my-input {
+ -webkit-transition:all linear 0.5s;
+ transition:all linear 0.5s;
+ background: transparent;
+ }
+ .my-input.ng-invalid {
+ color:white;
+ background: red;
+ }
+ </style>
+ Update input to see transitions when valid/invalid.
+ Integer is a valid value.
+ <form name="testForm" ng-controller="ExampleController">
+ <input ng-model="val" ng-pattern="/^\d+$/" name="anim" class="my-input" />
+ </form>
+ </file>
+ * </example>
+ */
+var ngModelDirective = function() {
+ return {
+ require: ['ngModel', '^?form'],
+ controller: NgModelController,
+ link: function(scope, element, attr, ctrls) {
+ // notify others, especially parent forms
+
+ var modelCtrl = ctrls[0],
+ formCtrl = ctrls[1] || nullFormCtrl;
+
+ formCtrl.$addControl(modelCtrl);
+
+ scope.$on('$destroy', function() {
+ formCtrl.$removeControl(modelCtrl);
+ });
+ }
+ };
+};
+
+
+/**
+ * @ngdoc directive
+ * @name ngChange
+ *
+ * @description
+ * Evaluate the given expression when the user changes the input.
+ * The expression is evaluated immediately, unlike the JavaScript onchange event
+ * which only triggers at the end of a change (usually, when the user leaves the
+ * form element or presses the return key).
+ * The expression is not evaluated when the value change is coming from the model.
+ *
+ * Note, this directive requires `ngModel` to be present.
+ *
+ * @element input
+ * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change
+ * in input value.
+ *
+ * @example
+ * <example name="ngChange-directive" module="changeExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('changeExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.counter = 0;
+ * $scope.change = function() {
+ * $scope.counter++;
+ * };
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" />
+ * <input type="checkbox" ng-model="confirmed" id="ng-change-example2" />
+ * <label for="ng-change-example2">Confirmed</label><br />
+ * <tt>debug = {{confirmed}}</tt><br/>
+ * <tt>counter = {{counter}}</tt><br/>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * var counter = element(by.binding('counter'));
+ * var debug = element(by.binding('confirmed'));
+ *
+ * it('should evaluate the expression if changing from view', function() {
+ * expect(counter.getText()).toContain('0');
+ *
+ * element(by.id('ng-change-example1')).click();
+ *
+ * expect(counter.getText()).toContain('1');
+ * expect(debug.getText()).toContain('true');
+ * });
+ *
+ * it('should not evaluate the expression if changing from model', function() {
+ * element(by.id('ng-change-example2')).click();
+
+ * expect(counter.getText()).toContain('0');
+ * expect(debug.getText()).toContain('true');
+ * });
+ * </file>
+ * </example>
+ */
+var ngChangeDirective = valueFn({
+ require: 'ngModel',
+ link: function(scope, element, attr, ctrl) {
+ ctrl.$viewChangeListeners.push(function() {
+ scope.$eval(attr.ngChange);
+ });
+ }
+});
+
+
+var requiredDirective = function() {
+ return {
+ require: '?ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ if (!ctrl) return;
+ attr.required = true; // force truthy in case we are on non input element
+
+ var validator = function(value) {
+ if (attr.required && ctrl.$isEmpty(value)) {
+ ctrl.$setValidity('required', false);
+ return;
+ } else {
+ ctrl.$setValidity('required', true);
+ return value;
+ }
+ };
+
+ ctrl.$formatters.push(validator);
+ ctrl.$parsers.unshift(validator);
+
+ attr.$observe('required', function() {
+ validator(ctrl.$viewValue);
+ });
+ }
+ };
+};
+
+
+/**
+ * @ngdoc directive
+ * @name ngList
+ *
+ * @description
+ * Text input that converts between a delimited string and an array of strings. The delimiter
+ * can be a fixed string (by default a comma) or a regular expression.
+ *
+ * @element input
+ * @param {string=} ngList optional delimiter that should be used to split the value. If
+ * specified in form `/something/` then the value will be converted into a regular expression.
+ *
+ * @example
+ <example name="ngList-directive" module="listExample">
+ <file name="index.html">
+ <script>
+ angular.module('listExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.names = ['igor', 'misko', 'vojta'];
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ List: <input name="namesInput" ng-model="names" ng-list required>
+ <span class="error" ng-show="myForm.namesInput.$error.required">
+ Required!</span>
+ <br>
+ <tt>names = {{names}}</tt><br/>
+ <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>
+ <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var listInput = element(by.model('names'));
+ var names = element(by.binding('{{names}}'));
+ var valid = element(by.binding('myForm.namesInput.$valid'));
+ var error = element(by.css('span.error'));
+
+ it('should initialize to model', function() {
+ expect(names.getText()).toContain('["igor","misko","vojta"]');
+ expect(valid.getText()).toContain('true');
+ expect(error.getCssValue('display')).toBe('none');
+ });
+
+ it('should be invalid if empty', function() {
+ listInput.clear();
+ listInput.sendKeys('');
+
+ expect(names.getText()).toContain('');
+ expect(valid.getText()).toContain('false');
+ expect(error.getCssValue('display')).not.toBe('none'); });
+ </file>
+ </example>
+ */
+var ngListDirective = function() {
+ return {
+ require: 'ngModel',
+ link: function(scope, element, attr, ctrl) {
+ var match = /\/(.*)\//.exec(attr.ngList),
+ separator = match && new RegExp(match[1]) || attr.ngList || ',';
+
+ var parse = function(viewValue) {
+ // If the viewValue is invalid (say required but empty) it will be `undefined`
+ if (isUndefined(viewValue)) return;
+
+ var list = [];
+
+ if (viewValue) {
+ forEach(viewValue.split(separator), function(value) {
+ if (value) list.push(trim(value));
+ });
+ }
+
+ return list;
+ };
+
+ ctrl.$parsers.push(parse);
+ ctrl.$formatters.push(function(value) {
+ if (isArray(value)) {
+ return value.join(', ');
+ }
+
+ return undefined;
+ });
+
+ // Override the standard $isEmpty because an empty array means the input is empty.
+ ctrl.$isEmpty = function(value) {
+ return !value || !value.length;
+ };
+ }
+ };
+};
+
+
+var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
+/**
+ * @ngdoc directive
+ * @name ngValue
+ *
+ * @description
+ * Binds the given expression to the value of `input[select]` or `input[radio]`, so
+ * that when the element is selected, the `ngModel` of that element is set to the
+ * bound value.
+ *
+ * `ngValue` is useful when dynamically generating lists of radio buttons using `ng-repeat`, as
+ * shown below.
+ *
+ * @element input
+ * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute
+ * of the `input` element
+ *
+ * @example
+ <example name="ngValue-directive" module="valueExample">
+ <file name="index.html">
+ <script>
+ angular.module('valueExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.names = ['pizza', 'unicorns', 'robots'];
+ $scope.my = { favorite: 'unicorns' };
+ }]);
+ </script>
+ <form ng-controller="ExampleController">
+ <h2>Which is your favorite?</h2>
+ <label ng-repeat="name in names" for="{{name}}">
+ {{name}}
+ <input type="radio"
+ ng-model="my.favorite"
+ ng-value="name"
+ id="{{name}}"
+ name="favorite">
+ </label>
+ <div>You chose {{my.favorite}}</div>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var favorite = element(by.binding('my.favorite'));
+
+ it('should initialize to model', function() {
+ expect(favorite.getText()).toContain('unicorns');
+ });
+ it('should bind the values to the inputs', function() {
+ element.all(by.model('my.favorite')).get(0).click();
+ expect(favorite.getText()).toContain('pizza');
+ });
+ </file>
+ </example>
+ */
+var ngValueDirective = function() {
+ return {
+ priority: 100,
+ compile: function(tpl, tplAttr) {
+ if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {
+ return function ngValueConstantLink(scope, elm, attr) {
+ attr.$set('value', scope.$eval(attr.ngValue));
+ };
+ } else {
+ return function ngValueLink(scope, elm, attr) {
+ scope.$watch(attr.ngValue, function valueWatchAction(value) {
+ attr.$set('value', value);
+ });
+ };
+ }
+ }
+ };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngBind
+ * @restrict AC
+ *
+ * @description
+ * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element
+ * with the value of a given expression, and to update the text content when the value of that
+ * expression changes.
+ *
+ * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like
+ * `{{ expression }}` which is similar but less verbose.
+ *
+ * It is preferable to use `ngBind` instead of `{{ expression }}` if a template is momentarily
+ * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an
+ * element attribute, it makes the bindings invisible to the user while the page is loading.
+ *
+ * An alternative solution to this problem would be using the
+ * {@link ng.directive:ngCloak ngCloak} directive.
+ *
+ *
+ * @element ANY
+ * @param {expression} ngBind {@link guide/expression Expression} to evaluate.
+ *
+ * @example
+ * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
+ <example module="bindExample">
+ <file name="index.html">
+ <script>
+ angular.module('bindExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.name = 'Whirled';
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ Enter name: <input type="text" ng-model="name"><br>
+ Hello <span ng-bind="name"></span>!
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-bind', function() {
+ var nameInput = element(by.model('name'));
+
+ expect(element(by.binding('name')).getText()).toBe('Whirled');
+ nameInput.clear();
+ nameInput.sendKeys('world');
+ expect(element(by.binding('name')).getText()).toBe('world');
+ });
+ </file>
+ </example>
+ */
+var ngBindDirective = ngDirective({
+ compile: function(templateElement) {
+ templateElement.addClass('ng-binding');
+ return function (scope, element, attr) {
+ element.data('$binding', attr.ngBind);
+ scope.$watch(attr.ngBind, function ngBindWatchAction(value) {
+ // We are purposefully using == here rather than === because we want to
+ // catch when value is "null or undefined"
+ // jshint -W041
+ element.text(value == undefined ? '' : value);
+ });
+ };
+ }
+});
+
+
+/**
+ * @ngdoc directive
+ * @name ngBindTemplate
+ *
+ * @description
+ * The `ngBindTemplate` directive specifies that the element
+ * text content should be replaced with the interpolation of the template
+ * in the `ngBindTemplate` attribute.
+ * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}`
+ * expressions. This directive is needed since some HTML elements
+ * (such as TITLE and OPTION) cannot contain SPAN elements.
+ *
+ * @element ANY
+ * @param {string} ngBindTemplate template of form
+ * <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.
+ *
+ * @example
+ * Try it here: enter text in text box and watch the greeting change.
+ <example module="bindExample">
+ <file name="index.html">
+ <script>
+ angular.module('bindExample', [])
+ .controller('ExampleController', ['$scope', function ($scope) {
+ $scope.salutation = 'Hello';
+ $scope.name = 'World';
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ Salutation: <input type="text" ng-model="salutation"><br>
+ Name: <input type="text" ng-model="name"><br>
+ <pre ng-bind-template="{{salutation}} {{name}}!"></pre>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-bind', function() {
+ var salutationElem = element(by.binding('salutation'));
+ var salutationInput = element(by.model('salutation'));
+ var nameInput = element(by.model('name'));
+
+ expect(salutationElem.getText()).toBe('Hello World!');
+
+ salutationInput.clear();
+ salutationInput.sendKeys('Greetings');
+ nameInput.clear();
+ nameInput.sendKeys('user');
+
+ expect(salutationElem.getText()).toBe('Greetings user!');
+ });
+ </file>
+ </example>
+ */
+var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
+ return function(scope, element, attr) {
+ // TODO: move this to scenario runner
+ var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));
+ element.addClass('ng-binding').data('$binding', interpolateFn);
+ attr.$observe('ngBindTemplate', function(value) {
+ element.text(value);
+ });
+ };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngBindHtml
+ *
+ * @description
+ * Creates a binding that will innerHTML the result of evaluating the `expression` into the current
+ * element in a secure way. By default, the innerHTML-ed content will be sanitized using the {@link
+ * ngSanitize.$sanitize $sanitize} service. To utilize this functionality, ensure that `$sanitize`
+ * is available, for example, by including {@link ngSanitize} in your module's dependencies (not in
+ * core Angular.) You may also bypass sanitization for values you know are safe. To do so, bind to
+ * an explicitly trusted value via {@link ng.$sce#trustAsHtml $sce.trustAsHtml}. See the example
+ * under {@link ng.$sce#Example Strict Contextual Escaping (SCE)}.
+ *
+ * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you
+ * will have an exception (instead of an exploit.)
+ *
+ * @element ANY
+ * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.
+ *
+ * @example
+
+ <example module="bindHtmlExample" deps="angular-sanitize.js">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <p ng-bind-html="myHTML"></p>
+ </div>
+ </file>
+
+ <file name="script.js">
+ angular.module('bindHtmlExample', ['ngSanitize'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.myHTML =
+ 'I am an <code>HTML</code>string with ' +
+ '<a href="#">links!</a> and other <em>stuff</em>';
+ }]);
+ </file>
+
+ <file name="protractor.js" type="protractor">
+ it('should check ng-bind-html', function() {
+ expect(element(by.binding('myHTML')).getText()).toBe(
+ 'I am an HTMLstring with links! and other stuff');
+ });
+ </file>
+ </example>
+ */
+var ngBindHtmlDirective = ['$sce', '$parse', function($sce, $parse) {
+ return {
+ compile: function (tElement) {
+ tElement.addClass('ng-binding');
+
+ return function (scope, element, attr) {
+ element.data('$binding', attr.ngBindHtml);
+
+ var parsed = $parse(attr.ngBindHtml);
+
+ function getStringValue() {
+ return (parsed(scope) || '').toString();
+ }
+
+ scope.$watch(getStringValue, function ngBindHtmlWatchAction(value) {
+ element.html($sce.getTrustedHtml(parsed(scope)) || '');
+ });
+ };
+ }
+ };
+}];
+
+function classDirective(name, selector) {
+ name = 'ngClass' + name;
+ return ['$animate', function($animate) {
+ return {
+ restrict: 'AC',
+ link: function(scope, element, attr) {
+ var oldVal;
+
+ scope.$watch(attr[name], ngClassWatchAction, true);
+
+ attr.$observe('class', function(value) {
+ ngClassWatchAction(scope.$eval(attr[name]));
+ });
+
+
+ if (name !== 'ngClass') {
+ scope.$watch('$index', function($index, old$index) {
+ // jshint bitwise: false
+ var mod = $index & 1;
+ if (mod !== (old$index & 1)) {
+ var classes = arrayClasses(scope.$eval(attr[name]));
+ mod === selector ?
+ addClasses(classes) :
+ removeClasses(classes);
+ }
+ });
+ }
+
+ function addClasses(classes) {
+ var newClasses = digestClassCounts(classes, 1);
+ attr.$addClass(newClasses);
+ }
+
+ function removeClasses(classes) {
+ var newClasses = digestClassCounts(classes, -1);
+ attr.$removeClass(newClasses);
+ }
+
+ function digestClassCounts (classes, count) {
+ var classCounts = element.data('$classCounts') || {};
+ var classesToUpdate = [];
+ forEach(classes, function (className) {
+ if (count > 0 || classCounts[className]) {
+ classCounts[className] = (classCounts[className] || 0) + count;
+ if (classCounts[className] === +(count > 0)) {
+ classesToUpdate.push(className);
+ }
+ }
+ });
+ element.data('$classCounts', classCounts);
+ return classesToUpdate.join(' ');
+ }
+
+ function updateClasses (oldClasses, newClasses) {
+ var toAdd = arrayDifference(newClasses, oldClasses);
+ var toRemove = arrayDifference(oldClasses, newClasses);
+ toRemove = digestClassCounts(toRemove, -1);
+ toAdd = digestClassCounts(toAdd, 1);
+
+ if (toAdd.length === 0) {
+ $animate.removeClass(element, toRemove);
+ } else if (toRemove.length === 0) {
+ $animate.addClass(element, toAdd);
+ } else {
+ $animate.setClass(element, toAdd, toRemove);
+ }
+ }
+
+ function ngClassWatchAction(newVal) {
+ if (selector === true || scope.$index % 2 === selector) {
+ var newClasses = arrayClasses(newVal || []);
+ if (!oldVal) {
+ addClasses(newClasses);
+ } else if (!equals(newVal,oldVal)) {
+ var oldClasses = arrayClasses(oldVal);
+ updateClasses(oldClasses, newClasses);
+ }
+ }
+ oldVal = shallowCopy(newVal);
+ }
+ }
+ };
+
+ function arrayDifference(tokens1, tokens2) {
+ var values = [];
+
+ outer:
+ for(var i = 0; i < tokens1.length; i++) {
+ var token = tokens1[i];
+ for(var j = 0; j < tokens2.length; j++) {
+ if(token == tokens2[j]) continue outer;
+ }
+ values.push(token);
+ }
+ return values;
+ }
+
+ function arrayClasses (classVal) {
+ if (isArray(classVal)) {
+ return classVal;
+ } else if (isString(classVal)) {
+ return classVal.split(' ');
+ } else if (isObject(classVal)) {
+ var classes = [], i = 0;
+ forEach(classVal, function(v, k) {
+ if (v) {
+ classes = classes.concat(k.split(' '));
+ }
+ });
+ return classes;
+ }
+ return classVal;
+ }
+ }];
+}
+
+/**
+ * @ngdoc directive
+ * @name ngClass
+ * @restrict AC
+ *
+ * @description
+ * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding
+ * an expression that represents all classes to be added.
+ *
+ * The directive operates in three different ways, depending on which of three types the expression
+ * evaluates to:
+ *
+ * 1. If the expression evaluates to a string, the string should be one or more space-delimited class
+ * names.
+ *
+ * 2. If the expression evaluates to an array, each element of the array should be a string that is
+ * one or more space-delimited class names.
+ *
+ * 3. If the expression evaluates to an object, then for each key-value pair of the
+ * object with a truthy value the corresponding key is used as a class name.
+ *
+ * The directive won't add duplicate classes if a particular class was already set.
+ *
+ * When the expression changes, the previously added classes are removed and only then the
+ * new classes are added.
+ *
+ * @animations
+ * add - happens just before the class is applied to the element
+ * remove - happens just before the class is removed from the element
+ *
+ * @element ANY
+ * @param {expression} ngClass {@link guide/expression Expression} to eval. The result
+ * of the evaluation can be a string representing space delimited class
+ * names, an array, or a map of class names to boolean values. In the case of a map, the
+ * names of the properties whose values are truthy will be added as css classes to the
+ * element.
+ *
+ * @example Example that demonstrates basic bindings via ngClass directive.
+ <example>
+ <file name="index.html">
+ <p ng-class="{strike: deleted, bold: important, red: error}">Map Syntax Example</p>
+ <input type="checkbox" ng-model="deleted"> deleted (apply "strike" class)<br>
+ <input type="checkbox" ng-model="important"> important (apply "bold" class)<br>
+ <input type="checkbox" ng-model="error"> error (apply "red" class)
+ <hr>
+ <p ng-class="style">Using String Syntax</p>
+ <input type="text" ng-model="style" placeholder="Type: bold strike red">
+ <hr>
+ <p ng-class="[style1, style2, style3]">Using Array Syntax</p>
+ <input ng-model="style1" placeholder="Type: bold, strike or red"><br>
+ <input ng-model="style2" placeholder="Type: bold, strike or red"><br>
+ <input ng-model="style3" placeholder="Type: bold, strike or red"><br>
+ </file>
+ <file name="style.css">
+ .strike {
+ text-decoration: line-through;
+ }
+ .bold {
+ font-weight: bold;
+ }
+ .red {
+ color: red;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var ps = element.all(by.css('p'));
+
+ it('should let you toggle the class', function() {
+
+ expect(ps.first().getAttribute('class')).not.toMatch(/bold/);
+ expect(ps.first().getAttribute('class')).not.toMatch(/red/);
+
+ element(by.model('important')).click();
+ expect(ps.first().getAttribute('class')).toMatch(/bold/);
+
+ element(by.model('error')).click();
+ expect(ps.first().getAttribute('class')).toMatch(/red/);
+ });
+
+ it('should let you toggle string example', function() {
+ expect(ps.get(1).getAttribute('class')).toBe('');
+ element(by.model('style')).clear();
+ element(by.model('style')).sendKeys('red');
+ expect(ps.get(1).getAttribute('class')).toBe('red');
+ });
+
+ it('array example should have 3 classes', function() {
+ expect(ps.last().getAttribute('class')).toBe('');
+ element(by.model('style1')).sendKeys('bold');
+ element(by.model('style2')).sendKeys('strike');
+ element(by.model('style3')).sendKeys('red');
+ expect(ps.last().getAttribute('class')).toBe('bold strike red');
+ });
+ </file>
+ </example>
+
+ ## Animations
+
+ The example below demonstrates how to perform animations using ngClass.
+
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <input id="setbtn" type="button" value="set" ng-click="myVar='my-class'">
+ <input id="clearbtn" type="button" value="clear" ng-click="myVar=''">
+ <br>
+ <span class="base-class" ng-class="myVar">Sample Text</span>
+ </file>
+ <file name="style.css">
+ .base-class {
+ -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+ }
+
+ .base-class.my-class {
+ color: red;
+ font-size:3em;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-class', function() {
+ expect(element(by.css('.base-class')).getAttribute('class')).not.
+ toMatch(/my-class/);
+
+ element(by.id('setbtn')).click();
+
+ expect(element(by.css('.base-class')).getAttribute('class')).
+ toMatch(/my-class/);
+
+ element(by.id('clearbtn')).click();
+
+ expect(element(by.css('.base-class')).getAttribute('class')).not.
+ toMatch(/my-class/);
+ });
+ </file>
+ </example>
+
+
+ ## ngClass and pre-existing CSS3 Transitions/Animations
+ The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.
+ Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder
+ any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure
+ to view the step by step details of {@link ngAnimate.$animate#addclass $animate.addClass} and
+ {@link ngAnimate.$animate#removeclass $animate.removeClass}.
+ */
+var ngClassDirective = classDirective('', true);
+
+/**
+ * @ngdoc directive
+ * @name ngClassOdd
+ * @restrict AC
+ *
+ * @description
+ * The `ngClassOdd` and `ngClassEven` directives work exactly as
+ * {@link ng.directive:ngClass ngClass}, except they work in
+ * conjunction with `ngRepeat` and take effect only on odd (even) rows.
+ *
+ * This directive can be applied only within the scope of an
+ * {@link ng.directive:ngRepeat ngRepeat}.
+ *
+ * @element ANY
+ * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result
+ * of the evaluation can be a string representing space delimited class names or an array.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
+ <li ng-repeat="name in names">
+ <span ng-class-odd="'odd'" ng-class-even="'even'">
+ {{name}}
+ </span>
+ </li>
+ </ol>
+ </file>
+ <file name="style.css">
+ .odd {
+ color: red;
+ }
+ .even {
+ color: blue;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-class-odd and ng-class-even', function() {
+ expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
+ toMatch(/odd/);
+ expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
+ toMatch(/even/);
+ });
+ </file>
+ </example>
+ */
+var ngClassOddDirective = classDirective('Odd', 0);
+
+/**
+ * @ngdoc directive
+ * @name ngClassEven
+ * @restrict AC
+ *
+ * @description
+ * The `ngClassOdd` and `ngClassEven` directives work exactly as
+ * {@link ng.directive:ngClass ngClass}, except they work in
+ * conjunction with `ngRepeat` and take effect only on odd (even) rows.
+ *
+ * This directive can be applied only within the scope of an
+ * {@link ng.directive:ngRepeat ngRepeat}.
+ *
+ * @element ANY
+ * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The
+ * result of the evaluation can be a string representing space delimited class names or an array.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
+ <li ng-repeat="name in names">
+ <span ng-class-odd="'odd'" ng-class-even="'even'">
+ {{name}} &nbsp; &nbsp; &nbsp;
+ </span>
+ </li>
+ </ol>
+ </file>
+ <file name="style.css">
+ .odd {
+ color: red;
+ }
+ .even {
+ color: blue;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-class-odd and ng-class-even', function() {
+ expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
+ toMatch(/odd/);
+ expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
+ toMatch(/even/);
+ });
+ </file>
+ </example>
+ */
+var ngClassEvenDirective = classDirective('Even', 1);
+
+/**
+ * @ngdoc directive
+ * @name ngCloak
+ * @restrict AC
+ *
+ * @description
+ * The `ngCloak` directive is used to prevent the Angular html template from being briefly
+ * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this
+ * directive to avoid the undesirable flicker effect caused by the html template display.
+ *
+ * The directive can be applied to the `<body>` element, but the preferred usage is to apply
+ * multiple `ngCloak` directives to small portions of the page to permit progressive rendering
+ * of the browser view.
+ *
+ * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and
+ * `angular.min.js`.
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```css
+ * [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
+ * display: none !important;
+ * }
+ * ```
+ *
+ * When this css rule is loaded by the browser, all html elements (including their children) that
+ * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive
+ * during the compilation of the template it deletes the `ngCloak` element attribute, making
+ * the compiled element visible.
+ *
+ * For the best result, the `angular.js` script must be loaded in the head section of the html
+ * document; alternatively, the css rule above must be included in the external stylesheet of the
+ * application.
+ *
+ * Legacy browsers, like IE7, do not provide attribute selector support (added in CSS 2.1) so they
+ * cannot match the `[ng\:cloak]` selector. To work around this limitation, you must add the css
+ * class `ng-cloak` in addition to the `ngCloak` directive as shown in the example below.
+ *
+ * @element ANY
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <div id="template1" ng-cloak>{{ 'hello' }}</div>
+ <div id="template2" ng-cloak class="ng-cloak">{{ 'hello IE7' }}</div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should remove the template directive and css class', function() {
+ expect($('#template1').getAttribute('ng-cloak')).
+ toBeNull();
+ expect($('#template2').getAttribute('ng-cloak')).
+ toBeNull();
+ });
+ </file>
+ </example>
+ *
+ */
+var ngCloakDirective = ngDirective({
+ compile: function(element, attr) {
+ attr.$set('ngCloak', undefined);
+ element.removeClass('ng-cloak');
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngController
+ *
+ * @description
+ * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular
+ * supports the principles behind the Model-View-Controller design pattern.
+ *
+ * MVC components in angular:
+ *
+ * * Model — Models are the properties of a scope; scopes are attached to the DOM where scope properties
+ * are accessed through bindings.
+ * * View — The template (HTML with data bindings) that is rendered into the View.
+ * * Controller — The `ngController` directive specifies a Controller class; the class contains business
+ * logic behind the application to decorate the scope with functions and values
+ *
+ * Note that you can also attach controllers to the DOM by declaring it in a route definition
+ * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller
+ * again using `ng-controller` in the template itself. This will cause the controller to be attached
+ * and executed twice.
+ *
+ * @element ANY
+ * @scope
+ * @param {expression} ngController Name of a globally accessible constructor function or an
+ * {@link guide/expression expression} that on the current scope evaluates to a
+ * constructor function. The controller instance can be published into a scope property
+ * by specifying `as propertyName`.
+ *
+ * @example
+ * Here is a simple form for editing user contact information. Adding, removing, clearing, and
+ * greeting are methods declared on the controller (see source tab). These methods can
+ * easily be called from the angular markup. Any changes to the data are automatically reflected
+ * in the View without the need for a manual update.
+ *
+ * Two different declaration styles are included below:
+ *
+ * * one binds methods and properties directly onto the controller using `this`:
+ * `ng-controller="SettingsController1 as settings"`
+ * * one injects `$scope` into the controller:
+ * `ng-controller="SettingsController2"`
+ *
+ * The second option is more common in the Angular community, and is generally used in boilerplates
+ * and in this guide. However, there are advantages to binding properties directly to the controller
+ * and avoiding scope.
+ *
+ * * Using `controller as` makes it obvious which controller you are accessing in the template when
+ * multiple controllers apply to an element.
+ * * If you are writing your controllers as classes you have easier access to the properties and
+ * methods, which will appear on the scope, from inside the controller code.
+ * * Since there is always a `.` in the bindings, you don't have to worry about prototypal
+ * inheritance masking primitives.
+ *
+ * This example demonstrates the `controller as` syntax.
+ *
+ * <example name="ngControllerAs" module="controllerAsExample">
+ * <file name="index.html">
+ * <div id="ctrl-as-exmpl" ng-controller="SettingsController1 as settings">
+ * Name: <input type="text" ng-model="settings.name"/>
+ * [ <a href="" ng-click="settings.greet()">greet</a> ]<br/>
+ * Contact:
+ * <ul>
+ * <li ng-repeat="contact in settings.contacts">
+ * <select ng-model="contact.type">
+ * <option>phone</option>
+ * <option>email</option>
+ * </select>
+ * <input type="text" ng-model="contact.value"/>
+ * [ <a href="" ng-click="settings.clearContact(contact)">clear</a>
+ * | <a href="" ng-click="settings.removeContact(contact)">X</a> ]
+ * </li>
+ * <li>[ <a href="" ng-click="settings.addContact()">add</a> ]</li>
+ * </ul>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('controllerAsExample', [])
+ * .controller('SettingsController1', SettingsController1);
+ *
+ * function SettingsController1() {
+ * this.name = "John Smith";
+ * this.contacts = [
+ * {type: 'phone', value: '408 555 1212'},
+ * {type: 'email', value: 'john.smith@example.org'} ];
+ * }
+ *
+ * SettingsController1.prototype.greet = function() {
+ * alert(this.name);
+ * };
+ *
+ * SettingsController1.prototype.addContact = function() {
+ * this.contacts.push({type: 'email', value: 'yourname@example.org'});
+ * };
+ *
+ * SettingsController1.prototype.removeContact = function(contactToRemove) {
+ * var index = this.contacts.indexOf(contactToRemove);
+ * this.contacts.splice(index, 1);
+ * };
+ *
+ * SettingsController1.prototype.clearContact = function(contact) {
+ * contact.type = 'phone';
+ * contact.value = '';
+ * };
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should check controller as', function() {
+ * var container = element(by.id('ctrl-as-exmpl'));
+ * expect(container.element(by.model('settings.name'))
+ * .getAttribute('value')).toBe('John Smith');
+ *
+ * var firstRepeat =
+ * container.element(by.repeater('contact in settings.contacts').row(0));
+ * var secondRepeat =
+ * container.element(by.repeater('contact in settings.contacts').row(1));
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('408 555 1212');
+ *
+ * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('john.smith@example.org');
+ *
+ * firstRepeat.element(by.linkText('clear')).click();
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('');
+ *
+ * container.element(by.linkText('add')).click();
+ *
+ * expect(container.element(by.repeater('contact in settings.contacts').row(2))
+ * .element(by.model('contact.value'))
+ * .getAttribute('value'))
+ * .toBe('yourname@example.org');
+ * });
+ * </file>
+ * </example>
+ *
+ * This example demonstrates the "attach to `$scope`" style of controller.
+ *
+ * <example name="ngController" module="controllerExample">
+ * <file name="index.html">
+ * <div id="ctrl-exmpl" ng-controller="SettingsController2">
+ * Name: <input type="text" ng-model="name"/>
+ * [ <a href="" ng-click="greet()">greet</a> ]<br/>
+ * Contact:
+ * <ul>
+ * <li ng-repeat="contact in contacts">
+ * <select ng-model="contact.type">
+ * <option>phone</option>
+ * <option>email</option>
+ * </select>
+ * <input type="text" ng-model="contact.value"/>
+ * [ <a href="" ng-click="clearContact(contact)">clear</a>
+ * | <a href="" ng-click="removeContact(contact)">X</a> ]
+ * </li>
+ * <li>[ <a href="" ng-click="addContact()">add</a> ]</li>
+ * </ul>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('controllerExample', [])
+ * .controller('SettingsController2', ['$scope', SettingsController2]);
+ *
+ * function SettingsController2($scope) {
+ * $scope.name = "John Smith";
+ * $scope.contacts = [
+ * {type:'phone', value:'408 555 1212'},
+ * {type:'email', value:'john.smith@example.org'} ];
+ *
+ * $scope.greet = function() {
+ * alert($scope.name);
+ * };
+ *
+ * $scope.addContact = function() {
+ * $scope.contacts.push({type:'email', value:'yourname@example.org'});
+ * };
+ *
+ * $scope.removeContact = function(contactToRemove) {
+ * var index = $scope.contacts.indexOf(contactToRemove);
+ * $scope.contacts.splice(index, 1);
+ * };
+ *
+ * $scope.clearContact = function(contact) {
+ * contact.type = 'phone';
+ * contact.value = '';
+ * };
+ * }
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should check controller', function() {
+ * var container = element(by.id('ctrl-exmpl'));
+ *
+ * expect(container.element(by.model('name'))
+ * .getAttribute('value')).toBe('John Smith');
+ *
+ * var firstRepeat =
+ * container.element(by.repeater('contact in contacts').row(0));
+ * var secondRepeat =
+ * container.element(by.repeater('contact in contacts').row(1));
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('408 555 1212');
+ * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('john.smith@example.org');
+ *
+ * firstRepeat.element(by.linkText('clear')).click();
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('');
+ *
+ * container.element(by.linkText('add')).click();
+ *
+ * expect(container.element(by.repeater('contact in contacts').row(2))
+ * .element(by.model('contact.value'))
+ * .getAttribute('value'))
+ * .toBe('yourname@example.org');
+ * });
+ * </file>
+ *</example>
+
+ */
+var ngControllerDirective = [function() {
+ return {
+ scope: true,
+ controller: '@',
+ priority: 500
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngCsp
+ *
+ * @element html
+ * @description
+ * Enables [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) support.
+ *
+ * This is necessary when developing things like Google Chrome Extensions.
+ *
+ * CSP forbids apps to use `eval` or `Function(string)` generated functions (among other things).
+ * For Angular to be CSP compatible there are only two things that we need to do differently:
+ *
+ * - don't use `Function` constructor to generate optimized value getters
+ * - don't inject custom stylesheet into the document
+ *
+ * AngularJS uses `Function(string)` generated functions as a speed optimization. Applying the `ngCsp`
+ * directive will cause Angular to use CSP compatibility mode. When this mode is on AngularJS will
+ * evaluate all expressions up to 30% slower than in non-CSP mode, but no security violations will
+ * be raised.
+ *
+ * CSP forbids JavaScript to inline stylesheet rules. In non CSP mode Angular automatically
+ * includes some CSS rules (e.g. {@link ng.directive:ngCloak ngCloak}).
+ * To make those directives work in CSP mode, include the `angular-csp.css` manually.
+ *
+ * Angular tries to autodetect if CSP is active and automatically turn on the CSP-safe mode. This
+ * autodetection however triggers a CSP error to be logged in the console:
+ *
+ * ```
+ * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of
+ * script in the following Content Security Policy directive: "default-src 'self'". Note that
+ * 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
+ * ```
+ *
+ * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`
+ * directive on the root element of the application or on the `angular.js` script tag, whichever
+ * appears first in the html document.
+ *
+ * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*
+ *
+ * @example
+ * This example shows how to apply the `ngCsp` directive to the `html` tag.
+ ```html
+ <!doctype html>
+ <html ng-app ng-csp>
+ ...
+ ...
+ </html>
+ ```
+ */
+
+// ngCsp is not implemented as a proper directive any more, because we need it be processed while we
+// bootstrap the system (before $parse is instantiated), for this reason we just have
+// the csp.isActive() fn that looks for ng-csp attribute anywhere in the current doc
+
+/**
+ * @ngdoc directive
+ * @name ngClick
+ *
+ * @description
+ * The ngClick directive allows you to specify custom behavior when
+ * an element is clicked.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon
+ * click. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-click="count = count + 1" ng-init="count=0">
+ Increment
+ </button>
+ <span>
+ count: {{count}}
+ <span>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-click', function() {
+ expect(element(by.binding('count')).getText()).toMatch('0');
+ element(by.css('button')).click();
+ expect(element(by.binding('count')).getText()).toMatch('1');
+ });
+ </file>
+ </example>
+ */
+/*
+ * A directive that allows creation of custom onclick handlers that are defined as angular
+ * expressions and are compiled and executed within the current scope.
+ *
+ * Events that are handled via these handler are always configured not to propagate further.
+ */
+var ngEventDirectives = {};
+
+// For events that might fire synchronously during DOM manipulation
+// we need to execute their event handlers asynchronously using $evalAsync,
+// so that they are not executed in an inconsistent state.
+var forceAsyncEvents = {
+ 'blur': true,
+ 'focus': true
+};
+forEach(
+ 'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),
+ function(eventName) {
+ var directiveName = directiveNormalize('ng-' + eventName);
+ ngEventDirectives[directiveName] = ['$parse', '$rootScope', function($parse, $rootScope) {
+ return {
+ compile: function($element, attr) {
+ var fn = $parse(attr[directiveName]);
+ return function ngEventHandler(scope, element) {
+ element.on(eventName, function(event) {
+ var callback = function() {
+ fn(scope, {$event:event});
+ };
+ if (forceAsyncEvents[eventName] && $rootScope.$$phase) {
+ scope.$evalAsync(callback);
+ } else {
+ scope.$apply(callback);
+ }
+ });
+ };
+ }
+ };
+ }];
+ }
+);
+
+/**
+ * @ngdoc directive
+ * @name ngDblclick
+ *
+ * @description
+ * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon
+ * a dblclick. (The Event object is available as `$event`)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-dblclick="count = count + 1" ng-init="count=0">
+ Increment (on double click)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMousedown
+ *
+ * @description
+ * The ngMousedown directive allows you to specify custom behavior on mousedown event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon
+ * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mousedown="count = count + 1" ng-init="count=0">
+ Increment (on mouse down)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseup
+ *
+ * @description
+ * Specify custom behavior on mouseup event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon
+ * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseup="count = count + 1" ng-init="count=0">
+ Increment (on mouse up)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngMouseover
+ *
+ * @description
+ * Specify custom behavior on mouseover event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon
+ * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseover="count = count + 1" ng-init="count=0">
+ Increment (when mouse is over)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseenter
+ *
+ * @description
+ * Specify custom behavior on mouseenter event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon
+ * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseenter="count = count + 1" ng-init="count=0">
+ Increment (when mouse enters)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseleave
+ *
+ * @description
+ * Specify custom behavior on mouseleave event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon
+ * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseleave="count = count + 1" ng-init="count=0">
+ Increment (when mouse leaves)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMousemove
+ *
+ * @description
+ * Specify custom behavior on mousemove event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon
+ * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mousemove="count = count + 1" ng-init="count=0">
+ Increment (when mouse moves)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeydown
+ *
+ * @description
+ * Specify custom behavior on keydown event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon
+ * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-keydown="count = count + 1" ng-init="count=0">
+ key down count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeyup
+ *
+ * @description
+ * Specify custom behavior on keyup event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon
+ * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <p>Typing in the input box below updates the key count</p>
+ <input ng-keyup="count = count + 1" ng-init="count=0"> key up count: {{count}}
+
+ <p>Typing in the input box below updates the keycode</p>
+ <input ng-keyup="event=$event">
+ <p>event keyCode: {{ event.keyCode }}</p>
+ <p>event altKey: {{ event.altKey }}</p>
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeypress
+ *
+ * @description
+ * Specify custom behavior on keypress event.
+ *
+ * @element ANY
+ * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon
+ * keypress. ({@link guide/expression#-event- Event object is available as `$event`}
+ * and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-keypress="count = count + 1" ng-init="count=0">
+ key press count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngSubmit
+ *
+ * @description
+ * Enables binding angular expressions to onsubmit events.
+ *
+ * Additionally it prevents the default action (which for form means sending the request to the
+ * server and reloading the current page), but only if the form does not contain `action`,
+ * `data-action`, or `x-action` attributes.
+ *
+ * <div class="alert alert-warning">
+ * **Warning:** Be careful not to cause "double-submission" by using both the `ngClick` and
+ * `ngSubmit` handlers together. See the
+ * {@link form#submitting-a-form-and-preventing-the-default-action `form` directive documentation}
+ * for a detailed discussion of when `ngSubmit` may be triggered.
+ * </div>
+ *
+ * @element form
+ * @priority 0
+ * @param {expression} ngSubmit {@link guide/expression Expression} to eval.
+ * ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example module="submitExample">
+ <file name="index.html">
+ <script>
+ angular.module('submitExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.list = [];
+ $scope.text = 'hello';
+ $scope.submit = function() {
+ if ($scope.text) {
+ $scope.list.push(this.text);
+ $scope.text = '';
+ }
+ };
+ }]);
+ </script>
+ <form ng-submit="submit()" ng-controller="ExampleController">
+ Enter text and hit enter:
+ <input type="text" ng-model="text" name="text" />
+ <input type="submit" id="submit" value="Submit" />
+ <pre>list={{list}}</pre>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-submit', function() {
+ expect(element(by.binding('list')).getText()).toBe('list=[]');
+ element(by.css('#submit')).click();
+ expect(element(by.binding('list')).getText()).toContain('hello');
+ expect(element(by.model('text')).getAttribute('value')).toBe('');
+ });
+ it('should ignore empty strings', function() {
+ expect(element(by.binding('list')).getText()).toBe('list=[]');
+ element(by.css('#submit')).click();
+ element(by.css('#submit')).click();
+ expect(element(by.binding('list')).getText()).toContain('hello');
+ });
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngFocus
+ *
+ * @description
+ * Specify custom behavior on focus event.
+ *
+ * Note: As the `focus` event is executed synchronously when calling `input.focus()`
+ * AngularJS executes the expression using `scope.$evalAsync` if the event is fired
+ * during an `$apply` to ensure a consistent state.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon
+ * focus. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ * See {@link ng.directive:ngClick ngClick}
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngBlur
+ *
+ * @description
+ * Specify custom behavior on blur event.
+ *
+ * A [blur event](https://developer.mozilla.org/en-US/docs/Web/Events/blur) fires when
+ * an element has lost focus.
+ *
+ * Note: As the `blur` event is executed synchronously also during DOM manipulations
+ * (e.g. removing a focussed input),
+ * AngularJS executes the expression using `scope.$evalAsync` if the event is fired
+ * during an `$apply` to ensure a consistent state.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon
+ * blur. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ * See {@link ng.directive:ngClick ngClick}
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngCopy
+ *
+ * @description
+ * Specify custom behavior on copy event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon
+ * copy. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-copy="copied=true" ng-init="copied=false; value='copy me'" ng-model="value">
+ copied: {{copied}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngCut
+ *
+ * @description
+ * Specify custom behavior on cut event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon
+ * cut. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-cut="cut=true" ng-init="cut=false; value='cut me'" ng-model="value">
+ cut: {{cut}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngPaste
+ *
+ * @description
+ * Specify custom behavior on paste event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon
+ * paste. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-paste="paste=true" ng-init="paste=false" placeholder='paste here'>
+ pasted: {{paste}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngIf
+ * @restrict A
+ *
+ * @description
+ * The `ngIf` directive removes or recreates a portion of the DOM tree based on an
+ * {expression}. If the expression assigned to `ngIf` evaluates to a false
+ * value then the element is removed from the DOM, otherwise a clone of the
+ * element is reinserted into the DOM.
+ *
+ * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the
+ * element in the DOM rather than changing its visibility via the `display` css property. A common
+ * case when this difference is significant is when using css selectors that rely on an element's
+ * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes.
+ *
+ * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope
+ * is created when the element is restored. The scope created within `ngIf` inherits from
+ * its parent scope using
+ * [prototypal inheritance](https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-Prototypal-Inheritance).
+ * An important implication of this is if `ngModel` is used within `ngIf` to bind to
+ * a javascript primitive defined in the parent scope. In this case any modifications made to the
+ * variable within the child scope will override (hide) the value in the parent scope.
+ *
+ * Also, `ngIf` recreates elements using their compiled state. An example of this behavior
+ * is if an element's class attribute is directly modified after it's compiled, using something like
+ * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element
+ * the added class will be lost because the original compiled state is used to regenerate the element.
+ *
+ * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter`
+ * and `leave` effects.
+ *
+ * @animations
+ * enter - happens just after the ngIf contents change and a new DOM element is created and injected into the ngIf container
+ * leave - happens just before the ngIf contents are removed from the DOM
+ *
+ * @element ANY
+ * @scope
+ * @priority 600
+ * @param {expression} ngIf If the {@link guide/expression expression} is falsy then
+ * the element is removed from the DOM tree. If it is truthy a copy of the compiled
+ * element is added to the DOM tree.
+ *
+ * @example
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ Click me: <input type="checkbox" ng-model="checked" ng-init="checked=true" /><br/>
+ Show when checked:
+ <span ng-if="checked" class="animate-if">
+ I'm removed when the checkbox is unchecked.
+ </span>
+ </file>
+ <file name="animations.css">
+ .animate-if {
+ background:white;
+ border:1px solid black;
+ padding:10px;
+ }
+
+ .animate-if.ng-enter, .animate-if.ng-leave {
+ -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+ }
+
+ .animate-if.ng-enter,
+ .animate-if.ng-leave.ng-leave-active {
+ opacity:0;
+ }
+
+ .animate-if.ng-leave,
+ .animate-if.ng-enter.ng-enter-active {
+ opacity:1;
+ }
+ </file>
+ </example>
+ */
+var ngIfDirective = ['$animate', function($animate) {
+ return {
+ transclude: 'element',
+ priority: 600,
+ terminal: true,
+ restrict: 'A',
+ $$tlb: true,
+ link: function ($scope, $element, $attr, ctrl, $transclude) {
+ var block, childScope, previousElements;
+ $scope.$watch($attr.ngIf, function ngIfWatchAction(value) {
+
+ if (toBoolean(value)) {
+ if (!childScope) {
+ childScope = $scope.$new();
+ $transclude(childScope, function (clone) {
+ clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ');
+ // Note: We only need the first/last node of the cloned nodes.
+ // However, we need to keep the reference to the jqlite wrapper as it might be changed later
+ // by a directive with templateUrl when its template arrives.
+ block = {
+ clone: clone
+ };
+ $animate.enter(clone, $element.parent(), $element);
+ });
+ }
+ } else {
+ if(previousElements) {
+ previousElements.remove();
+ previousElements = null;
+ }
+ if(childScope) {
+ childScope.$destroy();
+ childScope = null;
+ }
+ if(block) {
+ previousElements = getBlockElements(block.clone);
+ $animate.leave(previousElements, function() {
+ previousElements = null;
+ });
+ block = null;
+ }
+ }
+ });
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngInclude
+ * @restrict ECA
+ *
+ * @description
+ * Fetches, compiles and includes an external HTML fragment.
+ *
+ * By default, the template URL is restricted to the same domain and protocol as the
+ * application document. This is done by calling {@link ng.$sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols
+ * you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist them} or
+ * [wrap them](ng.$sce#trustAsResourceUrl) as trusted values. Refer to Angular's {@link
+ * ng.$sce Strict Contextual Escaping}.
+ *
+ * In addition, the browser's
+ * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+ * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
+ * policy may further restrict whether the template is successfully loaded.
+ * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://`
+ * access on some browsers.
+ *
+ * @animations
+ * enter - animation is used to bring new content into the browser.
+ * leave - animation is used to animate existing content away.
+ *
+ * The enter and leave animation occur concurrently.
+ *
+ * @scope
+ * @priority 400
+ *
+ * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,
+ * make sure you wrap it in **single** quotes, e.g. `src="'myPartialTemplate.html'"`.
+ * @param {string=} onload Expression to evaluate when a new partial is loaded.
+ *
+ * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll
+ * $anchorScroll} to scroll the viewport after the content is loaded.
+ *
+ * - If the attribute is not set, disable scrolling.
+ * - If the attribute is set without value, enable scrolling.
+ * - Otherwise enable scrolling only if the expression evaluates to truthy value.
+ *
+ * @example
+ <example module="includeExample" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <select ng-model="template" ng-options="t.name for t in templates">
+ <option value="">(blank)</option>
+ </select>
+ url of the template: <tt>{{template.url}}</tt>
+ <hr/>
+ <div class="slide-animate-container">
+ <div class="slide-animate" ng-include="template.url"></div>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('includeExample', ['ngAnimate'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.templates =
+ [ { name: 'template1.html', url: 'template1.html'},
+ { name: 'template2.html', url: 'template2.html'} ];
+ $scope.template = $scope.templates[0];
+ }]);
+ </file>
+ <file name="template1.html">
+ Content of template1.html
+ </file>
+ <file name="template2.html">
+ Content of template2.html
+ </file>
+ <file name="animations.css">
+ .slide-animate-container {
+ position:relative;
+ background:white;
+ border:1px solid black;
+ height:40px;
+ overflow:hidden;
+ }
+
+ .slide-animate {
+ padding:10px;
+ }
+
+ .slide-animate.ng-enter, .slide-animate.ng-leave {
+ -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+
+ position:absolute;
+ top:0;
+ left:0;
+ right:0;
+ bottom:0;
+ display:block;
+ padding:10px;
+ }
+
+ .slide-animate.ng-enter {
+ top:-50px;
+ }
+ .slide-animate.ng-enter.ng-enter-active {
+ top:0;
+ }
+
+ .slide-animate.ng-leave {
+ top:0;
+ }
+ .slide-animate.ng-leave.ng-leave-active {
+ top:50px;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var templateSelect = element(by.model('template'));
+ var includeElem = element(by.css('[ng-include]'));
+
+ it('should load template1.html', function() {
+ expect(includeElem.getText()).toMatch(/Content of template1.html/);
+ });
+
+ it('should load template2.html', function() {
+ if (browser.params.browser == 'firefox') {
+ // Firefox can't handle using selects
+ // See https://github.com/angular/protractor/issues/480
+ return;
+ }
+ templateSelect.click();
+ templateSelect.all(by.css('option')).get(2).click();
+ expect(includeElem.getText()).toMatch(/Content of template2.html/);
+ });
+
+ it('should change to blank', function() {
+ if (browser.params.browser == 'firefox') {
+ // Firefox can't handle using selects
+ return;
+ }
+ templateSelect.click();
+ templateSelect.all(by.css('option')).get(0).click();
+ expect(includeElem.isPresent()).toBe(false);
+ });
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentRequested
+ * @eventType emit on the scope ngInclude was declared in
+ * @description
+ * Emitted every time the ngInclude content is requested.
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentLoaded
+ * @eventType emit on the current ngInclude scope
+ * @description
+ * Emitted every time the ngInclude content is reloaded.
+ */
+var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$animate', '$sce',
+ function($http, $templateCache, $anchorScroll, $animate, $sce) {
+ return {
+ restrict: 'ECA',
+ priority: 400,
+ terminal: true,
+ transclude: 'element',
+ controller: angular.noop,
+ compile: function(element, attr) {
+ var srcExp = attr.ngInclude || attr.src,
+ onloadExp = attr.onload || '',
+ autoScrollExp = attr.autoscroll;
+
+ return function(scope, $element, $attr, ctrl, $transclude) {
+ var changeCounter = 0,
+ currentScope,
+ previousElement,
+ currentElement;
+
+ var cleanupLastIncludeContent = function() {
+ if(previousElement) {
+ previousElement.remove();
+ previousElement = null;
+ }
+ if(currentScope) {
+ currentScope.$destroy();
+ currentScope = null;
+ }
+ if(currentElement) {
+ $animate.leave(currentElement, function() {
+ previousElement = null;
+ });
+ previousElement = currentElement;
+ currentElement = null;
+ }
+ };
+
+ scope.$watch($sce.parseAsResourceUrl(srcExp), function ngIncludeWatchAction(src) {
+ var afterAnimation = function() {
+ if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {
+ $anchorScroll();
+ }
+ };
+ var thisChangeId = ++changeCounter;
+
+ if (src) {
+ $http.get(src, {cache: $templateCache}).success(function(response) {
+ if (thisChangeId !== changeCounter) return;
+ var newScope = scope.$new();
+ ctrl.template = response;
+
+ // Note: This will also link all children of ng-include that were contained in the original
+ // html. If that content contains controllers, ... they could pollute/change the scope.
+ // However, using ng-include on an element with additional content does not make sense...
+ // Note: We can't remove them in the cloneAttchFn of $transclude as that
+ // function is called before linking the content, which would apply child
+ // directives to non existing elements.
+ var clone = $transclude(newScope, function(clone) {
+ cleanupLastIncludeContent();
+ $animate.enter(clone, null, $element, afterAnimation);
+ });
+
+ currentScope = newScope;
+ currentElement = clone;
+
+ currentScope.$emit('$includeContentLoaded');
+ scope.$eval(onloadExp);
+ }).error(function() {
+ if (thisChangeId === changeCounter) cleanupLastIncludeContent();
+ });
+ scope.$emit('$includeContentRequested');
+ } else {
+ cleanupLastIncludeContent();
+ ctrl.template = null;
+ }
+ });
+ };
+ }
+ };
+}];
+
+// This directive is called during the $transclude call of the first `ngInclude` directive.
+// It will replace and compile the content of the element with the loaded template.
+// We need this directive so that the element content is already filled when
+// the link function of another directive on the same element as ngInclude
+// is called.
+var ngIncludeFillContentDirective = ['$compile',
+ function($compile) {
+ return {
+ restrict: 'ECA',
+ priority: -400,
+ require: 'ngInclude',
+ link: function(scope, $element, $attr, ctrl) {
+ $element.html(ctrl.template);
+ $compile($element.contents())(scope);
+ }
+ };
+ }];
+
+/**
+ * @ngdoc directive
+ * @name ngInit
+ * @restrict AC
+ *
+ * @description
+ * The `ngInit` directive allows you to evaluate an expression in the
+ * current scope.
+ *
+ * <div class="alert alert-error">
+ * The only appropriate use of `ngInit` is for aliasing special properties of
+ * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below. Besides this case, you
+ * should use {@link guide/controller controllers} rather than `ngInit`
+ * to initialize values on a scope.
+ * </div>
+ * <div class="alert alert-warning">
+ * **Note**: If you have assignment in `ngInit` along with {@link ng.$filter `$filter`}, make
+ * sure you have parenthesis for correct precedence:
+ * <pre class="prettyprint">
+ * <div ng-init="test1 = (data | orderBy:'name')"></div>
+ * </pre>
+ * </div>
+ *
+ * @priority 450
+ *
+ * @element ANY
+ * @param {expression} ngInit {@link guide/expression Expression} to eval.
+ *
+ * @example
+ <example module="initExample">
+ <file name="index.html">
+ <script>
+ angular.module('initExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.list = [['a', 'b'], ['c', 'd']];
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <div ng-repeat="innerList in list" ng-init="outerIndex = $index">
+ <div ng-repeat="value in innerList" ng-init="innerIndex = $index">
+ <span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
+ </div>
+ </div>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should alias index positions', function() {
+ var elements = element.all(by.css('.example-init'));
+ expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;');
+ expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;');
+ expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;');
+ expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;');
+ });
+ </file>
+ </example>
+ */
+var ngInitDirective = ngDirective({
+ priority: 450,
+ compile: function() {
+ return {
+ pre: function(scope, element, attrs) {
+ scope.$eval(attrs.ngInit);
+ }
+ };
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngNonBindable
+ * @restrict AC
+ * @priority 1000
+ *
+ * @description
+ * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current
+ * DOM element. This is useful if the element contains what appears to be Angular directives and
+ * bindings but which should be ignored by Angular. This could be the case if you have a site that
+ * displays snippets of code, for instance.
+ *
+ * @element ANY
+ *
+ * @example
+ * In this example there are two locations where a simple interpolation binding (`{{}}`) is present,
+ * but the one wrapped in `ngNonBindable` is left alone.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <div>Normal: {{1 + 2}}</div>
+ <div ng-non-bindable>Ignored: {{1 + 2}}</div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-non-bindable', function() {
+ expect(element(by.binding('1 + 2')).getText()).toContain('3');
+ expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/);
+ });
+ </file>
+ </example>
+ */
+var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
+
+/**
+ * @ngdoc directive
+ * @name ngPluralize
+ * @restrict EA
+ *
+ * @description
+ * `ngPluralize` is a directive that displays messages according to en-US localization rules.
+ * These rules are bundled with angular.js, but can be overridden
+ * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive
+ * by specifying the mappings between
+ * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
+ * and the strings to be displayed.
+ *
+ * # Plural categories and explicit number rules
+ * There are two
+ * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
+ * in Angular's default en-US locale: "one" and "other".
+ *
+ * While a plural category may match many numbers (for example, in en-US locale, "other" can match
+ * any number that is not 1), an explicit number rule can only match one number. For example, the
+ * explicit number rule for "3" matches the number 3. There are examples of plural categories
+ * and explicit number rules throughout the rest of this documentation.
+ *
+ * # Configuring ngPluralize
+ * You configure ngPluralize by providing 2 attributes: `count` and `when`.
+ * You can also provide an optional attribute, `offset`.
+ *
+ * The value of the `count` attribute can be either a string or an {@link guide/expression
+ * Angular expression}; these are evaluated on the current scope for its bound value.
+ *
+ * The `when` attribute specifies the mappings between plural categories and the actual
+ * string to be displayed. The value of the attribute should be a JSON object.
+ *
+ * The following example shows how to configure ngPluralize:
+ *
+ * ```html
+ * <ng-pluralize count="personCount"
+ when="{'0': 'Nobody is viewing.',
+ * 'one': '1 person is viewing.',
+ * 'other': '{} people are viewing.'}">
+ * </ng-pluralize>
+ *```
+ *
+ * In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not
+ * specify this rule, 0 would be matched to the "other" category and "0 people are viewing"
+ * would be shown instead of "Nobody is viewing". You can specify an explicit number rule for
+ * other numbers, for example 12, so that instead of showing "12 people are viewing", you can
+ * show "a dozen people are viewing".
+ *
+ * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted
+ * into pluralized strings. In the previous example, Angular will replace `{}` with
+ * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder
+ * for <span ng-non-bindable>{{numberExpression}}</span>.
+ *
+ * # Configuring ngPluralize with offset
+ * The `offset` attribute allows further customization of pluralized text, which can result in
+ * a better user experience. For example, instead of the message "4 people are viewing this document",
+ * you might display "John, Kate and 2 others are viewing this document".
+ * The offset attribute allows you to offset a number by any desired value.
+ * Let's take a look at an example:
+ *
+ * ```html
+ * <ng-pluralize count="personCount" offset=2
+ * when="{'0': 'Nobody is viewing.',
+ * '1': '{{person1}} is viewing.',
+ * '2': '{{person1}} and {{person2}} are viewing.',
+ * 'one': '{{person1}}, {{person2}} and one other person are viewing.',
+ * 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
+ * </ng-pluralize>
+ * ```
+ *
+ * Notice that we are still using two plural categories(one, other), but we added
+ * three explicit number rules 0, 1 and 2.
+ * When one person, perhaps John, views the document, "John is viewing" will be shown.
+ * When three people view the document, no explicit number rule is found, so
+ * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.
+ * In this case, plural category 'one' is matched and "John, Mary and one other person are viewing"
+ * is shown.
+ *
+ * Note that when you specify offsets, you must provide explicit number rules for
+ * numbers from 0 up to and including the offset. If you use an offset of 3, for example,
+ * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for
+ * plural categories "one" and "other".
+ *
+ * @param {string|expression} count The variable to be bound to.
+ * @param {string} when The mapping between plural category to its corresponding strings.
+ * @param {number=} offset Offset to deduct from the total number.
+ *
+ * @example
+ <example module="pluralizeExample">
+ <file name="index.html">
+ <script>
+ angular.module('pluralizeExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.person1 = 'Igor';
+ $scope.person2 = 'Misko';
+ $scope.personCount = 1;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ Person 1:<input type="text" ng-model="person1" value="Igor" /><br/>
+ Person 2:<input type="text" ng-model="person2" value="Misko" /><br/>
+ Number of People:<input type="text" ng-model="personCount" value="1" /><br/>
+
+ <!--- Example with simple pluralization rules for en locale --->
+ Without Offset:
+ <ng-pluralize count="personCount"
+ when="{'0': 'Nobody is viewing.',
+ 'one': '1 person is viewing.',
+ 'other': '{} people are viewing.'}">
+ </ng-pluralize><br>
+
+ <!--- Example with offset --->
+ With Offset(2):
+ <ng-pluralize count="personCount" offset=2
+ when="{'0': 'Nobody is viewing.',
+ '1': '{{person1}} is viewing.',
+ '2': '{{person1}} and {{person2}} are viewing.',
+ 'one': '{{person1}}, {{person2}} and one other person are viewing.',
+ 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
+ </ng-pluralize>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should show correct pluralized string', function() {
+ var withoutOffset = element.all(by.css('ng-pluralize')).get(0);
+ var withOffset = element.all(by.css('ng-pluralize')).get(1);
+ var countInput = element(by.model('personCount'));
+
+ expect(withoutOffset.getText()).toEqual('1 person is viewing.');
+ expect(withOffset.getText()).toEqual('Igor is viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('0');
+
+ expect(withoutOffset.getText()).toEqual('Nobody is viewing.');
+ expect(withOffset.getText()).toEqual('Nobody is viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('2');
+
+ expect(withoutOffset.getText()).toEqual('2 people are viewing.');
+ expect(withOffset.getText()).toEqual('Igor and Misko are viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('3');
+
+ expect(withoutOffset.getText()).toEqual('3 people are viewing.');
+ expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('4');
+
+ expect(withoutOffset.getText()).toEqual('4 people are viewing.');
+ expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.');
+ });
+ it('should show data-bound names', function() {
+ var withOffset = element.all(by.css('ng-pluralize')).get(1);
+ var personCount = element(by.model('personCount'));
+ var person1 = element(by.model('person1'));
+ var person2 = element(by.model('person2'));
+ personCount.clear();
+ personCount.sendKeys('4');
+ person1.clear();
+ person1.sendKeys('Di');
+ person2.clear();
+ person2.sendKeys('Vojta');
+ expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.');
+ });
+ </file>
+ </example>
+ */
+var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interpolate) {
+ var BRACE = /{}/g;
+ return {
+ restrict: 'EA',
+ link: function(scope, element, attr) {
+ var numberExp = attr.count,
+ whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs
+ offset = attr.offset || 0,
+ whens = scope.$eval(whenExp) || {},
+ whensExpFns = {},
+ startSymbol = $interpolate.startSymbol(),
+ endSymbol = $interpolate.endSymbol(),
+ isWhen = /^when(Minus)?(.+)$/;
+
+ forEach(attr, function(expression, attributeName) {
+ if (isWhen.test(attributeName)) {
+ whens[lowercase(attributeName.replace('when', '').replace('Minus', '-'))] =
+ element.attr(attr.$attr[attributeName]);
+ }
+ });
+ forEach(whens, function(expression, key) {
+ whensExpFns[key] =
+ $interpolate(expression.replace(BRACE, startSymbol + numberExp + '-' +
+ offset + endSymbol));
+ });
+
+ scope.$watch(function ngPluralizeWatch() {
+ var value = parseFloat(scope.$eval(numberExp));
+
+ if (!isNaN(value)) {
+ //if explicit number rule such as 1, 2, 3... is defined, just use it. Otherwise,
+ //check it against pluralization rules in $locale service
+ if (!(value in whens)) value = $locale.pluralCat(value - offset);
+ return whensExpFns[value](scope, element, true);
+ } else {
+ return '';
+ }
+ }, function ngPluralizeWatchAction(newVal) {
+ element.text(newVal);
+ });
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngRepeat
+ *
+ * @description
+ * The `ngRepeat` directive instantiates a template once per item from a collection. Each template
+ * instance gets its own scope, where the given loop variable is set to the current collection item,
+ * and `$index` is set to the item index or key.
+ *
+ * Special properties are exposed on the local scope of each template instance, including:
+ *
+ * | Variable | Type | Details |
+ * |-----------|-----------------|-----------------------------------------------------------------------------|
+ * | `$index` | {@type number} | iterator offset of the repeated element (0..length-1) |
+ * | `$first` | {@type boolean} | true if the repeated element is first in the iterator. |
+ * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |
+ * | `$last` | {@type boolean} | true if the repeated element is last in the iterator. |
+ * | `$even` | {@type boolean} | true if the iterator position `$index` is even (otherwise false). |
+ * | `$odd` | {@type boolean} | true if the iterator position `$index` is odd (otherwise false). |
+ *
+ * Creating aliases for these properties is possible with {@link ng.directive:ngInit `ngInit`}.
+ * This may be useful when, for instance, nesting ngRepeats.
+ *
+ * # Special repeat start and end points
+ * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending
+ * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.
+ * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on)
+ * up to and including the ending HTML tag where **ng-repeat-end** is placed.
+ *
+ * The example below makes use of this feature:
+ * ```html
+ * <header ng-repeat-start="item in items">
+ * Header {{ item }}
+ * </header>
+ * <div class="body">
+ * Body {{ item }}
+ * </div>
+ * <footer ng-repeat-end>
+ * Footer {{ item }}
+ * </footer>
+ * ```
+ *
+ * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to:
+ * ```html
+ * <header>
+ * Header A
+ * </header>
+ * <div class="body">
+ * Body A
+ * </div>
+ * <footer>
+ * Footer A
+ * </footer>
+ * <header>
+ * Header B
+ * </header>
+ * <div class="body">
+ * Body B
+ * </div>
+ * <footer>
+ * Footer B
+ * </footer>
+ * ```
+ *
+ * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such
+ * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).
+ *
+ * @animations
+ * **.enter** - when a new item is added to the list or when an item is revealed after a filter
+ *
+ * **.leave** - when an item is removed from the list or when an item is filtered out
+ *
+ * **.move** - when an adjacent item is filtered out causing a reorder or when the item contents are reordered
+ *
+ * @element ANY
+ * @scope
+ * @priority 1000
+ * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These
+ * formats are currently supported:
+ *
+ * * `variable in expression` – where variable is the user defined loop variable and `expression`
+ * is a scope expression giving the collection to enumerate.
+ *
+ * For example: `album in artist.albums`.
+ *
+ * * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,
+ * and `expression` is the scope expression giving the collection to enumerate.
+ *
+ * For example: `(name, age) in {'adam':10, 'amalie':12}`.
+ *
+ * * `variable in expression track by tracking_expression` – You can also provide an optional tracking function
+ * which can be used to associate the objects in the collection with the DOM elements. If no tracking function
+ * is specified the ng-repeat associates elements by identity in the collection. It is an error to have
+ * more than one tracking function to resolve to the same key. (This would mean that two distinct objects are
+ * mapped to the same DOM element, which is not possible.) Filters should be applied to the expression,
+ * before specifying a tracking expression.
+ *
+ * For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements
+ * will be associated by item identity in the array.
+ *
+ * For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique
+ * `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements
+ * with the corresponding item in the array by identity. Moving the same object in array would move the DOM
+ * element in the same way in the DOM.
+ *
+ * For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this
+ * case the object identity does not matter. Two objects are considered equivalent as long as their `id`
+ * property is same.
+ *
+ * For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter
+ * to items in conjunction with a tracking expression.
+ *
+ * @example
+ * This example initializes the scope to a list of names and
+ * then uses `ngRepeat` to display every person:
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <div ng-init="friends = [
+ {name:'John', age:25, gender:'boy'},
+ {name:'Jessie', age:30, gender:'girl'},
+ {name:'Johanna', age:28, gender:'girl'},
+ {name:'Joy', age:15, gender:'girl'},
+ {name:'Mary', age:28, gender:'girl'},
+ {name:'Peter', age:95, gender:'boy'},
+ {name:'Sebastian', age:50, gender:'boy'},
+ {name:'Erika', age:27, gender:'girl'},
+ {name:'Patrick', age:40, gender:'boy'},
+ {name:'Samantha', age:60, gender:'girl'}
+ ]">
+ I have {{friends.length}} friends. They are:
+ <input type="search" ng-model="q" placeholder="filter friends..." />
+ <ul class="example-animate-container">
+ <li class="animate-repeat" ng-repeat="friend in friends | filter:q">
+ [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
+ </li>
+ </ul>
+ </div>
+ </file>
+ <file name="animations.css">
+ .example-animate-container {
+ background:white;
+ border:1px solid black;
+ list-style:none;
+ margin:0;
+ padding:0 10px;
+ }
+
+ .animate-repeat {
+ line-height:40px;
+ list-style:none;
+ box-sizing:border-box;
+ }
+
+ .animate-repeat.ng-move,
+ .animate-repeat.ng-enter,
+ .animate-repeat.ng-leave {
+ -webkit-transition:all linear 0.5s;
+ transition:all linear 0.5s;
+ }
+
+ .animate-repeat.ng-leave.ng-leave-active,
+ .animate-repeat.ng-move,
+ .animate-repeat.ng-enter {
+ opacity:0;
+ max-height:0;
+ }
+
+ .animate-repeat.ng-leave,
+ .animate-repeat.ng-move.ng-move-active,
+ .animate-repeat.ng-enter.ng-enter-active {
+ opacity:1;
+ max-height:40px;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var friends = element.all(by.repeater('friend in friends'));
+
+ it('should render initial data set', function() {
+ expect(friends.count()).toBe(10);
+ expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.');
+ expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.');
+ expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.');
+ expect(element(by.binding('friends.length')).getText())
+ .toMatch("I have 10 friends. They are:");
+ });
+
+ it('should update repeater when filter predicate changes', function() {
+ expect(friends.count()).toBe(10);
+
+ element(by.model('q')).sendKeys('ma');
+
+ expect(friends.count()).toBe(2);
+ expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');
+ expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.');
+ });
+ </file>
+ </example>
+ */
+var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
+ var NG_REMOVED = '$$NG_REMOVED';
+ var ngRepeatMinErr = minErr('ngRepeat');
+ return {
+ transclude: 'element',
+ priority: 1000,
+ terminal: true,
+ $$tlb: true,
+ link: function($scope, $element, $attr, ctrl, $transclude){
+ var expression = $attr.ngRepeat;
+ var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),
+ trackByExp, trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn,
+ lhs, rhs, valueIdentifier, keyIdentifier,
+ hashFnLocals = {$id: hashKey};
+
+ if (!match) {
+ throw ngRepeatMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",
+ expression);
+ }
+
+ lhs = match[1];
+ rhs = match[2];
+ trackByExp = match[3];
+
+ if (trackByExp) {
+ trackByExpGetter = $parse(trackByExp);
+ trackByIdExpFn = function(key, value, index) {
+ // assign key, value, and $index to the locals so that they can be used in hash functions
+ if (keyIdentifier) hashFnLocals[keyIdentifier] = key;
+ hashFnLocals[valueIdentifier] = value;
+ hashFnLocals.$index = index;
+ return trackByExpGetter($scope, hashFnLocals);
+ };
+ } else {
+ trackByIdArrayFn = function(key, value) {
+ return hashKey(value);
+ };
+ trackByIdObjFn = function(key) {
+ return key;
+ };
+ }
+
+ match = lhs.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);
+ if (!match) {
+ throw ngRepeatMinErr('iidexp', "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",
+ lhs);
+ }
+ valueIdentifier = match[3] || match[1];
+ keyIdentifier = match[2];
+
+ // Store a list of elements from previous run. This is a hash where key is the item from the
+ // iterator, and the value is objects with following properties.
+ // - scope: bound scope
+ // - element: previous element.
+ // - index: position
+ var lastBlockMap = {};
+
+ //watch props
+ $scope.$watchCollection(rhs, function ngRepeatAction(collection){
+ var index, length,
+ previousNode = $element[0], // current position of the node
+ nextNode,
+ // Same as lastBlockMap but it has the current state. It will become the
+ // lastBlockMap on the next iteration.
+ nextBlockMap = {},
+ arrayLength,
+ childScope,
+ key, value, // key/value of iteration
+ trackById,
+ trackByIdFn,
+ collectionKeys,
+ block, // last object information {scope, element, id}
+ nextBlockOrder = [],
+ elementsToRemove;
+
+
+ if (isArrayLike(collection)) {
+ collectionKeys = collection;
+ trackByIdFn = trackByIdExpFn || trackByIdArrayFn;
+ } else {
+ trackByIdFn = trackByIdExpFn || trackByIdObjFn;
+ // if object, extract keys, sort them and use to determine order of iteration over obj props
+ collectionKeys = [];
+ for (key in collection) {
+ if (collection.hasOwnProperty(key) && key.charAt(0) != '$') {
+ collectionKeys.push(key);
+ }
+ }
+ collectionKeys.sort();
+ }
+
+ arrayLength = collectionKeys.length;
+
+ // locate existing items
+ length = nextBlockOrder.length = collectionKeys.length;
+ for(index = 0; index < length; index++) {
+ key = (collection === collectionKeys) ? index : collectionKeys[index];
+ value = collection[key];
+ trackById = trackByIdFn(key, value, index);
+ assertNotHasOwnProperty(trackById, '`track by` id');
+ if(lastBlockMap.hasOwnProperty(trackById)) {
+ block = lastBlockMap[trackById];
+ delete lastBlockMap[trackById];
+ nextBlockMap[trackById] = block;
+ nextBlockOrder[index] = block;
+ } else if (nextBlockMap.hasOwnProperty(trackById)) {
+ // restore lastBlockMap
+ forEach(nextBlockOrder, function(block) {
+ if (block && block.scope) lastBlockMap[block.id] = block;
+ });
+ // This is a duplicate and we need to throw an error
+ throw ngRepeatMinErr('dupes',
+ "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}",
+ expression, trackById, toJson(value));
+ } else {
+ // new never before seen block
+ nextBlockOrder[index] = { id: trackById };
+ nextBlockMap[trackById] = false;
+ }
+ }
+
+ // remove existing items
+ for (key in lastBlockMap) {
+ // lastBlockMap is our own object so we don't need to use special hasOwnPropertyFn
+ if (lastBlockMap.hasOwnProperty(key)) {
+ block = lastBlockMap[key];
+ elementsToRemove = getBlockElements(block.clone);
+ $animate.leave(elementsToRemove);
+ forEach(elementsToRemove, function(element) { element[NG_REMOVED] = true; });
+ block.scope.$destroy();
+ }
+ }
+
+ // we are not using forEach for perf reasons (trying to avoid #call)
+ for (index = 0, length = collectionKeys.length; index < length; index++) {
+ key = (collection === collectionKeys) ? index : collectionKeys[index];
+ value = collection[key];
+ block = nextBlockOrder[index];
+ if (nextBlockOrder[index - 1]) previousNode = getBlockEnd(nextBlockOrder[index - 1]);
+
+ if (block.scope) {
+ // if we have already seen this object, then we need to reuse the
+ // associated scope/element
+ childScope = block.scope;
+
+ nextNode = previousNode;
+ do {
+ nextNode = nextNode.nextSibling;
+ } while(nextNode && nextNode[NG_REMOVED]);
+
+ if (getBlockStart(block) != nextNode) {
+ // existing item which got moved
+ $animate.move(getBlockElements(block.clone), null, jqLite(previousNode));
+ }
+ previousNode = getBlockEnd(block);
+ } else {
+ // new item which we don't know about
+ childScope = $scope.$new();
+ }
+
+ childScope[valueIdentifier] = value;
+ if (keyIdentifier) childScope[keyIdentifier] = key;
+ childScope.$index = index;
+ childScope.$first = (index === 0);
+ childScope.$last = (index === (arrayLength - 1));
+ childScope.$middle = !(childScope.$first || childScope.$last);
+ // jshint bitwise: false
+ childScope.$odd = !(childScope.$even = (index&1) === 0);
+ // jshint bitwise: true
+
+ if (!block.scope) {
+ $transclude(childScope, function(clone) {
+ clone[clone.length++] = document.createComment(' end ngRepeat: ' + expression + ' ');
+ $animate.enter(clone, null, jqLite(previousNode));
+ previousNode = clone;
+ block.scope = childScope;
+ // Note: We only need the first/last node of the cloned nodes.
+ // However, we need to keep the reference to the jqlite wrapper as it might be changed later
+ // by a directive with templateUrl when its template arrives.
+ block.clone = clone;
+ nextBlockMap[block.id] = block;
+ });
+ }
+ }
+ lastBlockMap = nextBlockMap;
+ });
+ }
+ };
+
+ function getBlockStart(block) {
+ return block.clone[0];
+ }
+
+ function getBlockEnd(block) {
+ return block.clone[block.clone.length - 1];
+ }
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngShow
+ *
+ * @description
+ * The `ngShow` directive shows or hides the given HTML element based on the expression
+ * provided to the `ngShow` attribute. The element is shown or hidden by removing or adding
+ * the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+ * in AngularJS and sets the display style to none (using an !important flag).
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```html
+ * <!-- when $scope.myValue is truthy (element is visible) -->
+ * <div ng-show="myValue"></div>
+ *
+ * <!-- when $scope.myValue is falsy (element is hidden) -->
+ * <div ng-show="myValue" class="ng-hide"></div>
+ * ```
+ *
+ * When the `ngShow` expression evaluates to false then the `.ng-hide` CSS class is added to the class attribute
+ * on the element causing it to become hidden. When true, the `.ng-hide` CSS class is removed
+ * from the element causing the element not to appear hidden.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Here is a list of values that ngShow will consider as a falsy value (case insensitive):<br />
+ * "f" / "0" / "false" / "no" / "n" / "[]"
+ * </div>
+ *
+ * ## Why is !important used?
+ *
+ * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
+ * can be easily overridden by heavier selectors. For example, something as simple
+ * as changing the display style on a HTML list item would make hidden elements appear visible.
+ * This also becomes a bigger issue when dealing with CSS frameworks.
+ *
+ * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+ * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+ * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
+ *
+ * ### Overriding `.ng-hide`
+ *
+ * By default, the `.ng-hide` class will style the element with `display:none!important`. If you wish to change
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
+ * class in CSS:
+ *
+ * ```css
+ * .ng-hide {
+ * //this is just another form of hiding an element
+ * display:block!important;
+ * position:absolute;
+ * top:-9999px;
+ * left:-9999px;
+ * }
+ * ```
+ *
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
+ *
+ * ## A note about animations with `ngShow`
+ *
+ * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+ * is true and false. This system works like the animation system present with ngClass except that
+ * you must also include the !important flag to override the display property
+ * so that you can perform an animation when the element is hidden during the time of the animation.
+ *
+ * ```css
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
+ * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ * transition:0.5s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add { ... }
+ * .my-element.ng-hide-add.ng-hide-add-active { ... }
+ * .my-element.ng-hide-remove { ... }
+ * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+ * ```
+ *
+ * Keep in mind that, as of AngularJS version 1.2.17 (and 1.3.0-beta.11), there is no need to change the display
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
+ *
+ * @animations
+ * addClass: `.ng-hide` - happens after the `ngShow` expression evaluates to a truthy value and the just before contents are set to visible
+ * removeClass: `.ng-hide` - happens after the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden
+ *
+ * @element ANY
+ * @param {expression} ngShow If the {@link guide/expression expression} is truthy
+ * then the element is shown or hidden respectively.
+ *
+ * @example
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ Click me: <input type="checkbox" ng-model="checked"><br/>
+ <div>
+ Show:
+ <div class="check-element animate-show" ng-show="checked">
+ <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+ </div>
+ </div>
+ <div>
+ Hide:
+ <div class="check-element animate-show" ng-hide="checked">
+ <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+ </div>
+ </div>
+ </file>
+ <file name="glyphicons.css">
+ @import url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css);
+ </file>
+ <file name="animations.css">
+ .animate-show {
+ -webkit-transition:all linear 0.5s;
+ transition:all linear 0.5s;
+ line-height:20px;
+ opacity:1;
+ padding:10px;
+ border:1px solid black;
+ background:white;
+ }
+
+ .animate-show.ng-hide {
+ line-height:0;
+ opacity:0;
+ padding:0 10px;
+ }
+
+ .check-element {
+ padding:10px;
+ border:1px solid black;
+ background:white;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+ var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+ it('should check ng-show / ng-hide', function() {
+ expect(thumbsUp.isDisplayed()).toBeFalsy();
+ expect(thumbsDown.isDisplayed()).toBeTruthy();
+
+ element(by.model('checked')).click();
+
+ expect(thumbsUp.isDisplayed()).toBeTruthy();
+ expect(thumbsDown.isDisplayed()).toBeFalsy();
+ });
+ </file>
+ </example>
+ */
+var ngShowDirective = ['$animate', function($animate) {
+ return function(scope, element, attr) {
+ scope.$watch(attr.ngShow, function ngShowWatchAction(value){
+ $animate[toBoolean(value) ? 'removeClass' : 'addClass'](element, 'ng-hide');
+ });
+ };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngHide
+ *
+ * @description
+ * The `ngHide` directive shows or hides the given HTML element based on the expression
+ * provided to the `ngHide` attribute. The element is shown or hidden by removing or adding
+ * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+ * in AngularJS and sets the display style to none (using an !important flag).
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```html
+ * <!-- when $scope.myValue is truthy (element is hidden) -->
+ * <div ng-hide="myValue" class="ng-hide"></div>
+ *
+ * <!-- when $scope.myValue is falsy (element is visible) -->
+ * <div ng-hide="myValue"></div>
+ * ```
+ *
+ * When the `.ngHide` expression evaluates to true then the `.ng-hide` CSS class is added to the class attribute
+ * on the element causing it to become hidden. When false, the `.ng-hide` CSS class is removed
+ * from the element causing the element not to appear hidden.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Here is a list of values that ngHide will consider as a falsy value (case insensitive):<br />
+ * "f" / "0" / "false" / "no" / "n" / "[]"
+ * </div>
+ *
+ * ## Why is !important used?
+ *
+ * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
+ * can be easily overridden by heavier selectors. For example, something as simple
+ * as changing the display style on a HTML list item would make hidden elements appear visible.
+ * This also becomes a bigger issue when dealing with CSS frameworks.
+ *
+ * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+ * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+ * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
+ *
+ * ### Overriding `.ng-hide`
+ *
+ * By default, the `.ng-hide` class will style the element with `display:none!important`. If you wish to change
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
+ * class in CSS:
+ *
+ * ```css
+ * .ng-hide {
+ * //this is just another form of hiding an element
+ * display:block!important;
+ * position:absolute;
+ * top:-9999px;
+ * left:-9999px;
+ * }
+ * ```
+ *
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
+ *
+ * ## A note about animations with `ngHide`
+ *
+ * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+ * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`
+ * CSS class is added and removed for you instead of your own CSS class.
+ *
+ * ```css
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
+ * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ * transition:0.5s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add { ... }
+ * .my-element.ng-hide-add.ng-hide-add-active { ... }
+ * .my-element.ng-hide-remove { ... }
+ * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+ * ```
+ *
+ * Keep in mind that, as of AngularJS version 1.2.17 (and 1.3.0-beta.11), there is no need to change the display
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
+ *
+ * @animations
+ * removeClass: `.ng-hide` - happens after the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden
+ * addClass: `.ng-hide` - happens after the `ngHide` expression evaluates to a non truthy value and just before the contents are set to visible
+ *
+ * @element ANY
+ * @param {expression} ngHide If the {@link guide/expression expression} is truthy then
+ * the element is shown or hidden respectively.
+ *
+ * @example
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ Click me: <input type="checkbox" ng-model="checked"><br/>
+ <div>
+ Show:
+ <div class="check-element animate-hide" ng-show="checked">
+ <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+ </div>
+ </div>
+ <div>
+ Hide:
+ <div class="check-element animate-hide" ng-hide="checked">
+ <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+ </div>
+ </div>
+ </file>
+ <file name="glyphicons.css">
+ @import url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css);
+ </file>
+ <file name="animations.css">
+ .animate-hide {
+ -webkit-transition:all linear 0.5s;
+ transition:all linear 0.5s;
+ line-height:20px;
+ opacity:1;
+ padding:10px;
+ border:1px solid black;
+ background:white;
+ }
+
+ .animate-hide.ng-hide {
+ line-height:0;
+ opacity:0;
+ padding:0 10px;
+ }
+
+ .check-element {
+ padding:10px;
+ border:1px solid black;
+ background:white;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+ var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+ it('should check ng-show / ng-hide', function() {
+ expect(thumbsUp.isDisplayed()).toBeFalsy();
+ expect(thumbsDown.isDisplayed()).toBeTruthy();
+
+ element(by.model('checked')).click();
+
+ expect(thumbsUp.isDisplayed()).toBeTruthy();
+ expect(thumbsDown.isDisplayed()).toBeFalsy();
+ });
+ </file>
+ </example>
+ */
+var ngHideDirective = ['$animate', function($animate) {
+ return function(scope, element, attr) {
+ scope.$watch(attr.ngHide, function ngHideWatchAction(value){
+ $animate[toBoolean(value) ? 'addClass' : 'removeClass'](element, 'ng-hide');
+ });
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngStyle
+ * @restrict AC
+ *
+ * @description
+ * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.
+ *
+ * @element ANY
+ * @param {expression} ngStyle
+ *
+ * {@link guide/expression Expression} which evals to an
+ * object whose keys are CSS style names and values are corresponding values for those CSS
+ * keys.
+ *
+ * Since some CSS style names are not valid keys for an object, they must be quoted.
+ * See the 'background-color' style in the example below.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input type="button" value="set color" ng-click="myStyle={color:'red'}">
+ <input type="button" value="set background" ng-click="myStyle={'background-color':'blue'}">
+ <input type="button" value="clear" ng-click="myStyle={}">
+ <br/>
+ <span ng-style="myStyle">Sample Text</span>
+ <pre>myStyle={{myStyle}}</pre>
+ </file>
+ <file name="style.css">
+ span {
+ color: black;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var colorSpan = element(by.css('span'));
+
+ it('should check ng-style', function() {
+ expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
+ element(by.css('input[value=\'set color\']')).click();
+ expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');
+ element(by.css('input[value=clear]')).click();
+ expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
+ });
+ </file>
+ </example>
+ */
+var ngStyleDirective = ngDirective(function(scope, element, attr) {
+ scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
+ if (oldStyles && (newStyles !== oldStyles)) {
+ forEach(oldStyles, function(val, style) { element.css(style, '');});
+ }
+ if (newStyles) element.css(newStyles);
+ }, true);
+});
+
+/**
+ * @ngdoc directive
+ * @name ngSwitch
+ * @restrict EA
+ *
+ * @description
+ * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.
+ * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location
+ * as specified in the template.
+ *
+ * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
+ * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element
+ * matches the value obtained from the evaluated expression. In other words, you define a container element
+ * (where you place the directive), place an expression on the **`on="..."` attribute**
+ * (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place
+ * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on
+ * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default
+ * attribute is displayed.
+ *
+ * <div class="alert alert-info">
+ * Be aware that the attribute values to match against cannot be expressions. They are interpreted
+ * as literal string values to match against.
+ * For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the
+ * value of the expression `$scope.someVal`.
+ * </div>
+
+ * @animations
+ * enter - happens after the ngSwitch contents change and the matched child element is placed inside the container
+ * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM
+ *
+ * @usage
+ *
+ * ```
+ * <ANY ng-switch="expression">
+ * <ANY ng-switch-when="matchValue1">...</ANY>
+ * <ANY ng-switch-when="matchValue2">...</ANY>
+ * <ANY ng-switch-default>...</ANY>
+ * </ANY>
+ * ```
+ *
+ *
+ * @scope
+ * @priority 800
+ * @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>.
+ * On child elements add:
+ *
+ * * `ngSwitchWhen`: the case statement to match against. If match then this
+ * case will be displayed. If the same match appears multiple times, all the
+ * elements will be displayed.
+ * * `ngSwitchDefault`: the default case when no other case match. If there
+ * are multiple default cases, all of them will be displayed when no other
+ * case match.
+ *
+ *
+ * @example
+ <example module="switchExample" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <select ng-model="selection" ng-options="item for item in items">
+ </select>
+ <tt>selection={{selection}}</tt>
+ <hr/>
+ <div class="animate-switch-container"
+ ng-switch on="selection">
+ <div class="animate-switch" ng-switch-when="settings">Settings Div</div>
+ <div class="animate-switch" ng-switch-when="home">Home Span</div>
+ <div class="animate-switch" ng-switch-default>default</div>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('switchExample', ['ngAnimate'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.items = ['settings', 'home', 'other'];
+ $scope.selection = $scope.items[0];
+ }]);
+ </file>
+ <file name="animations.css">
+ .animate-switch-container {
+ position:relative;
+ background:white;
+ border:1px solid black;
+ height:40px;
+ overflow:hidden;
+ }
+
+ .animate-switch {
+ padding:10px;
+ }
+
+ .animate-switch.ng-animate {
+ -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+
+ position:absolute;
+ top:0;
+ left:0;
+ right:0;
+ bottom:0;
+ }
+
+ .animate-switch.ng-leave.ng-leave-active,
+ .animate-switch.ng-enter {
+ top:-50px;
+ }
+ .animate-switch.ng-leave,
+ .animate-switch.ng-enter.ng-enter-active {
+ top:0;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var switchElem = element(by.css('[ng-switch]'));
+ var select = element(by.model('selection'));
+
+ it('should start in settings', function() {
+ expect(switchElem.getText()).toMatch(/Settings Div/);
+ });
+ it('should change to home', function() {
+ select.all(by.css('option')).get(1).click();
+ expect(switchElem.getText()).toMatch(/Home Span/);
+ });
+ it('should select default', function() {
+ select.all(by.css('option')).get(2).click();
+ expect(switchElem.getText()).toMatch(/default/);
+ });
+ </file>
+ </example>
+ */
+var ngSwitchDirective = ['$animate', function($animate) {
+ return {
+ restrict: 'EA',
+ require: 'ngSwitch',
+
+ // asks for $scope to fool the BC controller module
+ controller: ['$scope', function ngSwitchController() {
+ this.cases = {};
+ }],
+ link: function(scope, element, attr, ngSwitchController) {
+ var watchExpr = attr.ngSwitch || attr.on,
+ selectedTranscludes = [],
+ selectedElements = [],
+ previousElements = [],
+ selectedScopes = [];
+
+ scope.$watch(watchExpr, function ngSwitchWatchAction(value) {
+ var i, ii;
+ for (i = 0, ii = previousElements.length; i < ii; ++i) {
+ previousElements[i].remove();
+ }
+ previousElements.length = 0;
+
+ for (i = 0, ii = selectedScopes.length; i < ii; ++i) {
+ var selected = selectedElements[i];
+ selectedScopes[i].$destroy();
+ previousElements[i] = selected;
+ $animate.leave(selected, function() {
+ previousElements.splice(i, 1);
+ });
+ }
+
+ selectedElements.length = 0;
+ selectedScopes.length = 0;
+
+ if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {
+ scope.$eval(attr.change);
+ forEach(selectedTranscludes, function(selectedTransclude) {
+ var selectedScope = scope.$new();
+ selectedScopes.push(selectedScope);
+ selectedTransclude.transclude(selectedScope, function(caseElement) {
+ var anchor = selectedTransclude.element;
+
+ selectedElements.push(caseElement);
+ $animate.enter(caseElement, anchor.parent(), anchor);
+ });
+ });
+ }
+ });
+ }
+ };
+}];
+
+var ngSwitchWhenDirective = ngDirective({
+ transclude: 'element',
+ priority: 800,
+ require: '^ngSwitch',
+ link: function(scope, element, attrs, ctrl, $transclude) {
+ ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);
+ ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });
+ }
+});
+
+var ngSwitchDefaultDirective = ngDirective({
+ transclude: 'element',
+ priority: 800,
+ require: '^ngSwitch',
+ link: function(scope, element, attr, ctrl, $transclude) {
+ ctrl.cases['?'] = (ctrl.cases['?'] || []);
+ ctrl.cases['?'].push({ transclude: $transclude, element: element });
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngTransclude
+ * @restrict AC
+ *
+ * @description
+ * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
+ *
+ * Any existing content of the element that this directive is placed on will be removed before the transcluded content is inserted.
+ *
+ * @element ANY
+ *
+ * @example
+ <example module="transcludeExample">
+ <file name="index.html">
+ <script>
+ angular.module('transcludeExample', [])
+ .directive('pane', function(){
+ return {
+ restrict: 'E',
+ transclude: true,
+ scope: { title:'@' },
+ template: '<div style="border: 1px solid black;">' +
+ '<div style="background-color: gray">{{title}}</div>' +
+ '<div ng-transclude></div>' +
+ '</div>'
+ };
+ })
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.title = 'Lorem Ipsum';
+ $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <input ng-model="title"><br>
+ <textarea ng-model="text"></textarea> <br/>
+ <pane title="{{title}}">{{text}}</pane>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should have transcluded', function() {
+ var titleElement = element(by.model('title'));
+ titleElement.clear();
+ titleElement.sendKeys('TITLE');
+ var textElement = element(by.model('text'));
+ textElement.clear();
+ textElement.sendKeys('TEXT');
+ expect(element(by.binding('title')).getText()).toEqual('TITLE');
+ expect(element(by.binding('text')).getText()).toEqual('TEXT');
+ });
+ </file>
+ </example>
+ *
+ */
+var ngTranscludeDirective = ngDirective({
+ link: function($scope, $element, $attrs, controller, $transclude) {
+ if (!$transclude) {
+ throw minErr('ngTransclude')('orphan',
+ 'Illegal use of ngTransclude directive in the template! ' +
+ 'No parent directive that requires a transclusion found. ' +
+ 'Element: {0}',
+ startingTag($element));
+ }
+
+ $transclude(function(clone) {
+ $element.empty();
+ $element.append(clone);
+ });
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name script
+ * @restrict E
+ *
+ * @description
+ * Load the content of a `<script>` element into {@link ng.$templateCache `$templateCache`}, so that the
+ * template can be used by {@link ng.directive:ngInclude `ngInclude`},
+ * {@link ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the
+ * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be
+ * assigned through the element's `id`, which can then be used as a directive's `templateUrl`.
+ *
+ * @param {string} type Must be set to `'text/ng-template'`.
+ * @param {string} id Cache name of the template.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <script type="text/ng-template" id="/tpl.html">
+ Content of the template.
+ </script>
+
+ <a ng-click="currentTpl='/tpl.html'" id="tpl-link">Load inlined template</a>
+ <div id="tpl-content" ng-include src="currentTpl"></div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should load template defined inside script tag', function() {
+ element(by.css('#tpl-link')).click();
+ expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);
+ });
+ </file>
+ </example>
+ */
+var scriptDirective = ['$templateCache', function($templateCache) {
+ return {
+ restrict: 'E',
+ terminal: true,
+ compile: function(element, attr) {
+ if (attr.type == 'text/ng-template') {
+ var templateUrl = attr.id,
+ // IE is not consistent, in scripts we have to read .text but in other nodes we have to read .textContent
+ text = element[0].text;
+
+ $templateCache.put(templateUrl, text);
+ }
+ }
+ };
+}];
+
+var ngOptionsMinErr = minErr('ngOptions');
+/**
+ * @ngdoc directive
+ * @name select
+ * @restrict E
+ *
+ * @description
+ * HTML `SELECT` element with angular data-binding.
+ *
+ * # `ngOptions`
+ *
+ * The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
+ * elements for the `<select>` element using the array or object obtained by evaluating the
+ * `ngOptions` comprehension_expression.
+ *
+ * When an item in the `<select>` menu is selected, the array element or object property
+ * represented by the selected option will be bound to the model identified by the `ngModel`
+ * directive.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** `ngModel` compares by reference, not value. This is important when binding to an
+ * array of objects. See an example [in this jsfiddle](http://jsfiddle.net/qWzTb/).
+ * </div>
+ *
+ * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can
+ * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
+ * option. See example below for demonstration.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** `ngOptions` provides an iterator facility for the `<option>` element which should be used instead
+ * of {@link ng.directive:ngRepeat ngRepeat} when you want the
+ * `select` model to be bound to a non-string value. This is because an option element can only
+ * be bound to string values at present.
+ * </div>
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required The control is considered valid only if value is entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {comprehension_expression=} ngOptions in one of the following forms:
+ *
+ * * for array data sources:
+ * * `label` **`for`** `value` **`in`** `array`
+ * * `select` **`as`** `label` **`for`** `value` **`in`** `array`
+ * * `label` **`group by`** `group` **`for`** `value` **`in`** `array`
+ * * `select` **`as`** `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
+ * * for object data sources:
+ * * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+ * * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+ * * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`
+ * * `select` **`as`** `label` **`group by`** `group`
+ * **`for` `(`**`key`**`,`** `value`**`) in`** `object`
+ *
+ * Where:
+ *
+ * * `array` / `object`: an expression which evaluates to an array / object to iterate over.
+ * * `value`: local variable which will refer to each item in the `array` or each property value
+ * of `object` during iteration.
+ * * `key`: local variable which will refer to a property name in `object` during iteration.
+ * * `label`: The result of this expression will be the label for `<option>` element. The
+ * `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).
+ * * `select`: The result of this expression will be bound to the model of the parent `<select>`
+ * element. If not specified, `select` expression will default to `value`.
+ * * `group`: The result of this expression will be used to group options using the `<optgroup>`
+ * DOM element.
+ * * `trackexpr`: Used when working with an array of objects. The result of this expression will be
+ * used to identify the objects in the array. The `trackexpr` will most likely refer to the
+ * `value` variable (e.g. `value.propertyName`).
+ *
+ * @example
+ <example module="selectExample">
+ <file name="index.html">
+ <script>
+ angular.module('selectExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.colors = [
+ {name:'black', shade:'dark'},
+ {name:'white', shade:'light'},
+ {name:'red', shade:'dark'},
+ {name:'blue', shade:'dark'},
+ {name:'yellow', shade:'light'}
+ ];
+ $scope.myColor = $scope.colors[2]; // red
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <ul>
+ <li ng-repeat="color in colors">
+ Name: <input ng-model="color.name">
+ [<a href ng-click="colors.splice($index, 1)">X</a>]
+ </li>
+ <li>
+ [<a href ng-click="colors.push({})">add</a>]
+ </li>
+ </ul>
+ <hr/>
+ Color (null not allowed):
+ <select ng-model="myColor" ng-options="color.name for color in colors"></select><br>
+
+ Color (null allowed):
+ <span class="nullable">
+ <select ng-model="myColor" ng-options="color.name for color in colors">
+ <option value="">-- choose color --</option>
+ </select>
+ </span><br/>
+
+ Color grouped by shade:
+ <select ng-model="myColor" ng-options="color.name group by color.shade for color in colors">
+ </select><br/>
+
+
+ Select <a href ng-click="myColor = { name:'not in list', shade: 'other' }">bogus</a>.<br>
+ <hr/>
+ Currently selected: {{ {selected_color:myColor} }}
+ <div style="border:solid 1px black; height:20px"
+ ng-style="{'background-color':myColor.name}">
+ </div>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-options', function() {
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');
+ element.all(by.model('myColor')).first().click();
+ element.all(by.css('select[ng-model="myColor"] option')).first().click();
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');
+ element(by.css('.nullable select[ng-model="myColor"]')).click();
+ element.all(by.css('.nullable select[ng-model="myColor"] option')).first().click();
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');
+ });
+ </file>
+ </example>
+ */
+
+var ngOptionsDirective = valueFn({ terminal: true });
+// jshint maxlen: false
+var selectDirective = ['$compile', '$parse', function($compile, $parse) {
+ //000011111111110000000000022222222220000000000000000000003333333333000000000000004444444444444440000000005555555555555550000000666666666666666000000000000000777777777700000000000000000008888888888
+ var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,
+ nullModelCtrl = {$setViewValue: noop};
+// jshint maxlen: 100
+
+ return {
+ restrict: 'E',
+ require: ['select', '?ngModel'],
+ controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {
+ var self = this,
+ optionsMap = {},
+ ngModelCtrl = nullModelCtrl,
+ nullOption,
+ unknownOption;
+
+
+ self.databound = $attrs.ngModel;
+
+
+ self.init = function(ngModelCtrl_, nullOption_, unknownOption_) {
+ ngModelCtrl = ngModelCtrl_;
+ nullOption = nullOption_;
+ unknownOption = unknownOption_;
+ };
+
+
+ self.addOption = function(value) {
+ assertNotHasOwnProperty(value, '"option value"');
+ optionsMap[value] = true;
+
+ if (ngModelCtrl.$viewValue == value) {
+ $element.val(value);
+ if (unknownOption.parent()) unknownOption.remove();
+ }
+ };
+
+
+ self.removeOption = function(value) {
+ if (this.hasOption(value)) {
+ delete optionsMap[value];
+ if (ngModelCtrl.$viewValue == value) {
+ this.renderUnknownOption(value);
+ }
+ }
+ };
+
+
+ self.renderUnknownOption = function(val) {
+ var unknownVal = '? ' + hashKey(val) + ' ?';
+ unknownOption.val(unknownVal);
+ $element.prepend(unknownOption);
+ $element.val(unknownVal);
+ unknownOption.prop('selected', true); // needed for IE
+ };
+
+
+ self.hasOption = function(value) {
+ return optionsMap.hasOwnProperty(value);
+ };
+
+ $scope.$on('$destroy', function() {
+ // disable unknown option so that we don't do work when the whole select is being destroyed
+ self.renderUnknownOption = noop;
+ });
+ }],
+
+ link: function(scope, element, attr, ctrls) {
+ // if ngModel is not defined, we don't need to do anything
+ if (!ctrls[1]) return;
+
+ var selectCtrl = ctrls[0],
+ ngModelCtrl = ctrls[1],
+ multiple = attr.multiple,
+ optionsExp = attr.ngOptions,
+ nullOption = false, // if false, user will not be able to select it (used by ngOptions)
+ emptyOption,
+ // we can't just jqLite('<option>') since jqLite is not smart enough
+ // to create it in <select> and IE barfs otherwise.
+ optionTemplate = jqLite(document.createElement('option')),
+ optGroupTemplate =jqLite(document.createElement('optgroup')),
+ unknownOption = optionTemplate.clone();
+
+ // find "null" option
+ for(var i = 0, children = element.children(), ii = children.length; i < ii; i++) {
+ if (children[i].value === '') {
+ emptyOption = nullOption = children.eq(i);
+ break;
+ }
+ }
+
+ selectCtrl.init(ngModelCtrl, nullOption, unknownOption);
+
+ // required validator
+ if (multiple) {
+ ngModelCtrl.$isEmpty = function(value) {
+ return !value || value.length === 0;
+ };
+ }
+
+ if (optionsExp) setupAsOptions(scope, element, ngModelCtrl);
+ else if (multiple) setupAsMultiple(scope, element, ngModelCtrl);
+ else setupAsSingle(scope, element, ngModelCtrl, selectCtrl);
+
+
+ ////////////////////////////
+
+
+
+ function setupAsSingle(scope, selectElement, ngModelCtrl, selectCtrl) {
+ ngModelCtrl.$render = function() {
+ var viewValue = ngModelCtrl.$viewValue;
+
+ if (selectCtrl.hasOption(viewValue)) {
+ if (unknownOption.parent()) unknownOption.remove();
+ selectElement.val(viewValue);
+ if (viewValue === '') emptyOption.prop('selected', true); // to make IE9 happy
+ } else {
+ if (isUndefined(viewValue) && emptyOption) {
+ selectElement.val('');
+ } else {
+ selectCtrl.renderUnknownOption(viewValue);
+ }
+ }
+ };
+
+ selectElement.on('change', function() {
+ scope.$apply(function() {
+ if (unknownOption.parent()) unknownOption.remove();
+ ngModelCtrl.$setViewValue(selectElement.val());
+ });
+ });
+ }
+
+ function setupAsMultiple(scope, selectElement, ctrl) {
+ var lastView;
+ ctrl.$render = function() {
+ var items = new HashMap(ctrl.$viewValue);
+ forEach(selectElement.find('option'), function(option) {
+ option.selected = isDefined(items.get(option.value));
+ });
+ };
+
+ // we have to do it on each watch since ngModel watches reference, but
+ // we need to work of an array, so we need to see if anything was inserted/removed
+ scope.$watch(function selectMultipleWatch() {
+ if (!equals(lastView, ctrl.$viewValue)) {
+ lastView = shallowCopy(ctrl.$viewValue);
+ ctrl.$render();
+ }
+ });
+
+ selectElement.on('change', function() {
+ scope.$apply(function() {
+ var array = [];
+ forEach(selectElement.find('option'), function(option) {
+ if (option.selected) {
+ array.push(option.value);
+ }
+ });
+ ctrl.$setViewValue(array);
+ });
+ });
+ }
+
+ function setupAsOptions(scope, selectElement, ctrl) {
+ var match;
+
+ if (!(match = optionsExp.match(NG_OPTIONS_REGEXP))) {
+ throw ngOptionsMinErr('iexp',
+ "Expected expression in form of " +
+ "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
+ " but got '{0}'. Element: {1}",
+ optionsExp, startingTag(selectElement));
+ }
+
+ var displayFn = $parse(match[2] || match[1]),
+ valueName = match[4] || match[6],
+ keyName = match[5],
+ groupByFn = $parse(match[3] || ''),
+ valueFn = $parse(match[2] ? match[1] : valueName),
+ valuesFn = $parse(match[7]),
+ track = match[8],
+ trackFn = track ? $parse(match[8]) : null,
+ // This is an array of array of existing option groups in DOM.
+ // We try to reuse these if possible
+ // - optionGroupsCache[0] is the options with no option group
+ // - optionGroupsCache[?][0] is the parent: either the SELECT or OPTGROUP element
+ optionGroupsCache = [[{element: selectElement, label:''}]];
+
+ if (nullOption) {
+ // compile the element since there might be bindings in it
+ $compile(nullOption)(scope);
+
+ // remove the class, which is added automatically because we recompile the element and it
+ // becomes the compilation root
+ nullOption.removeClass('ng-scope');
+
+ // we need to remove it before calling selectElement.empty() because otherwise IE will
+ // remove the label from the element. wtf?
+ nullOption.remove();
+ }
+
+ // clear contents, we'll add what's needed based on the model
+ selectElement.empty();
+
+ selectElement.on('change', function() {
+ scope.$apply(function() {
+ var optionGroup,
+ collection = valuesFn(scope) || [],
+ locals = {},
+ key, value, optionElement, index, groupIndex, length, groupLength, trackIndex;
+
+ if (multiple) {
+ value = [];
+ for (groupIndex = 0, groupLength = optionGroupsCache.length;
+ groupIndex < groupLength;
+ groupIndex++) {
+ // list of options for that group. (first item has the parent)
+ optionGroup = optionGroupsCache[groupIndex];
+
+ for(index = 1, length = optionGroup.length; index < length; index++) {
+ if ((optionElement = optionGroup[index].element)[0].selected) {
+ key = optionElement.val();
+ if (keyName) locals[keyName] = key;
+ if (trackFn) {
+ for (trackIndex = 0; trackIndex < collection.length; trackIndex++) {
+ locals[valueName] = collection[trackIndex];
+ if (trackFn(scope, locals) == key) break;
+ }
+ } else {
+ locals[valueName] = collection[key];
+ }
+ value.push(valueFn(scope, locals));
+ }
+ }
+ }
+ } else {
+ key = selectElement.val();
+ if (key == '?') {
+ value = undefined;
+ } else if (key === ''){
+ value = null;
+ } else {
+ if (trackFn) {
+ for (trackIndex = 0; trackIndex < collection.length; trackIndex++) {
+ locals[valueName] = collection[trackIndex];
+ if (trackFn(scope, locals) == key) {
+ value = valueFn(scope, locals);
+ break;
+ }
+ }
+ } else {
+ locals[valueName] = collection[key];
+ if (keyName) locals[keyName] = key;
+ value = valueFn(scope, locals);
+ }
+ }
+ }
+ ctrl.$setViewValue(value);
+ render();
+ });
+ });
+
+ ctrl.$render = render;
+
+ scope.$watchCollection(valuesFn, render);
+ scope.$watchCollection(function () {
+ var locals = {},
+ values = valuesFn(scope);
+ if (values) {
+ var toDisplay = new Array(values.length);
+ for (var i = 0, ii = values.length; i < ii; i++) {
+ locals[valueName] = values[i];
+ toDisplay[i] = displayFn(scope, locals);
+ }
+ return toDisplay;
+ }
+ }, render);
+
+ if ( multiple ) {
+ scope.$watchCollection(function() { return ctrl.$modelValue; }, render);
+ }
+
+ function getSelectedSet() {
+ var selectedSet = false;
+ if (multiple) {
+ var modelValue = ctrl.$modelValue;
+ if (trackFn && isArray(modelValue)) {
+ selectedSet = new HashMap([]);
+ var locals = {};
+ for (var trackIndex = 0; trackIndex < modelValue.length; trackIndex++) {
+ locals[valueName] = modelValue[trackIndex];
+ selectedSet.put(trackFn(scope, locals), modelValue[trackIndex]);
+ }
+ } else {
+ selectedSet = new HashMap(modelValue);
+ }
+ }
+ return selectedSet;
+ }
+
+
+ function render() {
+ // Temporary location for the option groups before we render them
+ var optionGroups = {'':[]},
+ optionGroupNames = [''],
+ optionGroupName,
+ optionGroup,
+ option,
+ existingParent, existingOptions, existingOption,
+ modelValue = ctrl.$modelValue,
+ values = valuesFn(scope) || [],
+ keys = keyName ? sortedKeys(values) : values,
+ key,
+ groupLength, length,
+ groupIndex, index,
+ locals = {},
+ selected,
+ selectedSet = getSelectedSet(),
+ lastElement,
+ element,
+ label;
+
+
+ // We now build up the list of options we need (we merge later)
+ for (index = 0; length = keys.length, index < length; index++) {
+
+ key = index;
+ if (keyName) {
+ key = keys[index];
+ if ( key.charAt(0) === '$' ) continue;
+ locals[keyName] = key;
+ }
+
+ locals[valueName] = values[key];
+
+ optionGroupName = groupByFn(scope, locals) || '';
+ if (!(optionGroup = optionGroups[optionGroupName])) {
+ optionGroup = optionGroups[optionGroupName] = [];
+ optionGroupNames.push(optionGroupName);
+ }
+ if (multiple) {
+ selected = isDefined(
+ selectedSet.remove(trackFn ? trackFn(scope, locals) : valueFn(scope, locals))
+ );
+ } else {
+ if (trackFn) {
+ var modelCast = {};
+ modelCast[valueName] = modelValue;
+ selected = trackFn(scope, modelCast) === trackFn(scope, locals);
+ } else {
+ selected = modelValue === valueFn(scope, locals);
+ }
+ selectedSet = selectedSet || selected; // see if at least one item is selected
+ }
+ label = displayFn(scope, locals); // what will be seen by the user
+
+ // doing displayFn(scope, locals) || '' overwrites zero values
+ label = isDefined(label) ? label : '';
+ optionGroup.push({
+ // either the index into array or key from object
+ id: trackFn ? trackFn(scope, locals) : (keyName ? keys[index] : index),
+ label: label,
+ selected: selected // determine if we should be selected
+ });
+ }
+ if (!multiple) {
+ if (nullOption || modelValue === null) {
+ // insert null option if we have a placeholder, or the model is null
+ optionGroups[''].unshift({id:'', label:'', selected:!selectedSet});
+ } else if (!selectedSet) {
+ // option could not be found, we have to insert the undefined item
+ optionGroups[''].unshift({id:'?', label:'', selected:true});
+ }
+ }
+
+ // Now we need to update the list of DOM nodes to match the optionGroups we computed above
+ for (groupIndex = 0, groupLength = optionGroupNames.length;
+ groupIndex < groupLength;
+ groupIndex++) {
+ // current option group name or '' if no group
+ optionGroupName = optionGroupNames[groupIndex];
+
+ // list of options for that group. (first item has the parent)
+ optionGroup = optionGroups[optionGroupName];
+
+ if (optionGroupsCache.length <= groupIndex) {
+ // we need to grow the optionGroups
+ existingParent = {
+ element: optGroupTemplate.clone().attr('label', optionGroupName),
+ label: optionGroup.label
+ };
+ existingOptions = [existingParent];
+ optionGroupsCache.push(existingOptions);
+ selectElement.append(existingParent.element);
+ } else {
+ existingOptions = optionGroupsCache[groupIndex];
+ existingParent = existingOptions[0]; // either SELECT (no group) or OPTGROUP element
+
+ // update the OPTGROUP label if not the same.
+ if (existingParent.label != optionGroupName) {
+ existingParent.element.attr('label', existingParent.label = optionGroupName);
+ }
+ }
+
+ lastElement = null; // start at the beginning
+ for(index = 0, length = optionGroup.length; index < length; index++) {
+ option = optionGroup[index];
+ if ((existingOption = existingOptions[index+1])) {
+ // reuse elements
+ lastElement = existingOption.element;
+ if (existingOption.label !== option.label) {
+ lastElement.text(existingOption.label = option.label);
+ }
+ if (existingOption.id !== option.id) {
+ lastElement.val(existingOption.id = option.id);
+ }
+ // lastElement.prop('selected') provided by jQuery has side-effects
+ if (lastElement[0].selected !== option.selected) {
+ lastElement.prop('selected', (existingOption.selected = option.selected));
+ if (msie) {
+ // See #7692
+ // The selected item wouldn't visually update on IE without this.
+ // Tested on Win7: IE9, IE10 and IE11. Future IEs should be tested as well
+ lastElement.prop('selected', existingOption.selected);
+ }
+ }
+ } else {
+ // grow elements
+
+ // if it's a null option
+ if (option.id === '' && nullOption) {
+ // put back the pre-compiled element
+ element = nullOption;
+ } else {
+ // jQuery(v1.4.2) Bug: We should be able to chain the method calls, but
+ // in this version of jQuery on some browser the .text() returns a string
+ // rather then the element.
+ (element = optionTemplate.clone())
+ .val(option.id)
+ .prop('selected', option.selected)
+ .attr('selected', option.selected)
+ .text(option.label);
+ }
+
+ existingOptions.push(existingOption = {
+ element: element,
+ label: option.label,
+ id: option.id,
+ selected: option.selected
+ });
+ if (lastElement) {
+ lastElement.after(element);
+ } else {
+ existingParent.element.append(element);
+ }
+ lastElement = element;
+ }
+ }
+ // remove any excessive OPTIONs in a group
+ index++; // increment since the existingOptions[0] is parent element not OPTION
+ while(existingOptions.length > index) {
+ existingOptions.pop().element.remove();
+ }
+ }
+ // remove any excessive OPTGROUPs from select
+ while(optionGroupsCache.length > groupIndex) {
+ optionGroupsCache.pop()[0].element.remove();
+ }
+ }
+ }
+ }
+ };
+}];
+
+var optionDirective = ['$interpolate', function($interpolate) {
+ var nullSelectCtrl = {
+ addOption: noop,
+ removeOption: noop
+ };
+
+ return {
+ restrict: 'E',
+ priority: 100,
+ compile: function(element, attr) {
+ if (isUndefined(attr.value)) {
+ var interpolateFn = $interpolate(element.text(), true);
+ if (!interpolateFn) {
+ attr.$set('value', element.text());
+ }
+ }
+
+ return function (scope, element, attr) {
+ var selectCtrlName = '$selectController',
+ parent = element.parent(),
+ selectCtrl = parent.data(selectCtrlName) ||
+ parent.parent().data(selectCtrlName); // in case we are in optgroup
+
+ if (selectCtrl && selectCtrl.databound) {
+ // For some reason Opera defaults to true and if not overridden this messes up the repeater.
+ // We don't want the view to drive the initialization of the model anyway.
+ element.prop('selected', false);
+ } else {
+ selectCtrl = nullSelectCtrl;
+ }
+
+ if (interpolateFn) {
+ scope.$watch(interpolateFn, function interpolateWatchAction(newVal, oldVal) {
+ attr.$set('value', newVal);
+ if (newVal !== oldVal) selectCtrl.removeOption(oldVal);
+ selectCtrl.addOption(newVal);
+ });
+ } else {
+ selectCtrl.addOption(attr.value);
+ }
+
+ element.on('$destroy', function() {
+ selectCtrl.removeOption(attr.value);
+ });
+ };
+ }
+ };
+}];
+
+var styleDirective = valueFn({
+ restrict: 'E',
+ terminal: true
+});
+
+ if (window.angular.bootstrap) {
+ //AngularJS is already loaded, so we can return here...
+ console.log('WARNING: Tried to load angular more than once.');
+ return;
+ }
+
+ //try to bind to jquery now so that one can write angular.element().read()
+ //but we will rebind on bootstrap again.
+ bindJQuery();
+
+ publishExternalAPI(angular);
+
+ jqLite(document).ready(function() {
+ angularInit(document, bootstrap);
+ });
+
+})(window, document);
+
+!window.angular.$$csp() && window.angular.element(document).find('head').prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}.ng-animate-block-transitions{transition:0s all!important;-webkit-transition:0s all!important;}.ng-hide-add-active,.ng-hide-remove{display:block!important;}</style>'); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/app.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/app.js
new file mode 100644
index 00000000..a403b5b5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/app.js
@@ -0,0 +1,6 @@
+angular.module('att.abs.helper', []);
+angular.module('quantum', []);
+angular.module('ui.bootstrap', []);
+var app=angular.module("abs", ["att.abs", "att.abs.helper","modalServices",
+ "att.gridster","checklist-model","ngRoute", "ui.bootstrap","ngCookies"]);
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/checklist-model.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/checklist-model.js
new file mode 100644
index 00000000..09d8cefb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/checklist-model.js
@@ -0,0 +1,99 @@
+/**
+ * Checklist-model
+ * AngularJS directive for list of checkboxes
+ */
+
+angular.module('checklist-model', [])
+.directive('checklistModel', ['$parse', '$compile', function($parse, $compile) {
+ // contains
+ function contains(arr, item) {
+ if (angular.isArray(arr)) {
+ for (var i = 0; i < arr.length; i++) {
+ if (angular.equals(arr[i], item)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ // add
+ function add(arr, item) {
+ arr = angular.isArray(arr) ? arr : [];
+ for (var i = 0; i < arr.length; i++) {
+ if (angular.equals(arr[i], item)) {
+ return arr;
+ }
+ }
+ arr.push(item);
+ return arr;
+ }
+
+ // remove
+ function remove(arr, item) {
+ if (angular.isArray(arr)) {
+ for (var i = 0; i < arr.length; i++) {
+ if (angular.equals(arr[i], item)) {
+ arr.splice(i, 1);
+ break;
+ }
+ }
+ }
+ return arr;
+ }
+
+ // http://stackoverflow.com/a/19228302/1458162
+ function postLinkFn(scope, elem, attrs) {
+ // compile with `ng-model` pointing to `checked`
+ $compile(elem)(scope);
+
+ // getter / setter for original model
+ var getter = $parse(attrs.checklistModel);
+ var setter = getter.assign;
+
+ // value added to list
+ var value = $parse(attrs.checklistValue)(scope.$parent);
+
+ // watch UI checked change
+ scope.$watch('checked', function(newValue, oldValue) {
+ if (newValue === oldValue) {
+ return;
+ }
+ var current = getter(scope.$parent);
+ if (newValue === true) {
+ setter(scope.$parent, add(current, value));
+ } else {
+ setter(scope.$parent, remove(current, value));
+ }
+ });
+
+ // watch original model change
+ scope.$parent.$watch(attrs.checklistModel, function(newArr, oldArr) {
+ scope.checked = contains(newArr, value);
+ }, true);
+ }
+
+ return {
+ restrict: 'A',
+ priority: 1000,
+ terminal: true,
+ scope: true,
+ compile: function(tElement, tAttrs) {
+ if (tElement[0].tagName !== 'INPUT' || tAttrs.type !== 'checkbox') {
+ throw 'checklist-model should be applied to `input[type="checkbox"]`.';
+ }
+
+ if (!tAttrs.checklistValue) {
+ throw 'You should provide `checklist-value`.';
+ }
+
+ // exclude recursion
+ tElement.removeAttr('checklist-model');
+
+ // local scope var storing individual checkbox model
+ tElement.attr('ng-model', 'checked');
+
+ return postLinkFn;
+ }
+ };
+}]);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/checklist-model.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/checklist-model.min.js
new file mode 100644
index 00000000..61be598e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/checklist-model.min.js
@@ -0,0 +1 @@
+angular.module("checklist-model",[]).directive("checklistModel",["$parse","$compile",function(e,c){function b(g,j){if(angular.isArray(g)){for(var h=0;h<g.length;h++){if(angular.equals(g[h],j)){return true}}}return false}function f(g,j){g=angular.isArray(g)?g:[];for(var h=0;h<g.length;h++){if(angular.equals(g[h],j)){return g}}g.push(j);return g}function a(g,j){if(angular.isArray(g)){for(var h=0;h<g.length;h++){if(angular.equals(g[h],j)){g.splice(h,1);break}}}return g}function d(i,j,h){c(j)(i);var g=e(h.checklistModel);var l=g.assign;var k=e(h.checklistValue)(i.$parent);i.$watch("checked",function(o,m){if(o===m){return}var n=g(i.$parent);if(o===true){l(i.$parent,f(n,k))}else{l(i.$parent,a(n,k))}});i.$parent.$watch(h.checklistModel,function(n,m){i.checked=b(n,k)},true)}return{restrict:"A",priority:1000,terminal:true,scope:true,compile:function(g,h){if(g[0].tagName!=="INPUT"||!g.attr("type","checkbox")){throw'checklist-model should be applied to `input[type="checkbox"]`.'}if(!h.checklistValue){throw"You should provide `checklist-value`."}g.removeAttr("checklist-model");g.attr("ng-model","checked");return d}}}]);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/gestures.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/gestures.js
new file mode 100644
index 00000000..8c515d8a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/gestures.js
@@ -0,0 +1,1495 @@
+/*! Hammer.JS - v1.0.5 - 2013-04-07
+ * http://eightmedia.github.com/hammer.js
+ *
+ * Copyright (c) 2013 Jorik Tangelder <j.tangelder@gmail.com>;
+ * Licensed under the MIT license */
+
+(function(window, undefined) {
+ 'use strict';
+
+/**
+ * Hammer
+ * use this to create instances
+ * @param {HTMLElement} element
+ * @param {Object} options
+ * @returns {Hammer.Instance}
+ * @constructor
+ */
+var Hammer = function(element, options) {
+ return new Hammer.Instance(element, options || {});
+};
+
+// default settings
+Hammer.defaults = {
+ // add styles and attributes to the element to prevent the browser from doing
+ // its native behavior. this doesnt prevent the scrolling, but cancels
+ // the contextmenu, tap highlighting etc
+ // set to false to disable this
+ stop_browser_behavior: {
+ // this also triggers onselectstart=false for IE
+ userSelect: 'none',
+ // this makes the element blocking in IE10 >, you could experiment with the value
+ // see for more options this issue; https://github.com/EightMedia/hammer.js/issues/241
+ touchAction: 'none',
+ touchCallout: 'none',
+ contentZooming: 'none',
+ userDrag: 'none',
+ tapHighlightColor: 'rgba(0,0,0,0)'
+ }
+
+ // more settings are defined per gesture at gestures.js
+};
+
+// detect touchevents
+Hammer.HAS_POINTEREVENTS = navigator.pointerEnabled || navigator.msPointerEnabled;
+Hammer.HAS_TOUCHEVENTS = ('ontouchstart' in window);
+
+// dont use mouseevents on mobile devices
+Hammer.MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
+Hammer.NO_MOUSEEVENTS = Hammer.HAS_TOUCHEVENTS && navigator.userAgent.match(Hammer.MOBILE_REGEX);
+
+// eventtypes per touchevent (start, move, end)
+// are filled by Hammer.event.determineEventTypes on setup
+Hammer.EVENT_TYPES = {};
+
+// direction defines
+Hammer.DIRECTION_DOWN = 'down';
+Hammer.DIRECTION_LEFT = 'left';
+Hammer.DIRECTION_UP = 'up';
+Hammer.DIRECTION_RIGHT = 'right';
+
+// pointer type
+Hammer.POINTER_MOUSE = 'mouse';
+Hammer.POINTER_TOUCH = 'touch';
+Hammer.POINTER_PEN = 'pen';
+
+// touch event defines
+Hammer.EVENT_START = 'start';
+Hammer.EVENT_MOVE = 'move';
+Hammer.EVENT_END = 'end';
+
+// hammer document where the base events are added at
+Hammer.DOCUMENT = document;
+
+// plugins namespace
+Hammer.plugins = {};
+
+// if the window events are set...
+Hammer.READY = false;
+
+/**
+ * setup events to detect gestures on the document
+ */
+function setup() {
+ if(Hammer.READY) {
+ return;
+ }
+
+ // find what eventtypes we add listeners to
+ Hammer.event.determineEventTypes();
+
+ // Register all gestures inside Hammer.gestures
+ for(var name in Hammer.gestures) {
+ if(Hammer.gestures.hasOwnProperty(name)) {
+ Hammer.detection.register(Hammer.gestures[name]);
+ }
+ }
+
+ // Add touch events on the document
+ Hammer.event.onTouch(Hammer.DOCUMENT, Hammer.EVENT_MOVE, Hammer.detection.detect);
+ Hammer.event.onTouch(Hammer.DOCUMENT, Hammer.EVENT_END, Hammer.detection.detect);
+
+ // Hammer is ready...!
+ Hammer.READY = true;
+}
+
+/**
+ * create new hammer instance
+ * all methods should return the instance itself, so it is chainable.
+ * @param {HTMLElement} element
+ * @param {Object} [options={}]
+ * @returns {Hammer.Instance}
+ * @constructor
+ */
+Hammer.Instance = function(element, options) {
+ var self = this;
+
+ // setup HammerJS window events and register all gestures
+ // this also sets up the default options
+ setup();
+
+ this.element = element;
+
+ // start/stop detection option
+ this.enabled = true;
+
+ // merge options
+ this.options = Hammer.utils.extend(
+ Hammer.utils.extend({}, Hammer.defaults),
+ options || {});
+
+ // add some css to the element to prevent the browser from doing its native behavoir
+ if(this.options.stop_browser_behavior) {
+ Hammer.utils.stopDefaultBrowserBehavior(this.element, this.options.stop_browser_behavior);
+ }
+
+ // start detection on touchstart
+ Hammer.event.onTouch(element, Hammer.EVENT_START, function(ev) {
+ if(self.enabled) {
+ Hammer.detection.startDetect(self, ev);
+ }
+ });
+
+ // return instance
+ return this;
+};
+
+
+Hammer.Instance.prototype = {
+ /**
+ * bind events to the instance
+ * @param {String} gesture
+ * @param {Function} handler
+ * @returns {Hammer.Instance}
+ */
+ on: function onEvent(gesture, handler){
+ var gestures = gesture.split(' ');
+ for(var t=0; t<gestures.length; t++) {
+ this.element.addEventListener(gestures[t], handler, false);
+ }
+ return this;
+ },
+
+
+ /**
+ * unbind events to the instance
+ * @param {String} gesture
+ * @param {Function} handler
+ * @returns {Hammer.Instance}
+ */
+ off: function offEvent(gesture, handler){
+ var gestures = gesture.split(' ');
+ for(var t=0; t<gestures.length; t++) {
+ this.element.removeEventListener(gestures[t], handler, false);
+ }
+ return this;
+ },
+
+
+ /**
+ * trigger gesture event
+ * @param {String} gesture
+ * @param {Object} eventData
+ * @returns {Hammer.Instance}
+ */
+ trigger: function triggerEvent(gesture, eventData){
+ // create DOM event
+ var event = Hammer.DOCUMENT.createEvent('Event');
+ event.initEvent(gesture, true, true);
+ event.gesture = eventData;
+
+ // trigger on the target if it is in the instance element,
+ // this is for event delegation tricks
+ var element = this.element;
+ if(Hammer.utils.hasParent(eventData.target, element)) {
+ element = eventData.target;
+ }
+
+ element.dispatchEvent(event);
+ return this;
+ },
+
+
+ /**
+ * enable of disable hammer.js detection
+ * @param {Boolean} state
+ * @returns {Hammer.Instance}
+ */
+ enable: function enable(state) {
+ this.enabled = state;
+ return this;
+ }
+};
+
+/**
+ * this holds the last move event,
+ * used to fix empty touchend issue
+ * see the onTouch event for an explanation
+ * @type {Object}
+ */
+var last_move_event = null;
+
+
+/**
+ * when the mouse is hold down, this is true
+ * @type {Boolean}
+ */
+var enable_detect = false;
+
+
+/**
+ * when touch events have been fired, this is true
+ * @type {Boolean}
+ */
+var touch_triggered = false;
+
+
+Hammer.event = {
+ /**
+ * simple addEventListener
+ * @param {HTMLElement} element
+ * @param {String} type
+ * @param {Function} handler
+ */
+ bindDom: function(element, type, handler) {
+ var types = type.split(' ');
+ for(var t=0; t<types.length; t++) {
+ element.addEventListener(types[t], handler, false);
+ }
+ },
+
+
+ /**
+ * touch events with mouse fallback
+ * @param {HTMLElement} element
+ * @param {String} eventType like Hammer.EVENT_MOVE
+ * @param {Function} handler
+ */
+ onTouch: function onTouch(element, eventType, handler) {
+ var self = this;
+
+ this.bindDom(element, Hammer.EVENT_TYPES[eventType], function bindDomOnTouch(ev) {
+ var sourceEventType = ev.type.toLowerCase();
+
+ // onmouseup, but when touchend has been fired we do nothing.
+ // this is for touchdevices which also fire a mouseup on touchend
+ if(sourceEventType.match(/mouse/) && touch_triggered) {
+ return;
+ }
+
+ // mousebutton must be down or a touch event
+ else if( sourceEventType.match(/touch/) || // touch events are always on screen
+ sourceEventType.match(/pointerdown/) || // pointerevents touch
+ (sourceEventType.match(/mouse/) && ev.which === 1) // mouse is pressed
+ ){
+ enable_detect = true;
+ }
+
+ // we are in a touch event, set the touch triggered bool to true,
+ // this for the conflicts that may occur on ios and android
+ if(sourceEventType.match(/touch|pointer/)) {
+ touch_triggered = true;
+ }
+
+ // count the total touches on the screen
+ var count_touches = 0;
+
+ // when touch has been triggered in this detection session
+ // and we are now handling a mouse event, we stop that to prevent conflicts
+ if(enable_detect) {
+ // update pointerevent
+ if(Hammer.HAS_POINTEREVENTS && eventType != Hammer.EVENT_END) {
+ count_touches = Hammer.PointerEvent.updatePointer(eventType, ev);
+ }
+ // touch
+ else if(sourceEventType.match(/touch/)) {
+ count_touches = ev.touches.length;
+ }
+ // mouse
+ else if(!touch_triggered) {
+ count_touches = sourceEventType.match(/up/) ? 0 : 1;
+ }
+
+ // if we are in a end event, but when we remove one touch and
+ // we still have enough, set eventType to move
+ if(count_touches > 0 && eventType == Hammer.EVENT_END) {
+ eventType = Hammer.EVENT_MOVE;
+ }
+ // no touches, force the end event
+ else if(!count_touches) {
+ eventType = Hammer.EVENT_END;
+ }
+
+ // because touchend has no touches, and we often want to use these in our gestures,
+ // we send the last move event as our eventData in touchend
+ if(!count_touches && last_move_event !== null) {
+ ev = last_move_event;
+ }
+ // store the last move event
+ else {
+ last_move_event = ev;
+ }
+
+ // trigger the handler
+ handler.call(Hammer.detection, self.collectEventData(element, eventType, ev));
+
+ // remove pointerevent from list
+ if(Hammer.HAS_POINTEREVENTS && eventType == Hammer.EVENT_END) {
+ count_touches = Hammer.PointerEvent.updatePointer(eventType, ev);
+ }
+ }
+
+ //debug(sourceEventType +" "+ eventType);
+
+ // on the end we reset everything
+ if(!count_touches) {
+ last_move_event = null;
+ enable_detect = false;
+ touch_triggered = false;
+ Hammer.PointerEvent.reset();
+ }
+ });
+ },
+
+
+ /**
+ * we have different events for each device/browser
+ * determine what we need and set them in the Hammer.EVENT_TYPES constant
+ */
+ determineEventTypes: function determineEventTypes() {
+ // determine the eventtype we want to set
+ var types;
+
+ // pointerEvents magic
+ if(Hammer.HAS_POINTEREVENTS) {
+ types = Hammer.PointerEvent.getEvents();
+ }
+ // on Android, iOS, blackberry, windows mobile we dont want any mouseevents
+ else if(Hammer.NO_MOUSEEVENTS) {
+ types = [
+ 'touchstart',
+ 'touchmove',
+ 'touchend touchcancel'];
+ }
+ // for non pointer events browsers and mixed browsers,
+ // like chrome on windows8 touch laptop
+ else {
+ types = [
+ 'touchstart mousedown',
+ 'touchmove mousemove',
+ 'touchend touchcancel mouseup'];
+ }
+
+ Hammer.EVENT_TYPES[Hammer.EVENT_START] = types[0];
+ Hammer.EVENT_TYPES[Hammer.EVENT_MOVE] = types[1];
+ Hammer.EVENT_TYPES[Hammer.EVENT_END] = types[2];
+ },
+
+
+ /**
+ * create touchlist depending on the event
+ * @param {Object} ev
+ * @param {String} eventType used by the fakemultitouch plugin
+ */
+ getTouchList: function getTouchList(ev/*, eventType*/) {
+ // get the fake pointerEvent touchlist
+ if(Hammer.HAS_POINTEREVENTS) {
+ return Hammer.PointerEvent.getTouchList();
+ }
+ // get the touchlist
+ else if(ev.touches) {
+ return ev.touches;
+ }
+ // make fake touchlist from mouse position
+ else {
+ return [{
+ identifier: 1,
+ pageX: ev.pageX,
+ pageY: ev.pageY,
+ target: ev.target
+ }];
+ }
+ },
+
+
+ /**
+ * collect event data for Hammer js
+ * @param {HTMLElement} element
+ * @param {String} eventType like Hammer.EVENT_MOVE
+ * @param {Object} eventData
+ */
+ collectEventData: function collectEventData(element, eventType, ev) {
+ var touches = this.getTouchList(ev, eventType);
+
+ // find out pointerType
+ var pointerType = Hammer.POINTER_TOUCH;
+ if(ev.type.match(/mouse/) || Hammer.PointerEvent.matchType(Hammer.POINTER_MOUSE, ev)) {
+ pointerType = Hammer.POINTER_MOUSE;
+ }
+
+ return {
+ center : Hammer.utils.getCenter(touches),
+ timeStamp : new Date().getTime(),
+ target : ev.target,
+ touches : touches,
+ eventType : eventType,
+ pointerType : pointerType,
+ srcEvent : ev,
+
+ /**
+ * prevent the browser default actions
+ * mostly used to disable scrolling of the browser
+ */
+ preventDefault: function() {
+ if(this.srcEvent.preventManipulation) {
+ this.srcEvent.preventManipulation();
+ }
+
+ if(this.srcEvent.preventDefault) {
+ this.srcEvent.preventDefault();
+ }
+ },
+
+ /**
+ * stop bubbling the event up to its parents
+ */
+ stopPropagation: function() {
+ this.srcEvent.stopPropagation();
+ },
+
+ /**
+ * immediately stop gesture detection
+ * might be useful after a swipe was detected
+ * @return {*}
+ */
+ stopDetect: function() {
+ return Hammer.detection.stopDetect();
+ }
+ };
+ }
+};
+
+Hammer.PointerEvent = {
+ /**
+ * holds all pointers
+ * @type {Object}
+ */
+ pointers: {},
+
+ /**
+ * get a list of pointers
+ * @returns {Array} touchlist
+ */
+ getTouchList: function() {
+ var self = this;
+ var touchlist = [];
+
+ // we can use forEach since pointerEvents only is in IE10
+ Object.keys(self.pointers).sort().forEach(function(id) {
+ touchlist.push(self.pointers[id]);
+ });
+ return touchlist;
+ },
+
+ /**
+ * update the position of a pointer
+ * @param {String} type Hammer.EVENT_END
+ * @param {Object} pointerEvent
+ */
+ updatePointer: function(type, pointerEvent) {
+ if(type == Hammer.EVENT_END) {
+ this.pointers = {};
+ }
+ else {
+ pointerEvent.identifier = pointerEvent.pointerId;
+ this.pointers[pointerEvent.pointerId] = pointerEvent;
+ }
+
+ return Object.keys(this.pointers).length;
+ },
+
+ /**
+ * check if ev matches pointertype
+ * @param {String} pointerType Hammer.POINTER_MOUSE
+ * @param {PointerEvent} ev
+ */
+ matchType: function(pointerType, ev) {
+ if(!ev.pointerType) {
+ return false;
+ }
+
+ var types = {};
+ types[Hammer.POINTER_MOUSE] = (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE || ev.pointerType == Hammer.POINTER_MOUSE);
+ types[Hammer.POINTER_TOUCH] = (ev.pointerType == ev.MSPOINTER_TYPE_TOUCH || ev.pointerType == Hammer.POINTER_TOUCH);
+ types[Hammer.POINTER_PEN] = (ev.pointerType == ev.MSPOINTER_TYPE_PEN || ev.pointerType == Hammer.POINTER_PEN);
+ return types[pointerType];
+ },
+
+
+ /**
+ * get events
+ */
+ getEvents: function() {
+ return [
+ 'pointerdown MSPointerDown',
+ 'pointermove MSPointerMove',
+ 'pointerup pointercancel MSPointerUp MSPointerCancel'
+ ];
+ },
+
+ /**
+ * reset the list
+ */
+ reset: function() {
+ this.pointers = {};
+ }
+};
+
+
+Hammer.utils = {
+ /**
+ * extend method,
+ * also used for cloning when dest is an empty object
+ * @param {Object} dest
+ * @param {Object} src
+ * @parm {Boolean} merge do a merge
+ * @returns {Object} dest
+ */
+ extend: function extend(dest, src, merge) {
+ for (var key in src) {
+ if(dest[key] !== undefined && merge) {
+ continue;
+ }
+ dest[key] = src[key];
+ }
+ return dest;
+ },
+
+
+ /**
+ * find if a node is in the given parent
+ * used for event delegation tricks
+ * @param {HTMLElement} node
+ * @param {HTMLElement} parent
+ * @returns {boolean} has_parent
+ */
+ hasParent: function(node, parent) {
+ while(node){
+ if(node == parent) {
+ return true;
+ }
+ node = node.parentNode;
+ }
+ return false;
+ },
+
+
+ /**
+ * get the center of all the touches
+ * @param {Array} touches
+ * @returns {Object} center
+ */
+ getCenter: function getCenter(touches) {
+ var valuesX = [], valuesY = [];
+
+ for(var t= 0,len=touches.length; t<len; t++) {
+ valuesX.push(touches[t].pageX);
+ valuesY.push(touches[t].pageY);
+ }
+
+ return {
+ pageX: ((Math.min.apply(Math, valuesX) + Math.max.apply(Math, valuesX)) / 2),
+ pageY: ((Math.min.apply(Math, valuesY) + Math.max.apply(Math, valuesY)) / 2)
+ };
+ },
+
+
+ /**
+ * calculate the velocity between two points
+ * @param {Number} delta_time
+ * @param {Number} delta_x
+ * @param {Number} delta_y
+ * @returns {Object} velocity
+ */
+ getVelocity: function getVelocity(delta_time, delta_x, delta_y) {
+ return {
+ x: Math.abs(delta_x / delta_time) || 0,
+ y: Math.abs(delta_y / delta_time) || 0
+ };
+ },
+
+
+ /**
+ * calculate the angle between two coordinates
+ * @param {Touch} touch1
+ * @param {Touch} touch2
+ * @returns {Number} angle
+ */
+ getAngle: function getAngle(touch1, touch2) {
+ var y = touch2.pageY - touch1.pageY,
+ x = touch2.pageX - touch1.pageX;
+ return Math.atan2(y, x) * 180 / Math.PI;
+ },
+
+
+ /**
+ * angle to direction define
+ * @param {Touch} touch1
+ * @param {Touch} touch2
+ * @returns {String} direction constant, like Hammer.DIRECTION_LEFT
+ */
+ getDirection: function getDirection(touch1, touch2) {
+ var x = Math.abs(touch1.pageX - touch2.pageX),
+ y = Math.abs(touch1.pageY - touch2.pageY);
+
+ if(x >= y) {
+ return touch1.pageX - touch2.pageX > 0 ? Hammer.DIRECTION_LEFT : Hammer.DIRECTION_RIGHT;
+ }
+ else {
+ return touch1.pageY - touch2.pageY > 0 ? Hammer.DIRECTION_UP : Hammer.DIRECTION_DOWN;
+ }
+ },
+
+
+ /**
+ * calculate the distance between two touches
+ * @param {Touch} touch1
+ * @param {Touch} touch2
+ * @returns {Number} distance
+ */
+ getDistance: function getDistance(touch1, touch2) {
+ var x = touch2.pageX - touch1.pageX,
+ y = touch2.pageY - touch1.pageY;
+ return Math.sqrt((x*x) + (y*y));
+ },
+
+
+ /**
+ * calculate the scale factor between two touchLists (fingers)
+ * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
+ * @param {Array} start
+ * @param {Array} end
+ * @returns {Number} scale
+ */
+ getScale: function getScale(start, end) {
+ // need two fingers...
+ if(start.length >= 2 && end.length >= 2) {
+ return this.getDistance(end[0], end[1]) /
+ this.getDistance(start[0], start[1]);
+ }
+ return 1;
+ },
+
+
+ /**
+ * calculate the rotation degrees between two touchLists (fingers)
+ * @param {Array} start
+ * @param {Array} end
+ * @returns {Number} rotation
+ */
+ getRotation: function getRotation(start, end) {
+ // need two fingers
+ if(start.length >= 2 && end.length >= 2) {
+ return this.getAngle(end[1], end[0]) -
+ this.getAngle(start[1], start[0]);
+ }
+ return 0;
+ },
+
+
+ /**
+ * boolean if the direction is vertical
+ * @param {String} direction
+ * @returns {Boolean} is_vertical
+ */
+ isVertical: function isVertical(direction) {
+ return (direction == Hammer.DIRECTION_UP || direction == Hammer.DIRECTION_DOWN);
+ },
+
+
+ /**
+ * stop browser default behavior with css props
+ * @param {HtmlElement} element
+ * @param {Object} css_props
+ */
+ stopDefaultBrowserBehavior: function stopDefaultBrowserBehavior(element, css_props) {
+ var prop,
+ vendors = ['webkit','khtml','moz','ms','o',''];
+
+ if(!css_props || !element.style) {
+ return;
+ }
+
+ // with css properties for modern browsers
+ for(var i = 0; i < vendors.length; i++) {
+ for(var p in css_props) {
+ if(css_props.hasOwnProperty(p)) {
+ prop = p;
+
+ // vender prefix at the property
+ if(vendors[i]) {
+ prop = vendors[i] + prop.substring(0, 1).toUpperCase() + prop.substring(1);
+ }
+
+ // set the style
+ element.style[prop] = css_props[p];
+ }
+ }
+ }
+
+ // also the disable onselectstart
+ if(css_props.userSelect == 'none') {
+ element.onselectstart = function() {
+ return false;
+ };
+ }
+ }
+};
+
+Hammer.detection = {
+ // contains all registred Hammer.gestures in the correct order
+ gestures: [],
+
+ // data of the current Hammer.gesture detection session
+ current: null,
+
+ // the previous Hammer.gesture session data
+ // is a full clone of the previous gesture.current object
+ previous: null,
+
+ // when this becomes true, no gestures are fired
+ stopped: false,
+
+
+ /**
+ * start Hammer.gesture detection
+ * @param {Hammer.Instance} inst
+ * @param {Object} eventData
+ */
+ startDetect: function startDetect(inst, eventData) {
+ // already busy with a Hammer.gesture detection on an element
+ if(this.current) {
+ return;
+ }
+
+ this.stopped = false;
+
+ this.current = {
+ inst : inst, // reference to HammerInstance we're working for
+ startEvent : Hammer.utils.extend({}, eventData), // start eventData for distances, timing etc
+ lastEvent : false, // last eventData
+ name : '' // current gesture we're in/detected, can be 'tap', 'hold' etc
+ };
+
+ this.detect(eventData);
+ },
+
+
+ /**
+ * Hammer.gesture detection
+ * @param {Object} eventData
+ * @param {Object} eventData
+ */
+ detect: function detect(eventData) {
+ if(!this.current || this.stopped) {
+ return;
+ }
+
+ // extend event data with calculations about scale, distance etc
+ eventData = this.extendEventData(eventData);
+
+ // instance options
+ var inst_options = this.current.inst.options;
+
+ // call Hammer.gesture handlers
+ for(var g=0,len=this.gestures.length; g<len; g++) {
+ var gesture = this.gestures[g];
+
+ // only when the instance options have enabled this gesture
+ if(!this.stopped && inst_options[gesture.name] !== false) {
+ // if a handler returns false, we stop with the detection
+ if(gesture.handler.call(gesture, eventData, this.current.inst) === false) {
+ this.stopDetect();
+ break;
+ }
+ }
+ }
+
+ // store as previous event event
+ if(this.current) {
+ this.current.lastEvent = eventData;
+ }
+
+ // endevent, but not the last touch, so dont stop
+ if(eventData.eventType == Hammer.EVENT_END && !eventData.touches.length-1) {
+ this.stopDetect();
+ }
+
+ return eventData;
+ },
+
+
+ /**
+ * clear the Hammer.gesture vars
+ * this is called on endDetect, but can also be used when a final Hammer.gesture has been detected
+ * to stop other Hammer.gestures from being fired
+ */
+ stopDetect: function stopDetect() {
+ // clone current data to the store as the previous gesture
+ // used for the double tap gesture, since this is an other gesture detect session
+ this.previous = Hammer.utils.extend({}, this.current);
+
+ // reset the current
+ this.current = null;
+
+ // stopped!
+ this.stopped = true;
+ },
+
+
+ /**
+ * extend eventData for Hammer.gestures
+ * @param {Object} ev
+ * @returns {Object} ev
+ */
+ extendEventData: function extendEventData(ev) {
+ var startEv = this.current.startEvent;
+
+ // if the touches change, set the new touches over the startEvent touches
+ // this because touchevents don't have all the touches on touchstart, or the
+ // user must place his fingers at the EXACT same time on the screen, which is not realistic
+ // but, sometimes it happens that both fingers are touching at the EXACT same time
+ if(startEv && (ev.touches.length != startEv.touches.length || ev.touches === startEv.touches)) {
+ // extend 1 level deep to get the touchlist with the touch objects
+ startEv.touches = [];
+ for(var i=0,len=ev.touches.length; i<len; i++) {
+ startEv.touches.push(Hammer.utils.extend({}, ev.touches[i]));
+ }
+ }
+
+ var delta_time = ev.timeStamp - startEv.timeStamp,
+ delta_x = ev.center.pageX - startEv.center.pageX,
+ delta_y = ev.center.pageY - startEv.center.pageY,
+ velocity = Hammer.utils.getVelocity(delta_time, delta_x, delta_y);
+
+ Hammer.utils.extend(ev, {
+ deltaTime : delta_time,
+
+ deltaX : delta_x,
+ deltaY : delta_y,
+
+ velocityX : velocity.x,
+ velocityY : velocity.y,
+
+ distance : Hammer.utils.getDistance(startEv.center, ev.center),
+ angle : Hammer.utils.getAngle(startEv.center, ev.center),
+ direction : Hammer.utils.getDirection(startEv.center, ev.center),
+
+ scale : Hammer.utils.getScale(startEv.touches, ev.touches),
+ rotation : Hammer.utils.getRotation(startEv.touches, ev.touches),
+
+ startEvent : startEv
+ });
+
+ return ev;
+ },
+
+
+ /**
+ * register new gesture
+ * @param {Object} gesture object, see gestures.js for documentation
+ * @returns {Array} gestures
+ */
+ register: function register(gesture) {
+ // add an enable gesture options if there is no given
+ var options = gesture.defaults || {};
+ if(options[gesture.name] === undefined) {
+ options[gesture.name] = true;
+ }
+
+ // extend Hammer default options with the Hammer.gesture options
+ Hammer.utils.extend(Hammer.defaults, options, true);
+
+ // set its index
+ gesture.index = gesture.index || 1000;
+
+ // add Hammer.gesture to the list
+ this.gestures.push(gesture);
+
+ // sort the list by index
+ this.gestures.sort(function(a, b) {
+ if (a.index < b.index) {
+ return -1;
+ }
+ if (a.index > b.index) {
+ return 1;
+ }
+ return 0;
+ });
+
+ return this.gestures;
+ }
+};
+
+
+Hammer.gestures = Hammer.gestures || {};
+
+/**
+ * Custom gestures
+ * ==============================
+ *
+ * Gesture object
+ * --------------------
+ * The object structure of a gesture:
+ *
+ * { name: 'mygesture',
+ * index: 1337,
+ * defaults: {
+ * mygesture_option: true
+ * }
+ * handler: function(type, ev, inst) {
+ * // trigger gesture event
+ * inst.trigger(this.name, ev);
+ * }
+ * }
+
+ * @param {String} name
+ * this should be the name of the gesture, lowercase
+ * it is also being used to disable/enable the gesture per instance config.
+ *
+ * @param {Number} [index=1000]
+ * the index of the gesture, where it is going to be in the stack of gestures detection
+ * like when you build an gesture that depends on the drag gesture, it is a good
+ * idea to place it after the index of the drag gesture.
+ *
+ * @param {Object} [defaults={}]
+ * the default settings of the gesture. these are added to the instance settings,
+ * and can be overruled per instance. you can also add the name of the gesture,
+ * but this is also added by default (and set to true).
+ *
+ * @param {Function} handler
+ * this handles the gesture detection of your custom gesture and receives the
+ * following arguments:
+ *
+ * @param {Object} eventData
+ * event data containing the following properties:
+ * timeStamp {Number} time the event occurred
+ * target {HTMLElement} target element
+ * touches {Array} touches (fingers, pointers, mouse) on the screen
+ * pointerType {String} kind of pointer that was used. matches Hammer.POINTER_MOUSE|TOUCH
+ * center {Object} center position of the touches. contains pageX and pageY
+ * deltaTime {Number} the total time of the touches in the screen
+ * deltaX {Number} the delta on x axis we haved moved
+ * deltaY {Number} the delta on y axis we haved moved
+ * velocityX {Number} the velocity on the x
+ * velocityY {Number} the velocity on y
+ * angle {Number} the angle we are moving
+ * direction {String} the direction we are moving. matches Hammer.DIRECTION_UP|DOWN|LEFT|RIGHT
+ * distance {Number} the distance we haved moved
+ * scale {Number} scaling of the touches, needs 2 touches
+ * rotation {Number} rotation of the touches, needs 2 touches *
+ * eventType {String} matches Hammer.EVENT_START|MOVE|END
+ * srcEvent {Object} the source event, like TouchStart or MouseDown *
+ * startEvent {Object} contains the same properties as above,
+ * but from the first touch. this is used to calculate
+ * distances, deltaTime, scaling etc
+ *
+ * @param {Hammer.Instance} inst
+ * the instance we are doing the detection for. you can get the options from
+ * the inst.options object and trigger the gesture event by calling inst.trigger
+ *
+ *
+ * Handle gestures
+ * --------------------
+ * inside the handler you can get/set Hammer.detection.current. This is the current
+ * detection session. It has the following properties
+ * @param {String} name
+ * contains the name of the gesture we have detected. it has not a real function,
+ * only to check in other gestures if something is detected.
+ * like in the drag gesture we set it to 'drag' and in the swipe gesture we can
+ * check if the current gesture is 'drag' by accessing Hammer.detection.current.name
+ *
+ * @readonly
+ * @param {Hammer.Instance} inst
+ * the instance we do the detection for
+ *
+ * @readonly
+ * @param {Object} startEvent
+ * contains the properties of the first gesture detection in this session.
+ * Used for calculations about timing, distance, etc.
+ *
+ * @readonly
+ * @param {Object} lastEvent
+ * contains all the properties of the last gesture detect in this session.
+ *
+ * after the gesture detection session has been completed (user has released the screen)
+ * the Hammer.detection.current object is copied into Hammer.detection.previous,
+ * this is usefull for gestures like doubletap, where you need to know if the
+ * previous gesture was a tap
+ *
+ * options that have been set by the instance can be received by calling inst.options
+ *
+ * You can trigger a gesture event by calling inst.trigger("mygesture", event).
+ * The first param is the name of your gesture, the second the event argument
+ *
+ *
+ * Register gestures
+ * --------------------
+ * When an gesture is added to the Hammer.gestures object, it is auto registered
+ * at the setup of the first Hammer instance. You can also call Hammer.detection.register
+ * manually and pass your gesture object as a param
+ *
+ */
+
+/**
+ * Hold
+ * Touch stays at the same place for x time
+ * @events hold
+ */
+Hammer.gestures.Hold = {
+ name: 'hold',
+ index: 10,
+ defaults: {
+ hold_timeout : 500,
+ hold_threshold : 1
+ },
+ timer: null,
+ handler: function holdGesture(ev, inst) {
+ switch(ev.eventType) {
+ case Hammer.EVENT_START:
+ // clear any running timers
+ clearTimeout(this.timer);
+
+ // set the gesture so we can check in the timeout if it still is
+ Hammer.detection.current.name = this.name;
+
+ // set timer and if after the timeout it still is hold,
+ // we trigger the hold event
+ this.timer = setTimeout(function() {
+ if(Hammer.detection.current.name == 'hold') {
+ inst.trigger('hold', ev);
+ }
+ }, inst.options.hold_timeout);
+ break;
+
+ // when you move or end we clear the timer
+ case Hammer.EVENT_MOVE:
+ if(ev.distance > inst.options.hold_threshold) {
+ clearTimeout(this.timer);
+ }
+ break;
+
+ case Hammer.EVENT_END:
+ clearTimeout(this.timer);
+ break;
+ }
+ }
+};
+
+
+/**
+ * Tap/DoubleTap
+ * Quick touch at a place or double at the same place
+ * @events tap, doubletap
+ */
+Hammer.gestures.Tap = {
+ name: 'tap',
+ index: 100,
+ defaults: {
+ tap_max_touchtime : 250,
+ tap_max_distance : 10,
+ tap_always : true,
+ doubletap_distance : 20,
+ doubletap_interval : 300
+ },
+ handler: function tapGesture(ev, inst) {
+ if(ev.eventType == Hammer.EVENT_END) {
+ // previous gesture, for the double tap since these are two different gesture detections
+ var prev = Hammer.detection.previous,
+ did_doubletap = false;
+
+ // when the touchtime is higher then the max touch time
+ // or when the moving distance is too much
+ if(ev.deltaTime > inst.options.tap_max_touchtime ||
+ ev.distance > inst.options.tap_max_distance) {
+ return;
+ }
+
+ // check if double tap
+ if(prev && prev.name == 'tap' &&
+ (ev.timeStamp - prev.lastEvent.timeStamp) < inst.options.doubletap_interval &&
+ ev.distance < inst.options.doubletap_distance) {
+ inst.trigger('doubletap', ev);
+ did_doubletap = true;
+ }
+
+ // do a single tap
+ if(!did_doubletap || inst.options.tap_always) {
+ Hammer.detection.current.name = 'tap';
+ inst.trigger(Hammer.detection.current.name, ev);
+ }
+ }
+ }
+};
+
+
+/**
+ * Swipe
+ * triggers swipe events when the end velocity is above the threshold
+ * @events swipe, swipeleft, swiperight, swipeup, swipedown
+ */
+Hammer.gestures.Swipe = {
+ name: 'swipe',
+ index: 40,
+ defaults: {
+ // set 0 for unlimited, but this can conflict with transform
+ swipe_max_touches : 1,
+ swipe_velocity : 0.7
+ },
+ handler: function swipeGesture(ev, inst) {
+ if(ev.eventType == Hammer.EVENT_END) {
+ // max touches
+ if(inst.options.swipe_max_touches > 0 &&
+ ev.touches.length > inst.options.swipe_max_touches) {
+ return;
+ }
+
+ // when the distance we moved is too small we skip this gesture
+ // or we can be already in dragging
+ if(ev.velocityX > inst.options.swipe_velocity ||
+ ev.velocityY > inst.options.swipe_velocity) {
+ // trigger swipe events
+ inst.trigger(this.name, ev);
+ inst.trigger(this.name + ev.direction, ev);
+ }
+ }
+ }
+};
+
+
+/**
+ * Drag
+ * Move with x fingers (default 1) around on the page. Blocking the scrolling when
+ * moving left and right is a good practice. When all the drag events are blocking
+ * you disable scrolling on that area.
+ * @events drag, drapleft, dragright, dragup, dragdown
+ */
+Hammer.gestures.Drag = {
+ name: 'drag',
+ index: 50,
+ defaults: {
+ drag_min_distance : 10,
+ // set 0 for unlimited, but this can conflict with transform
+ drag_max_touches : 1,
+ // prevent default browser behavior when dragging occurs
+ // be careful with it, it makes the element a blocking element
+ // when you are using the drag gesture, it is a good practice to set this true
+ drag_block_horizontal : false,
+ drag_block_vertical : false,
+ // drag_lock_to_axis keeps the drag gesture on the axis that it started on,
+ // It disallows vertical directions if the initial direction was horizontal, and vice versa.
+ drag_lock_to_axis : false,
+ // drag lock only kicks in when distance > drag_lock_min_distance
+ // This way, locking occurs only when the distance has become large enough to reliably determine the direction
+ drag_lock_min_distance : 25
+ },
+ triggered: false,
+ handler: function dragGesture(ev, inst) {
+ // current gesture isnt drag, but dragged is true
+ // this means an other gesture is busy. now call dragend
+ if(Hammer.detection.current.name != this.name && this.triggered) {
+ inst.trigger(this.name +'end', ev);
+ this.triggered = false;
+ return;
+ }
+
+ // max touches
+ if(inst.options.drag_max_touches > 0 &&
+ ev.touches.length > inst.options.drag_max_touches) {
+ return;
+ }
+
+ switch(ev.eventType) {
+ case Hammer.EVENT_START:
+ this.triggered = false;
+ break;
+
+ case Hammer.EVENT_MOVE:
+ // when the distance we moved is too small we skip this gesture
+ // or we can be already in dragging
+ if(ev.distance < inst.options.drag_min_distance &&
+ Hammer.detection.current.name != this.name) {
+ return;
+ }
+
+ // we are dragging!
+ Hammer.detection.current.name = this.name;
+
+ // lock drag to axis?
+ if(Hammer.detection.current.lastEvent.drag_locked_to_axis || (inst.options.drag_lock_to_axis && inst.options.drag_lock_min_distance<=ev.distance)) {
+ ev.drag_locked_to_axis = true;
+ }
+ var last_direction = Hammer.detection.current.lastEvent.direction;
+ if(ev.drag_locked_to_axis && last_direction !== ev.direction) {
+ // keep direction on the axis that the drag gesture started on
+ if(Hammer.utils.isVertical(last_direction)) {
+ ev.direction = (ev.deltaY < 0) ? Hammer.DIRECTION_UP : Hammer.DIRECTION_DOWN;
+ }
+ else {
+ ev.direction = (ev.deltaX < 0) ? Hammer.DIRECTION_LEFT : Hammer.DIRECTION_RIGHT;
+ }
+ }
+
+ // first time, trigger dragstart event
+ if(!this.triggered) {
+ inst.trigger(this.name +'start', ev);
+ this.triggered = true;
+ }
+
+ // trigger normal event
+ inst.trigger(this.name, ev);
+
+ // direction event, like dragdown
+ inst.trigger(this.name + ev.direction, ev);
+
+ // block the browser events
+ if( (inst.options.drag_block_vertical && Hammer.utils.isVertical(ev.direction)) ||
+ (inst.options.drag_block_horizontal && !Hammer.utils.isVertical(ev.direction))) {
+ ev.preventDefault();
+ }
+ break;
+
+ case Hammer.EVENT_END:
+ // trigger dragend
+ if(this.triggered) {
+ inst.trigger(this.name +'end', ev);
+ }
+
+ this.triggered = false;
+ break;
+ }
+ }
+};
+
+
+/**
+ * Transform
+ * User want to scale or rotate with 2 fingers
+ * @events transform, pinch, pinchin, pinchout, rotate
+ */
+Hammer.gestures.Transform = {
+ name: 'transform',
+ index: 45,
+ defaults: {
+ // factor, no scale is 1, zoomin is to 0 and zoomout until higher then 1
+ transform_min_scale : 0.01,
+ // rotation in degrees
+ transform_min_rotation : 1,
+ // prevent default browser behavior when two touches are on the screen
+ // but it makes the element a blocking element
+ // when you are using the transform gesture, it is a good practice to set this true
+ transform_always_block : false
+ },
+ triggered: false,
+ handler: function transformGesture(ev, inst) {
+ // current gesture isnt drag, but dragged is true
+ // this means an other gesture is busy. now call dragend
+ if(Hammer.detection.current.name != this.name && this.triggered) {
+ inst.trigger(this.name +'end', ev);
+ this.triggered = false;
+ return;
+ }
+
+ // atleast multitouch
+ if(ev.touches.length < 2) {
+ return;
+ }
+
+ // prevent default when two fingers are on the screen
+ if(inst.options.transform_always_block) {
+ ev.preventDefault();
+ }
+
+ switch(ev.eventType) {
+ case Hammer.EVENT_START:
+ this.triggered = false;
+ break;
+
+ case Hammer.EVENT_MOVE:
+ var scale_threshold = Math.abs(1-ev.scale);
+ var rotation_threshold = Math.abs(ev.rotation);
+
+ // when the distance we moved is too small we skip this gesture
+ // or we can be already in dragging
+ if(scale_threshold < inst.options.transform_min_scale &&
+ rotation_threshold < inst.options.transform_min_rotation) {
+ return;
+ }
+
+ // we are transforming!
+ Hammer.detection.current.name = this.name;
+
+ // first time, trigger dragstart event
+ if(!this.triggered) {
+ inst.trigger(this.name +'start', ev);
+ this.triggered = true;
+ }
+
+ inst.trigger(this.name, ev); // basic transform event
+
+ // trigger rotate event
+ if(rotation_threshold > inst.options.transform_min_rotation) {
+ inst.trigger('rotate', ev);
+ }
+
+ // trigger pinch event
+ if(scale_threshold > inst.options.transform_min_scale) {
+ inst.trigger('pinch', ev);
+ inst.trigger('pinch'+ ((ev.scale < 1) ? 'in' : 'out'), ev);
+ }
+ break;
+
+ case Hammer.EVENT_END:
+ // trigger dragend
+ if(this.triggered) {
+ inst.trigger(this.name +'end', ev);
+ }
+
+ this.triggered = false;
+ break;
+ }
+ }
+};
+
+
+/**
+ * Touch
+ * Called as first, tells the user has touched the screen
+ * @events touch
+ */
+Hammer.gestures.Touch = {
+ name: 'touch',
+ index: -Infinity,
+ defaults: {
+ // call preventDefault at touchstart, and makes the element blocking by
+ // disabling the scrolling of the page, but it improves gestures like
+ // transforming and dragging.
+ // be careful with using this, it can be very annoying for users to be stuck
+ // on the page
+ prevent_default: false,
+
+ // disable mouse events, so only touch (or pen!) input triggers events
+ prevent_mouseevents: false
+ },
+ handler: function touchGesture(ev, inst) {
+ if(inst.options.prevent_mouseevents && ev.pointerType == Hammer.POINTER_MOUSE) {
+ ev.stopDetect();
+ return;
+ }
+
+ if(inst.options.prevent_default) {
+ ev.preventDefault();
+ }
+
+ if(ev.eventType == Hammer.EVENT_START) {
+ inst.trigger(this.name, ev);
+ }
+ }
+};
+
+
+/**
+ * Release
+ * Called as last, tells the user has released the screen
+ * @events release
+ */
+Hammer.gestures.Release = {
+ name: 'release',
+ index: Infinity,
+ handler: function releaseGesture(ev, inst) {
+ if(ev.eventType == Hammer.EVENT_END) {
+ inst.trigger(this.name, ev);
+ }
+ }
+};
+
+// node export
+if(typeof module === 'object' && typeof module.exports === 'object'){
+ module.exports = Hammer;
+}
+// just window export
+else {
+ window.Hammer = Hammer;
+
+ // requireJS module definition
+ if(typeof window.define === 'function' && window.define.amd) {
+ window.define('hammer', [], function() {
+ return Hammer;
+ });
+ }
+}
+})(this);
+'use strict';
+
+angular.module('angular-gestures', []);
+
+/**
+ * Inspired by AngularJS' implementation of "click dblclick mousedown..."
+ *
+ * This ties in the Hammer 1.0.0 events to attributes like:
+ *
+ * hm-tap="add_something()" hm-swipe="remove_something()"
+ *
+ * and also has support for Hammer options with:
+ *
+ * hm-tap-opts="{hold: false}"
+ *
+ * or any other of the "hm-event" listed underneath.
+ */
+var HGESTURES = {
+ hmDoubleTap : 'doubletap',
+ hmDragstart : 'dragstart',
+ hmDrag : 'drag',
+ hmDragUp : 'dragup',
+ hmDragDown : 'dragdown',
+ hmDragLeft : 'dragleft',
+ hmDragRight : 'dragright',
+ hmDragend : 'dragend',
+ hmHold : 'hold',
+ hmPinch : 'pinch',
+ hmPinchIn : 'pinchin',
+ hmPinchOut : 'pinchout',
+ hmRelease : 'release',
+ hmRotate : 'rotate',
+ hmSwipe : 'swipe',
+ hmSwipeUp : 'swipeup',
+ hmSwipeDown : 'swipedown',
+ hmSwipeLeft : 'swipeleft',
+ hmSwipeRight : 'swiperight',
+ hmTap : 'tap',
+ hmTouch : 'touch',
+ hmTransformstart : 'transformstart',
+ hmTransform : 'transform',
+ hmTransformend : 'transformend'
+};
+
+var VERBOSE = false;
+
+angular.forEach(HGESTURES, function(eventName, directiveName) {
+ angular.module('angular-gestures').directive(
+ directiveName,
+ ['$parse', '$log', '$timeout', function($parse, $log, $timeout) {
+ return function(scope, element, attr) {
+ var hammertime, handler;
+ attr.$observe(directiveName, function(value) {
+ var fn = $parse(value);
+ var opts = $parse(attr[directiveName + 'Opts'])
+ (scope, {});
+ hammertime = new Hammer(element[0], opts);
+ handler = function(event) {
+ if (VERBOSE) {
+ $log.debug('angular-gestures: %s',
+ eventName);
+ }
+ $timeout(function() {
+ fn(scope, { $event : event });
+ }, 0);
+ };
+ hammertime.on(eventName, handler);
+ });
+ scope.$on('$destroy', function() {
+ hammertime.off(eventName, handler);
+ });
+ };
+ }]);
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/ng_base.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/ng_base.js
new file mode 100644
index 00000000..f864525c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/ng_base.js
@@ -0,0 +1,4 @@
+!function(a,b){function c(a){var b=a.length,c=kb.type(a);return kb.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||"function"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){var b=zb[a]={};return kb.each(a.match(mb)||[],function(a,c){b[c]=!0}),b}function e(a,c,d,e){if(kb.acceptData(a)){var f,g,h=kb.expando,i=a.nodeType,j=i?kb.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||d!==b||"string"!=typeof c)return k||(k=i?a[h]=bb.pop()||kb.guid++:h),j[k]||(j[k]=i?{}:{toJSON:kb.noop}),("object"==typeof c||"function"==typeof c)&&(e?j[k]=kb.extend(j[k],c):j[k].data=kb.extend(j[k].data,c)),g=j[k],e||(g.data||(g.data={}),g=g.data),d!==b&&(g[kb.camelCase(c)]=d),"string"==typeof c?(f=g[c],null==f&&(f=g[kb.camelCase(c)])):f=g,f}}function f(a,b,c){if(kb.acceptData(a)){var d,e,f=a.nodeType,g=f?kb.cache:a,i=f?a[kb.expando]:kb.expando;if(g[i]){if(b&&(d=c?g[i]:g[i].data)){kb.isArray(b)?b=b.concat(kb.map(b,kb.camelCase)):b in d?b=[b]:(b=kb.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;for(;e--;)delete d[b[e]];if(c?!h(d):!kb.isEmptyObject(d))return}(c||(delete g[i].data,h(g[i])))&&(f?kb.cleanData([a],!0):kb.support.deleteExpando||g!=g.window?delete g[i]:g[i]=null)}}}function g(a,c,d){if(d===b&&1===a.nodeType){var e="data-"+c.replace(Bb,"-$1").toLowerCase();if(d=a.getAttribute(e),"string"==typeof d){try{d="true"===d?!0:"false"===d?!1:"null"===d?null:+d+""===d?+d:Ab.test(d)?kb.parseJSON(d):d}catch(f){}kb.data(a,c,d)}else d=b}return d}function h(a){var b;for(b in a)if(("data"!==b||!kb.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function i(){return!0}function j(){return!1}function k(){try{return Y.activeElement}catch(a){}}function l(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}function m(a,b,c){if(kb.isFunction(b))return kb.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return kb.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(Qb.test(b))return kb.filter(b,a,c);b=kb.filter(b,a)}return kb.grep(a,function(a){return kb.inArray(a,b)>=0!==c})}function n(a){var b=Ub.split("|"),c=a.createDocumentFragment();if(c.createElement)for(;b.length;)c.createElement(b.pop());return c}function o(a,b){return kb.nodeName(a,"table")&&kb.nodeName(1===b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function p(a){return a.type=(null!==kb.find.attr(a,"type"))+"/"+a.type,a}function q(a){var b=ec.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function r(a,b){for(var c,d=0;null!=(c=a[d]);d++)kb._data(c,"globalEval",!b||kb._data(b[d],"globalEval"))}function s(a,b){if(1===b.nodeType&&kb.hasData(a)){var c,d,e,f=kb._data(a),g=kb._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)kb.event.add(b,c,h[c][d])}g.data&&(g.data=kb.extend({},g.data))}}function t(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!kb.support.noCloneEvent&&b[kb.expando]){e=kb._data(b);for(d in e.events)kb.removeEvent(b,d,e.handle);b.removeAttribute(kb.expando)}"script"===c&&b.text!==a.text?(p(b).text=a.text,q(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),kb.support.html5Clone&&a.innerHTML&&!kb.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&bc.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}function u(a,c){var d,e,f=0,g=typeof a.getElementsByTagName!==W?a.getElementsByTagName(c||"*"):typeof a.querySelectorAll!==W?a.querySelectorAll(c||"*"):b;if(!g)for(g=[],d=a.childNodes||a;null!=(e=d[f]);f++)!c||kb.nodeName(e,c)?g.push(e):kb.merge(g,u(e,c));return c===b||c&&kb.nodeName(a,c)?kb.merge([a],g):g}function v(a){bc.test(a.type)&&(a.defaultChecked=a.checked)}function w(a,b){if(b in a)return b;for(var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=yc.length;e--;)if(b=yc[e]+c,b in a)return b;return d}function x(a,b){return a=b||a,"none"===kb.css(a,"display")||!kb.contains(a.ownerDocument,a)}function y(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=kb._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&x(d)&&(f[g]=kb._data(d,"olddisplay",C(d.nodeName)))):f[g]||(e=x(d),(c&&"none"!==c||!e)&&kb._data(d,"olddisplay",e?c:kb.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function z(a,b,c){var d=rc.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function A(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=kb.css(a,c+xc[f],!0,e)),d?("content"===c&&(g-=kb.css(a,"padding"+xc[f],!0,e)),"margin"!==c&&(g-=kb.css(a,"border"+xc[f]+"Width",!0,e))):(g+=kb.css(a,"padding"+xc[f],!0,e),"padding"!==c&&(g+=kb.css(a,"border"+xc[f]+"Width",!0,e)));return g}function B(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=kc(a),g=kb.support.boxSizing&&"border-box"===kb.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=lc(a,b,f),(0>e||null==e)&&(e=a.style[b]),sc.test(e))return e;d=g&&(kb.support.boxSizingReliable||e===a.style[b]),e=parseFloat(e)||0}return e+A(a,b,c||(g?"border":"content"),d,f)+"px"}function C(a){var b=Y,c=uc[a];return c||(c=D(a,b),"none"!==c&&c||(jc=(jc||kb("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(b.documentElement),b=(jc[0].contentWindow||jc[0].contentDocument).document,b.write("<!doctype html><html><body>"),b.close(),c=D(a,b),jc.detach()),uc[a]=c),c}function D(a,b){var c=kb(b.createElement(a)).appendTo(b.body),d=kb.css(c[0],"display");return c.remove(),d}function E(a,b,c,d){var e;if(kb.isArray(b))kb.each(b,function(b,e){c||Ac.test(a)?d(a,e):E(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==kb.type(b))d(a,b);else for(e in b)E(a+"["+e+"]",b[e],c,d)}function F(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(mb)||[];if(kb.isFunction(c))for(;d=f[e++];)"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function G(a,b,c,d){function e(h){var i;return f[h]=!0,kb.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||g||f[j]?g?!(i=j):void 0:(b.dataTypes.unshift(j),e(j),!1)}),i}var f={},g=a===Rc;return e(b.dataTypes[0])||!f["*"]&&e("*")}function H(a,c){var d,e,f=kb.ajaxSettings.flatOptions||{};for(e in c)c[e]!==b&&((f[e]?a:d||(d={}))[e]=c[e]);return d&&kb.extend(!0,a,d),a}function I(a,c,d){for(var e,f,g,h,i=a.contents,j=a.dataTypes;"*"===j[0];)j.shift(),f===b&&(f=a.mimeType||c.getResponseHeader("Content-Type"));if(f)for(h in i)if(i[h]&&i[h].test(f)){j.unshift(h);break}if(j[0]in d)g=j[0];else{for(h in d){if(!j[0]||a.converters[h+" "+j[0]]){g=h;break}e||(e=h)}g=g||e}return g?(g!==j[0]&&j.unshift(g),d[g]):void 0}function J(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];for(f=k.shift();f;)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}function K(){try{return new a.XMLHttpRequest}catch(b){}}function L(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function M(){return setTimeout(function(){$c=b}),$c=kb.now()}function N(a,b,c){for(var d,e=(ed[b]||[]).concat(ed["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function O(a,b,c){var d,e,f=0,g=dd.length,h=kb.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$c||M(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:kb.extend({},b),opts:kb.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$c||M(),duration:c.duration,tweens:[],createTween:function(b,c){var d=kb.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(P(k,j.opts.specialEasing);g>f;f++)if(d=dd[f].call(j,a,k,j.opts))return d;return kb.map(k,N,j),kb.isFunction(j.opts.start)&&j.opts.start.call(a,j),kb.fx.timer(kb.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function P(a,b){var c,d,e,f,g;for(c in a)if(d=kb.camelCase(c),e=b[d],f=a[c],kb.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=kb.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Q(a,b,c){var d,e,f,g,h,i,j=this,k={},l=a.style,m=a.nodeType&&x(a),n=kb._data(a,"fxshow");c.queue||(h=kb._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,j.always(function(){j.always(function(){h.unqueued--,kb.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[l.overflow,l.overflowX,l.overflowY],"inline"===kb.css(a,"display")&&"none"===kb.css(a,"float")&&(kb.support.inlineBlockNeedsLayout&&"inline"!==C(a.nodeName)?l.zoom=1:l.display="inline-block")),c.overflow&&(l.overflow="hidden",kb.support.shrinkWrapBlocks||j.always(function(){l.overflow=c.overflow[0],l.overflowX=c.overflow[1],l.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ad.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(m?"hide":"show"))continue;k[d]=n&&n[d]||kb.style(a,d)}if(!kb.isEmptyObject(k)){n?"hidden"in n&&(m=n.hidden):n=kb._data(a,"fxshow",{}),f&&(n.hidden=!m),m?kb(a).show():j.done(function(){kb(a).hide()}),j.done(function(){var b;kb._removeData(a,"fxshow");for(b in k)kb.style(a,b,k[b])});for(d in k)g=N(m?n[d]:0,d,j),d in n||(n[d]=g.start,m&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function R(a,b,c,d,e){return new R.prototype.init(a,b,c,d,e)}function S(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=xc[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function T(a){return kb.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}var U,V,W=typeof b,X=a.location,Y=a.document,Z=Y.documentElement,$=a.jQuery,_=a.$,ab={},bb=[],cb="1.10.2",db=bb.concat,eb=bb.push,fb=bb.slice,gb=bb.indexOf,hb=ab.toString,ib=ab.hasOwnProperty,jb=cb.trim,kb=function(a,b){return new kb.fn.init(a,b,V)},lb=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,mb=/\S+/g,nb=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ob=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,pb=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,qb=/^[\],:{}\s]*$/,rb=/(?:^|:|,)(?:\s*\[)+/g,sb=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,tb=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,ub=/^-ms-/,vb=/-([\da-z])/gi,wb=function(a,b){return b.toUpperCase()},xb=function(a){(Y.addEventListener||"load"===a.type||"complete"===Y.readyState)&&(yb(),kb.ready())},yb=function(){Y.addEventListener?(Y.removeEventListener("DOMContentLoaded",xb,!1),a.removeEventListener("load",xb,!1)):(Y.detachEvent("onreadystatechange",xb),a.detachEvent("onload",xb))};kb.fn=kb.prototype={jquery:cb,constructor:kb,init:function(a,c,d){var e,f;if(!a)return this;if("string"==typeof a){if(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:ob.exec(a),!e||!e[1]&&c)return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a);if(e[1]){if(c=c instanceof kb?c[0]:c,kb.merge(this,kb.parseHTML(e[1],c&&c.nodeType?c.ownerDocument||c:Y,!0)),pb.test(e[1])&&kb.isPlainObject(c))for(e in c)kb.isFunction(this[e])?this[e](c[e]):this.attr(e,c[e]);return this}if(f=Y.getElementById(e[2]),f&&f.parentNode){if(f.id!==e[2])return d.find(a);this.length=1,this[0]=f}return this.context=Y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):kb.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),kb.makeArray(a,this))},selector:"",length:0,toArray:function(){return fb.call(this)},get:function(a){return null==a?this.toArray():0>a?this[this.length+a]:this[a]},pushStack:function(a){var b=kb.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return kb.each(this,a,b)},ready:function(a){return kb.ready.promise().done(a),this},slice:function(){return this.pushStack(fb.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},map:function(a){return this.pushStack(kb.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:eb,sort:[].sort,splice:[].splice},kb.fn.init.prototype=kb.fn,kb.extend=kb.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[1]||{},i=2),"object"==typeof h||kb.isFunction(h)||(h={}),j===i&&(h=this,--i);j>i;i++)if(null!=(f=arguments[i]))for(e in f)a=h[e],d=f[e],h!==d&&(k&&d&&(kb.isPlainObject(d)||(c=kb.isArray(d)))?(c?(c=!1,g=a&&kb.isArray(a)?a:[]):g=a&&kb.isPlainObject(a)?a:{},h[e]=kb.extend(k,g,d)):d!==b&&(h[e]=d));return h},kb.extend({expando:"jQuery"+(cb+Math.random()).replace(/\D/g,""),noConflict:function(b){return a.$===kb&&(a.$=_),b&&a.jQuery===kb&&(a.jQuery=$),kb},isReady:!1,readyWait:1,holdReady:function(a){a?kb.readyWait++:kb.ready(!0)},ready:function(a){if(a===!0?!--kb.readyWait:!kb.isReady){if(!Y.body)return setTimeout(kb.ready);kb.isReady=!0,a!==!0&&--kb.readyWait>0||(U.resolveWith(Y,[kb]),kb.fn.trigger&&kb(Y).trigger("ready").off("ready"))}},isFunction:function(a){return"function"===kb.type(a)},isArray:Array.isArray||function(a){return"array"===kb.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return null==a?String(a):"object"==typeof a||"function"==typeof a?ab[hb.call(a)]||"object":typeof a},isPlainObject:function(a){var c;if(!a||"object"!==kb.type(a)||a.nodeType||kb.isWindow(a))return!1;try{if(a.constructor&&!ib.call(a,"constructor")&&!ib.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(d){return!1}if(kb.support.ownLast)for(c in a)return ib.call(a,c);for(c in a);return c===b||ib.call(a,c)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||Y;var d=pb.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=kb.buildFragment([a],b,e),e&&kb(e).remove(),kb.merge([],d.childNodes))},parseJSON:function(b){return a.JSON&&a.JSON.parse?a.JSON.parse(b):null===b?b:"string"==typeof b&&(b=kb.trim(b),b&&qb.test(b.replace(sb,"@").replace(tb,"]").replace(rb,"")))?new Function("return "+b)():void kb.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||"string"!=typeof c)return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return d&&d.documentElement&&!d.getElementsByTagName("parsererror").length||kb.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&kb.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(ub,"ms-").replace(vb,wb)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,d){var e,f=0,g=a.length,h=c(a);if(d){if(h)for(;g>f&&(e=b.apply(a[f],d),e!==!1);f++);else for(f in a)if(e=b.apply(a[f],d),e===!1)break}else if(h)for(;g>f&&(e=b.call(a[f],f,a[f]),e!==!1);f++);else for(f in a)if(e=b.call(a[f],f,a[f]),e===!1)break;return a},trim:jb&&!jb.call(" ")?function(a){return null==a?"":jb.call(a)}:function(a){return null==a?"":(a+"").replace(nb,"")},makeArray:function(a,b){var d=b||[];return null!=a&&(c(Object(a))?kb.merge(d,"string"==typeof a?[a]:a):eb.call(d,a)),d},inArray:function(a,b,c){var d;if(b){if(gb)return gb.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if("number"==typeof d)for(;d>f;f++)a[e++]=c[f];else for(;c[f]!==b;)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;for(c=!!c;g>f;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,b,d){var e,f=0,g=a.length,h=c(a),i=[];if(h)for(;g>f;f++)e=b(a[f],f,d),null!=e&&(i[i.length]=e);else for(f in a)e=b(a[f],f,d),null!=e&&(i[i.length]=e);return db.apply([],i)},guid:1,proxy:function(a,c){var d,e,f;return"string"==typeof c&&(f=a[c],c=a,a=f),kb.isFunction(a)?(d=fb.call(arguments,2),e=function(){return a.apply(c||this,d.concat(fb.call(arguments)))},e.guid=a.guid=a.guid||kb.guid++,e):b},access:function(a,c,d,e,f,g,h){var i=0,j=a.length,k=null==d;if("object"===kb.type(d)){f=!0;for(i in d)kb.access(a,c,i,d[i],!0,g,h)}else if(e!==b&&(f=!0,kb.isFunction(e)||(h=!0),k&&(h?(c.call(a,e),c=null):(k=c,c=function(a,b,c){return k.call(kb(a),c)})),c))for(;j>i;i++)c(a[i],d,h?e:e.call(a[i],i,c(a[i],d)));return f?a:k?c.call(a):j?c(a[0],d):g},now:function(){return(new Date).getTime()},swap:function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e}}),kb.ready.promise=function(b){if(!U)if(U=kb.Deferred(),"complete"===Y.readyState)setTimeout(kb.ready);else if(Y.addEventListener)Y.addEventListener("DOMContentLoaded",xb,!1),a.addEventListener("load",xb,!1);else{Y.attachEvent("onreadystatechange",xb),a.attachEvent("onload",xb);var c=!1;try{c=null==a.frameElement&&Y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!kb.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}yb(),kb.ready()}}()}return U.promise(b)},kb.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){ab["[object "+b+"]"]=b.toLowerCase()}),V=kb(Y),function(a,b){function c(a,b,c,d){var e,f,g,h,i,j,k,l,o,p;if((b?b.ownerDocument||b:O)!==G&&F(b),b=b||G,c=c||[],!a||"string"!=typeof a)return c;if(1!==(h=b.nodeType)&&9!==h)return[];if(I&&!d){if(e=tb.exec(a))if(g=e[1]){if(9===h){if(f=b.getElementById(g),!f||!f.parentNode)return c;if(f.id===g)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(g))&&M(b,f)&&f.id===g)return c.push(f),c}else{if(e[2])return ab.apply(c,b.getElementsByTagName(a)),c;if((g=e[3])&&x.getElementsByClassName&&b.getElementsByClassName)return ab.apply(c,b.getElementsByClassName(g)),c}if(x.qsa&&(!J||!J.test(a))){if(l=k=N,o=b,p=9===h&&a,1===h&&"object"!==b.nodeName.toLowerCase()){for(j=m(a),(k=b.getAttribute("id"))?l=k.replace(wb,"\\$&"):b.setAttribute("id",l),l="[id='"+l+"'] ",i=j.length;i--;)j[i]=l+n(j[i]);o=nb.test(a)&&b.parentNode||b,p=j.join(",")}if(p)try{return ab.apply(c,o.querySelectorAll(p)),c}catch(q){}finally{k||b.removeAttribute("id")}}}return v(a.replace(jb,"$1"),b,c,d)}function d(){function a(c,d){return b.push(c+=" ")>z.cacheLength&&delete a[b.shift()],a[c]=d}var b=[];return a}function e(a){return a[N]=!0,a}function f(a){var b=G.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function g(a,b){for(var c=a.split("|"),d=a.length;d--;)z.attrHandle[c[d]]=b}function h(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||X)-(~a.sourceIndex||X);if(d)return d;if(c)for(;c=c.nextSibling;)if(c===b)return-1;return a?1:-1}function i(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function j(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function k(a){return e(function(b){return b=+b,e(function(c,d){for(var e,f=a([],c.length,b),g=f.length;g--;)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function l(){}function m(a,b){var d,e,f,g,h,i,j,k=S[a+" "];if(k)return b?0:k.slice(0);for(h=a,i=[],j=z.preFilter;h;){(!d||(e=lb.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),d=!1,(e=mb.exec(h))&&(d=e.shift(),f.push({value:d,type:e[0].replace(jb," ")}),h=h.slice(d.length));for(g in z.filter)!(e=rb[g].exec(h))||j[g]&&!(e=j[g](e))||(d=e.shift(),f.push({value:d,type:g,matches:e}),h=h.slice(d.length));if(!d)break}return b?h.length:h?c.error(a):S(a,i).slice(0)}function n(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function o(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=Q++;return b.first?function(b,c,f){for(;b=b[d];)if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=P+" "+f;if(g){for(;b=b[d];)if((1===b.nodeType||e)&&a(b,c,g))return!0}else for(;b=b[d];)if(1===b.nodeType||e)if(j=b[N]||(b[N]={}),(i=j[d])&&i[0]===k){if((h=i[1])===!0||h===y)return h===!0}else if(i=j[d]=[k],i[1]=a(b,c,g)||y,i[1]===!0)return!0}}function p(a){return a.length>1?function(b,c,d){for(var e=a.length;e--;)if(!a[e](b,c,d))return!1;return!0}:a[0]}function q(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function r(a,b,c,d,f,g){return d&&!d[N]&&(d=r(d)),f&&!f[N]&&(f=r(f,g)),e(function(e,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=e||u(b||"*",h.nodeType?[h]:h,[]),r=!a||!e&&b?p:q(p,m,a,h,i),s=c?f||(e?a:o||d)?[]:g:r;if(c&&c(r,s,h,i),d)for(j=q(s,n),d(j,[],h,i),k=j.length;k--;)(l=j[k])&&(s[n[k]]=!(r[n[k]]=l));if(e){if(f||a){if(f){for(j=[],k=s.length;k--;)(l=s[k])&&j.push(r[k]=l);f(null,s=[],j,i)}for(k=s.length;k--;)(l=s[k])&&(j=f?cb.call(e,l):m[k])>-1&&(e[j]=!(g[j]=l))}}else s=q(s===g?s.splice(o,s.length):s),f?f(null,g,s,i):ab.apply(g,s)})}function s(a){for(var b,c,d,e=a.length,f=z.relative[a[0].type],g=f||z.relative[" "],h=f?1:0,i=o(function(a){return a===b},g,!0),j=o(function(a){return cb.call(b,a)>-1},g,!0),k=[function(a,c,d){return!f&&(d||c!==D)||((b=c).nodeType?i(a,c,d):j(a,c,d))}];e>h;h++)if(c=z.relative[a[h].type])k=[o(p(k),c)];else{if(c=z.filter[a[h].type].apply(null,a[h].matches),c[N]){for(d=++h;e>d&&!z.relative[a[d].type];d++);return r(h>1&&p(k),h>1&&n(a.slice(0,h-1).concat({value:" "===a[h-2].type?"*":""})).replace(jb,"$1"),c,d>h&&s(a.slice(h,d)),e>d&&s(a=a.slice(d)),e>d&&n(a))}k.push(c)}return p(k)}function t(a,b){var d=0,f=b.length>0,g=a.length>0,h=function(e,h,i,j,k){var l,m,n,o=[],p=0,r="0",s=e&&[],t=null!=k,u=D,v=e||g&&z.find.TAG("*",k&&h.parentNode||h),w=P+=null==u?1:Math.random()||.1;for(t&&(D=h!==G&&h,y=d);null!=(l=v[r]);r++){if(g&&l){for(m=0;n=a[m++];)if(n(l,h,i)){j.push(l);break}t&&(P=w,y=++d)}f&&((l=!n&&l)&&p--,e&&s.push(l))}if(p+=r,f&&r!==p){for(m=0;n=b[m++];)n(s,o,h,i);if(e){if(p>0)for(;r--;)s[r]||o[r]||(o[r]=$.call(j));o=q(o)}ab.apply(j,o),t&&!e&&o.length>0&&p+b.length>1&&c.uniqueSort(j)}return t&&(P=w,D=u),s};return f?e(h):h}function u(a,b,d){for(var e=0,f=b.length;f>e;e++)c(a,b[e],d);return d}function v(a,b,c,d){var e,f,g,h,i,j=m(a);if(!d&&1===j.length){if(f=j[0]=j[0].slice(0),f.length>2&&"ID"===(g=f[0]).type&&x.getById&&9===b.nodeType&&I&&z.relative[f[1].type]){if(b=(z.find.ID(g.matches[0].replace(xb,yb),b)||[])[0],!b)return c;a=a.slice(f.shift().value.length)}for(e=rb.needsContext.test(a)?0:f.length;e--&&(g=f[e],!z.relative[h=g.type]);)if((i=z.find[h])&&(d=i(g.matches[0].replace(xb,yb),nb.test(f[0].type)&&b.parentNode||b))){if(f.splice(e,1),a=d.length&&n(f),!a)return ab.apply(c,d),c;break}}return C(a,j)(d,b,!I,c,nb.test(a)),c}var w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N="sizzle"+-new Date,O=a.document,P=0,Q=0,R=d(),S=d(),T=d(),U=!1,V=function(a,b){return a===b?(U=!0,0):0},W=typeof b,X=1<<31,Y={}.hasOwnProperty,Z=[],$=Z.pop,_=Z.push,ab=Z.push,bb=Z.slice,cb=Z.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},db="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",eb="[\\x20\\t\\r\\n\\f]",fb="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",gb=fb.replace("w","w#"),hb="\\["+eb+"*("+fb+")"+eb+"*(?:([*^$|!~]?=)"+eb+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+gb+")|)|)"+eb+"*\\]",ib=":("+fb+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+hb.replace(3,8)+")*)|.*)\\)|)",jb=new RegExp("^"+eb+"+|((?:^|[^\\\\])(?:\\\\.)*)"+eb+"+$","g"),lb=new RegExp("^"+eb+"*,"+eb+"*"),mb=new RegExp("^"+eb+"*([>+~]|"+eb+")"+eb+"*"),nb=new RegExp(eb+"*[+~]"),ob=new RegExp("="+eb+"*([^\\]'\"]*)"+eb+"*\\]","g"),pb=new RegExp(ib),qb=new RegExp("^"+gb+"$"),rb={ID:new RegExp("^#("+fb+")"),CLASS:new RegExp("^\\.("+fb+")"),TAG:new RegExp("^("+fb.replace("w","w*")+")"),ATTR:new RegExp("^"+hb),PSEUDO:new RegExp("^"+ib),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+eb+"*(even|odd|(([+-]|)(\\d*)n|)"+eb+"*(?:([+-]|)"+eb+"*(\\d+)|))"+eb+"*\\)|)","i"),bool:new RegExp("^(?:"+db+")$","i"),needsContext:new RegExp("^"+eb+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+eb+"*((?:-\\d)?\\d*)"+eb+"*\\)|)(?=[^-]|$)","i")},sb=/^[^{]+\{\s*\[native \w/,tb=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ub=/^(?:input|select|textarea|button)$/i,vb=/^h\d$/i,wb=/'|\\/g,xb=new RegExp("\\\\([\\da-f]{1,6}"+eb+"?|("+eb+")|.)","ig"),yb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{ab.apply(Z=bb.call(O.childNodes),O.childNodes),Z[O.childNodes.length].nodeType}catch(zb){ab={apply:Z.length?function(a,b){_.apply(a,bb.call(b))}:function(a,b){for(var c=a.length,d=0;a[c++]=b[d++];);a.length=c-1}}}B=c.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},x=c.support={},F=c.setDocument=function(a){var b=a?a.ownerDocument||a:O,c=b.defaultView;return b!==G&&9===b.nodeType&&b.documentElement?(G=b,H=b.documentElement,I=!B(b),c&&c.attachEvent&&c!==c.top&&c.attachEvent("onbeforeunload",function(){F()}),x.attributes=f(function(a){return a.className="i",!a.getAttribute("className")}),x.getElementsByTagName=f(function(a){return a.appendChild(b.createComment("")),!a.getElementsByTagName("*").length}),x.getElementsByClassName=f(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),x.getById=f(function(a){return H.appendChild(a).id=N,!b.getElementsByName||!b.getElementsByName(N).length}),x.getById?(z.find.ID=function(a,b){if(typeof b.getElementById!==W&&I){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},z.filter.ID=function(a){var b=a.replace(xb,yb);return function(a){return a.getAttribute("id")===b}}):(delete z.find.ID,z.filter.ID=function(a){var b=a.replace(xb,yb);return function(a){var c=typeof a.getAttributeNode!==W&&a.getAttributeNode("id");return c&&c.value===b}}),z.find.TAG=x.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==W?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){for(;c=f[e++];)1===c.nodeType&&d.push(c);return d}return f},z.find.CLASS=x.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==W&&I?b.getElementsByClassName(a):void 0},K=[],J=[],(x.qsa=sb.test(b.querySelectorAll))&&(f(function(a){a.innerHTML="<select><option selected=''></option></select>",a.querySelectorAll("[selected]").length||J.push("\\["+eb+"*(?:value|"+db+")"),a.querySelectorAll(":checked").length||J.push(":checked")}),f(function(a){var c=b.createElement("input");c.setAttribute("type","hidden"),a.appendChild(c).setAttribute("t",""),a.querySelectorAll("[t^='']").length&&J.push("[*^$]="+eb+"*(?:''|\"\")"),a.querySelectorAll(":enabled").length||J.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),J.push(",.*:")})),(x.matchesSelector=sb.test(L=H.webkitMatchesSelector||H.mozMatchesSelector||H.oMatchesSelector||H.msMatchesSelector))&&f(function(a){x.disconnectedMatch=L.call(a,"div"),L.call(a,"[s!='']:x"),K.push("!=",ib)}),J=J.length&&new RegExp(J.join("|")),K=K.length&&new RegExp(K.join("|")),M=sb.test(H.contains)||H.compareDocumentPosition?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)for(;b=b.parentNode;)if(b===a)return!0;return!1},V=H.compareDocumentPosition?function(a,c){if(a===c)return U=!0,0;var d=c.compareDocumentPosition&&a.compareDocumentPosition&&a.compareDocumentPosition(c);return d?1&d||!x.sortDetached&&c.compareDocumentPosition(a)===d?a===b||M(O,a)?-1:c===b||M(O,c)?1:E?cb.call(E,a)-cb.call(E,c):0:4&d?-1:1:a.compareDocumentPosition?-1:1}:function(a,c){var d,e=0,f=a.parentNode,g=c.parentNode,i=[a],j=[c];if(a===c)return U=!0,0;if(!f||!g)return a===b?-1:c===b?1:f?-1:g?1:E?cb.call(E,a)-cb.call(E,c):0;if(f===g)return h(a,c);for(d=a;d=d.parentNode;)i.unshift(d);for(d=c;d=d.parentNode;)j.unshift(d);for(;i[e]===j[e];)e++;return e?h(i[e],j[e]):i[e]===O?-1:j[e]===O?1:0},b):G},c.matches=function(a,b){return c(a,null,null,b)},c.matchesSelector=function(a,b){if((a.ownerDocument||a)!==G&&F(a),b=b.replace(ob,"='$1']"),!(!x.matchesSelector||!I||K&&K.test(b)||J&&J.test(b)))try{var d=L.call(a,b);if(d||x.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return c(b,G,null,[a]).length>0},c.contains=function(a,b){return(a.ownerDocument||a)!==G&&F(a),M(a,b)},c.attr=function(a,c){(a.ownerDocument||a)!==G&&F(a);var d=z.attrHandle[c.toLowerCase()],e=d&&Y.call(z.attrHandle,c.toLowerCase())?d(a,c,!I):b;return e===b?x.attributes||!I?a.getAttribute(c):(e=a.getAttributeNode(c))&&e.specified?e.value:null:e},c.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},c.uniqueSort=function(a){var b,c=[],d=0,e=0;if(U=!x.detectDuplicates,E=!x.sortStable&&a.slice(0),a.sort(V),U){for(;b=a[e++];)b===a[e]&&(d=c.push(e));for(;d--;)a.splice(c[d],1)}return a},A=c.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(1===e||9===e||11===e){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=A(a)}else if(3===e||4===e)return a.nodeValue}else for(;b=a[d];d++)c+=A(b);return c},z=c.selectors={cacheLength:50,createPseudo:e,match:rb,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(xb,yb),a[3]=(a[4]||a[5]||"").replace(xb,yb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||c.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&c.error(a[0]),a},PSEUDO:function(a){var c,d=!a[5]&&a[2];return rb.CHILD.test(a[0])?null:(a[3]&&a[4]!==b?a[2]=a[4]:d&&pb.test(d)&&(c=m(d,!0))&&(c=d.indexOf(")",d.length-c)-d.length)&&(a[0]=a[0].slice(0,c),a[2]=d.slice(0,c)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(xb,yb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=R[a+" "];return b||(b=new RegExp("(^|"+eb+")"+a+"("+eb+"|$)"))&&R(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==W&&a.getAttribute("class")||"")})},ATTR:function(a,b,d){return function(e){var f=c.attr(e,a);return null==f?"!="===b:b?(f+="","="===b?f===d:"!="===b?f!==d:"^="===b?d&&0===f.indexOf(d):"*="===b?d&&f.indexOf(d)>-1:"$="===b?d&&f.slice(-d.length)===d:"~="===b?(" "+f+" ").indexOf(d)>-1:"|="===b?f===d||f.slice(0,d.length+1)===d+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;
+return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){for(;p;){for(l=b;l=l[p];)if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){for(k=q[N]||(q[N]={}),j=k[a]||[],n=j[0]===P&&j[1],m=j[0]===P&&j[2],l=n&&q.childNodes[n];l=++n&&l&&l[p]||(m=n=0)||o.pop();)if(1===l.nodeType&&++m&&l===b){k[a]=[P,n,m];break}}else if(s&&(j=(b[N]||(b[N]={}))[a])&&j[0]===P)m=j[1];else for(;(l=++n&&l&&l[p]||(m=n=0)||o.pop())&&((h?l.nodeName.toLowerCase()!==r:1!==l.nodeType)||!++m||(s&&((l[N]||(l[N]={}))[a]=[P,m]),l!==b)););return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var d,f=z.pseudos[a]||z.setFilters[a.toLowerCase()]||c.error("unsupported pseudo: "+a);return f[N]?f(b):f.length>1?(d=[a,a,"",b],z.setFilters.hasOwnProperty(a.toLowerCase())?e(function(a,c){for(var d,e=f(a,b),g=e.length;g--;)d=cb.call(a,e[g]),a[d]=!(c[d]=e[g])}):function(a){return f(a,0,d)}):f}},pseudos:{not:e(function(a){var b=[],c=[],d=C(a.replace(jb,"$1"));return d[N]?e(function(a,b,c,e){for(var f,g=d(a,null,e,[]),h=a.length;h--;)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:e(function(a){return function(b){return c(a,b).length>0}}),contains:e(function(a){return function(b){return(b.textContent||b.innerText||A(b)).indexOf(a)>-1}}),lang:e(function(a){return qb.test(a||"")||c.error("unsupported lang: "+a),a=a.replace(xb,yb).toLowerCase(),function(b){var c;do if(c=I?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===H},focus:function(a){return a===G.activeElement&&(!G.hasFocus||G.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeName>"@"||3===a.nodeType||4===a.nodeType)return!1;return!0},parent:function(a){return!z.pseudos.empty(a)},header:function(a){return vb.test(a.nodeName)},input:function(a){return ub.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||b.toLowerCase()===a.type)},first:k(function(){return[0]}),last:k(function(a,b){return[b-1]}),eq:k(function(a,b,c){return[0>c?c+b:c]}),even:k(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:k(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:k(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:k(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},z.pseudos.nth=z.pseudos.eq;for(w in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})z.pseudos[w]=i(w);for(w in{submit:!0,reset:!0})z.pseudos[w]=j(w);l.prototype=z.filters=z.pseudos,z.setFilters=new l,C=c.compile=function(a,b){var c,d=[],e=[],f=T[a+" "];if(!f){for(b||(b=m(a)),c=b.length;c--;)f=s(b[c]),f[N]?d.push(f):e.push(f);f=T(a,t(e,d))}return f},x.sortStable=N.split("").sort(V).join("")===N,x.detectDuplicates=U,F(),x.sortDetached=f(function(a){return 1&a.compareDocumentPosition(G.createElement("div"))}),f(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||g("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),x.attributes&&f(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||g("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),f(function(a){return null==a.getAttribute("disabled")})||g(db,function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&d.specified?d.value:a[b]===!0?b.toLowerCase():null}),kb.find=c,kb.expr=c.selectors,kb.expr[":"]=kb.expr.pseudos,kb.unique=c.uniqueSort,kb.text=c.getText,kb.isXMLDoc=c.isXML,kb.contains=c.contains}(a);var zb={};kb.Callbacks=function(a){a="string"==typeof a?zb[a]||d(a):kb.extend({},a);var c,e,f,g,h,i,j=[],k=!a.once&&[],l=function(b){for(e=a.memory&&b,f=!0,h=i||0,i=0,g=j.length,c=!0;j&&g>h;h++)if(j[h].apply(b[0],b[1])===!1&&a.stopOnFalse){e=!1;break}c=!1,j&&(k?k.length&&l(k.shift()):e?j=[]:m.disable())},m={add:function(){if(j){var b=j.length;!function d(b){kb.each(b,function(b,c){var e=kb.type(c);"function"===e?a.unique&&m.has(c)||j.push(c):c&&c.length&&"string"!==e&&d(c)})}(arguments),c?g=j.length:e&&(i=b,l(e))}return this},remove:function(){return j&&kb.each(arguments,function(a,b){for(var d;(d=kb.inArray(b,j,d))>-1;)j.splice(d,1),c&&(g>=d&&g--,h>=d&&h--)}),this},has:function(a){return a?kb.inArray(a,j)>-1:!(!j||!j.length)},empty:function(){return j=[],g=0,this},disable:function(){return j=k=e=b,this},disabled:function(){return!j},lock:function(){return k=b,e||m.disable(),this},locked:function(){return!k},fireWith:function(a,b){return!j||f&&!k||(b=b||[],b=[a,b.slice?b.slice():b],c?k.push(b):l(b)),this},fire:function(){return m.fireWith(this,arguments),this},fired:function(){return!!f}};return m},kb.extend({Deferred:function(a){var b=[["resolve","done",kb.Callbacks("once memory"),"resolved"],["reject","fail",kb.Callbacks("once memory"),"rejected"],["notify","progress",kb.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return kb.Deferred(function(c){kb.each(b,function(b,f){var g=f[0],h=kb.isFunction(a[b])&&a[b];e[f[1]](function(){var a=h&&h.apply(this,arguments);a&&kb.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[g+"With"](this===d?c.promise():this,h?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?kb.extend(a,d):d}},e={};return d.pipe=d.then,kb.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b,c,d,e=0,f=fb.call(arguments),g=f.length,h=1!==g||a&&kb.isFunction(a.promise)?g:0,i=1===h?a:kb.Deferred(),j=function(a,c,d){return function(e){c[a]=this,d[a]=arguments.length>1?fb.call(arguments):e,d===b?i.notifyWith(c,d):--h||i.resolveWith(c,d)}};if(g>1)for(b=new Array(g),c=new Array(g),d=new Array(g);g>e;e++)f[e]&&kb.isFunction(f[e].promise)?f[e].promise().done(j(e,d,f)).fail(i.reject).progress(j(e,c,b)):--h;return h||i.resolveWith(d,f),i.promise()}}),kb.support=function(b){var c,d,e,f,g,h,i,j,k,l=Y.createElement("div");if(l.setAttribute("className","t"),l.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=l.getElementsByTagName("*")||[],d=l.getElementsByTagName("a")[0],!d||!d.style||!c.length)return b;f=Y.createElement("select"),h=f.appendChild(Y.createElement("option")),e=l.getElementsByTagName("input")[0],d.style.cssText="top:1px;float:left;opacity:.5",b.getSetAttribute="t"!==l.className,b.leadingWhitespace=3===l.firstChild.nodeType,b.tbody=!l.getElementsByTagName("tbody").length,b.htmlSerialize=!!l.getElementsByTagName("link").length,b.style=/top/.test(d.getAttribute("style")),b.hrefNormalized="/a"===d.getAttribute("href"),b.opacity=/^0.5/.test(d.style.opacity),b.cssFloat=!!d.style.cssFloat,b.checkOn=!!e.value,b.optSelected=h.selected,b.enctype=!!Y.createElement("form").enctype,b.html5Clone="<:nav></:nav>"!==Y.createElement("nav").cloneNode(!0).outerHTML,b.inlineBlockNeedsLayout=!1,b.shrinkWrapBlocks=!1,b.pixelPosition=!1,b.deleteExpando=!0,b.noCloneEvent=!0,b.reliableMarginRight=!0,b.boxSizingReliable=!0,e.checked=!0,b.noCloneChecked=e.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!h.disabled;try{delete l.test}catch(m){b.deleteExpando=!1}e=Y.createElement("input"),e.setAttribute("value",""),b.input=""===e.getAttribute("value"),e.value="t",e.setAttribute("type","radio"),b.radioValue="t"===e.value,e.setAttribute("checked","t"),e.setAttribute("name","t"),g=Y.createDocumentFragment(),g.appendChild(e),b.appendChecked=e.checked,b.checkClone=g.cloneNode(!0).cloneNode(!0).lastChild.checked,l.attachEvent&&(l.attachEvent("onclick",function(){b.noCloneEvent=!1}),l.cloneNode(!0).click());for(k in{submit:!0,change:!0,focusin:!0})l.setAttribute(i="on"+k,"t"),b[k+"Bubbles"]=i in a||l.attributes[i].expando===!1;l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",b.clearCloneStyle="content-box"===l.style.backgroundClip;for(k in kb(b))break;return b.ownLast="0"!==k,kb(function(){var c,d,e,f="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",g=Y.getElementsByTagName("body")[0];g&&(c=Y.createElement("div"),c.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",g.appendChild(c).appendChild(l),l.innerHTML="<table><tr><td></td><td>t</td></tr></table>",e=l.getElementsByTagName("td"),e[0].style.cssText="padding:0;margin:0;border:0;display:none",j=0===e[0].offsetHeight,e[0].style.display="",e[1].style.display="none",b.reliableHiddenOffsets=j&&0===e[0].offsetHeight,l.innerHTML="",l.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",kb.swap(g,null!=g.style.zoom?{zoom:1}:{},function(){b.boxSizing=4===l.offsetWidth}),a.getComputedStyle&&(b.pixelPosition="1%"!==(a.getComputedStyle(l,null)||{}).top,b.boxSizingReliable="4px"===(a.getComputedStyle(l,null)||{width:"4px"}).width,d=l.appendChild(Y.createElement("div")),d.style.cssText=l.style.cssText=f,d.style.marginRight=d.style.width="0",l.style.width="1px",b.reliableMarginRight=!parseFloat((a.getComputedStyle(d,null)||{}).marginRight)),typeof l.style.zoom!==W&&(l.innerHTML="",l.style.cssText=f+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=3===l.offsetWidth,l.style.display="block",l.innerHTML="<div></div>",l.firstChild.style.width="5px",b.shrinkWrapBlocks=3!==l.offsetWidth,b.inlineBlockNeedsLayout&&(g.style.zoom=1)),g.removeChild(c),c=l=e=d=null)}),c=f=g=h=d=e=null,b}({});var Ab=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,Bb=/([A-Z])/g;kb.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?kb.cache[a[kb.expando]]:a[kb.expando],!!a&&!h(a)},data:function(a,b,c){return e(a,b,c)},removeData:function(a,b){return f(a,b)},_data:function(a,b,c){return e(a,b,c,!0)},_removeData:function(a,b){return f(a,b,!0)},acceptData:function(a){if(a.nodeType&&1!==a.nodeType&&9!==a.nodeType)return!1;var b=a.nodeName&&kb.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),kb.fn.extend({data:function(a,c){var d,e,f=null,h=0,i=this[0];if(a===b){if(this.length&&(f=kb.data(i),1===i.nodeType&&!kb._data(i,"parsedAttrs"))){for(d=i.attributes;h<d.length;h++)e=d[h].name,0===e.indexOf("data-")&&(e=kb.camelCase(e.slice(5)),g(i,e,f[e]));kb._data(i,"parsedAttrs",!0)}return f}return"object"==typeof a?this.each(function(){kb.data(this,a)}):arguments.length>1?this.each(function(){kb.data(this,a,c)}):i?g(i,a,kb.data(i,a)):null},removeData:function(a){return this.each(function(){kb.removeData(this,a)})}}),kb.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=kb._data(a,b),c&&(!d||kb.isArray(c)?d=kb._data(a,b,kb.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=kb.queue(a,b),d=c.length,e=c.shift(),f=kb._queueHooks(a,b),g=function(){kb.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return kb._data(a,c)||kb._data(a,c,{empty:kb.Callbacks("once memory").add(function(){kb._removeData(a,b+"queue"),kb._removeData(a,c)})})}}),kb.fn.extend({queue:function(a,c){var d=2;return"string"!=typeof a&&(c=a,a="fx",d--),arguments.length<d?kb.queue(this[0],a):c===b?this:this.each(function(){var b=kb.queue(this,a,c);kb._queueHooks(this,a),"fx"===a&&"inprogress"!==b[0]&&kb.dequeue(this,a)})},dequeue:function(a){return this.each(function(){kb.dequeue(this,a)})},delay:function(a,b){return a=kb.fx?kb.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=kb.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};for("string"!=typeof a&&(c=a,a=b),a=a||"fx";h--;)d=kb._data(g[h],a+"queueHooks"),d&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var Cb,Db,Eb=/[\t\r\n\f]/g,Fb=/\r/g,Gb=/^(?:input|select|textarea|button|object)$/i,Hb=/^(?:a|area)$/i,Ib=/^(?:checked|selected)$/i,Jb=kb.support.getSetAttribute,Kb=kb.support.input;kb.fn.extend({attr:function(a,b){return kb.access(this,kb.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){kb.removeAttr(this,a)})},prop:function(a,b){return kb.access(this,kb.prop,a,b,arguments.length>1)},removeProp:function(a){return a=kb.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g=0,h=this.length,i="string"==typeof a&&a;if(kb.isFunction(a))return this.each(function(b){kb(this).addClass(a.call(this,b,this.className))});if(i)for(b=(a||"").match(mb)||[];h>g;g++)if(c=this[g],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(Eb," "):" ")){for(f=0;e=b[f++];)d.indexOf(" "+e+" ")<0&&(d+=e+" ");c.className=kb.trim(d)}return this},removeClass:function(a){var b,c,d,e,f,g=0,h=this.length,i=0===arguments.length||"string"==typeof a&&a;if(kb.isFunction(a))return this.each(function(b){kb(this).removeClass(a.call(this,b,this.className))});if(i)for(b=(a||"").match(mb)||[];h>g;g++)if(c=this[g],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(Eb," "):"")){for(f=0;e=b[f++];)for(;d.indexOf(" "+e+" ")>=0;)d=d.replace(" "+e+" "," ");c.className=a?kb.trim(d):""}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(kb.isFunction(a)?function(c){kb(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c)for(var b,d=0,e=kb(this),f=a.match(mb)||[];b=f[d++];)e.hasClass(b)?e.removeClass(b):e.addClass(b);else(c===W||"boolean"===c)&&(this.className&&kb._data(this,"__className__",this.className),this.className=this.className||a===!1?"":kb._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(Eb," ").indexOf(b)>=0)return!0;return!1},val:function(a){var c,d,e,f=this[0];{if(arguments.length)return e=kb.isFunction(a),this.each(function(c){var f;1===this.nodeType&&(f=e?a.call(this,c,kb(this).val()):a,null==f?f="":"number"==typeof f?f+="":kb.isArray(f)&&(f=kb.map(f,function(a){return null==a?"":a+""})),d=kb.valHooks[this.type]||kb.valHooks[this.nodeName.toLowerCase()],d&&"set"in d&&d.set(this,f,"value")!==b||(this.value=f))});if(f)return d=kb.valHooks[f.type]||kb.valHooks[f.nodeName.toLowerCase()],d&&"get"in d&&(c=d.get(f,"value"))!==b?c:(c=f.value,"string"==typeof c?c.replace(Fb,""):null==c?"":c)}}}),kb.extend({valHooks:{option:{get:function(a){var b=kb.find.attr(a,"value");return null!=b?b:a.text}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(kb.support.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&kb.nodeName(c.parentNode,"optgroup"))){if(b=kb(c).val(),f)return b;g.push(b)}return g},set:function(a,b){for(var c,d,e=a.options,f=kb.makeArray(b),g=e.length;g--;)d=e[g],(d.selected=kb.inArray(kb(d).val(),f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}},attr:function(a,c,d){var e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return typeof a.getAttribute===W?kb.prop(a,c,d):(1===g&&kb.isXMLDoc(a)||(c=c.toLowerCase(),e=kb.attrHooks[c]||(kb.expr.match.bool.test(c)?Db:Cb)),d===b?e&&"get"in e&&null!==(f=e.get(a,c))?f:(f=kb.find.attr(a,c),null==f?b:f):null!==d?e&&"set"in e&&(f=e.set(a,d,c))!==b?f:(a.setAttribute(c,d+""),d):void kb.removeAttr(a,c))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(mb);if(f&&1===a.nodeType)for(;c=f[e++];)d=kb.propFix[c]||c,kb.expr.match.bool.test(c)?Kb&&Jb||!Ib.test(c)?a[d]=!1:a[kb.camelCase("default-"+c)]=a[d]=!1:kb.attr(a,c,""),a.removeAttribute(Jb?c:d)},attrHooks:{type:{set:function(a,b){if(!kb.support.radioValue&&"radio"===b&&kb.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(a&&3!==h&&8!==h&&2!==h)return g=1!==h||!kb.isXMLDoc(a),g&&(c=kb.propFix[c]||c,f=kb.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&null!==(e=f.get(a,c))?e:a[c]},propHooks:{tabIndex:{get:function(a){var b=kb.find.attr(a,"tabindex");return b?parseInt(b,10):Gb.test(a.nodeName)||Hb.test(a.nodeName)&&a.href?0:-1}}}}),Db={set:function(a,b,c){return b===!1?kb.removeAttr(a,c):Kb&&Jb||!Ib.test(c)?a.setAttribute(!Jb&&kb.propFix[c]||c,c):a[kb.camelCase("default-"+c)]=a[c]=!0,c}},kb.each(kb.expr.match.bool.source.match(/\w+/g),function(a,c){var d=kb.expr.attrHandle[c]||kb.find.attr;kb.expr.attrHandle[c]=Kb&&Jb||!Ib.test(c)?function(a,c,e){var f=kb.expr.attrHandle[c],g=e?b:(kb.expr.attrHandle[c]=b)!=d(a,c,e)?c.toLowerCase():null;return kb.expr.attrHandle[c]=f,g}:function(a,c,d){return d?b:a[kb.camelCase("default-"+c)]?c.toLowerCase():null}}),Kb&&Jb||(kb.attrHooks.value={set:function(a,b,c){return kb.nodeName(a,"input")?void(a.defaultValue=b):Cb&&Cb.set(a,b,c)}}),Jb||(Cb={set:function(a,c,d){var e=a.getAttributeNode(d);return e||a.setAttributeNode(e=a.ownerDocument.createAttribute(d)),e.value=c+="","value"===d||c===a.getAttribute(d)?c:b}},kb.expr.attrHandle.id=kb.expr.attrHandle.name=kb.expr.attrHandle.coords=function(a,c,d){var e;return d?b:(e=a.getAttributeNode(c))&&""!==e.value?e.value:null},kb.valHooks.button={get:function(a,c){var d=a.getAttributeNode(c);return d&&d.specified?d.value:b},set:Cb.set},kb.attrHooks.contenteditable={set:function(a,b,c){Cb.set(a,""===b?!1:b,c)}},kb.each(["width","height"],function(a,b){kb.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),kb.support.hrefNormalized||kb.each(["href","src"],function(a,b){kb.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),kb.support.style||(kb.attrHooks.style={get:function(a){return a.style.cssText||b},set:function(a,b){return a.style.cssText=b+""}}),kb.support.optSelected||(kb.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),kb.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){kb.propFix[this.toLowerCase()]=this}),kb.support.enctype||(kb.propFix.enctype="encoding"),kb.each(["radio","checkbox"],function(){kb.valHooks[this]={set:function(a,b){return kb.isArray(b)?a.checked=kb.inArray(kb(a).val(),b)>=0:void 0}},kb.support.checkOn||(kb.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var Lb=/^(?:input|select|textarea)$/i,Mb=/^key/,Nb=/^(?:mouse|contextmenu)|click/,Ob=/^(?:focusinfocus|focusoutblur)$/,Pb=/^([^.]*)(?:\.(.+)|)$/;kb.event={global:{},add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=kb._data(a);if(r){for(d.handler&&(j=d,d=j.handler,f=j.selector),d.guid||(d.guid=kb.guid++),(h=r.events)||(h=r.events={}),(l=r.handle)||(l=r.handle=function(a){return typeof kb===W||a&&kb.event.triggered===a.type?b:kb.event.dispatch.apply(l.elem,arguments)},l.elem=a),c=(c||"").match(mb)||[""],i=c.length;i--;)g=Pb.exec(c[i])||[],o=q=g[1],p=(g[2]||"").split(".").sort(),o&&(k=kb.event.special[o]||{},o=(f?k.delegateType:k.bindType)||o,k=kb.event.special[o]||{},m=kb.extend({type:o,origType:q,data:e,handler:d,guid:d.guid,selector:f,needsContext:f&&kb.expr.match.needsContext.test(f),namespace:p.join(".")},j),(n=h[o])||(n=h[o]=[],n.delegateCount=0,k.setup&&k.setup.call(a,e,p,l)!==!1||(a.addEventListener?a.addEventListener(o,l,!1):a.attachEvent&&a.attachEvent("on"+o,l))),k.add&&(k.add.call(a,m),m.handler.guid||(m.handler.guid=d.guid)),f?n.splice(n.delegateCount++,0,m):n.push(m),kb.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=kb.hasData(a)&&kb._data(a);if(q&&(k=q.events)){for(b=(b||"").match(mb)||[""],j=b.length;j--;)if(h=Pb.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){for(l=kb.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=k[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;f--;)g=m[f],!e&&p!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||kb.removeEvent(a,n,q.handle),delete k[n])}else for(n in k)kb.event.remove(a,n+b[j],c,d,!0);kb.isEmptyObject(k)&&(delete q.handle,kb._removeData(a,"events"))}},trigger:function(c,d,e,f){var g,h,i,j,k,l,m,n=[e||Y],o=ib.call(c,"type")?c.type:c,p=ib.call(c,"namespace")?c.namespace.split("."):[];if(i=l=e=e||Y,3!==e.nodeType&&8!==e.nodeType&&!Ob.test(o+kb.event.triggered)&&(o.indexOf(".")>=0&&(p=o.split("."),o=p.shift(),p.sort()),h=o.indexOf(":")<0&&"on"+o,c=c[kb.expando]?c:new kb.Event(o,"object"==typeof c&&c),c.isTrigger=f?2:3,c.namespace=p.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,c.result=b,c.target||(c.target=e),d=null==d?[c]:kb.makeArray(d,[c]),k=kb.event.special[o]||{},f||!k.trigger||k.trigger.apply(e,d)!==!1)){if(!f&&!k.noBubble&&!kb.isWindow(e)){for(j=k.delegateType||o,Ob.test(j+o)||(i=i.parentNode);i;i=i.parentNode)n.push(i),l=i;l===(e.ownerDocument||Y)&&n.push(l.defaultView||l.parentWindow||a)}for(m=0;(i=n[m++])&&!c.isPropagationStopped();)c.type=m>1?j:k.bindType||o,g=(kb._data(i,"events")||{})[c.type]&&kb._data(i,"handle"),g&&g.apply(i,d),g=h&&i[h],g&&kb.acceptData(i)&&g.apply&&g.apply(i,d)===!1&&c.preventDefault();if(c.type=o,!f&&!c.isDefaultPrevented()&&(!k._default||k._default.apply(n.pop(),d)===!1)&&kb.acceptData(e)&&h&&e[o]&&!kb.isWindow(e)){l=e[h],l&&(e[h]=null),kb.event.triggered=o;try{e[o]()}catch(q){}kb.event.triggered=b,l&&(e[h]=l)}return c.result}},dispatch:function(a){a=kb.event.fix(a);var c,d,e,f,g,h=[],i=fb.call(arguments),j=(kb._data(this,"events")||{})[a.type]||[],k=kb.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){for(h=kb.event.handlers.call(this,a,j),c=0;(f=h[c++])&&!a.isPropagationStopped();)for(a.currentTarget=f.elem,g=0;(e=f.handlers[g++])&&!a.isImmediatePropagationStopped();)(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,d=((kb.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),d!==b&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()));return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,c){var d,e,f,g,h=[],i=c.delegateCount,j=a.target;if(i&&j.nodeType&&(!a.button||"click"!==a.type))for(;j!=this;j=j.parentNode||this)if(1===j.nodeType&&(j.disabled!==!0||"click"!==a.type)){for(f=[],g=0;i>g;g++)e=c[g],d=e.selector+" ",f[d]===b&&(f[d]=e.needsContext?kb(d,this).index(j)>=0:kb.find(d,this,null,[j]).length),f[d]&&f.push(e);f.length&&h.push({elem:j,handlers:f})}return i<c.length&&h.push({elem:this,handlers:c.slice(i)}),h},fix:function(a){if(a[kb.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];for(g||(this.fixHooks[e]=g=Nb.test(e)?this.mouseHooks:Mb.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new kb.Event(f),b=d.length;b--;)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||Y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,e,f,g=c.button,h=c.fromElement;return null==a.pageX&&null!=c.clientX&&(e=a.target.ownerDocument||Y,f=e.documentElement,d=e.body,a.pageX=c.clientX+(f&&f.scrollLeft||d&&d.scrollLeft||0)-(f&&f.clientLeft||d&&d.clientLeft||0),a.pageY=c.clientY+(f&&f.scrollTop||d&&d.scrollTop||0)-(f&&f.clientTop||d&&d.clientTop||0)),!a.relatedTarget&&h&&(a.relatedTarget=h===a.target?c.toElement:h),a.which||g===b||(a.which=1&g?1:2&g?3:4&g?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==k()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===k()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return kb.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return kb.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){a.result!==b&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=kb.extend(new kb.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?kb.event.trigger(e,null,b):kb.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},kb.removeEvent=Y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===W&&(a[d]=null),a.detachEvent(d,c))},kb.Event=function(a,b){return this instanceof kb.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?i:j):this.type=a,b&&kb.extend(this,b),this.timeStamp=a&&a.timeStamp||kb.now(),void(this[kb.expando]=!0)):new kb.Event(a,b)},kb.Event.prototype={isDefaultPrevented:j,isPropagationStopped:j,isImmediatePropagationStopped:j,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=i,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=i,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=i,this.stopPropagation()}},kb.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){kb.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!kb.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),kb.support.submitBubbles||(kb.event.special.submit={setup:function(){return kb.nodeName(this,"form")?!1:void kb.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=kb.nodeName(c,"input")||kb.nodeName(c,"button")?c.form:b;d&&!kb._data(d,"submitBubbles")&&(kb.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),kb._data(d,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&kb.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return kb.nodeName(this,"form")?!1:void kb.event.remove(this,"._submit")}}),kb.support.changeBubbles||(kb.event.special.change={setup:function(){return Lb.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(kb.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),kb.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),kb.event.simulate("change",this,a,!0)})),!1):void kb.event.add(this,"beforeactivate._change",function(a){var b=a.target;Lb.test(b.nodeName)&&!kb._data(b,"changeBubbles")&&(kb.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||kb.event.simulate("change",this.parentNode,a,!0)}),kb._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return kb.event.remove(this,"._change"),!Lb.test(this.nodeName)}}),kb.support.focusinBubbles||kb.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){kb.event.simulate(b,a.target,kb.event.fix(a),!0)};kb.event.special[b]={setup:function(){0===c++&&Y.addEventListener(a,d,!0)},teardown:function(){0===--c&&Y.removeEventListener(a,d,!0)}}}),kb.fn.extend({on:function(a,c,d,e,f){var g,h;if("object"==typeof a){"string"!=typeof c&&(d=d||c,c=b);for(g in a)this.on(g,c,d,a[g],f);return this}if(null==d&&null==e?(e=c,d=c=b):null==e&&("string"==typeof c?(e=d,d=b):(e=d,d=c,c=b)),e===!1)e=j;else if(!e)return this;return 1===f&&(h=e,e=function(a){return kb().off(a),h.apply(this,arguments)},e.guid=h.guid||(h.guid=kb.guid++)),this.each(function(){kb.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,kb(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if("object"==typeof a){for(f in a)this.off(f,c,a[f]);return this}return(c===!1||"function"==typeof c)&&(d=c,c=b),d===!1&&(d=j),this.each(function(){kb.event.remove(this,a,d,c)})},trigger:function(a,b){return this.each(function(){kb.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?kb.event.trigger(a,b,c,!0):void 0}});var Qb=/^.[^:#\[\.,]*$/,Rb=/^(?:parents|prev(?:Until|All))/,Sb=kb.expr.match.needsContext,Tb={children:!0,contents:!0,next:!0,prev:!0};kb.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(kb(a).filter(function(){for(b=0;e>b;b++)if(kb.contains(d[b],this))return!0}));for(b=0;e>b;b++)kb.find(a,d[b],c);return c=this.pushStack(e>1?kb.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},has:function(a){var b,c=kb(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(kb.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(m(this,a||[],!0))},filter:function(a){return this.pushStack(m(this,a||[],!1))},is:function(a){return!!m(this,"string"==typeof a&&Sb.test(a)?kb(a):a||[],!1).length},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=Sb.test(a)||"string"!=typeof a?kb(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&kb.find.matchesSelector(c,a))){c=f.push(c);break}return this.pushStack(f.length>1?kb.unique(f):f)},index:function(a){return a?"string"==typeof a?kb.inArray(this[0],kb(a)):kb.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){var c="string"==typeof a?kb(a,b):kb.makeArray(a&&a.nodeType?[a]:a),d=kb.merge(this.get(),c);return this.pushStack(kb.unique(d))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}}),kb.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null
+},parents:function(a){return kb.dir(a,"parentNode")},parentsUntil:function(a,b,c){return kb.dir(a,"parentNode",c)},next:function(a){return l(a,"nextSibling")},prev:function(a){return l(a,"previousSibling")},nextAll:function(a){return kb.dir(a,"nextSibling")},prevAll:function(a){return kb.dir(a,"previousSibling")},nextUntil:function(a,b,c){return kb.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return kb.dir(a,"previousSibling",c)},siblings:function(a){return kb.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return kb.sibling(a.firstChild)},contents:function(a){return kb.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:kb.merge([],a.childNodes)}},function(a,b){kb.fn[a]=function(c,d){var e=kb.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=kb.filter(d,e)),this.length>1&&(Tb[a]||(e=kb.unique(e)),Rb.test(a)&&(e=e.reverse())),this.pushStack(e)}}),kb.extend({filter:function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?kb.find.matchesSelector(d,a)?[d]:[]:kb.find.matches(a,kb.grep(b,function(a){return 1===a.nodeType}))},dir:function(a,c,d){for(var e=[],f=a[c];f&&9!==f.nodeType&&(d===b||1!==f.nodeType||!kb(f).is(d));)1===f.nodeType&&e.push(f),f=f[c];return e},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}});var Ub="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Vb=/ jQuery\d+="(?:null|\d+)"/g,Wb=new RegExp("<(?:"+Ub+")[\\s/>]","i"),Xb=/^\s+/,Yb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Zb=/<([\w:]+)/,$b=/<tbody/i,_b=/<|&#?\w+;/,ac=/<(?:script|style|link)/i,bc=/^(?:checkbox|radio)$/i,cc=/checked\s*(?:[^=]|=\s*.checked.)/i,dc=/^$|\/(?:java|ecma)script/i,ec=/^true\/(.*)/,fc=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,gc={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:kb.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},hc=n(Y),ic=hc.appendChild(Y.createElement("div"));gc.optgroup=gc.option,gc.tbody=gc.tfoot=gc.colgroup=gc.caption=gc.thead,gc.th=gc.td,kb.fn.extend({text:function(a){return kb.access(this,function(a){return a===b?kb.text(this):this.empty().append((this[0]&&this[0].ownerDocument||Y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=o(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=o(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?kb.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||kb.cleanData(u(c)),c.parentNode&&(b&&kb.contains(c.ownerDocument,c)&&r(u(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){for(1===a.nodeType&&kb.cleanData(u(a,!1));a.firstChild;)a.removeChild(a.firstChild);a.options&&kb.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return kb.clone(this,a,b)})},html:function(a){return kb.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return 1===c.nodeType?c.innerHTML.replace(Vb,""):b;if(!("string"!=typeof a||ac.test(a)||!kb.support.htmlSerialize&&Wb.test(a)||!kb.support.leadingWhitespace&&Xb.test(a)||gc[(Zb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(Yb,"<$1></$2>");try{for(;e>d;d++)c=this[d]||{},1===c.nodeType&&(kb.cleanData(u(c,!1)),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=kb.map(this,function(a){return[a.nextSibling,a.parentNode]}),b=0;return this.domManip(arguments,function(c){var d=a[b++],e=a[b++];e&&(d&&d.parentNode!==e&&(d=this.nextSibling),kb(this).remove(),e.insertBefore(c,d))},!0),b?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b,c){a=db.apply([],a);var d,e,f,g,h,i,j=0,k=this.length,l=this,m=k-1,n=a[0],o=kb.isFunction(n);if(o||!(1>=k||"string"!=typeof n||kb.support.checkClone)&&cc.test(n))return this.each(function(d){var e=l.eq(d);o&&(a[0]=n.call(this,d,e.html())),e.domManip(a,b,c)});if(k&&(i=kb.buildFragment(a,this[0].ownerDocument,!1,!c&&this),d=i.firstChild,1===i.childNodes.length&&(i=d),d)){for(g=kb.map(u(i,"script"),p),f=g.length;k>j;j++)e=i,j!==m&&(e=kb.clone(e,!0,!0),f&&kb.merge(g,u(e,"script"))),b.call(this[j],e,j);if(f)for(h=g[g.length-1].ownerDocument,kb.map(g,q),j=0;f>j;j++)e=g[j],dc.test(e.type||"")&&!kb._data(e,"globalEval")&&kb.contains(h,e)&&(e.src?kb._evalUrl(e.src):kb.globalEval((e.text||e.textContent||e.innerHTML||"").replace(fc,"")));i=d=null}return this}}),kb.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){kb.fn[a]=function(a){for(var c,d=0,e=[],f=kb(a),g=f.length-1;g>=d;d++)c=d===g?this:this.clone(!0),kb(f[d])[b](c),eb.apply(e,c.get());return this.pushStack(e)}}),kb.extend({clone:function(a,b,c){var d,e,f,g,h,i=kb.contains(a.ownerDocument,a);if(kb.support.html5Clone||kb.isXMLDoc(a)||!Wb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ic.innerHTML=a.outerHTML,ic.removeChild(f=ic.firstChild)),!(kb.support.noCloneEvent&&kb.support.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||kb.isXMLDoc(a)))for(d=u(f),h=u(a),g=0;null!=(e=h[g]);++g)d[g]&&t(e,d[g]);if(b)if(c)for(h=h||u(a),d=d||u(f),g=0;null!=(e=h[g]);g++)s(e,d[g]);else s(a,f);return d=u(f,"script"),d.length>0&&r(d,!i&&u(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k,l=a.length,m=n(b),o=[],p=0;l>p;p++)if(f=a[p],f||0===f)if("object"===kb.type(f))kb.merge(o,f.nodeType?[f]:f);else if(_b.test(f)){for(h=h||m.appendChild(b.createElement("div")),i=(Zb.exec(f)||["",""])[1].toLowerCase(),k=gc[i]||gc._default,h.innerHTML=k[1]+f.replace(Yb,"<$1></$2>")+k[2],e=k[0];e--;)h=h.lastChild;if(!kb.support.leadingWhitespace&&Xb.test(f)&&o.push(b.createTextNode(Xb.exec(f)[0])),!kb.support.tbody)for(f="table"!==i||$b.test(f)?"<table>"!==k[1]||$b.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;e--;)kb.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j);for(kb.merge(o,h.childNodes),h.textContent="";h.firstChild;)h.removeChild(h.firstChild);h=m.lastChild}else o.push(b.createTextNode(f));for(h&&m.removeChild(h),kb.support.appendChecked||kb.grep(u(o,"input"),v),p=0;f=o[p++];)if((!d||-1===kb.inArray(f,d))&&(g=kb.contains(f.ownerDocument,f),h=u(m.appendChild(f),"script"),g&&r(h),c))for(e=0;f=h[e++];)dc.test(f.type||"")&&c.push(f);return h=null,m},cleanData:function(a,b){for(var c,d,e,f,g=0,h=kb.expando,i=kb.cache,j=kb.support.deleteExpando,k=kb.event.special;null!=(c=a[g]);g++)if((b||kb.acceptData(c))&&(e=c[h],f=e&&i[e])){if(f.events)for(d in f.events)k[d]?kb.event.remove(c,d):kb.removeEvent(c,d,f.handle);i[e]&&(delete i[e],j?delete c[h]:typeof c.removeAttribute!==W?c.removeAttribute(h):c[h]=null,bb.push(e))}},_evalUrl:function(a){return kb.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),kb.fn.extend({wrapAll:function(a){if(kb.isFunction(a))return this.each(function(b){kb(this).wrapAll(a.call(this,b))});if(this[0]){var b=kb(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){for(var a=this;a.firstChild&&1===a.firstChild.nodeType;)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(kb.isFunction(a)?function(b){kb(this).wrapInner(a.call(this,b))}:function(){var b=kb(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=kb.isFunction(a);return this.each(function(c){kb(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){kb.nodeName(this,"body")||kb(this).replaceWith(this.childNodes)}).end()}});var jc,kc,lc,mc=/alpha\([^)]*\)/i,nc=/opacity\s*=\s*([^)]*)/,oc=/^(top|right|bottom|left)$/,pc=/^(none|table(?!-c[ea]).+)/,qc=/^margin/,rc=new RegExp("^("+lb+")(.*)$","i"),sc=new RegExp("^("+lb+")(?!px)[a-z%]+$","i"),tc=new RegExp("^([+-])=("+lb+")","i"),uc={BODY:"block"},vc={position:"absolute",visibility:"hidden",display:"block"},wc={letterSpacing:0,fontWeight:400},xc=["Top","Right","Bottom","Left"],yc=["Webkit","O","Moz","ms"];kb.fn.extend({css:function(a,c){return kb.access(this,function(a,c,d){var e,f,g={},h=0;if(kb.isArray(c)){for(f=kc(a),e=c.length;e>h;h++)g[c[h]]=kb.css(a,c[h],!1,f);return g}return d!==b?kb.style(a,c,d):kb.css(a,c)},a,c,arguments.length>1)},show:function(){return y(this,!0)},hide:function(){return y(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){x(this)?kb(this).show():kb(this).hide()})}}),kb.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=lc(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":kb.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var f,g,h,i=kb.camelCase(c),j=a.style;if(c=kb.cssProps[i]||(kb.cssProps[i]=w(j,i)),h=kb.cssHooks[c]||kb.cssHooks[i],d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];if(g=typeof d,"string"===g&&(f=tc.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(kb.css(a,c)),g="number"),!(null==d||"number"===g&&isNaN(d)||("number"!==g||kb.cssNumber[i]||(d+="px"),kb.support.clearCloneStyle||""!==d||0!==c.indexOf("background")||(j[c]="inherit"),h&&"set"in h&&(d=h.set(a,d,e))===b)))try{j[c]=d}catch(k){}}},css:function(a,c,d,e){var f,g,h,i=kb.camelCase(c);return c=kb.cssProps[i]||(kb.cssProps[i]=w(a.style,i)),h=kb.cssHooks[c]||kb.cssHooks[i],h&&"get"in h&&(g=h.get(a,!0,d)),g===b&&(g=lc(a,c,e)),"normal"===g&&c in wc&&(g=wc[c]),""===d||d?(f=parseFloat(g),d===!0||kb.isNumeric(f)?f||0:g):g}}),a.getComputedStyle?(kc=function(b){return a.getComputedStyle(b,null)},lc=function(a,c,d){var e,f,g,h=d||kc(a),i=h?h.getPropertyValue(c)||h[c]:b,j=a.style;return h&&(""!==i||kb.contains(a.ownerDocument,a)||(i=kb.style(a,c)),sc.test(i)&&qc.test(c)&&(e=j.width,f=j.minWidth,g=j.maxWidth,j.minWidth=j.maxWidth=j.width=i,i=h.width,j.width=e,j.minWidth=f,j.maxWidth=g)),i}):Y.documentElement.currentStyle&&(kc=function(a){return a.currentStyle},lc=function(a,c,d){var e,f,g,h=d||kc(a),i=h?h[c]:b,j=a.style;return null==i&&j&&j[c]&&(i=j[c]),sc.test(i)&&!oc.test(c)&&(e=j.left,f=a.runtimeStyle,g=f&&f.left,g&&(f.left=a.currentStyle.left),j.left="fontSize"===c?"1em":i,i=j.pixelLeft+"px",j.left=e,g&&(f.left=g)),""===i?"auto":i}),kb.each(["height","width"],function(a,b){kb.cssHooks[b]={get:function(a,c,d){return c?0===a.offsetWidth&&pc.test(kb.css(a,"display"))?kb.swap(a,vc,function(){return B(a,b,d)}):B(a,b,d):void 0},set:function(a,c,d){var e=d&&kc(a);return z(a,c,d?A(a,b,d,kb.support.boxSizing&&"border-box"===kb.css(a,"boxSizing",!1,e),e):0)}}}),kb.support.opacity||(kb.cssHooks.opacity={get:function(a,b){return nc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=kb.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===kb.trim(f.replace(mc,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=mc.test(f)?f.replace(mc,e):f+" "+e)}}),kb(function(){kb.support.reliableMarginRight||(kb.cssHooks.marginRight={get:function(a,b){return b?kb.swap(a,{display:"inline-block"},lc,[a,"marginRight"]):void 0}}),!kb.support.pixelPosition&&kb.fn.position&&kb.each(["top","left"],function(a,b){kb.cssHooks[b]={get:function(a,c){return c?(c=lc(a,b),sc.test(c)?kb(a).position()[b]+"px":c):void 0}}})}),kb.expr&&kb.expr.filters&&(kb.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!kb.support.reliableHiddenOffsets&&"none"===(a.style&&a.style.display||kb.css(a,"display"))},kb.expr.filters.visible=function(a){return!kb.expr.filters.hidden(a)}),kb.each({margin:"",padding:"",border:"Width"},function(a,b){kb.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+xc[d]+b]=f[d]||f[d-2]||f[0];return e}},qc.test(a)||(kb.cssHooks[a+b].set=z)});var zc=/%20/g,Ac=/\[\]$/,Bc=/\r?\n/g,Cc=/^(?:submit|button|image|reset|file)$/i,Dc=/^(?:input|select|textarea|keygen)/i;kb.fn.extend({serialize:function(){return kb.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=kb.prop(this,"elements");return a?kb.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!kb(this).is(":disabled")&&Dc.test(this.nodeName)&&!Cc.test(a)&&(this.checked||!bc.test(a))}).map(function(a,b){var c=kb(this).val();return null==c?null:kb.isArray(c)?kb.map(c,function(a){return{name:b.name,value:a.replace(Bc,"\r\n")}}):{name:b.name,value:c.replace(Bc,"\r\n")}}).get()}}),kb.param=function(a,c){var d,e=[],f=function(a,b){b=kb.isFunction(b)?b():null==b?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(c===b&&(c=kb.ajaxSettings&&kb.ajaxSettings.traditional),kb.isArray(a)||a.jquery&&!kb.isPlainObject(a))kb.each(a,function(){f(this.name,this.value)});else for(d in a)E(d,a[d],c,f);return e.join("&").replace(zc,"+")},kb.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){kb.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),kb.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var Ec,Fc,Gc=kb.now(),Hc=/\?/,Ic=/#.*$/,Jc=/([?&])_=[^&]*/,Kc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Lc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mc=/^(?:GET|HEAD)$/,Nc=/^\/\//,Oc=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Pc=kb.fn.load,Qc={},Rc={},Sc="*/".concat("*");try{Fc=X.href}catch(Tc){Fc=Y.createElement("a"),Fc.href="",Fc=Fc.href}Ec=Oc.exec(Fc.toLowerCase())||[],kb.fn.load=function(a,c,d){if("string"!=typeof a&&Pc)return Pc.apply(this,arguments);var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),kb.isFunction(c)?(d=c,c=b):c&&"object"==typeof c&&(g="POST"),h.length>0&&kb.ajax({url:a,type:g,dataType:"html",data:c}).done(function(a){f=arguments,h.html(e?kb("<div>").append(kb.parseHTML(a)).find(e):a)}).complete(d&&function(a,b){h.each(d,f||[a.responseText,b,a])}),this},kb.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){kb.fn[b]=function(a){return this.on(b,a)}}),kb.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Fc,type:"GET",isLocal:Lc.test(Ec[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Sc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":kb.parseJSON,"text xml":kb.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?H(H(a,kb.ajaxSettings),b):H(kb.ajaxSettings,a)},ajaxPrefilter:F(Qc),ajaxTransport:F(Rc),ajax:function(a,c){function d(a,c,d,e){var f,l,s,t,v,x=c;2!==u&&(u=2,i&&clearTimeout(i),k=b,h=e||"",w.readyState=a>0?4:0,f=a>=200&&300>a||304===a,d&&(t=I(m,w,d)),t=J(m,t,w,f),f?(m.ifModified&&(v=w.getResponseHeader("Last-Modified"),v&&(kb.lastModified[g]=v),v=w.getResponseHeader("etag"),v&&(kb.etag[g]=v)),204===a||"HEAD"===m.type?x="nocontent":304===a?x="notmodified":(x=t.state,l=t.data,s=t.error,f=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),w.status=a,w.statusText=(c||x)+"",f?p.resolveWith(n,[l,x,w]):p.rejectWith(n,[w,x,s]),w.statusCode(r),r=b,j&&o.trigger(f?"ajaxSuccess":"ajaxError",[w,m,f?l:s]),q.fireWith(n,[w,x]),j&&(o.trigger("ajaxComplete",[w,m]),--kb.active||kb.event.trigger("ajaxStop")))}"object"==typeof a&&(c=a,a=b),c=c||{};var e,f,g,h,i,j,k,l,m=kb.ajaxSetup({},c),n=m.context||m,o=m.context&&(n.nodeType||n.jquery)?kb(n):kb.event,p=kb.Deferred(),q=kb.Callbacks("once memory"),r=m.statusCode||{},s={},t={},u=0,v="canceled",w={readyState:0,getResponseHeader:function(a){var b;if(2===u){if(!l)for(l={};b=Kc.exec(h);)l[b[1].toLowerCase()]=b[2];b=l[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===u?h:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return u||(a=t[c]=t[c]||a,s[a]=b),this},overrideMimeType:function(a){return u||(m.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>u)for(b in a)r[b]=[r[b],a[b]];else w.always(a[w.status]);return this},abort:function(a){var b=a||v;return k&&k.abort(b),d(0,b),this}};if(p.promise(w).complete=q.add,w.success=w.done,w.error=w.fail,m.url=((a||m.url||Fc)+"").replace(Ic,"").replace(Nc,Ec[1]+"//"),m.type=c.method||c.type||m.method||m.type,m.dataTypes=kb.trim(m.dataType||"*").toLowerCase().match(mb)||[""],null==m.crossDomain&&(e=Oc.exec(m.url.toLowerCase()),m.crossDomain=!(!e||e[1]===Ec[1]&&e[2]===Ec[2]&&(e[3]||("http:"===e[1]?"80":"443"))===(Ec[3]||("http:"===Ec[1]?"80":"443")))),m.data&&m.processData&&"string"!=typeof m.data&&(m.data=kb.param(m.data,m.traditional)),G(Qc,m,c,w),2===u)return w;j=m.global,j&&0===kb.active++&&kb.event.trigger("ajaxStart"),m.type=m.type.toUpperCase(),m.hasContent=!Mc.test(m.type),g=m.url,m.hasContent||(m.data&&(g=m.url+=(Hc.test(g)?"&":"?")+m.data,delete m.data),m.cache===!1&&(m.url=Jc.test(g)?g.replace(Jc,"$1_="+Gc++):g+(Hc.test(g)?"&":"?")+"_="+Gc++)),m.ifModified&&(kb.lastModified[g]&&w.setRequestHeader("If-Modified-Since",kb.lastModified[g]),kb.etag[g]&&w.setRequestHeader("If-None-Match",kb.etag[g])),(m.data&&m.hasContent&&m.contentType!==!1||c.contentType)&&w.setRequestHeader("Content-Type",m.contentType),w.setRequestHeader("Accept",m.dataTypes[0]&&m.accepts[m.dataTypes[0]]?m.accepts[m.dataTypes[0]]+("*"!==m.dataTypes[0]?", "+Sc+"; q=0.01":""):m.accepts["*"]);for(f in m.headers)w.setRequestHeader(f,m.headers[f]);if(m.beforeSend&&(m.beforeSend.call(n,w,m)===!1||2===u))return w.abort();v="abort";for(f in{success:1,error:1,complete:1})w[f](m[f]);if(k=G(Rc,m,c,w)){w.readyState=1,j&&o.trigger("ajaxSend",[w,m]),m.async&&m.timeout>0&&(i=setTimeout(function(){w.abort("timeout")},m.timeout));try{u=1,k.send(s,d)}catch(x){if(!(2>u))throw x;d(-1,x)}}else d(-1,"No Transport");return w},getJSON:function(a,b,c){return kb.get(a,b,c,"json")},getScript:function(a,c){return kb.get(a,b,c,"script")}}),kb.each(["get","post"],function(a,c){kb[c]=function(a,d,e,f){return kb.isFunction(d)&&(f=f||e,e=d,d=b),kb.ajax({url:a,type:c,dataType:f,data:d,success:e})}}),kb.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return kb.globalEval(a),a}}}),kb.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),kb.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=Y.head||kb("head")[0]||Y.documentElement;return{send:function(b,e){c=Y.createElement("script"),c.async=!0,a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,b){(b||!c.readyState||/loaded|complete/.test(c.readyState))&&(c.onload=c.onreadystatechange=null,c.parentNode&&c.parentNode.removeChild(c),c=null,b||e(200,"success"))},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(b,!0)}}}});var Uc=[],Vc=/(=)\?(?=&|$)|\?\?/;kb.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Uc.pop()||kb.expando+"_"+Gc++;return this[a]=!0,a}}),kb.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.jsonp!==!1&&(Vc.test(c.url)?"url":"string"==typeof c.data&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vc.test(c.data)&&"data");return i||"jsonp"===c.dataTypes[0]?(f=c.jsonpCallback=kb.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,i?c[i]=c[i].replace(Vc,"$1"+f):c.jsonp!==!1&&(c.url+=(Hc.test(c.url)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||kb.error(f+" was not called"),h[0]},c.dataTypes[0]="json",g=a[f],a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,Uc.push(f)),h&&kb.isFunction(g)&&g(h[0]),h=g=b}),"script"):void 0});var Wc,Xc,Yc=0,Zc=a.ActiveXObject&&function(){var a;for(a in Wc)Wc[a](b,!0)};kb.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&K()||L()}:K,Xc=kb.ajaxSettings.xhr(),kb.support.cors=!!Xc&&"withCredentials"in Xc,Xc=kb.support.ajax=!!Xc,Xc&&kb.ajaxTransport(function(c){if(!c.crossDomain||kb.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();if(c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async),c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),c.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l;try{if(d&&(e||4===i.readyState))if(d=b,g&&(i.onreadystatechange=kb.noop,Zc&&delete Wc[g]),e)4!==i.readyState&&i.abort();else{l={},h=i.status,j=i.getAllResponseHeaders(),"string"==typeof i.responseText&&(l.text=i.responseText);try{k=i.statusText}catch(m){k=""}h||!c.isLocal||c.crossDomain?1223===h&&(h=204):h=l.text?200:404}}catch(n){e||f(-1,n)}l&&f(h,k,l,j)},c.async?4===i.readyState?setTimeout(d):(g=++Yc,Zc&&(Wc||(Wc={},kb(a).unload(Zc)),Wc[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(b,!0)}}}});var $c,_c,ad=/^(?:toggle|show|hide)$/,bd=new RegExp("^(?:([+-])=|)("+lb+")([a-z%]*)$","i"),cd=/queueHooks$/,dd=[Q],ed={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bd.exec(b),f=e&&e[3]||(kb.cssNumber[a]?"":"px"),g=(kb.cssNumber[a]||"px"!==f&&+d)&&bd.exec(kb.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,kb.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};kb.Animation=kb.extend(O,{tweener:function(a,b){kb.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ed[c]=ed[c]||[],ed[c].unshift(b)},prefilter:function(a,b){b?dd.unshift(a):dd.push(a)}}),kb.Tween=R,R.prototype={constructor:R,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(kb.cssNumber[c]?"":"px")},cur:function(){var a=R.propHooks[this.prop];return a&&a.get?a.get(this):R.propHooks._default.get(this)},run:function(a){var b,c=R.propHooks[this.prop];return this.pos=b=this.options.duration?kb.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):R.propHooks._default.set(this),this}},R.prototype.init.prototype=R.prototype,R.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=kb.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){kb.fx.step[a.prop]?kb.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[kb.cssProps[a.prop]]||kb.cssHooks[a.prop])?kb.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},R.propHooks.scrollTop=R.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},kb.each(["toggle","show","hide"],function(a,b){var c=kb.fn[b];kb.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(S(b,!0),a,d,e)}}),kb.fn.extend({fadeTo:function(a,b,c,d){return this.filter(x).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=kb.isEmptyObject(a),f=kb.speed(b,c,d),g=function(){var b=O(this,kb.extend({},a),f);(e||kb._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return"string"!=typeof a&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=null!=a&&a+"queueHooks",f=kb.timers,g=kb._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&cd.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem!==this||null!=a&&f[c].queue!==a||(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&kb.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=kb._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=kb.timers,g=d?d.length:0;for(c.finish=!0,kb.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),kb.each({slideDown:S("show"),slideUp:S("hide"),slideToggle:S("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){kb.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),kb.speed=function(a,b,c){var d=a&&"object"==typeof a?kb.extend({},a):{complete:c||!c&&b||kb.isFunction(a)&&a,duration:a,easing:c&&b||b&&!kb.isFunction(b)&&b};return d.duration=kb.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in kb.fx.speeds?kb.fx.speeds[d.duration]:kb.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){kb.isFunction(d.old)&&d.old.call(this),d.queue&&kb.dequeue(this,d.queue)},d},kb.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},kb.timers=[],kb.fx=R.prototype.init,kb.fx.tick=function(){var a,c=kb.timers,d=0;for($c=kb.now();d<c.length;d++)a=c[d],a()||c[d]!==a||c.splice(d--,1);c.length||kb.fx.stop(),$c=b},kb.fx.timer=function(a){a()&&kb.timers.push(a)&&kb.fx.start()},kb.fx.interval=13,kb.fx.start=function(){_c||(_c=setInterval(kb.fx.tick,kb.fx.interval))},kb.fx.stop=function(){clearInterval(_c),_c=null},kb.fx.speeds={slow:600,fast:200,_default:400},kb.fx.step={},kb.expr&&kb.expr.filters&&(kb.expr.filters.animated=function(a){return kb.grep(kb.timers,function(b){return a===b.elem}).length}),kb.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){kb.offset.setOffset(this,a,b)});var c,d,e={top:0,left:0},f=this[0],g=f&&f.ownerDocument;if(g)return c=g.documentElement,kb.contains(c,f)?(typeof f.getBoundingClientRect!==W&&(e=f.getBoundingClientRect()),d=T(g),{top:e.top+(d.pageYOffset||c.scrollTop)-(c.clientTop||0),left:e.left+(d.pageXOffset||c.scrollLeft)-(c.clientLeft||0)}):e},kb.offset={setOffset:function(a,b,c){var d=kb.css(a,"position");"static"===d&&(a.style.position="relative");var e,f,g=kb(a),h=g.offset(),i=kb.css(a,"top"),j=kb.css(a,"left"),k=("absolute"===d||"fixed"===d)&&kb.inArray("auto",[i,j])>-1,l={},m={};k?(m=g.position(),e=m.top,f=m.left):(e=parseFloat(i)||0,f=parseFloat(j)||0),kb.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(l.top=b.top-h.top+e),null!=b.left&&(l.left=b.left-h.left+f),"using"in b?b.using.call(a,l):g.css(l)}},kb.fn.extend({position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===kb.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),kb.nodeName(a[0],"html")||(c=a.offset()),c.top+=kb.css(a[0],"borderTopWidth",!0),c.left+=kb.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-kb.css(d,"marginTop",!0),left:b.left-c.left-kb.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||Z;a&&!kb.nodeName(a,"html")&&"static"===kb.css(a,"position");)a=a.offsetParent;return a||Z})}}),kb.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);kb.fn[a]=function(e){return kb.access(this,function(a,e,f){var g=T(a);return f===b?g?c in g?g[c]:g.document.documentElement[e]:a[e]:void(g?g.scrollTo(d?kb(g).scrollLeft():f,d?f:kb(g).scrollTop()):a[e]=f)},a,e,arguments.length,null)}}),kb.each({Height:"height",Width:"width"},function(a,c){kb.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){kb.fn[e]=function(e,f){var g=arguments.length&&(d||"boolean"!=typeof e),h=d||(e===!0||f===!0?"margin":"border");return kb.access(this,function(c,d,e){var f;return kb.isWindow(c)?c.document.documentElement["client"+a]:9===c.nodeType?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?kb.css(c,d,h):kb.style(c,d,e,h)},c,g?e:b,g,null)}})}),kb.fn.size=function(){return this.length},kb.fn.andSelf=kb.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=kb:(a.jQuery=a.$=kb,"function"==typeof define&&define.amd&&define("jquery",[],function(){return kb}))}(window),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(a(c).is("body")?window:c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";
+this.offsets=a([]),this.targets=a([]);{var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})}},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),function(a){function b(a){return"object"==typeof a?a:{top:a,left:a}}var c=a.scrollTo=function(b,c,d){a(window).scrollTo(b,c,d)};c.defaults={axis:"xy",duration:parseFloat(a.fn.jquery)>=1.3?0:1,limit:!0},c.window=function(){return a(window)._scrollable()},a.fn._scrollable=function(){return this.map(function(){var b=this,c=!b.nodeName||-1!=a.inArray(b.nodeName.toLowerCase(),["iframe","#document","html","body"]);if(!c)return b;var d=(b.contentWindow||b).document||b.ownerDocument||b;return/webkit/i.test(navigator.userAgent)||"BackCompat"==d.compatMode?d.body:d.documentElement})},a.fn.scrollTo=function(d,e,f){return"object"==typeof e&&(f=e,e=0),"function"==typeof f&&(f={onAfter:f}),"max"==d&&(d=9e9),f=a.extend({},c.defaults,f),e=e||f.duration,f.queue=f.queue&&f.axis.length>1,f.queue&&(e/=2),f.offset=b(f.offset),f.over=b(f.over),this._scrollable().each(function(){function g(a){j.animate(l,e,f.easing,a&&function(){a.call(this,k,f)})}if(null!=d){var h,i=this,j=a(i),k=d,l={},m=j.is("html,body");switch(typeof k){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(k)){k=b(k);break}if(k=a(k,this),!k.length)return;case"object":(k.is||k.style)&&(h=(k=a(k)).offset())}a.each(f.axis.split(""),function(a,b){var d="x"==b?"Left":"Top",e=d.toLowerCase(),n="scroll"+d,o=i[n],p=c.max(i,b);if(h)l[n]=h[e]+(m?0:o-j.offset()[e]),f.margin&&(l[n]-=parseInt(k.css("margin"+d))||0,l[n]-=parseInt(k.css("border"+d+"Width"))||0),l[n]+=f.offset[e]||0,f.over[e]&&(l[n]+=k["x"==b?"width":"height"]()*f.over[e]);else{var q=k[e];l[n]=q.slice&&"%"==q.slice(-1)?parseFloat(q)/100*p:q}f.limit&&/^\d+$/.test(l[n])&&(l[n]=l[n]<=0?0:Math.min(l[n],p)),!a&&f.queue&&(o!=l[n]&&g(f.onAfterFirst),delete l[n])}),g(f.onAfter)}}).end()},c.max=function(b,c){var d="x"==c?"Width":"Height",e="scroll"+d;if(!a(b).is("html,body"))return b[e]-a(b)[d.toLowerCase()]();var f="client"+d,g=b.ownerDocument.documentElement,h=b.ownerDocument.body;return Math.max(g[e],h[e])-Math.min(g[f],h[f])}}(jQuery),function(a){function b(b,c,d){var e=c.hash.slice(1),f=document.getElementById(e)||document.getElementsByName(e)[0];if(f){b&&b.preventDefault();var g=a(d.target);if(!(d.lock&&g.is(":animated")||d.onBefore&&d.onBefore(b,f,g)===!1)){if(d.stop&&g._scrollable().stop(!0),d.hash){var h=d.offset;h=h&&h.top||h||0;var i=f.id==e?"id":"name",j=a("<a> </a>").attr(i,e).css({position:"absolute",top:a(window).scrollTop()+h,left:a(window).scrollLeft()});f[i]="",a("body").prepend(j),location=c.hash,j.remove(),f[i]=e}g.scrollTo(f,d).trigger("notify.serialScroll",[f])}}}var c=location.href.replace(/#.*/,""),d=a.localScroll=function(b){a("body").localScroll(b)};d.defaults={duration:1e3,axis:"y",event:"click",stop:!0,target:window,reset:!0},d.hash=function(c){if(location.hash){if(c=a.extend({},d.defaults,c),c.hash=!1,c.reset){var e=c.duration;delete c.duration,a(c.target).scrollTo(0,c),c.duration=e}b(0,location,c)}},a.fn.localScroll=function(e){function f(){return!(!this.href||!this.hash||this.href.replace(this.hash,"")!=c||e.filter&&!a(this).is(e.filter))}return e=a.extend({},d.defaults,e),e.lazy?this.bind(e.event,function(c){var d=a([c.target,c.target.parentNode]).filter(f)[0];d&&b(c,d,e)}):this.find("a,area").filter(f).bind(e.event,function(a){b(a,this,e)}).end().end()}}(jQuery),function(){if(navigator.appVersion.indexOf("MSIE 8")>0){var a=Array.prototype.slice;Array.prototype.slice=function(){if(this instanceof Array)return a.apply(this,arguments);for(var b=[],c=arguments.length>=1?arguments[0]:0,d=arguments.length>=2?arguments[1]:this.length,e=c;d>e;e++)b.push(this[e]);return b},"function"!=typeof Array.prototype.forEach&&(Array.prototype.forEach=function(a){for(var b=0;b<this.length;b++)a.apply(this,[this[b],b,this])})}}();var self="undefined"!=typeof window?window:{},Prism=function(){var a=/\blang(?:uage)?-(?!\*)(\w+)\b/i,b=self.Prism={util:{type:function(a){return Object.prototype.toString.call(a).match(/\[object (\w+)\]/)[1]},clone:function(a){var c=b.util.type(a);switch(c){case"Object":var d={};for(var e in a)a.hasOwnProperty(e)&&(d[e]=b.util.clone(a[e]));return d;case"Array":return a.slice()}return a}},languages:{extend:function(a,c){var d=b.util.clone(b.languages[a]);for(var e in c)d[e]=c[e];return d},insertBefore:function(a,c,d,e){e=e||b.languages;var f=e[a],g={};for(var h in f)if(f.hasOwnProperty(h)){if(h==c)for(var i in d)d.hasOwnProperty(i)&&(g[i]=d[i]);g[h]=f[h]}return e[a]=g},DFS:function(a,c){for(var d in a)c.call(a,d,a[d]),"Object"===b.util.type(a)&&b.languages.DFS(a[d],c)}},highlightAll:function(a,c){for(var d,e=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),f=0;d=e[f++];)b.highlightElement(d,a===!0,c)},highlightElement:function(d,e,f){for(var g,h,i=d;i&&!a.test(i.className);)i=i.parentNode;if(i&&(g=(i.className.match(a)||[,""])[1],h=b.languages[g]),h){d.className=d.className.replace(a,"").replace(/\s+/g," ")+" language-"+g,i=d.parentNode,/pre/i.test(i.nodeName)&&(i.className=i.className.replace(a,"").replace(/\s+/g," ")+" language-"+g);var j=d.textContent;if(j){j=j.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ");var k={element:d,language:g,grammar:h,code:j};if(b.hooks.run("before-highlight",k),e&&self.Worker){var l=new Worker(b.filename);l.onmessage=function(a){k.highlightedCode=c.stringify(JSON.parse(a.data),g),b.hooks.run("before-insert",k),k.element.innerHTML=k.highlightedCode,f&&f.call(k.element),b.hooks.run("after-highlight",k)},l.postMessage(JSON.stringify({language:k.language,code:k.code}))}else k.highlightedCode=b.highlight(k.code,k.grammar,k.language),b.hooks.run("before-insert",k),k.element.innerHTML=k.highlightedCode,f&&f.call(d),b.hooks.run("after-highlight",k)}}},highlight:function(a,d,e){return c.stringify(b.tokenize(a,d),e)},tokenize:function(a,c){var d=b.Token,e=[a],f=c.rest;if(f){for(var g in f)c[g]=f[g];delete c.rest}a:for(var g in c)if(c.hasOwnProperty(g)&&c[g]){var h=c[g],i=h.inside,j=!!h.lookbehind,k=0;h=h.pattern||h;for(var l=0;l<e.length;l++){var m=e[l];if(e.length>a.length)break a;if(!(m instanceof d)){h.lastIndex=0;var n=h.exec(m);if(n){j&&(k=n[1].length);var o=n.index-1+k,n=n[0].slice(k),p=n.length,q=o+p,r=m.slice(0,o+1),s=m.slice(q+1),t=[l,1];r&&t.push(r);var u=new d(g,i?b.tokenize(n,i):n);t.push(u),s&&t.push(s),Array.prototype.splice.apply(e,t)}}}}return e},hooks:{all:{},add:function(a,c){var d=b.hooks.all;d[a]=d[a]||[],d[a].push(c)},run:function(a,c){var d=b.hooks.all[a];if(d&&d.length)for(var e,f=0;e=d[f++];)e(c)}}},c=b.Token=function(a,b){this.type=a,this.content=b};if(c.stringify=function(a,d,e){if("string"==typeof a)return a;if("[object Array]"==Object.prototype.toString.call(a))return a.map(function(b){return c.stringify(b,d,a)}).join("");var f={type:a.type,content:c.stringify(a.content,d,e),tag:"span",classes:["token",a.type],attributes:{},language:d,parent:e};"comment"==f.type&&(f.attributes.spellcheck="true"),b.hooks.run("wrap",f);var g="";for(var h in f.attributes)g+=h+'="'+(f.attributes[h]||"")+'"';return"<"+f.tag+' class="'+f.classes.join(" ")+'" '+g+">"+f.content+"</"+f.tag+">"},!self.document)return self.addEventListener?(self.addEventListener("message",function(a){var c=JSON.parse(a.data),d=c.language,e=c.code;self.postMessage(JSON.stringify(b.tokenize(e,b.languages[d]))),self.close()},!1),self.Prism):self.Prism;var d=document.getElementsByTagName("script");return d=d[d.length-1],d&&(b.filename=d.src,document.addEventListener&&!d.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",b.highlightAll)),self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),Prism.languages.markup={comment:/&lt;!--[\w\W]*?-->/g,prolog:/&lt;\?.+?\?>/,doctype:/&lt;!DOCTYPE.+?>/,cdata:/&lt;!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/&lt;\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^&lt;\/?[\w:-]+/i,inside:{punctuation:/^&lt;\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&amp;#?[\da-z]{1,8};/gi},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&amp;/,"&"))}),Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/gi,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g},Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(&lt;|<)style[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/style(>|&gt;)/gi,inside:{tag:{pattern:/(&lt;|<)style[\w\W]*?(>|&gt;)|(&lt;|<)\/style(>|&gt;)/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}}),Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/gi,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/gi,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|&lt;=?|>=?|={1,3}|(&amp;){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g},Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|get|set|new|with|typeof|try|throw|catch|finally|null|break|continue|this)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(&lt;|<)script[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/script(>|&gt;)/gi,inside:{tag:{pattern:/(&lt;|<)script[\w\W]*?(>|&gt;)|(&lt;|<)\/script(>|&gt;)/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}}),function(){if(self.Prism&&self.document&&document.querySelector){var a={js:"javascript",html:"markup",svg:"markup"};Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(b){var c=b.getAttribute("data-src"),d=(c.match(/\.(\w+)$/)||[,""])[1],e=a[d]||d,f=document.createElement("code");f.className="language-"+e,b.textContent="",f.textContent="Loading…",b.appendChild(f);var g=new XMLHttpRequest;g.open("GET",c,!0),g.onreadystatechange=function(){4==g.readyState&&(g.status<400&&g.responseText?(f.textContent=g.responseText,Prism.highlightElement(f)):f.textContent=g.status>=400?"✖ Error "+g.status+" while fetching file: "+g.statusText:"✖ Error: File does not exist or is empty")},g.send(null)})}}(),Prism.hooks.add("after-highlight",function(a){var b=a.element.parentNode;if(b&&/pre/i.test(b.nodeName)&&-1!==b.className.indexOf("line-numbers")){var c,d=1+a.code.split("\n").length;lines=new Array(d),lines=lines.join("<span></span>"),c=document.createElement("span"),c.className="line-numbers-rows",c.innerHTML=lines,b.hasAttribute("data-start")&&(b.style.counterReset="linenumber "+(parseInt(b.getAttribute("data-start"),10)-1)),a.element.appendChild(c)}}),function(a){function b(){function b(c,d,e){var f,g=a("<li>"),h=a("<a>");if(h.attr({href:"#"+c}),h.text(d.attr("title")?d.attr("title"):d.text()),e&&e.length){f=a("<ul>",{"class":"nav"});for(var i=0;i<e.length;i++){var j=a(e[i]);f.append(b(j.attr("id"),j))}}return g.append(h),h.after(f),f&&f.find("ul").each(function(){a(this).height(a(this).outerHeight()).hide()}),g}var c=a("#sidebar-nav");a("section").each(function(){var d=a(this);c.append(b(d.attr("id"),d.find("h2:first"),d.find(".section-row h3[id], .section-row h4[id]")))}),a("#sidebar-nav > li").on("activate",function(){a(this).find(".nav").show()}).on("deactivate",function(){a(this).find(".nav").hide()})}function c(){a.localScroll({offset:-110,duration:200,filter:":not([data-tabs] a)"})}a(function(){b(),c(),a("body").scrollspy({target:".sidebar",offset:100}).css("opacity",1)})}(jQuery,window,document,void 0); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/ui-charts-tpls.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/ui-charts-tpls.js
new file mode 100644
index 00000000..41d1bf6c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/ui-charts-tpls.js
@@ -0,0 +1,3909 @@
+/*Sandbox version 0.0.41a*/
+angular.module("att.charts", ["att.charts.tpls", "att.charts.utilities","att.charts.areachartD3","att.charts.barchartD3","att.charts.coschartD3","att.charts.coschartwithbarD3","att.charts.cosdeletionD3","att.charts.cosmultichartD3","att.charts.donutD3","att.charts.donutFusion","att.charts.horseshoeD3","att.charts.radialguageD3","att.charts.stackedBarchart","att.charts.stackedareachart"]);
+angular.module("att.charts.tpls", ["template/areachartD3/attAreaChartD3.html","template/barchartD3/attBarChartD3.html","template/coschartD3/attCosd3Chart.html","template/coschartwithbarD3/attCosBarD3Chart.html","template/cosmultichartD3/attCosmultid3Chart.html","template/donutD3/attDonutd3Chart.html","template/donutFusion/attDonutfusionChart.html","template/horseshoeD3/attHorseshoeD3Chart.html","template/stackedBarchart/stackedBarchart.html","template/stackedareachart/stackedAreaChart.html"]);
+angular.module('att.charts.utilities', [])
+ .factory('$extendObj', [function () {
+ var _extendDeep = function (dst) {
+ angular.forEach(arguments, function (obj) {
+ if (obj !== dst) {
+ angular.forEach(obj, function (value, key) {
+ if (dst[key] && dst[key].constructor && dst[key].constructor === Object) {
+ _extendDeep(dst[key], value);
+ } else {
+ dst[key] = value;
+ }
+ });
+ }
+ });
+ return dst;
+ };
+ return {
+ extendDeep: _extendDeep
+
+ };
+ }]);
+
+angular.module('att.charts.areachartD3', ['att.charts.utilities'])
+ .constant("areaChartConfig",
+ {
+ "chartcolor": {
+ "areaChartColor": ["#bff1ec", "#bbf0eb", "#00c7b2"],
+ "lineChartColor": ["#444444", "#444444"],
+ "overageColor": ["#b8509e"]
+ },
+ "gridLineColor": "#808080",
+ "lineCurveType": 'cardinal',
+ "yAxisMaxTicks": 4,
+ "chartHeight": "200",
+ "dataType": "GB",
+ "lineStroke": 3,
+ "opacityOnHover": "0.5",
+ "circleRadius": 3.5,
+ "yearLabelPos": [5, -5],
+ "tooltipTopMargin": 105,
+ "tooltipLeftMargin": 28,
+ "amountKDivision": 1000,
+ "amountKText": "K",
+ "amountMDivision": 1000000,
+ "amountMText": "M"
+ })
+ .directive('attAreaChart', ['areaChartConfig', '$extendObj', '$timeout', function (areaChartConfig, $extendObj, $timeout) {
+ return {
+ restrict: 'A',
+ scope: {
+ chartData: '=',
+ chartColor: "=",
+ legendLabel: "=",
+ refreshChart: "=",
+ chartConfig: "="
+ },
+ templateUrl: "template/areachartD3/attAreaChartD3.html",
+ replace: true,
+ controller: ['$scope', '$attrs', function ($scope, $attrs) {
+ if (angular.isDefined($scope.chartConfig)) {
+ areaChartConfig = $extendObj.extendDeep(areaChartConfig, $scope.chartConfig);
+ }
+ $scope.dataType = areaChartConfig.dataType;
+ $scope.chartID = $attrs.id;
+ }],
+ link: function (scope, element, attrs, ctrl) {
+ scope.tooltipFlag = false;
+ scope.overageFlag = false;
+ scope.underageFlag = false;
+ var startColor, stopColor, lineColor, xAxisticks, dataObj, margin = {top: 30, right: 15, bottom: 30, left: 40},
+ width = parseInt(attrs.chartWidth, 10),
+ height = areaChartConfig.chartHeight,
+ parseDate = d3.time.format("%d-%b-%Y").parse,
+ tooltipFormat = d3.time.format("%B-%Y"),
+ labelFormat = d3.time.format("%Y");
+ var legendColors = [];
+ legendColors = (scope.chartColor) ? scope.chartColor : areaChartConfig.chartcolor;
+ startColor = legendColors.areaChartColor[0];
+ stopColor = legendColors.areaChartColor[1];
+ lineColor = legendColors.lineChartColor[0];
+ scope.areaLegendColor = legendColors.areaChartColor[2];
+ scope.lineLegendColor = legendColors.lineChartColor[1];
+ scope.overageLegend = legendColors.overageColor[0];
+ var oldIE = navigator.userAgent.toLowerCase().indexOf('msie 8.0') !== -1;
+ scope.addLegendColor = function (id) {
+ var bgColor = null;
+ switch (id) {
+ case 0:
+ bgColor = {"background-color": scope.areaLegendColor, "border-radius": "100%"};
+ break;
+ case 1:
+ bgColor = {"background-color": scope.lineLegendColor};
+ break;
+ case 2:
+ bgColor = {"background-color": scope.overageLegend, "border-radius": "100%"};
+ break;
+ }
+ return bgColor;
+ };
+
+ attrs.$observe('legendRequired', function (val) {
+ if (val === 'true') {
+ scope.showLegend = true;
+ }
+ else {
+ scope.showLegend = false;
+ }
+ });
+
+ scope.$watch('refreshChart', function (value) {
+ if (value === false) {
+ return;
+ }
+ if (angular.isDefined(scope.chartConfig)) {
+ areaChartConfig = $extendObj.extendDeep(areaChartConfig, scope.chartConfig);
+ }
+ d3.select("svg#" + attrs.id).remove();
+ d3.selectAll("svg#" + attrs.id + " > *").remove();
+ d3.selectAll("div#areaChartContainer" + " > div").remove();
+ xAxisticks = scope.chartData.length;
+ dataObj = scope.chartData;
+ var yearLabel = '', monthArr = {}, isSingleMonth, singleMonthName;
+
+ // On selecting same month in From and To dropdowns, User should be getting graph
+ if (dataObj.length === 1) {
+ isSingleMonth = true;
+ var tmp1 = "01-" + dataObj[0].month;
+ var tmp = parseDate(tmp1);
+ singleMonthName = tmp.toString().split(" ")[1];
+ tmp.setMonth(tmp.getMonth() + 1);
+ var nextMonth = tmp.toString().split(" ")[1] + "-" + tmp.getFullYear();
+ dataObj.push({month: nextMonth, usage: dataObj[0].usage, available: dataObj[0].available, usageDataType: dataObj[0].usageDataType, availableDataType: dataObj[0].availableDataType});
+ }
+
+ dataObj.forEach(function (d) {
+ var tmp = "01-" + d.month;
+ d.numericMonth = parseDate(tmp);
+ d.usage = +d.usage;
+ d.available = +d.available;
+ monthArr[labelFormat(d.numericMonth)] = labelFormat(d.numericMonth);
+ });
+
+ for (var key in monthArr) {
+ var label = monthArr[key];
+ if (!yearLabel) {
+ yearLabel = label;
+ }
+ else {
+ if (!isSingleMonth) {
+ yearLabel = yearLabel + "-" + label;
+ }
+ }
+ }
+
+ //X-Axis Range
+ var xRange = d3.time.scale()
+ .range([0, width]);
+
+ //Y-Axis Range
+ var yRange = d3.scale.linear()
+ .range([height, 0]);
+
+ //X-Axis Domain
+ xRange.domain(d3.extent(dataObj, function (d) {
+ return d.numericMonth;
+ }));
+
+ //Y-Axis Domain
+ var yDomainData = [], yAxisData = [];
+ for (var b = 0; b < dataObj.length; b++) {
+ var usageVal = Math.round(parseInt(dataObj[b].usage, 10) / areaChartConfig.yAxisMaxTicks);
+ var availableVal = Math.round(parseInt(dataObj[b].available, 10) / areaChartConfig.yAxisMaxTicks);
+ var val;
+ if (usageVal > availableVal) {
+ val = usageVal;
+ }
+ else {
+ val = availableVal;
+ }
+ var Calc = Math.ceil((val / Math.pow(10, ("" + val).length - 1))) * (areaChartConfig.yAxisMaxTicks) * Math.pow(10, ("" + val).length - 1);
+ yDomainData.push({'yAxisVal': Calc});
+ }
+
+ //Y-Axis Domain
+ yRange.domain([0, d3.max(yDomainData, function (d) {
+ return (d.yAxisVal);
+ })]);
+
+ var yTick = d3.max(yDomainData, function (d) {
+ return d.yAxisVal;
+ });
+
+ yTick = yTick / areaChartConfig.yAxisMaxTicks;
+ for (var x = 0; x <= areaChartConfig.yAxisMaxTicks; x++) {
+ yAxisData.push(yTick * x);
+ }
+ var formatData = function (d) {
+ if (d >= areaChartConfig.amountMDivision) {
+ return d / areaChartConfig.amountMDivision + areaChartConfig.amountMText;
+ } else if (d >= areaChartConfig.amountKDivision) {
+ return d / areaChartConfig.amountKDivision + areaChartConfig.amountKText;
+ } else {
+ return d;
+ }
+ };
+ var xAxis = d3.svg.axis().scale(xRange).orient("bottom").tickFormat(d3.time.format('%b')).ticks(d3.time.months);
+ var yAxis = d3.svg.axis().scale(yRange).orient("left").tickValues(yAxisData).ticks(areaChartConfig.yAxisMaxTicks).tickFormat(formatData);
+
+ //Draw Line
+ var line = d3.svg.line()
+ .x(function (d) {
+ return xRange(d.numericMonth);
+ })
+ .y(function (d) {
+ return yRange(d.available);
+ }).interpolate(areaChartConfig.lineCurveType);
+
+ //Draw Area
+ var area = d3.svg.area()
+ .x(function (d) {
+ return xRange(d.numericMonth);
+ })
+ .y0(height)
+ .y1(function (d) {
+ return yRange(d.usage);
+ }).interpolate(areaChartConfig.lineCurveType);
+
+ //Plot Chart
+ var drawChart = d3.select("#areaChartContainer")
+ .append("svg")
+ .attr("id", attrs.id)
+ .data(dataObj)
+ .attr("width", width + margin.left + margin.right)
+ .attr("height", parseInt(height, 10) + parseInt(margin.top, 10) + parseInt(margin.bottom, 10))
+ .append("g")
+ .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
+ //Apply gradients
+ if (!oldIE) {
+ var svgDefs = drawChart.append("defs")
+ .append("linearGradient")
+ .attr("id", "areaGradient")
+ .attr('x1', '0%').attr('y1', '0%')
+ .attr('x2', '0%').attr('y2', '100%');
+
+ //Fill gradient
+ svgDefs.append('stop')
+ .attr('stop-color', startColor)
+ .attr("offset", "0%")
+ .attr("stop-opacity", "1");
+ svgDefs.append('stop')
+ .attr('stop-color', stopColor)
+ .attr("offset", "100%")
+ .attr("stop-opacity", "1");
+ }
+
+ //Draw X Axis
+ drawChart.append("g")
+ .attr("class", "x axis")
+ .attr("transform", "translate(0," + height + ")")
+ .call(xAxis).selectAll("text")
+ .attr("dy", "1.2em");
+
+
+ if (isSingleMonth) {
+ drawChart.selectAll('.x.axis').selectAll('.tick').selectAll('text')[1][0].textContent = singleMonthName;
+ }
+
+ //Plot Area
+ var areaPath = drawChart.append("path")
+ .datum(dataObj)
+ .attr("class", "area")
+ .attr("d", area).style("fill", "url(#areaGradient)").append("title").text(function () {
+ return scope.legendLabel[0].series;
+ });
+
+ var newDataObj = dataObj;
+ if (isSingleMonth) {
+ newDataObj = dataObj.slice(0, 1);
+ }
+
+ //Draw Data Points for Area Chart
+ var circle = drawChart.selectAll(".dot")
+ .data(newDataObj)
+ .enter().append("circle")
+ .attr("class", "dot")
+ .attr("transform", "translate(" + (isSingleMonth === true) * width / 2 + ",0)")
+ .style("fill", function (d) {
+ if (d.usage > d.available) {
+ return scope.overageLegend;
+ }
+ else {
+ return scope.areaLegendColor;
+ }
+ })
+ .attr("r", areaChartConfig.circleRadius)
+ .attr("cx", function (d) {
+ return xRange(d.numericMonth);
+ })
+ .attr("cy", function (d) {
+ return yRange(d.usage);
+ }).on("mouseover", function (d) {
+ var offsetX = Math.ceil(d3.select(this).attr("cx"));
+ show_tooltip_grid_line(d3.select(this).attr("cx"), "circle", "cx");
+ var offsetY = Math.round(d3.select(this).attr("cy"));
+ d3.select('svg#' + attrs.id).style("fill-opacity", areaChartConfig.opacityOnHover);
+ mouseOver(d, offsetX - 3, offsetY - 3);
+ }).on("mouseout", function () {
+ hide_tooltip_grid_line(d3.select(this).attr("cx"), "circle", "cx");
+ d3.select('svg#' + attrs.id).style("fill-opacity", "1");
+ scope.tooltipFlag = false;
+ scope.$apply();
+ });
+ circle.append('desc').append('title').text(function (d) {
+ return(addTitle(d));
+ });
+
+ //Draw Line Chart
+ drawChart.append("path")
+ .attr("class", "line")
+ .style("stroke", lineColor)
+ //.style("stroke-dasharray", (areaChartConfig.lineStroke, areaChartConfig.lineStroke))
+ .attr("d", line(dataObj)).append("title").text(function () {
+ return scope.legendLabel[1].series;
+ });
+
+ //Draw data points for Line Chart
+ if (!oldIE) {
+ var squaredot = drawChart.selectAll(".square-dot")
+ .data(newDataObj).enter().append("rect")
+ .attr("transform", "translate(" + (isSingleMonth === true) * width / 2 + ",0)")
+ .style("fill", scope.lineLegendColor)
+ .attr("class", "square-dot")
+ .attr("x", function (d) {
+ var tmp = xRange(d.numericMonth);
+ tmp = tmp - 2.5;
+ return tmp;
+ })
+ .attr("y", function (d) {
+ var tmp = yRange(d.available);
+ tmp = tmp - 2.5;
+ return tmp;
+ })
+ .attr("width", "5px")
+ .attr("height", "5px")
+ .on("mouseover", function (d) {
+ var offsetX = Math.ceil(d3.select(this).attr("x"));
+ show_tooltip_grid_line(d3.select(this).attr("x"), "rect", "x");
+ var offsetY = Math.round(d3.select(this).attr("y"));
+ d3.select('svg#' + attrs.id).style("fill-opacity", areaChartConfig.opacityOnHover);
+ mouseOver(d, offsetX, offsetY);
+ }).on("mouseout", function () {
+ hide_tooltip_grid_line(d3.select(this).attr("x"), "rect", "x");
+ d3.select('svg#' + attrs.id).style("fill-opacity", "1");
+ scope.tooltipFlag = false;
+ scope.$apply();
+ });
+ squaredot.append('desc').append('title').text(function (d) {
+ return(addTitle(d));
+ });
+ }
+ else {
+ areaPath.style("fill", startColor);
+ var squareDot = drawChart.selectAll(".square-dot")
+ .data(newDataObj).enter().append("circle")
+ .attr("class", "square-dot")
+ .attr("transform", "translate(" + (isSingleMonth === true) * width / 2 + ",0)")
+ .style("fill", scope.areaLegendColor)
+ .attr("r", areaChartConfig.circleRadius)
+ .attr("cx", function (d) {
+ return xRange(d.numericMonth);
+ })
+ .attr("cy", function (d) {
+ return yRange(d.available);
+ }).on("mouseover", function (d) {
+ var offsetX = Math.ceil(d3.select(this).attr("cx"));
+ var offsetY = Math.round(d3.select(this).attr("cy"));
+ show_tooltip_grid_line(d3.select(this).attr("cx"), "circle", "cx");
+ d3.select('svg#' + attrs.id).style("fill-opacity", areaChartConfig.opacityOnHover);
+ mouseOver(d, offsetX, offsetY);
+ }).on("mouseout", function () {
+ hide_tooltip_grid_line(d3.select(this).attr("cx"), "circle", "cx");
+ d3.select('svg#' + attrs.id).style("fill-opacity", "1");
+ scope.tooltipFlag = false;
+ scope.$apply();
+ });
+ squareDot.append('desc').append('title').text(function (d) {
+ return(addTitle(d));
+ });
+ }
+
+ //Draw Y Axis
+ var yAxisNodes = drawChart.append("g")
+ .attr("class", "y axis").attr("id", "yAxisId")
+ .call(yAxis);
+
+ yAxisNodes.selectAll("text")
+ .attr("id", function (d, i) {
+ return ("yAxisText" + i);
+ });
+
+ //Append Year Label
+ yAxisNodes.append("text")
+ .attr("transform", "rotate(0)")
+ .attr("y", areaChartConfig.yearLabelPos[1])
+ .attr("x", areaChartConfig.yearLabelPos[0]).attr("class", "yearLabel")
+ .text(yearLabel);
+ //Remove minimum value label form Y Axis
+ drawChart.select("#yAxisText0").remove();
+
+ // Draw the x Grid lines
+ drawChart.append("g")
+ .attr("class", "grid")
+ .attr("id", "xGrid")
+ .attr("transform", "translate(" + (isSingleMonth === true) * width / 2 + ",0)")
+ .call(make_x_axis()
+ .tickSize(-height, 0)
+ .tickFormat(""));
+
+ // function for the x grid lines
+ function make_x_axis() {
+ return d3.svg.axis()
+ .scale(xRange)
+ .orient("top")
+ .tickFormat(d3.time.format('%b')).ticks(d3.time.months);
+ }
+
+ //drawChart.select("#xGrid").selectAll("line").style("stroke", areaChartConfig.gridLineColor);
+ drawChart.select("#xGrid").selectAll("line").style("stroke", "none");
+ drawChart.select("#xGrid").selectAll("line")
+ .attr("id", function (d, i) {
+ return ("xAxisLine" + i);
+ });
+
+ //Add title for NVDA screen reader
+ function addTitle(d) {
+ return (tooltipFormat(d.numericMonth) + "Used" + d.usage + d.usageDataType + "Available" + d.available + d.availableDataType);
+ }
+
+ //Show Gridline on Mouse Hover
+ function show_tooltip_grid_line(offsetX, shape, attr) {
+ try {
+ for (var i = 0; i < xAxisticks; i++) {
+ var circle = drawChart.selectAll(shape);
+ if (circle[0][i].getAttribute(attr) === offsetX) {
+ drawChart.select("#xAxisLine" + i).style("stroke", areaChartConfig.gridLineColor);
+ }
+ }
+ } catch (e) {
+ }
+ }
+
+ //Hide Gridline on Mouse Hover
+ function hide_tooltip_grid_line(offsetX, shape, attr) {
+ try {
+ for (var i = 0; i < xAxisticks; i++) {
+ var circle = drawChart.selectAll(shape);
+ if (circle[0][i].getAttribute(attr) === offsetX) {
+ drawChart.select("#xAxisLine" + i).style("stroke", "transparent");
+ }
+ }
+ } catch (e) {
+ }
+ }
+
+ //Mouse Hover
+ function mouseOver(d, offsetX, offsetY) {
+ scope.underageFlag = false;
+ scope.overageFlag = false;
+ if (d.usage > d.available) {
+ scope.overageFlag = true;
+ }
+ if (d.usage < d.available) {
+ scope.underageFlag = true;
+ }
+ scope.dataPoint = {"xData": tooltipFormat(d.numericMonth).replace('-', ' '), "dataUsed": d.usage, "dataAvailable": d.available, "overage": d.overage, "usageDataType": d.usageDataType, "availableDataType": d.availableDataType, "underage": d.underage};
+ scope.$apply();
+ $timeout(function () {
+ offsetY = offsetY - areaChartConfig.tooltipTopMargin;
+ var tooltipEl = element.children().eq(2);
+ var tooltipWidth = tooltipEl[0].offsetWidth;
+ if (isSingleMonth) {
+ offsetX = offsetX - (tooltipWidth / 2) + areaChartConfig.tooltipLeftMargin + (width / 2);
+ } else {
+ offsetX = offsetX - (tooltipWidth / 2) + areaChartConfig.tooltipLeftMargin;
+ }
+ scope.tooltipStyle = {"left": offsetX + "px", "top": offsetY + "px"};
+ scope.tooltipFlag = true;
+ },0);
+ }
+ scope.refreshChart = false;
+ });
+ }
+ };
+ }])
+ .filter('filterInput', function () {
+ return function (input) {
+ return input.replace(/ +/g, "").toLowerCase();
+ };
+ });
+angular.module('att.charts.barchartD3', ['att.charts.utilities'])
+
+ .constant("BarChartD3Config",
+ {
+ "barChartColor": "#0081C2",
+ "gridLineColor": "#808080",
+ "yaxisGridLineColor": "#000000",
+ "margin": {
+ top : 40,
+ right: 20,
+ bottom: 30,
+ left: 40
+ },
+ "attributes": {
+ "userName": "name",
+ "phoneNumber": "phoneNumber",
+ "charges": "charges"
+ },
+ "yAxisMaxTicks": 4,
+ "chartHeight": 160,
+ "amountFormat" : "$0,000",
+ "amountKDivision" : 1000,
+ "amountKText" : "K",
+ "amountMDivision" : 1000000,
+ "amountMText" : "M",
+ "xAxistickSize":0,
+ "tooltipTopMargin":69,
+ "tooltipLeftMargin":59,
+ "xAxisTextTopMargin":15,
+ "xAxisTextLeftMargin":7,
+ "barChartSize":25,
+ "barHoverOpacity":0.2
+ })
+
+ .directive('attBarChart', ['BarChartD3Config','$extendObj', function(BarChartD3Config,$extendObj) {
+ return {
+ restrict: 'A',
+ scope: {
+ chartData: '=',
+ chartConfig: '=',
+ refreshChart: "="
+ },
+ templateUrl: "template/barchartD3/attBarChartD3.html",
+ replace: true,
+ link: function(scope, element, attrs, ctrl) {
+
+ scope.$watch('refreshChart', function() {
+ if (angular.isDefined(scope.chartConfig)) {
+ BarChartD3Config = $extendObj.extendDeep(BarChartD3Config, scope.chartConfig);
+ }
+
+ var width = parseInt(attrs.chartWidth, 10),
+ chartColor = BarChartD3Config.barChartColor,
+ height = BarChartD3Config.chartHeight,
+ userName = BarChartD3Config.attributes.userName,
+ charges = BarChartD3Config.attributes.charges,
+ phoneNumber = BarChartD3Config.attributes.phoneNumber,
+ formatCharges = d3.format(BarChartD3Config.amountFormat),
+ isSingleDataObj = false, padding = 20;
+ var barChartData, yDomainData = [],yAxisData = [];
+ scope.tooltipFlag = false;
+ var compare = function compare(a, b) {
+ if (parseInt(a[charges], 10) > parseInt(b[charges], 10)) {
+ return -1;
+ }
+ if (parseInt(a[charges], 10) < parseInt(b[charges], 10)) {
+ return 1;
+ }
+ return 0;
+ };
+
+
+ d3.select("svg#" + attrs.id).remove();
+ d3.selectAll("svg#" + attrs.id + " > *").remove();
+ d3.selectAll("div#barChartContainer" + " > div").remove();
+
+ barChartData = scope.chartData.sort(compare);
+ barChartData = barChartData.slice(0,BarChartD3Config.barChartSize);
+ if (barChartData.length === 1) {
+ isSingleDataObj = true;
+ }
+ var x = d3.scale.ordinal().rangeBands([0, width]);
+
+ var y = d3.scale.linear()
+ .range([height, 0]);
+
+ x.domain(barChartData.map(function(d, i) {
+ return i + 1;
+ }));
+
+ for(var b=0; b < barChartData.length; b++){
+ var val = Math.round(parseInt(barChartData[b].charges, 10)/BarChartD3Config.yAxisMaxTicks);
+ var Calc = Math.ceil((val / Math.pow(10, ("" + val).length - 1))) * (BarChartD3Config.yAxisMaxTicks) * Math.pow(10, ("" + val).length - 1);
+ yDomainData.push({'yAxisVal':Calc});
+ }
+
+ //Y-Axis Domain
+ y.domain([0, d3.max(yDomainData, function(d) {
+ return (d.yAxisVal);
+ })]);
+
+ var yTick = d3.max(yDomainData, function(d) {return d.yAxisVal;});
+
+ yTick = yTick/BarChartD3Config.yAxisMaxTicks;
+ for(var z = 0; z <= BarChartD3Config.yAxisMaxTicks; z++){
+ yAxisData.push(yTick * z);
+ }
+ var formatMoney = function(d) {
+ if (d >= BarChartD3Config.amountMDivision) {
+ return "$" + d / BarChartD3Config.amountMDivision + BarChartD3Config.amountMText;
+ } else if (d >= BarChartD3Config.amountKDivision) {
+ return "$" + d / BarChartD3Config.amountKDivision + BarChartD3Config.amountKText;
+ } else {
+ return "$" + d;
+ }
+ };
+
+ var xAxis = d3.svg.axis()
+ .scale(x)
+ .orient("bottom")
+ .tickSize(BarChartD3Config.xAxistickSize);
+
+ var yAxis = d3.svg.axis().scale(y).orient("left").tickValues(yAxisData).ticks(BarChartD3Config.yAxisMaxTicks).tickFormat(formatMoney);
+
+ var svg = d3.select("#barChartContainer")
+ .append("svg")
+ .attr("id", attrs.id)
+ .attr("width", width + BarChartD3Config.margin.left + BarChartD3Config.margin.right)
+ .attr("height", height + BarChartD3Config.margin.top + BarChartD3Config.margin.bottom)
+ .append("g")
+ .attr("transform", "translate(" + BarChartD3Config.margin.left + "," + BarChartD3Config.margin.top + ")");
+
+ svg.append("g")
+ .attr("class", "x axis")
+ .attr("transform", "translate(" + -Math.ceil((x(2) - x(1)) / 2 - BarChartD3Config.xAxisTextTopMargin) + "," + (height + BarChartD3Config.xAxisTextLeftMargin) + ")")
+ .call(xAxis);
+
+ var formatPhNumber = function(phoneNum) {
+ if (phoneNum.indexOf("-") === -1) {
+ return phoneNum.substr(0, 3) + '-' + phoneNum.substr(3, 3) + '-' + phoneNum.substr(6);
+ } else {
+ return phoneNum;
+ }
+ };
+
+ var rectBarGroup = svg.append("g")
+ .attr("class", "group").attr("id", function (d, i) {
+ return ("barGroup" + i);
+ }).attr("transform", "translate(" + (isSingleDataObj === true? ((width / 2) + 11):10) + ",0)");
+
+ var rectBars = rectBarGroup.selectAll(".bar")
+ .data(barChartData)
+ .enter().append("rect")
+ .attr("style", "fill:" + chartColor)
+ .attr("class", "bar")
+ .attr("x", function(d, i) {
+ return Math.round(x(i + 1));
+ })
+ .attr("width", 10)
+ .attr("y", function(d) {
+ return y(d[charges]);
+ })
+ .attr("height", function(d) {
+ return (height - y(d[charges]));
+ })
+ .on("mouseover", function(d) {
+ var offsetX = Math.round(d3.select(this).attr("x"));
+ show_tooltip_grid_line(offsetX);
+ var offsetY = Math.round(d3.select(this).attr("y"));
+ svg.select(".grid").selectAll("line").style("stroke", "transparent");
+ svg.selectAll(".bar").style("fill-opacity",BarChartD3Config.barHoverOpacity);
+ d3.select(this).style("fill-opacity","1");
+ mouseOver(d, offsetX, offsetY);
+ })
+ .on("mouseout", function() {
+ var offsetX = Math.round(d3.select(this).attr("x"));
+ hide_tooltip_grid_line(offsetX);
+ scope.tooltipFlag = false;
+ svg.select(".grid").selectAll("line").style("stroke", BarChartD3Config.gridLineColor);
+ svg.selectAll(".bar").style("fill-opacity","1");
+ scope.$apply();
+ });
+ rectBars.append('desc').append('title').text(function(d){ return (d[userName] + "-- Wireless Number" + formatPhNumber(d[phoneNumber]) + "Charges-" + d[charges]);});
+
+ var yAxisNodes = svg.append("g")
+ .attr("class", "y axis")
+ .call(yAxis);
+
+ yAxisNodes.selectAll("text")
+ .attr("id", function(d, i) {
+ return ("yAxisText" + i);
+ });
+
+ yAxisNodes.selectAll("line")
+ .attr("id", function(d, i) {
+ return ("yAxisLine" + i);
+ });
+
+ //Remove minimum value label form Y Axis
+ d3.select("#yAxisText0").remove();
+ d3.select("#yAxisLine0").remove();
+ yAxisNodes.select("path").remove();
+
+ // Draw the y Grid lines
+ svg.append("g")
+ .attr("class", "grid")
+ .attr("transform", "translate(0,0)")
+ .call(make_y_axis()
+ .tickSize(-width + x(2) - x(1), 0, 0)
+ .tickFormat(""));
+ svg.select(".grid").selectAll("line").style("stroke", BarChartD3Config.gridLineColor);
+ // function for the y grid lines
+ function make_y_axis() {
+ return d3.svg.axis()
+ .scale(y)
+ .orient("left")
+ .ticks(BarChartD3Config.yAxisMaxTicks).tickValues(yAxisData);
+ }
+ // Draw the x Grid lines
+ svg.append("g")
+ .attr("class", "grid").attr("id", "xGrid")
+ .call(make_x_axis()
+ .tickSize(-height , 0)
+ .tickFormat("")).selectAll("line").attr("transform", "translate(" + -Math.ceil((x(2) - x(1)) / 2 - BarChartD3Config.xAxisTextTopMargin) + ",0)")
+ .attr("id", function (d, i) {
+ return ("xAxisLine" + i);
+ });
+
+
+ // function for the x grid lines
+ function make_x_axis() {
+ return d3.svg.axis()
+ .scale(x)
+ .orient("top")
+ .ticks(BarChartD3Config.yAxisMaxTicks)
+ ;
+ }
+ svg.select("#xGrid").selectAll("line")
+ .attr("id", function(d, i) {
+ return ("xAxisLine" + i);
+ });
+
+ function show_tooltip_grid_line(offsetX){
+ for (var i = 0; i < barChartData.length; i++) {
+ if(Math.round(x(i+1))===offsetX){
+ svg.select("#xAxisLine"+i).style("stroke", BarChartD3Config.yaxisGridLineColor);
+ }
+ }
+ }
+
+ function hide_tooltip_grid_line(offsetX){
+ for (var i = 0; i < barChartData.length; i++) {
+ if(Math.round(x(i+1))===offsetX){
+ svg.select("#xAxisLine"+i).style("stroke", "transparent");
+ }
+ }
+ }
+ function mouseOver(d, offsetX, offsetY) {
+ offsetY = offsetY - BarChartD3Config.tooltipTopMargin;
+ if (isSingleDataObj) {
+ offsetX = offsetX - BarChartD3Config.tooltipLeftMargin + (width / 2);
+ } else {
+ offsetX = offsetX - BarChartD3Config.tooltipLeftMargin;
+ }
+ scope.tooltipFlag = true;
+ scope.tooltipStyle = {"left": offsetX + "px", "top": offsetY + "px"};
+ scope.dataPoint = {"name": d[userName], "phoneNumber": formatPhNumber(d[phoneNumber]), "charges": formatCharges(d[charges])};
+ scope.$apply();
+ }
+ scope.refreshChart = false;
+ });
+ }
+ };
+ }]);
+angular.module('att.charts.coschartD3', ['att.charts.utilities'])
+ .constant("CosChartD3Config",
+ {
+ "chartcolor": {
+ "paletteColors": ["#097cb5", "#FEFFF7"] //default color options for rendering chart baseColor and NeedleColor,
+
+ },
+ "defaultcenterlabel": "COS 1",
+ "defaultcentercategory": "Real Time",
+ "zoomLevel": "25",
+ "doughnutratio": 20,
+ "legendreqd": "false",
+ "animduration": "300",
+ "legendposition": "top",
+ "centerTextValueDy": "0",
+ "centerTextValueDx": "0",
+ "centerTextPercentDx": "20",
+ "centerTextPercentDy": "-10",
+ "centerTextLabelDy": "20",
+ "centerTextLabelDx": "0",
+ "arcOverMargin": 5
+ })
+ .directive('attCosd3Chart', ['CosChartD3Config', '$timeout','$extendObj', function (CosChartD3Config, $timeout,$extendObj) {
+ return {
+ restrict: 'A',
+ scope: {
+ chartConfig: '=',
+ initVal: '='
+ },
+ templateUrl: 'template/coschartD3/attCosd3Chart.html',
+ transclude: true,
+ replace: true,
+ controller: ['$scope', '$attrs', function ($scope, $attrs) {
+ if (angular.isDefined($scope.chartConfig)) {
+ CosChartD3Config = $extendObj.extendDeep(CosChartD3Config, $scope.chartConfig);
+ }
+ var legendColor = [];
+ legendColor = CosChartD3Config.chartcolor.paletteColors;
+ $scope.addLegendColor = function () {
+ return {"color": legendColor[0]};
+ };
+ $scope.chartID = $attrs.id;
+ if (!angular.isDefined($attrs.legendRequired)) {
+ $scope.legendRequired = CosChartD3Config.legendreqd;
+ } else {
+ $scope.legendRequired = $attrs.legendRequired;
+ }
+ if (!angular.isDefined($attrs.legendPosition)) {
+ $scope.legendPosition = CosChartD3Config.legendposition;
+ } else {
+ $scope.legendPosition = $attrs.legendPosition;
+ }
+ }],
+ link: function (scope, element, attrs) {
+ // var radius = Math.min(attrs.chartWidth, attrs.chartHeight) / 2,
+ var color = d3.scale.ordinal().range(CosChartD3Config.chartcolor.paletteColors),
+ zoom = parseInt(CosChartD3Config.zoomLevel, 0),data,
+ margin = {// optionally set margins
+ top: zoom,
+ right: zoom,
+ bottom: zoom,
+ left: zoom
+ },
+ width = attrs.chartWidth,
+ height = attrs.chartHeight,
+ radius = Math.min(
+ width - (margin.left + margin.right),
+ height - (margin.top + margin.bottom)) / 2;
+ scope.LegendLabel = CosChartD3Config.defaultcenterlabel;
+ scope.LegendCategory = CosChartD3Config.defaultcentercategory;
+ scope.$watch('initVal', function (value) {
+ if(!angular.isDefined(scope.initVal)){
+ return;
+ }
+ d3.select("svg#" + attrs.id).remove();
+ d3.selectAll("svg#" + attrs.id + " > *").remove();
+ var cosval = parseInt(scope.initVal.value, 10);
+ scope.cosval = cosval + "%";
+ if(cosval>100){
+ data = [
+ {"name": "cos1", "value": 100},
+ {"name": "rest", "value": 0}
+ ];
+ }else{
+ data = [
+ {"name": "cos1", "value": cosval},
+ {"name": "rest", "value": 100 - (parseInt(cosval, 10))}
+ ];
+ }
+ var sliderpercent = parseInt(cosval, 10);
+ if (angular.isDefined(sliderpercent)) {
+ sliderpercent = 0;
+ }
+ element[0].querySelector('.cosd3Container').setAttribute('id', attrs.id);
+ // build chart
+ var svg = d3.select(".cosd3Container#" + attrs.id)
+ .attr("style", "height: " + attrs.chartHeight + "px;")
+ .append("svg")
+ .attr("id", attrs.id)
+ .attr("width", "100%")
+ .attr("height", "100%")
+ .attr('viewBox', '0 0 ' + Math.min(width, height) + ' ' + Math.min(width, height))
+ .attr('preserveAspectRatio', 'xMinYMin')
+ .append("g")
+ .attr("transform", "translate(" + Math.min(width, height) / 2 + "," + Math.min(width, height) / 2 + ")");
+ // set radius
+ var arc = d3.svg.arc()
+ .innerRadius(radius - CosChartD3Config.doughnutratio)
+ .outerRadius(radius);
+ // set hovered radius
+ var arcOver = d3.svg.arc()
+ .innerRadius(radius - CosChartD3Config.doughnutratio)
+ .outerRadius(radius + CosChartD3Config.arcOverMargin);
+
+ // add center text element
+ var centerTextValue = svg.append("text")
+ .attr("y", CosChartD3Config.centerTextValueDy)
+ .attr("x", CosChartD3Config.centerTextValueDx)
+ .attr("class", "coschartcenterValue");
+ var centerTextPercent = svg.append("text")
+ .attr("x", CosChartD3Config.centerTextPercentDx)
+ .attr("y", CosChartD3Config.centerTextPercentDy)
+ .attr("class", "coschartcenterPercent");
+ var centerTextLabel = svg.append("text")
+ .attr("y", CosChartD3Config.centerTextLabelDy)
+ .attr("x", CosChartD3Config.centerTextLabelDx)
+ .attr("class", "coschartcenterLabel");
+ centerTextValue.text(cosval);
+ centerTextPercent.text("%");
+ centerTextLabel.text(CosChartD3Config.defaultcenterlabel + "(" + CosChartD3Config.defaultcentercategory + ")");
+
+ var pie = d3.layout.pie()
+ .sort(null)
+ .startAngle(3.2 * Math.PI)
+ .endAngle(5.2 * Math.PI)
+ .value(function (d) {
+ return d.value;
+ });
+
+ // set chart attributes and bind hover events
+ var g = svg.selectAll(".arc")
+ .data(pie(data))
+ .enter()
+ .append("g")
+ .attr("class", "arc")
+ .attr("id", function (d, i) {
+ return "cosarc-" + i;
+ })
+ .style("cursor", "pointer");
+
+ g.append("path")
+ .style("fill", function (d) {
+ return color(d.data.name);
+ })
+ .attr("id", function (d, i) {
+ return "cospath-" + i;
+ })
+ .on("mouseover", function (d) {
+ d3.select(this).transition()
+ .duration(CosChartD3Config.animduration)
+ .attr("d", arcOver);
+ })
+ .on("mouseout", function (d) {
+ d3.select(this).transition()
+ .duration(CosChartD3Config.animduration)
+ .attr("d", arc);
+ })
+ .transition()
+ .ease("exp")
+ .duration(0)
+ .attrTween("d", tweenPie);
+
+ // animate function
+ function tweenPie(b) {
+ var i = d3.interpolate({
+ startAngle: 2.1 * Math.PI,
+ endAngle: 2.1 * Math.PI
+ }, b);
+ return function (t) {
+ return arc(i(t));
+ };
+ }
+ if(cosval>0 && cosval<100){
+ d3.select(".cosd3Container path#cospath-1").style('stroke', 'black');
+ }
+
+
+
+ });
+ }
+ };
+ }]);
+angular.module('att.charts.coschartwithbarD3', ['att.charts.utilities'])
+.constant("CosChartWithBarD3Config",
+ {
+ "chartcolor": {
+ "paletteColors": ["#0574ac", "#44c8f5", "#4ca90c", "#da0081", "#ff9900", "#81017e"], //["#097cb5", "#FEFFF7"], //default color options for rendering chart baseColor and NeedleColor,
+ "zeroColor": "#ffffff",
+ "borderColor": "#666666"
+ },
+ "zoomLevel": "25",
+ "doughnutratio": 20,
+ "barreqd": "true",
+ "barHeight": 50,
+ "barWidth": 150,
+ "barCornerRadius": 9,
+ //"barTextValueDy": "250",
+ //"barTextValueDx": "0",
+ //"barTextPercentDx": "20",
+ //"barTextPercentDy": "-250",
+ //"barTextLabelDy": "60",
+ //"barTextLabelDx": "-80",
+ //"defaultbarlabel": "CoS 2V/CoS 2/CoS 3/CoS 4/CoS 5",
+ "animduration": "300",
+ "centerText": {
+ 'defaultCenterLabel': 'COS 1',
+ 'defaultCenterCategory': 'Real Time',
+ 'textValueDy': '0',
+ 'textValueDx': '0',
+ 'textPercentDx': '20',
+ 'textPercentDy': '-10',
+ 'textLabelDx': '0',
+ 'textLabelDy': '20',
+ 'color': '#666666',
+ 'size': '36px',
+ 'font': 'omnes_att_light'
+ },
+ "centerTextValueDy": "0",
+ "centerTextValueDx": "0",
+ "centerTextPercentDx": "20",
+ "centerTextPercentDy": "-10",
+ "centerTextLabelDy": "20",
+ "centerTextLabelDx": "0",
+ "arcOverMargin": 5
+ })
+.directive('attCosBarD3Chart', ['CosChartWithBarD3Config', '$timeout','$extendObj', function (CosChartWithBarD3Config, $timeout,$extendObj) {return {
+ restrict: 'A',
+ scope: {
+ chartConfig: '=',
+ chartData: '=',
+ totalCos: '=',
+ remainingCos: '=',
+ mouseOver: '=?'
+ },
+ templateUrl: 'template/coschartwithbarD3/attCosBarD3Chart.html',
+ transclude: true,
+ replace: true,
+ controller: ['$scope', '$attrs', function ($scope, $attrs) {
+ if (angular.isDefined($scope.chartConfig)) {
+ CosChartWithBarD3Config = $extendObj.extendDeep(CosChartWithBarD3Config, $scope.chartConfig);
+ }
+
+ $scope.chartID = $attrs.id;
+ if (!angular.isDefined($attrs.barRequired)) {
+ $scope.barRequired = CosChartWithBarD3Config.barreqd;
+ } else {
+ $scope.barRequired = $attrs.barRequired;
+ }
+
+ }],
+ link: function (scope, element, attrs) {
+ /*
+ x: x-coordinate
+ y: y-coordinate
+ w: width
+ h: height
+ r: corner radius
+ tl: top_left rounded?
+ tr: top_right rounded?
+ bl: bottom_left rounded?
+ br: bottom_right rounded?
+ */
+ function rounded_rect(x, y, w, h, r, tl, tr, bl, br) {
+ var retval;
+ retval = "M" + (x + r) + "," + y;
+ retval += "h" + (w - 2*r);
+ if (tr) { retval += "a" + r + "," + r + " 0 0 1 " + r + "," + r; }
+ else { retval += "h" + r; retval += "v" + r; }
+ retval += "v" + (h - 2*r);
+ if (br) { retval += "a" + r + "," + r + " 0 0 1 " + -r + "," + r; }
+ else { retval += "v" + r; retval += "h" + -r; }
+ retval += "h" + (2*r - w);
+ if (bl) { retval += "a" + r + "," + r + " 0 0 1 " + -r + "," + -r; }
+ else { retval += "h" + -r; retval += "v" + -r; }
+ retval += "v" + (2*r - h);
+ if (tl) { retval += "a" + r + "," + r + " 0 0 1 " + r + "," + -r; }
+ else { retval += "v" + -r; retval += "h" + r; }
+ retval += "z";
+ return retval;
+ }
+
+ var radScale = d3.scale.linear().domain([0, 100]).range([0, 2 * Math.PI]);
+
+
+ var zoom = parseInt(CosChartWithBarD3Config.zoomLevel, 0),data,
+ margin = {// optionally set margins
+ top: zoom,
+ right: zoom,
+ bottom: zoom,
+ left: zoom
+ },
+ width = attrs.chartWidth,
+ height = attrs.chartHeight,
+ radius = Math.min(
+ width - (margin.left + margin.right),
+ height - (margin.top + margin.bottom)) / 2;
+
+
+ scope.$watchCollection('chartData', function (value) {
+ var j = 0; // index for for-loops
+
+ if(!angular.isDefined(scope.chartData) || scope.chartData.length < 1){
+ return;
+ }
+
+ d3.select("svg#" + attrs.id).remove();
+ d3.selectAll("svg#" + attrs.id + " > *").remove();
+
+ // SnickrBar
+ d3.select("svg#" + scope.snickrbarId).remove();
+ d3.selectAll("svg#" + scope.snickrbarId + " > *").remove();
+
+ var cosval = scope.chartData[0];
+ var remainingCosVal = 0, restCosVal = 0;
+
+ for(j = 1; j < scope.chartData.length; j++)
+ {
+ remainingCosVal += parseInt(scope.chartData[j], 10); //parseInt allows strings to be passed in
+ }
+ restCosVal = 100 - cosval - remainingCosVal;
+ scope.totalCos = cosval + remainingCosVal;
+ scope.remainingCos = remainingCosVal;
+
+ var data = angular.copy(scope.chartData);
+ if (angular.isDefined(restCosVal)) {
+ data.push(restCosVal);
+ }
+
+ element[0].querySelector('.cosd3Container').setAttribute('id', attrs.id);
+ // build chart
+ var svg = d3.select(".cosd3Container#" + attrs.id)
+ .attr("style", "height: " + attrs.chartHeight + "px;")
+ .append("svg")
+ .attr("id", attrs.id)
+ .attr("width", "100%")
+ .attr("height", "100%")
+ .attr('viewBox', '0 0 ' + Math.min(width, height) + ' ' + Math.min(width, height))
+ .attr('preserveAspectRatio', 'xMinYMin')
+ .append("g")
+ .attr("transform", "translate(" + Math.min(width, height) / 2 + "," + Math.min(width, height) / 2 + ")");
+
+ scope.snickrbarId = attrs.id + 'snickrbar';
+ var snickrbar = d3.select(".snickrBar")
+ .attr('style', 'margin-left:' + Math.floor(CosChartWithBarD3Config.barWidth/3) + ';')
+ .style({'background-color': CosChartWithBarD3Config.chartcolor.zeroColor, 'width': CosChartWithBarD3Config.barWidth + 'px', 'border': '1px solid #777', 'border-radius': '10px'})
+ .append("svg")
+ .attr("id", scope.snickrbarId)
+ .attr("width", CosChartWithBarD3Config.barWidth + "px")
+ .attr("height", CosChartWithBarD3Config.barHeight + "px")
+ .append("g");
+
+ // set radius
+ var arc = d3.svg.arc()
+ .innerRadius(radius - CosChartWithBarD3Config.doughnutratio)
+ .outerRadius(radius);
+
+ // set hovered radius
+ var arcOver = d3.svg.arc()
+ .innerRadius(radius - CosChartWithBarD3Config.doughnutratio)
+ .outerRadius(radius + CosChartWithBarD3Config.arcOverMargin);
+
+ // add center text element
+ var centerTextValue = svg.append("text")
+ .attr("y", CosChartWithBarD3Config.centerText.textValueDy)
+ .attr("x", CosChartWithBarD3Config.centerText.textValueDx)
+ .attr("class", "coschartcenterValue");
+ var centerTextPercent = svg.append("text")
+ .attr("x", CosChartWithBarD3Config.centerText.textPercentDx)
+ .attr("y", CosChartWithBarD3Config.centerText.textPercentDy)
+ .attr("class", "coschartcenterPercent");
+ var centerTextLabel = svg.append("text")
+ .attr("y", CosChartWithBarD3Config.centerText.textLabelDy)
+ .attr("x", CosChartWithBarD3Config.centerText.textLabelDx)
+ .attr("class", "coschartcenterLabel");
+ centerTextValue.text(cosval);
+ centerTextPercent.text("%");
+ centerTextLabel.text(CosChartWithBarD3Config.centerText.defaultCenterLabel + "(" + CosChartWithBarD3Config.centerText.defaultCenterCategory + ")");
+
+ var scale = function(d) {
+ if (d <= 0) {
+ return 0;
+ } else {
+ var r = (d * CosChartWithBarD3Config.barWidth) / 100;
+ if (isNaN(r)) { r = 0; }
+ else if (!isFinite(r)) { r = CosChartWithBarD3Config.barWidth; }
+
+ return r;
+ }
+ };
+
+ // Only executed when totalCos is 0
+ if (cosval <= 0) {
+ arc.startAngle(0).endAngle(2 * Math.PI); //just radians
+ svg.append("path")
+ .attr("d", arc)
+ .attr("fill", CosChartWithBarD3Config.chartcolor.zeroColor)
+ .style("stroke", CosChartWithBarD3Config.chartcolor.borderColor)
+ .style("stroke-width", 1);
+ } else {
+
+ // JVM: This code is temp for just snicker's bar release
+ var temp = 100-data[0];
+ var newData = [];
+ newData.push({'value':data[0]});
+ newData.push({'value':temp});
+
+ /*for(j = 0; j < data.length; j++) {
+ var obj = angular.extend({}, data[j]);
+ obj.value = data[j];
+ newData.push(obj);
+ }*/
+
+
+ //======================================================
+
+
+ var pie = d3.layout.pie()
+ .sort(null)
+ .value(function (d,index) {
+ var r = d.value;
+ if (d.value <= 0) { r = 0; }
+ return r;
+ });
+
+ // set chart attributes and bind hover events
+ var g = svg.selectAll(".arc")
+ .data(pie(newData))
+ .enter()
+ .append("g")
+ .attr("class", "arc")
+ .attr("id", function (d, i) {
+ return "cosarc-" + i;
+ })
+ .style("cursor", "pointer");
+
+ g.append("path")
+ .style("fill", function (d, i) {
+ if (i === CosChartWithBarD3Config.chartcolor.paletteColors.length || i === newData.length-1 || d.data.value === 0) {
+ return CosChartWithBarD3Config.chartcolor.zeroColor;
+ }
+
+ return CosChartWithBarD3Config.chartcolor.paletteColors[i];
+ })
+ .style("stroke", "white")
+ .style("stroke-width", function(d,index) { if (cosval >= 100) { return 0; } else { return 1; } })
+ .attr("id", function (d, i) {
+ return "cospath-" + i;
+ })
+ .on("mouseover", function (d, index) {
+ if (index < newData.length-1) {
+ d3.select(this).transition()
+ .duration(CosChartWithBarD3Config.animduration)
+ .attr("d", arcOver);
+ }
+ })
+ .on("mouseout", function (d, index) {
+ if (index < newData.length-1) {
+ d3.select(this).transition()
+ .duration(CosChartWithBarD3Config.animduration)
+ .attr("d", arc);
+ }
+ })
+ .transition()
+ .ease("exp")
+ .duration(0)
+ .attrTween("d", tweenPie);
+ } // end of else
+
+ if (!CosChartWithBarD3Config.barreqd) { return; }
+ var snickrData = [];
+ var d = scope.chartData.slice(1, scope.chartData.length);
+ for (j = 0; j < d.length; j++) {
+ if (d[j] !== 0) {
+ var obj = {};
+ obj.data = d[j];
+ obj.color = CosChartWithBarD3Config.chartcolor.paletteColors[j+1];
+ snickrData.push(obj);
+ }
+ }
+
+ var prevWidth = 0;
+ var nextX = function(d, i) {
+ if (i === 0) {
+ prevWidth = scale(d);
+ return 0;
+ } else {
+ var p = prevWidth;
+ prevWidth += scale(d);
+ return p;
+ }
+ };
+
+ var rect = snickrbar.selectAll("path")
+ .data(snickrData)
+ .enter()
+ .append("path")
+ .style("fill", function(d, i) {
+ if (i >= CosChartWithBarD3Config.chartcolor.paletteColors.length || d.data === 0) {
+ return CosChartWithBarD3Config.chartcolor.zeroColor;
+ }
+
+ return d.color;
+ })
+ .attr("d", function(d, index) {
+ if (index === 0) {
+ // Left rounded rectangle
+ return rounded_rect(nextX(d.data, index), 0, scale(d.data), CosChartWithBarD3Config.barHeight, CosChartWithBarD3Config.barCornerRadius, true, false, true, false);
+ } else if (index === snickrData.length-1 && remainingCosVal >= 100) {
+ // Right rounded rectangle
+ return rounded_rect(nextX(d.data, index), 0, scale(d.data), CosChartWithBarD3Config.barHeight, CosChartWithBarD3Config.barCornerRadius, false, true, false, true);
+ } else {
+ console.log('normal rect at ' + index);
+ return rounded_rect(nextX(d.data, index), 0, scale(d.data), CosChartWithBarD3Config.barHeight, 0, false, false, false, false);
+ }
+ });
+
+ if (remainingCosVal === 0) {
+ snickrbar.attr("fill", CosChartWithBarD3Config.chartcolor.zeroColor);
+ }
+
+ // add bar text element
+ /*var snickerText = d3.select('.snickrBar svg')
+ .append("g")
+ .style("fill", "black");
+
+ var barTextValue = snickerText.append("text")
+ .attr("y", CosChartWithBarD3Config.barTextValueDy)
+ .attr("x", CosChartWithBarD3Config.barTextValueDx)
+ .attr("class", "coschartbarcenterValue");
+ var barTextPercent = snickerText.append("text")
+ .attr("x", CosChartWithBarD3Config.barTextPercentDx)
+ .attr("y", CosChartWithBarD3Config.centerTextPercentDy)
+ .attr("class", "coschartbarcenterPercent");
+ var barTextLabel = snickerText.append("text")
+ .attr("y", CosChartWithBarD3Config.barTextLabelDy)
+ .attr("x", CosChartWithBarD3Config.barTextLabelDx)
+ .attr("class", "coschartbarcenterLabel");
+ barTextValue.text(cosval);
+ barTextPercent.text("%");
+ barTextLabel.text(CosChartWithBarD3Config.defaultbarlabel);*/
+
+
+
+ // animate function
+ function tweenPie(b) {
+ var i = d3.interpolate({
+ startAngle: 2.1 * Math.PI,
+ endAngle: 2.1 * Math.PI
+ }, b);
+ return function (t) {
+ return arc(i(t));
+ };
+ }
+
+ scope.$watch('mouseOver', function(val) {
+ if (!angular.isDefined(scope.mouseOver)) { return; }
+ var id = scope.mouseOver.split('-')[1];
+ if (scope.mouseOver.split('-')[0] === 'true') {
+ if (id === '0') {
+ d3.select("#cospath-" + id).transition()
+ .duration(CosChartWithBarD3Config.animduration)
+ .attr("d", arcOver);
+ } else {
+ for (var i = 0; i < newData.length-1; i++) {
+ d3.select("#cospath-" + (i+1)).transition()
+ .duration(CosChartWithBarD3Config.animduration)
+ .attr("d", arcOver);
+ }
+ }
+ } else {
+ if (id === '0') {
+ d3.select("#cospath-" + id).transition()
+ .duration(CosChartWithBarD3Config.animduration)
+ .attr("d", arc);
+ } else {
+ for (j = 0; j < newData.length-1; j++) {
+ d3.select("#cospath-" + (j+1)).transition()
+ .duration(CosChartWithBarD3Config.animduration)
+ .attr("d", arc);
+ }
+ }
+ }
+ });
+
+ });
+
+ }
+ };
+ }]);
+angular.module('att.charts.cosdeletionD3', ['att.charts.utilities'])
+ .constant("CosdeletionD3Config",
+ {
+ "chartcolor": {
+ "MaxBandwidthReached": "#d3d3d3",
+ "ZeroBandwidthSelected": "#FEFFF7",
+ "RemainingBandwidthColor": "#ffffff",
+ "RemainingBandwidthStrokeColor": "#d3d3d3",
+ "RemainingBandwidthStrokeWidth": 1.5,
+ "UsedBandwidthColor": "#0574AC",
+ "UsedBandwidthStrokeColor":"#efefef", //white
+ "UsedBandwidthStrokeWidth":"1"
+ },
+ "defaultcenterlabel": "Kbps",
+ "zoomLevel": "10",
+ "doughnutratio": 21,
+ "animduration": "300",
+ "guageStartAngle":4,
+ "guageEndAngle":8.56,
+ "legendreqd": "false",
+ "initduration": "1000",
+ "legendposition": "top",
+ "centerTextLabelDy": "20",
+ "centerTextValueDy": "0",
+ "centerTextValueDx": "-30",
+ "centerTextLabelDx": "-10",
+ "maxbandwidthTextDx": "25",
+ "maxbandwidthTextDy": "70",
+ "arcOverMargin": 5
+ })
+ .directive('attCosdeletiond3Chart', ['CosdeletionD3Config', '$timeout','$extendObj', function(CosdeletionD3Config, $timeout,$extendObj) {
+ return {
+ restrict: 'A',
+ scope: {
+ maxValue: '=',
+ chartData: '=',
+ chartConfig: '=',
+ resetChart: '=',
+ removeArcs: '='
+ },
+ controller: ['$scope', '$attrs', function($scope, $attrs) {
+ if (angular.isDefined($scope.chartConfig)) {
+ CosdeletionD3Config = $extendObj.extendDeep(CosdeletionD3Config, $scope.chartConfig);
+ }
+
+ }],
+ link: function(scope, element, attrs) {
+ var zoom = parseInt(CosdeletionD3Config.zoomLevel, 0),
+ margin = {// optionally set margins
+ top: zoom,
+ right: zoom,
+ bottom: zoom,
+ left: zoom
+ },
+ width = attrs.chartWidth,
+ height = attrs.chartHeight,
+ radius = Math.min(
+ width - (margin.left + margin.right),
+ height - (margin.top + margin.bottom)) / 2,arcPath;
+ // set radius
+ var arc = d3.svg.arc()
+ .innerRadius(radius - CosdeletionD3Config.doughnutratio)
+ .outerRadius(radius);
+ var arcOver = d3.svg.arc()
+ .innerRadius(radius - CosdeletionD3Config.doughnutratio)
+ .outerRadius(radius + CosdeletionD3Config.arcOverMargin);
+
+ // Browser onresize event
+ window.onresize = function() {
+ scope.$apply();
+ };
+ scope.$watch('resetChart', function(newValue, oldValue) {
+ if(scope.resetChart === true){
+ scope.resetChart = false;
+ return;
+ }
+ return scope.render(newValue, oldValue);
+ });
+ scope.render = function(newValue, oldValue) {
+ d3.select("svg#" + attrs.id).remove();
+ d3.selectAll("svg#" + attrs.id + " > *").remove();
+ if (!scope.chartData)
+ {
+ return;
+ }
+ var data=angular.copy(scope.chartData);
+ data=data.reverse();
+ var totalBandwidth=0,totalUsed=0,remainingBandwidth=0,dynamicColorRange=[],noCheckBoxSelected=true,selectedBandwidth=0,selectedElem=[];
+ if (angular.isDefined(scope.maxValue)) {
+ totalBandwidth = parseInt(scope.maxValue, 0);
+ }
+ for (var j = 0; j < data.length; j++) {
+ totalUsed = (totalUsed + parseInt(data[j].value, 0));
+ if(angular.equals(data[j].status, true)){
+ noCheckBoxSelected=false;
+ selectedBandwidth=selectedBandwidth+data[j].value;
+
+ data[j].value=0;
+ dynamicColorRange.push(CosdeletionD3Config.chartcolor.MaxBandwidthReached);
+
+ }else{
+ selectedElem.push({index: data[j].id, value: data[j].value});
+ dynamicColorRange.push(CosdeletionD3Config.chartcolor.UsedBandwidthColor);
+ }
+ }
+ if(scope.removeArcs){
+ while(data.length > 0) {
+ data.pop();
+ }
+ dynamicColorRange=[];
+ data.push({name: "totalUsed", value: totalUsed-selectedBandwidth,id:"totalUsed"});
+ dynamicColorRange.push(CosdeletionD3Config.chartcolor.UsedBandwidthColor);
+ scope.removeArcs=false;
+ }
+ if(totalUsed>0 && totalUsed<totalBandwidth){
+ remainingBandwidth=totalBandwidth-totalUsed;
+ if(!noCheckBoxSelected){
+ data.push({name: "selectedBandwidth", value: selectedBandwidth,id:"selectedBandwidth"});
+ dynamicColorRange.push(CosdeletionD3Config.chartcolor.MaxBandwidthReached);
+ }
+ data.push({name: "remaining", value: remainingBandwidth,id:"remaining"});
+ dynamicColorRange.push(CosdeletionD3Config.chartcolor.RemainingBandwidthColor);
+ }
+ element[0].setAttribute('id', attrs.id);
+ var svg = d3.select(element[0])
+ .attr("style", "height: " + attrs.chartHeight + "px;")
+ .append("svg")
+ .attr("id", attrs.id)
+ .attr("radius", radius)
+ .attr("width", attrs.chartWidth)
+ .attr("height", attrs.chartHeight)
+ .attr('viewBox', '0 0 ' + Math.min(width, height) + ' ' + Math.min(width, height))
+ .attr('preserveAspectRatio', 'xMinYMin')
+ .append("g")
+ .attr("transform", "translate(" + Math.min(width, height) / 2 + "," + Math.min(width, height) / 2 + ")");
+
+ var centerTextValue = svg.append("text")
+ .attr("y", CosdeletionD3Config.centerTextValueDy)
+ .attr("x", CosdeletionD3Config.centerTextValueDx)
+ .attr("class", "cosdeletioncenterValue");
+ var centerTextLabel = svg.append("text")
+ .attr("y", CosdeletionD3Config.centerTextLabelDy)
+ .attr("x", CosdeletionD3Config.centerTextLabelDx)
+ .attr("class", "cosdeletioncenterLabel");
+ var maxbandwidthText = svg.append("text")
+ .attr("y", CosdeletionD3Config.maxbandwidthTextDy)
+ .attr("x", CosdeletionD3Config.maxbandwidthTextDx)
+ .attr("class", "cosdeletionmaxbandwidthText");
+
+ var color = d3.scale.ordinal().range(dynamicColorRange);
+ centerTextValue.text(totalUsed-selectedBandwidth);
+ centerTextLabel.text(CosdeletionD3Config.defaultcenterlabel);
+ maxbandwidthText.text(totalBandwidth + " " + CosdeletionD3Config.defaultcenterlabel);
+
+ var pie = d3.layout.pie()
+ .sort(null)
+ .startAngle(CosdeletionD3Config.guageStartAngle)
+ .endAngle(CosdeletionD3Config.guageEndAngle)
+ .value(function(d) {
+ return d.value;
+ });
+
+ var g = svg.selectAll(".arc")
+ .data(pie(data))
+ .enter()
+ .append("g")
+ .attr("class", "arc")
+ .attr("id", function(d, i) {
+ return "cosdeletionarc-" + d.data.id;
+ })
+ .style("cursor", "pointer");
+
+ arcPath = g.append("path")
+ .style("fill", function(d) {
+ return color(d.data.name);
+ }).attr("id", function(d, i) {
+ return "cosdeletionpath-" + d.data.id;
+ })
+ .transition()
+ .ease("exp")
+ .duration(0)
+ .attrTween("d", tweenPie);
+
+ arcPath = arcPath[0];
+ for (var i = 0; i < arcPath.length; i++) {
+ var id = arcPath[i].id;
+ if (id !== 'cosdeletionpath-remaining' && id !== 'cosdeletionpath-selectedBandwidth') {
+ d3.select("path#" + id).transition().attr("d", arcOver);
+ }
+ }
+
+ if (remainingBandwidth > 0) {
+ if(angular.isDefined(newValue) && angular.isDefined(oldValue)){
+ for (var k = 0; k < selectedElem.length; k++) {
+ var index =selectedElem[k].index;
+ d3.select("path#cosdeletionpath-" + index).style('stroke', CosdeletionD3Config.chartcolor.UsedBandwidthStrokeColor).style("stroke-width", CosdeletionD3Config.chartcolor.UsedBandwidthStrokeWidth);
+ }
+ }
+ d3.select("#" + attrs.id + " path#cosdeletionpath-remaining").style('stroke', CosdeletionD3Config.chartcolor.RemainingBandwidthStrokeColor).style("stroke-width", CosdeletionD3Config.chartcolor.RemainingBandwidthStrokeWidth);
+ }
+ };
+
+ function tweenPie(b) {
+ var i = d3.interpolate({
+ startAngle: 2.1 * Math.PI,
+ endAngle: 2.1 * Math.PI
+ }, b);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+ }
+ };
+ }]);
+angular.module('att.charts.cosmultichartD3', ['att.charts.utilities'])
+ .constant("CosMultiChartD3Config",
+ {
+ "chartcolor": {
+ "paletteColors": ["#44c6f7", "#4ba90b", "#d70e80", "#ff9900", "#81017e", "#cccccc"], //default color options for rendering chart baseColor and NeedleColor,
+ "zeroTicketColor": ["#d3d3d3"]
+ },
+ "defaultcenterlabel": "CoS",
+ "defaultcentercategory": "2V/2/3/4/5",
+ "zoomLevel": "25",
+ "doughnutratio": 20,
+ "animduration": "300",
+ "legendreqd": "false",
+ "initduration": "1000",
+ "legendposition": "top",
+ "centerTextValueDy": "0",
+ "centerTextValueDx": "0",
+ "centerTextPercentDx": "22",
+ "centerTextPercentDy": "-8",
+ "centerTextLabelDy": "20",
+ "centerTextLabelDx": "0",
+ "arcOverMargin": 5
+ })
+ .directive('attCosmultid3Chart', ['CosMultiChartD3Config', '$timeout','$extendObj', function (CosMultiChartD3Config, $timeout,$extendObj) {
+ return {
+ restrict: 'A',
+ scope: {
+ chartData: '=',
+ chartConfig: '='
+ },
+ templateUrl: 'template/cosmultichartD3/attCosmultid3Chart.html',
+ transclude: true,
+ replace: true,
+ controller: ['$scope', '$attrs', function ($scope, $attrs) {
+
+ if (angular.isDefined($scope.chartConfig)) {
+ CosMultiChartD3Config = $extendObj.extendDeep(CosMultiChartD3Config, $scope.chartConfig);
+ }
+
+ $scope.addLegendColor = function (id, item) {
+ return {"color": CosMultiChartD3Config.chartcolor.paletteColors[id]};
+ };
+
+ $scope.chartID = $attrs.id;
+ if (!angular.isDefined($attrs.legendRequired)) {
+ $scope.legendRequired = CosMultiChartD3Config.legendreqd;
+ } else {
+ $scope.legendRequired = $attrs.legendRequired;
+ }
+ if (!angular.isDefined($attrs.legendPosition)) {
+ $scope.legendPosition = CosMultiChartD3Config.legendposition;
+ } else {
+ $scope.legendPosition = $attrs.legendPosition;
+ }
+ }],
+ link: function (scope, element, attrs) {
+ var zoom = parseInt(CosMultiChartD3Config.zoomLevel, 0),
+ pi = Math.PI,
+ margin = {// optionally set margins
+ top: zoom,
+ right: zoom,
+ bottom: zoom,
+ left: zoom
+ },
+ width = attrs.chartWidth,
+ height = attrs.chartHeight,
+ radius = Math.min(
+ width - (margin.left + margin.right),
+ height - (margin.top + margin.bottom)) / 2;
+
+ function renderChart() {
+ var color = d3.scale.ordinal().range(CosMultiChartD3Config.chartcolor.paletteColors);
+ d3.select("svg#" + attrs.id).remove();
+ d3.selectAll("svg#" + attrs.id + " > *").remove();
+ var totalCosVal = 0, remainingCosVal;
+ for (var j = 0; j < scope.chartData.length; j++) {
+ var chartObj = scope.chartData[j];
+ totalCosVal = (totalCosVal + parseInt(chartObj.value, 10));
+ }
+ remainingCosVal = 100 - parseInt(totalCosVal, 10);
+ var data = angular.copy(scope.chartData);
+ if (angular.isDefined(remainingCosVal)) {
+ data.push({name: "rest", value: remainingCosVal});
+ }
+ element[0].querySelector('.cosmultid3Container').setAttribute('id', attrs.id);
+ // build chart
+ var svg = d3.select(".cosmultid3Container#" + attrs.id)
+ .attr("style", "height: " + attrs.chartHeight + "px;")
+ .append("svg")
+ .attr("id", attrs.id)
+ .attr("width", "100%")
+ .attr("height", "100%")
+ .attr('viewBox', '0 0 ' + Math.min(width, height) + ' ' + Math.min(width, height))
+ .attr('preserveAspectRatio', 'xMinYMin')
+ .append("g")
+ .attr("transform", "translate(" + Math.min(width, height) / 2 + "," + Math.min(width, height) / 2 + ")");
+ // set radius
+ var arc = d3.svg.arc()
+ .innerRadius(radius - CosMultiChartD3Config.doughnutratio)
+ .outerRadius(radius);
+ // set hovered radius
+ var arcOver = d3.svg.arc()
+ .innerRadius(radius - CosMultiChartD3Config.doughnutratio)
+ .outerRadius(radius + CosMultiChartD3Config.arcOverMargin);
+ // add center text element
+ var centerTextValue = svg.append("text")
+ .attr("y", CosMultiChartD3Config.centerTextValueDy)
+ .attr("x", CosMultiChartD3Config.centerTextValueDx)
+ .attr("class", "cosmultichartcenterValue");
+ var centerTextPercent = svg.append("text")
+ .attr("x", CosMultiChartD3Config.centerTextPercentDx)
+ .attr("y", CosMultiChartD3Config.centerTextPercentDy)
+ .attr("class", "cosmultichartcenterPercent");
+ var centerTextLabel = svg.append("text")
+ .attr("y", CosMultiChartD3Config.centerTextLabelDy)
+ .attr("x", CosMultiChartD3Config.centerTextLabelDx)
+ .attr("class", "cosmultichartcenterLabel");
+ centerTextValue.text(totalCosVal);
+ centerTextPercent.text("%");
+ centerTextLabel.text(CosMultiChartD3Config.defaultcenterlabel +" " + CosMultiChartD3Config.defaultcentercategory);
+
+ if (totalCosVal <= 0) {
+ arc.startAngle(0).endAngle(2 * pi); //just radians
+ svg.append("path")
+ .attr("d", arc)
+ .attr("fill", CosMultiChartD3Config.chartcolor.zeroTicketColor);
+ } else {
+ var pie = d3.layout.pie()
+ .sort(null)
+ .startAngle(3.2 * Math.PI)
+ .endAngle(5.2 * Math.PI)
+ .value(function (d) {
+ return d.value;
+ });
+
+ var g = svg.selectAll(".arc")
+ .data(pie(data))
+ .enter()
+ .append("g")
+ .attr("class", "arc")
+ .attr("id", function (d, i) {
+ return "cosmultiarc-" + i;
+ })
+ .style("cursor", "pointer");
+
+ g.append("path")
+ .style("fill", function (d) {
+ return color(d.data.name);
+ })
+ .attr("id", function (d, i) {
+ return "cosmultipath-" + i;
+ })
+ .style("stroke", "white")
+ .style("stroke-width", 1)
+ .on("mouseover", function (d) {
+ d3.select(this).transition()
+ .duration(CosMultiChartD3Config.animduration)
+ .attr("d", arcOver);
+ })
+ .on("mouseout", function (d) {
+ d3.select(this).transition()
+ .duration(CosMultiChartD3Config.animduration)
+ .attr("d", arc);
+ })
+ .transition()
+ .ease("exp")
+ .duration(0)
+ .attrTween("d", tweenPie);
+
+
+ }
+ function tweenPie(b) {
+ var i = d3.interpolate({
+ startAngle: 2.1 * Math.PI,
+ endAngle: 2.1 * Math.PI
+ }, b);
+ return function (t) {
+ return arc(i(t));
+ };
+ }
+ }
+
+ scope.$watch('chartConfig', function(value) {
+ if (angular.isDefined(scope.chartConfig)) {
+ CosMultiChartD3Config = $extendObj.extendDeep(CosMultiChartD3Config, scope.chartConfig);
+ }
+
+ renderChart();
+ }, true);
+
+ scope.$watch('chartData', function (value) {
+ renderChart();
+ });
+ }
+ };
+ }]);
+angular.module('att.charts.donutD3', ['att.charts.utilities'])
+ .constant("DonutChartD3Config",
+ {
+ "chartcolor": {
+ "paletteColors": ["#676767", "#96B1D0", "#0B2477", "#FF9900", "#81017D", "#B6BF00", "#DA0081", "#00C7B2"], //default color options for rendering chart
+ "zeroTicketColor": ["#d3d3d3"],
+ "centerTicketCountHoverColor":["#0574AC"]
+ },
+ "zoomlevel": "25",
+ "defaultcenterlabel": "Total",
+ "donutratio": "1.5",
+ "initduration": "1000",
+ "animduration": "300",
+ "legendreqd": "false",
+ "legendposition": "right",
+ "centerTextLabelDy": "20",
+ "clipMargin": "400",
+ "arcOverMargin":10
+ })
+ .directive('attDonutd3Chart', ['DonutChartD3Config', '$timeout','$extendObj', function (DonutChartD3Config, $timeout,$extendObj) {
+ return {
+ restrict: 'A',
+ scope: {
+ chartData: '=',
+ chartColor: '=',
+ chartConfig: '=',
+ refreshChart: '=',
+ onclickcallback: '&',
+ legendclickcallback: '&',
+ centerclickcallback: '&'
+ },
+ templateUrl: 'template/donutD3/attDonutd3Chart.html',
+ transclude: true,
+ replace: true,
+ controller: ['$scope', '$attrs', function ($scope, $attrs) {
+ if (angular.isDefined($scope.chartConfig)) {
+ DonutChartD3Config = $extendObj.extendDeep(DonutChartD3Config,$scope.chartConfig);
+ }
+ var legendColors = [];
+ legendColors = ($scope.chartColor) ? $scope.chartColor : DonutChartD3Config.chartcolor.paletteColors;
+ $scope.addLegendColor = function (id, item) {
+ if (item.value > 0) {
+ return {"color": legendColors[id]};
+ } else {
+ return {"color": DonutChartD3Config.chartcolor.zeroTicketColor};
+ }
+ };
+ $scope.chartID = $attrs.id;
+ if (!angular.isDefined($attrs.legendRequired)) {
+ $scope.legendRequired = DonutChartD3Config.legendreqd;
+ } else {
+ $scope.legendRequired = $attrs.legendRequired;
+ }
+ if (!angular.isDefined($attrs.legendPosition)) {
+ $scope.legendPosition = DonutChartD3Config.legendposition;
+ } else {
+ $scope.legendPosition = $attrs.legendPosition;
+ }
+ $scope.addStyle = function (elem) {
+ if ($scope.legendRequired && angular.isDefined($scope.legendPosition)) {
+ if ($attrs.legendPosition === "right") {
+ return "floatLeft";
+ } else {
+ if (elem === 'chartLegend')
+ {
+ return "floatLeft";
+ }
+ else
+ {
+ return "floatRight";
+ }
+ }
+ } else {
+ return "floatLeft";
+ }
+ };
+ }],
+ link: function (scope, element, attrs) {
+ scope.$watch('refreshChart', function () {
+ if (angular.isDefined(scope.refreshChart)) {
+ if (scope.refreshChart !== true)
+ {
+ return;
+ } else {
+ for (var j = 0; j < scope.chartData.length; j++) {
+ var chartObj =scope.chartData[j];
+ var className = (chartObj.name).replace(/ /g, "").toUpperCase();
+ angular.element(document.querySelector("[chart-legend-id=" + className + "]")).removeClass("active");
+ }
+
+ }
+
+ }
+
+ if (angular.isDefined(scope.chartConfig)) {
+ DonutChartD3Config = $extendObj.extendDeep(DonutChartD3Config, scope.chartConfig);
+ }
+ d3.select("svg#" + attrs.id).remove();
+ d3.selectAll("svg#" + attrs.id + " > *").remove();
+ var selectedPath = "",
+ lastSelected,
+ pi = Math.PI;
+ var zoom = parseInt(DonutChartD3Config.zoomlevel, 0),
+ coloroptions = (scope.chartColor) ? scope.chartColor : DonutChartD3Config.chartcolor.paletteColors,
+ defaultcenterlabel = DonutChartD3Config.defaultcenterlabel,
+ totalcount = 0,
+ margin = {// optionally set margins
+ top: zoom,
+ right: zoom,
+ bottom: zoom,
+ left: zoom
+ },
+ // set height and width plus margin so zoomed area is not clipped
+ /* width = parseInt(attrs.chartWidth, 0) - (margin.left + margin.right),
+ height = parseInt(attrs.chartHeight, 0) - (margin.top + margin.bottom),
+ radius = Math.min(
+ width - (margin.left + margin.right),
+ height - (margin.top + margin.bottom)) / 2,*/
+ width = attrs.chartWidth,
+ height = attrs.chartHeight,
+ radius = Math.min(
+ width - (margin.left + margin.right),
+ height - (margin.top + margin.bottom)) / 2,
+ color = d3.scale.ordinal().range(coloroptions);
+ if (angular.isDefined(scope.chartData)) {
+ for (var i in scope.chartData) {
+ if (angular.isDefined(scope.chartData[i].value)) {
+ totalcount = (totalcount + parseInt(scope.chartData[i].value, 10));
+ }
+ }
+ }
+
+ var data=[];
+ for (var z = 0; z < scope.chartData.length; z++) {
+ var chartElem =scope.chartData[z];
+ if(chartElem.value <= 0){
+ data.push({index: z, value: chartElem.value});
+ }
+ }
+ var chartStyle = d3.select(".chartContainer#" + attrs.id)
+ .attr("style");
+ var chart = d3.select(".chartContainer#" + attrs.id)
+ .attr("style", "height: " + attrs.chartHeight + "px;width:" + attrs.chartWidth + "px;")
+ .append("svg")
+ .attr("id", attrs.id)
+ .attr("width", '100%')
+ .attr("height", '100%')
+ .attr('viewBox', '0 0 ' + Math.min(width, height) + ' ' + Math.min(width, height))
+ .attr('preserveAspectRatio', 'xMinYMin')
+ .append("g")
+ .attr("transform", "translate(" + Math.min(width, height) / 2 + "," + Math.min(width, height) / 2 + ")");
+ // set radius
+ var arc = d3.svg.arc()
+ .innerRadius(radius / DonutChartD3Config.donutratio)
+ .outerRadius(radius);
+ // add center text element
+ var centerTextValue = chart.append("text")
+ .attr("class", "donutcenterValue")
+ .attr("id", attrs.id + "count")
+ .on("click", function (d) {
+ var value = d3.select("g > text#" + attrs.id + "count").text();
+ var label = d3.select("g > text#" + attrs.id + "category").text();
+ if (angular.isDefined(scope.onclickcallback)) {
+ scope.centerclickcallback({count: value, category: label});
+ }
+ });
+ var centerTextLabel = chart.append("text")
+ .attr("y", DonutChartD3Config.centerTextLabelDy)
+ .attr("class", "donutcenterLabel")
+ .attr("id", attrs.id + "category");
+
+ centerTextValue.text(totalcount);
+ centerTextLabel.text(defaultcenterlabel);
+ if (totalcount <= 0) {
+ arc.startAngle(0).endAngle(2 * pi); //just radians
+ chart.append("path")
+ .attr("d", arc)
+ .attr("fill", DonutChartD3Config.chartcolor.zeroTicketColor);
+ } else {
+ // set hovered radius
+ var arcOver = d3.svg.arc()
+ .innerRadius(radius / DonutChartD3Config.donutratio)
+ .outerRadius(radius + DonutChartD3Config.arcOverMargin);
+ var pie = d3.layout.pie()
+ .sort(null)
+ .startAngle(1.1 * Math.PI)
+ .endAngle(3.1 * Math.PI)
+ .value(function (d) {
+ return d.value;
+ });
+ var g = chart.selectAll(".arc")
+ .data(pie(scope.chartData))
+ .enter()
+ .append("g")
+ .attr("class", "arc")
+ .style("cursor", "pointer");
+ // set fill color and animate tween
+ g.append("path")
+ .style("fill", function (d) {
+ return color(d.data.name);
+ })
+ .attr("path-id",function (d, i) {
+ return "b-" + i;
+ })
+ .style("stroke", "white")
+ .style("stroke-width", 1)
+ .on("mouseover", function (d) {
+ d3.select(this).transition()
+ .duration(DonutChartD3Config.animduration)
+ .attr("d", arcOver);
+
+ centerTextValue.text(d3.select(this).datum().data.value);
+ centerTextLabel.text(d3.select(this).datum().data.name);
+ var className = d3.select(this).datum().data.name.replace(/ /g, "").toUpperCase();
+ angular.element(document.querySelector("[chart-legend-id=" + className + "]")).addClass("active");
+ })
+ .on("mouseout", function (d) {
+ if (!this.getAttribute("clicked")) {
+ d3.select(this).transition()
+ .duration(DonutChartD3Config.animduration)
+ .attr("d", arc);
+ if (selectedPath.length === 0) {
+ centerTextValue.text(totalcount);
+ centerTextLabel.text(defaultcenterlabel);
+ } else {
+ centerTextValue.text(selectedPath.datum().data.value);
+ centerTextLabel.text(selectedPath.datum().data.name);
+ }
+ var className = d3.select(this).datum().data.name.replace(/ /g, "").toUpperCase();
+ angular.element(document.querySelector("[chart-legend-id=" + className + "]")).removeClass("active");
+ } else if (angular.isDefined(lastSelected) && lastSelected!=="") {
+ lastSelected.transition()
+ .duration(DonutChartD3Config.animduration)
+ .attr("d", arc);
+ if (angular.isDefined(lastSelected)) {
+ var prevclassName = lastSelected.datum().data.name.replace(/ /g, "").toUpperCase();
+ angular.element(document.querySelector("[chart-legend-id=" + prevclassName + "]")).removeClass("active");
+ }
+ }
+ })
+ .on("click", function (d, i) {
+ if (angular.isDefined(scope.onclickcallback)) {
+ scope.onclickcallback({name: d3.select(this).datum().data.name, value: d3.select(this).datum().data.value});
+ }
+ if (!this.getAttribute("clicked")) {
+ this.setAttribute("clicked", "clicked");
+ if (selectedPath !== "") {
+ lastSelected = selectedPath;
+ selectedPath[0][0].removeAttribute("clicked");
+ }
+ selectedPath = d3.select(this);
+ } else {
+ if (this.getAttribute("path-id") === selectedPath.attr("path-id")) {
+ selectedPath[0][0].removeAttribute("clicked");
+ selectedPath = "";
+ }
+ }
+
+ })
+ .transition()
+ .ease("exp")
+ .duration(DonutChartD3Config.initduration)
+ .attrTween("d", tweenPie);
+ // animate function
+ scope.legendMouseOver = function (item, id, e) {
+ selectedId="b-"+id;
+ if (item.value > 0) {
+ scope.LegendClass = "";
+ this.LegendClass = "active";
+ centerTextValue.text(item.value);
+ centerTextLabel.text(item.name);
+ d3.selectAll(".chartContainer#"+attrs.id+" "+"path").each(function(d, i) {
+ if(this.getAttribute("path-id")==selectedId){
+ d3.select(this).transition()
+ .duration(DonutChartD3Config.animduration)
+ .attr("d", arcOver);
+ }
+ });
+
+ d3.select("#TicketGraphcount").style('fill',DonutChartD3Config.chartcolor.centerTicketCountHoverColor);
+ }
+ };
+ scope.legendMouseLeave = function (item, id, e) {
+ selectedId="b-"+id;
+ hoveredLegendItem=this;
+ if (item.value > 0) {
+ if (selectedPath.length === 0) {
+ centerTextValue.text(totalcount);
+ centerTextLabel.text(defaultcenterlabel);
+ } else {
+ centerTextValue.text(selectedPath.datum().data.value);
+ centerTextLabel.text(selectedPath.datum().data.name);
+ }
+ d3.selectAll(".chartContainer#"+attrs.id+" "+"path").each(function(d, i) {
+ if(this.getAttribute("path-id")==selectedId){
+ if(this.getAttribute("clicked")===null){
+ hoveredLegendItem.LegendClass = "";
+ d3.select(this).transition().duration(DonutChartD3Config.animduration).attr("d", arc);
+ }
+ }
+ });
+ d3.select("#TicketGraphcount").style('fill', "#000");
+
+ }
+ };
+ }
+ function tweenPie(b) {
+ var i = d3.interpolate({
+ startAngle: 1.1 * Math.PI,
+ endAngle: 1.1 * Math.PI
+ }, b);
+ return function (t) {
+ return arc(i(t));
+ };
+ }
+ $timeout(function () {
+ var h = element.find("ul")[0].clientHeight,
+ fHeight = (parseInt(height, 10) - h),
+ className = scope.addStyle('chartContainer');
+ fHeight = (fHeight < 0) ? 0 : fHeight;
+ angular.element(element[0].querySelector('.chartContainer')).addClass(className);
+ angular.element(element[0].querySelector(".chartLegend")).css({
+ "margin-top": (fHeight / 2) + "px"
+ });
+ }, 200);
+ for (var k = 0; k < data.length; k++) {
+ var index =data[k].index;
+ var zeroValIndex="b-"+index;
+ if(data[k].value <= 0){
+ removeStrokelines(zeroValIndex);
+ }
+
+ }
+
+ function removeStrokelines(zeroValIndex){
+ d3.selectAll(".chartContainer#"+attrs.id+" "+"path").each(function(d, i) {
+ if(this.getAttribute("path-id")==zeroValIndex){
+ d3.select(this).style('stroke', "").style("stroke-width", "");
+ }
+ });
+ }
+ scope.refreshChart = false;
+ });
+
+ }
+ };
+ }])
+ .filter('filterData', function () {
+ return function (input) {
+ return input.replace(/ /g, "").toUpperCase();
+ };
+ });
+angular.module('att.charts.donutFusion', [])
+ .constant("DonutChartFusionConfig",
+ {
+ "chart": {
+ "caption": "Tickets",
+ "startingAngle": 0,
+ "theme": "fist",
+ "captionPadding": "0",
+ "paletteColors": "#FF0066,#00CCFF,#00CC66,#6699FF,#000099,#660066,#FF6600,#4D4D4D", //default color options for rendering chart
+ "enableSmartLabels": "0",
+ "enableMultiSlicing": "1",
+ "donutRadius": "65",
+ "pieRadius": "110",
+ "showLabels": "0",
+ "showValues": "0",
+ "showBorder": "0",
+ "showpercentintooltip": "0",
+ "bgcolor": "#FFFFFF",
+ "defaultCenterLabel": "Total",
+ "showshadow": 0,
+ "centerLabel": "$value $label",
+ "plotHoverEffect": 1,
+ "plotBorderHoverDashGap": "50",
+ "enableRotation": "0",
+ "baseFont": "Arial",
+ "baseFontColor": "#666666",
+ "use3DLighting": "0",
+ "numbersuffix": "",
+ "defaultAnimation": "0",
+ "showValuesOnHover": 0
+ }
+ })
+ .directive('attDonutfusionChart', ['DonutChartFusionConfig', '$timeout', function (DonutChartFusionConfig, $timeout) {
+ 'use strict';
+ return {
+ restrict: 'A',
+ scope: {
+ chartData: '=',
+ onclickcallback: '&'
+ },
+ templateUrl: 'template/donutFusion/attDonutfusionChart.html',
+ transclude: true,
+ replace: true,
+ link: function (scope, element, attrs, controller, transclude) {
+ var totalItems = 0;
+ if (angular.isDefined(scope.chartData)) {
+ for (var i in scope.chartData) {
+ if(angular.isDefined(scope.chartData[i].value)){
+ totalItems = (totalItems + parseInt(scope.chartData[i].value, 10));
+ }
+ }
+ }
+ DonutChartFusionConfig.data = scope.chartData;
+ var donutChartDataSource = DonutChartFusionConfig;
+ var defaultCenterLabelText;
+ defaultCenterLabelText = totalItems + ' ' + DonutChartFusionConfig.chart.defaultCenterLabel;
+ donutChartDataSource.chart.defaultCenterLabel = defaultCenterLabelText;
+
+ var initChart = function () {
+ FusionCharts.ready(function () {
+ var donutChart = new FusionCharts({
+ type: 'doughnut2d',
+ renderAt: "donutFusionChart",
+ //width: '100%',
+ width: attrs.chartWidth,
+ height: attrs.chartHeight,
+ dataFormat: 'json',
+ dataSource: donutChartDataSource,
+ events: {
+ //dataPlotRollOver event is raised whenever you hover over a data plot (column, anchor of line or area, pie etc.)
+ "dataPlotRollOver": function (evtObj, argumentsObject) {
+ var selectedLabelArr = argumentsObject.toolText.split(",");
+ var className = selectedLabelArr[0].replace(/ /g, "").toUpperCase();
+ angular.element(document.querySelector("[chart-legend-id=" + className + "_fusion" + "]")).addClass("active");
+ },
+ "dataPlotRollOut": function (evtObj, argObj) {
+ var selectedLabelArr = argObj.toolText.split(",");
+ var className = selectedLabelArr[0].replace(/ /g, "").toUpperCase();
+ angular.element(document.querySelector("[chart-legend-id=" + className + "_fusion" + "]")).removeClass("active");
+ },
+ "dataPlotClick": function (evtObj, argObj) {
+ if(angular.isDefined(scope.onclickcallback)){
+ scope.onclickcallback({evtObj:evtObj, argObj:argObj});
+ }
+ }
+ }
+ });
+ donutChart.render();
+ DonutChartFusionConfig.chart.defaultCenterLabel = DonutChartFusionConfig.chart.defaultCenterLabel;
+ });
+ };
+ initChart();
+ $timeout(function () {
+ var w = element.find("ul")[0].clientHeight,
+ fWidth = (parseInt(attrs.chartHeight, 10) - w);
+ element.find("ul").css("margin-top", (fWidth / 2) + "px");
+
+ }, 200);
+ },
+ controller: function ($scope, $element, $attrs) {
+ var legendColors = [];
+ legendColors = DonutChartFusionConfig.chart.paletteColors.split(",");
+ $scope.addLegendColor = function (id) {
+ return {"color": legendColors[id]};
+ };
+ $scope.legendRequired = $attrs.legendRequired;
+
+ $scope.addStyle = function (elem) {
+ if ($scope.legendRequired && angular.isDefined($attrs.legendPosition)) {
+ if ($attrs.legendPosition === "right") {
+ if (elem === 'chartLegend')
+ {
+ return {"float": "left"};
+ }
+ else
+ {
+ return {"float": "left"};
+ }
+ } else {
+ if (elem === 'chartLegend')
+ {
+ return {"float": "left"};
+ }
+ else
+ {
+ return {"float": "right"};
+ }
+ }
+ } else {
+ return {"float": "left"};
+ }
+ };
+ }
+ };
+ }])
+ .filter('filterData', function () {
+ return function (input) {
+ return input.replace(/ /g, "").toUpperCase();
+ };
+ });
+angular.module('att.charts.horseshoeD3', ['att.charts.utilities'])
+ .constant("HorseShoeChartD3Config",
+ {
+ "chartcolor": {
+ "paletteColors": ["#1072b8", "#FEFFF7"], //default color options for rendering chart baseColor and NeedleColor,
+ "paletteBorderColors": ["#1072b8", "#000"]
+ },
+ "defaultcenterlabel": "COS 1",
+ "defaultcentercategory": "Real Time",
+ "animduration": 500,
+ "legendreqd": "false",
+ "legendposition": "top",
+ "centerTextLabelDy": "20"
+ })
+ .directive('attHorseshoed3Chart', ['HorseShoeChartD3Config', '$timeout','$extendObj', function (HorseShoeChartD3Config, $timeout,$extendObj) {
+ return {
+ restrict: 'A',
+ scope: {
+ chartConfig: '=',
+ initVal: '=',
+ horseShoeId: '@'
+ },
+ templateUrl: 'template/horseshoeD3/attHorseshoeD3Chart.html',
+ transclude: true,
+ replace: true,
+ controller: ['$scope', '$attrs',function ($scope, $attrs) {
+ if (angular.isDefined($scope.chartConfig)) {
+ HorseShoeChartD3Config = $extendObj.extendDeep(HorseShoeChartD3Config, $scope.chartConfig);
+ }
+ var legendColor = [];
+ legendColor = HorseShoeChartD3Config.chartcolor.paletteColors;
+ $scope.addLegendColor = function () {
+ return {"color": legendColor[0]};
+ };
+ if (!angular.isDefined($attrs.legendRequired)) {
+ $scope.legendRequired = HorseShoeChartD3Config.legendreqd;
+ } else {
+ $scope.legendRequired = $attrs.legendRequired;
+ }
+ if (!angular.isDefined($attrs.legendPosition)) {
+ $scope.legendPosition = HorseShoeChartD3Config.legendposition;
+ } else {
+ $scope.legendPosition = $attrs.legendPosition;
+ }
+ }],
+ link: function (scope, element, attrs) {
+ var radius = Math.min(attrs.chartWidth, attrs.chartHeight) / 2;
+ scope.LegendLabel = HorseShoeChartD3Config.defaultcenterlabel;
+ scope.LegendCategory = HorseShoeChartD3Config.defaultcentercategory;
+ var duration = HorseShoeChartD3Config.animduration,
+ guageVal = parseInt(scope.initVal.value, 10);
+ scope.guageVal = guageVal + "%";
+ var dataset = {
+ lower: calcPercent(0),
+ upper: calcPercent(guageVal)
+ },
+ pie = d3.layout.pie().sort(null),
+ format = d3.format(".0%");
+ var arc = d3.svg.arc()
+ .innerRadius(radius - 20)
+ .outerRadius(radius)
+ .startAngle(function (d) {
+ return d.startAngle + 2.6 * Math.PI / 2;
+ })
+ .endAngle(function (d) {
+ return d.endAngle + 2.6 * Math.PI / 2;
+ });
+
+ element[0].querySelector('.horseshoed3Container').setAttribute('id', scope.horseShoeId);
+
+ var svg = d3.select(".horseshoed3Container#" + scope.horseShoeId)
+ .attr("style", "height: " + attrs.chartHeight + "px;")
+ .append("svg")
+ .attr("id", scope.horseShoeId)
+ .attr("width", "100%")
+ .attr("height", "100%")
+ .attr('viewBox', '0 0 ' + Math.min(attrs.chartWidth, attrs.chartHeight) + ' ' + Math.min(attrs.chartWidth, attrs.chartHeight))
+ .attr('preserveAspectRatio', 'xMinYMin')
+ .append("g")
+ .attr("transform", "translate(" + Math.min(attrs.chartWidth, attrs.chartHeight) / 2 + "," + Math.min(attrs.chartWidth, attrs.chartHeight) / 2 + ")");
+ var path = svg.selectAll("path")
+ .data(pie(dataset.lower))
+ .enter().append("path")
+ .attr("class", function (d, i) {
+ return "color" + i;
+ })
+ .attr("fill", HorseShoeChartD3Config.chartcolor.paletteColors[1])
+ .attr("stroke", HorseShoeChartD3Config.chartcolor.paletteBorderColors[1])
+ .attr("d", arc)
+ .each(function (d) {
+ this._current = d;
+ }); // store the initial values
+ // add center text element
+ var centerTextValue = svg.append("text")
+ .attr("class", "horseshoecenterValue");
+ var centerTextLabel = svg.append("text")
+ .attr("y", HorseShoeChartD3Config.centerTextLabelDy)
+ .attr("class", "horseshoecenterLabel");
+ if (typeof (guageVal) === "string") {
+ centerTextValue.text(guageVal);
+ centerTextLabel.text(HorseShoeChartD3Config.defaultcenterlabel + "(" + HorseShoeChartD3Config.defaultcentercategory + ")");
+ }
+ else {
+ var progress = 0;
+ var timeout = setTimeout(function () {
+ clearTimeout(timeout);
+ path = path.data(pie(dataset.upper)); // update the data
+ path.transition().duration(duration).attrTween("d", function (a, index) {
+ angular.element(this)
+ .attr("fill", HorseShoeChartD3Config.chartcolor.paletteColors[index])
+ .attr("stroke", HorseShoeChartD3Config.chartcolor.paletteBorderColors[index]);
+
+ var i = d3.interpolate(this._current, a);
+ var i2 = d3.interpolate(progress, guageVal);
+ this._current = i(0);
+ return function (t) {
+ centerTextValue.text(format(i2(t) / 100));
+ centerTextLabel.text(HorseShoeChartD3Config.defaultcenterlabel + "(" + HorseShoeChartD3Config.defaultcentercategory + ")");
+ return arc(i(t));
+ };
+ }); // redraw the arcs
+
+ }, 200);
+ }
+ scope.$watch('initVal', function (value) {
+ scope.guageVal = value.value + "%";
+ path.data(pie(calcPercent(value.value)));
+ path.transition().duration(duration).attrTween("d", function (a, index) {
+ angular.element(this)
+ .attr("fill", HorseShoeChartD3Config.chartcolor.paletteColors[index])
+ .attr("stroke", HorseShoeChartD3Config.chartcolor.paletteBorderColors[index]);
+
+ var i = d3.interpolate(this._current, a);
+ var i2 = d3.interpolate(progress, value.value);
+ this._current = i(0);
+ return function (t) {
+ centerTextValue.text(format(i2(t) / 100));
+ centerTextLabel.text(HorseShoeChartD3Config.defaultcenterlabel + "(" + HorseShoeChartD3Config.defaultcentercategory + ")");
+ return arc(i(t));
+ };
+ }); // redraw the arcs
+
+ });
+ function calcPercent(guageVal) {
+ return [guageVal, 100 - guageVal];
+ }
+
+ }
+ };
+ }]);
+angular.module('att.charts.radialguageD3', ['att.charts.utilities'])
+ .constant("RadialGuageChartD3Config",
+ {
+ "chartcolor": {
+ "MaxBandwidthReached": ["#efefef"],
+ "ZeroBandwidthSelected": ["#FEFFF7"],
+ "RemainingBandwidthColor": ["#FEFFF7"],
+ "RemainingBandwidthStrokeColor": ["#000000"],
+ "UsedBandwidthColor": ["#1072b8"],
+ "MouseOverArcFillColor": ["#0091d9"],
+ "RemainingBandwidthStrokeWidth":1,
+ "UsedBandwidthStrokeWidth":1,
+ "UsedBandwidthStrokeColor":["#efefef"]
+ },
+ "defaultcenterlabel": "Kbps",
+ "maxAllowedUnitsLabel": "Kbps",
+ "zoomLevel": "25",
+ "doughnutratio": 20,
+ "animduration": "300",
+ "guageStartAngle":4,
+ "guageEndAngle":8.56,
+ "legendreqd": "false",
+ "legendposition": "top",
+ "centerTextLabelDy": "20",
+ "centerTextValueDy": "0",
+ "centerTextValueDx": "0",
+ "centerTextLabelDx": "0",
+ "maxbandwidthTextDx": "65",
+ "maxbandwidthTextDy": "100",
+ "arcOverMargin": 5
+ })
+ .directive('attRadialguaged3Chart', ['RadialGuageChartD3Config', '$timeout','$extendObj', function(RadialGuageChartD3Config, $timeout,$extendObj) {
+ return {
+ restrict: 'A',
+ scope: {
+ maxValue: '=',
+ chartData: '=',
+ chartConfig: '=',
+ resetChart: '=',
+ mouseOver: '=?'
+ },
+ controller: ['$scope', '$attrs', function($scope, $attrs) {
+ if (angular.isDefined($scope.chartConfig)) {
+ RadialGuageChartD3Config = $extendObj.extendDeep(RadialGuageChartD3Config, $scope.chartConfig);
+ }
+
+ }],
+ link: function(scope, element, attrs) {
+ var zoom = parseInt(RadialGuageChartD3Config.zoomLevel, 0),
+ margin = {// optionally set margins
+ top: zoom,
+ right: zoom,
+ bottom: zoom,
+ left: zoom
+ },
+ width = attrs.chartWidth,
+ height = attrs.chartHeight,
+ radius = Math.min(
+ width - (margin.left + margin.right),
+ height - (margin.top + margin.bottom)) / 2;
+ // set radius
+ var arc = d3.svg.arc()
+ .innerRadius(radius - RadialGuageChartD3Config.doughnutratio)
+ .outerRadius(radius);
+ // set hovered radius
+ var arcOver = d3.svg.arc()
+ .innerRadius(radius - RadialGuageChartD3Config.doughnutratio)
+ .outerRadius(radius + RadialGuageChartD3Config.arcOverMargin);
+ // Browser onresize event
+ window.onresize = function() {
+ scope.$apply();
+ };
+
+ scope.$watch('mouseOver', function(val) {
+ if (!angular.isDefined(scope.mouseOver)) { return; }
+ var id = parseInt(scope.mouseOver.split('-')[1], 10);
+ if (scope.mouseOver.split('-')[0] === 'true') {
+ d3.select('path#radialguagepath-' + (id)).transition()
+ .duration(parseInt(RadialGuageChartD3Config.animduration,10))
+ .attr('d', arcOver);
+
+ } else {
+ d3.select('path#radialguagepath-' + (id)).transition()
+ .duration(parseInt(RadialGuageChartD3Config.animduration,10))
+ .attr('d', arc);
+ }
+ });
+
+ scope.$watch('resetChart', function() {
+ if (angular.isDefined(scope.resetChart)) {
+ if (angular.isDefined(scope.chartData)) {
+ scope.render(scope.chartData, scope.chartData);
+ }
+ scope.resetChart = false;
+ }
+ });
+ scope.$watch('chartData', function(newValue, oldValue) {
+ return scope.render(newValue, oldValue);
+ }, true);
+ scope.render = function(newValue, oldValue) {
+ d3.select("svg#" + attrs.id).remove();
+ d3.selectAll("svg#" + attrs.id + " > *").remove();
+ if (!scope.chartData)
+ {
+ return;
+ }
+ var color, selectedSlider, totalBandwidth = 0, totalUsed = 0, remainingBandwidth = 0;
+ if (angular.isDefined(scope.maxValue)) {
+ totalBandwidth = parseInt(scope.maxValue, 0);
+ }
+ angular.forEach(newValue, function(val, key) {
+ totalUsed = (totalUsed + parseInt(val.value, 10));
+ if (newValue[key].value !== oldValue[key].value) {
+ selectedSlider = key;
+ }
+ });
+ var data = angular.copy(scope.chartData);
+ if (totalUsed < totalBandwidth) {
+ remainingBandwidth = totalBandwidth - parseInt(totalUsed, 0);
+ data.push({name: "remaining", value: remainingBandwidth});
+ }
+ element[0].setAttribute('id', attrs.id);
+ var svg = d3.select(element[0])
+ .attr("style", "height: " + attrs.chartHeight + "px;")
+ .append("svg")
+ .attr("id", attrs.id)
+ .attr("width", "100%")
+ .attr("height", "100%")
+ .attr('viewBox', '0 0 ' + Math.min(width, height) + ' ' + Math.min(width, height))
+ .attr('preserveAspectRatio', 'xMinYMin')
+ .append("g")
+ .attr("transform", "translate(" + Math.min(width, height) / 2 + "," + Math.min(width, height) / 2 + ")");
+
+ var centerTextValue = svg.append("text")
+ .attr("y", RadialGuageChartD3Config.centerTextValueDy)
+ .attr("x", RadialGuageChartD3Config.centerTextValueDx)
+ .attr("class", "radialguagecenterValue");
+ var centerTextLabel = svg.append("text")
+ .attr("y", RadialGuageChartD3Config.centerTextLabelDy)
+ .attr("x", RadialGuageChartD3Config.centerTextLabelDx)
+ .attr("class", "radialguagecenterLabel");
+ var maxbandwidthText = svg.append("text")
+ .attr("y", RadialGuageChartD3Config.maxbandwidthTextDy)
+ .attr("x", RadialGuageChartD3Config.maxbandwidthTextDx)
+ .attr("class", "radialmaxbandwidthText");
+ if (totalUsed > totalBandwidth) {
+ totalUsed = totalBandwidth;
+ data = [
+ {
+ name: "totalUsed",
+ value: "100"
+ }
+ ];
+ color = d3.scale.ordinal().range(RadialGuageChartD3Config.chartcolor.MaxBandwidthReached);
+ } else if (totalUsed <= 0) {
+ data = [
+ {
+ name: "totalUnUsed",
+ value: "100"
+ }
+ ];
+ color = d3.scale.ordinal().range(RadialGuageChartD3Config.chartcolor.ZeroBandwidthSelected);
+
+ } else {
+ var Colorpalette = [];
+ if (newValue === oldValue) {
+ data = [
+ {
+ name: "totalUsed",
+ value: totalUsed
+ }
+ ];
+ if (remainingBandwidth > 0) {
+ data.push({name: "remaining", value: remainingBandwidth});
+ }
+ }
+ for (var j = 0; j < data.length - 1; j++) {
+ Colorpalette[j] = RadialGuageChartD3Config.chartcolor.UsedBandwidthColor;
+ }
+ if (remainingBandwidth > 0) {
+ Colorpalette.push(RadialGuageChartD3Config.chartcolor.RemainingBandwidthColor);
+ }
+ color = d3.scale.ordinal().range(Colorpalette);
+ }
+
+ centerTextValue.text(totalUsed);
+ centerTextLabel.text(RadialGuageChartD3Config.defaultcenterlabel);
+ maxbandwidthText.text(totalBandwidth + " " + RadialGuageChartD3Config.maxAllowedUnitsLabel);
+ var pie = d3.layout.pie()
+ .sort(null)
+ .startAngle(RadialGuageChartD3Config.guageStartAngle)
+ .endAngle(RadialGuageChartD3Config.guageEndAngle)
+ .value(function(d) {
+ return d.value;
+ });
+
+ var g = svg.selectAll(".arc")
+ .data(pie(data))
+ .enter()
+ .append("g")
+ .attr("class", "arc")
+ .attr("id", function(d, i) {
+ return "radialguagearc-" + i;
+ })
+ .style("cursor", "pointer");
+
+ if (newValue === oldValue) {
+ g.append("path")
+ .style("fill", function(d) {
+ return color(d.data.name);
+ })
+ .attr("id", function(d, i) {
+ return "radialguagepath-" + i;
+ })
+ .transition()
+ .ease("exp")
+ .duration(0)
+ .attrTween("d", tweenPie);
+ } else {
+ g.append("path")
+ .style("fill", function(d) {
+ return color(d.data.name);
+ })
+ .attr("id", function(d, i) {
+ return "radialguagepath-" + i;
+ })
+ .style("stroke", RadialGuageChartD3Config.chartcolor.RemainingBandwidthColor)
+ .style("stroke-width", RadialGuageChartD3Config.chartcolor.UsedBandwidthStrokeWidth)
+ .transition()
+ .ease("exp")
+ .duration(0)
+ .attrTween("d", tweenPie);
+ }
+ if (totalUsed === totalBandwidth || remainingBandwidth > 0) {
+ var count = data.length - 1;
+ d3.select("#" + attrs.id + " path#radialguagepath-" + count).style('stroke', RadialGuageChartD3Config.chartcolor.RemainingBandwidthStrokeColor).style("stroke-width", RadialGuageChartD3Config.chartcolor.RemainingBandwidthStrokeWidth);
+ }
+ if (angular.isDefined(selectedSlider) && remainingBandwidth > 0) {
+
+ d3.select("#" + attrs.id + " path#radialguagepath-" + selectedSlider).transition()
+ .duration(RadialGuageChartD3Config.animduration)
+ .attr("d", arcOver);
+ d3.select("#" + attrs.id + " path#radialguagepath-" + selectedSlider).style('fill', RadialGuageChartD3Config.chartcolor.MouseOverArcFillColor);
+ }
+ function tweenPie(b) {
+ var i = d3.interpolate({
+ startAngle: 2.1 * Math.PI,
+ endAngle: 2.1 * Math.PI
+ }, b);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+
+ };
+
+
+ }
+ };
+ }]);
+angular.module('att.charts.stackedBarchart', ['att.charts.utilities'])
+ .constant("stackBarChartConfig",
+ {
+ "chartcolor": ["#B2B2B2", "#00CC00"],
+ "gridLineColor": "#CCCCCC",
+ "yAxisMaxTicks": 4,
+ "chartHeight": "200",
+ "chartOpacity": 0.3,
+ "amountKDivision": 1000,
+ "amountKText": "K",
+ "amountMDivision": 1000000,
+ "amountMText": "M",
+ "yearLabelPos": {"x": 10, "y": 15},
+ "tooltipTopMargin": 110,
+ "tooltipLeftMargin": 54,
+ "margin": {
+ top: 20,
+ right: 80,
+ bottom: 30,
+ left: 52
+ }
+ })
+ .directive('stackedBarChart', ['stackBarChartConfig', '$extendObj', '$timeout', function (stackBarChartConfig, $extendObj, $timeout) {
+ return {
+ restrict: 'A',
+ scope: {
+ chartData: '=',
+ legendRequired: "=",
+ refreshChart: "=",
+ chartConfig: "="
+ },
+ templateUrl: "template/stackedBarchart/stackedBarchart.html",
+ replace: true,
+ controller: ['$scope', '$attrs', function ($scope, $attrs) {
+ if (angular.isDefined($scope.chartConfig)) {
+ stackBarChartConfig = $extendObj.extendDeep(stackBarChartConfig, $scope.chartConfig);
+ }
+ $scope.chartID = $attrs.id;
+ $scope.legendColors = stackBarChartConfig.chartcolor;
+ $scope.addLegendColor = function (id) {
+ var bgColor = null;
+ bgColor = {"background-color": $scope.legendColors[id]};
+ return bgColor;
+ };
+ }],
+ link: function (scope, element, attrs, ctrl) {
+ scope.tooltipFlag = false;
+ var dataObj, idx = 0, xAxisTicks, margin = stackBarChartConfig.margin,
+ width = parseInt(attrs.chartWidth, 10),
+ height = parseInt(stackBarChartConfig.chartHeight, 10),
+ padding = 20,
+ parseDate = d3.time.format("%d-%b-%Y").parse,
+ tooltipFormat = d3.time.format("%B-%Y"),
+ labelFormat = d3.time.format("%Y");
+ attrs.$observe('legendRequired', function (val) {
+ if (val === 'true') {
+ scope.showLegend = true;
+ }
+ else {
+ scope.showLegend = false;
+ }
+ });
+ scope.$watch('refreshChart', function (value) {
+ if (value === false) {
+ return;
+ }
+
+ if (angular.isDefined(scope.chartConfig)) {
+ stackBarChartConfig = $extendObj.extendDeep(stackBarChartConfig, scope.chartConfig);
+ }
+
+ d3.select("svg#" + attrs.id).remove();
+ d3.selectAll("svg#" + attrs.id + " > *").remove();
+ d3.selectAll("div#stackBarChartContainer" + " > div").remove();
+ if (scope.chartData[0].values.length === 0) {
+ scope.refreshChart = false;
+ return;
+ }
+
+ var xMonth = [], yDomainData = [], yAxisData = [], yValue = [], tempData = [], tooltipData = {}, yearArr = {}, isSingleMonth = false;
+
+ //X-Axis Range
+ var xRange = d3.time.scale().range([padding, width - padding * 2]);
+
+ //Y-Axis Range
+ var yRange = d3.scale.linear().range([height - padding, padding]);
+
+ dataObj = scope.chartData;
+
+ dataObj.forEach(function (data) {
+ var obj = data.values;
+ xAxisTicks = obj.length;
+ if (obj.length == 1) {
+ isSingleMonth = true;
+ }
+ obj.forEach(function (d) {
+ var tmp = "01-" + d.month;
+ d.numericMonth = parseDate(tmp);
+ yValue.push({'value': +d.value});
+ d.value = +d.value;
+ xMonth.push({'numericMonth': d.numericMonth});
+ });
+ });
+
+ //ToolTip Data
+ for (var z = 0; z < dataObj.length; z++) {
+ var tempSeries = dataObj[z].series;
+ for (var j = 0; j < dataObj[z].values.length; j++) {
+ var months = dataObj[z].values[j].month;
+ var tempVal = dataObj[z].values[j].value;
+ var percent = dataObj[z].values[j].percent;
+ tempData.push({"month": months, "series": tempSeries, "value": tempVal, "percent": percent});
+ }
+ }
+
+ for (var k = 0; k < tempData.length; k++) {
+ var seriesName = tempData[k].series;
+ var seriesVal = tempData[k].value;
+ var seriesPer = tempData[k].percent;
+ var tempObj = tooltipData[tempData[k].month];
+ if (!(tempObj)) {
+ tempObj = [];
+ tooltipData[tempData[k].month] = tempObj;
+ tooltipData[tempData[k].month]['seriesPer'] = seriesPer;
+ }
+ tempObj.push({seriesName: seriesName, seriesVal: seriesVal});
+ }
+
+ //X-Axis Domain
+ xRange.domain(d3.extent(xMonth, function (d) {
+ return d.numericMonth;
+ }));
+
+ for (var b = 0; b < tempData.length; b++) {
+ var val = Math.round(parseInt(tempData[b].value, 10) / stackBarChartConfig.yAxisMaxTicks);
+ var Calc = Math.ceil((val / Math.pow(10, ("" + val).length - 1))) * (stackBarChartConfig.yAxisMaxTicks) * Math.pow(10, ("" + val).length - 1);
+ yDomainData.push({'yAxisVal': Calc});
+ }
+
+ //Y-Axis Domain
+ yRange.domain([0, d3.max(yDomainData, function (d) {
+ return (d.yAxisVal);
+ })]);
+
+ var yTick = d3.max(yDomainData, function (d) {
+ return d.yAxisVal;
+ });
+
+ yTick = yTick / stackBarChartConfig.yAxisMaxTicks;
+ for (var x = 0; x <= stackBarChartConfig.yAxisMaxTicks; x++) {
+ yAxisData.push(yTick * x);
+ }
+
+ var formatMoney = function (d) {
+ if (d >= stackBarChartConfig.amountMDivision) {
+ return d / stackBarChartConfig.amountMDivision + stackBarChartConfig.amountMText;
+ } else if (d >= stackBarChartConfig.amountKDivision) {
+ return d / stackBarChartConfig.amountKDivision + stackBarChartConfig.amountKText;
+ } else {
+ return d;
+ }
+ };
+ var xAxis = d3.svg.axis().scale(xRange).orient("bottom").tickFormat(d3.time.format('%b')).ticks(d3.time.months);
+ var xAxisGrid = d3.svg.axis().scale(xRange).orient("top").ticks(d3.time.months).tickFormat('').tickSize(-height + 2 * padding, 0);
+
+ var yAxis = d3.svg.axis().scale(yRange).orient("left").tickValues(yAxisData).ticks(stackBarChartConfig.yAxisMaxTicks).tickFormat(formatMoney);
+ var yAxisGrid = d3.svg.axis().scale(yRange).orient("left").tickValues(yAxisData).ticks(stackBarChartConfig.yAxisMaxTicks).tickSize(-width, 0, 0);
+
+
+ //Calculate values for Stack
+ var stack = d3.layout.stack()
+ .values(function (d) {
+ return d.values;
+ })
+ .x(function (d) {
+ return d.numericMonth;
+ })
+ .y(function (d) {
+ return d.value;
+ });
+
+ //Plot Chart
+ var drawBarChart = d3.select("#stackBarChartContainer")
+ .append("svg")
+ .attr("id", attrs.id)
+ .data(dataObj)
+ .attr("width", width + margin.left + margin.right)
+ .attr("height", parseInt(height, 10) + parseInt(margin.top, 10) + parseInt(margin.bottom, 10))
+ .append("g")
+ .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
+ //Draw X Axis
+ drawBarChart.append("g")
+ .attr("class", "x axis")
+ .attr("transform", "translate(0," + (height - padding) + ")")
+ .call(xAxis);
+
+ if (isSingleMonth) {
+ drawBarChart.select(".x").select(".tick").attr("transform", "translate(" + (isSingleMonth === true) * (width / 2 + 20) + ",0)");
+ }
+
+ //Draw Y Grid Lines
+ var yGrid = drawBarChart.append("g")
+ .attr("class", "grid").attr("id", "stackBarYGrid")
+ .attr("transform", "translate(0,0)")
+ .call(yAxisGrid);
+ yGrid.selectAll("line").style("stroke", stackBarChartConfig.gridLineColor);
+ yGrid.selectAll("text").remove();
+
+ //Plot Bars for multiple Stacks
+ var barGroup = drawBarChart.selectAll(".group")
+ .data(stack(dataObj))
+ .enter().append("g")
+ .attr("class", "group").attr("id", function (d, i) {
+ return ("stackBar" + i);
+ })
+ .attr("transform", "translate(" + (isSingleMonth === true) * width / 2 + ",0)");
+
+ barGroup.append("title").text(function (d) {
+ return d.series;
+ });
+
+ var bars = barGroup.selectAll("rect")
+ .data(function (d) {
+ return d.values;
+ })
+ .enter().append("rect")
+ .attr("class", "bar")
+ .attr("x", function (d) {
+ return (xRange(d.numericMonth) - 10);
+ })
+ .attr("y", function (d) {
+ return yRange(d.value);
+ })
+ .attr("width", "20")
+ .attr("height", function (d) {
+ return ((height - yRange(d.value)) - padding);
+ }).on("mouseover", function (d) {
+ var offsetX = d3.select(this).attr("x");
+ var offsetY = d3.select(this).attr("y");
+ show_tooltip_grid_line(offsetX, "x");
+ drawBarChart.selectAll(".bar").style("fill-opacity", stackBarChartConfig.chartOpacity);
+ d3.select(this).style("fill-opacity", "1");
+ mouseOver(d, offsetX, offsetY);
+ }).on("mouseout", function () {
+ hide_tooltip_grid_line(d3.select(this).attr("x"), "x");
+ scope.tooltipFlag = false;
+ drawBarChart.selectAll(".bar").style("fill-opacity", "1");
+ scope.$apply();
+ });
+
+ bars.append('desc').append('title').text(function (d) {
+ var nvdaObj = tooltipData[d.month];
+ return (addTitle(nvdaObj, d));
+ });
+
+ //Fill color in Bars
+ for (var a = 0; a < dataObj.length; a++) {
+ var rectBars = drawBarChart.select('#stackBar' + a).selectAll('rect');
+ rectBars.attr('fill', scope.legendColors[a]).attr("fill-opacity", "1");
+ }
+
+ // Draw the x Grid lines
+ var xGrid = drawBarChart.append("g")
+ .attr("class", "grid").attr("id", "stackBarXGrid")
+ .attr("transform", "translate(" + (isSingleMonth === true) * width / 2 + ",0)")
+ .call(xAxisGrid);
+
+ xGrid.selectAll("line").attr("transform", "translate(" + -Math.ceil((xRange(2) - xRange(1)) / 2) + "," + padding + ")")
+ .attr("id", function (d, i) {
+ return ("xGridLine" + i);
+ });
+
+ //Draw dual Y axis on change of Year
+ var yAxisObj = dataObj[0].values, yAxisIdx = 0;
+ for (var i = 0; i < yAxisObj.length; i++) {
+ var tmpObj = [];
+
+ tmpObj.push({"year": labelFormat(yAxisObj[i].numericMonth), "transform": xRange(yAxisObj[i].numericMonth)});
+ if (!yearArr[labelFormat(yAxisObj[i].numericMonth)]) {
+ yearArr[labelFormat(yAxisObj[i].numericMonth)] = tmpObj;
+ }
+ }
+ for (var key in yearArr) {
+ var obj = yearArr[key];
+ var yAxisNodes = drawBarChart.append("g")
+ .attr("class", "y axis").attr("id", yAxisId(yAxisIdx))
+ .attr("transform", "translate(" + (obj[0].transform - padding) + ",0)")
+ .call(yAxis);
+
+ yAxisNodes.selectAll("text").attr('class', 'ticktext');
+
+ //Append Year Label
+ yAxisNodes.append("text")
+ .attr("transform", "rotate(0)")
+ .attr("y", stackBarChartConfig.yearLabelPos.y)
+ .attr("x", stackBarChartConfig.yearLabelPos.x)
+ .text(obj[0].year).attr("class", "yearLabel");
+ yAxisIdx++;
+ }
+
+ function yAxisId(yAxisIdx) {
+ return ("yAxis" + yAxisIdx);
+ }
+
+ //function to select first element
+ d3.selection.prototype.first = function () {
+ return d3.select(this[0][0]);
+ };
+
+ //Remove minimum value label form Y Axis
+ var tickLabels = d3.select("#yAxis0").selectAll('.ticktext');
+ //tickLabels.first().remove();
+ d3.select("#yAxis1").selectAll('.ticktext').remove();
+
+ //Add title for NVDA screen reader
+ function addTitle(nvdaObj, d) {
+ var temp = "";
+ for (var y = 0; y < nvdaObj.length; y++) {
+ temp = temp + nvdaObj[y].seriesName + nvdaObj[y].seriesVal;
+ }
+ return (tooltipFormat(d.numericMonth) + "--" + temp + "Retainibility Percentage" + nvdaObj.seriesPer);
+ }
+
+ //MouseOver Event
+ function mouseOver(d, offsetX, offsetY) {
+ for (var key in tooltipData) {
+ if (key == d.month) {
+ scope.stackDataPoint = tooltipData[key];
+ break;
+ }
+ }
+ scope.monthPoint = {"xData": tooltipFormat(d.numericMonth).replace('-', ' ')};
+ scope.$apply();
+ $timeout(function () {
+ offsetY = offsetY - stackBarChartConfig.tooltipTopMargin;
+ var tooltipEl = element.children().eq(2);
+ var tooltipWidth = tooltipEl[0].offsetWidth;
+ if (isSingleMonth) {
+ offsetX = offsetX - (tooltipWidth / 2) + stackBarChartConfig.tooltipLeftMargin + (width / 2);
+ } else {
+ offsetX = offsetX - (tooltipWidth / 2) + stackBarChartConfig.tooltipLeftMargin;
+ }
+ scope.tooltipStyle = {"left": offsetX + "px", "top": offsetY + "px"};
+ scope.tooltipFlag = true;
+ }, 0);
+ }
+
+ //Show Grid Line on Over
+ function show_tooltip_grid_line(offsetX, attr) {
+ var dataLength;
+ dataLength = scope.chartData[0].values.length;
+ for (var i = 0; i < dataLength; i++) {
+ var bar = drawBarChart.selectAll(".bar");
+ if (bar[0][i].getAttribute(attr) === offsetX) {
+ drawBarChart.select("#xGridLine" + i).style("stroke", stackBarChartConfig.gridLineColor);
+ }
+ }
+ }
+
+ //Hide Grid Line
+ function hide_tooltip_grid_line(offsetX, attr) {
+ var dataLength;
+ dataLength = scope.chartData[0].values.length;
+ for (var i = 0; i < dataLength; i++) {
+ var bar = drawBarChart.selectAll(".bar");
+ if (bar[0][i].getAttribute(attr) === offsetX) {
+ drawBarChart.select("#xGridLine" + i).style("stroke", "transparent");
+ }
+ }
+ }
+ scope.refreshChart = false;
+ });
+ }
+ };
+ }])
+ .filter('filterInput', function () {
+ return function (input) {
+ return input.replace(/ +/g, "").toLowerCase();
+ };
+ });
+angular.module('att.charts.stackedareachart', ['att.charts.utilities'])
+ .constant("stackChartConfig",
+ {
+ "chartcolor": ["#9966FF", "#E68A2E", "#4DDB4D"],
+ "gridLineColor": "#808080",
+ "lineCurveType": 'linear',
+ "yAxisMaxTicks": 4,
+ "chartHeight": "200",
+ "shapes": ['circle', 'rect', 'triangle'],
+ "shapeSize": [3, 5, 6],
+ "chartOpacity": 0.6,
+ "yearLabelPos": {"x": 8, "y": -5},
+ "tooltipTopMargin": 100,
+ "tooltipLeftMargin": 42,
+ "yAxisUnitRange": 500000,
+ "margin": {
+ top: 30,
+ right: 80,
+ bottom: 30,
+ left: 52
+ }
+ })
+ .directive('stackedAreaChart', ['stackChartConfig','$extendObj','$timeout', function (stackChartConfig,$extendObj,$timeout) {
+ return {
+ restrict: 'A',
+ scope: {
+ chartData: '=',
+ legendRequired: "=",
+ refreshChart: "=",
+ chartConfig: "="
+ },
+ templateUrl: "template/stackedareachart/stackedAreaChart.html",
+ replace: true,
+ controller: ['$scope', '$attrs', function ($scope, $attrs) {
+ var extendDeep = function extendDeep(dst) {
+ angular.forEach(arguments, function(obj) {
+ if (obj !== dst) {
+ angular.forEach(obj, function(value, key) {
+ if (dst[key] && dst[key].constructor && dst[key].constructor === Object) {
+ extendDeep(dst[key], value);
+ } else {
+ dst[key] = value;
+ }
+ });
+ }
+ });
+ return dst;
+ };
+ if (angular.isDefined($scope.chartConfig)) {
+ stackChartConfig = $extendObj.extendDeep(stackChartConfig, $scope.chartConfig);
+ }
+ $scope.chartID = $attrs.id;
+ $scope.legendColors = stackChartConfig.chartcolor;
+ $scope.legendTooltipColors = angular.copy(stackChartConfig.chartcolor).reverse();
+ $scope.addLegendColor = function (id) {
+ var bgColor = null;
+ switch (id) {
+ case 0:
+ bgColor = {"background-color": $scope.legendColors[id], "border-radius": "100%"};
+ break;
+ case 1:
+ bgColor = {"background-color": $scope.legendColors[id]};
+ break;
+ case 2:
+ bgColor = {"width": "0", "height": "0", "border-left": "8px solid transparent", "border-right": "8px solid transparent", "border-bottom-style": "solid", "border-bottom-width": "8px", "border-bottom-color": $scope.legendColors[id]};
+ break;
+ }
+ return bgColor;
+ };
+ $scope.addToolTipLegendColor = function (id) {
+ var bgColor = null;
+ switch (id) {
+ case 2:
+ bgColor = {"background-color": $scope.legendTooltipColors[id], "border-radius": "100%"};
+ break;
+ case 1:
+ bgColor = {"background-color": $scope.legendTooltipColors[id]};
+ break;
+ case 0:
+ bgColor = {"width": "0", "height": "0", "border-left": "6px solid transparent", "border-right": "6px solid transparent", "border-bottom-style": "solid", "border-bottom-width": "12px", "border-bottom-color": $scope.legendTooltipColors[id]};
+ break;
+ }
+ return bgColor;
+ };
+ }],
+ link: function (scope, element, attrs, ctrl) {
+ scope.tooltipFlag = false;
+ var dataObj, idx = 0, xAxisTicks, margin = stackChartConfig.margin,
+ width = parseInt(attrs.chartWidth, 10),
+ height = stackChartConfig.chartHeight,
+ parseDate = d3.time.format("%d-%b-%Y").parse,
+ tooltipFormat = d3.time.format("%B-%Y"),
+ labelFormat = d3.time.format("%Y");
+ attrs.$observe('legendRequired', function (val) {
+ if (val === 'true') {
+ scope.showLegend = true;
+ }
+ else {
+ scope.showLegend = false;
+ }
+ });
+ scope.$watch('refreshChart', function (value) {
+ if (value === false) {
+ return;
+ }
+ if (angular.isDefined(scope.chartConfig)) {
+ stackChartConfig = $extendObj.extendDeep(stackChartConfig, scope.chartConfig);
+ }
+ d3.select("svg#" + attrs.id).remove();
+ d3.selectAll("svg#" + attrs.id + " > *").remove();
+ d3.selectAll("div#stackChartContainer" + " > div").remove();
+ if (scope.chartData[0].values.length === 0) {
+ scope.refreshChart = false;
+ return;
+ }
+
+ var xMonth = [], yValue = [], tempData = [], tooltipData = {}, yearArr = {}, yearLabel = '', isSingleMonth = false, singleMonthName, currencyFormat = 'K';
+
+ //X-Axis Range
+ var xRange = d3.time.scale()
+ .range([0, width]);
+
+ //Y-Axis Range
+ var yRange = d3.scale.linear()
+ .range([height, 0]);
+
+ dataObj = scope.chartData;
+
+ // On selecting same month in From and To dropdowns, User should be getting graph
+ if (dataObj[0].values.length === 1) {
+ isSingleMonth = true;
+ dataObj.forEach(function (data) {
+ var tmp1 = "01-" + data.values[0].month;
+ var tmp = parseDate(tmp1);
+ singleMonthName = tmp.toString().split(" ")[1];
+ tmp.setMonth(tmp.getMonth() + 1);
+ var nextMonth = tmp.toString().split(" ")[1] + "-" + tmp.getFullYear();
+ data.values.push({month: nextMonth, value: data.values[0].value});
+ });
+ }
+
+ dataObj.forEach(function (data) {
+ var obj = data.values;
+ xAxisTicks = obj.length;
+ obj.forEach(function (d) {
+ var tmp = "01-" + d.month;
+ d.numericMonth = parseDate(tmp);
+ yValue.push({'value': +d.value});
+ d.value = +d.value;
+ xMonth.push({'numericMonth': d.numericMonth});
+ if (d.value > stackChartConfig.yAxisUnitRange) {
+ currencyFormat = 'M';
+ }
+ });
+ });
+
+ //ToolTip Data
+ for (var z = 0; z < dataObj.length; z++) {
+ var tempSeries = dataObj[z].series;
+ for (var j = 0; j < dataObj[z].values.length; j++) {
+ var months = dataObj[z].values[j].month;
+ var tempVal = dataObj[z].values[j].value;
+ tempData.push({"month": months, "series": tempSeries, "value": tempVal});
+ }
+ }
+ for (var k = 0; k < tempData.length; k++) {
+ var seriesName = tempData[k].series;
+ var seriesVal = tempData[k].value;
+ var tempObj = tooltipData[tempData[k].month];
+ if (!(tempObj)) {
+ tempObj = [];
+ tooltipData[tempData[k].month] = tempObj;
+ }
+ tempObj.push({seriesName: seriesName, seriesVal: seriesVal});
+ }
+ for (var d in tooltipData) {
+ var tooltipObj = tooltipData[d];
+ var temp = 0, monthTotalVal = 0;
+ for (var y = 0; y < tooltipObj.length; y++) {
+ temp = parseFloat(tooltipObj[y].seriesVal);
+ monthTotalVal = monthTotalVal + temp;
+ tooltipObj['total'] = monthTotalVal;
+ }
+ }
+ var yDomainData = [],yAxisData = [],yTicksData = [];
+ for (var month in tooltipData) {
+ yDomainData.push({"total": tooltipData[month].total});
+ }
+
+ //Format yAxis Labels
+ var formatCurrency = function (d) {
+ if (currencyFormat === 'M') {
+ return "$" + d / 1000000 + "M";
+ } else {
+ return "$" + d / 1000 + "K";
+ }
+ };
+
+ //X-Axis Domain
+ xRange.domain(d3.extent(xMonth, function (d) {
+ return d.numericMonth;
+ }));
+
+ for (var b = 0; b < yDomainData.length; b++) {
+ var val = Math.round(parseInt(yDomainData[b].total, 10) / stackChartConfig.yAxisMaxTicks);
+ var Calc = Math.ceil((val / Math.pow(10, ("" + val).length - 1))) * (stackChartConfig.yAxisMaxTicks) * Math.pow(10, ("" + val).length - 1);
+ yAxisData.push({'yAxisVal': Calc});
+ }
+
+ //Y-Axis Domain
+ yRange.domain([0, d3.max(yAxisData, function (d) {
+ return (d.yAxisVal);
+ })]);
+
+ var yTick = d3.max(yAxisData, function (d) {
+ return d.yAxisVal;
+ });
+
+ yTick = yTick / stackChartConfig.yAxisMaxTicks;
+ for (var c = 0; c <= stackChartConfig.yAxisMaxTicks; c++) {
+ yTicksData.push(yTick * c);
+ }
+
+ var xAxis = d3.svg.axis().scale(xRange).orient("bottom").tickFormat(d3.time.format('%b')).ticks(d3.time.months);
+ var yAxis = d3.svg.axis().scale(yRange).orient("left").tickValues(yTicksData).ticks(stackChartConfig.yAxisMaxTicks).tickFormat(formatCurrency);
+ var yAxisGrid = d3.svg.axis().scale(yRange).orient("left").tickValues(yTicksData).ticks(stackChartConfig.yAxisMaxTicks).tickSize(-width, 0, 0);
+
+ //Calculate values for Stack
+ var stack = d3.layout.stack()
+ .values(function (d) {
+ return d.values;
+ })
+ .x(function (d) {
+ return d.numericMonth;
+ })
+ .y(function (d) {
+ return d.value;
+ });
+
+ //Draw Area
+ var area = d3.svg.area()
+ .x(function (d) {
+ return xRange(d.numericMonth);
+ })
+ .y0(function (d) {
+ return yRange(d.y0);
+ })
+ .y1(function (d) {
+ return yRange(d.y0 + d.y);
+ }).interpolate(stackChartConfig.lineCurveType);
+
+ //Plot Chart
+ var drawChart = d3.select("#stackChartContainer")
+ .append("svg")
+ .attr("id", attrs.id)
+ .data(dataObj)
+ .attr("width", width + margin.left + margin.right)
+ .attr("height", parseInt(height, 10) + parseInt(margin.top, 10) + parseInt(margin.bottom, 10))
+ .append("g")
+ .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
+ //Draw X Axis
+ drawChart.append("g")
+ .attr("class", "x axis")
+ .attr("transform", "translate(0," + height + ")")
+ .call(xAxis);
+
+ //Plot Area for multiple Stacks
+ drawChart.selectAll(".layer")
+ .data(stack(dataObj))
+ .enter().append("path")
+ .attr("class", "layer")
+ .attr("d", function (d) {
+ return area(d.values);
+ }).style("fill", function (d, i) {
+ return scope.legendColors[i];
+ }).style("opacity", stackChartConfig.chartOpacity).style("stroke", "#ddd").append("title")
+ .text(function (d) {
+ return d.series;
+ });
+
+ //Draw dual Y axis on change of Year
+ var yAxisObj = dataObj[0].values, yAxisIdx = 0;
+ for (var i = 0; i < yAxisObj.length; i++) {
+ var tmpObj = [];
+ tmpObj.push({"year": labelFormat(yAxisObj[i].numericMonth), "transform": xRange(yAxisObj[i].numericMonth)});
+ if (!yearArr[labelFormat(yAxisObj[i].numericMonth)]) {
+ yearArr[labelFormat(yAxisObj[i].numericMonth)] = tmpObj;
+ }
+ }
+ for (var key in yearArr) {
+ var obj = yearArr[key];
+ var yAxisNodes = drawChart.append("g")
+ .attr("class", "y axis").attr("id", yAxisId(yAxisIdx))
+ .attr("transform", "translate(" + obj[0].transform + ",0)")
+ .call(yAxis);
+
+ yAxisNodes.selectAll("text").attr('class', 'ticktext');
+ //Append Year Label
+ yAxisNodes.append("text")
+ .attr("transform", "rotate(0)")
+ .attr("y", stackChartConfig.yearLabelPos.y)
+ .attr("x", stackChartConfig.yearLabelPos.x)
+ .text(obj[0].year).attr("class", "yearLabel");
+ yAxisIdx++;
+ }
+
+ //Remove next year Y axis in case of single Month selection
+ if (isSingleMonth) {
+ d3.select("#yAxisId1").remove();
+ }
+
+ function yAxisId(yAxisIdx) {
+ return ("yAxisId" + yAxisIdx);
+ }
+
+ //function to select first element
+ d3.selection.prototype.first = function () {
+ return d3.select(this[0][0]);
+ };
+
+ //Remove minimum value label form Y Axis
+ var tickLabels = d3.select("#yAxisId0").selectAll('.ticktext');
+ tickLabels.first().remove();
+ d3.select("#yAxisId1").selectAll('.ticktext').remove();
+
+ if (isSingleMonth) {
+ drawChart.selectAll('.x.axis').selectAll('.tick').selectAll('text')[1][0].textContent = singleMonthName;
+ }
+
+ //Append Data Points
+ for (var x = 0; x < dataObj.length; x++) {
+ drawChart.append('g').attr('id', "pathId" + x).attr("transform", "translate(" + (isSingleMonth === true) * width / 2 + ",0)");
+ if (idx >= stackChartConfig.shapes.length) {
+ idx = 0;
+ }
+ var shape = stackChartConfig.shapes[idx], shapeToAppend;
+ if (shape == 'rect' || shape == 'triangle') {
+ shapeToAppend = 'polygon';
+ }
+ else {
+ shapeToAppend = 'circle';
+ }
+
+ var newDataObj;
+ if (isSingleMonth) {
+ newDataObj = dataObj[x].values.slice(0, 1);
+ } else {
+ newDataObj = dataObj[x].values;
+ }
+
+ var dataPoints = drawChart.select('#pathId' + x).selectAll(shapeToAppend)
+ .data(newDataObj)
+ .enter()
+ .append(shapeToAppend)
+ .attr('class', shape);
+ drawShapes(shape, dataPoints);
+ idx++;
+ }
+
+ //Fill color in dataPoints
+ for (var a = 0; a <= dataObj.length; a++) {
+ var Dots = drawChart.selectAll('.' + stackChartConfig.shapes[a]);
+ Dots.attr('fill', scope.legendColors[a]);
+ }
+
+ //function to draw multiple shapes for Data Points
+ function drawShapes(shape, dataPoints) {
+ switch (shape) {
+ case 'circle':
+ var circle = dataPoints.attr("cx", function (d) {
+ return xRange(d.numericMonth);
+ }).attr("cy", function (d) {
+ return yRange(d.y + d.y0);
+ }).attr("r", stackChartConfig.shapeSize[0]).on("mouseover", function (d) {
+ show_tooltip_grid_line(d3.select(this).attr("cx"), "circle", "cx");
+ var offsetX = Math.ceil(d3.select(this).attr("cx"));
+ var offsetY = Math.round(d3.select(this).attr("cy"));
+ d3.selectAll('svg#' + attrs.id + " " + "path").style("fill-opacity", stackChartConfig.chartOpacity);
+ d3.selectAll('svg#' + attrs.id + " " + "polygon").style("fill-opacity", stackChartConfig.chartOpacity);
+ d3.selectAll('svg#' + attrs.id + " " + "circle").style("fill-opacity", stackChartConfig.chartOpacity);
+ mouseOver(d, offsetX, offsetY);
+ }).on("mouseout", function () {
+ hide_tooltip_grid_line(d3.select(this).attr("cx"), "circle", "cx");
+ d3.selectAll('svg#' + attrs.id + " " + "path").style("fill-opacity", 1);
+ d3.selectAll('svg#' + attrs.id + " " + "polygon").style("fill-opacity", 1);
+ d3.selectAll('svg#' + attrs.id + " " + "circle").style("fill-opacity", 1);
+ scope.tooltipFlag = false;
+ scope.$apply();
+ });
+ circle.append('desc').append('title').text(function (d) {
+ var nvdaObj = tooltipData[d.month];
+ return (addTitle(nvdaObj, d));
+ });
+ break;
+ case 'rect':
+ var rect = dataPoints.attr("points", function (d) {
+ var x = parseInt(xRange(d.numericMonth), 10);
+ x = x + (stackChartConfig.shapeSize[1] / 2);
+ var y = parseInt(yRange(d.y + d.y0), 10);
+ y = y - (stackChartConfig.shapeSize[1] / 2);
+ var x1 = parseInt((x - stackChartConfig.shapeSize[1]), 10);
+ var y1 = y;
+ var x2 = x1;
+ var y2 = parseInt((y1 + stackChartConfig.shapeSize[1]), 10);
+ var x3 = x;
+ var y3 = y2;
+ var tmp = x2 + "," + y2 + " " + x3 + "," + y3 + " " + x + "," + y + " " + x1 + "," + y1;
+ return tmp;
+ }).attr('x', function (d) {
+ return xRange(d.numericMonth);
+ }).attr('y', function (d) {
+ return yRange(d.y + d.y0);
+ }).on("mouseover", function (d) {
+ show_tooltip_grid_line(d3.select(this).attr("x"), "rect", "x");
+ var offsetX = Math.ceil(d3.select(this).attr("x"));
+ var offsetY = Math.round(d3.select(this).attr("y"));
+ d3.selectAll('svg#' + attrs.id + " " + "path").style("fill-opacity", stackChartConfig.chartOpacity);
+ d3.selectAll('svg#' + attrs.id + " " + "polygon").style("fill-opacity", stackChartConfig.chartOpacity);
+ d3.selectAll('svg#' + attrs.id + " " + "circle").style("fill-opacity", stackChartConfig.chartOpacity);
+ mouseOver(d, offsetX, offsetY);
+ }).on("mouseout", function () {
+ hide_tooltip_grid_line(d3.select(this).attr("x"), "rect", "x");
+ d3.selectAll('svg#' + attrs.id + " " + "path").style("fill-opacity", 1);
+ d3.selectAll('svg#' + attrs.id + " " + "polygon").style("fill-opacity", 1);
+ d3.selectAll('svg#' + attrs.id + " " + "circle").style("fill-opacity", 1);
+ scope.tooltipFlag = false;
+ scope.$apply();
+ });
+ rect.append('desc').append('title').text(function (d) {
+ var nvdaObj = tooltipData[d.month];
+ return (addTitle(nvdaObj, d));
+ });
+ break;
+ case 'triangle':
+ var triangle = dataPoints.attr("points", function (d) {
+ var x = parseInt(xRange(d.numericMonth), 10);
+ var y = parseInt(yRange(d.y + d.y0), 10);
+ var x1 = parseInt((x - stackChartConfig.shapeSize[2]), 10);
+ var y1 = parseInt((y - stackChartConfig.shapeSize[2]), 10);
+ var x2 = parseInt((x + stackChartConfig.shapeSize[2]), 10);
+ var y2 = y1;
+ var tmp = x1 + "," + y1 + " " + x + "," + y + " " + x2 + "," + y2;
+ return tmp;
+ }).attr("transform", function (d) {
+ var x = parseInt(xRange(d.numericMonth), 10);
+ var y = parseInt(yRange(d.y + d.y0), 10);
+ y = y - 2;
+ var tmp = "rotate(180," + x + "," + y + ")";
+ return tmp;
+ }).attr('x', function (d) {
+ return xRange(d.numericMonth);
+ }).attr('y', function (d) {
+ return yRange(d.y + d.y0);
+ }).on("mouseover", function (d) {
+ show_tooltip_grid_line(d3.select(this).attr("x"), "triangle", "x");
+ var offsetX = Math.ceil(d3.select(this).attr("x"));
+ var offsetY = Math.round(d3.select(this).attr("y"));
+ d3.selectAll('svg#' + attrs.id + " " + "path").style("fill-opacity", stackChartConfig.chartOpacity);
+ d3.selectAll('svg#' + attrs.id + " " + "polygon").style("fill-opacity", stackChartConfig.chartOpacity);
+ d3.selectAll('svg#' + attrs.id + " " + "circle").style("fill-opacity", stackChartConfig.chartOpacity);
+ mouseOver(d, offsetX, offsetY);
+ }).on("mouseout", function () {
+ hide_tooltip_grid_line(d3.select(this).attr("x"), "triangle", "x");
+ d3.selectAll('svg#' + attrs.id + " " + "path").style("fill-opacity", 1);
+ d3.selectAll('svg#' + attrs.id + " " + "polygon").style("fill-opacity", 1);
+ d3.selectAll('svg#' + attrs.id + " " + "circle").style("fill-opacity", 1);
+ scope.tooltipFlag = false;
+ scope.$apply();
+ });
+ triangle.append('desc').append('title').text(function (d) {
+ var nvdaObj = tooltipData[d.month];
+ return (addTitle(nvdaObj, d));
+ });
+ break;
+ }
+ }
+
+ //Draw Grid Lines
+ drawChart.append("g")
+ .attr("class", "grid")
+ .attr("id", "yStackGrid")
+ .attr("transform", "translate(0,0)")
+ .call(yAxisGrid)
+ .selectAll("text").remove();
+
+ // Draw the x Grid lines
+ drawChart.append("g")
+ .attr("class", "grid")
+ .attr("id", "xGrid")
+ .attr("transform", "translate(" + (isSingleMonth === true) * width / 2 + ",0)")
+ .call(make_x_axis()
+ .tickSize(-height, 0)
+ .tickFormat(""));
+
+ // function for the x grid lines
+ function make_x_axis() {
+ return d3.svg.axis()
+ .scale(xRange)
+ .orient("top")
+ .tickFormat(d3.time.format('%b')).ticks(d3.time.months);
+ }
+
+ drawChart.select("#xGrid").selectAll("line").style("stroke", "none");
+ drawChart.select("#xGrid").selectAll("line")
+ .attr("id", function (d, i) {
+ return ("xAxisLine" + i);
+ });
+ //Add title for NVDA screen reader
+ function addTitle(nvdaObj, d) {
+ var temp = "";
+ for (var y = 0; y < nvdaObj.length; y++) {
+ temp = temp + nvdaObj[y].seriesName + nvdaObj[y].seriesVal;
+ }
+ return (tooltipFormat(d.numericMonth) + "--" + temp + "Total Charges" + nvdaObj.total);
+ }
+
+ //Show Grid Lines on Mouse Hover
+ function show_tooltip_grid_line(offsetX, shape, attr) {
+ try {
+ var dataLength;
+ if (isSingleMonth) {
+ dataLength = 1;
+ } else {
+ dataLength = scope.chartData[0].values.length;
+ }
+
+ for (var i = 0; i < dataLength; i++) {
+ var circle = drawChart.selectAll("." + shape);
+ if (circle[0][i].getAttribute(attr) === offsetX) {
+ drawChart.select("#xAxisLine" + i).style("stroke", stackChartConfig.gridLineColor);
+ }
+ }
+ } catch (e) {
+ }
+ }
+
+ //Hide grid Lines
+ function hide_tooltip_grid_line(offsetX, shape, attr) {
+ try {
+ var dataLength;
+ if (isSingleMonth) {
+ dataLength = 1;
+ } else {
+ dataLength = scope.chartData[0].values.length;
+ }
+
+ for (var i = 0; i < dataLength; i++) {
+ var circle = drawChart.selectAll("." + shape);
+ if (circle[0][i].getAttribute(attr) === offsetX) {
+ drawChart.select("#xAxisLine" + i).style("stroke", "transparent");
+ }
+ }
+ } catch (e) {
+ }
+ }
+
+ //MouseOver Event
+ function mouseOver(d, offsetX, offsetY) {
+ for (var key in tooltipData) {
+ if (key == d.month) {
+ var data = angular.copy(tooltipData);
+ scope.stackDataPoint = data[key].reverse();
+ break;
+ }
+ }
+ var tmp = 0, monthTotalVal = 0;
+ for (var b = 0; b < scope.stackDataPoint.length; b++) {
+ tmp = parseFloat(scope.stackDataPoint[b].seriesVal);
+ monthTotalVal = monthTotalVal + tmp;
+ }
+ scope.total = monthTotalVal;
+ scope.stackDataPoint.total = monthTotalVal;
+
+ scope.monthPoint = {"xData": tooltipFormat(d.numericMonth).replace('-', ' ')};
+ scope.$apply();
+ $timeout(function(){
+ offsetY = offsetY - stackChartConfig.tooltipTopMargin;
+ var tooltipEl = element.children().eq(2);
+ var tooltipWidth = tooltipEl[0].offsetWidth;
+ if (isSingleMonth) {
+ offsetX = offsetX - (tooltipWidth/2) + stackChartConfig.tooltipLeftMargin + (width / 2);
+ } else {
+ offsetX = offsetX - (tooltipWidth/2) + stackChartConfig.tooltipLeftMargin;
+ }
+ scope.tooltipStyle = {"left": offsetX + "px", "top": offsetY + "px"};
+ scope.tooltipFlag = true;
+ },0);
+
+
+
+
+ }
+ //fix for removing upper text if it is below to year label
+// try {
+// var lastTickPostion = drawChart.selectAll('#yAxisId0').selectAll('.tick')[0].length - 1;
+// var lastGridPos = drawChart.select("#yStackGrid").selectAll('.tick')[0].length - 1;
+// var val = drawChart.selectAll('#yAxisId0').selectAll('.tick')[0][lastTickPostion].attributes.transform.value.split(',')[1].split(')')[0];
+// if (val < 20) {
+// drawChart.selectAll('#yAxisId0').selectAll('text')[0][lastTickPostion - 1].remove();
+// drawChart.select("#yStackGrid").selectAll('.tick')[0][lastGridPos].remove();
+// }
+// } catch (e) {
+// }
+ scope.refreshChart = false;
+ });
+ }
+ };
+ }])
+ .filter('filterInput', function () {
+ return function (input) {
+ return input.replace(/ +/g, "").toLowerCase();
+ };
+ });
+angular.module("template/areachartD3/attAreaChartD3.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/areachartD3/attAreaChartD3.html",
+ "<div class=\"areaChartD3\">\n" +
+ " <ul class=\"legendsList\" ng-show=\"showLegend\">\n" +
+ " <li ng-repeat=\"label in legendLabel\" id=\"{{label.series|filterInput}}\">\n" +
+ " <i class=\"legend-icon\" ng-style=\"addLegendColor($index)\"></i>{{label.series}}\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ " <div id=\"areaChartContainer\">\n" +
+ " </div>\n" +
+ " <div ng-class=\"{'tooltip--on': tooltipFlag,'tooltip': !tooltipFlag}\" ng-style=\"tooltipStyle\">\n" +
+ " <span class=\"title\">{{dataPoint.xData}}</span>\n" +
+ " <p>\n" +
+ " <span class=\"alignLeft\"><i class=\"legend-icon\" ng-style=\"addLegendColor(1)\"></i>Available</span>\n" +
+ " <span class=\"alignRight\">{{dataPoint.dataAvailable}} <span>{{dataPoint.usageDataType}}</span></span>\n" +
+ " </p>\n" +
+ " <div style=\"clear:both\"></div> \n" +
+ " <p>\n" +
+ " <span class=\"alignLeft\"><i class=\"legend-icon\" ng-style=\"addLegendColor(0)\"></i>Used</span>\n" +
+ " <span class=\"alignRight\">{{dataPoint.dataUsed}} <span>{{dataPoint.availableDataType}}</span></span>\n" +
+ " </p>\n" +
+ " <div style=\"clear:both\"></div>\n" +
+ " <p ng-show=\"overageFlag\">\n" +
+ " <span class=\"alignLeft\"><i class=\"legend-icon\" ng-style=\"addLegendColor(2)\"></i>Overage</span> \n" +
+ " <span class=\"alignRight\">{{dataPoint.overage}}</span>\n" +
+ " </p>\n" +
+ " <div style=\"clear:both\"></div>\n" +
+ " <p ng-show=\"underageFlag\">\n" +
+ " <span class=\"alignLeft\">Buffer</span> \n" +
+ " <span class=\"alignRight\">{{dataPoint.underage}}</span>\n" +
+ " </p>\n" +
+ " <div style=\"clear:both\"></div>\n" +
+ " <span class=\"tooltipArrow\"></span>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("template/barchartD3/attBarChartD3.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/barchartD3/attBarChartD3.html",
+ "<div class=\"barChartD3\">\n" +
+ " <div id=\"barChartContainer\">\n" +
+ " <span class=\"tooltip\" ng-class=\"{'tooltip--on': tooltipFlag}\" ng-show=\"tooltipFlag\" ng-style=\"tooltipStyle\">\n" +
+ " <span class=\"title\">{{dataPoint.name}}</span>\n" +
+ " <span><span class=\"alignText\">Wireless number</span><span style=\"float:right\">{{dataPoint.phoneNumber}}</span></span>\n" +
+ " <span><span class=\"alignText\">Charges</span><span style=\"float:right\">{{dataPoint.charges}}</span></span>\n" +
+ " <span class=\"tooltipArrow\"></span>\n" +
+ " </span>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("template/coschartD3/attCosd3Chart.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/coschartD3/attCosd3Chart.html",
+ "<div class=\"attCosd3Chart\">\n" +
+ " <div class=\"chartLegend\" ng-if=\"legendPosition == 'top' && legendRequired\">\n" +
+ " <ul>\n" +
+ " <li ng-style=\"addLegendColor()\">\n" +
+ " <div>\n" +
+ " <span class=\"LegendLabel\">{{LegendLabel}}</span> <span class=\"LegendCategory\">{{LegendCategory}}</span> <span class=\"legendItemValue\">({{cosval}})</span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ " </div>\n" +
+ " <div id={{chartID}} class=\"cosd3Container\"></div>\n" +
+ " <div class=\"chartLegend\" ng-if=\"legendPosition == 'bottom' && legendRequired\">\n" +
+ " <ul>\n" +
+ " <li ng-style=\"addLegendColor()\">\n" +
+ " <div>\n" +
+ " <span class=\"LegendLabel\">{{LegendLabel}}</span> <span class=\"LegendCategory\">{{LegendCategory}}</span> <span class=\"legendItemValue\">({{cosval}})</span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("template/coschartwithbarD3/attCosBarD3Chart.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/coschartwithbarD3/attCosBarD3Chart.html",
+ "<div class=\"attCosWithBard3Chart\">\n" +
+ " <div id={{chartID}} class=\"cosd3Container\"></div>\n" +
+ " <div id={{snickrbarId}} class=\"snickrBar\" ng-if=\"barRequired\"></div>\n" +
+ "</div>");
+}]);
+
+angular.module("template/cosmultichartD3/attCosmultid3Chart.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/cosmultichartD3/attCosmultid3Chart.html",
+ "<div class=\"attCosmultid3Chart\">\n" +
+ " <div class=\"chartLegend\" ng-if=\"legendPosition == 'top' && legendRequired\">\n" +
+ " <ul>\n" +
+ " <li ng-repeat=\"item in chartData\" ng-style=\"addLegendColor($index,item)\" chart-legend-id=\"{{item.name}}\">\n" +
+ " <div>\n" +
+ " <span class=\"LegendLabel\">{{item.name}}</span> <span class=\"LegendCategory\">{{item.category}}</span> <span class=\"legendItemValue\">({{item.value}}%)</span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ " </div>\n" +
+ " <div id={{chartID}} class=\"cosmultid3Container\"></div>\n" +
+ " <div class=\"chartLegend\" ng-if=\"legendPosition == 'bottom' && legendRequired\">\n" +
+ " <ul>\n" +
+ " <li ng-repeat=\"item in chartData\" ng-style=\"addLegendColor($index,item)\" chart-legend-id=\"{{item.name}}\">\n" +
+ " <div>\n" +
+ " <span class=\"LegendLabel\">{{item.name}}</span> <span class=\"LegendCategory\">{{item.category}}</span> <span class=\"legendItemValue\">({{item.value}}%)</span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("template/donutD3/attDonutd3Chart.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/donutD3/attDonutd3Chart.html",
+ "<div class=\"attDonutd3Chart\">\n" +
+ " <div id={{chartID}} class=\"chartContainer\" ng-class=\"addStyle('chartContainer')\"></div>\n" +
+ " <div ng-show=\"legendRequired\" chartLegend class=\"chartLegend\" ng-class=\"addStyle('chartLegend')\">\n" +
+ " <ul>\n" +
+ " <li ng-repeat=\"item in chartData\" ng-style=\"addLegendColor($index,item)\" chart-legend-id=\"{{item.name|filterData}}\" ng-mouseover=\"legendMouseOver(item,$index,$event)\" ng-mouseleave=\"legendMouseLeave(item,$index,$event)\" ng-class=\"LegendClass\" ng-click=\"legendclickcallback({name:item.name , value:item.value})\">\n" +
+ " <div ng-class=\"{'emptyticket-category': item.value ===0}\" >\n" +
+ " <span class=\"legendItemName\">{{item.name}}</span> <span class=\"legendItemValue\">({{item.value}})</span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ " </div>\n" +
+ " <div style=\"clear: both;\"></div>\n" +
+ "</div>");
+}]);
+
+angular.module("template/donutFusion/attDonutfusionChart.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/donutFusion/attDonutfusionChart.html",
+ "<div class=\"attDonutfusionChart\">\n" +
+ " <div id=\"donutFusionChart\" chartContainer class=\"chartContainer\" ng-style=\"addStyle('chartContainer')\"></div>\n" +
+ " <div ng-show=\"legendRequired\" chartLegend class=\"chartLegend\" ng-style=\"addStyle('chartLegend')\">\n" +
+ " <ul>\n" +
+ " <li ng-repeat=\"item in chartData\" ng-show=\"item.value > 0\" ng-style=\"addLegendColor($index)\">\n" +
+ " <div chart-legend-id=\"{{item.name|filterData}}_fusion\">\n" +
+ " <span class=\"legendItemName\">{{item.name}}</span> <span class=\"legendItemValue\">({{item.value}})</span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ " </div>\n" +
+ " <div style=\"clear: both;\">\n" +
+ " </div>\n" +
+ "</div> ");
+}]);
+
+angular.module("template/horseshoeD3/attHorseshoeD3Chart.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/horseshoeD3/attHorseshoeD3Chart.html",
+ "<div class=\"attHorseshoed3Chart\">\n" +
+ " <div class=\"chartLegend\" ng-if=\"legendPosition == 'top' && legendRequired\">\n" +
+ " <ul>\n" +
+ " <li ng-style=\"addLegendColor()\">\n" +
+ " <div>\n" +
+ " <span class=\"LegendLabel\">{{LegendLabel}}</span> <span class=\"LegendCategory\">{{LegendCategory}}</span> <span class=\"legendItemValue\">({{guageVal}})</span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ " </div>\n" +
+ " <div class=\"horseshoed3Container\"></div>\n" +
+ " <div class=\"chartLegend\" ng-if=\"legendPosition == 'bottom' && legendRequired\">\n" +
+ " <ul>\n" +
+ " <li ng-style=\"addLegendColor()\">\n" +
+ " <div>\n" +
+ " <span class=\"LegendLabel\">{{LegendLabel}}</span> <span class=\"LegendCategory\">{{LegendCategory}}</span> <span class=\"legendItemValue\">({{guageVal}})</span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("template/stackedBarchart/stackedBarchart.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/stackedBarchart/stackedBarchart.html",
+ "<div class=\"stackedBarChart\">\n" +
+ " <ul class=\"legendsList\" ng-show=\"showLegend\">\n" +
+ " <li ng-repeat=\"label in chartData\" id=\"{{label.series|filterInput}}\">\n" +
+ " <i class=\"legend-icon\" ng-style=\"addLegendColor($index)\"></i>{{label.series}}\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ " <div id=\"stackBarChartContainer\"></div>\n" +
+ " <div ng-class=\"{'tooltip--on': tooltipFlag,'tooltip': !tooltipFlag}\" ng-style=\"tooltipStyle\">\n" +
+ " <span class=\"title\">{{monthPoint.xData}}</span>\n" +
+ " <div ng-repeat=\"label in stackDataPoint\">\n" +
+ " <p>\n" +
+ " <span class=\"alignLeft\"><i class=\"legend-icon-stackedchart\" ng-style=\"addLegendColor($index)\"></i>{{label.seriesName}}</span>\n" +
+ " <span class=\"alignRight\">{{label.seriesVal| number:0}}</span>\n" +
+ " </p> \n" +
+ "\n" +
+ " <div style=\"clear:both\"></div>\n" +
+ " </div>\n" +
+ " <p>\n" +
+ " <span class=\"alignLeft\"><i class=\"legend-icon-stackedchart\"></i>Retainability percentage</span>\n" +
+ " <span class=\"alignRight\">{{stackDataPoint.seriesPer}}</span>\n" +
+ "\n" +
+ " </p>\n" +
+ " <div style=\"clear:both\"></div>\n" +
+ " <span class=\"tooltipArrow\"></span>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("template/stackedareachart/stackedAreaChart.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/stackedareachart/stackedAreaChart.html",
+ "<div class=\"stackedAreaChart\">\n" +
+ " <ul class=\"legendsList\" ng-show=\"showLegend\">\n" +
+ " <li ng-repeat=\"label in chartData\" id=\"{{label.series|filterInput}}\">\n" +
+ " <i class=\"legend-icon\" ng-style=\"addLegendColor($index)\"></i>{{label.series}}\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ " <div id=\"stackChartContainer\"></div>\n" +
+ " <div ng-class=\"{'tooltip--on': tooltipFlag,'tooltip': !tooltipFlag}\" ng-style=\"tooltipStyle\">\n" +
+ " <span class=\"title\">{{monthPoint.xData}}</span>\n" +
+ " <div ng-repeat=\"label in stackDataPoint\">\n" +
+ " <p>\n" +
+ " <span class=\"alignLeft\"><i class=\"legend-icon-stackedchart\" ng-style=\"addToolTipLegendColor($index)\"></i>{{label.seriesName}}</span>\n" +
+ " <span class=\"alignRight\">{{label.seriesVal| currency}}</span>\n" +
+ " </p>\n" +
+ " <div style=\"clear:both\"></div> \n" +
+ " </div>\n" +
+ " <p>\n" +
+ " <span class=\"alignLeft\">Total charges</span>\n" +
+ " <span class=\"alignRight\">{{stackDataPoint.total| currency}}</span>\n" +
+ " </p>\n" +
+ " <div style=\"clear:both\"></div>\n" +
+ " <span class=\"tooltipArrow\"></span>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/footer.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/footer.css
new file mode 100644
index 00000000..fcb94c79
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/footer.css
@@ -0,0 +1,311 @@
+/* Please include base.less file to make this footer work*/
+/*font family*/
+.footerContainer {
+ background: none repeat scroll 0 0 #067AB4;
+ width: 100%;
+ margin: 0 auto;
+ background-color: #067AB4;
+ position: relative;
+ z-index: 2;
+}
+.footerContainer.stickyFooter {
+ position: absolute;
+ left: 0;
+ right: 0;
+}
+.footerContainer .footerWrapper {
+ width: 980px;
+ padding-bottom: 25px;
+ margin: 0 auto;
+ background-color: #067AB4;
+}
+.footerContainer .footerWrapper .footerItem {
+ width: 980px;
+ height: 60px;
+ line-height: 1;
+ margin: auto;
+ overflow: hidden;
+ font-family: clearviewatt;
+ font-size: 12px;
+ color: #ffffff;
+}
+.footerContainer .footerWrapper .footerItem .divider {
+ border-bottom: 1px solid #ffffff;
+ margin-top: 10px;
+ margin-bottom: 10px;
+ width: 100px;
+}
+.footerContainer .footerWrapper .footerItem .customerSupport {
+ float: left;
+ width: 160px;
+ margin-left: 30px;
+}
+.footerContainer .footerWrapper .footerItem .customerSupport .customerHelp {
+ font-size: 14px;
+ margin-bottom: 20px;
+ margin-top: 45px;
+}
+.footerContainer .footerWrapper .footerItem .customerSupport a {
+ color: #ffffff !important;
+}
+.footerContainer .footerWrapper .footerItem .customerSupport a:hover {
+ text-decoration: none;
+}
+.footerContainer .footerWrapper .footerItem .legalInfo {
+ float: left;
+ width: 160px;
+}
+.footerContainer .footerWrapper .footerItem .legalInfo .legal {
+ font-size: 14px;
+ margin-bottom: 20px;
+ margin-top: 45px;
+}
+.footerContainer .footerWrapper .footerItem .legalInfo a {
+ color: #ffffff !important;
+}
+.footerContainer .footerWrapper .footerItem .legalInfo a:hover {
+ text-decoration: none;
+}
+.footerContainer .footerWrapper .footerItem .subscribeSection {
+ float: left;
+ width: 295px;
+}
+.footerContainer .footerWrapper .footerItem .subscribeSection .subscribeSave {
+ font-size: 14px;
+ margin-bottom: 20px;
+ margin-top: 45px;
+}
+.footerContainer .footerWrapper .footerItem .subscribeSection .subscribeToSection {
+ margin-top: 15px;
+ overflow: hidden;
+}
+.footerContainer .footerWrapper .footerItem .subscribeSection .subscribeToSection .emailAddress {
+ float: left;
+ width: 170px;
+}
+.footerContainer .footerWrapper .footerItem .subscribeSection .subscribeToSection .emailAddress input {
+ background-color: #067AB4;
+ color: #FFFFFF !important;
+ width: 152px;
+ padding: 5px 10px 5px 5px;
+}
+.footerContainer .footerWrapper .footerItem .subscribeSection .subscribeToSection .subscribeBtn {
+ background-color: #FFFFFF;
+ border-radius: 1px 5px 5px 1px;
+ color: #067AB4;
+ cursor: pointer;
+ float: left;
+ font-size: 14px;
+ height: 30px;
+ position: relative;
+ right: 7px;
+ text-align: center;
+ top: 1px;
+ vertical-align: middle;
+ width: 95px;
+}
+.footerContainer .footerWrapper .footerItem .socialMedia {
+ float: left;
+ margin-left: 0px;
+}
+.footerContainer .footerWrapper .footerItem .socialMedia .followAtt {
+ font-size: 14px;
+ margin-bottom: 20px;
+ margin-top: 45px;
+}
+.footerContainer .footerWrapper .footerItem .socialMedia .socialFeeds {
+ margin-left: -8px;
+ margin-top: 20px;
+}
+.footerContainer .footerWrapper .footerItem .socialMedia .socialFeeds span {
+ font-size: 30px;
+ margin: 0;
+ padding: 5px;
+}
+.footerContainer .footerWrapper .footerItem .socialMedia .socialFeeds span a {
+ color: #ffffff;
+ margin: 0;
+ padding: 0;
+ /*width: 30px;*/
+
+}
+.footerContainer .footerWrapper .footerItem .socialMedia .socialFeeds span a:hover {
+ text-decoration: none;
+}
+.footerContainer .footerWrapper .dividerBottom {
+ border-bottom: 1px solid #ffffff;
+ margin: auto;
+ width: 920px;
+}
+.footerContainer .footerWrapper .feedbackSection {
+ margin: auto;
+ width: 920px;
+ display: none;
+}
+.footerContainer .footerWrapper .feedbackSection .dividerTop {
+ border-bottom: 1px solid #ffffff;
+ margin: auto;
+ width: 920px;
+}
+.footerContainer .footerWrapper .feedbackSection .feedbackContent {
+ margin: 30px auto;
+ height: 240px;
+}
+.footerContainer .footerWrapper .feedbackSection .feedbackContent #feedbackForm {
+ height: 120px;
+}
+.footerContainer .footerWrapper .feedbackSection .feedbackContent .feedbackInfo {
+ margin-right: 30px;
+ width: 270px;
+ font-family: clearviewatt;
+ font-size: 12px;
+ color: #FFFFFF;
+ float: left;
+ margin-top: -5px;
+}
+.footerContainer .footerWrapper .feedbackSection .feedbackContent .feedbackTextSection .feedbackText {
+ width: 620px;
+ height: 170px;
+ border: 1px solid #FFFFFF;
+ background-color: #067AB4;
+ border-radius: 5px;
+ font-family: clearviewatt;
+ font-size: 14px;
+ cursor: text;
+ color: #FFFFFF;
+ float: left;
+ padding: 10px;
+ resize: none;
+}
+.footerContainer .footerWrapper .feedbackSection .feedbackContent .feedbackTextSection .feedbackSubmitButton {
+ width: 82px;
+ background-color: #FFFFFF;
+ margin-left: 16px;
+ padding: 5px;
+ border-radius: 5px;
+ color: #067AB4;
+ cursor: pointer;
+ font-family: clearviewatt;
+ font-size: 14px;
+ border: none;
+ margin-top: 10px;
+ margin-right: 0px;
+ float: right;
+}
+.footerContainer .footerWrapper .feedbackResultMsg {
+ font-family: clearviewatt;
+ font-size: 18px;
+ color: #FFFFFF;
+ line-height: 70px;
+ width: 980px;
+ text-align: center;
+ margin: 0 auto;
+ display: none;
+}
+.footerContainer .footerWrapper .feedbackResultMsg #feedbackMsgCheck {
+ margin-right: 20px;
+ font-size: 20px;
+}
+.footerContainer .footerWrapper .feedbackResultMsg .feedbackMsgOKButton {
+ width: 82px;
+ height: 30px;
+ line-height: 0px;
+ background-color: #FFFFFF;
+ margin-left: 16px;
+ padding: 5px;
+ border-radius: 5px;
+ color: #067AB4;
+ cursor: pointer;
+ font-family: clearviewatt;
+ font-size: 14px;
+ border: none;
+ margin-top: 20px;
+ margin-right: 30px;
+ float: right;
+}
+.footerContainer .footerWrapper #feedbackResultDivider {
+ display: none;
+}
+.footerContainer .footerWrapper .feedbackButtonDiv {
+ margin: auto;
+ max-width: 110px;
+}
+.footerContainer .footerWrapper .feedbackButtonDiv .feedbackButton,
+.footerContainer .footerWrapper .feedbackButtonDiv .closeFeedbackButton {
+ background-color: #FFFFFF;
+ background: #FFFFFF;
+ margin: -1px auto auto;
+ padding: 5px 10px;
+ border-radius: 0 0 5px 5px;
+ color: #067AB4;
+ cursor: pointer;
+ border: none;
+ font-family: clearviewatt;
+ font-size: 14px;
+}
+.footerContainer .footerWrapper .feedbackButtonDiv .feedbackButton span,
+.footerContainer .footerWrapper .feedbackButtonDiv .closeFeedbackButton span {
+ padding-left: 10px;
+ background-image: none;
+}
+.footerContainer .footerWrapper .attFooterInfo {
+ margin: auto;
+ width: 980px;
+ overflow: hidden;
+ font-family: clearviewatt;
+ font-size: 12px;
+ color: #ffffff;
+}
+.footerContainer .footerWrapper .attFooterInfo a {
+ color: #ffffff;
+ margin: 0;
+ padding: 0;
+ text-decoration: underline;
+}
+.footerContainer .footerWrapper .attFooterInfo .footerLastSection {
+ margin-top: 40px;
+ width: 980px;
+ overflow: hidden;
+}
+.footerContainer .footerWrapper .attFooterInfo span {
+ border-right: 1px solid #ffffff;
+ padding-left: 3px;
+ padding-right: 5px;
+}
+.footerContainer .footerWrapper .attFooterInfo span:last-child {
+ border: none;
+}
+.footerContainer .footerWrapper .attFooterInfo .attLogo {
+
+ width: 150px;
+ height: 77px;
+ margin-left: 17px;
+ margin-right: 0;
+ float: left;
+}
+.footerContainer .footerWrapper .attFooterInfo .attQuality {
+ background: url("../images/common/footer/footer-consumerinfo.png") repeat-x scroll 0 0 transparent;
+ margin-right: 103px;
+ float: left;
+ width: 79px;
+ height: 82px;
+ position: relative;
+ top: -5px;
+}
+.footerContainer .footerWrapper .attFooterInfo .attAdvertise {
+ float: right;
+ width: 68%;
+ margin-right: 30px;
+}
+.footerContainer .footerWrapper .attFooterInfo .attAdvertise .privacyPolicy {
+ margin-top: 17px;
+}
+.footerContainer .footerWrapper .attFooterInfo .attAdvertise .privacyPolicy a {
+ text-decoration: underline;
+}
+.footerContainer .footerWrapper .attFooterInfo .attAdvertise .privacyPolicy a span {
+ padding: 0px;
+}
+.footerContainer .footerWrapper .attFooterInfo .attAdvertise .privacyPolicy a:hover {
+ text-decoration: underline;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/header.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/header.css
new file mode 100644
index 00000000..6e387806
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/header.css
@@ -0,0 +1,1866 @@
+/* Generated by F12 developer tools. This might not be an accurate representation of the original source file */
+
+.bui-global-btn {
+ padding: 8px 20px; border-radius: 6px; border: 0px currentColor; transition:background-color 0.3s ease-out; height: auto; text-align: center; color: rgb(255, 255, 255) !important; line-height: 1; font-size: 14px; text-decoration: none !important; vertical-align: middle; display: inline-block; position: relative; cursor: pointer; box-sizing: border-box; background-color:;
+}
+.bui-global-btn-small {
+ height: 30px !important; min-width: 60px;
+}
+.bui-global-btn-primary {
+ border-color: rgb(53, 128, 189); color: rgb(255, 255, 255) !important; background-color: rgb(6, 122, 180);
+}
+.bui-global-btn-primary:hover {
+ background-color: rgb(25, 157, 223);
+}
+.bui-global-btn-primary:active {
+ border-color: rgb(40, 97, 141); background-color: rgb(50, 120, 177);
+}
+.bui-global-btn-hero {
+ color: rgb(255, 255, 255); background-color: rgb(239, 111, 0);
+}
+.bui-global-btn-hero:hover {
+ background-color: rgb(252, 179, 20);
+}
+.bui-global-btn-hero:active {
+ background-color: rgb(255, 114, 0);
+}
+.bui-global-btn-secondary {
+ color: rgb(255, 255, 255); background-color: rgb(102, 102, 102);
+}
+.bui-global-btn-secondary:hover {
+ background-color: rgb(187, 187, 187);
+}
+.bui-global-btn-secondary:active {
+ background-color: rgb(102, 102, 102);
+}
+.bui-global-btn-disabled {
+ color: rgb(153, 153, 153) !important; cursor: pointer; background-color: rgb(221, 221, 221);
+}
+.bui-global-btn-disabled:hover {
+ background-color: rgb(221, 221, 221);
+}
+.bui-global-btn-disabled:active {
+ background-color: rgb(221, 221, 221);
+}
+.bui-global-links {
+ transition:0.3s ease-in-out; color: rgb(6, 122, 180); text-decoration: none;
+}
+.bui-global-links:hover {
+ color: rgb(25, 157, 223); text-decoration: underline;
+}
+.bui-global-links:active {
+ text-decoration: none; coloe: #199ddf;
+}
+.att-global-fonts-common {
+ margin: 0px; text-transform: none;
+}
+.att-global-fonts-popup-header {
+ margin: 0px; text-transform: none; line-height: 10px; font-family: clearviewatt_ltbold; font-size: 11px; font-weight: 100;
+}
+.att-global-fonts-popup-content {
+ margin: 0px; text-transform: none; line-height: 15px; font-family: clearviewattregular; font-size: 14px;
+}
+a.reg-logout-btn {
+ padding: 8px 20px; border-radius: 6px; border: currentColor !important; transition:background-color 0.3s ease-out; width: 94px !important; height: auto; text-align: center; color: rgb(255, 255, 255) !important; line-height: 1; font-family: clearviewattregular; font-size: 14px; text-decoration: none !important; vertical-align: middle; display: inline-block; position: relative; cursor: pointer; box-sizing: border-box; background-color: rgb(102, 102, 102); -moz-box-sizing: border-box; valign: middle;
+}
+a.reg-logout-btn:hover {
+ background-color: rgb(187, 187, 187);
+}
+a.reg-logout-btn:active {
+ background-color: rgb(102, 102, 102);
+}
+ul.reg-Details-table > li {
+ line-height: 0px !important;
+}
+ul.reg-Details-table {
+ margin: 0px; padding: 0px;
+}
+#reg-header-snippet {
+ width: inherit; height: auto; overflow: hidden; clear: both; background-color: rgb(250, 250, 250);
+}
+#reg-header-snippet .reg-profilePicture {
+ padding: 20px 20px 17px; width: 109px; margin-bottom: 0px; border-right-color: rgb(211, 211, 211); border-right-width: 1px; border-right-style: solid; float: left; background-color: rgb(250, 250, 250);
+}
+#reg-header-snippet .reg-profilePicture #reg-profileImage {
+ width: 100%; clear: both; margin-left: 15px;
+}
+#reg-header-snippet .reg-profilePicture #reg-myprofile-link {
+ text-align: left; margin-top: 18px;
+}
+#reg-header-snippet .reg-profilePicture #reg-myprofile-link a {
+ transition:0.3s ease-in-out; color: rgb(6, 122, 180); line-height: 15px; padding-left: 21px; font-size: 14px; text-decoration: none;
+}
+#reg-header-snippet .reg-profilePicture #reg-myprofile-link a:hover {
+ color: rgb(25, 157, 223); text-decoration: underline;
+}
+#reg-header-snippet .reg-profilePicture #reg-myprofile-link a:active {
+ text-decoration: none; coloe: #199ddf;
+}
+#reg-header-snippet .reg-profilePicture #reg-companyProfile-link {
+ margin-top: 14px;
+}
+#reg-header-snippet .reg-profilePicture #reg-companyProfile-link a {
+ transition:0.3s ease-in-out; color: rgb(6, 122, 180); line-height: 15px; font-size: 14px; text-decoration: none;
+}
+#reg-header-snippet .reg-profilePicture #reg-companyProfile-link a:hover {
+ color: rgb(25, 157, 223); text-decoration: underline;
+}
+#reg-header-snippet .reg-profilePicture #reg-companyProfile-link a:active {
+ text-decoration: none; coloe: #199ddf;
+}
+#reg-header-snippet .reg-profilePicture #reg-logout-div {
+ margin-top: 38px;
+}
+#reg-header-snippet .reg-profilePicture #reg-logout-div form.reg-logoutForm {
+ margin: 0px;
+}
+#reg-header-snippet .reg-profileDetails {
+ padding: 11px 20px 20px; width: 199px; margin-bottom: 0px; border-bottom-width: 0px; float: left; min-height: 220px; background-color: rgb(255, 255, 255);
+}
+#reg-header-snippet .reg-profileDetails .reg-userName-table {
+ height: 70px; display: table; min-height: 70px;
+}
+#reg-header-snippet .reg-profileDetails .reg-userName-table #reg-userName-table-row {
+ text-align: left; clear: both; display: table-row; min-height: inherit;
+}
+#reg-header-snippet .reg-profileDetails .reg-userName-table #reg-userName-table-row #reg-userName-table-cell {
+ height: inherit; vertical-align: middle; display: table-cell; -ms-word-wrap: break-word; min-height: inherit;
+}
+#reg-header-snippet .reg-profileDetails .reg-userName-table #reg-userName-table-row #reg-userName-table-cell #reg-userName {
+ width: 8em; color: rgb(68, 68, 68); overflow: hidden; font-weight: normal; float: left; white-space: normal;
+}
+#reg-header-snippet .reg-profileDetails .reg-userEmail-label {
+ text-align: left; clear: both; margin-top: 21px;
+}
+#reg-header-snippet .reg-profileDetails .reg-userEmail-label .reg-userEmail-label-spn {
+ margin: 0px; color: rgb(68, 68, 68); text-transform: none; line-height: 10px; font-family: clearviewatt_ltbold; font-size: 11px; font-weight: 100;
+}
+#reg-header-snippet .reg-profileDetails .reg-userEmail-value {
+ text-align: left; clear: both; margin-top: 5px;
+}
+#reg-header-snippet .reg-profileDetails .reg-userEmail-value .reg-userEmail-value-spn {
+ margin: 0px; color: rgb(102, 102, 102); text-transform: none; line-height: 15px; font-family: clearviewattregular; font-size: 14px;
+}
+#reg-header-snippet .reg-profileDetails .reg-userRole-label {
+ text-align: left; clear: both; margin-top: 20px;
+}
+#reg-header-snippet .reg-profileDetails .reg-userRole-label .reg-userRole-label-spn {
+ margin: 0px; color: rgb(68, 68, 68); text-transform: none; line-height: 10px; font-family: clearviewatt_ltbold; font-size: 11px; font-weight: 100;
+}
+#reg-header-snippet .reg-profileDetails .reg-userRole-value {
+ text-align: left; clear: both; margin-top: 6px;
+}
+#reg-header-snippet .reg-profileDetails .reg-userRole-value .reg-userRole-value-spn {
+ margin: 0px; color: rgb(102, 102, 102); text-transform: none; line-height: 15px; font-family: clearviewattregular; font-size: 14px;
+}
+#reg-header-snippet .reg-profileDetails .reg-userCompany-label {
+ text-align: left; clear: both; margin-top: 19px;
+}
+#reg-header-snippet .reg-profileDetails .reg-userCompany-label .reg-userCompany-spn {
+ margin: 0px; color: rgb(68, 68, 68); text-transform: none; line-height: 10px; font-family: clearviewatt_ltbold; font-size: 11px; font-weight: 100;
+}
+#reg-header-snippet .reg-profileDetails .reg-userCompany-value {
+ text-align: left; clear: both; margin-top: 5px;
+}
+#reg-header-snippet .reg-profileDetails .reg-userCompany-value .reg-userCompany-spn {
+ margin: 0px; color: rgb(102, 102, 102); text-transform: none; line-height: 15px; font-family: clearviewattregular; font-size: 14px; -ms-word-wrap: break-word;
+}
+.bui-global-transitions-hover {
+ border: 1px solid rgb(187, 187, 187); z-index: 90;
+}
+.bui-global-transitions-focus {
+ outline: 0px; border: 1px solid rgb(25, 157, 223) !important; z-index: 100; box-shadow: none; -webkit-box-shadow: none;
+}
+.bui-global-transitions-login-page {
+ background: 0px 0px rgb(250, 250, 250); border-radius: 3px; border: 1px solid rgb(211, 211, 211); transition:border 0.3s ease-in-out; color: rgb(68, 68, 68); font-family: clearviewattregular; box-shadow: none !important;
+}
+.bui-global-transitions-login-page:hover {
+ border: 1px solid rgb(187, 187, 187); z-index: 90;
+}
+.bui-global-transitions-login-page:focus {
+ outline: 0px; border: 1px solid rgb(25, 157, 223) !important; z-index: 100; box-shadow: none; -webkit-box-shadow: none;
+}
+li#anchor ul.column {
+ display: none;
+}
+li#anchor:hover ul.column {
+ display: block;
+}
+.login-icon {
+ width: 27px; height: 27px; vertical-align: middle; display: inline-block; background-image: url("../images/common/header/login-icon.png"); background-repeat: no-repeat;
+}
+.bui-reg-one-line-layout * {
+ display: inline-block;
+}
+.popbox {
+ margin: 0px auto; text-align: center; position: relative;
+}
+.collapse {
+ position: relative;
+}
+.box {
+ background: rgb(255, 255, 255); border: 1px solid rgb(187, 187, 187); width: auto; height: auto; display: none; position: relative; z-index: 0; min-width: 260px;
+}
+.box * {
+ box-sizing: content-box; -webkit-box-sizing: content-box; -moz-box-sizing: content-box;
+}
+.box ::after {
+ box-sizing: content-box; -webkit-box-sizing: content-box; -moz-box-sizing: content-box;
+}
+.box ::before {
+ box-sizing: content-box; -webkit-box-sizing: content-box; -moz-box-sizing: content-box;
+}
+.box a.close {
+ color: red; font-family: arial; font-size: 12px; text-decoration: underline;
+}
+.box .arrow {
+ left: 1px; top: -8px; width: 0px; height: 0px; border-right-color: transparent; border-bottom-color: rgb(255, 255, 255); border-left-color: transparent; border-right-width: 8px; border-bottom-width: 8px; border-left-width: 8px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; position: absolute; z-index: 1001;
+}
+.standard-input-error-msg-class {
+ background: url("../images/common/header/exclamation-error.png") no-repeat 337px rgb(231, 229, 230) !important;
+}
+.box-form {
+ padding-top: 10px; padding-bottom: 0px; padding-left: 16px;
+}
+.control-text-popup {
+ border-radius: 3px 3px 0px 0px !important; width: 200px !important;
+}
+.control-label-password {
+ line-height: 10px !important; padding-top: 3px !important;
+}
+.control-label-checkbox {
+ line-height: 15px; padding-top: 5px;
+}
+.placeholder-class {
+ color: rgb(139, 139, 139) !important;
+}
+.forgot-userid-password {
+ font-size: 10px !important; font-weight: normal !important;
+}
+.header-login-label {
+ color: rgb(255, 255, 255); font-size: 13px; maxlength: 10;
+}
+.ellipsis-header-name {
+ overflow: hidden; padding-top: 0px; margin-top: 0px; white-space: nowrap; -ms-text-overflow: ellipsis; max-width: 100px; ms-text-overflow: ellipsis;
+}
+#generic-image {
+ padding: 100px; background-image: url("../images/common/header/placerimage.jpg"); background-repeat: no-repeat;
+}
+.bui-reg-horizontal-rule {
+ width: 100%; height: 1.25px; clear: both; background-color: rgb(231, 230, 230);
+}
+.bui-reg-horizontal-rule-margin {
+ margin-top: 20px; margin-bottom: 20px;
+}
+.password-horizontal-rule-margin {
+ margin-top: 5px; margin-bottom: 5px;
+}
+.requiredInformation {
+ font-size: 11px;
+}
+.header-login-window {
+ height: 100px;
+}
+.header-login-window-image {
+ padding: 18px;
+}
+.header-login-window-name {
+ line-height: 1.5em; overflow: hidden; padding-top: 18px; padding-right: 18px; font-family: clearviewatt_ltbold; font-size: 16px;
+}
+.header-login-window-role {
+ font-family: clearviewattregular; font-size: 12px;
+}
+.header-login-window-logout {
+ background: rgb(231, 229, 230); height: 27px; line-height: 27px; font-family: clearviewatt_ltbold; font-size: 11px; z-index: 10001;
+}
+.header-login-window-logout a {
+ color: rgb(103, 103, 103);
+}
+.header-login-name {
+ width: auto; line-height: 50px; padding-right: 23px; padding-left: 3px; float: left; cursor: pointer;
+}
+.error-msg-box {
+ border-radius: 3px; width: 200px; height: 35px; color: rgb(255, 255, 255); line-height: 35px; font-size: 12px; margin-top: 15px; margin-left: 30px; background-color: rgb(255, 69, 57);
+}
+.header_login_field_border_error {
+ background: url("../images/common/header/icon-error.png") no-repeat 118px rgb(255, 255, 255) !important; border: 1px solid rgb(255, 69, 57) !important; z-index: 100;
+}
+.header_login_field_border_error:hover {
+ border: 1px solid rgb(255, 69, 57) !important;
+}
+.header_login_field_3sides_error {
+ background: url("../images/common/header/icon-error.png") no-repeat 118px rgb(255, 255, 255) !important; border-right-color: rgb(255, 69, 57) !important; border-bottom-color: rgb(255, 69, 57) !important; border-left-color: rgb(255, 69, 57) !important; border-right-width: 1px !important; border-bottom-width: 1px !important; border-left-width: 1px !important; border-right-style: solid !important; border-bottom-style: solid !important; border-left-style: solid !important;
+}
+.header_login_field_3sides_error:hover {
+ border: 1px solid rgb(255, 69, 57) !important;
+}
+.header_login_field_wrapper_border_error {
+ background: url("../images/common/header/icon-error.png") no-repeat 118px rgb(255, 255, 255) !important;
+}
+.error-msg-class {
+ background: url("../images/common/header/exclamation-error.png") no-repeat 178px rgb(255, 255, 255) !important; border-color: rgb(177, 11, 59) !important; color: rgb(179, 10, 60) !important; font-size: 10px; box-shadow: inset 0px 0px 3px #b10b3b, 0px 0px 3px #b10b3b !important;
+}
+.regFormInputLoginText {
+ background: no-repeat 100% -22px rgb(250, 250, 250); padding: 10px; width: 200px; height: 20px; color: rgb(68, 68, 68); font-size: 12px; display: block;
+}
+.regFormInputLoginPassword {
+ background: no-repeat 100% -22px rgb(250, 250, 250); padding: 10px; width: 200px; height: 20px; color: rgb(68, 68, 68); font-size: 12px; display: block;
+}
+.header-login-button {
+ height: 20px; min-width: 10px !important; box-shadow: none;
+}
+#headerLoginFormID #header_login_title {
+ color: rgb(68, 68, 68); font-family: clearviewattregular; font-size: 14px; margin-top: 25px;
+}
+#headerLoginFormID #header_login_id {
+ background: url("../images/common/header/icon-username.png") no-repeat 10px rgb(250, 250, 250) !important; padding: 10px 10px 10px 36px; border-radius: 3px 3px 0px 0px !important; border: 1px solid rgb(211, 211, 211); transition:border 0.3s ease-in-out; width: 200px; height: 32px; color: rgb(68, 68, 68); font-family: clearviewattregular; font-size: 12px; margin-top: 15px; margin-bottom: 10px !important; margin-left: 30px; display: block; box-shadow: none !important;
+}
+#headerLoginFormID #header_login_id:hover {
+ border: 1px solid rgb(187, 187, 187); z-index: 90;
+}
+#headerLoginFormID #header_login_id:focus {
+ outline: 0px; border: 1px solid rgb(25, 157, 223) !important; z-index: 100; box-shadow: none; -webkit-box-shadow: none;
+}
+#headerLoginFormID #header_password {
+ background: url("../images/common/header/icon-password.png") no-repeat 10px rgb(250, 250, 250) !important; padding: 10px 10px 10px 36px; border-radius: 0px 0px 3px 3px !important; border: 1px solid rgb(211, 211, 211); transition:border 0.3s ease-in-out; width: 200px; height: 32px; color: rgb(68, 68, 68); font-family: clearviewattregular; font-size: 12px; margin-top: -11px; margin-bottom: 0px; margin-left: 30px; display: block; box-shadow: none !important;
+}
+#headerLoginFormID #header_password:hover {
+ border: 1px solid rgb(187, 187, 187); z-index: 90;
+}
+#headerLoginFormID #header_password:focus {
+ outline: 0px; border: 1px solid rgb(25, 157, 223) !important; z-index: 100; box-shadow: none; -webkit-box-shadow: none;
+}
+#headerLoginFormID #header_login_block {
+ height: 30px; margin-top: 15px;
+}
+#headerLoginFormID #header_login_block #header_login_button {
+ padding: 8px 20px; border-radius: 6px; border: 0px rgb(53, 128, 189); transition:background-color 0.3s ease-out; width: 80px; height: 30px !important; text-align: center; color: rgb(255, 255, 255) !important; line-height: 1; font-size: 14px; text-decoration: none !important; margin-left: 25px; vertical-align: middle; float: left; display: inline-block; position: relative; cursor: pointer; min-width: 60px; box-sizing: border-box; background-color: rgb(6, 122, 180); -moz-box-sizing: border-box; valign: middle;
+}
+#headerLoginFormID #header_login_block #header_login_button:hover {
+ background-color: rgb(25, 157, 223);
+}
+#headerLoginFormID #header_login_block #header_login_button:active {
+ border-color: rgb(40, 97, 141); background-color: rgb(50, 120, 177);
+}
+#headerLoginFormID #remember_me_component {
+ padding-left: 30px; margin-top: 11px;
+}
+#headerLoginFormID #remember_me_component #rememberme_header_label {
+ margin-top: 4px;
+}
+#headerLoginFormID #remember_me_component #remember-me {
+ color: rgb(102, 102, 102); font-family: clearviewattregular; font-size: 12px; font-weight: normal;
+}
+#headerLoginFormID #forgot_username_component {
+ text-align: left; padding-top: 30px; padding-bottom: 30px; padding-left: 30px; clear: both;
+}
+#headerLoginFormID #forgot_username_component .regular {
+ color: rgb(68, 68, 68); font-family: clearviewattregular; font-size: 12px;
+}
+#headerLoginFormID #forgot_username_component .link {
+ color: rgb(6, 122, 180); font-family: clearviewattregular; font-size: 12px;
+}
+.footerContainer {
+ background: 0px 0px rgb(6, 122, 180); margin: 0px auto; width: 100%;
+}
+.footerContainer .footerWrapper {
+ margin: 0px auto; width: 100%; padding-bottom: 25px; background-color: rgb(6, 122, 180);
+}
+.footerContainer .footerWrapper .footerItem {
+ margin: auto; width: 100%; height: 60px; color: rgb(255, 255, 255); line-height: 1; overflow: hidden; font-family: clearview_att_regular; font-size: 12px;
+}
+.footerContainer .footerWrapper .footerItem .divider {
+ width: 100px; margin-top: 10px; margin-bottom: 10px; border-bottom-color: rgb(255, 255, 255); border-bottom-width: 1px; border-bottom-style: solid;
+}
+.footerContainer .footerWrapper .footerItem .customerSupport {
+ width: 160px; margin-left: 30px; float: left;
+}
+.footerContainer .footerWrapper .footerItem .customerSupport .customerHelp {
+ font-size: 14px; margin-top: 45px; margin-bottom: 20px;
+}
+.footerContainer .footerWrapper .footerItem .customerSupport a {
+ color: rgb(255, 255, 255) !important;
+}
+.footerContainer .footerWrapper .footerItem .customerSupport a:hover {
+ text-decoration: none;
+}
+.footerContainer .footerWrapper .footerItem .legalInfo {
+ width: 160px; float: left;
+}
+.footerContainer .footerWrapper .footerItem .legalInfo .legal {
+ font-size: 14px; margin-top: 45px; margin-bottom: 20px;
+}
+.footerContainer .footerWrapper .footerItem .legalInfo a {
+ color: rgb(255, 255, 255) !important;
+}
+.footerContainer .footerWrapper .footerItem .legalInfo a:hover {
+ text-decoration: none;
+}
+.footerContainer .footerWrapper .footerItem .subscribeSection {
+ width: 295px; float: left;
+}
+.footerContainer .footerWrapper .footerItem .subscribeSection .subscribeSave {
+ font-size: 14px; margin-top: 45px; margin-bottom: 20px;
+}
+.footerContainer .footerWrapper .footerItem .subscribeSection .subscribeToSection {
+ overflow: hidden; margin-top: 15px;
+}
+.footerContainer .footerWrapper .footerItem .subscribeSection .subscribeToSection .emailAddress {
+ width: 170px; float: left;
+}
+.footerContainer .footerWrapper .footerItem .subscribeSection .subscribeToSection .emailAddress input {
+ padding: 5px 10px 5px 5px; width: 152px; color: rgb(255, 255, 255) !important; background-color: rgb(6, 122, 180);
+}
+.footerContainer .footerWrapper .footerItem .subscribeSection .subscribeToSection .subscribeBtn {
+ border-radius: 1px 5px 5px 1px; top: 1px; width: 95px; height: 30px; text-align: center; right: 7px; color: rgb(6, 122, 180); font-size: 14px; vertical-align: middle; float: left; position: relative; cursor: pointer; background-color: rgb(255, 255, 255);
+}
+.footerContainer .footerWrapper .footerItem .socialMedia {
+ margin-left: 0px; float: left;
+}
+.footerContainer .footerWrapper .footerItem .socialMedia .followAtt {
+ font-size: 14px; margin-top: 45px; margin-bottom: 20px;
+}
+.footerContainer .footerWrapper .footerItem .socialMedia .socialFeeds {
+ margin-top: 20px; margin-left: -8px;
+}
+.footerContainer .footerWrapper .footerItem .socialMedia .socialFeeds span {
+ margin: 0px; padding: 5px; font-size: 30px;
+}
+.footerContainer .footerWrapper .footerItem .socialMedia .socialFeeds span a {
+ margin: 0px; padding: 0px; color: rgb(255, 255, 255);
+}
+.footerContainer .footerWrapper .footerItem .socialMedia .socialFeeds span a:hover {
+ text-decoration: none;
+}
+.footerContainer .footerWrapper .dividerBottom {
+ margin: auto; width: 920px; border-bottom-color: rgb(255, 255, 255); border-bottom-width: 1px; border-bottom-style: solid;
+}
+.footerContainer .footerWrapper .feedbackSection {
+ margin: auto; width: 920px; display: none;
+}
+.footerContainer .footerWrapper .feedbackSection .dividerTop {
+ margin: auto; width: 920px; border-bottom-color: rgb(255, 255, 255); border-bottom-width: 1px; border-bottom-style: solid;
+}
+.footerContainer .footerWrapper .feedbackSection .feedbackContent {
+ margin: 30px auto;
+}
+.footerContainer .footerWrapper .feedbackSection .feedbackContent #feedbackForm {
+ height: 120px;
+}
+.footerContainer .footerWrapper .feedbackSection .feedbackContent .feedbackInfo {
+ width: 270px; color: rgb(255, 255, 255); font-family: clearview_att_regular; font-size: 12px; margin-top: -5px; margin-right: 30px; float: left;
+}
+.footerContainer .footerWrapper .feedbackSection .feedbackContent .feedbackTextSection .feedbackText {
+ padding: 10px; border-radius: 5px; border: 1px solid rgb(255, 255, 255); width: 500px; height: 100px; color: rgb(255, 255, 255); font-family: clearview_att_regular; font-size: 14px; float: left; cursor: text; background-color: rgb(6, 122, 180); resize: none;
+}
+.footerContainer .footerWrapper .feedbackSection .feedbackContent .feedbackTextSection .feedbackSubmitButton {
+ padding: 5px; border-radius: 5px; border: currentColor; width: 82px; color: rgb(6, 122, 180); font-family: clearview_att_regular; font-size: 14px; margin-top: 92px; margin-left: 16px; cursor: pointer; background-color: rgb(255, 255, 255);
+}
+.footerContainer .footerWrapper .feedbackResultMsg {
+ margin: 0px auto; width: 100%; text-align: center; color: rgb(255, 255, 255); line-height: 70px; font-family: clearview_att_regular; font-size: 18px; display: none;
+}
+.footerContainer .footerWrapper .feedbackResultMsg #feedbackMsgCheck {
+ font-size: 20px; margin-right: 20px;
+}
+.footerContainer .footerWrapper #feedbackResultDivider {
+ display: none;
+}
+.footerContainer .footerWrapper .feedbackButtonDiv {
+ margin: auto; max-width: 110px;
+}
+.footerContainer .footerWrapper .feedbackButtonDiv .feedbackButton {
+ background: rgb(255, 255, 255); margin: -1px auto auto; padding: 5px 10px; border-radius: 0px 0px 5px 5px; border: currentColor; color: rgb(6, 122, 180); font-family: clearview_att_regular; font-size: 14px; cursor: pointer;
+}
+.footerContainer .footerWrapper .feedbackButtonDiv .closeFeedbackButton {
+ background: rgb(255, 255, 255); margin: -1px auto auto; padding: 5px 10px; border-radius: 0px 0px 5px 5px; border: currentColor; color: rgb(6, 122, 180); font-family: clearview_att_regular; font-size: 14px; cursor: pointer;
+}
+.footerContainer .footerWrapper .feedbackButtonDiv .feedbackButton span {
+ padding-left: 10px; background-image: none;
+}
+.footerContainer .footerWrapper .feedbackButtonDiv .closeFeedbackButton span {
+ padding-left: 10px; background-image: none;
+}
+.footerContainer .footerWrapper .attFooterInfo {
+ margin: auto; width: 100%; color: rgb(255, 255, 255); overflow: hidden; font-family: clearview_att_regular; font-size: 12px;
+}
+.footerContainer .footerWrapper .attFooterInfo a {
+ margin: 0px; padding: 0px; color: rgb(255, 255, 255); text-decoration: underline;
+}
+.footerContainer .footerWrapper .attFooterInfo .footerLastSection {
+ overflow: hidden; margin-top: 40px;
+}
+.footerContainer .footerWrapper .attFooterInfo span {
+ padding-right: 5px; padding-left: 3px; border-right-color: rgb(255, 255, 255); border-right-width: 1px; border-right-style: solid;
+}
+.footerContainer .footerWrapper .attFooterInfo span:last-child {
+ border: currentColor;
+}
+.footerContainer .footerWrapper .attFooterInfo .attLogo {
+ width: 150px; height: 77px; margin-right: 0px; margin-left: 17px; float: left;
+}
+.footerContainer .footerWrapper .attFooterInfo .attQuality {
+ background: url("../images/common/footer/footer-consumerinfo.png") repeat-x 0px 0px; top: -5px; width: 79px; height: 82px; margin-right: 103px; float: left; position: relative;
+}
+.footerContainer .footerWrapper .attFooterInfo .attAdvertise {
+ width: 64%; float: right;
+}
+.footerContainer .footerWrapper .attFooterInfo .attAdvertise .privacyPolicy {
+ margin-top: 17px;
+}
+.footerContainer .footerWrapper .attFooterInfo .attAdvertise .privacyPolicy a {
+ text-decoration: underline;
+}
+.footerContainer .footerWrapper .attFooterInfo .attAdvertise .privacyPolicy a span {
+ padding: 0px;
+}
+.footerContainer .footerWrapper .attFooterInfo .attAdvertise .privacyPolicy a:hover {
+ text-decoration: underline;
+}
+[data-icon]::before {
+ text-transform: none; line-height: 1; font-family: "atticons"; font-variant: normal; font-weight: normal; content: attr(data-icon); speak: none; -webkit-font-smoothing: antialiased;
+}
+[class^='icon-'] {
+ text-transform: none; line-height: 1; font-family: "atticons"; font-style: normal; font-variant: normal; font-weight: normal; speak: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
+}
+[class*=' icon-'] {
+ text-transform: none; line-height: 1; font-family: "atticons"; font-style: normal; font-variant: normal; font-weight: normal; speak: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
+}
+.icon-wireless-outline::before {
+ content: "\e600";
+}
+.icon-wireless-dashboard::before {
+ content: "\e601";
+}
+.icon-website-hosting-outline::before {
+ content: "\e602";
+}
+.icon-volume-up::before {
+ content: "\e603";
+}
+.icon-volume-mute::before {
+ content: "\e604";
+}
+.icon-volume-down::before {
+ content: "\e605";
+}
+.icon-video::before {
+ content: "\e606";
+}
+.icon-video-tutorials::before {
+ content: "\e607";
+}
+.icon-video-tutorials-outline::before {
+ content: "\e608";
+}
+.icon-video-outline::before {
+ content: "\e609";
+}
+.icon-user::before {
+ content: "\e60a";
+}
+.icon-user-small::before {
+ content: "\e60b";
+}
+.icon-user-outline::before {
+ content: "\e60c";
+}
+.icon-user-large-outline::before {
+ content: "\e60d";
+}
+.icon-upgrades::before {
+ content: "\e60e";
+}
+.icon-upgrades-outline::before {
+ content: "\e60f";
+}
+.icon-unlimited-nights-weekends-outline::before {
+ content: "\e610";
+}
+.icon-unlimited-minutes-outline::before {
+ content: "\e611";
+}
+.icon-unlimited-messaging-outline::before {
+ content: "\e612";
+}
+.icon-unlimited-m2m-outline::before {
+ content: "\e613";
+}
+.icon-unlimited-calling::before {
+ content: "\e614";
+}
+.icon-tv-packages-outline::before {
+ content: "\e615";
+}
+.icon-travel-minutes-outline::before {
+ content: "\e616";
+}
+.icon-trash::before {
+ content: "\e617";
+}
+.icon-tollfree-outline::before {
+ content: "\e618";
+}
+.icon-tiles::before {
+ content: "\e619";
+}
+.icon-tiles-small::before {
+ content: "\e61a";
+}
+.icon-tickets::before {
+ content: "\e61b";
+}
+.icon-tickets-returned::before {
+ content: "\e61c";
+}
+.icon-tickets-referred::before {
+ content: "\e61d";
+}
+.icon-tickets-outline::before {
+ content: "\e61e";
+}
+.icon-tickets-open::before {
+ content: "\e61f";
+}
+.icon-tickets-escalate::before {
+ content: "\e620";
+}
+.icon-tickets-contested::before {
+ content: "\e621";
+}
+.icon-tickets-closed::before {
+ content: "\e622";
+}
+.icon-tickets-cleared::before {
+ content: "\e623";
+}
+.icon-tickets-arquived::before {
+ content: "\e624";
+}
+.icon-tickets-active::before {
+ content: "\e625";
+}
+.icon-technical-specifications::before {
+ content: "\e626";
+}
+.icon-tech-support::before {
+ content: "\e627";
+}
+.icon-tech-support-outline::before {
+ content: "\e628";
+}
+.icon-tablet::before {
+ content: "\e629";
+}
+.icon-tablet-outline::before {
+ content: "\e62a";
+}
+.icon-support::before {
+ content: "\e62b";
+}
+.icon-support-outline::before {
+ content: "\e62c";
+}
+.icon-star::before {
+ content: "\e62d";
+}
+.icon-sort::before {
+ content: "\e62e";
+}
+.icon-social-outline::before {
+ content: "\e62f";
+}
+.icon-smartphone::before {
+ content: "\e630";
+}
+.icon-smartphone-outline::before {
+ content: "\e631";
+}
+.icon-signout-outline::before {
+ content: "\e632";
+}
+.icon-sign-out::before {
+ content: "\e633";
+}
+.icon-shop::before {
+ content: "\e634";
+}
+.icon-shop-outline::before {
+ content: "\e635";
+}
+.icon-shared-outline::before {
+ content: "\e636";
+}
+.icon-shared-minutes-outline::before {
+ content: "\e637";
+}
+.icon-share::before {
+ content: "\e638";
+}
+.icon-settings::before {
+ content: "\e639";
+}
+.icon-send-invoice-outline::before {
+ content: "\e63a";
+}
+.icon-see-more::before {
+ content: "\e63b";
+}
+.icon-see-less::before {
+ content: "\e63c";
+}
+.icon-search::before {
+ content: "\e63d";
+}
+.icon-search-small::before {
+ content: "\e63e";
+}
+.icon-screen-calls-outline::before {
+ content: "\e63f";
+}
+.icon-save-time-outline::before {
+ content: "\e640";
+}
+.icon-saas-enablement-outline::before {
+ content: "\e641";
+}
+.icon-s-beam::before {
+ content: "\e642";
+}
+.icon-s-beam-outline::before {
+ content: "\e643";
+}
+.icon-rollover-outline::before {
+ content: "\e644";
+}
+.icon-rollover-minutes::before {
+ content: "\e645";
+}
+.icon-reviews-outline::before {
+ content: "\e646";
+}
+.icon-reports::before {
+ content: "\e647";
+}
+.icon-reports-outline::before {
+ content: "\e648";
+}
+.icon-recommendation-tool::before {
+ content: "\e649";
+}
+.icon-receivers-outline::before {
+ content: "\e64a";
+}
+.icon-productivity-outline::before {
+ content: "\e64b";
+}
+.icon-print::before {
+ content: "\e64c";
+}
+.icon-plus::before {
+ content: "\e64d";
+}
+.icon-plus-outline::before {
+ content: "\e64e";
+}
+.icon-play::before {
+ content: "\e64f";
+}
+.icon-platform-as-service-outline::before {
+ content: "\e650";
+}
+.icon-plans::before {
+ content: "\e651";
+}
+.icon-plans-outline::before {
+ content: "\e652";
+}
+.icon-pie-chart::before {
+ content: "\e653";
+}
+.icon-photos::before {
+ content: "\e654";
+}
+.icon-photos-outline::before {
+ content: "\e655";
+}
+.icon-phone-data-outline::before {
+ content: "\e656";
+}
+.icon-payments::before {
+ content: "\e657";
+}
+.icon-payments-outline::before {
+ content: "\e658";
+}
+.icon-pause::before {
+ content: "\e659";
+}
+.icon-password::before {
+ content: "\e65a";
+}
+.icon-password-outline::before {
+ content: "\e65b";
+}
+.icon-overview::before {
+ content: "\e65c";
+}
+.icon-overview-small::before {
+ content: "\e65d";
+}
+.icon-overages::before {
+ content: "\e65e";
+}
+.icon-overages-outline::before {
+ content: "\e65f";
+}
+.icon-outage-outline::before {
+ content: "\e660";
+}
+.icon-orders::before {
+ content: "\e661";
+}
+.icon-orders-outline::before {
+ content: "\e662";
+}
+.icon-optional-applications-outline::before {
+ content: "\e663";
+}
+.icon-office-at-hand-outline::before {
+ content: "\e664";
+}
+.icon-offers::before {
+ content: "\e665";
+}
+.icon-offers-outline::before {
+ content: "\e666";
+}
+.icon-notifications::before {
+ content: "\e667";
+}
+.icon-notifications-outline::before {
+ content: "\e668";
+}
+.icon-normal-screen::before {
+ content: "\e669";
+}
+.icon-nights-weekends-outline::before {
+ content: "\e66a";
+}
+.icon-new-requests-outline::before {
+ content: "\e66b";
+}
+.icon-network::before {
+ content: "\e66c";
+}
+.icon-network-dashboard::before {
+ content: "\e66d";
+}
+.icon-netbook::before {
+ content: "\e66e";
+}
+.icon-netbook-outline::before {
+ content: "\e66f";
+}
+.icon-music::before {
+ content: "\e670";
+}
+.icon-music-video::before {
+ content: "\e671";
+}
+.icon-music-video-outline::before {
+ content: "\e672";
+}
+.icon-music-outline::before {
+ content: "\e673";
+}
+.icon-modem::before {
+ content: "\e674";
+}
+.icon-modem-outline::before {
+ content: "\e675";
+}
+.icon-mobile-insurance::before {
+ content: "\e676";
+}
+.icon-mobile-insurance-outline::before {
+ content: "\e677";
+}
+.icon-mobile-2-mobile-outline::before {
+ content: "\e678";
+}
+.icon-missed-calls-outline::before {
+ content: "\e679";
+}
+.icon-minutes::before {
+ content: "\e67a";
+}
+.icon-minutes-outline::before {
+ content: "\e67b";
+}
+.icon-messaging::before {
+ content: "\e67c";
+}
+.icon-messaging-toolkit-outline::before {
+ content: "\e67d";
+}
+.icon-messaging-outline::before {
+ content: "\e67e";
+}
+.icon-messaging-email::before {
+ content: "\e67f";
+}
+.icon-messaging-email-outline::before {
+ content: "\e680";
+}
+.icon-message-small::before {
+ content: "\e681";
+}
+.icon-maintenance::before {
+ content: "\e682";
+}
+.icon-location-pin::before {
+ content: "\e683";
+}
+.icon-location-pin-small::before {
+ content: "\e684";
+}
+.icon-local-search::before {
+ content: "\e685";
+}
+.icon-local-long-distance-outline::before {
+ content: "\e686";
+}
+.icon-list::before {
+ content: "\e687";
+}
+.icon-learn::before {
+ content: "\e688";
+}
+.icon-learn-outline::before {
+ content: "\e689";
+}
+.icon-laptop::before {
+ content: "\e68a";
+}
+.icon-landline::before {
+ content: "\e68b";
+}
+.icon-landline-outline::before {
+ content: "\e68c";
+}
+.icon-invoices::before {
+ content: "\e68d";
+}
+.icon-invoices-outline::before {
+ content: "\e68e";
+}
+.icon-inventory::before {
+ content: "\e68f";
+}
+.icon-intranet-outline::before {
+ content: "\e690";
+}
+.icon-interpreter::before {
+ content: "\e691";
+}
+.icon-interpreter-outline::before {
+ content: "\e692";
+}
+.icon-internet::before {
+ content: "\e693";
+}
+.icon-internet-outline::before {
+ content: "\e694";
+}
+.icon-internet-24-outline::before {
+ content: "\e695";
+}
+.icon-internet-18-outline::before {
+ content: "\e696";
+}
+.icon-international-outline::before {
+ content: "\e697";
+}
+.icon-international-long-distance-outline::before {
+ content: "\e698";
+}
+.icon-international-data-outline::before {
+ content: "\e699";
+}
+.icon-installation-outline::before {
+ content: "\e69a";
+}
+.icon-information::before {
+ content: "\e69b";
+}
+.icon-info-success::before {
+ content: "\e69c";
+}
+.icon-info-alert::before {
+ content: "\e69d";
+}
+.icon-info-alert-outline::before {
+ content: "\e69e";
+}
+.icon-included-checkmark::before {
+ content: "\e69f";
+}
+.icon-included-checkmark-outline::before {
+ content: "\e6a0";
+}
+.icon-hotspot::before {
+ content: "\e6a1";
+}
+.icon-hotspot-outline::before {
+ content: "\e6a2";
+}
+.icon-hotspot-access-outline::before {
+ content: "\e6a3";
+}
+.icon-home::before {
+ content: "\e6a4";
+}
+.icon-help::before {
+ content: "\e6a5";
+}
+.icon-help-outline::before {
+ content: "\e6a6";
+}
+.icon-hd::before {
+ content: "\e6a7";
+}
+.icon-hd-outline::before {
+ content: "\e6a8";
+}
+.icon-hamburger::before {
+ content: "\e6a9";
+}
+.icon-group-outline::before {
+ content: "\e6aa";
+}
+.icon-gps::before {
+ content: "\e6ab";
+}
+.icon-gps-outline::before {
+ content: "\e6ac";
+}
+.icon-go-paperless-email-outline::before {
+ content: "\e6ad";
+}
+.icon-global-messaging-outline::before {
+ content: "\e6ae";
+}
+.icon-gamepad-outline::before {
+ content: "\e6af";
+}
+.icon-game-devices::before {
+ content: "\e6b0";
+}
+.icon-full-screen::before {
+ content: "\e6b1";
+}
+.icon-forward-calls-outline::before {
+ content: "\e6b2";
+}
+.icon-forum::before {
+ content: "\e6b3";
+}
+.icon-forum-outline::before {
+ content: "\e6b4";
+}
+.icon-filter::before {
+ content: "\e6b5";
+}
+.icon-extras::before {
+ content: "\e6b6";
+}
+.icon-extras-outline::before {
+ content: "\e6b7";
+}
+.icon-erase::before {
+ content: "\e6b8";
+}
+.icon-envelope::before {
+ content: "\e6b9";
+}
+.icon-envelope-outline::before {
+ content: "\e6ba";
+}
+.icon-enterprise-messaging-outline::before {
+ content: "\e6bb";
+}
+.icon-edit::before {
+ content: "\e6bc";
+}
+.icon-duplicate::before {
+ content: "\e6bd";
+}
+.icon-dropdown-up::before {
+ content: "\e6be";
+}
+.icon-dropdown-down::before {
+ content: "\e6bf";
+}
+.icon-download::before {
+ content: "\e6c0";
+}
+.icon-download-outline::before {
+ content: "\e6c1";
+}
+.icon-disputes::before {
+ content: "\e6c2";
+}
+.icon-detailed-billing::before {
+ content: "\e6c3";
+}
+.icon-detailed-billing-outline::before {
+ content: "\e6c4";
+}
+.icon-desktop-outline::before {
+ content: "\e6c5";
+}
+.icon-data::before {
+ content: "\e6c6";
+}
+.icon-data-outline::before {
+ content: "\e6c7";
+}
+.icon-data-additional-outline::before {
+ content: "\e6c8";
+}
+.icon-compare::before {
+ content: "\e6c9";
+}
+.icon-cloud-storage-outline::before {
+ content: "\e6ca";
+}
+.icon-cloud-outline::before {
+ content: "\e6cb";
+}
+.icon-cloud-computing-outline::before {
+ content: "\e6cc";
+}
+.icon-cloud-backup::before {
+ content: "\e6cd";
+}
+.icon-cloud-backup-outline::before {
+ content: "\e6ce";
+}
+.icon-circle-information-outline::before {
+ content: "\e6cf";
+}
+.icon-circle-action-plus-outline::before {
+ content: "\e6d0";
+}
+.icon-circle-action-minus-outline::before {
+ content: "\e6d1";
+}
+.icon-circle-action-empty::before {
+ content: "\e6d2";
+}
+.icon-circle-action-delete-outline::before {
+ content: "\e6d3";
+}
+.icon-circle-action-close::before {
+ content: "\e6d4";
+}
+.icon-circle-action-check-outline::before {
+ content: "\e6d5";
+}
+.icon-circle-action-remove::before {
+ content: "\e6d6";
+}
+.icon-circle-action-add::before {
+ content: "\e6d7";
+}
+.icon-chip-outline::before {
+ content: "\e6d8";
+}
+.icon-chevron-up::before {
+ content: "\e6d9";
+}
+.icon-chevron-right::before {
+ content: "\e6da";
+}
+.icon-chevron-left::before {
+ content: "\e6db";
+}
+.icon-chevron-down::before {
+ content: "\e6dc";
+}
+.icon-checkbox-checkmark::before {
+ content: "\e6dd";
+}
+.icon-chat::before {
+ content: "\e6de";
+}
+.icon-chat-small::before {
+ content: "\e6df";
+}
+.icon-case-studies::before {
+ content: "\e6e0";
+}
+.icon-cart::before {
+ content: "\e6e1";
+}
+.icon-cart-small::before {
+ content: "\e6e2";
+}
+.icon-camera::before {
+ content: "\e6e3";
+}
+.icon-camera-outline::before {
+ content: "\e6e4";
+}
+.icon-calendar-outline::before {
+ content: "\e6e5";
+}
+.icon-business::before {
+ content: "\e6e6";
+}
+.icon-business-tv::before {
+ content: "\e6e7";
+}
+.icon-business-tv-outline::before {
+ content: "\e6e8";
+}
+.icon-business-tv-additional-packs-outline::before {
+ content: "\e6e9";
+}
+.icon-business-outline::before {
+ content: "\e6ea";
+}
+.icon-business-center::before {
+ content: "\e6eb";
+}
+.icon-business-center-outline::before {
+ content: "\e6ec";
+}
+.icon-bundles::before {
+ content: "\e6ed";
+}
+.icon-bundles-outline::before {
+ content: "\e6ee";
+}
+.icon-billing::before {
+ content: "\e6ef";
+}
+.icon-billing-history-outline::before {
+ content: "\e6f0";
+}
+.icon-billing-dashboard::before {
+ content: "\e6f1";
+}
+.icon-bd-maps::before {
+ content: "\e6f2";
+}
+.icon-basicphone::before {
+ content: "\e6f3";
+}
+.icon-basicphone-outline::before {
+ content: "\e6f4";
+}
+.icon-barcode-outline::before {
+ content: "\e6f5";
+}
+.icon-bar-chart-vertical::before {
+ content: "\e6f6";
+}
+.icon-bar-chart-horizontal::before {
+ content: "\e6f7";
+}
+.icon-arrow-up::before {
+ content: "\e6f8";
+}
+.icon-arrow-up-right::before {
+ content: "\e6f9";
+}
+.icon-arrow-up-left::before {
+ content: "\e6fa";
+}
+.icon-arrow-up-circle::before {
+ content: "\e6fb";
+}
+.icon-arrow-right::before {
+ content: "\e6fc";
+}
+.icon-arrow-right-circle::before {
+ content: "\e6fd";
+}
+.icon-arrow-left::before {
+ content: "\e6fe";
+}
+.icon-arrow-left-circle::before {
+ content: "\e6ff";
+}
+.icon-arrow-down::before {
+ content: "\e700";
+}
+.icon-arrow-down-right::before {
+ content: "\e701";
+}
+.icon-arrow-down-left::before {
+ content: "\e702";
+}
+.icon-arrow-down-circle::before {
+ content: "\e703";
+}
+.icon-arrow-double-right::before {
+ content: "\e704";
+}
+.icon-arrow-double-left::before {
+ content: "\e705";
+}
+.icon-apps-media::before {
+ content: "\e706";
+}
+.icon-apps-media-outline::before {
+ content: "\e707";
+}
+.icon-apps-marketplace::before {
+ content: "\e708";
+}
+.icon-apps-marketplace-outline::before {
+ content: "\e709";
+}
+.icon-analytics::before {
+ content: "\e70a";
+}
+.icon-alt-media-subscription-outline::before {
+ content: "\e70b";
+}
+.icon-all-locations::before {
+ content: "\e70c";
+}
+.icon-all-devices::before {
+ content: "\e70d";
+}
+.icon-all-devices-outline::before {
+ content: "\e70e";
+}
+.icon-alarms::before {
+ content: "\e70f";
+}
+.icon-alarms-outline::before {
+ content: "\e710";
+}
+.icon-address-ip-outline::before {
+ content: "\e711";
+}
+.icon-addons::before {
+ content: "\e712";
+}
+.icon-addons-outline::before {
+ content: "\e713";
+}
+.icon-additional-services::before {
+ content: "\e714";
+}
+.icon-additional-minutes-outline::before {
+ content: "\e715";
+}
+.icon-add-widget::before {
+ content: "\e716";
+}
+.icon-activity-feed::before {
+ content: "\e717";
+}
+.icon-accessories::before {
+ content: "\e718";
+}
+.icon-accessories-outline::before {
+ content: "\e719";
+}
+.icon-foundation-account::before {
+ content: "\e71a";
+}
+.icon-billing-account::before {
+ content: "\e71b";
+}
+.headerContainer {
+ left: 0px; top: 0px; width: 100%; color: rgb(255, 255, 255); line-height: 50px; position: fixed; z-index: 999; background-color: rgb(6, 122, 180); height: 55px;
+}
+.icon-infinite::before {
+ content: "\e71c";
+}
+.headerContentContainer .primaryMenuContainer {
+ font-family: clearview_att_regular; font-size: 18px;
+}
+.icon-social-business-community::before {
+ content: "\e71d";
+}
+.icon-social-facebook::before {
+ content: "\e71e";
+}
+.icon-social-feed::before {
+ content: "\e71f";
+}
+.icon-social-google-plus::before {
+ content: "\e720";
+}
+.icon-social-linkedin::before {
+ content: "\e721";
+}
+.icon-social-network-exchange::before {
+ content: "\e722";
+}
+.icon-social-twitter-bird::before {
+ content: "\e723";
+}
+.icon-social-twitter::before {
+ content: "\e724";
+}
+.icon-social-youtube::before {
+ content: "\e725";
+}
+.icon-blocked::before {
+ content: "\e726";
+}
+.icon-talk-text::before {
+ content: "\e727";
+}
+.icon-blocked::before {
+ content: "\e726";
+}
+.icon-group::before {
+ content: "\e72c";
+}
+.icon-group-create::before {
+ content: "\e72b";
+}
+.headerContentContainer {
+ margin: auto; width: 100%; height: 50px; margin-top:5px;
+}
+.headerContentContainer .primaryMenuContainer .linkToRegistration {
+ color: rgb(255, 255, 255); float: right;
+}
+.headerContentContainer .primaryMenuContainer .ATTLogo {
+ background: url("../images/common/header/attLogo.png") no-repeat -10px -10px; width: 36px; height: 36px; margin-top: 7px; margin-right: 35px; margin-left: 10px; float: left;
+}
+.headerContentContainer .primaryMenuContainer .attHomeContainer {
+ float: left; cursor: pointer;
+}
+.headerContentContainer .primaryMenuContainer .attHomeContainer .businessCenterR {
+ font-family: clearviewatt_ltbold; margin-right: 4px; margin-left: 2px; float: left;
+}
+.headerContentContainer .primaryMenuContainer .attHomeContainer .businessCenterR a {
+ color: rgb(255, 255, 255); font-family: clearviewatt_ltbold; font-size: 18px; text-decoration: none;
+}
+.headerContentContainer .primaryMenuContainer .attHomeContainer .businessCenterR a:hover {
+ color: rgb(191, 231, 251); text-decoration: none;
+}
+.headerContentContainer .primaryMenuContainer .attHomeContainer .businessCenterR a:active {
+ color: rgb(191, 231, 251); text-decoration: none;
+}
+.headerContentContainer .primaryMenuContainer .attHomeContainer .businessCenterR:hover {
+ margin-top: -2px;
+}
+.headerContentContainer .primaryMenuContainer .attHomeContainer .businessCenterR:active {
+ margin-top: -2px;
+}
+.headerContentContainer .primaryMenuContainer .primaryMenuOptionsContainer .primaryMenuOptionLink {
+ color: rgb(255, 255, 255); font-family: clearviewatt; font-size: 18px; text-decoration: none; margin-left: 20px; float: left; cursor: pointer;
+}
+/* .primaryMenuOptionLink { */
+/* width: 8em; text-overflow: clip; text-overflow: ellipsis; text-overflow: "…"; white-space: nowrap; */
+/* } */
+.headerContentContainer .primaryMenuContainer .primaryMenuOptionsContainer .primaryMenuOptionLink:hover {
+ color: rgb(191, 231, 251); text-decoration: none; margin-top: -2px;
+}
+.headerContentContainer .primaryMenuContainer .primaryMenuOptionsContainer .primaryMenuOptionLink:focus {
+ color: rgb(191, 231, 251); text-decoration: none; margin-top: -2px;
+}
+.headerContentContainer .primaryMenuContainer .primaryMenuOptionsContainer .primaryMenuOptionLink:active {
+ color: rgb(191, 231, 251); text-decoration: none; margin-top: -2px;
+}
+.headerContentContainer .primaryMenuContainer .pageNameContainer .pageName {
+ color: rgb(255, 255, 255); font-family: clearviewatt_ltbold; font-size: 18px; text-decoration: none; margin-left: 30px; float: left; cursor: pointer;
+}
+.headerContentContainer .primaryMenuContainer .pageNameContainer .pageName:hover {
+ color: rgb(191, 231, 251); text-decoration: none; margin-top: -2px;
+}
+.headerContentContainer .primaryMenuContainer .pageNameContainer .pageName:active {
+ color: rgb(191, 231, 251); text-decoration: none; margin-top: -2px;
+}
+.headerContentContainer .primaryMenuContainer .selectedOptionIndicator {
+ border-width: 0px 8px 8px; border-style: solid; border-color: transparent transparent rgb(255, 255, 255); width: 0px; height: 0px; margin-top: 43px; position: absolute;
+}
+.headerContentContainer .primaryMenuContainer .loginIcon {
+ background: url("") no-repeat -10px -41px; width: 16px; height: 21px; color: rgb(255, 255, 255); line-height: 50px; font-size: 18px; margin-top: 14px; margin-right: 10px; float: left; position: relative; cursor: pointer;
+}
+.headerContentContainer .primaryMenuContainer .loginIcon:hover {
+ background-position: -10px -10px; margin-top: 12px;
+}
+.headerContentContainer .primaryMenuContainer .loginIcon:focus {
+ background-position: -10px -10px; margin-top: 12px;
+}
+.headerContentContainer .primaryMenuContainer .icon-cart {
+ background-position: -1000px; color: rgb(255, 255, 255); line-height: 50px; font-size: 18px; margin-right: 34px; float: left; position: relative; cursor: pointer;
+}
+.headerContentContainer .primaryMenuContainer .icon-cart:hover {
+ color: rgb(191, 231, 251); margin-top: -2px;
+}
+.headerContentContainer .primaryMenuContainer .headerIconContainer {
+ height: 50px; float: right; position: relative;
+}
+.headerContentContainer .primaryMenuContainer .headerIconContainer .loginName {
+ line-height: 50px; font-family: clearviewatt; font-size: 12px; margin-right: 31px; float: left; position: relative;
+}
+.headerContentContainer .primaryMenuContainer .headerIconContainer .chatIcon {
+ background: url("../images/headerChatIcon.png") no-repeat -3px -3px; width: 18px; height: 19px; color: rgb(255, 255, 255); line-height: 50px; margin-top: 16px; margin-right: 32px; float: left; position: relative; cursor: pointer;
+}
+.headerContentContainer .primaryMenuContainer .headerIconContainer .chatIcon:hover {
+ background-position: -3px -4px; margin-top: 14px;
+}
+.headerContentContainer .primaryMenuContainer .headerIconContainer .chatIcon:focus {
+ background-position: -3px -4px; margin-top: 14px;
+}
+.headerContentContainer .primaryMenuContainer .headerIconContainer .searchIcon {
+ background-position: -1000px; color: rgb(255, 255, 255); line-height: 50px; margin-right: 31px; float: left; position: relative; cursor: pointer;
+}
+.headerContentContainer .primaryMenuContainer .headerIconContainer .searchIcon:hover {
+ color: rgb(191, 231, 251); margin-top: -2px;
+}
+.selectedPrimaryMenuOption {
+ color: rgb(255, 255, 255); font-family: clearviewatt_ltbold !important;
+}
+.secondaryTopMenuContainer .secondaryMenuContentContainer .thirdMenuContainer .thirdFourthMenuContainer {
+
+}
+.secondaryTopMenuContainer {
+ color: rgb(102, 102, 102); line-height: 50px; font-family: clearviewatt;
+ font-size: 16px; float: left; background-color: rgb(255, 255, 255); z-index: 1000;
+ top: 57px; margin: 0 auto 10; height: auto; margin-left: 201px; padding-right: 10px;
+ /* width: 100%; margin-top: 50px; margin-bottom: 50px; */
+}
+.secondaryTopMenuContainer .secondaryMenuContentContainer .secondaryMenuOption {
+ overflow: hidden; float: left; cursor: pointer;
+}
+.secondaryTopMenuContainer .secondaryMenuContentContainer .secondaryMenuOption .selectionDiv {
+ top: -4px; height: 4px; position: relative; background-color: rgb(6, 122, 180);
+}
+.secondaryTopMenuContainer .secondaryMenuContentContainer .secondaryMenuOption .secondaryMenuOptionLink {
+ outline: 0px; color: rgb(102, 102, 102); text-decoration: none;
+}
+.secondaryTopMenuContainer .secondaryMenuContentContainer .secondaryMenuOption .secondaryMenuOptionLink:hover {
+ font-weight: bold; font-size: 16px; text-decoration: none;
+}
+.secondaryTopMenuContainer .secondaryMenuContentContainer .secondaryMenuOption .secondaryMenuOptionLink:focus {
+ font-weight: bold; font-size: 16px; text-decoration: none;
+}
+.secondaryTopMenuContainer .secondaryMenuContentContainer .secondaryMenuOption {
+ outline: 0px; color: rgb(102, 102, 102); text-decoration: none;
+}
+.secondaryTopMenuContainer .secondaryMenuContentContainer .secondaryMenuOption {
+ font-family: clearviewatt_ltbold; font-size: 16px; text-decoration: none;
+}
+.secondaryTopMenuContainer .secondaryMenuContentContainer .secondaryMenuOption {
+ font-family: clearviewatt_ltbold; font-size: 16px; text-decoration: none;
+}
+.selectedSecondaryMenuOption {
+ font-family: clearviewatt_ltbold; font-size: 16px;
+}
+
+.secondThirdFourthContainer {
+ display: block;
+}
+
+.thirdSubmenuOptionLink a:hover:after, .headerMenus selected {
+ outline: 0;
+ font-weight: bold;
+ !important;
+}
+
+.thirdSubmenuContainer {
+ font-family: clearviewatt;
+ font-size: 14px;
+ float: left;
+ background-color: rgb(255, 255, 255);
+ left: 0;
+/* top: 90px; */
+/* margin-left: 201px; */
+ padding-right: 10px;
+ display: inline-flex;
+ width: auto;
+ position: relative;
+}
+.fourthMenuContainer {
+ font-family: clearviewatt;
+ font-size: 14px;
+ float: left;
+ background-color: rgb(255, 255, 255);
+ width: auto;
+ margin-top: -20px;
+ margin-bottom: 30px;
+ position: relative;
+}
+.thirdMenuContainer .thirdMenuContentContainer .thirdSubmenuOption {
+ cursor: pointer;
+}
+.thirdMenuContainer .thirdMenuContentContainer .thirdSubmenuOption .selectionThirdDiv {
+ !important; top: -4px; height: 4px; position: relative; background-color: rgb(6, 122, 180);
+}
+.thirdMenuContainer .thirdMenuContentContainer .thirdSubmenuOption {
+ !important; outline: 0px; color: rgb(102, 102, 102); text-decoration: none; !important;
+}
+.thirdMenuContainer .thirdMenuContentContainer .thirdSubmenuOption {
+ !important; font-family: clearviewatt_ltbold; font-size: 14px; text-decoration: none; font-weight: bold; !important;
+}
+.thirdMenuContainer .thirdMenuContentContainer .thirdSubmenuOption {
+ !important; font-family: clearviewatt_ltbold; font-size: 14px; text-decoration: none; !important;
+}
+.selectedThirdMenuOption {
+/* font-family: clearviewatt_ltbold; font-size: 14px; */
+}
+
+.fourthMenuContainer .fourthMenuContentContainer {
+ margin: auto; width: 100%;
+}
+.fourthMenuContainer .fourthMenuContentContainer .fourthSubmenuOption {
+ overflow: hidden; float: left; cursor: pointer;
+}
+.fourthMenuContainer .fourthMenuContentContainer .fourthSubmenuOption .selectionFourthDiv {
+ top: -4px; height: 4px; position: relative; background-color: rgb(6, 122, 180);
+}
+.fourthMenuContainer .fourthMenuContentContainer .fourthSubmenuOption .fourthSubmenuOptionLink {
+ outline: 0px; color: rgb(102, 102, 102); text-decoration: none;
+}
+.fourthMenuContainer .fourthMenuContentContainer .fourthSubmenuOption .fourthSubmenuOptionLink:hover {
+ font-family: clearviewatt_ltbold; font-size: 14px; text-decoration: none;
+}
+.fourthMenuContainer .fourthMenuContentContainer .fourthSubmenuOption .fourthSubmenuOptionLink:focus {
+ font-family: clearviewatt_ltbold; font-size: 14px; text-decoration: none;
+}
+.selectedfourthMenuOption {
+/* font-family: clearviewatt_ltbold; font-size: 14px; */
+}
+
+.homePageNameHighlight {
+ font-family: clearviewatt_ltbold; font-size: 16px;
+}
+.megaMenuContainer {
+ width: 100%; overflow: auto; margin-top: 101px; position: fixed; z-index: 3000; height: 55px; max-height: 500px; opacity: 1; background-color: rgb(255, 255, 255);
+}
+.megaMenuContentContainer {
+ margin: auto; width: 100%;
+}
+.megaMenuContentContainer .megaMenuTable {
+ width: 100%;
+}
+.megaMenuContentContainer .megaMenuTable .megaMenuRow .categoryContainerColumn {
+ vertical-align: top;
+}
+.megaMenuContentContainer .megaMenuTable .megaMenuRow .categoryContainerColumn .categoryContainer {
+ margin-bottom: 32px; float: left;
+}
+.megaMenuContentContainer .megaMenuTable .megaMenuRow .categoryContainerColumn .categoryContainer .categoryTitle {
+ color: rgb(68, 68, 68); font-family: clearviewatt_ltbold; font-size: 14px; margin-top: 36px; margin-bottom: 22px;
+}
+.megaMenuContentContainer .megaMenuTable .megaMenuRow .categoryContainerColumn .categoryContainer .categoryOptionLink {
+ outline: 0px; color: rgb(68, 68, 68); font-family: clearviewatt; font-size: 12px; text-decoration: none; margin-bottom: 13px;
+}
+.megaMenuContentContainer .megaMenuTable .megaMenuRow .categoryContainerColumn .categoryContainer .categoryOptionLink:hover {
+ color: rgb(25, 157, 223); text-decoration: none;
+}
+.megaMenuContentContainer .megaMenuTable .megaMenuRow .categoryContainerColumn .categoryContainer .categoryOptionLink:focus {
+ color: rgb(25, 157, 223); text-decoration: none;
+}
+.megaMenuContentContainer .megaMenuTable .megaMenuRow .categoryContainerColumn .categoryContainer .categoryOptionLink:active {
+ color: rgb(25, 157, 223); text-decoration: none;
+}
+.megaMenuContentContainer .megaMenuTable .megaMenuSecondRow .categoryTitle {
+ margin-top: 4px !important;
+}
+.addMargin {
+ margin-top: 50px;
+}
+.contents {
+ padding-top: 100px;
+}
+.megaMenuContentContainer .megaMenuTable li {
+ float: left;
+}
+.megaMenuContentContainer ul {
+ margin: 0px;
+}
+.unselectable {
+ -ms-user-select: none; -webkit-user-select: none; -moz-user-select: none; -o-user-select: none; user-select: none; -khtml-user-select: none;
+}
+.chatBox {
+ background: rgb(242, 242, 242); border: 1px solid rgb(187, 187, 187); top: 50px; width: 250px; right: 30px; display: none; position: absolute; z-index: 1000; min-height: 145px; box-sizing: border-box; box-shadow: 0px 4px 4px rgba(0,0,0,0.25); -webkit-box-sizing: border-box; -moz-box-sizing: border-box;
+}
+.chatBox .arrow {
+ left: 233px; top: -8px; width: 0px; height: 0px; border-right-color: transparent; border-bottom-color: rgb(255, 255, 255); border-left-color: transparent; border-right-width: 8px; border-bottom-width: 8px; border-left-width: 8px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; position: absolute; z-index: 1001;
+}
+.chatBox-header {
+ padding: 0px 25px; width: 250px; height: 85px; position: relative; box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box;
+}
+.chatBox-heading {
+ left: 25px; top: 18px; color: rgb(68, 68, 68); line-height: 28px; font-family: omnes_attlight; font-size: 24px; position: absolute;
+}
+.chatBox-question {
+ left: 25px; top: 53px; color: rgb(68, 68, 68); line-height: 16.8px; font-family: clearviewatt; font-size: 13px; position: absolute;
+}
+.circle_close_chat {
+ top: 22px; right: 20px; color: rgb(68, 68, 68); font-size: 14px; position: absolute; cursor: pointer;
+}
+.chatBox-body {
+ padding: 0px 15px; width: 250px; color: rgb(68, 68, 68); font-size: 12px; position: relative; box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box;
+}
+.chat-option {
+ height: 35px; line-height: 45px; margin-bottom: 10px; position: relative;
+}
+.chat-option .hr-chatbox {
+ margin: 10px 0px; padding: 0px; border: 0px currentColor !important; width: inherit; height: 1px; display: block;
+}
+.chat-icon-info {
+ top: 15px; right: 6px; font-size: 16px; position: absolute;
+}
+.chat-option > span {
+ left: 10px; top: 0px; position: absolute; cursor: pointer;
+}
+.chat-option > span {
+ left: 10px; top: 0px; position: absolute;
+}
+.chat-option > span:hover {
+ color: rgb(6, 122, 180);
+}
+
+.box1 {
+ min-width: 260px;
+ /* min-height:165px; */
+
+ height: auto;
+ width: auto;
+ z-index: 1000;
+ display: none;
+ background: #FFF;
+ border: solid 1px #BBBBBB;
+ /* border-radius:5px; */
+
+ box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
+ position: relative;
+}
+.box1 *,
+.box1 :after,
+.box1 :before {
+ -webkit-box-sizing: content-box;
+ -moz-box-sizing: content-box;
+ box-sizing: content-box;
+}
+.box1 a.close {
+ color: red;
+ font-size: 12px;
+ font-family: arial;
+ text-decoration: underline;
+}
+.box1 .arrow {
+ width: 0;
+ height: 0;
+ border-left: 8px solid transparent;
+ border-right: 8px solid transparent;
+ border-bottom: 8px solid #FFF;
+ position: absolute;
+ left: 1px;
+ top: -8px;
+ z-index: 1001;
+}
+.headerContentContainer .primaryMenuContainer .headerIconContainer .popbox .box1 ul {
+ margin-left: 0px;
+}
+
+.logo-image {
+ .att-logo;
+ display: inline-block;
+ vertical-align: middle;
+ margin-top: -3px;
+ }
+
+.megamenu-tabs .megamenu__item {
+ padding: 0 0;
+}
+.megamenu-tabs .megamenu__item span {
+ font-size: 18px;
+}
+
+.submenu-tabs {
+ line-height:50px;
+
+}
+.submenu-tabs .sub__menu{
+ top:54px;
+}
+
+.top-megamenu .megamenu-tabs ul{
+ width:98%;
+ list-style: none;
+}
+.top-megamenu .megamenu-tabs ul li {
+ display: inline-block;
+ text-align: left;
+
+}
+
+.favorites-icon-active {
+ color: #fbb313;
+}
+
+.favorites-icon-inactive {
+ color: #666666;
+}
+.favorites-window {
+ width: 100%;
+ height: auto;
+ //margin: auto;
+ font-size: 14px !important;
+ display: flex;
+ font-family: clearview_att_regular;
+ margin-top: 25px;
+ margin-left: 25px;
+ z-index: 1000;
+
+ a:link, a:active, a:hover {
+ margin-left: 3px;
+ margin-right: 20px;
+ text-decoration: none;
+ }
+}
+
+ .favoritesLargeText {
+ font-weight: 400;
+ font-family: Arial !important;
+ font-size: 18px;
+ text-align: center;
+ }
+
+
+.favorites-window-empty {
+ width: 100%;
+ height: auto;
+ display:flex;
+ justify-content:center;
+ align-items:center;
+ margin: auto;
+ text-align: center;
+
+}
+
+.favoritesNormalText {
+ font-size: 14px;
+ text-align: center;
+ color: #666666
+}
+
+.columns{
+ column-count: 5;
+ line-height: 15px;
+ column-gap: 40px;
+ column-rule: 2px outset #666666;
+
+}
+
+.columns-div {
+ min-width: 90%;
+ margin-top: -5px;
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/portal_ebz_header.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/portal_ebz_header.css
new file mode 100644
index 00000000..639b5e75
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/portal_ebz_header.css
@@ -0,0 +1,63 @@
+li {
+ list-style: none;
+}
+
+#userIcon:hover {
+ color: rgb(191, 231, 239);
+}
+
+ .body-content-jsp {
+ margin-top: 50px;
+ min-height:500px;
+ margin-left:210px;
+ margin-right:50px;
+}
+
+.headerContentContainer .primaryMenuContainer .headerIconContainer .popbox .openpopbox:hover
+ {
+ color: #bfe7fb;
+ margin-top: -2px;
+ text-decoration: none;
+ outline: none
+}
+
+.headerContentContainer .primaryMenuContainer .headerIconContainer .popbox .openpopbox
+ {
+ color: #fff;
+ display: block;
+ min-width: 70px;
+ max-width: 115px;
+ text-decoration: none
+}
+
+a {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
+}
+
+/* a:active,a:hover {
+ outline: 0;
+ font-weight: bold;
+} */
+b,strong {
+ font-weight: 700
+}
+
+/* .thirdMenuContainer { */
+/* width: 100%; */
+/* overflow: auto; */
+/* margin-top: 101px; */
+/* position: fixed; */
+/* z-index: 3000; */
+/* min-height: 140px; */
+/* max-height: 500px; */
+/* opacity: 1; */
+/* background-color: rgb(255, 255, 255); */
+
+/* } */
+
+.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden .focusable:active,.visuallyhidden .focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/fn-ebz.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/fn-ebz.css
new file mode 100644
index 00000000..f81cc2a4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/fn-ebz.css
@@ -0,0 +1,1614 @@
+@CHARSET "ISO-8859-1";
+
+* {
+ font-family: Arial;
+}
+
+/* html, body {
+ overflow:auto
+} */
+div.fn-ebz-container {
+ position: relative;
+ display: inline-block;
+ margin-top: 4px;
+ padding-bottom: 16px;
+}
+
+div.fn-ebz-small-container {
+ position: relative;
+ display: inline-block;
+ margin-top: 4px;
+ padding-bottom: 16px;
+ height: 30px;
+}
+
+.myDivBackground div {
+ font-family: clearviewatt;
+ font-size: 11px;
+ font-weight: normal;
+ background: rgb(242, 242, 242);
+}
+
+.myGrid tr.z-row td.z-row-inner {
+ border: 0px rgb(242, 242, 242);
+ border-right: 0px solid transparent;
+ padding: 0px;
+}
+
+.myGrid tr.z-row-over>td.z-row-inner>.z-row-cnt {
+ color: #00547A;
+}
+
+.ebz-radioDiv {
+ border: 1px solid #8FB9D0;
+ padding: 10px;
+ "
+}
+/**************************************************************************************/
+/**************************** following is for button**********************************/
+/**************************************************************************************/
+.fn-ebz-btn,.fn-ebz-btn.std {
+ -webkit-border-radius: 6px;
+ -moz-border-radius: 6px;
+ border-radius: 6px;
+ height: 40px;
+ padding-left: 30px;
+ padding-right: 30px;
+ font-size: 18px;
+ text-align: center;
+ border: 0px;
+ cursor: pointer;
+ color: rgba(255, 255, 255, 1);
+ margin-top: 5px;
+ margin-bottom: 5px;
+}
+
+.fn-ebz-btn.sm {
+ -webkit-border-radius: 6px;
+ -moz-border-radius: 6px;
+ border-radius: 6px;
+ height: 30px;
+ padding-left: 20px;
+ padding-right: 20px;
+ font-size: 12px;
+ text-align: center;
+ border: 0px;
+ cursor: pointer;
+ color: rgba(255, 255, 255, 1);
+}
+
+.fn-ebz-btn.primary {
+ background-color: #067AB4;
+}
+
+.fn-ebz-btn.footer {
+ color: #067AB4;
+}
+
+.fn-ebz-btn:hover {
+ background-color: rgba(0, 145, 217, 1) !important;
+}
+
+.fn-ebz-btn:active {
+ background-color: rgba(57, 176, 236, 1) !important;
+}
+
+.fn-ebz-btn:disabled {
+ background-color: rgba(211, 211, 211, 1) !important;
+ color: rgba(170, 170, 170, 1);
+ cursor: initial;
+}
+
+.fn-ebz-btn:focus {
+ outline-offset: 2px; /* not supported in IE */
+ outline: rgba(57, 176, 236, 1) solid 1px;
+}
+
+.fn-ebz-btn.loading {
+ color: transparent !important;
+ background: url("../images/fn-ebz-css/processing.gif") no-repeat;
+ background-position: center;
+ background-color: rgba(211, 211, 211, 1) !important;
+}
+
+.fn-ebz-btn.directional::after {
+ content: " \2192";
+ vertical-align: middle;
+}
+
+/*************************************************************************************/
+/**************************** following is for label**********************************/
+/*************************************************************************************/
+/*-----------------------------------------------------------------------------------*/
+/*---- font-size rules for label, specify top attr when change font size of label ---*/
+/*------------------------------ top: -(font-size)px --------------------------------*/
+/*-----------------------------------------------------------------------------------*/
+label.fn-ebz-text-label,label.fn-ebz-select-label {
+ position: absolute;
+ color: #444444;
+ left: 0px;
+ top: -5px;
+ white-space: nowrap;
+ font-family: Arial;
+ /*font-size: 12px;*/
+ font-size: .75rem;
+}
+
+label.fn-ebz-radiobtn-label {
+ background-image: url(../images/fn-ebz-css/radio_btn.png);
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+/*************************************************************************************/
+/**************************** following is for text field ****************************/
+/*************************************************************************************/
+input[type="password"].fn-ebz-text {
+ -webkit-border-radius: 6px;
+ -moz-border-radius: 6px;
+ border-radius: 6px;
+ margin-top: 8px;
+ height: 30px;
+ width: 250px;
+ border: 1px solid gray;
+ font-size: .875rem;
+ /*font-size: 11px;*/
+ /*font-weight: bold;*/
+ padding-left: 10px;
+}
+
+input[type="text"].fn-ebz-text {
+ width: 210px;
+ margin-right: 20px;
+}
+
+input[type="text"].fn-ebz-text:hover {
+ border: 1px solid black;
+}
+
+input[type="text"].fn-ebz-text:hover+label.fn-ebz-text-label {
+ color: black;
+}
+
+input[type="text"].fn-ebz-text:focus {
+ outline: 0;
+ border: 1px solid rgba(57, 176, 236, 1);
+}
+
+input[type="text"].fn-ebz-text:focus+label.fn-ebz-text-label {
+ color: rgba(57, 176, 236, 1);
+}
+
+input[type="text"].fn-ebz-text:disabled {
+ background-color: LightGray;
+}
+
+input[type="text"].fn-ebz-text:disabled+label.fn-ebz-text-label {
+ color: LightGray;
+}
+
+input[type="text"].fn-ebz-text:hover:disabled {
+ border: 1px solid gray;
+}
+
+input[type="text"].fn-ebz-text:hover:disabled+label.fn-ebz-text-label {
+ color: LightGray;
+}
+
+input[type="text"].fn-ebz-text.small {
+ width: 30px;
+ height: 20px;
+}
+
+input[type="text"].fn-ebz-text.medium-width {
+ width: 60px;
+}
+
+input[type="text"].fn-ebz-text.large {
+ width: 350px;
+}
+
+input[type="text"].fn-ebz-text.extra-large {
+ width: 520px;
+}
+
+input[type="text"].fn-ebz-text.medium {
+ width: 200px;
+ height: 29px;
+ margin-top: 0;
+ padding-top: 10px;
+ padding-right: 10px;
+ padding-bottom: 10px;
+ padding-left: 10px;
+}
+
+input[type="text"].fn-ebz-text.search {
+ width: 200px;
+ height: 30px;
+ padding-top: 10px;
+ padding-right: 10px;
+ padding-bottom: 10px;
+ padding-left: 10px;
+}
+
+input[type="text"].fn-ebz-text.normal {
+ width: 250px;
+ height: 30px;
+ padding-top: 10px;
+ padding-right: 10px;
+ padding-bottom: 10px;
+ padding-left: 10px;
+}
+/********************************************************************************/
+/************************ following is for errors and valid *********************/
+/********************************************************************************/
+.fn-ebz-error {
+ border: 1px solid red !important;
+}
+
+.fn-ebz-errorGeneric {
+ border: 1px solid red !important;
+}
+
+.fn-ebz-errorGeneric+label.fn-ebz-text-label::after,.fn-ebz-errorGeneric+label.fn-ebz-select-label::after
+ {
+ content: url("../images/fn-ebz-css/error_sign_generic.png");
+ baseline-shift: -2px;
+ margin-left: 10px;
+}
+
+.fn-ebz-validInput {
+ border: 1px solid green !important;
+}
+
+.fn-ebz-validInput+label.fn-ebz-text-label::after {
+ content: url("../images/fn-ebz-css/warning_sign.png")
+ url("../images/fn-ebz-css/10px_space.png")
+ url("../images/fn-ebz-css/valid_check.png");
+ baseline-shift: -2px;
+ margin-left: 5px;
+ margin-right: 5px;
+}
+
+.fn-ebz-validInput+label.fn-ebz-select-label {
+ color: green;
+}
+
+.fn-ebz-validInput+label.fn-ebz-select-label::after {
+ content: url("../images/fn-ebz-css/valid_check.png");
+ baseline-shift: -2px;
+ margin-left: 10px;
+}
+
+/*************************************************************************************************/
+/************************************* Following is for tooltips *********************************/
+/*************************************************************************************************/
+span.fn-ebz-tooltip,span.fn-ebz-tooltip.south {
+ position: absolute;
+ height: 30px;
+ top: 90%;
+ left: 0%;
+ line-height: 30px;
+ text-align: center;
+ visibility: hidden;
+ border-radius: 6px;
+ padding-left: 10px;
+ padding-right: 10px;
+ opacity: 0.7;
+ z-index: 999;
+ font-weight: bold;
+ font-size: 14px;
+ color: #000000;
+ background: #FFFFFF;
+ box-shadow: 0px 6px 6px gray;
+ border: 2px solid #EEEEEE;
+ text-align: center;
+ white-space: nowrap;
+}
+
+span.fn-ebz-tooltip::before,span.fn-ebz-tooltip.south::before {
+ content: '';
+ position: absolute;
+ bottom: 100%;
+ left: 14px;
+ margin-left: -12px;
+ width: 0;
+ height: 0;
+ border-bottom: 12px solid #EEEEEE;
+ border-right: 12px solid transparent;
+ border-left: 12px solid transparent;
+}
+
+span.fn-ebz-tooltip::after,span.fn-ebz-tooltip.south::after {
+ content: '';
+ position: absolute;
+ bottom: 99%;
+ left: 14px;
+ margin-left: -8px;
+ width: 0;
+ height: 0;
+ border-bottom: 8px solid #FFFFFF;
+ border-right: 8px solid transparent;
+ border-left: 8px solid transparent;
+}
+
+span.fn-ebz-tooltip:hover {
+ border: 2px solid Darkgray;
+}
+
+span.fn-ebz-tooltip:hover.south::before {
+ border-bottom: 12px solid Darkgray;
+}
+
+span.fn-ebz-tooltip:hover.south::after {
+ border-bottom: 8px solid white;
+}
+
+span.fn-ebz-tooltip:hover.north::before {
+ border-top: 12px solid Darkgray;
+}
+
+span.fn-ebz-tooltip:hover.north::after {
+ border-top: 8px solid white;
+}
+
+span.fn-ebz-tooltip.north {
+ top: -70%;
+}
+
+span.fn-ebz-tooltip.north::before {
+ top: 100%;
+ border-top: 12px solid #EEEEEE;
+ border-bottom: 0;
+}
+
+span.fn-ebz-tooltip.north::after {
+ top: 100%;
+ border-top: 8px solid #FFFFFF;
+ border-bottom: 0;
+}
+
+span.fn-ebz-tooltip.error {
+ color: #FFFFFF;
+ padding-left: 30px;
+ background: url("../images/fn-ebz-css/error_sign_spec.png") no-repeat;
+ background-position: 10px 7px;
+ background-color: #FF0000;
+ border: 0;
+}
+
+span.fn-ebz-tooltip.error::before,span.fn-ebz-tooltip.warning:before {
+ border: 0;
+}
+
+span.fn-ebz-tooltip.error.south::after {
+ border-bottom: 8px solid #FF0000 !important;
+}
+
+span.fn-ebz-tooltip.error.north::after {
+ border-top: 8px solid #FF0000 !important;
+}
+
+span.fn-ebz-tooltip.warning {
+ color: black;
+ padding-left: 30px;
+ background: url("../images/fn-ebz-css/warning_sign.png") no-repeat;
+ background-position: 10px 7px;
+ background-color: orange;
+ border: 0;
+}
+
+span.fn-ebz-tooltip.warning.south::after {
+ border-bottom: 8px solid orange !important;
+}
+
+span.fn-ebz-tooltip.warning.north::after {
+ border-bottom: 8px solid orange !important;
+}
+
+/*************************************************************************************************/
+/************************************* Following is for Dropdown *********************************/
+/*************************************************************************************************/
+select.fn-ebz-dropdown::-ms-expand {
+ display: none;
+}
+
+select.fn-ebz-dropdown {
+ -webkit-border-radius: 6px;
+ -moz-border-radius: 6px;
+ border-radius: 6px;
+ -webkit-appearance: none; /* not supported in IE */
+ -moz-appearance: none; /* not supported in IE */
+ appearance: none; /* not supported in IE */
+ height: 30px;
+ width: 200px;
+ padding-left: 10px;
+ padding-right: 30px;
+ background: url(../images/fn-ebz-css/down_arrow.png) no-repeat right;
+ background-color: white;
+ color: gray;
+ margin-top: 8px;
+ font-size: 12px;
+}
+
+select.fn-ebz-dropdown:hover {
+ border: 1px solid black;
+ color: black;
+}
+
+select.fn-ebz-dropdown:hover+label.fn-ebz-select-label {
+ color: black;
+}
+
+select.fn-ebz-dropdown:focus {
+ outline: 0;
+ color: black;
+ border: 1px solid rgba(0, 145, 217, 1);
+ background: url(../images/fn-ebz-css/up_arrow.png) no-repeat right;
+}
+
+select.fn-ebz-dropdown:focus+label.fn-ebz-select-label {
+ color: rgba(0, 145, 217, 1);
+}
+
+select.fn-ebz-dropdown.medium {
+ width: 150px;
+ height: 29px;
+ margin: auto;
+ padding-right: 10px;
+ padding-left: 10px;
+}
+
+select.fn-ebz-dropdown.large {
+ height: 36px;
+ font-size: 14px;
+}
+
+.mydropdown {
+ color: gray;
+ /*font-size:11px;*/
+ font-size: .875rem;
+}
+
+select.fn-ebz-dropdown.search {
+ width: 200px;
+ height: 30px;
+ margin: auto;
+ padding: 0px;
+}
+/*************************************************************************************************/
+/********************************* following is for radio button *********************************/
+/*************************************************************************************************/
+div.fn-ebz-container>input[type=radio],input[type=radio].fn-ebz-radiobtn
+ {
+ display: none;
+}
+
+div.fn-ebz-container>input[type=radio]+label.fn-ebz-radiobtn-label,input[type=radio].fn-ebz-radiobtn+label.fn-ebz-radiobtn-label
+ {
+ background-image: url(../images/fn-ebz-css/radio_btn.png);
+ padding-left: 32px;
+ height: 30px;
+ display: block;
+ line-height: 30px;
+ background-repeat: no-repeat;
+ background-position: 0 0px;
+ font-size: 16px;
+ vertical-align: middle;
+ cursor: pointer;
+ opacity: 0.8;
+}
+
+div.fn-ebz-container>input[type=radio]+label.fn-ebz-radiobtn-label:hover,input[type=radio].fn-ebz-radiobtn+label.fn-ebz-radiobtn-label:hover
+ {
+ opacity: 1;
+}
+
+div.fn-ebz-container>input[type=radio]:checked+label.fn-ebz-radiobtn-label,input[type=radio].fn-ebz-radiobtn:checked+label.fn-ebz-radiobtn-label
+ {
+ background-image: url(../images/fn-ebz-css/radio_btn.png);
+ background-position: 0 -30px;
+}
+
+div.fn-ebz-container>input[type=radio]:disabled+label.fn-ebz-radiobtn-label,input[type=radio].fn-ebz-radiobtn:disabled+label.fn-ebz-radiobtn-label
+ {
+ -webkit-filter: grayscale(100%);
+ opacity: 0.5;
+ cursor: default;
+}
+
+label.fn-ebz-radiobtn-label:active {
+ background-position: 0 -60px !important;
+ color: rgba(0, 145, 217, 1);
+}
+
+div.fn-ebz-container>input[type=radio].fn-ebz-error+label.fn-ebz-radiobtn-label,input[type=radio].fn-ebz-radiobtn.fn-ebz-error+label.fn-ebz-radiobtn-label
+ {
+ background-position: 0 -90px;
+}
+
+div.fn-ebz-container>input[type=radio].fn-ebz-errorGeneric+label.fn-ebz-radiobtn-label,input[type=radio].fn-ebz-radiobtn.fn-ebz-errorGeneric+label.fn-ebz-radiobtn-label
+ {
+ background-position: 0 -90px;
+}
+
+/*************************************************************************************************/
+/********************************* following is header and footer *********************************/
+/*************************************************************************************************/
+.ebz_footer {
+ /*clear: both;*/
+ border-width: 0px 1px 0px 1px;
+ border-style: solid;
+ border-color: #959595;
+ font-family: inherit;
+ font-size: 12px;
+ padding: 10px 10px 30px 10px;
+ /* background: rgba(6, 124, 180, 0.82) !important; */
+ background: #067AB4;
+ color: white;
+}
+
+.ebz_header {
+ border-width: 0px 1px 0px 1px;
+ border-style: solid;
+ border-color: #959595;
+ font-size: 12px;
+ font-family: inherit;
+}
+
+.ebz_header.level1 {
+ background: #226485;
+ color: white;
+}
+
+.ebz_header.level2 {
+ background: #067AB4;
+ padding: 10px 10px 15px 10px;
+ color: white;
+ font-size: 20px;
+}
+
+.ebz_header.level3 {
+ background: white;
+ padding: 10px 10px 10px 10px;
+ color: black;
+}
+
+/*************************************************************************************************/
+/********************************* following is for grid in user page ****************************/
+/*************************************************************************************************/
+.heading1 {
+ font-family: omnes_att_light;
+ font-size: 36px;
+ color: #444444;
+ margin: 0;
+ padding: 0;
+ font-weight: normal;
+}
+
+.heading2 {
+ font-family: omnes_att_light;
+ font-size: 24px;
+ color: #444444;
+ margin: 0;
+ padding: 0;
+ font-weight: normal;
+}
+
+.heading3 {
+ font-family: omnes_att_light;
+ font-size: 16px;
+ color: #444444;
+ margin: 0;
+ padding: 0;
+ font-weight: bold;
+}
+
+.fn-ebz-grid.limited-size {
+ padding: 0;
+ margin: 0;
+ min-height: 40px;
+ max-width: 940px;
+ max-height: 900px;
+}
+
+.fn-ebz-grid tr.z-row td.z-row-inner,tr.z-row .z-cell {
+ border: 0 white;
+ background: rgb(242, 242, 242);
+}
+
+.fn-ebz-grid tr.z-grid-odd td.z-row-inner,tr.z-grid-odd .z-cell,tr.z-grid-odd
+ {
+ background: rgb(255, 255, 255);
+}
+
+.fn-ebz-grid .z-grid-header-bg {
+ background-image: none;
+}
+
+/* .fn-ebz-grid tr.z-grid-odd .z-row-over{
+ background: rgb(107,166,191);
+ } */
+.fn-ebz-grid .z-column-cnt,.z-row-cnt {
+ font-size: 13px;
+ font-weight: normal;
+ color: black;
+}
+
+.fn-ebz-grid .z-column-cnt {
+ text-align: left;
+}
+
+.fn-ebz-grid .z-label {
+ font-size: 12px;
+ font-weight: normal;
+ word-wrap: break-word;
+ white-space: pre-wrap;
+}
+
+.fn-ebz-grid .z-grid-header th.z-column div.z-column-cnt {
+ white-space: pre-wrap;
+ color: white;
+ backgroud: grey;
+}
+
+.fn-ebz-grid div.z-grid-header th.z-column,div.z-grid-header th.z-auxheader
+ {
+ background: rgb(102, 102, 102) repeat-x 0 0 !important;
+ background-image: none !important;
+ background-color: grey;
+ border-color: grey;
+ height: 40px;
+}
+
+.fn-ebz-grid tr.z-row-over>td.z-row-inner {
+ border-color: lightgrey;
+}
+
+.fn-ebz-grid tr.z-row-over>td.z-row-inner,tr.z-row-over>.z-cell {
+ background-color: lightgrey;
+}
+
+.fn-ebz-grid .z-row-cnt {
+ color: black;
+}
+
+.fn-ebz-grid tr.z-row-over>td.z-row-inner>.z-row-cnt {
+ color: black;
+}
+
+.fn-ebz-btn.grid-btn {
+ margin: auto;
+}
+
+.fn-ebz-grid .z-toolbarbutton-cnt {
+ padding: 8px 2px;
+ margin: auto;
+}
+
+.z-button-os,.z-label,.z-button,.z-radio-cnt,.z-checkbox-cnt,.z-loading,.z-toolbarbutton-cnt,.z-button tr td
+ {
+ font-family: Arial;
+}
+
+.fn-ebz-btn.z-button tr td {
+ color: rgba(255, 255, 255, 1);
+}
+
+.fn-ebz-btn.grid-btn.z-toolbarbutton-over .z-toolbarbutton-cnt,.fn-ebz-btn.z-button .z-button-tm,.z-button .z-button-bm,.fn-ebz-btn.z-button .z-button-cm,.z-button .z-button-tl,.fn-ebz-btn.z-button .z-button-tr,.fn-ebz-btn.z-button .z-button-bl,.z-button .z-button-br,.fn-ebz-btn.z-button .z-button-cl,.fn-ebz-btn.z-button .z-button-cr
+ {
+ background-image: none;
+}
+
+.fn-ebz-btn.z-button .z-button-cm {
+ padding: 0;
+}
+
+.fn-ebz-btn.grid-btn.z-toolbarbutton-over .z-toolbarbutton-body {
+ border: 0px;
+}
+
+.fn-ebz-pop-up {
+ -webkit-border-radius: 6px;
+ -moz-border-radius: 6px;
+ border-radius: 6px;
+ border-style: solid;
+ border-width: 1px;
+ max-width: 360px;
+}
+
+.fn-ebz-pop-up .z-label {
+ margin: 0;
+ padding: 0;
+ white-space: pre-wrap;
+}
+
+.fn-ebz-pop-up.success {
+ border-color: #4CA90C;
+}
+
+.fn-ebz-pop-up.warning-unsuccess {
+ border-color: #FF9900;
+}
+
+.fn-ebz-pop-up .heading,.fn-ebz-pop-up .heading .z-label {
+ font-family: Calibri;
+ font-size: 16px;
+ font-weight: bold;
+ white-space: pre-wrap;
+}
+
+.fn-ebz-pop-up.success .heading,.fn-ebz-pop-up.success .heading .z-label
+ {
+ color: #4CA90C
+}
+
+.fn-ebz-pop-up.warning-unsuccess .heading,.fn-ebz-pop-up.warning-unsuccess .heading .z-label
+ {
+ color: #FF9900;
+}
+
+.fn-ebz-pop-up.success .text-content {
+ background-image: url('../images/vsp_check_sign.jpg');
+}
+
+.fn-ebz-pop-up.warning-unsuccess .text-content {
+ background-image: url('../images/vsp_warning_sign.jpg');
+}
+
+.fn-ebz-pop-up .text-content {
+ background-repeat: no-repeat;
+ background-position: 15px center;
+ background-size: 30px 30px;
+ margin: 0;
+ padding: 10px 20px 16px 60px;
+}
+
+.fn-ebz-pop-up {
+ background-color: #FFF;
+ opacity: 0.95;
+}
+
+a.fn-ebz-link {
+ font-family: Calibri;
+ text-decoration: none;
+ color: grey;
+ font-size: 18px;
+}
+
+a.fn-ebz-link:hover {
+ color: rgb(6, 122, 180);
+ cursor: pointer;
+}
+
+.hide,.show {
+ width: 100%;
+ height: 100%;
+}
+
+a.collapsibleArrow {
+ width: 30px;
+ height: 30px;
+ margin-left: 10px;
+}
+
+.fn-ebz-grid .z-column-unassigned-Image {
+ width: 7px;
+ height: 7px;
+}
+
+/*************************************************************************************************/
+/********************************* following is for info label ***********************************/
+/*************************************************************************************************/
+.fn-ebz-info-label {
+ display: inline-block;
+ width: 300px;
+ color: black;
+ padding-left: 30px;
+ background: url("../images/info_blue.jpg") no-repeat;
+ background-position: top left;
+}
+
+/*************************************************************************************************/
+/********************************* following is for ListBox ****************************/
+/*************************************************************************************************/
+
+/*To change the header color to gray*/
+.mylistbox .z-listbox-header tr.z-listhead,.mylistheader .z-listbox-header tr.z-auxhead
+ {
+ background: rgb(102, 102, 102) repeat-x 0 0 !important;
+ background-image: none !important;
+}
+
+.mylistbox .z-listheader-sort-asc .z-listheader-sort-img,.z-listheader-sort-dsc .z-listheader-sort-img
+ {
+ background-position: 0 0;
+ background-repeat: no-repeat;
+ background-image: none;
+}
+
+.mylistbox tr.z-listbox-odd {
+ background: rgb(255, 255, 255);
+}
+
+.mylistbox .z-listitem {
+ background: rgb(242, 242, 242);
+}
+
+.mylistbox .z-listitem-over {
+ background-color: rgb(107, 166, 191) !important;
+ border: none;
+ cursor: pointer;
+ text-shadow: 1px 1px 1px #59ACC1;
+}
+
+.mylistbox .z-listbox-header-bg {
+ background-image: none;
+}
+
+.mylistbox div.z-listheader-cnt {
+ color: white;
+}
+
+div.z-listbox {
+ overflow: hidden;
+ zoom: 1;
+ background: #FFF;
+ border: none;
+ background-image: none;
+}
+
+.mylistbox .z-listcell-cnt {
+ font-size: 13px;
+ font-family: Arial;
+}
+
+div.ebz-listbox {
+ height: 350px;
+ border: 1px solid black;
+ overflow: auto;
+ border-radius: 6px;
+ border-color: rgb(105, 138, 154);
+ background-color: rgb(255, 255, 255);
+ padding: 10px;
+ -webkit-border-radius: 10px;
+ -moz-border-radius: 10px;
+}
+
+/*************************************************************************************************/
+/********************************* following is for butto on LocationPhoneNosList ****************************/
+/*************************************************************************************************/
+.myComboboxTextbox .z-combobox .z-combobox-inp {
+ border: 1px solid #E6E6E6;
+ border-top-color: #B2B2B2;
+ border-right: 0;
+ padding: 2px;
+ border-radius: 6px 0 0 2px;
+ -moz-border-radius: 2px 0 0 2px;
+ -webkit-border-radius: 6px 0 0 2px;
+ height: 25px;
+}
+
+.myzkBtn {
+ color: gray;
+ -webkit-border-radius: 6px;
+ -moz-border-radius: 6px;
+ border-radius: 6px;
+ height: 32px;
+ width: 32px;
+ background: white;
+ margin-top: 8px;
+}
+
+.myTextbox {
+ padding-left: 8px;
+ border-radius: 6px;
+ height: 30px;
+ width: 150px;
+}
+/*************************************************************************************************/
+/********************************* following is for Dashboard ****************************/
+/*************************************************************************************************/
+.ebz_dashboard .z-panel-br,.ebz_dashboard .z-panel-cr,.ebz_dashboard .z-panel-cl,.ebz_dashboard .z-panel-hr,.ebz_dashboard .z-panel-tr,.ebz_dashboard .z-panel-hl
+ {
+ background-image: none;
+ background-color: white;
+ color: white;
+}
+
+.ebz_dashboard .z-panel-hm .z-panel-header,.ebz_dashboard .z-panel-header
+ {
+ background-image: none;
+ background-color: white;
+ font-size: 15px;
+ font-weight: bold;
+ color: grey;
+ font-family: Arial;
+}
+
+.ebz_dashboard .z-panel-hl {
+ border-bottom: 0px;
+}
+
+.ebz_dashboard .z-panelchildren {
+ border: 0px;
+}
+
+.ebz_dashboard .z-panel-shadow {
+ box-shadow: 0 2px 5px 0 #bebebe;
+ border: 3px solid rgb(242, 242, 242);
+}
+
+.ebz_dashboard .search_panel_span {
+ font-size: 12px;
+}
+
+.mypanel .z-panel-br,.mypanel .z-panel-cr,.mypanel .z-panel-cl,.mypanel .z-panel-hr,.mypanel .z-panel-tr,.mypanel .z-panel-hl
+ {
+ background-image: none;
+ background-color: grey;
+ color: white;
+}
+
+.mypanel .z-panel-hm .z-panel-header,.mypanel .z-panel-header {
+ background-image: none;
+ background-color: grey;
+ font-size: 15px;
+ font-weight: bold;
+ color: white;
+}
+
+.adashboard {
+ color: grey;
+ text-decoration: none;
+ font-size: 14px;
+ font-family: Arial;
+}
+
+.adashboard:hover {
+ color: rgb(6, 122, 180);
+}
+
+.horizontal-label {
+ font-size: 12px;
+}
+
+.myDashboard iframe {
+ position: relative;
+ height: 100%;
+ width: 100%;
+ background: rgb(242, 242, 242);
+ border: none;
+}
+
+.myDashboard .a {
+ color: grey !important;
+ font-family: Calibri;
+ text-decoration: none;
+ font-size: 18px;
+}
+
+.myDashboard .a:hover {
+ color: rgb(6, 122, 180);
+}
+
+.fn-ebz-info {
+ width: 500px
+}
+
+.myDashboard .z-panel-hm .z-panel-header,.myDashboard .z-panel-header {
+ background-image: none;
+ background-color: grey;
+ font-size: 15px;
+ font-weight: bold;
+}
+
+.myDashboard .z-window-overlapped-cnt-noborder {
+ padding: 0px;
+}
+
+.fn_ebz_dashboard_search_dd .select2-container .select2-choice {
+ height: 30px;
+ border-top-right-radius: 0px;
+ border-bottom-right-radius: 0px;
+ border: 1px solid #D3D3D3;
+ z-index: 0;
+}
+
+.fn_ebz_dashboard_search_dd .select2-container .select2-chosen {
+ line-height: 30px;
+}
+
+.fn_ebz_dashboard_search_dd .select2-container .select2-choice .select2-arrow b:after,.select2-container.select2-container-disabled .select2-choice .select2-arrow b:after
+ {
+ height: 30px;
+ line-height: 30px;
+}
+
+.fn_ebz_dashboard_search_dd .select2-results {
+ margin: -4px 0 0;
+}
+
+.fn_ebz_dashboard_search_dd .select2-dropdown-open .select2-choice {
+ border-top-right-radius: 0 !important;
+}
+
+.fn_ebz_dashboard_search_dd .select2-container .select2-choice .select2-arrow
+ {
+ border-top-right-radius: 0 !important;
+}
+
+.fn_ebz_dashboard_search_button .button {
+ padding: 6px;
+ border-bottom-left-radius: 0px;
+ border-top-left-radius: 0px;
+}
+
+.fn_ebz_dashboard_input {
+ background: white !important;
+ border-radius: 0 0 0 0 !important;
+ font-family: Arial !important;
+ height: 30px !important;
+ border-left-width: 0px !important;
+ padding-bottom: 9px !important;
+}
+/*************************************************************************************************/
+/********************************* following is for location Manage ****************************/
+/*************************************************************************************************/
+.ebz_location_manage tr.z-listitem-seld .z-listcell-cnt,.ebz_location_manage tr.z-listitem-over-seld .z-listcell-cnt,.ebz_location_manage tr.z-listitem-over .z-listcell-cnt
+ {
+ color: black;
+}
+
+.ebz_location_manage div.z-listbox-header th.z-auxheader {
+ border: none;
+}
+
+.ebz_location_manage div.z-listbox-header div.z-auxheader-cnt {
+ padding-bottom: 0;
+}
+
+.ebz_location_manage div.z-listbox-footer .z-listfooter,.ebz_location_manage div.z-listbox-footer
+ {
+ background: none;
+ border: none;
+}
+
+.ebz_location_manage div.z-listbox-footer table {
+ margin: 0;
+}
+
+/*************************************************************************************************/
+/********************************* following is for CallFowardAdd ****************************/
+/*************************************************************************************************/
+.myhlayout .z-hlayout-inner {
+ vertical-align: middle;
+}
+
+.myhlayout {
+ position: relative;
+ left: 55px;
+}
+
+/* div.tile{
+ display: table-cell;
+ position: relative;
+ height:50%;
+ border: 1px solid grey;
+ border-radius: 15px;
+}
+div.tile-content{
+ margin: 0;
+ padding: 20px 20px 100px 20px;
+ height:100%;
+}
+div.tile.without_save_btn .tile-content{
+ padding-bottom: 20px;
+}
+div.detail{
+ padding-left:5%;
+ width: 100%;
+ height:100%;
+ display: table;
+ table-layout: fixed;
+ border-spacing: 5px;
+}
+div.detail-row{
+ display:table-row;
+ width:100%;
+ height:100%;
+} */
+.right-bottom {
+ position: absolute;
+ right: 20px;
+ top: 40px;
+}
+
+.lred .tags__item--color.tags__item .tags__item--color-icon {
+ background: red;
+ border-color: red;
+ z-index: 0;
+}
+
+.lred .tags__item.tags__item--color {
+ border: none;
+}
+
+.lred .tags__item.tags__item--color:active {
+ background: none;
+}
+
+.lgreen .tags__item--color.tags__item .tags__item--color-icon {
+ background: #118817;
+ border-color: #118817;
+ z-index: 0;
+}
+
+.lgreen .tags__item.tags__item--color {
+ border: none;
+}
+
+.lgreen .tags__item.tags__item--color:active {
+ background: none;
+}
+
+ul.tab {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+}
+
+ul.tab li {
+ float: left;
+ border: 1px solid #000;
+ border-bottom-width: 0;
+ margin: 3px 3px 0px 3px;
+ padding: 5px 5px 0px 5px;
+ background-color: #CCC;
+ color: #696969;
+ cursor: pointer;
+}
+
+ul.tab li.active {
+ background-color: #FFF;
+ color: #000;
+}
+
+a.info-link:before {
+ content: url(../images/info_blue.jpg);
+ margin: 0;
+}
+
+table.tableSection {
+ display: table;
+ width: 100%;
+}
+
+table.tableSection thead,table.tableSection tbody {
+ float: left;
+ width: 100%;
+}
+
+table.tableSection tbody {
+ overflow: auto;
+ overflow-x: hidden;
+}
+
+table.tableSection tr {
+ width: 100%;
+ display: table;
+ text-align: left;
+}
+
+.custom-file-input::-webkit-file-upload-button {
+ visibility: hidden;
+}
+
+.custom-file-input::before {
+ content: 'Browse';
+ background-color: #067AB4;
+ -webkit-border-radius: 6px;
+ -moz-border-radius: 6px;
+ border-radius: 6px;
+ display: inline-block;
+ height: 30px;
+ padding-left: 10px;
+ padding-right: 10px;
+ padding-top: 5px;
+ font-size: 14px;
+ text-align: center;
+ border: 0px;
+ cursor: pointer;
+ color: rgba(255, 255, 255, 1);
+ margin-top: 5px;
+ margin-bottom: 5px;
+ margin_right: 5px
+}
+
+.custom-file-input:hover::before {
+ border-color: black;
+}
+
+.custom-file-input:active::before {
+ background: -webkit-linear-gradient(top, #e3e3e3, #f9f9f9);
+}
+
+.ebz_menu_anchorMenuDiv {
+ position: absolute;
+ display: none;
+ margin-top: 0px;
+ background-color: white;
+ width: 955px;
+ border: 1px solid;
+ border-right: 0px;
+ color: rgb(211, 211, 211);
+}
+
+.ebz_menu_anchorMenuDiv2 {
+ background-color: white;
+ width: 130px;
+ display: true;
+ border: 1px solid;
+ color: rgb(211, 211, 211);
+ float: right;
+ margin-top: -29px;
+ box-shadow: 10px 10px 5px #888888;
+ height: 94vh;
+ position: relative;
+ z-index: 1;
+ border-radius: 8px;
+}
+
+.ebz_menu_anchorHead2 {
+ font-size: 18px;
+}
+
+.ebz_menu_meunIcon_div {
+ width: 1029px;
+ position: relative;
+ z-index: 2;
+}
+
+.ebz_menu_anchorMenu_div {
+ width: 1230px;
+}
+
+.ebz_menu_anchorIcon {
+ margin-top: 10px;
+ font-size: 35px;
+}
+
+.ebz_menu_anchorIcon2 {
+ font-size: 35px;
+}
+
+.ebz_menu_anchorIconAndHead {
+ float: left;
+ margin-left: 40px;
+ width: 125px;
+ height: 95px;
+}
+
+.ebz_menu_anchorIconAndHead2 {
+ margin-top: 20px;
+ margin-bottom: 20px;
+}
+
+.ebz_menu_userItems {
+ text-transform: none;
+ line-height: 10px;
+ font-weight: 100;
+ color: black;
+}
+
+.ebz_menu_userItemsValue {
+ color: #666666;
+}
+
+.ebz_menu_secondLevelOption {
+ font-size: 18px;
+ color: #666666;
+ margin-left: auto;
+ margin-right: auto;
+ float: left;
+}
+
+.ebz_menu_thirdLevelOptionHeader a {
+ color: black;
+ font-weight: bold;
+ font-size: 12px;
+}
+
+.ebz_menu_thirdLevelOptionHeader {
+ margin-top: 25px;
+ float: left;
+ width: 180px;
+}
+
+.ebz_menu_userMenuInfoDiv {
+ margin-top: -252px;
+ background-color: white;
+ margin-left: auto;
+ height: 252px;
+ width: 207px;
+ display: block;
+ border: 1px solid;
+ color: rgb(211, 211, 211);
+}
+
+.ebz_menu_userMenuLogoutDiv {
+ margin-top: 0px;
+ margin-left: 441px;
+ background-color: rgb(250, 250, 250);
+ height: 252px;
+ width: 125px;
+ display: true;
+ border: 1px solid;
+ border-right: 0px;
+ color: rgb(211, 211, 211);
+}
+
+.ebz_menu_navBtn a {
+ position: relative;
+ font-size: 18px;
+ color: white;
+ font-size: 18px;
+ -webkit-transition-property: position, color; /* Safari */
+ -webkit-transition-duration: 5s; /* Safari */
+ transition-property: position, color;
+ transition-duration: 5s;
+}
+
+.ebz_menu_navBtn a:hover {
+ position: relative;
+ bottom: 2px;
+ color: rgb(191, 213, 224);
+}
+
+.ebz_search_directory_phone_detail .phoneDetail {
+ display: inline-block;
+ margin-left: 20px;
+ margin-bottom: 20px;
+}
+
+.ebz_search_directory_phone_detail .phoneDetailInside .colsize {
+ width: 180px;
+ height: 45px;
+ padding: 0px;
+}
+
+.ebz_search_directory_phone_detail .phoneDetailInside {
+ border: 1px solid;
+ width: 400px;
+ height: 250px;
+ background: white;
+}
+
+.ebz_search_button {
+ color: gray;
+ -webkit-border-radius: 6px;
+ -moz-border-radius: 6px;
+ border-radius: 6px;
+ height: 32px;
+ width: 32px;
+ background: white;
+ background-repeat: no-repeat;
+ background-position: center;
+ margin-top: 0px;
+}
+
+.ebz_helpfulInfo {
+ border-style: solid;
+ border-width: 1px;
+ margin-bottom: 50px;
+}
+
+.ebz_helpfulInfo .helpfulInfoContent {
+ margin-left: 10px;
+ margin-top: 10px;
+}
+
+.ebz_helpfulInfo .helpfulInfoTable {
+ width: 340px;
+ margin-left: 10px;
+ display: inline-flex;
+}
+
+.ebz_helpfulInfo .helpfulInfoTableHeight {
+ height: 250px;;
+}
+
+.ebz_bulk_edit {
+ margin-top: 20px;
+}
+
+.ebz_bulk_edit .content {
+ margin-top: 20px;
+}
+
+.form-field,.form-field-input-container {
+ width: 210px !important;
+ margin-right: 20px;
+}
+
+.form-field__square .select2-container .select2-choice,.form-field__square select,.form-field__square
+ {
+ -webkit-border-radius: 0;
+ -moz-border-radius: 0;
+ border-radius: 0;
+}
+
+.form-field__square.left_round_border .select2-container .select2-choice,.form-field__square.left_round_border select,.form-field__square.left_round_border div,.form-field__glued.form-field__square.left_round_border input[type="text"]
+ {
+ -webkit-border-radius: 5px 0px 0px 5px;
+ -moz-border-radius: 5px 0px 0px 5px;
+ border-radius: 5px 0px 0px 5px;
+}
+
+.form-field__square.right_round_border .select2-container .select2-choice,.form-field__square.right_round_border select,.form-field__square.right_round_border div,.form-field__glued.form-field__square.right_round_border input[type="text"]
+ {
+ -webkit-border-radius: 0px 5px 5px 0px;
+ -moz-border-radius: 0px 5px 5px 0px;
+ border-radius: 0px 5px 5px 0px;
+}
+
+.form-field__glued.form-field__square {
+ margin-right: -5px;
+}
+
+.form-field__glued.form-field__square {
+ vertical-align: top;
+}
+
+.form-field__glued.form-field__square input[type=text],.form-field__glued.form-field__square select
+ {
+ margin-top: 0;
+}
+
+div.hide-password-placeholder>div.form-field>label.form-field__label.form-field__label--show,div.hide-password-placeholder>div.form-field>label.form-field__label.form-field__label--hide
+ {
+ visibility: hidden;
+}
+
+.col-md-18.content div.fn-ebz-container {
+ margin-top: 14px;
+}
+
+.col-md-18.content div.fixed-in-row {
+ position: fixed;
+ top: 115px;
+ z-index: 95;
+ width: 725px;
+}
+
+.col-md-18.content div.fixed-in-row {
+ text-align: right;
+}
+
+.col-md-18.content .size-onefourth,.form-field__glued.size-onefourth {
+ width: 25%;
+}
+
+.voiceAndCalllog {
+ display: none;
+ position: relative;
+ margin-left: 5px;
+}
+
+.loadingId {
+ position: fixed;
+ top: 50%;
+ right: 50%;
+ z-index: 101;
+}
+
+#messagingDashboard .widgetBody {
+ border: 1px solid #d3d3d3;
+ overflow: hidden
+}
+
+#messagingDashboard .widgetHeader {
+ height: 50px !important;
+ border: 1px solid #d3d3d3;
+ border-bottom: 0;
+ background-color: #e5e5e5;
+ padding-right: 20px;
+ width: 100%;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ z-index: 1;
+ -webkit-border-radius: 2px 2px 0 0;
+ -moz-border-radius: 2px 2px 0 0;
+ -ms-border-radius: 2px 2px 0 0;
+ -o-border-radius: 2px 2px 0 0;
+ border-radius: 2px 2px 0 0;
+ behavior: url(/ebiz/dashboard/web/common/css/pie/PIE.htc );
+ position: relative
+}
+
+#messagingDashboard .widgetHeader .widgetHeaderContent {
+ line-height: 44px;
+ font-family: clearviewatt;
+ font-size: 18px;
+ color: #444
+}
+
+#messagingDashboard .widgetHeader .widgetSubHeaderContent {
+ position: absolute;
+ top: 29.5px;
+ left: 18px;
+ font-family: clearviewatt;
+ font-size: 12px;
+ color: #444
+}
+
+#messagingDashboard input[type="text"].fn-ebz-text {
+ width: 150px;
+ margin-top: 0;
+}
+
+#messagingDashboard div.without_save_btn {
+ display: table-cell;
+}
+
+#messagingDashboard .content-summary {
+ margin-top: 20px;
+ margin-right: 50px;
+}
+
+.appBody {
+ background-color: rgb(242, 242, 242)
+}
+
+.att-drawer {
+ z-index: 997 !important;
+}
+
+.secondaryMenuContainer {
+ z-index: 1000;
+}
+
+.appContent {
+ margin-left: 50px;
+
+ display: inline-block;
+ float: left;
+}
+
+.appLeftMenu{
+ display: inline-block;
+ float: left;
+ width:200px;
+ height:1px;
+
+}
+
+.appLeftMenu .appLeftMenuDiv{
+ position: relative;
+ color: black;
+ top: 70px;
+}
+
+.appLeftMenu .appLeftMenuAccordDiv{
+ margin-left:10px;
+ margin-right:10px;
+
+ }
+.appFooter{
+ display: inline-block;
+ width:100%
+}
+.drawer-backdrop{
+ position:relative !important;
+}
+
+.license-notification{
+ position:fixed;
+ top:60px;
+ right:20px;
+ z-index: 999;
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/images/no_favorites_star.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/images/no_favorites_star.png
new file mode 100644
index 00000000..4db05403
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/images/no_favorites_star.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/js/attHeaderSnippet.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/js/attHeaderSnippet.js
new file mode 100644
index 00000000..2c0dfc37
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/js/attHeaderSnippet.js
@@ -0,0 +1,210 @@
+/* Popup Box function */
+(function(){
+
+ $.fn.popbox = function(options){
+ settings = $.extend({
+ selector : this.selector,
+ open : '.openpopbox',
+ box : '.box1',
+ arrow : '.arrow',
+ arrow_border : '.arrow-border',
+ close : '.close'
+ }, options);
+
+ var methods = {
+ open: function(event){
+ event.preventDefault();
+ var pop = $(this);
+ var box = $(this).parent().find(settings['box']);
+ box.find(settings['arrow']).css({'left': box.width()/2 - 10 + 46});
+ box.find(settings['arrow_border']).css({'left': box.width()/2 - 10 - 63});
+ if(box.css('display') == 'block'){
+ /* methods.close();
+ setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
+ // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
+ if($(window).scrollTop() > 20){
+ setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
+ // $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
+ };*/
+ $('.box1').fadeIn('slow');
+ } else {
+ $('.chatBox').fadeOut('fast');
+ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
+ if(box.attr('target') == 'auth'){
+ box.find(settings['arrow']).css({'left': box.width()/2 + 36});
+ box.css({'display': 'block', 'top': 0, 'left': ((pop.parent().parent().width()/2) -box.width()/2 ) - 90});
+ }
+ else{
+ box.find(settings['arrow']).css({'left': box.width()/2 - 42});
+ box.css({'display': 'block', 'top': 0, 'left': ((pop.parent().parent().width()/2) -box.width()/2-15 )});
+ box.find("#header_login_id").focus();
+ box.find('#header_password').val('');
+ }
+ }
+ },
+
+ close: function(){
+ $(settings['box']).fadeOut("fast");
+ }
+ };
+
+ $(document).bind('keyup', function(event){
+ if(event.keyCode == 27){
+ setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
+ // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
+ if($(window).scrollTop() > 20){
+ // setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
+ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
+ };
+ methods.close();
+ }
+ });
+ // Close chat-box and popup on clicking out of chat-box
+ $(document).bind('click', function(event){
+ if(!($(event.target).closest('.chatBox').length || $(event.target).hasClass('chatIcon') || $(event.target).closest(settings['selector']).length)){
+ methods.close();
+ if ($("#actionsDropDown").css('z-index')=='-999'){
+ setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
+ }
+ if($(window).scrollTop() > 20){
+ setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
+ // $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
+ };
+
+ $('.chatBox').fadeOut('fast');
+
+ }
+ });
+
+ return this.each(function(){
+
+ $(this).css({'width': $(settings['box']).width()}); // Width needs to be set otherwise popbox will not move when window resized.
+ $(settings['open'], this).bind('click', methods.open);
+ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
+ $(settings['open'], this).parent().find(settings['close']).bind('click', function(event){
+ // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
+ setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
+ methods.close();
+ });
+ });
+ }
+
+}).call(this);
+
+
+$('.popbox').popbox();
+
+$(function(){
+ var displayName = "";
+ if($("#reg-fn-ln-id").length > 0){
+ var fnln = $("#reg-fn-ln-id").val().length;
+ if(fnln > 0){
+ var fnVar = $("#reg-fname-id").val();
+ var lnVar = $("#reg-lname-id").val();
+ var numChars = 13;
+ var nameLen = fnVar.length + lnVar.length + 1; // 1 for space between the first name and the last name
+ if(fnVar != " " && lnVar != " "){
+ if(nameLen <= numChars){
+ displayName = fnVar+" "+lnVar;
+ }else if(nameLen <= (numChars * 2)){
+ displayName = fnVar+"<br/>"+lnVar;
+ }else
+ {
+ if(fnVar.length < numChars && lnVar.length > numChars){ //Smaller first name and longer last name
+ displayName = fnVar+"<br/>"+lnVar.substring(0,numChars-1)+"...";
+ }
+
+ if(fnVar.length >= numChars ){ //Longer first name
+ // 2 = 1 for elipses, 1 for space between the first name and last name
+ longLName = numChars - ((fnVar.substring(numChars,fnVar.length)).length + 2);
+ displayName = fnVar.substring(0,numChars)+"<br/>"+fnVar.substring(numChars,fnVar.length)+" "+lnVar.substring(0,longLName)+"...";
+ }
+ }
+ }
+ else{
+ displayName = fnVar+" "+lnVar;
+ }
+ }
+
+ $("#reg-userName").html(displayName);
+ }
+});
+
+/* ClickToChat ANONYMOUS FUNCTION DEFINITION *
+ * =============================================== *
+ * On clicking the chat icon displays the chat box */
+(function(){
+
+ var chatbox = $('.chatBox');
+
+ // var actionsDropDown = $('#actionsDropDown');
+ var methods = {
+ open: function(){chatbox.css('display','block');},
+ close: function(){chatbox.fadeOut('fast');}
+ };
+ $('.chatIcon').click(function(){
+ if (chatbox.css('display') == 'block'){
+ methods.close();
+ setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
+ // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
+ if($(window).scrollTop() > 20){
+ setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
+ // $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
+ };
+ } else {
+ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
+ methods.open();
+ $(settings['box']).fadeOut("fast");
+ }
+ });
+
+ // Close chat-box on clicking cross icon
+ $('.circle_close_chat').click(function(){
+ // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
+ setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
+ methods.close();
+ if($(window).scrollTop() > 20){
+ setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
+ // $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
+ };
+ });
+
+ // Close chat-box on Escape key press
+ $(document).bind('keyup', function(event){
+ if(event.keyCode == 27){
+ setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
+ methods.close();
+ if($(window).scrollTop() > 20){
+ setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
+ //$(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
+ };
+ }
+ });
+
+ // Close chat-box on clicking out of chat-box
+ // $(document).bind('click', function(event){
+
+ // console.log(event.target,"2");
+ // if(!($(event.target).closest('.chatBox').length || $(event.target).hasClass('chatIcon'))) {
+ // event.preventDefault();
+ // // console.log($(event.target).closest(settings['selector']).length);
+ // console.log($(event.target).closest('. ').length);
+ // console.log($(event.target).hasClass('chatIcon'));
+
+
+ // // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
+ // methods.close();
+ // if ($("#actionsDropDown").css('z-index')=='-999') {
+ // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
+ // };
+ // // if (flag!="clicked") {
+ // // if ($('.box').css('display') == 'block' || $('.chatBox').css('display') == 'block' ){
+ // // $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
+ // // } else {
+ // // $(".btn-panel-vertical,#actionsDropDown").css('z-index','999');
+ // // }
+ // // }
+ // }
+ // });
+
+})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/js/footer.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/js/footer.js
new file mode 100644
index 00000000..4cc2d2a4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/js/footer.js
@@ -0,0 +1,110 @@
+var feedbackText, pageAddress;
+(function ( $ ) {
+ $(document).on('click', '.feedbackButtonDiv', function (e) {
+ $(".feedbackSection").slideToggle(600, function(){
+ if($(".feedbackButton").hasClass("closeFeedbackButton")) {
+ $(".footerContainer .feedbackButton").html("Feedback<span class='icon-chevron-down'></span>");
+ $(".footerContainer .feedbackButton").removeClass("closeFeedbackButton");
+ } else {
+ $(".footerContainer .feedbackButton").html("Close<span class='icon-chevron-up'></span>");
+ $(".footerContainer .feedbackButton").addClass("closeFeedbackButton");
+ $(".footerContainer .feedbackText").focus();
+ }
+
+ });
+ });
+
+ $(document).on('click', '.closeFeedback', function (e) {
+ $(".feedbackSection").slideUp(600, function(){
+
+ });
+ });
+
+ $(document).on('click keypress keyup blur paste','textarea[maxlength]', function(e) {
+ var maxlength = $(this).attr('maxlength');
+ var val = $(this).val();
+
+ if (val.length > maxlength) {
+ $(this).val(val.slice(0, maxlength));
+ }
+ });
+
+ $(document).on('click', '.feedbackSubmitButton', function (e) {
+ var feedbackTextTemp = $(".feedbackText").val();
+ feedbackText = $.trim(feedbackTextTemp);
+ var feedbackData = feedbackText;
+ if (feedbackText != null && feedbackText != '') {
+ $.ajax({
+ type: "post",
+ contentType :'application/json',
+ dataType: 'json',
+ data: feedbackData,
+ url: "/ebiz/dashboard/feedback/createfeedback",
+ success: function (data) {
+ if (data.success) {
+ $(".feedbackSection").slideUp(600, function() {
+ $(".feedbackText").val("");
+ $(".footerContainer .feedbackButton").html("Feedback<span class='icon-chevron-down'></span>");
+ $(".footerContainer .feedbackButton").removeClass("closeFeedbackButton");
+ $(".feedbackButtonDiv").slideUp(600);
+ $(".readFeedBackMessage").text(data.feedBackMessage);
+ $(".feedbackResultMsg, #feedbackResultDivider").slideDown(600);
+ $(".readFeedBackMessage").focus();
+ });
+ } else if (typeof console == "object") {
+
+ }
+ },
+ error: function () {
+
+ }
+ });
+ } else {
+ e.preventDefault();
+ if (typeof console == 'object') {
+ console.log("Invalid Input String");
+ }
+ }
+
+ });
+
+ // Click function definition for OK button in feedback success message
+ $(document).on('click', '.feedbackMsgOKButton', function(e) {
+ $(".feedbackResultMsg, #feedbackResultDivider").slideUp(600, function(){
+ $(".readFeedBackMessage").text("");
+ });
+ $(".feedbackButtonDiv").slideDown(600, function() {
+ $('.feedbackButton').focus();
+ });
+ });
+
+}( jQuery ));
+
+$(function() {
+ var footerHeight = 0,
+ footerTop = 0,
+ $footer = $("#footer");
+
+ positionFooter();
+
+
+ function positionFooter() {
+
+ footerHeight = $footer.height();
+ footerTop = ($(window).scrollTop() + $(window).height() - footerHeight) + "px";
+
+ if (($(document.body).height() + footerHeight) < $(window).height()) {
+ $footer.addClass('stickyFooter')
+ .animate({
+ top: footerTop
+ }, -1)
+ } else {
+ $footer.removeClass('stickyFooter');
+ }
+
+ }
+
+ $(window)
+ .scroll(positionFooter)
+ .resize(positionFooter)
+}); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/att-abs-tpls.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/att-abs-tpls.js
new file mode 100644
index 00000000..95964973
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/att-abs-tpls.js
@@ -0,0 +1,20451 @@
+/**
+* FileName att-style-guide
+* Version 2.17.0
+* Build number 5c64ecd381d5984c483cdfaa078a1890
+* Date 11/23/2015
+*/
+
+(function(angular, window){
+angular.module("att.abs", ["att.abs.tpls", "att.abs.utilities","att.abs.position","att.abs.transition","att.abs.accordion","att.abs.alert","att.abs.boardStrip","att.abs.breadCrumbs","att.abs.buttons","att.abs.checkbox","att.abs.colorselector","att.abs.datepicker","att.abs.devNotes","att.abs.dividerLines","att.abs.dragdrop","att.abs.drawer","att.abs.message","att.abs.formField","att.abs.hourpicker","att.abs.iconButtons","att.abs.links","att.abs.loading","att.abs.modal","att.abs.pagination","att.abs.paneSelector","att.abs.tooltip","att.abs.popOvers","att.abs.profileCard","att.abs.progressBars","att.abs.radio","att.abs.scrollbar","att.abs.search","att.abs.select","att.abs.slider","att.abs.splitButtonDropdown","att.abs.splitIconButton","att.abs.stepSlider","att.abs.steptracker","att.abs.table","att.abs.tableMessages","att.abs.tabs","att.abs.tagBadges","att.abs.textOverflow","att.abs.toggle","att.abs.treeview","att.abs.typeAhead","att.abs.verticalSteptracker","att.abs.videoControls"]);
+angular.module("att.abs.tpls", ["app/scripts/ng_js_att_tpls/accordion/accordion.html","app/scripts/ng_js_att_tpls/accordion/accordion_alt.html","app/scripts/ng_js_att_tpls/accordion/attAccord.html","app/scripts/ng_js_att_tpls/accordion/attAccordBody.html","app/scripts/ng_js_att_tpls/accordion/attAccordHeader.html","app/scripts/ng_js_att_tpls/alert/alert.html","app/scripts/ng_js_att_tpls/boardStrip/attAddBoard.html","app/scripts/ng_js_att_tpls/boardStrip/attBoard.html","app/scripts/ng_js_att_tpls/boardStrip/attBoardStrip.html","app/scripts/ng_js_att_tpls/buttons/buttonDropdown.html","app/scripts/ng_js_att_tpls/colorselector/colorselector.html","app/scripts/ng_js_att_tpls/datepicker/dateFilter.html","app/scripts/ng_js_att_tpls/datepicker/dateFilterList.html","app/scripts/ng_js_att_tpls/datepicker/datepicker.html","app/scripts/ng_js_att_tpls/datepicker/datepickerPopup.html","app/scripts/ng_js_att_tpls/dividerLines/dividerLines.html","app/scripts/ng_js_att_tpls/dragdrop/fileUpload.html","app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlert.html","app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlertPrv.html","app/scripts/ng_js_att_tpls/formField/creditCardImage.html","app/scripts/ng_js_att_tpls/formField/cvcSecurityImg.html","app/scripts/ng_js_att_tpls/hourpicker/hourpicker.html","app/scripts/ng_js_att_tpls/links/readMore.html","app/scripts/ng_js_att_tpls/loading/loading.html","app/scripts/ng_js_att_tpls/modal/backdrop.html","app/scripts/ng_js_att_tpls/modal/tabbedItem.html","app/scripts/ng_js_att_tpls/modal/tabbedOverlayItem.html","app/scripts/ng_js_att_tpls/modal/window.html","app/scripts/ng_js_att_tpls/pagination/pagination.html","app/scripts/ng_js_att_tpls/paneSelector/innerPane.html","app/scripts/ng_js_att_tpls/paneSelector/paneGroup.html","app/scripts/ng_js_att_tpls/paneSelector/sidePane.html","app/scripts/ng_js_att_tpls/tooltip/tooltip-popup.html","app/scripts/ng_js_att_tpls/popOvers/popOvers.html","app/scripts/ng_js_att_tpls/profileCard/addUser.html","app/scripts/ng_js_att_tpls/profileCard/profileCard.html","app/scripts/ng_js_att_tpls/progressBars/progressBars.html","app/scripts/ng_js_att_tpls/scrollbar/scrollbar.html","app/scripts/ng_js_att_tpls/search/search.html","app/scripts/ng_js_att_tpls/select/select.html","app/scripts/ng_js_att_tpls/select/textDropdown.html","app/scripts/ng_js_att_tpls/slider/maxContent.html","app/scripts/ng_js_att_tpls/slider/minContent.html","app/scripts/ng_js_att_tpls/slider/slider.html","app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdown.html","app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdownItem.html","app/scripts/ng_js_att_tpls/splitIconButton/splitIcon.html","app/scripts/ng_js_att_tpls/splitIconButton/splitIconButton.html","app/scripts/ng_js_att_tpls/splitIconButton/splitIconButtonGroup.html","app/scripts/ng_js_att_tpls/stepSlider/attStepSlider.html","app/scripts/ng_js_att_tpls/steptracker/step-tracker.html","app/scripts/ng_js_att_tpls/steptracker/step.html","app/scripts/ng_js_att_tpls/steptracker/timeline.html","app/scripts/ng_js_att_tpls/steptracker/timelineBar.html","app/scripts/ng_js_att_tpls/steptracker/timelineDot.html","app/scripts/ng_js_att_tpls/table/attTable.html","app/scripts/ng_js_att_tpls/table/attTableBody.html","app/scripts/ng_js_att_tpls/table/attTableHeader.html","app/scripts/ng_js_att_tpls/tableMessages/attTableMessage.html","app/scripts/ng_js_att_tpls/tableMessages/attUserMessage.html","app/scripts/ng_js_att_tpls/tabs/floatingTabs.html","app/scripts/ng_js_att_tpls/tabs/genericTabs.html","app/scripts/ng_js_att_tpls/tabs/menuTab.html","app/scripts/ng_js_att_tpls/tabs/parentmenuTab.html","app/scripts/ng_js_att_tpls/tabs/simplifiedTabs.html","app/scripts/ng_js_att_tpls/tabs/submenuTab.html","app/scripts/ng_js_att_tpls/tagBadges/tagBadges.html","app/scripts/ng_js_att_tpls/toggle/demoToggle.html","app/scripts/ng_js_att_tpls/typeAhead/typeAhead.html","app/scripts/ng_js_att_tpls/verticalSteptracker/vertical-step-tracker.html","app/scripts/ng_js_att_tpls/videoControls/photoControls.html","app/scripts/ng_js_att_tpls/videoControls/videoControls.html"]);
+angular.module('att.abs.utilities', [])
+
+.filter('unsafe',[ '$sce', function ($sce) {
+ return function(val){
+ return $sce.trustAsHtml(val);
+ };
+}])
+
+.filter('highlight', function () {
+ function escapeRegexp(queryToEscape) {
+ return queryToEscape.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
+ }
+ return function (matchItem, query, className) {
+ return query && matchItem ? matchItem.replace(new RegExp(escapeRegexp(query), 'gi'), '<span class=\"' + className + '\">$&</span>') : matchItem;
+ };
+})
+
+.filter('attLimitTo', function() {
+ return function(actualArray, _limit, _begin) {
+ var finalArray = [];
+ var limit = _limit;
+ var begin = _begin;
+ if(isNaN(begin)) {
+ begin = 0;
+ }
+ if(actualArray && !isNaN(limit)) {
+ finalArray = actualArray.slice(begin, begin+limit);
+ } else {
+ finalArray = actualArray;
+ }
+ return finalArray;
+ };
+})
+
+.filter('startsWith', function() {
+ if (typeof String.prototype.startsWith !== 'function') {
+ // see below for better implementation!
+ String.prototype.startsWith = function (str){
+ return this.indexOf(str) === 0;
+ };
+ }
+
+ return function(items, searchString) {
+ if (searchString === undefined || searchString === "") {
+ return items;
+ }
+
+ var filtered = [];
+ angular.forEach(items, function(item) {
+ if (item.title.toLowerCase().startsWith(searchString.toLowerCase())) {
+ filtered.push(item);
+ }
+ });
+ return filtered;
+ };
+})
+
+.directive('attInputDeny', [function() {
+ return {
+ restrict: 'A',
+ require: 'ngModel',
+ link: function (scope, elem, attr, ctrl) {
+ var regexExpression = null;
+ attr.$observe('attInputDeny', function (value) {
+ if (value) {
+ regexExpression = new RegExp(value, 'g');
+ }
+ });
+ elem.bind('input', function () {
+ var inputString = ctrl.$viewValue && ctrl.$viewValue.replace(regexExpression, '');
+ if (inputString !== ctrl.$viewValue) {
+ ctrl.$setViewValue(inputString);
+ ctrl.$render();
+ scope.$apply();
+ }
+ });
+ }
+ };
+}])
+
+.directive('attAccessibilityClick', [function() {
+ return {
+ restrict: 'A',
+ link: function (scope, elem, attr) {
+ var keyCode = [];
+ attr.$observe('attAccessibilityClick', function (value) {
+ if (value) {
+ keyCode = value.split(',');
+ }
+ });
+ elem.bind('keydown', function (ev) {
+ var keyCodeCondition = function(){
+ var flag = false;
+ if(!(ev.keyCode)){
+ if(ev.which){
+ ev.keyCode = ev.which;
+ }
+ else if(ev.charCode){
+ ev.keyCode = ev.charCode;
+ }
+ }
+ if((ev.keyCode && keyCode.indexOf(ev.keyCode.toString()) > -1)){
+ flag = true;
+ }
+ return flag;
+ };
+ if(keyCode.length > 0 && keyCodeCondition()) {
+ elem[0].click();
+ ev.preventDefault();
+ }
+ });
+ }
+ };
+}])
+
+.directive('attElementFocus', [function() {
+ return {
+ restrict: 'A',
+ link: function(scope, elem, attr) {
+ scope.$watch(attr.attElementFocus, function (value) {
+ if (value) {
+ elem[0].focus();
+ }
+ });
+ }
+ };
+}])
+
+.directive('focusOn', ['$timeout',
+ function ($timeout) {
+ var checkDirectivePrerequisites = function (attrs) {
+ if (!attrs.focusOn && attrs.focusOn !== '') {
+ throw 'FocusOnCondition missing attribute to evaluate';
+ }
+ };
+ return {
+ restrict: 'A',
+ link: function (scope, element, attrs) {
+ checkDirectivePrerequisites(attrs);
+
+ scope.$watch(attrs.focusOn, function (currentValue) {
+ if(currentValue) {
+ $timeout(function () {
+ element[0].focus();
+ });
+ }
+ });
+ }
+ };
+ }
+])
+.constant('whenScrollEndsConstants', {
+ 'threshold': 100,
+ 'width': 0,
+ 'height': 0
+})
+.directive('whenScrollEnds', function(whenScrollEndsConstants, $log) {
+ return {
+ restrict: 'A',
+ link: function (scope, element, attrs) {
+ /**
+ * Exposed Attributes:
+ * threshold - integer - number of pixels before scrollbar hits end that callback is called
+ * width - integer - override for element's width (px)
+ * height - integer - override for element's height (px)
+ * axis - string - x/y for scroll bar axis
+ */
+ var threshold = parseInt(attrs.threshold, 10) || whenScrollEndsConstants.threshold;
+
+ if (!attrs.axis || attrs.axis === '') {
+ $log.warn('axis attribute must be defined for whenScrollEnds.');
+ return;
+ }
+
+ if (attrs.axis === 'x') {
+ visibleWidth = parseInt(attrs.width, 10) || whenScrollEndsConstants.width;
+ if (element.css('width')) {
+ visibleWidth = element.css('width').split('px')[0];
+ }
+
+ element[0].addEventListener('scroll', function() {
+ var scrollableWidth = element.prop('scrollWidth');
+ if (scrollableWidth === undefined) {
+ scrollableWidth = 1;
+ }
+ var hiddenContentWidth = scrollableWidth - visibleWidth;
+
+ if (hiddenContentWidth - element[0].scrollLeft <= threshold) {
+ /* Scroll almost at bottom, load more rows */
+ scope.$apply(attrs.whenScrollEnds);
+ }
+ });
+ } else if (attrs.axis === 'y') {
+ visibleHeight = parseInt(attrs.height, 10) || whenScrollEndsConstants.height;
+ if (element.css('width')) {
+ visibleHeight = element.css('height').split('px')[0];
+ }
+
+ element[0].addEventListener('scroll', function() {
+ var scrollableHeight = element.prop('scrollHeight');
+ if (scrollableHeight === undefined) {
+ scrollableHeight = 1;
+ }
+ var hiddenContentHeight = scrollableHeight - visibleHeight;
+
+ if (hiddenContentHeight - element[0].scrollTop <= threshold) {
+ /* Scroll almost at bottom, load more rows */
+ scope.$apply(attrs.whenScrollEnds);
+ }
+ });
+ }
+ }
+ };
+})
+
+.directive("validImei", function(){
+ return {
+ restrict: 'A',
+ require: 'ngModel',
+ link: function(scope, ele, attrs, ctrl)
+ {
+ ctrl.$parsers.unshift(function(value)
+ {
+ if(value){
+ scope.valid = false;
+ if (!isNaN(value) && value.length === 15)
+ {
+ var sumImeiVal = 0;
+ var posIMEI = [];
+ for (var imeiIndex=0; imeiIndex<15; imeiIndex++)
+ {
+ posIMEI[imeiIndex] = parseInt(value.substring(imeiIndex,imeiIndex + 1),10);
+ if (imeiIndex % 2 !== 0)
+ {
+ posIMEI[imeiIndex] = parseInt((posIMEI[imeiIndex] * 2),10);
+ }
+ if (posIMEI[imeiIndex] > 9)
+ {
+ posIMEI[imeiIndex] = parseInt((posIMEI[imeiIndex] % 10),10) + parseInt((posIMEI[imeiIndex] / 10),10);
+ }
+ sumImeiVal=sumImeiVal+parseInt((posIMEI[imeiIndex]),10);
+ }
+
+ if((sumImeiVal % 10) === 0)
+ {
+ scope.valid = true;
+ }
+ else
+ {
+ scope.valid = false;
+ }
+ }
+ else
+ {
+ scope.valid = false;
+ }
+ ctrl.$setValidity('invalidImei', scope.valid);
+ }
+ return scope.valid ? value : undefined;
+ });
+ }
+ };
+})
+
+.directive("togglePassword", function(){
+ return{
+ restrict:'A',
+ transclude:false,
+ link: function(scope, element, attr, ctrl)
+ {
+ element.bind("click", function()
+ {
+ var ipwd = attr.togglePassword;
+ element[0].innerHTML = element[0].innerHTML === "Show" ? "Hide" : "Show";
+ var e = angular.element(document.querySelector('#' + ipwd))[0].type;
+ angular.element(document.querySelector('#' + ipwd))[0].type = e === "password"? "text" : "password";
+
+ });
+
+ }
+ };
+})
+
+.factory('events', function(){
+ var _stopPropagation = function(evt){
+ if(evt.stopPropagation) {
+ evt.stopPropagation();
+ } else {
+ evt.returnValue = false;
+ }
+ };
+ var _preventDefault = function(evt) {
+ if (evt.preventDefault) {
+ evt.preventDefault();
+ } else {
+ evt.returnValue = false;
+ }
+ }
+ return {
+ stopPropagation: _stopPropagation,
+ preventDefault: _preventDefault
+ };
+})
+
+.factory('$documentBind', ['$document', '$timeout', function ($document, $timeout) {
+ var _click = function (flag, callbackFunc, scope) {
+ scope.$watch(flag, function (val) {
+ $timeout(function () {
+ if (val) {
+ $document.bind('click', callbackFunc);
+ } else {
+ $document.unbind('click', callbackFunc);
+ }
+ });
+ });
+ };
+
+ var _event = function (event, flag, callbackFunc, scope, timeoutFlag, timeoutValue) {
+ if (timeoutFlag) {
+ if (!(timeoutValue)) {
+ timeoutValue = 0;
+ }
+ scope.$watch(flag, function (newVal, oldVal) {
+ if (newVal !== oldVal) {
+ $timeout(function () {
+ if (newVal) {
+ $document.bind(event, callbackFunc);
+ } else {
+ $document.unbind(event, callbackFunc);
+ }
+ }, timeoutValue);
+ }
+ });
+ } else {
+ scope.$watch(flag, function (newVal, oldVal) {
+ if (newVal !== oldVal) {
+ if (newVal) {
+ $document.bind(event, callbackFunc);
+ } else {
+ $document.unbind(event, callbackFunc);
+ }
+ }
+ });
+ }
+ };
+
+ return {
+ click: _click,
+ event: _event
+ };
+}])
+
+.factory('DOMHelper', function() {
+
+ function isTabable(node) {
+ var element = angular.element(node);
+ var hasTabindex = (parseInt(element.attr('tabindex'), 10) >= 0) ? true : false;
+ var tagName = element[0].tagName.toUpperCase();
+
+ if (hasTabindex || tagName === 'A' || tagName === 'INPUT' || tagName === 'TEXTAREA') {
+ return !(element[0].disabled || element[0].readOnly);
+ }
+ return false;
+ }
+
+ function isValidChild(child) {
+ return child.nodeType == 1 && child.nodeName != 'SCRIPT' && child.nodeName != 'STYLE';
+ }
+
+ function traverse(obj) {
+ var obj = obj || document.getElementsByTagName('body')[0];
+ if (isValidChild(obj) && isTabable(obj)) {
+ return obj;
+ }
+ if (obj.hasChildNodes()) {
+ var child = obj.firstChild;
+ while(child) {
+ var res = traverse(child);
+ if(res){
+ return res;
+ }
+ else{
+ child = child.nextSibling;
+ }
+ }
+ }
+ else{
+ return undefined;
+ }
+ }
+
+ var _firstTabableElement = function(el) {
+ /* This will return the first tabable element from the parent el */
+ var elem = el;
+ if (el.hasOwnProperty('length')) {
+ elem = el[0];
+ }
+
+ return traverse(elem);
+ };
+
+ return {
+ firstTabableElement: _firstTabableElement
+ };
+})
+
+.factory('keymap', function(){
+ return {
+ KEY:{
+ TAB: 9,
+ ENTER: 13,
+ ESC: 27,
+ SPACE: 32,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40,
+ SHIFT: 16,
+ CTRL: 17,
+ ALT: 18,
+ PAGE_UP: 33,
+ PAGE_DOWN: 34,
+ HOME: 36,
+ END: 35,
+ BACKSPACE: 8,
+ DELETE: 46,
+ COMMAND: 91
+ },
+ MAP: { 91 : "COMMAND", 8 : "BACKSPACE" , 9 : "TAB" , 13 : "ENTER" , 16 : "SHIFT" , 17 : "CTRL" , 18 : "ALT" , 19 : "PAUSEBREAK" , 20 : "CAPSLOCK" , 27 : "ESC" , 32 : "SPACE" , 33 : "PAGE_UP", 34 : "PAGE_DOWN" , 35 : "END" , 36 : "HOME" , 37 : "LEFT" , 38 : "UP" , 39 : "RIGHT" , 40 : "DOWN" , 43 : "+" , 44 : "PRINTSCREEN" , 45 : "INSERT" , 46 : "DELETE", 48 : "0" , 49 : "1" , 50 : "2" , 51 : "3" , 52 : "4" , 53 : "5" , 54 : "6" , 55 : "7" , 56 : "8" , 57 : "9" , 59 : ";", 61 : "=" , 65 : "A" , 66 : "B" , 67 : "C" , 68 : "D" , 69 : "E" , 70 : "F" , 71 : "G" , 72 : "H" , 73 : "I" , 74 : "J" , 75 : "K" , 76 : "L", 77 : "M" , 78 : "N" , 79 : "O" , 80 : "P" , 81 : "Q" , 82 : "R" , 83 : "S" , 84 : "T" , 85 : "U" , 86 : "V" , 87 : "W" , 88 : "X" , 89 : "Y" , 90 : "Z", 96 : "0" , 97 : "1" , 98 : "2" , 99 : "3" , 100 : "4" , 101 : "5" , 102 : "6" , 103 : "7" , 104 : "8" , 105 : "9", 106 : "*" , 107 : "+" , 109 : "-" , 110 : "." , 111 : "/", 112 : "F1" , 113 : "F2" , 114 : "F3" , 115 : "F4" , 116 : "F5" , 117 : "F6" , 118 : "F7" , 119 : "F8" , 120 : "F9" , 121 : "F10" , 122 : "F11" , 123 : "F12", 144 : "NUMLOCK" , 145 : "SCROLLLOCK" , 186 : ";" , 187 : "=" , 188 : "," , 189 : "-" , 190 : "." , 191 : "/" , 192 : "`" , 219 : "[" , 220 : "\\" , 221 : "]" , 222 : "'"
+ },
+ isControl: function (e) {
+ var k = e.keyCode;
+ switch (k) {
+ case this.KEY.COMMAND:
+ case this.KEY.SHIFT:
+ case this.KEY.CTRL:
+ case this.KEY.ALT:
+ return true;
+ default:;
+ }
+
+ if (e.metaKey) {
+ return true;
+ }
+
+ return false;
+ },
+ isFunctionKey: function (k) {
+ k = k.keyCode ? k.keyCode : k;
+ return k >= 112 && k <= 123;
+ },
+ isVerticalMovement: function (k){
+ return ~[this.KEY.UP, this.KEY.DOWN].indexOf(k);
+ },
+ isHorizontalMovement: function (k){
+ return ~[this.KEY.LEFT, this.KEY.RIGHT, this.KEY.BACKSPACE, this.KEY.DELETE].indexOf(k);
+ },
+ isAllowedKey: function (k){
+ return (~[this.KEY.SPACE, this.KEY.ESC, this.KEY.ENTER].indexOf(k)) || this.isHorizontalMovement(k) || this.isVerticalMovement(k);
+ }
+ };
+})
+
+.factory('keyMapAc', function(){
+ return {
+ keys:{ "32":" ", "33":"!", "34":"\"", "35":"#", "36":"$", "37":"%", "38":"&", "39":"'"
+ , "40":"(", "41":")", "42":"*", "43":"+", "44":",", "45":"-", "46":".", "47":"\/", "58":":"
+ , "59":";", "60":"<", "61":"=", "62":">", "63":"?", "64":"@", "91":"[", "92":"\\", "93":"]"
+ , "94":"^", "95":"_", "96":"`", "123":"{", "124":"|", "125":"}", "126":"~"
+ },
+ keyRange:{"startNum":"48","endNum":"57","startSmallLetters":"97","endSmallLetters":"122"
+ ,"startCapitalLetters":"65","endCapitalLetters":"90"},
+ allowedKeys:{TAB:8, BACKSPACE:9, DELETE:16}
+ };
+})
+
+.factory('$attElementDetach', function () {
+ var _detach = function (element) {
+ if (element && element.parentNode) {
+ element.parentNode.removeChild(element);
+ }
+ };
+ return _detach;
+})
+
+.factory('$ieVersion', function () {
+ var ie = null;
+
+ var loadIEVersion = function () {
+ var isIE10 = (eval("/*@cc_on!@*/false") && document.documentMode === 10);
+ if (isIE10) {
+ return 10;
+ }
+ var v = 3,
+ div = document.createElement('div'),
+ all = div.getElementsByTagName('i');
+ do {
+ div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->';
+ } while (all[0]);
+ return v > 4 ? v : undefined;
+ };
+
+ return function () {
+ if (ie===null) {
+ ie = loadIEVersion();
+ }
+ return ie;
+ };
+});
+(function () {
+ String.prototype.toSnakeCase = function () {
+ return this.replace(/([A-Z])/g, function ($1) {
+ return "-" + $1.toLowerCase();
+ });
+ };
+ var concat = function (character, times) {
+ character = character || '';
+ times = (!isNaN(times) && times) || 0;
+ var finalChar = '';
+ for (var i = 0; i < times; i++) {
+ finalChar += character;
+ }
+ return finalChar;
+ };
+
+ // direction: true for left and false for right
+ var pad = function (actualString, width, character, direction) {
+ actualString = actualString || '';
+ width = (!isNaN(width) && width) || 0;
+ character = character || '';
+ if (width > actualString.length) {
+ if (direction) {
+ return concat(character, (width - actualString.length)) + actualString;
+ } else {
+ return actualString + concat(character, (width - actualString.length));
+ }
+ }
+ return actualString;
+ };
+
+ String.prototype.lPad = function (width, character) {
+ return pad(this, width, character, true);
+ };
+
+ String.prototype.rPad = function (width, character) {
+ return pad(this, width, character, false);
+ };
+
+ if (!Array.prototype.indexOf) {
+ Array.prototype.indexOf = function (val) {
+ for (var index = 0; index < this.length; index++) {
+ if (this[index] === val) {
+ return index;
+ }
+ }
+ return -1;
+ };
+ }
+})();
+
+angular.module('att.abs.position', [])
+
+.factory('$position', ['$document', '$window', function ($document, $window) {
+ function getStyle(el, cssprop) {
+ if (el.currentStyle) { //IE
+ return el.currentStyle[cssprop];
+ } else if ($window.getComputedStyle) {
+ return $window.getComputedStyle(el)[cssprop];
+ }
+ // finally try and get inline style
+ return el.style[cssprop];
+ }
+
+ /**
+ * Checks if a given element is statically positioned
+ * @param element - raw DOM element
+ */
+ function isStaticPositioned(element) {
+ return (getStyle(element, "position") || 'static') === 'static';
+ }
+
+ /**
+ * returns the closest, non-statically positioned parentOffset of a given element
+ * @param element
+ */
+ var parentOffsetEl = function (element) {
+ var docDomEl = $document[0];
+ var offsetParent = element.offsetParent || docDomEl;
+ while (offsetParent && offsetParent !== docDomEl && isStaticPositioned(offsetParent)) {
+ offsetParent = offsetParent.offsetParent;
+ }
+ return offsetParent || docDomEl;
+ };
+
+ return {
+ /**
+ * Provides read-only equivalent of jQuery's position function:
+ * http://api.jquery.com/position/
+ */
+ position: function (element) {
+ var elBCR = this.offset(element);
+ var offsetParentBCR = {
+ top: 0,
+ left: 0
+ };
+ var offsetParentEl = parentOffsetEl(element[0]);
+ if (offsetParentEl !== $document[0]) {
+ offsetParentBCR = this.offset(angular.element(offsetParentEl));
+ offsetParentBCR.top += offsetParentEl.clientTop - offsetParentEl.scrollTop;
+ offsetParentBCR.left += offsetParentEl.clientLeft - offsetParentEl.scrollLeft;
+ }
+
+ return {
+ width: element.prop('offsetWidth'),
+ height: element.prop('offsetHeight'),
+ top: elBCR.top - offsetParentBCR.top,
+ left: elBCR.left - offsetParentBCR.left
+ };
+ },
+
+ /**
+ * Provides read-only equivalent of jQuery's offset function:
+ * http://api.jquery.com/offset/
+ */
+ offset: function (element) {
+ var boundingClientRect = element[0].getBoundingClientRect();
+ return {
+ width: element.prop('offsetWidth'),
+ height: element.prop('offsetHeight'),
+ top: boundingClientRect.top + ($window.pageYOffset || $document[0].body.scrollTop || $document[0].documentElement.scrollTop),
+ left: boundingClientRect.left + ($window.pageXOffset || $document[0].body.scrollLeft || $document[0].documentElement.scrollLeft)
+ };
+ }
+ };
+}])
+
+.factory('$isElement', [function () {
+ var isElement = function (currentElem, targetElem, alternateElem) {
+ if (currentElem[0] === targetElem[0]) {
+ return true;
+ } else if (currentElem[0] === alternateElem[0]) {
+ return false;
+ } else {
+ return isElement((currentElem.parent()[0] && currentElem.parent()) || targetElem, targetElem, alternateElem);
+ }
+ };
+
+ return isElement;
+}])
+
+.directive('attPosition', ['$position', function ($position) {
+ return {
+ restrict: 'A',
+ link: function (scope, elem, attr) {
+ scope.$watchCollection(function () {
+ return $position.position(elem);
+ }, function (value) {
+ scope[attr.attPosition] = value;
+ });
+ }
+ };
+}]);
+
+/*!
+ * VERSION: 1.7.3
+ * DATE: 2014-01-14
+ * UPDATES AND DOCS AT: http://www.greensock.com
+ *
+ * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
+ * This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for
+ * Club GreenSock members, the software agreement that was issued with your membership.
+ *
+ * @author: Jack Doyle, jack@greensock.com
+ **/
+(window._gsQueue || (window._gsQueue = [])).push( function() {
+
+ "use strict";
+
+ var _doc = document.documentElement,
+ _window = window,
+ _max = function(element, axis) {
+ var dim = (axis === "x") ? "Width" : "Height",
+ scroll = "scroll" + dim,
+ client = "client" + dim,
+ body = document.body;
+ return (element === _window || element === _doc || element === body) ? Math.max(_doc[scroll], body[scroll]) - (_window["inner" + dim] || Math.max(_doc[client], body[client])) : element[scroll] - element["offset" + dim];
+ },
+
+ ScrollToPlugin = window._gsDefine.plugin({
+ propName: "scrollTo",
+ API: 2,
+ version:"1.7.3",
+
+ //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
+ init: function(target, value, tween) {
+ this._wdw = (target === _window);
+ this._target = target;
+ this._tween = tween;
+ if (typeof(value) !== "object") {
+ value = {y:value}; //if we don't receive an object as the parameter, assume the user intends "y".
+ }
+ this._autoKill = (value.autoKill !== false);
+ this.x = this.xPrev = this.getX();
+ this.y = this.yPrev = this.getY();
+ if (value.x != null) {
+ this._addTween(this, "x", this.x, (value.x === "max") ? _max(target, "x") : value.x, "scrollTo_x", true);
+ this._overwriteProps.push("scrollTo_x");
+ } else {
+ this.skipX = true;
+ }
+ if (value.y != null) {
+ this._addTween(this, "y", this.y, (value.y === "max") ? _max(target, "y") : value.y, "scrollTo_y", true);
+ this._overwriteProps.push("scrollTo_y");
+ } else {
+ this.skipY = true;
+ }
+ return true;
+ },
+
+ //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.)
+ set: function(v) {
+ this._super.setRatio.call(this, v);
+
+ var x = (this._wdw || !this.skipX) ? this.getX() : this.xPrev,
+ y = (this._wdw || !this.skipY) ? this.getY() : this.yPrev,
+ yDif = y - this.yPrev,
+ xDif = x - this.xPrev;
+
+ if (this._autoKill) {
+ //note: iOS has a bug that throws off the scroll by several pixels, so we need to check if it's within 7 pixels of the previous one that we set instead of just looking for an exact match.
+ if (!this.skipX && (xDif > 7 || xDif < -7) && x < _max(this._target, "x")) {
+ this.skipX = true; //if the user scrolls separately, we should stop tweening!
+ }
+ if (!this.skipY && (yDif > 7 || yDif < -7) && y < _max(this._target, "y")) {
+ this.skipY = true; //if the user scrolls separately, we should stop tweening!
+ }
+ if (this.skipX && this.skipY) {
+ this._tween.kill();
+ }
+ }
+ if (this._wdw) {
+ _window.scrollTo((!this.skipX) ? this.x : x, (!this.skipY) ? this.y : y);
+ } else {
+ if (!this.skipY) {
+ this._target.scrollTop = this.y;
+ }
+ if (!this.skipX) {
+ this._target.scrollLeft = this.x;
+ }
+ }
+ this.xPrev = this.x;
+ this.yPrev = this.y;
+ }
+
+ }),
+ p = ScrollToPlugin.prototype;
+
+ ScrollToPlugin.max = _max;
+
+ p.getX = function() {
+ return (!this._wdw) ? this._target.scrollLeft : (_window.pageXOffset != null) ? _window.pageXOffset : (_doc.scrollLeft != null) ? _doc.scrollLeft : document.body.scrollLeft;
+ };
+
+ p.getY = function() {
+ return (!this._wdw) ? this._target.scrollTop : (_window.pageYOffset != null) ? _window.pageYOffset : (_doc.scrollTop != null) ? _doc.scrollTop : document.body.scrollTop;
+ };
+
+ p._kill = function(lookup) {
+ if (lookup.scrollTo_x) {
+ this.skipX = true;
+ }
+ if (lookup.scrollTo_y) {
+ this.skipY = true;
+ }
+ return this._super._kill.call(this, lookup);
+ };
+
+}); if (window._gsDefine) { window._gsQueue.pop()(); }
+/*!
+ * VERSION: 1.12.1
+ * DATE: 2014-06-26
+ * UPDATES AND DOCS AT: http://www.greensock.com
+ *
+ * Includes all of the following: TweenLite, TweenMax, TimelineLite, TimelineMax, EasePack, CSSPlugin, RoundPropsPlugin, BezierPlugin, AttrPlugin, DirectionalRotationPlugin
+ *
+ * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
+ * This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for
+ * Club GreenSock members, the software agreement that was issued with your membership.
+ *
+ * @author: Jack Doyle, jack@greensock.com
+ **/
+
+(window._gsQueue || (window._gsQueue = [])).push( function() {
+
+ "use strict";
+
+ window._gsDefine("TweenMax", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) {
+
+ var _slice = [].slice,
+ TweenMax = function(target, duration, vars) {
+ TweenLite.call(this, target, duration, vars);
+ this._cycle = 0;
+ this._yoyo = (this.vars.yoyo === true);
+ this._repeat = this.vars.repeat || 0;
+ this._repeatDelay = this.vars.repeatDelay || 0;
+ this._dirty = true; //ensures that if there is any repeat, the totalDuration will get recalculated to accurately report it.
+ this.render = TweenMax.prototype.render; //speed optimization (avoid prototype lookup on this "hot" method)
+ },
+ _tinyNum = 0.0000000001,
+ TweenLiteInternals = TweenLite._internals,
+ _isSelector = TweenLiteInternals.isSelector,
+ _isArray = TweenLiteInternals.isArray,
+ p = TweenMax.prototype = TweenLite.to({}, 0.1, {}),
+ _blankArray = [];
+
+ TweenMax.version = "1.12.1";
+ p.constructor = TweenMax;
+ p.kill()._gc = false;
+ TweenMax.killTweensOf = TweenMax.killDelayedCallsTo = TweenLite.killTweensOf;
+ TweenMax.getTweensOf = TweenLite.getTweensOf;
+ TweenMax.lagSmoothing = TweenLite.lagSmoothing;
+ TweenMax.ticker = TweenLite.ticker;
+ TweenMax.render = TweenLite.render;
+
+ p.invalidate = function() {
+ this._yoyo = (this.vars.yoyo === true);
+ this._repeat = this.vars.repeat || 0;
+ this._repeatDelay = this.vars.repeatDelay || 0;
+ this._uncache(true);
+ return TweenLite.prototype.invalidate.call(this);
+ };
+
+ p.updateTo = function(vars, resetDuration) {
+ var curRatio = this.ratio, p;
+ if (resetDuration && this._startTime < this._timeline._time) {
+ this._startTime = this._timeline._time;
+ this._uncache(false);
+ if (this._gc) {
+ this._enabled(true, false);
+ } else {
+ this._timeline.insert(this, this._startTime - this._delay); //ensures that any necessary re-sequencing of Animations in the timeline occurs to make sure the rendering order is correct.
+ }
+ }
+ for (p in vars) {
+ this.vars[p] = vars[p];
+ }
+ if (this._initted) {
+ if (resetDuration) {
+ this._initted = false;
+ } else {
+ if (this._gc) {
+ this._enabled(true, false);
+ }
+ if (this._notifyPluginsOfEnabled && this._firstPT) {
+ TweenLite._onPluginEvent("_onDisable", this); //in case a plugin like MotionBlur must perform some cleanup tasks
+ }
+ if (this._time / this._duration > 0.998) { //if the tween has finished (or come extremely close to finishing), we just need to rewind it to 0 and then render it again at the end which forces it to re-initialize (parsing the new vars). We allow tweens that are close to finishing (but haven't quite finished) to work this way too because otherwise, the values are so small when determining where to project the starting values that binary math issues creep in and can make the tween appear to render incorrectly when run backwards.
+ var prevTime = this._time;
+ this.render(0, true, false);
+ this._initted = false;
+ this.render(prevTime, true, false);
+ } else if (this._time > 0) {
+ this._initted = false;
+ this._init();
+ var inv = 1 / (1 - curRatio),
+ pt = this._firstPT, endValue;
+ while (pt) {
+ endValue = pt.s + pt.c;
+ pt.c *= inv;
+ pt.s = endValue - pt.c;
+ pt = pt._next;
+ }
+ }
+ }
+ }
+ return this;
+ };
+
+ p.render = function(time, suppressEvents, force) {
+ if (!this._initted) if (this._duration === 0 && this.vars.repeat) { //zero duration tweens that render immediately have render() called from TweenLite's constructor, before TweenMax's constructor has finished setting _repeat, _repeatDelay, and _yoyo which are critical in determining totalDuration() so we need to call invalidate() which is a low-kb way to get those set properly.
+ this.invalidate();
+ }
+ var totalDur = (!this._dirty) ? this._totalDuration : this.totalDuration(),
+ prevTime = this._time,
+ prevTotalTime = this._totalTime,
+ prevCycle = this._cycle,
+ duration = this._duration,
+ prevRawPrevTime = this._rawPrevTime,
+ isComplete, callback, pt, cycleDuration, r, type, pow, rawPrevTime, i;
+ if (time >= totalDur) {
+ this._totalTime = totalDur;
+ this._cycle = this._repeat;
+ if (this._yoyo && (this._cycle & 1) !== 0) {
+ this._time = 0;
+ this.ratio = this._ease._calcEnd ? this._ease.getRatio(0) : 0;
+ } else {
+ this._time = duration;
+ this.ratio = this._ease._calcEnd ? this._ease.getRatio(1) : 1;
+ }
+ if (!this._reversed) {
+ isComplete = true;
+ callback = "onComplete";
+ }
+ if (duration === 0) if (this._initted || !this.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
+ if (this._startTime === this._timeline._duration) { //if a zero-duration tween is at the VERY end of a timeline and that timeline renders at its end, it will typically add a tiny bit of cushion to the render time to prevent rounding errors from getting in the way of tweens rendering their VERY end. If we then reverse() that timeline, the zero-duration tween will trigger its onReverseComplete even though technically the playhead didn't pass over it again. It's a very specific edge case we must accommodate.
+ time = 0;
+ }
+ if (time === 0 || prevRawPrevTime < 0 || prevRawPrevTime === _tinyNum) if (prevRawPrevTime !== time) {
+ force = true;
+ if (prevRawPrevTime > _tinyNum) {
+ callback = "onReverseComplete";
+ }
+ }
+ this._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
+ }
+
+ } else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0.
+ this._totalTime = this._time = this._cycle = 0;
+ this.ratio = this._ease._calcEnd ? this._ease.getRatio(0) : 0;
+ if (prevTotalTime !== 0 || (duration === 0 && prevRawPrevTime > 0 && prevRawPrevTime !== _tinyNum)) {
+ callback = "onReverseComplete";
+ isComplete = this._reversed;
+ }
+ if (time < 0) {
+ this._active = false;
+ if (duration === 0) if (this._initted || !this.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
+ if (prevRawPrevTime >= 0) {
+ force = true;
+ }
+ this._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
+ }
+ } else if (!this._initted) { //if we render the very beginning (time == 0) of a fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately.
+ force = true;
+ }
+ } else {
+ this._totalTime = this._time = time;
+
+ if (this._repeat !== 0) {
+ cycleDuration = duration + this._repeatDelay;
+ this._cycle = (this._totalTime / cycleDuration) >> 0; //originally _totalTime % cycleDuration but floating point errors caused problems, so I normalized it. (4 % 0.8 should be 0 but Flash reports it as 0.79999999!)
+ if (this._cycle !== 0) if (this._cycle === this._totalTime / cycleDuration) {
+ this._cycle--; //otherwise when rendered exactly at the end time, it will act as though it is repeating (at the beginning)
+ }
+ this._time = this._totalTime - (this._cycle * cycleDuration);
+ if (this._yoyo) if ((this._cycle & 1) !== 0) {
+ this._time = duration - this._time;
+ }
+ if (this._time > duration) {
+ this._time = duration;
+ } else if (this._time < 0) {
+ this._time = 0;
+ }
+ }
+
+ if (this._easeType) {
+ r = this._time / duration;
+ type = this._easeType;
+ pow = this._easePower;
+ if (type === 1 || (type === 3 && r >= 0.5)) {
+ r = 1 - r;
+ }
+ if (type === 3) {
+ r *= 2;
+ }
+ if (pow === 1) {
+ r *= r;
+ } else if (pow === 2) {
+ r *= r * r;
+ } else if (pow === 3) {
+ r *= r * r * r;
+ } else if (pow === 4) {
+ r *= r * r * r * r;
+ }
+
+ if (type === 1) {
+ this.ratio = 1 - r;
+ } else if (type === 2) {
+ this.ratio = r;
+ } else if (this._time / duration < 0.5) {
+ this.ratio = r / 2;
+ } else {
+ this.ratio = 1 - (r / 2);
+ }
+
+ } else {
+ this.ratio = this._ease.getRatio(this._time / duration);
+ }
+
+ }
+
+ if (prevTime === this._time && !force && prevCycle === this._cycle) {
+ if (prevTotalTime !== this._totalTime) if (this._onUpdate) if (!suppressEvents) { //so that onUpdate fires even during the repeatDelay - as long as the totalTime changed, we should trigger onUpdate.
+ this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
+ }
+ return;
+ } else if (!this._initted) {
+ this._init();
+ if (!this._initted || this._gc) { //immediateRender tweens typically won't initialize until the playhead advances (_time is greater than 0) in order to ensure that overwriting occurs properly. Also, if all of the tweening properties have been overwritten (which would cause _gc to be true, as set in _init()), we shouldn't continue otherwise an onStart callback could be called for example.
+ return;
+ } else if (!force && this._firstPT && ((this.vars.lazy !== false && this._duration) || (this.vars.lazy && !this._duration))) { //we stick it in the queue for rendering at the very end of the tick - this is a performance optimization because browsers invalidate styles and force a recalculation if you read, write, and then read style data (so it's better to read/read/read/write/write/write than read/write/read/write/read/write). The down side, of course, is that usually you WANT things to render immediately because you may have code running right after that which depends on the change. Like imagine running TweenLite.set(...) and then immediately after that, creating a nother tween that animates the same property to another value; the starting values of that 2nd tween wouldn't be accurate if lazy is true.
+ this._time = prevTime;
+ this._totalTime = prevTotalTime;
+ this._rawPrevTime = prevRawPrevTime;
+ this._cycle = prevCycle;
+ TweenLiteInternals.lazyTweens.push(this);
+ this._lazy = time;
+ return;
+ }
+ //_ease is initially set to defaultEase, so now that init() has run, _ease is set properly and we need to recalculate the ratio. Overall this is faster than using conditional logic earlier in the method to avoid having to set ratio twice because we only init() once but renderTime() gets called VERY frequently.
+ if (this._time && !isComplete) {
+ this.ratio = this._ease.getRatio(this._time / duration);
+ } else if (isComplete && this._ease._calcEnd) {
+ this.ratio = this._ease.getRatio((this._time === 0) ? 0 : 1);
+ }
+ }
+ if (this._lazy !== false) {
+ this._lazy = false;
+ }
+
+ if (!this._active) if (!this._paused && this._time !== prevTime && time >= 0) {
+ this._active = true; //so that if the user renders a tween (as opposed to the timeline rendering it), the timeline is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the tween already finished but the user manually re-renders it as halfway done.
+ }
+ if (prevTotalTime === 0) {
+ if (this._initted === 2 && time > 0) {
+ //this.invalidate();
+ this._init(); //will just apply overwriting since _initted of (2) means it was a from() tween that had immediateRender:true
+ }
+ if (this._startAt) {
+ if (time >= 0) {
+ this._startAt.render(time, suppressEvents, force);
+ } else if (!callback) {
+ callback = "_dummyGS"; //if no callback is defined, use a dummy value just so that the condition at the end evaluates as true because _startAt should render AFTER the normal render loop when the time is negative. We could handle this in a more intuitive way, of course, but the render loop is the MOST important thing to optimize, so this technique allows us to avoid adding extra conditional logic in a high-frequency area.
+ }
+ }
+ if (this.vars.onStart) if (this._totalTime !== 0 || duration === 0) if (!suppressEvents) {
+ this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
+ }
+ }
+
+ pt = this._firstPT;
+ while (pt) {
+ if (pt.f) {
+ pt.t[pt.p](pt.c * this.ratio + pt.s);
+ } else {
+ pt.t[pt.p] = pt.c * this.ratio + pt.s;
+ }
+ pt = pt._next;
+ }
+
+ if (this._onUpdate) {
+ if (time < 0) if (this._startAt && this._startTime) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values.
+ this._startAt.render(time, suppressEvents, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete.
+ }
+ if (!suppressEvents) if (this._totalTime !== prevTotalTime || isComplete) {
+ this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
+ }
+ }
+ if (this._cycle !== prevCycle) if (!suppressEvents) if (!this._gc) if (this.vars.onRepeat) {
+ this.vars.onRepeat.apply(this.vars.onRepeatScope || this, this.vars.onRepeatParams || _blankArray);
+ }
+ if (callback) if (!this._gc) { //check gc because there's a chance that kill() could be called in an onUpdate
+ if (time < 0 && this._startAt && !this._onUpdate && this._startTime) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values.
+ this._startAt.render(time, suppressEvents, force);
+ }
+ if (isComplete) {
+ if (this._timeline.autoRemoveChildren) {
+ this._enabled(false, false);
+ }
+ this._active = false;
+ }
+ if (!suppressEvents && this.vars[callback]) {
+ this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray);
+ }
+ if (duration === 0 && this._rawPrevTime === _tinyNum && rawPrevTime !== _tinyNum) { //the onComplete or onReverseComplete could trigger movement of the playhead and for zero-duration tweens (which must discern direction) that land directly back on their start time, we don't want to fire again on the next render. Think of several addPause()'s in a timeline that forces the playhead to a certain spot, but what if it's already paused and another tween is tweening the "time" of the timeline? Each time it moves [forward] past that spot, it would move back, and since suppressEvents is true, it'd reset _rawPrevTime to _tinyNum so that when it begins again, the callback would fire (so ultimately it could bounce back and forth during that tween). Again, this is a very uncommon scenario, but possible nonetheless.
+ this._rawPrevTime = 0;
+ }
+ }
+ };
+
+//---- STATIC FUNCTIONS -----------------------------------------------------------------------------------------------------------
+
+ TweenMax.to = function(target, duration, vars) {
+ return new TweenMax(target, duration, vars);
+ };
+
+ TweenMax.from = function(target, duration, vars) {
+ vars.runBackwards = true;
+ vars.immediateRender = (vars.immediateRender != false);
+ return new TweenMax(target, duration, vars);
+ };
+
+ TweenMax.fromTo = function(target, duration, fromVars, toVars) {
+ toVars.startAt = fromVars;
+ toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false);
+ return new TweenMax(target, duration, toVars);
+ };
+
+ TweenMax.staggerTo = TweenMax.allTo = function(targets, duration, vars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
+ stagger = stagger || 0;
+ var delay = vars.delay || 0,
+ a = [],
+ finalComplete = function() {
+ if (vars.onComplete) {
+ vars.onComplete.apply(vars.onCompleteScope || this, arguments);
+ }
+ onCompleteAll.apply(onCompleteAllScope || this, onCompleteAllParams || _blankArray);
+ },
+ l, copy, i, p;
+ if (!_isArray(targets)) {
+ if (typeof(targets) === "string") {
+ targets = TweenLite.selector(targets) || targets;
+ }
+ if (_isSelector(targets)) {
+ targets = _slice.call(targets, 0);
+ }
+ }
+ l = targets.length;
+ for (i = 0; i < l; i++) {
+ copy = {};
+ for (p in vars) {
+ copy[p] = vars[p];
+ }
+ copy.delay = delay;
+ if (i === l - 1 && onCompleteAll) {
+ copy.onComplete = finalComplete;
+ }
+ a[i] = new TweenMax(targets[i], duration, copy);
+ delay += stagger;
+ }
+ return a;
+ };
+
+ TweenMax.staggerFrom = TweenMax.allFrom = function(targets, duration, vars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
+ vars.runBackwards = true;
+ vars.immediateRender = (vars.immediateRender != false);
+ return TweenMax.staggerTo(targets, duration, vars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope);
+ };
+
+ TweenMax.staggerFromTo = TweenMax.allFromTo = function(targets, duration, fromVars, toVars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
+ toVars.startAt = fromVars;
+ toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false);
+ return TweenMax.staggerTo(targets, duration, toVars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope);
+ };
+
+ TweenMax.delayedCall = function(delay, callback, params, scope, useFrames) {
+ return new TweenMax(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, onCompleteScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, onReverseCompleteScope:scope, immediateRender:false, useFrames:useFrames, overwrite:0});
+ };
+
+ TweenMax.set = function(target, vars) {
+ return new TweenMax(target, 0, vars);
+ };
+
+ TweenMax.isTweening = function(target) {
+ return (TweenLite.getTweensOf(target, true).length > 0);
+ };
+
+ var _getChildrenOf = function(timeline, includeTimelines) {
+ var a = [],
+ cnt = 0,
+ tween = timeline._first;
+ while (tween) {
+ if (tween instanceof TweenLite) {
+ a[cnt++] = tween;
+ } else {
+ if (includeTimelines) {
+ a[cnt++] = tween;
+ }
+ a = a.concat(_getChildrenOf(tween, includeTimelines));
+ cnt = a.length;
+ }
+ tween = tween._next;
+ }
+ return a;
+ },
+ getAllTweens = TweenMax.getAllTweens = function(includeTimelines) {
+ return _getChildrenOf(Animation._rootTimeline, includeTimelines).concat( _getChildrenOf(Animation._rootFramesTimeline, includeTimelines) );
+ };
+
+ TweenMax.killAll = function(complete, tweens, delayedCalls, timelines) {
+ if (tweens == null) {
+ tweens = true;
+ }
+ if (delayedCalls == null) {
+ delayedCalls = true;
+ }
+ var a = getAllTweens((timelines != false)),
+ l = a.length,
+ allTrue = (tweens && delayedCalls && timelines),
+ isDC, tween, i;
+ for (i = 0; i < l; i++) {
+ tween = a[i];
+ if (allTrue || (tween instanceof SimpleTimeline) || ((isDC = (tween.target === tween.vars.onComplete)) && delayedCalls) || (tweens && !isDC)) {
+ if (complete) {
+ tween.totalTime(tween._reversed ? 0 : tween.totalDuration());
+ } else {
+ tween._enabled(false, false);
+ }
+ }
+ }
+ };
+
+ TweenMax.killChildTweensOf = function(parent, complete) {
+ if (parent == null) {
+ return;
+ }
+ var tl = TweenLiteInternals.tweenLookup,
+ a, curParent, p, i, l;
+ if (typeof(parent) === "string") {
+ parent = TweenLite.selector(parent) || parent;
+ }
+ if (_isSelector(parent)) {
+ parent = _slice.call(parent, 0);
+ }
+ if (_isArray(parent)) {
+ i = parent.length;
+ while (--i > -1) {
+ TweenMax.killChildTweensOf(parent[i], complete);
+ }
+ return;
+ }
+ a = [];
+ for (p in tl) {
+ curParent = tl[p].target.parentNode;
+ while (curParent) {
+ if (curParent === parent) {
+ a = a.concat(tl[p].tweens);
+ }
+ curParent = curParent.parentNode;
+ }
+ }
+ l = a.length;
+ for (i = 0; i < l; i++) {
+ if (complete) {
+ a[i].totalTime(a[i].totalDuration());
+ }
+ a[i]._enabled(false, false);
+ }
+ };
+
+ var _changePause = function(pause, tweens, delayedCalls, timelines) {
+ tweens = (tweens !== false);
+ delayedCalls = (delayedCalls !== false);
+ timelines = (timelines !== false);
+ var a = getAllTweens(timelines),
+ allTrue = (tweens && delayedCalls && timelines),
+ i = a.length,
+ isDC, tween;
+ while (--i > -1) {
+ tween = a[i];
+ if (allTrue || (tween instanceof SimpleTimeline) || ((isDC = (tween.target === tween.vars.onComplete)) && delayedCalls) || (tweens && !isDC)) {
+ tween.paused(pause);
+ }
+ }
+ };
+
+ TweenMax.pauseAll = function(tweens, delayedCalls, timelines) {
+ _changePause(true, tweens, delayedCalls, timelines);
+ };
+
+ TweenMax.resumeAll = function(tweens, delayedCalls, timelines) {
+ _changePause(false, tweens, delayedCalls, timelines);
+ };
+
+ TweenMax.globalTimeScale = function(value) {
+ var tl = Animation._rootTimeline,
+ t = TweenLite.ticker.time;
+ if (!arguments.length) {
+ return tl._timeScale;
+ }
+ value = value || _tinyNum; //can't allow zero because it'll throw the math off
+ tl._startTime = t - ((t - tl._startTime) * tl._timeScale / value);
+ tl = Animation._rootFramesTimeline;
+ t = TweenLite.ticker.frame;
+ tl._startTime = t - ((t - tl._startTime) * tl._timeScale / value);
+ tl._timeScale = Animation._rootTimeline._timeScale = value;
+ return value;
+ };
+
+
+//---- GETTERS / SETTERS ----------------------------------------------------------------------------------------------------------
+
+ p.progress = function(value) {
+ return (!arguments.length) ? this._time / this.duration() : this.totalTime( this.duration() * ((this._yoyo && (this._cycle & 1) !== 0) ? 1 - value : value) + (this._cycle * (this._duration + this._repeatDelay)), false);
+ };
+
+ p.totalProgress = function(value) {
+ return (!arguments.length) ? this._totalTime / this.totalDuration() : this.totalTime( this.totalDuration() * value, false);
+ };
+
+ p.time = function(value, suppressEvents) {
+ if (!arguments.length) {
+ return this._time;
+ }
+ if (this._dirty) {
+ this.totalDuration();
+ }
+ if (value > this._duration) {
+ value = this._duration;
+ }
+ if (this._yoyo && (this._cycle & 1) !== 0) {
+ value = (this._duration - value) + (this._cycle * (this._duration + this._repeatDelay));
+ } else if (this._repeat !== 0) {
+ value += this._cycle * (this._duration + this._repeatDelay);
+ }
+ return this.totalTime(value, suppressEvents);
+ };
+
+ p.duration = function(value) {
+ if (!arguments.length) {
+ return this._duration; //don't set _dirty = false because there could be repeats that haven't been factored into the _totalDuration yet. Otherwise, if you create a repeated TweenMax and then immediately check its duration(), it would cache the value and the totalDuration would not be correct, thus repeats wouldn't take effect.
+ }
+ return Animation.prototype.duration.call(this, value);
+ };
+
+ p.totalDuration = function(value) {
+ if (!arguments.length) {
+ if (this._dirty) {
+ //instead of Infinity, we use 999999999999 so that we can accommodate reverses
+ this._totalDuration = (this._repeat === -1) ? 999999999999 : this._duration * (this._repeat + 1) + (this._repeatDelay * this._repeat);
+ this._dirty = false;
+ }
+ return this._totalDuration;
+ }
+ return (this._repeat === -1) ? this : this.duration( (value - (this._repeat * this._repeatDelay)) / (this._repeat + 1) );
+ };
+
+ p.repeat = function(value) {
+ if (!arguments.length) {
+ return this._repeat;
+ }
+ this._repeat = value;
+ return this._uncache(true);
+ };
+
+ p.repeatDelay = function(value) {
+ if (!arguments.length) {
+ return this._repeatDelay;
+ }
+ this._repeatDelay = value;
+ return this._uncache(true);
+ };
+
+ p.yoyo = function(value) {
+ if (!arguments.length) {
+ return this._yoyo;
+ }
+ this._yoyo = value;
+ return this;
+ };
+
+
+ return TweenMax;
+
+ }, true);
+
+
+
+
+
+
+
+
+/*
+ * ----------------------------------------------------------------
+ * TimelineLite
+ * ----------------------------------------------------------------
+ */
+ window._gsDefine("TimelineLite", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) {
+
+ var TimelineLite = function(vars) {
+ SimpleTimeline.call(this, vars);
+ this._labels = {};
+ this.autoRemoveChildren = (this.vars.autoRemoveChildren === true);
+ this.smoothChildTiming = (this.vars.smoothChildTiming === true);
+ this._sortChildren = true;
+ this._onUpdate = this.vars.onUpdate;
+ var v = this.vars,
+ val, p;
+ for (p in v) {
+ val = v[p];
+ if (_isArray(val)) if (val.join("").indexOf("{self}") !== -1) {
+ v[p] = this._swapSelfInParams(val);
+ }
+ }
+ if (_isArray(v.tweens)) {
+ this.add(v.tweens, 0, v.align, v.stagger);
+ }
+ },
+ _tinyNum = 0.0000000001,
+ _isSelector = TweenLite._internals.isSelector,
+ _isArray = TweenLite._internals.isArray,
+ _blankArray = [],
+ _globals = window._gsDefine.globals,
+ _copy = function(vars) {
+ var copy = {}, p;
+ for (p in vars) {
+ copy[p] = vars[p];
+ }
+ return copy;
+ },
+ _pauseCallback = function(tween, callback, params, scope) {
+ tween._timeline.pause(tween._startTime);
+ if (callback) {
+ callback.apply(scope || tween._timeline, params || _blankArray);
+ }
+ },
+ _slice = _blankArray.slice,
+ p = TimelineLite.prototype = new SimpleTimeline();
+
+ TimelineLite.version = "1.12.1";
+ p.constructor = TimelineLite;
+ p.kill()._gc = false;
+
+ p.to = function(target, duration, vars, position) {
+ var Engine = (vars.repeat && _globals.TweenMax) || TweenLite;
+ return duration ? this.add( new Engine(target, duration, vars), position) : this.set(target, vars, position);
+ };
+
+ p.from = function(target, duration, vars, position) {
+ return this.add( ((vars.repeat && _globals.TweenMax) || TweenLite).from(target, duration, vars), position);
+ };
+
+ p.fromTo = function(target, duration, fromVars, toVars, position) {
+ var Engine = (toVars.repeat && _globals.TweenMax) || TweenLite;
+ return duration ? this.add( Engine.fromTo(target, duration, fromVars, toVars), position) : this.set(target, toVars, position);
+ };
+
+ p.staggerTo = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
+ var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, onCompleteScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}),
+ i;
+ if (typeof(targets) === "string") {
+ targets = TweenLite.selector(targets) || targets;
+ }
+ if (_isSelector(targets)) { //senses if the targets object is a selector. If it is, we should translate it into an array.
+ targets = _slice.call(targets, 0);
+ }
+ stagger = stagger || 0;
+ for (i = 0; i < targets.length; i++) {
+ if (vars.startAt) {
+ vars.startAt = _copy(vars.startAt);
+ }
+ tl.to(targets[i], duration, _copy(vars), i * stagger);
+ }
+ return this.add(tl, position);
+ };
+
+ p.staggerFrom = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
+ vars.immediateRender = (vars.immediateRender != false);
+ vars.runBackwards = true;
+ return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope);
+ };
+
+ p.staggerFromTo = function(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
+ toVars.startAt = fromVars;
+ toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false);
+ return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope);
+ };
+
+ p.call = function(callback, params, scope, position) {
+ return this.add( TweenLite.delayedCall(0, callback, params, scope), position);
+ };
+
+ p.set = function(target, vars, position) {
+ position = this._parseTimeOrLabel(position, 0, true);
+ if (vars.immediateRender == null) {
+ vars.immediateRender = (position === this._time && !this._paused);
+ }
+ return this.add( new TweenLite(target, 0, vars), position);
+ };
+
+ TimelineLite.exportRoot = function(vars, ignoreDelayedCalls) {
+ vars = vars || {};
+ if (vars.smoothChildTiming == null) {
+ vars.smoothChildTiming = true;
+ }
+ var tl = new TimelineLite(vars),
+ root = tl._timeline,
+ tween, next;
+ if (ignoreDelayedCalls == null) {
+ ignoreDelayedCalls = true;
+ }
+ root._remove(tl, true);
+ tl._startTime = 0;
+ tl._rawPrevTime = tl._time = tl._totalTime = root._time;
+ tween = root._first;
+ while (tween) {
+ next = tween._next;
+ if (!ignoreDelayedCalls || !(tween instanceof TweenLite && tween.target === tween.vars.onComplete)) {
+ tl.add(tween, tween._startTime - tween._delay);
+ }
+ tween = next;
+ }
+ root.add(tl, 0);
+ return tl;
+ };
+
+ p.add = function(value, position, align, stagger) {
+ var curTime, l, i, child, tl, beforeRawTime;
+ if (typeof(position) !== "number") {
+ position = this._parseTimeOrLabel(position, 0, true, value);
+ }
+ if (!(value instanceof Animation)) {
+ if ((value instanceof Array) || (value && value.push && _isArray(value))) {
+ align = align || "normal";
+ stagger = stagger || 0;
+ curTime = position;
+ l = value.length;
+ for (i = 0; i < l; i++) {
+ if (_isArray(child = value[i])) {
+ child = new TimelineLite({tweens:child});
+ }
+ this.add(child, curTime);
+ if (typeof(child) !== "string" && typeof(child) !== "function") {
+ if (align === "sequence") {
+ curTime = child._startTime + (child.totalDuration() / child._timeScale);
+ } else if (align === "start") {
+ child._startTime -= child.delay();
+ }
+ }
+ curTime += stagger;
+ }
+ return this._uncache(true);
+ } else if (typeof(value) === "string") {
+ return this.addLabel(value, position);
+ } else if (typeof(value) === "function") {
+ value = TweenLite.delayedCall(0, value);
+ } else {
+ throw("Cannot add " + value + " into the timeline; it is not a tween, timeline, function, or string.");
+ }
+ }
+
+ SimpleTimeline.prototype.add.call(this, value, position);
+
+ //if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly. We should also align the playhead with the parent timeline's when appropriate.
+ if (this._gc || this._time === this._duration) if (!this._paused) if (this._duration < this.duration()) {
+ //in case any of the ancestors had completed but should now be enabled...
+ tl = this;
+ beforeRawTime = (tl.rawTime() > value._startTime); //if the tween is placed on the timeline so that it starts BEFORE the current rawTime, we should align the playhead (move the timeline). This is because sometimes users will create a timeline, let it finish, and much later append a tween and expect it to run instead of jumping to its end state. While technically one could argue that it should jump to its end state, that's not what users intuitively expect.
+ while (tl._timeline) {
+ if (beforeRawTime && tl._timeline.smoothChildTiming) {
+ tl.totalTime(tl._totalTime, true); //moves the timeline (shifts its startTime) if necessary, and also enables it.
+ } else if (tl._gc) {
+ tl._enabled(true, false);
+ }
+ tl = tl._timeline;
+ }
+ }
+
+ return this;
+ };
+
+ p.remove = function(value) {
+ if (value instanceof Animation) {
+ return this._remove(value, false);
+ } else if (value instanceof Array || (value && value.push && _isArray(value))) {
+ var i = value.length;
+ while (--i > -1) {
+ this.remove(value[i]);
+ }
+ return this;
+ } else if (typeof(value) === "string") {
+ return this.removeLabel(value);
+ }
+ return this.kill(null, value);
+ };
+
+ p._remove = function(tween, skipDisable) {
+ SimpleTimeline.prototype._remove.call(this, tween, skipDisable);
+ var last = this._last;
+ if (!last) {
+ this._time = this._totalTime = this._duration = this._totalDuration = 0;
+ } else if (this._time > last._startTime + last._totalDuration / last._timeScale) {
+ this._time = this.duration();
+ this._totalTime = this._totalDuration;
+ }
+ return this;
+ };
+
+ p.append = function(value, offsetOrLabel) {
+ return this.add(value, this._parseTimeOrLabel(null, offsetOrLabel, true, value));
+ };
+
+ p.insert = p.insertMultiple = function(value, position, align, stagger) {
+ return this.add(value, position || 0, align, stagger);
+ };
+
+ p.appendMultiple = function(tweens, offsetOrLabel, align, stagger) {
+ return this.add(tweens, this._parseTimeOrLabel(null, offsetOrLabel, true, tweens), align, stagger);
+ };
+
+ p.addLabel = function(label, position) {
+ this._labels[label] = this._parseTimeOrLabel(position);
+ return this;
+ };
+
+ p.addPause = function(position, callback, params, scope) {
+ return this.call(_pauseCallback, ["{self}", callback, params, scope], this, position);
+ };
+
+ p.removeLabel = function(label) {
+ delete this._labels[label];
+ return this;
+ };
+
+ p.getLabelTime = function(label) {
+ return (this._labels[label] != null) ? this._labels[label] : -1;
+ };
+
+ p._parseTimeOrLabel = function(timeOrLabel, offsetOrLabel, appendIfAbsent, ignore) {
+ var i;
+ //if we're about to add a tween/timeline (or an array of them) that's already a child of this timeline, we should remove it first so that it doesn't contaminate the duration().
+ if (ignore instanceof Animation && ignore.timeline === this) {
+ this.remove(ignore);
+ } else if (ignore && ((ignore instanceof Array) || (ignore.push && _isArray(ignore)))) {
+ i = ignore.length;
+ while (--i > -1) {
+ if (ignore[i] instanceof Animation && ignore[i].timeline === this) {
+ this.remove(ignore[i]);
+ }
+ }
+ }
+ if (typeof(offsetOrLabel) === "string") {
+ return this._parseTimeOrLabel(offsetOrLabel, (appendIfAbsent && typeof(timeOrLabel) === "number" && this._labels[offsetOrLabel] == null) ? timeOrLabel - this.duration() : 0, appendIfAbsent);
+ }
+ offsetOrLabel = offsetOrLabel || 0;
+ if (typeof(timeOrLabel) === "string" && (isNaN(timeOrLabel) || this._labels[timeOrLabel] != null)) { //if the string is a number like "1", check to see if there's a label with that name, otherwise interpret it as a number (absolute value).
+ i = timeOrLabel.indexOf("=");
+ if (i === -1) {
+ if (this._labels[timeOrLabel] == null) {
+ return appendIfAbsent ? (this._labels[timeOrLabel] = this.duration() + offsetOrLabel) : offsetOrLabel;
+ }
+ return this._labels[timeOrLabel] + offsetOrLabel;
+ }
+ offsetOrLabel = parseInt(timeOrLabel.charAt(i-1) + "1", 10) * Number(timeOrLabel.substr(i+1));
+ timeOrLabel = (i > 1) ? this._parseTimeOrLabel(timeOrLabel.substr(0, i-1), 0, appendIfAbsent) : this.duration();
+ } else if (timeOrLabel == null) {
+ timeOrLabel = this.duration();
+ }
+ return Number(timeOrLabel) + offsetOrLabel;
+ };
+
+ p.seek = function(position, suppressEvents) {
+ return this.totalTime((typeof(position) === "number") ? position : this._parseTimeOrLabel(position), (suppressEvents !== false));
+ };
+
+ p.stop = function() {
+ return this.paused(true);
+ };
+
+ p.gotoAndPlay = function(position, suppressEvents) {
+ return this.play(position, suppressEvents);
+ };
+
+ p.gotoAndStop = function(position, suppressEvents) {
+ return this.pause(position, suppressEvents);
+ };
+
+ p.render = function(time, suppressEvents, force) {
+ if (this._gc) {
+ this._enabled(true, false);
+ }
+ var totalDur = (!this._dirty) ? this._totalDuration : this.totalDuration(),
+ prevTime = this._time,
+ prevStart = this._startTime,
+ prevTimeScale = this._timeScale,
+ prevPaused = this._paused,
+ tween, isComplete, next, callback, internalForce;
+ if (time >= totalDur) {
+ this._totalTime = this._time = totalDur;
+ if (!this._reversed) if (!this._hasPausedChild()) {
+ isComplete = true;
+ callback = "onComplete";
+ if (this._duration === 0) if (time === 0 || this._rawPrevTime < 0 || this._rawPrevTime === _tinyNum) if (this._rawPrevTime !== time && this._first) {
+ internalForce = true;
+ if (this._rawPrevTime > _tinyNum) {
+ callback = "onReverseComplete";
+ }
+ }
+ }
+ this._rawPrevTime = (this._duration || !suppressEvents || time || this._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
+ time = totalDur + 0.0001; //to avoid occasional floating point rounding errors - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when _time - tween._startTime is performed, floating point errors would return a value that was SLIGHTLY off). Try (999999999999.7 - 999999999999) * 1 = 0.699951171875 instead of 0.7.
+
+ } else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0.
+ this._totalTime = this._time = 0;
+ if (prevTime !== 0 || (this._duration === 0 && this._rawPrevTime !== _tinyNum && (this._rawPrevTime > 0 || (time < 0 && this._rawPrevTime >= 0)))) {
+ callback = "onReverseComplete";
+ isComplete = this._reversed;
+ }
+ if (time < 0) {
+ this._active = false;
+ if (this._duration === 0) if (this._rawPrevTime >= 0 && this._first) { //zero-duration timelines are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
+ internalForce = true;
+ }
+ this._rawPrevTime = time;
+ } else {
+ this._rawPrevTime = (this._duration || !suppressEvents || time || this._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
+
+ time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline)
+ if (!this._initted) {
+ internalForce = true;
+ }
+ }
+
+ } else {
+ this._totalTime = this._time = this._rawPrevTime = time;
+ }
+ if ((this._time === prevTime || !this._first) && !force && !internalForce) {
+ return;
+ } else if (!this._initted) {
+ this._initted = true;
+ }
+
+ if (!this._active) if (!this._paused && this._time !== prevTime && time > 0) {
+ this._active = true; //so that if the user renders the timeline (as opposed to the parent timeline rendering it), it is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the timeline already finished but the user manually re-renders it as halfway done, for example.
+ }
+
+ if (prevTime === 0) if (this.vars.onStart) if (this._time !== 0) if (!suppressEvents) {
+ this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
+ }
+
+ if (this._time >= prevTime) {
+ tween = this._first;
+ while (tween) {
+ next = tween._next; //record it here because the value could change after rendering...
+ if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
+ break;
+ } else if (tween._active || (tween._startTime <= this._time && !tween._paused && !tween._gc)) {
+ if (!tween._reversed) {
+ tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
+ } else {
+ tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
+ }
+ }
+ tween = next;
+ }
+ } else {
+ tween = this._last;
+ while (tween) {
+ next = tween._prev; //record it here because the value could change after rendering...
+ if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
+ break;
+ } else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) {
+ if (!tween._reversed) {
+ tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
+ } else {
+ tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
+ }
+ }
+ tween = next;
+ }
+ }
+
+ if (this._onUpdate) if (!suppressEvents) {
+ this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
+ }
+
+ if (callback) if (!this._gc) if (prevStart === this._startTime || prevTimeScale !== this._timeScale) if (this._time === 0 || totalDur >= this.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate
+ if (isComplete) {
+ if (this._timeline.autoRemoveChildren) {
+ this._enabled(false, false);
+ }
+ this._active = false;
+ }
+ if (!suppressEvents && this.vars[callback]) {
+ this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray);
+ }
+ }
+ };
+
+ p._hasPausedChild = function() {
+ var tween = this._first;
+ while (tween) {
+ if (tween._paused || ((tween instanceof TimelineLite) && tween._hasPausedChild())) {
+ return true;
+ }
+ tween = tween._next;
+ }
+ return false;
+ };
+
+ p.getChildren = function(nested, tweens, timelines, ignoreBeforeTime) {
+ ignoreBeforeTime = ignoreBeforeTime || -9999999999;
+ var a = [],
+ tween = this._first,
+ cnt = 0;
+ while (tween) {
+ if (tween._startTime < ignoreBeforeTime) {
+ //do nothing
+ } else if (tween instanceof TweenLite) {
+ if (tweens !== false) {
+ a[cnt++] = tween;
+ }
+ } else {
+ if (timelines !== false) {
+ a[cnt++] = tween;
+ }
+ if (nested !== false) {
+ a = a.concat(tween.getChildren(true, tweens, timelines));
+ cnt = a.length;
+ }
+ }
+ tween = tween._next;
+ }
+ return a;
+ };
+
+ p.getTweensOf = function(target, nested) {
+ var disabled = this._gc,
+ a = [],
+ cnt = 0,
+ tweens, i;
+ if (disabled) {
+ this._enabled(true, true); //getTweensOf() filters out disabled tweens, and we have to mark them as _gc = true when the timeline completes in order to allow clean garbage collection, so temporarily re-enable the timeline here.
+ }
+ tweens = TweenLite.getTweensOf(target);
+ i = tweens.length;
+ while (--i > -1) {
+ if (tweens[i].timeline === this || (nested && this._contains(tweens[i]))) {
+ a[cnt++] = tweens[i];
+ }
+ }
+ if (disabled) {
+ this._enabled(false, true);
+ }
+ return a;
+ };
+
+ p._contains = function(tween) {
+ var tl = tween.timeline;
+ while (tl) {
+ if (tl === this) {
+ return true;
+ }
+ tl = tl.timeline;
+ }
+ return false;
+ };
+
+ p.shiftChildren = function(amount, adjustLabels, ignoreBeforeTime) {
+ ignoreBeforeTime = ignoreBeforeTime || 0;
+ var tween = this._first,
+ labels = this._labels,
+ p;
+ while (tween) {
+ if (tween._startTime >= ignoreBeforeTime) {
+ tween._startTime += amount;
+ }
+ tween = tween._next;
+ }
+ if (adjustLabels) {
+ for (p in labels) {
+ if (labels[p] >= ignoreBeforeTime) {
+ labels[p] += amount;
+ }
+ }
+ }
+ return this._uncache(true);
+ };
+
+ p._kill = function(vars, target) {
+ if (!vars && !target) {
+ return this._enabled(false, false);
+ }
+ var tweens = (!target) ? this.getChildren(true, true, false) : this.getTweensOf(target),
+ i = tweens.length,
+ changed = false;
+ while (--i > -1) {
+ if (tweens[i]._kill(vars, target)) {
+ changed = true;
+ }
+ }
+ return changed;
+ };
+
+ p.clear = function(labels) {
+ var tweens = this.getChildren(false, true, true),
+ i = tweens.length;
+ this._time = this._totalTime = 0;
+ while (--i > -1) {
+ tweens[i]._enabled(false, false);
+ }
+ if (labels !== false) {
+ this._labels = {};
+ }
+ return this._uncache(true);
+ };
+
+ p.invalidate = function() {
+ var tween = this._first;
+ while (tween) {
+ tween.invalidate();
+ tween = tween._next;
+ }
+ return this;
+ };
+
+ p._enabled = function(enabled, ignoreTimeline) {
+ if (enabled === this._gc) {
+ var tween = this._first;
+ while (tween) {
+ tween._enabled(enabled, true);
+ tween = tween._next;
+ }
+ }
+ return SimpleTimeline.prototype._enabled.call(this, enabled, ignoreTimeline);
+ };
+
+ p.duration = function(value) {
+ if (!arguments.length) {
+ if (this._dirty) {
+ this.totalDuration(); //just triggers recalculation
+ }
+ return this._duration;
+ }
+ if (this.duration() !== 0 && value !== 0) {
+ this.timeScale(this._duration / value);
+ }
+ return this;
+ };
+
+ p.totalDuration = function(value) {
+ if (!arguments.length) {
+ if (this._dirty) {
+ var max = 0,
+ tween = this._last,
+ prevStart = 999999999999,
+ prev, end;
+ while (tween) {
+ prev = tween._prev; //record it here in case the tween changes position in the sequence...
+ if (tween._dirty) {
+ tween.totalDuration(); //could change the tween._startTime, so make sure the tween's cache is clean before analyzing it.
+ }
+ if (tween._startTime > prevStart && this._sortChildren && !tween._paused) { //in case one of the tweens shifted out of order, it needs to be re-inserted into the correct position in the sequence
+ this.add(tween, tween._startTime - tween._delay);
+ } else {
+ prevStart = tween._startTime;
+ }
+ if (tween._startTime < 0 && !tween._paused) { //children aren't allowed to have negative startTimes unless smoothChildTiming is true, so adjust here if one is found.
+ max -= tween._startTime;
+ if (this._timeline.smoothChildTiming) {
+ this._startTime += tween._startTime / this._timeScale;
+ }
+ this.shiftChildren(-tween._startTime, false, -9999999999);
+ prevStart = 0;
+ }
+ end = tween._startTime + (tween._totalDuration / tween._timeScale);
+ if (end > max) {
+ max = end;
+ }
+ tween = prev;
+ }
+ this._duration = this._totalDuration = max;
+ this._dirty = false;
+ }
+ return this._totalDuration;
+ }
+ if (this.totalDuration() !== 0) if (value !== 0) {
+ this.timeScale(this._totalDuration / value);
+ }
+ return this;
+ };
+
+ p.usesFrames = function() {
+ var tl = this._timeline;
+ while (tl._timeline) {
+ tl = tl._timeline;
+ }
+ return (tl === Animation._rootFramesTimeline);
+ };
+
+ p.rawTime = function() {
+ return this._paused ? this._totalTime : (this._timeline.rawTime() - this._startTime) * this._timeScale;
+ };
+
+ return TimelineLite;
+
+ }, true);
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * ----------------------------------------------------------------
+ * TimelineMax
+ * ----------------------------------------------------------------
+ */
+ window._gsDefine("TimelineMax", ["TimelineLite","TweenLite","easing.Ease"], function(TimelineLite, TweenLite, Ease) {
+
+ var TimelineMax = function(vars) {
+ TimelineLite.call(this, vars);
+ this._repeat = this.vars.repeat || 0;
+ this._repeatDelay = this.vars.repeatDelay || 0;
+ this._cycle = 0;
+ this._yoyo = (this.vars.yoyo === true);
+ this._dirty = true;
+ },
+ _tinyNum = 0.0000000001,
+ _blankArray = [],
+ _easeNone = new Ease(null, null, 1, 0),
+ p = TimelineMax.prototype = new TimelineLite();
+
+ p.constructor = TimelineMax;
+ p.kill()._gc = false;
+ TimelineMax.version = "1.12.1";
+
+ p.invalidate = function() {
+ this._yoyo = (this.vars.yoyo === true);
+ this._repeat = this.vars.repeat || 0;
+ this._repeatDelay = this.vars.repeatDelay || 0;
+ this._uncache(true);
+ return TimelineLite.prototype.invalidate.call(this);
+ };
+
+ p.addCallback = function(callback, position, params, scope) {
+ return this.add( TweenLite.delayedCall(0, callback, params, scope), position);
+ };
+
+ p.removeCallback = function(callback, position) {
+ if (callback) {
+ if (position == null) {
+ this._kill(null, callback);
+ } else {
+ var a = this.getTweensOf(callback, false),
+ i = a.length,
+ time = this._parseTimeOrLabel(position);
+ while (--i > -1) {
+ if (a[i]._startTime === time) {
+ a[i]._enabled(false, false);
+ }
+ }
+ }
+ }
+ return this;
+ };
+
+ p.tweenTo = function(position, vars) {
+ vars = vars || {};
+ var copy = {ease:_easeNone, overwrite:(vars.delay ? 2 : 1), useFrames:this.usesFrames(), immediateRender:false},//note: set overwrite to 1 (true/all) by default unless there's a delay so that we avoid a racing situation that could happen if, for example, an onmousemove creates the same tweenTo() over and over again.
+ duration, p, t;
+ for (p in vars) {
+ copy[p] = vars[p];
+ }
+ copy.time = this._parseTimeOrLabel(position);
+ duration = (Math.abs(Number(copy.time) - this._time) / this._timeScale) || 0.001;
+ t = new TweenLite(this, duration, copy);
+ copy.onStart = function() {
+ t.target.paused(true);
+ if (t.vars.time !== t.target.time() && duration === t.duration()) { //don't make the duration zero - if it's supposed to be zero, don't worry because it's already initting the tween and will complete immediately, effectively making the duration zero anyway. If we make duration zero, the tween won't run at all.
+ t.duration( Math.abs( t.vars.time - t.target.time()) / t.target._timeScale );
+ }
+ if (vars.onStart) { //in case the user had an onStart in the vars - we don't want to overwrite it.
+ vars.onStart.apply(vars.onStartScope || t, vars.onStartParams || _blankArray);
+ }
+ };
+ return t;
+ };
+
+ p.tweenFromTo = function(fromPosition, toPosition, vars) {
+ vars = vars || {};
+ fromPosition = this._parseTimeOrLabel(fromPosition);
+ vars.startAt = {onComplete:this.seek, onCompleteParams:[fromPosition], onCompleteScope:this};
+ vars.immediateRender = (vars.immediateRender !== false);
+ var t = this.tweenTo(toPosition, vars);
+ return t.duration((Math.abs( t.vars.time - fromPosition) / this._timeScale) || 0.001);
+ };
+
+ p.render = function(time, suppressEvents, force) {
+ if (this._gc) {
+ this._enabled(true, false);
+ }
+ var totalDur = (!this._dirty) ? this._totalDuration : this.totalDuration(),
+ dur = this._duration,
+ prevTime = this._time,
+ prevTotalTime = this._totalTime,
+ prevStart = this._startTime,
+ prevTimeScale = this._timeScale,
+ prevRawPrevTime = this._rawPrevTime,
+ prevPaused = this._paused,
+ prevCycle = this._cycle,
+ tween, isComplete, next, callback, internalForce, cycleDuration;
+ if (time >= totalDur) {
+ if (!this._locked) {
+ this._totalTime = totalDur;
+ this._cycle = this._repeat;
+ }
+ if (!this._reversed) if (!this._hasPausedChild()) {
+ isComplete = true;
+ callback = "onComplete";
+ if (this._duration === 0) if (time === 0 || prevRawPrevTime < 0 || prevRawPrevTime === _tinyNum) if (prevRawPrevTime !== time && this._first) {
+ internalForce = true;
+ if (prevRawPrevTime > _tinyNum) {
+ callback = "onReverseComplete";
+ }
+ }
+ }
+ this._rawPrevTime = (this._duration || !suppressEvents || time || this._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
+ if (this._yoyo && (this._cycle & 1) !== 0) {
+ this._time = time = 0;
+ } else {
+ this._time = dur;
+ time = dur + 0.0001; //to avoid occasional floating point rounding errors - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when _time - tween._startTime is performed, floating point errors would return a value that was SLIGHTLY off). Try (999999999999.7 - 999999999999) * 1 = 0.699951171875 instead of 0.7. We cannot do less then 0.0001 because the same issue can occur when the duration is extremely large like 999999999999 in which case adding 0.00000001, for example, causes it to act like nothing was added.
+ }
+
+ } else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0.
+ if (!this._locked) {
+ this._totalTime = this._cycle = 0;
+ }
+ this._time = 0;
+ if (prevTime !== 0 || (dur === 0 && prevRawPrevTime !== _tinyNum && (prevRawPrevTime > 0 || (time < 0 && prevRawPrevTime >= 0)) && !this._locked)) { //edge case for checking time < 0 && prevRawPrevTime >= 0: a zero-duration fromTo() tween inside a zero-duration timeline (yeah, very rare)
+ callback = "onReverseComplete";
+ isComplete = this._reversed;
+ }
+ if (time < 0) {
+ this._active = false;
+ if (dur === 0) if (prevRawPrevTime >= 0 && this._first) { //zero-duration timelines are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
+ internalForce = true;
+ }
+ this._rawPrevTime = time;
+ } else {
+ this._rawPrevTime = (dur || !suppressEvents || time || this._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
+ time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline)
+ if (!this._initted) {
+ internalForce = true;
+ }
+ }
+
+ } else {
+ if (dur === 0 && prevRawPrevTime < 0) { //without this, zero-duration repeating timelines (like with a simple callback nested at the very beginning and a repeatDelay) wouldn't render the first time through.
+ internalForce = true;
+ }
+ this._time = this._rawPrevTime = time;
+ if (!this._locked) {
+ this._totalTime = time;
+ if (this._repeat !== 0) {
+ cycleDuration = dur + this._repeatDelay;
+ this._cycle = (this._totalTime / cycleDuration) >> 0; //originally _totalTime % cycleDuration but floating point errors caused problems, so I normalized it. (4 % 0.8 should be 0 but it gets reported as 0.79999999!)
+ if (this._cycle !== 0) if (this._cycle === this._totalTime / cycleDuration) {
+ this._cycle--; //otherwise when rendered exactly at the end time, it will act as though it is repeating (at the beginning)
+ }
+ this._time = this._totalTime - (this._cycle * cycleDuration);
+ if (this._yoyo) if ((this._cycle & 1) !== 0) {
+ this._time = dur - this._time;
+ }
+ if (this._time > dur) {
+ this._time = dur;
+ time = dur + 0.0001; //to avoid occasional floating point rounding error
+ } else if (this._time < 0) {
+ this._time = time = 0;
+ } else {
+ time = this._time;
+ }
+ }
+ }
+ }
+
+ if (this._cycle !== prevCycle) if (!this._locked) {
+ /*
+ make sure children at the end/beginning of the timeline are rendered properly. If, for example,
+ a 3-second long timeline rendered at 2.9 seconds previously, and now renders at 3.2 seconds (which
+ would get transated to 2.8 seconds if the timeline yoyos or 0.2 seconds if it just repeats), there
+ could be a callback or a short tween that's at 2.95 or 3 seconds in which wouldn't render. So
+ we need to push the timeline to the end (and/or beginning depending on its yoyo value). Also we must
+ ensure that zero-duration tweens at the very beginning or end of the TimelineMax work.
+ */
+ var backwards = (this._yoyo && (prevCycle & 1) !== 0),
+ wrap = (backwards === (this._yoyo && (this._cycle & 1) !== 0)),
+ recTotalTime = this._totalTime,
+ recCycle = this._cycle,
+ recRawPrevTime = this._rawPrevTime,
+ recTime = this._time;
+
+ this._totalTime = prevCycle * dur;
+ if (this._cycle < prevCycle) {
+ backwards = !backwards;
+ } else {
+ this._totalTime += dur;
+ }
+ this._time = prevTime; //temporarily revert _time so that render() renders the children in the correct order. Without this, tweens won't rewind correctly. We could arhictect things in a "cleaner" way by splitting out the rendering queue into a separate method but for performance reasons, we kept it all inside this method.
+
+ this._rawPrevTime = (dur === 0) ? prevRawPrevTime - 0.0001 : prevRawPrevTime;
+ this._cycle = prevCycle;
+ this._locked = true; //prevents changes to totalTime and skips repeat/yoyo behavior when we recursively call render()
+ prevTime = (backwards) ? 0 : dur;
+ this.render(prevTime, suppressEvents, (dur === 0));
+ if (!suppressEvents) if (!this._gc) {
+ if (this.vars.onRepeat) {
+ this.vars.onRepeat.apply(this.vars.onRepeatScope || this, this.vars.onRepeatParams || _blankArray);
+ }
+ }
+ if (wrap) {
+ prevTime = (backwards) ? dur + 0.0001 : -0.0001;
+ this.render(prevTime, true, false);
+ }
+ this._locked = false;
+ if (this._paused && !prevPaused) { //if the render() triggered callback that paused this timeline, we should abort (very rare, but possible)
+ return;
+ }
+ this._time = recTime;
+ this._totalTime = recTotalTime;
+ this._cycle = recCycle;
+ this._rawPrevTime = recRawPrevTime;
+ }
+
+ if ((this._time === prevTime || !this._first) && !force && !internalForce) {
+ if (prevTotalTime !== this._totalTime) if (this._onUpdate) if (!suppressEvents) { //so that onUpdate fires even during the repeatDelay - as long as the totalTime changed, we should trigger onUpdate.
+ this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
+ }
+ return;
+ } else if (!this._initted) {
+ this._initted = true;
+ }
+
+ if (!this._active) if (!this._paused && this._totalTime !== prevTotalTime && time > 0) {
+ this._active = true; //so that if the user renders the timeline (as opposed to the parent timeline rendering it), it is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the timeline already finished but the user manually re-renders it as halfway done, for example.
+ }
+
+ if (prevTotalTime === 0) if (this.vars.onStart) if (this._totalTime !== 0) if (!suppressEvents) {
+ this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
+ }
+
+ if (this._time >= prevTime) {
+ tween = this._first;
+ while (tween) {
+ next = tween._next; //record it here because the value could change after rendering...
+ if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
+ break;
+ } else if (tween._active || (tween._startTime <= this._time && !tween._paused && !tween._gc)) {
+ if (!tween._reversed) {
+ tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
+ } else {
+ tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
+ }
+
+ }
+ tween = next;
+ }
+ } else {
+ tween = this._last;
+ while (tween) {
+ next = tween._prev; //record it here because the value could change after rendering...
+ if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
+ break;
+ } else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) {
+ if (!tween._reversed) {
+ tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
+ } else {
+ tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
+ }
+ }
+ tween = next;
+ }
+ }
+
+ if (this._onUpdate) if (!suppressEvents) {
+ this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
+ }
+ if (callback) if (!this._locked) if (!this._gc) if (prevStart === this._startTime || prevTimeScale !== this._timeScale) if (this._time === 0 || totalDur >= this.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate
+ if (isComplete) {
+ if (this._timeline.autoRemoveChildren) {
+ this._enabled(false, false);
+ }
+ this._active = false;
+ }
+ if (!suppressEvents && this.vars[callback]) {
+ this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray);
+ }
+ }
+ };
+
+ p.getActive = function(nested, tweens, timelines) {
+ if (nested == null) {
+ nested = true;
+ }
+ if (tweens == null) {
+ tweens = true;
+ }
+ if (timelines == null) {
+ timelines = false;
+ }
+ var a = [],
+ all = this.getChildren(nested, tweens, timelines),
+ cnt = 0,
+ l = all.length,
+ i, tween;
+ for (i = 0; i < l; i++) {
+ tween = all[i];
+ if (tween.isActive()) {
+ a[cnt++] = tween;
+ }
+ }
+ return a;
+ };
+
+
+ p.getLabelAfter = function(time) {
+ if (!time) if (time !== 0) { //faster than isNan()
+ time = this._time;
+ }
+ var labels = this.getLabelsArray(),
+ l = labels.length,
+ i;
+ for (i = 0; i < l; i++) {
+ if (labels[i].time > time) {
+ return labels[i].name;
+ }
+ }
+ return null;
+ };
+
+ p.getLabelBefore = function(time) {
+ if (time == null) {
+ time = this._time;
+ }
+ var labels = this.getLabelsArray(),
+ i = labels.length;
+ while (--i > -1) {
+ if (labels[i].time < time) {
+ return labels[i].name;
+ }
+ }
+ return null;
+ };
+
+ p.getLabelsArray = function() {
+ var a = [],
+ cnt = 0,
+ p;
+ for (p in this._labels) {
+ a[cnt++] = {time:this._labels[p], name:p};
+ }
+ a.sort(function(a,b) {
+ return a.time - b.time;
+ });
+ return a;
+ };
+
+
+//---- GETTERS / SETTERS -------------------------------------------------------------------------------------------------------
+
+ p.progress = function(value) {
+ return (!arguments.length) ? this._time / this.duration() : this.totalTime( this.duration() * ((this._yoyo && (this._cycle & 1) !== 0) ? 1 - value : value) + (this._cycle * (this._duration + this._repeatDelay)), false);
+ };
+
+ p.totalProgress = function(value) {
+ return (!arguments.length) ? this._totalTime / this.totalDuration() : this.totalTime( this.totalDuration() * value, false);
+ };
+
+ p.totalDuration = function(value) {
+ if (!arguments.length) {
+ if (this._dirty) {
+ TimelineLite.prototype.totalDuration.call(this); //just forces refresh
+ //Instead of Infinity, we use 999999999999 so that we can accommodate reverses.
+ this._totalDuration = (this._repeat === -1) ? 999999999999 : this._duration * (this._repeat + 1) + (this._repeatDelay * this._repeat);
+ }
+ return this._totalDuration;
+ }
+ return (this._repeat === -1) ? this : this.duration( (value - (this._repeat * this._repeatDelay)) / (this._repeat + 1) );
+ };
+
+ p.time = function(value, suppressEvents) {
+ if (!arguments.length) {
+ return this._time;
+ }
+ if (this._dirty) {
+ this.totalDuration();
+ }
+ if (value > this._duration) {
+ value = this._duration;
+ }
+ if (this._yoyo && (this._cycle & 1) !== 0) {
+ value = (this._duration - value) + (this._cycle * (this._duration + this._repeatDelay));
+ } else if (this._repeat !== 0) {
+ value += this._cycle * (this._duration + this._repeatDelay);
+ }
+ return this.totalTime(value, suppressEvents);
+ };
+
+ p.repeat = function(value) {
+ if (!arguments.length) {
+ return this._repeat;
+ }
+ this._repeat = value;
+ return this._uncache(true);
+ };
+
+ p.repeatDelay = function(value) {
+ if (!arguments.length) {
+ return this._repeatDelay;
+ }
+ this._repeatDelay = value;
+ return this._uncache(true);
+ };
+
+ p.yoyo = function(value) {
+ if (!arguments.length) {
+ return this._yoyo;
+ }
+ this._yoyo = value;
+ return this;
+ };
+
+ p.currentLabel = function(value) {
+ if (!arguments.length) {
+ return this.getLabelBefore(this._time + 0.00000001);
+ }
+ return this.seek(value, true);
+ };
+
+ return TimelineMax;
+
+ }, true);
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * ----------------------------------------------------------------
+ * BezierPlugin
+ * ----------------------------------------------------------------
+ */
+ (function() {
+
+ var _RAD2DEG = 180 / Math.PI,
+ _r1 = [],
+ _r2 = [],
+ _r3 = [],
+ _corProps = {},
+ Segment = function(a, b, c, d) {
+ this.a = a;
+ this.b = b;
+ this.c = c;
+ this.d = d;
+ this.da = d - a;
+ this.ca = c - a;
+ this.ba = b - a;
+ },
+ _correlate = ",x,y,z,left,top,right,bottom,marginTop,marginLeft,marginRight,marginBottom,paddingLeft,paddingTop,paddingRight,paddingBottom,backgroundPosition,backgroundPosition_y,",
+ cubicToQuadratic = function(a, b, c, d) {
+ var q1 = {a:a},
+ q2 = {},
+ q3 = {},
+ q4 = {c:d},
+ mab = (a + b) / 2,
+ mbc = (b + c) / 2,
+ mcd = (c + d) / 2,
+ mabc = (mab + mbc) / 2,
+ mbcd = (mbc + mcd) / 2,
+ m8 = (mbcd - mabc) / 8;
+ q1.b = mab + (a - mab) / 4;
+ q2.b = mabc + m8;
+ q1.c = q2.a = (q1.b + q2.b) / 2;
+ q2.c = q3.a = (mabc + mbcd) / 2;
+ q3.b = mbcd - m8;
+ q4.b = mcd + (d - mcd) / 4;
+ q3.c = q4.a = (q3.b + q4.b) / 2;
+ return [q1, q2, q3, q4];
+ },
+ _calculateControlPoints = function(a, curviness, quad, basic, correlate) {
+ var l = a.length - 1,
+ ii = 0,
+ cp1 = a[0].a,
+ i, p1, p2, p3, seg, m1, m2, mm, cp2, qb, r1, r2, tl;
+ for (i = 0; i < l; i++) {
+ seg = a[ii];
+ p1 = seg.a;
+ p2 = seg.d;
+ p3 = a[ii+1].d;
+
+ if (correlate) {
+ r1 = _r1[i];
+ r2 = _r2[i];
+ tl = ((r2 + r1) * curviness * 0.25) / (basic ? 0.5 : _r3[i] || 0.5);
+ m1 = p2 - (p2 - p1) * (basic ? curviness * 0.5 : (r1 !== 0 ? tl / r1 : 0));
+ m2 = p2 + (p3 - p2) * (basic ? curviness * 0.5 : (r2 !== 0 ? tl / r2 : 0));
+ mm = p2 - (m1 + (((m2 - m1) * ((r1 * 3 / (r1 + r2)) + 0.5) / 4) || 0));
+ } else {
+ m1 = p2 - (p2 - p1) * curviness * 0.5;
+ m2 = p2 + (p3 - p2) * curviness * 0.5;
+ mm = p2 - (m1 + m2) / 2;
+ }
+ m1 += mm;
+ m2 += mm;
+
+ seg.c = cp2 = m1;
+ if (i !== 0) {
+ seg.b = cp1;
+ } else {
+ seg.b = cp1 = seg.a + (seg.c - seg.a) * 0.6; //instead of placing b on a exactly, we move it inline with c so that if the user specifies an ease like Back.easeIn or Elastic.easeIn which goes BEYOND the beginning, it will do so smoothly.
+ }
+
+ seg.da = p2 - p1;
+ seg.ca = cp2 - p1;
+ seg.ba = cp1 - p1;
+
+ if (quad) {
+ qb = cubicToQuadratic(p1, cp1, cp2, p2);
+ a.splice(ii, 1, qb[0], qb[1], qb[2], qb[3]);
+ ii += 4;
+ } else {
+ ii++;
+ }
+
+ cp1 = m2;
+ }
+ seg = a[ii];
+ seg.b = cp1;
+ seg.c = cp1 + (seg.d - cp1) * 0.4; //instead of placing c on d exactly, we move it inline with b so that if the user specifies an ease like Back.easeOut or Elastic.easeOut which goes BEYOND the end, it will do so smoothly.
+ seg.da = seg.d - seg.a;
+ seg.ca = seg.c - seg.a;
+ seg.ba = cp1 - seg.a;
+ if (quad) {
+ qb = cubicToQuadratic(seg.a, cp1, seg.c, seg.d);
+ a.splice(ii, 1, qb[0], qb[1], qb[2], qb[3]);
+ }
+ },
+ _parseAnchors = function(values, p, correlate, prepend) {
+ var a = [],
+ l, i, p1, p2, p3, tmp;
+ if (prepend) {
+ values = [prepend].concat(values);
+ i = values.length;
+ while (--i > -1) {
+ if (typeof( (tmp = values[i][p]) ) === "string") if (tmp.charAt(1) === "=") {
+ values[i][p] = prepend[p] + Number(tmp.charAt(0) + tmp.substr(2)); //accommodate relative values. Do it inline instead of breaking it out into a function for speed reasons
+ }
+ }
+ }
+ l = values.length - 2;
+ if (l < 0) {
+ a[0] = new Segment(values[0][p], 0, 0, values[(l < -1) ? 0 : 1][p]);
+ return a;
+ }
+ for (i = 0; i < l; i++) {
+ p1 = values[i][p];
+ p2 = values[i+1][p];
+ a[i] = new Segment(p1, 0, 0, p2);
+ if (correlate) {
+ p3 = values[i+2][p];
+ _r1[i] = (_r1[i] || 0) + (p2 - p1) * (p2 - p1);
+ _r2[i] = (_r2[i] || 0) + (p3 - p2) * (p3 - p2);
+ }
+ }
+ a[i] = new Segment(values[i][p], 0, 0, values[i+1][p]);
+ return a;
+ },
+ bezierThrough = function(values, curviness, quadratic, basic, correlate, prepend) {
+ var obj = {},
+ props = [],
+ first = prepend || values[0],
+ i, p, a, j, r, l, seamless, last;
+ correlate = (typeof(correlate) === "string") ? ","+correlate+"," : _correlate;
+ if (curviness == null) {
+ curviness = 1;
+ }
+ for (p in values[0]) {
+ props.push(p);
+ }
+ //check to see if the last and first values are identical (well, within 0.05). If so, make seamless by appending the second element to the very end of the values array and the 2nd-to-last element to the very beginning (we'll remove those segments later)
+ if (values.length > 1) {
+ last = values[values.length - 1];
+ seamless = true;
+ i = props.length;
+ while (--i > -1) {
+ p = props[i];
+ if (Math.abs(first[p] - last[p]) > 0.05) { //build in a tolerance of +/-0.05 to accommodate rounding errors. For example, if you set an object's position to 4.945, Flash will make it 4.9
+ seamless = false;
+ break;
+ }
+ }
+ if (seamless) {
+ values = values.concat(); //duplicate the array to avoid contaminating the original which the user may be reusing for other tweens
+ if (prepend) {
+ values.unshift(prepend);
+ }
+ values.push(values[1]);
+ prepend = values[values.length - 3];
+ }
+ }
+ _r1.length = _r2.length = _r3.length = 0;
+ i = props.length;
+ while (--i > -1) {
+ p = props[i];
+ _corProps[p] = (correlate.indexOf(","+p+",") !== -1);
+ obj[p] = _parseAnchors(values, p, _corProps[p], prepend);
+ }
+ i = _r1.length;
+ while (--i > -1) {
+ _r1[i] = Math.sqrt(_r1[i]);
+ _r2[i] = Math.sqrt(_r2[i]);
+ }
+ if (!basic) {
+ i = props.length;
+ while (--i > -1) {
+ if (_corProps[p]) {
+ a = obj[props[i]];
+ l = a.length - 1;
+ for (j = 0; j < l; j++) {
+ r = a[j+1].da / _r2[j] + a[j].da / _r1[j];
+ _r3[j] = (_r3[j] || 0) + r * r;
+ }
+ }
+ }
+ i = _r3.length;
+ while (--i > -1) {
+ _r3[i] = Math.sqrt(_r3[i]);
+ }
+ }
+ i = props.length;
+ j = quadratic ? 4 : 1;
+ while (--i > -1) {
+ p = props[i];
+ a = obj[p];
+ _calculateControlPoints(a, curviness, quadratic, basic, _corProps[p]); //this method requires that _parseAnchors() and _setSegmentRatios() ran first so that _r1, _r2, and _r3 values are populated for all properties
+ if (seamless) {
+ a.splice(0, j);
+ a.splice(a.length - j, j);
+ }
+ }
+ return obj;
+ },
+ _parseBezierData = function(values, type, prepend) {
+ type = type || "soft";
+ var obj = {},
+ inc = (type === "cubic") ? 3 : 2,
+ soft = (type === "soft"),
+ props = [],
+ a, b, c, d, cur, i, j, l, p, cnt, tmp;
+ if (soft && prepend) {
+ values = [prepend].concat(values);
+ }
+ if (values == null || values.length < inc + 1) { throw "invalid Bezier data"; }
+ for (p in values[0]) {
+ props.push(p);
+ }
+ i = props.length;
+ while (--i > -1) {
+ p = props[i];
+ obj[p] = cur = [];
+ cnt = 0;
+ l = values.length;
+ for (j = 0; j < l; j++) {
+ a = (prepend == null) ? values[j][p] : (typeof( (tmp = values[j][p]) ) === "string" && tmp.charAt(1) === "=") ? prepend[p] + Number(tmp.charAt(0) + tmp.substr(2)) : Number(tmp);
+ if (soft) if (j > 1) if (j < l - 1) {
+ cur[cnt++] = (a + cur[cnt-2]) / 2;
+ }
+ cur[cnt++] = a;
+ }
+ l = cnt - inc + 1;
+ cnt = 0;
+ for (j = 0; j < l; j += inc) {
+ a = cur[j];
+ b = cur[j+1];
+ c = cur[j+2];
+ d = (inc === 2) ? 0 : cur[j+3];
+ cur[cnt++] = tmp = (inc === 3) ? new Segment(a, b, c, d) : new Segment(a, (2 * b + a) / 3, (2 * b + c) / 3, c);
+ }
+ cur.length = cnt;
+ }
+ return obj;
+ },
+ _addCubicLengths = function(a, steps, resolution) {
+ var inc = 1 / resolution,
+ j = a.length,
+ d, d1, s, da, ca, ba, p, i, inv, bez, index;
+ while (--j > -1) {
+ bez = a[j];
+ s = bez.a;
+ da = bez.d - s;
+ ca = bez.c - s;
+ ba = bez.b - s;
+ d = d1 = 0;
+ for (i = 1; i <= resolution; i++) {
+ p = inc * i;
+ inv = 1 - p;
+ d = d1 - (d1 = (p * p * da + 3 * inv * (p * ca + inv * ba)) * p);
+ index = j * resolution + i - 1;
+ steps[index] = (steps[index] || 0) + d * d;
+ }
+ }
+ },
+ _parseLengthData = function(obj, resolution) {
+ resolution = resolution >> 0 || 6;
+ var a = [],
+ lengths = [],
+ d = 0,
+ total = 0,
+ threshold = resolution - 1,
+ segments = [],
+ curLS = [], //current length segments array
+ p, i, l, index;
+ for (p in obj) {
+ _addCubicLengths(obj[p], a, resolution);
+ }
+ l = a.length;
+ for (i = 0; i < l; i++) {
+ d += Math.sqrt(a[i]);
+ index = i % resolution;
+ curLS[index] = d;
+ if (index === threshold) {
+ total += d;
+ index = (i / resolution) >> 0;
+ segments[index] = curLS;
+ lengths[index] = total;
+ d = 0;
+ curLS = [];
+ }
+ }
+ return {length:total, lengths:lengths, segments:segments};
+ },
+
+
+
+ BezierPlugin = window._gsDefine.plugin({
+ propName: "bezier",
+ priority: -1,
+ version: "1.3.2",
+ API: 2,
+ global:true,
+
+ //gets called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
+ init: function(target, vars, tween) {
+ this._target = target;
+ if (vars instanceof Array) {
+ vars = {values:vars};
+ }
+ this._func = {};
+ this._round = {};
+ this._props = [];
+ this._timeRes = (vars.timeResolution == null) ? 6 : parseInt(vars.timeResolution, 10);
+ var values = vars.values || [],
+ first = {},
+ second = values[0],
+ autoRotate = vars.autoRotate || tween.vars.orientToBezier,
+ p, isFunc, i, j, prepend;
+
+ this._autoRotate = autoRotate ? (autoRotate instanceof Array) ? autoRotate : [["x","y","rotation",((autoRotate === true) ? 0 : Number(autoRotate) || 0)]] : null;
+ for (p in second) {
+ this._props.push(p);
+ }
+
+ i = this._props.length;
+ while (--i > -1) {
+ p = this._props[i];
+
+ this._overwriteProps.push(p);
+ isFunc = this._func[p] = (typeof(target[p]) === "function");
+ first[p] = (!isFunc) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]();
+ if (!prepend) if (first[p] !== values[0][p]) {
+ prepend = first;
+ }
+ }
+ this._beziers = (vars.type !== "cubic" && vars.type !== "quadratic" && vars.type !== "soft") ? bezierThrough(values, isNaN(vars.curviness) ? 1 : vars.curviness, false, (vars.type === "thruBasic"), vars.correlate, prepend) : _parseBezierData(values, vars.type, first);
+ this._segCount = this._beziers[p].length;
+
+ if (this._timeRes) {
+ var ld = _parseLengthData(this._beziers, this._timeRes);
+ this._length = ld.length;
+ this._lengths = ld.lengths;
+ this._segments = ld.segments;
+ this._l1 = this._li = this._s1 = this._si = 0;
+ this._l2 = this._lengths[0];
+ this._curSeg = this._segments[0];
+ this._s2 = this._curSeg[0];
+ this._prec = 1 / this._curSeg.length;
+ }
+
+ if ((autoRotate = this._autoRotate)) {
+ this._initialRotations = [];
+ if (!(autoRotate[0] instanceof Array)) {
+ this._autoRotate = autoRotate = [autoRotate];
+ }
+ i = autoRotate.length;
+ while (--i > -1) {
+ for (j = 0; j < 3; j++) {
+ p = autoRotate[i][j];
+ this._func[p] = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ] : false;
+ }
+ p = autoRotate[i][2];
+ this._initialRotations[i] = this._func[p] ? this._func[p].call(this._target) : this._target[p];
+ }
+ }
+ this._startRatio = tween.vars.runBackwards ? 1 : 0; //we determine the starting ratio when the tween inits which is always 0 unless the tween has runBackwards:true (indicating it's a from() tween) in which case it's 1.
+ return true;
+ },
+
+ //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.)
+ set: function(v) {
+ var segments = this._segCount,
+ func = this._func,
+ target = this._target,
+ notStart = (v !== this._startRatio),
+ curIndex, inv, i, p, b, t, val, l, lengths, curSeg;
+ if (!this._timeRes) {
+ curIndex = (v < 0) ? 0 : (v >= 1) ? segments - 1 : (segments * v) >> 0;
+ t = (v - (curIndex * (1 / segments))) * segments;
+ } else {
+ lengths = this._lengths;
+ curSeg = this._curSeg;
+ v *= this._length;
+ i = this._li;
+ //find the appropriate segment (if the currently cached one isn't correct)
+ if (v > this._l2 && i < segments - 1) {
+ l = segments - 1;
+ while (i < l && (this._l2 = lengths[++i]) <= v) { }
+ this._l1 = lengths[i-1];
+ this._li = i;
+ this._curSeg = curSeg = this._segments[i];
+ this._s2 = curSeg[(this._s1 = this._si = 0)];
+ } else if (v < this._l1 && i > 0) {
+ while (i > 0 && (this._l1 = lengths[--i]) >= v) { }
+ if (i === 0 && v < this._l1) {
+ this._l1 = 0;
+ } else {
+ i++;
+ }
+ this._l2 = lengths[i];
+ this._li = i;
+ this._curSeg = curSeg = this._segments[i];
+ this._s1 = curSeg[(this._si = curSeg.length - 1) - 1] || 0;
+ this._s2 = curSeg[this._si];
+ }
+ curIndex = i;
+ //now find the appropriate sub-segment (we split it into the number of pieces that was defined by "precision" and measured each one)
+ v -= this._l1;
+ i = this._si;
+ if (v > this._s2 && i < curSeg.length - 1) {
+ l = curSeg.length - 1;
+ while (i < l && (this._s2 = curSeg[++i]) <= v) { }
+ this._s1 = curSeg[i-1];
+ this._si = i;
+ } else if (v < this._s1 && i > 0) {
+ while (i > 0 && (this._s1 = curSeg[--i]) >= v) { }
+ if (i === 0 && v < this._s1) {
+ this._s1 = 0;
+ } else {
+ i++;
+ }
+ this._s2 = curSeg[i];
+ this._si = i;
+ }
+ t = (i + (v - this._s1) / (this._s2 - this._s1)) * this._prec;
+ }
+ inv = 1 - t;
+
+ i = this._props.length;
+ while (--i > -1) {
+ p = this._props[i];
+ b = this._beziers[p][curIndex];
+ val = (t * t * b.da + 3 * inv * (t * b.ca + inv * b.ba)) * t + b.a;
+ if (this._round[p]) {
+ val = Math.round(val);
+ }
+ if (func[p]) {
+ target[p](val);
+ } else {
+ target[p] = val;
+ }
+ }
+
+ if (this._autoRotate) {
+ var ar = this._autoRotate,
+ b2, x1, y1, x2, y2, add, conv;
+ i = ar.length;
+ while (--i > -1) {
+ p = ar[i][2];
+ add = ar[i][3] || 0;
+ conv = (ar[i][4] === true) ? 1 : _RAD2DEG;
+ b = this._beziers[ar[i][0]];
+ b2 = this._beziers[ar[i][1]];
+
+ if (b && b2) { //in case one of the properties got overwritten.
+ b = b[curIndex];
+ b2 = b2[curIndex];
+
+ x1 = b.a + (b.b - b.a) * t;
+ x2 = b.b + (b.c - b.b) * t;
+ x1 += (x2 - x1) * t;
+ x2 += ((b.c + (b.d - b.c) * t) - x2) * t;
+
+ y1 = b2.a + (b2.b - b2.a) * t;
+ y2 = b2.b + (b2.c - b2.b) * t;
+ y1 += (y2 - y1) * t;
+ y2 += ((b2.c + (b2.d - b2.c) * t) - y2) * t;
+
+ val = notStart ? Math.atan2(y2 - y1, x2 - x1) * conv + add : this._initialRotations[i];
+
+ if (func[p]) {
+ target[p](val);
+ } else {
+ target[p] = val;
+ }
+ }
+ }
+ }
+ }
+ }),
+ p = BezierPlugin.prototype;
+
+
+ BezierPlugin.bezierThrough = bezierThrough;
+ BezierPlugin.cubicToQuadratic = cubicToQuadratic;
+ BezierPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite
+ BezierPlugin.quadraticToCubic = function(a, b, c) {
+ return new Segment(a, (2 * b + a) / 3, (2 * b + c) / 3, c);
+ };
+
+ BezierPlugin._cssRegister = function() {
+ var CSSPlugin = window._gsDefine.globals.CSSPlugin;
+ if (!CSSPlugin) {
+ return;
+ }
+ var _internals = CSSPlugin._internals,
+ _parseToProxy = _internals._parseToProxy,
+ _setPluginRatio = _internals._setPluginRatio,
+ CSSPropTween = _internals.CSSPropTween;
+ _internals._registerComplexSpecialProp("bezier", {parser:function(t, e, prop, cssp, pt, plugin) {
+ if (e instanceof Array) {
+ e = {values:e};
+ }
+ plugin = new BezierPlugin();
+ var values = e.values,
+ l = values.length - 1,
+ pluginValues = [],
+ v = {},
+ i, p, data;
+ if (l < 0) {
+ return pt;
+ }
+ for (i = 0; i <= l; i++) {
+ data = _parseToProxy(t, values[i], cssp, pt, plugin, (l !== i));
+ pluginValues[i] = data.end;
+ }
+ for (p in e) {
+ v[p] = e[p]; //duplicate the vars object because we need to alter some things which would cause problems if the user plans to reuse the same vars object for another tween.
+ }
+ v.values = pluginValues;
+ pt = new CSSPropTween(t, "bezier", 0, 0, data.pt, 2);
+ pt.data = data;
+ pt.plugin = plugin;
+ pt.setRatio = _setPluginRatio;
+ if (v.autoRotate === 0) {
+ v.autoRotate = true;
+ }
+ if (v.autoRotate && !(v.autoRotate instanceof Array)) {
+ i = (v.autoRotate === true) ? 0 : Number(v.autoRotate);
+ v.autoRotate = (data.end.left != null) ? [["left","top","rotation",i,false]] : (data.end.x != null) ? [["x","y","rotation",i,false]] : false;
+ }
+ if (v.autoRotate) {
+ if (!cssp._transform) {
+ cssp._enableTransforms(false);
+ }
+ data.autoRotate = cssp._target._gsTransform;
+ }
+ plugin._onInitTween(data.proxy, v, cssp._tween);
+ return pt;
+ }});
+ };
+
+ p._roundProps = function(lookup, value) {
+ var op = this._overwriteProps,
+ i = op.length;
+ while (--i > -1) {
+ if (lookup[op[i]] || lookup.bezier || lookup.bezierThrough) {
+ this._round[op[i]] = value;
+ }
+ }
+ };
+
+ p._kill = function(lookup) {
+ var a = this._props,
+ p, i;
+ for (p in this._beziers) {
+ if (p in lookup) {
+ delete this._beziers[p];
+ delete this._func[p];
+ i = a.length;
+ while (--i > -1) {
+ if (a[i] === p) {
+ a.splice(i, 1);
+ }
+ }
+ }
+ }
+ return this._super._kill.call(this, lookup);
+ };
+
+ }());
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * ----------------------------------------------------------------
+ * CSSPlugin
+ * ----------------------------------------------------------------
+ */
+ window._gsDefine("plugins.CSSPlugin", ["plugins.TweenPlugin","TweenLite"], function(TweenPlugin, TweenLite) {
+
+ /** @constructor **/
+ var CSSPlugin = function() {
+ TweenPlugin.call(this, "css");
+ this._overwriteProps.length = 0;
+ this.setRatio = CSSPlugin.prototype.setRatio; //speed optimization (avoid prototype lookup on this "hot" method)
+ },
+ _hasPriority, //turns true whenever a CSSPropTween instance is created that has a priority other than 0. This helps us discern whether or not we should spend the time organizing the linked list or not after a CSSPlugin's _onInitTween() method is called.
+ _suffixMap, //we set this in _onInitTween() each time as a way to have a persistent variable we can use in other methods like _parse() without having to pass it around as a parameter and we keep _parse() decoupled from a particular CSSPlugin instance
+ _cs, //computed style (we store this in a shared variable to conserve memory and make minification tighter
+ _overwriteProps, //alias to the currently instantiating CSSPlugin's _overwriteProps array. We use this closure in order to avoid having to pass a reference around from method to method and aid in minification.
+ _specialProps = {},
+ p = CSSPlugin.prototype = new TweenPlugin("css");
+
+ p.constructor = CSSPlugin;
+ CSSPlugin.version = "1.12.1";
+ CSSPlugin.API = 2;
+ CSSPlugin.defaultTransformPerspective = 0;
+ CSSPlugin.defaultSkewType = "compensated";
+ p = "px"; //we'll reuse the "p" variable to keep file size down
+ CSSPlugin.suffixMap = {top:p, right:p, bottom:p, left:p, width:p, height:p, fontSize:p, padding:p, margin:p, perspective:p, lineHeight:""};
+
+
+ var _numExp = /(?:\d|\-\d|\.\d|\-\.\d)+/g,
+ _relNumExp = /(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,
+ _valuesExp = /(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi, //finds all the values that begin with numbers or += or -= and then a number. Includes suffixes. We use this to split complex values apart like "1px 5px 20px rgb(255,102,51)"
+ _NaNExp = /[^\d\-\.]/g,
+ _suffixExp = /(?:\d|\-|\+|=|#|\.)*/g,
+ _opacityExp = /opacity *= *([^)]*)/i,
+ _opacityValExp = /opacity:([^;]*)/i,
+ _alphaFilterExp = /alpha\(opacity *=.+?\)/i,
+ _rgbhslExp = /^(rgb|hsl)/,
+ _capsExp = /([A-Z])/g,
+ _camelExp = /-([a-z])/gi,
+ _urlExp = /(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi, //for pulling out urls from url(...) or url("...") strings (some browsers wrap urls in quotes, some don't when reporting things like backgroundImage)
+ _camelFunc = function(s, g) { return g.toUpperCase(); },
+ _horizExp = /(?:Left|Right|Width)/i,
+ _ieGetMatrixExp = /(M11|M12|M21|M22)=[\d\-\.e]+/gi,
+ _ieSetMatrixExp = /progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,
+ _commasOutsideParenExp = /,(?=[^\)]*(?:\(|$))/gi, //finds any commas that are not within parenthesis
+ _DEG2RAD = Math.PI / 180,
+ _RAD2DEG = 180 / Math.PI,
+ _forcePT = {},
+ _doc = document,
+ _tempDiv = _doc.createElement("div"),
+ _tempImg = _doc.createElement("img"),
+ _internals = CSSPlugin._internals = {_specialProps:_specialProps}, //provides a hook to a few internal methods that we need to access from inside other plugins
+ _agent = navigator.userAgent,
+ _autoRound,
+ _reqSafariFix, //we won't apply the Safari transform fix until we actually come across a tween that affects a transform property (to maintain best performance).
+
+ _isSafari,
+ _isFirefox, //Firefox has a bug that causes 3D transformed elements to randomly disappear unless a repaint is forced after each update on each element.
+ _isSafariLT6, //Safari (and Android 4 which uses a flavor of Safari) has a bug that prevents changes to "top" and "left" properties from rendering properly if changed on the same frame as a transform UNLESS we set the element's WebkitBackfaceVisibility to hidden (weird, I know). Doing this for Android 3 and earlier seems to actually cause other problems, though (fun!)
+ _ieVers,
+ _supportsOpacity = (function() { //we set _isSafari, _ieVers, _isFirefox, and _supportsOpacity all in one function here to reduce file size slightly, especially in the minified version.
+ var i = _agent.indexOf("Android"),
+ d = _doc.createElement("div"), a;
+
+ _isSafari = (_agent.indexOf("Safari") !== -1 && _agent.indexOf("Chrome") === -1 && (i === -1 || Number(_agent.substr(i+8, 1)) > 3));
+ _isSafariLT6 = (_isSafari && (Number(_agent.substr(_agent.indexOf("Version/")+8, 1)) < 6));
+ _isFirefox = (_agent.indexOf("Firefox") !== -1);
+
+ if ((/MSIE ([0-9]{1,}[\.0-9]{0,})/).exec(_agent)) {
+ _ieVers = parseFloat( RegExp.$1 );
+ }
+
+ d.innerHTML = "<a style='top:1px;opacity:.55;'>a</a>";
+ a = d.getElementsByTagName("a")[0];
+ return a ? /^0.55/.test(a.style.opacity) : false;
+ }()),
+ _getIEOpacity = function(v) {
+ return (_opacityExp.test( ((typeof(v) === "string") ? v : (v.currentStyle ? v.currentStyle.filter : v.style.filter) || "") ) ? ( parseFloat( RegExp.$1 ) / 100 ) : 1);
+ },
+ _log = function(s) {//for logging messages, but in a way that won't throw errors in old versions of IE.
+ if (window.console) {
+ //console.log(s);
+ }
+ },
+ _prefixCSS = "", //the non-camelCase vendor prefix like "-o-", "-moz-", "-ms-", or "-webkit-"
+ _prefix = "", //camelCase vendor prefix like "O", "ms", "Webkit", or "Moz".
+
+ // @private feed in a camelCase property name like "transform" and it will check to see if it is valid as-is or if it needs a vendor prefix. It returns the corrected camelCase property name (i.e. "WebkitTransform" or "MozTransform" or "transform" or null if no such property is found, like if the browser is IE8 or before, "transform" won't be found at all)
+ _checkPropPrefix = function(p, e) {
+ e = e || _tempDiv;
+ var s = e.style,
+ a, i;
+ if (s[p] !== undefined) {
+ return p;
+ }
+ p = p.charAt(0).toUpperCase() + p.substr(1);
+ a = ["O","Moz","ms","Ms","Webkit"];
+ i = 5;
+ while (--i > -1 && s[a[i]+p] === undefined) { }
+ if (i >= 0) {
+ _prefix = (i === 3) ? "ms" : a[i];
+ _prefixCSS = "-" + _prefix.toLowerCase() + "-";
+ return _prefix + p;
+ }
+ return null;
+ },
+
+ _getComputedStyle = _doc.defaultView ? _doc.defaultView.getComputedStyle : function() {},
+
+ /**
+ * @private Returns the css style for a particular property of an element. For example, to get whatever the current "left" css value for an element with an ID of "myElement", you could do:
+ * var currentLeft = CSSPlugin.getStyle( document.getElementById("myElement"), "left");
+ *
+ * @param {!Object} t Target element whose style property you want to query
+ * @param {!string} p Property name (like "left" or "top" or "marginTop", etc.)
+ * @param {Object=} cs Computed style object. This just provides a way to speed processing if you're going to get several properties on the same element in quick succession - you can reuse the result of the getComputedStyle() call.
+ * @param {boolean=} calc If true, the value will not be read directly from the element's "style" property (if it exists there), but instead the getComputedStyle() result will be used. This can be useful when you want to ensure that the browser itself is interpreting the value.
+ * @param {string=} dflt Default value that should be returned in the place of null, "none", "auto" or "auto auto".
+ * @return {?string} The current property value
+ */
+ _getStyle = CSSPlugin.getStyle = function(t, p, cs, calc, dflt) {
+ var rv;
+ if (!_supportsOpacity) if (p === "opacity") { //several versions of IE don't use the standard "opacity" property - they use things like filter:alpha(opacity=50), so we parse that here.
+ return _getIEOpacity(t);
+ }
+ if (!calc && t.style[p]) {
+ rv = t.style[p];
+ } else if ((cs = cs || _getComputedStyle(t))) {
+ rv = cs[p] || cs.getPropertyValue(p) || cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase());
+ } else if (t.currentStyle) {
+ rv = t.currentStyle[p];
+ }
+ return (dflt != null && (!rv || rv === "none" || rv === "auto" || rv === "auto auto")) ? dflt : rv;
+ },
+
+ /**
+ * @private Pass the target element, the property name, the numeric value, and the suffix (like "%", "em", "px", etc.) and it will spit back the equivalent pixel number.
+ * @param {!Object} t Target element
+ * @param {!string} p Property name (like "left", "top", "marginLeft", etc.)
+ * @param {!number} v Value
+ * @param {string=} sfx Suffix (like "px" or "%" or "em")
+ * @param {boolean=} recurse If true, the call is a recursive one. In some browsers (like IE7/8), occasionally the value isn't accurately reported initially, but if we run the function again it will take effect.
+ * @return {number} value in pixels
+ */
+ _convertToPixels = _internals.convertToPixels = function(t, p, v, sfx, recurse) {
+ if (sfx === "px" || !sfx) { return v; }
+ if (sfx === "auto" || !v) { return 0; }
+ var horiz = _horizExp.test(p),
+ node = t,
+ style = _tempDiv.style,
+ neg = (v < 0),
+ pix, cache, time;
+ if (neg) {
+ v = -v;
+ }
+ if (sfx === "%" && p.indexOf("border") !== -1) {
+ pix = (v / 100) * (horiz ? t.clientWidth : t.clientHeight);
+ } else {
+ style.cssText = "border:0 solid red;position:" + _getStyle(t, "position") + ";line-height:0;";
+ if (sfx === "%" || !node.appendChild) {
+ node = t.parentNode || _doc.body;
+ cache = node._gsCache;
+ time = TweenLite.ticker.frame;
+ if (cache && horiz && cache.time === time) { //performance optimization: we record the width of elements along with the ticker frame so that we can quickly get it again on the same tick (seems relatively safe to assume it wouldn't change on the same tick)
+ return cache.width * v / 100;
+ }
+ style[(horiz ? "width" : "height")] = v + sfx;
+ } else {
+ style[(horiz ? "borderLeftWidth" : "borderTopWidth")] = v + sfx;
+ }
+ node.appendChild(_tempDiv);
+ pix = parseFloat(_tempDiv[(horiz ? "offsetWidth" : "offsetHeight")]);
+ node.removeChild(_tempDiv);
+ if (horiz && sfx === "%" && CSSPlugin.cacheWidths !== false) {
+ cache = node._gsCache = node._gsCache || {};
+ cache.time = time;
+ cache.width = pix / v * 100;
+ }
+ if (pix === 0 && !recurse) {
+ pix = _convertToPixels(t, p, v, sfx, true);
+ }
+ }
+ return neg ? -pix : pix;
+ },
+ _calculateOffset = _internals.calculateOffset = function(t, p, cs) { //for figuring out "top" or "left" in px when it's "auto". We need to factor in margin with the offsetLeft/offsetTop
+ if (_getStyle(t, "position", cs) !== "absolute") { return 0; }
+ var dim = ((p === "left") ? "Left" : "Top"),
+ v = _getStyle(t, "margin" + dim, cs);
+ return t["offset" + dim] - (_convertToPixels(t, p, parseFloat(v), v.replace(_suffixExp, "")) || 0);
+ },
+
+ // @private returns at object containing ALL of the style properties in camelCase and their associated values.
+ _getAllStyles = function(t, cs) {
+ var s = {},
+ i, tr;
+ if ((cs = cs || _getComputedStyle(t, null))) {
+ if ((i = cs.length)) {
+ while (--i > -1) {
+ s[cs[i].replace(_camelExp, _camelFunc)] = cs.getPropertyValue(cs[i]);
+ }
+ } else { //Opera behaves differently - cs.length is always 0, so we must do a for...in loop.
+ for (i in cs) {
+ s[i] = cs[i];
+ }
+ }
+ } else if ((cs = t.currentStyle || t.style)) {
+ for (i in cs) {
+ if (typeof(i) === "string" && s[i] === undefined) {
+ s[i.replace(_camelExp, _camelFunc)] = cs[i];
+ }
+ }
+ }
+ if (!_supportsOpacity) {
+ s.opacity = _getIEOpacity(t);
+ }
+ tr = _getTransform(t, cs, false);
+ s.rotation = tr.rotation;
+ s.skewX = tr.skewX;
+ s.scaleX = tr.scaleX;
+ s.scaleY = tr.scaleY;
+ s.x = tr.x;
+ s.y = tr.y;
+ if (_supports3D) {
+ s.z = tr.z;
+ s.rotationX = tr.rotationX;
+ s.rotationY = tr.rotationY;
+ s.scaleZ = tr.scaleZ;
+ }
+ if (s.filters) {
+ delete s.filters;
+ }
+ return s;
+ },
+
+ // @private analyzes two style objects (as returned by _getAllStyles()) and only looks for differences between them that contain tweenable values (like a number or color). It returns an object with a "difs" property which refers to an object containing only those isolated properties and values for tweening, and a "firstMPT" property which refers to the first MiniPropTween instance in a linked list that recorded all the starting values of the different properties so that we can revert to them at the end or beginning of the tween - we don't want the cascading to get messed up. The forceLookup parameter is an optional generic object with properties that should be forced into the results - this is necessary for className tweens that are overwriting others because imagine a scenario where a rollover/rollout adds/removes a class and the user swipes the mouse over the target SUPER fast, thus nothing actually changed yet and the subsequent comparison of the properties would indicate they match (especially when px rounding is taken into consideration), thus no tweening is necessary even though it SHOULD tween and remove those properties after the tween (otherwise the inline styles will contaminate things). See the className SpecialProp code for details.
+ _cssDif = function(t, s1, s2, vars, forceLookup) {
+ var difs = {},
+ style = t.style,
+ val, p, mpt;
+ for (p in s2) {
+ if (p !== "cssText") if (p !== "length") if (isNaN(p)) if (s1[p] !== (val = s2[p]) || (forceLookup && forceLookup[p])) if (p.indexOf("Origin") === -1) if (typeof(val) === "number" || typeof(val) === "string") {
+ difs[p] = (val === "auto" && (p === "left" || p === "top")) ? _calculateOffset(t, p) : ((val === "" || val === "auto" || val === "none") && typeof(s1[p]) === "string" && s1[p].replace(_NaNExp, "") !== "") ? 0 : val; //if the ending value is defaulting ("" or "auto"), we check the starting value and if it can be parsed into a number (a string which could have a suffix too, like 700px), then we swap in 0 for "" or "auto" so that things actually tween.
+ if (style[p] !== undefined) { //for className tweens, we must remember which properties already existed inline - the ones that didn't should be removed when the tween isn't in progress because they were only introduced to facilitate the transition between classes.
+ mpt = new MiniPropTween(style, p, style[p], mpt);
+ }
+ }
+ }
+ if (vars) {
+ for (p in vars) { //copy properties (except className)
+ if (p !== "className") {
+ difs[p] = vars[p];
+ }
+ }
+ }
+ return {difs:difs, firstMPT:mpt};
+ },
+ _dimensions = {width:["Left","Right"], height:["Top","Bottom"]},
+ _margins = ["marginLeft","marginRight","marginTop","marginBottom"],
+
+ /**
+ * @private Gets the width or height of an element
+ * @param {!Object} t Target element
+ * @param {!string} p Property name ("width" or "height")
+ * @param {Object=} cs Computed style object (if one exists). Just a speed optimization.
+ * @return {number} Dimension (in pixels)
+ */
+ _getDimension = function(t, p, cs) {
+ var v = parseFloat((p === "width") ? t.offsetWidth : t.offsetHeight),
+ a = _dimensions[p],
+ i = a.length;
+ cs = cs || _getComputedStyle(t, null);
+ while (--i > -1) {
+ v -= parseFloat( _getStyle(t, "padding" + a[i], cs, true) ) || 0;
+ v -= parseFloat( _getStyle(t, "border" + a[i] + "Width", cs, true) ) || 0;
+ }
+ return v;
+ },
+
+ // @private Parses position-related complex strings like "top left" or "50px 10px" or "70% 20%", etc. which are used for things like transformOrigin or backgroundPosition. Optionally decorates a supplied object (recObj) with the following properties: "ox" (offsetX), "oy" (offsetY), "oxp" (if true, "ox" is a percentage not a pixel value), and "oxy" (if true, "oy" is a percentage not a pixel value)
+ _parsePosition = function(v, recObj) {
+ if (v == null || v === "" || v === "auto" || v === "auto auto") { //note: Firefox uses "auto auto" as default whereas Chrome uses "auto".
+ v = "0 0";
+ }
+ var a = v.split(" "),
+ x = (v.indexOf("left") !== -1) ? "0%" : (v.indexOf("right") !== -1) ? "100%" : a[0],
+ y = (v.indexOf("top") !== -1) ? "0%" : (v.indexOf("bottom") !== -1) ? "100%" : a[1];
+ if (y == null) {
+ y = "0";
+ } else if (y === "center") {
+ y = "50%";
+ }
+ if (x === "center" || (isNaN(parseFloat(x)) && (x + "").indexOf("=") === -1)) { //remember, the user could flip-flop the values and say "bottom center" or "center bottom", etc. "center" is ambiguous because it could be used to describe horizontal or vertical, hence the isNaN(). If there's an "=" sign in the value, it's relative.
+ x = "50%";
+ }
+ if (recObj) {
+ recObj.oxp = (x.indexOf("%") !== -1);
+ recObj.oyp = (y.indexOf("%") !== -1);
+ recObj.oxr = (x.charAt(1) === "=");
+ recObj.oyr = (y.charAt(1) === "=");
+ recObj.ox = parseFloat(x.replace(_NaNExp, ""));
+ recObj.oy = parseFloat(y.replace(_NaNExp, ""));
+ }
+ return x + " " + y + ((a.length > 2) ? " " + a[2] : "");
+ },
+
+ /**
+ * @private Takes an ending value (typically a string, but can be a number) and a starting value and returns the change between the two, looking for relative value indicators like += and -= and it also ignores suffixes (but make sure the ending value starts with a number or +=/-= and that the starting value is a NUMBER!)
+ * @param {(number|string)} e End value which is typically a string, but could be a number
+ * @param {(number|string)} b Beginning value which is typically a string but could be a number
+ * @return {number} Amount of change between the beginning and ending values (relative values that have a "+=" or "-=" are recognized)
+ */
+ _parseChange = function(e, b) {
+ return (typeof(e) === "string" && e.charAt(1) === "=") ? parseInt(e.charAt(0) + "1", 10) * parseFloat(e.substr(2)) : parseFloat(e) - parseFloat(b);
+ },
+
+ /**
+ * @private Takes a value and a default number, checks if the value is relative, null, or numeric and spits back a normalized number accordingly. Primarily used in the _parseTransform() function.
+ * @param {Object} v Value to be parsed
+ * @param {!number} d Default value (which is also used for relative calculations if "+=" or "-=" is found in the first parameter)
+ * @return {number} Parsed value
+ */
+ _parseVal = function(v, d) {
+ return (v == null) ? d : (typeof(v) === "string" && v.charAt(1) === "=") ? parseInt(v.charAt(0) + "1", 10) * Number(v.substr(2)) + d : parseFloat(v);
+ },
+
+ /**
+ * @private Translates strings like "40deg" or "40" or 40rad" or "+=40deg" or "270_short" or "-90_cw" or "+=45_ccw" to a numeric radian angle. Of course a starting/default value must be fed in too so that relative values can be calculated properly.
+ * @param {Object} v Value to be parsed
+ * @param {!number} d Default value (which is also used for relative calculations if "+=" or "-=" is found in the first parameter)
+ * @param {string=} p property name for directionalEnd (optional - only used when the parsed value is directional ("_short", "_cw", or "_ccw" suffix). We need a way to store the uncompensated value so that at the end of the tween, we set it to exactly what was requested with no directional compensation). Property name would be "rotation", "rotationX", or "rotationY"
+ * @param {Object=} directionalEnd An object that will store the raw end values for directional angles ("_short", "_cw", or "_ccw" suffix). We need a way to store the uncompensated value so that at the end of the tween, we set it to exactly what was requested with no directional compensation.
+ * @return {number} parsed angle in radians
+ */
+ _parseAngle = function(v, d, p, directionalEnd) {
+ var min = 0.000001,
+ cap, split, dif, result;
+ if (v == null) {
+ result = d;
+ } else if (typeof(v) === "number") {
+ result = v;
+ } else {
+ cap = 360;
+ split = v.split("_");
+ dif = Number(split[0].replace(_NaNExp, "")) * ((v.indexOf("rad") === -1) ? 1 : _RAD2DEG) - ((v.charAt(1) === "=") ? 0 : d);
+ if (split.length) {
+ if (directionalEnd) {
+ directionalEnd[p] = d + dif;
+ }
+ if (v.indexOf("short") !== -1) {
+ dif = dif % cap;
+ if (dif !== dif % (cap / 2)) {
+ dif = (dif < 0) ? dif + cap : dif - cap;
+ }
+ }
+ if (v.indexOf("_cw") !== -1 && dif < 0) {
+ dif = ((dif + cap * 9999999999) % cap) - ((dif / cap) | 0) * cap;
+ } else if (v.indexOf("ccw") !== -1 && dif > 0) {
+ dif = ((dif - cap * 9999999999) % cap) - ((dif / cap) | 0) * cap;
+ }
+ }
+ result = d + dif;
+ }
+ if (result < min && result > -min) {
+ result = 0;
+ }
+ return result;
+ },
+
+ _colorLookup = {aqua:[0,255,255],
+ lime:[0,255,0],
+ silver:[192,192,192],
+ black:[0,0,0],
+ maroon:[128,0,0],
+ teal:[0,128,128],
+ blue:[0,0,255],
+ navy:[0,0,128],
+ white:[255,255,255],
+ fuchsia:[255,0,255],
+ olive:[128,128,0],
+ yellow:[255,255,0],
+ orange:[255,165,0],
+ gray:[128,128,128],
+ purple:[128,0,128],
+ green:[0,128,0],
+ red:[255,0,0],
+ pink:[255,192,203],
+ cyan:[0,255,255],
+ transparent:[255,255,255,0]},
+
+ _hue = function(h, m1, m2) {
+ h = (h < 0) ? h + 1 : (h > 1) ? h - 1 : h;
+ return ((((h * 6 < 1) ? m1 + (m2 - m1) * h * 6 : (h < 0.5) ? m2 : (h * 3 < 2) ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * 255) + 0.5) | 0;
+ },
+
+ /**
+ * @private Parses a color (like #9F0, #FF9900, or rgb(255,51,153)) into an array with 3 elements for red, green, and blue. Also handles rgba() values (splits into array of 4 elements of course)
+ * @param {(string|number)} v The value the should be parsed which could be a string like #9F0 or rgb(255,102,51) or rgba(255,0,0,0.5) or it could be a number like 0xFF00CC or even a named color like red, blue, purple, etc.
+ * @return {Array.<number>} An array containing red, green, and blue (and optionally alpha) in that order.
+ */
+ _parseColor = function(v) {
+ var c1, c2, c3, h, s, l;
+ if (!v || v === "") {
+ return _colorLookup.black;
+ }
+ if (typeof(v) === "number") {
+ return [v >> 16, (v >> 8) & 255, v & 255];
+ }
+ if (v.charAt(v.length - 1) === ",") { //sometimes a trailing commma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value.
+ v = v.substr(0, v.length - 1);
+ }
+ if (_colorLookup[v]) {
+ return _colorLookup[v];
+ }
+ if (v.charAt(0) === "#") {
+ if (v.length === 4) { //for shorthand like #9F0
+ c1 = v.charAt(1),
+ c2 = v.charAt(2),
+ c3 = v.charAt(3);
+ v = "#" + c1 + c1 + c2 + c2 + c3 + c3;
+ }
+ v = parseInt(v.substr(1), 16);
+ return [v >> 16, (v >> 8) & 255, v & 255];
+ }
+ if (v.substr(0, 3) === "hsl") {
+ v = v.match(_numExp);
+ h = (Number(v[0]) % 360) / 360;
+ s = Number(v[1]) / 100;
+ l = Number(v[2]) / 100;
+ c2 = (l <= 0.5) ? l * (s + 1) : l + s - l * s;
+ c1 = l * 2 - c2;
+ if (v.length > 3) {
+ v[3] = Number(v[3]);
+ }
+ v[0] = _hue(h + 1 / 3, c1, c2);
+ v[1] = _hue(h, c1, c2);
+ v[2] = _hue(h - 1 / 3, c1, c2);
+ return v;
+ }
+ v = v.match(_numExp) || _colorLookup.transparent;
+ v[0] = Number(v[0]);
+ v[1] = Number(v[1]);
+ v[2] = Number(v[2]);
+ if (v.length > 3) {
+ v[3] = Number(v[3]);
+ }
+ return v;
+ },
+ _colorExp = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#.+?\\b"; //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc.
+
+ for (p in _colorLookup) {
+ _colorExp += "|" + p + "\\b";
+ }
+ _colorExp = new RegExp(_colorExp+")", "gi");
+
+ /**
+ * @private Returns a formatter function that handles taking a string (or number in some cases) and returning a consistently formatted one in terms of delimiters, quantity of values, etc. For example, we may get boxShadow values defined as "0px red" or "0px 0px 10px rgb(255,0,0)" or "0px 0px 20px 20px #F00" and we need to ensure that what we get back is described with 4 numbers and a color. This allows us to feed it into the _parseComplex() method and split the values up appropriately. The neat thing about this _getFormatter() function is that the dflt defines a pattern as well as a default, so for example, _getFormatter("0px 0px 0px 0px #777", true) not only sets the default as 0px for all distances and #777 for the color, but also sets the pattern such that 4 numbers and a color will always get returned.
+ * @param {!string} dflt The default value and pattern to follow. So "0px 0px 0px 0px #777" will ensure that 4 numbers and a color will always get returned.
+ * @param {boolean=} clr If true, the values should be searched for color-related data. For example, boxShadow values typically contain a color whereas borderRadius don't.
+ * @param {boolean=} collapsible If true, the value is a top/left/right/bottom style one that acts like margin or padding, where if only one value is received, it's used for all 4; if 2 are received, the first is duplicated for 3rd (bottom) and the 2nd is duplicated for the 4th spot (left), etc.
+ * @return {Function} formatter function
+ */
+ var _getFormatter = function(dflt, clr, collapsible, multi) {
+ if (dflt == null) {
+ return function(v) {return v;};
+ }
+ var dColor = clr ? (dflt.match(_colorExp) || [""])[0] : "",
+ dVals = dflt.split(dColor).join("").match(_valuesExp) || [],
+ pfx = dflt.substr(0, dflt.indexOf(dVals[0])),
+ sfx = (dflt.charAt(dflt.length - 1) === ")") ? ")" : "",
+ delim = (dflt.indexOf(" ") !== -1) ? " " : ",",
+ numVals = dVals.length,
+ dSfx = (numVals > 0) ? dVals[0].replace(_numExp, "") : "",
+ formatter;
+ if (!numVals) {
+ return function(v) {return v;};
+ }
+ if (clr) {
+ formatter = function(v) {
+ var color, vals, i, a;
+ if (typeof(v) === "number") {
+ v += dSfx;
+ } else if (multi && _commasOutsideParenExp.test(v)) {
+ a = v.replace(_commasOutsideParenExp, "|").split("|");
+ for (i = 0; i < a.length; i++) {
+ a[i] = formatter(a[i]);
+ }
+ return a.join(",");
+ }
+ color = (v.match(_colorExp) || [dColor])[0];
+ vals = v.split(color).join("").match(_valuesExp) || [];
+ i = vals.length;
+ if (numVals > i--) {
+ while (++i < numVals) {
+ vals[i] = collapsible ? vals[(((i - 1) / 2) | 0)] : dVals[i];
+ }
+ }
+ return pfx + vals.join(delim) + delim + color + sfx + (v.indexOf("inset") !== -1 ? " inset" : "");
+ };
+ return formatter;
+
+ }
+ formatter = function(v) {
+ var vals, a, i;
+ if (typeof(v) === "number") {
+ v += dSfx;
+ } else if (multi && _commasOutsideParenExp.test(v)) {
+ a = v.replace(_commasOutsideParenExp, "|").split("|");
+ for (i = 0; i < a.length; i++) {
+ a[i] = formatter(a[i]);
+ }
+ return a.join(",");
+ }
+ vals = v.match(_valuesExp) || [];
+ i = vals.length;
+ if (numVals > i--) {
+ while (++i < numVals) {
+ vals[i] = collapsible ? vals[(((i - 1) / 2) | 0)] : dVals[i];
+ }
+ }
+ return pfx + vals.join(delim) + sfx;
+ };
+ return formatter;
+ },
+
+ /**
+ * @private returns a formatter function that's used for edge-related values like marginTop, marginLeft, paddingBottom, paddingRight, etc. Just pass a comma-delimited list of property names related to the edges.
+ * @param {!string} props a comma-delimited list of property names in order from top to left, like "marginTop,marginRight,marginBottom,marginLeft"
+ * @return {Function} a formatter function
+ */
+ _getEdgeParser = function(props) {
+ props = props.split(",");
+ return function(t, e, p, cssp, pt, plugin, vars) {
+ var a = (e + "").split(" "),
+ i;
+ vars = {};
+ for (i = 0; i < 4; i++) {
+ vars[props[i]] = a[i] = a[i] || a[(((i - 1) / 2) >> 0)];
+ }
+ return cssp.parse(t, vars, pt, plugin);
+ };
+ },
+
+ // @private used when other plugins must tween values first, like BezierPlugin or ThrowPropsPlugin, etc. That plugin's setRatio() gets called first so that the values are updated, and then we loop through the MiniPropTweens which handle copying the values into their appropriate slots so that they can then be applied correctly in the main CSSPlugin setRatio() method. Remember, we typically create a proxy object that has a bunch of uniquely-named properties that we feed to the sub-plugin and it does its magic normally, and then we must interpret those values and apply them to the css because often numbers must get combined/concatenated, suffixes added, etc. to work with css, like boxShadow could have 4 values plus a color.
+ _setPluginRatio = _internals._setPluginRatio = function(v) {
+ this.plugin.setRatio(v);
+ var d = this.data,
+ proxy = d.proxy,
+ mpt = d.firstMPT,
+ min = 0.000001,
+ val, pt, i, str;
+ while (mpt) {
+ val = proxy[mpt.v];
+ if (mpt.r) {
+ val = Math.round(val);
+ } else if (val < min && val > -min) {
+ val = 0;
+ }
+ mpt.t[mpt.p] = val;
+ mpt = mpt._next;
+ }
+ if (d.autoRotate) {
+ d.autoRotate.rotation = proxy.rotation;
+ }
+ //at the end, we must set the CSSPropTween's "e" (end) value dynamically here because that's what is used in the final setRatio() method.
+ if (v === 1) {
+ mpt = d.firstMPT;
+ while (mpt) {
+ pt = mpt.t;
+ if (!pt.type) {
+ pt.e = pt.s + pt.xs0;
+ } else if (pt.type === 1) {
+ str = pt.xs0 + pt.s + pt.xs1;
+ for (i = 1; i < pt.l; i++) {
+ str += pt["xn"+i] + pt["xs"+(i+1)];
+ }
+ pt.e = str;
+ }
+ mpt = mpt._next;
+ }
+ }
+ },
+
+ /**
+ * @private @constructor Used by a few SpecialProps to hold important values for proxies. For example, _parseToProxy() creates a MiniPropTween instance for each property that must get tweened on the proxy, and we record the original property name as well as the unique one we create for the proxy, plus whether or not the value needs to be rounded plus the original value.
+ * @param {!Object} t target object whose property we're tweening (often a CSSPropTween)
+ * @param {!string} p property name
+ * @param {(number|string|object)} v value
+ * @param {MiniPropTween=} next next MiniPropTween in the linked list
+ * @param {boolean=} r if true, the tweened value should be rounded to the nearest integer
+ */
+ MiniPropTween = function(t, p, v, next, r) {
+ this.t = t;
+ this.p = p;
+ this.v = v;
+ this.r = r;
+ if (next) {
+ next._prev = this;
+ this._next = next;
+ }
+ },
+
+ /**
+ * @private Most other plugins (like BezierPlugin and ThrowPropsPlugin and others) can only tween numeric values, but CSSPlugin must accommodate special values that have a bunch of extra data (like a suffix or strings between numeric values, etc.). For example, boxShadow has values like "10px 10px 20px 30px rgb(255,0,0)" which would utterly confuse other plugins. This method allows us to split that data apart and grab only the numeric data and attach it to uniquely-named properties of a generic proxy object ({}) so that we can feed that to virtually any plugin to have the numbers tweened. However, we must also keep track of which properties from the proxy go with which CSSPropTween values and instances. So we create a linked list of MiniPropTweens. Each one records a target (the original CSSPropTween), property (like "s" or "xn1" or "xn2") that we're tweening and the unique property name that was used for the proxy (like "boxShadow_xn1" and "boxShadow_xn2") and whether or not they need to be rounded. That way, in the _setPluginRatio() method we can simply copy the values over from the proxy to the CSSPropTween instance(s). Then, when the main CSSPlugin setRatio() method runs and applies the CSSPropTween values accordingly, they're updated nicely. So the external plugin tweens the numbers, _setPluginRatio() copies them over, and setRatio() acts normally, applying css-specific values to the element.
+ * This method returns an object that has the following properties:
+ * - proxy: a generic object containing the starting values for all the properties that will be tweened by the external plugin. This is what we feed to the external _onInitTween() as the target
+ * - end: a generic object containing the ending values for all the properties that will be tweened by the external plugin. This is what we feed to the external plugin's _onInitTween() as the destination values
+ * - firstMPT: the first MiniPropTween in the linked list
+ * - pt: the first CSSPropTween in the linked list that was created when parsing. If shallow is true, this linked list will NOT attach to the one passed into the _parseToProxy() as the "pt" (4th) parameter.
+ * @param {!Object} t target object to be tweened
+ * @param {!(Object|string)} vars the object containing the information about the tweening values (typically the end/destination values) that should be parsed
+ * @param {!CSSPlugin} cssp The CSSPlugin instance
+ * @param {CSSPropTween=} pt the next CSSPropTween in the linked list
+ * @param {TweenPlugin=} plugin the external TweenPlugin instance that will be handling tweening the numeric values
+ * @param {boolean=} shallow if true, the resulting linked list from the parse will NOT be attached to the CSSPropTween that was passed in as the "pt" (4th) parameter.
+ * @return An object containing the following properties: proxy, end, firstMPT, and pt (see above for descriptions)
+ */
+ _parseToProxy = _internals._parseToProxy = function(t, vars, cssp, pt, plugin, shallow) {
+ var bpt = pt,
+ start = {},
+ end = {},
+ transform = cssp._transform,
+ oldForce = _forcePT,
+ i, p, xp, mpt, firstPT;
+ cssp._transform = null;
+ _forcePT = vars;
+ pt = firstPT = cssp.parse(t, vars, pt, plugin);
+ _forcePT = oldForce;
+ //break off from the linked list so the new ones are isolated.
+ if (shallow) {
+ cssp._transform = transform;
+ if (bpt) {
+ bpt._prev = null;
+ if (bpt._prev) {
+ bpt._prev._next = null;
+ }
+ }
+ }
+ while (pt && pt !== bpt) {
+ if (pt.type <= 1) {
+ p = pt.p;
+ end[p] = pt.s + pt.c;
+ start[p] = pt.s;
+ if (!shallow) {
+ mpt = new MiniPropTween(pt, "s", p, mpt, pt.r);
+ pt.c = 0;
+ }
+ if (pt.type === 1) {
+ i = pt.l;
+ while (--i > 0) {
+ xp = "xn" + i;
+ p = pt.p + "_" + xp;
+ end[p] = pt.data[xp];
+ start[p] = pt[xp];
+ if (!shallow) {
+ mpt = new MiniPropTween(pt, xp, p, mpt, pt.rxp[xp]);
+ }
+ }
+ }
+ }
+ pt = pt._next;
+ }
+ return {proxy:start, end:end, firstMPT:mpt, pt:firstPT};
+ },
+
+
+
+ /**
+ * @constructor Each property that is tweened has at least one CSSPropTween associated with it. These instances store important information like the target, property, starting value, amount of change, etc. They can also optionally have a number of "extra" strings and numeric values named xs1, xn1, xs2, xn2, xs3, xn3, etc. where "s" indicates string and "n" indicates number. These can be pieced together in a complex-value tween (type:1) that has alternating types of data like a string, number, string, number, etc. For example, boxShadow could be "5px 5px 8px rgb(102, 102, 51)". In that value, there are 6 numbers that may need to tween and then pieced back together into a string again with spaces, suffixes, etc. xs0 is special in that it stores the suffix for standard (type:0) tweens, -OR- the first string (prefix) in a complex-value (type:1) CSSPropTween -OR- it can be the non-tweening value in a type:-1 CSSPropTween. We do this to conserve memory.
+ * CSSPropTweens have the following optional properties as well (not defined through the constructor):
+ * - l: Length in terms of the number of extra properties that the CSSPropTween has (default: 0). For example, for a boxShadow we may need to tween 5 numbers in which case l would be 5; Keep in mind that the start/end values for the first number that's tweened are always stored in the s and c properties to conserve memory. All additional values thereafter are stored in xn1, xn2, etc.
+ * - xfirst: The first instance of any sub-CSSPropTweens that are tweening properties of this instance. For example, we may split up a boxShadow tween so that there's a main CSSPropTween of type:1 that has various xs* and xn* values associated with the h-shadow, v-shadow, blur, color, etc. Then we spawn a CSSPropTween for each of those that has a higher priority and runs BEFORE the main CSSPropTween so that the values are all set by the time it needs to re-assemble them. The xfirst gives us an easy way to identify the first one in that chain which typically ends at the main one (because they're all prepende to the linked list)
+ * - plugin: The TweenPlugin instance that will handle the tweening of any complex values. For example, sometimes we don't want to use normal subtweens (like xfirst refers to) to tween the values - we might want ThrowPropsPlugin or BezierPlugin some other plugin to do the actual tweening, so we create a plugin instance and store a reference here. We need this reference so that if we get a request to round values or disable a tween, we can pass along that request.
+ * - data: Arbitrary data that needs to be stored with the CSSPropTween. Typically if we're going to have a plugin handle the tweening of a complex-value tween, we create a generic object that stores the END values that we're tweening to and the CSSPropTween's xs1, xs2, etc. have the starting values. We store that object as data. That way, we can simply pass that object to the plugin and use the CSSPropTween as the target.
+ * - setRatio: Only used for type:2 tweens that require custom functionality. In this case, we call the CSSPropTween's setRatio() method and pass the ratio each time the tween updates. This isn't quite as efficient as doing things directly in the CSSPlugin's setRatio() method, but it's very convenient and flexible.
+ * @param {!Object} t Target object whose property will be tweened. Often a DOM element, but not always. It could be anything.
+ * @param {string} p Property to tween (name). For example, to tween element.width, p would be "width".
+ * @param {number} s Starting numeric value
+ * @param {number} c Change in numeric value over the course of the entire tween. For example, if element.width starts at 5 and should end at 100, c would be 95.
+ * @param {CSSPropTween=} next The next CSSPropTween in the linked list. If one is defined, we will define its _prev as the new instance, and the new instance's _next will be pointed at it.
+ * @param {number=} type The type of CSSPropTween where -1 = a non-tweening value, 0 = a standard simple tween, 1 = a complex value (like one that has multiple numbers in a comma- or space-delimited string like border:"1px solid red"), and 2 = one that uses a custom setRatio function that does all of the work of applying the values on each update.
+ * @param {string=} n Name of the property that should be used for overwriting purposes which is typically the same as p but not always. For example, we may need to create a subtween for the 2nd part of a "clip:rect(...)" tween in which case "p" might be xs1 but "n" is still "clip"
+ * @param {boolean=} r If true, the value(s) should be rounded
+ * @param {number=} pr Priority in the linked list order. Higher priority CSSPropTweens will be updated before lower priority ones. The default priority is 0.
+ * @param {string=} b Beginning value. We store this to ensure that it is EXACTLY what it was when the tween began without any risk of interpretation issues.
+ * @param {string=} e Ending value. We store this to ensure that it is EXACTLY what the user defined at the end of the tween without any risk of interpretation issues.
+ */
+ CSSPropTween = _internals.CSSPropTween = function(t, p, s, c, next, type, n, r, pr, b, e) {
+ this.t = t; //target
+ this.p = p; //property
+ this.s = s; //starting value
+ this.c = c; //change value
+ this.n = n || p; //name that this CSSPropTween should be associated to (usually the same as p, but not always - n is what overwriting looks at)
+ if (!(t instanceof CSSPropTween)) {
+ _overwriteProps.push(this.n);
+ }
+ this.r = r; //round (boolean)
+ this.type = type || 0; //0 = normal tween, -1 = non-tweening (in which case xs0 will be applied to the target's property, like tp.t[tp.p] = tp.xs0), 1 = complex-value SpecialProp, 2 = custom setRatio() that does all the work
+ if (pr) {
+ this.pr = pr;
+ _hasPriority = true;
+ }
+ this.b = (b === undefined) ? s : b;
+ this.e = (e === undefined) ? s + c : e;
+ if (next) {
+ this._next = next;
+ next._prev = this;
+ }
+ },
+
+ /**
+ * Takes a target, the beginning value and ending value (as strings) and parses them into a CSSPropTween (possibly with child CSSPropTweens) that accommodates multiple numbers, colors, comma-delimited values, etc. For example:
+ * sp.parseComplex(element, "boxShadow", "5px 10px 20px rgb(255,102,51)", "0px 0px 0px red", true, "0px 0px 0px rgb(0,0,0,0)", pt);
+ * It will walk through the beginning and ending values (which should be in the same format with the same number and type of values) and figure out which parts are numbers, what strings separate the numeric/tweenable values, and then create the CSSPropTweens accordingly. If a plugin is defined, no child CSSPropTweens will be created. Instead, the ending values will be stored in the "data" property of the returned CSSPropTween like: {s:-5, xn1:-10, xn2:-20, xn3:255, xn4:0, xn5:0} so that it can be fed to any other plugin and it'll be plain numeric tweens but the recomposition of the complex value will be handled inside CSSPlugin's setRatio().
+ * If a setRatio is defined, the type of the CSSPropTween will be set to 2 and recomposition of the values will be the responsibility of that method.
+ *
+ * @param {!Object} t Target whose property will be tweened
+ * @param {!string} p Property that will be tweened (its name, like "left" or "backgroundColor" or "boxShadow")
+ * @param {string} b Beginning value
+ * @param {string} e Ending value
+ * @param {boolean} clrs If true, the value could contain a color value like "rgb(255,0,0)" or "#F00" or "red". The default is false, so no colors will be recognized (a performance optimization)
+ * @param {(string|number|Object)} dflt The default beginning value that should be used if no valid beginning value is defined or if the number of values inside the complex beginning and ending values don't match
+ * @param {?CSSPropTween} pt CSSPropTween instance that is the current head of the linked list (we'll prepend to this).
+ * @param {number=} pr Priority in the linked list order. Higher priority properties will be updated before lower priority ones. The default priority is 0.
+ * @param {TweenPlugin=} plugin If a plugin should handle the tweening of extra properties, pass the plugin instance here. If one is defined, then NO subtweens will be created for any extra properties (the properties will be created - just not additional CSSPropTween instances to tween them) because the plugin is expected to do so. However, the end values WILL be populated in the "data" property, like {s:100, xn1:50, xn2:300}
+ * @param {function(number)=} setRatio If values should be set in a custom function instead of being pieced together in a type:1 (complex-value) CSSPropTween, define that custom function here.
+ * @return {CSSPropTween} The first CSSPropTween in the linked list which includes the new one(s) added by the parseComplex() call.
+ */
+ _parseComplex = CSSPlugin.parseComplex = function(t, p, b, e, clrs, dflt, pt, pr, plugin, setRatio) {
+ //DEBUG: _log("parseComplex: "+p+", b: "+b+", e: "+e);
+ b = b || dflt || "";
+ pt = new CSSPropTween(t, p, 0, 0, pt, (setRatio ? 2 : 1), null, false, pr, b, e);
+ e += ""; //ensures it's a string
+ var ba = b.split(", ").join(",").split(" "), //beginning array
+ ea = e.split(", ").join(",").split(" "), //ending array
+ l = ba.length,
+ autoRound = (_autoRound !== false),
+ i, xi, ni, bv, ev, bnums, enums, bn, rgba, temp, cv, str;
+ if (e.indexOf(",") !== -1 || b.indexOf(",") !== -1) {
+ ba = ba.join(" ").replace(_commasOutsideParenExp, ", ").split(" ");
+ ea = ea.join(" ").replace(_commasOutsideParenExp, ", ").split(" ");
+ l = ba.length;
+ }
+ if (l !== ea.length) {
+ //DEBUG: _log("mismatched formatting detected on " + p + " (" + b + " vs " + e + ")");
+ ba = (dflt || "").split(" ");
+ l = ba.length;
+ }
+ pt.plugin = plugin;
+ pt.setRatio = setRatio;
+ for (i = 0; i < l; i++) {
+ bv = ba[i];
+ ev = ea[i];
+ bn = parseFloat(bv);
+
+ //if the value begins with a number (most common). It's fine if it has a suffix like px
+ if (bn || bn === 0) {
+ pt.appendXtra("", bn, _parseChange(ev, bn), ev.replace(_relNumExp, ""), (autoRound && ev.indexOf("px") !== -1), true);
+
+ //if the value is a color
+ } else if (clrs && (bv.charAt(0) === "#" || _colorLookup[bv] || _rgbhslExp.test(bv))) {
+ str = ev.charAt(ev.length - 1) === "," ? ")," : ")"; //if there's a comma at the end, retain it.
+ bv = _parseColor(bv);
+ ev = _parseColor(ev);
+ rgba = (bv.length + ev.length > 6);
+ if (rgba && !_supportsOpacity && ev[3] === 0) { //older versions of IE don't support rgba(), so if the destination alpha is 0, just use "transparent" for the end color
+ pt["xs" + pt.l] += pt.l ? " transparent" : "transparent";
+ pt.e = pt.e.split(ea[i]).join("transparent");
+ } else {
+ if (!_supportsOpacity) { //old versions of IE don't support rgba().
+ rgba = false;
+ }
+ pt.appendXtra((rgba ? "rgba(" : "rgb("), bv[0], ev[0] - bv[0], ",", true, true)
+ .appendXtra("", bv[1], ev[1] - bv[1], ",", true)
+ .appendXtra("", bv[2], ev[2] - bv[2], (rgba ? "," : str), true);
+ if (rgba) {
+ bv = (bv.length < 4) ? 1 : bv[3];
+ pt.appendXtra("", bv, ((ev.length < 4) ? 1 : ev[3]) - bv, str, false);
+ }
+ }
+
+ } else {
+ bnums = bv.match(_numExp); //gets each group of numbers in the beginning value string and drops them into an array
+
+ //if no number is found, treat it as a non-tweening value and just append the string to the current xs.
+ if (!bnums) {
+ pt["xs" + pt.l] += pt.l ? " " + bv : bv;
+
+ //loop through all the numbers that are found and construct the extra values on the pt.
+ } else {
+ enums = ev.match(_relNumExp); //get each group of numbers in the end value string and drop them into an array. We allow relative values too, like +=50 or -=.5
+ if (!enums || enums.length !== bnums.length) {
+ //DEBUG: _log("mismatched formatting detected on " + p + " (" + b + " vs " + e + ")");
+ return pt;
+ }
+ ni = 0;
+ for (xi = 0; xi < bnums.length; xi++) {
+ cv = bnums[xi];
+ temp = bv.indexOf(cv, ni);
+ pt.appendXtra(bv.substr(ni, temp - ni), Number(cv), _parseChange(enums[xi], cv), "", (autoRound && bv.substr(temp + cv.length, 2) === "px"), (xi === 0));
+ ni = temp + cv.length;
+ }
+ pt["xs" + pt.l] += bv.substr(ni);
+ }
+ }
+ }
+ //if there are relative values ("+=" or "-=" prefix), we need to adjust the ending value to eliminate the prefixes and combine the values properly.
+ if (e.indexOf("=") !== -1) if (pt.data) {
+ str = pt.xs0 + pt.data.s;
+ for (i = 1; i < pt.l; i++) {
+ str += pt["xs" + i] + pt.data["xn" + i];
+ }
+ pt.e = str + pt["xs" + i];
+ }
+ if (!pt.l) {
+ pt.type = -1;
+ pt.xs0 = pt.e;
+ }
+ return pt.xfirst || pt;
+ },
+ i = 9;
+
+
+ p = CSSPropTween.prototype;
+ p.l = p.pr = 0; //length (number of extra properties like xn1, xn2, xn3, etc.
+ while (--i > 0) {
+ p["xn" + i] = 0;
+ p["xs" + i] = "";
+ }
+ p.xs0 = "";
+ p._next = p._prev = p.xfirst = p.data = p.plugin = p.setRatio = p.rxp = null;
+
+
+ /**
+ * Appends and extra tweening value to a CSSPropTween and automatically manages any prefix and suffix strings. The first extra value is stored in the s and c of the main CSSPropTween instance, but thereafter any extras are stored in the xn1, xn2, xn3, etc. The prefixes and suffixes are stored in the xs0, xs1, xs2, etc. properties. For example, if I walk through a clip value like "rect(10px, 5px, 0px, 20px)", the values would be stored like this:
+ * xs0:"rect(", s:10, xs1:"px, ", xn1:5, xs2:"px, ", xn2:0, xs3:"px, ", xn3:20, xn4:"px)"
+ * And they'd all get joined together when the CSSPlugin renders (in the setRatio() method).
+ * @param {string=} pfx Prefix (if any)
+ * @param {!number} s Starting value
+ * @param {!number} c Change in numeric value over the course of the entire tween. For example, if the start is 5 and the end is 100, the change would be 95.
+ * @param {string=} sfx Suffix (if any)
+ * @param {boolean=} r Round (if true).
+ * @param {boolean=} pad If true, this extra value should be separated by the previous one by a space. If there is no previous extra and pad is true, it will automatically drop the space.
+ * @return {CSSPropTween} returns itself so that multiple methods can be chained together.
+ */
+ p.appendXtra = function(pfx, s, c, sfx, r, pad) {
+ var pt = this,
+ l = pt.l;
+ pt["xs" + l] += (pad && l) ? " " + pfx : pfx || "";
+ if (!c) if (l !== 0 && !pt.plugin) { //typically we'll combine non-changing values right into the xs to optimize performance, but we don't combine them when there's a plugin that will be tweening the values because it may depend on the values being split apart, like for a bezier, if a value doesn't change between the first and second iteration but then it does on the 3rd, we'll run into trouble because there's no xn slot for that value!
+ pt["xs" + l] += s + (sfx || "");
+ return pt;
+ }
+ pt.l++;
+ pt.type = pt.setRatio ? 2 : 1;
+ pt["xs" + pt.l] = sfx || "";
+ if (l > 0) {
+ pt.data["xn" + l] = s + c;
+ pt.rxp["xn" + l] = r; //round extra property (we need to tap into this in the _parseToProxy() method)
+ pt["xn" + l] = s;
+ if (!pt.plugin) {
+ pt.xfirst = new CSSPropTween(pt, "xn" + l, s, c, pt.xfirst || pt, 0, pt.n, r, pt.pr);
+ pt.xfirst.xs0 = 0; //just to ensure that the property stays numeric which helps modern browsers speed up processing. Remember, in the setRatio() method, we do pt.t[pt.p] = val + pt.xs0 so if pt.xs0 is "" (the default), it'll cast the end value as a string. When a property is a number sometimes and a string sometimes, it prevents the compiler from locking in the data type, slowing things down slightly.
+ }
+ return pt;
+ }
+ pt.data = {s:s + c};
+ pt.rxp = {};
+ pt.s = s;
+ pt.c = c;
+ pt.r = r;
+ return pt;
+ };
+
+ /**
+ * @constructor A SpecialProp is basically a css property that needs to be treated in a non-standard way, like if it may contain a complex value like boxShadow:"5px 10px 15px rgb(255, 102, 51)" or if it is associated with another plugin like ThrowPropsPlugin or BezierPlugin. Every SpecialProp is associated with a particular property name like "boxShadow" or "throwProps" or "bezier" and it will intercept those values in the vars object that's passed to the CSSPlugin and handle them accordingly.
+ * @param {!string} p Property name (like "boxShadow" or "throwProps")
+ * @param {Object=} options An object containing any of the following configuration options:
+ * - defaultValue: the default value
+ * - parser: A function that should be called when the associated property name is found in the vars. This function should return a CSSPropTween instance and it should ensure that it is properly inserted into the linked list. It will receive 4 paramters: 1) The target, 2) The value defined in the vars, 3) The CSSPlugin instance (whose _firstPT should be used for the linked list), and 4) A computed style object if one was calculated (this is a speed optimization that allows retrieval of starting values quicker)
+ * - formatter: a function that formats any value received for this special property (for example, boxShadow could take "5px 5px red" and format it to "5px 5px 0px 0px red" so that both the beginning and ending values have a common order and quantity of values.)
+ * - prefix: if true, we'll determine whether or not this property requires a vendor prefix (like Webkit or Moz or ms or O)
+ * - color: set this to true if the value for this SpecialProp may contain color-related values like rgb(), rgba(), etc.
+ * - priority: priority in the linked list order. Higher priority SpecialProps will be updated before lower priority ones. The default priority is 0.
+ * - multi: if true, the formatter should accommodate a comma-delimited list of values, like boxShadow could have multiple boxShadows listed out.
+ * - collapsible: if true, the formatter should treat the value like it's a top/right/bottom/left value that could be collapsed, like "5px" would apply to all, "5px, 10px" would use 5px for top/bottom and 10px for right/left, etc.
+ * - keyword: a special keyword that can [optionally] be found inside the value (like "inset" for boxShadow). This allows us to validate beginning/ending values to make sure they match (if the keyword is found in one, it'll be added to the other for consistency by default).
+ */
+ var SpecialProp = function(p, options) {
+ options = options || {};
+ this.p = options.prefix ? _checkPropPrefix(p) || p : p;
+ _specialProps[p] = _specialProps[this.p] = this;
+ this.format = options.formatter || _getFormatter(options.defaultValue, options.color, options.collapsible, options.multi);
+ if (options.parser) {
+ this.parse = options.parser;
+ }
+ this.clrs = options.color;
+ this.multi = options.multi;
+ this.keyword = options.keyword;
+ this.dflt = options.defaultValue;
+ this.pr = options.priority || 0;
+ },
+
+ //shortcut for creating a new SpecialProp that can accept multiple properties as a comma-delimited list (helps minification). dflt can be an array for multiple values (we don't do a comma-delimited list because the default value may contain commas, like rect(0px,0px,0px,0px)). We attach this method to the SpecialProp class/object instead of using a private _createSpecialProp() method so that we can tap into it externally if necessary, like from another plugin.
+ _registerComplexSpecialProp = _internals._registerComplexSpecialProp = function(p, options, defaults) {
+ if (typeof(options) !== "object") {
+ options = {parser:defaults}; //to make backwards compatible with older versions of BezierPlugin and ThrowPropsPlugin
+ }
+ var a = p.split(","),
+ d = options.defaultValue,
+ i, temp;
+ defaults = defaults || [d];
+ for (i = 0; i < a.length; i++) {
+ options.prefix = (i === 0 && options.prefix);
+ options.defaultValue = defaults[i] || d;
+ temp = new SpecialProp(a[i], options);
+ }
+ },
+
+ //creates a placeholder special prop for a plugin so that the property gets caught the first time a tween of it is attempted, and at that time it makes the plugin register itself, thus taking over for all future tweens of that property. This allows us to not mandate that things load in a particular order and it also allows us to log() an error that informs the user when they attempt to tween an external plugin-related property without loading its .js file.
+ _registerPluginProp = function(p) {
+ if (!_specialProps[p]) {
+ var pluginName = p.charAt(0).toUpperCase() + p.substr(1) + "Plugin";
+ _registerComplexSpecialProp(p, {parser:function(t, e, p, cssp, pt, plugin, vars) {
+ var pluginClass = (window.GreenSockGlobals || window).com.greensock.plugins[pluginName];
+ if (!pluginClass) {
+ _log("Error: " + pluginName + " js file not loaded.");
+ return pt;
+ }
+ pluginClass._cssRegister();
+ return _specialProps[p].parse(t, e, p, cssp, pt, plugin, vars);
+ }});
+ }
+ };
+
+
+ p = SpecialProp.prototype;
+
+ /**
+ * Alias for _parseComplex() that automatically plugs in certain values for this SpecialProp, like its property name, whether or not colors should be sensed, the default value, and priority. It also looks for any keyword that the SpecialProp defines (like "inset" for boxShadow) and ensures that the beginning and ending values have the same number of values for SpecialProps where multi is true (like boxShadow and textShadow can have a comma-delimited list)
+ * @param {!Object} t target element
+ * @param {(string|number|object)} b beginning value
+ * @param {(string|number|object)} e ending (destination) value
+ * @param {CSSPropTween=} pt next CSSPropTween in the linked list
+ * @param {TweenPlugin=} plugin If another plugin will be tweening the complex value, that TweenPlugin instance goes here.
+ * @param {function=} setRatio If a custom setRatio() method should be used to handle this complex value, that goes here.
+ * @return {CSSPropTween=} First CSSPropTween in the linked list
+ */
+ p.parseComplex = function(t, b, e, pt, plugin, setRatio) {
+ var kwd = this.keyword,
+ i, ba, ea, l, bi, ei;
+ //if this SpecialProp's value can contain a comma-delimited list of values (like boxShadow or textShadow), we must parse them in a special way, and look for a keyword (like "inset" for boxShadow) and ensure that the beginning and ending BOTH have it if the end defines it as such. We also must ensure that there are an equal number of values specified (we can't tween 1 boxShadow to 3 for example)
+ if (this.multi) if (_commasOutsideParenExp.test(e) || _commasOutsideParenExp.test(b)) {
+ ba = b.replace(_commasOutsideParenExp, "|").split("|");
+ ea = e.replace(_commasOutsideParenExp, "|").split("|");
+ } else if (kwd) {
+ ba = [b];
+ ea = [e];
+ }
+ if (ea) {
+ l = (ea.length > ba.length) ? ea.length : ba.length;
+ for (i = 0; i < l; i++) {
+ b = ba[i] = ba[i] || this.dflt;
+ e = ea[i] = ea[i] || this.dflt;
+ if (kwd) {
+ bi = b.indexOf(kwd);
+ ei = e.indexOf(kwd);
+ if (bi !== ei) {
+ e = (ei === -1) ? ea : ba;
+ e[i] += " " + kwd;
+ }
+ }
+ }
+ b = ba.join(", ");
+ e = ea.join(", ");
+ }
+ return _parseComplex(t, this.p, b, e, this.clrs, this.dflt, pt, this.pr, plugin, setRatio);
+ };
+
+ /**
+ * Accepts a target and end value and spits back a CSSPropTween that has been inserted into the CSSPlugin's linked list and conforms with all the conventions we use internally, like type:-1, 0, 1, or 2, setting up any extra property tweens, priority, etc. For example, if we have a boxShadow SpecialProp and call:
+ * this._firstPT = sp.parse(element, "5px 10px 20px rgb(2550,102,51)", "boxShadow", this);
+ * It should figure out the starting value of the element's boxShadow, compare it to the provided end value and create all the necessary CSSPropTweens of the appropriate types to tween the boxShadow. The CSSPropTween that gets spit back should already be inserted into the linked list (the 4th parameter is the current head, so prepend to that).
+ * @param {!Object} t Target object whose property is being tweened
+ * @param {Object} e End value as provided in the vars object (typically a string, but not always - like a throwProps would be an object).
+ * @param {!string} p Property name
+ * @param {!CSSPlugin} cssp The CSSPlugin instance that should be associated with this tween.
+ * @param {?CSSPropTween} pt The CSSPropTween that is the current head of the linked list (we'll prepend to it)
+ * @param {TweenPlugin=} plugin If a plugin will be used to tween the parsed value, this is the plugin instance.
+ * @param {Object=} vars Original vars object that contains the data for parsing.
+ * @return {CSSPropTween} The first CSSPropTween in the linked list which includes the new one(s) added by the parse() call.
+ */
+ p.parse = function(t, e, p, cssp, pt, plugin, vars) {
+ return this.parseComplex(t.style, this.format(_getStyle(t, this.p, _cs, false, this.dflt)), this.format(e), pt, plugin);
+ };
+
+ /**
+ * Registers a special property that should be intercepted from any "css" objects defined in tweens. This allows you to handle them however you want without CSSPlugin doing it for you. The 2nd parameter should be a function that accepts 3 parameters:
+ * 1) Target object whose property should be tweened (typically a DOM element)
+ * 2) The end/destination value (could be a string, number, object, or whatever you want)
+ * 3) The tween instance (you probably don't need to worry about this, but it can be useful for looking up information like the duration)
+ *
+ * Then, your function should return a function which will be called each time the tween gets rendered, passing a numeric "ratio" parameter to your function that indicates the change factor (usually between 0 and 1). For example:
+ *
+ * CSSPlugin.registerSpecialProp("myCustomProp", function(target, value, tween) {
+ * var start = target.style.width;
+ * return function(ratio) {
+ * target.style.width = (start + value * ratio) + "px";
+ * console.log("set width to " + target.style.width);
+ * }
+ * }, 0);
+ *
+ * Then, when I do this tween, it will trigger my special property:
+ *
+ * TweenLite.to(element, 1, {css:{myCustomProp:100}});
+ *
+ * In the example, of course, we're just changing the width, but you can do anything you want.
+ *
+ * @param {!string} name Property name (or comma-delimited list of property names) that should be intercepted and handled by your function. For example, if I define "myCustomProp", then it would handle that portion of the following tween: TweenLite.to(element, 1, {css:{myCustomProp:100}})
+ * @param {!function(Object, Object, Object, string):function(number)} onInitTween The function that will be called when a tween of this special property is performed. The function will receive 4 parameters: 1) Target object that should be tweened, 2) Value that was passed to the tween, 3) The tween instance itself (rarely used), and 4) The property name that's being tweened. Your function should return a function that should be called on every update of the tween. That function will receive a single parameter that is a "change factor" value (typically between 0 and 1) indicating the amount of change as a ratio. You can use this to determine how to set the values appropriately in your function.
+ * @param {number=} priority Priority that helps the engine determine the order in which to set the properties (default: 0). Higher priority properties will be updated before lower priority ones.
+ */
+ CSSPlugin.registerSpecialProp = function(name, onInitTween, priority) {
+ _registerComplexSpecialProp(name, {parser:function(t, e, p, cssp, pt, plugin, vars) {
+ var rv = new CSSPropTween(t, p, 0, 0, pt, 2, p, false, priority);
+ rv.plugin = plugin;
+ rv.setRatio = onInitTween(t, e, cssp._tween, p);
+ return rv;
+ }, priority:priority});
+ };
+
+
+
+
+
+
+
+
+ //transform-related methods and properties
+ var _transformProps = ("scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective").split(","),
+ _transformProp = _checkPropPrefix("transform"), //the Javascript (camelCase) transform property, like msTransform, WebkitTransform, MozTransform, or OTransform.
+ _transformPropCSS = _prefixCSS + "transform",
+ _transformOriginProp = _checkPropPrefix("transformOrigin"),
+ _supports3D = (_checkPropPrefix("perspective") !== null),
+ Transform = _internals.Transform = function() {
+ this.skewY = 0;
+ },
+
+ /**
+ * Parses the transform values for an element, returning an object with x, y, z, scaleX, scaleY, scaleZ, rotation, rotationX, rotationY, skewX, and skewY properties. Note: by default (for performance reasons), all skewing is combined into skewX and rotation but skewY still has a place in the transform object so that we can record how much of the skew is attributed to skewX vs skewY. Remember, a skewY of 10 looks the same as a rotation of 10 and skewX of -10.
+ * @param {!Object} t target element
+ * @param {Object=} cs computed style object (optional)
+ * @param {boolean=} rec if true, the transform values will be recorded to the target element's _gsTransform object, like target._gsTransform = {x:0, y:0, z:0, scaleX:1...}
+ * @param {boolean=} parse if true, we'll ignore any _gsTransform values that already exist on the element, and force a reparsing of the css (calculated style)
+ * @return {object} object containing all of the transform properties/values like {x:0, y:0, z:0, scaleX:1...}
+ */
+ _getTransform = _internals.getTransform = function(t, cs, rec, parse) {
+ if (t._gsTransform && rec && !parse) {
+ return t._gsTransform; //if the element already has a _gsTransform, use that. Note: some browsers don't accurately return the calculated style for the transform (particularly for SVG), so it's almost always safest to just use the values we've already applied rather than re-parsing things.
+ }
+ var tm = rec ? t._gsTransform || new Transform() : new Transform(),
+ invX = (tm.scaleX < 0), //in order to interpret things properly, we need to know if the user applied a negative scaleX previously so that we can adjust the rotation and skewX accordingly. Otherwise, if we always interpret a flipped matrix as affecting scaleY and the user only wants to tween the scaleX on multiple sequential tweens, it would keep the negative scaleY without that being the user's intent.
+ min = 0.00002,
+ rnd = 100000,
+ minAngle = 179.99,
+ minPI = minAngle * _DEG2RAD,
+ zOrigin = _supports3D ? parseFloat(_getStyle(t, _transformOriginProp, cs, false, "0 0 0").split(" ")[2]) || tm.zOrigin || 0 : 0,
+ s, m, i, n, dec, scaleX, scaleY, rotation, skewX, difX, difY, difR, difS;
+ if (_transformProp) {
+ s = _getStyle(t, _transformPropCSS, cs, true);
+ } else if (t.currentStyle) {
+ //for older versions of IE, we need to interpret the filter portion that is in the format: progid:DXImageTransform.Microsoft.Matrix(M11=6.123233995736766e-17, M12=-1, M21=1, M22=6.123233995736766e-17, sizingMethod='auto expand') Notice that we need to swap b and c compared to a normal matrix.
+ s = t.currentStyle.filter.match(_ieGetMatrixExp);
+ s = (s && s.length === 4) ? [s[0].substr(4), Number(s[2].substr(4)), Number(s[1].substr(4)), s[3].substr(4), (tm.x || 0), (tm.y || 0)].join(",") : "";
+ }
+ //split the matrix values out into an array (m for matrix)
+ m = (s || "").match(/(?:\-|\b)[\d\-\.e]+\b/gi) || [];
+ i = m.length;
+ while (--i > -1) {
+ n = Number(m[i]);
+ m[i] = (dec = n - (n |= 0)) ? ((dec * rnd + (dec < 0 ? -0.5 : 0.5)) | 0) / rnd + n : n; //convert strings to Numbers and round to 5 decimal places to avoid issues with tiny numbers. Roughly 20x faster than Number.toFixed(). We also must make sure to round before dividing so that values like 0.9999999999 become 1 to avoid glitches in browser rendering and interpretation of flipped/rotated 3D matrices. And don't just multiply the number by rnd, floor it, and then divide by rnd because the bitwise operations max out at a 32-bit signed integer, thus it could get clipped at a relatively low value (like 22,000.00000 for example).
+ }
+ if (m.length === 16) {
+
+ //we'll only look at these position-related 6 variables first because if x/y/z all match, it's relatively safe to assume we don't need to re-parse everything which risks losing important rotational information (like rotationX:180 plus rotationY:180 would look the same as rotation:180 - there's no way to know for sure which direction was taken based solely on the matrix3d() values)
+ var a13 = m[8], a23 = m[9], a33 = m[10],
+ a14 = m[12], a24 = m[13], a34 = m[14];
+
+ //we manually compensate for non-zero z component of transformOrigin to work around bugs in Safari
+ if (tm.zOrigin) {
+ a34 = -tm.zOrigin;
+ a14 = a13*a34-m[12];
+ a24 = a23*a34-m[13];
+ a34 = a33*a34+tm.zOrigin-m[14];
+ }
+
+ //only parse from the matrix if we MUST because not only is it usually unnecessary due to the fact that we store the values in the _gsTransform object, but also because it's impossible to accurately interpret rotationX, rotationY, rotationZ, scaleX, and scaleY if all are applied, so it's much better to rely on what we store. However, we must parse the first time that an object is tweened. We also assume that if the position has changed, the user must have done some styling changes outside of CSSPlugin, thus we force a parse in that scenario.
+ if (!rec || parse || tm.rotationX == null) {
+ var a11 = m[0], a21 = m[1], a31 = m[2], a41 = m[3],
+ a12 = m[4], a22 = m[5], a32 = m[6], a42 = m[7],
+ a43 = m[11],
+ angle = Math.atan2(a32, a33),
+ xFlip = (angle < -minPI || angle > minPI),
+ t1, t2, t3, cos, sin, yFlip, zFlip;
+ tm.rotationX = angle * _RAD2DEG;
+ //rotationX
+ if (angle) {
+ cos = Math.cos(-angle);
+ sin = Math.sin(-angle);
+ t1 = a12*cos+a13*sin;
+ t2 = a22*cos+a23*sin;
+ t3 = a32*cos+a33*sin;
+ a13 = a12*-sin+a13*cos;
+ a23 = a22*-sin+a23*cos;
+ a33 = a32*-sin+a33*cos;
+ a43 = a42*-sin+a43*cos;
+ a12 = t1;
+ a22 = t2;
+ a32 = t3;
+ }
+ //rotationY
+ angle = Math.atan2(a13, a11);
+ tm.rotationY = angle * _RAD2DEG;
+ if (angle) {
+ yFlip = (angle < -minPI || angle > minPI);
+ cos = Math.cos(-angle);
+ sin = Math.sin(-angle);
+ t1 = a11*cos-a13*sin;
+ t2 = a21*cos-a23*sin;
+ t3 = a31*cos-a33*sin;
+ a23 = a21*sin+a23*cos;
+ a33 = a31*sin+a33*cos;
+ a43 = a41*sin+a43*cos;
+ a11 = t1;
+ a21 = t2;
+ a31 = t3;
+ }
+ //rotationZ
+ angle = Math.atan2(a21, a22);
+ tm.rotation = angle * _RAD2DEG;
+ if (angle) {
+ zFlip = (angle < -minPI || angle > minPI);
+ cos = Math.cos(-angle);
+ sin = Math.sin(-angle);
+ a11 = a11*cos+a12*sin;
+ t2 = a21*cos+a22*sin;
+ a22 = a21*-sin+a22*cos;
+ a32 = a31*-sin+a32*cos;
+ a21 = t2;
+ }
+
+ if (zFlip && xFlip) {
+ tm.rotation = tm.rotationX = 0;
+ } else if (zFlip && yFlip) {
+ tm.rotation = tm.rotationY = 0;
+ } else if (yFlip && xFlip) {
+ tm.rotationY = tm.rotationX = 0;
+ }
+
+ tm.scaleX = ((Math.sqrt(a11 * a11 + a21 * a21) * rnd + 0.5) | 0) / rnd;
+ tm.scaleY = ((Math.sqrt(a22 * a22 + a23 * a23) * rnd + 0.5) | 0) / rnd;
+ tm.scaleZ = ((Math.sqrt(a32 * a32 + a33 * a33) * rnd + 0.5) | 0) / rnd;
+ tm.skewX = 0;
+ tm.perspective = a43 ? 1 / ((a43 < 0) ? -a43 : a43) : 0;
+ tm.x = a14;
+ tm.y = a24;
+ tm.z = a34;
+ }
+
+ } else if ((!_supports3D || parse || !m.length || tm.x !== m[4] || tm.y !== m[5] || (!tm.rotationX && !tm.rotationY)) && !(tm.x !== undefined && _getStyle(t, "display", cs) === "none")) { //sometimes a 6-element matrix is returned even when we performed 3D transforms, like if rotationX and rotationY are 180. In cases like this, we still need to honor the 3D transforms. If we just rely on the 2D info, it could affect how the data is interpreted, like scaleY might get set to -1 or rotation could get offset by 180 degrees. For example, do a TweenLite.to(element, 1, {css:{rotationX:180, rotationY:180}}) and then later, TweenLite.to(element, 1, {css:{rotationX:0}}) and without this conditional logic in place, it'd jump to a state of being unrotated when the 2nd tween starts. Then again, we need to honor the fact that the user COULD alter the transforms outside of CSSPlugin, like by manually applying new css, so we try to sense that by looking at x and y because if those changed, we know the changes were made outside CSSPlugin and we force a reinterpretation of the matrix values. Also, in Webkit browsers, if the element's "display" is "none", its calculated style value will always return empty, so if we've already recorded the values in the _gsTransform object, we'll just rely on those.
+ var k = (m.length >= 6),
+ a = k ? m[0] : 1,
+ b = m[1] || 0,
+ c = m[2] || 0,
+ d = k ? m[3] : 1;
+ tm.x = m[4] || 0;
+ tm.y = m[5] || 0;
+ scaleX = Math.sqrt(a * a + b * b);
+ scaleY = Math.sqrt(d * d + c * c);
+ rotation = (a || b) ? Math.atan2(b, a) * _RAD2DEG : tm.rotation || 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist).
+ skewX = (c || d) ? Math.atan2(c, d) * _RAD2DEG + rotation : tm.skewX || 0;
+ difX = scaleX - Math.abs(tm.scaleX || 0);
+ difY = scaleY - Math.abs(tm.scaleY || 0);
+ if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) {
+ if (invX) {
+ scaleX *= -1;
+ skewX += (rotation <= 0) ? 180 : -180;
+ rotation += (rotation <= 0) ? 180 : -180;
+ } else {
+ scaleY *= -1;
+ skewX += (skewX <= 0) ? 180 : -180;
+ }
+ }
+ difR = (rotation - tm.rotation) % 180; //note: matching ranges would be very small (+/-0.0001) or very close to 180.
+ difS = (skewX - tm.skewX) % 180;
+ //if there's already a recorded _gsTransform in place for the target, we should leave those values in place unless we know things changed for sure (beyond a super small amount). This gets around ambiguous interpretations, like if scaleX and scaleY are both -1, the matrix would be the same as if the rotation was 180 with normal scaleX/scaleY. If the user tweened to particular values, those must be prioritized to ensure animation is consistent.
+ if (tm.skewX === undefined || difX > min || difX < -min || difY > min || difY < -min || (difR > -minAngle && difR < minAngle && (difR * rnd) | 0 !== 0) || (difS > -minAngle && difS < minAngle && (difS * rnd) | 0 !== 0)) {
+ tm.scaleX = scaleX;
+ tm.scaleY = scaleY;
+ tm.rotation = rotation;
+ tm.skewX = skewX;
+ }
+ if (_supports3D) {
+ tm.rotationX = tm.rotationY = tm.z = 0;
+ tm.perspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0;
+ tm.scaleZ = 1;
+ }
+ }
+ tm.zOrigin = zOrigin;
+
+ //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 0 in these cases. The conditional logic here is faster than calling Math.abs(). Also, browsers tend to render a SLIGHTLY rotated object in a fuzzy way, so we need to snap to exactly 0 when appropriate.
+ for (i in tm) {
+ if (tm[i] < min) if (tm[i] > -min) {
+ tm[i] = 0;
+ }
+ }
+ //DEBUG: _log("parsed rotation: "+(tm.rotationX)+", "+(tm.rotationY)+", "+(tm.rotation)+", scale: "+tm.scaleX+", "+tm.scaleY+", "+tm.scaleZ+", position: "+tm.x+", "+tm.y+", "+tm.z+", perspective: "+tm.perspective);
+ if (rec) {
+ t._gsTransform = tm; //record to the object's _gsTransform which we use so that tweens can control individual properties independently (we need all the properties to accurately recompose the matrix in the setRatio() method)
+ }
+ return tm;
+ },
+
+ //for setting 2D transforms in IE6, IE7, and IE8 (must use a "filter" to emulate the behavior of modern day browser transforms)
+ _setIETransformRatio = function(v) {
+ var t = this.data, //refers to the element's _gsTransform object
+ ang = -t.rotation * _DEG2RAD,
+ skew = ang + t.skewX * _DEG2RAD,
+ rnd = 100000,
+ a = ((Math.cos(ang) * t.scaleX * rnd) | 0) / rnd,
+ b = ((Math.sin(ang) * t.scaleX * rnd) | 0) / rnd,
+ c = ((Math.sin(skew) * -t.scaleY * rnd) | 0) / rnd,
+ d = ((Math.cos(skew) * t.scaleY * rnd) | 0) / rnd,
+ style = this.t.style,
+ cs = this.t.currentStyle,
+ filters, val;
+ if (!cs) {
+ return;
+ }
+ val = b; //just for swapping the variables an inverting them (reused "val" to avoid creating another variable in memory). IE's filter matrix uses a non-standard matrix configuration (angle goes the opposite way, and b and c are reversed and inverted)
+ b = -c;
+ c = -val;
+ filters = cs.filter;
+ style.filter = ""; //remove filters so that we can accurately measure offsetWidth/offsetHeight
+ var w = this.t.offsetWidth,
+ h = this.t.offsetHeight,
+ clip = (cs.position !== "absolute"),
+ m = "progid:DXImageTransform.Microsoft.Matrix(M11=" + a + ", M12=" + b + ", M21=" + c + ", M22=" + d,
+ ox = t.x,
+ oy = t.y,
+ dx, dy;
+
+ //if transformOrigin is being used, adjust the offset x and y
+ if (t.ox != null) {
+ dx = ((t.oxp) ? w * t.ox * 0.01 : t.ox) - w / 2;
+ dy = ((t.oyp) ? h * t.oy * 0.01 : t.oy) - h / 2;
+ ox += dx - (dx * a + dy * b);
+ oy += dy - (dx * c + dy * d);
+ }
+
+ if (!clip) {
+ m += ", sizingMethod='auto expand')";
+ } else {
+ dx = (w / 2);
+ dy = (h / 2);
+ //translate to ensure that transformations occur around the correct origin (default is center).
+ m += ", Dx=" + (dx - (dx * a + dy * b) + ox) + ", Dy=" + (dy - (dx * c + dy * d) + oy) + ")";
+ }
+ if (filters.indexOf("DXImageTransform.Microsoft.Matrix(") !== -1) {
+ style.filter = filters.replace(_ieSetMatrixExp, m);
+ } else {
+ style.filter = m + " " + filters; //we must always put the transform/matrix FIRST (before alpha(opacity=xx)) to avoid an IE bug that slices part of the object when rotation is applied with alpha.
+ }
+
+ //at the end or beginning of the tween, if the matrix is normal (1, 0, 0, 1) and opacity is 100 (or doesn't exist), remove the filter to improve browser performance.
+ if (v === 0 || v === 1) if (a === 1) if (b === 0) if (c === 0) if (d === 1) if (!clip || m.indexOf("Dx=0, Dy=0") !== -1) if (!_opacityExp.test(filters) || parseFloat(RegExp.$1) === 100) if (filters.indexOf("gradient(" && filters.indexOf("Alpha")) === -1) {
+ style.removeAttribute("filter");
+ }
+
+ //we must set the margins AFTER applying the filter in order to avoid some bugs in IE8 that could (in rare scenarios) cause them to be ignored intermittently (vibration).
+ if (!clip) {
+ var mult = (_ieVers < 8) ? 1 : -1, //in Internet Explorer 7 and before, the box model is broken, causing the browser to treat the width/height of the actual rotated filtered image as the width/height of the box itself, but Microsoft corrected that in IE8. We must use a negative offset in IE8 on the right/bottom
+ marg, prop, dif;
+ dx = t.ieOffsetX || 0;
+ dy = t.ieOffsetY || 0;
+ t.ieOffsetX = Math.round((w - ((a < 0 ? -a : a) * w + (b < 0 ? -b : b) * h)) / 2 + ox);
+ t.ieOffsetY = Math.round((h - ((d < 0 ? -d : d) * h + (c < 0 ? -c : c) * w)) / 2 + oy);
+ for (i = 0; i < 4; i++) {
+ prop = _margins[i];
+ marg = cs[prop];
+ //we need to get the current margin in case it is being tweened separately (we want to respect that tween's changes)
+ val = (marg.indexOf("px") !== -1) ? parseFloat(marg) : _convertToPixels(this.t, prop, parseFloat(marg), marg.replace(_suffixExp, "")) || 0;
+ if (val !== t[prop]) {
+ dif = (i < 2) ? -t.ieOffsetX : -t.ieOffsetY; //if another tween is controlling a margin, we cannot only apply the difference in the ieOffsets, so we essentially zero-out the dx and dy here in that case. We record the margin(s) later so that we can keep comparing them, making this code very flexible.
+ } else {
+ dif = (i < 2) ? dx - t.ieOffsetX : dy - t.ieOffsetY;
+ }
+ style[prop] = (t[prop] = Math.round( val - dif * ((i === 0 || i === 2) ? 1 : mult) )) + "px";
+ }
+ }
+ },
+
+ _set3DTransformRatio = _internals.set3DTransformRatio = function(v) {
+ var t = this.data, //refers to the element's _gsTransform object
+ style = this.t.style,
+ angle = t.rotation * _DEG2RAD,
+ sx = t.scaleX,
+ sy = t.scaleY,
+ sz = t.scaleZ,
+ perspective = t.perspective,
+ a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43,
+ zOrigin, rnd, cos, sin, t1, t2, t3, t4;
+ if (v === 1 || v === 0) if (t.force3D === "auto") if (!t.rotationY && !t.rotationX && sz === 1 && !perspective && !t.z) { //on the final render (which could be 0 for a from tween), if there are no 3D aspects, render in 2D to free up memory and improve performance especially on mobile devices
+ _set2DTransformRatio.call(this, v);
+ return;
+ }
+ if (_isFirefox) {
+ var n = 0.0001;
+ if (sx < n && sx > -n) { //Firefox has a bug (at least in v25) that causes it to render the transparent part of 32-bit PNG images as black when displayed inside an iframe and the 3D scale is very small and doesn't change sufficiently enough between renders (like if you use a Power4.easeInOut to scale from 0 to 1 where the beginning values only change a tiny amount to begin the tween before accelerating). In this case, we force the scale to be 0.00002 instead which is visually the same but works around the Firefox issue.
+ sx = sz = 0.00002;
+ }
+ if (sy < n && sy > -n) {
+ sy = sz = 0.00002;
+ }
+ if (perspective && !t.z && !t.rotationX && !t.rotationY) { //Firefox has a bug that causes elements to have an odd super-thin, broken/dotted black border on elements that have a perspective set but aren't utilizing 3D space (no rotationX, rotationY, or z).
+ perspective = 0;
+ }
+ }
+ if (angle || t.skewX) {
+ cos = Math.cos(angle);
+ sin = Math.sin(angle);
+ a11 = cos;
+ a21 = sin;
+ if (t.skewX) {
+ angle -= t.skewX * _DEG2RAD;
+ cos = Math.cos(angle);
+ sin = Math.sin(angle);
+ if (t.skewType === "simple") { //by default, we compensate skewing on the other axis to make it look more natural, but you can set the skewType to "simple" to use the uncompensated skewing that CSS does
+ t1 = Math.tan(t.skewX * _DEG2RAD);
+ t1 = Math.sqrt(1 + t1 * t1);
+ cos *= t1;
+ sin *= t1;
+ }
+ }
+ a12 = -sin;
+ a22 = cos;
+
+ } else if (!t.rotationY && !t.rotationX && sz === 1 && !perspective) { //if we're only translating and/or 2D scaling, this is faster...
+ style[_transformProp] = "translate3d(" + t.x + "px," + t.y + "px," + t.z +"px)" + ((sx !== 1 || sy !== 1) ? " scale(" + sx + "," + sy + ")" : "");
+ return;
+ } else {
+ a11 = a22 = 1;
+ a12 = a21 = 0;
+ }
+ a33 = 1;
+ a13 = a14 = a23 = a24 = a31 = a32 = a34 = a41 = a42 = 0;
+ a43 = (perspective) ? -1 / perspective : 0;
+ zOrigin = t.zOrigin;
+ rnd = 100000;
+ angle = t.rotationY * _DEG2RAD;
+ if (angle) {
+ cos = Math.cos(angle);
+ sin = Math.sin(angle);
+ a31 = a33*-sin;
+ a41 = a43*-sin;
+ a13 = a11*sin;
+ a23 = a21*sin;
+ a33 *= cos;
+ a43 *= cos;
+ a11 *= cos;
+ a21 *= cos;
+ }
+ angle = t.rotationX * _DEG2RAD;
+ if (angle) {
+ cos = Math.cos(angle);
+ sin = Math.sin(angle);
+ t1 = a12*cos+a13*sin;
+ t2 = a22*cos+a23*sin;
+ t3 = a32*cos+a33*sin;
+ t4 = a42*cos+a43*sin;
+ a13 = a12*-sin+a13*cos;
+ a23 = a22*-sin+a23*cos;
+ a33 = a32*-sin+a33*cos;
+ a43 = a42*-sin+a43*cos;
+ a12 = t1;
+ a22 = t2;
+ a32 = t3;
+ a42 = t4;
+ }
+ if (sz !== 1) {
+ a13*=sz;
+ a23*=sz;
+ a33*=sz;
+ a43*=sz;
+ }
+ if (sy !== 1) {
+ a12*=sy;
+ a22*=sy;
+ a32*=sy;
+ a42*=sy;
+ }
+ if (sx !== 1) {
+ a11*=sx;
+ a21*=sx;
+ a31*=sx;
+ a41*=sx;
+ }
+ if (zOrigin) {
+ a34 -= zOrigin;
+ a14 = a13*a34;
+ a24 = a23*a34;
+ a34 = a33*a34+zOrigin;
+ }
+ //we round the x, y, and z slightly differently to allow even larger values.
+ a14 = (t1 = (a14 += t.x) - (a14 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a14 : a14;
+ a24 = (t1 = (a24 += t.y) - (a24 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a24 : a24;
+ a34 = (t1 = (a34 += t.z) - (a34 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a34 : a34;
+ style[_transformProp] = "matrix3d(" + [ (((a11 * rnd) | 0) / rnd), (((a21 * rnd) | 0) / rnd), (((a31 * rnd) | 0) / rnd), (((a41 * rnd) | 0) / rnd), (((a12 * rnd) | 0) / rnd), (((a22 * rnd) | 0) / rnd), (((a32 * rnd) | 0) / rnd), (((a42 * rnd) | 0) / rnd), (((a13 * rnd) | 0) / rnd), (((a23 * rnd) | 0) / rnd), (((a33 * rnd) | 0) / rnd), (((a43 * rnd) | 0) / rnd), a14, a24, a34, (perspective ? (1 + (-a34 / perspective)) : 1) ].join(",") + ")";
+ },
+
+ _set2DTransformRatio = _internals.set2DTransformRatio = function(v) {
+ var t = this.data, //refers to the element's _gsTransform object
+ targ = this.t,
+ style = targ.style,
+ ang, skew, rnd, sx, sy;
+ if (t.rotationX || t.rotationY || t.z || t.force3D === true || (t.force3D === "auto" && v !== 1 && v !== 0)) { //if a 3D tween begins while a 2D one is running, we need to kick the rendering over to the 3D method. For example, imagine a yoyo-ing, infinitely repeating scale tween running, and then the object gets rotated in 3D space with a different tween.
+ this.setRatio = _set3DTransformRatio;
+ _set3DTransformRatio.call(this, v);
+ return;
+ }
+ if (!t.rotation && !t.skewX) {
+ style[_transformProp] = "matrix(" + t.scaleX + ",0,0," + t.scaleY + "," + t.x + "," + t.y + ")";
+ } else {
+ ang = t.rotation * _DEG2RAD;
+ skew = ang - t.skewX * _DEG2RAD;
+ rnd = 100000;
+ sx = t.scaleX * rnd;
+ sy = t.scaleY * rnd;
+ //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 5 decimal places.
+ style[_transformProp] = "matrix(" + (((Math.cos(ang) * sx) | 0) / rnd) + "," + (((Math.sin(ang) * sx) | 0) / rnd) + "," + (((Math.sin(skew) * -sy) | 0) / rnd) + "," + (((Math.cos(skew) * sy) | 0) / rnd) + "," + t.x + "," + t.y + ")";
+ }
+ };
+
+ _registerComplexSpecialProp("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType", {parser:function(t, e, p, cssp, pt, plugin, vars) {
+ if (cssp._transform) { return pt; } //only need to parse the transform once, and only if the browser supports it.
+ var m1 = cssp._transform = _getTransform(t, _cs, true, vars.parseTransform),
+ style = t.style,
+ min = 0.000001,
+ i = _transformProps.length,
+ v = vars,
+ endRotations = {},
+ m2, skewY, copy, orig, has3D, hasChange, dr;
+ if (typeof(v.transform) === "string" && _transformProp) { //for values like transform:"rotate(60deg) scale(0.5, 0.8)"
+ copy = _tempDiv.style; //don't use the original target because it might be SVG in which case some browsers don't report computed style correctly.
+ copy[_transformProp] = v.transform;
+ copy.display = "block"; //if display is "none", the browser often refuses to report the transform properties correctly.
+ copy.position = "absolute";
+ _doc.body.appendChild(_tempDiv);
+ m2 = _getTransform(_tempDiv, null, false);
+ _doc.body.removeChild(_tempDiv);
+ } else if (typeof(v) === "object") { //for values like scaleX, scaleY, rotation, x, y, skewX, and skewY or transform:{...} (object)
+ m2 = {scaleX:_parseVal((v.scaleX != null) ? v.scaleX : v.scale, m1.scaleX),
+ scaleY:_parseVal((v.scaleY != null) ? v.scaleY : v.scale, m1.scaleY),
+ scaleZ:_parseVal(v.scaleZ, m1.scaleZ),
+ x:_parseVal(v.x, m1.x),
+ y:_parseVal(v.y, m1.y),
+ z:_parseVal(v.z, m1.z),
+ perspective:_parseVal(v.transformPerspective, m1.perspective)};
+ dr = v.directionalRotation;
+ if (dr != null) {
+ if (typeof(dr) === "object") {
+ for (copy in dr) {
+ v[copy] = dr[copy];
+ }
+ } else {
+ v.rotation = dr;
+ }
+ }
+ m2.rotation = _parseAngle(("rotation" in v) ? v.rotation : ("shortRotation" in v) ? v.shortRotation + "_short" : ("rotationZ" in v) ? v.rotationZ : m1.rotation, m1.rotation, "rotation", endRotations);
+ if (_supports3D) {
+ m2.rotationX = _parseAngle(("rotationX" in v) ? v.rotationX : ("shortRotationX" in v) ? v.shortRotationX + "_short" : m1.rotationX || 0, m1.rotationX, "rotationX", endRotations);
+ m2.rotationY = _parseAngle(("rotationY" in v) ? v.rotationY : ("shortRotationY" in v) ? v.shortRotationY + "_short" : m1.rotationY || 0, m1.rotationY, "rotationY", endRotations);
+ }
+ m2.skewX = (v.skewX == null) ? m1.skewX : _parseAngle(v.skewX, m1.skewX);
+
+ //note: for performance reasons, we combine all skewing into the skewX and rotation values, ignoring skewY but we must still record it so that we can discern how much of the overall skew is attributed to skewX vs. skewY. Otherwise, if the skewY would always act relative (tween skewY to 10deg, for example, multiple times and if we always combine things into skewX, we can't remember that skewY was 10 from last time). Remember, a skewY of 10 degrees looks the same as a rotation of 10 degrees plus a skewX of -10 degrees.
+ m2.skewY = (v.skewY == null) ? m1.skewY : _parseAngle(v.skewY, m1.skewY);
+ if ((skewY = m2.skewY - m1.skewY)) {
+ m2.skewX += skewY;
+ m2.rotation += skewY;
+ }
+ }
+
+ if (_supports3D && v.force3D != null) {
+ m1.force3D = v.force3D;
+ hasChange = true;
+ }
+
+ m1.skewType = v.skewType || m1.skewType || CSSPlugin.defaultSkewType;
+
+ has3D = (m1.force3D || m1.z || m1.rotationX || m1.rotationY || m2.z || m2.rotationX || m2.rotationY || m2.perspective);
+ if (!has3D && v.scale != null) {
+ m2.scaleZ = 1; //no need to tween scaleZ.
+ }
+
+ while (--i > -1) {
+ p = _transformProps[i];
+ orig = m2[p] - m1[p];
+ if (orig > min || orig < -min || _forcePT[p] != null) {
+ hasChange = true;
+ pt = new CSSPropTween(m1, p, m1[p], orig, pt);
+ if (p in endRotations) {
+ pt.e = endRotations[p]; //directional rotations typically have compensated values during the tween, but we need to make sure they end at exactly what the user requested
+ }
+ pt.xs0 = 0; //ensures the value stays numeric in setRatio()
+ pt.plugin = plugin;
+ cssp._overwriteProps.push(pt.n);
+ }
+ }
+
+ orig = v.transformOrigin;
+ if (orig || (_supports3D && has3D && m1.zOrigin)) { //if anything 3D is happening and there's a transformOrigin with a z component that's non-zero, we must ensure that the transformOrigin's z-component is set to 0 so that we can manually do those calculations to get around Safari bugs. Even if the user didn't specifically define a "transformOrigin" in this particular tween (maybe they did it via css directly).
+ if (_transformProp) {
+ hasChange = true;
+ p = _transformOriginProp;
+ orig = (orig || _getStyle(t, p, _cs, false, "50% 50%")) + ""; //cast as string to avoid errors
+ pt = new CSSPropTween(style, p, 0, 0, pt, -1, "transformOrigin");
+ pt.b = style[p];
+ pt.plugin = plugin;
+ if (_supports3D) {
+ copy = m1.zOrigin;
+ orig = orig.split(" ");
+ m1.zOrigin = ((orig.length > 2 && !(copy !== 0 && orig[2] === "0px")) ? parseFloat(orig[2]) : copy) || 0; //Safari doesn't handle the z part of transformOrigin correctly, so we'll manually handle it in the _set3DTransformRatio() method.
+ pt.xs0 = pt.e = orig[0] + " " + (orig[1] || "50%") + " 0px"; //we must define a z value of 0px specifically otherwise iOS 5 Safari will stick with the old one (if one was defined)!
+ pt = new CSSPropTween(m1, "zOrigin", 0, 0, pt, -1, pt.n); //we must create a CSSPropTween for the _gsTransform.zOrigin so that it gets reset properly at the beginning if the tween runs backward (as opposed to just setting m1.zOrigin here)
+ pt.b = copy;
+ pt.xs0 = pt.e = m1.zOrigin;
+ } else {
+ pt.xs0 = pt.e = orig;
+ }
+
+ //for older versions of IE (6-8), we need to manually calculate things inside the setRatio() function. We record origin x and y (ox and oy) and whether or not the values are percentages (oxp and oyp).
+ } else {
+ _parsePosition(orig + "", m1);
+ }
+ }
+
+ if (hasChange) {
+ cssp._transformType = (has3D || this._transformType === 3) ? 3 : 2; //quicker than calling cssp._enableTransforms();
+ }
+ return pt;
+ }, prefix:true});
+
+ _registerComplexSpecialProp("boxShadow", {defaultValue:"0px 0px 0px 0px #999", prefix:true, color:true, multi:true, keyword:"inset"});
+
+ _registerComplexSpecialProp("borderRadius", {defaultValue:"0px", parser:function(t, e, p, cssp, pt, plugin) {
+ e = this.format(e);
+ var props = ["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],
+ style = t.style,
+ ea1, i, es2, bs2, bs, es, bn, en, w, h, esfx, bsfx, rel, hn, vn, em;
+ w = parseFloat(t.offsetWidth);
+ h = parseFloat(t.offsetHeight);
+ ea1 = e.split(" ");
+ for (i = 0; i < props.length; i++) { //if we're dealing with percentages, we must convert things separately for the horizontal and vertical axis!
+ if (this.p.indexOf("border")) { //older browsers used a prefix
+ props[i] = _checkPropPrefix(props[i]);
+ }
+ bs = bs2 = _getStyle(t, props[i], _cs, false, "0px");
+ if (bs.indexOf(" ") !== -1) {
+ bs2 = bs.split(" ");
+ bs = bs2[0];
+ bs2 = bs2[1];
+ }
+ es = es2 = ea1[i];
+ bn = parseFloat(bs);
+ bsfx = bs.substr((bn + "").length);
+ rel = (es.charAt(1) === "=");
+ if (rel) {
+ en = parseInt(es.charAt(0)+"1", 10);
+ es = es.substr(2);
+ en *= parseFloat(es);
+ esfx = es.substr((en + "").length - (en < 0 ? 1 : 0)) || "";
+ } else {
+ en = parseFloat(es);
+ esfx = es.substr((en + "").length);
+ }
+ if (esfx === "") {
+ esfx = _suffixMap[p] || bsfx;
+ }
+ if (esfx !== bsfx) {
+ hn = _convertToPixels(t, "borderLeft", bn, bsfx); //horizontal number (we use a bogus "borderLeft" property just because the _convertToPixels() method searches for the keywords "Left", "Right", "Top", and "Bottom" to determine of it's a horizontal or vertical property, and we need "border" in the name so that it knows it should measure relative to the element itself, not its parent.
+ vn = _convertToPixels(t, "borderTop", bn, bsfx); //vertical number
+ if (esfx === "%") {
+ bs = (hn / w * 100) + "%";
+ bs2 = (vn / h * 100) + "%";
+ } else if (esfx === "em") {
+ em = _convertToPixels(t, "borderLeft", 1, "em");
+ bs = (hn / em) + "em";
+ bs2 = (vn / em) + "em";
+ } else {
+ bs = hn + "px";
+ bs2 = vn + "px";
+ }
+ if (rel) {
+ es = (parseFloat(bs) + en) + esfx;
+ es2 = (parseFloat(bs2) + en) + esfx;
+ }
+ }
+ pt = _parseComplex(style, props[i], bs + " " + bs2, es + " " + es2, false, "0px", pt);
+ }
+ return pt;
+ }, prefix:true, formatter:_getFormatter("0px 0px 0px 0px", false, true)});
+ _registerComplexSpecialProp("backgroundPosition", {defaultValue:"0 0", parser:function(t, e, p, cssp, pt, plugin) {
+ var bp = "background-position",
+ cs = (_cs || _getComputedStyle(t, null)),
+ bs = this.format( ((cs) ? _ieVers ? cs.getPropertyValue(bp + "-x") + " " + cs.getPropertyValue(bp + "-y") : cs.getPropertyValue(bp) : t.currentStyle.backgroundPositionX + " " + t.currentStyle.backgroundPositionY) || "0 0"), //Internet Explorer doesn't report background-position correctly - we must query background-position-x and background-position-y and combine them (even in IE10). Before IE9, we must do the same with the currentStyle object and use camelCase
+ es = this.format(e),
+ ba, ea, i, pct, overlap, src;
+ if ((bs.indexOf("%") !== -1) !== (es.indexOf("%") !== -1)) {
+ src = _getStyle(t, "backgroundImage").replace(_urlExp, "");
+ if (src && src !== "none") {
+ ba = bs.split(" ");
+ ea = es.split(" ");
+ _tempImg.setAttribute("src", src); //set the temp <img>'s src to the background-image so that we can measure its width/height
+ i = 2;
+ while (--i > -1) {
+ bs = ba[i];
+ pct = (bs.indexOf("%") !== -1);
+ if (pct !== (ea[i].indexOf("%") !== -1)) {
+ overlap = (i === 0) ? t.offsetWidth - _tempImg.width : t.offsetHeight - _tempImg.height;
+ ba[i] = pct ? (parseFloat(bs) / 100 * overlap) + "px" : (parseFloat(bs) / overlap * 100) + "%";
+ }
+ }
+ bs = ba.join(" ");
+ }
+ }
+ return this.parseComplex(t.style, bs, es, pt, plugin);
+ }, formatter:_parsePosition});
+ _registerComplexSpecialProp("backgroundSize", {defaultValue:"0 0", formatter:_parsePosition});
+ _registerComplexSpecialProp("perspective", {defaultValue:"0px", prefix:true});
+ _registerComplexSpecialProp("perspectiveOrigin", {defaultValue:"50% 50%", prefix:true});
+ _registerComplexSpecialProp("transformStyle", {prefix:true});
+ _registerComplexSpecialProp("backfaceVisibility", {prefix:true});
+ _registerComplexSpecialProp("userSelect", {prefix:true});
+ _registerComplexSpecialProp("margin", {parser:_getEdgeParser("marginTop,marginRight,marginBottom,marginLeft")});
+ _registerComplexSpecialProp("padding", {parser:_getEdgeParser("paddingTop,paddingRight,paddingBottom,paddingLeft")});
+ _registerComplexSpecialProp("clip", {defaultValue:"rect(0px,0px,0px,0px)", parser:function(t, e, p, cssp, pt, plugin){
+ var b, cs, delim;
+ if (_ieVers < 9) { //IE8 and earlier don't report a "clip" value in the currentStyle - instead, the values are split apart into clipTop, clipRight, clipBottom, and clipLeft. Also, in IE7 and earlier, the values inside rect() are space-delimited, not comma-delimited.
+ cs = t.currentStyle;
+ delim = _ieVers < 8 ? " " : ",";
+ b = "rect(" + cs.clipTop + delim + cs.clipRight + delim + cs.clipBottom + delim + cs.clipLeft + ")";
+ e = this.format(e).split(",").join(delim);
+ } else {
+ b = this.format(_getStyle(t, this.p, _cs, false, this.dflt));
+ e = this.format(e);
+ }
+ return this.parseComplex(t.style, b, e, pt, plugin);
+ }});
+ _registerComplexSpecialProp("textShadow", {defaultValue:"0px 0px 0px #999", color:true, multi:true});
+ _registerComplexSpecialProp("autoRound,strictUnits", {parser:function(t, e, p, cssp, pt) {return pt;}}); //just so that we can ignore these properties (not tween them)
+ _registerComplexSpecialProp("border", {defaultValue:"0px solid #000", parser:function(t, e, p, cssp, pt, plugin) {
+ return this.parseComplex(t.style, this.format(_getStyle(t, "borderTopWidth", _cs, false, "0px") + " " + _getStyle(t, "borderTopStyle", _cs, false, "solid") + " " + _getStyle(t, "borderTopColor", _cs, false, "#000")), this.format(e), pt, plugin);
+ }, color:true, formatter:function(v) {
+ var a = v.split(" ");
+ return a[0] + " " + (a[1] || "solid") + " " + (v.match(_colorExp) || ["#000"])[0];
+ }});
+ _registerComplexSpecialProp("borderWidth", {parser:_getEdgeParser("borderTopWidth,borderRightWidth,borderBottomWidth,borderLeftWidth")}); //Firefox doesn't pick up on borderWidth set in style sheets (only inline).
+ _registerComplexSpecialProp("float,cssFloat,styleFloat", {parser:function(t, e, p, cssp, pt, plugin) {
+ var s = t.style,
+ prop = ("cssFloat" in s) ? "cssFloat" : "styleFloat";
+ return new CSSPropTween(s, prop, 0, 0, pt, -1, p, false, 0, s[prop], e);
+ }});
+
+ //opacity-related
+ var _setIEOpacityRatio = function(v) {
+ var t = this.t, //refers to the element's style property
+ filters = t.filter || _getStyle(this.data, "filter"),
+ val = (this.s + this.c * v) | 0,
+ skip;
+ if (val === 100) { //for older versions of IE that need to use a filter to apply opacity, we should remove the filter if opacity hits 1 in order to improve performance, but make sure there isn't a transform (matrix) or gradient in the filters.
+ if (filters.indexOf("atrix(") === -1 && filters.indexOf("radient(") === -1 && filters.indexOf("oader(") === -1) {
+ t.removeAttribute("filter");
+ skip = (!_getStyle(this.data, "filter")); //if a class is applied that has an alpha filter, it will take effect (we don't want that), so re-apply our alpha filter in that case. We must first remove it and then check.
+ } else {
+ t.filter = filters.replace(_alphaFilterExp, "");
+ skip = true;
+ }
+ }
+ if (!skip) {
+ if (this.xn1) {
+ t.filter = filters = filters || ("alpha(opacity=" + val + ")"); //works around bug in IE7/8 that prevents changes to "visibility" from being applied properly if the filter is changed to a different alpha on the same frame.
+ }
+ if (filters.indexOf("pacity") === -1) { //only used if browser doesn't support the standard opacity style property (IE 7 and 8). We omit the "O" to avoid case-sensitivity issues
+ if (val !== 0 || !this.xn1) { //bugs in IE7/8 won't render the filter properly if opacity is ADDED on the same frame/render as "visibility" changes (this.xn1 is 1 if this tween is an "autoAlpha" tween)
+ t.filter = filters + " alpha(opacity=" + val + ")"; //we round the value because otherwise, bugs in IE7/8 can prevent "visibility" changes from being applied properly.
+ }
+ } else {
+ t.filter = filters.replace(_opacityExp, "opacity=" + val);
+ }
+ }
+ };
+ _registerComplexSpecialProp("opacity,alpha,autoAlpha", {defaultValue:"1", parser:function(t, e, p, cssp, pt, plugin) {
+ var b = parseFloat(_getStyle(t, "opacity", _cs, false, "1")),
+ style = t.style,
+ isAutoAlpha = (p === "autoAlpha");
+ if (typeof(e) === "string" && e.charAt(1) === "=") {
+ e = ((e.charAt(0) === "-") ? -1 : 1) * parseFloat(e.substr(2)) + b;
+ }
+ if (isAutoAlpha && b === 1 && _getStyle(t, "visibility", _cs) === "hidden" && e !== 0) { //if visibility is initially set to "hidden", we should interpret that as intent to make opacity 0 (a convenience)
+ b = 0;
+ }
+ if (_supportsOpacity) {
+ pt = new CSSPropTween(style, "opacity", b, e - b, pt);
+ } else {
+ pt = new CSSPropTween(style, "opacity", b * 100, (e - b) * 100, pt);
+ pt.xn1 = isAutoAlpha ? 1 : 0; //we need to record whether or not this is an autoAlpha so that in the setRatio(), we know to duplicate the setting of the alpha in order to work around a bug in IE7 and IE8 that prevents changes to "visibility" from taking effect if the filter is changed to a different alpha(opacity) at the same time. Setting it to the SAME value first, then the new value works around the IE7/8 bug.
+ style.zoom = 1; //helps correct an IE issue.
+ pt.type = 2;
+ pt.b = "alpha(opacity=" + pt.s + ")";
+ pt.e = "alpha(opacity=" + (pt.s + pt.c) + ")";
+ pt.data = t;
+ pt.plugin = plugin;
+ pt.setRatio = _setIEOpacityRatio;
+ }
+ if (isAutoAlpha) { //we have to create the "visibility" PropTween after the opacity one in the linked list so that they run in the order that works properly in IE8 and earlier
+ pt = new CSSPropTween(style, "visibility", 0, 0, pt, -1, null, false, 0, ((b !== 0) ? "inherit" : "hidden"), ((e === 0) ? "hidden" : "inherit"));
+ pt.xs0 = "inherit";
+ cssp._overwriteProps.push(pt.n);
+ cssp._overwriteProps.push(p);
+ }
+ return pt;
+ }});
+
+
+ var _removeProp = function(s, p) {
+ if (p) {
+ if (s.removeProperty) {
+ if (p.substr(0,2) === "ms") { //Microsoft browsers don't conform to the standard of capping the first prefix character, so we adjust so that when we prefix the caps with a dash, it's correct (otherwise it'd be "ms-transform" instead of "-ms-transform" for IE9, for example)
+ p = "M" + p.substr(1);
+ }
+ s.removeProperty(p.replace(_capsExp, "-$1").toLowerCase());
+ } else { //note: old versions of IE use "removeAttribute()" instead of "removeProperty()"
+ s.removeAttribute(p);
+ }
+ }
+ },
+ _setClassNameRatio = function(v) {
+ this.t._gsClassPT = this;
+ if (v === 1 || v === 0) {
+ this.t.setAttribute("class", (v === 0) ? this.b : this.e);
+ var mpt = this.data, //first MiniPropTween
+ s = this.t.style;
+ while (mpt) {
+ if (!mpt.v) {
+ _removeProp(s, mpt.p);
+ } else {
+ s[mpt.p] = mpt.v;
+ }
+ mpt = mpt._next;
+ }
+ if (v === 1 && this.t._gsClassPT === this) {
+ this.t._gsClassPT = null;
+ }
+ } else if (this.t.getAttribute("class") !== this.e) {
+ this.t.setAttribute("class", this.e);
+ }
+ };
+ _registerComplexSpecialProp("className", {parser:function(t, e, p, cssp, pt, plugin, vars) {
+ var b = t.getAttribute("class") || "", //don't use t.className because it doesn't work consistently on SVG elements; getAttribute("class") and setAttribute("class", value") is more reliable.
+ cssText = t.style.cssText,
+ difData, bs, cnpt, cnptLookup, mpt;
+ pt = cssp._classNamePT = new CSSPropTween(t, p, 0, 0, pt, 2);
+ pt.setRatio = _setClassNameRatio;
+ pt.pr = -11;
+ _hasPriority = true;
+ pt.b = b;
+ bs = _getAllStyles(t, _cs);
+ //if there's a className tween already operating on the target, force it to its end so that the necessary inline styles are removed and the class name is applied before we determine the end state (we don't want inline styles interfering that were there just for class-specific values)
+ cnpt = t._gsClassPT;
+ if (cnpt) {
+ cnptLookup = {};
+ mpt = cnpt.data; //first MiniPropTween which stores the inline styles - we need to force these so that the inline styles don't contaminate things. Otherwise, there's a small chance that a tween could start and the inline values match the destination values and they never get cleaned.
+ while (mpt) {
+ cnptLookup[mpt.p] = 1;
+ mpt = mpt._next;
+ }
+ cnpt.setRatio(1);
+ }
+ t._gsClassPT = pt;
+ pt.e = (e.charAt(1) !== "=") ? e : b.replace(new RegExp("\\s*\\b" + e.substr(2) + "\\b"), "") + ((e.charAt(0) === "+") ? " " + e.substr(2) : "");
+ if (cssp._tween._duration) { //if it's a zero-duration tween, there's no need to tween anything or parse the data. In fact, if we switch classes temporarily (which we must do for proper parsing) and the class has a transition applied, it could cause a quick flash to the end state and back again initially in some browsers.
+ t.setAttribute("class", pt.e);
+ difData = _cssDif(t, bs, _getAllStyles(t), vars, cnptLookup);
+ t.setAttribute("class", b);
+ pt.data = difData.firstMPT;
+ t.style.cssText = cssText; //we recorded cssText before we swapped classes and ran _getAllStyles() because in cases when a className tween is overwritten, we remove all the related tweening properties from that class change (otherwise class-specific stuff can't override properties we've directly set on the target's style object due to specificity).
+ pt = pt.xfirst = cssp.parse(t, difData.difs, pt, plugin); //we record the CSSPropTween as the xfirst so that we can handle overwriting propertly (if "className" gets overwritten, we must kill all the properties associated with the className part of the tween, so we can loop through from xfirst to the pt itself)
+ }
+ return pt;
+ }});
+
+
+ var _setClearPropsRatio = function(v) {
+ if (v === 1 || v === 0) if (this.data._totalTime === this.data._totalDuration && this.data.data !== "isFromStart") { //this.data refers to the tween. Only clear at the END of the tween (remember, from() tweens make the ratio go from 1 to 0, so we can't just check that and if the tween is the zero-duration one that's created internally to render the starting values in a from() tween, ignore that because otherwise, for example, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in).
+ var s = this.t.style,
+ transformParse = _specialProps.transform.parse,
+ a, p, i, clearTransform;
+ if (this.e === "all") {
+ s.cssText = "";
+ clearTransform = true;
+ } else {
+ a = this.e.split(",");
+ i = a.length;
+ while (--i > -1) {
+ p = a[i];
+ if (_specialProps[p]) {
+ if (_specialProps[p].parse === transformParse) {
+ clearTransform = true;
+ } else {
+ p = (p === "transformOrigin") ? _transformOriginProp : _specialProps[p].p; //ensures that special properties use the proper browser-specific property name, like "scaleX" might be "-webkit-transform" or "boxShadow" might be "-moz-box-shadow"
+ }
+ }
+ _removeProp(s, p);
+ }
+ }
+ if (clearTransform) {
+ _removeProp(s, _transformProp);
+ if (this.t._gsTransform) {
+ delete this.t._gsTransform;
+ }
+ }
+
+ }
+ };
+ _registerComplexSpecialProp("clearProps", {parser:function(t, e, p, cssp, pt) {
+ pt = new CSSPropTween(t, p, 0, 0, pt, 2);
+ pt.setRatio = _setClearPropsRatio;
+ pt.e = e;
+ pt.pr = -10;
+ pt.data = cssp._tween;
+ _hasPriority = true;
+ return pt;
+ }});
+
+ p = "bezier,throwProps,physicsProps,physics2D".split(",");
+ i = p.length;
+ while (i--) {
+ _registerPluginProp(p[i]);
+ }
+
+
+
+
+
+
+
+
+ p = CSSPlugin.prototype;
+ p._firstPT = null;
+
+ //gets called when the tween renders for the first time. This kicks everything off, recording start/end values, etc.
+ p._onInitTween = function(target, vars, tween) {
+ if (!target.nodeType) { //css is only for dom elements
+ return false;
+ }
+ this._target = target;
+ this._tween = tween;
+ this._vars = vars;
+ _autoRound = vars.autoRound;
+ _hasPriority = false;
+ _suffixMap = vars.suffixMap || CSSPlugin.suffixMap;
+ _cs = _getComputedStyle(target, "");
+ _overwriteProps = this._overwriteProps;
+ var style = target.style,
+ v, pt, pt2, first, last, next, zIndex, tpt, threeD;
+ if (_reqSafariFix) if (style.zIndex === "") {
+ v = _getStyle(target, "zIndex", _cs);
+ if (v === "auto" || v === "") {
+ //corrects a bug in [non-Android] Safari that prevents it from repainting elements in their new positions if they don't have a zIndex set. We also can't just apply this inside _parseTransform() because anything that's moved in any way (like using "left" or "top" instead of transforms like "x" and "y") can be affected, so it is best to ensure that anything that's tweening has a z-index. Setting "WebkitPerspective" to a non-zero value worked too except that on iOS Safari things would flicker randomly. Plus zIndex is less memory-intensive.
+ this._addLazySet(style, "zIndex", 0);
+ }
+ }
+
+ if (typeof(vars) === "string") {
+ first = style.cssText;
+ v = _getAllStyles(target, _cs);
+ style.cssText = first + ";" + vars;
+ v = _cssDif(target, v, _getAllStyles(target)).difs;
+ if (!_supportsOpacity && _opacityValExp.test(vars)) {
+ v.opacity = parseFloat( RegExp.$1 );
+ }
+ vars = v;
+ style.cssText = first;
+ }
+ this._firstPT = pt = this.parse(target, vars, null);
+
+ if (this._transformType) {
+ threeD = (this._transformType === 3);
+ if (!_transformProp) {
+ style.zoom = 1; //helps correct an IE issue.
+ } else if (_isSafari) {
+ _reqSafariFix = true;
+ //if zIndex isn't set, iOS Safari doesn't repaint things correctly sometimes (seemingly at random).
+ if (style.zIndex === "") {
+ zIndex = _getStyle(target, "zIndex", _cs);
+ if (zIndex === "auto" || zIndex === "") {
+ this._addLazySet(style, "zIndex", 0);
+ }
+ }
+ //Setting WebkitBackfaceVisibility corrects 3 bugs:
+ // 1) [non-Android] Safari skips rendering changes to "top" and "left" that are made on the same frame/render as a transform update.
+ // 2) iOS Safari sometimes neglects to repaint elements in their new positions. Setting "WebkitPerspective" to a non-zero value worked too except that on iOS Safari things would flicker randomly.
+ // 3) Safari sometimes displayed odd artifacts when tweening the transform (or WebkitTransform) property, like ghosts of the edges of the element remained. Definitely a browser bug.
+ //Note: we allow the user to override the auto-setting by defining WebkitBackfaceVisibility in the vars of the tween.
+ if (_isSafariLT6) {
+ this._addLazySet(style, "WebkitBackfaceVisibility", this._vars.WebkitBackfaceVisibility || (threeD ? "visible" : "hidden"));
+ }
+ }
+ pt2 = pt;
+ while (pt2 && pt2._next) {
+ pt2 = pt2._next;
+ }
+ tpt = new CSSPropTween(target, "transform", 0, 0, null, 2);
+ this._linkCSSP(tpt, null, pt2);
+ tpt.setRatio = (threeD && _supports3D) ? _set3DTransformRatio : _transformProp ? _set2DTransformRatio : _setIETransformRatio;
+ tpt.data = this._transform || _getTransform(target, _cs, true);
+ _overwriteProps.pop(); //we don't want to force the overwrite of all "transform" tweens of the target - we only care about individual transform properties like scaleX, rotation, etc. The CSSPropTween constructor automatically adds the property to _overwriteProps which is why we need to pop() here.
+ }
+
+ if (_hasPriority) {
+ //reorders the linked list in order of pr (priority)
+ while (pt) {
+ next = pt._next;
+ pt2 = first;
+ while (pt2 && pt2.pr > pt.pr) {
+ pt2 = pt2._next;
+ }
+ if ((pt._prev = pt2 ? pt2._prev : last)) {
+ pt._prev._next = pt;
+ } else {
+ first = pt;
+ }
+ if ((pt._next = pt2)) {
+ pt2._prev = pt;
+ } else {
+ last = pt;
+ }
+ pt = next;
+ }
+ this._firstPT = first;
+ }
+ return true;
+ };
+
+
+ p.parse = function(target, vars, pt, plugin) {
+ var style = target.style,
+ p, sp, bn, en, bs, es, bsfx, esfx, isStr, rel;
+ for (p in vars) {
+ es = vars[p]; //ending value string
+ sp = _specialProps[p]; //SpecialProp lookup.
+ if (sp) {
+ pt = sp.parse(target, es, p, this, pt, plugin, vars);
+
+ } else {
+ bs = _getStyle(target, p, _cs) + "";
+ isStr = (typeof(es) === "string");
+ if (p === "color" || p === "fill" || p === "stroke" || p.indexOf("Color") !== -1 || (isStr && _rgbhslExp.test(es))) { //Opera uses background: to define color sometimes in addition to backgroundColor:
+ if (!isStr) {
+ es = _parseColor(es);
+ es = ((es.length > 3) ? "rgba(" : "rgb(") + es.join(",") + ")";
+ }
+ pt = _parseComplex(style, p, bs, es, true, "transparent", pt, 0, plugin);
+
+ } else if (isStr && (es.indexOf(" ") !== -1 || es.indexOf(",") !== -1)) {
+ pt = _parseComplex(style, p, bs, es, true, null, pt, 0, plugin);
+
+ } else {
+ bn = parseFloat(bs);
+ bsfx = (bn || bn === 0) ? bs.substr((bn + "").length) : ""; //remember, bs could be non-numeric like "normal" for fontWeight, so we should default to a blank suffix in that case.
+
+ if (bs === "" || bs === "auto") {
+ if (p === "width" || p === "height") {
+ bn = _getDimension(target, p, _cs);
+ bsfx = "px";
+ } else if (p === "left" || p === "top") {
+ bn = _calculateOffset(target, p, _cs);
+ bsfx = "px";
+ } else {
+ bn = (p !== "opacity") ? 0 : 1;
+ bsfx = "";
+ }
+ }
+
+ rel = (isStr && es.charAt(1) === "=");
+ if (rel) {
+ en = parseInt(es.charAt(0) + "1", 10);
+ es = es.substr(2);
+ en *= parseFloat(es);
+ esfx = es.replace(_suffixExp, "");
+ } else {
+ en = parseFloat(es);
+ esfx = isStr ? es.substr((en + "").length) || "" : "";
+ }
+
+ if (esfx === "") {
+ esfx = (p in _suffixMap) ? _suffixMap[p] : bsfx; //populate the end suffix, prioritizing the map, then if none is found, use the beginning suffix.
+ }
+
+ es = (en || en === 0) ? (rel ? en + bn : en) + esfx : vars[p]; //ensures that any += or -= prefixes are taken care of. Record the end value before normalizing the suffix because we always want to end the tween on exactly what they intended even if it doesn't match the beginning value's suffix.
+
+ //if the beginning/ending suffixes don't match, normalize them...
+ if (bsfx !== esfx) if (esfx !== "") if (en || en === 0) if (bn) { //note: if the beginning value (bn) is 0, we don't need to convert units!
+ bn = _convertToPixels(target, p, bn, bsfx);
+ if (esfx === "%") {
+ bn /= _convertToPixels(target, p, 100, "%") / 100;
+ if (vars.strictUnits !== true) { //some browsers report only "px" values instead of allowing "%" with getComputedStyle(), so we assume that if we're tweening to a %, we should start there too unless strictUnits:true is defined. This approach is particularly useful for responsive designs that use from() tweens.
+ bs = bn + "%";
+ }
+
+ } else if (esfx === "em") {
+ bn /= _convertToPixels(target, p, 1, "em");
+
+ //otherwise convert to pixels.
+ } else if (esfx !== "px") {
+ en = _convertToPixels(target, p, en, esfx);
+ esfx = "px"; //we don't use bsfx after this, so we don't need to set it to px too.
+ }
+ if (rel) if (en || en === 0) {
+ es = (en + bn) + esfx; //the changes we made affect relative calculations, so adjust the end value here.
+ }
+ }
+
+ if (rel) {
+ en += bn;
+ }
+
+ if ((bn || bn === 0) && (en || en === 0)) { //faster than isNaN(). Also, previously we required en !== bn but that doesn't really gain much performance and it prevents _parseToProxy() from working properly if beginning and ending values match but need to get tweened by an external plugin anyway. For example, a bezier tween where the target starts at left:0 and has these points: [{left:50},{left:0}] wouldn't work properly because when parsing the last point, it'd match the first (current) one and a non-tweening CSSPropTween would be recorded when we actually need a normal tween (type:0) so that things get updated during the tween properly.
+ pt = new CSSPropTween(style, p, bn, en - bn, pt, 0, p, (_autoRound !== false && (esfx === "px" || p === "zIndex")), 0, bs, es);
+ pt.xs0 = esfx;
+ //DEBUG: _log("tween "+p+" from "+pt.b+" ("+bn+esfx+") to "+pt.e+" with suffix: "+pt.xs0);
+ } else if (style[p] === undefined || !es && (es + "" === "NaN" || es == null)) {
+ _log("invalid " + p + " tween value: " + vars[p]);
+ } else {
+ pt = new CSSPropTween(style, p, en || bn || 0, 0, pt, -1, p, false, 0, bs, es);
+ pt.xs0 = (es === "none" && (p === "display" || p.indexOf("Style") !== -1)) ? bs : es; //intermediate value should typically be set immediately (end value) except for "display" or things like borderTopStyle, borderBottomStyle, etc. which should use the beginning value during the tween.
+ //DEBUG: _log("non-tweening value "+p+": "+pt.xs0);
+ }
+ }
+ }
+ if (plugin) if (pt && !pt.plugin) {
+ pt.plugin = plugin;
+ }
+ }
+ return pt;
+ };
+
+
+ //gets called every time the tween updates, passing the new ratio (typically a value between 0 and 1, but not always (for example, if an Elastic.easeOut is used, the value can jump above 1 mid-tween). It will always start and 0 and end at 1.
+ p.setRatio = function(v) {
+ var pt = this._firstPT,
+ min = 0.000001,
+ val, str, i;
+
+ //at the end of the tween, we set the values to exactly what we received in order to make sure non-tweening values (like "position" or "float" or whatever) are set and so that if the beginning/ending suffixes (units) didn't match and we normalized to px, the value that the user passed in is used here. We check to see if the tween is at its beginning in case it's a from() tween in which case the ratio will actually go from 1 to 0 over the course of the tween (backwards).
+ if (v === 1 && (this._tween._time === this._tween._duration || this._tween._time === 0)) {
+ while (pt) {
+ if (pt.type !== 2) {
+ pt.t[pt.p] = pt.e;
+ } else {
+ pt.setRatio(v);
+ }
+ pt = pt._next;
+ }
+
+ } else if (v || !(this._tween._time === this._tween._duration || this._tween._time === 0) || this._tween._rawPrevTime === -0.000001) {
+ while (pt) {
+ val = pt.c * v + pt.s;
+ if (pt.r) {
+ val = Math.round(val);
+ } else if (val < min) if (val > -min) {
+ val = 0;
+ }
+ if (!pt.type) {
+ pt.t[pt.p] = val + pt.xs0;
+ } else if (pt.type === 1) { //complex value (one that typically has multiple numbers inside a string, like "rect(5px,10px,20px,25px)"
+ i = pt.l;
+ if (i === 2) {
+ pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2;
+ } else if (i === 3) {
+ pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3;
+ } else if (i === 4) {
+ pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3 + pt.xn3 + pt.xs4;
+ } else if (i === 5) {
+ pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3 + pt.xn3 + pt.xs4 + pt.xn4 + pt.xs5;
+ } else {
+ str = pt.xs0 + val + pt.xs1;
+ for (i = 1; i < pt.l; i++) {
+ str += pt["xn"+i] + pt["xs"+(i+1)];
+ }
+ pt.t[pt.p] = str;
+ }
+
+ } else if (pt.type === -1) { //non-tweening value
+ pt.t[pt.p] = pt.xs0;
+
+ } else if (pt.setRatio) { //custom setRatio() for things like SpecialProps, external plugins, etc.
+ pt.setRatio(v);
+ }
+ pt = pt._next;
+ }
+
+ //if the tween is reversed all the way back to the beginning, we need to restore the original values which may have different units (like % instead of px or em or whatever).
+ } else {
+ while (pt) {
+ if (pt.type !== 2) {
+ pt.t[pt.p] = pt.b;
+ } else {
+ pt.setRatio(v);
+ }
+ pt = pt._next;
+ }
+ }
+ };
+
+ /**
+ * @private
+ * Forces rendering of the target's transforms (rotation, scale, etc.) whenever the CSSPlugin's setRatio() is called.
+ * Basically, this tells the CSSPlugin to create a CSSPropTween (type 2) after instantiation that runs last in the linked
+ * list and calls the appropriate (3D or 2D) rendering function. We separate this into its own method so that we can call
+ * it from other plugins like BezierPlugin if, for example, it needs to apply an autoRotation and this CSSPlugin
+ * doesn't have any transform-related properties of its own. You can call this method as many times as you
+ * want and it won't create duplicate CSSPropTweens.
+ *
+ * @param {boolean} threeD if true, it should apply 3D tweens (otherwise, just 2D ones are fine and typically faster)
+ */
+ p._enableTransforms = function(threeD) {
+ this._transformType = (threeD || this._transformType === 3) ? 3 : 2;
+ this._transform = this._transform || _getTransform(this._target, _cs, true); //ensures that the element has a _gsTransform property with the appropriate values.
+ };
+
+ var lazySet = function(v) {
+ this.t[this.p] = this.e;
+ this.data._linkCSSP(this, this._next, null, true); //we purposefully keep this._next even though it'd make sense to null it, but this is a performance optimization, as this happens during the while (pt) {} loop in setRatio() at the bottom of which it sets pt = pt._next, so if we null it, the linked list will be broken in that loop.
+ };
+ /** @private Gives us a way to set a value on the first render (and only the first render). **/
+ p._addLazySet = function(t, p, v) {
+ var pt = this._firstPT = new CSSPropTween(t, p, 0, 0, this._firstPT, 2);
+ pt.e = v;
+ pt.setRatio = lazySet;
+ pt.data = this;
+ };
+
+ /** @private **/
+ p._linkCSSP = function(pt, next, prev, remove) {
+ if (pt) {
+ if (next) {
+ next._prev = pt;
+ }
+ if (pt._next) {
+ pt._next._prev = pt._prev;
+ }
+ if (pt._prev) {
+ pt._prev._next = pt._next;
+ } else if (this._firstPT === pt) {
+ this._firstPT = pt._next;
+ remove = true; //just to prevent resetting this._firstPT 5 lines down in case pt._next is null. (optimized for speed)
+ }
+ if (prev) {
+ prev._next = pt;
+ } else if (!remove && this._firstPT === null) {
+ this._firstPT = pt;
+ }
+ pt._next = next;
+ pt._prev = prev;
+ }
+ return pt;
+ };
+
+ //we need to make sure that if alpha or autoAlpha is killed, opacity is too. And autoAlpha affects the "visibility" property.
+ p._kill = function(lookup) {
+ var copy = lookup,
+ pt, p, xfirst;
+ if (lookup.autoAlpha || lookup.alpha) {
+ copy = {};
+ for (p in lookup) { //copy the lookup so that we're not changing the original which may be passed elsewhere.
+ copy[p] = lookup[p];
+ }
+ copy.opacity = 1;
+ if (copy.autoAlpha) {
+ copy.visibility = 1;
+ }
+ }
+ if (lookup.className && (pt = this._classNamePT)) { //for className tweens, we need to kill any associated CSSPropTweens too; a linked list starts at the className's "xfirst".
+ xfirst = pt.xfirst;
+ if (xfirst && xfirst._prev) {
+ this._linkCSSP(xfirst._prev, pt._next, xfirst._prev._prev); //break off the prev
+ } else if (xfirst === this._firstPT) {
+ this._firstPT = pt._next;
+ }
+ if (pt._next) {
+ this._linkCSSP(pt._next, pt._next._next, xfirst._prev);
+ }
+ this._classNamePT = null;
+ }
+ return TweenPlugin.prototype._kill.call(this, copy);
+ };
+
+
+
+ //used by cascadeTo() for gathering all the style properties of each child element into an array for comparison.
+ var _getChildStyles = function(e, props, targets) {
+ var children, i, child, type;
+ if (e.slice) {
+ i = e.length;
+ while (--i > -1) {
+ _getChildStyles(e[i], props, targets);
+ }
+ return;
+ }
+ children = e.childNodes;
+ i = children.length;
+ while (--i > -1) {
+ child = children[i];
+ type = child.type;
+ if (child.style) {
+ props.push(_getAllStyles(child));
+ if (targets) {
+ targets.push(child);
+ }
+ }
+ if ((type === 1 || type === 9 || type === 11) && child.childNodes.length) {
+ _getChildStyles(child, props, targets);
+ }
+ }
+ };
+
+ /**
+ * Typically only useful for className tweens that may affect child elements, this method creates a TweenLite
+ * and then compares the style properties of all the target's child elements at the tween's start and end, and
+ * if any are different, it also creates tweens for those and returns an array containing ALL of the resulting
+ * tweens (so that you can easily add() them to a TimelineLite, for example). The reason this functionality is
+ * wrapped into a separate static method of CSSPlugin instead of being integrated into all regular className tweens
+ * is because it creates entirely new tweens that may have completely different targets than the original tween,
+ * so if they were all lumped into the original tween instance, it would be inconsistent with the rest of the API
+ * and it would create other problems. For example:
+ * - If I create a tween of elementA, that tween instance may suddenly change its target to include 50 other elements (unintuitive if I specifically defined the target I wanted)
+ * - We can't just create new independent tweens because otherwise, what happens if the original/parent tween is reversed or pause or dropped into a TimelineLite for tight control? You'd expect that tween's behavior to affect all the others.
+ * - Analyzing every style property of every child before and after the tween is an expensive operation when there are many children, so this behavior shouldn't be imposed on all className tweens by default, especially since it's probably rare that this extra functionality is needed.
+ *
+ * @param {Object} target object to be tweened
+ * @param {number} Duration in seconds (or frames for frames-based tweens)
+ * @param {Object} Object containing the end values, like {className:"newClass", ease:Linear.easeNone}
+ * @return {Array} An array of TweenLite instances
+ */
+ CSSPlugin.cascadeTo = function(target, duration, vars) {
+ var tween = TweenLite.to(target, duration, vars),
+ results = [tween],
+ b = [],
+ e = [],
+ targets = [],
+ _reservedProps = TweenLite._internals.reservedProps,
+ i, difs, p;
+ target = tween._targets || tween.target;
+ _getChildStyles(target, b, targets);
+ tween.render(duration, true);
+ _getChildStyles(target, e);
+ tween.render(0, true);
+ tween._enabled(true);
+ i = targets.length;
+ while (--i > -1) {
+ difs = _cssDif(targets[i], b[i], e[i]);
+ if (difs.firstMPT) {
+ difs = difs.difs;
+ for (p in vars) {
+ if (_reservedProps[p]) {
+ difs[p] = vars[p];
+ }
+ }
+ results.push( TweenLite.to(targets[i], duration, difs) );
+ }
+ }
+ return results;
+ };
+
+ TweenPlugin.activate([CSSPlugin]);
+ return CSSPlugin;
+
+ }, true);
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * ----------------------------------------------------------------
+ * RoundPropsPlugin
+ * ----------------------------------------------------------------
+ */
+ (function() {
+
+ var RoundPropsPlugin = window._gsDefine.plugin({
+ propName: "roundProps",
+ priority: -1,
+ API: 2,
+
+ //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
+ init: function(target, value, tween) {
+ this._tween = tween;
+ return true;
+ }
+
+ }),
+ p = RoundPropsPlugin.prototype;
+
+ p._onInitAllProps = function() {
+ var tween = this._tween,
+ rp = (tween.vars.roundProps instanceof Array) ? tween.vars.roundProps : tween.vars.roundProps.split(","),
+ i = rp.length,
+ lookup = {},
+ rpt = tween._propLookup.roundProps,
+ prop, pt, next;
+ while (--i > -1) {
+ lookup[rp[i]] = 1;
+ }
+ i = rp.length;
+ while (--i > -1) {
+ prop = rp[i];
+ pt = tween._firstPT;
+ while (pt) {
+ next = pt._next; //record here, because it may get removed
+ if (pt.pg) {
+ pt.t._roundProps(lookup, true);
+ } else if (pt.n === prop) {
+ this._add(pt.t, prop, pt.s, pt.c);
+ //remove from linked list
+ if (next) {
+ next._prev = pt._prev;
+ }
+ if (pt._prev) {
+ pt._prev._next = next;
+ } else if (tween._firstPT === pt) {
+ tween._firstPT = next;
+ }
+ pt._next = pt._prev = null;
+ tween._propLookup[prop] = rpt;
+ }
+ pt = next;
+ }
+ }
+ return false;
+ };
+
+ p._add = function(target, p, s, c) {
+ this._addTween(target, p, s, s + c, p, true);
+ this._overwriteProps.push(p);
+ };
+
+ }());
+
+
+
+
+
+
+
+
+
+
+/*
+ * ----------------------------------------------------------------
+ * AttrPlugin
+ * ----------------------------------------------------------------
+ */
+ window._gsDefine.plugin({
+ propName: "attr",
+ API: 2,
+ version: "0.3.2",
+
+ //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
+ init: function(target, value, tween) {
+ var p, start, end;
+ if (typeof(target.setAttribute) !== "function") {
+ return false;
+ }
+ this._target = target;
+ this._proxy = {};
+ this._start = {}; // we record start and end values exactly as they are in case they're strings (not numbers) - we need to be able to revert to them cleanly.
+ this._end = {};
+ for (p in value) {
+ this._start[p] = this._proxy[p] = start = target.getAttribute(p);
+ end = this._addTween(this._proxy, p, parseFloat(start), value[p], p);
+ this._end[p] = end ? end.s + end.c : value[p];
+ this._overwriteProps.push(p);
+ }
+ return true;
+ },
+
+ //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.)
+ set: function(ratio) {
+ this._super.setRatio.call(this, ratio);
+ var props = this._overwriteProps,
+ i = props.length,
+ lookup = (ratio === 1) ? this._end : ratio ? this._proxy : this._start,
+ p;
+ while (--i > -1) {
+ p = props[i];
+ this._target.setAttribute(p, lookup[p] + "");
+ }
+ }
+
+ });
+
+
+
+
+
+
+
+
+
+
+/*
+ * ----------------------------------------------------------------
+ * DirectionalRotationPlugin
+ * ----------------------------------------------------------------
+ */
+ window._gsDefine.plugin({
+ propName: "directionalRotation",
+ API: 2,
+ version: "0.2.0",
+
+ //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
+ init: function(target, value, tween) {
+ if (typeof(value) !== "object") {
+ value = {rotation:value};
+ }
+ this.finals = {};
+ var cap = (value.useRadians === true) ? Math.PI * 2 : 360,
+ min = 0.000001,
+ p, v, start, end, dif, split;
+ for (p in value) {
+ if (p !== "useRadians") {
+ split = (value[p] + "").split("_");
+ v = split[0];
+ start = parseFloat( (typeof(target[p]) !== "function") ? target[p] : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() );
+ end = this.finals[p] = (typeof(v) === "string" && v.charAt(1) === "=") ? start + parseInt(v.charAt(0) + "1", 10) * Number(v.substr(2)) : Number(v) || 0;
+ dif = end - start;
+ if (split.length) {
+ v = split.join("_");
+ if (v.indexOf("short") !== -1) {
+ dif = dif % cap;
+ if (dif !== dif % (cap / 2)) {
+ dif = (dif < 0) ? dif + cap : dif - cap;
+ }
+ }
+ if (v.indexOf("_cw") !== -1 && dif < 0) {
+ dif = ((dif + cap * 9999999999) % cap) - ((dif / cap) | 0) * cap;
+ } else if (v.indexOf("ccw") !== -1 && dif > 0) {
+ dif = ((dif - cap * 9999999999) % cap) - ((dif / cap) | 0) * cap;
+ }
+ }
+ if (dif > min || dif < -min) {
+ this._addTween(target, p, start, start + dif, p);
+ this._overwriteProps.push(p);
+ }
+ }
+ }
+ return true;
+ },
+
+ //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.)
+ set: function(ratio) {
+ var pt;
+ if (ratio !== 1) {
+ this._super.setRatio.call(this, ratio);
+ } else {
+ pt = this._firstPT;
+ while (pt) {
+ if (pt.f) {
+ pt.t[pt.p](this.finals[pt.p]);
+ } else {
+ pt.t[pt.p] = this.finals[pt.p];
+ }
+ pt = pt._next;
+ }
+ }
+ }
+
+ })._autoCSS = true;
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * ----------------------------------------------------------------
+ * EasePack
+ * ----------------------------------------------------------------
+ */
+ window._gsDefine("easing.Back", ["easing.Ease"], function(Ease) {
+
+ var w = (window.GreenSockGlobals || window),
+ gs = w.com.greensock,
+ _2PI = Math.PI * 2,
+ _HALF_PI = Math.PI / 2,
+ _class = gs._class,
+ _create = function(n, f) {
+ var C = _class("easing." + n, function(){}, true),
+ p = C.prototype = new Ease();
+ p.constructor = C;
+ p.getRatio = f;
+ return C;
+ },
+ _easeReg = Ease.register || function(){}, //put an empty function in place just as a safety measure in case someone loads an OLD version of TweenLite.js where Ease.register doesn't exist.
+ _wrap = function(name, EaseOut, EaseIn, EaseInOut, aliases) {
+ var C = _class("easing."+name, {
+ easeOut:new EaseOut(),
+ easeIn:new EaseIn(),
+ easeInOut:new EaseInOut()
+ }, true);
+ _easeReg(C, name);
+ return C;
+ },
+ EasePoint = function(time, value, next) {
+ this.t = time;
+ this.v = value;
+ if (next) {
+ this.next = next;
+ next.prev = this;
+ this.c = next.v - value;
+ this.gap = next.t - time;
+ }
+ },
+
+ //Back
+ _createBack = function(n, f) {
+ var C = _class("easing." + n, function(overshoot) {
+ this._p1 = (overshoot || overshoot === 0) ? overshoot : 1.70158;
+ this._p2 = this._p1 * 1.525;
+ }, true),
+ p = C.prototype = new Ease();
+ p.constructor = C;
+ p.getRatio = f;
+ p.config = function(overshoot) {
+ return new C(overshoot);
+ };
+ return C;
+ },
+
+ Back = _wrap("Back",
+ _createBack("BackOut", function(p) {
+ return ((p = p - 1) * p * ((this._p1 + 1) * p + this._p1) + 1);
+ }),
+ _createBack("BackIn", function(p) {
+ return p * p * ((this._p1 + 1) * p - this._p1);
+ }),
+ _createBack("BackInOut", function(p) {
+ return ((p *= 2) < 1) ? 0.5 * p * p * ((this._p2 + 1) * p - this._p2) : 0.5 * ((p -= 2) * p * ((this._p2 + 1) * p + this._p2) + 2);
+ })
+ ),
+
+
+ //SlowMo
+ SlowMo = _class("easing.SlowMo", function(linearRatio, power, yoyoMode) {
+ power = (power || power === 0) ? power : 0.7;
+ if (linearRatio == null) {
+ linearRatio = 0.7;
+ } else if (linearRatio > 1) {
+ linearRatio = 1;
+ }
+ this._p = (linearRatio !== 1) ? power : 0;
+ this._p1 = (1 - linearRatio) / 2;
+ this._p2 = linearRatio;
+ this._p3 = this._p1 + this._p2;
+ this._calcEnd = (yoyoMode === true);
+ }, true),
+ p = SlowMo.prototype = new Ease(),
+ SteppedEase, RoughEase, _createElastic;
+
+ p.constructor = SlowMo;
+ p.getRatio = function(p) {
+ var r = p + (0.5 - p) * this._p;
+ if (p < this._p1) {
+ return this._calcEnd ? 1 - ((p = 1 - (p / this._p1)) * p) : r - ((p = 1 - (p / this._p1)) * p * p * p * r);
+ } else if (p > this._p3) {
+ return this._calcEnd ? 1 - (p = (p - this._p3) / this._p1) * p : r + ((p - r) * (p = (p - this._p3) / this._p1) * p * p * p);
+ }
+ return this._calcEnd ? 1 : r;
+ };
+ SlowMo.ease = new SlowMo(0.7, 0.7);
+
+ p.config = SlowMo.config = function(linearRatio, power, yoyoMode) {
+ return new SlowMo(linearRatio, power, yoyoMode);
+ };
+
+
+ //SteppedEase
+ SteppedEase = _class("easing.SteppedEase", function(steps) {
+ steps = steps || 1;
+ this._p1 = 1 / steps;
+ this._p2 = steps + 1;
+ }, true);
+ p = SteppedEase.prototype = new Ease();
+ p.constructor = SteppedEase;
+ p.getRatio = function(p) {
+ if (p < 0) {
+ p = 0;
+ } else if (p >= 1) {
+ p = 0.999999999;
+ }
+ return ((this._p2 * p) >> 0) * this._p1;
+ };
+ p.config = SteppedEase.config = function(steps) {
+ return new SteppedEase(steps);
+ };
+
+
+ //RoughEase
+ RoughEase = _class("easing.RoughEase", function(vars) {
+ vars = vars || {};
+ var taper = vars.taper || "none",
+ a = [],
+ cnt = 0,
+ points = (vars.points || 20) | 0,
+ i = points,
+ randomize = (vars.randomize !== false),
+ clamp = (vars.clamp === true),
+ template = (vars.template instanceof Ease) ? vars.template : null,
+ strength = (typeof(vars.strength) === "number") ? vars.strength * 0.4 : 0.4,
+ x, y, bump, invX, obj, pnt;
+ while (--i > -1) {
+ x = randomize ? Math.random() : (1 / points) * i;
+ y = template ? template.getRatio(x) : x;
+ if (taper === "none") {
+ bump = strength;
+ } else if (taper === "out") {
+ invX = 1 - x;
+ bump = invX * invX * strength;
+ } else if (taper === "in") {
+ bump = x * x * strength;
+ } else if (x < 0.5) { //"both" (start)
+ invX = x * 2;
+ bump = invX * invX * 0.5 * strength;
+ } else { //"both" (end)
+ invX = (1 - x) * 2;
+ bump = invX * invX * 0.5 * strength;
+ }
+ if (randomize) {
+ y += (Math.random() * bump) - (bump * 0.5);
+ } else if (i % 2) {
+ y += bump * 0.5;
+ } else {
+ y -= bump * 0.5;
+ }
+ if (clamp) {
+ if (y > 1) {
+ y = 1;
+ } else if (y < 0) {
+ y = 0;
+ }
+ }
+ a[cnt++] = {x:x, y:y};
+ }
+ a.sort(function(a, b) {
+ return a.x - b.x;
+ });
+
+ pnt = new EasePoint(1, 1, null);
+ i = points;
+ while (--i > -1) {
+ obj = a[i];
+ pnt = new EasePoint(obj.x, obj.y, pnt);
+ }
+
+ this._prev = new EasePoint(0, 0, (pnt.t !== 0) ? pnt : pnt.next);
+ }, true);
+ p = RoughEase.prototype = new Ease();
+ p.constructor = RoughEase;
+ p.getRatio = function(p) {
+ var pnt = this._prev;
+ if (p > pnt.t) {
+ while (pnt.next && p >= pnt.t) {
+ pnt = pnt.next;
+ }
+ pnt = pnt.prev;
+ } else {
+ while (pnt.prev && p <= pnt.t) {
+ pnt = pnt.prev;
+ }
+ }
+ this._prev = pnt;
+ return (pnt.v + ((p - pnt.t) / pnt.gap) * pnt.c);
+ };
+ p.config = function(vars) {
+ return new RoughEase(vars);
+ };
+ RoughEase.ease = new RoughEase();
+
+
+ //Bounce
+ _wrap("Bounce",
+ _create("BounceOut", function(p) {
+ if (p < 1 / 2.75) {
+ return 7.5625 * p * p;
+ } else if (p < 2 / 2.75) {
+ return 7.5625 * (p -= 1.5 / 2.75) * p + 0.75;
+ } else if (p < 2.5 / 2.75) {
+ return 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375;
+ }
+ return 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375;
+ }),
+ _create("BounceIn", function(p) {
+ if ((p = 1 - p) < 1 / 2.75) {
+ return 1 - (7.5625 * p * p);
+ } else if (p < 2 / 2.75) {
+ return 1 - (7.5625 * (p -= 1.5 / 2.75) * p + 0.75);
+ } else if (p < 2.5 / 2.75) {
+ return 1 - (7.5625 * (p -= 2.25 / 2.75) * p + 0.9375);
+ }
+ return 1 - (7.5625 * (p -= 2.625 / 2.75) * p + 0.984375);
+ }),
+ _create("BounceInOut", function(p) {
+ var invert = (p < 0.5);
+ if (invert) {
+ p = 1 - (p * 2);
+ } else {
+ p = (p * 2) - 1;
+ }
+ if (p < 1 / 2.75) {
+ p = 7.5625 * p * p;
+ } else if (p < 2 / 2.75) {
+ p = 7.5625 * (p -= 1.5 / 2.75) * p + 0.75;
+ } else if (p < 2.5 / 2.75) {
+ p = 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375;
+ } else {
+ p = 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375;
+ }
+ return invert ? (1 - p) * 0.5 : p * 0.5 + 0.5;
+ })
+ );
+
+
+ //CIRC
+ _wrap("Circ",
+ _create("CircOut", function(p) {
+ return Math.sqrt(1 - (p = p - 1) * p);
+ }),
+ _create("CircIn", function(p) {
+ return -(Math.sqrt(1 - (p * p)) - 1);
+ }),
+ _create("CircInOut", function(p) {
+ return ((p*=2) < 1) ? -0.5 * (Math.sqrt(1 - p * p) - 1) : 0.5 * (Math.sqrt(1 - (p -= 2) * p) + 1);
+ })
+ );
+
+
+ //Elastic
+ _createElastic = function(n, f, def) {
+ var C = _class("easing." + n, function(amplitude, period) {
+ this._p1 = amplitude || 1;
+ this._p2 = period || def;
+ this._p3 = this._p2 / _2PI * (Math.asin(1 / this._p1) || 0);
+ }, true),
+ p = C.prototype = new Ease();
+ p.constructor = C;
+ p.getRatio = f;
+ p.config = function(amplitude, period) {
+ return new C(amplitude, period);
+ };
+ return C;
+ };
+ _wrap("Elastic",
+ _createElastic("ElasticOut", function(p) {
+ return this._p1 * Math.pow(2, -10 * p) * Math.sin( (p - this._p3) * _2PI / this._p2 ) + 1;
+ }, 0.3),
+ _createElastic("ElasticIn", function(p) {
+ return -(this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * _2PI / this._p2 ));
+ }, 0.3),
+ _createElastic("ElasticInOut", function(p) {
+ return ((p *= 2) < 1) ? -0.5 * (this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * _2PI / this._p2)) : this._p1 * Math.pow(2, -10 *(p -= 1)) * Math.sin( (p - this._p3) * _2PI / this._p2 ) *0.5 + 1;
+ }, 0.45)
+ );
+
+
+ //Expo
+ _wrap("Expo",
+ _create("ExpoOut", function(p) {
+ return 1 - Math.pow(2, -10 * p);
+ }),
+ _create("ExpoIn", function(p) {
+ return Math.pow(2, 10 * (p - 1)) - 0.001;
+ }),
+ _create("ExpoInOut", function(p) {
+ return ((p *= 2) < 1) ? 0.5 * Math.pow(2, 10 * (p - 1)) : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
+ })
+ );
+
+
+ //Sine
+ _wrap("Sine",
+ _create("SineOut", function(p) {
+ return Math.sin(p * _HALF_PI);
+ }),
+ _create("SineIn", function(p) {
+ return -Math.cos(p * _HALF_PI) + 1;
+ }),
+ _create("SineInOut", function(p) {
+ return -0.5 * (Math.cos(Math.PI * p) - 1);
+ })
+ );
+
+ _class("easing.EaseLookup", {
+ find:function(s) {
+ return Ease.map[s];
+ }
+ }, true);
+
+ //register the non-standard eases
+ _easeReg(w.SlowMo, "SlowMo", "ease,");
+ _easeReg(RoughEase, "RoughEase", "ease,");
+ _easeReg(SteppedEase, "SteppedEase", "ease,");
+
+ return Back;
+
+ }, true);
+
+
+});
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * ----------------------------------------------------------------
+ * Base classes like TweenLite, SimpleTimeline, Ease, Ticker, etc.
+ * ----------------------------------------------------------------
+ */
+(function(window) {
+
+ "use strict";
+ var _globals = window.GreenSockGlobals || window;
+ if (_globals.TweenLite) {
+ return; //in case the core set of classes is already loaded, don't instantiate twice.
+ }
+ var _namespace = function(ns) {
+ var a = ns.split("."),
+ p = _globals, i;
+ for (i = 0; i < a.length; i++) {
+ p[a[i]] = p = p[a[i]] || {};
+ }
+ return p;
+ },
+ gs = _namespace("com.greensock"),
+ _tinyNum = 0.0000000001,
+ _slice = [].slice,
+ _emptyFunc = function() {},
+ _isArray = (function() { //works around issues in iframe environments where the Array global isn't shared, thus if the object originates in a different window/iframe, "(obj instanceof Array)" will evaluate false. We added some speed optimizations to avoid Object.prototype.toString.call() unless it's absolutely necessary because it's VERY slow (like 20x slower)
+ var toString = Object.prototype.toString,
+ array = toString.call([]);
+ return function(obj) {
+ return obj != null && (obj instanceof Array || (typeof(obj) === "object" && !!obj.push && toString.call(obj) === array));
+ };
+ }()),
+ a, i, p, _ticker, _tickerActive,
+ _defLookup = {},
+
+ /**
+ * @constructor
+ * Defines a GreenSock class, optionally with an array of dependencies that must be instantiated first and passed into the definition.
+ * This allows users to load GreenSock JS files in any order even if they have interdependencies (like CSSPlugin extends TweenPlugin which is
+ * inside TweenLite.js, but if CSSPlugin is loaded first, it should wait to run its code until TweenLite.js loads and instantiates TweenPlugin
+ * and then pass TweenPlugin to CSSPlugin's definition). This is all done automatically and internally.
+ *
+ * Every definition will be added to a "com.greensock" global object (typically window, but if a window.GreenSockGlobals object is found,
+ * it will go there as of v1.7). For example, TweenLite will be found at window.com.greensock.TweenLite and since it's a global class that should be available anywhere,
+ * it is ALSO referenced at window.TweenLite. However some classes aren't considered global, like the base com.greensock.core.Animation class, so
+ * those will only be at the package like window.com.greensock.core.Animation. Again, if you define a GreenSockGlobals object on the window, everything
+ * gets tucked neatly inside there instead of on the window directly. This allows you to do advanced things like load multiple versions of GreenSock
+ * files and put them into distinct objects (imagine a banner ad uses a newer version but the main site uses an older one). In that case, you could
+ * sandbox the banner one like:
+ *
+ * <script>
+ * var gs = window.GreenSockGlobals = {}; //the newer version we're about to load could now be referenced in a "gs" object, like gs.TweenLite.to(...). Use whatever alias you want as long as it's unique, "gs" or "banner" or whatever.
+ * </script>
+ * <script src="js/greensock/v1.7/TweenMax.js"></script>
+ * <script>
+ * window.GreenSockGlobals = null; //reset it back to null so that the next load of TweenMax affects the window and we can reference things directly like TweenLite.to(...)
+ * </script>
+ * <script src="js/greensock/v1.6/TweenMax.js"></script>
+ * <script>
+ * gs.TweenLite.to(...); //would use v1.7
+ * TweenLite.to(...); //would use v1.6
+ * </script>
+ *
+ * @param {!string} ns The namespace of the class definition, leaving off "com.greensock." as that's assumed. For example, "TweenLite" or "plugins.CSSPlugin" or "easing.Back".
+ * @param {!Array.<string>} dependencies An array of dependencies (described as their namespaces minus "com.greensock." prefix). For example ["TweenLite","plugins.TweenPlugin","core.Animation"]
+ * @param {!function():Object} func The function that should be called and passed the resolved dependencies which will return the actual class for this definition.
+ * @param {boolean=} global If true, the class will be added to the global scope (typically window unless you define a window.GreenSockGlobals object)
+ */
+ Definition = function(ns, dependencies, func, global) {
+ this.sc = (_defLookup[ns]) ? _defLookup[ns].sc : []; //subclasses
+ _defLookup[ns] = this;
+ this.gsClass = null;
+ this.func = func;
+ var _classes = [];
+ this.check = function(init) {
+ var i = dependencies.length,
+ missing = i,
+ cur, a, n, cl;
+ while (--i > -1) {
+ if ((cur = _defLookup[dependencies[i]] || new Definition(dependencies[i], [])).gsClass) {
+ _classes[i] = cur.gsClass;
+ missing--;
+ } else if (init) {
+ cur.sc.push(this);
+ }
+ }
+ if (missing === 0 && func) {
+ a = ("com.greensock." + ns).split(".");
+ n = a.pop();
+ cl = _namespace(a.join("."))[n] = this.gsClass = func.apply(func, _classes);
+
+ //exports to multiple environments
+ if (global) {
+ _globals[n] = cl; //provides a way to avoid global namespace pollution. By default, the main classes like TweenLite, Power1, Strong, etc. are added to window unless a GreenSockGlobals is defined. So if you want to have things added to a custom object instead, just do something like window.GreenSockGlobals = {} before loading any GreenSock files. You can even set up an alias like window.GreenSockGlobals = windows.gs = {} so that you can access everything like gs.TweenLite. Also remember that ALL classes are added to the window.com.greensock object (in their respective packages, like com.greensock.easing.Power1, com.greensock.TweenLite, etc.)
+ if (typeof(define) === "function" && define.amd){ //AMD
+ define((window.GreenSockAMDPath ? window.GreenSockAMDPath + "/" : "") + ns.split(".").join("/"), [], function() { return cl; });
+ } else if (typeof(module) !== "undefined" && module.exports){ //node
+ module.exports = cl;
+ }
+ }
+ for (i = 0; i < this.sc.length; i++) {
+ this.sc[i].check();
+ }
+ }
+ };
+ this.check(true);
+ },
+
+ //used to create Definition instances (which basically registers a class that has dependencies).
+ _gsDefine = window._gsDefine = function(ns, dependencies, func, global) {
+ return new Definition(ns, dependencies, func, global);
+ },
+
+ //a quick way to create a class that doesn't have any dependencies. Returns the class, but first registers it in the GreenSock namespace so that other classes can grab it (other classes might be dependent on the class).
+ _class = gs._class = function(ns, func, global) {
+ func = func || function() {};
+ _gsDefine(ns, [], function(){ return func; }, global);
+ return func;
+ };
+
+ _gsDefine.globals = _globals;
+
+
+
+/*
+ * ----------------------------------------------------------------
+ * Ease
+ * ----------------------------------------------------------------
+ */
+ var _baseParams = [0, 0, 1, 1],
+ _blankArray = [],
+ Ease = _class("easing.Ease", function(func, extraParams, type, power) {
+ this._func = func;
+ this._type = type || 0;
+ this._power = power || 0;
+ this._params = extraParams ? _baseParams.concat(extraParams) : _baseParams;
+ }, true),
+ _easeMap = Ease.map = {},
+ _easeReg = Ease.register = function(ease, names, types, create) {
+ var na = names.split(","),
+ i = na.length,
+ ta = (types || "easeIn,easeOut,easeInOut").split(","),
+ e, name, j, type;
+ while (--i > -1) {
+ name = na[i];
+ e = create ? _class("easing."+name, null, true) : gs.easing[name] || {};
+ j = ta.length;
+ while (--j > -1) {
+ type = ta[j];
+ _easeMap[name + "." + type] = _easeMap[type + name] = e[type] = ease.getRatio ? ease : ease[type] || new ease();
+ }
+ }
+ };
+
+ p = Ease.prototype;
+ p._calcEnd = false;
+ p.getRatio = function(p) {
+ if (this._func) {
+ this._params[0] = p;
+ return this._func.apply(null, this._params);
+ }
+ var t = this._type,
+ pw = this._power,
+ r = (t === 1) ? 1 - p : (t === 2) ? p : (p < 0.5) ? p * 2 : (1 - p) * 2;
+ if (pw === 1) {
+ r *= r;
+ } else if (pw === 2) {
+ r *= r * r;
+ } else if (pw === 3) {
+ r *= r * r * r;
+ } else if (pw === 4) {
+ r *= r * r * r * r;
+ }
+ return (t === 1) ? 1 - r : (t === 2) ? r : (p < 0.5) ? r / 2 : 1 - (r / 2);
+ };
+
+ //create all the standard eases like Linear, Quad, Cubic, Quart, Quint, Strong, Power0, Power1, Power2, Power3, and Power4 (each with easeIn, easeOut, and easeInOut)
+ a = ["Linear","Quad","Cubic","Quart","Quint,Strong"];
+ i = a.length;
+ while (--i > -1) {
+ p = a[i]+",Power"+i;
+ _easeReg(new Ease(null,null,1,i), p, "easeOut", true);
+ _easeReg(new Ease(null,null,2,i), p, "easeIn" + ((i === 0) ? ",easeNone" : ""));
+ _easeReg(new Ease(null,null,3,i), p, "easeInOut");
+ }
+ _easeMap.linear = gs.easing.Linear.easeIn;
+ _easeMap.swing = gs.easing.Quad.easeInOut; //for jQuery folks
+
+
+/*
+ * ----------------------------------------------------------------
+ * EventDispatcher
+ * ----------------------------------------------------------------
+ */
+ var EventDispatcher = _class("events.EventDispatcher", function(target) {
+ this._listeners = {};
+ this._eventTarget = target || this;
+ });
+ p = EventDispatcher.prototype;
+
+ p.addEventListener = function(type, callback, scope, useParam, priority) {
+ priority = priority || 0;
+ var list = this._listeners[type],
+ index = 0,
+ listener, i;
+ if (list == null) {
+ this._listeners[type] = list = [];
+ }
+ i = list.length;
+ while (--i > -1) {
+ listener = list[i];
+ if (listener.c === callback && listener.s === scope) {
+ list.splice(i, 1);
+ } else if (index === 0 && listener.pr < priority) {
+ index = i + 1;
+ }
+ }
+ list.splice(index, 0, {c:callback, s:scope, up:useParam, pr:priority});
+ if (this === _ticker && !_tickerActive) {
+ _ticker.wake();
+ }
+ };
+
+ p.removeEventListener = function(type, callback) {
+ var list = this._listeners[type], i;
+ if (list) {
+ i = list.length;
+ while (--i > -1) {
+ if (list[i].c === callback) {
+ list.splice(i, 1);
+ return;
+ }
+ }
+ }
+ };
+
+ p.dispatchEvent = function(type) {
+ var list = this._listeners[type],
+ i, t, listener;
+ if (list) {
+ i = list.length;
+ t = this._eventTarget;
+ while (--i > -1) {
+ listener = list[i];
+ if (listener.up) {
+ listener.c.call(listener.s || t, {type:type, target:t});
+ } else {
+ listener.c.call(listener.s || t);
+ }
+ }
+ }
+ };
+
+
+/*
+ * ----------------------------------------------------------------
+ * Ticker
+ * ----------------------------------------------------------------
+ */
+ var _reqAnimFrame = window.requestAnimationFrame,
+ _cancelAnimFrame = window.cancelAnimationFrame,
+ _getTime = Date.now || function() {return new Date().getTime();},
+ _lastUpdate = _getTime();
+
+ //now try to determine the requestAnimationFrame and cancelAnimationFrame functions and if none are found, we'll use a setTimeout()/clearTimeout() polyfill.
+ a = ["ms","moz","webkit","o"];
+ i = a.length;
+ while (--i > -1 && !_reqAnimFrame) {
+ _reqAnimFrame = window[a[i] + "RequestAnimationFrame"];
+ _cancelAnimFrame = window[a[i] + "CancelAnimationFrame"] || window[a[i] + "CancelRequestAnimationFrame"];
+ }
+
+ _class("Ticker", function(fps, useRAF) {
+ var _self = this,
+ _startTime = _getTime(),
+ _useRAF = (useRAF !== false && _reqAnimFrame),
+ _lagThreshold = 500,
+ _adjustedLag = 33,
+ _fps, _req, _id, _gap, _nextTime,
+ _tick = function(manual) {
+ var elapsed = _getTime() - _lastUpdate,
+ overlap, dispatch;
+ if (elapsed > _lagThreshold) {
+ _startTime += elapsed - _adjustedLag;
+ }
+ _lastUpdate += elapsed;
+ _self.time = (_lastUpdate - _startTime) / 1000;
+ overlap = _self.time - _nextTime;
+ if (!_fps || overlap > 0 || manual === true) {
+ _self.frame++;
+ _nextTime += overlap + (overlap >= _gap ? 0.004 : _gap - overlap);
+ dispatch = true;
+ }
+ if (manual !== true) { //make sure the request is made before we dispatch the "tick" event so that timing is maintained. Otherwise, if processing the "tick" requires a bunch of time (like 15ms) and we're using a setTimeout() that's based on 16.7ms, it'd technically take 31.7ms between frames otherwise.
+ _id = _req(_tick);
+ }
+ if (dispatch) {
+ _self.dispatchEvent("tick");
+ }
+ };
+
+ EventDispatcher.call(_self);
+ _self.time = _self.frame = 0;
+ _self.tick = function() {
+ _tick(true);
+ };
+
+ _self.lagSmoothing = function(threshold, adjustedLag) {
+ _lagThreshold = threshold || (1 / _tinyNum); //zero should be interpreted as basically unlimited
+ _adjustedLag = Math.min(adjustedLag, _lagThreshold, 0);
+ };
+
+ _self.sleep = function() {
+ if (_id == null) {
+ return;
+ }
+ if (!_useRAF || !_cancelAnimFrame) {
+ clearTimeout(_id);
+ } else {
+ _cancelAnimFrame(_id);
+ }
+ _req = _emptyFunc;
+ _id = null;
+ if (_self === _ticker) {
+ _tickerActive = false;
+ }
+ };
+
+ _self.wake = function() {
+ if (_id !== null) {
+ _self.sleep();
+ } else if (_self.frame > 10) { //don't trigger lagSmoothing if we're just waking up, and make sure that at least 10 frames have elapsed because of the iOS bug that we work around below with the 1.5-second setTimout().
+ _lastUpdate = _getTime() - _lagThreshold + 5;
+ }
+ _req = (_fps === 0) ? _emptyFunc : (!_useRAF || !_reqAnimFrame) ? function(f) { return setTimeout(f, ((_nextTime - _self.time) * 1000 + 1) | 0); } : _reqAnimFrame;
+ if (_self === _ticker) {
+ _tickerActive = true;
+ }
+ _tick(2);
+ };
+
+ _self.fps = function(value) {
+ if (!arguments.length) {
+ return _fps;
+ }
+ _fps = value;
+ _gap = 1 / (_fps || 60);
+ _nextTime = this.time + _gap;
+ _self.wake();
+ };
+
+ _self.useRAF = function(value) {
+ if (!arguments.length) {
+ return _useRAF;
+ }
+ _self.sleep();
+ _useRAF = value;
+ _self.fps(_fps);
+ };
+ _self.fps(fps);
+
+ //a bug in iOS 6 Safari occasionally prevents the requestAnimationFrame from working initially, so we use a 1.5-second timeout that automatically falls back to setTimeout() if it senses this condition.
+ setTimeout(function() {
+ if (_useRAF && (!_id || _self.frame < 5)) {
+ _self.useRAF(false);
+ }
+ }, 1500);
+ });
+
+ p = gs.Ticker.prototype = new gs.events.EventDispatcher();
+ p.constructor = gs.Ticker;
+
+
+/*
+ * ----------------------------------------------------------------
+ * Animation
+ * ----------------------------------------------------------------
+ */
+ var Animation = _class("core.Animation", function(duration, vars) {
+ this.vars = vars = vars || {};
+ this._duration = this._totalDuration = duration || 0;
+ this._delay = Number(vars.delay) || 0;
+ this._timeScale = 1;
+ this._active = (vars.immediateRender === true);
+ this.data = vars.data;
+ this._reversed = (vars.reversed === true);
+
+ if (!_rootTimeline) {
+ return;
+ }
+ if (!_tickerActive) { //some browsers (like iOS 6 Safari) shut down JavaScript execution when the tab is disabled and they [occasionally] neglect to start up requestAnimationFrame again when returning - this code ensures that the engine starts up again properly.
+ _ticker.wake();
+ }
+
+ var tl = this.vars.useFrames ? _rootFramesTimeline : _rootTimeline;
+ tl.add(this, tl._time);
+
+ if (this.vars.paused) {
+ this.paused(true);
+ }
+ });
+
+ _ticker = Animation.ticker = new gs.Ticker();
+ p = Animation.prototype;
+ p._dirty = p._gc = p._initted = p._paused = false;
+ p._totalTime = p._time = 0;
+ p._rawPrevTime = -1;
+ p._next = p._last = p._onUpdate = p._timeline = p.timeline = null;
+ p._paused = false;
+
+
+ //some browsers (like iOS) occasionally drop the requestAnimationFrame event when the user switches to a different tab and then comes back again, so we use a 2-second setTimeout() to sense if/when that condition occurs and then wake() the ticker.
+ var _checkTimeout = function() {
+ if (_tickerActive && _getTime() - _lastUpdate > 2000) {
+ _ticker.wake();
+ }
+ setTimeout(_checkTimeout, 2000);
+ };
+ _checkTimeout();
+
+
+ p.play = function(from, suppressEvents) {
+ if (from != null) {
+ this.seek(from, suppressEvents);
+ }
+ return this.reversed(false).paused(false);
+ };
+
+ p.pause = function(atTime, suppressEvents) {
+ if (atTime != null) {
+ this.seek(atTime, suppressEvents);
+ }
+ return this.paused(true);
+ };
+
+ p.resume = function(from, suppressEvents) {
+ if (from != null) {
+ this.seek(from, suppressEvents);
+ }
+ return this.paused(false);
+ };
+
+ p.seek = function(time, suppressEvents) {
+ return this.totalTime(Number(time), suppressEvents !== false);
+ };
+
+ p.restart = function(includeDelay, suppressEvents) {
+ return this.reversed(false).paused(false).totalTime(includeDelay ? -this._delay : 0, (suppressEvents !== false), true);
+ };
+
+ p.reverse = function(from, suppressEvents) {
+ if (from != null) {
+ this.seek((from || this.totalDuration()), suppressEvents);
+ }
+ return this.reversed(true).paused(false);
+ };
+
+ p.render = function(time, suppressEvents, force) {
+ //stub - we override this method in subclasses.
+ };
+
+ p.invalidate = function() {
+ return this;
+ };
+
+ p.isActive = function() {
+ var tl = this._timeline, //the 2 root timelines won't have a _timeline; they're always active.
+ startTime = this._startTime,
+ rawTime;
+ return (!tl || (!this._gc && !this._paused && tl.isActive() && (rawTime = tl.rawTime()) >= startTime && rawTime < startTime + this.totalDuration() / this._timeScale));
+ };
+
+ p._enabled = function (enabled, ignoreTimeline) {
+ if (!_tickerActive) {
+ _ticker.wake();
+ }
+ this._gc = !enabled;
+ this._active = this.isActive();
+ if (ignoreTimeline !== true) {
+ if (enabled && !this.timeline) {
+ this._timeline.add(this, this._startTime - this._delay);
+ } else if (!enabled && this.timeline) {
+ this._timeline._remove(this, true);
+ }
+ }
+ return false;
+ };
+
+
+ p._kill = function(vars, target) {
+ return this._enabled(false, false);
+ };
+
+ p.kill = function(vars, target) {
+ this._kill(vars, target);
+ return this;
+ };
+
+ p._uncache = function(includeSelf) {
+ var tween = includeSelf ? this : this.timeline;
+ while (tween) {
+ tween._dirty = true;
+ tween = tween.timeline;
+ }
+ return this;
+ };
+
+ p._swapSelfInParams = function(params) {
+ var i = params.length,
+ copy = params.concat();
+ while (--i > -1) {
+ if (params[i] === "{self}") {
+ copy[i] = this;
+ }
+ }
+ return copy;
+ };
+
+//----Animation getters/setters --------------------------------------------------------
+
+ p.eventCallback = function(type, callback, params, scope) {
+ if ((type || "").substr(0,2) === "on") {
+ var v = this.vars;
+ if (arguments.length === 1) {
+ return v[type];
+ }
+ if (callback == null) {
+ delete v[type];
+ } else {
+ v[type] = callback;
+ v[type + "Params"] = (_isArray(params) && params.join("").indexOf("{self}") !== -1) ? this._swapSelfInParams(params) : params;
+ v[type + "Scope"] = scope;
+ }
+ if (type === "onUpdate") {
+ this._onUpdate = callback;
+ }
+ }
+ return this;
+ };
+
+ p.delay = function(value) {
+ if (!arguments.length) {
+ return this._delay;
+ }
+ if (this._timeline.smoothChildTiming) {
+ this.startTime( this._startTime + value - this._delay );
+ }
+ this._delay = value;
+ return this;
+ };
+
+ p.duration = function(value) {
+ if (!arguments.length) {
+ this._dirty = false;
+ return this._duration;
+ }
+ this._duration = this._totalDuration = value;
+ this._uncache(true); //true in case it's a TweenMax or TimelineMax that has a repeat - we'll need to refresh the totalDuration.
+ if (this._timeline.smoothChildTiming) if (this._time > 0) if (this._time < this._duration) if (value !== 0) {
+ this.totalTime(this._totalTime * (value / this._duration), true);
+ }
+ return this;
+ };
+
+ p.totalDuration = function(value) {
+ this._dirty = false;
+ return (!arguments.length) ? this._totalDuration : this.duration(value);
+ };
+
+ p.time = function(value, suppressEvents) {
+ if (!arguments.length) {
+ return this._time;
+ }
+ if (this._dirty) {
+ this.totalDuration();
+ }
+ return this.totalTime((value > this._duration) ? this._duration : value, suppressEvents);
+ };
+
+ p.totalTime = function(time, suppressEvents, uncapped) {
+ if (!_tickerActive) {
+ _ticker.wake();
+ }
+ if (!arguments.length) {
+ return this._totalTime;
+ }
+ if (this._timeline) {
+ if (time < 0 && !uncapped) {
+ time += this.totalDuration();
+ }
+ if (this._timeline.smoothChildTiming) {
+ if (this._dirty) {
+ this.totalDuration();
+ }
+ var totalDuration = this._totalDuration,
+ tl = this._timeline;
+ if (time > totalDuration && !uncapped) {
+ time = totalDuration;
+ }
+ this._startTime = (this._paused ? this._pauseTime : tl._time) - ((!this._reversed ? time : totalDuration - time) / this._timeScale);
+ if (!tl._dirty) { //for performance improvement. If the parent's cache is already dirty, it already took care of marking the ancestors as dirty too, so skip the function call here.
+ this._uncache(false);
+ }
+ //in case any of the ancestor timelines had completed but should now be enabled, we should reset their totalTime() which will also ensure that they're lined up properly and enabled. Skip for animations that are on the root (wasteful). Example: a TimelineLite.exportRoot() is performed when there's a paused tween on the root, the export will not complete until that tween is unpaused, but imagine a child gets restarted later, after all [unpaused] tweens have completed. The startTime of that child would get pushed out, but one of the ancestors may have completed.
+ if (tl._timeline) {
+ while (tl._timeline) {
+ if (tl._timeline._time !== (tl._startTime + tl._totalTime) / tl._timeScale) {
+ tl.totalTime(tl._totalTime, true);
+ }
+ tl = tl._timeline;
+ }
+ }
+ }
+ if (this._gc) {
+ this._enabled(true, false);
+ }
+ if (this._totalTime !== time || this._duration === 0) {
+ this.render(time, suppressEvents, false);
+ if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when someone calls seek() or time() or progress(), they expect an immediate render.
+ _lazyRender();
+ }
+ }
+ }
+ return this;
+ };
+
+ p.progress = p.totalProgress = function(value, suppressEvents) {
+ return (!arguments.length) ? this._time / this.duration() : this.totalTime(this.duration() * value, suppressEvents);
+ };
+
+ p.startTime = function(value) {
+ if (!arguments.length) {
+ return this._startTime;
+ }
+ if (value !== this._startTime) {
+ this._startTime = value;
+ if (this.timeline) if (this.timeline._sortChildren) {
+ this.timeline.add(this, value - this._delay); //ensures that any necessary re-sequencing of Animations in the timeline occurs to make sure the rendering order is correct.
+ }
+ }
+ return this;
+ };
+
+ p.timeScale = function(value) {
+ if (!arguments.length) {
+ return this._timeScale;
+ }
+ value = value || _tinyNum; //can't allow zero because it'll throw the math off
+ if (this._timeline && this._timeline.smoothChildTiming) {
+ var pauseTime = this._pauseTime,
+ t = (pauseTime || pauseTime === 0) ? pauseTime : this._timeline.totalTime();
+ this._startTime = t - ((t - this._startTime) * this._timeScale / value);
+ }
+ this._timeScale = value;
+ return this._uncache(false);
+ };
+
+ p.reversed = function(value) {
+ if (!arguments.length) {
+ return this._reversed;
+ }
+ if (value != this._reversed) {
+ this._reversed = value;
+ this.totalTime(((this._timeline && !this._timeline.smoothChildTiming) ? this.totalDuration() - this._totalTime : this._totalTime), true);
+ }
+ return this;
+ };
+
+ p.paused = function(value) {
+ if (!arguments.length) {
+ return this._paused;
+ }
+ if (value != this._paused) if (this._timeline) {
+ if (!_tickerActive && !value) {
+ _ticker.wake();
+ }
+ var tl = this._timeline,
+ raw = tl.rawTime(),
+ elapsed = raw - this._pauseTime;
+ if (!value && tl.smoothChildTiming) {
+ this._startTime += elapsed;
+ this._uncache(false);
+ }
+ this._pauseTime = value ? raw : null;
+ this._paused = value;
+ this._active = this.isActive();
+ if (!value && elapsed !== 0 && this._initted && this.duration()) {
+ this.render((tl.smoothChildTiming ? this._totalTime : (raw - this._startTime) / this._timeScale), true, true); //in case the target's properties changed via some other tween or manual update by the user, we should force a render.
+ }
+ }
+ if (this._gc && !value) {
+ this._enabled(true, false);
+ }
+ return this;
+ };
+
+
+/*
+ * ----------------------------------------------------------------
+ * SimpleTimeline
+ * ----------------------------------------------------------------
+ */
+ var SimpleTimeline = _class("core.SimpleTimeline", function(vars) {
+ Animation.call(this, 0, vars);
+ this.autoRemoveChildren = this.smoothChildTiming = true;
+ });
+
+ p = SimpleTimeline.prototype = new Animation();
+ p.constructor = SimpleTimeline;
+ p.kill()._gc = false;
+ p._first = p._last = null;
+ p._sortChildren = false;
+
+ p.add = p.insert = function(child, position, align, stagger) {
+ var prevTween, st;
+ child._startTime = Number(position || 0) + child._delay;
+ if (child._paused) if (this !== child._timeline) { //we only adjust the _pauseTime if it wasn't in this timeline already. Remember, sometimes a tween will be inserted again into the same timeline when its startTime is changed so that the tweens in the TimelineLite/Max are re-ordered properly in the linked list (so everything renders in the proper order).
+ child._pauseTime = child._startTime + ((this.rawTime() - child._startTime) / child._timeScale);
+ }
+ if (child.timeline) {
+ child.timeline._remove(child, true); //removes from existing timeline so that it can be properly added to this one.
+ }
+ child.timeline = child._timeline = this;
+ if (child._gc) {
+ child._enabled(true, true);
+ }
+ prevTween = this._last;
+ if (this._sortChildren) {
+ st = child._startTime;
+ while (prevTween && prevTween._startTime > st) {
+ prevTween = prevTween._prev;
+ }
+ }
+ if (prevTween) {
+ child._next = prevTween._next;
+ prevTween._next = child;
+ } else {
+ child._next = this._first;
+ this._first = child;
+ }
+ if (child._next) {
+ child._next._prev = child;
+ } else {
+ this._last = child;
+ }
+ child._prev = prevTween;
+ if (this._timeline) {
+ this._uncache(true);
+ }
+ return this;
+ };
+
+ p._remove = function(tween, skipDisable) {
+ if (tween.timeline === this) {
+ if (!skipDisable) {
+ tween._enabled(false, true);
+ }
+ tween.timeline = null;
+
+ if (tween._prev) {
+ tween._prev._next = tween._next;
+ } else if (this._first === tween) {
+ this._first = tween._next;
+ }
+ if (tween._next) {
+ tween._next._prev = tween._prev;
+ } else if (this._last === tween) {
+ this._last = tween._prev;
+ }
+
+ if (this._timeline) {
+ this._uncache(true);
+ }
+ }
+ return this;
+ };
+
+ p.render = function(time, suppressEvents, force) {
+ var tween = this._first,
+ next;
+ this._totalTime = this._time = this._rawPrevTime = time;
+ while (tween) {
+ next = tween._next; //record it here because the value could change after rendering...
+ if (tween._active || (time >= tween._startTime && !tween._paused)) {
+ if (!tween._reversed) {
+ tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
+ } else {
+ tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
+ }
+ }
+ tween = next;
+ }
+ };
+
+ p.rawTime = function() {
+ if (!_tickerActive) {
+ _ticker.wake();
+ }
+ return this._totalTime;
+ };
+
+/*
+ * ----------------------------------------------------------------
+ * TweenLite
+ * ----------------------------------------------------------------
+ */
+ var TweenLite = _class("TweenLite", function(target, duration, vars) {
+ Animation.call(this, duration, vars);
+ this.render = TweenLite.prototype.render; //speed optimization (avoid prototype lookup on this "hot" method)
+
+ if (target == null) {
+ throw "Cannot tween a null target.";
+ }
+
+ this.target = target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target;
+
+ var isSelector = (target.jquery || (target.length && target !== window && target[0] && (target[0] === window || (target[0].nodeType && target[0].style && !target.nodeType)))),
+ overwrite = this.vars.overwrite,
+ i, targ, targets;
+
+ this._overwrite = overwrite = (overwrite == null) ? _overwriteLookup[TweenLite.defaultOverwrite] : (typeof(overwrite) === "number") ? overwrite >> 0 : _overwriteLookup[overwrite];
+
+ if ((isSelector || target instanceof Array || (target.push && _isArray(target))) && typeof(target[0]) !== "number") {
+ this._targets = targets = _slice.call(target, 0);
+ this._propLookup = [];
+ this._siblings = [];
+ for (i = 0; i < targets.length; i++) {
+ targ = targets[i];
+ if (!targ) {
+ targets.splice(i--, 1);
+ continue;
+ } else if (typeof(targ) === "string") {
+ targ = targets[i--] = TweenLite.selector(targ); //in case it's an array of strings
+ if (typeof(targ) === "string") {
+ targets.splice(i+1, 1); //to avoid an endless loop (can't imagine why the selector would return a string, but just in case)
+ }
+ continue;
+ } else if (targ.length && targ !== window && targ[0] && (targ[0] === window || (targ[0].nodeType && targ[0].style && !targ.nodeType))) { //in case the user is passing in an array of selector objects (like jQuery objects), we need to check one more level and pull things out if necessary. Also note that <select> elements pass all the criteria regarding length and the first child having style, so we must also check to ensure the target isn't an HTML node itself.
+ targets.splice(i--, 1);
+ this._targets = targets = targets.concat(_slice.call(targ, 0));
+ continue;
+ }
+ this._siblings[i] = _register(targ, this, false);
+ if (overwrite === 1) if (this._siblings[i].length > 1) {
+ _applyOverwrite(targ, this, null, 1, this._siblings[i]);
+ }
+ }
+
+ } else {
+ this._propLookup = {};
+ this._siblings = _register(target, this, false);
+ if (overwrite === 1) if (this._siblings.length > 1) {
+ _applyOverwrite(target, this, null, 1, this._siblings);
+ }
+ }
+ if (this.vars.immediateRender || (duration === 0 && this._delay === 0 && this.vars.immediateRender !== false)) {
+ this._time = -_tinyNum; //forces a render without having to set the render() "force" parameter to true because we want to allow lazying by default (using the "force" parameter always forces an immediate full render)
+ this.render(-this._delay);
+ }
+ }, true),
+ _isSelector = function(v) {
+ return (v.length && v !== window && v[0] && (v[0] === window || (v[0].nodeType && v[0].style && !v.nodeType))); //we cannot check "nodeType" if the target is window from within an iframe, otherwise it will trigger a security error in some browsers like Firefox.
+ },
+ _autoCSS = function(vars, target) {
+ var css = {},
+ p;
+ for (p in vars) {
+ if (!_reservedProps[p] && (!(p in target) || p === "transform" || p === "x" || p === "y" || p === "width" || p === "height" || p === "className" || p === "border") && (!_plugins[p] || (_plugins[p] && _plugins[p]._autoCSS))) { //note: <img> elements contain read-only "x" and "y" properties. We should also prioritize editing css width/height rather than the element's properties.
+ css[p] = vars[p];
+ delete vars[p];
+ }
+ }
+ vars.css = css;
+ };
+
+ p = TweenLite.prototype = new Animation();
+ p.constructor = TweenLite;
+ p.kill()._gc = false;
+
+//----TweenLite defaults, overwrite management, and root updates ----------------------------------------------------
+
+ p.ratio = 0;
+ p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
+ p._notifyPluginsOfEnabled = p._lazy = false;
+
+ TweenLite.version = "1.12.1";
+ TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
+ TweenLite.defaultOverwrite = "auto";
+ TweenLite.ticker = _ticker;
+ TweenLite.autoSleep = true;
+ TweenLite.lagSmoothing = function(threshold, adjustedLag) {
+ _ticker.lagSmoothing(threshold, adjustedLag);
+ };
+ TweenLite.selector = window.$ || window.jQuery || function(e) { if (window.$) { TweenLite.selector = window.$; return window.$(e); } return window.document ? window.document.getElementById((e.charAt(0) === "#") ? e.substr(1) : e) : e; };
+
+ var _lazyTweens = [],
+ _lazyLookup = {},
+ _internals = TweenLite._internals = {isArray:_isArray, isSelector:_isSelector, lazyTweens:_lazyTweens}, //gives us a way to expose certain private values to other GreenSock classes without contaminating tha main TweenLite object.
+ _plugins = TweenLite._plugins = {},
+ _tweenLookup = _internals.tweenLookup = {},
+ _tweenLookupNum = 0,
+ _reservedProps = _internals.reservedProps = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, onCompleteScope:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, onUpdateScope:1, onStart:1, onStartParams:1, onStartScope:1, onReverseComplete:1, onReverseCompleteParams:1, onReverseCompleteScope:1, onRepeat:1, onRepeatParams:1, onRepeatScope:1, easeParams:1, yoyo:1, immediateRender:1, repeat:1, repeatDelay:1, data:1, paused:1, reversed:1, autoCSS:1, lazy:1},
+ _overwriteLookup = {none:0, all:1, auto:2, concurrent:3, allOnStart:4, preexisting:5, "true":1, "false":0},
+ _rootFramesTimeline = Animation._rootFramesTimeline = new SimpleTimeline(),
+ _rootTimeline = Animation._rootTimeline = new SimpleTimeline(),
+ _lazyRender = function() {
+ var i = _lazyTweens.length;
+ _lazyLookup = {};
+ while (--i > -1) {
+ a = _lazyTweens[i];
+ if (a && a._lazy !== false) {
+ a.render(a._lazy, false, true);
+ a._lazy = false;
+ }
+ }
+ _lazyTweens.length = 0;
+ };
+
+ _rootTimeline._startTime = _ticker.time;
+ _rootFramesTimeline._startTime = _ticker.frame;
+ _rootTimeline._active = _rootFramesTimeline._active = true;
+ setTimeout(_lazyRender, 1); //on some mobile devices, there isn't a "tick" before code runs which means any lazy renders wouldn't run before the next official "tick".
+
+ Animation._updateRoot = TweenLite.render = function() {
+ var i, a, p;
+ if (_lazyTweens.length) { //if code is run outside of the requestAnimationFrame loop, there may be tweens queued AFTER the engine refreshed, so we need to ensure any pending renders occur before we refresh again.
+ _lazyRender();
+ }
+ _rootTimeline.render((_ticker.time - _rootTimeline._startTime) * _rootTimeline._timeScale, false, false);
+ _rootFramesTimeline.render((_ticker.frame - _rootFramesTimeline._startTime) * _rootFramesTimeline._timeScale, false, false);
+ if (_lazyTweens.length) {
+ _lazyRender();
+ }
+ if (!(_ticker.frame % 120)) { //dump garbage every 120 frames...
+ for (p in _tweenLookup) {
+ a = _tweenLookup[p].tweens;
+ i = a.length;
+ while (--i > -1) {
+ if (a[i]._gc) {
+ a.splice(i, 1);
+ }
+ }
+ if (a.length === 0) {
+ delete _tweenLookup[p];
+ }
+ }
+ //if there are no more tweens in the root timelines, or if they're all paused, make the _timer sleep to reduce load on the CPU slightly
+ p = _rootTimeline._first;
+ if (!p || p._paused) if (TweenLite.autoSleep && !_rootFramesTimeline._first && _ticker._listeners.tick.length === 1) {
+ while (p && p._paused) {
+ p = p._next;
+ }
+ if (!p) {
+ _ticker.sleep();
+ }
+ }
+ }
+ };
+
+ _ticker.addEventListener("tick", Animation._updateRoot);
+
+ var _register = function(target, tween, scrub) {
+ var id = target._gsTweenID, a, i;
+ if (!_tweenLookup[id || (target._gsTweenID = id = "t" + (_tweenLookupNum++))]) {
+ _tweenLookup[id] = {target:target, tweens:[]};
+ }
+ if (tween) {
+ a = _tweenLookup[id].tweens;
+ a[(i = a.length)] = tween;
+ if (scrub) {
+ while (--i > -1) {
+ if (a[i] === tween) {
+ a.splice(i, 1);
+ }
+ }
+ }
+ }
+ return _tweenLookup[id].tweens;
+ },
+
+ _applyOverwrite = function(target, tween, props, mode, siblings) {
+ var i, changed, curTween, l;
+ if (mode === 1 || mode >= 4) {
+ l = siblings.length;
+ for (i = 0; i < l; i++) {
+ if ((curTween = siblings[i]) !== tween) {
+ if (!curTween._gc) if (curTween._enabled(false, false)) {
+ changed = true;
+ }
+ } else if (mode === 5) {
+ break;
+ }
+ }
+ return changed;
+ }
+ //NOTE: Add 0.0000000001 to overcome floating point errors that can cause the startTime to be VERY slightly off (when a tween's time() is set for example)
+ var startTime = tween._startTime + _tinyNum,
+ overlaps = [],
+ oCount = 0,
+ zeroDur = (tween._duration === 0),
+ globalStart;
+ i = siblings.length;
+ while (--i > -1) {
+ if ((curTween = siblings[i]) === tween || curTween._gc || curTween._paused) {
+ //ignore
+ } else if (curTween._timeline !== tween._timeline) {
+ globalStart = globalStart || _checkOverlap(tween, 0, zeroDur);
+ if (_checkOverlap(curTween, globalStart, zeroDur) === 0) {
+ overlaps[oCount++] = curTween;
+ }
+ } else if (curTween._startTime <= startTime) if (curTween._startTime + curTween.totalDuration() / curTween._timeScale > startTime) if (!((zeroDur || !curTween._initted) && startTime - curTween._startTime <= 0.0000000002)) {
+ overlaps[oCount++] = curTween;
+ }
+ }
+
+ i = oCount;
+ while (--i > -1) {
+ curTween = overlaps[i];
+ if (mode === 2) if (curTween._kill(props, target)) {
+ changed = true;
+ }
+ if (mode !== 2 || (!curTween._firstPT && curTween._initted)) {
+ if (curTween._enabled(false, false)) { //if all property tweens have been overwritten, kill the tween.
+ changed = true;
+ }
+ }
+ }
+ return changed;
+ },
+
+ _checkOverlap = function(tween, reference, zeroDur) {
+ var tl = tween._timeline,
+ ts = tl._timeScale,
+ t = tween._startTime;
+ while (tl._timeline) {
+ t += tl._startTime;
+ ts *= tl._timeScale;
+ if (tl._paused) {
+ return -100;
+ }
+ tl = tl._timeline;
+ }
+ t /= ts;
+ return (t > reference) ? t - reference : ((zeroDur && t === reference) || (!tween._initted && t - reference < 2 * _tinyNum)) ? _tinyNum : ((t += tween.totalDuration() / tween._timeScale / ts) > reference + _tinyNum) ? 0 : t - reference - _tinyNum;
+ };
+
+
+//---- TweenLite instance methods -----------------------------------------------------------------------------
+
+ p._init = function() {
+ var v = this.vars,
+ op = this._overwrittenProps,
+ dur = this._duration,
+ immediate = !!v.immediateRender,
+ ease = v.ease,
+ i, initPlugins, pt, p, startVars;
+ if (v.startAt) {
+ if (this._startAt) {
+ this._startAt.render(-1, true); //if we've run a startAt previously (when the tween instantiated), we should revert it so that the values re-instantiate correctly particularly for relative tweens. Without this, a TweenLite.fromTo(obj, 1, {x:"+=100"}, {x:"-=100"}), for example, would actually jump to +=200 because the startAt would run twice, doubling the relative change.
+ this._startAt.kill();
+ }
+ startVars = {};
+ for (p in v.startAt) { //copy the properties/values into a new object to avoid collisions, like var to = {x:0}, from = {x:500}; timeline.fromTo(e, 1, from, to).fromTo(e, 1, to, from);
+ startVars[p] = v.startAt[p];
+ }
+ startVars.overwrite = false;
+ startVars.immediateRender = true;
+ startVars.lazy = (immediate && v.lazy !== false);
+ startVars.startAt = startVars.delay = null; //no nesting of startAt objects allowed (otherwise it could cause an infinite loop).
+ this._startAt = TweenLite.to(this.target, 0, startVars);
+ if (immediate) {
+ if (this._time > 0) {
+ this._startAt = null; //tweens that render immediately (like most from() and fromTo() tweens) shouldn't revert when their parent timeline's playhead goes backward past the startTime because the initial render could have happened anytime and it shouldn't be directly correlated to this tween's startTime. Imagine setting up a complex animation where the beginning states of various objects are rendered immediately but the tween doesn't happen for quite some time - if we revert to the starting values as soon as the playhead goes backward past the tween's startTime, it will throw things off visually. Reversion should only happen in TimelineLite/Max instances where immediateRender was false (which is the default in the convenience methods like from()).
+ } else if (dur !== 0) {
+ return; //we skip initialization here so that overwriting doesn't occur until the tween actually begins. Otherwise, if you create several immediateRender:true tweens of the same target/properties to drop into a TimelineLite or TimelineMax, the last one created would overwrite the first ones because they didn't get placed into the timeline yet before the first render occurs and kicks in overwriting.
+ }
+ }
+ } else if (v.runBackwards && dur !== 0) {
+ //from() tweens must be handled uniquely: their beginning values must be rendered but we don't want overwriting to occur yet (when time is still 0). Wait until the tween actually begins before doing all the routines like overwriting. At that time, we should render at the END of the tween to ensure that things initialize correctly (remember, from() tweens go backwards)
+ if (this._startAt) {
+ this._startAt.render(-1, true);
+ this._startAt.kill();
+ this._startAt = null;
+ } else {
+ pt = {};
+ for (p in v) { //copy props into a new object and skip any reserved props, otherwise onComplete or onUpdate or onStart could fire. We should, however, permit autoCSS to go through.
+ if (!_reservedProps[p] || p === "autoCSS") {
+ pt[p] = v[p];
+ }
+ }
+ pt.overwrite = 0;
+ pt.data = "isFromStart"; //we tag the tween with as "isFromStart" so that if [inside a plugin] we need to only do something at the very END of a tween, we have a way of identifying this tween as merely the one that's setting the beginning values for a "from()" tween. For example, clearProps in CSSPlugin should only get applied at the very END of a tween and without this tag, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in.
+ pt.lazy = (immediate && v.lazy !== false);
+ pt.immediateRender = immediate; //zero-duration tweens render immediately by default, but if we're not specifically instructed to render this tween immediately, we should skip this and merely _init() to record the starting values (rendering them immediately would push them to completion which is wasteful in that case - we'd have to render(-1) immediately after)
+ this._startAt = TweenLite.to(this.target, 0, pt);
+ if (!immediate) {
+ this._startAt._init(); //ensures that the initial values are recorded
+ this._startAt._enabled(false); //no need to have the tween render on the next cycle. Disable it because we'll always manually control the renders of the _startAt tween.
+ } else if (this._time === 0) {
+ return;
+ }
+ }
+ }
+ if (!ease) {
+ this._ease = TweenLite.defaultEase;
+ } else if (ease instanceof Ease) {
+ this._ease = (v.easeParams instanceof Array) ? ease.config.apply(ease, v.easeParams) : ease;
+ } else {
+ this._ease = (typeof(ease) === "function") ? new Ease(ease, v.easeParams) : _easeMap[ease] || TweenLite.defaultEase;
+ }
+ this._easeType = this._ease._type;
+ this._easePower = this._ease._power;
+ this._firstPT = null;
+
+ if (this._targets) {
+ i = this._targets.length;
+ while (--i > -1) {
+ if ( this._initProps( this._targets[i], (this._propLookup[i] = {}), this._siblings[i], (op ? op[i] : null)) ) {
+ initPlugins = true;
+ }
+ }
+ } else {
+ initPlugins = this._initProps(this.target, this._propLookup, this._siblings, op);
+ }
+
+ if (initPlugins) {
+ TweenLite._onPluginEvent("_onInitAllProps", this); //reorders the array in order of priority. Uses a static TweenPlugin method in order to minimize file size in TweenLite
+ }
+ if (op) if (!this._firstPT) if (typeof(this.target) !== "function") { //if all tweening properties have been overwritten, kill the tween. If the target is a function, it's probably a delayedCall so let it live.
+ this._enabled(false, false);
+ }
+ if (v.runBackwards) {
+ pt = this._firstPT;
+ while (pt) {
+ pt.s += pt.c;
+ pt.c = -pt.c;
+ pt = pt._next;
+ }
+ }
+ this._onUpdate = v.onUpdate;
+ this._initted = true;
+ };
+
+ p._initProps = function(target, propLookup, siblings, overwrittenProps) {
+ var p, i, initPlugins, plugin, pt, v;
+ if (target == null) {
+ return false;
+ }
+
+ if (_lazyLookup[target._gsTweenID]) {
+ _lazyRender(); //if other tweens of the same target have recently initted but haven't rendered yet, we've got to force the render so that the starting values are correct (imagine populating a timeline with a bunch of sequential tweens and then jumping to the end)
+ }
+
+ if (!this.vars.css) if (target.style) if (target !== window && target.nodeType) if (_plugins.css) if (this.vars.autoCSS !== false) { //it's so common to use TweenLite/Max to animate the css of DOM elements, we assume that if the target is a DOM element, that's what is intended (a convenience so that users don't have to wrap things in css:{}, although we still recommend it for a slight performance boost and better specificity). Note: we cannot check "nodeType" on the window inside an iframe.
+ _autoCSS(this.vars, target);
+ }
+ for (p in this.vars) {
+ v = this.vars[p];
+ if (_reservedProps[p]) {
+ if (v) if ((v instanceof Array) || (v.push && _isArray(v))) if (v.join("").indexOf("{self}") !== -1) {
+ this.vars[p] = v = this._swapSelfInParams(v, this);
+ }
+
+ } else if (_plugins[p] && (plugin = new _plugins[p]())._onInitTween(target, this.vars[p], this)) {
+
+ //t - target [object]
+ //p - property [string]
+ //s - start [number]
+ //c - change [number]
+ //f - isFunction [boolean]
+ //n - name [string]
+ //pg - isPlugin [boolean]
+ //pr - priority [number]
+ this._firstPT = pt = {_next:this._firstPT, t:plugin, p:"setRatio", s:0, c:1, f:true, n:p, pg:true, pr:plugin._priority};
+ i = plugin._overwriteProps.length;
+ while (--i > -1) {
+ propLookup[plugin._overwriteProps[i]] = this._firstPT;
+ }
+ if (plugin._priority || plugin._onInitAllProps) {
+ initPlugins = true;
+ }
+ if (plugin._onDisable || plugin._onEnable) {
+ this._notifyPluginsOfEnabled = true;
+ }
+
+ } else {
+ this._firstPT = propLookup[p] = pt = {_next:this._firstPT, t:target, p:p, f:(typeof(target[p]) === "function"), n:p, pg:false, pr:0};
+ pt.s = (!pt.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]();
+ pt.c = (typeof(v) === "string" && v.charAt(1) === "=") ? parseInt(v.charAt(0) + "1", 10) * Number(v.substr(2)) : (Number(v) - pt.s) || 0;
+ }
+ if (pt) if (pt._next) {
+ pt._next._prev = pt;
+ }
+ }
+
+ if (overwrittenProps) if (this._kill(overwrittenProps, target)) { //another tween may have tried to overwrite properties of this tween before init() was called (like if two tweens start at the same time, the one created second will run first)
+ return this._initProps(target, propLookup, siblings, overwrittenProps);
+ }
+ if (this._overwrite > 1) if (this._firstPT) if (siblings.length > 1) if (_applyOverwrite(target, this, propLookup, this._overwrite, siblings)) {
+ this._kill(propLookup, target);
+ return this._initProps(target, propLookup, siblings, overwrittenProps);
+ }
+ if (this._firstPT) if ((this.vars.lazy !== false && this._duration) || (this.vars.lazy && !this._duration)) { //zero duration tweens don't lazy render by default; everything else does.
+ _lazyLookup[target._gsTweenID] = true;
+ }
+ return initPlugins;
+ };
+
+ p.render = function(time, suppressEvents, force) {
+ var prevTime = this._time,
+ duration = this._duration,
+ prevRawPrevTime = this._rawPrevTime,
+ isComplete, callback, pt, rawPrevTime;
+ if (time >= duration) {
+ this._totalTime = this._time = duration;
+ this.ratio = this._ease._calcEnd ? this._ease.getRatio(1) : 1;
+ if (!this._reversed ) {
+ isComplete = true;
+ callback = "onComplete";
+ }
+ if (duration === 0) if (this._initted || !this.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
+ if (this._startTime === this._timeline._duration) { //if a zero-duration tween is at the VERY end of a timeline and that timeline renders at its end, it will typically add a tiny bit of cushion to the render time to prevent rounding errors from getting in the way of tweens rendering their VERY end. If we then reverse() that timeline, the zero-duration tween will trigger its onReverseComplete even though technically the playhead didn't pass over it again. It's a very specific edge case we must accommodate.
+ time = 0;
+ }
+ if (time === 0 || prevRawPrevTime < 0 || prevRawPrevTime === _tinyNum) if (prevRawPrevTime !== time) {
+ force = true;
+ if (prevRawPrevTime > _tinyNum) {
+ callback = "onReverseComplete";
+ }
+ }
+ this._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
+ }
+
+ } else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0.
+ this._totalTime = this._time = 0;
+ this.ratio = this._ease._calcEnd ? this._ease.getRatio(0) : 0;
+ if (prevTime !== 0 || (duration === 0 && prevRawPrevTime > 0 && prevRawPrevTime !== _tinyNum)) {
+ callback = "onReverseComplete";
+ isComplete = this._reversed;
+ }
+ if (time < 0) {
+ this._active = false;
+ if (duration === 0) if (this._initted || !this.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
+ if (prevRawPrevTime >= 0) {
+ force = true;
+ }
+ this._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
+ }
+ } else if (!this._initted) { //if we render the very beginning (time == 0) of a fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately.
+ force = true;
+ }
+ } else {
+ this._totalTime = this._time = time;
+
+ if (this._easeType) {
+ var r = time / duration, type = this._easeType, pow = this._easePower;
+ if (type === 1 || (type === 3 && r >= 0.5)) {
+ r = 1 - r;
+ }
+ if (type === 3) {
+ r *= 2;
+ }
+ if (pow === 1) {
+ r *= r;
+ } else if (pow === 2) {
+ r *= r * r;
+ } else if (pow === 3) {
+ r *= r * r * r;
+ } else if (pow === 4) {
+ r *= r * r * r * r;
+ }
+
+ if (type === 1) {
+ this.ratio = 1 - r;
+ } else if (type === 2) {
+ this.ratio = r;
+ } else if (time / duration < 0.5) {
+ this.ratio = r / 2;
+ } else {
+ this.ratio = 1 - (r / 2);
+ }
+
+ } else {
+ this.ratio = this._ease.getRatio(time / duration);
+ }
+ }
+
+ if (this._time === prevTime && !force) {
+ return;
+ } else if (!this._initted) {
+ this._init();
+ if (!this._initted || this._gc) { //immediateRender tweens typically won't initialize until the playhead advances (_time is greater than 0) in order to ensure that overwriting occurs properly. Also, if all of the tweening properties have been overwritten (which would cause _gc to be true, as set in _init()), we shouldn't continue otherwise an onStart callback could be called for example.
+ return;
+ } else if (!force && this._firstPT && ((this.vars.lazy !== false && this._duration) || (this.vars.lazy && !this._duration))) {
+ this._time = this._totalTime = prevTime;
+ this._rawPrevTime = prevRawPrevTime;
+ _lazyTweens.push(this);
+ this._lazy = time;
+ return;
+ }
+ //_ease is initially set to defaultEase, so now that init() has run, _ease is set properly and we need to recalculate the ratio. Overall this is faster than using conditional logic earlier in the method to avoid having to set ratio twice because we only init() once but renderTime() gets called VERY frequently.
+ if (this._time && !isComplete) {
+ this.ratio = this._ease.getRatio(this._time / duration);
+ } else if (isComplete && this._ease._calcEnd) {
+ this.ratio = this._ease.getRatio((this._time === 0) ? 0 : 1);
+ }
+ }
+ if (this._lazy !== false) { //in case a lazy render is pending, we should flush it because the new render is occuring now (imagine a lazy tween instantiating and then immediately the user calls tween.seek(tween.duration()), skipping to the end - the end render would be forced, and then if we didn't flush the lazy render, it'd fire AFTER the seek(), rendering it at the wrong time.
+ this._lazy = false;
+ }
+ if (!this._active) if (!this._paused && this._time !== prevTime && time >= 0) {
+ this._active = true; //so that if the user renders a tween (as opposed to the timeline rendering it), the timeline is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the tween already finished but the user manually re-renders it as halfway done.
+ }
+ if (prevTime === 0) {
+ if (this._startAt) {
+ if (time >= 0) {
+ this._startAt.render(time, suppressEvents, force);
+ } else if (!callback) {
+ callback = "_dummyGS"; //if no callback is defined, use a dummy value just so that the condition at the end evaluates as true because _startAt should render AFTER the normal render loop when the time is negative. We could handle this in a more intuitive way, of course, but the render loop is the MOST important thing to optimize, so this technique allows us to avoid adding extra conditional logic in a high-frequency area.
+ }
+ }
+ if (this.vars.onStart) if (this._time !== 0 || duration === 0) if (!suppressEvents) {
+ this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
+ }
+ }
+
+ pt = this._firstPT;
+ while (pt) {
+ if (pt.f) {
+ pt.t[pt.p](pt.c * this.ratio + pt.s);
+ } else {
+ pt.t[pt.p] = pt.c * this.ratio + pt.s;
+ }
+ pt = pt._next;
+ }
+
+ if (this._onUpdate) {
+ if (time < 0) if (this._startAt && this._startTime) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values.
+ this._startAt.render(time, suppressEvents, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete.
+ }
+ if (!suppressEvents) if (this._time !== prevTime || isComplete) {
+ this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
+ }
+ }
+
+ if (callback) if (!this._gc) { //check _gc because there's a chance that kill() could be called in an onUpdate
+ if (time < 0 && this._startAt && !this._onUpdate && this._startTime) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values.
+ this._startAt.render(time, suppressEvents, force);
+ }
+ if (isComplete) {
+ if (this._timeline.autoRemoveChildren) {
+ this._enabled(false, false);
+ }
+ this._active = false;
+ }
+ if (!suppressEvents && this.vars[callback]) {
+ this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray);
+ }
+ if (duration === 0 && this._rawPrevTime === _tinyNum && rawPrevTime !== _tinyNum) { //the onComplete or onReverseComplete could trigger movement of the playhead and for zero-duration tweens (which must discern direction) that land directly back on their start time, we don't want to fire again on the next render. Think of several addPause()'s in a timeline that forces the playhead to a certain spot, but what if it's already paused and another tween is tweening the "time" of the timeline? Each time it moves [forward] past that spot, it would move back, and since suppressEvents is true, it'd reset _rawPrevTime to _tinyNum so that when it begins again, the callback would fire (so ultimately it could bounce back and forth during that tween). Again, this is a very uncommon scenario, but possible nonetheless.
+ this._rawPrevTime = 0;
+ }
+ }
+
+ };
+
+ p._kill = function(vars, target) {
+ if (vars === "all") {
+ vars = null;
+ }
+ if (vars == null) if (target == null || target === this.target) {
+ this._lazy = false;
+ return this._enabled(false, false);
+ }
+ target = (typeof(target) !== "string") ? (target || this._targets || this.target) : TweenLite.selector(target) || target;
+ var i, overwrittenProps, p, pt, propLookup, changed, killProps, record;
+ if ((_isArray(target) || _isSelector(target)) && typeof(target[0]) !== "number") {
+ i = target.length;
+ while (--i > -1) {
+ if (this._kill(vars, target[i])) {
+ changed = true;
+ }
+ }
+ } else {
+ if (this._targets) {
+ i = this._targets.length;
+ while (--i > -1) {
+ if (target === this._targets[i]) {
+ propLookup = this._propLookup[i] || {};
+ this._overwrittenProps = this._overwrittenProps || [];
+ overwrittenProps = this._overwrittenProps[i] = vars ? this._overwrittenProps[i] || {} : "all";
+ break;
+ }
+ }
+ } else if (target !== this.target) {
+ return false;
+ } else {
+ propLookup = this._propLookup;
+ overwrittenProps = this._overwrittenProps = vars ? this._overwrittenProps || {} : "all";
+ }
+
+ if (propLookup) {
+ killProps = vars || propLookup;
+ record = (vars !== overwrittenProps && overwrittenProps !== "all" && vars !== propLookup && (typeof(vars) !== "object" || !vars._tempKill)); //_tempKill is a super-secret way to delete a particular tweening property but NOT have it remembered as an official overwritten property (like in BezierPlugin)
+ for (p in killProps) {
+ if ((pt = propLookup[p])) {
+ if (pt.pg && pt.t._kill(killProps)) {
+ changed = true; //some plugins need to be notified so they can perform cleanup tasks first
+ }
+ if (!pt.pg || pt.t._overwriteProps.length === 0) {
+ if (pt._prev) {
+ pt._prev._next = pt._next;
+ } else if (pt === this._firstPT) {
+ this._firstPT = pt._next;
+ }
+ if (pt._next) {
+ pt._next._prev = pt._prev;
+ }
+ pt._next = pt._prev = null;
+ }
+ delete propLookup[p];
+ }
+ if (record) {
+ overwrittenProps[p] = 1;
+ }
+ }
+ if (!this._firstPT && this._initted) { //if all tweening properties are killed, kill the tween. Without this line, if there's a tween with multiple targets and then you killTweensOf() each target individually, the tween would technically still remain active and fire its onComplete even though there aren't any more properties tweening.
+ this._enabled(false, false);
+ }
+ }
+ }
+ return changed;
+ };
+
+ p.invalidate = function() {
+ if (this._notifyPluginsOfEnabled) {
+ TweenLite._onPluginEvent("_onDisable", this);
+ }
+ this._firstPT = null;
+ this._overwrittenProps = null;
+ this._onUpdate = null;
+ this._startAt = null;
+ this._initted = this._active = this._notifyPluginsOfEnabled = this._lazy = false;
+ this._propLookup = (this._targets) ? {} : [];
+ return this;
+ };
+
+ p._enabled = function(enabled, ignoreTimeline) {
+ if (!_tickerActive) {
+ _ticker.wake();
+ }
+ if (enabled && this._gc) {
+ var targets = this._targets,
+ i;
+ if (targets) {
+ i = targets.length;
+ while (--i > -1) {
+ this._siblings[i] = _register(targets[i], this, true);
+ }
+ } else {
+ this._siblings = _register(this.target, this, true);
+ }
+ }
+ Animation.prototype._enabled.call(this, enabled, ignoreTimeline);
+ if (this._notifyPluginsOfEnabled) if (this._firstPT) {
+ return TweenLite._onPluginEvent((enabled ? "_onEnable" : "_onDisable"), this);
+ }
+ return false;
+ };
+
+
+//----TweenLite static methods -----------------------------------------------------
+
+ TweenLite.to = function(target, duration, vars) {
+ return new TweenLite(target, duration, vars);
+ };
+
+ TweenLite.from = function(target, duration, vars) {
+ vars.runBackwards = true;
+ vars.immediateRender = (vars.immediateRender != false);
+ return new TweenLite(target, duration, vars);
+ };
+
+ TweenLite.fromTo = function(target, duration, fromVars, toVars) {
+ toVars.startAt = fromVars;
+ toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false);
+ return new TweenLite(target, duration, toVars);
+ };
+
+ TweenLite.delayedCall = function(delay, callback, params, scope, useFrames) {
+ return new TweenLite(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, onCompleteScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, onReverseCompleteScope:scope, immediateRender:false, useFrames:useFrames, overwrite:0});
+ };
+
+ TweenLite.set = function(target, vars) {
+ return new TweenLite(target, 0, vars);
+ };
+
+ TweenLite.getTweensOf = function(target, onlyActive) {
+ if (target == null) { return []; }
+ target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target;
+ var i, a, j, t;
+ if ((_isArray(target) || _isSelector(target)) && typeof(target[0]) !== "number") {
+ i = target.length;
+ a = [];
+ while (--i > -1) {
+ a = a.concat(TweenLite.getTweensOf(target[i], onlyActive));
+ }
+ i = a.length;
+ //now get rid of any duplicates (tweens of arrays of objects could cause duplicates)
+ while (--i > -1) {
+ t = a[i];
+ j = i;
+ while (--j > -1) {
+ if (t === a[j]) {
+ a.splice(i, 1);
+ }
+ }
+ }
+ } else {
+ a = _register(target).concat();
+ i = a.length;
+ while (--i > -1) {
+ if (a[i]._gc || (onlyActive && !a[i].isActive())) {
+ a.splice(i, 1);
+ }
+ }
+ }
+ return a;
+ };
+
+ TweenLite.killTweensOf = TweenLite.killDelayedCallsTo = function(target, onlyActive, vars) {
+ if (typeof(onlyActive) === "object") {
+ vars = onlyActive; //for backwards compatibility (before "onlyActive" parameter was inserted)
+ onlyActive = false;
+ }
+ var a = TweenLite.getTweensOf(target, onlyActive),
+ i = a.length;
+ while (--i > -1) {
+ a[i]._kill(vars, target);
+ }
+ };
+
+
+
+/*
+ * ----------------------------------------------------------------
+ * TweenPlugin (could easily be split out as a separate file/class, but included for ease of use (so that people don't need to include another <script> call before loading plugins which is easy to forget)
+ * ----------------------------------------------------------------
+ */
+ var TweenPlugin = _class("plugins.TweenPlugin", function(props, priority) {
+ this._overwriteProps = (props || "").split(",");
+ this._propName = this._overwriteProps[0];
+ this._priority = priority || 0;
+ this._super = TweenPlugin.prototype;
+ }, true);
+
+ p = TweenPlugin.prototype;
+ TweenPlugin.version = "1.10.1";
+ TweenPlugin.API = 2;
+ p._firstPT = null;
+
+ p._addTween = function(target, prop, start, end, overwriteProp, round) {
+ var c, pt;
+ if (end != null && (c = (typeof(end) === "number" || end.charAt(1) !== "=") ? Number(end) - start : parseInt(end.charAt(0) + "1", 10) * Number(end.substr(2)))) {
+ this._firstPT = pt = {_next:this._firstPT, t:target, p:prop, s:start, c:c, f:(typeof(target[prop]) === "function"), n:overwriteProp || prop, r:round};
+ if (pt._next) {
+ pt._next._prev = pt;
+ }
+ return pt;
+ }
+ };
+
+ p.setRatio = function(v) {
+ var pt = this._firstPT,
+ min = 0.000001,
+ val;
+ while (pt) {
+ val = pt.c * v + pt.s;
+ if (pt.r) {
+ val = Math.round(val);
+ } else if (val < min) if (val > -min) { //prevents issues with converting very small numbers to strings in the browser
+ val = 0;
+ }
+ if (pt.f) {
+ pt.t[pt.p](val);
+ } else {
+ pt.t[pt.p] = val;
+ }
+ pt = pt._next;
+ }
+ };
+
+ p._kill = function(lookup) {
+ var a = this._overwriteProps,
+ pt = this._firstPT,
+ i;
+ if (lookup[this._propName] != null) {
+ this._overwriteProps = [];
+ } else {
+ i = a.length;
+ while (--i > -1) {
+ if (lookup[a[i]] != null) {
+ a.splice(i, 1);
+ }
+ }
+ }
+ while (pt) {
+ if (lookup[pt.n] != null) {
+ if (pt._next) {
+ pt._next._prev = pt._prev;
+ }
+ if (pt._prev) {
+ pt._prev._next = pt._next;
+ pt._prev = null;
+ } else if (this._firstPT === pt) {
+ this._firstPT = pt._next;
+ }
+ }
+ pt = pt._next;
+ }
+ return false;
+ };
+
+ p._roundProps = function(lookup, value) {
+ var pt = this._firstPT;
+ while (pt) {
+ if (lookup[this._propName] || (pt.n != null && lookup[ pt.n.split(this._propName + "_").join("") ])) { //some properties that are very plugin-specific add a prefix named after the _propName plus an underscore, so we need to ignore that extra stuff here.
+ pt.r = value;
+ }
+ pt = pt._next;
+ }
+ };
+
+ TweenLite._onPluginEvent = function(type, tween) {
+ var pt = tween._firstPT,
+ changed, pt2, first, last, next;
+ if (type === "_onInitAllProps") {
+ //sorts the PropTween linked list in order of priority because some plugins need to render earlier/later than others, like MotionBlurPlugin applies its effects after all x/y/alpha tweens have rendered on each frame.
+ while (pt) {
+ next = pt._next;
+ pt2 = first;
+ while (pt2 && pt2.pr > pt.pr) {
+ pt2 = pt2._next;
+ }
+ if ((pt._prev = pt2 ? pt2._prev : last)) {
+ pt._prev._next = pt;
+ } else {
+ first = pt;
+ }
+ if ((pt._next = pt2)) {
+ pt2._prev = pt;
+ } else {
+ last = pt;
+ }
+ pt = next;
+ }
+ pt = tween._firstPT = first;
+ }
+ while (pt) {
+ if (pt.pg) if (typeof(pt.t[type]) === "function") if (pt.t[type]()) {
+ changed = true;
+ }
+ pt = pt._next;
+ }
+ return changed;
+ };
+
+ TweenPlugin.activate = function(plugins) {
+ var i = plugins.length;
+ while (--i > -1) {
+ if (plugins[i].API === TweenPlugin.API) {
+ _plugins[(new plugins[i]())._propName] = plugins[i];
+ }
+ }
+ return true;
+ };
+
+ //provides a more concise way to define plugins that have no dependencies besides TweenPlugin and TweenLite, wrapping common boilerplate stuff into one function (added in 1.9.0). You don't NEED to use this to define a plugin - the old way still works and can be useful in certain (rare) situations.
+ _gsDefine.plugin = function(config) {
+ if (!config || !config.propName || !config.init || !config.API) { throw "illegal plugin definition."; }
+ var propName = config.propName,
+ priority = config.priority || 0,
+ overwriteProps = config.overwriteProps,
+ map = {init:"_onInitTween", set:"setRatio", kill:"_kill", round:"_roundProps", initAll:"_onInitAllProps"},
+ Plugin = _class("plugins." + propName.charAt(0).toUpperCase() + propName.substr(1) + "Plugin",
+ function() {
+ TweenPlugin.call(this, propName, priority);
+ this._overwriteProps = overwriteProps || [];
+ }, (config.global === true)),
+ p = Plugin.prototype = new TweenPlugin(propName),
+ prop;
+ p.constructor = Plugin;
+ Plugin.API = config.API;
+ for (prop in map) {
+ if (typeof(config[prop]) === "function") {
+ p[map[prop]] = config[prop];
+ }
+ }
+ Plugin.version = config.version;
+ TweenPlugin.activate([Plugin]);
+ return Plugin;
+ };
+
+
+ //now run through all the dependencies discovered and if any are missing, log that to the console as a warning. This is why it's best to have TweenLite load last - it can check all the dependencies for you.
+ a = window._gsQueue;
+ if (a) {
+ for (i = 0; i < a.length; i++) {
+ a[i]();
+ }
+ for (p in _defLookup) {
+ if (!_defLookup[p].func) {
+ //window.console.log("GSAP encountered missing dependency: com.greensock." + p);
+ }
+ }
+ }
+
+ _tickerActive = false; //ensures that the first official animation forces a ticker.tick() to update the time when it is instantiated
+
+})(window);
+
+angular.module('att.abs.transition', [])
+
+.factory('$transition', ['$q', '$timeout', '$rootScope', function($q, $timeout, $rootScope) {
+
+ var $transition = function(element, trigger, options) {
+ options = options || {};
+ var deferred = $q.defer();
+ var endEventName = $transition[options.animation ? "animationEndEventName" : "transitionEndEventName"];
+
+ var transitionEndHandler = function() {
+ $rootScope.$apply(function() {
+ element.unbind(endEventName, transitionEndHandler);
+ deferred.resolve(element);
+ });
+ };
+
+ if (endEventName) {
+ element.bind(endEventName, transitionEndHandler);
+ }
+
+ // Wrap in a timeout to allow the browser time to update the DOM before the transition is to occur
+ $timeout(function() {
+ if ( angular.isString(trigger) ) {
+ element.addClass(trigger);
+ } else if ( angular.isFunction(trigger) ) {
+ trigger(element);
+ } else if ( angular.isObject(trigger) ) {
+ element.css(trigger);
+ }
+ //If browser does not support transitions, instantly resolve
+ if ( !endEventName ) {
+ deferred.resolve(element);
+ }
+ }, 100);
+
+ // Add our custom cancel function to the promise that is returned
+ // We can call this if we are about to run a new transition, which we know will prevent this transition from ending,
+ // i.e. it will therefore never raise a transitionEnd event for that transition
+ deferred.promise.cancel = function() {
+ if ( endEventName ) {
+ element.unbind(endEventName, transitionEndHandler);
+ }
+ deferred.reject('Transition cancelled');
+ };
+
+ return deferred.promise;
+ };
+
+ // Work out the name of the transitionEnd event
+ var transElement = document.createElement('trans');
+ var transitionEndEventNames = {
+ 'WebkitTransition': 'webkitTransitionEnd',
+ 'MozTransition': 'transitionend',
+ 'OTransition': 'oTransitionEnd',
+ 'transition': 'transitionend'
+ };
+ var animationEndEventNames = {
+ 'WebkitTransition': 'webkitAnimationEnd',
+ 'MozTransition': 'animationend',
+ 'OTransition': 'oAnimationEnd',
+ 'transition': 'animationend'
+ };
+ function findEndEventName(endEventNames) {
+ for (var name in endEventNames){
+ if (transElement.style[name] !== undefined) {
+ return endEventNames[name];
+ }
+ }
+ }
+ $transition.transitionEndEventName = findEndEventName(transitionEndEventNames);
+ $transition.animationEndEventName = findEndEventName(animationEndEventNames);
+ return $transition;
+}])
+
+.factory('$scrollTo', ['$window', function($window) {
+ var $scrollTo = function(offsetLeft, offsetTop, duration) {
+ TweenMax.to($window, duration || 1, {scrollTo: {y: offsetTop, x: offsetLeft}, ease: Power4.easeOut});
+ };
+ return $scrollTo;
+}])
+.factory('animation', function(){
+ return TweenMax;
+})
+.factory('$progressBar', function(){
+
+ //Provides a function to pass in code for closure purposes
+ var loadingAnimationCreator = function(onUpdateCallback){
+
+ //Use closure to setup some resuable code
+ var loadingAnimation = function(callback, duration){
+ TweenMax.to({}, duration, {
+ onUpdateParams: ["{self}"],
+ onUpdate: onUpdateCallback,
+ onComplete: callback
+ });
+ };
+ //Returns a function that takes a callback function and a duration for the animation
+ return (function(){
+ return loadingAnimation;
+ })();
+ };
+
+ return loadingAnimationCreator;
+})
+.factory('$height', function(){
+ var heightAnimation = function(element,duration,height,alpha){
+ TweenMax.to(element,
+ duration,
+ {height:height, autoAlpha:alpha},
+ 0);
+ };
+ return heightAnimation;
+});
+angular.module('att.abs.accordion', ['att.abs.utilities', 'att.abs.position', 'att.abs.transition'])
+.constant('accordionConfig', {
+ closeOthers: false
+}).controller('AccordionController', ['$scope', '$attrs', 'accordionConfig', '$log',
+function ($scope, $attrs, accordionConfig, $log) {
+// This array keeps track of the accordion groups
+this.groups = [];
+this.index = -1;
+// Keep reference to user's scope to properly assign `is-open`
+this.scope = $scope;
+$scope.forceExpand = false;
+// Ensure that all the groups in this accordion are closed, unless close-others explicitly says not to
+this.closeOthers = function (openGroup) {
+ var closeOthers = angular.isDefined($attrs.closeOthers) ? $scope.$eval($attrs.closeOthers) : accordionConfig.closeOthers;
+ if (closeOthers && !$scope.forceExpand) {
+ angular.forEach(this.groups, function (group) {
+ if (group !== openGroup) {
+ group.isOpen = false;
+ }
+ });
+ }
+ if (this.groups.indexOf(openGroup) === (this.groups.length - 1) && $scope.forceExpand) {
+ $scope.forceExpand = false;
+ }
+};
+this.expandAll = function () {
+ $scope.forceExpand = true;
+ angular.forEach(this.groups, function (group) {
+ group.isOpen = true;
+ });
+};
+this.collapseAll = function () {
+ angular.forEach(this.groups, function (group) {
+ group.isOpen = false;
+ });
+};
+/**function focus @param focusGroup */
+this.focus = function (focusGroup) {
+ var self = this;
+ angular.forEach(this.groups, function (group, index) {
+ if (group !== focusGroup) {
+ group.focused = false;
+ } else {
+ self.index = index;
+ group.focused = true;
+ }
+ });
+};
+/** @param blurGroup*/
+this.blur = function (blurGroup) {
+ blurGroup.focused = false;
+ this.index = -1;
+ $log.log("accordion.blur()", blurGroup);
+};
+/** @param group - the group in current focus @param down - cycling down */
+this.cycle = function (group, down, noRecycle) {
+ if (!down) {
+ if (this.index <= 0 && !noRecycle) {
+ this.index = this.groups.length - 1;
+ } else {
+ this.index--;
+ }
+ } else {
+ if (this.index === (this.groups.length - 1))
+ {
+ if (noRecycle) {
+ this.index = 0;
+ group.focused = false;
+ $scope.$apply();
+ return;
+ }
+ else
+ {
+ this.index = 0;
+ }
+ } else {
+ this.index++;
+ }
+ }
+
+ group.focused = false;
+ this.groups[this.index].setFocus = true;
+ this.groups[this.index].focused = true;
+ $scope.$apply();
+};
+// This is called from the accordion-group directive to add itself to the accordion
+this.addGroup = function (groupScope) {
+ var that = this;
+ groupScope.index = this.groups.length;
+ groupScope.focused = false;
+ this.groups.push(groupScope);
+
+ if(this.groups.length > 0){
+ this.index = 0;
+ }
+
+ groupScope.$on('$destroy', function () {
+ that.removeGroup(groupScope);
+ });
+};
+// This is called from the accordion-group directive when to remove itself
+this.removeGroup = function (group) {
+ var index = this.groups.indexOf(group);
+ if (index !== -1) {
+ this.groups.splice(this.groups.indexOf(group), 1);
+ }
+};
+}])
+//The accordion directive simply sets up the directive controller and adds an accordion CSS class to itself element.
+.directive('accordion', function () {
+ return {
+ restrict: 'EA',
+ controller: 'AccordionController',
+ transclude: true,
+ replace: false,
+ scope: {
+ cClass: '@css',
+ expandAll: "=?",
+ collapseAll: "=?"
+ },
+ template: '<div class="{{cClass}}" ng-transclude></div>',
+ link: function (scope, elem, attribute, ctrl) {
+ scope.$watch("expandAll", function (value) {
+ if (value) {
+ ctrl.expandAll();
+ scope.expandAll = false;
+ }
+ });
+ scope.$watch("collapseAll", function (value) {
+ if (value) {
+ ctrl.collapseAll();
+ scope.collapseAll = false;
+ }
+ });
+ }
+ };
+})
+//The accordion-group directive indicates a block of html that will expand and collapse in an accordion
+.directive('accordionGroup', [ function () {
+ return {
+ // We need this directive to be inside an accordion
+ require: ['^accordion', 'accordionGroup'],
+ restrict: 'EA',
+ // It transcludes the contents of the directive into the template
+ transclude: true,
+ // The element containing the directive will be replaced with the template
+ replace: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/accordion/accordion.html',
+ scope: {
+ // Create an isolated scope and interpolate the heading attribute onto this scope
+ heading: '@',
+ isOpen: '=?'
+ },
+ controller: ['$scope', function ($scope)
+ {
+ $scope.showicon = true;
+ this.setHeading = function (element)
+ {
+ this.heading = element;
+ $scope.showicon = false;
+ };
+ this.isIsOpen = function ()
+ {
+ return $scope.isOpen;
+ };
+ }],
+ link: function (scope, element, attrs, ctrl) {
+ var accordionCtrl = ctrl[0];
+ var accordionGroupCtrl = ctrl[1];
+ var keys = {tab: 9, enter: 13, esc: 27, space: 32, pageup: 33, pagedown: 34, end: 35, home: 36, left: 37, up: 38, right: 39, down: 40};
+ //not a fix
+ var tab = element.children().eq(0);
+ var parentHyperLink=attrs.parentLink;
+ scope.setFocus = false;
+ scope.childLength = attrs.childLength;
+ scope.headingIconClass = attrs.imageSource;
+
+ var handleKeydown = function (ev) {
+ var boolFlag = true;
+ switch (ev.keyCode)
+ {
+ case keys.enter:
+ ev.preventDefault();
+ scope.toggle();
+ scope.$apply();
+ break;
+ case keys.up:
+ case keys.left:
+ ev.preventDefault();
+ accordionCtrl.cycle(scope, false);
+ break;
+ case keys.down:
+ case keys.right:
+ ev.preventDefault();
+ accordionCtrl.cycle(scope, true);
+ break;
+ default:
+ boolFlag = false;
+ break;
+ }
+ ev.stopPropagation();
+ return boolFlag;
+ };
+
+ if (angular.isUndefined(scope.isOpen)) {
+ scope.isOpen = false;
+ }
+
+ tab.bind("keydown", handleKeydown);
+
+ accordionCtrl.addGroup(scope);
+
+ if (scope.index === 0) {
+ scope.focused = true;
+ }
+
+ accordionGroupCtrl.toggle = scope.toggle = function () {
+ /* if the menu item has children, toggle/expand child menu of this item */
+ if (scope.childLength>0) {
+ scope.isOpen = !scope.isOpen;
+ accordionCtrl.focus(scope);
+ return scope.isOpen;
+ }
+ /* if the menu item does not have children, redirect to parent action URL*/
+ else {
+ window.location.href = parentHyperLink;
+ }
+
+ };
+
+ scope.$watch('isOpen', function (value) {
+ if (value) {
+ accordionCtrl.closeOthers(scope);
+ }
+ });
+
+ scope.$watch("focused", function (value) {
+ if (!!value) {
+ tab.attr("tabindex", "0");
+ if(scope.setFocus){
+ tab[0].focus();
+ }
+ }
+ else{
+ scope.setFocus = false;
+ tab.attr("tabindex", "-1");
+ }
+ });
+ }
+ };
+ }])
+//Use accordion-heading below an accordion-group to provide a heading containing HTML
+//<accordion-group>
+//<accordion-heading>Heading containing HTML - <img src="..."></accordion-heading>
+//</accordion-group>
+.directive('accordionToggle', function () {
+ return{
+ restrict: 'EA',
+ require: '^accordionGroup',
+ scope: {
+ expandIcon: '@',
+ collapseIcon: '@'
+ },
+ link: function (scope, element, attr, accordionCtrl)
+ {
+ var setIcon = function (isOpen) {
+ if (scope.expandIcon && scope.collapseIcon)
+ {
+ if (isOpen) {
+ element.removeClass(scope.expandIcon);
+ element.addClass(scope.collapseIcon);
+ }
+ else {
+ element.removeClass(scope.collapseIcon);
+ element.addClass(scope.expandIcon);
+ }
+ }
+ };
+ element.bind('click', function ()
+ {
+ accordionCtrl.toggle();
+ scope.$apply();
+ });
+ scope.$watch(function () {
+ return accordionCtrl.isIsOpen();
+ }, function (value) {
+ setIcon(value);
+ });
+ }
+ };
+}).directive('accordionHeading', function () {
+return {
+restrict: 'EA',
+transclude: true,
+template: '',
+require: '^accordionGroup',
+compile: function (element, attr, transclude) {
+ var link = function (scope, element, attr, accordionGroupCtrl) {
+ // Pass the heading to the accordion-group controller
+ // so that it can be transcluded into the right place in the template
+ // [The second parameter to transclude causes the elements to be cloned so that they work in ng-repeat]
+ transclude(scope, function (clone) {
+ element.append(clone);
+ accordionGroupCtrl.setHeading(element);
+ });
+ };
+ return link;
+}
+};
+})
+// Use in the accordion-group template to indicate where you want the heading to be transcluded
+// You must provide the property on the accordion-group controller that will hold the transcluded element
+ .directive('accordionTransclude', function () {
+ return {
+ require: '^accordionGroup',
+ link: function (scope, element, attr, controller) {
+ scope.$watch(function () {
+ return controller[attr.accordionTransclude];
+ }, function (heading) {
+ if (heading) {
+ element.find("span").eq(0).prepend(heading);
+ }
+ });
+ }
+ };
+ })
+ .directive('attGoTop', ['$scrollTo', function ($scrollTo) {
+ return {
+ restrict: 'A',
+ transclude: false,
+ link: function (scope, elem, attrs)
+ {
+ elem.bind('click', function ()
+ {
+ $scrollTo(0, attrs["attGoTop"]);
+ });
+ }
+ };
+ }])
+ .directive('attGoTo', ['$anchorScroll', '$location', function ($anchorScroll, $location) {
+ return {
+ restrict: 'A',
+ transclude: false,
+ link: function (scope, elem, attrs)
+ {
+ elem.bind('click', function ()
+ {
+ var newHash = attrs["attGoTo"];
+ if ($location.hash() !== newHash)
+ {
+ $location.hash(attrs["attGoTo"]);
+ }
+ else
+ {
+ $anchorScroll();
+ }
+ });
+ }
+ };
+ }])
+ .directive('freeStanding', function () {
+ return {
+ restrict: 'EA',
+ transclude: true,
+ replace: true,
+ scope: true,
+ template: "<div><span class='att-accordion__freestanding' ng-show='showAccordion'></span>\n" +
+ "<div class='section-toggle'>\n" +
+ "<button class='section-toggle__button' ng-click='fsToggle()'>\n" +
+ " {{btnText}}<i style='font-size:0.875rem' ng-class='{\"ion-ios-arrow-up\": showAccordion,\"ion-ios-arrow-down\": !showAccordion, }'></i> \n" +
+ "</button>\n" +
+ "</div></div>",
+ compile: function (element, attr, transclude)
+ {
+ var link = function (scope, elem, attrs) {
+ scope.content = "";
+ transclude(scope, function (clone)
+ {
+ elem.find("span").append(clone);
+ });
+ scope.showAccordion = false;
+ scope.btnText = scope.showAccordion ? attrs.hideMsg : attrs.showMsg;
+ scope.fsToggle = function ()
+ {
+ scope.showAccordion = !scope.showAccordion;
+ scope.btnText = scope.showAccordion ? attrs.hideMsg : attrs.showMsg;
+ };
+ };
+ return link;
+ }
+ };
+ }).directive('expanders', function () {
+ return{
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ template: "<div ng-transclude></div>",
+ controller: ['$scope', function ($scope){
+ var bodyScope = null;
+ this.setScope = function (scope) {
+ bodyScope = scope;
+ };
+ this.toggle = function () {
+ $scope.isOpen = bodyScope.isOpen = !bodyScope.isOpen;
+ return bodyScope.isOpen;
+ };
+ }],
+ link: function (scope)
+ {
+ scope.isOpen = false;
+ }
+ };
+}).directive('expanderHeading', function () {
+ return{
+ require: "^expanders",
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ scope: true,
+ template: "<div style='padding:10px !important' ng-transclude></div>"
+ };
+}).directive('expanderBody', function () {
+ return{
+ restrict: 'EA',
+ require: "^expanders",
+ replace: true,
+ transclude: true,
+ scope: {},
+ template: "<div collapse='!isOpen'><div ng-transclude></div></div>",
+ link: function (scope, elem, attr, myCtrl) {
+ scope.isOpen = false;
+ myCtrl.setScope(scope);
+ }
+ };
+}).directive('expanderToggle', function () {
+ return{
+ restrict: 'EA',
+ require: "^expanders",
+ scope: {
+ expandIcon: '@',
+ collapseIcon: '@'
+ },
+ link: function (scope, element, attr, myCtrl)
+ {
+ var isOpen = false;
+ var setIcon = function () {
+ if (scope.expandIcon && scope.collapseIcon)
+ {
+ if (isOpen) {
+ element.removeClass(scope.expandIcon);
+ element.addClass(scope.collapseIcon);
+ }
+ else {
+ element.removeClass(scope.collapseIcon);
+ element.addClass(scope.expandIcon);
+ }
+ }
+ };
+ element.bind("keydown", function (e) {
+ if (e.keyCode === 13)
+ {
+ scope.toggleit();
+ }
+ });
+ element.bind('click', function ()
+ {
+ scope.toggleit();
+ });
+ scope.toggleit = function ()
+ {
+ isOpen = myCtrl.toggle();
+ setIcon();
+ scope.$apply();
+ };
+ setIcon();
+ }
+ };
+}).directive('collapse', ['$transition', function ($transition) {
+ // CSS transitions don't work with height: auto, so we have to manually change the height to a
+ // specific value and then once the animation completes, we can reset the height to auto.
+ // Unfortunately if you do this while the CSS transitions are specified (i.e. in the CSS class
+ // "collapse") then you trigger a change to height 0 in between.
+ // The fix is to remove the "collapse" CSS class while changing the height back to auto - phew!
+ var props = {
+ open: {
+ marginTop: null,
+ marginBottom: null,
+ paddingTop: null,
+ paddingBottom: null,
+ display: 'block'
+ },
+ closed: {
+ marginTop: 0,
+ marginBottom: 0,
+ paddingTop: 0,
+ paddingBottom: 0,
+ display: 'none'
+ }
+ };
+ var fixUpHeight = function (scope, element, height) {
+ // We remove the collapse CSS class to prevent a transition when we change to height: auto
+ element.removeClass('collapse');
+ element.css({height: height});
+ //adjusting for any margin or padding
+ if (height === 0) {
+ element.css(props.closed);
+ } else {
+ element.css(props.open);
+ }
+ // It appears that reading offsetWidth makes the browser realise that we have changed the
+ // height already :-/
+ element.addClass('collapse');
+ };
+ return {
+ link: function (scope, element, attrs) {
+ var isCollapsed;
+ var initialAnimSkip = true;
+ scope.$watch(function () {
+ return element[0].scrollHeight;
+ }, function () {
+ //The listener is called when scrollHeight changes
+ //It actually does on 2 scenarios:
+ // 1. Parent is set to display none
+ // 2. angular bindings inside are resolved
+ //When we have a change of scrollHeight we are setting again the correct height if the group is opened
+ if (element[0].scrollHeight !== 0 && !isCollapsed) {
+ if (initialAnimSkip) {
+ fixUpHeight(scope, element, element[0].scrollHeight + 'px');
+ } else {
+ fixUpHeight(scope, element, 'auto');
+ }
+ }
+ });
+ var currentTransition;
+ var doTransition = function (change) {
+ if (currentTransition) {
+ currentTransition.cancel();
+ }
+ currentTransition = $transition(element, change);
+ currentTransition.then(
+ function () {
+ currentTransition = undefined;
+ },
+ function () {
+ currentTransition = undefined;
+ }
+ );
+ return currentTransition;
+ };
+ var expand = function () {
+ scope.postTransition = true;
+ if (initialAnimSkip) {
+ initialAnimSkip = false;
+ if (!isCollapsed) {
+ fixUpHeight(scope, element, 'auto');
+ }
+ } else {
+ doTransition(angular.extend({height: element[0].scrollHeight + 'px'}, props.open))
+ .then(function () {
+ // This check ensures that we don't accidentally update the height if the user has closed
+ // the group while the animation was still running
+ if (!isCollapsed)
+ {
+ fixUpHeight(scope, element, 'auto');
+ }
+ });
+ }
+ isCollapsed = false;
+ };
+ var collapse = function () {
+ isCollapsed = true;
+ if (initialAnimSkip) {
+ initialAnimSkip = false;
+ fixUpHeight(scope, element, 0);
+ } else {
+ fixUpHeight(scope, element, element[0].scrollHeight + 'px');
+ doTransition(angular.extend({height: 0}, props.closed)).then(function () {
+ scope.postTransition = false;
+ });
+ }
+ };
+ scope.$watch(attrs.collapse, function (value) {
+ if (value) {
+ collapse();
+ } else {
+ expand();
+ }
+ });
+ }
+ };
+ }])
+ .directive('attAccord', function () {
+ return {
+ restrict: 'EA',
+ transclude: true,
+ replace: true,
+ scope: {},
+ controller: 'AttAccordCtrl',
+ templateUrl: 'app/scripts/ng_js_att_tpls/accordion/attAccordHeader.html'
+ };
+ })
+ .controller('AttAccordCtrl', [function () {
+ this.type = 'attAccord';
+ this.headerCtrl;
+ this.bodyCtrl;
+ var isOpen = true;
+ this.toggleBody = function () {
+ if (isOpen) {
+ this.expandBody();
+ }
+ else {
+ this.collapseBody();
+ }
+ isOpen = !isOpen;
+ };
+ this.expandBody = function () {
+ this.bodyCtrl.expand();
+ };
+ this.collapseBody = function () {
+ this.bodyCtrl.collapse();
+ };
+ }])
+ .controller('AttAccordHeaderCtrl', [function () {
+ this.type = 'header';
+ }])
+ .directive('attAccordHeader', ['keymap', 'events', function (keymap, events) {
+ return {
+ restrict: 'EA',
+ transclude: true,
+ replace: true,
+ require: ['^attAccord', 'attAccordHeader'],
+ controller: 'AttAccordHeaderCtrl',
+ templateUrl: 'app/scripts/ng_js_att_tpls/accordion/attAccordHeader.html',
+ link: function (scope, element, attr, ctrls) {
+ var attAccordCtrl = ctrls[0];
+ var attAccordHeaderCtrl = ctrls[1];
+ attAccordCtrl.headerCtrl = attAccordHeaderCtrl;
+ var tab = element.children().eq(0);
+
+ scope.clickFunc = function () {
+ attAccordCtrl.toggleBody();
+ };
+
+ var handleKeydown = function (ev) {
+ var boolFlag = true;
+ switch (ev.keyCode)
+ {
+ case keymap.KEY.ENTER:
+ ev.preventDefault();
+ scope.clickFunc();
+ scope.$apply();
+ break;
+ default:
+ boolFlag = false;
+ break;
+ }
+ ev.stopPropagation();
+ return boolFlag;
+ };
+
+ if (angular.isUndefined(scope.isOpen)) {
+ scope.isOpen = false;
+ }
+
+ tab.bind("keydown", handleKeydown);
+ }
+ };
+ }])
+ .controller('AttAccordBodyCtrl', ['$scope', function ($scope) {
+ this.type = 'body';
+ this.expand = function () {
+ $scope.expand();
+ };
+ this.collapse = function () {
+ $scope.collapse();
+ };
+ }])
+ .directive('attAccordBody', ['$timeout', '$height', function ($timeout, $height) {
+ return {
+ restrict: 'EA',
+ transclude: true,
+ replace: true,
+ require: ['^attAccord', 'attAccordBody'],
+ controller: 'AttAccordBodyCtrl',
+ templateUrl: 'app/scripts/ng_js_att_tpls/accordion/attAccordBody.html',
+ link: function (scope, element, attr, ctrls) {
+ var attAccordCtrl = ctrls[0];
+ var attAccordBodyCtrl = ctrls[1];
+ attAccordCtrl.bodyCtrl = attAccordBodyCtrl;
+ var originalHeight;
+ $timeout(function () {
+ originalHeight = element[0].offsetHeight;
+ $height(element, 0, 0, 0);
+ });
+ scope.expand = function () {
+ $height(element, 0.05, originalHeight, 1);
+ };
+ scope.collapse = function () {
+ $height(element, 0.25, 0, 0);
+ };
+ }
+ };
+ }]);
+angular.module('att.abs.alert', [])
+.directive('attAlert', [function()
+{
+ return {
+ restrict:'EA',
+ replace : true,
+ transclude : true,
+ scope: {
+ alertType : "@type",
+ showTop : "@topPos",
+ showAlert : "="
+ },
+ templateUrl : 'app/scripts/ng_js_att_tpls/alert/alert.html',
+ link: function(scope)
+ {
+ if(scope.showTop === 'true'){
+ scope.cssStyle = {'top':'50px'};
+ }
+ else{
+ scope.cssStyle = {'top':'0px'};
+ }
+ scope.close = function(){
+ scope.showAlert = false;
+ };
+ }
+ };
+}]);
+
+angular.module('att.abs.boardStrip', ['att.abs.utilities'])
+.constant('BoardStripConfig', {
+ 'maxVisibleBoards': 4,
+ 'boardsToScroll': 1,
+ /* These parameters are non-configurable and remain unaltered, until there is a change in corresponding SCSS */
+ 'boardLength': 140,
+ 'boardMargin': 15
+})
+.directive('attBoard', [function() {
+ return {
+ restrict: 'AE',
+ replace: true,
+ transclude: true,
+ require: '^attBoardStrip',
+ scope : {
+ boardIndex : '=',
+ boardLabel : '='
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/boardStrip/attBoard.html',
+ link: function(scope, element, attrs, ctrls) {
+
+ var parentCtrl = ctrls;
+
+ scope.getCurrentIndex = function() {
+ return parentCtrl.getCurrentIndex();
+ };
+ scope.selectBoard = function(boardIndex) {
+ if (!isNaN(boardIndex)) {
+ parentCtrl.setCurrentIndex(boardIndex);
+ }
+ };
+ scope.isInView = function(boardIndex) {
+ return parentCtrl.isInView(boardIndex);
+ };
+ }
+ };
+}])
+.directive('attBoardStrip', ['BoardStripConfig', '$timeout', '$ieVersion', function(BoardStripConfig, $timeout, $ieVersion) {
+ return {
+ restrict: 'AE',
+ replace: true,
+ transclude: true,
+ scope: {
+ currentIndex: '=selectedIndex',
+ boardsMasterArray : '=',
+ onAddBoard : '&?'
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/boardStrip/attBoardStrip.html',
+ controller: function($scope) {
+ if(!angular.isDefined($scope.boardsMasterArray)){
+ $scope.boardsMasterArray = [];
+ }
+
+ this.rectifyMaxVisibleBoards = function() {
+ if (this.maxVisibleIndex >= $scope.boardsMasterArray.length) {
+ this.maxVisibleIndex = $scope.boardsMasterArray.length - 1;
+ }
+
+ if (this.maxVisibleIndex < 0) {
+ this.maxVisibleIndex = 0;
+ }
+ };
+
+ this.resetBoardStrip = function(){
+ $scope.currentIndex = 0;
+
+ this.maxVisibleIndex = BoardStripConfig.maxVisibleBoards-1;
+ this.minVisibleIndex = 0;
+
+ this.rectifyMaxVisibleBoards();
+ };
+
+
+ if ($scope.currentIndex > 0) {
+ var index = $scope.currentIndex;
+ this.resetBoardStrip();
+ if (index > $scope.boardsMasterArray.length) {
+ $scope.currentIndex = $scope.boardsMasterArray.length-1;
+ } else {
+ $scope.currentIndex = index;
+ }
+ } else {
+ this.resetBoardStrip();
+ }
+
+
+ this.getCurrentIndex = function() {
+ return $scope.currentIndex;
+ };
+ this.setCurrentIndex = function(indx) {
+ $scope.currentIndex = indx;
+ };
+
+ this.isInView = function(index) {
+ return (index <= this.maxVisibleIndex && index >= this.minVisibleIndex);
+ };
+
+ this.getBoardsMasterArrayLength = function() {
+ return $scope.boardsMasterArray.length;
+ };
+ },
+ link: function(scope, element, attrs, ctrl) {
+ var ieVersion = $ieVersion();
+
+ var oldTimeout;
+ var animationTimeout = 1000;
+
+ if(ieVersion && ieVersion < 10) {
+ animationTimeout = 0;
+ }
+
+ var getBoardViewportWidth = function (numberOfVisibleBoards) {
+ return numberOfVisibleBoards * (BoardStripConfig.boardLength + BoardStripConfig.boardMargin);
+ };
+ if(element[0].querySelector(".board-viewport")) {
+ angular.element(element[0].querySelector(".board-viewport")).css({"width": getBoardViewportWidth(BoardStripConfig.maxVisibleBoards) + "px"});
+ }
+
+ var getBoardstripContainerWidth = function (totalNumberOfBoards) {
+ return totalNumberOfBoards * (BoardStripConfig.boardLength + BoardStripConfig.boardMargin);
+ };
+ if(element[0].querySelector(".boardstrip-container")) {
+ angular.element(element[0].querySelector(".boardstrip-container")).css({"width": getBoardstripContainerWidth(ctrl.getBoardsMasterArrayLength()) + "px"});
+ angular.element(element[0].querySelector(".boardstrip-container")).css({"left": "0px"});
+ }
+
+ var calculateAndGetBoardstripContainerAdjustment = function () {
+
+ var calculatedAdjustmentValue;
+
+ if(ctrl.getBoardsMasterArrayLength() <= BoardStripConfig.maxVisibleBoards) {
+ calculatedAdjustmentValue = 0;
+ }
+ else{
+ calculatedAdjustmentValue = (ctrl.minVisibleIndex * (BoardStripConfig.boardLength + BoardStripConfig.boardMargin))* -1;
+ }
+
+ return calculatedAdjustmentValue;
+ };
+
+ var updateBoardsTabIndex = function(boardArray, minViewIndex, maxViewIndex) {
+ for (var i = 0; i < boardArray.length; i++) {
+ angular.element(boardArray[i]).attr('tabindex', '-1');
+ }
+ for (var i = minViewIndex; i <= maxViewIndex; i++) {
+ angular.element(boardArray[i]).attr('tabindex', '0');
+ }
+ };
+
+ scope.$watchCollection('boardsMasterArray', function(newVal, oldVal){
+ if(newVal !== oldVal){
+ /* When a board is removed */
+ if(newVal.length < oldVal.length){
+ ctrl.resetBoardStrip();
+ $timeout(function(){
+
+ var currentBoardArray = element[0].querySelectorAll('[att-board]');
+ if(currentBoardArray.length !== 0) {
+
+ var oldContainerAdjustment = angular.element(element[0].querySelector(".boardstrip-container"))[0].style.left;
+ var containerAdjustment = calculateAndGetBoardstripContainerAdjustment();
+ if(oldContainerAdjustment !== containerAdjustment+'px') {
+ angular.element(element[0].querySelector(".boardstrip-container")).css({"left": containerAdjustment + "px"});
+
+ $timeout.cancel(oldTimeout);
+ oldTimeout = $timeout(function(){
+ currentBoardArray[0].focus();
+ }, animationTimeout);
+ }
+ else{
+ currentBoardArray[0].focus();
+ }
+ }
+ else{
+ element[0].querySelector('div.boardstrip-item--add').focus();
+ }
+
+ angular.element(element[0].querySelector(".boardstrip-container")).css({"width": getBoardstripContainerWidth(ctrl.getBoardsMasterArrayLength()) + "px"});
+ });
+ }
+ /* When a board is added */
+ else {
+ ctrl.maxVisibleIndex = ctrl.getBoardsMasterArrayLength()-1;
+ ctrl.minVisibleIndex = Math.max(ctrl.maxVisibleIndex - BoardStripConfig.maxVisibleBoards + 1, 0);
+
+ ctrl.setCurrentIndex(ctrl.maxVisibleIndex);
+
+ $timeout(function(){
+ angular.element(element[0].querySelector(".boardstrip-container")).css({"width": getBoardstripContainerWidth(ctrl.getBoardsMasterArrayLength()) + "px"});
+
+ var oldContainerAdjustment = angular.element(element[0].querySelector(".boardstrip-container"))[0].style.left;
+ var containerAdjustment = calculateAndGetBoardstripContainerAdjustment();
+ var currentBoardArray = element[0].querySelectorAll('[att-board]');
+ if(oldContainerAdjustment !== containerAdjustment+'px') {
+ angular.element(element[0].querySelector(".boardstrip-container")).css({"left": containerAdjustment + "px"});
+
+ $timeout.cancel(oldTimeout);
+ oldTimeout = $timeout(function(){
+ currentBoardArray[currentBoardArray.length-1].focus();
+ }, animationTimeout);
+ }
+ else{
+ currentBoardArray[currentBoardArray.length-1].focus();
+ }
+ /* Update tabindecies to ensure keyboard navigation behaves correctly */
+ updateBoardsTabIndex(currentBoardArray, ctrl.minVisibleIndex, ctrl.maxVisibleIndex);
+ });
+ }
+ }
+ });
+
+ scope.nextBoard = function() {
+ ctrl.maxVisibleIndex += BoardStripConfig.boardsToScroll;
+ ctrl.rectifyMaxVisibleBoards();
+ ctrl.minVisibleIndex = ctrl.maxVisibleIndex - (BoardStripConfig.maxVisibleBoards-1);
+
+ $timeout.cancel(oldTimeout);
+ angular.element(element[0].querySelector(".boardstrip-container")).css({"left": calculateAndGetBoardstripContainerAdjustment() + "px"});
+
+ $timeout(function(){
+ var currentBoardArray = element[0].querySelectorAll('[att-board]');
+
+ /* Remove tabindex from non-visible boards */
+ updateBoardsTabIndex(currentBoardArray, ctrl.minVisibleIndex, ctrl.maxVisibleIndex);
+
+ if (!(scope.isNextBoard())) {
+ try {
+ currentBoardArray[currentBoardArray.length-1].focus();
+ } catch(e) {}
+ }
+ }, animationTimeout);
+ };
+ scope.prevBoard = function() {
+
+ ctrl.minVisibleIndex -= BoardStripConfig.boardsToScroll;
+ if (ctrl.minVisibleIndex < 0) {
+ ctrl.minVisibleIndex = 0;
+ }
+
+ ctrl.maxVisibleIndex = ctrl.minVisibleIndex + BoardStripConfig.maxVisibleBoards-1;
+ ctrl.rectifyMaxVisibleBoards();
+
+ $timeout.cancel(oldTimeout);
+ angular.element(element[0].querySelector(".boardstrip-container")).css({"left": calculateAndGetBoardstripContainerAdjustment() + "px"});
+
+ $timeout(function(){
+ var currentBoardArray = element[0].querySelectorAll('[att-board]');
+
+ /* Remove tabindex from non-visible boards */
+ updateBoardsTabIndex(currentBoardArray, ctrl.minVisibleIndex, ctrl.maxVisibleIndex);
+
+ if (ctrl.minVisibleIndex === 0) {
+ try {
+ element[0].querySelector('div.boardstrip-item--add').focus();
+ } catch (e) {} /* IE8 may throw exception */
+ }
+ });
+ };
+
+ scope.isPrevBoard = function() {
+ return (ctrl.minVisibleIndex > 0);
+ };
+ scope.isNextBoard = function() {
+ return (ctrl.getBoardsMasterArrayLength()-1 > ctrl.maxVisibleIndex);
+ };
+ }
+ };
+}])
+.directive('attAddBoard', ['BoardStripConfig', '$parse', '$timeout', function(BoardStripConfig, $parse, $timeout) {
+ return {
+ restrict: 'AE',
+ replace: true,
+ require: '^attBoardStrip',
+ scope : {
+ onAddBoard : '&?'
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/boardStrip/attAddBoard.html',
+ link: function(scope, element, attrs, ctrls) {
+ var parentCtrl = ctrls;
+ scope.addBoard = function() {
+ if (attrs['onAddBoard'] ) {
+ scope.onAddBoard = $parse(scope.onAddBoard);
+ scope.onAddBoard();
+ }
+ };
+ }
+ };
+}])
+.directive('attBoardNavigation', ['keymap', 'events', function(keymap, events) {
+ return {
+ restrict: 'AE',
+ link: function(scope, elem) {
+
+ var prevElem = keymap.KEY.LEFT;
+ var nextElem = keymap.KEY.RIGHT;
+
+ elem.bind('keydown', function (ev) {
+
+ if (!(ev.keyCode)) {
+ ev.keyCode = ev.which;
+ }
+
+ switch (ev.keyCode) {
+ case nextElem:
+ events.preventDefault(ev);
+ events.stopPropagation(ev);
+
+ if (elem[0].nextElementSibling && parseInt(angular.element(elem[0].nextElementSibling).attr('tabindex')) >= 0) {
+ angular.element(elem[0])[0].nextElementSibling.focus();
+ } else {
+ /* IE8 fix */
+ var el = angular.element(elem[0])[0];
+ do {
+ if (el.nextSibling){
+ el = el.nextSibling;
+ }
+ else{
+ break;
+ }
+ } while (el && el.tagName !== 'LI');
+
+ if (el.tagName && el.tagName === 'LI' && parseInt(angular.element(el).attr('tabindex')) >= 0){
+ el.focus();
+ }
+ }
+
+ break;
+ case prevElem:
+ events.preventDefault(ev);
+ events.stopPropagation(ev);
+
+ if (elem[0].previousElementSibling && parseInt(angular.element(elem[0].previousElementSibling).attr('tabindex')) >= 0) {
+ angular.element(elem[0])[0].previousElementSibling.focus();
+ } else {
+ /* IE8 fix */
+ var el1 = angular.element(elem[0])[0];
+ do {
+ if (el1.previousSibling){
+ el1 = el1.previousSibling;
+ }
+ else{
+ break;
+ }
+ } while (el1 && el1.tagName !== 'LI');
+
+ if (el1.tagName && el1.tagName === 'LI' && parseInt(angular.element(el).attr('tabindex')) >= 0){
+ el1.focus();
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ });
+ }
+ };
+}]);
+
+angular.module('att.abs.breadCrumbs', [])
+ .constant("classConstant",{
+ "defaultClass" : "breadcrumbs__link",
+ "activeClass": "breadcrumbs__link--active"
+ })
+ .directive('attCrumb', ['classConstant', function(classConstant) {
+ return {
+ restrict: 'A',
+ link: function(scope, elem, attr) {
+ elem.addClass(classConstant.defaultClass);
+ if(attr.attCrumb === 'active'){
+ elem.addClass(classConstant.activeClass);
+ }
+ if(!elem.hasClass('last')){
+ elem.after('<i class="breadcrumbs__item"></i>');
+ }
+ }
+ };
+ }
+]);
+angular.module('att.abs.buttons', ['att.abs.position', 'att.abs.utilities'])
+ .constant('btnConfig', {
+ btnClass: 'button',
+ btnPrimaryClass: 'button--primary',
+ btnSecondaryClass: 'button--secondary',
+ btnDisabledClass: 'button--inactive',
+ btnSmallClass: 'button--small'
+ })
+ .directive('attButton', ['btnConfig', function (btnConfig) {
+ return {
+ restrict: 'A',
+ link: function (scope, element, attrs) {
+ element.addClass(btnConfig.btnClass);
+ if (attrs.size === 'small') {
+ element.addClass(btnConfig.btnSmallClass);
+ }
+ attrs.$observe('btnType', function (value) {
+ if (value === 'primary') {
+ element.addClass(btnConfig.btnPrimaryClass);
+ element.removeClass(btnConfig.btnSecondaryClass);
+ element.removeClass(btnConfig.btnDisabledClass);
+ element.removeAttr('disabled');
+ } else if (value === 'secondary') {
+ element.addClass(btnConfig.btnSecondaryClass);
+ element.removeClass(btnConfig.btnPrimaryClass);
+ element.removeClass(btnConfig.btnDisabledClass);
+ element.removeAttr('disabled');
+ } else if (value === 'disabled') {
+ element.addClass(btnConfig.btnDisabledClass);
+ element.removeClass(btnConfig.btnPrimaryClass);
+ element.removeClass(btnConfig.btnSecondaryClass);
+ element.attr('disabled', 'disabled');
+ }
+ });
+ }
+ };
+ }])
+ .directive('attButtonLoader', [function () {
+ return {
+ restrict: 'A',
+ replace: false,
+ scope: {
+ size: '@'
+ },
+ template: '<div ng-class="{\'button--loading\': size === \'large\',\'button--loading__small\': size === \'small\'}"><i></i><i class="second__loader"></i><i></i></div>',
+ link: function (scope, element) {
+ element.addClass('button button--inactive');
+ }
+ };
+ }])
+ .directive('attButtonHero', [function () {
+ return {
+ restrict: 'A',
+ replace: false,
+ transclude: true,
+ scope: {
+ icon: '@'
+ },
+ template: '<div class="button--hero__inner"><span ng-transclude></span> <i ng-class="{\'icon-arrow-right\': icon === \'arrow-right\',\'icon-cart\': icon === \'cart\'}"></i></div>',
+ link: function (scope, element) {
+ element.addClass('button button--hero');
+ element.attr("tabindex", "0");
+ }
+ };
+ }])
+ .directive('attBtnDropdown', ['$document', '$timeout', '$isElement', '$documentBind', 'keymap', 'events', function ($document, $timeout, $isElement, $documentBind, keymap, events) {
+ return {
+ restrict: 'EA',
+ scope: {
+ type: "@dropdowntype"
+ },
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/buttons/buttonDropdown.html',
+ link: function (scope, element) {
+ scope.isOpen = false;
+ var currentIndex = -1;
+ // Capture all the li elements after compilation
+ var list = [], button = undefined;
+ $timeout(function() {
+ list = element.find('li');
+ button = element.find('button')[0];
+ }, 10);
+ var toggle = scope.toggle = function (show) {
+ if (angular.isUndefined(show) || show === '') {
+ scope.isOpen = !scope.isOpen;
+ }
+ else {
+ scope.isOpen = show;
+ }
+ };
+ var selectNext = function() {
+ if (currentIndex+1 < list.length) {
+ currentIndex++;
+ list[currentIndex].focus();
+ }
+ };
+ var selectPrev = function() {
+ if (currentIndex-1 >= 0) {
+ currentIndex--;
+ list[currentIndex].focus();
+ }
+ };
+ element.bind("keydown", function($event) {
+ var keyCode = $event.keyCode;
+ if (keymap.isAllowedKey(keyCode) || keymap.isControl($event) || keymap.isFunctionKey($event)) {
+ switch (keyCode) {
+ case keymap.KEY.ENTER:
+ if (currentIndex > 0) {
+ button.focus();
+ scope.$apply();
+ }
+ break;
+ case keymap.KEY.ESC:
+ toggle(false);
+ currentIndex = -1;
+ button.focus();
+ scope.$apply();
+ break;
+ case keymap.KEY.DOWN:
+ selectNext();
+ scope.$apply();
+ events.preventDefault($event);
+ events.stopPropagation($event);
+ break;
+ case keymap.KEY.UP:
+ selectPrev();
+ scope.$apply();
+ events.preventDefault($event);
+ events.stopPropagation($event);
+ break;
+ default:
+ break;
+ }
+ } else if (keyCode === keymap.KEY.TAB) {
+ toggle(false);
+ currentIndex = -1;
+ scope.$apply();
+ }
+ });
+ var outsideClick = function (e) {
+ var isElement = $isElement(angular.element(e.target), element, $document);
+ if (!isElement) {
+ toggle(false);
+ currentIndex = -1;
+ for (var i = 0; i < list.length; i++) {
+ angular.element(list[i]).removeClass('selected');
+ }
+ button.focus();
+ scope.$apply();
+ }
+ };
+ $documentBind.click('isOpen', outsideClick, scope);
+ }
+ };
+ }]);
+angular.module('att.abs.checkbox', [])
+.constant("attCheckboxConfig", {
+ activeClass : "att-checkbox--on",
+ disabledClass : "att-checkbox--disabled"
+})
+.directive('checkboxLimit', function () {
+return {
+ scope: {
+ checkboxLimit:'=',
+ selectLimit:'@?',
+ maxSelected:'&?'
+ },
+ restrict: 'A',
+ require:'checkboxLimit',
+ controller: ['$scope',function($scope)
+ {
+ $scope.limit=true;
+ this.getMaxLimits=function(){
+ return $scope.limit;
+ };
+ this.setMaxLimits=function(value){
+ $scope.limit=value;
+ };
+ this.maxCheckboxSelected=function(){
+ $scope.maxSelected();
+ };
+ }],
+ link: function (scope, element, attribute, ctrl) {
+ scope.$watch('checkboxLimit', function()
+ {
+ var countTrue = 0;
+ for (var keys in scope.checkboxLimit) {
+ if (scope.checkboxLimit.hasOwnProperty(keys) && scope.checkboxLimit[keys]) {
+ countTrue = countTrue + 1;
+ }
+ };
+ if(countTrue>=parseInt(scope.selectLimit)){
+ ctrl.setMaxLimits(false);
+ }
+ else{
+ ctrl.setMaxLimits(true);
+ }
+ }, true);
+ }
+};
+})
+.directive('attCheckbox', ['$compile', "attCheckboxConfig", function ($compile, attCheckboxConfig) {
+ return {
+ scope: {},
+ restrict: 'A',
+ require: ['ngModel','^?checkboxLimit'],
+ link: function (scope, element, attribute, ctrl) {
+ var ngCtrl = ctrl[0];
+ var checkboxLimitCtrl = ctrl[1];
+ var parentDiv = $compile('<div tabindex="0" role="checkbox" att-accessibility-click="13,32" aria-label="Checkbox" ng-click="updateModel($event)" class="att-checkbox"></div>')(scope);
+ element.css({display:'none'});
+ element.wrap(parentDiv);
+ element.parent().append('<div class="att-checkbox__indicator"></div>');
+ element.parent().attr("title", attribute.title);
+ element.parent().attr("aria-label", attribute.title);
+ element.parent().attr("id", attribute.id);
+ element.removeAttr("id");
+ //element.removeAttr("title");
+ //model -> UI
+ ngCtrl.$render = function () {
+ var selected = ngCtrl.$modelValue ? true : false;
+ element.parent().toggleClass(attCheckboxConfig.activeClass, selected);
+ element.parent().attr("aria-checked", selected);
+ };
+
+ //ui->model
+ scope.updateModel = function (evt) {
+ if (!scope.disabled) {
+ ngCtrl.$setViewValue(element.parent().hasClass(attCheckboxConfig.activeClass) ? false : true);
+ if(checkboxLimitCtrl && !(checkboxLimitCtrl.getMaxLimits())){
+ if(!ngCtrl.$modelValue){
+ ngCtrl.$render();
+ }
+ else{
+ checkboxLimitCtrl.maxCheckboxSelected();
+ ngCtrl.$setViewValue(element.parent().hasClass(attCheckboxConfig.activeClass) ? true : false);
+ }
+ }
+ else{
+ ngCtrl.$render();
+ }
+ }
+ evt.preventDefault();
+ };
+
+ attribute.$observe('disabled', function(val) {
+ scope.disabled = (val || val === "disabled" || val === "true");
+ element.parent().toggleClass(attCheckboxConfig.disabledClass, scope.disabled);
+ element.parent().attr("tabindex", scope.disabled ? "-1" : "0");
+ });
+ }
+ };
+}])
+.directive('checkboxGroup', ['$compile',function($compile) {
+ return {
+ scope:{
+ checkboxGroup: "=",
+ checkboxGroupValue: "=?"
+ },
+ restrict: 'A',
+ link: function(scope, element, attribute){
+ scope.checkboxState = 'none';
+ if (scope.checkboxGroupValue === undefined) {
+ scope.checkboxGroupValue = "indeterminate";
+ }
+ element.css({display:'none'});
+ element.wrap($compile('<div tabindex="0" role="checkbox" att-accessibility-click="13,32" ng-click="updateModel($event)" class="att-checkbox"></div>')(scope));
+ element.parent().append('<div class="att-checkbox__indicator"></div>');
+ element.parent().attr("title", attribute.title);
+ element.parent().attr("aria-label", attribute.title);
+ scope.$watch('checkboxState', function(val) {
+ if (val === 'all') {
+ element.parent().addClass('att-checkbox--on');
+ element.parent().removeClass('att-checkbox--indeterminate');
+ element.parent().attr("aria-checked", true);
+ }
+ else if (val === 'none') {
+ element.parent().removeClass('att-checkbox--on');
+ element.parent().removeClass('att-checkbox--indeterminate');
+ element.parent().attr("aria-checked", false);
+ }
+ else if (val === 'indeterminate') {
+ element.parent().removeClass('att-checkbox--on');
+ element.parent().addClass('att-checkbox--indeterminate');
+ element.parent().attr("aria-checked", true);
+ }
+ });
+ scope.updateModel = function(evt){
+ if (element.parent().hasClass('att-checkbox--on')) {
+ element.parent().removeClass('att-checkbox--on');
+ for (var keys in scope.checkboxGroup) {
+ if (scope.checkboxGroup.hasOwnProperty(keys)) {
+ scope.checkboxGroup[keys] = false;
+ }
+ };
+ }
+ else {
+ element.parent().addClass('att-checkbox--on');
+ for (var key in scope.checkboxGroup) {
+ if (scope.checkboxGroup.hasOwnProperty(key)) {
+ scope.checkboxGroup[key] = true;
+ }
+ };
+ }
+ evt.preventDefault();
+ };
+ scope.$watch('checkboxGroupValue', function (value) {
+ if (value===false) {
+ element.parent().removeClass('att-checkbox--on');
+ for (var keys in scope.checkboxGroup) {
+ if (scope.checkboxGroup.hasOwnProperty(keys)) {
+ scope.checkboxGroup[keys] = false;
+ }
+ };
+ }
+ else if (value === true){
+ element.parent().addClass('att-checkbox--on');
+ for (var key in scope.checkboxGroup) {
+ if (scope.checkboxGroup.hasOwnProperty(key)) {
+ scope.checkboxGroup[key] = true;
+ }
+ };
+ }
+ });
+ scope.$watch('checkboxGroup', function(){
+ var countTrue = 0;
+ var countFalse = 0;
+ var count = 0;
+ for (var keys in scope.checkboxGroup) {
+ if (scope.checkboxGroup.hasOwnProperty(keys)) {
+ count = count + 1;
+ if (scope.checkboxGroup[keys]) {
+ countTrue = countTrue + 1;
+ }
+ else if (!scope.checkboxGroup[keys]) {
+ countFalse = countFalse + 1;
+ }
+ }
+ };
+ if (count === countTrue) {
+ scope.checkboxState = "all";
+ scope.checkboxGroupValue=true;
+ }
+ else if (count === countFalse) {
+ scope.checkboxState = "none";
+ scope.checkboxGroupValue=false;
+ }
+ else {
+ scope.checkboxState = "indeterminate";
+ scope.checkboxGroupValue="indeterminate";
+ }
+ }, true);
+ }
+ };
+}]);
+
+angular.module('att.abs.colorselector', [])
+ .directive('colorSelectorWrapper', [function() {
+ return {
+ scope: {
+ selected: '=',
+ iconColor: '@'
+
+ },
+ restrict: 'AE',
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/colorselector/colorselector.html',
+ link: function(scope) {
+ scope.applycolor = {'background-color': scope.iconColor};
+ scope.selectedcolor = function(iconColor) {
+ scope.selected = iconColor;
+ };
+ }
+ };
+ }])
+ .directive('colorSelector', ['$compile', function($compile) {
+ return{
+ restrict: 'A',
+ scope: {
+ colorSelector: '@',
+ ngModel: '='
+ },
+ link: function(scope, element, attr) {
+ element.removeAttr('color-selector');
+ var colorTitle = attr.title;
+ var wrapcont = angular.element('<color-selector-wrapper selected="ngModel" title="' + colorTitle + '" icon-color="{{colorSelector}}">' + element.prop('outerHTML') + '</color-selector-wrapper>');
+ var newWrapcont = $compile(wrapcont)(scope);
+ element.replaceWith(newWrapcont);
+ }
+ };
+ }]);
+angular.module('att.abs.datepicker', ['att.abs.position', 'att.abs.utilities'])
+
+.constant('datepickerConfig', {
+ dateFormat: 'MM/dd/yyyy',
+ dayFormat: 'd',
+ monthFormat: 'MMMM',
+ yearFormat: 'yyyy',
+ dayHeaderFormat: 'EEEE',
+ dayTitleFormat: 'MMMM yyyy',
+ disableWeekend: false,
+ disableSunday: false,
+ startingDay: 0,
+ minDate: null,
+ maxDate: null,
+ mode: 0,
+ dateFilter: {
+ defaultText: 'Select from list'
+ },
+ datepickerEvalAttributes: ['dateFormat', 'dayFormat', 'monthFormat', 'yearFormat', 'dayHeaderFormat', 'dayTitleFormat', 'disableWeekend', 'disableSunday', 'startingDay', 'mode'],
+ datepickerWatchAttributes: ['min', 'max']
+})
+
+.factory('datepickerService', ['datepickerConfig', 'dateFilter', function (datepickerConfig, dateFilter) {
+ var setAttributes = function (attr, elem) {
+ if (angular.isDefined(attr) && attr !== null && angular.isDefined(elem) && elem !== null) {
+ var attributes = datepickerConfig.datepickerEvalAttributes.concat(datepickerConfig.datepickerWatchAttributes);
+ for (var key in attr) {
+ var val = attr[key];
+ if (attributes.indexOf(key) !== -1 && angular.isDefined(val)) {
+ elem.attr(key.toSnakeCase(), key);
+ }
+ }
+ }
+ };
+
+ var bindScope = function (attr, scope) {
+ if (angular.isDefined(attr) && attr !== null && angular.isDefined(scope) && scope !== null) {
+ var evalFunction = function (key, val) {
+ scope[key] = scope.$parent.$eval(val);
+ };
+
+ var watchFunction = function (key, val) {
+ scope.$parent.$watch(val, function (value) {
+ scope[key] = value;
+ });
+ scope.$watch(key, function (value) {
+ scope.$parent[val] = value;
+ });
+ };
+
+ var evalAttributes = datepickerConfig.datepickerEvalAttributes;
+ var watchAttributes = datepickerConfig.datepickerWatchAttributes;
+ for (var key in attr) {
+ var val = attr[key];
+ if (evalAttributes.indexOf(key) !== -1 && angular.isDefined(val)) {
+ evalFunction(key, val);
+ } else if (watchAttributes.indexOf(key) !== -1 && angular.isDefined(val)) {
+ watchFunction(key, val);
+ }
+ }
+ }
+ };
+
+ var validateDateString = function (dateString, dateFormat) {
+ if (dateString && dateFormat) {
+ var delimiter;
+ if (dateFormat.indexOf('/') !== -1) {
+ delimiter = '/';
+ } else if (dateFormat.indexOf('-') !== -1) {
+ delimiter = '-';
+ } else if (dateFormat.indexOf('.') !== -1) {
+ delimiter = '.';
+ }
+
+ var dateStringArray = dateString.split(delimiter);
+ var dateFormatArray = dateFormat.split(delimiter);
+ if (dateStringArray.length !== dateFormatArray.length) {
+ return false;
+ }
+
+ for (var i = 0; i < dateStringArray.length; i++) {
+ dateStringArray[i] = dateStringArray[i].lPad(dateFormatArray[i].length, '0');
+ }
+ var intermediateDateString = dateStringArray.join(delimiter);
+
+ var actualDateString = dateFilter(new Date(intermediateDateString), dateFormat);
+ return intermediateDateString === actualDateString;
+ }
+ };
+
+ return {
+ setAttributes: setAttributes,
+ bindScope: bindScope,
+ validateDateString: validateDateString
+ };
+}])
+
+.controller('DatepickerController', ['$scope', '$attrs', 'dateFilter', 'datepickerConfig', function($scope, $attrs, dateFilter, dtConfig) {
+ var format = {
+ date: getValue($attrs.dateFormat, dtConfig.dateFormat),
+ day: getValue($attrs.dayFormat, dtConfig.dayFormat),
+ month: getValue($attrs.monthFormat, dtConfig.monthFormat),
+ year: getValue($attrs.yearFormat, dtConfig.yearFormat),
+ dayHeader: getValue($attrs.dayHeaderFormat, dtConfig.dayHeaderFormat),
+ dayTitle: getValue($attrs.dayTitleFormat, dtConfig.dayTitleFormat),
+ disableWeekend: getValue($attrs.disableWeekend, dtConfig.disableWeekend),
+ disableSunday: getValue($attrs.disableSunday, dtConfig.disableSunday)
+ },
+ startingDay = getValue($attrs.startingDay, dtConfig.startingDay);
+ $scope.mode = getValue($attrs.mode, dtConfig.mode);
+
+ $scope.minDate = dtConfig.minDate ? $scope.resetTime(dtConfig.minDate) : null;
+ $scope.maxDate = dtConfig.maxDate ? $scope.resetTime(dtConfig.maxDate) : null;
+
+ function getValue(value, defaultValue) {
+ return angular.isDefined(value) ? $scope.$parent.$eval(value) : defaultValue;
+ }
+
+ function getDaysInMonth(year, month) {
+ return new Date(year, month, 0).getDate();
+ }
+
+ function getDates(startDate, n) {
+ var dates = [];
+ var current = startDate, i = 0;
+ while (i < n) {
+ dates[i++] = new Date(current);
+ current.setDate(current.getDate() + 1);
+ }
+ return dates;
+ }
+
+ var compare = this.compare = function(date1, date2) {
+ return (new Date(date1.getFullYear(), date1.getMonth(), date1.getDate()) - new Date(date2.getFullYear(), date2.getMonth(), date2.getDate()));
+ };
+
+ function isSelected(dt) {
+ if (dt && angular.isDate($scope.currentDate) && compare(dt, $scope.currentDate) === 0) {
+ return true;
+ }
+ return false;
+ }
+
+ function isFromDate(dt) {
+ if (dt && angular.isDate($scope.fromDate) && compare(dt, $scope.fromDate) === 0) {
+ return true;
+ }
+ return false;
+ }
+
+ function isToDate(dt) {
+ if (dt && angular.isDate($scope.fromDate) && angular.isDate($scope.currentDate) && compare(dt, $scope.currentDate) === 0) {
+ return true;
+ }
+ return false;
+ }
+
+ function isDateRange(dt) {
+ if (dt && angular.isDate($scope.fromDate) && angular.isDate($scope.currentDate) && (compare(dt, $scope.fromDate) >= 0) && (compare(dt, $scope.currentDate) <= 0)) {
+ return true;
+ }
+ return false;
+ }
+
+ function isWeekend(date) {
+ if (dateFilter(date, format.dayHeader) === "Saturday" || dateFilter(date, format.dayHeader) === "Sunday") {
+ return true;
+ }
+ return false;
+ }
+
+ function isToday(date) {
+ if (compare(date, $scope.resetTime(new Date())) === 0) {
+ return true;
+ }
+ return false;
+ }
+ function isFocused(date) {
+ if (date && angular.isDate($scope.focusedDate) && compare(date, $scope.focusedDate) === 0) {
+ return true;
+ }
+ return false;
+ }
+
+ var isDisabled = this.isDisabled = function(date) {
+ if (format.disableWeekend === true && (dateFilter(date, format.dayHeader) === "Saturday" || dateFilter(date, format.dayHeader) === "Sunday")) {
+ return true;
+ }
+ if (format.disableSunday === true && (dateFilter(date, format.dayHeader) === "Sunday")) {
+ return true;
+ }
+ return (($scope.minDate && compare(date, $scope.minDate) < 0) || ($scope.maxDate && compare(date, $scope.maxDate) > 0));
+ };
+
+
+ function isMinDateAvailable(startDate, endDate) {
+ return ($scope.minDate && $scope.minDate.getTime() >= startDate.getTime()) && ($scope.minDate.getTime() <= endDate.getTime());
+ }
+
+ function isMaxDateAvailable(startDate, endDate) {
+ return ($scope.maxDate && $scope.maxDate.getTime() >= startDate.getTime()) && ($scope.maxDate.getTime() <= endDate.getTime());
+ }
+
+ function getLabel(label) {
+ if (label)
+ {
+ var labelObj = {
+ pre: label.substr(0, 3),
+ post: label
+ };
+ return labelObj;
+ }
+ return;
+ }
+ function makeDate(dateobj) {
+ return {date: dateobj.date, label: dateFilter(dateobj.date, dateobj.formatDay), header: dateFilter(dateobj.date, dateobj.formatHeader), focused: !!dateobj.isFocused, selected: !!dateobj.isSelected, from: !!dateobj.isFromDate, to: !!dateobj.isToDate, dateRange: !!dateobj.isDateRange, oldMonth: !!dateobj.oldMonth, nextMonth: !!dateobj.newMonth, disabled: !!dateobj.isDisabled, today: !!dateobj.isToday, weekend: !!dateobj.isWeakend};
+ }
+
+ this.modes = [
+ {
+ name: 'day',
+ getVisibleDates: function(date, calendar) {
+ var year = date.getFullYear(), month = date.getMonth(), firstDayOfMonth = new Date(year, month, 1), lastDayOfMonth = new Date(year, month+1, 0);
+ var difference = startingDay - firstDayOfMonth.getDay(),
+ numDisplayedFromPreviousMonth = (difference > 0) ? 7 - difference : -difference,
+ firstDate = new Date(firstDayOfMonth), numDates = 0;
+
+ if (numDisplayedFromPreviousMonth > 0) {
+ firstDate.setDate(-numDisplayedFromPreviousMonth + 1);
+ numDates += numDisplayedFromPreviousMonth; // Previous
+ }
+ numDates += getDaysInMonth(year, month + 1); // Current
+ numDates += (7 - numDates % 7) % 7; // Next
+
+ var days = getDates(firstDate, numDates), labels = [];
+ for (var i = 0; i < numDates; i++) {
+ var dt = new Date(days[i]);
+ days[i] = makeDate({date:dt,
+ formatDay:format.day,
+ formatHeader:format.dayHeader,
+ isFocused:isFocused(dt),
+ isSelected:isSelected(dt),
+ isFromDate:isFromDate(dt),
+ isToDate:isToDate(dt),
+ isDateRange:isDateRange(dt),
+ oldMonth:(new Date(dt.getFullYear(), dt.getMonth(), 1, 0, 0, 0).getTime() < new Date(year, month, 1, 0, 0, 0).getTime()),
+ newMonth:(new Date(dt.getFullYear(), dt.getMonth(), 1, 0, 0, 0).getTime() > new Date(year, month, 1, 0, 0, 0).getTime()),
+ isDisabled:isDisabled(dt),
+ isToday:isToday(dt),
+ isWeakend:isWeekend(dt)});
+ }
+ for (var j = 0; j < 7; j++) {
+ labels[j] = getLabel(dateFilter(days[j].date, format.dayHeader));
+ }
+ if (calendar === 'top') {
+ $scope.disablePrevTop = isMinDateAvailable(firstDayOfMonth, lastDayOfMonth);
+ $scope.disableNextTop = isMaxDateAvailable(firstDayOfMonth, lastDayOfMonth);
+ } else if (calendar === 'bottom') {
+ $scope.disablePrevBottom = isMinDateAvailable(firstDayOfMonth, lastDayOfMonth);
+ $scope.disableNextBottom = isMaxDateAvailable(firstDayOfMonth, lastDayOfMonth);
+ } else {
+ $scope.disablePrevTop = $scope.disablePrevBottom = isMinDateAvailable(firstDayOfMonth, lastDayOfMonth);
+ $scope.disableNextTop = $scope.disableNextBottom = isMaxDateAvailable(firstDayOfMonth, lastDayOfMonth);
+ }
+ $scope.disablePrev = $scope.disablePrevTop || $scope.disablePrevBottom;
+ $scope.disableNext = $scope.disableNextTop || $scope.disableNextBottom;
+ return {objects: days, title: dateFilter(date, format.dayTitle), labels: labels};
+ },
+ split: 7,
+ step: {months: 1}
+ },
+ {
+ name: 'month',
+ getVisibleDates: function(date) {
+ var months = [], labels = [], year = date.getFullYear();
+ for (var i = 0; i < 12; i++) {
+ var dt = new Date(year,i,1);
+ months[i] = makeDate({date:dt,
+ formatDay:format.month,
+ formatHeader:format.month,
+ isFocused:isFocused(dt),
+ isSelected:isSelected(dt),
+ isFromDate:isFromDate(dt),
+ isToDate:isToDate(dt),
+ isDateRange:isDateRange(dt),
+ oldMonth:false,
+ newMonth:false,
+ isDisabled:isDisabled(dt),
+ isToday:isToday(dt),
+ isWeakend:false});
+ }
+ return {objects: months, title: dateFilter(date, format.year), labels: labels};
+ },
+ split:3,
+ step: {years: 1}
+ }
+ ];
+
+}])
+
+.directive('datepicker', ['$timeout', function ($timeout) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/datepicker/datepicker.html',
+ scope: {
+ currentDate: "=?current",
+ fromDate: "=?from"
+ },
+ require: 'datepicker',
+ controller: 'DatepickerController',
+ link: function(scope, element, attrs, ctrl) {
+ var datepickerCtrl = ctrl;
+ var selected, calendarSelected = false;
+ scope.focusedDate;
+
+ scope.resetTime = function(date) {
+ var dt;
+ if (!isNaN(new Date(date))) {
+ dt = new Date(date);
+ if(scope.mode === 1){
+ dt = new Date(dt.getFullYear(), dt.getMonth());
+ }else{
+ dt = new Date(dt.getFullYear(), dt.getMonth(), dt.getDate());
+ }
+ } else {
+ return null;
+ }
+ return dt;
+ };
+
+ if (attrs.min) {
+ scope.$parent.$watch(attrs.min, function(value) {
+ scope.minDate = value ? scope.resetTime(value) : null;
+ refill();
+ });
+ }
+ if (attrs.max) {
+ scope.$parent.$watch(attrs.max, function(value) {
+ scope.maxDate = value ? scope.resetTime(value) : null;
+ refill();
+ });
+ }
+
+ // Split array into smaller arrays
+ function split(arr, size) {
+ var arrays = [];
+ while (arr.length > 0) {
+ arrays.push(arr.splice(0, size));
+ }
+ return arrays;
+ }
+ var moveMonth = function(selectedDate, direction) {
+ var step = datepickerCtrl.modes[scope.mode].step;
+ selectedDate.setDate(1);
+ selectedDate.setMonth(selectedDate.getMonth() + direction * (step.months || 0));
+ selectedDate.setFullYear(selectedDate.getFullYear() + direction * (step.years || 0));
+
+ return selectedDate;
+ };
+
+ function refill(date) {
+ if (angular.isDate(date) && !isNaN(date)) {
+ selected = new Date(date);
+ } else {
+ if (!selected) {
+ selected = new Date();
+ }
+ }
+
+ if (selected) {
+ var selectedCalendar;
+ if(scope.mode === 1){
+ selected = new Date();
+ selectedCalendar = moveMonth(angular.copy(selected), -1);
+ } else {
+ selectedCalendar = angular.copy(selected);
+ }
+
+ var currentMode = datepickerCtrl.modes[scope.mode];
+ var currentData = currentMode.getVisibleDates(selectedCalendar, 'top');
+ scope.currentRows = split(currentData.objects, currentMode.split);
+ scope.currentTitle = currentData.title;
+ scope.labels = currentData.labels || [];
+
+ var nextData = currentMode.getVisibleDates(moveMonth(angular.copy(selectedCalendar), 1), 'bottom');
+ scope.nextRows = split(nextData.objects, currentMode.split);
+ scope.nextTitle = nextData.title;
+ }
+ }
+
+ var selectCurrentDate = function(date) {
+ var dt = new Date(date.getFullYear(), date.getMonth(), date.getDate());
+ scope.currentDate = dt;
+ };
+
+ var selectFromDate = function(date) {
+ var dt = new Date(date.getFullYear(), date.getMonth(), date.getDate());
+ scope.fromDate = dt;
+ };
+
+ scope.select = function(date) {
+ calendarSelected = true;
+ if(attrs.from) {
+ if(!(angular.isDate(scope.fromDate) && angular.isDate(scope.currentDate))) {
+ if(angular.isDate(scope.fromDate)) {
+ selectCurrentDate(date);
+ } else if(!angular.isDate(scope.fromDate)) {
+ selectFromDate(date);
+ }
+ }
+ } else {
+ selectCurrentDate(date);
+ }
+ scope.focusedDate = date;
+ };
+
+ var swapDate = function(fromDate, currentDate) {
+ selectFromDate(currentDate);
+ $timeout(function () {
+ calendarSelected = true;
+ scope.focusedDate = currentDate;
+ selectCurrentDate(fromDate);
+ });
+ };
+
+ scope.move = function(direction) {
+ selected = moveMonth(angular.copy(selected), direction);
+ refill();
+ };
+
+ scope.$watch('currentDate', function (value) {
+ if(angular.isDate(value) && !isNaN(value) && datepickerCtrl.isDisabled(value)) {
+ scope.currentDate = null;
+ return;
+ }
+
+ if (attrs.from && !isNaN(value) && !isNaN(scope.fromDate) && datepickerCtrl.compare(value, scope.fromDate) < 0) {
+ swapDate(scope.fromDate, value);
+ return;
+ }
+
+ if (calendarSelected) {
+ refill();
+ calendarSelected = false;
+ } else {
+ if (angular.isDefined(value) && value !== null) {
+ refill(value);
+ } else {
+ refill();
+ }
+ }
+ scope.focusedDate = undefined;
+ });
+
+ scope.$watch('fromDate', function (value) {
+ if(angular.isDate(value) && !isNaN(value) && datepickerCtrl.isDisabled(value)) {
+ scope.fromDate = null;
+ return;
+ }
+ if (attrs.from) {
+ if (!isNaN(scope.currentDate) && !isNaN(value) && datepickerCtrl.compare(scope.currentDate, value) < 0) {
+ swapDate(value, scope.currentDate);
+ return;
+ }
+ if (calendarSelected) {
+ refill();
+ calendarSelected = false;
+ } else {
+ if (angular.isDefined(value) && value !== null) {
+ refill(value);
+ } else {
+ refill();
+ }
+ }
+ }
+ scope.focusedDate = undefined;
+ });
+ }
+ };
+}])
+.directive('datepickerPopup', ['$document', 'datepickerService', '$isElement', '$documentBind', function($document, datepickerService, $isElement, $documentBind) {
+ var link = function (scope, elem, attr) {
+ datepickerService.bindScope(attr, scope);
+
+ scope.isOpen = false;
+
+ var toggle = scope.toggle = function (show) {
+ if(show === true || show === false) {
+ scope.isOpen = show;
+ } else {
+ scope.isOpen = !scope.isOpen;
+ }
+ };
+
+ scope.$watch('current', function () {
+ toggle(false);
+ });
+
+ var outsideClick = function (e) {
+ var isElement = $isElement(angular.element(e.target), elem, $document);
+ if(!isElement) {
+ toggle(false);
+ scope.$apply();
+ }
+ };
+
+ $documentBind.click('isOpen', outsideClick, scope);
+ };
+
+ return {
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/datepicker/datepickerPopup.html',
+ scope: {
+ current: "=current"
+ },
+ compile: function (elem, attr) {
+ var wrapperElement = elem.find('span').eq(1);
+ wrapperElement.attr('current', 'current');
+ datepickerService.setAttributes(attr, wrapperElement);
+
+ return link;
+ }
+ };
+}])
+
+.directive('attDatepicker', ['$log', function($log) {
+ return {
+ restrict: 'A',
+ require: 'ngModel',
+ scope: {},
+ controller: ['$scope', '$element', '$attrs', '$compile', 'datepickerConfig', 'datepickerService', function($scope, $element, $attrs, $compile, datepickerConfig, datepickerService) {
+ var dateFormatString = angular.isDefined($attrs.dateFormat) ? $scope.$parent.$eval($attrs.dateFormat) : datepickerConfig.dateFormat;
+ var selectedDateMessage = '<div class="sr-focus hidden-spoken" tabindex="-1">the date you selected is {{$parent.current | date : \'' + dateFormatString + '\'}}</div>';
+
+ $element.removeAttr('att-datepicker');
+ $element.removeAttr('ng-model');
+ $element.attr('ng-model', '$parent.current');
+ $element.attr('aria-describedby', 'datepicker');
+ $element.attr('format-date', dateFormatString);
+ $element.attr('att-input-deny', '[^0-9\/-]');
+ $element.attr('maxlength', 10);
+ $element.attr('readonly', 'readonly'); //Trinity for CATO
+ var wrapperElement = angular.element('<div></div>');
+ wrapperElement.attr('datepicker-popup', '');
+ wrapperElement.attr('current', 'current');
+
+ datepickerService.setAttributes($attrs, wrapperElement);
+ datepickerService.bindScope($attrs, $scope);
+
+ wrapperElement.html('');
+ wrapperElement.append($element.prop('outerHTML'));
+ if (navigator.userAgent.match(/MSIE 8/) === null) {
+ wrapperElement.append(selectedDateMessage);
+ }
+ var elm = wrapperElement.prop('outerHTML');
+ elm = $compile(elm)($scope);
+ $element.replaceWith(elm);
+ }],
+ link: function(scope, elem, attr, ctrl) {
+ if (!ctrl) {
+ // do nothing if no ng-model
+ $log.error("ng-model is required.");
+ return;
+ }
+
+ scope.$watch('current', function(value) {
+ ctrl.$setViewValue(value);
+ });
+ ctrl.$render = function() {
+ scope.current = ctrl.$viewValue;
+ };
+ }
+ };
+}])
+
+.directive('formatDate', ['dateFilter', 'datepickerService', function(dateFilter, datepickerService) {
+ return {
+ restrict: 'A',
+ require: 'ngModel',
+ link: function(scope, elem, attr, ctrl) {
+ var formatDate = "";
+ attr.$observe('formatDate', function (value) {
+ formatDate = value;
+ });
+ var dateToString = function(value) {
+ if (value) {
+ ctrl.$setValidity('invalidDate', true);
+ return dateFilter(value, formatDate);
+ } else {
+ ctrl.$setValidity('invalidDate', false);
+ return elem.val();
+ }
+ };
+ var stringToDate = function(value) {
+ if(datepickerService.validateDateString(value, formatDate)) {
+ ctrl.$setValidity('invalidDate', true);
+ return new Date(value);
+ } else {
+ ctrl.$setValidity('invalidDate', false);
+ return null;
+ }
+ };
+ ctrl.$formatters.unshift(dateToString);
+ ctrl.$parsers.unshift(stringToDate);
+ }
+ };
+}])
+
+.directive('attDateFilter', ['$document', 'dateFilter', 'datepickerConfig', 'datepickerService', '$isElement', '$documentBind', function($document, dateFilter, datepickerConfig, datepickerService, $isElement, $documentBind) {
+
+ var link = function (scope, elem, attr, ctrl) {
+ datepickerService.bindScope(attr, scope);
+
+ scope.selectedOption = datepickerConfig.dateFilter.defaultText;
+ scope.showDropdownList = false;
+ scope.showCalendar = false;
+ scope.applyButtonType = "disabled";
+
+ scope.currentSelection = "";
+ var dateFormatString = angular.isDefined(attr.dateFormat) ? scope.$parent.$eval(attr.dateFormat) : datepickerConfig.dateFormat;
+ var inputChange = false;
+
+ var setDropdownText = function(value) {
+ if(inputChange) {
+ return;
+ }
+
+ var fromDateText = dateFormatString.toUpperCase();
+ var currentDateText = dateFormatString.toUpperCase();
+
+ if(!isNaN(new Date(scope.fromDate))) {
+ fromDateText = dateFilter(scope.fromDate, dateFormatString);
+ }
+ if(!isNaN(new Date(scope.currentDate))) {
+ currentDateText = dateFilter(scope.currentDate, dateFormatString);
+ }
+
+ if(value === 'Custom Single Date') {
+ ctrl.$setValidity('invalidDate', true);
+ scope.maxLength = 10;
+ scope.selectedOption = currentDateText;
+ } else if(value === 'Custom Range') {
+ ctrl.$setValidity('invalidDate', true);
+ ctrl.$setValidity('invalidDateRange', true);
+ scope.maxLength = 21;
+ scope.selectedOption = fromDateText + '-' + currentDateText;
+ }
+ };
+
+ var clear = scope.clear = function(partial) {
+ scope.fromDate = undefined;
+ scope.currentDate = undefined;
+ scope.applyButtonType = "disabled";
+ if(!partial) {
+ ctrl.$setValidity('invalidDate', true);
+ ctrl.$setValidity('invalidDateRange', true);
+ setDropdownText(scope.currentSelection);
+ }
+ };
+
+ var showCalendar = function() {
+ scope.showCalendar = true;
+ };
+
+ var hideCalendar = function() {
+ scope.showCalendar = false;
+ if(scope.currentSelection !== 'Custom Single Date' && scope.currentSelection !== 'Custom Range') {
+ clear(true);
+ }
+ };
+
+ var showDropdown = scope.showDropdown = function (show) {
+ if(show === true || show === false) {
+ scope.showDropdownList = show;
+ } else {
+ scope.showDropdownList = !scope.showDropdownList;
+ }
+
+ if (!scope.showDropdownList) {
+ scope.focusInputButton = true;
+ hideCalendar();
+ } else {
+ if (scope.currentSelection === 'Custom Single Date' || scope.currentSelection === 'Custom Range') {
+ showCalendar();
+ }
+ }
+ };
+
+ scope.resetTime = function(date) {
+ var dt;
+ if (!isNaN(new Date(date))) {
+ dt = new Date(date);
+ } else {
+ return null;
+ }
+ return new Date(dt.getFullYear(), dt.getMonth(), dt.getDate());
+ };
+
+ scope.getDropdownText = function () {
+ inputChange = true;
+ var dropdownText = scope.selectedOption;
+
+ if (scope.currentSelection === 'Custom Single Date') {
+ if (!isNaN(new Date(dropdownText)) && datepickerService.validateDateString(dropdownText, dateFormatString)) {
+ ctrl.$setValidity('invalidDate', true);
+ scope.fromDate = undefined;
+ scope.currentDate = new Date(dropdownText);
+ } else {
+ ctrl.$setValidity('invalidDate', false);
+ clear(true);
+ }
+ } else if (scope.currentSelection === 'Custom Range') {
+ if (dropdownText.indexOf('-') !== -1 && (dropdownText.split('-').length === 2 || dropdownText.split('-').length === 6)) {
+ ctrl.$setValidity('invalidDateRange', true);
+ var resultDropdownText = dropdownText.split('-');
+ if (resultDropdownText.length === 2) {
+ resultDropdownText[0] = resultDropdownText[0].trim();
+ resultDropdownText[1] = resultDropdownText[1].trim();
+ } else if (resultDropdownText.length === 6) {
+ var firstDateString = resultDropdownText[0].trim() + '-' + resultDropdownText[1].trim() + '-' + resultDropdownText[2].trim();
+ var secondDateString = resultDropdownText[3].trim() + '-' + resultDropdownText[4].trim() + '-' + resultDropdownText[5].trim();
+ resultDropdownText[0] = firstDateString;
+ resultDropdownText[1] = secondDateString;
+ }
+
+ if (!isNaN(new Date(resultDropdownText[0])) && !isNaN(new Date(resultDropdownText[1])) && datepickerService.validateDateString(resultDropdownText[0], dateFormatString) && datepickerService.validateDateString(resultDropdownText[1], dateFormatString)) {
+ ctrl.$setValidity('invalidDate', true);
+ var fromDate = new Date(resultDropdownText[0]);
+ var currentDate = new Date(resultDropdownText[1]);
+ if(fromDate.getTime() < currentDate.getTime()) {
+ ctrl.$setValidity('invalidDateRange', true);
+ scope.fromDate = fromDate;
+ scope.currentDate = currentDate;
+ } else {
+ ctrl.$setValidity('invalidDateRange', false);
+ clear(true);
+ }
+ } else {
+ ctrl.$setValidity('invalidDate', false);
+ clear(true);
+ }
+ } else {
+ ctrl.$setValidity('invalidDateRange', false);
+ clear(true);
+ }
+ }
+ };
+
+ scope.untrackInputChange = function() {
+ inputChange = false;
+ };
+
+ scope.selectAdvancedOption = function (value, notClearFlag) {
+ scope.currentSelection = value;
+ if(!notClearFlag){
+ clear();
+ showCalendar();
+ }
+ scope.$watch('currentDate', function(val) {
+ if(!isNaN(new Date(val))) {
+ scope.applyButtonType = "primary";
+ setDropdownText(value);
+ if (!inputChange) {
+ scope.focusApplyButton = true;
+ }
+ }
+ });
+ scope.$watch('fromDate', function(val) {
+ if(!isNaN(new Date(val))) {
+ setDropdownText(value);
+ }
+ });
+ if (value === 'Custom Single Date') {
+ scope.focusSingleDateCalendar = true;
+ } else if (value === 'Custom Range') {
+ scope.focusRangeCalendar = true;
+ }
+ };
+
+ scope.resetFocus = function () {
+ scope.focusSingleDateCalendar = false;
+ scope.focusRangeCalendar = false;
+ scope.focusApplyButton = false;
+ };
+
+ scope.apply = function() {
+ scope.dateRange.selection = scope.selectedOption;
+ if(!isNaN(new Date(scope.fromDate))) {
+ scope.from = scope.fromDate;
+ scope.dateRange.from = scope.fromDate;
+ } else {
+ scope.from = undefined;
+ scope.dateRange.from = undefined;
+ }
+ if(!isNaN(new Date(scope.currentDate))) {
+ scope.current = scope.currentDate;
+ scope.dateRange.current = scope.currentDate;
+ } else {
+ scope.current = undefined;
+ scope.dateRange.current = undefined;
+ }
+
+ showDropdown();
+ };
+
+ scope.$watchCollection(function() {
+ return scope.dateRange;
+ }, function(value) {
+ if(ctrl) {
+ var finalDateRange = angular.copy(value);
+ ctrl.$setViewValue(finalDateRange);
+ }
+ });
+
+ ctrl.$render = function () {
+ if (ctrl.$viewValue) {
+ var inputRange = ctrl.$viewValue;
+ scope.selectedOption = inputRange.selection;
+ scope.fromDate = inputRange.from;
+ scope.currentDate = inputRange.current;
+ if (scope.fromDate !== undefined && scope.currentDate !== undefined) {
+ scope.selectAdvancedOption('Custom Range', true);
+ scope.dateRange.from = scope.fromDate;
+ scope.dateRange.current = scope.currentDate;
+ } else if (scope.currentDate !== undefined) {
+ scope.selectAdvancedOption('Custom Single Date', true);
+ scope.dateRange.from = undefined;
+ scope.dateRange.current = scope.currentDate;
+ }
+ }
+ };
+
+ scope.cancel = function() {
+ scope.currentSelection = "";
+ scope.selectedOption = datepickerConfig.dateFilter.defaultText;
+ showDropdown();
+ };
+
+ var outsideClick = function (e) {
+ var isElement = $isElement(angular.element(e.target), elem, $document);
+ if(!isElement) {
+ scope.cancel();
+ scope.$apply();
+ }
+ };
+ $documentBind.click('showDropdownList', outsideClick, scope);
+ };
+
+ return {
+ restrict: 'EA',
+ scope: {
+ from: '=?from',
+ current: "=?current"
+ },
+ replace: true,
+ require: '?ngModel',
+ transclude:true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/datepicker/dateFilter.html',
+ controller:['$scope', '$element', '$attrs',function($scope){
+ $scope.dateRange = {
+ selection: undefined,
+ from: undefined,
+ current: undefined
+ };
+ this.selectOption = function (fromDate,toDate,caption) {
+ $scope.selectedOption = caption;
+ $scope.currentSelection =caption;
+ $scope.dateRange.selection = caption;
+ $scope.dateRange.current = $scope.resetTime(toDate);
+ $scope.dateRange.from = $scope.resetTime(fromDate);
+ $scope.showDropdown();
+ };
+ $scope.checkCurrentSelection=this.checkCurrentSelection = function(value) {
+ if(value === $scope.currentSelection) {
+ return true;
+ }
+ return false;
+ };
+ }],
+ compile: function(elem, attr) {
+ var singleDateCalendar = elem.find('span').eq(4);
+ var rangeCalendar = elem.find('span').eq(5);
+ rangeCalendar.attr('from', 'fromDate');
+ singleDateCalendar.attr('current', 'currentDate');
+ rangeCalendar.attr('current', 'currentDate');
+ datepickerService.setAttributes(attr, singleDateCalendar);
+ datepickerService.setAttributes(attr, rangeCalendar);
+
+ return link;
+ }
+ };
+}])
+.directive('attDateFilterList',function(){
+ return{
+ restrict:'EA',
+ scope:{
+ fromDate:'=fromDate',
+ toDate:'=toDate',
+ caption:'=caption',
+ disabled:'=disabled'
+ },
+ require:'^attDateFilter',
+ transclude:true,
+ replace:true,
+ templateUrl:'app/scripts/ng_js_att_tpls/datepicker/dateFilterList.html',
+ link:function(scope,elem,attr,ctrl){
+ scope.selectOption=function(fromDate,toDate,caption){
+ ctrl.selectOption(fromDate,toDate,caption);
+ };
+ scope.checkCurrentSelection=ctrl.checkCurrentSelection;
+ }
+ };
+});
+angular.module('att.abs.devNotes', [])
+
+ .directive('attDevNotes', function() {
+ return {
+ restrict: 'EA',
+ transclude: true,
+ scope: {},
+ controller: function($scope){
+ var panes = $scope.panes = [];
+ $scope.select = function(pane)
+ {
+ angular.forEach(panes, function(pane)
+ {
+ pane.selected = false;
+ });
+ pane.selected = true;
+ };
+ this.addPane = function(pane) {
+ if (panes.length === 0) {
+ $scope.select(pane);
+ }
+ panes.push(pane);
+ };
+ },
+ template:'<div>'+
+ '<ul class="tabs">' +
+ '<li ng-repeat="pane in panes" ng-class="{active:pane.selected}">'+
+ '<a href="javascript:void(0)" ng-click="select(pane)">{{pane.title}}</a>' +
+ '</li>' +
+ '</ul>' +
+ '<div ng-transclude></div>'+
+ '</div>',
+ replace: true
+ };
+ })
+
+ .directive('pane', function() {
+ return {
+ require: '^attDevNotes',
+ restrict: 'EA',
+ transclude: true,
+ scope: {
+ title: '@'
+ },
+ link: function(scope, element, attrs, tabsCtrl) {
+ tabsCtrl.addPane(scope);
+ },
+ template:
+ '<div class="tab-pane" ng-class="{active: selected}">' +
+ '<pre ng-class="{\'language-markup\':title==\'HTML\',\'language-javascript\':title==\'JavaScript\',\'language-json\':title==\'JSON\'}" class=" line-numbers">' +
+ '<code ng-transclude></code>' +
+ '</pre>' +
+ '</div>',
+ replace: true
+ };
+ });
+
+angular.module('att.abs.dividerLines', [])
+ .directive('attDividerLines', [function()
+ {
+ return {
+ scope: {
+ attDividerLines: '@'
+ },
+ restrict: 'A',
+ replace: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/dividerLines/dividerLines.html',
+ link: function(scope, element, attribute)
+ {
+ scope.lightContainer = attribute.attDividerLines;
+ }
+ };
+ }]);
+
+angular.module('att.abs.dragdrop', [])
+ .directive('attFileDrop', ['$parse', function($parse) {
+ return {
+ restrict: 'A',
+ scope: {
+ fileModel : '=',
+ onDrop : '&',
+ attFileDrop : '&'
+ },
+ controller: ['$scope', '$attrs', function($scope, $attrs){
+ if($attrs.attFileDrop!==""){
+ $scope.onDrop=$scope.attFileDrop;
+ }
+ this.onDrop = $scope.onDrop;
+ }],
+ link: function(scope, element) {
+ element.addClass('dragdrop');
+ element.bind(
+ 'dragover',
+ function(e) {
+ if(e.originalEvent){
+ e.dataTransfer = e.originalEvent.dataTransfer;
+ }
+ e.dataTransfer.dropEffect = 'move';
+ // allows us to drop
+ if (e.preventDefault) {
+ e.preventDefault();
+ }
+ element.addClass('dragdrop-over');
+ return false;
+ }
+ );
+ element.bind(
+ 'dragenter',
+ function(e) {
+ // allows us to drop
+ if (e.preventDefault) {
+ e.preventDefault();
+ }
+ element.addClass('dragdrop-over');
+ return false;
+ }
+ );
+ element.bind(
+ 'dragleave',
+ function() {
+ element.removeClass('dragdrop-over');
+ return false;
+ }
+ );
+ element.bind(
+ 'drop',
+ function(e) {
+ // Stops some browsers from redirecting.
+ if(e.preventDefault) {
+ e.preventDefault();
+ }
+ if (e.stopPropagation) {
+ e.stopPropagation();
+ }
+ if(e.originalEvent){
+ e.dataTransfer = e.originalEvent.dataTransfer;
+ }
+ element.removeClass('dragdrop-over');
+ if(e.dataTransfer.files && e.dataTransfer.files.length > 0){
+ scope.fileModel = e.dataTransfer.files[0];
+ scope.$apply();
+ if(typeof scope.onDrop === "function"){
+ scope.onDrop = $parse(scope.onDrop);
+ scope.onDrop();
+ }
+ }
+ return false;
+ }
+ );
+ }
+ };
+ }])
+ .directive('attFileLink', [ function() {
+ return {
+ restrict: 'EA',
+ require: '^?attFileDrop',
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/dragdrop/fileUpload.html',
+ scope: {
+ fileModel : '=?',
+ onFileSelect : '&',
+ attFileLink : '&'
+ },
+ controller: ['$scope', '$parse', function($scope, $parse){
+ this.setFileModel= function(fileModel){
+ if($scope.takeFileModelFromParent){
+ $scope.$parent.fileModel = fileModel;
+ $scope.$parent.$apply();
+ }
+ else{
+ $scope.fileModel = fileModel;
+ $scope.$apply();
+ }
+ };
+ this.callbackFunction= function(){
+ if(typeof $scope.onFileSelect === "function"){
+ $scope.onFileSelect = $parse($scope.onFileSelect);
+ $scope.onFileSelect();
+ }
+ };
+
+ }],
+ link: function(scope, element, attr, attFileDropCtrl) {
+ scope.takeFileModelFromParent = false;
+ if(!(attr.fileModel) && attFileDropCtrl){
+ scope.takeFileModelFromParent = true;
+ }
+ if(attr.attFileLink!==""){
+ scope.onFileSelect=scope.attFileLink;
+ }
+ else if(!(attr.onFileSelect) && attFileDropCtrl){
+ scope.onFileSelect = attFileDropCtrl.onDrop;
+ }
+ }
+ };
+ }])
+ .directive('attFileChange', ['$log','$rootScope',function($log,$rootScope) {
+ return {
+ restrict: 'A',
+ require: '^attFileLink',
+ link: function(scope, element, attr, attFileLinkCtrl) {
+ element.bind('change',changeFileModel);
+ function changeFileModel(e) {
+ if (e.target.files && e.target.files.length > 0) {
+ attFileLinkCtrl.setFileModel(e.target.files[0]);
+ attFileLinkCtrl.callbackFunction();
+ }
+ else {
+ var strFileName = e.target.value;
+ try {
+ var objFSO = new ActiveXObject("Scripting.FileSystemObject");
+ attFileLinkCtrl.setFileModel(objFSO.getFile(strFileName));
+ attFileLinkCtrl.callbackFunction();
+ }
+ catch (e) {
+ var errMsg = "Error: Please follow the guidelines of Drag and Drop component on Sandbox demo page.";
+ $log.error(errMsg);
+ $rootScope.$broadcast('att-file-link-failure', errMsg);
+ }
+ }
+ }
+ }
+ };
+ }]);
+angular.module("att.abs.drawer", ['att.abs.utilities'])
+.directive('attDrawer', ['$document', '$timeout', 'DOMHelper', function ($document, $timeout, DOMHelper) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ scope: {
+ drawerOpen: "=?",
+ drawerAutoClose: "&?"
+ },
+ template: '<div><div class="att-drawer" ng-transclude></div><div ng-class="{\'drawer-backdrop\':drawerOpen}"></div></div>',
+ link: function ($scope, element, attrs) {
+ var param = {};
+ // First Element in Drawer component
+ var firstElement = undefined;
+ // Element drawer is toggled from
+ var drawerLaunchingElement = undefined;
+ // Override default parameters
+ param.side = attrs.drawerSlide || 'top';
+ param.speed = attrs.drawerSpeed || '0.25';
+ param.size = attrs.drawerSize || '300px';
+ param.zindex = attrs.drawerZindex || 1000;
+ param.className = attrs.drawerClass || 'att-drawer';
+ var slider = element.eq(0).children()[0];
+ var content = angular.element(slider).children()[0];
+ slider.className = param.className;
+ /* Style setup */
+ slider.style.transitionDuration = param.speed + 's';
+ slider.style.webkitTransitionDuration = param.speed + 's';
+ slider.style.zIndex = param.zindex;
+ slider.style.position = 'fixed';
+ slider.style.width = 0;
+ slider.style.height = 0;
+ slider.style.transitionProperty = 'width, height';
+ if(param.side==='right'){
+ slider.style.height = attrs.drawerCustomHeight || '100%';
+ slider.style.top = attrs.drawerCustomTop || '0px';
+ slider.style.bottom = attrs.drawerCustomBottom || '0px';
+ slider.style.right = attrs.drawerCustomRight || '0px';
+ }else if(param.side==='left'){ /*Added this part for ECOM*/
+ slider.style.height = attrs.drawerCustomHeight || '100%';
+ slider.style.top = attrs.drawerCustomTop || '0px';
+ slider.style.bottom = attrs.drawerCustomBottom || '0px';
+ slider.style.left = attrs.drawerCustomRight || '0px';
+ }
+ else if(param.side==='top' || param.side==='bottom'){
+ slider.style.width = attrs.drawerCustomWidth || '100%';
+ slider.style.left = attrs.drawerCustomLeft || '0px';
+ slider.style.top = attrs.drawerCustomTop || '0px';
+ slider.style.right = attrs.drawerCustomRight || '0px';
+ }
+ $timeout(function() {
+ firstElement = DOMHelper.firstTabableElement(element[0]);
+ }, 10, false);
+ /* Closed */
+ function drawerClose(slider, param) {
+ if (slider && slider.style.width !== 0 && slider.style.height !== 0){
+ content.style.display = 'none';
+ if(param.side==='right' || param.side==='left'){
+ slider.style.width = '0px';
+ }
+ else if(param.side==='top' || param.side==='bottom'){
+ slider.style.height = '0px';
+ }
+ }
+ $scope.drawerOpen = false;
+ // Shift focus
+ if (angular.isDefined(drawerLaunchingElement) && drawerLaunchingElement != null) {
+ drawerLaunchingElement.focus();
+ }
+ }
+ /* Open */
+ function drawerOpen(slider, param) {
+ // Before opening drawer, find the focused element
+ drawerLaunchingElement = document.activeElement;
+ if (slider.style.width !== 0 && slider.style.height !== 0){
+ if(param.side==='right' || param.side==='left'){
+ slider.style.width = param.size;
+ }
+ else if(param.side==='top' || param.side==='bottom'){
+ slider.style.height = param.size;
+ }
+ $timeout(function() {
+ content.style.display = 'block';
+ // Shift focus
+ if (angular.isDefined(firstElement) && firstElement != null) {
+ firstElement.focus();
+ }
+ },(param.speed * 1000));
+ }
+ }
+ function isFunction(functionToCheck) {
+ var getType = {};
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
+ }
+ /*
+ * Watchers
+ * */
+ if(attrs.drawerSize) {
+ $scope.$watch(function() {
+ return attrs.drawerSize;
+ }, function(newVal) {
+ param.size = newVal;
+ if($scope.drawerOpen) {
+ drawerOpen(slider,param);
+ }
+ });
+ }
+ $scope.$watch("drawerOpen", function (value){
+ if (!!value) {
+ // Open
+ drawerOpen(slider,param);
+ } else {
+ // Close
+ drawerClose(slider,param);
+ }
+ });
+ // close panel on location change
+ if($scope.drawerAutoClose()) {
+ $scope.$on("$locationChangeStart", function(){
+ drawerClose(slider, param);
+ if(isFunction($scope.drawerAutoClose())) {
+ $scope.drawerAutoClose();
+ }
+ });
+ $scope.$on("$stateChangeStart", function(){
+ drawerClose(slider, param);
+ if(isFunction($scope.drawerAutoClose)) {
+ $scope.drawerAutoClose();
+ }
+ });
+ }
+ }
+ };
+ }
+]);
+angular.module('att.abs.message', [])
+
+.directive('attMessages', [function() {
+ return {
+ restrict: 'EA',
+ scope: {
+ messageType: '=?'
+ },
+ controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {
+ $scope.messageScope = [];
+ this.registerScope = function(messageScope) {
+ $scope.messageScope.push(messageScope);
+ };
+ $scope.$parent.$watchCollection($attrs['for'], function(errors) {
+ for (var key in errors) {
+ if (errors[key]) {
+ $scope.error = key;
+ break;
+ } else {
+ $scope.error = null;
+ }
+ }
+ for (var i = 0; i < $scope.messageScope.length; i++) {
+ if($scope.messageScope[i].when === $scope.error) {
+ $scope.messageScope[i].show();
+ $scope.setMessageType($scope.messageScope[i].type);
+ } else {
+ $scope.messageScope[i].hide();
+ }
+ }
+ if($scope.error === null) {
+ $scope.setMessageType(null);
+ }
+ });
+ $scope.setMessageType = this.setMessageType = function(messageType) {
+ if($attrs.messageType) {
+ $scope.messageType = messageType;
+ }
+ };
+ }]
+ };
+}])
+
+.directive('attMessage', [function() {
+ return {
+ restrict: 'EA',
+ scope: {},
+ require: '^attMessages',
+ link: function(scope, elem, attr, ctrl) {
+ ctrl.registerScope(scope);
+ elem.attr('role', 'alert'); //Trinity CATO
+ scope.when = attr.when || attr.attMessage;
+ scope.type = attr.type;
+ scope.show = function() {
+ elem.css({display: 'block'});
+ };
+ scope.hide = function() {
+ elem.css({display: 'none'});
+ };
+ scope.hide();
+ }
+ };
+}]);
+
+angular.module('att.abs.formField', ['att.abs.message', 'att.abs.utilities'])
+.directive('attFormField', [function() {
+ return {
+ priority: 101,
+ restrict: 'A',
+ controller:function() {
+ },
+ link: function(scope, elem, attr) {
+ elem.wrap('<div class="form-field"></div>');
+ elem.parent().append('<label class="form-field__label">' + attr.placeholder || attr.attFormField + '</label>');
+ elem.wrap('<div class="form-field-input-container"></div>');
+
+ elem.bind('keyup', function() {
+ if (this.value !== '') {
+ elem.parent().parent().find('label').addClass('form-field__label--show').removeClass('form-field__label--hide');
+ } else {
+ elem.parent().parent().find('label').addClass('form-field__label--hide').removeClass('form-field__label--show');
+ }
+ });
+
+ elem.bind('blur', function() {
+ if (this.value === '') {
+ elem.parent().parent().find('label').removeClass('form-field__label--hide');
+ }
+ });
+ }
+ };
+}])
+.directive('attFormFieldValidation', ['$compile', '$log', function($compile, $log) {
+ return {
+ priority: 102,
+ scope: {},
+ restrict: 'A',
+ require: ['?ngModel', '?attFormField'],
+ link: function(scope, elem, attr, ctrl) {
+ var ngCtrl = ctrl[0];
+ var attFormFieldCtrl = ctrl[1];
+ scope.valid = "";
+ if (!ngCtrl) {
+ $log.error("att-form-field-validation :: ng-model directive is required.");
+ return;
+ }
+ if (!attFormFieldCtrl) {
+ $log.error("att-form-field-validation :: att-form-field directive is required.");
+ return;
+ }
+
+ elem.parent().append($compile(angular.element('<i class="icon-info-alert error" ng-show="valid===false">&nbsp;</i>'))(scope));
+ elem.parent().append($compile(angular.element('<i class="icon-info-success success" ng-show="valid===true">&nbsp;</i>'))(scope));
+
+ scope.$watch('valid', function(value) {
+ if (value) {
+ elem.parent().parent().addClass('success');
+ } else if (value === false) {
+ elem.parent().parent().addClass('error');
+ } else {
+ elem.parent().parent().removeClass('success').removeClass('error');
+ }
+ });
+
+ elem.bind('keyup', function() {
+ if (ngCtrl.$valid) {
+ scope.valid = true;
+ } else if (ngCtrl.$invalid) {
+ scope.valid = false;
+ } else {
+ scope.valid = "";
+ }
+ scope.$apply();
+ });
+ }
+ };
+}])
+.directive('attFormFieldValidationAlert', ['$timeout', function($timeout) {
+ return {
+ scope: {
+ messageType: '=?'
+ },
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlert.html',
+ link: function(scope, elem, attr, ctrl) {
+ scope.showLabel = false;
+ scope.hideLabel = false;
+ scope.errorMessage = false;
+ scope.warningMessage = false;
+ var checkMessageType = function() {
+ var messageType = scope.messageType;
+ if (messageType === 'error') {
+ scope.errorMessage = true;
+ scope.warningMessage = false;
+ } else if (messageType === 'warning') {
+ scope.errorMessage = false;
+ scope.warningMessage = true;
+ } else {
+ scope.errorMessage = false;
+ scope.warningMessage = false;
+ }
+ };
+ var oldIE = navigator.userAgent.toLowerCase().indexOf('msie 8.0') !== -1;
+ elem.find('label').text(elem.find('input').attr('placeholder'));
+ elem.find('input').bind('keyup', function() {
+ if (this.value !== '') {
+ scope.showLabel = true;
+ scope.hideLabel = false;
+ if (oldIE) {
+ elem.find('label').css({top: '-20px'});
+ }
+ } else {
+ scope.showLabel = false;
+ scope.hideLabel = true;
+ if (oldIE) {
+ elem.find('label').css({top: '0px'});
+ }
+ }
+ checkMessageType();
+ scope.$apply();
+ });
+
+ elem.find('input').bind('blur', function() {
+ if (this.value === '') {
+ scope.showLabel = false;
+ scope.hideLabel = false;
+ }
+ scope.$apply();
+ });
+ $timeout(function() {
+ checkMessageType();
+ }, 100);
+ }
+ };
+}])
+.constant("CoreFormsUiConfig", {
+ phoneMask: '(___) ___-____'
+ })
+.directive('attPhoneMask', ['$parse', 'CoreFormsUiConfig', function($parse, CoreFormsUiConfig) {
+ return {
+ require: 'ngModel',
+ scope: {
+ ngModel: '='
+ },
+ link: function(scope, iElement, iAttrs, ctrl) {
+ var B = navigator.userAgent.toLowerCase(), C = B.indexOf("android") > -1,
+ oldIE = B.indexOf('msie 8.0') !== -1;;
+ var A = '';
+ var validPhoneNumber = false;
+ if (C) {
+ A = "__________";
+ }
+ else {
+ A = CoreFormsUiConfig.phoneMask;
+ }
+ iElement.attr("maxlength", A.length);
+ var checkValidity = function(unmaskedValue) {
+ var valid = false;
+ if (unmaskedValue){
+ valid = (unmaskedValue.length === 10);}
+ ctrl.$setValidity('invalidPhoneNumber', validPhoneNumber);
+ ctrl.$setValidity('mask', valid);
+ return valid;
+ };
+
+ var handleKeyup = function() {
+ var E,D = ctrl.$modelValue;
+ if (!D.length) {
+ return;
+ }
+ var L, K, G, J, I;
+ J = [];
+ G = A.split("");
+ I = G.length;
+ L = D.substring(0, A.length);
+ K = D.replace(/[^0-9]/g, "").split("");
+ for (E = 0; E < I; E++) {
+ J.push(G[E] === "_" ? K.shift() : G[E]);
+ if (K.length === 0) {
+ break;
+ }
+ }
+ D = J.join("");
+ if (D === '('){
+ D = '';}
+ ctrl.$setViewValue(D);
+ ctrl.$render();
+ return D;
+ };
+
+
+ // since we are only allowing 0-9, why even let the keypress go forward?
+ // also added in delete... in case they want to delete :)
+ var handlePress = function(e) {
+ if (e.which) {
+ if ((e.which < 48 || e.which > 57) && (e.which < 96 || e.which > 105)) {
+ if (e.which !== 8 && e.which !== 9 && e.which !== 46 && e.which !== 13 && e.which !== 37 && e.which !== 39 &&
+ // Allow: Ctrl+V/v
+ (e.ctrlKey !== true && (e.which !== '118' || e.which !== '86'))&&
+ // Allow: Ctrl+C/c
+ (e.ctrlKey !== true && (e.which !== '99' || e.which !== '67'))&&
+ // Allow: Ctrl+X/x
+ (e.ctrlKey !== true && (e.which !== '120' || e.which !== '88')))
+ {
+ e.preventDefault ? e.preventDefault() : e.returnValue = false;
+ iElement.attr("aria-label","Only numbers are allowed");
+ validPhoneNumber = false;
+ }}
+ else{
+ iElement.removeAttr("aria-label");
+ validPhoneNumber = true;
+ }
+ }
+ scope.$apply();
+ };
+ // i moved this out because i thought i might need focus as well..
+ // to handle setting the model as the view changes
+ var parser = function(fromViewValue) {
+ var letters = /^[A-Za-z]+$/;
+ var numbers = /^[0-9]+$/;
+ if(fromViewValue.match(letters))
+ {validPhoneNumber = false;}
+ if(fromViewValue.match(numbers))
+ {validPhoneNumber = true;}
+ var clean = "";
+ if (fromViewValue && fromViewValue.length > 0) {
+ clean = fromViewValue.replace(/[^0-9]/g, '');
+ }
+ checkValidity(clean);
+ return clean;
+ };
+
+ //to handle reading the model and formatting it
+ var formatter = function(fromModelView) {
+ var input = '';
+ checkValidity(fromModelView);
+ if (fromModelView){
+ input = handleKeyup();}
+ return input;
+ };
+ ctrl.$parsers.push(parser);
+ ctrl.$formatters.push(formatter);
+ iElement.bind('keyup', handleKeyup);
+ iElement.bind('keydown', handlePress);
+ iElement.bind('input', function(e){
+ handleKeyup(e);
+ handlePress(e);
+ });
+ }
+ };
+}])
+.constant('validationTypeInt', {
+ validationNum: {'number':'1','text':'2','email':'3'}
+ })
+.directive('attFormFieldPrv', [ 'keyMapAc', 'validationTypeInt', function( keyMapAc, validationTypeInt ) {
+ return {
+ priority: 101,
+ restrict: 'AE',
+ controller:['$scope', function($scope) {
+ this.showHideErrorMessage = function ( booleanValue ){
+ if( $scope.$$prevSibling != null && angular.isDefined( $scope.$$prevSibling )
+ && angular.isDefined( $scope.$$prevSibling.hideErrorMsg ) ){
+ $scope.$$prevSibling.hideErrorMsg = booleanValue;
+ $scope.$apply();
+ }
+ };
+ this.findAllowedCharactor = function( keyCode ){
+ var keyMapSc = keyMapAc.keys;
+ if( angular.isDefined( $scope.allowedSpecialCharacters )
+ && angular.isDefined( $scope.allowedSpecialCharacters.length )
+ && $scope.allowedSpecialCharacters.length > 0 ){
+ var allowedCharList = $scope.allowedSpecialCharacters;
+ var charFound = false;
+ for( var i=0 ; i < allowedCharList.length ; i++){
+ if( allowedCharList[i] === keyMapSc[keyCode] ){
+ charFound = true;
+ break;
+ }
+ }
+ return charFound;
+ }else{
+ return false;
+ }
+ };
+ this.validateText = function( validationType, allowedChars, validationInput, outputSpecialChars ){
+ if( angular.isDefined( allowedChars ) && allowedChars.length === 0 ){
+ var expAlphanumeric = /^[a-zA-Z0-9]*$/i;
+ return expAlphanumeric.test( validationInput );
+ }else{
+ var expAlphanumericSpecialChar = '^[a-zA-Z0-9' + outputSpecialChars + ']*$';
+ var regularExp = new RegExp( expAlphanumericSpecialChar, 'i' );
+ return regularExp.test( validationInput );
+ }
+ };
+ this.validateNumber = function( validationType, allowedChars, validationInput, outputSpecialChars ){
+ if( angular.isDefined( allowedChars ) && allowedChars.length === 0 ){
+ var expNumber = /^[0-9\.]+$/;
+ return expNumber.test( validationInput );
+ }else{
+ var expNumberSpecial = '^[0-9\.' + outputSpecialChars + ']*$';
+ var regularExp = new RegExp( expNumberSpecial, 'i' );
+ return regularExp.test( validationInput );
+ }
+ };
+ this.validateEmail = function( validationType, allowedChars, validationInput, outputSpecialChars ){
+ if( angular.isDefined( allowedChars ) && allowedChars.length === 0 ){
+ var expEmail = /(([a-zA-Z0-9\-?\.?]+)@(([a-zA-Z0-9\-_]+\.)+)([a-z]{2,3}))+$/;
+ return expEmail.test( validationInput );
+ }else{
+ var expEmailSpecial = '(([a-z' + outputSpecialChars + 'A-Z0-9\-?\.?]+)@(([a-z'
+ + outputSpecialChars + 'A-Z0-9\-_]+\.)+)([' + outputSpecialChars + 'a-z]{2,3}))+$';
+ var regularExp = new RegExp( expEmailSpecial, 'i' );
+ return regularExp.test( validationInput );
+ }
+ };
+ this.validateInput = function( validationType, allowedChars, validationInput ){
+ var outputSpecialChars = '';
+ var result = false;
+ if( angular.isDefined( allowedChars ) && angular.isDefined( allowedChars.length )
+ && allowedChars.length > 0 ){
+ for( var i = 0; i < allowedChars.length; i++){
+ outputSpecialChars += '\\'+allowedChars[i];
+ }
+ }
+ switch ( validationTypeInt.validationNum[ validationType ] ) {
+ case validationTypeInt.validationNum["text"]:
+ result = this.validateText( validationType, allowedChars, validationInput, outputSpecialChars );
+ break;
+ case validationTypeInt.validationNum["number"]:
+ result = this.validateNumber( validationType, allowedChars, validationInput, outputSpecialChars );
+ break;
+ case validationTypeInt.validationNum["email"]:
+ result = this.validateEmail( validationType, allowedChars, validationInput, outputSpecialChars );
+ break;
+ default:
+ break;
+ }
+ return result;
+ };
+ }],
+ link: function(scope, elem, attr ) {
+ elem.parent().prepend('<label class="form-field__label">' + attr.placeholder + '</label>');
+ elem.wrap('<div class="form-field-input-container"></div>');
+ elem.parent().parent().find('label').addClass('form-field__label--show');
+ }
+ };
+}])
+.directive('attFormFieldValidationPrv', [ 'keyMapAc','validationTypeInt' , function( keyMapAc, validationTypeInt ) {
+ return {
+ priority: 202,
+ scope: {
+ validationType: '=',
+ allowedChars: '='
+ },
+ restrict: 'A',
+ require: ['?ngModel', '^attFormFieldPrv'],
+ link: function(scope, elem, attr, ctrl) {
+ var attFormFieldCtrl = ctrl[1];
+ elem.bind('keyup', function() {
+ /* email validation has tobe done on keyup */
+ if( attFormFieldCtrl.validateInput( scope.validationType, scope.allowedChars, elem[0].value ) ){
+ attFormFieldCtrl.showHideErrorMessage(false);
+ }
+ else{
+ attFormFieldCtrl.showHideErrorMessage(true);
+ }
+ });
+ var keyMapSc = keyMapAc.keyRange;
+ var allowedKeys = keyMapAc.allowedKeys;
+ var validateTextCode = function( charFound,event ){
+ var resultOne = (event.which < keyMapSc['startNum'] || event.which > keyMapSc['endNum'] );
+ var resultTwo = (event.which < keyMapSc['startCapitalLetters'] || event.which > keyMapSc['endCapitalLetters'] );
+ var resultThree = (event.which < keyMapSc['startSmallLetters'] || event.which > keyMapSc['endSmallLetters'] );
+ var result = ( resultOne && resultTwo && resultThree );
+ return ( result && ( !charFound ) );
+ };
+ var validateNumberCode = function( charFound,event ){
+ return ( ( event.which < keyMapSc['startNum'] || event.which > keyMapSc['endNum'] ) && ( !charFound ) );
+ };
+ var validateEmailCode = function( charFound,event ){
+ var condOne = String.fromCharCode( event.which ) !== '-' && String.fromCharCode( event.which ) !== '_';
+ var condTwo = String.fromCharCode( event.which ) !== '@' && String.fromCharCode( event.which ) !== '.';
+ var ifAllowedChars = condOne && condTwo;
+ var ifCharRange = validateTextCode( charFound,event );
+ return ( ( !charFound ) && ifAllowedChars && ifCharRange );
+ };
+ var validateSwitch = function( validationTypeSwitch, charFound, event ){
+ switch ( validationTypeSwitch ) {
+ case validationTypeInt.validationNum["text"]:
+ /* 97-122 65-90 48-57 if keyCode is outside range of alphanumeric chars and not found in list then prevent */
+ if( validateTextCode( charFound, event ) ){
+ return true;
+ }
+ break;
+ case validationTypeInt.validationNum["number"]:
+ /* if key code is outside number range and notfound then prevent */
+ if( validateNumberCode( charFound, event ) ){
+ return true;
+ }
+ break;
+ case validationTypeInt.validationNum["email"]:
+ /* if keyCode is outside charactor/number range and not _-@. then prevent */
+ if( validateEmailCode( charFound, event ) ){
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ return false;
+ };
+ /* key stroke prevention has to be happen on numeric and alphanumeric fields */
+ elem.bind('keypress', function( event ){
+ if(!(event.which)){
+ if(event.keyCode){
+ event.which = event.keyCode;
+ }
+ else if(event.charCode){
+ event.which = event.charCode;
+ }
+ }
+ var charFound = attFormFieldCtrl.findAllowedCharactor( event.which );
+ var insideCondOne = ( angular.isDefined( scope.validationType ) && scope.validationType !== '');
+ var insideCondTwo = ( event.which !== allowedKeys['TAB']
+ && event.which !== allowedKeys['BACKSPACE'] && event.which!== allowedKeys['DELETE'] );
+ var goInside = insideCondOne && insideCondTwo;
+ if( goInside && validateSwitch( validationTypeInt.validationNum[ scope.validationType ], charFound, event ) ){
+ event.preventDefault();
+ }
+ });
+ }
+ };
+}])
+.directive('attFormFieldValidationAlertPrv', [ function() {
+ return {
+ restrict: 'A',
+ scope : { errorMessage : '=' },
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlertPrv.html',
+ link: function( scope ) {
+ scope.errorMessage = scope.errorMessage;
+ if( angular.isDefined( scope.$parent.hideErrorMsg ) ){
+ scope.hideErrorMsg = scope.$parent.hideErrorMsg;
+ }
+ else{
+ scope.hideErrorMsg = true;
+ }
+ }
+ };
+}])
+//Credit card validation directives starts here
+.factory('Cards', [function() {
+ var defaultFormat = /(\d{1,4})/g;
+ var defaultInputFormat = /(?:^|\s)(\d{4})$/;
+ var cards = [
+ {
+ type: 'discover',
+ pattern: /^(6011|65|64[4-9]|622)/,
+ format: defaultFormat,
+ inputFormat: defaultInputFormat,
+ length: [16],
+ cvcLength: [3],
+ cvcSecurityImg: 'visaI',
+ zipLength: [5],
+ luhn: true
+ },
+ {
+ type: 'mc',
+ pattern: /^5[1-5]/,
+ format: defaultFormat,
+ inputFormat: defaultInputFormat,
+ length: [16],
+ cvcLength: [3],
+ cvcSecurityImg: 'visaI',
+ zipLength: [5],
+ luhn: true
+ },
+ {
+ type: 'amex',
+ pattern: /^3[47]/,
+ format: /(\d{1,4})(\d{1,6})?(\d{1,5})?/,
+ inputFormat: /^(\d{4}|\d{4}\s\d{6})$/,
+ length: [15],
+ cvcLength: [4],
+ cvcSecurityImg: 'amexI',
+ zipLength: [5],
+ luhn: true
+ },
+ {
+ type: 'visa',
+ pattern: /^4/,
+ format: defaultFormat,
+ inputFormat: defaultInputFormat,
+ length: [16],
+ cvcLength: [3],
+ cvcSecurityImg: 'visaI',
+ zipLength: [5],
+ luhn: true
+ }
+ ];
+
+ var _fromNumber = function(num) {
+ var card, i, len;
+
+ num = (num + '').replace(/\D/g, '');
+
+ for (i = 0, len = cards.length; i < len; i++) {
+
+ card = cards[i];
+
+ if (card.pattern.test(num)) {
+ return card;
+ }
+
+ }
+ };
+
+ var _fromType = function(type) {
+ var card, i, len;
+
+ for (i = 0, len = cards.length; i < len; i++) {
+
+ card = cards[i];
+
+ if (card.type === type) {
+ return card;
+ }
+
+ }
+ };
+
+ return {
+ fromNumber: function(val) {
+ return _fromNumber(val);
+ },
+ fromType: function(val) {
+ return _fromType(val);
+ },
+ defaultFormat: function() {
+ return defaultFormat;
+ },
+ defaultInputFormat: function() {
+ return defaultInputFormat;
+ }
+ };
+
+ }])
+.factory('_Validate', ['Cards', '$parse', function(Cards, $parse) {
+ var __indexOf = [].indexOf || function(item)
+ {
+ for (var i = 0, l = this.length; i < l; i++)
+ {
+ if (i in this && this[i] === item)
+ {
+ return i;
+ }
+ }
+ return -1;
+ };
+
+ var _luhnCheck = function(num) {
+ var digit, digits, odd, sum, i, len;
+
+ odd = true;
+ sum = 0;
+ digits = (num + '').split('').reverse();
+
+ for (i = 0, len = digits.length; i < len; i++) {
+
+ digit = digits[i];
+ digit = parseInt(digit, 10);
+
+ if ((odd = !odd)) {
+ digit *= 2;
+ }
+
+ if (digit > 9) {
+ digit -= 9;
+ }
+
+ sum += digit;
+
+ }
+
+ return sum % 10 === 0;
+ };
+
+ var _validators = {};
+
+ _validators['cvc'] = function(cvc, ctrl, scope, attr) {
+ var ref, ref1;
+
+ // valid if empty - let ng-required handle empty
+ if ((angular.isUndefined(cvc)) || (cvc === null) || (cvc.length === 0))
+ {
+ return true;
+ }
+
+ if (!/^\d+$/.test(cvc)) {
+ return false;
+ }
+
+ var type;
+ if (attr.paymentsTypeModel) {
+ var typeModel = $parse(attr.paymentsTypeModel);
+ type = typeModel(scope);
+ }
+
+ if (type)
+ {
+ ref1 = Cards.fromType(type);
+ return (ref = cvc.length, __indexOf.call((ref1 !== null) ? ref1.cvcLength : void 0, ref)) >= 0;
+ }
+ else
+ {
+ return cvc.length >= 3 && cvc.length <= 4;
+ }
+ };
+ _validators['zip'] = function(zip, ctrl, scope, attr) {
+ var ref, ref1;
+
+ // valid if empty - let ng-required handle empty
+ if ((angular.isUndefined(zip)) || (zip === null) || (zip.length === 0))
+ {
+ return true;
+ }
+
+ if (!/^\d+$/.test(zip)) {
+ return false;
+ }
+
+ var type;
+ if (attr.paymentsTypeModel) {
+ var typeModel = $parse(attr.paymentsTypeModel);
+ type = typeModel(scope);
+ }
+ if (type)
+ {
+ ref1 = Cards.fromType(type);
+ return (ref = zip.length, __indexOf.call(ref1 !== null ? ref1.zipLength : void 0, ref)) >= 0;
+ }
+ else
+ {
+ return zip.length < 6;
+ }
+ };
+ _validators['card'] = function(num, ctrl, scope, attr) {
+ var card, ref, typeModel;
+
+ if (attr.paymentsTypeModel) {
+ typeModel = $parse(attr.paymentsTypeModel);
+ }
+
+ var clearCard = function() {
+ if (typeModel) {
+ typeModel.assign(scope, null);
+ }
+ ctrl.$card = null;
+ };
+
+ // valid if empty - let ng-required handle empty
+ if ((angular.isUndefined(num)) || (num === null) || (num.length === 0)) {
+ clearCard();
+ return true;
+ }
+
+ num = (num + '').replace(/\s+|-/g, '');
+
+ if (!/^\d+$/.test(num)) {
+ clearCard();
+ return false;
+ }
+
+ card = Cards.fromNumber(num);
+ if (!card) {
+ clearCard();
+ return false;
+ }
+ ctrl.$card = angular.copy(card);
+
+ if (typeModel) {
+ typeModel.assign(scope, card.type);
+ }
+
+ ret = (ref = num.length, __indexOf.call(card.length, ref) >= 0) && (card.luhn === false || _luhnCheck(num));
+ return ret;
+ };
+ return function(type, val, ctrl, scope, attr) {
+ if (!_validators[type]) {
+
+ types = Object.keys(_validators);
+
+ errstr = 'Unknown type for validation: "' + type + '". ';
+ errstr += 'Should be one of: "' + types.join('", "') + '"';
+
+ throw errstr;
+ }
+ return _validators[type](val, ctrl, scope, attr);
+ };
+ }])
+.factory('_ValidateWatch', ['_Validate', function(_Validate) {
+
+ var _validatorWatches = {};
+
+ _validatorWatches['cvc'] = function(type, ctrl, scope, attr) {
+ if (attr.paymentsTypeModel) {
+ scope.$watch(attr.paymentsTypeModel, function(newVal, oldVal) {
+ if (newVal !== oldVal) {
+ var valid = _Validate(type, ctrl.$modelValue, ctrl, scope, attr);
+ ctrl.$setValidity(type, valid);
+ }
+ });
+ }
+ };
+ _validatorWatches['zip'] = function(type, ctrl, scope, attr) {
+ if (attr.paymentsTypeModel) {
+ scope.$watch(attr.paymentsTypeModel, function(newVal, oldVal) {
+ if (newVal !== oldVal) {
+ var valid = _Validate(type, ctrl.$modelValue, ctrl, scope, attr);
+ ctrl.$setValidity(type, valid);
+ }
+ });
+ }
+ };
+ return function(type, ctrl, scope, attr) {
+ if (_validatorWatches[type]) {
+ return _validatorWatches[type](type, ctrl, scope, attr);
+ }
+ };
+ }])
+.directive('validateCard', ['$window', '_Validate', '_ValidateWatch', function($window, _Validate, _ValidateWatch) {
+ return {
+ restrict: 'A',
+ require: 'ngModel',
+ link: function(scope, elem, attr, ctrl) {
+
+ var type = attr.validateCard;
+ _ValidateWatch(type, ctrl, scope, attr);
+ var validateFn = function(val) {
+ var valid = _Validate(type, val, ctrl, scope, attr);
+ ctrl.$setValidity(type, valid);
+ if (type === 'card')
+ {
+ if (ctrl.$card === null)
+ {
+ if ((val == null) || (val === "") || (val === ''))
+ {
+ scope.invalidCardError = '';
+ scope.invalidCard = "";
+ }
+ else if (val.length >= 1)
+ {
+ scope.invalidCardError = 'error';
+ scope.invalidCard = "The number entered is not a recognized credit card number.";
+ }
+ }
+ else
+ {
+ if (!valid)
+ {
+ if (ctrl.$card.length.indexOf(val.length) >= 0)
+ {
+ scope.invalidCardError = 'error';
+ scope.invalidCard = "The number entered is not a recognized credit card number.";
+ }
+ else
+ {
+ scope.invalidCardError = '';
+ scope.invalidCard = "";
+ }
+ }
+ else
+ {
+ scope.invalidCardError = '';
+ scope.invalidCard = "";
+ }
+ }
+ elem.bind("blur", function()
+ {
+ if ((!valid) || (ctrl.$card === null))
+ {
+ scope.invalidCardError = 'error';
+ scope.invalidCard = "The number entered is not a recognized credit card number.";
+ }
+ else
+ {
+ scope.invalidCardError = '';
+ scope.invalidCard = "";
+ }
+ });
+ }
+ return valid ? val : undefined;
+ };
+ ctrl.$formatters.push(validateFn);
+ ctrl.$parsers.push(validateFn);
+ }
+ };
+ }])
+.directive('creditCardImage', function() {
+ return{
+ templateUrl: 'app/scripts/ng_js_att_tpls/formField/creditCardImage.html',
+ replace: false,
+ transclude: false,
+ link: function(scope, element, attr)
+ {
+ scope.$watch(attr.creditCardImage, function(newVal, oldVal)
+ {
+ if (newVal !== oldVal)
+ {
+ scope.cvc = '';
+ if (!angular.isUndefined(newVal) && newVal !== null)
+ {
+ scope.newValCCI = 'show-' + newVal;
+ }
+ if (newVal === null)
+ {
+ scope.newValCCI = '';
+ }
+ }
+ });
+ }
+ };
+})
+.directive('securityCodeImage', ['$document', function($document) {
+ return{
+ templateUrl: 'app/scripts/ng_js_att_tpls/formField/cvcSecurityImg.html',
+ replace: false,
+ transclude: false,
+ link: function(scope, element, attr)
+ {
+ scope.$watch(attr.securityCodeImage, function(newVal, oldVal)
+ {
+ if (newVal !== oldVal)
+ {
+ if (!angular.isUndefined(newVal) && newVal !== null)
+ {
+ if (newVal === 'amexI')
+ {
+ scope.newValI = 'ccv2-security-amex';
+ scope.newValIAlt = "The 4 digit CVC security code is on the front of the card.";
+ scope.cvcPlaceholder = "4 digits";
+ scope.cvcMaxlength = 4;
+ }
+ else if (newVal === 'visaI')
+ {
+ scope.newValI = 'ccv2-security';
+ scope.newValIAlt = "The CVC security code is on the back of your card right after the credit card number.";
+ scope.cvcPlaceholder = "3 digits";
+ scope.cvcMaxlength = 3;
+ }
+ }
+ if (newVal === null)
+ {
+ scope.newValI = 'ccv2-security';
+ scope.cvcPlaceholder = "3 digits";
+ scope.cvcMaxlength = 3;
+ scope.newValIAlt = "The CVC security code is on the back of your card right after the credit card number.";
+ }
+
+ }
+ });
+ element.bind("click", function(ev) {
+ ev.preventDefault();
+ if (element.find("button").hasClass("active")) {
+ element.find("button").removeClass("active");
+ }
+ else {
+ element.find("button").addClass("active");
+ }
+ });
+
+ var window = angular.element($document);
+ window.bind("click", function(ev) {
+ var targetClassname = ev.target.className;
+ if ((targetClassname !== "btn btn-alt btn-tooltip active")) {
+ if (element.find("button").hasClass("active")) {
+ element.find("button").removeClass("active");
+ }
+ }
+
+ });
+ }
+ };
+ }]);
+
+angular.module('att.abs.hourpicker', ['att.abs.utilities'])
+ .constant('hourpickerConfig', {
+ days: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
+ customOption: 'Custom'
+ })
+
+.controller('hourPickerController', ['$scope', function ($scope) {
+
+ $scope.options = [];
+ this.setOptions = function (value, fromtime, totime, preselect, uncheckedFromTime, uncheckedToTime) {
+ $scope.options.push(value);
+
+ if (preselect !== undefined) {
+ $scope.preselect = preselect;
+ }
+
+ var daycount;
+
+ if (fromtime !== undefined) {
+ $scope.fromtime = fromtime;
+ for (daycount in $scope.days) {
+ if ($scope.days.hasOwnProperty(daycount)) {
+ $scope.FrtimeList[$scope.days[daycount]] = {};
+ if (uncheckedFromTime !== undefined) {
+ $scope.FrtimeList[$scope.days[daycount]].value = uncheckedFromTime;
+ $scope.selectedFromOption[$scope.days[daycount]] = uncheckedFromTime;
+ } else {
+ $scope.FrtimeList[$scope.days[daycount]].value = fromtime[0].value;
+ $scope.selectedFromOption[$scope.days[daycount]] = fromtime[0].value;
+ }
+ }
+ }
+ }
+ if (totime !== undefined) {
+ $scope.totime = totime;
+ for (daycount in $scope.days) {
+ if ($scope.days.hasOwnProperty(daycount)) {
+ $scope.TotimeList[$scope.days[daycount]] = {};
+ if (uncheckedToTime !== undefined) {
+ $scope.TotimeList[$scope.days[daycount]].value = uncheckedToTime;
+ $scope.selectedToOption[$scope.days[daycount]] = uncheckedToTime;
+ } else {
+ $scope.TotimeList[$scope.days[daycount]].value = totime[0].value;
+ $scope.selectedToOption[$scope.days[daycount]] = totime[0].value;
+ }
+ $scope.showToTimeErrorDay[$scope.days[daycount]] = false;
+ }
+ }
+ }
+
+ if (uncheckedFromTime !== undefined) {
+ $scope.uncheckedFromTime = uncheckedFromTime;
+ }
+ if (uncheckedToTime !== undefined) {
+ $scope.uncheckedToTime = uncheckedToTime;
+ }
+ };
+
+ this.getSelectedOption = function () {
+ return $scope.selectedOption;
+ };
+
+ this.setToTimeErrorDay = function (day, flag) {
+ $scope.showToTimeErrorDay[day] = flag;
+ };
+}])
+
+.directive('attHourpickerOption', [function () {
+ return {
+ restrict: 'EA',
+ require: '^attHourpicker',
+ scope: {
+ option: "=option",
+ fromtime: "=fromtime",
+ totime: "=totime",
+ preselect: "=preselect",
+ uncheckedFromTime: "=",
+ uncheckedToTime: "="
+ },
+ link: function (scope, element, attr, ctrl) {
+ ctrl.setOptions(scope.option,
+ scope.fromtime,
+ scope.totime,
+ scope.preselect,
+ scope.uncheckedFromTime,
+ scope.uncheckedToTime);
+ }
+ };
+}])
+
+.directive('attHourpicker', ["hourpickerConfig", "$document", "$log", "$documentBind", "$timeout", function (hourpickerConfig, $document, $log, $documentBind, $timeout) {
+ return {
+ require: 'ngModel',
+ restrict: 'EA',
+ controller: 'hourPickerController',
+ transclude: true,
+ scope: {
+ model: "=ngModel",
+ resetFlag: "=?"
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/hourpicker/hourpicker.html',
+ link: function (scope, element, attr, ctrl) {
+ var flag = false;
+ scope.isFromDropDownOpen = false;
+ scope.isToDropDownOpen = false;
+ var dropDownOpenValue = "";
+ var custTime = {};
+ scope.days = hourpickerConfig.days;
+ scope.daysList = {};
+ scope.FrtimeList = {};
+ scope.FrtimeListDay = {};
+ scope.TotimeListDay = {};
+ scope.selectedFromOption = {};
+ scope.selectedToOption = {};
+ scope.TotimeList = {};
+ scope.selectedIndex = 0;
+ scope.selectedOption = "Select from list";
+ scope.customTime = [];
+
+ scope.resetFlag = false;
+ scope.showToTimeErrorDay = {};
+ scope.validatedCustomPreselect = [];
+
+ scope.$watch('resetFlag', function (newVal, oldVal) {
+ if (newVal !== oldVal) {
+ if (newVal && scope.selectedOption === hourpickerConfig.customOption) {
+ //disable and reset all days checkbox
+ for (day in scope.daysList) {
+ if (scope.daysList.hasOwnProperty(day)) {
+ scope.daysList[day] = false;
+ scope.addSelectedValue(day);
+ }
+ }
+ scope.preselectUpdateFxn(scope.preselect);
+ }
+ scope.resetFlag = false;
+ }
+ });
+
+ scope.$watch('selCategory', function (value) {
+ if (value) {
+ ctrl.$setViewValue(value);
+ }
+ }, true);
+
+ scope.updateData = function (value) {
+ if (value.constructor === Array) {
+ scope.showDaysSelector = true;
+ scope.selectedOption = hourpickerConfig.customOption;
+ for (var arry in value) {
+ if (value.hasOwnProperty(arry)) {
+ var day = value[arry].day;
+
+ if (typeof value[arry].preEnabled === 'boolean' && value[arry].preEnabled) {
+ scope.daysList[day] = true;
+ } else {
+ scope.daysList[day] = false;
+ }
+
+ for (var fromcount in scope.fromtime) {
+ if (scope.fromtime[fromcount].value === value[arry].FromTime && !scope.uncheckedFromTime) {
+ scope.FrtimeList[day].value = scope.fromtime[fromcount].value;
+ scope.selectedFromOption[day] = scope.FrtimeList[day].value;
+ }
+ }
+ for (var tocount in scope.totime) {
+ if (scope.totime[tocount].value === value[arry].ToTime && !scope.uncheckedToTime) {
+ scope.TotimeList[day].value = scope.totime[tocount].value;
+ scope.selectedToOption[day] = scope.TotimeList[day].value;
+ }
+ }
+
+ scope.addSelectedValue(day, value[arry].FromTime, value[arry].ToTime);
+
+ //for IE8 Fix
+ if (parseInt(arry) + 1 === value.length) {
+ break;
+ }
+ }
+ }
+ } else {
+ scope.selectOption(value.day);
+ }
+ };
+
+ scope.$watch('preselect', function (value) {
+ scope.preselectUpdateFxn(value);
+ });
+
+ scope.preselectUpdateFxn = function (value) {
+ if (value !== undefined) {
+ if (scope.options) {
+ value = scope.validatePreselectData(value);
+ }
+ if (value === "") {
+ return;
+ }
+ scope.updateData(value);
+ }
+ };
+
+ scope.validatePreselectData = function (value) {
+ if (value.constructor === Array) {
+ for (var arry in value) {
+ if (value.hasOwnProperty(arry)) {
+ var day = value[arry].day;
+ var isDayFound = false;
+ var isFrmFound = false;
+ var isToFound = false;
+ for (var daycount in scope.days) {
+ if (scope.days[daycount] === day) {
+ isDayFound = true;
+ break;
+ }
+ }
+ if (!isDayFound) {
+ value.splice(arry, 1);
+ continue;
+ }
+ for (var fromcount in scope.fromtime) {
+ if (scope.fromtime[fromcount].value === value[arry].FromTime) {
+ isFrmFound = true;
+ break;
+ }
+ }
+ if (!isFrmFound) {
+ value[arry].FromTime = scope.fromtime[0].value;
+ }
+ for (var tocount in scope.totime) {
+ if (scope.totime[tocount].value === value[arry].ToTime) {
+ isToFound = true;
+ break;
+ }
+ }
+ if (!isToFound) {
+ value[arry].ToTime = scope.totime[0].value;
+ }
+
+ if (typeof value[arry].preEnabled === 'boolean' && value[arry].preEnabled) {
+ value[arry].preEnabled = true;
+ } else {
+ value[arry].preEnabled = false;
+ }
+
+ scope.validatedCustomPreselect[day] = {};
+ scope.validatedCustomPreselect[day].FromTime = value[arry].FromTime;
+ scope.validatedCustomPreselect[day].ToTime = value[arry].ToTime;
+
+ //for IE8 Fix
+ if (parseInt(arry) + 1 === value.length) {
+ break;
+ }
+ }
+ }
+ } else {
+ var isOptionFound = false;
+ for (var optcount in scope.options) {
+ if (scope.options[optcount] === value.day) {
+ isOptionFound = true;
+ break;
+ }
+ }
+ if (!isOptionFound) {
+ value = "";
+ }
+ }
+ return value;
+ };
+
+ scope.selectPrevNextValue = function ($event, arrayValues, currValue) {
+
+ var value;
+ var index = 0;
+ if ($event.keyCode === 38) {
+ value = -1;
+ } else if ($event.keyCode === 40) {
+ value = 1;
+ } else {
+ return currValue;
+ }
+
+ if (arrayValues.indexOf(currValue) !== -1) {
+ index = arrayValues.indexOf(currValue) + value;
+ } else {
+ for (var count in arrayValues) {
+ if (arrayValues[count].value === currValue) {
+ index = parseInt(count) + value;
+ break;
+ }
+ }
+ }
+
+ if (index === arrayValues.length) {
+ index = index - 1;
+ } else if (index === -1) {
+ index = index + 1;
+ }
+
+ $event.preventDefault();
+ if (arrayValues[index].value) {
+ return arrayValues[index].value;
+ } else {
+ return arrayValues[index];
+ }
+ };
+
+ scope.showDropdown = function () {
+ scope.showlist = !scope.showlist;
+ flag = !flag;
+ };
+
+ scope.showfromDayDropdown = function (value) {
+ //close dropdown if any other From drop down is opened
+ for (count in scope.FrtimeListDay) {
+ if (count !== value && scope.FrtimeListDay[count]) {
+ scope.FrtimeListDay[count] = false;
+ }
+ }
+ for (count in scope.TotimeListDay) {
+ if (scope.TotimeListDay[count]) {
+ scope.TotimeListDay[count] = false;
+ }
+ }
+ scope.FrtimeListDay[value] = !scope.FrtimeListDay[value];
+ flag = !flag;
+ scope.showlist = false;
+
+ //save model value so we can close current dropdown on click of other part of the document
+ if (scope.FrtimeListDay[value]) {
+ scope.isFromDropDownOpen = true;
+ dropDownOpenValue = value;
+ } else {
+ scope.isFromDropDownOpen = false;
+ }
+
+ $timeout(function () {
+ if (scope.FrtimeListDay[value]) {
+ var daysContainerDIV = angular.element(element)[0].querySelector(".customdays-width");
+ var containerUL = angular.element(daysContainerDIV.querySelector('.select2-container-active')).parent()[0].querySelector("ul");
+ var selectedElemTopPos = angular.element(containerUL.querySelector('.selectedItemInDropDown'))[0].offsetTop;
+ angular.element(containerUL)[0].scrollTop = selectedElemTopPos;
+ }
+ });
+ };
+
+ scope.showtoDayDropdown = function (value) {
+ //close dropdown if any other To drop down is opened
+ for (count in scope.TotimeListDay) {
+ if (count !== value && scope.TotimeListDay[count]) {
+ scope.TotimeListDay[count] = false;
+ }
+ }
+ for (count in scope.FrtimeListDay) {
+ if (scope.FrtimeListDay[count]) {
+ scope.FrtimeListDay[count] = false;
+ }
+ }
+ scope.TotimeListDay[value] = !scope.TotimeListDay[value];
+ flag = !flag;
+ scope.showlist = false;
+
+ //save model value so we can close current dropdown on click of other part of the document
+ if (scope.TotimeListDay[value]) {
+ scope.isToDropDownOpen = true;
+ dropDownOpenValue = value;
+
+ } else {
+ scope.isToDropDownOpen = false;
+ }
+
+ $timeout(function () {
+ if (scope.TotimeListDay[value]) {
+ var daysContainerDIV = angular.element(element)[0].querySelector(".customdays-width");
+ var containerUL = angular.element(daysContainerDIV.querySelector('.select2-container-active')).parent()[0].querySelector("ul");
+ var selectedElemTopPos = angular.element(containerUL.querySelector('.selectedItemInDropDown'))[0].offsetTop;
+ angular.element(containerUL)[0].scrollTop = selectedElemTopPos;
+ }
+ });
+ };
+
+ scope.selectFromDayOption = function (day, value) {
+ scope.selectedFromOption[day] = value;
+ scope.FrtimeList[day].value = value;
+ scope.FrtimeListDay[day] = false;
+ scope.isFromDropDownOpen = false;
+ };
+
+ scope.selectToDayOption = function (day, value) {
+ scope.selectedToOption[day] = value;
+ scope.TotimeList[day].value = value;
+ scope.TotimeListDay[day] = false;
+ scope.isToDropDownOpen = false;
+ };
+
+ scope.addSelectedValue = function (value, fromtime, totime) {
+ var count, len;
+ if (scope.daysList[value] !== undefined && !scope.daysList[value]) {
+ for (count = 0, len = scope.customTime.length; count < len; count++) {
+ if (scope.customTime[count].day === value) {
+ if (scope.uncheckedFromTime) {
+ scope.selectedFromOption[scope.customTime[count].day] = scope.uncheckedFromTime;
+ } else {
+ scope.selectedFromOption[scope.customTime[count].day] = scope.FrtimeList[scope.customTime[count].day].value;
+ }
+
+ if (scope.uncheckedToTime) {
+ scope.selectedToOption[scope.customTime[count].day] = scope.uncheckedToTime;
+ } else {
+ scope.selectedToOption[scope.customTime[count].day] = scope.TotimeList[scope.customTime[count].day].value;
+ }
+
+ scope.customTime.splice(count, 1);
+ break;
+ }
+ }
+ } else {
+ if (scope.selectedFromOption[value] === scope.uncheckedFromTime) {
+
+ if (angular.isDefined(scope.validatedCustomPreselect[value])) {
+ scope.selectedFromOption[value] = scope.validatedCustomPreselect[value].FromTime;
+ fromtime = scope.validatedCustomPreselect[value].FromTime;
+ scope.FrtimeList[value].value = scope.validatedCustomPreselect[value].FromTime;
+ } else {
+ scope.selectedFromOption[value] = scope.fromtime[0].value;
+ fromtime = scope.fromtime[0].value;
+ scope.FrtimeList[value].value = scope.fromtime[0].value;
+ }
+
+ }
+
+ if (scope.selectedToOption[value] === scope.uncheckedToTime) {
+
+ if (angular.isDefined(scope.validatedCustomPreselect[value])) {
+ scope.selectedToOption[value] = scope.validatedCustomPreselect[value].ToTime;
+ totime = scope.validatedCustomPreselect[value].ToTime;
+ scope.TotimeList[value].value = scope.validatedCustomPreselect[value].ToTime;
+ } else {
+ scope.selectedToOption[value] = scope.totime[0].value;
+ totime = scope.totime[0].value;
+ scope.TotimeList[value].value = scope.totime[0].value;
+ }
+ }
+
+ custTime["day"] = value;
+ custTime["FromTime"] = scope.FrtimeList[value].value;
+ custTime["ToTime"] = scope.TotimeList[value].value;
+
+ for (count = 0, len = scope.customTime.length; count < len; count++) {
+ if (scope.customTime[count].day === value) {
+ scope.customTime[count].FromTime = custTime["FromTime"];
+ scope.customTime[count].ToTime = custTime["ToTime"];
+ break;
+ }
+ }
+ if (count === len) {
+ var x = angular.copy(custTime);
+ scope.customTime.push(x);
+ }
+ }
+ scope.selCategory = scope.customTime;
+ };
+
+
+ var outsideClick = function () {
+ if (scope.showlist) {
+ scope.$apply(function () {
+ scope.showlist = false;
+ });
+ }
+ };
+
+ $documentBind.click('showlist', outsideClick, scope);
+
+ var outsideClickFromDropdown = function () {
+ scope.$apply(function () {
+ if (scope.isFromDropDownOpen) {
+ scope.FrtimeListDay[dropDownOpenValue] = false;
+ scope.isFromDropDownOpen = false;
+ }
+ });
+ };
+
+ $documentBind.click('isFromDropDownOpen', outsideClickFromDropdown, scope);
+
+ var outsideClickToDropdown = function () {
+ scope.$apply(function () {
+ if (scope.isToDropDownOpen) {
+ scope.TotimeListDay[dropDownOpenValue] = false;
+ scope.isToDropDownOpen = false;
+ }
+ });
+ };
+
+ $documentBind.click('isToDropDownOpen', outsideClickToDropdown, scope);
+
+ scope.selectOption = function (sItem) {
+
+ if (sItem === hourpickerConfig.customOption) {
+ scope.showDaysSelector = true;
+ scope.selCategory = scope.customTime;
+ } else {
+ scope.showDaysSelector = false;
+ var fromTime = /[0-9]\s?am/i.exec(sItem);
+ var toTime = /[0-9]\s?pm/i.exec(sItem);
+ scope.selCategory = {
+ day: sItem,
+ FromTime: fromTime === null ? 'NA' : fromTime[0],
+ ToTime: toTime === null ? 'NA' : toTime[0]
+ };
+ }
+
+ scope.showlist = false;
+ flag = false;
+ scope.selectedOption = sItem;
+ };
+ }
+ };
+}])
+
+.directive('attHourpickerValidator', ['hourpickerConfig', function (hourpickerConfig) {
+ return {
+ restrict: 'A',
+ require: ['attHourpicker', 'ngModel'],
+ link: function (scope, element, attr, ctrl) {
+
+ var attHourpickerCtrl = ctrl[0];
+ var ngModelCtrl = ctrl[1];
+
+ //required format [h:MM tt] like '1:10 PM'
+ var convertTimeStrngToMilitaryFormat = function (time) {
+ var hours = Number(time.match(/^(\d+)/)[1]);
+ var minutes = Number(time.match(/:(\d+)/)[1]);
+ var AMPM = (time.match(/\s(.*)$/)[1]).toUpperCase();
+ if (AMPM === 'PM' && hours < 12) {
+ hours = hours + 12;
+ }
+ if (AMPM === 'AM' && hours === 12) {
+ hours = hours - 12;
+ }
+ var sHours = hours.toString();
+ var sMinutes = minutes.toString();
+ if (hours < 10) {
+ sHours = '0' + sHours;
+ }
+ if (minutes < 10) {
+ sMinutes = '0' + sMinutes;
+ }
+ return parseInt(sHours + sMinutes, 10);
+ };
+
+ var compareTimeStrings = function (fromTimeString, toTimeString) {
+ var fromMilitaryTime = convertTimeStrngToMilitaryFormat(fromTimeString);
+ var toMilitaryTime = convertTimeStrngToMilitaryFormat(toTimeString);
+ return (toMilitaryTime - fromMilitaryTime);
+ };
+
+ var validateCustomData = function (finalDataModal) {
+
+ if (attHourpickerCtrl.getSelectedOption() === hourpickerConfig.customOption) {
+
+ var errorDaysCount = 0;
+
+ for (var item in finalDataModal) {
+ if (finalDataModal.hasOwnProperty(item)) {
+ if (compareTimeStrings(finalDataModal[item].FromTime, finalDataModal[item].ToTime) <= 0) {
+ attHourpickerCtrl.setToTimeErrorDay(finalDataModal[item].day, true);
+ errorDaysCount++;
+ } else {
+ attHourpickerCtrl.setToTimeErrorDay(finalDataModal[item].day, false);
+ }
+ }
+ }
+
+ if (errorDaysCount > 0) {
+ //validation error
+ ngModelCtrl.$setValidity('validationStatus', false);
+ return [];
+ } else {
+ //validation successful
+ ngModelCtrl.$setValidity('validationStatus', true);
+ return finalDataModal;
+ }
+ } else {
+ //default case no validation
+ ngModelCtrl.$setValidity('validationStatus', true);
+ return finalDataModal;
+ }
+
+ };
+
+ ngModelCtrl.$parsers.unshift(validateCustomData);
+ }
+ };
+}]);
+angular.module('att.abs.iconButtons', [])
+ .constant('buttonConfig', {
+ activeClass: 'active--button',
+ toggleEvent: 'click'
+ })
+ .directive('attIconBtnRadio', ['buttonConfig', function(buttonConfig) {
+ var activeClass = buttonConfig.activeClass || 'active--button';
+ var toggleEvent = buttonConfig.toggleEvent || 'click';
+ return {
+ require: 'ngModel',
+ link: function(scope, element, attrs, ngModelCtrl) {
+ element.attr("tabindex","0");
+ element.append("<span class='hidden-spoken'>"+attrs.attIconBtnRadio+"</span>");
+ //model -> UI
+ ngModelCtrl.$render = function() {
+ element.parent().toggleClass(activeClass, angular.equals(ngModelCtrl.$modelValue, attrs.attIconBtnRadio));
+ };
+ //ui->model
+ element.parent().bind(toggleEvent, function() {
+ if (!element.parent().hasClass(activeClass)) {
+ scope.$apply(function() {
+ ngModelCtrl.$setViewValue(attrs.attIconBtnRadio);
+ ngModelCtrl.$render();
+ });
+ }
+ });
+ }
+ };
+ }])
+ .directive('attIconBtnCheckbox', ['buttonConfig', function(buttonConfig) {
+ var activeClass = buttonConfig.activeClass || 'active--button';
+ var toggleEvent = buttonConfig.toggleEvent || 'click';
+ return {
+ require: 'ngModel',
+ link: function(scope, element, attrs, ngModelCtrl) {
+ element.attr("tabindex","0");
+ element.append("<span class='hidden-spoken'>"+attrs.attIconBtnCheckbox+"</span>");
+ function getTrueValue() {
+ var trueValue = scope.$eval(attrs.btnCheckboxTrue);
+ return angular.isDefined(trueValue) ? trueValue : true;
+ }
+ function getFalseValue() {
+ var falseValue = scope.$eval(attrs.btnCheckboxFalse);
+ return angular.isDefined(falseValue) ? falseValue : false;
+ }
+ //model -> UI
+ ngModelCtrl.$render = function() {
+ element.parent().toggleClass(activeClass, angular.equals(ngModelCtrl.$modelValue, getTrueValue()));
+ };
+ //ui->model
+ element.parent().bind(toggleEvent, function() {
+ scope.$apply(function() {
+ ngModelCtrl.$setViewValue(element.parent().hasClass(activeClass) ? getFalseValue() : getTrueValue());
+ ngModelCtrl.$render();
+ });
+ });
+ }
+ };
+ }]);
+
+angular.module('att.abs.links', ['ngSanitize'])
+ .directive('attLink', [function() {
+ return {
+ restrict: 'A',
+ link: function(scope, elem) {
+ elem.addClass('link');
+ if(!(elem.attr('href'))){
+ elem.attr("tabindex", "0");
+ }
+ }
+ };
+ }])
+ .directive('attLinkVisited', [function() {
+ return {
+ restrict: 'A',
+ link: function(scope, elem) {
+ elem.addClass('link--visited');
+ if(!(elem.attr('href'))){
+ elem.attr("tabindex", "0");
+ }
+ }
+ };
+ }])
+ .directive('attReadmore', ['$timeout',function($timeout) {
+ return {
+ restrict: 'A',
+ scope: {
+ lines:"@noOfLines",
+ textModel: "=",
+ //attribute to use readmore inside accordion
+ isOpen: "="
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/links/readMore.html',
+ link: function(scope, elem) {
+ var height = 1;
+ scope.$watch('textModel', function(val){
+ if(!val){
+ scope.textToDisplay = '';
+ scope.readMoreLink = false;
+ scope.readLessLink = false;
+ scope.readFlag = false;
+ }
+ else{
+ if (typeof String.prototype.trim !== 'function') {
+ String.prototype.trim = function() {
+ return this.replace(/^\s+|\s+$/g, '');
+ };
+ }
+ scope.textToDisplay = val.trim();
+ scope.readFlag = true;
+ $timeout(function() {
+ var readElem = elem[0].children[0].children[0];
+ if(height===1){
+ if(window.getComputedStyle){
+ height = parseInt(scope.lines) * parseFloat(window.getComputedStyle(readElem,null).getPropertyValue("height"));
+ }
+ else {
+ height = parseInt(scope.lines) * parseFloat(readElem.currentStyle.height);
+ }
+ scope.elemHeight = height;
+ scope.readLinkStyle = {'height': scope.elemHeight + 'px'};
+ }
+ });
+ scope.readMoreLink = true;
+ scope.readLessLink = false;
+ }
+ });
+ // Code to use readmore inside accordion
+ var parentElem = elem.parent();
+ if (parentElem.hasClass('att-accordion__body')) {
+ scope.$watch('isOpen', function(val) {
+ if (!val) {
+ scope.readMoreLink = true;
+ scope.readLessLink = false;
+ scope.readLinkStyle = {'height': scope.elemHeight + 'px'};
+ scope.readFlag = true;
+ }
+ });
+ }
+ scope.readMore = function() {
+ scope.readMoreLink = false;
+ scope.readLessLink = true;
+ scope.readLinkStyle = {'height': 'auto'};
+ scope.readFlag = false;
+ var moreLink = angular.element(elem).children().eq(1).find('a')[0];
+ $timeout(function()
+ {
+ moreLink.focus();
+ });
+ };
+ scope.readLess = function() {
+ scope.readMoreLink = true;
+ scope.readLessLink = false;
+ scope.readLinkStyle = {'height': scope.elemHeight + 'px'};
+ scope.readFlag = true;
+ var readLessLink = angular.element(elem).children().eq(0).find('a')[0];
+ $timeout(function()
+ {
+ readLessLink.focus();
+ });
+ };
+ }
+ };
+ }])
+ .directive('attLinksList', [function() {
+ return {
+ restrict: 'A',
+ controller: function() {
+ },
+ link: function(scope, elem) {
+ elem.addClass('links-list');
+ }
+ };
+ }])
+ .directive('attLinksListItem', [function() {
+ return {
+ restrict: 'A',
+ require: '^attLinksList',
+ link: function(scope, elem) {
+ elem.addClass('links-list__item');
+ if(!(elem.attr('href'))){
+ elem.attr("tabindex", "0");
+ }
+ }
+ };
+ }]);
+angular.module('att.abs.loading', [])
+ .directive('attLoading', ['$window',function($window) {
+ return {
+ restrict: 'A',
+ replace: true,
+ scope: {
+ icon: '@attLoading',
+ progressStatus: '=?',
+ colorClass: '=?'
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/loading/loading.html',
+ link: function(scope, element) {
+ var progressvalue = scope.progressStatus;
+ scope.progressStatus = Math.min(100, Math.max(0, progressvalue));
+ if($window.navigator.userAgent.indexOf("MSIE 8.")!==-1){
+ var shiftX = 0, shiftY = scope.progressStatus * 36;
+ element.css({
+ 'background-position-x' : shiftX,
+ 'background-position-y' : -shiftY
+ });
+ }
+ }
+ };
+ }]);
+angular.module('att.abs.modal', ['att.abs.utilities'])
+/**
+ * A helper, internal data structure that acts as a map but also allows getting / removing
+ * elements in the LIFO order
+ */
+ .factory('$$stackedMap', function () {
+ return {
+ createNew: function () {
+ var stack = [];
+
+ return {
+ add: function (key, value) {
+ stack.push({
+ key: key,
+ value: value
+ });
+ },
+ get: function (key) {
+ for (var i = 0; i < stack.length; i++) {
+ if (key === stack[i].key) {
+ return stack[i];
+ }
+ }
+ },
+ keys: function() {
+ var keys = [];
+ for (var i = 0; i < stack.length; i++) {
+ keys.push(stack[i].key);
+ }
+ return keys;
+ },
+ top: function () {
+ return stack[stack.length - 1];
+ },
+ remove: function (key) {
+ var idx = -1;
+ for (var i = 0; i < stack.length; i++) {
+ if (key === stack[i].key) {
+ idx = i;
+ break;
+ }
+ }
+ return stack.splice(idx, 1)[0];
+ },
+ removeTop: function () {
+ return stack.splice(stack.length - 1, 1)[0];
+ },
+ length: function () {
+ return stack.length;
+ }
+ };
+ }
+ };
+ })
+
+/**
+ * A helper directive for the $modal service. It creates a backdrop element.
+ */
+ .directive('modalBackdrop', ['$timeout', function ($timeout) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/modal/backdrop.html',
+ link: function (scope) {
+ scope.animate = false;
+ //trigger CSS transitions
+ $timeout(function () {
+ scope.animate = true;
+ });
+ }
+ };
+ }])
+
+ .directive('modalWindow', ['$modalStack','$timeout','$document', function ($modalStack,$timeout,$document) {
+ return {
+ restrict: 'EA',
+ scope: {
+ index: '@',
+ modalTitle: '@?'
+ },
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/modal/window.html',
+ link: function (scope, element, attrs) {
+ scope.windowClass = attrs.windowClass || '';
+ if (attrs['modalTitle'] && attrs['modalTitle']!=="") {
+ element[0].setAttribute('aria-label', attrs['modalTitle']);
+ element[0].removeAttribute('modal-title');
+ }
+ $timeout(function () {
+ // trigger CSS transitions
+ scope.focusModalFlag = true;
+ scope.animate = true;
+ });
+ $document.on('focus keydown', function(e){
+ if (e.which ===9) {
+ String.prototype.contains = function(it) {
+ return this.indexOf(it) !== -1;
+ };
+ if (element[0] !== e.target && !element[0].contains( e.target )) {
+ element[0].focus();
+ }
+ }
+ });
+ scope.close = function (evt) {
+ var modal = $modalStack.getTop();
+ if (modal && modal.value.backdrop && modal.value.backdrop != 'static' && (evt.target === evt.currentTarget)) {
+ // Check if preventDefault exists due to lack of support for IE8
+ if (evt.preventDefault) {
+ evt.preventDefault();
+ evt.stopPropagation();
+ } else {
+ evt.returnValue = false;
+ }
+ $modalStack.dismiss(modal.key, 'backdrop click');
+ }
+ };
+ }
+ };
+ }])
+
+ .factory('$modalStack', ['$document', '$compile', '$rootScope', '$$stackedMap', 'events', 'keymap',
+ function ($document, $compile, $rootScope, $$stackedMap, events, keymap) {
+ var OPENED_MODAL_CLASS = 'modal-open';
+ var backdropjqLiteEl, backdropDomEl;
+ var backdropScope = $rootScope.$new(true);
+ var openedWindows = $$stackedMap.createNew();
+ var $modalStack = {};
+ var modalLaunchingElement = undefined;
+ function backdropIndex() {
+ var topBackdropIndex = -1;
+ var opened = openedWindows.keys();
+ for (var i = 0; i < opened.length; i++) {
+ if (openedWindows.get(opened[i]).value.backdrop) {
+ topBackdropIndex = i;
+ }
+ }
+ return topBackdropIndex;
+ }
+
+ $rootScope.$watch(backdropIndex, function(newBackdropIndex){
+ backdropScope.index = newBackdropIndex;
+ });
+
+ function removeModalWindow(modalInstance) {
+
+ var body = $document.find('body').eq(0);
+ var html = $document.find('html').eq(0);
+ var modalWindow = openedWindows.get(modalInstance).value;
+ //clean up the stack
+ openedWindows.remove(modalInstance);
+ ////remove window DOM element
+ modalWindow.modalDomEl.remove();
+ body.toggleClass(OPENED_MODAL_CLASS, openedWindows.length() > 0);
+ html.css({overflow: 'scroll'});
+
+ //remove backdrop if no longer needed
+ if (backdropDomEl && backdropIndex() == -1) {
+ backdropDomEl.remove();
+ backdropDomEl = undefined;
+ }
+ //destroy scope
+ modalWindow.modalScope.$destroy();
+
+ // Shift focus
+ if (angular.isDefined(modalLaunchingElement) && modalLaunchingElement != null) {
+ modalLaunchingElement.focus();
+ }
+ }
+ $document.bind('keydown', function (evt) {
+ var modal;
+ if (evt.which === 27) {
+ modal = openedWindows.top();
+ if (modal && modal.value.keyboard) {
+ $rootScope.$apply(function () {
+ $modalStack.dismiss(modal.key);
+ });
+ }
+ } else if (evt.keyCode === keymap.KEY.BACKSPACE) {
+ var doPrevent = false;
+ var d = evt.srcElement || evt.target;
+ var type;
+ if (d.type === undefined) {
+ doPrevent = true;
+ } else if (d.tagName.toUpperCase() === 'INPUT' &&
+ ( (type = d.type.toUpperCase()) === 'TEXT' ||
+ type === 'PASSWORD' ||
+ type === 'FILE' ||
+ type === 'SEARCH' ||
+ type === 'EMAIL' ||
+ type === 'NUMBER' ||
+ type === 'DATE' ||
+ type === 'TEL' ||
+ type === 'URL' ||
+ type === 'TIME')
+ || d.tagName.toUpperCase() === 'TEXTAREA') {
+ doPrevent = d.readOnly || d.disabled;
+ } else {
+ doPrevent = true;
+ }
+ if (doPrevent) {
+ events.preventDefault(evt);
+ }
+ }
+ });
+
+ $modalStack.open = function (modalInstance, modal) {
+ openedWindows.add(modalInstance, {
+ deferred: modal.deferred,
+ modalScope: modal.scope,
+ backdrop: modal.backdrop,
+ keyboard: modal.keyboard
+ });
+
+ //Before opening modal, find the focused element
+ modalLaunchingElement = document.activeElement;
+
+ var body = $document.find('body').eq(0);
+ var html = $document.find('html').eq(0);
+
+ if (backdropIndex() >= 0 && !backdropDomEl) {
+ backdropjqLiteEl = angular.element('<div modal-backdrop></div>');
+ backdropDomEl = $compile(backdropjqLiteEl)(backdropScope);
+ body.append(backdropDomEl);
+ }
+ var angularDomEl = angular.element('<div modal-window></div>');
+ angularDomEl.attr('window-class', modal.windowClass);
+ angularDomEl.attr('index', openedWindows.length() - 1);
+ angularDomEl.attr('modal-title', modal.modalTitle);
+ angularDomEl.html(modal.content);
+
+ var modalDomEl = $compile(angularDomEl)(modal.scope);
+ openedWindows.top().value.modalDomEl = modalDomEl;
+ body.append(modalDomEl);
+ body.addClass(OPENED_MODAL_CLASS);
+ html.css({overflow: 'hidden'});
+ };
+
+ $modalStack.close = function (modalInstance, result) {
+ var modal = openedWindows.get(modalInstance);
+ if (modal) {
+ modal.value.deferred.resolve(result);
+ removeModalWindow(modalInstance);
+ }
+ };
+
+ $modalStack.dismiss = function (modalInstance, reason) {
+ var modalWindow = openedWindows.get(modalInstance).value;
+ if (modalWindow) {
+ modalWindow.deferred.reject(reason);
+ removeModalWindow(modalInstance);
+ }
+ };
+
+ $modalStack.getTop = function () {
+ return openedWindows.top();
+ };
+
+ return $modalStack;
+ }])
+
+ .provider('$modal', function () {
+
+ var $modalProvider = {
+ options: {
+ //can be also false or 'static'
+ backdrop: true,
+ keyboard: true
+ },
+ $get: ['$injector', '$rootScope', '$q', '$http', '$templateCache', '$controller', '$modalStack',
+ function ($injector, $rootScope, $q, $http, $templateCache, $controller, $modalStack) {
+ var $modal = {};
+ function getTemplatePromise(options) {
+ return options.template ? $q.when(options.template) :
+ $http.get(options.templateUrl, {cache: $templateCache}).then(function (result) {
+ return result.data;
+ });
+ }
+
+ function getResolvePromises(resolves) {
+ var promisesArr = [];
+ angular.forEach(resolves, function (value) {
+ if (angular.isFunction(value) || angular.isArray(value)) {
+ promisesArr.push($q.when($injector.invoke(value)));
+ }
+ });
+ return promisesArr;
+ }
+ $modal.open = function (modalOptions) {
+ var modalResultDeferred = $q.defer();
+ var modalOpenedDeferred = $q.defer();
+
+ //prepare an instance of a modal to be injected into controllers and returned to a caller
+ var modalInstance = {
+ result: modalResultDeferred.promise,
+ opened: modalOpenedDeferred.promise,
+ close: function (result) {
+ $modalStack.close(modalInstance, result);
+ },
+ dismiss: function (reason) {
+ $modalStack.dismiss(modalInstance, reason);
+ }
+ };
+ //merge and clean up options
+ modalOptions = angular.extend({}, $modalProvider.options, modalOptions);
+ modalOptions.resolve = modalOptions.resolve || {};
+
+ //verify options
+ if (!modalOptions.template && !modalOptions.templateUrl) {
+ throw new Error('One of template or templateUrl options is required.');
+ }
+
+ var templateAndResolvePromise =
+ $q.all([getTemplatePromise(modalOptions)].concat(getResolvePromises(modalOptions.resolve)));
+ templateAndResolvePromise.then(function(tplAndVars) {
+ var modalScope = (modalOptions.scope || $rootScope).$new();
+ modalScope.$close = modalInstance.close;
+ modalScope.$dismiss = modalInstance.dismiss;
+
+ var ctrlInstance, ctrlLocals = {};
+ var resolveIter = 1;
+
+ //controllers
+ if (modalOptions.controller) {
+ ctrlLocals.$scope = modalScope;
+ ctrlLocals.$modalInstance = modalInstance;
+ angular.forEach(modalOptions.resolve, function (value, key) {
+ ctrlLocals[key] = tplAndVars[resolveIter++];
+ });
+
+ ctrlInstance = $controller(modalOptions.controller, ctrlLocals);
+ }
+
+ $modalStack.open(modalInstance, {
+ scope: modalScope,
+ deferred: modalResultDeferred,
+ content: tplAndVars[0],
+ backdrop: modalOptions.backdrop,
+ keyboard: modalOptions.keyboard,
+ windowClass: modalOptions.windowClass,
+ modalTitle: modalOptions.modalTitle
+ });
+
+ }, function(reason) {
+ modalResultDeferred.reject(reason);
+ });
+
+ templateAndResolvePromise.then(function () {
+ modalOpenedDeferred.resolve(true);
+ }, function () {
+ modalOpenedDeferred.reject(false);
+ });
+
+ return modalInstance;
+ };
+
+ return $modal;
+ }]
+ };
+
+ return $modalProvider;
+ })
+
+.directive("simpleModal", ["$modal", function($modal) {
+ return {
+ restrict: 'EA',
+ scope: {
+ simpleModal: '@',
+ backdrop:'@',
+ keyboard:'@',
+ modalOk:'&',
+ modalCancel:'&',
+ windowClass:'@',
+ controller:'@',
+ modalTitle: '@?'
+ },
+ link: function(scope, elm) {
+ elm.bind('click', function(ev) {
+ ev.preventDefault();
+ if (angular.isDefined(elm.attr("href")) && elm.attr("href") !== "") {
+ scope.simpleModal = elm.attr("href");
+ }
+
+ scope.backdrop === "false" ? scope.backdropclick = 'static' : scope.backdropclick = true;
+ scope.keyboard === "false" ? scope.keyboardev = false : scope.keyboardev = true;
+
+ $modal.open({
+ templateUrl: scope.simpleModal,
+ backdrop:scope.backdropclick,
+ keyboard:scope.keyboardev,
+ windowClass:scope.windowClass,
+ controller: scope.controller,
+ modalTitle: scope.modalTitle
+ }).result.then(scope.modalOk, scope.modalCancel);
+ });
+ }
+ };
+ }])
+
+.directive('tabbedItem', ['$modal', '$log',function ($modal, $log){
+ return {
+ restrict: 'AE',
+ replace: true,
+ scope: {
+ items: "=items",
+ controller: "@",
+ templateId:"@",
+ modalTitle: '@?'
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/modal/tabbedItem.html',
+ controller: ['$scope', '$rootScope', '$attrs', function ($scope) {
+ $scope.clickTab = function (index) {
+ for (var i = 0; i < $scope.items.length; i++) {
+ if (i === index) {
+ $scope.items[i].isTabOpen = true;
+ $scope.items[i].showData = true;
+ }
+ else {
+ $scope.items[i].isTabOpen = false;
+ $scope.items[i].showData = false;
+ }
+ }
+ var modalInstance = $modal.open({
+ templateUrl: $scope.templateId,
+ controller: $scope.controller,
+ windowClass: 'tabbedOverlay_modal',
+ modalTitle: $scope.modalTitle,
+ resolve: {
+ items: function () {
+ return $scope.items;
+ }
+ }
+ });
+ modalInstance.result.then(function (selectedItem) {
+ $scope.selected = selectedItem;
+ }, function () {
+ $log.info('Modal dismissed at: ' + new Date());
+ });
+ };
+ $scope.isActiveTab = function (index) {
+ return $scope.items && $scope.items[index] && $scope.items[index].isTabOpen;
+ };
+ }]
+ };
+}])
+
+.directive('tabbedOverlay', [function () {
+ return {
+ restrict: 'AE',
+ replace: true,
+ scope: {
+ items: "="
+ },
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/modal/tabbedOverlayItem.html',
+ controller: ['$scope', function ($scope) {
+ $scope.clickTab = function (index) {
+ for (var i = 0; i < $scope.items.length; i++) {
+ if (i === index) {
+ $scope.items[i].isTabOpen = true;
+ $scope.items[i].showData = true;
+ }
+ else {
+ $scope.items[i].isTabOpen = false;
+ $scope.items[i].showData = false;
+ }
+ }
+ };
+ $scope.isActiveTab = function (index) {
+ return $scope.items && $scope.items[index] && $scope.items[index].isTabOpen;
+ };
+ }]
+ };
+}]);
+angular.module('att.abs.pagination', ['att.abs.utilities'])
+.directive('attPagination', [ function() {
+ return {
+ restrict: 'EA',
+ scope: {
+ totalPages: '=',
+ currentPage: '=',
+ showInput: '=',
+ clickHandler: '=?'
+ },
+ replace: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/pagination/pagination.html',
+ link: function(scope) {
+ scope.focusedPage;
+ scope.$watch('totalPages', function(value) {
+ if(angular.isDefined(value) && value !== null){
+ scope.pages = [];
+ if (value < 1) {
+ scope.totalPages = 1;
+ return;
+ }
+ if (value <= 7) {
+ for (var i = 1; i <= value; i++) {
+ scope.pages.push(i);
+ }
+ } else if (value > 7) {
+ var midVal = Math.ceil(value / 2);
+ scope.pages = [midVal - 1, midVal, midVal + 1];
+ }
+ currentPageChanged(1);
+ }
+ });
+ scope.$watch('currentPage', function(value) {
+ currentPageChanged(value);
+ });
+ var callbackHandler = function(num) {
+ if (angular.isFunction(scope.clickHandler)){
+ scope.clickHandler(num);
+ }
+ };
+ function currentPageChanged(value) {
+ if (angular.isDefined(value) && value !== null) {
+ if (!value || value < 1) {
+ value = 1;
+ }
+ if (value > scope.totalPages) {
+ value = scope.totalPages;
+ }
+ if(scope.currentPage !== value) {
+ scope.currentPage = value;
+ callbackHandler(scope.currentPage);
+ }
+ if (scope.totalPages > 7) {
+ if (value < scope.pages[0] && value > 3) {
+ scope.pages = [value, value + 1, value + 2];
+ } else if (value > scope.pages[2] && value < scope.totalPages - 2) {
+ scope.pages = [value - 2, value - 1, value];
+ } else if (value <= 3) {
+ scope.pages = [1, 2, 3];
+ } else if (value >= scope.totalPages - 2) {
+ scope.pages = [scope.totalPages - 2, scope.totalPages - 1, scope.totalPages];
+ }
+ }
+ }
+ }
+ scope.next = function(event) {
+ event.preventDefault();
+ if (scope.currentPage < scope.totalPages) {
+ scope.currentPage += 1;
+ callbackHandler(scope.currentPage);
+ }
+ };
+ scope.prev = function(event) {
+ event.preventDefault();
+ if (scope.currentPage > 1) {
+ scope.currentPage -= 1;
+ callbackHandler(scope.currentPage);
+ }
+ };
+ scope.selectPage = function(value, event) {
+ event.preventDefault();
+ scope.currentPage = value;
+ scope.focusedPage = value;
+ callbackHandler(scope.currentPage);
+ };
+ scope.checkSelectedPage = function(value) {
+ if(scope.currentPage === value) {
+ return true;
+ }
+ return false;
+ };
+ scope.isFocused = function(page) {
+ return scope.focusedPage === page;
+ };
+ }
+ };
+}]);
+
+angular.module('att.abs.paneSelector',['att.abs.utilities'])
+.constant('paneGroupConstants',{
+ SIDE_WIDTH_DEFAULT: '33%',
+ INNER_PANE_DEFAULT: '67%',
+ SIDE_PANE_ID: 'sidePane',
+ NO_DRILL_DOWN: 'none'
+})
+.factory('animation', function(){
+ return TweenLite;
+}).directive('attPaneAccessibility',['keymap','$window',function(keymap,$window) {
+ return{
+ restrict: 'A',
+ require: ['^?sidePane','^?innerPane'],
+ link: function (scope, elem,attr,ctrl) {
+ var sidepaneCtrl = ctrl[0],innerPaneCtrl = ctrl[1],ieFlag=false;
+ scope.ie = (function () {
+ var undef,v = 3,div = document.createElement('div'),
+ all = div.getElementsByTagName('i');
+ while (
+ div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i>< ![endif]-->',
+ all[0]
+ );
+ return v > 4 ? v : undef;
+ }());
+ if(scope.ie === 8){
+ ieFlag = true;
+ }
+ else{
+ ieFlag = false;
+ }
+ elem.bind('keydown',function(ev){
+ if (keymap.isAllowedKey(ev.keyCode) || keymap.isControl(ev) || keymap.isFunctionKey(ev)) {
+ ev.preventDefault();
+ ev.stopPropagation();
+ var el;
+ switch (ev.keyCode) {
+ case keymap.KEY.DOWN:
+ el = angular.element(elem[0])[0];
+ if(el && el.nextElementSibling){
+ el.nextElementSibling.focus();
+ }
+ /*IE8 fix*/
+ if(ieFlag){
+ do {
+ if (el && el.nextSibling){
+ el = el.nextSibling;
+ }
+ else{
+ break;
+ }
+ } while (el && el.tagName !== 'DIV');
+ el.focus();
+ }
+ break;
+ case keymap.KEY.UP:
+ el = angular.element(elem[0])[0];
+ if(el && el.previousElementSibling){
+ el.previousElementSibling.focus();
+ }
+ /*IE8 fix*/
+ if(ieFlag){
+ do {
+ if (el && el.previousSibling){
+ el = el.previousSibling;
+ }
+ else{
+ break;
+ }
+ } while (el && el.tagName !== 'DIV');
+ el.focus();
+ }
+ break;
+ case keymap.KEY.RIGHT:
+ if(angular.isDefined(sidepaneCtrl)){
+ el = sidepaneCtrl.getElement()[0];
+ }
+ if(angular.isDefined(innerPaneCtrl)){
+ el = innerPaneCtrl.getElement()[0];
+ }
+ do {
+ if (el && el.nextElementSibling){
+ el = el.nextElementSibling;
+ }
+ else{
+ break;
+ }
+ }while(window.getComputedStyle(el, null).getPropertyValue("display") === 'none');
+ /*IE8 fix*/
+ if(ieFlag){
+ do {
+ if (el && el.nextSibling){
+ el = el.nextSibling;
+ }
+ else{
+ break;
+ }
+ }while ((el && el.tagName == 'DIV') && el.currentStyle['display'] == 'none');
+ }
+ if (el){
+ el.querySelector("[att-pane-accessibility]").focus();
+ }
+ break;
+ case keymap.KEY.LEFT:
+ if(angular.isDefined(sidepaneCtrl)){
+ el = sidepaneCtrl.getElement()[0];
+ }
+ if(angular.isDefined(innerPaneCtrl)){
+ el = innerPaneCtrl.getElement()[0];
+ }
+ do {
+ if (el && el.previousElementSibling){
+ el = el.previousElementSibling;
+ }
+ else{
+ break;
+ }
+ }while (window.getComputedStyle(el, null).getPropertyValue("display") == 'none');
+
+ /*IE8 fix*/
+ if(ieFlag){
+ do {
+ if (el && el.previousSibling){
+ el = el.previousSibling;
+ }
+ else{
+ break;
+ }
+ }while((el && el.tagName == 'DIV') && el.currentStyle['display'] == 'none');
+ }
+ if (el){
+ el.querySelector("[att-pane-accessibility]").focus();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ });
+ }
+ };
+}])
+.directive('sideRow', [function(){
+ return {
+ restrict: 'A',
+ replace:true,
+ require: ['^sidePane','^paneGroup'],
+ link: function(scope,element,attr,ctrls){
+ var sidePaneCtrl = ctrls[0];
+ var paneGroupCtrl = ctrls[1];
+ if(scope.$first){
+ /*
+ Reset the sidePaneId array if a new
+ set of ngRepeat data appeared
+ */
+ sidePaneCtrl.sidePaneIds = [];
+ }
+ var paneId =attr['paneId'];
+ var drillDownTo = attr['drillDownTo'];
+ sidePaneCtrl.sidePaneRows.push({'paneId':paneId, 'drillDownTo':drillDownTo});
+ element.on('click', function(){
+ sidePaneCtrl.currentSelectedRowPaneId = paneId;
+ paneGroupCtrl.slideOutPane(paneId,true);
+ });
+ }
+ };
+}])
+.controller('SidePaneCtrl',['$scope', '$element','animation', 'paneGroupConstants',
+ function($scope,$element,animation, paneGroupConstants){
+ this.getElement = function(){
+ return $element;
+ };
+ this.sidePaneTracker = {};
+ this.currentWidth = paneGroupConstants.SIDE_WIDTH_DEFAULT;
+ this.paneId = paneGroupConstants.SIDE_PANE_ID;
+ this.currentSelectedRowPaneId;
+ this.drillDownToMapper = {};
+ this.sidePaneRows = [];
+ this.init = function(){
+ var sidePaneRows = this.sidePaneRows;
+ if(sidePaneRows){
+ for(var index in sidePaneRows){
+ if (sidePaneRows.hasOwnProperty(index)) {
+ var paneId = sidePaneRows[index].paneId;
+ var drillDownTo = sidePaneRows[index].drillDownTo;
+ this.drillDownToMapper[paneId] = drillDownTo;
+ if(index == 0){
+ this.currentSelectedRowPaneId = paneId;
+ this.sidePaneTracker[paneId] = [];
+ }
+ }
+ }
+ }
+ };
+ this.getSidePanesList = function(){
+ return this.sidePaneTracker[this.currentSelectedRowPaneId];
+ };
+ this.addToSidePanesList = function(newPaneId){
+ if(this.sidePaneTracker[this.currentSelectedRowPaneId] === undefined){
+ this.sidePaneTracker[this.currentSelectedRowPaneId] = [];
+ }
+ else if(newPaneId){
+ this.sidePaneTracker[this.currentSelectedRowPaneId].push(newPaneId);
+ }
+ };
+ this.setWidth = function(val){
+ if(val){
+ this.currentWidth = val;
+ }
+ animation.set($element,{width:this.currentWidth});
+ };
+ this.resizeWidth = function(val){
+ if(val){
+ this.currentWidth = val;
+ }
+ animation.to($element,.5,{width:val});
+ };
+
+}])
+.directive('sidePane', ['paneGroupConstants', function(paneGroupConstants){
+ return {
+ restrict: 'EA',
+ transclude: true,
+ replace: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/paneSelector/sidePane.html',
+ require: ['^paneGroup', 'sidePane'],
+ controller: 'SidePaneCtrl',
+ scope:{},
+ link: function(scope,element,attr, ctrls){
+ var paneGroupCtrl = ctrls[0];
+ var sidePaneCtrl = ctrls[1];
+ paneGroupCtrl.addPaneCtrl(paneGroupConstants.SIDE_PANE_ID, sidePaneCtrl);
+ }
+ };
+}])
+.directive('drillDownRow', ['$parse', 'paneGroupConstants',function($parse,paneGroupConstants){
+ return {
+ restrict: 'A',
+ replace:true,
+ require: ['^innerPane','^paneGroup'],
+ link: function(scope,element,attr,ctrls){
+ var innerPaneCtrl = ctrls[0];
+ var paneGroupCtrl = ctrls[1];
+ element.on('click', function(){
+ var drillDownTo = innerPaneCtrl.drillDownTo;
+ if(innerPaneCtrl.drillDownTo !== paneGroupConstants.NO_DRILL_DOWN){
+ paneGroupCtrl.slideOutPane(drillDownTo);
+ }
+ element[0].focus();
+ });
+ }
+ };
+}])
+.controller('InnerPaneCtrl', ['$scope', '$element','animation', 'paneGroupConstants',
+ function($scope,$element,animation,paneGroupConstants){
+ this.getElement = function(){
+ return $element;
+ };
+ this.paneId = $scope.paneId;
+ this.drillDownTo;
+ this.currentWidth = paneGroupConstants.INNER_PANE_DEFAULT;
+ this.setWidth = function(val){
+ if(val){
+ this.currentWidth = val;
+ }
+ animation.set($element,{width:this.currentWidth});
+ };
+ this.resizeWidth = function(val,callback){
+ animation.to($element,.25,{width:val,onComplete: callback});
+ };
+ this.displayNone = function(){
+ animation.set($element, {display:'none'});
+ };
+ this.displayBlock = function(){
+ animation.set($element,{display:'block'});
+ if(this){
+ this.hideRightBorder();
+ }
+ };
+ this.floatLeft = function(){
+ animation.set($element,{float:'left'});
+ };
+ this.hideLeftBorder = function(){
+ animation.set($element, {borderLeftWidth: '0px'});
+ };
+ this.showLeftBorder = function(){
+ animation.set($element,{borderLeftWidth: '1px'});
+ };
+ this.hideRightBorder = function(){
+ animation.set($element,{borderRightWidth: '0px'});
+ };
+ this.showRightBorder = function(){
+ animation.set($element, {borderRightWidth: '1px'});
+ };
+ this.slideFromRight = function(){
+ animation.set($element, {float:'right'});
+ animation.set($element, {width: this.currentWidth});
+ };
+ this.startOpen = function(){
+ return $scope.startOpen;
+ };
+}])
+.directive('innerPane', function(){
+ return {
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/paneSelector/innerPane.html',
+ require: ['^paneGroup', 'innerPane'],
+ controller: 'InnerPaneCtrl',
+ scope:{
+ paneId:'@'
+ },
+ link: function(scope,element,attr,ctrls){
+ if(attr.startOpen === ""){
+ scope.startOpen = true;
+ }
+ var paneGroupCtrl = ctrls[0];
+ var innerPaneCtrl = ctrls[1];
+ paneGroupCtrl.addPaneCtrl(scope.paneId,innerPaneCtrl);
+ }
+ };
+})
+.controller('PaneGroupCtrl', ['$scope', '$element', 'paneGroupConstants',function($scope,$element,paneGroupConstants){
+ this.panes = {};
+ this.accountLevelPaneModel = [];
+ this.title = $scope.title;
+ this.init = function(){
+ var sidePane = this.panes[paneGroupConstants.SIDE_PANE_ID];
+ if(sidePane){
+ sidePane.init();
+
+ //Show the other panes that may be set to startOpen
+ //numOpen starts at 1 because of the side pane
+ var numOpen = 1;
+ var key;
+ for(key in this.panes){
+ if(this.panes[key].startOpen && this.panes[key].startOpen()){
+ numOpen++;
+ }
+ }
+ var width;
+ if(numOpen >= 3){
+ width = ((100/numOpen)) + '%';
+ }
+ if(this.panes[sidePane.currentSelectedRowPaneId])
+ {
+ if(width){
+ sidePane.setWidth(width);
+ this.panes[sidePane.currentSelectedRowPaneId].setWidth(width);
+ }
+ else{
+ sidePane.setWidth();
+ this.panes[sidePane.currentSelectedRowPaneId].setWidth();
+ }
+ this.panes[sidePane.currentSelectedRowPaneId].displayBlock();
+ for(key in this.panes){
+ if(key !== paneGroupConstants.SIDE_PANE_ID && key !== sidePane.currentSelectedRowPaneId){
+ this.panes[key].displayNone();
+ }
+ this.panes[key].drillDownTo = sidePane.drillDownToMapper[key];
+ }
+ }
+ openOtherPanesOnStart(sidePane, this.panes);
+ }
+
+ function openOtherPanesOnStart(sidePane, panes){
+ //Build an array of the panes that need to be out
+ var otherPanesStartOpened = [];
+ var index;
+ for(index in sidePane.sidePaneRows){
+ if (sidePane.sidePaneRows.hasOwnProperty(index)) {
+ var pane = sidePane.sidePaneRows[index];
+
+ //Skip the first pane row since we handled it in the begining
+ if(index > 0 && panes[pane.paneId].startOpen && panes[pane.paneId].startOpen()){
+ otherPanesStartOpened.push(pane);
+ //Remember the panes that are opened for the first pane row Index
+ sidePane.addToSidePanesList(pane.paneId);
+ }
+ }
+ }
+
+ if(width){
+ for(index in otherPanesStartOpened){
+ if (otherPanesStartOpened.hasOwnProperty(index)) {
+ var paneId = otherPanesStartOpened[index].paneId;
+ var paneCtrl = panes[paneId];
+ if(paneCtrl && paneCtrl.setWidth && paneCtrl.displayBlock){
+ paneCtrl.setWidth(width);
+ paneCtrl.displayBlock();
+ }
+ }
+ }
+ }
+
+ }
+ };
+
+ /*
+ Resets all the panels to their original positions at the end of a sidebar click
+ By setting the sideBar to its default width
+ Setting all panes to float left and displaynone
+ Setting the pane that was clicked to default width and slide right
+ */
+
+ this.resetPanes = function(){
+ for(var key in this.panes){
+ if(this.panes.hasOwnProperty(key)){
+ var pane = this.panes[key];
+ if(pane && (pane.paneId !== paneGroupConstants.SIDE_PANE_ID)){
+ pane.floatLeft();
+ pane.displayNone();
+ }
+ }
+ }
+
+ if(this.panes[paneGroupConstants.SIDE_PANE_ID]){
+ this.panes[paneGroupConstants.SIDE_PANE_ID].setWidth(paneGroupConstants.SIDE_WIDTH_DEFAULT);
+ }
+ };
+
+ this.addPaneCtrl = function(paneId,paneCtrl){
+ this.panes[paneId] = paneCtrl;
+ };
+
+ this._slideOutPane = function(paneId,isFromSidePane){
+ this.resetPanes();
+ //Check current side pane stack to see how many panes are already open for that side pane choice
+ //then add the new pane that needs to be there
+ var panesList;
+ if(isFromSidePane){
+
+ //Check if the side pane id has already been clicked
+ if(this.panes[paneGroupConstants.SIDE_PANE_ID]){
+ panesList = this.panes[paneGroupConstants.SIDE_PANE_ID].getSidePanesList();
+ }
+ if(!panesList){
+ if(this.panes && this.panes[paneGroupConstants.SIDE_PANE_ID] && this.panes[paneId]){
+ this.panes[paneGroupConstants.SIDE_PANE_ID].currentSelectedRowPaneId = paneId;
+ this.panes[paneGroupConstants.SIDE_PANE_ID].addToSidePanesList();
+
+ this.panes[paneId].slideFromRight();
+ this.panes[paneId].displayBlock();
+
+ this.panes[paneId].setWidth(paneGroupConstants.INNER_PANE_DEFAULT);
+ }
+ }
+ else if(this.panes && this.panes[paneGroupConstants.SIDE_PANE_ID]){
+ //Restore the panes based on the panelist
+ if(panesList.length === 0 && this.panes[paneId]){
+ //Only one pane is out
+ this.panes[paneGroupConstants.SIDE_PANE_ID].setWidth(paneGroupConstants.SIDE_WIDTH_DEFAULT);
+ this.panes[paneId].displayBlock();
+ this.panes[paneId].setWidth(paneGroupConstants.INNER_PANE_DEFAULT);
+ }
+ else{
+ //Multiple panes out
+ var numPanes = panesList.length + 2;
+ var width = ((100/numPanes)) + '%';
+ this.panes[paneGroupConstants.SIDE_PANE_ID].setWidth(width);
+
+ //Set the sidePanes pane
+ //set the panes children list
+ if(this.panes[this.panes[paneGroupConstants.SIDE_PANE_ID].currentSelectedRowPaneId]){
+ this.panes[this.panes[paneGroupConstants.SIDE_PANE_ID].currentSelectedRowPaneId].displayBlock();
+ this.panes[this.panes[paneGroupConstants.SIDE_PANE_ID].currentSelectedRowPaneId].setWidth(width);
+ }
+ for(var i in panesList){
+ if(this.panes[panesList[i]]){
+ this.panes[panesList[i]].displayBlock();
+ this.panes[panesList[i]].setWidth(width);
+ }
+ }
+ }
+ }
+ }
+ else{
+
+ //Have to check the paneId that was given and where it is drilling down to
+ var isPaneInStack = false;
+ var stackPaneList;
+ if(this.panes[paneGroupConstants.SIDE_PANE_ID]){
+ stackPaneList = this.panes[paneGroupConstants.SIDE_PANE_ID].getSidePanesList();
+ }
+ for(var j in stackPaneList){
+ if(stackPaneList.hasOwnProperty(j)){
+ var pId = stackPaneList[j];
+ if(pId === paneId){
+ isPaneInStack = true;
+ break;
+ }
+ }
+ }
+ if(!isPaneInStack && this.panes[paneGroupConstants.SIDE_PANE_ID]){
+ this.panes[paneGroupConstants.SIDE_PANE_ID].addToSidePanesList(paneId);
+ }
+ var sidePanesListLength;
+ if(this.panes[paneGroupConstants.SIDE_PANE_ID]){
+ sidePanesListLength = this.panes[paneGroupConstants.SIDE_PANE_ID].getSidePanesList().length;
+ }
+ var numberPanes = sidePanesListLength + 2;
+ var widthToSet = ((100/numberPanes)) + '%';
+ if(this.panes[paneGroupConstants.SIDE_PANE_ID]){
+ this.panes[paneGroupConstants.SIDE_PANE_ID].setWidth(widthToSet);
+ }
+ var slideInPaneId;
+
+ if(this.panes[paneGroupConstants.SIDE_PANE_ID]){
+ slideInPaneId = this.panes[paneGroupConstants.SIDE_PANE_ID].getSidePanesList()[sidePanesListLength - 1];
+ }
+
+ var that = this;
+
+ if(that.panes[paneGroupConstants.SIDE_PANE_ID]){
+ panesList = that.panes[paneGroupConstants.SIDE_PANE_ID].getSidePanesList();
+ }
+
+ for(var p in panesList){
+ if(panesList.hasOwnProperty(p)){
+ var paneListPaneId = panesList[p];
+ var pane = this.panes[paneListPaneId];
+ if(paneListPaneId !== slideInPaneId && pane){
+ pane.setWidth(widthToSet);
+ pane.displayBlock();
+ pane.floatLeft();
+ }
+ }
+ }
+
+ if(this.panes[this.panes[paneGroupConstants.SIDE_PANE_ID].currentSelectedRowPaneId]){
+ this.panes[this.panes[paneGroupConstants.SIDE_PANE_ID].currentSelectedRowPaneId].displayBlock();
+ this.panes[this.panes[paneGroupConstants.SIDE_PANE_ID].currentSelectedRowPaneId].showRightBorder();
+
+ this.panes[this.panes[paneGroupConstants.SIDE_PANE_ID].currentSelectedRowPaneId].resizeWidth(widthToSet,function(){
+
+ if(that.panes[slideInPaneId] && that.panes[that.panes[paneGroupConstants.SIDE_PANE_ID].currentSelectedRowPaneId]){
+ that.panes[that.panes[paneGroupConstants.SIDE_PANE_ID].currentSelectedRowPaneId].hideRightBorder();
+ that.panes[slideInPaneId].setWidth(widthToSet);
+ that.panes[slideInPaneId].slideFromRight();
+ that.panes[slideInPaneId].displayBlock();
+ that.panes[slideInPaneId].floatLeft();
+ }
+
+ });
+ }
+ }
+ };
+
+ this.slideOutPane = function(paneId,isFromSidePane){
+ this._slideOutPane(paneId,isFromSidePane);
+ };
+}])
+.directive('paneGroup', ['$timeout',function($timeout){
+ return {
+ restrict: 'EA',
+ transclude: true,
+ replace: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/paneSelector/paneGroup.html',
+ scope:{
+ },
+ controller: 'PaneGroupCtrl',
+ link: function(scope,element,attr,ctrl){
+ $timeout(initialize,100);
+ function initialize(){
+ ctrl.init();
+ }
+ }
+ };
+}]);
+angular.module('att.abs.tooltip', ['att.abs.position', 'att.abs.utilities', 'ngSanitize'])
+ // The default options tooltip and popover.
+ .constant('tooltipDefaultOptions', {
+ placement: 'above',
+ animation: false,
+ popupDelay: 0,
+ stylett: 'dark',
+ appendToBody: true
+ })
+
+ /**
+ * The $tooltip service creates tooltip- and popover-like directives as well as
+ * houses global options for them.
+ */
+ .provider('$tooltip', ['tooltipDefaultOptions', function(tooltipDefaultOptions) {
+
+ // Default hide triggers for each show trigger
+ var triggerMap = {
+ 'mouseenter': 'mouseleave',
+ 'click': 'click',
+ 'focus': 'blur',
+ 'mouseover':'mouseout'
+ };
+
+ // The options specified to the provider globally.
+ var globalOptions = {};
+
+ this.options = function(value) {
+ angular.extend(globalOptions, value);
+ };
+
+ /**
+ * This allows you to extend the set of trigger mappings available. E.g.:
+ *
+ * $tooltipProvider.setTriggers( 'openTrigger': 'closeTrigger' );
+ */
+ this.setTriggers = function(triggers) {
+ angular.extend(triggerMap, triggers);
+ };
+
+ /**
+ * This is a helper function for translating camel-case to snake-case.
+ */
+ function snakeCase(name) {
+ var regexp = /[A-Z]/g;
+ var separator = '-';
+ return name.replace(regexp, function(letter, pos) {
+ return (pos ? separator : '') + letter.toLowerCase();
+ });
+ }
+
+ /**
+ * Returns the actual instance of the $tooltip service.
+ */
+ this.$get = ['$window', '$compile', '$timeout', '$parse', '$document', '$position', '$interpolate', '$attElementDetach', function($window, $compile, $timeout, $parse, $document, $position, $interpolate, $attElementDetach) {
+ return function (type, prefix, defaultTriggerShow) {
+ var options = angular.extend({}, tooltipDefaultOptions, globalOptions);
+ /**
+ * Returns an object of show and hide triggers.
+ *
+ * If a trigger is supplied,
+ * it is used to show the tooltip; otherwise, it will use the `trigger`
+ * option passed to the `$tooltipProvider.options` method; else it will
+ * default to the trigger supplied to this directive factory.
+ *
+ * The hide trigger is based on the show trigger. If the `trigger` option
+ * was passed to the `$tooltipProvider.options` method, it will use the
+ * mapped trigger from `triggerMap` or the passed trigger if the map is
+ * undefined; otherwise, it uses the `triggerMap` value of the show
+ * trigger; else it will just use the show trigger.
+ */
+ function getTriggers(trigger) {
+ var show = trigger || options.trigger || defaultTriggerShow;
+ var hide = triggerMap[show] || show;
+ return {
+ show: show,
+ hide: hide
+ };
+ }
+
+ var directiveName = snakeCase(type);
+
+ var startSym = $interpolate.startSymbol();
+ var endSym = $interpolate.endSymbol();
+
+ return {
+ restrict: 'EA',
+ scope: true,
+ link: function (scope, element, attrs) {
+ /* Allows a developer to force element to be non-tabable */
+ if (!element.attr('tabindex')) {
+ element.attr('tabindex', '0');
+ }
+
+ var isElementHovered = false;
+ element.bind('mouseenter', function(){
+ isElementHovered = true;
+ element.removeAttr('title');
+ });
+ element.bind('mouseleave', function(){
+ isElementHovered = false;
+ // setTooltipAriaLabel();
+ });
+
+ /* We store our attributes on our scope so any user of $tooltip service can access attributes */
+ scope.parentAttrs = attrs;
+ var template =
+ '<div ' + directiveName + '-popup ' +
+ 'title="' + startSym + 'tt_title' + endSym + '" ' +
+ 'content="' + startSym + 'tt_content' + endSym + '" ' +
+ 'placement="' + startSym + 'tt_placement' + endSym + '" ' +
+ 'animation="tt_animation()" ' +
+ 'is-open="tt_isOpen" ' +
+ 'stylett="' + startSym + 'tt_style' + endSym + '" ' +
+ '>' +
+ '</div>';
+
+ var tooltip = $compile(template)(scope);
+ var transitionTimeout;
+ var popupTimeout;
+ var $body;
+ var appendToBody = angular.isDefined(options.appendToBody) ? options.appendToBody : false;
+ var triggers = getTriggers(undefined);
+ var hasRegisteredTriggers = false;
+ var hasEnableExp = angular.isDefined(attrs[prefix + 'Enable']);
+ var tooltipOffset = 0;
+ var tooltipAriaLabelDefined = false;
+
+ // By default, the tooltip is not open.
+ // add ability to start tooltip opened
+ scope.tt_isOpen = false;
+
+ //Adding a scope watch, to remove the created popup from DOM, incase it is updated outside the provider code.
+ scope.$watch('tt_isOpen', function(newVal, oldVal){
+ if(newVal !== oldVal && !newVal){
+ $attElementDetach(tooltip[0]);
+ }
+ });
+
+ function toggleTooltipBind() {
+ if (!scope.tt_isOpen) {
+ showTooltipBind();
+ } else {
+ hideTooltipBind();
+ }
+ }
+
+ // Show the tooltip with delay if specified, otherwise show it immediately
+ function showTooltipBind() {
+ if (hasEnableExp && !scope.$eval(attrs[prefix + 'Enable'])) {
+ return;
+ }
+ if (scope.tt_popupDelay) {
+ popupTimeout = $timeout(show, scope.tt_popupDelay);
+ } else {
+ scope.$apply(show);
+ }
+ }
+
+ function hideTooltipBind() {
+ scope.$apply(function() {
+ hide();
+ });
+ }
+
+ // Show the tooltip popup element.
+ function show() {
+ var position,
+ ttWidth,
+ ttHeight,
+ ttPosition;
+
+ // Don't show empty tooltips.
+ if (!scope.tt_content) {
+ return;
+ }
+
+ // If there is a pending remove transition, we must cancel it, lest the
+ // tooltip be mysteriously removed.
+ if (transitionTimeout) {
+ $timeout.cancel(transitionTimeout);
+ }
+
+ // Set the initial positioning.
+ tooltip.css({top: 0, left: 0, display: 'block', 'z-index': 9999});
+
+ // Now we add it to the DOM because need some info about it. But it's not
+ // visible yet anyway.
+ if (appendToBody) {
+ $body = $body || $document.find('body');
+ $body.append(tooltip);
+ } else {
+ element.after(tooltip);
+ }
+
+ // Get the position of the directive element.
+ position = appendToBody ? $position.offset(element) : $position.position(element);
+
+ // Get the height and width of the tooltip so we can center it.
+ ttWidth = tooltip.prop('offsetWidth');
+ ttHeight = tooltip.prop('offsetHeight');
+
+ // Calculate the tooltip's top and left coordinates to center it with
+ // this directive.
+ var ttArrowOffset = 10;
+ switch (scope.tt_placement) {
+ case 'right':
+ if(appendToBody){
+ ttPosition = {
+ top: position.top + position.height / 2 - ttHeight / 2,
+ left: (position.left + position.width) + tooltipOffset
+ };
+ }else{
+ ttPosition = {
+ top: position.top + position.height / 2 - ttHeight / 2,
+ left: (position.left + position.width + ttArrowOffset) + tooltipOffset
+ };
+ }
+ break;
+ case 'below':
+ if(appendToBody){
+ ttPosition = {
+ top: (position.top + position.height) + tooltipOffset,
+ left: position.left + position.width / 2 - ttWidth / 2
+ };
+ }else{
+ ttPosition = {
+ top: (position.top + position.height + ttArrowOffset) + tooltipOffset,
+ left: position.left + position.width / 2 - ttWidth / 2
+ };
+ }
+ break;
+ case 'left':
+ if(appendToBody){
+ ttPosition = {
+ top: position.top + position.height / 2 - ttHeight / 2,
+ left: (position.left - ttWidth) - tooltipOffset
+ };
+ }else{
+ ttPosition = {
+ top: position.top + position.height / 2 - ttHeight / 2,
+ left: (position.left - ttWidth - ttArrowOffset) - tooltipOffset
+ };
+ }
+ break;
+ default:
+ if(appendToBody){
+ ttPosition = {
+ top: (position.top - ttHeight) - tooltipOffset,
+ left: position.left + position.width / 2 - ttWidth / 2
+ };
+ }else{
+ ttPosition = {
+ top: (position.top - ttHeight - ttArrowOffset) - tooltipOffset,
+ left: position.left + position.width / 2 - ttWidth / 2
+ };
+ }
+ break;
+ }
+
+ ttPosition.top += 'px';
+ ttPosition.left += 'px';
+
+ // Now set the calculated positioning.
+ tooltip.css(ttPosition);
+
+ // And show the tooltip.
+ scope.tt_isOpen = true;
+ }
+
+ // Hide the tooltip popup element.
+ function hide() {
+ // First things first: we don't show it anymore.
+ scope.tt_isOpen = false;
+
+ //if tooltip is going to be shown after delay, we must cancel this
+ $timeout.cancel(popupTimeout);
+
+ // And now we remove it from the DOM. However, if we have animation, we
+ // need to wait for it to expire beforehand.
+ // This is a placeholder for a port of the transitions library.
+ if (angular.isDefined(scope.tt_animation) && scope.tt_animation()) {
+ transitionTimeout = $timeout(function() {
+ $attElementDetach(tooltip[0]);
+ }, 500);
+ } else {
+ $attElementDetach(tooltip[0]);
+ }
+ }
+
+ function setTooltipAriaLabel() {
+ element.removeAttr('title');
+ if(!isElementHovered){
+ if (tooltipAriaLabelDefined) {
+ element.attr('title', scope.tooltipAriaLabel);
+ } else {
+ element.attr('title', scope.tt_content);
+ }
+ }
+ }
+
+ /**
+ * Observe the relevant attributes.
+ */
+ attrs.$observe(type, function(val) {
+ if (val) {
+ scope.tt_content = val;
+ // setTooltipAriaLabel();
+ } else {
+ if (scope.tt_isOpen) {
+ hide();
+ }
+ }
+ });
+
+ attrs.$observe(prefix + 'Title', function(val) {
+ scope.tt_title = val;
+ });
+
+ attrs.$observe(prefix + 'Placement', function(val) {
+ scope.tt_placement = angular.isDefined(val) ? val : options.placement;
+ });
+
+ attrs.$observe(prefix + 'Style', function(val) {
+ scope.tt_style = angular.isDefined(val) ? val : options.stylett;
+ });
+
+ attrs.$observe(prefix + 'Animation', function(val) {
+ scope.tt_animation = angular.isDefined(val) ? $parse(val) : function() {
+ return options.animation;
+ };
+ });
+
+ attrs.$observe(prefix + 'PopupDelay', function(val) {
+ var delay = parseInt(val, 10);
+ scope.tt_popupDelay = !isNaN(delay) ? delay : options.popupDelay;
+ });
+
+ attrs.$observe(prefix + 'Trigger', function(val) {
+
+ if (hasRegisteredTriggers) {
+ element.unbind(triggers.show, showTooltipBind);
+ element.unbind(triggers.hide, hideTooltipBind);
+ }
+
+ triggers = getTriggers(val);
+
+ /* This fixes issue in which a click on input field with trigger as focus
+ causes focus to fire following click thus making tooltip flash. */
+ if (triggers.show === 'focus') {
+ element.bind('focus', showTooltipBind);
+ element.bind('blur', hideTooltipBind);
+ element.bind('click', function(e) {
+ e.stopPropagation();
+ });
+ } else if (triggers.show === triggers.hide) {
+ element.bind(triggers.show, toggleTooltipBind);
+ } else {
+ element.bind(triggers.show, showTooltipBind);
+ element.bind(triggers.hide, hideTooltipBind);
+ }
+
+ hasRegisteredTriggers = true;
+ });
+
+ attrs.$observe(prefix + 'AppendToBody', function (val) {
+ appendToBody = angular.isDefined(val) ? $parse(val)(scope) : appendToBody;
+ });
+
+ attrs.$observe(prefix + 'Offset', function (val) {
+ tooltipOffset = angular.isDefined(val) ? parseInt(val, 10) : 0;
+ });
+
+ attrs.$observe(prefix + 'AriaLabel', function (val) {
+ if (angular.isDefined(val)) {
+ scope.tooltipAriaLabel = val;
+ tooltipAriaLabelDefined = true;
+ } else {
+ tooltipAriaLabelDefined = false;
+ }
+ setTooltipAriaLabel();
+ });
+
+ // if a tooltip is attached to <body> we need to remove it on
+ // location change as its parent scope will probably not be destroyed
+ // by the change.
+ if (appendToBody) {
+ scope.$on('$locationChangeSuccess', function() {
+ if (scope.tt_isOpen) {
+ hide();
+ }
+ });
+ }
+
+ // Make sure tooltip is destroyed and removed.
+ scope.$on('$destroy', function() {
+ if (scope.tt_isOpen) {
+ hide();
+ } else {
+ tooltip.remove();
+ }
+ });
+ }
+ };
+ };
+ }];
+ }])
+
+ .directive('tooltipPopup', ['$document', '$documentBind', function($document, $documentBind) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ scope: {content: '@', placement: '@', animation: '&', isOpen: '=', stylett: '@'},
+ templateUrl: 'app/scripts/ng_js_att_tpls/tooltip/tooltip-popup.html',
+ link: function(scope, elem) {
+ scope.$watch("isOpen", function() {
+ scope.isOpen;
+ });
+ elem.bind('click', function (e) {
+ e.stopPropagation();
+ });
+ var outsideClick = function() {
+ scope.$apply(function() {
+ scope.isOpen = false;
+ });
+ };
+
+ $documentBind.event('click', 'isOpen', outsideClick, scope, true, 10);
+ }
+ };
+ }])
+
+ .directive('tooltip', ['$tooltip', function($tooltip) {
+ return $tooltip('tooltip', 'tooltip', 'mouseenter');
+ }])
+
+ .directive('tooltipCondition', [ '$timeout',function($timeout) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ scope:{
+ tooltipCondition:"@?"
+ },
+ template:'<p><span tooltip=\"{{tooltipCondition}}\" ng-if=\"showpop\">{{tooltipCondition}}</span><span id=\"innerElement\" ng-hide=\"showpop\">{{tooltipCondition}}</span></p>',
+ link: function(scope, elem, attr){
+ scope.showpop=false;
+ if(attr.height==='true'){
+ $timeout(function () {
+ var maxHeight=(elem[0].offsetHeight);
+ var elemHeight=elem.children(0)[0].offsetHeight;
+ if(elemHeight > maxHeight){
+ scope.showpop=true;
+ }
+ });
+ }
+ else if(scope.tooltipCondition.length>=25){
+ scope.showpop=true;
+ }
+ }
+ };
+ }]);
+angular.module('att.abs.popOvers', ['att.abs.tooltip', 'att.abs.utilities', 'ngSanitize'])
+ .directive('popover', ['$tooltip', function($tooltip) {
+ return $tooltip('popover', 'popover', 'click');
+ }])
+ .directive('popoverPopup', ['$document', '$documentBind', '$timeout', 'events', 'DOMHelper', function($document, $documentBind, $timeout, events, DOMHelper) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/popOvers/popOvers.html',
+ scope: {content: '@', placement: '@', animation: '&', isOpen: '=', stylett: '@'},
+ link: function(scope, elem, attr, ctrl) {
+
+ scope.closeable = false;
+ try {
+ scope.closeable = scope.$parent.parentAttrs['closeable'] === '' ? true : false;
+ } catch (e) {}
+
+ /* Before opening modal, find the focused element */
+ var launchingElement = undefined,
+ firstTabableElement = undefined;
+
+ var outsideClick = function(evt) {
+ scope.$apply(function() {
+ scope.isOpen = false;
+ });
+ };
+ var escKeydown = function(evt) {
+ if (evt.which === 27 || evt.keyCode === 27) {
+ console.log('ESC was pressed!');
+ scope.$apply(function() {
+ scope.isOpen = false;
+ });
+ }
+ };
+
+ $timeout(function() {
+ firstTabableElement = DOMHelper.firstTabableElement(elem);
+ }, 10, false);
+
+ scope.$watch('isOpen', function(value) {
+ if (scope.isOpen) {
+ launchingElement = document.activeElement;
+ /* Focus on first tabbable element */
+ if (angular.isDefined(firstTabableElement)) {
+ try {
+ firstTabableElement.focus();
+ } catch(e) {}
+ }
+ } else {
+ if (angular.isDefined(launchingElement)) {
+ try {
+ launchingElement.focus();
+ } catch (e) {} /* IE8 will throw exception */
+ }
+ }
+ });
+
+ scope.$watch("stylett", function(value) {
+ scope.popOverStyle = value;
+ });
+
+ scope.$watch("placement", function(value) {
+ scope.popOverPlacement = value;
+ });
+
+ scope.closeMe = function(){
+ scope.isOpen = false;
+ };
+
+ elem.bind('click', function (e) {
+ events.stopPropagation(e);
+ });
+
+ $documentBind.event('click', 'isOpen', outsideClick, scope, true, 10);
+ $documentBind.event('keydown', 'isOpen', escKeydown, scope, true, 10);
+ }
+ };
+ }]);
+
+angular.module('att.abs.profileCard', [])
+ .constant('profileStatus',{
+ status:{
+ ACTIVE:{status:"Active",color:"green"},
+ DEACTIVATED:{status:"Deactivated",color:"red"},
+ LOCKED:{status:"Locked",color:"red"},
+ IDLE:{status:"Idle",color:"yellow"},
+ PENDING:{status:"Pending",color:"blue"}
+ },
+ role:"COMPANY ADMINISTRATOR"
+ })
+ .directive('profileCard',['$http','$q','profileStatus', function($http,$q,profileStatus) {
+ return {
+ restrict: 'EA',
+ replace:'true',
+ templateUrl:function(element, attrs){
+ if(!attrs.addUser){
+ return 'app/scripts/ng_js_att_tpls/profileCard/profileCard.html';
+ }
+ else{
+ return 'app/scripts/ng_js_att_tpls/profileCard/addUser.html';
+ }
+ },
+ scope:{
+ profile:'='
+ },
+ link: function(scope, elem, attr){
+ scope.image=true;
+ function isImage(src) {
+ var deferred = $q.defer();
+ var image = new Image();
+ image.onerror = function() {
+ deferred.reject(false);
+ };
+ image.onload = function() {
+ deferred.resolve(true);
+ };
+ if(src!==undefined && src.length>0 ){
+ image.src = src;
+ }else{
+ deferred.reject(false);
+ }
+ return deferred.promise;
+ }
+ if(!attr.addUser){
+ scope.image=false;
+ isImage(scope.profile.img).then(function(img) {
+ scope.image=img;
+ });
+ var splitName=(scope.profile.name).split(' ');
+ scope.initials='';
+ for(var i=0;i<splitName.length;i++){
+ scope.initials += splitName[i][0];
+ }
+ if(scope.profile.role.toUpperCase()===profileStatus.role){
+ scope.badge=true;
+ }
+ var profileState=profileStatus.status[scope.profile.state.toUpperCase()];
+ if(profileState) {
+ scope.profile.state=profileStatus.status[scope.profile.state.toUpperCase()].status;
+ scope.colorIcon=profileStatus.status[scope.profile.state.toUpperCase()].color;
+ if(scope.profile.state.toUpperCase()===profileStatus.status.PENDING.status.toUpperCase()||scope.profile.state.toUpperCase()===profileStatus.status.LOCKED.status.toUpperCase()){
+ scope.profile.lastLogin=scope.profile.state;
+ }
+ }
+ var today=new Date().getTime();
+ var lastlogin=new Date(scope.profile.lastLogin).getTime();
+ var diff=(today-lastlogin)/(1000*60*60*24);
+ if(diff<=1){
+ scope.profile.lastLogin="Today";
+ }
+ else if(diff<=2){
+ scope.profile.lastLogin="Yesterday";
+ }
+ }
+ }
+ };
+ }]);
+angular.module('att.abs.progressBars', [])
+
+.directive('attProgressBar', [function(){
+ return {
+ restrict: 'A',
+ replace: true,
+ templateUrl : 'app/scripts/ng_js_att_tpls/progressBars/progressBars.html'
+ };
+}]);
+angular.module('att.abs.radio', [])
+ .constant('attRadioConfig', {
+ activeClass : "att-radio--on",
+ disabledClass : "att-radio--disabled"
+ })
+.directive('attRadio', ['$compile','attRadioConfig', function ($compile, attRadioConfig) {
+ return {
+ scope: {},
+ restrict: 'A',
+ require: 'ngModel',
+ link: function (scope, element, attr, ctrl) {
+ var ngCtrl = ctrl;
+ scope.radioVal='';
+ var parentDiv = angular.element('<div att-accessibility-click="13,32" ng-click="updateModel($event)" class="att-radio"></div>');
+ element.attr("value",attr.attRadio);
+ element.removeAttr("att-radio");
+ element.removeAttr("title");
+ element.attr("ng-model","radioVal");
+ parentDiv.append(element.prop('outerHTML'));
+ parentDiv.append('<div class="att-radio__indicator"></div>');
+ parentDiv.attr("title", attr.title);
+
+ var elm = parentDiv.prop('outerHTML');
+ elm = $compile(elm)(scope);
+ element = element.replaceWith(elm);
+ var radioElm = elm.find("input");
+
+ radioElm.on('focus', function() {
+ elm.css("outline","2px solid #5E9ED6");
+ // elm.css("outline","-mos-focus-ring-color auto 5px");
+ elm.css("outline","-webkit-focus-ring-color auto 5px");
+
+ });
+ radioElm.on('blur', function() {
+ elm.css("outline","none");
+ });
+
+ ngCtrl.$render = function () {
+ scope.radioVal = ngCtrl.$modelValue;
+ var selected = angular.equals(ngCtrl.$modelValue, attr.attRadio);
+ elm.toggleClass(attRadioConfig.activeClass, selected);
+ };
+
+ scope.updateModel = function () {
+ radioElm[0].focus();
+ var isActive = elm.hasClass(attRadioConfig.activeClass);
+
+ if (!isActive && !scope.disabled) {
+ ngCtrl.$setViewValue(isActive ? null : attr.attRadio);
+ ngCtrl.$render();
+ }
+ };
+
+ attr.$observe('disabled', function (val) {
+ scope.disabled = (val || val === "disabled" || val === "true");
+ if (scope.disabled){
+ elm.addClass(attRadioConfig.disabledClass);
+ elm.attr("tabindex", "-1");
+ }else {
+ elm.removeClass(attRadioConfig.disabledClass);
+ elm.attr("tabindex", "0");
+ }
+ });
+ }
+ };
+}]);
+angular.module('att.abs.scrollbar', ['att.abs.position'])
+
+.constant('attScrollbarConstant', {
+ defaults: {
+ // Vertical or horizontal scrollbar? ( x || y ).
+ axis: 'y',
+ // Whether navigation pane is required of not.
+ navigation: false,
+ // Enable or disable the mousewheel.
+ wheel: true,
+ // How many pixels must the mouswheel scroll at a time.
+ wheelSpeed: 40,
+ // Lock default scrolling window when there is no more content.
+ wheelLock: true,
+ //// Enable invert style scrolling
+ scrollInvert: false,
+ // Set the size of the scrollbar to auto or a fixed number.
+ trackSize: false,
+ // Set the size of the thumb to auto or a fixed number.
+ thumbSize: false,
+ // Set to false to hide the scrollbar if not being used
+ alwaysVisible: true
+ }
+})
+
+.directive('attScrollbar', ['$window', '$timeout', '$parse', '$animate', 'attScrollbarConstant', '$position', function ($window, $timeout, $parse, $animate, attScrollbarConstant, $position) {
+ return {
+ restrict: 'A',
+ scope: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/scrollbar/scrollbar.html',
+ controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
+ var defaults = {
+ axis: $attrs.attScrollbar || attScrollbarConstant.defaults.axis,
+ navigation: $attrs.navigation || attScrollbarConstant.defaults.navigation,
+ wheel: attScrollbarConstant.defaults.wheel,
+ wheelSpeed: attScrollbarConstant.defaults.wheelSpeed,
+ wheelLock: attScrollbarConstant.defaults.wheelLock,
+ scrollInvert: attScrollbarConstant.defaults.scrollInvert,
+ trackSize: attScrollbarConstant.defaults.trackSize,
+ thumbSize: attScrollbarConstant.defaults.thumbSize,
+ alwaysVisible: attScrollbarConstant.defaults.alwaysVisible
+ };
+ var options = $attrs.scrollbar;
+ if (options) {
+ options = $parse(options)($scope);
+ } else {
+ options = {};
+ }
+ this.options = angular.extend({}, defaults, options);
+ this._defaults = defaults;
+
+ var self = this,
+ $body = angular.element(document.querySelectorAll('body')[0]),
+ $document = angular.element(document),
+ $viewport = angular.element($element[0].querySelectorAll('.scroll-viewport')[0]),
+ $overview = angular.element($element[0].querySelectorAll('.scroll-overview')[0]),
+ $scrollbar = angular.element($element[0].querySelectorAll('.scroll-bar')[0]),
+ $thumb = angular.element($element[0].querySelectorAll('.scroll-thumb')[0]),
+ mousePosition = 0,
+ isHorizontal = this.options.axis === 'x',
+ hasTouchEvents = false,
+ // Modern browsers support "wheel"
+ wheelEvent = ("onwheel" in document ? "wheel" :
+ // Webkit and IE support at least "mousewheel"
+ document.onmousewheel !== undefined ? "mousewheel" :
+ // let's assume that remaining browsers are older Firefox
+ "DOMMouseScroll"),
+ sizeLabel = isHorizontal ? 'width' : 'height',
+ sizeLabelCap = sizeLabel.charAt(0).toUpperCase() + sizeLabel.slice(1).toLowerCase(),
+ posiLabel = isHorizontal ? 'left' : 'top',
+ // moveEvent = document.createEvent('HTMLEvents'),
+ restoreVisibilityAfterWheel,
+ thumbscrolltouch = false,
+ documnetscrolltouch = false;
+ if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
+ hasTouchEvents = true;
+ }
+
+ //moveEvent.initEvent('move', true, true);
+ this.contentPosition = 0;
+ this.viewportSize = 0;
+ this.contentSize = 0;
+ this.contentRatio = 0;
+ this.trackSize = 0;
+ this.trackRatio = 0;
+ this.thumbSize = 0;
+ this.thumbPosition = 0;
+
+ this.initialize = function () {
+ if (!this.options.alwaysVisible) {
+ $scrollbar.css('opacity', 0);
+ }
+ self.update();
+ setEvents();
+ return self;
+ };
+
+ this.setSizeData = function () {
+ this.viewportSize = $viewport.prop('offset' + sizeLabelCap) || 1;
+ this.contentSize = $overview.prop('scroll' + sizeLabelCap) || 1;
+ this.contentRatio = this.viewportSize / this.contentSize;
+ this.trackSize = this.options.trackSize || this.viewportSize;
+ this.thumbSize = Math.min(this.trackSize, Math.max(0, (this.options.thumbSize || (this.trackSize * this.contentRatio))));
+ this.trackRatio = this.options.thumbSize ? (this.contentSize - this.viewportSize) / (this.trackSize - this.thumbSize) : (this.contentSize / this.trackSize);
+ };
+
+ this.update = function (scrollTo) {
+ self.setSizeData();
+ mousePosition = $scrollbar.prop('offsetTop');
+
+ $scrollbar.toggleClass('disable', this.contentRatio >= 1 || isNaN(this.contentRatio));
+
+ if (!this.options.alwaysVisible && this.contentRatio < 1 && this.viewportSize > 0) {
+ //flash the scrollbar when update happens
+ $animate.addClass($scrollbar, 'visible').then(function () {
+ $animate.removeClass($scrollbar, 'visible');
+ $scope.$digest();
+ });
+ }
+
+ if (scrollTo !== null) {
+ if (scrollTo === 'bottom') {
+ this.contentPosition = this.contentSize - this.viewportSize;
+ } else {
+ this.contentPosition = parseInt(scrollTo, 10) || 0;
+ }
+ }
+
+ ensureContentPosition();
+ $thumb.css(posiLabel, self.contentPosition / self.trackRatio + 'px');
+ $scrollbar.css(sizeLabel, self.trackSize + 'px');
+ $thumb.css(sizeLabel, self.thumbSize + 'px');
+ $overview.css(posiLabel, -self.contentPosition + 'px');
+
+ return this;
+ };
+
+ fireEvent = function (obj, evt) {
+ var fireOnThis = obj;
+ var evtObj;
+ if (document.createEvent) {
+ // alert("FF");
+ evtObj = document.createEvent('HTMLEvents');
+ evtObj.initEvent(evt, true, false);
+ fireOnThis.dispatchEvent(evtObj);
+ } else if (document.createEventObject) {
+ // alert("IE8");
+ evtObj = document.createEventObject();
+ fireOnThis.fireEvent('on' + evt, evtObj);
+ }
+ };
+
+ function ensureContentPosition() {
+ // if scrollbar is on, ensure the bottom of the content does not go above the bottom of the viewport
+ if (self.contentRatio <= 1 && self.contentPosition > self.contentSize - self.viewportSize) {
+ self.contentPosition = self.contentSize - self.viewportSize;
+ }
+ // if scrollbar is off, ensure the top of the content does not go below the top of the viewport
+ else if (self.contentRatio > 1 && self.contentPosition > 0) {
+ self.contentPosition = 0;
+ }
+
+ if (self.contentPosition <= 0) {
+ $scope.prevAvailable = false;
+ } else {
+ $scope.prevAvailable = true;
+ }
+
+ if (self.contentPosition >= (self.contentSize - self.viewportSize)) {
+ $scope.nextAvailable = false;
+ } else {
+ $scope.nextAvailable = true;
+ }
+ }
+
+ function setEvents() {
+ if (hasTouchEvents) {
+ $viewport.on('touchstart', touchstart);
+ $thumb.on('touchstart', touchstart);
+ } else {
+ $thumb.on('mousedown', start);
+ $scrollbar.on('mousedown', drag);
+ }
+
+ angular.element($window).on('resize', resize);
+
+ if (self.options.wheel) {
+ $element.on(wheelEvent, wheel);
+ }
+ }
+
+ function resize() {
+ self.update();
+ }
+
+ function touchstart(event) {
+ if (1 === event.touches.length) {
+ event.stopPropagation();
+ start(event.touches[0]);
+ }
+ }
+
+ function start(event) {
+ $body.addClass('scroll-no-select');
+ $element.addClass('scroll-no-select');
+
+ if (!self.options.alwaysVisible) {
+ $scrollbar.addClass('visible');
+ }
+ mousePosition = isHorizontal ? event.clientX : event.clientY;
+ self.thumbPosition = parseInt($thumb.css(posiLabel), 10) || 0;
+
+ if (hasTouchEvents) {
+ documnetscrolltouch = false;
+ thumbscrolltouch = false;
+ $viewport.on('touchmove', touchdrag);
+ $viewport.on('touchend', end);
+ $thumb.on('touchmove', touchdragthumb);
+ $thumb.on('touchend', end);
+ } else {
+ $document.on('mousemove', drag);
+ $document.on('mouseup', end);
+ $thumb.on('mouseup', end);
+ }
+ }
+
+ function wheel(event) {
+ if (self.contentRatio >= 1) {
+ return;
+ }
+
+ if (!self.options.alwaysVisible) {
+ //cancel removing visibility if wheel event is triggered before the timeout
+ if (restoreVisibilityAfterWheel) {
+ $timeout.cancel(restoreVisibilityAfterWheel);
+ }
+ $scrollbar.addClass('visible');
+
+ restoreVisibilityAfterWheel = $timeout(function () {
+ $scrollbar.removeClass('visible');
+ }, 100);
+ }
+
+ var evntObj = (event && event.originalEvent) || event || $window.event,
+ deltaDir = self.options.axis.toUpperCase(),
+ delta = {
+ X: evntObj.deltaX || 0,
+ Y: evntObj.deltaY || 0
+ },
+ wheelSpeed = evntObj.deltaMode === 0 ? self.options.wheelSpeed : 1;
+
+ if (self.options.scrollInvert) {
+ wheelSpeed *= -1;
+ }
+
+ if (wheelEvent === 'mousewheel') {
+ delta.Y = -1 * evntObj.wheelDelta / 40;
+ if (evntObj.wheelDeltaX) {
+ delta.X = -1 * evntObj.wheelDeltaX / 40;
+ }
+ }
+ delta.X *= -1 / wheelSpeed;
+ delta.Y *= -1 / wheelSpeed;
+
+ var wheelSpeedDelta = delta[deltaDir];
+
+ self.contentPosition -= wheelSpeedDelta * self.options.wheelSpeed;
+ self.contentPosition = Math.min((self.contentSize - self.viewportSize), Math.max(0, self.contentPosition));
+
+ fireEvent($element[0], 'move');
+
+ ensureContentPosition();
+ $thumb.css(posiLabel, self.contentPosition / self.trackRatio + 'px');
+ $overview.css(posiLabel, -self.contentPosition + 'px');
+
+ if (self.options.wheelLock || (self.contentPosition !== (self.contentSize - self.viewportSize) && self.contentPosition !== 0)) {
+ evntObj.preventDefault();
+ }
+
+ $scope.$apply();
+ }
+
+ function touchdrag(event) {
+ event.preventDefault();
+ documnetscrolltouch = true;
+ drag(event.touches[0]);
+ }
+
+ function touchdragthumb(event) {
+ event.preventDefault();
+ thumbscrolltouch = true;
+ drag(event.touches[0]);
+ }
+
+ function drag(event) {
+ if (self.contentRatio >= 1) {
+ return;
+ }
+
+ var mousePositionNew = isHorizontal ? event.clientX : event.clientY,
+ thumbPositionDelta = mousePositionNew - mousePosition;
+
+ if ((self.options.scrollInvert && !hasTouchEvents) ||
+ (hasTouchEvents && !self.options.scrollInvert)) {
+ thumbPositionDelta = mousePosition - mousePositionNew;
+ }
+ if (documnetscrolltouch && hasTouchEvents) {
+ thumbPositionDelta = mousePosition - mousePositionNew;
+ }
+ if (thumbscrolltouch && hasTouchEvents) {
+ thumbPositionDelta = mousePositionNew - mousePosition;
+ }
+ var thumbPositionNew = Math.min((self.trackSize - self.thumbSize), Math.max(0, self.thumbPosition + thumbPositionDelta));
+ self.contentPosition = thumbPositionNew * self.trackRatio;
+
+ fireEvent($element[0], 'move');
+
+ ensureContentPosition();
+ $thumb.css(posiLabel, thumbPositionNew + 'px');
+ $overview.css(posiLabel, -self.contentPosition + 'px');
+
+ $scope.$apply();
+ }
+
+ $scope.customScroll = function (direction) {
+ if (self.contentRatio >= 1) {
+ return;
+ }
+
+ var customScrollDelta;
+ var viewportDimension = $position.position($viewport);
+
+ if (isHorizontal) {
+ customScrollDelta = viewportDimension.width;
+ } else {
+ customScrollDelta = viewportDimension.height;
+ }
+
+ if (direction) {
+ self.contentPosition += customScrollDelta;
+ } else {
+ self.contentPosition -= customScrollDelta;
+ }
+ self.contentPosition = Math.min((self.contentSize - self.viewportSize), Math.max(0, self.contentPosition));
+
+ fireEvent($element[0], 'move');
+
+ ensureContentPosition();
+ $thumb.css(posiLabel, self.contentPosition / self.trackRatio + 'px');
+ $overview.css(posiLabel, -self.contentPosition + 'px');
+ };
+
+ function end() {
+ $body.removeClass('scroll-no-select');
+ $element.removeClass('scroll-no-select');
+ if (!self.options.alwaysVisible) {
+ $scrollbar.removeClass('visible');
+ }
+ $document.off('mousemove', drag);
+ $document.off('mouseup', end);
+ $thumb.off('mouseup', end);
+ $document.off('touchmove', touchdrag);
+ $document.off('ontouchend', end);
+ $thumb.off('touchmove', touchdragthumb);
+ $thumb.off('touchend', end);
+ }
+
+ this.cleanup = function () {
+ $viewport.off('touchstart', touchstart);
+ $thumb.off('mousedown', start);
+ $scrollbar.off('mousedown', drag);
+ $thumb.off('touchmove', touchdragthumb);
+ $thumb.off('touchend', end);
+ angular.element($window).off('resize', resize);
+ $element.off(wheelEvent, wheel);
+ //ensure scrollbar isn't activated
+ self.options.alwaysVisible = true;
+ end();
+ };
+ }],
+ link: function (scope, iElement, iAttrs, controller) {
+ scope.navigation = controller.options.navigation;
+ scope.viewportHeight = iAttrs.viewportHeight;
+ scope.viewportWidth = iAttrs.viewportWidth;
+ scope.scrollbarAxis = controller.options.axis;
+ if (scope.scrollbarAxis === 'x') {
+ iElement.addClass('horizontal');
+ } else if (scope.scrollbarAxis === 'y') {
+ iElement.addClass('vertical');
+ }
+
+ var position = iElement.css('position');
+ if (position !== 'relative' && position !== 'absolute') {
+ iElement.css('position', 'relative');
+ }
+
+ scope.$watch(function () {
+ $timeout(refreshScrollbar, 100, false);
+ });
+
+ var refreshScrollbar = function () {
+ var $overview = angular.element(iElement[0].querySelectorAll('.scroll-overview')[0]);
+ var newValue = $overview.prop('scrollHeight');
+ var oldValue = scope.oldValue;
+ if (newValue !== oldValue) {
+ scope.oldValue = newValue;
+ controller.update();
+ }
+ };
+
+ controller.initialize();
+ iElement.on('$destroy', function () {
+ controller.cleanup();
+ });
+ }
+ };
+}]);
+
+angular.module('att.abs.search', ['att.abs.utilities', 'att.abs.position', 'att.abs.utilities'])
+.directive('attSearch', ['$document', '$filter', '$isElement', '$documentBind', '$timeout', '$log', 'keymap', function($document, $filter, $isElement, $documentBind, $timeout, $log, keymap){
+ return{
+ restrict: 'A',
+ scope:{cName: '=attSearch'},
+ transclude: false,
+ replace: false,
+ require:'ngModel',
+ templateUrl: 'app/scripts/ng_js_att_tpls/search/search.html',
+ link: function(scope, element, attr, ctrl) {
+ scope.selectedIndex = -1;
+ scope.selectedOption = attr.placeholder;
+ scope.isDisabled = false;
+ scope.className = "select2-match";
+ scope.showSearch = false;
+ scope.showlist = false;
+
+ // This is used to jump to elements in list
+ var search = '';
+ // This is used to ensure searches only persist so many ms.
+ var prevSearchDate = new Date();
+ // This is used to shift focus back after closing dropdown
+ var dropdownElement = undefined;
+ // Used to ensure focus on dropdown elements
+ var list = [];
+ $timeout(function() {
+ list = element.find('li');
+ }, 10);
+
+ $log.warn('attSearch is deprecated, please use attSelect instead. This component will be removed by version 2.7.')
+ //scope.noFilter = true;
+ if (attr.noFilter || attr.noFilter === 'true') {
+ scope.noFilter = true;
+ } else {
+ scope.noFilter = false;
+ }
+ if (attr.placeholderAsOption === 'false') {
+ //scope.selectMsg = '';
+ scope.selectedOption = attr.placeholder;
+ } else {
+ scope.selectMsg = attr.placeholder;
+ }
+ if (attr.startsWithFilter || attr.startsWithFilter === 'true') {
+ scope.startsWithFilter = true;
+ }
+ if (attr.showInputFilter === 'true') {
+ scope.showSearch = false;
+ $log.warn('showInputFilter functionality has been removed from the library.');
+ // This is deprecated
+ }
+ if (attr.disabled) {
+ scope.isDisabled = true;
+ }
+ dropdownElement = angular.element(element).children().eq(0).find('a')[0];
+ var prevIndex = 0;
+ var selectOptionFromSearch = function() {
+ if (!scope.noFilter) {
+ return;
+ }
+
+ // Find next element that matches search criteria.
+ // If no element is found, loop to beginning and search.
+ var criteria = search;
+ var i = 0;
+ for (i = prevIndex; i < scope.cName.length; i++) {
+ // Need to ensure we keep searching until all startsWith have passed before looping
+ if (scope.cName[i].title.startsWith(criteria) && i !== scope.selectedIndex) {
+ scope.selectOption(scope.cName[i], i, scope.showlist);
+ prevIndex = i;
+ search = '';
+ break;
+ }
+ }
+ if ((i >= scope.cName.length || !scope.cName[i+1].title.startsWith(criteria)) && prevIndex > 0) {
+ prevIndex = 0;
+ }
+ };
+ scope.showDropdown = function() {
+ if (!(attr.disabled)) {
+ scope.showlist = !scope.showlist;
+ scope.setSelectTop();
+ }
+ };
+ element.bind('keydown', function(e) {
+ if (keymap.isAllowedKey(e.keyCode) || keymap.isControl(e) || keymap.isFunctionKey(e)) {
+ e.preventDefault();
+ e.stopPropagation();
+
+ switch (e.keyCode) {
+ case keymap.KEY.DOWN:
+ scope.selectNext();
+ break;
+ case keymap.KEY.UP:
+ scope.selectPrev();
+ search = '';
+ break;
+ case keymap.KEY.ENTER:
+ scope.selectCurrent();
+ search = '';
+ break;
+ case keymap.KEY.BACKSPACE:
+ scope.title = '';
+ search = '';
+ scope.$apply();
+ break;
+ case keymap.KEY.SPACE:
+ if (!scope.noFilter) {
+ scope.title += ' ';
+ }
+ scope.$apply();
+ break;
+ case keymap.KEY.ESC:
+ if (scope.title === '' || scope.title === undefined) {
+ scope.showlist = false;
+ dropdownElement.focus();
+ scope.$apply();
+ } else {
+ scope.title = '';
+ scope.$apply();
+ }
+ if (scope.noFilter) {
+ search = '';
+ dropdownElement.focus();
+ scope.showlist = false;
+ }
+ break;
+ default:
+ break;
+ }
+ } else {
+ if (e.keyCode !== 9)
+ {
+ if (!scope.noFilter) {
+ scope.showlist = true;
+ scope.title = scope.title ? scope.title + String.fromCharCode(e.keyCode) : String.fromCharCode(e.keyCode);
+ } else {
+ var date = new Date();
+ var delta = Math.abs(prevSearchDate.getMilliseconds() - date.getMilliseconds());
+ prevSearchDate = date;
+ if (delta > 100) {
+ search = '';
+ }
+ search = search ? search + String.fromCharCode(e.keyCode) : String.fromCharCode(e.keyCode);
+ if (search.length > 2) {
+ search = search.substring(0, 2);
+ }
+ selectOptionFromSearch();
+ }
+ scope.$apply();
+ } else if (e.keyCode === 9) {
+ scope.showlist = false;
+ scope.title = '';
+ scope.$apply();
+ }
+ }
+ });
+ scope.selectOption = function(sTitle, sIndex, keepOpen) {
+ if (sIndex === -1 || sIndex === '-1') {
+ scope.selCategory = '';
+ scope.selectedIndex = -1;
+ ctrl.$setViewValue('');
+ if(attr.placeholderAsOption !== 'false')
+ {
+ scope.selectedOption = scope.selectMsg;
+ }
+ } else {
+ scope.selCategory = scope.cName[sIndex];
+ scope.selectedIndex = sIndex;
+ ctrl.$setViewValue(scope.selCategory);
+ scope.selectedOption = scope.selCategory.title;
+ if (angular.isDefined(list[sIndex])) {
+ list[sIndex].focus();
+ }
+ }
+ scope.title = '';
+ if (!keepOpen) {
+ scope.showlist = false;
+ dropdownElement.focus();
+ }
+ scope.$apply();
+ };
+ scope.selectCurrent = function() {
+ if (scope.showlist) {
+ scope.selectOption(scope.selectMsg, scope.selectedIndex, false);
+ scope.$apply();
+ } else {
+ scope.showlist = true;
+ scope.setSelectTop();
+ scope.$apply();
+ }
+ };
+ scope.hoverIn = function(cItem) {
+ scope.selectedIndex = cItem;
+ scope.focusme();
+ };
+ scope.setSelectTop = function() {
+ $timeout(function() {
+ if (scope.showlist && !scope.noFilter)
+ {
+ var containerUL = angular.element(element)[0].querySelector(".select2-results");
+ if(angular.element(containerUL.querySelector('.select2-result-current'))[0])
+ {
+ var selectedElemTopPos = angular.element(containerUL.querySelector('.select2-result-current'))[0].offsetTop;
+ }
+ angular.element(containerUL)[0].scrollTop = selectedElemTopPos;
+ }
+ });
+ };
+ scope.setCurrentTop = function() {
+ $timeout(function() {
+ if (scope.showlist) {
+ var containerUL = angular.element(element)[0].querySelector(".select2-results");
+ if(angular.element(containerUL.querySelector('.hovstyle'))[0])
+ {
+ var selectedElemTopPos = angular.element(containerUL.querySelector('.hovstyle'))[0].offsetTop;
+ }
+ if (selectedElemTopPos < (angular.element(containerUL)[0].scrollTop)) {
+ angular.element(containerUL)[0].scrollTop -= 30;
+ } else if ((selectedElemTopPos + 30) > (angular.element(containerUL)[0].clientHeight)) {
+ angular.element(containerUL)[0].scrollTop += 30;
+ }
+
+ }
+ });
+ };
+ scope.selectNext = function() {
+ if ((scope.selectedIndex + 1) <= (scope.cName.length - 1)) {
+ scope.selectedIndex += 1;
+ if (!scope.showlist) {
+ scope.selectOption(scope.selectMsg, scope.selectedIndex, false);
+ }
+ scope.focusme();
+ scope.$apply();
+ }
+ scope.setCurrentTop();
+ };
+ scope.selectPrev = function() {
+ if ((scope.selectedIndex - 1) >= 0) {
+ scope.selectedIndex -= 1;
+ if (!scope.showlist) {
+ scope.selectOption(scope.selectMsg, scope.selectedIndex, false);
+ }
+ scope.focusme();
+ scope.$apply();
+ } else if (scope.selectedIndex - 1 < 0) {
+ // If placeholderAsOption is true or undefined (default), ensure we can select it on up key.
+ if (attr.placeholderAsOption === undefined || attr.placeholderAsOption === 'true') {
+ scope.selectedIndex = -1;
+ } else {
+ scope.selectedIndex = 0;
+ }
+ if (!scope.showlist) {
+ scope.selectOption(scope.selectMsg, scope.selectedIndex, false);
+ }
+ scope.focusme();
+ scope.$apply();
+ }
+ scope.setCurrentTop();
+ };
+ scope.updateSelection = function(sItem) {
+ scope.selectedOption = sItem.title;
+ scope.title = "";
+ };
+ scope.focusme = function() {
+ $timeout(function() {
+ var list = angular.element(element).find('ul').find('li');
+ var index = scope.selectedIndex + 2;
+ if (scope.noFilter) {
+ index = scope.selectedIndex;
+ }
+ if (angular.isDefined(list[index])) {
+ list[index].focus();
+ }
+ });
+ };
+ scope.$watch('selCategory', function(value) {
+ if (value) {
+ scope.updateSelection(value);
+ };
+ });
+ ctrl.$viewChangeListeners.push(function() {
+ scope.$eval(attr.ngChange);
+ });
+ ctrl.$render = function() {
+ scope.selCategory = ctrl.$viewValue;
+ };
+ var outsideClick = function(e) {
+ var isElement = $isElement(angular.element(e.target), element, $document);
+ if (!isElement) {
+ scope.showlist = false;
+ dropdownElement.focus();
+ scope.$apply();
+ }
+ };
+ $documentBind.click('showlist', outsideClick, scope);
+ }
+ };
+}]);
+angular.module('att.abs.select', ['att.abs.utilities', 'att.abs.position', 'att.abs.utilities'])
+.directive('attSelect', ["$document", "$filter", "$isElement", '$documentBind', '$timeout', 'keymap', '$log', function($document, $filter, $isElement, $documentBind, $timeout, keymap, $log) {
+ return {
+ restrict: 'A',
+ scope: {
+ cName: '=attSelect'
+ },
+ transclude: false,
+ replace: false,
+ require: 'ngModel',
+ templateUrl: 'app/scripts/ng_js_att_tpls/select/select.html',
+ link: function(scope, element, attr, ctrl) {
+ scope.selectedIndex = -1;
+ scope.selectedOption = attr.placeholder;
+ scope.isDisabled = false;
+ scope.className = "select2-match";
+ scope.showSearch = false;
+ scope.showlist = false;
+ scope.titleName = attr.titlename;
+ scope.$watch('ngModel', function() {
+ // console.log('sv:', ctrl.$modelValue);
+ });
+
+ // This is used to jump to elements in list
+ var search = '';
+ // This is used to ensure searches only persist so many ms.
+ var prevSearchDate = new Date();
+ // This is used to shift focus back after closing dropdown
+ var dropdownElement = undefined;
+ // Used to ensure focus on dropdown elements
+ var list = [];
+ $timeout(function() {
+ list = element.find('li');
+ }, 10);
+ //scope.noFilter = true;
+ if (attr.noFilter || attr.noFilter === 'true') {
+ scope.noFilter = true;
+ } else {
+ scope.noFilter = false;
+ }
+ if (attr.placeholderAsOption === 'false') {
+ scope.selectedOption = attr.placeholder;
+ } else {
+ scope.selectMsg = attr.placeholder;
+ }
+ if (attr.startsWithFilter || attr.startsWithFilter === 'true') {
+ scope.startsWithFilter = true;
+ }
+ if (attr.showInputFilter === 'true') {
+ scope.showSearch = false;
+ /* This is deprecated */
+ $log.warn('showInputFilter functionality has been removed from the library.');
+ }
+ if (attr.disabled) {
+ scope.isDisabled = true;
+ }
+ var getFilterType = function() {
+ if (scope.startsWithFilter) {
+ return 'startsWith';
+ } else {
+ return 'filter';
+ }
+ };
+ dropdownElement = angular.element(element).children().eq(0).find('span')[0];
+ var prevIndex = 0;
+ var selectOptionFromSearch = function() {
+ if (!scope.noFilter) {
+ return;
+ }
+
+ // Find next element that matches search criteria.
+ // If no element is found, loop to beginning and search.
+ var criteria = search;
+ var i = 0;
+ for (i = prevIndex; i < scope.cName.length; i++) {
+ // Need to ensure we keep searching until all startsWith have passed before looping
+ if (scope.cName[i].title.startsWith(criteria) && i !== scope.selectedIndex) {
+ scope.selectOption(scope.cName[i], i, scope.showlist);
+ prevIndex = i;
+ search = '';
+ break;
+ }
+ }
+ if ((i >= scope.cName.length || !scope.cName[i+1].title.startsWith(criteria)) && prevIndex > 0) {
+ prevIndex = 0;
+ }
+ };
+ scope.showDropdown = function() {
+ if (!(attr.disabled)) {
+ scope.showlist = !scope.showlist;
+ scope.setSelectTop();
+ /* Ensure selected element is focused upon opening dropdown */
+ scope.focusme();
+ }
+ };
+ element.bind('keydown', function(e) {
+ if (keymap.isAllowedKey(e.keyCode) || keymap.isControl(e) || keymap.isFunctionKey(e)) {
+ e.preventDefault();
+ e.stopPropagation();
+
+ switch (e.keyCode) {
+ case keymap.KEY.DOWN:
+ scope.selectNext();
+ break;
+ case keymap.KEY.UP:
+ scope.selectPrev();
+ search = '';
+ break;
+ case keymap.KEY.ENTER:
+ scope.selectCurrent();
+ search = '';
+ break;
+ case keymap.KEY.BACKSPACE:
+ scope.title = '';
+ search = '';
+ scope.$apply();
+ break;
+ case keymap.KEY.SPACE:
+ if (!scope.noFilter) {
+ scope.title += ' ';
+ }
+ scope.$apply();
+ break;
+ case keymap.KEY.ESC:
+ if (scope.title === '' || scope.title === undefined) {
+ scope.showlist = false;
+ dropdownElement.focus();
+ scope.$apply();
+ } else {
+ scope.title = '';
+ scope.$apply();
+ }
+ if (scope.noFilter) {
+ search = '';
+ dropdownElement.focus();
+ scope.showlist = false;
+ }
+ break;
+ default:
+ break;
+ }
+ } else {
+ if (e.keyCode !== keymap.KEY.TAB)
+ {
+ if (!scope.noFilter) {
+ scope.showlist = true;
+ scope.title = scope.title ? scope.title + String.fromCharCode(e.keyCode) : String.fromCharCode(e.keyCode);
+
+ /* Perform index correction */
+ if (scope.title != '') {
+ var filteredArray = $filter(getFilterType())(scope.cName, scope.title);
+
+ for (var i = 0; i < filteredArray.length; i++) {
+ for (var j = 0; j < scope.cName.length; j++) {
+ if (!angular.isDefined(scope.cName[scope.selectedIndex])) {
+ break;
+ }
+ if (filteredArray[i]['title'] === scope.cName[scope.selectedIndex]['title']) {
+ scope.selectedIndex = i;
+ scope.focusme();
+ break;
+ }
+ }
+ }
+ }
+ } else {
+ var date = new Date();
+ var delta = Math.abs(prevSearchDate.getMilliseconds() - date.getMilliseconds());
+ prevSearchDate = date;
+ if (delta > 100) {
+ search = '';
+ }
+ search = search ? search + String.fromCharCode(e.keyCode) : String.fromCharCode(e.keyCode);
+ if (search.length > 2) {
+ search = search.substring(0, 2);
+ }
+ selectOptionFromSearch();
+ }
+ scope.$apply();
+ } else if (e.keyCode === keymap.KEY.TAB) {
+ scope.showlist = false;
+ scope.title = '';
+ scope.$apply();
+ }
+ }
+ });
+ scope.selectOption = function(sTitle, sIndex, keepOpen) {
+
+ if (sIndex === -1 || sIndex === '-1') {
+ scope.selCategory = '';
+ scope.selectedIndex = -1;
+ ctrl.$setViewValue('');
+ if(attr.placeholderAsOption !== 'false')
+ {
+ scope.selectedOption = scope.selectMsg;
+ }
+ }
+ else {
+ /* Apply filter here to remap the selected index and shift focus*/
+ if (scope.title != '') {
+ var filteredArray = $filter(getFilterType())(scope.cName, scope.title);
+
+ if (angular.isDefined(filteredArray) && angular.isDefined(filteredArray[sIndex]))
+ {
+ for (var i = 0; i < scope.cName.length; i++) {
+ if (filteredArray[sIndex]['title'] === scope.cName[i]['title']) {
+ sIndex = i;
+ break;
+ }
+ }
+ }
+ }
+ scope.selCategory = scope.cName[sIndex];
+ scope.selectedIndex = sIndex;
+ ctrl.$setViewValue(scope.selCategory);
+ scope.selectedOption = scope.selCategory.title;
+ ctrl.$render();
+
+ $timeout(function(){
+ if (angular.isDefined(list[sIndex])) {
+ try{
+ list[index].focus();
+ } catch (e) {} /* IE8 will throw exception if display:none or not in DOM */
+ }
+ });
+ }
+ scope.title = '';
+ if (!keepOpen) {
+ scope.showlist = false;
+ dropdownElement.focus();
+ }
+ };
+ scope.selectCurrent = function() {
+ if (scope.showlist) {
+ scope.selectOption(scope.selectMsg,scope.selectedIndex,false);
+ } else {
+ scope.showlist = true;
+ scope.setSelectTop();
+ }
+ scope.$apply();
+ };
+ scope.hoverIn = function(cItem) {
+ scope.selectedIndex = cItem;
+ scope.focusme();
+ };
+ scope.setSelectTop = function() {
+ $timeout(function() {
+ if (scope.showlist && !scope.noFilter)
+ {
+ var containerUL = angular.element(element)[0].querySelector(".select2-results");
+ if(angular.element(containerUL.querySelector('.select2-result-current'))[0])
+ {
+ var selectedElemTopPos = angular.element(containerUL.querySelector('.select2-result-current'))[0].offsetTop;
+ }
+ angular.element(containerUL)[0].scrollTop = selectedElemTopPos;
+ }
+ });
+ };
+ scope.setCurrentTop = function() {
+ $timeout(function() {
+ if (scope.showlist) {
+ var containerUL = angular.element(element)[0].querySelector(".select2-results");
+ if(angular.element(containerUL.querySelector('.hovstyle'))[0])
+ {
+ var selectedElemTopPos = angular.element(containerUL.querySelector('.hovstyle'))[0].offsetTop;
+ }
+ if (selectedElemTopPos < (angular.element(containerUL)[0].scrollTop)) {
+ angular.element(containerUL)[0].scrollTop -= 30;
+ } else if ((selectedElemTopPos + 30) > (angular.element(containerUL)[0].clientHeight)) {
+ angular.element(containerUL)[0].scrollTop += 30;
+ }
+
+ }
+ });
+ };
+ scope.selectNext = function() {
+ var length = scope.cName.length;
+
+ if ((scope.selectedIndex + 1) <= (scope.cName.length - 1)) {
+ scope.selectedIndex += 1;
+ var nextDisabled = scope.cName[scope.selectedIndex].disabled;
+ if (nextDisabled) {
+ scope.selectedIndex += 1;
+ }
+ if (!scope.showlist) {
+ scope.selectOption(scope.selectMsg, scope.selectedIndex,false);
+ }
+ scope.focusme();
+ scope.$apply();
+ }
+ scope.setCurrentTop();
+ };
+ scope.selectPrev = function() {
+ if ((scope.selectedIndex - 1) >= 0) {
+ scope.selectedIndex -= 1;
+ var prevDisabled = scope.cName[scope.selectedIndex].disabled;
+ if (prevDisabled) {
+ scope.selectedIndex -= 1;
+ }
+ if (!scope.showlist) {
+ scope.selectOption(scope.selectMsg, scope.selectedIndex,false);
+ }
+ scope.focusme();
+ scope.$apply();
+ } else if (scope.selectedIndex - 1 < 0) {
+ // If placeholderAsOption is true or undefined (default), ensure we can select it on up key.
+ if (attr.placeholderAsOption === undefined || attr.placeholderAsOption === 'true') {
+ if(attr.placeholder === undefined ){
+ scope.selectedIndex = 0;
+ }
+ else{
+ scope.selectedIndex = -1;
+ }
+ } else {
+ scope.selectedIndex = 0;
+ }
+ if (!scope.showlist) {
+ scope.selectOption(scope.selectMsg, scope.selectedIndex,false);
+ }
+ scope.focusme();
+ scope.$apply();
+ }
+ scope.setCurrentTop();
+ };
+ scope.updateSelection = function(sItem) {
+ scope.selectedOption = sItem.title;
+ scope.title = '';
+
+ if (sItem.index < 0) {
+ scope.selectOption(scope.selectMsg, sItem.index, scope.showlist);
+ }
+ };
+ scope.focusme = function() {
+ $timeout(function() {
+ var list = angular.element(element).find('ul').find('li');
+ var index = scope.selectedIndex + 2;
+ if (scope.noFilter) {
+ index = scope.selectedIndex;
+ }
+ if (angular.isDefined(list[index])) {
+ try {
+ list[index].focus();
+ } catch (e) {} /* IE8 will throw exception if display:none or not in DOM */
+ }
+ });
+ };
+ scope.$watch('selCategory', function(value) {
+ if (value) {
+ scope.updateSelection(value);
+ };
+ });
+ ctrl.$viewChangeListeners.push(function() {
+ scope.$eval(attr.ngChange);
+ });
+ ctrl.$render = function() {
+ scope.selCategory = ctrl.$viewValue;
+ };
+ var outsideClick = function(e) {
+ var isElement = $isElement(angular.element(e.target), element, $document);
+ if (!isElement) {
+ scope.showlist = false;
+ dropdownElement.focus();
+ scope.$apply();
+ }
+ };
+ $documentBind.click('showlist', outsideClick, scope);
+ }
+ };
+}])
+.directive('textDropdown', ['$document', '$isElement', '$documentBind', "keymap", function($document, $isElement, $documentBind, keymap) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ scope: {
+ actions: '=actions',
+ defaultAction: '=defaultAction',
+ onActionClicked: '=?'
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/select/textDropdown.html',
+ link: function(scope, element, attr) {
+ scope.selectedIndex = 0;
+ scope.selectedOption = attr.placeholder;
+ scope.isDisabled = false;
+ scope.isActionsShown = false;
+ var dropdownElement = undefined;
+ if (attr.disabled) {
+ scope.isDisabled = true;
+ }
+
+ dropdownElement = element.find('div')[0];
+
+ // Set default Action
+ if (!angular.isDefined(scope.defaultAction)) {
+ scope.currentAction = scope.actions[0];
+ scope.selectedIndex = 0;
+ } else if (angular.isDefined(scope.defaultAction) || scope.defaultAction !== '') {
+ for (var act in scope.actions) {
+ if (scope.actions[act] === scope.defaultAction) {
+ scope.currentAction = scope.actions[act];
+ scope.selectedIndex = scope.actions.indexOf(act);
+ scope.isActionsShown = false;
+ break;
+ }
+ }
+ } else {
+ scope.currentAction = scope.actions[0];
+ }
+ scope.toggle = function() {
+ scope.isActionsShown = !scope.isActionsShown;
+ };
+ scope.chooseAction = function($event, action, $index) {
+ if ($event != null) {
+ scope.currentAction = action;
+ scope.selectedIndex = $index;
+ } else {
+ scope.currentAction = scope.actions[scope.selectedIndex];
+ }
+ if (angular.isFunction(scope.onActionClicked)) {
+ scope.onActionClicked(scope.currentAction);
+ }
+ scope.toggle();
+ };
+ scope.isCurrentAction = function(action) {
+ return (action === scope.currentAction);
+ };
+ element.bind("keydown", function(e) {
+ if (keymap.isAllowedKey(e.keyCode) || keymap.isControl(e) || keymap.isFunctionKey(e)) {
+ e.preventDefault();
+ e.stopPropagation();
+ switch (e.keyCode) {
+ case keymap.KEY.DOWN:
+ scope.selectNext();
+ break;
+ case keymap.KEY.UP:
+ scope.selectPrev();
+ break;
+ case keymap.KEY.ENTER:
+ scope.selectCurrent();
+ break;
+ case keymap.KEY.ESC:
+ scope.isActionsShown = false;
+ dropdownElement.focus();
+ scope.$apply();
+ break;
+ default:
+ break;
+ }
+ scope.$apply();
+ return;
+ } else if (e.keyCode === keymap.KEY.TAB) {
+ scope.isActionsShown = false;
+ scope.$apply();
+ }
+ });
+ scope.selectCurrent = function() {
+ if (scope.selectedIndex < 0) {
+ scope.selectedIndex = 0;
+ }
+ if (!scope.isActionsShown) {
+ scope.toggle();
+ } else {
+ scope.chooseAction(null, scope.currentAction);
+ }
+ };
+ scope.selectNext = function() {
+ if (scope.isActionsShown) {
+ if ((scope.selectedIndex + 1) < scope.actions.length) {
+ scope.selectedIndex += 1;
+ } else {
+ scope.selectedIndex = (scope.actions.length - 1);
+ }
+ scope.$apply();
+ }
+ };
+ scope.selectPrev = function() {
+ if (scope.isActionsShown) {
+ if ((scope.selectedIndex - 1) >= 0) {
+ scope.selectedIndex -= 1;
+ } else if (scope.selectedIndex - 1 < 0) {
+ scope.selectedIndex = 0;
+ }
+ scope.$apply();
+ }
+ };
+ scope.hoverIn = function(cItem) {
+ scope.selectedIndex = cItem;
+ };
+ //end cato
+ var outsideClick = function(e) {
+ var isElement = $isElement(angular.element(e.target), element, $document);
+ if (!isElement) {
+ scope.toggle();
+ scope.$apply();
+ }
+ };
+ $documentBind.click('isActionsShown', outsideClick, scope);
+ }
+ };
+}]);
+angular.module('att.abs.slider', ['att.abs.position'])
+ .constant('sliderDefaultOptions', {
+ width: 300,
+ step: 1,
+ precision: 0,
+ disabledWidth: 116
+ })
+ .directive('attSlider', ['sliderDefaultOptions','$position','$document', function(sliderDefaultOptions,$position,$document)
+ {
+ return {
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ scope: {
+ floor: "=",
+ ceiling: "=",
+ step: "@",
+ precision: "@",
+ width: "@",
+ textDisplay: "=",
+ value: "=",
+ ngModelSingle: '=?',
+ ngModelLow: '=?',
+ ngModelHigh: '=?',
+ ngModelDisabled: '=?'
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/slider/slider.html',
+ link: function(scope, elem, attr)
+ {
+ var minOffset, maxOffset, newOffset, newOffset1, newOffset2, offsetRange, valueRange, start_x = 0, disabledRange, disabled, evFlag = false, minValue, maxValue, range, refLow, refHigh, maxPtr, minPtr, singlePtr, getHandles;
+ scope.minPtrOffset = 0;
+ scope.maxPtrOffset = 0;
+ var disableWidth = sliderDefaultOptions.disabledWidth;
+ //Get handles
+ var obj = elem.children();
+ disabledRange = obj[0].children;
+ disabledRange = angular.element(disabledRange[0]);
+ getHandles = obj[1].children;
+ singlePtr = angular.element(getHandles[0]);
+ minPtr = angular.element(getHandles[1]);
+ maxPtr = angular.element(getHandles[2]);
+ disabled = ((attr.ngModelSingle == null) && (attr.ngModelLow == null) && (attr.ngModelHigh == null)) && (attr.ngModelDisabled != null);
+ range = (attr.ngModelSingle == null) && ((attr.ngModelLow != null) && (attr.ngModelHigh != null));
+ refLow = 'ngModelLow';
+ refHigh = 'ngModelHigh';
+ if (!range) {
+ minPtr.remove();
+ maxPtr.remove();
+ }
+ else {
+ singlePtr.remove();
+ }
+ if (!disabled) {
+ disabledRange.remove();
+ }
+ else {
+ scope.disabledStyle = {width: disableWidth + 'px', zIndex: 1};
+ scope.handleStyle = {left: disableWidth + 'px'};
+ }
+ minValue = parseFloat(scope.floor);
+ maxValue = parseFloat(scope.ceiling);
+ valueRange = maxValue - minValue;
+ minOffset = 0;
+ if (attr.width !== undefined) {
+ maxOffset = attr.width;
+ }
+ else {
+ if (elem[0].clientWidth !== 0) {
+ maxOffset = elem[0].clientWidth;
+ }
+ else {
+ maxOffset = sliderDefaultOptions.width;
+ }
+ }
+ offsetRange = maxOffset - minOffset;
+ //Key Down Event
+ scope.keyDown = function(ev){
+ if(ev.keyCode === 39){
+ var elemLeft = $position.position(elem).left;
+ if (newOffset){
+ if(scope.ref === "ngModelLow"){
+ newOffset1 = sliderDefaultOptions.step + newOffset1;
+ newOffset = newOffset1;
+ }
+ else if(scope.ref === "ngModelHigh"){
+ newOffset2 = sliderDefaultOptions.step + newOffset2;
+ newOffset = newOffset2;
+ }
+ else{newOffset = sliderDefaultOptions.step + newOffset;}
+ }
+ else {
+ if(range &&scope.ref === "ngModelLow"){
+ return;
+ }
+ else {
+ newOffset = sliderDefaultOptions.step + elemLeft;
+ newOffset1 = newOffset2 = newOffset;
+ }
+ }
+ }
+ else if(ev.keyCode === 37){
+ var ptrLeft = $position.position(singlePtr).left;
+ if(newOffset){
+ if (!(newOffset<=0)){
+ if(scope.ref === "ngModelLow"){
+ newOffset1 = newOffset1 - sliderDefaultOptions.step;
+ newOffset = newOffset1;
+ }
+ else if(scope.ref === "ngModelHigh"){
+ newOffset2 = newOffset2 - sliderDefaultOptions.step;
+ newOffset = newOffset2;
+ }
+ else {
+ newOffset = newOffset - sliderDefaultOptions.step;
+ newOffset1 = newOffset2 = newOffset;
+ }
+ }
+ }
+ else {
+ newOffset = ptrLeft - sliderDefaultOptions.step;
+ }
+ }
+ if(newOffset>=0){
+ scope.ptrOffset(newOffset);
+ }
+ };
+ //Mouse Down Event
+ scope.mouseDown = function(e, ref) {
+ scope.ref = ref;
+ evFlag = true;
+ if (!range){
+ if (newOffset)
+ {
+ start_x = e.clientX - newOffset;
+ }
+ else {
+ start_x = e.clientX;
+ }
+ } else {
+ if (scope.ref === refLow) {
+ start_x = e.clientX - scope.minPtrOffset;
+ }
+ else {
+ start_x = e.clientX - scope.maxPtrOffset;
+ }
+ }
+ if (disabled) {
+ scope.ref= 'ngModelDisabled';
+ scope.disabledStyle = {width: disableWidth + 'px', zIndex: 1};
+ }
+ };
+ // Mouse Move Event
+ scope.moveElem = function(ev) {
+ if (evFlag) {
+ var eventX;
+ eventX = ev.clientX;
+ newOffset = eventX - start_x;
+ scope.ptrOffset(newOffset);
+ }
+ };
+ scope.focus=function(ev,ref){
+ console.log(ref);
+ scope.ref=ref;
+ }
+ // Mouse Up Event
+ scope.mouseUp = function(ev) {
+ evFlag = false;
+ minPtr.removeClass('dragging');
+ maxPtr.removeClass('dragging');
+ singlePtr.removeClass('dragging');
+ $document.off('mousemove');
+ };
+ // key Up Event
+ scope.keyUp = function(ev) {
+ evFlag = false;
+ minPtr.removeClass('dragging');
+ maxPtr.removeClass('dragging');
+ singlePtr.removeClass('dragging');
+ $document.off('mousemove');
+ };
+ //Function to calculate the current PositionValue
+ scope.calStep = function(value, precision, step, floor) {
+ var decimals, remainder, roundedValue, steppedValue;
+ if (floor === null) {
+ floor = 0;
+ }
+ if (step === null) {
+ step = 1 / Math.pow(10, precision);
+ }
+ remainder = (value - floor) % step;
+ steppedValue = remainder > (step / 2) ? value + step - remainder : value - remainder;
+ decimals = Math.pow(10, precision);
+ roundedValue = steppedValue * decimals / decimals;
+ return roundedValue.toFixed(precision);
+ };
+ //Function to calculate Offset Percent
+ scope.percentOffset = function(offset) {
+ return ((offset - minOffset) / offsetRange) * 100;
+ };
+ //Function to calculate Offset position
+ scope.ptrOffset = function(newOffset){
+ var newPercent, newValue;
+ newOffset = Math.max(Math.min(newOffset, maxOffset), minOffset);
+ newPercent = scope.percentOffset(newOffset);
+ newValue = minValue + (valueRange * newPercent / 100.0);
+ if (range) {
+ var rangeSliderWidth;
+ if (scope.ref === refLow) {
+ scope.minHandleStyle = {left: newOffset + "px"};
+ scope.minNewVal = newValue;
+ scope.minPtrOffset = newOffset;
+ minPtr.addClass('dragging');
+ if (newValue > scope.maxNewVal) {
+ scope.ref = refHigh;
+ maxPtr[0].focus();
+ scope.maxNewVal = newValue;
+ scope.maxPtrOffset = newOffset;
+ maxPtr.addClass('dragging');
+ minPtr.removeClass('dragging');
+ scope.maxHandleStyle = {left: newOffset + "px"};
+ }
+ }
+ else {
+ scope.maxHandleStyle = {left: newOffset + "px"};
+ scope.maxNewVal = newValue;
+ scope.maxPtrOffset = newOffset;
+ maxPtr.addClass('dragging');
+ if (newValue < scope.minNewVal) {
+ scope.ref = refLow;
+ minPtr[0].focus();
+ scope.minVal = newValue;
+ scope.minPtrOffset = newOffset;
+ minPtr.addClass('dragging');
+ maxPtr.removeClass('dragging');
+ scope.minHandleStyle = {left: newOffset + "px"};
+ }
+ }
+ rangeSliderWidth = parseInt(scope.maxPtrOffset) - parseInt(scope.minPtrOffset);
+ scope.rangeStyle = {width: rangeSliderWidth + "px", left: scope.minPtrOffset + "px"};
+ }
+ else {
+ if (disabled && newOffset > disableWidth) {
+ scope.rangeStyle = {width: newOffset + "px", zIndex: 0};
+ }
+ else {
+ singlePtr.addClass('dragging');
+ scope.rangeStyle = {width: newOffset + "px"};
+ }
+ scope.handleStyle = {left: newOffset + "px"};
+ }
+ if ((scope.precision === undefined) || (scope.step === undefined)) {
+ scope.precision = sliderDefaultOptions.precision;
+ scope.step = sliderDefaultOptions.step;
+ }
+ newValue = scope.calStep(newValue, parseInt(scope.precision), parseFloat(scope.step), parseFloat(scope.floor));
+ scope[scope.ref] = newValue;
+ };
+ }
+ };
+ }
+ ]).directive('attSliderMin',[function()
+ {
+ return{
+ require: '^attSlider',
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/slider/minContent.html'
+ };
+ }
+ ]).directive('attSliderMax',[function()
+ {
+ return{
+ require: '^attSlider',
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/slider/maxContent.html'
+ };
+ }
+ ]);
+angular.module('att.abs.splitButtonDropdown', ['att.abs.utilities','att.abs.position'])
+ .directive('attButtonDropdown', ['$document', '$parse', '$documentBind', '$timeout','$isElement', function ($document, $parse, $documentBind, $timeout,$isElement) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdown.html',
+ scope: {
+ btnText: "@",
+ btnType: "@",
+ btnLink: "@",
+ btnClick: "&",
+ toggleTitle:"@",
+ },
+ controller: ['$scope', '$element', function ($scope, $element) {
+
+ this.cSelected = 0;
+ this.closeAndFocusDropdown = function () {
+ if ($scope.isDropDownOpen) {
+ $scope.$apply(function () {
+ $scope.isDropDownOpen = false;
+ angular.element($element[0].querySelector('a.dropdown-toggle'))[0].focus();
+ });
+ }
+ };
+
+ this.focusNext = function () {
+ this.cSelected = this.cSelected + 1 >= this.childScopes.length ?($scope.cycleSelection === true ? 0 : this.childScopes.length-1): this.cSelected +1;
+ this.childScopes[this.cSelected].sFlag = true;
+ this.resetFlag(this.cSelected);
+ };
+
+ this.focusPrev = function () {
+ this.cSelected = this.cSelected -1 < 0 ? ($scope.cycleSelection === true ? this.childScopes.length-1 : 0) : this.cSelected - 1 ;
+ this.childScopes[this.cSelected].sFlag = true;
+ this.resetFlag(this.cSelected);
+ };
+
+ this.childScopes = [];
+ this.registerScope = function(childScope)
+ {
+ this.childScopes.push(childScope);
+ };
+
+ this.resetFlag = function(index){
+ for(var i=0; i < this.childScopes.length; i++)
+ {
+ if(i !== index)
+ {
+ this.childScopes[i].sFlag = false;
+ }
+ }
+ };
+
+ }],
+ link: function (scope, element, attr) {
+ scope.isSmall = attr.small === "" ? true : false;
+ scope.multiselect = attr.multiselect === ""? true : false;
+ scope.cycleSelection = attr.cycleSelection === "" ? true : false;
+ scope.isDropDownOpen = false;
+ scope.isActionDropdown = false;
+
+ if (!(scope.btnText)) {
+ scope.isActionDropdown = true;
+ }
+
+ scope.clickFxn = function () {
+ if (typeof scope.btnClick === "function" && !scope.btnLink) {
+ scope.btnClick = $parse(scope.btnClick);
+ scope.btnClick();
+ }
+ if(scope.multiselect === true)
+ {
+ scope.isDropDownOpen = false;
+ }
+ };
+
+ scope.toggleDropdown = function () {
+ if (!(scope.btnType === 'disabled')) {
+ scope.isDropDownOpen = !scope.isDropDownOpen;
+ if (scope.isDropDownOpen) {
+ $timeout(function () {
+ angular.element(element[0].querySelector('li'))[0].focus();
+ });
+ }
+ }
+ };
+
+ scope.btnTypeSelector = function (directiveValue, attrValue) {
+ if (directiveValue !== "") {
+ scope.btnTypeFinal = directiveValue;
+ } else {
+ scope.btnTypeFinal = attrValue;
+ }
+ };
+
+ var outsideClick = function(e) {
+ var isElement = $isElement(angular.element(e.target), element.find('ul').eq(0), $document);
+ if (!isElement) {
+ scope.isDropDownOpen = false;
+ scope.$apply();
+ }
+ };
+
+ $documentBind.click('isDropDownOpen', outsideClick, scope);
+
+ attr.$observe('btnType', function (val) {
+ scope.btnType = val;
+ });
+ attr.$observe('attButtonDropdown', function (val) {
+ attr.attButtonDropdown = val;
+ scope.btnTypeSelector(attr.attButtonDropdown, scope.btnType);
+ });
+ }
+ };
+
+ }])
+
+.directive('attButtonDropdownItem', ['$location','keymap', function ($location,keymap) {
+ return {
+ restrict: 'EA',
+ require: ['^attButtonDropdown','?ngModel'],
+ replace: true,
+ transclude: true,
+ templateUrl:'app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdownItem.html', scope: {
+ itemLink: "@"
+ },
+ link: function (scope, element, attr, ctrl) {
+ var rootLink = angular.element(element[0].querySelector('a'));
+ scope.sFlag = false;
+ ctrl[0].registerScope(scope);
+ var clickOnLink = function () {
+ if (scope.itemLinkFinal) {
+ $location.url(scope.itemLinkFinal);
+ }
+ };
+
+ if(ctrl[1]){
+ scope.isSelected = ctrl[1].$viewValue;
+ }else{
+ scope.isSelected = false;
+ }
+
+ element.bind('keydown', function(e) {
+ if (keymap.isAllowedKey(e.keyCode) || keymap.isControl(e) || keymap.isFunctionKey(e)) {
+ e.preventDefault();
+ e.stopPropagation();
+ switch (e.keyCode) {
+ case keymap.KEY.DOWN:
+ ctrl[0].focusNext();
+ break;
+ case keymap.KEY.UP:
+ ctrl[0].focusPrev();
+ break;
+ case keymap.KEY.ENTER:
+ scope.selectItem();
+ break;
+ case keymap.KEY.ESC:
+ ctrl[0].closeAndFocusDropdown();
+ break;
+ default:
+ break;
+ }
+
+ }
+ scope.$apply();
+ });
+
+ scope.selectItem = function()
+ {
+ if(ctrl[1]){
+ scope.$evalAsync(function(){ctrl[1].$setViewValue(!ctrl[1].$viewValue)});
+ }
+ };
+
+ }
+ };
+ }]);
+
+angular.module('att.abs.splitIconButton', ['att.abs.utilities'])
+.constant('iconStateConstants', {
+ MIDDLE: 'middle',
+ LEFT: 'left',
+ RIGHT: 'right',
+ NEXT_TO_DROPDOWN:'next-to-dropdown',
+ LEFT_NEXT_TO_DROPDOWN:'left-next-to-dropdown',
+ DIR_TYPE: {
+ LEFT: 'left',
+ RIGHT: 'right',
+ BUTTON: 'button'
+ },
+ SPLIT_ICON_BTN_EVENT_EMITTER_KEY: 'splitIconButtonTap'
+})
+.directive('expandableLine', [function(){
+ return {
+ restrict: 'EA',
+ replace: true,
+ priority: 300,
+ require: ['^attSplitIconButton', 'expandableLine'],
+ controller: ['$scope', function($scope){
+ $scope.isActive = false;
+ this.setActiveState = function(isActive){
+ $scope.isActive = isActive;
+ };
+ this.isActive = $scope.isActive;
+ this.dirType = $scope.dirType;
+ }],
+ template: '<div ng-class="{\'expand-line-container\': !isActive, \'expand-line-container-active\': isActive}"> <div ng-class="{\'hovered-line\':isActive, \'vertical-line\':!isActive}"> </div></div>',
+ scope:{
+ dirType: '@'
+ },
+ link: function(scope,element,attr,ctrls) {
+ var attSplitIconButtonCtrl = ctrls[0];
+ var expandableLineCtrl = ctrls[1];
+ attSplitIconButtonCtrl.addSubCtrl(expandableLineCtrl);
+ }
+ };
+}])
+.controller('AttSplitIconCtrl', ['$scope', function($scope){
+ this.setType = function(type){
+ $scope.type = type;
+ };
+ this.isDropdown = function(isDropdown){
+ $scope.isDropdown = isDropdown;
+ };
+ this.dropDownClicked = function(){
+ if($scope.dropDownClicked) {
+ $scope.dropDownClicked();
+ }
+ };
+ this.dirType = $scope.dirType;
+}])
+.directive('attSplitIcon', ['$document', '$timeout','iconStateConstants','$documentBind','events', 'keymap',
+ function($document,$timeout,iconStateConstants,$documentBind, events, keymap){
+ return {
+ restrict: 'EA',
+ replace: true,
+ priority: 200,
+ transclude: true,
+ require: ['^attSplitIconButton','attSplitIcon'],
+ templateUrl: 'app/scripts/ng_js_att_tpls/splitIconButton/splitIcon.html',
+ scope:{
+ icon: '@',
+ iconTitle: '@title',
+ hoverWatch: '=',
+ dropDownWatch: '=',
+ dirType: '@'
+ },
+ controller:'AttSplitIconCtrl',
+ link: function(scope,element,attr,ctrls){
+ var attSplitIconButtonCtrl = ctrls[0];
+ var attSplitIconCtrl = ctrls[1];
+ attSplitIconButtonCtrl.addSubCtrl(attSplitIconCtrl);
+ scope.iconStateConstants = iconStateConstants;
+ var currentIndex = 0;
+ var isMyElement = false;
+ var listElements;
+ scope.isDropdown = false;
+ scope.isDropdownOpen = false;
+ var outsideClick = function(e) {
+ if(scope.isDropdown){
+ if (isMyElement) {
+ isMyElement = false;
+ scope.toggleDropdown();
+ } else{
+ scope.toggleDropdown(false);
+ }
+ scope.$apply();
+ }
+ };
+ if(attr.dropDownId && attr.dropDownId !== ''){
+ scope.dropDownId = attr.dropDownId;
+ scope.isDropdown = true;
+ }
+ scope.$on(iconStateConstants.SPLIT_ICON_BTN_EVENT_EMITTER_KEY, function(evnt, data){
+ if(typeof data === 'boolean' && data) {
+ scope.dropDownClicked();
+ /*
+ Check if the dropdown is open and if we are selecting one
+ of the items, so that when pressing enter it will trigger it.
+ */
+ if(scope.isDropDownOpen) {
+ listElements[currentIndex].eq(0).find('a')[0].click();
+ }
+ } else {
+ var e = data;
+ //Only trigger the keyboard event if the icon button is a dropdown type
+ if(scope.isDropdown) {
+ triggerKeyboardEvents(e);
+ }
+ }
+ function triggerKeyboardEvents(e) {
+ switch(e.which) {
+ case (keymap.KEY.TAB):
+ scope.toggleDropdown(false);
+ scope.$digest();
+ break;
+ case (keymap.KEY.ESC):
+ outsideClick();
+ break;
+ case (keymap.KEY.ENTER):
+ if (scope.isDropDownOpen) {
+ listElementsInit();
+ }
+ break;
+ case (keymap.KEY.UP):
+ e.preventDefault();
+ events.stopPropagation(e);
+ if(scope.isDropDownOpen) {
+ scope.previousItemInDropdown();
+ }
+ break;
+ case (keymap.KEY.DOWN):
+ e.preventDefault();
+ events.stopPropagation(e);
+ //Dropdown is open and the user taps down again
+ if(scope.isDropDownOpen) {
+ //Now we need to go through the rows in the dropdown
+ scope.nextItemInDropdown();
+ } else {
+ isMyElement = true;
+ outsideClick();
+ listElementsInit();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ function listElementsInit() {
+ if(listElements === undefined) {
+ listElements = [];
+ var liTemps = element.find('li');
+ for(var i = 0; i < liTemps.length; i++) {
+ listElements.push(liTemps.eq(i));
+ }
+ listElements[currentIndex].children().eq(0).addClass('selected-item');
+ }
+ }
+ });
+ scope.nextItemInDropdown = function(){
+ if(listElements && currentIndex < listElements.length - 1){
+ currentIndex++;
+ listElements[currentIndex - 1].children().eq(0).removeClass('selected-item');
+ listElements[currentIndex].children().eq(0).addClass('selected-item');
+ }
+ };
+ scope.previousItemInDropdown = function(){
+ if(currentIndex > 0) {
+ currentIndex--;
+ listElements[currentIndex].children().eq(0).addClass('selected-item');
+
+ if(currentIndex + 1 < listElements.length)
+ listElements[currentIndex + 1].children().eq(0).removeClass('selected-item');
+ }
+ };
+ scope.$watch('isIconHovered', function(val) {
+ scope.hoverWatch = val;
+ });
+ scope.$watch('type', function(val) {
+ function toggleValues(isMiddle,isNextToDropDown,isRight,isLeft,isLeftNextDropdown){
+ scope['isMiddle'] = isMiddle;
+ scope['isNextToDropDown'] = isNextToDropDown;
+ scope['isRight'] = isRight;
+ scope['isLeft'] = isLeft;
+ scope['isLeftNextDropdown'] = isLeftNextDropdown;
+ };
+ switch(val) {
+ case (scope.iconStateConstants.MIDDLE):
+ toggleValues(true,false,false,true,false);
+ break;
+ case (scope.iconStateConstants.LEFT):
+ toggleValues(false,false,false,true,false);
+ break;
+ case (scope.iconStateConstants.RIGHT):
+ toggleValues(false,false,true,false,false);
+ break;
+ case (scope.iconStateConstants.NEXT_TO_DROPDOWN):
+ toggleValues(false,true,true,true,false);
+ break;
+ case (scope.iconStateConstants.LEFT_NEXT_TO_DROPDOWN):
+ toggleValues(false,false,false,true,true);
+ break;
+ default:
+ break;
+ }
+ });
+ scope.dropDownClicked = function() {
+ isMyElement = true;
+ };
+ scope.toggleDropdown = function(val) {
+ if(val !== undefined) {
+ scope.isDropDownOpen = val;
+ } else {
+ scope.isDropDownOpen = !scope.isDropDownOpen;
+ }
+ scope.dropDownWatch = scope.isDropDownOpen;
+ };
+ $documentBind.click('isDropdown', outsideClick, scope);
+ }
+ };
+}])
+.controller('AttSplitIconButtonCtrl',['$scope', 'iconStateConstants',function($scope,iconStateConstants){
+ this.subCtrls = [];
+ $scope.isLeftLineShown=true;
+ $scope.isRightLineShown=true;
+ $scope.childrenScopes = [];
+ var that = this;
+
+ function getDirIndex(dirType) {
+ var index = -1;
+ for(var c in that.subCtrls) {
+ var ctrl = that.subCtrls[c];
+ if(ctrl.dirType === dirType) {
+ index = c;
+ break;
+ }
+ }
+ return index;
+ }
+ this.addSubCtrl = function(sub) {
+ this.subCtrls.push(sub);
+ };
+ this.isLeftLineShown = function(isShown) {
+ if(isShown === undefined) {
+ return $scope.isLeftLineShown;
+ } else {
+ $scope.isLeftLineShown = isShown;
+ }
+ };
+ this.isRightLineShown = function(isShown) {
+ if(isShown === undefined) {
+ return $scope.isRightLineShown;
+ } else {
+ $scope.isRightLineShown = isShown;
+ }
+ };
+ this.setLeftLineHover = function(isHovered) {
+ var leftLineIndex = getDirIndex(iconStateConstants.DIR_TYPE.LEFT);
+
+ if($scope.isLeftLineShown && this.subCtrls[leftLineIndex] && this.subCtrls[leftLineIndex].setActiveState) {
+ this.subCtrls[leftLineIndex].setActiveState(isHovered);
+ }
+ };
+ this.setRightLineHover = function(isHovered) {
+ var rightLineIndex = getDirIndex(iconStateConstants.DIR_TYPE.RIGHT);
+ if($scope.isRightLineShown && this.subCtrls[rightLineIndex] && this.subCtrls[rightLineIndex].setActiveState){
+ this.subCtrls[rightLineIndex].setActiveState(isHovered);
+ }
+ };
+ this.toggleLines = function(isHovered, buttonGroupCtrl, buttonCtrl, isDropDownOpen) {
+ var subIconButtons = buttonGroupCtrl.subIconButtons;
+ var subIconButtonsLength = subIconButtons.length;
+ var leftLineIndex = getDirIndex(iconStateConstants.DIR_TYPE.LEFT);
+ var rightLineIndex = getDirIndex(iconStateConstants.DIR_TYPE.RIGHT);
+ function noVerticalLineToggle() {
+ for(var i =0; i < subIconButtonsLength; i++) {
+ if(subIconButtons[i] === buttonCtrl) {
+ if(i + 1 <= subIconButtonsLength - 1 && subIconButtons[i+1].isLeftLineShown()
+ && subIconButtons[i+1].subCtrls[leftLineIndex]
+ && subIconButtons[i+1].subCtrls[leftLineIndex].setActiveState) {
+ subIconButtons[i+1].subCtrls[leftLineIndex].setActiveState(isHovered);
+ }
+ if(i - 1 >= 0 && subIconButtons[i-1].isRightLineShown()
+ && subIconButtons[i-1].subCtrls[rightLineIndex]
+ && subIconButtons[i-1].subCtrls[rightLineIndex].setActiveState) {
+ subIconButtons[i-1].subCtrls[rightLineIndex].setActiveState(isHovered);
+ }
+ break;
+ }
+ }
+ }
+ if(isDropDownOpen) {
+ /*
+ If the button is next to the dropdown button then just keep the
+ buttons left line or its left neighbors right line toggled on
+ If the button is the dropdown button don't do anything
+ else do things normally witht the button
+ */
+ /*if(subIconButtons[subIconButtonsLength-1] === buttonCtrl) {
+
+ }
+ else */
+ if(subIconButtons[subIconButtonsLength-2]==buttonCtrl) {
+ if(subIconButtons[subIconButtonsLength-2].isLeftLineShown()) {
+ subIconButtons[subIconButtonsLength-2].subCtrls[leftLineIndex].setActiveState(isHovered);
+ } else if(subIconButtonsLength - 3 >= 0) {
+ if(subIconButtons[subIconButtonsLength-3].isRightLineShown()) {
+ subIconButtons[subIconButtonsLength-3].subCtrls[rightLineIndex].setActiveState(isHovered);
+ }
+ }
+ } else {
+ noVerticalLineToggle();
+
+ if($scope.isLeftLineShown) {
+ this.subCtrls[leftLineIndex].setActiveState(isHovered);
+ }
+ if($scope.isRightLineShown) {
+ this.subCtrls[rightLineIndex].setActiveState(isHovered);
+ }
+ }
+ } else { // End of if(isDropDownOpen)
+ //Handle Special cases where they aren't showing any vertical lines
+ //and the dropdown isn't down
+ if(!$scope.isLeftLineShown && !$scope.isRightLineShown) {
+ noVerticalLineToggle();
+ }
+ if($scope.isLeftLineShown && this.subCtrls[leftLineIndex].setActiveState) {
+ this.subCtrls[leftLineIndex].setActiveState(isHovered);
+ }
+ if($scope.isRightLineShown && this.subCtrls[rightLineIndex].setActiveState){
+ this.subCtrls[rightLineIndex].setActiveState(isHovered);
+ }
+ }
+ };
+ this.setButtonType = function(type){
+ var buttonIndex = getDirIndex(iconStateConstants.DIR_TYPE.BUTTON);
+ if(this.subCtrls[buttonIndex] && this.subCtrls[buttonIndex].setType) {
+ this.subCtrls[buttonIndex].setType(type);
+ }
+ };
+}])
+.directive('attSplitIconButton', ['$document', 'iconStateConstants', 'keymap',
+ function($document, iconStateConstants, keymap){
+ return {
+ restrict: 'EA',
+ replace: true,
+ priority: 100,
+ transclude: true,
+ require: ['^attSplitIconButtonGroup', 'attSplitIconButton'],
+ controller: 'AttSplitIconButtonCtrl',
+ templateUrl: 'app/scripts/ng_js_att_tpls/splitIconButton/splitIconButton.html',
+ scope:{
+ icon: '@',
+ title: '@',
+ dropDownId: '@'
+ },
+ link: function(scope,element,attr,ctrls) {
+ if(!scope.title) {
+ scope.title = scope.icon;
+ }
+ var attSplitButtonGroupCtrl = ctrls[0];
+ var attSplitIconButtonCtrl = ctrls[1];
+ attSplitButtonGroupCtrl.addIconButton(attSplitIconButtonCtrl);
+ element.bind('keydown', function(e){
+ //Check if the key is the up or down key
+ if(e.which === keymap.KEY.ESC ||
+ e.which === keymap.KEY.DOWN ||
+ e.which === keymap.KEY.ENTER ||
+ e.which === keymap.KEY.UP ||
+ e.which === keymap.KEY.TAB ) {
+ scope.clickHandler();
+ scope.$broadcast(iconStateConstants.SPLIT_ICON_BTN_EVENT_EMITTER_KEY, e);
+ }
+ });
+ scope.dropDownWatch = false;
+ scope.iconStateConstants = iconStateConstants;
+ scope.clickHandler = function() {
+ attSplitButtonGroupCtrl.hideLeftLineRightButton(attSplitIconButtonCtrl);
+ };
+ scope.$watch('isHovered', function(val){
+ if(val) {
+ attSplitIconButtonCtrl.toggleLines(val,attSplitButtonGroupCtrl,attSplitIconButtonCtrl,attSplitButtonGroupCtrl.isDropDownOpen);
+ } else{
+ attSplitIconButtonCtrl.toggleLines(val,attSplitButtonGroupCtrl,attSplitIconButtonCtrl,attSplitButtonGroupCtrl.isDropDownOpen);
+ }
+ });
+ scope.$watch('dropDownWatch', function(val) {
+ attSplitButtonGroupCtrl.isDropDownOpen = val;
+ attSplitButtonGroupCtrl.toggleDropdownState(val);
+ });
+ }
+ }
+}])
+.controller('AttSplitIconButtonGroupCtrl', ['$scope','iconStateConstants',function($scope,iconStateConstants){
+ this.subIconButtons = [];
+ this.addIconButton = function(iconButton){
+ this.subIconButtons.push(iconButton);
+ };
+ this.isDropDownOpen = false;
+ this.hideLeftLineRightButton = function(btn){
+ var numButtons = this.subIconButtons.length;
+ var buttonLeftOfRightMost = this.subIconButtons[numButtons - 2];
+ var rightMostButton = this.subIconButtons[numButtons -1];
+
+ if (btn != buttonLeftOfRightMost && btn != rightMostButton ){
+ rightMostButton.setLeftLineHover(false);
+ }
+ };
+ this.toggleDropdownState = function(isDropDownOpen){
+ var numButtons = this.subIconButtons.length;
+ if(numButtons > 2) {
+ if(isDropDownOpen) {
+ if(this.subIconButtons[numButtons - 2].isRightLineShown()) {
+ this.subIconButtons[numButtons - 2].setRightLineHover(true);
+ } else {
+ this.subIconButtons[numButtons - 1].setLeftLineHover(true);
+ }
+ this.subIconButtons[numButtons - 2].setButtonType(iconStateConstants.NEXT_TO_DROPDOWN);
+ } else {
+ this.subIconButtons[numButtons - 1].setLeftLineHover(false);
+ this.subIconButtons[numButtons - 2].setButtonType(iconStateConstants.MIDDLE);
+ }
+ } else {
+ if(isDropDownOpen) {
+ this.subIconButtons[0].setRightLineHover(true);
+ this.subIconButtons[0].setButtonType(iconStateConstants.LEFT_NEXT_TO_DROPDOWN);
+ } else {
+ this.subIconButtons[0].setButtonType(iconStateConstants.LEFT);
+ }
+ }
+ };
+}])
+.directive('attSplitIconButtonGroup', ['$document', '$timeout', 'iconStateConstants' ,function($document,$timeout,iconStateConstants){
+ return {
+ restrict: 'EA',
+ replace: true,
+ priority: 50,
+ transclude: true,
+ require: 'attSplitIconButtonGroup',
+ controller: 'AttSplitIconButtonGroupCtrl',
+ templateUrl: 'app/scripts/ng_js_att_tpls/splitIconButton/splitIconButtonGroup.html',
+ scope:{},
+ link: function(scope,element,attr,ctrls){
+ $timeout(initialize,100);
+ function initialize(){
+ var subIconButtonCtrls = ctrls.subIconButtons;
+ var leftMostButtonIndex = 0;
+ var rightMostButtonIndex =subIconButtonCtrls.length-1;
+ //left most button config
+ subIconButtonCtrls[leftMostButtonIndex].setButtonType(iconStateConstants.LEFT);
+ subIconButtonCtrls[leftMostButtonIndex].isLeftLineShown(false);
+ subIconButtonCtrls[leftMostButtonIndex].isRightLineShown(true);
+ //right most button config
+ subIconButtonCtrls[rightMostButtonIndex].setButtonType(iconStateConstants.RIGHT);
+ subIconButtonCtrls[rightMostButtonIndex].isRightLineShown(false);
+ subIconButtonCtrls[rightMostButtonIndex].isLeftLineShown(false);
+ //middle buttons config
+ if(rightMostButtonIndex >= 2) {
+ var index = 1;
+ while(index < rightMostButtonIndex) {
+ subIconButtonCtrls[index].setButtonType(iconStateConstants.MIDDLE);
+ subIconButtonCtrls[index].isRightLineShown(false);
+ subIconButtonCtrls[index].isLeftLineShown(false);
+ index++;
+ }
+ var skipIndex = 2;
+ while(skipIndex <= rightMostButtonIndex){
+ if(skipIndex == rightMostButtonIndex) {
+ subIconButtonCtrls[skipIndex].isLeftLineShown(true);
+ } else {
+ subIconButtonCtrls[skipIndex].isRightLineShown(true);
+ subIconButtonCtrls[skipIndex].isLeftLineShown(true);
+ }
+ skipIndex = skipIndex + 2;
+ }
+ }
+ //reposition the dropdown
+ var ulElem = element.find('ul');
+ if(ulElem.length > 0) {
+ var numButtons = rightMostButtonIndex+1;
+ if(numButtons > 2) {
+ var offset = (numButtons)*34-70+(numButtons/1.5) + 0.5;
+ var offSetStr = offset+'px';
+ angular.element(ulElem).css('left',offSetStr);
+ angular.element(ulElem).css('border-top-left-radius','0px');
+ } else {
+ angular.element(ulElem).css('left','0px');
+ }
+ }
+ }
+ }
+ }
+}]);
+
+angular.module('att.abs.stepSlider', ['att.abs.position'])
+ .constant('sliderConstants', {
+ /*
+ The MIT License (MIT)
+ Copyright (c) 2013 Julien Valéry
+ */
+ SLIDER: {
+ settings: {
+ from: 1,
+ to: 40,
+ step: 1,
+ smooth: true,
+ limits: true,
+ value: "3",
+ dimension: "",
+ vertical: false
+ },
+ className: "jslider",
+ selector: ".jslider-"
+ },
+ EVENTS: {
+ },
+ COLORS: {
+ GREEN: 'green',
+ BLUE_HIGHLIGHT: 'blue',
+ MAGENTA: 'magenta',
+ GOLD: 'gold',
+ PURPLE: 'purple',
+ DARK_BLUE: 'dark-blue',
+ REGULAR: 'regular',
+ WHITE: 'white'
+ }
+ })
+ .factory('utils', function () {
+ /*
+ The MIT License (MIT)
+ Copyright (c) 2013 Julien Valéry
+ */
+ return {
+ offset: function (elm) {
+ var rawDom = elm[0];
+ var _x = 0;
+ var _y = 0;
+ var body = document.documentElement || document.body;
+ var scrollX = window.pageXOffset || body.scrollLeft;
+ var scrollY = window.pageYOffset || body.scrollTop;
+ _x = rawDom.getBoundingClientRect().left + scrollX;
+ _y = rawDom.getBoundingClientRect().top + scrollY;
+ return {left: _x, top: _y};
+ },
+ roundUpToScale: function (mousePrc, scale, cutOffWidth, cutOffIndex) {
+ var lowerVal;
+ var higherVal;
+ var newMousePrc;
+ var middle;
+
+ for (var index = 1; index < scale.length; index++) {
+ lowerVal = scale[index - 1];
+ higherVal = scale[index];
+ middle = ((higherVal - lowerVal) * .5) + lowerVal;
+ /*
+ Handles a situation where the user clicks close to the start point of
+ the slider but the pointer doesn't move
+ */
+ if ((lowerVal === 0 && mousePrc <= middle) || checkEquality(lowerVal, mousePrc)) {
+ newMousePrc = lowerVal;
+ break;
+ }
+ else if (lowerVal < mousePrc && (mousePrc < higherVal ||
+ checkEquality(mousePrc, higherVal)))
+ {
+ newMousePrc = higherVal;
+ break;
+ }
+ }
+ //Check if the newMousePrc is <= the cuttOffPoint
+ if (cutOffWidth && newMousePrc < cutOffWidth) {
+ return scale[cutOffIndex];
+ }
+ else {
+ return newMousePrc;
+ }
+ /*
+ Checks to see if 2 points are so close that they are
+ basically equal.
+ */
+ function checkEquality(point1, point2) {
+ var precision = 0.1;
+ if (Math.abs(point2 - point1) <= precision) {
+ return true;
+ }
+ return false;
+ }
+ },
+ valueForDifferentScale: function (from, to, prc, prcToValueMapper) {
+ var decimalPrc = prc / 100;
+ if (decimalPrc === 0) {
+ return from;
+ }
+ return prcToValueMapper[prc];
+ },
+ /* converts the default value Kbps to Mbps or Gbps */
+ convertToMbpsGbps: function (unitValue, unitLabel, configDecimalPlaces) {
+ var defaultDecimalPlaces = 3; /* this is the default decimal places as per business requirements */
+ if (configDecimalPlaces) {
+ defaultDecimalPlaces = configDecimalPlaces;
+ }
+
+ if ((unitValue > 1024 && unitValue < 1000000) && angular.equals(unitLabel, 'Kbps')) {
+ unitValue = truncator((unitValue/1000), defaultDecimalPlaces);
+ unitLabel = 'Mbps';
+ } else if ((unitValue > 1024 && unitValue < 1000000) && angular.equals(unitLabel, 'Mbps')){
+ unitValue = truncator((unitValue/1000), defaultDecimalPlaces);
+ unitLabel = 'Mbps';
+ } else if (unitValue <= 1024 && angular.equals(unitLabel, 'Mbps')) {
+ unitLabel = 'Kbps';
+ } else {
+ unitLabel = 'Kbps';
+ }
+
+ if (unitValue >= 1000000 && angular.equals(unitLabel, 'Kbps')) {
+ unitValue = truncator((unitValue/1000000), defaultDecimalPlaces);
+ unitLabel = 'Gbps';
+ }
+ return {
+ unitValue: unitValue,
+ unitLabel: unitLabel
+ };
+
+ function truncator(numToTruncate, intDecimalPlaces) {
+ var cnvrtdNum = Math.pow(10, intDecimalPlaces);
+ return ~~(numToTruncate * cnvrtdNum)/cnvrtdNum;
+ }
+ },
+ getConversionFactorValue: function (value, conversion, firstDimension) {
+ /*
+ Loop through the conversion array and keep checking the
+ startVal
+ */
+ if (value <= conversion[0].startVal) {
+ return{
+ scaledVal: value,
+ scaledDimension: firstDimension
+ };
+ }
+ var endIndex = 0;
+ for (var index in conversion) {
+ var c = conversion[index];
+ if (value > c.startVal) {
+ endIndex = index;
+ }
+ }
+ var scaleFactor = conversion[endIndex].scaleFactor;
+ var scaledVal = value / scaleFactor;
+ var scaledDimension = conversion[endIndex].dimension;
+ return {
+ scaledVal: scaledVal,
+ scaledDimension: scaledDimension
+ };
+ }
+ };
+ })
+ .factory('sliderDraggable', ['utils', function (utils) {
+ /*
+ The MIT License (MIT)
+ Copyright (c) 2013 Julien Valéry
+ */
+ function Draggable() {
+ this._init.apply(this, arguments);
+ }
+ Draggable.prototype.oninit = function () {
+ };
+ Draggable.prototype.events = function () {
+ };
+ Draggable.prototype.onmousedown = function () {
+ this.ptr.css({position: "absolute"});
+ };
+ Draggable.prototype.onmousemove = function (evt, x, y) {
+ this.ptr.css({left: x, top: y});
+ };
+ Draggable.prototype.onmouseup = function () {
+ };
+ Draggable.prototype.isDefault = {
+ drag: false,
+ clicked: false,
+ toclick: true,
+ mouseup: false
+ };
+ Draggable.prototype._init = function () {
+ if (arguments.length > 0) {
+ this.ptr = arguments[0];
+ this.parent = arguments[2];
+ if (!this.ptr) {
+ return;
+ }
+ this.is = {};
+ angular.extend(this.is, this.isDefault);
+ var offset = utils.offset(this.ptr);
+ this.d = {
+ left: offset.left,
+ top: offset.top,
+ width: this.ptr[0].clientWidth,
+ height: this.ptr[0].clientHeight
+ };
+ this.oninit.apply(this, arguments);
+ this._events();
+ }
+ };
+ Draggable.prototype._getPageCoords = function (event) {
+ var value = {};
+ if (event.targetTouches && event.targetTouches[0]) {
+ value = {x: event.targetTouches[0].pageX, y: event.targetTouches[0].pageY};
+ } else {
+ value = {x: event.pageX, y: event.pageY};
+ }
+ return value;
+ };
+ Draggable.prototype._bindEvent = function (ptr, eventType, handler) {
+ if (this.supportTouches_) {
+ ptr[0].attachEvent(this.events_[ eventType ], handler);
+ }
+ else {
+ if (ptr.bind) {
+ ptr.bind(this.events_[ eventType ], handler);
+ }
+ }
+ };
+ Draggable.prototype._events = function () {
+ var self = this;
+ this.supportTouches_ = 'ontouchend' in document;
+ this.events_ = {
+ "click": this.supportTouches_ ? "touchstart" : "click",
+ "down": this.supportTouches_ ? "touchstart" : "mousedown",
+ "move": this.supportTouches_ ? "touchmove" : "mousemove",
+ "up": this.supportTouches_ ? "touchend" : "mouseup",
+ "mousedown": this.supportTouches_ ? "mousedown" : "mousedown"
+ };
+ var documentElt = angular.element(window.document);
+ this._bindEvent(documentElt, "move", function (event) {
+ if (self.is.drag) {
+ event.stopPropagation();
+ event.preventDefault();
+ if (!self.parent.disabled) {
+ self._mousemove(event);
+ }
+ }
+ });
+ this._bindEvent(documentElt, "down", function (event) {
+ if (self.is.drag) {
+ event.stopPropagation();
+ event.preventDefault();
+ }
+ });
+ this._bindEvent(documentElt, "up", function (event) {
+ self._mouseup(event);
+ });
+ this._bindEvent(this.ptr, "down", function (event) {
+ self._mousedown(event);
+ return false;
+ });
+ this._bindEvent(this.ptr, "up", function (event) {
+ self._mouseup(event);
+ });
+ this.events();
+ };
+ Draggable.prototype._mousedown = function (evt) {
+ this.is.drag = true;
+ this.is.clicked = false;
+ this.is.mouseup = false;
+ var coords = this._getPageCoords(evt);
+ this.cx = coords.x - this.ptr[0].offsetLeft;
+ this.cy = coords.y - this.ptr[0].offsetTop;
+ angular.extend(this.d, {
+ left: this.ptr[0].offsetLeft,
+ top: this.ptr[0].offsetTop,
+ width: this.ptr[0].clientWidth,
+ height: this.ptr[0].clientHeight
+ });
+ if (this.outer && this.outer.get(0)) {
+ this.outer.css({height: Math.max(this.outer.height(), $(document.body).height()), overflow: "hidden"});
+ }
+ this.onmousedown(evt);
+ };
+ Draggable.prototype._mousemove = function (evt) {
+ if (this.uid === 0) {
+ return;
+ }
+ this.is.toclick = false;
+ var coords = this._getPageCoords(evt);
+ this.onmousemove(evt, coords.x - this.cx, coords.y - this.cy);
+ };
+ Draggable.prototype._mouseup = function (evt) {
+ if (this.is.drag) {
+ this.is.drag = false;
+ if (this.outer && this.outer.get(0)) {
+ if ($.browser.mozilla) {
+ this.outer.css({overflow: "hidden"});
+ } else {
+ this.outer.css({overflow: "visible"});
+ }
+ if ($.browser.msie && $.browser.version === '6.0') {
+ this.outer.css({height: "100%"});
+ } else {
+ this.outer.css({height: "auto"});
+ }
+ }
+ this.onmouseup(evt);
+ }
+ };
+ return Draggable;
+ }])
+ .factory('sliderPointer', ['sliderDraggable', 'utils', function (Draggable, utils) {
+ /*
+ The MIT License (MIT)
+ Copyright (c) 2013 Julien Valéry
+ */
+ function SliderPointer() {
+ Draggable.apply(this, arguments);
+ }
+ SliderPointer.prototype = new Draggable();
+ SliderPointer.prototype.oninit = function (ptr, id, _constructor) {
+ this.uid = id;
+ this.parent = _constructor;
+ this.value = {};
+ this.settings = angular.copy(_constructor.settings);
+ };
+ SliderPointer.prototype.onmousedown = function (evt) {
+ var off = utils.offset(this.parent.domNode);
+ var offset = {
+ left: off.left,
+ top: off.top,
+ width: this.parent.domNode[0].clientWidth,
+ height: this.parent.domNode[0].clientHeight
+ };
+ this._parent = {
+ offset: offset,
+ width: offset.width,
+ height: offset.height
+ };
+ this.ptr.addClass("jslider-pointer-hover");
+ this.setIndexOver();
+ };
+ SliderPointer.prototype.onmousemove = function (evt, x, y) {
+ var coords = this._getPageCoords(evt);
+ //val is the percent where the slider pointer is located
+ var val = this.calc(coords.x);
+ if (!this.parent.settings.smooth) {
+ val = utils.roundUpToScale(val,
+ this.parent.settings.scale,
+ this.parent.settings.cutOffWidth,
+ this.parent.settings.cutOffIndex);
+ }
+ var cutOffWidth = this.parent.settings.cutOffWidth;
+ if (cutOffWidth && val < cutOffWidth) {
+ val = cutOffWidth;
+ }
+ this._set(val);
+ };
+ SliderPointer.prototype.onmouseup = function (evt) {
+ if (this.settings.callback && angular.isFunction(this.settings.callback)) {
+ var val = this.parent.getValue();
+ this.settings.callback.call(this.parent, val);
+ }
+ this.ptr.removeClass("jslider-pointer-hover");
+ };
+ SliderPointer.prototype.setIndexOver = function () {
+ this.parent.setPointersIndex(1);
+ this.index(2);
+ };
+ SliderPointer.prototype.index = function (i) {
+ };
+ SliderPointer.prototype.limits = function (x) {
+ return this.parent.limits(x, this);
+ };
+ SliderPointer.prototype.calc = function (coords) {
+ var diff = coords - this._parent.offset.left;
+ var val = this.limits((diff * 100) / this._parent.width);
+ return val;
+ };
+ SliderPointer.prototype.set = function (value, opt_origin) {
+ this.value.origin = this.parent.round(value);
+ this._set(this.parent.valueToPrc(value, this), opt_origin);
+ };
+ SliderPointer.prototype._set = function (prc, opt_origin) {
+ if (!opt_origin) {
+ this.value.origin = this.parent.prcToValue(prc);
+ }
+ this.value.prc = prc;
+ //Sets the location of the SliderPointer
+ this.ptr.css({left: prc + '%'});
+ this.parent.redraw(this);
+ };
+ return SliderPointer;
+ }])
+ .factory('slider', ['sliderPointer', 'sliderConstants', 'utils', function (SliderPointer, sliderConstants, utils) {
+ /*
+ The MIT License (MIT)
+ Copyright (c) 2013 Julien Valéry
+ */
+ var cutOffDom;
+ function Slider() {
+ return this.init.apply(this, arguments);
+ }
+ function changeCutOffWidth(width) {
+ cutOffDom.css('width', width);
+ }
+ ;
+ Slider.prototype.changeCutOffWidth = changeCutOffWidth;
+ Slider.prototype.init = function (inputNode, templateNode, settings) {
+ this.settings = sliderConstants.SLIDER.settings;
+ angular.extend(this.settings, angular.copy(settings));
+ this.inputNode = inputNode;
+ this.inputNode.addClass("ng-hide");
+ this.settings.interval = this.settings.to - this.settings.from;
+ if (this.settings.calculate && $.isFunction(this.settings.calculate)) {
+ this.nice = this.settings.calculate;
+ }
+ if (this.settings.onstatechange && $.isFunction(this.settings.onstatechange)) {
+ this.onstatechange = this.settings.onstatechange;
+ }
+ this.is = {init: false};
+ this.o = {};
+ this.create(templateNode);
+ };
+ Slider.prototype.create = function (templateNode) {
+ var $this = this;
+ this.domNode = templateNode;
+ var off = utils.offset(this.domNode);
+ var offset = {
+ left: off.left,
+ top: off.top,
+ width: this.domNode[0].clientWidth,
+ height: this.domNode[0].clientHeight
+ };
+ this.sizes = {domWidth: this.domNode[0].clientWidth, domOffset: offset};
+ angular.extend(this.o, {
+ pointers: {},
+ labels: {
+ 0: {
+ o: angular.element(this.domNode.find('div')[5])
+ },
+ 1: {
+ o: angular.element(this.domNode.find('div')[6])
+ }
+ },
+ limits: {
+ 0: angular.element(this.domNode.find('div')[3]),
+ 1: angular.element(this.domNode.find('div')[5])
+ }
+ });
+ angular.extend(this.o.labels[0], {
+ value: this.o.labels[0].o.find("span")
+ });
+ angular.extend(this.o.labels[1], {
+ value: this.o.labels[1].o.find("span")
+ });
+ if (!$this.settings.value.split(";")[1]) {
+ this.settings.single = true;
+ }
+ var domNodeDivs = this.domNode.find('div');
+ cutOffDom = angular.element(domNodeDivs[8]);
+ if (cutOffDom && cutOffDom.css) {
+ cutOffDom.css('width', '0%');
+ }
+ var pointers = [angular.element(domNodeDivs[1]), angular.element(domNodeDivs[2])];
+ angular.forEach(pointers, function (pointer, key) {
+ $this.settings = angular.copy($this.settings);
+ var value = $this.settings.value.split(';')[key];
+ if (value) {
+ $this.o.pointers[key] = new SliderPointer(pointer, key, $this);
+ var prev = $this.settings.value.split(';')[key - 1];
+ if (prev && parseInt(value, 10) < parseInt(prev, 10)) {
+ value = prev;
+ }
+ var value1 = value < $this.settings.from ? $this.settings.from : value;
+ value1 = value > $this.settings.to ? $this.settings.to : value;
+ $this.o.pointers[key].set(value1, true);
+ if (key === 0) {
+ $this.domNode.bind('mousedown', $this.clickHandler.apply($this));
+ }
+ }
+ });
+ this.o.value = angular.element(this.domNode.find("i")[2]);
+ this.is.init = true;
+ angular.forEach(this.o.pointers, function (pointer) {
+ $this.redraw(pointer);
+ });
+ };
+ Slider.prototype.clickHandler = function () {
+ var self = this;
+ return function (evt) {
+ if (self.disabled) {
+ return;
+ }
+ var className = evt.target.className;
+ var targetIdx = 0;
+ if (className.indexOf('jslider-pointer-to') > 0) {
+ targetIdx = 1;
+ }
+ var _off = utils.offset(self.domNode);
+ var offset = {
+ left: _off.left,
+ top: _off.top,
+ width: self.domNode[0].clientWidth,
+ height: self.domNode[0].clientHeight
+ };
+ targetIdx = 1;
+ var targetPtr = self.o.pointers[targetIdx];
+ targetPtr._parent = {offset: offset, width: offset.width, height: offset.height};
+ targetPtr._mousemove(evt);
+ targetPtr.onmouseup();
+ return false;
+ };
+ };
+ Slider.prototype.disable = function (bool) {
+ this.disabled = bool;
+ };
+ Slider.prototype.nice = function (value) {
+ return value;
+ };
+ Slider.prototype.onstatechange = function () {
+ };
+ Slider.prototype.limits = function (x, pointer) {
+ if (!this.settings.smooth) {
+ var step = this.settings.step * 100 / (this.settings.interval);
+ x = Math.round(x / step) * step;
+ }
+ var another = this.o.pointers[1 - pointer.uid];
+ if (another && pointer.uid && x < another.value.prc) {
+ x = another.value.prc;
+ }
+ if (another && !pointer.uid && x > another.value.prc) {
+ x = another.value.prc;
+ }
+ if (x < 0) {
+ x = 0;
+ }
+ if (x > 100) {
+ x = 100;
+ }
+ var val = Math.round(x * 10) / 10;
+ return val;
+ };
+ Slider.prototype.setPointersIndex = function (i) {
+ angular.forEach(this.getPointers(), function (pointer, i) {
+ pointer.index(i);
+ });
+ };
+ Slider.prototype.getPointers = function () {
+ return this.o.pointers;
+ };
+ Slider.prototype.onresize = function () {
+ var self = this;
+ this.sizes = {
+ domWidth: this.domNode[0].clientWidth,
+ domHeight: this.domNode[0].clientHeight,
+ domOffset: {
+ left: this.domNode[0].offsetLeft,
+ top: this.domNode[0].offsetTop,
+ width: this.domNode[0].clientWidth,
+ height: this.domNode[0].clientHeight
+ }
+ };
+ angular.forEach(this.o.pointers, function (ptr, key) {
+ self.redraw(ptr);
+ });
+ };
+ Slider.prototype.update = function () {
+ this.onresize();
+ this.drawScale();
+ };
+ Slider.prototype.drawScale = function () {
+ };
+ Slider.prototype.redraw = function (pointer) {
+ if (!this.settings.smooth) {
+ var newMousePrc = utils.roundUpToScale(pointer.value.prc,
+ this.settings.scale,
+ this.settings.cutOffWidth,
+ this.settings.cutOffIndex);
+ pointer.value.origin = newMousePrc;
+ pointer.value.prc = newMousePrc;
+ }
+
+ if (!this.is.init) {
+ return false;
+ }
+ this.setValue();
+ var width = this.o.pointers[1].value.prc;
+ var newPos = {left: '0%', width: width + '%'};
+ this.o.value.css(newPos);
+ var htmlValue = this.nice(pointer.value.origin);
+ var scaledDimension = this.settings.firstDimension;
+ if (this.settings.stepWithDifferentScale && !this.settings.smooth) {
+ htmlValue = utils.valueForDifferentScale(this.settings.from,
+ this.settings.to, htmlValue, this.settings.prcToValueMapper);
+ }
+ //This is the base value before the conversion
+ if (this.settings.realtimeCallback && angular.isFunction(this.settings.realtimeCallback)
+ && this.settings.cutOffVal !== undefined && pointer.uid === 1) {
+ this.settings.realtimeCallback(htmlValue);
+ }
+ //Need to change this to the correct value for the scale
+ if (this.settings.conversion) {
+ var conversionObj = utils.getConversionFactorValue(parseInt(htmlValue),
+ this.settings.conversion,
+ this.settings.firstDimension);
+ htmlValue = conversionObj.scaledVal;
+ scaledDimension = conversionObj.scaledDimension;
+ }
+
+ htmlValue = parseFloat(htmlValue);
+ var tooltipLabel = utils.convertToMbpsGbps(htmlValue, scaledDimension, this.settings.decimalPlaces);
+
+ this.o.labels[pointer.uid].value.html(tooltipLabel.unitValue + ' ' + tooltipLabel.unitLabel);
+ //Top tooltip label
+ this.redrawLabels(pointer);
+ };
+ Slider.prototype.redrawLabels = function (pointer) {
+ function setPosition(label, sizes, prc) {
+ sizes.margin = -sizes.label / 2;
+ var domSize = self.sizes.domWidth;
+ var label_left = sizes.border + sizes.margin;
+ if (label_left < 0) {
+ sizes.margin -= label_left;
+ }
+ if (sizes.border + sizes.label / 2 > domSize) {
+ sizes.margin = 0;
+ sizes.right = true;
+ } else
+ sizes.right = false;
+ //Adjust the tooltip location
+ sizes.margin = -((label.o[0].clientWidth / 2) - label.o[0].clientWidth / 20);
+ label.o.css({left: prc + "%", marginLeft: sizes.margin, right: "auto"});
+ if (sizes.right)
+ label.o.css({left: "auto", right: 0});
+ return sizes;
+ }
+ var self = this;
+ var label = this.o.labels[pointer.uid];
+ var prc = pointer.value.prc;
+ var sizes = {
+ label: label.o[0].offsetWidth,
+ right: false,
+ border: (prc * domSize) / 100
+ };
+ var another_label = null;
+ var another = null;
+ if (!this.settings.single) {
+ another = this.o.pointers[1 - pointer.uid];
+ another_label = this.o.labels[another.uid];
+ switch (pointer.uid) {
+ case 0:
+ if (sizes.border + sizes.label / 2 > another_label.o[0].offsetLeft - this.sizes.domOffset.left) {
+ another_label.o.css({visibility: "hidden"});
+ another_label.value.html(this.nice(another.value.origin));
+ label.o.css({visibility: "hidden"});
+ prc = (another.value.prc - prc) / 2 + prc;
+ if (another.value.prc !== pointer.value.prc) {
+ label.value.html(this.nice(pointer.value.origin) + "&nbsp;&ndash;&nbsp;" + this.nice(another.value.origin));
+ sizes.label = label.o[0].clientWidth;
+ sizes.border = (prc * domSize) / 100;
+ }
+ } else {
+ another_label.o.css({visibility: "visible"});
+ }
+ break;
+ case 1:
+ if (sizes.border - sizes.label / 2 < another_label.o[0].offsetLeft - this.sizes.domOffset.left + another_label.o[0].clientWidth) {
+ another_label.o.css({visibility: "hidden"});
+ another_label.value.html(this.nice(another.value.origin));
+ label.o.css({visibility: "visible"});
+ prc = (prc - another.value.prc) / 2 + another.value.prc;
+ if (another.value.prc !== pointer.value.prc) {
+ label.value.html(this.nice(another.value.origin) + "&nbsp;&ndash;&nbsp;" + this.nice(pointer.value.origin));
+ sizes.label = label.o[0].clientWidth;
+ sizes.border = (prc * domSize) / 100;
+ }
+ } else {
+ another_label.o.css({visibility: "visible"});
+ }
+ break;
+ }
+ }
+ sizes = setPosition(label, sizes, prc);
+ var domSize = self.sizes.domWidth;
+ //This is the 0th pointer
+ if (another_label) {
+ sizes = {
+ label: another_label.o[0].clientWidth,
+ right: false,
+ border: (another.value.prc * this.sizes.domWidth) / 100
+ };
+ sizes = setPosition(another_label, sizes, another.value.prc);
+ }
+ };
+ Slider.prototype.redrawLimits = function () {
+ if (this.settings.limits) {
+ var limits = [true, true];
+ for (var key in this.o.pointers) {
+ if (!this.settings.single || key === 0) {
+ var pointer = this.o.pointers[key];
+ var label = this.o.labels[pointer.uid];
+ var label_left = label.o[0].offsetLeft - this.sizes.domOffset.left;
+ var limit = this.o.limits[0];
+ if (label_left < limit[0].clientWidth)
+ limits[0] = false;
+ limit = this.o.limits[1];
+ if (label_left + label.o[0].clientWidth > this.sizes.domWidth - limit[0].clientWidth)
+ limits[1] = false;
+ }
+ }
+ for (var i = 0; i < limits.length; i++) {
+ if (limits[i]){
+ angular.element(this.o.limits[i]).addClass("animate-show");}
+ else{
+ angular.element(this.o.limits[i]).addClass("animate-hidde");}
+ }
+ }
+ };
+ Slider.prototype.setValue = function () {
+ var value = this.getValue();
+ this.inputNode.attr("value", value);
+ this.onstatechange.call(this, value, this.inputNode);
+ };
+ Slider.prototype.getValue = function () {
+ if (!this.is.init){
+ return false;}
+ var $this = this;
+ var value = "";
+ angular.forEach(this.o.pointers, function (pointer, key) {
+ if (pointer.value.prc !== undefined && !isNaN(pointer.value.prc)) {
+ var pointerPrc = pointer.value.prc;
+ var myValue = $this.prcToValue(pointerPrc);
+ if (!$this.settings.smooth) {
+ var myValue = utils.valueForDifferentScale($this.settings.from,
+ $this.settings.to,
+ pointerPrc,
+ $this.settings.prcToValueMapper);
+ }
+ value += (key > 0 ? ";" : "") + myValue;
+ }
+ });
+ return value;
+ };
+ Slider.prototype.getPrcValue = function () {
+ if (!this.is.init)
+ return false;
+ var value = "";
+ $.each(this.o.pointers, function (i) {
+ if (this.value.prc !== undefined && !isNaN(this.value.prc))
+ value += (i > 0 ? ";" : "") + this.value.prc;
+ });
+ return value;
+ };
+ Slider.prototype.prcToValue = function (prc) {
+ var value;
+ if (this.settings.heterogeneity && this.settings.heterogeneity.length > 0) {
+ var h = this.settings.heterogeneity;
+ var _start = 0;
+ var _from = this.settings.from;
+ for (var i = 0; i <= h.length; i++) {
+ var v;
+ if (h[i]){
+ v = h[i].split("/");}
+ else{
+ v = [100, this.settings.to];}
+ if (prc >= _start && prc <= v[0]) {
+ value = _from + ((prc - _start) * (v[1] - _from)) / (v[0] - _start);
+ }
+ _start = v[0];
+ _from = v[1];
+ }
+ }
+ else {
+ value = this.settings.from + (prc * this.settings.interval) / 100;
+ }
+ var roundedValue = this.round(value);
+ return roundedValue;
+ };
+ Slider.prototype.valueToPrc = function (value, pointer) {
+ var prc;
+ if (this.settings.heterogeneity && this.settings.heterogeneity.length > 0) {
+ var h = this.settings.heterogeneity;
+ var _start = 0;
+ var _from = this.settings.from;
+ for (var i = 0; i <= h.length; i++) {
+ var v;
+ if (h[i])
+ v = h[i].split("/");
+ else
+ v = [100, this.settings.to];
+ if (value >= _from && value <= v[1]) {
+ prc = pointer.limits(_start + (value - _from) * (v[0] - _start) / (v[1] - _from));
+ }
+ _start = v[0];
+ _from = v[1];
+ }
+ } else {
+ prc = pointer.limits((value - this.settings.from) * 100 / this.settings.interval);
+ }
+ return prc;
+ };
+ Slider.prototype.round = function (value) {
+ value = Math.round(value / this.settings.step) * this.settings.step;
+ if (this.settings.round){
+ value = Math.round(value * Math.pow(10, this.settings.round)) / Math.pow(10, this.settings.round);}
+ else{
+ value = Math.round(value);}
+ return value;
+ };
+ return Slider;
+ }])
+ .directive('attStepSlider', [
+ '$compile', '$templateCache', '$timeout', '$window', 'slider', 'sliderConstants', 'utils',
+ function (compile, templateCache, timeout, win, Slider, sliderConstants, utils) {
+ /*
+ The MIT License (MIT)
+ Copyright (c) 2013 Julien Valéry
+ */
+ var templateUrl = 'app/scripts/ng_js_att_tpls/stepSlider/attStepSlider.html';
+ return {
+ restrict: 'AE',
+ require: '?ngModel',
+ scope: {
+ options: '=',
+ cutOff: '='
+ },
+ priority: 1,
+ templateUrl: templateUrl,
+ link: function (scope, element, attrs, ngModel) {
+ if (!ngModel)
+ return;
+ scope.mainSliderClass = 'step-slider';
+ element.after(compile(templateCache.get(templateUrl))(scope, function (clonedElement, scope) {
+ scope.tmplElt = clonedElement;
+ }));
+ ngModel.$render = function () {
+ if (ngModel.$viewValue.split && ngModel.$viewValue.split(";").length === 1) {
+ ngModel.$viewValue = '0;' + ngModel.$viewValue;
+ } else if (typeof (ngModel.$viewValue) === 'number') {
+ ngModel.$viewValue = '0;' + ngModel.$viewValue;
+ }
+ if (!ngModel.$viewValue && ngModel.$viewValue !== 0) {
+ return;
+ }
+ if (typeof (ngModel.$viewValue) === 'number') {
+ ngModel.$viewValue = '' + ngModel.$viewValue;
+ }
+ if (scope.slider) {
+ var firstPointer = '0';
+ scope.slider.getPointers()[0].set(firstPointer, true);
+ if (ngModel.$viewValue.split(";")[1]) {
+ var value = ngModel.$viewValue.split(";")[1];
+ if (value.length >= 4) {
+ value = value.substring(0, 2);
+ }
+ if (!scope.options.realtime)
+ scope.options.callback(parseFloat(ngModel.$viewValue.split(";")[1]));
+ scope.slider.getPointers()[1].set(ngModel.$viewValue.split(";")[1], true);
+ }
+ }
+ };
+ var init = function () {
+ scope.from = '' + scope.options.from;
+ scope.to = '' + scope.options.to;
+ if (scope.options.calculate && typeof scope.options.calculate === 'function') {
+ scope.from = scope.options.calculate(scope.from);
+ scope.to = scope.options.calculate(scope.to);
+ }
+ scope.showDividers = scope.options.showDividers;
+ scope.COLORS = sliderConstants.COLORS;
+ scope.sliderColor = scope.options.sliderColor;
+ if (!scope.sliderColor)
+ scope.sliderColor = sliderConstants.COLORS.REGULAR;
+ var scaleArray = scope.options.scale;
+ /* Make a copy of the scaleArray before converting it to percentage for the bars */
+ var nonPercentScaleArray = [];
+ /* Define variable for displaying lower range values */
+ var scaledUpValueArray=[];
+ /* Create Mapper for the percentage to value */
+ var prcToValueMapper = {};
+ for (var i in scaleArray) {
+ var s = scaleArray[i];
+ nonPercentScaleArray.push(s);
+ }
+ function addScaleArrayStartAndEnd() {
+ if (scaleArray[0] !== 0) {
+ scaleArray.splice(0, 0, 0);
+ }
+ if (scaleArray[scaleArray.length - 1] !== 100) {
+ scaleArray.splice(scaleArray.length, 0, 100);
+ }
+ }
+ function convertScaleArrayToPercentage() {
+ if (scaleArray[scaleArray.length - 1] !== scope.options.to) {
+ scaleArray.splice(scaleArray.length, 0, scope.options.to);
+ }
+
+ if(scope.options.displayScaledvalues){
+ for(var i in scaleArray){
+ scaledUpValueArray.push(Math.log2(scaleArray[i]));
+ }
+ var maxScaledUpValue=scaledUpValueArray[scaledUpValueArray.length-1];
+ }
+
+ for (var i in scaleArray) {
+ var prcValue;
+ var fromValueCheck = (scaleArray[i] / scope.options.from);
+ var toValueCheck = (scaleArray[i] / scope.options.to);
+
+ if (scope.options.displayScaledvalues){
+ prcValue = (scaledUpValueArray[i] /maxScaledUpValue)*100;
+ } else {
+ prcValue = ((scaleArray[i] - scope.options.from) / (scope.options.to - scope.options.from)) * 100;
+ }
+
+ var realValue = scaleArray[i];
+
+ if (toValueCheck === 1) {
+ prcValue = 100;
+ }
+ else if (fromValueCheck === 1) {
+ prcValue = 0;
+ }
+ scaleArray[i] = prcValue;
+ prcToValueMapper['' + prcValue] = realValue;
+ }
+ }
+ if ((scope.options.from !== 0 || scope.options.to !== 100)
+ && scope.options.smooth) {
+ /*
+ scale array is in real values.
+ */
+ addScaleArrayStartAndEnd();
+ scope.options.stepWithDifferentScale = true;
+ }
+ else if ((scope.options.from !== 0 || scope.options.to !== 100)
+ && !scope.options.smooth) {
+ /*
+ Case for different from and to values other than 0 and 100
+ so we have to do some different calculations
+ */
+ scope.options.stepWithDifferentScale = true;
+ convertScaleArrayToPercentage();
+ addScaleArrayStartAndEnd();
+ }
+ else {
+ /*
+ This is the normal case where the from and to values are 0 and
+ 100 respectively.
+ */
+ //Check that the scale starts at 0 and 100
+ convertScaleArrayToPercentage();
+ addScaleArrayStartAndEnd();
+ }
+ var decimalPlaces = 0;
+ if (scope.options.decimalPlaces) {
+ decimalPlaces = scope.options.decimalPlaces;
+ }
+ //Modify the endDimension based on whether converison was passed in
+ //Also change the toStr value to scale to the last factor
+ scope.endDimension = scope.options.dimension;
+ if (scope.options.conversion) {
+ //Get the dimension of the last conversion
+ var lastIndex = scope.options.conversion.length - 1;
+ var lastDimension = scope.options.conversion[lastIndex].dimension;
+ var lastScaleFactor = scope.options.conversion[lastIndex].scaleFactor;
+ scope.endDimension = ' ' + lastDimension;
+
+ var toVal = (scope.to / lastScaleFactor).toFixed(decimalPlaces);
+ scope.toStr = toVal;
+ } else {
+ scope.toStr = scope.options.to;
+ }
+
+ var tooltipLabel = utils.convertToMbpsGbps(scope.toStr, scope.endDimension, scope.options.decimalPlaces);
+ scope.toStr = tooltipLabel.unitValue;
+ scope.endDimension = ' ' + tooltipLabel.unitLabel;
+
+ var OPTIONS = {
+ from: scope.options.from,
+ to: scope.options.to,
+ step: scope.options.step,
+ smooth: scope.options.smooth,
+ limits: true,
+ stepWithDifferentScale: scope.options.stepWithDifferentScale,
+ round: scope.options.round || false,
+ value: ngModel.$viewValue,
+ scale: scope.options.scale,
+ nonPercentScaleArray: nonPercentScaleArray,
+ prcToValueMapper: prcToValueMapper,
+ firstDimension: scope.options.dimension,
+ decimalPlaces: decimalPlaces,
+ conversion: scope.options.conversion,
+ realtimeCallback: scope.options.callback
+ };
+ if (angular.isFunction(scope.options.realtime)) {
+ OPTIONS.realtimeCallback = function (value) {
+ ngModel.$setViewValue(value);
+ scope.options.callback(value);
+ };
+ }
+ else {
+ OPTIONS.callback = forceApply;
+ }
+ OPTIONS.calculate = scope.options.calculate || undefined;
+ OPTIONS.onstatechange = scope.options.onstatechange || undefined;
+ timeout(function () {
+ var scaleDiv = scope.tmplElt.find('div')[7];
+ if (!OPTIONS.conversion) {
+ scope.tmplElt.find('div').eq(6).find('span').eq(0).css('padding-left', '10px');
+ scope.tmplElt.find('div').eq(6).find('span').eq(0).css('padding-right', '15px');
+ }
+ scope.slider = angular.element.slider(element, scope.tmplElt, OPTIONS);
+ angular.element(scaleDiv).html(scope.generateScale());
+ scope.drawScale(scaleDiv);
+ initListener();
+ scope.$watch('options.disable', function (val) {
+ if (scope.slider) {
+ scope.tmplElt.toggleClass('disabled', val);
+ scope.slider.disable(val);
+ }
+ });
+ scope.$watch('cutOff', function (cutOffVal) {
+ if (cutOffVal && cutOffVal > 0) {
+ var cutOffPrc = (cutOffVal - scope.slider.settings.from) / (scope.slider.settings.to -
+ scope.slider.settings.from);
+ cutOffPrc = cutOffPrc * 100;
+ scope.isCutOffSlider = true;
+ scope.slider.settings.cutOffWidth = cutOffPrc;
+ //cutOffVal is the actual value of the cutoff point
+ scope.cutOffVal = cutOffVal;
+ if (scope.options.conversion) {
+ var convertedVal = utils.getConversionFactorValue(cutOffVal, scope.options.conversion, scope.options.dimension);
+ convertedVal.scaledVal = parseFloat(convertedVal.scaledVal).toFixed(scope.options.decimalPlaces);
+ scope.cutOffVal = convertedVal.scaledVal + ' ' + convertedVal.scaledDimension;
+ }
+ scope.slider.settings.cutOffVal = cutOffVal;
+ //Calculate the cutOff percentage
+ scope.slider.changeCutOffWidth(cutOffPrc + '%');
+ var scale = scope.slider.settings.nonPercentScaleArray;
+ //Calculate where the cutOff point in relation to the scale array
+ for (var i in scale) {
+ if (i >= 1) {
+ var lowerVal = scale[i - 1];
+ var higherVal = scale[i];
+ if (cutOffVal > lowerVal && cutOffVal <= higherVal) {
+ scope.slider.settings.cutOffIndex = i;
+ }
+ }
+ }
+ } else {
+ scope.slider.settings.cutOffVal = 0;
+ }
+ });
+ });
+ };
+ function initListener() {
+ angular.element(win).bind('resize', function (event) {
+ scope.slider.onresize();
+ });
+ }
+ scope.generateScale = function () {
+ if (scope.options.scale && scope.options.scale.length > 0) {
+ var str = "";
+ var s = scope.options.scale;
+ var position = 'left';
+ for (var i = 0; i < s.length; i++) {
+ if (i !== 0 && i !== s.length - 1) {
+ var scaledPosition = ((s[i] - scope.from) / (scope.to - scope.from)) * 100;
+ if (scope.options.stepWithDifferentScale && !scope.options.smooth) {
+ scaledPosition = s[i];
+ }
+ str += '<span style="' + position + ': ' + scaledPosition + '%"></span>';
+ }
+ }
+ return str;
+ } else
+ return "";
+ return "";
+ };
+ scope.drawScale = function (scaleDiv) {
+ angular.forEach(angular.element(scaleDiv).find('ins'), function (scaleLabel, key) {
+ scaleLabel.style.marginLeft = -scaleLabel.clientWidth / 2;
+ });
+ };
+ var forceApply = function (value) {
+ var val = value.split(";")[1];
+ scope.$apply(function () {
+ ngModel.$setViewValue(parseInt(val));
+ });
+ if (scope.options.callback) {
+ scope.options.callback(parseInt(val));
+ }
+ };
+ scope.$watch('options', function (value) {
+ init();
+ });
+ angular.element.slider = function (inputElement, element, settings) {
+ if (!element.data('jslider'))
+ element.data('jslider', new Slider(inputElement, element, settings));
+ var sliderObj = element.data('jslider');
+ return sliderObj;
+ };
+ }
+ };
+ }]);
+angular.module('att.abs.steptracker', ['att.abs.transition'])
+ .directive('steptracker', ['$timeout', function ($timeout) {
+ return {
+ // This allows dev's clickHandler to cancel an operation
+ priority: 100,
+ scope: {
+ sdata: "=sdata",
+ cstep: "=currentStep",
+ clickHandler: '=?',
+ disableClick: '=?'
+ },
+ restrict: 'EA',
+ replace: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/steptracker/step-tracker.html',
+ link: function (scope, elem) {
+ if (scope.disableClick === undefined) {
+ scope.disableClick = false;
+ }
+ $timeout(function () {
+ if (scope.cstep < 1) {
+ scope.cstep = 1;
+ }
+ else if (scope.cstep > scope.sdata.length) {
+ scope.cstep = scope.sdata.length;
+ }
+ var divs = elem.find('div');
+ var slidertracks = [];
+ for (var i in divs) {
+ if (divs.eq(i)[0]) {
+ var el = divs.eq(i)[0].className;
+ if (el.indexOf('track ng-scope') > -1) {
+ slidertracks.push(divs.eq(i));
+ }
+ }
+ }
+ var currentPage,totalPage,currentTrack = updateCurrentTrack(scope.cstep);
+ function updateCurrentTrack(step) {
+ // Always return the step-1 because array starts at 0
+ return angular.element(slidertracks[step - 1]);
+ }
+ function updateTrackWidth() {
+ if (scope.cstep > 0 && scope.cstep <= scope.sdata.length - 1 && currentPage > 0) {
+ var newWidth = ((currentPage / totalPage) * 100) + "%";
+ currentTrack = updateCurrentTrack(scope.cstep);
+ currentTrack.css('width', newWidth);
+ }
+ }
+ function updatePages() {
+ if (scope.cstep <= scope.sdata.length) {
+ currentPage = scope.sdata[scope.cstep - 1]['currentPage'];
+ totalPage = scope.sdata[scope.cstep - 1]['totalPages'];
+ }
+ }
+ // dynamically add width for steps, depending on the number of steps.
+ scope.set_width = function (indexval) {
+ var setwidth = (100 / (scope.sdata.length - 1)) + "%";
+ // skip last element and add width for all other element
+ if ((scope.sdata.length - 1) > indexval) {
+ return {'width': setwidth};
+ }
+ };
+ scope.$watch('sdata', function () {
+ updatePages();
+ var prevStep = scope.cstep;
+ // Before anything, ensure currentPage is never below 1
+ if (currentPage < 1) {
+ currentPage = 1;
+ if (scope.cstep !== 1) {
+ // Decrease step, current track width is 0%, new step width updates
+ scope.cstep--;
+ updatePages();
+ }
+ }
+ // Move to next step, reset currentPage, totalPage, and ensure previous steps are completed
+ if (currentPage > totalPage) {
+ if (scope.cstep > scope.sdata.length - 1) {
+ scope.cstep++;
+ return;
+ } else {
+ currentPage = totalPage;
+ updateTrackWidth();
+ scope.cstep++;
+ updatePages();
+ updateTrackWidth();
+ }
+ }
+ if (currentPage < 1 && prevStep === scope.cstep) {
+ currentPage = 1;
+ if (scope.cstep > 1) {
+ scope.cstep--;
+ scope.sdata[scope.cstep - 1]['currentPage'] = scope.sdata[scope.cstep - 1]['totalPages'];
+ scope.sdata[scope.cstep]['currentPage'] = 1;
+ }
+ }
+ updateTrackWidth();
+ }, true);
+ //add the active class for current step
+ scope.activestep = function (index) {
+ return (index === scope.cstep - 1);
+ };
+ //add the done class for finished step
+ scope.donesteps = function (index) {
+ return (index < scope.cstep - 1);
+ };
+ //add the last class for final step
+ scope.laststep = function (index) {
+ return (index === scope.sdata.length - 1);
+ };
+ scope.isIncomplete = function (index) {
+ if (index === scope.cstep - 1) {
+ return false;
+ }
+ if (index >= 0 && index < scope.sdata.length - 1) {
+ var step = scope.sdata[index];
+ return (step['currentPage'] <= step['totalPages']);
+ }
+ };
+ //click event
+ scope.stepclick = function ($event, steps) {
+ // If we are decreasing steps, reset all currentPage counts to 1
+ if (steps < scope.cstep) {
+ for (var i = scope.cstep - 1; i > steps; i--) {
+ scope.sdata[i]['currentPage'] = 1;
+ }
+ scope.sdata[steps]['currentPage']--;
+ }
+ if (angular.isFunction(scope.clickHandler)) {
+ scope.clickHandler($event, steps);
+ }
+ scope.cstep = steps + 1;
+ // In the case we decremented previously from this step, we need to reset currentpage to default
+ if (scope.cstep <= scope.sdata.length && scope.sdata[scope.cstep]['currentPage'] < 1) {
+ scope.sdata[scope.cstep]['currentPage'] = 1;
+ }
+ updatePages();
+ updateTrackWidth();
+ };
+ }, 100);
+ }
+ };
+ }
+ ])
+ .constant('timelineConstants', {
+ STEP_TYPE: {
+ ALERT: 'alert',
+ COMPLETED: 'completed',
+ CANCELLED: 'cancelled'
+ }
+ })
+ .controller('AttTimelineCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
+ var timelineBarCtrls = [];
+ var timelineDotCtrls = [];
+ this.numSteps = 0;
+ this.isAlternate = function () {
+ return $scope.alternate;
+ };
+ this.addTimelineBarCtrls = function (t) {
+ timelineBarCtrls.push(t);
+ };
+ this.addTimelineDotCtrls = function (b) {
+ timelineDotCtrls.push(b);
+ };
+ $timeout(init, 200);
+ function init() {
+ function compare(a, b) {
+ if (a.order < b.order) {
+ return -1;
+ }
+ if (a.order > b.order) {
+ return 1;
+ }
+ return 0;
+ }
+ timelineDotCtrls.sort(compare);
+ timelineBarCtrls.sort(compare);
+ if ($scope.$parent.animate) {
+ animateSequence();
+ }
+ $scope.$watch('trigger', function (val) {
+ if (val) {
+ $scope.resetTimeline();
+ } else {
+ $scope.$parent.animate = false;
+ }
+ });
+ }
+ function animateSequence() {
+ var dotsDuration = .25;
+ var timelineBarProgressDuration = .25;
+ if (typeof $scope.barAnimateDuration === 'number') {
+ timelineBarProgressDuration = $scope.barAnimateDuration;
+ }
+ var start = createAnimation(0, timelineBarProgressDuration);
+ function setToInactiveStates() {
+ for (var i in timelineDotCtrls) {
+ var dotCtrl = timelineDotCtrls[i];
+ if (i % 2 === 0) {
+ dotCtrl.unhoveredStateForBelow(.25);
+ } else {
+ dotCtrl.unhoveredStateForAbove(.25);
+ }
+ if (dotCtrl.isStop()) {
+ break;
+ }
+ }
+ }
+ function createAnimation(i, duration) {
+ if (i === 0) {
+ return function () {
+ if (timelineDotCtrls[i + 1].isStop() && timelineDotCtrls[i + 1].isCancelled()) {
+ timelineBarCtrls[i].isCancelled(true);
+ }
+ timelineBarCtrls[i].animate(createAnimation(i + 1, duration), duration);
+ };
+ } else if (i === timelineBarCtrls.length - 1) {
+ return function () {
+ //Removes the bolded text from the start
+ if (timelineDotCtrls[0].isCurrentStep()) {
+ timelineDotCtrls[0].isCurrentStep(false);
+ }
+ if (timelineDotCtrls[i].isStop()) {
+ timelineDotCtrls[i - 1].shrinkAnimate(dotsDuration);
+ timelineDotCtrls[i].isCurrentStep(true);
+ } else {
+ timelineDotCtrls[i - 1].shrinkAnimate(dotsDuration);
+ timelineBarCtrls[i].animate(createAnimation(i + 1, duration), duration);
+ }
+ timelineDotCtrls[i].expandedAnimate(dotsDuration);
+ $timeout(function () {
+ setToInactiveStates();
+ }, 500);
+ };
+ }
+ //End Dot
+ else if (i === timelineBarCtrls.length) {
+ return function () {
+ //Removes the bolded text from the start
+ if (timelineDotCtrls[0].isCurrentStep()) {
+ timelineDotCtrls[0].isCurrentStep(false);
+ }
+ timelineDotCtrls[i - 1].shrinkAnimate(dotsDuration);
+ timelineDotCtrls[i].expandedAnimate(dotsDuration);
+ timelineDotCtrls[i].isCurrentStep(true);
+ $timeout(function () {
+ setToInactiveStates();
+ }, 500);
+ };
+ }
+ else {
+ return function () {
+ //Removes the bolded text from the start
+ if (timelineDotCtrls[0].isCurrentStep()) {
+ timelineDotCtrls[0].isCurrentStep(false);
+ }
+ if (timelineDotCtrls[i].isStop()) {
+ timelineDotCtrls[i - 1].shrinkAnimate(dotsDuration);
+ timelineDotCtrls[i].expandedAnimate(dotsDuration);
+ timelineDotCtrls[i].isCurrentStep(true);
+ $timeout(function () {
+ setToInactiveStates();
+ }, 500);
+ } else {
+ if (timelineDotCtrls[i + 1].isStop() && timelineDotCtrls[i + 1].isCancelled()) {
+ timelineBarCtrls[i].isCancelled(true);
+ }
+ timelineDotCtrls[i - 1].shrinkAnimate(dotsDuration);
+ timelineBarCtrls[i].animate(createAnimation(i + 1, duration), duration);
+ timelineDotCtrls[i].expandedAnimate(dotsDuration);
+ }
+ };
+ }
+ }
+ start();
+ }
+ }])
+ .directive('attTimeline', ['$timeout', '$compile', function ($timeout, $compile) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ scope: {
+ steps: '=',
+ trigger: '=',
+ alternate: '=',
+ barAnimateDuration: '='
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/steptracker/timeline.html',
+ controller: 'AttTimelineCtrl',
+ link: function (scope, element, attrs, ctrl) {
+ var init = function () {
+ var steps = scope.steps;
+ var middleSteps = [];
+ for (var i = 1; i < steps.length; i++) {
+ var aStep = steps[i];
+ middleSteps.push(aStep);
+ }
+ scope.middleSteps = middleSteps;
+ //Used in calculating the width of the loading bars
+ ctrl.numSteps = steps.length - 1;
+ };
+ init();
+ //Recompile in case of scope changes
+ scope.resetTimeline = function () {
+ scope.animate = true;
+ $compile(element)(scope);
+ };
+ }
+ };
+ }])
+ .controller('TimelineBarCtrl', ['$scope', function ($scope) {
+ this.type = 'timelinebar';
+ this.order = parseInt($scope.order);
+ this.animate = function (callback, duration) {
+ $scope.loadingAnimation(callback, duration);
+ };
+ this.isCancelled = function (isCancelled) {
+ $scope.isCancelled = isCancelled;
+ };
+ }])
+ .directive('timelineBar', ['animation', '$progressBar', function (animation, $progressBar) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/steptracker/timelineBar.html',
+ scope: {
+ order: '@'
+ },
+ require: ['^attTimeline', 'timelineBar'],
+ controller: 'TimelineBarCtrl',
+ link: function (scope, element, attrs, ctrls) {
+ var attTimelineCtrl = ctrls[0];
+ var timelineBarCtrl = ctrls[1];
+ attTimelineCtrl.addTimelineBarCtrls(timelineBarCtrl);
+ scope.isCompleted = true;
+ var widthPerc = (100 / attTimelineCtrl.numSteps) - 3;
+ element.css('width', widthPerc + '%');
+ var elem = element.find('div').eq(0);
+ animation.set(elem, {opacity: 0.0});
+ var updateCallback = function (selfElement) {
+ animation.set(elem, {opacity: 1.0});
+ animation.set(elem, {
+ scaleX: selfElement.progress(),
+ transformOrigin: "left"
+ });
+ };
+ scope.loadingAnimation = $progressBar(updateCallback);
+ }
+ };
+ }])
+ .controller('TimelineDotCtrl', ['$scope', '$timeout', 'timelineConstants', function ($scope, $timeout, timelineConstants) {
+ this.type = 'dot';
+ this.order = parseInt($scope.order);
+ var self = this;
+ $timeout(function () {
+ if (self.order !== 0) {
+ if (self.order % 2 !== 0) {
+ $scope.initializeAboveForAnimation();
+ }
+ else {
+ $scope.initializeBelowForAnimation();
+ }
+ }
+ });
+ this.expandedAnimate = function (duration) {
+ $scope.setColor();
+ $scope.expandedAnimate(duration);
+ if (self.order !== 0 && !$scope.isStepsLessThanFive()) {
+ if (self.order % 2 !== 0) {
+ $scope.expandContentForAbove(duration);
+ } else {
+ $scope.expandContentForBelow(duration);
+ }
+ }
+ };
+ this.unhoveredStateForAbove = function (duration) {
+ $scope.unhoveredStateForAbove(duration);
+ };
+ this.unhoveredStateForBelow = function (duration) {
+ $scope.unhoveredStateForBelow(duration);
+ };
+ this.shrinkAnimate = function (duration) {
+ $scope.shrinkAnimate(duration);
+ };
+ this.setExpanded = function () {
+ $scope.setSize(3);
+ };
+ this.isStop = function () {
+ return $scope.isStop;
+ };
+ this.isCancelled = function () {
+ return ($scope.type === timelineConstants.STEP_TYPE.CANCELLED);
+ };
+ this.isAlert = function () {
+ return ($scope.type === timelineConstants.STEP_TYPE.ALERT);
+ };
+ //Sets the bolded text
+ this.isCurrentStep = function (isCurrentStep) {
+ if (isCurrentStep !== undefined) {
+ $scope.isCurrentStep = isCurrentStep;
+ }
+ return $scope.isCurrentStep;
+ };
+ }])
+ .directive('timelineDot', ['animation', 'timelineConstants',
+ function (animation, timelineConstants) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ scope: {
+ order: '@',
+ title: '@',
+ description: '@',
+ by: '@',
+ date: '@',
+ type: '@'
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/steptracker/timelineDot.html',
+ require: ['^attTimeline', 'timelineDot'],
+ controller: 'TimelineDotCtrl',
+ link: function (scope, element, attrs, ctrls) {
+ var attTimelineCtrl = ctrls[0];
+ var timelineDotCtrl = ctrls[1];
+ attTimelineCtrl.addTimelineDotCtrls(timelineDotCtrl);
+ scope.numSteps = attTimelineCtrl.numSteps + 1;
+ scope.isCurrentStep = false;
+ scope.isCompleted = false;
+ scope.isStop = false;
+ if (scope.type === timelineConstants.STEP_TYPE.ALERT || scope.type === timelineConstants.STEP_TYPE.CANCELLED) {
+ scope.isStop = true;
+ }
+ scope.isInactive = true;
+ var divs = element.find('div');
+ var biggerCircleElem = divs.eq(0);
+ var expandableCircleElem = divs.eq(2);
+ var infoboxElem = divs.eq(3);
+ var titleElem = divs.eq(5);
+ var contentElem = divs.eq(6);
+ var dateElem = divs.eq(9);
+ function isEmptyStep() {
+ if (!scope.description && !scope.by && !scope.date) {
+ return true;
+ }
+ return false;
+ }
+ scope.isStepsLessThanFive = function () {
+ if (scope.numSteps < 5) {
+ return true;
+ }
+ return false;
+ };
+ scope.titleMouseover = function (num) {
+ if (!scope.isStepsLessThanFive() && !isEmptyStep()) {
+ if (num === 1 && scope.order % 2 === 0) {
+ scope.expandContentForBelow(.25);
+ }
+ if (num === 2 && scope.order % 2 !== 0) {
+ scope.expandContentForAbove(.25);
+ }
+ }
+ };
+ scope.titleMouseleave = function () {
+ if (scope.order % 2 === 0) {
+ scope.unhoveredStateForBelow(.25);
+ }
+ else {
+ scope.unhoveredStateForAbove(.25);
+ }
+ };
+ scope.initializeAboveForAnimation = function () {
+ if (!scope.isStepsLessThanFive() && attTimelineCtrl.isAlternate()) {
+ animation.set(contentElem, {opacity: 0});
+ animation.set(dateElem, {opacity: 0});
+ if (!isEmptyStep()) {
+ var yOffset = contentElem[0].offsetHeight + dateElem[0].offsetHeight;
+ animation.set(titleElem, {'top': yOffset});
+ }
+ }
+ };
+ scope.expandContentForAbove = function (duration) {
+ if (!scope.isStepsLessThanFive() && attTimelineCtrl.isAlternate()) {
+ animation.to(titleElem, duration, {'top': 0});
+ animation.to(contentElem, duration, {opacity: 1});
+ animation.to(dateElem, duration, {opacity: 1});
+ }
+ };
+ scope.unhoveredStateForAbove = function (duration) {
+ if (!scope.isStepsLessThanFive() && attTimelineCtrl.isAlternate()) {
+ animation.set(contentElem, {opacity: 0});
+ animation.set(dateElem, {opacity: 1});
+ var yOffset = contentElem[0].offsetHeight;
+ animation.to(titleElem, duration, {'top': yOffset});
+ }
+ };
+ scope.initializeBelowForAnimation = function () {
+ if (!scope.isStepsLessThanFive() && attTimelineCtrl.isAlternate()) {
+ animation.set(contentElem, {height: '0%', opacity: 0, top: '-20px'});
+ animation.set(dateElem, {opacity: 0});
+ }
+ };
+ scope.expandContentForBelow = function (duration) {
+ if (!scope.isStepsLessThanFive() && attTimelineCtrl.isAlternate()) {
+ animation.set(dateElem, {opacity: 1});
+ animation.to(contentElem, duration, {height: 'auto', opacity: 1, top: '0px'});
+ }
+ };
+ scope.unhoveredStateForBelow = function (duration) {
+ if (!scope.isStepsLessThanFive() && attTimelineCtrl.isAlternate()) {
+ animation.to(contentElem, duration, {height: '0%', opacity: 0, top: '-20px', position: 'relative'});
+ animation.set(dateElem, {opacity: 1});
+ }
+ };
+ /*Default Initializaztion*/
+ //If the info box is above and the description and date and by are empty then we have do reset its position
+ if (isEmptyStep() && (scope.order % 2 !== 0 && attTimelineCtrl.isAlternate())) {
+ infoboxElem.css('top', '-47px');
+ }
+ //Check if the order is odd and set the appropiate above or below and other effects
+ if (scope.order % 2 === 0 || !attTimelineCtrl.isAlternate()) {
+ scope.isBelowInfoBoxShown = true;
+ }
+ else {
+ scope.isBelowInfoBoxShown = false;
+ }
+ //modify some css for steps less than 5 and not alternating
+ if (scope.isStepsLessThanFive() && !attTimelineCtrl.isAlternate()) {
+ animation.set(dateElem, {marginTop: 10});
+ }
+ //For IE 8 fix
+ animation.set(biggerCircleElem, {opacity: '.5'});
+ //shrink the expandableCircle to we can expand it later
+ animation.set(expandableCircleElem, {opacity: '0.0'});
+ animation.set(expandableCircleElem, {scale: .10});
+ if (scope.order === 0) {
+ animation.set(expandableCircleElem, {opacity: '1.0'});
+ animation.set(expandableCircleElem, {scale: 1});
+ animation.set(biggerCircleElem, {scale: 3});
+ scope.isCurrentStep = true;
+ scope.isInactive = false;
+ scope.isCompleted = true;
+ }
+ scope.setColor = function () {
+ scope.isInactive = false;
+ if (scope.type === timelineConstants.STEP_TYPE.CANCELLED) {
+ scope.isCancelled = true;
+ }
+ else if (scope.type === timelineConstants.STEP_TYPE.ALERT) {
+ scope.isAlert = true;
+ }
+ else {
+ scope.isCompleted = true;
+ }
+ if (!scope.$phase) {
+ scope.$apply();
+ }
+ };
+ scope.setSize = function (size) {
+ animation.set(biggerCircle, {scale: size});
+ };
+ scope.setExpandedCircle = function () {
+ animation.set(expandableCircleElem, {opacity: '1.0'});
+ animation.set(expandableCircleElem, {scale: 1});
+ };
+ scope.expandedAnimate = function (duration) {
+ animation.to(biggerCircleElem, duration, {scale: 3});
+ animation.set(expandableCircleElem, {opacity: '1.0'});
+ animation.to(expandableCircleElem, duration, {scale: 1});
+ };
+ scope.shrinkAnimate = function (duration) {
+ animation.to(biggerCircleElem, duration, {scale: 1});
+ };
+ }
+ };
+ }]);
+angular.module('att.abs.table', ['att.abs.utilities'])
+.constant('tableConfig', {
+ //true for descending & false for ascending
+ defaultSortPattern: false,
+ highlightSearchStringClass: 'tablesorter-search-highlight'
+})
+
+.directive('attTable', ['$filter', function($filter) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ scope: {
+ tableData: "=",
+ viewPerPage: "=",
+ currentPage: "=",
+ totalPage: "=",
+ searchCategory: "=",
+ searchString: "="
+ },
+ require: 'attTable',
+ templateUrl: 'app/scripts/ng_js_att_tpls/table/attTable.html',
+ controller: ['$scope', function($scope) {
+ this.headers = [];
+ this.currentSortIndex = null;
+ this.setIndex = function(headerScope) {
+ this.headers.push(headerScope);
+ };
+ this.getIndex = function(headerName) {
+ for (var i = 0; i < this.headers.length; i++) {
+ if (this.headers[i].headerName === headerName) {
+ return this.headers[i].index;
+ }
+ }
+ return null;
+ };
+ this.sortData = function(columnIndex, reverse) {
+ $scope.$parent.columnIndex = columnIndex;
+ $scope.$parent.reverse = reverse;
+ this.currentSortIndex = columnIndex;
+ $scope.currentPage = 1;
+ this.resetSortPattern();
+ };
+ this.getSearchString = function() {
+ return $scope.searchString;
+ };
+ this.resetSortPattern = function() {
+ for(var i = 0; i < this.headers.length; i++) {
+ var currentScope = this.headers[i];
+ if(currentScope.index !== this.currentSortIndex) {
+ currentScope.resetSortPattern();
+ }
+ }
+ };
+ }],
+ link: function(scope, elem, attr, ctrl) {
+ scope.searchCriteria = {};
+ scope.$watchCollection('tableData', function(value) {
+ if(value && !isNaN(value.length)) {
+ scope.totalRows = value.length;
+ }
+ });
+ scope.$watch('currentPage', function(val) {
+ scope.$parent.currentPage = val;
+ });
+ scope.$watch('viewPerPage', function(val) {
+ scope.$parent.viewPerPage = val;
+ });
+ scope.$watch(function() {
+ return scope.totalRows / scope.viewPerPage;
+ }, function(value) {
+ if(!isNaN(value)) {
+ scope.totalPage = Math.ceil(value);
+ scope.currentPage = 1;
+ }
+ });
+ var searchValCheck = function(val){
+ if(angular.isDefined(val) && val !== null && val !== ""){
+ return true;
+ }
+ };
+ var setSearchCriteria = function(v1,v2){
+ if(searchValCheck(v1) && searchValCheck(v2)){
+ var index = ctrl.getIndex(v2);
+ scope.searchCriteria = {};
+ if (index !== null) {
+ scope.searchCriteria[index] = v1;
+ }
+ }else if(searchValCheck(v1) && (!angular.isDefined(v2) || v2 === null || v2 === "")){
+ scope.searchCriteria = {
+ $: v1
+ };
+ }else {
+ scope.searchCriteria = {};
+ }
+ };
+ scope.$watch('searchCategory', function(newVal,oldVal) {
+ if(newVal !== oldVal){
+ setSearchCriteria(scope.searchString,newVal);
+ }
+ });
+ scope.$watch('searchString', function (newVal,oldVal) {
+ if(newVal !== oldVal){
+ setSearchCriteria(newVal,scope.searchCategory);
+ }
+ });
+ scope.$watchCollection('searchCriteria', function(val) {
+ scope.$parent.searchCriteria = val;
+ scope.totalRows = scope.tableData && ($filter('filter')(scope.tableData, val, false)).length || 0;
+ scope.currentPage = 1;
+ });
+ }
+ };
+}])
+
+.directive('attTableRow', [function() {
+ return {
+ restrict: 'EA',
+ compile: function (elem, attr) {
+ if (attr.type === 'header') {
+ elem.find('tr').eq(0).addClass('tablesorter-headerRow');
+ } else if (attr.type === 'body') {
+ var html = elem.children();
+ if(attr.rowRepeat){
+ if (attr.trackBy) {
+ html.attr('ng-repeat', attr.rowRepeat.concat(" | orderBy : columnIndex : reverse | filter : searchCriteria : false | attLimitTo : viewPerPage : viewPerPage*(currentPage-1) track by " + attr.trackBy));
+ } else {
+ html.attr('ng-repeat', attr.rowRepeat.concat(" | orderBy : columnIndex : reverse | filter : searchCriteria : false | attLimitTo : viewPerPage : viewPerPage*(currentPage-1) track by $index"));
+ }
+ }
+ html.attr('ng-class', "{'alt-row': $even,'normal-row': $odd}");
+ elem.append(html);
+ }
+ }
+ };
+}])
+
+.directive('attTableHeader', ['tableConfig', function(tableConfig) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ scope: {
+ sortable: '@',
+ defaultSort: '@',
+ index: '@key'
+ },
+ require: '^attTable',
+ templateUrl: 'app/scripts/ng_js_att_tpls/table/attTableHeader.html',
+ link: function(scope, elem, attr, ctrl) {
+ var reverse = tableConfig.defaultSortPattern;
+ scope.headerName = elem.text();
+ scope.sortPattern = null;
+ ctrl.setIndex(scope);
+
+ scope.$watch(function() {
+ return elem.text();
+ }, function(value) {
+ scope.headerName = value;
+ });
+ scope.sort = function(sortType) {
+ if(typeof sortType === 'boolean') {
+ reverse = sortType;
+ }
+ ctrl.sortData(scope.index, reverse);
+ scope.sortPattern = reverse ? 'descending' : 'ascending';
+ reverse = !reverse;
+ };
+ scope.$watch(function() {
+ return ctrl.currentSortIndex;
+ }, function(value) {
+ if (value !== scope.index) {
+ scope.sortPattern = null;
+ }
+ });
+
+ if (scope.sortable === undefined || scope.sortable === 'true' || scope.sortable === true) {
+ scope.sortable = 'true';
+ } else if (scope.sortable === false || scope.sortable === 'false') {
+ scope.sortable = 'false';
+ }
+
+ if(scope.sortable !== 'false') {
+ if(scope.defaultSort === 'A' || scope.defaultSort === 'a') {
+ scope.sort(false);
+ } else if(scope.defaultSort === 'D' || scope.defaultSort === 'd') {
+ scope.sort(true);
+ }
+ }
+ scope.resetSortPattern = function() {
+ reverse = tableConfig.defaultSortPattern;
+ };
+ }
+ };
+}])
+
+.directive('attTableBody', ['$filter', '$timeout', 'tableConfig', function($filter, $timeout, tableConfig) {
+ return {
+ restrict: 'EA',
+ require: '^attTable',
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/table/attTableBody.html',
+ link: function (scope, elem, attr, ctrl) {
+ var highlightSearchStringClass = tableConfig.highlightSearchStringClass;
+ var searchString = "";
+ var wrapElement = function (elem) {
+ var text = elem.text();
+ elem.html($filter('highlight')(text, searchString, highlightSearchStringClass));
+ };
+ var traverse = function (elem) {
+ var innerHtml = elem.children();
+ if (innerHtml.length > 0) {
+ for (var i = 0; i < innerHtml.length; i++) {
+ traverse(innerHtml.eq(i));
+ }
+ } else {
+ wrapElement(elem);
+ return;
+ }
+ };
+ var clearWrap = function (elem) {
+ var elems = elem.find('*');
+ for (var i = 0; i < elems.length; i++) {
+ if (elems.eq(i).attr('class') && elems.eq(i).attr('class').indexOf(highlightSearchStringClass) !== -1) {
+ var text = elems.eq(i).text();
+ elems.eq(i).replaceWith(text);
+ }
+ }
+ };
+ $timeout(function () {
+ var actualHtml = elem.children();
+ scope.$watch(function () {
+ return ctrl.getSearchString();
+ }, function (val) {
+ searchString = val;
+ clearWrap(elem);
+ if (actualHtml.length > 0) {
+ traverse(elem);
+ } else {
+ wrapElement(elem);
+ }
+ });
+ }, 50);
+ }
+ };
+}]);
+
+angular.module('att.abs.tableMessages', ['att.abs.utilities'])
+ .constant('messageConstants', {
+ TABLE_MESSAGE_TYPES: {
+ noMatching: 1,
+ errorLoading: 2,
+ magnifySearch: 3,
+ isLoading: 4},
+ USER_MESSAGE_TYPES: {
+ success: 1,
+ error: 0
+ }
+ })
+ .directive('attTableMessage', ['messageConstants', function(messageConstants) {
+ return {
+ restrict: 'AE',
+ replace: true,
+ transclude: true,
+ scope: {
+ msgType: '=',
+ onRefreshClick: '&'
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/tableMessages/attTableMessage.html',
+ link: function(scope) {
+ scope.messageConstants = messageConstants;
+ scope.refreshAction = function(evt) {
+ scope.onRefreshClick(evt);
+ };
+ }
+ };
+ }]).directive('attUserMessage', ['messageConstants', '$timeout', 'DOMHelper', function(messageConstants, $timeout, DOMHelper) {
+ return {
+ restrict: 'AE',
+ replace: true,
+ transclude: true,
+ scope: {
+ thetitle: '=',
+ type: '=',
+ message: '=',
+ trigger: '='
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/tableMessages/attUserMessage.html',
+ link: function(scope, element) {
+ var prevActiveElement = undefined;
+ var firstElement = undefined;
+ scope.messageConstants = messageConstants;
+
+ $timeout(function() {
+ firstElement = DOMHelper.firstTabableElement(element[0]);
+ }, 10);
+
+
+ scope.$watch('trigger', function() {
+ if (scope.trigger) {
+ prevActiveElement = document.activeElement;
+ if (angular.isDefined(firstElement)) {
+ firstElement.focus();
+ }
+ } else {
+ if (angular.isDefined(prevActiveElement)) {
+ prevActiveElement.focus();
+ }
+ }
+ })
+
+
+ }
+ };
+ }]);
+angular.module('att.abs.tabs', ['att.abs.utilities'])
+ .directive('attTabs', function () {
+ return{
+ restrict: 'EA',
+ transclude: false,
+ replace: true,
+ scope: {
+ tabs: "=title"
+ },
+ controller: ['$scope', function ($scope) {
+ this.getData = function () {
+ return $scope.tabs;
+ };
+ this.onClickTab = function (tab) {
+ $scope.currentTab = tab.url;
+ return $scope.currentTab;
+ };
+ this.isActiveTab = function (tab) {
+ return (tab === $scope.currentTab);
+ };
+ }],
+ link: function (scope) {
+ for (var i = 0; i < scope.tabs.length; i++) {
+ if ((scope.tabs[i].selected) && (scope.tabs[i].url)) {
+ scope.currentTab = scope.tabs[i].url;
+ }
+ }
+ }
+ };
+ })
+ .directive('floatingTabs', function () {
+ return {
+ require: '^attTabs',
+ restrict: 'EA',
+ transclude: false,
+ replace: true,
+ scope: {
+ size: "@"
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/tabs/floatingTabs.html',
+ link: function (scope, elem, attr, attTabsCtrl) {
+ scope.tabs = attTabsCtrl.getData();
+ scope.onClickTab = attTabsCtrl.onClickTab;
+ scope.isActiveTab = attTabsCtrl.isActiveTab;
+ }
+ };
+ })
+ .directive('simplifiedTabs', function () {
+ return {
+ require: '^attTabs',
+ restrict: 'EA',
+ transclude: false,
+ replace: true,
+ scope: {
+ ctab: "=ngModel"
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/tabs/simplifiedTabs.html',
+ link: function (scope, elem, attr, attTabsCtrl) {
+ scope.tabs = attTabsCtrl.getData();
+ scope.clickTab = function (tab) {
+ scope.ctab = tab.id;
+ return scope.ctab;
+ };
+ scope.isActive = function (tab) {
+ return (tab === scope.ctab);
+ };
+ }
+ };
+ })
+ .directive('genericTabs', function () {
+ return {
+ require: '^attTabs',
+ restrict: 'EA',
+ transclude: false,
+ replace: true,
+ scope: {
+ ctab: "=ngModel"
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/tabs/genericTabs.html',
+ link: function (scope, elem, attr, attTabsCtrl) {
+ scope.tabs = attTabsCtrl.getData();
+ scope.clickTab = function (tab) {
+ scope.ctab = tab.id;
+ return scope.ctab;
+ };
+ scope.isActive = function (tab) {
+ return (tab === scope.ctab);
+ };
+ }
+ };
+ })
+ .directive('skipNavigation', function(){
+ return{
+ link: function(scope,elem,attr){
+ elem.bind('click', function(){
+ var skiptoBody = angular.element(elem.parent().parent().parent().parent())[0].querySelector('a.skiptoBody');
+ (angular.element(skiptoBody)).attr('tabindex',-1);
+ skiptoBody.focus();
+ });
+
+ }
+ }
+ })
+ .directive('parentTab', [function () {
+ return {
+ restrict: 'EA',
+ scope: {
+ menuItems: '=',
+ activeSubMenu: '=',
+ activeMenu: '='
+ },
+ controller: ['$scope', function ($scope) {
+ $scope.megaMenu = $scope.menuItems;
+ $scope.megaMenuTab;
+ $scope.megaMenuHoverTab;
+ this.setMenu = function () {
+ $scope.menuItems = $scope.megaMenu;
+ $scope.activeSubMenu.scroll=false;
+ for (var i = 0; i < $scope.menuItems.length; i++) {
+ if ($scope.menuItems[i].active) {
+ $scope.activeMenu = $scope.menuItems[i];
+ }
+ }
+ this.setSubMenuStatus(false);
+ $scope.$apply();
+ };
+ this.setActiveMenu = function () {
+ if (!($scope.megaMenuTab === undefined || $scope.megaMenuTab === null)) {
+ $scope.menuItems = [$scope.megaMenuTab];
+ $scope.megaMenuTab.scroll = true;
+ $scope.activeMenu = {};
+ $scope.activeSubMenu = $scope.megaMenuTab;
+ this.setSubMenuStatus(true);
+ }
+ else{
+ for(var i=0; i<$scope.menuItems.length; i++){
+ ($scope.menuItems[i].active = false);
+ if($scope.menuItems[i].subItems)
+ for(var j=0; j<$scope.menuItems[i].subItems.length; j++){
+ $scope.menuItems[i].subItems[j].active = false;
+ };
+ };
+ $scope.menuItems=$scope.megaMenu;
+ }
+ $scope.$apply();
+ };
+ var checkSubMenuStatus = false;
+ this.setSubMenuStatus = function (value) {
+ checkSubMenuStatus = value;
+ };
+ this.getSubMenuStatus = function () {
+ return checkSubMenuStatus;
+ };
+ this.setActiveMenuTab = function (tab) {
+ $scope.megaMenuTab = tab;
+ };
+ this.setActiveMenuHoverTab = function (tab) {
+ $scope.megaMenuHoverTab = tab;
+ };
+ this.setActiveSubMenuTab = function () {
+ $scope.megaMenuTab = $scope.megaMenuHoverTab;
+ };
+ this.resetMenuTab = function () {
+ $scope.megaMenuTab = undefined;
+ };
+ this.clearSubMenu = function () {
+ /* Clears Sub-tems when focus shifts from Sub-menu to Mega menu*/
+ $scope.$evalAsync(function(){
+ $scope.megaMenuTab = undefined;
+ $scope.megaMenuHoverTab = undefined;
+ })
+ };
+ }]
+ };
+ }])
+ .directive('parentmenuTabs', [function () {
+ return {
+ restrict: 'EA',
+ transclude: true,
+ replace: true,
+ scope: {
+ megaMenu: '@',
+ menuItems: '='
+ },
+ controller: ['$scope', function ($scope) {
+ this.getMenu = function () {
+ return $scope.menuItems;
+ };
+ this.setMenu = function (menuItem) {
+ $scope.menuItems = menuItem;
+ };
+ }],
+ templateUrl: 'app/scripts/ng_js_att_tpls/tabs/parentmenuTab.html'
+ };
+ }])
+
+ .directive('menuTabs', ["$window", "$document",'events','keymap', function (win, $document, events, keymap) {
+ return {
+ restrict: 'EA',
+ transclude: true,
+ replace: true,
+ require: ['^?parentTab', '^?parentmenuTabs'],
+ scope: {
+ activeMenu: "=",
+ menuItem: "=",
+ subMenu: "@",
+ subItemActive: "@",
+ tabName: "=?",
+ tabUrl: "=?"
+ },
+ templateUrl: function (element, attrs) {
+ if (attrs.megaMenu) {
+ return 'app/scripts/ng_js_att_tpls/tabs/menuTab.html';
+ }
+ else {
+ return 'app/scripts/ng_js_att_tpls/tabs/submenuTab.html';
+ }
+ },
+ link: function (scope, elem, attr, ctrl) {
+ var parentCtrl = ctrl[0];
+ var parentmenuCtrl = ctrl[1];
+ scope.clickInactive = true;
+ scope.showHoverChild = function (e) {
+ scope.clickInactive = false;
+ scope.hoverChild = ctrl[0].getSubMenuStatus();
+ if (e.type === "mouseover" && ctrl[0].getSubMenuStatus())
+ {
+ //scope.showChildren(e);
+ }
+
+ };
+ scope.showChildren = function (e) {
+ scope.parentMenuItems = parentmenuCtrl.getMenu();
+ for (var i = 0; i < scope.parentMenuItems.length; i++) {
+ scope.parentMenuItems[i].active = false;
+ if (scope.parentMenuItems[i].subItems) {
+ for (var j = 0; j < scope.parentMenuItems[i].subItems.length; j++) {
+ scope.parentMenuItems[i].subItems[j].active = false;
+ }
+ }
+ scope.clickInactive = true;
+ }
+ scope.menuItem.active = true;
+ scope.activeMenu = scope.menuItem;
+ e.stopPropagation();
+ };
+ scope.$watch("subItemActive", function (value) {
+ if (value === "true" && scope.subMenu === 'true') {
+ parentCtrl.setActiveMenuHoverTab(scope.menuItem);
+ }
+ });
+ scope.showMenuClick = function (e) {
+ parentCtrl.setActiveMenuTab(scope.menuItem);
+ e.stopPropagation();
+ };
+ scope.showSubMenuClick = function (e) {
+ parentCtrl.setActiveSubMenuTab();
+ e.stopPropagation();
+ };
+ scope.resetMenu = function (e) {
+ parentCtrl.resetMenuTab();
+ e.stopPropagation();
+ };
+ function debounce(method, delay) {
+ clearTimeout(method._tId);
+ method._tId = setTimeout(function () {
+ parentCtrl.setMenu();
+ }, delay);
+ }
+ function debounce1(method, delay) {
+ clearTimeout(method._tId);
+ method._tId = setTimeout(function () {
+ parentCtrl.setActiveMenu();
+ }, delay);
+ }
+ $document.bind('scroll', function () {
+ /* if (win.pageYOffset === 0) {
+ debounce(parentCtrl.setMenu, 100);
+ }
+ else if (win.pageYOffset > 1 && win.pageYOffset < 1500) {
+ debounce1(parentCtrl.setActiveMenu, 100);
+ }*/
+ });
+ elem.bind('keydown', function(evt){
+ if (!(evt.keyCode)){
+ evt.keyCode = evt.which;
+ }
+ if(evt.keyCode !== keymap.KEY.TAB){
+ events.preventDefault(evt);
+ events.stopPropagation(evt);
+ }
+
+ switch (evt.keyCode) {
+ case keymap.KEY.ESC:
+ var skiptoBody;
+ if (!(elem.attr('mega-menu'))) {
+ if (elem.attr("sub-menu") === "true") {
+ /* condition true when user navigates through Sub-menu*/
+
+ skiptoBody = angular.element(elem.parent().parent().parent().parent().parent().parent().parent())[0].querySelector('a.skiptoBody');
+ (angular.element(skiptoBody)).attr('tabindex',-1);
+ skiptoBody.focus();
+ }
+ else if (elem.attr("sub-menu") === undefined) {
+ skiptoBody = angular.element(elem.parent().parent().parent().parent().parent().parent().parent().parent().parent().parent())[0].querySelector('a.skiptoBody');
+ (angular.element(skiptoBody)).attr('tabindex',-1);
+ skiptoBody.focus();
+ }
+ }
+ else
+ {
+ if (elem.attr("menu-item") === "item") {
+ /* Works when user on Mega menu*/
+
+ skiptoBody = angular.element(elem.parent().parent().parent().parent())[0].querySelector('a.skiptoBody');
+ (angular.element(skiptoBody)).attr('tabindex',-1);
+ skiptoBody.focus();
+ }
+ }
+ break;
+ case keymap.KEY.RIGHT:
+ if (!(elem.attr('mega-menu'))) {
+ var el = angular.element(elem)[0];
+ if (elem.attr("sub-menu") === "true") {
+ /* condition true when user navigates through Sub-menu*/
+ if(el.nextElementSibling === null){ break;}
+ if(el.nextElementSibling){
+ el.nextElementSibling.querySelector("a").focus();
+ }
+ else{
+ do{
+ if (el && el.nextSibling){
+ el = el.nextSibling;
+ }
+ else{
+ break;
+ }
+ } while (el && el.tagName !== 'LI');
+ if(el){
+ if (el.querySelector("a") == null){}
+ else{
+ el.querySelector("a").focus();}
+ }
+ events.preventDefault(evt);
+ events.stopPropagation(evt);
+ }
+ }
+ else if (elem.attr("sub-menu") === undefined) {
+ if(el.nextElementSibling === null) break;
+ if(el.nextElementSibling){
+ el.nextElementSibling.querySelector("a").focus();
+ }
+ else{
+ do{
+ if (el && el.nextSibling){
+ el = el.nextSibling;
+ }
+ else{
+ break;
+ }
+ } while (el && el.tagName !== 'LI');
+ if(el){
+ if (el.querySelector("a") == null){}
+ else{
+ el.querySelector("a").focus();}
+ }
+
+ }
+ }
+ }
+ else
+ {
+ if (elem.attr("menu-item") === "item") {
+ /* When user navigates through on Mega menu*/
+
+ var el = angular.element(elem)[0];
+
+ if(el.nextElementSibling){
+ if(el.nextElementSibling.querySelector("span") == null){
+ }
+ else {
+ el.nextElementSibling.querySelector("span").focus();
+ }
+ }
+ else{
+ do{
+ if (el && el.nextSibling){
+ el = el.nextSibling;
+ }
+ else{
+ break;
+ }
+ } while (el && el.tagName !== 'LI');
+ if(el){
+ if(el.querySelector("span") === null){}
+ else {
+ el.querySelector("span").focus();
+ }
+ }
+ events.preventDefault(evt);
+ events.stopPropagation(evt);
+ }
+ }
+ }
+ break;
+ case keymap.KEY.DOWN:
+
+
+ if (elem.attr('mega-menu')) {
+ /* When user navigates from top menu to Sub-menu*/
+ angular.element(elem)[0].querySelectorAll(".megamenu__items")[0].querySelector("a").focus();
+ }
+ else if(elem.attr("sub-menu") === undefined) {
+ /*When user navigates within Sub Items*/
+ var el = document.activeElement;
+ if(el.nextElementSibling === null) break;
+ if(el.nextElementSibling) {
+ el.nextElementSibling.focus();
+ }else{
+ do {
+ if (el && el.nextSibling){
+ el = el.nextSibling;
+ }
+ else{
+ break;
+ }
+ } while (el && el.tagName !== 'A');
+ if(el.attributes !== null){
+ el.focus();
+ }
+ events.stopPropagation(evt);
+ }
+
+ }
+ else if (elem.attr("sub-menu")=== "true" ) {
+ /* condition true when user navigates from sub menu to Sub Item*/
+ var childItems = angular.element(elem)[0].querySelector("span").querySelector('a');
+ if(childItems === null) break;
+ childItems.focus();
+ }
+ break;
+
+ case keymap.KEY.LEFT:
+
+ if (!(elem.attr('mega-menu'))) {
+ var el = angular.element(elem)[0];
+ if (elem.attr("sub-menu") === "true") {
+ /* condition true when user navigates through Sub-menu*/
+ if(el.previousElementSibling === null) break;
+ if(el.previousElementSibling){
+ el.previousElementSibling.querySelector("a").focus();
+ }
+ else{
+ do{
+ if (el && el.previousSibling){
+ el = el.previousSibling;
+ }
+ else{
+ break;
+ }
+ } while (el && el.tagName !== 'LI');
+ if(el){
+ if (el.querySelector("a") == null){}
+ else{
+ el.querySelector("a").focus();}
+ }
+ events.preventDefault(evt);
+ events.stopPropagation(evt);
+ }
+
+ /*el.previousElementSibling.querySelector("span").focus();
+ events.stopPropagation(evt);
+ break;*/
+ }
+ else if (elem.attr("sub-menu") === undefined) {
+ if(el.previousElementSibling === null) break;
+ if(el.previousElementSibling){
+ el.previousElementSibling.querySelector("a").focus();
+ }
+ else{
+ do{
+ if (el && el.previousSibling){
+ el = el.previousSibling;
+ }
+ else{
+ break;
+ }
+ } while (el && el.tagName !== 'LI');
+ if(el){
+ if (el.querySelector("a") == null){}
+ else{
+ el.querySelector("a").focus();}
+ }
+ }
+ }
+ }
+ else
+ {
+ if (elem.attr("menu-item") === "item") {
+ /* Works when user on Mega menu*/
+
+ var el = angular.element(elem)[0];
+ if(el.previousElementSibling){
+
+ if(el.previousElementSibling.querySelector("span") === null){
+ }
+ else {
+ el.previousElementSibling.querySelector("span").focus();
+ }
+
+ }
+ else{
+ do{
+ if (el && el.previousSibling){
+ el = el.previousSibling;
+ }
+ else{
+ break;
+ }
+ } while (el && el.tagName !== 'LI');
+ if(el){
+ if (el.querySelector("span") === null) {
+ }
+ else {
+ el.querySelector("span").focus();
+ }
+ }
+ events.preventDefault(evt);
+ events.stopPropagation(evt);
+ }
+ }
+ }
+ break;
+ case keymap.KEY.UP:
+
+ if (elem.attr("sub-menu") === "true") {
+ var el = document.activeElement;
+ var parent_menu = angular.element(elem.parent().parent().parent().parent())[0].querySelector("span");
+ parent_menu.focus();
+ parentCtrl.clearSubMenu();
+ scope.menuItem.active = false;
+ break;
+ }
+ else if(elem.attr("sub-menu") === undefined) {
+ /* condition true when user navigates within Sub Items*/
+ var el = document.activeElement;
+ var parent_menu = angular.element(elem.parent().parent().parent().parent())[0].querySelector("a");
+ if(document.activeElement === angular.element(el).parent().parent()[0].querySelectorAll('a')[0]){
+ parent_menu.focus();
+ break;
+ };
+
+ if(el.previousElementSibling) {
+ var prev_a = el.previousElementSibling;
+ (el.previousElementSibling != null)? el.previousElementSibling.focus(): parent_menu.focus();
+ }else{
+ do{
+ if (el && el.previousSibling){
+ el = el.previousSibling;
+ }
+ else{
+ break;
+ }
+ } while (el && el.tagName !== 'A');
+ if(el && (el.nodeType !== 3)){
+ el.focus();
+ }
+ events.preventDefault(evt);
+ events.stopPropagation(evt);
+ }
+
+ break;
+ }
+ default:
+ break;
+ }
+ });
+ }
+ };
+ }]);
+
+angular.module('att.abs.tagBadges', [])
+ .directive('tagBadges', ['$parse', '$timeout', function($parse, $timeout) {
+ return {
+ restrict: 'EA',
+ replace: false,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/tagBadges/tagBadges.html',
+ scope: {
+ styleType: "@",
+ onClose: "&"
+ },
+ link: function(scope, elem, attr) {
+ scope.isSmall = false;
+ scope.isIcon = false;
+ scope.isColor = false;
+ scope.display = true;
+ scope.isClosable = false;
+ scope.isHighlight = false;
+ scope.customColor = false;
+
+ if (attr.small === "") {
+ scope.isSmall = true;
+ }
+ if (scope.styleType === "icon") {
+ scope.isIcon = true;
+ }
+ else if (scope.styleType === "color") {
+ scope.isColor = true;
+ if(attr.color !== undefined && attr.color !== "") {
+ scope.customColor = true;
+ attr.$observe("color", function(val) {
+ scope.border_type_borderColor = val;
+ scope.background_type_backgroundColor = val;
+ scope.background_type_borderColor = val;
+ });
+ }
+ }
+ scope.activeHighlight = function(state){
+ if(scope.customColor){
+ if(state){
+ scope.isHighlight = true;
+ }
+ else{
+ scope.isHighlight = false;
+ }
+ }
+ };
+ if (attr.closable === "") {
+ scope.isClosable = true;
+ scope.closeMe = function() {
+ scope.display = false;
+ $timeout(function(){
+ elem.attr("tabindex", "0");
+ elem[0].focus();
+ elem.bind('blur', function(){
+ elem.remove();
+ });
+ });
+ if(attr['onClose']){
+ scope.onClose = $parse(scope.onClose);
+ scope.onClose();
+ }
+ };
+ }
+ }
+ };
+ }]);
+angular.module('att.abs.textOverflow', [])
+ .constant('textDefaultOptions', {
+ width: '50%'
+ })
+.directive('attTextOverflow', ['textDefaultOptions','$compile',function(textDefaultOptions,$compile)
+{
+ return {
+ restrict: 'A',
+ link: function(scope, elem, attrs)
+ {
+ var tooltipText = elem.text();
+ elem.addClass('text-ellipsis');
+ attrs.$observe('attTextOverflow', function(val){
+ if(val){
+ elem.css({"width":val});
+ }
+ else{
+ elem.css({"width":textDefaultOptions.width});
+ }
+ });
+ if(!(elem.attr('tooltip'))){
+ elem.attr("tooltip", tooltipText);
+ elem.attr("tooltip-placement", 'above');
+ var newElem = angular.element(elem);
+ $compile(newElem)(scope);
+ }
+ }
+ };
+}]);
+
+angular.module('att.abs.toggle', ['angular-gestures', 'att.abs.position'])
+ .directive('attToggleTemplate', ['$compile', '$log', '$position', function ($compile, $log, $position)
+ {
+ return{
+ restrict: 'A',
+ require: 'ngModel',
+ transclude: true,
+ scope: {
+ modelVal: "=ngModel"
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/toggle/demoToggle.html',
+ link: function (scope, element, attr) {
+ scope.initialDragPosition = 0;
+ var dragStatus = 0;
+ var switchMovementPath = ($position.offset(element.children().eq(1).children().eq(0)).width - 1);
+ var updateModelVal = function () {
+ if (scope.attrValue === attr.ngTrueValue || scope.attrValue)
+ {
+ scope.modelVal = false;
+ }
+ else
+ {
+ scope.modelVal = true;
+ }
+ };
+ scope.updateModel = function (env) {
+ {
+ if (dragStatus !== 1) {
+ updateModelVal();
+ dragStatus = 0;
+ }
+ }
+ env.preventDefault();
+ };
+ scope.drag = function (e) {
+ dragStatus = 1;
+ if (e.type === 'dragstart') {
+ scope.initialDragPosition = $position.position(element.children().eq(1)).left;
+ element.children().eq(1).addClass('dragging');
+ } else if (e.type === 'drag') {
+ var left = Math.min(0, Math.max(scope.initialDragPosition + e.gesture.deltaX, -switchMovementPath));
+ element.children().eq(1).css({
+ left: left + 'px'
+ });
+ } else if (e.type === 'dragend') {
+ var isOn = $position.position(element.children().eq(1)).left > (switchMovementPath * -1) / 2;
+ element.children().eq(1).removeClass('dragging');
+ TweenMax.to(element.children().eq(1), .1, {left: isOn ? 0 : (switchMovementPath * -1), ease: Power4.easeOut,
+ onComplete: function () {
+ element.children().eq(1).css({left: ''});
+ }});
+ if (isOn || (!isOn && e.gesture.direction === "left")) {
+ updateModelVal();
+ }
+ dragStatus = 0;
+ }
+
+ return false;
+ };
+
+ scope.directiveValue = attr.attToggleTemplate;
+ scope.on = attr.trueValue;
+ scope.off = attr.falseValue;
+ var switchMovementPathPixels = ((switchMovementPath) * -1) + 'px';
+ scope.$watch('modelVal', function (newVal) {
+ scope.attrValue = newVal;
+ if (newVal === attr.ngTrueValue || newVal) {
+ element.children().eq(1).css({
+ left: '0px'
+ });
+ element.addClass('att-checkbox--on');
+ var elem = element.find('div').find('div').eq(1);
+ elem.attr("aria-checked", true);
+ dragStatus = 0;
+ } else {
+ element.children().eq(1).css({
+ left: switchMovementPathPixels
+ });
+ element.removeClass('att-checkbox--on');
+ var elem = element.find('div').find('div').eq(1);
+ elem.attr("aria-checked", false);
+ dragStatus = 0;
+ }
+ element.children().eq(1).css({
+ left: ''
+ });
+ });
+ }
+ };
+ }
+ ])
+
+ .directive('attToggleMain', ['$compile', function ($compile)
+ {
+ return{
+ restrict: 'A',
+ require: 'ngModel',
+ transclude: true,
+ replace: true,
+ scope: {
+ modelValue: "=ngModel",
+ trueValue: "=ngTrueValue",
+ falseValue: "=ngFalseValue"
+ },
+ link: function (scope, element, attr) {
+ var html = "";
+ var attrVal = "";
+ element.removeAttr('att-toggle-main');
+ scope.on = attr.ngTrueValue;
+ scope.off = attr.ngFalseValue;
+ scope.largeValue = attr.attToggleMain;
+ if (angular.isDefined(attr.ngTrueValue)) {
+ html += ' true-value="{{on}}" false-value="{{off}}"';
+ }
+ if (scope.largeValue !== undefined)
+ {
+ attrVal += ' ="{{largeValue}}"';
+ }
+
+ element.css({display: 'none'});
+ var elm = angular.element('<div class="att-switch att-switch-alt" ng-class="{\'large\' : largeValue == \'large\'}" ng-model="modelValue"' + html + ' att-toggle-template' + attrVal + '>' + element.prop('outerHTML') + '</div>');
+ elm = $compile(elm)(scope);
+ element.replaceWith(elm);
+ }
+ };
+ }]);
+angular.module('att.abs.treeview', [])
+ .directive('treeView', function() {
+ return{
+ restrict: 'A',
+ link: function(scope, elem) {
+ var el = elem.children('ul li');
+ var list = TweenMax.from(el, .2, {display: 'none', paused: true, reversed: true});
+ elem.attr("tabindex","0");
+ function toggleBranch() {
+ if (list.reversed())
+ {
+ list.play();
+ } else
+ {
+ list.reverse();
+ }
+ };
+ function toggleTree(e) {
+ e.stopPropagation();
+ if (angular.element(e.target).attr("tree-view") !== undefined)
+ {
+ if (elem.hasClass('minus'))
+ {
+ elem.removeClass('minus');
+ }
+ else
+ {
+ elem.addClass('minus');
+ }
+ toggleBranch();
+ }
+ }
+ elem.on('click', function(e) {
+ toggleTree(e);
+ });
+ elem.on('keypress', function (e) {
+ var activeCode = e.keyCode ? e.keyCode : e.charCode;
+ var keyCode = [13,32];
+ if (keyCode.length > 0 && ((activeCode && keyCode.indexOf(activeCode) > -1))) {
+ toggleTree(e);
+ e.preventDefault();
+ }
+ });
+ }
+ };
+ });
+
+angular.module('att.abs.typeAhead', ['att.abs.tagBadges'])
+
+ .directive('focusMe',['$timeout', '$parse', function($timeout, $parse) {
+ return {
+ link: function(scope, element, attrs) {
+ var model = $parse(attrs.focusMe);
+ scope.$watch(model, function(value) {
+ if (value) {
+ $timeout(function() {
+ element[0].focus();
+ scope.inputActive=true;
+ });
+ }
+ });
+ element.bind('blur', function() {
+ model.assign(scope, false);
+ scope.inputActive=false;
+ scope.$digest();
+ });
+ }
+ };
+ }])
+
+ .directive('typeAhead', ['$timeout','$log', function($timeout,$log) {
+ return {
+ restrict: 'EA',
+ templateUrl: 'app/scripts/ng_js_att_tpls/typeAhead/typeAhead.html',
+ replace: true,
+ scope: {
+ items: '=',
+ title: '@?',
+ titleName: '@',
+ subtitle: '@',
+ model: '=',
+ emailIdList:'=',
+ emailMessage:'='
+ },
+ link: function(scope, elem) {
+ if(!angular.isDefined(scope.titleName) && angular.isDefined(scope.title)){
+ $timeout(function(){
+ scope.titleName = scope.title;
+ $log.warn("title attribute is deprecated and title-name attribute is used instead as it is conflicting with html title attribute");
+ });
+ }
+ scope.lineItems = [];
+ scope.filteredListLength = -1;
+ scope.filteredList = [];
+ scope.setFocus = function() {
+ scope.clickFocus = true;
+ };
+ scope.setFocus();
+ scope.handleSelection = function(selectedItem,emailItem) {
+ scope.lineItems.push(selectedItem);
+ scope.emailIdList.push(emailItem);
+ scope.model = "";
+ scope.current = 0;
+ scope.selected = true;
+ scope.clickFocus = true;
+ };
+ scope.theMethodToBeCalled = function(index) {
+ var tempArr = scope.lineItems.slice();
+ scope.emailIdList.splice(index, 1);
+ tempArr.splice(index, 1);
+ $timeout(function() {
+ scope.lineItems = [];
+ scope.$apply();
+ scope.lineItems = scope.lineItems.concat(tempArr);
+ });
+ };
+
+ scope.current = 0;
+ scope.selected = true;
+
+ scope.isCurrent = function(index, itemName,itemEmail,dropdownLength) {
+ if (scope.current === index) {
+ scope.itemName = itemName;
+ scope.itemEmail = itemEmail;
+ }
+ scope.dropdownLength=dropdownLength;
+ return scope.current === index;
+ };
+
+ scope.setCurrent = function(index) {
+ scope.current = index;
+ };
+
+ scope.selectionIndex = function(evt) {
+ if (evt.keyCode === 38 && scope.current > 0) {
+ evt.preventDefault();
+ scope.current = scope.current - 1;
+ scope.isCurrent(scope.current);
+ } else if (evt.keyCode === 9) {
+ scope.selected = true;
+ } else if (evt.keyCode === 13 && scope.dropdownLength!==scope.items.length) {
+ scope.handleSelection(scope.itemName,scope.itemEmail);
+ } else if ((evt.keyCode === 8 && scope.model.length === 0) || evt.keyCode === 46) {
+ scope.theMethodToBeCalled(scope.lineItems.length - 1);
+ } else if (evt.keyCode === 40 && scope.current < scope.dropdownLength-1) {
+ evt.preventDefault();
+ scope.current = scope.current + 1;
+ scope.isCurrent(scope.current);
+ }
+ elem[0].querySelector('.list-scrollable').scrollTop = (scope.current - 1) * 35;
+ };
+ }
+ };
+ }]);
+angular.module('att.abs.verticalSteptracker', ['ngSanitize'])
+ .directive('verticalSteptracker', [ function(){
+ return {
+ restrict: 'EA',
+ transclude: true,
+ replace: false,
+ scope: {},
+ template: '<div class="vertical-nav"><ul ng-transclude arial-label="step list" role="presentation" class="tickets-list-height"></ul></div>',
+ link: function () {}
+ };
+ }])
+ .directive('verticalSteptrackerStep',[ function(){
+ return {
+ restrict: 'EA',
+ transclude: true,
+ replace: false,
+ scope: {
+ type: "=type",
+ id: "=id"
+ },
+ templateUrl: 'app/scripts/ng_js_att_tpls/verticalSteptracker/vertical-step-tracker.html',
+ link: function(){}
+ };
+ }])
+ .directive('attAbsLink',[ function(){
+ return{
+ restrict: 'EA',
+ transclude: true,
+ replace: false,
+ template: '<span ng-transclude class="view-log"></span>'
+ };
+ }]);
+angular.module('att.abs.videoControls', [])
+ .config(['$compileProvider' , function ($compileProvider) {
+ $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|javascript):/);
+ }])
+ .directive('videoControls', [function() {
+ return {
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/videoControls/videoControls.html'
+ };
+ }])
+ .directive('photoControls', [function() {
+ return {
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/videoControls/photoControls.html',
+ scope: {
+ prevLink: "@",
+ nextLink: "@"
+ },
+ link: function(scope, elem, attr) {
+ if(!attr['prevLink']){
+ scope.prevLink = 'javascript:void(0)';
+ }
+ if(!attr['nextLink']){
+ scope.nextLink = 'javascript:void(0)';
+ }
+ scope.links = {
+ prevLink : scope.prevLink,
+ nextLink : scope.nextLink
+ };
+ }
+ };
+ }]);
+angular.module("app/scripts/ng_js_att_tpls/accordion/accordion.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/accordion/accordion.html",
+ "<div class=\"att-accordion__group tabpanel\" ng-class=\"{'att-accordion__group att-accordion__group--open':isOpen,'att-accordion__group':!isOpen }\">\n" +
+ " <a ng-show=\"showicon\" \n" +
+ " class=\"toggle-header att-accordion__heading att-accordion__toggle noafter\" \n" +
+ " aria-selected=\"{{focused}}\" \n" +
+ " aria-controls=\"panel{{index}}\" \n" +
+ " aria-expanded=\"{{isOpen}}\" \n" +
+ " ng-class=\"{focus: focused, selected: focused}\" \n" +
+ " role=\"tab\" \n" +
+ " ng-click=\"toggle()\" \n" +
+ " accordion-transclude=\"heading\" \n" +
+ " style=\"cursor:pointer; text-decoration:none\">\n" +
+ " <span href=\"#\"><i class={{headingIconClass}}></i>&nbsp;&nbsp;{{heading}}</span>\n" +
+ " <i i ng-show = 'childLength > 0' ng-class=\"{'ion-ios-arrow-down':!isOpen,'ion-ios-arrow-up':isOpen }\" class=\"pull-right\"></i>\n" +
+ " </a>\n" +
+ " <div ng-show=\"!showicon\" \n" +
+ " ng-class=\"{focus: focused, selected: focused}\" \n" +
+ " style=\"text-decoration:none\" \n" +
+ " accordion-transclude=\"heading\" \n" +
+ " role=\"tab\" \n" +
+ " aria-expanded=\"{{isOpen}}\"\n" +
+ " aria-selected=\"{{focused}}\" \n" +
+ " aria-controls=\"panel{{index}}\" \n" +
+ " class=\"toggle-header att-accordion__heading att-accordion__toggle noafter\">\n" +
+ " <span>{{heading}}</span>\n" +
+ " </div> \n" +
+ " <div aria-label=\"{{heading}}\" \n" +
+ " aria-hidden=\"{{!isOpen}}\" \n" +
+ " role=\"tabpanel\" \n" +
+ " collapse=\"!isOpen\" \n" +
+ " class=\"att-accordion__body\" \n" +
+ " id=\"panel{{index}}\" \n" +
+ " ng-transclude>\n" +
+ " </div>\n" +
+ " <div class=\"att-accordion__bottom--border\"></div> \n" +
+ "</div> ");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/accordion/accordion_alt.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/accordion/accordion_alt.html",
+ "<div class=\"att-accordion__group tabpanel\" ng-class=\"{'att-accordion__group att-accordion__group--open':isOpen,'att-accordion__group':!isOpen }\">\n" +
+ " <a class=\"toggle-header att-accordion__heading att-accordion__toggle\" \n" +
+ " aria-selected=\"{{focused}}\" \n" +
+ " aria-controls=\"panel{{index}}\" \n" +
+ " ng-class=\"{focus: focused, selected: focused}\" \n" +
+ " aria-expanded=\"{{isOpen}}\" \n" +
+ " role=\"tab\" \n" +
+ " ng-click=\"toggle()\" \n" +
+ " accordion-transclude=\"heading\"> \n" +
+ " </a>\n" +
+ " <span>{{heading}}</span>\n" +
+ " <div aria-label=\"{{heading}}\" \n" +
+ " aria-hidden=\"{{!isOpen}}\" \n" +
+ " role=\"tabpanel\" \n" +
+ " collapse=\"!isOpen\" \n" +
+ " class=\"att-accordion__body\" \n" +
+ " id=\"panel{{index}}\" \n" +
+ " ng-transclude>\n" +
+ " </div>\n" +
+ "</div> ");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/accordion/attAccord.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/accordion/attAccord.html",
+ "<div ng-transclude></div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/accordion/attAccordBody.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/accordion/attAccordBody.html",
+ "<div ng-transclude></div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/accordion/attAccordHeader.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/accordion/attAccordHeader.html",
+ "<div ng-click=\"clickFunc()\">\n" +
+ " <div ng-transclude>\n" +
+ " <i class=\"ion-ios-arrow-down\"></i>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/alert/alert.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/alert/alert.html",
+ "<div class=\"alert\" ng-class=\"{'alert-success': alertType === 'success', 'alert-warning': alertType === 'warning', 'alert-error': alertType === 'error', 'alert-info': alertType === 'info', 'alert-inplace': showTop !== 'true'}\" ng-show=\"showAlert\" ng-style=\"cssStyle\">\n" +
+ " <div class=\"container\">\n" +
+ " <a href=\"javascript:void(0)\" alt=\"close\" class=\"close-role\" ng-click=\"close()\" tabindex=\"0\" att-accessibility-click=\"32,13\">Dismiss <i class=\"icon-circle-action-close\"></i></a>\n" +
+ " <span ng-transclude> </span>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/boardStrip/attAddBoard.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/boardStrip/attAddBoard.html",
+ "<div tabindex=\"0\" att-accessibility-click=\"13,32\" ng-click=\"addBoard()\" aria-label=\"Add Board\" class=\"boardstrip-item--add\">\n" +
+ " <i aria-hidden=\"true\" class=\"icon-add centered\"></i>\n" +
+ " <br/>\n" +
+ " <div class=\"centered\">Add board</div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/boardStrip/attBoard.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/boardStrip/attBoard.html",
+ "<li att-board-navigation tabindex=\"0\" aria-label=\"{{boardLabel}}\" att-accessibility-click=\"13,32\" ng-click=\"selectBoard(boardIndex)\" class=\"board-item\" ng-class=\"{'selected': getCurrentIndex()===boardIndex}\">\n" +
+ " <div ng-transclude></div>\n" +
+ " <div class=\"board-caret\" ng-if=\"getCurrentIndex()===boardIndex\">\n" +
+ " <div class=\"board-caret-indicator\"></div>\n" +
+ " <div class=\"board-caret-arrow-up\"></div>\n" +
+ " </div>\n" +
+ "</li>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/boardStrip/attBoardStrip.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/boardStrip/attBoardStrip.html",
+ "<div class=\"att-boardstrip\">\n" +
+ " <div class=\"boardstrip-reel\">\n" +
+ " <div class=\"prev-items\" ng-if=\"isPrevBoard()\">\n" +
+ " <i tabindex=\"0\" aria-label=\"Scroll Boardstrip Left\" att-accessibility-click=\"13,32\" ng-click=\"prevBoard()\" class=\"arrow icon-arrow-left-circle\"></i>\n" +
+ " </div>\n" +
+ " <div att-add-board on-add-board=\"onAddBoard()\"></div>\n" +
+ " <div class=\"board-viewport\"><ul role=\"presentation\" class=\"boardstrip-container\" ng-transclude></ul></div>\n" +
+ " <div class=\"next-items\" ng-if=\"isNextBoard()\">\n" +
+ " <i tabindex=\"0\" aria-label=\"Scroll Boardstrip Right\" att-accessibility-click=\"13,32\" ng-click=\"nextBoard()\" class=\"arrow icon-arrow-right-circle\"></i>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/buttons/buttonDropdown.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/buttons/buttonDropdown.html",
+ "<div class=\"att-btn-dropdown\">\n" +
+ " <div class=\"buttons-dropdown--small btn-group\" ng-class=\"{'open': isOpen}\" att-accessibility-click=\"13,32\" ng-click=\"toggle()\">\n" +
+ " \n" +
+ " <button role=\"menu\" class=\"button button--secondary button--small buttons-dropdown__drop dropdown-toggle\" ng-if=\"type==='dots'\" alt=\"Click for Options\" >\n" +
+ " \n" +
+ " <div class=\"circle\"></div>\n" +
+ " <div class=\"circle\"></div>\n" +
+ " <div class=\"circle\"></div>\n" +
+ " </button>\n" +
+ " <button role=\"menu\" class=\"button button--secondary button--small buttons-dropdown__drop dropdown-toggle ng-isolate-scope actions-title\" ng-if=\"type === 'actions'\" alt=\"Actions dropdown Buttons\">Actions</button>\n" +
+ " \n" +
+ "\n" +
+ " <ul ng-class=\"{'dropdown-menu dots-dropdwn': type==='dots', 'dropdown-menu actions-dropdwn': type === 'actions'}\" ng-transclude></ul>\n" +
+ " </div>\n" +
+ " \n" +
+ "</div>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/colorselector/colorselector.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/colorselector/colorselector.html",
+ "<div class=\"att-radio att-color-selector__item\" \n" +
+ " ng-class=\"{'att-radio--on': (iconColor === selected)}\">\n" +
+ " <div class=\"att-radio__indicator\" tabindex=\"0\" att-accessibility-click=\"32,13\" ng-click=\"selectedcolor(iconColor)\" \n" +
+ " ng-style=\"applycolor\" ng-transclude></div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/datepicker/dateFilter.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/datepicker/dateFilter.html",
+ "<div class=\"calendar\" ng-class=\"{'monthpicker':mode === 1}\">\n" +
+ " <div class=\"select2-container\" ng-class=\"{'select2-container-active select2-dropdown-open': showDropdownList}\" style=\"width: 100%; z-index:0\">\n" +
+ " <a tabindex=\"0\" id=\"select2-choice\" class=\"select2-choice\" href=\"javascript:void(0)\" att-element-focus=\"focusInputButton\" ng-show=\"!showCalendar\" att-accessibility-click=\"13,32\" ng-click=\"showDropdown()\" ng-blur=\"focusInputButton=false\">\n" +
+ " <span class=\"select2-chosen\" ng-show=\"!showCalendar\">{{selectedOption}}</span>\n" +
+ " <input type=\"text\" ng-show=\"showCalendar\" ng-blur=\"untrackInputChange($event)\" att-input-deny=\"[^0-9\\/-]\" maxlength=\"{{maxLength}}\" ng-model=\"selectedOption\" aria-labelledby=\"select2-choice\" ng-change=\"getDropdownText()\" />\n" +
+ " <abbr class=\"select2-search-choice-close\"></abbr>\n" +
+ " <span ng-class=\"{'select2-arrow': mode !== 1, 'calendar-icon': mode === 1}\"><b></b></span>\n" +
+ " </a>\n" +
+ " <a id=\"select2-chosen\" class=\"select2-choice\" href=\"javascript:void(0)\" ng-show=\"showCalendar\">\n" +
+ " <span class=\"select2-chosen\" ng-show=\"!showCalendar\">{{selectedOption}}</span>\n" +
+ " <input type=\"text\" ng-show=\"showCalendar\" ng-blur=\"untrackInputChange($event)\" att-input-deny=\"[^0-9\\/-]\" maxlength=\"{{maxLength}}\" ng-model=\"selectedOption\" aria-labelledby=\"select2-chosen\" ng-change=\"getDropdownText()\" />\n" +
+ " <abbr class=\"select2-search-choice-close\"></abbr>\n" +
+ " <span tabindex=\"0\" ng-class=\"{'select2-arrow': mode !== 1, 'calendar-icon': mode === 1}\" att-accessibility-click=\"13,32\" ng-click=\"showDropdown()\"><b></b></span>\n" +
+ " </a>\n" +
+ " </div>\n" +
+ " <div class=\"select2-drop select2-drop-active select2-display-none\" ng-style=\"{display: (showDropdownList && 'block') || 'none', 'border-radius': showCalendar && '0 0 0 6px'}\" style=\"width: 100%\">\n" +
+ " <div id=\"dateFilterList\" att-scrollbar ><ul class=\"select2-results options\" ng-transclude></ul></div>\n" +
+ " <ul class=\"select2-results sttings\" style=\"margin-top:0px\">\n" +
+ " <li tabindex=\"0\" class=\"select2-result select2-highlighted greyBorder\" ng-class=\"{'select2-result-current': checkCurrentSelection('Custom Single Date')}\" att-accessibility-click=\"13,32\" ng-click=\"selectAdvancedOption('Custom Single Date')\">\n" +
+ " <div class=\"select2-result-label\" ng-if=\"mode !== 1\">Custom Single Date...</div>\n" +
+ " <div class=\"select2-result-label\" ng-if=\"mode === 1\">Custom single month...</div>\n" +
+ " </li>\n" +
+ " <li tabindex=\"0\" class=\"select2-result select2-highlighted\" ng-class=\"{'select2-result-current': checkCurrentSelection('Custom Range')}\" att-accessibility-click=\"13,32\" ng-click=\"selectAdvancedOption('Custom Range')\">\n" +
+ " <div class=\"select2-result-label\" ng-if=\"mode !== 1\">Custom Range...</div>\n" +
+ " <div class=\"select2-result-label\" ng-if=\"mode === 1\">Custom month range...</div>\n" +
+ " </li>\n" +
+ " <li class=\"select2-result select2-highlighted btnContainer\" ng-style=\"{display: (showCalendar && 'block') || 'none'}\">\n" +
+ " <button tabindex=\"0\" ng-blur=\"resetFocus($event)\" att-element-focus=\"focusApplyButton\" att-button=\"\" btn-type=\"{{applyButtonType}}\" size=\"small\" att-accessibility-click=\"13,32\" ng-click=\"apply()\">Apply</button>\n" +
+ " <button tabindex=\"0\" att-button=\"\" btn-type=\"secondary\" size=\"small\" att-accessibility-click=\"13,32\" ng-click=\"cancel()\">Cancel</button>\n" +
+ " <div>\n" +
+ " <a tabindex=\"0\" href=\"javascript:void(0)\" ng-if=\"mode !== 1\" style=\"text-decoration:underline;\" att-accessibility-click=\"13,32\" ng-click=\"clear()\">Clear Dates</a>\n" +
+ " <a tabindex=\"0\" href=\"javascript:void(0)\" ng-if=\"mode === 1\" style=\"text-decoration:underline;\" att-accessibility-click=\"13,32\" ng-click=\"clear()\">Clear Months</a>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ " </div>\n" +
+ " <div class=\"datepicker-wrapper show-right\" ng-style=\"{display: (showCalendar && 'block') || 'none'}\">\n" +
+ " <span datepicker ng-blur=\"resetFocus($event)\" att-element-focus=\"focusSingleDateCalendar\" ng-show=\"checkCurrentSelection('Custom Single Date')\"></span>\n" +
+ " <span datepicker ng-blur=\"resetFocus($event)\" att-element-focus=\"focusRangeCalendar\" ng-show=\"checkCurrentSelection('Custom Range')\"></span>\n" +
+ " </div>\n" +
+ "</div>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/datepicker/dateFilterList.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/datepicker/dateFilterList.html",
+ "<li ng-click=\"!disabled && selectOption(fromDate,toDate,caption)\" att-accessibility-click=\"13,32\" ng-class=\"{'select2-result-current': checkCurrentSelection(caption)}\" class=\"select2-result select2-highlighted ng-scope\" tabindex=\"{{!disabled?'0':'-1'}}\">\n" +
+ " <div class=\"select2-result-label\" ng-class=\"{'disabled':disabled}\" ng-transclude></div>\n" +
+ "</li>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/datepicker/datepicker.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/datepicker/datepicker.html",
+ "<div id=\"datepicker\" class=\"datepicker\" ng-class=\"{'monthpicker': mode === 1}\" aria-hidden=\"false\" role=\"dialog\" tabindex=\"-1\" aria-labelledby=\"datepicker\">\n" +
+ " <div class=\"datepicker-days\" style=\"display: block;\">\n" +
+ " <table class=\"table-condensed\">\n" +
+ " <thead>\n" +
+ " <tr>\n" +
+ " <th id=\"month\" tabindex=\"0\" class=\"datepicker-switch\" colspan=\"{{(mode !== 1) && (currentRows[0].length - 2) || (currentRows[0].length)}}\" style=\"text-align:left\">{{currentTitle}}</th>\n" +
+ " <th ng-if=\"mode !== 1\" id=\"prev\" aria-hidden=\"{{!disablePrev && 'false'|| 'true'}}\" tabindex=\"{{!disablePrev && '0'|| '-1'}}\" att-accessibility-click=\"13,32\" ng-click=\"!disablePrev && move(-1)\">\n" +
+ " <div class=\"icons-list\" data-size=\"medium\"><i class=\"icon-arrow-left-circle\" ng-class=\"{'disabled': disablePrev}\" alt=\"Left Arrow\"></i>\n" +
+ " </div><span class=\"hidden-spoken\">Previous Month</span>\n" +
+ " </th>\n" +
+ " <th ng-if=\"mode !== 1\" id=\"next\" aria-hidden=\"{{!disableNext && 'false'|| 'true'}}\" tabindex=\"{{!disableNext && '0'|| '-1'}}\" att-accessibility-click=\"13,32\" ng-click=\"!disableNext && move(1)\">\n" +
+ " <div class=\"icons-list\" data-size=\"medium\"><i class=\"icon-arrow-right-circle\" ng-class=\"{'disabled': disableNext}\" alt=\"Right Arrow\"></i>\n" +
+ " </div><span class=\"hidden-spoken\">Next Month</span>\n" +
+ " </th>\n" +
+ " </tr>\n" +
+ " <tr ng-if=\"labels.length > 0\">\n" +
+ " <th tabindex=\"-1\" class=\"dow weekday\" ng-repeat=\"label in labels\"><span>{{label.pre}}</span></th>\n" +
+ " </tr>\n" +
+ " </thead>\n" +
+ " <tbody>\n" +
+ " <tr>\n" +
+ " <td id=\"datepickerBody\" att-scrollbar colspan=\"{{currentRows[0].length}}\" style=\"padding: 0px;\" headers=\"\">\n" +
+ " <table ng-class=\"{'table-condensed': mode === 0, 'monthtable-condensed': mode === 1}\" style=\"padding: 0px;\">\n" +
+ " <thead class=\"hidden-spoken\">\n" +
+ " <tr ng-show=\"labels.length > 0\">\n" +
+ " <th id=\"{{label.post}}\" tabindex=\"-1\" class=\"dow weekday\" ng-repeat=\"label in labels\"></th>\n" +
+ " </tr>\n" +
+ " </thead>\n" +
+ " <tbody>\n" +
+ " <tr ng-repeat=\"row in currentRows\">\n" +
+ " <td headers=\"{{(mode === 0) && dt.header || 'month'}}\" att-element-focus=\"dt.focused\" aria-hidden=\"{{(!dt.oldMonth && !dt.nextMonth && !dt.disabled && 'false') || 'true'}}\" tabindex=\"{{(!dt.oldMonth && !dt.nextMonth && !dt.disabled && '0') || '-1'}}\" ng-repeat=\"dt in row\" class=\"days\" ng-class=\"{'active': dt.selected || dt.from || dt.to, 'from': dt.from, 'to': dt.to, 'range': dt.dateRange, 'prev-month ': dt.oldMonth, 'next-month': dt.nextMonth, 'disabled': dt.disabled, 'today': dt.today, 'weekend': dt.weekend}\" ng-click=\"!dt.selected && !dt.from && !dt.to && !dt.disabled && !dt.oldMonth && !dt.nextMonth && select(dt.date)\" att-accessibility-click=\"13,32\" aria-label=\"{{dt.date | date : 'EEEE, MMMM d'}}\"><span class=\"day\">{{dt.label}}</span></td>\n" +
+ " </tr>\n" +
+ " <tr ng-if=\"mode === 1\" class=\"divider\"><td colspan=\"{{nextRows[0].length}}\"><hr></td></tr>\n" +
+ " <tr>\n" +
+ " <th id=\"month\" tabindex=\"0\" class=\"datepicker-switch internal\" colspan=\"{{nextRows[0].length}}\" style=\"text-align:left\">{{nextTitle}}</th>\n" +
+ " </tr>\n" +
+ " <tr ng-repeat=\"row in nextRows\">\n" +
+ " <td headers=\"{{(mode === 0) && dt.header || 'month'}}\" att-element-focus=\"dt.focused\" aria-hidden=\"{{(!dt.oldMonth && !dt.nextMonth && !dt.disabled && 'false') || 'true'}}\" tabindex=\"{{(!dt.oldMonth && !dt.nextMonth && !dt.disabled && '0') || '-1'}}\" ng-repeat=\"dt in row\" class=\"days\" ng-class=\"{'active': dt.selected || dt.from || dt.to, 'from': dt.from, 'to': dt.to, 'range': dt.dateRange, 'prev-month ': dt.oldMonth, 'next-month': dt.nextMonth, 'disabled': dt.disabled, 'today': dt.today, 'weekend': dt.weekend}\" ng-click=\"!dt.selected && !dt.from && !dt.to && !dt.disabled && !dt.oldMonth && !dt.nextMonth && select(dt.date)\" att-accessibility-click=\"13,32\" aria-label=\"{{dt.date | date : 'EEEE, MMMM d'}}\"><span class=\"day\">{{dt.label}}</span></td>\n" +
+ " </tr>\n" +
+ " </tbody>\n" +
+ " </table>\n" +
+ " </td>\n" +
+ " </tr>\n" +
+ " </tbody>\n" +
+ " </table>\n" +
+ " </div>\n" +
+ "</div>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/datepicker/datepickerPopup.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/datepicker/datepickerPopup.html",
+ "<div class=\"calendar\">\n" +
+ " <div class=\"box\" ng-class=\"{'active': isOpen}\">\n" +
+ " <span ng-transclude></span>\n" +
+ " <i class=\"calendar-icon\" tabindex=\"0\" att-accessibility-click=\"13,32\" ng-click=\"toggle()\" alt=\"Calendar Icon\"></i>\n" +
+ " </div>\n" +
+ " <div class=\"datepicker-wrapper datepicker-wrapper-display-none\" ng-style=\"{display: (isOpen && 'block') || 'none'}\" aria-hidden=\"false\" role=\"dialog\" tabindex=\"-1\">\n" +
+ " <span datepicker></span>\n" +
+ " </div>\n" +
+ "</div>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/dividerLines/dividerLines.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/dividerLines/dividerLines.html",
+ "<div class=\"divider-container\" ng-class=\"{'divider-container-light': lightContainer}\">\n" +
+ " <hr ng-class=\"{'divider-light': lightContainer}\">\n" +
+ "</div>\n" +
+ "\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/dragdrop/fileUpload.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/dragdrop/fileUpload.html",
+ "<label class=\"fileContainer\"><span ng-transclude></span><input type=\"file\" att-file-change></label>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlert.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlert.html",
+ "<div class=\"form-field\" ng-class=\"{'error': errorMessage, 'warning': warningMessage}\">\n" +
+ " <label class=\"form-field__label\" ng-class=\"{'form-field__label--show': showLabel, 'form-field__label--hide': hideLabel}\"></label>\n" +
+ " <div class=\"form-field-input-container\" ng-transclude></div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlertPrv.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlertPrv.html",
+ "<div class=\"form-field\" ng-class=\"{'error':hideErrorMsg}\">\n" +
+ " <div class=\"form-field-input-container\" ng-transclude></div>\n" +
+ " <div class=\"form-field__message error\" type=\"error\" ng-show=\"hideErrorMsg\" >\n" +
+ " <i class=\"icon-info-alert\"></i>{{errorMessage}}\n" +
+ " </div>\n" +
+ "</div>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/formField/creditCardImage.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/formField/creditCardImage.html",
+ "<span class=\"css-sprite pull-right\">\n" +
+ "<span class=\"hidden-spoken\">We accept</span>\n" +
+ "<ul class=\"{{newValCCI}}\">\n" +
+ " <li class=\"css-sprite-mc\"><span class=\"hidden-spoken\">MasterCard</span></li>\n" +
+ " <li class=\"css-sprite-visa\"><span class=\"hidden-spoken\">Visa</span></li>\n" +
+ " <li class=\"css-sprite-amex\"><span class=\"hidden-spoken\">American Express</span></li>\n" +
+ " <li class=\"css-sprite-discover\"><span class=\"hidden-spoken\">Discover</span></li> \n" +
+ "</ul>\n" +
+ "</span>\n" +
+ "<label for=\"ccForm.card\" class=\"pull-left\">Card number</label>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/formField/cvcSecurityImg.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/formField/cvcSecurityImg.html",
+ "<div>\n" +
+ "<button type=\"button\" class=\"btn btn-alt btn-tooltip\" style=\"padding-top:16px\" title=\"Help\"><i class=\"hidden-spoken\">Help</i></button>\n" +
+ "<div class=\"helpertext\" role=\"tooltip\">\n" +
+ "<div class=\"popover-title\"></div>\n" +
+ "<div class=\"popover-content\">\n" +
+ " <p class=\"text-legal cvc-cc\">\n" +
+ " <img ng-src=\"images/{{newValI}}.png\" alt=\"{{newValIAlt}}\">\n" +
+ " </p>\n" +
+ "</div>\n" +
+ "</div>\n" +
+ "</div>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/hourpicker/hourpicker.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/hourpicker/hourpicker.html",
+ "<div class=\"hourpicker\">\n" +
+ " <div class=\"dropdown-width\">\n" +
+ " <div ng-model=\"showlist\" class=\"select2-container topDropDownWidth\" ng-class=\"{'select2-dropdown-open select2-container-active': showlist}\" >\n" +
+ " <a class=\"select2-choice\" href=\"javascript:void(0)\" id=\"customSelect\" ng-keydown=\"selectOption(selectPrevNextValue($event,options,selectedOption))\" att-accessibility-click=\"13\" ng-click=\"showDropdown()\">\n" +
+ " <span class=\"select2-chosen\">{{selectedOption}}</span>\n" +
+ " <span class=\"select2-arrow\"><b></b></span>\n" +
+ " </a>\n" +
+ " </div> \n" +
+ " <div class=\"select2-display-none select2-with-searchbox select2-drop-active show-search resultTopWidth\" ng-show=\"showlist\"> \n" +
+ " <ul class=\"select2-results resultTopMargin\" > \n" +
+ " <li ng-model=\"ListType\" ng-repeat=\"option in options\" att-accessibility-click=\"13\" ng-click=\"selectOption(option,$index)\" class=\"select2-results-dept-0 select2-result select2-result-selectable\"><div class=\"select2-result-label\"><span >{{option}}</span></div></li> \n" +
+ " </ul>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ " <div ng-show=\"showDaysSelector\" class=\"customdays-width\">\n" +
+ " <div att-divider-lines class=\"divider-margin-f\"></div> \n" +
+ " <div class=\"col-md-3 fromto-margin\">\n" +
+ " <div>From</div> <br>\n" +
+ " <div>To</div>\n" +
+ " </div>\n" +
+ " <div ng-repeat=\"day in days\">\n" +
+ " <div class=\"col-md-3 col-md-days\">\n" +
+ " <div class=\"col-md-1 daysselect-margin\">\n" +
+ " <input type=\"checkbox\" ng-model=\"daysList[day]\" title=\"Day selection {{$index}}\" att-checkbox ng-change=\"addSelectedValue(day)\"> \n" +
+ " </div>\n" +
+ " <span>{{day}}</span><br>\n" +
+ " \n" +
+ " <div class=\"dropDownMarginBottom\">\n" +
+ " <div class=\"select2-container topDropDownWidth\" ng-class=\"{'select2-dropdown-open select2-container-active': FrtimeListDay[day]}\" >\n" +
+ " <a class=\"select2-choice selectDropDown\" href=\"javascript:void(0)\" tabindex=\"{{daysList[day] ? '0' : '-1'}}\" att-accessibility-click=\"13\" ng-click=\"daysList[day] && showfromDayDropdown(day)\" ng-class=\"{'select2-chosen-disabled':!daysList[day]}\" ng-keydown=\"daysList[day] && selectFromDayOption(day , selectPrevNextValue($event,fromtime,selectedFromOption[day]));daysList[day] && addSelectedValue(day);\">\n" +
+ " <span class=\"select2-chosen dropDownMarginRight\" >{{selectedFromOption[day]}} <i ng-if=\"daysList[day]\" ng-class=\"FrtimeListDay[day] ? 'ion-arrow-up-b' : 'ion-arrow-down-b'\"></i></span>\n" +
+ " </a>\n" +
+ " </div> \n" +
+ " \n" +
+ " <div class=\"select2-display-none select2-with-searchbox select2-drop-active show-search resultFromDropDown\" ng-show=\"FrtimeListDay[day]\"> \n" +
+ " <ul class=\"select2-results resultTopMargin\" > \n" +
+ " <li ng-click=\"selectFromDayOption(day,time.value);addSelectedValue(day);\" ng-repeat=\"time in fromtime\" class=\"select2-results-dept-0 select2-result select2-result-selectable\"><div class=\"select2-result-label\" ng-class=\"{'selectedItemInDropDown': (time.value==selectedFromOption[day])}\"><span >{{time.value}}</span></div></li> \n" +
+ " </ul>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ " \n" +
+ " <div class=\"dropDownMarginBottom\">\n" +
+ " <div class=\"select2-container topDropDownWidth\" ng-class=\"{'select2-dropdown-open select2-container-active': TotimeListDay[day]}\" >\n" +
+ " <a class=\"select2-choice selectDropDown\" href=\"javascript:void(0)\" tabindex=\"{{daysList[day] ? '0' : '-1'}}\" att-accessibility-click=\"13\" ng-click=\"daysList[day] && showtoDayDropdown(day)\" ng-class=\"{'select2-chosen-disabled':!daysList[day], 'selectDropDown-error':daysList[day] && showToTimeErrorDay[day]}\" ng-keydown=\"daysList[day] && selectToDayOption(day , selectPrevNextValue($event,totime,selectedToOption[day]));daysList[day] && addSelectedValue(day);\">\n" +
+ " <span class=\"select2-chosen dropDownMarginRight\">{{selectedToOption[day]}} <i ng-if=\"daysList[day]\" ng-class=\"TotimeListDay[day] ? 'ion-arrow-up-b' : 'ion-arrow-down-b'\" ></i></span>\n" +
+ " </a>\n" +
+ " </div>\n" +
+ " \n" +
+ " <div class=\"select2-display-none select2-with-searchbox select2-drop-active show-search resultToDropDown\" ng-show=\"TotimeListDay[day]\"> \n" +
+ " <ul class=\"select2-results resultTopMargin\" > \n" +
+ " <li ng-click=\"selectToDayOption(day,time.value);addSelectedValue(day);\" ng-repeat=\"time in totime\" class=\"select2-results-dept-0 select2-result select2-result-selectable\"><div class=\"select2-result-label\" ng-class=\"{'selectedItemInDropDown': (time.value==selectedToOption[day])}\"><span >{{time.value}}</span></div></li> \n" +
+ " </ul>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ " </div> \n" +
+ " </div> \n" +
+ " <div att-divider-lines class=\"divider-margin-s\"></div>\n" +
+ " </div>\n" +
+ " <div ng-transclude></div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/links/readMore.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/links/readMore.html",
+ "<div>\n" +
+ " <div ng-bind-html=\"textToDisplay\" ng-class=\"{'att--readMore': readFlag, 'att--readLess': !readFlag}\" ng-style=\"readLinkStyle\"></div>\n" +
+ " <span class=\"att--readmore__link\" ng-show=\"readMoreLink\">… <a href=\"javascript:void(0);\" ng-click=\"readMore()\" att-accessbility-click=\"32,13\">Read More</a>\n" +
+ " </span>\n" +
+ "</div>\n" +
+ "<span class=\"att--readless__link\" ng-show=\"readLessLink\">\n" +
+ " <a href=\"javascript:void(0);\" ng-click=\"readLess()\" att-accessbility-click=\"32,13\">Read Less</a>\n" +
+ "</span>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/loading/loading.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/loading/loading.html",
+ "<div data-progress=\"{{progressStatus}}\" class=\"{{colorClass}}\" ng-class=\"{'att-loading-count':icon == 'count','loading--small':icon == 'small','loading': icon != 'count'}\" alt=\"Loading\">\n" +
+ " <div class=\"att-loading-circle\" ng-if=\"icon == 'count'\">\n" +
+ " <div class=\"att-loading-circle__mask att-loading-circle__full\">\n" +
+ " <div class=\"att-loading-circle__fill\"></div>\n" +
+ " </div>\n" +
+ " <div class=\"att-loading-circle__mask att-loading-circle__half\">\n" +
+ " <div class=\"att-loading-circle__fill\"></div>\n" +
+ " <div class=\"att-loading-circle__fill att-loading-circle__fix\"></div>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ " <div ng-class=\"{'att-loading-inset':icon == 'count','loading__inside':icon != 'count'}\"><div class=\"att-loading-inset__percentage\" ng-if=\"icon == 'count'\" alt=\"Loading with Count\"></div></div>\n" +
+ "</div>\n" +
+ "\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/modal/backdrop.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/modal/backdrop.html",
+ "<div class=\"overlayed\" ng-class=\"{show: animate}\" \n" +
+ " ng-style=\"{'z-index': 2000 + index*10,'overflow':'scroll'}\"> \n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/modal/tabbedItem.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/modal/tabbedItem.html",
+ "<div>\n" +
+ " <ul class=\"tabs_overlay\">\n" +
+ " <li ng-repeat=\"item in items\" class=\"tabs_overlay__item two__item\" ng-class=\"{'active':isActiveTab($index)}\" ng-click=\"clickTab($index)\">\n" +
+ " <i class=\"{{item.iconClass}}\"></i>\n" +
+ " {{item.title}} ({{item.number}})\n" +
+ " <a class=\"viewLink\" att-link>Show</a>\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/modal/tabbedOverlayItem.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/modal/tabbedOverlayItem.html",
+ "<div>\n" +
+ " <ul class=\"tabs_overlay\">\n" +
+ " <li ng-repeat=\"item in items\" class=\"tabs_overlay__item two__item\" ng-class=\"{'active':isActiveTab($index)}\" ng-click=\"clickTab($index)\">\n" +
+ " <i class=\"{{item.iconClass}}\"></i>\n" +
+ " {{item.title}} ({{item.number}})\n" +
+ " <a class=\"viewLink\" att-link>Show</a>\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/modal/window.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/modal/window.html",
+ "<div tabindex=\"-1\" role=\"dialog\" att-element-focus=\"focusModalFlag\" class=\"modals {{ windowClass }}\" ng-class=\"{show: animate}\" \n" +
+ " ng-style=\"{'z-index': 2010 + index*10}\" ng-click=\"close($event)\" ng-transclude> \n" +
+ "</div>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/pagination/pagination.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/pagination/pagination.html",
+ "<div class=\"pager\">\n" +
+ " <a tabindex=\"0\" href=\"javascript:void(0)\" class=\"pager__item--prev\" att-accessibility-click=\"13,32\" ng-click=\"prev($event)\" ng-if=\"currentPage > 1\"><i class=\"icon-arrow-left\"></i> Previous</a>\n" +
+ " <a tabindex=\"0\" href=\"javascript:void(0)\" class=\"pager__item pager__item--link\" ng-if=\"totalPages > 7 && currentPage > 3\" att-accessibility-click=\"13,32\" ng-click=\"selectPage(1, $event)\">1</a>\n" +
+ " <span class=\"pager__item\" ng-if=\"totalPages > 7 && currentPage > 3\">...</span>\n" +
+ " <a tabindex=\"0\" href=\"javascript:void(0)\" class=\"pager__item pager__item--link\" att-element-focus=\"isFocused(page)\" ng-repeat=\"page in pages\" ng-class=\"{'pager__item--active': checkSelectedPage(page)}\" att-accessibility-click=\"13,32\" ng-click=\"selectPage(page, $event)\">{{page}}</a>\n" +
+ " <span class=\"pager__item\" ng-if=\"totalPages > 7 && currentPage < totalPages - 2 && showInput !== true\">...</span>\n" +
+ " <span ng-show=\"totalPages > 7 && showInput === true\"><input class=\"pager__item--input\" type=\"text\" placeholder=\"...\" maxlength=\"2\" ng-model=\"currentPage\" aria-label=\"Current page count\"/></span>\n" +
+ " <a tabindex=\"0\" href=\"javascript:void(0)\" class=\"pager__item pager__item--link\" ng-if=\"totalPages > 7 && currentPage < totalPages - 2\" att-accessibility-click=\"13,32\" ng-click=\"selectPage(totalPages, $event)\">{{totalPages}}</a>\n" +
+ " <a tabindex=\"0\" href=\"javascript:void(0)\" class=\"pager__item--next\" att-accessibility-click=\"13,32\" ng-click=\"next($event)\" ng-if=\"currentPage < totalPages\">Next <i class=\"icon-arrow-right\"></i></a>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/paneSelector/innerPane.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/paneSelector/innerPane.html",
+ "<div class='inner-pane' ng-transclude></div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/paneSelector/paneGroup.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/paneSelector/paneGroup.html",
+ "<div class='pane-group' ng-transclude></div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/paneSelector/sidePane.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/paneSelector/sidePane.html",
+ "<div class='side-pane' ng-transclude></div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/tooltip/tooltip-popup.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/tooltip/tooltip-popup.html",
+ "<div class=\"att-tooltip \" \n" +
+ " ng-class=\"{ 'att-tooltip--on': isOpen, \n" +
+ " 'att-tooltip--dark att-tooltip--dark--hover':stylett=='dark', \n" +
+ " 'att-tooltip--light att-tooltip--light--hover':stylett=='light',\n" +
+ " 'att-tooltip--left':placement=='left', \n" +
+ " 'att-tooltip--above':placement=='above', \n" +
+ " 'att-tooltip--right':placement=='right', \n" +
+ " 'att-tooltip--below':placement=='below'}\" \n" +
+ " ng-bind-html=\"content | unsafe\" ></div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/popOvers/popOvers.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/popOvers/popOvers.html",
+ "<div class=\"att-popover popover-demo\" ng-style=\"{backgroundColor:popOverStyle}\"\n" +
+ " ng-class=\"{'att-tooltip--dark':popOverStyle==='grey',\n" +
+ " 'att-pop-over--left':popOverPlacement==='left', \n" +
+ " 'att-pop-over--above':popOverPlacement==='above', \n" +
+ " 'att-pop-over--right':popOverPlacement==='right'}\" \n" +
+ " style='position: absolute; max-width: 490px;'>\n" +
+ " <div class=\"pop-over-caret\"\n" +
+ " ng-class=\"{'pop-over-caret-border--left':popOverPlacement==='left', \n" +
+ " 'pop-over-caret-border--above':popOverPlacement==='above', \n" +
+ " 'pop-over-caret-border--right':popOverPlacement==='right', \n" +
+ " 'pop-over-caret-border--below':popOverPlacement==='below'}\">\n" +
+ " </div>\n" +
+ " <div class=\"pop-over-caret\" ng-style=\"popOverPlacement=='below' && {borderBottom:'6px solid ' +popOverStyle}||popOverPlacement=='left' && {borderLeft:'6px solid ' +popOverStyle}||popOverPlacement=='right' && {borderRight:'6px solid ' +popOverStyle}||popOverPlacement=='above' && {borderTop:'6px solid ' +popOverStyle}\"\n" +
+ " ng-class=\"{'pop-over-caret--left':popOverPlacement==='left', \n" +
+ " 'pop-over-caret--above':popOverPlacement==='above', \n" +
+ " 'pop-over-caret--right':popOverPlacement==='right', \n" +
+ " 'pop-over-caret--below':popOverPlacement==='below'}\"></div>\n" +
+ " \n" +
+ " <div class=\"att-popover-content\">\n" +
+ " <a ng-if=\"closeable\" href=\"javascript:void(0)\" class=\"icon-close att-popover__close\" ng-click=\"closeMe();$event.preventDefault()\"></a>\n" +
+ " <div class=\"popover-packages__container\" ng-include=\"content\"></div>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/profileCard/addUser.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/profileCard/addUser.html",
+ "<div class=\"col-md-9 profile-card add-user\">\n" +
+ " <div class=\"atcenter\">\n" +
+ " <div><i class=\"icon-add\"></i></div>\n" +
+ " <span>add User</span>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/profileCard/profileCard.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/profileCard/profileCard.html",
+ "<div class=\"col-md-9 profile-card\">\n" +
+ " <div class=\"top-block\">\n" +
+ " <div class=\"profile-image\">\n" +
+ " <img ng-if=\"image\" profile-name=\"{{profile.name}}\" ng-src=\"{{profile.img}}\" alt=\"{{profile.name}}\">\n" +
+ " <span ng-hide=\"image\" class=\"default-img\">{{initials}}</span>\n" +
+ " <p class=\"name\" tooltip-condition=\"{{profile.name}}\" height=\"true\"></p>\n" +
+ " <p class=\"status\">\n" +
+ " <span class=\"status-icon\" ng-class=\"{'icon-green':colorIcon==='green','icon-red':colorIcon==='red','icon-blue':colorIcon==='blue','icon-yellow':colorIcon==='yellow'}\"> \n" +
+ " </span>\n" +
+ " <span>{{profile.state}}<span ng-if=\"badge\" class=\"status-badge\">Admin</span></span>\n" +
+ " </p>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ " <div class=\"bottom-block\">\n" +
+ " <div class=\"profile-details\">\n" +
+ " <label>Username</label>\n" +
+ " <p att-text-overflow=\"92%\" tooltip-condition=\"{{profile.userName}}\">{{profile.userName}}</p>\n" +
+ " <label>Email</label>\n" +
+ " <p att-text-overflow=\"92%\" tooltip-condition=\"{{profile.email}}\">{{profile.email}}</p>\n" +
+ " <label>Role</label>\n" +
+ " <p att-text-overflow=\"92%\" tooltip-condition=\"{{profile.role}}\">{{profile.role}}</p>\n" +
+ " <label>Last Login</label>\n" +
+ " <p att-text-overflow=\"92%\" tooltip-condition=\"{{profile.lastLogin}}\">{{profile.lastLogin}}</p>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/progressBars/progressBars.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/progressBars/progressBars.html",
+ "<div class=\"att-progress\">\n" +
+ " <div class=\"att-progress-value\">&nbsp;</div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/scrollbar/scrollbar.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/scrollbar/scrollbar.html",
+ "<div class=\"scroll-bar\" style=\"position: absolute\">\n" +
+ " <div class=\"scroll-thumb\" style=\"position: absolute; overflow: hidden\"></div>\n" +
+ "</div>\n" +
+ "<div class=\"prev icons-list\" data-size=\"medium\" ng-show=\"navigation && prevAvailable\" ng-style=\"{height: scrollbarAxis === 'x' && position.height + 'px'}\">\n" +
+ " <a href=\"javascript:void(0);\" ng-click=\"customScroll(false)\" aria-label=\"Scroll\" aria-hidden=\"true\">\n" +
+ " <i ng-class=\"{'ion-ios-arrow-up': (scrollbarAxis === 'y'), 'icon-chevron-left': (scrollbarAxis === 'x')}\"></i>\n" +
+ " </a>\n" +
+ "</div>\n" +
+ "<div class=\"scroll-viewport\" ng-style=\"{height: (scrollbarAxis === 'x' && position.height + 'px') || viewportHeight, width: viewportWidth}\" style=\"position: relative; overflow: hidden\">\n" +
+ " <div class=\"scroll-overview\" style=\"position: absolute; display: table; width: 100%\" att-position=\"position\" ng-transclude></div>\n" +
+ "</div>\n" +
+ "<div class='next icons-list' data-size=\"medium\" ng-show=\"navigation && nextAvailable\" ng-style=\"{height: scrollbarAxis === 'x' && position.height + 'px'}\">\n" +
+ " <a href=\"javascript:void(0);\" ng-click=\"customScroll(true)\" aria-label=\"Scroll\" aria-hidden=\"true\">\n" +
+ " <i ng-class=\"{'ion-ios-arrow-down': (scrollbarAxis === 'y'), 'icon-chevron-right': (scrollbarAxis === 'x')}\"></i>\n" +
+ " </a>\n" +
+ "</div>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/search/search.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/search/search.html",
+ "<div class=\"select2-container show-search\" ng-class=\"{'select2-dropdown-open': (showlist && !isDisabled),'select2-container-disabled':isDisabled, 'select2-container-active': isact}\" ng-init=\"isact=false;\" style=\"width: 100%;\">\n" +
+ " <a href=\"javascript:void(0)\" class=\"select2-choice needsclick\" tabindex=\"0\" ng-click=\"showDropdown()\" ng-class=\"{'select2-chosen-disabled':isDisabled}\" role=\"combobox\" aria-expanded=\"{{showlist}}\" aria-owns=\"inList\" aria-label=\"{{selectedOption}} selected\" ng-focus=\"isact=true;\" ng-blur=\"isact=false;\">\n" +
+ " <span class=\"select2-chosen needsclick\" aria-hidden = \"true\">{{selectedOption}}</span>\n" +
+ " <abbr class=\"select2-search-choice-close needsclick\"></abbr>\n" +
+ " <span class=\"select2-arrow needsclick\" role=\"presentation\">\n" +
+ " <b role=\"presentation\" class=\"needsclick\"></b>\n" +
+ " </span>\n" +
+ " </a> \n" +
+ " <input class=\"select2-focusser select2-offscreen\" \n" +
+ " tabindex=\"-1\" \n" +
+ " type=\"text\" \n" +
+ " aria-hidden=\"true\" \n" +
+ " title=\"hidden\" \n" +
+ " aria-haspopup=\"true\" \n" +
+ " role=\"button\"> \n" +
+ "</div>\n" +
+ "\n" +
+ "<div class=\"select2-drop select2-with-searchbox select2-drop-auto-width select2-drop-active\" ng-class=\"{'select2-display-none':(!showlist || isDisabled)}\" style=\"width:100%;z-index: 10\">\n" +
+ " <div class=\"select2-search\">\n" +
+ " <label ng-if=\"!noFilter\" class=\"select2-offscreen\" aria-label=\"Inline Search Field\" aria-hidden=\"true\">Inline Search Field</label>\n" +
+ " <input ng-if=\"!noFilter\" ng-model=\"title\" aria-label=\"title\" typeahead=\"c.title for c in cName | filter:$viewValue:startsWith\" type=\"text\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\" class=\"select2-input\" aria-autocomplete=\"list\" placeholder=\"\">\n" +
+ " </div>\n" +
+ " <ul id=\"inList\" class=\"select2-results\" role=\"listbox\">\n" +
+ " <li ng-show=\"filteredName.length === 0\" class=\"select2-no-results\" tabindex=\"-1\">No matches found</li>\n" +
+ " <li class=\"select2-results-dept-0 select2-result select2-result-selectable\" role=\"presentation\" ng-model=\"ListType\" ng-show=\"selectMsg && filteredName.length > 0\" ng-click=\"selectOption(selectMsg, '-1')\" ng-class=\"{'select2-result-current': selectedOption === selectMsg, 'hovstyle': selectedIndex === -1}\" ng-mouseover=\"hoverIn(-1)\" aria-label=\"{{selectMsg}}\" tabindex=\"-1\">\n" +
+ " <div ng-if=\"startsWithFilter\" class=\"select2-result-label\" ng-bind-html=\"selectMsg | unsafe\" role=\"option\">\n" +
+ " <span class=\"select2-match\"></span>\n" +
+ " </div>\n" +
+ " <div ng-if=\"!startsWithFilter\" class=\"select2-result-label\" ng-bind-html=\"selectMsg | highlight:title:className | unsafe\" role=\"option\">\n" +
+ " <span class=\"select2-match\"></span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ "\n" +
+ " <li role=\"menuitem\" ng-if=\"startsWithFilter\" class=\"select2-results-dept-0 select2-result select2-result-selectable\" role=\"presentation\" ng-model=\"ListType\" ng-repeat=\"(fIndex, item) in filteredName = (cName | startsWith:title:item)\" ng-class=\"{'select2-result-current': selectedOption === item.title,'hovstyle': selectedIndex === item.index,'disable': item.disabled}\" ng-click=\"item.disabled || selectOption(item.title,item.index)\" ng-mouseover=\"hoverIn(item.index)\" aria-label=\"{{item.title}}\" tabindex=\"-1\">\n" +
+ " <div class=\"select2-result-label\" ng-bind-html=\"item.title | unsafe\" role=\"option\">\n" +
+ " <span class=\"select2-match\"></span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ "\n" +
+ " <li role=\"menuitem\" ng-if=\"!startsWithFilter\" class=\"select2-results-dept-0 select2-result select2-result-selectable\" role=\"presentation\" ng-model=\"ListType\" ng-repeat=\"(fIndex, item) in filteredName = (cName | filter:title)\" ng-class=\"{'select2-result-current': selectedOption === item.title,'hovstyle': selectedIndex === item.index,'disable': item.disabled}\" ng-click=\"item.disabled || selectOption(item.title,item.index)\" ng-mouseover=\"hoverIn(item.index)\" aria-label=\"{{item.title}}\" tabindex=\"-1\">\n" +
+ " <div class=\"select2-result-label\" ng-bind-html=\"item.title | highlight:title:className | unsafe\" role=\"option\">\n" +
+ " <span class=\"select2-match\"></span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/select/select.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/select/select.html",
+ "<div class=\"select2-container show-search\" ng-class=\"{'select2-dropdown-open': (showlist && !isDisabled),'select2-container-disabled': isDisabled, 'select2-container-active': isact}\" ng-init=\"isact=false;\">\n" +
+ " <span class=\"select2-choice needsclick\" tabindex=\"{{isDisabled ? -1 : 0}}\" ng-click=\"showDropdown()\" ng-class=\"{'select2-chosen-disabled':isDisabled}\" role=\"combobox\" aria-expanded=\"{{showlist}}\" aria-owns=\"inList\" aria-label=\"{{titleName}} dropdown {{selectedOption}} selected\" ng-focus=\"isact=true;\" ng-blur=\"isact=false;\">\n" +
+ " <span class=\"select2-chosen needsclick\" aria-hidden=\"true\" ng-bind-html=\"selectedOption | unsafe\">{{selectedOption}}</span>\n" +
+ " <abbr class=\"select2-search-choice-close needsclick\"></abbr>\n" +
+ " <span class=\"select2-arrow needsclick\" role=\"presentation\">\n" +
+ " <b role=\"presentation\" class=\"needsclick\"></b>\n" +
+ " </span>\n" +
+ " </span> \n" +
+ " <input class=\"select2-focusser select2-offscreen\" \n" +
+ " tabindex=\"-1\" \n" +
+ " type=\"text\" \n" +
+ " aria-hidden=\"true\" \n" +
+ " title=\"hidden\" \n" +
+ " aria-haspopup=\"true\" \n" +
+ " role=\"button\"> \n" +
+ "</div>\n" +
+ "\n" +
+ "<div class=\"select2-drop select2-with-searchbox select2-drop-auto-width select2-drop-active\" ng-class=\"{'select2-display-none':(!showlist || isDisabled)}\" style=\"width:100%;z-index: 10\">\n" +
+ " <div class=\"select2-search\">\n" +
+ " <label ng-if=\"!noFilter\" class=\"select2-offscreen\" aria-label=\"Inline Search Field\" aria-hidden=\"true\">Inline Search Field</label>\n" +
+ " <input ng-if=\"!noFilter\" ng-model=\"title\" aria-label=\"title\" typeahead=\"c.title for c in cName | filter:$viewValue:startsWith\" type=\"text\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\" class=\"select2-input\" aria-autocomplete=\"list\" placeholder=\"\">\n" +
+ " </div>\n" +
+ " <ul id=\"inList\" class=\"select2-results\" role=\"listbox\">\n" +
+ " <li ng-if=\"!noFilter\" ng-show=\"filteredName.length === 0\" class=\"select2-no-results\" tabindex=\"-1\">No matches found</li>\n" +
+ " <li ng-if=\"!noFilter\" class=\"select2-results-dept-0 select2-result select2-result-selectable\" role=\"presentation\" ng-model=\"ListType\" ng-show=\"selectMsg && filteredName.length > 0\" ng-click=\"selectOption(selectMsg, '-1')\" ng-class=\"{'select2-result-current': selectedOption === selectMsg, 'hovstyle': selectedIndex === -1}\" ng-mouseover=\"hoverIn(-1)\" aria-label=\"{{selectMsg}}\" tabindex=\"-1\">\n" +
+ " <div ng-if=\"startsWithFilter\" class=\"select2-result-label\" ng-bind-html=\"selectMsg | unsafe\" role=\"option\">\n" +
+ " <span class=\"select2-match\"></span>\n" +
+ " </div>\n" +
+ " <div ng-if=\"!startsWithFilter\" class=\"select2-result-label\" ng-bind-html=\"selectMsg | highlight:title:className | unsafe\" role=\"option\">\n" +
+ " <span class=\"select2-match\"></span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ "\n" +
+ " <li role=\"menuitem\" ng-if=\"startsWithFilter\" class=\"select2-results-dept-0 select2-result select2-result-selectable\" ng-model=\"ListType\" ng-repeat=\"(fIndex, item) in filteredName = (cName | startsWith:title:item)\" ng-class=\"{'select2-result-current': selectedOption === item.title,'hovstyle': selectedIndex === item.index,'disable': item.disabled}\" ng-click=\"item.disabled || selectOption(item.title,item.index)\" ng-mouseover=\"hoverIn(item.index)\" tabindex=\"-1\">\n" +
+ " <div class=\"select2-result-label\" ng-bind-html=\"item.title | unsafe\" role=\"option\">\n" +
+ " <span class=\"select2-match\"></span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ "\n" +
+ " <li role=\"menuitem\" ng-if=\"!startsWithFilter\" class=\"select2-results-dept-0 select2-result select2-result-selectable\" ng-model=\"ListType\" ng-repeat=\"(fIndex, item) in filteredName = (cName | filter:title)\" ng-class=\"{'select2-result-current': selectedOption === item.title,'hovstyle': selectedIndex === item.index,'disable': item.disabled}\" ng-click=\"item.disabled || selectOption(item.title,item.index)\" ng-mouseover=\"hoverIn(item.index)\" tabindex=\"-1\">\n" +
+ " <div class=\"select2-result-label\" ng-bind-html=\"item.title | highlight:title:className | unsafe\" role=\"option\">\n" +
+ " <span class=\"select2-match\"></span>\n" +
+ " </div>\n" +
+ " </li>\n" +
+ " </ul>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/select/textDropdown.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/select/textDropdown.html",
+ "<div tabindex=\"0\" class=\"text-dropdown\">\n" +
+ " <div class=\"dropdown\" ng-class=\"{'not-visible': isActionsShown}\" ng-click=\"toggle()\">\n" +
+ " <span class=\"action--selected\" ng-bind=\"currentAction\"></span>\n" +
+ " <i ng-class=\"isActionsShown ? 'ion-arrow-up-b' : 'ion-arrow-down-b'\"></i>\n" +
+ " </div>\n" +
+ " <ul ng-class=\"isActionsShown ? 'actionsOpened' : 'actionsClosed'\" ng-show=\"isActionsShown\">\n" +
+ " <li ng-class=\"{'highlight': selectedIndex==$index}\" ng-repeat=\"action in actions track by $index\" ng-click=\"chooseAction($event, action, $index)\" ng-mouseover=\"hoverIn($index)\">{{action}}<i ng-class=\"{'icon-included-checkmark': isCurrentAction(action)}\" att-accessibility-click=\"13,32\"></i></li>\n" +
+ " </ul>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/slider/maxContent.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/slider/maxContent.html",
+ "<div class=\"att-slider__label att-slider__label--max att-slider__label--below\" ng-transclude></div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/slider/minContent.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/slider/minContent.html",
+ "<div class=\"att-slider__label att-slider__label--min att-slider__label--below\" ng-transclude></div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/slider/slider.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/slider/slider.html",
+ "<div class=\"att-slider\" ng-mousemove=\"moveElem($event)\" ng-mouseup=\"mouseUp($event)\">\n" +
+ " <div class=\"att-slider__track\">\n" +
+ " <div class=\"att-slider__range att-slider__range--disabled\" ng-style=\"disabledStyle\"></div>\n" +
+ " <div class=\"att-slider__range\" ng-style=\"rangeStyle\"></div>\n" +
+ " </div>\n" +
+ " <div class=\"att-slider__handles-container\">\n" +
+ " <div role=\"menuitem\" aria-label=\"{{ngModelSingle}}\" class=\"att-slider__handle\" ng-style=\"handleStyle\" ng-mousedown=\"mouseDown($event,'ngModelSingle')\" ng-mousemove=\"moveElem($event)\" ng-mouseup=\"mouseUp($event)\" tabindex=\"0\" ng-keydown=\"keyDown($event,'ngModelSingle')\"></div>\n" +
+ " <div role=\"menuitem\" aria-label=\"Minimum Value- {{ngModelLow}}\" class=\"att-slider__handle\" ng-style=\"minHandleStyle\" ng-mousedown=\"mouseDown($event,'ngModelLow')\" ng-focus=\"focus($event,'ngModelLow')\" ng-mousemove=\"moveElem($event)\" ng-mouseup=\"mouseUp($event)\" tabindex=\"0\" ng-keyup=\"keyUp($event,'ngModelLow')\" ng-keydown=\"keyDown($event,'ngModelLow')\"></div>\n" +
+ " <div role=\"menuitem\" aria-label=\"Maximum Value- {{ngModelHigh}}\" class=\"att-slider__handle\" ng-style=\"maxHandleStyle\" ng-mousedown=\"mouseDown($event,'ngModelHigh')\" ng-focus=\"focus($event,'ngModelHigh')\" ng-mousemove=\"moveElem($event)\" ng-mouseup=\"mouseUp($event)\" tabindex=\"0\" ng-keyup=\"keyUp($event,'ngModelHigh')\" ng-keydown=\"keyDown($event,'ngModelHigh')\"></div>\n" +
+ " </div>\n" +
+ " <div ng-transclude></div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdown.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdown.html",
+ "<div class=\" btn-group\" \n" +
+ " ng-class=\"{'buttons-dropdown--large':!isSmall, \n" +
+ " 'buttons-dropdown--small':isSmall, \n" +
+ " 'action-dropdown':(isActionDropdown), \n" +
+ " 'open':isDropDownOpen}\">\n" +
+ " <a tabindex=\"0\" href=\"javascript:void(0)\" class=\"button btn buttons-dropdown__split\" \n" +
+ " ng-class=\"{'button--primary':(btnType==undefined || btnType=='primary'), \n" +
+ " 'button--secondary':btnType=='secondary', \n" +
+ " 'button--disabled':btnType=='disabled', \n" +
+ " 'button--small':isSmall}\" \n" +
+ " ng-if=\"!isActionDropdown\"\n" +
+ " ng-click=\"btnType==='disabled'?undefined:clickFxn()\" att-accessibility-click=\"13,32\">{{btnText}}</a>\n" +
+ " <a tabindex=\"0\" href=\"javascript:void(0)\" role=\"button\" aria-label=\"Toggle Dropdown\" aria-haspopup=\"true\" class=\"button buttons-dropdown__drop dropdown-toggle\" \n" +
+ " ng-class=\"{'button--primary':(btnType==undefined || btnType=='primary'), \n" +
+ " 'button--secondary':btnType=='secondary', \n" +
+ " 'button--disabled':btnType=='disabled', \n" +
+ " 'button--small':isSmall}\" ng-click=\"toggleDropdown()\" att-accessibility-click=\"13,32\">{{toggleTitle}} </a>\n" +
+ " <ul class=\"dropdown-menu\" ng-class=\"{'align-right':multiselect ===true}\" aria-expanded=\"{{isDropDownOpen}}\" ng-click=\"hideDropdown()\" role=\"menu\" ng-transclude></ul>\n" +
+ "</div> ");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdownItem.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdownItem.html",
+ "<li role=\"menuitem\" att-element-focus=\"sFlag\" tabindex=\"0\" ng-transclude></li>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/splitIconButton/splitIcon.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/splitIconButton/splitIcon.html",
+ "<div class='split-icon-button-container'>\n" +
+ "\n" +
+ " <div class='split-icon-button' ng-class=\"{'icon-with-chevron': isRight && !isMiddle && !isLeftNextDropdown && !isNextToDropDown, 'split-icon-button-middle':isMiddle, 'split-icon-button-right':isRight, 'split-icon-button-left':isLeft, 'split-icon-button-left-dropdown': isLeftNextDropdown ,'split-icon-button-next-dropdown': isNextToDropDown,'split-icon-button-dropdown': isDropDownOpen,'split-icon-button-hover':isIconHovered || isDropDownOpen}\" ng-mouseover='isIconHovered = true;' ng-mouseleave='isIconHovered = false;' tabindex=\"-1\" att-accessibility-click=\"13,32\" ng-click='dropDownClicked();'>\n" +
+ " <a class='{{icon}}' title='{{iconTitle}}' tabindex=\"0\"></a>\n" +
+ " <i ng-if=\"isRight && !isMiddle && !isLeftNextDropdown && !isNextToDropDown\" \n" +
+ " ng-class=\"isDropDownOpen ? 'ion-arrow-up-b' : 'ion-arrow-down-b'\"> </i>\n" +
+ " </div> \n" +
+ "\n" +
+ " <ul ng-if='isDropdown' class='dropdown-menu {{dropDownId}}' ng-show='\n" +
+ " isDropDownOpen' ng-click='toggleDropdown(false)' role=\"presentation\" ng-transclude>\n" +
+ " </ul>\n" +
+ "\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/splitIconButton/splitIconButton.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/splitIconButton/splitIconButton.html",
+ "<div>\n" +
+ " <div ng-if='isLeftLineShown' dir-type='{{iconStateConstants.DIR_TYPE.LEFT}}' expandable-line></div>\n" +
+ " <div ng-click='clickHandler()' att-split-icon icon='{{icon}}' title='{{title}}' dir-type='{{iconStateConstants.DIR_TYPE.BUTTON}}' hover-watch='isHovered' drop-down-watch='dropDownWatch' drop-down-id='{{dropDownId}}'>\n" +
+ " <div ng-transclude>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ " <div ng-if='isRightLineShown' dir-type='{{iconStateConstants.DIR_TYPE.RIGHT}}' expandable-line></div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/splitIconButton/splitIconButtonGroup.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/splitIconButton/splitIconButtonGroup.html",
+ "<div ng-transclude>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/stepSlider/attStepSlider.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/stepSlider/attStepSlider.html",
+ "<span ng-class=\"mainSliderClass\">\n" +
+ " <table>\n" +
+ " <tr>\n" +
+ " <td>\n" +
+ " <div class=\"jslider-bg\">\n" +
+ " <i class=\"l\"></i>\n" +
+ " <i class=\"r\"></i>\n" +
+ " <i class=\"v\" ng-class=\"{'step-slider-green':sliderColor == COLORS.GREEN, 'step-slider-blue': sliderColor == COLORS.BLUE_HIGHLIGHT, 'step-slider-magenta': sliderColor == COLORS.MAGENTA, 'step-slider-gold': sliderColor == COLORS.GOLD, 'step-slider-purple': sliderColor == COLORS.PURPLE, 'step-slider-dark-blue': sliderColor == COLORS.DARK_BLUE, 'step-slider-regular': sliderColor == COLORS.REGULAR, 'step-slider-white': sliderColor == COLORS.WHITE, 'cutoff-slider': isCutOffSlider}\"></i>\n" +
+ " </div>\n" +
+ " <div class=\"jslider-pointer\" id=\"left-pointer\"></div>\n" +
+ " <div class=\"jslider-pointer jslider-pointer-to\" ng-class=\"{'step-slider-green':sliderColor == COLORS.GREEN, 'step-slider-blue': sliderColor == COLORS.BLUE_HIGHLIGHT, 'step-slider-magenta': sliderColor == COLORS.MAGENTA, 'step-slider-gold': sliderColor == COLORS.GOLD, 'step-slider-purple': sliderColor == COLORS.PURPLE, 'step-slider-dark-blue': sliderColor == COLORS.DARK_BLUE, 'step-slider-regular': sliderColor == COLORS.REGULAR, 'step-slider-white':sliderColor == COLORS.WHITE ,'cutoff-slider': isCutOffSlider}\"></div>\n" +
+ " <div class=\"jslider-label\"><span ng-bind=\"from\"></span><span ng-bind=\"options.dimension\"></span></div>\n" +
+ " <div class=\"jslider-label jslider-label-to\"><span ng-bind=\"toStr\"></span><span ng-bind=\"endDimension\"></span></div>\n" +
+ " <div class=\"jslider-value\" id=\"jslider-value-left\"><span></span>{{options.dimension}}</div>\n" +
+ " <div class=\"jslider-value jslider-value-to\"><span></span>{{toolTipDimension}}</div>\n" +
+ " <div class=\"jslider-scale\" ng-class=\"{'show-dividers': showDividers, 'cutoff-slider-dividers':isCutOffSlider}\">\n" +
+ " </div>\n" +
+ " <div class=\"jslider-cutoff\">\n" +
+ " <div class=\"jslider-label jslider-label-cutoff\">\n" +
+ " <span ng-bind=\"cutOffVal\"></span>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ " </td>\n" +
+ " </tr>\n" +
+ " </table>\n" +
+ "</span>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/steptracker/step-tracker.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/steptracker/step-tracker.html",
+ "<div class=\"steptracker1\">\n" +
+ " <div class=\"steptracker-bg\">\n" +
+ " <div tabindex=\"0\" ng-click=\"stepclick($event, $index);\" att-accessibility-click=\"13,23\" class=\"steptracker-track size-onethird\" ng-repeat=\"step in sdata\"\n" +
+ " ng-style=\"set_width($index)\"\n" +
+ " ng-class=\"{'last':laststep($index),'done':donesteps($index),'active':activestep($index), 'incomplete': isIncomplete($index), 'disabled': disableClick}\">\n" +
+ " <div class=\"circle\">{{($index) + 1}}<span>{{step.title}}</span></div>\n" +
+ " <div ng-if=\"!laststep($index)\" class=\"track\"></div>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/steptracker/step.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/steptracker/step.html",
+ "<div class=\"steptracker1\">\n" +
+ " <div class=\"steptracker-bg\">\n" +
+ " <div class=\"steptracker-track size-onethird\" \n" +
+ " ng-class=\"{'last':laststep($index),'done':donesteps($index),'active':activestep($index)}\">\n" +
+ " <div class=\"circle\" tabindex=\"0\" \n" +
+ " ng-click=\"stepclick($event, $index);\" \n" +
+ " att-accessibility-click=\"13,23\">{{($index) + 1}}<span>{{step.title}}</span></div>\n" +
+ " <div ng-if=\"!laststep($index)\" class=\"track\"></div>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ "</div>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/steptracker/timeline.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/steptracker/timeline.html",
+ "<div class='att-timeline'>\n" +
+ " <div timeline-dot order='0' title='{{steps[0].title}}' description='{{steps[0].description}}' by='{{steps[0].by}}' date='{{steps[0].date}}' type='{{steps[0].type}}'></div>\n" +
+ "\n" +
+ " <div ng-repeat=\"m in middleSteps track by $index\">\n" +
+ " <div timeline-bar order='{{$index}}'></div>\n" +
+ " <div timeline-dot order='{{$index + 1}}' title='{{m.title}}' description='{{m.description}}' by='{{m.by}}' date='{{m.date}}' type='{{m.type}}'>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ "\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/steptracker/timelineBar.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/steptracker/timelineBar.html",
+ "<div class='timeline-bar'>\n" +
+ " <div class='progress-bar' ng-class=\"{'completed-color':isCompleted,'cancelled-color':isCancelled,'alert-color':isAlert}\">\n" +
+ " </div>\n" +
+ " <hr></hr>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/steptracker/timelineDot.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/steptracker/timelineDot.html",
+ "<div class='timeline-dot'>\n" +
+ "\n" +
+ " <div class='bigger-circle' ng-class=\"{'completed-color':isCompleted,'cancelled-color':isCancelled,'alert-color':isAlert}\">\n" +
+ " </div>\n" +
+ "\n" +
+ " <div class='inactive-circle'>\n" +
+ " </div>\n" +
+ "\n" +
+ " <div class='expandable-circle' ng-class=\"{'completed-color':isCompleted,'cancelled-color':isCancelled,'alert-color':isAlert}\">\n" +
+ " </div>\n" +
+ "\n" +
+ " <div ng-class=\"{'below-info-box':isBelowInfoBoxShown, 'above-info-box': !isBelowInfoBoxShown}\" tabindex=\"0\">\n" +
+ " \n" +
+ " <div ng-if='isBelowInfoBoxShown' class='vertical-line'>\n" +
+ " </div>\n" +
+ "\n" +
+ " <div class='info-container' ng-init='isContentShown=false'>\n" +
+ " <div ng-class=\"{'current-step-title':isCurrentStep, 'title':!isCurrentStep,'completed-color-text':isCompleted,'cancelled-color-text':isCancelled,'alert-color-text':isAlert, 'inactive-color-text':isInactive}\" ng-mouseover='titleMouseover(1)' ng-mouseleave='titleMouseleave()' ng-bind='title' ></div>\n" +
+ " <div class='content'>\n" +
+ " <div class='description' ng-bind='description'></div>\n" +
+ " <div class='submitter' ng-bind='by'></div>\n" +
+ " </div>\n" +
+ " <div class='date' ng-mouseover='titleMouseover(2)' ng-mouseleave='titleMouseleave()' ng-bind='date'></div>\n" +
+ " </div>\n" +
+ "\n" +
+ " <div ng-if='!isBelowInfoBoxShown' class='vertical-line'>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ "\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/table/attTable.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/table/attTable.html",
+ "<table class=\"tablesorter tablesorter-default\" ng-transclude></table>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/table/attTableBody.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/table/attTableBody.html",
+ "<td ng-transclude></td>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/table/attTableHeader.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/table/attTableHeader.html",
+ "<th role=\"columnheader\" scope=\"col\" aria-live=\"polite\" aria-sort=\"{{sortPattern !== 'null' && '' || sortPattern}}\" aria-label=\"{{headerName}} {{sortable !== 'false' && ': activate to sort' || ' '}} {{sortPattern !== 'null' && '' || sortPattern}}\" tabindex=\"{{sortable !== 'false' && '0' || '-1'}}\" class=\"tablesorter-header\" ng-class=\"{'tablesorter-headerAsc': sortPattern === 'ascending', 'tablesorter-headerDesc': sortPattern === 'descending', 'tablesort-sortable': sortable !== 'false', 'sorter-false': sortable === 'false'}\" att-accessibility-click=\"13,32\" ng-click=\"(sortable !== 'false') && sort();\"><div class=\"tablesorter-header-inner\" ng-transclude></div></th>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/tableMessages/attTableMessage.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/tableMessages/attTableMessage.html",
+ "<div class=\"att-table-message\">\n" +
+ " <div class=\"message\" ng-if=\"msgType==messageConstants.TABLE_MESSAGE_TYPES.noMatching\">\n" +
+ " <div class=\"img-magnify-glass\"></div> \n" +
+ " <div>\n" +
+ " <div ng-transclude></div>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ " <div class=\"message\" ng-if=\"msgType==messageConstants.TABLE_MESSAGE_TYPES.errorLoading\">\n" +
+ " <div class=\"img-oops-exclamation\" tabindex=\"0\" aria-label=\"Oops! The information could not load at this time. Please click link to refresh the page.\"></div> \n" +
+ " <div>Oops!</div>\n" +
+ " <div>The information could not load at this time.</div>\n" +
+ " <div>Please <a href=\"javascript:void(0)\" ng-click=\"refreshAction($event)\">refresh the page</a>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ " <div class=\"message\" ng-if=\"msgType==messageConstants.TABLE_MESSAGE_TYPES.magnifySearch\">\n" +
+ " <div class=\"img-magnify-glass\"></div>\n" +
+ " <div>\n" +
+ " <p class=\"title\" tabindex=\"0\">Please input values to <br/> begin your search.</p>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ " <div class=\"message loading-message\" ng-if=\"msgType==messageConstants.TABLE_MESSAGE_TYPES.isLoading\">\n" +
+ " <div class=\"img-loading-dots\"></div>\n" +
+ " <div ng-transclude></div>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/tableMessages/attUserMessage.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/tableMessages/attUserMessage.html",
+ "<div class=\"att-user-message\">\n" +
+ " <div ng-class=\"type==messageConstants.USER_MESSAGE_TYPES.error && trigger ? 'message-wrapper-error' : 'hidden'\">\n" +
+ " <div class=\"message-icon-error\"> <i class=\"icon-info-alert\"></i> </div>\n" +
+ "\n" +
+ " <div class=\"message-body-wrapper\">\n" +
+ " <div class=\"message-title-error\" ng-if=\"thetitle && thetitle.length > 0\"> <span ng-bind=\"thetitle\" tabindex=\"0\" aria-label=\"{{thetitle}}\"></span> </div>\n" +
+ " <div class=\"message-msg\" ng-bind=\"message\" ng-if=\"message && message.length > 0\" tabindex=\"0\"></div>\n" +
+ " <div class=\"message-bottom\">\n" +
+ " <div ng-transclude></div>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ "\n" +
+ " </div>\n" +
+ " <div ng-class=\"type==messageConstants.USER_MESSAGE_TYPES.success && trigger ? 'message-wrapper-success' : 'hidden'\">\n" +
+ " <div class=\"message-icon-success\"> <i class=\"icon-included-checkmark\"></i></div>\n" +
+ "\n" +
+ " <div class=\"message-body-wrapper\">\n" +
+ " <div class=\"message-title-success\" ng-if=\"thetitle && thetitle.length > 0\" >\n" +
+ " <span ng-bind=\"thetitle\" tabindex=\"0\" aria-label=\"{{thetitle}}\"></span>\n" +
+ " </div>\n" +
+ " <div class=\"message-msg\" ng-bind=\"message\" ng-if=\"message && message.length > 0\" tabindex=\"0\"></div>\n" +
+ " <div class=\"message-bottom\">\n" +
+ " <div ng-transclude></div>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ "\n" +
+ " </div>\n" +
+ "</div>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/tabs/floatingTabs.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/tabs/floatingTabs.html",
+ "<ul ng-class=\"{'tabsbid': size === 'large', 'tabsbid--small': size === 'small'}\">\n" +
+ " <li ng-repeat=\"tab in tabs\" ng-class=\"{'tabsbid__item tabsbid__item--active': isActiveTab(tab.url), 'tabsbid__item': !isActiveTab(tab.url)}\" ng-click=\"onClickTab(tab)\">\n" +
+ " <a class=\"tabsbid__item-link\" href=\"{{tab.url}}\" tabindex=\"0\" att-accessibility-click=\"32,13\">{{tab.title}}</a>\n" +
+ " </li>\n" +
+ "</ul>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/tabs/genericTabs.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/tabs/genericTabs.html",
+ "<ul ng-class=\"{'tabsbid': size === 'large', 'tabsbid--small': size === 'small'}\">\n" +
+ " <li ng-repeat=\"tab in tabs\" ng-class=\"{'tabsbid__item tabsbid__item--active': isActive(tab.id), 'tabsbid__item': !isActive(tab.id),'tabs__item--active': isActive(tab.id)}\" ng-click=\"clickTab(tab)\">\n" +
+ " <a class=\"tabsbid__item-link\" href=\"{{tab.url}}\" tabindex=\"0\" att-accessibility-click=\"32,13\">{{tab.title}}</a>\n" +
+ " </li>\n" +
+ "</ul>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/tabs/menuTab.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/tabs/menuTab.html",
+ "<li class=\"megamenu__item\" ng-mouseover=\"showHoverChild($event)\" ng-class=\"{'tabs__item--active': menuItem.active==true && !hoverChild==true}\">\n" +
+ " <span role=\"menuitem\" att-accessibility-click=\"13,32\" tabindex=\"0\" ng-click=\"showChildren($event);!clickInactive||resetMenu($event)\">{{tabName}}</span>\n" +
+ " <div ng-transclude></div>\n" +
+ "</li>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/tabs/parentmenuTab.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/tabs/parentmenuTab.html",
+ "<div ng-class=\"{'megamenu-tabs': megaMenu,'submenu-tabs': !megaMenu}\">\n" +
+ " <ul class=\"megamenu__items\" role=\"presentation\" ng-transclude>\n" +
+ " </ul>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/tabs/simplifiedTabs.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/tabs/simplifiedTabs.html",
+ "<div class=\"simplified-tabs\">\n" +
+ "<ul class=\"simplified-tabs__items\" role=\"tablist\">\n" +
+ " <li ng-repeat=\"tab in tabs\" role=\"tab\" class=\"simplified-tabs__item\" ng-class=\"{'tabs__item--active': isActive(tab.id)}\" ng-click=\"clickTab(tab)\" tabindex=\"0\" att-accessibility-click=\"32,13\">{{tab.title}}</li>\n" +
+ " <li class=\"tabs__pointer\"></li>\n" +
+ "</ul>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/tabs/submenuTab.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/tabs/submenuTab.html",
+ "<li class=\"tabsbid__item megamenu__item\" ng-class=\"{'subMenuHover': menuItem.active==true}\">\n" +
+ "<a ng-href=\"{{tabUrl}}\" role=\"menuitem\" ng-if=\"subMenu === true\" ng-mouseover=\"!subMenu || showChildren($event)\" ng-focus=\"!subMenu ||showChildren($event)\" tabindex=\"{{subMenu=='true'?0:-1}}\" ng-click=\"!subMenu ||showMenuClick($event) ; subMenu ||showSubMenuClick($event)\" att-accessibility-click=\"13,32\">{{tabName}}</a>\n" +
+ "<a ng-href=\"{{tabUrl}}\" role=\"menuitem\" ng-if=\"!menuItem.leafNode && subMenu !== true\" ng-mouseover=\"!subMenu || showChildren($event)\" ng-focus=\"!subMenu ||showChildren($event)\" tabindex=\"{{subMenu=='true'?0:-1}}\" ng-click=\"!subMenu ||showMenuClick($event) ; subMenu ||showSubMenuClick($event)\" att-accessibility-click=\"13,32\">{{tabName}}</a>\n" +
+ "<span ng-transclude></span>\n" +
+ "</li>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/tagBadges/tagBadges.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/tagBadges/tagBadges.html",
+ "<div class=\"tags__item\" \n" +
+ " ng-class=\"{'tags__item--small':isSmall, \n" +
+ " 'tags__item--color':isColor, \n" +
+ " 'tags__item--cloud':!isClosable && !isColor,'active':applyActiveClass}\"\n" +
+ " ng-if=\"display\" \n" +
+ " ng-style=\"{borderColor: border_type_borderColor, background: isHighlight?'#bbb':undefined, color: isHighlight?'#444':undefined }\"\n" +
+ " ng-mousedown=\"activeHighlight(true)\" role=\"presentation\" ng-mouseup=\"activeHighlight(false)\">\n" +
+ " <i class=\"icon-filter tags__item--icon\" ng-if=\"isIcon\">&nbsp;</i>\n" +
+ " <i class=\"tags__item--color-icon\" ng-if=\"isColor\" ng-style=\"{backgroundColor: background_type_backgroundColor, borderColor: background_type_borderColor}\"></i>\n" +
+ " <span class=\"tags__item--title\" role=\"presentation\" tabindex=0 ng-mousedown=\"activeHighlight(true)\" ng-mouseup=\"activeHighlight(false)\" ng-transclude></span>\n" +
+ " <a href=\"javascript:void(0)\" title=\"Dismiss Link\" class=\"tags__item--action\" ng-click=\"closeMe();$event.preventDefault()\" ng-if=\"isClosable\"\n" +
+ " ng-style=\"{color: (isHighlight && '#444') || '#888' , borderLeft: (isHighlight && '1px solid #444')|| '1px solid #888' }\">\n" +
+ " <i class=\"icon-erase\">&nbsp;</i>\n" +
+ " </a>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/toggle/demoToggle.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/toggle/demoToggle.html",
+ "<span ng-transclude></span>\n" +
+ "<div class=\"att-switch-content\" hm-drag = \"drag($event)\" att-accessibility-click=\"13,32\" ng-click=\"updateModel($event)\" hm-dragstart=\"alert('hello')\" hm-dragend=\"drag($event)\" ng-class=\"{'large' : directiveValue == 'large'}\" style=\"-webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\">\n" +
+ " <div class=\"att-switch-onText\" ng-style=\"\" ng-class=\"{'icon-included-checkmark ico' : on === undefined,'large' : directiveValue == 'large'}\">{{on}}<span class=\"hidden-spoken\">{{directiveValue}} when checked.</span></div>\n" +
+ " <div class=\"att-switch-thumb\" tabindex=\"0\" title=\"Toggle switch\" role=\"checkbox\" ng-class=\"{'large' : directiveValue == 'large'}\"></div>\n" +
+ " <div class=\"att-switch-offText\" ng-class=\"{'icon-erase ico' : on === undefined,'large' : directiveValue == 'large'}\">{{off}}<span class=\"hidden-spoken\">{{directiveValue}} when unchecked.</span></div>\n" +
+ "</div>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/typeAhead/typeAhead.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/typeAhead/typeAhead.html",
+ "<div class=\"typeahead mainContainerOuter\">\n" +
+ " <span class=\"message\">To</span>\n" +
+ " <div class='maincontainer' ng-click=\"setFocus()\" ng-focus=\"inputActive=true\" ng-class =\"{'typeahed_active':inputActive || (lineItems.length && inputActive)}\">\n" +
+ " <span tag-badges closable ng-repeat =\"lineItem in lineItems track by $index\" on-close=\"theMethodToBeCalled($index)\" >{{lineItem}}</span>\n" +
+ " <input type=\"text\" focus-me=\"clickFocus\" ng-focus=\"inputActive=true\" ng-model=\"model\" ng-keydown=\"selected = false; selectionIndex($event)\"/><br/> \n" +
+ " </div>\n" +
+ " <div ng-hide=\"!model.length || selected\">\n" +
+ " <div class=\"filtercontainer list-scrollable\" ng-show=\"( items | filter:model).length\">\n" +
+ " <div class=\"item\" ng-repeat=\"item in items| filter:model track by $index\" ng-click=\"handleSelection(item[titleName],item[subtitle])\" att-accessibility-click=\"13,32\" ng-class=\"{active:isCurrent($index,item[titleName],item[subtitle],( items | filter:model).length)}\"ng-mouseenter=\"setCurrent($index)\">\n" +
+ " <span class=\"title\" >{{item[titleName]}}</span>\n" +
+ " <span class=\"subtitle\">{{item[subtitle]}}</span>\n" +
+ " </div> \n" +
+ " </div>\n" +
+ " </div>\n" +
+ " \n" +
+ " <div class=\"textAreaEmailContentDiv\">\n" +
+ " <span class=\"message\">Message</span>\n" +
+ " <textarea rows=\"4\" cols=\"50\" role=\"textarea\" class=\"textAreaEmailContent\" ng-model=\"emailMessage\">To send \n" +
+ " a text, picture, or video message1 to a wireless device from your email:my message.</textarea>\n" +
+ " \n" +
+ " </div>\n" +
+ " \n" +
+ "</div>\n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/verticalSteptracker/vertical-step-tracker.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/verticalSteptracker/vertical-step-tracker.html",
+ "<li>\n" +
+ " <i ng-class=\"{'icon-tickets-active' : type == 'actual' && id =='Active','icon-tickets-referred' : type == 'actual' && id =='Requested Closed','icon-ticket-regular' : type == 'progress' && id =='In Progress','icon-tickets-contested' : type == 'actual' && id =='Contested','icon-tickets-returned' : type == 'actual' && id =='Deferred','icon-tickets-closed' : type == 'actual' && id =='Ready to Close','icon-tickets-cleared' : type == 'actual' && id =='Cleared'}\"></i>\n" +
+ " <span ng-transclude></span>\n" +
+ "</li>\n" +
+ " \n" +
+ "");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/videoControls/photoControls.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/videoControls/photoControls.html",
+ "<div>\n" +
+ " <a title=\"{{links.prevLink}}\" aria-label=\"Previous Link\" ng-href=\"{{links.prevLink}}\"><i alt=\"previous\" class=\"icon-arrow-left\">&nbsp;</i></a>\n" +
+ " <span ng-transclude></span>\n" +
+ " <a title=\"{{links.nextLink}}\" aria-label=\"Next Link\" ng-href=\"{{links.nextLink}}\"><i alt=\"next\" class=\"icon-arrow-right\">&nbsp;</i></a>\n" +
+ "</div>");
+}]);
+
+angular.module("app/scripts/ng_js_att_tpls/videoControls/videoControls.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/videoControls/videoControls.html",
+ "<div class=\"video-player\">\n" +
+ " <div class=\"video-player__control video-player__play-button\">\n" +
+ " <a class=\"video-player__button gigant-play\" data-toggle-buttons=\"icon-play, icon-pause\" data-target=\"i\"><i class=\"icon-play\" alt=\"Play/Pause Button\"></i></a>\n" +
+ " </div>\n" +
+ " <div class=\"video-player__control video-player__track\">\n" +
+ "\n" +
+ " <div class=\"video-player__track--inner\">\n" +
+ " <div class=\"video-player__track--loaded\" style=\"width: 75%\"></div>\n" +
+ " <div class=\"video-player__track--played\" style=\"width: 40%\">\n" +
+ " <div class=\"att-tooltip att-tooltip--on att-tooltip--dark att-tooltip--above video-player__track-tooltip\" ng-transclude></div>\n" +
+ " <div class=\"video-player__track-handle\"></div>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ " </div>\n" +
+ " <a class=\"video-player__time\" ng-transclude></a>\n" +
+ " <div class=\"video-player__control video-player__volume_icon\">\n" +
+ " <a class=\"video-player__button\" data-toggle-buttons=\"icon-volume-mute, icon-volume-up\" data-target=\"i\"><i class=\"icon-volume-up\" alt=\"Volume Button\"></i></a>\n" +
+ " </div>\n" +
+ " <ul class=\"video-player__control video-player__volume\">\n" +
+ " <li class=\"video-player__volume-bar video-player__volume-bar--full\">&nbsp;</li>\n" +
+ " <li class=\"video-player__volume-bar video-player__volume-bar--full\">&nbsp;</li>\n" +
+ " <li class=\"video-player__volume-bar\">&nbsp;</li>\n" +
+ " <li class=\"video-player__volume-bar\">&nbsp;</li>\n" +
+ " <li class=\"video-player__volume-bar\">&nbsp;</li>\n" +
+ " </ul>\n" +
+ " <div class=\"video-player__control video-player__toggle-fullscreen-button\">\n" +
+ " <a class=\"video-player__button\" data-toggle-buttons=\"icon-full-screen, icon-normal-screen\" data-target=\"i\"><i class=\"icon-full-screen\" alt=\"Full Screen Button\">&nbsp;</i></a>\n" +
+ " </div>\n" +
+ "</div>");
+}]);
+
+return {}
+})(angular, window); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/att-abs-tpls.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/att-abs-tpls.min.js
new file mode 100644
index 00000000..31c5ec3b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/att-abs-tpls.min.js
@@ -0,0 +1,22 @@
+/**
+* FileName att-style-guide
+* Version 2.17.0
+* Build number 5c64ecd381d5984c483cdfaa078a1890
+* Date 11/23/2015
+*/
+
+(function(angular, window){
+angular.module("att.abs",["att.abs.tpls","att.abs.utilities","att.abs.position","att.abs.transition","att.abs.accordion","att.abs.alert","att.abs.boardStrip","att.abs.breadCrumbs","att.abs.buttons","att.abs.checkbox","att.abs.colorselector","att.abs.datepicker","att.abs.devNotes","att.abs.dividerLines","att.abs.dragdrop","att.abs.drawer","att.abs.message","att.abs.formField","att.abs.hourpicker","att.abs.iconButtons","att.abs.links","att.abs.loading","att.abs.modal","att.abs.pagination","att.abs.paneSelector","att.abs.tooltip","att.abs.popOvers","att.abs.profileCard","att.abs.progressBars","att.abs.radio","att.abs.scrollbar","att.abs.search","att.abs.select","att.abs.slider","att.abs.splitButtonDropdown","att.abs.splitIconButton","att.abs.stepSlider","att.abs.steptracker","att.abs.table","att.abs.tableMessages","att.abs.tabs","att.abs.tagBadges","att.abs.textOverflow","att.abs.toggle","att.abs.treeview","att.abs.typeAhead","att.abs.verticalSteptracker","att.abs.videoControls"]),angular.module("att.abs.tpls",["app/scripts/ng_js_att_tpls/accordion/accordion.html","app/scripts/ng_js_att_tpls/accordion/accordion_alt.html","app/scripts/ng_js_att_tpls/accordion/attAccord.html","app/scripts/ng_js_att_tpls/accordion/attAccordBody.html","app/scripts/ng_js_att_tpls/accordion/attAccordHeader.html","app/scripts/ng_js_att_tpls/alert/alert.html","app/scripts/ng_js_att_tpls/boardStrip/attAddBoard.html","app/scripts/ng_js_att_tpls/boardStrip/attBoard.html","app/scripts/ng_js_att_tpls/boardStrip/attBoardStrip.html","app/scripts/ng_js_att_tpls/buttons/buttonDropdown.html","app/scripts/ng_js_att_tpls/colorselector/colorselector.html","app/scripts/ng_js_att_tpls/datepicker/dateFilter.html","app/scripts/ng_js_att_tpls/datepicker/dateFilterList.html","app/scripts/ng_js_att_tpls/datepicker/datepicker.html","app/scripts/ng_js_att_tpls/datepicker/datepickerPopup.html","app/scripts/ng_js_att_tpls/dividerLines/dividerLines.html","app/scripts/ng_js_att_tpls/dragdrop/fileUpload.html","app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlert.html","app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlertPrv.html","app/scripts/ng_js_att_tpls/formField/creditCardImage.html","app/scripts/ng_js_att_tpls/formField/cvcSecurityImg.html","app/scripts/ng_js_att_tpls/hourpicker/hourpicker.html","app/scripts/ng_js_att_tpls/links/readMore.html","app/scripts/ng_js_att_tpls/loading/loading.html","app/scripts/ng_js_att_tpls/modal/backdrop.html","app/scripts/ng_js_att_tpls/modal/tabbedItem.html","app/scripts/ng_js_att_tpls/modal/tabbedOverlayItem.html","app/scripts/ng_js_att_tpls/modal/window.html","app/scripts/ng_js_att_tpls/pagination/pagination.html","app/scripts/ng_js_att_tpls/paneSelector/innerPane.html","app/scripts/ng_js_att_tpls/paneSelector/paneGroup.html","app/scripts/ng_js_att_tpls/paneSelector/sidePane.html","app/scripts/ng_js_att_tpls/tooltip/tooltip-popup.html","app/scripts/ng_js_att_tpls/popOvers/popOvers.html","app/scripts/ng_js_att_tpls/profileCard/addUser.html","app/scripts/ng_js_att_tpls/profileCard/profileCard.html","app/scripts/ng_js_att_tpls/progressBars/progressBars.html","app/scripts/ng_js_att_tpls/scrollbar/scrollbar.html","app/scripts/ng_js_att_tpls/search/search.html","app/scripts/ng_js_att_tpls/select/select.html","app/scripts/ng_js_att_tpls/select/textDropdown.html","app/scripts/ng_js_att_tpls/slider/maxContent.html","app/scripts/ng_js_att_tpls/slider/minContent.html","app/scripts/ng_js_att_tpls/slider/slider.html","app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdown.html","app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdownItem.html","app/scripts/ng_js_att_tpls/splitIconButton/splitIcon.html","app/scripts/ng_js_att_tpls/splitIconButton/splitIconButton.html","app/scripts/ng_js_att_tpls/splitIconButton/splitIconButtonGroup.html","app/scripts/ng_js_att_tpls/stepSlider/attStepSlider.html","app/scripts/ng_js_att_tpls/steptracker/step-tracker.html","app/scripts/ng_js_att_tpls/steptracker/step.html","app/scripts/ng_js_att_tpls/steptracker/timeline.html","app/scripts/ng_js_att_tpls/steptracker/timelineBar.html","app/scripts/ng_js_att_tpls/steptracker/timelineDot.html","app/scripts/ng_js_att_tpls/table/attTable.html","app/scripts/ng_js_att_tpls/table/attTableBody.html","app/scripts/ng_js_att_tpls/table/attTableHeader.html","app/scripts/ng_js_att_tpls/tableMessages/attTableMessage.html","app/scripts/ng_js_att_tpls/tableMessages/attUserMessage.html","app/scripts/ng_js_att_tpls/tabs/floatingTabs.html","app/scripts/ng_js_att_tpls/tabs/genericTabs.html","app/scripts/ng_js_att_tpls/tabs/menuTab.html","app/scripts/ng_js_att_tpls/tabs/parentmenuTab.html","app/scripts/ng_js_att_tpls/tabs/simplifiedTabs.html","app/scripts/ng_js_att_tpls/tabs/submenuTab.html","app/scripts/ng_js_att_tpls/tagBadges/tagBadges.html","app/scripts/ng_js_att_tpls/toggle/demoToggle.html","app/scripts/ng_js_att_tpls/typeAhead/typeAhead.html","app/scripts/ng_js_att_tpls/verticalSteptracker/vertical-step-tracker.html","app/scripts/ng_js_att_tpls/videoControls/photoControls.html","app/scripts/ng_js_att_tpls/videoControls/videoControls.html"]),angular.module("att.abs.utilities",[]).filter("unsafe",["$sce",function(a){return function(b){return a.trustAsHtml(b)}}]).filter("highlight",function(){function a(a){return a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(b,c,d){return c&&b?b.replace(new RegExp(a(c),"gi"),'<span class="'+d+'">$&</span>'):b}}).filter("attLimitTo",function(){return function(a,b,c){var d=[],e=b,f=c;return isNaN(f)&&(f=0),d=a&&!isNaN(e)?a.slice(f,f+e):a}}).filter("startsWith",function(){return"function"!=typeof String.prototype.startsWith&&(String.prototype.startsWith=function(a){return 0===this.indexOf(a)}),function(a,b){if(void 0===b||""===b)return a;var c=[];return angular.forEach(a,function(a){a.title.toLowerCase().startsWith(b.toLowerCase())&&c.push(a)}),c}}).directive("attInputDeny",[function(){return{restrict:"A",require:"ngModel",link:function(a,b,c,d){var e=null;c.$observe("attInputDeny",function(a){a&&(e=new RegExp(a,"g"))}),b.bind("input",function(){var b=d.$viewValue&&d.$viewValue.replace(e,"");b!==d.$viewValue&&(d.$setViewValue(b),d.$render(),a.$apply())})}}}]).directive("attAccessibilityClick",[function(){return{restrict:"A",link:function(a,b,c){var d=[];c.$observe("attAccessibilityClick",function(a){a&&(d=a.split(","))}),b.bind("keydown",function(a){var c=function(){var b=!1;return a.keyCode||(a.which?a.keyCode=a.which:a.charCode&&(a.keyCode=a.charCode)),a.keyCode&&d.indexOf(a.keyCode.toString())>-1&&(b=!0),b};d.length>0&&c()&&(b[0].click(),a.preventDefault())})}}}]).directive("attElementFocus",[function(){return{restrict:"A",link:function(a,b,c){a.$watch(c.attElementFocus,function(a){a&&b[0].focus()})}}}]).directive("focusOn",["$timeout",function(a){var b=function(a){if(!a.focusOn&&""!==a.focusOn)throw"FocusOnCondition missing attribute to evaluate"};return{restrict:"A",link:function(c,d,e){b(e),c.$watch(e.focusOn,function(b){b&&a(function(){d[0].focus()})})}}}]).constant("whenScrollEndsConstants",{threshold:100,width:0,height:0}).directive("whenScrollEnds",function(a,b){return{restrict:"A",link:function(c,d,e){var f=parseInt(e.threshold,10)||a.threshold;return e.axis&&""!==e.axis?void("x"===e.axis?(visibleWidth=parseInt(e.width,10)||a.width,d.css("width")&&(visibleWidth=d.css("width").split("px")[0]),d[0].addEventListener("scroll",function(){var a=d.prop("scrollWidth");void 0===a&&(a=1);var b=a-visibleWidth;b-d[0].scrollLeft<=f&&c.$apply(e.whenScrollEnds)})):"y"===e.axis&&(visibleHeight=parseInt(e.height,10)||a.height,d.css("width")&&(visibleHeight=d.css("height").split("px")[0]),d[0].addEventListener("scroll",function(){var a=d.prop("scrollHeight");void 0===a&&(a=1);var b=a-visibleHeight;b-d[0].scrollTop<=f&&c.$apply(e.whenScrollEnds)}))):void b.warn("axis attribute must be defined for whenScrollEnds.")}}}).directive("validImei",function(){return{restrict:"A",require:"ngModel",link:function(a,b,c,d){d.$parsers.unshift(function(b){if(b){if(a.valid=!1,isNaN(b)||15!==b.length)a.valid=!1;else{for(var c=0,e=[],f=0;15>f;f++)e[f]=parseInt(b.substring(f,f+1),10),f%2!==0&&(e[f]=parseInt(2*e[f],10)),e[f]>9&&(e[f]=parseInt(e[f]%10,10)+parseInt(e[f]/10,10)),c+=parseInt(e[f],10);c%10===0?a.valid=!0:a.valid=!1}d.$setValidity("invalidImei",a.valid)}return a.valid?b:void 0})}}}).directive("togglePassword",function(){return{restrict:"A",transclude:!1,link:function(a,b,c,d){b.bind("click",function(){var a=c.togglePassword;b[0].innerHTML="Show"===b[0].innerHTML?"Hide":"Show";var d=angular.element(document.querySelector("#"+a))[0].type;angular.element(document.querySelector("#"+a))[0].type="password"===d?"text":"password"})}}}).factory("events",function(){var a=function(a){a.stopPropagation?a.stopPropagation():a.returnValue=!1},b=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1};return{stopPropagation:a,preventDefault:b}}).factory("$documentBind",["$document","$timeout",function(a,b){var c=function(c,d,e){e.$watch(c,function(c){b(function(){c?a.bind("click",d):a.unbind("click",d)})})},d=function(c,d,e,f,g,h){g?(h||(h=0),f.$watch(d,function(d,f){d!==f&&b(function(){d?a.bind(c,e):a.unbind(c,e)},h)})):f.$watch(d,function(b,d){b!==d&&(b?a.bind(c,e):a.unbind(c,e))})};return{click:c,event:d}}]).factory("DOMHelper",function(){function a(a){var b=angular.element(a),c=parseInt(b.attr("tabindex"),10)>=0?!0:!1,d=b[0].tagName.toUpperCase();return c||"A"===d||"INPUT"===d||"TEXTAREA"===d?!(b[0].disabled||b[0].readOnly):!1}function b(a){return 1==a.nodeType&&"SCRIPT"!=a.nodeName&&"STYLE"!=a.nodeName}function c(d){var d=d||document.getElementsByTagName("body")[0];if(b(d)&&a(d))return d;if(!d.hasChildNodes())return void 0;for(var e=d.firstChild;e;){var f=c(e);if(f)return f;e=e.nextSibling}}var d=function(a){var b=a;return a.hasOwnProperty("length")&&(b=a[0]),c(b)};return{firstTabableElement:d}}).factory("keymap",function(){return{KEY:{TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,COMMAND:91},MAP:{91:"COMMAND",8:"BACKSPACE",9:"TAB",13:"ENTER",16:"SHIFT",17:"CTRL",18:"ALT",19:"PAUSEBREAK",20:"CAPSLOCK",27:"ESC",32:"SPACE",33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT",38:"UP",39:"RIGHT",40:"DOWN",43:"+",44:"PRINTSCREEN",45:"INSERT",46:"DELETE",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NUMLOCK",145:"SCROLLLOCK",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},isControl:function(a){var b=a.keyCode;switch(b){case this.KEY.COMMAND:case this.KEY.SHIFT:case this.KEY.CTRL:case this.KEY.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.keyCode?a.keyCode:a,a>=112&&123>=a},isVerticalMovement:function(a){return~[this.KEY.UP,this.KEY.DOWN].indexOf(a)},isHorizontalMovement:function(a){return~[this.KEY.LEFT,this.KEY.RIGHT,this.KEY.BACKSPACE,this.KEY.DELETE].indexOf(a)},isAllowedKey:function(a){return~[this.KEY.SPACE,this.KEY.ESC,this.KEY.ENTER].indexOf(a)||this.isHorizontalMovement(a)||this.isVerticalMovement(a)}}}).factory("keyMapAc",function(){return{keys:{32:" ",33:"!",34:'"',35:"#",36:"$",37:"%",38:"&",39:"'",40:"(",41:")",42:"*",43:"+",44:",",45:"-",46:".",47:"/",58:":",59:";",60:"<",61:"=",62:">",63:"?",64:"@",91:"[",92:"\\",93:"]",94:"^",95:"_",96:"`",123:"{",124:"|",125:"}",126:"~"},keyRange:{startNum:"48",endNum:"57",startSmallLetters:"97",endSmallLetters:"122",startCapitalLetters:"65",endCapitalLetters:"90"},allowedKeys:{TAB:8,BACKSPACE:9,DELETE:16}}}).factory("$attElementDetach",function(){var a=function(a){a&&a.parentNode&&a.parentNode.removeChild(a)};return a}).factory("$ieVersion",function(){var ie=null,loadIEVersion=function(){var isIE10=eval("/*@cc_on!@*/false")&&10===document.documentMode;if(isIE10)return 10;var v=3,div=document.createElement("div"),all=div.getElementsByTagName("i");do div.innerHTML="<!--[if gt IE "+ ++v+"]><i></i><![endif]-->";while(all[0]);return v>4?v:void 0};return function(){return null===ie&&(ie=loadIEVersion()),ie}}),function(){String.prototype.toSnakeCase=function(){return this.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})};var a=function(a,b){a=a||"",b=!isNaN(b)&&b||0;for(var c="",d=0;b>d;d++)c+=a;return c},b=function(b,c,d,e){return b=b||"",c=!isNaN(c)&&c||0,d=d||"",c>b.length?e?a(d,c-b.length)+b:b+a(d,c-b.length):b};String.prototype.lPad=function(a,c){return b(this,a,c,!0)},String.prototype.rPad=function(a,c){return b(this,a,c,!1)},Array.prototype.indexOf||(Array.prototype.indexOf=function(a){for(var b=0;b<this.length;b++)if(this[b]===a)return b;return-1})}(),angular.module("att.abs.position",[]).factory("$position",["$document","$window",function(a,b){function c(a,c){return a.currentStyle?a.currentStyle[c]:b.getComputedStyle?b.getComputedStyle(a)[c]:a.style[c]}function d(a){return"static"===(c(a,"position")||"static")}var e=function(b){for(var c=a[0],e=b.offsetParent||c;e&&e!==c&&d(e);)e=e.offsetParent;return e||c};return{position:function(b){var c=this.offset(b),d={top:0,left:0},f=e(b[0]);return f!==a[0]&&(d=this.offset(angular.element(f)),d.top+=f.clientTop-f.scrollTop,d.left+=f.clientLeft-f.scrollLeft),{width:b.prop("offsetWidth"),height:b.prop("offsetHeight"),top:c.top-d.top,left:c.left-d.left}},offset:function(c){var d=c[0].getBoundingClientRect();return{width:c.prop("offsetWidth"),height:c.prop("offsetHeight"),top:d.top+(b.pageYOffset||a[0].body.scrollTop||a[0].documentElement.scrollTop),left:d.left+(b.pageXOffset||a[0].body.scrollLeft||a[0].documentElement.scrollLeft)}}}}]).factory("$isElement",[function(){var a=function(b,c,d){return b[0]===c[0]?!0:b[0]===d[0]?!1:a(b.parent()[0]&&b.parent()||c,c,d)};return a}]).directive("attPosition",["$position",function(a){return{restrict:"A",link:function(b,c,d){b.$watchCollection(function(){return a.position(c)},function(a){b[d.attPosition]=a})}}}]),(window._gsQueue||(window._gsQueue=[])).push(function(){"use strict";var a=document.documentElement,b=window,c=function(c,d){var e="x"===d?"Width":"Height",f="scroll"+e,g="client"+e,h=document.body;return c===b||c===a||c===h?Math.max(a[f],h[f])-(b["inner"+e]||Math.max(a[g],h[g])):c[f]-c["offset"+e]},d=window._gsDefine.plugin({propName:"scrollTo",API:2,version:"1.7.3",init:function(a,d,e){return this._wdw=a===b,this._target=a,this._tween=e,"object"!=typeof d&&(d={y:d}),this._autoKill=d.autoKill!==!1,this.x=this.xPrev=this.getX(),this.y=this.yPrev=this.getY(),null!=d.x?(this._addTween(this,"x",this.x,"max"===d.x?c(a,"x"):d.x,"scrollTo_x",!0),this._overwriteProps.push("scrollTo_x")):this.skipX=!0,null!=d.y?(this._addTween(this,"y",this.y,"max"===d.y?c(a,"y"):d.y,"scrollTo_y",!0),this._overwriteProps.push("scrollTo_y")):this.skipY=!0,!0},set:function(a){this._super.setRatio.call(this,a);var d=this._wdw||!this.skipX?this.getX():this.xPrev,e=this._wdw||!this.skipY?this.getY():this.yPrev,f=e-this.yPrev,g=d-this.xPrev;this._autoKill&&(!this.skipX&&(g>7||-7>g)&&d<c(this._target,"x")&&(this.skipX=!0),!this.skipY&&(f>7||-7>f)&&e<c(this._target,"y")&&(this.skipY=!0),this.skipX&&this.skipY&&this._tween.kill()),this._wdw?b.scrollTo(this.skipX?d:this.x,this.skipY?e:this.y):(this.skipY||(this._target.scrollTop=this.y),this.skipX||(this._target.scrollLeft=this.x)),this.xPrev=this.x,this.yPrev=this.y}}),e=d.prototype;d.max=c,e.getX=function(){return this._wdw?null!=b.pageXOffset?b.pageXOffset:null!=a.scrollLeft?a.scrollLeft:document.body.scrollLeft:this._target.scrollLeft},e.getY=function(){return this._wdw?null!=b.pageYOffset?b.pageYOffset:null!=a.scrollTop?a.scrollTop:document.body.scrollTop:this._target.scrollTop},e._kill=function(a){return a.scrollTo_x&&(this.skipX=!0),a.scrollTo_y&&(this.skipY=!0),this._super._kill.call(this,a)}}),window._gsDefine&&window._gsQueue.pop()(),(window._gsQueue||(window._gsQueue=[])).push(function(){"use strict";window._gsDefine("TweenMax",["core.Animation","core.SimpleTimeline","TweenLite"],function(a,b,c){var d=[].slice,e=function(a,b,d){c.call(this,a,b,d),this._cycle=0,this._yoyo=this.vars.yoyo===!0,this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._dirty=!0,this.render=e.prototype.render},f=1e-10,g=c._internals,h=g.isSelector,i=g.isArray,j=e.prototype=c.to({},.1,{}),k=[];e.version="1.12.1",j.constructor=e,j.kill()._gc=!1,e.killTweensOf=e.killDelayedCallsTo=c.killTweensOf,e.getTweensOf=c.getTweensOf,e.lagSmoothing=c.lagSmoothing,e.ticker=c.ticker,e.render=c.render,j.invalidate=function(){return this._yoyo=this.vars.yoyo===!0,this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._uncache(!0),c.prototype.invalidate.call(this)},j.updateTo=function(a,b){var d,e=this.ratio;b&&this._startTime<this._timeline._time&&(this._startTime=this._timeline._time,this._uncache(!1),this._gc?this._enabled(!0,!1):this._timeline.insert(this,this._startTime-this._delay));for(d in a)this.vars[d]=a[d];if(this._initted)if(b)this._initted=!1;else if(this._gc&&this._enabled(!0,!1),this._notifyPluginsOfEnabled&&this._firstPT&&c._onPluginEvent("_onDisable",this),this._time/this._duration>.998){var f=this._time;this.render(0,!0,!1),this._initted=!1,this.render(f,!0,!1)}else if(this._time>0){this._initted=!1,this._init();for(var g,h=1/(1-e),i=this._firstPT;i;)g=i.s+i.c,i.c*=h,i.s=g-i.c,i=i._next}return this},j.render=function(a,b,c){this._initted||0===this._duration&&this.vars.repeat&&this.invalidate();var d,e,h,i,j,l,m,n,o=this._dirty?this.totalDuration():this._totalDuration,p=this._time,q=this._totalTime,r=this._cycle,s=this._duration,t=this._rawPrevTime;if(a>=o?(this._totalTime=o,this._cycle=this._repeat,this._yoyo&&0!==(1&this._cycle)?(this._time=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0):(this._time=s,this.ratio=this._ease._calcEnd?this._ease.getRatio(1):1),this._reversed||(d=!0,e="onComplete"),0===s&&(this._initted||!this.vars.lazy||c)&&(this._startTime===this._timeline._duration&&(a=0),(0===a||0>t||t===f)&&t!==a&&(c=!0,t>f&&(e="onReverseComplete")),this._rawPrevTime=n=!b||a||t===a?a:f)):1e-7>a?(this._totalTime=this._time=this._cycle=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0,(0!==q||0===s&&t>0&&t!==f)&&(e="onReverseComplete",d=this._reversed),0>a?(this._active=!1,0===s&&(this._initted||!this.vars.lazy||c)&&(t>=0&&(c=!0),this._rawPrevTime=n=!b||a||t===a?a:f)):this._initted||(c=!0)):(this._totalTime=this._time=a,0!==this._repeat&&(i=s+this._repeatDelay,this._cycle=this._totalTime/i>>0,0!==this._cycle&&this._cycle===this._totalTime/i&&this._cycle--,this._time=this._totalTime-this._cycle*i,this._yoyo&&0!==(1&this._cycle)&&(this._time=s-this._time),this._time>s?this._time=s:this._time<0&&(this._time=0)),this._easeType?(j=this._time/s,l=this._easeType,m=this._easePower,(1===l||3===l&&j>=.5)&&(j=1-j),3===l&&(j*=2),1===m?j*=j:2===m?j*=j*j:3===m?j*=j*j*j:4===m&&(j*=j*j*j*j),1===l?this.ratio=1-j:2===l?this.ratio=j:this._time/s<.5?this.ratio=j/2:this.ratio=1-j/2):this.ratio=this._ease.getRatio(this._time/s)),p===this._time&&!c&&r===this._cycle)return void(q!==this._totalTime&&this._onUpdate&&(b||this._onUpdate.apply(this.vars.onUpdateScope||this,this.vars.onUpdateParams||k)));if(!this._initted){if(this._init(),!this._initted||this._gc)return;if(!c&&this._firstPT&&(this.vars.lazy!==!1&&this._duration||this.vars.lazy&&!this._duration))return this._time=p,this._totalTime=q,this._rawPrevTime=t,this._cycle=r,g.lazyTweens.push(this),void(this._lazy=a);this._time&&!d?this.ratio=this._ease.getRatio(this._time/s):d&&this._ease._calcEnd&&(this.ratio=this._ease.getRatio(0===this._time?0:1))}for(this._lazy!==!1&&(this._lazy=!1),this._active||!this._paused&&this._time!==p&&a>=0&&(this._active=!0),0===q&&(2===this._initted&&a>0&&this._init(),this._startAt&&(a>=0?this._startAt.render(a,b,c):e||(e="_dummyGS")),this.vars.onStart&&(0!==this._totalTime||0===s)&&(b||this.vars.onStart.apply(this.vars.onStartScope||this,this.vars.onStartParams||k))),h=this._firstPT;h;)h.f?h.t[h.p](h.c*this.ratio+h.s):h.t[h.p]=h.c*this.ratio+h.s,h=h._next;this._onUpdate&&(0>a&&this._startAt&&this._startTime&&this._startAt.render(a,b,c),b||(this._totalTime!==q||d)&&this._onUpdate.apply(this.vars.onUpdateScope||this,this.vars.onUpdateParams||k)),this._cycle!==r&&(b||this._gc||this.vars.onRepeat&&this.vars.onRepeat.apply(this.vars.onRepeatScope||this,this.vars.onRepeatParams||k)),e&&(this._gc||(0>a&&this._startAt&&!this._onUpdate&&this._startTime&&this._startAt.render(a,b,c),d&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!b&&this.vars[e]&&this.vars[e].apply(this.vars[e+"Scope"]||this,this.vars[e+"Params"]||k),0===s&&this._rawPrevTime===f&&n!==f&&(this._rawPrevTime=0)))},e.to=function(a,b,c){return new e(a,b,c)},e.from=function(a,b,c){return c.runBackwards=!0,c.immediateRender=0!=c.immediateRender,new e(a,b,c)},e.fromTo=function(a,b,c,d){return d.startAt=c,d.immediateRender=0!=d.immediateRender&&0!=c.immediateRender,new e(a,b,d)},e.staggerTo=e.allTo=function(a,b,f,g,j,l,m){g=g||0;var n,o,p,q,r=f.delay||0,s=[],t=function(){f.onComplete&&f.onComplete.apply(f.onCompleteScope||this,arguments),j.apply(m||this,l||k)};for(i(a)||("string"==typeof a&&(a=c.selector(a)||a),h(a)&&(a=d.call(a,0))),n=a.length,p=0;n>p;p++){o={};for(q in f)o[q]=f[q];o.delay=r,p===n-1&&j&&(o.onComplete=t),s[p]=new e(a[p],b,o),r+=g}return s},e.staggerFrom=e.allFrom=function(a,b,c,d,f,g,h){return c.runBackwards=!0,c.immediateRender=0!=c.immediateRender,e.staggerTo(a,b,c,d,f,g,h)},e.staggerFromTo=e.allFromTo=function(a,b,c,d,f,g,h,i){return d.startAt=c,d.immediateRender=0!=d.immediateRender&&0!=c.immediateRender,e.staggerTo(a,b,d,f,g,h,i)},e.delayedCall=function(a,b,c,d,f){return new e(b,0,{delay:a,onComplete:b,onCompleteParams:c,onCompleteScope:d,onReverseComplete:b,onReverseCompleteParams:c,onReverseCompleteScope:d,immediateRender:!1,useFrames:f,overwrite:0})},e.set=function(a,b){return new e(a,0,b)},e.isTweening=function(a){return c.getTweensOf(a,!0).length>0};var l=function(a,b){for(var d=[],e=0,f=a._first;f;)f instanceof c?d[e++]=f:(b&&(d[e++]=f),d=d.concat(l(f,b)),e=d.length),f=f._next;return d},m=e.getAllTweens=function(b){return l(a._rootTimeline,b).concat(l(a._rootFramesTimeline,b))};e.killAll=function(a,c,d,e){null==c&&(c=!0),null==d&&(d=!0);var f,g,h,i=m(0!=e),j=i.length,k=c&&d&&e;for(h=0;j>h;h++)g=i[h],(k||g instanceof b||(f=g.target===g.vars.onComplete)&&d||c&&!f)&&(a?g.totalTime(g._reversed?0:g.totalDuration()):g._enabled(!1,!1))},e.killChildTweensOf=function(a,b){if(null!=a){var f,j,k,l,m,n=g.tweenLookup;if("string"==typeof a&&(a=c.selector(a)||a),h(a)&&(a=d.call(a,0)),i(a))for(l=a.length;--l>-1;)e.killChildTweensOf(a[l],b);else{f=[];for(k in n)for(j=n[k].target.parentNode;j;)j===a&&(f=f.concat(n[k].tweens)),j=j.parentNode;for(m=f.length,l=0;m>l;l++)b&&f[l].totalTime(f[l].totalDuration()),f[l]._enabled(!1,!1)}}};var n=function(a,c,d,e){c=c!==!1,d=d!==!1,e=e!==!1;for(var f,g,h=m(e),i=c&&d&&e,j=h.length;--j>-1;)g=h[j],(i||g instanceof b||(f=g.target===g.vars.onComplete)&&d||c&&!f)&&g.paused(a)};return e.pauseAll=function(a,b,c){n(!0,a,b,c)},e.resumeAll=function(a,b,c){n(!1,a,b,c)},e.globalTimeScale=function(b){var d=a._rootTimeline,e=c.ticker.time;return arguments.length?(b=b||f,d._startTime=e-(e-d._startTime)*d._timeScale/b,d=a._rootFramesTimeline,e=c.ticker.frame,d._startTime=e-(e-d._startTime)*d._timeScale/b,d._timeScale=a._rootTimeline._timeScale=b,b):d._timeScale},j.progress=function(a){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&0!==(1&this._cycle)?1-a:a)+this._cycle*(this._duration+this._repeatDelay),!1):this._time/this.duration()},j.totalProgress=function(a){return arguments.length?this.totalTime(this.totalDuration()*a,!1):this._totalTime/this.totalDuration()},j.time=function(a,b){return arguments.length?(this._dirty&&this.totalDuration(),a>this._duration&&(a=this._duration),this._yoyo&&0!==(1&this._cycle)?a=this._duration-a+this._cycle*(this._duration+this._repeatDelay):0!==this._repeat&&(a+=this._cycle*(this._duration+this._repeatDelay)),this.totalTime(a,b)):this._time},j.duration=function(b){return arguments.length?a.prototype.duration.call(this,b):this._duration},j.totalDuration=function(a){return arguments.length?-1===this._repeat?this:this.duration((a-this._repeat*this._repeatDelay)/(this._repeat+1)):(this._dirty&&(this._totalDuration=-1===this._repeat?999999999999:this._duration*(this._repeat+1)+this._repeatDelay*this._repeat,this._dirty=!1),this._totalDuration)},j.repeat=function(a){return arguments.length?(this._repeat=a,this._uncache(!0)):this._repeat},j.repeatDelay=function(a){return arguments.length?(this._repeatDelay=a,this._uncache(!0)):this._repeatDelay},j.yoyo=function(a){return arguments.length?(this._yoyo=a,this):this._yoyo},e},!0),window._gsDefine("TimelineLite",["core.Animation","core.SimpleTimeline","TweenLite"],function(a,b,c){var d=function(a){b.call(this,a),this._labels={},this.autoRemoveChildren=this.vars.autoRemoveChildren===!0,this.smoothChildTiming=this.vars.smoothChildTiming===!0,this._sortChildren=!0,this._onUpdate=this.vars.onUpdate;var c,d,e=this.vars;for(d in e)c=e[d],g(c)&&-1!==c.join("").indexOf("{self}")&&(e[d]=this._swapSelfInParams(c));g(e.tweens)&&this.add(e.tweens,0,e.align,e.stagger)},e=1e-10,f=c._internals.isSelector,g=c._internals.isArray,h=[],i=window._gsDefine.globals,j=function(a){var b,c={};for(b in a)c[b]=a[b];return c},k=function(a,b,c,d){a._timeline.pause(a._startTime),b&&b.apply(d||a._timeline,c||h)},l=h.slice,m=d.prototype=new b;return d.version="1.12.1",m.constructor=d,m.kill()._gc=!1,m.to=function(a,b,d,e){var f=d.repeat&&i.TweenMax||c;return b?this.add(new f(a,b,d),e):this.set(a,d,e)},m.from=function(a,b,d,e){return this.add((d.repeat&&i.TweenMax||c).from(a,b,d),e)},m.fromTo=function(a,b,d,e,f){var g=e.repeat&&i.TweenMax||c;return b?this.add(g.fromTo(a,b,d,e),f):this.set(a,e,f)},m.staggerTo=function(a,b,e,g,h,i,k,m){var n,o=new d({onComplete:i,onCompleteParams:k,onCompleteScope:m,smoothChildTiming:this.smoothChildTiming});for("string"==typeof a&&(a=c.selector(a)||a),f(a)&&(a=l.call(a,0)),g=g||0,n=0;n<a.length;n++)e.startAt&&(e.startAt=j(e.startAt)),o.to(a[n],b,j(e),n*g);return this.add(o,h)},m.staggerFrom=function(a,b,c,d,e,f,g,h){return c.immediateRender=0!=c.immediateRender,c.runBackwards=!0,this.staggerTo(a,b,c,d,e,f,g,h)},m.staggerFromTo=function(a,b,c,d,e,f,g,h,i){return d.startAt=c,d.immediateRender=0!=d.immediateRender&&0!=c.immediateRender,this.staggerTo(a,b,d,e,f,g,h,i)},m.call=function(a,b,d,e){return this.add(c.delayedCall(0,a,b,d),e)},m.set=function(a,b,d){return d=this._parseTimeOrLabel(d,0,!0),null==b.immediateRender&&(b.immediateRender=d===this._time&&!this._paused),this.add(new c(a,0,b),d)},d.exportRoot=function(a,b){a=a||{},null==a.smoothChildTiming&&(a.smoothChildTiming=!0);var e,f,g=new d(a),h=g._timeline;for(null==b&&(b=!0),h._remove(g,!0),g._startTime=0,g._rawPrevTime=g._time=g._totalTime=h._time,e=h._first;e;)f=e._next,b&&e instanceof c&&e.target===e.vars.onComplete||g.add(e,e._startTime-e._delay),e=f;return h.add(g,0),g},m.add=function(e,f,h,i){var j,k,l,m,n,o;if("number"!=typeof f&&(f=this._parseTimeOrLabel(f,0,!0,e)),!(e instanceof a)){if(e instanceof Array||e&&e.push&&g(e)){for(h=h||"normal",i=i||0,j=f,k=e.length,l=0;k>l;l++)g(m=e[l])&&(m=new d({tweens:m})),this.add(m,j),"string"!=typeof m&&"function"!=typeof m&&("sequence"===h?j=m._startTime+m.totalDuration()/m._timeScale:"start"===h&&(m._startTime-=m.delay())),j+=i;return this._uncache(!0)}if("string"==typeof e)return this.addLabel(e,f);if("function"!=typeof e)throw"Cannot add "+e+" into the timeline; it is not a tween, timeline, function, or string.";e=c.delayedCall(0,e)}if(b.prototype.add.call(this,e,f),(this._gc||this._time===this._duration)&&!this._paused&&this._duration<this.duration())for(n=this,o=n.rawTime()>e._startTime;n._timeline;)o&&n._timeline.smoothChildTiming?n.totalTime(n._totalTime,!0):n._gc&&n._enabled(!0,!1),n=n._timeline;return this},m.remove=function(b){if(b instanceof a)return this._remove(b,!1);if(b instanceof Array||b&&b.push&&g(b)){for(var c=b.length;--c>-1;)this.remove(b[c]);return this}return"string"==typeof b?this.removeLabel(b):this.kill(null,b)},m._remove=function(a,c){b.prototype._remove.call(this,a,c);var d=this._last;return d?this._time>d._startTime+d._totalDuration/d._timeScale&&(this._time=this.duration(),this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},m.append=function(a,b){return this.add(a,this._parseTimeOrLabel(null,b,!0,a))},m.insert=m.insertMultiple=function(a,b,c,d){return this.add(a,b||0,c,d)},m.appendMultiple=function(a,b,c,d){return this.add(a,this._parseTimeOrLabel(null,b,!0,a),c,d)},m.addLabel=function(a,b){return this._labels[a]=this._parseTimeOrLabel(b),this},m.addPause=function(a,b,c,d){return this.call(k,["{self}",b,c,d],this,a)},m.removeLabel=function(a){return delete this._labels[a],this},m.getLabelTime=function(a){return null!=this._labels[a]?this._labels[a]:-1},m._parseTimeOrLabel=function(b,c,d,e){var f;if(e instanceof a&&e.timeline===this)this.remove(e);else if(e&&(e instanceof Array||e.push&&g(e)))for(f=e.length;--f>-1;)e[f]instanceof a&&e[f].timeline===this&&this.remove(e[f]);if("string"==typeof c)return this._parseTimeOrLabel(c,d&&"number"==typeof b&&null==this._labels[c]?b-this.duration():0,d);if(c=c||0,"string"!=typeof b||!isNaN(b)&&null==this._labels[b])null==b&&(b=this.duration());else{if(f=b.indexOf("="),-1===f)return null==this._labels[b]?d?this._labels[b]=this.duration()+c:c:this._labels[b]+c;c=parseInt(b.charAt(f-1)+"1",10)*Number(b.substr(f+1)),b=f>1?this._parseTimeOrLabel(b.substr(0,f-1),0,d):this.duration()}return Number(b)+c},m.seek=function(a,b){return this.totalTime("number"==typeof a?a:this._parseTimeOrLabel(a),b!==!1)},m.stop=function(){return this.paused(!0)},m.gotoAndPlay=function(a,b){return this.play(a,b)},m.gotoAndStop=function(a,b){return this.pause(a,b)},m.render=function(a,b,c){this._gc&&this._enabled(!0,!1);var d,f,g,i,j,k=this._dirty?this.totalDuration():this._totalDuration,l=this._time,m=this._startTime,n=this._timeScale,o=this._paused;if(a>=k?(this._totalTime=this._time=k,this._reversed||this._hasPausedChild()||(f=!0,i="onComplete",0===this._duration&&(0===a||this._rawPrevTime<0||this._rawPrevTime===e)&&this._rawPrevTime!==a&&this._first&&(j=!0,this._rawPrevTime>e&&(i="onReverseComplete"))),this._rawPrevTime=this._duration||!b||a||this._rawPrevTime===a?a:e,a=k+1e-4):1e-7>a?(this._totalTime=this._time=0,(0!==l||0===this._duration&&this._rawPrevTime!==e&&(this._rawPrevTime>0||0>a&&this._rawPrevTime>=0))&&(i="onReverseComplete",f=this._reversed),0>a?(this._active=!1,0===this._duration&&this._rawPrevTime>=0&&this._first&&(j=!0),this._rawPrevTime=a):(this._rawPrevTime=this._duration||!b||a||this._rawPrevTime===a?a:e,a=0,this._initted||(j=!0))):this._totalTime=this._time=this._rawPrevTime=a,this._time!==l&&this._first||c||j){if(this._initted||(this._initted=!0),this._active||!this._paused&&this._time!==l&&a>0&&(this._active=!0),0===l&&this.vars.onStart&&0!==this._time&&(b||this.vars.onStart.apply(this.vars.onStartScope||this,this.vars.onStartParams||h)),this._time>=l)for(d=this._first;d&&(g=d._next,!this._paused||o);)(d._active||d._startTime<=this._time&&!d._paused&&!d._gc)&&(d._reversed?d.render((d._dirty?d.totalDuration():d._totalDuration)-(a-d._startTime)*d._timeScale,b,c):d.render((a-d._startTime)*d._timeScale,b,c)),d=g;else for(d=this._last;d&&(g=d._prev,!this._paused||o);)(d._active||d._startTime<=l&&!d._paused&&!d._gc)&&(d._reversed?d.render((d._dirty?d.totalDuration():d._totalDuration)-(a-d._startTime)*d._timeScale,b,c):d.render((a-d._startTime)*d._timeScale,b,c)),
+d=g;this._onUpdate&&(b||this._onUpdate.apply(this.vars.onUpdateScope||this,this.vars.onUpdateParams||h)),i&&(this._gc||(m===this._startTime||n!==this._timeScale)&&(0===this._time||k>=this.totalDuration())&&(f&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!b&&this.vars[i]&&this.vars[i].apply(this.vars[i+"Scope"]||this,this.vars[i+"Params"]||h)))}},m._hasPausedChild=function(){for(var a=this._first;a;){if(a._paused||a instanceof d&&a._hasPausedChild())return!0;a=a._next}return!1},m.getChildren=function(a,b,d,e){e=e||-9999999999;for(var f=[],g=this._first,h=0;g;)g._startTime<e||(g instanceof c?b!==!1&&(f[h++]=g):(d!==!1&&(f[h++]=g),a!==!1&&(f=f.concat(g.getChildren(!0,b,d)),h=f.length))),g=g._next;return f},m.getTweensOf=function(a,b){var d,e,f=this._gc,g=[],h=0;for(f&&this._enabled(!0,!0),d=c.getTweensOf(a),e=d.length;--e>-1;)(d[e].timeline===this||b&&this._contains(d[e]))&&(g[h++]=d[e]);return f&&this._enabled(!1,!0),g},m._contains=function(a){for(var b=a.timeline;b;){if(b===this)return!0;b=b.timeline}return!1},m.shiftChildren=function(a,b,c){c=c||0;for(var d,e=this._first,f=this._labels;e;)e._startTime>=c&&(e._startTime+=a),e=e._next;if(b)for(d in f)f[d]>=c&&(f[d]+=a);return this._uncache(!0)},m._kill=function(a,b){if(!a&&!b)return this._enabled(!1,!1);for(var c=b?this.getTweensOf(b):this.getChildren(!0,!0,!1),d=c.length,e=!1;--d>-1;)c[d]._kill(a,b)&&(e=!0);return e},m.clear=function(a){var b=this.getChildren(!1,!0,!0),c=b.length;for(this._time=this._totalTime=0;--c>-1;)b[c]._enabled(!1,!1);return a!==!1&&(this._labels={}),this._uncache(!0)},m.invalidate=function(){for(var a=this._first;a;)a.invalidate(),a=a._next;return this},m._enabled=function(a,c){if(a===this._gc)for(var d=this._first;d;)d._enabled(a,!0),d=d._next;return b.prototype._enabled.call(this,a,c)},m.duration=function(a){return arguments.length?(0!==this.duration()&&0!==a&&this.timeScale(this._duration/a),this):(this._dirty&&this.totalDuration(),this._duration)},m.totalDuration=function(a){if(!arguments.length){if(this._dirty){for(var b,c,d=0,e=this._last,f=999999999999;e;)b=e._prev,e._dirty&&e.totalDuration(),e._startTime>f&&this._sortChildren&&!e._paused?this.add(e,e._startTime-e._delay):f=e._startTime,e._startTime<0&&!e._paused&&(d-=e._startTime,this._timeline.smoothChildTiming&&(this._startTime+=e._startTime/this._timeScale),this.shiftChildren(-e._startTime,!1,-9999999999),f=0),c=e._startTime+e._totalDuration/e._timeScale,c>d&&(d=c),e=b;this._duration=this._totalDuration=d,this._dirty=!1}return this._totalDuration}return 0!==this.totalDuration()&&0!==a&&this.timeScale(this._totalDuration/a),this},m.usesFrames=function(){for(var b=this._timeline;b._timeline;)b=b._timeline;return b===a._rootFramesTimeline},m.rawTime=function(){return this._paused?this._totalTime:(this._timeline.rawTime()-this._startTime)*this._timeScale},d},!0),window._gsDefine("TimelineMax",["TimelineLite","TweenLite","easing.Ease"],function(a,b,c){var d=function(b){a.call(this,b),this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._cycle=0,this._yoyo=this.vars.yoyo===!0,this._dirty=!0},e=1e-10,f=[],g=new c(null,null,1,0),h=d.prototype=new a;return h.constructor=d,h.kill()._gc=!1,d.version="1.12.1",h.invalidate=function(){return this._yoyo=this.vars.yoyo===!0,this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._uncache(!0),a.prototype.invalidate.call(this)},h.addCallback=function(a,c,d,e){return this.add(b.delayedCall(0,a,d,e),c)},h.removeCallback=function(a,b){if(a)if(null==b)this._kill(null,a);else for(var c=this.getTweensOf(a,!1),d=c.length,e=this._parseTimeOrLabel(b);--d>-1;)c[d]._startTime===e&&c[d]._enabled(!1,!1);return this},h.tweenTo=function(a,c){c=c||{};var d,e,h,i={ease:g,overwrite:c.delay?2:1,useFrames:this.usesFrames(),immediateRender:!1};for(e in c)i[e]=c[e];return i.time=this._parseTimeOrLabel(a),d=Math.abs(Number(i.time)-this._time)/this._timeScale||.001,h=new b(this,d,i),i.onStart=function(){h.target.paused(!0),h.vars.time!==h.target.time()&&d===h.duration()&&h.duration(Math.abs(h.vars.time-h.target.time())/h.target._timeScale),c.onStart&&c.onStart.apply(c.onStartScope||h,c.onStartParams||f)},h},h.tweenFromTo=function(a,b,c){c=c||{},a=this._parseTimeOrLabel(a),c.startAt={onComplete:this.seek,onCompleteParams:[a],onCompleteScope:this},c.immediateRender=c.immediateRender!==!1;var d=this.tweenTo(b,c);return d.duration(Math.abs(d.vars.time-a)/this._timeScale||.001)},h.render=function(a,b,c){this._gc&&this._enabled(!0,!1);var d,g,h,i,j,k,l=this._dirty?this.totalDuration():this._totalDuration,m=this._duration,n=this._time,o=this._totalTime,p=this._startTime,q=this._timeScale,r=this._rawPrevTime,s=this._paused,t=this._cycle;if(a>=l?(this._locked||(this._totalTime=l,this._cycle=this._repeat),this._reversed||this._hasPausedChild()||(g=!0,i="onComplete",0===this._duration&&(0===a||0>r||r===e)&&r!==a&&this._first&&(j=!0,r>e&&(i="onReverseComplete"))),this._rawPrevTime=this._duration||!b||a||this._rawPrevTime===a?a:e,this._yoyo&&0!==(1&this._cycle)?this._time=a=0:(this._time=m,a=m+1e-4)):1e-7>a?(this._locked||(this._totalTime=this._cycle=0),this._time=0,(0!==n||0===m&&r!==e&&(r>0||0>a&&r>=0)&&!this._locked)&&(i="onReverseComplete",g=this._reversed),0>a?(this._active=!1,0===m&&r>=0&&this._first&&(j=!0),this._rawPrevTime=a):(this._rawPrevTime=m||!b||a||this._rawPrevTime===a?a:e,a=0,this._initted||(j=!0))):(0===m&&0>r&&(j=!0),this._time=this._rawPrevTime=a,this._locked||(this._totalTime=a,0!==this._repeat&&(k=m+this._repeatDelay,this._cycle=this._totalTime/k>>0,0!==this._cycle&&this._cycle===this._totalTime/k&&this._cycle--,this._time=this._totalTime-this._cycle*k,this._yoyo&&0!==(1&this._cycle)&&(this._time=m-this._time),this._time>m?(this._time=m,a=m+1e-4):this._time<0?this._time=a=0:a=this._time))),this._cycle!==t&&!this._locked){var u=this._yoyo&&0!==(1&t),v=u===(this._yoyo&&0!==(1&this._cycle)),w=this._totalTime,x=this._cycle,y=this._rawPrevTime,z=this._time;if(this._totalTime=t*m,this._cycle<t?u=!u:this._totalTime+=m,this._time=n,this._rawPrevTime=0===m?r-1e-4:r,this._cycle=t,this._locked=!0,n=u?0:m,this.render(n,b,0===m),b||this._gc||this.vars.onRepeat&&this.vars.onRepeat.apply(this.vars.onRepeatScope||this,this.vars.onRepeatParams||f),v&&(n=u?m+1e-4:-1e-4,this.render(n,!0,!1)),this._locked=!1,this._paused&&!s)return;this._time=z,this._totalTime=w,this._cycle=x,this._rawPrevTime=y}if(!(this._time!==n&&this._first||c||j))return void(o!==this._totalTime&&this._onUpdate&&(b||this._onUpdate.apply(this.vars.onUpdateScope||this,this.vars.onUpdateParams||f)));if(this._initted||(this._initted=!0),this._active||!this._paused&&this._totalTime!==o&&a>0&&(this._active=!0),0===o&&this.vars.onStart&&0!==this._totalTime&&(b||this.vars.onStart.apply(this.vars.onStartScope||this,this.vars.onStartParams||f)),this._time>=n)for(d=this._first;d&&(h=d._next,!this._paused||s);)(d._active||d._startTime<=this._time&&!d._paused&&!d._gc)&&(d._reversed?d.render((d._dirty?d.totalDuration():d._totalDuration)-(a-d._startTime)*d._timeScale,b,c):d.render((a-d._startTime)*d._timeScale,b,c)),d=h;else for(d=this._last;d&&(h=d._prev,!this._paused||s);)(d._active||d._startTime<=n&&!d._paused&&!d._gc)&&(d._reversed?d.render((d._dirty?d.totalDuration():d._totalDuration)-(a-d._startTime)*d._timeScale,b,c):d.render((a-d._startTime)*d._timeScale,b,c)),d=h;this._onUpdate&&(b||this._onUpdate.apply(this.vars.onUpdateScope||this,this.vars.onUpdateParams||f)),i&&(this._locked||this._gc||(p===this._startTime||q!==this._timeScale)&&(0===this._time||l>=this.totalDuration())&&(g&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!b&&this.vars[i]&&this.vars[i].apply(this.vars[i+"Scope"]||this,this.vars[i+"Params"]||f)))},h.getActive=function(a,b,c){null==a&&(a=!0),null==b&&(b=!0),null==c&&(c=!1);var d,e,f=[],g=this.getChildren(a,b,c),h=0,i=g.length;for(d=0;i>d;d++)e=g[d],e.isActive()&&(f[h++]=e);return f},h.getLabelAfter=function(a){a||0!==a&&(a=this._time);var b,c=this.getLabelsArray(),d=c.length;for(b=0;d>b;b++)if(c[b].time>a)return c[b].name;return null},h.getLabelBefore=function(a){null==a&&(a=this._time);for(var b=this.getLabelsArray(),c=b.length;--c>-1;)if(b[c].time<a)return b[c].name;return null},h.getLabelsArray=function(){var a,b=[],c=0;for(a in this._labels)b[c++]={time:this._labels[a],name:a};return b.sort(function(a,b){return a.time-b.time}),b},h.progress=function(a){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&0!==(1&this._cycle)?1-a:a)+this._cycle*(this._duration+this._repeatDelay),!1):this._time/this.duration()},h.totalProgress=function(a){return arguments.length?this.totalTime(this.totalDuration()*a,!1):this._totalTime/this.totalDuration()},h.totalDuration=function(b){return arguments.length?-1===this._repeat?this:this.duration((b-this._repeat*this._repeatDelay)/(this._repeat+1)):(this._dirty&&(a.prototype.totalDuration.call(this),this._totalDuration=-1===this._repeat?999999999999:this._duration*(this._repeat+1)+this._repeatDelay*this._repeat),this._totalDuration)},h.time=function(a,b){return arguments.length?(this._dirty&&this.totalDuration(),a>this._duration&&(a=this._duration),this._yoyo&&0!==(1&this._cycle)?a=this._duration-a+this._cycle*(this._duration+this._repeatDelay):0!==this._repeat&&(a+=this._cycle*(this._duration+this._repeatDelay)),this.totalTime(a,b)):this._time},h.repeat=function(a){return arguments.length?(this._repeat=a,this._uncache(!0)):this._repeat},h.repeatDelay=function(a){return arguments.length?(this._repeatDelay=a,this._uncache(!0)):this._repeatDelay},h.yoyo=function(a){return arguments.length?(this._yoyo=a,this):this._yoyo},h.currentLabel=function(a){return arguments.length?this.seek(a,!0):this.getLabelBefore(this._time+1e-8)},d},!0),function(){var a=180/Math.PI,b=[],c=[],d=[],e={},f=function(a,b,c,d){this.a=a,this.b=b,this.c=c,this.d=d,this.da=d-a,this.ca=c-a,this.ba=b-a},g=",x,y,z,left,top,right,bottom,marginTop,marginLeft,marginRight,marginBottom,paddingLeft,paddingTop,paddingRight,paddingBottom,backgroundPosition,backgroundPosition_y,",h=function(a,b,c,d){var e={a:a},f={},g={},h={c:d},i=(a+b)/2,j=(b+c)/2,k=(c+d)/2,l=(i+j)/2,m=(j+k)/2,n=(m-l)/8;return e.b=i+(a-i)/4,f.b=l+n,e.c=f.a=(e.b+f.b)/2,f.c=g.a=(l+m)/2,g.b=m-n,h.b=k+(d-k)/4,g.c=h.a=(g.b+h.b)/2,[e,f,g,h]},i=function(a,e,f,g,i){var j,k,l,m,n,o,p,q,r,s,t,u,v,w=a.length-1,x=0,y=a[0].a;for(j=0;w>j;j++)n=a[x],k=n.a,l=n.d,m=a[x+1].d,i?(t=b[j],u=c[j],v=(u+t)*e*.25/(g?.5:d[j]||.5),o=l-(l-k)*(g?.5*e:0!==t?v/t:0),p=l+(m-l)*(g?.5*e:0!==u?v/u:0),q=l-(o+((p-o)*(3*t/(t+u)+.5)/4||0))):(o=l-(l-k)*e*.5,p=l+(m-l)*e*.5,q=l-(o+p)/2),o+=q,p+=q,n.c=r=o,0!==j?n.b=y:n.b=y=n.a+.6*(n.c-n.a),n.da=l-k,n.ca=r-k,n.ba=y-k,f?(s=h(k,y,r,l),a.splice(x,1,s[0],s[1],s[2],s[3]),x+=4):x++,y=p;n=a[x],n.b=y,n.c=y+.4*(n.d-y),n.da=n.d-n.a,n.ca=n.c-n.a,n.ba=y-n.a,f&&(s=h(n.a,y,n.c,n.d),a.splice(x,1,s[0],s[1],s[2],s[3]))},j=function(a,d,e,g){var h,i,j,k,l,m,n=[];if(g)for(a=[g].concat(a),i=a.length;--i>-1;)"string"==typeof(m=a[i][d])&&"="===m.charAt(1)&&(a[i][d]=g[d]+Number(m.charAt(0)+m.substr(2)));if(h=a.length-2,0>h)return n[0]=new f(a[0][d],0,0,a[-1>h?0:1][d]),n;for(i=0;h>i;i++)j=a[i][d],k=a[i+1][d],n[i]=new f(j,0,0,k),e&&(l=a[i+2][d],b[i]=(b[i]||0)+(k-j)*(k-j),c[i]=(c[i]||0)+(l-k)*(l-k));return n[i]=new f(a[i][d],0,0,a[i+1][d]),n},k=function(a,f,h,k,l,m){var n,o,p,q,r,s,t,u,v={},w=[],x=m||a[0];l="string"==typeof l?","+l+",":g,null==f&&(f=1);for(o in a[0])w.push(o);if(a.length>1){for(u=a[a.length-1],t=!0,n=w.length;--n>-1;)if(o=w[n],Math.abs(x[o]-u[o])>.05){t=!1;break}t&&(a=a.concat(),m&&a.unshift(m),a.push(a[1]),m=a[a.length-3])}for(b.length=c.length=d.length=0,n=w.length;--n>-1;)o=w[n],e[o]=-1!==l.indexOf(","+o+","),v[o]=j(a,o,e[o],m);for(n=b.length;--n>-1;)b[n]=Math.sqrt(b[n]),c[n]=Math.sqrt(c[n]);if(!k){for(n=w.length;--n>-1;)if(e[o])for(p=v[w[n]],s=p.length-1,q=0;s>q;q++)r=p[q+1].da/c[q]+p[q].da/b[q],d[q]=(d[q]||0)+r*r;for(n=d.length;--n>-1;)d[n]=Math.sqrt(d[n])}for(n=w.length,q=h?4:1;--n>-1;)o=w[n],p=v[o],i(p,f,h,k,e[o]),t&&(p.splice(0,q),p.splice(p.length-q,q));return v},l=function(a,b,c){b=b||"soft";var d,e,g,h,i,j,k,l,m,n,o,p={},q="cubic"===b?3:2,r="soft"===b,s=[];if(r&&c&&(a=[c].concat(a)),null==a||a.length<q+1)throw"invalid Bezier data";for(m in a[0])s.push(m);for(j=s.length;--j>-1;){for(m=s[j],p[m]=i=[],n=0,l=a.length,k=0;l>k;k++)d=null==c?a[k][m]:"string"==typeof(o=a[k][m])&&"="===o.charAt(1)?c[m]+Number(o.charAt(0)+o.substr(2)):Number(o),r&&k>1&&l-1>k&&(i[n++]=(d+i[n-2])/2),i[n++]=d;for(l=n-q+1,n=0,k=0;l>k;k+=q)d=i[k],e=i[k+1],g=i[k+2],h=2===q?0:i[k+3],i[n++]=o=3===q?new f(d,e,g,h):new f(d,(2*e+d)/3,(2*e+g)/3,g);i.length=n}return p},m=function(a,b,c){for(var d,e,f,g,h,i,j,k,l,m,n,o=1/c,p=a.length;--p>-1;)for(m=a[p],f=m.a,g=m.d-f,h=m.c-f,i=m.b-f,d=e=0,k=1;c>=k;k++)j=o*k,l=1-j,d=e-(e=(j*j*g+3*l*(j*h+l*i))*j),n=p*c+k-1,b[n]=(b[n]||0)+d*d},n=function(a,b){b=b>>0||6;var c,d,e,f,g=[],h=[],i=0,j=0,k=b-1,l=[],n=[];for(c in a)m(a[c],g,b);for(e=g.length,d=0;e>d;d++)i+=Math.sqrt(g[d]),f=d%b,n[f]=i,f===k&&(j+=i,f=d/b>>0,l[f]=n,h[f]=j,i=0,n=[]);return{length:j,lengths:h,segments:l}},o=window._gsDefine.plugin({propName:"bezier",priority:-1,version:"1.3.2",API:2,global:!0,init:function(a,b,c){this._target=a,b instanceof Array&&(b={values:b}),this._func={},this._round={},this._props=[],this._timeRes=null==b.timeResolution?6:parseInt(b.timeResolution,10);var d,e,f,g,h,i=b.values||[],j={},m=i[0],o=b.autoRotate||c.vars.orientToBezier;this._autoRotate=o?o instanceof Array?o:[["x","y","rotation",o===!0?0:Number(o)||0]]:null;for(d in m)this._props.push(d);for(f=this._props.length;--f>-1;)d=this._props[f],this._overwriteProps.push(d),e=this._func[d]="function"==typeof a[d],j[d]=e?a[d.indexOf("set")||"function"!=typeof a["get"+d.substr(3)]?d:"get"+d.substr(3)]():parseFloat(a[d]),h||j[d]!==i[0][d]&&(h=j);if(this._beziers="cubic"!==b.type&&"quadratic"!==b.type&&"soft"!==b.type?k(i,isNaN(b.curviness)?1:b.curviness,!1,"thruBasic"===b.type,b.correlate,h):l(i,b.type,j),this._segCount=this._beziers[d].length,this._timeRes){var p=n(this._beziers,this._timeRes);this._length=p.length,this._lengths=p.lengths,this._segments=p.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length}if(o=this._autoRotate)for(this._initialRotations=[],o[0]instanceof Array||(this._autoRotate=o=[o]),f=o.length;--f>-1;){for(g=0;3>g;g++)d=o[f][g],this._func[d]="function"==typeof a[d]?a[d.indexOf("set")||"function"!=typeof a["get"+d.substr(3)]?d:"get"+d.substr(3)]:!1;d=o[f][2],this._initialRotations[f]=this._func[d]?this._func[d].call(this._target):this._target[d]}return this._startRatio=c.vars.runBackwards?1:0,!0},set:function(b){var c,d,e,f,g,h,i,j,k,l,m=this._segCount,n=this._func,o=this._target,p=b!==this._startRatio;if(this._timeRes){if(k=this._lengths,l=this._curSeg,b*=this._length,e=this._li,b>this._l2&&m-1>e){for(j=m-1;j>e&&(this._l2=k[++e])<=b;);this._l1=k[e-1],this._li=e,this._curSeg=l=this._segments[e],this._s2=l[this._s1=this._si=0]}else if(b<this._l1&&e>0){for(;e>0&&(this._l1=k[--e])>=b;);0===e&&b<this._l1?this._l1=0:e++,this._l2=k[e],this._li=e,this._curSeg=l=this._segments[e],this._s1=l[(this._si=l.length-1)-1]||0,this._s2=l[this._si]}if(c=e,b-=this._l1,e=this._si,b>this._s2&&e<l.length-1){for(j=l.length-1;j>e&&(this._s2=l[++e])<=b;);this._s1=l[e-1],this._si=e}else if(b<this._s1&&e>0){for(;e>0&&(this._s1=l[--e])>=b;);0===e&&b<this._s1?this._s1=0:e++,this._s2=l[e],this._si=e}h=(e+(b-this._s1)/(this._s2-this._s1))*this._prec}else c=0>b?0:b>=1?m-1:m*b>>0,h=(b-c*(1/m))*m;for(d=1-h,e=this._props.length;--e>-1;)f=this._props[e],g=this._beziers[f][c],i=(h*h*g.da+3*d*(h*g.ca+d*g.ba))*h+g.a,this._round[f]&&(i=Math.round(i)),n[f]?o[f](i):o[f]=i;if(this._autoRotate){var q,r,s,t,u,v,w,x=this._autoRotate;for(e=x.length;--e>-1;)f=x[e][2],v=x[e][3]||0,w=x[e][4]===!0?1:a,g=this._beziers[x[e][0]],q=this._beziers[x[e][1]],g&&q&&(g=g[c],q=q[c],r=g.a+(g.b-g.a)*h,t=g.b+(g.c-g.b)*h,r+=(t-r)*h,t+=(g.c+(g.d-g.c)*h-t)*h,s=q.a+(q.b-q.a)*h,u=q.b+(q.c-q.b)*h,s+=(u-s)*h,u+=(q.c+(q.d-q.c)*h-u)*h,i=p?Math.atan2(u-s,t-r)*w+v:this._initialRotations[e],n[f]?o[f](i):o[f]=i)}}}),p=o.prototype;o.bezierThrough=k,o.cubicToQuadratic=h,o._autoCSS=!0,o.quadraticToCubic=function(a,b,c){return new f(a,(2*b+a)/3,(2*b+c)/3,c)},o._cssRegister=function(){var a=window._gsDefine.globals.CSSPlugin;if(a){var b=a._internals,c=b._parseToProxy,d=b._setPluginRatio,e=b.CSSPropTween;b._registerComplexSpecialProp("bezier",{parser:function(a,b,f,g,h,i){b instanceof Array&&(b={values:b}),i=new o;var j,k,l,m=b.values,n=m.length-1,p=[],q={};if(0>n)return h;for(j=0;n>=j;j++)l=c(a,m[j],g,h,i,n!==j),p[j]=l.end;for(k in b)q[k]=b[k];return q.values=p,h=new e(a,"bezier",0,0,l.pt,2),h.data=l,h.plugin=i,h.setRatio=d,0===q.autoRotate&&(q.autoRotate=!0),!q.autoRotate||q.autoRotate instanceof Array||(j=q.autoRotate===!0?0:Number(q.autoRotate),q.autoRotate=null!=l.end.left?[["left","top","rotation",j,!1]]:null!=l.end.x?[["x","y","rotation",j,!1]]:!1),q.autoRotate&&(g._transform||g._enableTransforms(!1),l.autoRotate=g._target._gsTransform),i._onInitTween(l.proxy,q,g._tween),h}})}},p._roundProps=function(a,b){for(var c=this._overwriteProps,d=c.length;--d>-1;)(a[c[d]]||a.bezier||a.bezierThrough)&&(this._round[c[d]]=b)},p._kill=function(a){var b,c,d=this._props;for(b in this._beziers)if(b in a)for(delete this._beziers[b],delete this._func[b],c=d.length;--c>-1;)d[c]===b&&d.splice(c,1);return this._super._kill.call(this,a)}}(),window._gsDefine("plugins.CSSPlugin",["plugins.TweenPlugin","TweenLite"],function(a,b){var c,d,e,f,g=function(){a.call(this,"css"),this._overwriteProps.length=0,this.setRatio=g.prototype.setRatio},h={},i=g.prototype=new a("css");i.constructor=g,g.version="1.12.1",g.API=2,g.defaultTransformPerspective=0,g.defaultSkewType="compensated",i="px",g.suffixMap={top:i,right:i,bottom:i,left:i,width:i,height:i,fontSize:i,padding:i,margin:i,perspective:i,lineHeight:""};var j,k,l,m,n,o,p=/(?:\d|\-\d|\.\d|\-\.\d)+/g,q=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,r=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,s=/[^\d\-\.]/g,t=/(?:\d|\-|\+|=|#|\.)*/g,u=/opacity *= *([^)]*)/i,v=/opacity:([^;]*)/i,w=/alpha\(opacity *=.+?\)/i,x=/^(rgb|hsl)/,y=/([A-Z])/g,z=/-([a-z])/gi,A=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,B=function(a,b){return b.toUpperCase()},C=/(?:Left|Right|Width)/i,D=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,E=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,F=/,(?=[^\)]*(?:\(|$))/gi,G=Math.PI/180,H=180/Math.PI,I={},J=document,K=J.createElement("div"),L=J.createElement("img"),M=g._internals={_specialProps:h},N=navigator.userAgent,O=function(){var a,b=N.indexOf("Android"),c=J.createElement("div");return l=-1!==N.indexOf("Safari")&&-1===N.indexOf("Chrome")&&(-1===b||Number(N.substr(b+8,1))>3),n=l&&Number(N.substr(N.indexOf("Version/")+8,1))<6,m=-1!==N.indexOf("Firefox"),/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(N)&&(o=parseFloat(RegExp.$1)),c.innerHTML="<a style='top:1px;opacity:.55;'>a</a>",a=c.getElementsByTagName("a")[0],a?/^0.55/.test(a.style.opacity):!1}(),P=function(a){return u.test("string"==typeof a?a:(a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100:1},Q=function(a){window.console},R="",S="",T=function(a,b){b=b||K;var c,d,e=b.style;if(void 0!==e[a])return a;for(a=a.charAt(0).toUpperCase()+a.substr(1),c=["O","Moz","ms","Ms","Webkit"],d=5;--d>-1&&void 0===e[c[d]+a];);return d>=0?(S=3===d?"ms":c[d],R="-"+S.toLowerCase()+"-",S+a):null},U=J.defaultView?J.defaultView.getComputedStyle:function(){},V=g.getStyle=function(a,b,c,d,e){var f;return O||"opacity"!==b?(!d&&a.style[b]?f=a.style[b]:(c=c||U(a))?f=c[b]||c.getPropertyValue(b)||c.getPropertyValue(b.replace(y,"-$1").toLowerCase()):a.currentStyle&&(f=a.currentStyle[b]),null==e||f&&"none"!==f&&"auto"!==f&&"auto auto"!==f?f:e):P(a)},W=M.convertToPixels=function(a,c,d,e,f){if("px"===e||!e)return d;if("auto"===e||!d)return 0;var h,i,j,k=C.test(c),l=a,m=K.style,n=0>d;if(n&&(d=-d),"%"===e&&-1!==c.indexOf("border"))h=d/100*(k?a.clientWidth:a.clientHeight);else{if(m.cssText="border:0 solid red;position:"+V(a,"position")+";line-height:0;","%"!==e&&l.appendChild)m[k?"borderLeftWidth":"borderTopWidth"]=d+e;else{if(l=a.parentNode||J.body,i=l._gsCache,j=b.ticker.frame,i&&k&&i.time===j)return i.width*d/100;m[k?"width":"height"]=d+e}l.appendChild(K),h=parseFloat(K[k?"offsetWidth":"offsetHeight"]),l.removeChild(K),k&&"%"===e&&g.cacheWidths!==!1&&(i=l._gsCache=l._gsCache||{},i.time=j,i.width=h/d*100),0!==h||f||(h=W(a,c,d,e,!0))}return n?-h:h},X=M.calculateOffset=function(a,b,c){if("absolute"!==V(a,"position",c))return 0;var d="left"===b?"Left":"Top",e=V(a,"margin"+d,c);return a["offset"+d]-(W(a,b,parseFloat(e),e.replace(t,""))||0)},Y=function(a,b){var c,d,e={};if(b=b||U(a,null))if(c=b.length)for(;--c>-1;)e[b[c].replace(z,B)]=b.getPropertyValue(b[c]);else for(c in b)e[c]=b[c];else if(b=a.currentStyle||a.style)for(c in b)"string"==typeof c&&void 0===e[c]&&(e[c.replace(z,B)]=b[c]);return O||(e.opacity=P(a)),d=ya(a,b,!1),e.rotation=d.rotation,e.skewX=d.skewX,e.scaleX=d.scaleX,e.scaleY=d.scaleY,e.x=d.x,e.y=d.y,wa&&(e.z=d.z,e.rotationX=d.rotationX,e.rotationY=d.rotationY,e.scaleZ=d.scaleZ),e.filters&&delete e.filters,e},Z=function(a,b,c,d,e){var f,g,h,i={},j=a.style;for(g in c)"cssText"!==g&&"length"!==g&&isNaN(g)&&(b[g]!==(f=c[g])||e&&e[g])&&-1===g.indexOf("Origin")&&("number"==typeof f||"string"==typeof f)&&(i[g]="auto"!==f||"left"!==g&&"top"!==g?""!==f&&"auto"!==f&&"none"!==f||"string"!=typeof b[g]||""===b[g].replace(s,"")?f:0:X(a,g),void 0!==j[g]&&(h=new la(j,g,j[g],h)));if(d)for(g in d)"className"!==g&&(i[g]=d[g]);return{difs:i,firstMPT:h}},$={width:["Left","Right"],height:["Top","Bottom"]},_=["marginLeft","marginRight","marginTop","marginBottom"],aa=function(a,b,c){var d=parseFloat("width"===b?a.offsetWidth:a.offsetHeight),e=$[b],f=e.length;for(c=c||U(a,null);--f>-1;)d-=parseFloat(V(a,"padding"+e[f],c,!0))||0,d-=parseFloat(V(a,"border"+e[f]+"Width",c,!0))||0;return d},ba=function(a,b){(null==a||""===a||"auto"===a||"auto auto"===a)&&(a="0 0");var c=a.split(" "),d=-1!==a.indexOf("left")?"0%":-1!==a.indexOf("right")?"100%":c[0],e=-1!==a.indexOf("top")?"0%":-1!==a.indexOf("bottom")?"100%":c[1];return null==e?e="0":"center"===e&&(e="50%"),("center"===d||isNaN(parseFloat(d))&&-1===(d+"").indexOf("="))&&(d="50%"),b&&(b.oxp=-1!==d.indexOf("%"),b.oyp=-1!==e.indexOf("%"),b.oxr="="===d.charAt(1),b.oyr="="===e.charAt(1),b.ox=parseFloat(d.replace(s,"")),b.oy=parseFloat(e.replace(s,""))),d+" "+e+(c.length>2?" "+c[2]:"")},ca=function(a,b){return"string"==typeof a&&"="===a.charAt(1)?parseInt(a.charAt(0)+"1",10)*parseFloat(a.substr(2)):parseFloat(a)-parseFloat(b)},da=function(a,b){return null==a?b:"string"==typeof a&&"="===a.charAt(1)?parseInt(a.charAt(0)+"1",10)*Number(a.substr(2))+b:parseFloat(a)},ea=function(a,b,c,d){var e,f,g,h,i=1e-6;return null==a?h=b:"number"==typeof a?h=a:(e=360,f=a.split("_"),g=Number(f[0].replace(s,""))*(-1===a.indexOf("rad")?1:H)-("="===a.charAt(1)?0:b),f.length&&(d&&(d[c]=b+g),-1!==a.indexOf("short")&&(g%=e,g!==g%(e/2)&&(g=0>g?g+e:g-e)),-1!==a.indexOf("_cw")&&0>g?g=(g+9999999999*e)%e-(g/e|0)*e:-1!==a.indexOf("ccw")&&g>0&&(g=(g-9999999999*e)%e-(g/e|0)*e)),h=b+g),i>h&&h>-i&&(h=0),h},fa={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],fuchsia:[255,0,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]},ga=function(a,b,c){return a=0>a?a+1:a>1?a-1:a,255*(1>6*a?b+(c-b)*a*6:.5>a?c:2>3*a?b+(c-b)*(2/3-a)*6:b)+.5|0},ha=function(a){var b,c,d,e,f,g;return a&&""!==a?"number"==typeof a?[a>>16,a>>8&255,255&a]:(","===a.charAt(a.length-1)&&(a=a.substr(0,a.length-1)),fa[a]?fa[a]:"#"===a.charAt(0)?(4===a.length&&(b=a.charAt(1),c=a.charAt(2),d=a.charAt(3),a="#"+b+b+c+c+d+d),a=parseInt(a.substr(1),16),[a>>16,a>>8&255,255&a]):"hsl"===a.substr(0,3)?(a=a.match(p),e=Number(a[0])%360/360,f=Number(a[1])/100,g=Number(a[2])/100,c=.5>=g?g*(f+1):g+f-g*f,b=2*g-c,a.length>3&&(a[3]=Number(a[3])),a[0]=ga(e+1/3,b,c),a[1]=ga(e,b,c),a[2]=ga(e-1/3,b,c),a):(a=a.match(p)||fa.transparent,a[0]=Number(a[0]),a[1]=Number(a[1]),a[2]=Number(a[2]),a.length>3&&(a[3]=Number(a[3])),a)):fa.black},ia="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#.+?\\b";for(i in fa)ia+="|"+i+"\\b";ia=new RegExp(ia+")","gi");var ja=function(a,b,c,d){if(null==a)return function(a){return a};var e,f=b?(a.match(ia)||[""])[0]:"",g=a.split(f).join("").match(r)||[],h=a.substr(0,a.indexOf(g[0])),i=")"===a.charAt(a.length-1)?")":"",j=-1!==a.indexOf(" ")?" ":",",k=g.length,l=k>0?g[0].replace(p,""):"";return k?e=b?function(a){var b,m,n,o;if("number"==typeof a)a+=l;else if(d&&F.test(a)){for(o=a.replace(F,"|").split("|"),n=0;n<o.length;n++)o[n]=e(o[n]);return o.join(",")}if(b=(a.match(ia)||[f])[0],m=a.split(b).join("").match(r)||[],n=m.length,k>n--)for(;++n<k;)m[n]=c?m[(n-1)/2|0]:g[n];return h+m.join(j)+j+b+i+(-1!==a.indexOf("inset")?" inset":"")}:function(a){var b,f,m;if("number"==typeof a)a+=l;else if(d&&F.test(a)){for(f=a.replace(F,"|").split("|"),m=0;m<f.length;m++)f[m]=e(f[m]);return f.join(",")}if(b=a.match(r)||[],m=b.length,k>m--)for(;++m<k;)b[m]=c?b[(m-1)/2|0]:g[m];return h+b.join(j)+i}:function(a){return a}},ka=function(a){return a=a.split(","),function(b,c,d,e,f,g,h){var i,j=(c+"").split(" ");for(h={},i=0;4>i;i++)h[a[i]]=j[i]=j[i]||j[(i-1)/2>>0];return e.parse(b,h,f,g)}},la=(M._setPluginRatio=function(a){this.plugin.setRatio(a);for(var b,c,d,e,f=this.data,g=f.proxy,h=f.firstMPT,i=1e-6;h;)b=g[h.v],h.r?b=Math.round(b):i>b&&b>-i&&(b=0),h.t[h.p]=b,h=h._next;if(f.autoRotate&&(f.autoRotate.rotation=g.rotation),1===a)for(h=f.firstMPT;h;){if(c=h.t,c.type){if(1===c.type){for(e=c.xs0+c.s+c.xs1,d=1;d<c.l;d++)e+=c["xn"+d]+c["xs"+(d+1)];c.e=e}}else c.e=c.s+c.xs0;h=h._next}},function(a,b,c,d,e){this.t=a,this.p=b,this.v=c,this.r=e,d&&(d._prev=this,this._next=d)}),ma=(M._parseToProxy=function(a,b,c,d,e,f){var g,h,i,j,k,l=d,m={},n={},o=c._transform,p=I;for(c._transform=null,I=b,d=k=c.parse(a,b,d,e),I=p,f&&(c._transform=o,l&&(l._prev=null,l._prev&&(l._prev._next=null)));d&&d!==l;){if(d.type<=1&&(h=d.p,n[h]=d.s+d.c,m[h]=d.s,f||(j=new la(d,"s",h,j,d.r),d.c=0),1===d.type))for(g=d.l;--g>0;)i="xn"+g,h=d.p+"_"+i,n[h]=d.data[i],m[h]=d[i],f||(j=new la(d,i,h,j,d.rxp[i]));d=d._next}return{proxy:m,end:n,firstMPT:j,pt:k}},M.CSSPropTween=function(a,b,d,e,g,h,i,j,k,l,m){this.t=a,this.p=b,this.s=d,this.c=e,this.n=i||b,a instanceof ma||f.push(this.n),this.r=j,this.type=h||0,k&&(this.pr=k,c=!0),this.b=void 0===l?d:l,this.e=void 0===m?d+e:m,g&&(this._next=g,g._prev=this)}),na=g.parseComplex=function(a,b,c,d,e,f,g,h,i,k){c=c||f||"",g=new ma(a,b,0,0,g,k?2:1,null,!1,h,c,d),d+="";var l,m,n,o,r,s,t,u,v,w,y,z,A=c.split(", ").join(",").split(" "),B=d.split(", ").join(",").split(" "),C=A.length,D=j!==!1;for((-1!==d.indexOf(",")||-1!==c.indexOf(","))&&(A=A.join(" ").replace(F,", ").split(" "),B=B.join(" ").replace(F,", ").split(" "),C=A.length),C!==B.length&&(A=(f||"").split(" "),C=A.length),g.plugin=i,g.setRatio=k,l=0;C>l;l++)if(o=A[l],r=B[l],u=parseFloat(o),u||0===u)g.appendXtra("",u,ca(r,u),r.replace(q,""),D&&-1!==r.indexOf("px"),!0);else if(e&&("#"===o.charAt(0)||fa[o]||x.test(o)))z=","===r.charAt(r.length-1)?"),":")",o=ha(o),r=ha(r),v=o.length+r.length>6,v&&!O&&0===r[3]?(g["xs"+g.l]+=g.l?" transparent":"transparent",g.e=g.e.split(B[l]).join("transparent")):(O||(v=!1),g.appendXtra(v?"rgba(":"rgb(",o[0],r[0]-o[0],",",!0,!0).appendXtra("",o[1],r[1]-o[1],",",!0).appendXtra("",o[2],r[2]-o[2],v?",":z,!0),v&&(o=o.length<4?1:o[3],g.appendXtra("",o,(r.length<4?1:r[3])-o,z,!1)));else if(s=o.match(p)){if(t=r.match(q),!t||t.length!==s.length)return g;for(n=0,m=0;m<s.length;m++)y=s[m],w=o.indexOf(y,n),g.appendXtra(o.substr(n,w-n),Number(y),ca(t[m],y),"",D&&"px"===o.substr(w+y.length,2),0===m),n=w+y.length;g["xs"+g.l]+=o.substr(n)}else g["xs"+g.l]+=g.l?" "+o:o;if(-1!==d.indexOf("=")&&g.data){for(z=g.xs0+g.data.s,l=1;l<g.l;l++)z+=g["xs"+l]+g.data["xn"+l];g.e=z+g["xs"+l]}return g.l||(g.type=-1,g.xs0=g.e),g.xfirst||g},oa=9;for(i=ma.prototype,i.l=i.pr=0;--oa>0;)i["xn"+oa]=0,i["xs"+oa]="";i.xs0="",i._next=i._prev=i.xfirst=i.data=i.plugin=i.setRatio=i.rxp=null,i.appendXtra=function(a,b,c,d,e,f){var g=this,h=g.l;return g["xs"+h]+=f&&h?" "+a:a||"",c||0===h||g.plugin?(g.l++,g.type=g.setRatio?2:1,g["xs"+g.l]=d||"",h>0?(g.data["xn"+h]=b+c,g.rxp["xn"+h]=e,g["xn"+h]=b,g.plugin||(g.xfirst=new ma(g,"xn"+h,b,c,g.xfirst||g,0,g.n,e,g.pr),g.xfirst.xs0=0),g):(g.data={s:b+c},g.rxp={},g.s=b,g.c=c,g.r=e,g)):(g["xs"+h]+=b+(d||""),g)};var pa=function(a,b){b=b||{},this.p=b.prefix?T(a)||a:a,h[a]=h[this.p]=this,this.format=b.formatter||ja(b.defaultValue,b.color,b.collapsible,b.multi),b.parser&&(this.parse=b.parser),this.clrs=b.color,this.multi=b.multi,this.keyword=b.keyword,this.dflt=b.defaultValue,this.pr=b.priority||0},qa=M._registerComplexSpecialProp=function(a,b,c){"object"!=typeof b&&(b={parser:c});var d,e,f=a.split(","),g=b.defaultValue;for(c=c||[g],d=0;d<f.length;d++)b.prefix=0===d&&b.prefix,b.defaultValue=c[d]||g,e=new pa(f[d],b)},ra=function(a){if(!h[a]){var b=a.charAt(0).toUpperCase()+a.substr(1)+"Plugin";qa(a,{parser:function(a,c,d,e,f,g,i){var j=(window.GreenSockGlobals||window).com.greensock.plugins[b];return j?(j._cssRegister(),h[d].parse(a,c,d,e,f,g,i)):(Q("Error: "+b+" js file not loaded."),f)}})}};i=pa.prototype,i.parseComplex=function(a,b,c,d,e,f){var g,h,i,j,k,l,m=this.keyword;if(this.multi&&(F.test(c)||F.test(b)?(h=b.replace(F,"|").split("|"),i=c.replace(F,"|").split("|")):m&&(h=[b],i=[c])),i){for(j=i.length>h.length?i.length:h.length,g=0;j>g;g++)b=h[g]=h[g]||this.dflt,c=i[g]=i[g]||this.dflt,m&&(k=b.indexOf(m),l=c.indexOf(m),k!==l&&(c=-1===l?i:h,c[g]+=" "+m));b=h.join(", "),c=i.join(", ")}return na(a,this.p,b,c,this.clrs,this.dflt,d,this.pr,e,f)},i.parse=function(a,b,c,d,f,g,h){return this.parseComplex(a.style,this.format(V(a,this.p,e,!1,this.dflt)),this.format(b),f,g)},g.registerSpecialProp=function(a,b,c){qa(a,{parser:function(a,d,e,f,g,h,i){var j=new ma(a,e,0,0,g,2,e,!1,c);return j.plugin=h,j.setRatio=b(a,d,f._tween,e),j},priority:c})};var sa="scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective".split(","),ta=T("transform"),ua=R+"transform",va=T("transformOrigin"),wa=null!==T("perspective"),xa=M.Transform=function(){this.skewY=0},ya=M.getTransform=function(a,b,c,d){if(a._gsTransform&&c&&!d)return a._gsTransform;var e,f,h,i,j,k,l,m,n,o,p,q,r,s=c?a._gsTransform||new xa:new xa,t=s.scaleX<0,u=2e-5,v=1e5,w=179.99,x=w*G,y=wa?parseFloat(V(a,va,b,!1,"0 0 0").split(" ")[2])||s.zOrigin||0:0;for(ta?e=V(a,ua,b,!0):a.currentStyle&&(e=a.currentStyle.filter.match(D),e=e&&4===e.length?[e[0].substr(4),Number(e[2].substr(4)),Number(e[1].substr(4)),e[3].substr(4),s.x||0,s.y||0].join(","):""),f=(e||"").match(/(?:\-|\b)[\d\-\.e]+\b/gi)||[],h=f.length;--h>-1;)i=Number(f[h]),f[h]=(j=i-(i|=0))?(j*v+(0>j?-.5:.5)|0)/v+i:i;if(16===f.length){var z=f[8],A=f[9],B=f[10],C=f[12],E=f[13],F=f[14];if(s.zOrigin&&(F=-s.zOrigin,C=z*F-f[12],E=A*F-f[13],F=B*F+s.zOrigin-f[14]),!c||d||null==s.rotationX){var I,J,K,L,M,N,O,P=f[0],Q=f[1],R=f[2],S=f[3],T=f[4],U=f[5],W=f[6],X=f[7],Y=f[11],Z=Math.atan2(W,B),$=-x>Z||Z>x;s.rotationX=Z*H,Z&&(L=Math.cos(-Z),M=Math.sin(-Z),I=T*L+z*M,J=U*L+A*M,K=W*L+B*M,z=T*-M+z*L,A=U*-M+A*L,B=W*-M+B*L,Y=X*-M+Y*L,T=I,U=J,W=K),Z=Math.atan2(z,P),s.rotationY=Z*H,Z&&(N=-x>Z||Z>x,L=Math.cos(-Z),M=Math.sin(-Z),I=P*L-z*M,J=Q*L-A*M,K=R*L-B*M,A=Q*M+A*L,B=R*M+B*L,Y=S*M+Y*L,P=I,Q=J,R=K),Z=Math.atan2(Q,U),s.rotation=Z*H,Z&&(O=-x>Z||Z>x,L=Math.cos(-Z),M=Math.sin(-Z),P=P*L+T*M,J=Q*L+U*M,U=Q*-M+U*L,W=R*-M+W*L,Q=J),O&&$?s.rotation=s.rotationX=0:O&&N?s.rotation=s.rotationY=0:N&&$&&(s.rotationY=s.rotationX=0),s.scaleX=(Math.sqrt(P*P+Q*Q)*v+.5|0)/v,s.scaleY=(Math.sqrt(U*U+A*A)*v+.5|0)/v,s.scaleZ=(Math.sqrt(W*W+B*B)*v+.5|0)/v,
+s.skewX=0,s.perspective=Y?1/(0>Y?-Y:Y):0,s.x=C,s.y=E,s.z=F}}else if((!wa||d||!f.length||s.x!==f[4]||s.y!==f[5]||!s.rotationX&&!s.rotationY)&&(void 0===s.x||"none"!==V(a,"display",b))){var _=f.length>=6,aa=_?f[0]:1,ba=f[1]||0,ca=f[2]||0,da=_?f[3]:1;s.x=f[4]||0,s.y=f[5]||0,k=Math.sqrt(aa*aa+ba*ba),l=Math.sqrt(da*da+ca*ca),m=aa||ba?Math.atan2(ba,aa)*H:s.rotation||0,n=ca||da?Math.atan2(ca,da)*H+m:s.skewX||0,o=k-Math.abs(s.scaleX||0),p=l-Math.abs(s.scaleY||0),Math.abs(n)>90&&Math.abs(n)<270&&(t?(k*=-1,n+=0>=m?180:-180,m+=0>=m?180:-180):(l*=-1,n+=0>=n?180:-180)),q=(m-s.rotation)%180,r=(n-s.skewX)%180,(void 0===s.skewX||o>u||-u>o||p>u||-u>p||q>-w&&w>q&&q*v|!1||r>-w&&w>r&&r*v|!1)&&(s.scaleX=k,s.scaleY=l,s.rotation=m,s.skewX=n),wa&&(s.rotationX=s.rotationY=s.z=0,s.perspective=parseFloat(g.defaultTransformPerspective)||0,s.scaleZ=1)}s.zOrigin=y;for(h in s)s[h]<u&&s[h]>-u&&(s[h]=0);return c&&(a._gsTransform=s),s},za=function(a){var b,c,d=this.data,e=-d.rotation*G,f=e+d.skewX*G,g=1e5,h=(Math.cos(e)*d.scaleX*g|0)/g,i=(Math.sin(e)*d.scaleX*g|0)/g,j=(Math.sin(f)*-d.scaleY*g|0)/g,k=(Math.cos(f)*d.scaleY*g|0)/g,l=this.t.style,m=this.t.currentStyle;if(m){c=i,i=-j,j=-c,b=m.filter,l.filter="";var n,p,q=this.t.offsetWidth,r=this.t.offsetHeight,s="absolute"!==m.position,v="progid:DXImageTransform.Microsoft.Matrix(M11="+h+", M12="+i+", M21="+j+", M22="+k,w=d.x,x=d.y;if(null!=d.ox&&(n=(d.oxp?q*d.ox*.01:d.ox)-q/2,p=(d.oyp?r*d.oy*.01:d.oy)-r/2,w+=n-(n*h+p*i),x+=p-(n*j+p*k)),s?(n=q/2,p=r/2,v+=", Dx="+(n-(n*h+p*i)+w)+", Dy="+(p-(n*j+p*k)+x)+")"):v+=", sizingMethod='auto expand')",-1!==b.indexOf("DXImageTransform.Microsoft.Matrix(")?l.filter=b.replace(E,v):l.filter=v+" "+b,(0===a||1===a)&&1===h&&0===i&&0===j&&1===k&&(s&&-1===v.indexOf("Dx=0, Dy=0")||u.test(b)&&100!==parseFloat(RegExp.$1)||-1===b.indexOf(b.indexOf("Alpha"))&&l.removeAttribute("filter")),!s){var y,z,A,B=8>o?1:-1;for(n=d.ieOffsetX||0,p=d.ieOffsetY||0,d.ieOffsetX=Math.round((q-((0>h?-h:h)*q+(0>i?-i:i)*r))/2+w),d.ieOffsetY=Math.round((r-((0>k?-k:k)*r+(0>j?-j:j)*q))/2+x),oa=0;4>oa;oa++)z=_[oa],y=m[z],c=-1!==y.indexOf("px")?parseFloat(y):W(this.t,z,parseFloat(y),y.replace(t,""))||0,A=c!==d[z]?2>oa?-d.ieOffsetX:-d.ieOffsetY:2>oa?n-d.ieOffsetX:p-d.ieOffsetY,l[z]=(d[z]=Math.round(c-A*(0===oa||2===oa?1:B)))+"px"}}},Aa=M.set3DTransformRatio=function(a){var b,c,d,e,f,g,h,i,j,k,l,n,o,p,q,r,s,t,u,v,w,x,y,z=this.data,A=this.t.style,B=z.rotation*G,C=z.scaleX,D=z.scaleY,E=z.scaleZ,F=z.perspective;if((1===a||0===a)&&"auto"===z.force3D&&!(z.rotationY||z.rotationX||1!==E||F||z.z))return void Ba.call(this,a);if(m){var H=1e-4;H>C&&C>-H&&(C=E=2e-5),H>D&&D>-H&&(D=E=2e-5),!F||z.z||z.rotationX||z.rotationY||(F=0)}if(B||z.skewX)t=Math.cos(B),u=Math.sin(B),b=t,f=u,z.skewX&&(B-=z.skewX*G,t=Math.cos(B),u=Math.sin(B),"simple"===z.skewType&&(v=Math.tan(z.skewX*G),v=Math.sqrt(1+v*v),t*=v,u*=v)),c=-u,g=t;else{if(!(z.rotationY||z.rotationX||1!==E||F))return void(A[ta]="translate3d("+z.x+"px,"+z.y+"px,"+z.z+"px)"+(1!==C||1!==D?" scale("+C+","+D+")":""));b=g=1,c=f=0}l=1,d=e=h=i=j=k=n=o=p=0,q=F?-1/F:0,r=z.zOrigin,s=1e5,B=z.rotationY*G,B&&(t=Math.cos(B),u=Math.sin(B),j=l*-u,o=q*-u,d=b*u,h=f*u,l*=t,q*=t,b*=t,f*=t),B=z.rotationX*G,B&&(t=Math.cos(B),u=Math.sin(B),v=c*t+d*u,w=g*t+h*u,x=k*t+l*u,y=p*t+q*u,d=c*-u+d*t,h=g*-u+h*t,l=k*-u+l*t,q=p*-u+q*t,c=v,g=w,k=x,p=y),1!==E&&(d*=E,h*=E,l*=E,q*=E),1!==D&&(c*=D,g*=D,k*=D,p*=D),1!==C&&(b*=C,f*=C,j*=C,o*=C),r&&(n-=r,e=d*n,i=h*n,n=l*n+r),e=(v=(e+=z.x)-(e|=0))?(v*s+(0>v?-.5:.5)|0)/s+e:e,i=(v=(i+=z.y)-(i|=0))?(v*s+(0>v?-.5:.5)|0)/s+i:i,n=(v=(n+=z.z)-(n|=0))?(v*s+(0>v?-.5:.5)|0)/s+n:n,A[ta]="matrix3d("+[(b*s|0)/s,(f*s|0)/s,(j*s|0)/s,(o*s|0)/s,(c*s|0)/s,(g*s|0)/s,(k*s|0)/s,(p*s|0)/s,(d*s|0)/s,(h*s|0)/s,(l*s|0)/s,(q*s|0)/s,e,i,n,F?1+-n/F:1].join(",")+")"},Ba=M.set2DTransformRatio=function(a){var b,c,d,e,f,g=this.data,h=this.t,i=h.style;return g.rotationX||g.rotationY||g.z||g.force3D===!0||"auto"===g.force3D&&1!==a&&0!==a?(this.setRatio=Aa,void Aa.call(this,a)):void(g.rotation||g.skewX?(b=g.rotation*G,c=b-g.skewX*G,d=1e5,e=g.scaleX*d,f=g.scaleY*d,i[ta]="matrix("+(Math.cos(b)*e|0)/d+","+(Math.sin(b)*e|0)/d+","+(Math.sin(c)*-f|0)/d+","+(Math.cos(c)*f|0)/d+","+g.x+","+g.y+")"):i[ta]="matrix("+g.scaleX+",0,0,"+g.scaleY+","+g.x+","+g.y+")")};qa("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType",{parser:function(a,b,c,d,f,h,i){if(d._transform)return f;var j,k,l,m,n,o,p,q=d._transform=ya(a,e,!0,i.parseTransform),r=a.style,s=1e-6,t=sa.length,u=i,v={};if("string"==typeof u.transform&&ta)l=K.style,l[ta]=u.transform,l.display="block",l.position="absolute",J.body.appendChild(K),j=ya(K,null,!1),J.body.removeChild(K);else if("object"==typeof u){if(j={scaleX:da(null!=u.scaleX?u.scaleX:u.scale,q.scaleX),scaleY:da(null!=u.scaleY?u.scaleY:u.scale,q.scaleY),scaleZ:da(u.scaleZ,q.scaleZ),x:da(u.x,q.x),y:da(u.y,q.y),z:da(u.z,q.z),perspective:da(u.transformPerspective,q.perspective)},p=u.directionalRotation,null!=p)if("object"==typeof p)for(l in p)u[l]=p[l];else u.rotation=p;j.rotation=ea("rotation"in u?u.rotation:"shortRotation"in u?u.shortRotation+"_short":"rotationZ"in u?u.rotationZ:q.rotation,q.rotation,"rotation",v),wa&&(j.rotationX=ea("rotationX"in u?u.rotationX:"shortRotationX"in u?u.shortRotationX+"_short":q.rotationX||0,q.rotationX,"rotationX",v),j.rotationY=ea("rotationY"in u?u.rotationY:"shortRotationY"in u?u.shortRotationY+"_short":q.rotationY||0,q.rotationY,"rotationY",v)),j.skewX=null==u.skewX?q.skewX:ea(u.skewX,q.skewX),j.skewY=null==u.skewY?q.skewY:ea(u.skewY,q.skewY),(k=j.skewY-q.skewY)&&(j.skewX+=k,j.rotation+=k)}for(wa&&null!=u.force3D&&(q.force3D=u.force3D,o=!0),q.skewType=u.skewType||q.skewType||g.defaultSkewType,n=q.force3D||q.z||q.rotationX||q.rotationY||j.z||j.rotationX||j.rotationY||j.perspective,n||null==u.scale||(j.scaleZ=1);--t>-1;)c=sa[t],m=j[c]-q[c],(m>s||-s>m||null!=I[c])&&(o=!0,f=new ma(q,c,q[c],m,f),c in v&&(f.e=v[c]),f.xs0=0,f.plugin=h,d._overwriteProps.push(f.n));return m=u.transformOrigin,(m||wa&&n&&q.zOrigin)&&(ta?(o=!0,c=va,m=(m||V(a,c,e,!1,"50% 50%"))+"",f=new ma(r,c,0,0,f,-1,"transformOrigin"),f.b=r[c],f.plugin=h,wa?(l=q.zOrigin,m=m.split(" "),q.zOrigin=(m.length>2&&(0===l||"0px"!==m[2])?parseFloat(m[2]):l)||0,f.xs0=f.e=m[0]+" "+(m[1]||"50%")+" 0px",f=new ma(q,"zOrigin",0,0,f,-1,f.n),f.b=l,f.xs0=f.e=q.zOrigin):f.xs0=f.e=m):ba(m+"",q)),o&&(d._transformType=n||3===this._transformType?3:2),f},prefix:!0}),qa("boxShadow",{defaultValue:"0px 0px 0px 0px #999",prefix:!0,color:!0,multi:!0,keyword:"inset"}),qa("borderRadius",{defaultValue:"0px",parser:function(a,b,c,f,g,h){b=this.format(b);var i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],z=a.style;for(q=parseFloat(a.offsetWidth),r=parseFloat(a.offsetHeight),i=b.split(" "),j=0;j<y.length;j++)this.p.indexOf("border")&&(y[j]=T(y[j])),m=l=V(a,y[j],e,!1,"0px"),-1!==m.indexOf(" ")&&(l=m.split(" "),m=l[0],l=l[1]),n=k=i[j],o=parseFloat(m),t=m.substr((o+"").length),u="="===n.charAt(1),u?(p=parseInt(n.charAt(0)+"1",10),n=n.substr(2),p*=parseFloat(n),s=n.substr((p+"").length-(0>p?1:0))||""):(p=parseFloat(n),s=n.substr((p+"").length)),""===s&&(s=d[c]||t),s!==t&&(v=W(a,"borderLeft",o,t),w=W(a,"borderTop",o,t),"%"===s?(m=v/q*100+"%",l=w/r*100+"%"):"em"===s?(x=W(a,"borderLeft",1,"em"),m=v/x+"em",l=w/x+"em"):(m=v+"px",l=w+"px"),u&&(n=parseFloat(m)+p+s,k=parseFloat(l)+p+s)),g=na(z,y[j],m+" "+l,n+" "+k,!1,"0px",g);return g},prefix:!0,formatter:ja("0px 0px 0px 0px",!1,!0)}),qa("backgroundPosition",{defaultValue:"0 0",parser:function(a,b,c,d,f,g){var h,i,j,k,l,m,n="background-position",p=e||U(a,null),q=this.format((p?o?p.getPropertyValue(n+"-x")+" "+p.getPropertyValue(n+"-y"):p.getPropertyValue(n):a.currentStyle.backgroundPositionX+" "+a.currentStyle.backgroundPositionY)||"0 0"),r=this.format(b);if(-1!==q.indexOf("%")!=(-1!==r.indexOf("%"))&&(m=V(a,"backgroundImage").replace(A,""),m&&"none"!==m)){for(h=q.split(" "),i=r.split(" "),L.setAttribute("src",m),j=2;--j>-1;)q=h[j],k=-1!==q.indexOf("%"),k!==(-1!==i[j].indexOf("%"))&&(l=0===j?a.offsetWidth-L.width:a.offsetHeight-L.height,h[j]=k?parseFloat(q)/100*l+"px":parseFloat(q)/l*100+"%");q=h.join(" ")}return this.parseComplex(a.style,q,r,f,g)},formatter:ba}),qa("backgroundSize",{defaultValue:"0 0",formatter:ba}),qa("perspective",{defaultValue:"0px",prefix:!0}),qa("perspectiveOrigin",{defaultValue:"50% 50%",prefix:!0}),qa("transformStyle",{prefix:!0}),qa("backfaceVisibility",{prefix:!0}),qa("userSelect",{prefix:!0}),qa("margin",{parser:ka("marginTop,marginRight,marginBottom,marginLeft")}),qa("padding",{parser:ka("paddingTop,paddingRight,paddingBottom,paddingLeft")}),qa("clip",{defaultValue:"rect(0px,0px,0px,0px)",parser:function(a,b,c,d,f,g){var h,i,j;return 9>o?(i=a.currentStyle,j=8>o?" ":",",h="rect("+i.clipTop+j+i.clipRight+j+i.clipBottom+j+i.clipLeft+")",b=this.format(b).split(",").join(j)):(h=this.format(V(a,this.p,e,!1,this.dflt)),b=this.format(b)),this.parseComplex(a.style,h,b,f,g)}}),qa("textShadow",{defaultValue:"0px 0px 0px #999",color:!0,multi:!0}),qa("autoRound,strictUnits",{parser:function(a,b,c,d,e){return e}}),qa("border",{defaultValue:"0px solid #000",parser:function(a,b,c,d,f,g){return this.parseComplex(a.style,this.format(V(a,"borderTopWidth",e,!1,"0px")+" "+V(a,"borderTopStyle",e,!1,"solid")+" "+V(a,"borderTopColor",e,!1,"#000")),this.format(b),f,g)},color:!0,formatter:function(a){var b=a.split(" ");return b[0]+" "+(b[1]||"solid")+" "+(a.match(ia)||["#000"])[0]}}),qa("borderWidth",{parser:ka("borderTopWidth,borderRightWidth,borderBottomWidth,borderLeftWidth")}),qa("float,cssFloat,styleFloat",{parser:function(a,b,c,d,e,f){var g=a.style,h="cssFloat"in g?"cssFloat":"styleFloat";return new ma(g,h,0,0,e,-1,c,!1,0,g[h],b)}});var Ca=function(a){var b,c=this.t,d=c.filter||V(this.data,"filter"),e=this.s+this.c*a|0;100===e&&(-1===d.indexOf("atrix(")&&-1===d.indexOf("radient(")&&-1===d.indexOf("oader(")?(c.removeAttribute("filter"),b=!V(this.data,"filter")):(c.filter=d.replace(w,""),b=!0)),b||(this.xn1&&(c.filter=d=d||"alpha(opacity="+e+")"),-1===d.indexOf("pacity")?0===e&&this.xn1||(c.filter=d+" alpha(opacity="+e+")"):c.filter=d.replace(u,"opacity="+e))};qa("opacity,alpha,autoAlpha",{defaultValue:"1",parser:function(a,b,c,d,f,g){var h=parseFloat(V(a,"opacity",e,!1,"1")),i=a.style,j="autoAlpha"===c;return"string"==typeof b&&"="===b.charAt(1)&&(b=("-"===b.charAt(0)?-1:1)*parseFloat(b.substr(2))+h),j&&1===h&&"hidden"===V(a,"visibility",e)&&0!==b&&(h=0),O?f=new ma(i,"opacity",h,b-h,f):(f=new ma(i,"opacity",100*h,100*(b-h),f),f.xn1=j?1:0,i.zoom=1,f.type=2,f.b="alpha(opacity="+f.s+")",f.e="alpha(opacity="+(f.s+f.c)+")",f.data=a,f.plugin=g,f.setRatio=Ca),j&&(f=new ma(i,"visibility",0,0,f,-1,null,!1,0,0!==h?"inherit":"hidden",0===b?"hidden":"inherit"),f.xs0="inherit",d._overwriteProps.push(f.n),d._overwriteProps.push(c)),f}});var Da=function(a,b){b&&(a.removeProperty?("ms"===b.substr(0,2)&&(b="M"+b.substr(1)),a.removeProperty(b.replace(y,"-$1").toLowerCase())):a.removeAttribute(b))},Ea=function(a){if(this.t._gsClassPT=this,1===a||0===a){this.t.setAttribute("class",0===a?this.b:this.e);for(var b=this.data,c=this.t.style;b;)b.v?c[b.p]=b.v:Da(c,b.p),b=b._next;1===a&&this.t._gsClassPT===this&&(this.t._gsClassPT=null)}else this.t.getAttribute("class")!==this.e&&this.t.setAttribute("class",this.e)};qa("className",{parser:function(a,b,d,f,g,h,i){var j,k,l,m,n,o=a.getAttribute("class")||"",p=a.style.cssText;if(g=f._classNamePT=new ma(a,d,0,0,g,2),g.setRatio=Ea,g.pr=-11,c=!0,g.b=o,k=Y(a,e),l=a._gsClassPT){for(m={},n=l.data;n;)m[n.p]=1,n=n._next;l.setRatio(1)}return a._gsClassPT=g,g.e="="!==b.charAt(1)?b:o.replace(new RegExp("\\s*\\b"+b.substr(2)+"\\b"),"")+("+"===b.charAt(0)?" "+b.substr(2):""),f._tween._duration&&(a.setAttribute("class",g.e),j=Z(a,k,Y(a),i,m),a.setAttribute("class",o),g.data=j.firstMPT,a.style.cssText=p,g=g.xfirst=f.parse(a,j.difs,g,h)),g}});var Fa=function(a){if((1===a||0===a)&&this.data._totalTime===this.data._totalDuration&&"isFromStart"!==this.data.data){var b,c,d,e,f=this.t.style,g=h.transform.parse;if("all"===this.e)f.cssText="",e=!0;else for(b=this.e.split(","),d=b.length;--d>-1;)c=b[d],h[c]&&(h[c].parse===g?e=!0:c="transformOrigin"===c?va:h[c].p),Da(f,c);e&&(Da(f,ta),this.t._gsTransform&&delete this.t._gsTransform)}};for(qa("clearProps",{parser:function(a,b,d,e,f){return f=new ma(a,d,0,0,f,2),f.setRatio=Fa,f.e=b,f.pr=-10,f.data=e._tween,c=!0,f}}),i="bezier,throwProps,physicsProps,physics2D".split(","),oa=i.length;oa--;)ra(i[oa]);i=g.prototype,i._firstPT=null,i._onInitTween=function(a,b,h){if(!a.nodeType)return!1;this._target=a,this._tween=h,this._vars=b,j=b.autoRound,c=!1,d=b.suffixMap||g.suffixMap,e=U(a,""),f=this._overwriteProps;var i,m,o,p,q,r,s,t,u,w=a.style;if(k&&""===w.zIndex&&(i=V(a,"zIndex",e),("auto"===i||""===i)&&this._addLazySet(w,"zIndex",0)),"string"==typeof b&&(p=w.cssText,i=Y(a,e),w.cssText=p+";"+b,i=Z(a,i,Y(a)).difs,!O&&v.test(b)&&(i.opacity=parseFloat(RegExp.$1)),b=i,w.cssText=p),this._firstPT=m=this.parse(a,b,null),this._transformType){for(u=3===this._transformType,ta?l&&(k=!0,""===w.zIndex&&(s=V(a,"zIndex",e),("auto"===s||""===s)&&this._addLazySet(w,"zIndex",0)),n&&this._addLazySet(w,"WebkitBackfaceVisibility",this._vars.WebkitBackfaceVisibility||(u?"visible":"hidden"))):w.zoom=1,o=m;o&&o._next;)o=o._next;t=new ma(a,"transform",0,0,null,2),this._linkCSSP(t,null,o),t.setRatio=u&&wa?Aa:ta?Ba:za,t.data=this._transform||ya(a,e,!0),f.pop()}if(c){for(;m;){for(r=m._next,o=p;o&&o.pr>m.pr;)o=o._next;(m._prev=o?o._prev:q)?m._prev._next=m:p=m,(m._next=o)?o._prev=m:q=m,m=r}this._firstPT=p}return!0},i.parse=function(a,b,c,f){var g,i,k,l,m,n,o,p,q,r,s=a.style;for(g in b)n=b[g],i=h[g],i?c=i.parse(a,n,g,this,c,f,b):(m=V(a,g,e)+"",q="string"==typeof n,"color"===g||"fill"===g||"stroke"===g||-1!==g.indexOf("Color")||q&&x.test(n)?(q||(n=ha(n),n=(n.length>3?"rgba(":"rgb(")+n.join(",")+")"),c=na(s,g,m,n,!0,"transparent",c,0,f)):!q||-1===n.indexOf(" ")&&-1===n.indexOf(",")?(k=parseFloat(m),o=k||0===k?m.substr((k+"").length):"",(""===m||"auto"===m)&&("width"===g||"height"===g?(k=aa(a,g,e),o="px"):"left"===g||"top"===g?(k=X(a,g,e),o="px"):(k="opacity"!==g?0:1,o="")),r=q&&"="===n.charAt(1),r?(l=parseInt(n.charAt(0)+"1",10),n=n.substr(2),l*=parseFloat(n),p=n.replace(t,"")):(l=parseFloat(n),p=q?n.substr((l+"").length)||"":""),""===p&&(p=g in d?d[g]:o),n=l||0===l?(r?l+k:l)+p:b[g],o!==p&&""!==p&&(l||0===l)&&k&&(k=W(a,g,k,o),"%"===p?(k/=W(a,g,100,"%")/100,b.strictUnits!==!0&&(m=k+"%")):"em"===p?k/=W(a,g,1,"em"):"px"!==p&&(l=W(a,g,l,p),p="px"),r&&(l||0===l)&&(n=l+k+p)),r&&(l+=k),!k&&0!==k||!l&&0!==l?void 0!==s[g]&&(n||n+""!="NaN"&&null!=n)?(c=new ma(s,g,l||k||0,0,c,-1,g,!1,0,m,n),c.xs0="none"!==n||"display"!==g&&-1===g.indexOf("Style")?n:m):Q("invalid "+g+" tween value: "+b[g]):(c=new ma(s,g,k,l-k,c,0,g,j!==!1&&("px"===p||"zIndex"===g),0,m,n),c.xs0=p)):c=na(s,g,m,n,!0,null,c,0,f)),f&&c&&!c.plugin&&(c.plugin=f);return c},i.setRatio=function(a){var b,c,d,e=this._firstPT,f=1e-6;if(1!==a||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(a||this._tween._time!==this._tween._duration&&0!==this._tween._time||this._tween._rawPrevTime===-1e-6)for(;e;){if(b=e.c*a+e.s,e.r?b=Math.round(b):f>b&&b>-f&&(b=0),e.type)if(1===e.type)if(d=e.l,2===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2;else if(3===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2+e.xn2+e.xs3;else if(4===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2+e.xn2+e.xs3+e.xn3+e.xs4;else if(5===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2+e.xn2+e.xs3+e.xn3+e.xs4+e.xn4+e.xs5;else{for(c=e.xs0+b+e.xs1,d=1;d<e.l;d++)c+=e["xn"+d]+e["xs"+(d+1)];e.t[e.p]=c}else-1===e.type?e.t[e.p]=e.xs0:e.setRatio&&e.setRatio(a);else e.t[e.p]=b+e.xs0;e=e._next}else for(;e;)2!==e.type?e.t[e.p]=e.b:e.setRatio(a),e=e._next;else for(;e;)2!==e.type?e.t[e.p]=e.e:e.setRatio(a),e=e._next},i._enableTransforms=function(a){this._transformType=a||3===this._transformType?3:2,this._transform=this._transform||ya(this._target,e,!0)};var Ga=function(a){this.t[this.p]=this.e,this.data._linkCSSP(this,this._next,null,!0)};i._addLazySet=function(a,b,c){var d=this._firstPT=new ma(a,b,0,0,this._firstPT,2);d.e=c,d.setRatio=Ga,d.data=this},i._linkCSSP=function(a,b,c,d){return a&&(b&&(b._prev=a),a._next&&(a._next._prev=a._prev),a._prev?a._prev._next=a._next:this._firstPT===a&&(this._firstPT=a._next,d=!0),c?c._next=a:d||null!==this._firstPT||(this._firstPT=a),a._next=b,a._prev=c),a},i._kill=function(b){var c,d,e,f=b;if(b.autoAlpha||b.alpha){f={};for(d in b)f[d]=b[d];f.opacity=1,f.autoAlpha&&(f.visibility=1)}return b.className&&(c=this._classNamePT)&&(e=c.xfirst,e&&e._prev?this._linkCSSP(e._prev,c._next,e._prev._prev):e===this._firstPT&&(this._firstPT=c._next),c._next&&this._linkCSSP(c._next,c._next._next,e._prev),this._classNamePT=null),a.prototype._kill.call(this,f)};var Ha=function(a,b,c){var d,e,f,g;if(a.slice)for(e=a.length;--e>-1;)Ha(a[e],b,c);else for(d=a.childNodes,e=d.length;--e>-1;)f=d[e],g=f.type,f.style&&(b.push(Y(f)),c&&c.push(f)),1!==g&&9!==g&&11!==g||!f.childNodes.length||Ha(f,b,c)};return g.cascadeTo=function(a,c,d){var e,f,g,h=b.to(a,c,d),i=[h],j=[],k=[],l=[],m=b._internals.reservedProps;for(a=h._targets||h.target,Ha(a,j,l),h.render(c,!0),Ha(a,k),h.render(0,!0),h._enabled(!0),e=l.length;--e>-1;)if(f=Z(l[e],j[e],k[e]),f.firstMPT){f=f.difs;for(g in d)m[g]&&(f[g]=d[g]);i.push(b.to(l[e],c,f))}return i},a.activate([g]),g},!0),function(){var a=window._gsDefine.plugin({propName:"roundProps",priority:-1,API:2,init:function(a,b,c){return this._tween=c,!0}}),b=a.prototype;b._onInitAllProps=function(){for(var a,b,c,d=this._tween,e=d.vars.roundProps instanceof Array?d.vars.roundProps:d.vars.roundProps.split(","),f=e.length,g={},h=d._propLookup.roundProps;--f>-1;)g[e[f]]=1;for(f=e.length;--f>-1;)for(a=e[f],b=d._firstPT;b;)c=b._next,b.pg?b.t._roundProps(g,!0):b.n===a&&(this._add(b.t,a,b.s,b.c),c&&(c._prev=b._prev),b._prev?b._prev._next=c:d._firstPT===b&&(d._firstPT=c),b._next=b._prev=null,d._propLookup[a]=h),b=c;return!1},b._add=function(a,b,c,d){this._addTween(a,b,c,c+d,b,!0),this._overwriteProps.push(b)}}(),window._gsDefine.plugin({propName:"attr",API:2,version:"0.3.2",init:function(a,b,c){var d,e,f;if("function"!=typeof a.setAttribute)return!1;this._target=a,this._proxy={},this._start={},this._end={};for(d in b)this._start[d]=this._proxy[d]=e=a.getAttribute(d),f=this._addTween(this._proxy,d,parseFloat(e),b[d],d),this._end[d]=f?f.s+f.c:b[d],this._overwriteProps.push(d);return!0},set:function(a){this._super.setRatio.call(this,a);for(var b,c=this._overwriteProps,d=c.length,e=1===a?this._end:a?this._proxy:this._start;--d>-1;)b=c[d],this._target.setAttribute(b,e[b]+"")}}),window._gsDefine.plugin({propName:"directionalRotation",API:2,version:"0.2.0",init:function(a,b,c){"object"!=typeof b&&(b={rotation:b}),this.finals={};var d,e,f,g,h,i,j=b.useRadians===!0?2*Math.PI:360,k=1e-6;for(d in b)"useRadians"!==d&&(i=(b[d]+"").split("_"),e=i[0],f=parseFloat("function"!=typeof a[d]?a[d]:a[d.indexOf("set")||"function"!=typeof a["get"+d.substr(3)]?d:"get"+d.substr(3)]()),g=this.finals[d]="string"==typeof e&&"="===e.charAt(1)?f+parseInt(e.charAt(0)+"1",10)*Number(e.substr(2)):Number(e)||0,h=g-f,i.length&&(e=i.join("_"),-1!==e.indexOf("short")&&(h%=j,h!==h%(j/2)&&(h=0>h?h+j:h-j)),-1!==e.indexOf("_cw")&&0>h?h=(h+9999999999*j)%j-(h/j|0)*j:-1!==e.indexOf("ccw")&&h>0&&(h=(h-9999999999*j)%j-(h/j|0)*j)),(h>k||-k>h)&&(this._addTween(a,d,f,f+h,d),this._overwriteProps.push(d)));return!0},set:function(a){var b;if(1!==a)this._super.setRatio.call(this,a);else for(b=this._firstPT;b;)b.f?b.t[b.p](this.finals[b.p]):b.t[b.p]=this.finals[b.p],b=b._next}})._autoCSS=!0,window._gsDefine("easing.Back",["easing.Ease"],function(a){var b,c,d,e=window.GreenSockGlobals||window,f=e.com.greensock,g=2*Math.PI,h=Math.PI/2,i=f._class,j=function(b,c){var d=i("easing."+b,function(){},!0),e=d.prototype=new a;return e.constructor=d,e.getRatio=c,d},k=a.register||function(){},l=function(a,b,c,d,e){var f=i("easing."+a,{easeOut:new b,easeIn:new c,easeInOut:new d},!0);return k(f,a),f},m=function(a,b,c){this.t=a,this.v=b,c&&(this.next=c,c.prev=this,this.c=c.v-b,this.gap=c.t-a)},n=function(b,c){var d=i("easing."+b,function(a){this._p1=a||0===a?a:1.70158,this._p2=1.525*this._p1},!0),e=d.prototype=new a;return e.constructor=d,e.getRatio=c,e.config=function(a){return new d(a)},d},o=l("Back",n("BackOut",function(a){return(a-=1)*a*((this._p1+1)*a+this._p1)+1}),n("BackIn",function(a){return a*a*((this._p1+1)*a-this._p1)}),n("BackInOut",function(a){return(a*=2)<1?.5*a*a*((this._p2+1)*a-this._p2):.5*((a-=2)*a*((this._p2+1)*a+this._p2)+2)})),p=i("easing.SlowMo",function(a,b,c){b=b||0===b?b:.7,null==a?a=.7:a>1&&(a=1),this._p=1!==a?b:0,this._p1=(1-a)/2,this._p2=a,this._p3=this._p1+this._p2,this._calcEnd=c===!0},!0),q=p.prototype=new a;return q.constructor=p,q.getRatio=function(a){var b=a+(.5-a)*this._p;return a<this._p1?this._calcEnd?1-(a=1-a/this._p1)*a:b-(a=1-a/this._p1)*a*a*a*b:a>this._p3?this._calcEnd?1-(a=(a-this._p3)/this._p1)*a:b+(a-b)*(a=(a-this._p3)/this._p1)*a*a*a:this._calcEnd?1:b},p.ease=new p(.7,.7),q.config=p.config=function(a,b,c){return new p(a,b,c)},b=i("easing.SteppedEase",function(a){a=a||1,this._p1=1/a,this._p2=a+1},!0),q=b.prototype=new a,q.constructor=b,q.getRatio=function(a){return 0>a?a=0:a>=1&&(a=.999999999),(this._p2*a>>0)*this._p1},q.config=b.config=function(a){return new b(a)},c=i("easing.RoughEase",function(b){b=b||{};for(var c,d,e,f,g,h,i=b.taper||"none",j=[],k=0,l=0|(b.points||20),n=l,o=b.randomize!==!1,p=b.clamp===!0,q=b.template instanceof a?b.template:null,r="number"==typeof b.strength?.4*b.strength:.4;--n>-1;)c=o?Math.random():1/l*n,d=q?q.getRatio(c):c,"none"===i?e=r:"out"===i?(f=1-c,e=f*f*r):"in"===i?e=c*c*r:.5>c?(f=2*c,e=f*f*.5*r):(f=2*(1-c),e=f*f*.5*r),o?d+=Math.random()*e-.5*e:n%2?d+=.5*e:d-=.5*e,p&&(d>1?d=1:0>d&&(d=0)),j[k++]={x:c,y:d};for(j.sort(function(a,b){return a.x-b.x}),h=new m(1,1,null),n=l;--n>-1;)g=j[n],h=new m(g.x,g.y,h);this._prev=new m(0,0,0!==h.t?h:h.next)},!0),q=c.prototype=new a,q.constructor=c,q.getRatio=function(a){var b=this._prev;if(a>b.t){for(;b.next&&a>=b.t;)b=b.next;b=b.prev}else for(;b.prev&&a<=b.t;)b=b.prev;return this._prev=b,b.v+(a-b.t)/b.gap*b.c},q.config=function(a){return new c(a)},c.ease=new c,l("Bounce",j("BounceOut",function(a){return 1/2.75>a?7.5625*a*a:2/2.75>a?7.5625*(a-=1.5/2.75)*a+.75:2.5/2.75>a?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}),j("BounceIn",function(a){return(a=1-a)<1/2.75?1-7.5625*a*a:2/2.75>a?1-(7.5625*(a-=1.5/2.75)*a+.75):2.5/2.75>a?1-(7.5625*(a-=2.25/2.75)*a+.9375):1-(7.5625*(a-=2.625/2.75)*a+.984375)}),j("BounceInOut",function(a){var b=.5>a;return a=b?1-2*a:2*a-1,a=1/2.75>a?7.5625*a*a:2/2.75>a?7.5625*(a-=1.5/2.75)*a+.75:2.5/2.75>a?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375,b?.5*(1-a):.5*a+.5})),l("Circ",j("CircOut",function(a){return Math.sqrt(1-(a-=1)*a)}),j("CircIn",function(a){return-(Math.sqrt(1-a*a)-1)}),j("CircInOut",function(a){return(a*=2)<1?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)})),d=function(b,c,d){var e=i("easing."+b,function(a,b){this._p1=a||1,this._p2=b||d,this._p3=this._p2/g*(Math.asin(1/this._p1)||0)},!0),f=e.prototype=new a;return f.constructor=e,f.getRatio=c,f.config=function(a,b){return new e(a,b)},e},l("Elastic",d("ElasticOut",function(a){return this._p1*Math.pow(2,-10*a)*Math.sin((a-this._p3)*g/this._p2)+1},.3),d("ElasticIn",function(a){return-(this._p1*Math.pow(2,10*(a-=1))*Math.sin((a-this._p3)*g/this._p2))},.3),d("ElasticInOut",function(a){return(a*=2)<1?-.5*(this._p1*Math.pow(2,10*(a-=1))*Math.sin((a-this._p3)*g/this._p2)):this._p1*Math.pow(2,-10*(a-=1))*Math.sin((a-this._p3)*g/this._p2)*.5+1},.45)),l("Expo",j("ExpoOut",function(a){return 1-Math.pow(2,-10*a)}),j("ExpoIn",function(a){return Math.pow(2,10*(a-1))-.001}),j("ExpoInOut",function(a){return(a*=2)<1?.5*Math.pow(2,10*(a-1)):.5*(2-Math.pow(2,-10*(a-1)))})),l("Sine",j("SineOut",function(a){return Math.sin(a*h)}),j("SineIn",function(a){return-Math.cos(a*h)+1}),j("SineInOut",function(a){return-.5*(Math.cos(Math.PI*a)-1)})),i("easing.EaseLookup",{find:function(b){return a.map[b]}},!0),k(e.SlowMo,"SlowMo","ease,"),k(c,"RoughEase","ease,"),k(b,"SteppedEase","ease,"),o},!0)}),function(a){"use strict";var b=a.GreenSockGlobals||a;if(!b.TweenLite){var c,d,e,f,g,h=function(a){var c,d=a.split("."),e=b;for(c=0;c<d.length;c++)e[d[c]]=e=e[d[c]]||{};return e},i=h("com.greensock"),j=1e-10,k=[].slice,l=function(){},m=function(){var a=Object.prototype.toString,b=a.call([]);return function(c){return null!=c&&(c instanceof Array||"object"==typeof c&&!!c.push&&a.call(c)===b)}}(),n={},o=function(c,d,e,f){this.sc=n[c]?n[c].sc:[],n[c]=this,this.gsClass=null,this.func=e;var g=[];this.check=function(i){for(var j,k,l,m,p=d.length,q=p;--p>-1;)(j=n[d[p]]||new o(d[p],[])).gsClass?(g[p]=j.gsClass,q--):i&&j.sc.push(this);if(0===q&&e)for(k=("com.greensock."+c).split("."),l=k.pop(),m=h(k.join("."))[l]=this.gsClass=e.apply(e,g),f&&(b[l]=m,"function"==typeof define&&define.amd?define((a.GreenSockAMDPath?a.GreenSockAMDPath+"/":"")+c.split(".").join("/"),[],function(){return m}):"undefined"!=typeof module&&module.exports&&(module.exports=m)),p=0;p<this.sc.length;p++)this.sc[p].check()},this.check(!0)},p=a._gsDefine=function(a,b,c,d){return new o(a,b,c,d)},q=i._class=function(a,b,c){return b=b||function(){},p(a,[],function(){return b},c),b};p.globals=b;var r=[0,0,1,1],s=[],t=q("easing.Ease",function(a,b,c,d){this._func=a,this._type=c||0,this._power=d||0,this._params=b?r.concat(b):r},!0),u=t.map={},v=t.register=function(a,b,c,d){for(var e,f,g,h,j=b.split(","),k=j.length,l=(c||"easeIn,easeOut,easeInOut").split(",");--k>-1;)for(f=j[k],e=d?q("easing."+f,null,!0):i.easing[f]||{},g=l.length;--g>-1;)h=l[g],u[f+"."+h]=u[h+f]=e[h]=a.getRatio?a:a[h]||new a};for(e=t.prototype,e._calcEnd=!1,e.getRatio=function(a){if(this._func)return this._params[0]=a,this._func.apply(null,this._params);var b=this._type,c=this._power,d=1===b?1-a:2===b?a:.5>a?2*a:2*(1-a);return 1===c?d*=d:2===c?d*=d*d:3===c?d*=d*d*d:4===c&&(d*=d*d*d*d),1===b?1-d:2===b?d:.5>a?d/2:1-d/2},c=["Linear","Quad","Cubic","Quart","Quint,Strong"],d=c.length;--d>-1;)e=c[d]+",Power"+d,v(new t(null,null,1,d),e,"easeOut",!0),v(new t(null,null,2,d),e,"easeIn"+(0===d?",easeNone":"")),v(new t(null,null,3,d),e,"easeInOut");u.linear=i.easing.Linear.easeIn,u.swing=i.easing.Quad.easeInOut;var w=q("events.EventDispatcher",function(a){this._listeners={},this._eventTarget=a||this});e=w.prototype,e.addEventListener=function(a,b,c,d,e){e=e||0;var h,i,j=this._listeners[a],k=0;for(null==j&&(this._listeners[a]=j=[]),i=j.length;--i>-1;)h=j[i],h.c===b&&h.s===c?j.splice(i,1):0===k&&h.pr<e&&(k=i+1);j.splice(k,0,{c:b,s:c,up:d,pr:e}),this!==f||g||f.wake()},e.removeEventListener=function(a,b){var c,d=this._listeners[a];if(d)for(c=d.length;--c>-1;)if(d[c].c===b)return void d.splice(c,1)},e.dispatchEvent=function(a){var b,c,d,e=this._listeners[a];if(e)for(b=e.length,c=this._eventTarget;--b>-1;)d=e[b],d.up?d.c.call(d.s||c,{type:a,target:c}):d.c.call(d.s||c)};var x=a.requestAnimationFrame,y=a.cancelAnimationFrame,z=Date.now||function(){return(new Date).getTime()},A=z();for(c=["ms","moz","webkit","o"],d=c.length;--d>-1&&!x;)x=a[c[d]+"RequestAnimationFrame"],y=a[c[d]+"CancelAnimationFrame"]||a[c[d]+"CancelRequestAnimationFrame"];q("Ticker",function(a,b){var c,d,e,h,i,k=this,m=z(),n=b!==!1&&x,o=500,p=33,q=function(a){var b,f,g=z()-A;g>o&&(m+=g-p),A+=g,k.time=(A-m)/1e3,b=k.time-i,(!c||b>0||a===!0)&&(k.frame++,i+=b+(b>=h?.004:h-b),f=!0),a!==!0&&(e=d(q)),f&&k.dispatchEvent("tick")};w.call(k),k.time=k.frame=0,k.tick=function(){q(!0)},k.lagSmoothing=function(a,b){o=a||1/j,p=Math.min(b,o,0)},k.sleep=function(){null!=e&&(n&&y?y(e):clearTimeout(e),d=l,e=null,k===f&&(g=!1))},k.wake=function(){null!==e?k.sleep():k.frame>10&&(A=z()-o+5),d=0===c?l:n&&x?x:function(a){return setTimeout(a,1e3*(i-k.time)+1|0)},k===f&&(g=!0),q(2)},k.fps=function(a){return arguments.length?(c=a,h=1/(c||60),i=this.time+h,void k.wake()):c},k.useRAF=function(a){return arguments.length?(k.sleep(),n=a,void k.fps(c)):n},k.fps(a),setTimeout(function(){n&&(!e||k.frame<5)&&k.useRAF(!1)},1500)}),e=i.Ticker.prototype=new i.events.EventDispatcher,e.constructor=i.Ticker;var B=q("core.Animation",function(a,b){if(this.vars=b=b||{},this._duration=this._totalDuration=a||0,this._delay=Number(b.delay)||0,this._timeScale=1,this._active=b.immediateRender===!0,this.data=b.data,this._reversed=b.reversed===!0,Q){g||f.wake();var c=this.vars.useFrames?P:Q;c.add(this,c._time),this.vars.paused&&this.paused(!0)}});f=B.ticker=new i.Ticker,e=B.prototype,e._dirty=e._gc=e._initted=e._paused=!1,e._totalTime=e._time=0,e._rawPrevTime=-1,e._next=e._last=e._onUpdate=e._timeline=e.timeline=null,e._paused=!1;var C=function(){g&&z()-A>2e3&&f.wake(),setTimeout(C,2e3)};C(),e.play=function(a,b){return null!=a&&this.seek(a,b),this.reversed(!1).paused(!1)},e.pause=function(a,b){return null!=a&&this.seek(a,b),this.paused(!0)},e.resume=function(a,b){return null!=a&&this.seek(a,b),this.paused(!1)},e.seek=function(a,b){return this.totalTime(Number(a),b!==!1)},e.restart=function(a,b){return this.reversed(!1).paused(!1).totalTime(a?-this._delay:0,b!==!1,!0)},e.reverse=function(a,b){return null!=a&&this.seek(a||this.totalDuration(),b),this.reversed(!0).paused(!1)},e.render=function(a,b,c){},e.invalidate=function(){return this},e.isActive=function(){var a,b=this._timeline,c=this._startTime;return!b||!this._gc&&!this._paused&&b.isActive()&&(a=b.rawTime())>=c&&a<c+this.totalDuration()/this._timeScale},e._enabled=function(a,b){return g||f.wake(),this._gc=!a,this._active=this.isActive(),b!==!0&&(a&&!this.timeline?this._timeline.add(this,this._startTime-this._delay):!a&&this.timeline&&this._timeline._remove(this,!0)),!1},e._kill=function(a,b){return this._enabled(!1,!1)},e.kill=function(a,b){return this._kill(a,b),this},e._uncache=function(a){for(var b=a?this:this.timeline;b;)b._dirty=!0,b=b.timeline;return this},e._swapSelfInParams=function(a){for(var b=a.length,c=a.concat();--b>-1;)"{self}"===a[b]&&(c[b]=this);return c},e.eventCallback=function(a,b,c,d){if("on"===(a||"").substr(0,2)){var e=this.vars;if(1===arguments.length)return e[a];null==b?delete e[a]:(e[a]=b,e[a+"Params"]=m(c)&&-1!==c.join("").indexOf("{self}")?this._swapSelfInParams(c):c,e[a+"Scope"]=d),"onUpdate"===a&&(this._onUpdate=b)}return this},e.delay=function(a){return arguments.length?(this._timeline.smoothChildTiming&&this.startTime(this._startTime+a-this._delay),this._delay=a,this):this._delay},e.duration=function(a){return arguments.length?(this._duration=this._totalDuration=a,this._uncache(!0),this._timeline.smoothChildTiming&&this._time>0&&this._time<this._duration&&0!==a&&this.totalTime(this._totalTime*(a/this._duration),!0),this):(this._dirty=!1,this._duration)},e.totalDuration=function(a){return this._dirty=!1,arguments.length?this.duration(a):this._totalDuration},e.time=function(a,b){return arguments.length?(this._dirty&&this.totalDuration(),this.totalTime(a>this._duration?this._duration:a,b)):this._time},e.totalTime=function(a,b,c){if(g||f.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(0>a&&!c&&(a+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var d=this._totalDuration,e=this._timeline;if(a>d&&!c&&(a=d),this._startTime=(this._paused?this._pauseTime:e._time)-(this._reversed?d-a:a)/this._timeScale,e._dirty||this._uncache(!1),e._timeline)for(;e._timeline;)e._timeline._time!==(e._startTime+e._totalTime)/e._timeScale&&e.totalTime(e._totalTime,!0),e=e._timeline}this._gc&&this._enabled(!0,!1),(this._totalTime!==a||0===this._duration)&&(this.render(a,b,!1),H.length&&R())}return this},e.progress=e.totalProgress=function(a,b){return arguments.length?this.totalTime(this.duration()*a,b):this._time/this.duration()},e.startTime=function(a){return arguments.length?(a!==this._startTime&&(this._startTime=a,
+this.timeline&&this.timeline._sortChildren&&this.timeline.add(this,a-this._delay)),this):this._startTime},e.timeScale=function(a){if(!arguments.length)return this._timeScale;if(a=a||j,this._timeline&&this._timeline.smoothChildTiming){var b=this._pauseTime,c=b||0===b?b:this._timeline.totalTime();this._startTime=c-(c-this._startTime)*this._timeScale/a}return this._timeScale=a,this._uncache(!1)},e.reversed=function(a){return arguments.length?(a!=this._reversed&&(this._reversed=a,this.totalTime(this._timeline&&!this._timeline.smoothChildTiming?this.totalDuration()-this._totalTime:this._totalTime,!0)),this):this._reversed},e.paused=function(a){if(!arguments.length)return this._paused;if(a!=this._paused&&this._timeline){g||a||f.wake();var b=this._timeline,c=b.rawTime(),d=c-this._pauseTime;!a&&b.smoothChildTiming&&(this._startTime+=d,this._uncache(!1)),this._pauseTime=a?c:null,this._paused=a,this._active=this.isActive(),!a&&0!==d&&this._initted&&this.duration()&&this.render(b.smoothChildTiming?this._totalTime:(c-this._startTime)/this._timeScale,!0,!0)}return this._gc&&!a&&this._enabled(!0,!1),this};var D=q("core.SimpleTimeline",function(a){B.call(this,0,a),this.autoRemoveChildren=this.smoothChildTiming=!0});e=D.prototype=new B,e.constructor=D,e.kill()._gc=!1,e._first=e._last=null,e._sortChildren=!1,e.add=e.insert=function(a,b,c,d){var e,f;if(a._startTime=Number(b||0)+a._delay,a._paused&&this!==a._timeline&&(a._pauseTime=a._startTime+(this.rawTime()-a._startTime)/a._timeScale),a.timeline&&a.timeline._remove(a,!0),a.timeline=a._timeline=this,a._gc&&a._enabled(!0,!0),e=this._last,this._sortChildren)for(f=a._startTime;e&&e._startTime>f;)e=e._prev;return e?(a._next=e._next,e._next=a):(a._next=this._first,this._first=a),a._next?a._next._prev=a:this._last=a,a._prev=e,this._timeline&&this._uncache(!0),this},e._remove=function(a,b){return a.timeline===this&&(b||a._enabled(!1,!0),a.timeline=null,a._prev?a._prev._next=a._next:this._first===a&&(this._first=a._next),a._next?a._next._prev=a._prev:this._last===a&&(this._last=a._prev),this._timeline&&this._uncache(!0)),this},e.render=function(a,b,c){var d,e=this._first;for(this._totalTime=this._time=this._rawPrevTime=a;e;)d=e._next,(e._active||a>=e._startTime&&!e._paused)&&(e._reversed?e.render((e._dirty?e.totalDuration():e._totalDuration)-(a-e._startTime)*e._timeScale,b,c):e.render((a-e._startTime)*e._timeScale,b,c)),e=d},e.rawTime=function(){return g||f.wake(),this._totalTime};var E=q("TweenLite",function(b,c,d){if(B.call(this,c,d),this.render=E.prototype.render,null==b)throw"Cannot tween a null target.";this.target=b="string"!=typeof b?b:E.selector(b)||b;var e,f,g,h=b.jquery||b.length&&b!==a&&b[0]&&(b[0]===a||b[0].nodeType&&b[0].style&&!b.nodeType),i=this.vars.overwrite;if(this._overwrite=i=null==i?O[E.defaultOverwrite]:"number"==typeof i?i>>0:O[i],(h||b instanceof Array||b.push&&m(b))&&"number"!=typeof b[0])for(this._targets=g=k.call(b,0),this._propLookup=[],this._siblings=[],e=0;e<g.length;e++)f=g[e],f?"string"!=typeof f?f.length&&f!==a&&f[0]&&(f[0]===a||f[0].nodeType&&f[0].style&&!f.nodeType)?(g.splice(e--,1),this._targets=g=g.concat(k.call(f,0))):(this._siblings[e]=S(f,this,!1),1===i&&this._siblings[e].length>1&&T(f,this,null,1,this._siblings[e])):(f=g[e--]=E.selector(f),"string"==typeof f&&g.splice(e+1,1)):g.splice(e--,1);else this._propLookup={},this._siblings=S(b,this,!1),1===i&&this._siblings.length>1&&T(b,this,null,1,this._siblings);(this.vars.immediateRender||0===c&&0===this._delay&&this.vars.immediateRender!==!1)&&(this._time=-j,this.render(-this._delay))},!0),F=function(b){return b.length&&b!==a&&b[0]&&(b[0]===a||b[0].nodeType&&b[0].style&&!b.nodeType)},G=function(a,b){var c,d={};for(c in a)N[c]||c in b&&"transform"!==c&&"x"!==c&&"y"!==c&&"width"!==c&&"height"!==c&&"className"!==c&&"border"!==c||!(!K[c]||K[c]&&K[c]._autoCSS)||(d[c]=a[c],delete a[c]);a.css=d};e=E.prototype=new B,e.constructor=E,e.kill()._gc=!1,e.ratio=0,e._firstPT=e._targets=e._overwrittenProps=e._startAt=null,e._notifyPluginsOfEnabled=e._lazy=!1,E.version="1.12.1",E.defaultEase=e._ease=new t(null,null,1,1),E.defaultOverwrite="auto",E.ticker=f,E.autoSleep=!0,E.lagSmoothing=function(a,b){f.lagSmoothing(a,b)},E.selector=a.$||a.jQuery||function(b){return a.$?(E.selector=a.$,a.$(b)):a.document?a.document.getElementById("#"===b.charAt(0)?b.substr(1):b):b};var H=[],I={},J=E._internals={isArray:m,isSelector:F,lazyTweens:H},K=E._plugins={},L=J.tweenLookup={},M=0,N=J.reservedProps={ease:1,delay:1,overwrite:1,onComplete:1,onCompleteParams:1,onCompleteScope:1,useFrames:1,runBackwards:1,startAt:1,onUpdate:1,onUpdateParams:1,onUpdateScope:1,onStart:1,onStartParams:1,onStartScope:1,onReverseComplete:1,onReverseCompleteParams:1,onReverseCompleteScope:1,onRepeat:1,onRepeatParams:1,onRepeatScope:1,easeParams:1,yoyo:1,immediateRender:1,repeat:1,repeatDelay:1,data:1,paused:1,reversed:1,autoCSS:1,lazy:1},O={none:0,all:1,auto:2,concurrent:3,allOnStart:4,preexisting:5,"true":1,"false":0},P=B._rootFramesTimeline=new D,Q=B._rootTimeline=new D,R=function(){var a=H.length;for(I={};--a>-1;)c=H[a],c&&c._lazy!==!1&&(c.render(c._lazy,!1,!0),c._lazy=!1);H.length=0};Q._startTime=f.time,P._startTime=f.frame,Q._active=P._active=!0,setTimeout(R,1),B._updateRoot=E.render=function(){var a,b,c;if(H.length&&R(),Q.render((f.time-Q._startTime)*Q._timeScale,!1,!1),P.render((f.frame-P._startTime)*P._timeScale,!1,!1),H.length&&R(),!(f.frame%120)){for(c in L){for(b=L[c].tweens,a=b.length;--a>-1;)b[a]._gc&&b.splice(a,1);0===b.length&&delete L[c]}if(c=Q._first,(!c||c._paused)&&E.autoSleep&&!P._first&&1===f._listeners.tick.length){for(;c&&c._paused;)c=c._next;c||f.sleep()}}},f.addEventListener("tick",B._updateRoot);var S=function(a,b,c){var d,e,f=a._gsTweenID;if(L[f||(a._gsTweenID=f="t"+M++)]||(L[f]={target:a,tweens:[]}),b&&(d=L[f].tweens,d[e=d.length]=b,c))for(;--e>-1;)d[e]===b&&d.splice(e,1);return L[f].tweens},T=function(a,b,c,d,e){var f,g,h,i;if(1===d||d>=4){for(i=e.length,f=0;i>f;f++)if((h=e[f])!==b)h._gc||h._enabled(!1,!1)&&(g=!0);else if(5===d)break;return g}var k,l=b._startTime+j,m=[],n=0,o=0===b._duration;for(f=e.length;--f>-1;)(h=e[f])===b||h._gc||h._paused||(h._timeline!==b._timeline?(k=k||U(b,0,o),0===U(h,k,o)&&(m[n++]=h)):h._startTime<=l&&h._startTime+h.totalDuration()/h._timeScale>l&&((o||!h._initted)&&l-h._startTime<=2e-10||(m[n++]=h)));for(f=n;--f>-1;)h=m[f],2===d&&h._kill(c,a)&&(g=!0),(2!==d||!h._firstPT&&h._initted)&&h._enabled(!1,!1)&&(g=!0);return g},U=function(a,b,c){for(var d=a._timeline,e=d._timeScale,f=a._startTime;d._timeline;){if(f+=d._startTime,e*=d._timeScale,d._paused)return-100;d=d._timeline}return f/=e,f>b?f-b:c&&f===b||!a._initted&&2*j>f-b?j:(f+=a.totalDuration()/a._timeScale/e)>b+j?0:f-b-j};e._init=function(){var a,b,c,d,e,f=this.vars,g=this._overwrittenProps,h=this._duration,i=!!f.immediateRender,j=f.ease;if(f.startAt){this._startAt&&(this._startAt.render(-1,!0),this._startAt.kill()),e={};for(d in f.startAt)e[d]=f.startAt[d];if(e.overwrite=!1,e.immediateRender=!0,e.lazy=i&&f.lazy!==!1,e.startAt=e.delay=null,this._startAt=E.to(this.target,0,e),i)if(this._time>0)this._startAt=null;else if(0!==h)return}else if(f.runBackwards&&0!==h)if(this._startAt)this._startAt.render(-1,!0),this._startAt.kill(),this._startAt=null;else{c={};for(d in f)N[d]&&"autoCSS"!==d||(c[d]=f[d]);if(c.overwrite=0,c.data="isFromStart",c.lazy=i&&f.lazy!==!1,c.immediateRender=i,this._startAt=E.to(this.target,0,c),i){if(0===this._time)return}else this._startAt._init(),this._startAt._enabled(!1)}if(j?j instanceof t?this._ease=f.easeParams instanceof Array?j.config.apply(j,f.easeParams):j:this._ease="function"==typeof j?new t(j,f.easeParams):u[j]||E.defaultEase:this._ease=E.defaultEase,this._easeType=this._ease._type,this._easePower=this._ease._power,this._firstPT=null,this._targets)for(a=this._targets.length;--a>-1;)this._initProps(this._targets[a],this._propLookup[a]={},this._siblings[a],g?g[a]:null)&&(b=!0);else b=this._initProps(this.target,this._propLookup,this._siblings,g);if(b&&E._onPluginEvent("_onInitAllProps",this),g&&(this._firstPT||"function"!=typeof this.target&&this._enabled(!1,!1)),f.runBackwards)for(c=this._firstPT;c;)c.s+=c.c,c.c=-c.c,c=c._next;this._onUpdate=f.onUpdate,this._initted=!0},e._initProps=function(b,c,d,e){var f,g,h,i,j,k;if(null==b)return!1;I[b._gsTweenID]&&R(),this.vars.css||b.style&&b!==a&&b.nodeType&&K.css&&this.vars.autoCSS!==!1&&G(this.vars,b);for(f in this.vars){if(k=this.vars[f],N[f])k&&(k instanceof Array||k.push&&m(k))&&-1!==k.join("").indexOf("{self}")&&(this.vars[f]=k=this._swapSelfInParams(k,this));else if(K[f]&&(i=new K[f])._onInitTween(b,this.vars[f],this)){for(this._firstPT=j={_next:this._firstPT,t:i,p:"setRatio",s:0,c:1,f:!0,n:f,pg:!0,pr:i._priority},g=i._overwriteProps.length;--g>-1;)c[i._overwriteProps[g]]=this._firstPT;(i._priority||i._onInitAllProps)&&(h=!0),(i._onDisable||i._onEnable)&&(this._notifyPluginsOfEnabled=!0)}else this._firstPT=c[f]=j={_next:this._firstPT,t:b,p:f,f:"function"==typeof b[f],n:f,pg:!1,pr:0},j.s=j.f?b[f.indexOf("set")||"function"!=typeof b["get"+f.substr(3)]?f:"get"+f.substr(3)]():parseFloat(b[f]),j.c="string"==typeof k&&"="===k.charAt(1)?parseInt(k.charAt(0)+"1",10)*Number(k.substr(2)):Number(k)-j.s||0;j&&j._next&&(j._next._prev=j)}return e&&this._kill(e,b)?this._initProps(b,c,d,e):this._overwrite>1&&this._firstPT&&d.length>1&&T(b,this,c,this._overwrite,d)?(this._kill(c,b),this._initProps(b,c,d,e)):(this._firstPT&&(this.vars.lazy!==!1&&this._duration||this.vars.lazy&&!this._duration)&&(I[b._gsTweenID]=!0),h)},e.render=function(a,b,c){var d,e,f,g,h=this._time,i=this._duration,k=this._rawPrevTime;if(a>=i)this._totalTime=this._time=i,this.ratio=this._ease._calcEnd?this._ease.getRatio(1):1,this._reversed||(d=!0,e="onComplete"),0===i&&(this._initted||!this.vars.lazy||c)&&(this._startTime===this._timeline._duration&&(a=0),(0===a||0>k||k===j)&&k!==a&&(c=!0,k>j&&(e="onReverseComplete")),this._rawPrevTime=g=!b||a||k===a?a:j);else if(1e-7>a)this._totalTime=this._time=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0,(0!==h||0===i&&k>0&&k!==j)&&(e="onReverseComplete",d=this._reversed),0>a?(this._active=!1,0===i&&(this._initted||!this.vars.lazy||c)&&(k>=0&&(c=!0),this._rawPrevTime=g=!b||a||k===a?a:j)):this._initted||(c=!0);else if(this._totalTime=this._time=a,this._easeType){var l=a/i,m=this._easeType,n=this._easePower;(1===m||3===m&&l>=.5)&&(l=1-l),3===m&&(l*=2),1===n?l*=l:2===n?l*=l*l:3===n?l*=l*l*l:4===n&&(l*=l*l*l*l),1===m?this.ratio=1-l:2===m?this.ratio=l:.5>a/i?this.ratio=l/2:this.ratio=1-l/2}else this.ratio=this._ease.getRatio(a/i);if(this._time!==h||c){if(!this._initted){if(this._init(),!this._initted||this._gc)return;if(!c&&this._firstPT&&(this.vars.lazy!==!1&&this._duration||this.vars.lazy&&!this._duration))return this._time=this._totalTime=h,this._rawPrevTime=k,H.push(this),void(this._lazy=a);this._time&&!d?this.ratio=this._ease.getRatio(this._time/i):d&&this._ease._calcEnd&&(this.ratio=this._ease.getRatio(0===this._time?0:1))}for(this._lazy!==!1&&(this._lazy=!1),this._active||!this._paused&&this._time!==h&&a>=0&&(this._active=!0),0===h&&(this._startAt&&(a>=0?this._startAt.render(a,b,c):e||(e="_dummyGS")),this.vars.onStart&&(0!==this._time||0===i)&&(b||this.vars.onStart.apply(this.vars.onStartScope||this,this.vars.onStartParams||s))),f=this._firstPT;f;)f.f?f.t[f.p](f.c*this.ratio+f.s):f.t[f.p]=f.c*this.ratio+f.s,f=f._next;this._onUpdate&&(0>a&&this._startAt&&this._startTime&&this._startAt.render(a,b,c),b||(this._time!==h||d)&&this._onUpdate.apply(this.vars.onUpdateScope||this,this.vars.onUpdateParams||s)),e&&(this._gc||(0>a&&this._startAt&&!this._onUpdate&&this._startTime&&this._startAt.render(a,b,c),d&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!b&&this.vars[e]&&this.vars[e].apply(this.vars[e+"Scope"]||this,this.vars[e+"Params"]||s),0===i&&this._rawPrevTime===j&&g!==j&&(this._rawPrevTime=0)))}},e._kill=function(a,b){if("all"===a&&(a=null),null==a&&(null==b||b===this.target))return this._lazy=!1,this._enabled(!1,!1);b="string"!=typeof b?b||this._targets||this.target:E.selector(b)||b;var c,d,e,f,g,h,i,j;if((m(b)||F(b))&&"number"!=typeof b[0])for(c=b.length;--c>-1;)this._kill(a,b[c])&&(h=!0);else{if(this._targets){for(c=this._targets.length;--c>-1;)if(b===this._targets[c]){g=this._propLookup[c]||{},this._overwrittenProps=this._overwrittenProps||[],d=this._overwrittenProps[c]=a?this._overwrittenProps[c]||{}:"all";break}}else{if(b!==this.target)return!1;g=this._propLookup,d=this._overwrittenProps=a?this._overwrittenProps||{}:"all"}if(g){i=a||g,j=a!==d&&"all"!==d&&a!==g&&("object"!=typeof a||!a._tempKill);for(e in i)(f=g[e])&&(f.pg&&f.t._kill(i)&&(h=!0),f.pg&&0!==f.t._overwriteProps.length||(f._prev?f._prev._next=f._next:f===this._firstPT&&(this._firstPT=f._next),f._next&&(f._next._prev=f._prev),f._next=f._prev=null),delete g[e]),j&&(d[e]=1);!this._firstPT&&this._initted&&this._enabled(!1,!1)}}return h},e.invalidate=function(){return this._notifyPluginsOfEnabled&&E._onPluginEvent("_onDisable",this),this._firstPT=null,this._overwrittenProps=null,this._onUpdate=null,this._startAt=null,this._initted=this._active=this._notifyPluginsOfEnabled=this._lazy=!1,this._propLookup=this._targets?{}:[],this},e._enabled=function(a,b){if(g||f.wake(),a&&this._gc){var c,d=this._targets;if(d)for(c=d.length;--c>-1;)this._siblings[c]=S(d[c],this,!0);else this._siblings=S(this.target,this,!0)}return B.prototype._enabled.call(this,a,b),this._notifyPluginsOfEnabled&&this._firstPT?E._onPluginEvent(a?"_onEnable":"_onDisable",this):!1},E.to=function(a,b,c){return new E(a,b,c)},E.from=function(a,b,c){return c.runBackwards=!0,c.immediateRender=0!=c.immediateRender,new E(a,b,c)},E.fromTo=function(a,b,c,d){return d.startAt=c,d.immediateRender=0!=d.immediateRender&&0!=c.immediateRender,new E(a,b,d)},E.delayedCall=function(a,b,c,d,e){return new E(b,0,{delay:a,onComplete:b,onCompleteParams:c,onCompleteScope:d,onReverseComplete:b,onReverseCompleteParams:c,onReverseCompleteScope:d,immediateRender:!1,useFrames:e,overwrite:0})},E.set=function(a,b){return new E(a,0,b)},E.getTweensOf=function(a,b){if(null==a)return[];a="string"!=typeof a?a:E.selector(a)||a;var c,d,e,f;if((m(a)||F(a))&&"number"!=typeof a[0]){for(c=a.length,d=[];--c>-1;)d=d.concat(E.getTweensOf(a[c],b));for(c=d.length;--c>-1;)for(f=d[c],e=c;--e>-1;)f===d[e]&&d.splice(c,1)}else for(d=S(a).concat(),c=d.length;--c>-1;)(d[c]._gc||b&&!d[c].isActive())&&d.splice(c,1);return d},E.killTweensOf=E.killDelayedCallsTo=function(a,b,c){"object"==typeof b&&(c=b,b=!1);for(var d=E.getTweensOf(a,b),e=d.length;--e>-1;)d[e]._kill(c,a)};var V=q("plugins.TweenPlugin",function(a,b){this._overwriteProps=(a||"").split(","),this._propName=this._overwriteProps[0],this._priority=b||0,this._super=V.prototype},!0);if(e=V.prototype,V.version="1.10.1",V.API=2,e._firstPT=null,e._addTween=function(a,b,c,d,e,f){var g,h;return null!=d&&(g="number"==typeof d||"="!==d.charAt(1)?Number(d)-c:parseInt(d.charAt(0)+"1",10)*Number(d.substr(2)))?(this._firstPT=h={_next:this._firstPT,t:a,p:b,s:c,c:g,f:"function"==typeof a[b],n:e||b,r:f},h._next&&(h._next._prev=h),h):void 0},e.setRatio=function(a){for(var b,c=this._firstPT,d=1e-6;c;)b=c.c*a+c.s,c.r?b=Math.round(b):d>b&&b>-d&&(b=0),c.f?c.t[c.p](b):c.t[c.p]=b,c=c._next},e._kill=function(a){var b,c=this._overwriteProps,d=this._firstPT;if(null!=a[this._propName])this._overwriteProps=[];else for(b=c.length;--b>-1;)null!=a[c[b]]&&c.splice(b,1);for(;d;)null!=a[d.n]&&(d._next&&(d._next._prev=d._prev),d._prev?(d._prev._next=d._next,d._prev=null):this._firstPT===d&&(this._firstPT=d._next)),d=d._next;return!1},e._roundProps=function(a,b){for(var c=this._firstPT;c;)(a[this._propName]||null!=c.n&&a[c.n.split(this._propName+"_").join("")])&&(c.r=b),c=c._next},E._onPluginEvent=function(a,b){var c,d,e,f,g,h=b._firstPT;if("_onInitAllProps"===a){for(;h;){for(g=h._next,d=e;d&&d.pr>h.pr;)d=d._next;(h._prev=d?d._prev:f)?h._prev._next=h:e=h,(h._next=d)?d._prev=h:f=h,h=g}h=b._firstPT=e}for(;h;)h.pg&&"function"==typeof h.t[a]&&h.t[a]()&&(c=!0),h=h._next;return c},V.activate=function(a){for(var b=a.length;--b>-1;)a[b].API===V.API&&(K[(new a[b])._propName]=a[b]);return!0},p.plugin=function(a){if(!(a&&a.propName&&a.init&&a.API))throw"illegal plugin definition.";var b,c=a.propName,d=a.priority||0,e=a.overwriteProps,f={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_roundProps",initAll:"_onInitAllProps"},g=q("plugins."+c.charAt(0).toUpperCase()+c.substr(1)+"Plugin",function(){V.call(this,c,d),this._overwriteProps=e||[]},a.global===!0),h=g.prototype=new V(c);h.constructor=g,g.API=a.API;for(b in f)"function"==typeof a[b]&&(h[f[b]]=a[b]);return g.version=a.version,V.activate([g]),g},c=a._gsQueue){for(d=0;d<c.length;d++)c[d]();for(e in n)!n[e].func}g=!1}}(window),angular.module("att.abs.transition",[]).factory("$transition",["$q","$timeout","$rootScope",function(a,b,c){function d(a){for(var b in a)if(void 0!==f.style[b])return a[b]}var e=function(d,f,g){g=g||{};var h=a.defer(),i=e[g.animation?"animationEndEventName":"transitionEndEventName"],j=function(){c.$apply(function(){d.unbind(i,j),h.resolve(d)})};return i&&d.bind(i,j),b(function(){angular.isString(f)?d.addClass(f):angular.isFunction(f)?f(d):angular.isObject(f)&&d.css(f),i||h.resolve(d)},100),h.promise.cancel=function(){i&&d.unbind(i,j),h.reject("Transition cancelled")},h.promise},f=document.createElement("trans"),g={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"},h={WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"};return e.transitionEndEventName=d(g),e.animationEndEventName=d(h),e}]).factory("$scrollTo",["$window",function(a){var b=function(b,c,d){TweenMax.to(a,d||1,{scrollTo:{y:c,x:b},ease:Power4.easeOut})};return b}]).factory("animation",function(){return TweenMax}).factory("$progressBar",function(){var a=function(a){var b=function(b,c){TweenMax.to({},c,{onUpdateParams:["{self}"],onUpdate:a,onComplete:b})};return function(){return b}()};return a}).factory("$height",function(){var a=function(a,b,c,d){TweenMax.to(a,b,{height:c,autoAlpha:d},0)};return a}),angular.module("att.abs.accordion",["att.abs.utilities","att.abs.position","att.abs.transition"]).constant("accordionConfig",{closeOthers:!1}).controller("AccordionController",["$scope","$attrs","accordionConfig","$log",function(a,b,c,d){this.groups=[],this.index=-1,this.scope=a,a.forceExpand=!1,this.closeOthers=function(d){var e=angular.isDefined(b.closeOthers)?a.$eval(b.closeOthers):c.closeOthers;e&&!a.forceExpand&&angular.forEach(this.groups,function(a){a!==d&&(a.isOpen=!1)}),this.groups.indexOf(d)===this.groups.length-1&&a.forceExpand&&(a.forceExpand=!1)},this.expandAll=function(){a.forceExpand=!0,angular.forEach(this.groups,function(a){a.isOpen=!0})},this.collapseAll=function(){angular.forEach(this.groups,function(a){a.isOpen=!1})},this.focus=function(a){var b=this;angular.forEach(this.groups,function(c,d){c!==a?c.focused=!1:(b.index=d,c.focused=!0)})},this.blur=function(a){a.focused=!1,this.index=-1,d.log("accordion.blur()",a)},this.cycle=function(b,c,d){if(c)if(this.index===this.groups.length-1){if(d)return this.index=0,b.focused=!1,void a.$apply();this.index=0}else this.index++;else this.index<=0&&!d?this.index=this.groups.length-1:this.index--;b.focused=!1,this.groups[this.index].setFocus=!0,this.groups[this.index].focused=!0,a.$apply()},this.addGroup=function(a){var b=this;a.index=this.groups.length,a.focused=!1,this.groups.push(a),this.groups.length>0&&(this.index=0),a.$on("$destroy",function(){b.removeGroup(a)})},this.removeGroup=function(a){var b=this.groups.indexOf(a);-1!==b&&this.groups.splice(this.groups.indexOf(a),1)}}]).directive("accordion",function(){return{restrict:"EA",controller:"AccordionController",transclude:!0,replace:!1,scope:{cClass:"@css",expandAll:"=?",collapseAll:"=?"},template:'<div class="{{cClass}}" ng-transclude></div>',link:function(a,b,c,d){a.$watch("expandAll",function(b){b&&(d.expandAll(),a.expandAll=!1)}),a.$watch("collapseAll",function(b){b&&(d.collapseAll(),a.collapseAll=!1)})}}}).directive("accordionGroup",[function(){return{require:["^accordion","accordionGroup"],restrict:"EA",transclude:!0,replace:!0,templateUrl:"app/scripts/ng_js_att_tpls/accordion/accordion.html",scope:{heading:"@",isOpen:"=?"},controller:["$scope",function(a){a.showicon=!0,this.setHeading=function(b){this.heading=b,a.showicon=!1},this.isIsOpen=function(){return a.isOpen}}],link:function(a,b,c,d){var e=d[0],f=d[1],g={tab:9,enter:13,esc:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40},h=b.children().eq(0);a.setFocus=!1;var i=function(b){var c=!0;switch(b.keyCode){case g.enter:b.preventDefault(),a.toggle(),a.$apply();break;case g.up:case g.left:b.preventDefault(),e.cycle(a,!1);break;case g.down:case g.right:b.preventDefault(),e.cycle(a,!0);break;default:c=!1}return b.stopPropagation(),c};angular.isUndefined(a.isOpen)&&(a.isOpen=!1),h.bind("keydown",i),e.addGroup(a),0===a.index&&(a.focused=!0),f.toggle=a.toggle=function(){return a.isOpen=!a.isOpen,e.focus(a),a.isOpen},a.$watch("isOpen",function(b){b&&e.closeOthers(a)}),a.$watch("focused",function(b){b?(h.attr("tabindex","0"),a.setFocus&&h[0].focus()):(a.setFocus=!1,h.attr("tabindex","-1"))})}}}]).directive("accordionToggle",function(){return{restrict:"EA",require:"^accordionGroup",scope:{expandIcon:"@",collapseIcon:"@"},link:function(a,b,c,d){var e=function(c){a.expandIcon&&a.collapseIcon&&(c?(b.removeClass(a.expandIcon),b.addClass(a.collapseIcon)):(b.removeClass(a.collapseIcon),b.addClass(a.expandIcon)))};b.bind("click",function(){d.toggle(),a.$apply()}),a.$watch(function(){return d.isIsOpen()},function(a){e(a)})}}}).directive("accordionHeading",function(){return{restrict:"EA",transclude:!0,template:"",require:"^accordionGroup",compile:function(a,b,c){var d=function(a,b,d,e){c(a,function(a){b.append(a),e.setHeading(b)})};return d}}}).directive("accordionTransclude",function(){return{require:"^accordionGroup",link:function(a,b,c,d){a.$watch(function(){return d[c.accordionTransclude]},function(a){a&&b.find("span").eq(0).prepend(a)})}}}).directive("attGoTop",["$scrollTo",function(a){return{restrict:"A",transclude:!1,link:function(b,c,d){c.bind("click",function(){a(0,d.attGoTop)})}}}]).directive("attGoTo",["$anchorScroll","$location",function(a,b){return{restrict:"A",transclude:!1,link:function(c,d,e){d.bind("click",function(){var c=e.attGoTo;b.hash()!==c?b.hash(e.attGoTo):a()})}}}]).directive("freeStanding",function(){return{restrict:"EA",transclude:!0,replace:!0,scope:!0,template:"<div><span class='att-accordion__freestanding' ng-show='showAccordion'></span>\n<div class='section-toggle'>\n<button class='section-toggle__button' ng-click='fsToggle()'>\n {{btnText}}<i style='font-size:0.875rem' ng-class='{\"icon-chevron-up\": showAccordion,\"icon-chevron-down\": !showAccordion, }'></i> \n</button>\n</div></div>",compile:function(a,b,c){var d=function(a,b,d){a.content="",c(a,function(a){b.find("span").append(a)}),a.showAccordion=!1,a.btnText=a.showAccordion?d.hideMsg:d.showMsg,a.fsToggle=function(){a.showAccordion=!a.showAccordion,a.btnText=a.showAccordion?d.hideMsg:d.showMsg}};return d}}}).directive("expanders",function(){return{restrict:"EA",replace:!0,transclude:!0,template:"<div ng-transclude></div>",controller:["$scope",function(a){var b=null;this.setScope=function(a){b=a},this.toggle=function(){return a.isOpen=b.isOpen=!b.isOpen,b.isOpen}}],link:function(a){a.isOpen=!1}}}).directive("expanderHeading",function(){return{require:"^expanders",restrict:"EA",replace:!0,transclude:!0,scope:!0,template:"<div style='padding:10px !important' ng-transclude></div>"}}).directive("expanderBody",function(){return{restrict:"EA",require:"^expanders",replace:!0,transclude:!0,scope:{},template:"<div collapse='!isOpen'><div ng-transclude></div></div>",link:function(a,b,c,d){a.isOpen=!1,d.setScope(a)}}}).directive("expanderToggle",function(){return{restrict:"EA",require:"^expanders",scope:{expandIcon:"@",collapseIcon:"@"},link:function(a,b,c,d){var e=!1,f=function(){a.expandIcon&&a.collapseIcon&&(e?(b.removeClass(a.expandIcon),b.addClass(a.collapseIcon)):(b.removeClass(a.collapseIcon),b.addClass(a.expandIcon)))};b.bind("keydown",function(b){13===b.keyCode&&a.toggleit()}),b.bind("click",function(){a.toggleit()}),a.toggleit=function(){e=d.toggle(),f(),a.$apply()},f()}}}).directive("collapse",["$transition",function(a){var b={open:{marginTop:null,marginBottom:null,paddingTop:null,paddingBottom:null,display:"block"},closed:{marginTop:0,marginBottom:0,paddingTop:0,paddingBottom:0,display:"none"}},c=function(a,c,d){c.removeClass("collapse"),c.css({height:d}),0===d?c.css(b.closed):c.css(b.open),c.addClass("collapse")};return{link:function(d,e,f){var g,h=!0;d.$watch(function(){return e[0].scrollHeight},function(){0===e[0].scrollHeight||g||(h?c(d,e,e[0].scrollHeight+"px"):c(d,e,"auto"))});var i,j=function(b){return i&&i.cancel(),i=a(e,b),i.then(function(){i=void 0},function(){i=void 0}),i},k=function(){d.postTransition=!0,h?(h=!1,g||c(d,e,"auto")):j(angular.extend({height:e[0].scrollHeight+"px"},b.open)).then(function(){g||c(d,e,"auto")}),g=!1},l=function(){g=!0,h?(h=!1,c(d,e,0)):(c(d,e,e[0].scrollHeight+"px"),j(angular.extend({height:0},b.closed)).then(function(){d.postTransition=!1}))};d.$watch(f.collapse,function(a){a?l():k()})}}}]).directive("attAccord",function(){return{restrict:"EA",transclude:!0,replace:!0,scope:{},controller:"AttAccordCtrl",templateUrl:"app/scripts/ng_js_att_tpls/accordion/attAccordHeader.html"}}).controller("AttAccordCtrl",[function(){this.type="attAccord",this.headerCtrl,this.bodyCtrl;var a=!0;this.toggleBody=function(){a?this.expandBody():this.collapseBody(),a=!a},this.expandBody=function(){this.bodyCtrl.expand()},this.collapseBody=function(){this.bodyCtrl.collapse()}}]).controller("AttAccordHeaderCtrl",[function(){this.type="header"}]).directive("attAccordHeader",["keymap","events",function(a,b){return{restrict:"EA",transclude:!0,replace:!0,require:["^attAccord","attAccordHeader"],controller:"AttAccordHeaderCtrl",templateUrl:"app/scripts/ng_js_att_tpls/accordion/attAccordHeader.html",link:function(b,c,d,e){var f=e[0],g=e[1];f.headerCtrl=g;var h=c.children().eq(0);b.clickFunc=function(){f.toggleBody()};var i=function(c){var d=!0;switch(c.keyCode){case a.KEY.ENTER:c.preventDefault(),b.clickFunc(),b.$apply();break;default:d=!1}return c.stopPropagation(),d};angular.isUndefined(b.isOpen)&&(b.isOpen=!1),h.bind("keydown",i)}}}]).controller("AttAccordBodyCtrl",["$scope",function(a){this.type="body",this.expand=function(){a.expand()},this.collapse=function(){a.collapse()}}]).directive("attAccordBody",["$timeout","$height",function(a,b){return{restrict:"EA",transclude:!0,replace:!0,require:["^attAccord","attAccordBody"],controller:"AttAccordBodyCtrl",templateUrl:"app/scripts/ng_js_att_tpls/accordion/attAccordBody.html",link:function(c,d,e,f){var g=f[0],h=f[1];g.bodyCtrl=h;var i;a(function(){i=d[0].offsetHeight,b(d,0,0,0)}),c.expand=function(){b(d,.05,i,1)},c.collapse=function(){b(d,.25,0,0)}}}}]),angular.module("att.abs.alert",[]).directive("attAlert",[function(){return{restrict:"EA",replace:!0,transclude:!0,scope:{alertType:"@type",showTop:"@topPos",showAlert:"="},templateUrl:"app/scripts/ng_js_att_tpls/alert/alert.html",link:function(a){"true"===a.showTop?a.cssStyle={top:"50px"}:a.cssStyle={top:"0px"},a.close=function(){a.showAlert=!1}}}}]),angular.module("att.abs.boardStrip",["att.abs.utilities"]).constant("BoardStripConfig",{maxVisibleBoards:4,boardsToScroll:1,boardLength:140,boardMargin:15}).directive("attBoard",[function(){return{restrict:"AE",replace:!0,transclude:!0,require:"^attBoardStrip",scope:{boardIndex:"=",boardLabel:"="},templateUrl:"app/scripts/ng_js_att_tpls/boardStrip/attBoard.html",link:function(a,b,c,d){var e=d;a.getCurrentIndex=function(){return e.getCurrentIndex()},a.selectBoard=function(a){isNaN(a)||e.setCurrentIndex(a)},a.isInView=function(a){return e.isInView(a)}}}}]).directive("attBoardStrip",["BoardStripConfig","$timeout","$ieVersion",function(a,b,c){return{restrict:"AE",replace:!0,transclude:!0,scope:{currentIndex:"=selectedIndex",boardsMasterArray:"=",onAddBoard:"&?"},templateUrl:"app/scripts/ng_js_att_tpls/boardStrip/attBoardStrip.html",controller:function(b){if(angular.isDefined(b.boardsMasterArray)||(b.boardsMasterArray=[]),this.rectifyMaxVisibleBoards=function(){this.maxVisibleIndex>=b.boardsMasterArray.length&&(this.maxVisibleIndex=b.boardsMasterArray.length-1),this.maxVisibleIndex<0&&(this.maxVisibleIndex=0)},this.resetBoardStrip=function(){b.currentIndex=0,this.maxVisibleIndex=a.maxVisibleBoards-1,this.minVisibleIndex=0,this.rectifyMaxVisibleBoards()},b.currentIndex>0){var c=b.currentIndex;this.resetBoardStrip(),c>b.boardsMasterArray.length?b.currentIndex=b.boardsMasterArray.length-1:b.currentIndex=c}else this.resetBoardStrip();this.getCurrentIndex=function(){return b.currentIndex},this.setCurrentIndex=function(a){b.currentIndex=a},this.isInView=function(a){return a<=this.maxVisibleIndex&&a>=this.minVisibleIndex},this.getBoardsMasterArrayLength=function(){return b.boardsMasterArray.length}},link:function(d,e,f,g){var h,i=c(),j=1e3;i&&10>i&&(j=0);var k=function(b){return b*(a.boardLength+a.boardMargin)};e[0].querySelector(".board-viewport")&&angular.element(e[0].querySelector(".board-viewport")).css({width:k(a.maxVisibleBoards)+"px"});var l=function(b){return b*(a.boardLength+a.boardMargin)};e[0].querySelector(".boardstrip-container")&&(angular.element(e[0].querySelector(".boardstrip-container")).css({width:l(g.getBoardsMasterArrayLength())+"px"}),angular.element(e[0].querySelector(".boardstrip-container")).css({left:"0px"}));var m=function(){var b;return b=g.getBoardsMasterArrayLength()<=a.maxVisibleBoards?0:g.minVisibleIndex*(a.boardLength+a.boardMargin)*-1},n=function(a,b,c){for(var d=0;d<a.length;d++)angular.element(a[d]).attr("tabindex","-1");for(var d=b;c>=d;d++)angular.element(a[d]).attr("tabindex","0")};d.$watchCollection("boardsMasterArray",function(c,d){c!==d&&(c.length<d.length?(g.resetBoardStrip(),b(function(){var a=e[0].querySelectorAll("[att-board]");if(0!==a.length){var c=angular.element(e[0].querySelector(".boardstrip-container"))[0].style.left,d=m();c!==d+"px"?(angular.element(e[0].querySelector(".boardstrip-container")).css({left:d+"px"}),b.cancel(h),h=b(function(){a[0].focus()},j)):a[0].focus()}else e[0].querySelector("div.boardstrip-item--add").focus();angular.element(e[0].querySelector(".boardstrip-container")).css({width:l(g.getBoardsMasterArrayLength())+"px"})})):(g.maxVisibleIndex=g.getBoardsMasterArrayLength()-1,g.minVisibleIndex=Math.max(g.maxVisibleIndex-a.maxVisibleBoards+1,0),g.setCurrentIndex(g.maxVisibleIndex),b(function(){angular.element(e[0].querySelector(".boardstrip-container")).css({width:l(g.getBoardsMasterArrayLength())+"px"});var a=angular.element(e[0].querySelector(".boardstrip-container"))[0].style.left,c=m(),d=e[0].querySelectorAll("[att-board]");a!==c+"px"?(angular.element(e[0].querySelector(".boardstrip-container")).css({left:c+"px"}),b.cancel(h),h=b(function(){d[d.length-1].focus()},j)):d[d.length-1].focus(),n(d,g.minVisibleIndex,g.maxVisibleIndex)})))}),d.nextBoard=function(){g.maxVisibleIndex+=a.boardsToScroll,g.rectifyMaxVisibleBoards(),g.minVisibleIndex=g.maxVisibleIndex-(a.maxVisibleBoards-1),b.cancel(h),angular.element(e[0].querySelector(".boardstrip-container")).css({left:m()+"px"}),b(function(){var a=e[0].querySelectorAll("[att-board]");if(n(a,g.minVisibleIndex,g.maxVisibleIndex),!d.isNextBoard())try{a[a.length-1].focus()}catch(b){}},j)},d.prevBoard=function(){g.minVisibleIndex-=a.boardsToScroll,g.minVisibleIndex<0&&(g.minVisibleIndex=0),g.maxVisibleIndex=g.minVisibleIndex+a.maxVisibleBoards-1,g.rectifyMaxVisibleBoards(),b.cancel(h),angular.element(e[0].querySelector(".boardstrip-container")).css({left:m()+"px"}),b(function(){var a=e[0].querySelectorAll("[att-board]");if(n(a,g.minVisibleIndex,g.maxVisibleIndex),
+0===g.minVisibleIndex)try{e[0].querySelector("div.boardstrip-item--add").focus()}catch(b){}})},d.isPrevBoard=function(){return g.minVisibleIndex>0},d.isNextBoard=function(){return g.getBoardsMasterArrayLength()-1>g.maxVisibleIndex}}}}]).directive("attAddBoard",["BoardStripConfig","$parse","$timeout",function(a,b,c){return{restrict:"AE",replace:!0,require:"^attBoardStrip",scope:{onAddBoard:"&?"},templateUrl:"app/scripts/ng_js_att_tpls/boardStrip/attAddBoard.html",link:function(a,c,d,e){a.addBoard=function(){d.onAddBoard&&(a.onAddBoard=b(a.onAddBoard),a.onAddBoard())}}}}]).directive("attBoardNavigation",["keymap","events",function(a,b){return{restrict:"AE",link:function(c,d){var e=a.KEY.LEFT,f=a.KEY.RIGHT;d.bind("keydown",function(a){switch(a.keyCode||(a.keyCode=a.which),a.keyCode){case f:if(b.preventDefault(a),b.stopPropagation(a),d[0].nextElementSibling&&parseInt(angular.element(d[0].nextElementSibling).attr("tabindex"))>=0)angular.element(d[0])[0].nextElementSibling.focus();else{var c=angular.element(d[0])[0];do{if(!c.nextSibling)break;c=c.nextSibling}while(c&&"LI"!==c.tagName);c.tagName&&"LI"===c.tagName&&parseInt(angular.element(c).attr("tabindex"))>=0&&c.focus()}break;case e:if(b.preventDefault(a),b.stopPropagation(a),d[0].previousElementSibling&&parseInt(angular.element(d[0].previousElementSibling).attr("tabindex"))>=0)angular.element(d[0])[0].previousElementSibling.focus();else{var g=angular.element(d[0])[0];do{if(!g.previousSibling)break;g=g.previousSibling}while(g&&"LI"!==g.tagName);g.tagName&&"LI"===g.tagName&&parseInt(angular.element(c).attr("tabindex"))>=0&&g.focus()}}})}}}]),angular.module("att.abs.breadCrumbs",[]).constant("classConstant",{defaultClass:"breadcrumbs__link",activeClass:"breadcrumbs__link--active"}).directive("attCrumb",["classConstant",function(a){return{restrict:"A",link:function(b,c,d){c.addClass(a.defaultClass),"active"===d.attCrumb&&c.addClass(a.activeClass),c.hasClass("last")||c.after('<i class="breadcrumbs__item"></i>')}}}]),angular.module("att.abs.buttons",["att.abs.position","att.abs.utilities"]).constant("btnConfig",{btnClass:"button",btnPrimaryClass:"button--primary",btnSecondaryClass:"button--secondary",btnDisabledClass:"button--inactive",btnSmallClass:"button--small"}).directive("attButton",["btnConfig",function(a){return{restrict:"A",link:function(b,c,d){c.addClass(a.btnClass),"small"===d.size&&c.addClass(a.btnSmallClass),d.$observe("btnType",function(b){"primary"===b?(c.addClass(a.btnPrimaryClass),c.removeClass(a.btnSecondaryClass),c.removeClass(a.btnDisabledClass),c.removeAttr("disabled")):"secondary"===b?(c.addClass(a.btnSecondaryClass),c.removeClass(a.btnPrimaryClass),c.removeClass(a.btnDisabledClass),c.removeAttr("disabled")):"disabled"===b&&(c.addClass(a.btnDisabledClass),c.removeClass(a.btnPrimaryClass),c.removeClass(a.btnSecondaryClass),c.attr("disabled","disabled"))})}}}]).directive("attButtonLoader",[function(){return{restrict:"A",replace:!1,scope:{size:"@"},template:"<div ng-class=\"{'button--loading': size === 'large','button--loading__small': size === 'small'}\"><i></i><i class=\"second__loader\"></i><i></i></div>",link:function(a,b){b.addClass("button button--inactive")}}}]).directive("attButtonHero",[function(){return{restrict:"A",replace:!1,transclude:!0,scope:{icon:"@"},template:"<div class=\"button--hero__inner\"><span ng-transclude></span> <i ng-class=\"{'icon-arrow-right': icon === 'arrow-right','icon-cart': icon === 'cart'}\"></i></div>",link:function(a,b){b.addClass("button button--hero"),b.attr("tabindex","0")}}}]).directive("attBtnDropdown",["$document","$timeout","$isElement","$documentBind","keymap","events",function(a,b,c,d,e,f){return{restrict:"EA",scope:{type:"@dropdowntype"},replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/buttons/buttonDropdown.html",link:function(g,h){g.isOpen=!1;var i=-1,j=[],k=void 0;b(function(){j=h.find("li"),k=h.find("button")[0]},10);var l=g.toggle=function(a){angular.isUndefined(a)||""===a?g.isOpen=!g.isOpen:g.isOpen=a},m=function(){i+1<j.length&&(i++,j[i].focus())},n=function(){i-1>=0&&(i--,j[i].focus())};h.bind("keydown",function(a){var b=a.keyCode;if(e.isAllowedKey(b)||e.isControl(a)||e.isFunctionKey(a))switch(b){case e.KEY.ENTER:i>0&&(k.focus(),g.$apply());break;case e.KEY.ESC:l(!1),i=-1,k.focus(),g.$apply();break;case e.KEY.DOWN:m(),g.$apply(),f.preventDefault(a),f.stopPropagation(a);break;case e.KEY.UP:n(),g.$apply(),f.preventDefault(a),f.stopPropagation(a)}else b===e.KEY.TAB&&(l(!1),i=-1,g.$apply())});var o=function(b){var d=c(angular.element(b.target),h,a);if(!d){l(!1),i=-1;for(var e=0;e<j.length;e++)angular.element(j[e]).removeClass("selected");k.focus(),g.$apply()}};d.click("isOpen",o,g)}}}]),angular.module("att.abs.checkbox",[]).constant("attCheckboxConfig",{activeClass:"att-checkbox--on",disabledClass:"att-checkbox--disabled"}).directive("checkboxLimit",function(){return{scope:{checkboxLimit:"=",selectLimit:"@?",maxSelected:"&?"},restrict:"A",require:"checkboxLimit",controller:["$scope",function(a){a.limit=!0,this.getMaxLimits=function(){return a.limit},this.setMaxLimits=function(b){a.limit=b},this.maxCheckboxSelected=function(){a.maxSelected()}}],link:function(a,b,c,d){a.$watch("checkboxLimit",function(){var b=0;for(var c in a.checkboxLimit)a.checkboxLimit.hasOwnProperty(c)&&a.checkboxLimit[c]&&(b+=1);b>=parseInt(a.selectLimit)?d.setMaxLimits(!1):d.setMaxLimits(!0)},!0)}}}).directive("attCheckbox",["$compile","attCheckboxConfig",function(a,b){return{scope:{},restrict:"A",require:["ngModel","^?checkboxLimit"],link:function(c,d,e,f){var g=f[0],h=f[1],i=a('<div tabindex="0" role="checkbox" att-accessibility-click="13,32" aria-label="Checkbox" ng-click="updateModel($event)" class="att-checkbox"></div>')(c);d.css({display:"none"}),d.wrap(i),d.parent().append('<div class="att-checkbox__indicator"></div>'),d.parent().attr("title",e.title),d.parent().attr("aria-label",e.title),d.parent().attr("id",e.id),d.removeAttr("id"),g.$render=function(){var a=g.$modelValue?!0:!1;d.parent().toggleClass(b.activeClass,a),d.parent().attr("aria-checked",a)},c.updateModel=function(a){c.disabled||(g.$setViewValue(d.parent().hasClass(b.activeClass)?!1:!0),h&&!h.getMaxLimits()&&g.$modelValue?(h.maxCheckboxSelected(),g.$setViewValue(d.parent().hasClass(b.activeClass)?!0:!1)):g.$render()),a.preventDefault()},e.$observe("disabled",function(a){c.disabled=a||"disabled"===a||"true"===a,d.parent().toggleClass(b.disabledClass,c.disabled),d.parent().attr("tabindex",c.disabled?"-1":"0")})}}}]).directive("checkboxGroup",["$compile",function(a){return{scope:{checkboxGroup:"=",checkboxGroupValue:"=?"},restrict:"A",link:function(b,c,d){b.checkboxState="none",void 0===b.checkboxGroupValue&&(b.checkboxGroupValue="indeterminate"),c.css({display:"none"}),c.wrap(a('<div tabindex="0" role="checkbox" att-accessibility-click="13,32" ng-click="updateModel($event)" class="att-checkbox"></div>')(b)),c.parent().append('<div class="att-checkbox__indicator"></div>'),c.parent().attr("title",d.title),c.parent().attr("aria-label",d.title),b.$watch("checkboxState",function(a){"all"===a?(c.parent().addClass("att-checkbox--on"),c.parent().removeClass("att-checkbox--indeterminate"),c.parent().attr("aria-checked",!0)):"none"===a?(c.parent().removeClass("att-checkbox--on"),c.parent().removeClass("att-checkbox--indeterminate"),c.parent().attr("aria-checked",!1)):"indeterminate"===a&&(c.parent().removeClass("att-checkbox--on"),c.parent().addClass("att-checkbox--indeterminate"),c.parent().attr("aria-checked",!0))}),b.updateModel=function(a){if(c.parent().hasClass("att-checkbox--on")){c.parent().removeClass("att-checkbox--on");for(var d in b.checkboxGroup)b.checkboxGroup.hasOwnProperty(d)&&(b.checkboxGroup[d]=!1)}else{c.parent().addClass("att-checkbox--on");for(var e in b.checkboxGroup)b.checkboxGroup.hasOwnProperty(e)&&(b.checkboxGroup[e]=!0)}a.preventDefault()},b.$watch("checkboxGroupValue",function(a){if(a===!1){c.parent().removeClass("att-checkbox--on");for(var d in b.checkboxGroup)b.checkboxGroup.hasOwnProperty(d)&&(b.checkboxGroup[d]=!1)}else if(a===!0){c.parent().addClass("att-checkbox--on");for(var e in b.checkboxGroup)b.checkboxGroup.hasOwnProperty(e)&&(b.checkboxGroup[e]=!0)}}),b.$watch("checkboxGroup",function(){var a=0,c=0,d=0;for(var e in b.checkboxGroup)b.checkboxGroup.hasOwnProperty(e)&&(d+=1,b.checkboxGroup[e]?a+=1:b.checkboxGroup[e]||(c+=1));d===a?(b.checkboxState="all",b.checkboxGroupValue=!0):d===c?(b.checkboxState="none",b.checkboxGroupValue=!1):(b.checkboxState="indeterminate",b.checkboxGroupValue="indeterminate")},!0)}}}]),angular.module("att.abs.colorselector",[]).directive("colorSelectorWrapper",[function(){return{scope:{selected:"=",iconColor:"@"},restrict:"AE",transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/colorselector/colorselector.html",link:function(a){a.applycolor={"background-color":a.iconColor},a.selectedcolor=function(b){a.selected=b}}}}]).directive("colorSelector",["$compile",function(a){return{restrict:"A",scope:{colorSelector:"@",ngModel:"="},link:function(b,c,d){c.removeAttr("color-selector");var e=d.title,f=angular.element('<color-selector-wrapper selected="ngModel" title="'+e+'" icon-color="{{colorSelector}}">'+c.prop("outerHTML")+"</color-selector-wrapper>"),g=a(f)(b);c.replaceWith(g)}}}]),angular.module("att.abs.datepicker",["att.abs.position","att.abs.utilities"]).constant("datepickerConfig",{dateFormat:"MM/dd/yyyy",dayFormat:"d",monthFormat:"MMMM",yearFormat:"yyyy",dayHeaderFormat:"EEEE",dayTitleFormat:"MMMM yyyy",disableWeekend:!1,disableSunday:!1,startingDay:0,minDate:null,maxDate:null,mode:0,dateFilter:{defaultText:"Select from list"},datepickerEvalAttributes:["dateFormat","dayFormat","monthFormat","yearFormat","dayHeaderFormat","dayTitleFormat","disableWeekend","disableSunday","startingDay","mode"],datepickerWatchAttributes:["min","max"]}).factory("datepickerService",["datepickerConfig","dateFilter",function(a,b){var c=function(b,c){if(angular.isDefined(b)&&null!==b&&angular.isDefined(c)&&null!==c){var d=a.datepickerEvalAttributes.concat(a.datepickerWatchAttributes);for(var e in b){var f=b[e];-1!==d.indexOf(e)&&angular.isDefined(f)&&c.attr(e.toSnakeCase(),e)}}},d=function(b,c){if(angular.isDefined(b)&&null!==b&&angular.isDefined(c)&&null!==c){var d=function(a,b){c[a]=c.$parent.$eval(b)},e=function(a,b){c.$parent.$watch(b,function(b){c[a]=b}),c.$watch(a,function(a){c.$parent[b]=a})},f=a.datepickerEvalAttributes,g=a.datepickerWatchAttributes;for(var h in b){var i=b[h];-1!==f.indexOf(h)&&angular.isDefined(i)?d(h,i):-1!==g.indexOf(h)&&angular.isDefined(i)&&e(h,i)}}},e=function(a,c){if(a&&c){var d;-1!==c.indexOf("/")?d="/":-1!==c.indexOf("-")?d="-":-1!==c.indexOf(".")&&(d=".");var e=a.split(d),f=c.split(d);if(e.length!==f.length)return!1;for(var g=0;g<e.length;g++)e[g]=e[g].lPad(f[g].length,"0");var h=e.join(d),i=b(new Date(h),c);return h===i}};return{setAttributes:c,bindScope:d,validateDateString:e}}]).controller("DatepickerController",["$scope","$attrs","dateFilter","datepickerConfig",function(a,b,c,d){function e(b,c){return angular.isDefined(b)?a.$parent.$eval(b):c}function f(a,b){return new Date(a,b,0).getDate()}function g(a,b){for(var c=[],d=a,e=0;b>e;)c[e++]=new Date(d),d.setDate(d.getDate()+1);return c}function h(b){return b&&angular.isDate(a.currentDate)&&0===u(b,a.currentDate)?!0:!1}function i(b){return b&&angular.isDate(a.fromDate)&&0===u(b,a.fromDate)?!0:!1}function j(b){return b&&angular.isDate(a.fromDate)&&angular.isDate(a.currentDate)&&0===u(b,a.currentDate)?!0:!1}function k(b){return b&&angular.isDate(a.fromDate)&&angular.isDate(a.currentDate)&&u(b,a.fromDate)>=0&&u(b,a.currentDate)<=0?!0:!1}function l(a){return"Saturday"===c(a,s.dayHeader)||"Sunday"===c(a,s.dayHeader)?!0:!1}function m(b){return 0===u(b,a.resetTime(new Date))?!0:!1}function n(b){return b&&angular.isDate(a.focusedDate)&&0===u(b,a.focusedDate)?!0:!1}function o(b,c){return a.minDate&&a.minDate.getTime()>=b.getTime()&&a.minDate.getTime()<=c.getTime()}function p(b,c){return a.maxDate&&a.maxDate.getTime()>=b.getTime()&&a.maxDate.getTime()<=c.getTime()}function q(a){if(a){var b={pre:a.substr(0,3),post:a};return b}}function r(a){return{date:a.date,label:c(a.date,a.formatDay),header:c(a.date,a.formatHeader),focused:!!a.isFocused,selected:!!a.isSelected,from:!!a.isFromDate,to:!!a.isToDate,dateRange:!!a.isDateRange,oldMonth:!!a.oldMonth,nextMonth:!!a.newMonth,disabled:!!a.isDisabled,today:!!a.isToday,weekend:!!a.isWeakend}}var s={date:e(b.dateFormat,d.dateFormat),day:e(b.dayFormat,d.dayFormat),month:e(b.monthFormat,d.monthFormat),year:e(b.yearFormat,d.yearFormat),dayHeader:e(b.dayHeaderFormat,d.dayHeaderFormat),dayTitle:e(b.dayTitleFormat,d.dayTitleFormat),disableWeekend:e(b.disableWeekend,d.disableWeekend),disableSunday:e(b.disableSunday,d.disableSunday)},t=e(b.startingDay,d.startingDay);a.mode=e(b.mode,d.mode),a.minDate=d.minDate?a.resetTime(d.minDate):null,a.maxDate=d.maxDate?a.resetTime(d.maxDate):null;var u=this.compare=function(a,b){return new Date(a.getFullYear(),a.getMonth(),a.getDate())-new Date(b.getFullYear(),b.getMonth(),b.getDate())},v=this.isDisabled=function(b){return s.disableWeekend!==!0||"Saturday"!==c(b,s.dayHeader)&&"Sunday"!==c(b,s.dayHeader)?s.disableSunday===!0&&"Sunday"===c(b,s.dayHeader)?!0:a.minDate&&u(b,a.minDate)<0||a.maxDate&&u(b,a.maxDate)>0:!0};this.modes=[{name:"day",getVisibleDates:function(b,d){var e=b.getFullYear(),u=b.getMonth(),w=new Date(e,u,1),x=new Date(e,u+1,0),y=t-w.getDay(),z=y>0?7-y:-y,A=new Date(w),B=0;z>0&&(A.setDate(-z+1),B+=z),B+=f(e,u+1),B+=(7-B%7)%7;for(var C=g(A,B),D=[],E=0;B>E;E++){var F=new Date(C[E]);C[E]=r({date:F,formatDay:s.day,formatHeader:s.dayHeader,isFocused:n(F),isSelected:h(F),isFromDate:i(F),isToDate:j(F),isDateRange:k(F),oldMonth:new Date(F.getFullYear(),F.getMonth(),1,0,0,0).getTime()<new Date(e,u,1,0,0,0).getTime(),newMonth:new Date(F.getFullYear(),F.getMonth(),1,0,0,0).getTime()>new Date(e,u,1,0,0,0).getTime(),isDisabled:v(F),isToday:m(F),isWeakend:l(F)})}for(var G=0;7>G;G++)D[G]=q(c(C[G].date,s.dayHeader));return"top"===d?(a.disablePrevTop=o(w,x),a.disableNextTop=p(w,x)):"bottom"===d?(a.disablePrevBottom=o(w,x),a.disableNextBottom=p(w,x)):(a.disablePrevTop=a.disablePrevBottom=o(w,x),a.disableNextTop=a.disableNextBottom=p(w,x)),a.disablePrev=a.disablePrevTop||a.disablePrevBottom,a.disableNext=a.disableNextTop||a.disableNextBottom,{objects:C,title:c(b,s.dayTitle),labels:D}},split:7,step:{months:1}},{name:"month",getVisibleDates:function(a){for(var b=[],d=[],e=a.getFullYear(),f=0;12>f;f++){var g=new Date(e,f,1);b[f]=r({date:g,formatDay:s.month,formatHeader:s.month,isFocused:n(g),isSelected:h(g),isFromDate:i(g),isToDate:j(g),isDateRange:k(g),oldMonth:!1,newMonth:!1,isDisabled:v(g),isToday:m(g),isWeakend:!1})}return{objects:b,title:c(a,s.year),labels:d}},split:3,step:{years:1}}]}]).directive("datepicker",["$timeout",function(a){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/datepicker/datepicker.html",scope:{currentDate:"=?current",fromDate:"=?from"},require:"datepicker",controller:"DatepickerController",link:function(b,c,d,e){function f(a,b){for(var c=[];a.length>0;)c.push(a.splice(0,b));return c}function g(a){if(angular.isDate(a)&&!isNaN(a)?h=new Date(a):h||(h=new Date),h){var c;1===b.mode?(h=new Date,c=k(angular.copy(h),-1)):c=angular.copy(h);var d=i.modes[b.mode],e=d.getVisibleDates(c,"top");b.currentRows=f(e.objects,d.split),b.currentTitle=e.title,b.labels=e.labels||[];var g=d.getVisibleDates(k(angular.copy(c),1),"bottom");b.nextRows=f(g.objects,d.split),b.nextTitle=g.title}}var h,i=e,j=!1;b.focusedDate,b.resetTime=function(a){var c;return isNaN(new Date(a))?null:(c=new Date(a),c=1===b.mode?new Date(c.getFullYear(),c.getMonth()):new Date(c.getFullYear(),c.getMonth(),c.getDate()))},d.min&&b.$parent.$watch(d.min,function(a){b.minDate=a?b.resetTime(a):null,g()}),d.max&&b.$parent.$watch(d.max,function(a){b.maxDate=a?b.resetTime(a):null,g()});var k=function(a,c){var d=i.modes[b.mode].step;return a.setDate(1),a.setMonth(a.getMonth()+c*(d.months||0)),a.setFullYear(a.getFullYear()+c*(d.years||0)),a},l=function(a){var c=new Date(a.getFullYear(),a.getMonth(),a.getDate());b.currentDate=c},m=function(a){var c=new Date(a.getFullYear(),a.getMonth(),a.getDate());b.fromDate=c};b.select=function(a){j=!0,d.from?angular.isDate(b.fromDate)&&angular.isDate(b.currentDate)||(angular.isDate(b.fromDate)?l(a):angular.isDate(b.fromDate)||m(a)):l(a),b.focusedDate=a};var n=function(c,d){m(d),a(function(){j=!0,b.focusedDate=d,l(c)})};b.move=function(a){h=k(angular.copy(h),a),g()},b.$watch("currentDate",function(a){return angular.isDate(a)&&!isNaN(a)&&i.isDisabled(a)?void(b.currentDate=null):d.from&&!isNaN(a)&&!isNaN(b.fromDate)&&i.compare(a,b.fromDate)<0?void n(b.fromDate,a):(j?(g(),j=!1):angular.isDefined(a)&&null!==a?g(a):g(),void(b.focusedDate=void 0))}),b.$watch("fromDate",function(a){if(angular.isDate(a)&&!isNaN(a)&&i.isDisabled(a))return void(b.fromDate=null);if(d.from){if(!isNaN(b.currentDate)&&!isNaN(a)&&i.compare(b.currentDate,a)<0)return void n(a,b.currentDate);j?(g(),j=!1):angular.isDefined(a)&&null!==a?g(a):g()}b.focusedDate=void 0})}}}]).directive("datepickerPopup",["$document","datepickerService","$isElement","$documentBind",function(a,b,c,d){var e=function(e,f,g){b.bindScope(g,e),e.isOpen=!1;var h=e.toggle=function(a){a===!0||a===!1?e.isOpen=a:e.isOpen=!e.isOpen};e.$watch("current",function(){h(!1)});var i=function(b){var d=c(angular.element(b.target),f,a);d||(h(!1),e.$apply())};d.click("isOpen",i,e)};return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/datepicker/datepickerPopup.html",scope:{current:"=current"},compile:function(a,c){var d=a.find("span").eq(1);return d.attr("current","current"),b.setAttributes(c,d),e}}}]).directive("attDatepicker",["$log",function(a){return{restrict:"A",require:"ngModel",scope:{},controller:["$scope","$element","$attrs","$compile","datepickerConfig","datepickerService",function(a,b,c,d,e,f){var g=angular.isDefined(c.dateFormat)?a.$parent.$eval(c.dateFormat):e.dateFormat,h='<div class="sr-focus hidden-spoken" tabindex="-1">the date you selected is {{$parent.current | date : \''+g+"'}}</div>";b.removeAttr("att-datepicker"),b.removeAttr("ng-model"),b.attr("ng-model","$parent.current"),b.attr("aria-describedby","datepicker"),b.attr("format-date",g),b.attr("att-input-deny","[^0-9/-]"),b.attr("maxlength",10);var i=angular.element("<div></div>");i.attr("datepicker-popup",""),i.attr("current","current"),f.setAttributes(c,i),f.bindScope(c,a),i.html(""),i.append(b.prop("outerHTML")),null===navigator.userAgent.match(/MSIE 8/)&&i.append(h);var j=i.prop("outerHTML");j=d(j)(a),b.replaceWith(j)}],link:function(b,c,d,e){return e?(b.$watch("current",function(a){e.$setViewValue(a)}),void(e.$render=function(){b.current=e.$viewValue})):void a.error("ng-model is required.")}}}]).directive("formatDate",["dateFilter","datepickerService",function(a,b){return{restrict:"A",require:"ngModel",link:function(c,d,e,f){var g="";e.$observe("formatDate",function(a){g=a});var h=function(b){return b?(f.$setValidity("invalidDate",!0),a(b,g)):(f.$setValidity("invalidDate",!1),d.val())},i=function(a){return b.validateDateString(a,g)?(f.$setValidity("invalidDate",!0),new Date(a)):(f.$setValidity("invalidDate",!1),null)};f.$formatters.unshift(h),f.$parsers.unshift(i)}}}]).directive("attDateFilter",["$document","dateFilter","datepickerConfig","datepickerService","$isElement","$documentBind",function(a,b,c,d,e,f){var g=function(g,h,i,j){d.bindScope(i,g),g.selectedOption=c.dateFilter.defaultText,g.showDropdownList=!1,g.showCalendar=!1,g.applyButtonType="disabled",g.currentSelection="";var k=angular.isDefined(i.dateFormat)?g.$parent.$eval(i.dateFormat):c.dateFormat,l=!1,m=function(a){if(!l){var c=k.toUpperCase(),d=k.toUpperCase();isNaN(new Date(g.fromDate))||(c=b(g.fromDate,k)),isNaN(new Date(g.currentDate))||(d=b(g.currentDate,k)),"Custom Single Date"===a?(j.$setValidity("invalidDate",!0),g.maxLength=10,g.selectedOption=d):"Custom Range"===a&&(j.$setValidity("invalidDate",!0),j.$setValidity("invalidDateRange",!0),g.maxLength=21,g.selectedOption=c+"-"+d)}},n=g.clear=function(a){g.fromDate=void 0,g.currentDate=void 0,g.applyButtonType="disabled",a||(j.$setValidity("invalidDate",!0),j.$setValidity("invalidDateRange",!0),m(g.currentSelection))},o=function(){g.showCalendar=!0},p=function(){g.showCalendar=!1,"Custom Single Date"!==g.currentSelection&&"Custom Range"!==g.currentSelection&&n(!0)},q=g.showDropdown=function(a){a===!0||a===!1?g.showDropdownList=a:g.showDropdownList=!g.showDropdownList,g.showDropdownList?("Custom Single Date"===g.currentSelection||"Custom Range"===g.currentSelection)&&o():(g.focusInputButton=!0,p())};g.resetTime=function(a){var b;return isNaN(new Date(a))?null:(b=new Date(a),new Date(b.getFullYear(),b.getMonth(),b.getDate()))},g.getDropdownText=function(){l=!0;var a=g.selectedOption;if("Custom Single Date"===g.currentSelection)!isNaN(new Date(a))&&d.validateDateString(a,k)?(j.$setValidity("invalidDate",!0),g.fromDate=void 0,g.currentDate=new Date(a)):(j.$setValidity("invalidDate",!1),n(!0));else if("Custom Range"===g.currentSelection)if(-1===a.indexOf("-")||2!==a.split("-").length&&6!==a.split("-").length)j.$setValidity("invalidDateRange",!1),n(!0);else{j.$setValidity("invalidDateRange",!0);var b=a.split("-");if(2===b.length)b[0]=b[0].trim(),b[1]=b[1].trim();else if(6===b.length){var c=b[0].trim()+"-"+b[1].trim()+"-"+b[2].trim(),e=b[3].trim()+"-"+b[4].trim()+"-"+b[5].trim();b[0]=c,b[1]=e}if(!isNaN(new Date(b[0]))&&!isNaN(new Date(b[1]))&&d.validateDateString(b[0],k)&&d.validateDateString(b[1],k)){j.$setValidity("invalidDate",!0);var f=new Date(b[0]),h=new Date(b[1]);f.getTime()<h.getTime()?(j.$setValidity("invalidDateRange",!0),g.fromDate=f,g.currentDate=h):(j.$setValidity("invalidDateRange",!1),n(!0))}else j.$setValidity("invalidDate",!1),n(!0)}},g.untrackInputChange=function(){l=!1},g.selectAdvancedOption=function(a,b){g.currentSelection=a,b||(n(),o()),g.$watch("currentDate",function(b){isNaN(new Date(b))||(g.applyButtonType="primary",m(a),l||(g.focusApplyButton=!0))}),g.$watch("fromDate",function(b){isNaN(new Date(b))||m(a)}),"Custom Single Date"===a?g.focusSingleDateCalendar=!0:"Custom Range"===a&&(g.focusRangeCalendar=!0)},g.resetFocus=function(){g.focusSingleDateCalendar=!1,g.focusRangeCalendar=!1,g.focusApplyButton=!1},g.apply=function(){g.dateRange.selection=g.selectedOption,isNaN(new Date(g.fromDate))?(g.from=void 0,g.dateRange.from=void 0):(g.from=g.fromDate,g.dateRange.from=g.fromDate),isNaN(new Date(g.currentDate))?(g.current=void 0,g.dateRange.current=void 0):(g.current=g.currentDate,g.dateRange.current=g.currentDate),q()},g.$watchCollection(function(){return g.dateRange},function(a){if(j){var b=angular.copy(a);j.$setViewValue(b)}}),j.$render=function(){if(j.$viewValue){var a=j.$viewValue;g.selectedOption=a.selection,g.fromDate=a.from,g.currentDate=a.current,void 0!==g.fromDate&&void 0!==g.currentDate?(g.selectAdvancedOption("Custom Range",!0),g.dateRange.from=g.fromDate,g.dateRange.current=g.currentDate):void 0!==g.currentDate&&(g.selectAdvancedOption("Custom Single Date",!0),g.dateRange.from=void 0,g.dateRange.current=g.currentDate)}},g.cancel=function(){g.currentSelection="",g.selectedOption=c.dateFilter.defaultText,q()};var r=function(b){var c=e(angular.element(b.target),h,a);c||(g.cancel(),g.$apply())};f.click("showDropdownList",r,g)};return{restrict:"EA",scope:{from:"=?from",current:"=?current"},replace:!0,require:"?ngModel",transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/datepicker/dateFilter.html",controller:["$scope","$element","$attrs",function(a){a.dateRange={selection:void 0,from:void 0,current:void 0},this.selectOption=function(b,c,d){a.selectedOption=d,a.currentSelection=d,a.dateRange.selection=d,a.dateRange.current=a.resetTime(c),a.dateRange.from=a.resetTime(b),a.showDropdown()},a.checkCurrentSelection=this.checkCurrentSelection=function(b){return b===a.currentSelection?!0:!1}}],compile:function(a,b){var c=a.find("span").eq(4),e=a.find("span").eq(5);return e.attr("from","fromDate"),c.attr("current","currentDate"),e.attr("current","currentDate"),d.setAttributes(b,c),d.setAttributes(b,e),g}}}]).directive("attDateFilterList",function(){return{restrict:"EA",scope:{fromDate:"=fromDate",toDate:"=toDate",caption:"=caption",disabled:"=disabled"},require:"^attDateFilter",transclude:!0,replace:!0,templateUrl:"app/scripts/ng_js_att_tpls/datepicker/dateFilterList.html",link:function(a,b,c,d){a.selectOption=function(a,b,c){d.selectOption(a,b,c)},a.checkCurrentSelection=d.checkCurrentSelection}}}),angular.module("att.abs.devNotes",[]).directive("attDevNotes",function(){return{restrict:"EA",transclude:!0,scope:{},controller:function(a){var b=a.panes=[];a.select=function(a){angular.forEach(b,function(a){a.selected=!1}),a.selected=!0},this.addPane=function(c){0===b.length&&a.select(c),b.push(c)}},template:'<div><ul class="tabs"><li ng-repeat="pane in panes" ng-class="{active:pane.selected}"><a href="javascript:void(0)" ng-click="select(pane)">{{pane.title}}</a></li></ul><div ng-transclude></div></div>',replace:!0}}).directive("pane",function(){return{require:"^attDevNotes",restrict:"EA",transclude:!0,scope:{title:"@"},link:function(a,b,c,d){d.addPane(a)},template:'<div class="tab-pane" ng-class="{active: selected}">'+"<pre ng-class=\"{'language-markup':title=='HTML','language-javascript':title=='JavaScript','language-json':title=='JSON'}\" class=\" line-numbers\"><code ng-transclude></code></pre></div>",replace:!0}}),angular.module("att.abs.dividerLines",[]).directive("attDividerLines",[function(){return{scope:{attDividerLines:"@"},restrict:"A",replace:!0,templateUrl:"app/scripts/ng_js_att_tpls/dividerLines/dividerLines.html",link:function(a,b,c){a.lightContainer=c.attDividerLines}}}]),angular.module("att.abs.dragdrop",[]).directive("attFileDrop",["$parse",function(a){return{restrict:"A",scope:{fileModel:"=",onDrop:"&",attFileDrop:"&"},controller:["$scope","$attrs",function(a,b){""!==b.attFileDrop&&(a.onDrop=a.attFileDrop),this.onDrop=a.onDrop}],link:function(b,c){c.addClass("dragdrop"),c.bind("dragover",function(a){return a.originalEvent&&(a.dataTransfer=a.originalEvent.dataTransfer),a.dataTransfer.dropEffect="move",a.preventDefault&&a.preventDefault(),c.addClass("dragdrop-over"),!1}),c.bind("dragenter",function(a){return a.preventDefault&&a.preventDefault(),c.addClass("dragdrop-over"),!1}),c.bind("dragleave",function(){return c.removeClass("dragdrop-over"),!1}),c.bind("drop",function(d){return d.preventDefault&&d.preventDefault(),d.stopPropagation&&d.stopPropagation(),d.originalEvent&&(d.dataTransfer=d.originalEvent.dataTransfer),c.removeClass("dragdrop-over"),d.dataTransfer.files&&d.dataTransfer.files.length>0&&(b.fileModel=d.dataTransfer.files[0],b.$apply(),"function"==typeof b.onDrop&&(b.onDrop=a(b.onDrop),b.onDrop())),!1})}}}]).directive("attFileLink",[function(){return{restrict:"EA",require:"^?attFileDrop",replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/dragdrop/fileUpload.html",scope:{fileModel:"=?",onFileSelect:"&",attFileLink:"&"},controller:["$scope","$parse",function(a,b){this.setFileModel=function(b){a.takeFileModelFromParent?(a.$parent.fileModel=b,a.$parent.$apply()):(a.fileModel=b,a.$apply())},this.callbackFunction=function(){"function"==typeof a.onFileSelect&&(a.onFileSelect=b(a.onFileSelect),a.onFileSelect())}}],link:function(a,b,c,d){a.takeFileModelFromParent=!1,!c.fileModel&&d&&(a.takeFileModelFromParent=!0),""!==c.attFileLink?a.onFileSelect=a.attFileLink:!c.onFileSelect&&d&&(a.onFileSelect=d.onDrop)}}}]).directive("attFileChange",["$log","$rootScope",function(a,b){return{restrict:"A",require:"^attFileLink",link:function(c,d,e,f){function g(c){if(c.target.files&&c.target.files.length>0)f.setFileModel(c.target.files[0]),f.callbackFunction();else{var d=c.target.value;try{var e=new ActiveXObject("Scripting.FileSystemObject");f.setFileModel(e.getFile(d)),f.callbackFunction()}catch(c){var g="Error: Please follow the guidelines of Drag and Drop component on Sandbox demo page.";a.error(g),b.$broadcast("att-file-link-failure",g)}}}d.bind("change",g)}}}]),angular.module("att.abs.drawer",["att.abs.utilities"]).directive("attDrawer",["$document","$timeout","DOMHelper",function(a,b,c){return{restrict:"EA",replace:!0,transclude:!0,scope:{drawerOpen:"=?",drawerAutoClose:"&?"},template:'<div><div class="att-drawer" ng-transclude></div><div ng-class="{\'drawer-backdrop\':drawerOpen}"></div></div>',link:function(a,d,e){function f(b,c){b&&0!==b.style.width&&0!==b.style.height&&(m.style.display="none","right"===c.side||"left"===c.side?b.style.width="0px":("top"===c.side||"bottom"===c.side)&&(b.style.height="0px")),a.drawerOpen=!1,angular.isDefined(k)&&null!=k&&k.focus()}function g(a,c){k=document.activeElement,0!==a.style.width&&0!==a.style.height&&("right"===c.side||"left"===c.side?a.style.width=c.size:("top"===c.side||"bottom"===c.side)&&(a.style.height=c.size),b(function(){m.style.display="block",angular.isDefined(j)&&null!=j&&j.focus()},1e3*c.speed))}function h(a){var b={};return a&&"[object Function]"===b.toString.call(a)}var i={},j=void 0,k=void 0;i.side=e.drawerSlide||"top",i.speed=e.drawerSpeed||"0.25",i.size=e.drawerSize||"300px",i.zindex=e.drawerZindex||1e3,i.className=e.drawerClass||"att-drawer";var l=d.eq(0).children()[0],m=angular.element(l).children()[0];l.className=i.className,l.style.transitionDuration=i.speed+"s",l.style.webkitTransitionDuration=i.speed+"s",l.style.zIndex=i.zindex,l.style.position="fixed",l.style.width=0,l.style.height=0,l.style.transitionProperty="width, height","right"===i.side||"left"===i.side?(l.style.height=e.drawerCustomHeight||"100%",l.style.top=e.drawerCustomTop||"0px",l.style.bottom=e.drawerCustomBottom||"0px",l.style.right=e.drawerCustomRight||"0px"):("top"===i.side||"bottom"===i.side)&&(l.style.width=e.drawerCustomWidth||"100%",l.style.left=e.drawerCustomLeft||"0px",l.style.top=e.drawerCustomTop||"0px",l.style.right=e.drawerCustomRight||"0px"),b(function(){j=c.firstTabableElement(d[0])},10,!1),e.drawerSize&&a.$watch(function(){return e.drawerSize},function(b){i.size=b,a.drawerOpen&&g(l,i)}),a.$watch("drawerOpen",function(a){a?g(l,i):f(l,i)}),a.drawerAutoClose&&(a.$on("$locationChangeStart",function(){f(l,i),h(a.drawerAutoClose)&&a.drawerAutoClose()}),a.$on("$stateChangeStart",function(){f(l,i),h(a.drawerAutoClose)&&a.drawerAutoClose()}))}}}]),angular.module("att.abs.message",[]).directive("attMessages",[function(){return{restrict:"EA",scope:{messageType:"=?"},controller:["$scope","$element","$attrs",function(a,b,c){a.messageScope=[],this.registerScope=function(b){a.messageScope.push(b)},a.$parent.$watchCollection(c["for"],function(b){for(var c in b){if(b[c]){a.error=c;break}a.error=null}for(var d=0;d<a.messageScope.length;d++)a.messageScope[d].when===a.error?(a.messageScope[d].show(),a.setMessageType(a.messageScope[d].type)):a.messageScope[d].hide();null===a.error&&a.setMessageType(null)}),a.setMessageType=this.setMessageType=function(b){c.messageType&&(a.messageType=b)}}]}}]).directive("attMessage",[function(){return{restrict:"EA",scope:{},require:"^attMessages",link:function(a,b,c,d){d.registerScope(a),a.when=c.when||c.attMessage,a.type=c.type,a.show=function(){b.css({display:"block"})},a.hide=function(){b.css({display:"none"})},a.hide()}}}]),angular.module("att.abs.formField",["att.abs.message","att.abs.utilities"]).directive("attFormField",[function(){return{priority:101,restrict:"A",controller:function(){},link:function(a,b,c){b.wrap('<div class="form-field"></div>'),b.parent().append('<label class="form-field__label">'+c.placeholder||c.attFormField+"</label>"),b.wrap('<div class="form-field-input-container"></div>'),b.bind("keyup",function(){""!==this.value?b.parent().parent().find("label").addClass("form-field__label--show").removeClass("form-field__label--hide"):b.parent().parent().find("label").addClass("form-field__label--hide").removeClass("form-field__label--show")}),b.bind("blur",function(){
+""===this.value&&b.parent().parent().find("label").removeClass("form-field__label--hide")})}}}]).directive("attFormFieldValidation",["$compile","$log",function(a,b){return{priority:102,scope:{},restrict:"A",require:["?ngModel","?attFormField"],link:function(c,d,e,f){var g=f[0],h=f[1];return c.valid="",g?h?(d.parent().append(a(angular.element('<i class="icon-info-alert error" ng-show="valid===false">&nbsp;</i>'))(c)),d.parent().append(a(angular.element('<i class="icon-info-success success" ng-show="valid===true">&nbsp;</i>'))(c)),c.$watch("valid",function(a){a?d.parent().parent().addClass("success"):a===!1?d.parent().parent().addClass("error"):d.parent().parent().removeClass("success").removeClass("error")}),void d.bind("keyup",function(){g.$valid?c.valid=!0:g.$invalid?c.valid=!1:c.valid="",c.$apply()})):void b.error("att-form-field-validation :: att-form-field directive is required."):void b.error("att-form-field-validation :: ng-model directive is required.")}}}]).directive("attFormFieldValidationAlert",["$timeout",function(a){return{scope:{messageType:"=?"},restrict:"EA",replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlert.html",link:function(b,c,d,e){b.showLabel=!1,b.hideLabel=!1,b.errorMessage=!1,b.warningMessage=!1;var f=function(){var a=b.messageType;"error"===a?(b.errorMessage=!0,b.warningMessage=!1):"warning"===a?(b.errorMessage=!1,b.warningMessage=!0):(b.errorMessage=!1,b.warningMessage=!1)},g=-1!==navigator.userAgent.toLowerCase().indexOf("msie 8.0");c.find("label").text(c.find("input").attr("placeholder")),c.find("input").bind("keyup",function(){""!==this.value?(b.showLabel=!0,b.hideLabel=!1,g&&c.find("label").css({top:"-20px"})):(b.showLabel=!1,b.hideLabel=!0,g&&c.find("label").css({top:"0px"})),f(),b.$apply()}),c.find("input").bind("blur",function(){""===this.value&&(b.showLabel=!1,b.hideLabel=!1),b.$apply()}),a(function(){f()},100)}}}]).constant("CoreFormsUiConfig",{phoneMask:"(___) ___-____"}).directive("attPhoneMask",["$parse","CoreFormsUiConfig",function(a,b){return{require:"ngModel",scope:{ngModel:"="},link:function(a,c,d,e){var f=navigator.userAgent.toLowerCase(),g=f.indexOf("android")>-1,h=(-1!==f.indexOf("msie 8.0"),""),i=!1;h=g?"__________":b.phoneMask,c.attr("maxlength",h.length);var j=function(a){var b=!1;return a&&(b=10===a.length),e.$setValidity("invalidPhoneNumber",i),e.$setValidity("mask",b),b},k=function(){var a,b=e.$modelValue;if(b.length){var c,d,f,g,i;for(g=[],f=h.split(""),i=f.length,c=b.substring(0,h.length),d=b.replace(/[^0-9]/g,"").split(""),a=0;i>a&&(g.push("_"===f[a]?d.shift():f[a]),0!==d.length);a++);return b=g.join(""),"("===b&&(b=""),e.$setViewValue(b),e.$render(),b}},l=function(b){b.which&&((b.which<48||b.which>57)&&(b.which<96||b.which>105)?8===b.which||9===b.which||46===b.which||13===b.which||37===b.which||39===b.which||b.ctrlKey===!0||"118"===b.which&&"86"===b.which||b.ctrlKey===!0||"99"===b.which&&"67"===b.which||b.ctrlKey===!0||"120"===b.which&&"88"===b.which||(b.preventDefault?b.preventDefault():b.returnValue=!1,c.attr("aria-label","Only numbers are allowed"),i=!1):(c.removeAttr("aria-label"),i=!0)),a.$apply()},m=function(a){var b=/^[A-Za-z]+$/,c=/^[0-9]+$/;a.match(b)&&(i=!1),a.match(c)&&(i=!0);var d="";return a&&a.length>0&&(d=a.replace(/[^0-9]/g,"")),j(d),d},n=function(a){var b="";return j(a),a&&(b=k()),b};e.$parsers.push(m),e.$formatters.push(n),c.bind("keyup",k),c.bind("keydown",l),c.bind("input",function(a){k(a),l(a)})}}}]).constant("validationTypeInt",{validationNum:{number:"1",text:"2",email:"3"}}).directive("attFormFieldPrv",["keyMapAc","validationTypeInt",function(a,b){return{priority:101,restrict:"AE",controller:["$scope",function(c){this.showHideErrorMessage=function(a){null!=c.$$prevSibling&&angular.isDefined(c.$$prevSibling)&&angular.isDefined(c.$$prevSibling.hideErrorMsg)&&(c.$$prevSibling.hideErrorMsg=a,c.$apply())},this.findAllowedCharactor=function(b){var d=a.keys;if(angular.isDefined(c.allowedSpecialCharacters)&&angular.isDefined(c.allowedSpecialCharacters.length)&&c.allowedSpecialCharacters.length>0){for(var e=c.allowedSpecialCharacters,f=!1,g=0;g<e.length;g++)if(e[g]===d[b]){f=!0;break}return f}return!1},this.validateText=function(a,b,c,d){if(angular.isDefined(b)&&0===b.length){var e=/^[a-zA-Z0-9]*$/i;return e.test(c)}var f="^[a-zA-Z0-9"+d+"]*$",g=new RegExp(f,"i");return g.test(c)},this.validateNumber=function(a,b,c,d){if(angular.isDefined(b)&&0===b.length){var e=/^[0-9\.]+$/;return e.test(c)}var f="^[0-9."+d+"]*$",g=new RegExp(f,"i");return g.test(c)},this.validateEmail=function(a,b,c,d){if(angular.isDefined(b)&&0===b.length){var e=/(([a-zA-Z0-9\-?\.?]+)@(([a-zA-Z0-9\-_]+\.)+)([a-z]{2,3}))+$/;return e.test(c)}var f="(([a-z"+d+"A-Z0-9-?.?]+)@(([a-z"+d+"A-Z0-9-_]+.)+)(["+d+"a-z]{2,3}))+$",g=new RegExp(f,"i");return g.test(c)},this.validateInput=function(a,c,d){var e="",f=!1;if(angular.isDefined(c)&&angular.isDefined(c.length)&&c.length>0)for(var g=0;g<c.length;g++)e+="\\"+c[g];switch(b.validationNum[a]){case b.validationNum.text:f=this.validateText(a,c,d,e);break;case b.validationNum.number:f=this.validateNumber(a,c,d,e);break;case b.validationNum.email:f=this.validateEmail(a,c,d,e)}return f}}],link:function(a,b,c){b.parent().prepend('<label class="form-field__label">'+c.placeholder+"</label>"),b.wrap('<div class="form-field-input-container"></div>'),b.parent().parent().find("label").addClass("form-field__label--show")}}}]).directive("attFormFieldValidationPrv",["keyMapAc","validationTypeInt",function(a,b){return{priority:202,scope:{validationType:"=",allowedChars:"="},restrict:"A",require:["?ngModel","^attFormFieldPrv"],link:function(c,d,e,f){var g=f[1];d.bind("keyup",function(){g.validateInput(c.validationType,c.allowedChars,d[0].value)?g.showHideErrorMessage(!1):g.showHideErrorMessage(!0)});var h=a.keyRange,i=a.allowedKeys,j=function(a,b){var c=b.which<h.startNum||b.which>h.endNum,d=b.which<h.startCapitalLetters||b.which>h.endCapitalLetters,e=b.which<h.startSmallLetters||b.which>h.endSmallLetters,f=c&&d&&e;return f&&!a},k=function(a,b){return(b.which<h.startNum||b.which>h.endNum)&&!a},l=function(a,b){var c="-"!==String.fromCharCode(b.which)&&"_"!==String.fromCharCode(b.which),d="@"!==String.fromCharCode(b.which)&&"."!==String.fromCharCode(b.which),e=c&&d,f=j(a,b);return!a&&e&&f},m=function(a,c,d){switch(a){case b.validationNum.text:if(j(c,d))return!0;break;case b.validationNum.number:if(k(c,d))return!0;break;case b.validationNum.email:if(l(c,d))return!0}return!1};d.bind("keypress",function(a){a.which||(a.keyCode?a.which=a.keyCode:a.charCode&&(a.which=a.charCode));var d=g.findAllowedCharactor(a.which),e=angular.isDefined(c.validationType)&&""!==c.validationType,f=a.which!==i.TAB&&a.which!==i.BACKSPACE&&a.which!==i.DELETE,h=e&&f;h&&m(b.validationNum[c.validationType],d,a)&&a.preventDefault()})}}}]).directive("attFormFieldValidationAlertPrv",[function(){return{restrict:"A",scope:{errorMessage:"="},transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlertPrv.html",link:function(a){a.errorMessage=a.errorMessage,angular.isDefined(a.$parent.hideErrorMsg)?a.hideErrorMsg=a.$parent.hideErrorMsg:a.hideErrorMsg=!0}}}]).factory("Cards",[function(){var a=/(\d{1,4})/g,b=/(?:^|\s)(\d{4})$/,c=[{type:"discover",pattern:/^(6011|65|64[4-9]|622)/,format:a,inputFormat:b,length:[16],cvcLength:[3],cvcSecurityImg:"visaI",zipLength:[5],luhn:!0},{type:"mc",pattern:/^5[1-5]/,format:a,inputFormat:b,length:[16],cvcLength:[3],cvcSecurityImg:"visaI",zipLength:[5],luhn:!0},{type:"amex",pattern:/^3[47]/,format:/(\d{1,4})(\d{1,6})?(\d{1,5})?/,inputFormat:/^(\d{4}|\d{4}\s\d{6})$/,length:[15],cvcLength:[4],cvcSecurityImg:"amexI",zipLength:[5],luhn:!0},{type:"visa",pattern:/^4/,format:a,inputFormat:b,length:[16],cvcLength:[3],cvcSecurityImg:"visaI",zipLength:[5],luhn:!0}],d=function(a){var b,d,e;for(a=(a+"").replace(/\D/g,""),d=0,e=c.length;e>d;d++)if(b=c[d],b.pattern.test(a))return b},e=function(a){var b,d,e;for(d=0,e=c.length;e>d;d++)if(b=c[d],b.type===a)return b};return{fromNumber:function(a){return d(a)},fromType:function(a){return e(a)},defaultFormat:function(){return a},defaultInputFormat:function(){return b}}}]).factory("_Validate",["Cards","$parse",function(a,b){var c=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1},d=function(a){var b,c,d,e,f,g;for(d=!0,e=0,c=(a+"").split("").reverse(),f=0,g=c.length;g>f;f++)b=c[f],b=parseInt(b,10),(d=!d)&&(b*=2),b>9&&(b-=9),e+=b;return e%10===0},e={};return e.cvc=function(d,e,f,g){var h,i;if(angular.isUndefined(d)||null===d||0===d.length)return!0;if(!/^\d+$/.test(d))return!1;var j;if(g.paymentsTypeModel){var k=b(g.paymentsTypeModel);j=k(f)}return j?(i=a.fromType(j),h=d.length,c.call(null!==i?i.cvcLength:void 0,h)>=0):d.length>=3&&d.length<=4},e.zip=function(d,e,f,g){var h,i;if(angular.isUndefined(d)||null===d||0===d.length)return!0;if(!/^\d+$/.test(d))return!1;var j;if(g.paymentsTypeModel){var k=b(g.paymentsTypeModel);j=k(f)}return j?(i=a.fromType(j),h=d.length,c.call(null!==i?i.zipLength:void 0,h)>=0):d.length<6},e.card=function(e,f,g,h){var i,j,k;h.paymentsTypeModel&&(k=b(h.paymentsTypeModel));var l=function(){k&&k.assign(g,null),f.$card=null};return angular.isUndefined(e)||null===e||0===e.length?(l(),!0):(e=(e+"").replace(/\s+|-/g,""),/^\d+$/.test(e)&&(i=a.fromNumber(e))?(f.$card=angular.copy(i),k&&k.assign(g,i.type),ret=(j=e.length,c.call(i.length,j)>=0&&(i.luhn===!1||d(e))),ret):(l(),!1))},function(a,b,c,d,f){if(!e[a])throw types=Object.keys(e),errstr='Unknown type for validation: "'+a+'". ',errstr+='Should be one of: "'+types.join('", "')+'"',errstr;return e[a](b,c,d,f)}}]).factory("_ValidateWatch",["_Validate",function(a){var b={};return b.cvc=function(b,c,d,e){e.paymentsTypeModel&&d.$watch(e.paymentsTypeModel,function(f,g){if(f!==g){var h=a(b,c.$modelValue,c,d,e);c.$setValidity(b,h)}})},b.zip=function(b,c,d,e){e.paymentsTypeModel&&d.$watch(e.paymentsTypeModel,function(f,g){if(f!==g){var h=a(b,c.$modelValue,c,d,e);c.$setValidity(b,h)}})},function(a,c,d,e){return b[a]?b[a](a,c,d,e):void 0}}]).directive("validateCard",["$window","_Validate","_ValidateWatch",function(a,b,c){return{restrict:"A",require:"ngModel",link:function(a,d,e,f){var g=e.validateCard;c(g,f,a,e);var h=function(c){var h=b(g,c,f,a,e);return f.$setValidity(g,h),"card"===g&&(null===f.$card?null==c||""===c||""===c?(a.invalidCardError="",a.invalidCard=""):c.length>=1&&(a.invalidCardError="error",a.invalidCard="The number entered is not a recognized credit card number."):h?(a.invalidCardError="",a.invalidCard=""):f.$card.length.indexOf(c.length)>=0?(a.invalidCardError="error",a.invalidCard="The number entered is not a recognized credit card number."):(a.invalidCardError="",a.invalidCard=""),d.bind("blur",function(){h&&null!==f.$card?(a.invalidCardError="",a.invalidCard=""):(a.invalidCardError="error",a.invalidCard="The number entered is not a recognized credit card number.")})),h?c:void 0};f.$formatters.push(h),f.$parsers.push(h)}}}]).directive("creditCardImage",function(){return{templateUrl:"app/scripts/ng_js_att_tpls/formField/creditCardImage.html",replace:!1,transclude:!1,link:function(a,b,c){a.$watch(c.creditCardImage,function(b,c){b!==c&&(a.cvc="",angular.isUndefined(b)||null===b||(a.newValCCI="show-"+b),null===b&&(a.newValCCI=""))})}}}).directive("securityCodeImage",["$document",function(a){return{templateUrl:"app/scripts/ng_js_att_tpls/formField/cvcSecurityImg.html",replace:!1,transclude:!1,link:function(b,c,d){b.$watch(d.securityCodeImage,function(a,c){a!==c&&(angular.isUndefined(a)||null===a||("amexI"===a?(b.newValI="ccv2-security-amex",b.newValIAlt="The 4 digit CVC security code is on the front of the card.",b.cvcPlaceholder="4 digits",b.cvcMaxlength=4):"visaI"===a&&(b.newValI="ccv2-security",b.newValIAlt="The CVC security code is on the back of your card right after the credit card number.",b.cvcPlaceholder="3 digits",b.cvcMaxlength=3)),null===a&&(b.newValI="ccv2-security",b.cvcPlaceholder="3 digits",b.cvcMaxlength=3,b.newValIAlt="The CVC security code is on the back of your card right after the credit card number."))}),c.bind("click",function(a){a.preventDefault(),c.find("button").hasClass("active")?c.find("button").removeClass("active"):c.find("button").addClass("active")});var e=angular.element(a);e.bind("click",function(a){var b=a.target.className;"btn btn-alt btn-tooltip active"!==b&&c.find("button").hasClass("active")&&c.find("button").removeClass("active")})}}}]),angular.module("att.abs.hourpicker",["att.abs.utilities"]).constant("hourpickerConfig",{days:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],customOption:"Custom"}).controller("hourPickerController",["$scope",function(a){a.options=[],this.setOptions=function(b,c,d,e,f,g){a.options.push(b),void 0!==e&&(a.preselect=e);var h;if(void 0!==c){a.fromtime=c;for(h in a.days)a.days.hasOwnProperty(h)&&(a.FrtimeList[a.days[h]]={},void 0!==f?(a.FrtimeList[a.days[h]].value=f,a.selectedFromOption[a.days[h]]=f):(a.FrtimeList[a.days[h]].value=c[0].value,a.selectedFromOption[a.days[h]]=c[0].value))}if(void 0!==d){a.totime=d;for(h in a.days)a.days.hasOwnProperty(h)&&(a.TotimeList[a.days[h]]={},void 0!==g?(a.TotimeList[a.days[h]].value=g,a.selectedToOption[a.days[h]]=g):(a.TotimeList[a.days[h]].value=d[0].value,a.selectedToOption[a.days[h]]=d[0].value),a.showToTimeErrorDay[a.days[h]]=!1)}void 0!==f&&(a.uncheckedFromTime=f),void 0!==g&&(a.uncheckedToTime=g)},this.getSelectedOption=function(){return a.selectedOption},this.setToTimeErrorDay=function(b,c){a.showToTimeErrorDay[b]=c}}]).directive("attHourpickerOption",[function(){return{restrict:"EA",require:"^attHourpicker",scope:{option:"=option",fromtime:"=fromtime",totime:"=totime",preselect:"=preselect",uncheckedFromTime:"=",uncheckedToTime:"="},link:function(a,b,c,d){d.setOptions(a.option,a.fromtime,a.totime,a.preselect,a.uncheckedFromTime,a.uncheckedToTime)}}}]).directive("attHourpicker",["hourpickerConfig","$document","$log","$documentBind","$timeout",function(a,b,c,d,e){return{require:"ngModel",restrict:"EA",controller:"hourPickerController",transclude:!0,scope:{model:"=ngModel",resetFlag:"=?"},templateUrl:"app/scripts/ng_js_att_tpls/hourpicker/hourpicker.html",link:function(b,c,f,g){var h=!1;b.isFromDropDownOpen=!1,b.isToDropDownOpen=!1;var i="",j={};b.days=a.days,b.daysList={},b.FrtimeList={},b.FrtimeListDay={},b.TotimeListDay={},b.selectedFromOption={},b.selectedToOption={},b.TotimeList={},b.selectedIndex=0,b.selectedOption="Select from list",b.customTime=[],b.resetFlag=!1,b.showToTimeErrorDay={},b.validatedCustomPreselect=[],b.$watch("resetFlag",function(c,d){if(c!==d){if(c&&b.selectedOption===a.customOption){for(day in b.daysList)b.daysList.hasOwnProperty(day)&&(b.daysList[day]=!1,b.addSelectedValue(day));b.preselectUpdateFxn(b.preselect)}b.resetFlag=!1}}),b.$watch("selCategory",function(a){a&&g.$setViewValue(a)},!0),b.updateData=function(c){if(c.constructor===Array){b.showDaysSelector=!0,b.selectedOption=a.customOption;for(var d in c)if(c.hasOwnProperty(d)){var e=c[d].day;"boolean"==typeof c[d].preEnabled&&c[d].preEnabled?b.daysList[e]=!0:b.daysList[e]=!1;for(var f in b.fromtime)b.fromtime[f].value!==c[d].FromTime||b.uncheckedFromTime||(b.FrtimeList[e].value=b.fromtime[f].value,b.selectedFromOption[e]=b.FrtimeList[e].value);for(var g in b.totime)b.totime[g].value!==c[d].ToTime||b.uncheckedToTime||(b.TotimeList[e].value=b.totime[g].value,b.selectedToOption[e]=b.TotimeList[e].value);if(b.addSelectedValue(e,c[d].FromTime,c[d].ToTime),parseInt(d)+1===c.length)break}}else b.selectOption(c.day)},b.$watch("preselect",function(a){b.preselectUpdateFxn(a)}),b.preselectUpdateFxn=function(a){if(void 0!==a){if(b.options&&(a=b.validatePreselectData(a)),""===a)return;b.updateData(a)}},b.validatePreselectData=function(a){if(a.constructor===Array){for(var c in a)if(a.hasOwnProperty(c)){var d=a[c].day,e=!1,f=!1,g=!1;for(var h in b.days)if(b.days[h]===d){e=!0;break}if(!e){a.splice(c,1);continue}for(var i in b.fromtime)if(b.fromtime[i].value===a[c].FromTime){f=!0;break}f||(a[c].FromTime=b.fromtime[0].value);for(var j in b.totime)if(b.totime[j].value===a[c].ToTime){g=!0;break}if(g||(a[c].ToTime=b.totime[0].value),"boolean"==typeof a[c].preEnabled&&a[c].preEnabled?a[c].preEnabled=!0:a[c].preEnabled=!1,b.validatedCustomPreselect[d]={},b.validatedCustomPreselect[d].FromTime=a[c].FromTime,b.validatedCustomPreselect[d].ToTime=a[c].ToTime,parseInt(c)+1===a.length)break}}else{var k=!1;for(var l in b.options)if(b.options[l]===a.day){k=!0;break}k||(a="")}return a},b.selectPrevNextValue=function(a,b,c){var d,e=0;if(38===a.keyCode)d=-1;else{if(40!==a.keyCode)return c;d=1}if(-1!==b.indexOf(c))e=b.indexOf(c)+d;else for(var f in b)if(b[f].value===c){e=parseInt(f)+d;break}return e===b.length?e-=1:-1===e&&(e+=1),a.preventDefault(),b[e].value?b[e].value:b[e]},b.showDropdown=function(){b.showlist=!b.showlist,h=!h},b.showfromDayDropdown=function(a){for(count in b.FrtimeListDay)count!==a&&b.FrtimeListDay[count]&&(b.FrtimeListDay[count]=!1);for(count in b.TotimeListDay)b.TotimeListDay[count]&&(b.TotimeListDay[count]=!1);b.FrtimeListDay[a]=!b.FrtimeListDay[a],h=!h,b.showlist=!1,b.FrtimeListDay[a]?(b.isFromDropDownOpen=!0,i=a):b.isFromDropDownOpen=!1,e(function(){if(b.FrtimeListDay[a]){var d=angular.element(c)[0].querySelector(".customdays-width"),e=angular.element(d.querySelector(".select2-container-active")).parent()[0].querySelector("ul"),f=angular.element(e.querySelector(".selectedItemInDropDown"))[0].offsetTop;angular.element(e)[0].scrollTop=f}})},b.showtoDayDropdown=function(a){for(count in b.TotimeListDay)count!==a&&b.TotimeListDay[count]&&(b.TotimeListDay[count]=!1);for(count in b.FrtimeListDay)b.FrtimeListDay[count]&&(b.FrtimeListDay[count]=!1);b.TotimeListDay[a]=!b.TotimeListDay[a],h=!h,b.showlist=!1,b.TotimeListDay[a]?(b.isToDropDownOpen=!0,i=a):b.isToDropDownOpen=!1,e(function(){if(b.TotimeListDay[a]){var d=angular.element(c)[0].querySelector(".customdays-width"),e=angular.element(d.querySelector(".select2-container-active")).parent()[0].querySelector("ul"),f=angular.element(e.querySelector(".selectedItemInDropDown"))[0].offsetTop;angular.element(e)[0].scrollTop=f}})},b.selectFromDayOption=function(a,c){b.selectedFromOption[a]=c,b.FrtimeList[a].value=c,b.FrtimeListDay[a]=!1,b.isFromDropDownOpen=!1},b.selectToDayOption=function(a,c){b.selectedToOption[a]=c,b.TotimeList[a].value=c,b.TotimeListDay[a]=!1,b.isToDropDownOpen=!1},b.addSelectedValue=function(a,c,d){var e,f;if(void 0===b.daysList[a]||b.daysList[a]){for(b.selectedFromOption[a]===b.uncheckedFromTime&&(angular.isDefined(b.validatedCustomPreselect[a])?(b.selectedFromOption[a]=b.validatedCustomPreselect[a].FromTime,c=b.validatedCustomPreselect[a].FromTime,b.FrtimeList[a].value=b.validatedCustomPreselect[a].FromTime):(b.selectedFromOption[a]=b.fromtime[0].value,c=b.fromtime[0].value,b.FrtimeList[a].value=b.fromtime[0].value)),b.selectedToOption[a]===b.uncheckedToTime&&(angular.isDefined(b.validatedCustomPreselect[a])?(b.selectedToOption[a]=b.validatedCustomPreselect[a].ToTime,d=b.validatedCustomPreselect[a].ToTime,b.TotimeList[a].value=b.validatedCustomPreselect[a].ToTime):(b.selectedToOption[a]=b.totime[0].value,d=b.totime[0].value,b.TotimeList[a].value=b.totime[0].value)),j.day=a,j.FromTime=b.FrtimeList[a].value,j.ToTime=b.TotimeList[a].value,e=0,f=b.customTime.length;f>e;e++)if(b.customTime[e].day===a){b.customTime[e].FromTime=j.FromTime,b.customTime[e].ToTime=j.ToTime;break}if(e===f){var g=angular.copy(j);b.customTime.push(g)}}else for(e=0,f=b.customTime.length;f>e;e++)if(b.customTime[e].day===a){b.uncheckedFromTime?b.selectedFromOption[b.customTime[e].day]=b.uncheckedFromTime:b.selectedFromOption[b.customTime[e].day]=b.FrtimeList[b.customTime[e].day].value,b.uncheckedToTime?b.selectedToOption[b.customTime[e].day]=b.uncheckedToTime:b.selectedToOption[b.customTime[e].day]=b.TotimeList[b.customTime[e].day].value,b.customTime.splice(e,1);break}b.selCategory=b.customTime};var k=function(){b.showlist&&b.$apply(function(){b.showlist=!1})};d.click("showlist",k,b);var l=function(){b.$apply(function(){b.isFromDropDownOpen&&(b.FrtimeListDay[i]=!1,b.isFromDropDownOpen=!1)})};d.click("isFromDropDownOpen",l,b);var m=function(){b.$apply(function(){b.isToDropDownOpen&&(b.TotimeListDay[i]=!1,b.isToDropDownOpen=!1)})};d.click("isToDropDownOpen",m,b),b.selectOption=function(c){if(c===a.customOption)b.showDaysSelector=!0,b.selCategory=b.customTime;else{b.showDaysSelector=!1;var d=/[0-9]\s?am/i.exec(c),e=/[0-9]\s?pm/i.exec(c);b.selCategory={day:c,FromTime:null===d?"NA":d[0],ToTime:null===e?"NA":e[0]}}b.showlist=!1,h=!1,b.selectedOption=c}}}}]).directive("attHourpickerValidator",["hourpickerConfig",function(a){return{restrict:"A",require:["attHourpicker","ngModel"],link:function(b,c,d,e){var f=e[0],g=e[1],h=function(a){var b=Number(a.match(/^(\d+)/)[1]),c=Number(a.match(/:(\d+)/)[1]),d=a.match(/\s(.*)$/)[1].toUpperCase();"PM"===d&&12>b&&(b+=12),"AM"===d&&12===b&&(b-=12);var e=b.toString(),f=c.toString();return 10>b&&(e="0"+e),10>c&&(f="0"+f),parseInt(e+f,10)},i=function(a,b){var c=h(a),d=h(b);return d-c},j=function(b){if(f.getSelectedOption()===a.customOption){var c=0;for(var d in b)b.hasOwnProperty(d)&&(i(b[d].FromTime,b[d].ToTime)<=0?(f.setToTimeErrorDay(b[d].day,!0),c++):f.setToTimeErrorDay(b[d].day,!1));return c>0?(g.$setValidity("validationStatus",!1),[]):(g.$setValidity("validationStatus",!0),b)}return g.$setValidity("validationStatus",!0),b};g.$parsers.unshift(j)}}}]),angular.module("att.abs.iconButtons",[]).constant("buttonConfig",{activeClass:"active--button",toggleEvent:"click"}).directive("attIconBtnRadio",["buttonConfig",function(a){var b=a.activeClass||"active--button",c=a.toggleEvent||"click";return{require:"ngModel",link:function(a,d,e,f){d.attr("tabindex","0"),d.append("<span class='hidden-spoken'>"+e.attIconBtnRadio+"</span>"),f.$render=function(){d.parent().toggleClass(b,angular.equals(f.$modelValue,e.attIconBtnRadio))},d.parent().bind(c,function(){d.parent().hasClass(b)||a.$apply(function(){f.$setViewValue(e.attIconBtnRadio),f.$render()})})}}}]).directive("attIconBtnCheckbox",["buttonConfig",function(a){var b=a.activeClass||"active--button",c=a.toggleEvent||"click";return{require:"ngModel",link:function(a,d,e,f){function g(){var b=a.$eval(e.btnCheckboxTrue);return angular.isDefined(b)?b:!0}function h(){var b=a.$eval(e.btnCheckboxFalse);return angular.isDefined(b)?b:!1}d.attr("tabindex","0"),d.append("<span class='hidden-spoken'>"+e.attIconBtnCheckbox+"</span>"),f.$render=function(){d.parent().toggleClass(b,angular.equals(f.$modelValue,g()))},d.parent().bind(c,function(){a.$apply(function(){f.$setViewValue(d.parent().hasClass(b)?h():g()),f.$render()})})}}}]),angular.module("att.abs.links",["ngSanitize"]).directive("attLink",[function(){return{restrict:"A",link:function(a,b){b.addClass("link"),b.attr("href")||b.attr("tabindex","0")}}}]).directive("attLinkVisited",[function(){return{restrict:"A",link:function(a,b){b.addClass("link--visited"),b.attr("href")||b.attr("tabindex","0")}}}]).directive("attReadmore",["$timeout",function(a){return{restrict:"A",scope:{lines:"@noOfLines",textModel:"=",isOpen:"="},templateUrl:"app/scripts/ng_js_att_tpls/links/readMore.html",link:function(b,c){var d=1;b.$watch("textModel",function(e){e?("function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),b.textToDisplay=e.trim(),b.readFlag=!0,a(function(){var a=c[0].children[0].children[0];1===d&&(d=window.getComputedStyle?parseInt(b.lines)*parseFloat(window.getComputedStyle(a,null).getPropertyValue("height")):parseInt(b.lines)*parseFloat(a.currentStyle.height),b.elemHeight=d,b.readLinkStyle={height:b.elemHeight+"px"})}),b.readMoreLink=!0,b.readLessLink=!1):(b.textToDisplay="",b.readMoreLink=!1,b.readLessLink=!1,b.readFlag=!1)});var e=c.parent();e.hasClass("att-accordion__body")&&b.$watch("isOpen",function(a){a||(b.readMoreLink=!0,b.readLessLink=!1,b.readLinkStyle={height:b.elemHeight+"px"},b.readFlag=!0)}),b.readMore=function(){b.readMoreLink=!1,b.readLessLink=!0,b.readLinkStyle={height:"auto"},b.readFlag=!1;var d=angular.element(c).children().eq(1).find("a")[0];a(function(){d.focus()})},b.readLess=function(){b.readMoreLink=!0,b.readLessLink=!1,b.readLinkStyle={height:b.elemHeight+"px"},b.readFlag=!0;var d=angular.element(c).children().eq(0).find("a")[0];a(function(){d.focus()})}}}}]).directive("attLinksList",[function(){return{restrict:"A",controller:function(){},link:function(a,b){b.addClass("links-list")}}}]).directive("attLinksListItem",[function(){return{restrict:"A",require:"^attLinksList",link:function(a,b){b.addClass("links-list__item"),b.attr("href")||b.attr("tabindex","0")}}}]),angular.module("att.abs.loading",[]).directive("attLoading",["$window",function(a){return{restrict:"A",replace:!0,scope:{icon:"@attLoading",progressStatus:"=?",colorClass:"=?"},templateUrl:"app/scripts/ng_js_att_tpls/loading/loading.html",link:function(b,c){var d=b.progressStatus;if(b.progressStatus=Math.min(100,Math.max(0,d)),-1!==a.navigator.userAgent.indexOf("MSIE 8.")){var e=0,f=36*b.progressStatus;c.css({"background-position-x":e,"background-position-y":-f})}}}}]),angular.module("att.abs.modal",["att.abs.utilities"]).factory("$$stackedMap",function(){return{createNew:function(){var a=[];return{add:function(b,c){a.push({key:b,value:c})},get:function(b){for(var c=0;c<a.length;c++)if(b===a[c].key)return a[c]},keys:function(){for(var b=[],c=0;c<a.length;c++)b.push(a[c].key);return b},top:function(){return a[a.length-1]},remove:function(b){for(var c=-1,d=0;d<a.length;d++)if(b===a[d].key){c=d;break}return a.splice(c,1)[0]},removeTop:function(){return a.splice(a.length-1,1)[0]},length:function(){return a.length}}}}}).directive("modalBackdrop",["$timeout",function(a){return{restrict:"EA",replace:!0,templateUrl:"app/scripts/ng_js_att_tpls/modal/backdrop.html",link:function(b){b.animate=!1,a(function(){b.animate=!0})}}}]).directive("modalWindow",["$modalStack","$timeout","$document",function(a,b,c){return{restrict:"EA",scope:{index:"@",modalTitle:"@?"},replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/modal/window.html",link:function(d,e,f){d.windowClass=f.windowClass||"",f.modalTitle&&""!==f.modalTitle&&(e[0].setAttribute("aria-label",f.modalTitle),e[0].removeAttribute("modal-title")),b(function(){d.focusModalFlag=!0,d.animate=!0}),c.on("focus keydown",function(a){9===a.which&&(String.prototype.contains=function(a){return-1!==this.indexOf(a)},e[0]===a.target||e[0].contains(a.target)||e[0].focus())}),d.close=function(b){var c=a.getTop();c&&c.value.backdrop&&"static"!=c.value.backdrop&&b.target===b.currentTarget&&(b.preventDefault?(b.preventDefault(),b.stopPropagation()):b.returnValue=!1,a.dismiss(c.key,"backdrop click"))}}}}]).factory("$modalStack",["$document","$compile","$rootScope","$$stackedMap","events","keymap",function(a,b,c,d,e,f){function g(){for(var a=-1,b=m.keys(),c=0;c<b.length;c++)m.get(b[c]).value.backdrop&&(a=c);return a}function h(b){var c=a.find("body").eq(0),d=a.find("html").eq(0),e=m.get(b).value;m.remove(b),e.modalDomEl.remove(),c.toggleClass(k,m.length()>0),d.css({overflow:"scroll"}),j&&-1==g()&&(j.remove(),j=void 0),e.modalScope.$destroy(),angular.isDefined(o)&&null!=o&&o.focus()}var i,j,k="modal-open",l=c.$new(!0),m=d.createNew(),n={},o=void 0;return c.$watch(g,function(a){l.index=a}),a.bind("keydown",function(a){var b;if(27===a.which)b=m.top(),b&&b.value.keyboard&&c.$apply(function(){n.dismiss(b.key)});else if(a.keyCode===f.KEY.BACKSPACE){var d,g=!1,h=a.srcElement||a.target;g=void 0===h.type?!0:"INPUT"===h.tagName.toUpperCase()&&("TEXT"===(d=h.type.toUpperCase())||"PASSWORD"===d||"FILE"===d||"SEARCH"===d||"EMAIL"===d||"NUMBER"===d||"DATE"===d||"TEL"===d||"URL"===d||"TIME"===d)||"TEXTAREA"===h.tagName.toUpperCase()?h.readOnly||h.disabled:!0,g&&e.preventDefault(a)}}),n.open=function(c,d){m.add(c,{deferred:d.deferred,modalScope:d.scope,backdrop:d.backdrop,keyboard:d.keyboard}),o=document.activeElement;var e=a.find("body").eq(0),f=a.find("html").eq(0);g()>=0&&!j&&(i=angular.element("<div modal-backdrop></div>"),j=b(i)(l),e.append(j));var h=angular.element("<div modal-window></div>");h.attr("window-class",d.windowClass),h.attr("index",m.length()-1),h.attr("modal-title",d.modalTitle),h.html(d.content);var n=b(h)(d.scope);m.top().value.modalDomEl=n,e.append(n),e.addClass(k),f.css({overflow:"hidden"})},n.close=function(a,b){var c=m.get(a);c&&(c.value.deferred.resolve(b),h(a))},n.dismiss=function(a,b){var c=m.get(a).value;c&&(c.deferred.reject(b),h(a))},n.getTop=function(){return m.top()},n}]).provider("$modal",function(){var a={options:{backdrop:!0,keyboard:!0},$get:["$injector","$rootScope","$q","$http","$templateCache","$controller","$modalStack",function(b,c,d,e,f,g,h){function i(a){return a.template?d.when(a.template):e.get(a.templateUrl,{cache:f}).then(function(a){return a.data})}function j(a){var c=[];return angular.forEach(a,function(a){(angular.isFunction(a)||angular.isArray(a))&&c.push(d.when(b.invoke(a)))}),c}var k={};return k.open=function(b){var e=d.defer(),f=d.defer(),k={result:e.promise,opened:f.promise,close:function(a){h.close(k,a)},dismiss:function(a){h.dismiss(k,a)}};if(b=angular.extend({},a.options,b),b.resolve=b.resolve||{},!b.template&&!b.templateUrl)throw new Error("One of template or templateUrl options is required.");var l=d.all([i(b)].concat(j(b.resolve)));return l.then(function(a){var d=(b.scope||c).$new();d.$close=k.close,d.$dismiss=k.dismiss;var f,i={},j=1;b.controller&&(i.$scope=d,i.$modalInstance=k,angular.forEach(b.resolve,function(b,c){i[c]=a[j++]}),f=g(b.controller,i)),h.open(k,{scope:d,deferred:e,content:a[0],backdrop:b.backdrop,keyboard:b.keyboard,windowClass:b.windowClass,modalTitle:b.modalTitle})},function(a){e.reject(a)}),l.then(function(){f.resolve(!0)},function(){f.reject(!1)}),k},k}]};return a}).directive("simpleModal",["$modal",function(a){return{restrict:"EA",scope:{simpleModal:"@",backdrop:"@",keyboard:"@",modalOk:"&",modalCancel:"&",windowClass:"@",controller:"@",modalTitle:"@?"},link:function(b,c){c.bind("click",function(d){d.preventDefault(),angular.isDefined(c.attr("href"))&&""!==c.attr("href")&&(b.simpleModal=c.attr("href")),"false"===b.backdrop?b.backdropclick="static":b.backdropclick=!0,"false"===b.keyboard?b.keyboardev=!1:b.keyboardev=!0,a.open({templateUrl:b.simpleModal,backdrop:b.backdropclick,keyboard:b.keyboardev,windowClass:b.windowClass,controller:b.controller,modalTitle:b.modalTitle}).result.then(b.modalOk,b.modalCancel)})}}}]).directive("tabbedItem",["$modal","$log",function(a,b){return{restrict:"AE",replace:!0,scope:{items:"=items",controller:"@",templateId:"@",modalTitle:"@?"},templateUrl:"app/scripts/ng_js_att_tpls/modal/tabbedItem.html",controller:["$scope","$rootScope","$attrs",function(c){c.clickTab=function(d){for(var e=0;e<c.items.length;e++)e===d?(c.items[e].isTabOpen=!0,c.items[e].showData=!0):(c.items[e].isTabOpen=!1,c.items[e].showData=!1);var f=a.open({templateUrl:c.templateId,controller:c.controller,windowClass:"tabbedOverlay_modal",modalTitle:c.modalTitle,resolve:{items:function(){return c.items}}});f.result.then(function(a){c.selected=a},function(){b.info("Modal dismissed at: "+new Date)})},c.isActiveTab=function(a){return c.items&&c.items[a]&&c.items[a].isTabOpen}}]}}]).directive("tabbedOverlay",[function(){return{restrict:"AE",replace:!0,scope:{items:"="},transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/modal/tabbedOverlayItem.html",controller:["$scope",function(a){a.clickTab=function(b){for(var c=0;c<a.items.length;c++)c===b?(a.items[c].isTabOpen=!0,a.items[c].showData=!0):(a.items[c].isTabOpen=!1,a.items[c].showData=!1)},a.isActiveTab=function(b){return a.items&&a.items[b]&&a.items[b].isTabOpen}}]}}]),angular.module("att.abs.pagination",["att.abs.utilities"]).directive("attPagination",[function(){return{restrict:"EA",scope:{totalPages:"=",currentPage:"=",showInput:"=",clickHandler:"=?"},replace:!0,templateUrl:"app/scripts/ng_js_att_tpls/pagination/pagination.html",
+link:function(a){function b(b){angular.isDefined(b)&&null!==b&&((!b||1>b)&&(b=1),b>a.totalPages&&(b=a.totalPages),a.currentPage!==b&&(a.currentPage=b,c(a.currentPage)),a.totalPages>7&&(b<a.pages[0]&&b>3?a.pages=[b,b+1,b+2]:b>a.pages[2]&&b<a.totalPages-2?a.pages=[b-2,b-1,b]:3>=b?a.pages=[1,2,3]:b>=a.totalPages-2&&(a.pages=[a.totalPages-2,a.totalPages-1,a.totalPages])))}a.focusedPage,a.$watch("totalPages",function(c){if(angular.isDefined(c)&&null!==c){if(a.pages=[],1>c)return void(a.totalPages=1);if(7>=c)for(var d=1;c>=d;d++)a.pages.push(d);else if(c>7){var e=Math.ceil(c/2);a.pages=[e-1,e,e+1]}b(1)}}),a.$watch("currentPage",function(a){b(a)});var c=function(b){angular.isFunction(a.clickHandler)&&a.clickHandler(b)};a.next=function(b){b.preventDefault(),a.currentPage<a.totalPages&&(a.currentPage+=1,c(a.currentPage))},a.prev=function(b){b.preventDefault(),a.currentPage>1&&(a.currentPage-=1,c(a.currentPage))},a.selectPage=function(b,d){d.preventDefault(),a.currentPage=b,a.focusedPage=b,c(a.currentPage)},a.checkSelectedPage=function(b){return a.currentPage===b?!0:!1},a.isFocused=function(b){return a.focusedPage===b}}}}]),angular.module("att.abs.paneSelector",["att.abs.utilities"]).constant("paneGroupConstants",{SIDE_WIDTH_DEFAULT:"33%",INNER_PANE_DEFAULT:"67%",SIDE_PANE_ID:"sidePane",NO_DRILL_DOWN:"none"}).factory("animation",function(){return TweenLite}).directive("attPaneAccessibility",["keymap","$window",function(a,b){return{restrict:"A",require:["^?sidePane","^?innerPane"],link:function(b,c,d,e){var f=e[0],g=e[1],h=!1;b.ie=function(){for(var a,b=3,c=document.createElement("div"),d=c.getElementsByTagName("i");c.innerHTML="<!--[if gt IE "+ ++b+"]><i></i>< ![endif]-->",d[0];);return b>4?b:a}(),h=8===b.ie?!0:!1,c.bind("keydown",function(b){if(a.isAllowedKey(b.keyCode)||a.isControl(b)||a.isFunctionKey(b)){b.preventDefault(),b.stopPropagation();var d;switch(b.keyCode){case a.KEY.DOWN:if(d=angular.element(c[0])[0],d&&d.nextElementSibling&&d.nextElementSibling.focus(),h){do{if(!d||!d.nextSibling)break;d=d.nextSibling}while(d&&"DIV"!==d.tagName);d.focus()}break;case a.KEY.UP:if(d=angular.element(c[0])[0],d&&d.previousElementSibling&&d.previousElementSibling.focus(),h){do{if(!d||!d.previousSibling)break;d=d.previousSibling}while(d&&"DIV"!==d.tagName);d.focus()}break;case a.KEY.RIGHT:angular.isDefined(f)&&(d=f.getElement()[0]),angular.isDefined(g)&&(d=g.getElement()[0]);do{if(!d||!d.nextElementSibling)break;d=d.nextElementSibling}while("none"===window.getComputedStyle(d,null).getPropertyValue("display"));if(h)do{if(!d||!d.nextSibling)break;d=d.nextSibling}while(d&&"DIV"==d.tagName&&"none"==d.currentStyle.display);d&&d.querySelector("[att-pane-accessibility]").focus();break;case a.KEY.LEFT:angular.isDefined(f)&&(d=f.getElement()[0]),angular.isDefined(g)&&(d=g.getElement()[0]);do{if(!d||!d.previousElementSibling)break;d=d.previousElementSibling}while("none"==window.getComputedStyle(d,null).getPropertyValue("display"));if(h)do{if(!d||!d.previousSibling)break;d=d.previousSibling}while(d&&"DIV"==d.tagName&&"none"==d.currentStyle.display);d&&d.querySelector("[att-pane-accessibility]").focus()}}})}}}]).directive("sideRow",[function(){return{restrict:"A",replace:!0,require:["^sidePane","^paneGroup"],link:function(a,b,c,d){var e=d[0],f=d[1];a.$first&&(e.sidePaneIds=[]);var g=c.paneId,h=c.drillDownTo;e.sidePaneRows.push({paneId:g,drillDownTo:h}),b.on("click",function(){e.currentSelectedRowPaneId=g,f.slideOutPane(g,!0)})}}}]).controller("SidePaneCtrl",["$scope","$element","animation","paneGroupConstants",function(a,b,c,d){this.getElement=function(){return b},this.sidePaneTracker={},this.currentWidth=d.SIDE_WIDTH_DEFAULT,this.paneId=d.SIDE_PANE_ID,this.currentSelectedRowPaneId,this.drillDownToMapper={},this.sidePaneRows=[],this.init=function(){var a=this.sidePaneRows;if(a)for(var b in a)if(a.hasOwnProperty(b)){var c=a[b].paneId,d=a[b].drillDownTo;this.drillDownToMapper[c]=d,0==b&&(this.currentSelectedRowPaneId=c,this.sidePaneTracker[c]=[])}},this.getSidePanesList=function(){return this.sidePaneTracker[this.currentSelectedRowPaneId]},this.addToSidePanesList=function(a){void 0===this.sidePaneTracker[this.currentSelectedRowPaneId]?this.sidePaneTracker[this.currentSelectedRowPaneId]=[]:a&&this.sidePaneTracker[this.currentSelectedRowPaneId].push(a)},this.setWidth=function(a){a&&(this.currentWidth=a),c.set(b,{width:this.currentWidth})},this.resizeWidth=function(a){a&&(this.currentWidth=a),c.to(b,.5,{width:a})}}]).directive("sidePane",["paneGroupConstants",function(a){return{restrict:"EA",transclude:!0,replace:!0,templateUrl:"app/scripts/ng_js_att_tpls/paneSelector/sidePane.html",require:["^paneGroup","sidePane"],controller:"SidePaneCtrl",scope:{},link:function(b,c,d,e){var f=e[0],g=e[1];f.addPaneCtrl(a.SIDE_PANE_ID,g)}}}]).directive("drillDownRow",["$parse","paneGroupConstants",function(a,b){return{restrict:"A",replace:!0,require:["^innerPane","^paneGroup"],link:function(a,c,d,e){var f=e[0],g=e[1];c.on("click",function(){var a=f.drillDownTo;f.drillDownTo!==b.NO_DRILL_DOWN&&g.slideOutPane(a),c[0].focus()})}}}]).controller("InnerPaneCtrl",["$scope","$element","animation","paneGroupConstants",function(a,b,c,d){this.getElement=function(){return b},this.paneId=a.paneId,this.drillDownTo,this.currentWidth=d.INNER_PANE_DEFAULT,this.setWidth=function(a){a&&(this.currentWidth=a),c.set(b,{width:this.currentWidth})},this.resizeWidth=function(a,d){c.to(b,.25,{width:a,onComplete:d})},this.displayNone=function(){c.set(b,{display:"none"})},this.displayBlock=function(){c.set(b,{display:"block"}),this&&this.hideRightBorder()},this.floatLeft=function(){c.set(b,{"float":"left"})},this.hideLeftBorder=function(){c.set(b,{borderLeftWidth:"0px"})},this.showLeftBorder=function(){c.set(b,{borderLeftWidth:"1px"})},this.hideRightBorder=function(){c.set(b,{borderRightWidth:"0px"})},this.showRightBorder=function(){c.set(b,{borderRightWidth:"1px"})},this.slideFromRight=function(){c.set(b,{"float":"right"}),c.set(b,{width:this.currentWidth})},this.startOpen=function(){return a.startOpen}}]).directive("innerPane",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/paneSelector/innerPane.html",require:["^paneGroup","innerPane"],controller:"InnerPaneCtrl",scope:{paneId:"@"},link:function(a,b,c,d){""===c.startOpen&&(a.startOpen=!0);var e=d[0],f=d[1];e.addPaneCtrl(a.paneId,f)}}}).controller("PaneGroupCtrl",["$scope","$element","paneGroupConstants",function(a,b,c){this.panes={},this.accountLevelPaneModel=[],this.title=a.title,this.init=function(){function a(a,b){var c,d=[];for(c in a.sidePaneRows)if(a.sidePaneRows.hasOwnProperty(c)){var e=a.sidePaneRows[c];c>0&&b[e.paneId].startOpen&&b[e.paneId].startOpen()&&(d.push(e),a.addToSidePanesList(e.paneId))}if(f)for(c in d)if(d.hasOwnProperty(c)){var g=d[c].paneId,h=b[g];h&&h.setWidth&&h.displayBlock&&(h.setWidth(f),h.displayBlock())}}var b=this.panes[c.SIDE_PANE_ID];if(b){b.init();var d,e=1;for(d in this.panes)this.panes[d].startOpen&&this.panes[d].startOpen()&&e++;var f;if(e>=3&&(f=100/e+"%"),this.panes[b.currentSelectedRowPaneId]){f?(b.setWidth(f),this.panes[b.currentSelectedRowPaneId].setWidth(f)):(b.setWidth(),this.panes[b.currentSelectedRowPaneId].setWidth()),this.panes[b.currentSelectedRowPaneId].displayBlock();for(d in this.panes)d!==c.SIDE_PANE_ID&&d!==b.currentSelectedRowPaneId&&this.panes[d].displayNone(),this.panes[d].drillDownTo=b.drillDownToMapper[d]}a(b,this.panes)}},this.resetPanes=function(){for(var a in this.panes)if(this.panes.hasOwnProperty(a)){var b=this.panes[a];b&&b.paneId!==c.SIDE_PANE_ID&&(b.floatLeft(),b.displayNone())}this.panes[c.SIDE_PANE_ID]&&this.panes[c.SIDE_PANE_ID].setWidth(c.SIDE_WIDTH_DEFAULT)},this.addPaneCtrl=function(a,b){this.panes[a]=b},this._slideOutPane=function(a,b){this.resetPanes();var d;if(b)if(this.panes[c.SIDE_PANE_ID]&&(d=this.panes[c.SIDE_PANE_ID].getSidePanesList()),d){if(this.panes&&this.panes[c.SIDE_PANE_ID])if(0===d.length&&this.panes[a])this.panes[c.SIDE_PANE_ID].setWidth(c.SIDE_WIDTH_DEFAULT),this.panes[a].displayBlock(),this.panes[a].setWidth(c.INNER_PANE_DEFAULT);else{var e=d.length+2,f=100/e+"%";this.panes[c.SIDE_PANE_ID].setWidth(f),this.panes[this.panes[c.SIDE_PANE_ID].currentSelectedRowPaneId]&&(this.panes[this.panes[c.SIDE_PANE_ID].currentSelectedRowPaneId].displayBlock(),this.panes[this.panes[c.SIDE_PANE_ID].currentSelectedRowPaneId].setWidth(f));for(var g in d)this.panes[d[g]]&&(this.panes[d[g]].displayBlock(),this.panes[d[g]].setWidth(f))}}else this.panes&&this.panes[c.SIDE_PANE_ID]&&this.panes[a]&&(this.panes[c.SIDE_PANE_ID].currentSelectedRowPaneId=a,this.panes[c.SIDE_PANE_ID].addToSidePanesList(),this.panes[a].slideFromRight(),this.panes[a].displayBlock(),this.panes[a].setWidth(c.INNER_PANE_DEFAULT));else{var h,i=!1;this.panes[c.SIDE_PANE_ID]&&(h=this.panes[c.SIDE_PANE_ID].getSidePanesList());for(var j in h)if(h.hasOwnProperty(j)){var k=h[j];if(k===a){i=!0;break}}!i&&this.panes[c.SIDE_PANE_ID]&&this.panes[c.SIDE_PANE_ID].addToSidePanesList(a);var l;this.panes[c.SIDE_PANE_ID]&&(l=this.panes[c.SIDE_PANE_ID].getSidePanesList().length);var m=l+2,n=100/m+"%";this.panes[c.SIDE_PANE_ID]&&this.panes[c.SIDE_PANE_ID].setWidth(n);var o;this.panes[c.SIDE_PANE_ID]&&(o=this.panes[c.SIDE_PANE_ID].getSidePanesList()[l-1]);var p=this;p.panes[c.SIDE_PANE_ID]&&(d=p.panes[c.SIDE_PANE_ID].getSidePanesList());for(var q in d)if(d.hasOwnProperty(q)){var r=d[q],s=this.panes[r];r!==o&&s&&(s.setWidth(n),s.displayBlock(),s.floatLeft())}this.panes[this.panes[c.SIDE_PANE_ID].currentSelectedRowPaneId]&&(this.panes[this.panes[c.SIDE_PANE_ID].currentSelectedRowPaneId].displayBlock(),this.panes[this.panes[c.SIDE_PANE_ID].currentSelectedRowPaneId].showRightBorder(),this.panes[this.panes[c.SIDE_PANE_ID].currentSelectedRowPaneId].resizeWidth(n,function(){p.panes[o]&&p.panes[p.panes[c.SIDE_PANE_ID].currentSelectedRowPaneId]&&(p.panes[p.panes[c.SIDE_PANE_ID].currentSelectedRowPaneId].hideRightBorder(),p.panes[o].setWidth(n),p.panes[o].slideFromRight(),p.panes[o].displayBlock(),p.panes[o].floatLeft())}))}},this.slideOutPane=function(a,b){this._slideOutPane(a,b)}}]).directive("paneGroup",["$timeout",function(a){return{restrict:"EA",transclude:!0,replace:!0,templateUrl:"app/scripts/ng_js_att_tpls/paneSelector/paneGroup.html",scope:{},controller:"PaneGroupCtrl",link:function(b,c,d,e){function f(){e.init()}a(f,100)}}}]),angular.module("att.abs.tooltip",["att.abs.position","att.abs.utilities","ngSanitize"]).constant("tooltipDefaultOptions",{placement:"above",animation:!1,popupDelay:0,stylett:"dark",appendToBody:!0}).provider("$tooltip",["tooltipDefaultOptions",function(a){function b(a){var b=/[A-Z]/g,c="-";return a.replace(b,function(a,b){return(b?c:"")+a.toLowerCase()})}var c={mouseenter:"mouseleave",click:"click",focus:"blur",mouseover:"mouseout"},d={};this.options=function(a){angular.extend(d,a)},this.setTriggers=function(a){angular.extend(c,a)},this.$get=["$window","$compile","$timeout","$parse","$document","$position","$interpolate","$attElementDetach",function(e,f,g,h,i,j,k,l){return function(e,m,n){function o(a){var b=a||p.trigger||n,d=c[b]||b;return{show:b,hide:d}}var p=angular.extend({},a,d),q=b(e),r=k.startSymbol(),s=k.endSymbol();return{restrict:"EA",scope:!0,link:function(a,b,c){function d(){a.tt_isOpen?n():k()}function k(){(!F||a.$eval(c[m+"Enable"]))&&(a.tt_popupDelay?y=g(t,a.tt_popupDelay):a.$apply(t))}function n(){a.$apply(function(){u()})}function t(){var c,d,e,f;if(a.tt_content){x&&g.cancel(x),B.css({top:0,left:0,display:"block","z-index":9999}),C?(z=z||i.find("body"),z.append(B)):b.after(B),c=C?j.offset(b):j.position(b),d=B.prop("offsetWidth"),e=B.prop("offsetHeight");var h=10;switch(a.tt_placement){case"right":f=C?{top:c.top+c.height/2-e/2,left:c.left+c.width+G}:{top:c.top+c.height/2-e/2,left:c.left+c.width+h+G};break;case"below":f=C?{top:c.top+c.height+G,left:c.left+c.width/2-d/2}:{top:c.top+c.height+h+G,left:c.left+c.width/2-d/2};break;case"left":f=C?{top:c.top+c.height/2-e/2,left:c.left-d-G}:{top:c.top+c.height/2-e/2,left:c.left-d-h-G};break;default:f=C?{top:c.top-e-G,left:c.left+c.width/2-d/2}:{top:c.top-e-h-G,left:c.left+c.width/2-d/2}}f.top+="px",f.left+="px",B.css(f),a.tt_isOpen=!0}}function u(){a.tt_isOpen=!1,g.cancel(y),angular.isDefined(a.tt_animation)&&a.tt_animation()?x=g(function(){l(B[0])},500):l(B[0])}function v(){b.removeAttr("title"),w||(H?b.attr("title",a.tooltipAriaLabel):b.attr("title",a.tt_content))}b.attr("tabindex")||b.attr("tabindex","0");var w=!1;b.bind("mouseenter",function(){w=!0,b.removeAttr("title")}),b.bind("mouseleave",function(){w=!1,v()}),a.parentAttrs=c;var x,y,z,A="<div "+q+'-popup title="'+r+"tt_title"+s+'" content="'+r+"tt_content"+s+'" placement="'+r+"tt_placement"+s+'" animation="tt_animation()" is-open="tt_isOpen" stylett="'+r+"tt_style"+s+'" ></div>',B=f(A)(a),C=angular.isDefined(p.appendToBody)?p.appendToBody:!1,D=o(void 0),E=!1,F=angular.isDefined(c[m+"Enable"]),G=0,H=!1;a.tt_isOpen=!1,a.$watch("tt_isOpen",function(a,b){a===b||a||l(B[0])}),c.$observe(e,function(b){b?(a.tt_content=b,v()):a.tt_isOpen&&u()}),c.$observe(m+"Title",function(b){a.tt_title=b}),c.$observe(m+"Placement",function(b){a.tt_placement=angular.isDefined(b)?b:p.placement}),c.$observe(m+"Style",function(b){a.tt_style=angular.isDefined(b)?b:p.stylett}),c.$observe(m+"Animation",function(b){a.tt_animation=angular.isDefined(b)?h(b):function(){return p.animation}}),c.$observe(m+"PopupDelay",function(b){var c=parseInt(b,10);a.tt_popupDelay=isNaN(c)?p.popupDelay:c}),c.$observe(m+"Trigger",function(a){E&&(b.unbind(D.show,k),b.unbind(D.hide,n)),D=o(a),"focus"===D.show?(b.bind("focus",k),b.bind("blur",n),b.bind("click",function(a){a.stopPropagation()})):D.show===D.hide?b.bind(D.show,d):(b.bind(D.show,k),b.bind(D.hide,n)),E=!0}),c.$observe(m+"AppendToBody",function(b){C=angular.isDefined(b)?h(b)(a):C}),c.$observe(m+"Offset",function(a){G=angular.isDefined(a)?parseInt(a,10):0}),c.$observe(m+"AriaLabel",function(b){angular.isDefined(b)?(a.tooltipAriaLabel=b,H=!0):H=!1,v()}),C&&a.$on("$locationChangeSuccess",function(){a.tt_isOpen&&u()}),a.$on("$destroy",function(){a.tt_isOpen?u():B.remove()})}}}}]}]).directive("tooltipPopup",["$document","$documentBind",function(a,b){return{restrict:"EA",replace:!0,transclude:!0,scope:{content:"@",placement:"@",animation:"&",isOpen:"=",stylett:"@"},templateUrl:"app/scripts/ng_js_att_tpls/tooltip/tooltip-popup.html",link:function(a,c){a.$watch("isOpen",function(){a.isOpen}),c.bind("click",function(a){a.stopPropagation()});var d=function(){a.$apply(function(){a.isOpen=!1})};b.event("click","isOpen",d,a,!0,10)}}}]).directive("tooltip",["$tooltip",function(a){return a("tooltip","tooltip","mouseenter")}]).directive("tooltipCondition",["$timeout",function(a){return{restrict:"EA",replace:!0,scope:{tooltipCondition:"@?"},template:'<p><span tooltip="{{tooltipCondition}}" ng-if="showpop">{{tooltipCondition}}</span><span id="innerElement" ng-hide="showpop">{{tooltipCondition}}</span></p>',link:function(b,c,d){b.showpop=!1,"true"===d.height?a(function(){var a=c[0].offsetHeight,d=c.children(0)[0].offsetHeight;d>a&&(b.showpop=!0)}):b.tooltipCondition.length>=25&&(b.showpop=!0)}}}]),angular.module("att.abs.popOvers",["att.abs.tooltip","att.abs.utilities","ngSanitize"]).directive("popover",["$tooltip",function(a){return a("popover","popover","click")}]).directive("popoverPopup",["$document","$documentBind","$timeout","events","DOMHelper",function(a,b,c,d,e){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/popOvers/popOvers.html",scope:{content:"@",placement:"@",animation:"&",isOpen:"=",stylett:"@"},link:function(a,f,g,h){a.closeable=!1;try{a.closeable=""===a.$parent.parentAttrs.closeable?!0:!1}catch(i){}var j=void 0,k=void 0,l=function(b){a.$apply(function(){a.isOpen=!1})},m=function(b){(27===b.which||27===b.keyCode)&&(console.log("ESC was pressed!"),a.$apply(function(){a.isOpen=!1}))};c(function(){k=e.firstTabableElement(f)},10,!1),a.$watch("isOpen",function(b){if(a.isOpen){if(j=document.activeElement,angular.isDefined(k))try{k.focus()}catch(c){}}else if(angular.isDefined(j))try{j.focus()}catch(c){}}),a.$watch("stylett",function(b){a.popOverStyle=b}),a.$watch("placement",function(b){a.popOverPlacement=b}),a.closeMe=function(){a.isOpen=!1},f.bind("click",function(a){d.stopPropagation(a)}),b.event("click","isOpen",l,a,!0,10),b.event("keydown","isOpen",m,a,!0,10)}}}]),angular.module("att.abs.profileCard",[]).constant("profileStatus",{status:{ACTIVE:{status:"Active",color:"green"},DEACTIVATED:{status:"Deactivated",color:"red"},LOCKED:{status:"Locked",color:"red"},IDLE:{status:"Idle",color:"yellow"},PENDING:{status:"Pending",color:"blue"}},role:"COMPANY ADMINISTRATOR"}).directive("profileCard",["$http","$q","profileStatus",function(a,b,c){return{restrict:"EA",replace:"true",templateUrl:function(a,b){return b.addUser?"app/scripts/ng_js_att_tpls/profileCard/addUser.html":"app/scripts/ng_js_att_tpls/profileCard/profileCard.html"},scope:{profile:"="},link:function(a,d,e){function f(a){var c=b.defer(),d=new Image;return d.onerror=function(){c.reject(!1)},d.onload=function(){c.resolve(!0)},void 0!==a&&a.length>0?d.src=a:c.reject(!1),c.promise}if(a.image=!0,!e.addUser){a.image=!1,f(a.profile.img).then(function(b){a.image=b});var g=a.profile.name.split(" ");a.initials="";for(var h=0;h<g.length;h++)a.initials+=g[h][0];a.profile.role.toUpperCase()===c.role&&(a.badge=!0);var i=c.status[a.profile.state.toUpperCase()];i&&(a.profile.state=c.status[a.profile.state.toUpperCase()].status,a.colorIcon=c.status[a.profile.state.toUpperCase()].color,(a.profile.state.toUpperCase()===c.status.PENDING.status.toUpperCase()||a.profile.state.toUpperCase()===c.status.LOCKED.status.toUpperCase())&&(a.profile.lastLogin=a.profile.state));var j=(new Date).getTime(),k=new Date(a.profile.lastLogin).getTime(),l=(j-k)/864e5;1>=l?a.profile.lastLogin="Today":2>=l&&(a.profile.lastLogin="Yesterday")}}}}]),angular.module("att.abs.progressBars",[]).directive("attProgressBar",[function(){return{restrict:"A",replace:!0,templateUrl:"app/scripts/ng_js_att_tpls/progressBars/progressBars.html"}}]),angular.module("att.abs.radio",[]).constant("attRadioConfig",{activeClass:"att-radio--on",disabledClass:"att-radio--disabled"}).directive("attRadio",["$compile","attRadioConfig",function(a,b){return{scope:{},restrict:"A",require:"ngModel",link:function(c,d,e,f){var g=f;c.radioVal="";var h=angular.element('<div att-accessibility-click="13,32" ng-click="updateModel($event)" class="att-radio"></div>');d.attr("value",e.attRadio),d.removeAttr("att-radio"),d.removeAttr("title"),d.attr("ng-model","radioVal"),h.append(d.prop("outerHTML")),h.append('<div class="att-radio__indicator"></div>'),h.attr("title",e.title);var i=h.prop("outerHTML");i=a(i)(c),d=d.replaceWith(i);var j=i.find("input");j.on("focus",function(){i.css("outline","thin dotted #333"),i.css("outline","-webkit-focus-ring-color auto 5px")}),j.on("blur",function(){i.css("outline","none")}),g.$render=function(){c.radioVal=g.$modelValue;var a=angular.equals(g.$modelValue,e.attRadio);i.toggleClass(b.activeClass,a)},c.updateModel=function(){j[0].focus();var a=i.hasClass(b.activeClass);a||c.disabled||(g.$setViewValue(a?null:e.attRadio),g.$render())},e.$observe("disabled",function(a){c.disabled=a||"disabled"===a||"true"===a,c.disabled&&(i.addClass(b.disabledClass),i.attr("tabindex","-1"))})}}}]),angular.module("att.abs.scrollbar",["att.abs.position"]).constant("attScrollbarConstant",{defaults:{axis:"y",navigation:!1,wheel:!0,wheelSpeed:40,wheelLock:!0,scrollInvert:!1,trackSize:!1,thumbSize:!1,alwaysVisible:!0}}).directive("attScrollbar",["$window","$timeout","$parse","$animate","attScrollbarConstant","$position",function(a,b,c,d,e,f){return{restrict:"A",scope:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/scrollbar/scrollbar.html",controller:["$scope","$element","$attrs",function(g,h,i){function j(){w.contentRatio<=1&&w.contentPosition>w.contentSize-w.viewportSize?w.contentPosition=w.contentSize-w.viewportSize:w.contentRatio>1&&w.contentPosition>0&&(w.contentPosition=0),w.contentPosition<=0?g.prevAvailable=!1:g.prevAvailable=!0,w.contentPosition>=w.contentSize-w.viewportSize?g.nextAvailable=!1:g.nextAvailable=!0}function k(){F?(z.on("touchstart",m),C.on("touchstart",m)):(C.on("mousedown",n),B.on("mousedown",r)),angular.element(a).on("resize",l),w.options.wheel&&h.on(G,o)}function l(){w.update()}function m(a){1===a.touches.length&&(a.stopPropagation(),n(a.touches[0]))}function n(a){x.addClass("scroll-no-select"),h.addClass("scroll-no-select"),w.options.alwaysVisible||B.addClass("visible"),D=E?a.clientX:a.clientY,w.thumbPosition=parseInt(C.css(J),10)||0,F?(L=!1,K=!1,z.on("touchmove",p),z.on("touchend",s),C.on("touchmove",q),C.on("touchend",s)):(y.on("mousemove",r),y.on("mouseup",s),C.on("mouseup",s))}function o(c){if(!(w.contentRatio>=1)){w.options.alwaysVisible||(v&&b.cancel(v),B.addClass("visible"),v=b(function(){B.removeClass("visible")},100));var d=c&&c.originalEvent||c||a.event,e=w.options.axis.toUpperCase(),f={X:d.deltaX||0,Y:d.deltaY||0},i=0===d.deltaMode?w.options.wheelSpeed:1;w.options.scrollInvert&&(i*=-1),"mousewheel"===G&&(f.Y=-1*d.wheelDelta/40,d.wheelDeltaX&&(f.X=-1*d.wheelDeltaX/40)),f.X*=-1/i,f.Y*=-1/i;var k=f[e];w.contentPosition-=k*w.options.wheelSpeed,w.contentPosition=Math.min(w.contentSize-w.viewportSize,Math.max(0,w.contentPosition)),fireEvent(h[0],"move"),j(),C.css(J,w.contentPosition/w.trackRatio+"px"),A.css(J,-w.contentPosition+"px"),(w.options.wheelLock||w.contentPosition!==w.contentSize-w.viewportSize&&0!==w.contentPosition)&&d.preventDefault(),g.$apply()}}function p(a){a.preventDefault(),L=!0,r(a.touches[0])}function q(a){a.preventDefault(),K=!0,r(a.touches[0])}function r(a){if(!(w.contentRatio>=1)){var b=E?a.clientX:a.clientY,c=b-D;(w.options.scrollInvert&&!F||F&&!w.options.scrollInvert)&&(c=D-b),L&&F&&(c=D-b),K&&F&&(c=b-D);var d=Math.min(w.trackSize-w.thumbSize,Math.max(0,w.thumbPosition+c));w.contentPosition=d*w.trackRatio,fireEvent(h[0],"move"),j(),C.css(J,d+"px"),A.css(J,-w.contentPosition+"px"),g.$apply()}}function s(){x.removeClass("scroll-no-select"),h.removeClass("scroll-no-select"),w.options.alwaysVisible||B.removeClass("visible"),y.off("mousemove",r),y.off("mouseup",s),C.off("mouseup",s),y.off("touchmove",p),y.off("ontouchend",s),C.off("touchmove",q),C.off("touchend",s)}var t={axis:i.attScrollbar||e.defaults.axis,navigation:i.navigation||e.defaults.navigation,wheel:e.defaults.wheel,wheelSpeed:e.defaults.wheelSpeed,wheelLock:e.defaults.wheelLock,scrollInvert:e.defaults.scrollInvert,trackSize:e.defaults.trackSize,thumbSize:e.defaults.thumbSize,alwaysVisible:e.defaults.alwaysVisible},u=i.scrollbar;u=u?c(u)(g):{},this.options=angular.extend({},t,u),this._defaults=t;var v,w=this,x=angular.element(document.querySelectorAll("body")[0]),y=angular.element(document),z=angular.element(h[0].querySelectorAll(".scroll-viewport")[0]),A=angular.element(h[0].querySelectorAll(".scroll-overview")[0]),B=angular.element(h[0].querySelectorAll(".scroll-bar")[0]),C=angular.element(h[0].querySelectorAll(".scroll-thumb")[0]),D=0,E="x"===this.options.axis,F=!1,G="onwheel"in document?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",H=E?"width":"height",I=H.charAt(0).toUpperCase()+H.slice(1).toLowerCase(),J=E?"left":"top",K=!1,L=!1;("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)&&(F=!0),this.contentPosition=0,this.viewportSize=0,this.contentSize=0,this.contentRatio=0,this.trackSize=0,this.trackRatio=0,this.thumbSize=0,this.thumbPosition=0,this.initialize=function(){return this.options.alwaysVisible||B.css("opacity",0),w.update(),k(),w},this.setSizeData=function(){this.viewportSize=z.prop("offset"+I)||1,this.contentSize=A.prop("scroll"+I)||1,this.contentRatio=this.viewportSize/this.contentSize,this.trackSize=this.options.trackSize||this.viewportSize,this.thumbSize=Math.min(this.trackSize,Math.max(0,this.options.thumbSize||this.trackSize*this.contentRatio)),this.trackRatio=this.options.thumbSize?(this.contentSize-this.viewportSize)/(this.trackSize-this.thumbSize):this.contentSize/this.trackSize},this.update=function(a){return w.setSizeData(),D=B.prop("offsetTop"),B.toggleClass("disable",this.contentRatio>=1||isNaN(this.contentRatio)),!this.options.alwaysVisible&&this.contentRatio<1&&this.viewportSize>0&&d.addClass(B,"visible").then(function(){d.removeClass(B,"visible"),g.$digest()}),null!==a&&("bottom"===a?this.contentPosition=this.contentSize-this.viewportSize:this.contentPosition=parseInt(a,10)||0),j(),C.css(J,w.contentPosition/w.trackRatio+"px"),B.css(H,w.trackSize+"px"),C.css(H,w.thumbSize+"px"),A.css(J,-w.contentPosition+"px"),this},fireEvent=function(a,b){var c,d=a;document.createEvent?(c=document.createEvent("HTMLEvents"),c.initEvent(b,!0,!1),d.dispatchEvent(c)):document.createEventObject&&(c=document.createEventObject(),d.fireEvent("on"+b,c))},g.customScroll=function(a){if(!(w.contentRatio>=1)){var b,c=f.position(z);b=E?c.width:c.height,a?w.contentPosition+=b:w.contentPosition-=b,w.contentPosition=Math.min(w.contentSize-w.viewportSize,Math.max(0,w.contentPosition)),fireEvent(h[0],"move"),j(),C.css(J,w.contentPosition/w.trackRatio+"px"),A.css(J,-w.contentPosition+"px")}},this.cleanup=function(){z.off("touchstart",m),C.off("mousedown",n),B.off("mousedown",r),C.off("touchmove",q),C.off("touchend",s),angular.element(a).off("resize",l),h.off(G,o),w.options.alwaysVisible=!0,s()}}],link:function(a,c,d,e){a.navigation=e.options.navigation,a.viewportHeight=d.viewportHeight,a.viewportWidth=d.viewportWidth,a.scrollbarAxis=e.options.axis,"x"===a.scrollbarAxis?c.addClass("horizontal"):"y"===a.scrollbarAxis&&c.addClass("vertical");var f=c.css("position");"relative"!==f&&"absolute"!==f&&c.css("position","relative"),a.$watch(function(){b(g,100,!1)});var g=function(){var b=angular.element(c[0].querySelectorAll(".scroll-overview")[0]),d=b.prop("scrollHeight"),f=a.oldValue;d!==f&&(a.oldValue=d,e.update())};e.initialize(),c.on("$destroy",function(){e.cleanup()})}}}]),angular.module("att.abs.search",["att.abs.utilities","att.abs.position","att.abs.utilities"]).directive("attSearch",["$document","$filter","$isElement","$documentBind","$timeout","$log","keymap",function(a,b,c,d,e,f,g){return{restrict:"A",scope:{cName:"=attSearch"},transclude:!1,replace:!1,require:"ngModel",templateUrl:"app/scripts/ng_js_att_tpls/search/search.html",link:function(b,h,i,j){b.selectedIndex=-1,b.selectedOption=i.placeholder,b.isDisabled=!1,b.className="select2-match",b.showSearch=!1,b.showlist=!1;var k="",l=new Date,m=void 0,n=[];e(function(){n=h.find("li")},10),f.warn("attSearch is deprecated, please use attSelect instead. This component will be removed by version 2.7."),i.noFilter||"true"===i.noFilter?b.noFilter=!0:b.noFilter=!1,"false"===i.placeholderAsOption?b.selectedOption=i.placeholder:b.selectMsg=i.placeholder,(i.startsWithFilter||"true"===i.startsWithFilter)&&(b.startsWithFilter=!0),"true"===i.showInputFilter&&(b.showSearch=!1,f.warn("showInputFilter functionality has been removed from the library.")),i.disabled&&(b.isDisabled=!0),m=angular.element(h).children().eq(0).find("a")[0];var o=0,p=function(){if(b.noFilter){var a=k,c=0;for(c=o;c<b.cName.length;c++)if(b.cName[c].title.startsWith(a)&&c!==b.selectedIndex){b.selectOption(b.cName[c],c,b.showlist),o=c,k="";break}(c>=b.cName.length||!b.cName[c+1].title.startsWith(a))&&o>0&&(o=0)}};b.showDropdown=function(){i.disabled||(b.showlist=!b.showlist,b.setSelectTop())},h.bind("keydown",function(a){if(g.isAllowedKey(a.keyCode)||g.isControl(a)||g.isFunctionKey(a))switch(a.preventDefault(),a.stopPropagation(),a.keyCode){case g.KEY.DOWN:b.selectNext();break;case g.KEY.UP:b.selectPrev(),k="";break;case g.KEY.ENTER:b.selectCurrent(),k="";break;case g.KEY.BACKSPACE:b.title="",k="",b.$apply();break;case g.KEY.SPACE:b.noFilter||(b.title+=" "),b.$apply();break;case g.KEY.ESC:""===b.title||void 0===b.title?(b.showlist=!1,m.focus(),b.$apply()):(b.title="",b.$apply()),b.noFilter&&(k="",m.focus(),b.showlist=!1)}else if(9!==a.keyCode){if(b.noFilter){var c=new Date,d=Math.abs(l.getMilliseconds()-c.getMilliseconds());l=c,d>100&&(k=""),k=k?k+String.fromCharCode(a.keyCode):String.fromCharCode(a.keyCode),k.length>2&&(k=k.substring(0,2)),p()}else b.showlist=!0,b.title=b.title?b.title+String.fromCharCode(a.keyCode):String.fromCharCode(a.keyCode);b.$apply()}else 9===a.keyCode&&(b.showlist=!1,b.title="",b.$apply())}),b.selectOption=function(a,c,d){-1===c||"-1"===c?(b.selCategory="",b.selectedIndex=-1,j.$setViewValue(""),"false"!==i.placeholderAsOption&&(b.selectedOption=b.selectMsg)):(b.selCategory=b.cName[c],b.selectedIndex=c,j.$setViewValue(b.selCategory),b.selectedOption=b.selCategory.title,angular.isDefined(n[c])&&n[c].focus()),b.title="",d||(b.showlist=!1,m.focus()),b.$apply()},b.selectCurrent=function(){b.showlist?(b.selectOption(b.selectMsg,b.selectedIndex,!1),b.$apply()):(b.showlist=!0,b.setSelectTop(),b.$apply())},b.hoverIn=function(a){b.selectedIndex=a,b.focusme()},b.setSelectTop=function(){e(function(){if(b.showlist&&!b.noFilter){var a=angular.element(h)[0].querySelector(".select2-results");if(angular.element(a.querySelector(".select2-result-current"))[0])var c=angular.element(a.querySelector(".select2-result-current"))[0].offsetTop;angular.element(a)[0].scrollTop=c}})},b.setCurrentTop=function(){e(function(){if(b.showlist){var a=angular.element(h)[0].querySelector(".select2-results");if(angular.element(a.querySelector(".hovstyle"))[0])var c=angular.element(a.querySelector(".hovstyle"))[0].offsetTop;c<angular.element(a)[0].scrollTop?angular.element(a)[0].scrollTop-=30:c+30>angular.element(a)[0].clientHeight&&(angular.element(a)[0].scrollTop+=30)}})},b.selectNext=function(){b.selectedIndex+1<=b.cName.length-1&&(b.selectedIndex+=1,b.showlist||b.selectOption(b.selectMsg,b.selectedIndex,!1),b.focusme(),b.$apply()),b.setCurrentTop()},b.selectPrev=function(){b.selectedIndex-1>=0?(b.selectedIndex-=1,b.showlist||b.selectOption(b.selectMsg,b.selectedIndex,!1),b.focusme(),b.$apply()):b.selectedIndex-1<0&&(void 0===i.placeholderAsOption||"true"===i.placeholderAsOption?b.selectedIndex=-1:b.selectedIndex=0,b.showlist||b.selectOption(b.selectMsg,b.selectedIndex,!1),b.focusme(),b.$apply()),b.setCurrentTop()},b.updateSelection=function(a){b.selectedOption=a.title,b.title=""},b.focusme=function(){e(function(){var a=angular.element(h).find("ul").find("li"),c=b.selectedIndex+2;b.noFilter&&(c=b.selectedIndex),angular.isDefined(a[c])&&a[c].focus()})},b.$watch("selCategory",function(a){a&&b.updateSelection(a)}),j.$viewChangeListeners.push(function(){b.$eval(i.ngChange)}),j.$render=function(){b.selCategory=j.$viewValue};var q=function(d){var e=c(angular.element(d.target),h,a);e||(b.showlist=!1,m.focus(),b.$apply())};d.click("showlist",q,b)}}}]),angular.module("att.abs.select",["att.abs.utilities","att.abs.position","att.abs.utilities"]).directive("attSelect",["$document","$filter","$isElement","$documentBind","$timeout","keymap","$log",function(a,b,c,d,e,f,g){return{restrict:"A",scope:{cName:"=attSelect"},transclude:!1,replace:!1,require:"ngModel",templateUrl:"app/scripts/ng_js_att_tpls/select/select.html",link:function(h,i,j,k){h.selectedIndex=-1,h.selectedOption=j.placeholder,h.isDisabled=!1,h.className="select2-match",h.showSearch=!1,h.showlist=!1;var l="",m=new Date,n=void 0,o=[];e(function(){o=i.find("li")},10),j.noFilter||"true"===j.noFilter?h.noFilter=!0:h.noFilter=!1,"false"===j.placeholderAsOption?h.selectedOption=j.placeholder:h.selectMsg=j.placeholder,(j.startsWithFilter||"true"===j.startsWithFilter)&&(h.startsWithFilter=!0),"true"===j.showInputFilter&&(h.showSearch=!1,g.warn("showInputFilter functionality has been removed from the library.")),j.disabled&&(h.isDisabled=!0);var p=function(){return h.startsWithFilter?"startsWith":"filter"};n=angular.element(i).children().eq(0).find("span")[0];var q=0,r=function(){if(h.noFilter){var a=l,b=0;for(b=q;b<h.cName.length;b++)if(h.cName[b].title.startsWith(a)&&b!==h.selectedIndex){
+h.selectOption(h.cName[b],b,h.showlist),q=b,l="";break}(b>=h.cName.length||!h.cName[b+1].title.startsWith(a))&&q>0&&(q=0)}};h.showDropdown=function(){j.disabled||(h.showlist=!h.showlist,h.setSelectTop(),h.focusme())},i.bind("keydown",function(a){if(f.isAllowedKey(a.keyCode)||f.isControl(a)||f.isFunctionKey(a))switch(a.preventDefault(),a.stopPropagation(),a.keyCode){case f.KEY.DOWN:h.selectNext();break;case f.KEY.UP:h.selectPrev(),l="";break;case f.KEY.ENTER:h.selectCurrent(),l="";break;case f.KEY.BACKSPACE:h.title="",l="",h.$apply();break;case f.KEY.SPACE:h.noFilter||(h.title+=" "),h.$apply();break;case f.KEY.ESC:""===h.title||void 0===h.title?(h.showlist=!1,n.focus(),h.$apply()):(h.title="",h.$apply()),h.noFilter&&(l="",n.focus(),h.showlist=!1)}else if(a.keyCode!==f.KEY.TAB){if(h.noFilter){var c=new Date,d=Math.abs(m.getMilliseconds()-c.getMilliseconds());m=c,d>100&&(l=""),l=l?l+String.fromCharCode(a.keyCode):String.fromCharCode(a.keyCode),l.length>2&&(l=l.substring(0,2)),r()}else if(h.showlist=!0,h.title=h.title?h.title+String.fromCharCode(a.keyCode):String.fromCharCode(a.keyCode),""!=h.title)for(var e=b(p())(h.cName,h.title),g=0;g<e.length;g++)for(var i=0;i<h.cName.length&&angular.isDefined(h.cName[h.selectedIndex]);i++)if(e[g].title===h.cName[h.selectedIndex].title){h.selectedIndex=g,h.focusme();break}h.$apply()}else a.keyCode===f.KEY.TAB&&(h.showlist=!1,h.title="",h.$apply())}),h.selectOption=function(a,c,d){if(-1===c||"-1"===c)h.selCategory="",h.selectedIndex=-1,k.$setViewValue(""),"false"!==j.placeholderAsOption&&(h.selectedOption=h.selectMsg);else{if(""!=h.title){var f=b(p())(h.cName,h.title);if(angular.isDefined(f)&&angular.isDefined(f[c]))for(var g=0;g<h.cName.length;g++)if(f[c].title===h.cName[g].title){c=g;break}}h.selCategory=h.cName[c],h.selectedIndex=c,k.$setViewValue(h.selCategory),h.selectedOption=h.selCategory.title,e(function(){if(angular.isDefined(o[c]))try{o[index].focus()}catch(a){}})}h.title="",d||(h.showlist=!1,n.focus())},h.selectCurrent=function(){h.showlist?h.selectOption(h.selectMsg,h.selectedIndex,!1):(h.showlist=!0,h.setSelectTop()),h.$apply()},h.hoverIn=function(a){h.selectedIndex=a,h.focusme()},h.setSelectTop=function(){e(function(){if(h.showlist&&!h.noFilter){var a=angular.element(i)[0].querySelector(".select2-results");if(angular.element(a.querySelector(".select2-result-current"))[0])var b=angular.element(a.querySelector(".select2-result-current"))[0].offsetTop;angular.element(a)[0].scrollTop=b}})},h.setCurrentTop=function(){e(function(){if(h.showlist){var a=angular.element(i)[0].querySelector(".select2-results");if(angular.element(a.querySelector(".hovstyle"))[0])var b=angular.element(a.querySelector(".hovstyle"))[0].offsetTop;b<angular.element(a)[0].scrollTop?angular.element(a)[0].scrollTop-=30:b+30>angular.element(a)[0].clientHeight&&(angular.element(a)[0].scrollTop+=30)}})},h.selectNext=function(){h.cName.length;if(h.selectedIndex+1<=h.cName.length-1){h.selectedIndex+=1;var a=h.cName[h.selectedIndex].disabled;a&&(h.selectedIndex+=1),h.showlist||h.selectOption(h.selectMsg,h.selectedIndex,!1),h.focusme(),h.$apply()}h.setCurrentTop()},h.selectPrev=function(){if(h.selectedIndex-1>=0){h.selectedIndex-=1;var a=h.cName[h.selectedIndex].disabled;a&&(h.selectedIndex-=1),h.showlist||h.selectOption(h.selectMsg,h.selectedIndex,!1),h.focusme(),h.$apply()}else h.selectedIndex-1<0&&(void 0===j.placeholderAsOption||"true"===j.placeholderAsOption?void 0===j.placeholder?h.selectedIndex=0:h.selectedIndex=-1:h.selectedIndex=0,h.showlist||h.selectOption(h.selectMsg,h.selectedIndex,!1),h.focusme(),h.$apply());h.setCurrentTop()},h.updateSelection=function(a){h.selectedOption=a.title,h.title="",a.index<0&&h.selectOption(h.selectMsg,a.index,h.showlist)},h.focusme=function(){e(function(){var a=angular.element(i).find("ul").find("li"),b=h.selectedIndex+2;if(h.noFilter&&(b=h.selectedIndex),angular.isDefined(a[b]))try{a[b].focus()}catch(c){}})},h.$watch("selCategory",function(a){a&&h.updateSelection(a)}),k.$viewChangeListeners.push(function(){h.$eval(j.ngChange)}),k.$render=function(){h.selCategory=k.$viewValue};var s=function(b){var d=c(angular.element(b.target),i,a);d||(h.showlist=!1,n.focus(),h.$apply())};d.click("showlist",s,h)}}}]).directive("textDropdown",["$document","$isElement","$documentBind","keymap",function(a,b,c,d){return{restrict:"EA",replace:!0,scope:{actions:"=actions",defaultAction:"=defaultAction",onActionClicked:"=?"},templateUrl:"app/scripts/ng_js_att_tpls/select/textDropdown.html",link:function(e,f,g){e.selectedIndex=0,e.selectedOption=g.placeholder,e.isDisabled=!1,e.isActionsShown=!1;var h=void 0;if(g.disabled&&(e.isDisabled=!0),h=f.find("div")[0],angular.isDefined(e.defaultAction))if(angular.isDefined(e.defaultAction)||""!==e.defaultAction){for(var i in e.actions)if(e.actions[i]===e.defaultAction){e.currentAction=e.actions[i],e.selectedIndex=e.actions.indexOf(i),e.isActionsShown=!1;break}}else e.currentAction=e.actions[0];else e.currentAction=e.actions[0],e.selectedIndex=0;e.toggle=function(){e.isActionsShown=!e.isActionsShown},e.chooseAction=function(a,b,c){null!=a?(e.currentAction=b,e.selectedIndex=c):e.currentAction=e.actions[e.selectedIndex],angular.isFunction(e.onActionClicked)&&e.onActionClicked(e.currentAction),e.toggle()},e.isCurrentAction=function(a){return a===e.currentAction},f.bind("keydown",function(a){if(d.isAllowedKey(a.keyCode)||d.isControl(a)||d.isFunctionKey(a)){switch(a.preventDefault(),a.stopPropagation(),a.keyCode){case d.KEY.DOWN:e.selectNext();break;case d.KEY.UP:e.selectPrev();break;case d.KEY.ENTER:e.selectCurrent();break;case d.KEY.ESC:e.isActionsShown=!1,h.focus(),e.$apply()}return void e.$apply()}a.keyCode===d.KEY.TAB&&(e.isActionsShown=!1,e.$apply())}),e.selectCurrent=function(){e.selectedIndex<0&&(e.selectedIndex=0),e.isActionsShown?e.chooseAction(null,e.currentAction):e.toggle()},e.selectNext=function(){e.isActionsShown&&(e.selectedIndex+1<e.actions.length?e.selectedIndex+=1:e.selectedIndex=e.actions.length-1,e.$apply())},e.selectPrev=function(){e.isActionsShown&&(e.selectedIndex-1>=0?e.selectedIndex-=1:e.selectedIndex-1<0&&(e.selectedIndex=0),e.$apply())},e.hoverIn=function(a){e.selectedIndex=a};var j=function(c){var d=b(angular.element(c.target),f,a);d||(e.toggle(),e.$apply())};c.click("isActionsShown",j,e)}}}]),angular.module("att.abs.slider",["att.abs.position"]).constant("sliderDefaultOptions",{width:300,step:1,precision:0,disabledWidth:116}).directive("attSlider",["sliderDefaultOptions","$position","$document",function(a,b,c){return{restrict:"EA",replace:!0,transclude:!0,scope:{floor:"=",ceiling:"=",step:"@",precision:"@",width:"@",textDisplay:"=",value:"=",ngModelSingle:"=?",ngModelLow:"=?",ngModelHigh:"=?",ngModelDisabled:"=?"},templateUrl:"app/scripts/ng_js_att_tpls/slider/slider.html",link:function(d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y=0,z=!1;d.minPtrOffset=0,d.maxPtrOffset=0;var A=a.disabledWidth,B=e.children();n=B[0].children,n=angular.element(n[0]),x=B[1].children,w=angular.element(x[0]),v=angular.element(x[1]),u=angular.element(x[2]),o=null==f.ngModelSingle&&null==f.ngModelLow&&null==f.ngModelHigh&&null!=f.ngModelDisabled,r=null==f.ngModelSingle&&null!=f.ngModelLow&&null!=f.ngModelHigh,s="ngModelLow",t="ngModelHigh",r?w.remove():(v.remove(),u.remove()),o?(d.disabledStyle={width:A+"px",zIndex:1},d.handleStyle={left:A+"px"}):n.remove(),p=parseFloat(d.floor),q=parseFloat(d.ceiling),m=q-p,g=0,h=void 0!==f.width?f.width:0!==e[0].clientWidth?e[0].clientWidth:a.width,l=h-g,d.keyDown=function(c){if(39===c.keyCode){var f=b.position(e).left;if(i)"ngModelLow"===d.ref?(j=a.step+j,i=j):"ngModelHigh"===d.ref?(k=a.step+k,i=k):i=a.step+i;else{if(r&&"ngModelLow"===d.ref)return;i=a.step+f,j=k=i}}else if(37===c.keyCode){var g=b.position(w).left;i?0>=i||("ngModelLow"===d.ref?(j-=a.step,i=j):"ngModelHigh"===d.ref?(k-=a.step,i=k):(i-=a.step,j=k=i)):i=g-a.step}i>=0&&d.ptrOffset(i)},d.mouseDown=function(a,b){d.ref=b,z=!0,y=r?d.ref===s?a.clientX-d.minPtrOffset:a.clientX-d.maxPtrOffset:i?a.clientX-i:a.clientX,o&&(d.ref="ngModelDisabled",d.disabledStyle={width:A+"px",zIndex:1})},d.moveElem=function(a){if(z){var b;b=a.clientX,i=b-y,d.ptrOffset(i)}},d.focus=function(a,b){console.log(b),d.ref=b},d.mouseUp=function(a){z=!1,v.removeClass("dragging"),u.removeClass("dragging"),w.removeClass("dragging"),c.off("mousemove")},d.keyUp=function(a){z=!1,v.removeClass("dragging"),u.removeClass("dragging"),w.removeClass("dragging"),c.off("mousemove")},d.calStep=function(a,b,c,d){var e,f,g,h;return null===d&&(d=0),null===c&&(c=1/Math.pow(10,b)),f=(a-d)%c,h=f>c/2?a+c-f:a-f,e=Math.pow(10,b),g=h*e/e,g.toFixed(b)},d.percentOffset=function(a){return(a-g)/l*100},d.ptrOffset=function(b){var c,e;if(b=Math.max(Math.min(b,h),g),c=d.percentOffset(b),e=p+m*c/100,r){var f;d.ref===s?(d.minHandleStyle={left:b+"px"},d.minNewVal=e,d.minPtrOffset=b,v.addClass("dragging"),e>d.maxNewVal&&(d.ref=t,u[0].focus(),d.maxNewVal=e,d.maxPtrOffset=b,u.addClass("dragging"),v.removeClass("dragging"),d.maxHandleStyle={left:b+"px"})):(d.maxHandleStyle={left:b+"px"},d.maxNewVal=e,d.maxPtrOffset=b,u.addClass("dragging"),e<d.minNewVal&&(d.ref=s,v[0].focus(),d.minVal=e,d.minPtrOffset=b,v.addClass("dragging"),u.removeClass("dragging"),d.minHandleStyle={left:b+"px"})),f=parseInt(d.maxPtrOffset)-parseInt(d.minPtrOffset),d.rangeStyle={width:f+"px",left:d.minPtrOffset+"px"}}else o&&b>A?d.rangeStyle={width:b+"px",zIndex:0}:(w.addClass("dragging"),d.rangeStyle={width:b+"px"}),d.handleStyle={left:b+"px"};(void 0===d.precision||void 0===d.step)&&(d.precision=a.precision,d.step=a.step),e=d.calStep(e,parseInt(d.precision),parseFloat(d.step),parseFloat(d.floor)),d[d.ref]=e}}}}]).directive("attSliderMin",[function(){return{require:"^attSlider",restrict:"EA",replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/slider/minContent.html"}}]).directive("attSliderMax",[function(){return{require:"^attSlider",restrict:"EA",replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/slider/maxContent.html"}}]),angular.module("att.abs.splitButtonDropdown",["att.abs.utilities","att.abs.position"]).directive("attButtonDropdown",["$document","$parse","$documentBind","$timeout","$isElement",function(a,b,c,d,e){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdown.html",scope:{btnText:"@",btnType:"@",btnLink:"@",btnClick:"&",toggleTitle:"@"},controller:["$scope","$element",function(a,b){this.cSelected=0,this.closeAndFocusDropdown=function(){a.isDropDownOpen&&a.$apply(function(){a.isDropDownOpen=!1,angular.element(b[0].querySelector("a.dropdown-toggle"))[0].focus()})},this.focusNext=function(){this.cSelected=this.cSelected+1>=this.childScopes.length?a.cycleSelection===!0?0:this.childScopes.length-1:this.cSelected+1,this.childScopes[this.cSelected].sFlag=!0,this.resetFlag(this.cSelected)},this.focusPrev=function(){this.cSelected=this.cSelected-1<0?a.cycleSelection===!0?this.childScopes.length-1:0:this.cSelected-1,this.childScopes[this.cSelected].sFlag=!0,this.resetFlag(this.cSelected)},this.childScopes=[],this.registerScope=function(a){this.childScopes.push(a)},this.resetFlag=function(a){for(var b=0;b<this.childScopes.length;b++)b!==a&&(this.childScopes[b].sFlag=!1)}}],link:function(f,g,h){f.isSmall=""===h.small?!0:!1,f.multiselect=""===h.multiselect?!0:!1,f.cycleSelection=""===h.cycleSelection?!0:!1,f.isDropDownOpen=!1,f.isActionDropdown=!1,f.btnText||(f.isActionDropdown=!0),f.clickFxn=function(){"function"!=typeof f.btnClick||f.btnLink||(f.btnClick=b(f.btnClick),f.btnClick()),f.multiselect===!0&&(f.isDropDownOpen=!1)},f.toggleDropdown=function(){"disabled"!==f.btnType&&(f.isDropDownOpen=!f.isDropDownOpen,f.isDropDownOpen&&d(function(){angular.element(g[0].querySelector("li"))[0].focus()}))},f.btnTypeSelector=function(a,b){""!==a?f.btnTypeFinal=a:f.btnTypeFinal=b};var i=function(b){var c=e(angular.element(b.target),g.find("ul").eq(0),a);c||(f.isDropDownOpen=!1,f.$apply())};c.click("isDropDownOpen",i,f),h.$observe("btnType",function(a){f.btnType=a}),h.$observe("attButtonDropdown",function(a){h.attButtonDropdown=a,f.btnTypeSelector(h.attButtonDropdown,f.btnType)})}}}]).directive("attButtonDropdownItem",["$location","keymap",function(a,b){return{restrict:"EA",require:["^attButtonDropdown","?ngModel"],replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdownItem.html",scope:{itemLink:"@"},link:function(a,c,d,e){angular.element(c[0].querySelector("a"));a.sFlag=!1,e[0].registerScope(a);e[1]?a.isSelected=e[1].$viewValue:a.isSelected=!1,c.bind("keydown",function(c){if(b.isAllowedKey(c.keyCode)||b.isControl(c)||b.isFunctionKey(c))switch(c.preventDefault(),c.stopPropagation(),c.keyCode){case b.KEY.DOWN:e[0].focusNext();break;case b.KEY.UP:e[0].focusPrev();break;case b.KEY.ENTER:a.selectItem();break;case b.KEY.ESC:e[0].closeAndFocusDropdown()}a.$apply()}),a.selectItem=function(){e[1]&&a.$evalAsync(function(){e[1].$setViewValue(!e[1].$viewValue)})}}}}]),angular.module("att.abs.splitIconButton",["att.abs.utilities"]).constant("iconStateConstants",{MIDDLE:"middle",LEFT:"left",RIGHT:"right",NEXT_TO_DROPDOWN:"next-to-dropdown",LEFT_NEXT_TO_DROPDOWN:"left-next-to-dropdown",DIR_TYPE:{LEFT:"left",RIGHT:"right",BUTTON:"button"},SPLIT_ICON_BTN_EVENT_EMITTER_KEY:"splitIconButtonTap"}).directive("expandableLine",[function(){return{restrict:"EA",replace:!0,priority:300,require:["^attSplitIconButton","expandableLine"],controller:["$scope",function(a){a.isActive=!1,this.setActiveState=function(b){a.isActive=b},this.isActive=a.isActive,this.dirType=a.dirType}],template:"<div ng-class=\"{'expand-line-container': !isActive, 'expand-line-container-active': isActive}\"> <div ng-class=\"{'hovered-line':isActive, 'vertical-line':!isActive}\"> </div></div>",scope:{dirType:"@"},link:function(a,b,c,d){var e=d[0],f=d[1];e.addSubCtrl(f)}}}]).controller("AttSplitIconCtrl",["$scope",function(a){this.setType=function(b){a.type=b},this.isDropdown=function(b){a.isDropdown=b},this.dropDownClicked=function(){a.dropDownClicked&&a.dropDownClicked()},this.dirType=a.dirType}]).directive("attSplitIcon",["$document","$timeout","iconStateConstants","$documentBind","events","keymap",function(a,b,c,d,e,f){return{restrict:"EA",replace:!0,priority:200,transclude:!0,require:["^attSplitIconButton","attSplitIcon"],templateUrl:"app/scripts/ng_js_att_tpls/splitIconButton/splitIcon.html",scope:{icon:"@",iconTitle:"@title",hoverWatch:"=",dropDownWatch:"=",dirType:"@"},controller:"AttSplitIconCtrl",link:function(a,b,g,h){var i=h[0],j=h[1];i.addSubCtrl(j),a.iconStateConstants=c;var k,l=0,m=!1;a.isDropdown=!1,a.isDropdownOpen=!1;var n=function(b){a.isDropdown&&(m?(m=!1,a.toggleDropdown()):a.toggleDropdown(!1),a.$apply())};g.dropDownId&&""!==g.dropDownId&&(a.dropDownId=g.dropDownId,a.isDropdown=!0),a.$on(c.SPLIT_ICON_BTN_EVENT_EMITTER_KEY,function(c,d){function g(b){switch(b.which){case f.KEY.TAB:a.toggleDropdown(!1),a.$digest();break;case f.KEY.ESC:n();break;case f.KEY.ENTER:a.isDropDownOpen&&h();break;case f.KEY.UP:b.preventDefault(),e.stopPropagation(b),a.isDropDownOpen&&a.previousItemInDropdown();break;case f.KEY.DOWN:b.preventDefault(),e.stopPropagation(b),a.isDropDownOpen?a.nextItemInDropdown():(m=!0,n(),h())}}function h(){if(void 0===k){k=[];for(var a=b.find("li"),c=0;c<a.length;c++)k.push(a.eq(c));k[l].children().eq(0).addClass("selected-item")}}if("boolean"==typeof d&&d)a.dropDownClicked(),a.isDropDownOpen&&k[l].eq(0).find("a")[0].click();else{var i=d;a.isDropdown&&g(i)}}),a.nextItemInDropdown=function(){k&&l<k.length-1&&(l++,k[l-1].children().eq(0).removeClass("selected-item"),k[l].children().eq(0).addClass("selected-item"))},a.previousItemInDropdown=function(){l>0&&(l--,k[l].children().eq(0).addClass("selected-item"),l+1<k.length&&k[l+1].children().eq(0).removeClass("selected-item"))},a.$watch("isIconHovered",function(b){a.hoverWatch=b}),a.$watch("type",function(b){function c(b,c,d,e,f){a.isMiddle=b,a.isNextToDropDown=c,a.isRight=d,a.isLeft=e,a.isLeftNextDropdown=f}switch(b){case a.iconStateConstants.MIDDLE:c(!0,!1,!1,!0,!1);break;case a.iconStateConstants.LEFT:c(!1,!1,!1,!0,!1);break;case a.iconStateConstants.RIGHT:c(!1,!1,!0,!1,!1);break;case a.iconStateConstants.NEXT_TO_DROPDOWN:c(!1,!0,!0,!0,!1);break;case a.iconStateConstants.LEFT_NEXT_TO_DROPDOWN:c(!1,!1,!1,!0,!0)}}),a.dropDownClicked=function(){m=!0},a.toggleDropdown=function(b){void 0!==b?a.isDropDownOpen=b:a.isDropDownOpen=!a.isDropDownOpen,a.dropDownWatch=a.isDropDownOpen},d.click("isDropdown",n,a)}}}]).controller("AttSplitIconButtonCtrl",["$scope","iconStateConstants",function(a,b){function c(a){var b=-1;for(var c in d.subCtrls){var e=d.subCtrls[c];if(e.dirType===a){b=c;break}}return b}this.subCtrls=[],a.isLeftLineShown=!0,a.isRightLineShown=!0,a.childrenScopes=[];var d=this;this.addSubCtrl=function(a){this.subCtrls.push(a)},this.isLeftLineShown=function(b){return void 0===b?a.isLeftLineShown:void(a.isLeftLineShown=b)},this.isRightLineShown=function(b){return void 0===b?a.isRightLineShown:void(a.isRightLineShown=b)},this.setLeftLineHover=function(d){var e=c(b.DIR_TYPE.LEFT);a.isLeftLineShown&&this.subCtrls[e]&&this.subCtrls[e].setActiveState&&this.subCtrls[e].setActiveState(d)},this.setRightLineHover=function(d){var e=c(b.DIR_TYPE.RIGHT);a.isRightLineShown&&this.subCtrls[e]&&this.subCtrls[e].setActiveState&&this.subCtrls[e].setActiveState(d)},this.toggleLines=function(d,e,f,g){function h(){for(var a=0;j>a;a++)if(i[a]===f){j-1>=a+1&&i[a+1].isLeftLineShown()&&i[a+1].subCtrls[k]&&i[a+1].subCtrls[k].setActiveState&&i[a+1].subCtrls[k].setActiveState(d),a-1>=0&&i[a-1].isRightLineShown()&&i[a-1].subCtrls[l]&&i[a-1].subCtrls[l].setActiveState&&i[a-1].subCtrls[l].setActiveState(d);break}}var i=e.subIconButtons,j=i.length,k=c(b.DIR_TYPE.LEFT),l=c(b.DIR_TYPE.RIGHT);g?i[j-2]==f?i[j-2].isLeftLineShown()?i[j-2].subCtrls[k].setActiveState(d):j-3>=0&&i[j-3].isRightLineShown()&&i[j-3].subCtrls[l].setActiveState(d):(h(),a.isLeftLineShown&&this.subCtrls[k].setActiveState(d),a.isRightLineShown&&this.subCtrls[l].setActiveState(d)):(a.isLeftLineShown||a.isRightLineShown||h(),a.isLeftLineShown&&this.subCtrls[k].setActiveState&&this.subCtrls[k].setActiveState(d),a.isRightLineShown&&this.subCtrls[l].setActiveState&&this.subCtrls[l].setActiveState(d))},this.setButtonType=function(a){var d=c(b.DIR_TYPE.BUTTON);this.subCtrls[d]&&this.subCtrls[d].setType&&this.subCtrls[d].setType(a)}}]).directive("attSplitIconButton",["$document","iconStateConstants","keymap",function(a,b,c){return{restrict:"EA",replace:!0,priority:100,transclude:!0,require:["^attSplitIconButtonGroup","attSplitIconButton"],controller:"AttSplitIconButtonCtrl",templateUrl:"app/scripts/ng_js_att_tpls/splitIconButton/splitIconButton.html",scope:{icon:"@",title:"@",dropDownId:"@"},link:function(a,d,e,f){a.title||(a.title=a.icon);var g=f[0],h=f[1];g.addIconButton(h),d.bind("keydown",function(d){(d.which===c.KEY.ESC||d.which===c.KEY.DOWN||d.which===c.KEY.ENTER||d.which===c.KEY.UP||d.which===c.KEY.TAB)&&(a.clickHandler(),a.$broadcast(b.SPLIT_ICON_BTN_EVENT_EMITTER_KEY,d))}),a.dropDownWatch=!1,a.iconStateConstants=b,a.clickHandler=function(){g.hideLeftLineRightButton(h)},a.$watch("isHovered",function(a){a?h.toggleLines(a,g,h,g.isDropDownOpen):h.toggleLines(a,g,h,g.isDropDownOpen)}),a.$watch("dropDownWatch",function(a){g.isDropDownOpen=a,g.toggleDropdownState(a)})}}}]).controller("AttSplitIconButtonGroupCtrl",["$scope","iconStateConstants",function(a,b){this.subIconButtons=[],this.addIconButton=function(a){this.subIconButtons.push(a)},this.isDropDownOpen=!1,this.hideLeftLineRightButton=function(a){var b=this.subIconButtons.length,c=this.subIconButtons[b-2],d=this.subIconButtons[b-1];a!=c&&a!=d&&d.setLeftLineHover(!1)},this.toggleDropdownState=function(a){var c=this.subIconButtons.length;c>2?a?(this.subIconButtons[c-2].isRightLineShown()?this.subIconButtons[c-2].setRightLineHover(!0):this.subIconButtons[c-1].setLeftLineHover(!0),this.subIconButtons[c-2].setButtonType(b.NEXT_TO_DROPDOWN)):(this.subIconButtons[c-1].setLeftLineHover(!1),this.subIconButtons[c-2].setButtonType(b.MIDDLE)):a?(this.subIconButtons[0].setRightLineHover(!0),this.subIconButtons[0].setButtonType(b.LEFT_NEXT_TO_DROPDOWN)):this.subIconButtons[0].setButtonType(b.LEFT)}}]).directive("attSplitIconButtonGroup",["$document","$timeout","iconStateConstants",function(a,b,c){return{restrict:"EA",replace:!0,priority:50,transclude:!0,require:"attSplitIconButtonGroup",controller:"AttSplitIconButtonGroupCtrl",templateUrl:"app/scripts/ng_js_att_tpls/splitIconButton/splitIconButtonGroup.html",scope:{},link:function(a,d,e,f){function g(){var a=f.subIconButtons,b=0,e=a.length-1;if(a[b].setButtonType(c.LEFT),a[b].isLeftLineShown(!1),a[b].isRightLineShown(!0),a[e].setButtonType(c.RIGHT),a[e].isRightLineShown(!1),a[e].isLeftLineShown(!1),e>=2){for(var g=1;e>g;)a[g].setButtonType(c.MIDDLE),a[g].isRightLineShown(!1),a[g].isLeftLineShown(!1),g++;for(var h=2;e>=h;)h==e?a[h].isLeftLineShown(!0):(a[h].isRightLineShown(!0),a[h].isLeftLineShown(!0)),h+=2}var i=d.find("ul");if(i.length>0){var j=e+1;if(j>2){var k=34*j-70+j/1.5+.5,l=k+"px";angular.element(i).css("left",l),angular.element(i).css("border-top-left-radius","0px")}else angular.element(i).css("left","0px")}}b(g,100)}}}]),angular.module("att.abs.stepSlider",["att.abs.position"]).constant("sliderConstants",{SLIDER:{settings:{from:1,to:40,step:1,smooth:!0,limits:!0,value:"3",dimension:"",vertical:!1},className:"jslider",selector:".jslider-"},EVENTS:{},COLORS:{GREEN:"green",BLUE_HIGHLIGHT:"blue",MAGENTA:"magenta",GOLD:"gold",PURPLE:"purple",DARK_BLUE:"dark-blue",REGULAR:"regular",WHITE:"white"}}).factory("utils",function(){return{offset:function(a){var b=a[0],c=0,d=0,e=document.documentElement||document.body,f=window.pageXOffset||e.scrollLeft,g=window.pageYOffset||e.scrollTop;return c=b.getBoundingClientRect().left+f,d=b.getBoundingClientRect().top+g,{left:c,top:d}},roundUpToScale:function(a,b,c,d){function e(a,b){var c=.1;return Math.abs(b-a)<=c?!0:!1}for(var f,g,h,i,j=1;j<b.length;j++){if(f=b[j-1],g=b[j],i=.5*(g-f)+f,0===f&&i>=a||e(f,a)){h=f;break}if(a>f&&(g>a||e(a,g))){h=g;break}}return c&&c>h?b[d]:h},valueForDifferentScale:function(a,b,c,d){var e=c/100;return 0===e?a:d[c]},convertToMbpsGbps:function(a,b,c){function d(a,b){var c=Math.pow(10,b);return~~(a*c)/c}var e=3;return c&&(e=c),a>1024&&1e6>a&&angular.equals(b,"Kbps")?(a=d(a/1e3,e),b="Mbps"):a>1024&&1e6>a&&angular.equals(b,"Mbps")?(a=d(a/1e3,e),b="Mbps"):b=(1024>=a&&angular.equals(b,"Mbps"),"Kbps"),a>=1e6&&angular.equals(b,"Kbps")&&(a=d(a/1e6,e),b="Gbps"),{unitValue:a,unitLabel:b}},getConversionFactorValue:function(a,b,c){if(a<=b[0].startVal)return{scaledVal:a,scaledDimension:c};var d=0;for(var e in b){var f=b[e];a>f.startVal&&(d=e)}var g=b[d].scaleFactor,h=a/g,i=b[d].dimension;return{scaledVal:h,scaledDimension:i}}}}).factory("sliderDraggable",["utils",function(a){function b(){this._init.apply(this,arguments)}return b.prototype.oninit=function(){},b.prototype.events=function(){},b.prototype.onmousedown=function(){this.ptr.css({position:"absolute"})},b.prototype.onmousemove=function(a,b,c){this.ptr.css({left:b,top:c})},b.prototype.onmouseup=function(){},b.prototype.isDefault={drag:!1,clicked:!1,toclick:!0,mouseup:!1},b.prototype._init=function(){if(arguments.length>0){if(this.ptr=arguments[0],this.parent=arguments[2],!this.ptr)return;this.is={},angular.extend(this.is,this.isDefault);var b=a.offset(this.ptr);this.d={left:b.left,top:b.top,width:this.ptr[0].clientWidth,height:this.ptr[0].clientHeight},this.oninit.apply(this,arguments),this._events()}},b.prototype._getPageCoords=function(a){var b={};return b=a.targetTouches&&a.targetTouches[0]?{x:a.targetTouches[0].pageX,y:a.targetTouches[0].pageY}:{x:a.pageX,y:a.pageY}},b.prototype._bindEvent=function(a,b,c){this.supportTouches_?a[0].attachEvent(this.events_[b],c):a.bind&&a.bind(this.events_[b],c)},b.prototype._events=function(){var a=this;this.supportTouches_="ontouchend"in document,this.events_={click:this.supportTouches_?"touchstart":"click",down:this.supportTouches_?"touchstart":"mousedown",move:this.supportTouches_?"touchmove":"mousemove",up:this.supportTouches_?"touchend":"mouseup",mousedown:(this.supportTouches_,"mousedown")};var b=angular.element(window.document);this._bindEvent(b,"move",function(b){a.is.drag&&(b.stopPropagation(),b.preventDefault(),a.parent.disabled||a._mousemove(b))}),this._bindEvent(b,"down",function(b){a.is.drag&&(b.stopPropagation(),b.preventDefault())}),this._bindEvent(b,"up",function(b){a._mouseup(b)}),this._bindEvent(this.ptr,"down",function(b){return a._mousedown(b),!1}),this._bindEvent(this.ptr,"up",function(b){a._mouseup(b)}),this.events()},b.prototype._mousedown=function(a){this.is.drag=!0,this.is.clicked=!1,this.is.mouseup=!1;var b=this._getPageCoords(a);this.cx=b.x-this.ptr[0].offsetLeft,this.cy=b.y-this.ptr[0].offsetTop,angular.extend(this.d,{left:this.ptr[0].offsetLeft,top:this.ptr[0].offsetTop,width:this.ptr[0].clientWidth,height:this.ptr[0].clientHeight}),this.outer&&this.outer.get(0)&&this.outer.css({height:Math.max(this.outer.height(),$(document.body).height()),overflow:"hidden"}),this.onmousedown(a)},b.prototype._mousemove=function(a){if(0!==this.uid){this.is.toclick=!1;var b=this._getPageCoords(a);this.onmousemove(a,b.x-this.cx,b.y-this.cy)}},b.prototype._mouseup=function(a){this.is.drag&&(this.is.drag=!1,this.outer&&this.outer.get(0)&&($.browser.mozilla?this.outer.css({overflow:"hidden"}):this.outer.css({overflow:"visible"}),$.browser.msie&&"6.0"===$.browser.version?this.outer.css({height:"100%"}):this.outer.css({height:"auto"})),this.onmouseup(a))},b}]).factory("sliderPointer",["sliderDraggable","utils",function(a,b){function c(){a.apply(this,arguments)}return c.prototype=new a,c.prototype.oninit=function(a,b,c){this.uid=b,this.parent=c,this.value={},this.settings=angular.copy(c.settings)},c.prototype.onmousedown=function(a){var c=b.offset(this.parent.domNode),d={left:c.left,top:c.top,width:this.parent.domNode[0].clientWidth,height:this.parent.domNode[0].clientHeight};this._parent={offset:d,width:d.width,height:d.height},this.ptr.addClass("jslider-pointer-hover"),this.setIndexOver()},c.prototype.onmousemove=function(a,c,d){var e=this._getPageCoords(a),f=this.calc(e.x);this.parent.settings.smooth||(f=b.roundUpToScale(f,this.parent.settings.scale,this.parent.settings.cutOffWidth,this.parent.settings.cutOffIndex));var g=this.parent.settings.cutOffWidth;g&&g>f&&(f=g),this._set(f)},c.prototype.onmouseup=function(a){if(this.settings.callback&&angular.isFunction(this.settings.callback)){var b=this.parent.getValue();this.settings.callback.call(this.parent,b)}this.ptr.removeClass("jslider-pointer-hover")},c.prototype.setIndexOver=function(){this.parent.setPointersIndex(1),this.index(2)},c.prototype.index=function(a){},c.prototype.limits=function(a){return this.parent.limits(a,this)},c.prototype.calc=function(a){var b=a-this._parent.offset.left,c=this.limits(100*b/this._parent.width);return c},c.prototype.set=function(a,b){this.value.origin=this.parent.round(a),this._set(this.parent.valueToPrc(a,this),b)},c.prototype._set=function(a,b){b||(this.value.origin=this.parent.prcToValue(a)),this.value.prc=a,this.ptr.css({left:a+"%"}),this.parent.redraw(this)},c}]).factory("slider",["sliderPointer","sliderConstants","utils",function(a,b,c){function d(){return this.init.apply(this,arguments)}function e(a){f.css("width",a)}var f;return d.prototype.changeCutOffWidth=e,d.prototype.init=function(a,c,d){this.settings=b.SLIDER.settings,angular.extend(this.settings,angular.copy(d)),this.inputNode=a,this.inputNode.addClass("ng-hide"),this.settings.interval=this.settings.to-this.settings.from,this.settings.calculate&&$.isFunction(this.settings.calculate)&&(this.nice=this.settings.calculate),this.settings.onstatechange&&$.isFunction(this.settings.onstatechange)&&(this.onstatechange=this.settings.onstatechange),this.is={init:!1},this.o={},this.create(c)},d.prototype.create=function(b){var d=this;this.domNode=b;var e=c.offset(this.domNode),g={left:e.left,top:e.top,width:this.domNode[0].clientWidth,height:this.domNode[0].clientHeight};this.sizes={domWidth:this.domNode[0].clientWidth,domOffset:g},angular.extend(this.o,{pointers:{},labels:{0:{o:angular.element(this.domNode.find("div")[5])},1:{o:angular.element(this.domNode.find("div")[6])}},limits:{0:angular.element(this.domNode.find("div")[3]),1:angular.element(this.domNode.find("div")[5])}}),angular.extend(this.o.labels[0],{value:this.o.labels[0].o.find("span")}),angular.extend(this.o.labels[1],{value:this.o.labels[1].o.find("span")}),d.settings.value.split(";")[1]||(this.settings.single=!0);var h=this.domNode.find("div");f=angular.element(h[8]),f&&f.css&&f.css("width","0%");var i=[angular.element(h[1]),angular.element(h[2])];angular.forEach(i,function(b,c){d.settings=angular.copy(d.settings);var e=d.settings.value.split(";")[c];if(e){d.o.pointers[c]=new a(b,c,d);var f=d.settings.value.split(";")[c-1];f&&parseInt(e,10)<parseInt(f,10)&&(e=f);var g=e<d.settings.from?d.settings.from:e;g=e>d.settings.to?d.settings.to:e,d.o.pointers[c].set(g,!0),0===c&&d.domNode.bind("mousedown",d.clickHandler.apply(d))}}),this.o.value=angular.element(this.domNode.find("i")[2]),this.is.init=!0,angular.forEach(this.o.pointers,function(a){d.redraw(a)})},d.prototype.clickHandler=function(){var a=this;return function(b){if(!a.disabled){var d=b.target.className,e=0;d.indexOf("jslider-pointer-to")>0&&(e=1);var f=c.offset(a.domNode),g={left:f.left,top:f.top,width:a.domNode[0].clientWidth,height:a.domNode[0].clientHeight};e=1;var h=a.o.pointers[e];return h._parent={offset:g,width:g.width,height:g.height},h._mousemove(b),h.onmouseup(),!1}}},d.prototype.disable=function(a){this.disabled=a},d.prototype.nice=function(a){return a},d.prototype.onstatechange=function(){},d.prototype.limits=function(a,b){if(!this.settings.smooth){var c=100*this.settings.step/this.settings.interval;a=Math.round(a/c)*c}var d=this.o.pointers[1-b.uid];d&&b.uid&&a<d.value.prc&&(a=d.value.prc),d&&!b.uid&&a>d.value.prc&&(a=d.value.prc),0>a&&(a=0),a>100&&(a=100);var e=Math.round(10*a)/10;return e},d.prototype.setPointersIndex=function(a){angular.forEach(this.getPointers(),function(a,b){a.index(b)})},d.prototype.getPointers=function(){return this.o.pointers},d.prototype.onresize=function(){var a=this;this.sizes={domWidth:this.domNode[0].clientWidth,domHeight:this.domNode[0].clientHeight,domOffset:{left:this.domNode[0].offsetLeft,top:this.domNode[0].offsetTop,width:this.domNode[0].clientWidth,height:this.domNode[0].clientHeight}},angular.forEach(this.o.pointers,function(b,c){a.redraw(b)})},d.prototype.update=function(){this.onresize(),this.drawScale()},d.prototype.drawScale=function(){},d.prototype.redraw=function(a){if(!this.settings.smooth){var b=c.roundUpToScale(a.value.prc,this.settings.scale,this.settings.cutOffWidth,this.settings.cutOffIndex);a.value.origin=b,a.value.prc=b}if(!this.is.init)return!1;this.setValue();var d=this.o.pointers[1].value.prc,e={left:"0%",width:d+"%"};this.o.value.css(e);var f=this.nice(a.value.origin),g=this.settings.firstDimension;if(this.settings.stepWithDifferentScale&&!this.settings.smooth&&(f=c.valueForDifferentScale(this.settings.from,this.settings.to,f,this.settings.prcToValueMapper)),this.settings.realtimeCallback&&angular.isFunction(this.settings.realtimeCallback)&&void 0!==this.settings.cutOffVal&&1===a.uid&&this.settings.realtimeCallback(f),this.settings.conversion){var h=c.getConversionFactorValue(parseInt(f),this.settings.conversion,this.settings.firstDimension);f=h.scaledVal,g=h.scaledDimension}f=parseFloat(f);var i=c.convertToMbpsGbps(f,g,this.settings.decimalPlaces);this.o.labels[a.uid].value.html(i.unitValue+" "+i.unitLabel),this.redrawLabels(a)},d.prototype.redrawLabels=function(a){function b(a,b,d){b.margin=-b.label/2;var e=c.sizes.domWidth,f=b.border+b.margin;return 0>f&&(b.margin-=f),b.border+b.label/2>e?(b.margin=0,b.right=!0):b.right=!1,b.margin=-(a.o[0].clientWidth/2-a.o[0].clientWidth/20),
+a.o.css({left:d+"%",marginLeft:b.margin,right:"auto"}),b.right&&a.o.css({left:"auto",right:0}),b}var c=this,d=this.o.labels[a.uid],e=a.value.prc,f={label:d.o[0].offsetWidth,right:!1,border:e*i/100},g=null,h=null;if(!this.settings.single)switch(h=this.o.pointers[1-a.uid],g=this.o.labels[h.uid],a.uid){case 0:f.border+f.label/2>g.o[0].offsetLeft-this.sizes.domOffset.left?(g.o.css({visibility:"hidden"}),g.value.html(this.nice(h.value.origin)),d.o.css({visibility:"hidden"}),e=(h.value.prc-e)/2+e,h.value.prc!==a.value.prc&&(d.value.html(this.nice(a.value.origin)+"&nbsp;&ndash;&nbsp;"+this.nice(h.value.origin)),f.label=d.o[0].clientWidth,f.border=e*i/100)):g.o.css({visibility:"visible"});break;case 1:f.border-f.label/2<g.o[0].offsetLeft-this.sizes.domOffset.left+g.o[0].clientWidth?(g.o.css({visibility:"hidden"}),g.value.html(this.nice(h.value.origin)),d.o.css({visibility:"visible"}),e=(e-h.value.prc)/2+h.value.prc,h.value.prc!==a.value.prc&&(d.value.html(this.nice(h.value.origin)+"&nbsp;&ndash;&nbsp;"+this.nice(a.value.origin)),f.label=d.o[0].clientWidth,f.border=e*i/100)):g.o.css({visibility:"visible"})}f=b(d,f,e);var i=c.sizes.domWidth;g&&(f={label:g.o[0].clientWidth,right:!1,border:h.value.prc*this.sizes.domWidth/100},f=b(g,f,h.value.prc))},d.prototype.redrawLimits=function(){if(this.settings.limits){var a=[!0,!0];for(var b in this.o.pointers)if(!this.settings.single||0===b){var c=this.o.pointers[b],d=this.o.labels[c.uid],e=d.o[0].offsetLeft-this.sizes.domOffset.left,f=this.o.limits[0];e<f[0].clientWidth&&(a[0]=!1),f=this.o.limits[1],e+d.o[0].clientWidth>this.sizes.domWidth-f[0].clientWidth&&(a[1]=!1)}for(var g=0;g<a.length;g++)a[g]?angular.element(this.o.limits[g]).addClass("animate-show"):angular.element(this.o.limits[g]).addClass("animate-hidde")}},d.prototype.setValue=function(){var a=this.getValue();this.inputNode.attr("value",a),this.onstatechange.call(this,a,this.inputNode)},d.prototype.getValue=function(){if(!this.is.init)return!1;var a=this,b="";return angular.forEach(this.o.pointers,function(d,e){if(void 0!==d.value.prc&&!isNaN(d.value.prc)){var f=d.value.prc,g=a.prcToValue(f);if(!a.settings.smooth)var g=c.valueForDifferentScale(a.settings.from,a.settings.to,f,a.settings.prcToValueMapper);b+=(e>0?";":"")+g}}),b},d.prototype.getPrcValue=function(){if(!this.is.init)return!1;var a="";return $.each(this.o.pointers,function(b){void 0===this.value.prc||isNaN(this.value.prc)||(a+=(b>0?";":"")+this.value.prc)}),a},d.prototype.prcToValue=function(a){var b;if(this.settings.heterogeneity&&this.settings.heterogeneity.length>0)for(var c=this.settings.heterogeneity,d=0,e=this.settings.from,f=0;f<=c.length;f++){var g;g=c[f]?c[f].split("/"):[100,this.settings.to],a>=d&&a<=g[0]&&(b=e+(a-d)*(g[1]-e)/(g[0]-d)),d=g[0],e=g[1]}else b=this.settings.from+a*this.settings.interval/100;var h=this.round(b);return h},d.prototype.valueToPrc=function(a,b){var c;if(this.settings.heterogeneity&&this.settings.heterogeneity.length>0)for(var d=this.settings.heterogeneity,e=0,f=this.settings.from,g=0;g<=d.length;g++){var h;h=d[g]?d[g].split("/"):[100,this.settings.to],a>=f&&a<=h[1]&&(c=b.limits(e+(a-f)*(h[0]-e)/(h[1]-f))),e=h[0],f=h[1]}else c=b.limits(100*(a-this.settings.from)/this.settings.interval);return c},d.prototype.round=function(a){return a=Math.round(a/this.settings.step)*this.settings.step,a=this.settings.round?Math.round(a*Math.pow(10,this.settings.round))/Math.pow(10,this.settings.round):Math.round(a)},d}]).directive("attStepSlider",["$compile","$templateCache","$timeout","$window","slider","sliderConstants","utils",function(a,b,c,d,e,f,g){var h="app/scripts/ng_js_att_tpls/stepSlider/attStepSlider.html";return{restrict:"AE",require:"?ngModel",scope:{options:"=",cutOff:"="},priority:1,templateUrl:h,link:function(i,j,k,l){function m(){angular.element(d).bind("resize",function(a){i.slider.onresize()})}if(l){i.mainSliderClass="step-slider",j.after(a(b.get(h))(i,function(a,b){b.tmplElt=a})),l.$render=function(){if(l.$viewValue.split&&1===l.$viewValue.split(";").length?l.$viewValue="0;"+l.$viewValue:"number"==typeof l.$viewValue&&(l.$viewValue="0;"+l.$viewValue),(l.$viewValue||0===l.$viewValue)&&("number"==typeof l.$viewValue&&(l.$viewValue=""+l.$viewValue),i.slider)){var a="0";if(i.slider.getPointers()[0].set(a,!0),l.$viewValue.split(";")[1]){var b=l.$viewValue.split(";")[1];b.length>=4&&(b=b.substring(0,2)),i.options.realtime||i.options.callback(parseFloat(l.$viewValue.split(";")[1])),i.slider.getPointers()[1].set(l.$viewValue.split(";")[1],!0)}}};var n=function(){function a(){0!==d[0]&&d.splice(0,0,0),100!==d[d.length-1]&&d.splice(d.length,0,100)}function b(){if(d[d.length-1]!==i.options.to&&d.splice(d.length,0,i.options.to),i.options.displayScaledvalues){for(var a in d)h.push(Math.log2(d[a]));var b=h[h.length-1]}for(var a in d){var c,e=d[a]/i.options.from,f=d[a]/i.options.to;c=i.options.displayScaledvalues?h[a]/b*100:(d[a]-i.options.from)/(i.options.to-i.options.from)*100;var g=d[a];1===f?c=100:1===e&&(c=0),d[a]=c,k[""+c]=g}}i.from=""+i.options.from,i.to=""+i.options.to,i.options.calculate&&"function"==typeof i.options.calculate&&(i.from=i.options.calculate(i.from),i.to=i.options.calculate(i.to)),i.showDividers=i.options.showDividers,i.COLORS=f.COLORS,i.sliderColor=i.options.sliderColor,i.sliderColor||(i.sliderColor=f.COLORS.REGULAR);var d=i.options.scale,e=[],h=[],k={};for(var n in d){var p=d[n];e.push(p)}0===i.options.from&&100===i.options.to||!i.options.smooth?0===i.options.from&&100===i.options.to||i.options.smooth?(b(),a()):(i.options.stepWithDifferentScale=!0,b(),a()):(a(),i.options.stepWithDifferentScale=!0);var q=0;if(i.options.decimalPlaces&&(q=i.options.decimalPlaces),i.endDimension=i.options.dimension,i.options.conversion){var r=i.options.conversion.length-1,s=i.options.conversion[r].dimension,t=i.options.conversion[r].scaleFactor;i.endDimension=" "+s;var u=(i.to/t).toFixed(q);i.toStr=u}else i.toStr=i.options.to;var v=g.convertToMbpsGbps(i.toStr,i.endDimension,i.options.decimalPlaces);i.toStr=v.unitValue,i.endDimension=" "+v.unitLabel;var w={from:i.options.from,to:i.options.to,step:i.options.step,smooth:i.options.smooth,limits:!0,stepWithDifferentScale:i.options.stepWithDifferentScale,round:i.options.round||!1,value:l.$viewValue,scale:i.options.scale,nonPercentScaleArray:e,prcToValueMapper:k,firstDimension:i.options.dimension,decimalPlaces:q,conversion:i.options.conversion,realtimeCallback:i.options.callback};angular.isFunction(i.options.realtime)?w.realtimeCallback=function(a){l.$setViewValue(a),i.options.callback(a)}:w.callback=o,w.calculate=i.options.calculate||void 0,w.onstatechange=i.options.onstatechange||void 0,c(function(){var a=i.tmplElt.find("div")[7];w.conversion||(i.tmplElt.find("div").eq(6).find("span").eq(0).css("padding-left","10px"),i.tmplElt.find("div").eq(6).find("span").eq(0).css("padding-right","15px")),i.slider=angular.element.slider(j,i.tmplElt,w),angular.element(a).html(i.generateScale()),i.drawScale(a),m(),i.$watch("options.disable",function(a){i.slider&&(i.tmplElt.toggleClass("disabled",a),i.slider.disable(a))}),i.$watch("cutOff",function(a){if(a&&a>0){var b=(a-i.slider.settings.from)/(i.slider.settings.to-i.slider.settings.from);if(b=100*b,i.isCutOffSlider=!0,i.slider.settings.cutOffWidth=b,i.cutOffVal=a,i.options.conversion){var c=g.getConversionFactorValue(a,i.options.conversion,i.options.dimension);c.scaledVal=parseFloat(c.scaledVal).toFixed(i.options.decimalPlaces),i.cutOffVal=c.scaledVal+" "+c.scaledDimension}i.slider.settings.cutOffVal=a,i.slider.changeCutOffWidth(b+"%");var d=i.slider.settings.nonPercentScaleArray;for(var e in d)if(e>=1){var f=d[e-1],h=d[e];a>f&&h>=a&&(i.slider.settings.cutOffIndex=e)}}else i.slider.settings.cutOffVal=0})})};i.generateScale=function(){if(i.options.scale&&i.options.scale.length>0){for(var a="",b=i.options.scale,c="left",d=0;d<b.length;d++)if(0!==d&&d!==b.length-1){var e=(b[d]-i.from)/(i.to-i.from)*100;i.options.stepWithDifferentScale&&!i.options.smooth&&(e=b[d]),a+='<span style="'+c+": "+e+'%"></span>'}return a}return""},i.drawScale=function(a){angular.forEach(angular.element(a).find("ins"),function(a,b){a.style.marginLeft=-a.clientWidth/2})};var o=function(a){var b=a.split(";")[1];i.$apply(function(){l.$setViewValue(parseInt(b))}),i.options.callback&&i.options.callback(parseInt(b))};i.$watch("options",function(a){n()}),angular.element.slider=function(a,b,c){b.data("jslider")||b.data("jslider",new e(a,b,c));var d=b.data("jslider");return d}}}}}]),angular.module("att.abs.steptracker",["att.abs.transition"]).directive("steptracker",["$timeout",function(a){return{priority:100,scope:{sdata:"=sdata",cstep:"=currentStep",clickHandler:"=?",disableClick:"=?"},restrict:"EA",replace:!0,templateUrl:"app/scripts/ng_js_att_tpls/steptracker/step-tracker.html",link:function(b,c){void 0===b.disableClick&&(b.disableClick=!1),a(function(){function a(a){return angular.element(g[a-1])}function d(){if(b.cstep>0&&b.cstep<=b.sdata.length-1&&j>0){var c=j/k*100+"%";l=a(b.cstep),l.css("width",c)}}function e(){b.cstep<=b.sdata.length&&(j=b.sdata[b.cstep-1].currentPage,k=b.sdata[b.cstep-1].totalPages)}b.cstep<1?b.cstep=1:b.cstep>b.sdata.length&&(b.cstep=b.sdata.length);var f=c.find("div"),g=[];for(var h in f)if(f.eq(h)[0]){var i=f.eq(h)[0].className;i.indexOf("track ng-scope")>-1&&g.push(f.eq(h))}var j,k,l=a(b.cstep);b.set_width=function(a){var c=100/(b.sdata.length-1)+"%";return b.sdata.length-1>a?{width:c}:void 0},b.$watch("sdata",function(){e();var a=b.cstep;if(1>j&&(j=1,1!==b.cstep&&(b.cstep--,e())),j>k){if(b.cstep>b.sdata.length-1)return void b.cstep++;j=k,d(),b.cstep++,e(),d()}1>j&&a===b.cstep&&(j=1,b.cstep>1&&(b.cstep--,b.sdata[b.cstep-1].currentPage=b.sdata[b.cstep-1].totalPages,b.sdata[b.cstep].currentPage=1)),d()},!0),b.activestep=function(a){return a===b.cstep-1},b.donesteps=function(a){return a<b.cstep-1},b.laststep=function(a){return a===b.sdata.length-1},b.isIncomplete=function(a){if(a===b.cstep-1)return!1;if(a>=0&&a<b.sdata.length-1){var c=b.sdata[a];return c.currentPage<=c.totalPages}},b.stepclick=function(a,c){if(c<b.cstep){for(var f=b.cstep-1;f>c;f--)b.sdata[f].currentPage=1;b.sdata[c].currentPage--}angular.isFunction(b.clickHandler)&&b.clickHandler(a,c),b.cstep=c+1,b.cstep<=b.sdata.length&&b.sdata[b.cstep].currentPage<1&&(b.sdata[b.cstep].currentPage=1),e(),d()}},100)}}}]).constant("timelineConstants",{STEP_TYPE:{ALERT:"alert",COMPLETED:"completed",CANCELLED:"cancelled"}}).controller("AttTimelineCtrl",["$scope","$timeout",function(a,b){function c(){function b(a,b){return a.order<b.order?-1:a.order>b.order?1:0}f.sort(b),e.sort(b),a.$parent.animate&&d(),a.$watch("trigger",function(b){b?a.resetTimeline():a.$parent.animate=!1})}function d(){function c(){for(var a in f){var b=f[a];if(a%2===0?b.unhoveredStateForBelow(.25):b.unhoveredStateForAbove(.25),b.isStop())break}}function d(a,h){return 0===a?function(){f[a+1].isStop()&&f[a+1].isCancelled()&&e[a].isCancelled(!0),e[a].animate(d(a+1,h),h)}:a===e.length-1?function(){f[0].isCurrentStep()&&f[0].isCurrentStep(!1),f[a].isStop()?(f[a-1].shrinkAnimate(g),f[a].isCurrentStep(!0)):(f[a-1].shrinkAnimate(g),e[a].animate(d(a+1,h),h)),f[a].expandedAnimate(g),b(function(){c()},500)}:a===e.length?function(){f[0].isCurrentStep()&&f[0].isCurrentStep(!1),f[a-1].shrinkAnimate(g),f[a].expandedAnimate(g),f[a].isCurrentStep(!0),b(function(){c()},500)}:function(){f[0].isCurrentStep()&&f[0].isCurrentStep(!1),f[a].isStop()?(f[a-1].shrinkAnimate(g),f[a].expandedAnimate(g),f[a].isCurrentStep(!0),b(function(){c()},500)):(f[a+1].isStop()&&f[a+1].isCancelled()&&e[a].isCancelled(!0),f[a-1].shrinkAnimate(g),e[a].animate(d(a+1,h),h),f[a].expandedAnimate(g))}}var g=.25,h=.25;"number"==typeof a.barAnimateDuration&&(h=a.barAnimateDuration);var i=d(0,h);i()}var e=[],f=[];this.numSteps=0,this.isAlternate=function(){return a.alternate},this.addTimelineBarCtrls=function(a){e.push(a)},this.addTimelineDotCtrls=function(a){f.push(a)},b(c,200)}]).directive("attTimeline",["$timeout","$compile",function(a,b){return{restrict:"EA",replace:!0,scope:{steps:"=",trigger:"=",alternate:"=",barAnimateDuration:"="},templateUrl:"app/scripts/ng_js_att_tpls/steptracker/timeline.html",controller:"AttTimelineCtrl",link:function(a,c,d,e){var f=function(){for(var b=a.steps,c=[],d=1;d<b.length;d++){var f=b[d];c.push(f)}a.middleSteps=c,e.numSteps=b.length-1};f(),a.resetTimeline=function(){a.animate=!0,b(c)(a)}}}}]).controller("TimelineBarCtrl",["$scope",function(a){this.type="timelinebar",this.order=parseInt(a.order),this.animate=function(b,c){a.loadingAnimation(b,c)},this.isCancelled=function(b){a.isCancelled=b}}]).directive("timelineBar",["animation","$progressBar",function(a,b){return{restrict:"EA",replace:!0,templateUrl:"app/scripts/ng_js_att_tpls/steptracker/timelineBar.html",scope:{order:"@"},require:["^attTimeline","timelineBar"],controller:"TimelineBarCtrl",link:function(c,d,e,f){var g=f[0],h=f[1];g.addTimelineBarCtrls(h),c.isCompleted=!0;var i=100/g.numSteps-3;d.css("width",i+"%");var j=d.find("div").eq(0);a.set(j,{opacity:0});var k=function(b){a.set(j,{opacity:1}),a.set(j,{scaleX:b.progress(),transformOrigin:"left"})};c.loadingAnimation=b(k)}}}]).controller("TimelineDotCtrl",["$scope","$timeout","timelineConstants",function(a,b,c){this.type="dot",this.order=parseInt(a.order);var d=this;b(function(){0!==d.order&&(d.order%2!==0?a.initializeAboveForAnimation():a.initializeBelowForAnimation())}),this.expandedAnimate=function(b){a.setColor(),a.expandedAnimate(b),0===d.order||a.isStepsLessThanFive()||(d.order%2!==0?a.expandContentForAbove(b):a.expandContentForBelow(b))},this.unhoveredStateForAbove=function(b){a.unhoveredStateForAbove(b)},this.unhoveredStateForBelow=function(b){a.unhoveredStateForBelow(b)},this.shrinkAnimate=function(b){a.shrinkAnimate(b)},this.setExpanded=function(){a.setSize(3)},this.isStop=function(){return a.isStop},this.isCancelled=function(){return a.type===c.STEP_TYPE.CANCELLED},this.isAlert=function(){return a.type===c.STEP_TYPE.ALERT},this.isCurrentStep=function(b){return void 0!==b&&(a.isCurrentStep=b),a.isCurrentStep}}]).directive("timelineDot",["animation","timelineConstants",function(a,b){return{restrict:"EA",replace:!0,scope:{order:"@",title:"@",description:"@",by:"@",date:"@",type:"@"},templateUrl:"app/scripts/ng_js_att_tpls/steptracker/timelineDot.html",require:["^attTimeline","timelineDot"],controller:"TimelineDotCtrl",link:function(c,d,e,f){function g(){return c.description||c.by||c.date?!1:!0}var h=f[0],i=f[1];h.addTimelineDotCtrls(i),c.numSteps=h.numSteps+1,c.isCurrentStep=!1,c.isCompleted=!1,c.isStop=!1,(c.type===b.STEP_TYPE.ALERT||c.type===b.STEP_TYPE.CANCELLED)&&(c.isStop=!0),c.isInactive=!0;var j=d.find("div"),k=j.eq(0),l=j.eq(2),m=j.eq(3),n=j.eq(5),o=j.eq(6),p=j.eq(9);c.isStepsLessThanFive=function(){return c.numSteps<5?!0:!1},c.titleMouseover=function(a){c.isStepsLessThanFive()||g()||(1===a&&c.order%2===0&&c.expandContentForBelow(.25),2===a&&c.order%2!==0&&c.expandContentForAbove(.25))},c.titleMouseleave=function(){c.order%2===0?c.unhoveredStateForBelow(.25):c.unhoveredStateForAbove(.25)},c.initializeAboveForAnimation=function(){if(!c.isStepsLessThanFive()&&h.isAlternate()&&(a.set(o,{opacity:0}),a.set(p,{opacity:0}),!g())){var b=o[0].offsetHeight+p[0].offsetHeight;a.set(n,{top:b})}},c.expandContentForAbove=function(b){!c.isStepsLessThanFive()&&h.isAlternate()&&(a.to(n,b,{top:0}),a.to(o,b,{opacity:1}),a.to(p,b,{opacity:1}))},c.unhoveredStateForAbove=function(b){if(!c.isStepsLessThanFive()&&h.isAlternate()){a.set(o,{opacity:0}),a.set(p,{opacity:1});var d=o[0].offsetHeight;a.to(n,b,{top:d})}},c.initializeBelowForAnimation=function(){!c.isStepsLessThanFive()&&h.isAlternate()&&(a.set(o,{height:"0%",opacity:0,top:"-20px"}),a.set(p,{opacity:0}))},c.expandContentForBelow=function(b){!c.isStepsLessThanFive()&&h.isAlternate()&&(a.set(p,{opacity:1}),a.to(o,b,{height:"auto",opacity:1,top:"0px"}))},c.unhoveredStateForBelow=function(b){!c.isStepsLessThanFive()&&h.isAlternate()&&(a.to(o,b,{height:"0%",opacity:0,top:"-20px",position:"relative"}),a.set(p,{opacity:1}))},g()&&c.order%2!==0&&h.isAlternate()&&m.css("top","-47px"),c.order%2!==0&&h.isAlternate()?c.isBelowInfoBoxShown=!1:c.isBelowInfoBoxShown=!0,c.isStepsLessThanFive()&&!h.isAlternate()&&a.set(p,{marginTop:10}),a.set(k,{opacity:".5"}),a.set(l,{opacity:"0.0"}),a.set(l,{scale:.1}),0===c.order&&(a.set(l,{opacity:"1.0"}),a.set(l,{scale:1}),a.set(k,{scale:3}),c.isCurrentStep=!0,c.isInactive=!1,c.isCompleted=!0),c.setColor=function(){c.isInactive=!1,c.type===b.STEP_TYPE.CANCELLED?c.isCancelled=!0:c.type===b.STEP_TYPE.ALERT?c.isAlert=!0:c.isCompleted=!0,c.$phase||c.$apply()},c.setSize=function(b){a.set(biggerCircle,{scale:b})},c.setExpandedCircle=function(){a.set(l,{opacity:"1.0"}),a.set(l,{scale:1})},c.expandedAnimate=function(b){a.to(k,b,{scale:3}),a.set(l,{opacity:"1.0"}),a.to(l,b,{scale:1})},c.shrinkAnimate=function(b){a.to(k,b,{scale:1})}}}}]),angular.module("att.abs.table",["att.abs.utilities"]).constant("tableConfig",{defaultSortPattern:!1,highlightSearchStringClass:"tablesorter-search-highlight"}).directive("attTable",["$filter",function(a){return{restrict:"EA",replace:!0,transclude:!0,scope:{tableData:"=",viewPerPage:"=",currentPage:"=",totalPage:"=",searchCategory:"=",searchString:"="},require:"attTable",templateUrl:"app/scripts/ng_js_att_tpls/table/attTable.html",controller:["$scope",function(a){this.headers=[],this.currentSortIndex=null,this.setIndex=function(a){this.headers.push(a)},this.getIndex=function(a){for(var b=0;b<this.headers.length;b++)if(this.headers[b].headerName===a)return this.headers[b].index;return null},this.sortData=function(b,c){a.$parent.columnIndex=b,a.$parent.reverse=c,this.currentSortIndex=b,a.currentPage=1,this.resetSortPattern()},this.getSearchString=function(){return a.searchString},this.resetSortPattern=function(){for(var a=0;a<this.headers.length;a++){var b=this.headers[a];b.index!==this.currentSortIndex&&b.resetSortPattern()}}}],link:function(b,c,d,e){b.searchCriteria={},b.$watchCollection("tableData",function(a){a&&!isNaN(a.length)&&(b.totalRows=a.length)}),b.$watch("currentPage",function(a){b.$parent.currentPage=a}),b.$watch("viewPerPage",function(a){b.$parent.viewPerPage=a}),b.$watch(function(){return b.totalRows/b.viewPerPage},function(a){isNaN(a)||(b.totalPage=Math.ceil(a),b.currentPage=1)});var f=function(a){return angular.isDefined(a)&&null!==a&&""!==a?!0:void 0},g=function(a,c){if(f(a)&&f(c)){var d=e.getIndex(c);b.searchCriteria={},null!==d&&(b.searchCriteria[d]=a)}else!f(a)||angular.isDefined(c)&&null!==c&&""!==c?b.searchCriteria={}:b.searchCriteria={$:a}};b.$watch("searchCategory",function(a,c){a!==c&&g(b.searchString,a)}),b.$watch("searchString",function(a,c){a!==c&&g(a,b.searchCategory)}),b.$watchCollection("searchCriteria",function(c){b.$parent.searchCriteria=c,b.totalRows=b.tableData&&a("filter")(b.tableData,c,!1).length||0,b.currentPage=1})}}}]).directive("attTableRow",[function(){return{restrict:"EA",compile:function(a,b){if("header"===b.type)a.find("tr").eq(0).addClass("tablesorter-headerRow");else if("body"===b.type){var c=a.children();b.rowRepeat&&(b.trackBy?c.attr("ng-repeat",b.rowRepeat.concat(" | orderBy : columnIndex : reverse | filter : searchCriteria : false | attLimitTo : viewPerPage : viewPerPage*(currentPage-1) track by "+b.trackBy)):c.attr("ng-repeat",b.rowRepeat.concat(" | orderBy : columnIndex : reverse | filter : searchCriteria : false | attLimitTo : viewPerPage : viewPerPage*(currentPage-1) track by $index"))),c.attr("ng-class","{'alt-row': $even,'normal-row': $odd}"),a.append(c)}}}}]).directive("attTableHeader",["tableConfig",function(a){return{restrict:"EA",replace:!0,transclude:!0,scope:{sortable:"@",defaultSort:"@",index:"@key"},require:"^attTable",templateUrl:"app/scripts/ng_js_att_tpls/table/attTableHeader.html",link:function(b,c,d,e){var f=a.defaultSortPattern;b.headerName=c.text(),b.sortPattern=null,e.setIndex(b),b.$watch(function(){return c.text()},function(a){b.headerName=a}),b.sort=function(a){"boolean"==typeof a&&(f=a),e.sortData(b.index,f),b.sortPattern=f?"desc":"asc",f=!f},b.$watch(function(){return e.currentSortIndex},function(a){a!==b.index&&(b.sortPattern=null)}),"false"!==b.sortable&&("A"===b.defaultSort||"a"===b.defaultSort?b.sort(!1):("D"===b.defaultSort||"d"===b.defaultSort)&&b.sort(!0)),b.resetSortPattern=function(){f=a.defaultSortPattern}}}}]).directive("attTableBody",["$filter","$timeout","tableConfig",function(a,b,c){return{restrict:"EA",require:"^attTable",replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/table/attTableBody.html",link:function(d,e,f,g){var h=c.highlightSearchStringClass,i="",j=function(b){var c=b.text();b.html(a("highlight")(c,i,h))},k=function(a){var b=a.children();if(!(b.length>0))return void j(a);for(var c=0;c<b.length;c++)k(b.eq(c))},l=function(a){for(var b=a.find("*"),c=0;c<b.length;c++)if(b.eq(c).attr("class")&&-1!==b.eq(c).attr("class").indexOf(h)){var d=b.eq(c).text();b.eq(c).replaceWith(d)}};b(function(){var a=e.children();d.$watch(function(){return g.getSearchString()},function(b){i=b,l(e),a.length>0?k(e):j(e)})},50)}}}]),angular.module("att.abs.tableMessages",["att.abs.utilities"]).constant("messageConstants",{TABLE_MESSAGE_TYPES:{noMatching:1,errorLoading:2,magnifySearch:3,isLoading:4},USER_MESSAGE_TYPES:{success:1,error:0}}).directive("attTableMessage",["messageConstants",function(a){return{restrict:"AE",replace:!0,transclude:!0,scope:{msgType:"=",onRefreshClick:"&"},templateUrl:"app/scripts/ng_js_att_tpls/tableMessages/attTableMessage.html",link:function(b){b.messageConstants=a,b.refreshAction=function(a){b.onRefreshClick(a)}}}}]).directive("attUserMessage",["messageConstants","$timeout","DOMHelper",function(a,b,c){return{restrict:"AE",replace:!0,transclude:!0,scope:{thetitle:"=",type:"=",message:"=",trigger:"="},templateUrl:"app/scripts/ng_js_att_tpls/tableMessages/attUserMessage.html",link:function(d,e){var f=void 0,g=void 0;d.messageConstants=a,b(function(){g=c.firstTabableElement(e[0])},10),d.$watch("trigger",function(){d.trigger?(f=document.activeElement,angular.isDefined(g)&&g.focus()):angular.isDefined(f)&&f.focus()})}}}]),angular.module("att.abs.tabs",["att.abs.utilities"]).directive("attTabs",function(){return{restrict:"EA",transclude:!1,replace:!0,scope:{tabs:"=title"},controller:["$scope",function(a){this.getData=function(){return a.tabs},this.onClickTab=function(b){return a.currentTab=b.url,a.currentTab},this.isActiveTab=function(b){return b===a.currentTab}}],link:function(a){for(var b=0;b<a.tabs.length;b++)a.tabs[b].selected&&a.tabs[b].url&&(a.currentTab=a.tabs[b].url)}}}).directive("floatingTabs",function(){return{require:"^attTabs",restrict:"EA",transclude:!1,replace:!0,scope:{size:"@"},templateUrl:"app/scripts/ng_js_att_tpls/tabs/floatingTabs.html",link:function(a,b,c,d){a.tabs=d.getData(),a.onClickTab=d.onClickTab,a.isActiveTab=d.isActiveTab}}}).directive("simplifiedTabs",function(){return{require:"^attTabs",restrict:"EA",transclude:!1,replace:!0,scope:{ctab:"=ngModel"},templateUrl:"app/scripts/ng_js_att_tpls/tabs/simplifiedTabs.html",link:function(a,b,c,d){a.tabs=d.getData(),a.clickTab=function(b){return a.ctab=b.id,a.ctab},a.isActive=function(b){return b===a.ctab}}}}).directive("genericTabs",function(){return{require:"^attTabs",restrict:"EA",transclude:!1,replace:!0,scope:{ctab:"=ngModel"},templateUrl:"app/scripts/ng_js_att_tpls/tabs/genericTabs.html",link:function(a,b,c,d){a.tabs=d.getData(),a.clickTab=function(b){return a.ctab=b.id,a.ctab},a.isActive=function(b){return b===a.ctab}}}}).directive("skipNavigation",function(){return{link:function(a,b,c){b.bind("click",function(){var a=angular.element(b.parent().parent().parent().parent())[0].querySelector("a.skiptoBody");angular.element(a).attr("tabindex",-1),a.focus()})}}}).directive("parentTab",[function(){return{restrict:"EA",scope:{menuItems:"=",activeSubMenu:"=",activeMenu:"="},controller:["$scope",function(a){a.megaMenu=a.menuItems,a.megaMenuTab,a.megaMenuHoverTab,this.setMenu=function(){a.menuItems=a.megaMenu,a.activeSubMenu.scroll=!1;for(var b=0;b<a.menuItems.length;b++)a.menuItems[b].active&&(a.activeMenu=a.menuItems[b]);this.setSubMenuStatus(!1),a.$apply()},this.setActiveMenu=function(){if(void 0!==a.megaMenuTab&&null!==a.megaMenuTab)a.menuItems=[a.megaMenuTab],a.megaMenuTab.scroll=!0,a.activeMenu={},a.activeSubMenu=a.megaMenuTab,this.setSubMenuStatus(!0);else{for(var b=0;b<a.menuItems.length;b++)if(a.menuItems[b].active=!1,a.menuItems[b].subItems)for(var c=0;c<a.menuItems[b].subItems.length;c++)a.menuItems[b].subItems[c].active=!1;a.menuItems=a.megaMenu}a.$apply()};var b=!1;this.setSubMenuStatus=function(a){b=a},this.getSubMenuStatus=function(){return b},this.setActiveMenuTab=function(b){a.megaMenuTab=b},this.setActiveMenuHoverTab=function(b){a.megaMenuHoverTab=b},this.setActiveSubMenuTab=function(){a.megaMenuTab=a.megaMenuHoverTab},this.resetMenuTab=function(){a.megaMenuTab=void 0},this.clearSubMenu=function(){a.$evalAsync(function(){a.megaMenuTab=void 0,a.megaMenuHoverTab=void 0})}}]}}]).directive("parentmenuTabs",[function(){return{restrict:"EA",transclude:!0,replace:!0,scope:{megaMenu:"@",menuItems:"="},controller:["$scope",function(a){this.getMenu=function(){return a.menuItems},this.setMenu=function(b){a.menuItems=b}}],templateUrl:"app/scripts/ng_js_att_tpls/tabs/parentmenuTab.html"}}]).directive("menuTabs",["$window","$document","events","keymap",function(a,b,c,d){return{restrict:"EA",transclude:!0,replace:!0,require:["^?parentTab","^?parentmenuTabs"],scope:{activeMenu:"=",menuItem:"=",subMenu:"@",subItemActive:"@",tabName:"=?",tabUrl:"=?"},templateUrl:function(a,b){return b.megaMenu?"app/scripts/ng_js_att_tpls/tabs/menuTab.html":"app/scripts/ng_js_att_tpls/tabs/submenuTab.html"},link:function(e,f,g,h){function i(a,b){clearTimeout(a._tId),a._tId=setTimeout(function(){k.setMenu()},b)}function j(a,b){clearTimeout(a._tId),a._tId=setTimeout(function(){k.setActiveMenu()},b)}var k=h[0],l=h[1];e.clickInactive=!0,e.showHoverChild=function(a){e.clickInactive=!1,e.hoverChild=h[0].getSubMenuStatus(),"mouseover"===a.type&&h[0].getSubMenuStatus()&&e.showChildren(a)},e.showChildren=function(a){e.parentMenuItems=l.getMenu();for(var b=0;b<e.parentMenuItems.length;b++){if(e.parentMenuItems[b].active=!1,e.parentMenuItems[b].subItems)for(var c=0;c<e.parentMenuItems[b].subItems.length;c++)e.parentMenuItems[b].subItems[c].active=!1;e.clickInactive=!0}e.menuItem.active=!0,e.activeMenu=e.menuItem,a.stopPropagation()},e.$watch("subItemActive",function(a){"true"===a&&"true"===e.subMenu&&k.setActiveMenuHoverTab(e.menuItem)}),e.showMenuClick=function(a){k.setActiveMenuTab(e.menuItem),a.stopPropagation()},e.showSubMenuClick=function(a){k.setActiveSubMenuTab(),a.stopPropagation()},e.resetMenu=function(a){k.resetMenuTab(),a.stopPropagation()},b.bind("scroll",function(){0===a.pageYOffset?i(k.setMenu,100):a.pageYOffset>1&&a.pageYOffset<1500&&j(k.setActiveMenu,100)}),f.bind("keydown",function(a){switch(a.keyCode||(a.keyCode=a.which),a.keyCode!==d.KEY.TAB&&(c.preventDefault(a),c.stopPropagation(a)),a.keyCode){case d.KEY.ESC:var b;f.attr("mega-menu")?"item"===f.attr("menu-item")&&(b=angular.element(f.parent().parent().parent().parent())[0].querySelector("a.skiptoBody"),angular.element(b).attr("tabindex",-1),b.focus()):"true"===f.attr("sub-menu")?(b=angular.element(f.parent().parent().parent().parent().parent().parent().parent())[0].querySelector("a.skiptoBody"),angular.element(b).attr("tabindex",-1),b.focus()):void 0===f.attr("sub-menu")&&(b=angular.element(f.parent().parent().parent().parent().parent().parent().parent().parent().parent().parent())[0].querySelector("a.skiptoBody"),angular.element(b).attr("tabindex",-1),b.focus());break;case d.KEY.RIGHT:if(f.attr("mega-menu")){if("item"===f.attr("menu-item")){var g=angular.element(f)[0];if(g.nextElementSibling)null==g.nextElementSibling.querySelector("span")||g.nextElementSibling.querySelector("span").focus();else{do{if(!g||!g.nextSibling)break;g=g.nextSibling}while(g&&"LI"!==g.tagName);g&&(null===g.querySelector("span")||g.querySelector("span").focus()),c.preventDefault(a),c.stopPropagation(a)}}}else{var g=angular.element(f)[0];if("true"===f.attr("sub-menu")){if(null===g.nextElementSibling)break;if(g.nextElementSibling)g.nextElementSibling.querySelector("a").focus();else{do{if(!g||!g.nextSibling)break;g=g.nextSibling}while(g&&"LI"!==g.tagName);g&&(null==g.querySelector("a")||g.querySelector("a").focus()),c.preventDefault(a),c.stopPropagation(a)}}else if(void 0===f.attr("sub-menu")){if(null===g.nextElementSibling)break;if(g.nextElementSibling)g.nextElementSibling.querySelector("a").focus();else{do{if(!g||!g.nextSibling)break;g=g.nextSibling}while(g&&"LI"!==g.tagName);g&&(null==g.querySelector("a")||g.querySelector("a").focus())}}}break;case d.KEY.DOWN:if(f.attr("mega-menu"))angular.element(f)[0].querySelectorAll(".megamenu__items")[0].querySelector("a").focus();else if(void 0===f.attr("sub-menu")){var g=document.activeElement;if(null===g.nextElementSibling)break;if(g.nextElementSibling)g.nextElementSibling.focus();else{do{if(!g||!g.nextSibling)break;g=g.nextSibling}while(g&&"A"!==g.tagName);null!==g.attributes&&g.focus(),c.stopPropagation(a)}}else if("true"===f.attr("sub-menu")){var h=angular.element(f)[0].querySelector("span").querySelector("a");if(null===h)break;h.focus()}break;case d.KEY.LEFT:if(f.attr("mega-menu")){if("item"===f.attr("menu-item")){var g=angular.element(f)[0];if(g.previousElementSibling)null===g.previousElementSibling.querySelector("span")||g.previousElementSibling.querySelector("span").focus();else{do{if(!g||!g.previousSibling)break;g=g.previousSibling}while(g&&"LI"!==g.tagName);g&&(null===g.querySelector("span")||g.querySelector("span").focus()),c.preventDefault(a),c.stopPropagation(a)}}}else{var g=angular.element(f)[0];if("true"===f.attr("sub-menu")){if(null===g.previousElementSibling)break;if(g.previousElementSibling)g.previousElementSibling.querySelector("a").focus();else{do{if(!g||!g.previousSibling)break;g=g.previousSibling}while(g&&"LI"!==g.tagName);g&&(null==g.querySelector("a")||g.querySelector("a").focus()),c.preventDefault(a),c.stopPropagation(a)}}else if(void 0===f.attr("sub-menu")){if(null===g.previousElementSibling)break;if(g.previousElementSibling)g.previousElementSibling.querySelector("a").focus();else{do{if(!g||!g.previousSibling)break;g=g.previousSibling}while(g&&"LI"!==g.tagName);g&&(null==g.querySelector("a")||g.querySelector("a").focus())}}}break;case d.KEY.UP:if("true"===f.attr("sub-menu")){var g=document.activeElement,i=angular.element(f.parent().parent().parent().parent())[0].querySelector("span");i.focus(),k.clearSubMenu(),e.menuItem.active=!1;break}if(void 0===f.attr("sub-menu")){var g=document.activeElement,i=angular.element(f.parent().parent().parent().parent())[0].querySelector("a");if(document.activeElement===angular.element(g).parent().parent()[0].querySelectorAll("a")[0]){i.focus();break}if(g.previousElementSibling){g.previousElementSibling;null!=g.previousElementSibling?g.previousElementSibling.focus():i.focus()}else{do{if(!g||!g.previousSibling)break;g=g.previousSibling}while(g&&"A"!==g.tagName);g&&3!==g.nodeType&&g.focus(),c.preventDefault(a),c.stopPropagation(a)}break}}})}}}]),angular.module("att.abs.tagBadges",[]).directive("tagBadges",["$parse","$timeout",function(a,b){return{restrict:"EA",replace:!1,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/tagBadges/tagBadges.html",scope:{styleType:"@",onClose:"&"},link:function(c,d,e){c.isSmall=!1,c.isIcon=!1,c.isColor=!1,c.display=!0,c.isClosable=!1,c.isHighlight=!1,c.customColor=!1,""===e.small&&(c.isSmall=!0),"icon"===c.styleType?c.isIcon=!0:"color"===c.styleType&&(c.isColor=!0,void 0!==e.color&&""!==e.color&&(c.customColor=!0,e.$observe("color",function(a){c.border_type_borderColor=a,c.background_type_backgroundColor=a,c.background_type_borderColor=a}))),c.activeHighlight=function(a){c.customColor&&(a?c.isHighlight=!0:c.isHighlight=!1)},""===e.closable&&(c.isClosable=!0,c.closeMe=function(){c.display=!1,b(function(){
+d.attr("tabindex","0"),d[0].focus(),d.bind("blur",function(){d.remove()})}),e.onClose&&(c.onClose=a(c.onClose),c.onClose())})}}}]),angular.module("att.abs.textOverflow",[]).constant("textDefaultOptions",{width:"50%"}).directive("attTextOverflow",["textDefaultOptions","$compile",function(a,b){return{restrict:"A",link:function(c,d,e){var f=d.text();if(d.addClass("text-ellipsis"),e.$observe("attTextOverflow",function(b){b?d.css({width:b}):d.css({width:a.width})}),!d.attr("tooltip")){d.attr("tooltip",f),d.attr("tooltip-placement","above");var g=angular.element(d);b(g)(c)}}}}]),angular.module("att.abs.toggle",["angular-gestures","att.abs.position"]).directive("attToggleTemplate",["$compile","$log","$position",function(a,b,c){return{restrict:"A",require:"ngModel",transclude:!0,scope:{modelVal:"=ngModel"},templateUrl:"app/scripts/ng_js_att_tpls/toggle/demoToggle.html",link:function(a,b,d){a.initialDragPosition=0;var e=0,f=c.offset(b.children().eq(1).children().eq(0)).width-1,g=function(){a.attrValue===d.ngTrueValue||a.attrValue?a.modelVal=!1:a.modelVal=!0};a.updateModel=function(a){1!==e&&(g(),e=0),a.preventDefault()},a.drag=function(d){if(e=1,"dragstart"===d.type)a.initialDragPosition=c.position(b.children().eq(1)).left,b.children().eq(1).addClass("dragging");else if("drag"===d.type){var h=Math.min(0,Math.max(a.initialDragPosition+d.gesture.deltaX,-f));b.children().eq(1).css({left:h+"px"})}else if("dragend"===d.type){var i=c.position(b.children().eq(1)).left>-1*f/2;b.children().eq(1).removeClass("dragging"),TweenMax.to(b.children().eq(1),.1,{left:i?0:-1*f,ease:Power4.easeOut,onComplete:function(){b.children().eq(1).css({left:""})}}),(i||!i&&"left"===d.gesture.direction)&&g(),e=0}return!1},a.directiveValue=d.attToggleTemplate,a.on=d.trueValue,a.off=d.falseValue;var h=-1*f+"px";a.$watch("modelVal",function(c){if(a.attrValue=c,c===d.ngTrueValue||c){b.children().eq(1).css({left:"0px"}),b.addClass("att-checkbox--on");var f=b.find("div").find("div").eq(1);f.attr("aria-checked",!0),e=0}else{b.children().eq(1).css({left:h}),b.removeClass("att-checkbox--on");var f=b.find("div").find("div").eq(1);f.attr("aria-checked",!1),e=0}b.children().eq(1).css({left:""})})}}}]).directive("attToggleMain",["$compile",function(a){return{restrict:"A",require:"ngModel",transclude:!0,replace:!0,scope:{modelValue:"=ngModel",trueValue:"=ngTrueValue",falseValue:"=ngFalseValue"},link:function(b,c,d){var e="",f="";c.removeAttr("att-toggle-main"),b.on=d.ngTrueValue,b.off=d.ngFalseValue,b.largeValue=d.attToggleMain,angular.isDefined(d.ngTrueValue)&&(e+=' true-value="{{on}}" false-value="{{off}}"'),void 0!==b.largeValue&&(f+=' ="{{largeValue}}"'),c.css({display:"none"});var g=angular.element('<div class="att-switch att-switch-alt" ng-class="{\'large\' : largeValue == \'large\'}" ng-model="modelValue"'+e+" att-toggle-template"+f+">"+c.prop("outerHTML")+"</div>");g=a(g)(b),c.replaceWith(g)}}}]),angular.module("att.abs.treeview",[]).directive("treeView",function(){return{restrict:"A",link:function(a,b){function c(){f.reversed()?f.play():f.reverse()}function d(a){a.stopPropagation(),void 0!==angular.element(a.target).attr("tree-view")&&(b.hasClass("minus")?b.removeClass("minus"):b.addClass("minus"),c())}var e=b.children("ul li"),f=TweenMax.from(e,.2,{display:"none",paused:!0,reversed:!0});b.attr("tabindex","0"),b.on("click",function(a){d(a)}),b.on("keypress",function(a){var b=a.keyCode?a.keyCode:a.charCode,c=[13,32];c.length>0&&b&&c.indexOf(b)>-1&&(d(a),a.preventDefault())})}}}),angular.module("att.abs.typeAhead",["att.abs.tagBadges"]).directive("focusMe",["$timeout","$parse",function(a,b){return{link:function(c,d,e){var f=b(e.focusMe);c.$watch(f,function(b){b&&a(function(){d[0].focus(),c.inputActive=!0})}),d.bind("blur",function(){f.assign(c,!1),c.inputActive=!1,c.$digest()})}}}]).directive("typeAhead",["$timeout","$log",function(a,b){return{restrict:"EA",templateUrl:"app/scripts/ng_js_att_tpls/typeAhead/typeAhead.html",replace:!0,scope:{items:"=",title:"@?",titleName:"@",subtitle:"@",model:"=",emailIdList:"=",emailMessage:"="},link:function(c,d){!angular.isDefined(c.titleName)&&angular.isDefined(c.title)&&a(function(){c.titleName=c.title,b.warn("title attribute is deprecated and title-name attribute is used instead as it is conflicting with html title attribute")}),c.lineItems=[],c.filteredListLength=-1,c.filteredList=[],c.setFocus=function(){c.clickFocus=!0},c.setFocus(),c.handleSelection=function(a,b){c.lineItems.push(a),c.emailIdList.push(b),c.model="",c.current=0,c.selected=!0,c.clickFocus=!0},c.theMethodToBeCalled=function(b){var d=c.lineItems.slice();c.emailIdList.splice(b,1),d.splice(b,1),a(function(){c.lineItems=[],c.$apply(),c.lineItems=c.lineItems.concat(d)})},c.current=0,c.selected=!0,c.isCurrent=function(a,b,d,e){return c.current===a&&(c.itemName=b,c.itemEmail=d),c.dropdownLength=e,c.current===a},c.setCurrent=function(a){c.current=a},c.selectionIndex=function(a){38===a.keyCode&&c.current>0?(a.preventDefault(),c.current=c.current-1,c.isCurrent(c.current)):9===a.keyCode?c.selected=!0:13===a.keyCode&&c.dropdownLength!==c.items.length?c.handleSelection(c.itemName,c.itemEmail):8===a.keyCode&&0===c.model.length||46===a.keyCode?c.theMethodToBeCalled(c.lineItems.length-1):40===a.keyCode&&c.current<c.dropdownLength-1&&(a.preventDefault(),c.current=c.current+1,c.isCurrent(c.current)),d[0].querySelector(".list-scrollable").scrollTop=35*(c.current-1)}}}}]),angular.module("att.abs.verticalSteptracker",["ngSanitize"]).directive("verticalSteptracker",[function(){return{restrict:"EA",transclude:!0,replace:!1,scope:{},template:'<div class="vertical-nav"><ul ng-transclude arial-label="step list" role="presentation" class="tickets-list-height"></ul></div>',link:function(){}}}]).directive("verticalSteptrackerStep",[function(){return{restrict:"EA",transclude:!0,replace:!1,scope:{type:"=type",id:"=id"},templateUrl:"app/scripts/ng_js_att_tpls/verticalSteptracker/vertical-step-tracker.html",link:function(){}}}]).directive("attAbsLink",[function(){return{restrict:"EA",transclude:!0,replace:!1,template:'<span ng-transclude class="view-log"></span>'}}]),angular.module("att.abs.videoControls",[]).config(["$compileProvider",function(a){a.aHrefSanitizationWhitelist(/^\s*(https?|javascript):/)}]).directive("videoControls",[function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/videoControls/videoControls.html"}}]).directive("photoControls",[function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"app/scripts/ng_js_att_tpls/videoControls/photoControls.html",scope:{prevLink:"@",nextLink:"@"},link:function(a,b,c){c.prevLink||(a.prevLink="javascript:void(0)"),c.nextLink||(a.nextLink="javascript:void(0)"),a.links={prevLink:a.prevLink,nextLink:a.nextLink}}}}]),angular.module("app/scripts/ng_js_att_tpls/accordion/accordion.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/accordion/accordion.html",'<div class="att-accordion__group tabpanel" ng-class="{\'att-accordion__group att-accordion__group--open\':isOpen,\'att-accordion__group\':!isOpen }">\n <a ng-show="showicon" \n class="toggle-header att-accordion__heading att-accordion__toggle noafter" \n aria-selected="{{focused}}" \n aria-controls="panel{{index}}" \n aria-expanded="{{isOpen}}" \n ng-class="{focus: focused, selected: focused}" \n role="tab" \n ng-click="toggle()" \n accordion-transclude="heading" \n style="cursor:pointer; text-decoration:none">\n <span>{{heading}}</span>\n <i ng-class="{\'icon-chevron-down\':!isOpen,\'icon-chevron-up\':isOpen }" class="pull-right"></i>\n </a>\n <div ng-show="!showicon" \n ng-class="{focus: focused, selected: focused}" \n style="text-decoration:none" \n accordion-transclude="heading" \n role="tab" \n aria-expanded="{{isOpen}}"\n aria-selected="{{focused}}" \n aria-controls="panel{{index}}" \n class="toggle-header att-accordion__heading att-accordion__toggle noafter">\n <span>{{heading}}</span>\n </div> \n <div aria-label="{{heading}}" \n aria-hidden="{{!isOpen}}" \n role="tabpanel" \n collapse="!isOpen" \n class="att-accordion__body" \n id="panel{{index}}" \n ng-transclude>\n </div>\n <div class="att-accordion__bottom--border"></div> \n</div> ')}]),angular.module("app/scripts/ng_js_att_tpls/accordion/accordion_alt.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/accordion/accordion_alt.html",'<div class="att-accordion__group tabpanel" ng-class="{\'att-accordion__group att-accordion__group--open\':isOpen,\'att-accordion__group\':!isOpen }">\n <a class="toggle-header att-accordion__heading att-accordion__toggle" \n aria-selected="{{focused}}" \n aria-controls="panel{{index}}" \n ng-class="{focus: focused, selected: focused}" \n aria-expanded="{{isOpen}}" \n role="tab" \n ng-click="toggle()" \n accordion-transclude="heading"> \n </a>\n <span>{{heading}}</span>\n <div aria-label="{{heading}}" \n aria-hidden="{{!isOpen}}" \n role="tabpanel" \n collapse="!isOpen" \n class="att-accordion__body" \n id="panel{{index}}" \n ng-transclude>\n </div>\n</div> ')}]),angular.module("app/scripts/ng_js_att_tpls/accordion/attAccord.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/accordion/attAccord.html","<div ng-transclude></div>")}]),angular.module("app/scripts/ng_js_att_tpls/accordion/attAccordBody.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/accordion/attAccordBody.html","<div ng-transclude></div>")}]),angular.module("app/scripts/ng_js_att_tpls/accordion/attAccordHeader.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/accordion/attAccordHeader.html",'<div ng-click="clickFunc()">\n <div ng-transclude>\n <i class="icon-chevron-down"></i>\n </div>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/alert/alert.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/alert/alert.html","<div class=\"alert\" ng-class=\"{'alert-success': alertType === 'success', 'alert-warning': alertType === 'warning', 'alert-error': alertType === 'error', 'alert-info': alertType === 'info', 'alert-inplace': showTop !== 'true'}\" ng-show=\"showAlert\" ng-style=\"cssStyle\">\n <div class=\"container\">\n"+' <a href="javascript:void(0)" alt="close" class="close-role" ng-click="close()" tabindex="0" att-accessibility-click="32,13">Dismiss <i class="icon-circle-action-close"></i></a>\n <span ng-transclude> </span>\n </div>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/boardStrip/attAddBoard.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/boardStrip/attAddBoard.html",'<div tabindex="0" att-accessibility-click="13,32" ng-click="addBoard()" aria-label="Add Board" class="boardstrip-item--add">\n <i aria-hidden="true" class="icon-add centered"></i>\n <br/>\n <div class="centered">Add board</div>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/boardStrip/attBoard.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/boardStrip/attBoard.html",'<li att-board-navigation tabindex="0" aria-label="{{boardLabel}}" att-accessibility-click="13,32" ng-click="selectBoard(boardIndex)" class="board-item" ng-class="{\'selected\': getCurrentIndex()===boardIndex}">\n <div ng-transclude></div>\n <div class="board-caret" ng-if="getCurrentIndex()===boardIndex">\n <div class="board-caret-indicator"></div>\n <div class="board-caret-arrow-up"></div>\n </div>\n</li>')}]),angular.module("app/scripts/ng_js_att_tpls/boardStrip/attBoardStrip.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/boardStrip/attBoardStrip.html",'<div class="att-boardstrip">\n <div class="boardstrip-reel">\n <div class="prev-items" ng-if="isPrevBoard()">\n <i tabindex="0" aria-label="Scroll Boardstrip Left" att-accessibility-click="13,32" ng-click="prevBoard()" class="arrow icon-arrow-left-circle"></i>\n </div>\n <div att-add-board on-add-board="onAddBoard()"></div>\n <div class="board-viewport"><ul role="presentation" class="boardstrip-container" ng-transclude></ul></div>\n <div class="next-items" ng-if="isNextBoard()">\n <i tabindex="0" aria-label="Scroll Boardstrip Right" att-accessibility-click="13,32" ng-click="nextBoard()" class="arrow icon-arrow-right-circle"></i>\n </div>\n </div>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/buttons/buttonDropdown.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/buttons/buttonDropdown.html",'<div class="att-btn-dropdown">\n <div class="buttons-dropdown--small btn-group" ng-class="{\'open\': isOpen}" att-accessibility-click="13,32" ng-click="toggle()">\n \n <button role="menu" class="button button--secondary button--small buttons-dropdown__drop dropdown-toggle" ng-if="type===\'dots\'" alt="Click for Options" >\n \n <div class="circle"></div>\n <div class="circle"></div>\n <div class="circle"></div>\n </button>\n <button role="menu" class="button button--secondary button--small buttons-dropdown__drop dropdown-toggle ng-isolate-scope actions-title" ng-if="type === \'actions\'" alt="Actions dropdown Buttons">Actions</button>\n \n\n'+" <ul ng-class=\"{'dropdown-menu dots-dropdwn': type==='dots', 'dropdown-menu actions-dropdwn': type === 'actions'}\" ng-transclude></ul>\n </div>\n \n</div>\n")}]),angular.module("app/scripts/ng_js_att_tpls/colorselector/colorselector.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/colorselector/colorselector.html",'<div class="att-radio att-color-selector__item" \n ng-class="{\'att-radio--on\': (iconColor === selected)}">\n <div class="att-radio__indicator" tabindex="0" att-accessibility-click="32,13" ng-click="selectedcolor(iconColor)" \n ng-style="applycolor" ng-transclude></div>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/datepicker/dateFilter.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/datepicker/dateFilter.html",'<div class="calendar" ng-class="{\'monthpicker\':mode === 1}">\n <div class="select2-container" ng-class="{\'select2-container-active select2-dropdown-open\': showDropdownList}" style="width: 100%; z-index:0">\n <a tabindex="0" id="select2-choice" class="select2-choice" href="javascript:void(0)" att-element-focus="focusInputButton" ng-show="!showCalendar" att-accessibility-click="13,32" ng-click="showDropdown()" ng-blur="focusInputButton=false">\n <span class="select2-chosen" ng-show="!showCalendar">{{selectedOption}}</span>\n <input type="text" ng-show="showCalendar" ng-blur="untrackInputChange($event)" att-input-deny="[^0-9\\/-]" maxlength="{{maxLength}}" ng-model="selectedOption" aria-labelledby="select2-choice" ng-change="getDropdownText()" />\n <abbr class="select2-search-choice-close"></abbr>\n <span ng-class="{\'select2-arrow\': mode !== 1, \'calendar-icon\': mode === 1}"><b></b></span>\n </a>\n <a id="select2-chosen" class="select2-choice" href="javascript:void(0)" ng-show="showCalendar">\n <span class="select2-chosen" ng-show="!showCalendar">{{selectedOption}}</span>\n <input type="text" ng-show="showCalendar" ng-blur="untrackInputChange($event)" att-input-deny="[^0-9\\/-]" maxlength="{{maxLength}}" ng-model="selectedOption" aria-labelledby="select2-chosen" ng-change="getDropdownText()" />\n <abbr class="select2-search-choice-close"></abbr>\n <span tabindex="0" ng-class="{\'select2-arrow\': mode !== 1, \'calendar-icon\': mode === 1}" att-accessibility-click="13,32" ng-click="showDropdown()"><b></b></span>\n </a>\n </div>\n <div class="select2-drop select2-drop-active select2-display-none" ng-style="{display: (showDropdownList && \'block\') || \'none\', \'border-radius\': showCalendar && \'0 0 0 6px\'}" style="width: 100%">\n <div id="dateFilterList" att-scrollbar ><ul class="select2-results options" ng-transclude></ul></div>\n <ul class="select2-results sttings" style="margin-top:0px">\n <li tabindex="0" class="select2-result select2-highlighted greyBorder" ng-class="{\'select2-result-current\': checkCurrentSelection(\'Custom Single Date\')}" att-accessibility-click="13,32" ng-click="selectAdvancedOption(\'Custom Single Date\')">\n <div class="select2-result-label" ng-if="mode !== 1">Custom Single Date...</div>\n <div class="select2-result-label" ng-if="mode === 1">Custom single month...</div>\n </li>\n <li tabindex="0" class="select2-result select2-highlighted" ng-class="{\'select2-result-current\': checkCurrentSelection(\'Custom Range\')}" att-accessibility-click="13,32" ng-click="selectAdvancedOption(\'Custom Range\')">\n <div class="select2-result-label" ng-if="mode !== 1">Custom Range...</div>\n <div class="select2-result-label" ng-if="mode === 1">Custom month range...</div>\n </li>\n <li class="select2-result select2-highlighted btnContainer" ng-style="{display: (showCalendar && \'block\') || \'none\'}">\n <button tabindex="0" ng-blur="resetFocus($event)" att-element-focus="focusApplyButton" att-button="" btn-type="{{applyButtonType}}" size="small" att-accessibility-click="13,32" ng-click="apply()">Apply</button>\n <button tabindex="0" att-button="" btn-type="secondary" size="small" att-accessibility-click="13,32" ng-click="cancel()">Cancel</button>\n <div>\n <a tabindex="0" href="javascript:void(0)" ng-if="mode !== 1" style="text-decoration:underline;" att-accessibility-click="13,32" ng-click="clear()">Clear Dates</a>\n <a tabindex="0" href="javascript:void(0)" ng-if="mode === 1" style="text-decoration:underline;" att-accessibility-click="13,32" ng-click="clear()">Clear Months</a>\n </div>\n </li>\n </ul>\n </div>\n <div class="datepicker-wrapper show-right" ng-style="{display: (showCalendar && \'block\') || \'none\'}">\n <span datepicker ng-blur="resetFocus($event)" att-element-focus="focusSingleDateCalendar" ng-show="checkCurrentSelection(\'Custom Single Date\')"></span>\n <span datepicker ng-blur="resetFocus($event)" att-element-focus="focusRangeCalendar" ng-show="checkCurrentSelection(\'Custom Range\')"></span>\n </div>\n</div>\n')}]),angular.module("app/scripts/ng_js_att_tpls/datepicker/dateFilterList.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/datepicker/dateFilterList.html",'<li ng-click="!disabled && selectOption(fromDate,toDate,caption)" att-accessibility-click="13,32" ng-class="{\'select2-result-current\': checkCurrentSelection(caption)}" class="select2-result select2-highlighted ng-scope" tabindex="{{!disabled?\'0\':\'-1\'}}">\n <div class="select2-result-label" ng-class="{\'disabled\':disabled}" ng-transclude></div>\n</li>')}]),angular.module("app/scripts/ng_js_att_tpls/datepicker/datepicker.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/datepicker/datepicker.html",'<div id="datepicker" class="datepicker" ng-class="{\'monthpicker\': mode === 1}" aria-hidden="false" role="dialog" tabindex="-1" aria-labelledby="datepicker">\n <div class="datepicker-days" style="display: block;">\n <table class="table-condensed">\n <thead>\n <tr>\n <th id="month" tabindex="0" class="datepicker-switch" colspan="{{(mode !== 1) && (currentRows[0].length - 2) || (currentRows[0].length)}}" style="text-align:left">{{currentTitle}}</th>\n <th ng-if="mode !== 1" id="prev" aria-hidden="{{!disablePrev && \'false\'|| \'true\'}}" tabindex="{{!disablePrev && \'0\'|| \'-1\'}}" att-accessibility-click="13,32" ng-click="!disablePrev && move(-1)">\n <div class="icons-list" data-size="medium"><i class="icon-arrow-left-circle" ng-class="{\'disabled\': disablePrev}" alt="Left Arrow"></i>\n </div><span class="hidden-spoken">Previous Month</span>\n </th>\n <th ng-if="mode !== 1" id="next" aria-hidden="{{!disableNext && \'false\'|| \'true\'}}" tabindex="{{!disableNext && \'0\'|| \'-1\'}}" att-accessibility-click="13,32" ng-click="!disableNext && move(1)">\n <div class="icons-list" data-size="medium"><i class="icon-arrow-right-circle" ng-class="{\'disabled\': disableNext}" alt="Right Arrow"></i>\n </div><span class="hidden-spoken">Next Month</span>\n </th>\n </tr>\n <tr ng-if="labels.length > 0">\n <th tabindex="-1" class="dow weekday" ng-repeat="label in labels"><span>{{label.pre}}</span></th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td id="datepickerBody" att-scrollbar colspan="{{currentRows[0].length}}" style="padding: 0px;" headers="">\n <table ng-class="{\'table-condensed\': mode === 0, \'monthtable-condensed\': mode === 1}" style="padding: 0px;">\n <thead class="hidden-spoken">\n <tr ng-show="labels.length > 0">\n <th id="{{label.post}}" tabindex="-1" class="dow weekday" ng-repeat="label in labels"></th>\n </tr>\n </thead>\n <tbody>\n <tr ng-repeat="row in currentRows">\n <td headers="{{(mode === 0) && dt.header || \'month\'}}" att-element-focus="dt.focused" aria-hidden="{{(!dt.oldMonth && !dt.nextMonth && !dt.disabled && \'false\') || \'true\'}}" tabindex="{{(!dt.oldMonth && !dt.nextMonth && !dt.disabled && \'0\') || \'-1\'}}" ng-repeat="dt in row" class="days" ng-class="{\'active\': dt.selected || dt.from || dt.to, \'from\': dt.from, \'to\': dt.to, \'range\': dt.dateRange, \'prev-month \': dt.oldMonth, \'next-month\': dt.nextMonth, \'disabled\': dt.disabled, \'today\': dt.today, \'weekend\': dt.weekend}" ng-click="!dt.selected && !dt.from && !dt.to && !dt.disabled && !dt.oldMonth && !dt.nextMonth && select(dt.date)" att-accessibility-click="13,32" aria-label="{{dt.date | date : \'EEEE, MMMM d\'}}"><span class="day">{{dt.label}}</span></td>\n </tr>\n <tr ng-if="mode === 1" class="divider"><td colspan="{{nextRows[0].length}}"><hr></td></tr>\n <tr>\n <th id="month" tabindex="0" class="datepicker-switch internal" colspan="{{nextRows[0].length}}" style="text-align:left">{{nextTitle}}</th>\n </tr>\n <tr ng-repeat="row in nextRows">\n'+" <td headers=\"{{(mode === 0) && dt.header || 'month'}}\" att-element-focus=\"dt.focused\" aria-hidden=\"{{(!dt.oldMonth && !dt.nextMonth && !dt.disabled && 'false') || 'true'}}\" tabindex=\"{{(!dt.oldMonth && !dt.nextMonth && !dt.disabled && '0') || '-1'}}\" ng-repeat=\"dt in row\" class=\"days\" ng-class=\"{'active': dt.selected || dt.from || dt.to, 'from': dt.from, 'to': dt.to, 'range': dt.dateRange, 'prev-month ': dt.oldMonth, 'next-month': dt.nextMonth, 'disabled': dt.disabled, 'today': dt.today, 'weekend': dt.weekend}\" ng-click=\"!dt.selected && !dt.from && !dt.to && !dt.disabled && !dt.oldMonth && !dt.nextMonth && select(dt.date)\" att-accessibility-click=\"13,32\" aria-label=\"{{dt.date | date : 'EEEE, MMMM d'}}\"><span class=\"day\">{{dt.label}}</span></td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</div>\n")}]),angular.module("app/scripts/ng_js_att_tpls/datepicker/datepickerPopup.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/datepicker/datepickerPopup.html",'<div class="calendar">\n <div class="box" ng-class="{\'active\': isOpen}">\n <span ng-transclude></span>\n <i class="calendar-icon" tabindex="0" att-accessibility-click="13,32" ng-click="toggle()" alt="Calendar Icon"></i>\n </div>\n <div class="datepicker-wrapper datepicker-wrapper-display-none" ng-style="{display: (isOpen && \'block\') || \'none\'}" aria-hidden="false" role="dialog" tabindex="-1">\n <span datepicker></span>\n </div>\n</div>\n')}]),angular.module("app/scripts/ng_js_att_tpls/dividerLines/dividerLines.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/dividerLines/dividerLines.html",'<div class="divider-container" ng-class="{\'divider-container-light\': lightContainer}">\n <hr ng-class="{\'divider-light\': lightContainer}">\n</div>\n\n')}]),angular.module("app/scripts/ng_js_att_tpls/dragdrop/fileUpload.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/dragdrop/fileUpload.html",'<label class="fileContainer"><span ng-transclude></span><input type="file" att-file-change></label>')}]),angular.module("app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlert.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlert.html",'<div class="form-field" ng-class="{\'error\': errorMessage, \'warning\': warningMessage}">\n <label class="form-field__label" ng-class="{\'form-field__label--show\': showLabel, \'form-field__label--hide\': hideLabel}"></label>\n <div class="form-field-input-container" ng-transclude></div>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlertPrv.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/formField/attFormFieldValidationAlertPrv.html",'<div class="form-field" ng-class="{\'error\':hideErrorMsg}">\n <div class="form-field-input-container" ng-transclude></div>\n <div class="form-field__message error" type="error" ng-show="hideErrorMsg" >\n <i class="icon-info-alert"></i>{{errorMessage}}\n </div>\n</div>\n')}]),angular.module("app/scripts/ng_js_att_tpls/formField/creditCardImage.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/formField/creditCardImage.html",'<span class="css-sprite pull-right">\n<span class="hidden-spoken">We accept</span>\n<ul class="{{newValCCI}}">\n <li class="css-sprite-mc"><span class="hidden-spoken">MasterCard</span></li>\n <li class="css-sprite-visa"><span class="hidden-spoken">Visa</span></li>\n <li class="css-sprite-amex"><span class="hidden-spoken">American Express</span></li>\n <li class="css-sprite-discover"><span class="hidden-spoken">Discover</span></li> \n</ul>\n</span>\n<label for="ccForm.card" class="pull-left">Card number</label>')}]),angular.module("app/scripts/ng_js_att_tpls/formField/cvcSecurityImg.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/formField/cvcSecurityImg.html",'<div>\n<button type="button" class="btn btn-alt btn-tooltip" style="padding-top:16px" title="Help"><i class="hidden-spoken">Help</i></button>\n<div class="helpertext" role="tooltip">\n<div class="popover-title"></div>\n<div class="popover-content">\n <p class="text-legal cvc-cc">\n <img ng-src="images/{{newValI}}.png" alt="{{newValIAlt}}">\n </p>\n</div>\n</div>\n</div>\n')}]),angular.module("app/scripts/ng_js_att_tpls/hourpicker/hourpicker.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/hourpicker/hourpicker.html",'<div class="hourpicker">\n <div class="dropdown-width">\n <div ng-model="showlist" class="select2-container topDropDownWidth" ng-class="{\'select2-dropdown-open select2-container-active\': showlist}" >\n <a class="select2-choice" href="javascript:void(0)" id="customSelect" ng-keydown="selectOption(selectPrevNextValue($event,options,selectedOption))" att-accessibility-click="13" ng-click="showDropdown()">\n <span class="select2-chosen">{{selectedOption}}</span>\n <span class="select2-arrow"><b></b></span>\n </a>\n </div> \n <div class="select2-display-none select2-with-searchbox select2-drop-active show-search resultTopWidth" ng-show="showlist"> \n <ul class="select2-results resultTopMargin" > \n <li ng-model="ListType" ng-repeat="option in options" att-accessibility-click="13" ng-click="selectOption(option,$index)" class="select2-results-dept-0 select2-result select2-result-selectable"><div class="select2-result-label"><span >{{option}}</span></div></li> \n </ul>\n </div>\n </div>\n <div ng-show="showDaysSelector" class="customdays-width">\n <div att-divider-lines class="divider-margin-f"></div> \n <div class="col-md-3 fromto-margin">\n <div>From</div> <br>\n <div>To</div>\n </div>\n <div ng-repeat="day in days">\n <div class="col-md-3 col-md-days">\n <div class="col-md-1 daysselect-margin">\n <input type="checkbox" ng-model="daysList[day]" title="Day selection {{$index}}" att-checkbox ng-change="addSelectedValue(day)"> \n </div>\n <span>{{day}}</span><br>\n \n <div class="dropDownMarginBottom">\n <div class="select2-container topDropDownWidth" ng-class="{\'select2-dropdown-open select2-container-active\': FrtimeListDay[day]}" >\n <a class="select2-choice selectDropDown" href="javascript:void(0)" tabindex="{{daysList[day] ? \'0\' : \'-1\'}}" att-accessibility-click="13" ng-click="daysList[day] && showfromDayDropdown(day)" ng-class="{\'select2-chosen-disabled\':!daysList[day]}" ng-keydown="daysList[day] && selectFromDayOption(day , selectPrevNextValue($event,fromtime,selectedFromOption[day]));daysList[day] && addSelectedValue(day);">\n <span class="select2-chosen dropDownMarginRight" >{{selectedFromOption[day]}} <i ng-if="daysList[day]" ng-class="FrtimeListDay[day] ? \'icon-dropdown-up\' : \'ion-arrow-down-b\'"></i></span>\n </a>\n </div> \n \n <div class="select2-display-none select2-with-searchbox select2-drop-active show-search resultFromDropDown" ng-show="FrtimeListDay[day]"> \n <ul class="select2-results resultTopMargin" > \n <li ng-click="selectFromDayOption(day,time.value);addSelectedValue(day);" ng-repeat="time in fromtime" class="select2-results-dept-0 select2-result select2-result-selectable"><div class="select2-result-label" ng-class="{\'selectedItemInDropDown\': (time.value==selectedFromOption[day])}"><span >{{time.value}}</span></div></li> \n </ul>\n </div>\n </div>\n \n <div class="dropDownMarginBottom">\n <div class="select2-container topDropDownWidth" ng-class="{\'select2-dropdown-open select2-container-active\': TotimeListDay[day]}" >\n <a class="select2-choice selectDropDown" href="javascript:void(0)" tabindex="{{daysList[day] ? \'0\' : \'-1\'}}" att-accessibility-click="13" ng-click="daysList[day] && showtoDayDropdown(day)" ng-class="{\'select2-chosen-disabled\':!daysList[day], \'selectDropDown-error\':daysList[day] && showToTimeErrorDay[day]}" ng-keydown="daysList[day] && selectToDayOption(day , selectPrevNextValue($event,totime,selectedToOption[day]));daysList[day] && addSelectedValue(day);">\n <span class="select2-chosen dropDownMarginRight">{{selectedToOption[day]}} <i ng-if="daysList[day]" ng-class="TotimeListDay[day] ? \'icon-dropdown-up\' : \'ion-arrow-down-b\'" ></i></span>\n </a>\n </div>\n \n <div class="select2-display-none select2-with-searchbox select2-drop-active show-search resultToDropDown" ng-show="TotimeListDay[day]"> \n <ul class="select2-results resultTopMargin" > \n <li ng-click="selectToDayOption(day,time.value);addSelectedValue(day);" ng-repeat="time in totime" class="select2-results-dept-0 select2-result select2-result-selectable"><div class="select2-result-label" ng-class="{\'selectedItemInDropDown\': (time.value==selectedToOption[day])}"><span >{{time.value}}</span></div></li> \n </ul>\n </div>\n </div>\n </div> \n </div> \n <div att-divider-lines class="divider-margin-s"></div>\n </div>\n <div ng-transclude></div>\n</div>');
+}]),angular.module("app/scripts/ng_js_att_tpls/links/readMore.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/links/readMore.html",'<div>\n <div ng-bind-html="textToDisplay" ng-class="{\'att--readMore\': readFlag, \'att--readLess\': !readFlag}" ng-style="readLinkStyle"></div>\n <span class="att--readmore__link" ng-show="readMoreLink">… <a href="javascript:void(0);" ng-click="readMore()" att-accessbility-click="32,13">Read More</a>\n </span>\n</div>\n<span class="att--readless__link" ng-show="readLessLink">\n <a href="javascript:void(0);" ng-click="readLess()" att-accessbility-click="32,13">Read Less</a>\n</span>')}]),angular.module("app/scripts/ng_js_att_tpls/loading/loading.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/loading/loading.html",'<div data-progress="{{progressStatus}}" class="{{colorClass}}" ng-class="{\'att-loading-count\':icon == \'count\',\'loading--small\':icon == \'small\',\'loading\': icon != \'count\'}" alt="Loading">\n <div class="att-loading-circle" ng-if="icon == \'count\'">\n <div class="att-loading-circle__mask att-loading-circle__full">\n <div class="att-loading-circle__fill"></div>\n </div>\n <div class="att-loading-circle__mask att-loading-circle__half">\n <div class="att-loading-circle__fill"></div>\n <div class="att-loading-circle__fill att-loading-circle__fix"></div>\n </div>\n </div>\n <div ng-class="{\'att-loading-inset\':icon == \'count\',\'loading__inside\':icon != \'count\'}"><div class="att-loading-inset__percentage" ng-if="icon == \'count\'" alt="Loading with Count"></div></div>\n</div>\n\n')}]),angular.module("app/scripts/ng_js_att_tpls/modal/backdrop.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/modal/backdrop.html",'<div class="overlayed" ng-class="{show: animate}" \n'+" ng-style=\"{'z-index': 2000 + index*10,'overflow':'scroll'}\"> \n</div>")}]),angular.module("app/scripts/ng_js_att_tpls/modal/tabbedItem.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/modal/tabbedItem.html",'<div>\n <ul class="tabs_overlay">\n <li ng-repeat="item in items" class="tabs_overlay__item two__item" ng-class="{\'active\':isActiveTab($index)}" ng-click="clickTab($index)">\n <i class="{{item.iconClass}}"></i>\n {{item.title}} ({{item.number}})\n <a class="viewLink" att-link>Show</a>\n </li>\n </ul>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/modal/tabbedOverlayItem.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/modal/tabbedOverlayItem.html",'<div>\n <ul class="tabs_overlay">\n <li ng-repeat="item in items" class="tabs_overlay__item two__item" ng-class="{\'active\':isActiveTab($index)}" ng-click="clickTab($index)">\n <i class="{{item.iconClass}}"></i>\n {{item.title}} ({{item.number}})\n <a class="viewLink" att-link>Show</a>\n </li>\n </ul>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/modal/window.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/modal/window.html",'<div tabindex="-1" role="dialog" att-element-focus="focusModalFlag" class="modals {{ windowClass }}" ng-class="{show: animate}" \n ng-style="{\'z-index\': 2010 + index*10}" ng-click="close($event)" ng-transclude> \n</div>\n')}]),angular.module("app/scripts/ng_js_att_tpls/pagination/pagination.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/pagination/pagination.html",'<div class="pager">\n <a tabindex="0" href="javascript:void(0)" class="pager__item--prev" att-accessibility-click="13,32" ng-click="prev($event)" ng-if="currentPage > 1"><i class="icon-arrow-left"></i> Previous</a>\n <a tabindex="0" href="javascript:void(0)" class="pager__item pager__item--link" ng-if="totalPages > 7 && currentPage > 3" att-accessibility-click="13,32" ng-click="selectPage(1, $event)">1</a>\n <span class="pager__item" ng-if="totalPages > 7 && currentPage > 3">...</span>\n <a tabindex="0" href="javascript:void(0)" class="pager__item pager__item--link" att-element-focus="isFocused(page)" ng-repeat="page in pages" ng-class="{\'pager__item--active\': checkSelectedPage(page)}" att-accessibility-click="13,32" ng-click="selectPage(page, $event)">{{page}}</a>\n <span class="pager__item" ng-if="totalPages > 7 && currentPage < totalPages - 2 && showInput !== true">...</span>\n <span ng-show="totalPages > 7 && showInput === true"><input class="pager__item--input" type="text" placeholder="..." maxlength="2" ng-model="currentPage" aria-label="Current page count"/></span>\n <a tabindex="0" href="javascript:void(0)" class="pager__item pager__item--link" ng-if="totalPages > 7 && currentPage < totalPages - 2" att-accessibility-click="13,32" ng-click="selectPage(totalPages, $event)">{{totalPages}}</a>\n <a tabindex="0" href="javascript:void(0)" class="pager__item--next" att-accessibility-click="13,32" ng-click="next($event)" ng-if="currentPage < totalPages">Next <i class="icon-arrow-right"></i></a>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/paneSelector/innerPane.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/paneSelector/innerPane.html","<div class='inner-pane' ng-transclude></div>")}]),angular.module("app/scripts/ng_js_att_tpls/paneSelector/paneGroup.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/paneSelector/paneGroup.html","<div class='pane-group' ng-transclude></div>")}]),angular.module("app/scripts/ng_js_att_tpls/paneSelector/sidePane.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/paneSelector/sidePane.html","<div class='side-pane' ng-transclude></div>")}]),angular.module("app/scripts/ng_js_att_tpls/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/tooltip/tooltip-popup.html","<div class=\"att-tooltip \" \n ng-class=\"{ 'att-tooltip--on': isOpen, \n 'att-tooltip--dark att-tooltip--dark--hover':stylett=='dark', \n 'att-tooltip--light att-tooltip--light--hover':stylett=='light',\n 'att-tooltip--left':placement=='left', \n 'att-tooltip--above':placement=='above', \n 'att-tooltip--right':placement=='right', \n 'att-tooltip--below':placement=='below'}\" \n ng-bind-html=\"content | unsafe\" ></div>")}]),angular.module("app/scripts/ng_js_att_tpls/popOvers/popOvers.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/popOvers/popOvers.html","<div class=\"att-popover popover-demo\" ng-style=\"{backgroundColor:popOverStyle}\"\n ng-class=\"{'att-tooltip--dark':popOverStyle==='grey',\n 'att-pop-over--left':popOverPlacement==='left', \n 'att-pop-over--above':popOverPlacement==='above', \n 'att-pop-over--right':popOverPlacement==='right'}\" \n style='position: absolute; max-width: 490px;'>\n <div class=\"pop-over-caret\"\n ng-class=\"{'pop-over-caret-border--left':popOverPlacement==='left', \n 'pop-over-caret-border--above':popOverPlacement==='above', \n 'pop-over-caret-border--right':popOverPlacement==='right', \n 'pop-over-caret-border--below':popOverPlacement==='below'}\">\n </div>\n <div class=\"pop-over-caret\" ng-style=\"popOverPlacement=='below' && {borderBottom:'6px solid ' +popOverStyle}||popOverPlacement=='left' && {borderLeft:'6px solid ' +popOverStyle}||popOverPlacement=='right' && {borderRight:'6px solid ' +popOverStyle}||popOverPlacement=='above' && {borderTop:'6px solid ' +popOverStyle}\"\n ng-class=\"{'pop-over-caret--left':popOverPlacement==='left', \n 'pop-over-caret--above':popOverPlacement==='above', \n 'pop-over-caret--right':popOverPlacement==='right', \n 'pop-over-caret--below':popOverPlacement==='below'}\"></div>\n \n <div class=\"att-popover-content\">\n"+' <a ng-if="closeable" href="javascript:void(0)" class="icon-close att-popover__close" ng-click="closeMe();$event.preventDefault()"></a>\n <div class="popover-packages__container" ng-include="content"></div>\n </div>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/profileCard/addUser.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/profileCard/addUser.html",'<div class="col-md-9 profile-card add-user">\n <div class="atcenter">\n <div><i class="icon-add"></i></div>\n <span>add User</span>\n </div>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/profileCard/profileCard.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/profileCard/profileCard.html",'<div class="col-md-9 profile-card">\n <div class="top-block">\n <div class="profile-image">\n <img ng-if="image" profile-name="{{profile.name}}" ng-src="{{profile.img}}" alt="{{profile.name}}">\n <span ng-hide="image" class="default-img">{{initials}}</span>\n <p class="name" tooltip-condition="{{profile.name}}" height="true"></p>\n <p class="status">\n <span class="status-icon" ng-class="{\'icon-green\':colorIcon===\'green\',\'icon-red\':colorIcon===\'red\',\'icon-blue\':colorIcon===\'blue\',\'icon-yellow\':colorIcon===\'yellow\'}"> \n </span>\n <span>{{profile.state}}<span ng-if="badge" class="status-badge">Admin</span></span>\n </p>\n </div>\n </div>\n <div class="bottom-block">\n <div class="profile-details">\n <label>Username</label>\n <p att-text-overflow="92%" tooltip-condition="{{profile.userName}}">{{profile.userName}}</p>\n <label>Email</label>\n <p att-text-overflow="92%" tooltip-condition="{{profile.email}}">{{profile.email}}</p>\n <label>Role</label>\n <p att-text-overflow="92%" tooltip-condition="{{profile.role}}">{{profile.role}}</p>\n <label>Last Login</label>\n <p att-text-overflow="92%" tooltip-condition="{{profile.lastLogin}}">{{profile.lastLogin}}</p>\n </div>\n </div>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/progressBars/progressBars.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/progressBars/progressBars.html",'<div class="att-progress">\n <div class="att-progress-value">&nbsp;</div>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/scrollbar/scrollbar.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/scrollbar/scrollbar.html",'<div class="scroll-bar" style="position: absolute">\n <div class="scroll-thumb" style="position: absolute; overflow: hidden"></div>\n</div>\n<div class="prev icons-list" data-size="medium" ng-show="navigation && prevAvailable" ng-style="{height: scrollbarAxis === \'x\' && position.height + \'px\'}">\n <a href="javascript:void(0);" ng-click="customScroll(false)" aria-label="Scroll" aria-hidden="true">\n <i ng-class="{\'icon-chevron-up\': (scrollbarAxis === \'y\'), \'icon-chevron-left\': (scrollbarAxis === \'x\')}"></i>\n </a>\n</div>\n<div class="scroll-viewport" ng-style="{height: (scrollbarAxis === \'x\' && position.height + \'px\') || viewportHeight, width: viewportWidth}" style="position: relative; overflow: hidden">\n <div class="scroll-overview" style="position: absolute; display: table; width: 100%" att-position="position" ng-transclude></div>\n</div>\n<div class=\'next icons-list\' data-size="medium" ng-show="navigation && nextAvailable" ng-style="{height: scrollbarAxis === \'x\' && position.height + \'px\'}">\n <a href="javascript:void(0);" ng-click="customScroll(true)" aria-label="Scroll" aria-hidden="true">\n'+" <i ng-class=\"{'icon-chevron-down': (scrollbarAxis === 'y'), 'icon-chevron-right': (scrollbarAxis === 'x')}\"></i>\n </a>\n</div>\n")}]),angular.module("app/scripts/ng_js_att_tpls/search/search.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/search/search.html",'<div class="select2-container show-search" ng-class="{\'select2-dropdown-open\': (showlist && !isDisabled),\'select2-container-disabled\':isDisabled, \'select2-container-active\': isact}" ng-init="isact=false;" style="width: 100%;">\n <a href="javascript:void(0)" class="select2-choice needsclick" tabindex="0" ng-click="showDropdown()" ng-class="{\'select2-chosen-disabled\':isDisabled}" role="combobox" aria-expanded="{{showlist}}" aria-owns="inList" aria-label="{{selectedOption}} selected" ng-focus="isact=true;" ng-blur="isact=false;">\n <span class="select2-chosen needsclick" aria-hidden = "true">{{selectedOption}}</span>\n <abbr class="select2-search-choice-close needsclick"></abbr>\n <span class="select2-arrow needsclick" role="presentation">\n <b role="presentation" class="needsclick"></b>\n </span>\n </a> \n <input class="select2-focusser select2-offscreen" \n tabindex="-1" \n type="text" \n aria-hidden="true" \n title="hidden" \n aria-haspopup="true" \n role="button"> \n</div>\n\n<div class="select2-drop select2-with-searchbox select2-drop-auto-width select2-drop-active" ng-class="{\'select2-display-none\':(!showlist || isDisabled)}" style="width:100%;z-index: 10">\n <div class="select2-search">\n <label ng-if="!noFilter" class="select2-offscreen" aria-label="Inline Search Field" aria-hidden="true">Inline Search Field</label>\n <input ng-if="!noFilter" ng-model="title" aria-label="title" typeahead="c.title for c in cName | filter:$viewValue:startsWith" type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input" aria-autocomplete="list" placeholder="">\n </div>\n <ul id="inList" class="select2-results" role="listbox">\n <li ng-show="filteredName.length === 0" class="select2-no-results" tabindex="-1">No matches found</li>\n <li class="select2-results-dept-0 select2-result select2-result-selectable" role="presentation" ng-model="ListType" ng-show="selectMsg && filteredName.length > 0" ng-click="selectOption(selectMsg, \'-1\')" ng-class="{\'select2-result-current\': selectedOption === selectMsg, \'hovstyle\': selectedIndex === -1}" ng-mouseover="hoverIn(-1)" aria-label="{{selectMsg}}" tabindex="-1">\n <div ng-if="startsWithFilter" class="select2-result-label" ng-bind-html="selectMsg | unsafe" role="option">\n <span class="select2-match"></span>\n </div>\n <div ng-if="!startsWithFilter" class="select2-result-label" ng-bind-html="selectMsg | highlight:title:className | unsafe" role="option">\n <span class="select2-match"></span>\n </div>\n </li>\n\n <li role="menuitem" ng-if="startsWithFilter" class="select2-results-dept-0 select2-result select2-result-selectable" role="presentation" ng-model="ListType" ng-repeat="(fIndex, item) in filteredName = (cName | startsWith:title:item)" ng-class="{\'select2-result-current\': selectedOption === item.title,\'hovstyle\': selectedIndex === item.index,\'disable\': item.disabled}" ng-click="item.disabled || selectOption(item.title,item.index)" ng-mouseover="hoverIn(item.index)" aria-label="{{item.title}}" tabindex="-1">\n <div class="select2-result-label" ng-bind-html="item.title | unsafe" role="option">\n <span class="select2-match"></span>\n </div>\n </li>\n\n <li role="menuitem" ng-if="!startsWithFilter" class="select2-results-dept-0 select2-result select2-result-selectable" role="presentation" ng-model="ListType" ng-repeat="(fIndex, item) in filteredName = (cName | filter:title)" ng-class="{\'select2-result-current\': selectedOption === item.title,\'hovstyle\': selectedIndex === item.index,\'disable\': item.disabled}" ng-click="item.disabled || selectOption(item.title,item.index)" ng-mouseover="hoverIn(item.index)" aria-label="{{item.title}}" tabindex="-1">\n <div class="select2-result-label" ng-bind-html="item.title | highlight:title:className | unsafe" role="option">\n <span class="select2-match"></span>\n </div>\n </li>\n </ul>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/select/select.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/select/select.html",'<div class="select2-container show-search" ng-class="{\'select2-dropdown-open\': (showlist && !isDisabled),\'select2-container-disabled\': isDisabled, \'select2-container-active\': isact}" ng-init="isact=false;">\n <span class="select2-choice needsclick" tabindex="{{isDisabled ? -1 : 0}}" ng-click="showDropdown()" ng-class="{\'select2-chosen-disabled\':isDisabled}" role="combobox" aria-expanded="{{showlist}}" aria-owns="inList" aria-label="{{selectedOption}} selected" ng-focus="isact=true;" ng-blur="isact=false;">\n <span class="select2-chosen needsclick" aria-hidden="true">{{selectedOption}}</span>\n <abbr class="select2-search-choice-close needsclick"></abbr>\n <span class="select2-arrow needsclick" role="presentation">\n <b role="presentation" class="needsclick"></b>\n </span>\n </span> \n <input class="select2-focusser select2-offscreen" \n tabindex="-1" \n type="text" \n aria-hidden="true" \n title="hidden" \n aria-haspopup="true" \n role="button"> \n</div>\n\n<div class="select2-drop select2-with-searchbox select2-drop-auto-width select2-drop-active" ng-class="{\'select2-display-none\':(!showlist || isDisabled)}" style="width:100%;z-index: 10">\n <div class="select2-search">\n <label ng-if="!noFilter" class="select2-offscreen" aria-label="Inline Search Field" aria-hidden="true">Inline Search Field</label>\n <input ng-if="!noFilter" ng-model="title" aria-label="title" typeahead="c.title for c in cName | filter:$viewValue:startsWith" type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input" aria-autocomplete="list" placeholder="">\n </div>\n <ul id="inList" class="select2-results" role="listbox">\n <li ng-if="!noFilter" ng-show="filteredName.length === 0" class="select2-no-results" tabindex="-1">No matches found</li>\n <li ng-if="!noFilter" class="select2-results-dept-0 select2-result select2-result-selectable" role="presentation" ng-model="ListType" ng-show="selectMsg && filteredName.length > 0" ng-click="selectOption(selectMsg, \'-1\')" ng-class="{\'select2-result-current\': selectedOption === selectMsg, \'hovstyle\': selectedIndex === -1}" ng-mouseover="hoverIn(-1)" aria-label="{{selectMsg}}" tabindex="-1">\n <div ng-if="startsWithFilter" class="select2-result-label" ng-bind-html="selectMsg | unsafe" role="option">\n <span class="select2-match"></span>\n </div>\n <div ng-if="!startsWithFilter" class="select2-result-label" ng-bind-html="selectMsg | highlight:title:className | unsafe" role="option">\n <span class="select2-match"></span>\n </div>\n </li>\n\n <li role="menuitem" ng-if="startsWithFilter" class="select2-results-dept-0 select2-result select2-result-selectable" ng-model="ListType" ng-repeat="(fIndex, item) in filteredName = (cName | startsWith:title:item)" ng-class="{\'select2-result-current\': selectedOption === item.title,\'hovstyle\': selectedIndex === item.index,\'disable\': item.disabled}" ng-click="item.disabled || selectOption(item.title,item.index)" ng-mouseover="hoverIn(item.index)" tabindex="-1">\n <div class="select2-result-label" ng-bind-html="item.title | unsafe" role="option">\n <span class="select2-match"></span>\n </div>\n </li>\n\n <li role="menuitem" ng-if="!startsWithFilter" class="select2-results-dept-0 select2-result select2-result-selectable" ng-model="ListType" ng-repeat="(fIndex, item) in filteredName = (cName | filter:title)" ng-class="{\'select2-result-current\': selectedOption === item.title,\'hovstyle\': selectedIndex === item.index,\'disable\': item.disabled}" ng-click="item.disabled || selectOption(item.title,item.index)" ng-mouseover="hoverIn(item.index)" tabindex="-1">\n <div class="select2-result-label" ng-bind-html="item.title | highlight:title:className | unsafe" role="option">\n <span class="select2-match"></span>\n </div>\n </li>\n </ul>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/select/textDropdown.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/select/textDropdown.html",'<div tabindex="0" class="text-dropdown">\n <div class="dropdown" ng-class="{\'not-visible\': isActionsShown}" ng-click="toggle()">\n <span class="action--selected" ng-bind="currentAction"></span>\n <i ng-class="isActionsShown ? \'icon-dropdown-up\' : \'ion-arrow-down-b\'"></i>\n </div>\n <ul ng-class="isActionsShown ? \'actionsOpened\' : \'actionsClosed\'" ng-show="isActionsShown">\n <li ng-class="{\'highlight\': selectedIndex==$index}" ng-repeat="action in actions track by $index" ng-click="chooseAction($event, action, $index)" ng-mouseover="hoverIn($index)">{{action}}<i ng-class="{\'icon-included-checkmark\': isCurrentAction(action)}" att-accessibility-click="13,32"></i></li>\n </ul>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/slider/maxContent.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/slider/maxContent.html",'<div class="att-slider__label att-slider__label--max att-slider__label--below" ng-transclude></div>')}]),angular.module("app/scripts/ng_js_att_tpls/slider/minContent.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/slider/minContent.html",'<div class="att-slider__label att-slider__label--min att-slider__label--below" ng-transclude></div>')}]),angular.module("app/scripts/ng_js_att_tpls/slider/slider.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/slider/slider.html",'<div class="att-slider" ng-mousemove="moveElem($event)" ng-mouseup="mouseUp($event)">\n <div class="att-slider__track">\n <div class="att-slider__range att-slider__range--disabled" ng-style="disabledStyle"></div>\n <div class="att-slider__range" ng-style="rangeStyle"></div>\n </div>\n <div class="att-slider__handles-container">\n <div role="menuitem" aria-label="{{ngModelSingle}}" class="att-slider__handle" ng-style="handleStyle" ng-mousedown="mouseDown($event,\'ngModelSingle\')" ng-mousemove="moveElem($event)" ng-mouseup="mouseUp($event)" tabindex="0" ng-keydown="keyDown($event,\'ngModelSingle\')"></div>\n <div role="menuitem" aria-label="Minimum Value- {{ngModelLow}}" class="att-slider__handle" ng-style="minHandleStyle" ng-mousedown="mouseDown($event,\'ngModelLow\')" ng-focus="focus($event,\'ngModelLow\')" ng-mousemove="moveElem($event)" ng-mouseup="mouseUp($event)" tabindex="0" ng-keyup="keyUp($event,\'ngModelLow\')" ng-keydown="keyDown($event,\'ngModelLow\')"></div>\n <div role="menuitem" aria-label="Maximum Value- {{ngModelHigh}}" class="att-slider__handle" ng-style="maxHandleStyle" ng-mousedown="mouseDown($event,\'ngModelHigh\')" ng-focus="focus($event,\'ngModelHigh\')" ng-mousemove="moveElem($event)" ng-mouseup="mouseUp($event)" tabindex="0" ng-keyup="keyUp($event,\'ngModelHigh\')" ng-keydown="keyDown($event,\'ngModelHigh\')"></div>\n </div>\n <div ng-transclude></div>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdown.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdown.html",'<div class=" btn-group" \n ng-class="{\'buttons-dropdown--large\':!isSmall, \n \'buttons-dropdown--small\':isSmall, \n \'action-dropdown\':(isActionDropdown), \n \'open\':isDropDownOpen}">\n <a tabindex="0" href="javascript:void(0)" class="button btn buttons-dropdown__split" \n ng-class="{\'button--primary\':(btnType==undefined || btnType==\'primary\'), \n \'button--secondary\':btnType==\'secondary\', \n \'button--disabled\':btnType==\'disabled\', \n \'button--small\':isSmall}" \n ng-if="!isActionDropdown"\n ng-click="btnType===\'disabled\'?undefined:clickFxn()" att-accessibility-click="13,32">{{btnText}}</a>\n <a tabindex="0" href="javascript:void(0)" role="button" aria-label="Toggle Dropdown" aria-haspopup="true" class="button buttons-dropdown__drop dropdown-toggle" \n ng-class="{\'button--primary\':(btnType==undefined || btnType==\'primary\'), \n \'button--secondary\':btnType==\'secondary\', \n \'button--disabled\':btnType==\'disabled\', \n \'button--small\':isSmall}" ng-click="toggleDropdown()" att-accessibility-click="13,32">{{toggleTitle}} </a>\n <ul class="dropdown-menu" ng-class="{\'align-right\':multiselect ===true}" aria-expanded="{{isDropDownOpen}}" ng-click="hideDropdown()" role="menu" ng-transclude></ul>\n</div> ')}]),angular.module("app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdownItem.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/splitButtonDropdown/splitButtonDropdownItem.html",'<li role="menuitem" att-element-focus="sFlag" tabindex="0" ng-transclude></li>')}]),angular.module("app/scripts/ng_js_att_tpls/splitIconButton/splitIcon.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/splitIconButton/splitIcon.html","<div class='split-icon-button-container'>\n\n <div class='split-icon-button' ng-class=\"{'icon-with-chevron': isRight && !isMiddle && !isLeftNextDropdown && !isNextToDropDown, 'split-icon-button-middle':isMiddle, 'split-icon-button-right':isRight, 'split-icon-button-left':isLeft, 'split-icon-button-left-dropdown': isLeftNextDropdown ,'split-icon-button-next-dropdown': isNextToDropDown,'split-icon-button-dropdown': isDropDownOpen,'split-icon-button-hover':isIconHovered || isDropDownOpen}\" ng-mouseover='isIconHovered = true;' ng-mouseleave='isIconHovered = false;' tabindex=\"-1\" att-accessibility-click=\"13,32\" ng-click='dropDownClicked();'>\n <a class='{{icon}}' title='{{iconTitle}}' tabindex=\"0\"></a>\n <i ng-if=\"isRight && !isMiddle && !isLeftNextDropdown && !isNextToDropDown\" \n ng-class=\"isDropDownOpen ? 'icon-dropdown-up' : 'ion-arrow-down-b'\"> </i>\n </div> \n\n <ul ng-if='isDropdown' class='dropdown-menu {{dropDownId}}' ng-show='\n isDropDownOpen' ng-click='toggleDropdown(false)' role=\"presentation\" ng-transclude>\n </ul>\n\n</div>")}]),angular.module("app/scripts/ng_js_att_tpls/splitIconButton/splitIconButton.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/splitIconButton/splitIconButton.html","<div>\n <div ng-if='isLeftLineShown' dir-type='{{iconStateConstants.DIR_TYPE.LEFT}}' expandable-line></div>\n <div ng-click='clickHandler()' att-split-icon icon='{{icon}}' title='{{title}}' dir-type='{{iconStateConstants.DIR_TYPE.BUTTON}}' hover-watch='isHovered' drop-down-watch='dropDownWatch' drop-down-id='{{dropDownId}}'>\n <div ng-transclude>\n </div>\n </div>\n <div ng-if='isRightLineShown' dir-type='{{iconStateConstants.DIR_TYPE.RIGHT}}' expandable-line></div>\n</div>")}]),angular.module("app/scripts/ng_js_att_tpls/splitIconButton/splitIconButtonGroup.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/splitIconButton/splitIconButtonGroup.html","<div ng-transclude>\n</div>")}]),angular.module("app/scripts/ng_js_att_tpls/stepSlider/attStepSlider.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/stepSlider/attStepSlider.html",'<span ng-class="mainSliderClass">\n <table>\n <tr>\n <td>\n <div class="jslider-bg">\n <i class="l"></i>\n <i class="r"></i>\n <i class="v" ng-class="{\'step-slider-green\':sliderColor == COLORS.GREEN, \'step-slider-blue\': sliderColor == COLORS.BLUE_HIGHLIGHT, \'step-slider-magenta\': sliderColor == COLORS.MAGENTA, \'step-slider-gold\': sliderColor == COLORS.GOLD, \'step-slider-purple\': sliderColor == COLORS.PURPLE, \'step-slider-dark-blue\': sliderColor == COLORS.DARK_BLUE, \'step-slider-regular\': sliderColor == COLORS.REGULAR, \'step-slider-white\': sliderColor == COLORS.WHITE, \'cutoff-slider\': isCutOffSlider}"></i>\n </div>\n <div class="jslider-pointer" id="left-pointer"></div>\n <div class="jslider-pointer jslider-pointer-to" ng-class="{\'step-slider-green\':sliderColor == COLORS.GREEN, \'step-slider-blue\': sliderColor == COLORS.BLUE_HIGHLIGHT, \'step-slider-magenta\': sliderColor == COLORS.MAGENTA, \'step-slider-gold\': sliderColor == COLORS.GOLD, \'step-slider-purple\': sliderColor == COLORS.PURPLE, \'step-slider-dark-blue\': sliderColor == COLORS.DARK_BLUE, \'step-slider-regular\': sliderColor == COLORS.REGULAR, \'step-slider-white\':sliderColor == COLORS.WHITE ,\'cutoff-slider\': isCutOffSlider}"></div>\n <div class="jslider-label"><span ng-bind="from"></span><span ng-bind="options.dimension"></span></div>\n <div class="jslider-label jslider-label-to"><span ng-bind="toStr"></span><span ng-bind="endDimension"></span></div>\n <div class="jslider-value" id="jslider-value-left"><span></span>{{options.dimension}}</div>\n <div class="jslider-value jslider-value-to"><span></span>{{toolTipDimension}}</div>\n <div class="jslider-scale" ng-class="{\'show-dividers\': showDividers, \'cutoff-slider-dividers\':isCutOffSlider}">\n </div>\n <div class="jslider-cutoff">\n <div class="jslider-label jslider-label-cutoff">\n <span ng-bind="cutOffVal"></span>\n </div>\n </div>\n </td>\n </tr>\n </table>\n</span>\n')}]),angular.module("app/scripts/ng_js_att_tpls/steptracker/step-tracker.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/steptracker/step-tracker.html",'<div class="steptracker1">\n <div class="steptracker-bg">\n <div tabindex="0" ng-click="stepclick($event, $index);" att-accessibility-click="13,23" class="steptracker-track size-onethird" ng-repeat="step in sdata"\n ng-style="set_width($index)"\n ng-class="{\'last\':laststep($index),\'done\':donesteps($index),\'active\':activestep($index), \'incomplete\': isIncomplete($index), \'disabled\': disableClick}">\n <div class="circle">{{($index) + 1}}<span>{{step.title}}</span></div>\n <div ng-if="!laststep($index)" class="track"></div>\n </div>\n </div>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/steptracker/step.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/steptracker/step.html",'<div class="steptracker1">\n <div class="steptracker-bg">\n <div class="steptracker-track size-onethird" \n ng-class="{\'last\':laststep($index),\'done\':donesteps($index),\'active\':activestep($index)}">\n <div class="circle" tabindex="0" \n ng-click="stepclick($event, $index);" \n att-accessibility-click="13,23">{{($index) + 1}}<span>{{step.title}}</span></div>\n <div ng-if="!laststep($index)" class="track"></div>\n </div>\n </div>\n</div>\n')}]),angular.module("app/scripts/ng_js_att_tpls/steptracker/timeline.html",[]).run(["$templateCache",function(a){
+a.put("app/scripts/ng_js_att_tpls/steptracker/timeline.html","<div class='att-timeline'>\n <div timeline-dot order='0' title='{{steps[0].title}}' description='{{steps[0].description}}' by='{{steps[0].by}}' date='{{steps[0].date}}' type='{{steps[0].type}}'></div>\n\n <div ng-repeat=\"m in middleSteps track by $index\">\n <div timeline-bar order='{{$index}}'></div>\n <div timeline-dot order='{{$index + 1}}' title='{{m.title}}' description='{{m.description}}' by='{{m.by}}' date='{{m.date}}' type='{{m.type}}'>\n </div>\n </div>\n\n</div>")}]),angular.module("app/scripts/ng_js_att_tpls/steptracker/timelineBar.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/steptracker/timelineBar.html","<div class='timeline-bar'>\n <div class='progress-bar' ng-class=\"{'completed-color':isCompleted,'cancelled-color':isCancelled,'alert-color':isAlert}\">\n </div>\n <hr></hr>\n</div>")}]),angular.module("app/scripts/ng_js_att_tpls/steptracker/timelineDot.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/steptracker/timelineDot.html","<div class='timeline-dot'>\n\n <div class='bigger-circle' ng-class=\"{'completed-color':isCompleted,'cancelled-color':isCancelled,'alert-color':isAlert}\">\n </div>\n\n <div class='inactive-circle'>\n </div>\n\n <div class='expandable-circle' ng-class=\"{'completed-color':isCompleted,'cancelled-color':isCancelled,'alert-color':isAlert}\">\n </div>\n\n <div ng-class=\"{'below-info-box':isBelowInfoBoxShown, 'above-info-box': !isBelowInfoBoxShown}\" tabindex=\"0\">\n \n <div ng-if='isBelowInfoBoxShown' class='vertical-line'>\n </div>\n\n <div class='info-container' ng-init='isContentShown=false'>\n <div ng-class=\"{'current-step-title':isCurrentStep, 'title':!isCurrentStep,'completed-color-text':isCompleted,'cancelled-color-text':isCancelled,'alert-color-text':isAlert, 'inactive-color-text':isInactive}\" ng-mouseover='titleMouseover(1)' ng-mouseleave='titleMouseleave()' ng-bind='title' ></div>\n <div class='content'>\n <div class='description' ng-bind='description'></div>\n <div class='submitter' ng-bind='by'></div>\n </div>\n <div class='date' ng-mouseover='titleMouseover(2)' ng-mouseleave='titleMouseleave()' ng-bind='date'></div>\n </div>\n\n <div ng-if='!isBelowInfoBoxShown' class='vertical-line'>\n </div>\n </div>\n\n</div>")}]),angular.module("app/scripts/ng_js_att_tpls/table/attTable.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/table/attTable.html",'<table class="tablesorter tablesorter-default" ng-transclude></table>\n')}]),angular.module("app/scripts/ng_js_att_tpls/table/attTableBody.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/table/attTableBody.html","<td ng-transclude></td>\n")}]),angular.module("app/scripts/ng_js_att_tpls/table/attTableHeader.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/table/attTableHeader.html","<th role=\"button\" aria-label=\"column header {{headerName}} {{sortable !== 'false' && '' || 'sortable'}} {{sortPattern !== 'null' && '' || sortPattern}}\" tabindex=\"{{sortable !== 'false' && '0' || '-1'}}\" class=\"tablesorter-header\" ng-class=\"{'tablesorter-headerAsc': sortPattern === 'asc', 'tablesorter-headerDesc': sortPattern === 'desc', 'tablesort-sortable': sortable !== 'false', 'sorter-false': sortable === 'false'}\" att-accessibility-click=\"13,32\" ng-click=\"(sortable !== 'false') && sort();\"><div class=\"tablesorter-header-inner\" ng-transclude></div></th>")}]),angular.module("app/scripts/ng_js_att_tpls/tableMessages/attTableMessage.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/tableMessages/attTableMessage.html",'<div class="att-table-message">\n <div class="message" ng-if="msgType==messageConstants.TABLE_MESSAGE_TYPES.noMatching">\n <div class="img-magnify-glass"></div> \n <div>\n <div ng-transclude></div>\n </div>\n </div>\n <div class="message" ng-if="msgType==messageConstants.TABLE_MESSAGE_TYPES.errorLoading">\n <div class="img-oops-exclamation" tabindex="0" aria-label="Oops! The information could not load at this time. Please click link to refresh the page."></div> \n <div>Oops!</div>\n <div>The information could not load at this time.</div>\n <div>Please <a href="javascript:void(0)" ng-click="refreshAction($event)">refresh the page</a>\n </div>\n </div>\n <div class="message" ng-if="msgType==messageConstants.TABLE_MESSAGE_TYPES.magnifySearch">\n <div class="img-magnify-glass"></div>\n <div>\n <p class="title" tabindex="0">Please input values to <br/> begin your search.</p>\n </div>\n </div>\n <div class="message loading-message" ng-if="msgType==messageConstants.TABLE_MESSAGE_TYPES.isLoading">\n <div class="img-loading-dots"></div>\n <div ng-transclude></div>\n </div>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/tableMessages/attUserMessage.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/tableMessages/attUserMessage.html",'<div class="att-user-message">\n <div ng-class="type==messageConstants.USER_MESSAGE_TYPES.error && trigger ? \'message-wrapper-error\' : \'hidden\'">\n <div class="message-icon-error"> <i class="icon-info-alert"></i> </div>\n\n <div class="message-body-wrapper">\n <div class="message-title-error" ng-if="thetitle && thetitle.length > 0"> <span ng-bind="thetitle" tabindex="0" aria-label="{{thetitle}}"></span> </div>\n <div class="message-msg" ng-bind="message" ng-if="message && message.length > 0" tabindex="0"></div>\n <div class="message-bottom">\n <div ng-transclude></div>\n </div>\n </div>\n\n </div>\n <div ng-class="type==messageConstants.USER_MESSAGE_TYPES.success && trigger ? \'message-wrapper-success\' : \'hidden\'">\n <div class="message-icon-success"> <i class="icon-included-checkmark"></i></div>\n\n <div class="message-body-wrapper">\n <div class="message-title-success" ng-if="thetitle && thetitle.length > 0" >\n <span ng-bind="thetitle" tabindex="0" aria-label="{{thetitle}}"></span>\n </div>\n <div class="message-msg" ng-bind="message" ng-if="message && message.length > 0" tabindex="0"></div>\n <div class="message-bottom">\n <div ng-transclude></div>\n </div>\n </div>\n\n </div>\n</div>\n')}]),angular.module("app/scripts/ng_js_att_tpls/tabs/floatingTabs.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/tabs/floatingTabs.html","<ul ng-class=\"{'tabsbid': size === 'large', 'tabsbid--small': size === 'small'}\">\n <li ng-repeat=\"tab in tabs\" ng-class=\"{'tabsbid__item tabsbid__item--active': isActiveTab(tab.url), 'tabsbid__item': !isActiveTab(tab.url)}\" ng-click=\"onClickTab(tab)\">\n"+' <a class="tabsbid__item-link" href="{{tab.url}}" tabindex="0" att-accessibility-click="32,13">{{tab.title}}</a>\n </li>\n</ul>')}]),angular.module("app/scripts/ng_js_att_tpls/tabs/genericTabs.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/tabs/genericTabs.html","<ul ng-class=\"{'tabsbid': size === 'large', 'tabsbid--small': size === 'small'}\">\n <li ng-repeat=\"tab in tabs\" ng-class=\"{'tabsbid__item tabsbid__item--active': isActive(tab.id), 'tabsbid__item': !isActive(tab.id),'tabs__item--active': isActive(tab.id)}\" ng-click=\"clickTab(tab)\">\n"+' <a class="tabsbid__item-link" href="{{tab.url}}" tabindex="0" att-accessibility-click="32,13">{{tab.title}}</a>\n </li>\n</ul>\n')}]),angular.module("app/scripts/ng_js_att_tpls/tabs/menuTab.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/tabs/menuTab.html",'<li class="megamenu__item" ng-mouseover="showHoverChild($event)" ng-class="{\'tabs__item--active\': menuItem.active==true && !hoverChild==true}">\n <span role="menuitem" att-accessibility-click="13,32" tabindex="0" ng-click="showChildren($event);!clickInactive||resetMenu($event)">{{tabName}}</span>\n <div ng-transclude></div>\n</li>\n')}]),angular.module("app/scripts/ng_js_att_tpls/tabs/parentmenuTab.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/tabs/parentmenuTab.html",'<div ng-class="{\'megamenu-tabs\': megaMenu,\'submenu-tabs\': !megaMenu}">\n <ul class="megamenu__items" role="presentation" ng-transclude>\n </ul>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/tabs/simplifiedTabs.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/tabs/simplifiedTabs.html",'<div class="simplified-tabs">\n<ul class="simplified-tabs__items" role="tablist">\n <li ng-repeat="tab in tabs" role="tab" class="simplified-tabs__item" ng-class="{\'tabs__item--active\': isActive(tab.id)}" ng-click="clickTab(tab)" tabindex="0" att-accessibility-click="32,13">{{tab.title}}</li>\n <li class="tabs__pointer"></li>\n</ul>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/tabs/submenuTab.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/tabs/submenuTab.html",'<li class="tabsbid__item megamenu__item" ng-class="{\'subMenuHover\': menuItem.active==true}">\n<a ng-href="{{tabUrl}}" role="menuitem" ng-if="subMenu === true" ng-mouseover="!subMenu || showChildren($event)" ng-focus="!subMenu ||showChildren($event)" tabindex="{{subMenu==\'true\'?0:-1}}" ng-click="!subMenu ||showMenuClick($event) ; subMenu ||showSubMenuClick($event)" att-accessibility-click="13,32">{{tabName}}</a>\n<a ng-href="{{tabUrl}}" role="menuitem" ng-if="!menuItem.leafNode && subMenu !== true" ng-mouseover="!subMenu || showChildren($event)" ng-focus="!subMenu ||showChildren($event)" tabindex="{{subMenu==\'true\'?0:-1}}" ng-click="!subMenu ||showMenuClick($event) ; subMenu ||showSubMenuClick($event)" att-accessibility-click="13,32">{{tabName}}</a>\n<span ng-transclude></span>\n</li>\n')}]),angular.module("app/scripts/ng_js_att_tpls/tagBadges/tagBadges.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/tagBadges/tagBadges.html","<div class=\"tags__item\" \n ng-class=\"{'tags__item--small':isSmall, \n 'tags__item--color':isColor, \n 'tags__item--cloud':!isClosable && !isColor,'active':applyActiveClass}\"\n ng-if=\"display\" \n ng-style=\"{borderColor: border_type_borderColor, background: isHighlight?'#bbb':undefined, color: isHighlight?'#444':undefined }\"\n"+' ng-mousedown="activeHighlight(true)" role="presentation" ng-mouseup="activeHighlight(false)">\n <i class="icon-filter tags__item--icon" ng-if="isIcon">&nbsp;</i>\n <i class="tags__item--color-icon" ng-if="isColor" ng-style="{backgroundColor: background_type_backgroundColor, borderColor: background_type_borderColor}"></i>\n <span class="tags__item--title" role="presentation" tabindex=0 aria-label="tag" ng-mousedown="activeHighlight(true)" ng-mouseup="activeHighlight(false)" ng-transclude></span>\n <a href="javascript:void(0)" title="Dismiss Link" class="tags__item--action" ng-click="closeMe();$event.preventDefault()" ng-if="isClosable"\n ng-style="{color: (isHighlight && \'#444\') || \'#888\' , borderLeft: (isHighlight && \'1px solid #444\')|| \'1px solid #888\' }">\n <i class="icon-erase">&nbsp;</i>\n </a>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/toggle/demoToggle.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/toggle/demoToggle.html",'<span ng-transclude></span>\n<div class="att-switch-content" hm-drag = "drag($event)" att-accessibility-click="13,32" ng-click="updateModel($event)" hm-dragstart="alert(\'hello\')" hm-dragend="drag($event)" ng-class="{\'large\' : directiveValue == \'large\'}" style="-webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">\n <div class="att-switch-onText" ng-style="" ng-class="{\'icon-included-checkmark ico\' : on === undefined,\'large\' : directiveValue == \'large\'}">{{on}}<span class="hidden-spoken">{{directiveValue}} when checked.</span></div>\n <div class="att-switch-thumb" tabindex="0" title="Toggle switch" role="checkbox" ng-class="{\'large\' : directiveValue == \'large\'}"></div>\n <div class="att-switch-offText" ng-class="{\'icon-erase ico\' : on === undefined,\'large\' : directiveValue == \'large\'}">{{off}}<span class="hidden-spoken">{{directiveValue}} when unchecked.</span></div>\n</div>\n')}]),angular.module("app/scripts/ng_js_att_tpls/typeAhead/typeAhead.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/typeAhead/typeAhead.html",'<div class="typeahead mainContainerOuter">\n <span class="message">To</span>\n <div class=\'maincontainer\' ng-click="setFocus()" ng-focus="inputActive=true" ng-class ="{\'typeahed_active\':inputActive || (lineItems.length && inputActive)}">\n <span tag-badges closable ng-repeat ="lineItem in lineItems track by $index" on-close="theMethodToBeCalled($index)" >{{lineItem}}</span>\n <input type="text" focus-me="clickFocus" ng-focus="inputActive=true" ng-model="model" ng-keydown="selected = false; selectionIndex($event)"/><br/> \n </div>\n <div ng-hide="!model.length || selected">\n <div class="filtercontainer list-scrollable" ng-show="( items | filter:model).length">\n <div class="item" ng-repeat="item in items| filter:model track by $index" ng-click="handleSelection(item[titleName],item[subtitle])" att-accessibility-click="13,32" ng-class="{active:isCurrent($index,item[titleName],item[subtitle],( items | filter:model).length)}"ng-mouseenter="setCurrent($index)">\n <span class="title" >{{item[titleName]}}</span>\n <span class="subtitle">{{item[subtitle]}}</span>\n </div> \n </div>\n </div>\n \n <div class="textAreaEmailContentDiv">\n <span class="message">Message</span>\n <textarea rows="4" cols="50" role="textarea" class="textAreaEmailContent" ng-model="emailMessage">To send \n a text, picture, or video message1 to a wireless device from your email:my message.</textarea>\n \n </div>\n \n</div>\n')}]),angular.module("app/scripts/ng_js_att_tpls/verticalSteptracker/vertical-step-tracker.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/verticalSteptracker/vertical-step-tracker.html","<li>\n <i ng-class=\"{'icon-tickets-active' : type == 'actual' && id =='Active','icon-tickets-referred' : type == 'actual' && id =='Requested Closed','icon-ticket-regular' : type == 'progress' && id =='In Progress','icon-tickets-contested' : type == 'actual' && id =='Contested','icon-tickets-returned' : type == 'actual' && id =='Deferred','icon-tickets-closed' : type == 'actual' && id =='Ready to Close','icon-tickets-cleared' : type == 'actual' && id =='Cleared'}\"></i>\n <span ng-transclude></span>\n</li>\n \n")}]),angular.module("app/scripts/ng_js_att_tpls/videoControls/photoControls.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/videoControls/photoControls.html",'<div>\n <a title="{{links.prevLink}}" aria-label="Previous Link" ng-href="{{links.prevLink}}"><i alt="previous" class="icon-arrow-left">&nbsp;</i></a>\n <span ng-transclude></span>\n <a title="{{links.nextLink}}" aria-label="Next Link" ng-href="{{links.nextLink}}"><i alt="next" class="icon-arrow-right">&nbsp;</i></a>\n</div>')}]),angular.module("app/scripts/ng_js_att_tpls/videoControls/videoControls.html",[]).run(["$templateCache",function(a){a.put("app/scripts/ng_js_att_tpls/videoControls/videoControls.html",'<div class="video-player">\n <div class="video-player__control video-player__play-button">\n <a class="video-player__button gigant-play" data-toggle-buttons="icon-play, icon-pause" data-target="i"><i class="icon-play" alt="Play/Pause Button"></i></a>\n </div>\n <div class="video-player__control video-player__track">\n\n <div class="video-player__track--inner">\n <div class="video-player__track--loaded" style="width: 75%"></div>\n <div class="video-player__track--played" style="width: 40%">\n <div class="att-tooltip att-tooltip--on att-tooltip--dark att-tooltip--above video-player__track-tooltip" ng-transclude></div>\n <div class="video-player__track-handle"></div>\n </div>\n </div>\n </div>\n <a class="video-player__time" ng-transclude></a>\n <div class="video-player__control video-player__volume_icon">\n <a class="video-player__button" data-toggle-buttons="icon-volume-mute, icon-volume-up" data-target="i"><i class="icon-volume-up" alt="Volume Button"></i></a>\n </div>\n <ul class="video-player__control video-player__volume">\n <li class="video-player__volume-bar video-player__volume-bar--full">&nbsp;</li>\n <li class="video-player__volume-bar video-player__volume-bar--full">&nbsp;</li>\n <li class="video-player__volume-bar">&nbsp;</li>\n <li class="video-player__volume-bar">&nbsp;</li>\n <li class="video-player__volume-bar">&nbsp;</li>\n </ul>\n <div class="video-player__control video-player__toggle-fullscreen-button">\n <a class="video-player__button" data-toggle-buttons="icon-full-screen, icon-normal-screen" data-target="i"><i class="icon-full-screen" alt="Full Screen Button">&nbsp;</i></a>\n </div>\n</div>')}]);
+return {}
+})(angular, window); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/base.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/base.css
new file mode 100644
index 00000000..fc4b1c3d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/base.css
@@ -0,0 +1 @@
+/*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background:0 0}a:active,a:hover{outline:0}h1{margin:.67em 0}b,strong{font-weight:700}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}button,input,select,textarea{margin:0}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}@media print{*{text-shadow:none!important;color:#000!important;background:transparent!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}@page{margin:2cm .5cm}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.table td,.table th{background-color:#fff!important}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}*,:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:62.5%;-webkit-tap-highlight-color:transparent}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.428571429;color:#333;background-color:#fff}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#428bca;text-decoration:none}a:focus,a:hover{color:#2a6496;text-decoration:underline}a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}img{vertical-align:middle}.img-responsive{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail,.thumbnail{padding:4px;line-height:1.428571429;background-color:#fff;border:1px solid #ddd;border-radius:6px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;display:inline-block;max-width:100%;height:auto}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);border:0}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:200;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}.small,small{font-size:85%}cite{font-style:normal}.text-muted{color:#999}.text-primary{color:#428bca}.text-primary:hover{color:#3071a9}.text-warning{color:#c09853}.text-warning:hover{color:#a47e3c}.text-danger{color:#b94a48}.text-danger:hover{color:#953b39}.text-success{color:#468847}.text-success:hover{color:#356635}.text-info{color:#3a87ad}.text-info:hover{color:#2d6987}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:700;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#999}h1,h2,h3{margin-top:20px;margin-bottom:10px}h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}h4,h5,h6{margin-top:10px;margin-bottom:10px}h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:36px}.h2,h2{font-size:30px}.h3,h3{font-size:24px}.h4,h4{font-size:18px}.h5,h5{font-size:14px}.h6,h6{font-size:12px}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ol,ul{margin-top:0;margin-bottom:10px}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}.list-inline,.list-unstyled{padding-left:0;list-style:none}.list-inline>li{display:inline-block;padding-left:5px;padding-right:5px}.list-inline>li:first-child{padding-left:0}dl{margin-bottom:20px}dd,dt{line-height:1.428571429}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}.dl-horizontal dd:after,.dl-horizontal dd:before{content:" ";display:table}.dl-horizontal dd:after{clear:both}}abbr[data-original-title],abbr[title]{cursor:help;border-bottom:1px dotted #999}abbr.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;border-left:5px solid #eee}blockquote p{font-size:17.5px;font-weight:300;line-height:1.25}blockquote p:last-child{margin-bottom:0}blockquote small{display:block;line-height:1.428571429;color:#999}blockquote small:before{content:'\2014 \00A0'}blockquote.pull-right{padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0}blockquote.pull-right .small,blockquote.pull-right p,blockquote.pull-right small{text-align:right}blockquote.pull-right .small:before,blockquote.pull-right small:before{content:''}blockquote.pull-right .small:after,blockquote.pull-right small:after{content:'\00A0 \2014'}blockquote:after,blockquote:before{content:""}address{margin-bottom:20px;font-style:normal;line-height:1.428571429}code,kbd,pre,samp{font-family:Monaco,Menlo,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;white-space:nowrap;border-radius:6px}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.428571429;word-break:break-all;word-wrap:break-word;color:#333;background-color:#f5f5f5;border:1px solid #ccc;border-radius:6px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{margin-right:auto;margin-left:auto;padding-left:10px;padding-right:10px}.container:after,.container:before{content:" ";display:table}.container:after{clear:both}.row{margin-left:-10px;margin-right:-10px}.row:after,.row:before{content:" ";display:table}.row:after{clear:both}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-13,.col-lg-14,.col-lg-15,.col-lg-16,.col-lg-17,.col-lg-18,.col-lg-19,.col-lg-2,.col-lg-20,.col-lg-21,.col-lg-22,.col-lg-23,.col-lg-24,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-13,.col-md-14,.col-md-15,.col-md-16,.col-md-17,.col-md-18,.col-md-19,.col-md-2,.col-md-20,.col-md-21,.col-md-22,.col-md-23,.col-md-24,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-13,.col-sm-14,.col-sm-15,.col-sm-16,.col-sm-17,.col-sm-18,.col-sm-19,.col-sm-2,.col-sm-20,.col-sm-21,.col-sm-22,.col-sm-23,.col-sm-24,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-13,.col-xs-14,.col-xs-15,.col-xs-16,.col-xs-17,.col-xs-18,.col-xs-19,.col-xs-2,.col-xs-20,.col-xs-21,.col-xs-22,.col-xs-23,.col-xs-24,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-left:10px;padding-right:10px}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-13,.col-xs-14,.col-xs-15,.col-xs-16,.col-xs-17,.col-xs-18,.col-xs-19,.col-xs-2,.col-xs-20,.col-xs-21,.col-xs-22,.col-xs-23,.col-xs-24,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-1{width:4.1666666667%}.col-xs-2{width:8.3333333333%}.col-xs-3{width:12.5%}.col-xs-4{width:16.6666666667%}.col-xs-5{width:20.8333333333%}.col-xs-6{width:25%}.col-xs-7{width:29.1666666667%}.col-xs-8{width:33.3333333333%}.col-xs-9{width:37.5%}.col-xs-10{width:41.6666666667%}.col-xs-11{width:45.8333333333%}.col-xs-12{width:50%}.col-xs-13{width:54.1666666667%}.col-xs-14{width:58.3333333333%}.col-xs-15{width:62.5%}.col-xs-16{width:66.6666666667%}.col-xs-17{width:70.8333333333%}.col-xs-18{width:75%}.col-xs-19{width:79.1666666667%}.col-xs-20{width:83.3333333333%}.col-xs-21{width:87.5%}.col-xs-22{width:91.6666666667%}.col-xs-23{width:95.8333333333%}.col-xs-24{width:100%}.col-xs-pull-0{right:0}.col-xs-pull-1{right:4.1666666667%}.col-xs-pull-2{right:8.3333333333%}.col-xs-pull-3{right:12.5%}.col-xs-pull-4{right:16.6666666667%}.col-xs-pull-5{right:20.8333333333%}.col-xs-pull-6{right:25%}.col-xs-pull-7{right:29.1666666667%}.col-xs-pull-8{right:33.3333333333%}.col-xs-pull-9{right:37.5%}.col-xs-pull-10{right:41.6666666667%}.col-xs-pull-11{right:45.8333333333%}.col-xs-pull-12{right:50%}.col-xs-pull-13{right:54.1666666667%}.col-xs-pull-14{right:58.3333333333%}.col-xs-pull-15{right:62.5%}.col-xs-pull-16{right:66.6666666667%}.col-xs-pull-17{right:70.8333333333%}.col-xs-pull-18{right:75%}.col-xs-pull-19{right:79.1666666667%}.col-xs-pull-20{right:83.3333333333%}.col-xs-pull-21{right:87.5%}.col-xs-pull-22{right:91.6666666667%}.col-xs-pull-23{right:95.8333333333%}.col-xs-pull-24{right:100%}.col-xs-push-0{left:0}.col-xs-push-1{left:4.1666666667%}.col-xs-push-2{left:8.3333333333%}.col-xs-push-3{left:12.5%}.col-xs-push-4{left:16.6666666667%}.col-xs-push-5{left:20.8333333333%}.col-xs-push-6{left:25%}.col-xs-push-7{left:29.1666666667%}.col-xs-push-8{left:33.3333333333%}.col-xs-push-9{left:37.5%}.col-xs-push-10{left:41.6666666667%}.col-xs-push-11{left:45.8333333333%}.col-xs-push-12{left:50%}.col-xs-push-13{left:54.1666666667%}.col-xs-push-14{left:58.3333333333%}.col-xs-push-15{left:62.5%}.col-xs-push-16{left:66.6666666667%}.col-xs-push-17{left:70.8333333333%}.col-xs-push-18{left:75%}.col-xs-push-19{left:79.1666666667%}.col-xs-push-20{left:83.3333333333%}.col-xs-push-21{left:87.5%}.col-xs-push-22{left:91.6666666667%}.col-xs-push-23{left:95.8333333333%}.col-xs-push-24{left:100%}.col-xs-offset-0{margin-left:0}.col-xs-offset-1{margin-left:4.1666666667%}.col-xs-offset-2{margin-left:8.3333333333%}.col-xs-offset-3{margin-left:12.5%}.col-xs-offset-4{margin-left:16.6666666667%}.col-xs-offset-5{margin-left:20.8333333333%}.col-xs-offset-6{margin-left:25%}.col-xs-offset-7{margin-left:29.1666666667%}.col-xs-offset-8{margin-left:33.3333333333%}.col-xs-offset-9{margin-left:37.5%}.col-xs-offset-10{margin-left:41.6666666667%}.col-xs-offset-11{margin-left:45.8333333333%}.col-xs-offset-12{margin-left:50%}.col-xs-offset-13{margin-left:54.1666666667%}.col-xs-offset-14{margin-left:58.3333333333%}.col-xs-offset-15{margin-left:62.5%}.col-xs-offset-16{margin-left:66.6666666667%}.col-xs-offset-17{margin-left:70.8333333333%}.col-xs-offset-18{margin-left:75%}.col-xs-offset-19{margin-left:79.1666666667%}.col-xs-offset-20{margin-left:83.3333333333%}.col-xs-offset-21{margin-left:87.5%}.col-xs-offset-22{margin-left:91.6666666667%}.col-xs-offset-23{margin-left:95.8333333333%}.col-xs-offset-24{margin-left:100%}@media (min-width:768px){.container{width:740px}.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-13,.col-sm-14,.col-sm-15,.col-sm-16,.col-sm-17,.col-sm-18,.col-sm-19,.col-sm-2,.col-sm-20,.col-sm-21,.col-sm-22,.col-sm-23,.col-sm-24,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-1{width:4.1666666667%}.col-sm-2{width:8.3333333333%}.col-sm-3{width:12.5%}.col-sm-4{width:16.6666666667%}.col-sm-5{width:20.8333333333%}.col-sm-6{width:25%}.col-sm-7{width:29.1666666667%}.col-sm-8{width:33.3333333333%}.col-sm-9{width:37.5%}.col-sm-10{width:41.6666666667%}.col-sm-11{width:45.8333333333%}.col-sm-12{width:50%}.col-sm-13{width:54.1666666667%}.col-sm-14{width:58.3333333333%}.col-sm-15{width:62.5%}.col-sm-16{width:66.6666666667%}.col-sm-17{width:70.8333333333%}.col-sm-18{width:75%}.col-sm-19{width:79.1666666667%}.col-sm-20{width:83.3333333333%}.col-sm-21{width:87.5%}.col-sm-22{width:91.6666666667%}.col-sm-23{width:95.8333333333%}.col-sm-24{width:100%}.col-sm-pull-0{right:0}.col-sm-pull-1{right:4.1666666667%}.col-sm-pull-2{right:8.3333333333%}.col-sm-pull-3{right:12.5%}.col-sm-pull-4{right:16.6666666667%}.col-sm-pull-5{right:20.8333333333%}.col-sm-pull-6{right:25%}.col-sm-pull-7{right:29.1666666667%}.col-sm-pull-8{right:33.3333333333%}.col-sm-pull-9{right:37.5%}.col-sm-pull-10{right:41.6666666667%}.col-sm-pull-11{right:45.8333333333%}.col-sm-pull-12{right:50%}.col-sm-pull-13{right:54.1666666667%}.col-sm-pull-14{right:58.3333333333%}.col-sm-pull-15{right:62.5%}.col-sm-pull-16{right:66.6666666667%}.col-sm-pull-17{right:70.8333333333%}.col-sm-pull-18{right:75%}.col-sm-pull-19{right:79.1666666667%}.col-sm-pull-20{right:83.3333333333%}.col-sm-pull-21{right:87.5%}.col-sm-pull-22{right:91.6666666667%}.col-sm-pull-23{right:95.8333333333%}.col-sm-pull-24{right:100%}.col-sm-push-0{left:0}.col-sm-push-1{left:4.1666666667%}.col-sm-push-2{left:8.3333333333%}.col-sm-push-3{left:12.5%}.col-sm-push-4{left:16.6666666667%}.col-sm-push-5{left:20.8333333333%}.col-sm-push-6{left:25%}.col-sm-push-7{left:29.1666666667%}.col-sm-push-8{left:33.3333333333%}.col-sm-push-9{left:37.5%}.col-sm-push-10{left:41.6666666667%}.col-sm-push-11{left:45.8333333333%}.col-sm-push-12{left:50%}.col-sm-push-13{left:54.1666666667%}.col-sm-push-14{left:58.3333333333%}.col-sm-push-15{left:62.5%}.col-sm-push-16{left:66.6666666667%}.col-sm-push-17{left:70.8333333333%}.col-sm-push-18{left:75%}.col-sm-push-19{left:79.1666666667%}.col-sm-push-20{left:83.3333333333%}.col-sm-push-21{left:87.5%}.col-sm-push-22{left:91.6666666667%}.col-sm-push-23{left:95.8333333333%}.col-sm-push-24{left:100%}.col-sm-offset-0{margin-left:0}.col-sm-offset-1{margin-left:4.1666666667%}.col-sm-offset-2{margin-left:8.3333333333%}.col-sm-offset-3{margin-left:12.5%}.col-sm-offset-4{margin-left:16.6666666667%}.col-sm-offset-5{margin-left:20.8333333333%}.col-sm-offset-6{margin-left:25%}.col-sm-offset-7{margin-left:29.1666666667%}.col-sm-offset-8{margin-left:33.3333333333%}.col-sm-offset-9{margin-left:37.5%}.col-sm-offset-10{margin-left:41.6666666667%}.col-sm-offset-11{margin-left:45.8333333333%}.col-sm-offset-12{margin-left:50%}.col-sm-offset-13{margin-left:54.1666666667%}.col-sm-offset-14{margin-left:58.3333333333%}.col-sm-offset-15{margin-left:62.5%}.col-sm-offset-16{margin-left:66.6666666667%}.col-sm-offset-17{margin-left:70.8333333333%}.col-sm-offset-18{margin-left:75%}.col-sm-offset-19{margin-left:79.1666666667%}.col-sm-offset-20{margin-left:83.3333333333%}.col-sm-offset-21{margin-left:87.5%}.col-sm-offset-22{margin-left:91.6666666667%}.col-sm-offset-23{margin-left:95.8333333333%}.col-sm-offset-24{margin-left:100%}}@media (min-width:992px){.container{width:980px}.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-13,.col-md-14,.col-md-15,.col-md-16,.col-md-17,.col-md-18,.col-md-19,.col-md-2,.col-md-20,.col-md-21,.col-md-22,.col-md-23,.col-md-24,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-1{width:4.1666666667%}.col-md-2{width:8.3333333333%}.col-md-3{width:12.5%}.col-md-4{width:16.6666666667%}.col-md-5{width:20.8333333333%}.col-md-6{width:25%}.col-md-7{width:29.1666666667%}.col-md-8{width:33.3333333333%}.col-md-9{width:37.5%}.col-md-10{width:41.6666666667%}.col-md-11{width:45.8333333333%}.col-md-12{width:50%}.col-md-13{width:54.1666666667%}.col-md-14{width:58.3333333333%}.col-md-15{width:62.5%}.col-md-16{width:66.6666666667%}.col-md-17{width:70.8333333333%}.col-md-18{width:75%}.col-md-19{width:79.1666666667%}.col-md-20{width:83.3333333333%}.col-md-21{width:87.5%}.col-md-22{width:91.6666666667%}.col-md-23{width:95.8333333333%}.col-md-24{width:100%}.col-md-pull-0{right:0}.col-md-pull-1{right:4.1666666667%}.col-md-pull-2{right:8.3333333333%}.col-md-pull-3{right:12.5%}.col-md-pull-4{right:16.6666666667%}.col-md-pull-5{right:20.8333333333%}.col-md-pull-6{right:25%}.col-md-pull-7{right:29.1666666667%}.col-md-pull-8{right:33.3333333333%}.col-md-pull-9{right:37.5%}.col-md-pull-10{right:41.6666666667%}.col-md-pull-11{right:45.8333333333%}.col-md-pull-12{right:50%}.col-md-pull-13{right:54.1666666667%}.col-md-pull-14{right:58.3333333333%}.col-md-pull-15{right:62.5%}.col-md-pull-16{right:66.6666666667%}.col-md-pull-17{right:70.8333333333%}.col-md-pull-18{right:75%}.col-md-pull-19{right:79.1666666667%}.col-md-pull-20{right:83.3333333333%}.col-md-pull-21{right:87.5%}.col-md-pull-22{right:91.6666666667%}.col-md-pull-23{right:95.8333333333%}.col-md-pull-24{right:100%}.col-md-push-0{left:0}.col-md-push-1{left:4.1666666667%}.col-md-push-2{left:8.3333333333%}.col-md-push-3{left:12.5%}.col-md-push-4{left:16.6666666667%}.col-md-push-5{left:20.8333333333%}.col-md-push-6{left:25%}.col-md-push-7{left:29.1666666667%}.col-md-push-8{left:33.3333333333%}.col-md-push-9{left:37.5%}.col-md-push-10{left:41.6666666667%}.col-md-push-11{left:45.8333333333%}.col-md-push-12{left:50%}.col-md-push-13{left:54.1666666667%}.col-md-push-14{left:58.3333333333%}.col-md-push-15{left:62.5%}.col-md-push-16{left:66.6666666667%}.col-md-push-17{left:70.8333333333%}.col-md-push-18{left:75%}.col-md-push-19{left:79.1666666667%}.col-md-push-20{left:83.3333333333%}.col-md-push-21{left:87.5%}.col-md-push-22{left:91.6666666667%}.col-md-push-23{left:95.8333333333%}.col-md-push-24{left:100%}.col-md-offset-0{margin-left:0}.col-md-offset-1{margin-left:4.1666666667%}.col-md-offset-2{margin-left:8.3333333333%}.col-md-offset-3{margin-left:12.5%}.col-md-offset-4{margin-left:16.6666666667%}.col-md-offset-5{margin-left:20.8333333333%}.col-md-offset-6{margin-left:25%}.col-md-offset-7{margin-left:29.1666666667%}.col-md-offset-8{margin-left:33.3333333333%}.col-md-offset-9{margin-left:37.5%}.col-md-offset-10{margin-left:41.6666666667%}.col-md-offset-11{margin-left:45.8333333333%}.col-md-offset-12{margin-left:50%}.col-md-offset-13{margin-left:54.1666666667%}.col-md-offset-14{margin-left:58.3333333333%}.col-md-offset-15{margin-left:62.5%}.col-md-offset-16{margin-left:66.6666666667%}.col-md-offset-17{margin-left:70.8333333333%}.col-md-offset-18{margin-left:75%}.col-md-offset-19{margin-left:79.1666666667%}.col-md-offset-20{margin-left:83.3333333333%}.col-md-offset-21{margin-left:87.5%}.col-md-offset-22{margin-left:91.6666666667%}.col-md-offset-23{margin-left:95.8333333333%}.col-md-offset-24{margin-left:100%}}@media (min-width:768px){.container{width:980px}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-13,.col-lg-14,.col-lg-15,.col-lg-16,.col-lg-17,.col-lg-18,.col-lg-19,.col-lg-2,.col-lg-20,.col-lg-21,.col-lg-22,.col-lg-23,.col-lg-24,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-1{width:4.1666666667%}.col-lg-2{width:8.3333333333%}.col-lg-3{width:12.5%}.col-lg-4{width:16.6666666667%}.col-lg-5{width:20.8333333333%}.col-lg-6{width:25%}.col-lg-7{width:29.1666666667%}.col-lg-8{width:33.3333333333%}.col-lg-9{width:37.5%}.col-lg-10{width:41.6666666667%}.col-lg-11{width:45.8333333333%}.col-lg-12{width:50%}.col-lg-13{width:54.1666666667%}.col-lg-14{width:58.3333333333%}.col-lg-15{width:62.5%}.col-lg-16{width:66.6666666667%}.col-lg-17{width:70.8333333333%}.col-lg-18{width:75%}.col-lg-19{width:79.1666666667%}.col-lg-20{width:83.3333333333%}.col-lg-21{width:87.5%}.col-lg-22{width:91.6666666667%}.col-lg-23{width:95.8333333333%}.col-lg-24{width:100%}.col-lg-pull-0{right:0}.col-lg-pull-1{right:4.1666666667%}.col-lg-pull-2{right:8.3333333333%}.col-lg-pull-3{right:12.5%}.col-lg-pull-4{right:16.6666666667%}.col-lg-pull-5{right:20.8333333333%}.col-lg-pull-6{right:25%}.col-lg-pull-7{right:29.1666666667%}.col-lg-pull-8{right:33.3333333333%}.col-lg-pull-9{right:37.5%}.col-lg-pull-10{right:41.6666666667%}.col-lg-pull-11{right:45.8333333333%}.col-lg-pull-12{right:50%}.col-lg-pull-13{right:54.1666666667%}.col-lg-pull-14{right:58.3333333333%}.col-lg-pull-15{right:62.5%}.col-lg-pull-16{right:66.6666666667%}.col-lg-pull-17{right:70.8333333333%}.col-lg-pull-18{right:75%}.col-lg-pull-19{right:79.1666666667%}.col-lg-pull-20{right:83.3333333333%}.col-lg-pull-21{right:87.5%}.col-lg-pull-22{right:91.6666666667%}.col-lg-pull-23{right:95.8333333333%}.col-lg-pull-24{right:100%}.col-lg-push-0{left:0}.col-lg-push-1{left:4.1666666667%}.col-lg-push-2{left:8.3333333333%}.col-lg-push-3{left:12.5%}.col-lg-push-4{left:16.6666666667%}.col-lg-push-5{left:20.8333333333%}.col-lg-push-6{left:25%}.col-lg-push-7{left:29.1666666667%}.col-lg-push-8{left:33.3333333333%}.col-lg-push-9{left:37.5%}.col-lg-push-10{left:41.6666666667%}.col-lg-push-11{left:45.8333333333%}.col-lg-push-12{left:50%}.col-lg-push-13{left:54.1666666667%}.col-lg-push-14{left:58.3333333333%}.col-lg-push-15{left:62.5%}.col-lg-push-16{left:66.6666666667%}.col-lg-push-17{left:70.8333333333%}.col-lg-push-18{left:75%}.col-lg-push-19{left:79.1666666667%}.col-lg-push-20{left:83.3333333333%}.col-lg-push-21{left:87.5%}.col-lg-push-22{left:91.6666666667%}.col-lg-push-23{left:95.8333333333%}.col-lg-push-24{left:100%}.col-lg-offset-0{margin-left:0}.col-lg-offset-1{margin-left:4.1666666667%}.col-lg-offset-2{margin-left:8.3333333333%}.col-lg-offset-3{margin-left:12.5%}.col-lg-offset-4{margin-left:16.6666666667%}.col-lg-offset-5{margin-left:20.8333333333%}.col-lg-offset-6{margin-left:25%}.col-lg-offset-7{margin-left:29.1666666667%}.col-lg-offset-8{margin-left:33.3333333333%}.col-lg-offset-9{margin-left:37.5%}.col-lg-offset-10{margin-left:41.6666666667%}.col-lg-offset-11{margin-left:45.8333333333%}.col-lg-offset-12{margin-left:50%}.col-lg-offset-13{margin-left:54.1666666667%}.col-lg-offset-14{margin-left:58.3333333333%}.col-lg-offset-15{margin-left:62.5%}.col-lg-offset-16{margin-left:66.6666666667%}.col-lg-offset-17{margin-left:70.8333333333%}.col-lg-offset-18{margin-left:75%}.col-lg-offset-19{margin-left:79.1666666667%}.col-lg-offset-20{margin-left:83.3333333333%}.col-lg-offset-21{margin-left:87.5%}.col-lg-offset-22{margin-left:91.6666666667%}.col-lg-offset-23{margin-left:95.8333333333%}.col-lg-offset-24{margin-left:100%}}table{max-width:100%;background-color:transparent}th{text-align:left}.table{width:100%;margin-bottom:20px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.428571429;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered,.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#f5f5f5}table col[class*=col-]{float:none;display:table-column}table td[class*=col-],table th[class*=col-]{float:none;display:table-cell}.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}@media (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;overflow-x:scroll;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd;-webkit-overflow-scrolling:touch}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset{padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type=file]{display:block}select[multiple],select[size]{height:auto}select optgroup{font-size:inherit;font-style:inherit;font-family:inherit}input[type=checkbox]:focus,input[type=file]:focus,input[type=radio]:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}output{display:block;padding-top:7px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:6px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control:-moz-placeholder{color:#999}.form-control::-moz-placeholder{color:#999}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee}textarea.form-control{height:auto}.form-group{margin-bottom:15px}.checkbox,.radio{display:block;min-height:20px;margin-top:10px;margin-bottom:10px;padding-left:20px;vertical-align:middle}.checkbox label,.radio label{display:inline;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{float:left;margin-left:-20px}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:400;cursor:pointer}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}.checkbox-inline[disabled],.checkbox[disabled],.radio-inline[disabled],.radio[disabled],fieldset[disabled] .checkbox,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio,fieldset[disabled] .radio-inline,fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox][disabled],input[type=radio][disabled]{cursor:not-allowed}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn,.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.input-group-sm>.input-group-btn>select.btn,.input-group-sm>select.form-control,.input-group-sm>select.input-group-addon,select.input-sm{height:30px;line-height:30px}.input-group-sm>.input-group-btn>textarea.btn,.input-group-sm>textarea.form-control,.input-group-sm>textarea.input-group-addon,textarea.input-sm{height:auto}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn,.input-lg{height:45px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.input-group-lg>.input-group-btn>select.btn,.input-group-lg>select.form-control,.input-group-lg>select.input-group-addon,select.input-lg{height:45px;line-height:45px}.input-group-lg>.input-group-btn>textarea.btn,.input-group-lg>textarea.form-control,.input-group-lg>textarea.input-group-addon,textarea.input-lg{height:auto}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline{color:#c09853}.has-warning .form-control{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #dbc59e}.has-warning .input-group-addon{color:#c09853;border-color:#c09853;background-color:#fcf8e3}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .help-block,.has-error .radio,.has-error .radio-inline{color:#b94a48}.has-error .form-control{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #d59392}.has-error .input-group-addon{color:#b94a48;border-color:#b94a48;background-color:#f2dede}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .help-block,.has-success .radio,.has-success .radio-inline{color:#468847}.has-success .form-control{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #7aba7b}.has-success .input-group-addon{color:#468847;border-color:#468847;background-color:#dff0d8}.form-control-static{margin-bottom:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group,.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control,.navbar-form .form-control{display:inline-block}.form-inline .checkbox,.form-inline .radio,.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio],.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{float:none;margin-left:0}}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .control-label,.form-horizontal .radio,.form-horizontal .radio-inline{margin-top:0;margin-bottom:0;padding-top:7px}.form-horizontal .form-group{margin-left:-10px;margin-right:-10px}.form-horizontal .form-group:after,.form-horizontal .form-group:before{content:" ";display:table}.form-horizontal .form-group:after{clear:both}.form-horizontal .form-control-static{padding-top:7px}@media (min-width:768px){.form-horizontal .control-label{text-align:right}}.btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;cursor:pointer;background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.428571429;border-radius:6px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{outline:0;background-image:none;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;pointer-events:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.active,.btn-default:active,.btn-default:focus,.btn-default:hover,.open .btn-default.dropdown-toggle{color:#333;background-color:#ebebeb;border-color:#adadad}.btn-default.active,.btn-default:active,.open .btn-default.dropdown-toggle{background-image:none}.btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled:active,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled]:active,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default.active,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.btn-primary.active,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.open .btn-primary.dropdown-toggle{color:#fff;background-color:#3276b1;border-color:#285e8e}.btn-primary.active,.btn-primary:active,.open .btn-primary.dropdown-toggle{background-image:none}.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled:active,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled]:active,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary.active,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#428bca;border-color:#357ebd}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.active,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.open .btn-warning.dropdown-toggle{color:#fff;background-color:#ed9c28;border-color:#d58512}.btn-warning.active,.btn-warning:active,.open .btn-warning.dropdown-toggle{background-image:none}.btn-warning.disabled,.btn-warning.disabled.active,.btn-warning.disabled:active,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled],.btn-warning[disabled].active,.btn-warning[disabled]:active,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning,fieldset[disabled] .btn-warning.active,fieldset[disabled] .btn-warning:active,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.active,.btn-danger:active,.btn-danger:focus,.btn-danger:hover,.open .btn-danger.dropdown-toggle{color:#fff;background-color:#d2322d;border-color:#ac2925}.btn-danger.active,.btn-danger:active,.open .btn-danger.dropdown-toggle{background-image:none}.btn-danger.disabled,.btn-danger.disabled.active,.btn-danger.disabled:active,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled],.btn-danger[disabled].active,.btn-danger[disabled]:active,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger,fieldset[disabled] .btn-danger.active,fieldset[disabled] .btn-danger:active,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.active,.btn-success:active,.btn-success:focus,.btn-success:hover,.open .btn-success.dropdown-toggle{color:#fff;background-color:#47a447;border-color:#398439}.btn-success.active,.btn-success:active,.open .btn-success.dropdown-toggle{background-image:none}.btn-success.disabled,.btn-success.disabled.active,.btn-success.disabled:active,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled],.btn-success[disabled].active,.btn-success[disabled]:active,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success,fieldset[disabled] .btn-success.active,fieldset[disabled] .btn-success:active,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.active,.btn-info:active,.btn-info:focus,.btn-info:hover,.open .btn-info.dropdown-toggle{color:#fff;background-color:#39b3d7;border-color:#269abc}.btn-info.active,.btn-info:active,.open .btn-info.dropdown-toggle{background-image:none}.btn-info.disabled,.btn-info.disabled.active,.btn-info.disabled:active,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled],.btn-info[disabled].active,.btn-info[disabled]:active,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info,fieldset[disabled] .btn-info.active,fieldset[disabled] .btn-info:active,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-link{color:#428bca;font-weight:400;cursor:pointer;border-radius:0}.btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#2a6496;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#999;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-group-sm>.btn,.btn-group-xs>.btn,.btn-sm,.btn-xs{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;transition:height .35s ease}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid #000;border-right:4px solid transparent;border-left:4px solid transparent;border-bottom:0 dotted}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;font-size:14px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:6px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175);background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.428571429;color:#333;white-space:nowrap}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{text-decoration:none;color:#262626;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;outline:0;background-color:#428bca}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#999}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);cursor:not-allowed}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.428571429;color:#999}.dropdown-backdrop{position:fixed;left:0;right:0;bottom:0;top:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0 dotted;border-bottom:4px solid #000;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}}.btn-default .caret{border-top-color:#333}.btn-danger .caret,.btn-info .caret,.btn-primary .caret,.btn-success .caret,.btn-warning .caret{border-top-color:#fff}.dropup .btn-default .caret{border-bottom-color:#333}.dropup .btn-danger .caret,.dropup .btn-info .caret,.dropup .btn-primary .caret,.dropup .btn-success .caret,.dropup .btn-warning .caret{border-bottom-color:#fff}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group-vertical>.btn:focus,.btn-group>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar:after,.btn-toolbar:before{content:" ";display:table}.btn-toolbar:after{clear:both}.btn-toolbar .btn-group{float:left}.btn-toolbar>.btn+.btn,.btn-toolbar>.btn+.btn-group,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn-group+.btn-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-bottom-right-radius:0;border-top-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px}.btn-group-lg.btn-group>.btn+.dropdown-toggle,.btn-group>.btn-lg+.dropdown-toggle{padding-left:12px;padding-right:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-group-lg>.btn .caret,.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-group-lg>.btn .caret,.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before{content:" ";display:table}.btn-group-vertical>.btn-group:after{clear:both}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:6px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-bottom-left-radius:6px;border-top-right-radius:0;border-top-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child>.btn:last-child,.btn-group-vertical>.btn-group:first-child>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified .btn{float:none;display:table-cell;width:1%}[data-toggle=buttons]>.btn>input[type=checkbox],[data-toggle=buttons]>.btn>input[type=radio]{display:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group.col{float:none;padding-left:0;padding-right:0}.input-group .form-control{width:100%;margin-bottom:0}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:6px}.input-group-addon.input-sm,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.input-group-addon.btn{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.input-group-addon.btn{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.dropdown-toggle{border-bottom-left-radius:0;border-top-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;white-space:nowrap}.input-group-btn:first-child>.btn{margin-right:-1px}.input-group-btn:last-child>.btn{margin-left:-1px}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-4px}.input-group-btn>.btn:active,.input-group-btn>.btn:hover{z-index:2}.nav{margin-bottom:0;padding-left:0;list-style:none}.nav:after,.nav:before{content:" ";display:table}.nav:after{clear:both}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#999}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#999;text-decoration:none;background-color:transparent;cursor:not-allowed}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#428bca}.nav .open>a .caret,.nav .open>a:focus .caret,.nav .open>a:hover .caret{border-top-color:#2a6496;border-bottom-color:#2a6496}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.428571429;border:1px solid transparent;border-radius:6px 6px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:6px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#428bca}.nav-pills>li.active>a .caret,.nav-pills>li.active>a:focus .caret,.nav-pills>li.active>a:hover .caret{border-top-color:#fff;border-bottom-color:#fff}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified,.nav-tabs.nav-justified{width:100%}.nav-justified>li,.nav-tabs.nav-justified>li{float:none}.nav-justified>li>a,.nav-tabs.nav-justified>li>a{text-align:center;margin-bottom:5px}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li,.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a,.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified,.nav-tabs.nav-justified{border-bottom:0}.nav-tabs-justified>li>a,.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:6px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a,.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:6px 6px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav .caret{border-top-color:#428bca;border-bottom-color:#428bca}.nav a:hover .caret{border-top-color:#2a6496;border-bottom-color:#2a6496}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-right-radius:0;border-top-left-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}.navbar:after,.navbar:before{content:" ";display:table}.navbar:after{clear:both}@media (min-width:768px){.navbar{border-radius:6px}}.navbar-header:after,.navbar-header:before{content:" ";display:table}.navbar-header:after{clear:both}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{max-height:340px;overflow-x:visible;padding-right:10px;padding-left:10px;border-top:1px solid transparent;box-shadow:inset 0 1px 0 rgba(255,255,255,.1);-webkit-overflow-scrolling:touch}.navbar-collapse:after,.navbar-collapse:before{content:" ";display:table}.navbar-collapse:after{clear:both}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:auto}.navbar-collapse .navbar-nav.navbar-left:first-child{margin-left:-10px}.navbar-collapse .navbar-nav.navbar-right:last-child{margin-right:-10px}.navbar-collapse .navbar-text:last-child{margin-right:0}}.container>.navbar-collapse,.container>.navbar-header{margin-right:-10px;margin-left:-10px}@media (min-width:768px){.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-bottom,.navbar-fixed-top{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;padding:15px 10px;font-size:18px;line-height:20px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}@media (min-width:768px){.navbar>.container .navbar-brand{margin-left:-10px}}.navbar-toggle{position:relative;float:right;margin-right:10px;padding:9px 10px;margin-top:8px;margin-bottom:8px;background-color:transparent;border:1px solid transparent;border-radius:6px}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -10px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important}}.navbar-form{margin-left:-10px;margin-right:-10px;padding:10px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);margin-top:8px;margin-bottom:8px}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}}@media (min-width:768px){.navbar-form{width:auto;border:0;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-right-radius:0;border-top-left-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-nav.pull-right>li>.dropdown-menu,.navbar-nav>li>.dropdown-menu.pull-right{left:auto;right:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-text{float:left;margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{margin-left:10px;margin-right:10px}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-nav>li>a,.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#ccc}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.dropdown>a:focus .caret,.navbar-default .navbar-nav>.dropdown>a:hover .caret{border-top-color:#333;border-bottom-color:#333}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{background-color:#e7e7e7;color:#555}.navbar-default .navbar-nav>.open>a .caret,.navbar-default .navbar-nav>.open>a:focus .caret,.navbar-default .navbar-nav>.open>a:hover .caret{border-top-color:#555;border-bottom-color:#555}.navbar-default .navbar-nav>.dropdown>a .caret{border-top-color:#777;border-bottom-color:#777}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-inverse{background-color:#222;border-color:#090909}.navbar-inverse .navbar-brand{color:#999}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>li>a,.navbar-inverse .navbar-text{color:#999}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#090909}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{background-color:#090909;color:#fff}.navbar-inverse .navbar-nav>.dropdown>a:hover .caret{border-top-color:#fff;border-bottom-color:#fff}.navbar-inverse .navbar-nav>.dropdown>a .caret{border-top-color:#999;border-bottom-color:#999}.navbar-inverse .navbar-nav>.open>a .caret,.navbar-inverse .navbar-nav>.open>a:focus .caret,.navbar-inverse .navbar-nav>.open>a:hover .caret{border-top-color:#fff;border-bottom-color:#fff}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#090909}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#999}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#090909}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#999}.navbar-inverse .navbar-link:hover{color:#fff}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:6px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{content:"/\00a0";padding:0 5px;color:#ccc}.breadcrumb>.active{color:#999}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:6px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;line-height:1.428571429;text-decoration:none;background-color:#fff;border:1px solid #ddd;margin-left:-1px}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-bottom-left-radius:6px;border-top-left-radius:6px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-bottom-right-radius:6px;border-top-right-radius:6px}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{background-color:#eee}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca;cursor:default}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#999;background-color:#fff;border-color:#ddd;cursor:not-allowed}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-bottom-left-radius:6px;border-top-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-bottom-right-radius:6px;border-top-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-bottom-left-radius:3px;border-top-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-bottom-right-radius:3px;border-top-right-radius:3px}.pager{padding-left:0;margin:20px 0;list-style:none;text-align:center}.pager:after,.pager:before{content:" ";display:table}.pager:after{clear:both}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#999;background-color:#fff;cursor:not-allowed}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}.label[href]:focus,.label[href]:hover{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.label-default{background-color:#999}.label-default[href]:focus,.label-default[href]:hover{background-color:gray}.label-primary{background-color:#428bca}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#3071a9}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;color:#fff;line-height:1;vertical-align:baseline;white-space:nowrap;text-align:center;background-color:#999;border-radius:10px}.badge:empty{display:none}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.btn .badge{position:relative;top:-1px}.nav-pills>.active>a>.badge,a.list-group-item.active>.badge{color:#428bca;background-color:#fff}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px;margin-bottom:30px;font-size:21px;font-weight:200;line-height:2.1428571435;color:inherit;background-color:#eee}.jumbotron h1{line-height:1;color:inherit}.jumbotron p{line-height:1.4}.container .jumbotron{border-radius:6px}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron{padding-left:60px;padding-right:60px}.jumbotron h1{font-size:63px}}.thumbnail{display:block;margin-bottom:20px}.thumbnail>img{display:block;max-width:100%;height:auto;margin-left:auto;margin-right:auto}.thumbnail .caption{padding:9px;color:#333}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#428bca}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:6px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable{padding-right:35px}.alert-dismissable .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#468847}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#356635}.alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#3a87ad}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#2d6987}.alert-warning{background-color:#fcf8e3;border-color:#faebcc;color:#c09853}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#a47e3c}.alert-danger{background-color:#f2dede;border-color:#ebccd1;color:#b94a48}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#953b39}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-moz-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:0 0}to{background-position:40px 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{overflow:hidden;height:20px;margin-bottom:20px;background-color:#f5f5f5;border-radius:6px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#428bca;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(.25,rgba(255,255,255,.15)),color-stop(.25,transparent),color-stop(.5,transparent),color-stop(.5,rgba(255,255,255,.15)),color-stop(.75,rgba(255,255,255,.15)),color-stop(.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:40px 40px}.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(.25,rgba(255,255,255,.15)),color-stop(.25,transparent),color-stop(.5,transparent),color-stop(.5,rgba(255,255,255,.15)),color-stop(.75,rgba(255,255,255,.15)),color-stop(.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(.25,rgba(255,255,255,.15)),color-stop(.25,transparent),color-stop(.5,transparent),color-stop(.5,rgba(255,255,255,.15)),color-stop(.75,rgba(255,255,255,.15)),color-stop(.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(.25,rgba(255,255,255,.15)),color-stop(.25,transparent),color-stop(.5,transparent),color-stop(.5,rgba(255,255,255,.15)),color-stop(.75,rgba(255,255,255,.15)),color-stop(.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(.25,rgba(255,255,255,.15)),color-stop(.25,transparent),color-stop(.5,transparent),color-stop(.5,rgba(255,255,255,.15)),color-stop(.75,rgba(255,255,255,.15)),color-stop(.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media,.media-body{overflow:hidden;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media>.pull-left{margin-right:10px}.media>.pull-right{margin-left:10px}.media-list{padding-left:0;list-style:none}.list-group{margin-bottom:20px;padding-left:0}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-right-radius:6px;border-top-left-radius:6px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:6px;border-bottom-left-radius:6px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover{text-decoration:none;background-color:#f5f5f5}a.list-group-item.active,a.list-group-item.active:focus,a.list-group-item.active:hover{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca}a.list-group-item.active .list-group-item-heading,a.list-group-item.active:focus .list-group-item-heading,a.list-group-item.active:hover .list-group-item-heading{color:inherit}a.list-group-item.active .list-group-item-text,a.list-group-item.active:focus .list-group-item-text,a.list-group-item.active:hover .list-group-item-text{color:#e1edf7}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:6px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-body:after,.panel-body:before{content:" ";display:table}.panel-body:after{clear:both}.panel>.list-group{margin-bottom:0}.panel>.list-group .list-group-item{border-width:1px 0}.panel>.list-group .list-group-item:first-child{border-top-right-radius:0;border-top-left-radius:0}.panel>.list-group .list-group-item:last-child{border-bottom:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.panel>.table,.panel>.table-responsive{margin-bottom:0}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive{border-top:1px solid #ddd}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-bordered>thead>tr:last-child>td,.panel>.table-bordered>thead>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>thead>tr:last-child>td,.panel>.table-responsive>.table-bordered>thead>tr:last-child>th{border-bottom:0}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-right-radius:5px;border-top-left-radius:5px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:5px;border-bottom-left-radius:5px}.panel-group .panel{margin-bottom:0;border-radius:6px;overflow:hidden}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse .panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse .panel-body{border-top-color:#ddd}.panel-default>.panel-heading>.dropdown .caret{border-color:#333 transparent}.panel-default>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#428bca}.panel-primary>.panel-heading{color:#fff;background-color:#428bca;border-color:#428bca}.panel-primary>.panel-heading+.panel-collapse .panel-body{border-top-color:#428bca}.panel-primary>.panel-heading>.dropdown .caret{border-color:#fff transparent}.panel-primary>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#428bca}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse .panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading>.dropdown .caret{border-color:#468847 transparent}.panel-success>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#d6e9c6}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#c09853;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse .panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading>.dropdown .caret{border-color:#c09853 transparent}.panel-warning>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#b94a48;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse .panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading>.dropdown .caret{border-color:#b94a48 transparent}.panel-danger>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ebccd1}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse .panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading>.dropdown .caret{border-color:#3a87ad transparent}.panel-info>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#bce8f1}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:6px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.5;filter:alpha(opacity=50)}button.close{padding:0;cursor:pointer;background:0 0;border:0;-webkit-appearance:none}.modal-open{overflow:hidden}.modal{display:none;overflow:auto;overflow-y:scroll;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040}.modal.fade .modal-dialog{-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);transform:translate(0,-25%);-webkit-transition:-webkit-transform .3s ease-out;-moz-transition:-moz-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0)}.modal-dialog{position:relative;margin-left:auto;margin-right:auto;width:auto;padding:10px;z-index:1050}.modal-content{position:relative;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);background-clip:padding-box;outline:0}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1030;background-color:#000}.modal-backdrop.fade{opacity:0;filter:alpha(opacity=0)}.modal-backdrop.in{opacity:.5;filter:alpha(opacity=50)}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5;min-height:16.428571429px}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.428571429}.modal-body{position:relative;padding:20px}.modal-footer{margin-top:15px;padding:19px 20px 20px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer:after,.modal-footer:before{content:" ";display:table}.modal-footer:after{clear:both}.modal-footer .btn+.btn{margin-left:5px;margin-bottom:0}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}@media screen and (min-width:768px){.modal-dialog{width:600px;padding-top:30px;padding-bottom:30px}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}}.tooltip{position:absolute;z-index:1030;display:block;visibility:visible;font-size:12px;line-height:1.4;opacity:0;filter:alpha(opacity=0)}.tooltip.in{opacity:.9;filter:alpha(opacity=90)}.tooltip.top{margin-top:-3px;padding:5px 0}.tooltip.right{margin-left:3px;padding:0 5px}.tooltip.bottom{margin-top:3px;padding:5px 0}.tooltip.left{margin-left:-3px;padding:0 5px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:6px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;right:5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;background-color:#fff;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);white-space:normal}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{margin:0;padding:8px 14px;font-size:14px;font-weight:400;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover .arrow,.popover .arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover .arrow{border-width:11px}.popover .arrow:after{border-width:10px;content:""}.popover.top .arrow{left:50%;margin-left:-11px;border-bottom-width:0;border-top-color:#999;border-top-color:rgba(0,0,0,.25);bottom:-11px}.popover.top .arrow:after{content:" ";bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#fff}.popover.right .arrow{top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:#999;border-right-color:rgba(0,0,0,.25)}.popover.right .arrow:after{content:" ";left:1px;bottom:-10px;border-left-width:0;border-right-color:#fff}.popover.bottom .arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25);top:-11px}.popover.bottom .arrow:after{content:" ";top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#fff}.popover.left .arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left .arrow:after{content:" ";right:1px;border-right-width:0;border-left-color:#fff;bottom:-10px}.carousel{position:relative}.carousel-inner{position:relative;overflow:hidden;width:100%}.carousel-inner>.item{display:none;position:relative;-webkit-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{display:block;max-width:100%;height:auto;line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;left:0;bottom:0;width:15%;opacity:.5;filter:alpha(opacity=50);font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-control.left{background-image:-webkit-gradient(linear,0 top,100% top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,.5) 0),color-stop(rgba(0,0,0,.0001) 100%));background-image:-moz-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1)}.carousel-control.right{left:auto;right:0;background-image:-webkit-gradient(linear,0 top,100% top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,.0001) 0),color-stop(rgba(0,0,0,.5) 100%));background-image:-moz-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1)}.carousel-control:focus,.carousel-control:hover{color:#fff;text-decoration:none;opacity:.9;filter:alpha(opacity=90)}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;margin-top:-10px;margin-left:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;margin-left:-30%;padding-left:0;list-style:none;text-align:center}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;border:1px solid #fff;border-radius:10px;cursor:pointer;background-color:#000 \9;background-color:transparent}.carousel-indicators .active{margin:0;width:12px;height:12px;background-color:#fff}.carousel-caption{position:absolute;left:15%;right:15%;bottom:20px;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicons-chevron-left,.carousel-control .glyphicons-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-15px;margin-left:-15px;font-size:30px}.carousel-caption{left:20%;right:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:after,.clearfix:before{content:" ";display:table}.clearfix:after{clear:both}.center-block{display:block;margin-left:auto;margin-right:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-lg,.visible-md,.visible-sm,.visible-xs,td.visible-lg,td.visible-md,td.visible-sm,td.visible-xs,th.visible-lg,th.visible-md,th.visible-sm,th.visible-xs,tr.visible-lg,tr.visible-md,tr.visible-sm,tr.visible-xs{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-xs.visible-sm{display:block!important}tr.visible-xs.visible-sm{display:table-row!important}td.visible-xs.visible-sm,th.visible-xs.visible-sm{display:table-cell!important}}@media (min-width:992px) and (max-width:767px){.visible-xs.visible-md{display:block!important}tr.visible-xs.visible-md{display:table-row!important}td.visible-xs.visible-md,th.visible-xs.visible-md{display:table-cell!important}}@media (min-width:768px){.visible-xs.visible-lg{display:block!important}tr.visible-xs.visible-lg{display:table-row!important}td.visible-xs.visible-lg,th.visible-xs.visible-lg{display:table-cell!important}}@media (max-width:767px){.visible-sm.visible-xs{display:block!important}tr.visible-sm.visible-xs{display:table-row!important}td.visible-sm.visible-xs,th.visible-sm.visible-xs{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}}@media (min-width:992px) and (max-width:767px){.visible-sm.visible-md{display:block!important}tr.visible-sm.visible-md{display:table-row!important}td.visible-sm.visible-md,th.visible-sm.visible-md{display:table-cell!important}}@media (min-width:768px){.visible-sm.visible-lg{display:block!important}tr.visible-sm.visible-lg{display:table-row!important}td.visible-sm.visible-lg,th.visible-sm.visible-lg{display:table-cell!important}}@media (max-width:767px){.visible-md.visible-xs{display:block!important}tr.visible-md.visible-xs{display:table-row!important}td.visible-md.visible-xs,th.visible-md.visible-xs{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-md.visible-sm{display:block!important}tr.visible-md.visible-sm{display:table-row!important}td.visible-md.visible-sm,th.visible-md.visible-sm{display:table-cell!important}}@media (min-width:992px) and (max-width:767px){.visible-md{display:block!important}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}}@media (min-width:768px){.visible-md.visible-lg{display:block!important}tr.visible-md.visible-lg{display:table-row!important}td.visible-md.visible-lg,th.visible-md.visible-lg{display:table-cell!important}}@media (max-width:767px){.visible-lg.visible-xs{display:block!important}tr.visible-lg.visible-xs{display:table-row!important}td.visible-lg.visible-xs,th.visible-lg.visible-xs{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-lg.visible-sm{display:block!important}tr.visible-lg.visible-sm{display:table-row!important}td.visible-lg.visible-sm,th.visible-lg.visible-sm{display:table-cell!important}}@media (min-width:992px) and (max-width:767px){.visible-lg.visible-md{display:block!important}tr.visible-lg.visible-md{display:table-row!important}td.visible-lg.visible-md,th.visible-lg.visible-md{display:table-cell!important}}@media (min-width:768px){.visible-lg{display:block!important}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}}.hidden-xs{display:block!important}tr.hidden-xs{display:table-row!important}td.hidden-xs,th.hidden-xs{display:table-cell!important}@media (max-width:767px){.hidden-xs,td.hidden-xs,th.hidden-xs,tr.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-xs.hidden-sm,td.hidden-xs.hidden-sm,th.hidden-xs.hidden-sm,tr.hidden-xs.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:767px){.hidden-xs.hidden-md,td.hidden-xs.hidden-md,th.hidden-xs.hidden-md,tr.hidden-xs.hidden-md{display:none!important}}@media (min-width:768px){.hidden-xs.hidden-lg,td.hidden-xs.hidden-lg,th.hidden-xs.hidden-lg,tr.hidden-xs.hidden-lg{display:none!important}}.hidden-sm{display:block!important}tr.hidden-sm{display:table-row!important}td.hidden-sm,th.hidden-sm{display:table-cell!important}@media (max-width:767px){.hidden-sm.hidden-xs,td.hidden-sm.hidden-xs,th.hidden-sm.hidden-xs,tr.hidden-sm.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm,td.hidden-sm,th.hidden-sm,tr.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:767px){.hidden-sm.hidden-md,td.hidden-sm.hidden-md,th.hidden-sm.hidden-md,tr.hidden-sm.hidden-md{display:none!important}}@media (min-width:768px){.hidden-sm.hidden-lg,td.hidden-sm.hidden-lg,th.hidden-sm.hidden-lg,tr.hidden-sm.hidden-lg{display:none!important}}.hidden-md{display:block!important}tr.hidden-md{display:table-row!important}td.hidden-md,th.hidden-md{display:table-cell!important}@media (max-width:767px){.hidden-md.hidden-xs,td.hidden-md.hidden-xs,th.hidden-md.hidden-xs,tr.hidden-md.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-md.hidden-sm,td.hidden-md.hidden-sm,th.hidden-md.hidden-sm,tr.hidden-md.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:767px){.hidden-md,td.hidden-md,th.hidden-md,tr.hidden-md{display:none!important}}@media (min-width:768px){.hidden-md.hidden-lg,td.hidden-md.hidden-lg,th.hidden-md.hidden-lg,tr.hidden-md.hidden-lg{display:none!important}}.hidden-lg{display:block!important}tr.hidden-lg{display:table-row!important}td.hidden-lg,th.hidden-lg{display:table-cell!important}@media (max-width:767px){.hidden-lg.hidden-xs,td.hidden-lg.hidden-xs,th.hidden-lg.hidden-xs,tr.hidden-lg.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-lg.hidden-sm,td.hidden-lg.hidden-sm,th.hidden-lg.hidden-sm,tr.hidden-lg.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:767px){.hidden-lg.hidden-md,td.hidden-lg.hidden-md,th.hidden-lg.hidden-md,tr.hidden-lg.hidden-md{display:none!important}}@media (min-width:768px){.hidden-lg,td.hidden-lg,th.hidden-lg,tr.hidden-lg{display:none!important}}.visible-print,td.visible-print,th.visible-print,tr.visible-print{display:none!important}@media print{.visible-print{display:block!important}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}.hidden-print,td.hidden-print,th.hidden-print,tr.hidden-print{display:none!important}}#sidebar-nav>li>a>i{background-color:#999;border-radius:100%;color:transparent;cursor:pointer;display:inline-block;font:0/0 Arial;height:12px;letter-spacing:0;padding:0;margin:0;position:absolute;top:8px;right:4px;vertical-align:middle;width:12px}#sidebar-nav>li>a>i:before{border:1px solid #fff;content:" ";display:block;height:0;left:50%;margin-left:-3px;margin-top:-1px;position:absolute;top:50%;width:6px}#sidebar-nav>li>a>i:after{border:1px solid #fff;content:" ";display:block;height:6px;left:50%;margin-left:-1px;margin-top:-3px;position:absolute;top:50%;width:0}#sidebar-nav>li>a.active>i:after{display:none}.css-sprite ul{height:24px;width:auto;margin:-5px 0 0}.css-sprite-amex,.css-sprite-discover,.css-sprite-mc,.css-sprite-visa,.css-sprite-visa-gift-card{background-image:url(//0.ecom.attccc.com/styles/att/assets3.2.0/images/cc-images-sprite.png?build_date=1429672365397);background-repeat:no-repeat;background-size:164px 48px;width:38px;height:24px;display:inline-block}@media \0screen\,screen\8{.css-sprite-amex,.css-sprite-discover,.css-sprite-mc,.css-sprite-visa,.css-sprite-visa-gift-card{background-image:url(//0.ecom.attccc.com/styles/att/assets3.2.0/images/cc-images-sprite-ie8.png?build_date=1429672365397)}}.css-sprite-mc{background-position:0 -24px}.css-sprite-visa{background-position:-42px -24px}.css-sprite-amex{background-position:-84px -24px}.css-sprite-discover{background-position:-126px -24px}.css-sprite-visa-gift-card{background-position:-168px -24px}.show-mc .css-sprite-mc{background-position:0 0}.show-visa .css-sprite-visa{background-position:-42px 0}.show-amex .css-sprite-amex{background-position:-84px 0}.show-discover .css-sprite-discover{background-position:-126px 0}.show-visa-gift-card .css-sprite-visa-gift-card{background-position:-168px 0}.cvc-amex img,.cvc-cc img{margin:10px -8px 0 0} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/btn.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/btn.css
new file mode 100644
index 00000000..368e3d52
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/btn.css
@@ -0,0 +1 @@
+@charset "UTF-8";address,blockquote,dd,h1,h2,h3,h4,h5,h6,ol,p,pre,table,ul{margin:0;padding:0;margin-bottom:24px;margin-bottom:1.5rem}html{font-size:1em;line-height:1.5}body{margin:0}h1{font-size:48px;font-size:3rem;line-height:1}h2{font-size:36px;font-size:2.25rem;line-height:1.3333333333}h3{font-size:30px;font-size:1.875rem;line-height:1.6}h4{font-size:24px;font-size:1.5rem;line-height:1}h5{font-size:20px;font-size:1.25rem;line-height:1.2}h6{font-size:18px;font-size:1.125rem;line-height:1.3333333333}dd,ol,ul{margin-left:48px;margin-left:3rem}li>ol,li>ul{margin-bottom:0}code,kbd,pre,samp{font-family:monospace,monospace}blockquote{text-indent:-.41em;quotes:"“" "â€";margin-left:48px;margin-left:3rem}blockquote p:before{content:"“";content:open-quote}blockquote p:after{content:"";content:no-close-quote}blockquote p:last-of-type:after{content:"â€";content:close-quote}q{quotes:"‘" "’" "“" "â€"}q:before{content:"‘";content:open-quote}q:after{content:"’";content:close-quote}q q:before{content:"“";content:open-quote}q q:after{content:"â€";content:close-quote}q:first-child{display:inline-block;text-indent:-.22em}table{width:100%;border-collapse:collapse;border-spacing:0}td,th{padding:12px}#grid{position:absolute;top:0;left:50%;width:980px;margin-left:-490px;counter-reset:section;z-index:9999!important;pointer-events:none;outline:1px solid rgba(0,206,209,.1)}#grid:after{position:fixed;top:0;left:0;content:'Column: 20px Gutter: 20px Margin: 20px';display:block;max-width:90px;padding:3px;background-color:#000;color:#fff;font-size:10px;font-family:monospace;z-index:9999}#grid div.vert{width:20px;outline:solid rgba(0,206,209,.3);outline-width:1px;margin-right:20px;position:relative;background:rgba(255,0,0,.05);counter-increment:section}#grid div.vert.first-line{margin-left:20px}#grid div.vert::after{position:fixed;display:block;text-align:center;color:#fff;width:20px;content:counter(section);top:5px;font-size:8px;font-family:monospace}#grid div.vert:nth-child(24){position:absolute;top:0;right:0}#grid div.vert:nth-child(1),#grid div.vert:nth-child(10),#grid div.vert:nth-child(11),#grid div.vert:nth-child(12),#grid div.vert:nth-child(13),#grid div.vert:nth-child(14),#grid div.vert:nth-child(15),#grid div.vert:nth-child(16),#grid div.vert:nth-child(17),#grid div.vert:nth-child(18),#grid div.vert:nth-child(19),#grid div.vert:nth-child(2),#grid div.vert:nth-child(20),#grid div.vert:nth-child(21),#grid div.vert:nth-child(22),#grid div.vert:nth-child(23),#grid div.vert:nth-child(24),#grid div.vert:nth-child(3),#grid div.vert:nth-child(4),#grid div.vert:nth-child(5),#grid div.vert:nth-child(6),#grid div.vert:nth-child(7),#grid div.vert:nth-child(8),#grid div.vert:nth-child(9){display:inline-block!important}#grid div.vert:nth-child(25),#grid div.vert:nth-child(26),#grid div.vert:nth-child(27),#grid div.vert:nth-child(28),#grid div.vert:nth-child(29),#grid div.vert:nth-child(30),#grid div.vert:nth-child(31){display:none!important}#grid div.horiz{height:10px;border-bottom:1px dotted rgba(100,100,100,.2);margin:0;padding:0}.bg-prime-blue{background-color:#067ab4}.bg-secondary-gray{background-color:#666}.bg-light-blue{background-color:#bcc9d5}.bg-dark-gray{background-color:#444}.bg-dusty-blue{background-color:#97b1cf}.bg-warm-gray{background-color:#cccb9b}.bg-taupe{background-color:#cccb6c}.bg-green-highlight{background-color:#c4d63f}.bg-lime-highlight{background-color:#dad632}.bg-purple-highlight{background-color:#b6539c}.bg-magenta{background-color:#d71481}.bg-blue-highlight{background-color:#4cc8f3}.bg-ochre{background-color:#fab230}.bg-green{background-color:#4fa721}.bg-lime{background-color:#b6bd26}.bg-purple{background-color:#7f0e7c}.bg-burgundy{background-color:#b1103e}.bg-dark-blue{background-color:#0e2875}.bg-gold{background-color:#fd9827}.bg-teal{background-color:#20c6b2}.bg-mint-green{background-color:#9cfecd}.bg-yellow{background-color:#feed35}.bg-white{background-color:#fff}.alt.inline-list>li{display:inline-block;zoom:1;*display:inline;*vertical-align:auto;vertical-align:middle;float:none}.text-upper{text-transform:uppercase!important}body{font-family:Arial}.font-showcase h1,.font-showcase h2,.font-showcase h3,.font-showcase h4,.font-showcase h5,.font-showcase h6{font-weight:100;letter-spacing:-1px;margin:10px 0;-webkit-font-smoothing:antialiased}.font-showcase h1{font-family:omnes_att_light;font-size:48px;font-size:3rem;line-height:48px}.font-showcase h2,.price{font-family:omnes_att_light;font-size:36px;font-size:2.25rem;line-height:36px}.font-showcase h3{font-family:omnes_att_regular;font-size:24px;font-size:1.5rem;line-height:28px}.font-showcase h4,.font-showcase h4.font-showcase-font-example,.font-showcase h4.font-showcase-font-name{font-family:Arial;font-size:18px;font-size:1.125rem;line-height:22px;-webkit-font-smoothing:antialiased}.font-showcase h5{font-family:Arial;font-size:14px;font-size:.875rem;line-height:20px;-webkit-font-smoothing:antialiased}.font-showcase h6{font-family:Arial;font-size:11px;font-size:.6875rem;line-height:30px;font-weight:100;-webkit-font-smoothing:antialiased}.body-copy,.font-showcase p{font-family:Arial;font-size:14px;font-size:.875rem;line-height:20px;-webkit-font-smoothing:antialiased}.body-copy-short{font-family:Arial;font-size:12px;font-size:.75rem;line-height:15px;-webkit-font-smoothing:antialiased}p [class*=icon]{display:inline-block;vertical-align:middle;margin-top:-4px}.details-label{display:block;font-family:Arial;font-size:11px;font-size:.6875rem;line-height:15px}.details-label+.price{line-height:28px}.price{letter-spacing:-1px;-webkit-font-smoothing:antialiased}.price sup{font-size:18px;font-size:1.125rem;vertical-align:baseline;top:-11px;margin:0 2px}.price-alt{font-size:24px;font-size:1.5rem;line-height:24px}.price-alt sup{font-size:12px;font-size:.75rem;top:-8px}.promo-tagline{font-family:omnes_att_medium_italic;font-size:16px;font-size:1rem;line-height:20px;display:inline-block;margin-bottom:5px;-webkit-font-smoothing:antialiased}.promo-text{font-family:clearview_att_italic;font-size:12px;font-size:.75rem;line-height:15px;display:inline-block;margin-bottom:5px;-webkit-font-smoothing:antialiased}.divider,.divider-dark,hr{border:0;border-bottom:1px solid #d3d3d3}.divider-light{border-color:#e5e5e5}dl{font-family:Arial;color:#444;font-size:12px;font-size:.75rem}dt{font-family:Arial;font-size:11px;font-size:.6875rem;display:block!important;margin:10px 0 5px!important;width:auto!important;text-transform:uppercase}dt a{font-family:Arial;color:#067ab4;text-transform:none}dd{display:inline!important;line-height:20px}[data-highlight]{background-color:#c9e9f9;-webkit-animation:highlight-fade 3s infinite}@-webkit-keyframes highlight-fade{100%,80%{background-color:transparent}}.button--group{vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;display:inline-block;margin-bottom:20px}.button--group .btn{margin-bottom:10px}.bg-light-gray .button,.button{display:inline-block;zoom:1;*display:inline;*vertical-align:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:background-color .3s ease-out;-moz-transition:background-color .3s ease-out;transition:background-color .3s ease-out;font-size:18px;font-size:1.125rem;vertical-align:middle;line-height:1;text-align:center;cursor:pointer;padding:11px 30px;background-color:#888;color:#f2f2f2;border-radius:6px;position:relative;border:0;text-decoration:none;letter-spacing:0;font-family:clearview_att_light}.bg-light-gray .button:hover,.button:hover{background-color:#666;color:#f2f2f2}.bg-light-gray .button:focus,.button:focus{outline:1px solid #39b1ec!important;outline-offset:2px;text-decoration:none}.bg-light-gray .button:active,.button:active{-webkit-transition:background-color 0;-moz-transition:background-color 0;transition:background-color 0;background-color:#bbb;box-shadow:none;color:#f2f2f2}.bg-light-gray .button:visited,.button:visited{color:#fff}.lt-ie9 .bg-light-gray .button,.lt-ie9 .button{min-width:64px}.bg-light-gray .button [class*=icon-],.button [class*=icon-]{display:inline-block;vertical-align:middle}.button--small,[class*=bg-] .button--small{font-size:14px;font-size:.875rem;height:30px;padding:8px 20px}.lt-ie9 .button--small,.lt-ie9 [class*=bg-] .button--small{min-width:85px}.button--disabled,.button:disabled,.button[disabled]{background-color:#d3d3d3;color:#888!important;pointer-events:none;cursor:not-allowed!important}.buttons-dropdown--large .button--disabled,.buttons-dropdown--small .button--disabled{cursor:not-allowed!important;pointer-events:all!important;background-color:#d3d3d3!important}.button--square{border-radius:0;padding-left:15px;padding-right:15px}.button--primary{background-color:#0574AC!important;min-width:100px}.button--primary:hover{background-color:#0091d9!important}.button--primary:active{background-color:#44c8f5!important;color:#fff}.button--primary:focus{color:#fff}.bg-prime-blue .button.button--primary{background-color:#fafafa!important;color:#067ab4;min-width:100px}.bg-prime-blue .button.button--primary:hover{background-color:#CAE0EB!important;color:#067ab4}.bg-prime-blue .button.button--primary:active{background-color:#1792D6!important;color:#fff}.bg-prime-blue .button.button--primary.button--inactive,.bg-prime-blue .button.button--primary:disabled{background-color:#d3d3d3!important;color:#888;cursor:not-allowed!important}.bg-prime-blue .button.button--primary:focus{outline:1px solid #99C4D9!important;outline-offset:2px}.button.button--secondary{background:#fff;border:1px solid #157BB2;color:#067ab4}.button.button--secondary:hover{background:#F7F7F7;border-color:#0091d9;color:#0091d9}.button.button--secondary:active{background:#E5E5E5;border-color:#0574AC;color:#0574AC}.button--hero{background-color:#ef6f00!important;min-width:100px!important;height:40px;overflow:hidden}.button--hero .button--hero__inner{height:60px;-webkit-transition:width 1s,height 1s,-webkit-transform .2s;-moz-transition:width 1s,height 1s,-moz-transform .2s}.button--hero .button--hero__inner [class*=icon-]{line-height:40px;display:block}.button--hero:hover>.button--hero__inner{-webkit-transform:translate(0px,-29px);-moz-transform:translate(0px,-29px);transform:translate(0px,-29px)}.button--hero:active>.button--hero__inner{-webkit-transform:translate(0px,0);-moz-transform:translate(0px,0);transform:translate(0px,0)}.button--hero:hover{background-color:#ef6f00!important}.button--hero:active{background-color:#fcb314!important;color:#fff}.button--hero:focus{color:#fff}.bg-secondary-gray .button.button--secondary:focus{outline:1px solid #BDBDBD!important;outline-offset:2px}.bg-secondary-gray .button.button--secondary:disabled{color:#f2f2f2}.button--icon{font-size:14px;font-size:.875rem;width:30px;height:30px;border-radius:50%;font-family:atticons;line-height:30px;min-width:0;padding:0}.button--icon [class^=icon-]{vertical-align:baseline}.button--large.button--icon{font-size:28px;font-size:1.75rem;width:40px;height:40px;line-height:40px}.button--inactive{background-color:#ddd!important;color:#999!important;cursor:not-allowed!important;min-width:100px}.bg-secondary-gray .button{background-color:#fff}.bg-secondary-gray .button:hover{background-color:#F7F7F7}.bg-secondary-gray .button.button--inactive,.bg-secondary-gray .button:active,.bg-secondary-gray .button:disabled{background-color:#E5E5E5;cursor:not-allowed;pointer-events:all}.bg-light-blue .button{background-color:#626870}.bg-light-blue .button:hover{background-color:#8a939c}.bg-light-blue .button.button--inactive,.bg-light-blue .button:active,.bg-light-blue .button:disabled{background-color:#d7dfe6;cursor:not-allowed;pointer-events:all}.bg-dark-gray .button{background-color:#fff}.bg-dark-gray .button:hover{background-color:#f4f4f4}.bg-dark-gray .button.button--inactive,.bg-dark-gray .button:active,.bg-dark-gray .button:disabled{background-color:#E5E5E5;cursor:not-allowed;pointer-events:all}.bg-dusty-blue .button{background-color:#4e5c6b}.bg-dusty-blue .button:hover{background-color:#6f8298}.bg-dusty-blue .button.button--inactive,.bg-dusty-blue .button:active,.bg-dusty-blue .button:disabled{background-color:#c0d0e2;cursor:not-allowed;pointer-events:all}.bg-warm-gray .button{background-color:#6a6950}.bg-warm-gray .button:hover{background-color:#969572}.bg-warm-gray .button.button--inactive,.bg-warm-gray .button:active,.bg-warm-gray .button:disabled{background-color:#e0dfc3;cursor:not-allowed;pointer-events:all}.bg-taupe .button{background-color:#6a6938}.bg-taupe .button:hover{background-color:#96954f}.bg-taupe .button.button--inactive,.bg-taupe .button:active,.bg-taupe .button:disabled{background-color:#e0dfa6;cursor:not-allowed;pointer-events:all}.bg-green-highlight .button{background-color:#666f20}.bg-green-highlight .button:hover{background-color:#909c2e}.bg-green-highlight .button.button--inactive,.bg-green-highlight .button:active,.bg-green-highlight .button:disabled{background-color:#dce787;cursor:not-allowed;pointer-events:all}.bg-lime-highlight .button{background-color:#726f17}.bg-lime-highlight .button:hover{background-color:#a19c23}.bg-lime-highlight .button.button--inactive,.bg-lime-highlight .button:active,.bg-lime-highlight .button:disabled{background-color:#e9e678;cursor:not-allowed;pointer-events:all}.bg-purple-highlight .button{background-color:#49213e}.bg-purple-highlight .button:hover{background-color:#7a3768}.bg-purple-highlight .button.button--inactive,.bg-purple-highlight .button:active,.bg-purple-highlight .button:disabled{background-color:#d397c4;cursor:not-allowed;pointer-events:all}.bg-magenta .button{background-color:#560333}.bg-magenta .button:hover{background-color:#8f0956}.bg-magenta .button.button--inactive,.bg-magenta .button:active,.bg-magenta .button:disabled{background-color:#eb82bf;cursor:not-allowed;pointer-events:all}.bg-blue-highlight .button{background-color:#27687e}.bg-blue-highlight .button:hover{background-color:#3893b2}.bg-blue-highlight .button.button--inactive,.bg-blue-highlight .button:active,.bg-blue-highlight .button:disabled{background-color:#92def7;cursor:not-allowed;pointer-events:all}.bg-ochre .button{background-color:#825c17}.bg-ochre .button:hover{background-color:#b88222}.bg-ochre .button.button--inactive,.bg-ochre .button:active,.bg-ochre .button:disabled{background-color:#fcd079;cursor:not-allowed;pointer-events:all}.bg-green .button{background-color:#1f430a}.bg-green .button:hover{background-color:#357014}.bg-green .button.button--inactive,.bg-green .button:active,.bg-green .button:disabled{background-color:#96c278;cursor:not-allowed;pointer-events:all}.bg-lime .button{background-color:#5f620f}.bg-lime .button:hover{background-color:#797e16}.bg-lime .button.button--inactive,.bg-lime .button:active,.bg-lime .button:disabled{background-color:#cacd74;cursor:not-allowed;pointer-events:all}.bg-purple .button{background-color:#c149be}.bg-purple .button:hover{background-color:#d259cf}.bg-purple .button.button--inactive,.bg-purple .button:active,.bg-purple .button:disabled{background-color:#ae71ad;cursor:not-allowed;pointer-events:all}.bg-burgundy .button{background-color:#e84575}.bg-burgundy .button:hover{background-color:#f65383}.bg-burgundy .button.button--inactive,.bg-burgundy .button:active,.bg-burgundy .button:disabled{background-color:#c6758d;cursor:not-allowed;pointer-events:all}.bg-dark-blue .button{background-color:#5b75c2}.bg-dark-blue .button:hover{background-color:#6e88d5}.bg-dark-blue .button.button--inactive,.bg-dark-blue .button:active,.bg-dark-blue .button:disabled{background-color:#7582a8;cursor:not-allowed;pointer-events:all}.bg-gold .button{background-color:#844e0f}.bg-gold .button:hover{background-color:#a96517}.bg-gold .button.button--inactive,.bg-gold .button:active,.bg-gold .button:disabled{background-color:#edba74;cursor:not-allowed;pointer-events:all}.bg-teal .button{background-color:#0b685c}.bg-teal .button:hover{background-color:#159183}.bg-teal .button.button--inactive,.bg-teal .button:active,.bg-teal .button:disabled{background-color:#1aab9a;cursor:not-allowed;pointer-events:all}.bg-mint-green .button{background-color:#51846a}.bg-mint-green .button:hover{background-color:#72ba97}.bg-mint-green .button.button--inactive,.bg-mint-green .button:active,.bg-mint-green .button:disabled{background-color:#88dcb2;cursor:not-allowed;pointer-events:all}.bg-yellow .button{background-color:#847c17}.bg-yellow .button:hover{background-color:#baae24}.bg-yellow .button.button--inactive,.bg-yellow .button:active,.bg-yellow .button:disabled{background-color:#dccd2c;cursor:not-allowed;pointer-events:all}.button--bordered{border:1px solid #d4d4d4}.button__scroll-top-right{position:fixed;top:50%;right:-50px;background:#f2f2f2;border:1px solid #888;border-radius:2px;color:#444;cursor:pointer;padding:7px 58px 7px 11px;z-index:3}.csstransitions .button__scroll-top-right{-webkit-transition:right .3s ease-out;-moz-transition:right .3s ease-out;transition:right .3s ease-out;right:-50px}.button__scroll-top-right.visible{right:20px}.button__scroll-top-right:hover{background:#b2b2b2;color:#000}.button__scroll-top-right:active{background:#0574AC;color:#fff}.button__scroll-top-right .icon-arrow-double-right{-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);font-size:14px}.button__scroll-top{background:#f2f2f2;border:1px solid #888;border-radius:2px;color:#444;cursor:pointer;padding:7px 9px;z-index:3}.csstransitions .button__scroll-top{-webkit-transition:right .3s ease-out;-moz-transition:right .3s ease-out;transition:right .3s ease-out;right:-50px}.button__scroll-top.visible{right:20px}.button__scroll-top:hover{background:#b2b2b2;color:#000}.button__scroll-top:active{background:#0574AC;color:#fff}.button__scroll-top .icon-arrow-double-right{-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-ms-transform:rotate(-90deg);font-size:14px}.button--danger{background-color:#ff6151!important}.button--danger:focus,.button--danger:hover{background-color:#eb4539!important}.button--light,.button--light:focus,.button--light:hover{background-color:#fff!important;color:#666}.button.button--link,[class^=bg-] .button.button--link{background:none!important;min-width:0;padding-left:10px;padding-right:10px}.button--loading{display:inline-block;width:100%}.button--loading i{-webkit-animation-name:loading-item;-webkit-animation-duration:1s;-webkit-animation-timing-function:ease-out;-webkit-animation-iteration-count:infinite;-webkit-transform:scale(0,0);-moz-animation-name:loading-item;-moz-animation-duration:1s;-moz-animation-timing-function:ease-out;-moz-animation-iteration-count:infinite;-moz-transform:scale(0,0);animation-name:loading-item;animation-duration:1s;animation-timing-function:ease-out;animation-iteration-count:infinite;transform:scale(0,0);width:8px;height:8px;background:#000;border-radius:50%;float:right;margin-right:6px}.button--loading__small i{-webkit-animation-name:loading-item;-webkit-animation-duration:1s;-webkit-animation-timing-function:ease-out;-webkit-animation-iteration-count:infinite;-webkit-transform:scale(0,0);-moz-animation-name:loading-item;-moz-animation-duration:1s;-moz-animation-timing-function:ease-out;-moz-animation-iteration-count:infinite;-moz-transform:scale(0,0);animation-name:loading-item;animation-duration:1s;animation-timing-function:ease-out;animation-iteration-count:infinite;transform:scale(0,0);width:5px;height:5px;background:#000;border-radius:50%;float:right;margin-right:4px}@-webkit-keyframes loading-item{0%{-webkit-transform:scale(1,1);-moz-transform:scale(1,1);transform:scale(1,1)}20%{-webkit-transform:scale(0.8,.8);-moz-transform:scale(0.8,.8);transform:scale(0.8,.8)}40%,60%{-webkit-transform:scale(0.6,.6);-moz-transform:scale(0.6,.6);transform:scale(0.6,.6)}80%{-webkit-transform:scale(0.8,.8);-moz-transform:scale(0.8,.8);transform:scale(0.8,.8)}100%{-webkit-transform:scale(1,1);-moz-transform:scale(1,1);transform:scale(1,1)}}i:nth-child(3){-webkit-animation-delay:.8s;-moz-animation-delay:.8s;animation-delay:.8s}i:nth-child(2){-webkit-animation-delay:1s;-moz-animation-delay:1s;animation-delay:1s}i:nth-child(1){-webkit-animation-delay:1.2s;-moz-animation-delay:1.2s;animation-delay:1.2s;margin-right:0}.button-secondary,.button.button-secondary{background-color:#666;color:#f2f2f2}.button-secondary:hover,.button.button-secondary:hover{background-color:#888;color:#f2f2f2}.button-secondary:focus,.button.button-secondary:focus{outline:1px solid #d3d3d3;outline-offset:2px;color:#f2f2f2}.button-secondary:active,.button.button-secondary:active{background-color:#666;color:#f2f2f2}.button-secondary:disabled,.button.button-secondary:disabled{background-color:#d3d3d3;color:#888}.buttons-dropdown--large a{font-size:18px;font-size:1.125rem}.buttons-dropdown--large .buttons-dropdown__split{min-width:inherit;padding:11px 29px}.buttons-dropdown--large .buttons-dropdown__drop{padding:11px 12px;min-width:34px;margin-left:1px!important}.buttons-dropdown--large .buttons-dropdown__drop:after{content:"\e6bf";font-family:atticons;font-size:10px;font-size:.625rem}.buttons-dropdown--large ul{min-width:inherit;top:0;left:100%;margin-left:-34px;margin-top:0;border-top-left-radius:0;overflow:hidden;padding:0;border:1px solid #0091d9}.buttons-dropdown--large ul li{text-align:left}.buttons-dropdown--large ul li a{color:#666;padding:10px;font-size:14px;font-size:.875rem;background:#fff}.buttons-dropdown--large ul li a:hover{background-color:#0091d9;color:#f2f2f2}.buttons-dropdown--small a{font-size:14px;font-size:.875rem;font-size:14px}.buttons-dropdown--small .buttons-dropdown__split{min-width:inherit;padding:8px 20px}.buttons-dropdown--small .buttons-dropdown__drop{padding:8px 12px;min-width:34px;margin-left:1px!important}.buttons-dropdown--small .buttons-dropdown__drop:after{content:"\e6bf";font-family:atticons;font-size:10px;font-size:.625rem}.buttons-dropdown--small ul{min-width:inherit;top:0;left:100%;margin-left:-34px;margin-top:0;border-top-left-radius:0;overflow:hidden;padding:0;border:1px solid #0091d9}.buttons-dropdown--small ul li{text-align:left}.buttons-dropdown--small ul li a{color:#666;padding:6px 10px;font-size:12px;font-size:.75rem;background:#fff}.buttons-dropdown--small ul li a:hover{background-color:#0091d9;color:#f2f2f2}.buttons-dropdown--large .button--secondary.buttons-dropdown__drop,.buttons-dropdown--small .button--secondary.buttons-dropdown__drop{margin-left:-1px!important}.action-dropdown-link,.buttons-dropdown--large.action-dropdown.open a,.buttons-dropdown--small.action-dropdown.open a{border-bottom-right-radius:0;border-bottom-left-radius:0;border-bottom-color:#AAA;z-index:2}.action-dropdown-list,.buttons-dropdown--large.action-dropdown.open ul,.buttons-dropdown--small.action-dropdown.open ul{border-top-left-radius:6px;border-top-right-radius:0;z-index:1}.buttons-dropdown--small.action-dropdown.open a.buttons-dropdown__drop:after{content:'\e6be'}.buttons-dropdown--small.action-dropdown.open ul{margin-left:-118px;margin-left:-117px\9;margin-top:29px;min-width:118px}.buttons-dropdown--large.action-dropdown.open a.buttons-dropdown__drop:after{content:'\e6be'}.buttons-dropdown--large.action-dropdown.open ul{margin-left:-133px;margin-left:-132px\9;margin-top:41px}.buttons-dropdown--large.action-dropdown a.buttons-dropdown__drop.button--primary{border:1px solid #157bb2}.att-btn-dropdown .btn-group{width:53px;min-width:53px;height:30px;min-height:30px}.att-btn-dropdown .dropdown-menu{border-top-right-radius:0;border-top-left-radius:6px}.att-btn-dropdown ul{min-width:130px;top:29px}.att-btn-dropdown ul li{color:#067AB4}.att-btn-dropdown ul li:focus,.att-btn-dropdown ul li:hover{color:#fff;background-color:#067AB4;cursor:pointer}.att-btn-dropdown ul.dots-dropdwn{left:-45px}.att-btn-dropdown ul.actions-dropdwn{left:3px}.att-btn-dropdown .button.button--secondary,.att-btn-dropdown .buttons-dropdown__drop button{color:#067ab4}.att-btn-dropdown button.button.button--secondary.button--small.buttons-dropdown__drop.dropdown-toggle.actions-title{min-width:100px}.att-btn-dropdown div.open .buttons-dropdown__drop:after{content:"\e6be";color:#067AB4}.att-btn-dropdown div.open button{border-bottom-left-radius:0;border-bottom-right-radius:0}.att-btn-dropdown div.open .circle{background:#067AB4}.att-btn-dropdown .circle{background:#067ab4;border-radius:50%;width:3px;height:3px;display:inline-block;margin-left:1px;margin-bottom:1px;margin-top:5px;float:left}.att-btn-dropdown div.circle:nth-child(1){margin-left:0}.att-btn-dropdown div.circle:nth-child(3){margin-right:3px}.expand-line-container{background-color:#fff;float:left;height:30px;position:relative;border-bottom:1px solid #aaa;border-top:1px solid #aaa}.expand-line-container .vertical-line{width:0;float:left;height:20px;margin-top:4px;border-left:1px solid #067AB4}.expand-line-container-active{background-color:#fff;float:left;height:30px;position:relative;border-bottom:1px solid #057ab4;border-top:1px solid #057ab4}.expand-line-container-active .hovered-line{width:0;float:left;height:29px;margin-top:0;border-left:1px solid #057ab4}.split-icon-button-container{position:relative;text-align:initial}.split-icon-button-container .selected-item{background-color:#0091d9!important;color:#f2f2f2!important}.split-icon-button-container .split-icon-button{background-color:#fff;border:1px solid #067AB4;border-radius:3px;float:left;height:30px;width:34px;cursor:pointer}.split-icon-button-container .split-icon-button a{font-size:15px;margin-left:7px;position:relative;top:8px;color:#067AB4}.split-icon-button-container .split-icon-button-middle{border-radius:0;border-left:0;border-right:0}.split-icon-button-container .split-icon-button-left{border-top-right-radius:0;border-bottom-right-radius:0;border-right:0}.split-icon-button-container .split-icon-button-right{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0}.split-icon-button-container .split-icon-button-next-dropdown{border-radius:0;border-left:0;border-right:0;border-bottom-color:#067AB4}.split-icon-button-container .split-icon-button-left-dropdown{border-bottom-color:#057ab4}.split-icon-button-container .split-icon-button-dropdown{border-bottom-right-radius:0;border-bottom-left-radius:0;border-top:1px solid #067AB4;border-right:1px solid #067AB4;border-bottom:0}.split-icon-button-container .icon-with-chevron{width:45px}.split-icon-button-container .icon-dropdown-down,.split-icon-button-container .icon-dropdown-up{font-size:12px;position:relative;top:5px;right:2px;color:#067AB4}.split-icon-button-container .dropdown-menu{position:absolute;top:28px;left:-36px;display:block;min-width:80px;width:80px;border-top-right-radius:0;border-top:0;border-color:#067AB4;overflow:hidden;padding-top:0;padding-bottom:0}.split-icon-button-container .dropdown-menu li{font-family:Arial;font-size:12px;color:#666;line-height:30px;margin-left:0}.split-icon-button-container .dropdown-menu li a{color:#666;padding:6px 10px;background:#fff;overflow:hidden;text-overflow:ellipsis;font-size:12px;line-height:30px;font-family:Arial;white-space:nowrap;display:block}.split-icon-button-container .dropdown-menu li a:hover{background-color:#0091d9;color:#f2f2f2} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/demo.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/demo.css
new file mode 100644
index 00000000..f85ce896
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/demo.css
@@ -0,0 +1,2 @@
+/* Style Guide Styles */
+.editTNModal{width:624px \9!important;margin:5% auto}.editTNModal .button--disabled,.editTNModal .button--disabled:active,.editTNModal .button--disabled:hover{background-color:#d3d3d3!important}.editTNModal h2{font-weight:400;line-height:36px}.editTNModal h6{line-height:15px;font-size:12px;font-family:omnes_att_regular;font-weight:400;margin-bottom:3px}.editTNModal label{font-size:11px;font-family:omnes_att_regular;margin-bottom:0;font-weight:400}.editTNModal .icon-circle-action-close{font-size:28px}.editTNModal .saveTNs-container button{margin-left:10px}.editTNModal .middleBlock{margin-top:89px}.editTNModal .editSettings{width:85% \9}.editTNModal .editSettings label{font-family:omnes_att_bold}.editTNModal .editSettings .ng-isolate-scope{position:relative}.editTNModal .editSettings .save-cnam-lidb button{margin-left:10px}.editTNModal .editSettings .col-md-16{width:68% \9}.editTNModal .size-threefourth{width:75%}.editTNModal .alt-rows{height:293px;background:#fff;border:1px solid #BBB;margin-left:0;border-radius:5px;overflow-x:hidden;overflow-y:auto}.editTNModal .alt-rows li.even{background-color:#f2f2f2}.editTNModal .alt-rows li.item-selected{background-color:#0091d9}.editTNModal .alt-rows li.item-selected a{color:#fff}.editTNModal .alt-rows li a{display:block;padding:11px 0 11px 10px;font-size:12px;color:#444;line-height:15px}.editTNModal .alt-rows li a:focus{text-decoration:none}.editTNModal .alt-rows .scroll-viewport{height:100%}.editTNModal .leftBlock button,.editTNModal .rightBlock button{min-width:100%!important;padding:8px 10px;width:100%;margin-left:-1px}.editTNModal .leftBlock .form-field input[type=text],.editTNModal .rightBlock .form-field input[type=text]{border-radius:6px 0 0 6px}.editTNModal .middleBlock button{width:110px}.editTNModal .newCNAM span.text-right{display:block;font-size:11px}.margin-bottom20{margin-bottom:20px}.margin-bottom10{margin-bottom:10px}.margin-bottom30{margin-bottom:30px}.margin-bottom40{margin-bottom:40px}.margin-bottom80{margin-bottom:80px}.drawer{margin-left:20%;margin-right:20%}.drawer .title{font-family:omnes_att_regular;font-size:36px;margin:0;border-top:26px solid #fff}.drawer .containerContent{font-family:clearview_att_regular;font-size:14px;margin:0;margin-top:20px;margin-bottom:25px}.drawer .smallText{font-family:clearview_att_regular;font-size:12px;margin:0;margin-bottom:7px}.drawer .textCount{font-family:clearview_att_regular;font-size:12px;text-align:right;margin-right:42%}.drawer .cancelButton{background-color:#000}.drawer .datepicker1{width:200px;height:40px;margin:0;margin-bottom:5px}.att-drawer{background-color:#fff;box-shadow:0 4px 5px rgba(0,0,0,.2),inset 0 1px rgba(0,0,0,.3);-webkit-box-shadow:0 4px 5px rgba(0,0,0,.2),inset 0 1px rgba(0,0,0,.3);-moz-box-shadow:0 4px 5px rgba(0,0,0,.2),inset 0 1px rgba(0,0,0,.3)}.drawer-backdrop{position:absolute;top:0;right:0;bottom:0;left:0;background:rgba(255,255,255,.6);z-index:999}#divider-lines .divider-container{padding:20px 40px;background:#f2f2f2}#divider-lines .divider-container-light{background-color:#fff}#tooltips-and-hints .att-tooltip{z-index:0;margin:0}.popover-packages.att-tooltip{border:0;padding:0}.popover-packages__container{background:#fff}.popover-packages__header{background:#0574ac;height:150px;padding:50px;position:relative;text-align:center;width:100%}.popover-packages__header h3{color:#fff;margin:0}.popover-packages__text-block{background:0 0;overflow:hidden;padding:50px}.popover-packages__text-block-row{float:left;width:100%}.text-block-row__title{float:left;margin-bottom:10px;width:auto}.text-block-row__info{float:right;margin-bottom:10px;width:auto}.popover-packages__text-block-price{float:left;margin-top:30px;width:100%}.text-block-price__title{float:left;font-family:Arial;margin-bottom:10px;width:auto}.text-block-price__price{float:right;margin-bottom:10px;position:relative;width:auto}pre.code-preview{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857;word-break:break-all;word-wrap:break-word;color:#333;background-color:#f5f5f5;border:1px solid #ccc;border-radius:6px}.popover-demo-container [data-preview-element]{height:auto}.popover-demo{position:relative}.popover-demo.att-popover{max-width:320px}.popover-demo .att-popover-content{display:block!important}.popover-demo .popover-packages__container{background:0 0}.popover-demo .popover-packages__container p{color:#444}.popover-demo .popover-packages__text-block{padding:5px 0 0}.popover-demo .popover-packages__text-block-row p{font-size:12px}.popover-demo hr{border-bottom:1px solid #b2b2b2;margin:10px 0 25px}.price--large{font-size:2.25rem;font-family:omnes_att_light;line-height:36px;word-spacing:2px;letter-spacing:-1px}.price--large sup{font-size:1.125rem;line-height:22px;letter-spacing:0;font-family:omnes_att_light;margin:0 2px;top:-11px;vertical-align:baseline}.price--large sup:nth-child(2):before{clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px);content:'.';display:inline;height:1px;overflow:hidden;position:absolute;width:1px}.bg-standard{background-color:#f2f2f2}.margin-top{margin-top:10px} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/dtpk.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/dtpk.css
new file mode 100644
index 00000000..194c849f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/dtpk.css
@@ -0,0 +1,9 @@
+/*!
+ * Datepicker for Bootstrap
+ *
+ * Copyright 2012 Stefan Petre
+ * Improvements by Andrew Rowls
+ * Licensed under the Apache License v2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */.jshook-return-focus-here{display:block}.datepicker table tr td.days.range.from .day,.datepicker table tr td.days.range.to .day,.range-inherit{color:#fff;background-color:#067ab4}.greyBorder{border-top:solid 1px #d3d3d3}.datepicker{background-color:#fff;padding:0;border-radius:5px;direction:ltr;outline:0;margin:0;width:300px}.datepicker.datepicker-rtl{direction:rtl}.datepicker .weekday{height:21px;margin:0 auto;font-family:clearview_att_regular;font-size:14px;line-height:20px;color:#444}.datepicker .icons-list{margin-top:0;cursor:pointer}.datepicker .icons-list .disabled{color:#d3d3d3;cursor:default}.datepicker table{padding:16px 10px;border-spacing:0;border-collapse:separate;font-family:clearview_att_regular;width:auto;margin:0}.datepicker table th.datepicker-switch{width:198px;font-size:14px;font-weight:400;line-height:20px;padding-bottom:13px;font-family:clearview_att_regular;color:#444;cursor:default!important}.datepicker table th.datepicker-switch.internal{padding-bottom:5px}.datepicker table tr td.days{background-color:#fff;color:#444;font-size:14px;width:32px;text-align:center;overflow:hidden}.datepicker table tr td.days.weekend{background-color:#f2f2f2}.datepicker table tr td.days.weekend.disabled .day:hover{background-color:#f2f2f2!important}.datepicker table tr td.days.disabled{color:#d3d3d3}.datepicker table tr td.days.disabled .day:hover{background-color:#fff;color:#d3d3d3;outline:0;cursor:default}.datepicker table tr td.days .day{width:30px;height:29;display:block;line-height:28px;border-radius:100%}.datepicker table tr td.days .day:hover{background-color:#bbb;color:#444;cursor:pointer;outline:2px solid #bbb;outline-offset:2px;-moz-outline-radius:100%}.datepicker table tr td.days.active{background-color:#067ab4;color:#fff;border-radius:100%}.datepicker table tr td.days.active .day:hover{cursor:default}.datepicker table tr td.days.range{background-color:#44c8f5}.datepicker table tr td.days.range.from{border-radius:20px 0 0 20px}.datepicker table tr td.days.range.from .day:hover{cursor:default}.datepicker table tr td.days.range.to{border-radius:0 20px 20px 0}.datepicker table tr td.days.range.to .day:hover{cursor:default}.datepicker table tr td.days.range .day{color:#444}.datepicker table tr td.days.range .day:hover{background-color:#bbb;color:#444}.datepicker table tr td.days.next-month,.datepicker table tr td.days.prev-month{color:#fff;opacity:0}.datepicker table tr td.days.next-month .day:hover,.datepicker table tr td.days.prev-month .day:hover{background-color:#fff!important;color:#fff;outline:0;cursor:default;opacity:0}.datepicker table tr td.today{color:#444;text-decoration:underline;-moz-text-decoration-color:#444;text-decoration-color:#444}.datepicker .dow{height:23px;width:31px;font-weight:400;position:relative;border-top:solid 1px #bbb;border-bottom:solid 1px #bbb;margin-top:13px}.datepicker .dow .hidden-spoken{display:block;letter-spacing:-6px;overflow:hidden;position:absolute;top:5px;left:17px}.datepicker .due-date:after{border:2px solid #cf2a2a;border-radius:100%;content:" ";display:block;height:30px;left:3px;position:absolute;top:2px;width:30px;text-indent:-9999px;-webkit-box-sizing:content-box!important;-moz-box-sizing:content-box!important;box-sizing:content-box!important}.datepicker .due-date.old:after{visibility:hidden}.datepicker .due-date.active:after{border-color:#fff}.datepicker .due-date.active.focused{color:#0577b2!important}.datepicker .due-date.active.focused:after{border-color:#cf2a2a!important}.datepicker i.legend-due-date{border:1px solid #ccc;height:20px;width:20px;display:inline-block;margin-right:5px;margin-top:4px;position:absolute;left:0;top:0}.datepicker i.legend-due-date:after{border:1px solid #cf2a2a;border-radius:100%;display:block;content:" ";height:16px;left:1px;position:absolute;top:1px;width:16px;text-indent:-9999px}.datepicker .calendar-legend li{position:relative;padding-left:30px;padding-top:5px;margin-bottom:5px;font-weight:400;font-size:12px}.monthpicker table{width:100%}.monthpicker table tr td.days{width:33%;padding:0}.monthpicker .datepicker-switch{padding:0}.monthpicker table tr td.days.active{border-radius:25px}.monthpicker table tr td.days .day{line-height:20px;width:auto;border-radius:25px}.monthpicker table tr td.days .day:hover{border-radius:20px;-moz-outline-radius:20px}.monthpicker .monthtable-condensed{border-spacing:0 5px}.monthpicker .divider td{padding:0}.monthpicker .divider hr{margin:10px 0}.calendar.monthpicker .btnContainer{margin:8px 0}.calendar.monthpicker ul.select2-results.sttings li:last-child{margin-bottom:0}.calendar.monthpicker .btnContainer div{margin:12px 0}.calendar{position:relative;display:inline-block;width:270px}.calendar .box{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;margin:0;position:relative;zoom:1;vertical-align:middle;display:inline-block}.calendar .box.active{z-index:0}.calendar .box.active input[type=text]{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important;border:solid 1px #067ab4;border-bottom:1px solid lightgrey}.calendar .calendar-icon{cursor:pointer;background:url(images/calendar-icon.png) no-repeat right top;width:30px;z-index:100;height:30px;position:absolute;right:3px;top:5px;background-color:#fff;background-size:30px 30px}.calendar .datepicker-wrapper{height:auto;width:302px;border:solid 1px #067ab4;background:none repeat scroll 0 0 #fff;border-radius:0 0 6px 6px;border-top:1px solid lightgrey;margin-top:-2px;z-index:1000;position:absolute;-webkit-box-shadow:rgba(0,0,0,.25) 0 8px 10px -3px;-moz-box-shadow:rgba(0,0,0,.25) 0 8px 10px -3px;box-shadow:rgba(0,0,0,.25) 0 8px 10px -3px}.calendar .datepicker-wrapper.show-right{right:-301px;border-bottom-left-radius:0!important;border-left:1px solid lightgrey;border-top:solid 1px #067ab4;top:41px}.calendar .datepicker-wrapper.datepicker-wrapper-display-none{display:none}.calendar .select2-results{border-radius:0;margin:0;overflow:hidden}.calendar .select2-result:focus{background:#1792D6!important;color:#fff!important}.calendar .select2-results.options{box-shadow:none}.calendar ul.select2-results.options li:last-child{margin-bottom:0}.calendar ul.select2-results.options li .disabled{color:#a0a0a0}.calendar ul.select2-results.sttings li:last-child{margin-bottom:35px}.btnContainer{line-height:14px;margin:9px 0 0;padding:8px 10px}.btnContainer div{margin-top:35px}.datepicker-inline{width:220px}.datepicker-dropdown{top:0;left:0}.datepicker-dropdown:before{content:" ";display:inline-block;border-left:12px solid transparent;border-right:12px solid transparent;border-bottom:12px solid #ccc;border-top:0;border-bottom-color:rgba(0,0,0,.2);position:absolute}.datepicker-dropdown:after{content:" ";display:inline-block;border-left:12px solid transparent;border-right:12px solid transparent;border-bottom:12px solid #fff;border-top:0;position:absolute}.datepicker-dropdown.datepicker-orient-left:after,.datepicker-dropdown.datepicker-orient-left:before{left:58px}.datepicker-dropdown.datepicker-orient-right:after,.datepicker-dropdown.datepicker-orient-right:before{right:58px}.datepicker-dropdown.datepicker-orient-top:before{top:-13px}.datepicker-dropdown.datepicker-orient-top:after{top:-12px}.datepicker-dropdown.datepicker-orient-bottom:before{bottom:-7px;border-bottom:0;border-top:7px solid #999}.datepicker-dropdown.datepicker-orient-bottom:after{bottom:-6px;border-bottom:0;border-top:6px solid #fff}.datepicker>div{display:none}.datepicker.days div.datepicker-days,.datepicker.months div.datepicker-months,.datepicker.years div.datepicker-years{display:block}.datepicker .next{padding-bottom:13px;background-size:10px 15px;background-position:10px 12px;background-repeat:no-repeat;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAKQWlDQ1BJQ0MgUHJvZmlsZQAASA2dlndUU9kWh8+9N73QEiIgJfQaegkg0jtIFQRRiUmAUAKGhCZ2RAVGFBEpVmRUwAFHhyJjRRQLg4Ji1wnyEFDGwVFEReXdjGsJ7601896a/cdZ39nnt9fZZ+9917oAUPyCBMJ0WAGANKFYFO7rwVwSE8vE9wIYEAEOWAHA4WZmBEf4RALU/L09mZmoSMaz9u4ugGS72yy/UCZz1v9/kSI3QyQGAApF1TY8fiYX5QKUU7PFGTL/BMr0lSkyhjEyFqEJoqwi48SvbPan5iu7yZiXJuShGlnOGbw0noy7UN6aJeGjjAShXJgl4GejfAdlvVRJmgDl9yjT0/icTAAwFJlfzOcmoWyJMkUUGe6J8gIACJTEObxyDov5OWieAHimZ+SKBIlJYqYR15hp5ejIZvrxs1P5YjErlMNN4Yh4TM/0tAyOMBeAr2+WRQElWW2ZaJHtrRzt7VnW5mj5v9nfHn5T/T3IevtV8Sbsz55BjJ5Z32zsrC+9FgD2JFqbHbO+lVUAtG0GQOXhrE/vIADyBQC03pzzHoZsXpLE4gwnC4vs7GxzAZ9rLivoN/ufgm/Kv4Y595nL7vtWO6YXP4EjSRUzZUXlpqemS0TMzAwOl89k/fcQ/+PAOWnNycMsnJ/AF/GF6FVR6JQJhIlou4U8gViQLmQKhH/V4X8YNicHGX6daxRodV8AfYU5ULhJB8hvPQBDIwMkbj96An3rWxAxCsi+vGitka9zjzJ6/uf6Hwtcim7hTEEiU+b2DI9kciWiLBmj34RswQISkAd0oAo0gS4wAixgDRyAM3AD3iAAhIBIEAOWAy5IAmlABLJBPtgACkEx2AF2g2pwANSBetAEToI2cAZcBFfADXALDIBHQAqGwUswAd6BaQiC8BAVokGqkBakD5lC1hAbWgh5Q0FQOBQDxUOJkBCSQPnQJqgYKoOqoUNQPfQjdBq6CF2D+qAH0CA0Bv0BfYQRmALTYQ3YALaA2bA7HAhHwsvgRHgVnAcXwNvhSrgWPg63whfhG/AALIVfwpMIQMgIA9FGWAgb8URCkFgkAREha5EipAKpRZqQDqQbuY1IkXHkAwaHoWGYGBbGGeOHWYzhYlZh1mJKMNWYY5hWTBfmNmYQM4H5gqVi1bGmWCesP3YJNhGbjS3EVmCPYFuwl7ED2GHsOxwOx8AZ4hxwfrgYXDJuNa4Etw/XjLuA68MN4SbxeLwq3hTvgg/Bc/BifCG+Cn8cfx7fjx/GvyeQCVoEa4IPIZYgJGwkVBAaCOcI/YQRwjRRgahPdCKGEHnEXGIpsY7YQbxJHCZOkxRJhiQXUiQpmbSBVElqIl0mPSa9IZPJOmRHchhZQF5PriSfIF8lD5I/UJQoJhRPShxFQtlOOUq5QHlAeUOlUg2obtRYqpi6nVpPvUR9Sn0vR5Mzl/OX48mtk6uRa5Xrl3slT5TXl3eXXy6fJ18hf0r+pvy4AlHBQMFTgaOwVqFG4bTCPYVJRZqilWKIYppiiWKD4jXFUSW8koGStxJPqUDpsNIlpSEaQtOledK4tE20Otpl2jAdRzek+9OT6cX0H+i99AllJWVb5SjlHOUa5bPKUgbCMGD4M1IZpYyTjLuMj/M05rnP48/bNq9pXv+8KZX5Km4qfJUilWaVAZWPqkxVb9UU1Z2qbapP1DBqJmphatlq+9Uuq43Pp893ns+dXzT/5PyH6rC6iXq4+mr1w+o96pMamhq+GhkaVRqXNMY1GZpumsma5ZrnNMe0aFoLtQRa5VrntV4wlZnuzFRmJbOLOaGtru2nLdE+pN2rPa1jqLNYZ6NOs84TXZIuWzdBt1y3U3dCT0svWC9fr1HvoT5Rn62fpL9Hv1t/ysDQINpgi0GbwaihiqG/YZ5ho+FjI6qRq9Eqo1qjO8Y4Y7ZxivE+41smsImdSZJJjclNU9jU3lRgus+0zwxr5mgmNKs1u8eisNxZWaxG1qA5wzzIfKN5m/krCz2LWIudFt0WXyztLFMt6ywfWSlZBVhttOqw+sPaxJprXWN9x4Zq42Ozzqbd5rWtqS3fdr/tfTuaXbDdFrtOu8/2DvYi+yb7MQc9h3iHvQ732HR2KLuEfdUR6+jhuM7xjOMHJ3snsdNJp9+dWc4pzg3OowsMF/AX1C0YctFx4bgccpEuZC6MX3hwodRV25XjWuv6zE3Xjed2xG3E3dg92f24+ysPSw+RR4vHlKeT5xrPC16Il69XkVevt5L3Yu9q76c+Oj6JPo0+E752vqt9L/hh/QL9dvrd89fw5/rX+08EOASsCegKpARGBFYHPgsyCRIFdQTDwQHBu4IfL9JfJFzUFgJC/EN2hTwJNQxdFfpzGC4sNKwm7Hm4VXh+eHcELWJFREPEu0iPyNLIR4uNFksWd0bJR8VF1UdNRXtFl0VLl1gsWbPkRoxajCCmPRYfGxV7JHZyqffS3UuH4+ziCuPuLjNclrPs2nK15anLz66QX8FZcSoeGx8d3xD/iRPCqeVMrvRfuXflBNeTu4f7kufGK+eN8V34ZfyRBJeEsoTRRJfEXYljSa5JFUnjAk9BteB1sl/ygeSplJCUoykzqdGpzWmEtPi000IlYYqwK10zPSe9L8M0ozBDuspp1e5VE6JA0ZFMKHNZZruYjv5M9UiMJJslg1kLs2qy3mdHZZ/KUcwR5vTkmuRuyx3J88n7fjVmNXd1Z752/ob8wTXuaw6thdauXNu5Tnddwbrh9b7rj20gbUjZ8MtGy41lG99uit7UUaBRsL5gaLPv5sZCuUJR4b0tzlsObMVsFWzt3WazrWrblyJe0fViy+KK4k8l3JLr31l9V/ndzPaE7b2l9qX7d+B2CHfc3em681iZYlle2dCu4F2t5czyovK3u1fsvlZhW3FgD2mPZI+0MqiyvUqvakfVp+qk6oEaj5rmvep7t+2d2sfb17/fbX/TAY0DxQc+HhQcvH/I91BrrUFtxWHc4azDz+ui6rq/Z39ff0TtSPGRz0eFR6XHwo911TvU1zeoN5Q2wo2SxrHjccdv/eD1Q3sTq+lQM6O5+AQ4ITnx4sf4H++eDDzZeYp9qukn/Z/2ttBailqh1tzWibakNml7THvf6YDTnR3OHS0/m/989Iz2mZqzymdLz5HOFZybOZ93fvJCxoXxi4kXhzpXdD66tOTSna6wrt7LgZevXvG5cqnbvfv8VZerZ645XTt9nX297Yb9jdYeu56WX+x+aem172296XCz/ZbjrY6+BX3n+l37L972un3ljv+dGwOLBvruLr57/17cPel93v3RB6kPXj/Mejj9aP1j7OOiJwpPKp6qP6391fjXZqm99Oyg12DPs4hnj4a4Qy//lfmvT8MFz6nPK0a0RupHrUfPjPmM3Xqx9MXwy4yX0+OFvyn+tveV0auffnf7vWdiycTwa9HrmT9K3qi+OfrW9m3nZOjk03dp76anit6rvj/2gf2h+2P0x5Hp7E/4T5WfjT93fAn88ngmbWbm3/eE8/syOll+AAAACXBIWXMAAAsTAAALEwEAmpwYAAABPElEQVRIDa3VvWoCQRiFYY0mRS4otelSxFICFilSqTeQOzFWFhYi2IlFOu8qRVD0vOLA8DG/u35wGGdn5tlhR9fu4/euY2qq/kAZKyelqvpmNtj8du2o9lOpQh9ui2l8jD47XCk9OqXlQIu59dUoYAxrhAK+uZWJtningCNln8DcUBEK+K98KAe3MtGCLpVubA4g9ae8KyUoXyW+WkHUgRqvQicx1AfvglqwNRoCW6ExsDFqXw5Afvmn/+IPBD5zUJ3UDgNr8pdy4LMIfkW53XGnhTJLgQ57ZXamrpjmnGNgI4ybhsDGWAhshVmwNeaDNdhKC2fKGcAWz/BJ2Sglp7nWvC8liOn69VC2aod0MgWW/Vtlh78ZiOEijImAPwrPJFbFGAAgFUOrMCAHhtBqDMS+vtgpNVCyB8BEWxf/bU+NW/VoOgAAAABJRU5ErkJggg==)}@media \0screen\,screen\8{.datepicker .next{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAPCAYAAADd/14OAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMNJREFUeNpiZC3fxAAEykA8CYhbgPg4AxbABMRqQLwBiL2AeCUQG+FSOBWIdaB8WSDeiE0xSGErEL9GEpOBKjZAV3gAiIOwKN6AZBNYIQgcwaJYHog3wxQzIUnAFD9CElOAKjZmZraJRHYKSBEzELshiQkAsToTmudsgDgPTewBEBezoClaB8SiaIp8gfgKEx5FD2GKYJ5xwKLoCRAHwBTBFFZjUeQPxBfQAzwbSedjqKJz2KLwFtSabUAcjk0RCAAEGADBuyhEiJHd4gAAAABJRU5ErkJggg==)}}.datepicker .prev{background-size:10px 15px;background-position:20px 12px;background-repeat:no-repeat;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAKQWlDQ1BJQ0MgUHJvZmlsZQAASA2dlndUU9kWh8+9N73QEiIgJfQaegkg0jtIFQRRiUmAUAKGhCZ2RAVGFBEpVmRUwAFHhyJjRRQLg4Ji1wnyEFDGwVFEReXdjGsJ7601896a/cdZ39nnt9fZZ+9917oAUPyCBMJ0WAGANKFYFO7rwVwSE8vE9wIYEAEOWAHA4WZmBEf4RALU/L09mZmoSMaz9u4ugGS72yy/UCZz1v9/kSI3QyQGAApF1TY8fiYX5QKUU7PFGTL/BMr0lSkyhjEyFqEJoqwi48SvbPan5iu7yZiXJuShGlnOGbw0noy7UN6aJeGjjAShXJgl4GejfAdlvVRJmgDl9yjT0/icTAAwFJlfzOcmoWyJMkUUGe6J8gIACJTEObxyDov5OWieAHimZ+SKBIlJYqYR15hp5ejIZvrxs1P5YjErlMNN4Yh4TM/0tAyOMBeAr2+WRQElWW2ZaJHtrRzt7VnW5mj5v9nfHn5T/T3IevtV8Sbsz55BjJ5Z32zsrC+9FgD2JFqbHbO+lVUAtG0GQOXhrE/vIADyBQC03pzzHoZsXpLE4gwnC4vs7GxzAZ9rLivoN/ufgm/Kv4Y595nL7vtWO6YXP4EjSRUzZUXlpqemS0TMzAwOl89k/fcQ/+PAOWnNycMsnJ/AF/GF6FVR6JQJhIlou4U8gViQLmQKhH/V4X8YNicHGX6daxRodV8AfYU5ULhJB8hvPQBDIwMkbj96An3rWxAxCsi+vGitka9zjzJ6/uf6Hwtcim7hTEEiU+b2DI9kciWiLBmj34RswQISkAd0oAo0gS4wAixgDRyAM3AD3iAAhIBIEAOWAy5IAmlABLJBPtgACkEx2AF2g2pwANSBetAEToI2cAZcBFfADXALDIBHQAqGwUswAd6BaQiC8BAVokGqkBakD5lC1hAbWgh5Q0FQOBQDxUOJkBCSQPnQJqgYKoOqoUNQPfQjdBq6CF2D+qAH0CA0Bv0BfYQRmALTYQ3YALaA2bA7HAhHwsvgRHgVnAcXwNvhSrgWPg63whfhG/AALIVfwpMIQMgIA9FGWAgb8URCkFgkAREha5EipAKpRZqQDqQbuY1IkXHkAwaHoWGYGBbGGeOHWYzhYlZh1mJKMNWYY5hWTBfmNmYQM4H5gqVi1bGmWCesP3YJNhGbjS3EVmCPYFuwl7ED2GHsOxwOx8AZ4hxwfrgYXDJuNa4Etw/XjLuA68MN4SbxeLwq3hTvgg/Bc/BifCG+Cn8cfx7fjx/GvyeQCVoEa4IPIZYgJGwkVBAaCOcI/YQRwjRRgahPdCKGEHnEXGIpsY7YQbxJHCZOkxRJhiQXUiQpmbSBVElqIl0mPSa9IZPJOmRHchhZQF5PriSfIF8lD5I/UJQoJhRPShxFQtlOOUq5QHlAeUOlUg2obtRYqpi6nVpPvUR9Sn0vR5Mzl/OX48mtk6uRa5Xrl3slT5TXl3eXXy6fJ18hf0r+pvy4AlHBQMFTgaOwVqFG4bTCPYVJRZqilWKIYppiiWKD4jXFUSW8koGStxJPqUDpsNIlpSEaQtOledK4tE20Otpl2jAdRzek+9OT6cX0H+i99AllJWVb5SjlHOUa5bPKUgbCMGD4M1IZpYyTjLuMj/M05rnP48/bNq9pXv+8KZX5Km4qfJUilWaVAZWPqkxVb9UU1Z2qbapP1DBqJmphatlq+9Uuq43Pp893ns+dXzT/5PyH6rC6iXq4+mr1w+o96pMamhq+GhkaVRqXNMY1GZpumsma5ZrnNMe0aFoLtQRa5VrntV4wlZnuzFRmJbOLOaGtru2nLdE+pN2rPa1jqLNYZ6NOs84TXZIuWzdBt1y3U3dCT0svWC9fr1HvoT5Rn62fpL9Hv1t/ysDQINpgi0GbwaihiqG/YZ5ho+FjI6qRq9Eqo1qjO8Y4Y7ZxivE+41smsImdSZJJjclNU9jU3lRgus+0zwxr5mgmNKs1u8eisNxZWaxG1qA5wzzIfKN5m/krCz2LWIudFt0WXyztLFMt6ywfWSlZBVhttOqw+sPaxJprXWN9x4Zq42Ozzqbd5rWtqS3fdr/tfTuaXbDdFrtOu8/2DvYi+yb7MQc9h3iHvQ732HR2KLuEfdUR6+jhuM7xjOMHJ3snsdNJp9+dWc4pzg3OowsMF/AX1C0YctFx4bgccpEuZC6MX3hwodRV25XjWuv6zE3Xjed2xG3E3dg92f24+ysPSw+RR4vHlKeT5xrPC16Il69XkVevt5L3Yu9q76c+Oj6JPo0+E752vqt9L/hh/QL9dvrd89fw5/rX+08EOASsCegKpARGBFYHPgsyCRIFdQTDwQHBu4IfL9JfJFzUFgJC/EN2hTwJNQxdFfpzGC4sNKwm7Hm4VXh+eHcELWJFREPEu0iPyNLIR4uNFksWd0bJR8VF1UdNRXtFl0VLl1gsWbPkRoxajCCmPRYfGxV7JHZyqffS3UuH4+ziCuPuLjNclrPs2nK15anLz66QX8FZcSoeGx8d3xD/iRPCqeVMrvRfuXflBNeTu4f7kufGK+eN8V34ZfyRBJeEsoTRRJfEXYljSa5JFUnjAk9BteB1sl/ygeSplJCUoykzqdGpzWmEtPi000IlYYqwK10zPSe9L8M0ozBDuspp1e5VE6JA0ZFMKHNZZruYjv5M9UiMJJslg1kLs2qy3mdHZZ/KUcwR5vTkmuRuyx3J88n7fjVmNXd1Z752/ob8wTXuaw6thdauXNu5Tnddwbrh9b7rj20gbUjZ8MtGy41lG99uit7UUaBRsL5gaLPv5sZCuUJR4b0tzlsObMVsFWzt3WazrWrblyJe0fViy+KK4k8l3JLr31l9V/ndzPaE7b2l9qX7d+B2CHfc3em681iZYlle2dCu4F2t5czyovK3u1fsvlZhW3FgD2mPZI+0MqiyvUqvakfVp+qk6oEaj5rmvep7t+2d2sfb17/fbX/TAY0DxQc+HhQcvH/I91BrrUFtxWHc4azDz+ui6rq/Z39ff0TtSPGRz0eFR6XHwo911TvU1zeoN5Q2wo2SxrHjccdv/eD1Q3sTq+lQM6O5+AQ4ITnx4sf4H++eDDzZeYp9qukn/Z/2ttBailqh1tzWibakNml7THvf6YDTnR3OHS0/m/989Iz2mZqzymdLz5HOFZybOZ93fvJCxoXxi4kXhzpXdD66tOTSna6wrt7LgZevXvG5cqnbvfv8VZerZ645XTt9nX297Yb9jdYeu56WX+x+aem172296XCz/ZbjrY6+BX3n+l37L972un3ljv+dGwOLBvruLr57/17cPel93v3RB6kPXj/Mejj9aP1j7OOiJwpPKp6qP6391fjXZqm99Oyg12DPs4hnj4a4Qy//lfmvT8MFz6nPK0a0RupHrUfPjPmM3Xqx9MXwy4yX0+OFvyn+tveV0auffnf7vWdiycTwa9HrmT9K3qi+OfrW9m3nZOjk03dp76anit6rvj/2gf2h+2P0x5Hp7E/4T5WfjT93fAn88ngmbWbm3/eE8/syOll+AAAACXBIWXMAAAsTAAALEwEAmpwYAAABOElEQVRIDa3WsW7CMBAG4AQoQx+InY2hK1XFwMBEeYG+CenEkKES6tZ2YCNzH4gBCdH/rzjLsRz7THzSL5Lo/CnJKSTlw9tXcUcNseYDaZAKMTUyW/oNYjXyfAtXGnTAvYQSbGGt2WL7VfZTQB8mjkG1lxzCbLTQnKEGE3QWA1Owb6jzEFiiYYfYA5AzcX+POPCCnLtAYrzRSyRWxJ6QExt9oGBrNkSqhbHXBXthLtgbs8EsmIDZMAE5Tc0AftFnpsnFvnKH4utJOkZwg7wrVk3Q84M8hnoJXhEtOkVvEJVLzoYKyKvIgtpgFtQFe6M+0EZr7kSqNagukAbv6Qrh6zJWRPfIOAQSuSD8T9SgfIo+YyB6ktCDBtSifDgqLRhD/zE2pYBdqMHYoH3Rs1dKBsW1DWK+a9jwB9DuTqWp5mUgAAAAAElFTkSuQmCC)}@media \0screen\,screen\8{.datepicker .prev{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAPCAYAAADd/14OAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAALxJREFUeNpiZC3fxIADWAJxDRDnAfFdFhyKjIB4JRDLArEcEAez4FC0EYhloHwdIJ7KhKbIAE0RCLwG4lZkE0E6N2BRFATER5iQFG0GYnlsikAckEJjqCIFJEWPkBXBFPaiKQKBSciKYAqLgfgBmkJQ2NmgKzwLxL5oikFhtw5ZMcwzV6CKHyIpFkVWjByOIMUBQPwEi2IH9AC/AMT+WBRXM2GJwnNQxY+RbMpmwpEoQIrDgXgb1Dm3AAIMALk+J8MvzLwTAAAAAElFTkSuQmCC)}}.datepicker .cw{font-size:10px;width:12px;padding:0 2px 0 5px;vertical-align:middle}.datepicker thead tr:first-child th.cw{cursor:default;background-color:transparent}.input-group.date .input-group-addon i{cursor:pointer;width:16px;height:16px}.datepicker.dropdown-menu{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;top:100%;left:0;float:left;display:none;margin-top:5px;width:290px;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:5px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;color:#333;font-size:13px;line-height:1.428571429;z-index:1050}.datepicker.dropdown-menu td,.datepicker.dropdown-menu th{padding:4px 5px;display:block;position:relative;float:left}.datepicker .text-left{width:100%}.hidden-spoken,.hidden-text-spoken{position:absolute!important;clip:rect(0 0 0 0)!important;width:1px!important;height:1px!important;padding:0!important;overflow:hidden!important;border:0!important;letter-spacing:0;line-height:0}#dateFilterList .scroll-viewport{height:120px;width:100%}#dateFilterList .scroll-bar.disable+div.scroll-viewport{width:268px}#dateFilterList .scroll-bar{width:6px;background-color:#fff}#dateFilterList .scroll-thumb{width:4px;background-color:#999}#datepickerBody .scroll-bar{right:-8px;width:6px;background-color:#fff}#datepickerBody .scroll-thumb{width:4px;background-color:#999}#datepickerBody .scroll-viewport{height:218px;width:280px}.monthpicker #datepickerBody .scroll-viewport{height:208px} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/frms.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/frms.css
new file mode 100644
index 00000000..ce1c42d2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/frms.css
@@ -0,0 +1 @@
+@charset "UTF-8";address,blockquote,dd,h1,h2,h3,h4,h5,h6,ol,p,pre,table,ul{margin:0;padding:0;margin-bottom:24px;margin-bottom:1.5rem}html{font-size:1em;line-height:1.5}body{margin:0}h1{font-size:48px;font-size:3rem;line-height:1}h2{font-size:36px;font-size:2.25rem;line-height:1.3333333333}h3{font-size:30px;font-size:1.875rem;line-height:1.6}h4{font-size:24px;font-size:1.5rem;line-height:1}h5{font-size:20px;font-size:1.25rem;line-height:1.2}h6{font-size:18px;font-size:1.125rem;line-height:1.3333333333}dd,ol,ul{margin-left:48px;margin-left:3rem}li>ol,li>ul{margin-bottom:0}code,kbd,pre,samp{font-family:monospace,monospace}blockquote{text-indent:-.41em;quotes:"“" "â€";margin-left:48px;margin-left:3rem}blockquote p:before{content:"“";content:open-quote}blockquote p:after{content:"";content:no-close-quote}blockquote p:last-of-type:after{content:"â€";content:close-quote}q{quotes:"‘" "’" "“" "â€"}q:before{content:"‘";content:open-quote}q:after{content:"’";content:close-quote}q q:before{content:"“";content:open-quote}q q:after{content:"â€";content:close-quote}q:first-child{display:inline-block;text-indent:-.22em}table{width:100%;border-collapse:collapse;border-spacing:0}td,th{padding:12px}#grid{position:absolute;top:0;left:50%;width:980px;margin-left:-490px;counter-reset:section;z-index:9999!important;pointer-events:none;outline:1px solid rgba(0,206,209,.1)}#grid:after{position:fixed;top:0;left:0;content:'Column: 20px Gutter: 20px Margin: 20px';display:block;max-width:90px;padding:3px;background-color:#000;color:#fff;font-size:10px;font-family:monospace;z-index:9999}#grid div.vert{width:20px;outline:solid rgba(0,206,209,.3);outline-width:1px;margin-right:20px;position:relative;background:rgba(255,0,0,.05);counter-increment:section}#grid div.vert.first-line{margin-left:20px}#grid div.vert::after{position:fixed;display:block;text-align:center;color:#fff;width:20px;content:counter(section);top:5px;font-size:8px;font-family:monospace}#grid div.vert:nth-child(24){position:absolute;top:0;right:0}#grid div.vert:nth-child(1),#grid div.vert:nth-child(10),#grid div.vert:nth-child(11),#grid div.vert:nth-child(12),#grid div.vert:nth-child(13),#grid div.vert:nth-child(14),#grid div.vert:nth-child(15),#grid div.vert:nth-child(16),#grid div.vert:nth-child(17),#grid div.vert:nth-child(18),#grid div.vert:nth-child(19),#grid div.vert:nth-child(2),#grid div.vert:nth-child(20),#grid div.vert:nth-child(21),#grid div.vert:nth-child(22),#grid div.vert:nth-child(23),#grid div.vert:nth-child(24),#grid div.vert:nth-child(3),#grid div.vert:nth-child(4),#grid div.vert:nth-child(5),#grid div.vert:nth-child(6),#grid div.vert:nth-child(7),#grid div.vert:nth-child(8),#grid div.vert:nth-child(9){display:inline-block!important}#grid div.vert:nth-child(25),#grid div.vert:nth-child(26),#grid div.vert:nth-child(27),#grid div.vert:nth-child(28),#grid div.vert:nth-child(29),#grid div.vert:nth-child(30),#grid div.vert:nth-child(31){display:none!important}#grid div.horiz{height:10px;border-bottom:1px dotted rgba(100,100,100,.2);margin:0;padding:0}.bg-prime-blue{background-color:#067ab4}.bg-secondary-gray{background-color:#666}.bg-light-blue{background-color:#bcc9d5}.bg-dark-gray{background-color:#444}.bg-dusty-blue{background-color:#97b1cf}.bg-warm-gray{background-color:#cccb9b}.bg-taupe{background-color:#cccb6c}.bg-green-highlight{background-color:#c4d63f}.bg-lime-highlight{background-color:#dad632}.bg-purple-highlight{background-color:#b6539c}.bg-magenta{background-color:#d71481}.bg-blue-highlight{background-color:#4cc8f3}.bg-ochre{background-color:#fab230}.bg-green{background-color:#4fa721}.bg-lime{background-color:#b6bd26}.bg-purple{background-color:#7f0e7c}.bg-burgundy{background-color:#b1103e}.bg-dark-blue{background-color:#0e2875}.bg-gold{background-color:#fd9827}.bg-teal{background-color:#20c6b2}.bg-mint-green{background-color:#9cfecd}.bg-yellow{background-color:#feed35}.bg-white{background-color:#fff}.alt.inline-list>li{display:inline-block;zoom:1;*display:inline;*vertical-align:auto;vertical-align:middle;float:none}.text-upper{text-transform:uppercase!important}body{font-family:clearview_att_regular}.font-showcase h1,.font-showcase h2,.font-showcase h3,.font-showcase h4,.font-showcase h5,.font-showcase h6{font-weight:100;letter-spacing:-1px;margin:10px 0;-webkit-font-smoothing:antialiased}.font-showcase h1{font-family:omnes_att_light;font-size:48px;font-size:3rem;line-height:48px}.font-showcase h2,.price{font-family:omnes_att_light;font-size:36px;font-size:2.25rem;line-height:36px}.font-showcase h3{font-family:omnes_att_regular;font-size:24px;font-size:1.5rem;line-height:28px}.font-showcase h4,.font-showcase h4.font-showcase-font-example,.font-showcase h4.font-showcase-font-name{font-family:clearview_att_regular;font-size:18px;font-size:1.125rem;line-height:22px;-webkit-font-smoothing:antialiased}.font-showcase h5{font-family:clearview_att_regular;font-size:14px;font-size:.875rem;line-height:20px;-webkit-font-smoothing:antialiased}.font-showcase h6{font-family:Arial;font-size:11px;font-size:.6875rem;line-height:30px;font-weight:100;-webkit-font-smoothing:antialiased}.body-copy,.font-showcase p{font-family:clearview_att_regular;font-size:14px;font-size:.875rem;line-height:20px;-webkit-font-smoothing:antialiased}.body-copy-short{font-family:clearview_att_regular;font-size:12px;font-size:.75rem;line-height:15px;-webkit-font-smoothing:antialiased}p [class*=icon]{display:inline-block;vertical-align:middle;margin-top:-4px}.details-label{display:block;font-family:clearview_att_regular;font-size:11px;font-size:.6875rem;line-height:15px}.details-label+.price{line-height:28px}.price{letter-spacing:-1px;-webkit-font-smoothing:antialiased}.price sup{font-size:18px;font-size:1.125rem;vertical-align:baseline;top:-11px;margin:0 2px}.price-alt{font-size:24px;font-size:1.5rem;line-height:24px}.price-alt sup{font-size:12px;font-size:.75rem;top:-8px}.promo-tagline{font-family:omnes_att_medium_italic;font-size:16px;font-size:1rem;line-height:20px;display:inline-block;margin-bottom:5px;-webkit-font-smoothing:antialiased}.promo-text{font-family:clearview_att_italic;font-size:12px;font-size:.75rem;line-height:15px;display:inline-block;margin-bottom:5px;-webkit-font-smoothing:antialiased}.divider,.divider-dark,hr{border:0;border-bottom:1px solid #d3d3d3}.divider-light{border-color:#e5e5e5}dl{font-family:clearview_att_regular;color:#444;font-size:12px;font-size:.75rem}dt{font-family:Arial;font-size:11px;font-size:.6875rem;display:block!important;margin:10px 0 5px!important;width:auto!important;text-transform:uppercase}dt a{font-family:clearview_att_regular;color:#067ab4;text-transform:none}dd{display:inline!important;line-height:20px}[data-highlight]{background-color:#c9e9f9;-webkit-animation:highlight-fade 3s infinite}@-webkit-keyframes highlight-fade{100%,80%{background-color:transparent}}.form-field{margin-bottom:10px}.form-field [class^=icon-]{font-size:14px;font-size:.875rem;-webkit-font-smoothing:antialiased;bottom:0;color:#888;height:40px;line-height:40px;pointer-events:none;position:absolute;right:0;text-align:center;margin-right:2px;margin-left:-1px;width:30px;z-index:3}.form-field,.form-field-input-container{position:relative;display:inline-block;width:270px}.form-field .hide-field,.form-field-input-container .hide-field{display:none}.form-field--has-left-icon .select2-choice .select2-chosen,.form-field--has-left-icon input[type=color],.form-field--has-left-icon input[type=date],.form-field--has-left-icon input[type=datetime-local],.form-field--has-left-icon input[type=datetime],.form-field--has-left-icon input[type=email],.form-field--has-left-icon input[type=month],.form-field--has-left-icon input[type=number],.form-field--has-left-icon input[type=password],.form-field--has-left-icon input[type=search],.form-field--has-left-icon input[type=tel],.form-field--has-left-icon input[type=text],.form-field--has-left-icon input[type=time],.form-field--has-left-icon input[type=url],.form-field--has-left-icon input[type=week]{padding-left:31px;padding-right:29px}.form-field .form-field-right-icon{color:#444}.form-field__left-icon{left:0;text-indent:12px;right:auto!important}.form-field .icon-checkbox-checkmark,.form-field .icon-cross{font-size:24px;font-size:1.5rem}.form-field .icon-help,.form-field .icon-help-outline{pointer-events:all}.form-field__label{font-size:12px;font-size:.75rem;visibility:hidden;display:block;font-family:clearview_att_regular;margin-bottom:3px;position:absolute;top:0;-webkit-transition:width 1s,height 1s,-webkit-transform .1s}.form-field__label--show{visibility:visible;-moz-transform:translateX(0px) translateY(-20px);-webkit-transform:translateX(0px) translateY(-20px);-o-transform:translateX(0px) translateY(-20px);-ms-transform:translateX(0px) translateY(-20px);transform:translateX(0px) translateY(-20px)}.form-field__label--hide{visibility:visible;-moz-transform:translateX(0px) translateY(0px);-webkit-transform:translateX(0px) translateY(0px);-o-transform:translateX(0px) translateY(0px);-ms-transform:translateX(0px) translateY(0px);transform:translateX(0px) translateY(0px)}[class^=icon-].success{color:#008a06}[class^=icon-].error{color:#e00000}[class^=icon-].info{color:#0a7cb5}input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week],select,textarea{font-size:14px;font-size:.875rem;-webkit-transition:all .04 ease-out;-moz-transition:all .04 ease-out;transition:all .04 ease-out;background:#fff;border-radius:6px;border:1px solid #888;color:#444;font-family:clearview_att_regular;width:100%;outline:0;padding:7px 10px;text-transform:none;z-index:0;height:40px;position:relative}input[type=color][disabled],input[type=date][disabled],input[type=datetime-local][disabled],input[type=datetime][disabled],input[type=email][disabled],input[type=month][disabled],input[type=number][disabled],input[type=password][disabled],input[type=search][disabled],input[type=tel][disabled],input[type=text][disabled],input[type=time][disabled],input[type=url][disabled],input[type=week][disabled],select[disabled],textarea[disabled]{border:1px solid #aaa;background:#f2f2f2;color:#a0a0a0;box-shadow:0 0 #d9d9d9 inset}textarea{resize:vertical}select{-webkit-transition-property:all,z-index,background-position;-moz-transition-property:all,z-index,background-position;transition-property:all,z-index,background-position;-webkit-transition-delay:.4s,0,0;-moz-transition-delay:.4s,0,0;transition-delay:.4s,0,0;-webkit-transition-timing-function:ease-out;-moz-transition-timing-function:ease-out;transition-timing-function:ease-out}input[type=color]:hover,input[type=date]:hover,input[type=datetime-local]:hover,input[type=datetime]:hover,input[type=email]:hover,input[type=month]:hover,input[type=number]:hover,input[type=password]:hover,input[type=search]:hover,input[type=tel]:hover,input[type=text]:hover,input[type=time]:hover,input[type=url]:hover,input[type=week]:hover,select:hover,textarea:hover{border:1px solid #444;z-index:1}input[type=color]:hover[disabled],input[type=date]:hover[disabled],input[type=datetime-local]:hover[disabled],input[type=datetime]:hover[disabled],input[type=email]:hover[disabled],input[type=month]:hover[disabled],input[type=number]:hover[disabled],input[type=password]:hover[disabled],input[type=search]:hover[disabled],input[type=tel]:hover[disabled],input[type=text]:hover[disabled],input[type=time]:hover[disabled],input[type=url]:hover[disabled],input[type=week]:hover[disabled],select:hover[disabled],textarea:hover[disabled]{border:1px solid #a0a0a0;background:#f2f2f2;color:#a0a0a0}input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus,select:focus,textarea:focus{border:1px solid #0574AC;color:#444;z-index:1}select{width:100%;position:relative;background-image:url(images/select-arrows.png);background-position:100% -1px;background-repeat:no-repeat;-webkit-appearance:none}.form-field.error input[type=email],.form-field.error input[type=password],.form-field.error input[type=text],.form-field.error select{border:1px solid #e00000}.form-field.warning{color:#444}.form-field.success input[type=email],.form-field.success input[type=password],.form-field.success input[type=text],.form-field.success select{border:1px solid #008a06}.form-field__glued{width:100%;margin-bottom:0}.form-field__glued input[type=email],.form-field__glued input[type=password],.form-field__glued input[type=text],.form-field__glued select{position:relative;margin-top:-1px;border-radius:0}.form-field__glued:first-child input[type=email],.form-field__glued:first-child input[type=password],.form-field__glued:first-child input[type=text],.form-field__glued:first-child select{margin-top:0;border-radius:5px 5px 0 0}.form-field__glued:last-child input[type=email],.form-field__glued:last-child input[type=password],.form-field__glued:last-child input[type=text],.form-field__glued:last-child select{border-radius:0 0 5px 5px}.form-field__glued.pull-left{margin-right:-1px}.form-field__glued.pull-left .select2-choice,.form-field__glued.pull-left input[type=email],.form-field__glued.pull-left input[type=password],.form-field__glued.pull-left input[type=text],.form-field__glued.pull-left select{border-radius:0;margin-top:0}.form-field__glued.pull-left:first-child .select2-choice,.form-field__glued.pull-left:first-child input[type=password],.form-field__glued.pull-left:first-child input[type=text],.form-field__glued.pull-left:first-child select{border-radius:5px 0 0 5px}.form-field__glued.pull-left:last-child .select2-choice,.form-field__glued.pull-left:last-child input[type=password],.form-field__glued.pull-left:last-child input[type=text],.form-field__glued.pull-left:last-child select{border-radius:0 5px 5px 0}::-webkit-input-placeholder{color:#444;opacity:.54}:-moz-placeholder{color:#444;opacity:.54}::-moz-placeholder{color:#444;opacity:.54}:-ms-input-placeholder{color:#444;opacity:.54;-ms-filter:'alpha(Opacity=54)'}[disabled]::-webkit-input-placeholder{color:#888}[disabled]:-moz-placeholder{color:#888}[disabled]::-moz-placeholder{color:#888}[disabled]:-ms-input-placeholder{color:#888}.form-field .form-field__message span{vertical-align:middle}.form-field .form-field__message{border-radius:4px;min-width:150px;max-width:280px;display:block;padding:10px;margin:12px 0 0;font-family:clearview_att_regular;font-size:12px;font-size:.75rem;line-height:10px;color:#666;text-transform:none;background:#fff;position:absolute;z-index:1;-moz-box-sizing:border-box;box-sizing:border-box}.form-field .form-field__message:after{content:'';position:absolute;left:10px;top:-7px;border-style:solid;border-width:0 7px 7px;border-color:transparent transparent #fff}.form-field .form-field__message [class*=icon-]{color:#fff;position:relative;margin-right:9px;line-height:0!important;vertical-align:middle}.form-field .form-field__message.error{color:#fff;background:#e00000}.form-field .form-field__message.error:after{border-bottom:7px solid #e00000}.form-field .form-field__message.warning{color:#444;background:#FCB123}.form-field .form-field__message.warning:after{border-bottom:7px solid #FCB123}.form-field .form-field__message.warning [class*=icon-]{color:#444}.form-field .form-field__message.alert{position:absolute;bottom:-45px;left:0;z-index:1;box-shadow:0 5px 10px 0 rgba(0,0,0,.25)}.form-field .form-field__message.success{color:#fff;background:#008a06}.form-field .form-field__message.success:after{border-bottom:7px solid #008a06}.form-field .form-field__message.info{color:#fff;background:#0a7cb5}.form-field .form-field__message [class^=icon-]{height:30px;line-height:30px}.form-field-loading>[class*=icon-]:not(.form-field-left-icon){opacity:0}.form-field-loading:after{content:'';position:absolute;top:2px;right:5px;width:25px;height:25px;background:url(images/loader.gif) center center no-repeat;background-size:20px}.fix-height{height:110px}.form-field__message-login{width:100%;display:block;position:relative;padding:7px 12px 3px;margin:-1px 0 -1px 0;font-family:clearview_att_regular;font-size:12px;font-size:.75rem;color:#666;text-transform:none;background:#fff;z-index:1;-moz-box-sizing:border-box;box-sizing:border-box}.form-field__message-login:after{content:'';position:absolute;right:10px;top:-7px;border-style:solid;border-width:0 7px 7px;border-color:transparent transparent #fff;z-index:2}.form-field__message-login [class*=icon-]{color:#fff;position:absolute;margin-right:5px}.form-field__message-login.incorrect{color:#fff;background:#e00000;border-bottom-left-radius:4px;border-bottom-right-radius:4px}.form-field__message-login.incorrect:after{border-bottom:7px solid #e00000}.form-field__message-login.unregistered{color:#444;background:#fcb134}.form-field__message-login.unregistered:after{border-bottom:7px solid #fcb134}.form-field__glued:first-child:hover+.form-field__message-login{margin:0 0 -1px 0}.form-field__login-field{width:200px}.form-field__login-field input[type=color],.form-field__login-field input[type=date],.form-field__login-field input[type=datetime-local],.form-field__login-field input[type=datetime],.form-field__login-field input[type=email],.form-field__login-field input[type=month],.form-field__login-field input[type=number],.form-field__login-field input[type=password],.form-field__login-field input[type=search],.form-field__login-field input[type=tel],.form-field__login-field input[type=text],.form-field__login-field input[type=time],.form-field__login-field input[type=url],.form-field__login-field input[type=week],.form-field__login-field select,.form-field__login-field textarea{height:35px;width:200px;font-size:12px;font-size:.75rem}.form-field__login-field [class^=icon-]{height:35px;line-height:35px} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/ie/backgroundsize.min.htc b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/ie/backgroundsize.min.htc
new file mode 100644
index 00000000..baa93ada
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/ie/backgroundsize.min.htc
@@ -0,0 +1,12 @@
+<!-- background-size-polyfill v0.2.0 | (c) 2012-2013 Louis-Rémi Babé | MIT License -->
+<PUBLIC:COMPONENT lightWeight="true">
+<PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="o.init()" />
+<PUBLIC:ATTACH EVENT="ondocumentready" ONEVENT="o.init()" />
+<PUBLIC:ATTACH EVENT="onpropertychange" ONEVENT="o.handlePropertychange()" />
+<PUBLIC:ATTACH EVENT="ondetach" ONEVENT="o.restore()" />
+<PUBLIC:ATTACH EVENT="onresize" FOR="window" ONEVENT="o.handleResize()" />
+<PUBLIC:EVENT NAME="onbackgroundupdate" ID="updateEvent" />
+<script type="text/javascript">
+var o;!function(a,b){var c=/url\(["']?(.*?)["']?\)/,d=/^\s\s*/,e=/\s\s*$/,f=/\s\s*/g,g=/%$/,h={top:0,left:0,bottom:1,right:1,center:.5},i=a.document,j="data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",k="background-size-polyfill",l=function(){},m=100,n,p,q,r;function s(){var b=i.createElement("div"),c=i.createElement("img"),d=b.style,e=a.style,f=a.currentStyle,g=a.bgsExpando,h=a.firstChild;g&&(g.restore&&(e.backgroundImage=g.restore.backgroundImage,e.position=g.restore.position,e.zIndex=g.restore.zIndex),h&&"DIV"===(h.nodeName||"").toUpperCase()&&h.className===k&&a.removeChild(h)),t(b),b.className=k,d.top=d.right=d.bottom=d.left=0,d.position="fixed",t(c),c.alt="",b.appendChild(c),a.insertBefore(b,a.firstChild),a.bgsExpando=g={wrapper:b,img:c,restore:{backgroundImage:e.backgroundImage,position:e.position,zIndex:e.zIndex},current:{},next:null,processing:!1,loadImg:null,display:!1,changed:!1,ignore:!1,canFixed:"BODY"===a.nodeName.toUpperCase()&&b.offsetHeight>0},d.position="absolute","auto"===f.zIndex&&(e.zIndex=0),"static"===f.position&&(e.position="relative"),o={init:l,handlePropertychange:D,restore:F,handleResize:E},D()}function t(a){var b=a.style;b.position="absolute",b.display="block",b.zIndex=-1,b.overflow="hidden",b.visibility="inherit",b.width=b.height=b.top=b.right=b.bottom=b.left=b.cursor="auto",b.margin=b.padding=b.border=b.outline=b.minWidth=b.minHeight=0,b.background=b.maxWidth=b.maxHeight="none",b.fontSize=b.lineHeight="1em"}function u(a,c,d){var e;c?(e=i.createElement("img"),e.onload=e.onerror=function(){var c=this.width,e=this.height;"error"===b.event.type&&(c=e=0),a.loadImg=this.onload=this.onerror=null,d(c,e)},e.src=c):e={callbackId:b.setTimeout(function(){a.loadImg=null,d(0,0)},0)},a.loadImg=e,e=null}function v(a){var b=o.handlePropertychange;o.handlePropertychange=l,a(),o.handlePropertychange=b}function w(a,b){var c=a.currentStyle.display;return c!==b.display&&(b.display=c,b.changed=!0),"none"!==c}function x(a,b){var d=a.style,e=a.currentStyle,f=b.restore,i=y(e["background-size"]),k=i.split(" "),l={innerWidth:a.offsetWidth-(parseFloat(e.borderLeftWidth)||0)-(parseFloat(e.borderRightWidth)||0),innerHeight:a.offsetHeight-(parseFloat(e.borderTopWidth)||0)-(parseFloat(e.borderBottomWidth)||0),size:i,sizeIsKeyword:"contain"===i||"cover"===i,sizeX:k[0],sizeY:k.length>1?k[1]:"auto",posX:e.backgroundPositionX,posY:e.backgroundPositionY,attachment:e.backgroundAttachment,src:"",imgWidth:0,imgHeight:0};return l.sizeIsKeyword||((parseFloat(l.sizeX)>=0||"auto"===l.sizeX)&&(parseFloat(l.sizeY)>=0||"auto"===l.sizeY)||(l.sizeX=l.sizeY="auto"),g.test(l.sizeX)&&(l.sizeX=(l.innerWidth*parseFloat(l.sizeX)/100||0)+"px"),g.test(l.sizeY)&&(l.sizeY=(l.innerHeight*parseFloat(l.sizeY)/100||0)+"px")),(l.posX in h||g.test(l.posX))&&(l.posX=h[l.posX]||parseFloat(l.posX)/100||0),(l.posY in h||g.test(l.posY))&&(l.posY=h[l.posY]||parseFloat(l.posY)/100||0),(c.exec(d.backgroundImage)||[])[1]===j?v(function(){d.backgroundImage=f.backgroundImage}):f.backgroundImage=d.backgroundImage,l.src=(c.exec(e.backgroundImage)||[])[1],v(function(){d.backgroundImage="url("+j+")"}),l}function y(a){return String(a).replace(d,"").replace(e,"").replace(f," ")}function z(a,c){var d=c.next;function e(){p=b.setTimeout(function(){c.processing=!1,z(a,c)},0)}!c.processing&&d&&(c.next=null,c.processing=!0,u(c,d.src,function(b,f){d.imgWidth=b,d.imgHeight=f,A(c,d)?B(a,c,d,e):e()}))}function A(a,b){var c=a.current,d=!1,e;if(a.changed)a.changed=!1,d=!0;else for(e in b)if(b[e]!==c[e]){d=!0;break}return d}function B(a,c,d,e){var f=c.img,g=f.style,h=d.size,i=d.innerWidth,j=d.innerHeight,k=d.imgWidth,l=d.imgHeight,m=d.posX,n=d.posY,o="number"==typeof m,p="number"==typeof n,s="none",t=0,u=0,v="auto",w="auto",x="px",y="100%",z,A;i&&j&&k&&l&&(c.wrapper.style.position="fixed"===d.attachment&&c.canFixed?"fixed":"absolute",f.src=d.src,d.sizeIsKeyword?(z=i/j,A=k/l,"contain"===h&&A>z||"cover"===h&&z>A?(u=C((j-i/A)*n)+x,v=y):(t=C((i-j*A)*m)+x,w=y),g.left=o?t:m,g.top=p?u:n,g.width=v,g.height=w,s="block"):(g.display="block",g.width=d.sizeX,g.height=d.sizeY,k=f.width,l=f.height,k&&l&&(g.left=o?C((i-k)*m)+x:m,g.top=p?C((j-l)*n)+x:n,s="block"))),g.display=s,c.current=d,q=b.setTimeout(function(){r=b.setTimeout(e,0),updateEvent.fire()},0)}function C(a){var b=0>a;return a=Math.floor(Math.abs(a)),b?-a:a}function D(){var c=a.bgsExpando,d=(b.event||{}).propertyName,e="style.backgroundImage";c.ignore&&(c.ignore=!1,d===e)||(d===e&&a.style.backgroundImage&&(c.ignore=!0),w(a,c)&&(c.next=x(a,c),z(a,c)))}function E(){b.clearTimeout(n),n=b.setTimeout(D,m)}function F(){var c=a.bgsExpando,d,e,f;o={init:l,handlePropertychange:l,restore:l,handleResize:l},b.clearTimeout(n),b.clearTimeout(p),b.clearTimeout(q),b.clearTimeout(r);try{c&&(d=c.loadImg,d&&(d.onload=d.onerror=null,b.clearTimeout(d.callbackId)),e=a.style,f=c.restore,e&&(e.backgroundImage=f.backgroundImage,e.position=f.position,e.zIndex=f.zIndex),a.removeChild(c.wrapper)),a.bgsExpando=null}catch(g){}a=b=i=l=null}o={init:"print"!==i.media?s:l,handlePropertychange:l,restore:l,handleResize:l},"complete"===a.readyState&&o.init()}(element,window);</script>
+<script type="text/vbscript"></script>
+</PUBLIC:COMPONENT>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/images/upanddown.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/images/upanddown.png
new file mode 100644
index 00000000..ce9f4e7e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/images/upanddown.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/pages/iconography.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/pages/iconography.css
new file mode 100644
index 00000000..bff182d8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/pages/iconography.css
@@ -0,0 +1,2 @@
+/* Style Guide Styles */
+.icons-list{list-style:none;margin:20px 0 0;padding:0;font-size:0}.icons-list li{font-size:14px;display:inline-block;width:20%;box-sizing:border-box;vertical-align:top;padding:20px;margin-bottom:20px;cursor:default;min-height:130px;position:relative;overflow:hidden;border:1px solid transparent;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;transition:all .2s ease-out}.icons-list li:hover{background:#fff;color:#199DDF;border-color:#d3d3d3}.icons-list [class*=icon]{display:inline-block;vertical-align:middle;-webkit-transition:font-size .2s ease-out;-moz-transition:font-size .2s ease-out;transition:font-size .2s ease-out}.icons-list[data-size=small] [class*=icon]{font-size:14px}.icons-list[data-size=medium] [class*=icon]{font-size:28px}.icons-list[data-size=large] [class*=icon]{font-size:56px}.icons-list.small-icons [class*=icon]{font-size:56px!important}.icons-list li [class*=icon]:hover{outline:1px dotted #444;color:#199DDF}.icons-list [data-role=title]{font-family:Arial;font-size:14px;margin-top:15px;display:block}.icons-list[data-display=list] li{display:block;margin-bottom:0;width:100%;min-height:0}.icons-list[data-display=list] [data-role=title]{display:inline-block;vertical-align:middle;margin:0;margin-left:15px}.icons-list [data-role=css-class]{display:none;font-size:11px;background:rgba(0,0,0,.8);color:#fff;margin-top:10px;text-align:center;box-sizing:border-box;position:absolute;left:0;right:0;bottom:-30px;padding:0 10px;height:25px;padding-top:7px;white-space:nowrap;overflow-x:auto;-webkit-transition:bottom .2s ease-out;-moz-transition:bottom .2s ease-out;transition:bottom .2s ease-out}.icons-list li:hover [data-role=css-class]{bottom:0}.icons-list[data-display=list] [data-role=css-class]{left:auto;top:50%;right:25px;margin-top:-12px;background:#d3d3d3;color:#444;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.show-dev-notes .icons-list [data-role=css-class]{display:block}.icons-list [data-role=css-class]::selection{background:#666}.icons-list[data-display=list] [data-role=css-class]::selection{background:#d3d3d3}.label-icon{display:block}.tabs-icon.tabs>li a{height:40px;line-height:40px;font-size:14px} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/sldr.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/sldr.css
new file mode 100644
index 00000000..151e394f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/sldr.css
@@ -0,0 +1 @@
+@charset "UTF-8";address,blockquote,dd,h1,h2,h3,h4,h5,h6,ol,p,pre,table,ul{margin:0;padding:0;margin-bottom:24px;margin-bottom:1.5rem}html{font-size:1em;line-height:1.5}body{margin:0}h1{font-size:48px;font-size:3rem;line-height:1}h2{font-size:36px;font-size:2.25rem;line-height:1.3333333333}h3{font-size:30px;font-size:1.875rem;line-height:1.6}h4{font-size:24px;font-size:1.5rem;line-height:1}h5{font-size:20px;font-size:1.25rem;line-height:1.2}h6{font-size:18px;font-size:1.125rem;line-height:1.3333333333}dd,ol,ul{margin-left:48px;margin-left:3rem}li>ol,li>ul{margin-bottom:0}code,kbd,pre,samp{font-family:monospace,monospace}blockquote{text-indent:-.41em;quotes:"“" "â€";margin-left:48px;margin-left:3rem}blockquote p:before{content:"“";content:open-quote}blockquote p:after{content:"";content:no-close-quote}blockquote p:last-of-type:after{content:"â€";content:close-quote}q{quotes:"‘" "’" "“" "â€"}q:before{content:"‘";content:open-quote}q:after{content:"’";content:close-quote}q q:before{content:"“";content:open-quote}q q:after{content:"â€";content:close-quote}q:first-child{display:inline-block;text-indent:-.22em}table{width:100%;border-collapse:collapse;border-spacing:0}td,th{padding:12px}#grid{position:absolute;top:0;left:50%;width:980px;margin-left:-490px;counter-reset:section;z-index:9999!important;pointer-events:none;outline:1px solid rgba(0,206,209,.1)}#grid:after{position:fixed;top:0;left:0;content:'Column: 20px Gutter: 20px Margin: 20px';display:block;max-width:90px;padding:3px;background-color:#000;color:#fff;font-size:10px;font-family:monospace;z-index:9999}#grid div.vert{width:20px;outline:solid rgba(0,206,209,.3);outline-width:1px;margin-right:20px;position:relative;background:rgba(255,0,0,.05);counter-increment:section}#grid div.vert.first-line{margin-left:20px}#grid div.vert::after{position:fixed;display:block;text-align:center;color:#fff;width:20px;content:counter(section);top:5px;font-size:8px;font-family:monospace}#grid div.vert:nth-child(24){position:absolute;top:0;right:0}#grid div.vert:nth-child(1),#grid div.vert:nth-child(10),#grid div.vert:nth-child(11),#grid div.vert:nth-child(12),#grid div.vert:nth-child(13),#grid div.vert:nth-child(14),#grid div.vert:nth-child(15),#grid div.vert:nth-child(16),#grid div.vert:nth-child(17),#grid div.vert:nth-child(18),#grid div.vert:nth-child(19),#grid div.vert:nth-child(2),#grid div.vert:nth-child(20),#grid div.vert:nth-child(21),#grid div.vert:nth-child(22),#grid div.vert:nth-child(23),#grid div.vert:nth-child(24),#grid div.vert:nth-child(3),#grid div.vert:nth-child(4),#grid div.vert:nth-child(5),#grid div.vert:nth-child(6),#grid div.vert:nth-child(7),#grid div.vert:nth-child(8),#grid div.vert:nth-child(9){display:inline-block!important}#grid div.vert:nth-child(25),#grid div.vert:nth-child(26),#grid div.vert:nth-child(27),#grid div.vert:nth-child(28),#grid div.vert:nth-child(29),#grid div.vert:nth-child(30),#grid div.vert:nth-child(31){display:none!important}#grid div.horiz{height:10px;border-bottom:1px dotted rgba(100,100,100,.2);margin:0;padding:0}.bg-prime-blue{background-color:#067ab4}.bg-secondary-gray{background-color:#666}.bg-light-blue{background-color:#bcc9d5}.bg-dark-gray{background-color:#444}.bg-dusty-blue{background-color:#97b1cf}.bg-warm-gray{background-color:#cccb9b}.bg-taupe{background-color:#cccb6c}.bg-green-highlight{background-color:#c4d63f}.bg-lime-highlight{background-color:#dad632}.bg-purple-highlight{background-color:#b6539c}.bg-magenta{background-color:#d71481}.bg-blue-highlight{background-color:#4cc8f3}.bg-ochre{background-color:#fab230}.bg-green{background-color:#4fa721}.bg-lime{background-color:#b6bd26}.bg-purple{background-color:#7f0e7c}.bg-burgundy{background-color:#b1103e}.bg-dark-blue{background-color:#0e2875}.bg-gold{background-color:#fd9827}.bg-teal{background-color:#20c6b2}.bg-mint-green{background-color:#9cfecd}.bg-yellow{background-color:#feed35}.bg-white{background-color:#fff}.alt.inline-list>li{display:inline-block;zoom:1;*display:inline;*vertical-align:auto;vertical-align:middle;float:none}.text-upper{text-transform:uppercase!important}body{font-family:clearview_att_regular}.font-showcase h1,.font-showcase h2,.font-showcase h3,.font-showcase h4,.font-showcase h5,.font-showcase h6{font-weight:100;letter-spacing:-1px;margin:10px 0;-webkit-font-smoothing:antialiased}.font-showcase h1{font-family:omnes_att_light;font-size:48px;font-size:3rem;line-height:48px}.font-showcase h2,.price{font-family:omnes_att_light;font-size:36px;font-size:2.25rem;line-height:36px}.font-showcase h3{font-family:omnes_att_regular;font-size:24px;font-size:1.5rem;line-height:28px}.font-showcase h4,.font-showcase h4.font-showcase-font-example,.font-showcase h4.font-showcase-font-name{font-family:clearview_att_regular;font-size:18px;font-size:1.125rem;line-height:22px;-webkit-font-smoothing:antialiased}.font-showcase h5{font-family:clearview_att_regular;font-size:14px;font-size:.875rem;line-height:20px;-webkit-font-smoothing:antialiased}.font-showcase h6{font-family:Arial;font-size:11px;font-size:.6875rem;line-height:30px;font-weight:100;-webkit-font-smoothing:antialiased}.body-copy,.font-showcase p{font-family:clearview_att_regular;font-size:14px;font-size:.875rem;line-height:20px;-webkit-font-smoothing:antialiased}.body-copy-short{font-family:clearview_att_regular;font-size:12px;font-size:.75rem;line-height:15px;-webkit-font-smoothing:antialiased}p [class*=icon]{display:inline-block;vertical-align:middle;margin-top:-4px}.details-label{display:block;font-family:clearview_att_regular;font-size:11px;font-size:.6875rem;line-height:15px}.details-label+.price{line-height:28px}.price{letter-spacing:-1px;-webkit-font-smoothing:antialiased}.price sup{font-size:18px;font-size:1.125rem;vertical-align:baseline;top:-11px;margin:0 2px}.price-alt{font-size:24px;font-size:1.5rem;line-height:24px}.price-alt sup{font-size:12px;font-size:.75rem;top:-8px}.promo-tagline{font-family:omnes_att_medium_italic;font-size:16px;font-size:1rem;line-height:20px;display:inline-block;margin-bottom:5px;-webkit-font-smoothing:antialiased}.promo-text{font-family:clearview_att_italic;font-size:12px;font-size:.75rem;line-height:15px;display:inline-block;margin-bottom:5px;-webkit-font-smoothing:antialiased}.divider,.divider-dark,hr{border:0;border-bottom:1px solid #d3d3d3}.divider-light{border-color:#e5e5e5}dl{font-family:clearview_att_regular;color:#444;font-size:12px;font-size:.75rem}dt{font-family:Arial;font-size:11px;font-size:.6875rem;display:block!important;margin:10px 0 5px!important;width:auto!important;text-transform:uppercase}dt a{font-family:clearview_att_regular;color:#067ab4;text-transform:none}dd{display:inline!important;line-height:20px}[data-highlight]{background-color:#c9e9f9;-webkit-animation:highlight-fade 3s infinite}@-webkit-keyframes highlight-fade{100%,80%{background-color:transparent}}.att-slider{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;height:10px;margin:120px 0;position:relative}.att-slider:first-child{margin:0}.att-slider__track{position:absolute;top:0;right:0;bottom:0;left:0;background-color:none}.att-slider__range{position:absolute;left:0;-webkit-mask-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);background:#157BB2;border-radius:5px;height:100%;z-index:1}.att-slider__range--disabled{background-color:#D3D3D3}.att-slider__handles-container{height:100%;position:relative;border:1px solid #888;border-radius:5px}.att-slider__handle{-webkit-transition:background-color .2s ease-out;-moz-transition:background-color .2s ease-out;transition:background-color .2s ease-out;box-shadow:0 0 0 1px #fff;background:#157BB2;border-radius:100%;cursor:pointer;height:16px;margin:-4px 0 0 -7px;position:absolute;width:15px;z-index:1}.att-slider__handle--dragging,.att-slider__handle:hover{z-index:2;background-color:#158BC3}.att-slider__handle--disabled,.att-slider__handle--disabled:hover{box-shadow:none;background:0 0;cursor:default;z-index:1}.att-slider__handle.att-slider-handle-disabled{width:0;margin:0}.att-slider__range.att-slider__range--disabled{border-top-right-radius:0;border-bottom-right-radius:0}.att-slider__handle .att-tooltip--textonly,.att-slider__label{position:absolute;top:-25px;font-size:12px;font-size:.75rem;color:#6f6f6f;font-family:clearview_att_regular;margin:0;text-align:left;z-index:0}.att-slider__label:after{position:absolute;bottom:-5px;background-color:#888;content:'';display:block;height:5px;width:1px}.att-slider__label--max,.att-slider__label--max:after{right:0}.att-slider__label--below{bottom:-34px;top:auto}.att-slider__label--below:after{bottom:auto;top:-7px;left:50%}.att-slider__handle .att-tooltip{white-space:nowrap}.att-slider__handle .att-tooltip--textonly:after{position:absolute;bottom:-5px;left:50%;background-color:#888;border:0;content:'';display:block;height:5px;margin:0 0 0 -1px;width:1px}.step-slider.disabled{opacity:.5}.step-slider.disabled .jslider-value-to{display:none}.step-slider.disabled .jslider-bg i.v,.step-slider.disabled .jslider-pointer-to{background-color:#AAA}.step-slider{display:block;width:100%;height:1em;position:relative;top:.6em;font-family:Arial,sans-serif}.step-slider table{width:100%;border-collapse:collapse;border:0}.step-slider td,.step-slider th{padding:0;vertical-align:top;text-align:left;border:0}.step-slider .step-slider-green{background-color:#4CA90C}.step-slider .step-slider-blue{background-color:#44C8F5}.step-slider .step-slider-magenta{background-color:#DA0081}.step-slider .step-slider-gold{background-color:#F90}.step-slider .step-slider-purple{background-color:#81017E}.step-slider .step-slider-dark-blue{background-color:#0C2577}.step-slider .step-slider-regular{background-color:#0574AC}.step-slider .step-slider-white{background-color:#fff}.step-slider .cutoff-slider{border:1px solid #000!important}.step-slider .cutoff-slider-dividers span{height:7px!important}.step-slider .jslider-label-cutoff{position:relative!important;float:right}.step-slider .jslider-cutoff{position:relative;height:7px;top:0;background-color:#0574AC;border-bottom-left-radius:5px;border-top-left-radius:5px;border-bottom-right-radius:5px;border-top-right-radius:5px}.step-slider .jslider-limitless .jslider-label,.step-slider .jslider-single .jslider-bg .v,.step-slider .jslider-single .jslider-pointer-to,.step-slider .jslider-single .jslider-value-to{display:none}.step-slider .jslider-pointer-to{left:80%;top:-6px}.step-slider .jslider-pointer{border-radius:100%;border:2px solid #fff;top:-5px;width:15px;height:15px;z-index:10;background-position:0 -60px;position:absolute;left:20%;margin-left:-6px;cursor:pointer}.step-slider .jslider-bg{position:relative;height:100%}.step-slider .jslider-bg i{height:5px;position:absolute;width:5px}.step-slider .jslider-bg i.l{height:6px;background-color:#E5E5E5;border-top-left-radius:3px;border-bottom-left-radius:3px;width:50%;background-position:0 0;left:0}.step-slider .jslider-bg i.r{height:6px;background-color:#E5E5E5;border-top-right-radius:3px;border-bottom-right-radius:3px;width:50%;left:50%;background-position:right 0}.step-slider .jslider-bg i.v{border-top-left-radius:3px;border-bottom-left-radius:3px;position:absolute;width:60%;left:20%;top:0;height:5px;background-repeat:repeat-x;background-position:0 -40px}.step-slider .jslider-scale{position:relative;top:9px;z-index:9}.step-slider .jslider-scale span{top:-9px;width:1px;border-left:0;position:absolute;height:5px;font-size:0}.step-slider .show-dividers span{background-color:#FFF}.step-slider .jslider-label{top:15px;font-size:9px;line-height:12px;color:#000;opacity:.4;white-space:nowrap;padding:0 2px;position:absolute;left:0}.step-slider .jslider-label-to{left:auto;right:0}.step-slider #jslider-value-left,.step-slider #left-pointer{display:none}.step-slider .jslider-value{font-size:9px;white-space:nowrap;padding:1px 2px 0;position:absolute;top:-19px;left:20%;background:#fff;line-height:12px;-moz-border-radius:2px;-webkit-border-radius:2px;-o-border-radius:2px;border-radius:2px}.step-slider .jslider-value-to{margin-left:-31px;-webkit-background-clip:border-box;-webkit-background-origin:padding-box;-webkit-background-size:auto;-webkit-box-shadow:rgba(0,0,0,.298039) 0 4px 5px 0;-webkit-transition-delay:0s;-webkit-transition-duration:.2s;-webkit-transition-property:opacity;-webkit-transition-timing-function:ease-out;background-attachment:scroll;background-clip:border-box;background-color:#fefefe;background-image:none;background-origin:padding-box;background-size:auto;border-bottom-left-radius:5px;border-bottom-right-radius:5px;border-top-left-radius:5px;border-top-right-radius:5px;box-shadow:rgba(0,0,0,.298039) 0 4px 5px 0;box-sizing:border-box;color:#444;display:block;font-family:clearview_att_regular;font-size:9px;line-height:15px;max-width:215px;opacity:1;padding:5px;position:absolute;z-index:0;top:-38px}.step-slider .jslider-value-to::after{content:'';border-bottom-color:transparent;border-bottom-style:solid;border-bottom-width:6px;border-image-outset:0;border-image-repeat:stretch;border-image-slice:100%;border-image-source:none;border-image-width:1;border-left-color:transparent;border-left-style:solid;border-left-width:6px;border-right-color:transparent;border-right-style:solid;border-right-width:6px;border-top-color:#fefefe;border-top-style:solid;border-top-width:6px;bottom:-12px;box-sizing:border-box;display:block;height:12px;left:40%;margin-top:-7px;position:absolute;top:auto;width:12px} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/style.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/style.css
new file mode 100644
index 00000000..289a1160
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/style.css
@@ -0,0 +1 @@
+@charset "UTF-8";code[class*=language-],pre[class*=language-]{color:#f8f8f2;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,'Andale Mono',monospace;direction:ltr;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#272822}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#f8f8f2}.namespace{opacity:.7}.token.constant,.token.property,.token.symbol,.token.tag{color:#f92672}.token.boolean,.token.number{color:#ae81ff}.token.attr-name,.token.builtin,.token.selector,.token.string{color:#a6e22e}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url,.token.variable{color:#f8f8f2}.token.atrule,.token.attr-value{color:#e6db74}.token.keyword{color:#66d9ef}.token.important,.token.regex{color:#fd971f}.token.important{font-weight:700}.token.entity{cursor:help}pre.line-numbers{position:relative;counter-reset:linenumber}pre.line-numbers>code{position:relative}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}.alert,.alert-success{position:fixed;top:0;left:0;right:0;z-index:2;background-color:#e9eee3;color:#444;font-family:clearview_att_regular;font-size:12px;padding:0;border:0;border-radius:0}.alert-warning{background-color:#fff3d9}.alert-error{background-color:#f3e6e5}.alert-info{background-color:#dfeff7}.alert .container{padding:15px 90px 15px 60px}.alert .container:before{content:'\e69c';position:absolute;top:14px;left:25px;font-family:"Ionicons";font-size:14px;color:#6ebb1f}.alert-warning .container:before{content:'\e69d';color:#fcb314}.alert-error .container:before{content:'\e69d';color:#ff4539}.alert-info .container:before{content:'\e69b';color:#067ab4}.alert strong{font-family:Arial;font-size:11px;font-weight:100;text-transform:uppercase}.alert a{color:#067ab4}.alert a:hover{color:#199ddf}.alert [data-role=close]{position:absolute;top:13px;right:20px;font-size:11px;height:20px;line-height:23px;border:0}.alert [data-role=close] [class^=icon-]{font-size:20px;width:15px;color:#777;margin:0;vertical-align:middle;display:inline-block;margin-top:-4px;-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;transition:all .2s ease-out}.alert [data-role=close]:hover [class^=icon-]{color:#199DDF}.alert .container,.alert-inplace{position:relative}.alert-inplace{z-index:1}.alert-inplace .container{width:100%}.tabs{display:inline-block;list-style:none;margin:0;padding:0;font-size:0}.tabs>li{padding:0;margin:0;display:inline-block}.tabs>li a{height:30px;width:auto;margin:0 0 0 -1px;padding:0 30px;background:#f2f2f2;border:1px solid #e7e6e6;text-align:center;font-size:11px;font-size:1.1rem;color:#6f6f6f;text-transform:uppercase;line-height:31px;cursor:pointer;display:inline-block}.tabs>li.first a,.tabs>li:first-child a{border-radius:4px 0 0 4px;margin-left:0}.tabs>li.last a,.tabs>li:last-child a{border-radius:0 4px 4px 0}.tabs>li a:hover{background:#e5e5e5;text-decoration:none;-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;transition:all .3s ease-out}.tabs>li.active a{background:#f8f8f8;color:#067ab4}.tabs-alt>li a,.tabs-small>li a{padding:0 15px}.tabs-light>li a{background-color:#fff}.tabs-icons>li a,.tabs-icons>li a:hover,.tabs-icons>li.active a{padding:0;border:0;background:0 0;font-size:28px;line-height:36px;margin-right:10px}.tabs-icons>li a i{vertical-align:middle}.tabs-icons>li a:hover{color:#067ab4}.tab-pane{display:none}.tab-pane.active{display:block}.tab-pane.html{padding:20px;border:1px solid #ddd;border-top:10px solid #272822;border-radius:0 0 3px 3px}address,blockquote,dd,h1,h2,h3,h4,h5,h6,ol,p,pre,table,ul{margin:0;padding:0;margin-bottom:24px;margin-bottom:1.5rem}html{font-size:1em;line-height:1.5}h1{font-size:48px;font-size:3rem;line-height:1}h2{line-height:1.3333333333}h3{line-height:1.6}h4{line-height:1}h5{font-size:20px;font-size:1.25rem;line-height:1.2}h6{font-size:18px;font-size:1.125rem;line-height:1.3333333333}dd,ol,ul{margin-left:48px;margin-left:3rem}li>ol,li>ul{margin-bottom:0}code,kbd,pre,samp{font-family:monospace,monospace}blockquote{text-indent:-.41em;quotes:"“" "â€";margin-left:48px;margin-left:3rem}blockquote p:before{content:"“";content:open-quote}blockquote p:after{content:"";content:no-close-quote}blockquote p:last-of-type:after{content:"â€";content:close-quote}q{quotes:"‘" "’" "“" "â€"}q:before{content:"‘";content:open-quote}q:after{content:"’";content:close-quote}q q:before{content:"“";content:open-quote}q q:after{content:"â€";content:close-quote}q:first-child{display:inline-block;text-indent:-.22em}table{width:100%;border-collapse:collapse;border-spacing:0}td,th{padding:12px}#grid{position:absolute;top:0;left:50%;width:980px;margin-left:-490px;counter-reset:section;z-index:9999!important;pointer-events:none;outline:1px solid rgba(0,206,209,.1)}#grid:after{position:fixed;top:0;left:0;content:'Column: 20px Gutter: 20px Margin: 20px';display:block;max-width:90px;padding:3px;background-color:#000;color:#fff;font-size:10px;font-family:monospace;z-index:9999}#grid div.vert{width:20px;outline:solid rgba(0,206,209,.3);outline-width:1px;margin-right:20px;position:relative;background:rgba(255,0,0,.05);counter-increment:section}#grid div.vert.first-line{margin-left:20px}#grid div.vert::after{position:fixed;display:block;text-align:center;color:#fff;width:20px;content:counter(section);top:5px;font-size:8px;font-family:monospace}#grid div.vert:nth-child(24){position:absolute;top:0;right:0}#grid div.vert:nth-child(1),#grid div.vert:nth-child(10),#grid div.vert:nth-child(11),#grid div.vert:nth-child(12),#grid div.vert:nth-child(13),#grid div.vert:nth-child(14),#grid div.vert:nth-child(15),#grid div.vert:nth-child(16),#grid div.vert:nth-child(17),#grid div.vert:nth-child(18),#grid div.vert:nth-child(19),#grid div.vert:nth-child(2),#grid div.vert:nth-child(20),#grid div.vert:nth-child(21),#grid div.vert:nth-child(22),#grid div.vert:nth-child(23),#grid div.vert:nth-child(24),#grid div.vert:nth-child(3),#grid div.vert:nth-child(4),#grid div.vert:nth-child(5),#grid div.vert:nth-child(6),#grid div.vert:nth-child(7),#grid div.vert:nth-child(8),#grid div.vert:nth-child(9){display:inline-block!important}#grid div.vert:nth-child(25),#grid div.vert:nth-child(26),#grid div.vert:nth-child(27),#grid div.vert:nth-child(28),#grid div.vert:nth-child(29),#grid div.vert:nth-child(30),#grid div.vert:nth-child(31){display:none!important}#grid div.horiz{height:10px;border-bottom:1px dotted rgba(100,100,100,.2);margin:0;padding:0}.bg-prime-blue{background-color:#067ab4}.bg-secondary-gray{background-color:#666}.bg-light-blue{background-color:#bcc9d5}.bg-dark-gray{background-color:#444}.bg-dusty-blue{background-color:#97b1cf}.bg-warm-gray{background-color:#cccb9b}.bg-taupe{background-color:#cccb6c}.bg-green-highlight{background-color:#c4d63f}.bg-lime-highlight{background-color:#dad632}.bg-purple-highlight{background-color:#b6539c}.bg-magenta{background-color:#d71481}.bg-blue-highlight{background-color:#4cc8f3}.bg-ochre{background-color:#fab230}.bg-green{background-color:#4fa721}.bg-lime{background-color:#b6bd26}.bg-purple{background-color:#7f0e7c}.bg-burgundy{background-color:#b1103e}.bg-dark-blue{background-color:#0e2875}.bg-gold{background-color:#fd9827}.bg-teal{background-color:#20c6b2}.bg-mint-green{background-color:#9cfecd}.bg-yellow{background-color:#feed35}.bg-white{background-color:#fff}html{background:#fff;overflow:auto}body{background-color:#fff;font-size:14px;font-size:.875rem;margin:0;padding:105px 0 20px;position:relative}.alt.inline-list>li{display:inline-block;zoom:1;*display:inline;*vertical-align:auto;vertical-align:middle;float:none}.text-upper{text-transform:uppercase!important}body{font-family:clearview_att_regular}.font-showcase h1,.font-showcase h2,.font-showcase h3,.font-showcase h4,.font-showcase h5,.font-showcase h6{font-weight:100;letter-spacing:-1px;margin:10px 0;-webkit-font-smoothing:antialiased}.font-showcase h1{font-family:omnes_att_light;font-size:48px;font-size:3rem;line-height:48px}.font-showcase h2,.price{font-family:omnes_att_light;font-size:36px;font-size:2.25rem;line-height:36px}.font-showcase h3{font-family:omnes_att_regular;font-size:24px;font-size:1.5rem;line-height:28px}.font-showcase h4,.font-showcase h4.font-showcase-font-example,.font-showcase h4.font-showcase-font-name{font-family:clearview_att_regular;font-size:18px;font-size:1.125rem;line-height:22px;-webkit-font-smoothing:antialiased}.font-showcase h5{font-family:clearview_att_regular;font-size:14px;font-size:.875rem;line-height:20px;-webkit-font-smoothing:antialiased}.font-showcase h6{font-family:Arial;font-size:11px;font-size:.6875rem;line-height:30px;font-weight:100;-webkit-font-smoothing:antialiased}.body-copy,.font-showcase p{font-family:clearview_att_regular;font-size:14px;font-size:.875rem;line-height:20px;-webkit-font-smoothing:antialiased}.body-copy-short{font-family:clearview_att_regular;font-size:12px;font-size:.75rem;line-height:15px;-webkit-font-smoothing:antialiased}p [class*=icon]{display:inline-block;vertical-align:middle;margin-top:-4px}.details-label{display:block;font-family:clearview_att_regular;font-size:11px;font-size:.6875rem;line-height:15px}.details-label+.price{line-height:28px}.price{letter-spacing:-1px;-webkit-font-smoothing:antialiased}.price sup{font-size:18px;font-size:1.125rem;vertical-align:baseline;top:-11px;margin:0 2px}.price-alt{font-size:24px;font-size:1.5rem;line-height:24px}.price-alt sup{font-size:12px;font-size:.75rem;top:-8px}.promo-tagline{font-family:omnes_att_medium_italic;font-size:16px;font-size:1rem;line-height:20px;display:inline-block;margin-bottom:5px;-webkit-font-smoothing:antialiased}.promo-text{font-family:clearview_att_italic;font-size:12px;font-size:.75rem;line-height:15px;display:inline-block;margin-bottom:5px;-webkit-font-smoothing:antialiased}.divider,.divider-dark,hr{border:0;border-bottom:1px solid #d3d3d3}.divider-light{border-color:#e5e5e5}dl{font-family:clearview_att_regular;color:#444;font-size:12px;font-size:.75rem}dt{font-family:Arial;font-size:11px;font-size:.6875rem;display:block!important;margin:10px 0 5px!important;width:auto!important;text-transform:uppercase}dt a{font-family:clearview_att_regular;color:#067ab4;text-transform:none}dd{display:inline!important;line-height:20px}[data-highlight]{background-color:#c9e9f9;-webkit-animation:highlight-fade 3s infinite}@-webkit-keyframes highlight-fade{100%,80%{background-color:transparent}}.changelog .title{border-bottom:1px solid #aaa;margin:50px 0 20px;padding-bottom:10px}.changelog:first-child .title{margin-top:0}.changelog:first-child .title a{color:#333}.changelog .title a:hover{color:#199DDF}.changelog .title a:hover:after{content:'#';margin-left:5px}.changelog .group{margin-bottom:20px}.changelog .changes-list{margin-bottom:30px}.changelog .changes-list li{margin-bottom:10px}.changelog .changes-list li:first-letter{text-transform:capitalize}.changelog .label-info{background-color:#333}.profile-card{height:380px;width:219px;border-radius:3px;margin:10px;border:solid 1px lightgrey;padding:0!important}.profile-card .top-block{padding:15px 20px;background-color:#e5e5e5;height:185px}.profile-card .bottom-block{padding:15px 20px;background-color:#fff}.profile-image{background:#e5e5e5;margin-bottom:15px;text-align:center}.profile-image .default-img,.profile-image img{display:inline-block;width:60px;height:60px;margin-bottom:10px;background-size:cover;text-align:center;background-position:center;border:6px solid #eee;border-radius:99em;-webkit-border-radius:99em;-moz-border-radius:99em;background-color:#eee}.profile-image .default-img{font-family:omnes_att_regular;color:#AAA;size:24px;line-height:22px;padding:15px;width:60px;height:60px}.profile-image .name{font-family:clearview-att_regular;font-size:18px;line-height:22px;color:#444;text-align:center;margin-bottom:5px;overflow:hidden;max-height:43px;word-break:break-word;white-space:normal}.profile-image .status-icon{border-radius:10px;border:1px solid #fff;margin:0 3px 0 0;width:10px;height:10px}.profile-image .status-icon.icon-green{background:#0c0}.profile-image .status-icon.icon-red{background:red}.profile-image .status-icon.icon-blue{background:#00f}.profile-image .status-icon.icon-yellow{background:#ff0}.profile-image .status{font-family:clearview_att_regular;font-size:12px;line-height:15px;text-align:center;margin:0 15px 0 0;color:#444}.profile-image .status .status-badge{margin-left:5px;border:dotted 1px #444;background-color:transparent;font-weight:400;color:#444;height:17px;padding:0 5px;border-radius:4px;font-size:11px}.profile-details{background:#fff}.profile-details label{display:block;font-family:Arial;font-size:12px;color:#444;padding:0;margin:0}.profile-details p{margin:0;font-family:clearview_att_regular;font-size:12px;color:#444;padding-bottom:6.5px}.add-user{background:#e5e5e5;border-style:dotted;font:clearview_att_regular;size:18px;line-height:21.6px;color:#666}.add-user i{font-size:30px;padding-bottom:15px}.atcenter{padding-top:150px;text-align:center}.scroll-viewport{overflow:hidden;position:relative}.scroll-overview{position:absolute;left:0;top:0;padding:0;margin:0;width:100%;display:table}.scroll-bar{background-color:#eaeaea;border-radius:5px;position:absolute;z-index:10;-webkit-transition:.6s ease-in-out opacity;transition:.6s ease-in-out opacity}.scroll-bar.disable{display:none}.scroll-bar.visible,.scroll-bar:hover{opacity:1!important}.scroll-thumb{background-color:#067ab4;border-radius:5px;cursor:pointer;overflow:hidden;position:absolute;top:0;left:1px}body.scroll-no-select{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.next,.prev{position:absolute}.vertical .scroll-bar{top:0;right:0;width:8px;height:100%}.vertical .scroll-thumb{height:20px;width:6px}.vertical .prev{top:-70px;left:0}.vertical .next{bottom:-50px;left:0}.horizontal .scroll-bar{left:0;bottom:0;width:100%;height:8px;border-radius:0;background-color:transparent}.horizontal .scroll-thumb{height:6px;width:20px}.horizontal .prev{left:-26px;top:0;height:inherit;background-color:#999;margin:0;z-index:1;width:26px;border-radius:6px 0 0 6px}.horizontal .next{right:-26px;top:0;height:inherit;background-color:#999;margin:0;z-index:1;width:26px;box-shadow:-7px 0 0 rgba(0,0,0,.2);border-radius:0 6px 6px 0}.horizontal .next:hover,.horizontal .prev:hover{background:#067ab4}.horizontal .next a,.horizontal .prev a{background:inherit;display:block;margin-top:-14px;padding-bottom:20px;padding-top:20px;position:absolute;top:50%;border-radius:6px;color:#fff}.horizontal .next a{right:-15px}.horizontal .prev a{left:-15px}.container{padding-left:20px;padding-right:20px}.att--readless__link,.att--readmore__link,.link{-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;transition:all .3s ease-out;font-size:12px;font-size:.75rem;display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;color:#0574AC;cursor:pointer;line-height:15px;border-bottom:solid 1px}.att--readless__link:hover,.att--readmore__link:hover,.link:hover{color:#0091d9;border-bottom:dotted 1px}.link--large{font-size:14px;font-size:.875rem;line-height:20px}.link--right{*zoom:1;float:right}.link--right:after,.link--right:before{content:" ";display:table}.link--right:after{clear:both}.links-list__item,.links-list__item a{font-size:12px;font-size:.75rem;border-top:1px solid #444;cursor:pointer;display:block;line-height:30px}.links-list__item a a:hover,.links-list__item a:hover,.links-list__item:hover{color:#0091d9}.links-list__item a:first-child,.links-list__item:first-child{border:0}.links-list__item,.links-list__item a{color:#444;text-decoration:none}.link--visited,.link:visited{color:#0c2577;border-color:#0c2577;border-bottom:solid 1px}.link--visited:hover,.link:visited:hover{color:#0091d9;border-bottom:dotted 1px}.body-copy .link{font-size:14px;font-size:.875rem;font-family:clearview_att_regular;letter-spacing:0;line-height:17px}.att--readmore__link{margin-left:5px;margin-bottom:10px;-webkit-transition:width 2s ease,height 2s ease;-moz-transition:width 2s ease,height 2s ease;-o-transition:width 2s ease,height 2s ease;transition:width 2s ease,height 2s ease}.show-more-snippet{height:35px;width:300px;overflow:hidden}.wrapper{width:60%;margin:0 auto}.att--readMore{text-overflow:ellipsis;overflow:hidden;margin-bottom:20px;font-size:12px;font-size:.75rem;line-height:2;height:24px}.att--readLess{height:auto;overflow:visible;margin-bottom:20px;font-size:12px;font-size:.75rem;line-height:2}.navbar{position:fixed;top:0;right:0;left:0;z-index:2000;color:#f8f8f8;height:50px;font-size:12px;font-size:.75rem;background:#000;border:0;border-radius:0}.navbar-brand{display:block;line-height:50px;padding:0;font-size:12px;font-size:.75rem;font-weight:400;color:#f8f8f8;margin-left:0!important;padding-left:40px;background:url(images/logo.png) 0 center no-repeat}.nav{list-style:none;margin:0;padding:0}.navbar li{margin:0;float:left}.navbar li:first-child{margin-left:0}.navbar li>a{display:block;height:50px;line-height:50px;padding:0 10px;color:#bbb;-moz-box-sizing:border-box;box-sizing:border-box}.navbar li.active>a{border-bottom:4px solid #FC411E}.navbar li>a:focus,.navbar li>a:hover{background-color:#181818}.navbar li.active>a,.navbar li>a:hover{color:#f8f8f8}.navbar .dropdown{position:relative;margin:0 0 0 10px}.navbar .dropdown:hover>a{-webkit-transition:none;-moz-transition:none;transition:none;background-color:#474747}.navbar .dropdown:hover .dropdown-menu{display:block}.navbar .dropdown-menu{position:absolute;list-style:none;margin:0;padding:0;min-width:120px;display:none;border:0;border-radius:0}.pull-right .dropdown-menu{left:auto;right:0;top:100%;background-color:#474747}.navbar .dropdown-menu li{display:block;float:none;margin:0;width:100%}.navbar .dropdown-menu li a:hover{background-color:#FC411E}.att-tooltip{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-size:12px;font-size:.75rem;-webkit-transition:opacity .2s ease-out;-moz-transition:opacity .2s ease-out;transition:opacity .2s ease-out;box-shadow:0 4px 5px 0 rgba(0,0,0,.3);-webkit-box-shadow:0 4px 5px 0 rgba(0,0,0,.3);-moz-box-shadow:0 4px 5px 0 rgba(0,0,0,.3);background:#ddd;border-radius:5px;color:#444;display:block;line-height:15px;margin:10px 0 0;max-width:215px;opacity:0;padding:7px 10px;position:absolute;z-index:5}.att-tooltip:after,.att-tooltip:before{position:absolute;left:50%;content:'';margin-left:-7px;border:6px solid transparent}.att-tooltip:before{top:-12px;border-bottom-color:#ccc}.att-tooltip:after{top:-12px;border-bottom-color:#ddd}.att-tooltip--on{opacity:1}.att-tooltip--right{margin:0 0 0 10px}.att-tooltip--right:after,.att-tooltip--right:before{top:50%;left:-5px;margin-top:-7px;border-bottom-color:transparent}.att-tooltip--right:before{border-right-color:#ccc;left:-5px}.att-tooltip--right:after{border-right-color:#ddd}.att-tooltip--left{margin:0 0 0 -10px}.att-tooltip--left:after,.att-tooltip--left:before{top:50%;left:auto;right:-12px;margin-top:-7px;border-bottom-color:transparent}.att-tooltip--left:before{border-left-color:#ccc;right:-12px}.att-tooltip--left:after{border-left-color:#ddd}.att-tooltip--above{margin:-10px 0 0 0}.att-tooltip--above:after,.att-tooltip--above:before{top:auto;bottom:-12px;margin-top:-7px;border-bottom-color:transparent}.att-tooltip--above:before{border-top-color:#ccc;bottom:-12px}.att-tooltip--above:after{border-top-color:#ddd}.att-tooltip--light{background-color:#fefefe}.att-tooltip--light.att-tooltip--above:after{border-top-color:#fefefe}.att-tooltip--light.att-tooltip--below:after{border-bottom-color:#fefefe}.att-tooltip--light.att-tooltip--right:after{border-right-color:#fefefe}.att-tooltip--light.att-tooltip--left:after{border-left-color:#fefefe}.att-tooltip--dark{background-color:#6d6d6d;color:#fefefe}.att-tooltip--dark.att-tooltip--above:after{border-top-color:#6d6d6d}.att-tooltip--dark.att-tooltip--below:after{border-bottom-color:#6d6d6d}.att-tooltip--dark.att-tooltip--right:after{border-right-color:#6d6d6d}.att-tooltip--dark.att-tooltip--left:after{border-left-color:#6d6d6d}.att-tooltip--light--hover:hover{padding:6px 9px;border:1px solid #8d8d8d}.att-tooltip--light--hover:hover.att-tooltip--left:before{border-left-color:#8d8d8d;margin-right:-1px}.att-tooltip--light--hover:hover.att-tooltip--right:before{border-right-color:#8d8d8d;margin-left:-8px}.att-tooltip--light--hover:hover.att-tooltip--above:before{border-top-color:#8d8d8d;margin-bottom:-1px}.att-tooltip--light--hover:hover.att-tooltip--below:before{border-bottom-color:#8d8d8d;margin-top:-1px}.att-tooltip--dark--hover:hover{padding:6px 9px;border:1px solid #404040}.att-tooltip--dark--hover:hover.att-tooltip--left:before{border-left-color:#404040;margin-right:-1px}.att-tooltip--dark--hover:hover.att-tooltip--right:before{border-right-color:#404040;margin-left:-8px}.att-tooltip--dark--hover:hover.att-tooltip--above:before{border-top-color:#404040;margin-bottom:-1px}.att-tooltip--dark--hover:hover.att-tooltip--below:before{border-bottom-color:#404040;margin-top:-1px}.att-tooltip--active--dark{width:60px;min-width:60px;max-width:300px;background-color:#6d6d6d;color:#fff;border:0}.att-tooltip--active--dark:focus{outline:0}.att-tooltip--active--light{width:60px;min-width:60px;max-width:300px;background-color:#fefefe;border:0}.att-tooltip--active--light:focus{outline:0}.att-tooltip--textonly{background:0 0;border-color:transparent;padding:0}.att-tooltip--textonly:after,.att-tooltip--textonly:before{display:none}.button.button--small.att-tooltip--button{min-width:60px!important}.lt-ie9 .pop-over-caret--above{bottom:-5px!important}.lt-ie9 .pop-over-caret-border--above{bottom:-6px!important}.lt-ie9 .pop-over-caret--below{top:-5px!important}.lt-ie9 .pop-over-caret-border--below{top:-6px!important}.lt-ie9 .pop-over-caret--right{left:-5px!important}.lt-ie9 .pop-over-caret-border--right{left:-6px!important}.att-pop-over--above{margin:-10px 0 0 1px!important}.att-pop-over--left{margin:-7px 0 0 -6px!important}.att-pop-over--right{margin:-7px 0 0 6px!important}.att-popover{border:1px solid #d3d3d3;max-width:490px;padding:19px;pointer-events:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-size:12px;font-size:.75rem;-webkit-transition:opacity .2s ease-out;-moz-transition:opacity .2s ease-out;transition:opacity .2s ease-out;background:#fff;border-radius:5px;box-shadow:0 5px 6px 0 rgba(0,0,0,.25);color:#444;display:table;line-height:15px;margin:6px 0 0;min-height:29px;position:absolute!important;z-index:5;opacity:1}.att-popover:focus{outline:0}.att-popover .pop-over-caret{width:0;height:0;position:absolute}.att-popover .pop-over-caret.pop-over-caret-border--below{border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #d3d3d3;top:-7px;left:50%}.att-popover .pop-over-caret.pop-over-caret-border--above{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #d3d3d3;bottom:-7px;left:50%;margin-left:-7px}.att-popover .pop-over-caret.pop-over-caret-border--left{border-top:6px solid transparent;border-left:6px solid #d3d3d3;border-bottom:6px solid transparent;right:-6px;top:50%}.att-popover .pop-over-caret.pop-over-caret-border--right{border-right:6px solid #d3d3d3;border-top:6px solid transparent;border-bottom:6px solid transparent;left:-7px;top:50%}.att-popover .pop-over-caret.pop-over-caret--below{border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #f2f2f2;top:-6px;left:50%}.att-popover .pop-over-caret.pop-over-caret--above{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #f2f2f2;bottom:-6px;left:50%;margin-left:-7px}.att-popover .pop-over-caret.pop-over-caret--left{border-top:6px solid transparent;border-left:6px solid #f2f2f2;border-bottom:6px solid transparent;right:-5px;top:50%}.att-popover .pop-over-caret.pop-over-caret--right{border-right:6px solid #f2f2f2;border-top:6px solid transparent;border-bottom:6px solid transparent;left:-6px;top:50%}.att-popover .att--readless__link,.att-popover .att--readmore__link,.att-popover .link{color:#0574AC}.att-popover .att--readless__link:hover,.att-popover .att--readless__link:hover:visited,.att-popover .att--readmore__link:hover,.att-popover .att--readmore__link:hover:visited,.att-popover .link:hover,.att-popover .link:hover:visited{color:#0091d9}.att-popover .att--readless__link--visited,.att-popover .att--readless__link:visited,.att-popover .att--readmore__link--visited,.att-popover .att--readmore__link:visited,.att-popover .link--visited,.att-popover .link:visited{color:#0c2577}.att-popover .att--readless__link--visited:hover,.att-popover .att--readless__link:visited:hover,.att-popover .att--readmore__link--visited:hover,.att-popover .att--readmore__link:visited:hover,.att-popover .link--visited:hover,.att-popover .link:visited:hover{color:#0091d9}.att-tooltip.att-popover{pointer-events:auto}.att-popover-content{display:none!important;text-align:left}.att-popover--with-header.att-tooltip--below:below{display:none}.att-popover--with-header.att-tooltip--below:after{border-bottom-color:#0574AC}.att-popover.att-popover--value-selector{max-width:220px;padding:20px;text-align:center}.att-popover.att-popover--value-selector .att-color-selector__item{width:40px;height:40px;-webkit-transition:none;-moz-transition:none;transition:none;background:0 0;border:0;position:relative}.att-popover.att-popover--value-selector .att-color-selector__item:before{position:absolute;-webkit-transition:border-color .3s ease-out;-moz-transition:border-color .3s ease-out;transition:border-color .3s ease-out;border:3px solid transparent;border-radius:50%;content:''}.att-popover.att-popover--value-selector .att-color-selector__item .att-radio__indicator{-webkit-transform:scale3d(1,1,1);-moz-transform:scale3d(1,1,1);-ms-transform:scale3d(1,1,1);-o-transform:scale3d(1,1,1);transform:scale3d(1,1,1);width:38px;height:38px;border:1px solid #444;border-radius:38px;display:block;-ms-filter:none;filter:none;left:50%;margin:-19px 0 0 -19px;opacity:1;top:50%}.att-popover.att-popover--value-selector .att-radio--on.att-color-selector__item:before{border-color:#0574AC}.att-popover.att-popover--value-selector .att-radio--on.att-color-selector__item .att-radio__indicator{width:28px;height:28px;margin:-14px 0 0 -14px}.att-popover.att-popover--value-selector .att-radio.att-value-selector__item{width:40px;height:40px;background:0 0;border:2px solid transparent;color:#666;padding:1px}.att-popover.att-popover--value-selector .att-radio.att-value-selector__item .att-radio__indicator{-webkit-transform:none;-moz-transform:none;-ms-transform:none;-o-transform:none;transform:none;-webkit-transition:none;-moz-transition:none;transition:none;width:40px;height:40px;background:0 0;border:1px solid #666;border-radius:50%;color:#666;-ms-filter:none;filter:none;margin:0;opacity:1;padding-top:5px;position:static}.att-popover.att-popover--value-selector .att-radio--on.att-value-selector__item .att-radio__indicator{background:#0574AC;border-color:#0574AC;color:#fff}.att-popover__close{position:absolute;top:9px;right:9px;font-size:14px;font-size:.875rem;color:#444}.popover-demo .att-popover-content{display:block!important}.popover-demo .popover-packages__container{background:0 0}.popover-demo .popover-packages__container p{color:#444}.popover-demo .popover-packages__text-block{padding:5px 0 0}.popover-demo .popover-packages__text-block-row p{font-size:12px}.popover-demo hr{border-bottom:1px solid #b2b2b2;margin:10px 0 25px}.icon-close:before{content:'\e6d5'}.breadcrumbs{color:#444;height:50px;list-style:none;text-align:right}.breadcrumbs__item{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto}.breadcrumbs__item:before{font-size:11px;font-size:.6875rem;display:inline-block;zoom:1;*display:inline;*vertical-align:auto;content:'>';margin-left:10px;vertical-align:middle}.breadcrumbs__item:first-child:before{display:none}.breadcrumbs__link{font-size:12px;font-size:.75rem;font-family:clearview_att_regular;color:#666;margin-left:10px}.breadcrumbs__link:hover{color:#0574AC;text-decoration:underline}.breadcrumbs__link--active,.breadcrumbs__link--active:hover{color:#444;text-decoration:none}.pager{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;font-size:0;list-style:none;margin:10px 0 0}.pager--dark{background-color:#000;padding:10px 10px 10px 5px}.pager__item{font-size:12px;font-size:.75rem;-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;transition:all .3s ease-out;display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;cursor:default;color:#4b4b4b;margin-left:12px;text-align:center;width:33px;height:33px;border-radius:6px;padding:7px}.pager__item [class^=icon-]{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;font-size:12px;font-size:.75rem;color:#888}.pager__item--link{border-radius:50px;border:1px solid transparent;color:#4b4b4b;cursor:pointer}.pager__item--link:hover{background:#b2b2b2;color:#4b4b4b}.pager__item--active{background:#067AB4;color:#fff;cursor:default}.pager__item--active:hover{background:#b2b2b2;color:#4b4b4b}.pager__item--active:focus{color:#fff}.pager__item--input{color:#067ab4;margin-left:12px;padding-left:12px;padding-right:12px;text-align:center;max-width:40px;max-height:29px}.pager__item--next,.pager__item--prev{font-size:12px;cursor:pointer;padding:12px;color:#888}.pager__item--next:hover,.pager__item--prev:hover{background:0 0;border-color:none;color:#0574AC}.pager__item--next:hover [class^=icon-],.pager__item--prev:hover [class^=icon-]{color:#0574AC}.views-per-page__item--active a::after,.views-per-page__item--active:hover a::after{border-bottom-color:#0574ac;border-bottom-width:2px;color:#0574ac;opacity:1}.views-per-page{display:inline-block;font-size:0}.views-per-page__item{display:inline-block;font-size:14px;margin-left:3px;text-align:center;width:33px}.views-per-page__item a{color:#444;outline:0 none;position:relative}.views-per-page__item a:focus::before{opacity:1}.views-per-page__item a::after{border-bottom:1px solid #0091d9;bottom:0;content:"";left:0;opacity:0;position:absolute;right:0;top:18px;transition:all .2s ease-out 0s}.views-per-page__item a::before{border:1px solid #44c8f5;border-radius:0;bottom:auto;content:"";display:inline-block;height:38px;left:50%;margin:-19px;opacity:0;position:absolute;right:auto;top:50%;transform:scale3d(1,1,1);width:38px}.views-per-page__item:hover{cursor:pointer}.views-per-page__item:hover a{color:#0091d9}.views-per-page__item:hover a::after{opacity:1}.views-per-page__item:first-child{margin-left:0;width:auto}.views-per-page__item:first-child:hover{color:#444;cursor:inherit}.views-per-page__item:first-child:hover::after{opacity:0}.lt-ie9 .views-per-page__item a::after,.lt-ie9 .views-per-page__item a::before{content:none}.lt-ie9 .views-per-page__item a:focus::before,.lt-ie9 .views-per-page__item--active a::after,.lt-ie9 .views-per-page__item--active:hover a::after,.lt-ie9 .views-per-page__item:hover a::after{content:""}.views-per-page__item--active a,.views-per-page__item--active:hover a{color:#0574ac}.sidebar{width:230px;padding:15px;background-color:#f2f2f2}.sidebar>.nav{margin-top:30px}.sidebar .nav a{color:#6f6f6f;display:block;padding:2px 0}.sidebar .nav .nav{display:none;margin:0 0 10px}.sidebar .nav .nav a{font-size:12px;font-size:.75rem;color:#999}.sidebar .nav a:hover,.sidebar>.nav .active>a{color:#FC411E;text-decoration:underline}.sidebar>.nav>.active .nav{display:block}.steptracker{padding:0;font-size:0;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.steptracker-bg{padding:0;font-size:0;position:relative}.steptracker-bg:before{content:'';position:absolute;height:4px;background:#e5e5e5;top:50%;right:0;left:0;margin-top:-2px;width:100%}.steptracker-track .circle{display:block;max-width:40px;max-height:40px;padding:11px 0;-moz-box-sizing:border-box;box-sizing:border-box;background:#e5e5e5;border-radius:20px;position:relative;font-size:11px;font-size:.6875rem;line-height:15px;color:#999;text-align:center;border:1px solid transparent;z-index:2}.steptracker-track .circle span{display:block;font-size:10px;font-size:.625rem;line-height:20px;text-align:left;color:#999;position:absolute;height:18px;width:65px;top:18px;left:0;padding-top:20px;cursor:default}.steptracker-track .track{content:'';position:absolute;height:4px;top:50%;left:0;width:0;margin-top:-2px;margin-left:20px;background:#e5e5e5;border-radius:2px;-webkit-transition:all .2s ease-in-out 0s;-moz-transition:all .2s ease-in-out 0s;transition:all .2s ease-in-out 0s}.steptracker-track.incomplete .track{background:#e5e5e5}.steptracker-track.done .track{background:#1b7e28;width:100%}.steptracker-track.active .track{background:#0574ac}.lt-ie9 .steptracker-track .circle span{left:-20px}.steptracker-track .circle,.steptracker-track .circle span{-webkit-transition:background-color .3s ease-out,color .3s ease-out;-moz-transition:background-color .3s ease-out,color .3s ease-out;transition:background-color .3s ease-out,color .3s ease-out}.steptracker-track{display:inline-block;font-size:15px;font-size:.9375rem;position:relative}.steptracker-track.active:before,.steptracker-track.done:before{width:101%}.steptracker-track.last{margin-right:-40px;width:40px}.steptracker-track.done .circle{background:#1b7e28;color:#fff;cursor:pointer}.steptracker-track.done .circle:hover{background:#199ddf;color:#fff}.steptracker-track.done .circle span{color:#444;cursor:pointer}.steptracker-track.incomplete .circle{background:#e5e5e5;color:#999}.steptracker-track.done .circle span:hover{color:#199ddf}.steptracker-track.active .circle{background:#0574ac;color:#fff}.steptracker-track.active .circle:hover{background:#199ddf;color:#fff}.steptracker-track.active .circle span{color:#0574ac}.steptracker-track.disabled{pointer-events:none;cursor:not-allowed}.att-timeline{position:relative}.att-timeline .completed-color{background-color:#1B7E28}.att-timeline .alert-color{background-color:#E00000}.att-timeline .cancelled-color{background-color:#999}.att-timeline .completed-color-text{color:#1B7E28}.att-timeline .alert-color-text{color:#E00000}.att-timeline .cancelled-color-text{color:#666}.att-timeline .inactive-color-text{color:#AAA}.att-timeline .timeline-bar{width:30%;float:left;position:relative}.att-timeline .timeline-bar .progress-bar{width:100%;height:2px;position:relative;z-index:100}.att-timeline .timeline-bar hr{border:0;border-top:2px dotted #AAA;position:relative;top:-20px;z-index:50px}.att-timeline .timeline-dot{width:10px;height:30px;top:-4px;position:relative;float:left}.att-timeline .timeline-dot .bigger-circle{width:10px;height:10px;border-radius:25px;z-index:50;position:absolute;opacity:.5}.att-timeline .timeline-dot .inactive-circle{width:10px;height:10px;border-radius:25px;border:1px solid #AAA;background-color:#fff;z-index:100;position:absolute}.att-timeline .timeline-dot .expandable-circle{width:10px;height:10px;border-radius:25px;z-index:150;position:absolute}.att-timeline .timeline-dot .below-info-box{position:relative;top:10px;left:4.5px;width:auto;min-width:150px}.att-timeline .timeline-dot .below-info-box .vertical-line{border-left:1px solid #AAA;width:1px;height:25px}.att-timeline .timeline-dot .below-info-box .info-container .title{position:relative;font-size:18px;line-height:22px;z-index:100;width:50%;font-family:clearview_att_regular}.att-timeline .timeline-dot .below-info-box .info-container .current-step-title{position:relative;font-size:18px;line-height:22px;z-index:100;width:50%;font-family:Arial}.att-timeline .timeline-dot .below-info-box .info-container .content{font-size:14px;color:#444;line-height:20px;position:relative}.att-timeline .timeline-dot .below-info-box .info-container .date{font-size:14px;color:#444;line-height:20px;position:relative;width:100%}.att-timeline .timeline-dot .above-info-box{position:relative;top:-105px;left:3.5px;width:auto;min-width:150px}.att-timeline .timeline-dot .above-info-box .vertical-line{border-left:1px solid #AAA;width:1px;height:25px}.att-timeline .timeline-dot .above-info-box .info-container .title{position:relative;font-size:18px;line-height:22px;z-index:100;width:50%;font-family:clearview_att_regular}.att-timeline .timeline-dot .above-info-box .info-container .current-step-title{position:relative;font-size:18px;line-height:22px;z-index:100;width:50%;font-family:Arial}.att-timeline .timeline-dot .above-info-box .info-container .content{font-size:14px;color:#444;line-height:20px;position:relative}.att-timeline .timeline-dot .above-info-box .info-container .date{font-size:14px;color:#444;line-height:20px;position:relative;width:100%}.vertical-nav{padding:11px 0;font-family:clearview_att_regular;font-size:11px}.vertical-nav ul{display:block;margin:0;padding:0 0 0 7px}.vertical-nav ul.tickets-list-height{height:221px;overflow-y:hidden}.vertical-nav ul.tickets-list-height-auto{height:auto}.vertical-nav ul li{display:block;padding:0 0 0 20px;height:41px;border-left:solid 1px #666;margin-top:3px;position:relative}.vertical-nav ul li i{position:absolute;left:-8px;top:2px;background-color:#f2f2f2;outline:3px solid #f2f2f2;outline-offset:0}.vertical-nav ul li i.icon-ticket-regular{border-radius:100%;width:6px;height:6px;background-color:#666;top:3px;left:-4px}.vertical-nav ul li .ticket-title{font-family:Arial;font-size:12px;line-height:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;width:45%}.vertical-nav ul li .ticket-title-regular{font-family:clearview_att_regular;font-size:11px;line-height:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;width:45%}.vertical-nav ul li .ticket-timestamp{font-size:11px;line-height:15px;padding:3px 0}.vertical-nav .view-log{position:absolute;right:0;bottom:4px}.vertical-nav .view-log a{text-decoration:underline}.tags__item{font-size:12px;font-size:.75rem;display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;border-radius:5px;border:1px solid #666;color:#444;margin:3px 5px 3px 0;padding:2px 10px}.tags__item a:hover{color:#666}.tags__item:last-child{margin-right:0}.tags__item:hover{background:#D3D3D3}.tags__item:active{background:#BBB}.tags__item:active>.tag__item--action,.tags__item:active>.tags__item--icon,.tags__item:hover>.tags__item--action,.tags__item:hover>.tags__item--icon{color:#444;border-color:#444}.tags__item.tags__item--color{border:1px solid #118817}.tags__item.tags__item--color .tags__item--title{padding-left:18px}.tags__item.tags__item--color .tags__item--color-icon{background:#118817;border:1px solid #118817;border-radius:100%;cursor:pointer;height:12px;width:12px;margin:6px 0 0;position:absolute;z-index:1}.tags__item.tags__item--color .active{background:#118817;color:#fff}.tags__item.tags__item--color .active>.tags__item--action{color:#fff;border-left:1px solid #fff}.tags__item.tags__item--color .active>.tags__item--color-icon,.tags__item.tags__item--color:hover>.tags__item--color-icon{border:1px solid #fff}.tags__item.tags__item--color:active{background:#118817;color:#fff}.tags__item.tags__item--color:active>.tags__item--action{color:#fff;border-left:1px solid #fff}.tags__item.tags__item--color:active>.tags__item--color-icon{border:1px solid #fff}.tags__item.tags__item--small{height:24px;padding:0 10px}.tags__item.tags__item--cloud .active{background:#157BB2;border-color:#157BB2}.tags__item.tags__item--cloud .active>.tags__item--icon,.tags__item.tags__item--cloud .active>.tags__item--title{color:#fff}.tags__item.tags__item--cloud:active{background:#157BB2;border-color:#157BB2}.tags__item.tags__item--cloud:active>.tags__item--icon,.tags__item.tags__item--cloud:active>.tags__item--title{color:#fff}.tags__item--action,.tags__item--icon,.tags__item--title{-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;transition:all .3s ease-out;font-size:14px;font-size:.875rem;line-height:1.7142857143;vertical-align:middle;margin:0}.tags__item--icon{font-size:14px;font-size:.875rem;line-height:1.7142857143;color:#888}.tags__item--action{border-left:1px solid #888;color:#888;cursor:pointer;margin-left:5px;text-align:center;width:18px}.tags__item--action [class^=icon-]{font-size:14px;font-size:.875rem;display:inline-block;zoom:1;*display:inline;*vertical-align:auto;margin-left:5px;margin-top:-2px;vertical-align:middle;width:14px}.lt-ie9 .tags__item--action [class^=icon-]{margin-top:4px}.att-progress{height:21px;background-color:#ddd;border-radius:21px;position:relative}.att-progress-value{border-radius:27px;background-color:#067ab4;width:0;min-width:21px;height:21px;-webkit-mask-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);-webkit-animation:att-progress 1s ease-out 0s infinite alternate,att-progress-width 10s ease-out infinite;-moz-animation:att-progress 1s ease-out 0s infinite alternate,att-progress-width 10s ease-out infinite;animation:att-progress 1s ease-out 0s infinite alternate,att-progress-width 10s ease-out infinite}@-webkit-keyframes att-progress{from{background-color:#067ab4}to{background-color:#199ddf}}@-moz-keyframes att-progress{from{background-color:#067ab4}to{background-color:#199ddf}}@keyframes att-progress{from{background-color:#067ab4}to{background-color:#199ddf}}@-webkit-keyframes att-progress-width{0%{width:0}100%,70%{width:100%}}@-moz-keyframes att-progress-width{0%{width:0}100%,70%{width:100%}}@keyframes att-progress-width{0%{width:0}100%,70%{width:100%}}.loader{display:inline-block;vertical-align:middle;background:url(images/loader.gif) center center no-repeat;min-width:75px;min-height:75px}.loading{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto}.loading .loading__inside,.loading:after,.loading:before{-webkit-animation:loading-item 1s infinite ease-out;-moz-animation:loading-item 1s infinite ease-out;animation:loading-item 1s infinite ease-out;width:8px;height:8px;display:inline-block;zoom:1;*display:inline;*vertical-align:auto;background:#000;border-radius:50%;content:'';margin-left:6px;vertical-align:middle}.loading:before{-webkit-animation-delay:1s;-moz-animation-delay:1s;animation-delay:1s;margin-left:0}.loading .loading__inside{-webkit-animation-delay:1.2s;-moz-animation-delay:1.2s;animation-delay:1.2s}.loading:after{-webkit-animation-delay:1.4s;-moz-animation-delay:1.4s;animation-delay:1.4s}.ie .loading{width:46px;height:20px;background:url(images/loading_balls_black.gif) center center no-repeat}.ie .loading .loading__inside,.ie .loading:after,.ie .loading:before{display:none}.loading--small .loading__inside,.loading--small:after,.loading--small:before{width:5px;height:5px;margin-left:4px}.ie .loading--small{width:37px;height:18px;background:url(images/loading_balls_black-small.gif) center center no-repeat}.ie .loading--small.att-loading--blue{background:url(images/loading_balls_blue-small.gif) center center no-repeat}.ie .loading--small.att-loading--white{background:url(images/loading_balls_white-small.gif) center center no-repeat}@-webkit-keyframes loading-item{0%{-webkit-transform:scale(1)}20%{-webkit-transform:scale(.8)}40%,60%{-webkit-transform:scale(.6)}80%{-webkit-transform:scale(.8)}100%{-webkit-transform:scale(1)}}@-moz-keyframes loading-item{0%{-moz-transform:scale(1)}20%{-moz-transform:scale(.8)}40%,60%{-moz-transform:scale(.6)}80%{-moz-transform:scale(.8)}100%{-moz-transform:scale(1)}}@-o-keyframes loading-item{0%{-o-transform:scale(1)}20%{-o-transform:scale(.8)}40%,60%{-o-transform:scale(.6)}80%{-o-transform:scale(.8)}100%{-o-transform:scale(1)}}@keyframes loading-item{0%{transform:scale(1)}20%{transform:scale(.8)}40%,60%{transform:scale(.6)}80%{transform:scale(.8)}100%{transform:scale(1)}}.att-loading-count{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;background-color:transparent;border-radius:50%;height:36px;position:relative;width:36px}.att-loading-count .att-loading-circle__fill,.att-loading-count .att-loading-circle__mask{height:36px;position:absolute;width:36px;-webkit-transition:transform 1s;-moz-transition:transform 1s;transition:transform 1s;-webkit-backface-visibility:hidden;border-radius:50%}.att-loading-count .att-loading-circle__mask{clip:rect(0,36px,36px,18px)}.att-loading-count .att-loading-circle__mask .att-loading-circle__fill{background-color:#444;clip:rect(0,18px,36px,0)}.att-loading-count .att-loading-inset{background-color:#f2f2f2;border-radius:50%;height:32px;left:0;margin-left:2px;margin-top:2px;position:absolute;top:0;width:32px}.lt-ie9 .att-loading-count .att-loading-inset{height:0;width:0}.att-loading-count .att-loading-inset__percentage{position:absolute;top:10px;left:1px;color:#444;font-size:12px;font-weight:800;line-height:1;text-align:center;width:30px}.att-loading-count[data-progress="0"] .att-loading-circle__fill,.att-loading-count[data-progress="0"] .att-loading-circle__fill.att-loading-circle__fix,.att-loading-count[data-progress="0"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}.att-loading-count[data-progress="0"] .att-loading-inset .att-loading-inset__percentage:before{content:"0"}.att-loading-count[data-progress="1"] .att-loading-circle__fill,.att-loading-count[data-progress="1"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(1.8deg);-moz-transform:rotate(1.8deg);-ms-transform:rotate(1.8deg);-o-transform:rotate(1.8deg);transform:rotate(1.8deg)}.att-loading-count[data-progress="1"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(3.6deg);-moz-transform:rotate(3.6deg);-ms-transform:rotate(3.6deg);-o-transform:rotate(3.6deg);transform:rotate(3.6deg)}.att-loading-count[data-progress="1"] .att-loading-inset .att-loading-inset__percentage:before{content:"1"}.att-loading-count[data-progress="2"] .att-loading-circle__fill,.att-loading-count[data-progress="2"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(3.6deg);-moz-transform:rotate(3.6deg);-ms-transform:rotate(3.6deg);-o-transform:rotate(3.6deg);transform:rotate(3.6deg)}.att-loading-count[data-progress="2"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(7.2deg);-moz-transform:rotate(7.2deg);-ms-transform:rotate(7.2deg);-o-transform:rotate(7.2deg);transform:rotate(7.2deg)}.att-loading-count[data-progress="2"] .att-loading-inset .att-loading-inset__percentage:before{content:"2"}.att-loading-count[data-progress="3"] .att-loading-circle__fill,.att-loading-count[data-progress="3"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(5.4deg);-moz-transform:rotate(5.4deg);-ms-transform:rotate(5.4deg);-o-transform:rotate(5.4deg);transform:rotate(5.4deg)}.att-loading-count[data-progress="3"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(10.8deg);-moz-transform:rotate(10.8deg);-ms-transform:rotate(10.8deg);-o-transform:rotate(10.8deg);transform:rotate(10.8deg)}.att-loading-count[data-progress="3"] .att-loading-inset .att-loading-inset__percentage:before{content:"3"}.att-loading-count[data-progress="4"] .att-loading-circle__fill,.att-loading-count[data-progress="4"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(7.2deg);-moz-transform:rotate(7.2deg);-ms-transform:rotate(7.2deg);-o-transform:rotate(7.2deg);transform:rotate(7.2deg)}.att-loading-count[data-progress="4"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(14.4deg);-moz-transform:rotate(14.4deg);-ms-transform:rotate(14.4deg);-o-transform:rotate(14.4deg);transform:rotate(14.4deg)}.att-loading-count[data-progress="4"] .att-loading-inset .att-loading-inset__percentage:before{content:"4"}.att-loading-count[data-progress="5"] .att-loading-circle__fill,.att-loading-count[data-progress="5"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(9deg);-moz-transform:rotate(9deg);-ms-transform:rotate(9deg);-o-transform:rotate(9deg);transform:rotate(9deg)}.att-loading-count[data-progress="5"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(18deg);-moz-transform:rotate(18deg);-ms-transform:rotate(18deg);-o-transform:rotate(18deg);transform:rotate(18deg)}.att-loading-count[data-progress="5"] .att-loading-inset .att-loading-inset__percentage:before{content:"5"}.att-loading-count[data-progress="6"] .att-loading-circle__fill,.att-loading-count[data-progress="6"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(10.8deg);-moz-transform:rotate(10.8deg);-ms-transform:rotate(10.8deg);-o-transform:rotate(10.8deg);transform:rotate(10.8deg)}.att-loading-count[data-progress="6"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(21.6deg);-moz-transform:rotate(21.6deg);-ms-transform:rotate(21.6deg);-o-transform:rotate(21.6deg);transform:rotate(21.6deg)}.att-loading-count[data-progress="6"] .att-loading-inset .att-loading-inset__percentage:before{content:"6"}.att-loading-count[data-progress="7"] .att-loading-circle__fill,.att-loading-count[data-progress="7"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(12.6deg);-moz-transform:rotate(12.6deg);-ms-transform:rotate(12.6deg);-o-transform:rotate(12.6deg);transform:rotate(12.6deg)}.att-loading-count[data-progress="7"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(25.2deg);-moz-transform:rotate(25.2deg);-ms-transform:rotate(25.2deg);-o-transform:rotate(25.2deg);transform:rotate(25.2deg)}.att-loading-count[data-progress="7"] .att-loading-inset .att-loading-inset__percentage:before{content:"7"}.att-loading-count[data-progress="8"] .att-loading-circle__fill,.att-loading-count[data-progress="8"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(14.4deg);-moz-transform:rotate(14.4deg);-ms-transform:rotate(14.4deg);-o-transform:rotate(14.4deg);transform:rotate(14.4deg)}.att-loading-count[data-progress="8"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(28.8deg);-moz-transform:rotate(28.8deg);-ms-transform:rotate(28.8deg);-o-transform:rotate(28.8deg);transform:rotate(28.8deg)}.att-loading-count[data-progress="8"] .att-loading-inset .att-loading-inset__percentage:before{content:"8"}.att-loading-count[data-progress="9"] .att-loading-circle__fill,.att-loading-count[data-progress="9"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(16.2deg);-moz-transform:rotate(16.2deg);-ms-transform:rotate(16.2deg);-o-transform:rotate(16.2deg);transform:rotate(16.2deg)}.att-loading-count[data-progress="9"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(32.4deg);-moz-transform:rotate(32.4deg);-ms-transform:rotate(32.4deg);-o-transform:rotate(32.4deg);transform:rotate(32.4deg)}.att-loading-count[data-progress="9"] .att-loading-inset .att-loading-inset__percentage:before{content:"9"}.att-loading-count[data-progress="10"] .att-loading-circle__fill,.att-loading-count[data-progress="10"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(18deg);-moz-transform:rotate(18deg);-ms-transform:rotate(18deg);-o-transform:rotate(18deg);transform:rotate(18deg)}.att-loading-count[data-progress="10"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(36deg);-moz-transform:rotate(36deg);-ms-transform:rotate(36deg);-o-transform:rotate(36deg);transform:rotate(36deg)}.att-loading-count[data-progress="10"] .att-loading-inset .att-loading-inset__percentage:before{content:"10"}.att-loading-count[data-progress="11"] .att-loading-circle__fill,.att-loading-count[data-progress="11"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(19.8deg);-moz-transform:rotate(19.8deg);-ms-transform:rotate(19.8deg);-o-transform:rotate(19.8deg);transform:rotate(19.8deg)}.att-loading-count[data-progress="11"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(39.6deg);-moz-transform:rotate(39.6deg);-ms-transform:rotate(39.6deg);-o-transform:rotate(39.6deg);transform:rotate(39.6deg)}.att-loading-count[data-progress="11"] .att-loading-inset .att-loading-inset__percentage:before{content:"11"}.att-loading-count[data-progress="12"] .att-loading-circle__fill,.att-loading-count[data-progress="12"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(21.6deg);-moz-transform:rotate(21.6deg);-ms-transform:rotate(21.6deg);-o-transform:rotate(21.6deg);transform:rotate(21.6deg)}.att-loading-count[data-progress="12"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(43.2deg);-moz-transform:rotate(43.2deg);-ms-transform:rotate(43.2deg);-o-transform:rotate(43.2deg);transform:rotate(43.2deg)}.att-loading-count[data-progress="12"] .att-loading-inset .att-loading-inset__percentage:before{content:"12"}.att-loading-count[data-progress="13"] .att-loading-circle__fill,.att-loading-count[data-progress="13"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(23.4deg);-moz-transform:rotate(23.4deg);-ms-transform:rotate(23.4deg);-o-transform:rotate(23.4deg);transform:rotate(23.4deg)}.att-loading-count[data-progress="13"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(46.8deg);-moz-transform:rotate(46.8deg);-ms-transform:rotate(46.8deg);-o-transform:rotate(46.8deg);transform:rotate(46.8deg)}.att-loading-count[data-progress="13"] .att-loading-inset .att-loading-inset__percentage:before{content:"13"}.att-loading-count[data-progress="14"] .att-loading-circle__fill,.att-loading-count[data-progress="14"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(25.2deg);-moz-transform:rotate(25.2deg);-ms-transform:rotate(25.2deg);-o-transform:rotate(25.2deg);transform:rotate(25.2deg)}.att-loading-count[data-progress="14"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(50.4deg);-moz-transform:rotate(50.4deg);-ms-transform:rotate(50.4deg);-o-transform:rotate(50.4deg);transform:rotate(50.4deg)}.att-loading-count[data-progress="14"] .att-loading-inset .att-loading-inset__percentage:before{content:"14"}.att-loading-count[data-progress="15"] .att-loading-circle__fill,.att-loading-count[data-progress="15"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(27deg);-moz-transform:rotate(27deg);-ms-transform:rotate(27deg);-o-transform:rotate(27deg);transform:rotate(27deg)}.att-loading-count[data-progress="15"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(54deg);-moz-transform:rotate(54deg);-ms-transform:rotate(54deg);-o-transform:rotate(54deg);transform:rotate(54deg)}.att-loading-count[data-progress="15"] .att-loading-inset .att-loading-inset__percentage:before{content:"15"}.att-loading-count[data-progress="16"] .att-loading-circle__fill,.att-loading-count[data-progress="16"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(28.8deg);-moz-transform:rotate(28.8deg);-ms-transform:rotate(28.8deg);-o-transform:rotate(28.8deg);transform:rotate(28.8deg)}.att-loading-count[data-progress="16"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(57.6deg);-moz-transform:rotate(57.6deg);-ms-transform:rotate(57.6deg);-o-transform:rotate(57.6deg);transform:rotate(57.6deg)}.att-loading-count[data-progress="16"] .att-loading-inset .att-loading-inset__percentage:before{content:"16"}.att-loading-count[data-progress="17"] .att-loading-circle__fill,.att-loading-count[data-progress="17"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(30.6deg);-moz-transform:rotate(30.6deg);-ms-transform:rotate(30.6deg);-o-transform:rotate(30.6deg);transform:rotate(30.6deg)}.att-loading-count[data-progress="17"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(61.2deg);-moz-transform:rotate(61.2deg);-ms-transform:rotate(61.2deg);-o-transform:rotate(61.2deg);transform:rotate(61.2deg)}.att-loading-count[data-progress="17"] .att-loading-inset .att-loading-inset__percentage:before{content:"17"}.att-loading-count[data-progress="18"] .att-loading-circle__fill,.att-loading-count[data-progress="18"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(32.4deg);-moz-transform:rotate(32.4deg);-ms-transform:rotate(32.4deg);-o-transform:rotate(32.4deg);transform:rotate(32.4deg)}.att-loading-count[data-progress="18"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(64.8deg);-moz-transform:rotate(64.8deg);-ms-transform:rotate(64.8deg);-o-transform:rotate(64.8deg);transform:rotate(64.8deg)}.att-loading-count[data-progress="18"] .att-loading-inset .att-loading-inset__percentage:before{content:"18"}.att-loading-count[data-progress="19"] .att-loading-circle__fill,.att-loading-count[data-progress="19"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(34.2deg);-moz-transform:rotate(34.2deg);-ms-transform:rotate(34.2deg);-o-transform:rotate(34.2deg);transform:rotate(34.2deg)}.att-loading-count[data-progress="19"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(68.4deg);-moz-transform:rotate(68.4deg);-ms-transform:rotate(68.4deg);-o-transform:rotate(68.4deg);transform:rotate(68.4deg)}.att-loading-count[data-progress="19"] .att-loading-inset .att-loading-inset__percentage:before{content:"19"}.att-loading-count[data-progress="20"] .att-loading-circle__fill,.att-loading-count[data-progress="20"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(36deg);-moz-transform:rotate(36deg);-ms-transform:rotate(36deg);-o-transform:rotate(36deg);transform:rotate(36deg)}.att-loading-count[data-progress="20"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(72deg);-moz-transform:rotate(72deg);-ms-transform:rotate(72deg);-o-transform:rotate(72deg);transform:rotate(72deg)}.att-loading-count[data-progress="20"] .att-loading-inset .att-loading-inset__percentage:before{content:"20"}.att-loading-count[data-progress="21"] .att-loading-circle__fill,.att-loading-count[data-progress="21"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(37.8deg);-moz-transform:rotate(37.8deg);-ms-transform:rotate(37.8deg);-o-transform:rotate(37.8deg);transform:rotate(37.8deg)}.att-loading-count[data-progress="21"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(75.6deg);-moz-transform:rotate(75.6deg);-ms-transform:rotate(75.6deg);-o-transform:rotate(75.6deg);transform:rotate(75.6deg)}.att-loading-count[data-progress="21"] .att-loading-inset .att-loading-inset__percentage:before{content:"21"}.att-loading-count[data-progress="22"] .att-loading-circle__fill,.att-loading-count[data-progress="22"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(39.6deg);-moz-transform:rotate(39.6deg);-ms-transform:rotate(39.6deg);-o-transform:rotate(39.6deg);transform:rotate(39.6deg)}.att-loading-count[data-progress="22"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(79.2deg);-moz-transform:rotate(79.2deg);-ms-transform:rotate(79.2deg);-o-transform:rotate(79.2deg);transform:rotate(79.2deg)}.att-loading-count[data-progress="22"] .att-loading-inset .att-loading-inset__percentage:before{content:"22"}.att-loading-count[data-progress="23"] .att-loading-circle__fill,.att-loading-count[data-progress="23"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(41.4deg);-moz-transform:rotate(41.4deg);-ms-transform:rotate(41.4deg);-o-transform:rotate(41.4deg);transform:rotate(41.4deg)}.att-loading-count[data-progress="23"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(82.8deg);-moz-transform:rotate(82.8deg);-ms-transform:rotate(82.8deg);-o-transform:rotate(82.8deg);transform:rotate(82.8deg)}.att-loading-count[data-progress="23"] .att-loading-inset .att-loading-inset__percentage:before{content:"23"}.att-loading-count[data-progress="24"] .att-loading-circle__fill,.att-loading-count[data-progress="24"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(43.2deg);-moz-transform:rotate(43.2deg);-ms-transform:rotate(43.2deg);-o-transform:rotate(43.2deg);transform:rotate(43.2deg)}.att-loading-count[data-progress="24"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(86.4deg);-moz-transform:rotate(86.4deg);-ms-transform:rotate(86.4deg);-o-transform:rotate(86.4deg);transform:rotate(86.4deg)}.att-loading-count[data-progress="24"] .att-loading-inset .att-loading-inset__percentage:before{content:"24"}.att-loading-count[data-progress="25"] .att-loading-circle__fill,.att-loading-count[data-progress="25"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.att-loading-count[data-progress="25"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.att-loading-count[data-progress="25"] .att-loading-inset .att-loading-inset__percentage:before{content:"25"}.att-loading-count[data-progress="26"] .att-loading-circle__fill,.att-loading-count[data-progress="26"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(46.8deg);-moz-transform:rotate(46.8deg);-ms-transform:rotate(46.8deg);-o-transform:rotate(46.8deg);transform:rotate(46.8deg)}.att-loading-count[data-progress="26"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(93.6deg);-moz-transform:rotate(93.6deg);-ms-transform:rotate(93.6deg);-o-transform:rotate(93.6deg);transform:rotate(93.6deg)}.att-loading-count[data-progress="26"] .att-loading-inset .att-loading-inset__percentage:before{content:"26"}.att-loading-count[data-progress="27"] .att-loading-circle__fill,.att-loading-count[data-progress="27"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(48.6deg);-moz-transform:rotate(48.6deg);-ms-transform:rotate(48.6deg);-o-transform:rotate(48.6deg);transform:rotate(48.6deg)}.att-loading-count[data-progress="27"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(97.2deg);-moz-transform:rotate(97.2deg);-ms-transform:rotate(97.2deg);-o-transform:rotate(97.2deg);transform:rotate(97.2deg)}.att-loading-count[data-progress="27"] .att-loading-inset .att-loading-inset__percentage:before{content:"27"}.att-loading-count[data-progress="28"] .att-loading-circle__fill,.att-loading-count[data-progress="28"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(50.4deg);-moz-transform:rotate(50.4deg);-ms-transform:rotate(50.4deg);-o-transform:rotate(50.4deg);transform:rotate(50.4deg)}.att-loading-count[data-progress="28"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(100.8deg);-moz-transform:rotate(100.8deg);-ms-transform:rotate(100.8deg);-o-transform:rotate(100.8deg);transform:rotate(100.8deg)}.att-loading-count[data-progress="28"] .att-loading-inset .att-loading-inset__percentage:before{content:"28"}.att-loading-count[data-progress="29"] .att-loading-circle__fill,.att-loading-count[data-progress="29"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(52.2deg);-moz-transform:rotate(52.2deg);-ms-transform:rotate(52.2deg);-o-transform:rotate(52.2deg);transform:rotate(52.2deg)}.att-loading-count[data-progress="29"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(104.4deg);-moz-transform:rotate(104.4deg);-ms-transform:rotate(104.4deg);-o-transform:rotate(104.4deg);transform:rotate(104.4deg)}.att-loading-count[data-progress="29"] .att-loading-inset .att-loading-inset__percentage:before{content:"29"}.att-loading-count[data-progress="30"] .att-loading-circle__fill,.att-loading-count[data-progress="30"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(54deg);-moz-transform:rotate(54deg);-ms-transform:rotate(54deg);-o-transform:rotate(54deg);transform:rotate(54deg)}.att-loading-count[data-progress="30"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(108deg);-moz-transform:rotate(108deg);-ms-transform:rotate(108deg);-o-transform:rotate(108deg);transform:rotate(108deg)}.att-loading-count[data-progress="30"] .att-loading-inset .att-loading-inset__percentage:before{content:"30"}.att-loading-count[data-progress="31"] .att-loading-circle__fill,.att-loading-count[data-progress="31"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(55.8deg);-moz-transform:rotate(55.8deg);-ms-transform:rotate(55.8deg);-o-transform:rotate(55.8deg);transform:rotate(55.8deg)}.att-loading-count[data-progress="31"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(111.6deg);-moz-transform:rotate(111.6deg);-ms-transform:rotate(111.6deg);-o-transform:rotate(111.6deg);transform:rotate(111.6deg)}.att-loading-count[data-progress="31"] .att-loading-inset .att-loading-inset__percentage:before{content:"31"}.att-loading-count[data-progress="32"] .att-loading-circle__fill,.att-loading-count[data-progress="32"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(57.6deg);-moz-transform:rotate(57.6deg);-ms-transform:rotate(57.6deg);-o-transform:rotate(57.6deg);transform:rotate(57.6deg)}.att-loading-count[data-progress="32"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(115.2deg);-moz-transform:rotate(115.2deg);-ms-transform:rotate(115.2deg);-o-transform:rotate(115.2deg);transform:rotate(115.2deg)}.att-loading-count[data-progress="32"] .att-loading-inset .att-loading-inset__percentage:before{content:"32"}.att-loading-count[data-progress="33"] .att-loading-circle__fill,.att-loading-count[data-progress="33"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(59.4deg);-moz-transform:rotate(59.4deg);-ms-transform:rotate(59.4deg);-o-transform:rotate(59.4deg);transform:rotate(59.4deg)}.att-loading-count[data-progress="33"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(118.8deg);-moz-transform:rotate(118.8deg);-ms-transform:rotate(118.8deg);-o-transform:rotate(118.8deg);transform:rotate(118.8deg)}.att-loading-count[data-progress="33"] .att-loading-inset .att-loading-inset__percentage:before{content:"33"}.att-loading-count[data-progress="34"] .att-loading-circle__fill,.att-loading-count[data-progress="34"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(61.2deg);-moz-transform:rotate(61.2deg);-ms-transform:rotate(61.2deg);-o-transform:rotate(61.2deg);transform:rotate(61.2deg)}.att-loading-count[data-progress="34"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(122.4deg);-moz-transform:rotate(122.4deg);-ms-transform:rotate(122.4deg);-o-transform:rotate(122.4deg);transform:rotate(122.4deg)}.att-loading-count[data-progress="34"] .att-loading-inset .att-loading-inset__percentage:before{content:"34"}.att-loading-count[data-progress="35"] .att-loading-circle__fill,.att-loading-count[data-progress="35"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(63deg);-moz-transform:rotate(63deg);-ms-transform:rotate(63deg);-o-transform:rotate(63deg);transform:rotate(63deg)}.att-loading-count[data-progress="35"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(126deg);-moz-transform:rotate(126deg);-ms-transform:rotate(126deg);-o-transform:rotate(126deg);transform:rotate(126deg)}.att-loading-count[data-progress="35"] .att-loading-inset .att-loading-inset__percentage:before{content:"35"}.att-loading-count[data-progress="36"] .att-loading-circle__fill,.att-loading-count[data-progress="36"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(64.8deg);-moz-transform:rotate(64.8deg);-ms-transform:rotate(64.8deg);-o-transform:rotate(64.8deg);transform:rotate(64.8deg)}.att-loading-count[data-progress="36"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(129.6deg);-moz-transform:rotate(129.6deg);-ms-transform:rotate(129.6deg);-o-transform:rotate(129.6deg);transform:rotate(129.6deg)}.att-loading-count[data-progress="36"] .att-loading-inset .att-loading-inset__percentage:before{content:"36"}.att-loading-count[data-progress="37"] .att-loading-circle__fill,.att-loading-count[data-progress="37"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(66.6deg);-moz-transform:rotate(66.6deg);-ms-transform:rotate(66.6deg);-o-transform:rotate(66.6deg);transform:rotate(66.6deg)}.att-loading-count[data-progress="37"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(133.2deg);-moz-transform:rotate(133.2deg);-ms-transform:rotate(133.2deg);-o-transform:rotate(133.2deg);transform:rotate(133.2deg)}.att-loading-count[data-progress="37"] .att-loading-inset .att-loading-inset__percentage:before{content:"37"}.att-loading-count[data-progress="38"] .att-loading-circle__fill,.att-loading-count[data-progress="38"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(68.4deg);-moz-transform:rotate(68.4deg);-ms-transform:rotate(68.4deg);-o-transform:rotate(68.4deg);transform:rotate(68.4deg)}.att-loading-count[data-progress="38"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(136.8deg);-moz-transform:rotate(136.8deg);-ms-transform:rotate(136.8deg);-o-transform:rotate(136.8deg);transform:rotate(136.8deg)}.att-loading-count[data-progress="38"] .att-loading-inset .att-loading-inset__percentage:before{content:"38"}.att-loading-count[data-progress="39"] .att-loading-circle__fill,.att-loading-count[data-progress="39"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(70.2deg);-moz-transform:rotate(70.2deg);-ms-transform:rotate(70.2deg);-o-transform:rotate(70.2deg);transform:rotate(70.2deg)}.att-loading-count[data-progress="39"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(140.4deg);-moz-transform:rotate(140.4deg);-ms-transform:rotate(140.4deg);-o-transform:rotate(140.4deg);transform:rotate(140.4deg)}.att-loading-count[data-progress="39"] .att-loading-inset .att-loading-inset__percentage:before{content:"39"}.att-loading-count[data-progress="40"] .att-loading-circle__fill,.att-loading-count[data-progress="40"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(72deg);-moz-transform:rotate(72deg);-ms-transform:rotate(72deg);-o-transform:rotate(72deg);transform:rotate(72deg)}.att-loading-count[data-progress="40"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(144deg);-moz-transform:rotate(144deg);-ms-transform:rotate(144deg);-o-transform:rotate(144deg);transform:rotate(144deg)}.att-loading-count[data-progress="40"] .att-loading-inset .att-loading-inset__percentage:before{content:"40"}.att-loading-count[data-progress="41"] .att-loading-circle__fill,.att-loading-count[data-progress="41"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(73.8deg);-moz-transform:rotate(73.8deg);-ms-transform:rotate(73.8deg);-o-transform:rotate(73.8deg);transform:rotate(73.8deg)}.att-loading-count[data-progress="41"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(147.6deg);-moz-transform:rotate(147.6deg);-ms-transform:rotate(147.6deg);-o-transform:rotate(147.6deg);transform:rotate(147.6deg)}.att-loading-count[data-progress="41"] .att-loading-inset .att-loading-inset__percentage:before{content:"41"}.att-loading-count[data-progress="42"] .att-loading-circle__fill,.att-loading-count[data-progress="42"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(75.6deg);-moz-transform:rotate(75.6deg);-ms-transform:rotate(75.6deg);-o-transform:rotate(75.6deg);transform:rotate(75.6deg)}.att-loading-count[data-progress="42"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(151.2deg);-moz-transform:rotate(151.2deg);-ms-transform:rotate(151.2deg);-o-transform:rotate(151.2deg);transform:rotate(151.2deg)}.att-loading-count[data-progress="42"] .att-loading-inset .att-loading-inset__percentage:before{content:"42"}.att-loading-count[data-progress="43"] .att-loading-circle__fill,.att-loading-count[data-progress="43"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(77.4deg);-moz-transform:rotate(77.4deg);-ms-transform:rotate(77.4deg);-o-transform:rotate(77.4deg);transform:rotate(77.4deg)}.att-loading-count[data-progress="43"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(154.8deg);-moz-transform:rotate(154.8deg);-ms-transform:rotate(154.8deg);-o-transform:rotate(154.8deg);transform:rotate(154.8deg)}.att-loading-count[data-progress="43"] .att-loading-inset .att-loading-inset__percentage:before{content:"43"}.att-loading-count[data-progress="44"] .att-loading-circle__fill,.att-loading-count[data-progress="44"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(79.2deg);-moz-transform:rotate(79.2deg);-ms-transform:rotate(79.2deg);-o-transform:rotate(79.2deg);transform:rotate(79.2deg)}.att-loading-count[data-progress="44"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(158.4deg);-moz-transform:rotate(158.4deg);-ms-transform:rotate(158.4deg);-o-transform:rotate(158.4deg);transform:rotate(158.4deg)}.att-loading-count[data-progress="44"] .att-loading-inset .att-loading-inset__percentage:before{content:"44"}.att-loading-count[data-progress="45"] .att-loading-circle__fill,.att-loading-count[data-progress="45"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(81deg);-moz-transform:rotate(81deg);-ms-transform:rotate(81deg);-o-transform:rotate(81deg);transform:rotate(81deg)}.att-loading-count[data-progress="45"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(162deg);-moz-transform:rotate(162deg);-ms-transform:rotate(162deg);-o-transform:rotate(162deg);transform:rotate(162deg)}.att-loading-count[data-progress="45"] .att-loading-inset .att-loading-inset__percentage:before{content:"45"}.att-loading-count[data-progress="46"] .att-loading-circle__fill,.att-loading-count[data-progress="46"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(82.8deg);-moz-transform:rotate(82.8deg);-ms-transform:rotate(82.8deg);-o-transform:rotate(82.8deg);transform:rotate(82.8deg)}.att-loading-count[data-progress="46"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(165.6deg);-moz-transform:rotate(165.6deg);-ms-transform:rotate(165.6deg);-o-transform:rotate(165.6deg);transform:rotate(165.6deg)}.att-loading-count[data-progress="46"] .att-loading-inset .att-loading-inset__percentage:before{content:"46"}.att-loading-count[data-progress="47"] .att-loading-circle__fill,.att-loading-count[data-progress="47"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(84.6deg);-moz-transform:rotate(84.6deg);-ms-transform:rotate(84.6deg);-o-transform:rotate(84.6deg);transform:rotate(84.6deg)}.att-loading-count[data-progress="47"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(169.2deg);-moz-transform:rotate(169.2deg);-ms-transform:rotate(169.2deg);-o-transform:rotate(169.2deg);transform:rotate(169.2deg)}.att-loading-count[data-progress="47"] .att-loading-inset .att-loading-inset__percentage:before{content:"47"}.att-loading-count[data-progress="48"] .att-loading-circle__fill,.att-loading-count[data-progress="48"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(86.4deg);-moz-transform:rotate(86.4deg);-ms-transform:rotate(86.4deg);-o-transform:rotate(86.4deg);transform:rotate(86.4deg)}.att-loading-count[data-progress="48"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(172.8deg);-moz-transform:rotate(172.8deg);-ms-transform:rotate(172.8deg);-o-transform:rotate(172.8deg);transform:rotate(172.8deg)}.att-loading-count[data-progress="48"] .att-loading-inset .att-loading-inset__percentage:before{content:"48"}.att-loading-count[data-progress="49"] .att-loading-circle__fill,.att-loading-count[data-progress="49"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(88.2deg);-moz-transform:rotate(88.2deg);-ms-transform:rotate(88.2deg);-o-transform:rotate(88.2deg);transform:rotate(88.2deg)}.att-loading-count[data-progress="49"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(176.4deg);-moz-transform:rotate(176.4deg);-ms-transform:rotate(176.4deg);-o-transform:rotate(176.4deg);transform:rotate(176.4deg)}.att-loading-count[data-progress="49"] .att-loading-inset .att-loading-inset__percentage:before{content:"49"}.att-loading-count[data-progress="50"] .att-loading-circle__fill,.att-loading-count[data-progress="50"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.att-loading-count[data-progress="50"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.att-loading-count[data-progress="50"] .att-loading-inset .att-loading-inset__percentage:before{content:"50"}.att-loading-count[data-progress="51"] .att-loading-circle__fill,.att-loading-count[data-progress="51"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(91.8deg);-moz-transform:rotate(91.8deg);-ms-transform:rotate(91.8deg);-o-transform:rotate(91.8deg);transform:rotate(91.8deg)}.att-loading-count[data-progress="51"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(183.6deg);-moz-transform:rotate(183.6deg);-ms-transform:rotate(183.6deg);-o-transform:rotate(183.6deg);transform:rotate(183.6deg)}.att-loading-count[data-progress="51"] .att-loading-inset .att-loading-inset__percentage:before{content:"51"}.att-loading-count[data-progress="52"] .att-loading-circle__fill,.att-loading-count[data-progress="52"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(93.6deg);-moz-transform:rotate(93.6deg);-ms-transform:rotate(93.6deg);-o-transform:rotate(93.6deg);transform:rotate(93.6deg)}.att-loading-count[data-progress="52"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(187.2deg);-moz-transform:rotate(187.2deg);-ms-transform:rotate(187.2deg);-o-transform:rotate(187.2deg);transform:rotate(187.2deg)}.att-loading-count[data-progress="52"] .att-loading-inset .att-loading-inset__percentage:before{content:"52"}.att-loading-count[data-progress="53"] .att-loading-circle__fill,.att-loading-count[data-progress="53"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(95.4deg);-moz-transform:rotate(95.4deg);-ms-transform:rotate(95.4deg);-o-transform:rotate(95.4deg);transform:rotate(95.4deg)}.att-loading-count[data-progress="53"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(190.8deg);-moz-transform:rotate(190.8deg);-ms-transform:rotate(190.8deg);-o-transform:rotate(190.8deg);transform:rotate(190.8deg)}.att-loading-count[data-progress="53"] .att-loading-inset .att-loading-inset__percentage:before{content:"53"}.att-loading-count[data-progress="54"] .att-loading-circle__fill,.att-loading-count[data-progress="54"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(97.2deg);-moz-transform:rotate(97.2deg);-ms-transform:rotate(97.2deg);-o-transform:rotate(97.2deg);transform:rotate(97.2deg)}.att-loading-count[data-progress="54"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(194.4deg);-moz-transform:rotate(194.4deg);-ms-transform:rotate(194.4deg);-o-transform:rotate(194.4deg);transform:rotate(194.4deg)}.att-loading-count[data-progress="54"] .att-loading-inset .att-loading-inset__percentage:before{content:"54"}.att-loading-count[data-progress="55"] .att-loading-circle__fill,.att-loading-count[data-progress="55"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(99deg);-moz-transform:rotate(99deg);-ms-transform:rotate(99deg);-o-transform:rotate(99deg);transform:rotate(99deg)}.att-loading-count[data-progress="55"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(198deg);-moz-transform:rotate(198deg);-ms-transform:rotate(198deg);-o-transform:rotate(198deg);transform:rotate(198deg)}.att-loading-count[data-progress="55"] .att-loading-inset .att-loading-inset__percentage:before{content:"55"}.att-loading-count[data-progress="56"] .att-loading-circle__fill,.att-loading-count[data-progress="56"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(100.8deg);-moz-transform:rotate(100.8deg);-ms-transform:rotate(100.8deg);-o-transform:rotate(100.8deg);transform:rotate(100.8deg)}.att-loading-count[data-progress="56"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(201.6deg);-moz-transform:rotate(201.6deg);-ms-transform:rotate(201.6deg);-o-transform:rotate(201.6deg);transform:rotate(201.6deg)}.att-loading-count[data-progress="56"] .att-loading-inset .att-loading-inset__percentage:before{content:"56"}.att-loading-count[data-progress="57"] .att-loading-circle__fill,.att-loading-count[data-progress="57"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(102.6deg);-moz-transform:rotate(102.6deg);-ms-transform:rotate(102.6deg);-o-transform:rotate(102.6deg);transform:rotate(102.6deg)}.att-loading-count[data-progress="57"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(205.2deg);-moz-transform:rotate(205.2deg);-ms-transform:rotate(205.2deg);-o-transform:rotate(205.2deg);transform:rotate(205.2deg)}.att-loading-count[data-progress="57"] .att-loading-inset .att-loading-inset__percentage:before{content:"57"}.att-loading-count[data-progress="58"] .att-loading-circle__fill,.att-loading-count[data-progress="58"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(104.4deg);-moz-transform:rotate(104.4deg);-ms-transform:rotate(104.4deg);-o-transform:rotate(104.4deg);transform:rotate(104.4deg)}.att-loading-count[data-progress="58"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(208.8deg);-moz-transform:rotate(208.8deg);-ms-transform:rotate(208.8deg);-o-transform:rotate(208.8deg);transform:rotate(208.8deg)}.att-loading-count[data-progress="58"] .att-loading-inset .att-loading-inset__percentage:before{content:"58"}.att-loading-count[data-progress="59"] .att-loading-circle__fill,.att-loading-count[data-progress="59"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(106.2deg);-moz-transform:rotate(106.2deg);-ms-transform:rotate(106.2deg);-o-transform:rotate(106.2deg);transform:rotate(106.2deg)}.att-loading-count[data-progress="59"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(212.4deg);-moz-transform:rotate(212.4deg);-ms-transform:rotate(212.4deg);-o-transform:rotate(212.4deg);transform:rotate(212.4deg)}.att-loading-count[data-progress="59"] .att-loading-inset .att-loading-inset__percentage:before{content:"59"}.att-loading-count[data-progress="60"] .att-loading-circle__fill,.att-loading-count[data-progress="60"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(108deg);-moz-transform:rotate(108deg);-ms-transform:rotate(108deg);-o-transform:rotate(108deg);transform:rotate(108deg)}.att-loading-count[data-progress="60"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(216deg);-moz-transform:rotate(216deg);-ms-transform:rotate(216deg);-o-transform:rotate(216deg);transform:rotate(216deg)}.att-loading-count[data-progress="60"] .att-loading-inset .att-loading-inset__percentage:before{content:"60"}.att-loading-count[data-progress="61"] .att-loading-circle__fill,.att-loading-count[data-progress="61"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(109.8deg);-moz-transform:rotate(109.8deg);-ms-transform:rotate(109.8deg);-o-transform:rotate(109.8deg);transform:rotate(109.8deg)}.att-loading-count[data-progress="61"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(219.6deg);-moz-transform:rotate(219.6deg);-ms-transform:rotate(219.6deg);-o-transform:rotate(219.6deg);transform:rotate(219.6deg)}.att-loading-count[data-progress="61"] .att-loading-inset .att-loading-inset__percentage:before{content:"61"}.att-loading-count[data-progress="62"] .att-loading-circle__fill,.att-loading-count[data-progress="62"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(111.6deg);-moz-transform:rotate(111.6deg);-ms-transform:rotate(111.6deg);-o-transform:rotate(111.6deg);transform:rotate(111.6deg)}.att-loading-count[data-progress="62"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(223.2deg);-moz-transform:rotate(223.2deg);-ms-transform:rotate(223.2deg);-o-transform:rotate(223.2deg);transform:rotate(223.2deg)}.att-loading-count[data-progress="62"] .att-loading-inset .att-loading-inset__percentage:before{content:"62"}.att-loading-count[data-progress="63"] .att-loading-circle__fill,.att-loading-count[data-progress="63"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(113.4deg);-moz-transform:rotate(113.4deg);-ms-transform:rotate(113.4deg);-o-transform:rotate(113.4deg);transform:rotate(113.4deg)}.att-loading-count[data-progress="63"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(226.8deg);-moz-transform:rotate(226.8deg);-ms-transform:rotate(226.8deg);-o-transform:rotate(226.8deg);transform:rotate(226.8deg)}.att-loading-count[data-progress="63"] .att-loading-inset .att-loading-inset__percentage:before{content:"63"}.att-loading-count[data-progress="64"] .att-loading-circle__fill,.att-loading-count[data-progress="64"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(115.2deg);-moz-transform:rotate(115.2deg);-ms-transform:rotate(115.2deg);-o-transform:rotate(115.2deg);transform:rotate(115.2deg)}.att-loading-count[data-progress="64"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(230.4deg);-moz-transform:rotate(230.4deg);-ms-transform:rotate(230.4deg);-o-transform:rotate(230.4deg);transform:rotate(230.4deg)}.att-loading-count[data-progress="64"] .att-loading-inset .att-loading-inset__percentage:before{content:"64"}.att-loading-count[data-progress="65"] .att-loading-circle__fill,.att-loading-count[data-progress="65"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(117deg);-moz-transform:rotate(117deg);-ms-transform:rotate(117deg);-o-transform:rotate(117deg);transform:rotate(117deg)}.att-loading-count[data-progress="65"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(234deg);-moz-transform:rotate(234deg);-ms-transform:rotate(234deg);-o-transform:rotate(234deg);transform:rotate(234deg)}.att-loading-count[data-progress="65"] .att-loading-inset .att-loading-inset__percentage:before{content:"65"}.att-loading-count[data-progress="66"] .att-loading-circle__fill,.att-loading-count[data-progress="66"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(118.8deg);-moz-transform:rotate(118.8deg);-ms-transform:rotate(118.8deg);-o-transform:rotate(118.8deg);transform:rotate(118.8deg)}.att-loading-count[data-progress="66"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(237.6deg);-moz-transform:rotate(237.6deg);-ms-transform:rotate(237.6deg);-o-transform:rotate(237.6deg);transform:rotate(237.6deg)}.att-loading-count[data-progress="66"] .att-loading-inset .att-loading-inset__percentage:before{content:"66"}.att-loading-count[data-progress="67"] .att-loading-circle__fill,.att-loading-count[data-progress="67"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(120.6deg);-moz-transform:rotate(120.6deg);-ms-transform:rotate(120.6deg);-o-transform:rotate(120.6deg);transform:rotate(120.6deg)}.att-loading-count[data-progress="67"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(241.2deg);-moz-transform:rotate(241.2deg);-ms-transform:rotate(241.2deg);-o-transform:rotate(241.2deg);transform:rotate(241.2deg)}.att-loading-count[data-progress="67"] .att-loading-inset .att-loading-inset__percentage:before{content:"67"}.att-loading-count[data-progress="68"] .att-loading-circle__fill,.att-loading-count[data-progress="68"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(122.4deg);-moz-transform:rotate(122.4deg);-ms-transform:rotate(122.4deg);-o-transform:rotate(122.4deg);transform:rotate(122.4deg)}.att-loading-count[data-progress="68"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(244.8deg);-moz-transform:rotate(244.8deg);-ms-transform:rotate(244.8deg);-o-transform:rotate(244.8deg);transform:rotate(244.8deg)}.att-loading-count[data-progress="68"] .att-loading-inset .att-loading-inset__percentage:before{content:"68"}.att-loading-count[data-progress="69"] .att-loading-circle__fill,.att-loading-count[data-progress="69"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(124.2deg);-moz-transform:rotate(124.2deg);-ms-transform:rotate(124.2deg);-o-transform:rotate(124.2deg);transform:rotate(124.2deg)}.att-loading-count[data-progress="69"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(248.4deg);-moz-transform:rotate(248.4deg);-ms-transform:rotate(248.4deg);-o-transform:rotate(248.4deg);transform:rotate(248.4deg)}.att-loading-count[data-progress="69"] .att-loading-inset .att-loading-inset__percentage:before{content:"69"}.att-loading-count[data-progress="70"] .att-loading-circle__fill,.att-loading-count[data-progress="70"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(126deg);-moz-transform:rotate(126deg);-ms-transform:rotate(126deg);-o-transform:rotate(126deg);transform:rotate(126deg)}.att-loading-count[data-progress="70"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(252deg);-moz-transform:rotate(252deg);-ms-transform:rotate(252deg);-o-transform:rotate(252deg);transform:rotate(252deg)}.att-loading-count[data-progress="70"] .att-loading-inset .att-loading-inset__percentage:before{content:"70"}.att-loading-count[data-progress="71"] .att-loading-circle__fill,.att-loading-count[data-progress="71"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(127.8deg);-moz-transform:rotate(127.8deg);-ms-transform:rotate(127.8deg);-o-transform:rotate(127.8deg);transform:rotate(127.8deg)}.att-loading-count[data-progress="71"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(255.6deg);-moz-transform:rotate(255.6deg);-ms-transform:rotate(255.6deg);-o-transform:rotate(255.6deg);transform:rotate(255.6deg)}.att-loading-count[data-progress="71"] .att-loading-inset .att-loading-inset__percentage:before{content:"71"}.att-loading-count[data-progress="72"] .att-loading-circle__fill,.att-loading-count[data-progress="72"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(129.6deg);-moz-transform:rotate(129.6deg);-ms-transform:rotate(129.6deg);-o-transform:rotate(129.6deg);transform:rotate(129.6deg)}.att-loading-count[data-progress="72"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(259.2deg);-moz-transform:rotate(259.2deg);-ms-transform:rotate(259.2deg);-o-transform:rotate(259.2deg);transform:rotate(259.2deg)}.att-loading-count[data-progress="72"] .att-loading-inset .att-loading-inset__percentage:before{content:"72"}.att-loading-count[data-progress="73"] .att-loading-circle__fill,.att-loading-count[data-progress="73"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(131.4deg);-moz-transform:rotate(131.4deg);-ms-transform:rotate(131.4deg);-o-transform:rotate(131.4deg);transform:rotate(131.4deg)}.att-loading-count[data-progress="73"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(262.8deg);-moz-transform:rotate(262.8deg);-ms-transform:rotate(262.8deg);-o-transform:rotate(262.8deg);transform:rotate(262.8deg)}.att-loading-count[data-progress="73"] .att-loading-inset .att-loading-inset__percentage:before{content:"73"}.att-loading-count[data-progress="74"] .att-loading-circle__fill,.att-loading-count[data-progress="74"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(133.2deg);-moz-transform:rotate(133.2deg);-ms-transform:rotate(133.2deg);-o-transform:rotate(133.2deg);transform:rotate(133.2deg)}.att-loading-count[data-progress="74"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(266.4deg);-moz-transform:rotate(266.4deg);-ms-transform:rotate(266.4deg);-o-transform:rotate(266.4deg);transform:rotate(266.4deg)}.att-loading-count[data-progress="74"] .att-loading-inset .att-loading-inset__percentage:before{content:"74"}.att-loading-count[data-progress="75"] .att-loading-circle__fill,.att-loading-count[data-progress="75"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(135deg);-moz-transform:rotate(135deg);-ms-transform:rotate(135deg);-o-transform:rotate(135deg);transform:rotate(135deg)}.att-loading-count[data-progress="75"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.att-loading-count[data-progress="75"] .att-loading-inset .att-loading-inset__percentage:before{content:"75"}.att-loading-count[data-progress="76"] .att-loading-circle__fill,.att-loading-count[data-progress="76"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(136.8deg);-moz-transform:rotate(136.8deg);-ms-transform:rotate(136.8deg);-o-transform:rotate(136.8deg);transform:rotate(136.8deg)}.att-loading-count[data-progress="76"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(273.6deg);-moz-transform:rotate(273.6deg);-ms-transform:rotate(273.6deg);-o-transform:rotate(273.6deg);transform:rotate(273.6deg)}.att-loading-count[data-progress="76"] .att-loading-inset .att-loading-inset__percentage:before{content:"76"}.att-loading-count[data-progress="77"] .att-loading-circle__fill,.att-loading-count[data-progress="77"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(138.6deg);-moz-transform:rotate(138.6deg);-ms-transform:rotate(138.6deg);-o-transform:rotate(138.6deg);transform:rotate(138.6deg)}.att-loading-count[data-progress="77"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(277.2deg);-moz-transform:rotate(277.2deg);-ms-transform:rotate(277.2deg);-o-transform:rotate(277.2deg);transform:rotate(277.2deg)}.att-loading-count[data-progress="77"] .att-loading-inset .att-loading-inset__percentage:before{content:"77"}.att-loading-count[data-progress="78"] .att-loading-circle__fill,.att-loading-count[data-progress="78"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(140.4deg);-moz-transform:rotate(140.4deg);-ms-transform:rotate(140.4deg);-o-transform:rotate(140.4deg);transform:rotate(140.4deg)}.att-loading-count[data-progress="78"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(280.8deg);-moz-transform:rotate(280.8deg);-ms-transform:rotate(280.8deg);-o-transform:rotate(280.8deg);transform:rotate(280.8deg)}.att-loading-count[data-progress="78"] .att-loading-inset .att-loading-inset__percentage:before{content:"78"}.att-loading-count[data-progress="79"] .att-loading-circle__fill,.att-loading-count[data-progress="79"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(142.2deg);-moz-transform:rotate(142.2deg);-ms-transform:rotate(142.2deg);-o-transform:rotate(142.2deg);transform:rotate(142.2deg)}.att-loading-count[data-progress="79"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(284.4deg);-moz-transform:rotate(284.4deg);-ms-transform:rotate(284.4deg);-o-transform:rotate(284.4deg);transform:rotate(284.4deg)}.att-loading-count[data-progress="79"] .att-loading-inset .att-loading-inset__percentage:before{content:"79"}.att-loading-count[data-progress="80"] .att-loading-circle__fill,.att-loading-count[data-progress="80"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(144deg);-moz-transform:rotate(144deg);-ms-transform:rotate(144deg);-o-transform:rotate(144deg);transform:rotate(144deg)}.att-loading-count[data-progress="80"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(288deg);-moz-transform:rotate(288deg);-ms-transform:rotate(288deg);-o-transform:rotate(288deg);transform:rotate(288deg)}.att-loading-count[data-progress="80"] .att-loading-inset .att-loading-inset__percentage:before{content:"80"}.att-loading-count[data-progress="81"] .att-loading-circle__fill,.att-loading-count[data-progress="81"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(145.8deg);-moz-transform:rotate(145.8deg);-ms-transform:rotate(145.8deg);-o-transform:rotate(145.8deg);transform:rotate(145.8deg)}.att-loading-count[data-progress="81"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(291.6deg);-moz-transform:rotate(291.6deg);-ms-transform:rotate(291.6deg);-o-transform:rotate(291.6deg);transform:rotate(291.6deg)}.att-loading-count[data-progress="81"] .att-loading-inset .att-loading-inset__percentage:before{content:"81"}.att-loading-count[data-progress="82"] .att-loading-circle__fill,.att-loading-count[data-progress="82"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(147.6deg);-moz-transform:rotate(147.6deg);-ms-transform:rotate(147.6deg);-o-transform:rotate(147.6deg);transform:rotate(147.6deg)}.att-loading-count[data-progress="82"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(295.2deg);-moz-transform:rotate(295.2deg);-ms-transform:rotate(295.2deg);-o-transform:rotate(295.2deg);transform:rotate(295.2deg)}.att-loading-count[data-progress="82"] .att-loading-inset .att-loading-inset__percentage:before{content:"82"}.att-loading-count[data-progress="83"] .att-loading-circle__fill,.att-loading-count[data-progress="83"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(149.4deg);-moz-transform:rotate(149.4deg);-ms-transform:rotate(149.4deg);-o-transform:rotate(149.4deg);transform:rotate(149.4deg)}.att-loading-count[data-progress="83"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(298.8deg);-moz-transform:rotate(298.8deg);-ms-transform:rotate(298.8deg);-o-transform:rotate(298.8deg);transform:rotate(298.8deg)}.att-loading-count[data-progress="83"] .att-loading-inset .att-loading-inset__percentage:before{content:"83"}.att-loading-count[data-progress="84"] .att-loading-circle__fill,.att-loading-count[data-progress="84"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(151.2deg);-moz-transform:rotate(151.2deg);-ms-transform:rotate(151.2deg);-o-transform:rotate(151.2deg);transform:rotate(151.2deg)}.att-loading-count[data-progress="84"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(302.4deg);-moz-transform:rotate(302.4deg);-ms-transform:rotate(302.4deg);-o-transform:rotate(302.4deg);transform:rotate(302.4deg)}.att-loading-count[data-progress="84"] .att-loading-inset .att-loading-inset__percentage:before{content:"84"}.att-loading-count[data-progress="85"] .att-loading-circle__fill,.att-loading-count[data-progress="85"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(153deg);-moz-transform:rotate(153deg);-ms-transform:rotate(153deg);-o-transform:rotate(153deg);transform:rotate(153deg)}.att-loading-count[data-progress="85"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(306deg);-moz-transform:rotate(306deg);-ms-transform:rotate(306deg);-o-transform:rotate(306deg);transform:rotate(306deg)}.att-loading-count[data-progress="85"] .att-loading-inset .att-loading-inset__percentage:before{content:"85"}.att-loading-count[data-progress="86"] .att-loading-circle__fill,.att-loading-count[data-progress="86"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(154.8deg);-moz-transform:rotate(154.8deg);-ms-transform:rotate(154.8deg);-o-transform:rotate(154.8deg);transform:rotate(154.8deg)}.att-loading-count[data-progress="86"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(309.6deg);-moz-transform:rotate(309.6deg);-ms-transform:rotate(309.6deg);-o-transform:rotate(309.6deg);transform:rotate(309.6deg)}.att-loading-count[data-progress="86"] .att-loading-inset .att-loading-inset__percentage:before{content:"86"}.att-loading-count[data-progress="87"] .att-loading-circle__fill,.att-loading-count[data-progress="87"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(156.6deg);-moz-transform:rotate(156.6deg);-ms-transform:rotate(156.6deg);-o-transform:rotate(156.6deg);transform:rotate(156.6deg)}.att-loading-count[data-progress="87"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(313.2deg);-moz-transform:rotate(313.2deg);-ms-transform:rotate(313.2deg);-o-transform:rotate(313.2deg);transform:rotate(313.2deg)}.att-loading-count[data-progress="87"] .att-loading-inset .att-loading-inset__percentage:before{content:"87"}.att-loading-count[data-progress="88"] .att-loading-circle__fill,.att-loading-count[data-progress="88"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(158.4deg);-moz-transform:rotate(158.4deg);-ms-transform:rotate(158.4deg);-o-transform:rotate(158.4deg);transform:rotate(158.4deg)}.att-loading-count[data-progress="88"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(316.8deg);-moz-transform:rotate(316.8deg);-ms-transform:rotate(316.8deg);-o-transform:rotate(316.8deg);transform:rotate(316.8deg)}.att-loading-count[data-progress="88"] .att-loading-inset .att-loading-inset__percentage:before{content:"88"}.att-loading-count[data-progress="89"] .att-loading-circle__fill,.att-loading-count[data-progress="89"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(160.2deg);-moz-transform:rotate(160.2deg);-ms-transform:rotate(160.2deg);-o-transform:rotate(160.2deg);transform:rotate(160.2deg)}.att-loading-count[data-progress="89"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(320.4deg);-moz-transform:rotate(320.4deg);-ms-transform:rotate(320.4deg);-o-transform:rotate(320.4deg);transform:rotate(320.4deg)}.att-loading-count[data-progress="89"] .att-loading-inset .att-loading-inset__percentage:before{content:"89"}.att-loading-count[data-progress="90"] .att-loading-circle__fill,.att-loading-count[data-progress="90"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(162deg);-moz-transform:rotate(162deg);-ms-transform:rotate(162deg);-o-transform:rotate(162deg);transform:rotate(162deg)}.att-loading-count[data-progress="90"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(324deg);-moz-transform:rotate(324deg);-ms-transform:rotate(324deg);-o-transform:rotate(324deg);transform:rotate(324deg)}.att-loading-count[data-progress="90"] .att-loading-inset .att-loading-inset__percentage:before{content:"90"}.att-loading-count[data-progress="91"] .att-loading-circle__fill,.att-loading-count[data-progress="91"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(163.8deg);-moz-transform:rotate(163.8deg);-ms-transform:rotate(163.8deg);-o-transform:rotate(163.8deg);transform:rotate(163.8deg)}.att-loading-count[data-progress="91"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(327.6deg);-moz-transform:rotate(327.6deg);-ms-transform:rotate(327.6deg);-o-transform:rotate(327.6deg);transform:rotate(327.6deg)}.att-loading-count[data-progress="91"] .att-loading-inset .att-loading-inset__percentage:before{content:"91"}.att-loading-count[data-progress="92"] .att-loading-circle__fill,.att-loading-count[data-progress="92"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(165.6deg);-moz-transform:rotate(165.6deg);-ms-transform:rotate(165.6deg);-o-transform:rotate(165.6deg);transform:rotate(165.6deg)}.att-loading-count[data-progress="92"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(331.2deg);-moz-transform:rotate(331.2deg);-ms-transform:rotate(331.2deg);-o-transform:rotate(331.2deg);transform:rotate(331.2deg)}.att-loading-count[data-progress="92"] .att-loading-inset .att-loading-inset__percentage:before{content:"92"}.att-loading-count[data-progress="93"] .att-loading-circle__fill,.att-loading-count[data-progress="93"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(167.4deg);-moz-transform:rotate(167.4deg);-ms-transform:rotate(167.4deg);-o-transform:rotate(167.4deg);transform:rotate(167.4deg)}.att-loading-count[data-progress="93"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(334.8deg);-moz-transform:rotate(334.8deg);-ms-transform:rotate(334.8deg);-o-transform:rotate(334.8deg);transform:rotate(334.8deg)}.att-loading-count[data-progress="93"] .att-loading-inset .att-loading-inset__percentage:before{content:"93"}.att-loading-count[data-progress="94"] .att-loading-circle__fill,.att-loading-count[data-progress="94"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(169.2deg);-moz-transform:rotate(169.2deg);-ms-transform:rotate(169.2deg);-o-transform:rotate(169.2deg);transform:rotate(169.2deg)}.att-loading-count[data-progress="94"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(338.4deg);-moz-transform:rotate(338.4deg);-ms-transform:rotate(338.4deg);-o-transform:rotate(338.4deg);transform:rotate(338.4deg)}.att-loading-count[data-progress="94"] .att-loading-inset .att-loading-inset__percentage:before{content:"94"}.att-loading-count[data-progress="95"] .att-loading-circle__fill,.att-loading-count[data-progress="95"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(171deg);-moz-transform:rotate(171deg);-ms-transform:rotate(171deg);-o-transform:rotate(171deg);transform:rotate(171deg)}.att-loading-count[data-progress="95"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(342deg);-moz-transform:rotate(342deg);-ms-transform:rotate(342deg);-o-transform:rotate(342deg);transform:rotate(342deg)}.att-loading-count[data-progress="95"] .att-loading-inset .att-loading-inset__percentage:before{content:"95"}.att-loading-count[data-progress="96"] .att-loading-circle__fill,.att-loading-count[data-progress="96"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(172.8deg);-moz-transform:rotate(172.8deg);-ms-transform:rotate(172.8deg);-o-transform:rotate(172.8deg);transform:rotate(172.8deg)}.att-loading-count[data-progress="96"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(345.6deg);-moz-transform:rotate(345.6deg);-ms-transform:rotate(345.6deg);-o-transform:rotate(345.6deg);transform:rotate(345.6deg)}.att-loading-count[data-progress="96"] .att-loading-inset .att-loading-inset__percentage:before{content:"96"}.att-loading-count[data-progress="97"] .att-loading-circle__fill,.att-loading-count[data-progress="97"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(174.6deg);-moz-transform:rotate(174.6deg);-ms-transform:rotate(174.6deg);-o-transform:rotate(174.6deg);transform:rotate(174.6deg)}.att-loading-count[data-progress="97"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(349.2deg);-moz-transform:rotate(349.2deg);-ms-transform:rotate(349.2deg);-o-transform:rotate(349.2deg);transform:rotate(349.2deg)}.att-loading-count[data-progress="97"] .att-loading-inset .att-loading-inset__percentage:before{content:"97"}.att-loading-count[data-progress="98"] .att-loading-circle__fill,.att-loading-count[data-progress="98"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(176.4deg);-moz-transform:rotate(176.4deg);-ms-transform:rotate(176.4deg);-o-transform:rotate(176.4deg);transform:rotate(176.4deg)}.att-loading-count[data-progress="98"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(352.8deg);-moz-transform:rotate(352.8deg);-ms-transform:rotate(352.8deg);-o-transform:rotate(352.8deg);transform:rotate(352.8deg)}.att-loading-count[data-progress="98"] .att-loading-inset .att-loading-inset__percentage:before{content:"98"}.att-loading-count[data-progress="99"] .att-loading-circle__fill,.att-loading-count[data-progress="99"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(178.2deg);-moz-transform:rotate(178.2deg);-ms-transform:rotate(178.2deg);-o-transform:rotate(178.2deg);transform:rotate(178.2deg)}.att-loading-count[data-progress="99"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(356.4deg);-moz-transform:rotate(356.4deg);-ms-transform:rotate(356.4deg);-o-transform:rotate(356.4deg);transform:rotate(356.4deg)}.att-loading-count[data-progress="99"] .att-loading-inset .att-loading-inset__percentage:before{content:"99"}.att-loading-count[data-progress="100"] .att-loading-circle__fill,.att-loading-count[data-progress="100"] .att-loading-circle__mask.att-loading-circle__full{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.att-loading-count[data-progress="100"] .att-loading-circle__fill.att-loading-circle__fix{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-ms-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}.att-loading-count[data-progress="100"] .att-loading-inset .att-loading-inset__percentage:before{content:"100"}@keyframes loadingCounter{0% .att-loading-inset .att-loading-inset__percentage:before{content:"0"}1% .att-loading-inset .att-loading-inset__percentage:before{content:"1"}2% .att-loading-inset .att-loading-inset__percentage:before{content:"2"}3% .att-loading-inset .att-loading-inset__percentage:before{content:"3"}4% .att-loading-inset .att-loading-inset__percentage:before{content:"4"}5% .att-loading-inset .att-loading-inset__percentage:before{content:"5"}6% .att-loading-inset .att-loading-inset__percentage:before{content:"6"}7% .att-loading-inset .att-loading-inset__percentage:before{content:"7"}8% .att-loading-inset .att-loading-inset__percentage:before{content:"8"}9% .att-loading-inset .att-loading-inset__percentage:before{content:"9"}10% .att-loading-inset .att-loading-inset__percentage:before{content:"10"}11% .att-loading-inset .att-loading-inset__percentage:before{content:"11"}12% .att-loading-inset .att-loading-inset__percentage:before{content:"12"}13% .att-loading-inset .att-loading-inset__percentage:before{content:"13"}14% .att-loading-inset .att-loading-inset__percentage:before{content:"14"}15% .att-loading-inset .att-loading-inset__percentage:before{content:"15"}16% .att-loading-inset .att-loading-inset__percentage:before{content:"16"}17% .att-loading-inset .att-loading-inset__percentage:before{content:"17"}18% .att-loading-inset .att-loading-inset__percentage:before{content:"18"}19% .att-loading-inset .att-loading-inset__percentage:before{content:"19"}20% .att-loading-inset .att-loading-inset__percentage:before{content:"20"}21% .att-loading-inset .att-loading-inset__percentage:before{content:"21"}22% .att-loading-inset .att-loading-inset__percentage:before{content:"22"}23% .att-loading-inset .att-loading-inset__percentage:before{content:"23"}24% .att-loading-inset .att-loading-inset__percentage:before{content:"24"}25% .att-loading-inset .att-loading-inset__percentage:before{content:"25"}26% .att-loading-inset .att-loading-inset__percentage:before{content:"26"}27% .att-loading-inset .att-loading-inset__percentage:before{content:"27"}28% .att-loading-inset .att-loading-inset__percentage:before{content:"28"}29% .att-loading-inset .att-loading-inset__percentage:before{content:"29"}30% .att-loading-inset .att-loading-inset__percentage:before{content:"30"}31% .att-loading-inset .att-loading-inset__percentage:before{content:"31"}32% .att-loading-inset .att-loading-inset__percentage:before{content:"32"}33% .att-loading-inset .att-loading-inset__percentage:before{content:"33"}34% .att-loading-inset .att-loading-inset__percentage:before{content:"34"}35% .att-loading-inset .att-loading-inset__percentage:before{content:"35"}36% .att-loading-inset .att-loading-inset__percentage:before{content:"36"}37% .att-loading-inset .att-loading-inset__percentage:before{content:"37"}38% .att-loading-inset .att-loading-inset__percentage:before{content:"38"}39% .att-loading-inset .att-loading-inset__percentage:before{content:"39"}40% .att-loading-inset .att-loading-inset__percentage:before{content:"40"}41% .att-loading-inset .att-loading-inset__percentage:before{content:"41"}42% .att-loading-inset .att-loading-inset__percentage:before{content:"42"}43% .att-loading-inset .att-loading-inset__percentage:before{content:"43"}44% .att-loading-inset .att-loading-inset__percentage:before{content:"44"}45% .att-loading-inset .att-loading-inset__percentage:before{content:"45"}46% .att-loading-inset .att-loading-inset__percentage:before{content:"46"}47% .att-loading-inset .att-loading-inset__percentage:before{content:"47"}48% .att-loading-inset .att-loading-inset__percentage:before{content:"48"}49% .att-loading-inset .att-loading-inset__percentage:before{content:"49"}50% .att-loading-inset .att-loading-inset__percentage:before{content:"50"}51% .att-loading-inset .att-loading-inset__percentage:before{content:"51"}52% .att-loading-inset .att-loading-inset__percentage:before{content:"52"}53% .att-loading-inset .att-loading-inset__percentage:before{content:"53"}54% .att-loading-inset .att-loading-inset__percentage:before{content:"54"}55% .att-loading-inset .att-loading-inset__percentage:before{content:"55"}56% .att-loading-inset .att-loading-inset__percentage:before{content:"56"}57% .att-loading-inset .att-loading-inset__percentage:before{content:"57"}58% .att-loading-inset .att-loading-inset__percentage:before{content:"58"}59% .att-loading-inset .att-loading-inset__percentage:before{content:"59"}60% .att-loading-inset .att-loading-inset__percentage:before{content:"60"}61% .att-loading-inset .att-loading-inset__percentage:before{content:"61"}62% .att-loading-inset .att-loading-inset__percentage:before{content:"62"}63% .att-loading-inset .att-loading-inset__percentage:before{content:"63"}64% .att-loading-inset .att-loading-inset__percentage:before{content:"64"}65% .att-loading-inset .att-loading-inset__percentage:before{content:"65"}66% .att-loading-inset .att-loading-inset__percentage:before{content:"66"}67% .att-loading-inset .att-loading-inset__percentage:before{content:"67"}68% .att-loading-inset .att-loading-inset__percentage:before{content:"68"}69% .att-loading-inset .att-loading-inset__percentage:before{content:"69"}70% .att-loading-inset .att-loading-inset__percentage:before{content:"70"}71% .att-loading-inset .att-loading-inset__percentage:before{content:"71"}72% .att-loading-inset .att-loading-inset__percentage:before{content:"72"}73% .att-loading-inset .att-loading-inset__percentage:before{content:"73"}74% .att-loading-inset .att-loading-inset__percentage:before{content:"74"}75% .att-loading-inset .att-loading-inset__percentage:before{content:"75"}76% .att-loading-inset .att-loading-inset__percentage:before{content:"76"}77% .att-loading-inset .att-loading-inset__percentage:before{content:"77"}78% .att-loading-inset .att-loading-inset__percentage:before{content:"78"}79% .att-loading-inset .att-loading-inset__percentage:before{content:"79"}80% .att-loading-inset .att-loading-inset__percentage:before{content:"80"}81% .att-loading-inset .att-loading-inset__percentage:before{content:"81"}82% .att-loading-inset .att-loading-inset__percentage:before{content:"82"}83% .att-loading-inset .att-loading-inset__percentage:before{content:"83"}84% .att-loading-inset .att-loading-inset__percentage:before{content:"84"}85% .att-loading-inset .att-loading-inset__percentage:before{content:"85"}86% .att-loading-inset .att-loading-inset__percentage:before{content:"86"}87% .att-loading-inset .att-loading-inset__percentage:before{content:"87"}88% .att-loading-inset .att-loading-inset__percentage:before{content:"88"}89% .att-loading-inset .att-loading-inset__percentage:before{content:"89"}90% .att-loading-inset .att-loading-inset__percentage:before{content:"90"}91% .att-loading-inset .att-loading-inset__percentage:before{content:"91"}92% .att-loading-inset .att-loading-inset__percentage:before{content:"92"}93% .att-loading-inset .att-loading-inset__percentage:before{content:"93"}94% .att-loading-inset .att-loading-inset__percentage:before{content:"94"}95% .att-loading-inset .att-loading-inset__percentage:before{content:"95"}96% .att-loading-inset .att-loading-inset__percentage:before{content:"96"}97% .att-loading-inset .att-loading-inset__percentage:before{content:"97"}98% .att-loading-inset .att-loading-inset__percentage:before{content:"98"}99% .att-loading-inset .att-loading-inset__percentage:before{content:"99"}100% .att-loading-inset .att-loading-inset__percentage:before{content:"100"}}.att-loading--dark .att-loading-circle__mask .att-loading-circle__fill,.att-loading--dark .loading__inside,.att-loading--dark:after,.att-loading--dark:before{background:#444}.att-loading--dark .att-loading-inset__percentage{color:#444}.lt-ie9 .att-loading--dark{background:url(images/loading_balls_black.gif) center center no-repeat}.att-loading--blue .att-loading-circle__mask .att-loading-circle__fill,.att-loading--blue .loading__inside,.att-loading--blue:after,.att-loading--blue:before{background:#0574AC}.att-loading--blue .att-loading-inset__percentage{color:#0574AC}.lt-ie9 .att-loading--blue{background:url(images/loading_balls_blue.gif) center center no-repeat}.att-loading--white{background-color:#888}.att-loading--white.att-loading-count .att-loading-inset{background-color:inherit}.att-loading--white .att-loading-circle__mask .att-loading-circle__fill,.att-loading--white .loading__inside,.att-loading--white:after,.att-loading--white:before{background:#fff}.att-loading--white .att-loading-inset__percentage{color:#fff}.lt-ie9 .att-loading--white{background:url(images/loading_balls_white.gif) center center no-repeat}.lt-ie9 .att-loading-count{background:url(images/loading_counter.png);overflow:hidden}.lt-ie9 .att-loading-count .att-loading-inset__percentage:before{margin-left:-2px}.video-player{position:relative}.video-player__control{display:inline-block;margin-right:-5px;background-color:#444}.video-player__button{-webkit-transition:background-color .3s ease-out;-moz-transition:background-color .3s ease-out;transition:background-color .3s ease-out;display:inline-block;zoom:1;*display:inline;*vertical-align:auto;font-size:14px;font-size:.875rem;vertical-align:middle;color:#f2f2f2;text-decoration:none;cursor:pointer}.video-player__button:hover{color:#44c8f5}.video-player__button:active{-webkit-transition-property:none;-moz-transition-property:none;transition-property:none;color:#44c8f5}.video-player__button [class*=icon]{display:inline-block}.video-player__play-button{border-radius:3px 0 0 3px;border-right:1px solid #f2f2f2;padding:10px 24px 5px}.gigant-play{font-size:25px}.video-player__volume_icon{border-left:1px solid #f2f2f2;padding:17px 0 13px 11px;margin:0 -5px 0 -5px}.video-player__toggle-fullscreen-button{padding:17px 0 13px 15px;border-radius:0 3px 3px 0}.video-player__volume{padding:24px 0 17px 8px;font-size:0;background-color:#444;margin-left:0;opacity:1}.video-player__volume_icon:hover .video-player__volume{opacity:0}.video-player__volume-bar{-webkit-animation:video__volume-bar .3s reverse;-moz-animation:video__volume-bar .3s reverse;animation:video__volume-bar .3s reverse;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;-ms-transform-origin:center bottom;-o-transform-origin:center bottom;transform-origin:center bottom;display:inline-block;zoom:1;*display:inline;*vertical-align:auto;vertical-align:middle;width:4px;height:14px;background-color:#777;margin:-5px 0 0 7px}.video-player__volume-bar:first-child{margin-left:0}.video-player__volume-bar:hover{-webkit-animation:video__volume-bar .3s 1;-moz-animation:video__volume-bar .3s 1;animation:video__volume-bar .3s 1;-webkit-transform:scaleY(1.3);-moz-transform:scaleY(1.3);-ms-transform:scaleY(1.3);-o-transform:scaleY(1.3);transform:scaleY(1.3);-webkit-transform-origin:center;-moz-transform-origin:center;-ms-transform-origin:center;-o-transform-origin:center;transform-origin:center;background-color:#44c8f5}.video-player__volume-bar--full{background-color:#f2f2f2}@-webkit-keyframes video__volume-bar{0%{-webkit-transform:scaleY(1)}50%{-webkit-transform:scaleY(1.3)}100%{-webkit-transform:scaleY(1)}}@-moz-keyframes video__volume-bar{0%{-moz-transform:scaleY(1)}50%{-moz-transform:scaleY(1.3)}100%{-moz-transform:scaleY(1)}}@-o-keyframes video__volume-bar{0%{-o-transform:scaleY(1)}50%{-o-transform:scaleY(1.3)}100%{-o-transform:scaleY(1)}}@keyframes video__volume-bar{0%{transform:scaleY(1)}50%{transform:scaleY(1.3)}100%{transform:scaleY(1)}}.video-player__track{padding:21px 0 21px 21px;margin-bottom:-19px;width:350px}.video-player__track--inner{position:relative;height:8px;border:1px solid #a0a0a0;border-radius:2px;margin:0}.video-player__track--loaded,.video-player__track--played{position:absolute;height:8px;background-color:#a0a0a0;border-radius:2px;margin:-1px 0 0 -1px;left:1px}.video-player__track--played{background-color:#f2f2f2}.video-player__track--played:hover{background-color:#44c8f5}.video-player__track-tooltip{-webkit-transition:opacity .1s ease-out;-moz-transition:opacity .1s ease-out;transition:opacity .1s ease-out;position:absolute;top:-35px;right:-22px;font-size:12px;font-size:.75rem;opacity:0}.lt-ie9 .video-player__track-tooltip{display:none}.video-player__track--played:hover .video-player__track-tooltip{opacity:1}.lt-ie9 .video-player__track--played:hover .video-player__track-tooltip{display:block}.video-player__track-handle{-webkit-transition:opacity .1s ease-out;-moz-transition:opacity .1s ease-out;transition:opacity .1s ease-out;position:absolute;top:-4px;right:-7px;opacity:0;background:#f2f2f2;width:16px;height:16px;border-radius:50%}.video-player__track--played:hover .video-player__track-handle{opacity:1}.video-player__time{font-size:14px;font-size:.875rem;color:#f2f2f2;padding:18px 20px 15px;background-color:#444}.video-player__time:hover{color:#fff}.alert-inplace .container{padding-right:30px}.alert .close-role{position:absolute;top:13px;right:20px;font-size:11px;height:20px;line-height:23px;border:0}.alert .close-role [class^=icon-]{font-size:20px;width:15px;color:#777;margin:0;vertical-align:middle;display:inline-block;margin-top:-4px;-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;transition:all .2s ease-out}.alert .close-role:hover [class^=icon-]{color:#199DDF}.att-checkbox,.att-radio{-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;transition:all .2s ease-out;display:inline-block;zoom:1;*display:inline;*vertical-align:auto;width:21px;height:21px;background-color:#fff;border-radius:21px;border:1px solid #888;cursor:pointer;line-height:21px;text-align:center;vertical-align:middle}.att-checkbox:hover,.att-radio:hover{border-color:#444}.att-checkbox:active,.att-radio:active{border-color:#0574AC}.att-checkbox{border-radius:3px}.att-checkbox__indicator,.att-radio__indicator{opacity:0;-webkit-transition:all .2s cubic-bezier(0.175,.885,.32,1.275);-moz-transition:all .2s cubic-bezier(0.175,.885,.32,1.275);transition:all .2s cubic-bezier(0.175,.885,.32,1.275);top:50%;left:50%;width:7px;height:7px;background:#0574AC;border-radius:7px;position:initial;margin:6px;-ms-filter:"alpha(Opacity=0)"}.csstransforms .att-checkbox__indicator,.csstransforms .att-radio__indicator{-webkit-transform:scale3d(0,0,0);-moz-transform:scale3d(0,0,0);-ms-transform:scale3d(0,0,0);-o-transform:scale3d(0,0,0);transform:scale3d(0,0,0);opacity:0;display:none}.att-checkbox__indicator{width:21px;height:21px;background:0 0;left:0;margin:0;overflow:hidden;position:relative;top:0}.att-checkbox__indicator:after{content:'\f121';position:absolute;display:block;width:21px;left:-18px;color:#0574AC;text-align:center;font-family:"Ionicons";font-size:56px}.att-checkbox--on .att-checkbox__indicator,.att-radio--on .att-radio__indicator{opacity:1;-ms-filter:"alpha(Opacity=100)"}.csstransforms .att-checkbox--on .att-checkbox__indicator,.csstransforms .att-radio--on .att-radio__indicator{-webkit-transform:scale3d(1,1,1);-moz-transform:scale3d(1,1,1);-ms-transform:scale3d(1,1,1);-o-transform:scale3d(1,1,1);transform:scale3d(1,1,1);display:block}.att-checkbox input,.att-radio input{left:-9999px;position:absolute}.att-checkbox.att-checkbox--disabled,.att-radio.att-radio--disabled{background-color:#f2f2f2;border:1px solid #DDD;cursor:not-allowed}.att-checkbox.att-checkbox--disabled:active,.att-checkbox.att-checkbox--disabled:hover,.att-radio.att-radio--disabled:active,.att-radio.att-radio--disabled:hover{border-color:#DDD}.att-radio--disabled .att-radio__indicator,.att-radio--on.att-radio--disabled .att-radio__indicator{background:#DDD}.att-checkbox--disabled .att-checkbox__indicator:after,.att-checkbox--on.att-checkbox--disabled .att-checkbox__indicator:after{color:#DDD}.accordion-color-icon-green{background:green;border-radius:100%;height:12px;width:12px;margin:3px 0 0 10px;position:absolute}.accordion-color-icon-yellow{background:#ff0;border-radius:100%;height:12px;width:12px;margin:3px 0 0 10px;position:absolute}.accordion-color-icon-blue{background:#00f;border-radius:100%;height:12px;width:12px;margin:3px 0 0 10px;position:absolute}.accordion-color-icon-red{background:red;border-radius:100%;height:12px;width:12px;margin:3px 0 0 10px;position:absolute}.show-true{padding-left:20px}.att-checkbox--indeterminate:after{content:'-';position:absolute;top:-2px;font-weight:700;color:#067ab4;font-size:40px;left:2px}.dropdown{position:relative}.dropdown:focus,.dropdown:hover{z-index:1}.dropdown:focus>.dropdown__menu,.dropdown:hover>.dropdown__menu{display:block}.dropdown__caret{font-size:10px;margin-left:5px}.dropdown__menu{position:absolute;top:100%;left:0;background-color:#fff;display:none;list-style:none;min-width:150px;text-align:left;z-index:5}.nav--text-right .dropdown__menu{left:auto;right:0}.dropdown__menu-link{display:block;padding:0 20px}select[data-dropdown]{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;width:auto;opacity:0}.no-js select[data-dropdown]{opacity:1}.att-dropdown{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;position:relative}.att-dropdown select{position:absolute;top:-10000px;left:-10000px;color:transparent;font:0/0 a;text-shadow:none}.att-dropdown__selection{font-size:48px;font-size:3rem;font-family:omnes_att_light;line-height:48px;letter-spacing:-2px;display:block;color:#444;cursor:pointer}.att-dropdown__selection:after{display:inline-block;zoom:1;*display:inline;*vertical-align:auto;font-size:14px;font-size:.875rem;margin-left:10px;vertical-align:middle}.att-dropdown__selection.att-dropdown--focus,.att-dropdown__selection.att-dropdown--focus:visited{color:#444;outline:0}.att-dropdown__items{position:absolute;top:-10000px;left:-10000px;background-color:#0574AC;border-radius:6px;color:#fff;opacity:0;visibility:hidden;list-style:none;z-index:6;min-width:100px;margin:-10px}.att-dropdown__items.att-dropdown--open{visibility:visible;opacity:1;outline:0}.att-dropdown__item{font-size:48px;font-size:3rem;font-family:omnes_att_light;letter-spacing:-2px;cursor:default;display:block;line-height:48px;margin-top:-1px;overflow:hidden;padding:10px 50px 17px 10px;position:relative}.att-dropdown__item:first-child{border-top-left-radius:6px;border-top-right-radius:6px}.att-dropdown__item:last-child{border-bottom-left-radius:6px;border-bottom-right-radius:6px}.att-dropdown__item:before{position:absolute;top:0;right:10px;left:10px;content:'';display:block;height:1px;border-top:1px solid #0e2875}.att-dropdown__item:first-child:before{display:none}.att-dropdown__item.att-dropdown__item--active{background-color:#0e2875}.att-dropdown__item.att-dropdown__item--selected:after{font-size:28px;font-size:1.75rem;display:inline-block;vertical-align:middle;margin-top:-2px;margin-left:20px}.att-dropdown--h2 .att-dropdown__item,.att-dropdown--h2 .att-dropdown__selection{font-size:36px;font-size:2.25rem;font-family:omnes_att_light;line-height:36px;letter-spacing:-2px}.att-dropdown--h3 .att-dropdown__item,.att-dropdown--h3 .att-dropdown__selection{font-size:24px;font-size:1.5rem;font-family:omnes_att_regular;line-height:26px;letter-spacing:0}.att-dropdown__overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:rgba(0,0,0,.1);display:none;z-index:5}.select2-container.select2-container-disabled .select2-choice{z-index:0}.select2-container{margin:0;position:relative;display:inline-block;zoom:1;*display:inline;vertical-align:middle;width:100%}.select2-container,.select2-drop,.select2-search,.select2-search input{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.select2-container .select2-choice{overflow:hidden;white-space:nowrap;line-height:26px;color:#444;text-decoration:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.select2-container.select2-drop-above .select2-choice{border-bottom-color:#aaa;border-radius:0 0 4px 4px;background-image:-webkit-gradient(linear,left bottom,left top,color-stop(0,#eee),color-stop(0.9,#fff));background-image:-webkit-linear-gradient(center bottom,#eee 0,#fff 90%);background-image:-moz-linear-gradient(center bottom,#eee 0,#fff 90%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);background-image:linear,to bottom,#eee 0,#fff 90%}.select2-container.select2-allowclear .select2-choice .select2-chosen{margin-right:42px}.select2-container .select2-choice>.select2-chosen{margin-right:26px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.select2-container .select2-choice abbr{display:none;width:12px;height:12px;position:absolute;right:24px;top:8px;font-size:1px;text-decoration:none;border:0;background:url(select2.png) right top no-repeat;cursor:pointer;outline:0}.select2-container.select2-allowclear .select2-choice abbr{display:inline-block}.select2-container .select2-choice abbr:hover{background-position:right -11px;cursor:pointer}.select2-drop-mask{border:0;margin:0;padding:0;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;background-color:#fff}.select2-drop{width:100%;position:absolute;top:100%;color:#000;border:1px solid #aaa;-webkit-box-shadow:0 4px 5px rgba(0,0,0,.15);box-shadow:0 4px 5px rgba(0,0,0,.15)}.select2-drop.select2-drop-above{margin-top:1px;border-radius:4px 4px 0 0;-webkit-box-shadow:0 -4px 5px rgba(0,0,0,.15);box-shadow:0 -4px 5px rgba(0,0,0,.15)}.select2-drop-active{border:1px solid #5897fb;border-top:0}.select2-drop.select2-drop-above.select2-drop-active{border-top:1px solid #5897fb}.select2-drop-auto-width{border-top:1px solid #aaa;width:auto}.select2-drop-auto-width .select2-search{padding-top:4px}.select2-container .select2-choice .select2-arrow{display:inline-block;height:100%;position:absolute;right:0;top:0;border-radius:0 4px 4px 0}.select2-container .select2-choice .select2-arrow b{display:block;width:100%;height:100%;background:url(select2.png) no-repeat 0 1px}.select2-search{display:inline-block;width:100%;margin:0;padding-left:4px;padding-right:4px;position:relative;z-index:10000;white-space:nowrap}.select2-search input{width:100%;outline:0;font-family:sans-serif;font-size:1em;border:1px solid #aaa;border-radius:0;-webkit-box-shadow:none;box-shadow:none;background:#fff url(select2.png) no-repeat 100% -22px;background:url(select2.png) no-repeat 100% -22px,-webkit-gradient(linear,left bottom,left top,color-stop(0.85,#fff),color-stop(0.99,#eee));background:url(select2.png) no-repeat 100% -22px,-webkit-linear-gradient(center bottom,#fff 85%,#eee 99%);background:url(select2.png) no-repeat 100% -22px,-moz-linear-gradient(center bottom,#fff 85%,#eee 99%);background:url(select2.png) no-repeat 100% -22px,linear,to bottom,#fff 85%,#eee 99% 0 0}.select2-drop.select2-drop-above .select2-search input{margin-top:4px}.select2-search input.select2-active{background:#fff url(select2-spinner.gif) no-repeat 100%;background:url(select2-spinner.gif) no-repeat 100%,-webkit-gradient(linear,left bottom,left top,color-stop(0.85,#fff),color-stop(0.99,#eee));background:url(select2-spinner.gif) no-repeat 100%,-webkit-linear-gradient(center bottom,#fff 85%,#eee 99%);background:url(select2-spinner.gif) no-repeat 100%,-moz-linear-gradient(center bottom,#fff 85%,#eee 99%);background:url(select2-spinner.gif) no-repeat 100%,linear,to bottom,#fff 85%,#eee 99% 0 0}.select2-container-active .select2-choice,.select2-container-active .select2-choices{border:1px solid #5897fb;outline:0;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.select2-dropdown-open .select2-choice{border-bottom-color:transparent;-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset;background-color:#eee;background-image:-webkit-gradient(linear,left bottom,left top,color-stop(0,#fff),color-stop(0.5,#eee));background-image:-webkit-linear-gradient(center bottom,#fff 0,#eee 50%);background-image:-moz-linear-gradient(center bottom,#fff 0,#eee 50%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);background-image:linear,to top,#fff 0,#eee 50%}.select2-dropdown-open.select2-drop-above .select2-choice,.select2-dropdown-open.select2-drop-above .select2-choices{border:1px solid #5897fb;border-top-color:transparent;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fff),color-stop(0.5,#eee));background-image:-webkit-linear-gradient(center top,#fff 0,#eee 50%);background-image:-moz-linear-gradient(center top,#fff 0,#eee 50%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);background-image:linear,to bottom,#fff 0,#eee 50%}.select2-dropdown-open .select2-choice .select2-arrow{background:0 0;border-left:0;filter:none}.select2-dropdown-open .select2-choice .select2-arrow b{background-position:-18px 1px}.select2-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.select2-results{max-height:200px;position:relative;overflow-x:hidden;overflow-y:auto;-webkit-tap-highlight-color:transparent}.select2-results ul.select2-result-sub{margin:0;padding-left:0}.select2-results ul.select2-result-sub>li .select2-result-label{padding-left:20px}.select2-results ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:40px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:60px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:80px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:100px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:110px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub>li .select2-result-label{padding-left:120px}.select2-results li{list-style:none;display:list-item;background-image:none}.select2-results li.select2-result-with-children>.select2-result-label{font-weight:700}.select2-results .select2-result-label{padding:3px 7px 4px;margin:0;cursor:pointer;min-height:1em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.select2-results .select2-highlighted{background:#3875d7;color:#fff}.select2-results li em{background:#feffde;font-style:normal}.select2-results .select2-highlighted em{background:0 0}.select2-results .select2-highlighted ul{background:#fff;color:#000}.select2-results .select2-no-results,.select2-results .select2-searching,.select2-results .select2-selection-limit{background:#f4f4f4;display:list-item;padding-left:5px}.select2-results .select2-disabled.select2-highlighted{color:#666;background:#f4f4f4;display:list-item;cursor:not-allowed}.select2-results .select2-disabled{background:#f4f4f4;display:list-item;cursor:not-allowed}.select2-results .select2-selected{display:none}.select2-more-results.select2-active{background:#f4f4f4 url(select2-spinner.gif) no-repeat 100%}.select2-more-results{background:#f4f4f4;display:list-item}.select2-container.select2-container-disabled .select2-choice{background-color:#f4f4f4;background-image:none;border:1px solid #ddd;cursor:not-allowed}.select2-container.select2-container-disabled .select2-choice abbr{display:none}.select2-container-multi .select2-choices{height:auto!important;height:1%;margin:0;padding:0;position:relative;border:1px solid #aaa;cursor:text;overflow:hidden;background-color:#fff;background-image:-webkit-gradient(linear,0 0,0 100%,color-stop(1%,#eee),color-stop(15%,#fff));background-image:-webkit-linear-gradient(top,#eee 1%,#fff 15%);background-image:-moz-linear-gradient(top,#eee 1%,#fff 15%);background-image:linear,to bottom,#eee 1%,#fff 15%}.select2-locked{padding:3px 5px!important}.select2-container-multi .select2-choices{min-height:26px}.select2-container-multi.select2-container-active .select2-choices{border:1px solid #5897fb;outline:0;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.select2-container-multi .select2-choices li{float:left;list-style:none}html[dir=rtl] .select2-container-multi .select2-choices li{float:right}.select2-container-multi .select2-choices .select2-search-field{margin:0;padding:0;white-space:nowrap}.select2-container-multi .select2-choices .select2-search-field input{padding:5px;margin:1px 0;font-family:sans-serif;font-size:100%;color:#666;outline:0;border:0;-webkit-box-shadow:none;box-shadow:none;background:transparent!important}.select2-container-multi .select2-choices .select2-search-field input.select2-active{background:#fff url(select2-spinner.gif) no-repeat 100%!important}.select2-default{color:#999!important}.select2-container-multi .select2-choices .select2-search-choice{padding:3px 5px 3px 18px;margin:3px 0 3px 5px;position:relative;line-height:13px;color:#333;cursor:default;border:1px solid #aaa;border-radius:3px;-webkit-box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);background-clip:padding-box;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#e4e4e4;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0);background-image:-webkit-gradient(linear,0 0,0 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear,to top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%}html[dir=rtl] .select2-container-multi .select2-choices .select2-search-choice{margin-left:0;margin-right:5px}.select2-container-multi .select2-choices .select2-search-choice .select2-chosen{cursor:default}.select2-container-multi .select2-choices .select2-search-choice-focus{background:#d4d4d4}.select2-search-choice-close{display:block;width:12px;height:13px;position:absolute;right:3px;top:4px;font-size:1px;outline:0;background:url(select2.png) right top no-repeat}html[dir=rtl] .select2-search-choice-close{right:auto;left:3px}.select2-container-multi .select2-search-choice-close{left:3px}.select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover,.select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close{background-position:right -11px}.select2-container-multi.select2-container-disabled .select2-choices{background-color:#f4f4f4;background-image:none;border:1px solid #ddd;cursor:not-allowed}.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice{padding:3px 5px;border:1px solid #ddd;background-image:none;background-color:#f4f4f4}.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close{display:none;background:0 0}.select2-offscreen,.select2-offscreen:focus{clip:rect(0 0 0 0)!important;width:1px!important;height:1px!important;border:0!important;margin:0!important;padding:0!important;overflow:hidden!important;position:absolute!important;outline:0!important;left:0!important;top:0!important}.select2-display-none{display:none}.select2-measure-scrollbar{position:absolute;top:-10000px;left:-10000px;width:100px;height:100px;overflow:scroll}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:2dppx){.select2-container .select2-choice .select2-arrow b,.select2-container .select2-choice abbr,.select2-search input,.select2-search-choice-close{background-image:url(select2x2.png)!important;background-repeat:no-repeat!important;background-size:60px 40px!important}.select2-search input{background-position:100% -21px!important}}.select2-container .select2-choice{-webkit-transition:border-color .2s ease-out;-moz-transition:border-color .2s ease-out;transition:border-color .2s ease-out;background:#fff;border-radius:6px;display:block;border:1px solid #888;box-shadow:none;filter:none;height:40px;padding:0;position:relative;z-index:5;cursor:pointer}.select2-container-active .select2-choice{border-color:#0091d9;z-index:1}.select2-dropdown-open .select2-choice{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.select2-dropdown-open.select2-drop-above .select2-choice{border-top-left-radius:0!important;border-top-right-radius:0!important}.select2-container .select2-chosen,.select2-container input{font-size:12px;font-size:.75rem;color:#444;height:100%;line-height:39px;padding-left:10px;text-align:left}.select2-container input,.select2-container input:hover{border:0!important;line-height:inherit}.text-separator-subtitle .select2-chosen{font-size:18px;font-size:1.125rem}.hovstyle{background:#1792d6!important;color:#fff!important}.hovstyle.disable{background:transparent!important;color:#c4c4c4!important}.select2-container .select2-choice .select2-arrow,.select2-container.select2-container-disabled .select2-choice .select2-arrow{-webkit-transition:none;-moz-transition:none;transition:none;background:0 0;border:0;filter:none;width:25px;z-index:10}.select2-container .select2-choice .select2-arrow b:after,.select2-container.select2-container-disabled .select2-choice .select2-arrow b:after{font-size:14px;font-size:.875rem;content:'\f104';font-family:"Ionicons";position:absolute;top:0;right:0;width:25px;height:40px;line-height:40px;background:0 0;text-align:center;color:#888}.select2-dropdown-open .select2-choice .select2-arrow b:after{content:'\f10d'}.select2-container.select2-container-disabled .select2-chosen{color:#a0a0a0}.select2-drop{margin-top:-1px;background:#fff;border-top:1px solid #d3d3d3;border-radius:0 0 6px 6px;z-index:4}.select2-drop-mask{z-index:3}.select2-drop.select2-drop-above{border-top:0;border-bottom:1px solid #d3d3d3}.select2-search{height:0;min-height:0;overflow:hidden}.select2-search input{margin:0;padding:7px 10px;height:40px!important;line-height:12px;line-height:1.2rem;min-height:0!important}.select2-results{padding:0;margin:-19px 0 0 0;border-radius:0 0 6px 6px;-webkit-box-shadow:rgba(0,0,0,.25) 0 8px 10px -3px;-moz-box-shadow:rgba(0,0,0,.25) 0 8px 10px -3px;box-shadow:rgba(0,0,0,.25) 0 8px 10px -3px}.select2-drop-above .select2-results{border-radius:6px 6px 0 0}.select2-drop-above.select2-dropdown-open .select2-choice{border-radius:0 0 6px 6px!important;background:#fff}.select2-drop-above.select2-drop{border-radius:6px 6px 0 0;margin-top:0;overflow:hidden}.select2-drop.show-search .select2-search{height:auto;overflow:visible;padding:5px}.select2-drop.show-search .select2-results{margin-top:0}.select2-results .select2-result{background:0 0}.select2-result .select2-result-label{-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;transition:all .2s ease-out;font-size:12px;font-size:.75rem;color:#444;display:block;line-height:14px;margin:0;padding:8px 10px}.select2-result.select2-result-current .select2-result-label{background:#fff;color:#1792D6}.select2-result.select2-result-current .select2-result-label:after{content:'\f121';font-family:"Ionicons";font-size:8px;vertical-align:bottom;margin-left:5px;background:0 0;text-align:center;color:#1792D6}.select2-result-current .select2-result-label{font-family:clearview_att_regular;padding-right:5px;color:#067ab4}.select2-no-results{font-size:12px;font-size:.75rem;color:#777;font-family:Arial;line-height:12px;padding:10px}.select2-result-selectable .select2-match,.select2-result-unselectable .select2-match{background-color:#c9e9f9;text-decoration:none}.select2-container .color-circle,.select2-results .color-circle{width:15px;height:15px;display:inline-block;zoom:1;*display:inline;*vertical-align:auto;border-radius:15px;margin-right:10px;vertical-align:middle}.select2-container .option-extra,.select2-results .option-extra{float:right}.select2-container .price,.select2-results .price{color:#888}.select2-container.select--clean{border-color:transparent;background:0 0;width:auto}.select2-container.select--clean .select2-choice{background:0 0;border-color:transparent;height:auto}.select2-container.select--clean .select2-drop{margin-top:5px}.select2-container.select--h1 .select2-chosen{font-size:48px;font-size:3rem;font-family:omnes_att_light;line-height:48px;letter-spacing:-2px}.select2-container.select--h2 .select2-chosen{font-size:36px;font-size:2.25rem;font-family:omnes_att_light;line-height:36px;letter-spacing:-2px}.select2-container.select--h3 .select2-chosen{font-size:24px;font-size:1.5rem;font-family:omnes_att_regular;line-height:26px;letter-spacing:0}.select2-container.select--h4 .select2-chosen{font-size:18px;font-size:1.125rem;font-family:clearview_att_regular;line-height:22px;letter-spacing:0}.select2-drop.select--clean{margin-top:5px}.select2-container .select2-choice .select2-arrow b,.select2-container .select2-choice abbr,.select2-container-multi .select2-choices .select2-search-field input.select2-active,.select2-more-results.select2-active,.select2-search input,.select2-search input.select2-active,.select2-search-choice-close{background-image:none!important}.select2-container.select2--small .select2-choice{height:30px;z-index:1}.select2-container.select2--small .select2-chosen{line-height:29px}.select2-container.select2--small .select2-choice .select2-arrow b:after,.select2-container.select2--small.select2-container-disabled .select2-choice .select2-arrow b:after{height:30px;line-height:30px}.select2-container.select2--small .select2-search input{height:30px!important}.select2-container .select2-choice.select2-chosen-disabled{margin-right:26px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:.75rem;height:100%;line-height:39px;padding-left:10px;text-align:left;color:#c4c4c4;background-color:#e4e4e4;border:1px solid #d4d4d4;cursor:not-allowed}.select2-result.disable .select2-result-label{color:#c4c4c4;cursor:not-allowed}ul.select2-results li:last-child{margin-bottom:10px}.text-dropdown{display:block;font-family:omnes_att_light;font-size:48px;color:#067AB4;line-height:40px}.text-dropdown .not-visible{visibility:hidden}.text-dropdown .actions-opened{display:block;width:auto;position:relative;margin-top:-35px;margin-left:20px}.text-dropdown .actions-opened li i{margin-left:20px}.text-dropdown .actions-closed{display:none}.text-dropdown .action--selected{text-decoration:underline;color:#0574AC}.text-dropdown ul{margin-left:-35px;margin-top:-40px;padding-left:0;position:absolute;list-style-type:none;-moz-border-radius:6px;-webkit-border-radius:6px;border:1px solid #0574AC;box-shadow:0 2px 10px -2px;-webkit-box-shadow:0 2px 10px -2px;-moz-box-shadow:0 2px 10px -2px}.text-dropdown li{white-space:nowrap;height:auto;background-color:#0F7EB6;color:#FFF;font-size:48px;font-family:omnes_att_light;line-height:48px;letter-spacing:-1px;padding-left:20px;cursor:pointer}.text-dropdown li i{margin-left:15px;font-size:30px}.text-dropdown .highlight{background-color:#0F2A7B}.text-dropdown .icon-included-checkmark{color:#fff;font-size:30px}.text-dropdown .dropdown{display:inline-block;cursor:pointer}.text-dropdown .dropdown i{font-size:20px;position:relative;top:-10px}.att-accordion{background:#fff;position:relative;border-radius:6px;border-width:1px;border-color:#888;border-style:solid;overflow:hidden}.att-accordion__freestanding{display:block;min-height:50px;margin-bottom:19px}.att-accordion__group{padding-left:20px;padding-right:20px;margin-top:-1px;position:relative}.att-accordion__group.first,.att-accordion__group:first-child{margin-top:0}.att-accordion__group:hover{background-color:#bbb;z-index:1}.att-accordion__group--open{z-index:1}.att-accordion__group--open.att-accordion__group:hover{background-color:transparent}.att-accordion__inner,.att-accordion__toggle{margin:10px 0;text-transform:none}.att-accordion__toggle{font-size:14px;font-size:.875rem;color:#666;display:inline-block;font-family:clearview_att_regular;position:relative;width:100%}.att-accordion__toggle:after{-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;transition:all .2s ease-out;font-size:14px;font-size:.875rem;position:absolute;top:50%;right:20px;font-family:"Ionicons";content:"\e6dc";height:14px;margin-top:-7px;color:#0574AC}.att-accordion__toggle:hover{color:#0091d9}.att-accordion__toggle.noafter:after{content:none}.att-accordion__toggle.noafter i{color:#067ab4}.att-accordion__group--open .att-accordion__toggle:after{-webkit-transform:rotate(-180deg);-moz-transform:rotate(-180deg);-ms-transform:rotate(-180deg);-o-transform:rotate(-180deg);transform:rotate(-180deg)}.no-csstransforms .att-accordion__heading .att-accordion__toggle:after{-webkit-transition:none;-moz-transition:none;transition:none}.att-accordion__body{display:none;padding-top:0;padding-bottom:14px}.att-accordion__body p{margin-bottom:15px}.att-accordion__inner{padding-top:0}.att-accordion__inner>*{margin:0}.att-accordion__bottom--border{border-bottom:1px solid #888;position:absolute;left:20px;right:20px}.att-accordion--no-box .att-accordion__bottom--border{border-bottom:0}.att-accordion--no-box{background:0 0}.att-accordion--no-box .att-accordion__group{border:0;border-bottom:1px solid #bbb;margin-top:-1px;position:relative;padding-left:0!important;padding-right:0!important}.att-accordion--no-box .att-accordion__group.last,.att-accordion--no-box .att-accordion__group:last-child{border-radius:0}.att-accordion--no-box .att-accordion__group:hover{border-color:#bbb;background-color:transparent}.att-accordion--no-box .att-accordion__group--open{border-color:#bbb}.att-accordion--no-box .att-accordion__toggle:active{color:#0574AC}.att-accordion--no-box .att-accordion__toggle:hover{color:#0091d9}.att-accordion--no-box .att-accordion__group--open .att-accordion__toggle{color:#199DDF}.att-accordion--no-box .att-accordion__inner{margin:10px 0!important;text-transform:none}.att-accordion--no-box .att-accordion__toggle:after{position:absolute;top:50%;right:0}.att-accord-header{width:600px;height:50px;background-color:#f2f2f2;border-left:2px solid gray;border-right:2px solid gray;border-top:2px solid gray;border-bottom:2px solid gray;cursor:pointer}.att-accord-header-closed{border-bottom:0}.att-accord-header i{float:right;margin-right:20px;margin-top:-15px}.att-accord-body-inner-text{margin-left:50px;margin-right:50px;height:32px;border-bottom:1px solid gray}.att-accord-body-inner-end{margin-left:50px;margin-right:50px;height:32px;border-bottom:0}.att-accord-header-child{margin-left:50px;margin-top:14px}.att-accord-body{width:600px;height:100px;background-color:#fff;border-left:2px solid gray;border-right:2px solid gray}.att-accord-body-last{border-bottom:2px solid gray}.hourpicker .customdays-width{width:700px}.hourpicker .dropdown-width{width:32%;position:relative}.hourpicker .col-md-days{width:13.4%;padding-left:0;padding-right:0}.hourpicker .divider-margin-f{margin-top:30px;margin-bottom:20px}.hourpicker .divider-margin-s{margin-top:155px}.hourpicker .fromto-margin{width:6%;margin-top:45px;padding:0}.hourpicker .days-margin{margin-right:3px}.hourpicker .daysselect-margin{margin-bottom:20px;margin-right:25px;padding:0}.hourpicker .topDropDownWidth{width:100%;z-index:0}.hourpicker .resultTopMargin{margin-top:0;max-height:205px}.hourpicker .resultTopWidth{display:block;width:100%;position:absolute;background:#fff;z-index:999}.hourpicker .dropDownMarginBottom{width:80px;margin-bottom:10px}.hourpicker .dropDownMarginRight{margin-right:0!important;line-height:30px}.hourpicker .resultToDropDown{display:block;width:80px;position:absolute;background:#fff;z-index:99;top:111px}.hourpicker .resultFromDropDown{display:block;width:80px;position:absolute;background:#fff;z-index:99;top:71px}.hourpicker .selectDropDown{height:30px!important;width:80px;padding-left:0!important}.hourpicker .selectDropDown.selectDropDown-error{border:red solid 1px}.hourpicker .selectedItemInDropDown{background:#1792D6;color:#fff}.hourpicker .select2-container .select2-chosen{padding-left:4px!important}.hourpicker .select2-result .select2-result-label{padding:8px 3px!important}.hourpicker.hourpicker-error-msg{width:100%;border-radius:4px;display:block;padding:10px;font-family:clearview_att_regular;font-size:12px;font-size:.75rem;line-height:10px;color:#666;text-transform:none;background:#fff;position:absolute;z-index:1;-moz-box-sizing:border-box;box-sizing:border-box;text-align:center}.hourpicker.hourpicker-error-msg [class*=icon-]{color:#fff;position:relative;margin-right:9px;line-height:0!important;vertical-align:middle}.hourpicker.hourpicker-error-msg span{vertical-align:middle}.hourpicker.hourpicker-error-msg.error{color:#fff;background:#e00000}.hourpicker.hourpicker-error-msg.warning{color:#444;background:#FCB123}.hourpicker.hourpicker-error-msg.warning [class*=icon-]{color:#444}.hourpicker.hourpicker-error-msg.success{color:#fff;background:#008a06}.hourpicker.hourpicker-error-msg.info{color:#fff;background:#0a7cb5}.hourpicker.hourpicker-error-msg [class^=icon-]{height:30px;line-height:30px}.att-switch{display:inline-block;vertical-align:middle;width:77px;height:20px;line-height:20px;background-color:#666;border-radius:2px;position:relative;overflow:hidden;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.att-switch.large{width:83px;height:30px}.ie .att-switch{border:0}.att-switch-content{position:absolute;width:131px;font-size:0;top:0;left:-52px;overflow:hidden;-webkit-transition:left .2s ease-in-out 0;-moz-transition:left .2s ease-in-out 0;transition:left .2s ease-in-out 0}.att-switch-content.large{width:135px}.att-switch-content.dragging{-webkit-transition:left;-moz-transition:left 0;transition:left 0}.att-switch.att-checkbox--on .att-switch-content{left:0}.att-switch-offText,.att-switch-onText,.att-switch-thumb{display:inline-block;vertical-align:middle;font-size:11px;font-size:.6875rem;width:53px;height:21px;text-align:center;cursor:pointer;color:#fafafa;margin:0;-webkit-transition:background-color .2s ease-out,color .2s ease-out;-moz-transition:background-color .2s ease-out,color .2s ease-out;transition:background-color .2s ease-out,color .2s ease-out}.ie .att-switch-thumb,.lt-ie9 .att-switch-offText,.lt-ie9 .att-switch-onText,.lt-ie9 .att-switch-thumb{margin-top:-1px}@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none){.att-switch-thumb{margin-top:-1px}}.att-switch-thumb{width:23px;height:18px;border-radius:2px;background:#fafafa;top:0;position:relative;overflow:hidden;font-size:12px;font-size:.75rem;color:#afafaf}.att-switch-thumb:focus{color:#0091d9}.att-switch-thumb:after{content:'III';letter-spacing:1px;line-height:17px;position:absolute;left:7px;top:1px}.att-switch-thumb.large{margin-top:1px;width:29px;height:28px}.att-switch-thumb.large:after{font-size:16px;font-size:1rem;content:'III';letter-spacing:1px;line-height:26px;position:absolute;left:7px;top:1px}.att-switch.att-checkbox--on{background:#118817}.att-switch .att-switch-thumb:hover,.att-switch.att-checkbox--on .att-switch-thumb:hover{color:#0091d9}.ico{font-size:15px;font-size:.9375rem;-webkit-font-smoothing:antialiased;color:#fff;line-height:20px;pointer-events:none;width:53px;z-index:3}.att-switch-onText{text-indent:4px}.att-switch-offText{text-indent:-4px}.att-switch input{visibility:hidden;position:absolute;left:-100px}.navbar .dev-notes-toggle{color:#6f6f6f;display:inline-block;vertical-align:middle;height:50px;line-height:49px}.navbar .dev-notes-toggle label{display:inline-block;vertical-align:middle;font-family:'Helvetica Neue LT Std','Helvetica Neue',Helvetica;font-size:12px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.navbar .att-switch{margin-top:-1px;margin-left:5px;background-color:#333;outline:1px solid #333}.button--search{border-radius:0 5px 5px 0}.form-field.form-field__small input[type=color],.form-field.form-field__small input[type=date],.form-field.form-field__small input[type=datetime-local],.form-field.form-field__small input[type=datetime],.form-field.form-field__small input[type=email],.form-field.form-field__small input[type=month],.form-field.form-field__small input[type=number],.form-field.form-field__small input[type=password],.form-field.form-field__small input[type=search],.form-field.form-field__small input[type=tel],.form-field.form-field__small input[type=text],.form-field.form-field__small input[type=time],.form-field.form-field__small input[type=url],.form-field.form-field__small input[type=week],.form-field.form-field__small select,.form-field.form-field__small textarea{height:30px;font-size:12px;font-size:.75rem}.form-field.form-field__small [class^=icon-]{height:30px;line-height:30px}.att-value-selector{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;font-size:16px;font-size:1rem}.att-value-selector .att-radio{width:48px;height:48px;background:0 0;border:2px solid transparent;color:#bbb;padding:1px}.att-value-selector .att-radio:hover{border-color:#bababa;color:#444}.att-value-selector .att-radio.att-radio--on{border-color:#0574AC;color:#444}.att-value-selector .att-radio__indicator{-webkit-transform:none;-moz-transform:none;-ms-transform:none;-o-transform:none;transform:none;-webkit-transition:none;-moz-transition:none;transition:none;width:42px;height:42px;-ms-filter:none;filter:none;background:0 0;border-radius:40px;border:1px solid #bababa;margin:0;opacity:1;padding-top:5px;position:static}.att-value-selector.att-radio--on .att-radio__indicator{-ms-filter:none;filter:none}.att-value-selector__item{text-align:center}.att-value-selector__unit,.att-value-selector__value{font-size:16px;font-size:1rem;display:block;font-family:clearview_att_regular;line-height:18px;margin:0}.att-value-selector__unit{font-size:12px;font-size:.75rem;line-height:12px}.att-color-selector{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;font-size:16px;font-size:1rem}.att-color-selector__item{width:30px;height:30px;-webkit-transition:none;-moz-transition:none;transition:none;margin-bottom:5px;background:0 0;border:0;position:relative}.att-color-selector__item:hover{border:2px solid #999;box-shadow:none}.att-radio.att-color-selector__item:hover>.att-radio__indicator{border:0;margin:-11px 0 0 -11px;width:22px;height:22px;border-radius:22px}.att-radio--on.att-color-selector__item{border:2px solid #157BB2}.att-radio--on.att-color-selector__item .att-radio__indicator{border:0;margin:-11px 0 0 -11px;width:22px;height:22px;border-radius:22px}.att-color-selector .att-radio__indicator,[data-color-selector] .att-radio__indicator{-webkit-transform:none;-moz-transform:none;-ms-transform:none;-o-transform:none;transform:none;-webkit-transition:none;-moz-transition:none;transition:none;width:30px;height:30px;border:1px solid #474747;border-radius:30px;display:block;left:50%;margin:-16px 0 0 -16px;opacity:1;top:50%;position:absolute;-ms-filter:"alpha(Opacity=100)"}.att-value-selector__popover-toggle{width:40px;height:40px;display:block;white-space:nowrap}.att-value-selector__popover-toggle [class^=icon-]{display:inline-block;zoom:1;*display:inline;*vertical-align:auto;position:static;vertical-align:middle;width:auto}.att-value-selector__popover-toggle--single{cursor:default}.att-value-selector__selected-circle{display:inline-block;zoom:1;*display:inline;*vertical-align:auto;width:40px;height:40px;border-radius:40px;border:2px solid #999;color:#444;text-align:center;vertical-align:middle}.att-value-selector__selected-circle .att-value-selector__value{line-height:14px;margin-top:5px}.att-color-selector .att-value-selector__selected-circle{border:0}.overlayed{position:absolute;top:0;right:0;bottom:0;left:0;background:none repeat scroll 0 0 rgba(242,242,242,.95);z-index:90;display:none}.modals{top:0;bottom:0;left:0;right:0;position:fixed;z-index:100;overflow-x:auto;overflow-y:scroll;display:none}.modal__informative,.modal__warning{background:#fff;width:380px;box-shadow:0 2px 5px 0 #BEBEBE;border:1px solid #E6E6E6;padding:35px;border-radius:5px;margin:5% auto}.modal__informative{color:#157BB2}.modal__informative .modal__header--icon{background:url(images/icon-informative-modal.png) center center no-repeat}.modal__warning{color:#ED6F20}.modal__warning .modal__header--icon{background:url(images/icon-warning-modal.png) center center no-repeat}.modal__header{display:inline-table;position:relative;width:73%}.modal__header h2{width:220px;display:inline-block;margin:0}.modal__header .modal__header--icon{position:absolute;display:inline-block;height:65px;width:110px;bottom:0}.modal__header .modal__header--close{color:#888;font-size:28px;position:absolute;right:-112px;top:-24px;cursor:pointer}.modal__header .modal__header--close:hover{color:#444}.modal__content{padding-top:8px;color:#444}.modal__footer{padding-top:35px}.modal__footer a{margin-right:5px}.modal-open,.modal-open .navbar{padding-right:17px}.custom_modal{background:none repeat scroll 0 0 #f2f2f2;opacity:.91}.custom_modal .modal__header h2{width:inherit;margin-bottom:12px}.custom_modal .modal__warning{color:inherit;padding:0;width:980px;background:0 0;border:0;border-radius:none;box-shadow:none}.custom_modal .modal__content{width:100%;padding-top:11px;display:inline-block}.custom_modal .size-onethird .button--primary{min-width:92px}.custom_modal .size-onethird .button--small{padding:8px 0}.custom_modal .accordian{background-color:#fff;margin:30px 5px 0;padding:0;border:1px solid #bbb;border-radius:3px 3px 0 0;border-bottom:0}.custom_modal .accordianheader{background:none repeat scroll 0 0 #666;color:#fff;padding:11px;border-radius:3px 3px 0 0}.custom_modal .att-accordion__bottom--border{border:0}.custom_modal .att-accordion__body,.custom_modal .att-accordion__heading{top:3px}.custom_modal .att-accordion__heading{padding:12px;margin:0}.custom_modal .att-accordion__body{padding:5px;background-color:#f2f2f2}.custom_modal .icon-chevron-down,.custom_modal .icon-chevron-up{right:24px;position:absolute}.custom_modal .button--square{border-bottom:1px solid #bbb;margin:14px 20px;padding:0}.custom_modal .button--square>label{margin-bottom:14px}.custom_modal .select2-container .select2-choice{height:30px}.custom_modal .select2-chosen{position:relative;top:-4px}.custom_modal .select2-arrow>b{position:relative;top:-6px}.custom_modal .att-accordion--no-box .att-accordion__group--open .att-accordion__toggle{background-color:#44C9F6;color:#444}.custom_modal .att-accordion__toggle{position:static}.custom_modal .acc_checkboxgroup .scroll-viewport{height:250px;width:960px}.att--tree ul{margin:0 0 0 10px!important;padding:0!important;list-style-type:none!important}.att--tree li{font-size:12px;font-size:.75rem;cursor:pointer;position:relative;text-decoration:none;color:#888;padding-left:24px;padding-top:2px}.att--tree li:hover{color:#0091d9}.att--tree__plus:before{font-size:14px;font-size:.875rem;font-family:"Ionicons";content:"\e63b";display:inline-block;margin-right:8px;vertical-align:middle}.att--tree__plus:hover{color:#0091d9}.att--tree__arrow{-moz-box-sizing:border-box;box-sizing:border-box;background:url(images/treearrow.png) no-repeat;display:block;margin-left:-10px}.att--tree a{font-size:12px;font-size:.75rem;cursor:pointer;position:relative;display:inline-block;padding:5px 3px;text-decoration:none;color:#888}.att--tree a:hover{color:#0091d9}.att--tree{width:-webkit-fit-content}.att--tree__plus.minus{color:#39b1ec}.att--tree__plus.minus:before{font-size:14px;font-size:.875rem;font-family:"Ionicons";content:"\e63c";display:inline-block;margin-right:8px;vertical-align:middle}.tablesorter-default{font-size:12px;font-size:.75rem;font-family:clearview_att_regular;width:100%;color:#333;background-color:#fff;margin:10px 0 15px;text-align:left;cursor:pointer}.tablesorter-default th,.tablesorter-default thead td{color:#fff;background-color:#666;border-collapse:collapse;padding:0;font-weight:700}.tablesorter-default tfoot td,.tablesorter-default tfoot th{border:0}.tablesorter-default .tablesorter-header.sorter-false .tablesorter-header-inner{background:0 0;cursor:default}.tablesorter-default .tablesorter-header .tablesorter-header-inner{background-image:url(images/upanddown.png);background-position:center right;background-repeat:no-repeat;cursor:pointer;white-space:normal;display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;padding:12px 16px}.tablesorter-default thead .headerSortUp .tablesorter-header-inner,.tablesorter-default thead .tablesorter-headerAsc .tablesorter-header-inner,.tablesorter-default thead .tablesorter-headerSortUp .tablesorter-header-inner{background-image:url(images/up.png)}.tablesorter-default thead .headerSortDown .tablesorter-header-inner,.tablesorter-default thead .tablesorter-headerDesc .tablesorter-header-inner,.tablesorter-default thead .tablesorter-headerSortDown .tablesorter-header-inner{background-image:url(images/down.png)}.tablesorter-default tfoot .tablesorter-headerAsc,.tablesorter-default tfoot .tablesorter-headerDesc,.tablesorter-default tfoot .tablesorter-headerSortDown,.tablesorter-default tfoot .tablesorter-headerSortUp{border-top:#000 2px solid}.tablesorter-default td{background-color:#fff;border-bottom:#aaa 1px solid;padding:4px;vertical-align:top}.tablesorter-default tbody>tr.even:hover>td,.tablesorter-default tbody>tr.odd:hover>td,.tablesorter-default tbody>tr:hover>td{background:#BBB;color:#000}.tablesorter-default tbody tr.normal-row td{background:#fff;padding:12px 16px}.tablesorter-default tbody tr.alt-row td{background:#f2f2f2;padding:12px 16px}.tablesorter-default tr.odd td{background-color:#dfdfdf}.tablesorter-default tr.even td{background-color:#efefef}.tablesorter-default tr.odd td.primary{background-color:#bfbfbf}.tablesorter-default td.primary,.tablesorter-default tr.even td.primary,.tablesorter-default tr.odd td.secondary{background-color:#d9d9d9}.tablesorter-default td.secondary,.tablesorter-default tr.even td.secondary,.tablesorter-default tr.odd td.tertiary{background-color:#e6e6e6}.tablesorter-default td.tertiary,.tablesorter-default tr.even td.tertiary{background-color:#f2f2f2}caption{background:#fff}.tablesorter-default .tablesorter-filter-row td{background:#eee;border-bottom:#ccc 1px solid;line-height:normal;text-align:center;-webkit-transition:line-height .1s ease;-moz-transition:line-height .1s ease;-o-transition:line-height .1s ease;transition:line-height .1s ease}.tablesorter-default .tablesorter-filter-row .disabled{opacity:.5;cursor:not-allowed}.tablesorter-default .tablesorter-filter-row.hideme td{padding:2px;margin:0;line-height:0;cursor:pointer}.tablesorter-default .tablesorter-filter-row.hideme .tablesorter-filter{height:1px;min-height:0;border:0;padding:0;margin:0;opacity:0}.tablesorter-default .tablesorter-filter{width:95%;height:auto;margin:4px;padding:4px;background-color:#fff;border:1px solid #bbb;color:#333;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:height .1s ease;-moz-transition:height .1s ease;-o-transition:height .1s ease;transition:height .1s ease}.tablesorter .filtered{display:none}.tablesorter .tablesorter-errorRow td{text-align:center;cursor:pointer;background-color:#e6bf99}.tablesorter-search-highlight{font-weight:700}.scrolling-table{width:700px}.scrolling-table .scroll-viewport{height:200px!important;width:99.5%!important;background-color:#fff}.scrolling-table .scroll-overview{margin-top:-14px!important}.scrolling-table .scroll-viewport:hover{background-color:#fff}.scrolling-table #att-scroll-table-content{height:200px;position:absolute!important;width:700px;padding-left:0;padding-top:0;padding-bottom:0;padding-right:5px}.icon--button{display:inline-block;margin-left:-6px;background-color:#fff;border:1px solid #888;height:40px;width:40px;line-height:39px;text-align:center;cursor:pointer;font-size:20px}.icon--button a{color:#888}.icon--button.first,.icon--button:first-child{border-radius:6px 0 0 6px}.icon--button.last,.icon--button:last-child{border-radius:0 6px 6px 0}.icon--button:hover{background-color:#bbb}.icon--button:hover>a{color:#444}.icon--button:active{background-color:#0574AC}.icon--button:active>a{color:#fff}.icon--button.active--button{background-color:#0574AC}.icon--button.active--button>a{color:#fff}.icon--button.icon--button__small{height:30px;width:34px;line-height:29px;font-size:14px}.icon--button__single-dropdown{font-size:14px;font-size:.875rem;display:inline-block;background-color:#fff;border:1px solid #888;height:30px;width:53px;line-height:29px;border-radius:6px;cursor:pointer}.icon--button__single-dropdown:after{font-size:14px;font-size:.875rem;font-family:"Ionicons";content:'\f104';color:#888;margin-left:-4px}.icon--button__single-dropdown:after:hover:after{color:#444}.icon--button__single-dropdown:after:active:after{content:"\f10d";color:#0091d9}.icon--button__single-dropdown a{color:#888;padding-left:10px}.icon--button__single-dropdown:hover{background-color:#bbb}.icon--button__single-dropdown:hover>a{color:#444}.icon--button__single-dropdown:active{background-color:#fff;border-radius:6px 6px 0 0;border-top:1px solid #0091d9;border-left:1px solid #0091d9;border-right:1px solid #0091d9;border-bottom:1px solid #bbb}.icon--button__single-dropdown:active>a{color:#0574AC}.icon--button__dropdown-list{position:absolute;display:none}.icon--button__dropdown-list ul{left:-webkit-calc("-100% + 52px");left:-moz-calc("-100% + 52px");left:calc("-100% + 52px");position:relative;list-style:none;margin-left:0;margin-top:-1px;padding-left:0;border-radius:6px 0 6px 6px;border:1px solid #0091d9}.icon--button__dropdown-list ul li{font-size:12px;text-align:left;height:30px;padding:0 10px}.icon--button__dropdown-list ul li a{color:#888;line-height:30px;padding:0}.icon--button__dropdown-list ul li:hover{background-color:#0091d9}.icon--button__dropdown-list ul li:hover>a{color:#fff}.section-toggle{border-top:1px solid #888;text-align:center}.section-toggle--disabled{border-top-color:#d3d3d3}.section-toggle__button{font-size:12px;font-size:.75rem;display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;background:#fff;border-radius:0 0 3px 3px;border:1px solid #888;color:#444;cursor:pointer;margin:0 auto;padding:5px 10px;position:relative;text-align:center;top:-1px}.section-toggle__button:hover{border-color:#0091d9}.section-toggle__button:active{outline:0}.section-toggle__button:focus{outline:1px solid #39b1ec;outline-offset:2px;text-decoration:none}.section-toggle__button .icon-chevron-down,.section-toggle__button .icon-chevron-up{display:inline-block;zoom:1;*display:inline;*vertical-align:auto;vertical-align:middle}.section-toggle--disabled .section-toggle__button{display:none}.icons-list{list-style:none;margin:20px 0 0;padding:0;font-size:0}.icons-list li{font-size:14px;display:inline-block;width:20%;box-sizing:border-box;vertical-align:top;padding:20px;margin-bottom:20px;cursor:default;min-height:130px;position:relative;overflow:hidden;border:1px solid transparent;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;transition:all .2s ease-out}.icons-list li:hover{background:#fff;color:#199DDF;border-color:#d3d3d3}.icons-list [class*=icon]{display:inline-block;vertical-align:middle;-webkit-transition:font-size .2s ease-out;-moz-transition:font-size .2s ease-out;transition:font-size .2s ease-out}.icons-list[data-size=small] [class*=icon]{font-size:14px}.icons-list[data-size=medium] [class*=icon]{font-size:28px}.icons-list[data-size=large] [class*=icon]{font-size:56px}.icons-list.small-icons [class*=icon]{font-size:56px!important}.icons-list li [class*=icon]:hover{outline:1px dotted #444;color:#199DDF}.icons-list [data-role=title]{font-family:clearview_att_regular;font-size:14px;margin-top:15px;display:block}.icons-list[data-display=list] li{display:block;margin-bottom:0;width:100%;min-height:0}.icons-list[data-display=list] [data-role=title]{display:inline-block;vertical-align:middle;margin:0;margin-left:15px}.icons-list [data-role=css-class]{display:none;font-size:11px;background:rgba(0,0,0,.8);color:#fff;margin-top:10px;text-align:center;box-sizing:border-box;position:absolute;left:0;right:0;bottom:-30px;padding:0 10px;height:25px;padding-top:7px;white-space:nowrap;overflow-x:auto;-webkit-transition:bottom .2s ease-out;-moz-transition:bottom .2s ease-out;transition:bottom .2s ease-out}.icons-list li:hover [data-role=css-class]{bottom:0}.icons-list[data-display=list] [data-role=css-class]{left:auto;top:50%;right:25px;margin-top:-12px;background:#d3d3d3;color:#444;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.show-dev-notes .icons-list [data-role=css-class]{display:block}.icons-list [data-role=css-class]::selection{background:#666}.icons-list[data-display=list] [data-role=css-class]::selection{background:#d3d3d3}.label-icon{display:block}.tabs-icon.tabs>li a{height:40px;line-height:40px;font-size:14px}.dragdrop{border:1px dashed #bbb;border-radius:5px;padding:0;text-align:center;color:#bbb;position:relative}.dragdrop-over{background:#0091d9;color:#006496}.dragdrop-over:after{content:"Drop the file";color:#fff;width:80px;height:20px;overflow:hidden;margin:auto;position:absolute;top:0;left:0;bottom:0;right:0}.fileContainer{position:relative;overflow:hidden;display:inline-table;font-weight:400}.fileContainer [type=file]{position:absolute;cursor:inherit;display:block;font-size:0;opacity:0;height:0;width:0;left:0;top:0;-ms-filter:"alpha(Opacity=0)"}.att-table-message .img-magnify-glass{background:url(images/magnify_glass.png) center center no-repeat;height:50px}.att-table-message .img-oops-exclamation{background:url(images/oops-exclamation.png) center center no-repeat;height:50px}.att-table-message .img-loading-dots{background:url(images/loading_dots.gif) center center no-repeat;height:50px}.att-table-message .message{text-align:center;padding-top:40px;border-style:solid;border-width:1px;border-top:0;padding-bottom:45px;border-color:#d2d2d2;width:100%;min-height:220px}.att-table-message .loading-message{background:#f2f2f2;background:rgba(242,242,242,.5)}.att-table-message .error-title{font-family:omnes_att_regular,Fallback,sans-serif;font-size:24px;color:#444;line-height:26px}.att-table-message .title{font-size:24px;color:#444;font-family:omnes_att_regular}.att-user-message .hidden{visibility:hidden}.att-user-message .message-wrapper-success{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;opacity:.95;background-color:#fff;-webkit-box-shadow:0 6px 6px rgba(0,0,0,.25),inset 0 -1px rgba(0,0,0,.3);-moz-box-shadow:0 6px 6px rgba(0,0,0,.25),inset 0 -1px rgba(0,0,0,.3);box-shadow:0 6px 6px rgba(0,0,0,.25),inset 0 -1px rgba(0,0,0,.3);float:right;margin-top:-50px;min-width:220px;max-width:360px;max-height:196px;border:solid #54AD18 1px}.att-user-message .message-wrapper-error{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;opacity:.95;background-color:#fff;-webkit-box-shadow:0 6px 6px rgba(0,0,0,.25),inset 0 -1px rgba(0,0,0,.3);-moz-box-shadow:0 6px 6px rgba(0,0,0,.25),inset 0 -1px rgba(0,0,0,.3);box-shadow:0 6px 6px rgba(0,0,0,.25),inset 0 -1px rgba(0,0,0,.3);float:right;margin-top:-50px;min-width:220px;max-width:360px;max-height:196px;border:solid #FE9E0C 1px}.att-user-message .message-icon-success{float:left;margin-top:10px;margin-left:10px;margin-right:10px;font-size:27px;color:#54AD18}.att-user-message .message-icon-error{float:left;margin-top:10px;margin-left:10px;margin-right:10px;font-size:27px;color:#FE9E0C}.att-user-message .message-title-success{font-family:clearview_att_regular;font-size:18px;line-height:15px;word-wrap:break-word;width:100%;color:#008A06}.att-user-message .message-title-error{font-family:clearview_att_regular;font-size:18px;line-height:15px;word-wrap:break-word;width:100%;color:#EF6F00}.att-user-message .message-body-wrapper{max-width:280px;margin-top:15px;margin-right:20px;margin-bottom:15px;float:left}.att-user-message .message-msg{color:#444;font-family:clearview_att_regular;font-size:12px;line-height:15px;margin-top:3px;margin-bottom:15px;word-wrap:break-word}.text-ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-ms-text-overflow:ellipsis;display:block;width:45%}.pane-group{height:100%;width:100%;border:1px solid #D3D3D3;border-radius:3px;background-color:#FFF}.pane-group .side-pane{position:relative;width:33%;height:100%;float:left}.pane-group .side-pane .header{padding:20px;font-family:Arial;font-size:14px;color:#444;line-height:20px}.pane-group .side-pane .body div{line-height:20px;font-family:clearview_att_regular;font-size:14px;color:#444;padding-top:10px;padding-bottom:10px;padding-left:20px}.pane-group .side-pane .body div:hover{background-color:#067AB4;cursor:pointer;color:#FFF}.pane-group .inner-pane{position:relative;display:none;width:300px;height:100%;border-left-width:1px;border-right-width:1px;border-left-style:solid;border-right-style:solid;border-color:#D3D3D3;float:left}.pane-group .inner-pane .header{padding:20px;font-family:Arial;font-size:14px;color:#444;line-height:20px}.pane-group .inner-pane .body div{line-height:20px;font-family:clearview_att_regular;font-size:14px;color:#444;padding-top:10px;padding-bottom:10px;padding-left:20px}.pane-group .inner-pane .body div:hover{background-color:#067AB4;cursor:pointer;color:#FFF}.pane-account-selector{width:940px;height:435px;margin-left:10%}.pane-account-selector .line{margin-left:20px;margin-right:20px}.pane-account-selector .side-pane .body .side-row-selected{background-color:#067AB4;color:#FFF}.pane-account-selector .side-pane .body .side-row-selected .chevron-mark{color:#FFF}.pane-account-selector .side-pane .body .chevron-mark{float:right;margin-right:10px;color:#067AB4}.pane-account-selector .side-pane .body div:hover .chevron-mark{color:#FFF}.pane-account-selector .inner-pane{height:434px}.pane-account-selector .inner-pane .header .form-field{width:100%;min-width:190px;max-width:270px;margin-top:10px}.pane-account-selector .inner-pane .header a{font-size:12px;font-family:clearview_att_regular;text-decoration:underline;color:#067AB4}.pane-account-selector .inner-pane .header .verticalLine{border-left:2px solid #D3D3D3;padding-left:2px;padding-right:4x}.pane-account-selector .inner-pane .body .chevron-mark{float:right;margin-right:20px;margin-left:20px;color:#067AB4}.pane-account-selector .inner-pane .body div:hover .chevron-mark{color:#FFF}.pane-account-selector .inner-pane .body .att-radio,.pane-account-selector .inner-pane .body .att-radio__indicator{padding:0}.pane-account-selector .inner-pane hr{margin-top:0;margin-bottom:0}.att-drawer{background-color:#fff;box-shadow:0 4px 5px rgba(0,0,0,.2),inset 0 1px rgba(0,0,0,.3);-webkit-box-shadow:0 4px 5px rgba(0,0,0,.2),inset 0 1px rgba(0,0,0,.3);-moz-box-shadow:0 4px 5px rgba(0,0,0,.2),inset 0 1px rgba(0,0,0,.3)}.drawer-backdrop{position:absolute;top:0;right:0;bottom:0;left:0;background:rgba(255,255,255,.6);z-index:999}.loading_div{display:block;margin:10px 0}.typeahead span[tag-badges]{margin-right:5px}.typeahead .tag{margin:0}.typeahead.mainContainerOuter{position:relative;margin-top:35px}.typeahead .maincontainer{text-align:left;width:700px;border:1px solid #888;border-radius:5px;background:#FFF;max-height:220px;overflow:auto;padding:8px 10px 7px;margin-top:3px}.typeahead .maincontainer:focus{border:1px solid #0091d9}.typeahead .typeahed_active{border:1px solid #0574ac}.typeahead .maincontainer>br{display:none}.typeahead .maincontiner>span{font-size:15px;display:inline-block;padding-right:10px}.typeahead input{padding:5px!important;font-size:14px!important;outline:0!important;background:transparent!important;width:auto!important;border:0!important;height:25px!important}.typeahead ::-ms-clear{display:none}.typeahead .item{width:100%;box-sizing:border-box;margin:auto;text-align:left;height:30px;background:#FFF;padding:4px}.typeahead .item.title{font-size:18px;font-weight:700}.typeahead .subtitle{font-size:14px;color:#444}.typeahead .active{background-color:#4180C4;color:#f2f2f2}.typeahead .filtercontainer{position:absolute;left:0;margin-top:-5px;max-height:160px;overflow:auto;width:100%;background:#FFF;z-index:999;border-radius:0 0 5px 5px;border:1px solid #0091d9}.typeahead .dynamiccss{width:120px;height:30px;border:2px #000 solid;display:inline;margin-left:2px}.typeahead .textAreaEmailContent{font-size:14px;height:80px;line-height:20px;color:#444;width:700px;font-family:clearview_att_regular;margin-top:3px;padding:10px}.typeahead .btnEmailSend{margin-top:70px}.typeahead .message{font-size:12px;line-height:20px;color:#444;font-family:clearview_att_regular}.typeahead .textAreaEmailContentDiv{margin-top:17px}.att-modal__close.typeahead-close{position:absolute;left:initial;bottom:initial;right:0;top:0;color:#000}.typeahead-modal-container{position:relative;width:700px;margin:30px auto}.typeahead-heading{font-size:36px;line-height:20px;color:#444;font-family:omnes_att_light;margin:0}.typeahead-paragraph{font-size:14px;line-height:20px;color:#444;font-family:clearview_att_regular;margin-top:7px;margin-bottom:0}.typeahead-modal-footer{padding-top:40px}.type_ahead-cancel{margin-left:10px}.tabs_overlay{list-style:none;margin:0;padding:0;font-size:0;display:block;border:1px solid #888;border-radius:3px}.tabs_overlay .tabs_overlay__item{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;font-size:18px;font-size:1.125rem;padding:10px 15px;border-left:1px solid #d3d3d3}.tabs_overlay .tabs_overlay__item.two__item{width:50%}.tabs_overlay .tabs_overlay__item.three__item{width:33.3%}.tabs_overlay .tabs_overlay__item.active{background-color:#0574AC;color:#fff}.tabs_overlay .tabs_overlay__item.active .icon-included-checkmark,.tabs_overlay .tabs_overlay__item.active .icon-orders,.tabs_overlay .tabs_overlay__item.active a.viewLink{color:#fff}.tabs_overlay .tabs_overlay__item a.viewLink{float:right;padding-top:2px;font-size:14px;font-size:.875rem}.tabs_overlay .tabs_overlay__item .icon-orders{color:#0574AC}.tabs_overlay .tabs_overlay__item .icon-included-checkmark{color:#4ca90c}.tabbedOverlay_modal{background:none repeat scroll 0 0 #f2f2f2;opacity:.91}.tabbedOverlay_modal .modal__main{color:inherit;padding:0;width:936px;background:0 0;border:0;border-radius:none;box-shadow:none;margin:5% auto}.tabbedOverlay_modal .modal__content{width:100%;background-color:#fff;display:inline-block;padding:0;margin-top:30px}.tabbedOverlay_modal .modal__content .body__content{padding:20px 8px}.tabbedOverlay_modal .icon-circle-action-close{font-size:28px}.tabbedOverlay_modal .icon-trash{font-size:14px;color:#0574AC;border:solid 1px #0574AC;border-radius:6px;padding:5px}.att-boardstrip{display:inline-block;width:100%;border-bottom:1px solid #9d9d9d;position:relative;padding-top:15px}.att-boardstrip .boardstrip-reel{margin-bottom:15px}.att-boardstrip .boardstrip-item--add{border:1px dashed #CCC!important;background:#F2F2F2;color:#444545;width:140px;height:80px;font-size:12px;font-family:clearview_att_regular;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;position:absolute;left:50px;top:15px}.att-boardstrip .boardstrip-item--add:hover{background-color:#39b1ec;cursor:pointer;color:#fff}.att-boardstrip .boardstrip-item--add i{font-size:30px;margin-left:auto;margin-right:auto}.att-boardstrip .boardstrip-item--add .centered{margin-left:auto;margin-right:auto;margin-top:8px;margin-bottom:-12px;display:block}.att-boardstrip .board-viewport{float:left;margin-left:210px;max-height:95px;position:relative;height:95px;overflow:hidden;width:0}.att-boardstrip .board-viewport .boardstrip-container{width:0;margin-left:0;left:0;position:absolute;list-style:none;-webkit-transition:left 1000ms;-moz-transition:left 1000ms;transition:left 1000ms}.att-boardstrip .board-viewport .board-item{width:140px;height:80px;border:1px solid #000;margin:0 15px 15px 0;background-color:#efefef;border-radius:3px;float:left;overflow:hidden}.att-boardstrip .board-viewport .board-item:focus,.att-boardstrip .board-viewport .board-item:hover{border:2px solid #0091d9;background-color:#fff;cursor:pointer}.att-boardstrip .board-viewport .board-item .board-img{width:61px;height:40px;margin:0 auto}.att-boardstrip .board-viewport .board-item .board-img img{max-width:100%}.att-boardstrip .board-viewport .board-item .title{margin:0 auto;display:block;text-align:center;line-height:16px;color:#555545;font-size:12px;font-family:clearview_att_regular;padding:10px 0}.att-boardstrip .board-viewport .board-item.selected{background-color:#fff;border:2px solid #0091d9}.att-boardstrip .board-viewport .board-item .board-caret{cursor:default;outline:0;position:absolute;bottom:7px}.att-boardstrip .board-viewport .board-item .board-caret .board-caret-indicator{border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:8px solid #999;width:0;height:0;position:absolute;left:61px;bottom:-7px}.att-boardstrip .board-viewport .board-item .board-caret .board-caret-arrow-up{width:0;height:0;border-style:solid;border-width:0 8px 8px;border-color:transparent transparent #f2f2f2;left:61px;position:absolute}.att-boardstrip .arrow{font-size:32px;cursor:pointer}.att-boardstrip .arrow:hover{color:#0091d9}.att-boardstrip .prev-items{display:inline-block;margin-top:auto;margin-bottom:auto;margin-right:15px;margin-right:15px;position:absolute;left:0;top:36px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.att-boardstrip .next-items{display:inline-block;margin-top:auto;margin-bottom:auto;margin-left:15px;position:absolute;right:0;top:36px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.att-boardstrip .centered{display:table-cell;text-align:center;vertical-align:middle}.content{color:#444}section{margin-bottom:60px}a:hover{text-decoration:none}a:focus{outline:-webkit-focus-ring-color auto 5px}h2,h3,h4{margin:0 0 20px}h2{font-family:'Helvetica Neue',Helvetica;font-size:36px;font-size:2.25rem}h3{font-size:18px;font-size:1.125rem;font-weight:400}h4{font-size:14px;font-size:.875rem;font-weight:600;margin:0}dl{margin:5px 0 20px}dd,dt{display:inline-block;margin:0;width:80px}dd{width:150px}.font-clearview p{font-size:12px;font-size:.75rem;line-height:20px}.row{position:relative}.section-row{padding:20px 0;position:relative}.section-row:first-child{padding-top:0}.section-row:first-child h2{margin-top:-5px}.section-row h4{text-transform:uppercase}.section-description{line-height:20px}.section-row-description{font-size:12px;font-size:.75rem;line-height:18px;margin:5px 0}.section-row-description+.section-row-description{margin-top:20px}.section-buttons,.section-download-button{margin-top:5px;position:absolute;right:10px}.section-image{margin:20px 0;width:100%}.font-face-showcase{font-size:44px;font-size:2.75rem;line-height:54px;margin:20px 0}#pill-buttons{background:url(images/pill-buttons-diagram.png) 360px 50px no-repeat}#pill-buttons h2{margin-top:0}#pill-buttons .section-row .icon-cross{color:#888;font-size:30px;font-size:1.875rem}.colored-buttons-wrapper{margin-bottom:40px}.colored-buttons-container{-webkit-transition:background .3s ease-out;-moz-transition:background .3s ease-out;transition:background .3s ease-out;margin:0 0 20px;overflow:hidden;padding:20px 0}#forms{background:url(images/forms-diagram.png) 360px 100px no-repeat}.switches label{display:inline-block;margin:10px 0 15px;text-align:center;width:100%}.switches .span2{text-align:center}.dev-notes{background:#eaeaea;border-radius:3px;display:none;margin-bottom:50px;padding:20px}.show-dev-notes .dev-notes{display:block}.dev-notes .tabs{margin-top:20px}.dev-notes .tabs li a{background:#aaa;border:0;border-bottom:0;border-radius:0;color:#333;font-family:clearview_att_regular;font-size:10px;font-size:.625rem;height:auto;line-height:18px;margin-left:2px;padding:5px 15px 2px}.dev-notes .tabs li:first-child a{margin-left:0}.dev-notes .tabs li:hover a{background:#181818}.dev-notes .tabs li.active a{background:#272822}.dev-notes .tabs li.active a,.dev-notes .tabs li:hover a{color:#fff}pre.line-numbers{background-color:#272822;border-radius:0 0 3px 3px;border:0;margin:0;padding-bottom:30px;padding-left:50px;padding-top:30px;word-wrap:normal}pre.line-numbers.with-example{border-radius:0 0 3px 3px;overflow:visible;padding-bottom:10px;padding-left:40px;position:relative}pre.notes{padding-top:0;padding-bottom:0}.dev-notes-header{margin:0 0 10px;z-index:10;-webkit-border-radius:3px 3px 0 0;-moz-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0}.dev-notes.with-tabs .dev-notes-header{margin:0;padding-bottom:0}.dev-notes .title,.dev-notes p{margin:10px 0 0;color:#777;font-size:12px;font-size:.75rem}.dev-notes p:first-of-type{margin-top:0}.dev-notes .title{font-weight:600;margin:0 0 5px}.dev-notes .title:before{content:'Dev Notes: '}.dev-notes .close{position:absolute;top:0;right:0;color:#777;font-size:12px;font-size:.75rem;padding:7px 0 7px 10px;text-align:right}.dev-notes .close:hover{color:#F9432C}.dev-notes-example-title{margin:0 0 10px;color:#777}.dev-notes-wrapper{margin:0;background:#272822;padding:20px;border-radius:0 3px 3px}.dev-notes-example{margin:0;padding:20px;background:#fff;position:relative;overflow:hidden}.dev-notes-example:last-child{margin-bottom:0}.dev-notes-js-link{position:absolute;right:10px;top:10px;font-family:clearview_att_regular;font-size:10px;font-size:.625rem;color:#444;padding:5px;background:#ddd;border:1px solid #ccc;border-radius:3px}.dev-notes-js-link:hover{background-color:#fff}.navbar .body-color-selector>a{color:#6f6f6f}.navbar .body-color-selector-item{height:50px;padding:0 10px;-moz-box-sizing:border-box;box-sizing:border-box}.navbar .body-color-selector-color{text-indent:-9999px;width:25px;height:25px;border-radius:100%;float:right;margin-top:12px;background-color:#DADADA}.body-color-selector-gray .body-color-selector-color{background-color:#DADADA}.body-color-selector-white .body-color-selector-color{background-color:#fff}.font-showcase-row>[class*=span]:first-child{border-top:1px solid #d3d3d3;padding-top:35px}.font-showcase-row h4{font-family:Arial;font-size:12px;font-size:.75rem;font-weight:100;text-transform:uppercase}h4.font-showcase-font-example,h4.font-showcase-font-name{text-transform:none}.font-showcase-info{font-family:clearview_att_regular;font-size:12px;font-size:.75rem;color:#888}.h6 .font-showcase-info{margin-top:-10px}.font-showcase-row .section-row-description{margin-bottom:20px}.font-showcase-row.display-prices .right-col .size-half{margin-bottom:15px}.font-showcase-row .display-prices-small{margin-top:30px}.font-showcase-details .details-label{margin-top:22px}.color-circle{display:inline-block;width:100px;height:100px;border-radius:100%}.next-section-link{margin-top:50px;display:inline-block;text-decoration:none;border-bottom:1px solid transparent}.next-section-link:hover{color:#FC411E;border-bottom-color:#FC411E;text-decoration:none}.next-section-link:after{content:'\e6da';font-family:"Ionicons";font-size:12px;font-size:.75rem;margin-left:5px}#breadcrumbs .section-row{padding-top:0}#breadcrumbs .section-description{margin:0}#photo-video-controls{background:url(../images/video-photo-controls.png) right 60px no-repeat}#photo-video-controls .section-description{margin-bottom:70px}[data-role=actions-bar]{background:#F2F2F2;position:relative;z-index:1;padding-top:0;padding-bottom:25px;margin-bottom:10px;overflow:hidden}[data-role=actions-bar]:after{content:'';position:absolute;display:block;bottom:0;left:10px;right:10px;border-bottom:1px solid #d3d3d3}.color-white [data-role=actions-bar]{background:#fff}[data-role=actions-bar] label{position:relative}[data-role=actions-bar] label span{text-transform:none;font-size:10px;font-size:.625rem}#iconography.affix{position:relative;padding-top:87px}#iconography.affix [data-role=actions-bar]{width:720px;top:50px;z-index:1;position:fixed;padding-top:35px;padding-bottom:25px}#total-icons-found{position:absolute;right:0}#iconography .section-row:first-child h2{margin-bottom:0}.columns{font-size:0}.columns.text-center{margin:0 auto}.col{display:inline-block;vertical-align:top;font-size:14px;font-size:.875rem;box-sizing:border-box}.size-col-10,.size-full{width:100%}.size-twofifths{width:40%}.size-threefifths{width:60%}.size-fourfifths{width:90%}.size-col-1,.size-onetenth{width:10%}.size-col-2,.size-twotenths{width:20%}.size-col-3,.size-threetenths{width:30%}.size-col-4,.size-fourtenths{width:40%}.size-col-5,.size-fivetenths{width:50%}.size-col-6,.size-sixtenths{width:60%}.size-col-7,.size-seventenths{width:70%}.size-col-8,.size-eighttenths{width:80%}.size-col-9,.size-ninetenths{width:90%}.no-margin{margin:0}.pull-right{float:right}.pull-left{float:left}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-uppercase{text-transform:uppercase}.text-underline{text-decoration:underline}.hide{display:none}.show{display:block}.invisible{visibility:hidden}.affix{position:fixed}.font-clearview{font-family:clearview_att_regular}.font-omnes{font-family:omnes_att_regular}.font-omnes-light{font-family:omnes_att_light}.note{font-size:12px;font-size:.75rem;color:#ff3000}.size-full{width:100%}.size-half{width:50%}.size-onethird{width:33.333333%}.size-twothirds{width:66.666666%}.size-onefourth{width:25%}.size-onefifth{width:20%}.size-onesixth{width:16.666666%}.size-oneseventh{width:14.285714%}.size-oneeighth{width:12.5%}.size-onenineth{width:11.111111%}.size-onetenth{width:10%}.bg-color-primary{background-color:#067ab4}.bg-color-primary-hover{background-color:#199ddf}.bg-color-text{background-color:#444}.bg-color-inactive{background-color:#ddd}.bg-color-uielements{background-color:#777}.bg-color-table-hover{background-color:#e5e5e5}.bg-color-subtle-hover{background-color:#bbb}.bg-color-background{background-color:#ddd}.bg-color-buynow{background-color:#ff7200}.bg-color-warning{background-color:#fcb134}.bg-color-error{background-color:#ff4539}.bg-color-success{background-color:#6ebb1f}.text-color-primary{color:#067ab4}.text-color-primary-hover{color:#199ddf}.text-color-text{color:#444}.text-color-inactive{color:#ddd}.text-color-uielements{color:#777}.text-color-table-hover{color:#e5e5e5}.text-color-subtle-hover{color:#bbb}.text-color-background{color:#ddd}.text-color-buynow{color:#ff7200}.text-color-warning{color:#fcb134}.text-color-error{color:#ff4539}.text-color-success{color:#6ebb1f}.align-right{margin-left:0!important;left:-100%!important;right:0!important}.align-left{left:-1px!important;right:0!important;margin-left:0!important;border-top-right-radius:6px!important;border-top-left-radius:0!important}#horizontalScroll{height:80px;width:100px;border:1px solid #000;overflow-y:hidden}#horizontalScroll #dynamicWidth{border:0}#horizontalScroll div{width:40px;height:100%;border:1px dashed #000}#utilities ul{height:80px;width:100px;border:1px solid #000;margin-left:0}#utilities .accessibility-div{min-width:100px;min-height:100px;width:100px;height:100px;border:1px solid #000}#utilities .circle{display:block;max-width:40px;max-height:40px;padding:11px 0;-moz-box-sizing:border-box;box-sizing:border-box;background:#e5e5e5;border-radius:20px;position:relative;line-height:15px;color:#999;text-align:center;border:1px solid transparent;cursor:pointer}#utilities .circle span{display:block;font-size:10px;line-height:10px;text-align:center;color:#999;border:1px solid #999;position:absolute;height:18px;width:65px;top:18px;left:0;padding-top:20px;cursor:pointer}#utilities .color-on-focus:focus{background:#0574AC;border-color:#fff} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/tbs.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/tbs.css
new file mode 100644
index 00000000..98202e6a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/tbs.css
@@ -0,0 +1 @@
+@charset "UTF-8";address,blockquote,dd,h1,h2,h3,h4,h5,h6,ol,p,pre,table,ul{margin:0;padding:0;margin-bottom:24px;margin-bottom:1.5rem}html{font-size:1em;line-height:1.5}body{margin:0}h1{font-size:48px;font-size:3rem;line-height:1}h2{font-size:36px;font-size:2.25rem;line-height:1.3333333333}h3{font-size:30px;font-size:1.875rem;line-height:1.6}h4{font-size:24px;font-size:1.5rem;line-height:1}h5{font-size:20px;font-size:1.25rem;line-height:1.2}h6{font-size:18px;font-size:1.125rem;line-height:1.3333333333}dd,ol,ul{margin-left:48px;margin-left:3rem}li>ol,li>ul{margin-bottom:0}code,kbd,pre,samp{font-family:monospace,monospace}blockquote{text-indent:-.41em;quotes:"“" "â€";margin-left:48px;margin-left:3rem}blockquote p:before{content:"“";content:open-quote}blockquote p:after{content:"";content:no-close-quote}blockquote p:last-of-type:after{content:"â€";content:close-quote}q{quotes:"‘" "’" "“" "â€"}q:before{content:"‘";content:open-quote}q:after{content:"’";content:close-quote}q q:before{content:"“";content:open-quote}q q:after{content:"â€";content:close-quote}q:first-child{display:inline-block;text-indent:-.22em}table{width:100%;border-collapse:collapse;border-spacing:0}td,th{padding:12px}#grid{position:absolute;top:0;left:50%;width:980px;margin-left:-490px;counter-reset:section;z-index:9999!important;pointer-events:none;outline:1px solid rgba(0,206,209,.1)}#grid:after{position:fixed;top:0;left:0;content:'Column: 20px Gutter: 20px Margin: 20px';display:block;max-width:90px;padding:3px;background-color:#000;color:#fff;font-size:10px;font-family:monospace;z-index:9999}#grid div.vert{width:20px;outline:solid rgba(0,206,209,.3);outline-width:1px;margin-right:20px;position:relative;background:rgba(255,0,0,.05);counter-increment:section}#grid div.vert.first-line{margin-left:20px}#grid div.vert::after{position:fixed;display:block;text-align:center;color:#fff;width:20px;content:counter(section);top:5px;font-size:8px;font-family:monospace}#grid div.vert:nth-child(24){position:absolute;top:0;right:0}#grid div.vert:nth-child(1),#grid div.vert:nth-child(10),#grid div.vert:nth-child(11),#grid div.vert:nth-child(12),#grid div.vert:nth-child(13),#grid div.vert:nth-child(14),#grid div.vert:nth-child(15),#grid div.vert:nth-child(16),#grid div.vert:nth-child(17),#grid div.vert:nth-child(18),#grid div.vert:nth-child(19),#grid div.vert:nth-child(2),#grid div.vert:nth-child(20),#grid div.vert:nth-child(21),#grid div.vert:nth-child(22),#grid div.vert:nth-child(23),#grid div.vert:nth-child(24),#grid div.vert:nth-child(3),#grid div.vert:nth-child(4),#grid div.vert:nth-child(5),#grid div.vert:nth-child(6),#grid div.vert:nth-child(7),#grid div.vert:nth-child(8),#grid div.vert:nth-child(9){display:inline-block!important}#grid div.vert:nth-child(25),#grid div.vert:nth-child(26),#grid div.vert:nth-child(27),#grid div.vert:nth-child(28),#grid div.vert:nth-child(29),#grid div.vert:nth-child(30),#grid div.vert:nth-child(31){display:none!important}#grid div.horiz{height:10px;border-bottom:1px dotted rgba(100,100,100,.2);margin:0;padding:0}.bg-prime-blue{background-color:#067ab4}.bg-secondary-gray{background-color:#666}.bg-light-blue{background-color:#bcc9d5}.bg-dark-gray{background-color:#444}.bg-dusty-blue{background-color:#97b1cf}.bg-warm-gray{background-color:#cccb9b}.bg-taupe{background-color:#cccb6c}.bg-green-highlight{background-color:#c4d63f}.bg-lime-highlight{background-color:#dad632}.bg-purple-highlight{background-color:#b6539c}.bg-magenta{background-color:#d71481}.bg-blue-highlight{background-color:#4cc8f3}.bg-ochre{background-color:#fab230}.bg-green{background-color:#4fa721}.bg-lime{background-color:#b6bd26}.bg-purple{background-color:#7f0e7c}.bg-burgundy{background-color:#b1103e}.bg-dark-blue{background-color:#0e2875}.bg-gold{background-color:#fd9827}.bg-teal{background-color:#20c6b2}.bg-mint-green{background-color:#9cfecd}.bg-yellow{background-color:#feed35}.bg-white{background-color:#fff}.alt.inline-list>li{display:inline-block;zoom:1;*display:inline;*vertical-align:auto;vertical-align:middle;float:none}.text-upper{text-transform:uppercase!important}body{font-family:clearview_att_regular}.font-showcase h1,.font-showcase h2,.font-showcase h3,.font-showcase h4,.font-showcase h5,.font-showcase h6{font-weight:100;letter-spacing:-1px;margin:10px 0;-webkit-font-smoothing:antialiased}.font-showcase h1{font-family:omnes_att_light;font-size:48px;font-size:3rem;line-height:48px}.font-showcase h2,.price{font-family:omnes_att_light;font-size:36px;font-size:2.25rem;line-height:36px}.font-showcase h3{font-family:omnes_att_regular;font-size:24px;font-size:1.5rem;line-height:28px}.font-showcase h4,.font-showcase h4.font-showcase-font-example,.font-showcase h4.font-showcase-font-name{font-family:clearview_att_regular;font-size:18px;font-size:1.125rem;line-height:22px;-webkit-font-smoothing:antialiased}.font-showcase h5{font-family:clearview_att_regular;font-size:14px;font-size:.875rem;line-height:20px;-webkit-font-smoothing:antialiased}.font-showcase h6{font-family:Arial;font-size:11px;font-size:.6875rem;line-height:30px;font-weight:100;-webkit-font-smoothing:antialiased}.body-copy,.font-showcase p{font-family:clearview_att_regular;font-size:14px;font-size:.875rem;line-height:20px;-webkit-font-smoothing:antialiased}.body-copy-short{font-family:clearview_att_regular;font-size:12px;font-size:.75rem;line-height:15px;-webkit-font-smoothing:antialiased}p [class*=icon]{display:inline-block;vertical-align:middle;margin-top:-4px}.details-label{display:block;font-family:clearview_att_regular;font-size:11px;font-size:.6875rem;line-height:15px}.details-label+.price{line-height:28px}.price{letter-spacing:-1px;-webkit-font-smoothing:antialiased}.price sup{font-size:18px;font-size:1.125rem;vertical-align:baseline;top:-11px;margin:0 2px}.price-alt{font-size:24px;font-size:1.5rem;line-height:24px}.price-alt sup{font-size:12px;font-size:.75rem;top:-8px}.promo-tagline{font-family:omnes_att_medium_italic;font-size:16px;font-size:1rem;line-height:20px;display:inline-block;margin-bottom:5px;-webkit-font-smoothing:antialiased}.promo-text{font-family:clearview_att_italic;font-size:12px;font-size:.75rem;line-height:15px;display:inline-block;margin-bottom:5px;-webkit-font-smoothing:antialiased}.divider,.divider-dark,hr{border:0;border-bottom:1px solid #d3d3d3}.divider-light{border-color:#e5e5e5}dl{font-family:clearview_att_regular;color:#444;font-size:12px;font-size:.75rem}dt{font-family:Arial;font-size:11px;font-size:.6875rem;display:block!important;margin:10px 0 5px!important;width:auto!important;text-transform:uppercase}dt a{font-family:clearview_att_regular;color:#067ab4;text-transform:none}dd{display:inline!important;line-height:20px}[data-highlight]{background-color:#c9e9f9;-webkit-animation:highlight-fade 3s infinite}@-webkit-keyframes highlight-fade{100%,80%{background-color:transparent}}.tabsbid{vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;list-style:none;margin:0;padding:0;font-size:0;display:-webkit-inline-box}.simplified-tabs__item .active{border-bottom:solid 4px #444}.tabsbid--right{float:right}.tabsbid__item{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;padding:0;margin:0}.tabsbid__item-link{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;font-size:14px;font-size:.875rem;background-color:#f2f2f2;border:1px solid #888;color:#666;cursor:pointer;height:40px;line-height:39px;margin:0 0 0 -1px;padding:0 20px;text-align:center;text-decoration:none;text-transform:none;width:auto}.tabsbid__item--first .tabsbid__item-link,.tabsbid__item:first-child .tabsbid__item-link{border-radius:4px 0 0 4px;margin-left:0}.tabsbid__item--last .tabsbid__item-link,.tabsbid__item:last-child .tabsbid__item-link{border-radius:0 4px 4px 0}.tabsbid__item-link:hover{-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;transition:all .3s ease-out;background-color:#b2b2b2;color:#000;text-decoration:none}.tabsbid__item--active .tabsbid__item-link{background-color:#0574AC;border:1px solid #0574AC;color:#fff}.tabsbid--small .tabsbid__item-link{font-size:11px;font-size:.6875rem;padding:0 15px;height:30px;line-height:29px;margin:0 0 0 -5px}.tabsbid--light .tabsbid__item-link{background-color:#fff}.tabsbid--links{text-align:left;border-bottom:1px solid #888}.tabsbid--links .tabsbid__item-link{font-size:14px;font-size:.875rem;background-color:none;border:0;padding:0 15px 0 0}.tabsbid--links .tabsbid__item-link:hover{-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;transition:all .3s ease-out;background:0 0;color:#067ab4;text-decoration:none}.tabsbid--links .tabsbid__item--active .tabsbid__item-link{background:0 0;color:#067ab4}.tabsbid--icons .tabsbid__item--active .tabsbid__item-link,.tabsbid--icons .tabsbid__item-link,.tabsbid--icons .tabsbid__item-link:hover{font-size:28px;font-size:1.75rem;background:0 0;border:0;line-height:36px;margin-right:10px;padding:0}.tabsbid--icons .tabsbid__item-link [class^=icon-]{vertical-align:middle}.tabsbid--icons .tabsbid__item-link:hover{color:#067ab4}.tabsbid__content{width:100%}.tabsbid__pane{display:none}.tabsbid__pane--active{display:block}.tabsbid--image{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;clear:both;float:none;list-style:none;margin:0;padding:20px 0 0;font-size:0}.tabsbid__item--image{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;position:relative}.tabsbid__item--image img{margin:0 auto;opacity:.3}.tabsbid__item--image-title{color:#888}.tabsbid__item--image.tabsbid__item--active img,.tabsbid__item--image:hover img{margin:0 auto;opacity:1}.tabsbid__item--image.tabsbid__item--active .tabsbid__item--image-title,.tabsbid__item--image:hover .tabsbid__item--image-title{color:#067ab4}.tabsbid__item--image .tabsbid__item--image-link,.tabsbid__item--image.tabsbid__item--active{position:relative}.tabsbid__item--image.tabsbid__item--active:after,.tabsbid__item--image.tabsbid__item--active:before{position:absolute;bottom:-24px;left:50%;content:'';margin-left:-8px;border:8px solid transparent;z-index:3}.tabsbid__item--image.tabsbid__item--active:before{bottom:-23px;border-bottom-color:#d3d3d3}.tabsbid__item--image.tabsbid__item--active:after{border-bottom-color:#f2f2f2}.tabsbid__content--image{padding:15px 0;width:100%}.simplified-tabs{background-color:#f2f2f2;position:relative}.simplified-tabs:after{position:absolute;right:0;bottom:0;left:0;border-bottom:1px solid #888;content:''}.simplified-tabs .simplified-tabs__items{border-spacing:30px 0;display:table;list-style:none;margin:0;padding:0;margin-left:-30px;position:relative;table-layout:fixed}.simplified-tabs .simplified-tabs__items:after{position:absolute;right:40px;bottom:0;left:30px;border-bottom:1px solid #888;content:''}.simplified-tabs .simplified-tabs__item{width:auto;height:100%;-webkit-transition:color .15s ease-in-out;-moz-transition:color .15s ease-in-out;transition:color .15s ease-in-out;font-size:14px;font-size:.875rem;display:table-cell;font-family:clearview_att_regular;padding-bottom:17px;position:relative;text-align:center}.simplified-tabs .simplified-tabs__item:before{height:0;width:0;border-color:transparent;border-style:solid;border-width:10px;border-bottom-color:#888;position:absolute;right:0;bottom:0;left:50%;content:'';display:none;margin-left:-11px;z-index:1}.simplified-tabs .simplified-tabs__item:after{height:0;width:0;border-color:transparent;border-style:solid;border-width:10px;border-bottom-color:#f2f2f2;-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;transition:all .2s ease-out;position:absolute;right:0;bottom:-1px;left:50%;content:'';display:none;margin-left:-11px;z-index:1}.simplified-tabs .simplified-tabs__item:hover{color:#0091d9;cursor:pointer}.simplified-tabs .simplified-tabs__item a{color:inherit;outline:0;position:relative}.simplified-tabs .simplified-tabs__item a:before{position:absolute;top:-2px;right:-2px;bottom:-2px;left:-2px;display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;border:1px solid #39b1ec;content:'';opacity:0}.lt-ie9 .simplified-tabs .simplified-tabs__item a:before{content:none}.simplified-tabs .simplified-tabs__item a:focus:before{opacity:1}.lt-ie9 .simplified-tabs .simplified-tabs__item a:focus:before{content:''}.simplified-tabs .simplified-tabs__item.tabs__item--active{color:#0574AC;font-family:Arial}.simplified-tabs .simplified-tabs__item.tabs__item--active:after,.simplified-tabs .simplified-tabs__item.tabs__item--active:before{display:block}.lt-ie9 .simplified-tabs .simplified-tabs__item.tabs__item--active:after,.lt-ie9 .simplified-tabs .simplified-tabs__item.tabs__item--active:before{content:' '}.simplified-tabs+.tabs__content{padding-top:19px}.simplified-tabs .tabs__pointer{width:20px;height:11px;left:-11px}.simplified-tabs .tabs__pointer:before{height:0;width:0;border-color:transparent;border-style:solid;border-width:10px;border-bottom-color:#888;left:-11px}.simplified-tabs .tabs__pointer:after{height:0;width:0;border-color:transparent;border-style:solid;border-width:10px;border-bottom-color:#f2f2f2;left:-11px}.tabs__pointer{width:28px;height:15px;position:absolute;bottom:0;left:-14px;display:none}.tabs__pointer:after,.tabs__pointer:before{content:'';z-index:3}.tabs__pointer:before{height:0;width:0;border-color:transparent;border-style:solid;border-width:14px;border-bottom-color:#6f6f6f;position:absolute;bottom:0;left:-14px}.tabs__pointer:after{height:0;width:0;border-color:transparent;border-style:solid;border-width:14px;border-bottom-color:#f2f2f2;position:absolute;bottom:-1px;left:-14px}.tabs--no-pointer .simplified-tabs__item:after,.tabs--no-pointer .simplified-tabs__item:before,.tabs--no-pointer .tabs__item--image:after,.tabs--no-pointer .tabs__item--image:before{display:none}.gtabs{margin-left:-30px}.gtabs .tabsbid__item{position:relative;bottom:-1px}.gtabs li.tabsbid__item--active{border-bottom:0}.gtabs ul{border-bottom:1px solid #888}.gtabs .tabsbid__item--first .tabsbid__item-link,.tabsbid__item:first-child .tabsbid__item-link{border-radius:4px 0 0}.gtabs .tabsbid__item--last .tabsbid__item-link,.tabsbid__item:last-child .tabsbid__item-link{border-radius:0 4px 0 0}.gtabs .tabsbid__item--active .tabsbid__item-link{background:#f2f2f2;border:1px solid #888;border-bottom:0;color:inherit;z-index:-2}.gtabs .tabsbid__item-link{background:#fff}.gtabs .tabsbid__item-link:hover{background-color:#bbb;color:#000;text-decoration:none}.tabsbid__item a:focus{text-decoration:none}.top-megamenu .megamenu-tabs{background-color:#067ab4;position:relative}.top-megamenu .megamenu-tabs ul{width:980px;margin:0 auto;display:block;list-style:none;padding:0}.top-megamenu .megamenu-tabs ul li{display:inline-block;text-align:left}.megamenu-tabs{background-color:#067ab4;position:relative}.megamenu-tabs ul{width:auto;display:block;list-style:none;padding:0}.megamenu-tabs ul li{display:inline-block;text-align:left}.megamenu-tabs .megamenu__items{border-spacing:30px 0}.megamenu-tabs .megamenu__item{width:auto;height:100%;-webkit-transition:color .15s ease-in-out;-moz-transition:color .15s ease-in-out;transition:color .15s ease-in-out;font-family:clearview_att_regular;font-size:16px;cursor:pointer;padding:13px 0;margin-right:30px;color:#fff}.megamenu-tabs .megamenu__item:hover{color:#BFE7FB;cursor:pointer}.megamenu-tabs .megamenu__item a{font-size:16px;color:#fff}position:relative .megamenu-tabs .megamenu__item a:focus:before{opacity:1}.lt-ie9 position:relative .megamenu-tabs .megamenu__item a:focus:before{content:''}.megamenu-tabs .megamenu__item.skip{text-align:left;text-indent:-9999px;color:transparent}.megamenu-tabs .megamenu__item.skip:focus{color:#fff;text-indent:0}.megamenu-tabs .megamenu__item.tabs__item--active{color:#fff}.megamenu-tabs .megamenu__item.tabs__item--active:after{height:0;width:0;border-color:transparent;border-style:solid;border-width:10px;border-bottom-color:#fff;-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;transition:all .2s ease-out;content:'';margin-left:12px;z-index:1;position:absolute;top:35px}.lt-ie9 .megamenu-tabs .megamenu__item.tabs__item--active:after{content:' '}.submenu-tabs{background-color:#fff;position:absolute;width:100%;left:0;top:55px;z-index:999;border-bottom:solid 1px #ddd}.submenu-tabs .megamenu__item{width:auto;height:100%;-webkit-transition:color .15s ease-in-out;-moz-transition:color .15s ease-in-out;transition:color .15s ease-in-out;color:#666;border-bottom:3px solid transparent;margin-right:40px;font-family:clearview_att_regular;font-size:16px;cursor:pointer;padding:14px 0 10px}.submenu-tabs .megamenu__item:hover{color:#444;cursor:pointer;font-family:Arial}.submenu-tabs .megamenu__item a{font-size:16px;color:#000;position:relative}.submenu-tabs .megamenu__item a:focus:before{opacity:1}.lt-ie9 .submenu-tabs .megamenu__item a:focus:before{content:''}.submenu-tabs .megamenu__item.tabs__item--active{color:#fff;font-family:clearview_att_regular}.submenu-tabs .megamenu__item.tabs__item--active:after,.submenu-tabs .megamenu__item.tabs__item--active:before{display:none}.lt-ie9 .submenu-tabs .megamenu__item.tabs__item--active:after{content:' '}.submenu-tabs .sub__menu{position:absolute;z-index:999;left:0;width:100%;top:50px;background-color:#fff}.submenu-tabs .sub__menu .tabsbid__item{display:inline-block;vertical-align:baseline;zoom:1;*display:inline;*vertical-align:auto;width:auto;float:left;margin:20px 0 0;padding-right:20px}.submenu-tabs .sub__menu .tabsbid__item .links-list__item{border:0;color:#000;font-size:12px;font-family:clearview_att_regular}.submenu-tabs .sub__menu .tabsbid__item .links-list__item:hover{color:#199ddf;border:0}.submenu-tabs .sub__menu .tabsbid__item .title{font-family:Arial;font-size:14px}.ie .submenu-tabs .sub__menu{top:51px}.subMenuHover{font-family:Arial!important;color:#444!important;border-bottom:3px solid #067ab4!important;cursor:pointer!important}.skiptoBody{position:absolute;top:-1000px;left:-1000px;height:1px;width:1px;text-align:left;overflow:hidden}a.skiptoBody:focus{height:1px;width:1px;text-align:left;overflow:hidden} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/.gitignore b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/.gitignore
new file mode 100644
index 00000000..790a4b0b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/.gitignore
@@ -0,0 +1,4 @@
+_site
+.sass-cache
+*.scssc
+*.swp \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/LICENSE b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/LICENSE
new file mode 100644
index 00000000..18ab118e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Drifty (http://drifty.com/)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/bower.json b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/bower.json
new file mode 100644
index 00000000..9417a8e4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/bower.json
@@ -0,0 +1,31 @@
+{
+ "ignore": [
+ "**/.*",
+ "builder",
+ "node_modules",
+ "bower_components",
+ "test",
+ "tests"
+ ],
+ "version": "2.0.0",
+ "name": "Ionicons",
+ "license": "MIT",
+ "authors": [
+ "Ben Sperry <ben@drifty.com>",
+ "Adam Bradley <adam@drifty.com>",
+ "Max Lynch <max@drifty.com>"
+ ],
+ "keywords": [
+ "fonts",
+ "icon font",
+ "icons",
+ "ionic",
+ "web font"
+ ],
+ "main": [
+ "css/ionicons.css",
+ "fonts/*"
+ ],
+ "homepage": "https://github.com/driftyco/ionicons",
+ "description": "Ionicons - free and beautiful icons from the creators of Ionic Framework"
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/component.json b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/component.json
new file mode 100644
index 00000000..5f4f5445
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/component.json
@@ -0,0 +1,19 @@
+{
+ "repo": "driftyco/ionicons",
+ "development": {},
+ "version": "2.0.0",
+ "styles": [
+ "css/ionicons.css"
+ ],
+ "name": "Ionicons",
+ "dependencies": {},
+ "keywords": [],
+ "license": "MIT",
+ "fonts": [
+ "fonts/ionicons.eot",
+ "fonts/ionicons.svg",
+ "fonts/ionicons.ttf",
+ "fonts/ionicons.woff"
+ ],
+ "description": "The premium icon font for Ionic Framework."
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/composer.json b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/composer.json
new file mode 100644
index 00000000..1161e9ff
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/composer.json
@@ -0,0 +1,36 @@
+{
+ "name": "driftyco/ionicons",
+ "license": [
+ "MIT"
+ ],
+ "extra": {},
+ "authors": [
+ {
+ "homepage": "https://twitter.com/benjsperry",
+ "role": "Designer",
+ "name": "Ben Sperry",
+ "email": "ben@drifty.com"
+ },
+ {
+ "homepage": "https://twitter.com/adamdbradley",
+ "role": "Developer",
+ "name": "Adam Bradley",
+ "email": "adam@drifty.com"
+ },
+ {
+ "homepage": "https://twitter.com/maxlynch",
+ "role": "Developer",
+ "name": "Max Lynch",
+ "email": "max@drifty.com"
+ }
+ ],
+ "keywords": [
+ "fonts",
+ "icon font",
+ "icons",
+ "ionic",
+ "web font"
+ ],
+ "homepage": "http://ionicons.com/",
+ "description": "The premium icon font for Ionic Framework."
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/css/ionicons.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/css/ionicons.css
new file mode 100644
index 00000000..885aa6bd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/css/ionicons.css
@@ -0,0 +1,1480 @@
+@charset "UTF-8";
+/*!
+ Ionicons, v2.0.0
+ Created by Ben Sperry for the Ionic Framework, http://ionicons.com/
+ https://twitter.com/benjsperry https://twitter.com/ionicframework
+ MIT License: https://github.com/driftyco/ionicons
+
+ Android-style icons originally built by Google’s
+ Material Design Icons: https://github.com/google/material-design-icons
+ used under CC BY http://creativecommons.org/licenses/by/4.0/
+ Modified icons to fit ionicon’s grid from original.
+*/
+@font-face { font-family: "Ionicons"; src: url("../fonts/ionicons.eot?v=2.0.0"); src: url("../fonts/ionicons.eot?v=2.0.0#iefix") format("embedded-opentype"), url("../fonts/ionicons.ttf?v=2.0.0") format("truetype"), url("../fonts/ionicons.woff?v=2.0.0") format("woff"), url("../fonts/ionicons.svg?v=2.0.0#Ionicons") format("svg"); font-weight: normal; font-style: normal; }
+.ion, .ionicons, .ion-alert:before, .ion-alert-circled:before, .ion-android-add:before, .ion-android-add-circle:before, .ion-android-alarm-clock:before, .ion-android-alert:before, .ion-android-apps:before, .ion-android-archive:before, .ion-android-arrow-back:before, .ion-android-arrow-down:before, .ion-android-arrow-dropdown:before, .ion-android-arrow-dropdown-circle:before, .ion-android-arrow-dropleft:before, .ion-android-arrow-dropleft-circle:before, .ion-android-arrow-dropright:before, .ion-android-arrow-dropright-circle:before, .ion-android-arrow-dropup:before, .ion-android-arrow-dropup-circle:before, .ion-android-arrow-forward:before, .ion-android-arrow-up:before, .ion-android-attach:before, .ion-android-bar:before, .ion-android-bicycle:before, .ion-android-boat:before, .ion-android-bookmark:before, .ion-android-bulb:before, .ion-android-bus:before, .ion-android-calendar:before, .ion-android-call:before, .ion-android-camera:before, .ion-android-cancel:before, .ion-android-car:before, .ion-android-cart:before, .ion-android-chat:before, .ion-android-checkbox:before, .ion-android-checkbox-blank:before, .ion-android-checkbox-outline:before, .ion-android-checkbox-outline-blank:before, .ion-android-checkmark-circle:before, .ion-android-clipboard:before, .ion-android-close:before, .ion-android-cloud:before, .ion-android-cloud-circle:before, .ion-android-cloud-done:before, .ion-android-cloud-outline:before, .ion-android-color-palette:before, .ion-android-compass:before, .ion-android-contact:before, .ion-android-contacts:before, .ion-android-contract:before, .ion-android-create:before, .ion-android-delete:before, .ion-android-desktop:before, .ion-android-document:before, .ion-android-done:before, .ion-android-done-all:before, .ion-android-download:before, .ion-android-drafts:before, .ion-android-exit:before, .ion-android-expand:before, .ion-android-favorite:before, .ion-android-favorite-outline:before, .ion-android-film:before, .ion-android-folder:before, .ion-android-folder-open:before, .ion-android-funnel:before, .ion-android-globe:before, .ion-android-hand:before, .ion-android-hangout:before, .ion-android-happy:before, .ion-android-home:before, .ion-android-image:before, .ion-android-laptop:before, .ion-android-list:before, .ion-android-locate:before, .ion-android-lock:before, .ion-android-mail:before, .ion-android-map:before, .ion-android-menu:before, .ion-android-microphone:before, .ion-android-microphone-off:before, .ion-android-more-horizontal:before, .ion-android-more-vertical:before, .ion-android-navigate:before, .ion-android-notifications:before, .ion-android-notifications-none:before, .ion-android-notifications-off:before, .ion-android-open:before, .ion-android-options:before, .ion-android-people:before, .ion-android-person:before, .ion-android-person-add:before, .ion-android-phone-landscape:before, .ion-android-phone-portrait:before, .ion-android-pin:before, .ion-android-plane:before, .ion-android-playstore:before, .ion-android-print:before, .ion-android-radio-button-off:before, .ion-android-radio-button-on:before, .ion-android-refresh:before, .ion-android-remove:before, .ion-android-remove-circle:before, .ion-android-restaurant:before, .ion-android-sad:before, .ion-android-search:before, .ion-android-send:before, .ion-android-settings:before, .ion-android-share:before, .ion-android-share-alt:before, .ion-android-star:before, .ion-android-star-half:before, .ion-android-star-outline:before, .ion-android-stopwatch:before, .ion-android-subway:before, .ion-android-sunny:before, .ion-android-sync:before, .ion-android-textsms:before, .ion-android-time:before, .ion-android-train:before, .ion-android-unlock:before, .ion-android-upload:before, .ion-android-volume-down:before, .ion-android-volume-mute:before, .ion-android-volume-off:before, .ion-android-volume-up:before, .ion-android-walk:before, .ion-android-warning:before, .ion-android-watch:before, .ion-android-wifi:before, .ion-aperture:before, .ion-archive:before, .ion-arrow-down-a:before, .ion-arrow-down-b:before, .ion-arrow-down-c:before, .ion-arrow-expand:before, .ion-arrow-graph-down-left:before, .ion-arrow-graph-down-right:before, .ion-arrow-graph-up-left:before, .ion-arrow-graph-up-right:before, .ion-arrow-left-a:before, .ion-arrow-left-b:before, .ion-arrow-left-c:before, .ion-arrow-move:before, .ion-arrow-resize:before, .ion-arrow-return-left:before, .ion-arrow-return-right:before, .ion-arrow-right-a:before, .ion-arrow-right-b:before, .ion-arrow-right-c:before, .ion-arrow-shrink:before, .ion-arrow-swap:before, .ion-arrow-up-a:before, .ion-arrow-up-b:before, .ion-arrow-up-c:before, .ion-asterisk:before, .ion-at:before, .ion-backspace:before, .ion-backspace-outline:before, .ion-bag:before, .ion-battery-charging:before, .ion-battery-empty:before, .ion-battery-full:before, .ion-battery-half:before, .ion-battery-low:before, .ion-beaker:before, .ion-beer:before, .ion-bluetooth:before, .ion-bonfire:before, .ion-bookmark:before, .ion-bowtie:before, .ion-briefcase:before, .ion-bug:before, .ion-calculator:before, .ion-calendar:before, .ion-camera:before, .ion-card:before, .ion-cash:before, .ion-chatbox:before, .ion-chatbox-working:before, .ion-chatboxes:before, .ion-chatbubble:before, .ion-chatbubble-working:before, .ion-chatbubbles:before, .ion-checkmark:before, .ion-checkmark-circled:before, .ion-checkmark-round:before, .ion-chevron-down:before, .ion-chevron-left:before, .ion-chevron-right:before, .ion-chevron-up:before, .ion-clipboard:before, .ion-clock:before, .ion-close:before, .ion-close-circled:before, .ion-close-round:before, .ion-closed-captioning:before, .ion-cloud:before, .ion-code:before, .ion-code-download:before, .ion-code-working:before, .ion-coffee:before, .ion-compass:before, .ion-compose:before, .ion-connection-bars:before, .ion-contrast:before, .ion-crop:before, .ion-cube:before, .ion-disc:before, .ion-document:before, .ion-document-text:before, .ion-drag:before, .ion-earth:before, .ion-easel:before, .ion-edit:before, .ion-egg:before, .ion-eject:before, .ion-email:before, .ion-email-unread:before, .ion-erlenmeyer-flask:before, .ion-erlenmeyer-flask-bubbles:before, .ion-eye:before, .ion-eye-disabled:before, .ion-female:before, .ion-filing:before, .ion-film-marker:before, .ion-fireball:before, .ion-flag:before, .ion-flame:before, .ion-flash:before, .ion-flash-off:before, .ion-folder:before, .ion-fork:before, .ion-fork-repo:before, .ion-forward:before, .ion-funnel:before, .ion-gear-a:before, .ion-gear-b:before, .ion-grid:before, .ion-hammer:before, .ion-happy:before, .ion-happy-outline:before, .ion-headphone:before, .ion-heart:before, .ion-heart-broken:before, .ion-help:before, .ion-help-buoy:before, .ion-help-circled:before, .ion-home:before, .ion-icecream:before, .ion-image:before, .ion-images:before, .ion-information:before, .ion-information-circled:before, .ion-ionic:before, .ion-ios-alarm:before, .ion-ios-alarm-outline:before, .ion-ios-albums:before, .ion-ios-albums-outline:before, .ion-ios-americanfootball:before, .ion-ios-americanfootball-outline:before, .ion-ios-analytics:before, .ion-ios-analytics-outline:before, .ion-ios-arrow-back:before, .ion-ios-arrow-down:before, .ion-ios-arrow-forward:before, .ion-ios-arrow-left:before, .ion-ios-arrow-right:before, .ion-ios-arrow-thin-down:before, .ion-ios-arrow-thin-left:before, .ion-ios-arrow-thin-right:before, .ion-ios-arrow-thin-up:before, .ion-ios-arrow-up:before, .ion-ios-at:before, .ion-ios-at-outline:before, .ion-ios-barcode:before, .ion-ios-barcode-outline:before, .ion-ios-baseball:before, .ion-ios-baseball-outline:before, .ion-ios-basketball:before, .ion-ios-basketball-outline:before, .ion-ios-bell:before, .ion-ios-bell-outline:before, .ion-ios-body:before, .ion-ios-body-outline:before, .ion-ios-bolt:before, .ion-ios-bolt-outline:before, .ion-ios-book:before, .ion-ios-book-outline:before, .ion-ios-bookmarks:before, .ion-ios-bookmarks-outline:before, .ion-ios-box:before, .ion-ios-box-outline:before, .ion-ios-briefcase:before, .ion-ios-briefcase-outline:before, .ion-ios-browsers:before, .ion-ios-browsers-outline:before, .ion-ios-calculator:before, .ion-ios-calculator-outline:before, .ion-ios-calendar:before, .ion-ios-calendar-outline:before, .ion-ios-camera:before, .ion-ios-camera-outline:before, .ion-ios-cart:before, .ion-ios-cart-outline:before, .ion-ios-chatboxes:before, .ion-ios-chatboxes-outline:before, .ion-ios-chatbubble:before, .ion-ios-chatbubble-outline:before, .ion-ios-checkmark:before, .ion-ios-checkmark-empty:before, .ion-ios-checkmark-outline:before, .ion-ios-circle-filled:before, .ion-ios-circle-outline:before, .ion-ios-clock:before, .ion-ios-clock-outline:before, .ion-ios-close:before, .ion-ios-close-empty:before, .ion-ios-close-outline:before, .ion-ios-cloud:before, .ion-ios-cloud-download:before, .ion-ios-cloud-download-outline:before, .ion-ios-cloud-outline:before, .ion-ios-cloud-upload:before, .ion-ios-cloud-upload-outline:before, .ion-ios-cloudy:before, .ion-ios-cloudy-night:before, .ion-ios-cloudy-night-outline:before, .ion-ios-cloudy-outline:before, .ion-ios-cog:before, .ion-ios-cog-outline:before, .ion-ios-color-filter:before, .ion-ios-color-filter-outline:before, .ion-ios-color-wand:before, .ion-ios-color-wand-outline:before, .ion-ios-compose:before, .ion-ios-compose-outline:before, .ion-ios-contact:before, .ion-ios-contact-outline:before, .ion-ios-copy:before, .ion-ios-copy-outline:before, .ion-ios-crop:before, .ion-ios-crop-strong:before, .ion-ios-download:before, .ion-ios-download-outline:before, .ion-ios-drag:before, .ion-ios-email:before, .ion-ios-email-outline:before, .ion-ios-eye:before, .ion-ios-eye-outline:before, .ion-ios-fastforward:before, .ion-ios-fastforward-outline:before, .ion-ios-filing:before, .ion-ios-filing-outline:before, .ion-ios-film:before, .ion-ios-film-outline:before, .ion-ios-flag:before, .ion-ios-flag-outline:before, .ion-ios-flame:before, .ion-ios-flame-outline:before, .ion-ios-flask:before, .ion-ios-flask-outline:before, .ion-ios-flower:before, .ion-ios-flower-outline:before, .ion-ios-folder:before, .ion-ios-folder-outline:before, .ion-ios-football:before, .ion-ios-football-outline:before, .ion-ios-game-controller-a:before, .ion-ios-game-controller-a-outline:before, .ion-ios-game-controller-b:before, .ion-ios-game-controller-b-outline:before, .ion-ios-gear:before, .ion-ios-gear-outline:before, .ion-ios-glasses:before, .ion-ios-glasses-outline:before, .ion-ios-grid-view:before, .ion-ios-grid-view-outline:before, .ion-ios-heart:before, .ion-ios-heart-outline:before, .ion-ios-help:before, .ion-ios-help-empty:before, .ion-ios-help-outline:before, .ion-ios-home:before, .ion-ios-home-outline:before, .ion-ios-infinite:before, .ion-ios-infinite-outline:before, .ion-ios-information:before, .ion-ios-information-empty:before, .ion-ios-information-outline:before, .ion-ios-ionic-outline:before, .ion-ios-keypad:before, .ion-ios-keypad-outline:before, .ion-ios-lightbulb:before, .ion-ios-lightbulb-outline:before, .ion-ios-list:before, .ion-ios-list-outline:before, .ion-ios-location:before, .ion-ios-location-outline:before, .ion-ios-locked:before, .ion-ios-locked-outline:before, .ion-ios-loop:before, .ion-ios-loop-strong:before, .ion-ios-medical:before, .ion-ios-medical-outline:before, .ion-ios-medkit:before, .ion-ios-medkit-outline:before, .ion-ios-mic:before, .ion-ios-mic-off:before, .ion-ios-mic-outline:before, .ion-ios-minus:before, .ion-ios-minus-empty:before, .ion-ios-minus-outline:before, .ion-ios-monitor:before, .ion-ios-monitor-outline:before, .ion-ios-moon:before, .ion-ios-moon-outline:before, .ion-ios-more:before, .ion-ios-more-outline:before, .ion-ios-musical-note:before, .ion-ios-musical-notes:before, .ion-ios-navigate:before, .ion-ios-navigate-outline:before, .ion-ios-nutrition:before, .ion-ios-nutrition-outline:before, .ion-ios-paper:before, .ion-ios-paper-outline:before, .ion-ios-paperplane:before, .ion-ios-paperplane-outline:before, .ion-ios-partlysunny:before, .ion-ios-partlysunny-outline:before, .ion-ios-pause:before, .ion-ios-pause-outline:before, .ion-ios-paw:before, .ion-ios-paw-outline:before, .ion-ios-people:before, .ion-ios-people-outline:before, .ion-ios-person:before, .ion-ios-person-outline:before, .ion-ios-personadd:before, .ion-ios-personadd-outline:before, .ion-ios-photos:before, .ion-ios-photos-outline:before, .ion-ios-pie:before, .ion-ios-pie-outline:before, .ion-ios-pint:before, .ion-ios-pint-outline:before, .ion-ios-play:before, .ion-ios-play-outline:before, .ion-ios-plus:before, .ion-ios-plus-empty:before, .ion-ios-plus-outline:before, .ion-ios-pricetag:before, .ion-ios-pricetag-outline:before, .ion-ios-pricetags:before, .ion-ios-pricetags-outline:before, .ion-ios-printer:before, .ion-ios-printer-outline:before, .ion-ios-pulse:before, .ion-ios-pulse-strong:before, .ion-ios-rainy:before, .ion-ios-rainy-outline:before, .ion-ios-recording:before, .ion-ios-recording-outline:before, .ion-ios-redo:before, .ion-ios-redo-outline:before, .ion-ios-refresh:before, .ion-ios-refresh-empty:before, .ion-ios-refresh-outline:before, .ion-ios-reload:before, .ion-ios-reverse-camera:before, .ion-ios-reverse-camera-outline:before, .ion-ios-rewind:before, .ion-ios-rewind-outline:before, .ion-ios-rose:before, .ion-ios-rose-outline:before, .ion-ios-search:before, .ion-ios-search-strong:before, .ion-ios-settings:before, .ion-ios-settings-strong:before, .ion-ios-shuffle:before, .ion-ios-shuffle-strong:before, .ion-ios-skipbackward:before, .ion-ios-skipbackward-outline:before, .ion-ios-skipforward:before, .ion-ios-skipforward-outline:before, .ion-ios-snowy:before, .ion-ios-speedometer:before, .ion-ios-speedometer-outline:before, .ion-ios-star:before, .ion-ios-star-half:before, .ion-ios-star-outline:before, .ion-ios-stopwatch:before, .ion-ios-stopwatch-outline:before, .ion-ios-sunny:before, .ion-ios-sunny-outline:before, .ion-ios-telephone:before, .ion-ios-telephone-outline:before, .ion-ios-tennisball:before, .ion-ios-tennisball-outline:before, .ion-ios-thunderstorm:before, .ion-ios-thunderstorm-outline:before, .ion-ios-time:before, .ion-ios-time-outline:before, .ion-ios-timer:before, .ion-ios-timer-outline:before, .ion-ios-toggle:before, .ion-ios-toggle-outline:before, .ion-ios-trash:before, .ion-ios-trash-outline:before, .ion-ios-undo:before, .ion-ios-undo-outline:before, .ion-ios-unlocked:before, .ion-ios-unlocked-outline:before, .ion-ios-upload:before, .ion-ios-upload-outline:before, .ion-ios-videocam:before, .ion-ios-videocam-outline:before, .ion-ios-volume-high:before, .ion-ios-volume-low:before, .ion-ios-wineglass:before, .ion-ios-wineglass-outline:before, .ion-ios-world:before, .ion-ios-world-outline:before, .ion-ipad:before, .ion-iphone:before, .ion-ipod:before, .ion-jet:before, .ion-key:before, .ion-knife:before, .ion-laptop:before, .ion-leaf:before, .ion-levels:before, .ion-lightbulb:before, .ion-link:before, .ion-load-a:before, .ion-load-b:before, .ion-load-c:before, .ion-load-d:before, .ion-location:before, .ion-lock-combination:before, .ion-locked:before, .ion-log-in:before, .ion-log-out:before, .ion-loop:before, .ion-magnet:before, .ion-male:before, .ion-man:before, .ion-map:before, .ion-medkit:before, .ion-merge:before, .ion-mic-a:before, .ion-mic-b:before, .ion-mic-c:before, .ion-minus:before, .ion-minus-circled:before, .ion-minus-round:before, .ion-model-s:before, .ion-monitor:before, .ion-more:before, .ion-mouse:before, .ion-music-note:before, .ion-navicon:before, .ion-navicon-round:before, .ion-navigate:before, .ion-network:before, .ion-no-smoking:before, .ion-nuclear:before, .ion-outlet:before, .ion-paintbrush:before, .ion-paintbucket:before, .ion-paper-airplane:before, .ion-paperclip:before, .ion-pause:before, .ion-person:before, .ion-person-add:before, .ion-person-stalker:before, .ion-pie-graph:before, .ion-pin:before, .ion-pinpoint:before, .ion-pizza:before, .ion-plane:before, .ion-planet:before, .ion-play:before, .ion-playstation:before, .ion-plus:before, .ion-plus-circled:before, .ion-plus-round:before, .ion-podium:before, .ion-pound:before, .ion-power:before, .ion-pricetag:before, .ion-pricetags:before, .ion-printer:before, .ion-pull-request:before, .ion-qr-scanner:before, .ion-quote:before, .ion-radio-waves:before, .ion-record:before, .ion-refresh:before, .ion-reply:before, .ion-reply-all:before, .ion-ribbon-a:before, .ion-ribbon-b:before, .ion-sad:before, .ion-sad-outline:before, .ion-scissors:before, .ion-search:before, .ion-settings:before, .ion-share:before, .ion-shuffle:before, .ion-skip-backward:before, .ion-skip-forward:before, .ion-social-android:before, .ion-social-android-outline:before, .ion-social-angular:before, .ion-social-angular-outline:before, .ion-social-apple:before, .ion-social-apple-outline:before, .ion-social-bitcoin:before, .ion-social-bitcoin-outline:before, .ion-social-buffer:before, .ion-social-buffer-outline:before, .ion-social-chrome:before, .ion-social-chrome-outline:before, .ion-social-codepen:before, .ion-social-codepen-outline:before, .ion-social-css3:before, .ion-social-css3-outline:before, .ion-social-designernews:before, .ion-social-designernews-outline:before, .ion-social-dribbble:before, .ion-social-dribbble-outline:before, .ion-social-dropbox:before, .ion-social-dropbox-outline:before, .ion-social-euro:before, .ion-social-euro-outline:before, .ion-social-facebook:before, .ion-social-facebook-outline:before, .ion-social-foursquare:before, .ion-social-foursquare-outline:before, .ion-social-freebsd-devil:before, .ion-social-github:before, .ion-social-github-outline:before, .ion-social-google:before, .ion-social-google-outline:before, .ion-social-googleplus:before, .ion-social-googleplus-outline:before, .ion-social-hackernews:before, .ion-social-hackernews-outline:before, .ion-social-html5:before, .ion-social-html5-outline:before, .ion-social-instagram:before, .ion-social-instagram-outline:before, .ion-social-javascript:before, .ion-social-javascript-outline:before, .ion-social-linkedin:before, .ion-social-linkedin-outline:before, .ion-social-markdown:before, .ion-social-nodejs:before, .ion-social-octocat:before, .ion-social-pinterest:before, .ion-social-pinterest-outline:before, .ion-social-python:before, .ion-social-reddit:before, .ion-social-reddit-outline:before, .ion-social-rss:before, .ion-social-rss-outline:before, .ion-social-sass:before, .ion-social-skype:before, .ion-social-skype-outline:before, .ion-social-snapchat:before, .ion-social-snapchat-outline:before, .ion-social-tumblr:before, .ion-social-tumblr-outline:before, .ion-social-tux:before, .ion-social-twitch:before, .ion-social-twitch-outline:before, .ion-social-twitter:before, .ion-social-twitter-outline:before, .ion-social-usd:before, .ion-social-usd-outline:before, .ion-social-vimeo:before, .ion-social-vimeo-outline:before, .ion-social-whatsapp:before, .ion-social-whatsapp-outline:before, .ion-social-windows:before, .ion-social-windows-outline:before, .ion-social-wordpress:before, .ion-social-wordpress-outline:before, .ion-social-yahoo:before, .ion-social-yahoo-outline:before, .ion-social-yen:before, .ion-social-yen-outline:before, .ion-social-youtube:before, .ion-social-youtube-outline:before, .ion-soup-can:before, .ion-soup-can-outline:before, .ion-speakerphone:before, .ion-speedometer:before, .ion-spoon:before, .ion-star:before, .ion-stats-bars:before, .ion-steam:before, .ion-stop:before, .ion-thermometer:before, .ion-thumbsdown:before, .ion-thumbsup:before, .ion-toggle:before, .ion-toggle-filled:before, .ion-transgender:before, .ion-trash-a:before, .ion-trash-b:before, .ion-trophy:before, .ion-tshirt:before, .ion-tshirt-outline:before, .ion-umbrella:before, .ion-university:before, .ion-unlocked:before, .ion-upload:before, .ion-usb:before, .ion-videocamera:before, .ion-volume-high:before, .ion-volume-low:before, .ion-volume-medium:before, .ion-volume-mute:before, .ion-wand:before, .ion-waterdrop:before, .ion-wifi:before, .ion-wineglass:before, .ion-woman:before, .ion-wrench:before, .ion-xbox:before { display: inline-block; font-family: "Ionicons"; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; text-rendering: auto; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
+
+.ion-alert:before { content: "\f101"; }
+
+.ion-alert-circled:before { content: "\f100"; }
+
+.ion-android-add:before { content: "\f2c7"; }
+
+.ion-android-add-circle:before { content: "\f359"; }
+
+.ion-android-alarm-clock:before { content: "\f35a"; }
+
+.ion-android-alert:before { content: "\f35b"; }
+
+.ion-android-apps:before { content: "\f35c"; }
+
+.ion-android-archive:before { content: "\f2c9"; }
+
+.ion-android-arrow-back:before { content: "\f2ca"; }
+
+.ion-android-arrow-down:before { content: "\f35d"; }
+
+.ion-android-arrow-dropdown:before { content: "\f35f"; }
+
+.ion-android-arrow-dropdown-circle:before { content: "\f35e"; }
+
+.ion-android-arrow-dropleft:before { content: "\f361"; }
+
+.ion-android-arrow-dropleft-circle:before { content: "\f360"; }
+
+.ion-android-arrow-dropright:before { content: "\f363"; }
+
+.ion-android-arrow-dropright-circle:before { content: "\f362"; }
+
+.ion-android-arrow-dropup:before { content: "\f365"; }
+
+.ion-android-arrow-dropup-circle:before { content: "\f364"; }
+
+.ion-android-arrow-forward:before { content: "\f30f"; }
+
+.ion-android-arrow-up:before { content: "\f366"; }
+
+.ion-android-attach:before { content: "\f367"; }
+
+.ion-android-bar:before { content: "\f368"; }
+
+.ion-android-bicycle:before { content: "\f369"; }
+
+.ion-android-boat:before { content: "\f36a"; }
+
+.ion-android-bookmark:before { content: "\f36b"; }
+
+.ion-android-bulb:before { content: "\f36c"; }
+
+.ion-android-bus:before { content: "\f36d"; }
+
+.ion-android-calendar:before { content: "\f2d1"; }
+
+.ion-android-call:before { content: "\f2d2"; }
+
+.ion-android-camera:before { content: "\f2d3"; }
+
+.ion-android-cancel:before { content: "\f36e"; }
+
+.ion-android-car:before { content: "\f36f"; }
+
+.ion-android-cart:before { content: "\f370"; }
+
+.ion-android-chat:before { content: "\f2d4"; }
+
+.ion-android-checkbox:before { content: "\f374"; }
+
+.ion-android-checkbox-blank:before { content: "\f371"; }
+
+.ion-android-checkbox-outline:before { content: "\f373"; }
+
+.ion-android-checkbox-outline-blank:before { content: "\f372"; }
+
+.ion-android-checkmark-circle:before { content: "\f375"; }
+
+.ion-android-clipboard:before { content: "\f376"; }
+
+.ion-android-close:before { content: "\f2d7"; }
+
+.ion-android-cloud:before { content: "\f37a"; }
+
+.ion-android-cloud-circle:before { content: "\f377"; }
+
+.ion-android-cloud-done:before { content: "\f378"; }
+
+.ion-android-cloud-outline:before { content: "\f379"; }
+
+.ion-android-color-palette:before { content: "\f37b"; }
+
+.ion-android-compass:before { content: "\f37c"; }
+
+.ion-android-contact:before { content: "\f2d8"; }
+
+.ion-android-contacts:before { content: "\f2d9"; }
+
+.ion-android-contract:before { content: "\f37d"; }
+
+.ion-android-create:before { content: "\f37e"; }
+
+.ion-android-delete:before { content: "\f37f"; }
+
+.ion-android-desktop:before { content: "\f380"; }
+
+.ion-android-document:before { content: "\f381"; }
+
+.ion-android-done:before { content: "\f383"; }
+
+.ion-android-done-all:before { content: "\f382"; }
+
+.ion-android-download:before { content: "\f2dd"; }
+
+.ion-android-drafts:before { content: "\f384"; }
+
+.ion-android-exit:before { content: "\f385"; }
+
+.ion-android-expand:before { content: "\f386"; }
+
+.ion-android-favorite:before { content: "\f388"; }
+
+.ion-android-favorite-outline:before { content: "\f387"; }
+
+.ion-android-film:before { content: "\f389"; }
+
+.ion-android-folder:before { content: "\f2e0"; }
+
+.ion-android-folder-open:before { content: "\f38a"; }
+
+.ion-android-funnel:before { content: "\f38b"; }
+
+.ion-android-globe:before { content: "\f38c"; }
+
+.ion-android-hand:before { content: "\f2e3"; }
+
+.ion-android-hangout:before { content: "\f38d"; }
+
+.ion-android-happy:before { content: "\f38e"; }
+
+.ion-android-home:before { content: "\f38f"; }
+
+.ion-android-image:before { content: "\f2e4"; }
+
+.ion-android-laptop:before { content: "\f390"; }
+
+.ion-android-list:before { content: "\f391"; }
+
+.ion-android-locate:before { content: "\f2e9"; }
+
+.ion-android-lock:before { content: "\f392"; }
+
+.ion-android-mail:before { content: "\f2eb"; }
+
+.ion-android-map:before { content: "\f393"; }
+
+.ion-android-menu:before { content: "\f394"; }
+
+.ion-android-microphone:before { content: "\f2ec"; }
+
+.ion-android-microphone-off:before { content: "\f395"; }
+
+.ion-android-more-horizontal:before { content: "\f396"; }
+
+.ion-android-more-vertical:before { content: "\f397"; }
+
+.ion-android-navigate:before { content: "\f398"; }
+
+.ion-android-notifications:before { content: "\f39b"; }
+
+.ion-android-notifications-none:before { content: "\f399"; }
+
+.ion-android-notifications-off:before { content: "\f39a"; }
+
+.ion-android-open:before { content: "\f39c"; }
+
+.ion-android-options:before { content: "\f39d"; }
+
+.ion-android-people:before { content: "\f39e"; }
+
+.ion-android-person:before { content: "\f3a0"; }
+
+.ion-android-person-add:before { content: "\f39f"; }
+
+.ion-android-phone-landscape:before { content: "\f3a1"; }
+
+.ion-android-phone-portrait:before { content: "\f3a2"; }
+
+.ion-android-pin:before { content: "\f3a3"; }
+
+.ion-android-plane:before { content: "\f3a4"; }
+
+.ion-android-playstore:before { content: "\f2f0"; }
+
+.ion-android-print:before { content: "\f3a5"; }
+
+.ion-android-radio-button-off:before { content: "\f3a6"; }
+
+.ion-android-radio-button-on:before { content: "\f3a7"; }
+
+.ion-android-refresh:before { content: "\f3a8"; }
+
+.ion-android-remove:before { content: "\f2f4"; }
+
+.ion-android-remove-circle:before { content: "\f3a9"; }
+
+.ion-android-restaurant:before { content: "\f3aa"; }
+
+.ion-android-sad:before { content: "\f3ab"; }
+
+.ion-android-search:before { content: "\f2f5"; }
+
+.ion-android-send:before { content: "\f2f6"; }
+
+.ion-android-settings:before { content: "\f2f7"; }
+
+.ion-android-share:before { content: "\f2f8"; }
+
+.ion-android-share-alt:before { content: "\f3ac"; }
+
+.ion-android-star:before { content: "\f2fc"; }
+
+.ion-android-star-half:before { content: "\f3ad"; }
+
+.ion-android-star-outline:before { content: "\f3ae"; }
+
+.ion-android-stopwatch:before { content: "\f2fd"; }
+
+.ion-android-subway:before { content: "\f3af"; }
+
+.ion-android-sunny:before { content: "\f3b0"; }
+
+.ion-android-sync:before { content: "\f3b1"; }
+
+.ion-android-textsms:before { content: "\f3b2"; }
+
+.ion-android-time:before { content: "\f3b3"; }
+
+.ion-android-train:before { content: "\f3b4"; }
+
+.ion-android-unlock:before { content: "\f3b5"; }
+
+.ion-android-upload:before { content: "\f3b6"; }
+
+.ion-android-volume-down:before { content: "\f3b7"; }
+
+.ion-android-volume-mute:before { content: "\f3b8"; }
+
+.ion-android-volume-off:before { content: "\f3b9"; }
+
+.ion-android-volume-up:before { content: "\f3ba"; }
+
+.ion-android-walk:before { content: "\f3bb"; }
+
+.ion-android-warning:before { content: "\f3bc"; }
+
+.ion-android-watch:before { content: "\f3bd"; }
+
+.ion-android-wifi:before { content: "\f305"; }
+
+.ion-aperture:before { content: "\f313"; }
+
+.ion-archive:before { content: "\f102"; }
+
+.ion-arrow-down-a:before { content: "\f103"; }
+
+.ion-arrow-down-b:before { content: "\f104"; }
+
+.ion-arrow-down-c:before { content: "\f105"; }
+
+.ion-arrow-expand:before { content: "\f25e"; }
+
+.ion-arrow-graph-down-left:before { content: "\f25f"; }
+
+.ion-arrow-graph-down-right:before { content: "\f260"; }
+
+.ion-arrow-graph-up-left:before { content: "\f261"; }
+
+.ion-arrow-graph-up-right:before { content: "\f262"; }
+
+.ion-arrow-left-a:before { content: "\f106"; }
+
+.ion-arrow-left-b:before { content: "\f107"; }
+
+.ion-arrow-left-c:before { content: "\f108"; }
+
+.ion-arrow-move:before { content: "\f263"; }
+
+.ion-arrow-resize:before { content: "\f264"; }
+
+.ion-arrow-return-left:before { content: "\f265"; }
+
+.ion-arrow-return-right:before { content: "\f266"; }
+
+.ion-arrow-right-a:before { content: "\f109"; }
+
+.ion-arrow-right-b:before { content: "\f10a"; }
+
+.ion-arrow-right-c:before { content: "\f10b"; }
+
+.ion-arrow-shrink:before { content: "\f267"; }
+
+.ion-arrow-swap:before { content: "\f268"; }
+
+.ion-arrow-up-a:before { content: "\f10c"; }
+
+.ion-arrow-up-b:before { content: "\f10d"; }
+
+.ion-arrow-up-c:before { content: "\f10e"; }
+
+.ion-asterisk:before { content: "\f314"; }
+
+.ion-at:before { content: "\f10f"; }
+
+.ion-backspace:before { content: "\f3bf"; }
+
+.ion-backspace-outline:before { content: "\f3be"; }
+
+.ion-bag:before { content: "\f110"; }
+
+.ion-battery-charging:before { content: "\f111"; }
+
+.ion-battery-empty:before { content: "\f112"; }
+
+.ion-battery-full:before { content: "\f113"; }
+
+.ion-battery-half:before { content: "\f114"; }
+
+.ion-battery-low:before { content: "\f115"; }
+
+.ion-beaker:before { content: "\f269"; }
+
+.ion-beer:before { content: "\f26a"; }
+
+.ion-bluetooth:before { content: "\f116"; }
+
+.ion-bonfire:before { content: "\f315"; }
+
+.ion-bookmark:before { content: "\f26b"; }
+
+.ion-bowtie:before { content: "\f3c0"; }
+
+.ion-briefcase:before { content: "\f26c"; }
+
+.ion-bug:before { content: "\f2be"; }
+
+.ion-calculator:before { content: "\f26d"; }
+
+.ion-calendar:before { content: "\f117"; }
+
+.ion-camera:before { content: "\f118"; }
+
+.ion-card:before { content: "\f119"; }
+
+.ion-cash:before { content: "\f316"; }
+
+.ion-chatbox:before { content: "\f11b"; }
+
+.ion-chatbox-working:before { content: "\f11a"; }
+
+.ion-chatboxes:before { content: "\f11c"; }
+
+.ion-chatbubble:before { content: "\f11e"; }
+
+.ion-chatbubble-working:before { content: "\f11d"; }
+
+.ion-chatbubbles:before { content: "\f11f"; }
+
+.ion-checkmark:before { content: "\f122"; }
+
+.ion-checkmark-circled:before { content: "\f120"; }
+
+.ion-checkmark-round:before { content: "\f121"; }
+
+.ion-chevron-down:before { content: "\f123"; }
+
+.ion-chevron-left:before { content: "\f124"; }
+
+.ion-chevron-right:before { content: "\f125"; }
+
+.ion-chevron-up:before { content: "\f126"; }
+
+.ion-clipboard:before { content: "\f127"; }
+
+.ion-clock:before { content: "\f26e"; }
+
+.ion-close:before { content: "\f12a"; }
+
+.ion-close-circled:before { content: "\f128"; }
+
+.ion-close-round:before { content: "\f129"; }
+
+.ion-closed-captioning:before { content: "\f317"; }
+
+.ion-cloud:before { content: "\f12b"; }
+
+.ion-code:before { content: "\f271"; }
+
+.ion-code-download:before { content: "\f26f"; }
+
+.ion-code-working:before { content: "\f270"; }
+
+.ion-coffee:before { content: "\f272"; }
+
+.ion-compass:before { content: "\f273"; }
+
+.ion-compose:before { content: "\f12c"; }
+
+.ion-connection-bars:before { content: "\f274"; }
+
+.ion-contrast:before { content: "\f275"; }
+
+.ion-crop:before { content: "\f3c1"; }
+
+.ion-cube:before { content: "\f318"; }
+
+.ion-disc:before { content: "\f12d"; }
+
+.ion-document:before { content: "\f12f"; }
+
+.ion-document-text:before { content: "\f12e"; }
+
+.ion-drag:before { content: "\f130"; }
+
+.ion-earth:before { content: "\f276"; }
+
+.ion-easel:before { content: "\f3c2"; }
+
+.ion-edit:before { content: "\f2bf"; }
+
+.ion-egg:before { content: "\f277"; }
+
+.ion-eject:before { content: "\f131"; }
+
+.ion-email:before { content: "\f132"; }
+
+.ion-email-unread:before { content: "\f3c3"; }
+
+.ion-erlenmeyer-flask:before { content: "\f3c5"; }
+
+.ion-erlenmeyer-flask-bubbles:before { content: "\f3c4"; }
+
+.ion-eye:before { content: "\f133"; }
+
+.ion-eye-disabled:before { content: "\f306"; }
+
+.ion-female:before { content: "\f278"; }
+
+.ion-filing:before { content: "\f134"; }
+
+.ion-film-marker:before { content: "\f135"; }
+
+.ion-fireball:before { content: "\f319"; }
+
+.ion-flag:before { content: "\f279"; }
+
+.ion-flame:before { content: "\f31a"; }
+
+.ion-flash:before { content: "\f137"; }
+
+.ion-flash-off:before { content: "\f136"; }
+
+.ion-folder:before { content: "\f139"; }
+
+.ion-fork:before { content: "\f27a"; }
+
+.ion-fork-repo:before { content: "\f2c0"; }
+
+.ion-forward:before { content: "\f13a"; }
+
+.ion-funnel:before { content: "\f31b"; }
+
+.ion-gear-a:before { content: "\f13d"; }
+
+.ion-gear-b:before { content: "\f13e"; }
+
+.ion-grid:before { content: "\f13f"; }
+
+.ion-hammer:before { content: "\f27b"; }
+
+.ion-happy:before { content: "\f31c"; }
+
+.ion-happy-outline:before { content: "\f3c6"; }
+
+.ion-headphone:before { content: "\f140"; }
+
+.ion-heart:before { content: "\f141"; }
+
+.ion-heart-broken:before { content: "\f31d"; }
+
+.ion-help:before { content: "\f143"; }
+
+.ion-help-buoy:before { content: "\f27c"; }
+
+.ion-help-circled:before { content: "\f142"; }
+
+.ion-home:before { content: "\f144"; }
+
+.ion-icecream:before { content: "\f27d"; }
+
+.ion-image:before { content: "\f147"; }
+
+.ion-images:before { content: "\f148"; }
+
+.ion-information:before { content: "\f14a"; }
+
+.ion-information-circled:before { content: "\f149"; }
+
+.ion-ionic:before { content: "\f14b"; }
+
+.ion-ios-alarm:before { content: "\f3c8"; }
+
+.ion-ios-alarm-outline:before { content: "\f3c7"; }
+
+.ion-ios-albums:before { content: "\f3ca"; }
+
+.ion-ios-albums-outline:before { content: "\f3c9"; }
+
+.ion-ios-americanfootball:before { content: "\f3cc"; }
+
+.ion-ios-americanfootball-outline:before { content: "\f3cb"; }
+
+.ion-ios-analytics:before { content: "\f3ce"; }
+
+.ion-ios-analytics-outline:before { content: "\f3cd"; }
+
+.ion-ios-arrow-back:before { content: "\f3cf"; }
+
+.ion-ios-arrow-down:before { content: "\f3d0"; }
+
+.ion-ios-arrow-forward:before { content: "\f3d1"; }
+
+.ion-ios-arrow-left:before { content: "\f3d2"; }
+
+.ion-ios-arrow-right:before { content: "\f3d3"; }
+
+.ion-ios-arrow-thin-down:before { content: "\f3d4"; }
+
+.ion-ios-arrow-thin-left:before { content: "\f3d5"; }
+
+.ion-ios-arrow-thin-right:before { content: "\f3d6"; }
+
+.ion-ios-arrow-thin-up:before { content: "\f3d7"; }
+
+.ion-ios-arrow-up:before { content: "\f3d8"; }
+
+.ion-ios-at:before { content: "\f3da"; }
+
+.ion-ios-at-outline:before { content: "\f3d9"; }
+
+.ion-ios-barcode:before { content: "\f3dc"; }
+
+.ion-ios-barcode-outline:before { content: "\f3db"; }
+
+.ion-ios-baseball:before { content: "\f3de"; }
+
+.ion-ios-baseball-outline:before { content: "\f3dd"; }
+
+.ion-ios-basketball:before { content: "\f3e0"; }
+
+.ion-ios-basketball-outline:before { content: "\f3df"; }
+
+.ion-ios-bell:before { content: "\f3e2"; }
+
+.ion-ios-bell-outline:before { content: "\f3e1"; }
+
+.ion-ios-body:before { content: "\f3e4"; }
+
+.ion-ios-body-outline:before { content: "\f3e3"; }
+
+.ion-ios-bolt:before { content: "\f3e6"; }
+
+.ion-ios-bolt-outline:before { content: "\f3e5"; }
+
+.ion-ios-book:before { content: "\f3e8"; }
+
+.ion-ios-book-outline:before { content: "\f3e7"; }
+
+.ion-ios-bookmarks:before { content: "\f3ea"; }
+
+.ion-ios-bookmarks-outline:before { content: "\f3e9"; }
+
+.ion-ios-box:before { content: "\f3ec"; }
+
+.ion-ios-box-outline:before { content: "\f3eb"; }
+
+.ion-ios-briefcase:before { content: "\f3ee"; }
+
+.ion-ios-briefcase-outline:before { content: "\f3ed"; }
+
+.ion-ios-browsers:before { content: "\f3f0"; }
+
+.ion-ios-browsers-outline:before { content: "\f3ef"; }
+
+.ion-ios-calculator:before { content: "\f3f2"; }
+
+.ion-ios-calculator-outline:before { content: "\f3f1"; }
+
+.ion-ios-calendar:before { content: "\f3f4"; }
+
+.ion-ios-calendar-outline:before { content: "\f3f3"; }
+
+.ion-ios-camera:before { content: "\f3f6"; }
+
+.ion-ios-camera-outline:before { content: "\f3f5"; }
+
+.ion-ios-cart:before { content: "\f3f8"; }
+
+.ion-ios-cart-outline:before { content: "\f3f7"; }
+
+.ion-ios-chatboxes:before { content: "\f3fa"; }
+
+.ion-ios-chatboxes-outline:before { content: "\f3f9"; }
+
+.ion-ios-chatbubble:before { content: "\f3fc"; }
+
+.ion-ios-chatbubble-outline:before { content: "\f3fb"; }
+
+.ion-ios-checkmark:before { content: "\f3ff"; }
+
+.ion-ios-checkmark-empty:before { content: "\f3fd"; }
+
+.ion-ios-checkmark-outline:before { content: "\f3fe"; }
+
+.ion-ios-circle-filled:before { content: "\f400"; }
+
+.ion-ios-circle-outline:before { content: "\f401"; }
+
+.ion-ios-clock:before { content: "\f403"; }
+
+.ion-ios-clock-outline:before { content: "\f402"; }
+
+.ion-ios-close:before { content: "\f406"; }
+
+.ion-ios-close-empty:before { content: "\f404"; }
+
+.ion-ios-close-outline:before { content: "\f405"; }
+
+.ion-ios-cloud:before { content: "\f40c"; }
+
+.ion-ios-cloud-download:before { content: "\f408"; }
+
+.ion-ios-cloud-download-outline:before { content: "\f407"; }
+
+.ion-ios-cloud-outline:before { content: "\f409"; }
+
+.ion-ios-cloud-upload:before { content: "\f40b"; }
+
+.ion-ios-cloud-upload-outline:before { content: "\f40a"; }
+
+.ion-ios-cloudy:before { content: "\f410"; }
+
+.ion-ios-cloudy-night:before { content: "\f40e"; }
+
+.ion-ios-cloudy-night-outline:before { content: "\f40d"; }
+
+.ion-ios-cloudy-outline:before { content: "\f40f"; }
+
+.ion-ios-cog:before { content: "\f412"; }
+
+.ion-ios-cog-outline:before { content: "\f411"; }
+
+.ion-ios-color-filter:before { content: "\f414"; }
+
+.ion-ios-color-filter-outline:before { content: "\f413"; }
+
+.ion-ios-color-wand:before { content: "\f416"; }
+
+.ion-ios-color-wand-outline:before { content: "\f415"; }
+
+.ion-ios-compose:before { content: "\f418"; }
+
+.ion-ios-compose-outline:before { content: "\f417"; }
+
+.ion-ios-contact:before { content: "\f41a"; }
+
+.ion-ios-contact-outline:before { content: "\f419"; }
+
+.ion-ios-copy:before { content: "\f41c"; }
+
+.ion-ios-copy-outline:before { content: "\f41b"; }
+
+.ion-ios-crop:before { content: "\f41e"; }
+
+.ion-ios-crop-strong:before { content: "\f41d"; }
+
+.ion-ios-download:before { content: "\f420"; }
+
+.ion-ios-download-outline:before { content: "\f41f"; }
+
+.ion-ios-drag:before { content: "\f421"; }
+
+.ion-ios-email:before { content: "\f423"; }
+
+.ion-ios-email-outline:before { content: "\f422"; }
+
+.ion-ios-eye:before { content: "\f425"; }
+
+.ion-ios-eye-outline:before { content: "\f424"; }
+
+.ion-ios-fastforward:before { content: "\f427"; }
+
+.ion-ios-fastforward-outline:before { content: "\f426"; }
+
+.ion-ios-filing:before { content: "\f429"; }
+
+.ion-ios-filing-outline:before { content: "\f428"; }
+
+.ion-ios-film:before { content: "\f42b"; }
+
+.ion-ios-film-outline:before { content: "\f42a"; }
+
+.ion-ios-flag:before { content: "\f42d"; }
+
+.ion-ios-flag-outline:before { content: "\f42c"; }
+
+.ion-ios-flame:before { content: "\f42f"; }
+
+.ion-ios-flame-outline:before { content: "\f42e"; }
+
+.ion-ios-flask:before { content: "\f431"; }
+
+.ion-ios-flask-outline:before { content: "\f430"; }
+
+.ion-ios-flower:before { content: "\f433"; }
+
+.ion-ios-flower-outline:before { content: "\f432"; }
+
+.ion-ios-folder:before { content: "\f435"; }
+
+.ion-ios-folder-outline:before { content: "\f434"; }
+
+.ion-ios-football:before { content: "\f437"; }
+
+.ion-ios-football-outline:before { content: "\f436"; }
+
+.ion-ios-game-controller-a:before { content: "\f439"; }
+
+.ion-ios-game-controller-a-outline:before { content: "\f438"; }
+
+.ion-ios-game-controller-b:before { content: "\f43b"; }
+
+.ion-ios-game-controller-b-outline:before { content: "\f43a"; }
+
+.ion-ios-gear:before { content: "\f43d"; }
+
+.ion-ios-gear-outline:before { content: "\f43c"; }
+
+.ion-ios-glasses:before { content: "\f43f"; }
+
+.ion-ios-glasses-outline:before { content: "\f43e"; }
+
+.ion-ios-grid-view:before { content: "\f441"; }
+
+.ion-ios-grid-view-outline:before { content: "\f440"; }
+
+.ion-ios-heart:before { content: "\f443"; }
+
+.ion-ios-heart-outline:before { content: "\f442"; }
+
+.ion-ios-help:before { content: "\f446"; }
+
+.ion-ios-help-empty:before { content: "\f444"; }
+
+.ion-ios-help-outline:before { content: "\f445"; }
+
+.ion-ios-home:before { content: "\f448"; }
+
+.ion-ios-home-outline:before { content: "\f447"; }
+
+.ion-ios-infinite:before { content: "\f44a"; }
+
+.ion-ios-infinite-outline:before { content: "\f449"; }
+
+.ion-ios-information:before { content: "\f44d"; }
+
+.ion-ios-information-empty:before { content: "\f44b"; }
+
+.ion-ios-information-outline:before { content: "\f44c"; }
+
+.ion-ios-ionic-outline:before { content: "\f44e"; }
+
+.ion-ios-keypad:before { content: "\f450"; }
+
+.ion-ios-keypad-outline:before { content: "\f44f"; }
+
+.ion-ios-lightbulb:before { content: "\f452"; }
+
+.ion-ios-lightbulb-outline:before { content: "\f451"; }
+
+.ion-ios-list:before { content: "\f454"; }
+
+.ion-ios-list-outline:before { content: "\f453"; }
+
+.ion-ios-location:before { content: "\f456"; }
+
+.ion-ios-location-outline:before { content: "\f455"; }
+
+.ion-ios-locked:before { content: "\f458"; }
+
+.ion-ios-locked-outline:before { content: "\f457"; }
+
+.ion-ios-loop:before { content: "\f45a"; }
+
+.ion-ios-loop-strong:before { content: "\f459"; }
+
+.ion-ios-medical:before { content: "\f45c"; }
+
+.ion-ios-medical-outline:before { content: "\f45b"; }
+
+.ion-ios-medkit:before { content: "\f45e"; }
+
+.ion-ios-medkit-outline:before { content: "\f45d"; }
+
+.ion-ios-mic:before { content: "\f461"; }
+
+.ion-ios-mic-off:before { content: "\f45f"; }
+
+.ion-ios-mic-outline:before { content: "\f460"; }
+
+.ion-ios-minus:before { content: "\f464"; }
+
+.ion-ios-minus-empty:before { content: "\f462"; }
+
+.ion-ios-minus-outline:before { content: "\f463"; }
+
+.ion-ios-monitor:before { content: "\f466"; }
+
+.ion-ios-monitor-outline:before { content: "\f465"; }
+
+.ion-ios-moon:before { content: "\f468"; }
+
+.ion-ios-moon-outline:before { content: "\f467"; }
+
+.ion-ios-more:before { content: "\f46a"; }
+
+.ion-ios-more-outline:before { content: "\f469"; }
+
+.ion-ios-musical-note:before { content: "\f46b"; }
+
+.ion-ios-musical-notes:before { content: "\f46c"; }
+
+.ion-ios-navigate:before { content: "\f46e"; }
+
+.ion-ios-navigate-outline:before { content: "\f46d"; }
+
+.ion-ios-nutrition:before { content: "\f470"; }
+
+.ion-ios-nutrition-outline:before { content: "\f46f"; }
+
+.ion-ios-paper:before { content: "\f472"; }
+
+.ion-ios-paper-outline:before { content: "\f471"; }
+
+.ion-ios-paperplane:before { content: "\f474"; }
+
+.ion-ios-paperplane-outline:before { content: "\f473"; }
+
+.ion-ios-partlysunny:before { content: "\f476"; }
+
+.ion-ios-partlysunny-outline:before { content: "\f475"; }
+
+.ion-ios-pause:before { content: "\f478"; }
+
+.ion-ios-pause-outline:before { content: "\f477"; }
+
+.ion-ios-paw:before { content: "\f47a"; }
+
+.ion-ios-paw-outline:before { content: "\f479"; }
+
+.ion-ios-people:before { content: "\f47c"; }
+
+.ion-ios-people-outline:before { content: "\f47b"; }
+
+.ion-ios-person:before { content: "\f47e"; }
+
+.ion-ios-person-outline:before { content: "\f47d"; }
+
+.ion-ios-personadd:before { content: "\f480"; }
+
+.ion-ios-personadd-outline:before { content: "\f47f"; }
+
+.ion-ios-photos:before { content: "\f482"; }
+
+.ion-ios-photos-outline:before { content: "\f481"; }
+
+.ion-ios-pie:before { content: "\f484"; }
+
+.ion-ios-pie-outline:before { content: "\f483"; }
+
+.ion-ios-pint:before { content: "\f486"; }
+
+.ion-ios-pint-outline:before { content: "\f485"; }
+
+.ion-ios-play:before { content: "\f488"; }
+
+.ion-ios-play-outline:before { content: "\f487"; }
+
+.ion-ios-plus:before { content: "\f48b"; }
+
+.ion-ios-plus-empty:before { content: "\f489"; }
+
+.ion-ios-plus-outline:before { content: "\f48a"; }
+
+.ion-ios-pricetag:before { content: "\f48d"; }
+
+.ion-ios-pricetag-outline:before { content: "\f48c"; }
+
+.ion-ios-pricetags:before { content: "\f48f"; }
+
+.ion-ios-pricetags-outline:before { content: "\f48e"; }
+
+.ion-ios-printer:before { content: "\f491"; }
+
+.ion-ios-printer-outline:before { content: "\f490"; }
+
+.ion-ios-pulse:before { content: "\f493"; }
+
+.ion-ios-pulse-strong:before { content: "\f492"; }
+
+.ion-ios-rainy:before { content: "\f495"; }
+
+.ion-ios-rainy-outline:before { content: "\f494"; }
+
+.ion-ios-recording:before { content: "\f497"; }
+
+.ion-ios-recording-outline:before { content: "\f496"; }
+
+.ion-ios-redo:before { content: "\f499"; }
+
+.ion-ios-redo-outline:before { content: "\f498"; }
+
+.ion-ios-refresh:before { content: "\f49c"; }
+
+.ion-ios-refresh-empty:before { content: "\f49a"; }
+
+.ion-ios-refresh-outline:before { content: "\f49b"; }
+
+.ion-ios-reload:before { content: "\f49d"; }
+
+.ion-ios-reverse-camera:before { content: "\f49f"; }
+
+.ion-ios-reverse-camera-outline:before { content: "\f49e"; }
+
+.ion-ios-rewind:before { content: "\f4a1"; }
+
+.ion-ios-rewind-outline:before { content: "\f4a0"; }
+
+.ion-ios-rose:before { content: "\f4a3"; }
+
+.ion-ios-rose-outline:before { content: "\f4a2"; }
+
+.ion-ios-search:before { content: "\f4a5"; }
+
+.ion-ios-search-strong:before { content: "\f4a4"; }
+
+.ion-ios-settings:before { content: "\f4a7"; }
+
+.ion-ios-settings-strong:before { content: "\f4a6"; }
+
+.ion-ios-shuffle:before { content: "\f4a9"; }
+
+.ion-ios-shuffle-strong:before { content: "\f4a8"; }
+
+.ion-ios-skipbackward:before { content: "\f4ab"; }
+
+.ion-ios-skipbackward-outline:before { content: "\f4aa"; }
+
+.ion-ios-skipforward:before { content: "\f4ad"; }
+
+.ion-ios-skipforward-outline:before { content: "\f4ac"; }
+
+.ion-ios-snowy:before { content: "\f4ae"; }
+
+.ion-ios-speedometer:before { content: "\f4b0"; }
+
+.ion-ios-speedometer-outline:before { content: "\f4af"; }
+
+.ion-ios-star:before { content: "\f4b3"; }
+
+.ion-ios-star-half:before { content: "\f4b1"; }
+
+.ion-ios-star-outline:before { content: "\f4b2"; }
+
+.ion-ios-stopwatch:before { content: "\f4b5"; }
+
+.ion-ios-stopwatch-outline:before { content: "\f4b4"; }
+
+.ion-ios-sunny:before { content: "\f4b7"; }
+
+.ion-ios-sunny-outline:before { content: "\f4b6"; }
+
+.ion-ios-telephone:before { content: "\f4b9"; }
+
+.ion-ios-telephone-outline:before { content: "\f4b8"; }
+
+.ion-ios-tennisball:before { content: "\f4bb"; }
+
+.ion-ios-tennisball-outline:before { content: "\f4ba"; }
+
+.ion-ios-thunderstorm:before { content: "\f4bd"; }
+
+.ion-ios-thunderstorm-outline:before { content: "\f4bc"; }
+
+.ion-ios-time:before { content: "\f4bf"; }
+
+.ion-ios-time-outline:before { content: "\f4be"; }
+
+.ion-ios-timer:before { content: "\f4c1"; }
+
+.ion-ios-timer-outline:before { content: "\f4c0"; }
+
+.ion-ios-toggle:before { content: "\f4c3"; }
+
+.ion-ios-toggle-outline:before { content: "\f4c2"; }
+
+.ion-ios-trash:before { content: "\f4c5"; }
+
+.ion-ios-trash-outline:before { content: "\f4c4"; }
+
+.ion-ios-undo:before { content: "\f4c7"; }
+
+.ion-ios-undo-outline:before { content: "\f4c6"; }
+
+.ion-ios-unlocked:before { content: "\f4c9"; }
+
+.ion-ios-unlocked-outline:before { content: "\f4c8"; }
+
+.ion-ios-upload:before { content: "\f4cb"; }
+
+.ion-ios-upload-outline:before { content: "\f4ca"; }
+
+.ion-ios-videocam:before { content: "\f4cd"; }
+
+.ion-ios-videocam-outline:before { content: "\f4cc"; }
+
+.ion-ios-volume-high:before { content: "\f4ce"; }
+
+.ion-ios-volume-low:before { content: "\f4cf"; }
+
+.ion-ios-wineglass:before { content: "\f4d1"; }
+
+.ion-ios-wineglass-outline:before { content: "\f4d0"; }
+
+.ion-ios-world:before { content: "\f4d3"; }
+
+.ion-ios-world-outline:before { content: "\f4d2"; }
+
+.ion-ipad:before { content: "\f1f9"; }
+
+.ion-iphone:before { content: "\f1fa"; }
+
+.ion-ipod:before { content: "\f1fb"; }
+
+.ion-jet:before { content: "\f295"; }
+
+.ion-key:before { content: "\f296"; }
+
+.ion-knife:before { content: "\f297"; }
+
+.ion-laptop:before { content: "\f1fc"; }
+
+.ion-leaf:before { content: "\f1fd"; }
+
+.ion-levels:before { content: "\f298"; }
+
+.ion-lightbulb:before { content: "\f299"; }
+
+.ion-link:before { content: "\f1fe"; }
+
+.ion-load-a:before { content: "\f29a"; }
+
+.ion-load-b:before { content: "\f29b"; }
+
+.ion-load-c:before { content: "\f29c"; }
+
+.ion-load-d:before { content: "\f29d"; }
+
+.ion-location:before { content: "\f1ff"; }
+
+.ion-lock-combination:before { content: "\f4d4"; }
+
+.ion-locked:before { content: "\f200"; }
+
+.ion-log-in:before { content: "\f29e"; }
+
+.ion-log-out:before { content: "\f29f"; }
+
+.ion-loop:before { content: "\f201"; }
+
+.ion-magnet:before { content: "\f2a0"; }
+
+.ion-male:before { content: "\f2a1"; }
+
+.ion-man:before { content: "\f202"; }
+
+.ion-map:before { content: "\f203"; }
+
+.ion-medkit:before { content: "\f2a2"; }
+
+.ion-merge:before { content: "\f33f"; }
+
+.ion-mic-a:before { content: "\f204"; }
+
+.ion-mic-b:before { content: "\f205"; }
+
+.ion-mic-c:before { content: "\f206"; }
+
+.ion-minus:before { content: "\f209"; }
+
+.ion-minus-circled:before { content: "\f207"; }
+
+.ion-minus-round:before { content: "\f208"; }
+
+.ion-model-s:before { content: "\f2c1"; }
+
+.ion-monitor:before { content: "\f20a"; }
+
+.ion-more:before { content: "\f20b"; }
+
+.ion-mouse:before { content: "\f340"; }
+
+.ion-music-note:before { content: "\f20c"; }
+
+.ion-navicon:before { content: "\f20e"; }
+
+.ion-navicon-round:before { content: "\f20d"; }
+
+.ion-navigate:before { content: "\f2a3"; }
+
+.ion-network:before { content: "\f341"; }
+
+.ion-no-smoking:before { content: "\f2c2"; }
+
+.ion-nuclear:before { content: "\f2a4"; }
+
+.ion-outlet:before { content: "\f342"; }
+
+.ion-paintbrush:before { content: "\f4d5"; }
+
+.ion-paintbucket:before { content: "\f4d6"; }
+
+.ion-paper-airplane:before { content: "\f2c3"; }
+
+.ion-paperclip:before { content: "\f20f"; }
+
+.ion-pause:before { content: "\f210"; }
+
+.ion-person:before { content: "\f213"; }
+
+.ion-person-add:before { content: "\f211"; }
+
+.ion-person-stalker:before { content: "\f212"; }
+
+.ion-pie-graph:before { content: "\f2a5"; }
+
+.ion-pin:before { content: "\f2a6"; }
+
+.ion-pinpoint:before { content: "\f2a7"; }
+
+.ion-pizza:before { content: "\f2a8"; }
+
+.ion-plane:before { content: "\f214"; }
+
+.ion-planet:before { content: "\f343"; }
+
+.ion-play:before { content: "\f215"; }
+
+.ion-playstation:before { content: "\f30a"; }
+
+.ion-plus:before { content: "\f218"; }
+
+.ion-plus-circled:before { content: "\f216"; }
+
+.ion-plus-round:before { content: "\f217"; }
+
+.ion-podium:before { content: "\f344"; }
+
+.ion-pound:before { content: "\f219"; }
+
+.ion-power:before { content: "\f2a9"; }
+
+.ion-pricetag:before { content: "\f2aa"; }
+
+.ion-pricetags:before { content: "\f2ab"; }
+
+.ion-printer:before { content: "\f21a"; }
+
+.ion-pull-request:before { content: "\f345"; }
+
+.ion-qr-scanner:before { content: "\f346"; }
+
+.ion-quote:before { content: "\f347"; }
+
+.ion-radio-waves:before { content: "\f2ac"; }
+
+.ion-record:before { content: "\f21b"; }
+
+.ion-refresh:before { content: "\f21c"; }
+
+.ion-reply:before { content: "\f21e"; }
+
+.ion-reply-all:before { content: "\f21d"; }
+
+.ion-ribbon-a:before { content: "\f348"; }
+
+.ion-ribbon-b:before { content: "\f349"; }
+
+.ion-sad:before { content: "\f34a"; }
+
+.ion-sad-outline:before { content: "\f4d7"; }
+
+.ion-scissors:before { content: "\f34b"; }
+
+.ion-search:before { content: "\f21f"; }
+
+.ion-settings:before { content: "\f2ad"; }
+
+.ion-share:before { content: "\f220"; }
+
+.ion-shuffle:before { content: "\f221"; }
+
+.ion-skip-backward:before { content: "\f222"; }
+
+.ion-skip-forward:before { content: "\f223"; }
+
+.ion-social-android:before { content: "\f225"; }
+
+.ion-social-android-outline:before { content: "\f224"; }
+
+.ion-social-angular:before { content: "\f4d9"; }
+
+.ion-social-angular-outline:before { content: "\f4d8"; }
+
+.ion-social-apple:before { content: "\f227"; }
+
+.ion-social-apple-outline:before { content: "\f226"; }
+
+.ion-social-bitcoin:before { content: "\f2af"; }
+
+.ion-social-bitcoin-outline:before { content: "\f2ae"; }
+
+.ion-social-buffer:before { content: "\f229"; }
+
+.ion-social-buffer-outline:before { content: "\f228"; }
+
+.ion-social-chrome:before { content: "\f4db"; }
+
+.ion-social-chrome-outline:before { content: "\f4da"; }
+
+.ion-social-codepen:before { content: "\f4dd"; }
+
+.ion-social-codepen-outline:before { content: "\f4dc"; }
+
+.ion-social-css3:before { content: "\f4df"; }
+
+.ion-social-css3-outline:before { content: "\f4de"; }
+
+.ion-social-designernews:before { content: "\f22b"; }
+
+.ion-social-designernews-outline:before { content: "\f22a"; }
+
+.ion-social-dribbble:before { content: "\f22d"; }
+
+.ion-social-dribbble-outline:before { content: "\f22c"; }
+
+.ion-social-dropbox:before { content: "\f22f"; }
+
+.ion-social-dropbox-outline:before { content: "\f22e"; }
+
+.ion-social-euro:before { content: "\f4e1"; }
+
+.ion-social-euro-outline:before { content: "\f4e0"; }
+
+.ion-social-facebook:before { content: "\f231"; }
+
+.ion-social-facebook-outline:before { content: "\f230"; }
+
+.ion-social-foursquare:before { content: "\f34d"; }
+
+.ion-social-foursquare-outline:before { content: "\f34c"; }
+
+.ion-social-freebsd-devil:before { content: "\f2c4"; }
+
+.ion-social-github:before { content: "\f233"; }
+
+.ion-social-github-outline:before { content: "\f232"; }
+
+.ion-social-google:before { content: "\f34f"; }
+
+.ion-social-google-outline:before { content: "\f34e"; }
+
+.ion-social-googleplus:before { content: "\f235"; }
+
+.ion-social-googleplus-outline:before { content: "\f234"; }
+
+.ion-social-hackernews:before { content: "\f237"; }
+
+.ion-social-hackernews-outline:before { content: "\f236"; }
+
+.ion-social-html5:before { content: "\f4e3"; }
+
+.ion-social-html5-outline:before { content: "\f4e2"; }
+
+.ion-social-instagram:before { content: "\f351"; }
+
+.ion-social-instagram-outline:before { content: "\f350"; }
+
+.ion-social-javascript:before { content: "\f4e5"; }
+
+.ion-social-javascript-outline:before { content: "\f4e4"; }
+
+.ion-social-linkedin:before { content: "\f239"; }
+
+.ion-social-linkedin-outline:before { content: "\f238"; }
+
+.ion-social-markdown:before { content: "\f4e6"; }
+
+.ion-social-nodejs:before { content: "\f4e7"; }
+
+.ion-social-octocat:before { content: "\f4e8"; }
+
+.ion-social-pinterest:before { content: "\f2b1"; }
+
+.ion-social-pinterest-outline:before { content: "\f2b0"; }
+
+.ion-social-python:before { content: "\f4e9"; }
+
+.ion-social-reddit:before { content: "\f23b"; }
+
+.ion-social-reddit-outline:before { content: "\f23a"; }
+
+.ion-social-rss:before { content: "\f23d"; }
+
+.ion-social-rss-outline:before { content: "\f23c"; }
+
+.ion-social-sass:before { content: "\f4ea"; }
+
+.ion-social-skype:before { content: "\f23f"; }
+
+.ion-social-skype-outline:before { content: "\f23e"; }
+
+.ion-social-snapchat:before { content: "\f4ec"; }
+
+.ion-social-snapchat-outline:before { content: "\f4eb"; }
+
+.ion-social-tumblr:before { content: "\f241"; }
+
+.ion-social-tumblr-outline:before { content: "\f240"; }
+
+.ion-social-tux:before { content: "\f2c5"; }
+
+.ion-social-twitch:before { content: "\f4ee"; }
+
+.ion-social-twitch-outline:before { content: "\f4ed"; }
+
+.ion-social-twitter:before { content: "\f243"; }
+
+.ion-social-twitter-outline:before { content: "\f242"; }
+
+.ion-social-usd:before { content: "\f353"; }
+
+.ion-social-usd-outline:before { content: "\f352"; }
+
+.ion-social-vimeo:before { content: "\f245"; }
+
+.ion-social-vimeo-outline:before { content: "\f244"; }
+
+.ion-social-whatsapp:before { content: "\f4f0"; }
+
+.ion-social-whatsapp-outline:before { content: "\f4ef"; }
+
+.ion-social-windows:before { content: "\f247"; }
+
+.ion-social-windows-outline:before { content: "\f246"; }
+
+.ion-social-wordpress:before { content: "\f249"; }
+
+.ion-social-wordpress-outline:before { content: "\f248"; }
+
+.ion-social-yahoo:before { content: "\f24b"; }
+
+.ion-social-yahoo-outline:before { content: "\f24a"; }
+
+.ion-social-yen:before { content: "\f4f2"; }
+
+.ion-social-yen-outline:before { content: "\f4f1"; }
+
+.ion-social-youtube:before { content: "\f24d"; }
+
+.ion-social-youtube-outline:before { content: "\f24c"; }
+
+.ion-soup-can:before { content: "\f4f4"; }
+
+.ion-soup-can-outline:before { content: "\f4f3"; }
+
+.ion-speakerphone:before { content: "\f2b2"; }
+
+.ion-speedometer:before { content: "\f2b3"; }
+
+.ion-spoon:before { content: "\f2b4"; }
+
+.ion-star:before { content: "\f24e"; }
+
+.ion-stats-bars:before { content: "\f2b5"; }
+
+.ion-steam:before { content: "\f30b"; }
+
+.ion-stop:before { content: "\f24f"; }
+
+.ion-thermometer:before { content: "\f2b6"; }
+
+.ion-thumbsdown:before { content: "\f250"; }
+
+.ion-thumbsup:before { content: "\f251"; }
+
+.ion-toggle:before { content: "\f355"; }
+
+.ion-toggle-filled:before { content: "\f354"; }
+
+.ion-transgender:before { content: "\f4f5"; }
+
+.ion-trash-a:before { content: "\f252"; }
+
+.ion-trash-b:before { content: "\f253"; }
+
+.ion-trophy:before { content: "\f356"; }
+
+.ion-tshirt:before { content: "\f4f7"; }
+
+.ion-tshirt-outline:before { content: "\f4f6"; }
+
+.ion-umbrella:before { content: "\f2b7"; }
+
+.ion-university:before { content: "\f357"; }
+
+.ion-unlocked:before { content: "\f254"; }
+
+.ion-upload:before { content: "\f255"; }
+
+.ion-usb:before { content: "\f2b8"; }
+
+.ion-videocamera:before { content: "\f256"; }
+
+.ion-volume-high:before { content: "\f257"; }
+
+.ion-volume-low:before { content: "\f258"; }
+
+.ion-volume-medium:before { content: "\f259"; }
+
+.ion-volume-mute:before { content: "\f25a"; }
+
+.ion-wand:before { content: "\f358"; }
+
+.ion-waterdrop:before { content: "\f25b"; }
+
+.ion-wifi:before { content: "\f25c"; }
+
+.ion-wineglass:before { content: "\f2b9"; }
+
+.ion-woman:before { content: "\f25d"; }
+
+.ion-wrench:before { content: "\f2ba"; }
+
+.ion-xbox:before { content: "\f30c"; }
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/css/ionicons.min.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/css/ionicons.min.css
new file mode 100644
index 00000000..baba9e93
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/css/ionicons.min.css
@@ -0,0 +1,11 @@
+@charset "UTF-8";/*!
+ Ionicons, v2.0.0
+ Created by Ben Sperry for the Ionic Framework, http://ionicons.com/
+ https://twitter.com/benjsperry https://twitter.com/ionicframework
+ MIT License: https://github.com/driftyco/ionicons
+
+ Android-style icons originally built by Google’s
+ Material Design Icons: https://github.com/google/material-design-icons
+ used under CC BY http://creativecommons.org/licenses/by/4.0/
+ Modified icons to fit ionicon’s grid from original.
+*/@font-face{font-family:"Ionicons";src:url("../fonts/ionicons.eot?v=2.0.0");src:url("../fonts/ionicons.eot?v=2.0.0#iefix") format("embedded-opentype"),url("../fonts/ionicons.ttf?v=2.0.0") format("truetype"),url("../fonts/ionicons.woff?v=2.0.0") format("woff"),url("../fonts/ionicons.svg?v=2.0.0#Ionicons") format("svg");font-weight:normal;font-style:normal}.ion,.ionicons,.ion-alert:before,.ion-alert-circled:before,.ion-android-add:before,.ion-android-add-circle:before,.ion-android-alarm-clock:before,.ion-android-alert:before,.ion-android-apps:before,.ion-android-archive:before,.ion-android-arrow-back:before,.ion-android-arrow-down:before,.ion-android-arrow-dropdown:before,.ion-android-arrow-dropdown-circle:before,.ion-android-arrow-dropleft:before,.ion-android-arrow-dropleft-circle:before,.ion-android-arrow-dropright:before,.ion-android-arrow-dropright-circle:before,.ion-android-arrow-dropup:before,.ion-android-arrow-dropup-circle:before,.ion-android-arrow-forward:before,.ion-android-arrow-up:before,.ion-android-attach:before,.ion-android-bar:before,.ion-android-bicycle:before,.ion-android-boat:before,.ion-android-bookmark:before,.ion-android-bulb:before,.ion-android-bus:before,.ion-android-calendar:before,.ion-android-call:before,.ion-android-camera:before,.ion-android-cancel:before,.ion-android-car:before,.ion-android-cart:before,.ion-android-chat:before,.ion-android-checkbox:before,.ion-android-checkbox-blank:before,.ion-android-checkbox-outline:before,.ion-android-checkbox-outline-blank:before,.ion-android-checkmark-circle:before,.ion-android-clipboard:before,.ion-android-close:before,.ion-android-cloud:before,.ion-android-cloud-circle:before,.ion-android-cloud-done:before,.ion-android-cloud-outline:before,.ion-android-color-palette:before,.ion-android-compass:before,.ion-android-contact:before,.ion-android-contacts:before,.ion-android-contract:before,.ion-android-create:before,.ion-android-delete:before,.ion-android-desktop:before,.ion-android-document:before,.ion-android-done:before,.ion-android-done-all:before,.ion-android-download:before,.ion-android-drafts:before,.ion-android-exit:before,.ion-android-expand:before,.ion-android-favorite:before,.ion-android-favorite-outline:before,.ion-android-film:before,.ion-android-folder:before,.ion-android-folder-open:before,.ion-android-funnel:before,.ion-android-globe:before,.ion-android-hand:before,.ion-android-hangout:before,.ion-android-happy:before,.ion-android-home:before,.ion-android-image:before,.ion-android-laptop:before,.ion-android-list:before,.ion-android-locate:before,.ion-android-lock:before,.ion-android-mail:before,.ion-android-map:before,.ion-android-menu:before,.ion-android-microphone:before,.ion-android-microphone-off:before,.ion-android-more-horizontal:before,.ion-android-more-vertical:before,.ion-android-navigate:before,.ion-android-notifications:before,.ion-android-notifications-none:before,.ion-android-notifications-off:before,.ion-android-open:before,.ion-android-options:before,.ion-android-people:before,.ion-android-person:before,.ion-android-person-add:before,.ion-android-phone-landscape:before,.ion-android-phone-portrait:before,.ion-android-pin:before,.ion-android-plane:before,.ion-android-playstore:before,.ion-android-print:before,.ion-android-radio-button-off:before,.ion-android-radio-button-on:before,.ion-android-refresh:before,.ion-android-remove:before,.ion-android-remove-circle:before,.ion-android-restaurant:before,.ion-android-sad:before,.ion-android-search:before,.ion-android-send:before,.ion-android-settings:before,.ion-android-share:before,.ion-android-share-alt:before,.ion-android-star:before,.ion-android-star-half:before,.ion-android-star-outline:before,.ion-android-stopwatch:before,.ion-android-subway:before,.ion-android-sunny:before,.ion-android-sync:before,.ion-android-textsms:before,.ion-android-time:before,.ion-android-train:before,.ion-android-unlock:before,.ion-android-upload:before,.ion-android-volume-down:before,.ion-android-volume-mute:before,.ion-android-volume-off:before,.ion-android-volume-up:before,.ion-android-walk:before,.ion-android-warning:before,.ion-android-watch:before,.ion-android-wifi:before,.ion-aperture:before,.ion-archive:before,.ion-arrow-down-a:before,.ion-arrow-down-b:before,.ion-arrow-down-c:before,.ion-arrow-expand:before,.ion-arrow-graph-down-left:before,.ion-arrow-graph-down-right:before,.ion-arrow-graph-up-left:before,.ion-arrow-graph-up-right:before,.ion-arrow-left-a:before,.ion-arrow-left-b:before,.ion-arrow-left-c:before,.ion-arrow-move:before,.ion-arrow-resize:before,.ion-arrow-return-left:before,.ion-arrow-return-right:before,.ion-arrow-right-a:before,.ion-arrow-right-b:before,.ion-arrow-right-c:before,.ion-arrow-shrink:before,.ion-arrow-swap:before,.ion-arrow-up-a:before,.ion-arrow-up-b:before,.ion-arrow-up-c:before,.ion-asterisk:before,.ion-at:before,.ion-backspace:before,.ion-backspace-outline:before,.ion-bag:before,.ion-battery-charging:before,.ion-battery-empty:before,.ion-battery-full:before,.ion-battery-half:before,.ion-battery-low:before,.ion-beaker:before,.ion-beer:before,.ion-bluetooth:before,.ion-bonfire:before,.ion-bookmark:before,.ion-bowtie:before,.ion-briefcase:before,.ion-bug:before,.ion-calculator:before,.ion-calendar:before,.ion-camera:before,.ion-card:before,.ion-cash:before,.ion-chatbox:before,.ion-chatbox-working:before,.ion-chatboxes:before,.ion-chatbubble:before,.ion-chatbubble-working:before,.ion-chatbubbles:before,.ion-checkmark:before,.ion-checkmark-circled:before,.ion-checkmark-round:before,.ion-chevron-down:before,.ion-chevron-left:before,.ion-chevron-right:before,.ion-chevron-up:before,.ion-clipboard:before,.ion-clock:before,.ion-close:before,.ion-close-circled:before,.ion-close-round:before,.ion-closed-captioning:before,.ion-cloud:before,.ion-code:before,.ion-code-download:before,.ion-code-working:before,.ion-coffee:before,.ion-compass:before,.ion-compose:before,.ion-connection-bars:before,.ion-contrast:before,.ion-crop:before,.ion-cube:before,.ion-disc:before,.ion-document:before,.ion-document-text:before,.ion-drag:before,.ion-earth:before,.ion-easel:before,.ion-edit:before,.ion-egg:before,.ion-eject:before,.ion-email:before,.ion-email-unread:before,.ion-erlenmeyer-flask:before,.ion-erlenmeyer-flask-bubbles:before,.ion-eye:before,.ion-eye-disabled:before,.ion-female:before,.ion-filing:before,.ion-film-marker:before,.ion-fireball:before,.ion-flag:before,.ion-flame:before,.ion-flash:before,.ion-flash-off:before,.ion-folder:before,.ion-fork:before,.ion-fork-repo:before,.ion-forward:before,.ion-funnel:before,.ion-gear-a:before,.ion-gear-b:before,.ion-grid:before,.ion-hammer:before,.ion-happy:before,.ion-happy-outline:before,.ion-headphone:before,.ion-heart:before,.ion-heart-broken:before,.ion-help:before,.ion-help-buoy:before,.ion-help-circled:before,.ion-home:before,.ion-icecream:before,.ion-image:before,.ion-images:before,.ion-information:before,.ion-information-circled:before,.ion-ionic:before,.ion-ios-alarm:before,.ion-ios-alarm-outline:before,.ion-ios-albums:before,.ion-ios-albums-outline:before,.ion-ios-americanfootball:before,.ion-ios-americanfootball-outline:before,.ion-ios-analytics:before,.ion-ios-analytics-outline:before,.ion-ios-arrow-back:before,.ion-ios-arrow-down:before,.ion-ios-arrow-forward:before,.ion-ios-arrow-left:before,.ion-ios-arrow-right:before,.ion-ios-arrow-thin-down:before,.ion-ios-arrow-thin-left:before,.ion-ios-arrow-thin-right:before,.ion-ios-arrow-thin-up:before,.ion-ios-arrow-up:before,.ion-ios-at:before,.ion-ios-at-outline:before,.ion-ios-barcode:before,.ion-ios-barcode-outline:before,.ion-ios-baseball:before,.ion-ios-baseball-outline:before,.ion-ios-basketball:before,.ion-ios-basketball-outline:before,.ion-ios-bell:before,.ion-ios-bell-outline:before,.ion-ios-body:before,.ion-ios-body-outline:before,.ion-ios-bolt:before,.ion-ios-bolt-outline:before,.ion-ios-book:before,.ion-ios-book-outline:before,.ion-ios-bookmarks:before,.ion-ios-bookmarks-outline:before,.ion-ios-box:before,.ion-ios-box-outline:before,.ion-ios-briefcase:before,.ion-ios-briefcase-outline:before,.ion-ios-browsers:before,.ion-ios-browsers-outline:before,.ion-ios-calculator:before,.ion-ios-calculator-outline:before,.ion-ios-calendar:before,.ion-ios-calendar-outline:before,.ion-ios-camera:before,.ion-ios-camera-outline:before,.ion-ios-cart:before,.ion-ios-cart-outline:before,.ion-ios-chatboxes:before,.ion-ios-chatboxes-outline:before,.ion-ios-chatbubble:before,.ion-ios-chatbubble-outline:before,.ion-ios-checkmark:before,.ion-ios-checkmark-empty:before,.ion-ios-checkmark-outline:before,.ion-ios-circle-filled:before,.ion-ios-circle-outline:before,.ion-ios-clock:before,.ion-ios-clock-outline:before,.ion-ios-close:before,.ion-ios-close-empty:before,.ion-ios-close-outline:before,.ion-ios-cloud:before,.ion-ios-cloud-download:before,.ion-ios-cloud-download-outline:before,.ion-ios-cloud-outline:before,.ion-ios-cloud-upload:before,.ion-ios-cloud-upload-outline:before,.ion-ios-cloudy:before,.ion-ios-cloudy-night:before,.ion-ios-cloudy-night-outline:before,.ion-ios-cloudy-outline:before,.ion-ios-cog:before,.ion-ios-cog-outline:before,.ion-ios-color-filter:before,.ion-ios-color-filter-outline:before,.ion-ios-color-wand:before,.ion-ios-color-wand-outline:before,.ion-ios-compose:before,.ion-ios-compose-outline:before,.ion-ios-contact:before,.ion-ios-contact-outline:before,.ion-ios-copy:before,.ion-ios-copy-outline:before,.ion-ios-crop:before,.ion-ios-crop-strong:before,.ion-ios-download:before,.ion-ios-download-outline:before,.ion-ios-drag:before,.ion-ios-email:before,.ion-ios-email-outline:before,.ion-ios-eye:before,.ion-ios-eye-outline:before,.ion-ios-fastforward:before,.ion-ios-fastforward-outline:before,.ion-ios-filing:before,.ion-ios-filing-outline:before,.ion-ios-film:before,.ion-ios-film-outline:before,.ion-ios-flag:before,.ion-ios-flag-outline:before,.ion-ios-flame:before,.ion-ios-flame-outline:before,.ion-ios-flask:before,.ion-ios-flask-outline:before,.ion-ios-flower:before,.ion-ios-flower-outline:before,.ion-ios-folder:before,.ion-ios-folder-outline:before,.ion-ios-football:before,.ion-ios-football-outline:before,.ion-ios-game-controller-a:before,.ion-ios-game-controller-a-outline:before,.ion-ios-game-controller-b:before,.ion-ios-game-controller-b-outline:before,.ion-ios-gear:before,.ion-ios-gear-outline:before,.ion-ios-glasses:before,.ion-ios-glasses-outline:before,.ion-ios-grid-view:before,.ion-ios-grid-view-outline:before,.ion-ios-heart:before,.ion-ios-heart-outline:before,.ion-ios-help:before,.ion-ios-help-empty:before,.ion-ios-help-outline:before,.ion-ios-home:before,.ion-ios-home-outline:before,.ion-ios-infinite:before,.ion-ios-infinite-outline:before,.ion-ios-information:before,.ion-ios-information-empty:before,.ion-ios-information-outline:before,.ion-ios-ionic-outline:before,.ion-ios-keypad:before,.ion-ios-keypad-outline:before,.ion-ios-lightbulb:before,.ion-ios-lightbulb-outline:before,.ion-ios-list:before,.ion-ios-list-outline:before,.ion-ios-location:before,.ion-ios-location-outline:before,.ion-ios-locked:before,.ion-ios-locked-outline:before,.ion-ios-loop:before,.ion-ios-loop-strong:before,.ion-ios-medical:before,.ion-ios-medical-outline:before,.ion-ios-medkit:before,.ion-ios-medkit-outline:before,.ion-ios-mic:before,.ion-ios-mic-off:before,.ion-ios-mic-outline:before,.ion-ios-minus:before,.ion-ios-minus-empty:before,.ion-ios-minus-outline:before,.ion-ios-monitor:before,.ion-ios-monitor-outline:before,.ion-ios-moon:before,.ion-ios-moon-outline:before,.ion-ios-more:before,.ion-ios-more-outline:before,.ion-ios-musical-note:before,.ion-ios-musical-notes:before,.ion-ios-navigate:before,.ion-ios-navigate-outline:before,.ion-ios-nutrition:before,.ion-ios-nutrition-outline:before,.ion-ios-paper:before,.ion-ios-paper-outline:before,.ion-ios-paperplane:before,.ion-ios-paperplane-outline:before,.ion-ios-partlysunny:before,.ion-ios-partlysunny-outline:before,.ion-ios-pause:before,.ion-ios-pause-outline:before,.ion-ios-paw:before,.ion-ios-paw-outline:before,.ion-ios-people:before,.ion-ios-people-outline:before,.ion-ios-person:before,.ion-ios-person-outline:before,.ion-ios-personadd:before,.ion-ios-personadd-outline:before,.ion-ios-photos:before,.ion-ios-photos-outline:before,.ion-ios-pie:before,.ion-ios-pie-outline:before,.ion-ios-pint:before,.ion-ios-pint-outline:before,.ion-ios-play:before,.ion-ios-play-outline:before,.ion-ios-plus:before,.ion-ios-plus-empty:before,.ion-ios-plus-outline:before,.ion-ios-pricetag:before,.ion-ios-pricetag-outline:before,.ion-ios-pricetags:before,.ion-ios-pricetags-outline:before,.ion-ios-printer:before,.ion-ios-printer-outline:before,.ion-ios-pulse:before,.ion-ios-pulse-strong:before,.ion-ios-rainy:before,.ion-ios-rainy-outline:before,.ion-ios-recording:before,.ion-ios-recording-outline:before,.ion-ios-redo:before,.ion-ios-redo-outline:before,.ion-ios-refresh:before,.ion-ios-refresh-empty:before,.ion-ios-refresh-outline:before,.ion-ios-reload:before,.ion-ios-reverse-camera:before,.ion-ios-reverse-camera-outline:before,.ion-ios-rewind:before,.ion-ios-rewind-outline:before,.ion-ios-rose:before,.ion-ios-rose-outline:before,.ion-ios-search:before,.ion-ios-search-strong:before,.ion-ios-settings:before,.ion-ios-settings-strong:before,.ion-ios-shuffle:before,.ion-ios-shuffle-strong:before,.ion-ios-skipbackward:before,.ion-ios-skipbackward-outline:before,.ion-ios-skipforward:before,.ion-ios-skipforward-outline:before,.ion-ios-snowy:before,.ion-ios-speedometer:before,.ion-ios-speedometer-outline:before,.ion-ios-star:before,.ion-ios-star-half:before,.ion-ios-star-outline:before,.ion-ios-stopwatch:before,.ion-ios-stopwatch-outline:before,.ion-ios-sunny:before,.ion-ios-sunny-outline:before,.ion-ios-telephone:before,.ion-ios-telephone-outline:before,.ion-ios-tennisball:before,.ion-ios-tennisball-outline:before,.ion-ios-thunderstorm:before,.ion-ios-thunderstorm-outline:before,.ion-ios-time:before,.ion-ios-time-outline:before,.ion-ios-timer:before,.ion-ios-timer-outline:before,.ion-ios-toggle:before,.ion-ios-toggle-outline:before,.ion-ios-trash:before,.ion-ios-trash-outline:before,.ion-ios-undo:before,.ion-ios-undo-outline:before,.ion-ios-unlocked:before,.ion-ios-unlocked-outline:before,.ion-ios-upload:before,.ion-ios-upload-outline:before,.ion-ios-videocam:before,.ion-ios-videocam-outline:before,.ion-ios-volume-high:before,.ion-ios-volume-low:before,.ion-ios-wineglass:before,.ion-ios-wineglass-outline:before,.ion-ios-world:before,.ion-ios-world-outline:before,.ion-ipad:before,.ion-iphone:before,.ion-ipod:before,.ion-jet:before,.ion-key:before,.ion-knife:before,.ion-laptop:before,.ion-leaf:before,.ion-levels:before,.ion-lightbulb:before,.ion-link:before,.ion-load-a:before,.ion-load-b:before,.ion-load-c:before,.ion-load-d:before,.ion-location:before,.ion-lock-combination:before,.ion-locked:before,.ion-log-in:before,.ion-log-out:before,.ion-loop:before,.ion-magnet:before,.ion-male:before,.ion-man:before,.ion-map:before,.ion-medkit:before,.ion-merge:before,.ion-mic-a:before,.ion-mic-b:before,.ion-mic-c:before,.ion-minus:before,.ion-minus-circled:before,.ion-minus-round:before,.ion-model-s:before,.ion-monitor:before,.ion-more:before,.ion-mouse:before,.ion-music-note:before,.ion-navicon:before,.ion-navicon-round:before,.ion-navigate:before,.ion-network:before,.ion-no-smoking:before,.ion-nuclear:before,.ion-outlet:before,.ion-paintbrush:before,.ion-paintbucket:before,.ion-paper-airplane:before,.ion-paperclip:before,.ion-pause:before,.ion-person:before,.ion-person-add:before,.ion-person-stalker:before,.ion-pie-graph:before,.ion-pin:before,.ion-pinpoint:before,.ion-pizza:before,.ion-plane:before,.ion-planet:before,.ion-play:before,.ion-playstation:before,.ion-plus:before,.ion-plus-circled:before,.ion-plus-round:before,.ion-podium:before,.ion-pound:before,.ion-power:before,.ion-pricetag:before,.ion-pricetags:before,.ion-printer:before,.ion-pull-request:before,.ion-qr-scanner:before,.ion-quote:before,.ion-radio-waves:before,.ion-record:before,.ion-refresh:before,.ion-reply:before,.ion-reply-all:before,.ion-ribbon-a:before,.ion-ribbon-b:before,.ion-sad:before,.ion-sad-outline:before,.ion-scissors:before,.ion-search:before,.ion-settings:before,.ion-share:before,.ion-shuffle:before,.ion-skip-backward:before,.ion-skip-forward:before,.ion-social-android:before,.ion-social-android-outline:before,.ion-social-angular:before,.ion-social-angular-outline:before,.ion-social-apple:before,.ion-social-apple-outline:before,.ion-social-bitcoin:before,.ion-social-bitcoin-outline:before,.ion-social-buffer:before,.ion-social-buffer-outline:before,.ion-social-chrome:before,.ion-social-chrome-outline:before,.ion-social-codepen:before,.ion-social-codepen-outline:before,.ion-social-css3:before,.ion-social-css3-outline:before,.ion-social-designernews:before,.ion-social-designernews-outline:before,.ion-social-dribbble:before,.ion-social-dribbble-outline:before,.ion-social-dropbox:before,.ion-social-dropbox-outline:before,.ion-social-euro:before,.ion-social-euro-outline:before,.ion-social-facebook:before,.ion-social-facebook-outline:before,.ion-social-foursquare:before,.ion-social-foursquare-outline:before,.ion-social-freebsd-devil:before,.ion-social-github:before,.ion-social-github-outline:before,.ion-social-google:before,.ion-social-google-outline:before,.ion-social-googleplus:before,.ion-social-googleplus-outline:before,.ion-social-hackernews:before,.ion-social-hackernews-outline:before,.ion-social-html5:before,.ion-social-html5-outline:before,.ion-social-instagram:before,.ion-social-instagram-outline:before,.ion-social-javascript:before,.ion-social-javascript-outline:before,.ion-social-linkedin:before,.ion-social-linkedin-outline:before,.ion-social-markdown:before,.ion-social-nodejs:before,.ion-social-octocat:before,.ion-social-pinterest:before,.ion-social-pinterest-outline:before,.ion-social-python:before,.ion-social-reddit:before,.ion-social-reddit-outline:before,.ion-social-rss:before,.ion-social-rss-outline:before,.ion-social-sass:before,.ion-social-skype:before,.ion-social-skype-outline:before,.ion-social-snapchat:before,.ion-social-snapchat-outline:before,.ion-social-tumblr:before,.ion-social-tumblr-outline:before,.ion-social-tux:before,.ion-social-twitch:before,.ion-social-twitch-outline:before,.ion-social-twitter:before,.ion-social-twitter-outline:before,.ion-social-usd:before,.ion-social-usd-outline:before,.ion-social-vimeo:before,.ion-social-vimeo-outline:before,.ion-social-whatsapp:before,.ion-social-whatsapp-outline:before,.ion-social-windows:before,.ion-social-windows-outline:before,.ion-social-wordpress:before,.ion-social-wordpress-outline:before,.ion-social-yahoo:before,.ion-social-yahoo-outline:before,.ion-social-yen:before,.ion-social-yen-outline:before,.ion-social-youtube:before,.ion-social-youtube-outline:before,.ion-soup-can:before,.ion-soup-can-outline:before,.ion-speakerphone:before,.ion-speedometer:before,.ion-spoon:before,.ion-star:before,.ion-stats-bars:before,.ion-steam:before,.ion-stop:before,.ion-thermometer:before,.ion-thumbsdown:before,.ion-thumbsup:before,.ion-toggle:before,.ion-toggle-filled:before,.ion-transgender:before,.ion-trash-a:before,.ion-trash-b:before,.ion-trophy:before,.ion-tshirt:before,.ion-tshirt-outline:before,.ion-umbrella:before,.ion-university:before,.ion-unlocked:before,.ion-upload:before,.ion-usb:before,.ion-videocamera:before,.ion-volume-high:before,.ion-volume-low:before,.ion-volume-medium:before,.ion-volume-mute:before,.ion-wand:before,.ion-waterdrop:before,.ion-wifi:before,.ion-wineglass:before,.ion-woman:before,.ion-wrench:before,.ion-xbox:before{display:inline-block;font-family:"Ionicons";speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;text-rendering:auto;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ion-alert:before{content:"\f101"}.ion-alert-circled:before{content:"\f100"}.ion-android-add:before{content:"\f2c7"}.ion-android-add-circle:before{content:"\f359"}.ion-android-alarm-clock:before{content:"\f35a"}.ion-android-alert:before{content:"\f35b"}.ion-android-apps:before{content:"\f35c"}.ion-android-archive:before{content:"\f2c9"}.ion-android-arrow-back:before{content:"\f2ca"}.ion-android-arrow-down:before{content:"\f35d"}.ion-android-arrow-dropdown:before{content:"\f35f"}.ion-android-arrow-dropdown-circle:before{content:"\f35e"}.ion-android-arrow-dropleft:before{content:"\f361"}.ion-android-arrow-dropleft-circle:before{content:"\f360"}.ion-android-arrow-dropright:before{content:"\f363"}.ion-android-arrow-dropright-circle:before{content:"\f362"}.ion-android-arrow-dropup:before{content:"\f365"}.ion-android-arrow-dropup-circle:before{content:"\f364"}.ion-android-arrow-forward:before{content:"\f30f"}.ion-android-arrow-up:before{content:"\f366"}.ion-android-attach:before{content:"\f367"}.ion-android-bar:before{content:"\f368"}.ion-android-bicycle:before{content:"\f369"}.ion-android-boat:before{content:"\f36a"}.ion-android-bookmark:before{content:"\f36b"}.ion-android-bulb:before{content:"\f36c"}.ion-android-bus:before{content:"\f36d"}.ion-android-calendar:before{content:"\f2d1"}.ion-android-call:before{content:"\f2d2"}.ion-android-camera:before{content:"\f2d3"}.ion-android-cancel:before{content:"\f36e"}.ion-android-car:before{content:"\f36f"}.ion-android-cart:before{content:"\f370"}.ion-android-chat:before{content:"\f2d4"}.ion-android-checkbox:before{content:"\f374"}.ion-android-checkbox-blank:before{content:"\f371"}.ion-android-checkbox-outline:before{content:"\f373"}.ion-android-checkbox-outline-blank:before{content:"\f372"}.ion-android-checkmark-circle:before{content:"\f375"}.ion-android-clipboard:before{content:"\f376"}.ion-android-close:before{content:"\f2d7"}.ion-android-cloud:before{content:"\f37a"}.ion-android-cloud-circle:before{content:"\f377"}.ion-android-cloud-done:before{content:"\f378"}.ion-android-cloud-outline:before{content:"\f379"}.ion-android-color-palette:before{content:"\f37b"}.ion-android-compass:before{content:"\f37c"}.ion-android-contact:before{content:"\f2d8"}.ion-android-contacts:before{content:"\f2d9"}.ion-android-contract:before{content:"\f37d"}.ion-android-create:before{content:"\f37e"}.ion-android-delete:before{content:"\f37f"}.ion-android-desktop:before{content:"\f380"}.ion-android-document:before{content:"\f381"}.ion-android-done:before{content:"\f383"}.ion-android-done-all:before{content:"\f382"}.ion-android-download:before{content:"\f2dd"}.ion-android-drafts:before{content:"\f384"}.ion-android-exit:before{content:"\f385"}.ion-android-expand:before{content:"\f386"}.ion-android-favorite:before{content:"\f388"}.ion-android-favorite-outline:before{content:"\f387"}.ion-android-film:before{content:"\f389"}.ion-android-folder:before{content:"\f2e0"}.ion-android-folder-open:before{content:"\f38a"}.ion-android-funnel:before{content:"\f38b"}.ion-android-globe:before{content:"\f38c"}.ion-android-hand:before{content:"\f2e3"}.ion-android-hangout:before{content:"\f38d"}.ion-android-happy:before{content:"\f38e"}.ion-android-home:before{content:"\f38f"}.ion-android-image:before{content:"\f2e4"}.ion-android-laptop:before{content:"\f390"}.ion-android-list:before{content:"\f391"}.ion-android-locate:before{content:"\f2e9"}.ion-android-lock:before{content:"\f392"}.ion-android-mail:before{content:"\f2eb"}.ion-android-map:before{content:"\f393"}.ion-android-menu:before{content:"\f394"}.ion-android-microphone:before{content:"\f2ec"}.ion-android-microphone-off:before{content:"\f395"}.ion-android-more-horizontal:before{content:"\f396"}.ion-android-more-vertical:before{content:"\f397"}.ion-android-navigate:before{content:"\f398"}.ion-android-notifications:before{content:"\f39b"}.ion-android-notifications-none:before{content:"\f399"}.ion-android-notifications-off:before{content:"\f39a"}.ion-android-open:before{content:"\f39c"}.ion-android-options:before{content:"\f39d"}.ion-android-people:before{content:"\f39e"}.ion-android-person:before{content:"\f3a0"}.ion-android-person-add:before{content:"\f39f"}.ion-android-phone-landscape:before{content:"\f3a1"}.ion-android-phone-portrait:before{content:"\f3a2"}.ion-android-pin:before{content:"\f3a3"}.ion-android-plane:before{content:"\f3a4"}.ion-android-playstore:before{content:"\f2f0"}.ion-android-print:before{content:"\f3a5"}.ion-android-radio-button-off:before{content:"\f3a6"}.ion-android-radio-button-on:before{content:"\f3a7"}.ion-android-refresh:before{content:"\f3a8"}.ion-android-remove:before{content:"\f2f4"}.ion-android-remove-circle:before{content:"\f3a9"}.ion-android-restaurant:before{content:"\f3aa"}.ion-android-sad:before{content:"\f3ab"}.ion-android-search:before{content:"\f2f5"}.ion-android-send:before{content:"\f2f6"}.ion-android-settings:before{content:"\f2f7"}.ion-android-share:before{content:"\f2f8"}.ion-android-share-alt:before{content:"\f3ac"}.ion-android-star:before{content:"\f2fc"}.ion-android-star-half:before{content:"\f3ad"}.ion-android-star-outline:before{content:"\f3ae"}.ion-android-stopwatch:before{content:"\f2fd"}.ion-android-subway:before{content:"\f3af"}.ion-android-sunny:before{content:"\f3b0"}.ion-android-sync:before{content:"\f3b1"}.ion-android-textsms:before{content:"\f3b2"}.ion-android-time:before{content:"\f3b3"}.ion-android-train:before{content:"\f3b4"}.ion-android-unlock:before{content:"\f3b5"}.ion-android-upload:before{content:"\f3b6"}.ion-android-volume-down:before{content:"\f3b7"}.ion-android-volume-mute:before{content:"\f3b8"}.ion-android-volume-off:before{content:"\f3b9"}.ion-android-volume-up:before{content:"\f3ba"}.ion-android-walk:before{content:"\f3bb"}.ion-android-warning:before{content:"\f3bc"}.ion-android-watch:before{content:"\f3bd"}.ion-android-wifi:before{content:"\f305"}.ion-aperture:before{content:"\f313"}.ion-archive:before{content:"\f102"}.ion-arrow-down-a:before{content:"\f103"}.ion-arrow-down-b:before{content:"\f104"}.ion-arrow-down-c:before{content:"\f105"}.ion-arrow-expand:before{content:"\f25e"}.ion-arrow-graph-down-left:before{content:"\f25f"}.ion-arrow-graph-down-right:before{content:"\f260"}.ion-arrow-graph-up-left:before{content:"\f261"}.ion-arrow-graph-up-right:before{content:"\f262"}.ion-arrow-left-a:before{content:"\f106"}.ion-arrow-left-b:before{content:"\f107"}.ion-arrow-left-c:before{content:"\f108"}.ion-arrow-move:before{content:"\f263"}.ion-arrow-resize:before{content:"\f264"}.ion-arrow-return-left:before{content:"\f265"}.ion-arrow-return-right:before{content:"\f266"}.ion-arrow-right-a:before{content:"\f109"}.ion-arrow-right-b:before{content:"\f10a"}.ion-arrow-right-c:before{content:"\f10b"}.ion-arrow-shrink:before{content:"\f267"}.ion-arrow-swap:before{content:"\f268"}.ion-arrow-up-a:before{content:"\f10c"}.ion-arrow-up-b:before{content:"\f10d"}.ion-arrow-up-c:before{content:"\f10e"}.ion-asterisk:before{content:"\f314"}.ion-at:before{content:"\f10f"}.ion-backspace:before{content:"\f3bf"}.ion-backspace-outline:before{content:"\f3be"}.ion-bag:before{content:"\f110"}.ion-battery-charging:before{content:"\f111"}.ion-battery-empty:before{content:"\f112"}.ion-battery-full:before{content:"\f113"}.ion-battery-half:before{content:"\f114"}.ion-battery-low:before{content:"\f115"}.ion-beaker:before{content:"\f269"}.ion-beer:before{content:"\f26a"}.ion-bluetooth:before{content:"\f116"}.ion-bonfire:before{content:"\f315"}.ion-bookmark:before{content:"\f26b"}.ion-bowtie:before{content:"\f3c0"}.ion-briefcase:before{content:"\f26c"}.ion-bug:before{content:"\f2be"}.ion-calculator:before{content:"\f26d"}.ion-calendar:before{content:"\f117"}.ion-camera:before{content:"\f118"}.ion-card:before{content:"\f119"}.ion-cash:before{content:"\f316"}.ion-chatbox:before{content:"\f11b"}.ion-chatbox-working:before{content:"\f11a"}.ion-chatboxes:before{content:"\f11c"}.ion-chatbubble:before{content:"\f11e"}.ion-chatbubble-working:before{content:"\f11d"}.ion-chatbubbles:before{content:"\f11f"}.ion-checkmark:before{content:"\f122"}.ion-checkmark-circled:before{content:"\f120"}.ion-checkmark-round:before{content:"\f121"}.ion-chevron-down:before{content:"\f123"}.ion-chevron-left:before{content:"\f124"}.ion-chevron-right:before{content:"\f125"}.ion-chevron-up:before{content:"\f126"}.ion-clipboard:before{content:"\f127"}.ion-clock:before{content:"\f26e"}.ion-close:before{content:"\f12a"}.ion-close-circled:before{content:"\f128"}.ion-close-round:before{content:"\f129"}.ion-closed-captioning:before{content:"\f317"}.ion-cloud:before{content:"\f12b"}.ion-code:before{content:"\f271"}.ion-code-download:before{content:"\f26f"}.ion-code-working:before{content:"\f270"}.ion-coffee:before{content:"\f272"}.ion-compass:before{content:"\f273"}.ion-compose:before{content:"\f12c"}.ion-connection-bars:before{content:"\f274"}.ion-contrast:before{content:"\f275"}.ion-crop:before{content:"\f3c1"}.ion-cube:before{content:"\f318"}.ion-disc:before{content:"\f12d"}.ion-document:before{content:"\f12f"}.ion-document-text:before{content:"\f12e"}.ion-drag:before{content:"\f130"}.ion-earth:before{content:"\f276"}.ion-easel:before{content:"\f3c2"}.ion-edit:before{content:"\f2bf"}.ion-egg:before{content:"\f277"}.ion-eject:before{content:"\f131"}.ion-email:before{content:"\f132"}.ion-email-unread:before{content:"\f3c3"}.ion-erlenmeyer-flask:before{content:"\f3c5"}.ion-erlenmeyer-flask-bubbles:before{content:"\f3c4"}.ion-eye:before{content:"\f133"}.ion-eye-disabled:before{content:"\f306"}.ion-female:before{content:"\f278"}.ion-filing:before{content:"\f134"}.ion-film-marker:before{content:"\f135"}.ion-fireball:before{content:"\f319"}.ion-flag:before{content:"\f279"}.ion-flame:before{content:"\f31a"}.ion-flash:before{content:"\f137"}.ion-flash-off:before{content:"\f136"}.ion-folder:before{content:"\f139"}.ion-fork:before{content:"\f27a"}.ion-fork-repo:before{content:"\f2c0"}.ion-forward:before{content:"\f13a"}.ion-funnel:before{content:"\f31b"}.ion-gear-a:before{content:"\f13d"}.ion-gear-b:before{content:"\f13e"}.ion-grid:before{content:"\f13f"}.ion-hammer:before{content:"\f27b"}.ion-happy:before{content:"\f31c"}.ion-happy-outline:before{content:"\f3c6"}.ion-headphone:before{content:"\f140"}.ion-heart:before{content:"\f141"}.ion-heart-broken:before{content:"\f31d"}.ion-help:before{content:"\f143"}.ion-help-buoy:before{content:"\f27c"}.ion-help-circled:before{content:"\f142"}.ion-home:before{content:"\f144"}.ion-icecream:before{content:"\f27d"}.ion-image:before{content:"\f147"}.ion-images:before{content:"\f148"}.ion-information:before{content:"\f14a"}.ion-information-circled:before{content:"\f149"}.ion-ionic:before{content:"\f14b"}.ion-ios-alarm:before{content:"\f3c8"}.ion-ios-alarm-outline:before{content:"\f3c7"}.ion-ios-albums:before{content:"\f3ca"}.ion-ios-albums-outline:before{content:"\f3c9"}.ion-ios-americanfootball:before{content:"\f3cc"}.ion-ios-americanfootball-outline:before{content:"\f3cb"}.ion-ios-analytics:before{content:"\f3ce"}.ion-ios-analytics-outline:before{content:"\f3cd"}.ion-ios-arrow-back:before{content:"\f3cf"}.ion-ios-arrow-down:before{content:"\f3d0"}.ion-ios-arrow-forward:before{content:"\f3d1"}.ion-ios-arrow-left:before{content:"\f3d2"}.ion-ios-arrow-right:before{content:"\f3d3"}.ion-ios-arrow-thin-down:before{content:"\f3d4"}.ion-ios-arrow-thin-left:before{content:"\f3d5"}.ion-ios-arrow-thin-right:before{content:"\f3d6"}.ion-ios-arrow-thin-up:before{content:"\f3d7"}.ion-ios-arrow-up:before{content:"\f3d8"}.ion-ios-at:before{content:"\f3da"}.ion-ios-at-outline:before{content:"\f3d9"}.ion-ios-barcode:before{content:"\f3dc"}.ion-ios-barcode-outline:before{content:"\f3db"}.ion-ios-baseball:before{content:"\f3de"}.ion-ios-baseball-outline:before{content:"\f3dd"}.ion-ios-basketball:before{content:"\f3e0"}.ion-ios-basketball-outline:before{content:"\f3df"}.ion-ios-bell:before{content:"\f3e2"}.ion-ios-bell-outline:before{content:"\f3e1"}.ion-ios-body:before{content:"\f3e4"}.ion-ios-body-outline:before{content:"\f3e3"}.ion-ios-bolt:before{content:"\f3e6"}.ion-ios-bolt-outline:before{content:"\f3e5"}.ion-ios-book:before{content:"\f3e8"}.ion-ios-book-outline:before{content:"\f3e7"}.ion-ios-bookmarks:before{content:"\f3ea"}.ion-ios-bookmarks-outline:before{content:"\f3e9"}.ion-ios-box:before{content:"\f3ec"}.ion-ios-box-outline:before{content:"\f3eb"}.ion-ios-briefcase:before{content:"\f3ee"}.ion-ios-briefcase-outline:before{content:"\f3ed"}.ion-ios-browsers:before{content:"\f3f0"}.ion-ios-browsers-outline:before{content:"\f3ef"}.ion-ios-calculator:before{content:"\f3f2"}.ion-ios-calculator-outline:before{content:"\f3f1"}.ion-ios-calendar:before{content:"\f3f4"}.ion-ios-calendar-outline:before{content:"\f3f3"}.ion-ios-camera:before{content:"\f3f6"}.ion-ios-camera-outline:before{content:"\f3f5"}.ion-ios-cart:before{content:"\f3f8"}.ion-ios-cart-outline:before{content:"\f3f7"}.ion-ios-chatboxes:before{content:"\f3fa"}.ion-ios-chatboxes-outline:before{content:"\f3f9"}.ion-ios-chatbubble:before{content:"\f3fc"}.ion-ios-chatbubble-outline:before{content:"\f3fb"}.ion-ios-checkmark:before{content:"\f3ff"}.ion-ios-checkmark-empty:before{content:"\f3fd"}.ion-ios-checkmark-outline:before{content:"\f3fe"}.ion-ios-circle-filled:before{content:"\f400"}.ion-ios-circle-outline:before{content:"\f401"}.ion-ios-clock:before{content:"\f403"}.ion-ios-clock-outline:before{content:"\f402"}.ion-ios-close:before{content:"\f406"}.ion-ios-close-empty:before{content:"\f404"}.ion-ios-close-outline:before{content:"\f405"}.ion-ios-cloud:before{content:"\f40c"}.ion-ios-cloud-download:before{content:"\f408"}.ion-ios-cloud-download-outline:before{content:"\f407"}.ion-ios-cloud-outline:before{content:"\f409"}.ion-ios-cloud-upload:before{content:"\f40b"}.ion-ios-cloud-upload-outline:before{content:"\f40a"}.ion-ios-cloudy:before{content:"\f410"}.ion-ios-cloudy-night:before{content:"\f40e"}.ion-ios-cloudy-night-outline:before{content:"\f40d"}.ion-ios-cloudy-outline:before{content:"\f40f"}.ion-ios-cog:before{content:"\f412"}.ion-ios-cog-outline:before{content:"\f411"}.ion-ios-color-filter:before{content:"\f414"}.ion-ios-color-filter-outline:before{content:"\f413"}.ion-ios-color-wand:before{content:"\f416"}.ion-ios-color-wand-outline:before{content:"\f415"}.ion-ios-compose:before{content:"\f418"}.ion-ios-compose-outline:before{content:"\f417"}.ion-ios-contact:before{content:"\f41a"}.ion-ios-contact-outline:before{content:"\f419"}.ion-ios-copy:before{content:"\f41c"}.ion-ios-copy-outline:before{content:"\f41b"}.ion-ios-crop:before{content:"\f41e"}.ion-ios-crop-strong:before{content:"\f41d"}.ion-ios-download:before{content:"\f420"}.ion-ios-download-outline:before{content:"\f41f"}.ion-ios-drag:before{content:"\f421"}.ion-ios-email:before{content:"\f423"}.ion-ios-email-outline:before{content:"\f422"}.ion-ios-eye:before{content:"\f425"}.ion-ios-eye-outline:before{content:"\f424"}.ion-ios-fastforward:before{content:"\f427"}.ion-ios-fastforward-outline:before{content:"\f426"}.ion-ios-filing:before{content:"\f429"}.ion-ios-filing-outline:before{content:"\f428"}.ion-ios-film:before{content:"\f42b"}.ion-ios-film-outline:before{content:"\f42a"}.ion-ios-flag:before{content:"\f42d"}.ion-ios-flag-outline:before{content:"\f42c"}.ion-ios-flame:before{content:"\f42f"}.ion-ios-flame-outline:before{content:"\f42e"}.ion-ios-flask:before{content:"\f431"}.ion-ios-flask-outline:before{content:"\f430"}.ion-ios-flower:before{content:"\f433"}.ion-ios-flower-outline:before{content:"\f432"}.ion-ios-folder:before{content:"\f435"}.ion-ios-folder-outline:before{content:"\f434"}.ion-ios-football:before{content:"\f437"}.ion-ios-football-outline:before{content:"\f436"}.ion-ios-game-controller-a:before{content:"\f439"}.ion-ios-game-controller-a-outline:before{content:"\f438"}.ion-ios-game-controller-b:before{content:"\f43b"}.ion-ios-game-controller-b-outline:before{content:"\f43a"}.ion-ios-gear:before{content:"\f43d"}.ion-ios-gear-outline:before{content:"\f43c"}.ion-ios-glasses:before{content:"\f43f"}.ion-ios-glasses-outline:before{content:"\f43e"}.ion-ios-grid-view:before{content:"\f441"}.ion-ios-grid-view-outline:before{content:"\f440"}.ion-ios-heart:before{content:"\f443"}.ion-ios-heart-outline:before{content:"\f442"}.ion-ios-help:before{content:"\f446"}.ion-ios-help-empty:before{content:"\f444"}.ion-ios-help-outline:before{content:"\f445"}.ion-ios-home:before{content:"\f448"}.ion-ios-home-outline:before{content:"\f447"}.ion-ios-infinite:before{content:"\f44a"}.ion-ios-infinite-outline:before{content:"\f449"}.ion-ios-information:before{content:"\f44d"}.ion-ios-information-empty:before{content:"\f44b"}.ion-ios-information-outline:before{content:"\f44c"}.ion-ios-ionic-outline:before{content:"\f44e"}.ion-ios-keypad:before{content:"\f450"}.ion-ios-keypad-outline:before{content:"\f44f"}.ion-ios-lightbulb:before{content:"\f452"}.ion-ios-lightbulb-outline:before{content:"\f451"}.ion-ios-list:before{content:"\f454"}.ion-ios-list-outline:before{content:"\f453"}.ion-ios-location:before{content:"\f456"}.ion-ios-location-outline:before{content:"\f455"}.ion-ios-locked:before{content:"\f458"}.ion-ios-locked-outline:before{content:"\f457"}.ion-ios-loop:before{content:"\f45a"}.ion-ios-loop-strong:before{content:"\f459"}.ion-ios-medical:before{content:"\f45c"}.ion-ios-medical-outline:before{content:"\f45b"}.ion-ios-medkit:before{content:"\f45e"}.ion-ios-medkit-outline:before{content:"\f45d"}.ion-ios-mic:before{content:"\f461"}.ion-ios-mic-off:before{content:"\f45f"}.ion-ios-mic-outline:before{content:"\f460"}.ion-ios-minus:before{content:"\f464"}.ion-ios-minus-empty:before{content:"\f462"}.ion-ios-minus-outline:before{content:"\f463"}.ion-ios-monitor:before{content:"\f466"}.ion-ios-monitor-outline:before{content:"\f465"}.ion-ios-moon:before{content:"\f468"}.ion-ios-moon-outline:before{content:"\f467"}.ion-ios-more:before{content:"\f46a"}.ion-ios-more-outline:before{content:"\f469"}.ion-ios-musical-note:before{content:"\f46b"}.ion-ios-musical-notes:before{content:"\f46c"}.ion-ios-navigate:before{content:"\f46e"}.ion-ios-navigate-outline:before{content:"\f46d"}.ion-ios-nutrition:before{content:"\f470"}.ion-ios-nutrition-outline:before{content:"\f46f"}.ion-ios-paper:before{content:"\f472"}.ion-ios-paper-outline:before{content:"\f471"}.ion-ios-paperplane:before{content:"\f474"}.ion-ios-paperplane-outline:before{content:"\f473"}.ion-ios-partlysunny:before{content:"\f476"}.ion-ios-partlysunny-outline:before{content:"\f475"}.ion-ios-pause:before{content:"\f478"}.ion-ios-pause-outline:before{content:"\f477"}.ion-ios-paw:before{content:"\f47a"}.ion-ios-paw-outline:before{content:"\f479"}.ion-ios-people:before{content:"\f47c"}.ion-ios-people-outline:before{content:"\f47b"}.ion-ios-person:before{content:"\f47e"}.ion-ios-person-outline:before{content:"\f47d"}.ion-ios-personadd:before{content:"\f480"}.ion-ios-personadd-outline:before{content:"\f47f"}.ion-ios-photos:before{content:"\f482"}.ion-ios-photos-outline:before{content:"\f481"}.ion-ios-pie:before{content:"\f484"}.ion-ios-pie-outline:before{content:"\f483"}.ion-ios-pint:before{content:"\f486"}.ion-ios-pint-outline:before{content:"\f485"}.ion-ios-play:before{content:"\f488"}.ion-ios-play-outline:before{content:"\f487"}.ion-ios-plus:before{content:"\f48b"}.ion-ios-plus-empty:before{content:"\f489"}.ion-ios-plus-outline:before{content:"\f48a"}.ion-ios-pricetag:before{content:"\f48d"}.ion-ios-pricetag-outline:before{content:"\f48c"}.ion-ios-pricetags:before{content:"\f48f"}.ion-ios-pricetags-outline:before{content:"\f48e"}.ion-ios-printer:before{content:"\f491"}.ion-ios-printer-outline:before{content:"\f490"}.ion-ios-pulse:before{content:"\f493"}.ion-ios-pulse-strong:before{content:"\f492"}.ion-ios-rainy:before{content:"\f495"}.ion-ios-rainy-outline:before{content:"\f494"}.ion-ios-recording:before{content:"\f497"}.ion-ios-recording-outline:before{content:"\f496"}.ion-ios-redo:before{content:"\f499"}.ion-ios-redo-outline:before{content:"\f498"}.ion-ios-refresh:before{content:"\f49c"}.ion-ios-refresh-empty:before{content:"\f49a"}.ion-ios-refresh-outline:before{content:"\f49b"}.ion-ios-reload:before{content:"\f49d"}.ion-ios-reverse-camera:before{content:"\f49f"}.ion-ios-reverse-camera-outline:before{content:"\f49e"}.ion-ios-rewind:before{content:"\f4a1"}.ion-ios-rewind-outline:before{content:"\f4a0"}.ion-ios-rose:before{content:"\f4a3"}.ion-ios-rose-outline:before{content:"\f4a2"}.ion-ios-search:before{content:"\f4a5"}.ion-ios-search-strong:before{content:"\f4a4"}.ion-ios-settings:before{content:"\f4a7"}.ion-ios-settings-strong:before{content:"\f4a6"}.ion-ios-shuffle:before{content:"\f4a9"}.ion-ios-shuffle-strong:before{content:"\f4a8"}.ion-ios-skipbackward:before{content:"\f4ab"}.ion-ios-skipbackward-outline:before{content:"\f4aa"}.ion-ios-skipforward:before{content:"\f4ad"}.ion-ios-skipforward-outline:before{content:"\f4ac"}.ion-ios-snowy:before{content:"\f4ae"}.ion-ios-speedometer:before{content:"\f4b0"}.ion-ios-speedometer-outline:before{content:"\f4af"}.ion-ios-star:before{content:"\f4b3"}.ion-ios-star-half:before{content:"\f4b1"}.ion-ios-star-outline:before{content:"\f4b2"}.ion-ios-stopwatch:before{content:"\f4b5"}.ion-ios-stopwatch-outline:before{content:"\f4b4"}.ion-ios-sunny:before{content:"\f4b7"}.ion-ios-sunny-outline:before{content:"\f4b6"}.ion-ios-telephone:before{content:"\f4b9"}.ion-ios-telephone-outline:before{content:"\f4b8"}.ion-ios-tennisball:before{content:"\f4bb"}.ion-ios-tennisball-outline:before{content:"\f4ba"}.ion-ios-thunderstorm:before{content:"\f4bd"}.ion-ios-thunderstorm-outline:before{content:"\f4bc"}.ion-ios-time:before{content:"\f4bf"}.ion-ios-time-outline:before{content:"\f4be"}.ion-ios-timer:before{content:"\f4c1"}.ion-ios-timer-outline:before{content:"\f4c0"}.ion-ios-toggle:before{content:"\f4c3"}.ion-ios-toggle-outline:before{content:"\f4c2"}.ion-ios-trash:before{content:"\f4c5"}.ion-ios-trash-outline:before{content:"\f4c4"}.ion-ios-undo:before{content:"\f4c7"}.ion-ios-undo-outline:before{content:"\f4c6"}.ion-ios-unlocked:before{content:"\f4c9"}.ion-ios-unlocked-outline:before{content:"\f4c8"}.ion-ios-upload:before{content:"\f4cb"}.ion-ios-upload-outline:before{content:"\f4ca"}.ion-ios-videocam:before{content:"\f4cd"}.ion-ios-videocam-outline:before{content:"\f4cc"}.ion-ios-volume-high:before{content:"\f4ce"}.ion-ios-volume-low:before{content:"\f4cf"}.ion-ios-wineglass:before{content:"\f4d1"}.ion-ios-wineglass-outline:before{content:"\f4d0"}.ion-ios-world:before{content:"\f4d3"}.ion-ios-world-outline:before{content:"\f4d2"}.ion-ipad:before{content:"\f1f9"}.ion-iphone:before{content:"\f1fa"}.ion-ipod:before{content:"\f1fb"}.ion-jet:before{content:"\f295"}.ion-key:before{content:"\f296"}.ion-knife:before{content:"\f297"}.ion-laptop:before{content:"\f1fc"}.ion-leaf:before{content:"\f1fd"}.ion-levels:before{content:"\f298"}.ion-lightbulb:before{content:"\f299"}.ion-link:before{content:"\f1fe"}.ion-load-a:before{content:"\f29a"}.ion-load-b:before{content:"\f29b"}.ion-load-c:before{content:"\f29c"}.ion-load-d:before{content:"\f29d"}.ion-location:before{content:"\f1ff"}.ion-lock-combination:before{content:"\f4d4"}.ion-locked:before{content:"\f200"}.ion-log-in:before{content:"\f29e"}.ion-log-out:before{content:"\f29f"}.ion-loop:before{content:"\f201"}.ion-magnet:before{content:"\f2a0"}.ion-male:before{content:"\f2a1"}.ion-man:before{content:"\f202"}.ion-map:before{content:"\f203"}.ion-medkit:before{content:"\f2a2"}.ion-merge:before{content:"\f33f"}.ion-mic-a:before{content:"\f204"}.ion-mic-b:before{content:"\f205"}.ion-mic-c:before{content:"\f206"}.ion-minus:before{content:"\f209"}.ion-minus-circled:before{content:"\f207"}.ion-minus-round:before{content:"\f208"}.ion-model-s:before{content:"\f2c1"}.ion-monitor:before{content:"\f20a"}.ion-more:before{content:"\f20b"}.ion-mouse:before{content:"\f340"}.ion-music-note:before{content:"\f20c"}.ion-navicon:before{content:"\f20e"}.ion-navicon-round:before{content:"\f20d"}.ion-navigate:before{content:"\f2a3"}.ion-network:before{content:"\f341"}.ion-no-smoking:before{content:"\f2c2"}.ion-nuclear:before{content:"\f2a4"}.ion-outlet:before{content:"\f342"}.ion-paintbrush:before{content:"\f4d5"}.ion-paintbucket:before{content:"\f4d6"}.ion-paper-airplane:before{content:"\f2c3"}.ion-paperclip:before{content:"\f20f"}.ion-pause:before{content:"\f210"}.ion-person:before{content:"\f213"}.ion-person-add:before{content:"\f211"}.ion-person-stalker:before{content:"\f212"}.ion-pie-graph:before{content:"\f2a5"}.ion-pin:before{content:"\f2a6"}.ion-pinpoint:before{content:"\f2a7"}.ion-pizza:before{content:"\f2a8"}.ion-plane:before{content:"\f214"}.ion-planet:before{content:"\f343"}.ion-play:before{content:"\f215"}.ion-playstation:before{content:"\f30a"}.ion-plus:before{content:"\f218"}.ion-plus-circled:before{content:"\f216"}.ion-plus-round:before{content:"\f217"}.ion-podium:before{content:"\f344"}.ion-pound:before{content:"\f219"}.ion-power:before{content:"\f2a9"}.ion-pricetag:before{content:"\f2aa"}.ion-pricetags:before{content:"\f2ab"}.ion-printer:before{content:"\f21a"}.ion-pull-request:before{content:"\f345"}.ion-qr-scanner:before{content:"\f346"}.ion-quote:before{content:"\f347"}.ion-radio-waves:before{content:"\f2ac"}.ion-record:before{content:"\f21b"}.ion-refresh:before{content:"\f21c"}.ion-reply:before{content:"\f21e"}.ion-reply-all:before{content:"\f21d"}.ion-ribbon-a:before{content:"\f348"}.ion-ribbon-b:before{content:"\f349"}.ion-sad:before{content:"\f34a"}.ion-sad-outline:before{content:"\f4d7"}.ion-scissors:before{content:"\f34b"}.ion-search:before{content:"\f21f"}.ion-settings:before{content:"\f2ad"}.ion-share:before{content:"\f220"}.ion-shuffle:before{content:"\f221"}.ion-skip-backward:before{content:"\f222"}.ion-skip-forward:before{content:"\f223"}.ion-social-android:before{content:"\f225"}.ion-social-android-outline:before{content:"\f224"}.ion-social-angular:before{content:"\f4d9"}.ion-social-angular-outline:before{content:"\f4d8"}.ion-social-apple:before{content:"\f227"}.ion-social-apple-outline:before{content:"\f226"}.ion-social-bitcoin:before{content:"\f2af"}.ion-social-bitcoin-outline:before{content:"\f2ae"}.ion-social-buffer:before{content:"\f229"}.ion-social-buffer-outline:before{content:"\f228"}.ion-social-chrome:before{content:"\f4db"}.ion-social-chrome-outline:before{content:"\f4da"}.ion-social-codepen:before{content:"\f4dd"}.ion-social-codepen-outline:before{content:"\f4dc"}.ion-social-css3:before{content:"\f4df"}.ion-social-css3-outline:before{content:"\f4de"}.ion-social-designernews:before{content:"\f22b"}.ion-social-designernews-outline:before{content:"\f22a"}.ion-social-dribbble:before{content:"\f22d"}.ion-social-dribbble-outline:before{content:"\f22c"}.ion-social-dropbox:before{content:"\f22f"}.ion-social-dropbox-outline:before{content:"\f22e"}.ion-social-euro:before{content:"\f4e1"}.ion-social-euro-outline:before{content:"\f4e0"}.ion-social-facebook:before{content:"\f231"}.ion-social-facebook-outline:before{content:"\f230"}.ion-social-foursquare:before{content:"\f34d"}.ion-social-foursquare-outline:before{content:"\f34c"}.ion-social-freebsd-devil:before{content:"\f2c4"}.ion-social-github:before{content:"\f233"}.ion-social-github-outline:before{content:"\f232"}.ion-social-google:before{content:"\f34f"}.ion-social-google-outline:before{content:"\f34e"}.ion-social-googleplus:before{content:"\f235"}.ion-social-googleplus-outline:before{content:"\f234"}.ion-social-hackernews:before{content:"\f237"}.ion-social-hackernews-outline:before{content:"\f236"}.ion-social-html5:before{content:"\f4e3"}.ion-social-html5-outline:before{content:"\f4e2"}.ion-social-instagram:before{content:"\f351"}.ion-social-instagram-outline:before{content:"\f350"}.ion-social-javascript:before{content:"\f4e5"}.ion-social-javascript-outline:before{content:"\f4e4"}.ion-social-linkedin:before{content:"\f239"}.ion-social-linkedin-outline:before{content:"\f238"}.ion-social-markdown:before{content:"\f4e6"}.ion-social-nodejs:before{content:"\f4e7"}.ion-social-octocat:before{content:"\f4e8"}.ion-social-pinterest:before{content:"\f2b1"}.ion-social-pinterest-outline:before{content:"\f2b0"}.ion-social-python:before{content:"\f4e9"}.ion-social-reddit:before{content:"\f23b"}.ion-social-reddit-outline:before{content:"\f23a"}.ion-social-rss:before{content:"\f23d"}.ion-social-rss-outline:before{content:"\f23c"}.ion-social-sass:before{content:"\f4ea"}.ion-social-skype:before{content:"\f23f"}.ion-social-skype-outline:before{content:"\f23e"}.ion-social-snapchat:before{content:"\f4ec"}.ion-social-snapchat-outline:before{content:"\f4eb"}.ion-social-tumblr:before{content:"\f241"}.ion-social-tumblr-outline:before{content:"\f240"}.ion-social-tux:before{content:"\f2c5"}.ion-social-twitch:before{content:"\f4ee"}.ion-social-twitch-outline:before{content:"\f4ed"}.ion-social-twitter:before{content:"\f243"}.ion-social-twitter-outline:before{content:"\f242"}.ion-social-usd:before{content:"\f353"}.ion-social-usd-outline:before{content:"\f352"}.ion-social-vimeo:before{content:"\f245"}.ion-social-vimeo-outline:before{content:"\f244"}.ion-social-whatsapp:before{content:"\f4f0"}.ion-social-whatsapp-outline:before{content:"\f4ef"}.ion-social-windows:before{content:"\f247"}.ion-social-windows-outline:before{content:"\f246"}.ion-social-wordpress:before{content:"\f249"}.ion-social-wordpress-outline:before{content:"\f248"}.ion-social-yahoo:before{content:"\f24b"}.ion-social-yahoo-outline:before{content:"\f24a"}.ion-social-yen:before{content:"\f4f2"}.ion-social-yen-outline:before{content:"\f4f1"}.ion-social-youtube:before{content:"\f24d"}.ion-social-youtube-outline:before{content:"\f24c"}.ion-soup-can:before{content:"\f4f4"}.ion-soup-can-outline:before{content:"\f4f3"}.ion-speakerphone:before{content:"\f2b2"}.ion-speedometer:before{content:"\f2b3"}.ion-spoon:before{content:"\f2b4"}.ion-star:before{content:"\f24e"}.ion-stats-bars:before{content:"\f2b5"}.ion-steam:before{content:"\f30b"}.ion-stop:before{content:"\f24f"}.ion-thermometer:before{content:"\f2b6"}.ion-thumbsdown:before{content:"\f250"}.ion-thumbsup:before{content:"\f251"}.ion-toggle:before{content:"\f355"}.ion-toggle-filled:before{content:"\f354"}.ion-transgender:before{content:"\f4f5"}.ion-trash-a:before{content:"\f252"}.ion-trash-b:before{content:"\f253"}.ion-trophy:before{content:"\f356"}.ion-tshirt:before{content:"\f4f7"}.ion-tshirt-outline:before{content:"\f4f6"}.ion-umbrella:before{content:"\f2b7"}.ion-university:before{content:"\f357"}.ion-unlocked:before{content:"\f254"}.ion-upload:before{content:"\f255"}.ion-usb:before{content:"\f2b8"}.ion-videocamera:before{content:"\f256"}.ion-volume-high:before{content:"\f257"}.ion-volume-low:before{content:"\f258"}.ion-volume-medium:before{content:"\f259"}.ion-volume-mute:before{content:"\f25a"}.ion-wand:before{content:"\f358"}.ion-waterdrop:before{content:"\f25b"}.ion-wifi:before{content:"\f25c"}.ion-wineglass:before{content:"\f2b9"}.ion-woman:before{content:"\f25d"}.ion-wrench:before{content:"\f2ba"}.ion-xbox:before{content:"\f30c"}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.eot b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.eot
new file mode 100644
index 00000000..92a3f20a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.eot
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.svg
new file mode 100644
index 00000000..49fc8f36
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.svg
@@ -0,0 +1,2230 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<!--
+2014-12-4: Created.
+-->
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata>
+Created by FontForge 20120731 at Thu Dec 4 09:51:48 2014
+ By Adam Bradley
+Created by Adam Bradley with FontForge 2.0 (http://fontforge.sf.net)
+</metadata>
+<defs>
+<font id="Ionicons" horiz-adv-x="448" >
+ <font-face
+ font-family="Ionicons"
+ font-weight="500"
+ font-stretch="normal"
+ units-per-em="512"
+ panose-1="2 0 6 3 0 0 0 0 0 0"
+ ascent="448"
+ descent="-64"
+ bbox="-0.54049 -64 512.487 448"
+ underline-thickness="25.6"
+ underline-position="-51.2"
+ unicode-range="U+F100-F4F7"
+ />
+ <missing-glyph />
+ <glyph glyph-name="ion-alert-circled" unicode="&#xf100;"
+d="M445 26c3 -5 5 -13 2 -18s-8 -8 -14 -8h-418c-6 0 -11 3 -14 8s-1 13 2 18l207 349c3 5 8 9 14 9s11 -4 14 -9zM256 48v48h-64v-48h64zM256 128v144h-64v-144h64z" />
+ <glyph glyph-name="ion-alert" unicode="&#xf101;" horiz-adv-x="128"
+d="M128 -32h-128v96h128v-96zM112 128h-96l-16 288h128z" />
+ <glyph glyph-name="ion-android-add-circle" unicode="&#xf359;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM315 171v42h-86v86h-42v-86h-86v-42h86v-86h42v86h86z" />
+ <glyph glyph-name="ion-android-add" unicode="&#xf2c7;" horiz-adv-x="320"
+d="M320 171h-139v-139h-42v139h-139v42h139v139h42v-139h139v-42z" />
+ <glyph glyph-name="ion-android-alarm-clock" unicode="&#xf35a;" horiz-adv-x="428"
+d="M428 323l-28 -33l-98 82l28 33zM125 373l-97 -83l-28 33l97 83zM225 275v0v-111l85 -50l-16 -27l-101 61v127h32zM214 360c106 0 193 -86 193 -191s-87 -191 -193 -191c-107 0 -193 86 -193 191s86 191 193 191zM214 20c82 0 150 66 150 149c0 82 -68 149 -150 149
+s-150 -67 -150 -149s68 -149 150 -149z" />
+ <glyph glyph-name="ion-android-alert" unicode="&#xf35b;" horiz-adv-x="416"
+d="M208 400c114 0 208 -94 208 -208s-94 -208 -208 -208s-208 94 -208 208s94 208 208 208zM232 88v40h-48v-40h48zM232 176v128h-48v-128h48z" />
+ <glyph glyph-name="ion-android-apps" unicode="&#xf35c;" horiz-adv-x="320"
+d="M0 272v80h80v-80h-80zM120 32v80h80v-80h-80zM0 32v80h80v-80h-80zM0 152v80h80v-80h-80zM120 152v80h80v-80h-80zM240 352h80v-80h-80v80zM120 272v80h80v-80h-80zM240 152v80h80v-80h-80zM240 32v80h80v-80h-80z" />
+ <glyph glyph-name="ion-android-archive" unicode="&#xf2c9;" horiz-adv-x="416"
+d="M406 348c7 -7 10 -17 10 -29v-289c0 -25 -21 -46 -46 -46h-324c-25 0 -46 21 -46 46v289c0 12 3 22 10 29l33 39c6 8 16 13 26 13h278c10 0 20 -5 26 -13zM208 65l127 127h-81v46h-92v-46h-81zM49 354h317l-22 23h-277z" />
+ <glyph glyph-name="ion-android-arrow-back" unicode="&#xf2ca;" horiz-adv-x="342"
+d="M342 213v-42h-260l119 -120l-30 -30l-171 171l171 171l31 -30l-120 -120h260z" />
+ <glyph glyph-name="ion-android-arrow-down" unicode="&#xf35d;" horiz-adv-x="342"
+d="M192 363v-260l120 120l30 -31l-171 -171l-171 171l30 30l120 -119v260h42z" />
+ <glyph glyph-name="ion-android-arrow-dropdown-circle" unicode="&#xf35e;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM208 128l96 96h-192z" />
+ <glyph glyph-name="ion-android-arrow-dropdown" unicode="&#xf35f;" horiz-adv-x="256"
+d="M0 256h256l-128 -128z" />
+ <glyph glyph-name="ion-android-arrow-dropleft-circle" unicode="&#xf360;" horiz-adv-x="416"
+d="M416 192c0 -115 -93 -208 -208 -208s-208 93 -208 208s93 208 208 208s208 -93 208 -208zM144 192l96 -96v192z" />
+ <glyph glyph-name="ion-android-arrow-dropleft" unicode="&#xf361;" horiz-adv-x="128"
+d="M128 320v-256l-128 128z" />
+ <glyph glyph-name="ion-android-arrow-dropright-circle" unicode="&#xf362;" horiz-adv-x="416"
+d="M208 -16c-115 0 -208 93 -208 208s93 208 208 208s208 -93 208 -208s-93 -208 -208 -208zM176 96l96 96l-96 96v-192z" />
+ <glyph glyph-name="ion-android-arrow-dropright" unicode="&#xf363;" horiz-adv-x="128"
+d="M0 320l128 -128l-128 -128v256z" />
+ <glyph glyph-name="ion-android-arrow-dropup-circle" unicode="&#xf364;" horiz-adv-x="416"
+d="M416 192c0 -115 -93 -208 -208 -208s-208 93 -208 208s93 208 208 208s208 -93 208 -208zM304 160l-96 96l-96 -96h192z" />
+ <glyph glyph-name="ion-android-arrow-dropup" unicode="&#xf365;" horiz-adv-x="256"
+d="M0 128l128 128l128 -128h-256z" />
+ <glyph glyph-name="ion-android-arrow-forward" unicode="&#xf30f;" horiz-adv-x="342"
+d="M0 171v42h260l-119 120l30 30l171 -171l-171 -171l-31 30l120 120h-260z" />
+ <glyph glyph-name="ion-android-arrow-up" unicode="&#xf366;" horiz-adv-x="342"
+d="M192 21h-42v260l-120 -119l-30 30l171 171l171 -171l-30 -31l-120 120v-260z" />
+ <glyph glyph-name="ion-android-attach" unicode="&#xf367;" horiz-adv-x="235"
+d="M203 320h32v-235c0 -65 -53 -117 -118 -117s-117 52 -117 117v246c0 47 38 85 85 85s86 -38 86 -85v-246c0 -30 -24 -53 -54 -53s-53 23 -53 53v203h32v-203c0 -12 9 -21 21 -21s22 9 22 21v246c0 30 -24 53 -54 53s-53 -23 -53 -53v-246c0 -47 38 -85 85 -85
+s86 38 86 85v235z" />
+ <glyph glyph-name="ion-android-bar" unicode="&#xf368;" horiz-adv-x="384"
+d="M171 171l-171 170v43h384v-43l-171 -170v-131h107v-40h-256v40h107v131zM96 299h192l43 42h-278z" />
+ <glyph glyph-name="ion-android-bicycle" unicode="&#xf369;"
+d="M299 317c-19 0 -34 14 -34 33s15 34 34 34s33 -15 33 -34s-14 -33 -33 -33zM355 187c51 0 93 -43 93 -94s-42 -93 -93 -93s-94 42 -94 93s43 94 94 94zM355 28c36 0 65 29 65 65s-29 66 -65 66s-66 -30 -66 -66s30 -65 66 -65zM274 224l-30 45l-43 -45l39 -32v-112h-32
+v86l-61 38c-9 6 -19 15 -19 27c0 8 3 17 9 23l72 69c6 6 14 9 22 9c11 0 22 -7 28 -16l34 -60h59v-32h-78zM93 187c51 0 94 -43 94 -94s-43 -93 -94 -93s-93 42 -93 93s42 94 93 94zM93 28c36 0 66 29 66 65s-30 66 -66 66s-65 -30 -65 -66s29 -65 65 -65z" />
+ <glyph glyph-name="ion-android-boat" unicode="&#xf36a;"
+d="M52 35l-51 139c-2 6 -1 12 1 17s8 8 13 10l38 13v98c0 23 20 43 43 43h64l16 53h96l16 -53h64c23 0 43 -20 43 -43v-98l38 -13c5 -2 11 -5 13 -10s3 -12 1 -17l-51 -139h-1c-34 0 -65 20 -86 43c-21 -23 -51 -43 -85 -43s-64 19 -85 42c-21 -23 -52 -42 -86 -42h-1z
+M96 312v-84l128 41l128 -41v84h-256zM309 40c0 0 59 -64 107 -64h-21c-30 0 -59 12 -86 26c-53 -28 -117 -28 -170 0c-27 -14 -56 -26 -86 -26h-21c49 0 107 64 107 64c52 -36 118 -36 170 0z" />
+ <glyph glyph-name="ion-android-bookmark" unicode="&#xf36b;" horiz-adv-x="288"
+d="M248 384c22 0 40 -18 40 -40v-344l-144 64l-144 -64v344c0 22 18 40 40 40h208z" />
+ <glyph glyph-name="ion-android-bulb" unicode="&#xf36c;"
+d="M224 278c-25 0 -50 -10 -68 -28s-28 -43 -28 -68c0 -34 18 -66 48 -83l16 -10v-18v-71h64v71v18l16 10c15 8 27 20 35 34c9 15 13 31 13 49c0 25 -10 50 -28 68s-43 28 -68 28zM245 416v0v-64h-42v64h42zM374 362v0l30 -30l-38 -38l-30 30zM74 362v0l38 -38l-30 -30
+l-38 38zM224 310v0c70 0 128 -58 128 -128c0 -48 -26 -89 -64 -111v-103h-128v103c-38 22 -64 64 -64 111c0 70 58 128 128 128zM448 203v0v-42h-64v42h64zM64 203v0v-42h-64v42h64z" />
+ <glyph glyph-name="ion-android-bus" unicode="&#xf36d;" horiz-adv-x="352"
+d="M0 96v204c0 75 82 84 176 84s176 -9 176 -84v-204c0 -18 -14 -24 -27 -36v-39c0 -12 -9 -21 -21 -21h-21c-12 0 -22 9 -22 21v22h-170v-22c0 -12 -10 -21 -22 -21h-21c-12 0 -21 9 -21 21v39c-13 12 -27 17 -27 36zM80 80c18 0 32 14 32 32s-14 32 -32 32
+s-32 -14 -32 -32s14 -32 32 -32zM272 80c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM304 203v106h-256v-106h256z" />
+ <glyph glyph-name="ion-android-calendar" unicode="&#xf2d1;" horiz-adv-x="384"
+d="M304 176v-96h-96v96h96zM272 384h48v-32h24c22 0 40 -18 40 -40v-272c0 -22 -18 -40 -40 -40h-304c-22 0 -40 18 -40 40v272c0 22 18 40 40 40h24v32h48v-32h160v32zM344 40v212h-304v-212h304z" />
+ <glyph glyph-name="ion-android-call" unicode="&#xf2d2;" horiz-adv-x="384"
+d="M363 117c12 0 21 -9 21 -21v-75c0 -12 -9 -21 -21 -21c-201 0 -363 162 -363 363c0 12 9 21 21 21h75c12 0 21 -9 21 -21c0 -27 4 -52 13 -77c2 -7 0 -16 -5 -21l-47 -47c31 -61 80 -110 141 -141l47 47c5 6 14 7 21 5c23 -7 49 -12 76 -12z" />
+ <glyph glyph-name="ion-android-camera" unicode="&#xf2d3;"
+d="M161 168c0 42 21 63 63 63s63 -21 63 -63s-21 -63 -63 -63s-63 21 -63 63zM408 352c11 0 20 -4 28 -12s12 -17 12 -28v-272c0 -11 -4 -20 -12 -28s-17 -12 -28 -12h-368c-11 0 -20 4 -28 12s-12 17 -12 28v272c0 11 4 20 12 28s17 12 28 12h88l32 32h128l32 -32h88z
+M224 56c31 0 57 11 79 33s33 48 33 79s-11 57 -33 79s-48 33 -79 33s-57 -11 -79 -33s-33 -48 -33 -79s11 -57 33 -79s48 -33 79 -33z" />
+ <glyph glyph-name="ion-android-cancel" unicode="&#xf36e;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM312 117l-75 75l75 75l-29 29l-75 -75l-75 75l-29 -29l75 -75l-75 -75l29 -29l75 75l75 -75z" />
+ <glyph glyph-name="ion-android-car" unicode="&#xf36f;" horiz-adv-x="384"
+d="M339 331l45 -118v-160c0 -12 -9 -21 -21 -21h-22c-12 0 -21 9 -21 21v11h-256v-11c0 -12 -9 -21 -21 -21h-22c-12 0 -21 9 -21 21v160l45 118c4 13 16 21 30 21h234c14 0 26 -8 30 -21zM75 128c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM309 128
+c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM43 235h298l-32 85h-234z" />
+ <glyph glyph-name="ion-android-cart" unicode="&#xf370;" horiz-adv-x="416"
+d="M122 70c23 0 41 -18 41 -41s-18 -42 -41 -42s-42 19 -42 42s19 41 42 41zM0 397h68l19 -42h308c11 0 21 -9 21 -20c0 -4 -1 -8 -2 -10l-75 -129c-7 -14 -20 -22 -36 -22h-155l-21 -32s-2 -5 -2 -6c0 -3 2 -5 5 -5h238v-40h-243c-26 0 -45 14 -45 42c0 7 2 15 5 20l31 51
+l-74 151h-42v42zM326 70c23 0 42 -18 42 -41s-19 -42 -42 -42s-41 19 -41 42s18 41 41 41z" />
+ <glyph glyph-name="ion-android-chat" unicode="&#xf2d4;" horiz-adv-x="416"
+d="M344 384c4 0 7 -4 7 -8v-214c0 -4 -3 -9 -7 -9h-187l-90 -89v89h-57c-4 0 -10 5 -10 9v214c0 4 6 8 10 8h334zM408 321c4 0 8 -5 8 -9v-214c0 -4 -4 -9 -8 -9h-57v-89l-90 89h-130l39 39h181c18 0 25 10 25 26v167h32z" />
+ <glyph glyph-name="ion-android-checkbox-blank" unicode="&#xf371;" horiz-adv-x="384"
+d="M341 384c23 0 43 -20 43 -43v-298c0 -23 -20 -43 -43 -43h-298c-23 0 -43 20 -43 43v298c0 23 20 43 43 43h298z" />
+ <glyph glyph-name="ion-android-checkbox-outline-blank" unicode="&#xf372;" horiz-adv-x="384"
+d="M341 341h-298v-298h298v298zM341 384v0c23 0 43 -20 43 -43v-298c0 -23 -20 -43 -43 -43h-298c-23 0 -43 20 -43 43v298c0 23 20 43 43 43h298z" />
+ <glyph glyph-name="ion-android-checkbox-outline" unicode="&#xf373;" horiz-adv-x="384"
+d="M105 233l66 -66l183 183l30 -30l-213 -213l-96 96zM341 43v170h43v-170c0 -23 -20 -43 -43 -43h-298c-23 0 -43 20 -43 43v298c0 23 20 43 43 43h213v-43h-213v-298h298z" />
+ <glyph glyph-name="ion-android-checkbox" unicode="&#xf374;" horiz-adv-x="384"
+d="M341 384c23 0 43 -20 43 -43v-298c0 -23 -20 -43 -43 -43h-298c-23 0 -43 20 -43 43v298c0 23 20 43 43 43h298zM149 85l192 192l-30 30l-162 -162l-76 77l-30 -30z" />
+ <glyph glyph-name="ion-android-checkmark-circle" unicode="&#xf375;" horiz-adv-x="416"
+d="M123 232l64 -64l179 178l29 -29l-208 -208l-93 93zM374 192h42c0 -114 -94 -208 -208 -208s-208 94 -208 208s94 208 208 208c28 0 54 -6 78 -16l-32 -32c-15 4 -30 6 -46 6c-92 0 -166 -74 -166 -166s74 -166 166 -166s166 74 166 166z" />
+ <glyph glyph-name="ion-android-clipboard" unicode="&#xf376;" horiz-adv-x="384"
+d="M341 368c23 0 43 -20 43 -43v-314c0 -23 -20 -43 -43 -43h-298c-23 0 -43 20 -43 43v314c0 23 20 43 43 43h87c7 28 32 48 62 48s55 -20 62 -48h87zM192 368c-12 0 -21 -9 -21 -21s9 -22 21 -22s21 10 21 22s-9 21 -21 21zM344 8v320h-40v-72h-224v72h-40v-320h304z" />
+ <glyph glyph-name="ion-android-close" unicode="&#xf2d7;" horiz-adv-x="298"
+d="M298 311l-119 -119l119 -119l-30 -30l-119 119l-119 -119l-30 30l119 119l-119 119l30 30l119 -119l119 119z" />
+ <glyph glyph-name="ion-android-cloud-circle" unicode="&#xf377;" horiz-adv-x="416"
+d="M208 400c114 0 208 -94 208 -208s-94 -208 -208 -208s-208 94 -208 208s94 208 208 208zM302 109c29 0 52 23 52 52s-23 52 -52 52h-11c0 46 -37 83 -83 83c-38 0 -71 -26 -80 -62h-3c-34 0 -63 -29 -63 -63s29 -62 63 -62h177z" />
+ <glyph glyph-name="ion-android-cloud-done" unicode="&#xf378;" horiz-adv-x="480"
+d="M387 231c52 -3 93 -46 93 -99c0 -55 -45 -100 -100 -100h-260c-66 0 -120 54 -120 120c0 62 47 113 107 119c25 48 75 81 133 81c73 0 133 -52 147 -121zM197 85l141 141l-30 30l-111 -111l-44 45l-30 -30z" />
+ <glyph glyph-name="ion-android-cloud-outline" unicode="&#xf379;" horiz-adv-x="480"
+d="M387 231c52 -3 93 -46 93 -99c0 -55 -45 -100 -100 -100h-260c-66 0 -120 54 -120 120c0 62 47 113 107 119c25 48 75 81 133 81c73 0 133 -52 147 -121zM380 72c33 0 60 27 60 60s-27 60 -60 60h-30v10c0 61 -49 110 -110 110c-51 0 -93 -34 -106 -80h-14
+c-44 0 -80 -36 -80 -80s36 -80 80 -80h260z" />
+ <glyph glyph-name="ion-android-cloud" unicode="&#xf37a;" horiz-adv-x="480"
+d="M387 231c52 -3 93 -46 93 -99c0 -55 -45 -100 -100 -100h-260c-66 0 -120 54 -120 120c0 62 47 113 107 119c25 48 75 81 133 81c73 0 133 -52 147 -121z" />
+ <glyph glyph-name="ion-android-color-palette" unicode="&#xf37b;" horiz-adv-x="384"
+d="M192 384c106 0 192 -77 192 -171c0 -59 -48 -106 -107 -106h-38c-18 0 -32 -14 -32 -32c0 -9 3 -17 8 -22s9 -12 9 -21c0 -18 -14 -32 -32 -32c-106 0 -192 86 -192 192s86 192 192 192zM75 192c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM139 277
+c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM245 277c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM309 192c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32z" />
+ <glyph glyph-name="ion-android-compass" unicode="&#xf37c;"
+d="M224 217c13 0 25 -12 25 -25s-12 -25 -25 -25s-25 12 -25 25s12 25 25 25zM224 416c123 0 224 -101 224 -224s-101 -224 -224 -224s-224 101 -224 224s101 224 224 224zM273 143l85 183l-183 -85l-85 -183z" />
+ <glyph glyph-name="ion-android-contact" unicode="&#xf2d8;" horiz-adv-x="384"
+d="M267 110c59 -18 104 -58 117 -110h-384c13 52 58 92 117 110c22 -13 48 -20 75 -20s53 7 75 20zM192 384c73 0 132 -59 132 -132s-59 -132 -132 -132s-132 59 -132 132s59 132 132 132zM192 153c42 0 78 26 92 63h-184c14 -37 50 -63 92 -63z" />
+ <glyph glyph-name="ion-android-contacts" unicode="&#xf2d9;"
+d="M207 104c47 -14 76 -62 87 -104h-294c11 42 40 90 87 104c18 -10 38 -16 60 -16s42 6 60 16zM147 328c58 0 106 -48 106 -106s-48 -106 -106 -106s-106 48 -106 106s48 106 106 106zM147 141c34 0 62 23 74 51h-148c12 -28 40 -51 74 -51zM291 64c-13 20 -34 43 -60 53
+c11 9 21 23 28 35c13 -5 27 -8 42 -8c22 0 42 6 60 16c47 -14 76 -54 87 -96h-157zM275 248c-8 37 -31 69 -63 87c19 29 52 49 89 49c58 0 106 -48 106 -106s-48 -106 -106 -106c-11 0 -22 2 -32 5c3 8 6 16 7 25c8 -3 16 -4 25 -4c34 0 62 22 74 50h-100z" />
+ <glyph glyph-name="ion-android-contract" unicode="&#xf37d;" horiz-adv-x="384"
+d="M0 77v51h128v-128h-51v77h-77zM77 307v77h51v-128h-128v51h77zM256 0v128h128v-51h-77v-77h-51zM307 307h77v-51h-128v128h51v-77z" />
+ <glyph glyph-name="ion-android-create" unicode="&#xf37e;" horiz-adv-x="384"
+d="M0 80l236 236l80 -80l-236 -236h-80v80zM378 298l-40 -40l-80 80l40 40c9 9 20 9 29 0l51 -51c9 -9 9 -20 0 -29z" />
+ <glyph glyph-name="ion-android-delete" unicode="&#xf37f;" horiz-adv-x="320"
+d="M32 43v245h256v-245c0 -23 -20 -43 -43 -43h-170c-23 0 -43 20 -43 43zM320 352v-32h-320v32h80l27 32h106l27 -32h80z" />
+ <glyph glyph-name="ion-android-desktop" unicode="&#xf380;"
+d="M405 416c23 0 43 -20 43 -43v-282c0 -23 -20 -43 -43 -43h-138l42 -48v-32h-170v32l42 48h-138c-23 0 -43 20 -43 43v282c0 23 20 43 43 43h362zM405 128v245h-362v-245h362z" />
+ <glyph glyph-name="ion-android-document" unicode="&#xf381;" horiz-adv-x="320"
+d="M192 400l128 -128v-248c0 -22 -18 -40 -40 -40h-240c-22 0 -40 18 -40 40v336c0 22 18 40 40 40h152zM176 256h112l-112 112v-112z" />
+ <glyph glyph-name="ion-android-done-all" unicode="&#xf382;" horiz-adv-x="512"
+d="M388 308l-140 -139l-31 31l140 139zM481 339l31 -31l-264 -263l-122 123l30 31l92 -91zM0 168l32 31l122 -123l-31 -31z" />
+ <glyph glyph-name="ion-android-done" unicode="&#xf383;" horiz-adv-x="384"
+d="M122 108l230 230l32 -31l-262 -261l-122 122l32 31z" />
+ <glyph glyph-name="ion-android-download" unicode="&#xf2dd;" horiz-adv-x="480"
+d="M387 231c52 -3 93 -46 93 -99c0 -55 -45 -100 -100 -100h-260c-66 0 -120 54 -120 120c0 62 47 113 107 119c25 48 75 81 133 81c73 0 133 -52 147 -121zM208 180h-68l100 -100l100 100h-68v76h-64v-76z" />
+ <glyph glyph-name="ion-android-drafts" unicode="&#xf384;"
+d="M448 246v-203c0 -23 -20 -43 -43 -43h-362c-23 0 -43 20 -43 43v203c0 15 8 30 20 37l204 101l204 -101c13 -7 20 -22 20 -37zM224 144l171 112l-171 85l-171 -85z" />
+ <glyph glyph-name="ion-android-exit" unicode="&#xf385;" horiz-adv-x="384"
+d="M151 115l55 56h-206v42h207l-56 56l30 30l107 -107l-107 -107zM341 384c23 0 43 -20 43 -43v-298c0 -23 -20 -43 -43 -43h-298c-23 0 -43 20 -43 43v85h43v-85h298v298h-298v-85h-43v85c0 23 20 43 43 43h298z" />
+ <glyph glyph-name="ion-android-expand" unicode="&#xf386;" horiz-adv-x="384"
+d="M333 51v77h51v-128h-128v51h77zM333 333h-77v51h128v-128h-51v77zM51 333v-77h-51v128h128v-51h-77zM51 51h77v-51h-128v128h51v-77z" />
+ <glyph glyph-name="ion-android-favorite-outline" unicode="&#xf387;" horiz-adv-x="416"
+d="M302 384c64 0 114 -50 114 -115c0 -80 -71 -144 -178 -242l-30 -27l-30 27c-107 98 -178 162 -178 242c0 65 50 115 114 115c36 0 71 -17 94 -44c23 27 58 44 94 44zM221 55c50 46 94 86 123 122c28 35 40 63 40 92c0 23 -9 44 -24 59s-35 24 -58 24
+c-26 0 -53 -13 -70 -33l-24 -29l-24 29c-17 20 -44 33 -70 33c-23 0 -43 -9 -58 -24s-24 -36 -24 -59c0 -29 12 -57 40 -92c29 -36 73 -76 123 -122l4 -4l9 -8l9 8z" />
+ <glyph glyph-name="ion-android-favorite" unicode="&#xf388;" horiz-adv-x="416"
+d="M208 0l-30 27c-107 98 -178 162 -178 242c0 65 50 115 114 115c36 0 71 -17 94 -44c23 27 58 44 94 44c64 0 114 -50 114 -115c0 -80 -71 -144 -178 -242z" />
+ <glyph glyph-name="ion-android-film" unicode="&#xf389;" horiz-adv-x="320"
+d="M280 384h40v-384h-40v43h-40v-43h-160v43h-40v-43h-40v384h40v-43h40v43h160v-43h40v43zM80 85v43h-40v-43h40zM80 171v42h-40v-42h40zM80 256v43h-40v-43h40zM280 85v43h-40v-43h40zM280 171v42h-40v-42h40zM280 256v43h-40v-43h40z" />
+ <glyph glyph-name="ion-android-folder-open" unicode="&#xf38a;"
+d="M405 304c23 0 43 -20 43 -43v-186c0 -23 -20 -43 -43 -43h-362c-23 0 -43 20 -43 43v234c0 23 20 43 43 43h138l43 -48h181zM416 75v186c0 6 -5 11 -11 11h-373v-197c0 -6 5 -11 11 -11h362c6 0 11 5 11 11z" />
+ <glyph glyph-name="ion-android-folder" unicode="&#xf2e0;"
+d="M181 352l43 -48h181c23 0 43 -20 43 -43v-186c0 -23 -20 -43 -43 -43h-362c-23 0 -43 20 -43 43v234c0 23 20 43 43 43h138z" />
+ <glyph glyph-name="ion-android-funnel" unicode="&#xf38b;"
+d="M176 48v48h96v-48h-96zM0 336h448v-48h-448v48zM80 167v50h288v-50h-288z" />
+ <glyph glyph-name="ion-android-globe" unicode="&#xf38c;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM186 15c6 15 21 29 8 39c-8 7 -16 14 -23 21c-2 2 -11 20 -9 23c5 9 6 14 8 24c3 12 -3 16 -13 22c-15 10 -29 23 -43 34c-7 5 -17 10 -20 19s-5 20 -10 28c-14 20 -12 34 -10 58
+c0 7 -1 16 -2 25c-28 -32 -42 -73 -42 -116c0 -48 18 -92 52 -126c29 -29 65 -46 104 -51zM334 66c23 23 39 51 47 82c-8 -1 -19 2 -19 2s-21 24 -23 45c-2 22 0 39 -3 57c-3 16 -20 31 -27 46c-7 14 -13 28 -20 42c2 -1 5 -2 7 -3c5 1 10 2 14 2c-23 16 -49 25 -76 29v-8
+l4 -9l-14 -13l-9 3l-10 10l-10 12l-14 5c-16 -2 -31 -7 -45 -13v-7c7 3 16 5 23 8c3 1 13 -7 16 -9c-4 -5 -21 -15 -22 -21c0 -2 7 -6 7 -10c0 -6 -1 -11 -1 -17c3 3 20 21 22 21c13 3 35 -19 37 -26s-22 -24 -33 -34c-8 -8 -25 -12 -20 -24c2 -4 10 -20 5 -24
+c-6 -5 -14 9 -17 12c-8 10 -26 7 -38 7c0 -17 -1 -31 15 -43c15 -11 30 -25 47 -33c13 -6 36 7 47 -1c16 -11 29 -21 47 -29c8 -3 33 -20 26 -31c-5 -8 -10 -15 -14 -23s-13 -20 -20 -25c-8 -6 -16 -17 -21 -29c35 7 66 23 92 49z" />
+ <glyph glyph-name="ion-android-hand" unicode="&#xf2e3;" horiz-adv-x="414"
+d="M401 174c15 -15 18 -36 3 -51c0 0 -96 -103 -126 -121v0c-28 -21 -65 -34 -100 -34c-55 0 -101 36 -117 85v0v1c0 1 -1 2 -1 3l-58 189c-5 15 2 32 17 37s30 -3 35 -18l34 -88c1 -4 2 -2 2 1l-22 161c-3 15 7 30 22 33s30 -8 33 -23l25 -138c0 -2 2 -2 2 0v177
+c0 15 13 28 28 28s28 -13 28 -28l8 -175c0 -5 3 -4 4 -1l23 135c2 15 16 27 31 25s27 -17 25 -32l-21 -172c-1 -12 -3 -30 2 -36c8 -9 20 -9 31 2l42 42c15 15 35 13 50 -2z" />
+ <glyph glyph-name="ion-android-hangout" unicode="&#xf38d;" horiz-adv-x="352"
+d="M176 400c97 0 176 -77 176 -172c0 -91 -76 -196 -176 -244v71c-97 0 -176 78 -176 173s79 172 176 172zM166 217v61h-62v-61h31l-21 -40h31zM248 217v61h-62v-61h31l-20 -40h31z" />
+ <glyph glyph-name="ion-android-happy" unicode="&#xf38e;" horiz-adv-x="416"
+d="M208 400c114 0 208 -94 208 -208s-93 -208 -208 -208s-208 94 -208 208s93 208 208 208zM208 26c92 0 166 74 166 166s-74 166 -166 166s-166 -74 -166 -166s74 -166 166 -166zM281 213c-18 0 -31 13 -31 31s13 31 31 31s31 -13 31 -31s-13 -31 -31 -31zM135 213
+c-18 0 -31 13 -31 31s13 31 31 31s31 -13 31 -31s-13 -31 -31 -31zM208 78c-49 0 -89 29 -106 72h212c-17 -43 -57 -72 -106 -72z" />
+ <glyph glyph-name="ion-android-home" unicode="&#xf38f;" horiz-adv-x="416"
+d="M160 0h-98v192h-62l208 192l208 -192h-62v-192h-98v128h-96v-128z" />
+ <glyph glyph-name="ion-android-image" unicode="&#xf2e4;" horiz-adv-x="384"
+d="M384 43c0 -23 -20 -43 -43 -43h-298c-23 0 -43 20 -43 43v298c0 23 20 43 43 43h298c23 0 43 -20 43 -43v-298zM117 160l-74 -96h298l-96 128l-74 -96z" />
+ <glyph glyph-name="ion-android-laptop" unicode="&#xf390;" horiz-adv-x="512"
+d="M437 32h75c0 -23 -64 -32 -96 -32h-320c-32 0 -96 9 -96 32h75c-23 0 -43 20 -43 43v266c0 23 20 43 43 43h362c23 0 43 -20 43 -43v-266c0 -23 -20 -43 -43 -43zM75 341v-272h362v272h-362zM256 13c12 0 21 10 21 22s-9 21 -21 21s-21 -9 -21 -21s9 -22 21 -22z" />
+ <glyph glyph-name="ion-android-list" unicode="&#xf391;" horiz-adv-x="384"
+d="M344 384c22 0 40 -18 40 -40v-304c0 -22 -18 -40 -40 -40h-304c-22 0 -40 18 -40 40v304c0 22 18 40 40 40h304zM240 80v48h-160v-48h160zM304 168v48h-224v-48h224zM304 256v48h-224v-48h224z" />
+ <glyph glyph-name="ion-android-locate" unicode="&#xf2e9;"
+d="M224 272c44 0 80 -36 80 -80s-36 -80 -80 -80s-80 36 -80 80s36 80 80 80zM415 213h33v-42h-33c-10 -89 -81 -160 -170 -170v-33h-42v33c-89 10 -160 81 -170 170h-33v42h33c10 89 81 160 170 170v33h42v-33c89 -10 160 -81 170 -170zM224 43c82 0 149 67 149 149
+s-67 149 -149 149s-149 -67 -149 -149s67 -149 149 -149z" />
+ <glyph glyph-name="ion-android-lock" unicode="&#xf392;" horiz-adv-x="320"
+d="M280 262c22 0 40 -18 40 -40v-200c0 -22 -18 -40 -40 -40h-240c-22 0 -40 18 -40 40v200c0 22 18 40 40 40h20v40c0 55 45 100 100 100s100 -45 100 -100v-40h20zM160 80c22 0 40 18 40 40s-18 40 -40 40s-40 -18 -40 -40s18 -40 40 -40zM222 262v40c0 34 -28 62 -62 62
+s-62 -28 -62 -62v-40h124z" />
+ <glyph glyph-name="ion-android-mail" unicode="&#xf2eb;"
+d="M405 368c23 0 43 -20 43 -43v-266c0 -23 -20 -43 -43 -43h-362c-23 0 -43 20 -43 43v266c0 23 20 43 43 43h362zM400 277v43l-176 -117l-176 117v-43l176 -117z" />
+ <glyph glyph-name="ion-android-map" unicode="&#xf393;" horiz-adv-x="384"
+d="M373 384c6 0 11 -5 11 -11v-322c0 -5 -3 -9 -7 -10l-121 -41l-128 45s-105 -41 -108 -42s-7 -3 -9 -3c-6 0 -11 5 -11 11v322c0 5 3 9 7 10l121 41l128 -45s103 40 108 42s7 3 9 3zM256 43v254l-128 44v-254z" />
+ <glyph glyph-name="ion-android-menu" unicode="&#xf394;" horiz-adv-x="384"
+d="M0 64v43h384v-43h-384zM0 171v42h384v-42h-384zM0 320h384v-43h-384v43z" />
+ <glyph glyph-name="ion-android-microphone-off" unicode="&#xf395;" horiz-adv-x="408"
+d="M316 93l58 -58l-58 58l58 -58l34 -33l-24 -24l-95 95c-19 -11 -40 -20 -62 -23v-82h-46v82c-75 10 -137 76 -137 153h39c0 -68 58 -117 121 -117c20 0 40 5 57 14l-32 33c-8 -3 -16 -5 -25 -5c-38 0 -69 31 -69 69v29l-135 134l24 24l111 -110v0l140 -140l5 -5l9 -9z
+M273 197c0 -4 0 -8 -1 -12l-137 137v25c0 38 31 69 69 69s69 -31 69 -69v-150zM365 203c0 -31 -10 -60 -27 -84l-27 28c9 17 15 36 15 56h39zM408 2v0l-34 33z" />
+ <glyph glyph-name="ion-android-microphone" unicode="&#xf2ec;" horiz-adv-x="320"
+d="M160 128c-38 0 -69 31 -69 69v150c0 38 31 69 69 69s69 -31 69 -69v-150c0 -38 -31 -69 -69 -69zM281 203h39c0 -78 -62 -142 -137 -153v-82h-46v82c-75 10 -137 75 -137 153h39c0 -69 58 -116 121 -116s121 47 121 116z" />
+ <glyph glyph-name="ion-android-more-horizontal" unicode="&#xf396;" horiz-adv-x="320"
+d="M40 232c22 0 40 -18 40 -40s-18 -40 -40 -40s-40 18 -40 40s18 40 40 40zM280 232c22 0 40 -18 40 -40s-18 -40 -40 -40s-40 18 -40 40s18 40 40 40zM160 232c22 0 40 -18 40 -40s-18 -40 -40 -40s-40 18 -40 40s18 40 40 40z" />
+ <glyph glyph-name="ion-android-more-vertical" unicode="&#xf397;" horiz-adv-x="80"
+d="M80 312c0 -22 -18 -40 -40 -40s-40 18 -40 40s18 40 40 40s40 -18 40 -40zM80 72c0 -22 -18 -40 -40 -40s-40 18 -40 40s18 40 40 40s40 -18 40 -40zM80 192c0 -22 -18 -40 -40 -40s-40 18 -40 40s18 40 40 40s40 -18 40 -40z" />
+ <glyph glyph-name="ion-android-navigate" unicode="&#xf398;" horiz-adv-x="320"
+d="M160 384l160 -369l-15 -15l-145 64l-145 -64l-15 15z" />
+ <glyph glyph-name="ion-android-notifications-none" unicode="&#xf399;" horiz-adv-x="352"
+d="M177 328h-2c-6 0 -24 -5 -24 -5c-46 -10 -78 -53 -78 -100v-114v-13l-9 -10l-8 -8h240l-8 8l-9 10v13v114c0 47 -32 90 -78 100c0 0 -17 5 -24 5zM176 400v0c18 0 31 -13 31 -31v-15c59 -14 104 -68 104 -131v-114l41 -42v-21h-352v21l41 42v114c0 63 45 117 104 131v15
+c0 18 13 31 31 31zM217 26v0c0 -23 -18 -42 -41 -42s-41 19 -41 42h82z" />
+ <glyph glyph-name="ion-android-notifications-off" unicode="&#xf39a;" horiz-adv-x="364"
+d="M182 -16c-23 0 -41 19 -41 42h82c0 -23 -18 -42 -41 -42zM57 341l295 -295v0l12 -12l-24 -24l-36 36h-298v21l41 41v115c0 23 6 44 16 63l-63 64l24 24l33 -33v0zM317 223v-94l-208 207c13 8 27 15 42 18v15c0 18 13 31 31 31s31 -13 31 -31v-15c59 -14 104 -67 104 -131
+z" />
+ <glyph glyph-name="ion-android-notifications" unicode="&#xf39b;" horiz-adv-x="352"
+d="M176 -16c-23 0 -41 19 -41 42h82c0 -23 -18 -42 -41 -42zM311 109l41 -42v-21h-352v21l41 42v114c0 63 45 117 104 131v15c0 18 13 31 31 31s31 -13 31 -31v-15c59 -14 104 -68 104 -131v-114z" />
+ <glyph glyph-name="ion-android-open" unicode="&#xf39c;" horiz-adv-x="384"
+d="M341 43v133h43v-133c0 -23 -20 -43 -43 -43h-298c-23 0 -43 20 -43 43v298c0 23 20 43 43 43h133v-43h-133v-298h298zM224 384h160v-160h-43v87l-215 -215l-30 30l215 215h-87v43z" />
+ <glyph glyph-name="ion-android-options" unicode="&#xf39d;"
+d="M0 32v32h272v-32h-272zM368 32v32h80v-32h-80zM352 0c0 -18 -14 -32 -32 -32v0c-18 0 -32 14 -32 32v96c0 18 14 32 32 32v0c18 0 32 -14 32 -32v-96zM0 176v32h80v-32h-80zM176 176v32h272v-32h-272zM160 144c0 -18 -14 -32 -32 -32v0c-18 0 -32 14 -32 32v96
+c0 18 14 32 32 32v0c18 0 32 -14 32 -32v-96zM0 320v32h272v-32h-272zM368 320v32h80v-32h-80zM352 288c0 -18 -14 -32 -32 -32v0c-18 0 -32 14 -32 32v96c0 18 14 32 32 32v0c18 0 32 -14 32 -32v-96z" />
+ <glyph glyph-name="ion-android-people" unicode="&#xf39e;"
+d="M305 216c-34 0 -61 27 -61 60s27 60 61 60s62 -27 62 -60s-28 -60 -62 -60zM143 216c-34 0 -62 27 -62 60s28 60 62 60s61 -27 61 -60s-27 -60 -61 -60zM143 172c48 0 145 -23 145 -70v-54h-288v54c0 47 95 70 143 70zM305 161c48 0 143 -12 143 -59v-54h-128v54
+c0 30 -9 41 -32 58c7 1 11 1 17 1z" />
+ <glyph glyph-name="ion-android-person-add" unicode="&#xf39f;" horiz-adv-x="480"
+d="M288 192c-53 0 -96 43 -96 96s43 96 96 96s96 -43 96 -96s-43 -96 -96 -96zM288 144c64 0 192 -32 192 -96v-48h-384v48c0 64 128 96 192 96zM96 224h64v-32h-64v-64h-32v64h-64v32h64v64h32v-64z" />
+ <glyph glyph-name="ion-android-person" unicode="&#xf3a0;" horiz-adv-x="384"
+d="M192 192c-53 0 -96 43 -96 96s43 96 96 96s96 -43 96 -96s-43 -96 -96 -96zM192 144c64 0 192 -32 192 -96v-48h-384v48c0 64 128 96 192 96z" />
+ <glyph glyph-name="ion-android-phone-landscape" unicode="&#xf3a1;"
+d="M448 89c0 -23 -19 -41 -41 -41h-366c-22 0 -41 18 -41 41v206c0 23 19 41 41 41h366c22 0 41 -18 41 -41v-206zM80 84h288v216h-288v-216z" />
+ <glyph glyph-name="ion-android-phone-portrait" unicode="&#xf3a2;" horiz-adv-x="288"
+d="M247 416c23 0 41 -19 41 -41v-366c0 -22 -18 -41 -41 -41h-206c-23 0 -41 19 -41 41v366c0 22 18 41 41 41h206zM252 48v288h-216v-288h216z" />
+ <glyph glyph-name="ion-android-pin" unicode="&#xf3a3;" horiz-adv-x="320"
+d="M160 416c88 0 160 -71 160 -157c0 -118 -160 -291 -160 -291s-160 173 -160 291c0 86 72 157 160 157zM160 203c32 0 57 25 57 56s-25 56 -57 56s-57 -25 -57 -56s25 -56 57 -56z" />
+ <glyph glyph-name="ion-android-plane" unicode="&#xf3a4;" horiz-adv-x="384"
+d="M384 112l-160 48v-114l48 -31v-31l-80 16l-80 -16v31l48 31v114l-160 -48v40l160 104v113c0 18 15 31 32 31s32 -13 32 -31v-113l160 -104v-40z" />
+ <glyph glyph-name="ion-android-playstore" unicode="&#xf2f0;" horiz-adv-x="416"
+d="M416 296c-19 -214 -13 -312 -13 -312h-390s6 96 -13 312h104c0 57 47 104 104 104s104 -47 104 -104h104zM208 374c-43 0 -78 -35 -78 -78h156c0 43 -35 78 -78 78zM156 50l143 85l-143 84v-169z" />
+ <glyph glyph-name="ion-android-print" unicode="&#xf3a5;" horiz-adv-x="416"
+d="M352 288c35 0 64 -29 64 -64v-139h-80v-85h-256v85h-80v139c0 35 29 64 64 64h288zM304 32v128h-192v-128h192zM336 384v0v-80h-256v80h256z" />
+ <glyph glyph-name="ion-android-radio-button-off" unicode="&#xf3a6;" horiz-adv-x="416"
+d="M208 400c114 0 208 -94 208 -208s-94 -208 -208 -208s-208 94 -208 208s94 208 208 208zM208 26c92 0 166 74 166 166s-74 166 -166 166s-166 -74 -166 -166s74 -166 166 -166z" />
+ <glyph glyph-name="ion-android-radio-button-on" unicode="&#xf3a7;" horiz-adv-x="416"
+d="M208 296c57 0 104 -47 104 -104s-47 -104 -104 -104s-104 47 -104 104s47 104 104 104zM208 400c114 0 208 -94 208 -208s-94 -208 -208 -208s-208 94 -208 208s94 208 208 208zM208 26c92 0 166 74 166 166s-74 166 -166 166s-166 -74 -166 -166s74 -166 166 -166z" />
+ <glyph glyph-name="ion-android-refresh" unicode="&#xf3a8;" horiz-adv-x="352"
+d="M176 60c56 0 104 34 123 84h46c-21 -74 -88 -128 -169 -128c-98 0 -176 79 -176 176s79 176 176 176c48 0 92 -20 124 -52l52 52v-154h-154l70 70c-23 24 -56 40 -92 40c-73 0 -132 -59 -132 -132s59 -132 132 -132z" />
+ <glyph glyph-name="ion-android-remove-circle" unicode="&#xf3a9;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM315 171v42h-214v-42h214z" />
+ <glyph glyph-name="ion-android-remove" unicode="&#xf2f4;" horiz-adv-x="320"
+d="M0 171v42h320v-42h-320z" />
+ <glyph glyph-name="ion-android-restaurant" unicode="&#xf3aa;" horiz-adv-x="415"
+d="M116 168l-91 89c-34 33 -34 86 0 119l153 -148zM264 206l-33 -31l150 -145l-30 -30l-150 146l-150 -146l-30 30s163 159 211 207c-15 32 -4 77 31 111c41 40 101 49 132 17c33 -31 24 -89 -17 -129c-34 -34 -80 -45 -114 -30z" />
+ <glyph glyph-name="ion-android-sad" unicode="&#xf3ab;" horiz-adv-x="416"
+d="M208 160c45 0 83 -26 102 -64h-204c19 38 57 64 102 64zM208 400c114 0 208 -94 208 -208s-93 -208 -208 -208s-208 94 -208 208s93 208 208 208zM208 26c92 0 166 74 166 166s-74 166 -166 166s-166 -74 -166 -166s74 -166 166 -166zM281 213c-18 0 -31 13 -31 31
+s13 31 31 31s31 -13 31 -31s-13 -31 -31 -31zM135 213c-18 0 -31 13 -31 31s13 31 31 31s31 -13 31 -31s-13 -31 -31 -31z" />
+ <glyph glyph-name="ion-android-search" unicode="&#xf2f5;" horiz-adv-x="384"
+d="M274 143l110 -110l-33 -33l-109 110v17l-7 6c-25 -21 -58 -34 -93 -34c-79 0 -142 63 -142 142s63 143 141 143c79 0 142 -64 142 -143c0 -36 -13 -68 -34 -93l7 -5h18zM142 143c55 0 99 43 99 98s-44 99 -99 99s-98 -44 -98 -99s43 -98 98 -98z" />
+ <glyph glyph-name="ion-android-send" unicode="&#xf2f6;" horiz-adv-x="416"
+d="M0 0v149l298 43l-298 43v149l416 -192z" />
+ <glyph glyph-name="ion-android-settings" unicode="&#xf2f7;" horiz-adv-x="416"
+d="M366 171l47 -34c3 -3 4 -10 2 -14l-43 -71c-2 -4 -7 -7 -12 -5l-54 21c-12 -8 -23 -16 -36 -21l-8 -55c-1 -4 -6 -8 -11 -8h-85c-5 0 -10 3 -11 8l-8 55c-13 5 -25 13 -36 21l-54 -21c-4 -2 -10 1 -12 5l-43 71c-3 5 -2 11 2 14l45 34c0 7 -1 14 -1 21s1 14 1 21l-46 34
+c-3 3 -4 10 -2 14l43 71c2 4 7 7 12 5l54 -21c12 8 23 16 36 21l8 55c1 4 6 8 11 8h85c5 0 10 -4 11 -8l7 -55c13 -5 25 -13 36 -21l53 21c4 2 11 -1 13 -5l43 -71c3 -5 2 -11 -2 -14l-45 -34c0 -7 1 -14 1 -21s0 -15 -1 -21zM207 119c41 0 75 32 75 73s-34 73 -75 73
+s-74 -32 -74 -73s33 -73 74 -73z" />
+ <glyph glyph-name="ion-android-share-alt" unicode="&#xf3ac;" horiz-adv-x="384"
+d="M320 104c34 0 62 -28 62 -62s-28 -62 -62 -62s-62 28 -62 62c0 5 1 10 2 14l-152 88c-12 -11 -27 -17 -44 -17c-35 0 -64 29 -64 64s28 64 63 64c17 0 32 -6 44 -17l151 87c-1 5 -2 10 -2 15c0 35 29 64 64 64s64 -29 64 -64s-29 -64 -64 -64c-17 0 -32 6 -44 17
+l-151 -87c1 -5 2 -10 2 -15s-1 -10 -2 -15l153 -88c11 11 26 16 42 16z" />
+ <glyph glyph-name="ion-android-share" unicode="&#xf2f8;" horiz-adv-x="384"
+d="M384 200l-160 -147v88c-107 0 -171 -34 -224 -109c21 107 75 214 224 235v85z" />
+ <glyph glyph-name="ion-android-star-half" unicode="&#xf3ad;" horiz-adv-x="404"
+d="M404 238l-110 -96l33 -142l-125 75l-125 -75l33 142l-110 96l145 12l57 134l57 -134zM219 103l60 -36l-16 68l-5 19l15 12l53 46l-70 6l-19 2l-8 18l-27 64v-189z" />
+ <glyph glyph-name="ion-android-star-outline" unicode="&#xf3ae;" horiz-adv-x="404"
+d="M404 238l-110 -96l33 -142l-125 75l-125 -75l33 142l-110 96l145 12l57 134l57 -134zM219 103l60 -36l-16 68l-5 19l15 12l53 46l-70 6l-19 2l-8 18l-27 64l-27 -64l-8 -18l-19 -2l-70 -6l53 -46l15 -12l-5 -19l-16 -68l60 36l17 10z" />
+ <glyph glyph-name="ion-android-star" unicode="&#xf2fc;" horiz-adv-x="404"
+d="M202 75l-125 -75l33 142l-110 96l145 12l57 134l57 -134l145 -12l-110 -96l33 -142z" />
+ <glyph glyph-name="ion-android-stopwatch" unicode="&#xf2fd;" horiz-adv-x="384"
+d="M168 141v131h48v-131h-48zM344 278c25 -33 40 -74 40 -118c0 -106 -86 -192 -192 -192s-192 86 -192 192s86 192 192 192c44 0 85 -15 118 -40l31 30l33 -33zM298 54c28 28 44 66 44 106s-16 78 -44 106s-66 44 -106 44s-78 -16 -106 -44s-44 -66 -44 -106
+s16 -78 44 -106s66 -44 106 -44s78 16 106 44zM128 368v48h128v-48h-128z" />
+ <glyph glyph-name="ion-android-subway" unicode="&#xf3af;" horiz-adv-x="352"
+d="M176 400c94 0 176 -10 176 -85v-214c0 -42 -33 -74 -75 -74l27 -27v-16h-256v16l27 27c-42 0 -75 32 -75 74v214c0 75 82 85 176 85zM80 64c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM160 208v96h-112v-96h112zM272 64c18 0 32 14 32 32
+s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM304 208v96h-112v-96h112z" />
+ <glyph glyph-name="ion-android-sunny" unicode="&#xf3b0;"
+d="M224 288c-25 0 -50 -10 -68 -28s-28 -43 -28 -68s10 -50 28 -68s43 -28 68 -28s50 10 68 28s28 43 28 68s-10 50 -28 68s-43 28 -68 28zM245 416v0v-64h-42v64h42zM374 372v0l30 -30l-38 -38l-30 30zM74 372v0l38 -38l-30 -30l-38 38zM224 320v0c70 0 128 -58 128 -128
+s-58 -128 -128 -128s-128 58 -128 128s58 128 128 128zM448 213v0v-42h-64v42h64zM64 213v0v-42h-64v42h64zM366 80v0l38 -38l-30 -30l-38 38zM82 80v0l30 -30l-38 -38l-30 30zM245 32v0v-64h-42v64h42z" />
+ <glyph glyph-name="ion-android-sync" unicode="&#xf3b1;" horiz-adv-x="320"
+d="M160 355c88 0 160 -73 160 -163c0 -32 -9 -62 -25 -87l-29 30c9 17 14 37 14 57c0 67 -54 122 -120 122v-61l-80 82l80 81v-61zM160 70v61l80 -82l-80 -81v61c-88 0 -160 73 -160 163c0 32 9 63 25 87l29 -30c-9 -17 -14 -37 -14 -57c0 -67 54 -122 120 -122z" />
+ <glyph glyph-name="ion-android-textsms" unicode="&#xf3b2;" horiz-adv-x="384"
+d="M344 384c22 0 40 -18 40 -40v-240c0 -22 -18 -40 -40 -40h-280l-64 -64v344c0 22 10 40 32 40h312zM134 206v40h-38v-40h38zM211 206v40h-38v-40h38zM288 206v40h-38v-40h38z" />
+ <glyph glyph-name="ion-android-time" unicode="&#xf3b3;" horiz-adv-x="426"
+d="M213 405c117 0 213 -96 213 -213s-95 -213 -213 -213s-213 96 -213 213s95 213 213 213zM213 22c94 0 170 76 170 170s-76 170 -170 170s-170 -76 -170 -170s76 -170 170 -170zM224 298v-111l96 -57l-16 -26l-112 67v127h32z" />
+ <glyph glyph-name="ion-android-train" unicode="&#xf3b4;" horiz-adv-x="352"
+d="M0 101v214c0 75 82 85 176 85s176 -10 176 -85v-214c0 -42 -33 -74 -75 -74l27 -27v-16h-256v16l27 27c-42 0 -75 32 -75 74zM176 72c22 0 40 18 40 40s-18 40 -40 40s-40 -18 -40 -40s18 -40 40 -40zM304 224v96h-256v-96h256z" />
+ <glyph glyph-name="ion-android-unlock" unicode="&#xf3b5;" horiz-adv-x="320"
+d="M280 262c22 0 40 -18 40 -40v-200c0 -22 -18 -40 -40 -40h-240c-22 0 -40 18 -40 40v200c0 22 18 40 40 40h182v40v0c0 34 -28 62 -62 62s-62 -28 -62 -62h-38c0 55 45 100 100 100s100 -45 100 -100v-40h20zM160 80c22 0 40 18 40 40s-18 40 -40 40s-40 -18 -40 -40
+s18 -40 40 -40z" />
+ <glyph glyph-name="ion-android-upload" unicode="&#xf3b6;" horiz-adv-x="480"
+d="M387 231c52 -3 93 -46 93 -99c0 -55 -45 -100 -100 -100h-260c-66 0 -120 54 -120 120c0 62 47 113 107 119c25 48 75 81 133 81c73 0 133 -52 147 -121zM272 172h68l-100 100l-100 -100h68v-76h64v76z" />
+ <glyph glyph-name="ion-android-volume-down" unicode="&#xf3b7;" horiz-adv-x="288"
+d="M0 256h85l107 112v-352l-107 112h-85v128zM288 192c0 -38 -21 -73 -53 -88v177c32 -16 53 -51 53 -89z" />
+ <glyph glyph-name="ion-android-volume-mute" unicode="&#xf3b8;" horiz-adv-x="192"
+d="M0 256h85l107 112v-352l-107 112h-85v128z" />
+ <glyph glyph-name="ion-android-volume-off" unicode="&#xf3b9;" horiz-adv-x="384"
+d="M342 192c0 69 -45 128 -107 147v45c85 -20 149 -99 149 -192c0 -35 -8 -68 -24 -96l-32 32c9 19 14 41 14 64zM192 368v-104l-51 51zM357 51v0l24 -24l-24 -24l-40 40c-23 -21 -51 -36 -82 -43v45c19 6 37 15 52 28l-95 95v-152l-107 112h-85v128h85l9 10l-91 91l24 24z
+M288 192c0 -7 0 -15 -2 -22l-51 51v60c32 -16 53 -51 53 -89z" />
+ <glyph glyph-name="ion-android-volume-up" unicode="&#xf3ba;" horiz-adv-x="384"
+d="M0 256h85l107 112v-352l-107 112h-85v128zM288 192c0 -38 -21 -73 -53 -88v177c32 -16 53 -51 53 -89zM235 384c85 -20 149 -99 149 -192s-64 -172 -149 -192v45c62 19 106 78 106 147s-44 128 -106 147v45z" />
+ <glyph glyph-name="ion-android-walk" unicode="&#xf3bb;" horiz-adv-x="272"
+d="M168 336c-22 0 -40 18 -40 40s18 40 40 40s40 -18 40 -40s-18 -40 -40 -40zM168 216l-20 38l-20 -62l57 -96v-128h-38v96l-50 68l-57 -164h-40l81 320l-41 -16v-80h-40v112l111 38c4 1 10 1 13 1c13 0 23 -6 31 -18l45 -69h72v-40h-104z" />
+ <glyph glyph-name="ion-android-warning" unicode="&#xf3bc;"
+d="M0 -16l224 416l224 -416h-448zM248 48v48h-48v-48h48zM248 128v96h-48v-96h48z" />
+ <glyph glyph-name="ion-android-watch" unicode="&#xf3bd;" horiz-adv-x="320"
+d="M320 192c0 -51 -24 -96 -61 -125l-19 -115h-160l-19 115c-37 29 -61 74 -61 125s24 96 61 125l19 115h160l19 -115c37 -29 61 -74 61 -125zM40 192c0 -66 54 -120 120 -120s120 54 120 120s-54 120 -120 120s-120 -54 -120 -120z" />
+ <glyph glyph-name="ion-android-wifi" unicode="&#xf305;" horiz-adv-x="416"
+d="M208 219c23 0 42 -18 42 -41s-19 -41 -42 -41s-42 18 -42 41s19 41 42 41zM333 178c0 -45 -26 -85 -63 -107l-20 36c25 14 41 40 41 71c0 45 -37 82 -83 82s-83 -37 -83 -82c0 -31 16 -57 41 -71l-20 -36c-37 22 -63 62 -63 107c0 68 56 124 125 124s125 -56 125 -124z
+M208 384c114 0 208 -93 208 -206c0 -76 -42 -142 -104 -178l-21 36c50 28 83 81 83 142c0 91 -74 165 -166 165s-166 -74 -166 -165c0 -61 33 -113 83 -142l-21 -36c-62 36 -104 102 -104 178c0 113 94 206 208 206z" />
+ <glyph glyph-name="ion-aperture" unicode="&#xf313;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM360 56c36 36 56 85 56 136s-20 100 -56 136s-85 56 -136 56s-100 -20 -136 -56s-56 -85 -56 -136s20 -100 56 -136s85 -56 136 -56s100 20 136 56zM168 342l56 -86h-147
+c17 40 50 71 91 86zM381 160h-102l72 129c21 -27 33 -60 33 -97c0 -11 -1 -22 -3 -32zM328 314l-49 -90l-78 126c8 1 15 2 23 2c40 0 76 -14 104 -38zM67 224h102l-72 -129c-21 27 -33 60 -33 97c0 11 1 22 3 32zM280 42l-56 86h147c-17 -40 -50 -71 -91 -86zM120 70l49 90
+l78 -126c-8 -1 -15 -2 -23 -2c-40 0 -76 14 -104 38z" />
+ <glyph glyph-name="ion-archive" unicode="&#xf102;"
+d="M224 140l-128 116h80v96h96v-96h80zM433 151c11 -6 17 -19 15 -32l-9 -67c-2 -13 -9 -20 -28 -20h-374c-18 0 -26 7 -28 20l-9 67c-2 13 3 26 14 32l72 55h42l-62 -62h50c2 0 5 -1 6 -3l18 -45h168l18 45c1 2 3 3 5 3h51l-62 62h42z" />
+ <glyph glyph-name="ion-arrow-down-a" unicode="&#xf103;" horiz-adv-x="384"
+d="M192 -0l-192 192h112v192h160v-192h112z" />
+ <glyph glyph-name="ion-arrow-down-b" unicode="&#xf104;" horiz-adv-x="320"
+d="M3 263c-2 2 -3 6 -3 9c0 9 8 16 17 16v0h286v0c9 0 17 -7 17 -16c0 -3 -1 -6 -3 -8l-2 -3l-136 -156c-5 -5 -11 -9 -19 -9s-14 4 -19 9l-136 156z" />
+ <glyph glyph-name="ion-arrow-down-c" unicode="&#xf105;" horiz-adv-x="274"
+d="M265 125l-105 -100c-6 -6 -14 -9 -23 -9s-16 3 -22 9l-106 100c-12 12 -12 31 0 43s34 12 46 0l50 -48v217c0 17 14 31 32 31s32 -14 32 -31v-217l50 48c12 12 34 12 46 0s12 -31 0 -43z" />
+ <glyph glyph-name="ion-arrow-expand" unicode="&#xf25e;" horiz-adv-x="320"
+d="M178 238l64 64l-50 50h128v-128l-50 50l-64 -64zM178 146l28 28l64 -64l50 50v-128h-128l50 50zM142 146l-64 -64l50 -50h-128v128l50 -50l64 64zM142 238l-28 -28l-64 64l-50 -50v128h128l-50 -50z" />
+ <glyph glyph-name="ion-arrow-graph-down-left" unicode="&#xf25f;"
+d="M0 64v160l61 -61l131 141l107 -112l149 128l-149 -203l-107 107l-94 -98l62 -62h-160z" />
+ <glyph glyph-name="ion-arrow-graph-down-right" unicode="&#xf260;"
+d="M288 64l62 62l-94 98l-107 -107l-149 203l149 -128l107 112l131 -141l61 61v-160h-160z" />
+ <glyph glyph-name="ion-arrow-graph-up-left" unicode="&#xf261;"
+d="M160 320l-62 -62l94 -98l107 107l149 -203l-149 128l-107 -112l-131 141l-61 -61v160h160z" />
+ <glyph glyph-name="ion-arrow-graph-up-right" unicode="&#xf262;"
+d="M288 320h160v-160l-61 61l-131 -141l-107 112l-149 -128l149 203l107 -107l94 98z" />
+ <glyph glyph-name="ion-arrow-left-a" unicode="&#xf106;" horiz-adv-x="384"
+d="M0 192l192 192v-112h192v-160h-192v-112z" />
+ <glyph glyph-name="ion-arrow-left-b" unicode="&#xf107;" horiz-adv-x="192"
+d="M167 349c2 2 6 3 9 3c9 0 16 -8 16 -17v0v-286v0c0 -9 -7 -17 -16 -17c-3 0 -7 1 -9 3l-2 2l-156 136c-5 5 -9 11 -9 19s4 14 9 19l156 136z" />
+ <glyph glyph-name="ion-arrow-left-c" unicode="&#xf108;" horiz-adv-x="352"
+d="M109 320c12 12 32 12 44 0s12 -34 0 -46l-49 -50h217c17 0 31 -14 31 -32s-14 -32 -31 -32h-217l48 -50c12 -12 12 -34 0 -46s-31 -12 -43 0l-100 106c-6 6 -9 13 -9 22s3 17 9 23z" />
+ <glyph glyph-name="ion-arrow-move" unicode="&#xf263;"
+d="M448 192l-96 -96v76h-109l1 -108h76l-96 -96l-96 96h76v108h-108v-76l-96 96l96 96v-76h108v108h-76l96 96l96 -96h-76v-108h108v76z" />
+ <glyph glyph-name="ion-arrow-resize" unicode="&#xf264;" horiz-adv-x="320"
+d="M192 352h128v-128l-50 50l-9 -9l-183 -183l50 -50h-128v128l50 -50l128 128v0l64 64z" />
+ <glyph glyph-name="ion-arrow-return-left" unicode="&#xf265;" horiz-adv-x="384"
+d="M128 352v-64h248c4 0 8 -4 8 -8v-240c0 -4 -4 -8 -8 -8h-304c-4 0 -8 4 -8 8v48c0 4 4 8 8 8h248v128h-192v-64l-128 96z" />
+ <glyph glyph-name="ion-arrow-return-right" unicode="&#xf266;" horiz-adv-x="384"
+d="M384 256l-128 -96v64h-192v-128h248c4 0 8 -4 8 -8v-48c0 -4 -4 -8 -8 -8h-304c-4 0 -8 4 -8 8v240c0 4 4 8 8 8h248v64z" />
+ <glyph glyph-name="ion-arrow-right-a" unicode="&#xf109;" horiz-adv-x="384"
+d="M384 192l-192 -192v112h-192v160h192v112z" />
+ <glyph glyph-name="ion-arrow-right-b" unicode="&#xf10a;" horiz-adv-x="192"
+d="M25 35c-2 -2 -6 -3 -9 -3c-9 0 -16 8 -16 17v0v286v0c0 9 7 17 16 17c3 0 6 -1 8 -3l3 -2l156 -136c5 -5 9 -11 9 -19s-4 -14 -9 -19l-156 -136z" />
+ <glyph glyph-name="ion-arrow-right-c" unicode="&#xf10b;" horiz-adv-x="352"
+d="M243 320l100 -105c6 -6 9 -14 9 -23s-3 -16 -9 -22l-100 -106c-12 -12 -31 -12 -43 0s-12 34 0 46l48 50h-217c-17 0 -31 14 -31 32s14 32 31 32h217l-49 50c-12 12 -12 34 0 46s32 12 44 0z" />
+ <glyph glyph-name="ion-arrow-shrink" unicode="&#xf267;" horiz-adv-x="384"
+d="M384 356l-82 -82l50 -50h-128v128l50 -50l82 82zM384 28l-28 -28l-82 82l-50 -50v128h128l-50 -50zM0 28l82 82l-50 50h128v-128l-50 50l-82 -82zM0 356l28 28l82 -82l50 50v-128h-128l50 50z" />
+ <glyph glyph-name="ion-arrow-swap" unicode="&#xf268;" horiz-adv-x="384"
+d="M0 120c0 4 4 8 8 8h248v64l128 -96l-128 -96v64h-248c-4 0 -8 4 -8 8v48zM384 264c0 -4 -4 -8 -8 -8h-248v-64l-128 96l128 96v-64h248c4 0 8 -4 8 -8v-48z" />
+ <glyph glyph-name="ion-arrow-up-a" unicode="&#xf10c;" horiz-adv-x="384"
+d="M192 384l192 -192h-112v-192h-160v192h-112z" />
+ <glyph glyph-name="ion-arrow-up-b" unicode="&#xf10d;" horiz-adv-x="320"
+d="M317 121c2 -2 3 -6 3 -9c0 -9 -8 -16 -17 -16v0h-286v0c-9 0 -17 7 -17 16c0 3 1 6 3 8l2 3l136 156c5 5 11 9 19 9s14 -4 19 -9l136 -156z" />
+ <glyph glyph-name="ion-arrow-up-c" unicode="&#xf10e;" horiz-adv-x="274"
+d="M9 259l105 100c6 6 14 9 23 9s16 -3 22 -9l106 -100c12 -12 12 -31 0 -43s-34 -12 -46 0l-50 48v-217c0 -17 -14 -31 -32 -31s-32 14 -32 31v217l-50 -49c-12 -12 -34 -12 -46 0s-12 32 0 44z" />
+ <glyph glyph-name="ion-asterisk" unicode="&#xf314;"
+d="M448 224v-64l-186 10l104 -170l-56 -32l-86 176l-86 -176l-56 32l104 170l-186 -10v64l187 -7l-109 167l60 32l86 -176l86 176l60 -32l-109 -167z" />
+ <glyph glyph-name="ion-at" unicode="&#xf10f;"
+d="M422 41c-24 -25 -52 -43 -85 -55s-69 -18 -105 -18c-35 0 -66 6 -95 17s-53 26 -73 46s-36 43 -47 71s-17 58 -17 90s6 62 18 89s29 51 50 71s46 35 74 47c28 11 58 17 90 17c28 0 55 -4 81 -12s49 -20 69 -36s36 -36 48 -60s18 -53 18 -85c0 -24 -3 -46 -10 -64
+s-16 -34 -27 -46s-24 -22 -38 -28s-29 -10 -45 -10s-29 4 -39 12s-15 17 -15 29h-3c-6 -10 -15 -19 -28 -28s-28 -13 -46 -13c-28 0 -49 9 -64 27s-23 42 -23 71c0 17 3 34 9 50s14 31 24 44s23 23 38 31s31 12 49 12c15 0 27 -4 38 -10c10 -6 18 -15 21 -24h1l5 24h54
+l-24 -113c-1 -6 -2 -12 -3 -19s-2 -13 -2 -19c0 -7 1 -13 4 -18s7 -7 15 -7c16 0 29 9 39 26s16 40 16 68c0 24 -4 45 -12 64s-20 34 -34 47s-32 23 -52 29s-41 9 -65 9c-26 0 -49 -4 -70 -13s-39 -22 -54 -38s-27 -34 -35 -56c-8 -21 -13 -44 -13 -69c0 -26 4 -51 13 -72
+s21 -39 37 -54s35 -27 57 -35s46 -12 72 -12c33 0 61 6 85 16s45 25 65 43zM231 260c-10 0 -18 -2 -25 -8s-14 -13 -19 -22s-8 -18 -11 -28s-4 -20 -4 -30c0 -5 0 -10 1 -16c1 -5 3 -10 6 -15s7 -8 12 -11s11 -5 19 -5c11 0 20 3 28 8s14 13 19 21s9 16 11 26s3 19 3 27
+c0 6 0 13 -1 19s-4 12 -7 17s-7 9 -12 12s-12 5 -20 5z" />
+ <glyph glyph-name="ion-backspace-outline" unicode="&#xf3be;" horiz-adv-x="512"
+d="M413 116c2 -2 3 -4 3 -6s-1 -4 -3 -6l-21 -22c-2 -2 -4 -2 -6 -2s-4 0 -6 2l-76 77l-76 -77c-2 -2 -4 -2 -6 -2s-4 0 -6 2l-21 22c-2 2 -3 4 -3 6s1 4 3 6l76 76l-77 76c-3 3 -3 9 0 12l22 22c2 2 4 2 6 2s4 0 6 -2l76 -76l76 76c2 2 4 2 6 2s4 0 6 -2l22 -22
+c3 -3 3 -9 0 -12l-77 -76zM499 354c9 -9 13 -20 13 -33v-256c0 -27 -20 -49 -46 -49h-298c-13 0 -24 3 -34 9c-9 5 -16 11 -23 20v0l-1 1l-110 146l110 148c14 19 34 28 58 28h298c13 0 24 -5 33 -14zM480 65v256c0 9 -5 15 -14 15h-298c-11 0 -22 -3 -32 -16l-96 -128
+l96 -128c8 -10 17 -16 32 -16h298c9 0 14 8 14 17z" />
+ <glyph glyph-name="ion-backspace" unicode="&#xf3bf;" horiz-adv-x="512"
+d="M499 354c9 -9 13 -20 13 -33v-256c0 -27 -20 -49 -46 -49h-298c-13 0 -24 3 -34 9c-9 5 -16 11 -23 20v0l-1 1l-110 146l110 148c14 19 34 28 58 28h298c13 0 24 -5 33 -14zM413 116l-76 76l77 76c3 3 3 9 0 12l-22 22c-2 2 -4 2 -6 2s-4 0 -6 -2l-76 -76l-76 76
+c-2 2 -4 2 -6 2s-4 0 -6 -2l-22 -22c-3 -3 -3 -9 0 -12l77 -76l-76 -76c-2 -2 -3 -4 -3 -6s1 -4 3 -6l21 -22c2 -2 4 -2 6 -2s4 0 6 2l76 77l76 -77c2 -2 4 -2 6 -2s4 0 6 2l21 22c2 2 3 4 3 6s-1 4 -3 6z" />
+ <glyph glyph-name="ion-bag" unicode="&#xf110;"
+d="M416 288l32 -320h-448l32 320h64v4c0 68 56 124 124 124h8c68 0 124 -56 124 -124v-4h64zM128 292v-4h192v4c0 51 -41 92 -92 92v0h-8c-51 0 -92 -41 -92 -92zM36 0h376l-25 256h-35v-36c10 -6 16 -16 16 -28c0 -18 -14 -32 -32 -32s-32 14 -32 32c0 12 6 22 16 28v36
+h-192v-36c10 -6 16 -16 16 -28c0 -18 -14 -32 -32 -32s-32 14 -32 32c0 12 6 22 16 28v36h-35z" />
+ <glyph glyph-name="ion-battery-charging" unicode="&#xf111;"
+d="M10 64c-6 0 -10 4 -10 10v236c0 6 4 10 10 10h381c6 0 10 -4 10 -10v-54h37c6 0 10 -4 10 -10v-108c0 -6 -4 -10 -10 -10h-37v-54c0 -6 -4 -10 -10 -10h-381zM225 288l-100 -111h61l-27 -81l100 111h-61z" />
+ <glyph glyph-name="ion-battery-empty" unicode="&#xf112;"
+d="M438 256c6 0 10 -4 10 -10v-108c0 -6 -4 -10 -10 -10h-37v-54c0 -6 -4 -10 -10 -10h-381c-6 0 -10 4 -10 10v236c0 6 4 10 10 10h381c6 0 10 -4 10 -10v-54h37zM416 160v64h-15h-32v32v32h-337v-192h337v32v32h32h15z" />
+ <glyph glyph-name="ion-battery-full" unicode="&#xf113;"
+d="M438 256c6 0 10 -4 10 -10v-108c0 -6 -4 -10 -10 -10h-37v-54c0 -6 -4 -10 -10 -10h-381c-6 0 -10 4 -10 10v236c0 6 4 10 10 10h381c6 0 10 -4 10 -10v-54h37z" />
+ <glyph glyph-name="ion-battery-half" unicode="&#xf114;"
+d="M438 256c6 0 10 -4 10 -10v-108c0 -6 -4 -10 -10 -10h-37v-54c0 -6 -4 -10 -10 -10h-381c-6 0 -10 4 -10 10v236c0 6 4 10 10 10h381c6 0 10 -4 10 -10v-54h37zM416 160v64h-15h-32v32v32h-81l32 -192h49v32v32h32h15z" />
+ <glyph glyph-name="ion-battery-low" unicode="&#xf115;"
+d="M10 64c-6 0 -10 4 -10 10v236c0 6 4 10 10 10h381c6 0 10 -4 10 -10v-54h37c6 0 10 -4 10 -10v-108c0 -6 -4 -10 -10 -10h-37v-54c0 -6 -4 -10 -10 -10h-381zM369 288h-209l32 -192h177v32v32h32h15v64h-15h-32v32v32z" />
+ <glyph glyph-name="ion-beaker" unicode="&#xf269;" horiz-adv-x="384"
+d="M80 256h240v-224c0 -9 -7 -16 -16 -16h-208c-9 0 -16 7 -16 16v224zM296 104v48c0 4 -4 8 -8 8s-8 -4 -8 -8v-48c0 -4 4 -8 8 -8s8 4 8 8zM288 176c4 0 8 4 8 8s-4 8 -8 8s-8 -4 -8 -8s4 -8 8 -8zM381 416c3 0 3 -2 3 -3s-2 -3 -3 -5s-13 -20 -13 -40v-336
+c0 -35 -29 -64 -64 -64h-208c-35 0 -64 29 -64 64v307c0 32 -2 33 -32 37c0 12 11 40 65 40h316zM336 368c0 5 0 16 1 16h-273c-1 0 -3 0 -4 -1c5 -7 4 -32 4 -44v-307c0 -18 14 -32 32 -32h210c17 0 30 14 30 32v336z" />
+ <glyph glyph-name="ion-beer" unicode="&#xf26a;"
+d="M384 288c35 0 64 -29 64 -64v-96c0 -35 -29 -64 -64 -64h-32v-80c0 -9 -7 -16 -16 -16h-256c-9 0 -16 7 -16 16v223c-26 0 -48 22 -48 48v54v1c-10 11 -16 26 -16 42c0 35 29 64 64 64c18 0 34 -8 46 -20c10 12 26 20 43 20c14 0 27 -6 37 -14c12 9 26 14 42 14
+c17 0 34 -6 46 -16c11 10 26 16 42 16c35 0 64 -29 64 -64c0 -24 -18 -44 -32 -48v-16h32zM296 144c4 0 8 3 8 8v0v48c0 4 -4 8 -8 8s-8 -4 -8 -8v-48c0 -3 2 -6 4 -7c1 -1 2 -1 4 -1zM303 220c1 2 1 4 1 6s-1 4 -3 5s-4 1 -6 1s-4 -2 -5 -4s-2 -4 -2 -6s2 -4 4 -5
+s4 -1 6 -1s4 2 5 4zM320 288v32h-20c-3 -8 -7 -16 -13 -23c-13 -16 -33 -25 -55 -25c-26 0 -48 13 -61 33c-6 -2 -12 -3 -18 -3c-12 0 -23 4 -32 10c-2 1 -3 3 -5 4c-1 -2 -2 -3 -3 -5c-5 -6 -11 -10 -17 -14v-32v-9h80c0 4 4 8 8 8s8 -4 8 -8h128v32zM351 343c1 3 1 6 1 9
+c0 18 -14 32 -32 32c-9 0 -17 -4 -23 -10c-2 -2 -6 -5 -16 -6h-8c-6 1 -12 3 -14 5c-7 7 -16 11 -27 11c-9 0 -18 -4 -25 -9l-7 -7c0 -1 0 -1 -1 -2c-3 -3 -7 -5 -11 -5c-5 0 -8 3 -11 6c-1 2 -2 3 -3 5s-3 4 -5 6c-4 4 -10 6 -16 6c-10 0 -18 -9 -25 -16
+c-7 -8 -27 -8 -34 0s-18 16 -30 16c-18 0 -32 -14 -32 -32c0 -2 1 -5 1 -7c2 -9 7 -17 15 -21v-34v-35c0 -9 7 -16 16 -16v26v23v32c10 0 18 4 24 11c2 2 3 4 4 6c0 0 6 10 12 11s20 6 30 -5c4 -5 11 -9 19 -9c3 0 5 1 7 2c3 1 7 2 9 4v0c3 2 6 4 10 4c7 0 12 -4 14 -10
+c0 0 1 -1 1 -2c1 -3 1 -5 3 -8c7 -12 20 -20 35 -20c13 0 25 6 32 16c5 7 8 15 8 24s9 8 9 8h7h48c6 0 13 -3 15 -9zM416 128v96c0 18 -14 32 -32 32h-32v-160h32c18 0 32 14 32 32zM128 280c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8s-8 3 -8 8zM288 280c0 5 3 8 8 8s8 -3 8 -8
+s-3 -8 -8 -8s-8 3 -8 8z" />
+ <glyph glyph-name="ion-bluetooth" unicode="&#xf116;" horiz-adv-x="256"
+d="M12 304c16 16 18 13 19 12l68 -65v0v0c2 -2 10 -10 10 -3v156v0v2c0 6 6 10 12 10c4 0 7 -2 9 -4v0s117 -113 122 -117s5 -10 1 -14l-84 -81s-4 -4 -4 -8s4 -8 4 -8l84 -81c4 -4 4 -10 -1 -14s-122 -117 -122 -117v0c-2 -2 -5 -4 -9 -4c-6 0 -12 4 -12 10v2v0v156
+s-8 -1 -10 -3v0v-1l-68 -64c-1 -1 -3 -4 -19 12s-12 17 -11 18s90 86 90 86s4 3 4 8v0c0 5 -4 8 -4 8s-89 85 -90 86s-5 2 11 18zM152 328v-79c0 -8 8 -1 10 1l30 30s3 5 3 7s-1 5 -3 7l-30 30c-2 2 -10 11 -10 4zM152 135v-79s8 2 10 4l30 30c2 2 3 5 3 7s-1 5 -3 7l-30 30
+c-2 2 -10 9 -10 1z" />
+ <glyph glyph-name="ion-bonfire" unicode="&#xf315;" horiz-adv-x="384"
+d="M207 97l15 -89c1 -3 1 -5 1 -8c0 -18 -14 -32 -32 -32s-32 14 -32 32c0 2 0 5 1 7l15 92v0c2 7 8 13 16 13s15 -7 16 -15zM242 93v0v0v0zM329 58c9 -8 10 -25 0 -35s-27 -9 -35 0c-1 1 -2 3 -3 4l-49 66c-3 5 -2 11 2 15c5 5 10 5 16 1l64 -47c2 -1 3 -3 5 -4zM309 113v0
+v0v0zM371 126c9 -1 13 -7 13 -19c0 -9 -10 -14 -18 -12l-57 18v0v0c-3 2 -6 5 -5 9s4 7 8 6zM75 113v0v0v0zM75 113v0l-58 -18c-8 -2 -17 3 -17 12c0 12 3 18 12 19l60 2c4 1 7 -2 8 -6s-2 -7 -5 -9v0zM124 109c5 4 11 4 16 -1c4 -4 5 -10 2 -15l-49 -66c-1 -1 -2 -3 -3 -4
+c-10 -10 -25 -10 -35 0s-10 25 0 35c2 2 3 3 5 4zM288 320c0 -32 -9 -58 -50 -86c-37 -26 -94 -46 -110 -106c0 0 -58 24 -48 96s124 106 112 192c24 0 96 -35 96 -96zM288 192c-16 -50 -44 -64 -80 -64c-15 0 -32 9 -43 26c12 15 28 26 47 37c9 5 20 10 29 16
+c21 14 38 31 47 49c5 -15 5 -48 0 -64zM88 288c-6 4 -9 14 -8 27c2 22 34 39 32 69c14 2 31 -3 42 -24c-5 -11 -15 -21 -28 -34s-26 -22 -38 -38z" />
+ <glyph glyph-name="ion-bookmark" unicode="&#xf26b;" horiz-adv-x="192"
+d="M184 384c4 0 8 -4 8 -8v-56h-192v56c0 4 4 8 8 8h176zM0 0v304h192v-304l-96 96z" />
+ <glyph glyph-name="ion-bowtie" unicode="&#xf3c0;"
+d="M192 236c0 0 8 5 20 7c21 4 39 5 47 -9c10 -17 19 -53 17 -85c-1 -17 -5 -22 -5 -22s-15 -10 -47 -7c-35 3 -40 15 -40 15s5 12 8 43s0 58 0 58zM152 163c-17 -4 -38 -10 -38 -10s45 4 64 9c-4 -21 -10 -34 -10 -34s-83 -80 -116 -80c-28 0 -52 68 -52 144s26 144 52 144
+c35 0 106 -57 128 -97c0 0 3 -16 2 -32c-10 5 -24 10 -44 14c-28 6 -42 3 -42 3s18 -4 57 -17c15 -5 22 -8 29 -10c0 -3 -1 -7 -1 -10c0 -5 0 -10 -1 -15c-5 -2 -15 -6 -28 -9zM396 336c26 0 52 -68 52 -144s-24 -144 -52 -144c-37 0 -104 68 -112 79c0 0 4 5 5 22v9
+c16 -7 70 -13 70 -13s-21 6 -40 11c-13 4 -25 8 -30 10c-1 11 -2 23 -4 33c17 11 69 34 69 34s-15 -2 -35 -9c-14 -5 -29 -11 -37 -14c-3 10 -7 18 -10 24c0 1 -1 4 -1 4v1c22 40 89 97 125 97z" />
+ <glyph glyph-name="ion-briefcase" unicode="&#xf26c;"
+d="M240 176v8h208v-176c0 -4 -4 -8 -8 -8h-432c-4 0 -8 4 -8 8v176h208v-8h32zM440 304c4 0 8 -4 8 -8v-96h-208v8h-32v-8h-208v96c0 4 4 8 8 8h120v31c1 28 22 49 51 49h90c30 0 50 -21 51 -49v-31h120zM288 332v1c0 10 -9 19 -19 19h-90c-10 0 -19 -9 -19 -19v-1v-1v-27
+h128v27v1z" />
+ <glyph glyph-name="ion-bug" unicode="&#xf2be;"
+d="M343 321c-6 -16 -16 -31 -28 -43c-24 -24 -57 -37 -91 -37s-67 13 -91 37c-12 12 -22 27 -28 43c29 39 72 63 119 63s90 -24 119 -63zM95 305c22 -45 68 -77 121 -80v-225c-40 2 -77 22 -104 54c-7 -6 -10 -9 -13 -15c8 -9 7 -22 -1 -31c-9 -10 -24 -11 -34 -2
+s-11 24 -2 34l3 3s2 1 2 1c4 13 13 25 27 36c-15 26 -26 57 -29 90c-7 0 -12 -2 -17 -3c-1 -13 -11 -23 -24 -23s-24 11 -24 24s11 24 24 24h3c4 2 8 5 12 6c7 2 14 4 25 4c1 23 6 45 13 65c-6 4 -11 7 -15 11c-6 5 -11 13 -14 19c-1 0 -3 1 -4 2c-12 6 -15 21 -9 33
+s21 15 33 9c11 -6 15 -20 10 -31c2 -3 3 -7 4 -8c2 -2 5 -3 8 -5c2 3 3 5 5 8zM424 192c13 0 24 -11 24 -24s-11 -24 -24 -24s-23 10 -24 23c-5 1 -10 3 -17 3c-3 -33 -14 -64 -29 -90c14 -11 23 -23 27 -36c0 0 1 0 2 -1l3 -3c9 -10 8 -25 -2 -34s-25 -8 -34 2
+c-8 9 -9 22 -1 31c-3 6 -6 9 -13 15c-27 -32 -64 -52 -104 -54v225c53 3 99 35 121 80c2 -3 3 -5 5 -8c3 2 6 3 8 5c1 1 2 5 4 8c-5 11 -1 25 10 31c12 6 27 3 33 -9s3 -27 -9 -33c-1 -1 -3 -2 -4 -2c-3 -6 -8 -14 -14 -19c-4 -4 -9 -7 -15 -11c7 -20 12 -42 13 -65
+c11 0 18 -2 25 -4c4 -1 8 -4 12 -6h3z" />
+ <glyph glyph-name="ion-calculator" unicode="&#xf26d;" horiz-adv-x="320"
+d="M304 416c9 0 16 -7 16 -16v-416c0 -9 -7 -16 -16 -16h-288c-9 0 -16 7 -16 16v416c0 9 7 16 16 16h288zM48 240v-32h32v32h-32zM48 176v-32h32v32h-32zM48 112v-32h32v32h-32zM144 16v32h-96v-32h96zM144 80v32h-32v-32h32zM144 144v32h-32v-32h32zM144 208v32h-32v-32
+h32zM208 16v32h-32v-32h32zM208 80v32h-32v-32h32zM208 144v32h-32v-32h32zM208 208v32h-32v-32h32zM272 16v96h-32v-96h32zM272 144v32h-32v-32h32zM272 208v32h-32v-32h32zM272 288v80h-224v-80h224z" />
+ <glyph glyph-name="ion-calendar" unicode="&#xf117;"
+d="M112 320c-18 0 -32 14 -32 32v32c0 18 14 32 32 32s32 -14 32 -32v-32c0 -18 -14 -32 -32 -32zM336 320c-18 0 -32 14 -32 32v32c0 18 14 32 32 32s32 -14 32 -32v-32c0 -18 -14 -32 -32 -32zM440 384c4 0 8 -4 8 -8v-400c0 -4 -4 -8 -8 -8h-432c-4 0 -8 4 -8 8v400
+c0 4 4 8 8 8h56v-41c0 -22 24 -39 48 -39s48 17 48 39v41h128v-41c0 -22 25 -39 49 -39s47 17 47 39v41h56zM400 16v256h-352v-256h352z" />
+ <glyph glyph-name="ion-camera" unicode="&#xf118;" horiz-adv-x="416"
+d="M382 301c18 0 34 -14 34 -33v-202c0 -19 -16 -34 -34 -34h-348c-19 0 -34 15 -34 34v202c0 19 15 33 34 33h69l39 40v0c6 7 15 11 25 11h84c9 0 17 -4 23 -10v0v0v0l41 -41h67zM208 82c51 0 92 42 92 93s-41 93 -92 93s-92 -42 -92 -93s41 -93 92 -93zM376 248
+c8 0 14 6 14 14s-6 14 -14 14s-14 -6 -14 -14s6 -14 14 -14zM208 245c38 0 70 -31 70 -70s-32 -70 -70 -70c-39 0 -70 31 -70 70s31 70 70 70z" />
+ <glyph glyph-name="ion-card" unicode="&#xf119;"
+d="M420 352c16 0 28 -12 28 -28v0v-264v0c0 -16 -12 -28 -28 -28h-392c-16 0 -28 12 -28 28v0v0v264v0v0c0 16 12 28 28 28h392zM45 320c-7 0 -12 -5 -13 -12v-20h384v20c-1 7 -6 12 -13 12h-358zM403 64c7 0 12 5 13 12v116h-384v-116c1 -7 6 -12 13 -12h358zM64 128v16
+h192v-16h-192zM64 96v16h96v-16h-96zM320 96v48h64v-48h-64z" />
+ <glyph glyph-name="ion-cash" unicode="&#xf316;" horiz-adv-x="512"
+d="M0 352h512v-256h-512v256zM193 128c-20 23 -33 58 -33 96s13 73 33 96h-97c0 -35 -29 -64 -64 -64v-80c27 0 48 -21 48 -48h113zM298 187c3 4 4 9 4 15c0 3 0 5 -1 8s-2 6 -4 8s-4 4 -7 6s-6 4 -10 5c-1 0 -4 1 -7 2s-5 0 -8 1v31c2 -1 5 -2 7 -3c4 -3 6 -7 7 -13h20
+c0 5 -2 9 -4 13s-5 8 -9 11s-9 5 -14 6c-2 1 -5 2 -7 2v9h-18v-9c-2 0 -4 -1 -6 -2c-5 -1 -10 -2 -14 -5s-7 -6 -9 -10s-4 -9 -4 -14c0 -3 0 -5 1 -8s2 -5 4 -7s5 -5 8 -7s7 -4 12 -5c3 -1 6 0 8 -1v-35c-3 1 -6 2 -9 4s-5 4 -6 7s-2 6 -2 9h-20c0 -5 2 -11 4 -16
+c3 -5 6 -8 10 -11s9 -6 15 -7c3 -1 5 -2 8 -2v-9h18v9c3 0 6 1 9 2c5 1 10 2 14 5s7 7 10 11zM480 176v80c-35 0 -64 29 -64 64h-97c20 -23 33 -58 33 -96s-13 -73 -33 -96h113c0 27 22 48 48 48zM64 224c0 21 11 32 32 32s32 -11 32 -32s-11 -32 -32 -32s-32 11 -32 32z
+M384 224c0 21 11 32 32 32s32 -11 32 -32s-11 -32 -32 -32s-32 11 -32 32zM273 213c2 -1 4 -2 6 -4s3 -5 3 -9c0 -2 0 -4 -1 -6s-2 -4 -4 -5s-5 -3 -8 -4c-1 0 -2 -1 -4 -1v31c3 -1 6 -1 8 -2zM236 257c1 2 3 3 5 4s4 2 6 2v-26c-4 1 -7 3 -9 5s-4 4 -4 8c0 3 1 5 2 7zM0 32
+v32h512v-32h-512z" />
+ <glyph glyph-name="ion-chatbox-working" unicode="&#xf11a;" horiz-adv-x="416"
+d="M76 48c-42 0 -76 31 -76 71v209c0 40 34 72 76 72h264c42 0 76 -32 76 -72v-209c0 -40 -34 -71 -76 -71h-4v-64s-79 54 -86 59s-7 5 -21 5h-153zM304 256c-18 0 -32 -14 -32 -32s14 -32 32 -32s32 14 32 32s-14 32 -32 32zM208 256c-18 0 -32 -14 -32 -32s14 -32 32 -32
+s32 14 32 32s-14 32 -32 32zM112 256c-18 0 -32 -14 -32 -32s14 -32 32 -32s32 14 32 32s-14 32 -32 32z" />
+ <glyph glyph-name="ion-chatbox" unicode="&#xf11b;" horiz-adv-x="416"
+d="M76 48c-42 0 -76 31 -76 71v209c0 40 34 72 76 72h264c42 0 76 -32 76 -72v-209c0 -40 -34 -71 -76 -71h-4v-64s-79 54 -86 59s-7 5 -21 5h-153z" />
+ <glyph glyph-name="ion-chatboxes" unicode="&#xf11c;" horiz-adv-x="416"
+d="M246 82l26 -18c-4 -21 -29 -32 -52 -32h-90c-8 0 -11 -2 -13 -3l-53 -45v48h-16c-26 0 -48 16 -48 41v129c0 25 20 45 46 45h2v-101c0 -33 29 -59 64 -59h117c10 0 14 -3 17 -5zM353 400c35 0 63 -27 63 -60v-168c0 -33 -28 -60 -63 -60h-17v-64l-75 60c-2 2 -7 4 -17 4
+h-101c-35 0 -63 27 -63 60v98v70c0 33 21 60 56 60h217z" />
+ <glyph glyph-name="ion-chatbubble-working" unicode="&#xf11d;" horiz-adv-x="416"
+d="M208 -1c-115 0 -208 89 -208 200s93 201 208 201s208 -90 208 -201c0 -40 -12 -77 -33 -108c-1 -1 -2 -3 -3 -4v0c-2 -4 -4 -10 -4 -15l22 -88l-84 31c-4 2 -8 2 -12 2s-7 -1 -11 -2v0c-1 0 -1 -1 -2 -1c-25 -10 -52 -15 -81 -15zM304 224c-18 0 -32 -14 -32 -32
+s14 -32 32 -32s32 14 32 32s-14 32 -32 32zM208 224c-18 0 -32 -14 -32 -32s14 -32 32 -32s32 14 32 32s-14 32 -32 32zM112 224c-18 0 -32 -14 -32 -32s14 -32 32 -32s32 14 32 32s-14 32 -32 32z" />
+ <glyph glyph-name="ion-chatbubble" unicode="&#xf11e;" horiz-adv-x="416"
+d="M208 -1c-115 0 -208 89 -208 200s93 201 208 201s208 -90 208 -201c0 -40 -12 -77 -33 -108c-1 -1 -2 -3 -3 -4v0c-2 -4 -4 -10 -4 -15l22 -88l-84 31c-4 2 -8 2 -12 2s-7 -1 -11 -2v0c-1 0 -1 -1 -2 -1c-25 -10 -52 -15 -81 -15z" />
+ <glyph glyph-name="ion-chatbubbles" unicode="&#xf11f;" horiz-adv-x="416"
+d="M25 57c-1 1 0 2 -1 3c-15 22 -24 49 -24 77c0 42 19 80 49 106c-2 -11 -4 -22 -4 -34c0 -92 78 -168 174 -168c15 0 30 2 44 6c-27 -32 -69 -53 -115 -53c-20 0 -40 5 -58 12h-1v0c-2 1 -5 2 -8 2s-6 -1 -9 -2l-56 -22l12 63c0 4 -1 7 -3 10v0zM242 400
+c96 0 174 -76 174 -168c0 -33 -11 -64 -28 -90c-1 -1 -1 -2 -2 -3v0c-2 -4 -3 -8 -3 -12l17 -74l-69 26c-3 1 -6 2 -10 2c-3 0 -6 -1 -9 -2v0l-2 -1c-8 -3 -16 -5 -24 -7c-14 -4 -29 -6 -44 -6c-96 0 -173 75 -173 167c0 12 1 24 3 35c16 76 86 133 170 133z" />
+ <glyph glyph-name="ion-checkmark-circled" unicode="&#xf120;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM339 267c1 1 1 2 1 3s0 3 -1 4l-31 24c-1 1 -3 1 -4 1s-2 0 -3 -1l-111 -143s-44 42 -45 43s-4 3 -6 3s-3 -2 -4 -3l-25 -25l-1 -1c-1 -1 -1 -3 -1 -4s0 -2 1 -3l2 -1
+s78 -75 79 -76s3 -3 5 -3s4 2 5 3z" />
+ <glyph glyph-name="ion-checkmark-round" unicode="&#xf121;" horiz-adv-x="416"
+d="M400 376c17 -13 22 -39 9 -57l-207 -302c-13 -18 -37 -22 -54 -9s-137 147 -137 147c-15 16 -15 42 1 58s40 15 55 -2l99 -107l180 263c13 18 37 22 54 9z" />
+ <glyph glyph-name="ion-checkmark" unicode="&#xf122;" horiz-adv-x="416"
+d="M414 338c1 -2 2 -4 2 -6s-1 -4 -2 -6l-249 -320c-2 -2 -5 -6 -9 -6s-8 3 -10 5s-141 136 -141 136l-3 3c-1 2 -2 4 -2 6s1 3 2 5l2 2c14 15 42 44 44 46s4 6 8 6s8 -4 10 -6s80 -78 80 -78l200 257c2 2 4 2 6 2s5 -1 7 -2z" />
+ <glyph glyph-name="ion-chevron-down" unicode="&#xf123;"
+d="M224 150v0v0l174 167c4 4 12 4 16 0l31 -30c4 -4 4 -12 0 -16l-213 -204c-2 -2 -5 -3 -8 -3s-6 1 -8 3l-213 204c-4 4 -4 12 0 16l31 30c4 4 12 4 16 0z" />
+ <glyph glyph-name="ion-chevron-left" unicode="&#xf124;" horiz-adv-x="256"
+d="M86 192l167 -174c4 -4 4 -12 0 -16l-30 -31c-4 -4 -12 -4 -16 0l-204 213c-2 2 -3 5 -3 8s1 6 3 8l204 213c4 4 12 3 16 -1l30 -30c4 -4 4 -12 0 -16l-167 -174v0v0z" />
+ <glyph glyph-name="ion-chevron-right" unicode="&#xf125;" horiz-adv-x="256"
+d="M170 192v0v0l-167 174c-4 4 -4 12 0 16l30 30c4 4 12 5 16 1l204 -213c2 -2 3 -5 3 -8s-1 -6 -3 -8l-204 -213c-4 -4 -12 -4 -16 0l-30 31c-4 4 -4 12 0 16z" />
+ <glyph glyph-name="ion-chevron-up" unicode="&#xf126;"
+d="M224 234l-174 -167c-4 -4 -12 -4 -16 0l-31 30c-4 4 -4 12 0 16l213 204c2 2 5 3 8 3s6 -1 8 -3l213 -204c4 -4 4 -12 0 -16l-31 -30c-4 -4 -12 -4 -16 0l-174 167v0v0z" />
+ <glyph glyph-name="ion-clipboard" unicode="&#xf127;" horiz-adv-x="352"
+d="M80 288c2 20 10 35 28 40l1 1c12 3 21 7 21 20v21c0 26 21 46 46 46s46 -20 46 -46v-21c0 -13 9 -18 21 -21h2c18 -5 25 -20 27 -40h-192zM176 384c-8 0 -13 -6 -13 -14s5 -14 13 -14s14 6 14 14s-6 14 -14 14zM325 384c15 0 27 -12 27 -28v-360c0 -16 -12 -28 -27 -28
+h-149h-148c-15 0 -28 12 -28 28v360c0 16 13 28 28 28h73v-13c0 -11 -9 -19 -19 -19h-37c-7 0 -12 -6 -12 -13v-327c0 -6 5 -12 11 -12h265c6 0 11 6 11 12v327c0 7 -5 13 -12 13h-37c-10 0 -20 8 -20 19v13h74zM64 224v32h112v-32h-112zM64 32v32h160v-32h-160zM64 96v32
+h129v-32h-129zM64 160v32h208v-32h-208z" />
+ <glyph glyph-name="ion-clock" unicode="&#xf26e;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM360 56c10 10 19 21 26 33l-27 16l8 14l27 -16c13 25 21 52 22 81h-32v16h32c-1 29 -9 56 -22 81l-27 -16l-8 14l27 16c-7 12 -16 23 -26 33s-21 19 -33 26l-16 -27l-14 8
+l16 27c-25 13 -52 21 -81 22v-32h-16v32c-29 -1 -56 -9 -81 -22l16 -27l-14 -8l-16 27c-12 -7 -23 -16 -33 -26s-19 -21 -26 -33l27 -16l-8 -14l-27 16c-13 -25 -21 -52 -22 -81h32v-16h-32c1 -29 9 -56 22 -81l27 16l8 -14l-27 -16c7 -12 16 -23 26 -33s21 -19 33 -26
+l16 27l14 -8l-16 -27c25 -13 52 -21 81 -22v32h16v-32c29 1 56 9 81 22l-16 27l14 8l16 -27c12 7 23 16 33 26zM368 207v-32h-117c-6 -9 -16 -15 -27 -15c-18 0 -32 14 -32 32c0 12 6 22 16 28v68h32v-68c5 -3 9 -8 12 -13h116z" />
+ <glyph glyph-name="ion-close-circled" unicode="&#xf128;"
+d="M224 415c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM332 116l-75 75l76 75c3 3 3 9 0 12l-22 21c-2 2 -4 3 -6 3s-3 -1 -5 -3l-76 -74l-76 74c-2 2 -3 3 -5 3s-4 -1 -6 -3l-21 -21c-3 -3 -3 -9 0 -12l76 -75l-76 -76
+c-2 -1 -2 -3 -2 -5s0 -4 2 -6l21 -22c2 -2 4 -2 6 -2s4 0 6 2l75 76l76 -75c2 -2 3 -3 5 -3s4 1 6 3l21 21c2 1 3 4 3 6s-1 4 -3 6z" />
+ <glyph glyph-name="ion-close-round" unicode="&#xf129;" horiz-adv-x="384"
+d="M374 61c14 -14 14 -37 0 -51s-37 -14 -51 0l-131 131l-131 -131c-14 -14 -36 -14 -50 0s-14 37 0 51l130 131l-130 131c-14 14 -14 37 0 51s36 14 50 0l131 -131l131 131c14 14 37 14 51 0s14 -37 0 -51l-131 -131z" />
+ <glyph glyph-name="ion-close" unicode="&#xf12a;" horiz-adv-x="384"
+d="M380 61c3 -3 4 -6 4 -10s-1 -7 -4 -10l-38 -37c-3 -3 -5 -4 -9 -4s-7 1 -10 4l-131 131l-131 -131c-3 -3 -5 -4 -9 -4s-7 1 -10 4l-38 37c-3 3 -4 6 -4 10s1 7 4 10l132 131l-132 130c-5 5 -5 15 0 20l37 38c3 2 6 4 10 4s7 -1 10 -4l131 -130l131 130c3 2 6 4 10 4
+s7 -1 10 -4l37 -38c5 -5 5 -14 0 -19l-132 -130z" />
+ <glyph glyph-name="ion-closed-captioning" unicode="&#xf317;" horiz-adv-x="512"
+d="M0 384h512v-384h-512v384zM464 192c0 27 0 44 -4 80s-23 56 -59 60s-91 4 -138 4h-7h-7c-47 0 -102 0 -138 -4s-55 -24 -59 -60s-4 -53 -4 -80s2 -47 4 -80s19 -56 59 -60s96 -4 145 -4s105 0 145 4s57 27 59 60s4 53 4 80zM372 164v4h53c0 -27 -7 -48 -19 -62
+s-32 -21 -61 -21c-14 0 -26 2 -36 5s-18 9 -25 17s-12 19 -15 33s-5 30 -5 51s3 39 7 53s9 25 17 33s17 14 27 17s22 5 34 5c25 0 44 -7 57 -21s19 -37 19 -62h-52v1c0 20 -12 33 -27 33s-25 -11 -28 -30c0 0 -2 -11 -2 -29s2 -28 2 -28c1 -17 12 -29 27 -29s27 10 27 29v1z
+M195 164v4h53c0 -27 -7 -48 -19 -62s-32 -21 -61 -21c-14 0 -26 2 -36 5s-18 9 -25 17s-12 19 -15 33s-5 30 -5 51s3 39 7 53s9 25 17 33s17 14 27 17s22 5 34 5c25 0 44 -7 57 -21s19 -37 19 -62h-52v1c0 20 -12 33 -27 33s-25 -11 -28 -30c0 0 -2 -11 -2 -29s2 -28 2 -28
+c1 -17 12 -29 27 -29s27 10 27 29v1z" />
+ <glyph glyph-name="ion-cloud" unicode="&#xf12b;"
+d="M366 215c45 0 82 -38 82 -84s-37 -83 -82 -83v0h-276c-49 0 -90 41 -90 91c0 40 26 74 61 86c5 29 29 51 59 51c10 0 18 -3 26 -7c19 40 59 67 105 67c64 0 115 -53 115 -118v-3z" />
+ <glyph glyph-name="ion-code-download" unicode="&#xf26f;"
+d="M299 164l-63 -63v0l-1 -1v0l-2 -1v0l-1 -1v0l-2 -1v0h-1v0h-1c-1 0 -3 -1 -4 -1s-3 1 -4 1h-1v0h-1v0l-2 1v0l-1 1v0c-1 1 -2 1 -3 2v0l-63 63c-6 6 -6 17 0 23s18 6 24 0l35 -34v118c0 9 7 17 16 17s16 -8 16 -17v-118l35 34c6 6 18 6 24 0s6 -17 0 -23zM136 56
+c-6 0 -12 2 -17 7l-112 112c-9 9 -9 25 0 34l112 112c9 9 25 9 34 0s9 -25 0 -34l-95 -95l95 -95c9 -9 9 -25 0 -34c-5 -5 -11 -7 -17 -7zM312 56c-6 0 -12 2 -17 7c-9 9 -9 25 0 34l95 95l-95 95c-9 9 -9 25 0 34s25 9 34 0l112 -112c9 -9 9 -25 0 -34l-112 -112
+c-5 -5 -11 -7 -17 -7z" />
+ <glyph glyph-name="ion-code-working" unicode="&#xf270;"
+d="M128 192c0 16 8 24 24 24s24 -8 24 -24s-8 -24 -24 -24s-24 8 -24 24zM200 192c0 16 8 24 24 24s24 -8 24 -24s-8 -24 -24 -24s-24 8 -24 24zM272 192c0 16 8 24 24 24s24 -8 24 -24s-8 -24 -24 -24s-24 8 -24 24zM136 56c-7 0 -12 2 -17 7l-112 112c-5 5 -7 10 -7 17
+s2 12 7 17l112 112c5 5 10 7 17 7s12 -2 17 -7s7 -10 7 -17s-2 -12 -7 -17l-95 -95l95 -95c5 -5 7 -10 7 -17s-2 -12 -7 -17s-10 -7 -17 -7zM312 56c-7 0 -12 2 -17 7s-7 10 -7 17s2 12 7 17l95 95l-95 95c-5 5 -7 10 -7 17s2 12 7 17s10 7 17 7s12 -2 17 -7l112 -112
+c5 -5 7 -10 7 -17s-2 -12 -7 -17l-112 -112c-5 -5 -10 -7 -17 -7z" />
+ <glyph glyph-name="ion-code" unicode="&#xf271;"
+d="M136 56c-6 0 -12 2 -17 7l-112 112c-9 9 -9 25 0 34l112 112c9 9 25 9 34 0s9 -25 0 -34l-95 -95l95 -95c9 -9 9 -25 0 -34c-5 -5 -11 -7 -17 -7zM312 56c-6 0 -12 2 -17 7c-9 9 -9 25 0 34l95 95l-95 95c-9 9 -9 25 0 34s25 9 34 0l112 -112c9 -9 9 -25 0 -34l-112 -112
+c-5 -5 -11 -7 -17 -7z" />
+ <glyph glyph-name="ion-coffee" unicode="&#xf272;" horiz-adv-x="384"
+d="M319 191c37 -7 65 -40 65 -79c0 -20 -8 -39 -21 -54c-15 -17 -37 -26 -61 -26c-8 0 -17 1 -25 3c-6 1 -10 3 -15 5c-11 -15 -23 -25 -32 -33v0c-5 -5 -12 -7 -19 -7h-102c-7 0 -14 2 -19 7v0c-17 15 -41 36 -62 86s-28 91 -28 111s3 20 16 20h101c-5 17 -37 19 -37 46
+c0 17 15 32 28 37c-2 -8 -3 -14 -3 -21c0 -19 39 -30 39 -53c0 -3 0 -6 -1 -9h56c1 5 2 10 2 14c0 36 -56 36 -56 84c0 28 21 55 47 62c-4 -14 -9 -23 -9 -35c0 -32 57 -50 57 -88c0 -13 -5 -25 -12 -37h76c13 0 16 0 16 -20c0 -4 0 -8 -1 -13zM302 64c33 0 50 25 50 48
+s-17 43 -39 47c-4 -19 -11 -42 -21 -66c-4 -9 -8 -17 -12 -25c6 -3 13 -4 22 -4z" />
+ <glyph glyph-name="ion-compass" unicode="&#xf273;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224c0 39 10 76 27 108c-16 12 -27 30 -27 52c0 35 29 64 64 64c22 0 40 -11 52 -27c32 17 69 27 108 27zM32 352c0 -10 5 -20 13 -26c13 17 28 32 45 45c-6 8 -16 13 -26 13c-18 0 -32 -14 -32 -32z
+M360 56c36 36 56 85 56 136s-20 100 -56 136s-85 56 -136 56s-100 -20 -136 -56s-56 -85 -56 -136s20 -100 56 -136s85 -56 136 -56s100 20 136 56zM320 320c0 0 -54 -130 -72 -152s-120 -104 -120 -104s54 132 72 152s120 104 120 104z" />
+ <glyph glyph-name="ion-compose" unicode="&#xf12c;" horiz-adv-x="384"
+d="M379 348c7 -7 7 -18 0 -25l-32 -31l-55 55l31 32c7 7 18 7 25 0zM282 338l55 -55l-177 -173l-64 -14l14 64zM320 192l32 32v-201c0 -13 -10 -23 -23 -23h-306c-13 0 -23 10 -23 23v306c0 13 10 23 23 23h201l-32 -32h-149c-6 0 -11 -5 -11 -10v-268s4 -10 10 -10h269
+s9 5 9 10v150z" />
+ <glyph glyph-name="ion-connection-bars" unicode="&#xf274;" horiz-adv-x="352"
+d="M0 32v64h64v-64h-64zM96 32v128h64v-128h-64zM192 32v224h64v-224h-64zM288 32v320h64v-320h-64z" />
+ <glyph glyph-name="ion-contrast" unicode="&#xf275;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM360 56c36 36 56 85 56 136s-20 100 -56 136s-85 56 -136 56v-384c51 0 100 20 136 56z" />
+ <glyph glyph-name="ion-crop" unicode="&#xf3c1;"
+d="M320 -32v48h64v-48h-64zM384 96h64v-64h-384v256h-64v64h64v64h64v-320h192v192h-176v64h240v-256z" />
+ <glyph glyph-name="ion-cube" unicode="&#xf318;"
+d="M435 280c7 0 13 -6 13 -12v-183c0 -9 -6 -17 -14 -22v-1l-175 -92v-1c-2 -1 -4 -1 -6 -1c-7 0 -13 6 -13 12v185c0 9 5 17 13 22v0l3 2l172 89l2 1c2 1 3 1 5 1zM422 329c0 0 8 -3 8 -9c0 -7 -8 -11 -8 -11l-183 -97l-2 -1c-4 -2 -8 -3 -13 -3s-9 1 -13 3l-2 1l-183 96
+s-8 5 -8 12c0 6 8 9 8 9l181 82s11 5 17 5s17 -5 17 -5zM195 187c8 -5 13 -13 13 -22v-185c0 -6 -6 -12 -13 -12c-2 0 -4 1 -6 2v0l-175 92v1c-8 5 -14 13 -14 22v183c0 6 6 12 13 12c2 0 4 0 5 -1l2 -1l171 -89z" />
+ <glyph glyph-name="ion-disc" unicode="&#xf12d;"
+d="M224 289c54 0 97 -43 97 -97s-43 -97 -97 -97s-97 43 -97 97s43 97 97 97zM224 148c24 0 44 20 44 44s-20 44 -44 44s-44 -20 -44 -44s20 -44 44 -44zM224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM224 69
+c68 0 123 55 123 123s-55 123 -123 123s-123 -55 -123 -123s55 -123 123 -123z" />
+ <glyph glyph-name="ion-document-text" unicode="&#xf12e;" horiz-adv-x="288"
+d="M286 279c1 -3 2 -6 2 -10v-245c0 -13 -10 -24 -22 -24h-243c-12 0 -23 11 -23 24v336c0 13 11 24 23 24h160c3 0 6 0 9 -2c2 -1 5 -3 7 -5l84 -92c2 -2 2 -4 3 -6zM48 269v-10c0 -1 1 -3 3 -3h71c2 0 3 2 3 3v10c0 2 -1 3 -3 3h-71c-2 0 -3 -1 -3 -3zM48 141v-10
+c0 -1 1 -3 3 -3h123c2 0 2 2 2 3v10c0 2 0 3 -2 3h-123c-2 0 -3 -1 -3 -3zM208 67v10c0 2 0 3 -2 3h-155c-2 0 -3 -1 -3 -3v-10c0 -1 1 -3 3 -3h155c2 0 2 2 2 3zM240 195v10c0 2 0 3 -2 3h-187c-2 0 -3 -1 -3 -3v-10c0 -1 1 -3 3 -3h187c2 0 2 2 2 3zM193 270h60l-71 78
+v-66c0 -6 5 -12 11 -12z" />
+ <glyph glyph-name="ion-document" unicode="&#xf12f;" horiz-adv-x="288"
+d="M287 279c1 -3 1 -5 1 -9v-244c0 -13 -9 -26 -21 -26h-243c-12 0 -24 13 -24 26v335c0 13 12 23 24 23h160c3 0 6 0 9 -2c2 -1 5 -2 7 -4l83 -92c2 -2 3 -4 4 -7zM193 337v-63h58zM32 32h224v210h-67c-15 0 -28 13 -28 28v82h-129v-320z" />
+ <glyph glyph-name="ion-drag" unicode="&#xf130;" horiz-adv-x="512"
+d="M0 272v32h512v-32h-512zM0 176v32h512v-32h-512zM0 80v32h512v-32h-512z" />
+ <glyph glyph-name="ion-earth" unicode="&#xf276;"
+d="M325 322c2 -4 7 -12 3 -15c-3 -2 -10 -2 -13 5s0 11 -5 9s-7 3 -6 4c1 2 3 3 5 4c0 2 -4 8 2 7c4 -1 12 -10 14 -14zM344 277v0v0zM403 251c0 0 -2 0 0 0v0zM224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM141 19l8 -4
+c3 -1 6 -2 10 -3c14 -5 28 -8 43 -10c28 -3 56 -1 83 8c15 5 30 11 43 20c6 4 6 16 10 24c8 16 -2 33 12 47c12 14 4 19 4 34c0 10 8 18 4 29c-1 4 -7 -3 -9 1c-5 7 -21 1 -28 2c-13 2 -24 14 -33 23c-5 5 0 20 1 26c4 15 0 33 19 38c5 1 5 9 10 11c5 1 10 3 15 4
+c9 1 17 -2 26 -2c10 0 14 -5 22 -11c7 -6 13 -3 22 -5c7 0 0 5 -2 8c-3 2 -6 2 -8 2c-16 4 -23 22 -36 30c-6 3 -9 2 -11 0c-1 -1 1 -12 1 -12c-1 -3 -10 -4 -13 -5c-9 -2 -29 17 -15 22c4 1 27 5 24 15c-3 6 2 13 -5 14c-8 1 -7 7 -15 8c-5 1 -5 11 -5 14c0 9 2 6 9 7
+c-17 11 -37 19 -57 24c-1 -3 -5 -12 -8 -12c-5 -1 -6 0 -9 -3c-9 -10 -16 -28 -25 -7c-4 11 5 19 2 28h-6h-3c6 -12 -5 -18 -8 -19c-8 0 -10 5 -17 4c-4 -1 -7 4 -11 2s-13 -8 -14 -12c-3 -12 6 -13 14 -6c6 6 17 12 25 6c6 -5 5 -9 5 -14s-1 -18 -9 -16c-4 1 -7 6 -11 3
+c-8 -7 -18 -6 -29 -9c-10 -2 -16 -6 -25 -9c-8 -3 -11 -4 -12 -12c0 -2 0 -14 -3 -15c-5 -2 -8 22 -22 20c-12 -1 -30 -13 -25 -28c2 -5 28 -3 10 -14c-2 -1 2 -17 2 -20c1 -8 13 -18 21 -10c6 6 6 5 14 2c15 -8 33 -15 45 -27c6 -6 9 -24 17 -28c9 -5 19 -5 26 -14
+c6 -7 -2 -19 -8 -23c-4 -2 -12 -24 -16 -29c-2 -4 -12 -6 -16 -7c-3 0 -7 -9 -9 -11c-7 -7 -8 -13 -17 -19c-18 -12 -22 -23 -18 -44c2 -8 5 -13 11 -16zM100 46l2 -2c7 -6 15 -11 23 -16c-21 21 -23 49 -21 78l3 24c1 3 -4 7 -4 11c0 10 0 5 -8 13c-4 4 -10 11 -12 17
+c-7 16 1 30 10 43c9 14 -7 20 -10 32c-1 6 -7 6 -6 12c1 7 -4 5 -9 9c-12 8 -1 20 -7 26c-43 -70 -36 -162 16 -224c1 -1 0 -1 1 -2h1c3 -4 6 -8 9 -11s7 -6 10 -9z" />
+ <glyph glyph-name="ion-easel" unicode="&#xf3c2;"
+d="M48 112v192h352v-192h-352zM432 352c9 0 16 -7 16 -16v-256c0 -9 -7 -16 -16 -16h-416c-9 0 -16 7 -16 16v256c0 9 7 16 16 16h416zM416 96v224h-384v-224h384zM48 -32l29 80h31l-28 -80h-32zM239 416l17 -48h-64l17 48h30zM340 48h31l29 -80h-32zM208 0v48h32v-48h-32z
+" />
+ <glyph glyph-name="ion-edit" unicode="&#xf2bf;"
+d="M381 259l-250 -251l-91 91l251 250zM440 360c12 -12 11 -32 -2 -45l-45 -45l-91 91l45 45c13 13 33 14 45 2zM32 85l85 -85l-117 -32z" />
+ <glyph glyph-name="ion-egg" unicode="&#xf277;" horiz-adv-x="320"
+d="M160 416c64 0 160 -133 160 -257s-64 -191 -160 -191s-160 67 -160 191s96 257 160 257z" />
+ <glyph glyph-name="ion-eject" unicode="&#xf131;" horiz-adv-x="320"
+d="M303 128h-286v0c-10 0 -17 7 -17 16c0 3 1 5 3 8l138 191c5 5 11 9 19 9s14 -4 19 -9l138 -190c2 -3 3 -6 3 -9c0 -9 -7 -16 -17 -16v0zM308 96c7 0 12 -5 12 -12v-40c0 -7 -5 -12 -12 -12h-296c-7 0 -12 5 -12 12v40c0 7 5 12 12 12h296z" />
+ <glyph glyph-name="ion-email-unread" unicode="&#xf3c3;" horiz-adv-x="480"
+d="M352 288c0 43 21 64 64 64s64 -21 64 -64s-21 -64 -64 -64s-64 21 -64 64zM209 288h127c0 -17 5 -33 15 -47c-6 -3 -14 -8 -22 -12s-16 -8 -23 -12s-14 -8 -22 -12s-15 -8 -21 -11s-11 -6 -16 -9s-9 -5 -12 -7s-4 -3 -5 -3c-6 -3 -13 -4 -21 -4s-15 1 -21 4
+c-1 1 -15 8 -42 23s-54 29 -81 44s-43 23 -46 25c-7 4 -12 8 -13 11c-1 4 -1 6 1 8s6 2 11 2h191zM277 175c18 11 45 30 83 56c16 -15 34 -23 56 -23v-155c0 -2 -1 -4 -2 -7s-3 -5 -5 -7s-4 -4 -7 -5s-6 -2 -8 -2h-185h-185c-5 0 -11 2 -16 7s-8 9 -8 14v205c0 6 3 8 9 5
+c2 -1 11 -7 26 -17s32 -22 53 -36s39 -26 53 -35l-83 -93c-2 -2 -2 -4 -1 -5c2 -1 4 -1 6 1l98 83c16 -10 25 -16 27 -17c6 -3 13 -4 21 -4s15 1 21 4c2 1 11 7 27 17l98 -83c2 -2 5 -2 6 -1s0 3 -2 5z" />
+ <glyph glyph-name="ion-email" unicode="&#xf132;" horiz-adv-x="416"
+d="M19 299c-4 2 -11 7 -13 11c-3 8 1 10 12 10h191h191c11 0 15 -2 12 -10c-2 -4 -9 -9 -13 -11c-11 -6 -163 -89 -169 -92s-12 -4 -21 -4s-15 1 -21 4s-158 86 -169 92zM408 295c9 4 8 -1 8 -5v-205c0 -9 -12 -21 -22 -21h-185h-185c-10 0 -24 12 -24 21v205s0 9 9 5
+c8 -4 83 -56 132 -88l-83 -93c-2 -2 -2 -4 -1 -5s4 -1 6 1l98 83c15 -10 25 -16 27 -17c8 -4 14 -4 21 -4s13 0 21 4c2 1 12 7 27 17l98 -83c2 -2 5 -2 6 -1s0 3 -2 5l-82 93c49 32 123 84 131 88z" />
+ <glyph glyph-name="ion-erlenmeyer-flask-bubbles" unicode="&#xf3c4;" horiz-adv-x="384"
+d="M382 21c2 -4 3 -10 0 -14s-8 -7 -13 -7h-177h-178c-5 0 -9 3 -12 7s-2 10 0 14l118 199v150c0 8 6 14 14 14s15 -6 15 -14v-80c4 3 10 5 16 5c15 0 27 -12 27 -27s-12 -26 -27 -26c-6 0 -12 2 -16 5v-31c0 -2 -1 -4 -2 -6l-35 -59h72c-15 6 -26 20 -26 37
+c0 23 19 42 43 42c15 0 27 -8 35 -19c-1 2 -1 3 -1 5v154c0 8 6 14 14 14s15 -6 15 -14v-150zM218 151h53l-31 54c2 -5 3 -11 3 -17c0 -17 -10 -31 -25 -37zM201 319c-12 0 -22 9 -22 21s10 21 22 21s22 -9 22 -21s-10 -21 -22 -21z" />
+ <glyph glyph-name="ion-erlenmeyer-flask" unicode="&#xf3c5;" horiz-adv-x="384"
+d="M375 52c6 -9 9 -20 9 -32c0 -28 -16 -52 -63 -52h-258c-47 0 -63 24 -63 52c0 12 3 23 9 32l49 73l49 77c13 20 21 44 21 70v92s-14 34 -16 43c-2 8 1 9 17 9h126c16 0 18 -1 16 -9c-2 -9 -15 -22 -15 -42v-93c0 -26 6 -50 19 -70zM345 7c3 3 7 8 7 14c0 5 -2 10 -4 14
+l-101 150c-16 26 -23 56 -23 87v112h-64v-112c0 -32 -9 -62 -25 -87l-99 -150c-2 -4 -4 -9 -4 -14c0 -6 3 -11 6 -14c4 -4 12 -7 25 -7h258c13 0 20 3 24 7zM325 37c1 -2 3 -6 3 -8c0 -7 -6 -15 -14 -15h-244c-7 0 -14 6 -14 14c0 3 1 6 3 8l81 124h103l82 -124v1zM238 106
+c2 -1 4 -2 6 -2s3 0 5 2c1 2 3 4 3 6s-1 4 -3 6c-1 2 -3 2 -5 2s-4 0 -6 -2c-1 -2 -2 -4 -2 -6s0 -4 2 -6zM285 47c4 2 4 7 2 11l-23 36c-1 2 -4 4 -7 4c-2 0 -3 0 -4 -1c-4 -2 -4 -7 -2 -11l23 -36c1 -2 5 -4 7 -4c1 0 3 0 4 1z" />
+ <glyph glyph-name="ion-eye-disabled" unicode="&#xf306;"
+d="M344 290c41 -27 76 -66 104 -100c-51 -54 -124 -135 -224 -135c-36 0 -65 8 -92 22l-77 -77l-23 23l71 71c-36 25 -68 61 -103 98c78 85 142 137 224 137c34 0 64 -9 92 -23l77 78l23 -23zM134 192c0 -19 6 -36 16 -51l27 27c-4 7 -5 15 -5 24c0 29 23 53 52 53h8
+c-5 -6 -8 -13 -8 -21c0 -3 0 -5 1 -8l51 50c-15 11 -33 17 -52 17c-49 0 -90 -41 -90 -91zM224 101c49 0 90 41 90 91c0 19 -6 37 -16 52l-50 -51c3 -1 5 -1 8 -1c8 0 14 3 20 7v-7c0 -29 -23 -53 -52 -53c-9 0 -17 2 -24 6l-28 -27c15 -11 33 -17 52 -17z" />
+ <glyph glyph-name="ion-eye" unicode="&#xf133;"
+d="M224 320c99 0 172 -70 224 -129c-51 -50 -124 -127 -224 -127s-157 60 -224 128c78 79 142 128 224 128zM224 101c49 0 90 41 90 91s-41 91 -90 91s-90 -41 -90 -91s41 -91 90 -91zM224 224c0 -18 14 -32 32 -32c8 0 14 3 20 7v-7c0 -29 -23 -53 -52 -53s-52 24 -52 53
+s23 53 52 53h8c-5 -6 -8 -13 -8 -21z" />
+ <glyph glyph-name="ion-female" unicode="&#xf278;" horiz-adv-x="256"
+d="M160 164v-68h64v-64h-64v-64h-64v64h-64v64h64v68c-55 14 -96 64 -96 124c0 71 57 128 128 128s128 -57 128 -128c0 -60 -41 -110 -96 -124zM128 208c44 0 80 36 80 80s-36 80 -80 80s-80 -36 -80 -80s36 -80 80 -80z" />
+ <glyph glyph-name="ion-filing" unicode="&#xf134;" horiz-adv-x="384"
+d="M317 319c12 0 19 0 19 -20v-28h-288v28c0 20 8 20 20 20h249zM269 352c13 0 19 -1 19 -19h-192c0 18 7 19 20 19h153zM368 278c13 -8 17 -17 15 -41l-17 -184c-4 -21 -16 -21 -24 -21h-300c-8 0 -20 0 -24 21l-17 185c-3 26 1 31 15 40l15 10v-32h321v32z" />
+ <glyph glyph-name="ion-film-marker" unicode="&#xf135;" horiz-adv-x="416"
+d="M400 240c9 0 16 -7 16 -15v-210c0 -8 -7 -15 -16 -15h-384c-9 0 -16 7 -16 15v210c0 8 6 14 13 15c-2 2 -3 4 -4 7l-9 45c-2 8 5 16 13 18l370 74c8 2 16 -4 18 -12l9 -46c2 -8 -4 -16 -12 -18l-342 -68h344zM257 46l-20 58l51 36h-62l-20 58l-19 -58h-63l51 -36l-19 -58
+l50 36z" />
+ <glyph glyph-name="ion-fireball" unicode="&#xf319;" horiz-adv-x="320"
+d="M297 210c14 -24 23 -52 23 -82c0 -33 -10 -63 -26 -88v0v0c-29 -43 -78 -72 -134 -72c-17 0 -32 1 -46 7s-25 13 -33 25c-11 16 -17 28 -21 52c-6 -25 2 -48 9 -60c-43 26 -69 71 -69 125v4c5 78 65 109 90 151c8 14 13 30 10 48c11 -9 15 -25 15 -39
+c0 -16 -3 -29 -3 -29c4 8 7 18 9 31c6 35 2 85 -37 132l-1 1s7 0 18 -3c95 -16 169 -91 184 -186c2 -12 3 -23 3 -35c0 -16 -2 -32 -5 -47c10 23 13 43 14 55v10z" />
+ <glyph glyph-name="ion-flag" unicode="&#xf279;" horiz-adv-x="384"
+d="M362 266c0 0 12 2 22 6c0 -16 -7 -32 -9 -36c-28 -50 -99 -123 -181 -84c-65 31 -92 30 -117 24c-1 0 -2 -1 -3 -1c-3 -1 -15 -5 -26 -1v197c0 16 14 31 33 35c39 7 106 5 148 -74c39 -74 97 -72 133 -66zM24 416c4 0 8 -4 8 -8v-432c0 -4 -4 -8 -8 -8h-16
+c-4 0 -8 4 -8 8v432c0 4 4 8 8 8h16z" />
+ <glyph glyph-name="ion-flame" unicode="&#xf31a;" horiz-adv-x="256"
+d="M1 128c-11 109 72 224 159 288c-26 -145 97 -142 96 -288c-1 -120 -105 -160 -128 -160s-114 26 -127 160zM88 80c0 -44 40 -80 40 -80s41 36 41 80s-41 80 -41 80s-40 -36 -40 -80z" />
+ <glyph glyph-name="ion-flash-off" unicode="&#xf136;"
+d="M115 -4c-69 38 -115 112 -115 196c0 124 100 224 224 224c24 0 47 -4 68 -11c2 -1 3 -1 5 -2c12 -4 24 -9 35 -15v0c69 -38 116 -112 116 -196c0 -124 -100 -224 -224 -224c-24 0 -47 4 -68 11c-2 1 -3 1 -5 2c-12 4 -24 8 -35 14zM86 291c-20 -28 -32 -62 -32 -99
+c0 -65 36 -121 90 -150c6 -3 13 -7 19 -9c2 -1 3 -1 5 -2c9 -3 19 -5 29 -7c9 -2 18 -2 27 -2c37 0 71 12 99 32l-52 53l36 40l55 -54c20 28 32 62 32 99c0 66 -37 123 -91 151c-6 3 -12 6 -18 8c-2 1 -3 1 -5 2c-9 3 -19 5 -29 7c-9 2 -18 2 -27 2c-37 0 -72 -12 -100 -32
+l53 -52l-36 -41zM178 58l38 113h-85l139 155l-38 -113h85z" />
+ <glyph glyph-name="ion-flash" unicode="&#xf137;" horiz-adv-x="320"
+d="M0 160l224 256l-51 -192h147l-224 -256l51 192h-147z" />
+ <glyph glyph-name="ion-folder" unicode="&#xf139;" horiz-adv-x="384"
+d="M366 256c18 0 19 -7 18 -18l-12 -186c-1 -11 -3 -20 -21 -20h-317c-18 0 -20 9 -21 20l-13 184c-1 11 0 20 18 20h348zM362 305l2 -33h-344c0 6 4 46 6 63c2 18 8 17 25 17h75c28 0 23 0 37 -15c16 -18 19 -17 41 -17h143c11 0 15 -3 15 -15z" />
+ <glyph glyph-name="ion-fork-repo" unicode="&#xf2c0;" horiz-adv-x="320"
+d="M320 368v-64h-48v-48h-64v48h-48v64h48v48h64v-48h48zM208 208h64v-5v0c0 -43 -7 -70 -38 -95c-23 -19 -51 -20 -75 -22c-9 -1 -18 -2 -26 -3c-6 -1 -13 -5 -20 -10c9 -11 15 -25 15 -41c0 -35 -29 -64 -64 -64s-64 29 -64 64c0 24 13 44 32 55v210c-19 11 -32 31 -32 55
+c0 35 29 64 64 64s64 -29 64 -64c0 -24 -13 -44 -32 -55v-160c8 4 18 7 27 9c11 2 21 2 31 3c17 1 33 3 40 9c10 8 14 11 14 50zM64 384c-18 0 -32 -14 -32 -32s14 -32 32 -32s32 14 32 32s-14 32 -32 32zM64 0c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32
+s14 -32 32 -32z" />
+ <glyph glyph-name="ion-fork" unicode="&#xf27a;" horiz-adv-x="128"
+d="M78 299v0v0v0zM128 282c0 -26 -15 -48 -37 -58c-12 -6 -11 -11 -11 -11s16 -200 16 -213s-3 -18 -9 -24s-15 -8 -23 -8v0v0c-8 0 -16 2 -22 8s-10 13 -10 24s16 213 16 213s0 6 -11 11c-22 10 -37 32 -37 58c0 43 15 93 24 134h8v-117c0 -6 3 -11 9 -11s9 4 10 10v1
+l9 117h8l10 -117v-1c1 -6 3 -10 9 -10s9 5 9 11v117h8v0c9 -40 24 -91 24 -134z" />
+ <glyph glyph-name="ion-forward" unicode="&#xf13a;" horiz-adv-x="384"
+d="M224 150c-102 0 -171 -9 -224 -102c0 0 37 208 224 208v80l160 -144l-160 -134v92z" />
+ <glyph glyph-name="ion-funnel" unicode="&#xf31b;"
+d="M224 416c124 0 224 -36 224 -80c0 -8 -3 -15 -9 -22v0c-35 -43 -151 -179 -151 -218v-4v-83v0c0 -23 -29 -41 -64 -41s-64 18 -64 41v0v87c0 39 -117 177 -149 216v0c-7 8 -11 16 -11 24c0 44 100 80 224 80zM224 288c92 0 176 22 176 48s-83 48 -176 48
+s-176 -22 -176 -48s84 -48 176 -48z" />
+ <glyph glyph-name="ion-gear-a" unicode="&#xf13d;" horiz-adv-x="384"
+d="M347 192c0 -24 15 -43 37 -56c-4 -13 -10 -26 -16 -38c-25 6 -45 -3 -62 -20s-22 -37 -16 -62c-12 -6 -25 -12 -38 -16c-13 22 -36 37 -60 37s-47 -15 -60 -37c-13 4 -27 10 -39 16c6 25 2 45 -15 62s-37 21 -62 15c-6 12 -12 26 -16 39c22 13 37 36 37 60s-15 43 -37 56
+c4 13 9 26 16 38c25 -6 45 3 62 20s21 37 15 62c12 6 26 12 39 16c13 -22 36 -37 60 -37s47 15 60 37c13 -4 27 -10 39 -16c-6 -25 -2 -45 15 -62s37 -26 62 -20c6 -12 12 -25 16 -38c-22 -13 -37 -32 -37 -56zM192 94c54 0 98 44 98 98s-44 98 -98 98s-98 -44 -98 -98
+s44 -98 98 -98z" />
+ <glyph glyph-name="ion-gear-b" unicode="&#xf13e;" horiz-adv-x="384"
+d="M384 154h-44c-4 -14 -10 -27 -17 -39l32 -32l-54 -54l-33 32c-12 -7 -24 -11 -38 -15v-46h-76v46c-13 4 -26 8 -38 15l-33 -32l-54 54l32 32c-7 12 -13 25 -17 39h-44v76h43c4 14 9 29 16 41l-30 30l54 54l29 -29c13 8 27 13 42 17v41h76v-41c15 -4 29 -9 42 -17l29 29
+l54 -54l-30 -30c7 -12 13 -27 16 -41h43v-76zM192 138c30 0 54 24 54 54s-24 54 -54 54s-54 -24 -54 -54s24 -54 54 -54z" />
+ <glyph glyph-name="ion-grid" unicode="&#xf13f;" horiz-adv-x="320"
+d="M64 295c0 -4 -3 -7 -7 -7h-50c-4 0 -7 3 -7 7v50c0 4 3 7 7 7h50c4 0 7 -3 7 -7v-50zM192 295c0 -4 -3 -7 -7 -7h-50c-4 0 -7 3 -7 7v50c0 4 3 7 7 7h50c4 0 7 -3 7 -7v-50zM320 295c0 -4 -3 -7 -7 -7h-50c-4 0 -7 3 -7 7v50c0 4 3 7 7 7h50c4 0 7 -3 7 -7v-50zM64 167
+c0 -4 -3 -7 -7 -7h-50c-4 0 -7 3 -7 7v50c0 4 3 7 7 7h50c4 0 7 -3 7 -7v-50zM192 167c0 -4 -3 -7 -7 -7h-50c-4 0 -7 3 -7 7v50c0 4 3 7 7 7h50c4 0 7 -3 7 -7v-50zM320 167c0 -4 -3 -7 -7 -7h-50c-4 0 -7 3 -7 7v50c0 4 3 7 7 7h50c4 0 7 -3 7 -7v-50zM64 39
+c0 -4 -3 -7 -7 -7h-50c-4 0 -7 3 -7 7v50c0 4 3 7 7 7h50c4 0 7 -3 7 -7v-50zM192 39c0 -4 -3 -7 -7 -7h-50c-4 0 -7 3 -7 7v50c0 4 3 7 7 7h50c4 0 7 -3 7 -7v-50zM320 39c0 -4 -3 -7 -7 -7h-50c-4 0 -7 3 -7 7v50c0 4 3 7 7 7h50c4 0 7 -3 7 -7v-50z" />
+ <glyph glyph-name="ion-hammer" unicode="&#xf27b;" horiz-adv-x="320"
+d="M314 416c3 0 6 -3 6 -6v-84c0 -3 -3 -6 -6 -6h-52c-3 0 -6 3 -6 6v14c-6 5 -16 9 -22 7c-7 -2 -23 -13 -30 -25s-6 -28 -6 -66l8 -2c5 -1 7 -6 7 -9v-70c0 -95 11 -201 11 -201c0 -3 -3 -6 -6 -6h-84c-3 0 -6 3 -6 6c0 0 11 106 11 201v70c0 3 3 8 7 9l7 2
+c0 43 -5 58 -22 74c-18 16 -41 19 -63 17s-51 -35 -58 -45s-10 2 -10 11c1 16 22 60 72 81s91 22 102 22s27 -1 38 -3s16 -18 26 -18c7 0 14 5 18 9v6c0 3 3 6 6 6h52z" />
+ <glyph glyph-name="ion-happy-outline" unicode="&#xf3c6;"
+d="M355 158c8 -4 11 -13 7 -21c-24 -46 -78 -73 -138 -73c-62 0 -118 29 -139 74c-4 8 0 17 8 21c2 1 5 1 7 1c6 0 11 -3 14 -9c16 -34 60 -55 110 -55c49 0 92 21 110 56c3 5 8 8 14 8c3 0 5 -1 7 -2zM381 217c5 -7 4 -17 -4 -22c-3 -2 -6 -3 -10 -3c-5 0 -11 2 -14 6
+s-7 10 -17 10s-14 -6 -17 -10s-9 -6 -14 -6c-4 0 -7 1 -10 3c-8 6 -9 15 -3 22c11 14 23 23 44 23s35 -9 45 -23zM157 217c5 -7 4 -17 -4 -22c-3 -2 -6 -3 -10 -3c-5 0 -11 2 -14 6s-7 10 -17 10s-14 -6 -17 -10s-9 -6 -14 -6c-4 0 -7 1 -10 3c-8 6 -9 15 -3 22
+c11 14 23 23 44 23s35 -9 45 -23zM224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM360 56c36 36 56 85 56 136s-20 100 -56 136s-85 56 -136 56s-100 -20 -136 -56s-56 -85 -56 -136s20 -100 56 -136s85 -56 136 -56
+s100 20 136 56z" />
+ <glyph glyph-name="ion-happy" unicode="&#xf31c;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM71 195c3 -2 6 -3 10 -3c5 0 11 2 14 6s7 10 17 10s14 -6 17 -10s9 -6 14 -6c4 0 7 1 10 3c8 5 9 15 4 22c-10 14 -24 23 -45 23s-33 -9 -44 -23c-6 -7 -5 -16 3 -22zM362 137
+c4 8 1 17 -7 21c-2 1 -4 2 -7 2c-6 0 -11 -3 -14 -8c-18 -35 -61 -56 -110 -56c-50 0 -94 21 -110 55c-3 6 -8 9 -14 9c-2 0 -5 0 -7 -1c-8 -4 -12 -13 -8 -21c21 -45 77 -74 139 -74c60 0 114 27 138 73zM377 195c8 5 9 15 4 22c-10 14 -24 23 -45 23s-33 -9 -44 -23
+c-6 -7 -5 -16 3 -22c3 -2 6 -3 10 -3c5 0 11 2 14 6s7 10 17 10s14 -6 17 -10s9 -6 14 -6c4 0 7 1 10 3z" />
+ <glyph glyph-name="ion-headphone" unicode="&#xf140;" horiz-adv-x="384"
+d="M383 210c3 -51 -3 -130 -13 -162c-20 -67 -40 -80 -72 -80s-58 27 -58 59v106c0 33 23 59 53 59c18 0 34 -9 44 -24c0 0 11 7 13 22s4 34 -5 64s-21 19 -36 38c-2 3 -5 7 -8 10l-10 10c-2 2 -3 3 -5 4c-11 9 -21 17 -34 23c-19 9 -39 13 -60 13s-42 -4 -61 -13
+c-13 -6 -22 -14 -33 -23c-2 -1 -3 -2 -5 -4l-10 -10s-6 -7 -8 -10c-15 -19 -27 -8 -36 -38c-9 -31 -7 -49 -5 -64s13 -22 13 -22c10 15 26 24 44 24c30 0 53 -27 53 -59v-106c0 -32 -26 -59 -58 -59s-52 13 -72 80c-10 32 -16 111 -13 162c3 60 22 108 56 145v0
+c8 8 15 16 24 23s19 13 29 18c25 13 53 20 82 20s57 -7 82 -20c10 -5 19 -11 28 -18s17 -15 25 -23v0c34 -37 53 -85 56 -145z" />
+ <glyph glyph-name="ion-heart-broken" unicode="&#xf31d;" horiz-adv-x="416"
+d="M181 160c0 -36 -2 -71 4 -107c2 -10 2 -20 2 -31l-153 159c-45 47 -45 124 0 171c40 41 103 43 144 3c-2 -15 -3 -31 -3 -46c-18 -14 -40 -21 -56 -39l11 7c17 11 15 8 35 14c3 1 8 3 11 5c0 -1 -1 -5 -1 -6c1 -20 11 -39 15 -60c0 -5 1 -10 -1 -15c-8 -17 -7 -37 -8 -55
+zM274 147c8 -18 23 -29 38 -39l-104 -108l-17 18c0 13 -4 26 -4 38c-2 48 10 94 21 142v0c1 -1 2 -1 3 -1c30 -6 52 -24 63 -50zM382 352c46 -47 46 -124 0 -171l-68 -70c-28 24 -42 54 -65 81c-12 13 -26 23 -41 32c-3 13 -8 26 -11 39c-3 12 14 21 16 31c3 12 3 26 3 39
+l19 19c40 42 107 42 147 0z" />
+ <glyph glyph-name="ion-heart" unicode="&#xf141;" horiz-adv-x="416"
+d="M382 352c46 -47 46 -124 0 -171l-174 -181l-174 181c-46 47 -46 124 0 171c40 42 107 42 147 0l27 -28l28 28c40 42 106 42 146 0z" />
+ <glyph glyph-name="ion-help-buoy" unicode="&#xf27c;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM402 264c-10 24 -23 45 -42 64s-41 32 -65 42l-19 -61c14 -6 27 -15 38 -26s21 -24 27 -38zM224 96c53 0 96 43 96 96s-43 96 -96 96s-96 -43 -96 -96s43 -96 96 -96zM88 328
+c-19 -19 -32 -41 -42 -65l61 -19c6 14 15 27 26 38s24 21 38 27l-19 61c-24 -10 -45 -23 -64 -42zM46 120c10 -24 23 -45 42 -64s41 -32 65 -42l19 61c-14 6 -27 15 -38 26s-21 24 -27 38zM360 56c19 19 32 41 42 65l-61 19c-6 -14 -15 -27 -26 -38s-24 -21 -38 -27l19 -61
+c24 10 45 23 64 42z" />
+ <glyph glyph-name="ion-help-circled" unicode="&#xf142;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM244 89c1 18 -12 31 -29 31c-16 0 -30 -11 -30 -29s12 -30 28 -30c17 0 31 10 31 28zM293 217c7 10 12 22 12 36c0 23 -9 40 -25 52c-17 13 -37 18 -62 18
+c-19 0 -34 -4 -47 -13c-19 -13 -28 -34 -28 -68h49c0 9 -1 19 4 27s13 15 26 15s19 -3 25 -11c5 -7 8 -15 8 -23c0 -7 -4 -14 -8 -20c-2 -4 -6 -7 -10 -10c0 0 -26 -15 -35 -30c-7 -11 -9 -24 -10 -41c0 -1 0 -4 4 -4h39s5 3 5 4c0 6 1 15 2 19c2 7 6 12 12 17l14 9
+c12 9 21 17 25 23z" />
+ <glyph glyph-name="ion-help" unicode="&#xf143;" horiz-adv-x="256"
+d="M217 371c25 -19 39 -46 39 -83c0 -22 -8 -42 -19 -57c-7 -9 -21 -21 -40 -36l-21 -14c-10 -8 -17 -18 -20 -28c-2 -6 -3 -19 -3 -29c0 -2 -1 -6 -7 -6h-62c-7 0 -7 3 -7 5c1 26 4 49 15 66c15 23 57 48 57 48c6 5 11 9 15 15c7 10 12 21 12 32c0 13 -3 26 -11 36
+c-10 12 -21 18 -41 18s-32 -11 -40 -24s-7 -29 -7 -43h-77c0 54 14 88 44 108c20 14 45 20 75 20c39 0 70 -7 98 -28zM114 78c27 -1 47 -20 46 -48s-22 -46 -49 -45c-26 1 -46 19 -45 47s22 47 48 46z" />
+ <glyph glyph-name="ion-home" unicode="&#xf144;" horiz-adv-x="384"
+d="M384 160h-48v-160h-96v128h-96v-128h-96v160h-48l192 224z" />
+ <glyph glyph-name="ion-icecream" unicode="&#xf27d;" horiz-adv-x="320"
+d="M32 192h256l-128 -224zM307 275c8 -5 13 -13 13 -23c0 -16 -14 -28 -30 -28h-4h-252h-4c-16 0 -30 13 -30 28c0 10 6 18 14 23c1 0 1 2 2 2c4 3 7 7 8 12v1c-2 6 -2 12 -2 18c0 42 34 76 76 76c8 0 16 -2 23 -4c-3 -12 -4 -31 -4 -31c2 15 11 29 11 29c18 23 46 38 77 38
+c53 0 96 -43 96 -96c0 -11 -2 -21 -5 -30v-1c0 -4 4 -9 8 -12c1 0 2 -2 3 -2z" />
+ <glyph glyph-name="ion-image" unicode="&#xf147;"
+d="M336 224c-26 0 -48 22 -48 48s22 48 48 48s48 -22 48 -48s-22 -48 -48 -48zM420 384c16 0 28 -12 28 -28v-328c0 -16 -12 -28 -28 -28h-392c-16 0 -28 12 -28 28v328c0 16 12 28 28 28h392zM317 186l99 -106v260c0 7 -6 12 -13 12h-358c-7 0 -12 -5 -13 -12v-260l126 152
+c4 4 10 8 17 8s13 -2 17 -7l54 -59l4 -4c3 -2 7 -4 11 -4s8 2 12 5l18 16c4 3 8 5 13 5s10 -2 13 -6z" />
+ <glyph glyph-name="ion-images" unicode="&#xf148;"
+d="M426 308c13 -1 23 -12 22 -24l-14 -263c-1 -13 -12 -22 -25 -21l-330 16c-13 1 -23 10 -22 23l2 46l-15 -1c-12 -1 -22 7 -23 18l-21 236c-1 11 7 21 19 22l296 24c12 1 22 -7 23 -18l5 -54zM71 302c1 12 11 22 24 22l219 -11l-2 31h-1v1c-1 5 -5 8 -10 8l-261 -22
+c-5 0 -10 -4 -10 -9v0v-1l16 -178l18 25zM405 66l10 198v1v0c0 6 -5 10 -11 10l-58 3l-29 2l-204 9c-6 0 -11 -4 -12 -9v0v-1l-3 -63l-7 -128v-7l6 7l102 109c4 4 8 6 14 6s11 -3 14 -7l43 -49l3 -3c2 -2 6 -4 10 -4s5 1 9 3l17 12c4 3 7 4 11 4s9 -2 11 -5l27 -33zM341 186
+c-20 0 -35 15 -35 35s16 35 35 35c20 0 35 -16 35 -35s-16 -35 -35 -35z" />
+ <glyph glyph-name="ion-information-circled" unicode="&#xf149;"
+d="M448 195c2 -124 -97 -225 -221 -227s-225 97 -227 221s97 225 221 227s225 -97 227 -221zM224 336c-18 0 -32 -14 -32 -32s14 -32 32 -32s32 14 32 32s-14 32 -32 32zM268 53v11h-22v172h-66v-12h22v-160h-22v-11h88z" />
+ <glyph glyph-name="ion-information" unicode="&#xf14a;" horiz-adv-x="128"
+d="M96 0h32v-16h-128v16h32v240h-32v16h96v-256zM64 304c-27 0 -48 21 -48 48s21 48 48 48s48 -21 48 -48s-21 -48 -48 -48z" />
+ <glyph glyph-name="ion-ionic" unicode="&#xf14b;" horiz-adv-x="416"
+d="M376 315c25 -34 40 -77 40 -123c0 -115 -93 -208 -208 -208s-208 93 -208 208s93 208 208 208c46 0 89 -15 123 -40c5 3 11 5 18 5c18 0 32 -14 32 -32c0 -7 -2 -13 -5 -18zM344 56c18 18 31 38 41 61c10 24 15 49 15 75s-5 51 -15 75c-6 13 -13 26 -21 38
+c-4 -2 -10 -4 -15 -4c-18 0 -32 14 -32 32c0 5 2 11 4 15c-12 8 -25 15 -38 21c-24 10 -49 15 -75 15s-51 -5 -75 -15c-23 -10 -43 -23 -61 -41s-31 -38 -41 -61c-10 -24 -15 -49 -15 -75s5 -51 15 -75c10 -23 23 -43 41 -61s38 -31 61 -41c24 -10 49 -15 75 -15s51 5 75 15
+c23 10 43 23 61 41zM112 192c0 64 32 96 96 96s96 -32 96 -96s-32 -96 -96 -96s-96 32 -96 96z" />
+ <glyph glyph-name="ion-ios-alarm-outline" unicode="&#xf3c7;" horiz-adv-x="404"
+d="M384 256l-54 52l-9 -9c35 -32 57 -79 57 -130c0 -44 -16 -83 -43 -114l36 -45l-12 -10l-35 43c-32 -30 -75 -49 -122 -49v0v0c-47 0 -90 19 -122 49l-35 -43l-12 10l36 45c-27 31 -43 71 -43 115c0 51 22 97 57 129l-9 9l-54 -52c-12 14 -20 32 -20 52c0 44 35 80 80 82
+h5c20 0 39 -7 54 -18l-54 -52l11 -11c26 19 56 32 90 35v0c0 8 8 16 16 16s15 -8 15 -16v0c34 -3 65 -16 91 -35l11 11l-54 52c15 11 34 18 54 18h5c45 -2 80 -38 80 -82c0 -20 -8 -38 -20 -52zM22 280l91 89c-9 5 -19 7 -32 6c-37 -2 -65 -32 -65 -67c0 -10 2 -19 6 -28z
+M362 172c0 88 -72 158 -160 158s-160 -70 -160 -158s72 -158 160 -158s160 70 160 158zM291 369l91 -89c4 9 6 18 6 28c0 35 -28 65 -65 67c-13 1 -23 -1 -32 -6zM202 288h16v-144h-112v16h96v128z" />
+ <glyph glyph-name="ion-ios-alarm" unicode="&#xf3c8;" horiz-adv-x="404"
+d="M385 256l-55 52l-9 -9c35 -32 57 -79 57 -130c0 -44 -16 -83 -43 -114l37 -45l-13 -10l-35 43c-32 -30 -75 -49 -122 -49v0v0c-47 0 -90 19 -122 49l-35 -43l-12 10l36 45c-27 31 -43 70 -43 114c0 51 22 98 57 130l-9 9l-54 -52c-12 14 -20 32 -20 52c0 44 35 80 80 82
+h5c20 0 39 -7 54 -18l-54 -53l11 -10c26 19 56 32 90 35v0c0 8 8 16 16 16s15 -8 15 -16v0c34 -3 65 -16 91 -35l11 11l-54 52c15 11 34 18 54 18h5c45 -2 80 -38 80 -82c0 -20 -7 -38 -19 -52zM218 144v144h-16v-128h-96v-16h112z" />
+ <glyph glyph-name="ion-ios-albums-outline" unicode="&#xf3c9;"
+d="M432 304h-416v-288h416v288zM448 320v0v-320h-448v320h448zM40 336v16h368v-16h-368zM72 368v16h304v-16h-304z" />
+ <glyph glyph-name="ion-ios-albums" unicode="&#xf3ca;"
+d="M448 320v0v-320h-448v320h448zM40 336v16h368v-16h-368zM72 368v16h304v-16h-304z" />
+ <glyph glyph-name="ion-ios-americanfootball-outline" unicode="&#xf3cb;" horiz-adv-x="416"
+d="M331 315c112 -112 81 -327 81 -327s-26 -4 -65 -4c-73 0 -189 12 -262 85c-112 112 -81 327 -81 327s26 4 65 4c73 0 189 -12 262 -85zM17 383c-2 -19 -5 -60 0 -107c1 -8 2 -16 3 -23l127 127c-25 3 -51 5 -78 5v0v0c-22 0 -41 -1 -52 -2zM96 80c30 -30 72 -53 124 -66
+c10 -3 20 -5 31 -7l142 142c-4 22 -10 44 -17 63c-14 37 -32 68 -56 92c-30 30 -72 53 -124 66c-10 3 -20 5 -31 7l-142 -142c4 -22 10 -44 17 -63c14 -37 32 -68 56 -92zM399 1c2 19 5 60 0 107c-1 8 -2 16 -3 23l-127 -127c25 -3 51 -5 78 -5c22 0 41 1 52 2zM259 130
+l-28 -29l-12 12l29 28l-23 23l-28 -29l-12 12l29 28l-23 23l-28 -29l-12 12l29 28l-23 23l-28 -29l-12 12l29 28l-22 23l-29 -29l-11 12l67 67l12 -11l-29 -29l23 -22l28 29l12 -12l-29 -28l23 -23l28 29l12 -12l-29 -28l23 -23l28 29l12 -12l-29 -28l22 -23l29 29l12 -12
+l-29 -28l22 -23l29 29l11 -12l-67 -67l-12 11l29 29z" />
+ <glyph glyph-name="ion-ios-americanfootball" unicode="&#xf3cc;" horiz-adv-x="416"
+d="M331 315c112 -112 81 -327 81 -327s-26 -4 -65 -4c-73 0 -189 12 -262 85c-112 112 -81 327 -81 327s26 4 65 4c73 0 189 -12 262 -85zM20 253l3 -18l142 142l-18 3zM219 113l12 -12l28 29l23 -22l-29 -29l12 -11l67 67l-11 12l-29 -29l-22 23l29 28l-12 12l-28 -29
+l-23 23l29 28l-12 12l-28 -29l-23 23l29 28l-12 12l-28 -29l-23 23l29 28l-12 12l-28 -29l-23 22l29 29l-12 11l-67 -67l11 -12l29 29l22 -23l-29 -28l12 -12l28 29l23 -23l-29 -28l12 -12l28 29l23 -23l-29 -28l12 -12l28 29l23 -23zM269 4l127 127l-3 18l-142 -142z" />
+ <glyph glyph-name="ion-ios-analytics-outline" unicode="&#xf3cd;"
+d="M224 400c-28 0 -55 -5 -81 -16c-25 -10 -47 -26 -66 -45s-35 -41 -45 -66c-11 -26 -16 -53 -16 -81s5 -55 16 -81c10 -25 26 -47 45 -66s41 -35 66 -45c26 -11 53 -16 81 -16s55 5 81 16c25 10 47 26 66 45s35 41 45 66c11 26 16 53 16 81s-5 55 -16 81
+c-10 25 -26 47 -45 66s-41 35 -66 45c-26 11 -53 16 -81 16zM224 416v0c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM76 128c-25 0 -41 18 -42 19c-3 3 -2 9 1 12s8 2 11 -1c1 -1 15 -17 36 -14c12 2 27 26 38 42c4 6 9 12 12 16
+c17 21 34 23 45 21c24 -3 45 -28 54 -50c7 -18 18 -28 32 -29c15 -1 31 11 43 30c1 2 3 4 4 7c9 17 24 43 52 43c31 0 52 -35 53 -36c2 -4 1 -9 -3 -11s-9 -1 -11 3c0 0 -5 8 -12 15c-6 6 -16 13 -27 13c-18 0 -29 -19 -38 -35c-1 -3 -3 -5 -4 -7c-15 -25 -36 -40 -58 -38
+c-20 1 -36 15 -46 39s-28 39 -41 41c-11 1 -21 -4 -31 -16c-3 -4 -6 -9 -10 -15c-14 -20 -31 -45 -50 -48c-3 0 -5 -1 -8 -1z" />
+ <glyph glyph-name="ion-ios-analytics" unicode="&#xf3ce;"
+d="M224 416c124 0 224 -100 224 -224c0 -13 -1 -25 -3 -37c-1 -6 -2 -12 -3 -17c-24 -98 -113 -170 -218 -170c-122 0 -221 98 -224 219v5c0 9 1 17 2 26c13 111 107 198 222 198zM431 168c1 8 1 16 1 24c0 28 -5 55 -16 81c-10 25 -26 47 -45 66s-41 35 -66 45
+c-26 11 -53 16 -81 16s-55 -5 -81 -16c-25 -10 -47 -26 -66 -45s-35 -41 -45 -66c-11 -26 -16 -53 -16 -81v0c14 -21 29 -34 29 -34h1v-1c1 -1 15 -16 36 -13c12 2 27 26 38 42c4 6 9 12 12 16c17 21 34 23 45 21c24 -3 45 -27 54 -50c7 -18 18 -28 32 -29c15 -1 31 9 43 29
+c1 2 3 4 4 7c9 17 24 44 52 44c31 0 52 -35 53 -36c3 -4 9 -12 16 -20z" />
+ <glyph glyph-name="ion-ios-arrow-back" unicode="&#xf3cf;" horiz-adv-x="192"
+d="M192 320l-127 -128l127 -128l-32 -32l-160 160v0v0l160 160z" />
+ <glyph glyph-name="ion-ios-arrow-down" unicode="&#xf3d0;" horiz-adv-x="320"
+d="M301 288l19 -21l-160 -171l-160 171l19 21l141 -150z" />
+ <glyph glyph-name="ion-ios-arrow-forward" unicode="&#xf3d1;" horiz-adv-x="192"
+d="M0 320l32 32l160 -160v0v0l-160 -160l-32 32l127 128z" />
+ <glyph glyph-name="ion-ios-arrow-left" unicode="&#xf3d2;" horiz-adv-x="192"
+d="M192 333l-150 -141l150 -141l-21 -19l-171 160l171 160z" />
+ <glyph glyph-name="ion-ios-arrow-right" unicode="&#xf3d3;" horiz-adv-x="192"
+d="M0 333l21 19l171 -160l-171 -160l-21 19l150 141z" />
+ <glyph glyph-name="ion-ios-arrow-thin-down" unicode="&#xf3d4;" horiz-adv-x="192"
+d="M190 126c2 -2 2 -4 2 -6s0 -4 -2 -6c0 0 -87 -79 -88 -80s-3 -2 -6 -2s-5 1 -6 2s-88 80 -88 80c-3 3 -3 9 0 12s9 3 12 0l74 -67v285c0 4 4 8 8 8s8 -4 8 -8v-285l74 67c3 3 9 3 12 0z" />
+ <glyph glyph-name="ion-ios-arrow-thin-left" unicode="&#xf3d5;" horiz-adv-x="320"
+d="M94 98c-2 -2 -4 -2 -6 -2s-4 0 -6 2c0 0 -79 87 -80 88s-2 3 -2 6s1 5 2 6s80 88 80 88c3 3 9 3 12 0s3 -9 0 -12l-67 -74h285c4 0 8 -4 8 -8s-4 -8 -8 -8h-285l67 -74c3 -3 3 -9 0 -12z" />
+ <glyph glyph-name="ion-ios-arrow-thin-right" unicode="&#xf3d6;" horiz-adv-x="320"
+d="M226 98c-3 3 -3 9 0 12l67 74h-285c-4 0 -8 4 -8 8s4 8 8 8h285l-67 74c-3 3 -3 9 0 12s9 3 12 0c0 0 79 -87 80 -88s2 -3 2 -6s-1 -5 -2 -6s-80 -88 -80 -88c-2 -2 -4 -2 -6 -2s-4 0 -6 2z" />
+ <glyph glyph-name="ion-ios-arrow-thin-up" unicode="&#xf3d7;" horiz-adv-x="192"
+d="M190 258c-3 -3 -9 -3 -12 0l-74 67v-285c0 -4 -4 -8 -8 -8s-8 4 -8 8v285l-74 -67c-3 -3 -9 -3 -12 0s-3 9 0 12c0 0 87 79 88 80s3 2 6 2s5 -1 6 -2s88 -80 88 -80c2 -2 2 -4 2 -6s0 -4 -2 -6z" />
+ <glyph glyph-name="ion-ios-arrow-up" unicode="&#xf3d8;" horiz-adv-x="320"
+d="M301 96l-141 150l-141 -150l-19 21l160 171l160 -171z" />
+ <glyph glyph-name="ion-ios-at-outline" unicode="&#xf3d9;" horiz-adv-x="255"
+d="M236 127v1h19l-3 -6c-3 -6 -13 -19 -22 -27s-18 -14 -28 -20s-21 -10 -32 -13s-23 -5 -34 -5c-16 0 -33 3 -49 8s-30 13 -43 24c-12 11 -26 29 -34 46c-7 16 -10 33 -10 58c0 18 4 38 11 55c7 16 17 30 29 42s27 21 43 28c15 6 33 9 53 9c16 0 32 -3 46 -8
+c15 -5 28 -12 39 -22s17 -21 24 -35c6 -13 8 -26 8 -44c0 -14 -2 -28 -7 -40s-9 -20 -17 -30c-8 -9 -13 -15 -23 -21c-11 -6 -20 -9 -29 -9c-8 0 -15 2 -20 7c-3 2 -5 6 -6 9c-6 -6 -11 -10 -17 -12c-10 -3 -18 -4 -26 -4s-15 1 -21 4s-12 7 -17 12s-8 11 -11 18
+s-5 14 -5 22c0 12 3 24 7 36v2c4 11 5 16 13 26c8 11 17 19 28 26s24 11 38 11c12 0 21 -3 31 -9c7 -4 12 -10 16 -16l6 17h18l-38 -102c-2 -5 -4 -10 -5 -14s-1 -7 -1 -10c0 -2 1 -4 3 -5s4 -2 8 -2c6 0 11 2 20 7c8 4 12 9 19 17c6 8 10 14 14 25s6 23 6 35
+c0 15 -2 25 -7 36c-6 13 -10 22 -19 30s-20 15 -33 20s-27 7 -42 7c-19 0 -35 -3 -48 -9c-15 -6 -27 -14 -37 -24c-11 -10 -19 -23 -25 -37c-6 -15 -10 -32 -10 -48c0 -22 2 -36 8 -49c6 -15 17 -31 28 -41s24 -18 38 -23s30 -7 46 -7c10 0 20 1 30 4s18 6 27 11
+s17 11 24 18s14 13 19 21zM147 154c4 5 8 12 11 20l21 57c-2 5 -4 10 -7 13c-3 4 -6 6 -10 8c-1 0 -1 1 -2 1c-3 2 -5 3 -9 4c-5 1 -9 2 -13 2c-10 0 -19 -3 -28 -9s-17 -13 -23 -22c-5 -8 -7 -11 -10 -20c0 -1 -1 -3 -1 -4c-4 -11 -5 -20 -5 -30c0 -6 1 -11 3 -16
+s5 -9 8 -13s7 -6 12 -8s9 -3 15 -3c4 0 9 1 14 2c4 1 8 2 12 5s8 7 12 13z" />
+ <glyph glyph-name="ion-ios-at" unicode="&#xf3da;" horiz-adv-x="256"
+d="M228 128v0h28c-1 -1 -2 -4 -3 -6c-4 -6 -14 -19 -23 -27s-18 -14 -28 -20s-20 -10 -32 -13c-11 -3 -23 -5 -34 -5c-16 0 -33 3 -49 8s-30 13 -43 24c-12 10 -26 28 -34 46c-7 16 -10 33 -10 58c0 19 4 39 11 55s17 30 29 42s28 21 44 28c15 6 32 9 52 9c16 0 31 -3 46 -8
+s28 -12 39 -22s18 -22 25 -36c6 -14 8 -26 8 -44c0 -14 -2 -28 -7 -40c-4 -11 -9 -20 -17 -30c-7 -9 -14 -16 -24 -22c-12 -6 -21 -9 -30 -9s-16 2 -22 8c-2 1 -3 3 -4 5c-4 -4 -9 -6 -14 -8c-10 -3 -18 -5 -27 -5c-8 0 -16 2 -23 5s-12 7 -17 12s-9 12 -12 19s-4 14 -4 22
+c0 12 2 25 6 37l1 1c4 10 5 17 13 27c8 11 17 20 28 27c12 7 24 10 38 10c12 0 22 -3 33 -9c5 -3 8 -6 12 -10l5 12h25l-39 -104c-2 -5 -3 -9 -4 -13c-1 -3 -1 -7 -1 -9s0 -3 1 -3c0 0 1 -1 5 -1c5 0 11 2 19 7c7 4 10 8 16 16s9 13 13 23s6 20 6 32c0 14 -1 24 -6 34
+c-5 12 -10 21 -18 28c-9 8 -19 14 -31 18s-26 7 -40 7c-18 0 -32 -3 -44 -8c-14 -6 -25 -13 -35 -23s-18 -22 -24 -35c-6 -14 -9 -30 -9 -45c0 -21 3 -34 8 -46c6 -14 16 -30 26 -39s22 -16 35 -21c14 -5 28 -7 43 -7c10 0 20 2 29 4s18 6 26 11s28 20 38 33zM144 157
+c4 5 7 12 10 19l20 55c-1 4 -3 7 -5 9c-3 3 -6 6 -9 8h-1h-1v1c-3 2 -5 2 -8 3c-4 1 -8 1 -12 1c-9 0 -17 -2 -25 -7c-10 -6 -17 -14 -21 -21c-5 -8 -6 -11 -9 -19c0 -1 -1 -2 -1 -3c-3 -10 -6 -19 -6 -28c0 -5 1 -10 3 -14s4 -8 7 -11s7 -6 11 -8s8 -2 13 -2c4 0 8 0 12 1
+v0c4 1 7 2 11 5c3 2 7 5 11 11z" />
+ <glyph glyph-name="ion-ios-barcode-outline" unicode="&#xf3db;" horiz-adv-x="416"
+d="M0 64v256h80v-16h-64v-224h64v-16h-80zM336 320h80v-256h-80v16h64v224h-64v16zM64 128v128h16v-128h-16zM336 128v128h16v-128h-16zM272 96v192h16v-192h-16zM128 96v192h16v-192h-16zM199 112v160h16v-160h-16z" />
+ <glyph glyph-name="ion-ios-barcode" unicode="&#xf3dc;" horiz-adv-x="416"
+d="M0 320h416v-256h-416v256zM80 128v128h-16v-128h16zM144 96v192h-16v-192h16zM215 112v160h-16v-160h16zM288 96v192h-16v-192h16zM352 128v128h-16v-128h16z" />
+ <glyph glyph-name="ion-ios-baseball-outline" unicode="&#xf3dd;" horiz-adv-x="416"
+d="M415 169v-1v0c-11 -97 -90 -174 -187 -183v0h-2c-2 0 -3 -1 -5 -1h-1h-3h-1h-8c-115 0 -208 93 -208 208v8v1v3v1c0 2 1 3 1 5v2v0c9 97 86 176 183 187v0v0c8 1 16 1 24 1c115 0 208 -93 208 -208c0 -7 0 -14 -1 -20v0v-3zM399 192c0 105 -86 191 -191 191
+c-3 0 -5 -1 -8 -1c0 -11 2 -21 4 -31l20 6l5 -15l-21 -7c2 -7 4 -14 7 -21c2 -5 5 -11 8 -16l17 12l9 -13l-19 -13c7 -12 16 -23 26 -33l14 15l12 -12l-15 -15c11 -10 22 -18 34 -25l12 18l14 -9l-12 -17c5 -2 10 -5 15 -7c7 -3 14 -5 22 -7l7 20l15 -5l-6 -19
+c10 -2 20 -4 30 -4c0 3 1 5 1 8zM17 192c0 -105 86 -191 191 -191h4c-1 9 -1 17 -3 26l-22 -7l-5 16l23 7c-2 8 -5 16 -8 24c-2 5 -4 9 -6 14l-20 -13l-9 13l21 14c-7 12 -16 24 -26 35l-17 -17l-11 11l17 17c-10 10 -22 18 -34 25l-14 -21l-14 9l14 20c-5 2 -10 5 -15 7
+c-7 3 -15 6 -23 8l-8 -24l-15 5l7 23c-9 2 -18 2 -27 3v-4zM228 2c88 9 158 78 169 166c-11 1 -23 3 -34 5l-9 -27l-15 5l8 25c-14 4 -28 10 -41 17l-15 -23l-13 9l14 21c-13 8 -26 17 -37 28l-19 -19l-11 11l19 19c-10 11 -19 23 -27 36l-21 -14l-9 13l22 15
+c-7 13 -12 27 -16 41l-25 -8l-5 16l26 8c-2 12 -4 23 -5 35c-88 -11 -157 -81 -166 -169c10 -1 21 -2 31 -4l8 23l15 -5l-7 -22c14 -4 28 -9 42 -16l13 19l14 -9l-13 -18c13 -8 25 -17 36 -28l17 17l11 -11l-17 -17c11 -12 20 -24 28 -37l19 13l9 -14l-20 -13
+c7 -14 12 -28 16 -42l23 7l5 -15l-24 -8c2 -10 3 -20 4 -30z" />
+ <glyph glyph-name="ion-ios-baseball" unicode="&#xf3de;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208c0 -8 0 -16 -1 -24v0v0c-12 -104 -100 -184 -207 -184c-115 0 -208 93 -208 208c0 107 80 195 184 207v0v0c8 1 16 1 24 1zM212 1c5 0 11 0 16 1c-1 10 -2 20 -4 30l24 8l-5 15l-23 -7c-4 14 -9 28 -16 42l20 13l-9 14l-19 -13
+c-8 13 -17 25 -28 37l17 17l-11 11l-17 -17c-11 11 -23 20 -36 28l13 18l-14 9l-13 -19c-14 7 -28 12 -42 16l7 22l-15 5l-8 -23c-10 2 -21 3 -31 4c-1 -5 -1 -11 -1 -16c9 -1 18 -1 27 -3l-7 -23l15 -5l8 24c8 -2 16 -5 23 -8c5 -2 10 -5 15 -7l-14 -20l14 -9l14 21
+c12 -7 24 -15 34 -25l-17 -17l11 -11l17 17c10 -11 19 -23 26 -35l-21 -14l9 -13l20 13c2 -5 4 -9 6 -14c3 -8 6 -16 8 -24l-23 -7l5 -16l22 7c2 -8 2 -17 3 -26zM363 173c11 -2 23 -4 34 -5c1 5 1 11 1 16c-10 1 -20 2 -30 4l6 19l-15 5l-7 -20c-8 2 -15 4 -22 7
+c-5 2 -10 5 -15 7l12 17l-14 9l-12 -18c-12 7 -23 15 -34 25l15 15l-12 12l-15 -15c-10 10 -18 21 -25 33l19 13l-9 13l-17 -12c-3 5 -6 11 -8 16c-3 7 -5 14 -7 21l21 7l-5 15l-20 -6c-2 10 -3 20 -4 31c-5 0 -11 0 -16 -1c1 -12 3 -23 5 -35l-26 -8l5 -16l25 8
+c4 -14 9 -28 16 -41l-22 -15l9 -13l21 14c8 -13 17 -25 27 -36l-19 -19l11 -11l19 19c11 -11 24 -20 37 -28l-14 -21l13 -9l15 23c13 -7 27 -13 41 -17l-8 -25l15 -5z" />
+ <glyph glyph-name="ion-ios-basketball-outline" unicode="&#xf3df;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM399 192c0 55 -24 105 -62 140c-14 -34 -31 -65 -52 -95c15 -12 31 -21 49 -29c21 -9 43 -14 65 -16v0zM325 343c-32 25 -73 40 -117 40v0c2 -22 6 -44 15 -65
+c10 -25 26 -47 45 -66c2 -1 2 -3 4 -4c20 29 38 60 52 93c0 1 1 1 1 2zM192 382c-51 -4 -96 -29 -128 -65c64 -28 121 -69 169 -119c11 12 21 24 30 37c-40 37 -67 89 -71 147zM233 174c-15 -16 -31 -30 -48 -44c28 -35 45 -79 47 -127c33 4 63 17 88 35
+c-22 50 -51 95 -87 136zM214 178l8 8l-10 10c-46 46 -99 82 -158 108c-18 -25 -31 -55 -35 -88c62 -3 116 -31 155 -74c14 11 27 23 40 36zM18 200c0 -3 -1 -5 -1 -8c0 -45 16 -87 43 -120c36 16 71 36 102 60l-7 7c-19 19 -41 35 -66 45c-22 9 -46 15 -71 16zM71 59
+c35 -36 83 -58 137 -58c3 0 5 1 8 1c-1 25 -6 48 -16 71c-7 17 -17 33 -28 47c-31 -24 -65 -45 -101 -61zM333 48c37 32 61 77 65 128c-46 3 -89 21 -123 48c-10 -13 -20 -26 -31 -38c36 -41 67 -87 89 -138z" />
+ <glyph glyph-name="ion-ios-basketball" unicode="&#xf3e0;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM333 48c-22 51 -53 97 -89 138c11 12 21 25 31 38c34 -27 77 -45 123 -48c0 5 1 11 1 16c-22 2 -44 7 -65 16c-18 8 -34 17 -49 29c21 30 38 61 52 95c-4 4 -8 8 -12 11
+c0 -1 -1 -1 -1 -2c-14 -33 -32 -64 -52 -93c-2 1 -2 2 -4 4c-19 19 -35 41 -45 66c-9 21 -13 43 -15 65c-5 0 -11 -1 -16 -1c4 -58 31 -110 71 -147c-9 -13 -19 -25 -30 -37c-48 50 -105 91 -169 119c-4 -4 -7 -9 -10 -13c59 -26 112 -62 158 -108l10 -10l-8 -8
+c-13 -13 -26 -25 -40 -36c-39 43 -93 71 -155 74c-1 -5 -1 -11 -1 -16c25 -1 49 -7 71 -16c25 -10 47 -26 66 -45l7 -7c-31 -24 -66 -44 -102 -60c4 -4 7 -9 11 -13c36 16 70 37 101 61c11 -14 21 -30 28 -47c10 -23 15 -46 16 -71c5 0 11 0 16 1c-2 48 -19 92 -47 127
+c17 14 33 28 48 44c36 -41 65 -86 87 -136c4 3 9 6 13 10z" />
+ <glyph glyph-name="ion-ios-bell-outline" unicode="&#xf3e1;" horiz-adv-x="384"
+d="M318 222c0 -114 28 -126 66 -158h-384c38 32 66 44 66 158c0 98 53 130 102 138v2c0 12 11 22 24 22s24 -10 24 -22v-2c49 -7 102 -40 102 -138zM43 80h298c-25 25 -40 58 -40 142c0 46 -13 80 -37 101c-23 19 -52 23 -72 23s-49 -4 -72 -23c-25 -21 -37 -55 -37 -101
+c0 -51 -5 -85 -17 -110c-6 -13 -14 -23 -23 -32zM192 0c-27 0 -49 20 -52 43h104c-3 -23 -25 -43 -52 -43z" />
+ <glyph glyph-name="ion-ios-bell" unicode="&#xf3e2;" horiz-adv-x="384"
+d="M318 222c0 -114 28 -126 66 -158h-384c38 32 66 44 66 158c0 98 53 130 102 138v2c0 12 11 22 24 22s24 -10 24 -22v-2c49 -7 102 -40 102 -138zM192 0c-27 0 -49 20 -52 43h104c-3 -23 -25 -43 -52 -43z" />
+ <glyph glyph-name="ion-ios-body-outline" unicode="&#xf3e3;" horiz-adv-x="384"
+d="M192 400c-18 0 -32 -14 -32 -32s14 -32 32 -32s32 14 32 32s-14 32 -32 32zM192 416v0c27 0 48 -21 48 -48s-21 -48 -48 -48s-48 21 -48 48s21 48 48 48zM360 304c13 0 24 -11 24 -24s-11 -24 -24 -24h-100c-5 0 -14 -5 -18 -15c-5 -12 -2 -33 1 -51l4 -21v-1v0l32 -172
+c2 -13 -6 -26 -19 -28h-5c-11 0 -22 8 -24 20l-21 120v0s-5 31 -17 31h-2c-12 0 -19 -31 -19 -31v0l-21 -120c-2 -12 -11 -20 -22 -20h-5c-13 2 -21 15 -19 28l32 172v1l4 21c3 18 6 39 1 51c-4 10 -12 15 -18 15h-100c-13 0 -24 11 -24 24s11 24 24 24h336zM24 272
+c-4 0 -8 4 -8 8s4 8 8 8h336c4 0 8 -4 8 -8s-4 -8 -8 -8h-102c-16 0 -26 -15 -30 -24c-5 -13 -6 -32 -1 -61v0v0l3 -19l1 -3l32 -172c0 -3 0 -5 -1 -6s-2 -2 -5 -3h-2c-4 0 -7 2 -8 6l-21 120v0c0 2 -2 10 -5 19c-2 6 -5 11 -8 15c-7 9 -14 11 -20 11h-2
+c-5 0 -13 -2 -20 -11c-3 -4 -6 -9 -8 -15c-4 -9 -6 -17 -6 -18v-1l-21 -120c-1 -4 -3 -6 -7 -6h-2c-3 0 -4 2 -5 3s-2 3 -1 6l32 172v0v1l4 21v0v0c5 29 5 48 0 61c-4 9 -14 24 -32 24z" />
+ <glyph glyph-name="ion-ios-body" unicode="&#xf3e4;" horiz-adv-x="384"
+d="M144 368c0 32 16 48 48 48s48 -16 48 -48s-16 -48 -48 -48s-48 16 -48 48zM360 304c7 0 12 -2 17 -7s7 -10 7 -17s-2 -12 -7 -17s-10 -7 -17 -7h-98c-8 -2 -15 -6 -18 -14c-4 -9 -3 -27 1 -52l4 -21v-1v0l30 -172c1 -7 0 -13 -4 -18s-8 -9 -15 -10s-13 0 -18 4
+s-9 9 -10 16l-21 120v-1l-2 9c-1 5 -3 11 -6 16s-6 8 -10 8h-2c-8 0 -14 -11 -18 -33v1l-21 -120c-1 -7 -5 -12 -10 -16s-11 -5 -18 -4s-11 5 -15 10s-5 11 -4 18l30 172v0v1l4 21c4 25 5 43 1 52c-3 8 -10 12 -18 14h-98c-7 0 -12 2 -17 7s-7 10 -7 17s2 12 7 17s10 7 17 7
+h336z" />
+ <glyph glyph-name="ion-ios-bolt-outline" unicode="&#xf3e5;" horiz-adv-x="226"
+d="M131 316l-100 -140h65h19l-3 -19l-17 -89l100 140h-65h-19l3 19zM160 384v0l-30 -160h96l-160 -224l30 160h-96z" />
+ <glyph glyph-name="ion-ios-bolt" unicode="&#xf3e6;" horiz-adv-x="226"
+d="M160 384v0l-30 -160h96l-160 -224l30 160h-96z" />
+ <glyph glyph-name="ion-ios-book-outline" unicode="&#xf3e7;" horiz-adv-x="384"
+d="M284 384c55 0 100 -26 100 -79v-1v-4v-261v-17h-6h-11h-5c-17 30 -44 42 -78 42c-40 0 -74 -28 -82 -64h-20c-8 36 -42 64 -82 64c-34 0 -65 -16 -78 -42h-5h-11h-6v9v264v9v1c0 53 45 79 100 79c41 0 78 -14 92 -44c12 30 51 44 92 44zM184 37v254v13v2
+c-1 43 -39 62 -84 62c-44 0 -81 -19 -84 -61v-1v0v-262h1c19 26 48 36 83 36s66 -17 84 -43zM368 300v14v1c-3 42 -40 53 -84 53c-46 0 -84 -20 -84 -64v-1v-266c18 26 49 43 84 43s66 -10 84 -36v256z" />
+ <glyph glyph-name="ion-ios-book" unicode="&#xf3e8;" horiz-adv-x="384"
+d="M100 384c35 0 67 -10 84 -31v-353h-2c-8 36 -42 64 -82 64c-34 0 -65 -16 -78 -42h-5h-11h-6v9v264v9v1c0 53 45 79 100 79zM284 384c55 0 100 -26 100 -79v-1v-4v-261v-17h-6h-11h-5c-17 30 -44 42 -78 42c-40 0 -74 -28 -82 -64h-2v353c17 21 50 31 84 31z" />
+ <glyph glyph-name="ion-ios-bookmarks-outline" unicode="&#xf3e9;" horiz-adv-x="418"
+d="M385 384c19 0 33 -13 33 -32v-286c0 -19 -14 -34 -33 -34h-143s-25 -4 -25 -19v-13h-8h-8v13c0 15 -11 19 -25 19h-143c-19 0 -33 15 -33 34v286c0 19 14 32 33 32h150c10 0 20 -5 26 -12v0v0c6 7 16 12 26 12h150zM201 37v309c0 9 -12 22 -25 22h-143
+c-9 0 -16 -7 -16 -16v-286c0 -9 7 -18 16 -18h144c10 0 19 -3 24 -11zM273 368v-100l23 14l9 6l9 -6l23 -14v100h-64zM401 66v286c0 9 -7 16 -16 16h-32v-131l-48 32l-48 -32v131h-15c-13 0 -25 -13 -25 -22v-309c5 9 14 11 24 11h144c9 0 16 9 16 18z" />
+ <glyph glyph-name="ion-ios-bookmarks" unicode="&#xf3ea;" horiz-adv-x="418"
+d="M296 283l-23 -15v116h64v-116l-23 15l-9 6zM385 384c19 0 33 -13 33 -32v-286c0 -19 -14 -34 -33 -34h-143s-25 -4 -25 -19v-13h-8h-8v13c0 15 -11 19 -25 19h-143c-19 0 -33 15 -33 34v286c0 19 14 32 33 32h150s18 -8 18 -15v-329l8 -6l8 6v329s10 15 18 15h22v-146
+l48 32l48 -32v146h32z" />
+ <glyph glyph-name="ion-ios-box-outline" unicode="&#xf3eb;" horiz-adv-x="320"
+d="M192 208h-1h-63c-9 0 -16 -7 -16 -16s7 -16 16 -16h64c9 0 16 7 16 16s-7 16 -16 16zM192 224v0c18 0 32 -14 32 -32s-14 -32 -32 -32h-64c-18 0 -32 14 -32 32s14 32 32 32h64zM320 336v-80h-16v-208h-288v208h-16v80h320zM288 64v192h-256v-192h256zM304 272v48h-288
+v-48h288z" />
+ <glyph glyph-name="ion-ios-box" unicode="&#xf3ec;" horiz-adv-x="320"
+d="M16 48v192h288v-192h-288zM128 208c-9 0 -16 -7 -16 -16s7 -16 16 -16h64c9 0 16 7 16 16s-7 16 -16 16h-64zM0 336h320v-80h-16h-288h-16v80z" />
+ <glyph glyph-name="ion-ios-briefcase-outline" unicode="&#xf3ed;" horiz-adv-x="416"
+d="M368 320h48v-320h-416v320h48v16h32v-16h48v30v2c0 18 10 32 29 32h99c19 0 32 -14 32 -32v-2v-30h48v16h32v-16zM144 320v0h128v0v30c0 10 -7 18 -17 18h-97c-11 0 -14 -8 -14 -18v-30zM400 16v224h-384v-224h384zM400 256v48h-32v-16h-32v16h-256v-16h-32v16h-32v-48
+h384z" />
+ <glyph glyph-name="ion-ios-briefcase" unicode="&#xf3ee;" horiz-adv-x="416"
+d="M48 320v16h32v-16h-32zM0 0v240h416v-240h-416zM336 320v16h32v-16h-32zM368 320h48v-64h-416v64h48v-32h32v32h48v30v2c0 18 10 32 29 32h99c19 0 32 -14 32 -32v-2v-30h48v-32h32v32zM272 320v30c0 10 -7 18 -17 18h-97c-11 0 -14 -8 -14 -18v-30v0h128v0z" />
+ <glyph glyph-name="ion-ios-browsers-outline" unicode="&#xf3ef;" horiz-adv-x="384"
+d="M0 304h304v-304h-304v304zM288 16v272h-272v-272h272zM384 384v-304h-64v16h48v272h-272v-48h-16v64h304z" />
+ <glyph glyph-name="ion-ios-browsers" unicode="&#xf3f0;" horiz-adv-x="384"
+d="M0 304h304v-304h-304v304zM80 384h304v-304h-64v240h-240v64z" />
+ <glyph glyph-name="ion-ios-calculator-outline" unicode="&#xf3f1;" horiz-adv-x="288"
+d="M32 288v64h224v-64h-224zM48 336v-32h192v32h-192zM256 384c18 0 32 -14 32 -32v-320c0 -18 -14 -32 -32 -32h-224c-18 0 -32 14 -32 32v320c0 18 14 32 32 32h224zM272 32v320c0 9 -7 16 -16 16h-224c-9 0 -16 -7 -16 -16v-320c0 -9 7 -16 16 -16h224c9 0 16 7 16 16z
+M48 208h32h16v-16h-64v64h16v-16v-32zM48 128h32h16v-16h-64v64h16v-16v-32zM48 48h32h16v-16h-64v64h16v-16v-32zM128 208h32h16v-16h-64v64h16v-16v-32zM208 208h32h16v-16h-64v64h16v-16v-32zM128 128h32h16v-16h-64v64h16v-16v-32zM128 48h32h16v-16h-64v64h16v-16v-32z
+M208 48h32h16v-16h-64v144h16v-96v-32z" />
+ <glyph glyph-name="ion-ios-calculator" unicode="&#xf3f2;" horiz-adv-x="288"
+d="M256 384c18 0 32 -14 32 -32v-320c0 -18 -14 -32 -32 -32h-224c-18 0 -32 14 -32 32v320c0 18 14 32 32 32h224zM248 168h-48v-128h48v128zM248 248h-48v-48h48v48zM168 88h-48v-48h48v48zM168 168h-48v-48h48v48zM168 248h-48v-48h48v48zM88 88h-48v-48h48v48zM88 168
+h-48v-48h48v48zM88 248h-48v-48h48v48zM40 296h208v48h-208v-48z" />
+ <glyph glyph-name="ion-ios-calendar-outline" unicode="&#xf3f3;" horiz-adv-x="384"
+d="M16 336v-64h352v64zM288 352h96v-352h-384v352h96v32h16v-32h160v32h16v-32zM368 16v240h-352v-240h352zM368 272v64h-80v-32h-16v32h-160v-32h-16v32h-80v-64h352z" />
+ <glyph glyph-name="ion-ios-calendar" unicode="&#xf3f4;" horiz-adv-x="384"
+d="M0 0v256h384v-256h-384zM384 352v-80h-384v80h96v-48h16v48h160v-48h16v48h96zM96 352v32h16v-32h-16zM272 352v32h16v-32h-16z" />
+ <glyph glyph-name="ion-ios-camera-outline" unicode="&#xf3f5;" horiz-adv-x="384"
+d="M354 288c18 0 30 -13 30 -31v-176c0 -18 -12 -33 -30 -33h-320c-18 0 -34 15 -34 33v176c0 18 16 31 34 31h13v16h34v-16h13c32 36 43 48 55 48h88c12 0 23 -12 55 -48h62zM368 81v176c0 9 -5 15 -14 15h-62h-7l-5 3c-3 4 -7 8 -10 11c-12 13 -20 24 -26 30
+c-5 5 -7 4 -7 4h-88s-2 0 -7 -4c-6 -5 -14 -14 -25 -27c-3 -4 -7 -10 -11 -14l-5 -3h-7h-60c-9 0 -18 -7 -18 -15v-176c0 -9 9 -17 18 -17h320c8 0 14 8 14 17zM192 258c47 0 86 -38 86 -85s-39 -85 -86 -85s-86 38 -86 85s39 85 86 85zM192 104c38 0 70 31 70 69
+s-32 69 -70 69s-70 -31 -70 -69s32 -69 70 -69zM288 239v17h17v-17h-17zM160 173c0 21 11 32 32 32s32 -11 32 -32s-11 -32 -32 -32s-32 11 -32 32z" />
+ <glyph glyph-name="ion-ios-camera" unicode="&#xf3f6;" horiz-adv-x="384"
+d="M354 288c18 0 30 -13 30 -31v-176c0 -18 -12 -33 -30 -33h-320c-18 0 -34 15 -34 33v176c0 18 16 31 34 31h13v16h34v-16h13c32 36 43 48 55 48h88c12 0 23 -12 55 -48h62zM192 88c47 0 86 38 86 85s-39 85 -86 85s-86 -38 -86 -85s39 -85 86 -85zM305 239v17h-17v-17h17
+zM192 242c38 0 70 -31 70 -69s-32 -69 -70 -69s-70 31 -70 69s32 69 70 69zM192 141c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32z" />
+ <glyph glyph-name="ion-ios-cart-outline" unicode="&#xf3f7;" horiz-adv-x="384"
+d="M96 48c13 0 24 -11 24 -24s-11 -24 -24 -24s-24 11 -24 24s11 24 24 24zM96 16c4 0 8 4 8 8s-4 8 -8 8s-8 -4 -8 -8s4 -8 8 -8zM320 48c13 0 24 -11 24 -24s-11 -24 -24 -24s-24 11 -24 24s11 24 24 24zM320 16c4 0 8 4 8 8s-4 8 -8 8s-8 -4 -8 -8s4 -8 8 -8zM384 320
+l-16 -128l-271 -48l5 -30c7 -34 21 -34 26 -34h240v-16h-240c-11 0 -21 5 -28 14c-6 8 -11 19 -13 33l-43 234v0c-2 8 -3 12 -7 16c-6 5 -18 7 -37 7v16c23 0 38 -4 47 -11c7 -6 10 -14 12 -21zM355 206l11 99l-304 31l32 -176z" />
+ <glyph glyph-name="ion-ios-cart" unicode="&#xf3f8;" horiz-adv-x="384"
+d="M96 48c13 0 24 -11 24 -24s-11 -24 -24 -24s-24 11 -24 24s11 24 24 24zM320 48c13 0 24 -11 24 -24s-11 -24 -24 -24s-24 11 -24 24s11 24 24 24zM384 320l-16 -128l-271 -48l5 -30c7 -34 21 -34 26 -34h240v-16h-240c-11 0 -21 5 -28 14c-6 8 -11 19 -13 33l-43 234v0
+c-2 8 -3 12 -7 16c-6 5 -18 7 -37 7v16c23 0 38 -4 47 -11c7 -6 10 -14 12 -21z" />
+ <glyph glyph-name="ion-ios-chatboxes-outline" unicode="&#xf3f9;" horiz-adv-x="416"
+d="M16 384v-192h96v-16h-112v224h288v-112h-16v96h-256zM128 272h288v-224h-48v-64h-13l-64 64h-163v224zM400 64v192h-256v-192h153l55 -55v55h48z" />
+ <glyph glyph-name="ion-ios-chatboxes" unicode="&#xf3fa;" horiz-adv-x="416"
+d="M288 400v-112h-176v-112h-112v224h288zM128 272h288v-224h-48v-64h-13l-64 64h-163v224z" />
+ <glyph glyph-name="ion-ios-chatbubble-outline" unicode="&#xf3fb;" horiz-adv-x="384"
+d="M192 336c-97 0 -176 -62 -176 -138c0 -26 10 -51 27 -73c0 -1 0 -2 1 -3s2 -1 2 -2c4 -6 6 -13 6 -20c0 -3 1 -3 -13 -47l39 17v0c2 1 10 4 11 4h1v0c5 2 10 3 16 3c5 0 9 -1 14 -2l1 -1h2c19 -6 41 -10 70 -10c48 0 92 15 125 40c32 25 50 58 50 94
+c0 76 -79 138 -176 138zM192 352v0c106 0 192 -69 192 -154s-85 -150 -191 -150c-27 0 -52 3 -75 11h-2v0c-3 1 -6 2 -10 2s-9 -1 -12 -2h1h-1c-1 0 -9 -4 -10 -4l-50 -22l-2 -1h-3h-3c-6 1 -8 6 -7 10v0s17 57 17 58c0 4 -1 8 -3 11v0v0v0l1 -1l-4 4c-19 24 -30 53 -30 84
+c0 85 86 154 192 154z" />
+ <glyph glyph-name="ion-ios-chatbubble" unicode="&#xf3fc;" horiz-adv-x="384"
+d="M192 352v0c106 0 192 -69 192 -154s-85 -150 -191 -150c-27 0 -52 3 -75 11h-2v0c-3 1 -6 2 -10 2s-9 -1 -12 -2h1h-1c-1 0 -9 -4 -10 -4l-50 -22l-2 -1h-3h-3c-6 1 -8 6 -7 10v0s17 57 17 58c0 4 -1 8 -3 11v0v0v0l1 -1l-4 4c-19 24 -30 53 -30 84c0 85 86 154 192 154z
+" />
+ <glyph glyph-name="ion-ios-checkmark-empty" unicode="&#xf3fd;" horiz-adv-x="207"
+d="M74 118c-2 -2 -6 -4 -9 -4s-7 2 -9 4l-56 56l18 18l47 -47l125 126l17 -18z" />
+ <glyph glyph-name="ion-ios-checkmark-outline" unicode="&#xf3fe;" horiz-adv-x="416"
+d="M292 271l18 -18l-134 -135c-2 -2 -6 -4 -9 -4s-7 2 -9 4l-56 56l18 18l47 -47zM208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM208 1c105 0 191 86 191 191s-86 191 -191 191s-191 -86 -191 -191s86 -191 191 -191z" />
+ <glyph glyph-name="ion-ios-checkmark" unicode="&#xf3ff;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM176 118l134 135l-18 18l-125 -126l-47 47l-18 -18l56 -56c2 -2 6 -4 9 -4s7 2 9 4z" />
+ <glyph glyph-name="ion-ios-circle-filled" unicode="&#xf400;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM208 1c105 0 191 86 191 191s-86 191 -191 191s-191 -86 -191 -191s86 -191 191 -191zM208 352c88 0 160 -72 160 -160s-72 -160 -160 -160s-160 72 -160 160s72 160 160 160z" />
+ <glyph glyph-name="ion-ios-circle-outline" unicode="&#xf401;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM208 1c105 0 191 86 191 191s-86 191 -191 191s-191 -86 -191 -191s86 -191 191 -191z" />
+ <glyph glyph-name="ion-ios-clock-outline" unicode="&#xf402;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM208 1c105 0 191 86 191 191s-86 191 -191 191s-191 -86 -191 -191s86 -191 191 -191zM208 192v128h17v-145h-113v17h96z" />
+ <glyph glyph-name="ion-ios-clock" unicode="&#xf403;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM225 175v145h-17v-128h-96v-17h113z" />
+ <glyph glyph-name="ion-ios-close-empty" unicode="&#xf404;" horiz-adv-x="192"
+d="M180 288l12 -12l-84 -84l84 -84l-12 -12l-84 84l-84 -84l-12 12l84 84l-84 84l12 12l84 -84z" />
+ <glyph glyph-name="ion-ios-close-outline" unicode="&#xf405;" horiz-adv-x="416"
+d="M355 339c81 -81 81 -213 0 -294s-213 -81 -294 0s-81 213 0 294s213 81 294 0zM343 57c74 74 74 196 0 270s-196 74 -270 0s-74 -196 0 -270s196 -74 270 0zM292 288l12 -12l-84 -84l84 -84l-12 -12l-84 84l-84 -84l-12 12l84 84l-84 84l12 12l84 -84z" />
+ <glyph glyph-name="ion-ios-close" unicode="&#xf406;" horiz-adv-x="416"
+d="M355 339c81 -81 81 -213 0 -294s-213 -81 -294 0s-81 213 0 294s213 81 294 0zM304 108l-84 84l84 84l-12 12l-84 -84l-84 84l-12 -12l84 -84l-84 -84l12 -12l84 84l84 -84z" />
+ <glyph glyph-name="ion-ios-cloud-download-outline" unicode="&#xf407;"
+d="M161 67l55 -54v242h16v-242l55 54l12 -12l-75 -73l-74 73zM367 284c45 0 81 -37 81 -82s-37 -82 -82 -82v0h-101v16h97h4c37 0 66 30 66 66s-29 67 -66 67h-15v20c0 55 -46 97 -101 97c-38 0 -73 -22 -90 -56l-6 -14l-14 7c-6 3 -13 5 -20 5c-22 0 -40 -18 -44 -39l-1 -9
+l-9 -3c-30 -10 -50 -36 -50 -67c0 -40 33 -74 74 -74h91v-16h-91c-50 0 -90 40 -90 89c0 39 26 71 61 83c5 28 29 51 59 51c10 0 18 -2 26 -6c19 39 59 65 105 65c64 0 117 -51 117 -115c0 -1 -1 -2 -1 -3z" />
+ <glyph glyph-name="ion-ios-cloud-download" unicode="&#xf408;"
+d="M216 13v107h16v-107l55 54l12 -12l-75 -73l-74 73l11 12zM367 284c45 0 81 -37 81 -82s-37 -82 -82 -82h-134v135h-16v-135h-35h-21h-70c-50 0 -90 40 -90 89c0 39 26 71 61 83c5 28 29 51 59 51c10 0 18 -2 26 -6c19 39 59 65 105 65c64 0 117 -51 117 -115
+c0 -1 -1 -2 -1 -3z" />
+ <glyph glyph-name="ion-ios-cloud-outline" unicode="&#xf409;"
+d="M367 215c45 0 81 -37 81 -83c0 -45 -37 -84 -82 -84h-276c-50 0 -90 42 -90 92c0 40 26 71 61 83c5 28 29 52 59 52c10 0 18 -2 26 -6c19 39 59 67 105 67c64 0 117 -53 117 -117c0 -1 -1 -3 -1 -4zM366 64c37 0 66 32 66 69s-29 67 -66 67h-15v21c0 56 -46 99 -101 99
+c-38 0 -73 -23 -90 -58l-6 -14l-14 7c-6 3 -13 5 -20 5c-22 0 -40 -17 -44 -39l-1 -9l-9 -3c-30 -10 -50 -37 -50 -69c0 -41 33 -76 74 -76h272h4z" />
+ <glyph glyph-name="ion-ios-cloud-upload-outline" unicode="&#xf40a;"
+d="M161 188l-11 11l74 75l75 -75l-12 -11l-55 54v-242h-16v242zM367 264c45 0 81 -39 81 -85s-37 -83 -82 -83v0h-101v16h97h4c37 0 66 30 66 67s-29 70 -66 70l-15 1v20c0 56 -46 99 -101 99c-38 0 -73 -23 -90 -58l-6 -13l-14 6c-6 3 -13 5 -20 5c-22 0 -40 -17 -44 -39
+l-1 -9l-9 -3c-30 -10 -50 -39 -50 -71c0 -41 33 -75 74 -75h91v-16h-91c-50 0 -90 40 -90 90c0 40 26 74 61 86c5 28 29 52 59 52c10 0 18 -2 26 -6c19 39 59 66 105 66c64 0 117 -52 117 -116c0 -1 -1 -3 -1 -4z" />
+ <glyph glyph-name="ion-ios-cloud-upload" unicode="&#xf40b;"
+d="M216 0v96h16v-96h-16zM367 264c45 0 81 -39 81 -85s-37 -83 -82 -83h-134v146l55 -54l12 11l-75 75l-74 -75l11 -11l55 54v-146h-35h-31h-60c-50 0 -90 40 -90 90c0 40 26 74 61 86c5 28 29 52 59 52c10 0 18 -2 26 -6c19 39 59 66 105 66c64 0 117 -52 117 -116
+c0 -1 -1 -3 -1 -4z" />
+ <glyph glyph-name="ion-ios-cloud" unicode="&#xf40c;"
+d="M367 215c45 0 81 -37 81 -83c0 -45 -37 -84 -82 -84h-276c-50 0 -90 42 -90 92c0 40 26 71 61 83c5 28 29 52 59 52c10 0 18 -2 26 -6c19 39 59 67 105 67c64 0 117 -53 117 -117c0 -1 -1 -3 -1 -4z" />
+ <glyph glyph-name="ion-ios-cloudy-night-outline" unicode="&#xf40d;" horiz-adv-x="384"
+d="M125 224c-34 0 -63 -28 -63 -62v-12s1 -10 1 -10c-5 0 -12 -1 -14 -1c-19 -3 -33 -18 -33 -37c0 -10 3 -19 10 -26s16 -11 26 -11h157c27 0 49 22 49 49s-22 50 -49 50c-2 0 -4 -1 -6 -1l-14 -2l-3 14c-3 14 -11 26 -22 35s-25 14 -39 14zM125 240v0c37 0 68 -26 76 -61
+h8c36 0 65 -29 65 -65s-29 -66 -65 -66h-157c-28 0 -52 24 -52 53c0 27 21 51 47 53v8c0 43 35 78 78 78zM361 142c8 0 15 2 23 4c-4 -7 -9 -14 -14 -20c-21 -24 -50 -41 -84 -45c4 6 6 12 8 19c19 4 36 13 50 25c-18 1 -35 6 -50 13c-23 11 -42 29 -56 51
+c-14 21 -22 48 -22 75c0 15 2 30 7 44c-24 -12 -43 -33 -53 -59c-5 2 -12 4 -18 5c14 36 45 65 82 77c8 2 16 4 24 5c-5 -6 -9 -13 -12 -20c-8 -16 -12 -34 -12 -52c0 -32 12 -63 35 -86s54 -36 86 -36h6z" />
+ <glyph glyph-name="ion-ios-cloudy-night" unicode="&#xf40e;" horiz-adv-x="384"
+d="M361 142c8 0 15 2 23 4c-4 -7 -9 -15 -14 -21c-21 -24 -50 -40 -84 -44h-3c4 10 7 21 7 32c0 22 -9 43 -24 58c-14 15 -33 23 -53 24c-6 16 -16 29 -29 40c-10 8 -20 13 -32 17v2c14 36 45 65 82 77c8 2 16 4 24 5c-5 -6 -9 -13 -12 -20c-8 -16 -12 -34 -12 -52
+c0 -32 12 -63 35 -86s54 -36 86 -36h6zM125 239v0c37 0 68 -26 76 -61h8c36 0 65 -29 65 -65s-29 -66 -65 -66h-157c-28 0 -52 24 -52 53c0 27 21 51 47 53v7c0 43 35 79 78 79z" />
+ <glyph glyph-name="ion-ios-cloudy-outline" unicode="&#xf40f;" horiz-adv-x="274"
+d="M125 272c-34 0 -63 -28 -63 -62v-12s1 -10 1 -10c-6 0 -12 -1 -14 -1c-19 -3 -33 -18 -33 -37c0 -10 3 -19 10 -26s16 -11 26 -11h157c27 0 49 22 49 49s-22 50 -49 50c-2 0 -4 -1 -6 -1l-14 -2l-3 14c-3 14 -11 26 -22 35s-25 14 -39 14zM125 288v0c37 0 68 -26 76 -61
+h8c36 0 65 -29 65 -65s-29 -66 -65 -66h-157c-28 0 -52 24 -52 53c0 27 21 51 47 53v8c0 43 35 78 78 78z" />
+ <glyph glyph-name="ion-ios-cloudy" unicode="&#xf410;" horiz-adv-x="274"
+d="M125 288v0c37 0 68 -26 76 -61h8c36 0 65 -29 65 -65s-29 -66 -65 -66h-157c-28 0 -52 24 -52 53c0 27 21 51 47 53v8c0 43 35 78 78 78z" />
+ <glyph glyph-name="ion-ios-cog-outline" unicode="&#xf411;" horiz-adv-x="384"
+d="M384 175l-33 -8l-3 -14l27 -20l-12 -30l-34 5l-8 -11l17 -29l-23 -23l-29 17l-10 -7l5 -34l-29 -12l-21 27l-14 -3l-8 -33h-32l-9 33l-13 3l-21 -28l-29 12l4 34l-11 8l-30 -19l-23 23l18 31l-7 11l-35 -5l-12 29l28 22l-2 12l-35 9v32l35 9l2 12l-29 22l12 30l36 -5
+l7 10l-19 32l22 22l32 -19l11 8l-4 35l29 13l22 -29l12 2l9 35h32l9 -35l12 -2l22 28l29 -12l-5 -35l11 -8l30 18l22 -23l-17 -30l7 -10l35 5l12 -30l-28 -21l3 -13l33 -9v-32zM356 127l-26 20l6 33l32 8v7l-32 8l-6 33l26 19l-3 7l-32 -5l-19 27l17 28l-5 6l-28 -17l-28 18
+l5 34l-6 2l-20 -26l-32 6l-8 33h-7l-9 -33l-32 -6l-20 27l-7 -3l5 -34l-28 -18l-9 6l-21 12l-5 -5l18 -30l-18 -27l-33 5l-3 -7l27 -20l-6 -32l-33 -8v-7l33 -9l6 -32l-27 -20l3 -6l33 4l18 -27l-17 -29l5 -6l29 18l28 -18l-5 -33l7 -3l19 27l33 -7l8 -31h8l7 31l33 7
+l20 -26l7 3l-5 32l26 18l28 -16l5 5l-16 27l19 28l32 -4zM192 320c71 0 128 -57 128 -128s-57 -128 -128 -128s-128 57 -128 128s57 128 128 128zM80 192c0 -7 1 -15 2 -22l104 28l28 104c-7 1 -15 2 -22 2c-30 0 -58 -12 -79 -33s-33 -49 -33 -79zM192 80c27 0 53 10 73 27
+l-75 75l-104 -28c6 -15 15 -29 27 -41c21 -21 49 -33 79 -33zM276 118c18 20 28 47 28 74c0 30 -12 58 -33 79c-12 12 -26 22 -42 27l-28 -105z" />
+ <glyph glyph-name="ion-ios-cog" unicode="&#xf412;" horiz-adv-x="384"
+d="M229 298c16 -5 30 -15 42 -27c21 -21 33 -49 33 -79c0 -27 -10 -54 -28 -74l-75 75zM214 302l-28 -104l-104 -28c-1 7 -2 15 -2 22c0 30 12 58 33 79s49 33 79 33c7 0 15 -1 22 -2zM86 154l104 28l75 -75c-20 -17 -46 -27 -73 -27c-30 0 -58 12 -79 33
+c-12 12 -21 26 -27 41zM384 175l-33 -8l-3 -14l27 -20l-12 -30l-34 5l-8 -11l17 -29l-23 -23l-29 17l-10 -7l5 -34l-29 -12l-21 27l-14 -3l-8 -33h-32l-9 33l-13 3l-21 -28l-29 12l4 34l-11 8l-30 -19l-23 23l18 31l-7 11l-35 -5l-12 29l28 22l-2 12l-35 9v32l35 9l2 12
+l-29 22l12 30l36 -5l7 10l-19 32l22 22l32 -19l11 8l-4 35l29 13l22 -29l12 2l9 35h32l9 -35l12 -2l22 28l29 -12l-5 -35l11 -8l30 18l22 -23l-17 -30l7 -10l35 5l12 -30l-28 -21l3 -13l33 -9v-32zM192 64c71 0 128 57 128 128s-57 128 -128 128s-128 -57 -128 -128
+s57 -128 128 -128z" />
+ <glyph glyph-name="ion-ios-color-filter-outline" unicode="&#xf413;" horiz-adv-x="384"
+d="M302 236c47 -13 82 -57 82 -108c0 -62 -50 -112 -112 -112c-31 0 -60 13 -80 34c-20 -21 -49 -34 -80 -34c-62 0 -112 50 -112 112c0 51 35 95 82 108c-1 7 -2 13 -2 20c0 62 50 112 112 112s112 -50 112 -112c0 -7 -1 -13 -2 -20zM96 256c0 -6 0 -12 1 -17
+c5 1 10 1 15 1c31 0 60 -13 80 -34c20 21 49 34 80 34c5 0 10 0 15 -1c1 5 1 11 1 17c0 53 -43 96 -96 96s-96 -43 -96 -96zM208 128c0 6 0 12 -1 17c-5 -1 -10 -1 -15 -1s-10 0 -15 1c-1 -5 -1 -11 -1 -17c0 -20 6 -38 16 -53c10 15 16 33 16 53zM192 160c3 0 7 1 10 1
+c-3 7 -6 14 -10 20c-4 -6 -7 -13 -10 -20c3 0 7 -1 10 -1zM166 164c4 11 9 21 16 30c-18 18 -43 30 -70 30c-3 0 -7 -1 -10 -1c10 -29 34 -51 64 -59zM202 194c7 -9 12 -19 16 -30c30 8 54 30 64 59c-3 0 -7 1 -10 1c-27 0 -52 -12 -70 -30zM112 32c27 0 52 12 70 30
+c-14 19 -22 41 -22 66c0 7 1 13 2 20c-36 10 -64 37 -76 72c-40 -11 -70 -48 -70 -92c0 -53 43 -96 96 -96zM272 32c53 0 96 43 96 96c0 44 -30 81 -70 92c-12 -35 -40 -62 -76 -72c1 -7 2 -13 2 -20c0 -25 -8 -47 -22 -66c18 -18 43 -30 70 -30z" />
+ <glyph glyph-name="ion-ios-color-filter" unicode="&#xf414;" horiz-adv-x="384"
+d="M302 236c47 -13 82 -57 82 -108c0 -62 -50 -112 -112 -112c-31 0 -60 13 -80 34c-20 -21 -49 -34 -80 -34c-62 0 -112 50 -112 112c0 51 35 95 82 108c-1 7 -2 13 -2 20c0 62 50 112 112 112s112 -50 112 -112c0 -7 -1 -13 -2 -20zM192 53l1 -2c3 3 6 7 9 11
+c14 19 22 41 22 66c0 7 -1 13 -2 20c36 10 64 37 76 72c2 5 3 10 4 15c-1 0 -2 1 -3 1v1c-4 1 -8 1 -12 2c-5 1 -10 1 -15 1c-31 0 -60 -13 -80 -34c-20 21 -49 34 -80 34c-5 0 -10 0 -15 -1c-4 -1 -8 -1 -12 -2v-1c-1 0 -2 -1 -3 -1c1 -5 2 -10 4 -15c12 -35 40 -62 76 -72
+c-1 -7 -2 -13 -2 -20c0 -25 8 -47 22 -66c3 -4 6 -8 9 -11zM207 145c1 -5 1 -11 1 -17c0 -20 -6 -38 -16 -53c-10 15 -16 33 -16 53c0 6 0 12 1 17c5 -1 10 -1 15 -1s10 0 15 1zM282 223c-10 -29 -34 -51 -64 -59c-4 11 -9 21 -16 30c18 18 43 30 70 30c3 0 7 -1 10 -1z
+M202 161c-3 0 -7 -1 -10 -1s-7 1 -10 1c3 7 6 14 10 20c4 -6 7 -13 10 -20zM112 224c27 0 52 -12 70 -30c-7 -9 -12 -19 -16 -30c-30 8 -54 30 -64 59c3 0 7 1 10 1z" />
+ <glyph glyph-name="ion-ios-color-wand-outline" unicode="&#xf415;" horiz-adv-x="384"
+d="M128 298l256 -256l-34 -34l-256 256zM149 232l201 -201l11 11l-201 202zM120 344v40h16v-40h-16zM120 140v40h16v-40h-16zM216 256v16h40v-16h-40zM0 256v16h40v-16h-40zM47 354l29 -29l-12 -11l-28 28zM76 198l-29 -28l-11 11l28 28zM220 342l-28 -28l-12 11l29 29z" />
+ <glyph glyph-name="ion-ios-color-wand" unicode="&#xf416;" horiz-adv-x="396"
+d="M140 289l256 -257l-34 -34l-256 257zM124 322v64h32v-64h-32zM124 118v64h32v-64h-32zM216 238v32h64v-32h-64zM246 336l-45 -45l-23 22l45 46zM34 336l23 23l45 -46l-23 -22zM34 169l45 45l23 -22l-45 -46zM0 238v32h64v-32h-64z" />
+ <glyph glyph-name="ion-ios-compose-outline" unicode="&#xf417;" horiz-adv-x="384"
+d="M304 32v208l16 16v-240h-320v304h256l-16 -16h-224v-272h288zM174 164l171 171l11 -11l-180 -180h-32v32l180 180l11 -11l-171 -171zM380 368c2 -3 4 -6 4 -10s-2 -7 -4 -10l-12 -12l-21 21l-11 11v0l12 12c3 2 6 4 10 4s7 -2 10 -4z" />
+ <glyph glyph-name="ion-ios-compose" unicode="&#xf418;" horiz-adv-x="384"
+d="M192 128l128 128v-240h-320v304h256l-128 -128v-64h64zM324 356l32 -32l-180 -180h-32v32zM380 368c2 -3 4 -6 4 -10s-2 -7 -4 -10l-12 -12l-21 21l-11 11v0l12 12c3 2 6 4 10 4s7 -2 10 -4z" />
+ <glyph glyph-name="ion-ios-contact-outline" unicode="&#xf419;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM208 383c-105 0 -191 -86 -191 -191c0 -47 17 -89 45 -122c18 8 62 24 90 32c2 1 3 0 3 10c0 11 -1 18 -4 24c-4 8 -7 20 -9 31c-4 5 -10 15 -14 33c-3 16 -1 22 1 28v2
+c1 4 0 23 -3 38c-2 10 1 34 15 52c9 12 27 26 58 28h18c32 -2 49 -16 58 -28c14 -18 17 -42 15 -52c-3 -15 -4 -34 -3 -38c0 0 1 -1 1 -2c2 -6 3 -12 0 -28c-4 -18 -10 -27 -14 -32c-2 -11 -5 -24 -9 -32c-3 -7 -6 -15 -6 -23c0 -10 0 -10 2 -11c27 -8 73 -24 93 -32
+c28 33 45 76 45 122c0 105 -86 191 -191 191z" />
+ <glyph glyph-name="ion-ios-contact" unicode="&#xf41a;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM208 1c59 0 111 27 146 69c-20 8 -66 24 -93 32c-2 1 -3 1 -3 11c0 8 4 16 7 23c4 8 7 21 9 32c4 5 10 14 14 32c3 16 2 22 0 28c0 0 -1 1 -1 2c-1 4 0 23 3 38c2 10 -1 34 -15 52
+c-9 12 -26 26 -58 28h-18c-31 -2 -49 -16 -58 -28c-14 -18 -17 -42 -15 -52c3 -15 4 -34 3 -38v-2c-2 -6 -4 -12 -1 -28c4 -18 10 -28 14 -33c2 -11 5 -23 9 -31c3 -6 4 -13 4 -24c0 -10 -1 -9 -3 -10c-28 -8 -72 -24 -90 -32c35 -42 87 -69 146 -69z" />
+ <glyph glyph-name="ion-ios-copy-outline" unicode="&#xf41b;" horiz-adv-x="288"
+d="M192 352v-64h64v-16h-80v80h16zM213 384l75 -75v-261h-48v-48h-240v336h48v48h165zM224 16v32h-176v272h-32v-304h208zM272 64v238l-65 66h-143v-304h208z" />
+ <glyph glyph-name="ion-ios-copy" unicode="&#xf41c;" horiz-adv-x="288"
+d="M32 32h16h192v-32h-240v336h32v-288v-16zM213 384l75 -75v-261h-48h-192v288v48h165zM256 272v16h-64v64h-16v-80h80z" />
+ <glyph glyph-name="ion-ios-crop-strong" unicode="&#xf41d;" horiz-adv-x="384"
+d="M64 336v48h32v-48h-32zM96 96h176v-32h-208v208h32v-176zM336 64v32h48v-32h-48zM0 320h320v-320h-32v288h-288v32z" />
+ <glyph glyph-name="ion-ios-crop" unicode="&#xf41e;" horiz-adv-x="384"
+d="M64 336v48h16v-48h-16zM80 80h208v-16h-224v224h16v-208zM336 64v16h48v-16h-48zM0 320h320v-320h-16v304h-304v16z" />
+ <glyph glyph-name="ion-ios-download-outline" unicode="&#xf41f;" horiz-adv-x="320"
+d="M192 304h128v-304h-320v304h128v-16h-112v-272h288v272h-112v16zM97 196l55 -55v243h16v-243l55 55l11 -12l-74 -74l-74 74z" />
+ <glyph glyph-name="ion-ios-download" unicode="&#xf420;" horiz-adv-x="320"
+d="M168 304h152v-304h-320v304h152v-163l-55 55l-11 -12l74 -74l74 74l-11 12l-55 -55v163zM152 304v80h16v-80h-16z" />
+ <glyph glyph-name="ion-ios-drag" unicode="&#xf421;" horiz-adv-x="352"
+d="M0 128v16h352v-16h-352zM0 184v16h352v-16h-352zM0 240v16h352v-16h-352z" />
+ <glyph glyph-name="ion-ios-email-outline" unicode="&#xf422;" horiz-adv-x="384"
+d="M0 320h384v-256h-384v256zM192 180l163 124h-326zM16 80h352v214l-115 -88l68 -77l-2 -2l-79 70l-48 -37l-48 37l-79 -70l-2 2l68 77l-115 88v-214z" />
+ <glyph glyph-name="ion-ios-email" unicode="&#xf423;" horiz-adv-x="384"
+d="M384 64h-384v242l131 -100l-68 -77l2 -2l79 70l48 -37l48 37l79 -70l2 2l-68 77l131 100v-242zM376 320l-184 -140l-184 140h368z" />
+ <glyph glyph-name="ion-ios-eye-outline" unicode="&#xf424;" horiz-adv-x="384"
+d="M383 192l1 -1l-6 -6c-21 -21 -47 -48 -78 -69c-36 -24 -72 -36 -108 -36c-83 0 -130 49 -185 105l-7 7l1 1c39 40 67 64 94 81c32 20 63 30 97 30c83 0 146 -60 191 -112zM192 288c-62 0 -111 -36 -170 -96c24 -24 48 -50 76 -68c30 -20 60 -28 94 -28
+c75 0 133 56 171 95c-26 29 -50 50 -74 66c-32 21 -64 31 -97 31zM192 112c-44 0 -80 36 -80 80s36 80 80 80s80 -36 80 -80s-36 -80 -80 -80zM192 256c-35 0 -64 -29 -64 -64s29 -64 64 -64s64 29 64 64s-29 64 -64 64zM224 192h16v0c0 -26 -22 -48 -48 -48s-48 21 -48 48
+s22 48 48 48v-16c-16 0 -32 -13 -32 -31s15 -33 32 -33s32 14 32 32v0z" />
+ <glyph glyph-name="ion-ios-eye" unicode="&#xf425;" horiz-adv-x="384"
+d="M383 192l1 -1l-6 -6c-21 -21 -47 -48 -78 -69c-36 -24 -72 -36 -108 -36c-83 0 -130 49 -185 105l-7 7l1 1c39 40 67 64 94 81c32 20 63 30 97 30c83 0 146 -60 191 -112zM192 112c44 0 80 36 80 80s-36 80 -80 80s-80 -36 -80 -80s36 -80 80 -80zM186 221
+c0 -19 16 -35 35 -35c7 0 14 2 19 6v0c0 -27 -22 -48 -48 -48s-48 21 -48 48s22 48 48 48c-4 -5 -6 -12 -6 -19z" />
+ <glyph glyph-name="ion-ios-fastforward-outline" unicode="&#xf426;"
+d="M16 293v-202l184 101zM240 292v0v-78v-27v-95l176 100zM224 320v0l224 -128l-224 -128v123l-224 -123v256l224 -123v123z" />
+ <glyph glyph-name="ion-ios-fastforward" unicode="&#xf427;"
+d="M224 320v0l224 -128l-224 -128v123l-224 -123v256l224 -123v123z" />
+ <glyph glyph-name="ion-ios-filing-outline" unicode="&#xf428;" horiz-adv-x="352"
+d="M288 320l64 -96v-160h-176h-176v160l64 96h224zM333 224l-45 68v-68h45zM80 304v-80h48c0 -26 22 -48 48 -48s48 22 48 48h48v80h-192zM64 292l-45 -68h45v68zM336 80v128h-98c-7 -28 -32 -48 -62 -48s-55 20 -62 48h-98v-128h160h160z" />
+ <glyph glyph-name="ion-ios-filing" unicode="&#xf429;" horiz-adv-x="352"
+d="M176 160c30 0 55 20 62 48h114v-144h-176h-176v144h114c7 -28 32 -48 62 -48zM64 224h-7h-57l64 96v0v-80h16v80h192v-80h16v80v0l64 -96h-56h-8h-16h-8h-40c0 -26 -22 -48 -48 -48s-48 22 -48 48h-39h-9h-16z" />
+ <glyph glyph-name="ion-ios-film-outline" unicode="&#xf42a;" horiz-adv-x="400"
+d="M0 360h400v-336h-400v336zM72 40v48h-56v-48h56zM72 104v48h-56v-48h56zM72 168v48h-56v-48h56zM72 232v48h-56v-48h56zM72 296v48h-56v-48h56zM312 40v144h-224v-144h224zM312 200v144h-224v-144h224zM384 40v48h-56v-48h56zM384 104v48h-56v-48h56zM384 168v48h-56v-48
+h56zM384 232v48h-56v-48h56zM384 296v48h-56v-48h56z" />
+ <glyph glyph-name="ion-ios-film" unicode="&#xf42b;" horiz-adv-x="400"
+d="M0 360h400v-336h-400v336zM72 40v48h-56v-48h56zM72 104v48h-56v-48h56zM72 168v48h-56v-48h56zM72 232v48h-56v-48h56zM72 296v48h-56v-48h56zM312 184v16h-224v-16h224zM384 40v48h-56v-48h56zM384 104v48h-56v-48h56zM384 168v48h-56v-48h56zM384 232v48h-56v-48h56z
+M384 296v48h-56v-48h56z" />
+ <glyph glyph-name="ion-ios-flag-outline" unicode="&#xf42c;" horiz-adv-x="256"
+d="M240 336c6 1 11 1 16 2v-16v-157c-5 -1 -10 -1 -16 -2c-11 -1 -24 -3 -39 -3c-25 0 -47 4 -69 9s-42 13 -64 13c-30 0 -46 -5 -52 -7v-143h-16v142v162v2l3 3c2 1 18 11 65 11c24 0 45 -4 67 -9c21 -4 42 -11 65 -11c15 0 29 3 40 4zM240 179v0v141c-11 -1 -25 -4 -40 -4
+c-25 0 -46 6 -68 11s-42 9 -64 9c-30 0 -46 -5 -52 -7v-137c10 3 26 6 52 6c24 0 45 -8 67 -13c21 -4 43 -9 66 -9c15 0 28 2 39 3z" />
+ <glyph glyph-name="ion-ios-flag" unicode="&#xf42d;" horiz-adv-x="256"
+d="M240 336c6 1 11 1 16 2v-16v-157c-5 -1 -10 -1 -16 -2c-11 -1 -24 -3 -39 -3c-25 0 -47 4 -69 9s-42 13 -64 13c-30 0 -46 -5 -52 -7v-143h-16v142v162v2l3 3c2 1 18 11 65 11c24 0 45 -4 67 -9c21 -4 42 -11 65 -11c15 0 29 3 40 4z" />
+ <glyph glyph-name="ion-ios-flame-outline" unicode="&#xf42e;" horiz-adv-x="256"
+d="M96 416c87 -64 170 -179 159 -288c-13 -134 -104 -160 -127 -160s-127 40 -128 160c-1 146 122 143 96 288zM128 -24c0 0 40 36 40 80s-40 80 -40 80s-41 -36 -41 -80s41 -80 41 -80zM239 130c5 47 -10 99 -41 151c-22 36 -50 70 -83 99c0 -57 -24 -91 -49 -123
+c-26 -34 -50 -65 -50 -129c0 -25 5 -48 15 -68c8 -17 20 -32 35 -45c8 -7 16 -12 23 -16c-9 16 -18 35 -18 57c0 51 44 90 46 92l11 9l11 -9c2 -2 45 -41 45 -92c0 -23 -9 -44 -19 -60c7 4 13 8 20 14c14 12 25 27 34 44c11 21 17 47 20 76z" />
+ <glyph glyph-name="ion-ios-flame" unicode="&#xf42f;" horiz-adv-x="256"
+d="M96 416c87 -64 170 -179 159 -288c-13 -134 -104 -160 -127 -160s-127 40 -128 160c-1 146 122 143 96 288zM128 -24c0 0 40 36 40 80s-40 80 -40 80s-41 -36 -41 -80s41 -80 41 -80z" />
+ <glyph glyph-name="ion-ios-flask-outline" unicode="&#xf430;" horiz-adv-x="384"
+d="M373 78c8 -16 11 -32 11 -46c-1 -36 -27 -64 -63 -64h-256c-36 0 -64 27 -65 64c0 14 4 30 12 46l116 195v127h-16v16h16h16v-16v-16h48v-16h-48v-32h32v-16h-32v-32h48v-16h-48v-3l-2 -4l-15 -25h49v-16h-58l-92 -154c-13 -25 -14 -43 -2 -63c9 -14 23 -23 41 -23h256
+c17 0 33 8 41 22c5 8 6 17 6 26c0 12 -2 25 -9 38l-116 195l-3 4v131v16h16h16v-16h-16v-127zM44 73l72 119h153l72 -119c7 -11 10 -24 10 -33c-1 -24 -16 -40 -46 -40h-226c-30 0 -46 12 -46 40c0 9 4 22 11 33zM260 176h-135l-67 -111v0v0c-5 -8 -9 -19 -9 -25
+c0 -13 5 -17 6 -18c4 -4 13 -6 24 -6h226c10 0 18 3 23 7c4 4 7 10 7 18c0 6 -3 16 -8 24v0v0z" />
+ <glyph glyph-name="ion-ios-flask" unicode="&#xf431;" horiz-adv-x="384"
+d="M327 65v0c5 -8 8 -18 8 -24c0 -8 -3 -14 -7 -18c-5 -4 -13 -7 -23 -7h-226c-11 0 -20 2 -24 6c-1 1 -6 5 -6 18c0 6 4 17 9 25v0v0l67 111h135l67 -111v0zM373 78c8 -16 11 -32 11 -46c-1 -36 -27 -64 -63 -64h-256c-36 0 -64 27 -65 64c0 14 4 30 12 46l116 195v127h-16
+v16h160v-16h-16v-127zM144 384v-16h48v16h-48zM144 336v-16h32v16h-32zM144 288v-16h48v16h-48zM127 240l-9 -16h58v16h-49zM351 40c0 9 -3 22 -10 33l-72 119h-154l-71 -119c-7 -11 -11 -24 -11 -33c0 -28 16 -40 46 -40h226c30 0 45 16 46 40z" />
+ <glyph glyph-name="ion-ios-flower-outline" unicode="&#xf432;"
+d="M363 164c-29 0 -65 7 -93 14c-1 -3 -2 -6 -4 -9c25 -15 56 -36 76 -56c40 -40 53 -68 41 -80c-3 -3 -7 -4 -12 -4c-15 0 -38 15 -68 45c-20 20 -41 51 -56 76c-3 -2 -7 -3 -10 -4c7 -28 15 -64 15 -93c0 -56 -12 -85 -28 -85s-28 29 -28 85c0 29 8 65 15 93
+c-3 1 -7 2 -10 4c-15 -25 -36 -56 -56 -76c-30 -30 -53 -45 -68 -45c-5 0 -9 1 -12 4c-12 12 1 40 41 80c20 20 51 41 76 56c-2 3 -3 6 -4 9c-28 -7 -64 -14 -93 -14c-56 0 -85 12 -85 28s29 28 85 28c29 0 65 -8 93 -15c1 3 2 7 4 10c-25 15 -56 35 -76 55
+c-40 40 -53 68 -41 80c3 3 7 4 12 4c15 0 38 -14 68 -44c20 -20 41 -51 56 -76c3 2 7 3 10 4c-7 28 -15 64 -15 93c0 56 12 85 28 85s28 -29 28 -85c0 -29 -8 -65 -15 -93c3 -1 7 -2 10 -4c15 25 36 56 56 76c30 30 53 44 68 44c5 0 9 -1 12 -4c12 -12 -1 -40 -41 -80
+c-20 -20 -51 -40 -76 -55c2 -3 3 -7 4 -10c28 7 64 15 93 15c56 0 85 -12 85 -28s-29 -28 -85 -28zM288 193v-3c30 -7 56 -10 75 -10c21 0 39 2 52 5c10 3 14 6 16 7c-2 1 -6 4 -16 7c-13 3 -31 5 -52 5c-19 0 -45 -4 -75 -11zM314 299c-14 -14 -30 -35 -46 -61l2 -2
+c26 16 47 32 61 46c15 15 26 28 33 40c5 9 7 14 7 16c-4 0 -22 -4 -57 -39zM178 236l2 2c-16 26 -32 47 -46 61c-35 35 -53 39 -57 39c0 -2 2 -7 7 -16c7 -12 18 -25 33 -40c14 -14 35 -30 61 -46zM85 180c19 0 45 3 75 10v3c-30 7 -56 11 -75 11c-21 0 -39 -2 -52 -5
+c-10 -3 -14 -6 -16 -7c2 -1 5 -4 15 -7c13 -3 32 -5 53 -5zM134 85c14 14 30 35 46 61l-2 2c-26 -16 -47 -32 -61 -46c-15 -15 -26 -29 -33 -41c-5 -9 -7 -14 -7 -16c4 0 22 5 57 40zM270 148l-2 -2c16 -26 32 -47 46 -61c35 -35 53 -40 57 -40c0 2 -2 7 -7 16
+c-7 12 -18 26 -33 41c-14 14 -35 30 -61 46zM217 383c-3 -13 -5 -31 -5 -52c0 -19 4 -45 11 -75h2c7 30 11 56 11 75c0 21 -2 39 -5 52c-3 10 -6 14 -7 16c-1 -2 -4 -6 -7 -16zM231 0c3 13 5 32 5 53c0 19 -4 45 -11 75h-2c-7 -30 -11 -56 -11 -75c0 -21 2 -40 5 -53
+c3 -10 6 -13 7 -15c1 2 4 5 7 15zM224 160c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM313 42c10 -34 7 -53 -5 -58c-2 -1 -3 -1 -5 -1c-11 0 -25 13 -37 35c5 35 -2 76 -2 76s24 -34 49 -52zM302 -1c1 4 2 14 -3 34c-5 4 -10 9 -15 14
+c0 -9 0 -17 -1 -25c10 -16 16 -22 19 -23zM182 365c-6 -35 1 -75 1 -75s-27 35 -48 51c-10 35 -7 54 5 59c2 1 3 1 5 1c11 0 24 -12 37 -36zM164 337c0 9 0 17 1 25c-10 16 -16 21 -19 22c-1 -4 -2 -14 3 -34c5 -4 10 -8 15 -13zM50 149c35 -4 76 2 76 2s-34 -24 -51 -48
+c-12 -4 -26 -6 -35 -6c-13 0 -21 4 -24 11c-5 11 7 25 34 41zM66 117c4 5 8 10 13 15c-9 0 -17 0 -25 1c-16 -10 -21 -16 -22 -19c1 0 4 -1 8 -1c7 0 16 1 26 4zM432 276c5 -11 -7 -26 -34 -42c-35 5 -76 -2 -76 -2s33 25 51 49c13 4 26 5 35 5c13 0 21 -3 24 -10zM394 250
+c16 10 21 16 22 19c-1 0 -4 1 -8 1c-7 0 -16 -1 -26 -4c-4 -5 -8 -9 -13 -14c9 0 17 -1 25 -2zM131 39c31 24 53 55 53 55s-7 -39 -3 -71c-15 -26 -28 -39 -39 -39c-2 0 -4 0 -6 1c-11 5 -13 24 -5 54zM143 1c4 2 12 8 22 26c0 6 -1 13 -1 20c-6 -6 -13 -12 -19 -17
+c-4 -18 -3 -26 -2 -29zM312 398c11 -5 13 -22 5 -54c-29 -21 -53 -55 -53 -55s8 48 3 71c13 25 28 39 39 39c2 0 4 0 6 -1zM303 353c5 18 3 27 2 30c-4 -2 -12 -8 -22 -26c0 -6 1 -14 1 -21c6 6 13 12 19 17zM71 285c18 -24 55 -53 55 -53s-40 7 -70 3c-28 15 -43 32 -38 44
+c3 7 10 11 22 11c8 0 21 -1 31 -5zM33 273c2 -4 8 -12 26 -22c6 0 13 1 20 1c-6 6 -12 12 -17 18c-8 2 -16 4 -22 4c-4 0 -6 -1 -7 -1zM392 149c30 -17 43 -33 38 -45c-3 -7 -10 -10 -22 -10c-8 0 -19 1 -31 5c-20 27 -55 52 -55 52s45 -8 70 -2zM408 110c4 0 6 1 7 1
+c-2 4 -8 12 -26 22c-6 0 -13 -1 -20 -1c6 -6 12 -13 17 -19c8 -2 16 -3 22 -3z" />
+ <glyph glyph-name="ion-ios-flower" unicode="&#xf433;"
+d="M363 220c56 0 85 -12 85 -28s-29 -28 -85 -28c-29 0 -65 7 -93 14c-1 -3 -2 -6 -4 -9c25 -15 56 -36 76 -56c40 -40 53 -68 41 -80s-40 1 -80 41c-20 20 -41 51 -56 76c-3 -2 -7 -3 -10 -4c7 -28 15 -64 15 -93c0 -56 -12 -85 -28 -85s-28 29 -28 85c0 29 8 65 15 93
+c-3 1 -7 2 -10 4c-15 -25 -36 -56 -56 -76c-40 -40 -68 -53 -80 -41s1 40 41 80c20 20 51 41 76 56c-2 3 -3 6 -4 9c-28 -7 -64 -14 -93 -14c-56 0 -85 12 -85 28s29 28 85 28c29 0 65 -8 93 -15c1 3 2 7 4 10c-25 15 -56 35 -76 55c-40 40 -53 68 -41 80s40 0 80 -40
+c20 -20 41 -51 56 -76c3 2 6 3 9 4c-7 28 -14 64 -14 93c0 56 12 85 28 85s28 -29 28 -85c0 -29 -7 -65 -14 -93c3 -1 6 -2 9 -4c15 25 36 56 56 76c40 40 68 52 80 40s-1 -40 -41 -80c-20 -20 -51 -40 -76 -55c2 -3 3 -7 4 -10c28 7 64 15 93 15zM264 94c0 0 24 -34 49 -52
+c10 -34 7 -53 -5 -58c-2 -1 -3 -1 -5 -1c-11 0 -25 13 -37 35c5 35 -2 76 -2 76zM183 290c0 0 -27 35 -48 51c-10 35 -7 54 5 59c2 1 3 1 5 1c11 0 24 -12 37 -36c-6 -35 1 -75 1 -75zM126 151c0 0 -34 -24 -51 -48c-12 -4 -26 -6 -35 -6c-13 0 -21 4 -24 11
+c-5 11 7 25 34 41c35 -4 76 2 76 2zM322 232c0 0 33 25 51 49c13 4 26 5 35 5c13 0 21 -3 24 -10c5 -11 -7 -26 -34 -42c-35 5 -76 -2 -76 -2zM131 39c31 24 53 55 53 55s-7 -39 -3 -71c-15 -26 -28 -39 -39 -39c-2 0 -4 0 -6 1c-11 5 -13 24 -5 54zM317 344
+c-29 -21 -53 -55 -53 -55s8 48 3 71c13 25 28 39 39 39c2 0 4 0 6 -1c11 -5 13 -22 5 -54zM56 235c-28 15 -43 32 -38 44c3 7 10 11 22 11c8 0 21 -1 31 -5c18 -24 55 -53 55 -53s-40 7 -70 3zM392 149c30 -17 43 -33 38 -45c-3 -7 -10 -10 -22 -10c-8 0 -19 1 -31 5
+c-20 27 -55 52 -55 52s45 -8 70 -2z" />
+ <glyph glyph-name="ion-ios-folder-outline" unicode="&#xf434;"
+d="M425 352c13 0 23 -10 23 -23v-304c0 -14 -10 -25 -23 -25h-400c-13 0 -25 12 -25 25v336c0 13 11 23 25 23h112c8 0 12 -2 17 -7v0l23 -23c2 -2 3 -2 6 -2h242zM25 368c-4 0 -9 -3 -9 -7v-74c3 1 5 1 8 1h400c3 0 5 0 8 -1v42c0 4 -3 7 -7 7h-242c-7 0 -12 2 -17 7
+l-23 23c-2 2 -3 2 -6 2h-112zM432 25v239c0 4 -4 8 -8 8h-400c-4 0 -8 -4 -8 -8v-239c0 -4 5 -9 9 -9h400c4 0 7 5 7 9z" />
+ <glyph glyph-name="ion-ios-folder" unicode="&#xf435;"
+d="M440 272c4 0 8 -4 8 -8v-239c0 -14 -10 -25 -23 -25h-400c-13 0 -25 12 -25 25v239c0 4 4 8 8 8h432zM425 352c13 0 23 -10 23 -23v-42c-3 1 -5 1 -8 1h-432c-3 0 -5 0 -8 -1v74c0 13 11 23 25 23h112c8 0 12 -2 17 -7v0l23 -23c2 -2 3 -2 6 -2h242z" />
+ <glyph glyph-name="ion-ios-football-outline" unicode="&#xf436;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM249 6c3 1 5 1 8 2l24 64l-20 39v1h-106l-20 -39l25 -65c2 -1 5 -1 7 -2c12 -3 25 -5 38 -5c14 0 30 2 44 5zM41 284c-15 -27 -23 -57 -24 -89l43 37v0zM142 371
+c-36 -14 -68 -38 -90 -69l22 -64l5 -2l49 -23l71 60v58zM277 201l-70 58l-69 -58v-1l18 -72h104l18 72zM399 195c-1 32 -9 63 -24 90l-19 -53v0zM364 302c-22 31 -54 56 -90 69l-58 -40v-58l71 -60l54 24zM18 175c3 -34 15 -66 33 -92l70 -1l21 39l-20 77l-1 1l-49 22z
+M295 82l70 1c18 26 30 58 33 92l-54 46l-50 -23l-20 -77zM207 345l47 32c-15 4 -30 6 -46 6s-32 -2 -47 -6zM118 66l-54 1c20 -23 46 -42 75 -53l-20 50zM277 14c29 11 55 30 75 53l-56 -1l-2 -3z" />
+ <glyph glyph-name="ion-ios-football" unicode="&#xf437;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM249 6c3 1 5 1 8 2l24 64l-20 39v1h-106l-20 -39l25 -65c2 -1 5 -1 7 -2c12 -3 25 -5 38 -5c14 0 30 2 44 5zM142 371c-36 -14 -68 -38 -90 -69l22 -64l5 -2l49 -23l71 60v58z
+M364 302c-22 31 -54 56 -90 69l-58 -40v-58l71 -60l54 24zM18 175c3 -34 15 -66 33 -92l70 -1l21 39l-20 77l-1 1l-49 22zM295 82l70 1c18 26 30 58 33 92l-54 46l-50 -23l-20 -77z" />
+ <glyph glyph-name="ion-ios-game-controller-a-outline" unicode="&#xf438;"
+d="M163 208c3 0 5 -2 5 -5v-22c0 -3 -2 -5 -5 -5h-35v-35c0 -3 -3 -5 -6 -5h-21c-3 0 -5 2 -5 5v35h-35c-3 0 -5 3 -5 6v21c0 3 2 5 5 5h35v35c0 3 2 5 5 5h22c3 0 5 -2 5 -5v-35h35zM330 169c11 0 20 -8 20 -19s-9 -19 -20 -19s-19 8 -19 19s8 19 19 19zM288 211
+c11 0 19 -8 19 -19s-8 -19 -19 -19s-20 8 -20 19s9 19 20 19zM373 211c11 0 19 -8 19 -19s-8 -19 -19 -19s-20 8 -20 19s9 19 20 19zM330 253c11 0 20 -8 20 -19s-9 -20 -20 -20s-19 9 -19 20s8 19 19 19zM337 286h-226c-26 0 -49 -9 -67 -26s-28 -41 -28 -67s10 -51 28 -68
+s41 -27 67 -27h226c26 0 49 10 67 27s28 42 28 68s-10 50 -28 67s-41 26 -67 26zM337 302v0c61 0 111 -45 111 -109s-50 -111 -111 -111h-226c-61 0 -111 47 -111 111s50 109 111 109h226z" />
+ <glyph glyph-name="ion-ios-game-controller-a" unicode="&#xf439;"
+d="M337 302c61 0 111 -45 111 -109s-50 -111 -111 -111h-226c-61 0 -111 47 -111 111s50 109 111 109h226zM168 181v0v22c0 3 -2 5 -5 5h-35v35c0 3 -2 5 -5 5h-22c-3 0 -5 -2 -5 -5v-35h-35c-3 0 -5 -2 -5 -5v-21c0 -3 2 -6 5 -6h35v-35c0 -3 2 -5 5 -5h21c3 0 6 2 6 5v35
+h35c3 0 5 2 5 5zM288 173c11 0 19 8 19 19s-8 19 -19 19s-20 -8 -20 -19s9 -19 20 -19zM330 131c11 0 20 8 20 19s-9 19 -20 19s-19 -8 -19 -19s8 -19 19 -19zM330 214c11 0 20 9 20 20s-9 19 -20 19s-19 -8 -19 -19s8 -20 19 -20zM373 173c11 0 19 8 19 19s-8 19 -19 19
+s-20 -8 -20 -19s9 -19 20 -19z" />
+ <glyph glyph-name="ion-ios-game-controller-b-outline" unicode="&#xf43a;"
+d="M276 244c11 0 20 -9 20 -20s-9 -20 -20 -20s-20 9 -20 20s9 20 20 20zM320 200c11 0 20 -9 20 -20s-9 -20 -20 -20s-20 9 -20 20s9 20 20 20zM103 264c22 0 39 -18 39 -40s-17 -40 -39 -40s-39 18 -39 40s17 40 39 40zM103 205c11 0 19 8 19 19s-8 19 -19 19
+s-19 -8 -19 -19s8 -19 19 -19zM320 288c11 0 20 -9 20 -20s-9 -20 -20 -20s-20 9 -20 20s9 20 20 20zM364 244c11 0 20 -9 20 -20s-9 -20 -20 -20s-20 9 -20 20s9 20 20 20zM434 199c21 -88 18 -152 -7 -164c-4 -2 -9 -3 -13 -3c-22 0 -45 24 -68 52c-26 32 -32 33 -110 33
+h-24c-78 0 -84 -1 -110 -33c-23 -28 -46 -52 -68 -52c-4 0 -9 1 -13 3c-25 12 -28 76 -7 164s43 136 88 149c10 3 18 4 26 4c28 0 47 -15 96 -15s68 15 96 15c8 0 16 -1 26 -4c45 -13 67 -61 88 -149zM420 49c10 5 23 48 -1 146c-21 90 -43 128 -78 138c-8 2 -14 3 -21 3
+c-10 0 -19 -2 -30 -5c-16 -4 -36 -10 -66 -10s-50 6 -66 10c-11 3 -20 5 -30 5c-7 0 -13 -1 -21 -3c-35 -10 -57 -48 -78 -138c-24 -98 -11 -141 -1 -146c2 -1 4 -1 6 -1c6 0 14 4 23 12s19 18 32 34s24 28 44 34c17 5 38 5 79 5h24c41 0 62 0 79 -5c20 -6 31 -18 44 -34
+s23 -26 32 -34s17 -12 23 -12c2 0 4 0 6 1z" />
+ <glyph glyph-name="ion-ios-game-controller-b" unicode="&#xf43b;"
+d="M103 243c11 0 19 -8 19 -19s-8 -19 -19 -19s-19 8 -19 19s8 19 19 19zM434 199c21 -88 18 -152 -7 -164c-4 -2 -9 -3 -13 -3c-22 0 -45 24 -68 52c-26 32 -32 33 -110 33h-24c-78 0 -84 -1 -110 -33c-23 -28 -46 -52 -68 -52c-4 0 -9 1 -13 3c-25 12 -28 76 -7 164
+s43 136 88 149c10 3 18 4 26 4c28 0 47 -15 96 -15s68 15 96 15c8 0 16 -1 26 -4c45 -13 67 -61 88 -149zM103 184c22 0 39 18 39 40s-17 40 -39 40s-39 -18 -39 -40s17 -40 39 -40zM276 204c11 0 20 9 20 20s-9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20zM320 160
+c11 0 20 9 20 20s-9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20zM320 248c11 0 20 9 20 20s-9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20zM364 204c11 0 20 9 20 20s-9 20 -20 20s-20 -9 -20 -20s9 -20 20 -20z" />
+ <glyph glyph-name="ion-ios-gear-outline" unicode="&#xf43c;" horiz-adv-x="384"
+d="M193 288c26 0 50 -10 68 -28s28 -42 28 -68s-10 -50 -28 -68s-42 -28 -68 -28s-50 10 -68 28s-28 42 -28 68s10 50 28 68s42 28 68 28zM193 112c44 0 80 36 80 80s-36 80 -80 80s-80 -36 -80 -80s36 -80 80 -80zM138 365c-10 -3 -20 -7 -30 -12c2 -8 1 -16 0 -24
+c-2 -13 -8 -25 -18 -35c-12 -12 -29 -19 -46 -19c-4 0 -9 0 -13 1c-5 -10 -9 -20 -12 -30c7 -4 12 -10 17 -17c8 -11 12 -24 12 -37s-4 -26 -12 -37c-5 -7 -10 -13 -17 -17c3 -10 7 -20 12 -30c4 1 9 1 13 1c17 0 34 -7 46 -19c10 -10 16 -22 18 -35c1 -8 2 -16 0 -24
+c10 -5 20 -9 30 -12c4 7 10 12 17 17c11 8 24 12 37 12s26 -4 37 -12c7 -5 13 -10 17 -17c10 3 20 7 30 12c-2 8 -1 16 0 24c2 13 8 25 18 35c12 12 29 19 46 19c4 0 9 0 13 -1c5 10 9 20 12 30c-7 4 -12 10 -17 17c-8 11 -12 24 -12 37s4 26 12 37c5 7 10 13 17 17
+c-3 10 -7 20 -12 30c-4 -1 -9 -1 -13 -1c-17 0 -34 7 -46 19c-10 10 -16 22 -18 35c-1 8 -2 16 0 24c-10 5 -20 9 -30 12c-4 -7 -10 -12 -17 -17c-11 -8 -24 -12 -37 -12s-26 4 -37 12c-7 5 -13 10 -17 17zM238 384v0c20 -5 40 -13 57 -24c-8 -18 -5 -40 10 -55
+c10 -10 22 -14 35 -14c7 0 14 1 20 4c11 -17 19 -37 24 -57c-19 -7 -32 -25 -32 -46s14 -39 32 -46c-5 -20 -13 -40 -24 -57c-6 3 -13 4 -20 4c-13 0 -25 -4 -35 -14c-15 -15 -18 -37 -10 -55c-17 -11 -37 -19 -57 -24c-7 18 -25 32 -46 32s-39 -14 -46 -32
+c-20 5 -40 13 -57 24c8 18 5 40 -10 55c-10 10 -22 14 -35 14c-7 0 -14 -1 -20 -4c-11 17 -19 37 -24 57c18 7 32 25 32 46s-13 39 -32 46c5 20 13 40 24 57c6 -3 13 -4 20 -4c13 0 25 4 35 14c15 15 18 37 10 55c17 11 37 19 57 24c7 -19 25 -32 46 -32s39 13 46 32z" />
+ <glyph glyph-name="ion-ios-gear" unicode="&#xf43d;" horiz-adv-x="384"
+d="M352 192c0 -21 14 -39 32 -46c-5 -20 -13 -40 -24 -57c-6 3 -13 4 -20 4c-13 0 -25 -4 -35 -14c-15 -15 -18 -37 -10 -55c-17 -11 -37 -19 -57 -24c-7 18 -25 32 -46 32s-39 -14 -46 -32c-20 5 -40 13 -57 24c8 18 5 40 -10 55c-10 10 -22 14 -35 14c-7 0 -14 -1 -20 -4
+c-11 17 -19 37 -24 57c18 7 32 25 32 46s-13 39 -32 46c5 20 13 40 24 57c6 -3 13 -4 20 -4c13 0 25 4 35 14c15 15 18 37 10 55c17 11 37 19 57 24c7 -19 25 -32 46 -32s39 13 46 32c20 -5 40 -13 57 -24c-8 -18 -5 -40 10 -55c10 -10 22 -14 35 -14c7 0 14 1 20 4
+c11 -17 19 -37 24 -57c-19 -7 -32 -25 -32 -46zM193 112c44 0 80 36 80 80s-36 80 -80 80s-80 -36 -80 -80s36 -80 80 -80z" />
+ <glyph glyph-name="ion-ios-glasses-outline" unicode="&#xf43e;"
+d="M433 201v0h15v-18h-15c-2 -22 -13 -43 -29 -58c-17 -16 -39 -25 -62 -25c-51 0 -92 41 -92 92v0v0c0 10 -12 22 -26 22s-26 -12 -26 -22v0v0c0 -51 -41 -92 -92 -92c-23 0 -45 9 -62 25c-16 15 -27 36 -29 58h-15v18h15c2 22 13 43 29 59c17 16 39 24 62 24
+c42 0 78 -27 89 -67c7 7 18 12 29 12s22 -5 29 -12c11 40 47 67 89 67c23 0 45 -9 62 -25c16 -15 27 -36 29 -58zM342 115c42 0 77 35 77 77s-35 77 -77 77s-77 -35 -77 -77s35 -77 77 -77zM106 115c42 0 77 35 77 77s-35 77 -77 77s-77 -35 -77 -77s35 -77 77 -77z" />
+ <glyph glyph-name="ion-ios-glasses" unicode="&#xf43f;"
+d="M433 201v0h15v-18h-15c-2 -22 -13 -43 -29 -58c-17 -16 -39 -25 -62 -25c-51 0 -92 41 -92 92v0v0c0 10 -12 22 -26 22s-26 -12 -26 -22v0v0c0 -51 -41 -92 -92 -92c-23 0 -45 9 -62 25c-16 15 -27 36 -29 58h-15v18h15c2 22 13 43 29 59c17 16 39 24 62 24
+c42 0 78 -27 89 -67c7 7 18 12 29 12s22 -5 29 -12c11 40 47 67 89 67c23 0 45 -9 62 -25c16 -15 27 -36 29 -58z" />
+ <glyph glyph-name="ion-ios-grid-view-outline" unicode="&#xf440;" horiz-adv-x="384"
+d="M384 256h-112v-128h112v-16h-112v-112h-16v112h-128v-112h-16v112h-112v16h112v128h-112v16h112v112h16v-112h128v112h16v-112h112v-16zM256 128v128h-128v-128h128z" />
+ <glyph glyph-name="ion-ios-grid-view" unicode="&#xf441;" horiz-adv-x="384"
+d="M128 128v128h128v-128h-128zM0 384h384v-384h-384v384zM352 256v16h-80v80h-16v-80h-128v80h-16v-80h-80v-16h80v-128h-80v-16h80v-80h16v80h128v-80h16v80h80v16h-80v128h80z" />
+ <glyph glyph-name="ion-ios-heart-outline" unicode="&#xf442;"
+d="M327 368c69 0 121 -43 121 -116c0 -31 -13 -71 -41 -105s-45 -52 -100 -88s-83 -43 -83 -43s-28 7 -83 43s-72 54 -100 88s-41 74 -41 105c0 73 52 116 121 116c39 0 82 -18 103 -53c21 35 64 53 103 53zM395 157c12 14 22 31 28 49c6 16 9 31 9 46c0 30 -10 56 -29 74
+c-9 8 -20 15 -33 19c-13 5 -28 7 -43 7c-38 0 -73 -18 -89 -45l-14 -23l-14 23c-16 27 -51 45 -89 45c-15 0 -30 -2 -43 -7c-13 -4 -24 -11 -33 -19c-19 -18 -29 -44 -29 -74c0 -15 3 -30 9 -46c6 -18 16 -35 28 -49c27 -32 42 -49 97 -85c40 -27 65 -36 74 -39
+c9 3 34 12 74 39c55 36 70 53 97 85z" />
+ <glyph glyph-name="ion-ios-heart" unicode="&#xf443;"
+d="M327 368c69 0 121 -43 121 -116c0 -31 -13 -71 -41 -105s-45 -52 -100 -88s-83 -43 -83 -43s-28 7 -83 43s-72 54 -100 88s-41 74 -41 105c0 73 52 116 121 116c39 0 82 -18 103 -53c21 35 64 53 103 53z" />
+ <glyph glyph-name="ion-ios-help-empty" unicode="&#xf444;" horiz-adv-x="128"
+d="M68 82c-9 0 -17 8 -17 17s8 17 17 17s17 -8 17 -17s-8 -17 -17 -17zM102 197c-23 -22 -22 -27 -23 -53h-19c1 28 7 43 30 64c11 10 19 24 19 39c0 24 -19 39 -42 39c-32 0 -49 -16 -48 -46h-19c0 42 25 62 68 62c33 0 60 -20 60 -54c0 -22 -11 -37 -26 -51z" />
+ <glyph glyph-name="ion-ios-help-outline" unicode="&#xf445;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM208 1c105 0 191 86 191 191s-86 191 -191 191s-191 -86 -191 -191s86 -191 191 -191zM212 302c33 0 60 -21 60 -55c0 -22 -11 -36 -26 -50c-23 -23 -22 -27 -23 -53h-19
+c1 28 7 43 30 64c11 10 19 23 19 38c0 24 -19 40 -42 40c-32 0 -49 -16 -48 -46h-19c0 42 25 62 68 62zM212 116c9 0 17 -8 17 -17s-8 -17 -17 -17s-17 8 -17 17s8 17 17 17z" />
+ <glyph glyph-name="ion-ios-help" unicode="&#xf446;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM212 82c9 0 17 8 17 17s-8 17 -17 17s-17 -8 -17 -17s8 -17 17 -17zM246 197c15 14 26 29 26 51c0 34 -27 54 -60 54c-43 0 -68 -20 -68 -62h19c-1 30 16 46 48 46
+c23 0 42 -15 42 -39c0 -15 -8 -29 -19 -39c-23 -21 -29 -36 -30 -64h19c1 26 0 31 23 53z" />
+ <glyph glyph-name="ion-ios-home-outline" unicode="&#xf447;" horiz-adv-x="384"
+d="M192 336l160 -128v-208h-112v128h-96v-128h-112v208zM336 16v184l-144 116l-144 -116v-184h80v128h128v-128h80zM192 384l192 -153l-12 -12l-180 145l-180 -145l-12 12l32 25v96h64v-45zM80 294v42h-32v-67z" />
+ <glyph glyph-name="ion-ios-home" unicode="&#xf448;" horiz-adv-x="384"
+d="M192 336l160 -128v-208h-112v128h-96v-128h-112v208zM192 384l192 -153l-12 -12l-180 145l-180 -145l-12 12l32 25v96h64v-45z" />
+ <glyph glyph-name="ion-ios-infinite-outline" unicode="&#xf449;"
+d="M419 260c19 -19 29 -43 29 -68s-10 -49 -29 -68c-19 -18 -44 -28 -70 -28s-50 10 -69 28l-126 123c-15 15 -35 22 -56 22s-40 -7 -55 -22c-31 -30 -31 -80 0 -110c15 -15 34 -22 55 -22s41 7 56 22l43 42l13 -14l-42 -41c-19 -18 -44 -28 -70 -28s-50 10 -69 28
+c-19 19 -29 43 -29 68s10 49 29 68c19 18 43 28 69 28s51 -10 70 -28l126 -123c15 -15 34 -22 55 -22s41 7 56 22c31 30 31 80 0 110c-15 15 -35 22 -56 22s-40 -7 -55 -22l-43 -42l-13 14l42 41c19 18 44 28 70 28s50 -10 69 -28z" />
+ <glyph glyph-name="ion-ios-infinite" unicode="&#xf44a;" horiz-adv-x="464"
+d="M433 266c20 -20 31 -46 31 -74s-11 -54 -31 -74s-48 -30 -76 -30s-55 10 -75 30l-125 123c-13 13 -32 20 -51 20s-37 -7 -50 -20s-21 -31 -21 -49c0 -19 8 -36 21 -49s31 -20 50 -20s38 7 51 20l39 38l25 -25l-39 -38c-20 -20 -48 -30 -76 -30s-55 10 -75 30
+s-31 46 -31 74s11 54 31 74s47 30 75 30s56 -10 76 -30l125 -123c13 -13 31 -20 50 -20s38 7 51 20s20 31 20 49c0 19 -7 36 -20 49s-32 20 -51 20s-37 -7 -50 -20l-39 -38l-25 25l39 38c20 20 48 30 76 30s55 -10 75 -30z" />
+ <glyph glyph-name="ion-ios-information-empty" unicode="&#xf44b;" horiz-adv-x="64"
+d="M8 276c0 13 7 20 20 20s20 -7 20 -20s-7 -20 -20 -20s-20 7 -20 20zM48 104h16v-8h-64v8h16v120h-16v8h48v-128z" />
+ <glyph glyph-name="ion-ios-information-outline" unicode="&#xf44c;" horiz-adv-x="416"
+d="M184 276c0 13 7 20 20 20s20 -7 20 -20s-7 -20 -20 -20s-20 7 -20 20zM224 104h16v-8h-64v8h16v120h-16v8h48v-128zM208 400c57 0 106 -20 147 -61s61 -90 61 -147s-20 -106 -61 -147s-90 -61 -147 -61s-106 20 -147 61s-61 90 -61 147s20 106 61 147s90 61 147 61z
+M208 1c53 0 98 19 135 56s56 82 56 135s-19 98 -56 135s-82 56 -135 56s-98 -19 -135 -56s-56 -82 -56 -135s19 -98 56 -135s82 -56 135 -56z" />
+ <glyph glyph-name="ion-ios-information" unicode="&#xf44d;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM204 296c-11 0 -20 -9 -20 -20s9 -20 20 -20s20 9 20 20s-9 20 -20 20zM240 96v8h-16v128h-48v-8h16v-120h-16v-8h64z" />
+ <glyph glyph-name="ion-ios-ionic-outline" unicode="&#xf44e;" horiz-adv-x="416"
+d="M378 313c24 -34 38 -76 38 -121c0 -115 -92 -208 -207 -208s-209 93 -209 208s94 208 209 208c45 0 86 -14 120 -38c6 5 13 8 21 8c19 0 35 -16 35 -35c0 -8 -2 -16 -7 -22zM350 357c-12 0 -22 -10 -22 -22s10 -22 22 -22s22 10 22 22s-10 22 -22 22zM344 56
+c18 18 31 39 41 62c10 24 15 48 15 74s-5 51 -15 75c-5 13 -12 25 -20 36c-5 -2 -10 -3 -15 -3c-19 0 -35 16 -35 35c0 5 2 11 4 15c-11 8 -23 15 -36 20c-24 10 -49 14 -75 14s-51 -4 -75 -14c-23 -10 -43 -24 -61 -42s-31 -38 -41 -61c-10 -24 -15 -49 -15 -75
+s5 -50 15 -74c10 -23 23 -44 41 -62s38 -31 61 -41c24 -10 49 -15 75 -15s51 5 75 15c23 10 43 23 61 41zM208 288c53 0 96 -43 96 -96s-43 -96 -96 -96s-96 43 -96 96s43 96 96 96zM208 112c44 0 80 36 80 80s-36 80 -80 80s-79 -36 -79 -80s35 -80 79 -80z" />
+ <glyph glyph-name="ion-ios-keypad-outline" unicode="&#xf44f;" horiz-adv-x="384"
+d="M331 107c30 0 53 -24 53 -54s-23 -53 -53 -53s-54 23 -54 53s24 54 54 54zM331 16c21 0 37 16 37 37s-16 38 -37 38s-38 -17 -38 -38s17 -37 38 -37zM192 107c30 0 53 -24 53 -54s-23 -53 -53 -53s-53 23 -53 53s23 54 53 54zM192 16c21 0 37 16 37 37s-16 38 -37 38
+s-37 -17 -37 -38s16 -37 37 -37zM53 107c30 0 54 -24 54 -54s-24 -53 -54 -53s-53 23 -53 53s23 54 53 54zM53 16c21 0 38 16 38 37s-17 38 -38 38s-37 -17 -37 -38s16 -37 37 -37zM331 245c30 0 53 -23 53 -53s-23 -53 -53 -53s-54 23 -54 53s24 53 54 53zM331 155
+c21 0 37 16 37 37s-16 37 -37 37s-38 -16 -38 -37s17 -37 38 -37zM192 245c30 0 53 -23 53 -53s-23 -53 -53 -53s-53 23 -53 53s23 53 53 53zM192 155c21 0 37 16 37 37s-16 37 -37 37s-37 -16 -37 -37s16 -37 37 -37zM53 245c30 0 54 -23 54 -53s-24 -53 -54 -53
+s-53 23 -53 53s23 53 53 53zM53 155c21 0 38 16 38 37s-17 37 -38 37s-37 -16 -37 -37s16 -37 37 -37zM331 277c-30 0 -54 24 -54 54s24 53 54 53s53 -23 53 -53s-23 -54 -53 -54zM331 368c-21 0 -38 -16 -38 -37s17 -38 38 -38s37 17 37 38s-16 37 -37 37zM192 384
+c30 0 53 -23 53 -53s-23 -54 -53 -54s-53 24 -53 54s23 53 53 53zM192 293c21 0 37 17 37 38s-16 37 -37 37s-37 -16 -37 -37s16 -38 37 -38zM53 384c30 0 54 -23 54 -53s-24 -54 -54 -54s-53 24 -53 54s23 53 53 53zM53 293c21 0 38 17 38 38s-17 37 -38 37
+s-37 -16 -37 -37s16 -38 37 -38z" />
+ <glyph glyph-name="ion-ios-keypad" unicode="&#xf450;" horiz-adv-x="384"
+d="M331 107c30 0 53 -24 53 -54s-23 -53 -53 -53s-54 23 -54 53s24 54 54 54zM192 107c30 0 53 -24 53 -54s-23 -53 -53 -53s-53 23 -53 53s23 54 53 54zM53 107c30 0 54 -24 54 -54s-24 -53 -54 -53s-53 23 -53 53s23 54 53 54zM331 245c30 0 53 -23 53 -53
+s-23 -53 -53 -53s-54 23 -54 53s24 53 54 53zM192 245c30 0 53 -23 53 -53s-23 -53 -53 -53s-53 23 -53 53s23 53 53 53zM53 245c30 0 54 -23 54 -53s-24 -53 -54 -53s-53 23 -53 53s23 53 53 53zM331 277c-30 0 -54 24 -54 54s24 53 54 53s53 -23 53 -53s-23 -54 -53 -54z
+M192 384c30 0 53 -23 53 -53s-23 -54 -53 -54s-53 24 -53 54s23 53 53 53zM53 384c30 0 54 -23 54 -53s-24 -54 -54 -54s-53 24 -53 54s23 53 53 53z" />
+ <glyph glyph-name="ion-ios-lightbulb-outline" unicode="&#xf451;" horiz-adv-x="288"
+d="M288 275c0 -31 -13 -59 -30 -83v0c-11 -15 -22 -28 -32 -45c-22 -38 -18 -73 -18 -82v-1h-128v1c0 7 3 44 -19 82c-10 17 -20 30 -31 45v0c-17 24 -30 52 -30 83c0 78 66 141 144 141s144 -63 144 -141zM239 194l6 8c16 22 27 47 27 73c0 33 -16 65 -40 89s-55 36 -88 36
+s-64 -12 -88 -36s-40 -56 -40 -89c0 -26 11 -51 27 -73l19 -26v0c5 -6 9 -13 13 -21c17 -29 21 -58 21 -75h16v112l-32 64h17l31 -64v-112h32v112l31 64h17l-32 -64v-112h16c0 17 4 45 21 75c8 14 16 25 24 36c1 1 1 2 2 3zM112 -32v16h64v-16h-64zM96 0v16h96v-16h-96z
+M96 32v16h96v-16h-96z" />
+ <glyph glyph-name="ion-ios-lightbulb" unicode="&#xf452;" horiz-adv-x="288"
+d="M288 275c0 -31 -13 -59 -30 -83v0c-11 -15 -22 -28 -32 -45c-22 -38 -18 -73 -18 -82v-1h-32v128l32 64h-16l-32 -64v-128h-32v128l-31 64h-17l32 -64v-128h-32v1c0 7 3 44 -19 82c-10 17 -20 30 -31 45v0c-17 24 -30 52 -30 83c0 78 66 141 144 141s144 -63 144 -141z
+M112 -32v16h64v-16h-64zM96 0v16h96v-16h-96zM96 32v16h96v-16h-96z" />
+ <glyph glyph-name="ion-ios-list-outline" unicode="&#xf453;" horiz-adv-x="384"
+d="M368 368h-352v-352h352v352zM384 384v0v-384h-384v384h384zM128 280v16h192v-16h-192zM128 184v16h192v-16h-192zM128 88v16h192v-16h-192zM64 288c0 11 5 16 16 16s16 -5 16 -16s-5 -16 -16 -16s-16 5 -16 16zM64 192c0 11 5 16 16 16s16 -5 16 -16s-5 -16 -16 -16
+s-16 5 -16 16zM64 96c0 11 5 16 16 16s16 -5 16 -16s-5 -16 -16 -16s-16 5 -16 16z" />
+ <glyph glyph-name="ion-ios-list" unicode="&#xf454;" horiz-adv-x="384"
+d="M0 384h384v-384h-384v384zM80 80c9 0 16 7 16 16s-7 16 -16 16s-16 -7 -16 -16s7 -16 16 -16zM80 176c9 0 16 7 16 16s-7 16 -16 16s-16 -7 -16 -16s7 -16 16 -16zM80 272c9 0 16 7 16 16s-7 16 -16 16s-16 -7 -16 -16s7 -16 16 -16zM320 88v16h-192v-16h192zM320 184v16
+h-192v-16h192zM320 280v16h-192v-16h192z" />
+ <glyph glyph-name="ion-ios-location-outline" unicode="&#xf455;" horiz-adv-x="288"
+d="M144 400c-34 0 -67 -13 -91 -37s-37 -57 -37 -91c0 -43 24 -107 70 -186c22 -38 44 -72 58 -91c14 19 36 53 58 91c46 79 70 143 70 186c0 34 -13 67 -37 91s-57 37 -91 37zM144 416v0c80 0 144 -64 144 -144c0 -112 -144 -304 -144 -304s-144 192 -144 304
+c0 80 64 144 144 144zM144 336c35 0 64 -29 64 -64s-29 -64 -64 -64s-64 29 -64 64s29 64 64 64zM144 225c26 0 47 21 47 47s-21 47 -47 47s-47 -21 -47 -47s21 -47 47 -47z" />
+ <glyph glyph-name="ion-ios-location" unicode="&#xf456;" horiz-adv-x="288"
+d="M144 416c80 0 144 -64 144 -144c0 -112 -144 -304 -144 -304s-144 192 -144 304c0 80 64 144 144 144zM144 225c26 0 47 21 47 47s-21 47 -47 47s-47 -21 -47 -47s21 -47 47 -47z" />
+ <glyph glyph-name="ion-ios-locked-outline" unicode="&#xf457;" horiz-adv-x="320"
+d="M264 224h56v-240h-320v240h56v72c0 57 47 104 104 104s104 -47 104 -104v-72zM72 296v-72h176v72c0 49 -39 88 -88 88s-88 -39 -88 -88zM304 0v208h-288v-208h288zM160 160c18 0 32 -14 32 -32c0 -15 -10 -27 -24 -31v-33h-16v33c-14 4 -24 16 -24 31c0 18 14 32 32 32z
+M160 112c9 0 16 7 16 16s-7 16 -16 16s-16 -7 -16 -16s7 -16 16 -16z" />
+ <glyph glyph-name="ion-ios-locked" unicode="&#xf458;" horiz-adv-x="320"
+d="M264 224h56v-240h-320v240h56v72c0 57 47 104 104 104s104 -47 104 -104v-72zM168 97c14 4 24 16 24 31c0 18 -14 32 -32 32s-32 -14 -32 -32c0 -15 10 -27 24 -31v-33h16v33zM248 224v72c0 49 -39 88 -88 88s-88 -39 -88 -88v-72h176zM160 144c9 0 16 -7 16 -16
+s-7 -16 -16 -16s-16 7 -16 16s7 16 16 16z" />
+ <glyph glyph-name="ion-ios-loop-strong" unicode="&#xf459;" horiz-adv-x="512"
+d="M256 400c115 0 208 -93 208 -208c0 -14 -1 -28 -4 -42l-1 -4l-24 5l1 4c2 12 4 24 4 37c0 101 -83 184 -184 184c-66 0 -127 -36 -160 -94l-2 -3l-21 11l2 4c37 65 106 106 181 106zM416 102l2 3l21 -11l-2 -4c-37 -65 -106 -106 -181 -106c-115 0 -208 93 -208 208
+c0 14 1 28 4 42l1 4l24 -5l-1 -4c-2 -12 -4 -24 -4 -37c0 -101 83 -184 184 -184c66 0 127 36 160 94zM384 192h128l-64 -64zM0 192l64 64l64 -64h-128z" />
+ <glyph glyph-name="ion-ios-loop" unicode="&#xf45a;" horiz-adv-x="489"
+d="M478 192l11 -11l-52 -53l-53 53l10 11l43 -41zM449 192v0v0c0 -7 0 -14 -1 -21l-16 1c1 7 1 14 1 21c-1 103 -85 187 -188 187c-68 0 -131 -37 -164 -96l-14 8c36 64 104 104 178 104c112 0 203 -91 204 -202v0v-2zM409 100l14 -8c-36 -64 -104 -104 -178 -104
+c-111 0 -202 90 -204 200v0v3v1v0c0 7 0 14 1 21l16 -1c-1 -7 -1 -14 -1 -21c0 -103 85 -187 188 -187c68 0 131 37 164 96zM53 256l52 -53l-11 -11l-41 41l-42 -41l-11 11z" />
+ <glyph glyph-name="ion-ios-medical-outline" unicode="&#xf45b;" horiz-adv-x="364"
+d="M364 260l-118 -68l118 -68l-32 -56l-118 69v-137h-64v137l-118 -69l-32 56l118 68l-118 68l32 56l118 -69v137h64v-137l118 69zM342 118l-128 74l128 74l-16 28l-128 -74v148h-32v-148l-128 74l-16 -28l128 -74l-128 -74l16 -28l128 74v-148h32v148l128 -74z" />
+ <glyph glyph-name="ion-ios-medical" unicode="&#xf45c;" horiz-adv-x="364"
+d="M364 260l-118 -68l118 -68l-32 -56l-118 69v-137h-64v137l-118 -69l-32 56l118 68l-118 68l32 56l118 -69v137h64v-137l118 69z" />
+ <glyph glyph-name="ion-ios-medkit-outline" unicode="&#xf45d;" horiz-adv-x="416"
+d="M224 240h-32v-48v-16h-16h-48v-32h48h16v-16v-48h32v48v16h16h48v32h-48h-16v16v48zM240 256v0v-64h64v-64h-64v-64h-64v64h-64v64h64v64h64zM288 320h128v-320h-416v320h128v32c0 18 10 32 29 32h99c19 0 32 -14 32 -32v-32zM144 350v-30h128v30c0 10 -7 18 -17 18h-97
+c-11 0 -14 -8 -14 -18zM400 16v288h-384v-288h384z" />
+ <glyph glyph-name="ion-ios-medkit" unicode="&#xf45e;" horiz-adv-x="416"
+d="M224 176h16h48v-32h-48h-16v-16v-48h-32v48v16h-16h-48v32h48h16v16v48h32v-48v-16zM288 320h128v-320h-416v320h128v32c0 18 10 32 29 32h99c19 0 32 -14 32 -32v-32zM144 350v-30h128v30c0 10 -7 18 -17 18h-97c-11 0 -14 -8 -14 -18zM304 128v64h-64v64h-64v-64h-64
+v-64h64v-64h64v64h64z" />
+ <glyph glyph-name="ion-ios-mic-off" unicode="&#xf45f;" horiz-adv-x="280"
+d="M266 -32l-258 440l14 8l258 -440zM128 95c-44 0 -79 37 -79 83v118l113 -193c-10 -5 -22 -8 -34 -8zM207 178c0 -10 -2 -19 -5 -28l-136 234c14 20 37 32 62 32c44 0 79 -38 79 -84v-154zM256 176c0 -28 -9 -54 -24 -75l-10 17c11 17 17 36 17 58v80h17v-80zM139 49v0
+v-63h69v-18h-161v18h73v63c-67 5 -120 60 -120 127v80h19v-80c0 -60 50 -109 110 -109c17 0 34 4 48 11l9 -16c-14 -7 -30 -12 -47 -13z" />
+ <glyph glyph-name="ion-ios-mic-outline" unicode="&#xf460;" horiz-adv-x="256"
+d="M128 416c44 0 79 -38 79 -84v-154c0 -46 -35 -84 -79 -84s-79 38 -79 84v154c0 46 35 84 79 84zM191 178v154c0 37 -28 68 -63 68s-63 -31 -63 -68v-154c0 -37 28 -68 63 -68s63 31 63 68zM239 256h17v-80c0 -67 -51 -122 -117 -127v-63h69v-18h-161v18h73v63
+c-67 5 -120 60 -120 127v80h19v-80c0 -60 50 -109 110 -109s110 49 110 109v80z" />
+ <glyph glyph-name="ion-ios-mic" unicode="&#xf461;" horiz-adv-x="256"
+d="M128 94c-44 0 -79 38 -79 84v154c0 46 35 84 79 84s79 -38 79 -84v-154c0 -46 -35 -84 -79 -84zM239 256h17v-80c0 -67 -51 -122 -117 -127v-63h69v-18h-161v18h73v63c-67 5 -120 60 -120 127v80h19v-80c0 -60 50 -109 110 -109s110 49 110 109v80z" />
+ <glyph glyph-name="ion-ios-minus-empty" unicode="&#xf462;" horiz-adv-x="256"
+d="M256 183h-256v17h256v-17z" />
+ <glyph glyph-name="ion-ios-minus-outline" unicode="&#xf463;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM208 1c105 0 191 86 191 191s-86 191 -191 191s-191 -86 -191 -191s86 -191 191 -191zM80 183v17h256v-17h-256z" />
+ <glyph glyph-name="ion-ios-minus" unicode="&#xf464;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM336 183v17h-256v-17h256z" />
+ <glyph glyph-name="ion-ios-monitor-outline" unicode="&#xf465;" horiz-adv-x="480"
+d="M480 64h-176v-16h64v-16h-257v16h64v16h-175v288h480v-288zM16 336v-256h448v256h-448z" />
+ <glyph glyph-name="ion-ios-monitor" unicode="&#xf466;" horiz-adv-x="480"
+d="M480 64h-176v-16h64v-16h-257v16h64v16h-175v288h480v-288zM16 336v-256h448v256h-448zM32 96v224h416v-224h-416z" />
+ <glyph glyph-name="ion-ios-moon-outline" unicode="&#xf467;" horiz-adv-x="216"
+d="M195 133c7 0 14 1 21 3c-4 -7 -7 -12 -12 -18c-21 -25 -53 -41 -88 -41c-64 0 -116 51 -116 115c0 52 34 96 81 111c7 2 14 3 22 4c-4 -6 -8 -12 -11 -18c-7 -14 -11 -30 -11 -47c0 -29 11 -56 32 -77s48 -32 77 -32h5zM116 93c25 0 48 9 65 24c-65 5 -116 59 -116 125
+c0 14 2 28 6 40c-33 -16 -55 -51 -55 -90c0 -55 45 -99 100 -99z" />
+ <glyph glyph-name="ion-ios-moon" unicode="&#xf468;" horiz-adv-x="216"
+d="M195 133c7 0 14 1 21 3c-4 -7 -7 -12 -12 -18c-21 -25 -53 -41 -88 -41c-64 0 -116 51 -116 115c0 52 34 96 81 111c7 2 14 3 22 4c-4 -6 -8 -12 -11 -18c-7 -14 -11 -30 -11 -47c0 -29 11 -56 32 -77s48 -32 77 -32h5z" />
+ <glyph glyph-name="ion-ios-more-outline" unicode="&#xf469;" horiz-adv-x="320"
+d="M160 210c-10 0 -18 -8 -18 -18s8 -18 18 -18s18 8 18 18s-8 18 -18 18zM160 224v0c18 0 32 -14 32 -32s-14 -32 -32 -32s-32 14 -32 32s14 32 32 32zM32 210c-10 0 -18 -8 -18 -18s8 -18 18 -18s18 8 18 18s-8 18 -18 18zM32 224v0c18 0 32 -14 32 -32s-14 -32 -32 -32
+s-32 14 -32 32s14 32 32 32zM288 210c-10 0 -18 -8 -18 -18s8 -18 18 -18s18 8 18 18s-8 18 -18 18zM288 224v0c18 0 32 -14 32 -32s-14 -32 -32 -32s-32 14 -32 32s14 32 32 32z" />
+ <glyph glyph-name="ion-ios-more" unicode="&#xf46a;" horiz-adv-x="320"
+d="M160 224v0c18 0 32 -14 32 -32s-14 -32 -32 -32s-32 14 -32 32s14 32 32 32zM32 224v0c18 0 32 -14 32 -32s-14 -32 -32 -32s-32 14 -32 32s14 32 32 32zM288 224v0c18 0 32 -14 32 -32s-14 -32 -32 -32s-32 14 -32 32s14 32 32 32z" />
+ <glyph glyph-name="ion-ios-musical-note" unicode="&#xf46b;" horiz-adv-x="192"
+d="M192 346v-1v-65c0 -3 -3 -6 -6 -5v0l-73 13v-192c0 -33 1 -80 -51 -82c-48 -2 -62 16 -62 41c0 19 9 39 51 41c22 1 37 1 45 1v273l90 -19l2 -1c2 0 3 -1 4 -3v0v-1v0z" />
+ <glyph glyph-name="ion-ios-musical-notes" unicode="&#xf46c;" horiz-adv-x="320"
+d="M320 128c0 -34 4 -80 -49 -82c-49 -2 -62 16 -62 41c0 20 9 39 52 41c23 1 34 2 43 2v160l-191 -32v-161c0 -34 3 -81 -50 -83c-49 -2 -63 17 -63 42c0 20 9 39 52 41c23 1 35 1 44 1v237l224 35v-242z" />
+ <glyph glyph-name="ion-ios-navigate-outline" unicode="&#xf46d;" horiz-adv-x="416"
+d="M208 384c-51 0 -99 -21 -135 -57s-57 -84 -57 -135s21 -99 57 -135s84 -57 135 -57s99 21 135 57s57 84 57 135s-21 99 -57 135s-84 57 -135 57zM208 400v0c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM304 288l-96 -224v128h-128z" />
+ <glyph glyph-name="ion-ios-navigate" unicode="&#xf46e;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM208 64l96 224l-224 -96h128v-128z" />
+ <glyph glyph-name="ion-ios-nutrition-outline" unicode="&#xf46f;" horiz-adv-x="384"
+d="M294 214v0c6 -6 10 -14 10 -23c0 -11 -5 -20 -13 -26v0s-51 -37 -106 -77l-38 31c-2 2 -4 3 -6 3c-1 0 -2 0 -3 -1v0c-2 -2 -2 -6 1 -10l29 -35l-115 -84c-6 -4 -13 -8 -21 -8c-18 0 -32 14 -32 32c0 7 1 13 4 18v0c2 2 17 25 37 57l21 -17c2 -2 4 -2 6 -2c1 0 3 0 4 1v0
+c2 2 1 6 -2 10l-19 23c27 43 60 96 84 134l36 -30c2 -2 4 -3 6 -3c1 0 2 1 3 2v0c2 2 2 5 -1 9l-33 40c11 18 19 29 19 29v0c6 10 15 16 27 16c9 0 18 -4 24 -10v0l78 -79v0v0zM282 178c4 3 6 8 6 13c0 4 -2 9 -5 12l-5 4v1l-69 69v0l-5 5c-3 3 -8 5 -12 5
+c-6 0 -10 -3 -13 -8l-5 -8c-2 -3 -5 -7 -8 -12l25 -30v0l1 -1c8 -10 8 -22 0 -30l-1 -1l-1 -1c-4 -3 -8 -5 -13 -5s-11 2 -16 6v1h-1l-21 18l-24 -39l-44 -70l12 -14v0v0c8 -10 8 -23 0 -31v0c-4 -4 -9 -6 -15 -6c-5 0 -11 2 -16 6v0v0l-7 5c-3 -5 -5 -9 -8 -13
+c-12 -19 -16 -26 -18 -29c-1 -3 -2 -6 -2 -9c0 -9 7 -16 16 -16c3 0 6 2 11 5l101 74l-18 22h-1v0c-8 10 -8 23 0 31v0v0v0c4 4 10 6 15 6s11 -2 16 -6v0h1l28 -24c49 36 93 68 96 70zM376 333l8 -14l-5 -3l-103 -60l-17 17l71 123l2 4l14 -8l-3 -4l-63 -111l91 53z" />
+ <glyph glyph-name="ion-ios-nutrition" unicode="&#xf470;" horiz-adv-x="384"
+d="M295 214v0c6 -6 9 -13 9 -22c0 -11 -5 -20 -13 -26v0s-51 -38 -106 -78l-38 32c-4 3 -8 3 -10 1v0c-2 -2 -2 -6 1 -10l29 -35l-114 -84c-6 -4 -13 -8 -21 -8c-18 0 -32 14 -32 32c0 7 2 13 5 18v0c1 2 16 25 36 57l20 -17c4 -3 8 -3 10 -1v0c2 2 2 6 -1 10l-20 23
+c27 43 60 96 84 134l36 -30c4 -3 8 -3 10 -1v0c2 2 2 6 -1 10l-33 40c11 18 18 29 18 29v0c6 10 16 16 28 16c9 0 18 -4 24 -10v0l78 -79l1 -1v0zM384 309l-103 -59l-28 29l70 121l28 -16l-50 -85l67 38z" />
+ <glyph glyph-name="ion-ios-paper-outline" unicode="&#xf471;" horiz-adv-x="384"
+d="M48 384h336v-353c0 -17 -14 -31 -31 -31h-322c-17 0 -31 14 -31 31v305h32v-16h-16v-289c0 -8 7 -15 15 -15h322c8 0 15 7 15 15v337h-304v-320h-16v320v16zM96 320v16h128v-16h-128zM96 240v16h240v-16h-240zM96 160v16h192v-16h-192zM96 80v16h240v-16h-240z" />
+ <glyph glyph-name="ion-ios-paper" unicode="&#xf472;" horiz-adv-x="384"
+d="M48 384h336v-353c0 -17 -14 -31 -31 -31h-322c-17 0 -31 14 -31 31v305h32v-288h16v288v32v16zM96 336v-16h128v16h-128zM96 176v-16h192v16h-192zM336 80v16h-240v-16h240zM336 240v16h-240v-16h240z" />
+ <glyph glyph-name="ion-ios-paperplane-outline" unicode="&#xf473;" horiz-adv-x="320"
+d="M0 198l320 154l-146 -320l-57 115zM132 152l41 -83l115 249zM286 320l-248 -121l83 -36z" />
+ <glyph glyph-name="ion-ios-paperplane" unicode="&#xf474;" horiz-adv-x="320"
+d="M0 198l320 154l-214 -200zM320 352l-146 -320l-52 104z" />
+ <glyph glyph-name="ion-ios-partlysunny-outline" unicode="&#xf475;" horiz-adv-x="384"
+d="M144 298v54h16v-54h-16zM0 192v16h55v-16h-55zM44 299l10 11l32 -32l-11 -11zM223 268l-11 11l32 32l11 -11zM56 96l-10 11l31 31l11 -11zM129 153c-4 -3 -8 -7 -12 -12c-23 12 -39 36 -39 63c0 39 32 71 71 71c21 0 40 -10 53 -25c-4 -2 -9 -4 -14 -8
+c-10 11 -23 17 -39 17c-30 0 -55 -25 -55 -55c0 -23 15 -43 35 -51zM235 208c-34 0 -63 -28 -63 -62v-12s1 -10 1 -10c-5 0 -12 -1 -14 -1c-19 -3 -33 -18 -33 -37c0 -10 3 -19 10 -26s16 -11 26 -11h157c27 0 49 22 49 49s-22 50 -49 50c-2 0 -4 -1 -6 -1l-14 -2l-3 14
+c-3 14 -11 26 -22 35s-25 14 -39 14zM235 224v0c37 0 68 -26 76 -61h8c36 0 65 -29 65 -65s-29 -66 -65 -66h-157c-28 0 -52 24 -52 53c0 27 21 51 47 53v8c0 43 35 78 78 78z" />
+ <glyph glyph-name="ion-ios-partlysunny" unicode="&#xf476;" horiz-adv-x="384"
+d="M144 298v54h16v-54h-16zM0 192v16h55v-16h-55zM44 299l10 11l32 -32l-11 -11zM223 268l-11 11l32 32l11 -11zM56 96l-10 11l31 31l11 -11zM235 224v0c37 0 68 -26 76 -61h8c36 0 65 -29 65 -65s-29 -66 -65 -66h-157c-28 0 -52 24 -52 53c0 27 21 51 47 53v8
+c0 43 35 78 78 78zM201 252l1 -2v0c-31 -5 -62 -43 -62 -75c0 -2 1 -5 1 -7l-1 -1h-1c-11 -6 -18 -14 -22 -26v1v-1c-23 12 -39 36 -39 63c0 39 32 71 71 71c21 0 39 -9 52 -23z" />
+ <glyph glyph-name="ion-ios-pause-outline" unicode="&#xf477;" horiz-adv-x="256"
+d="M63 336h-47v-288h47v288zM79 352v0v-320h-79v320h79zM240 336h-47v-288h47v288zM256 352v0v-320h-79v320h79z" />
+ <glyph glyph-name="ion-ios-pause" unicode="&#xf478;" horiz-adv-x="256"
+d="M0 32v320h79v-320h-79zM177 32v320h79v-320h-79z" />
+ <glyph glyph-name="ion-ios-paw-outline" unicode="&#xf479;" horiz-adv-x="384"
+d="M380 252c6 -17 5 -38 -3 -57c-10 -25 -31 -43 -51 -43c-5 0 -10 1 -15 3c-22 10 -30 45 -17 79c10 28 31 46 51 46c5 0 10 -1 14 -3c10 -4 17 -13 21 -25zM362 202c6 15 7 31 2 44c-2 5 -5 12 -12 15c-2 1 -4 2 -7 2c-13 0 -28 -15 -36 -36c-9 -25 -6 -50 8 -56
+c2 -1 5 -1 8 -1c14 0 29 13 37 32zM90 234c13 -34 5 -69 -17 -79c-5 -2 -10 -3 -15 -3c-20 0 -41 18 -51 43c-8 19 -9 40 -3 57c4 12 11 21 21 25c4 2 9 3 14 3c20 0 41 -18 51 -46zM67 171c14 6 17 31 8 56c-8 21 -23 36 -36 36c-3 0 -5 -1 -7 -2c-7 -3 -10 -10 -12 -15
+c-5 -13 -4 -29 2 -44c8 -19 23 -32 37 -32c3 0 6 0 8 1zM134 237c-28 1 -52 32 -56 69c-2 23 4 45 16 60c8 10 19 17 31 18h6c27 -1 46 -29 50 -67c3 -24 -1 -48 -13 -63c-8 -9 -17 -15 -28 -16c-2 0 -4 -1 -6 -1zM107 356c-10 -12 -14 -29 -12 -48c3 -29 21 -53 40 -54h3
+c6 1 12 4 17 10c10 12 12 31 10 51c-3 29 -17 52 -35 53h-3c-9 -1 -16 -7 -20 -12zM192 208c64 0 128 -76 128 -149c0 -22 -11 -40 -22 -47c-13 -9 -23 -12 -42 -12c-23 0 -29 8 -40 15c-8 5 -14 10 -24 10s-16 -5 -24 -10c-11 -7 -17 -15 -40 -15c-19 0 -29 3 -42 12
+c-11 7 -22 25 -22 47c0 73 64 149 128 149zM290 27c6 4 14 16 14 32c0 30 -14 64 -36 91c-11 13 -23 24 -36 31c-13 8 -27 11 -40 11s-27 -3 -40 -11c-13 -7 -25 -18 -36 -31c-22 -27 -36 -61 -36 -91c0 -16 8 -28 14 -32c11 -7 18 -10 34 -10c14 0 19 4 26 9c2 1 4 3 6 4
+c9 6 18 12 32 12s23 -6 32 -12c2 -1 4 -3 6 -4c7 -5 12 -9 26 -9c16 0 23 3 34 10zM244 238c-11 1 -20 7 -28 16c-12 15 -16 39 -13 63c4 38 23 66 50 67h7c12 -1 22 -8 30 -18c12 -15 18 -37 16 -60c-4 -37 -28 -67 -56 -68h-6zM219 315c-2 -20 0 -39 10 -51
+c5 -6 11 -9 17 -10h3c19 1 38 25 41 54c2 19 -3 36 -13 48c-4 5 -10 11 -19 12h-4c-18 -1 -32 -24 -35 -53z" />
+ <glyph glyph-name="ion-ios-paw" unicode="&#xf47a;" horiz-adv-x="384"
+d="M380 252c6 -17 5 -38 -3 -57c-10 -25 -31 -43 -51 -43c-5 0 -10 1 -15 3c-22 10 -30 45 -17 79c10 28 31 46 51 46c5 0 10 -1 14 -3c10 -4 17 -13 21 -25zM90 234c13 -34 5 -69 -17 -79c-5 -2 -10 -3 -15 -3c-20 0 -41 18 -51 43c-8 19 -9 40 -3 57c4 12 11 21 21 25
+c4 2 9 3 14 3c20 0 41 -18 51 -46zM134 237c-28 1 -52 32 -56 69c-2 23 4 45 16 60c8 10 19 17 31 18h6c27 -1 46 -29 50 -67c3 -24 -1 -48 -13 -63c-8 -9 -17 -15 -28 -16c-2 0 -4 -1 -6 -1zM192 208c64 0 128 -76 128 -149c0 -22 -11 -40 -22 -47c-13 -9 -23 -12 -42 -12
+c-23 0 -29 8 -40 15c-8 5 -14 10 -24 10s-16 -5 -24 -10c-11 -7 -17 -15 -40 -15c-19 0 -29 3 -42 12c-11 7 -22 25 -22 47c0 73 64 149 128 149zM244 238c-11 1 -20 7 -28 16c-12 15 -16 39 -13 63c4 38 23 66 50 67h7c12 -1 22 -8 30 -18c12 -15 18 -37 16 -60
+c-4 -37 -28 -67 -56 -68h-6z" />
+ <glyph glyph-name="ion-ios-people-outline" unicode="&#xf47b;"
+d="M224 336v0v0zM317 113c11 -4 -11 4 0 0c28 -10 46 -35 46 -65h-28h-250c0 22 9 42 27 55c15 11 31 12 49 16c7 1 24 5 26 13s1 15 1 23c0 3 0 3 -2 5c-4 4 -6 9 -8 14c-2 8 -3 16 -4 24c-9 -2 -10 16 -12 21c-1 4 -7 24 3 21c-3 5 -4 13 -5 19c-2 13 -2 26 3 39
+c10 26 37 39 64 38c26 -1 51 -16 59 -42c4 -12 3 -26 1 -39c-1 -5 -2 -11 -4 -15c10 3 4 -20 3 -23c-2 -5 -3 -21 -12 -19c-1 -10 -2 -22 -7 -31c-1 -2 -7 -8 -7 -10v-11c0 -5 0 -10 2 -15s10 -7 14 -8c14 -5 27 -5 41 -10zM115 84c-6 -6 9 10 0 0c-6 -6 -10 -12 -12 -20h4
+h238c-4 15 -17 27 -30 33s-28 4 -41 9s-25 9 -28 25c-2 11 -2 22 -2 33c0 2 7 7 8 9c3 5 4 11 5 17c1 5 0 12 4 15c5 4 7 7 9 13c2 8 3 12 -1 19c-3 5 0 8 1 13c3 11 4 24 2 36c-8 37 -62 45 -86 19c-12 -13 -12 -31 -9 -47c1 -6 6 -14 3 -19c-1 -3 -5 -6 -4 -10
+c2 -5 2 -11 4 -16c2 -4 4 -6 7 -8s3 -6 3 -9c1 -7 2 -17 6 -23c3 -4 8 -6 8 -11v-21c-1 -8 -2 -18 -8 -24c-7 -6 -18 -10 -27 -12c-11 -3 -23 -3 -33 -7c-8 -3 -15 -8 -21 -14zM112 126c-15 -7 9 4 0 0c-9 -5 -18 -11 -25 -19c-1 -2 -6 -11 -7 -11h-25h-55c0 20 13 34 31 40
+c6 2 27 4 30 11c2 5 0 11 0 16c-10 -1 -24 1 -32 7c-2 2 3 9 4 12l3 12c1 9 1 19 1 28c0 16 -1 34 8 48c8 13 23 18 38 18c24 0 43 -13 47 -37c3 -16 1 -32 2 -48c0 -8 2 -16 5 -24c1 -2 5 -7 3 -9l-6 -3c-5 -2 -11 -3 -17 -4c-1 0 -8 0 -9 -1s0 -9 0 -11c0 -4 1 -6 5 -7
+c6 -2 19 -3 23 -8c2 -3 1 -5 -2 -5c-8 -1 -15 -1 -22 -5zM71 112c6 10 16 18 26 24c-9 9 -5 26 -4 37c0 2 0 5 2 5h8c6 0 11 1 17 2c-7 23 0 47 -5 70c-3 16 -15 23 -31 23c-17 0 -27 -9 -30 -25c-4 -22 3 -46 -4 -68c9 -1 17 -2 26 -2c1 0 1 -28 1 -29
+c-1 -12 -8 -18 -19 -22c-12 -4 -29 -3 -36 -15h49zM368 96c-2 8 -10 14 -16 19c-8 6 -18 13 -28 15c-3 1 -16 -1 -13 5c2 4 9 5 13 6s15 2 16 7c0 1 1 14 0 14c-6 0 -12 1 -18 2c-4 1 -7 2 -11 4c-6 3 -2 6 0 11c14 32 -10 88 32 105c15 6 34 5 48 -3c15 -9 20 -27 20 -44
+c0 -20 -4 -44 7 -62c2 -3 4 -4 0 -6c-2 -1 -4 -1 -6 -2l-12 -3s-9 -1 -13 -1c0 -4 -2 -13 1 -17c6 -7 21 -7 29 -10c18 -6 31 -20 31 -40h-80zM367 123c4 -4 -5 5 0 0s8 -11 15 -11h16h28c-7 12 -26 11 -38 16c-11 4 -16 12 -17 24c0 2 -1 27 1 27c9 0 18 0 26 1
+c-7 23 1 47 -4 70c-3 15 -15 23 -30 23c-17 0 -28 -8 -31 -25c-4 -23 2 -46 -5 -68c6 -2 12 -2 18 -2s8 1 9 -5c1 -11 5 -28 -4 -37c6 -4 11 -8 16 -13z" />
+ <glyph glyph-name="ion-ios-people" unicode="&#xf47c;"
+d="M317 113c11 -4 -11 4 0 0v0zM317 113c28 -10 46 -35 46 -65h-28h-250c0 22 9 42 27 55c15 11 31 12 49 16c7 1 24 5 26 13s1 15 1 23c0 3 0 3 -2 5c-4 4 -6 9 -8 14c-2 8 -3 16 -4 24c-9 -2 -10 16 -12 21c-1 4 -7 24 3 21c-3 5 -4 13 -5 19c-2 13 -2 26 3 39
+c10 26 37 39 64 38c26 -1 51 -16 59 -42c4 -12 3 -26 1 -39c-1 -5 -2 -11 -4 -15c10 3 4 -20 3 -23c-2 -5 -3 -21 -12 -19c-1 -10 -2 -22 -7 -31c-1 -2 -7 -8 -7 -10v-11c0 -5 0 -10 2 -15s10 -7 14 -8c14 -5 27 -5 41 -10zM111 126h2h-1h-1zM111 126c-9 -5 -17 -11 -24 -19
+c-1 -2 -6 -11 -7 -11h-25h-55c0 20 12 34 30 40c6 2 27 4 30 11c2 5 1 11 1 16c-10 -1 -24 1 -32 7c-2 2 3 9 4 12c1 4 2 7 3 11c1 9 1 19 1 28c0 16 -1 35 8 49c8 13 23 18 38 18c24 0 43 -13 47 -37c3 -16 1 -32 2 -48c0 -8 2 -16 5 -24c1 -2 5 -7 3 -9l-6 -3
+c-5 -2 -11 -3 -17 -4c-1 0 -8 0 -9 -1s0 -9 0 -11c0 -4 1 -6 5 -7c6 -2 19 -3 23 -8c2 -3 1 -5 -2 -5c-7 -1 -14 -2 -21 -5c2 1 2 2 -1 0c-8 -4 -4 -2 -1 0zM417 136c18 -6 31 -20 31 -40h-80c-2 8 -10 14 -16 19c-8 6 -18 13 -28 15c-3 1 -16 -1 -13 5c2 4 9 5 13 6
+s15 2 16 7c0 1 1 14 0 14c-6 0 -12 1 -18 2c-4 1 -7 2 -11 4c-6 3 -2 6 0 11c14 32 -10 88 32 105c15 6 34 5 48 -3c15 -9 20 -27 20 -44c0 -20 -4 -44 7 -62c2 -3 4 -4 0 -6c-2 -1 -4 -1 -6 -2l-12 -3s-9 -1 -13 -1c0 -4 -2 -13 1 -17c6 -7 21 -7 29 -10z" />
+ <glyph glyph-name="ion-ios-person-outline" unicode="&#xf47d;" horiz-adv-x="320"
+d="M106 246v0v0zM267 84c13 -5 53 -20 53 -52h-160h-160c0 32 40 47 53 52s31 6 43 9c7 2 17 5 20 9s1 41 1 41s-6 10 -9 18s-7 32 -7 32s-7 0 -9 12c-2 13 -6 17 -6 27c0 9 5 10 5 10v0s-4 13 -5 42c-1 34 25 68 74 68s75 -34 74 -68c-1 -29 -5 -42 -5 -42v0s5 -1 5 -10
+c0 -10 -3 -15 -6 -28c-2 -12 -9 -12 -9 -12s-4 -23 -7 -31s-9 -18 -9 -18s-2 -37 1 -41s13 -7 20 -9c12 -3 30 -4 43 -9zM160 48v0h137c-2 3 -4 6 -8 8c-7 5 -16 9 -27 13c-7 2 -17 4 -26 5c-6 1 -10 2 -15 3c-3 1 -21 5 -29 15c-4 5 -6 12 -6 32c0 10 1 20 1 20v4l2 4
+c1 2 6 9 8 15c2 5 5 19 6 28c0 0 0 -1 1 4s8 4 9 8s3 7 5 18s-5 12 -5 17c0 4 1 5 1 5v0c0 1 4 14 4 38c0 13 -5 26 -14 35c-11 11 -25 16 -44 16c-18 0 -34 -5 -45 -16c-9 -9 -13 -22 -13 -35c1 -24 4 -37 4 -38v0s1 -3 0 -6c-1 -5 -6 -5 -4 -16s4 -14 5 -18s8 -3 9 -8
+s1 -4 1 -4c1 -9 4 -23 6 -28c2 -6 6 -13 8 -15l2 -4v-4s1 -10 1 -20c0 -20 -2 -27 -6 -32c-8 -10 -26 -14 -29 -15c-5 -1 -10 -2 -16 -3c-9 -1 -18 -3 -25 -5c-11 -4 -20 -8 -27 -13c-4 -2 -6 -5 -8 -8h137z" />
+ <glyph glyph-name="ion-ios-person" unicode="&#xf47e;" horiz-adv-x="320"
+d="M267 84c13 -5 53 -20 53 -52h-160h-160c0 32 40 47 53 52s31 6 43 9c7 2 17 5 20 9s1 41 1 41s-6 10 -9 18s-7 32 -7 32s-7 0 -9 12c-2 13 -6 17 -6 27c0 9 5 10 5 10v0s-4 13 -5 42c-1 34 25 68 74 68s75 -34 74 -68c-1 -29 -5 -42 -5 -42v0s5 -1 5 -10
+c0 -10 -3 -15 -6 -28c-2 -12 -9 -12 -9 -12s-4 -23 -7 -31s-9 -18 -9 -18s-2 -37 1 -41s13 -7 20 -9c12 -3 30 -4 43 -9z" />
+ <glyph glyph-name="ion-ios-personadd-outline" unicode="&#xf47f;" horiz-adv-x="320"
+d="M320 295v-14h-25v-25h-14v25h-25v14h25v25h14v-25h25zM106 246v0v0zM267 84c13 -5 53 -20 53 -52h-160h-160c0 32 40 47 53 52s31 6 43 9c7 2 17 5 20 9s1 41 1 41s-6 10 -9 18s-7 32 -7 32s-7 0 -9 12c-2 13 -6 17 -6 27c0 9 5 10 5 10v0s-4 13 -5 42c-1 34 25 68 74 68
+s75 -34 74 -68c-1 -29 -5 -42 -5 -42v0s5 -1 5 -10c0 -10 -3 -15 -6 -28c-2 -12 -9 -12 -9 -12s-4 -23 -7 -31s-9 -18 -9 -18s-2 -37 1 -41s13 -7 20 -9c12 -3 30 -4 43 -9zM160 48v0h137c-2 3 -4 6 -8 8c-7 5 -16 9 -27 13c-7 2 -17 4 -26 5c-6 1 -10 2 -15 3
+c-3 1 -21 5 -29 15c-4 5 -6 12 -6 32c0 10 1 20 1 20v4l2 4c1 2 6 9 8 15c2 5 5 19 6 28c0 0 0 -1 1 4s8 4 9 8s3 7 5 18s-5 12 -5 17c0 4 1 5 1 5v0c0 1 4 14 4 38c0 13 -5 26 -14 35c-11 11 -25 16 -44 16c-18 0 -34 -5 -45 -16c-9 -9 -13 -22 -13 -35c1 -24 4 -37 4 -38
+v0s1 -3 0 -6c-1 -5 -6 -5 -4 -16s4 -14 5 -18s8 -3 9 -8s1 -4 1 -4c1 -9 4 -23 6 -28c2 -6 6 -13 8 -15l2 -4v-4s1 -10 1 -20c0 -20 -2 -27 -6 -32c-8 -10 -26 -14 -29 -15c-5 -1 -10 -2 -16 -3c-9 -1 -18 -3 -25 -5c-11 -4 -20 -8 -27 -13c-4 -2 -6 -5 -8 -8h137z" />
+ <glyph glyph-name="ion-ios-personadd" unicode="&#xf480;" horiz-adv-x="320"
+d="M320 295v-14h-25v-25h-14v25h-25v14h25v25h14v-25h25zM267 84c13 -5 53 -20 53 -52h-160h-160c0 32 40 47 53 52s31 6 43 9c7 2 17 5 20 9s1 41 1 41s-6 10 -9 18s-7 32 -7 32s-7 0 -9 12c-2 13 -6 17 -6 27c0 9 5 10 5 10v0s-4 13 -5 42c-1 34 25 68 74 68
+s75 -34 74 -68c-1 -29 -5 -42 -5 -42v0s5 -1 5 -10c0 -10 -3 -15 -6 -28c-2 -12 -9 -12 -9 -12s-4 -23 -7 -31s-9 -18 -9 -18s-2 -37 1 -41s13 -7 20 -9c12 -3 30 -4 43 -9z" />
+ <glyph glyph-name="ion-ios-photos-outline" unicode="&#xf481;"
+d="M64 320h384v-320h-384v320zM432 16v288h-352v-288h352zM0 384h384v-48h-16v32h-352v-288h32v-16h-48v320z" />
+ <glyph glyph-name="ion-ios-photos" unicode="&#xf482;"
+d="M64 320h384v-320h-384v320zM384 384v-48h-336v-272h-48v320h384z" />
+ <glyph glyph-name="ion-ios-pie-outline" unicode="&#xf483;"
+d="M256 367v0v-207v-12l-12 -4l-180 -45c6 -13 13 -25 21 -36c12 -16 25 -30 41 -42c33 -24 73 -37 114 -37c26 0 51 5 75 15c23 10 43 23 61 41s31 38 41 61c10 24 15 49 15 75c0 51 -20 100 -56 136c-32 32 -75 51 -120 55zM240 384v0c115 0 208 -93 208 -208
+s-93 -208 -208 -208c-92 0 -171 60 -198 143l198 49v224zM208 400c-31 -1 -60 -7 -85 -18c-24 -11 -44 -26 -61 -46c-29 -34 -46 -80 -46 -127v0v0c0 -13 3 -46 12 -70l180 46v215zM224 416v0v-244l-205 -52c-19 32 -19 89 -19 89c0 91 58 207 218 207h6z" />
+ <glyph glyph-name="ion-ios-pie" unicode="&#xf484;"
+d="M240 384v0c115 0 208 -93 208 -208s-93 -208 -208 -208c-92 0 -171 60 -198 143l198 49v224zM224 416v0v-244l-205 -52c-19 32 -19 89 -19 89c0 91 58 207 218 207h6z" />
+ <glyph glyph-name="ion-ios-pint-outline" unicode="&#xf485;" horiz-adv-x="224"
+d="M224 278c0 -98 -32 -101 -32 -181c0 -40 16 -71 16 -99c0 -27 -9 -30 -32 -30h-128c-23 0 -32 2 -32 29c0 28 16 60 16 100c0 80 -32 83 -32 181c0 21 1 89 19 125c4 9 13 13 32 13h122c19 0 28 -4 32 -13c18 -36 19 -104 19 -125zM34 396c-8 -16 -14 -43 -17 -76h190
+c-3 33 -9 60 -17 76c-1 2 -1 1 -2 2c-2 1 -6 2 -15 2h-122c-9 0 -13 -1 -15 -2c-1 -1 -1 0 -2 -2zM191 -15c0 1 1 5 1 13c0 11 -4 23 -7 37c-4 18 -9 39 -9 62c0 41 8 64 16 86c8 23 16 46 16 95c0 9 -1 18 -1 26h-190c0 -8 -1 -17 -1 -26c0 -49 8 -72 16 -95
+c8 -22 16 -45 16 -86c0 -23 -5 -44 -9 -62c-3 -14 -7 -26 -7 -37c0 -8 1 -12 1 -13c2 -1 7 -1 15 -1h128c8 0 13 0 15 1z" />
+ <glyph glyph-name="ion-ios-pint" unicode="&#xf486;" horiz-adv-x="224"
+d="M224 278c0 -98 -32 -101 -32 -181c0 -40 16 -71 16 -99c0 -27 -9 -30 -32 -30h-128c-23 0 -32 2 -32 29c0 28 16 60 16 100c0 80 -32 83 -32 181c0 21 1 89 19 125c4 9 13 13 32 13h122c19 0 28 -4 32 -13c18 -36 19 -104 19 -125zM34 396c-8 -16 -14 -43 -17 -76h190
+c-3 33 -9 60 -17 76c-1 2 -1 1 -2 2c-2 1 -6 2 -15 2h-122c-9 0 -13 -1 -15 -2c-1 -1 -1 0 -2 -2z" />
+ <glyph glyph-name="ion-ios-play-outline" unicode="&#xf487;" horiz-adv-x="256"
+d="M16 323v-262l210 131zM0 352v0l256 -160l-256 -160v320z" />
+ <glyph glyph-name="ion-ios-play" unicode="&#xf488;" horiz-adv-x="256"
+d="M0 352v0l256 -160l-256 -160v320z" />
+ <glyph glyph-name="ion-ios-plus-empty" unicode="&#xf489;" horiz-adv-x="256"
+d="M256 183h-120v-119h-17v119h-119v17h119v120h17v-120h120v-17z" />
+ <glyph glyph-name="ion-ios-plus-outline" unicode="&#xf48a;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM208 1c105 0 191 86 191 191s-86 191 -191 191s-191 -86 -191 -191s86 -191 191 -191zM216 320v-120h120v-17h-120v-119h-17v119h-119v17h119v120h17z" />
+ <glyph glyph-name="ion-ios-plus" unicode="&#xf48b;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM336 183v17h-120v120h-17v-120h-119v-17h119v-119h17v119h120z" />
+ <glyph glyph-name="ion-ios-pricetag-outline" unicode="&#xf48c;" horiz-adv-x="416"
+d="M416 416v-160l-256 -288l-160 160l256 288h160zM400 264v136h-136l-240 -272l136 -136zM320 288c-18 0 -32 14 -32 32s14 32 32 32s32 -14 32 -32s-14 -32 -32 -32zM320 336c-9 0 -16 -7 -16 -16s7 -16 16 -16s16 7 16 16s-7 16 -16 16z" />
+ <glyph glyph-name="ion-ios-pricetag" unicode="&#xf48d;" horiz-adv-x="416"
+d="M304 320c0 11 5 16 16 16s16 -5 16 -16s-5 -16 -16 -16s-16 5 -16 16zM256 416h160v-160l-256 -288l-160 160zM320 288c9 0 16 4 22 10s10 13 10 22s-4 16 -10 22s-13 10 -22 10s-16 -4 -22 -10s-10 -13 -10 -22s4 -16 10 -22s13 -10 22 -10z" />
+ <glyph glyph-name="ion-ios-pricetags-outline" unicode="&#xf48e;"
+d="M416 384h32v-144l-240 -272l-25 24l-23 -24l-160 160l256 288h160v-32zM160 -9l12 12l11 12l217 248v105v16v16h-137l-241 -272zM432 247v121h-16v-112l-221 -253l13 -12zM320 288c-18 0 -32 14 -32 32s14 32 32 32s32 -14 32 -32s-14 -32 -32 -32zM320 336
+c-9 0 -16 -7 -16 -16s7 -16 16 -16s16 7 16 16s-7 16 -16 16z" />
+ <glyph glyph-name="ion-ios-pricetags" unicode="&#xf48f;"
+d="M432 384h16v-144l-240 -272l-13 13l237 266v137zM256 416h160v-32v-16v-112l-221 -253l-12 -11l-23 -24l-160 160zM320 288c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM304 320c0 11 5 16 16 16s16 -5 16 -16s-5 -16 -16 -16s-16 5 -16 16z" />
+ <glyph glyph-name="ion-ios-printer-outline" unicode="&#xf490;" horiz-adv-x="416"
+d="M384 336c18 0 32 -13 32 -31v-159c0 -18 -14 -32 -32 -32h-48v-114h-256v114h-48c-18 0 -32 14 -32 32v159c0 18 14 31 32 31h32v48h288v-48h32zM80 368v-32h256v32h-256zM320 16v192h-224v-192h224zM400 146v159c0 9 -7 15 -16 15v0h-352c-9 0 -16 -6 -16 -15v-159
+c0 -9 7 -16 16 -16h48v94h256v-94h48c9 0 16 7 16 16z" />
+ <glyph glyph-name="ion-ios-printer" unicode="&#xf491;" horiz-adv-x="416"
+d="M80 0v224h256v-224h-256zM80 -0v224h256v-224h-256zM64 352v32h288v-32h-288zM385 336c18 0 31 -14 31 -31v-158c0 -17 -13 -34 -31 -34h-33v126h-288v-126h-31c-18 0 -33 17 -33 34v158c0 17 15 31 33 31h352z" />
+ <glyph glyph-name="ion-ios-pulse-strong" unicode="&#xf492;" horiz-adv-x="480"
+d="M432 175c27 0 48 -20 48 -47s-21 -49 -48 -49c-21 0 -38 13 -45 31h-51c-7 0 -13 4 -15 11l-16 47l-50 -173c-2 -7 -8 -11 -15 -11h-1c-7 0 -14 5 -15 12l-51 308l-45 -182c-2 -7 -9 -12 -16 -12h-112v32h99l61 245c2 7 8 13 16 13s15 -7 16 -14l52 -314l45 155
+c2 7 8 11 15 11v0c7 0 13 -4 15 -11l29 -85h38c6 19 25 33 46 33z" />
+ <glyph glyph-name="ion-ios-pulse" unicode="&#xf493;"
+d="M416 160c18 0 32 -14 32 -32s-14 -32 -32 -32c-15 0 -27 10 -31 23h-65c-3 0 -7 2 -8 5l-23 72l-57 -198c-1 -3 -4 -6 -8 -6v0c-4 0 -7 3 -8 7l-58 346l-54 -220c-1 -4 -4 -6 -8 -6h-96v16h90l62 251c1 4 4 6 8 6s7 -3 8 -7l58 -349l54 190c1 3 4 5 8 5s7 -2 8 -5l30 -91
+h59c3 14 16 25 31 25z" />
+ <glyph glyph-name="ion-ios-rainy-outline" unicode="&#xf494;" horiz-adv-x="288"
+d="M220 269c38 0 68 -33 68 -71c0 -29 -19 -56 -45 -66l-55 -80c-2 -2 -5 -4 -8 -4c-5 0 -8 3 -8 8c0 2 1 4 2 6l46 66v0h-35l-31 -44c-2 -2 -4 -4 -7 -4c-5 0 -9 3 -9 8c0 2 1 3 2 5l25 35h-37l-53 -76c-2 -2 -4 -4 -7 -4c-5 0 -9 3 -9 8c0 2 2 4 3 6l46 66h-36l-32 -44
+c-2 -2 -4 -4 -7 -4c-5 0 -8 3 -8 8c0 2 1 4 2 6l25 34c-29 2 -52 27 -52 56c0 28 22 58 50 60c0 3 -1 5 -1 8c0 46 31 84 82 84c45 0 73 -31 81 -68c3 0 5 1 8 1zM220 146c28 0 52 24 52 52s-24 54 -52 54h-6l-15 -2l-3 15c-3 14 -11 31 -23 40c-12 10 -26 14 -41 14
+c-36 0 -66 -31 -66 -67v-12v-10c-6 0 -12 -2 -14 -2c-20 -3 -35 -23 -35 -43c0 -10 4 -20 11 -27s16 -12 26 -12h124v0v0h42z" />
+ <glyph glyph-name="ion-ios-rainy" unicode="&#xf495;" horiz-adv-x="288"
+d="M220 269c38 0 68 -33 68 -71c0 -29 -19 -56 -45 -66l-55 -80c-2 -2 -5 -4 -8 -4c-5 0 -8 3 -8 8c0 2 1 4 2 6l46 66v0h-35l-31 -44c-2 -2 -4 -4 -7 -4c-5 0 -9 3 -9 8c0 2 1 3 2 5l25 35h-37l-53 -76c-2 -2 -4 -4 -7 -4c-5 0 -9 3 -9 8c0 2 2 4 3 6l46 66h-36l-32 -44
+c-2 -2 -4 -4 -7 -4c-5 0 -8 3 -8 8c0 2 1 4 2 6l25 34c-29 2 -52 27 -52 56c0 28 22 58 50 60c0 3 -1 5 -1 8c0 46 31 84 82 84c45 0 73 -31 81 -68c3 0 5 1 8 1z" />
+ <glyph glyph-name="ion-ios-recording-outline" unicode="&#xf496;" horiz-adv-x="480"
+d="M370 304c61 0 110 -50 110 -112s-49 -112 -110 -112h-260c-61 0 -110 50 -110 112s49 112 110 112s110 -50 110 -112c0 -40 -21 -75 -53 -95h146c-32 20 -53 55 -53 95c0 62 49 112 110 112zM16 192c0 -53 42 -95 94 -95s93 42 93 95s-41 95 -93 95s-94 -42 -94 -95z
+M370 97c52 0 94 42 94 95s-42 95 -94 95s-93 -42 -93 -95s41 -95 93 -95zM368 240c-26 0 -48 -22 -48 -48s22 -48 48 -48s48 22 48 48s-22 48 -48 48zM368 256v0c35 0 64 -29 64 -64s-29 -64 -64 -64s-64 29 -64 64s29 64 64 64zM112 240c-26 0 -48 -22 -48 -48
+s22 -48 48 -48s48 22 48 48s-22 48 -48 48zM112 256v0c35 0 64 -29 64 -64s-29 -64 -64 -64s-64 29 -64 64s29 64 64 64z" />
+ <glyph glyph-name="ion-ios-recording" unicode="&#xf497;" horiz-adv-x="480"
+d="M370 304c61 0 110 -50 110 -112s-49 -112 -110 -112h-260c-61 0 -110 50 -110 112s49 112 110 112s110 -50 110 -112c0 -40 -21 -76 -53 -95h146c-32 19 -53 55 -53 95c0 62 49 112 110 112zM112 128c35 0 64 29 64 64s-29 64 -64 64s-64 -29 -64 -64s29 -64 64 -64z
+M368 128c35 0 64 29 64 64s-29 64 -64 64s-64 -29 -64 -64s29 -64 64 -64zM368 240c26 0 48 -22 48 -48s-22 -48 -48 -48s-48 22 -48 48s22 48 48 48zM112 240c26 0 48 -22 48 -48s-22 -48 -48 -48s-48 22 -48 48s22 48 48 48z" />
+ <glyph glyph-name="ion-ios-redo-outline" unicode="&#xf498;" horiz-adv-x="384"
+d="M0 48v32c0 17 -3 83 49 136c35 36 80 53 143 56v80l192 -128l-192 -128v80c-40 -1 -63 -9 -87 -20c-31 -14 -55 -44 -75 -77l-20 -31h-10zM208 256c-201 0 -192 -169 -192 -169c48 81 101 105 192 105v-65l148 97l-148 97v-65z" />
+ <glyph glyph-name="ion-ios-redo" unicode="&#xf499;" horiz-adv-x="384"
+d="M0 48v32c0 17 -3 83 49 136c35 36 80 53 143 56v80l192 -128l-192 -128v80c-40 -1 -63 -9 -87 -20c-31 -14 -55 -44 -75 -77l-20 -31h-10z" />
+ <glyph glyph-name="ion-ios-refresh-empty" unicode="&#xf49a;" horiz-adv-x="256"
+d="M128 64c-71 0 -128 57 -128 128s57 128 128 128v44l96 -64l-96 -56v56c-60 0 -108 -48 -108 -108s48 -108 108 -108s108 48 108 108h20c0 -71 -57 -128 -128 -128z" />
+ <glyph glyph-name="ion-ios-refresh-outline" unicode="&#xf49b;" horiz-adv-x="416"
+d="M316 192v0h20c0 -71 -57 -128 -128 -128s-128 57 -128 128s57 128 128 128v44l96 -64l-96 -56v56c-60 0 -108 -48 -108 -108s48 -108 108 -108s108 48 108 108zM208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM208 1
+c105 0 191 86 191 191s-86 191 -191 191s-191 -86 -191 -191s86 -191 191 -191z" />
+ <glyph glyph-name="ion-ios-refresh" unicode="&#xf49c;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM208 64c71 0 128 57 128 128h-20c0 -60 -48 -108 -108 -108s-108 48 -108 108s48 108 108 108v-56l96 56l-96 64v-44c-71 0 -128 -57 -128 -128s57 -128 128 -128z" />
+ <glyph glyph-name="ion-ios-reload" unicode="&#xf49d;"
+d="M192 384c106 0 192 -86 192 -192l55 53l9 -9l-70 -68l-67 68l9 9l51 -52c0 98 -80 178 -179 178s-179 -80 -179 -179s80 -179 179 -179c79 0 146 50 170 121l12 -3c-26 -76 -97 -131 -182 -131c-106 0 -192 86 -192 192s86 192 192 192z" />
+ <glyph glyph-name="ion-ios-reverse-camera-outline" unicode="&#xf49e;" horiz-adv-x="384"
+d="M238 129l2 2l11 -12l-2 -2c-16 -14 -36 -21 -57 -21c-45 0 -82 36 -87 78h-30l38 50l39 -50h-31c5 -33 35 -62 71 -62c17 0 33 6 46 17zM252 249c16 -14 25 -37 27 -57h30l-38 -51l-39 51h31c-5 35 -35 64 -71 64c-17 0 -33 -6 -46 -17l-2 -2l-11 12l2 2
+c16 14 36 21 57 21c22 0 44 -8 60 -23zM354 288c18 0 30 -14 30 -31v-176c0 -17 -12 -33 -30 -33h-320c-18 0 -34 16 -34 33v176c0 17 16 31 34 31h13v16h34v-16h13c32 36 43 48 55 48h88c12 0 23 -12 55 -48h62zM368 81v176c0 9 -5 15 -14 15h-62h-6s-4 1 -6 3s-6 8 -9 11
+c-12 13 -21 24 -27 30c-5 5 -7 4 -7 4h-88s-1 0 -6 -4c-6 -5 -15 -14 -26 -27c-3 -4 -8 -11 -11 -14s-4 -3 -6 -3h-6h-60c-9 0 -18 -7 -18 -15v-176c0 -9 9 -17 18 -17h320c8 0 14 8 14 17z" />
+ <glyph glyph-name="ion-ios-reverse-camera" unicode="&#xf49f;" horiz-adv-x="384"
+d="M354 288c18 0 30 -14 30 -31v-176c0 -17 -12 -33 -30 -33h-320c-18 0 -34 16 -34 33v176c0 17 16 31 34 31h13v16h34v-16h13c32 36 43 48 55 48h88c12 0 23 -12 55 -48h62zM249 117l2 2l-11 12l-2 -2c-13 -11 -29 -17 -46 -17c-36 0 -66 29 -71 62h31l-39 50l-38 -50h30
+c5 -42 42 -78 87 -78c21 0 41 7 57 21zM271 141l38 51h-30c-2 20 -11 43 -27 57c-16 15 -38 23 -60 23c-21 0 -41 -7 -57 -21l-2 -2l11 -12l2 2c13 11 29 17 46 17c36 0 66 -29 71 -64h-31z" />
+ <glyph glyph-name="ion-ios-rewind-outline" unicode="&#xf4a0;"
+d="M432 293l-184 -101l184 -101v202zM208 292v0l-176 -100l176 -100v95v27v78zM224 320v0v-123l224 123v-256l-224 123v-123l-224 128z" />
+ <glyph glyph-name="ion-ios-rewind" unicode="&#xf4a1;"
+d="M224 320v0v-123l224 123v-256l-224 123v-123l-224 128z" />
+ <glyph glyph-name="ion-ios-rose-outline" unicode="&#xf4a2;" horiz-adv-x="320"
+d="M284 295c-4 -1 -9 -3 -13 -4c-37 -11 -71 -24 -103 -39c-17 -8 -24 -12 -44 -24l-7 -4c-31 -18 -50 -33 -63 -51c-15 -21 -22 -45 -22 -77c0 -16 3 -30 9 -44c6 -13 14 -26 25 -36c23 -21 55 -32 94 -32s71 11 94 32c11 10 19 23 25 36c6 14 9 28 9 44c0 20 -5 40 -11 60
+c-11 40 -23 83 7 139zM320 320v0c-77 -96 -16 -151 -16 -224s-56 -128 -144 -128s-144 55 -144 128s35 109 93 142c25 14 33 19 52 28c30 14 65 28 105 40c17 5 35 10 54 14zM38 325c14 -28 18 -57 19 -83c9 7 20 13 30 20c7 4 14 9 21 13c5 3 10 6 16 9c-5 4 -11 7 -17 11
+c-22 13 -48 23 -69 30zM0 352v0s66 -15 115 -43c15 -8 28 -18 37 -29c-12 -6 -24 -12 -36 -19c-7 -4 -14 -8 -20 -12c-25 -16 -44 -31 -57 -42c5 41 2 98 -39 145zM249 367c-8 -1 -20 -2 -35 -7c-25 -8 -47 -20 -64 -36c8 -6 15 -12 21 -18c29 12 65 26 95 34
+c-5 10 -12 20 -17 27zM256 384v0s26 -32 32 -55c-33 -8 -84 -25 -121 -42l-3 3c-9 11 -22 22 -39 32c52 60 131 62 131 62zM85 394c-6 -10 -10 -20 -14 -28c12 -4 22 -10 36 -17c4 5 9 10 14 14c-13 15 -27 25 -36 31zM80 416v0s35 -16 64 -56c-12 -9 -23 -20 -33 -31
+c-26 13 -40 21 -61 27c5 15 15 38 30 60z" />
+ <glyph glyph-name="ion-ios-rose" unicode="&#xf4a3;" horiz-adv-x="320"
+d="M320 320v0c-77 -96 -16 -151 -16 -224s-56 -128 -144 -128s-144 55 -144 128s35 109 93 142c25 14 33 19 52 28c30 14 65 28 105 40c17 5 35 10 54 14zM0 352v0s66 -15 115 -43c15 -8 28 -18 37 -29c-12 -6 -24 -12 -36 -19c-7 -4 -14 -8 -20 -12
+c-25 -16 -44 -31 -57 -42c5 41 2 98 -39 145zM256 384v0s26 -32 32 -55c-33 -8 -84 -25 -121 -42l-3 3c-9 11 -22 22 -39 32c52 60 131 62 131 62zM80 416v0s35 -16 64 -56c-12 -9 -23 -20 -33 -31c-26 13 -40 21 -61 27c5 15 15 38 30 60z" />
+ <glyph glyph-name="ion-ios-search-strong" unicode="&#xf4a4;" horiz-adv-x="384"
+d="M280 150l-4 -7l108 -109l-34 -34l-108 109l-7 -5c-24 -15 -53 -25 -83 -25c-84 0 -152 69 -152 153s68 152 152 152s152 -68 152 -152c0 -30 -9 -58 -24 -82zM237 317c-23 23 -53 35 -85 35s-62 -12 -85 -35s-35 -53 -35 -85s12 -62 35 -85s53 -35 85 -35s62 12 85 35
+s36 53 36 85s-13 62 -36 85z" />
+ <glyph glyph-name="ion-ios-search" unicode="&#xf4a5;" horiz-adv-x="384"
+d="M384 23l-23 -23l-113 113c-26 -21 -60 -33 -96 -33c-84 0 -152 68 -152 152s68 152 152 152s152 -68 152 -152c0 -36 -12 -69 -33 -95zM56 135c26 -26 60 -39 96 -39s70 14 96 40s40 60 40 96s-14 70 -40 96s-60 40 -96 40s-70 -14 -96 -40s-40 -60 -40 -96
+s14 -71 40 -97z" />
+ <glyph glyph-name="ion-ios-settings-strong" unicode="&#xf4a6;"
+d="M0 72h283c6 14 21 24 37 24s31 -10 37 -24h91v-32h-91c-6 -14 -21 -24 -37 -24s-31 10 -37 24h-283zM0 208h91c6 14 21 24 37 24s31 -10 37 -24h283v-32h-283c-6 -14 -21 -24 -37 -24s-31 10 -37 24h-91zM0 344h283c6 14 21 24 37 24s31 -10 37 -24h91v-32h-91
+c-6 -14 -21 -24 -37 -24s-31 10 -37 24h-283z" />
+ <glyph glyph-name="ion-ios-settings" unicode="&#xf4a7;"
+d="M320 344c-9 0 -16 -7 -16 -16s7 -16 16 -16s16 7 16 16s-7 16 -16 16zM320 360v0c18 0 32 -14 32 -32s-14 -32 -32 -32s-32 14 -32 32s14 32 32 32zM320 72c-9 0 -16 -7 -16 -16s7 -16 16 -16s16 7 16 16s-7 16 -16 16zM320 88v0c18 0 32 -14 32 -32s-14 -32 -32 -32
+s-32 14 -32 32s14 32 32 32zM128 208c-9 0 -16 -7 -16 -16s7 -16 16 -16s16 7 16 16s-7 16 -16 16zM128 224v0c18 0 32 -14 32 -32s-14 -32 -32 -32s-32 14 -32 32s14 32 32 32zM175 200h273v-16h-273c0 3 1 5 1 8s-1 5 -1 8zM80 192c0 -3 1 -5 1 -8h-81v16h81
+c0 -3 -1 -5 -1 -8zM367 64h81v-16h-81c0 3 1 5 1 8s-1 5 -1 8zM272 56c0 -3 1 -5 1 -8h-273v16h273c0 -3 -1 -5 -1 -8zM367 336h81v-16h-81c0 3 1 5 1 8s-1 5 -1 8zM273 336c0 -3 -1 -5 -1 -8s1 -5 1 -8h-273v16h273z" />
+ <glyph glyph-name="ion-ios-shuffle-strong" unicode="&#xf4a8;" horiz-adv-x="384"
+d="M301 296c-85 0 -119 -64 -152 -126c-1 -3 -3 -5 -4 -8l-1 -1c-2 -3 -2 -5 -4 -8c-21 -38 -43 -68 -68 -83c-15 -9 -34 -18 -72 -18v32c45 0 76 18 112 84c2 3 2 6 4 9h1c1 2 3 4 4 7c34 64 76 144 180 144h15l-52 43l21 25l99 -84l-99 -82l-21 24l51 42h-14zM285 154
+l99 -82l-99 -84l-21 25l52 43h-15c-78 0 -122 45 -153 95l18 33c29 -51 64 -96 135 -96h14l-51 42zM112 216c-36 66 -67 84 -112 84v32c38 0 57 -9 72 -18c25 -15 47 -44 67 -81c-7 -11 -13 -22 -19 -33c-1 2 -2 5 -3 7h-1c-2 3 -2 6 -4 9z" />
+ <glyph glyph-name="ion-ios-shuffle" unicode="&#xf4a9;" horiz-adv-x="384"
+d="M298 241l-10 12l62 51h-46c-93 0 -129 -75 -164 -139c-2 -3 -3 -6 -5 -9c-20 -37 -41 -61 -65 -75c-14 -8 -33 -17 -70 -17v16c48 0 83 14 121 84c2 3 3 6 5 9c35 65 75 147 178 147h46l-62 52l10 12l86 -72zM135 228c0 -1 1 -2 1 -3c-3 -5 -6 -11 -9 -16c0 1 -1 1 -1 2
+c-2 3 -3 6 -5 9c-38 70 -73 84 -121 84v16c37 0 56 -9 70 -17c24 -14 45 -38 65 -75zM298 143l86 -71l-86 -72l-10 12l62 52h-46c-76 0 -118 45 -149 95c1 2 2 5 3 7c2 3 4 7 6 10c30 -50 67 -96 140 -96h46l-62 51z" />
+ <glyph glyph-name="ion-ios-skipbackward-outline" unicode="&#xf4aa;" horiz-adv-x="320"
+d="M0 352h79v-142l241 142v-320l-241 142v-142h-79v320zM80 192l7 -4l217 -128v264v0l-217 -128zM16 336v-288h47v126v8v28v126h-47z" />
+ <glyph glyph-name="ion-ios-skipbackward" unicode="&#xf4ab;" horiz-adv-x="320"
+d="M0 352h79v-142l241 142v-320l-241 142v-142h-79v320z" />
+ <glyph glyph-name="ion-ios-skipforward-outline" unicode="&#xf4ac;" horiz-adv-x="320"
+d="M241 352h79v-320h-79v142l-241 -142v320l241 -142v142zM233 188l7 4l-7 4l-217 128v0v-264zM304 48v288h-47v-126v-28v-8v-126h47z" />
+ <glyph glyph-name="ion-ios-skipforward" unicode="&#xf4ad;" horiz-adv-x="320"
+d="M241 352h79v-320h-79v142l-241 -142v320l241 -142v142z" />
+ <glyph glyph-name="ion-ios-snowy" unicode="&#xf4ae;" horiz-adv-x="256"
+d="M252 131c4 -2 5 -7 3 -11s-7 -5 -11 -3l-29 17c-2 -8 -2 -16 0 -24c1 -4 -3 -9 -7 -10s-8 2 -9 6c-2 12 -3 24 1 36l-64 36v-73c11 -3 22 -8 31 -16c3 -3 4 -8 1 -11s-8 -4 -11 -1c-6 5 -13 10 -21 12v-33c0 -4 -4 -8 -8 -8s-8 4 -8 8v33c-8 -2 -15 -7 -21 -12
+c-3 -3 -8 -2 -11 1s-3 8 0 11c9 8 20 13 32 16v73l-65 -36c4 -12 4 -23 2 -35c-1 -4 -5 -8 -9 -7s-8 6 -7 10c2 8 2 16 0 24l-29 -17c-4 -2 -9 -1 -11 3s-1 9 3 11l29 16c-6 6 -13 10 -21 13c-4 1 -6 6 -5 10c2 4 6 6 10 5c12 -4 22 -11 30 -19l65 36l-65 37
+c-8 -9 -18 -15 -30 -19c-4 -1 -9 0 -10 4s1 10 5 11c8 3 15 6 21 12l-29 16c-4 2 -5 7 -3 11s7 5 11 3l29 -16c2 8 2 15 0 23c-1 4 3 9 7 10s8 -2 9 -6c2 -12 1 -25 -2 -36l65 -36v73c-12 3 -23 8 -32 16c-3 3 -3 8 0 11s8 4 11 1c6 -5 13 -10 21 -12v33c0 4 4 8 8 8
+s8 -4 8 -8v-33c8 2 15 7 21 12c3 3 8 2 11 -1s2 -8 -1 -11c-9 -8 -20 -13 -31 -16v-73l64 36c-3 11 -4 24 -2 36c1 4 6 7 10 6s7 -6 6 -10c-2 -8 -1 -15 1 -23l29 16c4 2 9 1 11 -3s1 -9 -3 -11l-29 -16c6 -6 13 -10 21 -13c4 -1 6 -6 5 -10s-6 -6 -10 -5
+c-12 4 -23 10 -31 19l-64 -36l64 -36c8 8 19 15 31 19c4 1 9 -1 10 -5s-1 -9 -5 -10c-8 -3 -15 -7 -21 -13z" />
+ <glyph glyph-name="ion-ios-speedometer-outline" unicode="&#xf4af;"
+d="M224 384c124 0 224 -100 224 -224c0 -57 -21 -108 -56 -148c-4 -4 -7 -8 -11 -12l-10 10l-1 2c-19 18 -41 33 -65 43c-26 11 -53 16 -81 16s-55 -5 -81 -16c-24 -10 -46 -25 -65 -43l-1 -2l-10 -10c-4 4 -7 8 -11 12c-35 40 -56 91 -56 148c0 124 100 224 224 224z
+M416 79c10 23 15 48 16 73h-32v16h32c-1 25 -6 50 -16 73c-9 22 -23 42 -39 60l-27 -27l-6 6l-5 5v0h-1l27 27c-18 17 -38 31 -60 40c-23 10 -48 15 -74 16v-38h-16v38c-25 -1 -49 -6 -72 -16c-22 -10 -43 -23 -61 -40l27 -27v0v0l-6 -6l-5 -5l-27 27
+c-16 -18 -30 -38 -39 -60c-10 -23 -15 -49 -16 -74h32v-16h-32c1 -25 6 -49 16 -72c9 -20 20 -39 35 -56c40 40 96 64 157 64s117 -24 157 -64c15 17 26 36 35 56zM336 273l2 -1l-75 -84c6 -8 9 -18 9 -28c0 -26 -22 -48 -48 -48c-10 0 -19 4 -27 9l-13 -12l-11 11l12 12
+c-6 8 -9 18 -9 28c0 26 22 48 48 48c10 0 19 -3 27 -8zM224 128c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32z" />
+ <glyph glyph-name="ion-ios-speedometer" unicode="&#xf4b0;"
+d="M385 169v-15h30c-1 -22 -6 -44 -15 -65c-8 -18 -19 -35 -32 -50c-39 37 -90 58 -144 58s-105 -21 -144 -58c-13 15 -24 32 -32 50c-9 21 -14 43 -15 65h28h1v16h-29c1 23 6 45 15 66c9 20 20 38 35 54l25 -24l10 10l1 1v0v0l-25 25c16 15 36 26 56 35c21 9 43 14 66 15
+v-34h14h1v34c23 -1 46 -6 67 -15s39 -20 55 -35l-24 -25l11 -11l25 25c15 -16 26 -35 35 -55c9 -21 14 -43 15 -66h-30v-1zM272 160c0 10 -3 20 -9 28l63 76l-2 1l-73 -65c-8 5 -17 8 -27 8c-26 0 -48 -22 -48 -48c0 -10 3 -20 9 -28l-12 -12l11 -11l13 12c8 -5 17 -9 27 -9
+c26 0 48 22 48 48zM224 384c124 0 224 -100 224 -224c0 -57 -21 -108 -56 -148c-4 -4 -7 -8 -11 -12h-23c-32 39 -80 64 -134 64s-102 -25 -134 -64h-23c-4 4 -7 8 -11 12c-35 40 -56 91 -56 148c0 124 100 224 224 224zM379 27c34 37 52 86 52 136c0 55 -22 106 -61 145
+s-91 60 -146 60s-107 -21 -146 -60s-61 -90 -61 -145c0 -50 18 -99 52 -136l10 -10l1 -1v1l9 9l1 1v0c17 17 38 30 60 39c24 10 48 15 74 15s50 -5 74 -15c22 -9 43 -22 60 -39v0l1 -1l9 -9v-1l1 1zM192 160c0 21 11 32 32 32s32 -11 32 -32s-11 -32 -32 -32s-32 11 -32 32z
+" />
+ <glyph glyph-name="ion-ios-star-half" unicode="&#xf4b1;"
+d="M140 143l-140 98h171l53 159l53 -159h171l-140 -98l54 -159l-138 99l-138 -99zM224 347v-244l107 -76l-43 122l108 75h-131z" />
+ <glyph glyph-name="ion-ios-star-outline" unicode="&#xf4b2;"
+d="M448 241l-140 -98l54 -159l-138 99l-138 -99l54 159l-140 98h171l53 159l53 -159h171zM331 27l-43 122l108 75h-131l-41 123l-41 -123h-131l108 -75l-43 -122l107 76z" />
+ <glyph glyph-name="ion-ios-star" unicode="&#xf4b3;"
+d="M448 241l-140 -98l54 -159l-138 99l-138 -99l54 159l-140 98h171l53 159l53 -159h171z" />
+ <glyph glyph-name="ion-ios-stopwatch-outline" unicode="&#xf4b4;" horiz-adv-x="384"
+d="M334 301c32 -35 50 -80 50 -128c0 -104 -86 -189 -192 -189s-192 85 -192 189c0 48 18 94 51 129l1 1h-18l-8 -8l-23 23l41 40l23 -22l-9 -9v-18c31 30 72 50 116 53h2v38h32v-38c43 -4 82 -21 113 -49l5 -5v19l-9 9l23 22l41 -40l-22 -23l-9 8h-18zM192 2
+c96 0 173 77 173 171s-77 171 -173 171c-95 0 -173 -77 -173 -171s77 -171 173 -171zM200 191c14 -4 24 -17 24 -31c0 -15 -10 -26 -24 -30l-8 -18v0l-8 18c-14 4 -24 15 -24 30c0 14 12 27 24 31v129h16v-129z" />
+ <glyph glyph-name="ion-ios-stopwatch" unicode="&#xf4b5;" horiz-adv-x="384"
+d="M334 301c32 -35 50 -80 50 -128c0 -104 -86 -189 -192 -189s-192 85 -192 189c0 48 18 94 51 129l1 1h-18l-8 -8l-23 23l41 40l23 -22l-9 -9v-18c31 30 72 50 116 53h2v38h32v-38c43 -4 82 -21 113 -49l5 -5v19l-9 9l23 22l41 -40l-22 -23l-9 8h-18zM200 130
+c14 4 24 15 24 30c0 14 -10 27 -24 31v129h-16v-129c-12 -4 -24 -17 -24 -31c0 -15 10 -26 24 -30l8 -18z" />
+ <glyph glyph-name="ion-ios-sunny-outline" unicode="&#xf4b6;" horiz-adv-x="320"
+d="M151 296v56h18v-56h-18zM151 32v60h18v-60h-18zM264 183v18h56v-18h-56zM0 183v18h60v-18h-60zM240 130l34 -34l-12 -12l-33 34zM64 306l34 -33l-12 -12l-34 34zM229 272l33 34l12 -12l-34 -33zM52 96l34 34l11 -12l-33 -34zM160 116c-42 0 -76 34 -76 76s34 76 76 76
+s76 -34 76 -76s-34 -76 -76 -76zM160 251c-32 0 -59 -27 -59 -59s27 -59 59 -59s59 27 59 59s-27 59 -59 59z" />
+ <glyph glyph-name="ion-ios-sunny" unicode="&#xf4b7;" horiz-adv-x="320"
+d="M151 296v56h18v-56h-18zM151 32v60h18v-60h-18zM264 183v18h56v-18h-56zM0 183v18h60v-18h-60zM240 130l34 -34l-12 -12l-33 34zM64 306l34 -33l-12 -12l-34 34zM229 272l33 34l12 -12l-34 -33zM52 96l34 34l11 -12l-33 -34zM160 116c-42 0 -76 34 -76 76s34 76 76 76
+s76 -34 76 -76s-34 -76 -76 -76z" />
+ <glyph glyph-name="ion-ios-telephone-outline" unicode="&#xf4b8;" horiz-adv-x="352"
+d="M336 112c16 -16 26 -35 0 -66c-25 -30 -42 -30 -64 -30c-24 0 -58 14 -93 40c-32 23 -46 34 -78 67c-34 35 -55 64 -79 107c-27 50 -24 74 -18 92c4 12 14 24 28 33l1 1c6 4 18 12 32 12c13 0 24 -6 34 -18l1 -1c11 -14 24 -31 32 -47c10 -21 10 -38 -1 -53
+c-9 -12 -12 -19 -12 -23s5 -9 13 -18l1 -1c16 -18 20 -23 26 -29c1 -1 3 -2 4 -3l2 -2c7 -7 11 -12 29 -28l1 -1c7 -6 9 -8 12 -8c5 0 16 7 29 15c4 3 11 5 17 5c27 0 68 -29 83 -44zM324 57c19 22 13 31 1 43c-13 14 -50 39 -72 39c-3 0 -6 -1 -8 -2
+c-19 -12 -28 -18 -37 -18s-15 6 -23 13h-1c-19 16 -23 21 -30 29l-2 2c-1 1 -3 2 -4 3c-6 6 -11 12 -27 30v1c-10 11 -17 18 -18 28s5 20 16 34c15 20 -5 48 -31 79l-1 1c-7 8 -14 12 -22 12c-10 0 -18 -6 -23 -9c-1 0 -2 -1 -2 -1c-11 -7 -18 -16 -21 -24
+c-5 -16 -7 -35 17 -79c23 -42 43 -70 76 -104c31 -32 45 -42 76 -64c32 -23 64 -38 84 -38c21 0 32 1 52 25z" />
+ <glyph glyph-name="ion-ios-telephone" unicode="&#xf4b9;" horiz-adv-x="352"
+d="M336 112c16 -16 26 -35 0 -66c-25 -30 -42 -30 -64 -30c-24 0 -58 14 -93 40c-32 23 -46 34 -78 67c-34 35 -55 64 -79 107c-27 50 -24 74 -18 92c4 12 14 24 28 33l1 1c6 4 18 12 32 12c13 0 24 -6 34 -18l1 -1c11 -14 24 -31 32 -47c10 -21 10 -38 -1 -53
+c-9 -12 -12 -19 -12 -23s5 -9 13 -18l1 -1c16 -18 20 -23 26 -29c1 -1 3 -2 4 -3l2 -2c7 -7 11 -12 29 -28l1 -1c7 -6 9 -8 12 -8c5 0 16 7 29 15c4 3 11 5 17 5c27 0 68 -29 83 -44z" />
+ <glyph glyph-name="ion-ios-tennisball-outline" unicode="&#xf4ba;" horiz-adv-x="416"
+d="M416 192v-8v0c0 -5 0 -11 -1 -16v0c-11 -97 -90 -174 -187 -183v0h-4h-2s-1 -1 -2 -1h-3h-1h-8c-115 0 -208 93 -208 208s93 208 208 208s208 -93 208 -208zM399 192c0 105 -86 191 -191 191c-3 0 -5 -1 -8 -1c1 -24 6 -46 15 -68c10 -26 26 -49 46 -69s43 -36 69 -46
+c22 -9 44 -14 68 -15c0 3 1 5 1 8zM17 192c0 -105 86 -191 191 -191h4c-1 22 -7 45 -15 66c-10 26 -26 48 -46 68s-42 36 -68 46c-21 8 -44 14 -66 15v-4zM228 2c88 9 158 78 169 166c-54 3 -106 25 -147 66s-63 93 -66 147c-88 -11 -157 -81 -166 -169
+c53 -3 105 -25 145 -65s62 -92 65 -145z" />
+ <glyph glyph-name="ion-ios-tennisball" unicode="&#xf4bb;" horiz-adv-x="416"
+d="M0 196v0v0v0zM212 -16h1h-1v0zM208 400c115 0 208 -93 208 -208c0 -8 0 -16 -1 -24v0v0c-11 -97 -90 -174 -187 -183v0v0c-6 -1 -13 -1 -20 -1c-115 0 -208 93 -208 208v4v0v0c0 6 0 11 1 16v0v0c9 97 86 176 183 187v0v0c6 1 11 1 16 1v0v0h8zM83 181
+c26 -10 48 -26 68 -46s36 -42 46 -68c8 -21 14 -44 15 -66c5 0 11 0 16 1c-3 53 -25 105 -65 145s-92 62 -145 65c-1 -5 -1 -11 -1 -16c22 -1 45 -7 66 -15zM250 234c41 -41 93 -63 147 -66c1 5 1 11 1 16c-24 1 -46 6 -68 15c-26 10 -49 26 -69 46s-36 43 -46 69
+c-9 22 -14 44 -15 68c-5 0 -11 0 -16 -1c3 -54 25 -106 66 -147z" />
+ <glyph glyph-name="ion-ios-thunderstorm-outline" unicode="&#xf4bc;" horiz-adv-x="274"
+d="M193 176l-88 -128l29 96h-52l15 80h72l-16 -48h40zM209 275c36 0 65 -29 65 -65s-29 -66 -65 -66h-8v17h8c27 0 49 22 49 49s-22 50 -49 50h-6l-14 -2l-3 14c-3 14 -11 26 -22 35s-25 13 -39 13c-34 0 -63 -27 -63 -62v-12s1 -9 1 -9c-5 0 -12 -2 -14 -2
+c-19 -3 -33 -18 -33 -37c0 -10 3 -19 10 -26s16 -11 26 -11h11v-17h-11c-28 0 -52 24 -52 53c0 27 21 51 47 53v8c0 43 35 78 78 78c37 0 68 -26 76 -61h8z" />
+ <glyph glyph-name="ion-ios-thunderstorm" unicode="&#xf4bd;" horiz-adv-x="274"
+d="M153 176h40l-22 -32l-66 -96l29 96h-52l15 80h72zM84 240h107l-16 -48h18h30l-33 -48h19c36 0 65 30 65 66s-29 65 -65 65h-8c-8 35 -39 61 -76 61c-43 0 -78 -35 -78 -78v-8c-26 -2 -47 -26 -47 -53c0 -29 24 -53 52 -53h14z" />
+ <glyph glyph-name="ion-ios-time-outline" unicode="&#xf4be;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM371 45c19 19 35 41 45 66c11 26 16 53 16 81s-5 55 -16 81c-10 25 -26 47 -45 66s-41 35 -66 45c-26 11 -53 16 -81 16s-55 -5 -81 -16c-25 -10 -47 -26 -66 -45
+s-35 -41 -45 -66c-11 -26 -16 -53 -16 -81s5 -55 16 -81c10 -25 26 -47 45 -66s41 -35 66 -45c26 -11 53 -16 81 -16s55 5 81 16c25 10 47 26 66 45zM216 368c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8s-8 3 -8 8zM216 16c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8s-8 3 -8 8zM392 192
+c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8s-8 3 -8 8zM40 192c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8s-8 3 -8 8zM128 344c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8s-8 3 -8 8zM304 40c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8s-8 3 -8 8zM368 280c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8s-8 3 -8 8
+zM64 104c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8s-8 3 -8 8zM64 280c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8s-8 3 -8 8zM368 104c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8s-8 3 -8 8zM304 344c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8s-8 3 -8 8zM128 40c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8
+s-8 3 -8 8zM238 200c4 -8 2 -18 -6 -22v-122c0 -4 -4 -8 -8 -8s-8 4 -8 8v122c-2 1 -4 4 -6 6c-3 5 -3 11 0 16l-37 63c-2 4 -1 9 3 11s8 1 10 -3l38 -63c5 0 11 -3 14 -8z" />
+ <glyph glyph-name="ion-ios-time" unicode="&#xf4bf;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM224 376c-4 0 -8 -4 -8 -8s4 -8 8 -8s8 4 8 8s-4 8 -8 8zM48 184c4 0 8 4 8 8s-4 8 -8 8s-8 -4 -8 -8s4 -8 8 -8zM76 97c4 2 4 7 2 11s-6 5 -10 3s-5 -7 -3 -11s7 -5 11 -3z
+M78 276c2 4 2 9 -2 11s-9 1 -11 -3s-1 -9 3 -11s8 -1 10 3zM132 351c-4 -2 -5 -7 -3 -11s7 -4 11 -2s5 6 3 10s-7 5 -11 3zM143 36c2 4 1 8 -3 10s-9 2 -11 -2s-1 -9 3 -11s9 -1 11 3zM224 8c4 0 8 4 8 8s-4 8 -8 8s-8 -4 -8 -8s4 -8 8 -8zM232 178c8 4 10 14 6 22
+c-3 5 -9 8 -14 8l-38 64c-2 4 -7 4 -11 2s-4 -7 -2 -11l37 -63c-3 -5 -3 -11 0 -16c2 -2 4 -5 6 -6v-122c0 -4 4 -8 8 -8s8 4 8 8v122zM316 33c4 2 5 7 3 11s-7 4 -11 2s-5 -6 -3 -10s7 -5 11 -3zM319 340c2 4 1 9 -3 11s-9 1 -11 -3s-1 -8 3 -10s9 -2 11 2zM383 100
+c2 4 1 9 -3 11s-8 1 -10 -3s-2 -9 2 -11s9 -1 11 3zM380 273c4 2 5 7 3 11s-7 5 -11 3s-4 -7 -2 -11s6 -5 10 -3zM400 184c4 0 8 4 8 8s-4 8 -8 8s-8 -4 -8 -8s4 -8 8 -8z" />
+ <glyph glyph-name="ion-ios-timer-outline" unicode="&#xf4c0;" horiz-adv-x="416"
+d="M189 176l-1 2s-89 118 -86 120s121 -85 121 -85c1 -1 1 -2 2 -3c5 -5 8 -11 8 -18c0 -14 -11 -25 -25 -25c-8 0 -14 3 -19 9zM208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208c0 57 23 109 61 147l12 -12c-35 -35 -56 -82 -56 -135
+c0 -106 85 -191 191 -191s191 85 191 191c0 100 -77 183 -175 191v-95h-16v112v0v0z" />
+ <glyph glyph-name="ion-ios-timer" unicode="&#xf4c1;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208s-208 93 -208 208s93 208 208 208zM102 298c-2 -2 86 -120 86 -120l1 -1c5 -6 11 -10 19 -10c14 0 25 11 25 25c0 7 -3 13 -8 18l-3 3c0 0 -117 87 -120 85zM208 1c106 0 192 85 192 191s-86 192 -192 192v-96h16v78
+c88 -9 158 -84 158 -174c0 -96 -78 -174 -174 -174s-175 78 -175 174c0 48 19 92 51 124l-11 12c-35 -35 -56 -83 -56 -136c0 -106 85 -191 191 -191z" />
+ <glyph glyph-name="ion-ios-toggle-outline" unicode="&#xf4c2;"
+d="M96 128c-26 0 -48 -22 -48 -48s22 -48 48 -48s48 22 48 48s-22 48 -48 48zM96 144v0c35 0 64 -29 64 -64s-29 -64 -64 -64s-64 29 -64 64s29 64 64 64zM351 160v0h-255c-44 0 -80 -36 -80 -80s36 -80 80 -80h256c44 0 80 36 80 80s-37 80 -81 80zM352 176v0
+c53 0 96 -43 96 -96s-43 -96 -96 -96h-256c-53 0 -96 43 -96 96s43 96 96 96h256zM352 352c-26 0 -48 -22 -48 -48s22 -48 48 -48s48 22 48 48s-22 48 -48 48zM352 368v0c35 0 64 -29 64 -64s-29 -64 -64 -64s-64 29 -64 64s29 64 64 64zM97 384v0c-44 0 -81 -36 -81 -80
+s36 -80 80 -80h256c44 0 80 36 80 80s-36 80 -80 80h-255zM96 400v0h256c53 0 96 -43 96 -96s-43 -96 -96 -96h-256c-53 0 -96 43 -96 96s43 96 96 96z" />
+ <glyph glyph-name="ion-ios-toggle" unicode="&#xf4c3;"
+d="M96 128c26 0 48 -22 48 -48s-22 -48 -48 -48s-48 22 -48 48s22 48 48 48zM352 176c53 0 96 -43 96 -96s-43 -96 -96 -96h-256c-53 0 -96 43 -96 96s43 96 96 96h256zM96 16c35 0 64 29 64 64s-29 64 -64 64s-64 -29 -64 -64s29 -64 64 -64zM352 256c-26 0 -48 22 -48 48
+s22 48 48 48s48 -22 48 -48s-22 -48 -48 -48zM96 208c-53 0 -96 43 -96 96s43 96 96 96h256c53 0 96 -43 96 -96s-43 -96 -96 -96h-256zM352 368c-35 0 -64 -29 -64 -64s29 -64 64 -64s64 29 64 64s-29 64 -64 64z" />
+ <glyph glyph-name="ion-ios-trash-outline" unicode="&#xf4c4;" horiz-adv-x="288"
+d="M288 335v-15h-20l-24 -291c0 -16 -13 -29 -29 -29h-141c-16 0 -29 13 -29 29l-24 291h-21v15h80v20c0 16 13 29 29 29h70c16 0 29 -13 29 -29v-20h80zM95 355v-20h98v20c0 8 -6 14 -14 14h-70c-8 0 -14 -6 -14 -14zM230 30l23 290h-217l23 -290v0v-1c0 -8 7 -14 15 -14
+h141c8 0 15 6 15 14v1v0zM137 47v241h14v-241h-14zM208 288l-11 -241h-14l10 241h15zM94 288l11 -241h-14l-11 241h14z" />
+ <glyph glyph-name="ion-ios-trash" unicode="&#xf4c5;" horiz-adv-x="288"
+d="M208 335h80v-15h-20l-24 -291c0 -16 -13 -29 -29 -29h-141c-16 0 -29 13 -29 29l-24 291h-21v15h80v20c0 16 13 29 29 29h70c16 0 29 -13 29 -29v-20zM95 355v0v-20h98v20c0 8 -6 14 -14 14h-70c-8 0 -14 -6 -14 -14zM91 47h14l-11 241h-14zM151 47v241h-14v-241h14z
+M197 47l11 241h-14l-11 -241h14z" />
+ <glyph glyph-name="ion-ios-undo-outline" unicode="&#xf4c6;" horiz-adv-x="384"
+d="M384 80v-32h-10l-20 31c-20 33 -44 63 -75 77c-24 11 -47 19 -87 20v-80l-192 128l192 128v-80c63 -3 108 -21 143 -56c52 -53 49 -119 49 -136zM368 87c0 0 9 169 -192 169v65l-148 -97l148 -97v65c91 0 144 -24 192 -105z" />
+ <glyph glyph-name="ion-ios-undo" unicode="&#xf4c7;" horiz-adv-x="384"
+d="M384 80v-32h-10l-20 31c-20 33 -44 63 -75 77c-24 11 -47 19 -87 20v-80l-192 128l192 128v-80c63 -3 108 -21 143 -56c52 -53 49 -119 49 -136z" />
+ <glyph glyph-name="ion-ios-unlocked-outline" unicode="&#xf4c8;" horiz-adv-x="320"
+d="M160 160c18 0 32 -14 32 -32c0 -15 -10 -27 -24 -31v-33h-16v33c-14 4 -24 16 -24 31c0 18 14 32 32 32zM160 112c9 0 16 7 16 16s-7 16 -16 16s-16 -7 -16 -16s7 -16 16 -16zM72 224h248v-240h-320v240h56v72c0 57 47 104 104 104s104 -47 104 -104v-8h-16v8
+c0 49 -39 88 -88 88s-88 -39 -88 -88v-72zM304 0v208h-288v-208h288z" />
+ <glyph glyph-name="ion-ios-unlocked" unicode="&#xf4c9;" horiz-adv-x="320"
+d="M160 144c9 0 16 -7 16 -16s-7 -16 -16 -16s-16 7 -16 16s7 16 16 16zM72 224h248v-240h-320v240h56v72c0 57 47 104 104 104s104 -47 104 -104v-8h-16v8c0 49 -39 88 -88 88s-88 -39 -88 -88v-72zM168 97c14 4 24 16 24 31c0 18 -14 32 -32 32s-32 -14 -32 -32
+c0 -15 10 -27 24 -31v-33h16v33z" />
+ <glyph glyph-name="ion-ios-upload-outline" unicode="&#xf4ca;" horiz-adv-x="320"
+d="M192 304h128v-304h-320v304h128v-16h-112v-272h288v272h-112v16zM97 330l-11 12l74 74l74 -74l-11 -12l-55 55v-243h-16v243z" />
+ <glyph glyph-name="ion-ios-upload" unicode="&#xf4cb;" horiz-adv-x="320"
+d="M168 304h152v-304h-320v304h152v-162h16v162zM168 385v-81h-16v81l-55 -55l-11 12l74 74l74 -74l-11 -12z" />
+ <glyph glyph-name="ion-ios-videocam-outline" unicode="&#xf4cc;" horiz-adv-x="418"
+d="M257 320c19 0 33 -14 33 -33v-188c0 -19 -14 -35 -33 -35h-221c-19 0 -36 16 -36 35v188c0 19 17 33 36 33h221zM273 99v188c0 9 -8 16 -17 16h-221c-9 0 -18 -7 -18 -16v-188c0 -9 10 -18 19 -18h221c9 0 16 9 16 18zM320 235l98 53v-192l-98 53v86zM401 258v0l-64 -33
+v-66l64 -33v132z" />
+ <glyph glyph-name="ion-ios-videocam" unicode="&#xf4cd;" horiz-adv-x="418"
+d="M257 320c19 0 33 -14 33 -33v-188c0 -19 -14 -35 -33 -35h-221c-19 0 -36 16 -36 35v188c0 19 17 33 36 33h221zM320 235l98 53v-192l-98 53v86z" />
+ <glyph glyph-name="ion-ios-volume-high" unicode="&#xf4ce;" horiz-adv-x="320"
+d="M278 320c26 -36 42 -80 42 -128s-16 -92 -42 -128l-14 10c24 33 39 74 39 118s-15 85 -39 118zM224 96l-14 10c18 24 29 54 29 86s-11 62 -29 86l14 10c20 -27 32 -60 32 -96s-12 -69 -32 -96zM177 128l-13 10c12 15 18 34 18 54s-6 39 -18 54l13 10
+c14 -18 22 -40 22 -64s-8 -46 -22 -64zM58 232l70 56v-192l-70 56h-58v80h58z" />
+ <glyph glyph-name="ion-ios-volume-low" unicode="&#xf4cf;" horiz-adv-x="128"
+d="M58 232l70 56v-192l-70 56h-58v80h58z" />
+ <glyph glyph-name="ion-ios-wineglass-outline" unicode="&#xf4d0;" horiz-adv-x="192"
+d="M104 139v-155h72v-16h-80h-80v16h72v155c0 22 -20 39 -40 55c-8 6 -16 13 -22 19c-27 28 -26 52 -26 71v4c0 44 31 125 32 128h64h64c1 -3 32 -84 32 -128v-4c0 -19 1 -43 -26 -71c-6 -6 -14 -13 -22 -19c-20 -16 -40 -33 -40 -55zM43 400c-5 -16 -20 -63 -25 -96h156
+c-5 33 -20 80 -25 96h-53h-53zM96 175c3 0 5 0 7 2v0c9 11 20 20 31 29c8 6 15 12 20 18c22 23 22 41 22 60v4h-160v-4c0 -19 0 -37 22 -60c5 -6 12 -12 20 -18c11 -9 22 -18 31 -29v0c2 -2 4 -2 7 -2z" />
+ <glyph glyph-name="ion-ios-wineglass" unicode="&#xf4d1;" horiz-adv-x="192"
+d="M104 139v-155h72v-16h-80h-80v16h72v155c0 22 -20 39 -40 55c-8 6 -16 13 -22 19c-27 28 -26 52 -26 71v4c0 44 31 125 32 128h64h64c1 -3 32 -84 32 -128v-4c0 -19 1 -43 -26 -71c-6 -6 -14 -13 -22 -19c-20 -16 -40 -33 -40 -55zM43 400c-5 -16 -20 -63 -25 -96h156
+c-5 33 -20 80 -25 96h-53h-53z" />
+ <glyph glyph-name="ion-ios-world-outline" unicode="&#xf4d2;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208v0v0v0c-115 0 -208 93 -208 208s93 208 208 208v0v0v0zM216 276v-76h75c-1 31 -5 60 -11 84c-21 -5 -42 -7 -64 -8zM216 292c20 1 41 3 60 8c-14 46 -38 76 -60 82v-90zM200 382c-23 -6 -45 -36 -60 -82
+c19 -5 39 -7 60 -8v90zM200 276c-22 1 -44 3 -65 8c-6 -24 -10 -53 -11 -84h76v76zM108 200c1 32 4 62 11 88c-21 6 -41 15 -59 25c-26 -31 -41 -70 -43 -113h91zM108 184h-91c2 -43 17 -82 43 -113c19 10 38 19 59 25c-7 26 -10 56 -11 88zM124 184c1 -31 5 -60 11 -84
+c21 5 43 8 65 9v75h-76zM200 92c-21 -1 -41 -3 -60 -8c15 -46 37 -76 60 -82v90zM216 2c22 6 46 36 60 82c-19 5 -40 7 -60 8v-90zM216 109c22 -1 43 -4 64 -9c6 24 10 53 11 84h-75v-75zM308 184c-1 -32 -5 -62 -12 -88c21 -6 41 -15 60 -25c26 31 41 70 43 113h-91z
+M308 200v0h91c-2 43 -17 82 -43 113c-19 -10 -38 -19 -59 -25c7 -26 10 -56 11 -88zM344 326c-25 25 -56 44 -91 52c16 -17 29 -43 39 -74c18 6 35 13 52 22zM163 378c-35 -8 -67 -27 -91 -52c16 -9 34 -15 52 -21c10 31 23 56 39 73zM72 58c25 -25 56 -44 91 -52
+c-16 17 -30 43 -40 74c-18 -6 -35 -13 -51 -22zM253 6c35 8 66 27 91 52c-17 9 -34 16 -52 22c-10 -31 -23 -57 -39 -74z" />
+ <glyph glyph-name="ion-ios-world" unicode="&#xf4d3;" horiz-adv-x="416"
+d="M208 400c115 0 208 -93 208 -208s-93 -208 -208 -208v0v0v0c-115 0 -208 93 -208 208s93 208 208 208v0v0v0zM208 1c106 0 191 85 191 191s-85 191 -191 191v0v0v0c-106 0 -191 -85 -191 -191s86 -191 191 -191v0v0v0zM274 276c6 -22 9 -48 10 -76h-68v68c20 1 39 4 58 8
+zM216 366c20 -6 41 -34 54 -75c-17 -4 -36 -6 -54 -7v82zM145 291c13 42 35 69 55 75v-82c-19 1 -37 3 -55 7zM333 315c-15 -8 -31 -15 -48 -20c-9 29 -21 52 -36 67c32 -8 61 -24 84 -47zM299 200c-1 29 -4 56 -10 80c19 6 37 14 54 23c23 -28 38 -64 40 -103h-84zM132 200
+c1 28 3 54 9 76c19 -5 39 -7 59 -8v-68h-68zM284 184c-1 -28 -4 -54 -10 -76c-19 5 -38 7 -58 8v68h68zM141 108c-6 22 -8 48 -9 76h68v-68c-20 -1 -40 -3 -59 -8zM200 18c-20 6 -42 33 -55 75c18 4 36 6 55 7v-82zM249 22c15 15 27 38 36 67c17 -5 33 -11 48 -19
+c-23 -23 -52 -40 -84 -48zM167 362c-15 -15 -27 -39 -36 -67c-16 5 -33 11 -48 19c22 23 52 40 84 48zM289 104c6 24 9 51 10 80h84c-2 -39 -17 -75 -40 -103c-17 9 -35 17 -54 23zM216 100c18 -1 37 -3 54 -7c-13 -42 -34 -69 -54 -75v82zM127 280c-6 -24 -11 -51 -11 -80
+h-83c2 39 17 75 40 103c17 -9 35 -17 54 -23zM116 184c1 -29 4 -56 10 -80c-19 -6 -36 -14 -53 -23c-23 28 -38 64 -40 103h83zM83 70c15 8 32 14 48 19c9 -28 21 -52 36 -67c-32 8 -62 25 -84 48z" />
+ <glyph glyph-name="ion-ipad" unicode="&#xf1f9;" horiz-adv-x="288"
+d="M0 375c0 5 4 9 9 9h270c5 0 9 -4 9 -9v-366c0 -5 -4 -9 -9 -9h-270c-5 0 -9 4 -9 9v366zM144 10c8 0 14 6 14 14s-7 14 -14 14c-8 0 -14 -6 -14 -14s6 -14 14 -14zM32 329v-275c0 -4 3 -6 6 -6h211c3 0 7 2 7 6v275c0 4 -4 7 -7 7h-211c-3 0 -6 -3 -6 -7z" />
+ <glyph glyph-name="ion-iphone" unicode="&#xf1fa;" horiz-adv-x="192"
+d="M168 384c13 0 24 -11 24 -24v-336c0 -13 -11 -24 -24 -24h-144c-13 0 -24 11 -24 24v336c0 13 11 24 24 24h144zM80 348v0c0 -2 2 -4 4 -4h24c2 0 4 2 4 4v0c0 2 -2 4 -4 4h-24c-2 0 -4 -2 -4 -4zM68 352c-2 0 -4 -2 -4 -4s2 -4 4 -4s4 2 4 4s-2 4 -4 4zM96 16
+c9 0 16 7 16 16s-7 16 -16 16s-16 -7 -16 -16s7 -16 16 -16zM176 64v256h-160v-256h160z" />
+ <glyph glyph-name="ion-ipod" unicode="&#xf1fb;" horiz-adv-x="224"
+d="M112 137c18 0 32 -14 32 -32s-14 -32 -32 -32s-32 14 -32 32s14 32 32 32zM196 384c15 0 28 -12 28 -28v-328c0 -16 -13 -28 -28 -28h-168c-15 0 -28 12 -28 28v328c0 16 13 28 28 28h168zM112 32c40 0 72 32 72 72s-32 72 -72 72s-72 -32 -72 -72s32 -72 72 -72z
+M192 221v118c-1 7 -6 12 -12 13h-136c-7 -1 -12 -7 -12 -15v-114c0 -8 6 -15 14 -15h131c8 0 14 5 15 13z" />
+ <glyph glyph-name="ion-jet" unicode="&#xf295;" horiz-adv-x="326"
+d="M222 80l-2 -13l53 -58l-18 -27l-74 9l-18 -55l-19 55l-73 -9l-18 27l53 58l-2 13l-104 -35l3 53l114 103s26 173 28 192c5 40 18 55 18 55s13 -15 18 -55c2 -19 28 -192 28 -192l114 -103l3 -53z" />
+ <glyph glyph-name="ion-key" unicode="&#xf296;" horiz-adv-x="192"
+d="M144 147c28 -17 48 -48 48 -83c0 -53 -43 -96 -96 -96s-96 43 -96 96c0 36 19 67 48 84c0 0 7 16 12 41c0 4 11 6 11 12v20c0 5 -7 9 -7 11v8v8c0 2 0 4 1 6c0 1 1 1 1 2l2 1l4 4v1c2 2 3 4 3 6c0 1 1 8 1 9c0 3 -2 6 -4 8l-1 1l-4 4v0l-1 1v0c-2 2 -3 5 -3 8v7
+c0 3 2 7 4 9v0l5 5v0c2 2 4 3 4 6v24c0 3 -2 6 -4 8v1l-4 4l-1 1c-2 2 -3 5 -3 8v18c0 11 0 19 9 23c3 1 14 3 23 3c20 0 30 -8 32 -36c0 0 7 -81 9 -143s7 -90 7 -90zM96 0c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32z" />
+ <glyph glyph-name="ion-knife" unicode="&#xf297;" horiz-adv-x="64"
+d="M62 416c2 0 2 -1 2 -6v-412c0 -15 -10 -30 -24 -30v0v0c-14 0 -24 15 -24 30c1 19 14 83 16 130v0c1 30 -32 31 -32 70c0 134 35 191 54 214c2 2 5 4 8 4z" />
+ <glyph glyph-name="ion-laptop" unicode="&#xf1fc;" horiz-adv-x="512"
+d="M480 342v-262h-448v262c0 6 4 10 10 10h428c6 0 10 -4 10 -10zM448 112v208h-384v-208h384zM0 59v5h512v-5c-70 -20 -116 -27 -256 -27s-186 7 -256 27z" />
+ <glyph glyph-name="ion-leaf" unicode="&#xf1fd;" horiz-adv-x="422"
+d="M412 69c18 -3 10 -41 -5 -39c0 0 -21 -1 -63 12c0 0 -16 -19 -39 -30c-26 -12 -118 -33 -197 38c-108 97 -120 354 -100 333c86 -90 197 -47 270 -106c55 -44 88 -127 77 -192c0 0 5 -8 57 -16zM316 65c5 5 10 16 10 24c-161 52 -252 160 -252 160s104 -143 242 -184z
+" />
+ <glyph glyph-name="ion-levels" unicode="&#xf298;" horiz-adv-x="350"
+d="M46 349c11 -5 18 -16 18 -29s-7 -24 -18 -29v-275c0 -9 -7 -16 -16 -16s-16 7 -16 16v278c-8 6 -14 15 -14 26s6 20 14 26v22c0 9 7 16 16 16s16 -7 16 -16v-19zM142 155c9 -6 15 -16 15 -27s-6 -21 -15 -27v-85c0 -9 -7 -16 -16 -16s-16 7 -16 16v84
+c-10 5 -17 16 -17 28s7 23 17 28v212c0 9 7 16 16 16s16 -7 16 -16v-213zM238 285c10 -6 16 -16 16 -28s-6 -22 -16 -28v-213c0 -9 -7 -16 -16 -16s-16 7 -16 16v213c-10 6 -16 16 -16 28s6 22 16 28v83c0 9 7 16 16 16s16 -7 16 -16v-83zM350 65c0 -12 -6 -22 -16 -28v-21
+c0 -9 -7 -16 -16 -16s-16 7 -16 16v21c-10 6 -16 16 -16 28s6 22 16 28v275c0 9 7 16 16 16s16 -7 16 -16v-275c10 -6 16 -16 16 -28z" />
+ <glyph glyph-name="ion-lightbulb" unicode="&#xf299;" horiz-adv-x="256"
+d="M128 416c71 0 128 -56 128 -124c0 -5 0 -9 -1 -14s-2 -11 -3 -16v-2c-17 -63 -45 -71 -59 -167v-1c-2 -9 -10 -12 -20 -12h-90c-10 0 -18 3 -20 12v1c-14 96 -42 104 -59 167v2c-1 5 -2 11 -3 16s-1 9 -1 14c0 68 57 124 128 124zM190 52v-1c-2 -3 -3 -4 -3 -7s1 -5 3 -8
+v-1c1 -2 2 -3 2 -5s-1 -4 -2 -6v-1c-2 -3 -3 -4 -3 -7s1 -5 3 -8v-1c1 -2 2 -4 2 -6c0 -5 -4 -9 -10 -11h-1c-6 -1 -13 -2 -19 -3h-2c-6 -1 -11 -5 -14 -9v0c-4 -5 -10 -10 -18 -10s-15 6 -19 11v0c-3 4 -7 7 -13 8h-2c-6 1 -13 2 -19 3h-1c-6 2 -10 6 -10 11c0 2 1 4 2 6v1
+c2 2 3 4 3 7s-1 5 -3 8v1c-1 2 -2 4 -2 6s1 3 2 5v1c2 3 3 5 3 8s-1 4 -3 7v1v0c-1 2 -2 4 -2 6c0 4 -1 6 7 6h114c8 0 7 -2 7 -6c0 -2 -1 -4 -2 -6v0z" />
+ <glyph glyph-name="ion-link" unicode="&#xf1fe;" horiz-adv-x="384"
+d="M192 240v0v0v0zM304 288c44 0 80 -36 80 -80v-32c0 -44 -36 -80 -80 -80h-112c-33 0 -60 20 -73 48c-4 10 -7 20 -7 32v32h48v-32c0 -18 14 -32 32 -32h112c18 0 32 14 32 32v32c0 18 -14 32 -32 32v0h-16c-6 31 -32 48 -32 48h48zM266 240c4 -10 6 -21 6 -32v-32v0h-48
+v0v32c0 18 -14 32 -32 32v0h-112c-18 0 -32 -14 -32 -32v-32c0 -18 14 -32 32 -32h16c6 -31 32 -48 32 -48h-48c-44 0 -80 36 -80 80v32c0 44 36 80 80 80h112c33 0 62 -20 74 -48z" />
+ <glyph glyph-name="ion-load-a" unicode="&#xf29a;" horiz-adv-x="384"
+d="M144 352c0 43 21 64 64 64s64 -21 64 -64s-21 -64 -64 -64s-64 21 -64 64zM0 192c0 32 16 48 48 48s48 -16 48 -48s-16 -48 -48 -48s-48 16 -48 48zM312 304c0 5 3 8 8 8s8 -3 8 -8s-3 -8 -8 -8s-8 3 -8 8zM132 340c10 -10 15 -22 15 -36s-5 -26 -15 -36s-22 -15 -36 -15
+s-26 5 -36 15s-15 22 -15 36s5 26 15 36s22 15 36 15s26 -5 36 -15zM352 192c0 11 5 16 16 16s16 -5 16 -16s-5 -16 -16 -16s-16 5 -16 16zM297 79c0 16 8 24 24 24s24 -8 24 -24s-8 -24 -24 -24s-24 8 -24 24zM176 32c0 21 11 32 32 32s32 -11 32 -32s-11 -32 -32 -32
+s-32 11 -32 32zM56 80c0 27 13 40 40 40s40 -13 40 -40s-13 -40 -40 -40s-40 13 -40 40z" />
+ <glyph glyph-name="ion-load-b" unicode="&#xf29b;"
+d="M256 288c0 -18 -14 -32 -32 -32v0c-18 0 -32 14 -32 32v96c0 18 14 32 32 32v0c18 0 32 -14 32 -32v-96zM224 128v0c18 0 32 -14 32 -32v-96c0 -18 -14 -32 -32 -32s-32 14 -32 32v96c0 18 14 32 32 32zM416 224v0c18 0 32 -14 32 -32s-14 -32 -32 -32h-96
+c-18 0 -32 14 -32 32s14 32 32 32h96zM128 224v0c18 0 32 -14 32 -32s-14 -32 -32 -32h-96c-18 0 -32 14 -32 32s14 32 32 32h96zM314 237c-12 -12 -33 -12 -45 0v0c-12 12 -12 34 0 46l68 67c12 12 33 12 45 0v0c12 -12 12 -33 0 -45zM179 147v0c12 -12 12 -33 0 -46
+l-68 -67c-12 -12 -33 -12 -45 0s-12 33 0 45l67 68c12 12 34 12 46 0zM382 79v0c12 -12 12 -33 0 -45s-33 -12 -45 0l-68 68c-12 12 -12 33 0 45s33 12 45 0zM179 282v0c12 -12 12 -33 0 -45s-34 -12 -46 0l-67 68c-12 12 -12 33 0 45s33 12 45 0z" />
+ <glyph glyph-name="ion-load-c" unicode="&#xf29c;"
+d="M448 222c0 -3 0 -6 -1 -9c-4 -8 -15 -12 -23 -7c-4 2 -6 7 -7 11c-1 5 -1 9 -2 14c-4 20 -12 40 -22 58c-12 21 -28 41 -47 56c-18 15 -40 26 -62 33c-21 6 -42 9 -64 9h-4c-3 0 -6 -1 -9 -1c-6 0 -14 -1 -20 -2c-13 -2 -25 -6 -37 -11c-21 -8 -40 -20 -57 -35
+s-31 -33 -42 -52c-12 -22 -20 -45 -24 -70c-2 -11 -2 -23 -2 -34c0 -6 0 -11 1 -16c1 -6 2 -13 3 -19c5 -24 14 -47 28 -67c13 -20 29 -38 48 -52c20 -15 42 -26 65 -33c25 -7 50 -9 76 -7c25 2 50 9 73 20c11 5 22 12 32 19s19 15 27 24c4 4 8 9 12 14s7 10 10 15
+c6 10 12 20 17 31c4 8 8 16 11 25c2 4 3 9 4 13s1 7 2 11c1 -9 1 -18 -1 -26c-1 -5 -2 -11 -4 -16c-1 -5 -3 -10 -5 -15c-4 -10 -8 -19 -13 -28c-6 -11 -12 -21 -20 -30s-16 -18 -25 -26c-18 -15 -40 -27 -62 -36c-23 -9 -48 -14 -73 -15s-51 3 -75 11c-23 7 -45 19 -65 33
+c-19 14 -36 31 -50 50c-7 10 -13 20 -18 31s-9 21 -13 33c-6 18 -9 37 -10 56c-1 20 1 39 5 58c5 24 15 47 28 68c12 19 26 35 42 50s35 27 55 36c23 11 48 19 74 21c10 1 19 1 29 1c13 0 26 -2 38 -4c24 -5 47 -14 68 -26s41 -29 57 -48c15 -18 27 -37 36 -58
+c4 -10 7 -21 10 -32c2 -8 5 -17 6 -26z" />
+ <glyph glyph-name="ion-load-d" unicode="&#xf29d;" horiz-adv-x="384"
+d="M368 208c9 0 16 -7 16 -16s-7 -16 -16 -16h-80c-9 0 -16 7 -16 16s7 16 16 16h80zM112 192c0 -9 -7 -16 -16 -16h-80c-9 0 -16 7 -16 16s7 16 16 16h80c9 0 16 -7 16 -16zM192 112c9 0 16 -7 16 -16v-80c0 -9 -7 -16 -16 -16s-16 7 -16 16v80c0 9 7 16 16 16zM192 384
+c9 0 16 -7 16 -16v-80c0 -9 -7 -16 -16 -16s-16 7 -16 16v80c0 9 7 16 16 16zM261 232c-4 8 -2 18 6 22l69 40c8 4 18 2 22 -6s2 -18 -6 -22l-69 -40c-8 -4 -18 -2 -22 6zM123 152c4 -8 2 -18 -6 -22l-69 -40c-8 -4 -18 -2 -22 6s-2 18 6 22l69 40c8 4 18 2 22 -6zM254 117
+l40 -69c4 -8 2 -18 -6 -22s-18 -2 -22 6l-40 69c-4 8 -2 18 6 22s18 2 22 -6zM118 352l40 -69c4 -8 2 -18 -6 -22s-18 -2 -22 6l-40 69c-4 8 -2 18 6 22s18 2 22 -6zM232 261c-8 4 -10 14 -6 22l40 69c4 8 14 10 22 6s10 -14 6 -22l-40 -69c-4 -8 -14 -10 -22 -6zM152 123
+c8 -4 10 -14 6 -22l-40 -69c-4 -8 -14 -10 -22 -6s-10 14 -6 22l40 69c4 8 14 10 22 6zM352 118c8 -4 10 -14 6 -22s-14 -10 -22 -6l-69 40c-8 4 -10 14 -6 22s14 10 22 6zM32 266c-8 4 -10 14 -6 22s14 10 22 6l69 -40c8 -4 10 -14 6 -22s-14 -10 -22 -6z" />
+ <glyph glyph-name="ion-location" unicode="&#xf1ff;" horiz-adv-x="239"
+d="M119 384c66 0 120 -54 120 -120c0 -115 -120 -264 -120 -264s-119 149 -119 264c0 66 53 120 119 120zM119 206c31 0 57 25 57 56s-26 57 -57 57s-56 -26 -56 -57s25 -56 56 -56z" />
+ <glyph glyph-name="ion-lock-combination" unicode="&#xf4d4;" horiz-adv-x="384"
+d="M320 271c39 -35 64 -86 64 -143c0 -106 -86 -192 -192 -192s-192 86 -192 192c0 57 25 108 64 143v49c0 71 57 128 128 128s128 -57 128 -128v-49zM96 320v-26c28 16 61 26 96 26s68 -10 96 -26v26c0 53 -43 96 -96 96s-96 -43 -96 -96zM192 -32c88 0 160 72 160 160
+s-72 160 -160 160s-160 -72 -160 -160s72 -160 160 -160zM192 272c80 0 144 -64 144 -144s-64 -144 -144 -144s-144 64 -144 144s64 144 144 144zM315 95c2 9 4 18 4 29h-7v7h8c0 11 -2 20 -5 30l-25 -7l-4 12l25 8c-4 10 -8 18 -14 26l-11 -8l-4 6l11 8c-6 8 -13 16 -21 22
+l-15 -21l-11 8l15 20c-8 6 -17 11 -27 14l-4 -13l-6 2l5 13c-9 3 -20 5 -29 5v-13v-6h-16v6v13c-11 -1 -19 -2 -29 -5l4 -12l-6 -2l-4 12c-10 -3 -19 -8 -27 -14l15 -20l-10 -8l-15 21c-8 -6 -16 -14 -22 -22l11 -8l-4 -5l-10 8c-6 -8 -10 -17 -14 -27l24 -8l-5 -12l-25 7
+c-3 -10 -3 -19 -3 -30h6v-7h-5c0 -11 2 -20 4 -29l24 7l4 -12l-24 -8c4 -10 8 -19 14 -27l9 7l4 -5l-9 -7c6 -8 13 -16 21 -22l15 21l10 -8l-15 -20c8 -5 17 -11 27 -14l3 11l7 -2l-4 -11c10 -3 18 -4 29 -5v13v6h16v-6v-13c9 1 19 2 29 5l-5 12l6 2l4 -12c10 3 19 8 27 14
+l-15 20l11 8l15 -21c8 6 15 14 21 22l-11 7l4 6l10 -8c6 8 11 17 15 27l-25 8l4 12zM111 128c0 54 27 81 81 81s81 -27 81 -81s-27 -81 -81 -81s-81 27 -81 81z" />
+ <glyph glyph-name="ion-locked" unicode="&#xf200;" horiz-adv-x="384"
+d="M22 -32c-12 0 -22 10 -22 22v212c0 12 10 22 22 22h3h19v31c0 42 17 87 43 115s64 46 105 46v0v0c41 0 79 -18 105 -46s43 -73 43 -115v-31h22c12 0 22 -10 22 -22v-212c0 -12 -10 -22 -22 -22h-340zM97 255v-31h17h155h18v31c0 27 -10 61 -28 80v0v1
+c-18 19 -42 29 -67 29v0v0c-25 0 -49 -10 -67 -29v-1v0c-18 -19 -28 -53 -28 -80z" />
+ <glyph glyph-name="ion-log-in" unicode="&#xf29e;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224c-96 0 -177 60 -209 144h34c9 -20 23 -40 39 -56c36 -36 85 -56 136 -56s100 20 136 56s56 85 56 136s-20 100 -56 136s-85 56 -136 56s-100 -20 -136 -56c-16 -16 -30 -36 -39 -56h-34c32 84 113 144 209 144z
+M175 124l52 52h-227v32h227l-52 52l22 23l91 -91l-91 -91z" />
+ <glyph glyph-name="ion-log-out" unicode="&#xf29f;"
+d="M335 124l52 52h-227v32h227l-52 52l22 23l91 -91l-91 -91zM359 56c3 3 6 5 8 8h41c-40 -58 -108 -96 -184 -96c-124 0 -224 100 -224 224s100 224 224 224c76 0 144 -38 184 -96h-41c-2 3 -5 5 -8 8c-36 36 -84 56 -135 56s-100 -20 -136 -56s-56 -85 -56 -136
+s20 -100 56 -136s85 -56 136 -56s99 20 135 56z" />
+ <glyph glyph-name="ion-loop" unicode="&#xf201;" horiz-adv-x="334"
+d="M184 148v-58c49 8 86 50 86 102c0 16 -4 30 -10 44c-3 6 -5 12 -9 17l47 43c1 -1 2 -3 3 -4c21 -28 33 -62 33 -100v-4c-2 -72 -47 -131 -111 -154c-12 -4 -26 -8 -39 -9v-57l-76 67l-26 23l44 39zM0 196c2 72 48 133 113 155c12 4 24 7 37 8v57l76 -67l26 -23l-44 -39
+l-59 -51l1 58c-49 -8 -86 -51 -86 -102c0 -16 4 -31 10 -45c3 -6 5 -11 9 -16l-47 -44c-1 2 -2 3 -3 5c-20 28 -33 63 -33 100v4z" />
+ <glyph glyph-name="ion-magnet" unicode="&#xf2a0;" horiz-adv-x="384"
+d="M192 416c115 0 192 -78 192 -200c0 -49 -3 -77 -15 -128c-16 -66 -39 -113 -39 -113v-1c-2 -3 -6 -6 -10 -6c-1 0 -3 1 -4 1l-2 1l-50 20l-2 1c-3 2 -5 5 -5 9c0 1 0 3 1 4v1c7 16 27 59 37 101s13 63 13 108c0 71 -52 122 -116 122s-116 -51 -116 -122
+c0 -45 3 -66 13 -108s30 -85 37 -101v-1c1 -1 1 -3 1 -4c0 -4 -2 -7 -5 -9l-2 -1l-50 -20l-2 -1c-1 0 -3 -1 -4 -1c-4 0 -8 3 -10 6v1s-24 47 -40 113c-12 51 -14 79 -14 128c0 122 77 200 192 200zM109 4c-9 19 -27 59 -36 98l-42 -12c13 -53 30 -92 35 -104l43 17v1z
+M317 -14c5 12 23 51 36 104l-43 12c-9 -39 -26 -79 -35 -98v-1z" />
+ <glyph glyph-name="ion-male" unicode="&#xf2a1;"
+d="M448 256l-63 63l-69 -69c22 -30 36 -66 36 -106c0 -97 -79 -176 -176 -176s-176 79 -176 176s79 176 176 176c40 0 76 -14 106 -36l69 69l-63 63h160v-160zM266 54c24 24 38 56 38 90s-14 66 -38 90s-56 38 -90 38s-66 -14 -90 -38s-38 -56 -38 -90s14 -66 38 -90
+s56 -38 90 -38s66 14 90 38z" />
+ <glyph glyph-name="ion-man" unicode="&#xf202;" horiz-adv-x="168"
+d="M84 341c-21 0 -37 17 -37 38s16 37 37 37s37 -16 37 -37s-16 -38 -37 -38zM121 333c28 0 47 -24 47 -48v-114c0 -22 -32 -22 -32 0v105h-5v-286c0 -28 -41 -31 -43 0v165h-1h-7v-165c-1 -29 -43 -30 -43 0v286h-6v-105c0 -22 -31 -22 -31 0v114c0 24 19 48 47 48h37h37z
+" />
+ <glyph glyph-name="ion-map" unicode="&#xf203;"
+d="M441 311c4 -3 7 -8 7 -14v-281c0 -6 -2 -11 -7 -14c-2 -1 -5 -2 -7 -2c-3 0 -6 0 -8 2l-97 66l-97 -66c-5 -3 -10 -3 -15 0l-97 66l-97 -66c-5 -3 -10 -3 -15 0s-8 8 -8 14v281c0 6 3 11 7 14l105 71c5 3 10 3 15 0l97 -66l98 66c5 3 10 3 15 0zM103 95v242l-71 -50v-242
+zM135 95l73 -49v129l-4 -11c-7 2 -13 6 -20 10l8 13c5 -3 11 -6 16 -8v109l-73 49v-101c4 -2 9 -4 13 -7l-10 -13c-1 1 -2 1 -3 2v-123zM240 46l73 49v109c0 -1 -1 -1 -1 -2l-6 -6l-12 11l6 6c3 3 5 7 8 10l5 -5v119l-73 -49v-112h7l3 -15c-3 0 -6 -1 -9 -1h-1v-114zM416 46
+v242l-71 49v-88c3 1 5 1 8 2l4 -16c-4 -1 -8 -1 -12 -3v-137zM97 227c-3 -1 -11 -5 -14 -7l-11 12c4 3 8 6 12 8c3 2 6 3 9 4l5 -15c-2 -1 1 -1 -1 -2zM265 182c5 3 10 5 15 10l11 -12c-6 -6 -12 -10 -19 -13zM67 192v-1l-15 5v1c2 7 4 13 9 20l13 -9c-4 -5 -5 -10 -7 -16z
+M166 210c3 -4 7 -8 11 -11l-11 -12c-4 4 -8 9 -12 13l-3 3l12 11c1 -1 2 -3 3 -4zM376 218l-11 12l10 10l-10 10l11 12l10 -11l11 11l11 -12l-10 -10l10 -10l-11 -12l-11 11z" />
+ <glyph glyph-name="ion-medkit" unicode="&#xf2a2;"
+d="M440 304c4 0 8 -4 8 -8v-288c0 -4 -4 -8 -8 -8h-432c-4 0 -8 4 -8 8v288c0 4 4 8 8 8h120v31c1 28 22 49 51 49h45h45c30 0 50 -21 51 -49v-31h120zM160 331v-27h128v27v1v1c0 10 -9 19 -19 19h-45h-45c-10 0 -19 -9 -19 -19v-1v-1zM320 128v64h-64v64h-64v-64h-64v-64
+h64v-64h64v64h64z" />
+ <glyph glyph-name="ion-merge" unicode="&#xf33f;" horiz-adv-x="384"
+d="M320 224c35 0 64 -29 64 -64s-29 -64 -64 -64c-24 0 -44 13 -55 32h-10c-61 0 -115 25 -159 74v-115c19 -11 32 -31 32 -55c0 -35 -29 -64 -64 -64s-64 29 -64 64c0 24 13 44 32 55v210c-19 11 -32 31 -32 55c0 35 29 64 64 64s64 -29 64 -64c0 -19 -8 -37 -22 -49
+c4 -9 17 -35 37 -58c32 -35 70 -53 112 -53h10c11 19 31 32 55 32zM64 384c-18 0 -32 -14 -32 -32s14 -32 32 -32s32 14 32 32s-14 32 -32 32zM64 0c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM320 128c18 0 32 14 32 32s-14 32 -32 32
+s-32 -14 -32 -32s14 -32 32 -32z" />
+ <glyph glyph-name="ion-mic-a" unicode="&#xf204;" horiz-adv-x="288"
+d="M0 210c0 10 9 19 20 19s19 -9 19 -19v-14c0 -28 12 -53 31 -72s45 -31 74 -31s55 12 74 31s31 44 31 72v14c0 10 8 19 19 19s20 -9 20 -19v-14c0 -66 -46 -120 -108 -136c-1 0 -3 -1 -4 -1c-6 -2 -10 -7 -12 -13v-58c0 -11 -9 -20 -20 -20v0c-11 0 -20 9 -20 20v58
+c-2 6 -6 11 -12 13c-1 0 -3 1 -4 1c-62 16 -108 70 -108 136v14zM67 340c0 42 34 76 77 76s78 -34 78 -76v-144c0 -42 -35 -75 -78 -75s-77 33 -77 75v144z" />
+ <glyph glyph-name="ion-mic-b" unicode="&#xf205;" horiz-adv-x="160"
+d="M80 416c35 0 65 -23 76 -59c6 -18 4 -45 2 -55s-8 -20 -14 -28c-3 -4 -7 -7 -11 -9c-1 0 -1 -1 -2 -1c-3 -1 -6 -2 -10 -3c-12 -3 -25 -5 -39 -5v0h-1h-1v0c-14 0 -29 2 -41 5c-4 1 -7 2 -10 3c-1 0 -1 1 -2 1c-4 2 -8 5 -11 9c-6 8 -12 18 -14 28s-4 37 2 55
+c11 36 41 59 76 59zM119 247c6 0 12 -5 12 -12v-2c-5 -67 -18 -241 -19 -252c0 0 -3 -13 -32 -13v0c-29 0 -32 13 -32 13c-1 11 -13 185 -18 252v2c0 7 5 12 11 12h1c1 0 1 -1 2 -1c2 0 4 -1 6 -1c9 -2 21 -2 31 -2s20 0 29 2c2 0 4 1 6 1c1 0 1 1 2 1h1zM90 166v33
+c0 6 -4 11 -10 11s-10 -5 -10 -11v-33c0 -6 4 -11 10 -11s10 5 10 11z" />
+ <glyph glyph-name="ion-mic-c" unicode="&#xf206;" horiz-adv-x="256"
+d="M201 416c30 0 55 -23 55 -52v-28h-59v-37h59v-43h-59v-37h59v-43h-59v-37h59v-42c0 -29 -25 -52 -55 -52h-30v-77h-86v77h-30c-30 0 -55 23 -55 52v42h152v37h-152v43h152v37h-152v43h152v37h-152v28c0 29 25 52 55 52h146z" />
+ <glyph glyph-name="ion-minus-circled" unicode="&#xf207;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM352 176v32h-256v-32h256z" />
+ <glyph glyph-name="ion-minus-round" unicode="&#xf208;" horiz-adv-x="384"
+d="M353 224c17 0 31 -14 31 -32s-14 -32 -31 -32h-322c-17 0 -31 14 -31 32s14 32 31 32h322z" />
+ <glyph glyph-name="ion-minus" unicode="&#xf209;" horiz-adv-x="384"
+d="M0 160v64h384v-64h-384z" />
+ <glyph glyph-name="ion-model-s" unicode="&#xf2c1;" horiz-adv-x="512"
+d="M509 57v-8v0v-1v-3v0c0 -3 -1 -5 -1 -7c-1 -12 -2 -18 -6 -20c-3 -2 -6 -2 -10 -2h-43s-10 1 -11 16v8c20 1 39 1 52 0c10 0 13 0 16 6c2 3 2 7 3 11zM3 57c1 -4 1 -8 3 -11c3 -6 6 -6 16 -6c13 1 32 1 52 0v-8c-1 -15 -8 -16 -11 -16h-43s-7 0 -10 2c-4 2 -6 8 -7 20v7
+v0v3v1v0v8zM512 151c0 -31 -2 -58 -2 -68c0 -4 0 -11 -1 -18c-1 -4 -1 -8 -3 -11c-3 -6 -6 -6 -16 -6c-13 1 -32 1 -52 0c-13 0 -27 -2 -39 -2c-30 -1 -21 4 -34 4s-63 -2 -109 -2s-97 2 -110 2s-4 -5 -34 -4c-12 0 -25 2 -38 2c-20 1 -39 1 -52 0c-10 0 -13 0 -16 6
+c-2 3 -2 7 -3 11c-1 7 -1 14 -1 18c0 10 -2 37 -2 68s4 61 6 64c1 2 8 9 26 21s17 10 20 18c-3 1 -5 3 -7 3c-4 0 -4 -3 -12 -3s-24 1 -28 5c-4 3 -5 5 -5 8s2 9 5 13s19 6 27 7s10 0 12 -1c4 -2 3 -22 3 -22l9 -1c5 13 12 41 24 62c13 23 26 30 32 32s10 2 48 6s69 5 96 5
+s58 -1 96 -5s42 -4 48 -6s19 -9 32 -32c12 -21 19 -49 24 -62l9 1s-1 20 3 22c2 1 4 2 12 1s24 -3 27 -7s5 -10 5 -13s-1 -4 -5 -8s-20 -5 -28 -5s-8 3 -12 3c-2 0 -4 -2 -7 -3c3 -8 2 -6 20 -18s25 -19 26 -21c2 -3 6 -33 6 -64zM86 303c-5 -11 -11 -33 -10 -36
+s-1 -5 15 -4s117 3 165 3s149 -2 165 -3s14 1 15 4s-5 25 -10 36s-17 31 -26 37c-2 1 -17 7 -54 9c-34 2 -72 3 -90 3s-56 -1 -90 -3c-37 -2 -52 -8 -54 -9c-7 -4 -21 -26 -26 -37zM123 178c7 2 11 2 11 2s-17 16 -48 25s-49 11 -66 10c0 0 -3 -16 0 -27s8 -10 16 -12
+s13 -5 16 -4s7 4 12 4s29 -4 38 -4s14 4 21 6zM358 99c15 2 34 19 21 33c-18 19 -15 19 -55 24c-35 4 -61 4 -68 4s-33 0 -68 -4c-40 -5 -37 -5 -55 -24c-13 -14 6 -31 21 -33c14 -2 74 -3 102 -3s88 1 102 3zM492 188c3 11 0 27 0 27c-17 1 -35 -1 -66 -10s-48 -26 -48 -26
+s4 1 11 -1s12 -6 21 -6s33 4 38 4s9 -3 12 -4s8 2 16 4s13 1 16 12z" />
+ <glyph glyph-name="ion-monitor" unicode="&#xf20a;"
+d="M437 384c6 0 11 -5 11 -11v-266c0 -6 -5 -11 -11 -11h-426c-6 0 -11 5 -11 11v266c0 6 5 11 11 11h426zM416 128v224h-384v-224h384zM270 0h-92c-28 0 -42 3 -30 12s30 16 30 23c0 4 1 45 1 45h45h45s1 -41 1 -45c0 -7 18 -14 30 -23s-2 -12 -30 -12z" />
+ <glyph glyph-name="ion-more" unicode="&#xf20b;" horiz-adv-x="384"
+d="M50 144c-28 0 -50 21 -50 48c0 26 22 48 50 48s50 -22 50 -48c0 -27 -22 -48 -50 -48zM192 144c-28 0 -50 21 -50 48c0 26 22 48 50 48s50 -22 50 -48c0 -27 -22 -48 -50 -48zM334 144c-28 0 -50 21 -50 48c0 26 22 48 50 48s50 -22 50 -48c0 -27 -22 -48 -50 -48z" />
+ <glyph glyph-name="ion-mouse" unicode="&#xf340;" horiz-adv-x="256"
+d="M128 416h-1h5h-4zM251 255c2 1 2 1 4 1h1v-176c0 -37 -21 -71 -53 -91c-5 -3 -9 -5 -14 -7v-1v0c-18 -9 -39 -13 -61 -13c-71 0 -128 50 -128 112v176h1c2 0 3 0 5 -1v0c34 -13 76 -23 122 -23s88 10 122 23h1zM189 -18c5 2 10 4 14 7c-5 -3 -9 -5 -14 -7v0v-1v1v0z
+M203 -11c-4 -3 -9 -5 -14 -7c5 2 9 4 14 7zM132 416c69 -2 124 -51 124 -112v-23c-2 -2 -4 -4 -6 -5c-1 -1 -3 0 -4 -1c-23 -10 -50 -16 -82 -19h-1h-2c-11 0 -17 0 -17 10v86c0 9 -7 16 -16 16s-16 -7 -16 -16v-85c0 -11 -6 -11 -17 -11h-2c-32 3 -61 9 -84 19v0
+c-1 0 -1 1 -2 1c-3 1 -5 3 -7 5v23c0 61 57 111 127 112h5z" />
+ <glyph glyph-name="ion-music-note" unicode="&#xf20c;" horiz-adv-x="384"
+d="M362 416c12 0 22 -9 22 -21v-303s-3 -43 -12 -55v0c-9 -15 -25 -21 -43 -21h-37c-28 0 -52 20 -52 48s24 48 52 48h60v192l-208 -38v-232c0 -8 -3 -27 -13 -41c-1 -2 -2 -3 -3 -5c0 -1 -1 -1 -2 -2v0c-9 -11 -23 -18 -38 -18h-37c-28 0 -51 20 -51 48s23 48 51 48v0h61
+v286c1 14 13 28 27 32l218 33s3 1 5 1z" />
+ <glyph glyph-name="ion-navicon-round" unicode="&#xf20d;" horiz-adv-x="384"
+d="M353 224c17 0 31 -14 31 -32s-14 -32 -31 -32h-322c-17 0 -31 14 -31 32s14 32 31 32h322zM353 352c17 0 31 -14 31 -32s-14 -32 -31 -32h-322c-17 0 -31 14 -31 32s14 32 31 32h322zM353 96c17 0 31 -14 31 -32s-14 -32 -31 -32h-322c-17 0 -31 14 -31 32s14 32 31 32
+h322z" />
+ <glyph glyph-name="ion-navicon" unicode="&#xf20e;" horiz-adv-x="320"
+d="M0 175v32h320v-32h-320zM0 271v32h320v-32h-320zM0 79v32h320v-32h-320z" />
+ <glyph glyph-name="ion-navigate" unicode="&#xf2a3;"
+d="M448 416l-192 -448v256h-256z" />
+ <glyph glyph-name="ion-network" unicode="&#xf341;" horiz-adv-x="384"
+d="M384 352c0 -24 -13 -44 -32 -55v-93l-128 -64v-53c19 -11 32 -31 32 -55c0 -35 -29 -64 -64 -64s-64 29 -64 64c0 24 13 44 32 55v53l-128 64v93c-19 11 -32 31 -32 55c0 35 29 64 64 64s64 -29 64 -64c0 -24 -13 -44 -32 -55v-53l96 -48l96 48v53c-19 11 -32 31 -32 55
+c0 35 29 64 64 64s64 -29 64 -64zM64 384c-18 0 -32 -14 -32 -32s14 -32 32 -32s32 14 32 32s-14 32 -32 32zM192 0c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM320 320c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32z" />
+ <glyph glyph-name="ion-no-smoking" unicode="&#xf2c2;"
+d="M328 144v48h16v-48h-16zM80 144v48h90l48 -48h-138zM332 388c69 -38 116 -112 116 -196c0 -124 -100 -224 -224 -224c-24 0 -47 4 -68 11c-2 1 -3 1 -5 2c-12 4 -24 9 -35 15h-1c-69 38 -115 112 -115 196c0 124 100 224 224 224c24 0 47 -4 68 -11c2 -1 3 -1 5 -2
+c12 -4 24 -9 35 -15v0zM224 22c37 0 72 12 100 32l-238 238c-20 -28 -32 -63 -32 -100c0 -65 36 -121 90 -150c6 -3 13 -7 19 -9c2 -1 3 -1 5 -2c9 -3 19 -5 29 -7c9 -2 18 -2 27 -2zM362 93c20 28 32 62 32 99c0 66 -37 123 -91 151c-6 3 -12 6 -18 8c-2 1 -3 1 -5 2
+c-9 3 -19 5 -29 7c-9 2 -18 2 -27 2c-37 0 -71 -12 -99 -32zM320 150l-42 42h42v-42zM352 144v48h16v-48h-16zM328 235c16 -7 16 -27 16 -34v-1h-16v1c0 8 -1 17 -7 20c-4 2 -13 4 -39 4h-3c-13 0 -24 0 -33 13c-5 8 -5 19 -2 29c-4 1 -8 1 -12 3c-17 7 -26 20 -26 38
+c0 33 27 44 39 44v-16c-1 0 -23 -2 -23 -28c0 -11 5 -19 16 -23c9 -4 18 -3 18 -3c3 0 6 -2 7 -5s2 -6 0 -8c-5 -7 -7 -18 -4 -22c4 -6 7 -6 20 -6h3c24 0 37 -2 46 -6zM368 200v0h-16c0 28 -4 41 -7 46c-6 10 -14 14 -25 14h-30c-3 0 -5 2 -6 4s-1 6 0 8c0 0 8 18 6 32
+c-1 8 -6 17 -27 17v16c24 0 40 -11 43 -30c2 -11 0 -23 -3 -31h17c16 0 30 -8 39 -22c6 -10 9 -28 9 -54z" />
+ <glyph glyph-name="ion-nuclear" unicode="&#xf2a4;"
+d="M176 176c0 32 16 48 48 48s48 -16 48 -48s-16 -48 -48 -48s-48 16 -48 48zM176 176c0 32 16 48 48 48s48 -16 48 -48s-16 -48 -48 -48s-48 16 -48 48zM448 176c0 -27 -5 -53 -15 -78s-23 -47 -40 -66s-36 -35 -59 -48l-79 136c22 12 33 31 33 56h160zM224 240
+c-12 0 -23 -3 -33 -9l-80 138c35 20 73 31 113 31s78 -10 113 -30l-81 -139c-10 6 -21 9 -32 9zM160 176c0 -25 11 -44 33 -56l-79 -136c-35 20 -62 46 -83 80s-31 71 -31 112h160z" />
+ <glyph glyph-name="ion-outlet" unicode="&#xf342;"
+d="M338 416c61 0 110 -51 110 -113v-222c0 -62 -49 -113 -110 -113h-228c-61 0 -110 51 -110 113v222c0 62 49 113 110 113h228zM143 197v102c0 11 -9 21 -20 21h-23c-11 0 -19 -9 -20 -20v-2v-101v-1c0 -11 9 -20 20 -20h23c11 0 20 9 20 20v1zM265 52v29
+c0 23 -18 42 -41 42s-41 -19 -41 -42v-29v0c0 -11 9 -20 20 -20h21h21c11 0 20 7 20 18v2zM368 197v102c0 11 -9 21 -20 21h-24c-11 0 -19 -9 -20 -20v-2v-101v-1c0 -11 9 -20 20 -20h24c11 0 20 9 20 20v1z" />
+ <glyph glyph-name="ion-paintbrush" unicode="&#xf4d5;"
+d="M118 165c52 0 102 -41 90 -102c-11 -52 -54 -71 -90 -77c-30 -5 -100 0 -118 35c24 9 34 26 34 49c0 49 32 95 84 95zM436 388c13 -13 17 -30 5 -45l-154 -175c2 -9 1 -17 -3 -23l-50 -58v0v0c-2 -2 -4 -2 -6 0c-1 1 -1 2 -1 3v1c2 53 -41 87 -89 90v0h-2s-2 0 -2 1
+c-2 2 -2 4 0 6l59 49c6 4 14 4 23 2l175 154c15 12 32 8 45 -5zM134 188v0v0v0z" />
+ <glyph glyph-name="ion-paintbucket" unicode="&#xf4d6;" horiz-adv-x="480"
+d="M112 384l32 32l275 -276l-58 -12l-163 -160l-198 192l152 152zM309 160l-110 110l-110 -110h220zM419 140c0 0 61 -66 61 -99s-27 -60 -61 -60s-60 27 -60 60s60 99 60 99z" />
+ <glyph glyph-name="ion-paper-airplane" unicode="&#xf2c3;"
+d="M0 176l448 240l-112 -448l-112 112l-80 -112l-16 160zM319 31l80 323l-322 -173l83 -31l192 154l-128 -176z" />
+ <glyph glyph-name="ion-paperclip" unicode="&#xf20f;" horiz-adv-x="160"
+d="M149 293c6 0 11 -5 11 -12v-195c0 -28 -10 -49 -24 -63c-15 -15 -36 -23 -56 -23c-40 0 -80 31 -80 88v234c0 24 11 44 29 54s39 11 57 0s29 -30 29 -54l-1 -225c0 -13 -3 -24 -9 -32s-16 -12 -25 -12c-17 0 -34 15 -34 44v173c0 6 6 12 12 12s11 -6 11 -12v-173
+c0 -14 5 -21 11 -21c2 0 5 2 7 4c3 4 5 10 5 17v225c0 15 -6 28 -17 34s-24 6 -35 0s-17 -19 -17 -34v-234c0 -44 29 -64 57 -64s57 19 57 63v195c0 6 6 11 12 11z" />
+ <glyph glyph-name="ion-pause" unicode="&#xf210;" horiz-adv-x="256"
+d="M96 12c0 -7 -5 -12 -12 -12h-72c-7 0 -12 5 -12 12v360c0 7 5 12 12 12h72c7 0 12 -5 12 -12v-360zM244 384c7 0 12 -5 12 -12v-360c0 -7 -5 -12 -12 -12h-72c-7 0 -12 5 -12 12v360c0 7 5 12 12 12h72z" />
+ <glyph glyph-name="ion-person-add" unicode="&#xf211;"
+d="M397 120h-42v51h-51v42h51v51h42v-51h51v-42h-51v-51zM384 0h-192h-192s0 26 2 40c2 11 17 25 81 49c63 23 60 12 60 55c0 28 -14 11 -23 64c-4 21 -6 7 -14 40c-4 17 3 19 2 27s-2 16 -4 33c-2 21 18 76 88 76s90 -55 88 -76c-2 -17 -3 -25 -4 -33s6 -10 2 -27
+c-8 -33 -10 -19 -14 -40c-9 -53 -23 -36 -23 -64c0 -43 -3 -32 60 -55c64 -24 79 -38 81 -49c2 -14 2 -40 2 -40z" />
+ <glyph glyph-name="ion-person-stalker" unicode="&#xf212;"
+d="M393 123c42 -16 52 -26 53 -33c2 -9 2 -90 2 -90h-98c0 18 0 71 -1 77c-1 10 -1 29 -55 50c-8 3 -14 5 -19 7c18 8 15 15 15 28c0 19 -9 11 -15 47c-2 14 -4 5 -9 28c-3 12 1 12 1 18s-1 10 -2 22c-1 14 11 52 57 52s59 -38 58 -52c-1 -12 -2 -16 -2 -22
+c-1 -6 4 -6 1 -18c-5 -23 -7 -14 -9 -28c-6 -36 -16 -28 -16 -47c0 -29 -2 -23 39 -39zM325 0h-163h-162s0 65 2 77c2 10 15 22 69 43c54 20 50 17 50 55c0 24 -12 8 -20 54c-3 18 -5 7 -11 36c-3 15 2 16 1 23s-2 14 -3 29c-2 19 15 67 74 67s77 -49 75 -67
+c-1 -15 -2 -22 -3 -29s5 -8 2 -23c-6 -29 -9 -18 -12 -36c-8 -46 -20 -30 -20 -54c0 -32 -2 -36 31 -48c6 -2 11 -4 19 -7c54 -21 67 -33 69 -43c1 -6 2 -28 2 -47v-30z" />
+ <glyph glyph-name="ion-person" unicode="&#xf213;" horiz-adv-x="384"
+d="M384 0h-192h-192s0 26 2 40c2 11 17 25 81 49c63 23 60 12 60 55c0 28 -14 11 -23 64c-4 21 -6 7 -14 40c-4 17 3 19 2 27s-2 16 -4 33c-2 21 18 76 88 76s90 -55 88 -76c-2 -17 -3 -25 -4 -33s6 -10 2 -27c-8 -33 -10 -19 -14 -40c-9 -53 -23 -36 -23 -64
+c0 -43 -3 -32 60 -55c64 -24 79 -38 81 -49c2 -14 2 -40 2 -40z" />
+ <glyph glyph-name="ion-pie-graph" unicode="&#xf2a5;"
+d="M1 192c0 5 -1 11 -1 16c0 115 93 208 208 208c5 0 11 -1 16 -1v-32v-191h-191h-32zM78 46c-26 32 -42 71 -45 114h223v223c43 -3 82 -19 114 -45c47 -38 78 -96 78 -162c0 -115 -93 -208 -208 -208c-66 0 -124 31 -162 78z" />
+ <glyph glyph-name="ion-pin" unicode="&#xf2a6;" horiz-adv-x="224"
+d="M188 220c20 -10 36 -31 36 -55c0 -17 -3 -21 -15 -21h-81l-12 -176h-8l-12 176h-81c-12 0 -15 5 -15 21c0 24 16 45 36 55v0c1 0 3 1 4 2c7 4 12 11 14 19l18 118v5c0 7 -4 10 -10 13v0c-1 0 -1 1 -2 1c-7 3 -12 9 -12 17c0 20 6 21 18 21h92c12 0 18 -1 18 -21
+c0 -8 -5 -14 -12 -17c-1 0 -1 -1 -2 -1v0c-6 -3 -10 -6 -10 -13v-5l18 -118c2 -8 7 -15 14 -19c1 -1 3 -2 4 -2v0z" />
+ <glyph glyph-name="ion-pinpoint" unicode="&#xf2a7;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM360 56c32 32 51 75 55 120l-63 8v16l63 8c-4 45 -23 88 -55 120s-75 51 -120 55l-8 -63h-16l-8 63c-45 -4 -88 -23 -120 -55s-51 -75 -55 -120l63 -8v-16l-63 -8
+c4 -45 23 -88 55 -120s75 -51 120 -55l8 63h16l8 -63c45 4 88 23 120 55z" />
+ <glyph glyph-name="ion-pizza" unicode="&#xf2a8;" horiz-adv-x="352"
+d="M315 318c10 -4 12 -13 9 -20l-148 -330s-143 320 -148 331s2 16 9 19c39 18 90 28 139 28s96 -9 139 -28zM112 256c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM176 109c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM240 224
+c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM342 382c6 -3 10 -6 10 -13c0 -1 0 -3 -1 -5l-8 -19c-3 -5 -8 -9 -14 -9c-1 0 -3 1 -6 2c-41 18 -95 30 -147 30s-102 -11 -147 -30c-3 -1 -4 -2 -6 -2c-6 0 -11 4 -14 9l-8 19s-1 2 -1 5c0 8 6 12 10 14
+c49 21 107 33 166 33s118 -13 166 -34z" />
+ <glyph glyph-name="ion-plane" unicode="&#xf214;"
+d="M250 136c0 -7 1 -69 -6 -102c-1 -4 3 -4 5 -7l51 -33c2 -2 3 -8 3 -8l1 -18l-68 16l-12 -32l-12 32l-68 -16l1 18s0 6 2 8l52 33c2 3 6 3 5 7c-7 33 -6 95 -6 102s-8 5 -8 5l-62 -13l-128 -49c0 23 2 26 9 31l183 131s5 63 5 113c0 24 12 78 27 78s27 -54 27 -78
+c0 -53 5 -113 5 -113l183 -131c6 -4 9 -7 9 -31l-128 49l-62 13s-8 2 -8 -5z" />
+ <glyph glyph-name="ion-planet" unicode="&#xf343;" horiz-adv-x="512"
+d="M96 182c39 -24 85 -48 134 -69c44 -19 87 -35 126 -46c-27 -22 -62 -35 -100 -35c-85 0 -155 66 -160 150zM107 251c1 4 3 8 5 11c10 21 26 40 44 55c27 22 62 35 100 35c85 0 155 -66 160 -150v-10c0 -21 -4 -41 -11 -59c-1 -4 -3 -8 -5 -11c-6 1 -13 3 -19 5
+c-39 11 -82 26 -126 45c-56 24 -108 52 -148 79zM430 163c57 -35 87 -62 81 -82c-4 -12 -19 -17 -44 -17c-50 0 -136 23 -231 64c-141 61 -246 140 -235 175c4 12 20 20 44 17c22 -3 47 -9 73 -18c-8 -9 -8 -12 -14 -22c-23 5 -44 8 -59 8h-6c2 -2 5 -6 8 -9
+c11 -11 27 -24 46 -37c41 -29 97 -59 156 -85c44 -19 89 -35 128 -46c36 -10 68 -15 90 -15h6c-2 2 -5 6 -8 9c-10 10 -24 22 -41 34c4 11 5 12 6 24z" />
+ <glyph glyph-name="ion-play" unicode="&#xf215;" horiz-adv-x="320"
+d="M309 215c7 -6 11 -14 11 -23s-4 -17 -11 -23l-278 -166c-4 -2 -7 -3 -11 -3c-11 0 -20 9 -20 20v0v344v0c0 11 9 20 20 20c4 0 8 -1 11 -3z" />
+ <glyph glyph-name="ion-playstation" unicode="&#xf30a;" horiz-adv-x="512"
+d="M400 245c0 -11 0 -22 -2 -33c-2 -10 -5 -20 -10 -28c-4 -7 -10 -13 -18 -17c-7 -4 -16 -6 -24 -6c-13 0 -31 4 -42 9v131v2c0 9 -7 17 -15 17h-1c-9 0 -16 -8 -16 -17v-3v-300l-80 26v358s28 -4 75 -18s67 -21 84 -31c8 -5 15 -11 21 -17c7 -7 13 -14 17 -23
+c8 -16 10 -33 11 -50zM87 90c-4 -2 -8 -3 -11 -6c-1 -1 -3 -3 -2 -5s4 -4 6 -5c6 -2 13 -3 19 -3c7 0 15 0 22 2c5 1 9 3 14 5c30 10 41 12 41 12v-42c-14 -2 -36 -4 -50 -4c-30 -1 -60 4 -88 13c-9 3 -19 6 -27 12c-4 3 -8 8 -10 13c-2 4 -1 9 1 13s5 8 9 11
+c9 6 18 10 28 14c8 4 17 7 26 10c35 12 111 37 111 37v-47s-62 -20 -89 -30zM512 102c0 -5 -2 -9 -5 -13c-6 -7 -14 -11 -22 -15s-17 -8 -26 -11c-54 -19 -171 -59 -171 -59v48s92 30 133 44c6 2 11 4 16 8c2 2 4 3 3 6c-1 2 -4 4 -6 5c-6 2 -13 3 -19 3
+c-10 0 -20 -2 -30 -5c-29 -10 -97 -32 -97 -32v49s45 14 67 16c8 1 23 1 31 1c26 0 54 -3 79 -11c5 -2 8 -3 14 -5c9 -3 18 -8 25 -14c4 -4 8 -9 8 -15z" />
+ <glyph glyph-name="ion-plus-circled" unicode="&#xf216;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM352 176v32h-112v112h-32v-112h-112v-32h112v-112h32v112h112z" />
+ <glyph glyph-name="ion-plus-round" unicode="&#xf217;" horiz-adv-x="384"
+d="M353 224c17 0 31 -14 31 -32s-14 -32 -31 -32h-129v-129c0 -17 -14 -31 -32 -31s-32 14 -32 31v129h-129c-17 0 -31 14 -31 32s14 32 31 32h129v129c0 17 14 31 32 31s32 -14 32 -31v-129h129z" />
+ <glyph glyph-name="ion-plus" unicode="&#xf218;" horiz-adv-x="384"
+d="M384 224v-64h-160v-160h-64v160h-160v64h160v160h64v-160h160z" />
+ <glyph glyph-name="ion-podium" unicode="&#xf344;"
+d="M0 0v192h128v-192h-128zM160 0v288h128v-288h-128zM320 0v128h128v-128h-128z" />
+ <glyph glyph-name="ion-pound" unicode="&#xf219;"
+d="M93 96h-93v54h101l13 84h-99v54h107l22 128h64l-22 -128h106l22 128h63l-22 -128h93v-54h-102l-12 -84h99v-54h-107l-22 -128h-63l22 128h-107l-22 -128h-63zM177 234l-12 -84h106l12 84h-106v0z" />
+ <glyph glyph-name="ion-power" unicode="&#xf2a9;"
+d="M224 192c-18 0 -32 14 -32 32v160c0 18 14 32 32 32s32 -14 32 -32v-160c0 -18 -14 -32 -32 -32zM347 379c61 -40 101 -109 101 -187c0 -124 -100 -224 -224 -224s-224 100 -224 224c0 78 40 147 101 187v0c5 3 11 5 17 5c18 0 32 -14 32 -32c0 -6 -2 -12 -5 -17
+c-2 -3 -4 -6 -7 -8c-1 -1 -3 -2 -4 -3c-8 -6 -16 -12 -23 -19c-30 -30 -47 -70 -47 -113s17 -83 47 -113s70 -47 113 -47s83 17 113 47s47 70 47 113s-17 83 -47 113c-7 7 -15 13 -23 19c-1 1 -3 2 -4 3c-3 2 -5 5 -7 8c-3 5 -5 11 -5 17c0 18 14 32 32 32c6 0 12 -2 17 -5
+v0z" />
+ <glyph glyph-name="ion-pricetag" unicode="&#xf2aa;"
+d="M439 187c12 -12 12 -31 0 -43l-165 -167c-11 -11 -30 -11 -42 -1l-3 3l-206 209l-6 5c-6 7 -9 15 -10 24v0v2v0l-7 98v4v0c0 12 4 24 13 33l49 49c8 9 20 13 31 13h4l100 -4v0c12 0 22 -4 30 -12v0l2 -2v0l210 -211v0v0zM112 256c26 0 48 22 48 48s-22 48 -48 48
+s-48 -22 -48 -48s22 -48 48 -48z" />
+ <glyph glyph-name="ion-pricetags" unicode="&#xf2ab;"
+d="M440 209c10 -11 11 -28 0 -39l-29 -29c11 11 10 28 0 39v0v0l-190 191v0l-1 1h-1c-8 7 -16 12 -27 12v0l-90 3h-4c-9 0 -19 -3 -26 -10l28 27c8 8 17 12 27 12h4l90 -4v0c11 0 19 -4 27 -11h1l1 -1v0l190 -191v0v0zM396 166v0c11 -11 11 -29 0 -40l-108 -109v1l-26 -27
+l-2 -2l-13 -13c-10 -10 -26 -10 -37 -1l-3 3l-186 188l-5 5c-5 6 -9 14 -10 22v0v2v0l-6 88v3v1c0 11 4 21 12 29l44 45l1 1l1 1c7 6 17 9 26 9h4l90 -3v0c11 0 19 -4 27 -11v0l2 -1v0l189 -191v0zM79 308c-12 -8 -21 -21 -21 -37c0 -24 19 -43 43 -43c16 0 29 9 37 21
+c4 7 7 14 7 22c0 24 -20 44 -44 44c-8 0 -15 -3 -22 -7z" />
+ <glyph glyph-name="ion-printer" unicode="&#xf21a;"
+d="M392 320c28 0 56 -19 56 -55v-131c0 -31 -28 -54 -56 -54h-40v-112h-8h-8h-224h-11h-5v112h-40c-28 0 -56 24 -56 62v123c0 38 28 55 56 55h40v64h256v-64h40zM336 -16v176h-224v-176h224zM336 320v48h-224v-48h224zM384 256v16h-17v-16h17zM128 112v16h192v-16h-192z
+M128 64v16h192v-16h-192zM128 16v16h192v-16h-192z" />
+ <glyph glyph-name="ion-pull-request" unicode="&#xf345;" horiz-adv-x="384"
+d="M64 384c35 0 64 -29 64 -64c0 -24 -13 -44 -32 -55v-178c19 -11 32 -31 32 -55c0 -35 -29 -64 -64 -64s-64 29 -64 64c0 24 13 44 32 55v178c-19 11 -32 31 -32 55c0 35 29 64 64 64zM64 0c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM64 288
+c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32zM351 88c20 -11 33 -32 33 -56c0 -35 -29 -64 -64 -64s-64 29 -64 64c0 23 12 44 31 55v156c0 16 -4 26 -11 33c-10 9 -26 12 -52 12v-64l-96 96l96 96v-64c42 1 74 -8 96 -29c21 -19 31 -46 31 -80v-155z
+M320 0c18 0 32 14 32 32s-14 32 -32 32s-32 -14 -32 -32s14 -32 32 -32z" />
+ <glyph glyph-name="ion-qr-scanner" unicode="&#xf346;" horiz-adv-x="416"
+d="M48 324v-68h-48v68c0 33 28 60 61 60h67v-48h-68c-7 0 -12 -5 -12 -12zM356 384c33 0 60 -27 60 -60v-68h-48v68c0 7 -6 12 -13 12h-67v48h68zM368 61v67h48v-67c0 -33 -27 -61 -60 -61h-68v49h68c7 0 12 5 12 12zM60 49h68v-49h-67c-33 0 -61 28 -61 61v67h48v-67
+c0 -7 5 -12 12 -12z" />
+ <glyph glyph-name="ion-quote" unicode="&#xf347;" horiz-adv-x="384"
+d="M128 384c-41 0 -73 -11 -95 -33s-33 -54 -33 -95v-256h160v256h-96c0 23 5 39 15 49s26 15 49 15zM352 384c-41 0 -73 -11 -95 -33s-33 -54 -33 -95v-256h160v256h-96c0 23 5 39 15 49s26 15 49 15z" />
+ <glyph glyph-name="ion-radio-waves" unicode="&#xf2ac;"
+d="M160 192c0 43 21 64 64 64s64 -21 64 -64s-21 -64 -64 -64s-64 21 -64 64zM112 192c0 -18 5 -35 13 -50s19 -28 33 -37l-23 -25c-6 5 -13 10 -18 16c-25 26 -37 59 -37 96s12 70 37 96c5 6 12 11 18 16l23 -25c-14 -9 -25 -22 -33 -37s-13 -32 -13 -50zM336 192
+c0 18 -5 35 -13 50s-19 28 -33 37l23 25c6 -5 13 -10 18 -16c25 -26 37 -59 37 -96s-12 -70 -37 -96c-5 -6 -12 -11 -18 -16l-23 25c14 9 25 22 33 37s13 32 13 50zM32 192c0 -27 6 -53 17 -77s27 -43 47 -59l-23 -24c-6 5 -12 10 -17 16c-18 19 -31 41 -41 65
+c-10 25 -15 51 -15 79s5 54 15 79c10 24 23 46 41 65c5 6 11 11 17 16l23 -24c-10 -8 -18 -17 -26 -27s-14 -21 -20 -32s-10 -24 -13 -37s-5 -26 -5 -40zM416 192c0 27 -6 53 -17 77s-27 43 -47 59l23 24c6 -5 12 -10 17 -16c18 -19 31 -41 41 -65c10 -25 15 -51 15 -79
+s-5 -54 -15 -79c-10 -24 -23 -46 -41 -65c-4 -5 -10 -10 -17 -16l-23 24c20 16 36 35 47 59s17 50 17 77z" />
+ <glyph glyph-name="ion-record" unicode="&#xf21b;" horiz-adv-x="416"
+d="M208 -16c-115 0 -208 93 -208 208s93 208 208 208s208 -93 208 -208s-93 -208 -208 -208z" />
+ <glyph glyph-name="ion-refresh" unicode="&#xf21c;"
+d="M352 96l-104 112h74c-7 65 -64 112 -130 112c-71 0 -128 -57 -128 -128s57 -128 128 -128c28 0 53 8 75 24l6 5l43 -46l-7 -6c-34 -26 -74 -41 -117 -41c-91 0 -167 64 -187 149v0c0 1 -1 2 -1 3v1v2s-1 2 -1 3v1c0 1 -1 3 -1 4v0c-1 6 -2 13 -2 19v1v4v5v5v4v1
+c0 6 1 13 2 19v0c0 1 1 3 1 4v1c0 1 1 1 1 2v3v1c0 1 1 2 1 3v0c20 85 96 149 187 149v0v0c11 0 21 -1 31 -3h2h2c57 -10 106 -47 133 -96c13 -23 21 -49 23 -77h65z" />
+ <glyph glyph-name="ion-reply-all" unicode="&#xf21d;" horiz-adv-x="416"
+d="M257 256c153 0 159 -208 159 -208c-51 93 -91 102 -159 102v-92l-152 134l152 144v-80zM0 192l144 136v-57l-82 -79l82 -68v-58z" />
+ <glyph glyph-name="ion-reply" unicode="&#xf21e;" horiz-adv-x="384"
+d="M384 48c-53 93 -122 102 -224 102v-92l-160 134l160 144v-80c187 0 224 -208 224 -208z" />
+ <glyph glyph-name="ion-ribbon-a" unicode="&#xf348;" horiz-adv-x="352"
+d="M272 416l80 -96l-64 -134c-24 30 -59 49 -99 53zM80 416l83 -177c-40 -4 -75 -23 -99 -53l-64 134zM189 416h67l-53 -112h-27h-27l-53 112h80h13zM176 224c71 0 128 -57 128 -128s-57 -128 -128 -128s-128 57 -128 128s57 128 128 128zM176 0c53 0 96 43 96 96
+s-43 96 -96 96s-96 -43 -96 -96s43 -96 96 -96zM176 184c49 0 88 -39 88 -88s-39 -88 -88 -88s-88 39 -88 88s39 88 88 88z" />
+ <glyph glyph-name="ion-ribbon-b" unicode="&#xf349;" horiz-adv-x="384"
+d="M192 376c49 0 88 -39 88 -88s-39 -88 -88 -88s-88 39 -88 88s39 88 88 88zM192 416c71 0 128 -57 128 -128s-57 -128 -128 -128s-128 57 -128 128s57 128 128 128zM192 192c53 0 96 43 96 96s-43 96 -96 96s-96 -43 -96 -96s43 -96 96 -96zM83 194c26 -30 65 -50 109 -50
+c12 0 23 1 34 4l-34 -74l-48 -106l-48 80h-96zM301 194l83 -146h-96l-48 -80l-40 88l45 98c22 9 41 23 56 40z" />
+ <glyph glyph-name="ion-sad-outline" unicode="&#xf4d7;"
+d="M367 164c3 -9 -2 -17 -11 -19c-3 -1 -7 0 -10 1c-5 2 -9 5 -11 10s-4 12 -13 15s-14 0 -19 -3c-4 -3 -10 -3 -15 -1c-3 1 -7 3 -9 6c-6 8 -3 17 5 22c15 9 29 13 49 6s29 -21 34 -37zM165 195c8 -5 10 -14 4 -22c-2 -3 -6 -5 -9 -6c-5 -2 -11 -2 -15 1c-5 3 -10 6 -19 3
+s-11 -10 -13 -15s-6 -8 -11 -10c-3 -1 -7 -2 -10 -1c-9 2 -14 10 -11 19c5 16 14 30 34 37s35 3 50 -6zM224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM360 56c36 36 56 85 56 136s-20 100 -56 136s-85 56 -136 56
+s-100 -20 -136 -56s-56 -85 -56 -136s20 -100 56 -136s85 -56 136 -56s100 20 136 56zM317 89c5 -7 3 -17 -4 -22c-3 -2 -6 -3 -9 -3c-5 0 -10 3 -13 7c0 0 -19 25 -67 25s-67 -25 -67 -25c-3 -4 -8 -7 -13 -7c-3 0 -6 1 -9 3c-7 5 -9 15 -4 22c1 2 28 39 93 39
+s92 -37 93 -39z" />
+ <glyph glyph-name="ion-sad" unicode="&#xf34a;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM113 156c2 5 4 12 13 15s14 0 19 -3c4 -3 10 -3 15 -1c3 1 7 3 9 6c6 8 4 17 -4 22c-15 9 -30 13 -50 6s-29 -21 -34 -37c-3 -9 2 -17 11 -19c3 -1 7 0 10 1c5 2 9 5 11 10z
+M313 67c7 5 9 15 4 22c-1 2 -28 39 -93 39s-92 -37 -93 -39c-5 -7 -3 -17 4 -22c3 -2 6 -3 9 -3c5 0 10 3 13 7c0 0 19 25 67 25s67 -25 67 -25c3 -4 8 -7 13 -7c3 0 6 1 9 3zM356 145c9 2 14 10 11 19c-5 16 -14 30 -34 37s-34 3 -49 -6c-8 -5 -11 -14 -5 -22
+c2 -3 6 -5 9 -6c5 -2 11 -2 15 1c5 3 10 6 19 3s11 -10 13 -15s6 -8 11 -10c3 -1 7 -2 10 -1z" />
+ <glyph glyph-name="ion-scissors" unicode="&#xf34b;" horiz-adv-x="384"
+d="M341 332c-13 -33 -117 -172 -117 -172l-32 -32s-31 -13 -50 -43s-33 -71 -33 -71v0c-7 -26 -28 -46 -53 -46c-31 0 -56 29 -56 64s25 64 56 64c13 0 25 -5 34 -13c2 -1 3 -3 4 -4v0l2 -2c4 -4 7 -2 14 11c8 15 17 35 27 54s38 59 38 59l17 23l144 192
+c23 -20 18 -51 5 -84zM56 0c15 0 28 14 28 32s-13 32 -28 32s-28 -14 -28 -32s13 -32 28 -32zM192 160c9 0 16 7 16 16s-7 16 -16 16s-16 -7 -16 -16s7 -16 16 -16zM143 183c-30 41 -90 125 -100 149c-13 33 -18 64 5 84l134 -178l-3 -4v0v0l-17 -23v-1v0
+c-1 -1 -10 -13 -19 -27zM328 96c31 0 56 -29 56 -64s-25 -64 -56 -64c-25 0 -47 20 -54 46v0s-13 41 -32 71c-11 17 -26 28 -36 35l29 29l1 1h1c1 1 1 2 2 4c3 -4 5 -9 7 -12c10 -19 20 -39 28 -54c7 -13 10 -15 14 -11c1 1 0 1 1 2h1c1 1 2 3 4 4c9 8 21 13 34 13zM328 0
+c15 0 28 14 28 32s-13 32 -28 32s-28 -14 -28 -32s13 -32 28 -32z" />
+ <glyph glyph-name="ion-search" unicode="&#xf21f;" horiz-adv-x="384"
+d="M381 61c4 -4 4 -10 0 -14l-43 -44c-2 -2 -5 -3 -8 -3s-5 1 -7 3l-84 86c-25 -15 -52 -23 -80 -23c-87 0 -159 71 -159 159s72 159 159 159s158 -71 158 -159c0 -27 -7 -54 -21 -78zM159 322c-53 0 -97 -43 -97 -97s44 -97 97 -97s96 43 96 97s-43 97 -96 97z" />
+ <glyph glyph-name="ion-settings" unicode="&#xf2ad;" horiz-adv-x="416"
+d="M402 310c10 -6 15 -25 14 -36c-1 -17 -7 -36 -25 -54c-1 -1 -2 -1 -3 -2c-26 -25 -62 -30 -94 -20c-1 1 -2 2 -4 2c-5 1 -10 0 -13 -4l-36 -39c52 -50 107 -96 107 -96c2 -2 2 -5 0 -7l-50 -51c-2 -2 -5 -2 -7 0c0 0 -44 55 -93 107l-92 -98c-14 -16 -40 -15 -55 0
+c-15 16 -15 42 1 56l97 93l-12 12c-2 2 -3 7 -1 10l2 5c-25 26 -36 33 -56 32s-36 -13 -48 -28s-10 -52 -8 -62s-7 -6 -12 0c-9 10 -23 50 -6 93s42 69 48 75s16 15 24 21s21 -1 27 5c4 4 5 11 5 16l-4 4c-2 2 -2 5 0 7l31 31c2 2 5 2 7 0l50 -50c2 -2 2 -6 0 -8l-31 -31
+c-2 -2 -5 -2 -7 0l-8 9c-7 0 -15 -5 -17 -10c-3 -6 -6 -21 -3 -33c3 -11 13 -20 36 -43l5 3c4 2 8 1 10 -1c0 0 1 -2 13 -14l38 37c4 3 5 7 4 13c0 2 0 4 -1 5c-10 33 -6 69 19 96l2 2c18 18 36 25 53 26c10 1 30 -5 35 -15l-48 -48l-2 -3l-1 -1c-1 -1 -1 -2 -1 -4
+s0 -3 1 -5l2 -2l2 -2l41 -42l3 -3l1 -1c1 -1 2 -1 4 -1s3 0 4 1l2 1l2 3z" />
+ <glyph glyph-name="ion-share" unicode="&#xf220;" horiz-adv-x="384"
+d="M288 70v59l38 31v-109c0 -11 -8 -19 -19 -19h-288c-11 0 -19 9 -19 19v218c0 11 8 19 19 19h120c-29 -18 -43 -38 -43 -38h-58v-180h250zM256 224c-84 0 -116 -24 -160 -96c0 0 5 164 160 164v60l128 -96l-128 -96v64z" />
+ <glyph glyph-name="ion-shuffle" unicode="&#xf221;"
+d="M338 267c-52 0 -83 -43 -120 -92c-41 -55 -88 -120 -171 -120h-47v63h47c52 0 84 47 121 96c41 55 87 116 170 116h29v54l81 -81l-81 -84v48h-29zM121 230c-21 21 -42 35 -74 36c-34 1 -47 0 -47 0v63h47c48 0 83 -20 113 -48c-10 -12 -19 -24 -28 -36
+c-4 -5 -7 -10 -11 -15zM367 118v47l81 -84l-81 -81v54h-29c-50 0 -87 23 -117 53c12 14 22 28 32 41c2 3 5 6 7 9c22 -24 46 -39 78 -39h29z" />
+ <glyph glyph-name="ion-skip-backward" unicode="&#xf222;" horiz-adv-x="384"
+d="M12 352h8c7 0 12 -5 12 -12v-113l187 122c2 2 5 3 8 3c8 0 16 -7 16 -17v-63l118 78c2 2 5 2 8 2c8 0 15 -7 15 -17v-286c0 -10 -7 -17 -15 -17c-3 0 -5 1 -8 3l-118 78v-64c0 -10 -8 -17 -16 -17c-3 0 -5 1 -8 3l-187 122v-113c0 -7 -5 -12 -12 -12h-8
+c-7 0 -12 5 -12 12v296c0 7 5 12 12 12z" />
+ <glyph glyph-name="ion-skip-forward" unicode="&#xf223;" horiz-adv-x="384"
+d="M372 352c7 0 12 -5 12 -12v-296c0 -7 -5 -12 -12 -12h-8c-7 0 -12 5 -12 12v113l-187 -122c-3 -2 -5 -3 -8 -3c-8 0 -15 7 -15 17v64l-119 -78c-3 -2 -5 -3 -8 -3c-8 0 -15 7 -15 17v286c0 10 7 17 15 17c3 0 6 0 8 -2l119 -78v63c0 10 7 17 15 17c3 0 6 -1 8 -3
+l187 -122v113c0 7 5 12 12 12h8z" />
+ <glyph glyph-name="ion-social-android-outline" unicode="&#xf224;" horiz-adv-x="352"
+d="M272 240h-192v-60v-89h24h16v-15v-52c0 -4 4 -8 8 -8s8 4 8 8v52v15h17h49h15v-15v-52c0 -2 1 -4 3 -6h1v0c1 -1 2 -2 4 -2h1v0v0c4 0 7 4 7 8v52v15h17h22v89v60zM288 256v0v-76v-90c0 -7 -3 -15 -10 -15h-29v-51c0 -13 -10 -24 -23 -24v0h-1c-6 0 -11 2 -15 5
+c-5 4 -9 11 -9 19v51h-49v-51c0 -13 -11 -24 -24 -24s-24 11 -24 24v51h-28c-7 0 -12 8 -12 15v90v76h224zM328 256c-4 0 -8 -4 -8 -8v-96c0 -4 4 -8 8 -8s8 4 8 8v96c0 4 -4 8 -8 8zM328 272v0c13 0 24 -11 24 -24v-96c0 -13 -11 -24 -24 -24s-24 11 -24 24v96
+c0 13 11 24 24 24zM24 256c-4 0 -8 -4 -8 -8v-96c0 -4 4 -8 8 -8s8 4 8 8v96c0 4 -4 8 -8 8zM24 272v0c13 0 24 -11 24 -24v-96c0 -13 -11 -24 -24 -24s-24 11 -24 24v96c0 13 11 24 24 24zM175 354c-14 0 -27 -3 -38 -6l-10 -4c-28 -12 -40 -37 -44 -56h186
+c-4 18 -15 43 -44 56l-10 4c-12 4 -25 6 -39 6v0v0h-1zM105 384v0h1l19 -23c13 5 30 9 50 9h1c20 0 36 -4 50 -9l20 23v0s1 -1 2 -1c1 -1 2 -3 2 -3l-19 -22c48 -21 56 -71 57 -86h-224c1 15 9 66 57 87l-19 22c0 1 1 1 2 2zM127 309c-7 0 -14 6 -14 13s6 14 14 14
+c7 0 13 -7 13 -14s-5 -13 -13 -13zM225 309c-7 0 -13 6 -13 13s5 14 13 14c7 0 13 -7 13 -14s-6 -13 -13 -13z" />
+ <glyph glyph-name="ion-social-android" unicode="&#xf225;" horiz-adv-x="352"
+d="M64 180v76h224v-76v-90c0 -7 -4 -14 -11 -14h-28v-52c0 -13 -11 -24 -24 -24v0h-1c-6 0 -10 2 -14 5c-5 4 -9 11 -9 19v52h-49v-52c0 -13 -11 -24 -24 -24s-24 11 -24 24v52h-29c-7 0 -11 7 -11 14v90zM328 272c13 0 24 -11 24 -24v-96c0 -13 -11 -24 -24 -24
+s-24 11 -24 24v96c0 13 11 24 24 24zM24 272c13 0 24 -11 24 -24v-96c0 -13 -11 -24 -24 -24s-24 11 -24 24v96c0 13 11 24 24 24zM231 359c48 -21 56 -72 57 -87h-224c1 15 8 66 56 87l-18 22c0 1 0 1 1 2s3 1 3 1l19 -23c14 5 31 9 51 9s36 -4 50 -9l20 23c0 1 1 0 2 -1
+l2 -2zM127 309c8 0 13 6 13 13s-6 14 -13 14c-8 0 -14 -7 -14 -14s7 -13 14 -13zM225 309c7 0 14 6 14 13s-7 14 -14 14c-8 0 -13 -7 -13 -14s6 -13 13 -13z" />
+ <glyph glyph-name="ion-social-angular-outline" unicode="&#xf4d8;"
+d="M224 384l-188 -69l39 -230l149 -80l149 80l39 230zM224 416v0l224 -80l-46 -272l-178 -96l-178 96l-46 272zM312 96l-27 56h-122l-27 -56h-40l128 280l128 -280h-40zM182 192h84l-42 89z" />
+ <glyph glyph-name="ion-social-angular" unicode="&#xf4d9;"
+d="M182 192l42 89l42 -89h-84zM224 416l224 -80l-46 -272l-178 -96l-178 96l-46 272zM312 96h40l-128 280l-128 -280h40l27 56h122z" />
+ <glyph glyph-name="ion-social-apple-outline" unicode="&#xf226;" horiz-adv-x="320"
+d="M238 278c-15 0 -26 -4 -37 -8c-10 -4 -21 -8 -35 -8s-25 4 -37 8c-11 4 -22 8 -34 8c-11 0 -23 -3 -34 -10c-12 -7 -23 -18 -31 -31c-12 -18 -16 -47 -13 -77c3 -34 16 -69 35 -99c13 -21 30 -45 50 -45h1c8 0 13 3 20 6c10 5 23 10 44 10v0c21 0 34 -5 44 -10
+c7 -3 12 -6 19 -6v0c22 0 44 35 52 48c8 12 12 20 17 31c-12 7 -22 16 -30 28c-10 15 -17 33 -18 52c-1 18 2 37 10 53c6 12 14 22 24 30c-14 13 -31 20 -47 20zM238 294v0c25 0 52 -14 71 -39c-63 -36 -53 -128 11 -153c-9 -20 -13 -28 -24 -46c-16 -25 -37 -56 -65 -56h-1
+c-24 0 -31 16 -63 16v0c-33 0 -40 -16 -64 -16h-1c-28 0 -48 28 -64 53c-44 69 -48 150 -21 193c19 30 50 48 78 48c29 0 47 -16 71 -16c23 0 38 16 72 16zM214 364c-11 -5 -21 -13 -28 -22c-4 -5 -9 -13 -13 -23c-1 -3 -2 -6 -2 -9c11 4 21 11 28 21c4 5 12 18 15 33z
+M230 384v0c3 -23 -6 -46 -18 -62c-13 -17 -35 -30 -56 -30h-1c-4 22 6 44 18 60c14 17 37 31 57 32z" />
+ <glyph glyph-name="ion-social-apple" unicode="&#xf227;" horiz-adv-x="320"
+d="M238 294v0c25 0 52 -14 71 -39c-63 -36 -53 -128 11 -153c-9 -20 -13 -28 -24 -46c-16 -25 -37 -56 -65 -56h-1c-24 0 -31 16 -63 16v0c-33 0 -40 -16 -64 -16h-1c-28 0 -48 28 -64 53c-44 69 -48 150 -21 193c19 30 50 48 78 48c29 0 47 -16 71 -16c23 0 38 16 72 16z
+M230 384v0c3 -23 -6 -46 -18 -62c-13 -17 -35 -30 -56 -30h-1c-4 22 6 44 18 60c14 17 37 31 57 32z" />
+ <glyph glyph-name="ion-social-bitcoin-outline" unicode="&#xf2ae;" horiz-adv-x="320"
+d="M184 400h-8v-48v-16h-16h-32h-16v16v48h-9v-48v-16h-16h-72v-16h13c11 0 19 0 25 -3s10 -7 13 -13s3 -8 3 -20v-178c0 -11 0 -18 -3 -24v-1c-1 -3 -4 -10 -12 -14h-1c-5 -3 -8 -3 -17 -3h-13l-3 -16h67h16v-16v-48h9v48v16h16h32h16v-16v-48h8v49v16h15c23 1 41 5 55 10
+c16 6 28 15 37 26c8 11 12 29 13 42c1 14 -1 29 -4 36s-8 16 -21 23c-7 4 -14 6 -21 8l-46 11l43 19c4 2 7 4 12 9c6 5 9 12 11 16c2 5 4 13 3 22c-1 17 -4 29 -10 37c-7 9 -17 16 -31 21c-12 5 -24 7 -41 8l-15 1v15v47zM200 416v0v-63c20 -1 32 -4 45 -9
+c16 -6 29 -15 38 -27s12 -28 13 -45c1 -10 0 -20 -3 -28s-8 -16 -16 -23c-6 -6 -11 -9 -16 -11c9 -2 17 -6 25 -10c15 -8 24 -18 29 -30c4 -10 6 -30 5 -44c-1 -16 -6 -37 -16 -51c-11 -14 -26 -24 -45 -31c-15 -6 -33 -10 -59 -11v-65h-40v64h-32v-64h-41v64h-87l8 48h28
+c9 0 8 1 11 2s4 3 5 6s1 9 1 18v178c0 9 0 10 -1 12s-3 4 -6 6s-9 2 -18 2h-28v48h87v64h41v-64h32v64h40zM160 298v-74h-32v74h32zM160 176v0v-90h-32v90h32zM200 294v0c6 -2 10 -7 14 -12c4 -6 6 -13 6 -21s-2 -15 -7 -21c-4 -5 -7 -9 -13 -12v66zM200 174v0
+c5 -1 8 -1 12 -3c8 -3 14 -7 19 -13s8 -15 8 -24c0 -11 -2 -19 -10 -26s-13 -11 -23 -15c-2 -1 -4 0 -6 -1v82z" />
+ <glyph glyph-name="ion-social-bitcoin" unicode="&#xf2af;" horiz-adv-x="320"
+d="M314 169c4 -10 7 -30 6 -44c-1 -16 -5 -37 -16 -51s-26 -24 -45 -31c-15 -6 -33 -10 -59 -11v-64h-40v64h-32v-64h-41v64h-87l9 48h26c9 0 9 0 12 1s4 4 5 7s2 8 2 17v173c0 9 -1 16 -2 18s-3 4 -6 6s-9 2 -18 2h-28v48h87v64h41v-64h32v64h40v-64c20 -1 33 -4 46 -9
+c16 -6 28 -15 37 -27s12 -28 13 -45c1 -10 0 -20 -3 -28c-2 -8 -8 -16 -16 -23c-6 -6 -11 -9 -16 -11c9 -2 17 -6 25 -10c15 -8 23 -18 28 -30zM128 298v-74h32v74h-32zM128 86h32v90h-32v-90zM200 294v-66c6 3 9 7 13 12c5 6 7 12 7 20s-2 15 -6 21c-4 5 -8 11 -14 13z
+M229 107c8 7 10 15 10 26c0 9 -3 19 -8 25s-12 10 -20 13c-4 2 -6 2 -11 3v-82c2 0 5 1 7 2c10 4 14 6 22 13z" />
+ <glyph glyph-name="ion-social-buffer-outline" unicode="&#xf228;" horiz-adv-x="384"
+d="M7 284c-9 4 -9 11 0 15l169 82c4 2 10 3 16 3s12 -1 16 -3l169 -82c9 -4 9 -11 0 -15l-169 -82c-4 -2 -10 -3 -16 -3s-12 1 -16 3zM183 366l-156 -75l156 -75c2 -1 5 -1 9 -1s7 0 9 1l156 75l-156 75c-2 1 -5 2 -9 2s-7 -1 -9 -2zM377 200c9 -4 9 -12 0 -16l-169 -81
+c-4 -2 -10 -4 -16 -4s-12 2 -16 4l-169 81c-9 4 -9 12 0 16c0 0 27 13 33 16c5 3 7 3 13 0s123 -60 123 -60c4 -2 10 -3 16 -3s12 1 16 3c0 0 121 59 125 61s5 2 9 0s35 -17 35 -17zM201 117l156 75l-19 9l-123 -59c-6 -3 -15 -5 -23 -5s-17 2 -23 5l-123 59l-19 -9l156 -75
+c2 -1 5 -2 9 -2s7 1 9 2zM377 100c9 -4 9 -11 0 -15l-169 -82c-4 -2 -10 -3 -16 -3s-12 1 -16 3l-169 82c-9 4 -9 11 0 15c0 0 27 14 33 17c5 3 7 2 13 -1s123 -59 123 -59c4 -2 10 -3 16 -3s12 1 16 3c0 0 121 58 125 60s5 2 9 0s35 -17 35 -17zM201 18l156 75l-19 9
+l-123 -60c-6 -3 -15 -4 -23 -4s-17 1 -23 4l-123 60l-19 -9l156 -75c2 -1 5 -2 9 -2s7 1 9 2z" />
+ <glyph glyph-name="ion-social-buffer" unicode="&#xf229;" horiz-adv-x="384"
+d="M7 284c-9 4 -9 11 0 15l169 82c4 2 10 3 16 3s12 -1 16 -3l169 -82c9 -4 9 -11 0 -15l-169 -82c-4 -2 -10 -3 -16 -3s-12 1 -16 3zM377 200c9 -4 9 -12 0 -16l-169 -81c-4 -2 -10 -4 -16 -4s-12 2 -16 4l-169 81c-9 4 -9 12 0 16c0 0 27 13 33 16c5 3 7 3 13 0
+s123 -60 123 -60c4 -2 10 -3 16 -3s12 1 16 3c0 0 121 59 125 61s5 2 9 0s35 -17 35 -17zM377 100c9 -4 9 -11 0 -15l-169 -82c-4 -2 -10 -3 -16 -3s-12 1 -16 3l-169 82c-9 4 -9 11 0 15c0 0 27 14 33 17c5 3 7 2 13 -1s123 -59 123 -59c4 -2 10 -3 16 -3s12 1 16 3
+c0 0 121 58 125 60s5 2 9 0s35 -17 35 -17z" />
+ <glyph glyph-name="ion-social-chrome-outline" unicode="&#xf4da;"
+d="M224 416c123 0 224 -101 224 -224s-101 -224 -224 -224s-224 101 -224 224s101 224 224 224zM224 371c-57 0 -109 -27 -141 -68l54 -93c8 40 43 72 87 72h155c-30 54 -89 89 -155 89zM291 192c0 37 -30 67 -67 67s-67 -30 -67 -67s30 -67 67 -67s67 30 67 67zM45 192
+c0 -91 67 -166 154 -177l54 93c-9 -3 -19 -6 -29 -6c-34 0 -61 18 -77 45v0l-78 135c-16 -27 -24 -58 -24 -90zM224 13c99 0 179 80 179 179c0 24 -4 46 -13 67h-108c19 -17 32 -40 32 -67c0 -17 -5 -32 -13 -45v0z" />
+ <glyph glyph-name="ion-social-chrome" unicode="&#xf4db;"
+d="M157 192c0 37 30 67 67 67s67 -30 67 -67s-30 -67 -67 -67s-67 30 -67 67zM445 230c2 -12 3 -25 3 -38c0 -106 -74 -195 -174 -218c-10 -2 -20 -4 -30 -5c-7 -1 -13 -1 -20 -1c-8 0 -17 0 -25 1v0v0v0v1l102 177c8 13 13 28 13 45c0 27 -13 50 -32 67h156
+c3 -9 5 -19 7 -29v0c-2 10 -4 20 -7 29v0c3 -9 5 -19 7 -29v0zM224 103c10 0 20 2 29 5l-78 -135v0c-42 9 -79 30 -108 59c-42 41 -67 97 -67 160c0 31 6 61 18 88c7 16 16 31 26 45v0l103 -178c16 -27 43 -44 77 -44zM59 343v0v1c24 26 55 47 90 59c23 8 49 13 75 13
+c73 0 138 -36 179 -90h1c10 -14 18 -29 25 -44v0c-7 15 -15 30 -25 44h-1c10 -14 19 -29 26 -44h-205c-44 0 -79 -32 -87 -72z" />
+ <glyph glyph-name="ion-social-codepen-outline" unicode="&#xf4dc;"
+d="M356 244c5 -3 7 -6 7 -12v-81c0 -6 -3 -10 -8 -13c-41 -27 -82 -55 -123 -82c-6 -4 -11 -4 -17 0c-41 27 -81 55 -122 82c-5 3 -8 7 -8 13v80c0 6 3 11 8 14c41 27 81 54 122 81c6 4 11 4 17 0c41 -27 83 -55 124 -82zM236 296v-54c0 -1 1 -2 2 -3c16 -11 31 -21 47 -32
+c1 -1 3 -1 4 0l40 26zM212 295c0 0 -62 -41 -93 -62c14 -9 27 -17 40 -26c1 -1 3 -1 4 0c15 10 31 21 46 31c1 1 3 4 3 6v51zM109 211v-40l30 20zM212 87v53c0 1 -2 3 -3 4c-15 10 -31 21 -46 31c-2 1 -3 1 -5 0l-39 -26c31 -21 93 -62 93 -62zM227 165l39 26s-34 23 -40 27
+c-1 1 -4 0 -5 -1c-5 -3 -9 -6 -14 -9c-8 -6 -25 -17 -25 -17l39 -26c2 -1 4 -1 6 0zM236 87l93 62l-38 26c-2 2 -5 2 -7 0c-15 -10 -30 -21 -45 -31c-2 -2 -3 -3 -3 -6v-51zM338 171v40l-30 -20zM224 384c-51 0 -100 -20 -136 -56s-56 -85 -56 -136s20 -100 56 -136
+s85 -56 136 -56s100 20 136 56s56 85 56 136s-20 100 -56 136s-85 56 -136 56zM224 416v0c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224z" />
+ <glyph glyph-name="ion-social-codepen" unicode="&#xf4dd;"
+d="M209 144c1 -1 3 -3 3 -4v-53s-62 41 -93 62l39 26c2 1 3 1 5 0c15 -10 31 -21 46 -31zM163 207c-1 -1 -3 -1 -4 0c-13 9 -26 17 -40 26c31 21 93 62 93 62v-51c0 -2 -2 -5 -3 -6c-15 -10 -31 -21 -46 -31zM238 239c-1 1 -2 2 -2 3v54l93 -63l-40 -26c-1 -1 -3 -1 -4 0
+c-16 11 -31 21 -47 32zM226 218c6 -4 40 -27 40 -27l-39 -26c-2 -1 -4 -1 -6 0l-39 26s17 11 25 17c5 3 9 6 14 9c1 1 4 2 5 1zM109 211l30 -20l-30 -20v40zM224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM363 151v81
+c0 6 -2 9 -7 12c-41 27 -83 55 -124 82c-6 4 -11 4 -17 0c-41 -27 -81 -54 -122 -81c-5 -3 -8 -8 -8 -14v-80c0 -6 3 -10 8 -13c41 -27 81 -55 122 -82c6 -4 11 -4 17 0c41 27 82 55 123 82c5 3 8 7 8 13zM284 175c2 2 5 2 7 0l38 -26l-93 -62v51c0 3 1 4 3 6
+c15 10 30 21 45 31zM338 171l-30 20l30 20v-40z" />
+ <glyph glyph-name="ion-social-css3-outline" unicode="&#xf4de;" horiz-adv-x="384"
+d="M291 81l-99 -28l-98 28l-7 78h48l4 -40l53 -15v0v0l54 15l5 64h-112l-4 50h121l4 51h-184l-4 49h241zM0 416h384l-35 -403l-157 -45l-157 45zM319 37l30 347h-314l30 -347l127 -36z" />
+ <glyph glyph-name="ion-social-css3" unicode="&#xf4df;" horiz-adv-x="384"
+d="M192 109v0zM0 416h384l-35 -403l-157 -45l-157 45zM291 81l22 252h-241l4 -49h184l-4 -51h-121l4 -50h112l-5 -64l-54 -15v0v0l-53 15l-4 40h-48l7 -78l98 -28z" />
+ <glyph glyph-name="ion-social-designernews-outline" unicode="&#xf22a;"
+d="M259 302v-53l-65 103zM0 188zM297 352l151 -119v-201h-248l-200 156h63c46 0 77 33 77 82c0 20 -5 37 -15 51l-3 3l37 -29v-107h41l-2 98l63 -98h36v84v80zM432 48v178l-119 92v1v-47v-83v-17h-15h-37h-9l-4 8l-33 50l1 -42v-16h-16h-41h-16v16v29c-3 -6 -7 -12 -12 -17
+c-8 -9 -18 -16 -30 -21s-24 -7 -38 -7h-16l159 -124h226zM59 298h-1h-3v-57h4c8 0 13 2 17 6c5 6 6 15 6 22c0 26 -12 29 -23 29zM59 314v0c25 0 39 -16 39 -45c0 -28 -14 -44 -40 -44h-19v89h20z" />
+ <glyph glyph-name="ion-social-designernews" unicode="&#xf22b;"
+d="M258 303l1 -53l-64 102zM297 352l151 -118v-202h-248l-200 157v0h63c46 0 77 33 77 82c0 20 -5 37 -15 51l-3 3l37 -29v-107h40l-2 99l64 -99h36v83v80zM98 270c0 -28 -14 -44 -40 -44h-19v89h19c26 0 40 -16 40 -45z" />
+ <glyph glyph-name="ion-social-dribbble-outline" unicode="&#xf22c;" horiz-adv-x="384"
+d="M192 384c106 0 192 -86 192 -192s-86 -192 -192 -192s-192 86 -192 192s86 192 192 192zM314 296c-17 -25 -47 -47 -85 -64c5 -10 9 -20 13 -31c33 3 75 4 110 2c-2 35 -16 68 -38 93zM192 352c-14 0 -26 -2 -39 -5c23 -23 43 -53 62 -87c34 14 62 33 79 55
+c-28 23 -63 37 -102 37zM120 334c-41 -21 -71 -58 -83 -103h25c44 0 85 6 121 17c-19 34 -40 63 -63 86zM32 200v-8c0 -40 15 -78 40 -106c24 45 67 83 122 106c4 2 8 3 14 4c-3 8 -6 16 -10 24c-40 -13 -88 -20 -138 -21c-9 0 -19 1 -28 1zM192 32c20 0 39 3 57 10
+c-3 25 -8 53 -15 79c-4 17 -10 33 -16 49c-7 -2 -13 -4 -17 -6c-48 -22 -86 -56 -107 -98c27 -21 61 -34 98 -34zM278 58c40 26 68 67 73 116c-30 2 -68 3 -99 0c4 -12 9 -25 12 -38c7 -27 11 -52 14 -78z" />
+ <glyph glyph-name="ion-social-dribbble" unicode="&#xf22d;" horiz-adv-x="384"
+d="M192 384c106 0 192 -86 192 -192s-86 -192 -192 -192s-192 86 -192 192s86 192 192 192zM192 32c88 0 160 72 160 160s-72 160 -160 160s-160 -72 -160 -160s72 -160 160 -160zM242 201c-4 11 -8 21 -13 31c25 11 47 24 63 39c15 -19 26 -42 28 -67c-26 0 -55 -1 -78 -3z
+M271 292c-15 -12 -34 -23 -56 -32c-12 22 -24 41 -38 59c5 1 10 1 15 1c30 0 57 -11 79 -28zM142 310c15 -18 28 -39 41 -62c-34 -10 -72 -16 -113 -17c11 36 38 65 72 79zM319 176c-4 -33 -21 -63 -46 -83c-3 14 -5 28 -9 43c-3 13 -8 26 -12 38c21 2 45 3 67 2zM194 192
+c-43 -18 -79 -46 -104 -78c-16 22 -26 49 -26 78v7c49 1 95 8 134 21c4 -8 7 -16 10 -24c-6 -1 -10 -2 -14 -4zM219 170c6 -16 11 -32 15 -49c4 -15 7 -31 10 -46c-16 -7 -34 -11 -52 -11c-31 0 -59 11 -81 29c22 30 53 54 90 71c4 2 11 4 18 6z" />
+ <glyph glyph-name="ion-social-dropbox-outline" unicode="&#xf22e;" horiz-adv-x="384"
+d="M113 371l79 -66l-114 -71l-78 63zM27 295l52 -42l86 53l-53 46zM306 235l78 -63l-78 -51v-39l-114 -69l-114 68v39l-78 52l78 63l114 -71l-79 -66l-19 12v-20l98 -59l98 59v20l-19 -12l-79 66zM79 217l-52 -44l85 -55l53 44zM219 162l53 -44l85 56l-52 43zM384 297
+l-78 -63l-114 71l79 66zM219 305l86 -52l52 42l-85 56z" />
+ <glyph glyph-name="ion-social-dropbox" unicode="&#xf22f;" horiz-adv-x="384"
+d="M113 371l79 -66l-114 -71l-78 63zM0 172l78 62l114 -70l-79 -66zM192 164l114 70l78 -62l-113 -74zM384 297l-78 -63l-114 71l79 66zM192 150l80 -66l34 22v-25l-114 -68l-114 68v25l34 -22z" />
+ <glyph glyph-name="ion-social-euro-outline" unicode="&#xf4e0;" horiz-adv-x="320"
+d="M214 384c-53 0 -91 -9 -115 -27c-22 -16 -33 -40 -33 -74v-11v-17h-16h-34v-16h34h16v-15v-48v-17h-16h-34v-16h34h16v-15v-27c0 -34 11 -58 33 -74c24 -18 62 -27 115 -27c31 0 59 2 88 8l-5 35c-30 -4 -55 -7 -80 -7c-36 0 -59 6 -74 19c-19 16 -21 40 -21 60v13v15h16
+h103l3 16h-106h-16v17v48v15h16h118l2 16h-120h-16v17v2c0 16 2 39 21 55c16 13 39 19 74 19c24 0 51 -3 80 -7l5 35c-29 6 -57 8 -88 8zM214 400v0c35 0 68 -3 106 -12l-9 -65c-37 6 -68 9 -94 9c-64 0 -79 -22 -79 -58v-3h139l-8 -48h-131v-48h124l-7 -48h-117v-12
+c0 -44 15 -63 79 -63c26 0 57 3 94 9l9 -65c-38 -9 -71 -12 -106 -12c-115 0 -164 41 -164 117v26h-50v48h50v48h-50v48h50v12c0 76 49 117 164 117z" />
+ <glyph glyph-name="ion-social-euro" unicode="&#xf4e1;" horiz-adv-x="320"
+d="M138 176h124l-7 -48h-117v-13c0 -44 15 -63 79 -63c26 0 56 3 93 9l10 -65c-38 -9 -71 -12 -106 -12c-115 0 -164 41 -164 117v27h-50v48h50v48h-50v48h50v11c0 76 49 117 164 117c35 0 68 -3 106 -12l-10 -65c-37 6 -67 9 -93 9c-64 0 -79 -22 -79 -58v-2h138l-7 -48
+h-131v-48z" />
+ <glyph glyph-name="ion-social-facebook-outline" unicode="&#xf230;" horiz-adv-x="192"
+d="M128 256h64l-8 -64h-56v-192h-83v192h-45v64h45v43c0 54 23 85 91 85h56v-64h-34c-27 0 -30 -9 -30 -26v-38zM170 208l4 32h-45h-17v17v37c0 10 1 21 9 30c10 11 25 12 37 12h18v32h-40c-28 0 -49 -6 -60 -18c-10 -11 -15 -27 -15 -51v-43v-16h-15h-30v-32h30h15v-16
+v-176h51v176v16h17h41z" />
+ <glyph glyph-name="ion-social-facebook" unicode="&#xf231;" horiz-adv-x="192"
+d="M128 256h64l-8 -64h-56v-192h-83v192h-45v64h45v43c0 54 23 85 91 85h56v-64h-34c-27 0 -30 -9 -30 -26v-38z" />
+ <glyph glyph-name="ion-social-foursquare-outline" unicode="&#xf34c;" horiz-adv-x="320"
+d="M302 284c-12 -60 -25 -131 -27 -138zM281 416c35 0 45 -20 37 -57c-3 -16 -10 -44 -16 -75l-27 -137c-3 -13 -8 -35 -39 -35h-72c-3 0 -3 0 -6 -3c-2 -2 -115 -133 -115 -133c-9 -10 -23 -8 -28 -6s-15 8 -15 26v380s10 40 43 40h238zM280 352c6 31 6 32 -24 32h-195
+c-29 0 -29 -3 -29 -28v-297c0 -38 1 -38 3 -38s10 8 29 31c0 0 78 89 79 90c2 2 3 2 6 2h62c26 0 28 6 33 31c4 21 36 177 36 177zM302 284c6 31 13 59 16 75zM233 352c5 0 9 -5 8 -11l-8 -44c-1 -4 -6 -9 -11 -9h-75c-8 0 -8 -5 -8 -13v-6c0 -8 0 -13 8 -13h64
+s11 -6 10 -12s-11 -51 -12 -54s-4 -9 -11 -9h-62c-9 0 -11 -1 -17 -8l-54 -63c-1 -1 -1 -1 -1 0v231c0 5 5 11 11 11h158z" />
+ <glyph glyph-name="ion-social-foursquare" unicode="&#xf34d;" horiz-adv-x="320"
+d="M281 416c35 0 45 -20 37 -57c-10 -49 -40 -202 -43 -213c-3 -13 -8 -34 -39 -34h-72c-3 0 -3 0 -6 -3c-2 -2 -115 -133 -115 -133c-9 -10 -23 -8 -28 -6s-15 8 -15 26v380s10 40 43 40h238zM275 146c3 11 33 164 43 213zM267 351c2 9 -5 16 -12 16h-191
+c-9 0 -15 -8 -15 -15v-296c0 -1 1 -1 2 0c0 0 70 84 78 94s11 11 23 11h64c9 0 14 8 15 12s8 43 10 51s-6 16 -13 16h-82c-10 0 -18 8 -18 18v13c0 10 8 17 18 17h96s14 6 15 12z" />
+ <glyph glyph-name="ion-social-freebsd-devil" unicode="&#xf2c4;" horiz-adv-x="512"
+d="M503 333c19 -37 8 -81 -20 -108s-60 -33 -60 -33c2 -32 16 -59 -41 -102c-43 -32 2 -90 2 -90c10 -14 23 -19 32 -32h-272s15 14 -7 32c0 0 -20 17 -18 29s6 13 9 15s0 7 0 7l-19 19s-13 -13 -44 -13c-38 0 -65 39 -65 39h46s-6 -8 -7 -13c-1 -4 1 -5 1 -5s11 -6 22 -6
+c17 0 33 12 33 12l-24 22l-15 -4l-16 37l39 -10l-1 -15l28 -18s9 9 7 27s-9 26 -9 26s-4 0 -9 -4s-6 -6 -6 -6l-10 44s43 -19 50 -63c3 -20 -6 -35 -6 -35l17 -10s6 5 17 7s23 2 29 -8s5 -12 4 -19s0 -9 6 -11s6 -6 11 -8s15 -6 21 -2s8 11 8 18v16s-9 8 -32 20
+s-54 22 -66 40s-12 44 0 57c9 10 23 25 26 35c4 14 4 42 4 42s-10 16 -8 40c2 30 22 84 96 114c0 0 -40 -55 -20 -80c0 0 37 11 77 9c31 -2 56 -12 73 -28s25 -23 47 -17s28 17 28 33c0 19 -16 51 -16 51s36 -7 58 -51zM195 245c14 4 21 -11 21 -11c14 25 30 60 22 64
+s-64 -25 -66 -88c0 0 6 31 23 35zM232 230c5 7 34 8 37 -17c4 -35 -24 -57 -24 -57s7 -2 23 2c17 4 43 29 43 70s-21 66 -41 62s-38 -60 -38 -60z" />
+ <glyph glyph-name="ion-social-github-outline" unicode="&#xf232;"
+d="M224 416c124 0 224 -103 224 -230c0 -101 -64 -188 -153 -218h-4c-8 0 -12 7 -12 12c0 8 1 31 1 62c0 21 -8 36 -16 43c50 6 103 25 103 113c0 25 -9 46 -23 62c2 6 10 29 -2 61h-5c-8 0 -27 -3 -57 -24c-18 5 -37 8 -56 8s-38 -3 -56 -8c-30 21 -49 24 -57 24h-5
+c-12 -32 -4 -55 -2 -61c-14 -16 -23 -37 -23 -62c0 -88 52 -107 102 -113c-6 -6 -12 -16 -14 -31c-6 -3 -16 -6 -26 -6c-13 0 -28 5 -39 25c0 0 -13 22 -35 24v0c-2 0 -21 0 -1 -14c0 0 15 -8 25 -34c0 0 10 -33 53 -33c7 0 14 0 22 2v-39c0 -5 -3 -11 -11 -11h-4
+c-89 30 -153 116 -153 218c0 127 100 230 224 230zM146 -0c-15 0 -28 4 -38 9c14 -10 28 -17 44 -23v6v8h-6zM157 73c-16 4 -35 10 -52 24c6 -6 11 -11 13 -16c7 -12 14 -17 25 -17c4 0 9 1 12 2c1 2 1 5 2 7zM347 14c17 13 32 28 45 46c26 37 40 80 40 126
+c0 29 -5 58 -16 84c-10 25 -26 48 -45 68s-41 34 -66 45c-26 11 -53 17 -81 17s-55 -6 -81 -17c-25 -11 -47 -25 -66 -45s-35 -42 -45 -68c-11 -26 -16 -55 -16 -84c0 -46 14 -89 40 -126c10 -14 22 -27 35 -38c-7 8 -11 16 -13 22c-7 18 -15 24 -17 25h-2v1
+c-5 3 -20 13 -15 28c3 9 12 15 25 15h1v0v0c13 -1 24 -6 32 -13c-21 19 -37 48 -37 98c0 24 7 47 21 66c-3 13 -6 34 5 62l3 8l7 2c2 0 5 1 10 1c12 0 31 -3 60 -22c17 4 35 6 53 6v0v0c18 0 36 -2 53 -6c29 19 48 22 60 22c5 0 8 -1 10 -1l7 -2l3 -7c11 -27 8 -50 5 -63
+c14 -19 21 -41 21 -66c0 -92 -55 -117 -92 -125c3 -8 5 -18 5 -30v-51v-6c18 7 35 16 51 28z" />
+ <glyph glyph-name="ion-social-github" unicode="&#xf233;"
+d="M224 416c124 0 224 -103 224 -230c0 -101 -64 -188 -153 -218h-4c-8 0 -12 7 -12 12c0 8 1 31 1 62c0 21 -8 36 -16 43c50 6 103 25 103 113c0 25 -9 46 -23 62c2 6 10 29 -2 61h-5c-8 0 -27 -3 -57 -24c-18 5 -37 8 -56 8s-38 -3 -56 -8c-30 21 -49 24 -57 24h-5
+c-12 -32 -4 -55 -2 -61c-14 -16 -23 -37 -23 -62c0 -88 52 -107 102 -113c-6 -6 -12 -16 -14 -31c-6 -3 -16 -6 -26 -6c-13 0 -28 5 -39 25c0 0 -13 22 -35 24v0c-2 0 -21 0 -1 -14c0 0 15 -8 25 -34c0 0 10 -33 53 -33c7 0 14 0 22 2v-39c0 -5 -3 -11 -11 -11h-4
+c-89 30 -153 116 -153 218c0 127 100 230 224 230z" />
+ <glyph glyph-name="ion-social-google-outline" unicode="&#xf34e;" horiz-adv-x="256"
+d="M191 366c12 -10 37 -30 37 -68c0 -37 -21 -55 -43 -72c-7 -7 -15 -13 -15 -24s8 -17 14 -22l18 -14c23 -19 43 -36 43 -71c0 -47 -47 -95 -135 -95c-74 0 -110 35 -110 72c0 18 10 44 40 62c32 19 75 21 98 23c-7 9 -16 18 -16 34c0 9 2 14 5 20c-6 0 -11 -1 -16 -1
+c-54 0 -85 40 -85 79c0 23 11 48 33 67c29 24 63 28 91 28h106l-33 -18h-32zM155 142c-4 1 -7 1 -12 1s-32 -1 -54 -8c-11 -4 -44 -16 -44 -52s36 -62 91 -62c49 0 75 24 75 55c0 26 -17 39 -56 66zM170 238c12 12 13 28 13 37c0 36 -22 92 -65 92c-13 0 -28 -6 -36 -16
+c-9 -11 -11 -25 -11 -38c0 -34 20 -89 64 -89c13 0 27 6 35 14z" />
+ <glyph glyph-name="ion-social-google" unicode="&#xf34f;" horiz-adv-x="288"
+d="M210 172c22 -18 45 -36 45 -73c0 -49 -48 -99 -140 -99c-80 0 -115 39 -115 77c0 10 3 42 42 65c27 16 61 20 85 22c-4 7 -8 16 -8 27c0 4 0 7 1 10h-4c-19 0 -46 4 -67 26c-15 15 -24 36 -24 57c0 26 13 53 35 71v0c32 25 70 29 95 29h133l-60 -33h-13
+c11 -13 23 -31 23 -58c0 -40 -25 -59 -45 -74v-1c-6 -6 -11 -10 -11 -17c0 -6 4 -10 10 -15v0zM85 308c0 -13 4 -33 14 -51c7 -12 20 -27 41 -27c10 0 21 4 28 11c10 10 10 25 10 30c0 18 -6 38 -15 54c-7 13 -20 27 -40 27c-11 0 -22 -5 -29 -13c-6 -7 -9 -18 -9 -31z
+M206 80c0 20 -13 31 -50 56c-3 0 -4 1 -8 1c-6 0 -32 -2 -51 -8c-16 -6 -37 -16 -37 -42c0 -31 32 -51 80 -51c41 0 66 17 66 44z" />
+ <glyph glyph-name="ion-social-googleplus-outline" unicode="&#xf234;"
+d="M192 366c12 -10 36 -30 36 -68c0 -37 -21 -55 -43 -72c-7 -7 -15 -13 -15 -24s8 -18 14 -22l18 -14c23 -19 43 -36 43 -71c0 -47 -47 -95 -135 -95c-74 0 -110 35 -110 72c0 18 10 44 40 62c32 19 75 21 98 23c-7 9 -16 18 -16 34c0 9 3 14 5 20c-6 0 -11 -1 -16 -1
+c-54 0 -85 40 -85 79c0 23 10 48 32 67c29 24 64 28 92 28h106l-33 -18h-31zM155 142c-4 0 -7 1 -12 1s-32 -1 -54 -8c-11 -4 -44 -16 -44 -52s36 -62 91 -62c49 0 75 24 75 55c0 26 -17 39 -56 66zM170 238c12 12 13 28 13 37c0 36 -22 92 -65 92c-13 0 -28 -6 -36 -16
+c-9 -11 -11 -24 -11 -37c0 -34 20 -90 64 -90c13 0 27 6 35 14zM448 306v-18h-78v-81h-18v81h-80v18h80v78h18v-78h78z" />
+ <glyph glyph-name="ion-social-googleplus" unicode="&#xf235;"
+d="M210 172c22 -18 45 -36 45 -73c0 -49 -47 -99 -139 -99c-80 0 -116 39 -116 77c0 10 3 42 42 65c27 16 61 21 85 23c-4 7 -8 15 -8 26c0 4 0 7 1 10h-4c-19 0 -46 4 -67 26c-15 15 -24 36 -24 57c0 26 13 53 35 71v0c32 25 69 29 94 29h134l-60 -33h-13
+c11 -13 23 -31 23 -58c0 -40 -25 -59 -45 -74v-1c-6 -6 -11 -10 -11 -17c0 -6 4 -10 10 -15v0zM85 308c0 -13 4 -33 14 -51c7 -12 21 -27 41 -27c10 0 21 4 28 11c10 10 10 25 10 30c0 18 -6 37 -15 53c-8 13 -20 28 -40 28c-11 0 -23 -5 -29 -13c-6 -7 -9 -18 -9 -31z
+M206 80c0 20 -13 31 -50 56c-3 0 -4 1 -8 1c-6 0 -31 -2 -50 -8c-16 -6 -38 -16 -38 -42c0 -31 32 -51 80 -51c41 0 66 17 66 44zM370 306h78v-34h-78v-81h-34v81h-80v34h80v78h34v-78z" />
+ <glyph glyph-name="ion-social-hackernews-outline" unicode="&#xf236;" horiz-adv-x="384"
+d="M352 352h-320v-320h320v320zM384 384v0v-384h-384v384h384zM233 289h45l-64 -120v-72h-40v72l-66 120h47l40 -84z" />
+ <glyph glyph-name="ion-social-hackernews" unicode="&#xf237;" horiz-adv-x="384"
+d="M0 384h384v-384h-384v384zM214 169l64 120h-45l-38 -84l-40 84h-47l66 -120v-72h40v72z" />
+ <glyph glyph-name="ion-social-html5-outline" unicode="&#xf4e2;" horiz-adv-x="384"
+d="M0 416h384l-35 -403l-157 -45l-157 45zM319 37l30 347h-314l30 -347l127 -36zM84 184l-13 150h241l-4 -50h-184l4 -51h176l-14 -151l-98 -28l-99 28l-6 77h48l3 -39l54 -15l53 15l6 64h-167z" />
+ <glyph glyph-name="ion-social-html5" unicode="&#xf4e3;" horiz-adv-x="384"
+d="M0 416h384l-35 -403l-157 -45l-157 45zM308 284l4 50h-241l13 -150h167l-6 -64l-53 -15l-54 15l-3 39h-48l6 -78l99 -27l98 28l14 151h-176l-4 51h184z" />
+ <glyph glyph-name="ion-social-instagram-outline" unicode="&#xf350;" horiz-adv-x="384"
+d="M384 336v-289c0 -26 -22 -47 -48 -47h-288c-26 0 -48 21 -48 47v289c0 26 22 48 48 48h288c26 0 48 -22 48 -48zM192 272c-44 0 -80 -36 -80 -80s36 -80 80 -80s80 36 80 80s-36 80 -80 80zM352 288v48c0 9 -7 16 -16 16h-48c-9 0 -16 -7 -16 -16v-48c0 -9 7 -16 16 -16
+h48c9 0 16 7 16 16zM337 32c9 0 15 7 15 16v176h-52c3 -10 4 -21 4 -32c0 -30 -11 -58 -32 -79s-50 -33 -80 -33s-58 12 -79 33s-33 49 -33 79c0 11 2 22 5 32h-53v-176c0 -9 8 -16 17 -16h288z" />
+ <glyph glyph-name="ion-social-instagram" unicode="&#xf351;" horiz-adv-x="384"
+d="M112 192c0 53 27 80 80 80s80 -27 80 -80s-27 -80 -80 -80s-80 27 -80 80zM113 271c-14 -14 -23 -29 -28 -47h-85v112c0 13 4 25 14 34s22 14 35 14h288c13 0 24 -5 33 -14s14 -21 14 -34v-112h-84c-5 18 -14 33 -28 47c-22 22 -49 33 -80 33s-57 -11 -79 -33zM352 300
+v39c0 4 -2 7 -4 9s-5 4 -9 4h-38c-4 0 -7 -2 -9 -4s-4 -5 -4 -9v-39c0 -4 2 -7 4 -9s5 -3 9 -3h38c4 0 7 1 9 3s4 5 4 9zM272 113c22 22 32 48 32 79h80v-144c0 -13 -5 -24 -14 -34s-20 -14 -33 -14h-288c-13 0 -24 4 -34 14s-15 21 -15 34v144h81c0 -31 10 -57 32 -79
+s48 -33 79 -33s58 11 80 33z" />
+ <glyph glyph-name="ion-social-javascript-outline" unicode="&#xf4e4;"
+d="M160 344h-48v-196c0 -30 -6 -50 -17 -64c-11 -13 -26 -20 -48 -20c-9 0 -18 1 -25 2l-4 -30c11 -2 25 -4 37 -4c34 0 59 8 76 25c19 18 29 48 29 90v197zM176 360v0v-213c0 -97 -49 -131 -121 -131c-18 0 -40 3 -55 8l8 62c10 -4 24 -6 39 -6c31 0 49 15 49 68v212h80z
+M350 352c-34 0 -62 -9 -82 -26c-19 -15 -28 -36 -28 -60c0 -20 7 -36 21 -51c14 -14 34 -26 61 -36c23 -8 38 -15 48 -24c12 -11 18 -23 18 -38c0 -16 -7 -31 -20 -40c-12 -9 -28 -14 -48 -14c-28 0 -52 8 -70 15l-7 -32c18 -8 44 -14 72 -14c38 0 70 9 90 27
+c18 16 27 38 27 63c0 21 -5 36 -17 50s-31 27 -58 37v0v0c-38 15 -72 28 -72 63c0 14 7 27 19 36c11 9 26 13 45 13c24 0 43 -5 57 -11l10 32c-19 6 -42 10 -66 10zM350 368v0c38 0 65 -7 85 -16l-19 -64c-13 7 -35 17 -67 17s-48 -16 -48 -33c0 -22 19 -31 62 -48
+c58 -22 85 -53 85 -102c0 -57 -42 -106 -133 -106c-38 0 -72 10 -91 21l15 63v0c20 -11 49 -21 81 -21c34 0 52 15 52 38c0 21 -15 33 -55 47c-55 20 -93 52 -93 102c0 58 49 102 126 102z" />
+ <glyph glyph-name="ion-social-javascript" unicode="&#xf4e5;"
+d="M176 360v0v-213c0 -97 -49 -131 -121 -131c-18 0 -40 3 -55 8l8 62c10 -4 24 -6 39 -6c31 0 49 15 49 68v212h80zM350 368v0c38 0 65 -7 85 -16l-19 -64c-13 7 -35 17 -67 17s-48 -16 -48 -33c0 -22 19 -31 62 -48c58 -22 85 -53 85 -102c0 -57 -42 -106 -133 -106
+c-38 0 -72 10 -91 21l15 63v0c20 -11 49 -21 81 -21c34 0 52 15 52 38c0 21 -15 33 -55 47c-55 20 -93 52 -93 102c0 58 49 102 126 102z" />
+ <glyph glyph-name="ion-social-linkedin-outline" unicode="&#xf238;" horiz-adv-x="384"
+d="M119 64v0h-55v171h55v-171zM93 261v0v0c-18 0 -29 13 -29 29c0 17 12 30 30 30s29 -13 29 -30c0 -16 -12 -29 -30 -29zM257 239c36 0 63 -24 63 -75v-100h-55v94c0 22 -8 37 -28 37c-15 0 -24 -10 -28 -20c-2 -4 -2 -9 -2 -14v-97h-55v171h55v-24c8 11 21 28 50 28z
+M353 384c18 0 31 -13 31 -30v-321c0 -17 -13 -33 -31 -33h-320c-18 0 -33 16 -33 33v321c0 17 15 30 33 30h320zM350 32c1 0 2 1 2 2v316c0 1 -1 2 -2 2h-316s-2 -1 -2 -2v-315s1 -3 3 -3h315z" />
+ <glyph glyph-name="ion-social-linkedin" unicode="&#xf239;" horiz-adv-x="384"
+d="M353 384c18 0 31 -13 31 -30v-321c0 -17 -13 -33 -31 -33h-320c-18 0 -33 16 -33 33v321c0 17 15 30 33 30h320zM119 64v171h-55v-171h55zM93 261c18 0 30 13 30 29c0 17 -11 30 -29 30s-30 -13 -30 -30c0 -16 11 -29 29 -29v0zM320 64v100c0 51 -27 75 -63 75
+c-29 0 -42 -17 -50 -28v24h-55v-171h55v97c0 5 0 10 2 14c4 10 13 20 28 20c20 0 28 -15 28 -37v-94h55z" />
+ <glyph glyph-name="ion-social-markdown" unicode="&#xf4e6;"
+d="M416 352c18 0 32 -14 32 -32v-256c0 -18 -14 -32 -32 -32h-384c-18 0 -32 14 -32 32v256c0 18 14 32 32 32h384zM252 96v0v192h-56l-42 -68l-42 68h-56v-192h56v96l42 -54l42 54v-96h56zM336 96v0l70 96h-42v96h-56v-96h-42z" />
+ <glyph glyph-name="ion-social-nodejs" unicode="&#xf4e7;" horiz-adv-x="384"
+d="M192 -32c-6 0 -12 2 -17 5l-53 32c-8 5 -4 6 -1 7c11 4 14 5 25 12c1 1 3 1 4 0l39 -23c1 -1 4 -1 5 0l156 92c1 1 2 2 2 4v187c0 2 0 4 -2 5l-156 94c-1 1 -3 1 -4 0l-155 -94c-2 -1 -3 -3 -3 -5v-187c0 -2 0 -3 2 -4l40 -24c24 -12 38 1 38 15v183c0 3 2 5 5 5h22
+c3 0 5 -2 5 -5v-183c0 -33 -19 -52 -49 -52c-9 0 -17 1 -37 11l-41 24c-10 6 -17 18 -17 30v190c0 12 7 24 17 30l158 95c10 6 24 6 34 0l158 -95c10 -6 17 -18 17 -30v-190c0 -12 -7 -24 -17 -30l-158 -94c-5 -3 -11 -5 -17 -5v0zM241 96c-65 0 -84 31 -84 59c0 3 1 5 4 5
+h21c2 0 5 -2 5 -4c3 -22 16 -31 54 -31c33 0 47 11 47 29c0 11 -3 18 -55 23c-43 4 -71 15 -71 51c0 33 28 52 73 52c46 0 76 -14 79 -51c0 -1 -1 -2 -2 -3s-2 -2 -3 -2h-20c-2 0 -5 2 -5 4c-4 17 -16 23 -49 23c-36 0 -41 -12 -41 -22c0 -12 5 -16 54 -23s72 -16 72 -51
+c0 -36 -29 -59 -79 -59v0v0z" />
+ <glyph glyph-name="ion-social-octocat" unicode="&#xf4e8;"
+d="M146 161c9 0 16 -4 22 -13s10 -20 10 -32s-4 -22 -10 -31s-14 -13 -22 -13c-9 0 -17 4 -23 13s-9 19 -9 31s3 24 9 32c6 9 14 13 23 13zM303 161c9 0 16 -4 22 -13s9 -20 9 -32s-3 -22 -9 -31s-13 -13 -22 -13s-18 4 -24 13s-9 19 -9 31s3 24 9 32c6 9 15 13 24 13z
+M414 276c24 -27 34 -66 34 -96c0 -24 -1 -46 -6 -65c-6 -19 -13 -35 -21 -47c-9 -12 -19 -23 -32 -32s-24 -17 -34 -21s-22 -8 -36 -10c-13 -2 -24 -4 -31 -4c0 0 -28 -1 -64 -1s-64 1 -64 1c-7 0 -18 2 -31 4c-14 2 -26 6 -36 10s-22 12 -34 21c-13 9 -23 20 -32 32
+c-8 12 -15 28 -21 47c-5 19 -6 41 -6 65c0 31 10 70 34 96c0 0 -2 14 0 39s7 48 16 69c30 -3 67 -20 112 -51c15 4 36 6 62 6c28 0 48 -2 62 -6c20 14 39 24 58 33c19 8 33 13 41 15s13 3 13 3c9 -21 14 -44 16 -69s0 -39 0 -39v0zM348 42c28 13 42 40 42 81
+c0 24 -8 43 -26 59c-9 9 -20 13 -32 15s-31 1 -56 -1s-40 -4 -52 -4s-25 2 -42 3s-30 3 -39 3c-10 0 -20 1 -31 -2s-21 -7 -28 -14c-17 -15 -25 -35 -25 -59c0 -41 13 -68 41 -81c27 -13 69 -18 123 -18h2c54 0 95 5 123 18z" />
+ <glyph glyph-name="ion-social-pinterest-outline" unicode="&#xf2b0;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224s-224 100 -224 224s100 224 224 224zM360 56c36 36 56 85 56 136s-20 100 -56 136s-85 56 -136 56s-100 -20 -136 -56s-56 -85 -56 -136s20 -100 56 -136c14 -14 31 -25 48 -34c1 6 2 10 3 16c4 18 29 122 29 122
+s-8 15 -8 36c0 33 20 58 44 58c20 0 30 -16 30 -34c0 -20 -13 -51 -20 -79c-6 -24 12 -43 35 -43c42 0 71 54 71 119c0 49 -33 85 -93 85c-68 0 -110 -50 -110 -107c0 -20 6 -33 15 -44c4 -5 5 -6 3 -12c-1 -4 -4 -14 -5 -18c-2 -6 -6 -8 -11 -6c-31 13 -46 48 -46 86
+c0 64 54 140 160 140c86 0 142 -63 142 -129c0 -88 -49 -153 -121 -153c-24 0 -47 13 -55 28c0 0 -12 -52 -15 -62c-2 -6 -4 -13 -7 -19c15 -4 31 -6 47 -6c51 0 100 20 136 56z" />
+ <glyph glyph-name="ion-social-pinterest" unicode="&#xf2b1;"
+d="M224 416c124 0 224 -100 224 -224s-100 -224 -224 -224c-22 0 -44 3 -64 9c8 14 18 31 23 48c3 10 16 62 16 62c8 -15 30 -28 54 -28c72 0 121 65 121 153c0 66 -56 129 -142 129c-106 0 -160 -76 -160 -140c0 -39 15 -73 46 -86c5 -2 10 0 12 6c1 4 3 14 4 18
+c2 6 1 7 -3 12c-9 11 -15 24 -15 44c0 57 42 107 110 107c60 0 94 -36 94 -85c0 -65 -29 -119 -71 -119c-24 0 -42 19 -36 43c7 28 20 59 20 79c0 18 -10 34 -30 34c-24 0 -43 -25 -43 -58c0 -21 7 -36 7 -36s-25 -104 -29 -122c-4 -17 -5 -35 -4 -51
+c-79 35 -134 113 -134 205c0 124 100 224 224 224z" />
+ <glyph glyph-name="ion-social-python" unicode="&#xf4e9;" horiz-adv-x="384"
+d="M129 199c-29 -5 -49 -30 -49 -57v-43v-3h-15c-29 0 -54 29 -62 69c-2 9 -3 17 -3 27v1c0 53 29 95 65 95h127v16h-96v29c0 26 7 40 46 47c13 2 29 4 45 4s39 -1 55 -4c25 -4 46 -22 46 -47v-57v-31c0 -21 -14 -38 -33 -43c-4 -1 -8 -2 -13 -2h-104h3c-4 0 -8 0 -12 -1z
+M140 321c10 0 17 7 17 17s-7 18 -17 18s-18 -8 -18 -18s8 -17 18 -17zM380 225c3 -10 4 -21 4 -33c0 -16 -3 -30 -7 -43c-11 -31 -33 -53 -58 -53h-127v-16h96v-26c0 -26 -23 -40 -46 -47c-35 -10 -68 -9 -97 0c-25 7 -49 22 -49 47v54v33c0 21 14 36 33 41c4 1 8 2 13 2
+h104c3 0 6 1 9 1c27 4 49 28 49 62v38v3h15c28 0 52 -26 61 -63zM244 65c-10 0 -18 -7 -18 -17s8 -18 18 -18s17 8 17 18s-7 17 -17 17z" />
+ <glyph glyph-name="ion-social-reddit-outline" unicode="&#xf23a;" horiz-adv-x="449"
+d="M259 160c0 21 11 31 32 31s32 -10 32 -31s-11 -32 -32 -32s-32 11 -32 32zM127 160c0 21 11 31 32 31s32 -10 32 -31s-11 -32 -32 -32s-32 11 -32 32zM449 197c0 -20 -9 -36 -27 -45c1 -5 1 -9 1 -14c0 -38 -19 -71 -58 -98s-85 -40 -140 -40s-102 13 -141 40
+s-58 59 -58 97c0 5 0 10 1 15c-18 9 -27 24 -27 45c0 14 5 25 15 35s21 15 35 15c13 0 24 -4 33 -13c36 25 79 39 129 41h7l29 98l86 -17c8 19 21 28 41 28c12 0 22 -4 31 -13s13 -20 13 -32s-4 -23 -13 -32s-19 -13 -31 -13s-23 4 -32 13s-13 19 -13 31l-69 14l-24 -77
+c50 -2 94 -16 129 -41c10 9 21 13 34 13c9 0 16 -3 24 -7s14 -10 18 -18s7 -16 7 -25zM375 366c-4 0 -8 -1 -11 -2s-6 -4 -8 -6s-5 -6 -6 -9s-2 -6 -2 -10c0 -8 3 -14 8 -19s12 -8 19 -8c5 0 9 1 13 3s8 6 10 10s4 9 4 14c0 8 -3 14 -8 19s-12 8 -19 8zM18 197
+c0 -11 5 -20 14 -27c7 19 19 37 37 53c-6 4 -12 6 -19 6c-3 0 -7 0 -10 -1s-6 -3 -9 -5s-5 -4 -7 -7s-4 -6 -5 -9s-1 -6 -1 -10zM355 55c34 23 50 51 50 83v9c-1 6 -3 12 -5 18c-6 16 -15 30 -30 43c-5 4 -10 9 -15 12v0c-36 25 -79 37 -130 37s-95 -12 -131 -37v0
+c-5 -3 -10 -8 -15 -12c-15 -13 -24 -27 -30 -43c-2 -6 -4 -12 -5 -18v-9c0 -32 16 -60 50 -83c36 -25 80 -37 131 -37s94 12 130 37zM417 170c9 6 14 16 14 27c0 9 -3 17 -9 23s-13 9 -22 9c-7 0 -14 -2 -20 -6c18 -16 30 -34 37 -53zM289 90l13 -12
+c-20 -20 -45 -30 -77 -30s-58 10 -78 30l13 12c16 -16 38 -24 65 -24s48 8 64 24z" />
+ <glyph glyph-name="ion-social-reddit" unicode="&#xf23b;" horiz-adv-x="449"
+d="M449 197c0 -20 -11 -37 -27 -45c1 -5 1 -9 1 -14c0 -76 -89 -138 -199 -138s-198 61 -198 137c0 5 0 10 1 15c-16 8 -27 25 -27 45c0 28 23 50 50 50c13 0 24 -5 33 -13c33 23 79 39 129 41h2l31 103l90 -18c8 14 22 24 39 24v0h1c25 0 44 -20 44 -45s-19 -45 -44 -45h-1
+v0c-23 0 -42 17 -44 40l-67 14l-22 -74c49 -3 93 -17 125 -40c9 8 21 13 34 13c27 0 49 -22 49 -50zM34 177c5 15 15 29 29 41c-4 3 -9 5 -15 5c-14 0 -25 -11 -25 -25c0 -9 4 -17 11 -21zM358 339c0 -9 7 -17 16 -17s17 8 17 17s-8 17 -17 17s-16 -8 -16 -17zM127 160
+c0 -18 14 -32 32 -32s32 14 32 32s-14 31 -32 31s-32 -13 -32 -31zM224 48c48 0 77 29 78 30l-13 12s-25 -24 -65 -24c-41 0 -64 24 -64 24l-13 -12c1 -1 29 -30 77 -30zM291 128c18 0 32 14 32 32s-14 31 -32 31s-32 -13 -32 -31s14 -32 32 -32zM415 176c7 5 11 13 11 22
+c0 14 -11 25 -25 25c-6 0 -11 -2 -15 -5c14 -12 24 -27 29 -42z" />
+ <glyph glyph-name="ion-social-rss-outline" unicode="&#xf23c;" horiz-adv-x="384"
+d="M56 112c31 0 56 -25 56 -56s-25 -56 -56 -56s-56 25 -56 56s25 56 56 56zM56 16c22 0 40 18 40 40s-18 40 -40 40s-40 -18 -40 -40s18 -40 40 -40zM0 256c140 0 256 -116 256 -256h-80c0 48 -14 94 -48 128s-80 48 -128 48v80zM240 16c-2 26 -8 52 -19 77
+c-12 28 -30 54 -52 76s-48 40 -76 52c-25 10 -51 16 -77 18v-47c50 -3 92 -22 123 -53s50 -73 53 -123h48zM0 384c212 0 384 -172 384 -384h-80c0 171 -133 304 -304 304v80zM227 228c56 -56 89 -131 93 -212h48c-8 190 -162 344 -352 352v-48c81 -4 155 -36 211 -92z" />
+ <glyph glyph-name="ion-social-rss" unicode="&#xf23d;" horiz-adv-x="384"
+d="M56 112c31 0 56 -25 56 -56s-25 -56 -56 -56s-56 25 -56 56s25 56 56 56zM0 256c140 0 256 -116 256 -256h-80c0 48 -14 94 -48 128s-80 48 -128 48v80zM0 384c212 0 384 -172 384 -384h-80c0 171 -133 304 -304 304v80z" />
+ <glyph glyph-name="ion-social-sass" unicode="&#xf4ea;" horiz-adv-x="512"
+d="M512 119v-8c-1 -9 -7 -17 -15 -22s-12 -4 -13 -3s1 3 4 5c13 8 17 20 10 33c-5 10 -15 16 -26 20c-24 8 -48 7 -72 0c4 -12 7 -23 -2 -34c-10 -12 -23 -19 -39 -22c-7 -2 -14 2 -15 9c-3 19 17 36 30 47c-7 11 -11 24 -14 37c-15 -17 -31 -40 -26 -61
+c3 -14 -1 -27 -14 -36s-30 -14 -46 -11c-4 1 -6 5 -5 8c2 14 25 32 35 43c2 2 3 4 1 7c-6 12 -10 23 -14 36c-13 -29 -30 -80 -57 -98c-9 -6 -17 -4 -21 5c-3 8 -2 20 -1 29c-6 -13 -11 -27 -20 -38c-7 -8 -24 -7 -30 1c-16 21 -13 50 -5 73l-29 -15c7 -16 8 -32 4 -49
+c-5 -19 -17 -35 -35 -46c-19 -12 -64 -24 -77 4c-7 16 -4 30 6 44c17 24 48 37 74 50c-32 23 -80 42 -96 80c-15 35 17 68 43 89c59 48 166 95 244 59c15 -7 36 -24 31 -52c-4 -24 -13 -39 -28 -54c-32 -32 -152 -77 -176 -15c-1 1 -1 4 1 4c2 -1 20 -15 43 -16
+c17 -1 36 3 52 8c33 11 71 33 80 67c4 13 -2 28 -15 34c-49 24 -116 -4 -159 -26c-33 -17 -84 -45 -82 -87c1 -37 56 -60 81 -82c15 7 42 15 52 27c11 13 26 25 44 26c8 0 14 -3 16 -10c2 -6 1 -11 0 -19c5 4 11 4 15 -1c12 -14 -22 -50 -10 -66c14 14 21 42 30 59
+c4 8 17 51 26 53c7 2 18 4 25 0c2 -1 3 -3 2 -5c-7 -19 -7 -33 3 -52c14 20 29 43 34 67c1 2 3 3 5 4c7 2 18 3 25 0c3 -1 3 -2 2 -5c-7 -22 -6 -38 6 -58c31 11 69 15 97 -5c-3 2 -7 5 0 0c5 -4 3 -2 0 0c12 -8 19 -18 21 -32zM113 94v0c1 7 -1 13 -3 20
+c-24 -8 -66 -35 -64 -62c1 -10 8 -13 17 -12s19 7 27 13c14 11 22 24 23 41zM216 166c1 3 -2 5 -5 4c-29 -8 -43 -57 -33 -81c1 -3 4 -3 6 -1c17 16 28 56 32 78zM286 84c8 -3 27 17 26 27c-8 -9 -18 -18 -26 -27zM367 102c11 6 16 19 12 30c-8 -6 -21 -19 -20 -31
+c0 -2 6 0 8 1z" />
+ <glyph glyph-name="ion-social-skype-outline" unicode="&#xf23e;" horiz-adv-x="384"
+d="M106 352c-41 0 -74 -33 -74 -73c0 -13 4 -25 10 -36l6 -11l-2 -12c-2 -10 -3 -20 -3 -30c0 -40 16 -77 44 -105s67 -44 107 -44c9 0 19 1 28 3l11 2l9 -5c11 -6 24 -9 36 -9c41 0 74 33 74 73c0 11 -3 22 -8 32l-5 10l3 11c2 10 3 21 3 32c0 40 -16 77 -44 105
+s-67 43 -107 43c-9 0 -18 0 -26 -2l-12 -2l-10 7c-12 7 -26 11 -40 11zM106 384v0c21 0 40 -6 56 -16c10 2 21 2 32 2c101 0 183 -80 183 -180c0 -13 -1 -27 -4 -39c7 -14 11 -29 11 -46c0 -58 -47 -105 -106 -105c-18 0 -35 4 -50 12c-11 -2 -22 -3 -34 -3
+c-101 0 -183 81 -183 181c0 12 2 24 4 36c-9 16 -15 34 -15 53c0 58 47 105 106 105zM288 104c-8 -12 -21 -21 -37 -28s-36 -10 -58 -10c-26 0 -48 5 -65 14c-12 7 -22 15 -30 26s-12 22 -12 33c0 7 3 12 8 17s11 7 19 7c6 0 12 -2 16 -6s7 -8 10 -15s7 -13 11 -18
+s8 -9 15 -12s16 -5 27 -5c15 0 28 4 37 10s13 13 13 22c0 7 -2 13 -7 17c-5 5 -11 9 -19 11c-8 3 -20 5 -34 8c-19 4 -35 9 -48 14c-13 6 -24 13 -32 23s-11 22 -11 36s4 25 12 36c8 10 20 19 36 25c15 6 34 8 54 8c16 0 30 -1 42 -5s23 -9 31 -15s14 -13 18 -20
+s5 -14 5 -21c0 -6 -2 -12 -7 -17s-11 -8 -19 -8c-7 0 -12 2 -16 5c-3 3 -7 7 -11 14c-5 8 -10 15 -16 20s-17 8 -31 8c-13 0 -23 -3 -31 -8s-12 -11 -12 -18c0 -4 2 -7 4 -10c3 -3 6 -6 11 -8s10 -5 15 -6s13 -3 25 -6c15 -3 28 -6 40 -10s23 -8 32 -14s15 -13 20 -22
+s8 -20 8 -32c0 -15 -5 -28 -13 -40z" />
+ <glyph glyph-name="ion-social-skype" unicode="&#xf23f;" horiz-adv-x="384"
+d="M373 151c7 -14 11 -29 11 -46c0 -58 -47 -105 -106 -105c-18 0 -35 4 -50 12c-11 -2 -22 -3 -34 -3c-101 0 -183 81 -183 181c0 12 2 24 4 36c-9 16 -15 34 -15 53c0 58 47 105 106 105c21 0 41 -6 57 -16c10 2 20 2 31 2c101 0 183 -80 183 -180c0 -13 -1 -27 -4 -39z
+M288 104c9 12 12 25 12 40c0 12 -2 23 -7 32s-12 16 -21 22s-19 10 -31 14s-26 7 -41 10c-12 3 -20 5 -25 6s-10 4 -15 6s-7 5 -10 8c-2 3 -4 6 -4 10c0 7 3 13 11 18s19 7 32 7c14 0 25 -2 31 -7s11 -12 16 -20c4 -7 8 -11 11 -14c4 -3 9 -5 16 -5c8 0 13 3 18 8s8 11 8 17
+c0 7 -2 14 -6 21s-10 14 -18 20s-18 11 -30 15s-27 5 -43 5c-20 0 -38 -2 -53 -8c-16 -6 -28 -15 -36 -25c-8 -11 -12 -22 -12 -36s3 -26 11 -36s19 -17 32 -23c13 -5 29 -10 48 -14c14 -3 26 -5 34 -8c8 -2 14 -6 19 -11c5 -4 7 -10 7 -17c0 -9 -4 -17 -13 -23
+s-22 -9 -37 -9c-11 0 -20 2 -27 5s-11 6 -15 11s-8 12 -11 19s-6 11 -10 15s-10 6 -16 6c-8 0 -14 -2 -19 -7s-8 -10 -8 -17c0 -11 4 -22 12 -33s18 -19 30 -26c17 -9 39 -14 65 -14c22 0 42 3 58 10s29 16 37 28z" />
+ <glyph glyph-name="ion-social-snapchat-outline" unicode="&#xf4eb;" horiz-adv-x="480"
+d="M240 400v0v0c-71 0 -128 -54 -118 -128c2 -15 3 -32 4 -45c0 0 -2 -5 -12 -5c-6 0 -15 2 -28 7c-2 1 -4 1 -6 1c-8 0 -13 -6 -14 -12c0 -5 4 -11 8 -13c14 -7 47 -10 47 -33s-23 -47 -41 -64s-64 -21 -64 -21s0 -21 32 -29s32 -5 33 -13c2 -15 1 -22 11 -22c2 0 4 1 6 1
+c8 1 20 3 32 3c11 0 23 -2 34 -9c23 -15 41 -34 76 -34s53 19 76 34c11 7 24 9 35 9c12 0 23 -2 31 -3c2 0 4 -1 6 -1c10 0 9 7 11 22c1 8 1 5 33 13s32 29 32 29s-46 4 -64 21s-41 41 -41 64s33 26 47 33c4 2 9 8 9 13c-1 6 -6 12 -14 12c-2 0 -5 0 -7 -1
+c-13 -5 -21 -6 -27 -6c-10 0 -13 4 -13 4c1 13 2 30 4 45c10 74 -47 128 -118 128zM240 416v0c41 0 80 -16 105 -45c24 -28 34 -63 29 -101c-1 -11 -2 -22 -3 -31c4 1 10 2 18 5c4 1 8 2 12 2c16 0 29 -12 30 -27c1 -13 -9 -25 -18 -29c-4 -2 -9 -3 -14 -5
+c-7 -2 -14 -5 -19 -8c-4 -3 -5 -4 -5 -5c0 -16 20 -37 36 -52c11 -10 39 -16 54 -17l15 -1v-14c0 -2 0 -11 -6 -21c-5 -8 -16 -19 -38 -24c-6 -1 -11 -3 -15 -4c-2 -1 -5 -1 -7 -1v-1c-1 -7 -1 -13 -4 -18c-2 -5 -9 -12 -22 -12c-2 0 -6 0 -9 1c-2 0 -3 1 -5 1
+c-7 1 -15 2 -23 2c-10 0 -19 -2 -26 -6c-4 -3 -9 -7 -14 -10c-18 -13 -38 -27 -71 -27s-53 14 -71 27c-5 3 -9 7 -14 10c-7 4 -15 6 -25 6c-8 0 -17 -1 -24 -2c-2 0 -3 -1 -5 -1c-3 -1 -7 -1 -9 -1c-13 0 -20 7 -22 12c-3 5 -3 11 -4 18v1c-2 0 -4 0 -6 1c-4 1 -10 3 -16 4
+c-22 5 -33 16 -38 24c-6 10 -6 18 -6 20v15l15 1c16 1 44 7 54 17c29 27 36 43 36 52c0 1 0 2 -4 5c-5 3 -13 6 -20 8c-5 2 -10 3 -14 5c-9 4 -18 16 -17 29c1 15 14 27 30 27c4 0 8 0 12 -2c8 -3 13 -4 17 -5c-1 9 -2 19 -3 30c-5 38 5 74 29 102c25 29 64 45 105 45v0z
+M240 219c-21 0 -41 8 -56 23c-3 3 -3 9 0 12s9 3 12 0c12 -12 27 -19 44 -19c16 0 32 7 44 19c3 3 9 3 12 0s3 -9 0 -12c-15 -15 -35 -23 -56 -23zM176 296c0 16 5 24 16 24s16 -8 16 -24s-5 -24 -16 -24s-16 8 -16 24zM272 296c0 16 5 24 16 24s16 -8 16 -24
+s-5 -24 -16 -24s-16 8 -16 24z" />
+ <glyph glyph-name="ion-social-snapchat" unicode="&#xf4ec;" horiz-adv-x="480"
+d="M480 88c0 -2 0 -11 -6 -21c-5 -8 -16 -19 -38 -24c-6 -1 -11 -3 -15 -4c-2 -1 -5 -1 -7 -1v-1c-1 -7 -1 -13 -4 -18c-2 -5 -9 -12 -22 -12c-2 0 -6 0 -9 1c-2 0 -3 1 -5 1c-7 1 -15 2 -23 2c-10 0 -19 -2 -26 -6c-4 -3 -9 -7 -14 -10c-18 -13 -38 -27 -71 -27
+s-53 14 -71 27c-5 3 -9 7 -14 10c-7 4 -15 6 -25 6c-8 0 -17 -1 -24 -2c-2 0 -3 -1 -5 -1c-3 -1 -7 -1 -9 -1c-13 0 -20 7 -22 12c-3 5 -3 11 -4 18v1c-2 0 -4 0 -6 1c-4 1 -10 3 -16 4c-22 5 -33 16 -38 24c-6 10 -6 18 -6 20v15l15 1c16 1 44 7 54 17c29 27 36 43 36 52
+c0 1 0 2 -4 5c-5 3 -13 6 -20 8c-5 2 -10 3 -14 5c-9 4 -18 16 -17 29c1 15 14 27 30 27c4 0 8 0 12 -2c8 -3 13 -4 17 -5c-1 9 -2 19 -3 30c-5 38 5 74 29 102c25 29 64 45 105 45v0c41 0 80 -16 105 -45c24 -28 34 -63 29 -101c-1 -11 -2 -22 -3 -31c4 1 10 2 18 5
+c4 1 8 2 12 2c16 0 29 -12 30 -27c1 -13 -9 -25 -18 -29c-4 -2 -9 -3 -14 -5c-7 -2 -14 -5 -19 -8c-4 -3 -5 -4 -5 -5c0 -16 20 -37 36 -52c11 -10 39 -16 54 -17l15 -1v-14zM192 320c-9 0 -16 -11 -16 -24s7 -24 16 -24s16 11 16 24s-7 24 -16 24zM296 242c3 3 3 9 0 12
+s-9 3 -12 0c-12 -12 -28 -19 -44 -19c-17 0 -32 7 -44 19c-3 3 -9 3 -12 0s-3 -9 0 -12c15 -15 35 -23 56 -23s41 8 56 23zM288 272c9 0 16 11 16 24s-7 24 -16 24s-16 -11 -16 -24s7 -24 16 -24z" />
+ <glyph glyph-name="ion-social-tumblr-outline" unicode="&#xf240;" horiz-adv-x="256"
+d="M193 52c21 0 42 6 63 20v-65c-18 -8 -34 -15 -48 -18s-28 -5 -45 -5c-19 0 -35 2 -50 7c-14 5 -28 12 -38 21s-17 18 -21 28s-6 25 -6 44v140h-48v58c16 5 30 14 42 24s19 21 26 35s11 37 14 59h62v-112h96v-64h-96v-101c0 -24 1 -40 4 -47c2 -7 7 -12 14 -16
+c9 -6 19 -8 31 -8zM240 17v29c-15 -6 -31 -10 -47 -10c-15 0 -28 3 -40 10c-10 6 -17 15 -21 25c-2 6 -4 17 -4 52v117h96v32h-96v112h-32c-2 -16 -7 -36 -14 -50c-8 -16 -17 -29 -30 -40c-11 -9 -23 -17 -36 -23v-31h48v-156c0 -21 2 -32 4 -38c3 -8 10 -15 18 -22
+c9 -8 19 -14 31 -18c13 -4 29 -6 46 -6c16 0 28 2 41 5c11 2 23 6 36 12z" />
+ <glyph glyph-name="ion-social-tumblr" unicode="&#xf241;" horiz-adv-x="256"
+d="M193 52c21 0 42 6 63 20v-65c-18 -8 -34 -15 -48 -18s-28 -5 -45 -5c-19 0 -35 2 -50 7c-14 5 -28 12 -38 21s-17 18 -21 28s-6 25 -6 44v140h-48v58c16 5 30 14 42 24s19 21 26 35s11 37 14 59h62v-112h96v-64h-96v-101c0 -24 1 -40 4 -47c2 -7 7 -12 14 -16
+c9 -6 19 -8 31 -8z" />
+ <glyph glyph-name="ion-social-tux" unicode="&#xf2c5;" horiz-adv-x="383"
+d="M189 347c2 2 -1 -1 0 0c2 2 4 4 6 5c-3 -2 -5 -4 -7 -8c0 1 0 2 1 3zM361 52c7 -4 23 -11 21 -22c-2 -10 -17 -15 -24 -19c-15 -8 -28 -14 -41 -25c-9 -8 -17 -15 -29 -17c-11 -2 -25 -1 -33 8c-5 5 -7 11 -15 12c-25 5 -54 4 -79 0c-13 -2 -21 -11 -32 -17
+c-10 -5 -20 -5 -30 -1c-13 5 -27 10 -41 13s-29 5 -43 9c-31 8 -5 30 -11 50c-3 12 -10 29 8 30c9 1 27 -1 31 11c2 7 -2 15 2 22s-1 17 1 25c4 18 19 32 25 49c5 14 8 25 18 37c9 11 22 22 29 34c10 18 9 35 8 55c-1 17 -1 33 -2 50c0 33 20 60 58 60h14
+c38 0 63 -32 64 -69c0 -19 -5 -38 5 -67c15 -27 36 -48 52 -73c10 -16 16 -31 20 -49c3 -14 9 -31 7 -45c-1 -6 -2 -9 -4 -11c3 -1 7 -2 9 -5c3 -4 2 -11 0 -26c-1 -8 5 -15 12 -19zM137 -3c2 20 -15 39 -25 56c-10 16 -21 43 -39 52c-8 4 -19 5 -23 -5c-2 -7 0 -19 -2 -22
+c-4 -9 -14 -10 -23 -11c-6 0 -17 0 -17 -8c1 -10 10 -20 7 -30c-2 -7 -8 -12 -8 -19c0 -14 38 -15 47 -17c19 -4 37 -14 57 -16c12 -1 25 7 26 20zM253 62c-2 10 2 -10 0 0s-5 28 1 35c4 5 10 6 17 5c0 4 1 9 3 12c8 13 29 8 39 0l-1 2c-3 4 -8 9 -13 10c0 0 4 12 2 34
+c-4 40 -33 62 -33 62c27 -30 27 -58 27 -72c0 -6 -1 -18 -4 -24c-4 -1 -7 -2 -11 -4c-10 -5 -8 2 -8 10c0 18 -2 36 -7 54c-3 9 -7 17 -13 24c-4 5 -4 9 -5 15c-3 12 -9 22 -16 32c-7 9 -7 17 -5 28c1 7 2 14 -6 17c-6 2 -26 5 -27 14c-1 6 -1 16 5 20c16 14 30 -11 17 -24
+c-3 -3 7 -4 8 -4c4 1 4 7 5 10c1 4 1 9 1 13c0 17 -18 32 -34 21c-6 -4 -9 -11 -10 -17c0 -2 -1 -20 0 -20c-4 0 -7 5 -11 5c-3 0 -7 0 -10 -1c0 0 2 14 -2 22c-4 9 -18 16 -24 4s-3 -25 0 -31s4 -6 4 -6c2 1 5 4 5 4s-6 3 -7 11c-1 9 3 14 7 15s10 -2 12 -8s0 -13 0 -13
+c-7 -6 -30 -18 -22 -28c14 -18 33 -15 52 -9c8 3 18 5 24 12c3 3 11 2 8 -4c-2 -5 -18 -7 -22 -9c-9 -4 -18 -8 -28 -10c-6 -1 -13 -5 -28 9c7 -6 8 -16 17 -20c13 -6 33 9 44 15c1 1 16 5 14 0c-1 -4 -11 -7 -15 -9c-11 -6 -23 -21 -36 -22c-8 -1 -21 16 -25 22
+c-1 1 -5 9 -6 4c-1 -8 2 -14 -3 -21c-6 -9 -11 -18 -13 -29c-1 -6 0 -11 -3 -16c-11 -15 -17 -33 -19 -51c0 -4 3 -43 -5 -41c-18 5 -17 33 -14 47c-3 -12 -8 -30 2 -44c12 -15 99 -55 53 -80c7 -14 14 -25 12 -41c8 7 2 20 -1 28c0 0 17 -12 38 -10c17 2 32 7 46 16
+c6 4 11 9 16 14c1 2 4 6 6 7l1 -11c2 -17 -12 -27 -10 -34c4 8 11 14 13 24c3 12 0 24 -2 36zM155 323v0v-3c2 0 2 5 1 8c-1 4 -3 6 -4 6h-2c3 -2 5 -6 5 -11zM210 335c3 -2 0 0 0 0c3 -2 5 -5 5 -10v-3c2 0 3 4 2 7s-3 6 -5 6h-2zM347 15c24 11 -24 -10 0 0
+c24 11 35 17 20 26c-17 10 -26 13 -26 29c0 5 4 16 2 22c-1 4 -6 5 -9 5c-10 -10 -17 -25 -34 -25c-14 0 -25 11 -28 24c-4 2 -10 1 -13 -4c-6 -12 1 -29 3 -41c2 -18 -4 -35 -2 -53c2 -21 26 -22 40 -13c16 10 29 22 47 30z" />
+ <glyph glyph-name="ion-social-twitch-outline" unicode="&#xf4ed;" horiz-adv-x="416"
+d="M32 416h384v-272l-112 -112h-80l-64 -64h-64v64h-96v304zM368 160v208h-304v-272h80v-64l64 64h96zM272 176v129h48v-129h-48zM160 176v129h48v-129h-48z" />
+ <glyph glyph-name="ion-social-twitch" unicode="&#xf4ee;" horiz-adv-x="416"
+d="M32 416h384v-272l-112 -112h-80l-64 -64h-64v64h-96v304zM208 176v129h-48v-129h48zM320 176v129h-48v-129h48z" />
+ <glyph glyph-name="ion-social-twitter-outline" unicode="&#xf242;" horiz-adv-x="472"
+d="M472 338c-13 -20 -29 -36 -48 -50v-12c0 -128 -98 -276 -276 -276c-55 0 -105 16 -148 44c8 -1 15 -2 23 -2c45 0 87 16 120 42c-42 1 -78 29 -90 67c6 -1 12 -2 18 -2c9 0 18 2 26 4c-44 9 -78 48 -78 95v1c13 -7 28 -12 44 -12c-26 17 -43 47 -43 81c0 18 5 34 13 48
+c48 -59 119 -97 199 -101c-2 7 -2 14 -2 22c0 54 43 97 97 97c28 0 52 -12 70 -31c22 4 43 13 62 24c-7 -23 -23 -42 -43 -54c20 2 39 7 56 15zM414 301c3 2 8 6 11 8c-2 0 -11 -2 -19 -1s-21 5 -21 5s14 13 18 17l11 11c-4 -1 -10 -2 -14 -3l-8 -2l-6 6
+c-15 16 -37 26 -59 26c-45 0 -81 -37 -81 -81c0 -6 1 -12 2 -18l5 -21l-22 1c-42 2 -81 13 -118 32c-28 14 -53 34 -75 56c-1 -6 -2 -13 -2 -19c0 -27 14 -53 36 -68c0 0 33 -23 46 -29c-24 -2 -56 0 -56 0c-8 0 -16 1 -24 3c8 -28 32 -50 62 -56l61 -10l-61 -21
+c-7 -2 -14 -3 -21 -3c15 -20 38 -34 64 -34l45 -1l-35 -28c-18 -14 -38 -25 -60 -33c-10 -3 -19 -6 -29 -8c27 -9 55 -14 84 -14c40 0 78 8 112 24c31 14 58 34 81 60c22 24 38 53 50 84c11 30 17 62 17 92v12l-1 8z" />
+ <glyph glyph-name="ion-social-twitter" unicode="&#xf243;" horiz-adv-x="472"
+d="M472 338c-13 -20 -29 -36 -48 -50v-12c0 -128 -98 -276 -276 -276c-55 0 -105 16 -148 44c8 -1 15 -2 23 -2c45 0 87 16 120 42c-42 1 -78 29 -90 67c6 -1 12 -2 18 -2c9 0 18 2 26 4c-44 9 -78 48 -78 95v1c13 -7 28 -12 44 -12c-26 17 -43 47 -43 81c0 18 5 34 13 48
+c48 -59 119 -97 199 -101c-2 7 -2 14 -2 22c0 54 43 97 97 97c28 0 52 -12 70 -31c22 4 43 13 62 24c-7 -23 -23 -42 -43 -54c20 2 39 7 56 15z" />
+ <glyph glyph-name="ion-social-usd-outline" unicode="&#xf352;" horiz-adv-x="320"
+d="M125 345c11 2 19 3 19 3v-131l-22 6c-15 5 -27 11 -36 19c-12 10 -19 25 -19 43c0 13 4 24 11 33c6 8 13 14 22 19c7 4 17 6 25 8zM128 238v92c-7 -2 -15 -4 -21 -7c-7 -4 -12 -9 -17 -15s-7 -14 -7 -23c0 -13 4 -24 13 -31c8 -7 20 -12 32 -16zM252 151
+c10 -10 15 -24 15 -42c0 -9 -1 -18 -5 -27s-11 -17 -20 -24c-8 -6 -18 -11 -31 -15c-6 -2 -11 -3 -17 -4s-18 -1 -18 -1v145l20 -5c10 -3 19 -6 28 -9c10 -4 20 -10 28 -18zM247 89c3 7 4 13 4 20c0 14 -3 24 -10 31s-15 11 -23 14s-16 5 -26 8v-107c6 1 10 2 14 3
+c11 3 20 8 27 13s11 11 14 18zM315 145c3 -10 5 -19 5 -29c0 -21 -5 -38 -14 -53s-20 -26 -35 -35s-31 -17 -50 -21c-10 -2 -19 -3 -29 -4v-35h-64v35c-9 1 -19 4 -28 6c-20 5 -36 12 -51 23s-26 24 -35 41c-8 16 -13 34 -14 55h69c0 -12 2 -24 7 -33c5 -10 12 -17 21 -23
+s20 -11 31 -14v120c-8 2 -18 4 -27 6c-17 4 -30 9 -41 16s-20 15 -27 23s-11 17 -14 26s-4 18 -4 28c0 18 4 34 12 48s19 25 33 34s29 16 46 20c7 2 15 3 22 4v33h64v-33c9 -1 16 -4 24 -6c18 -5 34 -12 48 -22s25 -22 33 -37c7 -13 11 -28 12 -46h-69c-3 21 -12 37 -26 46
+c-7 4 -13 8 -22 10v-106c9 -2 16 -4 25 -6c12 -3 22 -6 27 -7c13 -4 23 -9 33 -15c10 -7 18 -14 24 -22s11 -17 14 -27zM293 72c7 12 11 27 11 44c0 8 -1 16 -4 24s-7 15 -12 22s-12 13 -20 19c-8 5 -18 10 -29 13c-5 1 -13 3 -24 6h-1l-4 1c-7 2 -13 4 -21 6l-13 3v137
+s9 -1 19 -4s19 -6 28 -12c15 -9 25 -24 30 -43h38c-2 8 -4 15 -8 22c-7 13 -16 24 -28 32c-12 9 -27 16 -43 20c-8 2 -16 4 -23 5l-13 2v31h-32v-31l-14 -2c-7 -1 -14 -2 -20 -4c-15 -4 -29 -10 -41 -18s-21 -16 -28 -28c-7 -11 -10 -24 -10 -40c0 -8 1 -15 3 -23
+c2 -7 6 -14 11 -21s14 -13 23 -19c10 -6 22 -10 37 -14v0v0c4 -1 8 -2 11 -3c5 -1 11 -3 16 -4l12 -3v-151s-8 1 -20 4s-26 8 -36 15c-11 8 -20 18 -26 30c-4 7 -6 16 -8 24h-36c2 -11 5 -23 10 -32c8 -14 17 -26 30 -35c13 -10 28 -16 46 -21c8 -2 17 -4 26 -5l14 -2v-33
+h32v33l15 1c9 1 17 3 26 5c17 4 32 10 45 18s23 19 31 31z" />
+ <glyph glyph-name="ion-social-usd" unicode="&#xf353;" horiz-adv-x="320"
+d="M315 145c3 -10 5 -19 5 -29c0 -21 -5 -38 -14 -53s-20 -26 -35 -35s-31 -17 -50 -21c-10 -2 -19 -3 -29 -4v-35h-64v35c-9 1 -19 4 -28 6c-20 5 -36 12 -51 23s-26 24 -35 41c-8 16 -13 34 -14 55h69c0 -12 2 -24 7 -33c5 -10 12 -17 21 -23s20 -11 31 -14v120
+c-8 2 -18 4 -27 6c-17 4 -30 9 -41 16s-20 15 -27 23s-11 17 -14 26s-4 18 -4 28c0 18 4 34 12 48s19 25 33 34s29 16 46 20c7 2 15 3 22 4v33h64v-33c9 -1 16 -4 24 -6c18 -5 34 -12 48 -22s25 -22 33 -37c7 -13 11 -28 12 -46h-69c-3 21 -12 37 -26 46c-7 4 -13 8 -22 10
+v-106c9 -2 16 -4 25 -6c12 -3 22 -6 27 -7c13 -4 23 -9 33 -15c10 -7 18 -14 24 -22s11 -17 14 -27zM128 238v92c-7 -2 -15 -4 -21 -7c-7 -4 -12 -9 -17 -15s-7 -14 -7 -23c0 -13 4 -24 13 -31c8 -7 20 -12 32 -16zM247 89c3 7 4 13 4 20c0 14 -3 24 -10 31s-15 11 -23 14
+s-16 5 -26 8v-107c6 1 10 2 14 3c11 3 20 8 27 13s11 11 14 18z" />
+ <glyph glyph-name="ion-social-vimeo-outline" unicode="&#xf244;"
+d="M445 334c7 -33 1 -66 -13 -97s-31 -59 -51 -87c-26 -36 -52 -71 -85 -101c-19 -18 -41 -35 -66 -44c-10 -4 -19 -5 -27 -5c-17 0 -31 9 -44 27c-14 19 -22 40 -28 63c-12 45 -25 90 -38 134c-4 12 -9 22 -15 33c-3 5 -8 10 -12 14c-2 2 -5 3 -8 3s-6 -1 -9 -3
+c-10 -6 -28 -18 -28 -18l-21 27c26 24 82 71 82 71c11 9 33 25 48 27h8c18 0 32 -7 42 -22c11 -17 15 -37 18 -57c7 -41 12 -82 24 -122c3 -10 7 -20 12 -29c4 -7 9 -10 14 -10c4 0 7 2 11 5s7 6 10 10c20 24 37 52 48 81c3 9 3 17 3 27c0 13 -10 25 -25 26h-7
+c-11 0 -20 -2 -32 -7c6 24 24 62 54 84c20 14 45 20 67 20c10 0 20 -2 27 -4c23 -8 36 -23 41 -46zM418 244c13 30 17 59 11 87c-4 19 -13 28 -30 34c-6 2 -14 3 -22 3c-21 0 -42 -6 -57 -17c-16 -12 -29 -30 -38 -48h6h8c23 -1 39 -19 40 -41c0 -10 0 -22 -4 -34
+c-11 -29 -29 -58 -51 -85c-4 -4 -7 -9 -12 -13c-7 -6 -15 -8 -22 -8c-8 0 -18 3 -27 18c-7 11 -11 22 -14 32c-10 31 -14 64 -19 95c-2 10 -3 19 -5 29c-3 17 -6 36 -16 51c-7 10 -16 15 -28 15h-6c-8 -1 -25 -11 -40 -23c-2 -2 -43 -37 -70 -61l2 -3c5 4 12 7 16 10
+c6 3 12 5 18 5c7 0 13 -3 18 -7c8 -7 13 -12 16 -18c6 -11 12 -24 16 -37c13 -44 26 -88 38 -133c5 -19 13 -41 26 -59s23 -20 31 -20c6 0 13 1 21 4c23 8 43 25 61 41c32 29 57 63 83 99v0c21 28 37 55 50 84z" />
+ <glyph glyph-name="ion-social-vimeo" unicode="&#xf245;"
+d="M445 334c7 -33 1 -66 -13 -97s-31 -59 -51 -87c-26 -36 -52 -71 -85 -101c-19 -18 -41 -35 -66 -44c-31 -11 -52 -5 -71 22c-14 19 -22 40 -28 63c-12 45 -25 90 -38 134c-4 12 -9 22 -15 33c-3 5 -8 10 -12 14c-5 4 -11 3 -17 0c-10 -6 -28 -18 -28 -18l-21 27
+c26 24 82 71 82 71c11 9 33 25 48 27c21 3 38 -4 50 -22c11 -17 15 -37 18 -57c7 -41 11 -82 23 -122c3 -10 8 -20 13 -29c7 -11 15 -13 25 -5c4 3 7 6 10 10c20 24 37 52 48 81c3 9 3 17 3 27c0 13 -10 25 -25 26s-24 -1 -39 -7c6 24 24 62 54 84c29 21 71 24 94 16
+s36 -23 41 -46z" />
+ <glyph glyph-name="ion-social-whatsapp-outline" unicode="&#xf4ef;"
+d="M178 294c4 -11 15 -39 16 -42s2 -6 0 -10s-3 -6 -6 -9s-6 -7 -9 -9c-3 -3 -6 -6 -3 -12s14 -24 30 -39c21 -20 38 -27 44 -30s9 -3 12 1s15 16 19 21s8 5 13 3s31 -17 37 -20s10 -5 11 -7s0 -13 -5 -26s-28 -24 -38 -25s-11 -8 -67 16s-90 84 -93 88s-22 31 -21 58
+s17 41 22 46s11 7 15 7h10s9 0 13 -11zM228 384c-50 0 -97 -20 -133 -55c-35 -35 -55 -81 -55 -131c0 -34 9 -67 27 -96l8 -13l-5 -14l-19 -57l61 19l13 4l12 -6c28 -15 59 -23 91 -23c50 0 97 19 133 54c35 35 55 82 55 132s-20 96 -55 131c-36 35 -83 55 -133 55zM228 416
+v0c121 0 220 -97 220 -218s-99 -218 -220 -218c-39 0 -74 10 -106 27l-122 -39l40 117c-20 33 -32 72 -32 113c0 121 99 218 220 218z" />
+ <glyph glyph-name="ion-social-whatsapp" unicode="&#xf4f0;"
+d="M228 416c121 0 220 -97 220 -218s-99 -218 -220 -218c-39 0 -74 10 -106 27l-122 -39l40 117c-20 33 -32 72 -32 113c0 121 99 218 220 218zM337 115c5 13 6 24 5 26s-5 4 -11 7s-32 18 -37 20s-9 2 -13 -3s-16 -17 -19 -21s-6 -4 -12 -1s-23 10 -44 30
+c-16 15 -27 33 -30 39s0 9 3 12c3 2 6 6 9 9s4 5 6 9s1 7 0 10s-12 31 -16 42s-10 11 -13 11h-10s-10 -2 -15 -7s-21 -19 -22 -46s18 -54 21 -58s37 -64 93 -88s57 -17 67 -16s33 12 38 25z" />
+ <glyph glyph-name="ion-social-windows-outline" unicode="&#xf246;"
+d="M432 167h-216v-149l216 -32v181zM448 183v0v-215l-248 36v179h248zM168 167h-152v-120l152 -22v142zM184 183v0v-177l-184 27v150h184zM432 398v0l-216 -31v-152h216v183zM448 416v0v-217h-248v182zM168 360v0l-152 -22v-123h152v145zM184 378v0v-179h-184v153z" />
+ <glyph glyph-name="ion-social-windows" unicode="&#xf247;"
+d="M448 183v0v-215l-248 36v179h248zM184 183v0v-177l-184 27v150h184zM448 416v0v-217h-248v182zM184 378v0v-179h-184v153z" />
+ <glyph glyph-name="ion-social-wordpress-outline" unicode="&#xf248;" horiz-adv-x="384"
+d="M192 384c106 0 192 -86 192 -192c0 -9 -1 -18 -2 -26c-12 -85 -79 -153 -165 -164c-8 -1 -17 -2 -25 -2c-106 0 -192 86 -192 192s86 192 192 192zM19 192c0 -68 40 -127 98 -155l-83 225c-10 -21 -15 -45 -15 -70zM214 21c12 2 24 4 35 8c0 1 -1 2 -1 3l-53 145l-33 -96
+v0l-19 -55c15 -5 32 -7 49 -7c8 0 15 1 22 2zM216 273l62 -186l17 58c9 22 13 41 13 56c0 21 -7 35 -14 47c-9 14 -17 27 -17 41c0 16 12 30 29 30h2c-31 28 -71 45 -116 45c-60 0 -113 -30 -144 -77c4 0 8 -1 11 -1c18 0 46 3 46 3c9 1 10 -14 1 -15c0 0 -10 -1 -20 -1
+l63 -187l38 113l-27 74c-9 0 -18 1 -18 1c-9 0 -8 16 1 15c0 0 28 -3 45 -3c18 0 46 3 46 3c9 1 11 -14 2 -15c0 0 -10 -1 -20 -1zM279 43c45 26 77 71 84 125c1 8 2 16 2 24c0 30 -8 58 -22 83c1 -6 1 -12 1 -18c0 -18 -3 -37 -13 -62l-39 -113z" />
+ <glyph glyph-name="ion-social-wordpress" unicode="&#xf249;" horiz-adv-x="384"
+d="M195 177l53 -146c0 -1 6 -13 9 -19c-3 -1 -5 -2 -8 -3v0c-10 -3 -21 -6 -32 -7c-8 -1 -17 -2 -25 -2c-17 0 -34 2 -50 6v0c-2 0 -3 2 -5 2l25 73v0zM17 268c6 0 7 -1 15 -1l93 -255c-3 1 -5 2 -8 3c-63 27 -109 87 -116 158c-1 6 -1 13 -1 19c0 25 7 53 17 76zM366 273
+c11 -24 18 -52 18 -81c0 -9 -1 -18 -2 -26c-9 -65 -50 -120 -107 -147c-2 -1 -3 -1 -5 -2l22 65l39 113c10 25 13 45 13 62v19v0c-1 18 -10 44 -36 43h-2c-17 0 -29 -14 -29 -30c0 -14 8 -27 17 -41c7 -12 14 -26 14 -47c0 -15 -4 -34 -13 -56l-17 -58l-62 186
+c10 0 20 1 20 1c9 1 7 16 -2 15c0 0 -28 -3 -46 -3c-17 0 -45 3 -45 3c-9 1 -10 -15 -1 -15c0 0 9 -1 18 -1l27 -74l-38 -113l-63 187c10 0 20 2 20 2c9 1 8 15 -1 14c0 0 -28 -2 -46 -2h-34c5 9 11 17 17 25c35 44 90 72 150 72c24 0 48 -5 69 -13c34 -13 63 -36 85 -65
+c2 -2 3 -5 5 -7c6 -8 11 -17 15 -26z" />
+ <glyph glyph-name="ion-social-yahoo-outline" unicode="&#xf24a;" horiz-adv-x="320"
+d="M289 380c11 0 21 1 31 4l-128 -213v-171c-10 4 -21 4 -32 4s-22 0 -32 -4v171l-128 213c10 -4 21 -4 32 -4s22 0 32 4l96 -160l96 160c10 -4 22 -4 33 -4zM178 180l111 184h-1c-7 0 -15 0 -24 2l-90 -150l-14 -23l-14 23l-89 150c-9 -2 -17 -2 -25 -2h-1l111 -184l2 -4
+v-5v-151c6 1 11 0 16 0s11 1 16 0v151v5z" />
+ <glyph glyph-name="ion-social-yahoo" unicode="&#xf24b;" horiz-adv-x="320"
+d="M289 380c11 0 21 1 31 4l-128 -213v-171c-10 4 -21 4 -32 4s-22 0 -32 -4v171l-128 213c10 -4 21 -4 32 -4s22 0 32 4l96 -160l96 160c10 -4 22 -4 33 -4z" />
+ <glyph glyph-name="ion-social-yen-outline" unicode="&#xf4f1;" horiz-adv-x="384"
+d="M384 416l-112 -208h48v-48h-73l-15 -31v-17h88v-48h-88v-96h-80v96h-88v48h88v17l-14 31h-74v48h48l-112 208h80l112 -221l112 221h80zM304 192h-59l13 24l99 184v0h-43l-122 -240l-122 240h-43l99 -184l13 -24h-59v-16h68l20 -44v-36h-88v-16h88v-96h48v96h88v16h-88v37
+l21 43h67v16z" />
+ <glyph glyph-name="ion-social-yen" unicode="&#xf4f2;" horiz-adv-x="384"
+d="M384 416l-112 -208h48v-48h-73l-15 -31v-17h88v-48h-88v-96h-80v96h-88v48h88v17l-14 31h-74v48h48l-112 208h80l112 -221l112 221h80z" />
+ <glyph glyph-name="ion-social-youtube-outline" unicode="&#xf24c;" horiz-adv-x="512"
+d="M265 352v0h-9h-9c-65 0 -118 -2 -168 -4h-1h-1c-23 0 -42 -22 -42 -49v-1v-1c-2 -34 -3 -70 -3 -105v0v0c0 -35 1 -70 3 -104v-2v-1c0 -14 5 -26 14 -36c8 -9 17 -13 28 -13h1h1c52 -2 108 -4 166 -4h11v0v0h11c58 0 113 2 166 4h1h1c11 0 20 4 28 13c9 10 14 22 14 36v1
+v2c2 34 3 68 3 104v0v0c0 36 -1 71 -3 105v1v2c0 27 -19 49 -42 49h-1h-1c-49 2 -103 3 -168 3zM265 384v0c58 0 115 0 170 -3c41 0 74 -36 74 -81c2 -36 3 -72 3 -108s-1 -71 -3 -107c0 -45 -33 -81 -74 -81c-55 -3 -111 -4 -168 -4h-11h-11c-57 0 -113 1 -168 4
+c-41 0 -74 36 -74 81c-2 36 -3 71 -3 107s2 71 4 107c0 45 32 82 73 82c55 2 112 3 170 3h9h9zM207 94v197l145 -99z" />
+ <glyph glyph-name="ion-social-youtube" unicode="&#xf24d;" horiz-adv-x="512"
+d="M509 299c2 -36 3 -71 3 -107s-1 -71 -3 -107c0 -45 -33 -81 -74 -81c-58 -3 -118 -4 -179 -4s-121 1 -179 4c-41 0 -74 36 -74 81c-2 36 -3 71 -3 107s2 71 4 107c0 45 32 81 73 81c55 3 112 4 170 4h9h9c58 0 115 -1 170 -4c41 0 74 -36 74 -81zM207 94l145 98l-145 99
+v-197z" />
+ <glyph glyph-name="ion-soup-can-outline" unicode="&#xf4f3;" horiz-adv-x="320"
+d="M160 304c-88 0 -160 29 -160 64s72 64 160 64s160 -29 160 -64s-72 -64 -160 -64zM160 415c-70 0 -126 -19 -126 -43s56 -43 126 -43s126 19 126 43s-56 43 -126 43zM161 288c88 0 158 29 159 64c0 -5 0 -33 -8 -40v-240c0 -35 -64 -64 -152 -64s-152 29 -152 64v240
+c-8 6 -8 40 -8 40c0 -35 73 -64 161 -64zM280 72v80c-18 -10 -43 -17 -72 -21h-2c-6 -20 -24 -35 -46 -35s-40 15 -46 35h-2c-29 4 -54 11 -72 21v-80c1 -2 9 -10 30 -18c24 -9 55 -14 90 -14s67 5 91 14c21 8 29 16 29 18zM280 184v91c-33 -12 -75 -19 -119 -19
+c-45 0 -87 7 -121 19v-91c18 -10 43 -17 73 -21h3c7 17 24 29 44 29s37 -12 44 -29h3c30 4 55 11 73 21zM178 -16zM160 -16h1h-1v0zM312 32l8 -16c0 -7 -3 -14 -8 -20c-21 -26 -81 -44 -152 -44s-131 18 -152 44c-5 6 -8 13 -8 20l8 16v16c0 -35 63 -64 152 -64
+s152 28 152 64v-16z" />
+ <glyph glyph-name="ion-soup-can" unicode="&#xf4f4;" horiz-adv-x="320"
+d="M0 368c0 43 53 64 160 64s160 -21 160 -64s-53 -64 -160 -64s-160 21 -160 64zM160 8c-44 0 -80 6 -109 18s-43 28 -43 46v128c0 -9 4 -19 13 -27s21 -15 37 -21s33 -10 54 -13c1 -12 7 -23 16 -31s20 -12 32 -12s23 4 32 12s15 19 16 31c31 4 56 12 75 23s29 24 29 38
+v-128c0 -18 -14 -34 -43 -46s-65 -18 -109 -18zM160 288c44 0 82 6 113 18s47 28 47 46v-8c0 -5 -1 -11 -2 -18s-3 -11 -6 -14v-96c0 -14 -10 -27 -29 -38s-44 -19 -76 -23c-2 11 -8 19 -17 26s-19 11 -30 11s-21 -4 -30 -11s-15 -15 -17 -26c-32 4 -57 12 -76 23
+s-29 24 -29 38v96c-5 5 -8 18 -8 40c0 -18 16 -34 47 -46s69 -18 113 -18zM312 56v-24l8 -16c0 -7 -3 -14 -8 -20c-11 -13 -30 -24 -58 -32s-59 -12 -94 -12s-66 4 -94 12s-47 19 -58 32c-5 6 -8 13 -8 20l8 16v24c0 -18 14 -34 43 -46s65 -18 109 -18s80 6 109 18
+s43 28 43 46z" />
+ <glyph glyph-name="ion-speakerphone" unicode="&#xf2b2;"
+d="M39 266c0 -37 20 -69 50 -86c-1 0 -2 1 -3 1s-4 1 -5 1v0c-35 3 -62 33 -69 69c-6 0 -12 7 -12 16c0 8 5 15 11 16c6 42 40 75 81 75h8c-36 -15 -61 -51 -61 -92zM433 357c10 -25 15 -56 15 -88s-5 -63 -15 -88l-3 -9c-6 -14 -15 -26 -24 -34c-10 -10 -22 -19 -34 -20h-3
+c-7 0 -15 2 -22 5c-3 2 -10 5 -10 5c-22 10 -84 28 -115 29c-4 -8 -10 -20 -12 -30c-2 -9 -6 -27 -7 -61c-1 -32 1 -59 3 -82c0 -2 1 -5 1 -7c0 -6 -2 -9 -9 -9h-77c-6 0 -9 3 -9 6v7c2 72 25 140 26 145c2 9 5 17 7 30c2 12 -27 13 -40 24c-29 17 -47 49 -47 86
+c0 41 25 77 59 92h42h19c58 3 114 21 163 50c1 1 3 1 4 2v0c8 4 16 6 24 6c13 0 26 -6 37 -16c9 -9 18 -21 24 -35c1 -3 2 -5 3 -8zM410 180c9 22 15 54 15 89s-6 66 -15 88c-8 18 -19 29 -30 29s-21 -11 -29 -29c-9 -22 -15 -53 -15 -88s6 -67 15 -89c8 -19 18 -33 29 -33
+s22 15 30 33z" />
+ <glyph glyph-name="ion-speedometer" unicode="&#xf2b3;"
+d="M312 192l8 -8l-64 -84v-4c0 -18 -14 -32 -32 -32s-32 14 -32 32s14 32 32 32h4zM224 352c124 0 224 -100 224 -224c0 -34 -8 -67 -22 -96h-36c15 27 25 57 26 88h-32v16h32c-1 29 -9 56 -22 81l-27 -15l-8 13l27 16c-8 12 -16 23 -26 33s-21 18 -33 26l-16 -27l-14 8
+l16 27c-25 13 -52 21 -81 22v-32h-16v32c-29 -1 -56 -9 -81 -22l16 -27l-14 -8l-16 27c-12 -8 -23 -16 -33 -26s-19 -21 -26 -33l28 -16l-8 -13l-28 15c-13 -25 -21 -52 -22 -81h32v-16h-32c1 -31 11 -61 26 -88h-36c-14 29 -22 62 -22 96c0 124 100 224 224 224z" />
+ <glyph glyph-name="ion-spoon" unicode="&#xf2b4;" horiz-adv-x="128"
+d="M128 288c0 64 -26 128 -64 128s-64 -64 -64 -128v0c1 -25 16 -54 37 -64l1 -1v0c3 -2 10 -6 10 -10c0 0 -16 -199 -16 -210s4 -20 10 -26s14 -9 22 -9v0v0c8 0 16 3 22 9s10 13 10 26s-16 210 -16 210c0 4 7 8 10 10l1 1c22 10 37 38 37 64z" />
+ <glyph glyph-name="ion-star" unicode="&#xf24e;"
+d="M448 248l-139 -104l55 -176l-140 112l-140 -112l55 176l-139 104h172l52 168l53 -168h171z" />
+ <glyph glyph-name="ion-stats-bars" unicode="&#xf2b5;" horiz-adv-x="352"
+d="M96 32v320h64v-320h-64zM0 32v96h64v-96h-64zM192 32v160h64v-160h-64zM288 32v224h64v-224h-64z" />
+ <glyph glyph-name="ion-steam" unicode="&#xf30b;" horiz-adv-x="512"
+d="M480 240c0 -20 -16 -37 -37 -37c-20 0 -37 16 -37 37c0 20 16 37 37 37c20 0 37 -17 37 -37zM443 309c38 0 69 -31 69 -69s-31 -70 -69 -70l-67 -48c-2 -26 -24 -47 -51 -47c-25 0 -46 18 -51 41l-196 78c-8 -5 -16 -7 -26 -7c-28 0 -52 24 -52 52s24 52 52 52
+c25 0 45 -18 50 -41l196 -79c8 5 17 8 27 8c2 0 3 -1 5 -1l43 62c0 38 32 69 70 69zM443 286c-26 0 -47 -20 -47 -46s21 -47 47 -47s46 21 46 47s-20 46 -46 46zM52 277c-21 0 -38 -17 -38 -38s17 -38 38 -38c3 0 5 0 8 1l-16 6v0c-15 7 -22 24 -16 39s24 23 39 17v0l19 -7
+c-6 12 -19 20 -34 20zM325 165c-3 0 -6 -1 -9 -1l16 -6c16 -6 23 -24 17 -40s-23 -23 -39 -17c-6 3 -13 6 -19 8c6 -12 19 -20 34 -20c21 0 38 17 38 38s-17 38 -38 38z" />
+ <glyph glyph-name="ion-stop" unicode="&#xf24f;" horiz-adv-x="384"
+d="M373 384c6 0 11 -5 11 -11v-362c0 -6 -5 -11 -11 -11h-362c-6 0 -11 5 -11 11v362c0 6 5 11 11 11h362z" />
+ <glyph glyph-name="ion-thermometer" unicode="&#xf2b6;" horiz-adv-x="160"
+d="M127 112c20 -14 33 -38 33 -64c0 -44 -36 -80 -80 -80s-80 36 -80 80c0 27 13 51 33 65v257c0 26 21 46 47 46s47 -20 47 -46v-258zM65 370v-50h30v50c0 8 -7 14 -15 14s-15 -6 -15 -14zM96 160v16h-16v-16h16zM96 192v64h-16v-64h16z" />
+ <glyph glyph-name="ion-thumbsdown" unicode="&#xf250;" horiz-adv-x="384"
+d="M24 195c-10 5 -18 17 -18 29c0 14 8 25 20 30c-4 5 -6 12 -6 19c0 14 8 25 20 30c-3 5 -5 11 -5 17c0 18 11 24 35 30s74 12 126 9c23 -1 55 -7 76 -7v32h112v-240h-112v16c-15 -1 -31 -4 -40 -14c-22 -23 -40 -65 -40 -108c0 -19 1 -29 -4 -34c-13 -13 -44 9 -52 37
+c-9 34 -1 62 1 87h-103c-19 0 -34 15 -34 34c0 15 10 29 24 33zM336 352c-9 0 -16 -7 -16 -16s7 -16 16 -16s16 7 16 16s-7 16 -16 16z" />
+ <glyph glyph-name="ion-thumbsup" unicode="&#xf251;" horiz-adv-x="384"
+d="M360 189c10 -5 18 -17 18 -29c0 -14 -8 -25 -20 -30c4 -5 6 -12 6 -19c0 -14 -8 -25 -20 -30c3 -5 5 -11 5 -17c0 -18 -11 -24 -35 -30s-74 -12 -126 -9c-23 1 -55 7 -76 7v-32h-112v240h112v-16c15 1 31 4 40 14c22 23 40 65 40 108c0 19 -1 29 4 34c13 13 44 -9 52 -37
+c9 -34 1 -62 -1 -87h103c19 0 34 -15 34 -34c0 -15 -10 -29 -24 -33zM48 32c9 0 16 7 16 16s-7 16 -16 16s-16 -7 -16 -16s7 -16 16 -16z" />
+ <glyph glyph-name="ion-toggle-filled" unicode="&#xf354;"
+d="M320 240c26 0 48 -22 48 -48s-22 -48 -48 -48s-48 22 -48 48s22 48 48 48zM320 320c71 0 128 -57 128 -128s-57 -128 -128 -128h-192c-71 0 -128 57 -128 128s57 128 128 128h192zM320 112c44 0 80 36 80 80s-36 80 -80 80s-80 -36 -80 -80s36 -80 80 -80z" />
+ <glyph glyph-name="ion-toggle" unicode="&#xf355;"
+d="M320 288h-192c-53 0 -96 -43 -96 -96s43 -96 96 -96h192c53 0 96 43 96 96s-43 96 -96 96zM320 320v0c71 0 128 -57 128 -128s-57 -128 -128 -128h-192c-71 0 -128 57 -128 128s57 128 128 128h192zM128 240c-26 0 -48 -22 -48 -48s22 -48 48 -48s48 22 48 48
+s-22 48 -48 48zM128 272v0c44 0 80 -36 80 -80s-36 -80 -80 -80s-80 36 -80 80s36 80 80 80z" />
+ <glyph glyph-name="ion-transgender" unicode="&#xf4f5;" horiz-adv-x="512"
+d="M368 448h144v-144h-40v76l-101 -100c8 -17 13 -36 13 -56c0 -63 -46 -115 -104 -126v-52h72v-46h-72v-64h-48v64h-72v46h72v52c-59 11 -104 63 -104 126c0 20 5 39 13 56l-22 22l-36 -36l-33 33l36 36l-46 45v-76h-40v144h144v-40h-70l43 -42l36 36l33 -33l-36 -36
+l17 -17c23 22 54 36 89 36c27 0 53 -8 74 -23c0 0 6 -5 15 -13l93 92h-70v40zM256 144c44 0 80 36 80 80s-36 80 -80 80s-80 -36 -80 -80s36 -80 80 -80z" />
+ <glyph glyph-name="ion-trash-a" unicode="&#xf252;" horiz-adv-x="352"
+d="M261 320v0h91v-32h-9s-5 -1 -8 -4s-4 -9 -4 -9l-19 -241c-2 -29 -2 -34 -36 -34h-200c-34 0 -34 5 -36 34l-19 242s-1 6 -4 9s-8 3 -8 3h-9v32h91v29c0 19 14 35 34 35h101c20 0 35 -16 35 -35v-29zM112 349v-29h128v29c0 10 -9 15 -19 15h-91c-10 0 -18 -5 -18 -15z
+M104 64h20l-10 192h-21zM187 64v192h-22v-192h22zM249 64l10 192h-20l-11 -192h21z" />
+ <glyph glyph-name="ion-trash-b" unicode="&#xf253;" horiz-adv-x="320"
+d="M318 315c3 -12 4 -11 -7 -11h-302c-11 0 -10 -1 -7 11c2 9 4 13 4 13c3 9 9 9 19 11l53 7c7 1 7 1 10 7c9 20 10 31 20 31h103c10 0 12 -11 21 -31c3 -6 3 -6 10 -7l53 -6c10 -2 16 -2 19 -11c0 0 2 -5 4 -14zM283 272c17 0 18 -2 17 -15l-19 -242c-2 -12 -2 -15 -17 -15
+h-208c-15 0 -15 3 -17 15l-19 242c-1 12 0 15 17 15h246z" />
+ <glyph glyph-name="ion-trophy" unicode="&#xf356;"
+d="M448 345c0 -25 2 -73 -22 -122c-15 -30 -36 -55 -63 -75c-23 -16 -49 -28 -77 -35c-16 -17 -32 -27 -46 -31v-33s0 -49 99 -49h13v-32h-256v32h13c85 0 97 35 99 46v36c-14 4 -30 14 -46 31c-28 7 -55 19 -77 35c-27 20 -48 45 -63 75c-17 36 -21 71 -22 97v0v11v0v21v0
+h80c-2 35 0 64 0 64h143h1h1h142s2 -29 0 -64h81v-7zM51 237c17 -34 43 -61 77 -78c-22 40 -33 84 -42 135c-1 8 -2 17 -3 26h-51c1 -23 5 -53 19 -83zM397 237c14 30 18 60 19 83h-51c-1 -9 -3 -18 -4 -26c-9 -51 -20 -95 -42 -135c34 17 61 43 78 78z" />
+ <glyph glyph-name="ion-tshirt-outline" unicode="&#xf4f6;"
+d="M146 362l-104 -31l11 -32l39 4l38 5l-2 -38l-14 -255h220l-14 255l-2 38l38 -5l39 -4l11 32l-104 31c-6 -8 -13 -14 -21 -19c-15 -10 -34 -15 -57 -15v0v0c-34 1 -59 11 -78 34zM288 400v0l160 -48l-32 -88l-64 8l16 -289h-288l16 289l-64 -8l-32 88l160 48
+c14 -27 31 -39 64 -40c33 0 50 13 64 40z" />
+ <glyph glyph-name="ion-tshirt" unicode="&#xf4f7;"
+d="M448 352l-32 -88l-64 8l16 -288h-288l16 288l-64 -8l-32 88l160 48c14 -27 31 -39 64 -40c33 0 50 13 64 40z" />
+ <glyph glyph-name="ion-umbrella" unicode="&#xf2b7;"
+d="M344 160v0v0v0zM104 160v0v0v0zM240 399c116 -8 208 -109 208 -227v-12c-4 25 -26 52 -52 52c-29 0 -52 -23 -52 -52v0c0 29 -23 52 -52 52s-49 -12 -52 -45v-135c0 -17 -6 -33 -18 -45s-29 -19 -46 -19c-35 0 -63 29 -63 64c0 9 7 16 16 16s16 -7 16 -16
+c0 -18 14 -32 31 -32c18 0 32 14 32 32v134c-1 24 -26 46 -52 46c-29 0 -52 -23 -52 -52v0c0 29 -23 52 -52 52c-27 0 -49 -26 -52 -52v18c0 118 92 213 208 221v1c0 9 7 16 16 16s16 -7 16 -16v-1z" />
+ <glyph glyph-name="ion-university" unicode="&#xf357;"
+d="M224 384l224 -111l-92 -60l-132 -85l-160 102v-198l-32 16v203l-32 21zM358 192l10 -82c-16 -12 -112 -78 -144 -110c-32 32 -128 98 -144 110l9 82l135 -88z" />
+ <glyph glyph-name="ion-unlocked" unicode="&#xf254;" horiz-adv-x="384"
+d="M22 -32c-12 0 -22 10 -22 22v212c0 12 10 22 22 22h3h19v31c0 42 17 87 43 115s64 46 105 46v0v0c41 0 79 -18 105 -46c20 -21 33 -51 39 -82h-53c-5 18 -13 35 -24 47v0v1c-18 19 -42 29 -67 29v0v0c-25 0 -49 -10 -67 -29v-1v0c-18 -19 -28 -53 -28 -80v-31h265
+c12 0 22 -10 22 -22v-212c0 -12 -10 -22 -22 -22h-340z" />
+ <glyph glyph-name="ion-upload" unicode="&#xf255;"
+d="M366 215c45 0 82 -37 82 -83s-37 -84 -82 -84h-110v80h48l-80 84l-80 -84h48v-80h-102c-49 0 -90 41 -90 91c0 40 26 74 61 86c5 29 29 51 59 51c10 0 18 -3 26 -7c19 40 59 67 105 67c64 0 115 -53 115 -118v-3z" />
+ <glyph glyph-name="ion-usb" unicode="&#xf2b8;" horiz-adv-x="256"
+d="M16 228v0v0zM256 320c0 -11 -6 -21 -14 -27v0c-2 -1 -3 -5 -3 -7c-1 -20 -3 -36 -9 -50c-7 -19 -20 -33 -39 -46c-17 -12 -29 -21 -36 -34c-7 -12 -11 -28 -11 -53v-24c0 -7 2 -13 10 -18c4 -2 7 -6 10 -9c8 -9 14 -21 14 -34c0 -28 -22 -50 -50 -50s-50 22 -50 50v1v0
+c0 18 10 33 24 42c5 4 9 5 9 18v0c0 14 -3 17 -10 27s-18 17 -32 26c-19 13 -33 27 -40 46c-6 15 -8 31 -9 39s-2 9 -4 11c-10 6 -16 16 -16 28c0 18 14 32 32 32s32 -14 32 -32c0 -10 -4 -20 -12 -26c-3 -2 -4 -11 -4 -14v0v0c0 -9 3 -18 7 -28c10 -21 45 -44 52 -44
+s8 5 8 12v196s-1 2 -3 4h-1v1v0c-9 6 -15 16 -15 27c0 18 14 32 32 32s32 -14 32 -32c0 -11 -5 -21 -14 -27v0c-2 -2 -2 -3 -2 -5v-140c0 -10 2 -12 8 -11c13 3 48 30 52 43c3 10 6 23 7 41v1c0 2 -2 4 -3 6c-10 6 -16 16 -16 28c0 18 14 32 32 32s32 -14 32 -32zM32 240
+c9 0 16 7 16 16s-7 16 -16 16s-16 -7 -16 -16s7 -16 16 -16zM128 368c9 0 16 7 16 16s-7 16 -16 16s-16 -7 -16 -16s7 -16 16 -16zM224 304c9 0 16 7 16 16s-7 16 -16 16s-16 -7 -16 -16s7 -16 16 -16z" />
+ <glyph glyph-name="ion-videocamera" unicode="&#xf256;"
+d="M335 263v-66l113 35v-89v-88l-113 35v-65c0 -5 -4 -9 -9 -9h-317c-5 0 -9 4 -9 9v12v55v171c0 5 4 9 9 9h208v38c0 4 -6 10 -10 10h-176v48h178c36 0 65 -29 65 -64v-32h52c5 0 9 -4 9 -9zM226 107c20 0 36 16 36 36s-16 35 -36 35s-36 -15 -36 -35c0 -10 4 -19 11 -26
+h-68c7 7 11 16 11 26c0 20 -16 36 -36 36s-36 -16 -36 -36s16 -36 36 -36h12h95h11z" />
+ <glyph glyph-name="ion-volume-high" unicode="&#xf257;"
+d="M199 40l-95 88h-104v128h104l95 88v-304zM255 92l-20 16c17 24 27 52 27 84s-10 60 -27 84l20 16c20 -28 33 -63 33 -100s-13 -72 -33 -100zM322 46l-21 16c27 36 43 81 43 130s-16 94 -43 130l21 16c30 -41 48 -91 48 -146s-18 -105 -48 -146zM365 369l20 15
+c39 -54 63 -120 63 -192s-24 -138 -63 -192l-20 15c36 49 58 111 58 177s-22 128 -58 177z" />
+ <glyph glyph-name="ion-volume-low" unicode="&#xf258;" horiz-adv-x="288"
+d="M199 40l-95 88h-104v128h104l95 88v-304zM255 92l-20 16c17 24 28 52 28 84s-11 60 -28 84l20 16c20 -28 33 -63 33 -100s-13 -72 -33 -100z" />
+ <glyph glyph-name="ion-volume-medium" unicode="&#xf259;" horiz-adv-x="370"
+d="M199 40l-95 88h-104v128h104l95 88v-304zM255 92l-20 16c17 24 28 52 28 84s-11 60 -28 84l20 16c20 -28 33 -63 33 -100s-13 -72 -33 -100zM322 46l-21 16c27 36 43 81 43 130s-16 94 -43 130l21 16c30 -41 48 -91 48 -146s-18 -105 -48 -146z" />
+ <glyph glyph-name="ion-volume-mute" unicode="&#xf25a;"
+d="M224 231l47 51v-180l-47 51h-65v78h65zM332 388c69 -38 116 -112 116 -196c0 -124 -100 -224 -224 -224c-39 0 -76 10 -108 27l-1 1c-69 38 -115 112 -115 196c0 124 100 224 224 224c39 0 75 -10 107 -28h1zM362 93c20 28 33 62 33 99c0 66 -38 123 -92 151
+c-6 3 -11 6 -17 8c-19 7 -40 11 -62 11c-37 0 -71 -12 -99 -32l73 -74h-76l-36 35c-20 -28 -32 -62 -32 -99c0 -65 36 -121 90 -150c6 -3 13 -7 19 -9c19 -7 39 -11 61 -11c37 0 72 12 100 32l-20 20v77z" />
+ <glyph glyph-name="ion-wand" unicode="&#xf358;"
+d="M192 208l48 48l48 -48l-48 -48zM0 16l176 176l48 -48l-176 -176zM224 352v64h32v-64h-32zM398 344l-45 -45l-23 22l46 45zM127 299l-45 45l22 22l45 -45zM376 50l-46 45l23 23l45 -46zM384 192v32h64v-32h-64z" />
+ <glyph glyph-name="ion-waterdrop" unicode="&#xf25b;" horiz-adv-x="320"
+d="M175 409c40 -41 145 -160 145 -288c0 -85 -72 -153 -160 -153c-56 0 -106 27 -134 69c-6 9 -11 19 -15 29c-7 17 -11 35 -11 55v4c1 67 31 131 64 183c20 31 42 57 59 77c9 10 16 18 22 24l1 1v0c4 3 8 6 14 6c5 0 10 -3 14 -6v0zM160 24c55 0 100 45 100 100
+c0 14 -3 28 -8 40c-17 -65 -70 -116 -136 -130c13 -6 28 -10 44 -10z" />
+ <glyph glyph-name="ion-wifi" unicode="&#xf25c;"
+d="M224 352c80 0 156 -30 214 -84l10 -10l-10 -9l-32 -32l-10 -10l-9 9c-44 41 -103 64 -163 64s-119 -23 -163 -64l-9 -9l-10 10l-32 32l-10 9l10 10c58 54 134 84 214 84v0zM365 192l11 -10l-10 -10l-33 -32l-9 -9l-10 8c-25 22 -57 35 -90 35s-65 -13 -90 -35l-10 -8
+l-9 9l-33 32l-10 10l11 10c37 33 83 52 132 54v0h9v0v0c52 0 102 -19 141 -54zM224 32l-10 10l-52 52l-11 10l12 10c17 11 32 20 61 20s47 -9 62 -20l11 -10l-10 -10l-53 -52z" />
+ <glyph glyph-name="ion-wineglass" unicode="&#xf2b9;" horiz-adv-x="256"
+d="M167 153c-11 -4 -24 -8 -24 -32v-94c0 -11 4 -19 12 -25c3 -2 7 -4 15 -6c32 -9 48 -16 50 -18c2 -1 4 -3 4 -7c0 0 -14 -3 -96 -3s-96 3 -96 3c0 4 2 6 4 7c2 2 18 9 50 18c8 2 11 4 14 6c8 6 11 14 11 25v94c0 24 -11 28 -22 32s-18 6 -26 11c-12 7 -23 16 -32 26
+c-20 23 -31 52 -31 87c0 50 4 100 8 114s14 25 31 25h178c17 0 27 -11 31 -25s8 -65 8 -115c0 -35 -11 -63 -31 -86c-9 -10 -20 -19 -32 -26c-8 -5 -15 -7 -26 -11zM128 178c26 0 50 11 67 28l6 6c16 18 22 35 23 65s-2 83 -8 107h-177c-7 -35 -8 -80 -7 -108s7 -46 23 -64
+c2 -3 4 -6 7 -8c17 -16 41 -26 66 -26zM208 277c0 -10 -1 -20 -4 -29s-8 -18 -15 -25l-5 -5c-14 -14 -34 -23 -56 -23c-21 0 -41 8 -55 22l-6 6c-7 7 -12 16 -15 25s-3 15 -4 29c-1 9 0 34 1 53c1 10 2 19 3 22h153c1 -6 2 -14 2 -22c1 -21 1 -45 1 -53zM192 269v0v26
+c0 4 -4 8 -8 8s-8 -4 -8 -8v-26c0 -3 1 -6 3 -7c1 -1 3 -1 5 -1c4 0 8 3 8 8zM191 316c1 2 1 4 1 6s-2 4 -4 5s-4 1 -6 1s-4 -1 -5 -3s-1 -4 -1 -6s2 -4 4 -5s4 -1 6 -1s4 1 5 3z" />
+ <glyph glyph-name="ion-woman" unicode="&#xf25d;" horiz-adv-x="192"
+d="M30 299c3 12 17 33 42 34h48c24 -1 38 -22 42 -34l29 -104c6 -23 -21 -32 -27 -10l-26 96h-9l46 -169h-43v-127c0 -23 -31 -23 -31 0v127h-10v-127c0 -23 -32 -23 -32 0v127h-42l45 169h-7l-27 -96c-7 -21 -33 -13 -27 10zM133 379c0 -21 -17 -37 -37 -37s-37 16 -37 37
+s17 37 37 37s37 -16 37 -37z" />
+ <glyph glyph-name="ion-wrench" unicode="&#xf2ba;"
+d="M430 333c14 -14 19 -31 18 -44s-6 -39 -32 -65s-77 -42 -113 -24c-5 3 -13 5 -21 -3c-10 -9 -202 -215 -202 -215c-17 -19 -48 -18 -66 0s-19 49 0 66c0 0 207 194 215 202s5 16 3 22c-20 47 2 89 24 112c22 24 51 31 65 32c13 1 31 -5 44 -18l-57 -56l10 -56l55 -10z
+M59 5c6 6 6 17 0 23s-16 6 -22 0s-6 -17 0 -23s16 -6 22 0z" />
+ <glyph glyph-name="ion-xbox" unicode="&#xf30c;"
+d="M95 200c-49 -72 -50 -139 -50 -143c-28 38 -45 84 -45 135c0 67 30 128 77 169l3 -1c51 -18 93 -68 93 -68s-38 -33 -78 -92zM448 192c0 -51 -17 -97 -45 -135c0 4 -1 71 -50 143c-40 59 -78 92 -78 92s42 50 93 68l3 1c47 -41 77 -102 77 -169zM169 367
+c-37 17 -65 12 -72 10c36 25 80 39 127 39s91 -14 127 -39c-7 2 -35 6 -72 -10c-29 -13 -55 -35 -55 -35s-26 22 -55 35zM327 155c40 -49 54 -85 62 -108l2 -5c-41 -46 -101 -74 -167 -74s-126 28 -167 74l1 5c8 23 23 59 63 108c46 57 103 94 103 94s57 -37 103 -94z" />
+ </font>
+</defs></svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.ttf b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.ttf
new file mode 100644
index 00000000..c4e46324
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.ttf
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.woff b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.woff
new file mode 100644
index 00000000..5f3a14e0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.woff
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-font.less b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-font.less
new file mode 100644
index 00000000..1d9bf7ee
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-font.less
@@ -0,0 +1,27 @@
+// Ionicons Font Path
+// --------------------------
+
+@font-face {
+ font-family: @ionicons-font-family;
+ src:url("@{ionicons-font-path}/ionicons.eot?v=@{ionicons-version}");
+ src:url("@{ionicons-font-path}/ionicons.eot?v=@{ionicons-version}#iefix") format("embedded-opentype"),
+ url("@{ionicons-font-path}/ionicons.ttf?v=@{ionicons-version}") format("truetype"),
+ url("@{ionicons-font-path}/ionicons.woff?v=@{ionicons-version}") format("woff"),
+ url("@{ionicons-font-path}/ionicons.svg?v=@{ionicons-version}#Ionicons") format("svg");
+ font-weight: normal;
+ font-style: normal;
+}
+
+.ion {
+ display: inline-block;
+ font-family: @ionicons-font-family;
+ speak: none;
+ font-style: normal;
+ font-weight: normal;
+ font-variant: normal;
+ text-transform: none;
+ text-rendering: auto;
+ line-height: 1;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-icons.less b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-icons.less
new file mode 100644
index 00000000..5e6052e9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-icons.less
@@ -0,0 +1,1473 @@
+// Ionicons Icons
+// --------------------------
+
+.ionicons,
+.@{ionicons-prefix}alert:before,
+.@{ionicons-prefix}alert-circled:before,
+.@{ionicons-prefix}android-add:before,
+.@{ionicons-prefix}android-add-circle:before,
+.@{ionicons-prefix}android-alarm-clock:before,
+.@{ionicons-prefix}android-alert:before,
+.@{ionicons-prefix}android-apps:before,
+.@{ionicons-prefix}android-archive:before,
+.@{ionicons-prefix}android-arrow-back:before,
+.@{ionicons-prefix}android-arrow-down:before,
+.@{ionicons-prefix}android-arrow-dropdown:before,
+.@{ionicons-prefix}android-arrow-dropdown-circle:before,
+.@{ionicons-prefix}android-arrow-dropleft:before,
+.@{ionicons-prefix}android-arrow-dropleft-circle:before,
+.@{ionicons-prefix}android-arrow-dropright:before,
+.@{ionicons-prefix}android-arrow-dropright-circle:before,
+.@{ionicons-prefix}android-arrow-dropup:before,
+.@{ionicons-prefix}android-arrow-dropup-circle:before,
+.@{ionicons-prefix}android-arrow-forward:before,
+.@{ionicons-prefix}android-arrow-up:before,
+.@{ionicons-prefix}android-attach:before,
+.@{ionicons-prefix}android-bar:before,
+.@{ionicons-prefix}android-bicycle:before,
+.@{ionicons-prefix}android-boat:before,
+.@{ionicons-prefix}android-bookmark:before,
+.@{ionicons-prefix}android-bulb:before,
+.@{ionicons-prefix}android-bus:before,
+.@{ionicons-prefix}android-calendar:before,
+.@{ionicons-prefix}android-call:before,
+.@{ionicons-prefix}android-camera:before,
+.@{ionicons-prefix}android-cancel:before,
+.@{ionicons-prefix}android-car:before,
+.@{ionicons-prefix}android-cart:before,
+.@{ionicons-prefix}android-chat:before,
+.@{ionicons-prefix}android-checkbox:before,
+.@{ionicons-prefix}android-checkbox-blank:before,
+.@{ionicons-prefix}android-checkbox-outline:before,
+.@{ionicons-prefix}android-checkbox-outline-blank:before,
+.@{ionicons-prefix}android-checkmark-circle:before,
+.@{ionicons-prefix}android-clipboard:before,
+.@{ionicons-prefix}android-close:before,
+.@{ionicons-prefix}android-cloud:before,
+.@{ionicons-prefix}android-cloud-circle:before,
+.@{ionicons-prefix}android-cloud-done:before,
+.@{ionicons-prefix}android-cloud-outline:before,
+.@{ionicons-prefix}android-color-palette:before,
+.@{ionicons-prefix}android-compass:before,
+.@{ionicons-prefix}android-contact:before,
+.@{ionicons-prefix}android-contacts:before,
+.@{ionicons-prefix}android-contract:before,
+.@{ionicons-prefix}android-create:before,
+.@{ionicons-prefix}android-delete:before,
+.@{ionicons-prefix}android-desktop:before,
+.@{ionicons-prefix}android-document:before,
+.@{ionicons-prefix}android-done:before,
+.@{ionicons-prefix}android-done-all:before,
+.@{ionicons-prefix}android-download:before,
+.@{ionicons-prefix}android-drafts:before,
+.@{ionicons-prefix}android-exit:before,
+.@{ionicons-prefix}android-expand:before,
+.@{ionicons-prefix}android-favorite:before,
+.@{ionicons-prefix}android-favorite-outline:before,
+.@{ionicons-prefix}android-film:before,
+.@{ionicons-prefix}android-folder:before,
+.@{ionicons-prefix}android-folder-open:before,
+.@{ionicons-prefix}android-funnel:before,
+.@{ionicons-prefix}android-globe:before,
+.@{ionicons-prefix}android-hand:before,
+.@{ionicons-prefix}android-hangout:before,
+.@{ionicons-prefix}android-happy:before,
+.@{ionicons-prefix}android-home:before,
+.@{ionicons-prefix}android-image:before,
+.@{ionicons-prefix}android-laptop:before,
+.@{ionicons-prefix}android-list:before,
+.@{ionicons-prefix}android-locate:before,
+.@{ionicons-prefix}android-lock:before,
+.@{ionicons-prefix}android-mail:before,
+.@{ionicons-prefix}android-map:before,
+.@{ionicons-prefix}android-menu:before,
+.@{ionicons-prefix}android-microphone:before,
+.@{ionicons-prefix}android-microphone-off:before,
+.@{ionicons-prefix}android-more-horizontal:before,
+.@{ionicons-prefix}android-more-vertical:before,
+.@{ionicons-prefix}android-navigate:before,
+.@{ionicons-prefix}android-notifications:before,
+.@{ionicons-prefix}android-notifications-none:before,
+.@{ionicons-prefix}android-notifications-off:before,
+.@{ionicons-prefix}android-open:before,
+.@{ionicons-prefix}android-options:before,
+.@{ionicons-prefix}android-people:before,
+.@{ionicons-prefix}android-person:before,
+.@{ionicons-prefix}android-person-add:before,
+.@{ionicons-prefix}android-phone-landscape:before,
+.@{ionicons-prefix}android-phone-portrait:before,
+.@{ionicons-prefix}android-pin:before,
+.@{ionicons-prefix}android-plane:before,
+.@{ionicons-prefix}android-playstore:before,
+.@{ionicons-prefix}android-print:before,
+.@{ionicons-prefix}android-radio-button-off:before,
+.@{ionicons-prefix}android-radio-button-on:before,
+.@{ionicons-prefix}android-refresh:before,
+.@{ionicons-prefix}android-remove:before,
+.@{ionicons-prefix}android-remove-circle:before,
+.@{ionicons-prefix}android-restaurant:before,
+.@{ionicons-prefix}android-sad:before,
+.@{ionicons-prefix}android-search:before,
+.@{ionicons-prefix}android-send:before,
+.@{ionicons-prefix}android-settings:before,
+.@{ionicons-prefix}android-share:before,
+.@{ionicons-prefix}android-share-alt:before,
+.@{ionicons-prefix}android-star:before,
+.@{ionicons-prefix}android-star-half:before,
+.@{ionicons-prefix}android-star-outline:before,
+.@{ionicons-prefix}android-stopwatch:before,
+.@{ionicons-prefix}android-subway:before,
+.@{ionicons-prefix}android-sunny:before,
+.@{ionicons-prefix}android-sync:before,
+.@{ionicons-prefix}android-textsms:before,
+.@{ionicons-prefix}android-time:before,
+.@{ionicons-prefix}android-train:before,
+.@{ionicons-prefix}android-unlock:before,
+.@{ionicons-prefix}android-upload:before,
+.@{ionicons-prefix}android-volume-down:before,
+.@{ionicons-prefix}android-volume-mute:before,
+.@{ionicons-prefix}android-volume-off:before,
+.@{ionicons-prefix}android-volume-up:before,
+.@{ionicons-prefix}android-walk:before,
+.@{ionicons-prefix}android-warning:before,
+.@{ionicons-prefix}android-watch:before,
+.@{ionicons-prefix}android-wifi:before,
+.@{ionicons-prefix}aperture:before,
+.@{ionicons-prefix}archive:before,
+.@{ionicons-prefix}arrow-down-a:before,
+.@{ionicons-prefix}arrow-down-b:before,
+.@{ionicons-prefix}arrow-down-c:before,
+.@{ionicons-prefix}arrow-expand:before,
+.@{ionicons-prefix}arrow-graph-down-left:before,
+.@{ionicons-prefix}arrow-graph-down-right:before,
+.@{ionicons-prefix}arrow-graph-up-left:before,
+.@{ionicons-prefix}arrow-graph-up-right:before,
+.@{ionicons-prefix}arrow-left-a:before,
+.@{ionicons-prefix}arrow-left-b:before,
+.@{ionicons-prefix}arrow-left-c:before,
+.@{ionicons-prefix}arrow-move:before,
+.@{ionicons-prefix}arrow-resize:before,
+.@{ionicons-prefix}arrow-return-left:before,
+.@{ionicons-prefix}arrow-return-right:before,
+.@{ionicons-prefix}arrow-right-a:before,
+.@{ionicons-prefix}arrow-right-b:before,
+.@{ionicons-prefix}arrow-right-c:before,
+.@{ionicons-prefix}arrow-shrink:before,
+.@{ionicons-prefix}arrow-swap:before,
+.@{ionicons-prefix}arrow-up-a:before,
+.@{ionicons-prefix}arrow-up-b:before,
+.@{ionicons-prefix}arrow-up-c:before,
+.@{ionicons-prefix}asterisk:before,
+.@{ionicons-prefix}at:before,
+.@{ionicons-prefix}backspace:before,
+.@{ionicons-prefix}backspace-outline:before,
+.@{ionicons-prefix}bag:before,
+.@{ionicons-prefix}battery-charging:before,
+.@{ionicons-prefix}battery-empty:before,
+.@{ionicons-prefix}battery-full:before,
+.@{ionicons-prefix}battery-half:before,
+.@{ionicons-prefix}battery-low:before,
+.@{ionicons-prefix}beaker:before,
+.@{ionicons-prefix}beer:before,
+.@{ionicons-prefix}bluetooth:before,
+.@{ionicons-prefix}bonfire:before,
+.@{ionicons-prefix}bookmark:before,
+.@{ionicons-prefix}bowtie:before,
+.@{ionicons-prefix}briefcase:before,
+.@{ionicons-prefix}bug:before,
+.@{ionicons-prefix}calculator:before,
+.@{ionicons-prefix}calendar:before,
+.@{ionicons-prefix}camera:before,
+.@{ionicons-prefix}card:before,
+.@{ionicons-prefix}cash:before,
+.@{ionicons-prefix}chatbox:before,
+.@{ionicons-prefix}chatbox-working:before,
+.@{ionicons-prefix}chatboxes:before,
+.@{ionicons-prefix}chatbubble:before,
+.@{ionicons-prefix}chatbubble-working:before,
+.@{ionicons-prefix}chatbubbles:before,
+.@{ionicons-prefix}checkmark:before,
+.@{ionicons-prefix}checkmark-circled:before,
+.@{ionicons-prefix}checkmark-round:before,
+.@{ionicons-prefix}chevron-down:before,
+.@{ionicons-prefix}chevron-left:before,
+.@{ionicons-prefix}chevron-right:before,
+.@{ionicons-prefix}chevron-up:before,
+.@{ionicons-prefix}clipboard:before,
+.@{ionicons-prefix}clock:before,
+.@{ionicons-prefix}close:before,
+.@{ionicons-prefix}close-circled:before,
+.@{ionicons-prefix}close-round:before,
+.@{ionicons-prefix}closed-captioning:before,
+.@{ionicons-prefix}cloud:before,
+.@{ionicons-prefix}code:before,
+.@{ionicons-prefix}code-download:before,
+.@{ionicons-prefix}code-working:before,
+.@{ionicons-prefix}coffee:before,
+.@{ionicons-prefix}compass:before,
+.@{ionicons-prefix}compose:before,
+.@{ionicons-prefix}connection-bars:before,
+.@{ionicons-prefix}contrast:before,
+.@{ionicons-prefix}crop:before,
+.@{ionicons-prefix}cube:before,
+.@{ionicons-prefix}disc:before,
+.@{ionicons-prefix}document:before,
+.@{ionicons-prefix}document-text:before,
+.@{ionicons-prefix}drag:before,
+.@{ionicons-prefix}earth:before,
+.@{ionicons-prefix}easel:before,
+.@{ionicons-prefix}edit:before,
+.@{ionicons-prefix}egg:before,
+.@{ionicons-prefix}eject:before,
+.@{ionicons-prefix}email:before,
+.@{ionicons-prefix}email-unread:before,
+.@{ionicons-prefix}erlenmeyer-flask:before,
+.@{ionicons-prefix}erlenmeyer-flask-bubbles:before,
+.@{ionicons-prefix}eye:before,
+.@{ionicons-prefix}eye-disabled:before,
+.@{ionicons-prefix}female:before,
+.@{ionicons-prefix}filing:before,
+.@{ionicons-prefix}film-marker:before,
+.@{ionicons-prefix}fireball:before,
+.@{ionicons-prefix}flag:before,
+.@{ionicons-prefix}flame:before,
+.@{ionicons-prefix}flash:before,
+.@{ionicons-prefix}flash-off:before,
+.@{ionicons-prefix}folder:before,
+.@{ionicons-prefix}fork:before,
+.@{ionicons-prefix}fork-repo:before,
+.@{ionicons-prefix}forward:before,
+.@{ionicons-prefix}funnel:before,
+.@{ionicons-prefix}gear-a:before,
+.@{ionicons-prefix}gear-b:before,
+.@{ionicons-prefix}grid:before,
+.@{ionicons-prefix}hammer:before,
+.@{ionicons-prefix}happy:before,
+.@{ionicons-prefix}happy-outline:before,
+.@{ionicons-prefix}headphone:before,
+.@{ionicons-prefix}heart:before,
+.@{ionicons-prefix}heart-broken:before,
+.@{ionicons-prefix}help:before,
+.@{ionicons-prefix}help-buoy:before,
+.@{ionicons-prefix}help-circled:before,
+.@{ionicons-prefix}home:before,
+.@{ionicons-prefix}icecream:before,
+.@{ionicons-prefix}image:before,
+.@{ionicons-prefix}images:before,
+.@{ionicons-prefix}information:before,
+.@{ionicons-prefix}information-circled:before,
+.@{ionicons-prefix}ionic:before,
+.@{ionicons-prefix}ios-alarm:before,
+.@{ionicons-prefix}ios-alarm-outline:before,
+.@{ionicons-prefix}ios-albums:before,
+.@{ionicons-prefix}ios-albums-outline:before,
+.@{ionicons-prefix}ios-americanfootball:before,
+.@{ionicons-prefix}ios-americanfootball-outline:before,
+.@{ionicons-prefix}ios-analytics:before,
+.@{ionicons-prefix}ios-analytics-outline:before,
+.@{ionicons-prefix}ios-arrow-back:before,
+.@{ionicons-prefix}ios-arrow-down:before,
+.@{ionicons-prefix}ios-arrow-forward:before,
+.@{ionicons-prefix}ios-arrow-left:before,
+.@{ionicons-prefix}ios-arrow-right:before,
+.@{ionicons-prefix}ios-arrow-thin-down:before,
+.@{ionicons-prefix}ios-arrow-thin-left:before,
+.@{ionicons-prefix}ios-arrow-thin-right:before,
+.@{ionicons-prefix}ios-arrow-thin-up:before,
+.@{ionicons-prefix}ios-arrow-up:before,
+.@{ionicons-prefix}ios-at:before,
+.@{ionicons-prefix}ios-at-outline:before,
+.@{ionicons-prefix}ios-barcode:before,
+.@{ionicons-prefix}ios-barcode-outline:before,
+.@{ionicons-prefix}ios-baseball:before,
+.@{ionicons-prefix}ios-baseball-outline:before,
+.@{ionicons-prefix}ios-basketball:before,
+.@{ionicons-prefix}ios-basketball-outline:before,
+.@{ionicons-prefix}ios-bell:before,
+.@{ionicons-prefix}ios-bell-outline:before,
+.@{ionicons-prefix}ios-body:before,
+.@{ionicons-prefix}ios-body-outline:before,
+.@{ionicons-prefix}ios-bolt:before,
+.@{ionicons-prefix}ios-bolt-outline:before,
+.@{ionicons-prefix}ios-book:before,
+.@{ionicons-prefix}ios-book-outline:before,
+.@{ionicons-prefix}ios-bookmarks:before,
+.@{ionicons-prefix}ios-bookmarks-outline:before,
+.@{ionicons-prefix}ios-box:before,
+.@{ionicons-prefix}ios-box-outline:before,
+.@{ionicons-prefix}ios-briefcase:before,
+.@{ionicons-prefix}ios-briefcase-outline:before,
+.@{ionicons-prefix}ios-browsers:before,
+.@{ionicons-prefix}ios-browsers-outline:before,
+.@{ionicons-prefix}ios-calculator:before,
+.@{ionicons-prefix}ios-calculator-outline:before,
+.@{ionicons-prefix}ios-calendar:before,
+.@{ionicons-prefix}ios-calendar-outline:before,
+.@{ionicons-prefix}ios-camera:before,
+.@{ionicons-prefix}ios-camera-outline:before,
+.@{ionicons-prefix}ios-cart:before,
+.@{ionicons-prefix}ios-cart-outline:before,
+.@{ionicons-prefix}ios-chatboxes:before,
+.@{ionicons-prefix}ios-chatboxes-outline:before,
+.@{ionicons-prefix}ios-chatbubble:before,
+.@{ionicons-prefix}ios-chatbubble-outline:before,
+.@{ionicons-prefix}ios-checkmark:before,
+.@{ionicons-prefix}ios-checkmark-empty:before,
+.@{ionicons-prefix}ios-checkmark-outline:before,
+.@{ionicons-prefix}ios-circle-filled:before,
+.@{ionicons-prefix}ios-circle-outline:before,
+.@{ionicons-prefix}ios-clock:before,
+.@{ionicons-prefix}ios-clock-outline:before,
+.@{ionicons-prefix}ios-close:before,
+.@{ionicons-prefix}ios-close-empty:before,
+.@{ionicons-prefix}ios-close-outline:before,
+.@{ionicons-prefix}ios-cloud:before,
+.@{ionicons-prefix}ios-cloud-download:before,
+.@{ionicons-prefix}ios-cloud-download-outline:before,
+.@{ionicons-prefix}ios-cloud-outline:before,
+.@{ionicons-prefix}ios-cloud-upload:before,
+.@{ionicons-prefix}ios-cloud-upload-outline:before,
+.@{ionicons-prefix}ios-cloudy:before,
+.@{ionicons-prefix}ios-cloudy-night:before,
+.@{ionicons-prefix}ios-cloudy-night-outline:before,
+.@{ionicons-prefix}ios-cloudy-outline:before,
+.@{ionicons-prefix}ios-cog:before,
+.@{ionicons-prefix}ios-cog-outline:before,
+.@{ionicons-prefix}ios-color-filter:before,
+.@{ionicons-prefix}ios-color-filter-outline:before,
+.@{ionicons-prefix}ios-color-wand:before,
+.@{ionicons-prefix}ios-color-wand-outline:before,
+.@{ionicons-prefix}ios-compose:before,
+.@{ionicons-prefix}ios-compose-outline:before,
+.@{ionicons-prefix}ios-contact:before,
+.@{ionicons-prefix}ios-contact-outline:before,
+.@{ionicons-prefix}ios-copy:before,
+.@{ionicons-prefix}ios-copy-outline:before,
+.@{ionicons-prefix}ios-crop:before,
+.@{ionicons-prefix}ios-crop-strong:before,
+.@{ionicons-prefix}ios-download:before,
+.@{ionicons-prefix}ios-download-outline:before,
+.@{ionicons-prefix}ios-drag:before,
+.@{ionicons-prefix}ios-email:before,
+.@{ionicons-prefix}ios-email-outline:before,
+.@{ionicons-prefix}ios-eye:before,
+.@{ionicons-prefix}ios-eye-outline:before,
+.@{ionicons-prefix}ios-fastforward:before,
+.@{ionicons-prefix}ios-fastforward-outline:before,
+.@{ionicons-prefix}ios-filing:before,
+.@{ionicons-prefix}ios-filing-outline:before,
+.@{ionicons-prefix}ios-film:before,
+.@{ionicons-prefix}ios-film-outline:before,
+.@{ionicons-prefix}ios-flag:before,
+.@{ionicons-prefix}ios-flag-outline:before,
+.@{ionicons-prefix}ios-flame:before,
+.@{ionicons-prefix}ios-flame-outline:before,
+.@{ionicons-prefix}ios-flask:before,
+.@{ionicons-prefix}ios-flask-outline:before,
+.@{ionicons-prefix}ios-flower:before,
+.@{ionicons-prefix}ios-flower-outline:before,
+.@{ionicons-prefix}ios-folder:before,
+.@{ionicons-prefix}ios-folder-outline:before,
+.@{ionicons-prefix}ios-football:before,
+.@{ionicons-prefix}ios-football-outline:before,
+.@{ionicons-prefix}ios-game-controller-a:before,
+.@{ionicons-prefix}ios-game-controller-a-outline:before,
+.@{ionicons-prefix}ios-game-controller-b:before,
+.@{ionicons-prefix}ios-game-controller-b-outline:before,
+.@{ionicons-prefix}ios-gear:before,
+.@{ionicons-prefix}ios-gear-outline:before,
+.@{ionicons-prefix}ios-glasses:before,
+.@{ionicons-prefix}ios-glasses-outline:before,
+.@{ionicons-prefix}ios-grid-view:before,
+.@{ionicons-prefix}ios-grid-view-outline:before,
+.@{ionicons-prefix}ios-heart:before,
+.@{ionicons-prefix}ios-heart-outline:before,
+.@{ionicons-prefix}ios-help:before,
+.@{ionicons-prefix}ios-help-empty:before,
+.@{ionicons-prefix}ios-help-outline:before,
+.@{ionicons-prefix}ios-home:before,
+.@{ionicons-prefix}ios-home-outline:before,
+.@{ionicons-prefix}ios-infinite:before,
+.@{ionicons-prefix}ios-infinite-outline:before,
+.@{ionicons-prefix}ios-information:before,
+.@{ionicons-prefix}ios-information-empty:before,
+.@{ionicons-prefix}ios-information-outline:before,
+.@{ionicons-prefix}ios-ionic-outline:before,
+.@{ionicons-prefix}ios-keypad:before,
+.@{ionicons-prefix}ios-keypad-outline:before,
+.@{ionicons-prefix}ios-lightbulb:before,
+.@{ionicons-prefix}ios-lightbulb-outline:before,
+.@{ionicons-prefix}ios-list:before,
+.@{ionicons-prefix}ios-list-outline:before,
+.@{ionicons-prefix}ios-location:before,
+.@{ionicons-prefix}ios-location-outline:before,
+.@{ionicons-prefix}ios-locked:before,
+.@{ionicons-prefix}ios-locked-outline:before,
+.@{ionicons-prefix}ios-loop:before,
+.@{ionicons-prefix}ios-loop-strong:before,
+.@{ionicons-prefix}ios-medical:before,
+.@{ionicons-prefix}ios-medical-outline:before,
+.@{ionicons-prefix}ios-medkit:before,
+.@{ionicons-prefix}ios-medkit-outline:before,
+.@{ionicons-prefix}ios-mic:before,
+.@{ionicons-prefix}ios-mic-off:before,
+.@{ionicons-prefix}ios-mic-outline:before,
+.@{ionicons-prefix}ios-minus:before,
+.@{ionicons-prefix}ios-minus-empty:before,
+.@{ionicons-prefix}ios-minus-outline:before,
+.@{ionicons-prefix}ios-monitor:before,
+.@{ionicons-prefix}ios-monitor-outline:before,
+.@{ionicons-prefix}ios-moon:before,
+.@{ionicons-prefix}ios-moon-outline:before,
+.@{ionicons-prefix}ios-more:before,
+.@{ionicons-prefix}ios-more-outline:before,
+.@{ionicons-prefix}ios-musical-note:before,
+.@{ionicons-prefix}ios-musical-notes:before,
+.@{ionicons-prefix}ios-navigate:before,
+.@{ionicons-prefix}ios-navigate-outline:before,
+.@{ionicons-prefix}ios-nutrition:before,
+.@{ionicons-prefix}ios-nutrition-outline:before,
+.@{ionicons-prefix}ios-paper:before,
+.@{ionicons-prefix}ios-paper-outline:before,
+.@{ionicons-prefix}ios-paperplane:before,
+.@{ionicons-prefix}ios-paperplane-outline:before,
+.@{ionicons-prefix}ios-partlysunny:before,
+.@{ionicons-prefix}ios-partlysunny-outline:before,
+.@{ionicons-prefix}ios-pause:before,
+.@{ionicons-prefix}ios-pause-outline:before,
+.@{ionicons-prefix}ios-paw:before,
+.@{ionicons-prefix}ios-paw-outline:before,
+.@{ionicons-prefix}ios-people:before,
+.@{ionicons-prefix}ios-people-outline:before,
+.@{ionicons-prefix}ios-person:before,
+.@{ionicons-prefix}ios-person-outline:before,
+.@{ionicons-prefix}ios-personadd:before,
+.@{ionicons-prefix}ios-personadd-outline:before,
+.@{ionicons-prefix}ios-photos:before,
+.@{ionicons-prefix}ios-photos-outline:before,
+.@{ionicons-prefix}ios-pie:before,
+.@{ionicons-prefix}ios-pie-outline:before,
+.@{ionicons-prefix}ios-pint:before,
+.@{ionicons-prefix}ios-pint-outline:before,
+.@{ionicons-prefix}ios-play:before,
+.@{ionicons-prefix}ios-play-outline:before,
+.@{ionicons-prefix}ios-plus:before,
+.@{ionicons-prefix}ios-plus-empty:before,
+.@{ionicons-prefix}ios-plus-outline:before,
+.@{ionicons-prefix}ios-pricetag:before,
+.@{ionicons-prefix}ios-pricetag-outline:before,
+.@{ionicons-prefix}ios-pricetags:before,
+.@{ionicons-prefix}ios-pricetags-outline:before,
+.@{ionicons-prefix}ios-printer:before,
+.@{ionicons-prefix}ios-printer-outline:before,
+.@{ionicons-prefix}ios-pulse:before,
+.@{ionicons-prefix}ios-pulse-strong:before,
+.@{ionicons-prefix}ios-rainy:before,
+.@{ionicons-prefix}ios-rainy-outline:before,
+.@{ionicons-prefix}ios-recording:before,
+.@{ionicons-prefix}ios-recording-outline:before,
+.@{ionicons-prefix}ios-redo:before,
+.@{ionicons-prefix}ios-redo-outline:before,
+.@{ionicons-prefix}ios-refresh:before,
+.@{ionicons-prefix}ios-refresh-empty:before,
+.@{ionicons-prefix}ios-refresh-outline:before,
+.@{ionicons-prefix}ios-reload:before,
+.@{ionicons-prefix}ios-reverse-camera:before,
+.@{ionicons-prefix}ios-reverse-camera-outline:before,
+.@{ionicons-prefix}ios-rewind:before,
+.@{ionicons-prefix}ios-rewind-outline:before,
+.@{ionicons-prefix}ios-rose:before,
+.@{ionicons-prefix}ios-rose-outline:before,
+.@{ionicons-prefix}ios-search:before,
+.@{ionicons-prefix}ios-search-strong:before,
+.@{ionicons-prefix}ios-settings:before,
+.@{ionicons-prefix}ios-settings-strong:before,
+.@{ionicons-prefix}ios-shuffle:before,
+.@{ionicons-prefix}ios-shuffle-strong:before,
+.@{ionicons-prefix}ios-skipbackward:before,
+.@{ionicons-prefix}ios-skipbackward-outline:before,
+.@{ionicons-prefix}ios-skipforward:before,
+.@{ionicons-prefix}ios-skipforward-outline:before,
+.@{ionicons-prefix}ios-snowy:before,
+.@{ionicons-prefix}ios-speedometer:before,
+.@{ionicons-prefix}ios-speedometer-outline:before,
+.@{ionicons-prefix}ios-star:before,
+.@{ionicons-prefix}ios-star-half:before,
+.@{ionicons-prefix}ios-star-outline:before,
+.@{ionicons-prefix}ios-stopwatch:before,
+.@{ionicons-prefix}ios-stopwatch-outline:before,
+.@{ionicons-prefix}ios-sunny:before,
+.@{ionicons-prefix}ios-sunny-outline:before,
+.@{ionicons-prefix}ios-telephone:before,
+.@{ionicons-prefix}ios-telephone-outline:before,
+.@{ionicons-prefix}ios-tennisball:before,
+.@{ionicons-prefix}ios-tennisball-outline:before,
+.@{ionicons-prefix}ios-thunderstorm:before,
+.@{ionicons-prefix}ios-thunderstorm-outline:before,
+.@{ionicons-prefix}ios-time:before,
+.@{ionicons-prefix}ios-time-outline:before,
+.@{ionicons-prefix}ios-timer:before,
+.@{ionicons-prefix}ios-timer-outline:before,
+.@{ionicons-prefix}ios-toggle:before,
+.@{ionicons-prefix}ios-toggle-outline:before,
+.@{ionicons-prefix}ios-trash:before,
+.@{ionicons-prefix}ios-trash-outline:before,
+.@{ionicons-prefix}ios-undo:before,
+.@{ionicons-prefix}ios-undo-outline:before,
+.@{ionicons-prefix}ios-unlocked:before,
+.@{ionicons-prefix}ios-unlocked-outline:before,
+.@{ionicons-prefix}ios-upload:before,
+.@{ionicons-prefix}ios-upload-outline:before,
+.@{ionicons-prefix}ios-videocam:before,
+.@{ionicons-prefix}ios-videocam-outline:before,
+.@{ionicons-prefix}ios-volume-high:before,
+.@{ionicons-prefix}ios-volume-low:before,
+.@{ionicons-prefix}ios-wineglass:before,
+.@{ionicons-prefix}ios-wineglass-outline:before,
+.@{ionicons-prefix}ios-world:before,
+.@{ionicons-prefix}ios-world-outline:before,
+.@{ionicons-prefix}ipad:before,
+.@{ionicons-prefix}iphone:before,
+.@{ionicons-prefix}ipod:before,
+.@{ionicons-prefix}jet:before,
+.@{ionicons-prefix}key:before,
+.@{ionicons-prefix}knife:before,
+.@{ionicons-prefix}laptop:before,
+.@{ionicons-prefix}leaf:before,
+.@{ionicons-prefix}levels:before,
+.@{ionicons-prefix}lightbulb:before,
+.@{ionicons-prefix}link:before,
+.@{ionicons-prefix}load-a:before,
+.@{ionicons-prefix}load-b:before,
+.@{ionicons-prefix}load-c:before,
+.@{ionicons-prefix}load-d:before,
+.@{ionicons-prefix}location:before,
+.@{ionicons-prefix}lock-combination:before,
+.@{ionicons-prefix}locked:before,
+.@{ionicons-prefix}log-in:before,
+.@{ionicons-prefix}log-out:before,
+.@{ionicons-prefix}loop:before,
+.@{ionicons-prefix}magnet:before,
+.@{ionicons-prefix}male:before,
+.@{ionicons-prefix}man:before,
+.@{ionicons-prefix}map:before,
+.@{ionicons-prefix}medkit:before,
+.@{ionicons-prefix}merge:before,
+.@{ionicons-prefix}mic-a:before,
+.@{ionicons-prefix}mic-b:before,
+.@{ionicons-prefix}mic-c:before,
+.@{ionicons-prefix}minus:before,
+.@{ionicons-prefix}minus-circled:before,
+.@{ionicons-prefix}minus-round:before,
+.@{ionicons-prefix}model-s:before,
+.@{ionicons-prefix}monitor:before,
+.@{ionicons-prefix}more:before,
+.@{ionicons-prefix}mouse:before,
+.@{ionicons-prefix}music-note:before,
+.@{ionicons-prefix}navicon:before,
+.@{ionicons-prefix}navicon-round:before,
+.@{ionicons-prefix}navigate:before,
+.@{ionicons-prefix}network:before,
+.@{ionicons-prefix}no-smoking:before,
+.@{ionicons-prefix}nuclear:before,
+.@{ionicons-prefix}outlet:before,
+.@{ionicons-prefix}paintbrush:before,
+.@{ionicons-prefix}paintbucket:before,
+.@{ionicons-prefix}paper-airplane:before,
+.@{ionicons-prefix}paperclip:before,
+.@{ionicons-prefix}pause:before,
+.@{ionicons-prefix}person:before,
+.@{ionicons-prefix}person-add:before,
+.@{ionicons-prefix}person-stalker:before,
+.@{ionicons-prefix}pie-graph:before,
+.@{ionicons-prefix}pin:before,
+.@{ionicons-prefix}pinpoint:before,
+.@{ionicons-prefix}pizza:before,
+.@{ionicons-prefix}plane:before,
+.@{ionicons-prefix}planet:before,
+.@{ionicons-prefix}play:before,
+.@{ionicons-prefix}playstation:before,
+.@{ionicons-prefix}plus:before,
+.@{ionicons-prefix}plus-circled:before,
+.@{ionicons-prefix}plus-round:before,
+.@{ionicons-prefix}podium:before,
+.@{ionicons-prefix}pound:before,
+.@{ionicons-prefix}power:before,
+.@{ionicons-prefix}pricetag:before,
+.@{ionicons-prefix}pricetags:before,
+.@{ionicons-prefix}printer:before,
+.@{ionicons-prefix}pull-request:before,
+.@{ionicons-prefix}qr-scanner:before,
+.@{ionicons-prefix}quote:before,
+.@{ionicons-prefix}radio-waves:before,
+.@{ionicons-prefix}record:before,
+.@{ionicons-prefix}refresh:before,
+.@{ionicons-prefix}reply:before,
+.@{ionicons-prefix}reply-all:before,
+.@{ionicons-prefix}ribbon-a:before,
+.@{ionicons-prefix}ribbon-b:before,
+.@{ionicons-prefix}sad:before,
+.@{ionicons-prefix}sad-outline:before,
+.@{ionicons-prefix}scissors:before,
+.@{ionicons-prefix}search:before,
+.@{ionicons-prefix}settings:before,
+.@{ionicons-prefix}share:before,
+.@{ionicons-prefix}shuffle:before,
+.@{ionicons-prefix}skip-backward:before,
+.@{ionicons-prefix}skip-forward:before,
+.@{ionicons-prefix}social-android:before,
+.@{ionicons-prefix}social-android-outline:before,
+.@{ionicons-prefix}social-angular:before,
+.@{ionicons-prefix}social-angular-outline:before,
+.@{ionicons-prefix}social-apple:before,
+.@{ionicons-prefix}social-apple-outline:before,
+.@{ionicons-prefix}social-bitcoin:before,
+.@{ionicons-prefix}social-bitcoin-outline:before,
+.@{ionicons-prefix}social-buffer:before,
+.@{ionicons-prefix}social-buffer-outline:before,
+.@{ionicons-prefix}social-chrome:before,
+.@{ionicons-prefix}social-chrome-outline:before,
+.@{ionicons-prefix}social-codepen:before,
+.@{ionicons-prefix}social-codepen-outline:before,
+.@{ionicons-prefix}social-css3:before,
+.@{ionicons-prefix}social-css3-outline:before,
+.@{ionicons-prefix}social-designernews:before,
+.@{ionicons-prefix}social-designernews-outline:before,
+.@{ionicons-prefix}social-dribbble:before,
+.@{ionicons-prefix}social-dribbble-outline:before,
+.@{ionicons-prefix}social-dropbox:before,
+.@{ionicons-prefix}social-dropbox-outline:before,
+.@{ionicons-prefix}social-euro:before,
+.@{ionicons-prefix}social-euro-outline:before,
+.@{ionicons-prefix}social-facebook:before,
+.@{ionicons-prefix}social-facebook-outline:before,
+.@{ionicons-prefix}social-foursquare:before,
+.@{ionicons-prefix}social-foursquare-outline:before,
+.@{ionicons-prefix}social-freebsd-devil:before,
+.@{ionicons-prefix}social-github:before,
+.@{ionicons-prefix}social-github-outline:before,
+.@{ionicons-prefix}social-google:before,
+.@{ionicons-prefix}social-google-outline:before,
+.@{ionicons-prefix}social-googleplus:before,
+.@{ionicons-prefix}social-googleplus-outline:before,
+.@{ionicons-prefix}social-hackernews:before,
+.@{ionicons-prefix}social-hackernews-outline:before,
+.@{ionicons-prefix}social-html5:before,
+.@{ionicons-prefix}social-html5-outline:before,
+.@{ionicons-prefix}social-instagram:before,
+.@{ionicons-prefix}social-instagram-outline:before,
+.@{ionicons-prefix}social-javascript:before,
+.@{ionicons-prefix}social-javascript-outline:before,
+.@{ionicons-prefix}social-linkedin:before,
+.@{ionicons-prefix}social-linkedin-outline:before,
+.@{ionicons-prefix}social-markdown:before,
+.@{ionicons-prefix}social-nodejs:before,
+.@{ionicons-prefix}social-octocat:before,
+.@{ionicons-prefix}social-pinterest:before,
+.@{ionicons-prefix}social-pinterest-outline:before,
+.@{ionicons-prefix}social-python:before,
+.@{ionicons-prefix}social-reddit:before,
+.@{ionicons-prefix}social-reddit-outline:before,
+.@{ionicons-prefix}social-rss:before,
+.@{ionicons-prefix}social-rss-outline:before,
+.@{ionicons-prefix}social-sass:before,
+.@{ionicons-prefix}social-skype:before,
+.@{ionicons-prefix}social-skype-outline:before,
+.@{ionicons-prefix}social-snapchat:before,
+.@{ionicons-prefix}social-snapchat-outline:before,
+.@{ionicons-prefix}social-tumblr:before,
+.@{ionicons-prefix}social-tumblr-outline:before,
+.@{ionicons-prefix}social-tux:before,
+.@{ionicons-prefix}social-twitch:before,
+.@{ionicons-prefix}social-twitch-outline:before,
+.@{ionicons-prefix}social-twitter:before,
+.@{ionicons-prefix}social-twitter-outline:before,
+.@{ionicons-prefix}social-usd:before,
+.@{ionicons-prefix}social-usd-outline:before,
+.@{ionicons-prefix}social-vimeo:before,
+.@{ionicons-prefix}social-vimeo-outline:before,
+.@{ionicons-prefix}social-whatsapp:before,
+.@{ionicons-prefix}social-whatsapp-outline:before,
+.@{ionicons-prefix}social-windows:before,
+.@{ionicons-prefix}social-windows-outline:before,
+.@{ionicons-prefix}social-wordpress:before,
+.@{ionicons-prefix}social-wordpress-outline:before,
+.@{ionicons-prefix}social-yahoo:before,
+.@{ionicons-prefix}social-yahoo-outline:before,
+.@{ionicons-prefix}social-yen:before,
+.@{ionicons-prefix}social-yen-outline:before,
+.@{ionicons-prefix}social-youtube:before,
+.@{ionicons-prefix}social-youtube-outline:before,
+.@{ionicons-prefix}soup-can:before,
+.@{ionicons-prefix}soup-can-outline:before,
+.@{ionicons-prefix}speakerphone:before,
+.@{ionicons-prefix}speedometer:before,
+.@{ionicons-prefix}spoon:before,
+.@{ionicons-prefix}star:before,
+.@{ionicons-prefix}stats-bars:before,
+.@{ionicons-prefix}steam:before,
+.@{ionicons-prefix}stop:before,
+.@{ionicons-prefix}thermometer:before,
+.@{ionicons-prefix}thumbsdown:before,
+.@{ionicons-prefix}thumbsup:before,
+.@{ionicons-prefix}toggle:before,
+.@{ionicons-prefix}toggle-filled:before,
+.@{ionicons-prefix}transgender:before,
+.@{ionicons-prefix}trash-a:before,
+.@{ionicons-prefix}trash-b:before,
+.@{ionicons-prefix}trophy:before,
+.@{ionicons-prefix}tshirt:before,
+.@{ionicons-prefix}tshirt-outline:before,
+.@{ionicons-prefix}umbrella:before,
+.@{ionicons-prefix}university:before,
+.@{ionicons-prefix}unlocked:before,
+.@{ionicons-prefix}upload:before,
+.@{ionicons-prefix}usb:before,
+.@{ionicons-prefix}videocamera:before,
+.@{ionicons-prefix}volume-high:before,
+.@{ionicons-prefix}volume-low:before,
+.@{ionicons-prefix}volume-medium:before,
+.@{ionicons-prefix}volume-mute:before,
+.@{ionicons-prefix}wand:before,
+.@{ionicons-prefix}waterdrop:before,
+.@{ionicons-prefix}wifi:before,
+.@{ionicons-prefix}wineglass:before,
+.@{ionicons-prefix}woman:before,
+.@{ionicons-prefix}wrench:before,
+.@{ionicons-prefix}xbox:before
+{
+ &:extend(.ion);
+}
+.@{ionicons-prefix}alert:before { content: @ionicon-var-alert; }
+.@{ionicons-prefix}alert-circled:before { content: @ionicon-var-alert-circled; }
+.@{ionicons-prefix}android-add:before { content: @ionicon-var-android-add; }
+.@{ionicons-prefix}android-add-circle:before { content: @ionicon-var-android-add-circle; }
+.@{ionicons-prefix}android-alarm-clock:before { content: @ionicon-var-android-alarm-clock; }
+.@{ionicons-prefix}android-alert:before { content: @ionicon-var-android-alert; }
+.@{ionicons-prefix}android-apps:before { content: @ionicon-var-android-apps; }
+.@{ionicons-prefix}android-archive:before { content: @ionicon-var-android-archive; }
+.@{ionicons-prefix}android-arrow-back:before { content: @ionicon-var-android-arrow-back; }
+.@{ionicons-prefix}android-arrow-down:before { content: @ionicon-var-android-arrow-down; }
+.@{ionicons-prefix}android-arrow-dropdown:before { content: @ionicon-var-android-arrow-dropdown; }
+.@{ionicons-prefix}android-arrow-dropdown-circle:before { content: @ionicon-var-android-arrow-dropdown-circle; }
+.@{ionicons-prefix}android-arrow-dropleft:before { content: @ionicon-var-android-arrow-dropleft; }
+.@{ionicons-prefix}android-arrow-dropleft-circle:before { content: @ionicon-var-android-arrow-dropleft-circle; }
+.@{ionicons-prefix}android-arrow-dropright:before { content: @ionicon-var-android-arrow-dropright; }
+.@{ionicons-prefix}android-arrow-dropright-circle:before { content: @ionicon-var-android-arrow-dropright-circle; }
+.@{ionicons-prefix}android-arrow-dropup:before { content: @ionicon-var-android-arrow-dropup; }
+.@{ionicons-prefix}android-arrow-dropup-circle:before { content: @ionicon-var-android-arrow-dropup-circle; }
+.@{ionicons-prefix}android-arrow-forward:before { content: @ionicon-var-android-arrow-forward; }
+.@{ionicons-prefix}android-arrow-up:before { content: @ionicon-var-android-arrow-up; }
+.@{ionicons-prefix}android-attach:before { content: @ionicon-var-android-attach; }
+.@{ionicons-prefix}android-bar:before { content: @ionicon-var-android-bar; }
+.@{ionicons-prefix}android-bicycle:before { content: @ionicon-var-android-bicycle; }
+.@{ionicons-prefix}android-boat:before { content: @ionicon-var-android-boat; }
+.@{ionicons-prefix}android-bookmark:before { content: @ionicon-var-android-bookmark; }
+.@{ionicons-prefix}android-bulb:before { content: @ionicon-var-android-bulb; }
+.@{ionicons-prefix}android-bus:before { content: @ionicon-var-android-bus; }
+.@{ionicons-prefix}android-calendar:before { content: @ionicon-var-android-calendar; }
+.@{ionicons-prefix}android-call:before { content: @ionicon-var-android-call; }
+.@{ionicons-prefix}android-camera:before { content: @ionicon-var-android-camera; }
+.@{ionicons-prefix}android-cancel:before { content: @ionicon-var-android-cancel; }
+.@{ionicons-prefix}android-car:before { content: @ionicon-var-android-car; }
+.@{ionicons-prefix}android-cart:before { content: @ionicon-var-android-cart; }
+.@{ionicons-prefix}android-chat:before { content: @ionicon-var-android-chat; }
+.@{ionicons-prefix}android-checkbox:before { content: @ionicon-var-android-checkbox; }
+.@{ionicons-prefix}android-checkbox-blank:before { content: @ionicon-var-android-checkbox-blank; }
+.@{ionicons-prefix}android-checkbox-outline:before { content: @ionicon-var-android-checkbox-outline; }
+.@{ionicons-prefix}android-checkbox-outline-blank:before { content: @ionicon-var-android-checkbox-outline-blank; }
+.@{ionicons-prefix}android-checkmark-circle:before { content: @ionicon-var-android-checkmark-circle; }
+.@{ionicons-prefix}android-clipboard:before { content: @ionicon-var-android-clipboard; }
+.@{ionicons-prefix}android-close:before { content: @ionicon-var-android-close; }
+.@{ionicons-prefix}android-cloud:before { content: @ionicon-var-android-cloud; }
+.@{ionicons-prefix}android-cloud-circle:before { content: @ionicon-var-android-cloud-circle; }
+.@{ionicons-prefix}android-cloud-done:before { content: @ionicon-var-android-cloud-done; }
+.@{ionicons-prefix}android-cloud-outline:before { content: @ionicon-var-android-cloud-outline; }
+.@{ionicons-prefix}android-color-palette:before { content: @ionicon-var-android-color-palette; }
+.@{ionicons-prefix}android-compass:before { content: @ionicon-var-android-compass; }
+.@{ionicons-prefix}android-contact:before { content: @ionicon-var-android-contact; }
+.@{ionicons-prefix}android-contacts:before { content: @ionicon-var-android-contacts; }
+.@{ionicons-prefix}android-contract:before { content: @ionicon-var-android-contract; }
+.@{ionicons-prefix}android-create:before { content: @ionicon-var-android-create; }
+.@{ionicons-prefix}android-delete:before { content: @ionicon-var-android-delete; }
+.@{ionicons-prefix}android-desktop:before { content: @ionicon-var-android-desktop; }
+.@{ionicons-prefix}android-document:before { content: @ionicon-var-android-document; }
+.@{ionicons-prefix}android-done:before { content: @ionicon-var-android-done; }
+.@{ionicons-prefix}android-done-all:before { content: @ionicon-var-android-done-all; }
+.@{ionicons-prefix}android-download:before { content: @ionicon-var-android-download; }
+.@{ionicons-prefix}android-drafts:before { content: @ionicon-var-android-drafts; }
+.@{ionicons-prefix}android-exit:before { content: @ionicon-var-android-exit; }
+.@{ionicons-prefix}android-expand:before { content: @ionicon-var-android-expand; }
+.@{ionicons-prefix}android-favorite:before { content: @ionicon-var-android-favorite; }
+.@{ionicons-prefix}android-favorite-outline:before { content: @ionicon-var-android-favorite-outline; }
+.@{ionicons-prefix}android-film:before { content: @ionicon-var-android-film; }
+.@{ionicons-prefix}android-folder:before { content: @ionicon-var-android-folder; }
+.@{ionicons-prefix}android-folder-open:before { content: @ionicon-var-android-folder-open; }
+.@{ionicons-prefix}android-funnel:before { content: @ionicon-var-android-funnel; }
+.@{ionicons-prefix}android-globe:before { content: @ionicon-var-android-globe; }
+.@{ionicons-prefix}android-hand:before { content: @ionicon-var-android-hand; }
+.@{ionicons-prefix}android-hangout:before { content: @ionicon-var-android-hangout; }
+.@{ionicons-prefix}android-happy:before { content: @ionicon-var-android-happy; }
+.@{ionicons-prefix}android-home:before { content: @ionicon-var-android-home; }
+.@{ionicons-prefix}android-image:before { content: @ionicon-var-android-image; }
+.@{ionicons-prefix}android-laptop:before { content: @ionicon-var-android-laptop; }
+.@{ionicons-prefix}android-list:before { content: @ionicon-var-android-list; }
+.@{ionicons-prefix}android-locate:before { content: @ionicon-var-android-locate; }
+.@{ionicons-prefix}android-lock:before { content: @ionicon-var-android-lock; }
+.@{ionicons-prefix}android-mail:before { content: @ionicon-var-android-mail; }
+.@{ionicons-prefix}android-map:before { content: @ionicon-var-android-map; }
+.@{ionicons-prefix}android-menu:before { content: @ionicon-var-android-menu; }
+.@{ionicons-prefix}android-microphone:before { content: @ionicon-var-android-microphone; }
+.@{ionicons-prefix}android-microphone-off:before { content: @ionicon-var-android-microphone-off; }
+.@{ionicons-prefix}android-more-horizontal:before { content: @ionicon-var-android-more-horizontal; }
+.@{ionicons-prefix}android-more-vertical:before { content: @ionicon-var-android-more-vertical; }
+.@{ionicons-prefix}android-navigate:before { content: @ionicon-var-android-navigate; }
+.@{ionicons-prefix}android-notifications:before { content: @ionicon-var-android-notifications; }
+.@{ionicons-prefix}android-notifications-none:before { content: @ionicon-var-android-notifications-none; }
+.@{ionicons-prefix}android-notifications-off:before { content: @ionicon-var-android-notifications-off; }
+.@{ionicons-prefix}android-open:before { content: @ionicon-var-android-open; }
+.@{ionicons-prefix}android-options:before { content: @ionicon-var-android-options; }
+.@{ionicons-prefix}android-people:before { content: @ionicon-var-android-people; }
+.@{ionicons-prefix}android-person:before { content: @ionicon-var-android-person; }
+.@{ionicons-prefix}android-person-add:before { content: @ionicon-var-android-person-add; }
+.@{ionicons-prefix}android-phone-landscape:before { content: @ionicon-var-android-phone-landscape; }
+.@{ionicons-prefix}android-phone-portrait:before { content: @ionicon-var-android-phone-portrait; }
+.@{ionicons-prefix}android-pin:before { content: @ionicon-var-android-pin; }
+.@{ionicons-prefix}android-plane:before { content: @ionicon-var-android-plane; }
+.@{ionicons-prefix}android-playstore:before { content: @ionicon-var-android-playstore; }
+.@{ionicons-prefix}android-print:before { content: @ionicon-var-android-print; }
+.@{ionicons-prefix}android-radio-button-off:before { content: @ionicon-var-android-radio-button-off; }
+.@{ionicons-prefix}android-radio-button-on:before { content: @ionicon-var-android-radio-button-on; }
+.@{ionicons-prefix}android-refresh:before { content: @ionicon-var-android-refresh; }
+.@{ionicons-prefix}android-remove:before { content: @ionicon-var-android-remove; }
+.@{ionicons-prefix}android-remove-circle:before { content: @ionicon-var-android-remove-circle; }
+.@{ionicons-prefix}android-restaurant:before { content: @ionicon-var-android-restaurant; }
+.@{ionicons-prefix}android-sad:before { content: @ionicon-var-android-sad; }
+.@{ionicons-prefix}android-search:before { content: @ionicon-var-android-search; }
+.@{ionicons-prefix}android-send:before { content: @ionicon-var-android-send; }
+.@{ionicons-prefix}android-settings:before { content: @ionicon-var-android-settings; }
+.@{ionicons-prefix}android-share:before { content: @ionicon-var-android-share; }
+.@{ionicons-prefix}android-share-alt:before { content: @ionicon-var-android-share-alt; }
+.@{ionicons-prefix}android-star:before { content: @ionicon-var-android-star; }
+.@{ionicons-prefix}android-star-half:before { content: @ionicon-var-android-star-half; }
+.@{ionicons-prefix}android-star-outline:before { content: @ionicon-var-android-star-outline; }
+.@{ionicons-prefix}android-stopwatch:before { content: @ionicon-var-android-stopwatch; }
+.@{ionicons-prefix}android-subway:before { content: @ionicon-var-android-subway; }
+.@{ionicons-prefix}android-sunny:before { content: @ionicon-var-android-sunny; }
+.@{ionicons-prefix}android-sync:before { content: @ionicon-var-android-sync; }
+.@{ionicons-prefix}android-textsms:before { content: @ionicon-var-android-textsms; }
+.@{ionicons-prefix}android-time:before { content: @ionicon-var-android-time; }
+.@{ionicons-prefix}android-train:before { content: @ionicon-var-android-train; }
+.@{ionicons-prefix}android-unlock:before { content: @ionicon-var-android-unlock; }
+.@{ionicons-prefix}android-upload:before { content: @ionicon-var-android-upload; }
+.@{ionicons-prefix}android-volume-down:before { content: @ionicon-var-android-volume-down; }
+.@{ionicons-prefix}android-volume-mute:before { content: @ionicon-var-android-volume-mute; }
+.@{ionicons-prefix}android-volume-off:before { content: @ionicon-var-android-volume-off; }
+.@{ionicons-prefix}android-volume-up:before { content: @ionicon-var-android-volume-up; }
+.@{ionicons-prefix}android-walk:before { content: @ionicon-var-android-walk; }
+.@{ionicons-prefix}android-warning:before { content: @ionicon-var-android-warning; }
+.@{ionicons-prefix}android-watch:before { content: @ionicon-var-android-watch; }
+.@{ionicons-prefix}android-wifi:before { content: @ionicon-var-android-wifi; }
+.@{ionicons-prefix}aperture:before { content: @ionicon-var-aperture; }
+.@{ionicons-prefix}archive:before { content: @ionicon-var-archive; }
+.@{ionicons-prefix}arrow-down-a:before { content: @ionicon-var-arrow-down-a; }
+.@{ionicons-prefix}arrow-down-b:before { content: @ionicon-var-arrow-down-b; }
+.@{ionicons-prefix}arrow-down-c:before { content: @ionicon-var-arrow-down-c; }
+.@{ionicons-prefix}arrow-expand:before { content: @ionicon-var-arrow-expand; }
+.@{ionicons-prefix}arrow-graph-down-left:before { content: @ionicon-var-arrow-graph-down-left; }
+.@{ionicons-prefix}arrow-graph-down-right:before { content: @ionicon-var-arrow-graph-down-right; }
+.@{ionicons-prefix}arrow-graph-up-left:before { content: @ionicon-var-arrow-graph-up-left; }
+.@{ionicons-prefix}arrow-graph-up-right:before { content: @ionicon-var-arrow-graph-up-right; }
+.@{ionicons-prefix}arrow-left-a:before { content: @ionicon-var-arrow-left-a; }
+.@{ionicons-prefix}arrow-left-b:before { content: @ionicon-var-arrow-left-b; }
+.@{ionicons-prefix}arrow-left-c:before { content: @ionicon-var-arrow-left-c; }
+.@{ionicons-prefix}arrow-move:before { content: @ionicon-var-arrow-move; }
+.@{ionicons-prefix}arrow-resize:before { content: @ionicon-var-arrow-resize; }
+.@{ionicons-prefix}arrow-return-left:before { content: @ionicon-var-arrow-return-left; }
+.@{ionicons-prefix}arrow-return-right:before { content: @ionicon-var-arrow-return-right; }
+.@{ionicons-prefix}arrow-right-a:before { content: @ionicon-var-arrow-right-a; }
+.@{ionicons-prefix}arrow-right-b:before { content: @ionicon-var-arrow-right-b; }
+.@{ionicons-prefix}arrow-right-c:before { content: @ionicon-var-arrow-right-c; }
+.@{ionicons-prefix}arrow-shrink:before { content: @ionicon-var-arrow-shrink; }
+.@{ionicons-prefix}arrow-swap:before { content: @ionicon-var-arrow-swap; }
+.@{ionicons-prefix}arrow-up-a:before { content: @ionicon-var-arrow-up-a; }
+.@{ionicons-prefix}arrow-up-b:before { content: @ionicon-var-arrow-up-b; }
+.@{ionicons-prefix}arrow-up-c:before { content: @ionicon-var-arrow-up-c; }
+.@{ionicons-prefix}asterisk:before { content: @ionicon-var-asterisk; }
+.@{ionicons-prefix}at:before { content: @ionicon-var-at; }
+.@{ionicons-prefix}backspace:before { content: @ionicon-var-backspace; }
+.@{ionicons-prefix}backspace-outline:before { content: @ionicon-var-backspace-outline; }
+.@{ionicons-prefix}bag:before { content: @ionicon-var-bag; }
+.@{ionicons-prefix}battery-charging:before { content: @ionicon-var-battery-charging; }
+.@{ionicons-prefix}battery-empty:before { content: @ionicon-var-battery-empty; }
+.@{ionicons-prefix}battery-full:before { content: @ionicon-var-battery-full; }
+.@{ionicons-prefix}battery-half:before { content: @ionicon-var-battery-half; }
+.@{ionicons-prefix}battery-low:before { content: @ionicon-var-battery-low; }
+.@{ionicons-prefix}beaker:before { content: @ionicon-var-beaker; }
+.@{ionicons-prefix}beer:before { content: @ionicon-var-beer; }
+.@{ionicons-prefix}bluetooth:before { content: @ionicon-var-bluetooth; }
+.@{ionicons-prefix}bonfire:before { content: @ionicon-var-bonfire; }
+.@{ionicons-prefix}bookmark:before { content: @ionicon-var-bookmark; }
+.@{ionicons-prefix}bowtie:before { content: @ionicon-var-bowtie; }
+.@{ionicons-prefix}briefcase:before { content: @ionicon-var-briefcase; }
+.@{ionicons-prefix}bug:before { content: @ionicon-var-bug; }
+.@{ionicons-prefix}calculator:before { content: @ionicon-var-calculator; }
+.@{ionicons-prefix}calendar:before { content: @ionicon-var-calendar; }
+.@{ionicons-prefix}camera:before { content: @ionicon-var-camera; }
+.@{ionicons-prefix}card:before { content: @ionicon-var-card; }
+.@{ionicons-prefix}cash:before { content: @ionicon-var-cash; }
+.@{ionicons-prefix}chatbox:before { content: @ionicon-var-chatbox; }
+.@{ionicons-prefix}chatbox-working:before { content: @ionicon-var-chatbox-working; }
+.@{ionicons-prefix}chatboxes:before { content: @ionicon-var-chatboxes; }
+.@{ionicons-prefix}chatbubble:before { content: @ionicon-var-chatbubble; }
+.@{ionicons-prefix}chatbubble-working:before { content: @ionicon-var-chatbubble-working; }
+.@{ionicons-prefix}chatbubbles:before { content: @ionicon-var-chatbubbles; }
+.@{ionicons-prefix}checkmark:before { content: @ionicon-var-checkmark; }
+.@{ionicons-prefix}checkmark-circled:before { content: @ionicon-var-checkmark-circled; }
+.@{ionicons-prefix}checkmark-round:before { content: @ionicon-var-checkmark-round; }
+.@{ionicons-prefix}chevron-down:before { content: @ionicon-var-chevron-down; }
+.@{ionicons-prefix}chevron-left:before { content: @ionicon-var-chevron-left; }
+.@{ionicons-prefix}chevron-right:before { content: @ionicon-var-chevron-right; }
+.@{ionicons-prefix}chevron-up:before { content: @ionicon-var-chevron-up; }
+.@{ionicons-prefix}clipboard:before { content: @ionicon-var-clipboard; }
+.@{ionicons-prefix}clock:before { content: @ionicon-var-clock; }
+.@{ionicons-prefix}close:before { content: @ionicon-var-close; }
+.@{ionicons-prefix}close-circled:before { content: @ionicon-var-close-circled; }
+.@{ionicons-prefix}close-round:before { content: @ionicon-var-close-round; }
+.@{ionicons-prefix}closed-captioning:before { content: @ionicon-var-closed-captioning; }
+.@{ionicons-prefix}cloud:before { content: @ionicon-var-cloud; }
+.@{ionicons-prefix}code:before { content: @ionicon-var-code; }
+.@{ionicons-prefix}code-download:before { content: @ionicon-var-code-download; }
+.@{ionicons-prefix}code-working:before { content: @ionicon-var-code-working; }
+.@{ionicons-prefix}coffee:before { content: @ionicon-var-coffee; }
+.@{ionicons-prefix}compass:before { content: @ionicon-var-compass; }
+.@{ionicons-prefix}compose:before { content: @ionicon-var-compose; }
+.@{ionicons-prefix}connection-bars:before { content: @ionicon-var-connection-bars; }
+.@{ionicons-prefix}contrast:before { content: @ionicon-var-contrast; }
+.@{ionicons-prefix}crop:before { content: @ionicon-var-crop; }
+.@{ionicons-prefix}cube:before { content: @ionicon-var-cube; }
+.@{ionicons-prefix}disc:before { content: @ionicon-var-disc; }
+.@{ionicons-prefix}document:before { content: @ionicon-var-document; }
+.@{ionicons-prefix}document-text:before { content: @ionicon-var-document-text; }
+.@{ionicons-prefix}drag:before { content: @ionicon-var-drag; }
+.@{ionicons-prefix}earth:before { content: @ionicon-var-earth; }
+.@{ionicons-prefix}easel:before { content: @ionicon-var-easel; }
+.@{ionicons-prefix}edit:before { content: @ionicon-var-edit; }
+.@{ionicons-prefix}egg:before { content: @ionicon-var-egg; }
+.@{ionicons-prefix}eject:before { content: @ionicon-var-eject; }
+.@{ionicons-prefix}email:before { content: @ionicon-var-email; }
+.@{ionicons-prefix}email-unread:before { content: @ionicon-var-email-unread; }
+.@{ionicons-prefix}erlenmeyer-flask:before { content: @ionicon-var-erlenmeyer-flask; }
+.@{ionicons-prefix}erlenmeyer-flask-bubbles:before { content: @ionicon-var-erlenmeyer-flask-bubbles; }
+.@{ionicons-prefix}eye:before { content: @ionicon-var-eye; }
+.@{ionicons-prefix}eye-disabled:before { content: @ionicon-var-eye-disabled; }
+.@{ionicons-prefix}female:before { content: @ionicon-var-female; }
+.@{ionicons-prefix}filing:before { content: @ionicon-var-filing; }
+.@{ionicons-prefix}film-marker:before { content: @ionicon-var-film-marker; }
+.@{ionicons-prefix}fireball:before { content: @ionicon-var-fireball; }
+.@{ionicons-prefix}flag:before { content: @ionicon-var-flag; }
+.@{ionicons-prefix}flame:before { content: @ionicon-var-flame; }
+.@{ionicons-prefix}flash:before { content: @ionicon-var-flash; }
+.@{ionicons-prefix}flash-off:before { content: @ionicon-var-flash-off; }
+.@{ionicons-prefix}folder:before { content: @ionicon-var-folder; }
+.@{ionicons-prefix}fork:before { content: @ionicon-var-fork; }
+.@{ionicons-prefix}fork-repo:before { content: @ionicon-var-fork-repo; }
+.@{ionicons-prefix}forward:before { content: @ionicon-var-forward; }
+.@{ionicons-prefix}funnel:before { content: @ionicon-var-funnel; }
+.@{ionicons-prefix}gear-a:before { content: @ionicon-var-gear-a; }
+.@{ionicons-prefix}gear-b:before { content: @ionicon-var-gear-b; }
+.@{ionicons-prefix}grid:before { content: @ionicon-var-grid; }
+.@{ionicons-prefix}hammer:before { content: @ionicon-var-hammer; }
+.@{ionicons-prefix}happy:before { content: @ionicon-var-happy; }
+.@{ionicons-prefix}happy-outline:before { content: @ionicon-var-happy-outline; }
+.@{ionicons-prefix}headphone:before { content: @ionicon-var-headphone; }
+.@{ionicons-prefix}heart:before { content: @ionicon-var-heart; }
+.@{ionicons-prefix}heart-broken:before { content: @ionicon-var-heart-broken; }
+.@{ionicons-prefix}help:before { content: @ionicon-var-help; }
+.@{ionicons-prefix}help-buoy:before { content: @ionicon-var-help-buoy; }
+.@{ionicons-prefix}help-circled:before { content: @ionicon-var-help-circled; }
+.@{ionicons-prefix}home:before { content: @ionicon-var-home; }
+.@{ionicons-prefix}icecream:before { content: @ionicon-var-icecream; }
+.@{ionicons-prefix}image:before { content: @ionicon-var-image; }
+.@{ionicons-prefix}images:before { content: @ionicon-var-images; }
+.@{ionicons-prefix}information:before { content: @ionicon-var-information; }
+.@{ionicons-prefix}information-circled:before { content: @ionicon-var-information-circled; }
+.@{ionicons-prefix}ionic:before { content: @ionicon-var-ionic; }
+.@{ionicons-prefix}ios-alarm:before { content: @ionicon-var-ios-alarm; }
+.@{ionicons-prefix}ios-alarm-outline:before { content: @ionicon-var-ios-alarm-outline; }
+.@{ionicons-prefix}ios-albums:before { content: @ionicon-var-ios-albums; }
+.@{ionicons-prefix}ios-albums-outline:before { content: @ionicon-var-ios-albums-outline; }
+.@{ionicons-prefix}ios-americanfootball:before { content: @ionicon-var-ios-americanfootball; }
+.@{ionicons-prefix}ios-americanfootball-outline:before { content: @ionicon-var-ios-americanfootball-outline; }
+.@{ionicons-prefix}ios-analytics:before { content: @ionicon-var-ios-analytics; }
+.@{ionicons-prefix}ios-analytics-outline:before { content: @ionicon-var-ios-analytics-outline; }
+.@{ionicons-prefix}ios-arrow-back:before { content: @ionicon-var-ios-arrow-back; }
+.@{ionicons-prefix}ios-arrow-down:before { content: @ionicon-var-ios-arrow-down; }
+.@{ionicons-prefix}ios-arrow-forward:before { content: @ionicon-var-ios-arrow-forward; }
+.@{ionicons-prefix}ios-arrow-left:before { content: @ionicon-var-ios-arrow-left; }
+.@{ionicons-prefix}ios-arrow-right:before { content: @ionicon-var-ios-arrow-right; }
+.@{ionicons-prefix}ios-arrow-thin-down:before { content: @ionicon-var-ios-arrow-thin-down; }
+.@{ionicons-prefix}ios-arrow-thin-left:before { content: @ionicon-var-ios-arrow-thin-left; }
+.@{ionicons-prefix}ios-arrow-thin-right:before { content: @ionicon-var-ios-arrow-thin-right; }
+.@{ionicons-prefix}ios-arrow-thin-up:before { content: @ionicon-var-ios-arrow-thin-up; }
+.@{ionicons-prefix}ios-arrow-up:before { content: @ionicon-var-ios-arrow-up; }
+.@{ionicons-prefix}ios-at:before { content: @ionicon-var-ios-at; }
+.@{ionicons-prefix}ios-at-outline:before { content: @ionicon-var-ios-at-outline; }
+.@{ionicons-prefix}ios-barcode:before { content: @ionicon-var-ios-barcode; }
+.@{ionicons-prefix}ios-barcode-outline:before { content: @ionicon-var-ios-barcode-outline; }
+.@{ionicons-prefix}ios-baseball:before { content: @ionicon-var-ios-baseball; }
+.@{ionicons-prefix}ios-baseball-outline:before { content: @ionicon-var-ios-baseball-outline; }
+.@{ionicons-prefix}ios-basketball:before { content: @ionicon-var-ios-basketball; }
+.@{ionicons-prefix}ios-basketball-outline:before { content: @ionicon-var-ios-basketball-outline; }
+.@{ionicons-prefix}ios-bell:before { content: @ionicon-var-ios-bell; }
+.@{ionicons-prefix}ios-bell-outline:before { content: @ionicon-var-ios-bell-outline; }
+.@{ionicons-prefix}ios-body:before { content: @ionicon-var-ios-body; }
+.@{ionicons-prefix}ios-body-outline:before { content: @ionicon-var-ios-body-outline; }
+.@{ionicons-prefix}ios-bolt:before { content: @ionicon-var-ios-bolt; }
+.@{ionicons-prefix}ios-bolt-outline:before { content: @ionicon-var-ios-bolt-outline; }
+.@{ionicons-prefix}ios-book:before { content: @ionicon-var-ios-book; }
+.@{ionicons-prefix}ios-book-outline:before { content: @ionicon-var-ios-book-outline; }
+.@{ionicons-prefix}ios-bookmarks:before { content: @ionicon-var-ios-bookmarks; }
+.@{ionicons-prefix}ios-bookmarks-outline:before { content: @ionicon-var-ios-bookmarks-outline; }
+.@{ionicons-prefix}ios-box:before { content: @ionicon-var-ios-box; }
+.@{ionicons-prefix}ios-box-outline:before { content: @ionicon-var-ios-box-outline; }
+.@{ionicons-prefix}ios-briefcase:before { content: @ionicon-var-ios-briefcase; }
+.@{ionicons-prefix}ios-briefcase-outline:before { content: @ionicon-var-ios-briefcase-outline; }
+.@{ionicons-prefix}ios-browsers:before { content: @ionicon-var-ios-browsers; }
+.@{ionicons-prefix}ios-browsers-outline:before { content: @ionicon-var-ios-browsers-outline; }
+.@{ionicons-prefix}ios-calculator:before { content: @ionicon-var-ios-calculator; }
+.@{ionicons-prefix}ios-calculator-outline:before { content: @ionicon-var-ios-calculator-outline; }
+.@{ionicons-prefix}ios-calendar:before { content: @ionicon-var-ios-calendar; }
+.@{ionicons-prefix}ios-calendar-outline:before { content: @ionicon-var-ios-calendar-outline; }
+.@{ionicons-prefix}ios-camera:before { content: @ionicon-var-ios-camera; }
+.@{ionicons-prefix}ios-camera-outline:before { content: @ionicon-var-ios-camera-outline; }
+.@{ionicons-prefix}ios-cart:before { content: @ionicon-var-ios-cart; }
+.@{ionicons-prefix}ios-cart-outline:before { content: @ionicon-var-ios-cart-outline; }
+.@{ionicons-prefix}ios-chatboxes:before { content: @ionicon-var-ios-chatboxes; }
+.@{ionicons-prefix}ios-chatboxes-outline:before { content: @ionicon-var-ios-chatboxes-outline; }
+.@{ionicons-prefix}ios-chatbubble:before { content: @ionicon-var-ios-chatbubble; }
+.@{ionicons-prefix}ios-chatbubble-outline:before { content: @ionicon-var-ios-chatbubble-outline; }
+.@{ionicons-prefix}ios-checkmark:before { content: @ionicon-var-ios-checkmark; }
+.@{ionicons-prefix}ios-checkmark-empty:before { content: @ionicon-var-ios-checkmark-empty; }
+.@{ionicons-prefix}ios-checkmark-outline:before { content: @ionicon-var-ios-checkmark-outline; }
+.@{ionicons-prefix}ios-circle-filled:before { content: @ionicon-var-ios-circle-filled; }
+.@{ionicons-prefix}ios-circle-outline:before { content: @ionicon-var-ios-circle-outline; }
+.@{ionicons-prefix}ios-clock:before { content: @ionicon-var-ios-clock; }
+.@{ionicons-prefix}ios-clock-outline:before { content: @ionicon-var-ios-clock-outline; }
+.@{ionicons-prefix}ios-close:before { content: @ionicon-var-ios-close; }
+.@{ionicons-prefix}ios-close-empty:before { content: @ionicon-var-ios-close-empty; }
+.@{ionicons-prefix}ios-close-outline:before { content: @ionicon-var-ios-close-outline; }
+.@{ionicons-prefix}ios-cloud:before { content: @ionicon-var-ios-cloud; }
+.@{ionicons-prefix}ios-cloud-download:before { content: @ionicon-var-ios-cloud-download; }
+.@{ionicons-prefix}ios-cloud-download-outline:before { content: @ionicon-var-ios-cloud-download-outline; }
+.@{ionicons-prefix}ios-cloud-outline:before { content: @ionicon-var-ios-cloud-outline; }
+.@{ionicons-prefix}ios-cloud-upload:before { content: @ionicon-var-ios-cloud-upload; }
+.@{ionicons-prefix}ios-cloud-upload-outline:before { content: @ionicon-var-ios-cloud-upload-outline; }
+.@{ionicons-prefix}ios-cloudy:before { content: @ionicon-var-ios-cloudy; }
+.@{ionicons-prefix}ios-cloudy-night:before { content: @ionicon-var-ios-cloudy-night; }
+.@{ionicons-prefix}ios-cloudy-night-outline:before { content: @ionicon-var-ios-cloudy-night-outline; }
+.@{ionicons-prefix}ios-cloudy-outline:before { content: @ionicon-var-ios-cloudy-outline; }
+.@{ionicons-prefix}ios-cog:before { content: @ionicon-var-ios-cog; }
+.@{ionicons-prefix}ios-cog-outline:before { content: @ionicon-var-ios-cog-outline; }
+.@{ionicons-prefix}ios-color-filter:before { content: @ionicon-var-ios-color-filter; }
+.@{ionicons-prefix}ios-color-filter-outline:before { content: @ionicon-var-ios-color-filter-outline; }
+.@{ionicons-prefix}ios-color-wand:before { content: @ionicon-var-ios-color-wand; }
+.@{ionicons-prefix}ios-color-wand-outline:before { content: @ionicon-var-ios-color-wand-outline; }
+.@{ionicons-prefix}ios-compose:before { content: @ionicon-var-ios-compose; }
+.@{ionicons-prefix}ios-compose-outline:before { content: @ionicon-var-ios-compose-outline; }
+.@{ionicons-prefix}ios-contact:before { content: @ionicon-var-ios-contact; }
+.@{ionicons-prefix}ios-contact-outline:before { content: @ionicon-var-ios-contact-outline; }
+.@{ionicons-prefix}ios-copy:before { content: @ionicon-var-ios-copy; }
+.@{ionicons-prefix}ios-copy-outline:before { content: @ionicon-var-ios-copy-outline; }
+.@{ionicons-prefix}ios-crop:before { content: @ionicon-var-ios-crop; }
+.@{ionicons-prefix}ios-crop-strong:before { content: @ionicon-var-ios-crop-strong; }
+.@{ionicons-prefix}ios-download:before { content: @ionicon-var-ios-download; }
+.@{ionicons-prefix}ios-download-outline:before { content: @ionicon-var-ios-download-outline; }
+.@{ionicons-prefix}ios-drag:before { content: @ionicon-var-ios-drag; }
+.@{ionicons-prefix}ios-email:before { content: @ionicon-var-ios-email; }
+.@{ionicons-prefix}ios-email-outline:before { content: @ionicon-var-ios-email-outline; }
+.@{ionicons-prefix}ios-eye:before { content: @ionicon-var-ios-eye; }
+.@{ionicons-prefix}ios-eye-outline:before { content: @ionicon-var-ios-eye-outline; }
+.@{ionicons-prefix}ios-fastforward:before { content: @ionicon-var-ios-fastforward; }
+.@{ionicons-prefix}ios-fastforward-outline:before { content: @ionicon-var-ios-fastforward-outline; }
+.@{ionicons-prefix}ios-filing:before { content: @ionicon-var-ios-filing; }
+.@{ionicons-prefix}ios-filing-outline:before { content: @ionicon-var-ios-filing-outline; }
+.@{ionicons-prefix}ios-film:before { content: @ionicon-var-ios-film; }
+.@{ionicons-prefix}ios-film-outline:before { content: @ionicon-var-ios-film-outline; }
+.@{ionicons-prefix}ios-flag:before { content: @ionicon-var-ios-flag; }
+.@{ionicons-prefix}ios-flag-outline:before { content: @ionicon-var-ios-flag-outline; }
+.@{ionicons-prefix}ios-flame:before { content: @ionicon-var-ios-flame; }
+.@{ionicons-prefix}ios-flame-outline:before { content: @ionicon-var-ios-flame-outline; }
+.@{ionicons-prefix}ios-flask:before { content: @ionicon-var-ios-flask; }
+.@{ionicons-prefix}ios-flask-outline:before { content: @ionicon-var-ios-flask-outline; }
+.@{ionicons-prefix}ios-flower:before { content: @ionicon-var-ios-flower; }
+.@{ionicons-prefix}ios-flower-outline:before { content: @ionicon-var-ios-flower-outline; }
+.@{ionicons-prefix}ios-folder:before { content: @ionicon-var-ios-folder; }
+.@{ionicons-prefix}ios-folder-outline:before { content: @ionicon-var-ios-folder-outline; }
+.@{ionicons-prefix}ios-football:before { content: @ionicon-var-ios-football; }
+.@{ionicons-prefix}ios-football-outline:before { content: @ionicon-var-ios-football-outline; }
+.@{ionicons-prefix}ios-game-controller-a:before { content: @ionicon-var-ios-game-controller-a; }
+.@{ionicons-prefix}ios-game-controller-a-outline:before { content: @ionicon-var-ios-game-controller-a-outline; }
+.@{ionicons-prefix}ios-game-controller-b:before { content: @ionicon-var-ios-game-controller-b; }
+.@{ionicons-prefix}ios-game-controller-b-outline:before { content: @ionicon-var-ios-game-controller-b-outline; }
+.@{ionicons-prefix}ios-gear:before { content: @ionicon-var-ios-gear; }
+.@{ionicons-prefix}ios-gear-outline:before { content: @ionicon-var-ios-gear-outline; }
+.@{ionicons-prefix}ios-glasses:before { content: @ionicon-var-ios-glasses; }
+.@{ionicons-prefix}ios-glasses-outline:before { content: @ionicon-var-ios-glasses-outline; }
+.@{ionicons-prefix}ios-grid-view:before { content: @ionicon-var-ios-grid-view; }
+.@{ionicons-prefix}ios-grid-view-outline:before { content: @ionicon-var-ios-grid-view-outline; }
+.@{ionicons-prefix}ios-heart:before { content: @ionicon-var-ios-heart; }
+.@{ionicons-prefix}ios-heart-outline:before { content: @ionicon-var-ios-heart-outline; }
+.@{ionicons-prefix}ios-help:before { content: @ionicon-var-ios-help; }
+.@{ionicons-prefix}ios-help-empty:before { content: @ionicon-var-ios-help-empty; }
+.@{ionicons-prefix}ios-help-outline:before { content: @ionicon-var-ios-help-outline; }
+.@{ionicons-prefix}ios-home:before { content: @ionicon-var-ios-home; }
+.@{ionicons-prefix}ios-home-outline:before { content: @ionicon-var-ios-home-outline; }
+.@{ionicons-prefix}ios-infinite:before { content: @ionicon-var-ios-infinite; }
+.@{ionicons-prefix}ios-infinite-outline:before { content: @ionicon-var-ios-infinite-outline; }
+.@{ionicons-prefix}ios-information:before { content: @ionicon-var-ios-information; }
+.@{ionicons-prefix}ios-information-empty:before { content: @ionicon-var-ios-information-empty; }
+.@{ionicons-prefix}ios-information-outline:before { content: @ionicon-var-ios-information-outline; }
+.@{ionicons-prefix}ios-ionic-outline:before { content: @ionicon-var-ios-ionic-outline; }
+.@{ionicons-prefix}ios-keypad:before { content: @ionicon-var-ios-keypad; }
+.@{ionicons-prefix}ios-keypad-outline:before { content: @ionicon-var-ios-keypad-outline; }
+.@{ionicons-prefix}ios-lightbulb:before { content: @ionicon-var-ios-lightbulb; }
+.@{ionicons-prefix}ios-lightbulb-outline:before { content: @ionicon-var-ios-lightbulb-outline; }
+.@{ionicons-prefix}ios-list:before { content: @ionicon-var-ios-list; }
+.@{ionicons-prefix}ios-list-outline:before { content: @ionicon-var-ios-list-outline; }
+.@{ionicons-prefix}ios-location:before { content: @ionicon-var-ios-location; }
+.@{ionicons-prefix}ios-location-outline:before { content: @ionicon-var-ios-location-outline; }
+.@{ionicons-prefix}ios-locked:before { content: @ionicon-var-ios-locked; }
+.@{ionicons-prefix}ios-locked-outline:before { content: @ionicon-var-ios-locked-outline; }
+.@{ionicons-prefix}ios-loop:before { content: @ionicon-var-ios-loop; }
+.@{ionicons-prefix}ios-loop-strong:before { content: @ionicon-var-ios-loop-strong; }
+.@{ionicons-prefix}ios-medical:before { content: @ionicon-var-ios-medical; }
+.@{ionicons-prefix}ios-medical-outline:before { content: @ionicon-var-ios-medical-outline; }
+.@{ionicons-prefix}ios-medkit:before { content: @ionicon-var-ios-medkit; }
+.@{ionicons-prefix}ios-medkit-outline:before { content: @ionicon-var-ios-medkit-outline; }
+.@{ionicons-prefix}ios-mic:before { content: @ionicon-var-ios-mic; }
+.@{ionicons-prefix}ios-mic-off:before { content: @ionicon-var-ios-mic-off; }
+.@{ionicons-prefix}ios-mic-outline:before { content: @ionicon-var-ios-mic-outline; }
+.@{ionicons-prefix}ios-minus:before { content: @ionicon-var-ios-minus; }
+.@{ionicons-prefix}ios-minus-empty:before { content: @ionicon-var-ios-minus-empty; }
+.@{ionicons-prefix}ios-minus-outline:before { content: @ionicon-var-ios-minus-outline; }
+.@{ionicons-prefix}ios-monitor:before { content: @ionicon-var-ios-monitor; }
+.@{ionicons-prefix}ios-monitor-outline:before { content: @ionicon-var-ios-monitor-outline; }
+.@{ionicons-prefix}ios-moon:before { content: @ionicon-var-ios-moon; }
+.@{ionicons-prefix}ios-moon-outline:before { content: @ionicon-var-ios-moon-outline; }
+.@{ionicons-prefix}ios-more:before { content: @ionicon-var-ios-more; }
+.@{ionicons-prefix}ios-more-outline:before { content: @ionicon-var-ios-more-outline; }
+.@{ionicons-prefix}ios-musical-note:before { content: @ionicon-var-ios-musical-note; }
+.@{ionicons-prefix}ios-musical-notes:before { content: @ionicon-var-ios-musical-notes; }
+.@{ionicons-prefix}ios-navigate:before { content: @ionicon-var-ios-navigate; }
+.@{ionicons-prefix}ios-navigate-outline:before { content: @ionicon-var-ios-navigate-outline; }
+.@{ionicons-prefix}ios-nutrition:before { content: @ionicon-var-ios-nutrition; }
+.@{ionicons-prefix}ios-nutrition-outline:before { content: @ionicon-var-ios-nutrition-outline; }
+.@{ionicons-prefix}ios-paper:before { content: @ionicon-var-ios-paper; }
+.@{ionicons-prefix}ios-paper-outline:before { content: @ionicon-var-ios-paper-outline; }
+.@{ionicons-prefix}ios-paperplane:before { content: @ionicon-var-ios-paperplane; }
+.@{ionicons-prefix}ios-paperplane-outline:before { content: @ionicon-var-ios-paperplane-outline; }
+.@{ionicons-prefix}ios-partlysunny:before { content: @ionicon-var-ios-partlysunny; }
+.@{ionicons-prefix}ios-partlysunny-outline:before { content: @ionicon-var-ios-partlysunny-outline; }
+.@{ionicons-prefix}ios-pause:before { content: @ionicon-var-ios-pause; }
+.@{ionicons-prefix}ios-pause-outline:before { content: @ionicon-var-ios-pause-outline; }
+.@{ionicons-prefix}ios-paw:before { content: @ionicon-var-ios-paw; }
+.@{ionicons-prefix}ios-paw-outline:before { content: @ionicon-var-ios-paw-outline; }
+.@{ionicons-prefix}ios-people:before { content: @ionicon-var-ios-people; }
+.@{ionicons-prefix}ios-people-outline:before { content: @ionicon-var-ios-people-outline; }
+.@{ionicons-prefix}ios-person:before { content: @ionicon-var-ios-person; }
+.@{ionicons-prefix}ios-person-outline:before { content: @ionicon-var-ios-person-outline; }
+.@{ionicons-prefix}ios-personadd:before { content: @ionicon-var-ios-personadd; }
+.@{ionicons-prefix}ios-personadd-outline:before { content: @ionicon-var-ios-personadd-outline; }
+.@{ionicons-prefix}ios-photos:before { content: @ionicon-var-ios-photos; }
+.@{ionicons-prefix}ios-photos-outline:before { content: @ionicon-var-ios-photos-outline; }
+.@{ionicons-prefix}ios-pie:before { content: @ionicon-var-ios-pie; }
+.@{ionicons-prefix}ios-pie-outline:before { content: @ionicon-var-ios-pie-outline; }
+.@{ionicons-prefix}ios-pint:before { content: @ionicon-var-ios-pint; }
+.@{ionicons-prefix}ios-pint-outline:before { content: @ionicon-var-ios-pint-outline; }
+.@{ionicons-prefix}ios-play:before { content: @ionicon-var-ios-play; }
+.@{ionicons-prefix}ios-play-outline:before { content: @ionicon-var-ios-play-outline; }
+.@{ionicons-prefix}ios-plus:before { content: @ionicon-var-ios-plus; }
+.@{ionicons-prefix}ios-plus-empty:before { content: @ionicon-var-ios-plus-empty; }
+.@{ionicons-prefix}ios-plus-outline:before { content: @ionicon-var-ios-plus-outline; }
+.@{ionicons-prefix}ios-pricetag:before { content: @ionicon-var-ios-pricetag; }
+.@{ionicons-prefix}ios-pricetag-outline:before { content: @ionicon-var-ios-pricetag-outline; }
+.@{ionicons-prefix}ios-pricetags:before { content: @ionicon-var-ios-pricetags; }
+.@{ionicons-prefix}ios-pricetags-outline:before { content: @ionicon-var-ios-pricetags-outline; }
+.@{ionicons-prefix}ios-printer:before { content: @ionicon-var-ios-printer; }
+.@{ionicons-prefix}ios-printer-outline:before { content: @ionicon-var-ios-printer-outline; }
+.@{ionicons-prefix}ios-pulse:before { content: @ionicon-var-ios-pulse; }
+.@{ionicons-prefix}ios-pulse-strong:before { content: @ionicon-var-ios-pulse-strong; }
+.@{ionicons-prefix}ios-rainy:before { content: @ionicon-var-ios-rainy; }
+.@{ionicons-prefix}ios-rainy-outline:before { content: @ionicon-var-ios-rainy-outline; }
+.@{ionicons-prefix}ios-recording:before { content: @ionicon-var-ios-recording; }
+.@{ionicons-prefix}ios-recording-outline:before { content: @ionicon-var-ios-recording-outline; }
+.@{ionicons-prefix}ios-redo:before { content: @ionicon-var-ios-redo; }
+.@{ionicons-prefix}ios-redo-outline:before { content: @ionicon-var-ios-redo-outline; }
+.@{ionicons-prefix}ios-refresh:before { content: @ionicon-var-ios-refresh; }
+.@{ionicons-prefix}ios-refresh-empty:before { content: @ionicon-var-ios-refresh-empty; }
+.@{ionicons-prefix}ios-refresh-outline:before { content: @ionicon-var-ios-refresh-outline; }
+.@{ionicons-prefix}ios-reload:before { content: @ionicon-var-ios-reload; }
+.@{ionicons-prefix}ios-reverse-camera:before { content: @ionicon-var-ios-reverse-camera; }
+.@{ionicons-prefix}ios-reverse-camera-outline:before { content: @ionicon-var-ios-reverse-camera-outline; }
+.@{ionicons-prefix}ios-rewind:before { content: @ionicon-var-ios-rewind; }
+.@{ionicons-prefix}ios-rewind-outline:before { content: @ionicon-var-ios-rewind-outline; }
+.@{ionicons-prefix}ios-rose:before { content: @ionicon-var-ios-rose; }
+.@{ionicons-prefix}ios-rose-outline:before { content: @ionicon-var-ios-rose-outline; }
+.@{ionicons-prefix}ios-search:before { content: @ionicon-var-ios-search; }
+.@{ionicons-prefix}ios-search-strong:before { content: @ionicon-var-ios-search-strong; }
+.@{ionicons-prefix}ios-settings:before { content: @ionicon-var-ios-settings; }
+.@{ionicons-prefix}ios-settings-strong:before { content: @ionicon-var-ios-settings-strong; }
+.@{ionicons-prefix}ios-shuffle:before { content: @ionicon-var-ios-shuffle; }
+.@{ionicons-prefix}ios-shuffle-strong:before { content: @ionicon-var-ios-shuffle-strong; }
+.@{ionicons-prefix}ios-skipbackward:before { content: @ionicon-var-ios-skipbackward; }
+.@{ionicons-prefix}ios-skipbackward-outline:before { content: @ionicon-var-ios-skipbackward-outline; }
+.@{ionicons-prefix}ios-skipforward:before { content: @ionicon-var-ios-skipforward; }
+.@{ionicons-prefix}ios-skipforward-outline:before { content: @ionicon-var-ios-skipforward-outline; }
+.@{ionicons-prefix}ios-snowy:before { content: @ionicon-var-ios-snowy; }
+.@{ionicons-prefix}ios-speedometer:before { content: @ionicon-var-ios-speedometer; }
+.@{ionicons-prefix}ios-speedometer-outline:before { content: @ionicon-var-ios-speedometer-outline; }
+.@{ionicons-prefix}ios-star:before { content: @ionicon-var-ios-star; }
+.@{ionicons-prefix}ios-star-half:before { content: @ionicon-var-ios-star-half; }
+.@{ionicons-prefix}ios-star-outline:before { content: @ionicon-var-ios-star-outline; }
+.@{ionicons-prefix}ios-stopwatch:before { content: @ionicon-var-ios-stopwatch; }
+.@{ionicons-prefix}ios-stopwatch-outline:before { content: @ionicon-var-ios-stopwatch-outline; }
+.@{ionicons-prefix}ios-sunny:before { content: @ionicon-var-ios-sunny; }
+.@{ionicons-prefix}ios-sunny-outline:before { content: @ionicon-var-ios-sunny-outline; }
+.@{ionicons-prefix}ios-telephone:before { content: @ionicon-var-ios-telephone; }
+.@{ionicons-prefix}ios-telephone-outline:before { content: @ionicon-var-ios-telephone-outline; }
+.@{ionicons-prefix}ios-tennisball:before { content: @ionicon-var-ios-tennisball; }
+.@{ionicons-prefix}ios-tennisball-outline:before { content: @ionicon-var-ios-tennisball-outline; }
+.@{ionicons-prefix}ios-thunderstorm:before { content: @ionicon-var-ios-thunderstorm; }
+.@{ionicons-prefix}ios-thunderstorm-outline:before { content: @ionicon-var-ios-thunderstorm-outline; }
+.@{ionicons-prefix}ios-time:before { content: @ionicon-var-ios-time; }
+.@{ionicons-prefix}ios-time-outline:before { content: @ionicon-var-ios-time-outline; }
+.@{ionicons-prefix}ios-timer:before { content: @ionicon-var-ios-timer; }
+.@{ionicons-prefix}ios-timer-outline:before { content: @ionicon-var-ios-timer-outline; }
+.@{ionicons-prefix}ios-toggle:before { content: @ionicon-var-ios-toggle; }
+.@{ionicons-prefix}ios-toggle-outline:before { content: @ionicon-var-ios-toggle-outline; }
+.@{ionicons-prefix}ios-trash:before { content: @ionicon-var-ios-trash; }
+.@{ionicons-prefix}ios-trash-outline:before { content: @ionicon-var-ios-trash-outline; }
+.@{ionicons-prefix}ios-undo:before { content: @ionicon-var-ios-undo; }
+.@{ionicons-prefix}ios-undo-outline:before { content: @ionicon-var-ios-undo-outline; }
+.@{ionicons-prefix}ios-unlocked:before { content: @ionicon-var-ios-unlocked; }
+.@{ionicons-prefix}ios-unlocked-outline:before { content: @ionicon-var-ios-unlocked-outline; }
+.@{ionicons-prefix}ios-upload:before { content: @ionicon-var-ios-upload; }
+.@{ionicons-prefix}ios-upload-outline:before { content: @ionicon-var-ios-upload-outline; }
+.@{ionicons-prefix}ios-videocam:before { content: @ionicon-var-ios-videocam; }
+.@{ionicons-prefix}ios-videocam-outline:before { content: @ionicon-var-ios-videocam-outline; }
+.@{ionicons-prefix}ios-volume-high:before { content: @ionicon-var-ios-volume-high; }
+.@{ionicons-prefix}ios-volume-low:before { content: @ionicon-var-ios-volume-low; }
+.@{ionicons-prefix}ios-wineglass:before { content: @ionicon-var-ios-wineglass; }
+.@{ionicons-prefix}ios-wineglass-outline:before { content: @ionicon-var-ios-wineglass-outline; }
+.@{ionicons-prefix}ios-world:before { content: @ionicon-var-ios-world; }
+.@{ionicons-prefix}ios-world-outline:before { content: @ionicon-var-ios-world-outline; }
+.@{ionicons-prefix}ipad:before { content: @ionicon-var-ipad; }
+.@{ionicons-prefix}iphone:before { content: @ionicon-var-iphone; }
+.@{ionicons-prefix}ipod:before { content: @ionicon-var-ipod; }
+.@{ionicons-prefix}jet:before { content: @ionicon-var-jet; }
+.@{ionicons-prefix}key:before { content: @ionicon-var-key; }
+.@{ionicons-prefix}knife:before { content: @ionicon-var-knife; }
+.@{ionicons-prefix}laptop:before { content: @ionicon-var-laptop; }
+.@{ionicons-prefix}leaf:before { content: @ionicon-var-leaf; }
+.@{ionicons-prefix}levels:before { content: @ionicon-var-levels; }
+.@{ionicons-prefix}lightbulb:before { content: @ionicon-var-lightbulb; }
+.@{ionicons-prefix}link:before { content: @ionicon-var-link; }
+.@{ionicons-prefix}load-a:before { content: @ionicon-var-load-a; }
+.@{ionicons-prefix}load-b:before { content: @ionicon-var-load-b; }
+.@{ionicons-prefix}load-c:before { content: @ionicon-var-load-c; }
+.@{ionicons-prefix}load-d:before { content: @ionicon-var-load-d; }
+.@{ionicons-prefix}location:before { content: @ionicon-var-location; }
+.@{ionicons-prefix}lock-combination:before { content: @ionicon-var-lock-combination; }
+.@{ionicons-prefix}locked:before { content: @ionicon-var-locked; }
+.@{ionicons-prefix}log-in:before { content: @ionicon-var-log-in; }
+.@{ionicons-prefix}log-out:before { content: @ionicon-var-log-out; }
+.@{ionicons-prefix}loop:before { content: @ionicon-var-loop; }
+.@{ionicons-prefix}magnet:before { content: @ionicon-var-magnet; }
+.@{ionicons-prefix}male:before { content: @ionicon-var-male; }
+.@{ionicons-prefix}man:before { content: @ionicon-var-man; }
+.@{ionicons-prefix}map:before { content: @ionicon-var-map; }
+.@{ionicons-prefix}medkit:before { content: @ionicon-var-medkit; }
+.@{ionicons-prefix}merge:before { content: @ionicon-var-merge; }
+.@{ionicons-prefix}mic-a:before { content: @ionicon-var-mic-a; }
+.@{ionicons-prefix}mic-b:before { content: @ionicon-var-mic-b; }
+.@{ionicons-prefix}mic-c:before { content: @ionicon-var-mic-c; }
+.@{ionicons-prefix}minus:before { content: @ionicon-var-minus; }
+.@{ionicons-prefix}minus-circled:before { content: @ionicon-var-minus-circled; }
+.@{ionicons-prefix}minus-round:before { content: @ionicon-var-minus-round; }
+.@{ionicons-prefix}model-s:before { content: @ionicon-var-model-s; }
+.@{ionicons-prefix}monitor:before { content: @ionicon-var-monitor; }
+.@{ionicons-prefix}more:before { content: @ionicon-var-more; }
+.@{ionicons-prefix}mouse:before { content: @ionicon-var-mouse; }
+.@{ionicons-prefix}music-note:before { content: @ionicon-var-music-note; }
+.@{ionicons-prefix}navicon:before { content: @ionicon-var-navicon; }
+.@{ionicons-prefix}navicon-round:before { content: @ionicon-var-navicon-round; }
+.@{ionicons-prefix}navigate:before { content: @ionicon-var-navigate; }
+.@{ionicons-prefix}network:before { content: @ionicon-var-network; }
+.@{ionicons-prefix}no-smoking:before { content: @ionicon-var-no-smoking; }
+.@{ionicons-prefix}nuclear:before { content: @ionicon-var-nuclear; }
+.@{ionicons-prefix}outlet:before { content: @ionicon-var-outlet; }
+.@{ionicons-prefix}paintbrush:before { content: @ionicon-var-paintbrush; }
+.@{ionicons-prefix}paintbucket:before { content: @ionicon-var-paintbucket; }
+.@{ionicons-prefix}paper-airplane:before { content: @ionicon-var-paper-airplane; }
+.@{ionicons-prefix}paperclip:before { content: @ionicon-var-paperclip; }
+.@{ionicons-prefix}pause:before { content: @ionicon-var-pause; }
+.@{ionicons-prefix}person:before { content: @ionicon-var-person; }
+.@{ionicons-prefix}person-add:before { content: @ionicon-var-person-add; }
+.@{ionicons-prefix}person-stalker:before { content: @ionicon-var-person-stalker; }
+.@{ionicons-prefix}pie-graph:before { content: @ionicon-var-pie-graph; }
+.@{ionicons-prefix}pin:before { content: @ionicon-var-pin; }
+.@{ionicons-prefix}pinpoint:before { content: @ionicon-var-pinpoint; }
+.@{ionicons-prefix}pizza:before { content: @ionicon-var-pizza; }
+.@{ionicons-prefix}plane:before { content: @ionicon-var-plane; }
+.@{ionicons-prefix}planet:before { content: @ionicon-var-planet; }
+.@{ionicons-prefix}play:before { content: @ionicon-var-play; }
+.@{ionicons-prefix}playstation:before { content: @ionicon-var-playstation; }
+.@{ionicons-prefix}plus:before { content: @ionicon-var-plus; }
+.@{ionicons-prefix}plus-circled:before { content: @ionicon-var-plus-circled; }
+.@{ionicons-prefix}plus-round:before { content: @ionicon-var-plus-round; }
+.@{ionicons-prefix}podium:before { content: @ionicon-var-podium; }
+.@{ionicons-prefix}pound:before { content: @ionicon-var-pound; }
+.@{ionicons-prefix}power:before { content: @ionicon-var-power; }
+.@{ionicons-prefix}pricetag:before { content: @ionicon-var-pricetag; }
+.@{ionicons-prefix}pricetags:before { content: @ionicon-var-pricetags; }
+.@{ionicons-prefix}printer:before { content: @ionicon-var-printer; }
+.@{ionicons-prefix}pull-request:before { content: @ionicon-var-pull-request; }
+.@{ionicons-prefix}qr-scanner:before { content: @ionicon-var-qr-scanner; }
+.@{ionicons-prefix}quote:before { content: @ionicon-var-quote; }
+.@{ionicons-prefix}radio-waves:before { content: @ionicon-var-radio-waves; }
+.@{ionicons-prefix}record:before { content: @ionicon-var-record; }
+.@{ionicons-prefix}refresh:before { content: @ionicon-var-refresh; }
+.@{ionicons-prefix}reply:before { content: @ionicon-var-reply; }
+.@{ionicons-prefix}reply-all:before { content: @ionicon-var-reply-all; }
+.@{ionicons-prefix}ribbon-a:before { content: @ionicon-var-ribbon-a; }
+.@{ionicons-prefix}ribbon-b:before { content: @ionicon-var-ribbon-b; }
+.@{ionicons-prefix}sad:before { content: @ionicon-var-sad; }
+.@{ionicons-prefix}sad-outline:before { content: @ionicon-var-sad-outline; }
+.@{ionicons-prefix}scissors:before { content: @ionicon-var-scissors; }
+.@{ionicons-prefix}search:before { content: @ionicon-var-search; }
+.@{ionicons-prefix}settings:before { content: @ionicon-var-settings; }
+.@{ionicons-prefix}share:before { content: @ionicon-var-share; }
+.@{ionicons-prefix}shuffle:before { content: @ionicon-var-shuffle; }
+.@{ionicons-prefix}skip-backward:before { content: @ionicon-var-skip-backward; }
+.@{ionicons-prefix}skip-forward:before { content: @ionicon-var-skip-forward; }
+.@{ionicons-prefix}social-android:before { content: @ionicon-var-social-android; }
+.@{ionicons-prefix}social-android-outline:before { content: @ionicon-var-social-android-outline; }
+.@{ionicons-prefix}social-angular:before { content: @ionicon-var-social-angular; }
+.@{ionicons-prefix}social-angular-outline:before { content: @ionicon-var-social-angular-outline; }
+.@{ionicons-prefix}social-apple:before { content: @ionicon-var-social-apple; }
+.@{ionicons-prefix}social-apple-outline:before { content: @ionicon-var-social-apple-outline; }
+.@{ionicons-prefix}social-bitcoin:before { content: @ionicon-var-social-bitcoin; }
+.@{ionicons-prefix}social-bitcoin-outline:before { content: @ionicon-var-social-bitcoin-outline; }
+.@{ionicons-prefix}social-buffer:before { content: @ionicon-var-social-buffer; }
+.@{ionicons-prefix}social-buffer-outline:before { content: @ionicon-var-social-buffer-outline; }
+.@{ionicons-prefix}social-chrome:before { content: @ionicon-var-social-chrome; }
+.@{ionicons-prefix}social-chrome-outline:before { content: @ionicon-var-social-chrome-outline; }
+.@{ionicons-prefix}social-codepen:before { content: @ionicon-var-social-codepen; }
+.@{ionicons-prefix}social-codepen-outline:before { content: @ionicon-var-social-codepen-outline; }
+.@{ionicons-prefix}social-css3:before { content: @ionicon-var-social-css3; }
+.@{ionicons-prefix}social-css3-outline:before { content: @ionicon-var-social-css3-outline; }
+.@{ionicons-prefix}social-designernews:before { content: @ionicon-var-social-designernews; }
+.@{ionicons-prefix}social-designernews-outline:before { content: @ionicon-var-social-designernews-outline; }
+.@{ionicons-prefix}social-dribbble:before { content: @ionicon-var-social-dribbble; }
+.@{ionicons-prefix}social-dribbble-outline:before { content: @ionicon-var-social-dribbble-outline; }
+.@{ionicons-prefix}social-dropbox:before { content: @ionicon-var-social-dropbox; }
+.@{ionicons-prefix}social-dropbox-outline:before { content: @ionicon-var-social-dropbox-outline; }
+.@{ionicons-prefix}social-euro:before { content: @ionicon-var-social-euro; }
+.@{ionicons-prefix}social-euro-outline:before { content: @ionicon-var-social-euro-outline; }
+.@{ionicons-prefix}social-facebook:before { content: @ionicon-var-social-facebook; }
+.@{ionicons-prefix}social-facebook-outline:before { content: @ionicon-var-social-facebook-outline; }
+.@{ionicons-prefix}social-foursquare:before { content: @ionicon-var-social-foursquare; }
+.@{ionicons-prefix}social-foursquare-outline:before { content: @ionicon-var-social-foursquare-outline; }
+.@{ionicons-prefix}social-freebsd-devil:before { content: @ionicon-var-social-freebsd-devil; }
+.@{ionicons-prefix}social-github:before { content: @ionicon-var-social-github; }
+.@{ionicons-prefix}social-github-outline:before { content: @ionicon-var-social-github-outline; }
+.@{ionicons-prefix}social-google:before { content: @ionicon-var-social-google; }
+.@{ionicons-prefix}social-google-outline:before { content: @ionicon-var-social-google-outline; }
+.@{ionicons-prefix}social-googleplus:before { content: @ionicon-var-social-googleplus; }
+.@{ionicons-prefix}social-googleplus-outline:before { content: @ionicon-var-social-googleplus-outline; }
+.@{ionicons-prefix}social-hackernews:before { content: @ionicon-var-social-hackernews; }
+.@{ionicons-prefix}social-hackernews-outline:before { content: @ionicon-var-social-hackernews-outline; }
+.@{ionicons-prefix}social-html5:before { content: @ionicon-var-social-html5; }
+.@{ionicons-prefix}social-html5-outline:before { content: @ionicon-var-social-html5-outline; }
+.@{ionicons-prefix}social-instagram:before { content: @ionicon-var-social-instagram; }
+.@{ionicons-prefix}social-instagram-outline:before { content: @ionicon-var-social-instagram-outline; }
+.@{ionicons-prefix}social-javascript:before { content: @ionicon-var-social-javascript; }
+.@{ionicons-prefix}social-javascript-outline:before { content: @ionicon-var-social-javascript-outline; }
+.@{ionicons-prefix}social-linkedin:before { content: @ionicon-var-social-linkedin; }
+.@{ionicons-prefix}social-linkedin-outline:before { content: @ionicon-var-social-linkedin-outline; }
+.@{ionicons-prefix}social-markdown:before { content: @ionicon-var-social-markdown; }
+.@{ionicons-prefix}social-nodejs:before { content: @ionicon-var-social-nodejs; }
+.@{ionicons-prefix}social-octocat:before { content: @ionicon-var-social-octocat; }
+.@{ionicons-prefix}social-pinterest:before { content: @ionicon-var-social-pinterest; }
+.@{ionicons-prefix}social-pinterest-outline:before { content: @ionicon-var-social-pinterest-outline; }
+.@{ionicons-prefix}social-python:before { content: @ionicon-var-social-python; }
+.@{ionicons-prefix}social-reddit:before { content: @ionicon-var-social-reddit; }
+.@{ionicons-prefix}social-reddit-outline:before { content: @ionicon-var-social-reddit-outline; }
+.@{ionicons-prefix}social-rss:before { content: @ionicon-var-social-rss; }
+.@{ionicons-prefix}social-rss-outline:before { content: @ionicon-var-social-rss-outline; }
+.@{ionicons-prefix}social-sass:before { content: @ionicon-var-social-sass; }
+.@{ionicons-prefix}social-skype:before { content: @ionicon-var-social-skype; }
+.@{ionicons-prefix}social-skype-outline:before { content: @ionicon-var-social-skype-outline; }
+.@{ionicons-prefix}social-snapchat:before { content: @ionicon-var-social-snapchat; }
+.@{ionicons-prefix}social-snapchat-outline:before { content: @ionicon-var-social-snapchat-outline; }
+.@{ionicons-prefix}social-tumblr:before { content: @ionicon-var-social-tumblr; }
+.@{ionicons-prefix}social-tumblr-outline:before { content: @ionicon-var-social-tumblr-outline; }
+.@{ionicons-prefix}social-tux:before { content: @ionicon-var-social-tux; }
+.@{ionicons-prefix}social-twitch:before { content: @ionicon-var-social-twitch; }
+.@{ionicons-prefix}social-twitch-outline:before { content: @ionicon-var-social-twitch-outline; }
+.@{ionicons-prefix}social-twitter:before { content: @ionicon-var-social-twitter; }
+.@{ionicons-prefix}social-twitter-outline:before { content: @ionicon-var-social-twitter-outline; }
+.@{ionicons-prefix}social-usd:before { content: @ionicon-var-social-usd; }
+.@{ionicons-prefix}social-usd-outline:before { content: @ionicon-var-social-usd-outline; }
+.@{ionicons-prefix}social-vimeo:before { content: @ionicon-var-social-vimeo; }
+.@{ionicons-prefix}social-vimeo-outline:before { content: @ionicon-var-social-vimeo-outline; }
+.@{ionicons-prefix}social-whatsapp:before { content: @ionicon-var-social-whatsapp; }
+.@{ionicons-prefix}social-whatsapp-outline:before { content: @ionicon-var-social-whatsapp-outline; }
+.@{ionicons-prefix}social-windows:before { content: @ionicon-var-social-windows; }
+.@{ionicons-prefix}social-windows-outline:before { content: @ionicon-var-social-windows-outline; }
+.@{ionicons-prefix}social-wordpress:before { content: @ionicon-var-social-wordpress; }
+.@{ionicons-prefix}social-wordpress-outline:before { content: @ionicon-var-social-wordpress-outline; }
+.@{ionicons-prefix}social-yahoo:before { content: @ionicon-var-social-yahoo; }
+.@{ionicons-prefix}social-yahoo-outline:before { content: @ionicon-var-social-yahoo-outline; }
+.@{ionicons-prefix}social-yen:before { content: @ionicon-var-social-yen; }
+.@{ionicons-prefix}social-yen-outline:before { content: @ionicon-var-social-yen-outline; }
+.@{ionicons-prefix}social-youtube:before { content: @ionicon-var-social-youtube; }
+.@{ionicons-prefix}social-youtube-outline:before { content: @ionicon-var-social-youtube-outline; }
+.@{ionicons-prefix}soup-can:before { content: @ionicon-var-soup-can; }
+.@{ionicons-prefix}soup-can-outline:before { content: @ionicon-var-soup-can-outline; }
+.@{ionicons-prefix}speakerphone:before { content: @ionicon-var-speakerphone; }
+.@{ionicons-prefix}speedometer:before { content: @ionicon-var-speedometer; }
+.@{ionicons-prefix}spoon:before { content: @ionicon-var-spoon; }
+.@{ionicons-prefix}star:before { content: @ionicon-var-star; }
+.@{ionicons-prefix}stats-bars:before { content: @ionicon-var-stats-bars; }
+.@{ionicons-prefix}steam:before { content: @ionicon-var-steam; }
+.@{ionicons-prefix}stop:before { content: @ionicon-var-stop; }
+.@{ionicons-prefix}thermometer:before { content: @ionicon-var-thermometer; }
+.@{ionicons-prefix}thumbsdown:before { content: @ionicon-var-thumbsdown; }
+.@{ionicons-prefix}thumbsup:before { content: @ionicon-var-thumbsup; }
+.@{ionicons-prefix}toggle:before { content: @ionicon-var-toggle; }
+.@{ionicons-prefix}toggle-filled:before { content: @ionicon-var-toggle-filled; }
+.@{ionicons-prefix}transgender:before { content: @ionicon-var-transgender; }
+.@{ionicons-prefix}trash-a:before { content: @ionicon-var-trash-a; }
+.@{ionicons-prefix}trash-b:before { content: @ionicon-var-trash-b; }
+.@{ionicons-prefix}trophy:before { content: @ionicon-var-trophy; }
+.@{ionicons-prefix}tshirt:before { content: @ionicon-var-tshirt; }
+.@{ionicons-prefix}tshirt-outline:before { content: @ionicon-var-tshirt-outline; }
+.@{ionicons-prefix}umbrella:before { content: @ionicon-var-umbrella; }
+.@{ionicons-prefix}university:before { content: @ionicon-var-university; }
+.@{ionicons-prefix}unlocked:before { content: @ionicon-var-unlocked; }
+.@{ionicons-prefix}upload:before { content: @ionicon-var-upload; }
+.@{ionicons-prefix}usb:before { content: @ionicon-var-usb; }
+.@{ionicons-prefix}videocamera:before { content: @ionicon-var-videocamera; }
+.@{ionicons-prefix}volume-high:before { content: @ionicon-var-volume-high; }
+.@{ionicons-prefix}volume-low:before { content: @ionicon-var-volume-low; }
+.@{ionicons-prefix}volume-medium:before { content: @ionicon-var-volume-medium; }
+.@{ionicons-prefix}volume-mute:before { content: @ionicon-var-volume-mute; }
+.@{ionicons-prefix}wand:before { content: @ionicon-var-wand; }
+.@{ionicons-prefix}waterdrop:before { content: @ionicon-var-waterdrop; }
+.@{ionicons-prefix}wifi:before { content: @ionicon-var-wifi; }
+.@{ionicons-prefix}wineglass:before { content: @ionicon-var-wineglass; }
+.@{ionicons-prefix}woman:before { content: @ionicon-var-woman; }
+.@{ionicons-prefix}wrench:before { content: @ionicon-var-wrench; }
+.@{ionicons-prefix}xbox:before { content: @ionicon-var-xbox; } \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-variables.less b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-variables.less
new file mode 100644
index 00000000..91195271
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-variables.less
@@ -0,0 +1,747 @@
+/*!
+Ionicons, v2.0.0
+Created by Ben Sperry for the Ionic Framework, http://ionicons.com/
+https://twitter.com/benjsperry https://twitter.com/ionicframework
+MIT License: https://github.com/driftyco/ionicons
+*/
+// Ionicons Variables
+// --------------------------
+
+@ionicons-font-path: "../fonts";
+@ionicons-font-family: "Ionicons";
+@ionicons-version: "2.0.0";
+@ionicons-prefix: ion-;
+
+@ionicon-var-alert: "\f101";
+@ionicon-var-alert-circled: "\f100";
+@ionicon-var-android-add: "\f2c7";
+@ionicon-var-android-add-circle: "\f359";
+@ionicon-var-android-alarm-clock: "\f35a";
+@ionicon-var-android-alert: "\f35b";
+@ionicon-var-android-apps: "\f35c";
+@ionicon-var-android-archive: "\f2c9";
+@ionicon-var-android-arrow-back: "\f2ca";
+@ionicon-var-android-arrow-down: "\f35d";
+@ionicon-var-android-arrow-dropdown: "\f35f";
+@ionicon-var-android-arrow-dropdown-circle: "\f35e";
+@ionicon-var-android-arrow-dropleft: "\f361";
+@ionicon-var-android-arrow-dropleft-circle: "\f360";
+@ionicon-var-android-arrow-dropright: "\f363";
+@ionicon-var-android-arrow-dropright-circle: "\f362";
+@ionicon-var-android-arrow-dropup: "\f365";
+@ionicon-var-android-arrow-dropup-circle: "\f364";
+@ionicon-var-android-arrow-forward: "\f30f";
+@ionicon-var-android-arrow-up: "\f366";
+@ionicon-var-android-attach: "\f367";
+@ionicon-var-android-bar: "\f368";
+@ionicon-var-android-bicycle: "\f369";
+@ionicon-var-android-boat: "\f36a";
+@ionicon-var-android-bookmark: "\f36b";
+@ionicon-var-android-bulb: "\f36c";
+@ionicon-var-android-bus: "\f36d";
+@ionicon-var-android-calendar: "\f2d1";
+@ionicon-var-android-call: "\f2d2";
+@ionicon-var-android-camera: "\f2d3";
+@ionicon-var-android-cancel: "\f36e";
+@ionicon-var-android-car: "\f36f";
+@ionicon-var-android-cart: "\f370";
+@ionicon-var-android-chat: "\f2d4";
+@ionicon-var-android-checkbox: "\f374";
+@ionicon-var-android-checkbox-blank: "\f371";
+@ionicon-var-android-checkbox-outline: "\f373";
+@ionicon-var-android-checkbox-outline-blank: "\f372";
+@ionicon-var-android-checkmark-circle: "\f375";
+@ionicon-var-android-clipboard: "\f376";
+@ionicon-var-android-close: "\f2d7";
+@ionicon-var-android-cloud: "\f37a";
+@ionicon-var-android-cloud-circle: "\f377";
+@ionicon-var-android-cloud-done: "\f378";
+@ionicon-var-android-cloud-outline: "\f379";
+@ionicon-var-android-color-palette: "\f37b";
+@ionicon-var-android-compass: "\f37c";
+@ionicon-var-android-contact: "\f2d8";
+@ionicon-var-android-contacts: "\f2d9";
+@ionicon-var-android-contract: "\f37d";
+@ionicon-var-android-create: "\f37e";
+@ionicon-var-android-delete: "\f37f";
+@ionicon-var-android-desktop: "\f380";
+@ionicon-var-android-document: "\f381";
+@ionicon-var-android-done: "\f383";
+@ionicon-var-android-done-all: "\f382";
+@ionicon-var-android-download: "\f2dd";
+@ionicon-var-android-drafts: "\f384";
+@ionicon-var-android-exit: "\f385";
+@ionicon-var-android-expand: "\f386";
+@ionicon-var-android-favorite: "\f388";
+@ionicon-var-android-favorite-outline: "\f387";
+@ionicon-var-android-film: "\f389";
+@ionicon-var-android-folder: "\f2e0";
+@ionicon-var-android-folder-open: "\f38a";
+@ionicon-var-android-funnel: "\f38b";
+@ionicon-var-android-globe: "\f38c";
+@ionicon-var-android-hand: "\f2e3";
+@ionicon-var-android-hangout: "\f38d";
+@ionicon-var-android-happy: "\f38e";
+@ionicon-var-android-home: "\f38f";
+@ionicon-var-android-image: "\f2e4";
+@ionicon-var-android-laptop: "\f390";
+@ionicon-var-android-list: "\f391";
+@ionicon-var-android-locate: "\f2e9";
+@ionicon-var-android-lock: "\f392";
+@ionicon-var-android-mail: "\f2eb";
+@ionicon-var-android-map: "\f393";
+@ionicon-var-android-menu: "\f394";
+@ionicon-var-android-microphone: "\f2ec";
+@ionicon-var-android-microphone-off: "\f395";
+@ionicon-var-android-more-horizontal: "\f396";
+@ionicon-var-android-more-vertical: "\f397";
+@ionicon-var-android-navigate: "\f398";
+@ionicon-var-android-notifications: "\f39b";
+@ionicon-var-android-notifications-none: "\f399";
+@ionicon-var-android-notifications-off: "\f39a";
+@ionicon-var-android-open: "\f39c";
+@ionicon-var-android-options: "\f39d";
+@ionicon-var-android-people: "\f39e";
+@ionicon-var-android-person: "\f3a0";
+@ionicon-var-android-person-add: "\f39f";
+@ionicon-var-android-phone-landscape: "\f3a1";
+@ionicon-var-android-phone-portrait: "\f3a2";
+@ionicon-var-android-pin: "\f3a3";
+@ionicon-var-android-plane: "\f3a4";
+@ionicon-var-android-playstore: "\f2f0";
+@ionicon-var-android-print: "\f3a5";
+@ionicon-var-android-radio-button-off: "\f3a6";
+@ionicon-var-android-radio-button-on: "\f3a7";
+@ionicon-var-android-refresh: "\f3a8";
+@ionicon-var-android-remove: "\f2f4";
+@ionicon-var-android-remove-circle: "\f3a9";
+@ionicon-var-android-restaurant: "\f3aa";
+@ionicon-var-android-sad: "\f3ab";
+@ionicon-var-android-search: "\f2f5";
+@ionicon-var-android-send: "\f2f6";
+@ionicon-var-android-settings: "\f2f7";
+@ionicon-var-android-share: "\f2f8";
+@ionicon-var-android-share-alt: "\f3ac";
+@ionicon-var-android-star: "\f2fc";
+@ionicon-var-android-star-half: "\f3ad";
+@ionicon-var-android-star-outline: "\f3ae";
+@ionicon-var-android-stopwatch: "\f2fd";
+@ionicon-var-android-subway: "\f3af";
+@ionicon-var-android-sunny: "\f3b0";
+@ionicon-var-android-sync: "\f3b1";
+@ionicon-var-android-textsms: "\f3b2";
+@ionicon-var-android-time: "\f3b3";
+@ionicon-var-android-train: "\f3b4";
+@ionicon-var-android-unlock: "\f3b5";
+@ionicon-var-android-upload: "\f3b6";
+@ionicon-var-android-volume-down: "\f3b7";
+@ionicon-var-android-volume-mute: "\f3b8";
+@ionicon-var-android-volume-off: "\f3b9";
+@ionicon-var-android-volume-up: "\f3ba";
+@ionicon-var-android-walk: "\f3bb";
+@ionicon-var-android-warning: "\f3bc";
+@ionicon-var-android-watch: "\f3bd";
+@ionicon-var-android-wifi: "\f305";
+@ionicon-var-aperture: "\f313";
+@ionicon-var-archive: "\f102";
+@ionicon-var-arrow-down-a: "\f103";
+@ionicon-var-arrow-down-b: "\f104";
+@ionicon-var-arrow-down-c: "\f105";
+@ionicon-var-arrow-expand: "\f25e";
+@ionicon-var-arrow-graph-down-left: "\f25f";
+@ionicon-var-arrow-graph-down-right: "\f260";
+@ionicon-var-arrow-graph-up-left: "\f261";
+@ionicon-var-arrow-graph-up-right: "\f262";
+@ionicon-var-arrow-left-a: "\f106";
+@ionicon-var-arrow-left-b: "\f107";
+@ionicon-var-arrow-left-c: "\f108";
+@ionicon-var-arrow-move: "\f263";
+@ionicon-var-arrow-resize: "\f264";
+@ionicon-var-arrow-return-left: "\f265";
+@ionicon-var-arrow-return-right: "\f266";
+@ionicon-var-arrow-right-a: "\f109";
+@ionicon-var-arrow-right-b: "\f10a";
+@ionicon-var-arrow-right-c: "\f10b";
+@ionicon-var-arrow-shrink: "\f267";
+@ionicon-var-arrow-swap: "\f268";
+@ionicon-var-arrow-up-a: "\f10c";
+@ionicon-var-arrow-up-b: "\f10d";
+@ionicon-var-arrow-up-c: "\f10e";
+@ionicon-var-asterisk: "\f314";
+@ionicon-var-at: "\f10f";
+@ionicon-var-backspace: "\f3bf";
+@ionicon-var-backspace-outline: "\f3be";
+@ionicon-var-bag: "\f110";
+@ionicon-var-battery-charging: "\f111";
+@ionicon-var-battery-empty: "\f112";
+@ionicon-var-battery-full: "\f113";
+@ionicon-var-battery-half: "\f114";
+@ionicon-var-battery-low: "\f115";
+@ionicon-var-beaker: "\f269";
+@ionicon-var-beer: "\f26a";
+@ionicon-var-bluetooth: "\f116";
+@ionicon-var-bonfire: "\f315";
+@ionicon-var-bookmark: "\f26b";
+@ionicon-var-bowtie: "\f3c0";
+@ionicon-var-briefcase: "\f26c";
+@ionicon-var-bug: "\f2be";
+@ionicon-var-calculator: "\f26d";
+@ionicon-var-calendar: "\f117";
+@ionicon-var-camera: "\f118";
+@ionicon-var-card: "\f119";
+@ionicon-var-cash: "\f316";
+@ionicon-var-chatbox: "\f11b";
+@ionicon-var-chatbox-working: "\f11a";
+@ionicon-var-chatboxes: "\f11c";
+@ionicon-var-chatbubble: "\f11e";
+@ionicon-var-chatbubble-working: "\f11d";
+@ionicon-var-chatbubbles: "\f11f";
+@ionicon-var-checkmark: "\f122";
+@ionicon-var-checkmark-circled: "\f120";
+@ionicon-var-checkmark-round: "\f121";
+@ionicon-var-chevron-down: "\f123";
+@ionicon-var-chevron-left: "\f124";
+@ionicon-var-chevron-right: "\f125";
+@ionicon-var-chevron-up: "\f126";
+@ionicon-var-clipboard: "\f127";
+@ionicon-var-clock: "\f26e";
+@ionicon-var-close: "\f12a";
+@ionicon-var-close-circled: "\f128";
+@ionicon-var-close-round: "\f129";
+@ionicon-var-closed-captioning: "\f317";
+@ionicon-var-cloud: "\f12b";
+@ionicon-var-code: "\f271";
+@ionicon-var-code-download: "\f26f";
+@ionicon-var-code-working: "\f270";
+@ionicon-var-coffee: "\f272";
+@ionicon-var-compass: "\f273";
+@ionicon-var-compose: "\f12c";
+@ionicon-var-connection-bars: "\f274";
+@ionicon-var-contrast: "\f275";
+@ionicon-var-crop: "\f3c1";
+@ionicon-var-cube: "\f318";
+@ionicon-var-disc: "\f12d";
+@ionicon-var-document: "\f12f";
+@ionicon-var-document-text: "\f12e";
+@ionicon-var-drag: "\f130";
+@ionicon-var-earth: "\f276";
+@ionicon-var-easel: "\f3c2";
+@ionicon-var-edit: "\f2bf";
+@ionicon-var-egg: "\f277";
+@ionicon-var-eject: "\f131";
+@ionicon-var-email: "\f132";
+@ionicon-var-email-unread: "\f3c3";
+@ionicon-var-erlenmeyer-flask: "\f3c5";
+@ionicon-var-erlenmeyer-flask-bubbles: "\f3c4";
+@ionicon-var-eye: "\f133";
+@ionicon-var-eye-disabled: "\f306";
+@ionicon-var-female: "\f278";
+@ionicon-var-filing: "\f134";
+@ionicon-var-film-marker: "\f135";
+@ionicon-var-fireball: "\f319";
+@ionicon-var-flag: "\f279";
+@ionicon-var-flame: "\f31a";
+@ionicon-var-flash: "\f137";
+@ionicon-var-flash-off: "\f136";
+@ionicon-var-folder: "\f139";
+@ionicon-var-fork: "\f27a";
+@ionicon-var-fork-repo: "\f2c0";
+@ionicon-var-forward: "\f13a";
+@ionicon-var-funnel: "\f31b";
+@ionicon-var-gear-a: "\f13d";
+@ionicon-var-gear-b: "\f13e";
+@ionicon-var-grid: "\f13f";
+@ionicon-var-hammer: "\f27b";
+@ionicon-var-happy: "\f31c";
+@ionicon-var-happy-outline: "\f3c6";
+@ionicon-var-headphone: "\f140";
+@ionicon-var-heart: "\f141";
+@ionicon-var-heart-broken: "\f31d";
+@ionicon-var-help: "\f143";
+@ionicon-var-help-buoy: "\f27c";
+@ionicon-var-help-circled: "\f142";
+@ionicon-var-home: "\f144";
+@ionicon-var-icecream: "\f27d";
+@ionicon-var-image: "\f147";
+@ionicon-var-images: "\f148";
+@ionicon-var-information: "\f14a";
+@ionicon-var-information-circled: "\f149";
+@ionicon-var-ionic: "\f14b";
+@ionicon-var-ios-alarm: "\f3c8";
+@ionicon-var-ios-alarm-outline: "\f3c7";
+@ionicon-var-ios-albums: "\f3ca";
+@ionicon-var-ios-albums-outline: "\f3c9";
+@ionicon-var-ios-americanfootball: "\f3cc";
+@ionicon-var-ios-americanfootball-outline: "\f3cb";
+@ionicon-var-ios-analytics: "\f3ce";
+@ionicon-var-ios-analytics-outline: "\f3cd";
+@ionicon-var-ios-arrow-back: "\f3cf";
+@ionicon-var-ios-arrow-down: "\f3d0";
+@ionicon-var-ios-arrow-forward: "\f3d1";
+@ionicon-var-ios-arrow-left: "\f3d2";
+@ionicon-var-ios-arrow-right: "\f3d3";
+@ionicon-var-ios-arrow-thin-down: "\f3d4";
+@ionicon-var-ios-arrow-thin-left: "\f3d5";
+@ionicon-var-ios-arrow-thin-right: "\f3d6";
+@ionicon-var-ios-arrow-thin-up: "\f3d7";
+@ionicon-var-ios-arrow-up: "\f3d8";
+@ionicon-var-ios-at: "\f3da";
+@ionicon-var-ios-at-outline: "\f3d9";
+@ionicon-var-ios-barcode: "\f3dc";
+@ionicon-var-ios-barcode-outline: "\f3db";
+@ionicon-var-ios-baseball: "\f3de";
+@ionicon-var-ios-baseball-outline: "\f3dd";
+@ionicon-var-ios-basketball: "\f3e0";
+@ionicon-var-ios-basketball-outline: "\f3df";
+@ionicon-var-ios-bell: "\f3e2";
+@ionicon-var-ios-bell-outline: "\f3e1";
+@ionicon-var-ios-body: "\f3e4";
+@ionicon-var-ios-body-outline: "\f3e3";
+@ionicon-var-ios-bolt: "\f3e6";
+@ionicon-var-ios-bolt-outline: "\f3e5";
+@ionicon-var-ios-book: "\f3e8";
+@ionicon-var-ios-book-outline: "\f3e7";
+@ionicon-var-ios-bookmarks: "\f3ea";
+@ionicon-var-ios-bookmarks-outline: "\f3e9";
+@ionicon-var-ios-box: "\f3ec";
+@ionicon-var-ios-box-outline: "\f3eb";
+@ionicon-var-ios-briefcase: "\f3ee";
+@ionicon-var-ios-briefcase-outline: "\f3ed";
+@ionicon-var-ios-browsers: "\f3f0";
+@ionicon-var-ios-browsers-outline: "\f3ef";
+@ionicon-var-ios-calculator: "\f3f2";
+@ionicon-var-ios-calculator-outline: "\f3f1";
+@ionicon-var-ios-calendar: "\f3f4";
+@ionicon-var-ios-calendar-outline: "\f3f3";
+@ionicon-var-ios-camera: "\f3f6";
+@ionicon-var-ios-camera-outline: "\f3f5";
+@ionicon-var-ios-cart: "\f3f8";
+@ionicon-var-ios-cart-outline: "\f3f7";
+@ionicon-var-ios-chatboxes: "\f3fa";
+@ionicon-var-ios-chatboxes-outline: "\f3f9";
+@ionicon-var-ios-chatbubble: "\f3fc";
+@ionicon-var-ios-chatbubble-outline: "\f3fb";
+@ionicon-var-ios-checkmark: "\f3ff";
+@ionicon-var-ios-checkmark-empty: "\f3fd";
+@ionicon-var-ios-checkmark-outline: "\f3fe";
+@ionicon-var-ios-circle-filled: "\f400";
+@ionicon-var-ios-circle-outline: "\f401";
+@ionicon-var-ios-clock: "\f403";
+@ionicon-var-ios-clock-outline: "\f402";
+@ionicon-var-ios-close: "\f406";
+@ionicon-var-ios-close-empty: "\f404";
+@ionicon-var-ios-close-outline: "\f405";
+@ionicon-var-ios-cloud: "\f40c";
+@ionicon-var-ios-cloud-download: "\f408";
+@ionicon-var-ios-cloud-download-outline: "\f407";
+@ionicon-var-ios-cloud-outline: "\f409";
+@ionicon-var-ios-cloud-upload: "\f40b";
+@ionicon-var-ios-cloud-upload-outline: "\f40a";
+@ionicon-var-ios-cloudy: "\f410";
+@ionicon-var-ios-cloudy-night: "\f40e";
+@ionicon-var-ios-cloudy-night-outline: "\f40d";
+@ionicon-var-ios-cloudy-outline: "\f40f";
+@ionicon-var-ios-cog: "\f412";
+@ionicon-var-ios-cog-outline: "\f411";
+@ionicon-var-ios-color-filter: "\f414";
+@ionicon-var-ios-color-filter-outline: "\f413";
+@ionicon-var-ios-color-wand: "\f416";
+@ionicon-var-ios-color-wand-outline: "\f415";
+@ionicon-var-ios-compose: "\f418";
+@ionicon-var-ios-compose-outline: "\f417";
+@ionicon-var-ios-contact: "\f41a";
+@ionicon-var-ios-contact-outline: "\f419";
+@ionicon-var-ios-copy: "\f41c";
+@ionicon-var-ios-copy-outline: "\f41b";
+@ionicon-var-ios-crop: "\f41e";
+@ionicon-var-ios-crop-strong: "\f41d";
+@ionicon-var-ios-download: "\f420";
+@ionicon-var-ios-download-outline: "\f41f";
+@ionicon-var-ios-drag: "\f421";
+@ionicon-var-ios-email: "\f423";
+@ionicon-var-ios-email-outline: "\f422";
+@ionicon-var-ios-eye: "\f425";
+@ionicon-var-ios-eye-outline: "\f424";
+@ionicon-var-ios-fastforward: "\f427";
+@ionicon-var-ios-fastforward-outline: "\f426";
+@ionicon-var-ios-filing: "\f429";
+@ionicon-var-ios-filing-outline: "\f428";
+@ionicon-var-ios-film: "\f42b";
+@ionicon-var-ios-film-outline: "\f42a";
+@ionicon-var-ios-flag: "\f42d";
+@ionicon-var-ios-flag-outline: "\f42c";
+@ionicon-var-ios-flame: "\f42f";
+@ionicon-var-ios-flame-outline: "\f42e";
+@ionicon-var-ios-flask: "\f431";
+@ionicon-var-ios-flask-outline: "\f430";
+@ionicon-var-ios-flower: "\f433";
+@ionicon-var-ios-flower-outline: "\f432";
+@ionicon-var-ios-folder: "\f435";
+@ionicon-var-ios-folder-outline: "\f434";
+@ionicon-var-ios-football: "\f437";
+@ionicon-var-ios-football-outline: "\f436";
+@ionicon-var-ios-game-controller-a: "\f439";
+@ionicon-var-ios-game-controller-a-outline: "\f438";
+@ionicon-var-ios-game-controller-b: "\f43b";
+@ionicon-var-ios-game-controller-b-outline: "\f43a";
+@ionicon-var-ios-gear: "\f43d";
+@ionicon-var-ios-gear-outline: "\f43c";
+@ionicon-var-ios-glasses: "\f43f";
+@ionicon-var-ios-glasses-outline: "\f43e";
+@ionicon-var-ios-grid-view: "\f441";
+@ionicon-var-ios-grid-view-outline: "\f440";
+@ionicon-var-ios-heart: "\f443";
+@ionicon-var-ios-heart-outline: "\f442";
+@ionicon-var-ios-help: "\f446";
+@ionicon-var-ios-help-empty: "\f444";
+@ionicon-var-ios-help-outline: "\f445";
+@ionicon-var-ios-home: "\f448";
+@ionicon-var-ios-home-outline: "\f447";
+@ionicon-var-ios-infinite: "\f44a";
+@ionicon-var-ios-infinite-outline: "\f449";
+@ionicon-var-ios-information: "\f44d";
+@ionicon-var-ios-information-empty: "\f44b";
+@ionicon-var-ios-information-outline: "\f44c";
+@ionicon-var-ios-ionic-outline: "\f44e";
+@ionicon-var-ios-keypad: "\f450";
+@ionicon-var-ios-keypad-outline: "\f44f";
+@ionicon-var-ios-lightbulb: "\f452";
+@ionicon-var-ios-lightbulb-outline: "\f451";
+@ionicon-var-ios-list: "\f454";
+@ionicon-var-ios-list-outline: "\f453";
+@ionicon-var-ios-location: "\f456";
+@ionicon-var-ios-location-outline: "\f455";
+@ionicon-var-ios-locked: "\f458";
+@ionicon-var-ios-locked-outline: "\f457";
+@ionicon-var-ios-loop: "\f45a";
+@ionicon-var-ios-loop-strong: "\f459";
+@ionicon-var-ios-medical: "\f45c";
+@ionicon-var-ios-medical-outline: "\f45b";
+@ionicon-var-ios-medkit: "\f45e";
+@ionicon-var-ios-medkit-outline: "\f45d";
+@ionicon-var-ios-mic: "\f461";
+@ionicon-var-ios-mic-off: "\f45f";
+@ionicon-var-ios-mic-outline: "\f460";
+@ionicon-var-ios-minus: "\f464";
+@ionicon-var-ios-minus-empty: "\f462";
+@ionicon-var-ios-minus-outline: "\f463";
+@ionicon-var-ios-monitor: "\f466";
+@ionicon-var-ios-monitor-outline: "\f465";
+@ionicon-var-ios-moon: "\f468";
+@ionicon-var-ios-moon-outline: "\f467";
+@ionicon-var-ios-more: "\f46a";
+@ionicon-var-ios-more-outline: "\f469";
+@ionicon-var-ios-musical-note: "\f46b";
+@ionicon-var-ios-musical-notes: "\f46c";
+@ionicon-var-ios-navigate: "\f46e";
+@ionicon-var-ios-navigate-outline: "\f46d";
+@ionicon-var-ios-nutrition: "\f470";
+@ionicon-var-ios-nutrition-outline: "\f46f";
+@ionicon-var-ios-paper: "\f472";
+@ionicon-var-ios-paper-outline: "\f471";
+@ionicon-var-ios-paperplane: "\f474";
+@ionicon-var-ios-paperplane-outline: "\f473";
+@ionicon-var-ios-partlysunny: "\f476";
+@ionicon-var-ios-partlysunny-outline: "\f475";
+@ionicon-var-ios-pause: "\f478";
+@ionicon-var-ios-pause-outline: "\f477";
+@ionicon-var-ios-paw: "\f47a";
+@ionicon-var-ios-paw-outline: "\f479";
+@ionicon-var-ios-people: "\f47c";
+@ionicon-var-ios-people-outline: "\f47b";
+@ionicon-var-ios-person: "\f47e";
+@ionicon-var-ios-person-outline: "\f47d";
+@ionicon-var-ios-personadd: "\f480";
+@ionicon-var-ios-personadd-outline: "\f47f";
+@ionicon-var-ios-photos: "\f482";
+@ionicon-var-ios-photos-outline: "\f481";
+@ionicon-var-ios-pie: "\f484";
+@ionicon-var-ios-pie-outline: "\f483";
+@ionicon-var-ios-pint: "\f486";
+@ionicon-var-ios-pint-outline: "\f485";
+@ionicon-var-ios-play: "\f488";
+@ionicon-var-ios-play-outline: "\f487";
+@ionicon-var-ios-plus: "\f48b";
+@ionicon-var-ios-plus-empty: "\f489";
+@ionicon-var-ios-plus-outline: "\f48a";
+@ionicon-var-ios-pricetag: "\f48d";
+@ionicon-var-ios-pricetag-outline: "\f48c";
+@ionicon-var-ios-pricetags: "\f48f";
+@ionicon-var-ios-pricetags-outline: "\f48e";
+@ionicon-var-ios-printer: "\f491";
+@ionicon-var-ios-printer-outline: "\f490";
+@ionicon-var-ios-pulse: "\f493";
+@ionicon-var-ios-pulse-strong: "\f492";
+@ionicon-var-ios-rainy: "\f495";
+@ionicon-var-ios-rainy-outline: "\f494";
+@ionicon-var-ios-recording: "\f497";
+@ionicon-var-ios-recording-outline: "\f496";
+@ionicon-var-ios-redo: "\f499";
+@ionicon-var-ios-redo-outline: "\f498";
+@ionicon-var-ios-refresh: "\f49c";
+@ionicon-var-ios-refresh-empty: "\f49a";
+@ionicon-var-ios-refresh-outline: "\f49b";
+@ionicon-var-ios-reload: "\f49d";
+@ionicon-var-ios-reverse-camera: "\f49f";
+@ionicon-var-ios-reverse-camera-outline: "\f49e";
+@ionicon-var-ios-rewind: "\f4a1";
+@ionicon-var-ios-rewind-outline: "\f4a0";
+@ionicon-var-ios-rose: "\f4a3";
+@ionicon-var-ios-rose-outline: "\f4a2";
+@ionicon-var-ios-search: "\f4a5";
+@ionicon-var-ios-search-strong: "\f4a4";
+@ionicon-var-ios-settings: "\f4a7";
+@ionicon-var-ios-settings-strong: "\f4a6";
+@ionicon-var-ios-shuffle: "\f4a9";
+@ionicon-var-ios-shuffle-strong: "\f4a8";
+@ionicon-var-ios-skipbackward: "\f4ab";
+@ionicon-var-ios-skipbackward-outline: "\f4aa";
+@ionicon-var-ios-skipforward: "\f4ad";
+@ionicon-var-ios-skipforward-outline: "\f4ac";
+@ionicon-var-ios-snowy: "\f4ae";
+@ionicon-var-ios-speedometer: "\f4b0";
+@ionicon-var-ios-speedometer-outline: "\f4af";
+@ionicon-var-ios-star: "\f4b3";
+@ionicon-var-ios-star-half: "\f4b1";
+@ionicon-var-ios-star-outline: "\f4b2";
+@ionicon-var-ios-stopwatch: "\f4b5";
+@ionicon-var-ios-stopwatch-outline: "\f4b4";
+@ionicon-var-ios-sunny: "\f4b7";
+@ionicon-var-ios-sunny-outline: "\f4b6";
+@ionicon-var-ios-telephone: "\f4b9";
+@ionicon-var-ios-telephone-outline: "\f4b8";
+@ionicon-var-ios-tennisball: "\f4bb";
+@ionicon-var-ios-tennisball-outline: "\f4ba";
+@ionicon-var-ios-thunderstorm: "\f4bd";
+@ionicon-var-ios-thunderstorm-outline: "\f4bc";
+@ionicon-var-ios-time: "\f4bf";
+@ionicon-var-ios-time-outline: "\f4be";
+@ionicon-var-ios-timer: "\f4c1";
+@ionicon-var-ios-timer-outline: "\f4c0";
+@ionicon-var-ios-toggle: "\f4c3";
+@ionicon-var-ios-toggle-outline: "\f4c2";
+@ionicon-var-ios-trash: "\f4c5";
+@ionicon-var-ios-trash-outline: "\f4c4";
+@ionicon-var-ios-undo: "\f4c7";
+@ionicon-var-ios-undo-outline: "\f4c6";
+@ionicon-var-ios-unlocked: "\f4c9";
+@ionicon-var-ios-unlocked-outline: "\f4c8";
+@ionicon-var-ios-upload: "\f4cb";
+@ionicon-var-ios-upload-outline: "\f4ca";
+@ionicon-var-ios-videocam: "\f4cd";
+@ionicon-var-ios-videocam-outline: "\f4cc";
+@ionicon-var-ios-volume-high: "\f4ce";
+@ionicon-var-ios-volume-low: "\f4cf";
+@ionicon-var-ios-wineglass: "\f4d1";
+@ionicon-var-ios-wineglass-outline: "\f4d0";
+@ionicon-var-ios-world: "\f4d3";
+@ionicon-var-ios-world-outline: "\f4d2";
+@ionicon-var-ipad: "\f1f9";
+@ionicon-var-iphone: "\f1fa";
+@ionicon-var-ipod: "\f1fb";
+@ionicon-var-jet: "\f295";
+@ionicon-var-key: "\f296";
+@ionicon-var-knife: "\f297";
+@ionicon-var-laptop: "\f1fc";
+@ionicon-var-leaf: "\f1fd";
+@ionicon-var-levels: "\f298";
+@ionicon-var-lightbulb: "\f299";
+@ionicon-var-link: "\f1fe";
+@ionicon-var-load-a: "\f29a";
+@ionicon-var-load-b: "\f29b";
+@ionicon-var-load-c: "\f29c";
+@ionicon-var-load-d: "\f29d";
+@ionicon-var-location: "\f1ff";
+@ionicon-var-lock-combination: "\f4d4";
+@ionicon-var-locked: "\f200";
+@ionicon-var-log-in: "\f29e";
+@ionicon-var-log-out: "\f29f";
+@ionicon-var-loop: "\f201";
+@ionicon-var-magnet: "\f2a0";
+@ionicon-var-male: "\f2a1";
+@ionicon-var-man: "\f202";
+@ionicon-var-map: "\f203";
+@ionicon-var-medkit: "\f2a2";
+@ionicon-var-merge: "\f33f";
+@ionicon-var-mic-a: "\f204";
+@ionicon-var-mic-b: "\f205";
+@ionicon-var-mic-c: "\f206";
+@ionicon-var-minus: "\f209";
+@ionicon-var-minus-circled: "\f207";
+@ionicon-var-minus-round: "\f208";
+@ionicon-var-model-s: "\f2c1";
+@ionicon-var-monitor: "\f20a";
+@ionicon-var-more: "\f20b";
+@ionicon-var-mouse: "\f340";
+@ionicon-var-music-note: "\f20c";
+@ionicon-var-navicon: "\f20e";
+@ionicon-var-navicon-round: "\f20d";
+@ionicon-var-navigate: "\f2a3";
+@ionicon-var-network: "\f341";
+@ionicon-var-no-smoking: "\f2c2";
+@ionicon-var-nuclear: "\f2a4";
+@ionicon-var-outlet: "\f342";
+@ionicon-var-paintbrush: "\f4d5";
+@ionicon-var-paintbucket: "\f4d6";
+@ionicon-var-paper-airplane: "\f2c3";
+@ionicon-var-paperclip: "\f20f";
+@ionicon-var-pause: "\f210";
+@ionicon-var-person: "\f213";
+@ionicon-var-person-add: "\f211";
+@ionicon-var-person-stalker: "\f212";
+@ionicon-var-pie-graph: "\f2a5";
+@ionicon-var-pin: "\f2a6";
+@ionicon-var-pinpoint: "\f2a7";
+@ionicon-var-pizza: "\f2a8";
+@ionicon-var-plane: "\f214";
+@ionicon-var-planet: "\f343";
+@ionicon-var-play: "\f215";
+@ionicon-var-playstation: "\f30a";
+@ionicon-var-plus: "\f218";
+@ionicon-var-plus-circled: "\f216";
+@ionicon-var-plus-round: "\f217";
+@ionicon-var-podium: "\f344";
+@ionicon-var-pound: "\f219";
+@ionicon-var-power: "\f2a9";
+@ionicon-var-pricetag: "\f2aa";
+@ionicon-var-pricetags: "\f2ab";
+@ionicon-var-printer: "\f21a";
+@ionicon-var-pull-request: "\f345";
+@ionicon-var-qr-scanner: "\f346";
+@ionicon-var-quote: "\f347";
+@ionicon-var-radio-waves: "\f2ac";
+@ionicon-var-record: "\f21b";
+@ionicon-var-refresh: "\f21c";
+@ionicon-var-reply: "\f21e";
+@ionicon-var-reply-all: "\f21d";
+@ionicon-var-ribbon-a: "\f348";
+@ionicon-var-ribbon-b: "\f349";
+@ionicon-var-sad: "\f34a";
+@ionicon-var-sad-outline: "\f4d7";
+@ionicon-var-scissors: "\f34b";
+@ionicon-var-search: "\f21f";
+@ionicon-var-settings: "\f2ad";
+@ionicon-var-share: "\f220";
+@ionicon-var-shuffle: "\f221";
+@ionicon-var-skip-backward: "\f222";
+@ionicon-var-skip-forward: "\f223";
+@ionicon-var-social-android: "\f225";
+@ionicon-var-social-android-outline: "\f224";
+@ionicon-var-social-angular: "\f4d9";
+@ionicon-var-social-angular-outline: "\f4d8";
+@ionicon-var-social-apple: "\f227";
+@ionicon-var-social-apple-outline: "\f226";
+@ionicon-var-social-bitcoin: "\f2af";
+@ionicon-var-social-bitcoin-outline: "\f2ae";
+@ionicon-var-social-buffer: "\f229";
+@ionicon-var-social-buffer-outline: "\f228";
+@ionicon-var-social-chrome: "\f4db";
+@ionicon-var-social-chrome-outline: "\f4da";
+@ionicon-var-social-codepen: "\f4dd";
+@ionicon-var-social-codepen-outline: "\f4dc";
+@ionicon-var-social-css3: "\f4df";
+@ionicon-var-social-css3-outline: "\f4de";
+@ionicon-var-social-designernews: "\f22b";
+@ionicon-var-social-designernews-outline: "\f22a";
+@ionicon-var-social-dribbble: "\f22d";
+@ionicon-var-social-dribbble-outline: "\f22c";
+@ionicon-var-social-dropbox: "\f22f";
+@ionicon-var-social-dropbox-outline: "\f22e";
+@ionicon-var-social-euro: "\f4e1";
+@ionicon-var-social-euro-outline: "\f4e0";
+@ionicon-var-social-facebook: "\f231";
+@ionicon-var-social-facebook-outline: "\f230";
+@ionicon-var-social-foursquare: "\f34d";
+@ionicon-var-social-foursquare-outline: "\f34c";
+@ionicon-var-social-freebsd-devil: "\f2c4";
+@ionicon-var-social-github: "\f233";
+@ionicon-var-social-github-outline: "\f232";
+@ionicon-var-social-google: "\f34f";
+@ionicon-var-social-google-outline: "\f34e";
+@ionicon-var-social-googleplus: "\f235";
+@ionicon-var-social-googleplus-outline: "\f234";
+@ionicon-var-social-hackernews: "\f237";
+@ionicon-var-social-hackernews-outline: "\f236";
+@ionicon-var-social-html5: "\f4e3";
+@ionicon-var-social-html5-outline: "\f4e2";
+@ionicon-var-social-instagram: "\f351";
+@ionicon-var-social-instagram-outline: "\f350";
+@ionicon-var-social-javascript: "\f4e5";
+@ionicon-var-social-javascript-outline: "\f4e4";
+@ionicon-var-social-linkedin: "\f239";
+@ionicon-var-social-linkedin-outline: "\f238";
+@ionicon-var-social-markdown: "\f4e6";
+@ionicon-var-social-nodejs: "\f4e7";
+@ionicon-var-social-octocat: "\f4e8";
+@ionicon-var-social-pinterest: "\f2b1";
+@ionicon-var-social-pinterest-outline: "\f2b0";
+@ionicon-var-social-python: "\f4e9";
+@ionicon-var-social-reddit: "\f23b";
+@ionicon-var-social-reddit-outline: "\f23a";
+@ionicon-var-social-rss: "\f23d";
+@ionicon-var-social-rss-outline: "\f23c";
+@ionicon-var-social-sass: "\f4ea";
+@ionicon-var-social-skype: "\f23f";
+@ionicon-var-social-skype-outline: "\f23e";
+@ionicon-var-social-snapchat: "\f4ec";
+@ionicon-var-social-snapchat-outline: "\f4eb";
+@ionicon-var-social-tumblr: "\f241";
+@ionicon-var-social-tumblr-outline: "\f240";
+@ionicon-var-social-tux: "\f2c5";
+@ionicon-var-social-twitch: "\f4ee";
+@ionicon-var-social-twitch-outline: "\f4ed";
+@ionicon-var-social-twitter: "\f243";
+@ionicon-var-social-twitter-outline: "\f242";
+@ionicon-var-social-usd: "\f353";
+@ionicon-var-social-usd-outline: "\f352";
+@ionicon-var-social-vimeo: "\f245";
+@ionicon-var-social-vimeo-outline: "\f244";
+@ionicon-var-social-whatsapp: "\f4f0";
+@ionicon-var-social-whatsapp-outline: "\f4ef";
+@ionicon-var-social-windows: "\f247";
+@ionicon-var-social-windows-outline: "\f246";
+@ionicon-var-social-wordpress: "\f249";
+@ionicon-var-social-wordpress-outline: "\f248";
+@ionicon-var-social-yahoo: "\f24b";
+@ionicon-var-social-yahoo-outline: "\f24a";
+@ionicon-var-social-yen: "\f4f2";
+@ionicon-var-social-yen-outline: "\f4f1";
+@ionicon-var-social-youtube: "\f24d";
+@ionicon-var-social-youtube-outline: "\f24c";
+@ionicon-var-soup-can: "\f4f4";
+@ionicon-var-soup-can-outline: "\f4f3";
+@ionicon-var-speakerphone: "\f2b2";
+@ionicon-var-speedometer: "\f2b3";
+@ionicon-var-spoon: "\f2b4";
+@ionicon-var-star: "\f24e";
+@ionicon-var-stats-bars: "\f2b5";
+@ionicon-var-steam: "\f30b";
+@ionicon-var-stop: "\f24f";
+@ionicon-var-thermometer: "\f2b6";
+@ionicon-var-thumbsdown: "\f250";
+@ionicon-var-thumbsup: "\f251";
+@ionicon-var-toggle: "\f355";
+@ionicon-var-toggle-filled: "\f354";
+@ionicon-var-transgender: "\f4f5";
+@ionicon-var-trash-a: "\f252";
+@ionicon-var-trash-b: "\f253";
+@ionicon-var-trophy: "\f356";
+@ionicon-var-tshirt: "\f4f7";
+@ionicon-var-tshirt-outline: "\f4f6";
+@ionicon-var-umbrella: "\f2b7";
+@ionicon-var-university: "\f357";
+@ionicon-var-unlocked: "\f254";
+@ionicon-var-upload: "\f255";
+@ionicon-var-usb: "\f2b8";
+@ionicon-var-videocamera: "\f256";
+@ionicon-var-volume-high: "\f257";
+@ionicon-var-volume-low: "\f258";
+@ionicon-var-volume-medium: "\f259";
+@ionicon-var-volume-mute: "\f25a";
+@ionicon-var-wand: "\f358";
+@ionicon-var-waterdrop: "\f25b";
+@ionicon-var-wifi: "\f25c";
+@ionicon-var-wineglass: "\f2b9";
+@ionicon-var-woman: "\f25d";
+@ionicon-var-wrench: "\f2ba";
+@ionicon-var-xbox: "\f30c"; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/ionicons.less b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/ionicons.less
new file mode 100644
index 00000000..163b80e7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/ionicons.less
@@ -0,0 +1,3 @@
+@import "_ionicons-variables";
+@import "_ionicons-font";
+@import "_ionicons-icons";
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/alert-circled.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/alert-circled.png
new file mode 100644
index 00000000..7cdd286a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/alert-circled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/alert.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/alert.png
new file mode 100644
index 00000000..a0c06feb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/alert.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-add-contact.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-add-contact.png
new file mode 100644
index 00000000..7dea968f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-add-contact.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-add.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-add.png
new file mode 100644
index 00000000..03838f73
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-add.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-alarm.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-alarm.png
new file mode 100644
index 00000000..bc3f06f3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-alarm.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-archive.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-archive.png
new file mode 100644
index 00000000..ef651170
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-archive.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-back.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-back.png
new file mode 100644
index 00000000..19de4b02
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-back.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-down-left.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-down-left.png
new file mode 100644
index 00000000..4e5ef0c9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-down-left.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-down-right.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-down-right.png
new file mode 100644
index 00000000..ba22a1a4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-down-right.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-forward.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-forward.png
new file mode 100644
index 00000000..b85834e3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-forward.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-up-left.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-up-left.png
new file mode 100644
index 00000000..eb93ab54
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-up-left.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-up-right.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-up-right.png
new file mode 100644
index 00000000..0f105d77
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-up-right.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-battery.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-battery.png
new file mode 100644
index 00000000..ddeaa1e3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-battery.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-book.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-book.png
new file mode 100644
index 00000000..4764f96a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-book.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-calendar.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-calendar.png
new file mode 100644
index 00000000..547edc56
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-calendar.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-call.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-call.png
new file mode 100644
index 00000000..1d514da3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-call.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-camera.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-camera.png
new file mode 100644
index 00000000..e3e8227c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-camera.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-chat.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-chat.png
new file mode 100644
index 00000000..8b7d7b95
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-chat.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-checkmark.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-checkmark.png
new file mode 100644
index 00000000..bec7334c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-checkmark.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-clock.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-clock.png
new file mode 100644
index 00000000..44976052
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-clock.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-close.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-close.png
new file mode 100644
index 00000000..f8a96b2a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-close.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-contact.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-contact.png
new file mode 100644
index 00000000..fa8c8fa2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-contact.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-contacts.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-contacts.png
new file mode 100644
index 00000000..b06e4f4d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-contacts.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-data.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-data.png
new file mode 100644
index 00000000..8fcf7c4f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-data.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-developer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-developer.png
new file mode 100644
index 00000000..294ffe28
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-developer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-display.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-display.png
new file mode 100644
index 00000000..ff0893d1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-display.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-download.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-download.png
new file mode 100644
index 00000000..3b156cfe
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-download.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-drawer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-drawer.png
new file mode 100644
index 00000000..7b0c8b95
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-drawer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-dropdown.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-dropdown.png
new file mode 100644
index 00000000..e4078816
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-dropdown.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-earth.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-earth.png
new file mode 100644
index 00000000..1f392124
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-earth.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-folder.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-folder.png
new file mode 100644
index 00000000..6c05cd4e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-folder.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-forums.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-forums.png
new file mode 100644
index 00000000..766b84d9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-forums.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-friends.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-friends.png
new file mode 100644
index 00000000..2e4e4e31
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-friends.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-hand.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-hand.png
new file mode 100644
index 00000000..5ebb0c52
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-hand.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-image.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-image.png
new file mode 100644
index 00000000..d3b1af9e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-image.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-inbox.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-inbox.png
new file mode 100644
index 00000000..1ca66de4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-inbox.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-information.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-information.png
new file mode 100644
index 00000000..9d9c923b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-information.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-keypad.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-keypad.png
new file mode 100644
index 00000000..cd22f55a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-keypad.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-lightbulb.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-lightbulb.png
new file mode 100644
index 00000000..963b2445
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-lightbulb.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-locate.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-locate.png
new file mode 100644
index 00000000..5288a280
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-locate.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-location.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-location.png
new file mode 100644
index 00000000..05cc5b62
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-location.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-mail.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-mail.png
new file mode 100644
index 00000000..894b1216
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-mail.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-microphone.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-microphone.png
new file mode 100644
index 00000000..b99bf614
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-microphone.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-mixer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-mixer.png
new file mode 100644
index 00000000..5b910d5a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-mixer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-more.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-more.png
new file mode 100644
index 00000000..a3ac53af
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-more.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-note.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-note.png
new file mode 100644
index 00000000..75643c53
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-note.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-playstore.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-playstore.png
new file mode 100644
index 00000000..9202fc61
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-playstore.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-printer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-printer.png
new file mode 100644
index 00000000..a653818b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-printer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-promotion.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-promotion.png
new file mode 100644
index 00000000..b65d1e8a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-promotion.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-reminder.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-reminder.png
new file mode 100644
index 00000000..41aadaa0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-reminder.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-remove.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-remove.png
new file mode 100644
index 00000000..467d7763
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-remove.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-search.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-search.png
new file mode 100644
index 00000000..148264d8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-search.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-send.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-send.png
new file mode 100644
index 00000000..3c668db0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-send.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-settings.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-settings.png
new file mode 100644
index 00000000..0090ed8d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-settings.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-share.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-share.png
new file mode 100644
index 00000000..3f7773c4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-share.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-social-user.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-social-user.png
new file mode 100644
index 00000000..db31a6b4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-social-user.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-social.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-social.png
new file mode 100644
index 00000000..4dd3c374
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-social.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-sort.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-sort.png
new file mode 100644
index 00000000..cb68046b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-sort.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-stair-drawer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-stair-drawer.png
new file mode 100644
index 00000000..8b339ea2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-stair-drawer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-star.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-star.png
new file mode 100644
index 00000000..aee429c2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-star.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-stopwatch.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-stopwatch.png
new file mode 100644
index 00000000..ca404d97
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-stopwatch.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-storage.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-storage.png
new file mode 100644
index 00000000..af2db373
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-storage.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-back.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-back.png
new file mode 100644
index 00000000..a7b22bf8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-back.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-home.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-home.png
new file mode 100644
index 00000000..54fa3237
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-home.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-windows.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-windows.png
new file mode 100644
index 00000000..4ea950c7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-windows.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-timer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-timer.png
new file mode 100644
index 00000000..6584dc79
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-timer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-trash.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-trash.png
new file mode 100644
index 00000000..d8434981
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-trash.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-user-menu.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-user-menu.png
new file mode 100644
index 00000000..8ddb33a7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-user-menu.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-volume.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-volume.png
new file mode 100644
index 00000000..8faa6040
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-volume.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-wifi.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-wifi.png
new file mode 100644
index 00000000..f9a9a1f3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-wifi.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/aperture.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/aperture.png
new file mode 100644
index 00000000..cb0f5482
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/aperture.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/archive.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/archive.png
new file mode 100644
index 00000000..7e52197b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/archive.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-a.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-a.png
new file mode 100644
index 00000000..c6c25131
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-a.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-b.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-b.png
new file mode 100644
index 00000000..da3041f5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-b.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-c.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-c.png
new file mode 100644
index 00000000..3643857b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-c.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-expand.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-expand.png
new file mode 100644
index 00000000..4db52ab6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-expand.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-down-left.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-down-left.png
new file mode 100644
index 00000000..060d13c6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-down-left.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-down-right.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-down-right.png
new file mode 100644
index 00000000..346f70d1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-down-right.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-up-left.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-up-left.png
new file mode 100644
index 00000000..b0247c3a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-up-left.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-up-right.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-up-right.png
new file mode 100644
index 00000000..d7dbb221
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-up-right.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-a.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-a.png
new file mode 100644
index 00000000..d56a7c9b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-a.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-b.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-b.png
new file mode 100644
index 00000000..fdb927c2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-b.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-c.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-c.png
new file mode 100644
index 00000000..c75bfc0a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-c.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-move.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-move.png
new file mode 100644
index 00000000..6c2902a0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-move.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-resize.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-resize.png
new file mode 100644
index 00000000..1aabbfff
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-resize.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-return-left.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-return-left.png
new file mode 100644
index 00000000..ad1d02ff
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-return-left.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-return-right.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-return-right.png
new file mode 100644
index 00000000..8e37cc55
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-return-right.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-a.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-a.png
new file mode 100644
index 00000000..d6dacc1c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-a.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-b.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-b.png
new file mode 100644
index 00000000..00e90696
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-b.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-c.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-c.png
new file mode 100644
index 00000000..dfb3242c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-c.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-shrink.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-shrink.png
new file mode 100644
index 00000000..e1de18d2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-shrink.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-swap.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-swap.png
new file mode 100644
index 00000000..cb7a2ece
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-swap.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-a.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-a.png
new file mode 100644
index 00000000..6d128915
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-a.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-b.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-b.png
new file mode 100644
index 00000000..a2b84ac5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-b.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-c.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-c.png
new file mode 100644
index 00000000..8e0ccc7e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-c.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/asterisk.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/asterisk.png
new file mode 100644
index 00000000..7cb3636e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/asterisk.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/at.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/at.png
new file mode 100644
index 00000000..ae4bbe3e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/at.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bag.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bag.png
new file mode 100644
index 00000000..26128312
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bag.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-charging.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-charging.png
new file mode 100644
index 00000000..c91d30e3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-charging.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-empty.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-empty.png
new file mode 100644
index 00000000..72d01979
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-empty.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-full.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-full.png
new file mode 100644
index 00000000..eb5bbd8b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-full.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-half.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-half.png
new file mode 100644
index 00000000..28e9073b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-half.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-low.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-low.png
new file mode 100644
index 00000000..12c507a1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-low.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/beaker.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/beaker.png
new file mode 100644
index 00000000..edfb857c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/beaker.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/beer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/beer.png
new file mode 100644
index 00000000..caa7b8e3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/beer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bluetooth.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bluetooth.png
new file mode 100644
index 00000000..139d5429
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bluetooth.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bonfire.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bonfire.png
new file mode 100644
index 00000000..5dcf8fa7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bonfire.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bookmark.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bookmark.png
new file mode 100644
index 00000000..35af5d79
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bookmark.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/briefcase.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/briefcase.png
new file mode 100644
index 00000000..439c2125
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/briefcase.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bug.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bug.png
new file mode 100644
index 00000000..8dc4d27a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bug.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/calculator.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/calculator.png
new file mode 100644
index 00000000..8c425e51
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/calculator.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/calendar.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/calendar.png
new file mode 100644
index 00000000..2700f1bb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/calendar.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/camera.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/camera.png
new file mode 100644
index 00000000..522071f9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/camera.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/card.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/card.png
new file mode 100644
index 00000000..536ed7e3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/card.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cash.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cash.png
new file mode 100644
index 00000000..2c43f2a9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cash.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbox-working.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbox-working.png
new file mode 100644
index 00000000..c54cba42
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbox-working.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbox.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbox.png
new file mode 100644
index 00000000..9d80dd80
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbox.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatboxes.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatboxes.png
new file mode 100644
index 00000000..4cf816ed
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatboxes.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubble-working.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubble-working.png
new file mode 100644
index 00000000..5b973d75
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubble-working.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubble.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubble.png
new file mode 100644
index 00000000..ba0ebed0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubble.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubbles.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubbles.png
new file mode 100644
index 00000000..4d0c4c0b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubbles.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark-circled.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark-circled.png
new file mode 100644
index 00000000..ca761f9e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark-circled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark-round.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark-round.png
new file mode 100644
index 00000000..bf6361e7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark-round.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark.png
new file mode 100644
index 00000000..34d15d39
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-down.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-down.png
new file mode 100644
index 00000000..dec11dc9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-down.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-left.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-left.png
new file mode 100644
index 00000000..93547200
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-left.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-right.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-right.png
new file mode 100644
index 00000000..2a5caff5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-right.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-up.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-up.png
new file mode 100644
index 00000000..a047b094
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-up.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/clipboard.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/clipboard.png
new file mode 100644
index 00000000..ae22e994
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/clipboard.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/clock.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/clock.png
new file mode 100644
index 00000000..508d32af
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/clock.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close-circled.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close-circled.png
new file mode 100644
index 00000000..e764171a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close-circled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close-round.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close-round.png
new file mode 100644
index 00000000..81aa3670
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close-round.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close.png
new file mode 100644
index 00000000..b8a65df7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/closed-captioning.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/closed-captioning.png
new file mode 100644
index 00000000..8a8c3030
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/closed-captioning.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cloud.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cloud.png
new file mode 100644
index 00000000..e693d348
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cloud.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code-download.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code-download.png
new file mode 100644
index 00000000..43f45359
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code-download.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code-working.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code-working.png
new file mode 100644
index 00000000..b462cb3e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code-working.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code.png
new file mode 100644
index 00000000..5633483b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/coffee.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/coffee.png
new file mode 100644
index 00000000..578375bc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/coffee.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/compass.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/compass.png
new file mode 100644
index 00000000..dcfa3e07
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/compass.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/compose.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/compose.png
new file mode 100644
index 00000000..f9c6ecae
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/compose.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/connection-bars.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/connection-bars.png
new file mode 100644
index 00000000..6ab10412
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/connection-bars.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/contrast.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/contrast.png
new file mode 100644
index 00000000..6d375648
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/contrast.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cube.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cube.png
new file mode 100644
index 00000000..a9164ca4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cube.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/disc.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/disc.png
new file mode 100644
index 00000000..3d2b9b97
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/disc.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/document-text.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/document-text.png
new file mode 100644
index 00000000..02318c2b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/document-text.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/document.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/document.png
new file mode 100644
index 00000000..0f37ec2d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/document.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/drag.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/drag.png
new file mode 100644
index 00000000..3a94a3bc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/drag.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/earth.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/earth.png
new file mode 100644
index 00000000..87a4057b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/earth.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/edit.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/edit.png
new file mode 100644
index 00000000..9f32a2a0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/edit.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/egg.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/egg.png
new file mode 100644
index 00000000..8710c887
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/egg.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eject.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eject.png
new file mode 100644
index 00000000..063c2f86
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eject.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/email.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/email.png
new file mode 100644
index 00000000..972cd315
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/email.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eye-disabled.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eye-disabled.png
new file mode 100644
index 00000000..d973e415
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eye-disabled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eye.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eye.png
new file mode 100644
index 00000000..13be6456
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eye.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/female.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/female.png
new file mode 100644
index 00000000..53f972fa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/female.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/filing.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/filing.png
new file mode 100644
index 00000000..7678ba72
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/filing.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/film-marker.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/film-marker.png
new file mode 100644
index 00000000..ebaf3e62
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/film-marker.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fireball.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fireball.png
new file mode 100644
index 00000000..8cc28779
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fireball.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flag.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flag.png
new file mode 100644
index 00000000..28aa3304
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flag.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flame.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flame.png
new file mode 100644
index 00000000..6efca560
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flame.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flash-off.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flash-off.png
new file mode 100644
index 00000000..878e0415
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flash-off.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flash.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flash.png
new file mode 100644
index 00000000..1cef7acf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flash.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flask.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flask.png
new file mode 100644
index 00000000..2f93ab69
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flask.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/folder.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/folder.png
new file mode 100644
index 00000000..35ffec5d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/folder.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fork-repo.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fork-repo.png
new file mode 100644
index 00000000..9b954522
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fork-repo.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fork.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fork.png
new file mode 100644
index 00000000..4e966221
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fork.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/forward.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/forward.png
new file mode 100644
index 00000000..9a583b36
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/forward.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/funnel.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/funnel.png
new file mode 100644
index 00000000..bdc73be3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/funnel.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/game-controller-a.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/game-controller-a.png
new file mode 100644
index 00000000..cca34443
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/game-controller-a.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/game-controller-b.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/game-controller-b.png
new file mode 100644
index 00000000..54cd8810
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/game-controller-b.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/gear-a.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/gear-a.png
new file mode 100644
index 00000000..1e3d229a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/gear-a.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/gear-b.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/gear-b.png
new file mode 100644
index 00000000..d7fb8e0a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/gear-b.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/grid.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/grid.png
new file mode 100644
index 00000000..05962156
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/grid.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/hammer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/hammer.png
new file mode 100644
index 00000000..1bd23c2f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/hammer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/happy.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/happy.png
new file mode 100644
index 00000000..42f4b719
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/happy.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/headphone.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/headphone.png
new file mode 100644
index 00000000..fbf54fcd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/headphone.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/heart-broken.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/heart-broken.png
new file mode 100644
index 00000000..24abdfe1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/heart-broken.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/heart.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/heart.png
new file mode 100644
index 00000000..8a444fb7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/heart.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help-buoy.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help-buoy.png
new file mode 100644
index 00000000..eef82ae3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help-buoy.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help-circled.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help-circled.png
new file mode 100644
index 00000000..5fb5e853
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help-circled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help.png
new file mode 100644
index 00000000..8b9179db
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/home.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/home.png
new file mode 100644
index 00000000..ad02c46a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/home.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icecream.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icecream.png
new file mode 100644
index 00000000..da3ae9d3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icecream.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icon-social-google-plus-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icon-social-google-plus-outline.png
new file mode 100644
index 00000000..9eeb43ff
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icon-social-google-plus-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icon-social-google-plus.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icon-social-google-plus.png
new file mode 100644
index 00000000..e79ca447
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icon-social-google-plus.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/image.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/image.png
new file mode 100644
index 00000000..eb11e5fa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/image.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/images.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/images.png
new file mode 100644
index 00000000..21dcd601
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/images.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/information-circled.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/information-circled.png
new file mode 100644
index 00000000..a85ad30b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/information-circled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/information.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/information.png
new file mode 100644
index 00000000..8e03190a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/information.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ionic.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ionic.png
new file mode 100644
index 00000000..95d70760
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ionic.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-alarm-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-alarm-outline.png
new file mode 100644
index 00000000..2809a5b9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-alarm-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-alarm.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-alarm.png
new file mode 100644
index 00000000..6c7415f9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-alarm.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-albums-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-albums-outline.png
new file mode 100644
index 00000000..41b5a845
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-albums-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-albums.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-albums.png
new file mode 100644
index 00000000..bdc76725
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-albums.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-americanfootball-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-americanfootball-outline.png
new file mode 100644
index 00000000..14c625d8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-americanfootball-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-americanfootball.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-americanfootball.png
new file mode 100644
index 00000000..81834cf3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-americanfootball.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-analytics-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-analytics-outline.png
new file mode 100644
index 00000000..38534a19
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-analytics-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-analytics.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-analytics.png
new file mode 100644
index 00000000..ffcd2817
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-analytics.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-back.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-back.png
new file mode 100644
index 00000000..4051ab2c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-back.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-down.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-down.png
new file mode 100644
index 00000000..093eb0b0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-down.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-forward.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-forward.png
new file mode 100644
index 00000000..aedf67a5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-forward.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-left.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-left.png
new file mode 100644
index 00000000..acc8354c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-left.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-right.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-right.png
new file mode 100644
index 00000000..6144fbd4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-right.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-down.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-down.png
new file mode 100644
index 00000000..8a5c17cb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-down.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-left.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-left.png
new file mode 100644
index 00000000..4f8bf90f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-left.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-right.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-right.png
new file mode 100644
index 00000000..b97e69c9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-right.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-up.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-up.png
new file mode 100644
index 00000000..61bb13a0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-up.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-up.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-up.png
new file mode 100644
index 00000000..b4733f2e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-up.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-at-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-at-outline.png
new file mode 100644
index 00000000..22346e27
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-at-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-at.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-at.png
new file mode 100644
index 00000000..be38570c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-at.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-barcode-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-barcode-outline.png
new file mode 100644
index 00000000..95c6c04e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-barcode-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-barcode.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-barcode.png
new file mode 100644
index 00000000..5c7d72f0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-barcode.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-baseball-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-baseball-outline.png
new file mode 100644
index 00000000..6bc6a21d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-baseball-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-baseball.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-baseball.png
new file mode 100644
index 00000000..b83d5366
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-baseball.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-basketball-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-basketball-outline.png
new file mode 100644
index 00000000..a1999bc5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-basketball-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-basketball.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-basketball.png
new file mode 100644
index 00000000..3c8af3d0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-basketball.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bell-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bell-outline.png
new file mode 100644
index 00000000..f84935b9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bell-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bell.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bell.png
new file mode 100644
index 00000000..d96c352c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bell.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bolt-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bolt-outline.png
new file mode 100644
index 00000000..bdf98cfd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bolt-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bolt.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bolt.png
new file mode 100644
index 00000000..723a27d7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bolt.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bookmarks-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bookmarks-outline.png
new file mode 100644
index 00000000..d9701947
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bookmarks-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bookmarks.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bookmarks.png
new file mode 100644
index 00000000..a53199af
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bookmarks.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-box-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-box-outline.png
new file mode 100644
index 00000000..b45b8e91
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-box-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-box.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-box.png
new file mode 100644
index 00000000..5e2ed571
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-box.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-briefcase-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-briefcase-outline.png
new file mode 100644
index 00000000..f224f4ad
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-briefcase-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-briefcase.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-briefcase.png
new file mode 100644
index 00000000..b6e581d2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-briefcase.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-browsers-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-browsers-outline.png
new file mode 100644
index 00000000..9c0e68be
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-browsers-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-browsers.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-browsers.png
new file mode 100644
index 00000000..4c527101
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-browsers.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calculator-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calculator-outline.png
new file mode 100644
index 00000000..0492f78e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calculator-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calculator.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calculator.png
new file mode 100644
index 00000000..ee55f2f0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calculator.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calendar-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calendar-outline.png
new file mode 100644
index 00000000..593bfe44
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calendar-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calendar.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calendar.png
new file mode 100644
index 00000000..bbc6f864
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calendar.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-camera-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-camera-outline.png
new file mode 100644
index 00000000..f835f6e6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-camera-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-camera.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-camera.png
new file mode 100644
index 00000000..59bdf3da
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-camera.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cart-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cart-outline.png
new file mode 100644
index 00000000..24f9d675
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cart-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cart.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cart.png
new file mode 100644
index 00000000..2e7cec12
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cart.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatboxes-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatboxes-outline.png
new file mode 100644
index 00000000..5fca4b96
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatboxes-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatboxes.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatboxes.png
new file mode 100644
index 00000000..d87b7efb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatboxes.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatbubble-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatbubble-outline.png
new file mode 100644
index 00000000..447f9cda
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatbubble-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatbubble.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatbubble.png
new file mode 100644
index 00000000..33f3b2d3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatbubble.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark-empty.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark-empty.png
new file mode 100644
index 00000000..f3d5c0c0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark-empty.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark-outline.png
new file mode 100644
index 00000000..1601cfec
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark.png
new file mode 100644
index 00000000..23e7de37
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-circle-filled.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-circle-filled.png
new file mode 100644
index 00000000..ce8b1033
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-circle-filled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-circle-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-circle-outline.png
new file mode 100644
index 00000000..c2fcf18d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-circle-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-clock-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-clock-outline.png
new file mode 100644
index 00000000..61892f08
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-clock-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-clock.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-clock.png
new file mode 100644
index 00000000..fc174560
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-clock.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close-empty.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close-empty.png
new file mode 100644
index 00000000..e64d614e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close-empty.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close-outline.png
new file mode 100644
index 00000000..de8b8467
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close.png
new file mode 100644
index 00000000..6465d425
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-download-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-download-outline.png
new file mode 100644
index 00000000..02274e23
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-download-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-download.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-download.png
new file mode 100644
index 00000000..df81fd78
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-download.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-outline.png
new file mode 100644
index 00000000..a2649227
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-upload-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-upload-outline.png
new file mode 100644
index 00000000..905eb55f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-upload-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-upload.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-upload.png
new file mode 100644
index 00000000..c3c80715
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-upload.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud.png
new file mode 100644
index 00000000..318bc14a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-night-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-night-outline.png
new file mode 100644
index 00000000..c2612d70
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-night-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-night.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-night.png
new file mode 100644
index 00000000..05b03d65
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-night.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-outline.png
new file mode 100644
index 00000000..3a003181
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy.png
new file mode 100644
index 00000000..746c333c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cog-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cog-outline.png
new file mode 100644
index 00000000..a137d1eb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cog-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cog.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cog.png
new file mode 100644
index 00000000..30697710
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cog.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-compose-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-compose-outline.png
new file mode 100644
index 00000000..004ec82b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-compose-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-compose.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-compose.png
new file mode 100644
index 00000000..7b1072ab
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-compose.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-contact-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-contact-outline.png
new file mode 100644
index 00000000..ec8ce437
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-contact-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-contact.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-contact.png
new file mode 100644
index 00000000..5b4f6db8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-contact.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-copy-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-copy-outline.png
new file mode 100644
index 00000000..90221899
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-copy-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-copy.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-copy.png
new file mode 100644
index 00000000..842aa205
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-copy.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-download-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-download-outline.png
new file mode 100644
index 00000000..7fbbaf5a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-download-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-download.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-download.png
new file mode 100644
index 00000000..40a5a698
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-download.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-drag.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-drag.png
new file mode 100644
index 00000000..d71784be
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-drag.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-email-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-email-outline.png
new file mode 100644
index 00000000..0d4838e2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-email-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-email.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-email.png
new file mode 100644
index 00000000..5e92b0f2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-email.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-expand.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-expand.png
new file mode 100644
index 00000000..d52bb235
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-expand.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-eye-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-eye-outline.png
new file mode 100644
index 00000000..2c9dfc14
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-eye-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-eye.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-eye.png
new file mode 100644
index 00000000..1c111914
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-eye.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-fastforward-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-fastforward-outline.png
new file mode 100644
index 00000000..fc06c60b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-fastforward-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-fastforward.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-fastforward.png
new file mode 100644
index 00000000..ce34f232
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-fastforward.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-filing-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-filing-outline.png
new file mode 100644
index 00000000..6c84c246
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-filing-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-filing.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-filing.png
new file mode 100644
index 00000000..d01cfc0b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-filing.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-film-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-film-outline.png
new file mode 100644
index 00000000..750fe600
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-film-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-film.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-film.png
new file mode 100644
index 00000000..4c28280a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-film.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-flag-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-flag-outline.png
new file mode 100644
index 00000000..39c2ebeb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-flag-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-flag.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-flag.png
new file mode 100644
index 00000000..eef93be9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-flag.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-folder-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-folder-outline.png
new file mode 100644
index 00000000..46746af2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-folder-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-folder.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-folder.png
new file mode 100644
index 00000000..a2d93665
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-folder.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-football-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-football-outline.png
new file mode 100644
index 00000000..426f6d3a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-football-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-football.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-football.png
new file mode 100644
index 00000000..e424b7f9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-football.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-gear-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-gear-outline.png
new file mode 100644
index 00000000..5c82237a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-gear-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-gear.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-gear.png
new file mode 100644
index 00000000..784a0e32
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-gear.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-glasses-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-glasses-outline.png
new file mode 100644
index 00000000..1f2cfa79
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-glasses-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-glasses.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-glasses.png
new file mode 100644
index 00000000..f0b3074b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-glasses.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-heart-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-heart-outline.png
new file mode 100644
index 00000000..c3a25335
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-heart-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-heart.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-heart.png
new file mode 100644
index 00000000..b3dbf4e4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-heart.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help-empty.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help-empty.png
new file mode 100644
index 00000000..5690a69d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help-empty.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help-outline.png
new file mode 100644
index 00000000..432abf85
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help.png
new file mode 100644
index 00000000..b5d9a448
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-home-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-home-outline.png
new file mode 100644
index 00000000..56b27f95
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-home-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-home.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-home.png
new file mode 100644
index 00000000..8061aa82
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-home.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-infinite-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-infinite-outline.png
new file mode 100644
index 00000000..8c251df0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-infinite-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-infinite.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-infinite.png
new file mode 100644
index 00000000..bd2eec56
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-infinite.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information-empty.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information-empty.png
new file mode 100644
index 00000000..70af5a5a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information-empty.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information-outline.png
new file mode 100644
index 00000000..a1cb7267
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information.png
new file mode 100644
index 00000000..43f3e2d7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-ionic-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-ionic-outline.png
new file mode 100644
index 00000000..cea7341f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-ionic-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-keypad-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-keypad-outline.png
new file mode 100644
index 00000000..4bc381ca
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-keypad-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-keypad.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-keypad.png
new file mode 100644
index 00000000..af76a7b3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-keypad.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-lightbulb-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-lightbulb-outline.png
new file mode 100644
index 00000000..e7a13c8f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-lightbulb-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-lightbulb.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-lightbulb.png
new file mode 100644
index 00000000..3a3e8bf3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-lightbulb.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-location-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-location-outline.png
new file mode 100644
index 00000000..727ff055
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-location-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-location.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-location.png
new file mode 100644
index 00000000..01260396
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-location.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-locked-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-locked-outline.png
new file mode 100644
index 00000000..e688f73c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-locked-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-locked.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-locked.png
new file mode 100644
index 00000000..ebeb2cc3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-locked.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-loop-strong.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-loop-strong.png
new file mode 100644
index 00000000..0fa94175
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-loop-strong.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-loop.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-loop.png
new file mode 100644
index 00000000..416c23df
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-loop.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-medkit-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-medkit-outline.png
new file mode 100644
index 00000000..255d84b8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-medkit-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-medkit.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-medkit.png
new file mode 100644
index 00000000..56b038e3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-medkit.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic-off.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic-off.png
new file mode 100644
index 00000000..07685a65
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic-off.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic-outline.png
new file mode 100644
index 00000000..c2520030
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic.png
new file mode 100644
index 00000000..78708232
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus-empty.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus-empty.png
new file mode 100644
index 00000000..74f32838
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus-empty.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus-outline.png
new file mode 100644
index 00000000..d6a2d87f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus.png
new file mode 100644
index 00000000..a5f67182
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-monitor-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-monitor-outline.png
new file mode 100644
index 00000000..4762d1d2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-monitor-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-monitor.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-monitor.png
new file mode 100644
index 00000000..0e2f28e6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-monitor.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-moon-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-moon-outline.png
new file mode 100644
index 00000000..0bbd6d62
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-moon-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-moon.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-moon.png
new file mode 100644
index 00000000..5e1e1b04
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-moon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-more-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-more-outline.png
new file mode 100644
index 00000000..8d3c9bf7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-more-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-more.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-more.png
new file mode 100644
index 00000000..d681b001
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-more.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-musical-note.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-musical-note.png
new file mode 100644
index 00000000..24186f23
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-musical-note.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-musical-notes.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-musical-notes.png
new file mode 100644
index 00000000..51470ab8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-musical-notes.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-navigate-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-navigate-outline.png
new file mode 100644
index 00000000..f3b40b1c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-navigate-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-navigate.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-navigate.png
new file mode 100644
index 00000000..8df442a4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-navigate.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paper-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paper-outline.png
new file mode 100644
index 00000000..6e08ebed
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paper-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paper.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paper.png
new file mode 100644
index 00000000..a5c0762c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paper.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paperplane-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paperplane-outline.png
new file mode 100644
index 00000000..b4c73c1a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paperplane-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paperplane.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paperplane.png
new file mode 100644
index 00000000..6b1b858f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paperplane.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-partlysunny-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-partlysunny-outline.png
new file mode 100644
index 00000000..2efcc2cd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-partlysunny-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-partlysunny.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-partlysunny.png
new file mode 100644
index 00000000..13a269ad
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-partlysunny.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pause-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pause-outline.png
new file mode 100644
index 00000000..e20b3abe
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pause-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pause.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pause.png
new file mode 100644
index 00000000..317a9854
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pause.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paw-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paw-outline.png
new file mode 100644
index 00000000..f5736efe
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paw-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paw.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paw.png
new file mode 100644
index 00000000..bfd64fe6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paw.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-people-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-people-outline.png
new file mode 100644
index 00000000..58178653
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-people-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-people.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-people.png
new file mode 100644
index 00000000..053e7705
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-people.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-person-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-person-outline.png
new file mode 100644
index 00000000..a9c4a0ac
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-person-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-person.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-person.png
new file mode 100644
index 00000000..baa6cf6b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-person.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-personadd-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-personadd-outline.png
new file mode 100644
index 00000000..679b6e47
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-personadd-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-personadd.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-personadd.png
new file mode 100644
index 00000000..354e6355
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-personadd.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-photos-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-photos-outline.png
new file mode 100644
index 00000000..a6a872ed
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-photos-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-photos.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-photos.png
new file mode 100644
index 00000000..1eb0f7ed
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-photos.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pie-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pie-outline.png
new file mode 100644
index 00000000..8470a2f9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pie-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pie.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pie.png
new file mode 100644
index 00000000..f7ab6890
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pie.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-play-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-play-outline.png
new file mode 100644
index 00000000..a484b4e4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-play-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-play.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-play.png
new file mode 100644
index 00000000..b6110aab
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-play.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus-empty.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus-empty.png
new file mode 100644
index 00000000..92f40304
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus-empty.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus-outline.png
new file mode 100644
index 00000000..d6c97ce5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus.png
new file mode 100644
index 00000000..2eaa563c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetag-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetag-outline.png
new file mode 100644
index 00000000..5184cc79
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetag-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetag.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetag.png
new file mode 100644
index 00000000..dbcbc688
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetag.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetags-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetags-outline.png
new file mode 100644
index 00000000..380d9682
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetags-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetags.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetags.png
new file mode 100644
index 00000000..0942729b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetags.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-printer-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-printer-outline.png
new file mode 100644
index 00000000..c759d046
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-printer-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-printer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-printer.png
new file mode 100644
index 00000000..79847d9d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-printer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pulse-strong.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pulse-strong.png
new file mode 100644
index 00000000..350b165d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pulse-strong.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pulse.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pulse.png
new file mode 100644
index 00000000..c5ffc503
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pulse.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rainy-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rainy-outline.png
new file mode 100644
index 00000000..7dc31109
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rainy-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rainy.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rainy.png
new file mode 100644
index 00000000..cf0e12e7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rainy.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-recording-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-recording-outline.png
new file mode 100644
index 00000000..4b647f55
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-recording-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-recording.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-recording.png
new file mode 100644
index 00000000..dfe84b18
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-recording.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-redo-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-redo-outline.png
new file mode 100644
index 00000000..235373ee
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-redo-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-redo.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-redo.png
new file mode 100644
index 00000000..c003ff3d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-redo.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh-empty.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh-empty.png
new file mode 100644
index 00000000..93df8b16
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh-empty.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh-outline.png
new file mode 100644
index 00000000..f815ba7d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh.png
new file mode 100644
index 00000000..3e98749a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reload.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reload.png
new file mode 100644
index 00000000..a109314b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reload.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reverse-camera-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reverse-camera-outline.png
new file mode 100644
index 00000000..f801e3a2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reverse-camera-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reverse-camera.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reverse-camera.png
new file mode 100644
index 00000000..b222f5c9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reverse-camera.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rewind-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rewind-outline.png
new file mode 100644
index 00000000..cf4181dd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rewind-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rewind.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rewind.png
new file mode 100644
index 00000000..05cd9463
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rewind.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-search-strong.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-search-strong.png
new file mode 100644
index 00000000..d59cc8f8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-search-strong.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-search.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-search.png
new file mode 100644
index 00000000..3b97bca8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-search.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-settings-strong.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-settings-strong.png
new file mode 100644
index 00000000..4f3e9487
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-settings-strong.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-settings.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-settings.png
new file mode 100644
index 00000000..588e3492
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-settings.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-shrink.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-shrink.png
new file mode 100644
index 00000000..8ccd4d3f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-shrink.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipbackward-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipbackward-outline.png
new file mode 100644
index 00000000..7597d711
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipbackward-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipbackward.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipbackward.png
new file mode 100644
index 00000000..0deff517
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipbackward.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipforward-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipforward-outline.png
new file mode 100644
index 00000000..96e1aef8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipforward-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipforward.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipforward.png
new file mode 100644
index 00000000..95c308a6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipforward.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-snowy.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-snowy.png
new file mode 100644
index 00000000..311b8bd2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-snowy.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-speedometer-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-speedometer-outline.png
new file mode 100644
index 00000000..a7120de6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-speedometer-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-speedometer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-speedometer.png
new file mode 100644
index 00000000..bc5a2a20
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-speedometer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star-half.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star-half.png
new file mode 100644
index 00000000..346cc8fa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star-half.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star-outline.png
new file mode 100644
index 00000000..6d9cd2a0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star.png
new file mode 100644
index 00000000..4a28feed
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-stopwatch-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-stopwatch-outline.png
new file mode 100644
index 00000000..8660b246
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-stopwatch-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-stopwatch.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-stopwatch.png
new file mode 100644
index 00000000..0bd2f224
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-stopwatch.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-sunny-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-sunny-outline.png
new file mode 100644
index 00000000..8c1943df
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-sunny-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-sunny.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-sunny.png
new file mode 100644
index 00000000..95f8ba63
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-sunny.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-telephone-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-telephone-outline.png
new file mode 100644
index 00000000..d3a1d989
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-telephone-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-telephone.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-telephone.png
new file mode 100644
index 00000000..983f2c28
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-telephone.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-tennisball-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-tennisball-outline.png
new file mode 100644
index 00000000..de9c07a4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-tennisball-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-tennisball.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-tennisball.png
new file mode 100644
index 00000000..42906a47
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-tennisball.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-thunderstorm-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-thunderstorm-outline.png
new file mode 100644
index 00000000..2a8d9db6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-thunderstorm-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-thunderstorm.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-thunderstorm.png
new file mode 100644
index 00000000..315acf05
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-thunderstorm.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-time-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-time-outline.png
new file mode 100644
index 00000000..6234a758
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-time-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-time.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-time.png
new file mode 100644
index 00000000..1dc05273
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-time.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-timer-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-timer-outline.png
new file mode 100644
index 00000000..64be9827
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-timer-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-timer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-timer.png
new file mode 100644
index 00000000..e916b521
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-timer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-toggle-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-toggle-outline.png
new file mode 100644
index 00000000..1202cfe7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-toggle-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-toggle.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-toggle.png
new file mode 100644
index 00000000..a7b91c83
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-toggle.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-trash-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-trash-outline.png
new file mode 100644
index 00000000..ce2dc7a4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-trash-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-trash.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-trash.png
new file mode 100644
index 00000000..58c4346f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-trash.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-undo-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-undo-outline.png
new file mode 100644
index 00000000..db79f3d7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-undo-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-undo.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-undo.png
new file mode 100644
index 00000000..efaf7c0d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-undo.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-unlocked-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-unlocked-outline.png
new file mode 100644
index 00000000..e66c3861
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-unlocked-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-unlocked.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-unlocked.png
new file mode 100644
index 00000000..fb97492f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-unlocked.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-upload-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-upload-outline.png
new file mode 100644
index 00000000..09cc277d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-upload-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-upload.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-upload.png
new file mode 100644
index 00000000..b37773fc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-upload.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-videocam-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-videocam-outline.png
new file mode 100644
index 00000000..0bf6d154
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-videocam-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-videocam.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-videocam.png
new file mode 100644
index 00000000..680a8df4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-videocam.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-volume-high.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-volume-high.png
new file mode 100644
index 00000000..0568110c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-volume-high.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-volume-low.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-volume-low.png
new file mode 100644
index 00000000..34a294e6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-volume-low.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-wineglass-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-wineglass-outline.png
new file mode 100644
index 00000000..22b9fc51
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-wineglass-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-wineglass.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-wineglass.png
new file mode 100644
index 00000000..4dbd6202
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-wineglass.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-world-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-world-outline.png
new file mode 100644
index 00000000..d14a6505
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-world-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-world.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-world.png
new file mode 100644
index 00000000..4491e61f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-world.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ipad.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ipad.png
new file mode 100644
index 00000000..85e09151
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ipad.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/iphone.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/iphone.png
new file mode 100644
index 00000000..7f538baa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/iphone.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ipod.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ipod.png
new file mode 100644
index 00000000..cf3c3aeb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ipod.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/jet.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/jet.png
new file mode 100644
index 00000000..166e1951
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/jet.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/key.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/key.png
new file mode 100644
index 00000000..3ae67379
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/key.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/knife.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/knife.png
new file mode 100644
index 00000000..9f13a0ff
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/knife.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/laptop.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/laptop.png
new file mode 100644
index 00000000..a8ec9630
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/laptop.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/leaf.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/leaf.png
new file mode 100644
index 00000000..3bf3801c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/leaf.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/levels.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/levels.png
new file mode 100644
index 00000000..79d4b3e2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/levels.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/lightbulb.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/lightbulb.png
new file mode 100644
index 00000000..d103bfe6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/lightbulb.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/link.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/link.png
new file mode 100644
index 00000000..34459387
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/link.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-a.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-a.png
new file mode 100644
index 00000000..f5cda196
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-a.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-b.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-b.png
new file mode 100644
index 00000000..7931879c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-b.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-c.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-c.png
new file mode 100644
index 00000000..39a59963
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-c.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-d.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-d.png
new file mode 100644
index 00000000..8d96f0de
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-d.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/location.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/location.png
new file mode 100644
index 00000000..5acf20aa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/location.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/locked.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/locked.png
new file mode 100644
index 00000000..e78f8158
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/locked.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/log-in.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/log-in.png
new file mode 100644
index 00000000..592e30cb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/log-in.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/log-out.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/log-out.png
new file mode 100644
index 00000000..1d41c22e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/log-out.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/loop.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/loop.png
new file mode 100644
index 00000000..d30a7a9f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/loop.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/magnet.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/magnet.png
new file mode 100644
index 00000000..8925becd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/magnet.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/male.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/male.png
new file mode 100644
index 00000000..ea0eab33
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/male.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/man.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/man.png
new file mode 100644
index 00000000..f0b46451
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/man.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/map.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/map.png
new file mode 100644
index 00000000..2aff1761
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/map.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/medkit.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/medkit.png
new file mode 100644
index 00000000..b03b2efa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/medkit.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/merge.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/merge.png
new file mode 100644
index 00000000..318a59fc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/merge.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-a.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-a.png
new file mode 100644
index 00000000..1034de7b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-a.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-b.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-b.png
new file mode 100644
index 00000000..ea04074e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-b.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-c.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-c.png
new file mode 100644
index 00000000..c545bfd4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-c.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus-circled.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus-circled.png
new file mode 100644
index 00000000..fd9e8400
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus-circled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus-round.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus-round.png
new file mode 100644
index 00000000..88e67810
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus-round.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus.png
new file mode 100644
index 00000000..67337156
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/model-s.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/model-s.png
new file mode 100644
index 00000000..ed021952
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/model-s.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/monitor.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/monitor.png
new file mode 100644
index 00000000..6a77e997
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/monitor.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/more.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/more.png
new file mode 100644
index 00000000..dd48f034
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/more.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mouse.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mouse.png
new file mode 100644
index 00000000..55e7a47d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mouse.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/music-note.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/music-note.png
new file mode 100644
index 00000000..d65191a0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/music-note.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navicon-round.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navicon-round.png
new file mode 100644
index 00000000..82c3d404
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navicon-round.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navicon.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navicon.png
new file mode 100644
index 00000000..2696c4dd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navicon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navigate.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navigate.png
new file mode 100644
index 00000000..8a3b385a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navigate.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/network.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/network.png
new file mode 100644
index 00000000..7cbc5cdd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/network.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/no-smoking.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/no-smoking.png
new file mode 100644
index 00000000..d13e35ec
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/no-smoking.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/nuclear.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/nuclear.png
new file mode 100644
index 00000000..a2a1783e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/nuclear.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/outlet.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/outlet.png
new file mode 100644
index 00000000..b3fc9057
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/outlet.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/paper-airplane.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/paper-airplane.png
new file mode 100644
index 00000000..76fa2e90
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/paper-airplane.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/paperclip.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/paperclip.png
new file mode 100644
index 00000000..f11b9095
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/paperclip.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pause.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pause.png
new file mode 100644
index 00000000..ab8f58ac
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pause.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person-add.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person-add.png
new file mode 100644
index 00000000..07c07f1d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person-add.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person-stalker.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person-stalker.png
new file mode 100644
index 00000000..c097f820
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person-stalker.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person.png
new file mode 100644
index 00000000..2f01007a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pie-graph.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pie-graph.png
new file mode 100644
index 00000000..37d84198
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pie-graph.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pin.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pin.png
new file mode 100644
index 00000000..22c05077
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pin.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pinpoint.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pinpoint.png
new file mode 100644
index 00000000..b2420fcf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pinpoint.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pizza.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pizza.png
new file mode 100644
index 00000000..41e9966f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pizza.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plane.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plane.png
new file mode 100644
index 00000000..2c12610a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plane.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/planet.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/planet.png
new file mode 100644
index 00000000..90374532
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/planet.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/play.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/play.png
new file mode 100644
index 00000000..5da06aa0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/play.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/playstation.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/playstation.png
new file mode 100644
index 00000000..70e00042
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/playstation.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus-circled.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus-circled.png
new file mode 100644
index 00000000..203c3a97
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus-circled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus-round.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus-round.png
new file mode 100644
index 00000000..8dee00d4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus-round.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus.png
new file mode 100644
index 00000000..a76887a0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/podium.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/podium.png
new file mode 100644
index 00000000..b34511be
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/podium.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pound.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pound.png
new file mode 100644
index 00000000..6d729a10
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pound.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/power.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/power.png
new file mode 100644
index 00000000..f90d4234
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/power.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pricetag.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pricetag.png
new file mode 100644
index 00000000..05946eb5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pricetag.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pricetags.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pricetags.png
new file mode 100644
index 00000000..b3cca2df
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pricetags.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/printer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/printer.png
new file mode 100644
index 00000000..96264b7d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/printer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pull-request.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pull-request.png
new file mode 100644
index 00000000..f1e00b47
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pull-request.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/qr-scanner.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/qr-scanner.png
new file mode 100644
index 00000000..65eada55
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/qr-scanner.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/quote.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/quote.png
new file mode 100644
index 00000000..ba43394f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/quote.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/radio-waves.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/radio-waves.png
new file mode 100644
index 00000000..1695cf04
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/radio-waves.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/record.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/record.png
new file mode 100644
index 00000000..06d6b508
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/record.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/refresh.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/refresh.png
new file mode 100644
index 00000000..35515efa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/refresh.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/reply-all.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/reply-all.png
new file mode 100644
index 00000000..68a1f070
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/reply-all.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/reply.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/reply.png
new file mode 100644
index 00000000..a6bd5aa1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/reply.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ribbon-a.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ribbon-a.png
new file mode 100644
index 00000000..16243e00
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ribbon-a.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ribbon-b.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ribbon-b.png
new file mode 100644
index 00000000..d92ceac4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ribbon-b.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/sad.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/sad.png
new file mode 100644
index 00000000..f15f6d0a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/sad.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/scissors.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/scissors.png
new file mode 100644
index 00000000..0dfeef2b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/scissors.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/search.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/search.png
new file mode 100644
index 00000000..4ec105d4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/search.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/settings.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/settings.png
new file mode 100644
index 00000000..88ad0b13
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/settings.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/share.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/share.png
new file mode 100644
index 00000000..35f9b3f2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/share.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/shuffle.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/shuffle.png
new file mode 100644
index 00000000..d03aadff
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/shuffle.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/skip-backward.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/skip-backward.png
new file mode 100644
index 00000000..4b9b2bd6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/skip-backward.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/skip-forward.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/skip-forward.png
new file mode 100644
index 00000000..771fae7c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/skip-forward.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-android-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-android-outline.png
new file mode 100644
index 00000000..d5abc210
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-android-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-android.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-android.png
new file mode 100644
index 00000000..d7b7c425
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-android.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-apple-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-apple-outline.png
new file mode 100644
index 00000000..e6232292
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-apple-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-apple.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-apple.png
new file mode 100644
index 00000000..074e4e7a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-apple.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-bitcoin-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-bitcoin-outline.png
new file mode 100644
index 00000000..7e429cce
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-bitcoin-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-bitcoin.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-bitcoin.png
new file mode 100644
index 00000000..d4311986
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-bitcoin.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-buffer-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-buffer-outline.png
new file mode 100644
index 00000000..a83d91a3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-buffer-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-buffer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-buffer.png
new file mode 100644
index 00000000..ec962e66
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-buffer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-designernews-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-designernews-outline.png
new file mode 100644
index 00000000..87799f54
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-designernews-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-designernews.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-designernews.png
new file mode 100644
index 00000000..8a036dd1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-designernews.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dribbble-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dribbble-outline.png
new file mode 100644
index 00000000..f8c0ba5b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dribbble-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dribbble.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dribbble.png
new file mode 100644
index 00000000..f5d30bb2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dribbble.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dropbox-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dropbox-outline.png
new file mode 100644
index 00000000..f92b0569
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dropbox-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dropbox.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dropbox.png
new file mode 100644
index 00000000..5507c5c4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dropbox.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-facebook-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-facebook-outline.png
new file mode 100644
index 00000000..293001aa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-facebook-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-facebook.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-facebook.png
new file mode 100644
index 00000000..6c41f80c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-facebook.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-foursquare-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-foursquare-outline.png
new file mode 100644
index 00000000..28766334
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-foursquare-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-foursquare.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-foursquare.png
new file mode 100644
index 00000000..0e671c69
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-foursquare.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-freebsd-devil.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-freebsd-devil.png
new file mode 100644
index 00000000..27008652
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-freebsd-devil.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-github-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-github-outline.png
new file mode 100644
index 00000000..915f3bf0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-github-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-github.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-github.png
new file mode 100644
index 00000000..87b4c754
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-github.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-google-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-google-outline.png
new file mode 100644
index 00000000..08d50ba1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-google-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-google.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-google.png
new file mode 100644
index 00000000..b788fb9a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-google.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-googleplus-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-googleplus-outline.png
new file mode 100644
index 00000000..9eeb43ff
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-googleplus-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-googleplus.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-googleplus.png
new file mode 100644
index 00000000..e79ca447
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-googleplus.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-hackernews-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-hackernews-outline.png
new file mode 100644
index 00000000..06f43197
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-hackernews-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-hackernews.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-hackernews.png
new file mode 100644
index 00000000..52902fe3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-hackernews.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-instagram-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-instagram-outline.png
new file mode 100644
index 00000000..bf75435b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-instagram-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-instagram.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-instagram.png
new file mode 100644
index 00000000..76e1ab87
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-instagram.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-linkedin-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-linkedin-outline.png
new file mode 100644
index 00000000..88d8169b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-linkedin-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-linkedin.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-linkedin.png
new file mode 100644
index 00000000..8e2eedf0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-linkedin.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-pinterest-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-pinterest-outline.png
new file mode 100644
index 00000000..75321dcf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-pinterest-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-pinterest.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-pinterest.png
new file mode 100644
index 00000000..6bb578d5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-pinterest.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-reddit-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-reddit-outline.png
new file mode 100644
index 00000000..1ffca7bb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-reddit-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-reddit.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-reddit.png
new file mode 100644
index 00000000..2c96b336
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-reddit.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-rss-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-rss-outline.png
new file mode 100644
index 00000000..11c22757
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-rss-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-rss.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-rss.png
new file mode 100644
index 00000000..55fdf00f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-rss.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-skype-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-skype-outline.png
new file mode 100644
index 00000000..bc605c82
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-skype-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-skype.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-skype.png
new file mode 100644
index 00000000..60eb1a83
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-skype.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tumblr-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tumblr-outline.png
new file mode 100644
index 00000000..1b3f4c03
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tumblr-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tumblr.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tumblr.png
new file mode 100644
index 00000000..79e3a2a9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tumblr.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tux.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tux.png
new file mode 100644
index 00000000..615e0ce9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tux.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-twitter-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-twitter-outline.png
new file mode 100644
index 00000000..d279ae03
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-twitter-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-twitter.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-twitter.png
new file mode 100644
index 00000000..a96d561e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-twitter.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-usd-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-usd-outline.png
new file mode 100644
index 00000000..ca5241d6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-usd-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-usd.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-usd.png
new file mode 100644
index 00000000..740f5bef
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-usd.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-vimeo-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-vimeo-outline.png
new file mode 100644
index 00000000..50a61d16
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-vimeo-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-vimeo.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-vimeo.png
new file mode 100644
index 00000000..ce7fbefa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-vimeo.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-windows-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-windows-outline.png
new file mode 100644
index 00000000..e0e98e4d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-windows-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-windows.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-windows.png
new file mode 100644
index 00000000..3b033a93
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-windows.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-wordpress-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-wordpress-outline.png
new file mode 100644
index 00000000..76e9939e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-wordpress-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-wordpress.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-wordpress.png
new file mode 100644
index 00000000..f1663108
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-wordpress.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-yahoo-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-yahoo-outline.png
new file mode 100644
index 00000000..defd58d8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-yahoo-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-yahoo.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-yahoo.png
new file mode 100644
index 00000000..ea210fe8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-yahoo.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-youtube-outline.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-youtube-outline.png
new file mode 100644
index 00000000..7708d48b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-youtube-outline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-youtube.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-youtube.png
new file mode 100644
index 00000000..b025720c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-youtube.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/speakerphone.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/speakerphone.png
new file mode 100644
index 00000000..7766a2b7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/speakerphone.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/speedometer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/speedometer.png
new file mode 100644
index 00000000..29625aff
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/speedometer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/spoon.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/spoon.png
new file mode 100644
index 00000000..98178e08
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/spoon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/star.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/star.png
new file mode 100644
index 00000000..7d877199
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/star.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/stats-bars.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/stats-bars.png
new file mode 100644
index 00000000..0a4134d2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/stats-bars.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/steam.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/steam.png
new file mode 100644
index 00000000..8ffa6843
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/steam.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/stop.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/stop.png
new file mode 100644
index 00000000..dd58b88a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/stop.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thermometer.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thermometer.png
new file mode 100644
index 00000000..9ba62b09
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thermometer.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thumbsdown.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thumbsdown.png
new file mode 100644
index 00000000..8e8cc85f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thumbsdown.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thumbsup.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thumbsup.png
new file mode 100644
index 00000000..da425557
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thumbsup.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/toggle-filled.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/toggle-filled.png
new file mode 100644
index 00000000..caff1e93
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/toggle-filled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/toggle.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/toggle.png
new file mode 100644
index 00000000..f8350b08
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/toggle.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trash-a.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trash-a.png
new file mode 100644
index 00000000..f9660b6f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trash-a.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trash-b.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trash-b.png
new file mode 100644
index 00000000..7a81ffe4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trash-b.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trophy.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trophy.png
new file mode 100644
index 00000000..f6406f8e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trophy.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/umbrella.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/umbrella.png
new file mode 100644
index 00000000..6b1c5b4c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/umbrella.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/university.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/university.png
new file mode 100644
index 00000000..6e74e340
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/university.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/unlocked.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/unlocked.png
new file mode 100644
index 00000000..83c0d487
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/unlocked.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/upload.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/upload.png
new file mode 100644
index 00000000..0519cbf9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/upload.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/usb.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/usb.png
new file mode 100644
index 00000000..87857b46
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/usb.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/videocamera.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/videocamera.png
new file mode 100644
index 00000000..9f5c333f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/videocamera.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-high.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-high.png
new file mode 100644
index 00000000..3a2da41a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-high.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-low.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-low.png
new file mode 100644
index 00000000..0faf9d3b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-low.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-medium.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-medium.png
new file mode 100644
index 00000000..b4e0d44d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-medium.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-mute.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-mute.png
new file mode 100644
index 00000000..722f7372
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-mute.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wand.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wand.png
new file mode 100644
index 00000000..0dbe13cf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wand.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/waterdrop.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/waterdrop.png
new file mode 100644
index 00000000..deaf4075
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/waterdrop.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wifi.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wifi.png
new file mode 100644
index 00000000..19bedd87
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wifi.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wineglass.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wineglass.png
new file mode 100644
index 00000000..881b6673
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wineglass.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/woman.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/woman.png
new file mode 100644
index 00000000..0cab2b5d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/woman.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wrench.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wrench.png
new file mode 100644
index 00000000..3071cc58
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wrench.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/xbox.png b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/xbox.png
new file mode 100644
index 00000000..22d1f851
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/xbox.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/readme.md b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/readme.md
new file mode 100644
index 00000000..f530251c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/readme.md
@@ -0,0 +1,60 @@
+# Ionicons
+
+
+The premium icon font for [Ionic](http://ionicframework.com/). Designed by [@benjsperry](https://twitter.com/benjsperry).
+
+Note: All brand icons are trademarks of their respective owners. The use of these trademarks does not indicate endorsement of the trademark holder by Drifty, nor vice versa.
+
+Visit [ionicons.com](http://ionicons.com) and check out the search feature, which has keywords identifying common icon names and styles. For example, if you search for “arrow†we call up every icon that could possibly be used as an arrow. We’ve also included each icon’s class name for easy copy/pasting when you’re developing!
+
+We intend for this icon pack to be used with [Ionic](http://ionicframework.com/), but it’s by no means limited to it. Use them wherever you see fit, personal or commercial. They are free to use and licensed under [MIT](http://opensource.org/licenses/MIT).
+
+
+## Getting Started
+
+ 1. Download and extract the font pack
+ 2. Copy the `ionicons.css` to your project
+ 3. Copy the `fonts` folder to your project
+ 4. Ensure the font urls within `ionicons.css` properly reference the `fonts` path within your project.
+ 5. Include a reference to the `ionicons.css` file from every webpage you need to use it.
+
+Or install with [component](https://github.com/component/component):
+
+ $ component install driftyco/ionicons
+
+Or perhaps you're known to use [bower](http://bower.io/)?
+
+ $ bower install ionicons
+
+
+## HTML Example
+
+You can use [ionicons.com](http://ionicons.com) to easily find the icon you want to use. Once you've copied the desired icon's CSS classname, simply add the `icon` and icon's classname, such as `ion-home` to an HTML element.
+
+ <i class="icon ion-home"></i>
+
+
+## Build Instructions
+
+This repo already comes with all the files built and ready to go, but can also build the fonts from the source. Requires Python, FontForge and Sass:
+
+1) Install FontForge, which is the program that creates the font files from the SVG files:
+
+ $ brew install fontforge ttfautohint
+
+2) Install [Sass](http://sass-lang.com/)
+
+ $ gem install sass
+
+3) Add or subtract files from the `src/` folder you'd like to be apart of the font files.
+
+4) Modify any settings in the `builder/manifest.json` file. You can change the name of the font-family and CSS classname prefix.
+
+5) Run the build command:
+
+ python ./builder/generate.py
+
+
+## License
+
+Ionicons is licensed under the [MIT license](http://opensource.org/licenses/MIT).
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-font.scss b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-font.scss
new file mode 100644
index 00000000..76ec6ebd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-font.scss
@@ -0,0 +1,27 @@
+// Ionicons Font Path
+// --------------------------
+
+@font-face {
+ font-family: $ionicons-font-family;
+ src:url("#{$ionicons-font-path}/ionicons.eot?v=#{$ionicons-version}");
+ src:url("#{$ionicons-font-path}/ionicons.eot?v=#{$ionicons-version}#iefix") format("embedded-opentype"),
+ url("#{$ionicons-font-path}/ionicons.ttf?v=#{$ionicons-version}") format("truetype"),
+ url("#{$ionicons-font-path}/ionicons.woff?v=#{$ionicons-version}") format("woff"),
+ url("#{$ionicons-font-path}/ionicons.svg?v=#{$ionicons-version}#Ionicons") format("svg");
+ font-weight: normal;
+ font-style: normal;
+}
+
+.ion {
+ display: inline-block;
+ font-family: $ionicons-font-family;
+ speak: none;
+ font-style: normal;
+ font-weight: normal;
+ font-variant: normal;
+ text-transform: none;
+ text-rendering: auto;
+ line-height: 1;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-icons.scss b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-icons.scss
new file mode 100644
index 00000000..d08d4f0e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-icons.scss
@@ -0,0 +1,1473 @@
+// Ionicons Icons
+// --------------------------
+
+.ionicons,
+.#{$ionicons-prefix}alert:before,
+.#{$ionicons-prefix}alert-circled:before,
+.#{$ionicons-prefix}android-add:before,
+.#{$ionicons-prefix}android-add-circle:before,
+.#{$ionicons-prefix}android-alarm-clock:before,
+.#{$ionicons-prefix}android-alert:before,
+.#{$ionicons-prefix}android-apps:before,
+.#{$ionicons-prefix}android-archive:before,
+.#{$ionicons-prefix}android-arrow-back:before,
+.#{$ionicons-prefix}android-arrow-down:before,
+.#{$ionicons-prefix}android-arrow-dropdown:before,
+.#{$ionicons-prefix}android-arrow-dropdown-circle:before,
+.#{$ionicons-prefix}android-arrow-dropleft:before,
+.#{$ionicons-prefix}android-arrow-dropleft-circle:before,
+.#{$ionicons-prefix}android-arrow-dropright:before,
+.#{$ionicons-prefix}android-arrow-dropright-circle:before,
+.#{$ionicons-prefix}android-arrow-dropup:before,
+.#{$ionicons-prefix}android-arrow-dropup-circle:before,
+.#{$ionicons-prefix}android-arrow-forward:before,
+.#{$ionicons-prefix}android-arrow-up:before,
+.#{$ionicons-prefix}android-attach:before,
+.#{$ionicons-prefix}android-bar:before,
+.#{$ionicons-prefix}android-bicycle:before,
+.#{$ionicons-prefix}android-boat:before,
+.#{$ionicons-prefix}android-bookmark:before,
+.#{$ionicons-prefix}android-bulb:before,
+.#{$ionicons-prefix}android-bus:before,
+.#{$ionicons-prefix}android-calendar:before,
+.#{$ionicons-prefix}android-call:before,
+.#{$ionicons-prefix}android-camera:before,
+.#{$ionicons-prefix}android-cancel:before,
+.#{$ionicons-prefix}android-car:before,
+.#{$ionicons-prefix}android-cart:before,
+.#{$ionicons-prefix}android-chat:before,
+.#{$ionicons-prefix}android-checkbox:before,
+.#{$ionicons-prefix}android-checkbox-blank:before,
+.#{$ionicons-prefix}android-checkbox-outline:before,
+.#{$ionicons-prefix}android-checkbox-outline-blank:before,
+.#{$ionicons-prefix}android-checkmark-circle:before,
+.#{$ionicons-prefix}android-clipboard:before,
+.#{$ionicons-prefix}android-close:before,
+.#{$ionicons-prefix}android-cloud:before,
+.#{$ionicons-prefix}android-cloud-circle:before,
+.#{$ionicons-prefix}android-cloud-done:before,
+.#{$ionicons-prefix}android-cloud-outline:before,
+.#{$ionicons-prefix}android-color-palette:before,
+.#{$ionicons-prefix}android-compass:before,
+.#{$ionicons-prefix}android-contact:before,
+.#{$ionicons-prefix}android-contacts:before,
+.#{$ionicons-prefix}android-contract:before,
+.#{$ionicons-prefix}android-create:before,
+.#{$ionicons-prefix}android-delete:before,
+.#{$ionicons-prefix}android-desktop:before,
+.#{$ionicons-prefix}android-document:before,
+.#{$ionicons-prefix}android-done:before,
+.#{$ionicons-prefix}android-done-all:before,
+.#{$ionicons-prefix}android-download:before,
+.#{$ionicons-prefix}android-drafts:before,
+.#{$ionicons-prefix}android-exit:before,
+.#{$ionicons-prefix}android-expand:before,
+.#{$ionicons-prefix}android-favorite:before,
+.#{$ionicons-prefix}android-favorite-outline:before,
+.#{$ionicons-prefix}android-film:before,
+.#{$ionicons-prefix}android-folder:before,
+.#{$ionicons-prefix}android-folder-open:before,
+.#{$ionicons-prefix}android-funnel:before,
+.#{$ionicons-prefix}android-globe:before,
+.#{$ionicons-prefix}android-hand:before,
+.#{$ionicons-prefix}android-hangout:before,
+.#{$ionicons-prefix}android-happy:before,
+.#{$ionicons-prefix}android-home:before,
+.#{$ionicons-prefix}android-image:before,
+.#{$ionicons-prefix}android-laptop:before,
+.#{$ionicons-prefix}android-list:before,
+.#{$ionicons-prefix}android-locate:before,
+.#{$ionicons-prefix}android-lock:before,
+.#{$ionicons-prefix}android-mail:before,
+.#{$ionicons-prefix}android-map:before,
+.#{$ionicons-prefix}android-menu:before,
+.#{$ionicons-prefix}android-microphone:before,
+.#{$ionicons-prefix}android-microphone-off:before,
+.#{$ionicons-prefix}android-more-horizontal:before,
+.#{$ionicons-prefix}android-more-vertical:before,
+.#{$ionicons-prefix}android-navigate:before,
+.#{$ionicons-prefix}android-notifications:before,
+.#{$ionicons-prefix}android-notifications-none:before,
+.#{$ionicons-prefix}android-notifications-off:before,
+.#{$ionicons-prefix}android-open:before,
+.#{$ionicons-prefix}android-options:before,
+.#{$ionicons-prefix}android-people:before,
+.#{$ionicons-prefix}android-person:before,
+.#{$ionicons-prefix}android-person-add:before,
+.#{$ionicons-prefix}android-phone-landscape:before,
+.#{$ionicons-prefix}android-phone-portrait:before,
+.#{$ionicons-prefix}android-pin:before,
+.#{$ionicons-prefix}android-plane:before,
+.#{$ionicons-prefix}android-playstore:before,
+.#{$ionicons-prefix}android-print:before,
+.#{$ionicons-prefix}android-radio-button-off:before,
+.#{$ionicons-prefix}android-radio-button-on:before,
+.#{$ionicons-prefix}android-refresh:before,
+.#{$ionicons-prefix}android-remove:before,
+.#{$ionicons-prefix}android-remove-circle:before,
+.#{$ionicons-prefix}android-restaurant:before,
+.#{$ionicons-prefix}android-sad:before,
+.#{$ionicons-prefix}android-search:before,
+.#{$ionicons-prefix}android-send:before,
+.#{$ionicons-prefix}android-settings:before,
+.#{$ionicons-prefix}android-share:before,
+.#{$ionicons-prefix}android-share-alt:before,
+.#{$ionicons-prefix}android-star:before,
+.#{$ionicons-prefix}android-star-half:before,
+.#{$ionicons-prefix}android-star-outline:before,
+.#{$ionicons-prefix}android-stopwatch:before,
+.#{$ionicons-prefix}android-subway:before,
+.#{$ionicons-prefix}android-sunny:before,
+.#{$ionicons-prefix}android-sync:before,
+.#{$ionicons-prefix}android-textsms:before,
+.#{$ionicons-prefix}android-time:before,
+.#{$ionicons-prefix}android-train:before,
+.#{$ionicons-prefix}android-unlock:before,
+.#{$ionicons-prefix}android-upload:before,
+.#{$ionicons-prefix}android-volume-down:before,
+.#{$ionicons-prefix}android-volume-mute:before,
+.#{$ionicons-prefix}android-volume-off:before,
+.#{$ionicons-prefix}android-volume-up:before,
+.#{$ionicons-prefix}android-walk:before,
+.#{$ionicons-prefix}android-warning:before,
+.#{$ionicons-prefix}android-watch:before,
+.#{$ionicons-prefix}android-wifi:before,
+.#{$ionicons-prefix}aperture:before,
+.#{$ionicons-prefix}archive:before,
+.#{$ionicons-prefix}arrow-down-a:before,
+.#{$ionicons-prefix}arrow-down-b:before,
+.#{$ionicons-prefix}arrow-down-c:before,
+.#{$ionicons-prefix}arrow-expand:before,
+.#{$ionicons-prefix}arrow-graph-down-left:before,
+.#{$ionicons-prefix}arrow-graph-down-right:before,
+.#{$ionicons-prefix}arrow-graph-up-left:before,
+.#{$ionicons-prefix}arrow-graph-up-right:before,
+.#{$ionicons-prefix}arrow-left-a:before,
+.#{$ionicons-prefix}arrow-left-b:before,
+.#{$ionicons-prefix}arrow-left-c:before,
+.#{$ionicons-prefix}arrow-move:before,
+.#{$ionicons-prefix}arrow-resize:before,
+.#{$ionicons-prefix}arrow-return-left:before,
+.#{$ionicons-prefix}arrow-return-right:before,
+.#{$ionicons-prefix}arrow-right-a:before,
+.#{$ionicons-prefix}arrow-right-b:before,
+.#{$ionicons-prefix}arrow-right-c:before,
+.#{$ionicons-prefix}arrow-shrink:before,
+.#{$ionicons-prefix}arrow-swap:before,
+.#{$ionicons-prefix}arrow-up-a:before,
+.#{$ionicons-prefix}arrow-up-b:before,
+.#{$ionicons-prefix}arrow-up-c:before,
+.#{$ionicons-prefix}asterisk:before,
+.#{$ionicons-prefix}at:before,
+.#{$ionicons-prefix}backspace:before,
+.#{$ionicons-prefix}backspace-outline:before,
+.#{$ionicons-prefix}bag:before,
+.#{$ionicons-prefix}battery-charging:before,
+.#{$ionicons-prefix}battery-empty:before,
+.#{$ionicons-prefix}battery-full:before,
+.#{$ionicons-prefix}battery-half:before,
+.#{$ionicons-prefix}battery-low:before,
+.#{$ionicons-prefix}beaker:before,
+.#{$ionicons-prefix}beer:before,
+.#{$ionicons-prefix}bluetooth:before,
+.#{$ionicons-prefix}bonfire:before,
+.#{$ionicons-prefix}bookmark:before,
+.#{$ionicons-prefix}bowtie:before,
+.#{$ionicons-prefix}briefcase:before,
+.#{$ionicons-prefix}bug:before,
+.#{$ionicons-prefix}calculator:before,
+.#{$ionicons-prefix}calendar:before,
+.#{$ionicons-prefix}camera:before,
+.#{$ionicons-prefix}card:before,
+.#{$ionicons-prefix}cash:before,
+.#{$ionicons-prefix}chatbox:before,
+.#{$ionicons-prefix}chatbox-working:before,
+.#{$ionicons-prefix}chatboxes:before,
+.#{$ionicons-prefix}chatbubble:before,
+.#{$ionicons-prefix}chatbubble-working:before,
+.#{$ionicons-prefix}chatbubbles:before,
+.#{$ionicons-prefix}checkmark:before,
+.#{$ionicons-prefix}checkmark-circled:before,
+.#{$ionicons-prefix}checkmark-round:before,
+.#{$ionicons-prefix}chevron-down:before,
+.#{$ionicons-prefix}chevron-left:before,
+.#{$ionicons-prefix}chevron-right:before,
+.#{$ionicons-prefix}chevron-up:before,
+.#{$ionicons-prefix}clipboard:before,
+.#{$ionicons-prefix}clock:before,
+.#{$ionicons-prefix}close:before,
+.#{$ionicons-prefix}close-circled:before,
+.#{$ionicons-prefix}close-round:before,
+.#{$ionicons-prefix}closed-captioning:before,
+.#{$ionicons-prefix}cloud:before,
+.#{$ionicons-prefix}code:before,
+.#{$ionicons-prefix}code-download:before,
+.#{$ionicons-prefix}code-working:before,
+.#{$ionicons-prefix}coffee:before,
+.#{$ionicons-prefix}compass:before,
+.#{$ionicons-prefix}compose:before,
+.#{$ionicons-prefix}connection-bars:before,
+.#{$ionicons-prefix}contrast:before,
+.#{$ionicons-prefix}crop:before,
+.#{$ionicons-prefix}cube:before,
+.#{$ionicons-prefix}disc:before,
+.#{$ionicons-prefix}document:before,
+.#{$ionicons-prefix}document-text:before,
+.#{$ionicons-prefix}drag:before,
+.#{$ionicons-prefix}earth:before,
+.#{$ionicons-prefix}easel:before,
+.#{$ionicons-prefix}edit:before,
+.#{$ionicons-prefix}egg:before,
+.#{$ionicons-prefix}eject:before,
+.#{$ionicons-prefix}email:before,
+.#{$ionicons-prefix}email-unread:before,
+.#{$ionicons-prefix}erlenmeyer-flask:before,
+.#{$ionicons-prefix}erlenmeyer-flask-bubbles:before,
+.#{$ionicons-prefix}eye:before,
+.#{$ionicons-prefix}eye-disabled:before,
+.#{$ionicons-prefix}female:before,
+.#{$ionicons-prefix}filing:before,
+.#{$ionicons-prefix}film-marker:before,
+.#{$ionicons-prefix}fireball:before,
+.#{$ionicons-prefix}flag:before,
+.#{$ionicons-prefix}flame:before,
+.#{$ionicons-prefix}flash:before,
+.#{$ionicons-prefix}flash-off:before,
+.#{$ionicons-prefix}folder:before,
+.#{$ionicons-prefix}fork:before,
+.#{$ionicons-prefix}fork-repo:before,
+.#{$ionicons-prefix}forward:before,
+.#{$ionicons-prefix}funnel:before,
+.#{$ionicons-prefix}gear-a:before,
+.#{$ionicons-prefix}gear-b:before,
+.#{$ionicons-prefix}grid:before,
+.#{$ionicons-prefix}hammer:before,
+.#{$ionicons-prefix}happy:before,
+.#{$ionicons-prefix}happy-outline:before,
+.#{$ionicons-prefix}headphone:before,
+.#{$ionicons-prefix}heart:before,
+.#{$ionicons-prefix}heart-broken:before,
+.#{$ionicons-prefix}help:before,
+.#{$ionicons-prefix}help-buoy:before,
+.#{$ionicons-prefix}help-circled:before,
+.#{$ionicons-prefix}home:before,
+.#{$ionicons-prefix}icecream:before,
+.#{$ionicons-prefix}image:before,
+.#{$ionicons-prefix}images:before,
+.#{$ionicons-prefix}information:before,
+.#{$ionicons-prefix}information-circled:before,
+.#{$ionicons-prefix}ionic:before,
+.#{$ionicons-prefix}ios-alarm:before,
+.#{$ionicons-prefix}ios-alarm-outline:before,
+.#{$ionicons-prefix}ios-albums:before,
+.#{$ionicons-prefix}ios-albums-outline:before,
+.#{$ionicons-prefix}ios-americanfootball:before,
+.#{$ionicons-prefix}ios-americanfootball-outline:before,
+.#{$ionicons-prefix}ios-analytics:before,
+.#{$ionicons-prefix}ios-analytics-outline:before,
+.#{$ionicons-prefix}ios-arrow-back:before,
+.#{$ionicons-prefix}ios-arrow-down:before,
+.#{$ionicons-prefix}ios-arrow-forward:before,
+.#{$ionicons-prefix}ios-arrow-left:before,
+.#{$ionicons-prefix}ios-arrow-right:before,
+.#{$ionicons-prefix}ios-arrow-thin-down:before,
+.#{$ionicons-prefix}ios-arrow-thin-left:before,
+.#{$ionicons-prefix}ios-arrow-thin-right:before,
+.#{$ionicons-prefix}ios-arrow-thin-up:before,
+.#{$ionicons-prefix}ios-arrow-up:before,
+.#{$ionicons-prefix}ios-at:before,
+.#{$ionicons-prefix}ios-at-outline:before,
+.#{$ionicons-prefix}ios-barcode:before,
+.#{$ionicons-prefix}ios-barcode-outline:before,
+.#{$ionicons-prefix}ios-baseball:before,
+.#{$ionicons-prefix}ios-baseball-outline:before,
+.#{$ionicons-prefix}ios-basketball:before,
+.#{$ionicons-prefix}ios-basketball-outline:before,
+.#{$ionicons-prefix}ios-bell:before,
+.#{$ionicons-prefix}ios-bell-outline:before,
+.#{$ionicons-prefix}ios-body:before,
+.#{$ionicons-prefix}ios-body-outline:before,
+.#{$ionicons-prefix}ios-bolt:before,
+.#{$ionicons-prefix}ios-bolt-outline:before,
+.#{$ionicons-prefix}ios-book:before,
+.#{$ionicons-prefix}ios-book-outline:before,
+.#{$ionicons-prefix}ios-bookmarks:before,
+.#{$ionicons-prefix}ios-bookmarks-outline:before,
+.#{$ionicons-prefix}ios-box:before,
+.#{$ionicons-prefix}ios-box-outline:before,
+.#{$ionicons-prefix}ios-briefcase:before,
+.#{$ionicons-prefix}ios-briefcase-outline:before,
+.#{$ionicons-prefix}ios-browsers:before,
+.#{$ionicons-prefix}ios-browsers-outline:before,
+.#{$ionicons-prefix}ios-calculator:before,
+.#{$ionicons-prefix}ios-calculator-outline:before,
+.#{$ionicons-prefix}ios-calendar:before,
+.#{$ionicons-prefix}ios-calendar-outline:before,
+.#{$ionicons-prefix}ios-camera:before,
+.#{$ionicons-prefix}ios-camera-outline:before,
+.#{$ionicons-prefix}ios-cart:before,
+.#{$ionicons-prefix}ios-cart-outline:before,
+.#{$ionicons-prefix}ios-chatboxes:before,
+.#{$ionicons-prefix}ios-chatboxes-outline:before,
+.#{$ionicons-prefix}ios-chatbubble:before,
+.#{$ionicons-prefix}ios-chatbubble-outline:before,
+.#{$ionicons-prefix}ios-checkmark:before,
+.#{$ionicons-prefix}ios-checkmark-empty:before,
+.#{$ionicons-prefix}ios-checkmark-outline:before,
+.#{$ionicons-prefix}ios-circle-filled:before,
+.#{$ionicons-prefix}ios-circle-outline:before,
+.#{$ionicons-prefix}ios-clock:before,
+.#{$ionicons-prefix}ios-clock-outline:before,
+.#{$ionicons-prefix}ios-close:before,
+.#{$ionicons-prefix}ios-close-empty:before,
+.#{$ionicons-prefix}ios-close-outline:before,
+.#{$ionicons-prefix}ios-cloud:before,
+.#{$ionicons-prefix}ios-cloud-download:before,
+.#{$ionicons-prefix}ios-cloud-download-outline:before,
+.#{$ionicons-prefix}ios-cloud-outline:before,
+.#{$ionicons-prefix}ios-cloud-upload:before,
+.#{$ionicons-prefix}ios-cloud-upload-outline:before,
+.#{$ionicons-prefix}ios-cloudy:before,
+.#{$ionicons-prefix}ios-cloudy-night:before,
+.#{$ionicons-prefix}ios-cloudy-night-outline:before,
+.#{$ionicons-prefix}ios-cloudy-outline:before,
+.#{$ionicons-prefix}ios-cog:before,
+.#{$ionicons-prefix}ios-cog-outline:before,
+.#{$ionicons-prefix}ios-color-filter:before,
+.#{$ionicons-prefix}ios-color-filter-outline:before,
+.#{$ionicons-prefix}ios-color-wand:before,
+.#{$ionicons-prefix}ios-color-wand-outline:before,
+.#{$ionicons-prefix}ios-compose:before,
+.#{$ionicons-prefix}ios-compose-outline:before,
+.#{$ionicons-prefix}ios-contact:before,
+.#{$ionicons-prefix}ios-contact-outline:before,
+.#{$ionicons-prefix}ios-copy:before,
+.#{$ionicons-prefix}ios-copy-outline:before,
+.#{$ionicons-prefix}ios-crop:before,
+.#{$ionicons-prefix}ios-crop-strong:before,
+.#{$ionicons-prefix}ios-download:before,
+.#{$ionicons-prefix}ios-download-outline:before,
+.#{$ionicons-prefix}ios-drag:before,
+.#{$ionicons-prefix}ios-email:before,
+.#{$ionicons-prefix}ios-email-outline:before,
+.#{$ionicons-prefix}ios-eye:before,
+.#{$ionicons-prefix}ios-eye-outline:before,
+.#{$ionicons-prefix}ios-fastforward:before,
+.#{$ionicons-prefix}ios-fastforward-outline:before,
+.#{$ionicons-prefix}ios-filing:before,
+.#{$ionicons-prefix}ios-filing-outline:before,
+.#{$ionicons-prefix}ios-film:before,
+.#{$ionicons-prefix}ios-film-outline:before,
+.#{$ionicons-prefix}ios-flag:before,
+.#{$ionicons-prefix}ios-flag-outline:before,
+.#{$ionicons-prefix}ios-flame:before,
+.#{$ionicons-prefix}ios-flame-outline:before,
+.#{$ionicons-prefix}ios-flask:before,
+.#{$ionicons-prefix}ios-flask-outline:before,
+.#{$ionicons-prefix}ios-flower:before,
+.#{$ionicons-prefix}ios-flower-outline:before,
+.#{$ionicons-prefix}ios-folder:before,
+.#{$ionicons-prefix}ios-folder-outline:before,
+.#{$ionicons-prefix}ios-football:before,
+.#{$ionicons-prefix}ios-football-outline:before,
+.#{$ionicons-prefix}ios-game-controller-a:before,
+.#{$ionicons-prefix}ios-game-controller-a-outline:before,
+.#{$ionicons-prefix}ios-game-controller-b:before,
+.#{$ionicons-prefix}ios-game-controller-b-outline:before,
+.#{$ionicons-prefix}ios-gear:before,
+.#{$ionicons-prefix}ios-gear-outline:before,
+.#{$ionicons-prefix}ios-glasses:before,
+.#{$ionicons-prefix}ios-glasses-outline:before,
+.#{$ionicons-prefix}ios-grid-view:before,
+.#{$ionicons-prefix}ios-grid-view-outline:before,
+.#{$ionicons-prefix}ios-heart:before,
+.#{$ionicons-prefix}ios-heart-outline:before,
+.#{$ionicons-prefix}ios-help:before,
+.#{$ionicons-prefix}ios-help-empty:before,
+.#{$ionicons-prefix}ios-help-outline:before,
+.#{$ionicons-prefix}ios-home:before,
+.#{$ionicons-prefix}ios-home-outline:before,
+.#{$ionicons-prefix}ios-infinite:before,
+.#{$ionicons-prefix}ios-infinite-outline:before,
+.#{$ionicons-prefix}ios-information:before,
+.#{$ionicons-prefix}ios-information-empty:before,
+.#{$ionicons-prefix}ios-information-outline:before,
+.#{$ionicons-prefix}ios-ionic-outline:before,
+.#{$ionicons-prefix}ios-keypad:before,
+.#{$ionicons-prefix}ios-keypad-outline:before,
+.#{$ionicons-prefix}ios-lightbulb:before,
+.#{$ionicons-prefix}ios-lightbulb-outline:before,
+.#{$ionicons-prefix}ios-list:before,
+.#{$ionicons-prefix}ios-list-outline:before,
+.#{$ionicons-prefix}ios-location:before,
+.#{$ionicons-prefix}ios-location-outline:before,
+.#{$ionicons-prefix}ios-locked:before,
+.#{$ionicons-prefix}ios-locked-outline:before,
+.#{$ionicons-prefix}ios-loop:before,
+.#{$ionicons-prefix}ios-loop-strong:before,
+.#{$ionicons-prefix}ios-medical:before,
+.#{$ionicons-prefix}ios-medical-outline:before,
+.#{$ionicons-prefix}ios-medkit:before,
+.#{$ionicons-prefix}ios-medkit-outline:before,
+.#{$ionicons-prefix}ios-mic:before,
+.#{$ionicons-prefix}ios-mic-off:before,
+.#{$ionicons-prefix}ios-mic-outline:before,
+.#{$ionicons-prefix}ios-minus:before,
+.#{$ionicons-prefix}ios-minus-empty:before,
+.#{$ionicons-prefix}ios-minus-outline:before,
+.#{$ionicons-prefix}ios-monitor:before,
+.#{$ionicons-prefix}ios-monitor-outline:before,
+.#{$ionicons-prefix}ios-moon:before,
+.#{$ionicons-prefix}ios-moon-outline:before,
+.#{$ionicons-prefix}ios-more:before,
+.#{$ionicons-prefix}ios-more-outline:before,
+.#{$ionicons-prefix}ios-musical-note:before,
+.#{$ionicons-prefix}ios-musical-notes:before,
+.#{$ionicons-prefix}ios-navigate:before,
+.#{$ionicons-prefix}ios-navigate-outline:before,
+.#{$ionicons-prefix}ios-nutrition:before,
+.#{$ionicons-prefix}ios-nutrition-outline:before,
+.#{$ionicons-prefix}ios-paper:before,
+.#{$ionicons-prefix}ios-paper-outline:before,
+.#{$ionicons-prefix}ios-paperplane:before,
+.#{$ionicons-prefix}ios-paperplane-outline:before,
+.#{$ionicons-prefix}ios-partlysunny:before,
+.#{$ionicons-prefix}ios-partlysunny-outline:before,
+.#{$ionicons-prefix}ios-pause:before,
+.#{$ionicons-prefix}ios-pause-outline:before,
+.#{$ionicons-prefix}ios-paw:before,
+.#{$ionicons-prefix}ios-paw-outline:before,
+.#{$ionicons-prefix}ios-people:before,
+.#{$ionicons-prefix}ios-people-outline:before,
+.#{$ionicons-prefix}ios-person:before,
+.#{$ionicons-prefix}ios-person-outline:before,
+.#{$ionicons-prefix}ios-personadd:before,
+.#{$ionicons-prefix}ios-personadd-outline:before,
+.#{$ionicons-prefix}ios-photos:before,
+.#{$ionicons-prefix}ios-photos-outline:before,
+.#{$ionicons-prefix}ios-pie:before,
+.#{$ionicons-prefix}ios-pie-outline:before,
+.#{$ionicons-prefix}ios-pint:before,
+.#{$ionicons-prefix}ios-pint-outline:before,
+.#{$ionicons-prefix}ios-play:before,
+.#{$ionicons-prefix}ios-play-outline:before,
+.#{$ionicons-prefix}ios-plus:before,
+.#{$ionicons-prefix}ios-plus-empty:before,
+.#{$ionicons-prefix}ios-plus-outline:before,
+.#{$ionicons-prefix}ios-pricetag:before,
+.#{$ionicons-prefix}ios-pricetag-outline:before,
+.#{$ionicons-prefix}ios-pricetags:before,
+.#{$ionicons-prefix}ios-pricetags-outline:before,
+.#{$ionicons-prefix}ios-printer:before,
+.#{$ionicons-prefix}ios-printer-outline:before,
+.#{$ionicons-prefix}ios-pulse:before,
+.#{$ionicons-prefix}ios-pulse-strong:before,
+.#{$ionicons-prefix}ios-rainy:before,
+.#{$ionicons-prefix}ios-rainy-outline:before,
+.#{$ionicons-prefix}ios-recording:before,
+.#{$ionicons-prefix}ios-recording-outline:before,
+.#{$ionicons-prefix}ios-redo:before,
+.#{$ionicons-prefix}ios-redo-outline:before,
+.#{$ionicons-prefix}ios-refresh:before,
+.#{$ionicons-prefix}ios-refresh-empty:before,
+.#{$ionicons-prefix}ios-refresh-outline:before,
+.#{$ionicons-prefix}ios-reload:before,
+.#{$ionicons-prefix}ios-reverse-camera:before,
+.#{$ionicons-prefix}ios-reverse-camera-outline:before,
+.#{$ionicons-prefix}ios-rewind:before,
+.#{$ionicons-prefix}ios-rewind-outline:before,
+.#{$ionicons-prefix}ios-rose:before,
+.#{$ionicons-prefix}ios-rose-outline:before,
+.#{$ionicons-prefix}ios-search:before,
+.#{$ionicons-prefix}ios-search-strong:before,
+.#{$ionicons-prefix}ios-settings:before,
+.#{$ionicons-prefix}ios-settings-strong:before,
+.#{$ionicons-prefix}ios-shuffle:before,
+.#{$ionicons-prefix}ios-shuffle-strong:before,
+.#{$ionicons-prefix}ios-skipbackward:before,
+.#{$ionicons-prefix}ios-skipbackward-outline:before,
+.#{$ionicons-prefix}ios-skipforward:before,
+.#{$ionicons-prefix}ios-skipforward-outline:before,
+.#{$ionicons-prefix}ios-snowy:before,
+.#{$ionicons-prefix}ios-speedometer:before,
+.#{$ionicons-prefix}ios-speedometer-outline:before,
+.#{$ionicons-prefix}ios-star:before,
+.#{$ionicons-prefix}ios-star-half:before,
+.#{$ionicons-prefix}ios-star-outline:before,
+.#{$ionicons-prefix}ios-stopwatch:before,
+.#{$ionicons-prefix}ios-stopwatch-outline:before,
+.#{$ionicons-prefix}ios-sunny:before,
+.#{$ionicons-prefix}ios-sunny-outline:before,
+.#{$ionicons-prefix}ios-telephone:before,
+.#{$ionicons-prefix}ios-telephone-outline:before,
+.#{$ionicons-prefix}ios-tennisball:before,
+.#{$ionicons-prefix}ios-tennisball-outline:before,
+.#{$ionicons-prefix}ios-thunderstorm:before,
+.#{$ionicons-prefix}ios-thunderstorm-outline:before,
+.#{$ionicons-prefix}ios-time:before,
+.#{$ionicons-prefix}ios-time-outline:before,
+.#{$ionicons-prefix}ios-timer:before,
+.#{$ionicons-prefix}ios-timer-outline:before,
+.#{$ionicons-prefix}ios-toggle:before,
+.#{$ionicons-prefix}ios-toggle-outline:before,
+.#{$ionicons-prefix}ios-trash:before,
+.#{$ionicons-prefix}ios-trash-outline:before,
+.#{$ionicons-prefix}ios-undo:before,
+.#{$ionicons-prefix}ios-undo-outline:before,
+.#{$ionicons-prefix}ios-unlocked:before,
+.#{$ionicons-prefix}ios-unlocked-outline:before,
+.#{$ionicons-prefix}ios-upload:before,
+.#{$ionicons-prefix}ios-upload-outline:before,
+.#{$ionicons-prefix}ios-videocam:before,
+.#{$ionicons-prefix}ios-videocam-outline:before,
+.#{$ionicons-prefix}ios-volume-high:before,
+.#{$ionicons-prefix}ios-volume-low:before,
+.#{$ionicons-prefix}ios-wineglass:before,
+.#{$ionicons-prefix}ios-wineglass-outline:before,
+.#{$ionicons-prefix}ios-world:before,
+.#{$ionicons-prefix}ios-world-outline:before,
+.#{$ionicons-prefix}ipad:before,
+.#{$ionicons-prefix}iphone:before,
+.#{$ionicons-prefix}ipod:before,
+.#{$ionicons-prefix}jet:before,
+.#{$ionicons-prefix}key:before,
+.#{$ionicons-prefix}knife:before,
+.#{$ionicons-prefix}laptop:before,
+.#{$ionicons-prefix}leaf:before,
+.#{$ionicons-prefix}levels:before,
+.#{$ionicons-prefix}lightbulb:before,
+.#{$ionicons-prefix}link:before,
+.#{$ionicons-prefix}load-a:before,
+.#{$ionicons-prefix}load-b:before,
+.#{$ionicons-prefix}load-c:before,
+.#{$ionicons-prefix}load-d:before,
+.#{$ionicons-prefix}location:before,
+.#{$ionicons-prefix}lock-combination:before,
+.#{$ionicons-prefix}locked:before,
+.#{$ionicons-prefix}log-in:before,
+.#{$ionicons-prefix}log-out:before,
+.#{$ionicons-prefix}loop:before,
+.#{$ionicons-prefix}magnet:before,
+.#{$ionicons-prefix}male:before,
+.#{$ionicons-prefix}man:before,
+.#{$ionicons-prefix}map:before,
+.#{$ionicons-prefix}medkit:before,
+.#{$ionicons-prefix}merge:before,
+.#{$ionicons-prefix}mic-a:before,
+.#{$ionicons-prefix}mic-b:before,
+.#{$ionicons-prefix}mic-c:before,
+.#{$ionicons-prefix}minus:before,
+.#{$ionicons-prefix}minus-circled:before,
+.#{$ionicons-prefix}minus-round:before,
+.#{$ionicons-prefix}model-s:before,
+.#{$ionicons-prefix}monitor:before,
+.#{$ionicons-prefix}more:before,
+.#{$ionicons-prefix}mouse:before,
+.#{$ionicons-prefix}music-note:before,
+.#{$ionicons-prefix}navicon:before,
+.#{$ionicons-prefix}navicon-round:before,
+.#{$ionicons-prefix}navigate:before,
+.#{$ionicons-prefix}network:before,
+.#{$ionicons-prefix}no-smoking:before,
+.#{$ionicons-prefix}nuclear:before,
+.#{$ionicons-prefix}outlet:before,
+.#{$ionicons-prefix}paintbrush:before,
+.#{$ionicons-prefix}paintbucket:before,
+.#{$ionicons-prefix}paper-airplane:before,
+.#{$ionicons-prefix}paperclip:before,
+.#{$ionicons-prefix}pause:before,
+.#{$ionicons-prefix}person:before,
+.#{$ionicons-prefix}person-add:before,
+.#{$ionicons-prefix}person-stalker:before,
+.#{$ionicons-prefix}pie-graph:before,
+.#{$ionicons-prefix}pin:before,
+.#{$ionicons-prefix}pinpoint:before,
+.#{$ionicons-prefix}pizza:before,
+.#{$ionicons-prefix}plane:before,
+.#{$ionicons-prefix}planet:before,
+.#{$ionicons-prefix}play:before,
+.#{$ionicons-prefix}playstation:before,
+.#{$ionicons-prefix}plus:before,
+.#{$ionicons-prefix}plus-circled:before,
+.#{$ionicons-prefix}plus-round:before,
+.#{$ionicons-prefix}podium:before,
+.#{$ionicons-prefix}pound:before,
+.#{$ionicons-prefix}power:before,
+.#{$ionicons-prefix}pricetag:before,
+.#{$ionicons-prefix}pricetags:before,
+.#{$ionicons-prefix}printer:before,
+.#{$ionicons-prefix}pull-request:before,
+.#{$ionicons-prefix}qr-scanner:before,
+.#{$ionicons-prefix}quote:before,
+.#{$ionicons-prefix}radio-waves:before,
+.#{$ionicons-prefix}record:before,
+.#{$ionicons-prefix}refresh:before,
+.#{$ionicons-prefix}reply:before,
+.#{$ionicons-prefix}reply-all:before,
+.#{$ionicons-prefix}ribbon-a:before,
+.#{$ionicons-prefix}ribbon-b:before,
+.#{$ionicons-prefix}sad:before,
+.#{$ionicons-prefix}sad-outline:before,
+.#{$ionicons-prefix}scissors:before,
+.#{$ionicons-prefix}search:before,
+.#{$ionicons-prefix}settings:before,
+.#{$ionicons-prefix}share:before,
+.#{$ionicons-prefix}shuffle:before,
+.#{$ionicons-prefix}skip-backward:before,
+.#{$ionicons-prefix}skip-forward:before,
+.#{$ionicons-prefix}social-android:before,
+.#{$ionicons-prefix}social-android-outline:before,
+.#{$ionicons-prefix}social-angular:before,
+.#{$ionicons-prefix}social-angular-outline:before,
+.#{$ionicons-prefix}social-apple:before,
+.#{$ionicons-prefix}social-apple-outline:before,
+.#{$ionicons-prefix}social-bitcoin:before,
+.#{$ionicons-prefix}social-bitcoin-outline:before,
+.#{$ionicons-prefix}social-buffer:before,
+.#{$ionicons-prefix}social-buffer-outline:before,
+.#{$ionicons-prefix}social-chrome:before,
+.#{$ionicons-prefix}social-chrome-outline:before,
+.#{$ionicons-prefix}social-codepen:before,
+.#{$ionicons-prefix}social-codepen-outline:before,
+.#{$ionicons-prefix}social-css3:before,
+.#{$ionicons-prefix}social-css3-outline:before,
+.#{$ionicons-prefix}social-designernews:before,
+.#{$ionicons-prefix}social-designernews-outline:before,
+.#{$ionicons-prefix}social-dribbble:before,
+.#{$ionicons-prefix}social-dribbble-outline:before,
+.#{$ionicons-prefix}social-dropbox:before,
+.#{$ionicons-prefix}social-dropbox-outline:before,
+.#{$ionicons-prefix}social-euro:before,
+.#{$ionicons-prefix}social-euro-outline:before,
+.#{$ionicons-prefix}social-facebook:before,
+.#{$ionicons-prefix}social-facebook-outline:before,
+.#{$ionicons-prefix}social-foursquare:before,
+.#{$ionicons-prefix}social-foursquare-outline:before,
+.#{$ionicons-prefix}social-freebsd-devil:before,
+.#{$ionicons-prefix}social-github:before,
+.#{$ionicons-prefix}social-github-outline:before,
+.#{$ionicons-prefix}social-google:before,
+.#{$ionicons-prefix}social-google-outline:before,
+.#{$ionicons-prefix}social-googleplus:before,
+.#{$ionicons-prefix}social-googleplus-outline:before,
+.#{$ionicons-prefix}social-hackernews:before,
+.#{$ionicons-prefix}social-hackernews-outline:before,
+.#{$ionicons-prefix}social-html5:before,
+.#{$ionicons-prefix}social-html5-outline:before,
+.#{$ionicons-prefix}social-instagram:before,
+.#{$ionicons-prefix}social-instagram-outline:before,
+.#{$ionicons-prefix}social-javascript:before,
+.#{$ionicons-prefix}social-javascript-outline:before,
+.#{$ionicons-prefix}social-linkedin:before,
+.#{$ionicons-prefix}social-linkedin-outline:before,
+.#{$ionicons-prefix}social-markdown:before,
+.#{$ionicons-prefix}social-nodejs:before,
+.#{$ionicons-prefix}social-octocat:before,
+.#{$ionicons-prefix}social-pinterest:before,
+.#{$ionicons-prefix}social-pinterest-outline:before,
+.#{$ionicons-prefix}social-python:before,
+.#{$ionicons-prefix}social-reddit:before,
+.#{$ionicons-prefix}social-reddit-outline:before,
+.#{$ionicons-prefix}social-rss:before,
+.#{$ionicons-prefix}social-rss-outline:before,
+.#{$ionicons-prefix}social-sass:before,
+.#{$ionicons-prefix}social-skype:before,
+.#{$ionicons-prefix}social-skype-outline:before,
+.#{$ionicons-prefix}social-snapchat:before,
+.#{$ionicons-prefix}social-snapchat-outline:before,
+.#{$ionicons-prefix}social-tumblr:before,
+.#{$ionicons-prefix}social-tumblr-outline:before,
+.#{$ionicons-prefix}social-tux:before,
+.#{$ionicons-prefix}social-twitch:before,
+.#{$ionicons-prefix}social-twitch-outline:before,
+.#{$ionicons-prefix}social-twitter:before,
+.#{$ionicons-prefix}social-twitter-outline:before,
+.#{$ionicons-prefix}social-usd:before,
+.#{$ionicons-prefix}social-usd-outline:before,
+.#{$ionicons-prefix}social-vimeo:before,
+.#{$ionicons-prefix}social-vimeo-outline:before,
+.#{$ionicons-prefix}social-whatsapp:before,
+.#{$ionicons-prefix}social-whatsapp-outline:before,
+.#{$ionicons-prefix}social-windows:before,
+.#{$ionicons-prefix}social-windows-outline:before,
+.#{$ionicons-prefix}social-wordpress:before,
+.#{$ionicons-prefix}social-wordpress-outline:before,
+.#{$ionicons-prefix}social-yahoo:before,
+.#{$ionicons-prefix}social-yahoo-outline:before,
+.#{$ionicons-prefix}social-yen:before,
+.#{$ionicons-prefix}social-yen-outline:before,
+.#{$ionicons-prefix}social-youtube:before,
+.#{$ionicons-prefix}social-youtube-outline:before,
+.#{$ionicons-prefix}soup-can:before,
+.#{$ionicons-prefix}soup-can-outline:before,
+.#{$ionicons-prefix}speakerphone:before,
+.#{$ionicons-prefix}speedometer:before,
+.#{$ionicons-prefix}spoon:before,
+.#{$ionicons-prefix}star:before,
+.#{$ionicons-prefix}stats-bars:before,
+.#{$ionicons-prefix}steam:before,
+.#{$ionicons-prefix}stop:before,
+.#{$ionicons-prefix}thermometer:before,
+.#{$ionicons-prefix}thumbsdown:before,
+.#{$ionicons-prefix}thumbsup:before,
+.#{$ionicons-prefix}toggle:before,
+.#{$ionicons-prefix}toggle-filled:before,
+.#{$ionicons-prefix}transgender:before,
+.#{$ionicons-prefix}trash-a:before,
+.#{$ionicons-prefix}trash-b:before,
+.#{$ionicons-prefix}trophy:before,
+.#{$ionicons-prefix}tshirt:before,
+.#{$ionicons-prefix}tshirt-outline:before,
+.#{$ionicons-prefix}umbrella:before,
+.#{$ionicons-prefix}university:before,
+.#{$ionicons-prefix}unlocked:before,
+.#{$ionicons-prefix}upload:before,
+.#{$ionicons-prefix}usb:before,
+.#{$ionicons-prefix}videocamera:before,
+.#{$ionicons-prefix}volume-high:before,
+.#{$ionicons-prefix}volume-low:before,
+.#{$ionicons-prefix}volume-medium:before,
+.#{$ionicons-prefix}volume-mute:before,
+.#{$ionicons-prefix}wand:before,
+.#{$ionicons-prefix}waterdrop:before,
+.#{$ionicons-prefix}wifi:before,
+.#{$ionicons-prefix}wineglass:before,
+.#{$ionicons-prefix}woman:before,
+.#{$ionicons-prefix}wrench:before,
+.#{$ionicons-prefix}xbox:before
+{
+ @extend .ion;
+}
+.#{$ionicons-prefix}alert:before { content: $ionicon-var-alert; }
+.#{$ionicons-prefix}alert-circled:before { content: $ionicon-var-alert-circled; }
+.#{$ionicons-prefix}android-add:before { content: $ionicon-var-android-add; }
+.#{$ionicons-prefix}android-add-circle:before { content: $ionicon-var-android-add-circle; }
+.#{$ionicons-prefix}android-alarm-clock:before { content: $ionicon-var-android-alarm-clock; }
+.#{$ionicons-prefix}android-alert:before { content: $ionicon-var-android-alert; }
+.#{$ionicons-prefix}android-apps:before { content: $ionicon-var-android-apps; }
+.#{$ionicons-prefix}android-archive:before { content: $ionicon-var-android-archive; }
+.#{$ionicons-prefix}android-arrow-back:before { content: $ionicon-var-android-arrow-back; }
+.#{$ionicons-prefix}android-arrow-down:before { content: $ionicon-var-android-arrow-down; }
+.#{$ionicons-prefix}android-arrow-dropdown:before { content: $ionicon-var-android-arrow-dropdown; }
+.#{$ionicons-prefix}android-arrow-dropdown-circle:before { content: $ionicon-var-android-arrow-dropdown-circle; }
+.#{$ionicons-prefix}android-arrow-dropleft:before { content: $ionicon-var-android-arrow-dropleft; }
+.#{$ionicons-prefix}android-arrow-dropleft-circle:before { content: $ionicon-var-android-arrow-dropleft-circle; }
+.#{$ionicons-prefix}android-arrow-dropright:before { content: $ionicon-var-android-arrow-dropright; }
+.#{$ionicons-prefix}android-arrow-dropright-circle:before { content: $ionicon-var-android-arrow-dropright-circle; }
+.#{$ionicons-prefix}android-arrow-dropup:before { content: $ionicon-var-android-arrow-dropup; }
+.#{$ionicons-prefix}android-arrow-dropup-circle:before { content: $ionicon-var-android-arrow-dropup-circle; }
+.#{$ionicons-prefix}android-arrow-forward:before { content: $ionicon-var-android-arrow-forward; }
+.#{$ionicons-prefix}android-arrow-up:before { content: $ionicon-var-android-arrow-up; }
+.#{$ionicons-prefix}android-attach:before { content: $ionicon-var-android-attach; }
+.#{$ionicons-prefix}android-bar:before { content: $ionicon-var-android-bar; }
+.#{$ionicons-prefix}android-bicycle:before { content: $ionicon-var-android-bicycle; }
+.#{$ionicons-prefix}android-boat:before { content: $ionicon-var-android-boat; }
+.#{$ionicons-prefix}android-bookmark:before { content: $ionicon-var-android-bookmark; }
+.#{$ionicons-prefix}android-bulb:before { content: $ionicon-var-android-bulb; }
+.#{$ionicons-prefix}android-bus:before { content: $ionicon-var-android-bus; }
+.#{$ionicons-prefix}android-calendar:before { content: $ionicon-var-android-calendar; }
+.#{$ionicons-prefix}android-call:before { content: $ionicon-var-android-call; }
+.#{$ionicons-prefix}android-camera:before { content: $ionicon-var-android-camera; }
+.#{$ionicons-prefix}android-cancel:before { content: $ionicon-var-android-cancel; }
+.#{$ionicons-prefix}android-car:before { content: $ionicon-var-android-car; }
+.#{$ionicons-prefix}android-cart:before { content: $ionicon-var-android-cart; }
+.#{$ionicons-prefix}android-chat:before { content: $ionicon-var-android-chat; }
+.#{$ionicons-prefix}android-checkbox:before { content: $ionicon-var-android-checkbox; }
+.#{$ionicons-prefix}android-checkbox-blank:before { content: $ionicon-var-android-checkbox-blank; }
+.#{$ionicons-prefix}android-checkbox-outline:before { content: $ionicon-var-android-checkbox-outline; }
+.#{$ionicons-prefix}android-checkbox-outline-blank:before { content: $ionicon-var-android-checkbox-outline-blank; }
+.#{$ionicons-prefix}android-checkmark-circle:before { content: $ionicon-var-android-checkmark-circle; }
+.#{$ionicons-prefix}android-clipboard:before { content: $ionicon-var-android-clipboard; }
+.#{$ionicons-prefix}android-close:before { content: $ionicon-var-android-close; }
+.#{$ionicons-prefix}android-cloud:before { content: $ionicon-var-android-cloud; }
+.#{$ionicons-prefix}android-cloud-circle:before { content: $ionicon-var-android-cloud-circle; }
+.#{$ionicons-prefix}android-cloud-done:before { content: $ionicon-var-android-cloud-done; }
+.#{$ionicons-prefix}android-cloud-outline:before { content: $ionicon-var-android-cloud-outline; }
+.#{$ionicons-prefix}android-color-palette:before { content: $ionicon-var-android-color-palette; }
+.#{$ionicons-prefix}android-compass:before { content: $ionicon-var-android-compass; }
+.#{$ionicons-prefix}android-contact:before { content: $ionicon-var-android-contact; }
+.#{$ionicons-prefix}android-contacts:before { content: $ionicon-var-android-contacts; }
+.#{$ionicons-prefix}android-contract:before { content: $ionicon-var-android-contract; }
+.#{$ionicons-prefix}android-create:before { content: $ionicon-var-android-create; }
+.#{$ionicons-prefix}android-delete:before { content: $ionicon-var-android-delete; }
+.#{$ionicons-prefix}android-desktop:before { content: $ionicon-var-android-desktop; }
+.#{$ionicons-prefix}android-document:before { content: $ionicon-var-android-document; }
+.#{$ionicons-prefix}android-done:before { content: $ionicon-var-android-done; }
+.#{$ionicons-prefix}android-done-all:before { content: $ionicon-var-android-done-all; }
+.#{$ionicons-prefix}android-download:before { content: $ionicon-var-android-download; }
+.#{$ionicons-prefix}android-drafts:before { content: $ionicon-var-android-drafts; }
+.#{$ionicons-prefix}android-exit:before { content: $ionicon-var-android-exit; }
+.#{$ionicons-prefix}android-expand:before { content: $ionicon-var-android-expand; }
+.#{$ionicons-prefix}android-favorite:before { content: $ionicon-var-android-favorite; }
+.#{$ionicons-prefix}android-favorite-outline:before { content: $ionicon-var-android-favorite-outline; }
+.#{$ionicons-prefix}android-film:before { content: $ionicon-var-android-film; }
+.#{$ionicons-prefix}android-folder:before { content: $ionicon-var-android-folder; }
+.#{$ionicons-prefix}android-folder-open:before { content: $ionicon-var-android-folder-open; }
+.#{$ionicons-prefix}android-funnel:before { content: $ionicon-var-android-funnel; }
+.#{$ionicons-prefix}android-globe:before { content: $ionicon-var-android-globe; }
+.#{$ionicons-prefix}android-hand:before { content: $ionicon-var-android-hand; }
+.#{$ionicons-prefix}android-hangout:before { content: $ionicon-var-android-hangout; }
+.#{$ionicons-prefix}android-happy:before { content: $ionicon-var-android-happy; }
+.#{$ionicons-prefix}android-home:before { content: $ionicon-var-android-home; }
+.#{$ionicons-prefix}android-image:before { content: $ionicon-var-android-image; }
+.#{$ionicons-prefix}android-laptop:before { content: $ionicon-var-android-laptop; }
+.#{$ionicons-prefix}android-list:before { content: $ionicon-var-android-list; }
+.#{$ionicons-prefix}android-locate:before { content: $ionicon-var-android-locate; }
+.#{$ionicons-prefix}android-lock:before { content: $ionicon-var-android-lock; }
+.#{$ionicons-prefix}android-mail:before { content: $ionicon-var-android-mail; }
+.#{$ionicons-prefix}android-map:before { content: $ionicon-var-android-map; }
+.#{$ionicons-prefix}android-menu:before { content: $ionicon-var-android-menu; }
+.#{$ionicons-prefix}android-microphone:before { content: $ionicon-var-android-microphone; }
+.#{$ionicons-prefix}android-microphone-off:before { content: $ionicon-var-android-microphone-off; }
+.#{$ionicons-prefix}android-more-horizontal:before { content: $ionicon-var-android-more-horizontal; }
+.#{$ionicons-prefix}android-more-vertical:before { content: $ionicon-var-android-more-vertical; }
+.#{$ionicons-prefix}android-navigate:before { content: $ionicon-var-android-navigate; }
+.#{$ionicons-prefix}android-notifications:before { content: $ionicon-var-android-notifications; }
+.#{$ionicons-prefix}android-notifications-none:before { content: $ionicon-var-android-notifications-none; }
+.#{$ionicons-prefix}android-notifications-off:before { content: $ionicon-var-android-notifications-off; }
+.#{$ionicons-prefix}android-open:before { content: $ionicon-var-android-open; }
+.#{$ionicons-prefix}android-options:before { content: $ionicon-var-android-options; }
+.#{$ionicons-prefix}android-people:before { content: $ionicon-var-android-people; }
+.#{$ionicons-prefix}android-person:before { content: $ionicon-var-android-person; }
+.#{$ionicons-prefix}android-person-add:before { content: $ionicon-var-android-person-add; }
+.#{$ionicons-prefix}android-phone-landscape:before { content: $ionicon-var-android-phone-landscape; }
+.#{$ionicons-prefix}android-phone-portrait:before { content: $ionicon-var-android-phone-portrait; }
+.#{$ionicons-prefix}android-pin:before { content: $ionicon-var-android-pin; }
+.#{$ionicons-prefix}android-plane:before { content: $ionicon-var-android-plane; }
+.#{$ionicons-prefix}android-playstore:before { content: $ionicon-var-android-playstore; }
+.#{$ionicons-prefix}android-print:before { content: $ionicon-var-android-print; }
+.#{$ionicons-prefix}android-radio-button-off:before { content: $ionicon-var-android-radio-button-off; }
+.#{$ionicons-prefix}android-radio-button-on:before { content: $ionicon-var-android-radio-button-on; }
+.#{$ionicons-prefix}android-refresh:before { content: $ionicon-var-android-refresh; }
+.#{$ionicons-prefix}android-remove:before { content: $ionicon-var-android-remove; }
+.#{$ionicons-prefix}android-remove-circle:before { content: $ionicon-var-android-remove-circle; }
+.#{$ionicons-prefix}android-restaurant:before { content: $ionicon-var-android-restaurant; }
+.#{$ionicons-prefix}android-sad:before { content: $ionicon-var-android-sad; }
+.#{$ionicons-prefix}android-search:before { content: $ionicon-var-android-search; }
+.#{$ionicons-prefix}android-send:before { content: $ionicon-var-android-send; }
+.#{$ionicons-prefix}android-settings:before { content: $ionicon-var-android-settings; }
+.#{$ionicons-prefix}android-share:before { content: $ionicon-var-android-share; }
+.#{$ionicons-prefix}android-share-alt:before { content: $ionicon-var-android-share-alt; }
+.#{$ionicons-prefix}android-star:before { content: $ionicon-var-android-star; }
+.#{$ionicons-prefix}android-star-half:before { content: $ionicon-var-android-star-half; }
+.#{$ionicons-prefix}android-star-outline:before { content: $ionicon-var-android-star-outline; }
+.#{$ionicons-prefix}android-stopwatch:before { content: $ionicon-var-android-stopwatch; }
+.#{$ionicons-prefix}android-subway:before { content: $ionicon-var-android-subway; }
+.#{$ionicons-prefix}android-sunny:before { content: $ionicon-var-android-sunny; }
+.#{$ionicons-prefix}android-sync:before { content: $ionicon-var-android-sync; }
+.#{$ionicons-prefix}android-textsms:before { content: $ionicon-var-android-textsms; }
+.#{$ionicons-prefix}android-time:before { content: $ionicon-var-android-time; }
+.#{$ionicons-prefix}android-train:before { content: $ionicon-var-android-train; }
+.#{$ionicons-prefix}android-unlock:before { content: $ionicon-var-android-unlock; }
+.#{$ionicons-prefix}android-upload:before { content: $ionicon-var-android-upload; }
+.#{$ionicons-prefix}android-volume-down:before { content: $ionicon-var-android-volume-down; }
+.#{$ionicons-prefix}android-volume-mute:before { content: $ionicon-var-android-volume-mute; }
+.#{$ionicons-prefix}android-volume-off:before { content: $ionicon-var-android-volume-off; }
+.#{$ionicons-prefix}android-volume-up:before { content: $ionicon-var-android-volume-up; }
+.#{$ionicons-prefix}android-walk:before { content: $ionicon-var-android-walk; }
+.#{$ionicons-prefix}android-warning:before { content: $ionicon-var-android-warning; }
+.#{$ionicons-prefix}android-watch:before { content: $ionicon-var-android-watch; }
+.#{$ionicons-prefix}android-wifi:before { content: $ionicon-var-android-wifi; }
+.#{$ionicons-prefix}aperture:before { content: $ionicon-var-aperture; }
+.#{$ionicons-prefix}archive:before { content: $ionicon-var-archive; }
+.#{$ionicons-prefix}arrow-down-a:before { content: $ionicon-var-arrow-down-a; }
+.#{$ionicons-prefix}arrow-down-b:before { content: $ionicon-var-arrow-down-b; }
+.#{$ionicons-prefix}arrow-down-c:before { content: $ionicon-var-arrow-down-c; }
+.#{$ionicons-prefix}arrow-expand:before { content: $ionicon-var-arrow-expand; }
+.#{$ionicons-prefix}arrow-graph-down-left:before { content: $ionicon-var-arrow-graph-down-left; }
+.#{$ionicons-prefix}arrow-graph-down-right:before { content: $ionicon-var-arrow-graph-down-right; }
+.#{$ionicons-prefix}arrow-graph-up-left:before { content: $ionicon-var-arrow-graph-up-left; }
+.#{$ionicons-prefix}arrow-graph-up-right:before { content: $ionicon-var-arrow-graph-up-right; }
+.#{$ionicons-prefix}arrow-left-a:before { content: $ionicon-var-arrow-left-a; }
+.#{$ionicons-prefix}arrow-left-b:before { content: $ionicon-var-arrow-left-b; }
+.#{$ionicons-prefix}arrow-left-c:before { content: $ionicon-var-arrow-left-c; }
+.#{$ionicons-prefix}arrow-move:before { content: $ionicon-var-arrow-move; }
+.#{$ionicons-prefix}arrow-resize:before { content: $ionicon-var-arrow-resize; }
+.#{$ionicons-prefix}arrow-return-left:before { content: $ionicon-var-arrow-return-left; }
+.#{$ionicons-prefix}arrow-return-right:before { content: $ionicon-var-arrow-return-right; }
+.#{$ionicons-prefix}arrow-right-a:before { content: $ionicon-var-arrow-right-a; }
+.#{$ionicons-prefix}arrow-right-b:before { content: $ionicon-var-arrow-right-b; }
+.#{$ionicons-prefix}arrow-right-c:before { content: $ionicon-var-arrow-right-c; }
+.#{$ionicons-prefix}arrow-shrink:before { content: $ionicon-var-arrow-shrink; }
+.#{$ionicons-prefix}arrow-swap:before { content: $ionicon-var-arrow-swap; }
+.#{$ionicons-prefix}arrow-up-a:before { content: $ionicon-var-arrow-up-a; }
+.#{$ionicons-prefix}arrow-up-b:before { content: $ionicon-var-arrow-up-b; }
+.#{$ionicons-prefix}arrow-up-c:before { content: $ionicon-var-arrow-up-c; }
+.#{$ionicons-prefix}asterisk:before { content: $ionicon-var-asterisk; }
+.#{$ionicons-prefix}at:before { content: $ionicon-var-at; }
+.#{$ionicons-prefix}backspace:before { content: $ionicon-var-backspace; }
+.#{$ionicons-prefix}backspace-outline:before { content: $ionicon-var-backspace-outline; }
+.#{$ionicons-prefix}bag:before { content: $ionicon-var-bag; }
+.#{$ionicons-prefix}battery-charging:before { content: $ionicon-var-battery-charging; }
+.#{$ionicons-prefix}battery-empty:before { content: $ionicon-var-battery-empty; }
+.#{$ionicons-prefix}battery-full:before { content: $ionicon-var-battery-full; }
+.#{$ionicons-prefix}battery-half:before { content: $ionicon-var-battery-half; }
+.#{$ionicons-prefix}battery-low:before { content: $ionicon-var-battery-low; }
+.#{$ionicons-prefix}beaker:before { content: $ionicon-var-beaker; }
+.#{$ionicons-prefix}beer:before { content: $ionicon-var-beer; }
+.#{$ionicons-prefix}bluetooth:before { content: $ionicon-var-bluetooth; }
+.#{$ionicons-prefix}bonfire:before { content: $ionicon-var-bonfire; }
+.#{$ionicons-prefix}bookmark:before { content: $ionicon-var-bookmark; }
+.#{$ionicons-prefix}bowtie:before { content: $ionicon-var-bowtie; }
+.#{$ionicons-prefix}briefcase:before { content: $ionicon-var-briefcase; }
+.#{$ionicons-prefix}bug:before { content: $ionicon-var-bug; }
+.#{$ionicons-prefix}calculator:before { content: $ionicon-var-calculator; }
+.#{$ionicons-prefix}calendar:before { content: $ionicon-var-calendar; }
+.#{$ionicons-prefix}camera:before { content: $ionicon-var-camera; }
+.#{$ionicons-prefix}card:before { content: $ionicon-var-card; }
+.#{$ionicons-prefix}cash:before { content: $ionicon-var-cash; }
+.#{$ionicons-prefix}chatbox:before { content: $ionicon-var-chatbox; }
+.#{$ionicons-prefix}chatbox-working:before { content: $ionicon-var-chatbox-working; }
+.#{$ionicons-prefix}chatboxes:before { content: $ionicon-var-chatboxes; }
+.#{$ionicons-prefix}chatbubble:before { content: $ionicon-var-chatbubble; }
+.#{$ionicons-prefix}chatbubble-working:before { content: $ionicon-var-chatbubble-working; }
+.#{$ionicons-prefix}chatbubbles:before { content: $ionicon-var-chatbubbles; }
+.#{$ionicons-prefix}checkmark:before { content: $ionicon-var-checkmark; }
+.#{$ionicons-prefix}checkmark-circled:before { content: $ionicon-var-checkmark-circled; }
+.#{$ionicons-prefix}checkmark-round:before { content: $ionicon-var-checkmark-round; }
+.#{$ionicons-prefix}chevron-down:before { content: $ionicon-var-chevron-down; }
+.#{$ionicons-prefix}chevron-left:before { content: $ionicon-var-chevron-left; }
+.#{$ionicons-prefix}chevron-right:before { content: $ionicon-var-chevron-right; }
+.#{$ionicons-prefix}chevron-up:before { content: $ionicon-var-chevron-up; }
+.#{$ionicons-prefix}clipboard:before { content: $ionicon-var-clipboard; }
+.#{$ionicons-prefix}clock:before { content: $ionicon-var-clock; }
+.#{$ionicons-prefix}close:before { content: $ionicon-var-close; }
+.#{$ionicons-prefix}close-circled:before { content: $ionicon-var-close-circled; }
+.#{$ionicons-prefix}close-round:before { content: $ionicon-var-close-round; }
+.#{$ionicons-prefix}closed-captioning:before { content: $ionicon-var-closed-captioning; }
+.#{$ionicons-prefix}cloud:before { content: $ionicon-var-cloud; }
+.#{$ionicons-prefix}code:before { content: $ionicon-var-code; }
+.#{$ionicons-prefix}code-download:before { content: $ionicon-var-code-download; }
+.#{$ionicons-prefix}code-working:before { content: $ionicon-var-code-working; }
+.#{$ionicons-prefix}coffee:before { content: $ionicon-var-coffee; }
+.#{$ionicons-prefix}compass:before { content: $ionicon-var-compass; }
+.#{$ionicons-prefix}compose:before { content: $ionicon-var-compose; }
+.#{$ionicons-prefix}connection-bars:before { content: $ionicon-var-connection-bars; }
+.#{$ionicons-prefix}contrast:before { content: $ionicon-var-contrast; }
+.#{$ionicons-prefix}crop:before { content: $ionicon-var-crop; }
+.#{$ionicons-prefix}cube:before { content: $ionicon-var-cube; }
+.#{$ionicons-prefix}disc:before { content: $ionicon-var-disc; }
+.#{$ionicons-prefix}document:before { content: $ionicon-var-document; }
+.#{$ionicons-prefix}document-text:before { content: $ionicon-var-document-text; }
+.#{$ionicons-prefix}drag:before { content: $ionicon-var-drag; }
+.#{$ionicons-prefix}earth:before { content: $ionicon-var-earth; }
+.#{$ionicons-prefix}easel:before { content: $ionicon-var-easel; }
+.#{$ionicons-prefix}edit:before { content: $ionicon-var-edit; }
+.#{$ionicons-prefix}egg:before { content: $ionicon-var-egg; }
+.#{$ionicons-prefix}eject:before { content: $ionicon-var-eject; }
+.#{$ionicons-prefix}email:before { content: $ionicon-var-email; }
+.#{$ionicons-prefix}email-unread:before { content: $ionicon-var-email-unread; }
+.#{$ionicons-prefix}erlenmeyer-flask:before { content: $ionicon-var-erlenmeyer-flask; }
+.#{$ionicons-prefix}erlenmeyer-flask-bubbles:before { content: $ionicon-var-erlenmeyer-flask-bubbles; }
+.#{$ionicons-prefix}eye:before { content: $ionicon-var-eye; }
+.#{$ionicons-prefix}eye-disabled:before { content: $ionicon-var-eye-disabled; }
+.#{$ionicons-prefix}female:before { content: $ionicon-var-female; }
+.#{$ionicons-prefix}filing:before { content: $ionicon-var-filing; }
+.#{$ionicons-prefix}film-marker:before { content: $ionicon-var-film-marker; }
+.#{$ionicons-prefix}fireball:before { content: $ionicon-var-fireball; }
+.#{$ionicons-prefix}flag:before { content: $ionicon-var-flag; }
+.#{$ionicons-prefix}flame:before { content: $ionicon-var-flame; }
+.#{$ionicons-prefix}flash:before { content: $ionicon-var-flash; }
+.#{$ionicons-prefix}flash-off:before { content: $ionicon-var-flash-off; }
+.#{$ionicons-prefix}folder:before { content: $ionicon-var-folder; }
+.#{$ionicons-prefix}fork:before { content: $ionicon-var-fork; }
+.#{$ionicons-prefix}fork-repo:before { content: $ionicon-var-fork-repo; }
+.#{$ionicons-prefix}forward:before { content: $ionicon-var-forward; }
+.#{$ionicons-prefix}funnel:before { content: $ionicon-var-funnel; }
+.#{$ionicons-prefix}gear-a:before { content: $ionicon-var-gear-a; }
+.#{$ionicons-prefix}gear-b:before { content: $ionicon-var-gear-b; }
+.#{$ionicons-prefix}grid:before { content: $ionicon-var-grid; }
+.#{$ionicons-prefix}hammer:before { content: $ionicon-var-hammer; }
+.#{$ionicons-prefix}happy:before { content: $ionicon-var-happy; }
+.#{$ionicons-prefix}happy-outline:before { content: $ionicon-var-happy-outline; }
+.#{$ionicons-prefix}headphone:before { content: $ionicon-var-headphone; }
+.#{$ionicons-prefix}heart:before { content: $ionicon-var-heart; }
+.#{$ionicons-prefix}heart-broken:before { content: $ionicon-var-heart-broken; }
+.#{$ionicons-prefix}help:before { content: $ionicon-var-help; }
+.#{$ionicons-prefix}help-buoy:before { content: $ionicon-var-help-buoy; }
+.#{$ionicons-prefix}help-circled:before { content: $ionicon-var-help-circled; }
+.#{$ionicons-prefix}home:before { content: $ionicon-var-home; }
+.#{$ionicons-prefix}icecream:before { content: $ionicon-var-icecream; }
+.#{$ionicons-prefix}image:before { content: $ionicon-var-image; }
+.#{$ionicons-prefix}images:before { content: $ionicon-var-images; }
+.#{$ionicons-prefix}information:before { content: $ionicon-var-information; }
+.#{$ionicons-prefix}information-circled:before { content: $ionicon-var-information-circled; }
+.#{$ionicons-prefix}ionic:before { content: $ionicon-var-ionic; }
+.#{$ionicons-prefix}ios-alarm:before { content: $ionicon-var-ios-alarm; }
+.#{$ionicons-prefix}ios-alarm-outline:before { content: $ionicon-var-ios-alarm-outline; }
+.#{$ionicons-prefix}ios-albums:before { content: $ionicon-var-ios-albums; }
+.#{$ionicons-prefix}ios-albums-outline:before { content: $ionicon-var-ios-albums-outline; }
+.#{$ionicons-prefix}ios-americanfootball:before { content: $ionicon-var-ios-americanfootball; }
+.#{$ionicons-prefix}ios-americanfootball-outline:before { content: $ionicon-var-ios-americanfootball-outline; }
+.#{$ionicons-prefix}ios-analytics:before { content: $ionicon-var-ios-analytics; }
+.#{$ionicons-prefix}ios-analytics-outline:before { content: $ionicon-var-ios-analytics-outline; }
+.#{$ionicons-prefix}ios-arrow-back:before { content: $ionicon-var-ios-arrow-back; }
+.#{$ionicons-prefix}ios-arrow-down:before { content: $ionicon-var-ios-arrow-down; }
+.#{$ionicons-prefix}ios-arrow-forward:before { content: $ionicon-var-ios-arrow-forward; }
+.#{$ionicons-prefix}ios-arrow-left:before { content: $ionicon-var-ios-arrow-left; }
+.#{$ionicons-prefix}ios-arrow-right:before { content: $ionicon-var-ios-arrow-right; }
+.#{$ionicons-prefix}ios-arrow-thin-down:before { content: $ionicon-var-ios-arrow-thin-down; }
+.#{$ionicons-prefix}ios-arrow-thin-left:before { content: $ionicon-var-ios-arrow-thin-left; }
+.#{$ionicons-prefix}ios-arrow-thin-right:before { content: $ionicon-var-ios-arrow-thin-right; }
+.#{$ionicons-prefix}ios-arrow-thin-up:before { content: $ionicon-var-ios-arrow-thin-up; }
+.#{$ionicons-prefix}ios-arrow-up:before { content: $ionicon-var-ios-arrow-up; }
+.#{$ionicons-prefix}ios-at:before { content: $ionicon-var-ios-at; }
+.#{$ionicons-prefix}ios-at-outline:before { content: $ionicon-var-ios-at-outline; }
+.#{$ionicons-prefix}ios-barcode:before { content: $ionicon-var-ios-barcode; }
+.#{$ionicons-prefix}ios-barcode-outline:before { content: $ionicon-var-ios-barcode-outline; }
+.#{$ionicons-prefix}ios-baseball:before { content: $ionicon-var-ios-baseball; }
+.#{$ionicons-prefix}ios-baseball-outline:before { content: $ionicon-var-ios-baseball-outline; }
+.#{$ionicons-prefix}ios-basketball:before { content: $ionicon-var-ios-basketball; }
+.#{$ionicons-prefix}ios-basketball-outline:before { content: $ionicon-var-ios-basketball-outline; }
+.#{$ionicons-prefix}ios-bell:before { content: $ionicon-var-ios-bell; }
+.#{$ionicons-prefix}ios-bell-outline:before { content: $ionicon-var-ios-bell-outline; }
+.#{$ionicons-prefix}ios-body:before { content: $ionicon-var-ios-body; }
+.#{$ionicons-prefix}ios-body-outline:before { content: $ionicon-var-ios-body-outline; }
+.#{$ionicons-prefix}ios-bolt:before { content: $ionicon-var-ios-bolt; }
+.#{$ionicons-prefix}ios-bolt-outline:before { content: $ionicon-var-ios-bolt-outline; }
+.#{$ionicons-prefix}ios-book:before { content: $ionicon-var-ios-book; }
+.#{$ionicons-prefix}ios-book-outline:before { content: $ionicon-var-ios-book-outline; }
+.#{$ionicons-prefix}ios-bookmarks:before { content: $ionicon-var-ios-bookmarks; }
+.#{$ionicons-prefix}ios-bookmarks-outline:before { content: $ionicon-var-ios-bookmarks-outline; }
+.#{$ionicons-prefix}ios-box:before { content: $ionicon-var-ios-box; }
+.#{$ionicons-prefix}ios-box-outline:before { content: $ionicon-var-ios-box-outline; }
+.#{$ionicons-prefix}ios-briefcase:before { content: $ionicon-var-ios-briefcase; }
+.#{$ionicons-prefix}ios-briefcase-outline:before { content: $ionicon-var-ios-briefcase-outline; }
+.#{$ionicons-prefix}ios-browsers:before { content: $ionicon-var-ios-browsers; }
+.#{$ionicons-prefix}ios-browsers-outline:before { content: $ionicon-var-ios-browsers-outline; }
+.#{$ionicons-prefix}ios-calculator:before { content: $ionicon-var-ios-calculator; }
+.#{$ionicons-prefix}ios-calculator-outline:before { content: $ionicon-var-ios-calculator-outline; }
+.#{$ionicons-prefix}ios-calendar:before { content: $ionicon-var-ios-calendar; }
+.#{$ionicons-prefix}ios-calendar-outline:before { content: $ionicon-var-ios-calendar-outline; }
+.#{$ionicons-prefix}ios-camera:before { content: $ionicon-var-ios-camera; }
+.#{$ionicons-prefix}ios-camera-outline:before { content: $ionicon-var-ios-camera-outline; }
+.#{$ionicons-prefix}ios-cart:before { content: $ionicon-var-ios-cart; }
+.#{$ionicons-prefix}ios-cart-outline:before { content: $ionicon-var-ios-cart-outline; }
+.#{$ionicons-prefix}ios-chatboxes:before { content: $ionicon-var-ios-chatboxes; }
+.#{$ionicons-prefix}ios-chatboxes-outline:before { content: $ionicon-var-ios-chatboxes-outline; }
+.#{$ionicons-prefix}ios-chatbubble:before { content: $ionicon-var-ios-chatbubble; }
+.#{$ionicons-prefix}ios-chatbubble-outline:before { content: $ionicon-var-ios-chatbubble-outline; }
+.#{$ionicons-prefix}ios-checkmark:before { content: $ionicon-var-ios-checkmark; }
+.#{$ionicons-prefix}ios-checkmark-empty:before { content: $ionicon-var-ios-checkmark-empty; }
+.#{$ionicons-prefix}ios-checkmark-outline:before { content: $ionicon-var-ios-checkmark-outline; }
+.#{$ionicons-prefix}ios-circle-filled:before { content: $ionicon-var-ios-circle-filled; }
+.#{$ionicons-prefix}ios-circle-outline:before { content: $ionicon-var-ios-circle-outline; }
+.#{$ionicons-prefix}ios-clock:before { content: $ionicon-var-ios-clock; }
+.#{$ionicons-prefix}ios-clock-outline:before { content: $ionicon-var-ios-clock-outline; }
+.#{$ionicons-prefix}ios-close:before { content: $ionicon-var-ios-close; }
+.#{$ionicons-prefix}ios-close-empty:before { content: $ionicon-var-ios-close-empty; }
+.#{$ionicons-prefix}ios-close-outline:before { content: $ionicon-var-ios-close-outline; }
+.#{$ionicons-prefix}ios-cloud:before { content: $ionicon-var-ios-cloud; }
+.#{$ionicons-prefix}ios-cloud-download:before { content: $ionicon-var-ios-cloud-download; }
+.#{$ionicons-prefix}ios-cloud-download-outline:before { content: $ionicon-var-ios-cloud-download-outline; }
+.#{$ionicons-prefix}ios-cloud-outline:before { content: $ionicon-var-ios-cloud-outline; }
+.#{$ionicons-prefix}ios-cloud-upload:before { content: $ionicon-var-ios-cloud-upload; }
+.#{$ionicons-prefix}ios-cloud-upload-outline:before { content: $ionicon-var-ios-cloud-upload-outline; }
+.#{$ionicons-prefix}ios-cloudy:before { content: $ionicon-var-ios-cloudy; }
+.#{$ionicons-prefix}ios-cloudy-night:before { content: $ionicon-var-ios-cloudy-night; }
+.#{$ionicons-prefix}ios-cloudy-night-outline:before { content: $ionicon-var-ios-cloudy-night-outline; }
+.#{$ionicons-prefix}ios-cloudy-outline:before { content: $ionicon-var-ios-cloudy-outline; }
+.#{$ionicons-prefix}ios-cog:before { content: $ionicon-var-ios-cog; }
+.#{$ionicons-prefix}ios-cog-outline:before { content: $ionicon-var-ios-cog-outline; }
+.#{$ionicons-prefix}ios-color-filter:before { content: $ionicon-var-ios-color-filter; }
+.#{$ionicons-prefix}ios-color-filter-outline:before { content: $ionicon-var-ios-color-filter-outline; }
+.#{$ionicons-prefix}ios-color-wand:before { content: $ionicon-var-ios-color-wand; }
+.#{$ionicons-prefix}ios-color-wand-outline:before { content: $ionicon-var-ios-color-wand-outline; }
+.#{$ionicons-prefix}ios-compose:before { content: $ionicon-var-ios-compose; }
+.#{$ionicons-prefix}ios-compose-outline:before { content: $ionicon-var-ios-compose-outline; }
+.#{$ionicons-prefix}ios-contact:before { content: $ionicon-var-ios-contact; }
+.#{$ionicons-prefix}ios-contact-outline:before { content: $ionicon-var-ios-contact-outline; }
+.#{$ionicons-prefix}ios-copy:before { content: $ionicon-var-ios-copy; }
+.#{$ionicons-prefix}ios-copy-outline:before { content: $ionicon-var-ios-copy-outline; }
+.#{$ionicons-prefix}ios-crop:before { content: $ionicon-var-ios-crop; }
+.#{$ionicons-prefix}ios-crop-strong:before { content: $ionicon-var-ios-crop-strong; }
+.#{$ionicons-prefix}ios-download:before { content: $ionicon-var-ios-download; }
+.#{$ionicons-prefix}ios-download-outline:before { content: $ionicon-var-ios-download-outline; }
+.#{$ionicons-prefix}ios-drag:before { content: $ionicon-var-ios-drag; }
+.#{$ionicons-prefix}ios-email:before { content: $ionicon-var-ios-email; }
+.#{$ionicons-prefix}ios-email-outline:before { content: $ionicon-var-ios-email-outline; }
+.#{$ionicons-prefix}ios-eye:before { content: $ionicon-var-ios-eye; }
+.#{$ionicons-prefix}ios-eye-outline:before { content: $ionicon-var-ios-eye-outline; }
+.#{$ionicons-prefix}ios-fastforward:before { content: $ionicon-var-ios-fastforward; }
+.#{$ionicons-prefix}ios-fastforward-outline:before { content: $ionicon-var-ios-fastforward-outline; }
+.#{$ionicons-prefix}ios-filing:before { content: $ionicon-var-ios-filing; }
+.#{$ionicons-prefix}ios-filing-outline:before { content: $ionicon-var-ios-filing-outline; }
+.#{$ionicons-prefix}ios-film:before { content: $ionicon-var-ios-film; }
+.#{$ionicons-prefix}ios-film-outline:before { content: $ionicon-var-ios-film-outline; }
+.#{$ionicons-prefix}ios-flag:before { content: $ionicon-var-ios-flag; }
+.#{$ionicons-prefix}ios-flag-outline:before { content: $ionicon-var-ios-flag-outline; }
+.#{$ionicons-prefix}ios-flame:before { content: $ionicon-var-ios-flame; }
+.#{$ionicons-prefix}ios-flame-outline:before { content: $ionicon-var-ios-flame-outline; }
+.#{$ionicons-prefix}ios-flask:before { content: $ionicon-var-ios-flask; }
+.#{$ionicons-prefix}ios-flask-outline:before { content: $ionicon-var-ios-flask-outline; }
+.#{$ionicons-prefix}ios-flower:before { content: $ionicon-var-ios-flower; }
+.#{$ionicons-prefix}ios-flower-outline:before { content: $ionicon-var-ios-flower-outline; }
+.#{$ionicons-prefix}ios-folder:before { content: $ionicon-var-ios-folder; }
+.#{$ionicons-prefix}ios-folder-outline:before { content: $ionicon-var-ios-folder-outline; }
+.#{$ionicons-prefix}ios-football:before { content: $ionicon-var-ios-football; }
+.#{$ionicons-prefix}ios-football-outline:before { content: $ionicon-var-ios-football-outline; }
+.#{$ionicons-prefix}ios-game-controller-a:before { content: $ionicon-var-ios-game-controller-a; }
+.#{$ionicons-prefix}ios-game-controller-a-outline:before { content: $ionicon-var-ios-game-controller-a-outline; }
+.#{$ionicons-prefix}ios-game-controller-b:before { content: $ionicon-var-ios-game-controller-b; }
+.#{$ionicons-prefix}ios-game-controller-b-outline:before { content: $ionicon-var-ios-game-controller-b-outline; }
+.#{$ionicons-prefix}ios-gear:before { content: $ionicon-var-ios-gear; }
+.#{$ionicons-prefix}ios-gear-outline:before { content: $ionicon-var-ios-gear-outline; }
+.#{$ionicons-prefix}ios-glasses:before { content: $ionicon-var-ios-glasses; }
+.#{$ionicons-prefix}ios-glasses-outline:before { content: $ionicon-var-ios-glasses-outline; }
+.#{$ionicons-prefix}ios-grid-view:before { content: $ionicon-var-ios-grid-view; }
+.#{$ionicons-prefix}ios-grid-view-outline:before { content: $ionicon-var-ios-grid-view-outline; }
+.#{$ionicons-prefix}ios-heart:before { content: $ionicon-var-ios-heart; }
+.#{$ionicons-prefix}ios-heart-outline:before { content: $ionicon-var-ios-heart-outline; }
+.#{$ionicons-prefix}ios-help:before { content: $ionicon-var-ios-help; }
+.#{$ionicons-prefix}ios-help-empty:before { content: $ionicon-var-ios-help-empty; }
+.#{$ionicons-prefix}ios-help-outline:before { content: $ionicon-var-ios-help-outline; }
+.#{$ionicons-prefix}ios-home:before { content: $ionicon-var-ios-home; }
+.#{$ionicons-prefix}ios-home-outline:before { content: $ionicon-var-ios-home-outline; }
+.#{$ionicons-prefix}ios-infinite:before { content: $ionicon-var-ios-infinite; }
+.#{$ionicons-prefix}ios-infinite-outline:before { content: $ionicon-var-ios-infinite-outline; }
+.#{$ionicons-prefix}ios-information:before { content: $ionicon-var-ios-information; }
+.#{$ionicons-prefix}ios-information-empty:before { content: $ionicon-var-ios-information-empty; }
+.#{$ionicons-prefix}ios-information-outline:before { content: $ionicon-var-ios-information-outline; }
+.#{$ionicons-prefix}ios-ionic-outline:before { content: $ionicon-var-ios-ionic-outline; }
+.#{$ionicons-prefix}ios-keypad:before { content: $ionicon-var-ios-keypad; }
+.#{$ionicons-prefix}ios-keypad-outline:before { content: $ionicon-var-ios-keypad-outline; }
+.#{$ionicons-prefix}ios-lightbulb:before { content: $ionicon-var-ios-lightbulb; }
+.#{$ionicons-prefix}ios-lightbulb-outline:before { content: $ionicon-var-ios-lightbulb-outline; }
+.#{$ionicons-prefix}ios-list:before { content: $ionicon-var-ios-list; }
+.#{$ionicons-prefix}ios-list-outline:before { content: $ionicon-var-ios-list-outline; }
+.#{$ionicons-prefix}ios-location:before { content: $ionicon-var-ios-location; }
+.#{$ionicons-prefix}ios-location-outline:before { content: $ionicon-var-ios-location-outline; }
+.#{$ionicons-prefix}ios-locked:before { content: $ionicon-var-ios-locked; }
+.#{$ionicons-prefix}ios-locked-outline:before { content: $ionicon-var-ios-locked-outline; }
+.#{$ionicons-prefix}ios-loop:before { content: $ionicon-var-ios-loop; }
+.#{$ionicons-prefix}ios-loop-strong:before { content: $ionicon-var-ios-loop-strong; }
+.#{$ionicons-prefix}ios-medical:before { content: $ionicon-var-ios-medical; }
+.#{$ionicons-prefix}ios-medical-outline:before { content: $ionicon-var-ios-medical-outline; }
+.#{$ionicons-prefix}ios-medkit:before { content: $ionicon-var-ios-medkit; }
+.#{$ionicons-prefix}ios-medkit-outline:before { content: $ionicon-var-ios-medkit-outline; }
+.#{$ionicons-prefix}ios-mic:before { content: $ionicon-var-ios-mic; }
+.#{$ionicons-prefix}ios-mic-off:before { content: $ionicon-var-ios-mic-off; }
+.#{$ionicons-prefix}ios-mic-outline:before { content: $ionicon-var-ios-mic-outline; }
+.#{$ionicons-prefix}ios-minus:before { content: $ionicon-var-ios-minus; }
+.#{$ionicons-prefix}ios-minus-empty:before { content: $ionicon-var-ios-minus-empty; }
+.#{$ionicons-prefix}ios-minus-outline:before { content: $ionicon-var-ios-minus-outline; }
+.#{$ionicons-prefix}ios-monitor:before { content: $ionicon-var-ios-monitor; }
+.#{$ionicons-prefix}ios-monitor-outline:before { content: $ionicon-var-ios-monitor-outline; }
+.#{$ionicons-prefix}ios-moon:before { content: $ionicon-var-ios-moon; }
+.#{$ionicons-prefix}ios-moon-outline:before { content: $ionicon-var-ios-moon-outline; }
+.#{$ionicons-prefix}ios-more:before { content: $ionicon-var-ios-more; }
+.#{$ionicons-prefix}ios-more-outline:before { content: $ionicon-var-ios-more-outline; }
+.#{$ionicons-prefix}ios-musical-note:before { content: $ionicon-var-ios-musical-note; }
+.#{$ionicons-prefix}ios-musical-notes:before { content: $ionicon-var-ios-musical-notes; }
+.#{$ionicons-prefix}ios-navigate:before { content: $ionicon-var-ios-navigate; }
+.#{$ionicons-prefix}ios-navigate-outline:before { content: $ionicon-var-ios-navigate-outline; }
+.#{$ionicons-prefix}ios-nutrition:before { content: $ionicon-var-ios-nutrition; }
+.#{$ionicons-prefix}ios-nutrition-outline:before { content: $ionicon-var-ios-nutrition-outline; }
+.#{$ionicons-prefix}ios-paper:before { content: $ionicon-var-ios-paper; }
+.#{$ionicons-prefix}ios-paper-outline:before { content: $ionicon-var-ios-paper-outline; }
+.#{$ionicons-prefix}ios-paperplane:before { content: $ionicon-var-ios-paperplane; }
+.#{$ionicons-prefix}ios-paperplane-outline:before { content: $ionicon-var-ios-paperplane-outline; }
+.#{$ionicons-prefix}ios-partlysunny:before { content: $ionicon-var-ios-partlysunny; }
+.#{$ionicons-prefix}ios-partlysunny-outline:before { content: $ionicon-var-ios-partlysunny-outline; }
+.#{$ionicons-prefix}ios-pause:before { content: $ionicon-var-ios-pause; }
+.#{$ionicons-prefix}ios-pause-outline:before { content: $ionicon-var-ios-pause-outline; }
+.#{$ionicons-prefix}ios-paw:before { content: $ionicon-var-ios-paw; }
+.#{$ionicons-prefix}ios-paw-outline:before { content: $ionicon-var-ios-paw-outline; }
+.#{$ionicons-prefix}ios-people:before { content: $ionicon-var-ios-people; }
+.#{$ionicons-prefix}ios-people-outline:before { content: $ionicon-var-ios-people-outline; }
+.#{$ionicons-prefix}ios-person:before { content: $ionicon-var-ios-person; }
+.#{$ionicons-prefix}ios-person-outline:before { content: $ionicon-var-ios-person-outline; }
+.#{$ionicons-prefix}ios-personadd:before { content: $ionicon-var-ios-personadd; }
+.#{$ionicons-prefix}ios-personadd-outline:before { content: $ionicon-var-ios-personadd-outline; }
+.#{$ionicons-prefix}ios-photos:before { content: $ionicon-var-ios-photos; }
+.#{$ionicons-prefix}ios-photos-outline:before { content: $ionicon-var-ios-photos-outline; }
+.#{$ionicons-prefix}ios-pie:before { content: $ionicon-var-ios-pie; }
+.#{$ionicons-prefix}ios-pie-outline:before { content: $ionicon-var-ios-pie-outline; }
+.#{$ionicons-prefix}ios-pint:before { content: $ionicon-var-ios-pint; }
+.#{$ionicons-prefix}ios-pint-outline:before { content: $ionicon-var-ios-pint-outline; }
+.#{$ionicons-prefix}ios-play:before { content: $ionicon-var-ios-play; }
+.#{$ionicons-prefix}ios-play-outline:before { content: $ionicon-var-ios-play-outline; }
+.#{$ionicons-prefix}ios-plus:before { content: $ionicon-var-ios-plus; }
+.#{$ionicons-prefix}ios-plus-empty:before { content: $ionicon-var-ios-plus-empty; }
+.#{$ionicons-prefix}ios-plus-outline:before { content: $ionicon-var-ios-plus-outline; }
+.#{$ionicons-prefix}ios-pricetag:before { content: $ionicon-var-ios-pricetag; }
+.#{$ionicons-prefix}ios-pricetag-outline:before { content: $ionicon-var-ios-pricetag-outline; }
+.#{$ionicons-prefix}ios-pricetags:before { content: $ionicon-var-ios-pricetags; }
+.#{$ionicons-prefix}ios-pricetags-outline:before { content: $ionicon-var-ios-pricetags-outline; }
+.#{$ionicons-prefix}ios-printer:before { content: $ionicon-var-ios-printer; }
+.#{$ionicons-prefix}ios-printer-outline:before { content: $ionicon-var-ios-printer-outline; }
+.#{$ionicons-prefix}ios-pulse:before { content: $ionicon-var-ios-pulse; }
+.#{$ionicons-prefix}ios-pulse-strong:before { content: $ionicon-var-ios-pulse-strong; }
+.#{$ionicons-prefix}ios-rainy:before { content: $ionicon-var-ios-rainy; }
+.#{$ionicons-prefix}ios-rainy-outline:before { content: $ionicon-var-ios-rainy-outline; }
+.#{$ionicons-prefix}ios-recording:before { content: $ionicon-var-ios-recording; }
+.#{$ionicons-prefix}ios-recording-outline:before { content: $ionicon-var-ios-recording-outline; }
+.#{$ionicons-prefix}ios-redo:before { content: $ionicon-var-ios-redo; }
+.#{$ionicons-prefix}ios-redo-outline:before { content: $ionicon-var-ios-redo-outline; }
+.#{$ionicons-prefix}ios-refresh:before { content: $ionicon-var-ios-refresh; }
+.#{$ionicons-prefix}ios-refresh-empty:before { content: $ionicon-var-ios-refresh-empty; }
+.#{$ionicons-prefix}ios-refresh-outline:before { content: $ionicon-var-ios-refresh-outline; }
+.#{$ionicons-prefix}ios-reload:before { content: $ionicon-var-ios-reload; }
+.#{$ionicons-prefix}ios-reverse-camera:before { content: $ionicon-var-ios-reverse-camera; }
+.#{$ionicons-prefix}ios-reverse-camera-outline:before { content: $ionicon-var-ios-reverse-camera-outline; }
+.#{$ionicons-prefix}ios-rewind:before { content: $ionicon-var-ios-rewind; }
+.#{$ionicons-prefix}ios-rewind-outline:before { content: $ionicon-var-ios-rewind-outline; }
+.#{$ionicons-prefix}ios-rose:before { content: $ionicon-var-ios-rose; }
+.#{$ionicons-prefix}ios-rose-outline:before { content: $ionicon-var-ios-rose-outline; }
+.#{$ionicons-prefix}ios-search:before { content: $ionicon-var-ios-search; }
+.#{$ionicons-prefix}ios-search-strong:before { content: $ionicon-var-ios-search-strong; }
+.#{$ionicons-prefix}ios-settings:before { content: $ionicon-var-ios-settings; }
+.#{$ionicons-prefix}ios-settings-strong:before { content: $ionicon-var-ios-settings-strong; }
+.#{$ionicons-prefix}ios-shuffle:before { content: $ionicon-var-ios-shuffle; }
+.#{$ionicons-prefix}ios-shuffle-strong:before { content: $ionicon-var-ios-shuffle-strong; }
+.#{$ionicons-prefix}ios-skipbackward:before { content: $ionicon-var-ios-skipbackward; }
+.#{$ionicons-prefix}ios-skipbackward-outline:before { content: $ionicon-var-ios-skipbackward-outline; }
+.#{$ionicons-prefix}ios-skipforward:before { content: $ionicon-var-ios-skipforward; }
+.#{$ionicons-prefix}ios-skipforward-outline:before { content: $ionicon-var-ios-skipforward-outline; }
+.#{$ionicons-prefix}ios-snowy:before { content: $ionicon-var-ios-snowy; }
+.#{$ionicons-prefix}ios-speedometer:before { content: $ionicon-var-ios-speedometer; }
+.#{$ionicons-prefix}ios-speedometer-outline:before { content: $ionicon-var-ios-speedometer-outline; }
+.#{$ionicons-prefix}ios-star:before { content: $ionicon-var-ios-star; }
+.#{$ionicons-prefix}ios-star-half:before { content: $ionicon-var-ios-star-half; }
+.#{$ionicons-prefix}ios-star-outline:before { content: $ionicon-var-ios-star-outline; }
+.#{$ionicons-prefix}ios-stopwatch:before { content: $ionicon-var-ios-stopwatch; }
+.#{$ionicons-prefix}ios-stopwatch-outline:before { content: $ionicon-var-ios-stopwatch-outline; }
+.#{$ionicons-prefix}ios-sunny:before { content: $ionicon-var-ios-sunny; }
+.#{$ionicons-prefix}ios-sunny-outline:before { content: $ionicon-var-ios-sunny-outline; }
+.#{$ionicons-prefix}ios-telephone:before { content: $ionicon-var-ios-telephone; }
+.#{$ionicons-prefix}ios-telephone-outline:before { content: $ionicon-var-ios-telephone-outline; }
+.#{$ionicons-prefix}ios-tennisball:before { content: $ionicon-var-ios-tennisball; }
+.#{$ionicons-prefix}ios-tennisball-outline:before { content: $ionicon-var-ios-tennisball-outline; }
+.#{$ionicons-prefix}ios-thunderstorm:before { content: $ionicon-var-ios-thunderstorm; }
+.#{$ionicons-prefix}ios-thunderstorm-outline:before { content: $ionicon-var-ios-thunderstorm-outline; }
+.#{$ionicons-prefix}ios-time:before { content: $ionicon-var-ios-time; }
+.#{$ionicons-prefix}ios-time-outline:before { content: $ionicon-var-ios-time-outline; }
+.#{$ionicons-prefix}ios-timer:before { content: $ionicon-var-ios-timer; }
+.#{$ionicons-prefix}ios-timer-outline:before { content: $ionicon-var-ios-timer-outline; }
+.#{$ionicons-prefix}ios-toggle:before { content: $ionicon-var-ios-toggle; }
+.#{$ionicons-prefix}ios-toggle-outline:before { content: $ionicon-var-ios-toggle-outline; }
+.#{$ionicons-prefix}ios-trash:before { content: $ionicon-var-ios-trash; }
+.#{$ionicons-prefix}ios-trash-outline:before { content: $ionicon-var-ios-trash-outline; }
+.#{$ionicons-prefix}ios-undo:before { content: $ionicon-var-ios-undo; }
+.#{$ionicons-prefix}ios-undo-outline:before { content: $ionicon-var-ios-undo-outline; }
+.#{$ionicons-prefix}ios-unlocked:before { content: $ionicon-var-ios-unlocked; }
+.#{$ionicons-prefix}ios-unlocked-outline:before { content: $ionicon-var-ios-unlocked-outline; }
+.#{$ionicons-prefix}ios-upload:before { content: $ionicon-var-ios-upload; }
+.#{$ionicons-prefix}ios-upload-outline:before { content: $ionicon-var-ios-upload-outline; }
+.#{$ionicons-prefix}ios-videocam:before { content: $ionicon-var-ios-videocam; }
+.#{$ionicons-prefix}ios-videocam-outline:before { content: $ionicon-var-ios-videocam-outline; }
+.#{$ionicons-prefix}ios-volume-high:before { content: $ionicon-var-ios-volume-high; }
+.#{$ionicons-prefix}ios-volume-low:before { content: $ionicon-var-ios-volume-low; }
+.#{$ionicons-prefix}ios-wineglass:before { content: $ionicon-var-ios-wineglass; }
+.#{$ionicons-prefix}ios-wineglass-outline:before { content: $ionicon-var-ios-wineglass-outline; }
+.#{$ionicons-prefix}ios-world:before { content: $ionicon-var-ios-world; }
+.#{$ionicons-prefix}ios-world-outline:before { content: $ionicon-var-ios-world-outline; }
+.#{$ionicons-prefix}ipad:before { content: $ionicon-var-ipad; }
+.#{$ionicons-prefix}iphone:before { content: $ionicon-var-iphone; }
+.#{$ionicons-prefix}ipod:before { content: $ionicon-var-ipod; }
+.#{$ionicons-prefix}jet:before { content: $ionicon-var-jet; }
+.#{$ionicons-prefix}key:before { content: $ionicon-var-key; }
+.#{$ionicons-prefix}knife:before { content: $ionicon-var-knife; }
+.#{$ionicons-prefix}laptop:before { content: $ionicon-var-laptop; }
+.#{$ionicons-prefix}leaf:before { content: $ionicon-var-leaf; }
+.#{$ionicons-prefix}levels:before { content: $ionicon-var-levels; }
+.#{$ionicons-prefix}lightbulb:before { content: $ionicon-var-lightbulb; }
+.#{$ionicons-prefix}link:before { content: $ionicon-var-link; }
+.#{$ionicons-prefix}load-a:before { content: $ionicon-var-load-a; }
+.#{$ionicons-prefix}load-b:before { content: $ionicon-var-load-b; }
+.#{$ionicons-prefix}load-c:before { content: $ionicon-var-load-c; }
+.#{$ionicons-prefix}load-d:before { content: $ionicon-var-load-d; }
+.#{$ionicons-prefix}location:before { content: $ionicon-var-location; }
+.#{$ionicons-prefix}lock-combination:before { content: $ionicon-var-lock-combination; }
+.#{$ionicons-prefix}locked:before { content: $ionicon-var-locked; }
+.#{$ionicons-prefix}log-in:before { content: $ionicon-var-log-in; }
+.#{$ionicons-prefix}log-out:before { content: $ionicon-var-log-out; }
+.#{$ionicons-prefix}loop:before { content: $ionicon-var-loop; }
+.#{$ionicons-prefix}magnet:before { content: $ionicon-var-magnet; }
+.#{$ionicons-prefix}male:before { content: $ionicon-var-male; }
+.#{$ionicons-prefix}man:before { content: $ionicon-var-man; }
+.#{$ionicons-prefix}map:before { content: $ionicon-var-map; }
+.#{$ionicons-prefix}medkit:before { content: $ionicon-var-medkit; }
+.#{$ionicons-prefix}merge:before { content: $ionicon-var-merge; }
+.#{$ionicons-prefix}mic-a:before { content: $ionicon-var-mic-a; }
+.#{$ionicons-prefix}mic-b:before { content: $ionicon-var-mic-b; }
+.#{$ionicons-prefix}mic-c:before { content: $ionicon-var-mic-c; }
+.#{$ionicons-prefix}minus:before { content: $ionicon-var-minus; }
+.#{$ionicons-prefix}minus-circled:before { content: $ionicon-var-minus-circled; }
+.#{$ionicons-prefix}minus-round:before { content: $ionicon-var-minus-round; }
+.#{$ionicons-prefix}model-s:before { content: $ionicon-var-model-s; }
+.#{$ionicons-prefix}monitor:before { content: $ionicon-var-monitor; }
+.#{$ionicons-prefix}more:before { content: $ionicon-var-more; }
+.#{$ionicons-prefix}mouse:before { content: $ionicon-var-mouse; }
+.#{$ionicons-prefix}music-note:before { content: $ionicon-var-music-note; }
+.#{$ionicons-prefix}navicon:before { content: $ionicon-var-navicon; }
+.#{$ionicons-prefix}navicon-round:before { content: $ionicon-var-navicon-round; }
+.#{$ionicons-prefix}navigate:before { content: $ionicon-var-navigate; }
+.#{$ionicons-prefix}network:before { content: $ionicon-var-network; }
+.#{$ionicons-prefix}no-smoking:before { content: $ionicon-var-no-smoking; }
+.#{$ionicons-prefix}nuclear:before { content: $ionicon-var-nuclear; }
+.#{$ionicons-prefix}outlet:before { content: $ionicon-var-outlet; }
+.#{$ionicons-prefix}paintbrush:before { content: $ionicon-var-paintbrush; }
+.#{$ionicons-prefix}paintbucket:before { content: $ionicon-var-paintbucket; }
+.#{$ionicons-prefix}paper-airplane:before { content: $ionicon-var-paper-airplane; }
+.#{$ionicons-prefix}paperclip:before { content: $ionicon-var-paperclip; }
+.#{$ionicons-prefix}pause:before { content: $ionicon-var-pause; }
+.#{$ionicons-prefix}person:before { content: $ionicon-var-person; }
+.#{$ionicons-prefix}person-add:before { content: $ionicon-var-person-add; }
+.#{$ionicons-prefix}person-stalker:before { content: $ionicon-var-person-stalker; }
+.#{$ionicons-prefix}pie-graph:before { content: $ionicon-var-pie-graph; }
+.#{$ionicons-prefix}pin:before { content: $ionicon-var-pin; }
+.#{$ionicons-prefix}pinpoint:before { content: $ionicon-var-pinpoint; }
+.#{$ionicons-prefix}pizza:before { content: $ionicon-var-pizza; }
+.#{$ionicons-prefix}plane:before { content: $ionicon-var-plane; }
+.#{$ionicons-prefix}planet:before { content: $ionicon-var-planet; }
+.#{$ionicons-prefix}play:before { content: $ionicon-var-play; }
+.#{$ionicons-prefix}playstation:before { content: $ionicon-var-playstation; }
+.#{$ionicons-prefix}plus:before { content: $ionicon-var-plus; }
+.#{$ionicons-prefix}plus-circled:before { content: $ionicon-var-plus-circled; }
+.#{$ionicons-prefix}plus-round:before { content: $ionicon-var-plus-round; }
+.#{$ionicons-prefix}podium:before { content: $ionicon-var-podium; }
+.#{$ionicons-prefix}pound:before { content: $ionicon-var-pound; }
+.#{$ionicons-prefix}power:before { content: $ionicon-var-power; }
+.#{$ionicons-prefix}pricetag:before { content: $ionicon-var-pricetag; }
+.#{$ionicons-prefix}pricetags:before { content: $ionicon-var-pricetags; }
+.#{$ionicons-prefix}printer:before { content: $ionicon-var-printer; }
+.#{$ionicons-prefix}pull-request:before { content: $ionicon-var-pull-request; }
+.#{$ionicons-prefix}qr-scanner:before { content: $ionicon-var-qr-scanner; }
+.#{$ionicons-prefix}quote:before { content: $ionicon-var-quote; }
+.#{$ionicons-prefix}radio-waves:before { content: $ionicon-var-radio-waves; }
+.#{$ionicons-prefix}record:before { content: $ionicon-var-record; }
+.#{$ionicons-prefix}refresh:before { content: $ionicon-var-refresh; }
+.#{$ionicons-prefix}reply:before { content: $ionicon-var-reply; }
+.#{$ionicons-prefix}reply-all:before { content: $ionicon-var-reply-all; }
+.#{$ionicons-prefix}ribbon-a:before { content: $ionicon-var-ribbon-a; }
+.#{$ionicons-prefix}ribbon-b:before { content: $ionicon-var-ribbon-b; }
+.#{$ionicons-prefix}sad:before { content: $ionicon-var-sad; }
+.#{$ionicons-prefix}sad-outline:before { content: $ionicon-var-sad-outline; }
+.#{$ionicons-prefix}scissors:before { content: $ionicon-var-scissors; }
+.#{$ionicons-prefix}search:before { content: $ionicon-var-search; }
+.#{$ionicons-prefix}settings:before { content: $ionicon-var-settings; }
+.#{$ionicons-prefix}share:before { content: $ionicon-var-share; }
+.#{$ionicons-prefix}shuffle:before { content: $ionicon-var-shuffle; }
+.#{$ionicons-prefix}skip-backward:before { content: $ionicon-var-skip-backward; }
+.#{$ionicons-prefix}skip-forward:before { content: $ionicon-var-skip-forward; }
+.#{$ionicons-prefix}social-android:before { content: $ionicon-var-social-android; }
+.#{$ionicons-prefix}social-android-outline:before { content: $ionicon-var-social-android-outline; }
+.#{$ionicons-prefix}social-angular:before { content: $ionicon-var-social-angular; }
+.#{$ionicons-prefix}social-angular-outline:before { content: $ionicon-var-social-angular-outline; }
+.#{$ionicons-prefix}social-apple:before { content: $ionicon-var-social-apple; }
+.#{$ionicons-prefix}social-apple-outline:before { content: $ionicon-var-social-apple-outline; }
+.#{$ionicons-prefix}social-bitcoin:before { content: $ionicon-var-social-bitcoin; }
+.#{$ionicons-prefix}social-bitcoin-outline:before { content: $ionicon-var-social-bitcoin-outline; }
+.#{$ionicons-prefix}social-buffer:before { content: $ionicon-var-social-buffer; }
+.#{$ionicons-prefix}social-buffer-outline:before { content: $ionicon-var-social-buffer-outline; }
+.#{$ionicons-prefix}social-chrome:before { content: $ionicon-var-social-chrome; }
+.#{$ionicons-prefix}social-chrome-outline:before { content: $ionicon-var-social-chrome-outline; }
+.#{$ionicons-prefix}social-codepen:before { content: $ionicon-var-social-codepen; }
+.#{$ionicons-prefix}social-codepen-outline:before { content: $ionicon-var-social-codepen-outline; }
+.#{$ionicons-prefix}social-css3:before { content: $ionicon-var-social-css3; }
+.#{$ionicons-prefix}social-css3-outline:before { content: $ionicon-var-social-css3-outline; }
+.#{$ionicons-prefix}social-designernews:before { content: $ionicon-var-social-designernews; }
+.#{$ionicons-prefix}social-designernews-outline:before { content: $ionicon-var-social-designernews-outline; }
+.#{$ionicons-prefix}social-dribbble:before { content: $ionicon-var-social-dribbble; }
+.#{$ionicons-prefix}social-dribbble-outline:before { content: $ionicon-var-social-dribbble-outline; }
+.#{$ionicons-prefix}social-dropbox:before { content: $ionicon-var-social-dropbox; }
+.#{$ionicons-prefix}social-dropbox-outline:before { content: $ionicon-var-social-dropbox-outline; }
+.#{$ionicons-prefix}social-euro:before { content: $ionicon-var-social-euro; }
+.#{$ionicons-prefix}social-euro-outline:before { content: $ionicon-var-social-euro-outline; }
+.#{$ionicons-prefix}social-facebook:before { content: $ionicon-var-social-facebook; }
+.#{$ionicons-prefix}social-facebook-outline:before { content: $ionicon-var-social-facebook-outline; }
+.#{$ionicons-prefix}social-foursquare:before { content: $ionicon-var-social-foursquare; }
+.#{$ionicons-prefix}social-foursquare-outline:before { content: $ionicon-var-social-foursquare-outline; }
+.#{$ionicons-prefix}social-freebsd-devil:before { content: $ionicon-var-social-freebsd-devil; }
+.#{$ionicons-prefix}social-github:before { content: $ionicon-var-social-github; }
+.#{$ionicons-prefix}social-github-outline:before { content: $ionicon-var-social-github-outline; }
+.#{$ionicons-prefix}social-google:before { content: $ionicon-var-social-google; }
+.#{$ionicons-prefix}social-google-outline:before { content: $ionicon-var-social-google-outline; }
+.#{$ionicons-prefix}social-googleplus:before { content: $ionicon-var-social-googleplus; }
+.#{$ionicons-prefix}social-googleplus-outline:before { content: $ionicon-var-social-googleplus-outline; }
+.#{$ionicons-prefix}social-hackernews:before { content: $ionicon-var-social-hackernews; }
+.#{$ionicons-prefix}social-hackernews-outline:before { content: $ionicon-var-social-hackernews-outline; }
+.#{$ionicons-prefix}social-html5:before { content: $ionicon-var-social-html5; }
+.#{$ionicons-prefix}social-html5-outline:before { content: $ionicon-var-social-html5-outline; }
+.#{$ionicons-prefix}social-instagram:before { content: $ionicon-var-social-instagram; }
+.#{$ionicons-prefix}social-instagram-outline:before { content: $ionicon-var-social-instagram-outline; }
+.#{$ionicons-prefix}social-javascript:before { content: $ionicon-var-social-javascript; }
+.#{$ionicons-prefix}social-javascript-outline:before { content: $ionicon-var-social-javascript-outline; }
+.#{$ionicons-prefix}social-linkedin:before { content: $ionicon-var-social-linkedin; }
+.#{$ionicons-prefix}social-linkedin-outline:before { content: $ionicon-var-social-linkedin-outline; }
+.#{$ionicons-prefix}social-markdown:before { content: $ionicon-var-social-markdown; }
+.#{$ionicons-prefix}social-nodejs:before { content: $ionicon-var-social-nodejs; }
+.#{$ionicons-prefix}social-octocat:before { content: $ionicon-var-social-octocat; }
+.#{$ionicons-prefix}social-pinterest:before { content: $ionicon-var-social-pinterest; }
+.#{$ionicons-prefix}social-pinterest-outline:before { content: $ionicon-var-social-pinterest-outline; }
+.#{$ionicons-prefix}social-python:before { content: $ionicon-var-social-python; }
+.#{$ionicons-prefix}social-reddit:before { content: $ionicon-var-social-reddit; }
+.#{$ionicons-prefix}social-reddit-outline:before { content: $ionicon-var-social-reddit-outline; }
+.#{$ionicons-prefix}social-rss:before { content: $ionicon-var-social-rss; }
+.#{$ionicons-prefix}social-rss-outline:before { content: $ionicon-var-social-rss-outline; }
+.#{$ionicons-prefix}social-sass:before { content: $ionicon-var-social-sass; }
+.#{$ionicons-prefix}social-skype:before { content: $ionicon-var-social-skype; }
+.#{$ionicons-prefix}social-skype-outline:before { content: $ionicon-var-social-skype-outline; }
+.#{$ionicons-prefix}social-snapchat:before { content: $ionicon-var-social-snapchat; }
+.#{$ionicons-prefix}social-snapchat-outline:before { content: $ionicon-var-social-snapchat-outline; }
+.#{$ionicons-prefix}social-tumblr:before { content: $ionicon-var-social-tumblr; }
+.#{$ionicons-prefix}social-tumblr-outline:before { content: $ionicon-var-social-tumblr-outline; }
+.#{$ionicons-prefix}social-tux:before { content: $ionicon-var-social-tux; }
+.#{$ionicons-prefix}social-twitch:before { content: $ionicon-var-social-twitch; }
+.#{$ionicons-prefix}social-twitch-outline:before { content: $ionicon-var-social-twitch-outline; }
+.#{$ionicons-prefix}social-twitter:before { content: $ionicon-var-social-twitter; }
+.#{$ionicons-prefix}social-twitter-outline:before { content: $ionicon-var-social-twitter-outline; }
+.#{$ionicons-prefix}social-usd:before { content: $ionicon-var-social-usd; }
+.#{$ionicons-prefix}social-usd-outline:before { content: $ionicon-var-social-usd-outline; }
+.#{$ionicons-prefix}social-vimeo:before { content: $ionicon-var-social-vimeo; }
+.#{$ionicons-prefix}social-vimeo-outline:before { content: $ionicon-var-social-vimeo-outline; }
+.#{$ionicons-prefix}social-whatsapp:before { content: $ionicon-var-social-whatsapp; }
+.#{$ionicons-prefix}social-whatsapp-outline:before { content: $ionicon-var-social-whatsapp-outline; }
+.#{$ionicons-prefix}social-windows:before { content: $ionicon-var-social-windows; }
+.#{$ionicons-prefix}social-windows-outline:before { content: $ionicon-var-social-windows-outline; }
+.#{$ionicons-prefix}social-wordpress:before { content: $ionicon-var-social-wordpress; }
+.#{$ionicons-prefix}social-wordpress-outline:before { content: $ionicon-var-social-wordpress-outline; }
+.#{$ionicons-prefix}social-yahoo:before { content: $ionicon-var-social-yahoo; }
+.#{$ionicons-prefix}social-yahoo-outline:before { content: $ionicon-var-social-yahoo-outline; }
+.#{$ionicons-prefix}social-yen:before { content: $ionicon-var-social-yen; }
+.#{$ionicons-prefix}social-yen-outline:before { content: $ionicon-var-social-yen-outline; }
+.#{$ionicons-prefix}social-youtube:before { content: $ionicon-var-social-youtube; }
+.#{$ionicons-prefix}social-youtube-outline:before { content: $ionicon-var-social-youtube-outline; }
+.#{$ionicons-prefix}soup-can:before { content: $ionicon-var-soup-can; }
+.#{$ionicons-prefix}soup-can-outline:before { content: $ionicon-var-soup-can-outline; }
+.#{$ionicons-prefix}speakerphone:before { content: $ionicon-var-speakerphone; }
+.#{$ionicons-prefix}speedometer:before { content: $ionicon-var-speedometer; }
+.#{$ionicons-prefix}spoon:before { content: $ionicon-var-spoon; }
+.#{$ionicons-prefix}star:before { content: $ionicon-var-star; }
+.#{$ionicons-prefix}stats-bars:before { content: $ionicon-var-stats-bars; }
+.#{$ionicons-prefix}steam:before { content: $ionicon-var-steam; }
+.#{$ionicons-prefix}stop:before { content: $ionicon-var-stop; }
+.#{$ionicons-prefix}thermometer:before { content: $ionicon-var-thermometer; }
+.#{$ionicons-prefix}thumbsdown:before { content: $ionicon-var-thumbsdown; }
+.#{$ionicons-prefix}thumbsup:before { content: $ionicon-var-thumbsup; }
+.#{$ionicons-prefix}toggle:before { content: $ionicon-var-toggle; }
+.#{$ionicons-prefix}toggle-filled:before { content: $ionicon-var-toggle-filled; }
+.#{$ionicons-prefix}transgender:before { content: $ionicon-var-transgender; }
+.#{$ionicons-prefix}trash-a:before { content: $ionicon-var-trash-a; }
+.#{$ionicons-prefix}trash-b:before { content: $ionicon-var-trash-b; }
+.#{$ionicons-prefix}trophy:before { content: $ionicon-var-trophy; }
+.#{$ionicons-prefix}tshirt:before { content: $ionicon-var-tshirt; }
+.#{$ionicons-prefix}tshirt-outline:before { content: $ionicon-var-tshirt-outline; }
+.#{$ionicons-prefix}umbrella:before { content: $ionicon-var-umbrella; }
+.#{$ionicons-prefix}university:before { content: $ionicon-var-university; }
+.#{$ionicons-prefix}unlocked:before { content: $ionicon-var-unlocked; }
+.#{$ionicons-prefix}upload:before { content: $ionicon-var-upload; }
+.#{$ionicons-prefix}usb:before { content: $ionicon-var-usb; }
+.#{$ionicons-prefix}videocamera:before { content: $ionicon-var-videocamera; }
+.#{$ionicons-prefix}volume-high:before { content: $ionicon-var-volume-high; }
+.#{$ionicons-prefix}volume-low:before { content: $ionicon-var-volume-low; }
+.#{$ionicons-prefix}volume-medium:before { content: $ionicon-var-volume-medium; }
+.#{$ionicons-prefix}volume-mute:before { content: $ionicon-var-volume-mute; }
+.#{$ionicons-prefix}wand:before { content: $ionicon-var-wand; }
+.#{$ionicons-prefix}waterdrop:before { content: $ionicon-var-waterdrop; }
+.#{$ionicons-prefix}wifi:before { content: $ionicon-var-wifi; }
+.#{$ionicons-prefix}wineglass:before { content: $ionicon-var-wineglass; }
+.#{$ionicons-prefix}woman:before { content: $ionicon-var-woman; }
+.#{$ionicons-prefix}wrench:before { content: $ionicon-var-wrench; }
+.#{$ionicons-prefix}xbox:before { content: $ionicon-var-xbox; } \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-variables.scss b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-variables.scss
new file mode 100644
index 00000000..a4601a94
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-variables.scss
@@ -0,0 +1,741 @@
+// Ionicons Variables
+// --------------------------
+
+$ionicons-font-path: "../fonts" !default;
+$ionicons-font-family: "Ionicons" !default;
+$ionicons-version: "2.0.0" !default;
+$ionicons-prefix: ion- !default;
+
+$ionicon-var-alert: "\f101";
+$ionicon-var-alert-circled: "\f100";
+$ionicon-var-android-add: "\f2c7";
+$ionicon-var-android-add-circle: "\f359";
+$ionicon-var-android-alarm-clock: "\f35a";
+$ionicon-var-android-alert: "\f35b";
+$ionicon-var-android-apps: "\f35c";
+$ionicon-var-android-archive: "\f2c9";
+$ionicon-var-android-arrow-back: "\f2ca";
+$ionicon-var-android-arrow-down: "\f35d";
+$ionicon-var-android-arrow-dropdown: "\f35f";
+$ionicon-var-android-arrow-dropdown-circle: "\f35e";
+$ionicon-var-android-arrow-dropleft: "\f361";
+$ionicon-var-android-arrow-dropleft-circle: "\f360";
+$ionicon-var-android-arrow-dropright: "\f363";
+$ionicon-var-android-arrow-dropright-circle: "\f362";
+$ionicon-var-android-arrow-dropup: "\f365";
+$ionicon-var-android-arrow-dropup-circle: "\f364";
+$ionicon-var-android-arrow-forward: "\f30f";
+$ionicon-var-android-arrow-up: "\f366";
+$ionicon-var-android-attach: "\f367";
+$ionicon-var-android-bar: "\f368";
+$ionicon-var-android-bicycle: "\f369";
+$ionicon-var-android-boat: "\f36a";
+$ionicon-var-android-bookmark: "\f36b";
+$ionicon-var-android-bulb: "\f36c";
+$ionicon-var-android-bus: "\f36d";
+$ionicon-var-android-calendar: "\f2d1";
+$ionicon-var-android-call: "\f2d2";
+$ionicon-var-android-camera: "\f2d3";
+$ionicon-var-android-cancel: "\f36e";
+$ionicon-var-android-car: "\f36f";
+$ionicon-var-android-cart: "\f370";
+$ionicon-var-android-chat: "\f2d4";
+$ionicon-var-android-checkbox: "\f374";
+$ionicon-var-android-checkbox-blank: "\f371";
+$ionicon-var-android-checkbox-outline: "\f373";
+$ionicon-var-android-checkbox-outline-blank: "\f372";
+$ionicon-var-android-checkmark-circle: "\f375";
+$ionicon-var-android-clipboard: "\f376";
+$ionicon-var-android-close: "\f2d7";
+$ionicon-var-android-cloud: "\f37a";
+$ionicon-var-android-cloud-circle: "\f377";
+$ionicon-var-android-cloud-done: "\f378";
+$ionicon-var-android-cloud-outline: "\f379";
+$ionicon-var-android-color-palette: "\f37b";
+$ionicon-var-android-compass: "\f37c";
+$ionicon-var-android-contact: "\f2d8";
+$ionicon-var-android-contacts: "\f2d9";
+$ionicon-var-android-contract: "\f37d";
+$ionicon-var-android-create: "\f37e";
+$ionicon-var-android-delete: "\f37f";
+$ionicon-var-android-desktop: "\f380";
+$ionicon-var-android-document: "\f381";
+$ionicon-var-android-done: "\f383";
+$ionicon-var-android-done-all: "\f382";
+$ionicon-var-android-download: "\f2dd";
+$ionicon-var-android-drafts: "\f384";
+$ionicon-var-android-exit: "\f385";
+$ionicon-var-android-expand: "\f386";
+$ionicon-var-android-favorite: "\f388";
+$ionicon-var-android-favorite-outline: "\f387";
+$ionicon-var-android-film: "\f389";
+$ionicon-var-android-folder: "\f2e0";
+$ionicon-var-android-folder-open: "\f38a";
+$ionicon-var-android-funnel: "\f38b";
+$ionicon-var-android-globe: "\f38c";
+$ionicon-var-android-hand: "\f2e3";
+$ionicon-var-android-hangout: "\f38d";
+$ionicon-var-android-happy: "\f38e";
+$ionicon-var-android-home: "\f38f";
+$ionicon-var-android-image: "\f2e4";
+$ionicon-var-android-laptop: "\f390";
+$ionicon-var-android-list: "\f391";
+$ionicon-var-android-locate: "\f2e9";
+$ionicon-var-android-lock: "\f392";
+$ionicon-var-android-mail: "\f2eb";
+$ionicon-var-android-map: "\f393";
+$ionicon-var-android-menu: "\f394";
+$ionicon-var-android-microphone: "\f2ec";
+$ionicon-var-android-microphone-off: "\f395";
+$ionicon-var-android-more-horizontal: "\f396";
+$ionicon-var-android-more-vertical: "\f397";
+$ionicon-var-android-navigate: "\f398";
+$ionicon-var-android-notifications: "\f39b";
+$ionicon-var-android-notifications-none: "\f399";
+$ionicon-var-android-notifications-off: "\f39a";
+$ionicon-var-android-open: "\f39c";
+$ionicon-var-android-options: "\f39d";
+$ionicon-var-android-people: "\f39e";
+$ionicon-var-android-person: "\f3a0";
+$ionicon-var-android-person-add: "\f39f";
+$ionicon-var-android-phone-landscape: "\f3a1";
+$ionicon-var-android-phone-portrait: "\f3a2";
+$ionicon-var-android-pin: "\f3a3";
+$ionicon-var-android-plane: "\f3a4";
+$ionicon-var-android-playstore: "\f2f0";
+$ionicon-var-android-print: "\f3a5";
+$ionicon-var-android-radio-button-off: "\f3a6";
+$ionicon-var-android-radio-button-on: "\f3a7";
+$ionicon-var-android-refresh: "\f3a8";
+$ionicon-var-android-remove: "\f2f4";
+$ionicon-var-android-remove-circle: "\f3a9";
+$ionicon-var-android-restaurant: "\f3aa";
+$ionicon-var-android-sad: "\f3ab";
+$ionicon-var-android-search: "\f2f5";
+$ionicon-var-android-send: "\f2f6";
+$ionicon-var-android-settings: "\f2f7";
+$ionicon-var-android-share: "\f2f8";
+$ionicon-var-android-share-alt: "\f3ac";
+$ionicon-var-android-star: "\f2fc";
+$ionicon-var-android-star-half: "\f3ad";
+$ionicon-var-android-star-outline: "\f3ae";
+$ionicon-var-android-stopwatch: "\f2fd";
+$ionicon-var-android-subway: "\f3af";
+$ionicon-var-android-sunny: "\f3b0";
+$ionicon-var-android-sync: "\f3b1";
+$ionicon-var-android-textsms: "\f3b2";
+$ionicon-var-android-time: "\f3b3";
+$ionicon-var-android-train: "\f3b4";
+$ionicon-var-android-unlock: "\f3b5";
+$ionicon-var-android-upload: "\f3b6";
+$ionicon-var-android-volume-down: "\f3b7";
+$ionicon-var-android-volume-mute: "\f3b8";
+$ionicon-var-android-volume-off: "\f3b9";
+$ionicon-var-android-volume-up: "\f3ba";
+$ionicon-var-android-walk: "\f3bb";
+$ionicon-var-android-warning: "\f3bc";
+$ionicon-var-android-watch: "\f3bd";
+$ionicon-var-android-wifi: "\f305";
+$ionicon-var-aperture: "\f313";
+$ionicon-var-archive: "\f102";
+$ionicon-var-arrow-down-a: "\f103";
+$ionicon-var-arrow-down-b: "\f104";
+$ionicon-var-arrow-down-c: "\f105";
+$ionicon-var-arrow-expand: "\f25e";
+$ionicon-var-arrow-graph-down-left: "\f25f";
+$ionicon-var-arrow-graph-down-right: "\f260";
+$ionicon-var-arrow-graph-up-left: "\f261";
+$ionicon-var-arrow-graph-up-right: "\f262";
+$ionicon-var-arrow-left-a: "\f106";
+$ionicon-var-arrow-left-b: "\f107";
+$ionicon-var-arrow-left-c: "\f108";
+$ionicon-var-arrow-move: "\f263";
+$ionicon-var-arrow-resize: "\f264";
+$ionicon-var-arrow-return-left: "\f265";
+$ionicon-var-arrow-return-right: "\f266";
+$ionicon-var-arrow-right-a: "\f109";
+$ionicon-var-arrow-right-b: "\f10a";
+$ionicon-var-arrow-right-c: "\f10b";
+$ionicon-var-arrow-shrink: "\f267";
+$ionicon-var-arrow-swap: "\f268";
+$ionicon-var-arrow-up-a: "\f10c";
+$ionicon-var-arrow-up-b: "\f10d";
+$ionicon-var-arrow-up-c: "\f10e";
+$ionicon-var-asterisk: "\f314";
+$ionicon-var-at: "\f10f";
+$ionicon-var-backspace: "\f3bf";
+$ionicon-var-backspace-outline: "\f3be";
+$ionicon-var-bag: "\f110";
+$ionicon-var-battery-charging: "\f111";
+$ionicon-var-battery-empty: "\f112";
+$ionicon-var-battery-full: "\f113";
+$ionicon-var-battery-half: "\f114";
+$ionicon-var-battery-low: "\f115";
+$ionicon-var-beaker: "\f269";
+$ionicon-var-beer: "\f26a";
+$ionicon-var-bluetooth: "\f116";
+$ionicon-var-bonfire: "\f315";
+$ionicon-var-bookmark: "\f26b";
+$ionicon-var-bowtie: "\f3c0";
+$ionicon-var-briefcase: "\f26c";
+$ionicon-var-bug: "\f2be";
+$ionicon-var-calculator: "\f26d";
+$ionicon-var-calendar: "\f117";
+$ionicon-var-camera: "\f118";
+$ionicon-var-card: "\f119";
+$ionicon-var-cash: "\f316";
+$ionicon-var-chatbox: "\f11b";
+$ionicon-var-chatbox-working: "\f11a";
+$ionicon-var-chatboxes: "\f11c";
+$ionicon-var-chatbubble: "\f11e";
+$ionicon-var-chatbubble-working: "\f11d";
+$ionicon-var-chatbubbles: "\f11f";
+$ionicon-var-checkmark: "\f122";
+$ionicon-var-checkmark-circled: "\f120";
+$ionicon-var-checkmark-round: "\f121";
+$ionicon-var-chevron-down: "\f123";
+$ionicon-var-chevron-left: "\f124";
+$ionicon-var-chevron-right: "\f125";
+$ionicon-var-chevron-up: "\f126";
+$ionicon-var-clipboard: "\f127";
+$ionicon-var-clock: "\f26e";
+$ionicon-var-close: "\f12a";
+$ionicon-var-close-circled: "\f128";
+$ionicon-var-close-round: "\f129";
+$ionicon-var-closed-captioning: "\f317";
+$ionicon-var-cloud: "\f12b";
+$ionicon-var-code: "\f271";
+$ionicon-var-code-download: "\f26f";
+$ionicon-var-code-working: "\f270";
+$ionicon-var-coffee: "\f272";
+$ionicon-var-compass: "\f273";
+$ionicon-var-compose: "\f12c";
+$ionicon-var-connection-bars: "\f274";
+$ionicon-var-contrast: "\f275";
+$ionicon-var-crop: "\f3c1";
+$ionicon-var-cube: "\f318";
+$ionicon-var-disc: "\f12d";
+$ionicon-var-document: "\f12f";
+$ionicon-var-document-text: "\f12e";
+$ionicon-var-drag: "\f130";
+$ionicon-var-earth: "\f276";
+$ionicon-var-easel: "\f3c2";
+$ionicon-var-edit: "\f2bf";
+$ionicon-var-egg: "\f277";
+$ionicon-var-eject: "\f131";
+$ionicon-var-email: "\f132";
+$ionicon-var-email-unread: "\f3c3";
+$ionicon-var-erlenmeyer-flask: "\f3c5";
+$ionicon-var-erlenmeyer-flask-bubbles: "\f3c4";
+$ionicon-var-eye: "\f133";
+$ionicon-var-eye-disabled: "\f306";
+$ionicon-var-female: "\f278";
+$ionicon-var-filing: "\f134";
+$ionicon-var-film-marker: "\f135";
+$ionicon-var-fireball: "\f319";
+$ionicon-var-flag: "\f279";
+$ionicon-var-flame: "\f31a";
+$ionicon-var-flash: "\f137";
+$ionicon-var-flash-off: "\f136";
+$ionicon-var-folder: "\f139";
+$ionicon-var-fork: "\f27a";
+$ionicon-var-fork-repo: "\f2c0";
+$ionicon-var-forward: "\f13a";
+$ionicon-var-funnel: "\f31b";
+$ionicon-var-gear-a: "\f13d";
+$ionicon-var-gear-b: "\f13e";
+$ionicon-var-grid: "\f13f";
+$ionicon-var-hammer: "\f27b";
+$ionicon-var-happy: "\f31c";
+$ionicon-var-happy-outline: "\f3c6";
+$ionicon-var-headphone: "\f140";
+$ionicon-var-heart: "\f141";
+$ionicon-var-heart-broken: "\f31d";
+$ionicon-var-help: "\f143";
+$ionicon-var-help-buoy: "\f27c";
+$ionicon-var-help-circled: "\f142";
+$ionicon-var-home: "\f144";
+$ionicon-var-icecream: "\f27d";
+$ionicon-var-image: "\f147";
+$ionicon-var-images: "\f148";
+$ionicon-var-information: "\f14a";
+$ionicon-var-information-circled: "\f149";
+$ionicon-var-ionic: "\f14b";
+$ionicon-var-ios-alarm: "\f3c8";
+$ionicon-var-ios-alarm-outline: "\f3c7";
+$ionicon-var-ios-albums: "\f3ca";
+$ionicon-var-ios-albums-outline: "\f3c9";
+$ionicon-var-ios-americanfootball: "\f3cc";
+$ionicon-var-ios-americanfootball-outline: "\f3cb";
+$ionicon-var-ios-analytics: "\f3ce";
+$ionicon-var-ios-analytics-outline: "\f3cd";
+$ionicon-var-ios-arrow-back: "\f3cf";
+$ionicon-var-ios-arrow-down: "\f3d0";
+$ionicon-var-ios-arrow-forward: "\f3d1";
+$ionicon-var-ios-arrow-left: "\f3d2";
+$ionicon-var-ios-arrow-right: "\f3d3";
+$ionicon-var-ios-arrow-thin-down: "\f3d4";
+$ionicon-var-ios-arrow-thin-left: "\f3d5";
+$ionicon-var-ios-arrow-thin-right: "\f3d6";
+$ionicon-var-ios-arrow-thin-up: "\f3d7";
+$ionicon-var-ios-arrow-up: "\f3d8";
+$ionicon-var-ios-at: "\f3da";
+$ionicon-var-ios-at-outline: "\f3d9";
+$ionicon-var-ios-barcode: "\f3dc";
+$ionicon-var-ios-barcode-outline: "\f3db";
+$ionicon-var-ios-baseball: "\f3de";
+$ionicon-var-ios-baseball-outline: "\f3dd";
+$ionicon-var-ios-basketball: "\f3e0";
+$ionicon-var-ios-basketball-outline: "\f3df";
+$ionicon-var-ios-bell: "\f3e2";
+$ionicon-var-ios-bell-outline: "\f3e1";
+$ionicon-var-ios-body: "\f3e4";
+$ionicon-var-ios-body-outline: "\f3e3";
+$ionicon-var-ios-bolt: "\f3e6";
+$ionicon-var-ios-bolt-outline: "\f3e5";
+$ionicon-var-ios-book: "\f3e8";
+$ionicon-var-ios-book-outline: "\f3e7";
+$ionicon-var-ios-bookmarks: "\f3ea";
+$ionicon-var-ios-bookmarks-outline: "\f3e9";
+$ionicon-var-ios-box: "\f3ec";
+$ionicon-var-ios-box-outline: "\f3eb";
+$ionicon-var-ios-briefcase: "\f3ee";
+$ionicon-var-ios-briefcase-outline: "\f3ed";
+$ionicon-var-ios-browsers: "\f3f0";
+$ionicon-var-ios-browsers-outline: "\f3ef";
+$ionicon-var-ios-calculator: "\f3f2";
+$ionicon-var-ios-calculator-outline: "\f3f1";
+$ionicon-var-ios-calendar: "\f3f4";
+$ionicon-var-ios-calendar-outline: "\f3f3";
+$ionicon-var-ios-camera: "\f3f6";
+$ionicon-var-ios-camera-outline: "\f3f5";
+$ionicon-var-ios-cart: "\f3f8";
+$ionicon-var-ios-cart-outline: "\f3f7";
+$ionicon-var-ios-chatboxes: "\f3fa";
+$ionicon-var-ios-chatboxes-outline: "\f3f9";
+$ionicon-var-ios-chatbubble: "\f3fc";
+$ionicon-var-ios-chatbubble-outline: "\f3fb";
+$ionicon-var-ios-checkmark: "\f3ff";
+$ionicon-var-ios-checkmark-empty: "\f3fd";
+$ionicon-var-ios-checkmark-outline: "\f3fe";
+$ionicon-var-ios-circle-filled: "\f400";
+$ionicon-var-ios-circle-outline: "\f401";
+$ionicon-var-ios-clock: "\f403";
+$ionicon-var-ios-clock-outline: "\f402";
+$ionicon-var-ios-close: "\f406";
+$ionicon-var-ios-close-empty: "\f404";
+$ionicon-var-ios-close-outline: "\f405";
+$ionicon-var-ios-cloud: "\f40c";
+$ionicon-var-ios-cloud-download: "\f408";
+$ionicon-var-ios-cloud-download-outline: "\f407";
+$ionicon-var-ios-cloud-outline: "\f409";
+$ionicon-var-ios-cloud-upload: "\f40b";
+$ionicon-var-ios-cloud-upload-outline: "\f40a";
+$ionicon-var-ios-cloudy: "\f410";
+$ionicon-var-ios-cloudy-night: "\f40e";
+$ionicon-var-ios-cloudy-night-outline: "\f40d";
+$ionicon-var-ios-cloudy-outline: "\f40f";
+$ionicon-var-ios-cog: "\f412";
+$ionicon-var-ios-cog-outline: "\f411";
+$ionicon-var-ios-color-filter: "\f414";
+$ionicon-var-ios-color-filter-outline: "\f413";
+$ionicon-var-ios-color-wand: "\f416";
+$ionicon-var-ios-color-wand-outline: "\f415";
+$ionicon-var-ios-compose: "\f418";
+$ionicon-var-ios-compose-outline: "\f417";
+$ionicon-var-ios-contact: "\f41a";
+$ionicon-var-ios-contact-outline: "\f419";
+$ionicon-var-ios-copy: "\f41c";
+$ionicon-var-ios-copy-outline: "\f41b";
+$ionicon-var-ios-crop: "\f41e";
+$ionicon-var-ios-crop-strong: "\f41d";
+$ionicon-var-ios-download: "\f420";
+$ionicon-var-ios-download-outline: "\f41f";
+$ionicon-var-ios-drag: "\f421";
+$ionicon-var-ios-email: "\f423";
+$ionicon-var-ios-email-outline: "\f422";
+$ionicon-var-ios-eye: "\f425";
+$ionicon-var-ios-eye-outline: "\f424";
+$ionicon-var-ios-fastforward: "\f427";
+$ionicon-var-ios-fastforward-outline: "\f426";
+$ionicon-var-ios-filing: "\f429";
+$ionicon-var-ios-filing-outline: "\f428";
+$ionicon-var-ios-film: "\f42b";
+$ionicon-var-ios-film-outline: "\f42a";
+$ionicon-var-ios-flag: "\f42d";
+$ionicon-var-ios-flag-outline: "\f42c";
+$ionicon-var-ios-flame: "\f42f";
+$ionicon-var-ios-flame-outline: "\f42e";
+$ionicon-var-ios-flask: "\f431";
+$ionicon-var-ios-flask-outline: "\f430";
+$ionicon-var-ios-flower: "\f433";
+$ionicon-var-ios-flower-outline: "\f432";
+$ionicon-var-ios-folder: "\f435";
+$ionicon-var-ios-folder-outline: "\f434";
+$ionicon-var-ios-football: "\f437";
+$ionicon-var-ios-football-outline: "\f436";
+$ionicon-var-ios-game-controller-a: "\f439";
+$ionicon-var-ios-game-controller-a-outline: "\f438";
+$ionicon-var-ios-game-controller-b: "\f43b";
+$ionicon-var-ios-game-controller-b-outline: "\f43a";
+$ionicon-var-ios-gear: "\f43d";
+$ionicon-var-ios-gear-outline: "\f43c";
+$ionicon-var-ios-glasses: "\f43f";
+$ionicon-var-ios-glasses-outline: "\f43e";
+$ionicon-var-ios-grid-view: "\f441";
+$ionicon-var-ios-grid-view-outline: "\f440";
+$ionicon-var-ios-heart: "\f443";
+$ionicon-var-ios-heart-outline: "\f442";
+$ionicon-var-ios-help: "\f446";
+$ionicon-var-ios-help-empty: "\f444";
+$ionicon-var-ios-help-outline: "\f445";
+$ionicon-var-ios-home: "\f448";
+$ionicon-var-ios-home-outline: "\f447";
+$ionicon-var-ios-infinite: "\f44a";
+$ionicon-var-ios-infinite-outline: "\f449";
+$ionicon-var-ios-information: "\f44d";
+$ionicon-var-ios-information-empty: "\f44b";
+$ionicon-var-ios-information-outline: "\f44c";
+$ionicon-var-ios-ionic-outline: "\f44e";
+$ionicon-var-ios-keypad: "\f450";
+$ionicon-var-ios-keypad-outline: "\f44f";
+$ionicon-var-ios-lightbulb: "\f452";
+$ionicon-var-ios-lightbulb-outline: "\f451";
+$ionicon-var-ios-list: "\f454";
+$ionicon-var-ios-list-outline: "\f453";
+$ionicon-var-ios-location: "\f456";
+$ionicon-var-ios-location-outline: "\f455";
+$ionicon-var-ios-locked: "\f458";
+$ionicon-var-ios-locked-outline: "\f457";
+$ionicon-var-ios-loop: "\f45a";
+$ionicon-var-ios-loop-strong: "\f459";
+$ionicon-var-ios-medical: "\f45c";
+$ionicon-var-ios-medical-outline: "\f45b";
+$ionicon-var-ios-medkit: "\f45e";
+$ionicon-var-ios-medkit-outline: "\f45d";
+$ionicon-var-ios-mic: "\f461";
+$ionicon-var-ios-mic-off: "\f45f";
+$ionicon-var-ios-mic-outline: "\f460";
+$ionicon-var-ios-minus: "\f464";
+$ionicon-var-ios-minus-empty: "\f462";
+$ionicon-var-ios-minus-outline: "\f463";
+$ionicon-var-ios-monitor: "\f466";
+$ionicon-var-ios-monitor-outline: "\f465";
+$ionicon-var-ios-moon: "\f468";
+$ionicon-var-ios-moon-outline: "\f467";
+$ionicon-var-ios-more: "\f46a";
+$ionicon-var-ios-more-outline: "\f469";
+$ionicon-var-ios-musical-note: "\f46b";
+$ionicon-var-ios-musical-notes: "\f46c";
+$ionicon-var-ios-navigate: "\f46e";
+$ionicon-var-ios-navigate-outline: "\f46d";
+$ionicon-var-ios-nutrition: "\f470";
+$ionicon-var-ios-nutrition-outline: "\f46f";
+$ionicon-var-ios-paper: "\f472";
+$ionicon-var-ios-paper-outline: "\f471";
+$ionicon-var-ios-paperplane: "\f474";
+$ionicon-var-ios-paperplane-outline: "\f473";
+$ionicon-var-ios-partlysunny: "\f476";
+$ionicon-var-ios-partlysunny-outline: "\f475";
+$ionicon-var-ios-pause: "\f478";
+$ionicon-var-ios-pause-outline: "\f477";
+$ionicon-var-ios-paw: "\f47a";
+$ionicon-var-ios-paw-outline: "\f479";
+$ionicon-var-ios-people: "\f47c";
+$ionicon-var-ios-people-outline: "\f47b";
+$ionicon-var-ios-person: "\f47e";
+$ionicon-var-ios-person-outline: "\f47d";
+$ionicon-var-ios-personadd: "\f480";
+$ionicon-var-ios-personadd-outline: "\f47f";
+$ionicon-var-ios-photos: "\f482";
+$ionicon-var-ios-photos-outline: "\f481";
+$ionicon-var-ios-pie: "\f484";
+$ionicon-var-ios-pie-outline: "\f483";
+$ionicon-var-ios-pint: "\f486";
+$ionicon-var-ios-pint-outline: "\f485";
+$ionicon-var-ios-play: "\f488";
+$ionicon-var-ios-play-outline: "\f487";
+$ionicon-var-ios-plus: "\f48b";
+$ionicon-var-ios-plus-empty: "\f489";
+$ionicon-var-ios-plus-outline: "\f48a";
+$ionicon-var-ios-pricetag: "\f48d";
+$ionicon-var-ios-pricetag-outline: "\f48c";
+$ionicon-var-ios-pricetags: "\f48f";
+$ionicon-var-ios-pricetags-outline: "\f48e";
+$ionicon-var-ios-printer: "\f491";
+$ionicon-var-ios-printer-outline: "\f490";
+$ionicon-var-ios-pulse: "\f493";
+$ionicon-var-ios-pulse-strong: "\f492";
+$ionicon-var-ios-rainy: "\f495";
+$ionicon-var-ios-rainy-outline: "\f494";
+$ionicon-var-ios-recording: "\f497";
+$ionicon-var-ios-recording-outline: "\f496";
+$ionicon-var-ios-redo: "\f499";
+$ionicon-var-ios-redo-outline: "\f498";
+$ionicon-var-ios-refresh: "\f49c";
+$ionicon-var-ios-refresh-empty: "\f49a";
+$ionicon-var-ios-refresh-outline: "\f49b";
+$ionicon-var-ios-reload: "\f49d";
+$ionicon-var-ios-reverse-camera: "\f49f";
+$ionicon-var-ios-reverse-camera-outline: "\f49e";
+$ionicon-var-ios-rewind: "\f4a1";
+$ionicon-var-ios-rewind-outline: "\f4a0";
+$ionicon-var-ios-rose: "\f4a3";
+$ionicon-var-ios-rose-outline: "\f4a2";
+$ionicon-var-ios-search: "\f4a5";
+$ionicon-var-ios-search-strong: "\f4a4";
+$ionicon-var-ios-settings: "\f4a7";
+$ionicon-var-ios-settings-strong: "\f4a6";
+$ionicon-var-ios-shuffle: "\f4a9";
+$ionicon-var-ios-shuffle-strong: "\f4a8";
+$ionicon-var-ios-skipbackward: "\f4ab";
+$ionicon-var-ios-skipbackward-outline: "\f4aa";
+$ionicon-var-ios-skipforward: "\f4ad";
+$ionicon-var-ios-skipforward-outline: "\f4ac";
+$ionicon-var-ios-snowy: "\f4ae";
+$ionicon-var-ios-speedometer: "\f4b0";
+$ionicon-var-ios-speedometer-outline: "\f4af";
+$ionicon-var-ios-star: "\f4b3";
+$ionicon-var-ios-star-half: "\f4b1";
+$ionicon-var-ios-star-outline: "\f4b2";
+$ionicon-var-ios-stopwatch: "\f4b5";
+$ionicon-var-ios-stopwatch-outline: "\f4b4";
+$ionicon-var-ios-sunny: "\f4b7";
+$ionicon-var-ios-sunny-outline: "\f4b6";
+$ionicon-var-ios-telephone: "\f4b9";
+$ionicon-var-ios-telephone-outline: "\f4b8";
+$ionicon-var-ios-tennisball: "\f4bb";
+$ionicon-var-ios-tennisball-outline: "\f4ba";
+$ionicon-var-ios-thunderstorm: "\f4bd";
+$ionicon-var-ios-thunderstorm-outline: "\f4bc";
+$ionicon-var-ios-time: "\f4bf";
+$ionicon-var-ios-time-outline: "\f4be";
+$ionicon-var-ios-timer: "\f4c1";
+$ionicon-var-ios-timer-outline: "\f4c0";
+$ionicon-var-ios-toggle: "\f4c3";
+$ionicon-var-ios-toggle-outline: "\f4c2";
+$ionicon-var-ios-trash: "\f4c5";
+$ionicon-var-ios-trash-outline: "\f4c4";
+$ionicon-var-ios-undo: "\f4c7";
+$ionicon-var-ios-undo-outline: "\f4c6";
+$ionicon-var-ios-unlocked: "\f4c9";
+$ionicon-var-ios-unlocked-outline: "\f4c8";
+$ionicon-var-ios-upload: "\f4cb";
+$ionicon-var-ios-upload-outline: "\f4ca";
+$ionicon-var-ios-videocam: "\f4cd";
+$ionicon-var-ios-videocam-outline: "\f4cc";
+$ionicon-var-ios-volume-high: "\f4ce";
+$ionicon-var-ios-volume-low: "\f4cf";
+$ionicon-var-ios-wineglass: "\f4d1";
+$ionicon-var-ios-wineglass-outline: "\f4d0";
+$ionicon-var-ios-world: "\f4d3";
+$ionicon-var-ios-world-outline: "\f4d2";
+$ionicon-var-ipad: "\f1f9";
+$ionicon-var-iphone: "\f1fa";
+$ionicon-var-ipod: "\f1fb";
+$ionicon-var-jet: "\f295";
+$ionicon-var-key: "\f296";
+$ionicon-var-knife: "\f297";
+$ionicon-var-laptop: "\f1fc";
+$ionicon-var-leaf: "\f1fd";
+$ionicon-var-levels: "\f298";
+$ionicon-var-lightbulb: "\f299";
+$ionicon-var-link: "\f1fe";
+$ionicon-var-load-a: "\f29a";
+$ionicon-var-load-b: "\f29b";
+$ionicon-var-load-c: "\f29c";
+$ionicon-var-load-d: "\f29d";
+$ionicon-var-location: "\f1ff";
+$ionicon-var-lock-combination: "\f4d4";
+$ionicon-var-locked: "\f200";
+$ionicon-var-log-in: "\f29e";
+$ionicon-var-log-out: "\f29f";
+$ionicon-var-loop: "\f201";
+$ionicon-var-magnet: "\f2a0";
+$ionicon-var-male: "\f2a1";
+$ionicon-var-man: "\f202";
+$ionicon-var-map: "\f203";
+$ionicon-var-medkit: "\f2a2";
+$ionicon-var-merge: "\f33f";
+$ionicon-var-mic-a: "\f204";
+$ionicon-var-mic-b: "\f205";
+$ionicon-var-mic-c: "\f206";
+$ionicon-var-minus: "\f209";
+$ionicon-var-minus-circled: "\f207";
+$ionicon-var-minus-round: "\f208";
+$ionicon-var-model-s: "\f2c1";
+$ionicon-var-monitor: "\f20a";
+$ionicon-var-more: "\f20b";
+$ionicon-var-mouse: "\f340";
+$ionicon-var-music-note: "\f20c";
+$ionicon-var-navicon: "\f20e";
+$ionicon-var-navicon-round: "\f20d";
+$ionicon-var-navigate: "\f2a3";
+$ionicon-var-network: "\f341";
+$ionicon-var-no-smoking: "\f2c2";
+$ionicon-var-nuclear: "\f2a4";
+$ionicon-var-outlet: "\f342";
+$ionicon-var-paintbrush: "\f4d5";
+$ionicon-var-paintbucket: "\f4d6";
+$ionicon-var-paper-airplane: "\f2c3";
+$ionicon-var-paperclip: "\f20f";
+$ionicon-var-pause: "\f210";
+$ionicon-var-person: "\f213";
+$ionicon-var-person-add: "\f211";
+$ionicon-var-person-stalker: "\f212";
+$ionicon-var-pie-graph: "\f2a5";
+$ionicon-var-pin: "\f2a6";
+$ionicon-var-pinpoint: "\f2a7";
+$ionicon-var-pizza: "\f2a8";
+$ionicon-var-plane: "\f214";
+$ionicon-var-planet: "\f343";
+$ionicon-var-play: "\f215";
+$ionicon-var-playstation: "\f30a";
+$ionicon-var-plus: "\f218";
+$ionicon-var-plus-circled: "\f216";
+$ionicon-var-plus-round: "\f217";
+$ionicon-var-podium: "\f344";
+$ionicon-var-pound: "\f219";
+$ionicon-var-power: "\f2a9";
+$ionicon-var-pricetag: "\f2aa";
+$ionicon-var-pricetags: "\f2ab";
+$ionicon-var-printer: "\f21a";
+$ionicon-var-pull-request: "\f345";
+$ionicon-var-qr-scanner: "\f346";
+$ionicon-var-quote: "\f347";
+$ionicon-var-radio-waves: "\f2ac";
+$ionicon-var-record: "\f21b";
+$ionicon-var-refresh: "\f21c";
+$ionicon-var-reply: "\f21e";
+$ionicon-var-reply-all: "\f21d";
+$ionicon-var-ribbon-a: "\f348";
+$ionicon-var-ribbon-b: "\f349";
+$ionicon-var-sad: "\f34a";
+$ionicon-var-sad-outline: "\f4d7";
+$ionicon-var-scissors: "\f34b";
+$ionicon-var-search: "\f21f";
+$ionicon-var-settings: "\f2ad";
+$ionicon-var-share: "\f220";
+$ionicon-var-shuffle: "\f221";
+$ionicon-var-skip-backward: "\f222";
+$ionicon-var-skip-forward: "\f223";
+$ionicon-var-social-android: "\f225";
+$ionicon-var-social-android-outline: "\f224";
+$ionicon-var-social-angular: "\f4d9";
+$ionicon-var-social-angular-outline: "\f4d8";
+$ionicon-var-social-apple: "\f227";
+$ionicon-var-social-apple-outline: "\f226";
+$ionicon-var-social-bitcoin: "\f2af";
+$ionicon-var-social-bitcoin-outline: "\f2ae";
+$ionicon-var-social-buffer: "\f229";
+$ionicon-var-social-buffer-outline: "\f228";
+$ionicon-var-social-chrome: "\f4db";
+$ionicon-var-social-chrome-outline: "\f4da";
+$ionicon-var-social-codepen: "\f4dd";
+$ionicon-var-social-codepen-outline: "\f4dc";
+$ionicon-var-social-css3: "\f4df";
+$ionicon-var-social-css3-outline: "\f4de";
+$ionicon-var-social-designernews: "\f22b";
+$ionicon-var-social-designernews-outline: "\f22a";
+$ionicon-var-social-dribbble: "\f22d";
+$ionicon-var-social-dribbble-outline: "\f22c";
+$ionicon-var-social-dropbox: "\f22f";
+$ionicon-var-social-dropbox-outline: "\f22e";
+$ionicon-var-social-euro: "\f4e1";
+$ionicon-var-social-euro-outline: "\f4e0";
+$ionicon-var-social-facebook: "\f231";
+$ionicon-var-social-facebook-outline: "\f230";
+$ionicon-var-social-foursquare: "\f34d";
+$ionicon-var-social-foursquare-outline: "\f34c";
+$ionicon-var-social-freebsd-devil: "\f2c4";
+$ionicon-var-social-github: "\f233";
+$ionicon-var-social-github-outline: "\f232";
+$ionicon-var-social-google: "\f34f";
+$ionicon-var-social-google-outline: "\f34e";
+$ionicon-var-social-googleplus: "\f235";
+$ionicon-var-social-googleplus-outline: "\f234";
+$ionicon-var-social-hackernews: "\f237";
+$ionicon-var-social-hackernews-outline: "\f236";
+$ionicon-var-social-html5: "\f4e3";
+$ionicon-var-social-html5-outline: "\f4e2";
+$ionicon-var-social-instagram: "\f351";
+$ionicon-var-social-instagram-outline: "\f350";
+$ionicon-var-social-javascript: "\f4e5";
+$ionicon-var-social-javascript-outline: "\f4e4";
+$ionicon-var-social-linkedin: "\f239";
+$ionicon-var-social-linkedin-outline: "\f238";
+$ionicon-var-social-markdown: "\f4e6";
+$ionicon-var-social-nodejs: "\f4e7";
+$ionicon-var-social-octocat: "\f4e8";
+$ionicon-var-social-pinterest: "\f2b1";
+$ionicon-var-social-pinterest-outline: "\f2b0";
+$ionicon-var-social-python: "\f4e9";
+$ionicon-var-social-reddit: "\f23b";
+$ionicon-var-social-reddit-outline: "\f23a";
+$ionicon-var-social-rss: "\f23d";
+$ionicon-var-social-rss-outline: "\f23c";
+$ionicon-var-social-sass: "\f4ea";
+$ionicon-var-social-skype: "\f23f";
+$ionicon-var-social-skype-outline: "\f23e";
+$ionicon-var-social-snapchat: "\f4ec";
+$ionicon-var-social-snapchat-outline: "\f4eb";
+$ionicon-var-social-tumblr: "\f241";
+$ionicon-var-social-tumblr-outline: "\f240";
+$ionicon-var-social-tux: "\f2c5";
+$ionicon-var-social-twitch: "\f4ee";
+$ionicon-var-social-twitch-outline: "\f4ed";
+$ionicon-var-social-twitter: "\f243";
+$ionicon-var-social-twitter-outline: "\f242";
+$ionicon-var-social-usd: "\f353";
+$ionicon-var-social-usd-outline: "\f352";
+$ionicon-var-social-vimeo: "\f245";
+$ionicon-var-social-vimeo-outline: "\f244";
+$ionicon-var-social-whatsapp: "\f4f0";
+$ionicon-var-social-whatsapp-outline: "\f4ef";
+$ionicon-var-social-windows: "\f247";
+$ionicon-var-social-windows-outline: "\f246";
+$ionicon-var-social-wordpress: "\f249";
+$ionicon-var-social-wordpress-outline: "\f248";
+$ionicon-var-social-yahoo: "\f24b";
+$ionicon-var-social-yahoo-outline: "\f24a";
+$ionicon-var-social-yen: "\f4f2";
+$ionicon-var-social-yen-outline: "\f4f1";
+$ionicon-var-social-youtube: "\f24d";
+$ionicon-var-social-youtube-outline: "\f24c";
+$ionicon-var-soup-can: "\f4f4";
+$ionicon-var-soup-can-outline: "\f4f3";
+$ionicon-var-speakerphone: "\f2b2";
+$ionicon-var-speedometer: "\f2b3";
+$ionicon-var-spoon: "\f2b4";
+$ionicon-var-star: "\f24e";
+$ionicon-var-stats-bars: "\f2b5";
+$ionicon-var-steam: "\f30b";
+$ionicon-var-stop: "\f24f";
+$ionicon-var-thermometer: "\f2b6";
+$ionicon-var-thumbsdown: "\f250";
+$ionicon-var-thumbsup: "\f251";
+$ionicon-var-toggle: "\f355";
+$ionicon-var-toggle-filled: "\f354";
+$ionicon-var-transgender: "\f4f5";
+$ionicon-var-trash-a: "\f252";
+$ionicon-var-trash-b: "\f253";
+$ionicon-var-trophy: "\f356";
+$ionicon-var-tshirt: "\f4f7";
+$ionicon-var-tshirt-outline: "\f4f6";
+$ionicon-var-umbrella: "\f2b7";
+$ionicon-var-university: "\f357";
+$ionicon-var-unlocked: "\f254";
+$ionicon-var-upload: "\f255";
+$ionicon-var-usb: "\f2b8";
+$ionicon-var-videocamera: "\f256";
+$ionicon-var-volume-high: "\f257";
+$ionicon-var-volume-low: "\f258";
+$ionicon-var-volume-medium: "\f259";
+$ionicon-var-volume-mute: "\f25a";
+$ionicon-var-wand: "\f358";
+$ionicon-var-waterdrop: "\f25b";
+$ionicon-var-wifi: "\f25c";
+$ionicon-var-wineglass: "\f2b9";
+$ionicon-var-woman: "\f25d";
+$ionicon-var-wrench: "\f2ba";
+$ionicon-var-xbox: "\f30c"; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/ionicons.scss b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/ionicons.scss
new file mode 100644
index 00000000..d2c79f9e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/ionicons.scss
@@ -0,0 +1,15 @@
+@import "ionicons-variables";
+/*!
+ Ionicons, v#{$ionicons-version}
+ Created by Ben Sperry for the Ionic Framework, http://ionicons.com/
+ https://twitter.com/benjsperry https://twitter.com/ionicframework
+ MIT License: https://github.com/driftyco/ionicons
+
+ Android-style icons originally built by Google’s
+ Material Design Icons: https://github.com/google/material-design-icons
+ used under CC BY http://creativecommons.org/licenses/by/4.0/
+ Modified icons to fit ionicon’s grid from original.
+*/
+
+@import "ionicons-font";
+@import "ionicons-icons";
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/alert-circled.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/alert-circled.svg
new file mode 100644
index 00000000..b6fccd72
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/alert-circled.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M476.7,422.2L270.1,72.7c-2.9-5-8.3-8.7-14.1-8.7c-5.9,0-11.3,3.7-14.1,8.7L35.3,422.2c-2.8,5-4.8,13-1.9,17.9
+ c2.9,4.9,8.2,7.9,14,7.9h417.1c5.8,0,11.1-3,14-7.9C481.5,435.2,479.5,427.1,476.7,422.2z M288,400h-64v-48h64V400z M288,320h-64
+ V176h64V320z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/alert.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/alert.svg
new file mode 100644
index 00000000..b1a1c1f3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/alert.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M320,480H192v-96h128V480z M304,320h-96L192,32h128L304,320z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-add-circle.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-add-circle.svg
new file mode 100644
index 00000000..af6a7c65
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-add-circle.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M256,48C141.125,48,48,141.125,48,256s93.125,208,208,208s208-93.125,208-208S370.875,48,256,48z M363,277h-86v86h-42v-86
+ h-86v-42h86v-86h42v86h86V277z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-add.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-add.svg
new file mode 100644
index 00000000..3ef4c9df
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-add.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_7_">
+ <g>
+ <path d="M416,277.333H277.333V416h-42.666V277.333H96v-42.666h138.667V96h42.666v138.667H416V277.333z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-alarm-clock.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-alarm-clock.svg
new file mode 100644
index 00000000..395e52f4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-alarm-clock.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_2_">
+ <g>
+ <path d="M470,124.837l-98.443-81.78l-27.814,32.931l98.442,81.769L470,124.837z M167.192,74.919L139.366,42L42,124.837
+ l27.814,32.919L167.192,74.919z M266.701,172.628h-32.101v127.446l101.649,60.539l16.051-26.553l-85.6-49.917V172.628z
+ M256,87.665c-107,0-192.601,86.021-192.601,191.166C63.399,383.98,149,470,256,470c105.936,0,192.601-86.02,192.601-191.169
+ C448.601,173.687,361.936,87.665,256,87.665z M256,427.52c-82.393,0-149.8-66.906-149.8-148.688
+ c0-81.777,67.407-148.684,149.8-148.684c82.394,0,149.8,66.906,149.8,148.684C405.8,361.671,338.394,427.52,256,427.52z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-alert.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-alert.svg
new file mode 100644
index 00000000..00671978
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-alert.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_30_">
+ <g>
+ <path d="M256,48C141.6,48,48,141.601,48,256s93.6,208,208,208c114.4,0,208-93.601,208-208S370.4,48,256,48z M280,360h-48v-40h48
+ V360z M280,272h-48V144h48V272z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-apps.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-apps.svg
new file mode 100644
index 00000000..db32fe51
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-apps.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon">
+ <g>
+ <path d="M96,176h80V96H96V176z M216,416h80v-80h-80V416z M96,416h80v-80H96V416z M96,296h80v-80H96V296z M216,296h80v-80h-80V296z
+ M336,96v80h80V96H336z M216,176h80V96h-80V176z M336,296h80v-80h-80V296z M336,416h80v-80h-80V416z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-archive.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-archive.svg
new file mode 100644
index 00000000..1f0ce3ad
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-archive.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M453.594,100.001l-32.353-39.299C415.469,52.627,405.083,48,394.664,48H117.335c-10.416,0-20.801,4.627-26.576,12.702
+ l-32.351,39.299C51.468,106.923,48,117.335,48,128.886v288.89C48,443.2,68.8,464,94.225,464h323.553
+ C443.202,464,464,443.2,464,417.775v-288.89C464,117.335,460.537,106.923,453.594,100.001z M256,383.109L128.89,256h80.89v-46.224
+ h92.443V256h80.89L256,383.109z M96.534,94.221l18.486-23.111h277.331l21.965,23.111H96.534z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-back.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-back.svg
new file mode 100644
index 00000000..309afd31
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-back.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_8_">
+ <g>
+ <path d="M427,234.625H167.296l119.702-119.702L256,85L85,256l171,171l29.922-29.924L167.296,277.375H427V234.625z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-down.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-down.svg
new file mode 100644
index 00000000..9e9a2cdf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-down.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_8_">
+ <g>
+ <path d="M277.375,85v259.704l119.702-119.702L427,256L256,427L85,256l29.924-29.922l119.701,118.626V85H277.375z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropdown-circle.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropdown-circle.svg
new file mode 100644
index 00000000..6393ec77
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropdown-circle.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,48C141.125,48,48,141.125,48,256s93.125,208,208,208s208-93.125,208-208S370.875,48,256,48z M256,320l-96-96h192
+ L256,320z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropdown.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropdown.svg
new file mode 100644
index 00000000..55ee520d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropdown.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="128,192 256,320 384,192 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropleft-circle.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropleft-circle.svg
new file mode 100644
index 00000000..9dd3aaba
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropleft-circle.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M464,256c0-114.875-93.125-208-208-208S48,141.125,48,256s93.125,208,208,208S464,370.875,464,256z M192,256l96-96v192
+ L192,256z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropleft.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropleft.svg
new file mode 100644
index 00000000..d693f531
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropleft.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="320,128 192,256 320,384 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropright-circle.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropright-circle.svg
new file mode 100644
index 00000000..932b7917
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropright-circle.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,464c114.875,0,208-93.125,208-208S370.875,48,256,48S48,141.125,48,256S141.125,464,256,464z M224,352V160l96,96
+ L224,352z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropright.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropright.svg
new file mode 100644
index 00000000..88fc3b84
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropright.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="192,128 320,256 192,384 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropup-circle.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropup-circle.svg
new file mode 100644
index 00000000..4633fba3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropup-circle.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M464,256c0-114.875-93.125-208-208-208S48,141.125,48,256s93.125,208,208,208S464,370.875,464,256z M352,288H160l96-96
+ L352,288z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropup.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropup.svg
new file mode 100644
index 00000000..1400388c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropup.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="128,320 256,192 384,320 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-forward.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-forward.svg
new file mode 100644
index 00000000..e40696fd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-forward.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_8_">
+ <g>
+ <path d="M85,277.375h259.704L225.002,397.077L256,427l171-171L256,85l-29.922,29.924l118.626,119.701H85V277.375z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-up.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-up.svg
new file mode 100644
index 00000000..e63ef5aa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-up.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_8_">
+ <g>
+ <path d="M277.375,427V167.296l119.702,119.702L427,256L256,85L85,256l29.924,29.922l119.701-118.626V427H277.375z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-attach.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-attach.svg
new file mode 100644
index 00000000..ae889ab1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-attach.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_3_">
+ <g>
+ <path d="M341.334,128v234.666C341.334,409.604,302.938,448,256,448c-46.937,0-85.333-38.396-85.333-85.334V117.334
+ C170.667,87.469,194.135,64,224,64c29.864,0,53.333,23.469,53.333,53.334v245.333c0,11.729-9.605,21.333-21.334,21.333
+ c-11.729,0-21.333-9.604-21.333-21.333V160h-32v202.667C202.667,392.531,226.135,416,256,416
+ c29.865,0,53.334-23.469,53.334-53.333V117.334C309.334,70.401,270.938,32,224,32c-46.938,0-85.334,38.401-85.334,85.334v245.332
+ C138.667,427.729,190.938,480,256,480c65.062,0,117.334-52.271,117.334-117.334V128H341.334z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bar.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bar.svg
new file mode 100644
index 00000000..a1f2bce0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bar.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_37_">
+ <g>
+ <path d="M234.667,277.333V408H128v40h256v-40H277.333V277.333L448,106.667V64H64v42.667L234.667,277.333z M160,149.333
+ l-42.667-42.666h277.334L352,149.333H160z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bicycle.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bicycle.svg
new file mode 100644
index 00000000..fa8400a7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bicycle.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_13_">
+ <g>
+ <path d="M330.666,131.202c18.668,0,33.598-14.935,33.598-33.601S349.334,64,330.666,64C312,64,297.07,78.935,297.07,97.601
+ S312,131.202,330.666,131.202z M386.666,261.334c-51.332,0-93.332,42-93.332,93.333s42,93.333,93.332,93.333
+ C438,448,480,406,480,354.667S438,261.334,386.666,261.334z M386.666,420c-36.402,0-65.332-28.93-65.332-65.333
+ s28.93-65.333,65.332-65.333c36.404,0,65.334,28.93,65.334,65.333S423.07,420,386.666,420z M305.597,224H384v-32h-58.845
+ l-34.62-60.134c-5.605-9.333-15.869-15.864-27.07-15.864c-8.399,0-16.798,3.732-22.399,9.333l-71.732,69.065
+ c-5.601,5.601-9.333,14-9.333,22.399c0,12.131,9.202,21.465,18.535,27.065L240,282.134V368h32V256l-39.333-32l42.929-44.533
+ L305.597,224z M125.333,261.334C74,261.334,32,303.334,32,354.667S74,448,125.333,448c51.333,0,93.333-42,93.333-93.333
+ S176.667,261.334,125.333,261.334z M125.333,420C88.934,420,60,391.07,60,354.667s28.934-65.333,65.333-65.333
+ c36.399,0,65.333,28.93,65.333,65.333S161.732,420,125.333,420z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-boat.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-boat.svg
new file mode 100644
index 00000000..23000b4a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-boat.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M84.255,413h1.063c34.123,0,63.977-19.021,85.305-42.494c21.325,23.473,51.18,42.762,85.304,42.762
+ s63.979-19.334,85.305-42.806C362.559,393.934,392.412,413,426.535,413h1.062l51.253-138.78c2.126-5.329,1.063-11.641-1.07-16.976
+ c-2.136-5.333-7.237-8.487-12.567-10.623L427,234.133v-98.15C427,112.51,407.344,93,383.884,93h-63.979l-15.993-53h-95.969
+ l-15.995,53h-63.979C104.511,93,85,112.51,85,135.982v98.15l-38.074,12.533c-5.33,2.136-10.582,5.334-12.718,10.667
+ c-2.135,5.335-3.158,10.49-1.031,16.887L84.255,413z M128,136h256v84.261l-128-41.605l-128,41.605V136z"/>
+ <path d="M341.231,408.007c-52.253,36.267-118.356,36.258-170.608-0.009c0,0-57.638,64.002-106.632,64.002h21.327
+ c29.854,0,58.646-11.726,85.305-25.594c53.315,27.734,117.293,27.728,170.608-0.007C367.89,460.268,396.681,472,426.535,472h21.328
+ C400.212,472,341.231,408.007,341.231,408.007z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bookmark.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bookmark.svg
new file mode 100644
index 00000000..799c8823
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bookmark.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M360,64H152c-22.002,0-40,17.998-40,40v344l144-64l144,64V104C400,81.998,382.002,64,360,64z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bulb.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bulb.svg
new file mode 100644
index 00000000..248bae16
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bulb.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_26_">
+ <g>
+ <path d="M256,170.136c25.499,0,49.567,10.025,67.771,28.229C341.975,216.568,352,240.637,352,266.136
+ c0,17.621-4.422,34.031-13.144,48.773c-8.339,14.098-20.437,26.036-34.985,34.526L288,358.697v18.376V448h-64v-70.927v-18.376
+ l-15.871-9.262C178.442,332.111,160,300.192,160,266.136c0-25.499,10.025-49.567,28.229-67.771
+ C206.433,180.161,230.501,170.136,256,170.136 M277.333,32c-6.396,0-42.666,0-42.666,0v64h42.666V32L277.333,32z M406.396,85.864
+ L368,124.271l29.864,29.865l38.406-38.396L406.396,85.864L406.396,85.864z M105.604,85.864l-29.875,29.875l38.406,38.396
+ L144,124.271L105.604,85.864L105.604,85.864z M256,138.136c-70.396,0-128,57.604-128,128c0,46.938,25.604,88.531,64,110.938V480
+ h128V377.073c38.396-22.406,64-62.938,64-110.938C384,195.739,326.396,138.136,256,138.136L256,138.136z M480,244.802h-64v42.667
+ h64V244.802L480,244.802z M96,244.802H32v42.667h64V244.802L96,244.802z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bus.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bus.svg
new file mode 100644
index 00000000..b55c0c20
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bus.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_14_">
+ <g>
+ <g>
+ <path d="M80,352c0,19.198,13.864,24.531,26.667,36.271v38.396c0,11.729,9.599,21.334,21.333,21.334h21.333
+ c11.734,0,21.334-9.604,21.334-21.334v-21.333h170.666v21.333c0,11.729,9.604,21.334,21.334,21.334H384
+ c11.729,0,21.333-9.604,21.333-21.334v-38.396C418.136,376.531,432,370.136,432,352V148.334C432,73.667,349.864,64,256,64
+ S80,73.667,80,148.334V352z M160,367.989c-18.136,0-32-13.864-32-32c0-18.135,13.864-32,32-32s32,13.865,32,32
+ C192,354.125,178.136,367.989,160,367.989z M352,367.989c-18.136,0-32-13.864-32-32c0-18.135,13.864-32,32-32s32,13.865,32,32
+ C384,354.125,370.136,367.989,352,367.989z M384,245.333H128V138.667h256V245.333z"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-calendar.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-calendar.svg
new file mode 100644
index 00000000..5fd9ed68
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-calendar.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M368.005,272h-96v96h96V272z M336.005,64v32h-160V64h-48v32h-24.01c-22.002,0-40,17.998-40,40v272
+ c0,22.002,17.998,40,40,40h304.01c22.002,0,40-17.998,40-40V136c0-22.002-17.998-40-40-40h-24V64H336.005z M408.005,408h-304.01
+ V196h304.01V408z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-call.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-call.svg
new file mode 100644
index 00000000..e687edf4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-call.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M426.666,330.667c-26.666,0-52.271-4.271-75.729-11.729c-7.469-2.136-16-1.073-21.332,5.333l-46.939,46.928
+ c-60.802-30.928-109.864-80-140.802-140.803l46.939-46.927c5.332-5.333,7.462-13.864,5.332-21.333
+ c-8.537-24.531-12.802-50.136-12.802-76.803C181.333,73.604,171.734,64,160,64H85.333C73.599,64,64,73.604,64,85.333
+ C64,285.864,226.136,448,426.666,448c11.73,0,21.334-9.604,21.334-21.333V352C448,340.271,438.396,330.667,426.666,330.667z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-camera.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-camera.svg
new file mode 100644
index 00000000..2dd4720a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-camera.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <circle cx="256" cy="280" r="63"/>
+ <path d="M440,96h-88l-32-32H192l-32,32H72c-22.092,0-40,17.908-40,40v272c0,22.092,17.908,40,40,40h368c22.092,0,40-17.908,40-40
+ V136C480,113.908,462.092,96,440,96z M256,392c-61.855,0-112-50.145-112-112s50.145-112,112-112s112,50.145,112,112
+ S317.855,392,256,392z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cancel.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cancel.svg
new file mode 100644
index 00000000..ddcbee55
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cancel.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,48C140.559,48,48,140.559,48,256c0,115.436,92.559,208,208,208c115.435,0,208-92.564,208-208
+ C464,140.559,371.436,48,256,48z M360.002,330.881l-29.12,29.117L256,285.117l-74.881,74.881l-29.121-29.117L226.881,256
+ l-74.883-74.881l29.121-29.116L256,226.881l74.881-74.878l29.12,29.116L285.119,256L360.002,330.881z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-car.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-car.svg
new file mode 100644
index 00000000..7b66a2e4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-car.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_15_">
+ <g>
+ <path d="M403.208,117.333c-4.271-12.802-16-21.333-29.875-21.333H138.667c-13.875,0-25.604,8.531-29.875,21.333L64,234.667v160
+ C64,406.396,73.604,416,85.333,416h21.334c11.729,0,21.333-9.604,21.333-21.333V384h256v10.667
+ c0,11.729,9.604,21.333,21.333,21.333h21.334c11.729,0,21.333-9.604,21.333-21.333v-160L403.208,117.333z M138.667,320
+ c-18.125,0-32-13.865-32-32s13.875-32,32-32s32,13.866,32,32S156.792,320,138.667,320z M373.333,320c-18.125,0-32-13.865-32-32
+ s13.875-32,32-32s32,13.866,32,32S391.458,320,373.333,320z M106.667,213.333l32-85.333h234.666l32,85.333H106.667z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cart.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cart.svg
new file mode 100644
index 00000000..1d97e720
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cart.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path fill="#010101" d="M169.6,377.6c-22.882,0-41.6,18.718-41.6,41.601c0,22.882,18.718,41.6,41.6,41.6s41.601-18.718,41.601-41.6
+ C211.2,396.317,192.481,377.6,169.6,377.6z M48,51.2v41.6h41.6l74.883,151.682l-31.308,50.954c-3.118,5.2-5.2,12.482-5.2,19.765
+ c0,27.85,19.025,41.6,44.825,41.6H416v-40H177.893c-3.118,0-5.2-2.082-5.2-5.2c0-1.036,2.207-5.2,2.207-5.2l20.782-32.8h154.954
+ c15.601,0,29.128-8.317,36.4-21.836l74.882-128.8c1.237-2.461,2.082-6.246,2.082-10.399c0-11.446-9.364-19.765-20.8-19.765H135.364
+ L115.6,51.2H48z M374.399,377.6c-22.882,0-41.6,18.718-41.6,41.601c0,22.882,18.718,41.6,41.6,41.6S416,442.082,416,419.2
+ C416,396.317,397.281,377.6,374.399,377.6z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-chat.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-chat.svg
new file mode 100644
index 00000000..66d00096
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-chat.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M391.553,64H57.607C53.131,64,48,67.745,48,72.159v214.217c0,4.413,5.131,8.624,9.607,8.624H115v88.894L205.128,295
+ h186.425c4.477,0,7.447-4.211,7.447-8.624V72.159C399,67.745,396.029,64,391.553,64z"/>
+ <path d="M456.396,127H424v166.57c0,15.987-6.915,26.43-25.152,26.43H218.096l-38.905,39h129.688L399,448v-89h57.396
+ c4.478,0,7.604-4.262,7.604-8.682V136.103C464,131.689,460.874,127,456.396,127z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-blank.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-blank.svg
new file mode 100644
index 00000000..ff50d6bb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-blank.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_23_">
+ <g>
+ <path d="M405.333,64H106.667C83.198,64,64,83.198,64,106.667v298.666C64,428.802,83.198,448,106.667,448h298.666
+ C428.802,448,448,428.802,448,405.333V106.667C448,83.198,428.802,64,405.333,64z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-outline-blank.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-outline-blank.svg
new file mode 100644
index 00000000..dfce6d6a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-outline-blank.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_25_">
+ <g>
+ <path d="M405.333,106.667v298.666H106.667V106.667H405.333 M405.333,64H106.667C83.198,64,64,83.198,64,106.667v298.666
+ C64,428.802,83.198,448,106.667,448h298.666C428.802,448,448,428.802,448,405.333V106.667C448,83.198,428.802,64,405.333,64
+ L405.333,64z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-outline.svg
new file mode 100644
index 00000000..96fb444e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-outline.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_24_">
+ <g>
+ <path d="M168.531,215.469l-29.864,29.864l96,96L448,128l-29.864-29.864L234.667,280.531L168.531,215.469z M405.333,405.333
+ H106.667V106.667H320V64H106.667C83.198,64,64,83.198,64,106.667v298.666C64,428.802,83.198,448,106.667,448h298.666
+ C428.802,448,448,428.802,448,405.333V234.667h-42.667V405.333z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox.svg
new file mode 100644
index 00000000..f7718a02
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_22_">
+ <g>
+ <path d="M405.333,64H106.667C83.198,64,64,83.198,64,106.667v298.666C64,428.802,83.198,448,106.667,448h298.666
+ C428.802,448,448,428.802,448,405.333V106.667C448,83.198,428.802,64,405.333,64z M213.333,362.667L106.667,256l29.864-29.864
+ l76.802,76.802l162.136-162.136l29.864,29.865L213.333,362.667z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkmark-circle.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkmark-circle.svg
new file mode 100644
index 00000000..32fe509c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkmark-circle.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M170.718,216.482L141.6,245.6L235.2,339.2l208-208l-29.118-29.118L235.2,279.918L170.718,216.482z M422.4,256
+ c0,91.518-74.883,166.4-166.4,166.4S89.6,347.518,89.6,256S164.482,89.6,256,89.6c15.6,0,31.2,2.082,45.764,6.241L334,63.6
+ C310.082,53.2,284.082,48,256,48C141.6,48,48,141.6,48,256s93.6,208,208,208s208-93.6,208-208H422.4z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-clipboard.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-clipboard.svg
new file mode 100644
index 00000000..97f22819
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-clipboard.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M405.333,80h-87.35C310.879,52.396,285.821,32,256,32s-54.879,20.396-61.983,48h-87.35C83.198,80,64,99.198,64,122.667
+ v314.665C64,460.801,83.198,480,106.667,480h298.666C428.802,480,448,460.801,448,437.332V122.667C448,99.198,428.802,80,405.333,80
+ z M256,80c11.729,0,21.333,9.599,21.333,21.333s-9.604,21.334-21.333,21.334s-21.333-9.6-21.333-21.334S244.271,80,256,80z M408,440
+ H104V120h40v72h224v-72h40V440z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-close.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-close.svg
new file mode 100644
index 00000000..3184bc13
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-close.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_5_">
+ <g>
+ <polygon points="405,136.798 375.202,107 256,226.202 136.798,107 107,136.798 226.202,256 107,375.202 136.798,405 256,285.798
+ 375.202,405 405,375.202 285.798,256 "/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-circle.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-circle.svg
new file mode 100644
index 00000000..bd8a656e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-circle.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_32_">
+ <g>
+ <g>
+ <path d="M256,48C141.6,48,48,141.6,48,256s93.6,208,208,208c114.4,0,208-93.6,208-208S370.4,48,256,48z M349.6,339.2
+ c0,0-175.759,0-176.799,0c-34.318,0-62.4-28.082-62.4-62.399c0-34.319,28.082-62.4,62.4-62.4c1.041,0,2.082,0,3.117,0
+ c9.364-36.4,41.601-62.399,80.083-62.399c45.764,0,83.199,37.435,83.199,83.198h10.4c29.118,0,52,22.882,52,52.001
+ C401.6,316.318,378.718,339.2,349.6,339.2z"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-done.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-done.svg
new file mode 100644
index 00000000..8aa97173
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-done.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M403.002,217.001C388.998,148.002,328.998,96,256,96c-57.998,0-107.998,32.998-132.998,81.001
+ C63.002,183.002,16,233.998,16,296c0,65.996,53.999,120,120,120h260c55,0,100-45,100-100
+ C496,263.002,455.004,219.999,403.002,217.001z M213.333,362.667L138.667,288l29.864-29.864l44.802,44.802L324.271,192
+ l29.865,29.864L213.333,362.667z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-outline.svg
new file mode 100644
index 00000000..98b34b15
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-outline.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_9_">
+ <g>
+ <g>
+ <path d="M403.001,217.001C388.997,148.002,328.998,96,256,96c-57.998,0-107.999,32.998-132.997,81
+ C63.002,183.002,16,233.998,16,296c0,65.996,54.004,120,120,120h260c55,0,100-45,100-100.001
+ C496,263.002,455.003,220,403.001,217.001z M396,376H136c-44.004,0-80-35.996-80-80c0-44,35.996-80,80-80h14.004
+ c12.998-46,55-80,105.996-80c60.996,0,110,49,110,110v10h30c32.998,0,60,27.003,60,60C456,348.998,428.998,376,396,376z"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud.svg
new file mode 100644
index 00000000..0869972a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M403.002,217.001C388.998,148.002,328.998,96,256,96c-57.998,0-107.998,32.998-132.998,81.001
+ C63.002,183.002,16,233.998,16,296c0,65.996,53.999,120,120,120h260c55,0,100-45,100-100
+ C496,263.002,455.004,219.999,403.002,217.001z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-color-palette.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-color-palette.svg
new file mode 100644
index 00000000..fddb19cf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-color-palette.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_12_">
+ <g>
+ <path d="M256,64C150.401,64,64,150.401,64,256c0,105.604,86.401,192,192,192c18.136,0,32-13.864,32-32
+ c0-8.531-3.198-16-8.531-21.333c-5.333-5.334-8.531-12.803-8.531-21.334c0-18.135,13.864-32,32-32h38.396
+ c58.667,0,106.667-48,106.667-106.666C448,140.802,361.604,64,256,64z M138.667,256c-18.136,0-32-13.864-32-32s13.864-32,32-32
+ c18.135,0,32,13.864,32,32S156.802,256,138.667,256z M202.667,170.667c-18.136,0-32-13.865-32-32c0-18.136,13.864-32,32-32
+ c18.135,0,32,13.864,32,32C234.667,156.802,220.802,170.667,202.667,170.667z M309.333,170.667c-18.135,0-32-13.865-32-32
+ c0-18.136,13.865-32,32-32c18.136,0,32,13.864,32,32C341.333,156.802,327.469,170.667,309.333,170.667z M373.333,256
+ c-18.135,0-32-13.864-32-32s13.865-32,32-32c18.136,0,32,13.864,32,32S391.469,256,373.333,256z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-compass.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-compass.svg
new file mode 100644
index 00000000..6ae34a9e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-compass.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,231.358c-13.442,0-24.643,11.2-24.643,24.642s11.2,24.643,24.643,24.643s24.643-11.2,24.643-24.643
+ S269.442,231.358,256,231.358z M256,32C132.8,32,32,132.8,32,256s100.8,224,224,224s224-100.8,224-224S379.2,32,256,32z
+ M305.284,305.284L121.6,390.4l85.116-183.679L390.4,121.6L305.284,305.284z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contact.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contact.svg
new file mode 100644
index 00000000..3b9b5aec
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contact.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M331.08,338.205c-22.156,12.594-47.777,19.783-75.084,19.783c-27.302,0-52.919-7.182-75.073-19.771
+ C122.153,356.152,77.262,396,64,448h384C434.745,396,389.854,356.131,331.08,338.205z"/>
+ <g>
+ <path d="M255.996,64c-72.871,0-131.945,59.127-131.945,132.013c0,72.887,59.074,131.972,131.945,131.972
+ s131.945-59.085,131.945-131.972C387.941,123.127,328.867,64,255.996,64z M255.996,294.986c-41.958,0-77.813-25.986-92.209-62.986
+ h184.418C333.809,269,297.953,294.986,255.996,294.986z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contacts.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contacts.svg
new file mode 100644
index 00000000..271a5405
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contacts.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M239.208,343.937c-17.78,10.103-38.342,15.876-60.255,15.876c-21.909,0-42.467-5.771-60.246-15.87
+ C71.544,358.331,42.643,406,32,448h293.912C315.273,406,286.375,358.317,239.208,343.937z"/>
+ <g>
+ <path d="M178.953,120.035c-58.479,0-105.886,47.394-105.886,105.858c0,58.464,47.407,105.857,105.886,105.857
+ c58.479,0,105.886-47.394,105.886-105.857C284.839,167.429,237.431,120.035,178.953,120.035z M178.953,306.523
+ c-33.671,0-62.445-22.513-73.997-50.523H252.95C241.396,284.011,212.624,306.523,178.953,306.523z"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path d="M322.602,384H480c-10.638-42-39.537-81.691-86.703-96.072c-17.781,10.104-38.343,15.873-60.256,15.873
+ c-14.823,0-29.024-2.654-42.168-7.49c-7.445,12.47-16.927,25.592-27.974,34.906C289.245,341.354,309.146,364,322.602,384z"/>
+ </g>
+ <path d="M306.545,200h100.493c-11.554,28-40.327,50.293-73.997,50.293c-8.875,0-17.404-1.692-25.375-4.51
+ c-1.338,8.709-3.543,17.07-6.52,25.118c10.066,3.174,20.779,4.862,31.895,4.862c58.479,0,105.886-47.41,105.886-105.872
+ c0-58.465-47.407-105.866-105.886-105.866c-37.49,0-70.427,19.703-89.243,49.09C275.607,131.383,298.961,163,306.545,200z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contract.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contract.svg
new file mode 100644
index 00000000..8c4708c7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contract.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_2_">
+ <g>
+ <path d="M64,371.2h76.795V448H192V320H64V371.2z M140.795,140.8H64V192h128V64h-51.205V140.8z M320,448h51.2v-76.8H448V320H320
+ V448z M371.2,140.8V64H320v128h128v-51.2H371.2z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-create.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-create.svg
new file mode 100644
index 00000000..d2cc74e6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-create.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_6_">
+ <g>
+ <path fill="#010101" d="M64,368v80h80l235.727-235.729l-79.999-79.998L64,368z M441.602,150.398
+ c8.531-8.531,8.531-21.334,0-29.865l-50.135-50.135c-8.531-8.531-21.334-8.531-29.865,0l-39.468,39.469l79.999,79.998
+ L441.602,150.398z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-delete.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-delete.svg
new file mode 100644
index 00000000..9159a485
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-delete.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M128,405.429C128,428.846,147.198,448,170.667,448h170.667C364.802,448,384,428.846,384,405.429V160H128V405.429z M416,96
+ h-80l-26.785-32H202.786L176,96H96v32h320V96z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-desktop.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-desktop.svg
new file mode 100644
index 00000000..adcd30ee
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-desktop.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_28_">
+ <g>
+ <path d="M437.333,32H74.667C51.198,32,32,51.197,32,74.666v282.667C32,380.802,51.198,400,74.667,400h138.666l-42.666,48v32
+ h170.666v-32l-42.666-48h138.666C460.802,400,480,380.802,480,357.333V74.666C480,51.197,460.802,32,437.333,32z M437.333,320
+ H74.667V74.666h362.666V320z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-document.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-document.svg
new file mode 100644
index 00000000..91cd9d03
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-document.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M288,48H136c-22.092,0-40,17.908-40,40v336c0,22.092,17.908,40,40,40h240c22.092,0,40-17.908,40-40V176L288,48z M272,192
+ V80l112,112H272z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-done-all.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-done-all.svg
new file mode 100644
index 00000000..8260759d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-done-all.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_4_">
+ <g>
+ <path d="M387.581,139.712L356.755,109L216.913,248.319l30.831,30.719L387.581,139.712z M481.172,109L247.744,340.469
+ l-91.39-91.051l-30.827,30.715L247.744,403L512,139.712L481.172,109z M0,280.133L123.321,403l30.829-30.713L31.934,249.418
+ L0,280.133z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-done.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-done.svg
new file mode 100644
index 00000000..fbd6e5cd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-done.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_1_">
+ <g>
+ <g>
+ <polygon points="186.301,339.893 96,249.461 64,279.968 186.301,402 448,140.506 416,110 "/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-download.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-download.svg
new file mode 100644
index 00000000..2d629944
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-download.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M403.002,217.001C388.998,148.002,328.998,96,256,96c-57.998,0-107.998,32.998-132.998,81.001
+ C63.002,183.002,16,233.998,16,296c0,65.996,53.999,120,120,120h260c55,0,100-45,100-100
+ C496,263.002,455.004,219.999,403.002,217.001z M224,268v-76h64v76h68L256,368L156,268H224z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-drafts.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-drafts.svg
new file mode 100644
index 00000000..18745a76
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-drafts.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_18_">
+ <g>
+ <g>
+ <path d="M480,201.667c0-14.933-7.469-28.803-20.271-36.266L256,64L52.271,165.401C40.531,172.864,32,186.734,32,201.667v203.666
+ C32,428.802,51.197,448,74.666,448h362.668C460.803,448,480,428.802,480,405.333V201.667z M256,304L84.631,192L256,106.667
+ L427.369,192L256,304z"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-exit.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-exit.svg
new file mode 100644
index 00000000..cf92b342
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-exit.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M215.469,332.802l29.863,29.864L352,256L245.332,149.333l-29.863,29.865l55.469,55.469H64v42.666h205.864L215.469,332.802z
+ M405.334,64H106.666C83.198,64,64,83.198,64,106.666V192h42.666v-85.333h298.668v298.668H106.666V320H64v85.334
+ C64,428.802,83.198,448,106.666,448h298.668C428.802,448,448,428.802,448,405.334V106.666C448,83.198,428.802,64,405.334,64z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-expand.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-expand.svg
new file mode 100644
index 00000000..beb08b2e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-expand.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="396.795,396.8 320,396.8 320,448 448,448 448,320 396.795,320 "/>
+ <polygon points="396.8,115.205 396.8,192 448,192 448,64 320,64 320,115.205 "/>
+ <polygon points="115.205,115.2 192,115.2 192,64 64,64 64,192 115.205,192 "/>
+ <polygon points="115.2,396.795 115.2,320 64,320 64,448 192,448 192,396.795 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-favorite-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-favorite-outline.svg
new file mode 100644
index 00000000..15d6e6b9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-favorite-outline.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M349.6,64c-36.4,0-70.718,16.742-93.6,43.947C233.117,80.742,198.8,64,162.4,64C97.918,64,48,114.221,48,179.095
+ c0,79.516,70.718,143.348,177.836,241.694L256,448l30.164-27.211C393.281,322.442,464,258.61,464,179.095
+ C464,114.221,414.082,64,349.6,64z M268.836,393.257l-4.219,3.873L256,404.903l-8.616-7.772l-4.214-3.869
+ c-50.418-46.282-93.961-86.254-122.746-121.994C92.467,236.555,80,208.128,80,179.095c0-22.865,8.422-43.931,23.715-59.316
+ C118.957,104.445,139.798,96,162.4,96c26.134,0,51.97,12.167,69.11,32.545L256,157.661l24.489-29.116
+ C297.63,108.167,323.465,96,349.6,96c22.603,0,43.443,8.445,58.686,23.778C423.578,135.164,432,156.229,432,179.095
+ c0,29.033-12.467,57.459-40.422,92.171C362.794,307.006,319.253,346.975,268.836,393.257z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-favorite.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-favorite.svg
new file mode 100644
index 00000000..3b836628
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-favorite.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,448l-30.164-27.211C118.718,322.442,48,258.61,48,179.095C48,114.221,97.918,64,162.4,64
+ c36.399,0,70.717,16.742,93.6,43.947C278.882,80.742,313.199,64,349.6,64C414.082,64,464,114.221,464,179.095
+ c0,79.516-70.719,143.348-177.836,241.694L256,448z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-film.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-film.svg
new file mode 100644
index 00000000..13fbeb63
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-film.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path fill="#010101" d="M376,64v42.667h-40V64H176v42.667h-40V64H96v384h40v-42.666h40V448h160v-42.666h40V448h40V64H376z
+ M176,362.667h-40V320h40V362.667z M176,277.334h-40v-42.667h40V277.334z M176,192h-40v-42.666h40V192z M376,362.667h-40V320h40
+ V362.667z M376,277.334h-40v-42.667h40V277.334z M376,192h-40v-42.666h40V192z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-folder-open.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-folder-open.svg
new file mode 100644
index 00000000..19545aa6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-folder-open.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M437.334,144H256.006l-42.668-48H74.666C51.197,96,32,115.198,32,138.667v234.666C32,396.802,51.197,416,74.666,416h362.668
+ C460.803,416,480,396.802,480,373.333V186.667C480,163.198,460.803,144,437.334,144z M448,373.333
+ c0,5.782-4.885,10.667-10.666,10.667H74.666C68.884,384,64,379.115,64,373.333V176h373.334c5.781,0,10.666,4.885,10.666,10.667
+ V373.333z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-folder.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-folder.svg
new file mode 100644
index 00000000..eb17131f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-folder.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_10_">
+ <g>
+ <g>
+ <path d="M213.338,96H74.666C51.197,96,32,115.198,32,138.667v234.666C32,396.802,51.197,416,74.666,416h362.668
+ C460.803,416,480,396.802,480,373.333V186.667C480,163.198,460.803,144,437.334,144H256.006L213.338,96z"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-funnel.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-funnel.svg
new file mode 100644
index 00000000..0c9f0e1a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-funnel.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M208,400h96v-47.994h-96V400z M32,112v47.994h448V112H32z M112,280.783h288v-49.555H112V280.783z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-globe.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-globe.svg
new file mode 100644
index 00000000..c65393e3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-globe.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,48C141.124,48,48,141.125,48,256c0,114.875,93.124,208,208,208c114.875,0,208-93.125,208-208
+ C464,141.125,370.875,48,256,48z M234.451,432.999c-39.464-4.726-75.978-22.392-104.519-50.932
+ C96.258,348.393,77.714,303.622,77.714,256c0-42.87,15.036-83.424,42.601-115.659c0.71,8.517,2.463,17.648,2.014,24.175
+ c-1.64,23.795-3.988,38.687,9.94,58.762c5.426,7.819,6.759,19.028,9.4,28.078c2.583,8.854,12.902,13.498,20.019,18.953
+ c14.359,11.009,28.096,23.805,43.322,33.494c10.049,6.395,16.326,9.576,13.383,21.839c-2.367,9.862-3.028,15.937-8.13,24.723
+ c-1.557,2.681,5.877,19.918,8.351,22.392c7.498,7.497,14.938,14.375,23.111,21.125C254.396,404.351,240.494,417.954,234.451,432.999
+ z M382.067,382.067c-25.633,25.633-57.699,42.486-92.556,49.081c4.94-12.216,13.736-23.07,21.895-29.362
+ c7.097-5.476,15.986-16.009,19.693-24.352c3.704-8.332,8.611-15.555,13.577-23.217c7.065-10.899-17.419-27.336-25.353-30.781
+ c-17.854-7.751-31.294-18.21-47.161-29.375c-11.305-7.954-34.257,4.154-47.02-1.417c-17.481-7.633-31.883-20.896-47.078-32.339
+ c-15.68-11.809-14.922-25.576-14.922-42.997c12.282,0.453,29.754-3.399,37.908,6.478c2.573,3.117,11.42,17.042,17.342,12.094
+ c4.838-4.043-3.585-20.249-5.212-24.059c-5.005-11.715,11.404-16.284,19.803-24.228c10.96-10.364,34.47-26.618,32.612-34.047
+ s-23.524-28.477-36.249-25.193c-1.907,0.492-18.697,18.097-21.941,20.859c0.086-5.746,0.172-11.491,0.26-17.237
+ c0.055-3.628-6.768-7.352-6.451-9.692c0.8-5.914,17.262-16.647,21.357-21.357c-2.869-1.793-12.659-10.202-15.622-8.968
+ c-7.174,2.99-15.276,5.05-22.45,8.039c0-2.488-0.302-4.825-0.662-7.133c14.376-6.365,29.587-10.791,45.31-13.152l14.084,5.66
+ l9.944,11.801l9.924,10.233l8.675,2.795l13.779-12.995L282,87.929v-8.339c27.25,3.958,52.984,14.124,75.522,29.8
+ c-4.032,0.361-8.463,0.954-13.462,1.59c-2.065-1.22-4.714-1.774-6.965-2.623c6.531,14.042,13.343,27.89,20.264,41.746
+ c7.393,14.801,23.793,30.677,26.673,46.301c3.394,18.416,1.039,35.144,2.896,56.811c1.788,20.865,23.524,44.572,23.524,44.572
+ s10.037,3.419,18.384,2.228C421.055,330.798,405.103,359.029,382.067,382.067z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-hand.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-hand.svg
new file mode 100644
index 00000000..5fdc8100
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-hand.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M450.679,273.5c-14.585-14.577-36.054-15.89-50.639-1.312l-41.687,41.664c-10.852,10.836-23.93,10.859-31.564,1.852
+ c-5.057-5.968-3.061-24.374-1.644-36.049l20.907-171.849c1.867-15.353-9.07-30.185-24.43-32.051
+ c-15.358-1.867-29.322,9.939-31.191,25.289L267.37,236.021c-1.205,3.358-3.79,3.938-4.081-0.582L255.44,60
+ c0-15.465-12.542-28-28.014-28c-15.473,0-28.015,12.535-28.015,28l-0.552,176.752c0.146,2.04-1.604,2.624-1.92,0.294L172.016,99.077
+ c-2.75-15.219-17.323-26.203-32.548-23.453c-15.227,2.748-25.339,18.187-22.591,33.403l22.193,161.455
+ c0.023,2.872-0.941,4.513-2.308,0.831l-33.109-88.517c-5.18-14.572-21.196-23.065-35.776-17.889
+ c-14.579,5.177-22.201,22.061-17.023,36.631l58.042,189.625c0.303,1.046,0.624,2.085,0.953,3.118l0.121,0.39
+ c0.011,0.031,0.025,0.058,0.035,0.088C126.079,444.233,172.57,480,227.427,480c35.116,0,71.591-12.378,99.357-33.672
+ c0.001,0,0.003-0.002,0.003-0.002c29.99-18.051,126.071-121.347,126.071-121.347C467.445,310.402,465.266,288.08,450.679,273.5z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-hangout.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-hangout.svg
new file mode 100644
index 00000000..08ba43be
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-hangout.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,48c-97.321,0-176,77.114-176,172.487c0,95.38,78.679,172.487,176,172.487V464c100.425-47.689,176-152.195,176-243.513
+ C432,125.114,353.321,48,256,48z M246,230.633L224.943,271H193.88l20.712-40H184v-61h62V230.633z M328,230.633L307.768,271h-31.063
+ l20.704-40H266v-61h62V230.633z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-happy.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-happy.svg
new file mode 100644
index 00000000..26072707
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-happy.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,48C140.563,48,48,141.6,48,256c0,114.4,92.563,208,208,208s208-93.6,208-208C464,141.6,370.401,48,256,48z M256,422.4
+ c-91.518,0-166.404-74.883-166.404-166.4c0-91.518,74.887-166.4,166.404-166.4S422.404,164.482,422.404,256
+ C422.404,347.518,347.518,422.4,256,422.4z M328.8,235.2c17.683,0,31.201-13.518,31.201-31.2s-13.519-31.2-31.201-31.2
+ c-17.682,0-31.2,13.518-31.2,31.2S311.118,235.2,328.8,235.2z M183.2,235.2c17.682,0,31.2-13.518,31.2-31.2s-13.519-31.2-31.2-31.2
+ c-17.683,0-31.201,13.518-31.201,31.2S165.518,235.2,183.2,235.2z M256,370.4c48.883,0,89.436-30.164,106.081-72.801H149.919
+ C166.564,340.236,207.117,370.4,256,370.4z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-home.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-home.svg
new file mode 100644
index 00000000..44d4234d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-home.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="208,448 208,320 304,320 304,448 401.6,448 401.6,256 464,256 256,64 48,256 110.4,256 110.4,448 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-image.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-image.svg
new file mode 100644
index 00000000..568dfe46
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-image.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_8_">
+ <g>
+ <path d="M448,405.333V106.667C448,83.198,428.802,64,405.333,64H106.667C83.198,64,64,83.198,64,106.667v298.666
+ C64,428.802,83.198,448,106.667,448h298.666C428.802,448,448,428.802,448,405.333z M181.333,288l53.334,64l74.666-96l96,128
+ H106.667L181.333,288z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-laptop.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-laptop.svg
new file mode 100644
index 00000000..07dcfb54
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-laptop.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_29_">
+ <g>
+ <path d="M437.334,416C460.803,416,480,396.803,480,373.334V106.668C480,83.199,460.803,64,437.334,64H74.666
+ C51.197,64,32,83.199,32,106.668v266.666C32,396.803,51.197,416,74.666,416H0c0,23.469,64,32,96,32h320c32,0,96-8.531,96-32
+ H437.334z M74.666,106.668h362.668v271.998H74.666V106.668z M256,434.666c-11.729,0-21.333-9.604-21.333-21.334
+ c0-11.729,9.604-21.332,21.333-21.332s21.333,9.604,21.333,21.332C277.333,425.062,267.729,434.666,256,434.666z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-list.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-list.svg
new file mode 100644
index 00000000..95a27cc2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-list.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M408,64H104c-22.091,0-40,17.908-40,40v304c0,22.092,17.909,40,40,40h304c22.092,0,40-17.908,40-40V104
+ C448,81.908,430.092,64,408,64z M304,368H144v-48h160V368z M368,280H144v-48h224V280z M368,192H144v-48h224V192z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-locate.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-locate.svg
new file mode 100644
index 00000000..a7b72bc4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-locate.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon">
+ <g>
+ <path d="M256,176c-44.004,0-80.001,36-80.001,80c0,44.004,35.997,80,80.001,80c44.005,0,79.999-35.996,79.999-80
+ C335.999,212,300.005,176,256,176z M446.938,234.667c-9.605-88.531-81.074-160-169.605-169.599V32h-42.666v33.067
+ c-88.531,9.599-160,81.068-169.604,169.599H32v42.667h33.062c9.604,88.531,81.072,160,169.604,169.604V480h42.666v-33.062
+ c88.531-9.604,160-81.073,169.605-169.604H480v-42.667H446.938z M256,405.333c-82.137,0-149.334-67.198-149.334-149.333
+ c0-82.136,67.197-149.333,149.334-149.333c82.135,0,149.332,67.198,149.332,149.333C405.332,338.135,338.135,405.333,256,405.333z
+ "/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-lock.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-lock.svg
new file mode 100644
index 00000000..fbc6418d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-lock.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M376,186h-20v-40c0-55-45-100-100-100S156,91,156,146v40h-20c-22.002,0-40,17.998-40,40v200c0,22.002,17.998,40,40,40h240
+ c22.002,0,40-17.998,40-40V226C416,203.998,398.002,186,376,186z M256,368c-22.002,0-40-17.998-40-40s17.998-40,40-40
+ s40,17.998,40,40S278.002,368,256,368z M318.002,186H193.998v-40c0-34.004,28.003-62.002,62.002-62.002
+ c34.004,0,62.002,27.998,62.002,62.002V186z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-mail.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-mail.svg
new file mode 100644
index 00000000..1afcfa1e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-mail.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_19_">
+ <g>
+ <path d="M437.332,80H74.668C51.199,80,32,99.198,32,122.667v266.666C32,412.802,51.199,432,74.668,432h362.664
+ C460.801,432,480,412.802,480,389.333V122.667C480,99.198,460.801,80,437.332,80z M432,170.667L256,288L80,170.667V128
+ l176,117.333L432,128V170.667z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-map.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-map.svg
new file mode 100644
index 00000000..5be7a01b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-map.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_34_">
+ <g>
+ <g>
+ <path d="M437.333,64c-2.176,0-4.396,1.369-9.176,3.207S320,108.802,320,108.802L192,64L71.469,104.531
+ C67.197,105.604,64,109.864,64,115.197v322.136C64,443.729,68.271,448,74.666,448c1.828,0,6.505-2.33,9.087-3.319
+ S192,403.197,192,403.197L320,448l120.531-40.531c4.271-1.073,7.469-5.334,7.469-10.667V74.666C448,68.271,443.729,64,437.333,64
+ z M320,405.333l-128-44.802V106.666l128,44.803V405.333z"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-menu.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-menu.svg
new file mode 100644
index 00000000..4d1cb7c0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-menu.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_3_">
+ <g>
+ <path d="M64,384h384v-42.666H64V384z M64,277.334h384v-42.667H64V277.334z M64,128v42.665h384V128H64z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-microphone-off.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-microphone-off.svg
new file mode 100644
index 00000000..297562b6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-microphone-off.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M367.951,354.654l-26.616-26.562l-9.568-9.548l-4.698-4.706L187,174.041v0.346L76.112,63.531L51.921,87.572L187,222.47
+ v28.816c0,37.79,31.121,68.714,68.91,68.714c8.61,0,16.952-1.62,24.565-4.545l32.389,32.274
+ c-17.333,8.793-36.812,13.86-56.782,13.86c-62.986,0-121.365-48.59-121.365-116.59H95.773C95.773,322,158,387.701,233,398.013V480
+ h46v-81.987c22-3.352,43.066-11.222,61.627-22.622l95.278,95.078l24.033-24l-33.847-33.785l-58.216-57.959l58.224,57.959
+ L367.951,354.654z"/>
+ <path d="M325,251.286V100.714C325,62.924,293.791,32,256,32s-69,30.924-69,68.714v25.244l137.109,136.968
+ C324.779,259.135,325,255.247,325,251.286z"/>
+ <path d="M416.439,245h-38.941c0,20.496-5.498,39.676-14.931,56.197l27.572,27.516C406.662,304.603,416.439,275.926,416.439,245z"/>
+ <polygon points="459.999,446.427 426.102,412.684 459.957,446.469 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-microphone.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-microphone.svg
new file mode 100644
index 00000000..35881609
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-microphone.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,320c37.712,0,68.571-30.924,68.571-68.714V100.714C324.571,62.924,293.712,32,256,32s-68.571,30.924-68.571,68.714
+ v150.572C187.429,289.076,218.288,320,256,320z M377.139,244.548c0,68.714-58.282,116.815-121.139,116.815
+ s-121.139-48.102-121.139-116.815H96c0,77.873,61.719,143.153,137.144,153.465V480h45.713v-81.987
+ C354.281,386.561,416,322.421,416,244.548H377.139z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-more-horizontal.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-more-horizontal.svg
new file mode 100644
index 00000000..c6f4af42
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-more-horizontal.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M136,216c-22.002,0-40,17.998-40,40s17.998,40,40,40s40-17.998,40-40S158.002,216,136,216z M376,216
+ c-22.002,0-40,17.998-40,40s17.998,40,40,40s40-17.998,40-40S398.002,216,376,216z M256,216c-22.002,0-40,17.998-40,40
+ s17.998,40,40,40s40-17.998,40-40S278.002,216,256,216z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-more-vertical.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-more-vertical.svg
new file mode 100644
index 00000000..fbca23d0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-more-vertical.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M296,136c0-22.002-17.998-40-40-40s-40,17.998-40,40s17.998,40,40,40S296,158.002,296,136z M296,376
+ c0-22.002-17.998-40-40-40s-40,17.998-40,40s17.998,40,40,40S296,398.002,296,376z M296,256c0-22.002-17.998-40-40-40
+ s-40,17.998-40,40s17.998,40,40,40S296,278.002,296,256z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-navigate.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-navigate.svg
new file mode 100644
index 00000000..8bf06e12
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-navigate.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_5_">
+ <g>
+ <polygon points="256,64 96,433.062 110.938,448 256,384 401.062,448 416,433.062 "/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications-none.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications-none.svg
new file mode 100644
index 00000000..d0400309
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications-none.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M257,120.471c7.083,0,23.911,4.479,23.911,4.479c45.589,10.447,77.678,52.439,77.678,99.85v114.4v13.212l9.321,9.364
+ l7.788,7.823H136.302l7.788-7.823l9.321-9.364V339.2V224.8c0-47.41,32.089-89.403,77.678-99.85c0,0,18.043-4.479,23.911-4.479
+ M256,48c-17.602,0-31.059,13.518-31.059,31.2v14.559c-59.015,13.523-103.53,67.601-103.53,131.041v114.4L80,380.8v20.8h352v-20.8
+ l-41.411-41.6V224.8c0-63.44-44.516-117.518-103.53-131.041V79.2C287.059,61.518,273.602,48,256,48L256,48z M297.411,422.4h-82.823
+ c0,22.881,18.633,41.6,41.412,41.6S297.411,445.281,297.411,422.4L297.411,422.4z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications-off.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications-off.svg
new file mode 100644
index 00000000..5b65dd80
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications-off.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,463.656c22.814,0,41.475-18.656,41.475-41.656h-82.95C214.525,445,233.186,463.656,256,463.656z"/>
+ <path d="M131.083,107.172l0.053,0.074L98.09,74.277L74.004,98.383l63.042,63.153C126.888,180.521,121,202.196,121,225.07v114.555
+ l-41,41.656V402h297.743l36.182,36.33l24.079-24.301L425.9,402h0.316L131.083,107.172z"/>
+ <path d="M391,225.07c0-63.526-45-117.677-104-131.218V79.274c0-17.706-13.371-31.243-31-31.243c-17.628,0-31,13.537-31,31.243
+ v14.578c-15,3.438-29.048,9.501-41.75,17.663L391,319.355V225.07z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications.svg
new file mode 100644
index 00000000..eb28dd22
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,464c22.779,0,41.411-18.719,41.411-41.6h-82.823C214.588,445.281,233.221,464,256,464z M390.589,339.2V224.8
+ c0-63.44-44.516-117.518-103.53-131.041V79.2c0-17.682-13.457-31.2-31.059-31.2s-31.059,13.518-31.059,31.2v14.559
+ c-59.015,13.523-103.53,67.601-103.53,131.041v114.4L80,380.8v20.8h352v-20.8L390.589,339.2z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-open.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-open.svg
new file mode 100644
index 00000000..b004029c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-open.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M405.34,405.332H106.66V106.668H240V64H106.66C83.191,64,64,83.197,64,106.668v298.664C64,428.803,83.191,448,106.66,448
+ h298.68c23.469,0,42.66-19.197,42.66-42.668V272h-42.66V405.332z M288,64v42.668h87.474L159.999,322.133l29.866,29.866
+ l215.476-215.47V224H448V64H288z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-options.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-options.svg
new file mode 100644
index 00000000..e95040b6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-options.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <rect x="32" y="384" width="272" height="32"/>
+ <rect x="400" y="384" width="80" height="32"/>
+ <path d="M384,447.5c0,17.949-14.327,32.5-32,32.5l0,0c-17.673,0-32-14.551-32-32.5v-95c0-17.949,14.327-32.5,32-32.5l0,0
+ c17.673,0,32,14.551,32,32.5V447.5z"/>
+ </g>
+ <g>
+ <rect x="32" y="240" width="80" height="32"/>
+ <rect x="208" y="240" width="272" height="32"/>
+ <path d="M192,303.5c0,17.949-14.327,32.5-32,32.5l0,0c-17.673,0-32-14.551-32-32.5v-95c0-17.949,14.327-32.5,32-32.5l0,0
+ c17.673,0,32,14.551,32,32.5V303.5z"/>
+ </g>
+ <g>
+ <rect x="32" y="96" width="272" height="32"/>
+ <rect x="400" y="96" width="80" height="32"/>
+ <path d="M384,159.5c0,17.949-14.327,32.5-32,32.5l0,0c-17.673,0-32-14.551-32-32.5v-95c0-17.949,14.327-32.5,32-32.5l0,0
+ c17.673,0,32,14.551,32,32.5V159.5z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-people.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-people.svg
new file mode 100644
index 00000000..0897dfd0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-people.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M337.454,232c33.599,0,61.092-27.002,61.092-60c0-32.997-27.493-60-61.092-60s-61.09,27.003-61.09,60
+ C276.364,204.998,303.855,232,337.454,232z M174.546,232c33.599,0,61.09-27.002,61.09-60c0-32.997-27.491-60-61.09-60
+ s-61.092,27.003-61.092,60C113.454,204.998,140.947,232,174.546,232z M174.546,276C126.688,276,32,298.998,32,346v54h288v-54
+ C320,298.998,222.401,276,174.546,276z M337.454,287.003c-6.105,0-10.325,0-17.454,0.997c23.426,17.002,32,28,32,58v54h128v-54
+ C480,298.998,385.312,287.003,337.454,287.003z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-person-add.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-person-add.svg
new file mode 100644
index 00000000..e5ac6c6e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-person-add.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M304,256c52.805,0,96-43.201,96-96s-43.195-96-96-96s-96,43.201-96,96S251.195,256,304,256z M304,304
+ c-63.598,0-192,32.402-192,96v48h384v-48C496,336.402,367.598,304,304,304z"/>
+ </g>
+ <g id="Icon_16_">
+ <g>
+ <path d="M112,224v-64H80v64H16v32h64v64h32v-64h64v-32H112z"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-person.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-person.svg
new file mode 100644
index 00000000..ac083d29
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-person.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,256c52.805,0,96-43.201,96-96s-43.195-96-96-96s-96,43.201-96,96S203.195,256,256,256z M256,304
+ c-63.598,0-192,32.402-192,96v48h384v-48C448,336.402,319.598,304,256,304z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-phone-landscape.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-phone-landscape.svg
new file mode 100644
index 00000000..1311cb62
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-phone-landscape.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_6_">
+ <g>
+ <path d="M480,358.856V153.143C480,130.512,461.674,112,439.272,112H72.728C50.326,112,32,130.512,32,153.143v205.713
+ C32,381.488,50.326,400,72.728,400h366.545C461.674,400,480,381.488,480,358.856z M112,364V148h288v216H112z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-phone-portrait.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-phone-portrait.svg
new file mode 100644
index 00000000..ff141828
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-phone-portrait.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_6_">
+ <g>
+ <path d="M358.856,32H153.143C130.512,32,112,50.326,112,72.728v366.545C112,461.674,130.512,480,153.143,480h205.713
+ C381.488,480,400,461.674,400,439.272V72.728C400,50.326,381.488,32,358.856,32z M364,400H148V112h216V400z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-pin.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-pin.svg
new file mode 100644
index 00000000..54c59a8f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-pin.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,32c-88.004,0-160,70.557-160,156.801C96,306.4,256,480,256,480s160-173.6,160-291.199C416,102.557,344.004,32,256,32z
+ M256,244.801c-31.996,0-57.144-24.645-57.144-56c0-31.357,25.147-56,57.144-56s57.144,24.643,57.144,56
+ C313.144,220.156,287.996,244.801,256,244.801z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-plane.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-plane.svg
new file mode 100644
index 00000000..bbe5d47e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-plane.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_36_">
+ <g>
+ <path d="M448,336v-40L288,192V79.2c0-17.683-14.82-31.2-32-31.2c-17.179,0-32,13.518-32,31.2V192L64,296v40l160-48v113.602
+ l-48,31.199V464l80-16l80,16v-31.199l-48-31.199V288L448,336z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-playstore.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-playstore.svg
new file mode 100644
index 00000000..a1ad5dc0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-playstore.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M464,152H360c0-57-46.562-103.859-104-103.859C198.562,48.141,152,95,152,152H48C66.688,368,61,464,61,464h389.999
+ C450.998,464,445.311,366,464,152z M256,74.105c43.008,0,77.999,34.895,77.999,77.895H178C178,109,212.991,74.105,256,74.105z
+ M204,397.64V228.867l142.999,84.387L204,397.64z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-print.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-print.svg
new file mode 100644
index 00000000..89fa7e03
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-print.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M399.95,160h-287.9C76.824,160,48,188.803,48,224v138.667h79.899V448h256.201v-85.333H464V224
+ C464,188.803,435.175,160,399.95,160z M352,416H160V288h192V416z M384.101,64H127.899v80h256.201V64z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-radio-button-off.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-radio-button-off.svg
new file mode 100644
index 00000000..59042e31
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-radio-button-off.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_20_">
+ <g>
+ <path d="M256,48C141.601,48,48,141.601,48,256s93.601,208,208,208s208-93.601,208-208S370.399,48,256,48z M256,422.399
+ c-91.518,0-166.399-74.882-166.399-166.399S164.482,89.6,256,89.6S422.4,164.482,422.4,256S347.518,422.399,256,422.399z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-radio-button-on.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-radio-button-on.svg
new file mode 100644
index 00000000..06c0235e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-radio-button-on.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_21_">
+ <g>
+ <path d="M256,152c-57.2,0-104,46.8-104,104s46.8,104,104,104s104-46.8,104-104S313.2,152,256,152z M256,48
+ C141.601,48,48,141.601,48,256s93.601,208,208,208s208-93.601,208-208S370.399,48,256,48z M256,422.4
+ c-91.518,0-166.4-74.883-166.4-166.4S164.482,89.6,256,89.6S422.4,164.482,422.4,256S347.518,422.4,256,422.4z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-refresh.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-refresh.svg
new file mode 100644
index 00000000..5b8867c2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-refresh.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,388c-72.597,0-132-59.405-132-132c0-72.601,59.403-132,132-132c36.3,0,69.299,15.4,92.406,39.601L278,234h154V80
+ l-51.698,51.702C348.406,99.798,304.406,80,256,80c-96.797,0-176,79.203-176,176s78.094,176,176,176
+ c81.045,0,148.287-54.134,169.401-128H378.85C360.105,353.561,311.712,388,256,388z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-remove-circle.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-remove-circle.svg
new file mode 100644
index 00000000..341b22ea
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-remove-circle.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,48C141.125,48,48,141.125,48,256s93.125,208,208,208s208-93.125,208-208S370.875,48,256,48z M363,277H149v-42h214V277
+ z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-remove.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-remove.svg
new file mode 100644
index 00000000..d3cacf5f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-remove.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<rect x="96" y="235" width="320" height="42"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-restaurant.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-restaurant.svg
new file mode 100644
index 00000000..582e9bff
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-restaurant.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_38_">
+ <g>
+ <g>
+ <path d="M164.852,279.939l61.834-60.251L73.72,71.706c-33.626,32.764-33.626,86.677,0,119.44L164.852,279.939z"/>
+ <path d="M312.389,241.88c33.636,14.802,80.283,4.232,113.91-29.593c41.222-40.165,49.909-98.303,17.363-128.96
+ c-31.465-31.71-91.131-23.245-132.354,16.921c-34.718,33.825-45.566,79.276-30.374,110.986
+ C233.195,258.802,69.382,418.407,69.382,418.407L99.759,448l149.71-145.866L399.177,448l30.374-29.593L279.842,272.538
+ L312.389,241.88z"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sad.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sad.svg
new file mode 100644
index 00000000..11a9d9e1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sad.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,288c-45.443,0-83.675,26.076-102.205,64h204.41C339.675,314.076,301.443,288,256,288z"/>
+ <path d="M256,48C140.563,48,48,141.6,48,256c0,114.4,92.563,208,208,208s208-93.6,208-208C464,141.6,370.401,48,256,48z M256,422.4
+ c-91.518,0-166.404-74.883-166.404-166.4c0-91.518,74.887-166.4,166.404-166.4S422.404,164.482,422.404,256
+ C422.404,347.518,347.518,422.4,256,422.4z"/>
+ <path d="M328.8,235.2c17.683,0,31.201-13.518,31.201-31.2s-13.519-31.2-31.201-31.2c-17.682,0-31.2,13.518-31.2,31.2
+ S311.118,235.2,328.8,235.2z"/>
+ <path d="M183.2,235.2c17.682,0,31.2-13.518,31.2-31.2s-13.519-31.2-31.2-31.2c-17.683,0-31.201,13.518-31.201,31.2
+ S165.518,235.2,183.2,235.2z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-search.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-search.svg
new file mode 100644
index 00000000..ef9d3f66
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-search.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_4_">
+ <g>
+ <g>
+ <g>
+ <path d="M337.509,305.372h-17.501l-6.571-5.486c20.791-25.232,33.922-57.054,33.922-93.257
+ C347.358,127.632,283.896,64,205.135,64C127.452,64,64,127.632,64,206.629s63.452,142.628,142.225,142.628
+ c35.011,0,67.831-13.167,92.991-34.008l6.561,5.487v17.551L415.18,448L448,415.086L337.509,305.372z M206.225,305.372
+ c-54.702,0-98.463-43.887-98.463-98.743c0-54.858,43.761-98.742,98.463-98.742c54.7,0,98.462,43.884,98.462,98.742
+ C304.687,261.485,260.925,305.372,206.225,305.372z"/>
+ </g>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-send.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-send.svg
new file mode 100644
index 00000000..8f80fb4b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-send.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<polygon points="48,448 464,256 48,64 48,213.333 346,256 48,298.667 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-settings.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-settings.svg
new file mode 100644
index 00000000..c16b089b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-settings.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M413.967,276.8c1.06-6.235,1.06-13.518,1.06-20.8s-1.06-13.518-1.06-20.8l44.667-34.318
+ c4.26-3.118,5.319-8.317,2.13-13.518L418.215,115.6c-2.129-4.164-8.507-6.235-12.767-4.164l-53.186,20.801
+ c-10.638-8.318-23.394-15.601-36.16-20.801l-7.448-55.117c-1.06-4.154-5.319-8.318-10.638-8.318h-85.098
+ c-5.318,0-9.577,4.164-10.637,8.318l-8.508,55.117c-12.767,5.2-24.464,12.482-36.171,20.801l-53.186-20.801
+ c-5.319-2.071-10.638,0-12.767,4.164l-42.549,71.765c-2.119,4.153-1.061,10.399,2.129,13.518L96.97,235.2
+ c0,7.282-1.06,13.518-1.06,20.8s1.06,13.518,1.06,20.8l-44.668,34.318c-4.26,3.118-5.318,8.317-2.13,13.518L92.721,396.4
+ c2.13,4.164,8.508,6.235,12.767,4.164l53.187-20.801c10.637,8.318,23.394,15.601,36.16,20.801l8.508,55.117
+ c1.069,5.2,5.318,8.318,10.637,8.318h85.098c5.319,0,9.578-4.164,10.638-8.318l8.518-55.117c12.757-5.2,24.464-12.482,36.16-20.801
+ l53.187,20.801c5.318,2.071,10.637,0,12.767-4.164l42.549-71.765c2.129-4.153,1.06-10.399-2.13-13.518L413.967,276.8z
+ M255.468,328.8c-41.489,0-74.46-32.235-74.46-72.8s32.971-72.8,74.46-72.8s74.461,32.235,74.461,72.8S296.957,328.8,255.468,328.8
+ z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-share-alt.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-share-alt.svg
new file mode 100644
index 00000000..821b4e21
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-share-alt.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_33_">
+ <g>
+ <path d="M383.822,344.427c-16.045,0-31.024,5.326-41.721,15.979l-152.957-88.42c1.071-5.328,2.142-9.593,2.142-14.919
+ c0-5.328-1.071-9.593-2.142-14.919l150.826-87.35c11.762,10.653,26.741,17.041,43.852,17.041c35.295,0,64.178-28.766,64.178-63.92
+ C448,72.767,419.117,44,383.822,44c-35.297,0-64.179,28.767-64.179,63.92c0,5.327,1.065,9.593,2.142,14.919l-150.821,87.35
+ c-11.767-10.654-26.741-17.041-43.856-17.041c-35.296,0-63.108,28.766-63.108,63.92c0,35.153,28.877,63.92,64.178,63.92
+ c17.115,0,32.089-6.389,43.856-17.042l151.891,88.421c-1.076,4.255-2.141,8.521-2.141,13.847
+ c0,34.094,27.806,61.787,62.037,61.787c34.229,0,62.036-27.693,62.036-61.787C445.858,372.12,418.052,344.427,383.822,344.427z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-share.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-share.svg
new file mode 100644
index 00000000..a38c4aba
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-share.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_17_">
+ <g>
+ <path d="M448,248L288,96v85.334C138.666,202.667,85.333,309.334,64,416c53.333-74.666,117.333-108.802,224-108.802v87.469L448,248
+ z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star-half.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star-half.svg
new file mode 100644
index 00000000..53a14d00
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star-half.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M458,210.409l-145.267-12.476L256,64l-56.743,133.934L54,210.409l110.192,95.524L131.161,448L256,372.686L380.83,448
+ l-33.021-142.066L458,210.409z M272.531,345.287L256,335.313l-0.002-189.277l27.27,64.379l7.52,17.751l19.208,1.65l69.846,5.998
+ l-52.993,45.939l-14.576,12.636l4.367,18.788l15.875,68.299L272.531,345.287z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star-outline.svg
new file mode 100644
index 00000000..3a143120
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star-outline.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M458,210.409l-145.267-12.476L256,64l-56.743,133.934L54,210.409l110.192,95.524L131.161,448L256,372.686L380.83,448
+ l-33.021-142.066L458,210.409z M272.531,345.286L256,335.312l-16.53,9.973l-59.988,36.191l15.879-68.296l4.369-18.79l-14.577-12.637
+ l-52.994-45.939l69.836-5.998l19.206-1.65l7.521-17.75l27.276-64.381l27.27,64.379l7.52,17.751l19.208,1.65l69.846,5.998
+ l-52.993,45.939l-14.576,12.636l4.367,18.788l15.875,68.299L272.531,345.286z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star.svg
new file mode 100644
index 00000000..4e0265f6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="256,372.686 380.83,448 347.809,305.934 458,210.409 312.733,197.934 256,64 199.257,197.934 54,210.409
+ 164.192,305.934 131.161,448 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-stopwatch.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-stopwatch.svg
new file mode 100644
index 00000000..93a6fd44
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-stopwatch.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g id="Icon_7_">
+ <g>
+ <path d="M232,306.667h48V176h-48V306.667z"/>
+ </g>
+ </g>
+ <g>
+ <path d="M407.67,170.271l30.786-30.786l-33.942-33.941l-30.785,30.786C341.217,111.057,300.369,96,256,96
+ C149.961,96,64,181.961,64,288s85.961,192,192,192s192-85.961,192-192C448,243.631,432.943,202.783,407.67,170.271z
+ M362.066,394.066C333.734,422.398,296.066,438,256,438s-77.735-15.602-106.066-43.934C121.602,365.735,106,328.066,106,288
+ s15.602-77.735,43.934-106.066C178.265,153.602,215.934,138,256,138s77.734,15.602,106.066,43.934
+ C390.398,210.265,406,247.934,406,288S390.398,365.735,362.066,394.066z"/>
+ <rect x="192" y="32" width="128" height="48"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-subway.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-subway.svg
new file mode 100644
index 00000000..ad497847
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-subway.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,48c-93.864,0-176,10.668-176,85.334v213.332c0,41.604,33.062,74.666,74.667,74.666L128,448v16h256v-16l-26.667-26.668
+ c41.604,0,74.667-33.062,74.667-74.666V133.334C432,58.668,349.864,48,256,48z M160,384c-18.136,0-32-13.865-32-32
+ c0-18.137,13.864-32,32-32s32,13.863,32,32C192,370.135,178.136,384,160,384z M240,240H128v-96h112V240z M352,384
+ c-18.136,0-32-13.865-32-32c0-18.137,13.864-32,32-32s32,13.863,32,32C384,370.135,370.136,384,352,384z M384,240H272v-96h112V240z
+ "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sunny.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sunny.svg
new file mode 100644
index 00000000..c40c5807
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sunny.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_27_">
+ <g>
+ <path d="M256,160c25.499,0,49.567,10.025,67.771,28.229C341.975,206.433,352,230.501,352,256s-10.025,49.567-28.229,67.771
+ C305.567,341.975,281.499,352,256,352s-49.567-10.025-67.771-28.229C170.025,305.567,160,281.499,160,256
+ s10.025-49.567,28.229-67.771C206.433,170.025,230.501,160,256,160 M277.333,32h-42.666v64h42.666V32L277.333,32z M406.396,75.729
+ L368,114.135L397.864,144l38.406-38.396L406.396,75.729L406.396,75.729z M105.604,75.729l-29.875,29.875L114.136,144L144,114.135
+ L105.604,75.729L105.604,75.729z M256,128c-70.396,0-128,57.604-128,128s57.604,128,128,128s128-57.604,128-128
+ S326.396,128,256,128L256,128z M480,234.666h-64v42.668h64V234.666L480,234.666z M96,234.666H32v42.668h64V234.666L96,234.666z
+ M397.864,368L368,397.865l38.396,38.406l29.875-29.875L397.864,368L397.864,368z M114.136,368l-38.406,38.396l29.875,29.875
+ L144,397.865L114.136,368L114.136,368z M277.333,416h-42.666v64c6.396,0,42.666,0,42.666,0V416L277.333,416z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sync.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sync.svg
new file mode 100644
index 00000000..d91eeec0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sync.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,93.09V32l-80,81.454l80,81.456v-61.093c65.996,0,120,54.982,120,122.183c0,20.363-5,39.714-14.004,57.016L391,342.547
+ c15.996-25.457,25-54.988,25-86.547C416,166.401,343.998,93.09,256,93.09z M256,378.184c-66.001,0-120-54.988-120-122.184
+ c0-20.363,5-39.709,13.999-57.02L121,169.454C104.999,193.89,96,224.436,96,256c0,89.599,72.002,162.91,160,162.91V480l80-81.453
+ l-80-81.457V378.184z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-textsms.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-textsms.svg
new file mode 100644
index 00000000..294516bc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-textsms.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M408,64H96c-22.002,0-32,17.998-32,40v344l64-64h280c22.002,0,40-17.998,40-40V104C448,81.998,430.002,64,408,64z
+ M198.4,242H160v-40h38.4V242z M275.2,242h-38.4v-40h38.4V242z M352,242h-38.4v-40H352V242z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-time.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-time.svg
new file mode 100644
index 00000000..929b2370
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-time.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_1_">
+ <g>
+ <g>
+ <path fill-opacity="0.9" d="M256,43C137.789,43,43,138.851,43,256s94.789,213,213,213s213-95.851,213-213S373.149,43,256,43z
+ M256,426.4c-93.718,0-170.4-76.683-170.4-170.4S162.282,85.6,256,85.6S426.4,162.282,426.4,256S349.718,426.4,256,426.4z"/>
+ </g>
+ <polygon fill-opacity="0.9" points="266.65,149.5 234.7,149.5 234.7,277.3 346.525,344.393 362.5,317.768 266.65,261.324 "/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-train.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-train.svg
new file mode 100644
index 00000000..1cd6da6d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-train.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_35_">
+ <g>
+ <g>
+ <path d="M80,346.666c0,41.604,33.062,74.666,74.667,74.666L128,448v16h256v-16l-26.667-26.668
+ c41.604,0,74.667-33.062,74.667-74.666V133.334C432,58.668,349.864,48,256,48S80,58.668,80,133.334V346.666z M256,376
+ c-22.002,0-40-17.997-40-39.999S233.998,296,256,296s40,17.999,40,40.001S278.002,376,256,376z M384,224H128v-96h256V224z"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-unlock.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-unlock.svg
new file mode 100644
index 00000000..6b816ac2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-unlock.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M376,186h-20v-40c0-55-45-100-100-100S156,91,156,146h37.998c0-34.004,28.003-62.002,62.002-62.002
+ c34.004,0,62.002,27.998,62.002,62.002H318v40H136c-22.002,0-40,17.998-40,40v200c0,22.002,17.998,40,40,40h240
+ c22.002,0,40-17.998,40-40V226C416,203.998,398.002,186,376,186z M256,368c-22.002,0-40-17.998-40-40s17.998-40,40-40
+ s40,17.998,40,40S278.002,368,256,368z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-upload.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-upload.svg
new file mode 100644
index 00000000..ed7edd2a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-upload.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M403.002,217.001C388.998,148.002,328.998,96,256,96c-57.998,0-107.998,32.998-132.998,81.001
+ C63.002,183.002,16,233.998,16,296c0,65.996,53.999,120,120,120h260c55,0,100-45,100-100
+ C496,263.002,455.004,219.999,403.002,217.001z M288,276v76h-64v-76h-68l100-100l100,100H288z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-down.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-down.svg
new file mode 100644
index 00000000..ceac980e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-down.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M64,192v128h85.334L256,431.543V80.458L149.334,192H64z M352,256c0-38.399-21.333-72.407-53.333-88.863v176.636
+ C330.667,328.408,352,294.4,352,256z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-mute.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-mute.svg
new file mode 100644
index 00000000..6cb847b7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-mute.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M64,192v128h85.334L256,431.543V80.458L149.334,192H64z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-off.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-off.svg
new file mode 100644
index 00000000..517c3138
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-off.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M405.5,256c0,22.717-4.883,44.362-13.603,63.855l31.88,31.88C439.283,323.33,448,290.653,448,256
+ c0-93.256-64-172.254-149-192v44.978C361,127.632,405.5,186.882,405.5,256z"/>
+ <polygon points="256,80.458 204.979,132.938 256,183.957 "/>
+ <path d="M420.842,396.885L91.116,67.157l-24,24l90.499,90.413l-8.28,10.43H64v128h85.334L256,431.543V280l94.915,94.686
+ C335.795,387.443,318,397.213,299,403.022V448c31-7.172,58.996-22.163,82.315-42.809l39.61,39.693l24-24.043l-24.002-24.039
+ L420.842,396.885z"/>
+ <path d="M352.188,256c0-38.399-21.188-72.407-53.188-88.863v59.82l50.801,50.801C351.355,270.739,352.188,263.454,352.188,256z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-up.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-up.svg
new file mode 100644
index 00000000..0a8b8b53
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-up.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M64,192v128h85.334L256,431.543V80.458L149.334,192H64z M352,256c0-38.399-21.333-72.407-53.333-88.863v176.636
+ C330.667,328.408,352,294.4,352,256z M298.667,64v44.978C360.531,127.632,405.334,186.882,405.334,256
+ c0,69.119-44.803,128.369-106.667,147.022V448C384,428.254,448,349.257,448,256C448,162.744,384,83.746,298.667,64z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-walk.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-walk.svg
new file mode 100644
index 00000000..38252ac8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-walk.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M288,112c22.223,0,39.997-17.776,39.997-40c0-22.225-17.774-40-39.997-40s-40.003,17.775-40.003,40
+ C247.997,94.224,265.777,112,288,112z"/>
+ <path d="M288,232h104v-40h-72l-44.802-69.333c-7.698-11.667-18.136-18.136-30.933-18.136c-3.198,0-8.828,0.531-12.799,1.747
+ L120,144v112h40v-80l40.531-16L120,480h40l56.698-164.271L267,384v96h38V352l-57.031-96l19.745-61.864L288,232z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-warning.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-warning.svg
new file mode 100644
index 00000000..1525a3eb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-warning.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_31_">
+ <g>
+ <path d="M32,464h448L256,48L32,464z M280,400h-48v-48h48V400z M280,320h-48v-96h48V320z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-watch.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-watch.svg
new file mode 100644
index 00000000..6ecfdf7c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-watch.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon_11_">
+ <g>
+ <g>
+ <path d="M416,256c0-51.001-24.004-96.001-60.996-125L336,16H176l-19.004,115C120.004,159.999,96,204.999,96,256
+ c0,50.996,24.004,95.996,60.996,125L176,496h160l19.004-115C391.996,351.996,416,306.996,416,256z M136,256
+ c0-66.001,54.004-120,120-120s120,53.999,120,120c0,65.996-54.004,120-120,120S136,321.996,136,256z"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-wifi.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-wifi.svg
new file mode 100644
index 00000000..73615429
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-wifi.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,228.719c-22.879,0-41.597,18.529-41.597,41.18c0,22.652,18.718,41.182,41.597,41.182
+ c22.878,0,41.597-18.529,41.597-41.182C297.597,247.248,278.878,228.719,256,228.719z M380.8,269.898
+ c0-67.946-56.163-123.539-124.8-123.539s-124.8,55.593-124.8,123.539c0,45.303,24.961,85.447,62.396,107.072l20.807-36.032
+ c-24.972-14.417-41.604-40.153-41.604-71.04c0-45.295,37.433-82.358,83.201-82.358c45.771,0,83.201,37.063,83.201,82.358
+ c0,30.887-16.633,56.623-41.604,71.04l20.807,36.032C355.837,355.346,380.8,315.201,380.8,269.898z M256,64
+ C141.597,64,48,156.654,48,269.898C48,346.085,89.592,411.968,152,448l20.799-36.032c-49.919-28.824-83.207-81.324-83.207-142.069
+ c0-90.593,74.891-164.718,166.408-164.718c91.517,0,166.406,74.125,166.406,164.718c0,60.745-33.284,114.271-83.205,142.069L360,448
+ c62.406-36.032,104-101.915,104-178.102C464,156.654,370.403,64,256,64z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/aperture.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/aperture.svg
new file mode 100644
index 00000000..41cf7ebe
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/aperture.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,32C132.288,32,32,132.288,32,256s100.288,224,224,224s224-100.288,224-224S379.712,32,256,32z M391.765,391.765
+ C355.5,428.028,307.285,448,256,448s-99.5-19.972-135.765-56.235C83.972,355.5,64,307.285,64,256s19.972-99.5,56.235-135.765
+ C156.5,83.972,204.715,64,256,64s99.5,19.972,135.765,56.235C428.028,156.5,448,204.715,448,256S428.028,355.5,391.765,391.765z"/>
+ <g>
+ <path d="M200.043,106.067c-40.631,15.171-73.434,46.382-90.717,85.933H256L200.043,106.067z"/>
+ <path d="M412.797,288c2.099-10.34,3.203-21.041,3.203-32c0-36.624-12.314-70.367-33.016-97.334L311,288H412.797z"/>
+ <path d="M359.973,134.395C332.007,110.461,295.694,96,256,96c-7.966,0-15.794,0.591-23.448,1.715L310.852,224L359.973,134.395z"/>
+ <path d="M99.204,224C97.104,234.34,96,245.041,96,256c0,36.639,12.324,70.394,33.041,97.366L201,224H99.204z"/>
+ <path d="M311.959,405.932c40.631-15.171,73.433-46.382,90.715-85.932H256L311.959,405.932z"/>
+ <path d="M152.046,377.621C180.009,401.545,216.314,416,256,416c7.969,0,15.799-0.592,23.456-1.716L201.164,288L152.046,377.621z"
+ />
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/archive.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/archive.svg
new file mode 100644
index 00000000..44eb44b6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/archive.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="256,307.7 384,192 304,192 304,96 207.6,96 207.6,192 128,192 "/>
+ <path d="M465.4,297.2l-71.4-55h-42l62,61.8h-50.6c-2.3,0-4.3,1.2-5.4,2.9l-18.4,45.5H172.1l-18.4-45.5c-1-1.8-3.1-2.9-5.4-2.9H97.8
+ l62.2-61.8h-42.2l-71.4,55c-10.6,6.2-15.8,19-14.1,31.6l8.7,66.9c2.3,13.1,9.7,20.3,28.1,20.3h373.8c19.1,0,25.8-7.6,28.1-20.3
+ l8.7-66.9C481.4,315.9,476,303.4,465.4,297.2z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-a.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-a.svg
new file mode 100644
index 00000000..7d476caf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-a.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="256.5,448.5 448.5,256.5 336.5,256.5 336.5,64.5 176.5,64.5 176.5,256.5 64.5,256.5 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-b.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-b.svg
new file mode 100644
index 00000000..247b81f4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-b.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M98.9,184.7l1.8,2.1l136,156.5c4.6,5.3,11.5,8.6,19.2,8.6c7.7,0,14.6-3.4,19.2-8.6L411,187.1l2.3-2.6
+ c1.7-2.5,2.7-5.5,2.7-8.7c0-8.7-7.4-15.8-16.6-15.8v0H112.6v0c-9.2,0-16.6,7.1-16.6,15.8C96,179.1,97.1,182.2,98.9,184.7z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-c.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-c.svg
new file mode 100644
index 00000000..d8ef45b3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-c.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M383.6,322.7L278.6,423c-5.8,6-13.7,9-22.4,9c-8.7,0-16.5-3-22.4-9L128.4,322.7c-12.5-11.9-12.5-31.3,0-43.2
+ c12.5-11.9,32.7-11.9,45.2,0l50.4,48.2v-217c0-16.9,14.3-30.6,32-30.6c17.7,0,32,13.7,32,30.6v217l50.4-48.2
+ c12.5-11.9,32.7-11.9,45.2,0C396.1,291.4,396.1,310.7,383.6,322.7z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-expand.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-expand.svg
new file mode 100644
index 00000000..268973dc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-expand.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="274,209.7 337.9,145.9 288,96 416,96 416,224 366.1,174.1 302.3,238 "/>
+ <polygon points="274,302.3 337.9,366.1 288,416 416,416 416,288 366.1,337.9 302.3,274 "/>
+ <polygon points="238,302.3 174.1,366.1 224,416 96,416 96,288 145.9,337.9 209.7,274 "/>
+ <polygon points="238,209.7 174.1,145.9 224,96 96,96 96,224 145.9,174.1 209.7,238 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-down-left.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-down-left.svg
new file mode 100644
index 00000000..85f8dce0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-down-left.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="32,384 32,224 92.8,284.8 223.7,144 330.7,256 480,128 330.7,330.7 223.7,224 130.2,322.2 192,384 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-down-right.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-down-right.svg
new file mode 100644
index 00000000..bd77539a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-down-right.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="320,384 381.8,322.2 288.3,224 181.3,330.7 32,128 181.3,256 288.3,144 419.2,284.8 480,224 480,384 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-up-left.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-up-left.svg
new file mode 100644
index 00000000..57ea68cb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-up-left.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="192,128 130.2,189.8 223.7,288 330.7,181.3 480,384 330.7,256 223.7,368 92.8,227.2 32,288 32,128 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-up-right.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-up-right.svg
new file mode 100644
index 00000000..689af444
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-up-right.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="320,128 381.8,189.8 288.3,288 181.3,181.3 32,384 181.3,256 288.3,368 419.2,227.2 480,288 480,128 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-a.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-a.svg
new file mode 100644
index 00000000..ad3fb71f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-a.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="64.5,256.5 256.5,448.5 256.5,336.5 448.5,336.5 448.5,176.5 256.5,176.5 256.5,64.5 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-b.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-b.svg
new file mode 100644
index 00000000..43602dbe
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-b.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M327.3,98.9l-2.1,1.8l-156.5,136c-5.3,4.6-8.6,11.5-8.6,19.2c0,7.7,3.4,14.6,8.6,19.2L324.9,411l2.6,2.3
+ c2.5,1.7,5.5,2.7,8.7,2.7c8.7,0,15.8-7.4,15.8-16.6h0V112.6h0c0-9.2-7.1-16.6-15.8-16.6C332.9,96,329.8,97.1,327.3,98.9z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-c.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-c.svg
new file mode 100644
index 00000000..b4a07c85
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-c.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M189.3,128.4L89,233.4c-6,5.8-9,13.7-9,22.4c0,8.7,3,16.5,9,22.4l100.3,105.4c11.9,12.5,31.3,12.5,43.2,0
+ c11.9-12.5,11.9-32.7,0-45.2L184.4,288h217c16.9,0,30.6-14.3,30.6-32c0-17.7-13.7-32-30.6-32h-217l48.2-50.4
+ c11.9-12.5,11.9-32.7,0-45.2C220.6,115.9,201.3,115.9,189.3,128.4z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-move.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-move.svg
new file mode 100644
index 00000000..52541875
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-move.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="480,256 384,160 384,236 276,236 276,128 352,128 256,32 160,128 236,128 236,236 128,236 128,160 32,256 128,352
+ 128,276 236,276 236,384 160,384 256,480 352,384 275.8,384 275.4,275.5 384,275.8 384,352 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-resize.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-resize.svg
new file mode 100644
index 00000000..24feb255
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-resize.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="288,96 337.9,145.9 274,209.7 274,209.7 145.9,337.9 96,288 96,416 224,416 174.1,366.1 357.4,182.9 366.1,174.1
+ 416,224 416,96 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-return-left.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-return-left.svg
new file mode 100644
index 00000000..a2dbb861
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-return-left.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M192,96v64h248c4.4,0,8,3.6,8,8v240c0,4.4-3.6,8-8,8H136c-4.4,0-8-3.6-8-8v-48c0-4.4,3.6-8,8-8h248V224H192v64L64,192
+ L192,96z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-return-right.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-return-right.svg
new file mode 100644
index 00000000..79deb8b8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-return-right.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M448,192l-128,96v-64H128v128h248c4.4,0,8,3.6,8,8v48c0,4.4-3.6,8-8,8H72c-4.4,0-8-3.6-8-8V168c0-4.4,3.6-8,8-8h248V96
+ L448,192z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-a.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-a.svg
new file mode 100644
index 00000000..fb6d0d67
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-a.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="448.5,256.5 256.5,64.5 256.5,176.5 64.5,176.5 64.5,336.5 256.5,336.5 256.5,448.5 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-b.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-b.svg
new file mode 100644
index 00000000..847718b3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-b.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M184.7,413.1l2.1-1.8l156.5-136c5.3-4.6,8.6-11.5,8.6-19.2c0-7.7-3.4-14.6-8.6-19.2L187.1,101l-2.6-2.3
+ C182,97,179,96,175.8,96c-8.7,0-15.8,7.4-15.8,16.6h0v286.8h0c0,9.2,7.1,16.6,15.8,16.6C179.1,416,182.2,414.9,184.7,413.1z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-c.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-c.svg
new file mode 100644
index 00000000..97f20cad
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-c.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M322.7,128.4L423,233.4c6,5.8,9,13.7,9,22.4c0,8.7-3,16.5-9,22.4L322.7,383.6c-11.9,12.5-31.3,12.5-43.2,0
+ c-11.9-12.5-11.9-32.7,0-45.2l48.2-50.4h-217C93.7,288,80,273.7,80,256c0-17.7,13.7-32,30.6-32h217l-48.2-50.4
+ c-11.9-12.5-11.9-32.7,0-45.2C291.4,115.9,310.7,115.9,322.7,128.4z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-shrink.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-shrink.svg
new file mode 100644
index 00000000..5c29eddb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-shrink.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="448,92.3 366.1,174.1 416,224 288,224 288,96 337.9,145.9 419.7,64 "/>
+ <polygon points="448,419.7 366.1,337.9 416,288 288,288 288,416 337.9,366.1 419.7,448 "/>
+ <polygon points="64,419.7 145.9,337.9 96,288 224,288 224,416 174.1,366.1 92.3,448 "/>
+ <polygon points="64,92.3 145.9,174.1 96,224 224,224 224,96 174.1,145.9 92.3,64 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-swap.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-swap.svg
new file mode 100644
index 00000000..aabe881e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-swap.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M64,328v48c0,4.4,3.6,8,8,8h248v64l128-96l-128-96v64H72C67.6,320,64,323.6,64,328z"/>
+ <path d="M448,184v-48c0-4.4-3.6-8-8-8H192V64L64,160l128,96v-64h248C444.4,192,448,188.4,448,184z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-a.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-a.svg
new file mode 100644
index 00000000..f908a1bd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-a.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="256.5,64.5 64.5,256.5 176.5,256.5 176.5,448.5 336.5,448.5 336.5,256.5 448.5,256.5 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-b.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-b.svg
new file mode 100644
index 00000000..01b790de
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-b.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M413.1,327.3l-1.8-2.1l-136-156.5c-4.6-5.3-11.5-8.6-19.2-8.6c-7.7,0-14.6,3.4-19.2,8.6L101,324.9l-2.3,2.6
+ C97,330,96,333,96,336.2c0,8.7,7.4,15.8,16.6,15.8v0h286.8v0c9.2,0,16.6-7.1,16.6-15.8C416,332.9,414.9,329.8,413.1,327.3z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-c.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-c.svg
new file mode 100644
index 00000000..cc291b3d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-c.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M128.4,189.3L233.4,89c5.8-6,13.7-9,22.4-9c8.7,0,16.5,3,22.4,9l105.4,100.3c12.5,11.9,12.5,31.3,0,43.2
+ c-12.5,11.9-32.7,11.9-45.2,0L288,184.4v217c0,16.9-14.3,30.6-32,30.6c-17.7,0-32-13.7-32-30.6v-217l-50.4,48.2
+ c-12.5,11.9-32.7,11.9-45.2,0C115.9,220.6,115.9,201.3,128.4,189.3z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/asterisk.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/asterisk.svg
new file mode 100644
index 00000000..34f54922
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/asterisk.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<polygon points="480,224 293.172,231.487 401.688,64 342.441,32 256,208 169.824,32 110.328,64 218.828,231.487 32,224 32,288
+ 217.537,277.934 113.65,448 169.619,480 256,304 342.381,480 398.33,448 294.463,277.934 480,288 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/at.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/at.svg
new file mode 100644
index 00000000..7d8a68b6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/at.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M453.8,407.1c-23.9,25.3-52.3,43.8-85.2,55.4C335.7,474.2,301,480,264.5,480c-34.9,0-66.7-5.5-95.3-16.6
+ c-28.6-11-53.1-26.4-73.3-46.1c-20.3-19.7-36-43.3-47.2-70.8c-11.2-27.5-16.7-57.5-16.7-90c0-32.1,6.1-61.8,18.3-89.1
+ c12.2-27.3,28.8-51,49.9-71.1c21.1-20.1,45.7-35.8,74-47.3C202.3,37.7,232.5,32,264.5,32c27.6,0,54.4,4,80.3,12
+ c26,8,49,20.1,69.1,36.1c20.1,16.1,36.1,36.1,48.1,60.2c12,24.1,18,52.4,18,84.9c0,24.1-3.3,45.4-10,63.8
+ c-6.7,18.5-15.6,33.9-26.8,46.4c-11.2,12.5-23.9,21.8-38.3,28c-14.4,6.2-29.5,9.3-45.3,9.3c-16.2,0-29.2-3.8-39-11.4
+ c-9.7-7.6-14.6-17.3-14.6-28.9h-3c-6.1,9.6-15.4,18.8-28,27.4c-12.6,8.6-28,13-46.3,13c-27.6,0-48.9-9-63.9-27.1
+ c-15-18.1-22.5-41.5-22.5-70.5c0-16.9,2.8-33.5,8.5-50c5.7-16.5,13.8-31.1,24.3-44c10.5-12.8,23.1-23.2,37.7-31
+ c14.6-7.8,30.8-11.7,48.7-11.7c15.4,0,28.4,3.2,39,9.6c10.5,6.4,17.4,14.3,20.7,23.5h0.6l4.9-24.1h54.2L357,261.4
+ c-0.8,5.6-1.9,11.8-3.3,18.7c-1.4,6.8-2.1,13.2-2.1,19.3c0,6.8,1.3,12.5,4,17.2c2.6,4.6,7.8,6.9,15.5,6.9
+ c15.8,0,28.9-8.4,39.3-25.3c10.3-16.9,15.5-39.5,15.5-68c0-24.1-4.1-45.5-12.2-64.1c-8.1-18.7-19.4-34.3-33.8-47
+ c-14.4-12.6-31.6-22.2-51.4-28.6c-19.9-6.4-41.6-9.6-65.1-9.6c-25.6,0-49,4.5-70.3,13.5s-39.5,21.5-54.5,37.3
+ c-15,15.9-26.7,34.5-35,56C95.2,209.1,91,232.3,91,257.2c0,26.5,4.4,50.4,13.1,71.7c8.7,21.3,21,39.4,36.8,54.5
+ c15.8,15.1,34.7,26.6,56.6,34.6c21.9,8,46.1,12,72.4,12c32.9,0,61.2-5.2,84.9-15.7c23.7-10.4,45.5-24.9,65.4-43.4L453.8,407.1z
+ M263.3,188c-9.7,0-18.3,2.8-25.6,8.4c-7.3,5.6-13.5,12.7-18.6,21.4c-5.1,8.6-8.9,18.2-11.6,28.6c-2.6,10.4-4,20.5-4,30.1
+ c0,4.8,0.5,9.9,1.5,15.4c1,5.4,3,10.4,6.1,15.1c3,4.6,7,8.4,11.9,11.4c4.9,3,11.4,4.5,19.5,4.5c11,0,20.3-2.7,28-8.1
+ c7.7-5.4,14-12.2,18.9-20.5c4.9-8.2,8.4-17.2,10.7-26.8c2.2-9.6,3.3-18.5,3.3-26.5c0-6.4-0.6-12.7-1.8-19
+ c-1.2-6.2-3.3-11.8-6.4-16.9c-3-5-7.2-9.1-12.5-12.3C277.5,189.6,271,188,263.3,188z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/backspace-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/backspace-outline.svg
new file mode 100644
index 00000000..19d2fe2c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/backspace-outline.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M413.442,332.307c1.528,1.51,2.372,3.562,2.372,5.71c0,2.151-0.844,4.203-2.372,5.707l-21.823,21.905
+ c-1.575,1.586-3.625,2.371-5.691,2.371c-2.071,0-4.138-0.785-5.695-2.371l-76.23-76.461l-76.23,76.461
+ c-1.558,1.586-3.625,2.371-5.695,2.371c-2.066,0-4.117-0.785-5.692-2.371l-21.824-21.905c-1.527-1.504-2.373-3.556-2.373-5.707
+ c0-2.148,0.846-4.2,2.373-5.71L271.098,256l-76.738-76.297c-3.146-3.153-3.146-8.273,0-11.427l21.807-21.919
+ c1.516-1.511,3.552-2.357,5.696-2.357c2.152,0,4.189,0.847,5.691,2.357l76.448,75.533l76.447-75.533
+ c1.504-1.511,3.541-2.357,5.693-2.357c2.143,0,4.179,0.847,5.695,2.357l21.807,21.919c3.146,3.153,3.146,8.273,0,11.427
+ L336.904,256L413.442,332.307z"/>
+ </g>
+ <path d="M498.941,93.559C490.037,84.654,478.696,80,465.875,80H168c-24.303,0-43.717,9.402-57.706,28.441L0,255.938l110.4,146.528
+ l0.18,0.231l0.184,0.232c6.904,8.855,14.424,15.701,22.99,20.417C143.883,428.924,155.405,432,168,432h298
+ c26.191,0,46-22.257,46-49V127C512,114.179,507.846,102.463,498.941,93.559z M480,383c0,8.837-5.163,17-14,17H168
+ c-15.167,0-24.333-6.666-32-16.5L40,256l96-128.438c9.5-13,21.167-15.562,32-15.562h297.5c8.837,0,14.5,6.163,14.5,15V383z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/backspace.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/backspace.svg
new file mode 100644
index 00000000..f02fff97
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/backspace.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M498.941,93.559C490.037,84.654,478.696,80,465.875,80H168c-24.303,0-43.717,9.402-57.706,28.441L0,255.938l110.4,146.528
+ l0.18,0.231l0.184,0.232c6.904,8.855,14.424,15.701,22.99,20.417C143.883,428.924,155.405,432,168,432h298
+ c26.191,0,46-22.257,46-49V127C512,114.179,507.846,102.463,498.941,93.559z M413.442,332.307c1.528,1.51,2.372,3.562,2.372,5.71
+ c0,2.151-0.844,4.203-2.372,5.707l-21.823,21.905c-1.575,1.586-3.625,2.371-5.691,2.371c-2.071,0-4.138-0.785-5.695-2.371
+ l-76.23-76.461l-76.23,76.461c-1.558,1.586-3.625,2.371-5.695,2.371c-2.066,0-4.117-0.785-5.692-2.371l-21.824-21.905
+ c-1.527-1.504-2.373-3.556-2.373-5.707c0-2.148,0.846-4.2,2.373-5.71L271.098,256l-76.738-76.297
+ c-3.146-3.153-3.146-8.273,0-11.427l21.807-21.919c1.516-1.511,3.552-2.357,5.696-2.357c2.152,0,4.189,0.847,5.691,2.357
+ l76.448,75.533l76.447-75.533c1.504-1.511,3.541-2.357,5.693-2.357c2.143,0,4.179,0.847,5.695,2.357l21.807,21.919
+ c3.146,3.153,3.146,8.273,0,11.427L336.904,256L413.442,332.307z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bag.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bag.svg
new file mode 100644
index 00000000..f66c5ac3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bag.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M448,160h-64v-4.5C384,87,329,32,260.5,32h-8C184,32,128,87,128,155.5v4.5H64L32,480h448L448,160z M160,155.5
+ c0-50.7,41.8-91.5,92.5-91.5h7.5h0.5c50.7,0,91.5,40.8,91.5,91.5v4.5H160V155.5z M67.8,448l24.9-256H128v36.3
+ c-9.6,5.5-16,15.9-16,27.7c0,17.7,14.3,32,32,32s32-14.3,32-32c0-11.8-6.4-22.2-16-27.7V192h192v36.3c-9.6,5.5-16,15.9-16,27.7
+ c0,17.7,14.3,32,32,32s32-14.3,32-32c0-11.8-6.4-22.2-16-27.7V192h35.4l24.9,256H67.8z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-charging.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-charging.svg
new file mode 100644
index 00000000..01586130
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-charging.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M42.1,384h381.1c5.5,0,9.9-4.5,9.9-10v-54h36.9c5.6,0,10.1-4.5,10.1-10V202c0-5.5-4.5-10-10.1-10H433v-54
+ c0-5.5-4.3-10-9.9-10H42.1c-5.6,0-10.1,4.5-10.1,10v236C32,379.5,36.5,384,42.1,384z M257.4,160l-27.9,81H291L190.6,352l27.9-81H157
+ L257.4,160z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-empty.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-empty.svg
new file mode 100644
index 00000000..6659cb26
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-empty.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M469.9,192H433v-54c0-5.5-4.3-10-9.9-10H42.1c-5.6,0-10.1,4.5-10.1,10v236c0,5.5,4.5,10,10.1,10h381.1c5.5,0,9.9-4.5,9.9-10
+ v-54h36.9c5.6,0,10.1-4.5,10.1-10V202C480,196.5,475.5,192,469.9,192z M448,288h-14.8H401v32v32H64V160h337v32v32h32.2H448V288z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-full.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-full.svg
new file mode 100644
index 00000000..a833ec4d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-full.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M469.9,192H433v-54c0-5.5-4.3-10-9.9-10H42.1c-5.6,0-10.1,4.5-10.1,10v236c0,5.5,4.5,10,10.1,10h381.1c5.5,0,9.9-4.5,9.9-10
+ v-54h36.9c5.6,0,10.1-4.5,10.1-10V202C480,196.5,475.5,192,469.9,192z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-half.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-half.svg
new file mode 100644
index 00000000..9b992d00
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-half.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M469.9,192H433v-54c0-5.5-4.3-10-9.9-10H42.1c-5.6,0-10.1,4.5-10.1,10v236c0,5.5,4.5,10,10.1,10h381.1c5.5,0,9.9-4.5,9.9-10
+ v-54h36.9c5.6,0,10.1-4.5,10.1-10V202C480,196.5,475.5,192,469.9,192z M448,288h-14.8H401v32v32h-49l-32-192h81v32v32h32.2H448V288z
+ "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-low.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-low.svg
new file mode 100644
index 00000000..7848ebbb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-low.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M42.1,384h381.1c5.5,0,9.9-4.5,9.9-10v-54h36.9c5.6,0,10.1-4.5,10.1-10V202c0-5.5-4.5-10-10.1-10H433v-54
+ c0-5.5-4.3-10-9.9-10H42.1c-5.6,0-10.1,4.5-10.1,10v236C32,379.5,36.5,384,42.1,384z M401,160v32v32h32.2H448v64h-14.8H401v32v32
+ H224l-32-192H401z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/beaker.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/beaker.svg
new file mode 100644
index 00000000..ecc33942
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/beaker.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M143.5,192.5V416c0,8.836,7.851,16.5,16.688,16.5h208c8.836,0,15.312-7.664,15.312-16.5V192.5H143.5z M359.5,344
+ c0,4.418-3.582,8-8,8s-8-3.582-8-8v-48c0-4.418,3.582-8,8-8s8,3.582,8,8V344z M352.188,272c-4.418,0-8-3.581-8-8s3.582-8,8-8
+ s8,3.581,8,8S356.605,272,352.188,272z"/>
+ </g>
+ <g>
+ <path d="M445.078,32.5H128.438c-54.345,0-64.594,27.426-64.594,39.75C94.094,76.5,95.5,77,95.5,109c0,16,0,307,0,307
+ c0,35.346,29.341,64.5,64.688,64.5h207.75c35.346,0,63.562-29.154,63.562-64.5c0,0,0-316.75,0-335.5
+ c0-20.349,12.298-38.276,13.516-40.183c1.219-1.906,3-3.798,3-4.958C448.016,34.188,447.6,32.5,445.078,32.5z M399.5,80.5V416
+ c0,17.92-12.443,32.5-29.812,32.5h-209.5c-17.617,0-32.688-14.883-32.688-32.5V109c0-11.812,1.094-37.25-3.828-43.957
+ c0.921-0.793,3.114-0.543,4.516-0.543h272.66C400.112,64.5,399.5,75.299,399.5,80.5z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/beer.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/beer.svg
new file mode 100644
index 00000000..be420d0a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/beer.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M416,160h-32v-16c14.5-3.5,32-24.3,32-48c0-35.3-28.7-64-64-64c-16.3,0-31.1,6.1-42.4,16.1C297.2,38,281.4,32,264.2,32
+ c-15.8,0-30.4,5.1-42.3,13.7c-9.9-8.5-22.9-13.7-37-13.7c-17.1,0-32.4,7.6-42.8,19.5C130.4,39.5,114.1,32,96,32
+ c-35.3,0-64,28.7-64,64c0,16.2,6.1,31,16,42.3c0,0.2,0,0.4,0,0.7v54c0,26.5,21.5,48,48,48v223c0,8.8,7.2,16,16,16h256
+ c8.8,0,16-7.2,16-16v-80h32c35.3,0,64-28.7,64-64v-96C480,188.7,451.3,160,416,160z M327.8,304c-1.6,0-3-0.6-4.3-1.4
+ c-2.2-1.4-3.5-4-3.5-6.8V248c0-4.4,3.6-8,8-8c4.4,0,8,3.6,8,8v48.1l0,0C336,301.1,332.2,304,327.8,304z M335,228.4
+ c-1.2,1.8-3,3-5.1,3.5c-2.1,0.4-4.3,0-6-1.1c-1.8-1.2-3-3-3.5-5.1c-0.4-2.1,0-4.3,1.1-6c1.2-1.8,3-3,5.1-3.5c2.1-0.4,4.3,0,6,1.1
+ c1.8,1.2,3,3,3.5,5.1C336.6,224.4,336.2,226.6,335,228.4z M352,160v32H224.2c-0.1-4.3-3.6-7.8-8-7.8c-4.4,0-7.9,3.5-8,7.8H128v-9
+ v-31.6c6.5-3.8,12.3-8.6,17-14.3c1.2-1.5,2.4-3,3.5-4.6c1.5,1.2,3,2.4,4.6,3.4c9.1,6.1,20,9.7,31.7,9.7c6.4,0,12.6-1.1,18.3-3
+ c12.8,20.2,35.3,33.7,61,33.7c22,0,41.7-9.9,54.9-25.4c5.7-6.7,10.2-14.4,13.1-22.9H352V160z M382.6,105.2
+ c-2.5-5.5-8.1-9.2-14.6-9.2h-48h-7c0,0-8.7-0.7-8.7,8.2s-2.9,17.1-7.8,23.7c-7.3,9.9-19.1,16.4-32.4,16.4
+ c-14.9,0-27.9-8.1-34.8-20.2c-1.6-2.7-2.8-5.6-3.7-8.6c-0.1-0.6-0.3-1.1-0.4-1.6c-2-5.9-7.5-10.2-14.1-10.2c-3.9,0-7.5,1.5-10.2,4
+ c0,0,0,0-0.1,0.1c-2.4,2.1-5.3,3.7-8.4,4.7c-2.4,0.8-5,1.2-7.7,1.2c-7.5,0-14.7-4-18.8-8.6c-10-11.4-23.7-6.8-29.7-5.5
+ s-12.2,11.7-12.2,11.7c-1.1,2.1-2.5,4-4,5.8c-5.9,6.7-14.5,11-24.1,11v32v23v26c-8.8,0-16-7.2-16-16v-35v-34.3
+ c-7.7-4.5-13.4-12.1-15.3-21c-0.5-2.1-0.7-4.4-0.7-6.7c0-17.6,14.4-32,32-32c11.8,0,23.3,7.7,30.1,15.4s26.7,7.7,33.9,0
+ c6.8-7.3,14.3-15.4,24.8-15.4c6,0,11.6,2.2,15.9,5.8c1.9,1.6,3.6,3.5,4.9,5.6c1.1,1.8,2,4.2,3.1,5.8c2.7,3.4,6.5,5.5,11.2,5.5
+ c4.4,0,8.3-1.9,11-5c0.6-0.7,1.2-1.5,1.7-2.3c2-2.5,4.2-4.8,6.7-6.8c6.8-5.4,15.5-8.6,24.8-8.6c10.6,0,20.2,4.1,27.4,10.9
+ c1.7,1.6,6.7,4.5,13.2,5.1c4.5,0.4,6.1,0.3,8.2,0c10.3-1.3,14.4-4.7,16.4-6.6c5.8-5.8,13.8-9.4,22.6-9.4c17.6,0,32,14.4,32,32
+ C384,99.2,383.5,102.3,382.6,105.2z M448,320c0,17.7-14.3,32-32,32h-32V192h32c17.7,0,32,14.3,32,32V320z"/>
+ <circle cx="168.2" cy="168.2" r="8"/>
+ <circle cx="328.2" cy="168.2" r="8"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bluetooth.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bluetooth.svg
new file mode 100644
index 00000000..798ef293
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bluetooth.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M140,143.6c-15.9,15.9-11.7,17.3-10.6,18.4c1.1,1.1,89.8,85.6,89.8,85.6s3.9,3.4,3.9,8.4h0c0,5-3.9,8.4-3.9,8.4
+ s-88.7,84.5-89.8,85.6c-1.1,1.1-5.3,2.5,10.6,18.4c15.9,15.9,18.4,12.2,19.2,11.4l67.4-64.3c0.1-0.1,0.2-0.2,0.3-0.3
+ c0.1-0.1,0.3-0.2,0.4-0.3c2.3-1.9,9.8-10.6,9.8-3.2c0,7.3,0,151.8,0,156.4v0.1v1.7c0,5.5,5.2,10.1,11.6,10.1c3.5,0,6.7-1.3,8.9-3.5
+ l0,0c0,0,118.2-112.8,122.8-117.2c4.6-4.4,5-10.7,1-14.7l-83.9-80.3c0,0-4.4-4.3-4.4-8.3s4.4-8.3,4.4-8.3l83.9-80.3
+ c4-4,3.6-10.4-1-14.7c-4.6-4.4-122.8-117.2-122.8-117.2l0,0c-2.1-2.1-5.3-3.5-8.8-3.5c-6.4,0-11.6,4.6-11.6,10.1v1.7V44
+ c0,4.6,0,149.1,0,156.4c0,7.4-7.5-1.3-9.8-3.2c-0.1-0.1-0.3-0.2-0.4-0.3c-0.1-0.1-0.2-0.2-0.3-0.3l-67.4-64.3
+ C158.3,131.4,155.9,127.7,140,143.6z M280,119.9c0-6.6,7.5,2.3,9.8,4.4l30.5,29.2c2.1,2,2.9,4.7,2.9,7.2c0,2.5-1,5.6-2.8,7.3
+ c-1.8,1.7-30.8,29.5-30.8,29.5c-2.3,1.8-9.6,9.8-9.6,1.7C280,199.2,280,126.5,280,119.9z M280,312.8c0-8.2,7.2-0.2,9.6,1.7
+ c0,0,29.1,27.8,30.9,29.5c1.8,1.7,2.8,4.9,2.8,7.3s-0.8,5.2-2.9,7.2l-30.5,29.2c-2.3,2.1-9.8,11-9.8,4.4
+ C280,385.5,280,312.8,280,312.8z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bonfire.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bonfire.svg
new file mode 100644
index 00000000..e3a69b89
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bonfire.svg
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M270.93,350.601C270.219,342.42,263.364,336,255,336c-7.635,0-14.01,5.352-15.605,12.506l-0.007-0.002l-15.612,92.502
+ C223.273,443.258,223,445.597,223,448c0,17.673,14.327,32,32,32s32-14.327,32-32c0-2.899-0.393-5.705-1.115-8.377L270.93,350.601z"
+ />
+ <polygon points="305.904,355.046 305.903,355.044 305.9,355.046 "/>
+ <path d="M392.875,390.261c-1.718-1.407-3.3-2.881-5.138-3.94l-63.629-47.507c-5.775-3.796-11.997-3.689-16.527,0.85
+ c-4.131,4.143-4.686,10.369-1.678,15.381l48.959,65.763c0.946,1.494,2.166,2.799,3.366,4.195c7.802,9.071,25.08,9.588,34.646-0.007
+ C402.445,415.409,402.305,397.986,392.875,390.261z"/>
+ <polygon points="372.511,335.018 372.509,335.018 372.509,335.02 "/>
+ <path d="M435.428,322.475l-59.521-2.284c-3.891-0.558-7.4,2.053-8.065,6.011c-0.604,3.611,1.347,7.138,4.668,8.816l0.013-0.039
+ c0.041,0.019,0.062,0.006,0.105,0.025l57.717,17.756c8.289,1.93,17.656-2.343,17.656-11.648
+ C448,329.328,444.917,323.667,435.428,322.475z"/>
+ <polygon points="139.222,335.02 139.222,335.018 139.22,335.018 "/>
+ <path d="M139.209,334.979l0.013,0.039c3.321-1.679,5.272-5.205,4.668-8.816c-0.665-3.958-4.175-6.568-8.065-6.011l-59.521,2.284
+ C66.813,323.667,64,329.328,64,341.111c0,9.306,9.098,13.578,17.387,11.648l57.717-17.756
+ C139.146,334.984,139.168,334.997,139.209,334.979z"/>
+ <path d="M187.903,338.807l-63.597,47.431c-1.838,1.057-3.569,2.362-5.137,3.931c-9.563,9.567-9.566,25.088-0.004,34.65
+ c9.561,9.571,25.055,9.578,34.618,0.007c1.3-1.299,2.405-2.694,3.352-4.185L206.097,355c3.007-5,2.452-11.213-1.677-15.346
+ C199.893,335.126,192.712,334.762,187.903,338.807z"/>
+ <path d="M352,128c0-61-72.35-96-96-96c12.017,85.553-101.667,119.667-112,192s48,96,48,96
+ c16.333-59.896,72.386-79.997,109.667-105.667C342.333,186.333,352,160.061,352,128z"/>
+ <path d="M352,256c5.03-15.613,4.91-49,0-64c-8.999,18.5-26.287,34.3-47.186,48.689c-8.584,5.911-19.859,11.443-28.83,16.797
+ c-18.714,11.165-34.984,21.848-47.329,36.4C240.001,311.25,256.973,320,272,320C307.999,320,336,305.662,352,256z"/>
+ <path d="M152.037,160c11.722-15.952,24.856-25.209,38.19-38.362c13.436-13.254,22.077-22.471,27.464-33.173
+ C207.025,67.134,189.842,61.857,176,64c2.333,30.334-29.97,46.567-32,68.657C142.773,146,146.5,156,152.037,160z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bookmark.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bookmark.svg
new file mode 100644
index 00000000..425f97e5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bookmark.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M344,64H168c-4.4,0-8,3.6-8,8v56h192V72C352,67.6,348.4,64,344,64z"/>
+ <polygon points="160,448 256,352 352,448 352,144 160,144 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bowtie.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bowtie.svg
new file mode 100644
index 00000000..0c9a67ad
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bowtie.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M223.955,212.011c0,0,8.054-4.679,19.985-7.011c21.318-4.166,39.472-5.5,47.466,8.5c9.777,17.124,18.402,53.417,16.488,85.5
+ c-1,16.75-4.622,22.125-4.622,22.125s-15.333,9.525-47.341,6.875c-34.725-2.875-39.971-15.004-39.971-15.004
+ s4.497-11.305,7.995-42.499C227.452,239.303,223.955,212.011,223.955,212.011z"/>
+<g>
+ <path d="M183.984,285c12.546-3.323,23.03-7.189,27.659-8.985c0.693-4.707,1.28-9.718,1.694-15.015
+ c0.271-3.461,0.465-6.754,0.602-9.896c-6.854-2.333-13.534-4.851-28.769-10.104c-38.66-13.333-57.146-17-57.146-17
+ s14.24-2.5,42.219,3c19.986,3.929,34.392,9.5,43.947,14.333c0.771-15.999-2.477-32.583-2.477-32.583
+ C189.729,168.5,119.53,112,84.368,112C57.888,112,32,180.5,32,256s23.03,144,51.51,144c33.356,0,116.463-80,116.463-80
+ s5.738-12.578,9.879-33.572c-18.788,5.198-63.84,8.572-63.84,8.572S166.996,289.5,183.984,285z"/>
+ <path d="M427.632,112c-36.37,0-102.363,56.5-124.348,96.75l-0.761,1.375c0,0,1.389,2.527,1.873,3.375
+ c3.424,5.996,6.704,14.348,9.442,24.041c8.115-2.805,23.599-8.164,37.523-13.041c19.985-7,34.975-9.5,34.975-9.5
+ s-52.982,23.741-69.605,34.264c2.169,10.159,3.693,21.199,4.218,32.242c5.423,2.216,16.551,6.475,29.914,9.994
+ c18.986,5,40.398,11.5,40.398,11.5s-54.202-5.27-70.114-12.522c-0.013,2.862-0.095,5.709-0.263,8.522
+ c-0.997,16.719-4.608,22.104-4.622,22.124C323.883,331.667,391.262,400,428.49,400C456.97,400,480,331.5,480,256
+ S454.112,112,427.632,112z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/briefcase.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/briefcase.svg
new file mode 100644
index 00000000..8b3875dc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/briefcase.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M272,272h-32v-8H32v176c0,4.4,3.3,8,7.8,8h432.5c4.4,0,7.7-3.6,7.7-8V264H272V272z"/>
+ <path d="M472.2,144H352v-30.7C351,85.1,330.3,64,300.8,64h-89.6c-29.4,0-50.2,21.1-51.2,49.3V144H39.8c-4.4,0-7.8,3.6-7.8,8v96h208
+ v-8h32v8h208v-96C480,147.6,476.7,144,472.2,144z M320,116.2c0,0.3,0,0.6,0,1V144H192v-26.8c0-0.4,0-0.7,0-1c0-0.3,0-0.6,0-1
+ c0-9.7,8.6-19.2,18.8-19.2h90.4c10.1,0,18.8,9.4,18.8,19.2C320,115.6,320,115.9,320,116.2z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bug.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bug.svg
new file mode 100644
index 00000000..837bc7e5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bug.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M374.64,127.327C345.365,88.512,303.062,64,256,64s-89.365,24.512-118.64,63.327c6.354,15.64,15.833,30,28.13,42.297
+ c24.176,24.176,56.319,37.49,90.51,37.49s66.334-13.314,90.51-37.49C358.807,157.327,368.286,142.966,374.64,127.327z"/>
+ <path d="M126.836,142.824c-1.725,2.827-3.396,5.703-4.992,8.644c-2.926-1.84-5.319-3.74-7.745-5.773
+ c-1.171-0.981-2.954-3.949-4.546-7.35c5.41-11.314,1.181-25.037-9.914-31.261c-11.561-6.484-26.188-2.372-32.674,9.189
+ c-6.485,11.56-2.371,26.188,9.187,32.673c1.251,0.702,2.539,1.272,3.847,1.729c2.816,6.269,7.32,14.331,13.548,19.547
+ c4.184,3.507,8.792,7.117,15.204,10.674c-7.195,20.259-11.576,42.303-12.545,65.427c-11.026,0.207-18.619,2.1-25.474,4.122
+ c-4.16,1.227-8.192,3.395-11.823,5.852c-0.954-0.115-1.923-0.182-2.908-0.182c-13.255,0-24,10.745-24,24s10.745,24,24,24
+ c12.93,0,23.467-10.227,23.976-23.032c5.046-1.482,9.888-2.659,17.095-2.774c3.167,33.015,13.304,63.483,28.613,89.224
+ c-14.166,11.006-22.882,23.016-26.605,36.317c0,0-0.75,0.438-1.873,1.366c-0.982,0.794-1.932,1.65-2.804,2.619
+ c-8.865,9.855-8.062,25.031,1.793,33.895c9.854,8.865,25.028,8.062,33.893-1.793c8.087-8.988,8.095-22.381,0.558-31.395
+ c3.074-5.562,6.236-9.014,13.67-14.961C171.368,425.235,207.723,445.619,248,448V222.872
+ C194.764,219.954,149.229,188.138,126.836,142.824z"/>
+ <path d="M456,256.114c-0.985,0-1.954,0.066-2.908,0.182c-3.631-2.457-7.663-4.625-11.823-5.852
+ c-6.854-2.021-14.447-3.915-25.474-4.122c-0.969-23.125-5.35-45.168-12.545-65.427c6.412-3.557,11.021-7.167,15.204-10.674
+ c6.228-5.216,10.731-13.278,13.548-19.547c1.308-0.458,2.596-1.028,3.847-1.729c11.558-6.485,15.672-21.114,9.187-32.673
+ c-6.485-11.561-21.113-15.673-32.674-9.189c-11.095,6.225-15.324,19.947-9.914,31.261c-1.592,3.401-3.375,6.369-4.546,7.35
+ c-2.426,2.033-4.819,3.933-7.745,5.773c-1.596-2.941-3.268-5.817-4.992-8.644c-22.393,45.314-67.928,77.13-121.164,80.048V448
+ c40.277-2.381,76.632-22.765,103.686-54.42c7.434,5.947,10.596,9.399,13.67,14.961c-7.537,9.014-7.529,22.406,0.558,31.395
+ c8.864,9.855,24.038,10.658,33.893,1.793c9.854-8.863,10.658-24.039,1.793-33.895c-0.872-0.969-1.821-1.825-2.804-2.619
+ c-1.123-0.929-1.873-1.366-1.873-1.366c-3.724-13.302-12.439-25.312-26.605-36.317c15.31-25.74,25.446-56.209,28.613-89.224
+ c7.207,0.115,12.049,1.292,17.095,2.774c0.509,12.806,11.046,23.032,23.976,23.032c13.255,0,24-10.745,24-24
+ S469.255,256.114,456,256.114z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/calculator.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/calculator.svg
new file mode 100644
index 00000000..93ef2c0e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/calculator.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M400,32H112c-8.8,0-16,7.2-16,16v416c0,8.8,7.2,16,16,16h288c8.8,0,16-7.2,16-16V48C416,39.2,408.8,32,400,32z M144,208h32
+ v32h-32V208z M144,272h32v32h-32V272z M144,336h32v32h-32V336z M240,432h-96v-32h96V432z M240,368h-32v-32h32V368z M240,304h-32v-32
+ h32V304z M240,240h-32v-32h32V240z M304,432h-32v-32h32V432z M304,368h-32v-32h32V368z M304,304h-32v-32h32V304z M304,240h-32v-32
+ h32V240z M368,432h-32v-96h32V432z M368,304h-32v-32h32V304z M368,240h-32v-32h32V240z M368,160H144V80h224V160z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/calendar.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/calendar.svg
new file mode 100644
index 00000000..e6e173a1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/calendar.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M144,128c17.7,0,32-14.3,32-32V64c0-17.7-14.3-32-32-32s-32,14.3-32,32v32C112,113.7,126.3,128,144,128z"/>
+ <path d="M368,128c17.7,0,32-14.3,32-32V64c0-17.7-14.3-32-32-32s-32,14.3-32,32v32C336,113.7,350.3,128,368,128z"/>
+ <path d="M472,64h-56v40.7c0,22.5-23.2,39.3-47.2,39.3S320,127.2,320,104.7V64H192v40.7c0,22.5-24,39.3-48,39.3s-48-16.8-48-39.3V64
+ H40c-4.4,0-8,3.6-8,8v400c0,4.4,3.6,8,8,8h432c4.4,0,8-3.6,8-8V72C480,67.6,476.4,64,472,64z M432,432H80V176h352V432z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/camera.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/camera.svg
new file mode 100644
index 00000000..7857f61a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/camera.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M430.4,147h-67.5l-40.4-40.8c0,0-0.2-0.2-0.3-0.2l-0.2-0.2v0c-6-6-14.1-9.8-23.3-9.8h-84c-9.8,0-18.5,4.2-24.6,10.9l0,0.1
+ l-39.5,40H81.6C63,147,48,161.6,48,180.2v202.1c0,18.6,15,33.7,33.6,33.7h348.8c18.5,0,33.6-15.1,33.6-33.7V180.2
+ C464,161.6,448.9,147,430.4,147z M256,365.5c-50.9,0-92.4-41.6-92.4-92.6c0-51.1,41.5-92.6,92.4-92.6c51,0,92.4,41.5,92.4,92.6
+ C348.4,323.9,307,365.5,256,365.5z M424.1,200.5c-7.7,0-14-6.3-14-14.1s6.3-14.1,14-14.1c7.7,0,14,6.3,14,14.1
+ S431.8,200.5,424.1,200.5z"/>
+ <path d="M256,202.9c-38.6,0-69.8,31.3-69.8,70c0,38.6,31.2,70,69.8,70c38.5,0,69.8-31.3,69.8-70C325.8,234.2,294.5,202.9,256,202.9
+ z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/card.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/card.svg
new file mode 100644
index 00000000..e18e8486
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/card.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M452,96H60c-15.5,0-27.9,12.5-28,28l0,0v0.3v263.4v0.3l0,0c0.2,15.5,12.5,28,28,28h392c15.6,0,28-12.7,28-28.3v0V124.3v0
+ C480,108.7,467.6,96,452,96z M77.1,128h357.7c6.9,0,12.1,5.1,13.1,12v20H64v-20.3C65,132.9,70.3,128,77.1,128z M434.9,384H77.1
+ c-6.9,0-12.1-4.9-13.1-11.7V256h384v116C447,378.9,441.7,384,434.9,384z"/>
+ <rect x="96" y="304" width="192" height="16"/>
+ <rect x="96" y="336" width="96" height="16"/>
+ <rect x="352" y="304" width="64" height="48"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cash.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cash.svg
new file mode 100644
index 00000000..3618133a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cash.svg
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M0,96v256h512V96H0z M192.508,320H80.129c0-26.582-21.549-48.129-48.129-48.129V192c35.346,0,64-28.653,64-64h96.509
+ C172.576,151.455,160,185.767,160,224S172.576,296.545,192.508,320z M298.089,261.248c-2.582,4.182-5.978,7.602-10.189,10.257
+ c-4.214,2.655-9.004,4.607-14.375,5.835c-2.812,0.644-5.654,1.119-8.524,1.432V288h-18v-9.43c-2.768-0.357-5.461-0.863-8.072-1.541
+ c-5.688-1.475-10.641-3.659-14.851-6.709c-4.214-3.047-7.584-6.803-10.11-11.573C211.548,254.186,210.24,248,210.04,243h19.735
+ c0.096,3,0.828,6.532,2.201,9.184c1.473,2.853,3.526,4.883,6.16,6.7c2.572,1.78,5.532,3.082,8.863,3.919v-34.358
+ c-2.436-0.601-5.016-1.245-7.758-1.938c-4.846-1.18-8.873-2.729-12.085-4.646c-3.214-1.918-5.766-4.057-7.661-6.417
+ c-1.896-2.359-3.238-4.867-4.028-7.522c-0.791-2.656-1.186-5.358-1.186-8.113c0-5.31,1.186-9.905,3.556-13.791
+ c2.368-3.883,5.502-7.104,9.398-9.662c3.895-2.556,8.319-4.448,13.27-5.679c2.154-0.534,4.319-0.945,6.494-1.248V160h18v9.499
+ c2.46,0.353,4.856,0.838,7.18,1.473c5.215,1.427,9.796,3.563,13.744,6.414c3.95,2.854,7.083,6.364,9.4,10.542
+ c2.109,3.811,3.258,8.072,3.445,13.072h-19.866c-0.753-6-3.175-10.326-7.274-12.923c-1.966-1.246-4.186-2.196-6.629-2.887v30.368
+ c2.589,0.639,5.15,1.268,7.654,1.878c3.421,0.836,5.87,1.453,7.346,1.844c3.686,1.083,6.897,2.558,9.637,4.425
+ c2.737,1.869,5.028,4.008,6.873,6.417c1.841,2.411,3.21,4.992,4.107,7.744c0.893,2.753,1.343,5.51,1.343,8.262
+ C301.96,252.027,300.668,257.07,298.089,261.248z M480,271.871c-26,0-48,21.547-48,48.129H319.491
+ C339.424,296.545,352,262.233,352,224s-12.576-72.545-32.51-96H416c0,35.347,28.653,64,64,64V271.871z"/>
+ <circle cx="96" cy="224" r="32"/>
+ <circle cx="416" cy="224" r="32"/>
+ <path d="M272.893,235.21c-2.395-0.823-5.029-1.618-7.893-2.389v30.856c1.592-0.23,3.069-0.547,4.416-0.959
+ c3.053-0.934,5.529-2.139,7.425-3.613s3.264-3.171,4.107-5.089c0.842-1.917,1.263-3.858,1.263-5.827
+ c0-4.031-0.975-7.006-2.921-8.924C277.34,237.349,275.206,235.999,272.893,235.21z"/>
+ <path d="M236.004,190.959c-1.318,1.771-1.975,3.982-1.975,6.638c0,3.738,1.236,6.663,3.712,8.776
+ c2.377,2.034,5.468,3.583,9.259,4.661v-26.356c-2.18,0.45-4.192,1.135-6.02,2.078C238.979,187.788,237.32,189.189,236.004,190.959z
+ "/>
+ <rect y="384" width="512" height="32"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbox-working.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbox-working.svg
new file mode 100644
index 00000000..1a6d1a66
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbox-working.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M124.3,400H277c14.4,0,14.4,0.1,21.3,5.2S384,464,384,464v-64h3.7c42.2,0,76.3-31.8,76.3-71.4V119.7
+ c0-39.6-34.2-71.7-76.3-71.7H124.3C82.2,48,48,80.1,48,119.7v208.9C48,368.2,82.2,400,124.3,400z M352.1,192c17.7,0,32,14.3,32,32
+ c0,17.7-14.3,32-32,32c-17.7,0-32-14.3-32-32C320.1,206.3,334.4,192,352.1,192z M256.1,192c17.7,0,32,14.3,32,32
+ c0,17.7-14.3,32-32,32c-17.7,0-32-14.3-32-32C224.1,206.3,238.4,192,256.1,192z M160.1,192c17.7,0,32,14.3,32,32
+ c0,17.7-14.3,32-32,32c-17.7,0-32-14.3-32-32C128.1,206.3,142.4,192,160.1,192z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbox.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbox.svg
new file mode 100644
index 00000000..4e3070b4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbox.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M124.3,400H277c14.4,0,14.4,0.1,21.3,5.2S384,464,384,464v-64h3.7c42.2,0,76.3-31.8,76.3-71.4V119.7
+ c0-39.6-34.2-71.7-76.3-71.7H124.3C82.2,48,48,80.1,48,119.7v208.9C48,368.2,82.2,400,124.3,400z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatboxes.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatboxes.svg
new file mode 100644
index 00000000..259cc814
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatboxes.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M294.1,365.5c-2.6-1.8-7.2-4.5-17.5-4.5H160.5c-34.7,0-64.5-26.1-64.5-59.2V201h-1.8C67.9,201,48,221.5,48,246.5v128.9
+ c0,25,21.4,40.6,47.7,40.6H112v48l53.1-45c1.9-1.4,5.3-3,13.2-3h89.8c23,0,47.4-11.4,51.9-32L294.1,365.5z"/>
+ <path d="M401,48H183.7C149,48,128,74.8,128,107.8v69.7V276c0,33.1,28,60,62.7,60h101.1c10.4,0,15,2.3,17.5,4.2L384,400v-64h17
+ c34.8,0,63-26.9,63-59.9V107.8C464,74.8,435.8,48,401,48z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubble-working.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubble-working.svg
new file mode 100644
index 00000000..da15d59e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubble-working.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,449.4c28.9,0,56.4-5.7,81.3-15.9c0.6-0.3,1.1-0.5,1.7-0.7c0.1,0,0.2,0,0.2-0.1c3.5-1.3,7.3-2,11.2-2
+ c4.3,0,8.4,0.8,12.1,2.4l84,30.9l-22.1-88.4c0-5.3,1.5-10.3,3.9-14.6c0,0,0,0,0,0c0.8-1.3,1.6-2.6,2.5-3.7
+ c20.9-31.3,33-68.5,33-108.4C464,137.9,370.9,48,256,48C141.1,48,48,137.9,48,248.7C48,359.6,141.1,449.4,256,449.4z M352,224
+ c17.7,0,32,14.3,32,32c0,17.7-14.3,32-32,32c-17.7,0-32-14.3-32-32C320,238.3,334.3,224,352,224z M256,224c17.7,0,32,14.3,32,32
+ c0,17.7-14.3,32-32,32c-17.7,0-32-14.3-32-32C224,238.3,238.3,224,256,224z M160,224c17.7,0,32,14.3,32,32c0,17.7-14.3,32-32,32
+ c-17.7,0-32-14.3-32-32C128,238.3,142.3,224,160,224z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubble.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubble.svg
new file mode 100644
index 00000000..f9ab693a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubble.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,449.4c28.9,0,56.4-5.7,81.3-15.9c0.6-0.3,1.1-0.5,1.7-0.7c0.1,0,0.2,0,0.2-0.1c3.5-1.3,7.3-2,11.2-2
+ c4.3,0,8.4,0.8,12.1,2.4l84,30.9l-22.1-88.4c0-5.3,1.5-10.3,3.9-14.6c0,0,0,0,0,0c0.8-1.3,1.6-2.6,2.5-3.7
+ c20.9-31.3,33-68.5,33-108.4C464,137.9,370.9,48,256,48C141.1,48,48,137.9,48,248.7C48,359.6,141.1,449.4,256,449.4z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubbles.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubbles.svg
new file mode 100644
index 00000000..d1a8ba84
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubbles.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M73.3,391C73.3,391,73.3,391,73.3,391c1.8,3,2.8,6.4,2.8,10.2L64,464l56.2-22.1c2.7-1.1,5.6-1.7,8.7-1.7
+ c2.8,0,5.5,0.5,8,1.4c0,0,0.1,0,0.2,0c0.4,0.2,0.8,0.3,1.2,0.5c17.8,7.3,37.4,11.4,57.9,11.4c46.3,0,87.6-20.5,114.8-52.6
+ c-14.1,3.6-28.9,5.7-44.1,5.7c-95.9,0-173.7-75-173.7-167.5c0-11.8,1.3-23.2,3.7-34.3C66.9,230.9,48,268.6,48,310.6
+ c0,28.4,8.6,55.2,23.5,77.5C72.1,388.9,72.7,390,73.3,391z"/>
+ <path d="M290.3,48c-83.7,0-153.6,57.2-170,133.2c-2.4,11.1-3.7,22.5-3.7,34.3c0,92.5,77.7,167.5,173.7,167.5
+ c15.3,0,30-2.1,44.1-5.7c8.1-2.1,16.1-4.5,23.8-7.6c0.5-0.2,0.9-0.4,1.4-0.6c0.1,0,0.2,0,0.2-0.1c2.9-1.1,6.1-1.7,9.3-1.7
+ c3.6,0,7,0.7,10.1,2l68.6,25.8l-17-73.8c0-4.4,1.2-8.6,3.3-12.2c0,0,0,0,0,0c0.6-1.1,1.4-2.1,2.1-3.1
+ c17.4-26.1,27.5-57.2,27.5-90.5C464,123,386.3,48,290.3,48z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark-circled.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark-circled.svg
new file mode 100644
index 00000000..818f4e30
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark-circled.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,32C132.3,32,32,132.3,32,256c0,123.7,100.3,224,224,224c123.7,0,224-100.3,224-224C480,132.3,379.7,32,256,32z
+ M370.9,181.1L231.8,359.6c-1.1,1.1-2.9,3.5-5.1,3.5c-2.3,0-3.8-1.6-5.1-2.9c-1.3-1.3-78.9-75.9-78.9-75.9l-1.5-1.5
+ c-0.6-0.9-1.1-2-1.1-3.2c0-1.2,0.5-2.3,1.1-3.2c0.4-0.4,0.7-0.7,1.1-1.2c7.7-8.1,23.3-24.5,24.3-25.5c1.3-1.3,2.4-3,4.8-3
+ c2.5,0,4.1,2.1,5.3,3.3c1.2,1.2,45,43.3,45,43.3l111.3-143c1-0.8,2.2-1.4,3.5-1.4c1.3,0,2.5,0.5,3.5,1.3l30.6,24.1
+ c0.8,1,1.3,2.2,1.3,3.5C372,179.1,371.5,180.2,370.9,181.1z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark-round.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark-round.svg
new file mode 100644
index 00000000..0f9e5e0b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark-round.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M448,71.9c-17.3-13.4-41.5-9.3-54.1,9.1L214,344.2l-99.1-107.3c-14.6-16.6-39.1-17.4-54.7-1.8
+ c-15.6,15.5-16.4,41.6-1.7,58.1c0,0,120.4,133.6,137.7,147c17.3,13.4,41.5,9.3,54.1-9.1l206.3-301.7
+ C469.2,110.9,465.3,85.2,448,71.9z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark.svg
new file mode 100644
index 00000000..5d091529
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M461.6,109.6l-54.9-43.3c-1.7-1.4-3.8-2.4-6.2-2.4c-2.4,0-4.6,1-6.3,2.5L194.5,323c0,0-78.5-75.5-80.7-77.7
+ c-2.2-2.2-5.1-5.9-9.5-5.9c-4.4,0-6.4,3.1-8.7,5.4c-1.7,1.8-29.7,31.2-43.5,45.8c-0.8,0.9-1.3,1.4-2,2.1c-1.2,1.7-2,3.6-2,5.7
+ c0,2.2,0.8,4,2,5.7l2.8,2.6c0,0,139.3,133.8,141.6,136.1c2.3,2.3,5.1,5.2,9.2,5.2c4,0,7.3-4.3,9.2-6.2L462,121.8
+ c1.2-1.7,2-3.6,2-5.8C464,113.5,463,111.4,461.6,109.6z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-down.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-down.svg
new file mode 100644
index 00000000..4d96e34b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-down.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,298.3L256,298.3L256,298.3l174.2-167.2c4.3-4.2,11.4-4.1,15.8,0.2l30.6,29.9c4.4,4.3,4.5,11.3,0.2,15.5L264.1,380.9
+ c-2.2,2.2-5.2,3.2-8.1,3c-3,0.1-5.9-0.9-8.1-3L35.2,176.7c-4.3-4.2-4.2-11.2,0.2-15.5L66,131.3c4.4-4.3,11.5-4.4,15.8-0.2L256,298.3
+ z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-left.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-left.svg
new file mode 100644
index 00000000..2a5847d3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-left.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M213.7,256L213.7,256L213.7,256L380.9,81.9c4.2-4.3,4.1-11.4-0.2-15.8l-29.9-30.6c-4.3-4.4-11.3-4.5-15.5-0.2L131.1,247.9
+ c-2.2,2.2-3.2,5.2-3,8.1c-0.1,3,0.9,5.9,3,8.1l204.2,212.7c4.2,4.3,11.2,4.2,15.5-0.2l29.9-30.6c4.3-4.4,4.4-11.5,0.2-15.8
+ L213.7,256z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-right.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-right.svg
new file mode 100644
index 00000000..c7806956
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-right.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M298.3,256L298.3,256L298.3,256L131.1,81.9c-4.2-4.3-4.1-11.4,0.2-15.8l29.9-30.6c4.3-4.4,11.3-4.5,15.5-0.2l204.2,212.7
+ c2.2,2.2,3.2,5.2,3,8.1c0.1,3-0.9,5.9-3,8.1L176.7,476.8c-4.2,4.3-11.2,4.2-15.5-0.2L131.3,446c-4.3-4.4-4.4-11.5-0.2-15.8
+ L298.3,256z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-up.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-up.svg
new file mode 100644
index 00000000..7ab9d97d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-up.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,213.7L256,213.7L256,213.7l174.2,167.2c4.3,4.2,11.4,4.1,15.8-0.2l30.6-29.9c4.4-4.3,4.5-11.3,0.2-15.5L264.1,131.1
+ c-2.2-2.2-5.2-3.2-8.1-3c-3-0.1-5.9,0.9-8.1,3L35.2,335.3c-4.3,4.2-4.2,11.2,0.2,15.5L66,380.7c4.4,4.3,11.5,4.4,15.8,0.2L256,213.7
+ z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/clipboard.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/clipboard.svg
new file mode 100644
index 00000000..abebc336
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/clipboard.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M161,160.5h192c-1.688-20-9.729-35.45-27.921-40.356c-0.446-0.119-1.12-0.424-1.567-0.541
+ c-12.004-3.424-21.012-7.653-21.012-20.781V78.227C302.5,52.691,281.976,32,256.49,32c-25.466,0-45.99,20.691-45.99,46.227v20.595
+ c0,13.128-8.592,17.169-20.597,20.593c-0.447,0.117-0.8,0.61-1.266,0.729C170.446,125.05,162.927,140.5,161,160.5z M256.99,64.395
+ c7.615,0,13.791,6.195,13.791,13.832c0,7.654-6.176,13.85-13.791,13.85c-7.614,0-13.772-6.195-13.772-13.85
+ C243.218,70.59,249.376,64.395,256.99,64.395z"/>
+ <path d="M405.611,63.5H331.5v13.988c0,10.583,9.193,19.012,19.507,19.012h37.212c6.667,0,12.099,5.435,12.44,12.195l0.085,327.1
+ c-0.322,6.432-5.303,11.546-11.514,12.017l-264.418,0.031c-6.211-0.471-11.149-5.695-11.472-12.126l-0.085-327.014
+ c0.322-6.761,5.858-12.203,12.506-12.203h37.231c10.313,0,18.507-8.429,18.507-19.012V63.5h-73.131
+ C93.25,63.5,80.5,76.058,80.5,91.575v360.38c0,15.502,12.75,28.545,27.869,28.545H256.99h148.621
+ c15.138,0,26.889-13.043,26.889-28.545V91.575C432.5,76.058,420.749,63.5,405.611,63.5z"/>
+ <rect x="144.5" y="192.5" width="112" height="32"/>
+ <rect x="144.5" y="384.5" width="160" height="32"/>
+ <rect x="144.5" y="320.5" width="129" height="32"/>
+ <rect x="144.5" y="256.5" width="208" height="32"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/clock.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/clock.svg
new file mode 100644
index 00000000..717c3189
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/clock.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M255.988,32C132.285,32,32,132.298,32,256c0,123.715,100.285,224,223.988,224C379.703,480,480,379.715,480,256
+ C480,132.298,379.703,32,255.988,32z M391.761,391.765c-10.099,10.098-21.126,18.928-32.886,26.42l-15.946-27.62l-13.856,8
+ l15.955,27.636c-24.838,13.03-52.372,20.455-81.027,21.624V416h-16v31.825c-28.656-1.166-56.191-8.59-81.03-21.62l15.958-27.641
+ l-13.856-8l-15.949,27.625c-11.761-7.492-22.79-16.324-32.889-26.424c-10.099-10.099-18.93-21.127-26.422-32.889l27.624-15.949
+ l-8-13.855L85.796,345.03c-13.03-24.839-20.454-52.374-21.621-81.03H96v-16H64.175c1.167-28.655,8.592-56.19,21.623-81.029
+ l27.638,15.958l8-13.856l-27.623-15.948c7.492-11.76,16.322-22.787,26.419-32.885c10.1-10.101,21.129-18.933,32.89-26.426
+ l15.949,27.624l13.856-8l-15.958-27.64C191.81,72.765,219.345,65.34,248,64.175V96h16V64.176
+ c28.654,1.169,56.188,8.595,81.026,21.626l-15.954,27.634l13.856,8l15.945-27.618c11.76,7.492,22.787,16.323,32.886,26.421
+ c10.1,10.099,18.931,21.126,26.424,32.887l-27.619,15.946l8,13.856l27.636-15.956c13.031,24.839,20.457,52.373,21.624,81.027H416
+ v16h31.824c-1.167,28.655-8.592,56.189-21.622,81.028l-27.637-15.957l-8,13.856l27.621,15.947
+ C410.693,370.637,401.861,381.665,391.761,391.765z"/>
+ <path d="M400,241H284.268c-2.818-5.299-7.083-9.708-12.268-12.708V160h-32v68.292c-9.562,5.534-16,15.866-16,27.708
+ c0,17.673,14.327,32,32,32c11.425,0,21.444-5.992,27.106-15H400V241z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close-circled.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close-circled.svg
new file mode 100644
index 00000000..8705b057
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close-circled.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,33C132.3,33,32,133.3,32,257c0,123.7,100.3,224,224,224c123.7,0,224-100.3,224-224C480,133.3,379.7,33,256,33z
+ M364.3,332.5c1.5,1.5,2.3,3.5,2.3,5.6c0,2.1-0.8,4.2-2.3,5.6l-21.6,21.7c-1.6,1.6-3.6,2.3-5.6,2.3c-2,0-4.1-0.8-5.6-2.3L256,289.8
+ l-75.4,75.7c-1.5,1.6-3.6,2.3-5.6,2.3c-2,0-4.1-0.8-5.6-2.3l-21.6-21.7c-1.5-1.5-2.3-3.5-2.3-5.6c0-2.1,0.8-4.2,2.3-5.6l75.7-76
+ l-75.9-75c-3.1-3.1-3.1-8.2,0-11.3l21.6-21.7c1.5-1.5,3.5-2.3,5.6-2.3c2.1,0,4.1,0.8,5.6,2.3l75.7,74.7l75.7-74.7
+ c1.5-1.5,3.5-2.3,5.6-2.3c2.1,0,4.1,0.8,5.6,2.3l21.6,21.7c3.1,3.1,3.1,8.2,0,11.3l-75.9,75L364.3,332.5z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close-round.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close-round.svg
new file mode 100644
index 00000000..e011f7bd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close-round.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M437.5,386.6L306.9,256l130.6-130.6c14.1-14.1,14.1-36.8,0-50.9c-14.1-14.1-36.8-14.1-50.9,0L256,205.1L125.4,74.5
+ c-14.1-14.1-36.8-14.1-50.9,0c-14.1,14.1-14.1,36.8,0,50.9L205.1,256L74.5,386.6c-14.1,14.1-14.1,36.8,0,50.9
+ c14.1,14.1,36.8,14.1,50.9,0L256,306.9l130.6,130.6c14.1,14.1,36.8,14.1,50.9,0C451.5,423.4,451.5,400.6,437.5,386.6z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close.svg
new file mode 100644
index 00000000..aa6b81c1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M443.6,387.1L312.4,255.4l131.5-130c5.4-5.4,5.4-14.2,0-19.6l-37.4-37.6c-2.6-2.6-6.1-4-9.8-4c-3.7,0-7.2,1.5-9.8,4
+ L256,197.8L124.9,68.3c-2.6-2.6-6.1-4-9.8-4c-3.7,0-7.2,1.5-9.8,4L68,105.9c-5.4,5.4-5.4,14.2,0,19.6l131.5,130L68.4,387.1
+ c-2.6,2.6-4.1,6.1-4.1,9.8c0,3.7,1.4,7.2,4.1,9.8l37.4,37.6c2.7,2.7,6.2,4.1,9.8,4.1c3.5,0,7.1-1.3,9.8-4.1L256,313.1l130.7,131.1
+ c2.7,2.7,6.2,4.1,9.8,4.1c3.5,0,7.1-1.3,9.8-4.1l37.4-37.6c2.6-2.6,4.1-6.1,4.1-9.8C447.7,393.2,446.2,389.7,443.6,387.1z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/closed-captioning.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/closed-captioning.svg
new file mode 100644
index 00000000..dc1c9394
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/closed-captioning.svg
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M0,64v384h512V64H0z M464,255.825c0.045,26.724-1.547,47.143-3.797,80.223S441,392.5,401.097,396.168
+ C361.201,399.835,305.369,400.12,256,400c-49,0.12-105.198-0.165-145.094-3.832c-39.903-3.668-56.855-27.04-59.105-60.12
+ s-3.841-53.499-3.796-80.223c-0.045-26.725,0.095-44.124,3.798-80.224s23.01-56.267,59.106-59.934S201.842,112,248.704,112
+ c2.431,0,5.296,0,7.296,0c2.437,0,4.871,0,7.302,0c46.862,0,101.698,0,137.795,3.667s55.403,23.833,59.106,59.934
+ S464.045,229.1,464,255.825z"/>
+ </g>
+ <g>
+ <path d="M372,283.846v0.766c0,18.639-11.581,29.566-27.003,29.566c-15.418,0-25.808-12.309-27.284-29.566
+ c0,0-1.335-9.078-1.335-27.298s1.546-29.759,1.546-29.759c2.711-19.473,12.188-29.566,27.607-29.566
+ c15.367,0,27.584,13.262,27.584,33.388c0.023,0.086,0.01,0.624,0.01,0.624h51.541c0-25-6.309-47.556-18.92-61.746
+ c-12.617-14.183-31.403-21.273-56.369-21.273c-12.483,0-23.93,1.654-34.33,4.942c-10.404,3.295-19.376,9.062-26.916,17.291
+ c-7.545,8.234-13.397,19.254-17.555,33.059c-4.162,13.809-6.242,31.224-6.242,52.247c0,20.52,1.688,37.684,5.072,51.488
+ c3.377,13.811,8.388,24.83,15.018,33.059c6.632,8.234,14.953,13.935,24.967,17.1c10.01,3.163,21.779,4.748,35.304,4.748
+ c28.604,0,49.089-7.258,61.443-21.318C418.486,327.537,424.666,307,424.666,280H372C372,280,372,282.876,372,283.846z"/>
+ <path d="M195,283.846v0.766c0,18.639-11.581,29.566-27.003,29.566c-15.418,0-25.808-12.309-27.284-29.566
+ c0,0-1.335-9.078-1.335-27.298s1.546-29.759,1.546-29.759c2.711-19.473,12.188-29.566,27.607-29.566
+ c15.367,0,27.584,13.262,27.584,33.388c0.023,0.086,0.01,0.624,0.01,0.624h51.541c0-25-6.309-47.556-18.92-61.746
+ c-12.617-14.183-31.403-21.273-56.369-21.273c-12.483,0-23.93,1.654-34.33,4.942c-10.404,3.295-19.376,9.062-26.916,17.291
+ c-7.545,8.234-13.397,19.254-17.555,33.059c-4.162,13.809-6.242,31.224-6.242,52.247c0,20.52,1.688,37.684,5.072,51.488
+ c3.377,13.811,8.388,24.83,15.018,33.059c6.632,8.234,14.953,13.935,24.967,17.1c10.01,3.163,21.779,4.748,35.304,4.748
+ c28.604,0,49.089-7.258,61.443-21.318C241.486,327.537,247.666,307,247.666,280H195C195,280,195,282.876,195,283.846z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cloud.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cloud.svg
new file mode 100644
index 00000000..7a687a60
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cloud.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M398.1,233.2c0-1.2,0.2-2.4,0.2-3.6c0-65-51.8-117.6-115.7-117.6c-46.1,0-85.7,27.4-104.3,67c-8.1-4.1-17.2-6.5-26.8-6.5
+ c-29.5,0-54.1,21.9-58.8,50.5C57.3,235.2,32,269.1,32,309c0,50.2,40.1,90.9,89.5,91h276.7l0,0c45.2-0.2,81.7-37.5,81.7-83.4
+ C480,270.6,443.3,233.3,398.1,233.2z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code-download.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code-download.svg
new file mode 100644
index 00000000..bcdd4ac0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code-download.svg
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <g>
+ <path d="M330.967,284.104c6.48-6.467,6.48-16.951,0-23.422c-6.48-6.467-17.342-6.467-23.823,0L272,295.432V176.58
+ c0-9.151-6.839-16.56-15.999-16.56c-9.162,0-16.001,7.408-16.001,16.56v118.852l-35.005-34.75
+ c-6.481-6.467-17.095-6.467-23.573,0c-6.482,6.471-6.539,16.955-0.057,23.422l63.07,63.023c0.02,0.02,0.028,0.037,0.05,0.057
+ c0.725,0.716,1.513,1.367,2.368,1.945c0.102,0.067,0.2,0.134,0.302,0.2c0.322,0.206,0.651,0.403,0.99,0.587
+ c0.117,0.064,0.231,0.133,0.35,0.193c0.421,0.218,0.849,0.423,1.292,0.605c0.002,0.001,0.004,0.001,0.006,0.002
+ c0.405,0.167,0.817,0.308,1.233,0.442c0.112,0.037,0.222,0.085,0.335,0.118c0.151,0.047,0.307,0.074,0.461,0.115
+ c1.424,0.385,2.872,0.588,4.315,0.588c1.442,0,2.89-0.203,4.312-0.588c0.153-0.041,0.312-0.068,0.464-0.115
+ c0.113-0.033,0.224-0.081,0.335-0.118c0.416-0.135,0.829-0.275,1.233-0.442c0.002-0.001,0.004-0.001,0.007-0.002
+ c0.441-0.183,0.87-0.387,1.289-0.604c0.122-0.064,0.24-0.133,0.36-0.198c0.332-0.185,0.658-0.376,0.975-0.579
+ c0.109-0.069,0.217-0.14,0.323-0.212c0.408-0.274,0.806-0.562,1.184-0.872c0.004-0.002,0.007-0.004,0.011-0.006
+ c0.406-0.332,0.791-0.684,1.162-1.051c0.024-0.022,0.051-0.043,0.074-0.066L330.967,284.104z"/>
+ </g>
+ </g>
+ <g>
+ <path d="M168,392c-6.143,0-12.285-2.344-16.971-7.029l-112-112c-9.373-9.373-9.373-24.569,0-33.941l112-112
+ c9.373-9.372,24.568-9.372,33.941,0c9.371,9.372,9.371,24.568,0,33.941L89.941,256l95.029,95.029
+ c9.371,9.372,9.371,24.568,0,33.941C180.283,389.656,174.143,392,168,392z"/>
+ <path d="M344,392c6.143,0,12.285-2.344,16.971-7.029l112-112c9.373-9.373,9.373-24.569,0-33.941l-112-112
+ c-9.373-9.372-24.568-9.372-33.941,0c-9.371,9.372-9.371,24.568,0,33.941L422.059,256l-95.029,95.029
+ c-9.371,9.372-9.371,24.568,0,33.941C331.717,389.656,337.857,392,344,392z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code-working.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code-working.svg
new file mode 100644
index 00000000..b0d367a3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code-working.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <circle cx="184.166" cy="256.166" r="24"/>
+ <circle cx="256.166" cy="256.166" r="24"/>
+ <circle cx="328.166" cy="256.166" r="24"/>
+ </g>
+ <g>
+ <path d="M168,392c-6.143,0-12.285-2.344-16.971-7.029l-112-112c-9.373-9.373-9.373-24.569,0-33.941l112-112
+ c9.373-9.372,24.568-9.372,33.941,0c9.371,9.372,9.371,24.568,0,33.941L89.941,256l95.029,95.029
+ c9.371,9.372,9.371,24.568,0,33.941C180.283,389.656,174.143,392,168,392z"/>
+ <path d="M344,392c6.143,0,12.285-2.344,16.971-7.029l112-112c9.373-9.373,9.373-24.569,0-33.941l-112-112
+ c-9.373-9.372-24.568-9.372-33.941,0c-9.371,9.372-9.371,24.568,0,33.941L422.059,256l-95.029,95.029
+ c-9.371,9.372-9.371,24.568,0,33.941C331.717,389.656,337.857,392,344,392z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code.svg
new file mode 100644
index 00000000..26cbd299
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M168,392c-6.143,0-12.285-2.344-16.971-7.029l-112-112c-9.373-9.373-9.373-24.569,0-33.941l112-112
+ c9.373-9.372,24.568-9.372,33.941,0c9.371,9.372,9.371,24.568,0,33.941L89.941,256l95.029,95.029
+ c9.371,9.373,9.371,24.568,0,33.941C180.283,389.656,174.143,392,168,392z"/>
+ <path d="M344,392c6.143,0,12.285-2.344,16.971-7.029l112-112c9.373-9.373,9.373-24.569,0-33.941l-112-112
+ c-9.373-9.372-24.568-9.372-33.941,0c-9.371,9.372-9.371,24.568,0,33.941L422.059,256l-95.029,95.029
+ c-9.371,9.373-9.371,24.568,0,33.941C331.717,389.656,337.857,392,344,392z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/coffee.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/coffee.svg
new file mode 100644
index 00000000..2a69c9f4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/coffee.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M383.1,257.4c0.6-5.4,0.9-10,0.9-13.8c0-19.6-3.3-19.7-16-19.7h-75.5c7.3-12,11.5-24.4,11.5-37c0-37.9-57.3-56.4-57.3-88
+ c0-11.7,5.1-21.3,9.3-34.9c-26.5,7-47.4,33.5-47.4,61.6c0,48.3,56.3,48.7,56.3,84.8c0,4.5-1.4,8.5-2.1,13.5h-55.9
+ c0.8-3,1.3-6.2,1.3-9.3c0-22.8-39.1-33.9-39.1-52.8c0-7,1-12.8,3.2-21c-12.9,5.1-28.3,20-28.3,36.8c0,26.7,31.9,29.3,36.8,46.3H80
+ c-12.7,0-16,0.1-16,19.7c0,19.6,7.7,61.3,28.3,111c20.6,49.7,44.4,71.6,61.2,86.2l0.1-0.2c5.1,4.6,11.8,7.3,19.2,7.3h102.4
+ c7.4,0,14.1-2.7,19.2-7.3l0.1,0.2c9-7.8,20-17.8,31.4-32.9c4.7,2,9.8,3.7,15.4,5c8.4,2,16.8,3,24.8,3c24,0,45.6-9.2,60.8-25.8
+ c13.4-14.6,21.1-34.4,21.1-54.2C448,297,420,264.5,383.1,257.4z M366.1,384.2c-8.6,0-15.6-1.2-22.1-4.2c4-8,7.9-15.9,11.7-25.1
+ c10.1-24.4,17.1-47,21.6-65.8c22,4.3,38.7,23.8,38.7,47.1C416,358.9,398.8,384.2,366.1,384.2z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/compass.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/compass.svg
new file mode 100644
index 00000000..89bde8b0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/compass.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M256,32c-39,0-75.6,10-107.5,27.4C136.9,42.9,117.7,32,96,32c-35.3,0-64,28.7-64,64c0,21.7,10.9,40.9,27.4,52.5
+ C42,180.4,32,217,32,256c0,123.7,100.3,224,224,224c123.7,0,224-100.3,224-224C480,132.3,379.7,32,256,32z M64,96
+ c0-17.7,14.3-32,32-32c10.5,0,19.8,5,25.6,12.8c-17,12.7-32.1,27.8-44.8,44.8C69,115.8,64,106.5,64,96z M391.8,391.8
+ C355.5,428,307.3,448,256,448c-51.3,0-99.5-20-135.8-56.2C84,355.5,64,307.3,64,256c0-51.3,20-99.5,56.2-135.8
+ C156.5,84,204.7,64,256,64c51.3,0,99.5,20,135.8,56.2C428,156.5,448,204.7,448,256C448,307.3,428,355.5,391.8,391.8z"/>
+ </g>
+ <path d="M352,128c0,0-101.6,83.7-120,104s-72,152-72,152s102.4-82.3,120-104S352,128,352,128z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/compose.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/compose.svg
new file mode 100644
index 00000000..82f190dc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/compose.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M442.8,99.6l-30.4-30.4c-7-6.9-18.2-6.9-25.1,0L355.5,101l55.5,55.5l31.8-31.7C449.7,117.7,449.7,106.5,442.8,99.6z"/>
+ <g>
+ <polygon points="346.1,110.5 174.1,288 160,352 224,337.9 400.6,164.9 "/>
+ </g>
+ <path d="M384,256v150c0,5.1-3.9,10.1-9.2,10.1s-269-0.1-269-0.1c-5.6,0-9.8-5.4-9.8-10s0-268,0-268c0-5,4.7-10,10.6-10H256l32-32
+ H87.4c-13,0-23.4,10.3-23.4,23.3v305.3c0,12.9,10.5,23.4,23.4,23.4h305.3c12.9,0,23.3-10.5,23.3-23.4V224L384,256z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/connection-bars.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/connection-bars.svg
new file mode 100644
index 00000000..ffd98bed
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/connection-bars.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <rect x="80" y="352" width="64" height="64"/>
+ <rect x="176" y="288" width="64" height="128"/>
+ <rect x="272" y="192" width="64" height="224"/>
+ <rect x="368" y="96" width="64" height="320"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/contrast.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/contrast.svg
new file mode 100644
index 00000000..ffcecdf7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/contrast.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,32C132.3,32,32,132.3,32,256c0,123.7,100.3,224,224,224c123.7,0,224-100.3,224-224C480,132.3,379.7,32,256,32z
+ M391.8,391.8C355.5,428,307,448,256,448V64c51,0,99.5,20,135.8,56.2C428,156.5,448,204.7,448,256C448,307.3,428,355.5,391.8,391.8z
+ "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/crop.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/crop.svg
new file mode 100644
index 00000000..6892bc8d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/crop.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <rect x="352" y="432" width="64" height="48"/>
+ <polygon points="416,352 416,96 176,96 176,160 352,160 352,352 160,352 160,32 96,32 96,96 32,96 32,160 96,160 96,416 480,416
+ 480,352 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cube.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cube.svg
new file mode 100644
index 00000000..cf94545d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cube.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M467.301,168.084c-1.805,0-3.516,0.329-5.07,0.962l-2.281,1.15l-171.475,88.938l-3.888,1.996c0,0-0.052,0.023-0.052,0.047
+ c-7.56,4.668-12.535,12.506-12.535,21.425v185.854c0,6.382,5.649,11.544,12.69,11.544c2.178,0,4.251-0.513,6.065-1.404
+ c0.155-0.095,0.363-0.188,0.519-0.282l174.731-92.694l0.259-0.141c8.241-4.504,13.735-12.742,13.735-22.105V179.582
+ C480,173.223,474.299,168.084,467.301,168.084z"/>
+ <path d="M454.273,118.521l-181.7-81.731c0,0-10.659-4.79-16.577-4.79s-16.526,4.79-16.526,4.79L57.614,118.521
+ c0,0-7.989,3.292-7.989,9.479c0,6.562,8.3,11.5,8.3,11.5l182.582,96.371l2.902,1.479c3.784,1.687,8.077,2.649,12.587,2.649
+ c4.561,0,8.915-0.963,12.742-2.696l2.539-1.315l182.893-96.536c0,0,7.508-4.036,7.508-11.453
+ C461.678,121.5,454.273,118.521,454.273,118.521z"/>
+ <path d="M227.466,261.178l-3.992-2.043L52.042,170.197l-2.28-1.15c-1.495-0.634-3.258-0.962-5.071-0.962
+ c-6.997,0-12.69,5.138-12.69,11.497v183.792c0,9.388,5.485,17.602,13.727,22.105l0.208,0.141l174.739,92.694l0,0
+ c1.918,1.08,4.199,1.687,6.636,1.687c6.989,0,12.69-5.162,12.69-11.544V282.603C240,273.684,235.024,265.846,227.466,261.178z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/disc.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/disc.svg
new file mode 100644
index 00000000..ef17856a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/disc.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,158.9c-53.7,0-97.2,43.5-97.2,97.2c0,53.7,43.5,97.1,97.2,97.1c53.7,0,97.2-43.5,97.2-97.1
+ C353.2,202.4,309.7,158.9,256,158.9z M256,299.5c-24,0-43.5-19.5-43.5-43.5c0-24,19.5-43.5,43.5-43.5c24,0,43.5,19.5,43.5,43.5
+ C299.5,280,280,299.5,256,299.5z"/>
+ <path d="M256,32C132.3,32,32,132.3,32,256c0,123.7,100.3,224,224,224s224-100.3,224-224C480,132.3,379.7,32,256,32z M256,378.8
+ c-67.8,0-122.8-55-122.8-122.8c0-67.8,55-122.8,122.8-122.8c67.8,0,122.8,55,122.8,122.8C378.8,323.8,323.8,378.8,256,378.8z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/document-text.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/document-text.svg
new file mode 100644
index 00000000..1a037e5b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/document-text.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M398.6,169.2c-0.9-2.2-2-4.3-3.5-6.1l-83.8-91.7c-1.9-2.1-4.2-3.6-6.7-4.9c-2.9-1.5-6.1-2.1-9.5-2.1H135.2
+ c-12.4,0-22.7,10.6-22.7,23.9v335.2c0,13.4,10.3,24.9,22.7,24.9h243.1c12.4,0,22.2-11.5,22.2-24.9V179.4
+ C400.5,175.8,400,172.3,398.6,169.2z M160.5,178.6c0-1.5,1.8-2.1,3.4-2.1h70.8c1.6,0,2.8,0.6,2.8,2.1v10.8c0,1.4-1.1,3.1-2.8,3.1
+ h-70.8c-1.6,0-3.4-1.7-3.4-3.1V178.6z M160.5,306.6c0-1.5,1.8-2.1,3.4-2.1h122.2c1.6,0,2.4,0.6,2.4,2.1v10.8c0,1.4-0.7,3.1-2.4,3.1
+ H163.9c-1.6,0-3.4-1.7-3.4-3.1V306.6z M320.5,381.4c0,1.4-0.7,3.1-2.4,3.1H163.9c-1.6,0-3.4-1.7-3.4-3.1v-10.8
+ c0-1.5,1.8-2.1,3.4-2.1h154.2c1.6,0,2.4,0.6,2.4,2.1V381.4z M352.5,253.4c0,1.4-0.7,3.1-2.4,3.1H163.9c-1.6,0-3.4-1.7-3.4-3.1
+ v-10.8c0-1.5,1.8-2.1,3.4-2.1h186.2c1.6,0,2.4,0.6,2.4,2.1V253.4z M305.6,177.5c-5.6,0-11.1-5.2-11.1-11.3v-66l71.2,77.3H305.6z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/document.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/document.svg
new file mode 100644
index 00000000..ed201709
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/document.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M399.3,168.9c-0.7-2.9-2-5-3.5-6.8l-83.7-91.7c-1.9-2.1-4.1-3.1-6.6-4.4c-2.9-1.5-6.1-1.6-9.4-1.6H136.2
+ c-12.4,0-23.7,9.6-23.7,22.9v335.2c0,13.4,11.3,25.9,23.7,25.9h243.1c12.4,0,21.2-12.5,21.2-25.9V178.4
+ C400.5,174.8,400.1,172.2,399.3,168.9z M305.5,111l58,63.5h-58V111z M144.5,416.5v-320h129v81.7c0,14.8,13.4,28.3,28.1,28.3h66.9
+ v210H144.5z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/drag.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/drag.svg
new file mode 100644
index 00000000..2961cd43
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/drag.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <rect y="144" width="512" height="32"/>
+ <rect y="240" width="512" height="32"/>
+ <rect y="336" width="512" height="32"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/earth.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/earth.svg
new file mode 100644
index 00000000..81258dc6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/earth.svg
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M357.275,125.525c-2.209-3.986-9.498-11.837-13.977-13.325c-5.979-0.921-2.398,4.413-2.398,6.7
+ c-1.543,1.157-3.941,2.454-5.102,4c-0.699,0.6,1.704,6.103,6.337,4.335s1.964,1.799,5.164,8.865s9.607,7.207,12.49,5.067
+ C363.444,138.455,359.286,129.155,357.275,125.525z"/>
+ <path d="M375.8,170.6c-0.001,0.006-0.004,0.011-0.005,0.017C375.795,170.629,375.797,170.629,375.8,170.6z"/>
+ <path d="M434.6,197.1C435,197.1,432.8,196.7,434.6,197.1L434.6,197.1z"/>
+ <path d="M256,32C132.3,32,32,132.3,32,256c0,123.701,100.3,224,224,224c123.701,0,224-100.299,224-224C480,132.3,379.701,32,256,32
+ z M173.399,429.424c-5.515-3.133-9.374-7.56-10.961-15.929c-3.947-20.808-0.303-32.067,17.962-44.245
+ c8.604-5.736,10.022-12.672,16.9-19.55c1.685-2.14,6.211-10.374,9.2-10.8c3.637-0.779,13.709-2.527,15.7-6.5
+ c3.79-5.146,12.127-27.398,15.8-29.602c5.997-3.925,14.419-15.96,8.3-23.1c-7.021-8.643-16.799-8.766-25.9-13.301
+ c-8.015-4.008-11.574-22.281-17.7-28.601c-11.912-12.136-29.999-19.199-45-26.7c-8.116-3.25-7.344-4.256-13.7,2.1
+ c-8.162,8.162-20.093-2.067-21.3-10.5c-0.09-2.802-3.296-18.216-1.4-19.4c17.956-11.225-8.328-8.64-10.5-13.8
+ c-5.355-14.993,13.008-26.86,25.4-28.1c13.885-1.738,16.784,21.895,22.1,19.9c2.556-1.276,2.566-12.394,2.9-14.8
+ c1.267-8.029,3.588-9.273,11.4-12.175c9.098-3.379,16.063-7.617,25.7-9.225c11.006-3.195,20.317-1.533,28.8-8.6
+ c3.888-2.915,6.704,1.58,10.4,2.4c7.999,1.599,9.7-11.1,9.7-15.9c-0.034-4.665,1.265-8.63-4.7-13.6
+ c-7.806-6.069-19.029-0.869-25.3,5.4c-7.574,7.035-16.357,6.55-13.8-5.6c0.634-4.433,10.209-9.587,14-12
+ c3.7-2.222,5.904,2.522,10.4,1.4c6.579-1.463,9.034,4.735,16.8,4.8c3.233-0.731,14.796-6.881,8.614-19.366
+ C254.143,64.021,255.07,64,256,64c1.855,0,3.707,0.034,5.555,0.086c2.805,8.881-5.965,16.443-1.555,27.614
+ c8.79,21.475,15.992,3.014,24.7-7c2.849-2.849,4.633-2.211,9.3-3.1c2.896-0.483,7.055-9.27,8.393-11.982
+ c20.058,4.956,39.121,13.127,56.567,24.255c-7.447,0.792-9.348-1.396-9.234,7.377c0.042,3.317,0.297,13.319,5.274,14.15
+ c8.277,0.975,6.781,6.832,14.551,7.85c7.443,0.976,2.816,7.553,5.851,14.05c3.393,10.227-19.806,13.302-24.302,14.8
+ c-13.64,4.554,6.34,24.41,15.2,22.3c2.817-0.704,12.215-1.902,12.867-5.067c-0.011-0.323-1.836-11.012-0.867-12.233
+ c1.533-1.934,5.123-2.946,10.776,0.255c13.374,7.573,20.146,25.7,35.897,29.295c2.146,0.489,5.86-0.15,8.494,2.033
+ c2.231,3.015,7.92,8.416,1.131,8.416c-9.017-2.003-13.78,0.859-21.198-4.874c-7.733-5.977-12.543-10.891-22.75-11.076
+ c-8.79-0.159-16.68-3.819-25.738-2.35c-5.05,0.819-10.038,2.811-14.912,4.3c-4.617,1.538-5.51,9.765-10.2,10.7
+ c-19.467,4.581-15.261,23.169-18.773,37.913c-1.351,5.662-6.025,21.003-0.926,26.087c9.12,8.854,19.783,21.035,33.176,22.963
+ c7.206,1.037,22.954-4.576,27.823,2.737c2.062,4.104,7.447-3.03,8.9,0.601c3.663,10.988-4.263,18.186-4.337,28.551
+ c-0.11,15.203,9.178,20.57-3.263,34.148c-13.642,13.607-4.333,30.788-11.9,47c-4.042,8.337-4.808,19.894-10.872,23.777
+ c-13.321,8.532-27.7,15.399-42.714,20.384c-26.627,8.838-55.155,11.672-83.017,8.456c-14.619-1.688-29.041-5.057-42.88-10.065
+ c-3.769-1.363-7.28-2.505-10.472-3.704C178.143,431.619,175.759,430.55,173.399,429.424z M131.699,402.329
+ c-0.468-0.397-0.935-0.796-1.399-1.198c-3.444-2.992-6.802-6.113-10.06-9.371c-3.388-3.388-6.634-6.881-9.734-10.471
+ c-0.035-0.041-0.07-0.082-0.105-0.123c-0.637-0.738-1.257-1.486-1.882-2.234C56.834,316.471,49.259,225.004,92.6,155.1
+ c6.078,6.078-4.101,18.024,7.5,26c5.124,3.606,10.021,2.159,9,8.8c-0.993,6.449,5.355,6.335,6.3,12
+ c2.842,12.429,19.207,18.642,9.9,32.6c-9.118,12.625-16.992,26.729-10.1,42.8c2.254,5.86,7.919,11.858,12.222,16.244
+ c7.813,7.966,7.377,3.188,7.377,13.256c-0.156,4.373,5.261,8.897,4.7,11.7c-1.001,8.011-2.904,15.93-3.9,23.9
+ c-1.792,28.638-0.129,56.662,21.3,78.1c-7.969-4.806-15.636-10.249-22.968-16.29C133.183,403.591,132.44,402.961,131.699,402.329z"
+ />
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/easel.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/easel.svg
new file mode 100644
index 00000000..75301a32
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/easel.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <rect x="80" y="144" width="352" height="192"/>
+ <path d="M464,96H48c-8.837,0-16,7.163-16,16v256c0,8.837,6.932,16,15.768,16H464c8.837,0,16-7.163,16-16V112
+ C480,103.163,472.837,96,464,96z M448,352H64V128h384V352z"/>
+ <polygon points="80,480 112,480 140.147,400 108.835,400 "/>
+ <polygon points="270.83,32 241.472,32 224.171,80 288.099,80 "/>
+ <polygon points="371.853,400 400,480 432,480 403.22,400 "/>
+ <rect x="240" y="400" width="32" height="48"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/edit.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/edit.svg
new file mode 100644
index 00000000..50d410ce
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/edit.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+
+ <rect x="178.846" y="92.087" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 224.3476 631.1498)" width="128.085" height="354.049"/>
+ <path d="M471.723,88.393l-48.115-48.114c-11.723-11.724-31.558-10.896-44.304,1.85l-45.202,45.203l90.569,90.568l45.202-45.202
+ C482.616,119.952,483.445,100.116,471.723,88.393z"/>
+ <polygon points="64.021,363.252 32,480 148.737,447.979 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/egg.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/egg.svg
new file mode 100644
index 00000000..4ac5a56f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/egg.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,32C192,32,96,165.2,96,288.9C96,412.6,160,480,256,480s160-67.4,160-191.1C416,165.2,320,32,256,32z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eject.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eject.svg
new file mode 100644
index 00000000..c9e173e6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eject.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M399,320L399,320c10,0,16.8-7.1,16.8-15.9c0-3.3-1.1-6.1-2.8-9L275.3,104.7c-4.6-5.3-11.5-8.7-19.3-8.7
+ c-7.7,0-14.6,3.4-19.2,8.7l-138,190.8c-1.7,2.6-2.6,5.5-2.6,8.7c0,8.7,6.8,15.8,16.8,15.8v0H399z"/>
+ <path d="M403.7,352H108.4c-6.8,0-12.4,5.4-12.4,12.2v39.6c0,6.7,5.5,12.2,12.4,12.2h295.3c6.8,0,12.3-5.5,12.3-12.2v-39.6
+ C416,357.4,410.5,352,403.7,352z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/email-unread.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/email-unread.svg
new file mode 100644
index 00000000..ea4b15b3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/email-unread.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <circle cx="432" cy="160" r="64"/>
+ <g>
+ <path d="M225,160H33.799c-11.1,0-13.898,3-11.299,10.5c1.5,4.4,8.4,8.1,12.5,10.2c11,5.8,163.799,89.1,169.5,92.1
+ c5.699,3,11.5,4.4,20.5,4.4s14.799-1.4,20.5-4.4c3.79-1.995,72.625-39.497,121.559-66.107C357.594,193.551,352,177.433,352,160
+ H225z"/>
+ <path d="M293.199,273.3l82.201,92.5c2,2,2.898,4.4,1.799,5.601c-1.199,1.1-3.799,0.5-5.9-1.4l-98.6-83.2
+ c-14.9,9.601-25.4,16.2-27.199,17.2c-7.701,3.9-13.1,4.4-20.5,4.4s-12.801-0.5-20.5-4.4c-1.9-1-12.301-7.6-27.201-17.2l-98.6,83.2
+ c-2,2-4.699,2.6-5.9,1.4C71.6,370.3,72.5,367.8,74.5,365.8l82.1-92.5C107.9,241.8,33.5,189.4,25.299,185.2
+ C16.5,180.7,16,186,16,190.1c0,4.101,0,205,0,205C16,404.4,29.699,416,39.5,416H225h185.5c9.799,0,21.5-11.7,21.5-20.9
+ c0,0,0-94.398,0-155.1c-21.726,0-41.416-8.673-55.832-22.729C350.167,235.173,318.36,257.025,293.199,273.3z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/email.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/email.svg
new file mode 100644
index 00000000..e99edb3a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/email.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M67,148.7c11,5.8,163.8,89.1,169.5,92.1c5.7,3,11.5,4.4,20.5,4.4c9,0,14.8-1.4,20.5-4.4c5.7-3,158.5-86.3,169.5-92.1
+ c4.1-2.1,11-5.9,12.5-10.2c2.6-7.6-0.2-10.5-11.3-10.5H257H65.8c-11.1,0-13.9,3-11.3,10.5C56,142.9,62.9,146.6,67,148.7z"/>
+ <path d="M455.7,153.2c-8.2,4.2-81.8,56.6-130.5,88.1l82.2,92.5c2,2,2.9,4.4,1.8,5.6c-1.2,1.1-3.8,0.5-5.9-1.4l-98.6-83.2
+ c-14.9,9.6-25.4,16.2-27.2,17.2c-7.7,3.9-13.1,4.4-20.5,4.4c-7.4,0-12.8-0.5-20.5-4.4c-1.9-1-12.3-7.6-27.2-17.2l-98.6,83.2
+ c-2,2-4.7,2.6-5.9,1.4c-1.2-1.1-0.3-3.6,1.7-5.6l82.1-92.5c-48.7-31.5-123.1-83.9-131.3-88.1c-8.8-4.5-9.3,0.8-9.3,4.9
+ c0,4.1,0,205,0,205c0,9.3,13.7,20.9,23.5,20.9H257h185.5c9.8,0,21.5-11.7,21.5-20.9c0,0,0-201,0-205
+ C464,153.9,464.6,148.7,455.7,153.2z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/erlenmeyer-flask-bubbles.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/erlenmeyer-flask-bubbles.svg
new file mode 100644
index 00000000..a7ae8868
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/erlenmeyer-flask-bubbles.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M445.9,427.1L328,227.9V78c0-7.7-6.5-14-14.5-14c-8,0-14.5,6.2-14.5,14v153.6c0,1.8,0.6,3.6,1.3,5.3
+ c-7.6-11.1-20.6-18.4-35.4-18.4c-23.5,0-42.5,18.3-42.5,41c0,16.8,10.5,31.5,25.4,37.5h-72l35-58.5c1.2-2.1,2.1-4.5,2.1-6.9v-30.4
+ c4,3.2,10,5.1,16.1,5.1c15.3,0,27.5-11.9,27.5-26.6c0-14.7-12.2-26.6-27.5-26.6c-6.1,0-12.1,1.9-16.1,5.1V78c0-7.7-6.5-14-14.5-14
+ c-8,0-14.5,6.2-14.5,14v149.9L66.1,427.1c-2.5,4.3-2.6,9.6,0,13.9c2.6,4.3,7.2,7,12.4,7H256h177.5c5.1,0,9.8-2.6,12.4-7
+ C448.5,436.8,448.4,431.4,445.9,427.1z M282.2,297c14.9-6,25.4-20.8,25.4-37.5c0-5.7-1.2-11.2-3.4-16.1l31,53.6H282.2z"/>
+ <path d="M265.1,128.6c12,0,21.7-9.4,21.7-20.9c0-11.6-9.7-20.9-21.7-20.9c-12,0-21.7,9.4-21.7,20.9
+ C243.3,119.2,253.1,128.6,265.1,128.6z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/erlenmeyer-flask.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/erlenmeyer-flask.svg
new file mode 100644
index 00000000..dba43584
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/erlenmeyer-flask.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M438.815,395.7L338.509,246.2c-12.8-20.3-19.009-44.4-19.009-70.2c0,0,0-73.5,0-93s12.592-33.25,15.009-42.083
+ c2.296-8.392,0.512-8.417-15.188-8.417H192.526c-15.999,0-18.548,0.009-16.311,8.416C178.633,50,191.5,64.3,191.5,83.5
+ s0,92.5,0,92.5c0,25.8-7.285,49.8-20.085,70.2l-49.279,76.5L73.035,395.6c-5.8,9-9.051,20.7-9.051,32.2
+ c0,28,16.347,52.7,63.246,52.7h257.589c46.998,0,63.197-24.7,63.197-52.7C447.916,416.3,444.615,404.7,438.815,395.7z M409.218,441
+ c-4.4,4.2-11.602,7.5-24.499,7.5h-257.59c-12.8,0-20.8-3.5-25.199-7.7c-2.7-2.6-6-7.05-6-13.35c0-5,1.4-10.125,3.9-14.125
+ l99.039-150.392c15.699-25.199,24.632-55.231,24.632-86.932V64.5h64v111.4c0,31.199,7.761,61.3,23.859,87l100.523,150
+ c2.499,4,3.968,9.25,3.968,14.25C415.85,433.55,411.918,438.4,409.218,441z"/>
+ <path d="M389.217,411.301c0.051,0.075,0.1,0.397,0,0.249L307.345,288.5H203.698l-81.069,123.151c-1.5,2.1-2.3,5.175-2.3,7.974
+ c0,7.5,6.288,13.875,13.687,13.875h244c7.5,0,13.599-6.725,13.599-14.125C391.614,416.875,390.516,413.301,389.217,411.301z
+ M302.021,341.7c-1.5-1.5-2.3-3.601-2.3-5.7s0.899-4.2,2.3-5.7c1.5-1.5,3.6-2.3,5.6-2.3c2.102,0,4.2,0.8,5.602,2.3
+ c1.5,1.5,2.299,3.601,2.299,5.7s-0.899,4.2-2.299,5.7c-1.5,1.5-3.5,2.3-5.602,2.3C305.621,344,303.521,343.1,302.021,341.7z
+ M348.92,400.7c-1.4,0.898-2.9,1.3-4.302,1.3c-2.499,0-5.099-1.3-6.598-3.6l-23.499-35.9c-2.4-3.7-1.4-8.7,2.299-11.1
+ c1.4-0.9,2.9-1.301,4.4-1.301c2.6,0,5.1,1.301,6.5,3.601L351.22,389.6C353.618,393.299,352.618,398.299,348.92,400.7z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eye-disabled.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eye-disabled.svg
new file mode 100644
index 00000000..bdb110dd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eye-disabled.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<path class="st0" d="M376.4,158.3L448,86.6L425.4,64l-77.6,77.6C320,127.7,289.5,119,256,119c-81.9,0-145.7,52.2-224,137
+ c34.8,37.4,66.8,72.7,103.3,98.1L64,425.4L86.6,448l76.9-76.9c27,13.7,57,21.9,92.5,21.9c99.9,0,173.4-81.8,224-135.5
+ C452,223.4,417.6,185.7,376.4,158.3z M166.4,256c0-50.4,40.2-91.3,89.6-91.3c19.3,0,37.2,6.2,51.8,16.9l-50.7,50.7
+ c-0.7-2.6-1.1-5.4-1.1-8.3c0-7.9,2.9-15.1,7.6-20.7c-2.5-0.4-5-0.6-7.6-0.6c-28.8,0-52.3,23.9-52.3,53.3c0,8.6,2,16.8,5.6,24
+ L182,307.4C172.2,292.7,166.4,275,166.4,256z M256,347.3c-19.3,0-37.2-6.2-51.8-16.9l27.4-27.4c7.3,4,15.6,6.2,24.4,6.2
+ c28.8,0,52.3-23.9,52.3-53.3c0-2.3-0.2-4.6-0.4-6.9c-5.5,4.3-12.3,6.9-19.8,6.9c-2.9,0-5.6-0.4-8.3-1.1l50.3-50.3
+ c9.8,14.6,15.6,32.3,15.6,51.4C345.6,306.4,305.4,347.3,256,347.3z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eye.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eye.svg
new file mode 100644
index 00000000..4b83a783
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eye.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,128c-81.9,0-145.7,48.8-224,128c67.4,67.7,124,128,224,128c99.9,0,173.4-76.4,224-126.6
+ C428.2,198.6,354.8,128,256,128z M256,347.3c-49.4,0-89.6-41-89.6-91.3c0-50.4,40.2-91.3,89.6-91.3s89.6,41,89.6,91.3
+ C345.6,306.4,305.4,347.3,256,347.3z"/>
+ <g>
+ <path d="M256,224c0-7.9,2.9-15.1,7.6-20.7c-2.5-0.4-5-0.6-7.6-0.6c-28.8,0-52.3,23.9-52.3,53.3c0,29.4,23.5,53.3,52.3,53.3
+ s52.3-23.9,52.3-53.3c0-2.3-0.2-4.6-0.4-6.9c-5.5,4.3-12.3,6.9-19.8,6.9C270.3,256,256,241.7,256,224z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/female.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/female.svg
new file mode 100644
index 00000000..2e8af488
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/female.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M288,284c55.2-14.2,96-64.3,96-124c0-70.7-57.3-128-128-128S128,89.3,128,160c0,59.6,40.8,109.7,96,124v68h-64v64h64v64h64
+ v-64h64v-64h-64V284z M256,240c-44.1,0-80-35.9-80-80s35.9-80,80-80s80,35.9,80,80S300.1,240,256,240z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/filing.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/filing.svg
new file mode 100644
index 00000000..89a2b2ed
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/filing.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M381,128.6H132.1c-12.1,0-19.5,0-19.5,20.4v28.1h288V149C400.6,128.6,393.2,128.6,381,128.6z"/>
+ <path d="M333,96.5H180c-13.1,0-19.5,0.3-19.5,18.7h192C352.4,96.8,346.1,96.5,333,96.5z"/>
+ <path d="M432.4,169.6l-15.9-9.4v32.3h-321v-32.3l-15.2,9.4c-14.3,8.9-17.8,15.3-15,40.9l17.5,184.8c3.7,20.7,15.9,21.2,24,21.2
+ h299.9c8.1,0,20.2-0.5,23.9-21.2l17.2-184.4C450.1,186.5,445.8,178.1,432.4,169.6z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/film-marker.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/film-marker.svg
new file mode 100644
index 00000000..73814adc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/film-marker.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M448.4,208h-344l341.2-68c8.5-1.6,14-9.7,12.4-18.1l-8.9-45.4c-1.6-8.4-9.8-13.8-18.3-12.2L60.7,137.9
+ c-8.5,1.6-14,9.7-12.4,18l8.9,45.4c0.6,2.8,2.1,5.2,3.9,7.2c-7.4,1.2-13.1,7.2-13.1,14.9v209.2c0,8.5,7,15.4,15.6,15.4h384.8
+ c8.6,0,15.6-6.9,15.6-15.4V223.4C464,214.9,457,208,448.4,208z M305,402.4l-50.7-36.3l-50.7,36.3l19.5-58.4l-50.8-36H235l19.2-58.4
+ l19.3,58.4h62.7l-50.8,36L305,402.4z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fireball.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fireball.svg
new file mode 100644
index 00000000..97b5521b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fireball.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M393.267,238.088l-0.231,10.404c-0.814,11.65-3.797,31.912-14.102,54.736c3.251-15.208,4.978-30.982,4.978-47.164
+ c0-12.096-0.958-23.968-2.799-35.544c-15.091-94.901-89.626-169.923-184.138-185.518C185.706,32.285,179.048,32,179.048,32
+ c0.238,0.281,0.465,0.562,0.7,0.844c39.458,47.181,44.1,96.656,37.744,131.85c-2.281,12.629-5.978,23.421-9.991,31.605
+ c0,0,3.359-13.911,3.035-29.72c-0.293-14.234-3.572-30.006-14.986-38.552c3.497,18.378-0.752,33.501-9.121,47.729
+ C161.69,217.808,101,249.386,96,327.408v3.836c0,53.692,25.624,98.979,68.719,125.012c-6.85-12.344-14.964-35.207-8.733-60.151
+ c3.998,23.669,9.951,36.045,20.879,51.756c8.153,11.721,19.104,19.269,33.095,24.934S238.995,480,255.889,480
+ c55.809,0,105.228-28.567,133.845-71.952l0.267,0.061v-0.007c16-25.254,26.1-55.5,26.1-88.019
+ C416.1,290.112,407.596,262.071,393.267,238.088z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flag.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flag.svg
new file mode 100644
index 00000000..5f7ded31
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flag.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M426.4,182.5c-35.8,5.9-94.2,7.5-133-66.1c-41.6-79.1-108.8-81.5-148.1-74.3c-19.1,3.5-33.4,19.5-33.4,35v196.6
+ c11.3,4.3,23.4-0.2,26.5-0.8c0.8-0.2,1.5-0.3,2.4-0.5c25-5.5,51.4-8.1,116.8,23.3c82,39.3,153.8-33.1,181.6-83.5
+ c2-3.5,8.7-20.2,8.7-36.2C438.2,180,426.4,182.5,426.4,182.5z"/>
+ <path d="M88,32H72c-4.4,0-8,3.6-8,8v432c0,4.4,3.6,8,8,8h16c4.4,0,8-3.6,8-8V40C96,35.6,92.4,32,88,32z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flame.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flame.svg
new file mode 100644
index 00000000..5b7c6401
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flame.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M128.922,320c13.05,134,103.764,160,126.932,160c23.168,0,127.457-40.49,128.142-160c0.836-146-121.586-143-95.895-288
+ C201.427,96,118.289,210.816,128.922,320z M215.667,368c0-44.183,40.187-80,40.187-80s40.701,35.817,40.701,80
+ c0,44.184-40.701,80-40.701,80S215.667,412.184,215.667,368z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flash-off.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flash-off.svg
new file mode 100644
index 00000000..eca230e2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flash-off.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M147.4,451.9c0.4,0.2,0.7,0.5,1.1,0.7c10.9,6,22.5,10.7,34.4,14.8c1.8,0.6,3.6,1.2,5.4,1.8c21.4,6.8,44,10.9,67.7,10.9
+ c123.7,0,224-100.3,224-224c0-84.3-46.6-157.7-115.5-195.9c-0.4-0.2-0.7-0.4-1-0.6c-10.9-6-22.5-10.7-34.4-14.8
+ c-1.8-0.6-3.6-1.2-5.4-1.8C302.3,36.1,279.6,32,256,32C132.3,32,32,132.3,32,256C32,340.3,78.6,413.6,147.4,451.9z M118.2,156.6
+ l54.4,54.4l36.3-40.5l-52.4-52.4c28-20.2,62.1-32.6,99.4-32.6c9.3,0,18.3,0.9,27.2,2.4c9.8,1.6,19.3,4.1,28.5,7.3
+ c1.8,0.6,3.7,1.2,5.6,1.9c6.2,2.4,12.2,5,18,8.1c54.2,28.5,91.2,85.3,91.2,150.8c0,37.2-12.4,71.3-32.7,99.4l-54.4-54.4L303,341.4
+ l52.4,52.4c-28,20.3-62.2,32.7-99.4,32.7c-9.3,0-18.4-0.9-27.2-2.4c-9.8-1.6-19.3-4.1-28.5-7.3c-1.9-0.6-3.8-1.2-5.6-1.9
+ c-6.5-2.5-12.9-5.3-19-8.6c-53.6-28.7-90.1-85.2-90.1-150.3C85.6,218.8,98,184.7,118.2,156.6z"/>
+ <polygon points="209.7,389.8 348.9,235 263.6,235 302.2,122.2 163.1,277 248.4,277 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flash.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flash.svg
new file mode 100644
index 00000000..84c0032b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flash.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="96,288 243,288 191.9,480 416,224 269,224 320,32 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/folder.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/folder.svg
new file mode 100644
index 00000000..0cb47be8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/folder.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M430.1,192H81.9c-17.7,0-18.6,9.2-17.6,20.5l13,183c0.9,11.2,3.5,20.5,21.1,20.5h316.2c18,0,20.1-9.2,21.1-20.5l12.1-185.3
+ C448.7,199,447.8,192,430.1,192z"/>
+ <g>
+ <path d="M426.2,143.3c-0.5-12.4-4.5-15.3-15.1-15.3c0,0-121.4,0-143.2,0c-21.8,0-24.4,0.3-40.9-17.4C213.3,95.8,218.7,96,190.4,96
+ c-22.6,0-75.3,0-75.3,0c-17.4,0-23.6-1.5-25.2,16.6c-1.5,16.7-5,57.2-5.5,63.4h343.4L426.2,143.3z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fork-repo.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fork-repo.svg
new file mode 100644
index 00000000..7136045b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fork-repo.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <polygon class="st0" points="416,80 368,80 368,32 304,32 304,80 256,80 256,144 304,144 304,192 368,192 368,144 416,144 "/>
+ <path class="st0" d="M304,240c0,38.6-4.5,42.3-14.4,50.3c-7.4,6-22.2,7.1-39.4,8.3c-9.5,0.7-20.4,1.5-31.4,3.3
+ c-9.4,1.5-18.4,4.7-26.8,8.8V151.4c19.1-11.1,32-31.7,32-55.4c0-35.3-28.7-64-64-64S96,60.7,96,96c0,23.7,12.9,44.3,32,55.4v209.2
+ c-19.1,11.1-32,31.7-32,55.4c0,35.3,28.7,64,64,64s64-28.7,64-64c0-15.7-5.7-30.1-15-41.2c6.7-4.8,13.9-8.7,20.2-9.7
+ c8.1-1.3,16.6-1.9,25.6-2.6c24.4-1.7,52.1-3.7,75.2-22.5c30.9-25.1,37.5-52.1,38-94.9l0,0V240H304z M160,64c17.6,0,32,14.4,32,32
+ s-14.4,32-32,32s-32-14.4-32-32S142.4,64,160,64z M160,448c-17.6,0-32-14.4-32-32s14.4-32,32-32s32,14.4,32,32S177.6,448,160,448z"
+ />
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fork.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fork.svg
new file mode 100644
index 00000000..79f076ea
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fork.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M270.2,148.9C270.2,149,270.1,149,270.2,148.9v0.1V148.9z"/>
+ <path d="M320,166c0-43.2-15-93.2-24-133.7V32h-8l-0.2,116.9c0,6.1-2.9,11.1-9,11.1c-5.7,0-8-4.3-8.6-9.9c-0.1-0.4,0-0.8,0-1.2
+ L259.9,32h-8l-9,117l-0.1,1.1c-0.6,5.6-3.7,9.9-9.5,9.9c-6.1,0-9.1-5-9.1-11.1L223.8,32h-8C207,73,192,122.9,192,166.1
+ c0,25.7,14.6,48.1,36.7,58.2c11.2,5.1,11.3,10.3,11.3,10.3s-16,201.7-16,213.1c0,11.4,4,18.5,9.5,24s14.2,8.2,22.4,8.2
+ c0.1,0,0.1,0,0.2,0c0.1,0,0.1,0,0.2,0c8.2,0,16.8-2.7,22.4-8.2c5.5-5.5,9.3-10.9,9.3-24c0-13.1-16-213.1-16-213.1s-1-5,11.4-10.6
+ C305,214.2,320,191.8,320,166z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/forward.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/forward.svg
new file mode 100644
index 00000000..55f0815e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/forward.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M288,298.1v92.3L448,256L288,112v80C100.8,192,64,400,64,400C117,307,186.4,298.1,288,298.1z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/funnel.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/funnel.svg
new file mode 100644
index 00000000..0174f908
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/funnel.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256.085,32c-123.79,0-224.096,35.817-224.096,80c0,8.476,3.729,16.642,10.573,24.309l-0.061,0.008
+ C74.408,175.213,192,313,192,352v87l0,0c0,22.688,28.891,41,64,41s64-18.312,64-41l0,0v-83.088c0-1.241,0.008-2.54,0.008-3.912
+ C320.008,313,436,177.432,471,134.062v-0.002c6-7.007,8.977-14.408,8.977-22.06C479.977,67.817,379.875,32,256.085,32z
+ M256.178,160c-92.058,0-176.112-22-176.112-48s83.053-48,176.112-48c93.06,0,176.111,22.413,176.111,48S348.236,160,256.178,160z"
+ />
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/gear-a.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/gear-a.svg
new file mode 100644
index 00000000..d8953415
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/gear-a.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M411.1,256c0-23.9,14.8-42.8,36.9-55.8c-4-13.3-9.3-26.2-15.8-38.2c-24.9,6.5-45-3.2-62-20.2c-16.9-16.9-22.1-37.1-15.6-62
+ C342.6,73.3,329.8,68,316.4,64c-13,22.2-36.4,36.9-60.4,36.9c-23.9,0-47.4-14.7-60.4-36.9c-13.4,4-26.2,9.3-38.2,15.8
+ c6.5,24.9,1.3,45-15.6,62c-16.9,16.9-37.1,26.7-61.9,20.2C73.3,174,68,186.8,64,200.2c22.2,13,37,31.9,37,55.8
+ c0,23.9-14.8,47.4-37,60.4c4,13.4,9.3,26.2,15.8,38.2c24.9-6.5,45-1.3,61.9,15.6c17,16.9,22.1,37.1,15.6,62
+ c12.1,6.5,24.8,11.8,38.2,15.8c13-22.2,36.5-36.9,60.4-36.9c23.9,0,47.4,14.7,60.4,36.9c13.4-4,26.2-9.3,38.2-15.8
+ c-6.5-24.9-1.3-45,15.6-62c16.9-16.9,37.1-26.7,62-20.2c6.5-12.1,11.8-24.9,15.8-38.2C425.8,298.8,411.1,279.9,411.1,256z
+ M256,354.3c-54.2,0-98.3-44-98.3-98.3c0-54.3,44-98.3,98.3-98.3c54.3,0,98.3,44,98.3,98.3C354.3,310.3,310.3,354.3,256,354.3z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/gear-b.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/gear-b.svg
new file mode 100644
index 00000000..88b31299
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/gear-b.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M448,294.4v-76.8h-42.8c-3.4-14.4-8.9-28-16.1-40.5l29.8-29.7l-54.3-54.3l-29.1,29.1c-12.6-7.7-26.4-13.5-41.1-17.3V64
+ h-76.8v40.9c-14.7,3.8-28.5,9.7-41.1,17.3l-29.1-29.1l-54.3,54.3l29.8,29.7c-7.2,12.5-12.6,26.1-16.1,40.5H64v76.8h44.1
+ c3.8,13.7,9.5,26.6,16.7,38.6l-31.7,31.7l54.3,54.3l32.3-32.3c11.7,6.8,24.5,11.9,37.9,15.4v46h76.8v-46
+ c13.5-3.5,26.2-8.6,37.9-15.4l32.3,32.3l54.3-54.3L387.3,333c7.2-11.9,12.9-24.8,16.7-38.6H448z M256,309.8
+ c-29.7,0-53.7-24.1-53.7-53.8s24-53.8,53.7-53.8s53.8,24.1,53.8,53.8S285.7,309.8,256,309.8z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/grid.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/grid.svg
new file mode 100644
index 00000000..7100f22e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/grid.svg
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M160,153.3c0,3.7-3,6.7-6.7,6.7h-50.5c-3.7,0-6.7-3-6.7-6.7v-50.5c0-3.7,3-6.7,6.7-6.7h50.5c3.7,0,6.7,3,6.7,6.7V153.3z"
+ />
+ <path d="M288,153.3c0,3.7-3,6.7-6.7,6.7h-50.5c-3.7,0-6.7-3-6.7-6.7v-50.5c0-3.7,3-6.7,6.7-6.7h50.5c3.7,0,6.7,3,6.7,6.7V153.3z"
+ />
+ <path d="M416,153.3c0,3.7-3,6.7-6.7,6.7h-50.5c-3.7,0-6.7-3-6.7-6.7v-50.5c0-3.7,3-6.7,6.7-6.7h50.5c3.7,0,6.7,3,6.7,6.7V153.3z"
+ />
+ </g>
+ <g>
+ <path d="M160,281.3c0,3.7-3,6.7-6.7,6.7h-50.5c-3.7,0-6.7-3-6.7-6.7v-50.5c0-3.7,3-6.7,6.7-6.7h50.5c3.7,0,6.7,3,6.7,6.7V281.3z"
+ />
+ <path d="M288,281.3c0,3.7-3,6.7-6.7,6.7h-50.5c-3.7,0-6.7-3-6.7-6.7v-50.5c0-3.7,3-6.7,6.7-6.7h50.5c3.7,0,6.7,3,6.7,6.7V281.3z"
+ />
+ <path d="M416,281.3c0,3.7-3,6.7-6.7,6.7h-50.5c-3.7,0-6.7-3-6.7-6.7v-50.5c0-3.7,3-6.7,6.7-6.7h50.5c3.7,0,6.7,3,6.7,6.7V281.3z"
+ />
+ </g>
+ <g>
+ <path d="M160,409.3c0,3.7-3,6.7-6.7,6.7h-50.5c-3.7,0-6.7-3-6.7-6.7v-50.5c0-3.7,3-6.7,6.7-6.7h50.5c3.7,0,6.7,3,6.7,6.7V409.3z"
+ />
+ <path d="M288,409.3c0,3.7-3,6.7-6.7,6.7h-50.5c-3.7,0-6.7-3-6.7-6.7v-50.5c0-3.7,3-6.7,6.7-6.7h50.5c3.7,0,6.7,3,6.7,6.7V409.3z"
+ />
+ <path d="M416,409.3c0,3.7-3,6.7-6.7,6.7h-50.5c-3.7,0-6.7-3-6.7-6.7v-50.5c0-3.7,3-6.7,6.7-6.7h50.5c3.7,0,6.7,3,6.7,6.7V409.3z"
+ />
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/hammer.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/hammer.svg
new file mode 100644
index 00000000..a6b2d085
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/hammer.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M410,32h-52c-3.3,0-6,2.7-6,6v5.6c-4,4-10.9,9.8-17.8,9.8c-10.5,0-14.8-16.4-26.1-18.4s-27.2-3-37.9-3s-52,0.7-102,21.5
+ c-50,20.8-71.7,64.9-72.3,81.4c-0.3,8.7,2.7,21.1,10,11.1c7.3-10,35.3-42.3,57.7-44.7c22.3-2.3,45.7,0.8,63.7,17.2
+ c17.3,15.7,21.3,30.8,21.3,73.5l-6.6,2c-4.3,1.3-7,5.7-7,9c0,0-0.2,6.5-0.2,70.4C234.8,368,224,474,224,474c0,3.3,2.7,6,6,6h84
+ c3.3,0,6-2.7,6-6c0,0-10.8-106-10.8-200.6c0-63.9-0.2-70.4-0.2-70.4c0-3.3-2.3-7.8-7-9l-8-2c0-38.2-0.4-54,6.3-65.9
+ c7-12.4,22.3-22.9,29.7-25.1c5.9-1.8,16,1.3,22,6.5V122c0,3.3,2.7,6,6,6h52c3.3,0,6-2.7,6-6V38C416,34.7,413.3,32,410,32z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/happy-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/happy-outline.svg
new file mode 100644
index 00000000..f5d7cc4b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/happy-outline.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M387.469,289.593c-2.248-1.175-4.775-1.796-7.308-1.796c-5.956,0-11.358,3.287-14.104,8.588
+ C347.804,331.731,304.605,352,256.004,352c-49.734,0-93.84-20.562-109.757-54.997c-2.589-5.589-8.244-9.199-14.407-9.199
+ c-2.294,0-4.521,0.485-6.658,1.463c-7.926,3.674-11.397,13.117-7.734,21.057C138.454,355.765,194.135,384,256.004,384
+ c60.34,0,114.604-27.281,138.241-73.055C398.254,303.184,395.201,293.598,387.469,289.593z"/>
+ <path d="M412.793,231.174C402.312,217.593,389.024,208,368.137,208c-20.887,0-34.062,9.573-44.611,23.117
+ c-5.502,7.062-4.525,16.633,3.746,22.207c2.914,1.963,6.347,2.676,9.928,2.676c5.395-0.001,10.507-2.109,13.67-6.179
+ c3.45-4.435,7.707-9.821,17.268-9.821c9.61,0,13.832,5.361,17.23,9.777c3.178,4.104,8.305,6.223,13.717,6.223
+ c3.581,0,7.007-0.708,9.922-2.683C416.558,248.185,418.257,238.25,412.793,231.174z"/>
+ <path d="M188.792,231.174C178.312,217.593,165.024,208,144.137,208s-34.063,9.573-44.612,23.117
+ c-5.501,7.062-4.525,16.633,3.747,22.207c2.914,1.963,6.346,2.676,9.927,2.676c5.395-0.001,10.507-2.109,13.669-6.179
+ c3.451-4.435,7.708-9.821,17.269-9.821c9.61,0,13.832,5.361,17.23,9.777c3.177,4.104,8.304,6.223,13.716,6.223
+ c3.582,0,7.007-0.708,9.922-2.683C192.558,248.185,194.257,238.25,188.792,231.174z"/>
+ <path d="M256,32C132.288,32,32,132.288,32,256s100.288,224,224,224s224-100.288,224-224S379.712,32,256,32z M391.765,391.765
+ C355.5,428.028,307.285,448,256,448s-99.5-19.972-135.765-56.235C83.972,355.5,64,307.285,64,256s19.972-99.5,56.235-135.765
+ C156.5,83.972,204.715,64,256,64s99.5,19.972,135.765,56.235C428.028,156.5,448,204.715,448,256S428.028,355.5,391.765,391.765z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/happy.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/happy.svg
new file mode 100644
index 00000000..cba963ed
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/happy.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,32C132.288,32,32,132.288,32,256s100.288,224,224,224s224-100.288,224-224S379.712,32,256,32z M103.272,253.324
+ c-8.272-5.574-9.249-15.145-3.747-22.207C110.074,217.573,123.25,208,144.137,208s34.174,9.593,44.655,23.174
+ c5.464,7.076,3.765,17.011-3.787,22.144c-2.915,1.975-6.341,2.683-9.922,2.683c-5.412,0-10.539-2.119-13.716-6.223
+ c-3.398-4.416-7.621-9.777-17.23-9.777c-9.561,0-13.818,5.387-17.269,9.821c-3.163,4.069-8.274,6.178-13.669,6.179
+ C109.618,256,106.186,255.287,103.272,253.324z M394.245,310.945C370.607,356.719,316.344,384,256.004,384
+ c-61.869,0-117.55-28.235-138.556-73.677c-3.663-7.939-0.191-17.383,7.734-21.057c2.137-0.978,4.363-1.463,6.658-1.463
+ c6.163,0,11.818,3.61,14.407,9.199C162.164,331.438,206.27,352,256.004,352c48.602,0,91.8-20.269,110.053-55.615
+ c2.746-5.301,8.148-8.588,14.104-8.588c2.532,0,5.06,0.621,7.308,1.796C395.201,293.598,398.254,303.184,394.245,310.945z
+ M409.006,253.317c-2.915,1.975-6.341,2.683-9.922,2.683c-5.412,0-10.539-2.119-13.717-6.223c-3.398-4.416-7.62-9.777-17.23-9.777
+ c-9.561,0-13.817,5.387-17.268,9.821c-3.163,4.069-8.275,6.178-13.67,6.179c-3.581,0-7.014-0.713-9.928-2.676
+ c-8.271-5.574-9.248-15.145-3.746-22.207C334.074,217.573,347.25,208,368.137,208c20.888,0,34.175,9.593,44.656,23.174
+ C418.257,238.25,416.558,248.185,409.006,253.317z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/headphone.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/headphone.svg
new file mode 100644
index 00000000..b49c9340
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/headphone.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M447.4,238.2c-3.2-59.8-21.9-108.6-56-145.2c-0.1-0.1-0.1-0.1-0.2-0.2c-7.7-8.4-16.1-15.9-24.8-22.6
+ c-9-6.9-18.6-13-28.5-18.1c-25.3-13.1-53-20-82.1-20c-29,0-56.6,6.9-81.9,20c-9.9,5.1-19.4,11.2-28.4,18.1
+ c-8.7,6.7-17,14.2-24.7,22.6c-0.1,0.1-0.1,0.1-0.2,0.2c-34,36.6-52.7,85.5-55.9,145.2C61.9,288.9,68,368,77.7,400
+ c20.3,67,40.4,80,72.1,80s58.2-26.4,58.2-58.9V315.1c0-32.5-23.3-59-53.3-59c-18,0-34,9.7-43.8,24.4c0,0-11.1-8.1-13.1-23
+ c-2.1-14.9-3.1-32.4,5.6-63c8.7-30.5,20.8-20.2,35.6-39c2.5-3.3,5.2-6.4,8-9.5c3.2-3.4,6.4-6.7,9.8-9.7c1.6-1.5,3.2-2.8,4.8-4.2
+ c11-9.3,21-17,33.7-22.8c18.9-8.6,39.4-13.3,60.5-13.3c21,0,41.7,4.7,60.7,13.3c12.7,5.8,22.9,13.5,33.9,22.8
+ c1.6,1.4,3.2,2.7,4.8,4.2c3.4,3,6.6,6.3,9.8,9.7c2.8,3.1,5.5,6.2,8,9.5c14.8,18.8,26.9,8.5,35.6,39c8.7,30.5,7.6,48.1,5.6,63
+ c-2.1,14.9-13.1,23-13.1,23c-9.8-14.7-25.7-24.4-43.8-24.4c-30,0-53.3,26.4-53.3,59v106.1c0,32.4,26.5,58.9,58.2,58.9
+ c31.7,0,51.8-13,72.1-80C444,368,450.1,288.9,447.4,238.2z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/heart-broken.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/heart-broken.svg
new file mode 100644
index 00000000..984e31aa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/heart-broken.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M229,288c1-18,0-38,8-55c2-5,1-10,1-15c-4-21-14-40-15-60c0-1.39,1.004-4.771,1.005-6.157
+ c-3.216,2.234-7.607,4.024-11.005,5.157c-20,6-17.51,2.573-34.51,13.573l-11.933,7.228c16.343-17.939,38.528-24.781,56.525-38.714
+ c0.194-15.438,0.858-30.677,3.137-45.84C185.61,53.496,121.785,54.268,82.123,95.57c-45.497,47.344-45.497,124.101,0,171.445
+ l152.849,159.096c-0.085-10.656-0.443-21.176-1.972-31.111C227,359,229,324,229,288z"/>
+ <path d="M322,301c-11-26-33-44-63-50c-0.85,0-1.879-0.543-2.936-1.319c-0.023,0.107-0.041,0.213-0.064,0.319c-11,48-23,94-21,142
+ c0,12.227,3.983,25.117,3.833,38.131L256,448l104-108.25C345.153,329.271,330.428,318.621,322,301z"/>
+ <path d="M429.874,95.57c-40.426-42.094-105.989-42.094-146.408,0L264,115.403c0.075,13.175,0.213,26.202-3,38.597
+ c-2,10-19,19-16,31c3.003,13.213,8.166,25.705,10.732,38.559C271.014,232.084,284.771,242.896,297,256
+ c22.801,26.766,37.747,57.459,65.283,81.371l67.591-70.355C475.375,219.671,475.375,142.914,429.874,95.57z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/heart.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/heart.svg
new file mode 100644
index 00000000..945b5103
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/heart.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M429.9,95.6c-40.4-42.1-106-42.1-146.4,0L256,124.1l-27.5-28.6c-40.5-42.1-106-42.1-146.4,0c-45.5,47.3-45.5,124.1,0,171.4
+ L256,448l173.9-181C475.4,219.7,475.4,142.9,429.9,95.6z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help-buoy.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help-buoy.svg
new file mode 100644
index 00000000..106cff94
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help-buoy.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,32C132.3,32,32,132.3,32,256s100.3,224,224,224s224-100.3,224-224S379.7,32,256,32z M434.3,184.5l-61.5,18.9
+ c-6.3-14-15.1-26.8-26.3-38c-11.2-11.2-24-20-38-26.3l18.9-61.5c23.8,9.5,45.6,23.9,64.3,42.5C410.4,138.9,424.8,160.7,434.3,184.5z
+ M256,352c-53,0-96-43-96-96c0-53,43-96,96-96s96,43,96,96C352,309,309,352,256,352z M120.2,120.2c18.7-18.7,40.5-33,64.3-42.5
+ l18.9,61.5c-14,6.3-26.8,15.1-38,26.3c-11.2,11.2-20,24-26.3,38l-61.5-18.9C87.2,160.7,101.6,138.9,120.2,120.2z M77.7,327.5
+ l61.5-18.9c6.3,14,15.1,26.8,26.3,38s24,20,38,26.3l-18.9,61.5c-23.8-9.5-45.6-23.9-64.3-42.5C101.6,373.1,87.2,351.3,77.7,327.5z
+ M391.8,391.8c-18.7,18.7-40.5,33-64.3,42.5l-18.9-61.5c14-6.3,26.8-15.1,38-26.3s20-24,26.3-38l61.5,18.9
+ C424.8,351.3,410.4,373.1,391.8,391.8z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help-circled.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help-circled.svg
new file mode 100644
index 00000000..f70e8313
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help-circled.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,32C132.3,32,32,132.3,32,256s100.3,224,224,224c123.7,0,224-100.3,224-224S379.7,32,256,32z M276.2,358.7
+ c-0.5,17.8-13.7,28.8-30.8,28.3c-16.4-0.5-29.3-12.2-28.8-30.1c0.5-17.8,14.1-29.1,30.5-28.6C264.3,328.8,276.8,340.9,276.2,358.7z
+ M324.9,231.4c-4.2,5.9-13.6,13.5-25.4,22.7l-13.1,9c-6.4,4.9-10.4,10.7-12.5,17.3c-1.1,3.5-1.9,12.6-2.1,18.7
+ c-0.1,1.2-0.8,3.9-4.5,3.9c-3.7,0-35,0-39.1,0c-4.1,0-4.6-2.4-4.5-3.6c0.6-16.6,3-30.3,9.9-41.3c9.3-14.8,35.5-30.4,35.5-30.4
+ c4-3,7.1-6.2,9.5-9.7c4.4-6,8-12.7,8-19.9c0-8.3-2-16.2-7.3-22.8c-6.2-7.7-12.9-11.4-25.8-11.4c-12.7,0-20.1,6.4-25.4,14.8
+ c-5.3,8.4-4.4,18.3-4.4,27.3H175c0-34,8.9-55.7,27.7-68.5c12.7-8.7,28.9-12.5,47.8-12.5c24.8,0,44.5,4.6,61.9,17.8
+ c16.1,12.2,24.6,29.4,24.6,52.6C337,209.7,332,221.7,324.9,231.4z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help.svg
new file mode 100644
index 00000000..cd4dcb8b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M345.1,77.1C317.6,56.2,286.6,49,247.3,49c-29.8,0-55.3,6.1-75.5,19.7C142,89,128,123.1,128,177h76.8
+ c0-14.4-1.4-29.9,7-43.2c8.4-13.3,20.1-23.5,40.2-23.5c20.4,0,30.9,5.9,40.8,18.1c8.4,10.4,11.6,22.8,11.6,36
+ c0,11.4-5.8,21.9-12.7,31.4c-3.8,5.6-8.8,10.6-15.1,15.4c0,0-41.5,24.7-56.1,48.1c-10.9,17.4-14.8,39.2-15.7,65.3
+ c-0.1,1.9,0.6,5.8,7.2,5.8c6.5,0,56,0,61.8,0c5.8,0,7-4.4,7.1-6.2c0.4-9.5,1.6-24.1,3.3-29.6c3.3-10.4,9.7-19.5,19.7-27.3
+ l20.7-14.3c18.7-14.6,33.6-26.5,40.2-35.9c11.3-15.4,19.2-34.4,19.2-56.9C384,123.5,370.5,96.4,345.1,77.1z M242,370.2
+ c-25.9-0.8-47.3,17.2-48.2,45.3c-0.8,28.2,19.5,46.7,45.5,47.5c27,0.8,47.9-16.6,48.7-44.7C288.8,390.2,269,371,242,370.2z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/home.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/home.svg
new file mode 100644
index 00000000..7a642ddf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/home.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="448,288 256,64 64,288 112,288 112,448 208,448 208,320 304,320 304,448 400,448 400,288 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/icecream.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/icecream.svg
new file mode 100644
index 00000000..21bfc9aa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/icecream.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="128,256 256,480 384,256 "/>
+ <g>
+ <path d="M402.5,172.6c-0.8-0.4-1.5-0.8-2.3-1.3c-4.4-2.8-8.4-8.5-8.7-12.7l0.1-0.7c3.2-9,5-19.2,5-29.8c0-53.1-43-96.1-96.1-96.1
+ c-31.4,0-59.2,15-76.8,38.3c0,0-9.1,14-10.8,29c0,0,1.1-19.4,4.2-31.5c-7.4-2.5-15.4-3.8-23.6-3.8c-41.7,0-75.6,33.8-75.6,75.6
+ c0,6.4,0.8,12.6,2.3,18.5c0,0.4-0.1,0.7-0.2,1c-0.9,5.1-4,9.5-8.4,12.3c-0.7,0.5-1.5,0.9-2.2,1.3c-8.2,5-13.5,13.6-13.5,23.4
+ c0,15.4,13.5,28,29.9,28h4.1h252h4.1c16.4,0,29.8-12.5,29.8-28C416,186.3,410.6,177.6,402.5,172.6z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/image.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/image.svg
new file mode 100644
index 00000000..7faf9bb3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/image.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M368,224c26.5,0,48-21.5,48-48c0-26.5-21.5-48-48-48c-26.5,0-48,21.5-48,48C320,202.5,341.5,224,368,224z"/>
+ <path d="M452,64H60c-15.6,0-28,12.7-28,28.3v327.4c0,15.6,12.4,28.3,28,28.3h392c15.6,0,28-12.7,28-28.3V92.3
+ C480,76.7,467.6,64,452,64z M348.9,261.7c-3-3.5-7.6-6.2-12.8-6.2c-5.1,0-8.7,2.4-12.8,5.7l-18.7,15.8c-3.9,2.8-7,4.7-11.5,4.7
+ c-4.3,0-8.2-1.6-11-4.1c-1-0.9-2.8-2.6-4.3-4.1L224,215.3c-4-4.6-10-7.5-16.7-7.5c-6.7,0-12.9,3.3-16.8,7.8L64,368.2V107.7
+ c1-6.8,6.3-11.7,13.1-11.7h357.7c6.9,0,12.5,5.1,12.9,12l0.3,260.4L348.9,261.7z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/images.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/images.svg
new file mode 100644
index 00000000..c14db6c6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/images.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M457.6,140.2l-82.5-4l-4.8-53.8c-1-11.3-11.1-19.2-22.9-18.3L51.4,88.4c-11.8,1-20.3,10.5-19.4,21.7l21.2,235.8
+ c1,11.3,11.2,19.2,22.9,18.3l15-1.2l-2.4,45.8c-0.6,12.6,9.2,22.8,22.4,23.5L441.3,448c13.2,0.6,24.1-8.6,24.8-21.2L480,163.5
+ C480.6,151,470.7,140.8,457.6,140.2z M102.6,145.5l-7.1,134.8L78.1,305l-16-178c0-0.2,0-0.3,0-0.5s0-0.3,0-0.5
+ c0.5-5,4.3-9,9.5-9.4l261-21.4c5.2-0.4,9.7,3,10.5,7.9c0,0.2,0.3,0.2,0.3,0.4c0,0.1,0.3,0.2,0.3,0.4l2.7,30.8l-219-10.5
+ C114.2,123.8,103.2,133,102.6,145.5z M436.7,382.4l-46.7-55.3l-27.5-32.7c-2.4-2.9-6.3-5.3-10.6-5.5c-4.3-0.2-7.5,1.5-11.1,4.1
+ l-16.4,11.9c-3.5,2.1-6.2,3.5-9.9,3.3c-3.6-0.2-6.8-1.6-9.1-3.8c-0.8-0.8-2.3-2.2-3.5-3.4l-42.8-48.9c-3.1-3.9-8.2-6.4-13.8-6.7
+ c-5.7-0.3-11.2,2.1-14.8,5.6L129.4,359.8l-6.8,7.4l0.3-6.8l6.8-128.9l3.3-62.9c0-0.2,0-0.4,0-0.5c0-0.2,0-0.4,0-0.5
+ c1.4-5.4,6.2-9.3,11.9-9l204.2,9.8l28.7,1.4l58.3,2.8c5.8,0.3,10.3,4.7,10.4,10.2c0,0.2,0.3,0.3,0.3,0.5c0,0.2,0.3,0.3,0.3,0.5
+ L436.7,382.4z"/>
+ </g>
+ <path d="M373.2,262.3c19.4,0,35.2-15.8,35.2-35.2s-15.7-35.2-35.2-35.2c-19.4,0-35.2,15.7-35.2,35.2S353.7,262.3,373.2,262.3z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/information-circled.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/information-circled.svg
new file mode 100644
index 00000000..bed4eda7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/information-circled.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M480,253C478.3,129.3,376.7,30.4,253,32S30.4,135.3,32,259c1.7,123.7,103.3,222.6,227,221C382.7,478.3,481.7,376.7,480,253
+ z M256,111.9c17.7,0,32,14.3,32,32s-14.3,32-32,32c-17.7,0-32-14.3-32-32S238.3,111.9,256,111.9z M300,395h-88v-11h22V224h-22v-12
+ h66v172h22V395z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/information.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/information.svg
new file mode 100644
index 00000000..6a72ba5f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/information.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="288,448 288,192 192,192 192,208 224,208 224,448 192,448 192,464 320,464 320,448 "/>
+ <path d="M255.8,144.5c26.6,0,48.2-21.6,48.2-48.2s-21.6-48.2-48.2-48.2c-26.6,0-48.2,21.6-48.2,48.2S229.2,144.5,255.8,144.5z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ionic.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ionic.svg
new file mode 100644
index 00000000..1db7b69a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ionic.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M423.592,132.804C427.006,127.714,429,121.59,429,115c0-17.675-14.33-32-32-32c-6.59,0-12.714,1.994-17.805,5.409
+ C344.709,63.015,302.11,48,256,48C141.125,48,48,141.125,48,256c0,114.877,93.125,208,208,208c114.873,0,208-93.123,208-208
+ C464,209.889,448.984,167.29,423.592,132.804z M391.83,391.832c-17.646,17.646-38.191,31.499-61.064,41.174
+ c-23.672,10.012-48.826,15.089-74.766,15.089c-25.94,0-51.095-5.077-74.767-15.089c-22.873-9.675-43.417-23.527-61.064-41.174
+ s-31.5-38.191-41.174-61.064C68.982,307.096,63.905,281.94,63.905,256c0-25.94,5.077-51.095,15.089-74.767
+ c9.674-22.873,23.527-43.417,41.174-61.064s38.191-31.5,61.064-41.174C204.905,68.982,230.06,63.905,256,63.905
+ c25.939,0,51.094,5.077,74.766,15.089c13.446,5.687,26.08,12.83,37.802,21.327C366.293,104.719,365,109.707,365,115
+ c0,17.675,14.327,32,32,32c5.293,0,10.28-1.293,14.678-3.568c8.498,11.721,15.641,24.355,21.327,37.801
+ c10.013,23.672,15.09,48.827,15.09,74.767c0,25.939-5.077,51.096-15.09,74.768C423.33,353.641,409.478,374.186,391.83,391.832z"/>
+ <circle cx="256.003" cy="256" r="96"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-alarm-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-alarm-outline.svg
new file mode 100644
index 00000000..e53ca3e2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-alarm-outline.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M438.4,192.4c12.2-14.2,19.6-32.3,19.6-52.2c0.1-43.8-35.5-79.6-80.4-82.1c-1.6-0.1-3.1-0.1-4.8-0.1
+ c-20.4-0.1-39.1,6.8-53.8,18.1l53.8,52.4l-10.5,10.4c-25.7-19.4-57-32-91-34.9v-0.1c0-8.5-7-15.5-15.5-15.5
+ c-8.5,0-15.5,7-15.5,15.5v0.1c-33.9,2.9-65.1,15.5-90.7,34.9l-10.4-10.4l53.8-52.4c-14.7-11.4-33.4-18.2-53.7-18.1
+ c-1.6,0-3.2,0.1-4.8,0.1c-45,2.5-80.6,38.3-80.4,82.1c0,19.8,7.4,38,19.6,52.2l54-52.6l9.5,9.5c-35.1,31.9-57.1,78-57.1,129.2
+ c0,43.9,16.2,84,43,114.7l-36.4,44.6L99,448l35.2-42.9c31.6,30.2,74.4,48.9,121.6,48.9h0.1c0,0,0.2,0,0.3,0
+ c47.2,0,90.2-18.7,121.8-48.9l35.2,43l12.3-10.1L389,393.3c26.8-30.8,43-70.9,43-114.7c0-51.1-22-97.3-57.2-129.3l9.5-9.5
+ L438.4,192.4z M76.2,167.8c-4.2-8.6-6.4-18.4-6.5-28c-0.1-35.1,28.4-64.6,65.5-66.8c12.7-0.7,23.1,1.4,32.1,6.1L76.2,167.8z
+ M415.9,276.5c0,87.7-72,157.1-160.1,157.1C167.8,433.6,96,364.2,96,276.5c0-87.7,71.8-158.7,159.9-158.7
+ C344,117.8,415.9,188.7,415.9,276.5z M344.7,79.2c8.8-4.8,19.3-6.8,32.1-6.1c37.2,2,65.6,31.5,65.5,66.8c0,9.6-2.3,19.4-6.5,28.1
+ L344.7,79.2z"/>
+ </g>
+ <polygon points="256,160 256,288 160,288 160,304 272,304 272,160 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-alarm.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-alarm.svg
new file mode 100644
index 00000000..b8339b6a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-alarm.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M438.4,192.4c12.2-14.2,19.6-32.3,19.6-52.2c0.1-43.8-35.5-79.6-80.4-82.1c-1.6-0.1-3.1-0.1-4.8-0.1
+ c-20.4-0.1-39.1,6.8-53.8,18.1l53.8,52.4l-10.6,10.4c-25.7-19.4-57.2-32-91.2-34.9v-0.1c0-8.5-7-15.5-15.5-15.5s-15.5,7-15.5,15.5
+ v0.1c-34,2.9-65,15.5-90.6,34.9L139,128.6l53.8-52.4c-14.7-11.4-33.4-18.2-53.7-18.1c-1.6,0-3.2,0.1-4.8,0.1
+ c-45,2.5-80.6,38.3-80.4,82.1c0,19.8,7.4,38,19.6,52.2l54-52.6l9.5,9.5c-35.1,31.9-57.1,78-57.1,129.2c0,43.9,16.2,84,43,114.7
+ l-36.4,44.6L99,448l35.2-42.9c31.6,30.2,74.4,48.9,121.6,48.9h0.1c0,0,0.2,0,0.3,0c47.2,0,90.2-18.7,121.8-48.9l35.2,43l12.3-10.1
+ L389,393.3c26.8-30.8,43-70.9,43-114.7c0-51.1-22-97.3-57.2-129.3l9.5-9.5L438.4,192.4z M272,304H160v-16h96V160h16V304z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-albums-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-albums-outline.svg
new file mode 100644
index 00000000..d0d248fd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-albums-outline.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M464,144v288H48V144H464 M480,128H32v320h448V128L480,128z"/>
+ <rect x="72" y="96" width="368" height="16"/>
+ <rect x="104" y="64" width="304" height="16"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-albums.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-albums.svg
new file mode 100644
index 00000000..5b2b384a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-albums.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M480,128H32v320h448V128L480,128z"/>
+ <rect x="72" y="96" width="368" height="16"/>
+ <rect x="104" y="64" width="304" height="16"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-americanfootball-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-americanfootball-outline.svg
new file mode 100644
index 00000000..0f98a8bd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-americanfootball-outline.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M378.605,133.395C305.902,60.691,189.38,47.998,116.85,48c-38.926,0.001-65.191,3.658-65.191,3.658
+ s-29.984,215.227,81.736,326.947C206.099,451.309,322.617,464,395.149,464c38.926,0,65.192-3.658,65.192-3.658
+ S490.326,245.116,378.605,133.395z M65.142,65.208C76.137,64.194,94.374,63,116.856,63H117l-0.068-0.071
+ c27.167,0,53.167,1.754,77.792,5.22l-126.6,126.581c-1.025-7.283-1.91-14.697-2.64-22.246
+ C60.898,125.049,63.398,84.256,65.142,65.208z M143.9,368.102c-23.85-23.852-42.793-54.938-56.304-92.396
+ c-6.973-19.332-12.51-40.373-16.57-62.866L212.838,71.05c10.672,1.929,21.064,4.191,31.141,6.804
+ c52.027,13.492,93.783,35.708,124.139,66.064c23.851,23.85,42.786,54.928,56.297,92.386c6.974,19.333,12.509,40.375,16.567,62.871
+ L299.17,440.986c-10.66-1.93-21.041-4.191-31.104-6.801C216.036,420.696,174.26,398.459,143.9,368.102z M446.861,446.868
+ c-10.994,1.012-29.23,2.275-51.71,2.275c-27.192,0-53.225-1.77-77.876-5.25l126.607-126.607c1.024,7.279,1.908,14.688,2.638,22.233
+ C451.108,386.956,448.606,427.817,446.861,446.868z"/>
+ <polygon points="307.304,317.847 329.929,340.479 301.275,369.131 312.59,380.445 380.471,312.564 369.157,301.25 340.436,329.971
+ 317.811,307.34 346.527,278.623 335.214,267.31 306.499,296.024 283.866,273.386 312.568,244.684 301.255,233.37 272.555,262.07
+ 249.929,239.439 278.626,210.742 267.312,199.429 238.618,228.124 215.987,205.487 244.674,176.8 233.361,165.487 204.676,194.172
+ 182.052,171.542 210.734,142.86 199.421,131.547 131.538,199.429 142.852,210.743 171.545,182.049 194.169,204.679 165.478,233.37
+ 176.791,244.683 205.48,215.994 228.11,238.631 199.432,267.31 210.745,278.623 239.422,249.946 262.048,272.577 233.374,301.251
+ 244.688,312.564 273.359,283.893 295.992,306.531 267.332,335.191 278.646,346.505 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-americanfootball.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-americanfootball.svg
new file mode 100644
index 00000000..635968b3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-americanfootball.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M378.605,133.395C305.902,60.691,189.381,47.998,116.85,48c-38.926,0.001-65.191,3.658-65.191,3.658
+ s-29.984,215.227,81.736,326.947C206.099,451.309,322.617,464,395.148,464c38.927,0,65.193-3.658,65.193-3.658
+ S490.327,245.116,378.605,133.395z M68.124,194.728L194.707,68.146c6.123,0.861,12.164,1.825,18.112,2.899L71.025,212.838
+ C69.955,206.901,68.987,200.862,68.124,194.728z M267.312,335.195l28.688-28.688l-22.627-22.628l-28.688,28.688l-11.313-11.312
+ l28.688-28.688l-22.627-22.627l-28.688,28.688l-11.313-11.312l28.688-28.688l-22.628-22.628l-28.688,28.688l-11.313-11.312
+ l28.689-28.689l-22.628-22.627l-28.688,28.688l-11.314-11.313l67.884-67.883l11.313,11.314l-28.688,28.688l22.628,22.627
+ l28.688-28.688l11.313,11.313l-28.688,28.688l22.628,22.628l28.688-28.688l11.314,11.313l-28.688,28.688l22.627,22.627
+ l28.688-28.688l11.313,11.312l-28.688,28.688l22.628,22.628l28.688-28.688l11.312,11.313l-28.688,28.688l22.627,22.627
+ l28.688-28.688l11.314,11.312l-67.883,67.884l-11.313-11.313l28.688-28.688l-22.628-22.628l-28.688,28.688L267.312,335.195z
+ M317.259,443.891c-6.121-0.863-12.159-1.83-18.104-2.906L440.979,299.16c1.071,5.938,2.038,11.977,2.901,18.111L317.259,443.891z
+ "/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-analytics-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-analytics-outline.svg
new file mode 100644
index 00000000..da7dca0b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-analytics-outline.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,48c28.087,0,55.325,5.497,80.958,16.339c24.767,10.476,47.013,25.476,66.12,44.583s34.107,41.354,44.583,66.12
+ C458.503,200.675,464,227.913,464,256s-5.497,55.325-16.339,80.958c-10.476,24.767-25.476,47.013-44.583,66.12
+ s-41.354,34.107-66.12,44.583C311.325,458.503,284.087,464,256,464s-55.325-5.497-80.958-16.339
+ c-24.767-10.476-47.013-25.476-66.12-44.583s-34.107-41.354-44.583-66.12C53.497,311.325,48,284.087,48,256
+ s5.497-55.325,16.339-80.958c10.476-24.767,25.476-47.013,44.583-66.12s41.354-34.107,66.12-44.583
+ C200.675,53.497,227.913,48,256,48 M256,32C132.288,32,32,132.288,32,256s100.288,224,224,224s224-100.288,224-224
+ S379.712,32,256,32L256,32z"/>
+ <path d="M107.776,320c-25.252,0-41.168-18.448-41.902-19.317c-2.841-3.359-2.401-8.371,0.982-11.192
+ c3.374-2.813,8.401-2.388,11.248,0.948c0.604,0.701,14.606,16.597,35.606,13.186c12.104-1.964,28.08-25.681,38.652-41.376
+ c4.251-6.311,7.922-11.761,11.215-15.856c16.773-20.865,33.899-23.333,45.325-21.726c24.139,3.394,44.358,27.498,53.689,49.882
+ c7.454,17.884,19.042,28.256,32.628,29.208c15.408,1.061,31.539-9.885,43.105-29.336c1.228-2.064,2.562-4.496,3.978-7.07
+ c9.482-17.262,23.814-43.35,51.75-43.35c31.146,0,51.957,34.286,52.828,35.746c2.252,3.774,0.996,8.648-2.806,10.885
+ c-3.8,2.237-8.708,0.988-10.96-2.786c-0.037-0.062-4.493-7.413-11.859-14.568c-6.286-6.107-16.108-13.387-27.203-13.387
+ c-18.438,0-29.121,19.445-37.705,35.07c-1.48,2.696-2.88,5.243-4.245,7.538c-14.718,24.751-36.4,38.635-58.01,37.108
+ c-19.951-1.398-36.389-15.242-46.284-38.98c-10.013-24.02-28.279-38.417-41.149-40.228c-10.6-1.494-20.895,3.861-30.578,15.906
+ c-2.872,3.573-6.539,9.017-10.421,14.779c-13.549,20.114-30.411,45.146-49.37,48.223C113.349,319.784,110.507,320,107.776,320z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-analytics.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-analytics.svg
new file mode 100644
index 00000000..578484b5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-analytics.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,32C141.174,32,46.544,118.404,33.54,229.739C32.534,238.354,32,247.114,32,256c0,1.783,0.026,3.561,0.067,5.333
+ C34.901,382.581,134.071,480,256,480c105.255,0,193.537-72.602,217.542-170.454c1.337-5.451,2.474-10.979,3.404-16.579
+ C478.943,280.939,480,268.594,480,256C480,132.288,379.712,32,256,32z M462.585,280.352c-7.265-7.807-13.064-16.09-15.702-20.429
+ c-0.871-1.47-21.682-35.994-52.828-35.994c-27.937,0-42.269,26.269-51.751,43.65c-1.415,2.593-2.75,5.041-3.978,7.118
+ c-11.566,19.587-27.693,30.608-43.105,29.541c-13.586-0.959-25.174-11.403-32.628-29.41c-9.331-22.54-29.551-46.812-53.689-50.229
+ c-11.428-1.619-28.553,0.866-45.325,21.876c-3.293,4.124-6.964,9.612-11.215,15.967c-10.572,15.804-26.549,39.686-38.653,41.663
+ c-21.02,3.438-35.021-12.596-35.583-13.249l-0.487-0.58l-0.587-0.479c-0.208-0.17-15.041-12.417-29.047-33.334
+ c0-0.155-0.006-0.31-0.006-0.464c0-28.087,5.497-55.325,16.339-80.958c10.476-24.767,25.476-47.013,44.583-66.12
+ s41.354-34.107,66.12-44.583C200.675,53.497,227.913,48,256,48s55.325,5.497,80.958,16.339
+ c24.767,10.476,47.013,25.476,66.12,44.583s34.107,41.354,44.583,66.12C458.503,200.675,464,227.913,464,256
+ C464,264.197,463.518,272.318,462.585,280.352z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-back.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-back.svg
new file mode 100644
index 00000000..ab05ca65
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-back.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="352,128.4 319.7,96 160,256 160,256 160,256 319.7,416 352,383.6 224.7,256 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-down.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-down.svg
new file mode 100644
index 00000000..f956e925
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-down.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="396.6,160 416,180.7 256,352 96,180.7 115.3,160 256,310.5 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-forward.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-forward.svg
new file mode 100644
index 00000000..68fd7eb5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-forward.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="160,128.4 192.3,96 352,256 352,256 352,256 192.3,416 160,383.6 287.3,256 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-left.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-left.svg
new file mode 100644
index 00000000..840ed365
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-left.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="352,115.4 331.3,96 160,256 331.3,416 352,396.7 201.5,256 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-right.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-right.svg
new file mode 100644
index 00000000..489f14c9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-right.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="160,115.4 180.7,96 352,256 180.7,416 160,396.7 310.5,256 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-down.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-down.svg
new file mode 100644
index 00000000..bd1634e2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-down.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M349.7,322.2c-3.1-3.1-8-3-11.3,0L264,388.6V104c0-4.4-3.6-8-8-8c-4.4,0-8,3.6-8,8v284.6l-74.4-66.3
+ c-3.4-2.9-8.1-3.2-11.2-0.1c-3.1,3.1-3.3,8.5-0.1,11.4c0,0,87,79.2,88,80s2.8,2.4,5.7,2.4s4.9-1.6,5.7-2.4s88-80,88-80
+ c1.5-1.5,2.3-3.6,2.3-5.7C352,325.8,351.2,323.8,349.7,322.2z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-left.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-left.svg
new file mode 100644
index 00000000..d1223cd6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-left.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M189.8,349.7c3.1-3.1,3-8,0-11.3L123.4,264H408c4.4,0,8-3.6,8-8c0-4.4-3.6-8-8-8H123.4l66.3-74.4c2.9-3.4,3.2-8.1,0.1-11.2
+ c-3.1-3.1-8.5-3.3-11.4-0.1c0,0-79.2,87-80,88S96,253.1,96,256s1.6,4.9,2.4,5.7s80,88,80,88c1.5,1.5,3.6,2.3,5.7,2.3
+ C186.2,352,188.2,351.2,189.8,349.7z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-right.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-right.svg
new file mode 100644
index 00000000..ae5e0497
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-right.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M322.2,349.7c-3.1-3.1-3-8,0-11.3l66.4-74.4H104c-4.4,0-8-3.6-8-8c0-4.4,3.6-8,8-8h284.6l-66.3-74.4
+ c-2.9-3.4-3.2-8.1-0.1-11.2c3.1-3.1,8.5-3.3,11.4-0.1c0,0,79.2,87,80,88s2.4,2.8,2.4,5.7s-1.6,4.9-2.4,5.7s-80,88-80,88
+ c-1.5,1.5-3.6,2.3-5.7,2.3C325.8,352,323.8,351.2,322.2,349.7z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-up.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-up.svg
new file mode 100644
index 00000000..38ed41e4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-up.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M349.7,189.8c-3.1,3.1-8,3-11.3,0L264,123.4V408c0,4.4-3.6,8-8,8c-4.4,0-8-3.6-8-8V123.4l-74.4,66.3
+ c-3.4,2.9-8.1,3.2-11.2,0.1c-3.1-3.1-3.3-8.5-0.1-11.4c0,0,87-79.2,88-80s2.8-2.4,5.7-2.4s4.9,1.6,5.7,2.4s88,80,88,80
+ c1.5,1.5,2.3,3.6,2.3,5.7C352,186.2,351.2,188.2,349.7,189.8z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-up.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-up.svg
new file mode 100644
index 00000000..9d53f771
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-up.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="396.6,352 416,331.3 256,160 96,331.3 115.3,352 256,201.5 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-at-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-at-outline.svg
new file mode 100644
index 00000000..9d3b02f1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-at-outline.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M364.4,320.9c-5.3,7.5-11.6,14.7-18.8,21.4c-7.1,6.6-15.1,12.5-23.7,17.4c-8.6,4.9-17.9,8.8-27.5,11.5s-19.8,4.1-30.3,4.1
+ c-15.9,0-31.2-2.6-45.5-7.6c-14.2-5-26.8-12.5-37.5-22.4c-10.7-9.8-21.7-25.9-28.2-41c-5.8-13.4-8.1-27.8-8.1-49.5
+ c0-15.6,3.6-33,9.8-47.6c6-14,14.3-26.4,24.9-36.9c10.4-10.3,23-18.6,37.6-24.8c13.1-5.5,28.5-8.2,47.1-8.2c14.9,0,29,2.4,41.9,7
+ c12.8,4.6,23.9,11.2,33.1,19.6c8.7,7.9,14,17.4,19.7,30.2c5,11.2,6.8,20.9,6.8,35.9c0,12.4-2.2,24.1-6.5,34.9
+ c-4.3,10.6-7.5,17-14,25c-6.6,7.9-10.6,12.7-18.1,17.1c-8.6,5-15.3,7.4-21,7.4c-3.6,0-6.3-0.7-7.8-2c-1.5-1.3-2.4-3-2.7-5.4
+ c-0.4-2.8-0.1-6.3,1-10.4c1.1-4.4,2.8-8.6,4.9-13.7L339.4,181h-17.8l-6.2,16.5c-3.8-6.1-9.1-11.5-15.9-15.5
+ c-10.5-6.1-19.5-8.8-31.2-8.8c-13.5,0-26,3.5-37.2,10.4c-11,6.8-20.5,15.6-28.2,26.3c-7.5,10.3-9.3,15.7-12.9,26.4l-0.6,1.7
+ c-4.2,12.4-6.3,24.6-6.3,36.2c0,7.7,1.4,15,4.1,21.8c2.7,6.8,6.4,12.8,11.1,17.8c4.7,5.1,10.4,9.1,16.9,12.1s13.7,4.5,21.3,4.5
+ c8.5,0,16.6-1.4,26.1-4.7c6.3-2.2,11.9-5.8,17.4-11.4c1,3.2,2.7,6,5.3,8.5c5,5,11.7,7.6,19.9,7.6c8.6,0,17.8-3,29-9.3
+ c9.9-5.6,15.7-12,23.3-21.1c8.2-9.8,12.3-18,16.9-29.7c5-12.5,7.5-26,7.5-40.3c0-18-2.4-30.2-8.5-43.6c-6.6-14.3-13.2-25.8-24-35.4
+ c-10.9-9.6-23.9-17.1-38.5-22.3c-14.5-5.1-30.3-7.7-46.7-7.7c-20.1,0-37.2,3-52.2,9.1c-16.5,6.7-30.9,16-43,27.6
+ c-12.2,11.8-22,25.9-29,41.9c-7.3,16.6-11.4,36.7-11.4,55.1c0,25.1,3.1,42.6,10.3,58.4c8,17.3,21,35.4,33.3,46
+ c12.6,10.9,27.1,19.1,43.2,24.2c15.9,5.1,32.3,7.7,48.8,7.7c11.4,0,22.8-1.6,34-4.6c11.2-3.1,22-7.4,32.1-13.1
+ c10.1-5.6,19.5-12.5,28.2-20.6c8.6-8.1,18.6-20.8,22-26.9c1.3-2.4,2.2-4.3,2.9-5.8h-18.5L364.4,320.9z M275.8,294.4
+ c-4.4,5.6-7.7,9.5-11.8,12.2c-4.4,3-7.9,4.9-12.4,5.9c-4.6,1.2-9.3,1.7-13.7,1.7c-5.6,0-10.8-1-15.4-3c-4.7-2-8.7-4.8-12.1-8.4
+ c-3.4-3.6-6.1-7.9-8.1-12.7c-1.9-4.8-2.9-10.2-2.9-16c0-9.5,1.8-19.7,5.3-30.3c0.4-1.2,0.8-2.4,1.1-3.4c2.8-8.6,4.3-11.5,9.5-20
+ c5.7-9.4,14.1-16.6,23-22.5c8.6-5.8,18.2-8.7,28.5-8.7c4.2,0,8.6,0.5,13.2,1.5c3.6,0.8,5.6,1.9,9,3.9c0.6,0.3,1.1,0.6,1.7,1
+ c3.9,2.2,7.4,5.1,10.4,8.7c2.7,3.2,4.8,7.4,6.3,12.3l-20.6,57.8C283.6,282.5,279.9,289.2,275.8,294.4z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-at.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-at.svg
new file mode 100644
index 00000000..917d984c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-at.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M356,320c-9.7,13.3-29.9,28.5-38.1,33.1s-16.9,8.3-26,10.8c-9,2.5-18.6,3.9-28.4,3.9c-14.9,0-29.4-2.4-43-7.2
+ c-13.3-4.7-25.2-11.8-35.1-21c-9.9-9-20.3-24.2-26.5-38.5c-5.3-12.4-7.6-25.8-7.6-46.5c0-14.7,3.4-30.9,9.2-44.7
+ c5.6-13.2,13.5-24.9,23.3-34.6c9.7-9.6,21.6-17.5,35.3-23.3c12.3-5.1,26.7-7.7,44.4-7.7c13.9,0,27.2,2.2,39.4,6.6
+ c11.9,4.3,22.3,10.4,30.9,18.3c8,7.3,12.9,16.1,18.2,28.1c4.6,10.2,6.3,19.2,6.3,33.3c0,11.5-2,22.4-6,32.4c-4,9.8-7,15.8-13,23.3
+ c-6.3,7.6-9.8,11.8-16.5,15.6c-7.8,4.6-13.7,6.7-18.5,6.7c-3.8,0-5-0.9-5.1-1c-0.6-0.5-1.1-1.2-1.4-2.8c-0.3-2.2,0-5.2,0.9-8.6
+ c1-3.9,2.4-7.7,4.6-12.9L342.3,179h-25.6l-4.5,12c-3.5-4.1-7.7-7.5-12.4-10.2c-11.1-6.4-20.4-9-32.3-9c-13.8,0-26.7,3.6-38.2,10.7
+ c-11.2,6.9-20.8,15.8-28.5,26.5c-7.6,10.5-9.5,16.1-13,26.5l-0.6,1.8c-4.2,12.4-6.3,24.7-6.3,36.4c0,7.9,1.5,15.5,4.3,22.6
+ c2.8,7.2,6.7,13.4,11.6,18.5c4.8,5.2,10.7,9.4,17.7,12.6c6.8,3.1,14.3,4.8,22.4,4.8c8.9,0,17.1-1.5,26.7-4.8
+ c5.3-1.8,9.9-4.5,14.4-8.3c1,1.7,2.2,3.1,3.7,4.5c5.6,5.6,13.1,8.5,22.1,8.5c8.9,0,18.6-3,30.2-9.5c10.3-5.8,16.3-12.5,23.7-21.4
+ c8.4-10,12.5-18.6,17-29.9c5.1-12.5,7.6-26.2,7.6-40.6c0-18.1-2.4-30.4-8.7-44c-6.6-14.4-13.3-25.9-24.3-35.6
+ c-10.9-9.7-23.9-17.2-38.7-22.4c-14.6-5.1-30.3-7.7-46.7-7.7c-20,0-37.2,3-52.2,9.1c-16.3,6.6-30.8,15.9-43.1,27.6
+ c-12.3,11.8-22.1,26-29.1,42c-7.3,16.5-11.4,36.5-11.4,55.1c0,25,3.1,42.4,10.4,58.4c8.1,17.5,21.2,35.5,33.4,45.9
+ c12.7,11.1,27.3,19.2,43.4,24.3c15.9,5.1,32.3,7.7,48.6,7.7c11.2,0,22.7-1.6,34.1-4.6c11.6-3.2,22.4-7.6,32.1-13.1
+ c9.9-5.5,19.5-12.4,28.2-20.6c8.8-8.2,19.4-20.9,22.9-27.1c1.2-2.3,2.2-4.2,2.8-5.6H356z M271.9,290.6c-4.4,5.5-7.2,8.9-10.6,11.2
+ c-3.8,2.6-6.8,4.2-10.7,5.2h-0.1c-3.9,1-8.1,1.5-12.4,1.5c-5,0-9.4-0.9-13.4-2.7c-4.1-1.7-7.5-4.1-10.5-7.3
+ c-2.9-3.1-5.4-6.8-7.1-11.1c-1.7-4.3-2.5-9-2.5-14.1c0-8.7,1.7-18.3,5-28.2c0.4-1.2,0.8-2.4,1.1-3.3c2.6-8.1,4-10.6,8.9-18.6
+ c4.5-7.4,11.5-14.2,21.2-20.7c7.7-5.1,16.2-7.8,25.6-7.8c3.8,0,7.8,0.5,12,1.4c3,0.7,4.6,1.6,7.6,3.3l0.2,0.1
+ c0.4,0.2,0.8,0.4,1.3,0.7l0.3,0.2c3.4,1.9,6.4,4.5,9,7.6c2,2.4,3.7,5.5,5,9.4L282,272.2C279,279.6,275.6,285.8,271.9,290.6z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-barcode-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-barcode-outline.svg
new file mode 100644
index 00000000..fcdfd3f5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-barcode-outline.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="48,384 128,384 128,368 64,368 64,144 128,144 128,128 48,128 "/>
+ <polygon points="384,128 384,144 448,144 448,368 384,368 384,384 464,384 464,128 "/>
+ <rect x="112" y="192" width="16" height="128"/>
+ <rect x="384" y="192" width="16" height="128"/>
+ <rect x="320" y="160" width="16" height="192"/>
+ <rect x="176" y="160" width="16" height="192"/>
+ <rect x="247" y="176" width="16" height="160"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-barcode.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-barcode.svg
new file mode 100644
index 00000000..16d59dff
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-barcode.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M48,128v256h416V128H48z M128,320h-16V192h16V320z M192,352h-16V160h16V352z M263,336h-16V176h16V336z M336,352h-16V160h16
+ V352z M400,320h-16V192h16V320z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-baseball-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-baseball-outline.svg
new file mode 100644
index 00000000..a992fea7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-baseball-outline.svg
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M462.686,279.369c0.132-1.182,0.257-2.365,0.369-3.554c0.004-0.038,0.007-0.078,0.011-0.117
+ C463.675,269.213,464,262.645,464,256c0-114.863-93.13-208-208-208c-7.951,0-15.792,0.462-23.512,1.331
+ c-0.089,0.01-0.18,0.018-0.27,0.028c0,0.001,0,0.002,0,0.003C135.207,60.409,58.442,138.199,48.989,235.687
+ c-0.001,0-0.003,0-0.004,0c-0.072,0.748-0.131,1.497-0.195,2.246c-0.136,1.576-0.253,3.157-0.353,4.743
+ c-0.026,0.418-0.056,0.835-0.08,1.254c-0.064,1.121-0.116,2.245-0.163,3.371c-0.011,0.281-0.021,0.562-0.032,0.843
+ C48.065,250.751,48,253.368,48,256c0,114.863,93.137,208,208,208c2.627,0,5.239-0.065,7.843-0.162
+ c0.293-0.011,0.586-0.021,0.878-0.033c1.11-0.046,2.219-0.098,3.324-0.16c0.454-0.025,0.906-0.058,1.359-0.086
+ c1.604-0.103,3.201-0.222,4.795-0.36c0.704-0.061,1.41-0.115,2.113-0.184c0-0.001,0-0.003,0-0.004
+ c97.494-9.452,175.279-86.216,186.326-183.229c0.001,0,0.002,0,0.004,0C462.658,279.645,462.67,279.507,462.686,279.369z
+ M446.665,256c0,2.568-0.066,5.122-0.167,7.666c-10.334-0.468-20.552-1.69-30.614-3.664l6.11-19.056l-15.232-4.884l-6.488,20.235
+ c-7.591-2.112-15.08-4.651-22.442-7.638c-4.976-2.018-9.851-4.223-14.625-6.604l11.518-17.003l-13.247-8.974l-12.359,18.246
+ c-12.241-7.35-23.703-15.977-34.305-25.812l14.73-14.73l-11.313-11.313l-14.73,14.73c-9.555-10.297-17.964-21.408-25.175-33.254
+ l18.487-12.522l-8.972-13.246l-17.324,11.735c-2.597-5.131-4.998-10.375-7.174-15.74c-2.843-7.009-5.276-14.134-7.327-21.352
+ l20.812-6.673l-4.885-15.234l-19.711,6.32c-2.104-10.423-3.41-21.014-3.896-31.729c2.544-0.101,5.097-0.167,7.665-0.167
+ C361.132,65.335,446.665,150.869,446.665,256z M65.337,256c0-1.317,0.023-2.629,0.05-3.939c9.064,0.559,18.039,1.687,26.891,3.409
+ l-7.115,22.191l15.235,4.885l7.5-23.391c7.692,2.128,15.28,4.696,22.738,7.721c5.175,2.099,10.239,4.404,15.197,6.896l-13.405,19.79
+ l13.246,8.973l14.219-20.992c12.038,7.279,23.32,15.793,33.765,25.483l-16.853,16.853l11.313,11.314l16.854-16.854
+ c9.968,10.744,18.7,22.369,26.114,34.796l-20.753,14.058l8.972,13.246l19.473-13.19c2.283,4.611,4.4,9.317,6.347,14.116
+ c3.161,7.795,5.834,15.729,8.016,23.778l-22.832,7.32l4.884,15.233l21.531-6.903c1.608,8.506,2.679,17.122,3.215,25.822
+ c-1.311,0.026-2.622,0.05-3.939,0.05C150.87,446.664,65.336,361.13,65.337,256z M275.893,445.629
+ c-0.621-9.974-1.911-19.911-3.859-29.746l24.1-7.727l-4.884-15.232l-22.896,7.341c-3.946-14.415-9.356-28.51-16.234-42.054
+ l20.172-13.664l-8.973-13.246l-18.988,12.862c-7.888-13.094-17.233-25.552-28.04-37.145l17.081-17.081l-11.313-11.313
+ l-17.082,17.081c-11.288-10.521-23.393-19.66-36.108-27.414l12.696-18.743l-13.246-8.972l-13.446,19.85
+ c-13.548-6.974-27.659-12.467-42.094-16.494l7.158-22.325l-15.235-4.885l-7.52,23.452c-10.181-2.068-20.477-3.424-30.81-4.067
+ c9.168-88.037,78.492-158.454,166.023-169.311c0.574,11.858,2.095,23.676,4.543,35.339l-25.935,8.316l4.885,15.234l24.903-7.985
+ c4.045,14.144,9.504,27.967,16.386,41.246l-22.322,15.121l8.973,13.246l21.236-14.385c7.688,12.528,16.735,24.455,27.116,35.59
+ l-19.204,19.204l11.313,11.314l19.204-19.205c11.447,10.669,23.735,19.921,36.647,27.745l-14.555,21.486l13.248,8.974l15.328-22.628
+ c13.28,6.789,27.1,12.155,41.229,16.118l-8.168,25.477l15.232,4.884l8.525-26.59c11.301,2.312,22.744,3.754,34.224,4.31
+ C434.347,367.137,363.93,436.46,275.893,445.629z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-baseball.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-baseball.svg
new file mode 100644
index 00000000..49a50bb2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-baseball.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,48c-8.044,0-15.975,0.473-23.782,1.361l0,0l0,0C128.555,61.166,48,149.18,48,256c0,114.863,93.137,208,208,208
+ c106.827,0,194.833-80.553,206.638-184.218l0,0l0,0C463.527,271.977,464,264.045,464,256C464,141.137,370.87,48,256,48z
+ M259.939,446.614c-0.539-8.693-1.605-17.305-3.209-25.804l-21.511,6.896l-4.885-15.234l22.812-7.314
+ c-2.183-8.056-4.856-15.994-8.02-23.794c-1.943-4.794-4.061-9.497-6.341-14.105l-19.464,13.186l-8.972-13.247l20.744-14.054
+ c-7.416-12.429-16.149-24.057-26.119-34.803l-16.852,16.853l-11.313-11.313l16.852-16.852c-10.442-9.689-21.721-18.202-33.757-25.48
+ l-14.216,20.988l-13.247-8.973l13.403-19.788c-4.96-2.491-10.027-4.799-15.206-6.9c-7.455-3.021-15.038-5.59-22.725-7.717
+ l-7.5,23.392l-15.236-4.885l7.115-22.192c-8.856-1.723-17.835-2.853-26.904-3.412c0.109-5.373,0.438-10.695,0.984-15.953
+ c10.339,0.647,20.639,1.998,30.827,4.068l7.518-23.454l15.237,4.886l-7.159,22.328c14.433,4.027,28.542,9.521,42.09,16.494
+ l13.449-19.854l13.248,8.973l-12.7,18.748c12.712,7.754,24.815,16.892,36.1,27.411l17.082-17.082l11.314,11.314l-17.083,17.082
+ c10.809,11.595,20.156,24.055,28.044,37.151l18.999-12.869l8.973,13.248l-20.183,13.67c6.878,13.546,12.289,27.642,16.232,42.058
+ l22.919-7.349l4.885,15.236l-24.122,7.734c1.947,9.828,3.231,19.761,3.854,29.727C270.637,446.177,265.314,446.504,259.939,446.614z
+ M410.961,275.293l-8.529,26.604l-15.236-4.885l8.174-25.493c-14.124-3.964-27.94-9.329-41.218-16.116l-15.335,22.641l-13.248-8.973
+ l14.564-21.499c-12.912-7.826-25.199-17.077-36.644-27.746l-19.205,19.204l-11.312-11.314l19.202-19.203
+ c-10.381-11.135-19.427-23.062-27.114-35.59l-21.248,14.393l-8.974-13.248l22.335-15.127c-6.881-13.278-12.339-27.099-16.384-41.241
+ l-24.918,7.99l-4.885-15.237l25.951-8.321c-2.447-11.663-3.943-23.482-4.522-35.337c5.189-0.644,10.446-1.068,15.754-1.284
+ c0.507,10.743,1.859,21.334,3.972,31.807l19.744-6.359l4.907,15.212l-20.789,6.658c2.051,7.218,4.491,14.338,7.333,21.348
+ c2.176,5.363,4.578,10.603,7.174,15.731l17.315-11.729l8.973,13.246l-18.477,12.516c7.209,11.846,15.619,22.957,25.174,33.254
+ l14.729-14.731l11.314,11.313l-14.732,14.731c10.602,9.836,22.062,18.463,34.302,25.813l12.352-18.235l13.248,8.973l-11.512,16.994
+ c4.777,2.383,9.656,4.589,14.635,6.608c7.354,2.982,14.837,5.521,22.421,7.631l6.484-20.22l15.233,4.885l-6.104,19.043
+ c10.116,1.984,20.286,3.311,30.626,3.824c-0.215,5.312-0.643,10.572-1.285,15.768C433.72,279.028,422.269,277.607,410.961,275.293z"
+ />
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-basketball-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-basketball-outline.svg
new file mode 100644
index 00000000..9c171547
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-basketball-outline.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,48C141.137,48,48,141.136,48,256s93.137,208,208,208c114.871,0,208-93.138,208-208S370.871,48,256,48z M446.664,256
+ c0,0.048-0.002,0.097-0.002,0.145c-22.315-1.721-43.989-6.972-64.62-15.699c-17.888-7.566-34.453-17.505-49.479-29.634
+ c20.69-29.501,38.442-61.212,52.824-94.715C423.045,150.95,446.664,200.766,446.664,256z M372.606,105.261
+ c-0.28,0.676-0.55,1.354-0.835,2.028c-13.908,32.883-31.062,63.956-51.286,92.987c-1.538-1.449-3.063-2.914-4.563-4.413
+ c-19.107-19.107-34.107-41.354-44.583-66.12c-8.697-20.563-13.933-42.163-15.671-64.401c0.111,0,0.221-0.004,0.332-0.004
+ C299.884,65.337,340.347,80.249,372.606,105.261z M239.675,66.044c4.431,58.126,31.044,110.041,71.391,147.312
+ c-9.495,12.749-19.609,25.076-30.319,36.965c-47.554-50.032-104.815-90.746-168.767-119.132
+ C143.616,94.733,188.833,70.375,239.675,66.044z M280.687,273.84c36.229,40.67,65.48,86.438,87.185,136.453
+ c-25.4,18.467-55.51,30.829-88.162,34.898c-2.272-47.816-19.521-91.707-47.179-127.071
+ C249.483,304.357,265.568,289.567,280.687,273.84z M262.039,270.039c-12.704,12.703-25.977,24.662-39.778,35.87
+ c-38.737-42.885-93.831-70.706-155.45-73.635c4.07-32.646,16.432-62.75,34.896-88.146c59.195,25.688,112.445,61.947,158.332,107.833
+ c3.323,3.323,6.59,6.689,9.812,10.089C267.277,264.736,264.677,267.401,262.039,270.039z M65.508,248.23
+ c25.238,1.145,49.436,6.797,71.45,16.109c24.767,10.476,47.013,25.476,66.12,44.583c2.254,2.254,4.445,4.555,6.584,6.895
+ c-31.414,23.915-65.427,44.049-101.708,60.182C81.322,343.205,65.336,301.437,65.336,256
+ C65.336,253.396,65.404,250.809,65.508,248.23z M119.067,388.526c35.988-16.434,69.81-36.787,100.914-60.521
+ c11.249,14.372,20.522,30.115,27.68,47.037c9.614,22.729,15.013,46.724,16.114,71.45c-2.58,0.104-5.17,0.172-7.775,0.172
+ C202.317,446.664,153.751,424.353,119.067,388.526z M380.81,400.021c-22.489-50.671-52.72-97.14-89.191-137.909
+ c11.101-12.269,21.634-25.061,31.556-38.336c34.171,27.342,76.521,44.885,122.801,48.363
+ C441.686,323.058,417.311,368.347,380.81,400.021z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-basketball.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-basketball.svg
new file mode 100644
index 00000000..9d749565
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-basketball.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,48C141.137,48,48,141.136,48,256s93.137,208,208,208c114.871,0,208-93.138,208-208S370.871,48,256,48z
+ M380.797,400.032c-4.158,3.608-8.48,7.029-12.942,10.272c-21.704-50.015-50.938-95.795-87.168-136.465
+ c-15.118,15.728-31.203,30.518-48.156,44.28c27.659,35.364,44.916,79.254,47.189,127.069c-5.252,0.655-10.571,1.086-15.944,1.303
+ c-1.103-24.727-6.5-48.721-16.114-71.45c-7.158-16.922-16.431-32.665-27.68-47.037c-31.104,23.733-64.923,44.093-100.91,60.526
+ c-3.883-4.011-7.592-8.191-11.115-12.529c36.28-16.134,70.291-36.271,101.705-60.186c-2.139-2.34-4.33-4.641-6.584-6.895
+ c-19.107-19.107-41.354-34.107-66.12-44.583c-22.015-9.312-46.212-14.964-71.45-16.108c0.217-5.379,0.648-10.703,1.303-15.959
+ c61.62,2.929,116.713,30.753,155.45,73.638c13.802-11.208,27.075-23.167,39.778-35.87c2.638-2.638,5.238-5.303,7.812-7.988
+ c-3.223-3.4-6.489-6.767-9.812-10.09c-45.887-45.886-99.137-82.145-158.332-107.832c3.243-4.461,6.665-8.782,10.272-12.939
+ c63.951,28.387,121.212,69.101,168.767,119.132c10.711-11.889,20.824-24.216,30.319-36.965
+ c-40.347-37.271-66.956-89.188-71.388-147.312c5.273-0.449,10.604-0.692,15.99-0.702c1.738,22.238,6.974,43.838,15.671,64.401
+ c10.476,24.767,25.476,47.013,44.583,66.12c1.5,1.5,3.025,2.965,4.562,4.413c20.226-29.031,37.379-60.104,51.287-92.987
+ c0.285-0.674,0.555-1.353,0.835-2.028c4.419,3.426,8.681,7.042,12.779,10.835c-14.383,33.502-32.132,65.215-52.822,94.716
+ c15.026,12.13,31.591,22.068,49.479,29.635c20.631,8.727,42.305,13.978,64.62,15.698c-0.004,5.387-0.243,10.717-0.688,15.991
+ c-46.278-3.479-88.631-21.018-122.801-48.359c-9.922,13.275-20.455,26.067-31.556,38.336
+ C328.091,302.883,358.307,349.36,380.797,400.032z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bell-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bell-outline.svg
new file mode 100644
index 00000000..bf8fae90
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bell-outline.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M381.7,225.9c0-97.6-52.5-130.8-101.6-138.2c0-0.5,0.1-1,0.1-1.6c0-12.3-10.9-22.1-24.2-22.1c-13.3,0-23.8,9.8-23.8,22.1
+ c0,0.6,0,1.1,0.1,1.6c-49.2,7.5-102,40.8-102,138.4c0,113.8-28.3,126-66.3,158h384C410.2,352,381.7,339.7,381.7,225.9z M107.2,368
+ c8.6-9,16.4-18.4,22.7-31.8c12-25.3,17.4-59.2,17.4-110.2c0-46.4,12.5-80.4,37.1-101.2c22.9-19.3,51.7-23.3,71.8-23.3
+ c20.1,0,48.9,4,71.6,23.3c24.5,20.7,37,54.5,37,100.9c0,83.8,14.9,117.3,40.3,142.3H107.2z"/>
+ <path d="M256.2,448c26.8,0,48.8-19.9,51.7-43H204.5C207.3,428.1,229.4,448,256.2,448z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bell.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bell.svg
new file mode 100644
index 00000000..f9e21a5a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bell.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M381.7,225.9c0-97.6-52.5-130.8-101.6-138.2c0-0.5,0.1-1,0.1-1.6c0-12.3-10.9-22.1-24.2-22.1c-13.3,0-23.8,9.8-23.8,22.1
+ c0,0.6,0,1.1,0.1,1.6c-49.2,7.5-102,40.8-102,138.4c0,113.8-28.3,126-66.3,158h384C410.2,352,381.7,339.7,381.7,225.9z"/>
+ <path d="M256.2,448c26.8,0,48.8-19.9,51.7-43H204.5C207.3,428.1,229.4,448,256.2,448z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-body-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-body-outline.svg
new file mode 100644
index 00000000..809da99c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-body-outline.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,47.959c17.645,0,32,14.351,32,31.991c0,17.64-14.355,31.99-32,31.99s-32-14.351-32-31.99
+ C224,62.31,238.355,47.959,256,47.959 M256,31.964c-26.51,0-48,21.483-48,47.986c0,26.502,21.49,47.985,48,47.985
+ s48-21.483,48-47.985C304,53.447,282.51,31.964,256,31.964L256,31.964z"/>
+ <path d="M424,144H88c-13.255,0-24,10.747-24,24s10.745,24,24,24h100.451c5.549,0,13.197,4.295,17.216,14.708
+ c4.651,12.055,2.37,33.33-0.539,51.444l-3.923,21.26c-0.019,0.104-0.205,0.1-0.205,0.203l-32.229,172.238
+ c-2.303,13.051,6.487,25.494,19.54,27.797c1.408,0.248,2.844,0.367,4.218,0.367c11.357,0,20.917-8.19,22.97-19.836L236,340.242
+ v0.166c0,0,7.25-31.408,19.452-31.408h1.096C269,309,274,340.408,274,340.408v-0.082l21.483,119.895
+ c2.052,11.642,12.331,19.815,23.763,19.815c1.387,0,2.855-0.121,4.268-0.368c13.053-2.303,21.821-14.76,19.519-27.811
+ l-32.349-172.251c-0.002-0.008,0.011-0.02,0.009-0.027c-0.019-0.104-0.032-0.217-0.052-0.322l-3.771-21.411
+ c-2.909-18.119-5.188-39.083-0.538-51.137C310.351,196.295,318.5,192,323.549,192H424c13.255,0,24-10.747,24-24
+ S437.255,144,424,144z M88,176.113c-4.411,0-8-3.646-8-8.057c0-4.411,3.589-8.057,8-8.057h336c4.411,0,8,3.59,8,8s-3.589,8-8,8
+ H322.5c-15.538,0-27.438,14.738-30.982,23.922c-4.846,12.557-5.004,31.942-0.388,60.688l-0.009,0.104l0.006,0.11l3.367,19.138
+ l0.562,3.241l32.252,171.628c0.5,2.834-0.62,4.961-1.332,5.977c-0.713,1.017-2.335,2.799-5.179,3.301
+ c-0.476,0.083-0.955,0.126-1.427,0.126c-3.893,0-7.207-2.639-7.883-6.472L290.255,338h-0.015c-0.271-2-1.828-10.05-5.022-18.771
+ c-2.278-6.217-4.844-11.034-7.844-15.005C270.283,294.836,262.135,293,256.548,293h-1.096c-5.47,0-13.503,1.731-20.71,10.938
+ c-3.05,3.896-5.729,8.671-8.19,14.802c-3.628,9.037-5.505,17.654-5.708,18.613l-0.11,0.369l-20.728,119.9
+ c-0.693,3.886-3.75,6.596-7.441,6.596c-0.459,0-0.932-0.043-1.403-0.127c-2.84-0.5-4.455-2.275-5.165-3.288
+ c-0.709-1.013-1.824-3.136-1.323-5.975l32.257-171.562l0.004-0.019l0.174-0.927l3.775-21.33l0.022-0.125l0.021-0.126
+ c4.629-28.829,4.527-48.3-0.332-60.891c-3.543-9.181-13.576-23.737-31.76-23.737"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-body.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-body.svg
new file mode 100644
index 00000000..c47f4c67
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-body.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <circle cx="256" cy="79.838" r="48"/>
+ <path d="M424,144H88c-13.255,0-24,10.745-24,24s10.745,24,24,24h98.451c5.579,1,13.197,3.837,17.216,14.252
+ c4.651,12.056,2.37,33.606-0.539,51.727l-3.775,21.395c-0.019,0.104-0.039,0.207-0.058,0.311c-0.002,0.008-0.002,0.012-0.004,0.02
+ l-30.375,172.268c-2.303,13.053,6.414,25.5,19.467,27.803c13.055,2.301,25.333-6.416,27.634-19.471L237,340.348v0.167
+ c0,0,6.25-32.515,18.452-32.515h1.096C269,308,275,340.515,275,340.515v-0.083l20.983,119.913
+ c2.301,13.055,14.663,21.749,27.718,19.448c13.053-2.303,21.728-14.762,19.425-27.814L312.73,279.703
+ c-0.002-0.008-0.013-0.02-0.015-0.027c-0.019-0.104-0.044-0.217-0.063-0.322l-3.777-21.414
+ c-2.909-18.121-5.191-39.631-0.541-51.688C312.354,195.838,319.97,193,325.549,192H424c13.255,0,24-10.745,24-24
+ S437.255,144,424,144z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bolt-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bolt-outline.svg
new file mode 100644
index 00000000..52bd7b43
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bolt-outline.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M273.9,132l-16.5,89.1L254,240h19.2h64.8l-99.8,140l16.5-89.1L258,272h-19.2h-64.7L273.9,132 M302.7,64L143,288h95.8
+ l-29.5,160L369,224h-95.8L302.7,64L302.7,64z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bolt.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bolt.svg
new file mode 100644
index 00000000..51a27ee9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bolt.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M302.7,64L143,288h95.8l-29.5,160L369,224h-95.8L302.7,64L302.7,64z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-book-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-book-outline.svg
new file mode 100644
index 00000000..d2857099
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-book-outline.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M347.621,64c-40.941,0-79.121,14-91.578,44.495C242.5,78,205.408,64,164.466,64C109.265,64,64,89.98,64,143v1v8.995V417v9
+ h6.215h10.958h4.967c12.86-26.334,44.238-42,78.325-42c40.224,0,73.877,27.528,81.617,64h19.714c7.739-36.472,41.495-64,81.722-64
+ c34.085,0,61.149,11.666,78.429,42h4.967h10.959H448v-17V148v-4v-1C448,89.98,402.823,64,347.621,64z M248,410.926
+ C230,385.055,199.27,368,164.5,368c-34.769,0-64.5,10.055-83.5,35.926l-1,0.537V142l0,0v-1c3-41.825,40.089-61,84.293-61
+ c45.162,0,82.145,18.708,83.363,61.808c-0.017,0.729,0.016,1.459,0.016,2.192L248,157.103V410.926z M432,148v255.926
+ C414,378.055,382.269,368,347.5,368c-34.77,0-65.5,17.055-83.5,42.926V145v-1c0-44.112,37.659-64,83.587-64
+ C391.79,80,429,91.175,432,133v1V148z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-book.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-book.svg
new file mode 100644
index 00000000..b8c6da3f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-book.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M164.466,64C109.266,64,64,89.98,64,143v1v8.994V417v9h6.215h10.959h4.967c12.86-26.334,44.238-42,78.325-42
+ c40.224,0,73.877,27.528,81.616,64H248V95.346C230.76,73.951,198.981,64,164.466,64z"/>
+ <path d="M347.621,64c-34.332,0-66.713,9.851-83.621,31.011V448h1.797c7.739-36.472,41.495-64,81.722-64
+ c34.085,0,61.149,11.666,78.429,42h4.967h10.959H448v-17V148v-4v-1C448,89.98,402.823,64,347.621,64z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bookmarks-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bookmarks-outline.svg
new file mode 100644
index 00000000..ee4fba02
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bookmarks-outline.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M432,64H281.6c-10.3,0-19.3,4.6-25.6,11.7l0,0l0,0c-6.2-7.2-15.3-11.7-25.6-11.7H80c-18.8,0-33,13.3-33,32v286.1
+ c0,18.8,14.2,33.9,33,33.9c0,0,129.5,0,143.3,0c13.8,0,24.7,4.2,24.7,19.4c0,9.1,0,12.6,0,12.6h8h8c0,0,0-3.4,0-12.6
+ c0-15.3,10.9-19.4,24.7-19.4s143.3,0,143.3,0c18.8,0,33-15.1,33-33.9V96C465,77.3,450.8,64,432,64z M248,411.1
+ c-4.7-7.8-13.5-11.1-23.8-11.1H80c-9.4,0-16-8.5-16-17.9V96c0-9.4,6.6-16,16-16c0,0,130.6,0,143.3,0c12.8,0,24.7,12.8,24.7,22.2
+ V411.1z M320,80c18.8,0,43,0,64,0v100.4l-22.9-14.5l-9.1-6.4l-9.1,6.4L320,180.4V80z M448,382.1c0,9.4-6.6,17.9-16,17.9H287.8
+ c-10.3,0-19.1,2.3-23.8,11.1V102.2c0-9.4,11.9-22.2,24.7-22.2c2.2,0,7.7,0,15.3,0v131l48-32l48,32V80c18.6,0,32,0,32,0
+ c9.4,0,16,6.7,16,16V382.1z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bookmarks.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bookmarks.svg
new file mode 100644
index 00000000..bb680400
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bookmarks.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M342.9,165.4l9.1-6.4l9.1,6.4l22.9,14.5V64c-20.7,0-44.5,0-64,0v115.9L342.9,165.4z"/>
+ <path d="M432,64c0,0-13.3,0-32,0v146.5l-48-32l-48,32V64c-12.1,0-20.6,0-22.4,0c-8.1,0-17.6,7.2-17.6,15s0,329,0,329l-8,5.5l-8-5.5
+ c0,0,0-322,0-329s-9.2-15-17.6-15S80,64,80,64c-18.8,0-33,13.3-33,32v286.1c0,18.8,14.2,33.9,33,33.9c0,0,129.5,0,143.3,0
+ c13.8,0,24.7,4.2,24.7,19.4c0,9.1,0,12.6,0,12.6h8h8c0,0,0-3.4,0-12.6c0-15.3,10.9-19.4,24.7-19.4s143.3,0,143.3,0
+ c18.8,0,33-15.1,33-33.9V96C465,77.3,450.8,64,432,64z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-box-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-box-outline.svg
new file mode 100644
index 00000000..1045d489
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-box-outline.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M287.8,240c8.8,0,16.1,7.2,16.1,16s-7,16-15.9,16h-64c-8.8,0-16-7.2-16-16s7.2-16,16-16h63 M288,224h-64
+ c-17.6,0-32,14.4-32,32s14.4,32,32,32h64c17.6,0,32-14.4,32-32S305.6,224,288,224L288,224z"/>
+ <g>
+ <path d="M416,112H96v80h16v208h288V192h16V112z M384,384H128V192h256V384z M400,176H112v-48h288V176z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-box.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-box.svg
new file mode 100644
index 00000000..7ed0eb52
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-box.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M112,400h288V208H112V400z M224,240h64c8.8,0,16,7.2,16,16s-7.2,16-16,16h-64c-8.8,0-16-7.2-16-16S215.2,240,224,240z"/>
+ <polygon points="96,112 96,192 112,192 400,192 416,192 416,112 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-briefcase-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-briefcase-outline.svg
new file mode 100644
index 00000000..b9ccbd2b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-briefcase-outline.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M416,128v-16h-32v16h-48V98.1V96c-0.5-18.2-13.6-32-32.2-32h-99.1C186.1,64,176,77.7,176,96v2.1V128h-48v-16H96v16H48v320
+ h416V128H416z M192,127.5V98.1c0-10.2,2.9-18.1,13.7-18.1h97.1c10.4,0,17.2,7.7,17.2,18.1v29.4v0.5H192V127.5z M448,432H64V208h384
+ V432z M448,192H64v-48h32v16h32v-16h256v16h32v-16h32V192z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-briefcase.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-briefcase.svg
new file mode 100644
index 00000000..90b9cf20
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-briefcase.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <rect x="96" y="112" width="32" height="16"/>
+ <rect x="48" y="208" width="416" height="240"/>
+ <rect x="384" y="112" width="32" height="16"/>
+ <path d="M416,128v32h-32v-32h-48V98.1V96c-0.5-18.2-13.6-32-32.2-32h-99.1C186.1,64,176,77.7,176,96v2.1V128h-48v32H96v-32H48v64
+ h416v-64H416z M320,127.5v0.5H192v-0.5V98.1c0-10.2,2.9-18.1,13.7-18.1h97.1c10.4,0,17.2,7.7,17.2,18.1V127.5z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-browsers-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-browsers-outline.svg
new file mode 100644
index 00000000..3c29db9a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-browsers-outline.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M64,144v304h303.9V144H64z M351.9,432H80V160h271.9V432z"/>
+ <g>
+ <polygon points="448,64 144,64 144,128 160,128 160,80 432,80 432,352 384,352 384,368 448,368 "/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-browsers.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-browsers.svg
new file mode 100644
index 00000000..36ab92e6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-browsers.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M64,144v304h303.9V144H64z"/>
+ <polygon points="144,64 144,128 384,128 384,368 448,368 448,64 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calculator-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calculator-outline.svg
new file mode 100644
index 00000000..9006a345
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calculator-outline.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M144,160h224V96H144V160z M160,112h192v32H160V112z"/>
+ <path d="M368,64H144c-17.7,0-32,14.3-32,32v320c0,17.7,14.3,32,32,32h224c17.7,0,32-14.3,32-32V96C400,78.3,385.7,64,368,64z
+ M384,416c0,8.8-7.2,16-16,16H144c-8.8,0-16-7.2-16-16V96c0-8.8,7.2-16,16-16h224c8.8,0,16,7.2,16,16V416z"/>
+ <polygon points="160,240 160,208 160,192 144,192 144,256 208,256 208,240 192,240 "/>
+ <polygon points="160,320 160,288 160,272 144,272 144,336 208,336 208,320 192,320 "/>
+ <polygon points="160,400 160,368 160,352 144,352 144,416 208,416 208,400 192,400 "/>
+ <polygon points="240,240 240,208 240,192 224,192 224,256 288,256 288,240 272,240 "/>
+ <polygon points="320,240 320,208 320,192 304,192 304,256 368,256 368,240 352,240 "/>
+ <polygon points="240,320 240,288 240,272 224,272 224,336 288,336 288,320 272,320 "/>
+ <polygon points="240,400 240,368 240,352 224,352 224,416 288,416 288,400 272,400 "/>
+ <polygon points="320,400 320,368 320,272 304,272 304,416 368,416 368,400 352,400 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calculator.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calculator.svg
new file mode 100644
index 00000000..64b08607
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calculator.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M368,64H144c-17.7,0-32,14.3-32,32v320c0,17.7,14.3,32,32,32h224c17.7,0,32-14.3,32-32V96C400,78.3,385.7,64,368,64z
+ M360,280v128h-48V280H360z M360,200v48h-48v-48H360z M280,360v48h-48v-48H280z M280,280v48h-48v-48H280z M280,200v48h-48v-48H280z
+ M200,360v48h-48v-48H200z M200,280v48h-48v-48H200z M200,200v48h-48v-48H200z M152,152v-48h208v48H152z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calendar-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calendar-outline.svg
new file mode 100644
index 00000000..cd81cbd1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calendar-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:none;}
+]]>
+</style>
+<polyline class="st0" points="80,112 80,176 432,176 432,112 "/>
+<path d="M352,96V64h-16v32H176V64h-16v32H64v352h384V96H352z M432,432H80V192h352V432z M432,176H80v-64h80v32h16v-32h160v32h16v-32
+ h80V176z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calendar.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calendar.svg
new file mode 100644
index 00000000..8fd1de32
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calendar.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <rect x="64" y="192" width="384" height="256"/>
+ <polygon points="448,96 352,96 352,144 336,144 336,96 176,96 176,144 160,144 160,96 64,96 64,176 448,176 "/>
+ <rect x="160" y="64" width="16" height="32"/>
+ <rect x="336" y="64" width="16" height="32"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-camera-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-camera-outline.svg
new file mode 100644
index 00000000..3feed556
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-camera-outline.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M417.5,160h-61.7c-32.1-36-42.2-48-54.5-48h-88.5c-12.3,0-22.2,12-54.5,48H145v-16h-34v16H97.5C79.9,160,64,173.2,64,190.7
+ v176c0,17.5,15.9,33.3,33.5,33.3h320c17.6,0,30.5-15.8,30.5-33.3v-176C448,173.2,435.1,160,417.5,160z M432,366.7
+ c0,9.3-6.2,17.3-14.5,17.3h-320c-8.7,0-17.5-8.7-17.5-17.3v-176c0-8.2,8.1-14.7,17.5-14.7h60.7h7.1l4.8-3.2c4-4.5,7.7-10,11.1-13.8
+ c11.3-12.7,19.5-21.7,25.3-26.9c4.7-4.2,6.2-4.1,6.2-4.1h88.5c0,0,1.6-0.1,6.7,4.5c6.1,5.5,14.7,16.5,26.6,29.8
+ c2.9,3.3,6,6.8,9.3,10.5l4.8,3.2h7.2h61.7c8.8,0,14.5,6,14.5,14.7V366.7z"/>
+ <path d="M256,189.5c-47.1,0-85.5,38.4-85.5,85.5s38.4,85.5,85.5,85.5s85.5-38.4,85.5-85.5S303.1,189.5,256,189.5z M256,344.5
+ c-38.4,0-69.5-31.1-69.5-69.5s31.1-69.5,69.5-69.5s69.5,31.1,69.5,69.5S294.4,344.5,256,344.5z"/>
+ <rect x="352" y="192" width="17" height="17"/>
+ <circle cx="256" cy="275" r="32"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-camera.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-camera.svg
new file mode 100644
index 00000000..11ce8753
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-camera.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M417.5,160h-61.7c-32.1-36-42.2-48-54.5-48h-88.5c-12.3,0-22.2,12-54.5,48H145v-16h-34v16H97.5C79.9,160,64,173.2,64,190.7
+ v176c0,17.5,15.9,33.3,33.5,33.3h320c17.6,0,30.5-15.8,30.5-33.3v-176C448,173.2,435.1,160,417.5,160z M256,360.5
+ c-47.1,0-85.5-38.4-85.5-85.5s38.4-85.5,85.5-85.5s85.5,38.4,85.5,85.5S303.1,360.5,256,360.5z M369,209h-17v-17h17V209z"/>
+ <path d="M256,205.5c-38.4,0-69.5,31.1-69.5,69.5s31.1,69.5,69.5,69.5s69.5-31.1,69.5-69.5S294.4,205.5,256,205.5z M256,307
+ c-17.7,0-32-14.3-32-32s14.3-32,32-32s32,14.3,32,32S273.7,307,256,307z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cart-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cart-outline.svg
new file mode 100644
index 00000000..9fe49fb7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cart-outline.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M160,400c-13.248,0-24,10.752-24,24s10.752,24,24,24s24-10.752,24-24S173.248,400,160,400z M160,432c-4.411,0-8-3.589-8-8
+ s3.589-8,8-8s8,3.589,8,8S164.411,432,160,432z"/>
+ <path d="M384.5,400c-13.248,0-24,10.752-24,24s10.752,24,24,24s24-10.752,24-24S397.748,400,384.5,400z M384.5,432
+ c-4.411,0-8-3.589-8-8s3.589-8,8-8s8,3.589,8,8S388.911,432,384.5,432z"/>
+ <path d="M448,128L123.177,95.646c-1.628-6.972-4.369-14.66-11.838-20.667C102.025,67.489,86.982,64,64,64v16.001
+ c18.614,0,31.167,2.506,37.312,7.447c4.458,3.585,5.644,8.423,7.165,15.989l-0.024,0.004l42.052,233.638
+ c2.413,14.422,7.194,25.209,13.291,32.986C171.043,379.312,180.533,384,192,384h240v-16H192c-4.727,0-19.136,0.123-25.749-33.755
+ l-5.429-30.16L432,256L448,128z M418.59,242.348l-260.601,45.99l-31.732-176.3l303.869,30.608L418.59,242.348z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cart.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cart.svg
new file mode 100644
index 00000000..b7fdd4b8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cart.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M160,400c-13.248,0-24,10.752-24,24s10.752,24,24,24s24-10.752,24-24S173.248,400,160,400z"/>
+ <path d="M384.5,400c-13.248,0-24,10.752-24,24s10.752,24,24,24s24-10.752,24-24S397.748,400,384.5,400z"/>
+ <path d="M448,128L123.177,95.646c-1.628-6.972-4.369-14.66-11.838-20.667C102.025,67.489,86.982,64,64,64v16.001
+ c18.614,0,31.167,2.506,37.312,7.447c4.458,3.585,5.644,8.423,7.165,15.989l-0.024,0.004l42.052,233.638
+ c2.413,14.422,7.194,25.209,13.291,32.986C171.043,379.312,180.533,384,192,384h240v-16H192c-4.727,0-19.136,0.123-25.749-33.755
+ l-5.429-30.16L432,256L448,128z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatboxes-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatboxes-outline.svg
new file mode 100644
index 00000000..d87a8861
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatboxes-outline.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="64,64 320,64 320,160 336,160 336,48 48,48 48,272 160,272 160,256 64,256 "/>
+ <path d="M176,176v224h162.6l64,64H416v-64h48V176H176z M448,384h-48v54.6L345,384H192V192h256V384z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatboxes.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatboxes.svg
new file mode 100644
index 00000000..1e975b1b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatboxes.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="336,48 48,48 48,272 160,272 160,160 336,160 "/>
+ <path d="M176,176v224h162.6l64,64H416v-64h48V176H176z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatbubble-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatbubble-outline.svg
new file mode 100644
index 00000000..251db96a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatbubble-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,112c97,0,176,62,176,138.3c0,35.9-17.6,69.2-49.5,93.9c-32.8,25.4-77.4,39.3-125.5,39.3c-28.9,0-51-3-69.7-9.3
+ c-0.6-0.2-1.3-0.5-2-0.7c-0.3-0.1-0.6-0.2-0.8-0.2c-4.7-1.4-9.7-2.1-14.7-2.1c-5.6,0-11.1,0.9-16.3,2.6l0,0l-0.3,0.1
+ c-0.6,0.2-8.9,3.3-11,4.3l0,0l-39.6,17.2c13.8-43.9,13.8-44.8,13.8-47.6c0-7.1-2.2-14.1-6.3-20.2c-0.5-0.7-1-1.4-1.6-2.1
+ c-0.7-0.9-1.3-1.7-1.8-2.3c-17.4-21.9-26.6-47.1-26.6-73C80,174,159,112,256,112 M256,96C149.9,96,64,165.1,64,250.3
+ c0,30.7,11.2,59.3,30.4,83.3c0.9,0.9,2.9,3.8,3.6,4.9c0,0-1-1.6-1.1-1.9c0,0,0,0,0,0l0,0c0,0,0,0,0,0c2.3,3.3,3.6,7.1,3.6,11.2
+ c0,1.4-17.9,58-17.9,58l0,0c-1.3,4.4,2.1,8.9,7.6,10c0.8,0.2,1.6,0.2,2.4,0.2c1.3,0,2.5-0.2,3.7-0.5l1.6-0.6l50.6-22
+ c0.9-0.4,9-3.5,10-3.9c0,0,0.6-0.2,0.6-0.2c0,0-0.1,0-0.6,0.2c3.4-1.2,7.2-1.8,11.2-1.8c3.6,0,7.1,0.5,10.3,1.5c0.1,0,0.2,0,0.2,0.1
+ c0.5,0.2,1,0.3,1.5,0.5c23.1,7.9,48.4,10.3,75.1,10.3c106,0,191-64.1,191-149.3C448,165.1,362,96,256,96L256,96z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatbubble.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatbubble.svg
new file mode 100644
index 00000000..c2efd7f2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatbubble.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,96C149.9,96,64,165.1,64,250.3c0,30.7,11.2,59.3,30.4,83.3c0.9,0.9,2.9,3.8,3.6,4.9c0,0-1-1.6-1.1-1.9c0,0,0,0,0,0l0,0
+ c0,0,0,0,0,0c2.3,3.3,3.6,7.1,3.6,11.2c0,1.4-17.9,58-17.9,58l0,0c-1.3,4.4,2.1,8.9,7.6,10c0.8,0.2,1.6,0.2,2.4,0.2
+ c1.3,0,2.5-0.2,3.7-0.5l1.6-0.6l50.6-22c0.9-0.4,9-3.5,10-3.9c0,0,0.6-0.2,0.6-0.2c0,0-0.1,0-0.6,0.2c3.4-1.2,7.2-1.8,11.2-1.8
+ c3.6,0,7.1,0.5,10.3,1.5c0.1,0,0.2,0,0.2,0.1c0.5,0.2,1,0.3,1.5,0.5c23.1,7.9,48.4,10.3,75.1,10.3c106,0,191-64.1,191-149.3
+ C448,165.1,362,96,256,96L256,96z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark-empty.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark-empty.svg
new file mode 100644
index 00000000..baf44785
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark-empty.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M223.9,329.7c-2.4,2.4-5.8,4.4-8.8,4.4s-6.4-2.1-8.9-4.5l-56-56l17.8-17.8l47.2,47.2l124.8-125.7l17.5,18.1L223.9,329.7z"
+ />
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark-outline.svg
new file mode 100644
index 00000000..57145a66
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M340.1,177.3L215.3,303l-47.2-47.2l-17.8,17.8l56,56c2.5,2.5,5.9,4.5,8.9,4.5s6.3-2,8.8-4.4l133.7-134.4L340.1,177.3z"/>
+ <g>
+ <path d="M256,48C141.1,48,48,141.1,48,256s93.1,208,208,208c114.9,0,208-93.1,208-208S370.9,48,256,48z M256,446.7
+ c-105.1,0-190.7-85.5-190.7-190.7c0-105.1,85.5-190.7,190.7-190.7c105.1,0,190.7,85.5,190.7,190.7
+ C446.7,361.1,361.1,446.7,256,446.7z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark.svg
new file mode 100644
index 00000000..42e46244
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,48C141.1,48,48,141.1,48,256s93.1,208,208,208c114.9,0,208-93.1,208-208S370.9,48,256,48z M223.9,329.7
+ c-2.4,2.4-5.8,4.4-8.8,4.4s-6.4-2.1-8.9-4.5l-56-56l17.8-17.8l47.2,47.2l124.8-125.7l17.5,18.1L223.9,329.7z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-circle-filled.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-circle-filled.svg
new file mode 100644
index 00000000..0cebbc00
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-circle-filled.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M256,48C141.1,48,48,141.1,48,256s93.1,208,208,208c114.9,0,208-93.1,208-208S370.9,48,256,48z M256,446.7
+ c-105.1,0-190.7-85.5-190.7-190.7c0-105.1,85.5-190.7,190.7-190.7c105.1,0,190.7,85.5,190.7,190.7
+ C446.7,361.1,361.1,446.7,256,446.7z"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path d="M256,96c-88.4,0-160,71.6-160,160c0,88.4,71.6,160,160,160c88.4,0,160-71.6,160-160C416,167.6,344.4,96,256,96z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-circle-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-circle-outline.svg
new file mode 100644
index 00000000..ce8c36e8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-circle-outline.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M256,48C141.1,48,48,141.1,48,256s93.1,208,208,208c114.9,0,208-93.1,208-208S370.9,48,256,48z M256,446.7
+ c-105.1,0-190.7-85.5-190.7-190.7c0-105.1,85.5-190.7,190.7-190.7c105.1,0,190.7,85.5,190.7,190.7
+ C446.7,361.1,361.1,446.7,256,446.7z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-clock-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-clock-outline.svg
new file mode 100644
index 00000000..4db33fc8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-clock-outline.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,48C141.1,48,48,141.1,48,256s93.1,208,208,208c114.9,0,208-93.1,208-208S370.9,48,256,48z M256,446.7
+ c-105.1,0-190.7-85.5-190.7-190.7c0-105.1,85.5-190.7,190.7-190.7c105.1,0,190.7,85.5,190.7,190.7
+ C446.7,361.1,361.1,446.7,256,446.7z"/>
+ <polygon points="256,256 160,256 160,273.3 273.3,273.3 273.3,128 256,128 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-clock.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-clock.svg
new file mode 100644
index 00000000..a083faa1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-clock.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,48C141.1,48,48,141.1,48,256s93.1,208,208,208c114.9,0,208-93.1,208-208S370.9,48,256,48z M273,273H160v-17h96V128h17
+ V273z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close-empty.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close-empty.svg
new file mode 100644
index 00000000..71c7d70f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close-empty.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<polygon class="st0" points="340.2,160 255.8,244.3 171.8,160.4 160,172.2 244,256 160,339.9 171.8,351.6 255.8,267.8 340.2,352
+ 352,340.3 267.6,256 352,171.8 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close-outline.svg
new file mode 100644
index 00000000..d67ac63f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close-outline.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <g>
+ <path class="st0" d="M403.1,108.9c-81.2-81.2-212.9-81.2-294.2,0s-81.2,212.9,0,294.2c81.2,81.2,212.9,81.2,294.2,0
+ S484.3,190.1,403.1,108.9z M390.8,390.8c-74.3,74.3-195.3,74.3-269.6,0c-74.3-74.3-74.3-195.3,0-269.6s195.3-74.3,269.6,0
+ C465.2,195.5,465.2,316.5,390.8,390.8z"/>
+ </g>
+ <polygon class="st0" points="340.2,160 255.8,244.2 171.8,160.4 160,172.2 244,256 160,339.8 171.8,351.6 255.8,267.8 340.2,352
+ 352,340.2 267.6,256 352,171.8 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close.svg
new file mode 100644
index 00000000..eb4d0e6c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <path class="st0" d="M403.1,108.9c-81.2-81.2-212.9-81.2-294.2,0s-81.2,212.9,0,294.2c81.2,81.2,212.9,81.2,294.2,0
+ S484.3,190.1,403.1,108.9z M352,340.2L340.2,352l-84.4-84.2l-84,83.8L160,339.8l84-83.8l-84-83.8l11.8-11.8l84,83.8l84.4-84.2
+ l11.8,11.8L267.6,256L352,340.2z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-download-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-download-outline.svg
new file mode 100644
index 00000000..c1629540
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-download-outline.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <polygon points="193.2,381.2 181.6,392.6 256.1,466 330.6,392.6 319,381.2 264.3,435 264.3,192.9 247.9,192.9 247.9,435 "/>
+ </g>
+ <g>
+ <path d="M399.2,164.4c0-1.2,0.2-2.3,0.2-3.5C399.4,97.4,346.5,46,282.6,46c-46.1,0-85.8,26.8-104.4,65.4c-8.1-4-17.1-6.3-26.8-6.3
+ c-29.6,0-54.1,23.3-58.9,51.3c-35.2,12-60.6,43.4-60.6,82.4c0,49.1,40.1,89.2,89.6,89.2H213v-16h-90.7
+ c-40.9,0-74.2-33.2-74.2-73.7c0-31.4,20.2-57.5,50.2-67.7l8.4-2.8l1.5-8.7c3.6-21.3,22.1-38.8,43.9-38.8c6.9,0,13.7,1.6,19.9,4.7
+ l13.5,6.7l6.5-13.6c16.6-34.4,52.1-56.6,90.4-56.6c55.3,0,100.9,42.8,100.9,97.6c0,13.1-0.2,20.1-0.2,20.1l15.2,0.1
+ c36.7,0.5,65.6,30,65.6,66.4c0,36.3-29.8,66.1-66.5,66.3l-3.2,0.1H297v16h101h0c45,0,81.9-37.2,81.9-82.1
+ C479.9,201,444.5,164.5,399.2,164.4z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-download.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-download.svg
new file mode 100644
index 00000000..526465a7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-download.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="248,435 193.3,381.2 181.6,392.6 256.1,466 330.6,392.6 318.8,381.2 264,435 264,328 248,328 "/>
+ <path d="M399.2,164.4c0-1.2,0.2-2.3,0.2-3.5C399.4,97.4,346.5,46,282.6,46c-46.1,0-85.8,26.8-104.4,65.4c-8.1-4-17.1-6.3-26.8-6.3
+ c-29.6,0-54.1,23.3-58.9,51.3c-35.2,12-60.6,43.4-60.6,82.4c0,49.1,40.1,89.2,89.6,89.2H192h21h35V193h16v135h134
+ c45,0,81.9-37.2,81.9-82.1C479.9,201,444.5,164.5,399.2,164.4z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-outline.svg
new file mode 100644
index 00000000..1665c917
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-outline.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M399.3,232.8c0-1.2,0.2-2.4,0.2-3.6c0-64.3-52.8-117.2-116.8-117.2c-46.1,0-85.8,27.9-104.4,67c-8.1-4.1-17.1-6.4-26.8-6.4
+ c-29.6,0-54.1,23.7-58.9,52C57.4,236.8,32,268.8,32,308.4c0,49.8,40.1,91.6,89.6,91.6H398c45,0,82-38.9,82-84.3
+ C480,270.1,444.6,232.9,399.3,232.8z M397.5,383.6l-3.2,0.4H122.4c-40.9,0-74.2-34.9-74.2-76.1c0-31.9,20.2-58.4,50.2-68.8l8.4-3
+ l1.5-8.8c3.6-21.6,22.1-39.3,43.9-39.3c6.9,0,13.7,1.6,19.9,4.8l13.5,6.8l6.5-13.7c16.6-34.9,52.1-58.2,90.4-58.2
+ c55.3,0,100.9,44.1,100.9,99.7c0,13.3-0.2,20.3-0.2,20.3l15.2,0.1c36.7,0.5,65.6,30.5,65.6,67.4C464,352.1,434.2,383.4,397.5,383.6z
+ "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-upload-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-upload-outline.svg
new file mode 100644
index 00000000..5cb54317
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-upload-outline.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <polygon points="193.3,260.4 181.7,248.8 256.2,174.5 330.7,248.8 319,260.4 264.4,205.8 264.4,447.6 247.9,447.6 247.9,205.8
+ "/>
+ </g>
+ <g>
+ <path d="M399.3,183.6c0-1.2,0.2-2.4,0.2-3.6c0-64.3-52.8-116.4-116.8-116.4c-46.1,0-85.8,27.1-104.4,66.3
+ c-8.1-4.1-17.1-6.4-26.8-6.4c-29.6,0-54.1,23.6-58.9,52C57.4,187.6,32,222.2,32,261.8c0,49.7,40.1,90.2,89.6,90.2H213v-16h-90.6
+ c-40.9,0-74.2-33.5-74.2-74.6c0-31.8,20.2-61.2,50.2-71.6l8.4-2.9l1.5-8.8c3.6-21.6,22.1-39.3,43.9-39.3c6.9,0,13.7,1.6,19.9,4.8
+ l13.5,6.8l6.5-13.7c16.6-34.9,52.1-57.4,90.4-57.4c55.3,0,100.9,43.3,100.9,98.9c0,13.3-0.2,20.3-0.2,20.3l15.2,0.1
+ C435,199.1,464,232,464,268.9c0,36.8-29.8,66.9-66.5,67.1l-3.2,0H297v16h101h0c45,0,82-37.3,82-82.8
+ C480,223.7,444.5,183.7,399.3,183.6z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-upload.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-upload.svg
new file mode 100644
index 00000000..cff5dc7a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-upload.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <rect x="248" y="352" width="16" height="96"/>
+ <path d="M399.3,183.6c0-1.2,0.2-2.4,0.2-3.6c0-64.3-52.8-116.4-116.8-116.4c-46.1,0-85.8,27.1-104.4,66.3
+ c-8.1-4.1-17.1-6.4-26.8-6.4c-29.6,0-54.1,23.6-58.9,52C57.4,187.6,32,222.2,32,261.8c0,49.7,40.1,90.2,89.6,90.2H182h31h35V205.8
+ l-54.7,54.5l-11.6-11.6l74.5-74.3l74.5,74.3l-11.8,11.6L264,205.8V352h134c45,0,82-37.3,82-82.8C480,223.7,444.5,183.7,399.3,183.6
+ z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud.svg
new file mode 100644
index 00000000..29b64a67
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M399.3,232.8c0-1.2,0.2-2.4,0.2-3.6c0-64.3-52.8-117.2-116.8-117.2c-46.1,0-85.8,27.9-104.4,67c-8.1-4.1-17.1-6.4-26.8-6.4
+ c-29.6,0-54.1,23.7-58.9,52C57.4,236.8,32,268.8,32,308.4c0,49.8,40.1,91.6,89.6,91.6H398c45,0,82-38.9,82-84.3
+ C480,270.1,444.6,232.9,399.3,232.8z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-night-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-night-outline.svg
new file mode 100644
index 00000000..c45c348a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-night-outline.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <path class="st0" d="M189,223.8c14.5,0,28.1,4.8,39.3,13.9c10.9,8.9,18.6,21.3,21.7,34.9l3.1,14l14.2-1.8c2.1-0.3,4.1-0.4,6.1-0.4
+ c26.9,0,48.8,22.1,48.8,49.2c0,27.1-21.9,49.2-48.8,49.2H115.7c-9.5,0-18.5-3.9-25.4-10.8c-6.8-7-10.6-16.2-10.6-25.9
+ c0-18.6,14.5-33.8,33.2-36.9c1.6-0.3,8.8-1.2,14.2-1.7c0,0-0.5-5.3-0.6-9.6c-0.1-4.3-0.1-9.4-0.1-11.5
+ C126.5,252,154.5,223.8,189,223.8 M189,208c-43.3,0-78.3,35.2-78.3,78.5c0,2.6,0.1,5.2,0.4,7.8C84.7,296.7,64,319.8,64,346.9
+ c0,28.6,23.2,53.1,51.7,53.1h157.7c35.7,0,64.6-29.9,64.6-65.7c0-35.8-28.9-65.3-64.6-65.3c-2.7,0-5.4,0-8,0.3
+ C257.5,234.3,226.3,208,189,208L189,208z"/>
+ <path class="st0" d="M424.6,305.6c-2,0.1-3.9,0.1-5.9,0.1c-32.3,0-62.7-12.6-85.5-35.5c-22.8-22.9-35.4-53.3-35.4-85.7
+ c0-18.4,4.1-36.2,11.8-52.4c3.4-7.1,7.5-13.9,12.3-20.2c-8.4,0.9-16.6,2.7-24.4,5.1c-37.2,11.8-67.1,40.2-81,76.5
+ c5.9,1.2,11.6,3,17,5.4c10.1-25.5,29.4-46.4,53.8-58.6c-4.6,13.9-7.1,28.7-7.1,44.1c0,27.3,7.9,52.8,21.4,74.2
+ c13.8,21.8,33.5,39.5,56.8,50.9c15.3,7.4,32.2,12.1,50,13.5c-14,12.2-31.2,20.9-50,24.8c-1.9,6.9-4.9,13.4-8.6,19.3
+ c33.6-3.6,63.3-20.1,84-44.6c5.4-6.3,10.2-13.2,14.2-20.5C440.4,304.1,432.6,305.2,424.6,305.6z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-night.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-night.svg
new file mode 100644
index 00000000..51a16221
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-night.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <path class="st0" d="M424.6,305.6c-2,0.1-3.9,0.1-5.9,0.1c-32.3,0-62.7-12.6-85.5-35.5c-22.8-22.9-35.4-53.3-35.4-85.7
+ c0-18.4,4.1-36.2,11.8-52.4c3.4-7.1,7.5-13.9,12.3-20.2c-8.4,0.9-16.6,2.7-24.4,5.1c-37.2,11.8-67.1,40.2-81,76.5
+ c-0.3,0.8-0.6,1.5-0.9,2.3c11.9,3.5,23.1,9.4,32.8,17.3c13,10.6,22.9,24.5,28.8,40.1c20.1,0.9,38.9,9.4,53.3,24
+ c15.2,15.4,23.5,35.9,23.5,57.4c0,11.4-2.4,22.5-6.8,32.8c0.8-0.1,1.6-0.1,2.5-0.2c33.6-3.6,63.3-20.1,84-44.6
+ c5.4-6.3,10.2-13.2,14.2-20.5C440.4,304.1,432.6,305.2,424.6,305.6z"/>
+</g>
+<path class="st0" d="M189,209c-43.3,0-78.3,35.2-78.3,78.5c0,2.6,0.1,5.2,0.4,7.8C84.7,297.7,64,320.8,64,347.9
+ c0,28.6,23.2,53.1,51.7,53.1h157.7c35.7,0,64.6-29.9,64.6-65.7c0-35.8-28.9-65.3-64.6-65.3c-2.7,0-5.4,0-8,0.3
+ C257.5,235.3,226.3,209,189,209L189,209z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-outline.svg
new file mode 100644
index 00000000..2bfbadd7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-outline.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<path class="st0" d="M244,175.8c14.5,0,28.1,4.8,39.3,13.9c10.9,8.9,18.6,21.3,21.7,34.9l3.1,14l14.2-1.8c2.1-0.3,4.1-0.4,6.1-0.4
+ c26.9,0,48.8,22.1,48.8,49.2c0,27.1-21.9,49.2-48.8,49.2H170.7c-9.5,0-18.5-3.9-25.4-10.8c-6.8-7-10.6-16.2-10.6-25.9
+ c0-18.6,14.5-33.8,33.2-36.9c1.6-0.3,8.7-1.2,14.2-1.7c0,0-0.5-5.3-0.6-9.6c-0.1-4.3-0.1-9.4-0.1-11.5
+ C181.5,204,209.5,175.8,244,175.8 M244,160c-43,0-78.3,35.2-78.3,78.5c0,2.6,0.1,5.2,0.4,7.8c-26.4,2.3-47.1,25.5-47.1,52.6
+ c0,28.6,23.2,53.1,51.7,53.1h157.7c35.7,0,64.6-29.9,64.6-65.7S364.1,221,328.4,221c-2.7,0-5.4,0-8,0.3C312.5,186.3,281,160,244,160
+ L244,160z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy.svg
new file mode 100644
index 00000000..634632e6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<path class="st0" d="M244,160c-43,0-78.3,35.2-78.3,78.5c0,2.6,0.1,5.2,0.4,7.8c-26.4,2.3-47.1,25.5-47.1,52.6
+ c0,28.6,23.2,53.1,51.7,53.1h157.7c35.7,0,64.6-29.9,64.6-65.7S364.1,221,328.4,221c-2.7,0-5.4,0-8,0.3C312.5,186.3,281,160,244,160
+ L244,160z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cog-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cog-outline.svg
new file mode 100644
index 00000000..cca3e715
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cog-outline.svg
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M448,272.754v-32.008l-33.291-8.703l-2.601-13.204l27.594-20.905l-12.197-29.608l-34.392,4.802l-7.498-10.603
+ l17.696-29.708l-22.594-22.605l-30.192,17.404l-10.697-7.302l5.298-35.009l-29.492-12.303L294.04,101.31l-12.297-2.601L273.045,64
+ h-31.991l-9.197,34.909l-12.098,2.4l-21.494-29.008l-29.592,12.304l4.799,35.709l-11.697,7.202l-31.292-18.705l-22.594,22.606
+ l18.795,31.508l-6.698,10.502l-35.49-5.001l-12.197,29.608l28.893,21.706l-2.399,12.203L64,240.846v32.008l34.69,8.903l2.4,12.503
+ l-28.394,21.306l12.297,29.508l34.991-5.002l7.099,11.303l-17.896,30.608l22.595,22.605l30.192-18.204l11.196,7.302l-4.498,34.31
+ l29.592,12.202l20.595-27.807l13.396,2.5L241.054,448h31.991l8.298-33.109l13.597-2.601l20.694,27.107l29.593-12.204l-4.998-33.708
+ l10.196-7.401l28.992,16.904l22.595-22.606l-16.795-28.907l7.896-11.403l33.791,4.802l12.298-29.508l-27.193-20.506l2.7-13.503
+ L448,272.754z M419.707,320.767l-2.8,6.702l-31.891-4.501l-18.896,27.807l15.695,27.106l-5.198,5.202l-27.293-15.904
+ l-26.593,18.204l4.799,31.809l-6.698,2.802l-19.595-25.607l-32.892,6.501l-7.798,31.209h-7.198l-8.397-31.309l-32.592-6.501
+ l-19.495,26.406l-6.698-2.801l4.399-32.509l-27.493-18.304l-28.793,17.504l-5.099-5.101l16.996-29.108l-18.096-27.606
+ l-33.191,4.701l-2.699-6.603l26.894-20.205l-6.199-31.809l-32.991-8.502v-7.202l32.991-8.402l6.299-31.608l-27.293-20.505
+ l2.699-6.602l33.691,4.801l17.796-26.807l-17.996-30.008l4.999-5.001l20.595,12.303l9.197,5.501l27.893-18.205l-4.499-33.809
+ l6.699-2.8l20.294,27.407l31.492-6.102l8.798-33.208h7.198l8.298,33.008l31.691,6.301l20.095-26.807l6.598,2.801l-4.999,33.108
+ l27.193,18.105l28.292-16.205l5.1,5.102l-16.695,28.007l18.396,27.007l32.491-4.601l2.799,6.702l-26.193,19.705l6.498,32.508
+ l31.292,8.102v7.202l-31.391,8.103l-6.499,32.709L419.707,320.767z"/>
+ <path d="M256,128c-70.692,0-128,57.308-128,128c0,70.693,57.308,128,128,128s128-57.307,128-128C384,185.308,326.692,128,256,128z
+ M144,256c0-29.916,11.65-58.042,32.804-79.195C197.958,155.65,226.084,144,256,144c7.496,0,14.88,0.732,22.069,2.161L250.3,250.1
+ l-104.155,27.888C144.727,270.824,144,263.468,144,256z M256,368c-29.917,0-58.042-11.65-79.196-32.804
+ c-11.927-11.926-20.831-26.069-26.331-41.499L253.9,266.2l74.935,74.889C308.558,358.501,283.009,368,256,368z M340.154,329.901
+ L265.2,254.9l28.05-104.58c15.604,5.487,29.904,14.443,41.945,26.484C356.35,197.958,368,226.084,368,256
+ C368,283.486,358.159,309.457,340.154,329.901z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cog.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cog.svg
new file mode 100644
index 00000000..e0d22afb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cog.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M293.25,150.32L265.2,254.9l74.954,75C358.159,309.457,368,283.486,368,256c0-29.916-11.65-58.042-32.805-79.196
+ C323.154,164.763,308.854,155.807,293.25,150.32z"/>
+ <path d="M278.068,146.161C270.88,144.732,263.496,144,256,144c-29.916,0-58.042,11.65-79.196,32.805
+ C155.65,197.958,144,226.084,144,256c0,7.468,0.727,14.824,2.145,21.988L250.3,250.1L278.068,146.161z"/>
+ <path d="M150.473,293.697c5.5,15.43,14.404,29.572,26.331,41.498C197.958,356.35,226.083,368,256,368
+ c27.009,0,52.558-9.499,72.835-26.911L253.9,266.2L150.473,293.697z"/>
+ <path d="M448,272.754v-32.008l-33.291-8.703l-2.601-13.204l27.594-20.905l-12.197-29.608l-34.392,4.802l-7.498-10.603
+ l17.695-29.708l-22.594-22.605l-30.191,17.404l-10.697-7.302l5.298-35.009l-29.492-12.303L294.04,101.31l-12.297-2.601L273.045,64
+ h-31.991l-9.197,34.909l-12.098,2.4l-21.494-29.008l-29.592,12.304l4.799,35.709l-11.697,7.202l-31.292-18.705l-22.594,22.606
+ l18.795,31.508l-6.698,10.502l-35.49-5.001l-12.197,29.608l28.893,21.706l-2.399,12.203L64,240.846v32.007l34.69,8.903l2.4,12.503
+ l-28.394,21.307l12.297,29.508l34.991-5.002l7.099,11.303l-17.896,30.607l22.595,22.605l30.192-18.204l11.196,7.302l-4.498,34.311
+ l29.592,12.202l20.595-27.808l13.396,2.5L241.054,448h31.991l8.298-33.109l13.597-2.601l20.694,27.106l29.593-12.203l-4.998-33.709
+ l10.196-7.4l28.992,16.904l22.595-22.606l-16.795-28.907l7.896-11.402l33.791,4.802l12.298-29.508l-27.193-20.507l2.7-13.502
+ L448,272.754z M256,384c-70.692,0-128-57.307-128-128c0-70.692,57.308-128,128-128c70.692,0,128,57.308,128,128
+ C384,326.693,326.692,384,256,384z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-filter-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-filter-outline.svg
new file mode 100644
index 00000000..2d44608e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-filter-outline.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M366.195,212.122c1.185-6.528,1.806-13.252,1.806-20.122c0-61.856-50.145-112.001-112.001-112.001
+ S143.999,130.144,143.999,192c0,6.87,0.621,13.594,1.806,20.122C98.616,225.302,63.999,268.606,63.999,320
+ c0,61.856,50.145,112.001,112.001,112.001c31.342,0,59.671-12.879,80-33.627c20.329,20.748,48.658,33.627,80,33.627
+ c61.856,0,112.001-50.145,112.001-112.001C448.001,268.606,413.384,225.303,366.195,212.122z M159.999,192
+ c0-52.935,43.065-96.001,96.001-96.001s96.001,43.066,96.001,96.001c0,5.776-0.513,11.435-1.495,16.933
+ c-4.749-0.614-9.59-0.934-14.506-0.934c-31.342,0-59.671,12.879-80,33.627c-20.329-20.748-48.658-33.627-80-33.627
+ c-4.916,0-9.757,0.319-14.506,0.934C160.512,203.435,159.999,197.776,159.999,192z M272.001,320c0,19.58-5.896,37.806-16.001,53.006
+ c-10.104-15.2-16.001-33.426-16.001-53.006c0-5.776,0.513-11.435,1.495-16.933c4.749,0.614,9.59,0.934,14.506,0.934
+ s9.757-0.319,14.506-0.934C271.488,308.565,272.001,314.224,272.001,320z M256,288.001c-3.484,0-6.925-0.191-10.314-0.556
+ c2.626-7.262,6.105-14.119,10.314-20.451c4.21,6.332,7.688,13.189,10.314,20.451C262.925,287.81,259.484,288.001,256,288.001z
+ M229.791,284.364c-29.756-8.455-53.666-30.937-64.105-59.81c3.39-0.364,6.83-0.556,10.314-0.556
+ c27.353,0,52.069,11.5,69.572,29.917C238.847,263.104,233.484,273.351,229.791,284.364z M266.428,253.917
+ c17.503-18.418,42.219-29.918,69.572-29.918c3.484,0,6.925,0.191,10.314,0.556c-10.439,28.873-34.35,51.354-64.105,59.81
+ C278.516,273.351,273.153,263.104,266.428,253.917z M176,416.001c-52.936,0-96.001-43.065-96.001-96.001
+ c0-43.852,29.555-80.931,69.792-92.364c11.732,34.983,40.265,62.257,76.014,72.243c-1.185,6.527-1.806,13.252-1.806,20.121
+ c0,24.717,8.013,47.559,21.573,66.084C228.069,404.501,203.353,416.001,176,416.001z M336,416.001
+ c-27.354,0-52.069-11.5-69.572-29.918c13.561-18.524,21.573-41.366,21.573-66.083c0-6.869-0.621-13.594-1.806-20.121
+ c35.749-9.986,64.281-37.26,76.014-72.243c40.237,11.434,69.792,48.513,69.792,92.364C432.001,372.936,388.936,416.001,336,416.001z
+ "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-filter.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-filter.svg
new file mode 100644
index 00000000..eee02aa4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-filter.svg
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M366.194,212.122c1.185-6.528,1.807-13.252,1.807-20.122c0-61.856-50.146-112-112.001-112
+ c-61.857,0-112.001,50.144-112.001,112c0,6.87,0.622,13.594,1.806,20.122C98.618,225.302,64,268.606,64,320
+ c0,61.855,50.144,112,112,112c31.341,0,59.67-12.879,80-33.627C276.328,419.121,304.658,432,335.999,432
+ C397.854,432,448,381.855,448,320C448,268.606,413.381,225.303,366.194,212.122z M255.998,395.373
+ c-0.484,0.495-0.979,0.982-1.475,1.469c-3.201-3.394-6.189-6.987-8.951-10.759c-13.561-18.525-21.574-41.366-21.574-66.083
+ c0-6.869,0.622-13.594,1.807-20.121c-35.749-9.986-64.281-37.26-76.014-72.243c-1.594-4.752-2.872-9.647-3.822-14.659
+ c0.942-0.29,1.882-0.589,2.835-0.854c-0.046-0.252-0.085-0.507-0.129-0.759c4.186-1.049,8.463-1.867,12.82-2.43
+ C166.243,208.319,171.084,208,176,208c31.341,0,59.67,12.878,80,33.626C276.328,220.878,304.658,208,335.999,208
+ c4.916,0,9.757,0.319,14.506,0.934c4.355,0.563,8.633,1.38,12.816,2.429c-0.043,0.253-0.082,0.507-0.129,0.76
+ c0.955,0.267,1.895,0.564,2.838,0.855c-0.949,5.012-2.229,9.907-3.822,14.658c-11.732,34.983-40.266,62.257-76.013,72.242
+ c1.185,6.528,1.807,13.253,1.807,20.122c0,24.717-8.014,47.558-21.574,66.083c-2.762,3.772-5.752,7.367-8.953,10.76
+ C256.979,396.356,256.484,395.869,255.998,395.373z"/>
+ <path d="M270.506,303.067c-4.749,0.614-9.59,0.934-14.506,0.934s-9.758-0.319-14.506-0.934c-0.982,5.498-1.496,11.156-1.496,16.933
+ c0,19.58,5.898,37.806,16.002,53.005c10.104-15.199,16.002-33.425,16.002-53.005C272.002,314.224,271.488,308.565,270.506,303.067z
+ "/>
+ <path d="M346.313,224.555c-3.39-0.364-6.83-0.556-10.314-0.556c-27.354,0-52.069,11.5-69.571,29.917
+ c6.725,9.188,12.088,19.434,15.781,30.448C311.964,275.909,335.874,253.428,346.313,224.555z"/>
+ <path d="M266.314,287.445c-2.625-7.262-6.105-14.119-10.314-20.451c-4.209,6.332-7.689,13.189-10.314,20.451
+ c3.389,0.364,6.83,0.556,10.314,0.556S262.925,287.81,266.314,287.445z"/>
+ <path d="M176,223.999c-3.484,0-6.925,0.191-10.314,0.556c10.439,28.873,34.349,51.354,64.106,59.81
+ c3.693-11.015,9.055-21.261,15.781-30.448C228.07,235.499,203.353,223.999,176,223.999z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-wand-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-wand-outline.svg
new file mode 100644
index 00000000..6583acb6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-wand-outline.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M192.011,149.661l-34.043,34.041l256.097,256.096L448,405.757L192.011,149.661z M212.596,215.702l11.415-11.414
+ l201.468,201.469l-11.414,11.414L212.596,215.702z"/>
+ <rect x="184" y="64" width="16" height="40"/>
+ <rect x="184" y="268" width="16" height="40"/>
+ <rect x="280" y="176" width="40" height="16"/>
+ <rect x="64" y="176" width="40" height="16"/>
+ <rect x="111.875" y="94.077" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 285.3039 109.9734)" width="16" height="40"/>
+ <rect x="111.877" y="238.327" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 21.9762 525.7571)" width="15.998" height="40"/>
+ <rect x="256.126" y="94.077" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 370.226 381.506)" width="16" height="39.999"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-wand.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-wand.svg
new file mode 100644
index 00000000..1865c8bd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-wand.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="198.011,159.22 163.968,193.337 420.064,450 454,415.883 "/>
+ <rect x="182" y="62" width="32" height="64"/>
+ <rect x="182" y="266" width="32" height="64"/>
+ <rect x="274" y="178" width="64" height="32"/>
+ <polygon points="303.941,112.143 281.314,89.465 236.06,134.82 258.687,157.498 "/>
+ <polygon points="92.06,112.143 137.314,157.498 159.941,134.82 114.687,89.465 "/>
+ <polygon points="92.06,279.141 114.687,301.816 159.941,256.462 137.314,233.784 "/>
+ <rect x="58" y="178" width="64" height="32"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-compose-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-compose-outline.svg
new file mode 100644
index 00000000..c11f6394
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-compose-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="368,416 80,416 80,144 304.117,144 320.117,128 64,128 64,432 384,432 384,191.883 368,207.883 "/>
+ <polygon points="237.623,284.084 227.917,274.377 399.24,103.054 387.927,91.74 208,271.651 208,304 240.216,304 420.261,124.016
+ 408.947,112.73 "/>
+ <path d="M444.213,80.312l-12.465-12.466C429.084,65.467,425.556,64,421.746,64c-3.812,0-7.304,1.468-9.929,3.85L399.666,80
+ l0.08,0.08l11.293,11.293l21.02,21.02l12.15-12.15c2.383-2.625,3.791-6.117,3.791-9.929C448,86.504,446.592,82.975,444.213,80.312z
+ "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-compose.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-compose.svg
new file mode 100644
index 00000000..08d818ff
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-compose.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="256,320 192,320 192,256 320,128 64,128 64,432 384,432 384,192 "/>
+ <polygon points="387.927,91.74 208,271.651 208,304 240.216,304 420.261,124.016 "/>
+ <path d="M444.213,80.312l-12.465-12.466C429.084,65.467,425.556,64,421.746,64c-3.812,0-7.304,1.468-9.929,3.85L399.666,80
+ l0.08,0.08l11.293,11.293l21.02,21.02l12.15-12.15c2.383-2.625,3.791-6.117,3.791-9.929C448,86.504,446.592,82.975,444.213,80.312z
+ "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-contact-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-contact-outline.svg
new file mode 100644
index 00000000..79ae9110
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-contact-outline.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,48C141.1,48,48,141.1,48,256c0,114.9,93.1,208,208,208c114.9,0,208-93.1,208-208C464,141.1,370.9,48,256,48z M256,65.3
+ c105.1,0,190.7,85.5,190.7,190.7c0,46.5-16.7,89.1-44.4,122.2c-20-8.2-65.9-24.1-92.9-32.1c-2.4-0.7-2.7-0.9-2.7-10.7
+ c0-8.1,3.3-16.3,6.6-23.3c3.6-7.5,7.7-20.2,9.2-31.6c4.2-4.9,10-14.5,13.6-32.9c3.2-16.2,1.7-22.1-0.4-27.6
+ c-0.2-0.6-0.5-1.2-0.6-1.7c-0.8-3.8,0.3-23.5,3.1-38.8c1.9-10.5-0.5-32.8-14.9-51.3c-9.1-11.7-26.6-26-58.5-28l-17.5,0
+ c-31.4,2-48.8,16.3-58,28c-14.5,18.5-16.9,40.8-15,51.3c2.8,15.3,3.9,35,3.1,38.8c-0.2,0.7-0.4,1.2-0.6,1.8
+ c-2.1,5.5-3.7,11.4-0.4,27.6c3.7,18.4,9.4,28,13.6,32.9c1.5,11.4,5.7,24,9.2,31.6c2.6,5.5,3.8,13,3.8,23.6c0,9.9-0.4,10-2.6,10.7
+ c-28.1,8.3-72.6,24.3-90.4,32C82.1,345.3,65.3,302.6,65.3,256C65.3,150.9,150.9,65.3,256,65.3z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-contact.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-contact.svg
new file mode 100644
index 00000000..61829b03
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-contact.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,48C141.1,48,48,141.1,48,256c0,114.9,93.1,208,208,208c114.9,0,208-93.1,208-208C464,141.1,370.9,48,256,48z
+ M256,446.7c-58.6,0-111.1-26.6-146.1-68.3c17.8-7.7,62.2-23.7,90.3-31.9c2.2-0.7,2.6-0.8,2.6-10.7c0-10.6-1.2-18.1-3.8-23.6
+ c-3.5-7.5-7.7-20.2-9.2-31.6c-4.2-4.9-9.9-14.5-13.6-32.9c-3.2-16.2-1.7-22.1,0.4-27.6c0.2-0.6,0.5-1.2,0.6-1.8
+ c0.8-3.7-0.3-23.5-3.1-38.8c-1.9-10.5,0.5-32.8,15-51.3c9.1-11.7,26.6-26,58-28l17.5,0c31.9,2,49.4,16.3,58.5,28
+ c14.5,18.5,16.9,40.8,14.9,51.3c-2.8,15.3-3.9,35-3.1,38.8c0.1,0.6,0.4,1.2,0.6,1.7c2.1,5.5,3.7,11.4,0.4,27.6
+ c-3.7,18.4-9.4,28-13.6,32.9c-1.5,11.4-5.7,24-9.2,31.6c-3.3,6.9-6.6,15.1-6.6,23.3c0,9.9,0.4,10,2.7,10.7
+ c26.7,7.9,72.7,23.8,93,32.1C367.2,420,314.7,446.7,256,446.7z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-copy-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-copy-outline.svg
new file mode 100644
index 00000000..75b8c0ba
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-copy-outline.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="304,96 288,96 288,176 368,176 368,160 304,160 "/>
+ <path d="M325.3,64H160v48h-48v336h240v-48h48V139L325.3,64z M336,432H128V128h32v272h176V432z M384,384H176V80h142.7l65.3,65.6V384
+ z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-copy.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-copy.svg
new file mode 100644
index 00000000..57132a74
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-copy.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="144,416 144,400 144,112 112,112 112,448 352,448 352,416 160,416 "/>
+ <g>
+ <path d="M325.3,64H160v48v288h192h48V139L325.3,64z M368,176h-80V96h16v64h64V176z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-crop-strong.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-crop-strong.svg
new file mode 100644
index 00000000..fcb8b3a2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-crop-strong.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <rect x="128" y="64" width="32" height="48"/>
+ <polygon points="160,352 160,176 128,176 128,384 336,384 336,352 "/>
+ <rect x="400" y="352" width="48" height="32"/>
+ <polygon points="64,128 64,160 352,160 352,448 384,448 384,128 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-crop.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-crop.svg
new file mode 100644
index 00000000..735b51a6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-crop.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <rect x="128" y="64" width="16" height="48"/>
+ <polygon points="144,368 144,160 128,160 128,384 352,384 352,368 "/>
+ <rect x="400" y="368" width="48" height="16"/>
+ <polygon points="64,128 64,144 368,144 368,448 384,448 384,128 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-download-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-download-outline.svg
new file mode 100644
index 00000000..7ca9a121
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-download-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <polygon points="288,144 288,160 400,160 400,432 112,432 112,160 224,160 224,144 96,144 96,448 416,448 416,144 "/>
+ </g>
+ <g>
+ <polygon points="193.1,252.3 181.5,263.9 256,338.4 330.5,263.9 318.9,252.3 264.2,307 264.2,64 247.8,64 247.8,307 "/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-download.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-download.svg
new file mode 100644
index 00000000..0ffdb50a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-download.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="264,144 264,307 318.8,252.3 330.4,263.9 256,338.4 181.5,263.9 193.2,252.3 248,307 248,144 96,144 96,448
+ 416,448 416,144 "/>
+ <rect x="248" y="64" width="16" height="80"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-drag.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-drag.svg
new file mode 100644
index 00000000..1cd687a8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-drag.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <rect x="80" y="304" width="352" height="16"/>
+ <rect x="80" y="248" width="352" height="16"/>
+ <rect x="80" y="192" width="352" height="16"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-email-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-email-outline.svg
new file mode 100644
index 00000000..1f3dcfdc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-email-outline.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M64,128v256h384V128H64z M256,267.9L93.2,144h325.6L256,267.9z M80,368V154.1l115.1,87.6L127,319l2,2l78.9-69.6L256,288
+ l48.1-36.6L383,321l2-2l-68.1-77.4L432,154.1V368H80z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-email.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-email.svg
new file mode 100644
index 00000000..049197b2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-email.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="448,384 448,141.8 316.9,241.6 385,319 383,321 304.1,251.4 256,288 207.9,251.4 129,321 127,319 195,241.6
+ 64,142 64,384 "/>
+ <polygon points="439.7,128 72,128 256,267.9 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-eye-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-eye-outline.svg
new file mode 100644
index 00000000..1bb77f68
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-eye-outline.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M447.1,256.2C401.8,204,339.2,144,256,144c-33.6,0-64.4,9.5-96.9,29.8C131.7,191,103.6,215.2,65,255l-1,1l6.7,6.9
+ C125.8,319.3,173.4,368,256,368c36.5,0,71.9-11.9,108.2-36.4c30.9-20.9,57.2-47.4,78.3-68.8l5.5-5.5L447.1,256.2z M256,160
+ c33.1,0,64.9,9.5,97.2,30.6c23.9,15.6,47.4,36.7,73.7,66.1C388.6,295.4,331.1,352,256,352c-34.2,0-64.2-8.4-94.2-28.2
+ c-27.5-18.1-52.3-43.3-76.2-67.8C144.7,196.3,194,160,256,160z"/>
+ <path d="M256,336c44.1,0,80-35.9,80-80c0-44.1-35.9-80-80-80c-44.1,0-80,35.9-80,80C176,300.1,211.9,336,256,336z M256,192.3
+ c35.2,0,64,28.6,64,63.7c0,35.1-28.8,63.7-64,63.7c-35.2,0-63.9-28.6-63.9-63.7C192.1,220.9,220.8,192.3,256,192.3z"/>
+ </g>
+ <path d="M288,256L288,256c0,17.5-14.4,32-31.8,32S224,272.8,224,255.3s15.8-31.3,32-31.3l0-16c-26.5,0-47.9,21.6-47.9,48.2
+ c0,26.6,21.5,48.1,47.9,48.1s48-21.6,48-48.1V256H288z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-eye.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-eye.svg
new file mode 100644
index 00000000..e3267565
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-eye.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M447.1,256.2C401.8,204,339.2,144,256,144c-33.6,0-64.4,9.5-96.9,29.8C131.7,191,103.6,215.2,65,255l-1,1l6.7,6.9
+ C125.8,319.3,173.4,368,256,368c36.5,0,71.9-11.9,108.2-36.4c30.9-20.9,57.2-47.4,78.3-68.8l5.5-5.5L447.1,256.2z M256,336
+ c-44.1,0-80-35.9-80-80c0-44.1,35.9-80,80-80c44.1,0,80,35.9,80,80C336,300.1,300.1,336,256,336z"/>
+ <path d="M250.4,226.8c0-6.9,2-13.4,5.5-18.8c-26.5,0-47.9,21.6-47.9,48.2c0,26.6,21.5,48.1,47.9,48.1s48-21.5,48-48.1v0
+ c-5.4,3.5-11.9,5.5-18.8,5.5C266,261.6,250.4,246,250.4,226.8z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-fastforward-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-fastforward-outline.svg
new file mode 100644
index 00000000..dff7d376
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-fastforward-outline.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M48,155l183.5,101L48,356.9V155 M272,155.8L448,256L272,356.4v-95.6v-27.1V156 M256,128v123.2L32,128v256l224-123.2V384
+ l224-128L256,128L256,128z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-fastforward.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-fastforward.svg
new file mode 100644
index 00000000..ddbdc86f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-fastforward.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,128v123.2L32,128v256l224-123.2V384l224-128L256,128L256,128z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-filing-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-filing-outline.svg
new file mode 100644
index 00000000..31d8329c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-filing-outline.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M368.5,128h-225L80,224v160h176h176V224L368.5,128z M413.4,224H368v-68L413.4,224z M160,144h192v80h-48
+ c0,26.5-21.5,48-48,48s-48-21.5-48-48h-48V144z M144,156v68H98.6L144,156z M416,368H256H96V240h98c7.1,27.6,32.2,48,62,48
+ s54.9-20.4,62-48h98V368z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-filing.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-filing.svg
new file mode 100644
index 00000000..8857ecbd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-filing.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,288c-29.8,0-54.9-20.4-62-48H80v144h176h176V240H318C310.9,267.6,285.8,288,256,288z"/>
+ <path d="M144,224h16h9h39c0,26.5,21.5,48,48,48s48-21.5,48-48h40h8h16h8h56l-63.5-96H368v80h-16v-80H160v80h-16v-80h-0.5L80,224h57
+ H144z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-film-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-film-outline.svg
new file mode 100644
index 00000000..2d257378
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-film-outline.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M56,88v336h400V88H56z M128,408H72v-48h56V408z M128,344H72v-48h56V344z M128,280H72v-48h56V280z M128,216H72v-48h56V216z
+ M128,152H72v-48h56V152z M368,408H144V264h224V408z M368,248H144V104h224V248z M440,408h-56v-48h56V408z M440,344h-56v-48h56V344z
+ M440,280h-56v-48h56V280z M440,216h-56v-48h56V216z M440,152h-56v-48h56V152z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-film.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-film.svg
new file mode 100644
index 00000000..081f1d2c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-film.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M56,88v336h400V88H56z M128,408H72v-48h56V408z M128,344H72v-48h56V344z M128,280H72v-48h56V280z M128,216H72v-48h56V216z
+ M128,152H72v-48h56V152z M368,264H144v-16h224V264z M440,408h-56v-48h56V408z M440,344h-56v-48h56V344z M440,280h-56v-48h56V280z
+ M440,216h-56v-48h56V216z M440,152h-56v-48h56V152z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flag-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flag-outline.svg
new file mode 100644
index 00000000..2ecb7d2f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flag-outline.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M368,112c-11,1.4-24.9,3.5-39.7,3.5c-23.1,0-44-5.7-65.2-10.2c-21.5-4.6-43.7-9.3-67.2-9.3c-46.9,0-62.8,10.1-64.4,11.2
+ l-3.4,2.4v2.6v161.7V416h16V272.7c6-2.5,21.8-6.9,51.9-6.9c21.8,0,42.2,8.3,63.9,13c22,4.7,44.8,9.6,69.5,9.6
+ c14.7,0,27.7-2,38.7-3.3c6-0.7,11.3-1.4,16-2.2V126v-16.5C379.4,110.4,374,111.2,368,112z M368,269c-11,1.4-23.9,3.5-38.7,3.5
+ c-23.1,0-45-4.7-66.2-9.2c-21.5-4.6-43.6-13.3-67.1-13.3c-25.7,0-41.9,3-51.9,6V118.7c6-2.5,21.9-6.8,51.9-6.8
+ c21.8,0,42.2,4.3,63.9,9c22,4.7,43.8,10.6,68.5,10.6c14.7,0,28.7-2,39.7-3.3L368,269L368,269z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flag.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flag.svg
new file mode 100644
index 00000000..8ed7781e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flag.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M368,112c-11,1.4-24.9,3.5-39.7,3.5c-23.1,0-44-5.7-65.2-10.2c-21.5-4.6-43.7-9.3-67.2-9.3c-46.9,0-62.8,10.1-64.4,11.2
+ l-3.4,2.4v2.6v161.7V416h16V272.7c6-2.5,21.8-6.9,51.9-6.9c21.8,0,42.2,8.3,63.9,13c22,4.7,44.8,9.6,69.5,9.6
+ c14.7,0,27.7-2,38.7-3.3c6-0.7,11.3-1.4,16-2.2V126v-16.5C379.4,110.4,374,111.2,368,112z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flame-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flame-outline.svg
new file mode 100644
index 00000000..f774dbc5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flame-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M223.899,32c25.691,145-96.732,142-95.895,288c0.686,119.51,104.975,160,128.143,160c23.166,0,113.88-26,126.931-160
+ C393.711,210.816,310.572,96,223.899,32z M256.147,472c0,0-40.701-35.816-40.701-80c0-44.183,40.555-80,40.555-80
+ s40.332,35.817,40.332,80C296.332,436.184,256.147,472,256.147,472z M367.153,318.449c-2.823,28.988-9.704,54.523-20.45,75.894
+ c-8.749,17.397-20.084,32.114-33.692,43.743c-6.522,5.575-13.255,10.115-19.771,13.749c10.039-15.938,19.093-36.72,19.093-59.835
+ c0-50.788-43.842-90.307-45.708-91.963l-10.594-9.41l-10.621,9.381c-1.877,1.657-45.963,41.178-45.963,91.992
+ c0,21.842,8.168,41.594,17.636,57.152c-7.381-4.326-15.215-9.748-22.986-16.451c-14.688-12.67-26.365-27.608-34.708-44.402
+ c-10.063-20.255-15.239-43.265-15.383-68.391c-0.367-63.986,24.09-95.746,49.983-129.369c24.568-31.903,49.829-64.7,49.458-122.113
+ c32.513,28.827,61.257,63.03,82.822,98.877C357.576,219.35,371.715,271.615,367.153,318.449z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flame.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flame.svg
new file mode 100644
index 00000000..4004d5ba
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flame.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M223.899,32c25.691,145-96.732,142-95.895,288c0.686,119.51,104.975,160,128.143,160c23.166,0,113.88-26,126.931-160
+ C393.711,210.816,310.572,96,223.899,32z M256.147,472c0,0-40.701-35.816-40.701-80c0-44.183,40.555-80,40.555-80
+ s40.332,35.817,40.332,80C296.332,436.184,256.147,472,256.147,472z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flask-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flask-outline.svg
new file mode 100644
index 00000000..1b3faa07
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flask-outline.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M436.912,370.441L320,175V48h16V32h-16.009H304v16v131.418l2.514,3.791l116.575,194.834
+ c6.75,12.818,9.314,25.95,9.001,37.957c-0.243,9.339-1.958,17.938-6.545,25.569C417.076,455.666,402.33,464,384.981,464H129.093
+ c-17.504,0-32.461-8.435-41.035-22.705c-11.897-19.801-10.889-38.145,2.275-63.139L181.821,224H240v-16h-48.683l14.687-24.756
+ L208,179.4V176h48v-16h-48v-32h32v-16h-32V80h48V64h-48V48V32h-15.989H176v16h16v127L76.126,370.441
+ C67.714,386.268,63.615,401.814,64.027,416c1.061,36.511,28.702,64,65.065,64h255.889c36.291,0,62.131-27.598,62.992-64
+ C448.311,401.756,445.367,386.349,436.912,370.441z"/>
+ <path d="M108.292,374.616c-6.907,10.542-10.936,24.095-10.936,33.55c0,27.584,15.82,39.834,45.682,39.834h225.932
+ c29.804,0,44.975-15.711,45.681-39.959c0.277-9.488-3.143-22.729-10.086-33.324L332.729,256H179.5L108.292,374.616z M323.705,272
+ l67.168,110.87l0.151,0.124l0.159,0.182c5.382,8.212,7.647,18.275,7.476,24.18c-0.229,7.839-2.477,13.98-6.683,17.795
+ c-4.774,4.328-12.729,6.85-23.008,6.85H143.037c-11.064,0-19.27-2.236-23.73-5.996c-1.472-1.24-5.954-5.143-5.954-18.088
+ c0-5.943,2.857-16.383,8.319-24.717l0.177-0.302l0.166-0.042L188.564,272H323.705z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flask.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flask.svg
new file mode 100644
index 00000000..1a5e04ff
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flask.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M391.016,382.994l-0.15-0.124L323.7,272H188.554l-66.549,110.855l-0.166,0.042l-0.177,0.302
+ c-5.461,8.334-8.319,18.773-8.319,24.717c0,12.945,4.481,16.848,5.954,18.088c4.46,3.76,12.667,5.996,23.731,5.996H368.96
+ c10.278,0,18.232-2.521,23.007-6.85c4.205-3.814,6.454-9.956,6.683-17.795c0.172-5.904-2.093-15.968-7.476-24.18L391.016,382.994z"
+ />
+ <path d="M436.912,370.441L320,175V48h16V32H176v16h16v127L76.125,370.441C67.715,386.268,63.616,401.814,64.028,416
+ c1.061,36.511,28.701,64,65.065,64h255.888c36.292,0,62.132-27.598,62.993-64C448.312,401.756,445.367,386.349,436.912,370.441z
+ M208,64h48v16h-48V64z M208,112h32v16h-32V112z M208,160h48v16h-48V160z M191.261,208H240v16h-58.179L191.261,208z
+ M414.64,408.041C413.934,432.289,398.763,448,368.96,448H143.027c-29.862,0-45.682-12.25-45.682-39.834
+ c0-9.455,4.029-23.008,10.937-33.55L179.49,256h153.228l71.836,118.717C411.497,385.312,414.916,398.553,414.64,408.041z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flower-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flower-outline.svg
new file mode 100644
index 00000000..83f58dd0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flower-outline.svg
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M395.057,284.252c55.929,0,84.943-11.62,84.943-28.002s-29.016-28.003-84.943-28.003c-28.732,0-64.708,7.391-92.902,14.578
+ c-0.975-3.419-2.305-6.688-3.973-9.75c25.009-14.852,55.645-35.05,75.947-55.353c39.547-39.547,52.023-68.458,40.44-80.042
+ c-2.747-2.748-6.472-4.142-11.079-4.142c-14.818,0-38.796,14.415-68.963,44.582c-20.282,20.282-40.459,50.873-55.307,75.869
+ c-3.062-1.696-6.33-3.062-9.755-4.062c7.175-28.17,14.535-64.059,14.535-92.735C284.002,61.266,272.382,32,256,32
+ s-28.002,29.266-28.002,85.194c0,28.676,7.362,64.565,14.536,92.735c-3.425,1-6.693,2.365-9.755,4.062
+ c-14.847-24.996-35.023-55.587-55.305-75.869C147.309,107.957,123.33,93.54,108.51,93.54c-4.609,0-8.331,1.394-11.079,4.142
+ c-11.584,11.583,0.894,40.494,40.44,80.041c20.303,20.303,50.938,40.501,75.947,55.353c-1.668,3.062-2.999,6.331-3.974,9.75
+ c-28.194-7.188-64.169-14.578-92.901-14.578C61.016,228.247,32,239.618,32,256s29.016,28.252,84.944,28.252
+ c28.777,0,64.82-7.413,93.034-14.611c1.003,3.392,2.368,6.625,4.055,9.656c-25.048,14.863-55.801,35.119-76.161,55.479
+ c-39.547,39.548-52.023,68.459-40.44,80.043c2.748,2.748,6.471,4.142,11.078,4.142c14.819,0,38.796-14.415,68.963-44.583
+ c20.382-20.381,40.659-51.177,55.526-76.238c3.032,1.657,6.267,2.988,9.651,3.967c-7.211,28.238-14.654,64.367-14.654,93.201
+ C227.998,451.234,239.618,480,256,480s28.002-28.766,28.002-84.693c0-28.834-7.441-64.963-14.652-93.201
+ c3.385-0.979,6.618-2.31,9.65-3.967c14.867,25.062,35.145,55.857,55.527,76.239c30.164,30.165,54.144,44.582,68.963,44.582
+ c4.608,0,8.33-1.394,11.078-4.142c11.584-11.584-0.894-40.495-40.439-80.043c-20.361-20.359-51.114-40.615-76.162-55.479
+ c1.688-3.031,3.053-6.266,4.055-9.656C330.237,276.839,366.28,284.252,395.057,284.252z M319.992,254.941
+ c30.144-7.014,55.893-10.694,75.064-10.694c21.329,0,39.453,1.806,52.41,5.222c9.705,2.559,14.005,5.317,15.736,6.781
+ c-1.731,1.463-6.031,4.221-15.736,6.779c-12.958,3.416-31.081,5.223-52.41,5.223c-19.176,0-44.927-3.68-75.075-10.695
+ L319.992,254.941z M345.841,149.436c35.382-35.383,52.682-39.412,56.818-39.846c-0.211,2.305-1.343,7.326-6.404,15.991
+ c-6.786,11.62-18.35,25.738-33.439,40.828c-13.533,13.534-34.3,29.111-60.513,45.438c-0.619-0.648-1.25-1.283-1.895-1.904
+ C316.732,183.729,332.309,162.968,345.841,149.436z M209.698,211.846c-26.213-16.326-46.979-31.904-60.512-45.437
+ c-15.09-15.091-26.653-29.208-33.439-40.828c-5.061-8.665-6.194-13.687-6.404-15.992c4.138,0.435,21.436,4.463,56.818,39.845
+ c13.533,13.533,29.108,34.295,45.433,60.507C210.948,210.563,210.316,211.198,209.698,211.846z M116.944,268.252
+ c-21.339,0-39.483-1.845-52.471-5.335c-9.689-2.604-13.961-5.394-15.675-6.87c1.75-1.451,6.077-4.177,15.796-6.689
+ c12.927-3.343,31.029-5.11,52.351-5.11c19.172,0,44.922,3.68,75.064,10.694l0.01,2.615
+ C161.87,264.572,136.12,268.252,116.944,268.252z M166.16,363.064c-35.383,35.382-52.68,39.41-56.818,39.846
+ c0.21-2.305,1.343-7.326,6.404-15.992c6.786-11.619,18.349-25.736,33.439-40.828c13.587-13.586,34.457-29.229,60.815-45.625
+ c0.584,0.604,1.181,1.197,1.789,1.779C195.394,328.604,179.749,349.475,166.16,363.064z M302,300.465
+ c26.356,16.395,47.227,32.037,60.814,45.625c15.091,15.092,26.653,29.209,33.439,40.828c5.062,8.666,6.193,13.688,6.403,15.992
+ c-4.138-0.436-21.436-4.464-56.817-39.846c-13.589-13.59-29.234-34.463-45.63-60.82C300.818,301.663,301.415,301.068,302,300.465z
+ M249.222,64.678c2.548-9.703,5.297-14.055,6.778-15.834c1.48,1.78,4.23,6.131,6.777,15.834
+ c3.418,13.015,5.225,31.174,5.225,52.516c0,19.117-3.66,44.781-10.637,74.821h-2.73c-6.977-30.04-10.638-55.704-10.638-74.821
+ C243.998,95.853,245.804,77.693,249.222,64.678z M262.782,447.612c-2.569,9.707-5.339,13.954-6.782,15.636
+ c-1.444-1.682-4.212-5.929-6.782-15.636c-3.415-12.901-5.22-30.988-5.22-52.308c0-19.228,3.701-45.066,10.752-75.316h2.5
+ c7.052,30.25,10.752,56.089,10.752,75.316C268.002,416.624,266.197,434.711,262.782,447.612z M256,288c-17.673,0-32-14.327-32-32
+ s14.327-32,32-32s32,14.327,32,32S273.673,288,256,288z"/>
+ <path d="M344.86,405.678c-24.529-17.674-48.394-51.732-48.394-51.732s7.031,41.059,1.854,75.946
+ c11.678,21.779,26.139,35.253,36.643,35.253c1.749,0,3.432-0.324,5.042-0.976C351.879,459.372,354.39,439.185,344.86,405.678z
+ M333.738,448.566c-2.738-1.46-9.407-6.369-18.992-22.27c0.688-7.872,1.098-16.337,1.219-25.282
+ c5.012,4.88,9.947,9.437,14.747,13.613C335.816,434.408,334.954,444.779,333.738,448.566z"/>
+ <path d="M213.679,82.608c-13.292-23.51-26.139-35.255-36.644-35.255c-1.749,0-3.431,0.325-5.042,0.976
+ c-11.868,4.795-14.497,23.211-4.87,58.441c21.252,15.98,48.374,51.55,48.374,51.55S207.75,117.5,213.679,82.608z M196.038,111.369
+ c-5.001-4.856-9.943-9.398-14.769-13.574c-5.084-19.731-4.223-30.082-3.008-33.863c2.737,1.459,9.407,6.369,18.994,22.27
+ C196.568,94.04,196.161,102.466,196.038,111.369z"/>
+ <path d="M82.357,298.568c-27.422,15.505-38.836,30.402-34.277,41.687c2.806,6.944,10.913,10.675,23.842,10.675
+ c9.182,0,22.434-1.559,34.672-5.826c17.405-23.934,51.712-48.387,51.712-48.387S116.999,302.836,82.357,298.568z M97.637,330.956
+ c-10.088,2.606-18.909,3.974-25.716,3.974c-4.092,0-6.733-0.502-8.223-0.97c1.477-2.755,6.407-9.411,22.253-18.966
+ c7.872,0.689,16.338,1.099,25.284,1.22C106.365,321.218,101.815,326.15,97.637,330.956z"/>
+ <path d="M463.92,172.245c-2.806-6.945-10.914-10.675-23.844-10.675c-9.178,0-21.4,1.715-34.654,5.822
+ c-18.088,23.774-51.699,48.387-51.699,48.387s40.778-7.28,75.918-1.849C457.064,198.426,468.479,183.528,463.92,172.245z
+ M426.047,197.504c-7.867-0.689-16.327-1.097-25.267-1.218c4.869-5.004,9.42-9.939,13.6-14.749
+ c10.081-2.602,18.895-3.968,25.697-3.968c4.093,0,6.733,0.502,8.225,0.97C446.824,181.294,441.893,187.951,426.047,197.504z"/>
+ <path d="M163.135,408.98c-8.42,30.34-5.956,48.938,5.244,53.69c1.674,0.711,3.437,1.066,5.275,1.066
+ c11.107,0,24.698-13.124,39.528-39.015c-4.184-32.22,2.351-70.779,2.351-70.779S193.999,385.336,163.135,408.98z M174.981,447.207
+ c-0.904-2.966-2.147-11.15,2.312-29.159c6.048-5.079,12.323-10.782,18.743-17.032c0.095,6.979,0.366,13.687,0.81,20.039
+ C186.466,438.66,178.52,445.39,174.981,447.207z"/>
+ <path d="M343.622,49.826c-1.674-0.71-3.438-1.066-5.274-1.066c-11.105,0-26.207,14.287-39.527,39.013
+ c4.514,22.894-2.393,71.053-2.393,71.053s23.239-34.326,52.342-54.956C357.167,72,354.865,54.599,343.622,49.826z M334.627,94.781
+ c-6.029,5.051-12.277,10.72-18.66,16.931c-0.092-7.062-0.364-13.846-0.812-20.269c10.379-17.607,18.327-24.336,21.864-26.153
+ C337.93,68.274,339.186,76.541,334.627,94.781z"/>
+ <path d="M103.209,163.367C93,159.5,80.717,158.366,72.457,158.366c-12.267,0-20.042,3.573-22.881,10.261
+ c-5.004,11.792,9.97,29.985,37.948,44.805c29.726-3.932,70.688,2.336,70.688,2.336S121,187.067,103.209,163.367z M65.034,175.215
+ c1.381-0.414,3.775-0.848,7.424-0.848c5.815,0,13.242,1.088,21.687,3.165c5.077,6.049,10.781,12.33,17.034,18.754
+ c-6.959,0.096-13.648,0.367-19.984,0.81C73.563,186.7,66.84,178.745,65.034,175.215z"/>
+ <path d="M424.477,299.066c-25.307,5.6-70.78-2.35-70.78-2.35s34.638,25.615,55.014,52.393c11.959,4.223,22.555,5.022,30.833,5.022
+ c12.266,0,20.041-3.573,22.88-10.261C467.428,332.08,454.283,315.801,424.477,299.066z M439.542,338.132
+ c-5.833,0-13.287-1.095-21.765-3.185c-5.078-6.053-10.774-12.326-17.013-18.734c6.98-0.095,13.688-0.365,20.041-0.811
+ c17.631,10.396,24.354,18.352,26.158,21.882C445.585,337.697,443.19,338.132,439.542,338.132z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flower.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flower.svg
new file mode 100644
index 00000000..38029b5b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flower.svg
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M395.057,228.247c-28.651,0-64.502,7.35-92.66,14.518c-0.98-3.443-2.321-6.734-4.001-9.817
+ c24.97-14.84,55.487-34.98,75.733-55.224c39.547-39.547,52.023-68.458,40.44-80.042c-11.584-11.583-40.495,0.893-80.042,40.44
+ c-20.225,20.225-40.343,50.698-55.178,75.654c-3.082-1.708-6.373-3.083-9.822-4.089c7.156-28.133,14.475-63.897,14.475-92.492
+ C284.002,61.266,272.382,32,256,32s-28.002,29.266-28.002,85.194c0,28.595,7.319,64.359,14.475,92.492
+ c-3.449,1.006-6.74,2.381-9.822,4.089c-14.835-24.956-34.953-55.43-55.176-75.653c-39.548-39.547-68.458-52.024-80.042-40.44
+ c-11.584,11.583,0.894,40.494,40.44,80.041c20.246,20.244,50.762,40.384,75.732,55.224c-1.68,3.083-3.021,6.374-4.001,9.817
+ c-28.158-7.168-64.008-14.518-92.659-14.518C61.016,228.247,32,239.618,32,256s29.016,28.252,84.944,28.252
+ c28.697,0,64.613-7.371,92.792-14.551c1.01,3.414,2.384,6.671,4.083,9.724c-25.009,14.852-55.645,35.049-75.946,55.351
+ c-39.547,39.548-52.023,68.459-40.44,80.043c11.584,11.584,40.495-0.895,80.042-40.441c20.323-20.323,40.542-51.001,55.398-76.024
+ c3.053,1.671,6.31,3.01,9.718,3.995c-7.192,28.203-14.592,64.207-14.592,92.959c0,55.929,11.62,84.693,28.002,84.693
+ s28.002-28.766,28.002-84.693c0-28.752-7.4-64.756-14.592-92.959c3.408-0.985,6.665-2.324,9.718-3.995
+ c14.855,25.023,35.073,55.701,55.399,76.025c39.547,39.547,68.457,52.024,80.041,40.44s-0.894-40.495-40.439-80.043
+ c-20.304-20.302-50.938-40.499-75.947-55.351c1.699-3.053,3.073-6.31,4.083-9.724c28.18,7.18,64.096,14.551,92.792,14.551
+ c55.929,0,84.943-11.62,84.943-28.002S450.984,228.247,395.057,228.247z"/>
+ <path d="M296.467,353.945c0,0,7.031,41.059,1.854,75.946c11.678,21.779,26.139,35.253,36.643,35.253
+ c1.749,0,3.432-0.324,5.042-0.976c11.874-4.797,14.385-24.984,4.855-58.491C320.331,388.004,296.467,353.945,296.467,353.945z"/>
+ <path d="M215.497,158.32c0,0-7.747-40.82-1.818-75.712c-13.292-23.51-26.139-35.255-36.644-35.255
+ c-1.749,0-3.431,0.325-5.042,0.976c-11.868,4.795-14.497,23.211-4.87,58.441C188.375,122.75,215.497,158.32,215.497,158.32z"/>
+ <path d="M158.306,296.717c0,0-41.308,6.119-75.949,1.852c-27.422,15.505-38.836,30.402-34.277,41.687
+ c2.806,6.944,10.913,10.675,23.842,10.675c9.182,0,22.434-1.559,34.672-5.826C123.999,321.17,158.306,296.717,158.306,296.717z"/>
+ <path d="M353.723,215.779c0,0,40.778-7.28,75.918-1.849c27.424-15.504,38.838-30.402,34.279-41.685
+ c-2.806-6.945-10.914-10.675-23.844-10.675c-9.178,0-21.4,1.715-34.654,5.822C387.334,191.166,353.723,215.779,353.723,215.779z"/>
+ <path d="M163.135,408.98c-8.42,30.34-5.956,48.938,5.244,53.69c1.674,0.711,3.437,1.066,5.275,1.066
+ c11.107,0,24.698-13.124,39.528-39.015c-4.184-32.22,2.351-70.779,2.351-70.779S193.999,385.336,163.135,408.98z"/>
+ <path d="M348.77,103.87c8.397-31.87,6.096-49.271-5.147-54.044c-1.674-0.71-3.438-1.066-5.274-1.066
+ c-11.105,0-26.207,14.287-39.527,39.013c4.514,22.894-2.393,71.053-2.393,71.053S319.667,124.5,348.77,103.87z"/>
+ <path d="M87.524,213.432c29.726-3.932,70.688,2.336,70.688,2.336S121,187.067,103.209,163.367
+ C93,159.5,80.717,158.366,72.457,158.366c-12.267,0-20.042,3.573-22.881,10.261C44.572,180.419,59.546,198.612,87.524,213.432z"/>
+ <path d="M424.477,299.066c-25.307,5.6-70.78-2.35-70.78-2.35s34.638,25.615,55.014,52.393c11.959,4.223,22.555,5.022,30.833,5.022
+ c12.266,0,20.041-3.573,22.88-10.261C467.428,332.08,454.283,315.801,424.477,299.066z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-folder-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-folder-outline.svg
new file mode 100644
index 00000000..c337acbe
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-folder-outline.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M457,96H215c-2.791,0-4.271-0.585-6.094-2.408l-22.501-22.501l-0.168-0.162C181.365,66.333,177.361,64,169,64H57
+ c-13.785,0-25,10.317-25,23v336c0,13.317,11.683,25,25,25h400c12.683,0,23-11.215,23-25V119C480,105.673,470.327,96,457,96z M57,80
+ h112c3.497,0,3.737,0.189,6.175,2.488l22.417,22.418c4.84,4.84,10.372,7.094,17.408,7.094h242c4.448,0,7,2.552,7,7v42.376
+ c-2.504-0.888-5.195-1.376-8-1.376H56c-2.805,0-5.496,0.488-8,1.376V87C48,82.677,52.672,80,57,80z M464,423c0,4.328-2.677,9-7,9H57
+ c-4.458,0-9-4.542-9-9V184c0-4.411,3.589-8,8-8h400c4.411,0,8,3.589,8,8V423z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-folder.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-folder.svg
new file mode 100644
index 00000000..bd31bf59
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-folder.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M472,176H40c-4.411,0-8,3.589-8,8v239c0,13.317,11.683,25,25,25h400c12.683,0,23-11.215,23-25V184
+ C480,179.589,476.411,176,472,176z"/>
+ <path d="M457,96H215c-2.791,0-4.271-0.585-6.094-2.408l-22.501-22.501l-0.168-0.162C181.365,66.333,177.361,64,169,64H57
+ c-13.785,0-25,10.317-25,23v74.376c2.504-0.888,5.195-1.376,8-1.376h432c2.805,0,5.496,0.488,8,1.376V119
+ C480,105.673,470.327,96,457,96z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-football-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-football-outline.svg
new file mode 100644
index 00000000..23844844
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-football-outline.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,48C141.137,48,48,141.136,48,256c0,114.864,93.137,208,208,208c114.872,0,208-93.138,208-208
+ C464,141.138,370.87,48,256,48z M297.151,442.179c-13.514,2.657-30.327,4.187-44,4.45c-13.198-0.195-26.074-1.735-38.5-4.493
+ c-2.144-0.549-4.383-1.138-6.805-1.777l-24.417-65.435L203.074,336h105.854l0.57,1.076l19.34,38.852L305.22,440.21
+ C302.553,440.924,299.862,441.579,297.151,442.179z M89.317,163.522l18.188,52.284l0.175,0.504L65.376,252.92
+ C65.892,220.535,74.52,190.088,89.317,163.522z M189.578,77.28L247,116.576v58.147l-70.997,60.067L126.6,212.28l-4.167-1.899
+ l-22.332-64.019C122.11,115.158,153.239,90.83,189.578,77.28z M325.025,247.206l0.921,0.765L307.569,320H204.431l-18.485-72.453
+ l0.445-0.376l68.873-58.27L325.025,247.206z M446.626,252.921l-42.454-36.738l0.127-0.364l18.298-52.451
+ C437.447,189.972,446.109,220.473,446.626,252.921z M411.564,146.067l-22.432,64.483l-53.992,24.388L264,174.723v-58.147
+ l57.596-39.415C357.958,90.644,389.501,114.913,411.564,146.067z M66.144,273.414l53.756-46.518l49.539,22.599l0.559,0.255
+ l19.718,77.287l-20.433,38.529l-69.86-0.915C81.075,338.291,69.209,307.105,66.144,273.414z M342.719,365.565l-20.434-38.529
+ l19.752-77.416l49.997-22.781l53.822,46.575c-3.065,33.691-14.932,64.877-33.277,91.236L342.719,365.565z M255.257,102.67
+ l-46.126-31.498c15-3.806,30.701-5.836,46.869-5.835c15.961,0,31.466,1.982,46.293,5.694L255.257,102.67z M166.423,381.529
+ l0.848,2.511l19.946,49.781c-29.239-11.351-55.011-29.704-75.232-53.006L166.423,381.529z M324.563,433.904l17.934-48.608
+ l1.627-3.748l55.892-0.732C379.744,404.175,353.893,422.562,324.563,433.904z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-football.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-football.svg
new file mode 100644
index 00000000..34151ac0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-football.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,48C141.137,48,48,141.136,48,256c0,114.864,93.137,208,208,208c114.872,0,208-93.138,208-208
+ C464,141.138,370.87,48,256,48z M297.151,442.179c-13.514,2.657-30.327,4.187-44,4.45c-13.198-0.195-26.074-1.735-38.5-4.493
+ c-2.144-0.549-4.383-1.138-6.805-1.777l-24.417-65.435L203.074,336h105.854l0.57,1.076l19.34,38.852L305.22,440.21
+ C302.553,440.924,299.862,441.579,297.151,442.179z M189.578,77.28L247,116.576v58.147l-70.997,60.067L126.6,212.28l-4.167-1.899
+ l-22.332-64.019C122.11,115.158,153.239,90.83,189.578,77.28z M411.564,146.067l-22.432,64.483l-53.992,24.388L264,174.723v-58.147
+ l57.596-39.415C357.958,90.644,389.501,114.913,411.564,146.067z M66.144,273.414l53.756-46.518l49.539,22.599l0.559,0.255
+ l19.718,77.287l-20.433,38.529l-69.86-0.915C81.075,338.291,69.209,307.105,66.144,273.414z M342.719,365.565l-20.434-38.529
+ l19.752-77.416l49.997-22.781l53.822,46.575c-3.065,33.691-14.932,64.877-33.277,91.236L342.719,365.565z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-a-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-a-outline.svg
new file mode 100644
index 00000000..9721587c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-a-outline.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M194.822,240H160v-34.762c0-2.817-2.604-5.238-5.303-5.238h-22.145c-2.698,0-4.552,2.372-4.552,5.178V240H92.533
+ c-2.615,0-4.533,2.143-4.533,4.771v21.427c0,2.698,2.031,5.803,4.861,5.803H128v35.467c0,2.615,2.143,4.533,4.771,4.533h21.427
+ c2.698,0,5.803-2.031,5.803-4.861V272h34.762c2.817,0,5.238-2.604,5.238-5.303v-22.145C200,241.854,197.628,240,194.822,240z"/>
+ <path d="M362.314,279.063c-10.736,0-19.451,8.515-19.451,19.153c0,10.555,8.715,19.084,19.451,19.084
+ c10.783,0,19.498-8.529,19.498-19.084C381.812,287.578,373.098,279.063,362.314,279.063z"/>
+ <path d="M319.766,237.165c-10.736,0-19.451,8.603-19.451,19.168c0,10.566,8.715,19.153,19.451,19.153
+ c10.783,0,19.498-8.587,19.498-19.153C339.264,245.768,330.549,237.165,319.766,237.165z"/>
+ <path d="M404.862,237.165c-10.729,0-19.442,8.603-19.442,19.168c0,10.566,8.714,19.153,19.442,19.153
+ c10.737,0,19.452-8.587,19.452-19.153C424.314,245.768,415.6,237.165,404.862,237.165z"/>
+ <path d="M362.314,195.301c-10.736,0-19.451,8.602-19.451,19.169c0,10.566,8.715,19.146,19.451,19.146
+ c10.783,0,19.498-8.579,19.498-19.146C381.812,203.902,373.098,195.301,362.314,195.301z"/>
+ </g>
+ <path d="M369.269,162c25.838,0,49.704,9.314,67.204,26.229C454.225,205.386,464,229.247,464,255.418
+ c0,26.303-9.806,50.405-27.611,67.869c-17.563,17.226-41.4,26.713-67.12,26.713H142.739c-25.712,0-49.548-9.487-67.117-26.715
+ C57.81,305.818,48,281.717,48,255.418c0-26.167,9.78-50.028,27.539-67.188C93.043,171.315,116.909,162,142.739,162H369.269
+ M369.269,146H142.739C81.541,146,32,191.458,32,255.418C32,319.419,81.541,366,142.739,366h226.529
+ C430.49,366,480,319.419,480,255.418C480,191.458,430.49,146,369.269,146L369.269,146z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-a.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-a.svg
new file mode 100644
index 00000000..db7240be
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-a.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M369.269,146H142.739C81.541,146,32,191.458,32,255.418C32,319.419,81.541,366,142.739,366h226.529
+ C430.49,366,480,319.419,480,255.418C480,191.458,430.49,146,369.269,146z M200,266.697c0,2.698-2.421,5.303-5.238,5.303H160
+ v35.139c0,2.83-3.104,4.861-5.803,4.861h-21.427c-2.628,0-4.771-1.918-4.771-4.533V272H92.861c-2.83,0-4.861-3.104-4.861-5.803
+ v-21.427c0-2.628,1.918-4.771,4.533-4.771H128v-34.822c0-2.806,1.854-5.178,4.553-5.178h22.145c2.698,0,5.303,2.421,5.303,5.238
+ V240h34.822c2.806,0,5.178,1.854,5.178,4.553V266.697z M319.766,275.486c-10.736,0-19.451-8.587-19.451-19.153
+ c0-10.565,8.715-19.168,19.451-19.168c10.783,0,19.498,8.603,19.498,19.168C339.264,266.899,330.549,275.486,319.766,275.486z
+ M362.314,317.301c-10.736,0-19.451-8.529-19.451-19.084c0-10.639,8.715-19.153,19.451-19.153c10.783,0,19.498,8.515,19.498,19.153
+ C381.812,308.771,373.098,317.301,362.314,317.301z M362.314,233.615c-10.736,0-19.451-8.579-19.451-19.146
+ c0-10.567,8.715-19.169,19.451-19.169c10.783,0,19.498,8.602,19.498,19.169C381.812,225.036,373.098,233.615,362.314,233.615z
+ M404.862,275.486c-10.729,0-19.442-8.587-19.442-19.153c0-10.565,8.714-19.168,19.442-19.168c10.737,0,19.452,8.603,19.452,19.168
+ C424.314,266.899,415.6,275.486,404.862,275.486z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-b-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-b-outline.svg
new file mode 100644
index 00000000..e462f00c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-b-outline.svg
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M308.076,203.929c-11.058,0-20.076,9.014-20.076,20.104c0,11.089,9.019,20.107,20.076,20.107
+ c11.131,0,20.148-9.019,20.148-20.107C328.225,212.942,319.207,203.929,308.076,203.929z"/>
+ <path d="M351.988,247.878c-11.058,0-20.053,8.949-20.053,20.106c0,11.064,8.995,20.016,20.053,20.016
+ c11.146,0,20.148-8.951,20.148-20.016C372.137,256.827,363.134,247.878,351.988,247.878z"/>
+ <path d="M135.234,184.367C113.594,184.367,96,202.17,96,224.01c0,21.865,17.594,39.623,39.234,39.623
+ c21.655,0,39.249-17.758,39.249-39.623C174.483,202.17,156.89,184.367,135.234,184.367z M135.123,243.457
+ c-10.688,0-19.343-8.721-19.343-19.447c0-10.725,8.655-19.441,19.343-19.441c10.641,0,19.297,8.717,19.297,19.441
+ C154.42,234.736,145.764,243.457,135.123,243.457z"/>
+ <path d="M351.988,160c-11.058,0-20.053,9.014-20.053,20.107c0,11.09,8.995,20.083,20.053,20.083
+ c11.146,0,20.148-8.993,20.148-20.083C372.137,169.014,363.134,160,351.988,160z"/>
+ <path d="M395.947,203.929c-11.105,0-20.101,9.014-20.101,20.104c0,11.089,8.995,20.107,20.101,20.107
+ c11.059,0,20.053-9.019,20.053-20.107C416,212.942,407.006,203.929,395.947,203.929z"/>
+ </g>
+ <path d="M466.279,248.866c-21.157-88.471-43.631-135.489-88.454-148.83C368.06,97.135,359.748,96,352.076,96
+ c-27.598,0-46.938,14.683-96.08,14.683c-49.174,0-68.502-14.681-96.062-14.683c-7.665,0-15.963,1.135-25.721,4.036
+ c-44.869,13.341-67.342,60.359-88.461,148.83c-21.181,88.473-17.334,152.363,7.679,164.289C57.502,415.1,61.662,416,65.885,416
+ c21.694,0,45.139-23.838,67.659-52.047C159.198,331.848,165.658,331,243.822,331h24.343c78.147,0,84.628,0.846,110.282,32.953
+ c22.526,28.207,45.97,52.004,67.665,52.004c4.226,0,8.384-0.879,12.457-2.823C483.574,401.208,487.421,337.339,466.279,248.866z
+ M451.677,398.716c-1.835,0.876-3.604,1.284-5.564,1.284c-6.022,0-14.077-4.049-23.295-11.708
+ c-9.181-7.63-19.307-18.509-31.87-34.239c-12.959-16.22-23.667-28.229-43.528-33.949c-16.647-4.793-38.624-5.104-79.254-5.104
+ h-24.343c-40.633,0-62.611,0.311-79.259,5.105c-19.853,5.719-30.56,17.685-43.523,33.908
+ c-12.556,15.727-22.68,26.627-31.862,34.258c-9.216,7.658-17.27,11.718-23.293,11.718c-1.932,0-3.751-0.415-5.568-1.282
+ c-9.556-4.557-22.572-47.673,0.998-146.129c21.387-89.591,42.381-126.777,77.459-137.207c7.633-2.27,14.554-3.372,21.159-3.372
+ c9.742,0,18.599,2.317,29.812,5.249c16.07,4.203,36.072,9.435,66.252,9.435c30.148,0,50.146-5.228,66.215-9.429
+ c11.229-2.936,20.1-5.254,29.865-5.254c6.618,0,13.551,1.104,21.185,3.371c35.037,10.428,56.03,47.617,77.456,137.214
+ C474.244,351.041,461.23,394.16,451.677,398.716z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-b.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-b.svg
new file mode 100644
index 00000000..97fdcaee
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-b.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M135.123,204.568c-10.688,0-19.343,8.717-19.343,19.441c0,10.727,8.655,19.447,19.343,19.447
+ c10.641,0,19.297-8.721,19.297-19.447C154.42,213.285,145.764,204.568,135.123,204.568z"/>
+ <path d="M466.279,248.866c-21.157-88.471-43.631-135.489-88.454-148.83C368.06,97.135,359.748,96,352.076,96
+ c-27.598,0-46.938,14.683-96.08,14.683c-49.174,0-68.502-14.681-96.062-14.683c-7.665,0-15.963,1.135-25.721,4.036
+ c-44.869,13.341-67.342,60.359-88.461,148.83c-21.181,88.473-17.334,152.363,7.679,164.289C57.502,415.1,61.662,416,65.885,416
+ c21.694,0,45.139-23.838,67.659-52.047C159.198,331.848,165.658,331,243.822,331h24.343c78.147,0,84.628,0.846,110.282,32.953
+ c22.526,28.207,45.97,52.004,67.665,52.004c4.226,0,8.384-0.879,12.457-2.823C483.574,401.208,487.421,337.339,466.279,248.866z
+ M135.234,263.633C113.594,263.633,96,245.875,96,224.01c0-21.84,17.594-39.643,39.234-39.643
+ c21.655,0,39.249,17.803,39.249,39.643C174.483,245.875,156.89,263.633,135.234,263.633z M308.076,244.14
+ c-11.058,0-20.076-9.019-20.076-20.107c0-11.09,9.019-20.104,20.076-20.104c11.131,0,20.148,9.014,20.148,20.104
+ C328.225,235.121,319.207,244.14,308.076,244.14z M351.988,288c-11.058,0-20.053-8.951-20.053-20.016
+ c0-11.157,8.995-20.106,20.053-20.106c11.146,0,20.148,8.949,20.148,20.106C372.137,279.049,363.134,288,351.988,288z
+ M351.988,200.19c-11.058,0-20.053-8.993-20.053-20.083c0-11.094,8.995-20.107,20.053-20.107c11.146,0,20.148,9.014,20.148,20.107
+ C372.137,191.197,363.134,200.19,351.988,200.19z M395.947,244.14c-11.105,0-20.101-9.019-20.101-20.107
+ c0-11.09,8.995-20.104,20.101-20.104c11.059,0,20.053,9.014,20.053,20.104C416,235.121,407.006,244.14,395.947,244.14z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-gear-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-gear-outline.svg
new file mode 100644
index 00000000..e5473bc4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-gear-outline.svg
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M256.9,159.9c-25.701,0-49.801,10-67.9,28.1s-28.1,42.199-28.1,67.9c0,25.699,10,49.699,28.1,67.9
+ c18.1,18.1,42.301,28.1,67.9,28.1c25.699,0,49.799-10,67.9-28.1c18.1-18.102,28.1-42.201,28.1-67.9c0-25.701-10-49.701-28.1-67.9
+ C306.699,169.9,282.6,159.9,256.9,159.9z M256.9,335.9c-44.301,0-80-35.9-80-80c0-44.101,35.699-80,80-80
+ c44.299,0,80,35.899,80,80C336.9,300,301.199,335.9,256.9,335.9z"/>
+ </g>
+ <g>
+ <path d="M201.787,82.828c4.458,6.628,10.119,12.406,16.775,17.069c11.012,7.715,23.957,11.793,37.438,11.793
+ c13.481,0,26.428-4.078,37.439-11.793c6.654-4.663,12.316-10.441,16.773-17.068c10.326,3.228,20.334,7.378,29.927,12.411
+ c-1.532,7.84-1.614,15.93-0.203,23.933c2.333,13.235,8.604,25.269,18.133,34.798c12.335,12.336,28.737,19.129,46.185,19.129
+ c4.242,0,8.424-0.399,12.52-1.195c5.032,9.6,9.181,19.613,12.405,29.947c-6.622,4.46-12.396,10.121-17.054,16.776
+ c-7.705,11.008-11.777,23.946-11.776,37.418c0,13.467,4.069,26.401,11.768,37.406c4.653,6.651,10.421,12.312,17.036,16.771
+ c-3.232,10.34-7.387,20.354-12.428,29.957c-4.081-0.789-8.246-1.187-12.472-1.187c-17.448,0-33.85,6.795-46.183,19.131
+ c-9.515,9.514-15.781,21.527-18.123,34.74c-1.415,7.988-1.343,16.065,0.176,23.895c-9.607,5.04-19.627,9.192-29.967,12.421
+ c-4.461-6.61-10.121-12.374-16.771-17.022c-11-7.689-23.928-11.754-37.386-11.754c-13.457,0-26.385,4.064-37.385,11.755
+ c-6.649,4.648-12.31,10.412-16.771,17.021c-10.339-3.228-20.359-7.381-29.966-12.42c1.519-7.829,1.591-15.906,0.176-23.895
+ c-2.342-13.214-8.608-25.228-18.123-34.741c-12.335-12.336-28.737-19.13-46.185-19.13c-4.226,0-8.39,0.396-12.471,1.187
+ c-5.04-9.602-9.195-19.618-12.428-29.958c6.615-4.46,12.383-10.119,17.036-16.771c7.699-11.004,11.769-23.939,11.769-37.408
+ c0-13.471-4.072-26.41-11.777-37.418c-4.658-6.654-10.432-12.316-17.054-16.776c3.225-10.333,7.372-20.346,12.405-29.946
+ c4.096,0.796,8.277,1.196,12.521,1.196c17.446,0,33.849-6.794,46.185-19.13c9.529-9.53,15.799-21.563,18.133-34.799
+ c1.411-8.003,1.33-16.093-0.203-23.932C181.455,90.207,191.461,86.057,201.787,82.828 M302.074,64
+ C294.971,82.529,277.027,95.69,256,95.69c-21.025,0-38.969-13.161-46.073-31.69c-20.466,4.895-39.692,12.973-57.128,23.688
+ c8.068,18.122,4.682,40.104-10.182,54.97c-9.631,9.631-22.25,14.443-34.87,14.443c-6.854,0-13.706-1.419-20.083-4.255
+ C76.958,170.284,68.887,189.517,64,209.984c18.51,7.112,31.652,25.049,31.652,46.062c0,21.008-13.133,38.936-31.631,46.054
+ c4.898,20.466,12.977,39.692,23.693,57.128c6.36-2.821,13.197-4.232,20.031-4.232c12.621,0,25.238,4.812,34.871,14.443
+ c14.841,14.841,18.238,36.781,10.215,54.889c17.438,10.71,36.664,18.783,57.131,23.673c7.127-18.479,25.046-31.596,46.037-31.596
+ c20.992,0,38.91,13.115,46.037,31.596c20.468-4.89,39.693-12.964,57.132-23.675c-8.023-18.106-4.626-40.046,10.216-54.887
+ c9.629-9.632,22.248-14.444,34.868-14.444c6.836,0,13.67,1.411,20.033,4.233c10.716-17.436,18.794-36.662,23.692-57.128
+ c-18.498-7.118-31.63-25.048-31.63-46.054c-0.001-21.013,13.143-38.948,31.651-46.062c-4.887-20.466-12.957-39.7-23.664-57.139
+ c-6.375,2.836-13.23,4.254-20.082,4.254c-12.621,0-25.238-4.811-34.871-14.442c-14.863-14.863-18.248-36.846-10.18-54.97
+ C341.768,76.973,322.54,68.895,302.074,64L302.074,64z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-gear.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-gear.svg
new file mode 100644
index 00000000..857d91ed
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-gear.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M416.349,256.046c-0.001-21.013,13.143-38.948,31.651-46.062c-4.887-20.466-12.957-39.7-23.664-57.139
+ c-6.375,2.836-13.23,4.254-20.082,4.254c-12.621,0-25.238-4.811-34.871-14.442c-14.863-14.863-18.248-36.846-10.18-54.97
+ C341.768,76.973,322.54,68.895,302.074,64C294.971,82.529,277.027,95.69,256,95.69c-21.025,0-38.969-13.161-46.073-31.69
+ c-20.466,4.895-39.693,12.973-57.128,23.688c8.068,18.122,4.683,40.104-10.181,54.97c-9.631,9.631-22.25,14.443-34.871,14.443
+ c-6.854,0-13.706-1.419-20.083-4.255C76.958,170.284,68.886,189.517,64,209.984c18.509,7.112,31.652,25.049,31.652,46.062
+ c0,21.008-13.132,38.936-31.63,46.054c4.898,20.466,12.976,39.692,23.692,57.128c6.361-2.821,13.198-4.232,20.032-4.232
+ c12.622,0,25.239,4.812,34.871,14.443c14.841,14.841,18.239,36.781,10.215,54.889c17.438,10.71,36.664,18.783,57.13,23.673
+ c7.128-18.479,25.046-31.596,46.038-31.596c20.992,0,38.91,13.115,46.037,31.596c20.468-4.89,39.693-12.964,57.132-23.675
+ c-8.023-18.106-4.626-40.046,10.216-54.887c9.629-9.632,22.248-14.444,34.868-14.444c6.836,0,13.67,1.411,20.033,4.233
+ c10.716-17.436,18.794-36.662,23.692-57.128C429.48,294.981,416.349,277.052,416.349,256.046z M256.9,335.9c-44.3,0-80-35.9-80-80
+ c0-44.101,35.7-80,80-80c44.299,0,80,35.899,80,80C336.9,300,301.199,335.9,256.9,335.9z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-glasses-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-glasses-outline.svg
new file mode 100644
index 00000000..e492b987
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-glasses-outline.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M465.4,247c-2.2-22-12.4-43-28.9-58.4c-17.1-15.9-39.3-24.7-62.7-24.7c-41.5,0-77.3,27.4-88.5,67c-7-7-18.5-11.7-29.3-11.7
+ c-10.8,0-22.3,4.7-29.3,11.7c-11.2-39.6-47-67-88.5-67c-23.3,0-45.6,8.7-62.7,24.6C59,204,48.8,225,46.6,247H32v18h14.6
+ c2.2,22,12.4,43,28.9,58.4c17.1,15.9,39.3,24.7,62.7,24.7c50.8,0,92.1-41.2,92.1-92c0-0.1,0-0.1,0-0.1h0c0-9.9,11.5-21.6,25.7-21.6
+ s25.7,11.7,25.7,21.6h0c0,0,0,0,0,0.1c0,50.8,41.3,92,92.1,92c23.3,0,45.6-8.7,62.7-24.7c16.5-15.4,26.7-36.5,28.9-58.5H480v-18
+ H465.4z M373.8,333c-42.5,0-77-34.6-77-77c0-42.5,34.6-77,77-77c42.5,0,77,34.6,77,77C450.8,298.5,416.3,333,373.8,333z M138.2,333
+ c-42.5,0-77-34.6-77-77c0-42.5,34.6-77,77-77c42.5,0,77,34.6,77,77C215.2,298.5,180.7,333,138.2,333z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-glasses.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-glasses.svg
new file mode 100644
index 00000000..0bf51ee9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-glasses.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M465.4,247c-2.2-22-12.4-43-28.9-58.4c-17.1-15.9-39.3-24.7-62.7-24.7c-41.5,0-77.3,27.4-88.5,67c-7-7-18.5-11.7-29.3-11.7
+ c-10.8,0-22.3,4.7-29.3,11.7c-11.2-39.6-47-67-88.5-67c-23.3,0-45.6,8.7-62.7,24.6C59,204,48.8,225,46.6,247H32v18h14.6
+ c2.2,22,12.4,43,28.9,58.4c17.1,15.9,39.3,24.7,62.7,24.7c50.8,0,92.1-41.2,92.1-92c0-0.1,0-0.1,0-0.1h0c0-9.9,11.5-21.6,25.7-21.6
+ s25.7,11.7,25.7,21.6h0c0,0,0,0,0,0.1c0,50.8,41.3,92,92.1,92c23.3,0,45.6-8.7,62.7-24.7c16.5-15.4,26.7-36.5,28.9-58.5H480v-18
+ H465.4z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-grid-view-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-grid-view-outline.svg
new file mode 100644
index 00000000..86f4b545
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-grid-view-outline.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M448,192v-16H336V64h-16v112H192V64h-16v112H64v16h112v128H64v16h112v112h16V336h128v112h16V336h112v-16H336V192H448z
+ M320,320H192V192h128V320z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-grid-view.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-grid-view.svg
new file mode 100644
index 00000000..e384d4b1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-grid-view.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <rect x="192" y="192" width="128" height="128"/>
+ <path d="M64,64v384h384V64H64z M416,192h-80v128h80v16h-80v80h-16v-80H192v80h-16v-80H96v-16h80V192H96v-16h80V96h16v80h128V96h16
+ v80h80V192z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-heart-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-heart-outline.svg
new file mode 100644
index 00000000..227163dd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-heart-outline.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M359.385,80C319.966,80,277.171,97.599,256,132.8C234.83,97.599,192.034,80,152.615,80C83.647,80,32,123.238,32,195.779
+ c0,31.288,12.562,71.924,40.923,105.657c28.359,33.735,45.229,51.7,100.153,88C228,425.738,256,432,256,432s28-6.262,82.924-42.564
+ c54.923-36.3,71.794-54.265,100.153-88C467.438,267.703,480,227.067,480,195.779C480,123.238,428.353,80,359.385,80z
+ M426.83,291.141c-26.852,31.94-42.18,48.895-96.729,84.947c-40.237,26.596-65.252,36.301-74.102,39.233
+ c-8.85-2.933-33.864-12.639-74.102-39.233c-54.548-36.052-69.876-53.006-96.729-84.948c-12.065-14.351-21.857-31.274-28.316-48.943
+ C51.062,226.355,48,210.304,48,195.779c0-30.284,10.131-55.643,29.297-73.335c9.14-8.437,20.158-14.992,32.752-19.484
+ C122.994,98.341,137.315,96,152.615,96c38.018,0,73.217,17.682,89.674,45.046L256,163.844l13.711-22.798
+ C286.169,113.682,321.368,96,359.385,96c15.3,0,29.621,2.341,42.566,6.959c12.594,4.493,23.612,11.048,32.752,19.484
+ C453.869,140.136,464,165.495,464,195.779c0,14.525-3.062,30.576-8.854,46.418C448.688,259.865,438.896,276.789,426.83,291.141z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-heart.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-heart.svg
new file mode 100644
index 00000000..73b087ae
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-heart.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M359.385,80C319.966,80,277.171,97.599,256,132.8C234.83,97.599,192.034,80,152.615,80C83.647,80,32,123.238,32,195.779
+ c0,31.288,12.562,71.924,40.923,105.657c28.359,33.735,45.229,51.7,100.153,88C228,425.738,256,432,256,432s28-6.262,82.924-42.564
+ c54.923-36.3,71.794-54.265,100.153-88C467.438,267.703,480,227.067,480,195.779C480,123.238,428.353,80,359.385,80z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help-empty.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help-empty.svg
new file mode 100644
index 00000000..a1ec8ddd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help-empty.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M260.3,366c-9.4,0-17-7.5-17-16.9c0-9.3,7.6-16.8,17-16.8c9.4,0,17,7.5,17,16.8C277.3,358.5,269.7,366,260.3,366z
+ M294.1,250.7c-22.8,22.5-22.2,27.4-23.3,53.3h-19c1.1-28.5,7.5-43.7,30.1-64.5c11-10.3,19.4-22.7,19.4-38.1
+ c0-23.6-19.4-39.9-42.6-39.9c-32.4,0-48.5,16.4-47.9,46.4H192c0.3-42,24.4-62.1,67.6-62.1c33,0,60.4,20.4,60.4,54.6
+ C320,222.3,309.3,236.6,294.1,250.7z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help-outline.svg
new file mode 100644
index 00000000..63574389
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help-outline.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <g>
+ <path d="M256,48C141.1,48,48,141.1,48,256c0,114.9,93.1,208,208,208c114.9,0,208-93.1,208-208C464,141.1,370.9,48,256,48z
+ M256,446.7c-105.1,0-190.7-85.5-190.7-190.7c0-105.1,85.5-190.7,190.7-190.7c105.1,0,190.7,85.5,190.7,190.7
+ C446.7,361.1,361.1,446.7,256,446.7z"/>
+ </g>
+ </g>
+ <g>
+ <path d="M259.6,146c-43.2,0-67.3,20.3-67.6,62.2h18.8c-0.6-30.4,15.5-46.5,47.9-46.5c23.2,0,42.6,16.2,42.6,39.8
+ c0,15.3-8.3,27.7-19.4,38.1c-22.6,20.8-29,36-30.1,64.5h19c1.1-25.8,0.5-30.7,23.3-53.3c15.2-14.2,25.9-28.3,25.9-50.2
+ C320,166.4,292.6,146,259.6,146z"/>
+ <path d="M260.3,332.3c-9.4,0-17,7.5-17,16.8c0,9.3,7.6,16.9,17,16.9c9.4,0,17-7.5,17-16.9C277.3,339.8,269.7,332.3,260.3,332.3z"
+ />
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help.svg
new file mode 100644
index 00000000..acc21edf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,48C141.1,48,48,141.1,48,256c0,114.9,93.1,208,208,208c114.9,0,208-93.1,208-208C464,141.1,370.9,48,256,48z
+ M260.3,366c-9.4,0-17-7.5-17-16.9c0-9.3,7.6-16.8,17-16.8c9.4,0,17,7.5,17,16.8C277.3,358.5,269.7,366,260.3,366z M294.1,250.7
+ c-22.8,22.5-22.2,27.4-23.3,53.3h-19c1.1-28.5,7.5-43.7,30.1-64.5c11-10.3,19.4-22.7,19.4-38.1c0-23.6-19.4-39.9-42.6-39.9
+ c-32.4,0-48.5,16.4-47.9,46.4H192c0.3-42,24.4-62.1,67.6-62.1c33,0,60.4,20.4,60.4,54.6C320,222.3,309.3,236.6,294.1,250.7z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-home-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-home-outline.svg
new file mode 100644
index 00000000..fdb70719
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-home-outline.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,112L96,240v208h112V320h96v128h112V240L256,112z M400,432h-80V304H192v128h-80V247.69l144-115.2l144,115.2V432z"/>
+ <path d="M256,64l-96,76.8V96H96v95.999l-32,25.499l11.51,11.384L256,84.49l180.49,144.393L448,217.498L256,64z M144,153.599
+ l-32,25.6V112h32V153.599z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-home.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-home.svg
new file mode 100644
index 00000000..5fb5efbf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-home.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,112L96,240v208h112V320h96v128h112V240L256,112z"/>
+ <path d="M256,64l-96,76.8V96H96v95.999l-32,25.499l11.51,11.384L256,84.49l180.49,144.393L448,217.498L256,64z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-infinite-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-infinite-outline.svg
new file mode 100644
index 00000000..fac58bbb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-infinite-outline.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M451.229,188.098C432.682,169.967,407.95,160,381.585,160c-26.363,0-51.095,9.967-69.642,28.098l-42.229,41.187
+ l13.649,13.447l42.229-41.306c14.933-14.529,34.764-22.573,55.878-22.573c21.113,0,40.946,8.044,55.878,22.573
+ c30.797,30.139,30.797,79.13,0,109.148c-14.932,14.529-34.765,22.573-55.878,22.573c-21.114,0-40.945-8.044-55.878-22.573
+ L200.071,188.098C181.406,169.967,156.675,160,130.427,160c-26.363,0-51.095,9.967-69.643,28.098
+ C41.615,206.809,32.021,231.441,32,256c-0.021,24.611,9.573,49.149,28.784,67.902C79.332,342.032,104.063,352,130.427,352
+ c26.365,0,51.095-9.968,69.645-28.098l42.111-41.186l-13.647-13.329l-42.229,41.187c-14.932,14.529-34.764,22.573-55.879,22.573
+ c-21.113,0-40.944-8.044-55.876-22.573c-30.799-30.14-30.799-79.13,0-109.148c14.932-14.529,34.763-22.573,55.876-22.573
+ c21.115,0,40.947,8.044,55.879,22.573l125.52,122.477C330.49,342.032,355.222,352,381.47,352c26.363,0,51.095-9.968,69.643-28.098
+ C470.361,305.23,479.985,280.6,480,256C480.015,231.399,470.42,206.83,451.229,188.098z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-infinite.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-infinite.svg
new file mode 100644
index 00000000..aae8d1d3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-infinite.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M456.821,182.377C436.782,162.788,410.062,152,381.585,152c-28.477,0-55.195,10.788-75.21,30.354l-39.106,37.885
+ l25.06,24.689l38.843-37.769c13.458-13.095,31.321-20.307,50.299-20.307c18.979,0,36.841,7.212,50.282,20.291
+ c13.363,13.077,20.712,30.468,20.693,48.97c-0.019,18.443-7.363,35.75-20.677,48.728c-13.458,13.095-31.32,20.307-50.299,20.307
+ c-18.978,0-36.841-7.212-50.291-20.299L205.646,182.359C185.491,162.782,158.778,152,130.427,152
+ c-28.477,0-55.195,10.788-75.23,30.373C35.103,201.986,24.023,228.132,24,255.993c-0.024,27.822,11.055,53.973,31.192,73.63
+ C75.232,349.212,101.951,360,130.427,360c28.475,0,55.194-10.788,75.223-30.363l38.994-37.909l-25.088-24.502l-38.829,37.615
+ c-13.458,13.095-31.321,20.307-50.3,20.307c-18.977,0-36.839-7.212-50.28-20.291c-13.364-13.077-20.714-30.469-20.694-48.971
+ c0.019-18.443,7.363-35.749,20.678-48.727c13.458-13.095,31.32-20.307,50.297-20.307c18.979,0,36.842,7.212,50.292,20.299
+ l125.532,122.489C326.406,349.218,353.119,360,381.47,360c28.476,0,55.194-10.788,75.213-30.355
+ c20.179-19.573,31.301-45.727,31.317-73.64C488.017,228.167,476.942,202.018,456.821,182.377z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information-empty.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information-empty.svg
new file mode 100644
index 00000000..387abc47
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information-empty.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <circle cx="251.5" cy="172" r="20"/>
+ <polygon points="272,344 272,216 224,216 224,224 240,224 240,344 224,344 224,352 288,352 288,344 "/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information-outline.svg
new file mode 100644
index 00000000..b16b6c44
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information-outline.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <circle cx="251.5" cy="172" r="20"/>
+ <polygon points="272,344 272,216 224,216 224,224 240,224 240,344 224,344 224,352 288,352 288,344 "/>
+ </g>
+ <g>
+ <path d="M256,48C141.1,48,48,141.1,48,256c0,114.9,93.1,208,208,208c114.9,0,208-93.1,208-208C464,141.1,370.9,48,256,48z
+ M256,446.7c-105.1,0-190.7-85.5-190.7-190.7c0-105.1,85.5-190.7,190.7-190.7c105.1,0,190.7,85.5,190.7,190.7
+ C446.7,361.1,361.1,446.7,256,446.7z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information.svg
new file mode 100644
index 00000000..2ef04fc8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,48C141.1,48,48,141.1,48,256c0,114.9,93.1,208,208,208c114.9,0,208-93.1,208-208C464,141.1,370.9,48,256,48z
+ M251.5,152c11.1,0,20,9,20,20s-9,20-20,20c-11,0-20-9-20-20S240.4,152,251.5,152z M288,352h-64v-8h16V224h-16v-8h48v128h16V352z"
+ />
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-ionic-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-ionic-outline.svg
new file mode 100644
index 00000000..694a603c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-ionic-outline.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M425.5,134.8c4.7-5.9,7.5-13.5,7.5-21.6c0-19.2-15.6-34.9-34.8-34.9c-8.2,0-15.7,2.8-21.6,7.5c-34-24.2-75-37.8-119.9-37.8
+ C141.8,48,48,140.5,48,255.6C48,370.7,141.7,464,256.6,464C371.5,464,464,370.7,464,255.6C464,210.6,449.7,168.9,425.5,134.8z
+ M398,91.3c12.2,0,22,9.9,22,22c0,12.2-9.9,22-22,22c-12.2,0-22-9.9-22-22C376,101.2,385.8,91.3,398,91.3z M391.8,391.7
+ c-17.6,17.6-38.2,31.6-61.1,41.3c-23.7,10-48.2,15.2-74.2,15.2c-25.9,0-51.7-5.1-75.4-15.2c-22.9-9.7-43.4-23.5-61.1-41.3
+ c-17.6-17.6-31.5-38.3-41.2-61.2c-10-23.7-15.1-48.9-15.1-74.9c0-25.9,5.1-51.2,15.1-74.9c9.7-22.9,23.5-43.5,41.2-61.2
+ s38.2-31.6,61.1-41.3c23.7-10,49.4-14.1,75.4-14.1c25.9,0,50.5,4,74.2,14.1c12.7,5.4,24.7,12.1,35.9,20c-2.1,4.5-3.3,9.5-3.3,14.9
+ c0,19.2,15.6,34.9,34.8,34.9c5.3,0,10.3-1.2,14.9-3.3c7.9,11.2,14.6,23.2,20,36c10,23.7,15.1,48.9,15.1,74.9
+ c0,25.9-5.1,51.2-15.1,74.9C423.3,353.4,409.5,374,391.8,391.7z"/>
+ <path d="M256.5,160.1c-53,0-96,42.8-96,95.9s42.9,96.1,96,96.1c53,0,96-43,96-96.1S309.5,160.1,256.5,160.1z M256.5,335.8
+ c-44.1,0-79.7-35.8-79.7-79.8c0-44.1,35.6-79.6,79.7-79.6s79.7,35.6,79.7,79.6C336.2,300.1,300.5,335.8,256.5,335.8z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-keypad-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-keypad-outline.svg
new file mode 100644
index 00000000..d6556355
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-keypad-outline.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M394.6,341.2c-29.5,0-53.4,23.9-53.4,53.4s23.9,53.4,53.4,53.4c29.5,0,53.4-23.9,53.4-53.4S424.1,341.2,394.6,341.2z
+ M394.6,432c-20.6,0-37.4-16.8-37.4-37.4c0-20.6,16.8-37.4,37.4-37.4s37.4,16.8,37.4,37.4C432,415.2,415.2,432,394.6,432z"/>
+ <path d="M256,341.2c-29.5,0-53.4,23.9-53.4,53.4S226.5,448,256,448c29.5,0,53.4-23.9,53.4-53.4S285.5,341.2,256,341.2z M256,432
+ c-20.6,0-37.4-16.8-37.4-37.4c0-20.6,16.8-37.4,37.4-37.4s37.4,16.8,37.4,37.4C293.4,415.2,276.6,432,256,432z"/>
+ <path d="M117.4,341.2c-29.5,0-53.4,23.9-53.4,53.4S87.9,448,117.4,448c29.5,0,53.4-23.9,53.4-53.4S146.9,341.2,117.4,341.2z
+ M117.4,432C96.8,432,80,415.2,80,394.6c0-20.6,16.8-37.4,37.4-37.4s37.4,16.8,37.4,37.4C154.8,415.2,138.1,432,117.4,432z"/>
+ <path d="M394.6,202.6c-29.5,0-53.4,23.9-53.4,53.4s23.9,53.4,53.4,53.4c29.5,0,53.4-23.9,53.4-53.4S424.1,202.6,394.6,202.6z
+ M394.6,293.4c-20.6,0-37.4-16.8-37.4-37.4c0-20.6,16.8-37.4,37.4-37.4S432,235.4,432,256C432,276.6,415.2,293.4,394.6,293.4z"/>
+ <path d="M256,202.6c-29.5,0-53.4,23.9-53.4,53.4s23.9,53.4,53.4,53.4c29.5,0,53.4-23.9,53.4-53.4S285.5,202.6,256,202.6z
+ M256,293.4c-20.6,0-37.4-16.8-37.4-37.4c0-20.6,16.8-37.4,37.4-37.4s37.4,16.8,37.4,37.4C293.4,276.6,276.6,293.4,256,293.4z"/>
+ <path d="M117.4,202.6C87.9,202.6,64,226.5,64,256s23.9,53.4,53.4,53.4c29.5,0,53.4-23.9,53.4-53.4S146.9,202.6,117.4,202.6z
+ M117.4,293.4C96.8,293.4,80,276.6,80,256c0-20.6,16.8-37.4,37.4-37.4s37.4,16.8,37.4,37.4C154.8,276.6,138.1,293.4,117.4,293.4z"
+ />
+ <path d="M394.6,170.8c29.5,0,53.4-23.9,53.4-53.4c0-29.5-23.9-53.4-53.4-53.4c-29.5,0-53.4,23.9-53.4,53.4
+ C341.2,146.9,365.1,170.8,394.6,170.8z M394.6,80c20.6,0,37.4,16.8,37.4,37.4c0,20.6-16.8,37.4-37.4,37.4s-37.4-16.8-37.4-37.4
+ C357.2,96.8,373.9,80,394.6,80z"/>
+ <path d="M256,64c-29.5,0-53.4,23.9-53.4,53.4c0,29.5,23.9,53.4,53.4,53.4c29.5,0,53.4-23.9,53.4-53.4C309.4,87.9,285.5,64,256,64z
+ M256,154.8c-20.6,0-37.4-16.8-37.4-37.4c0-20.6,16.8-37.4,37.4-37.4s37.4,16.8,37.4,37.4C293.4,138,276.6,154.8,256,154.8z"/>
+ <path d="M117.4,64C87.9,64,64,87.9,64,117.4c0,29.5,23.9,53.4,53.4,53.4c29.5,0,53.4-23.9,53.4-53.4C170.8,87.9,146.9,64,117.4,64z
+ M117.4,154.8C96.8,154.8,80,138,80,117.4C80,96.8,96.8,80,117.4,80s37.4,16.8,37.4,37.4C154.8,138,138.1,154.8,117.4,154.8z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-keypad.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-keypad.svg
new file mode 100644
index 00000000..9eae5d1b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-keypad.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M394.6,341.2c-29.5,0-53.4,23.9-53.4,53.4s23.9,53.4,53.4,53.4c29.5,0,53.4-23.9,53.4-53.4S424.1,341.2,394.6,341.2z"/>
+ <path d="M256,341.2c-29.5,0-53.4,23.9-53.4,53.4S226.5,448,256,448c29.5,0,53.4-23.9,53.4-53.4S285.5,341.2,256,341.2z"/>
+ <path d="M117.4,341.2c-29.5,0-53.4,23.9-53.4,53.4S87.9,448,117.4,448c29.5,0,53.4-23.9,53.4-53.4S146.9,341.2,117.4,341.2z"/>
+ <path d="M394.6,202.6c-29.5,0-53.4,23.9-53.4,53.4s23.9,53.4,53.4,53.4c29.5,0,53.4-23.9,53.4-53.4S424.1,202.6,394.6,202.6z"/>
+ <path d="M256,202.6c-29.5,0-53.4,23.9-53.4,53.4s23.9,53.4,53.4,53.4c29.5,0,53.4-23.9,53.4-53.4S285.5,202.6,256,202.6z"/>
+ <path d="M117.4,202.6C87.9,202.6,64,226.5,64,256s23.9,53.4,53.4,53.4c29.5,0,53.4-23.9,53.4-53.4S146.9,202.6,117.4,202.6z"/>
+ <path d="M394.6,170.8c29.5,0,53.4-23.9,53.4-53.4c0-29.5-23.9-53.4-53.4-53.4c-29.5,0-53.4,23.9-53.4,53.4
+ C341.2,146.9,365.1,170.8,394.6,170.8z"/>
+ <path d="M256,64c-29.5,0-53.4,23.9-53.4,53.4c0,29.5,23.9,53.4,53.4,53.4c29.5,0,53.4-23.9,53.4-53.4C309.4,87.9,285.5,64,256,64z"
+ />
+ <path d="M117.4,64C87.9,64,64,87.9,64,117.4c0,29.5,23.9,53.4,53.4,53.4c29.5,0,53.4-23.9,53.4-53.4C170.8,87.9,146.9,64,117.4,64z
+ "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-lightbulb-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-lightbulb-outline.svg
new file mode 100644
index 00000000..8390f3ef
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-lightbulb-outline.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M400,172.9C400,95.1,333.9,32,256,32c-77.9,0-144,63.1-144,141c0,31,13.2,59,30.2,83h-0.3c10.9,15,21.4,27.7,31.5,45
+ c22,37.8,18.6,74.3,18.7,81.6v1.4h128v-1.4c0-8.9-3.6-43.8,18.4-81.6c10.1-17.3,20.6-30,31.5-45h-0.1C386.8,232,400,204,400,172.9z
+ M351,254.4c-0.6,0.8-1.1,1.5-1.7,2.3c-8.1,10.9-16.5,22.2-24.7,36.1c-17.3,29.7-20.4,57.9-20.8,75.1H288V256l32-64h-16.6L272,256
+ v112h-32V256l-31.4-64H192l32,64v112h-15.9c-0.5-17.2-3.9-45.7-20.9-75c-4.5-7.7-9.1-15-13.7-21h0.2l-18.6-25.6
+ c-15.8-21.6-27.1-47.1-27.1-73.6c0-33.4,16-64.8,39.6-88.4s55-36.7,88.4-36.7c33.4,0,64.8,13.1,88.4,36.7
+ c23.6,23.6,39.6,55,39.6,88.4c0,26.5-11.3,51.9-27.1,73.5L351,254.4z"/>
+ <rect x="224" y="464" width="64" height="16"/>
+ <rect x="208" y="432" width="96" height="16"/>
+ <rect x="208" y="400" width="96" height="16"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-lightbulb.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-lightbulb.svg
new file mode 100644
index 00000000..b6580713
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-lightbulb.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M400,172.9C400,95.1,333.9,32,256,32c-77.9,0-144,63.1-144,141c0,31,13.2,59,30.2,83h-0.3c10.9,15,21.4,27.7,31.5,45
+ c22,37.8,18.6,74.3,18.7,81.6v1.4h32V256l-32-64h16.6l31.4,64v128h32V256l31.4-64H320l-32,64v128h32v-1.4
+ c0-8.9-3.6-43.8,18.4-81.6c10.1-17.3,20.6-30,31.5-45h-0.1C386.8,232,400,204,400,172.9z"/>
+ </g>
+ <rect x="224" y="464" width="64" height="16"/>
+ <rect x="208" y="432" width="96" height="16"/>
+ <rect x="208" y="400" width="96" height="16"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-list-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-list-outline.svg
new file mode 100644
index 00000000..38049cc9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-list-outline.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M432,80v352H80V80H432 M448,64H64v384h384V64L448,64z"/>
+ <g>
+ <rect x="192" y="152" width="192" height="16"/>
+ </g>
+ <g>
+ <rect x="192" y="248" width="192" height="16"/>
+ </g>
+ <g>
+ <rect x="192" y="344" width="192" height="16"/>
+ </g>
+ </g>
+ <circle cx="144" cy="160" r="16"/>
+ <circle cx="144" cy="256" r="16"/>
+ <circle cx="144" cy="352" r="16"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-list.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-list.svg
new file mode 100644
index 00000000..ba40a539
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-list.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M64,64v384h384V64H64z M144,368c-8.836,0-16-7.164-16-16s7.164-16,16-16s16,7.164,16,16S152.836,368,144,368z M144,272
+ c-8.836,0-16-7.164-16-16s7.164-16,16-16s16,7.164,16,16S152.836,272,144,272z M144,176c-8.836,0-16-7.164-16-16s7.164-16,16-16
+ s16,7.164,16,16S152.836,176,144,176z M384,360H192v-16h192V360z M384,264H192v-16h192V264z M384,168H192v-16h192V168z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-location-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-location-outline.svg
new file mode 100644
index 00000000..98751071
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-location-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,48c34.19,0,66.334,13.314,90.51,37.49S384,141.81,384,176c0,42.92-24.092,107.127-69.67,185.68
+ c-22.279,38.396-44.771,71.634-58.332,90.931c-13.518-19.232-35.912-52.327-58.161-90.645C152.149,283.281,128,218.976,128,176
+ c0-34.19,13.314-66.334,37.49-90.51S221.81,48,256,48 M256,32c-79.529,0-144,64.471-144,144c0,112,144,304,144,304s144-192,144-304
+ C400,96.471,335.529,32,256,32L256,32z"/>
+ <path d="M256,112c-35.3,0-64,28.7-64,64s28.7,64,64,64s64-28.7,64-64S291.3,112,256,112z M256,222.9c-25.9,0-46.9-21-46.9-46.9
+ s21-46.9,46.9-46.9s46.9,21,46.9,46.9S281.9,222.9,256,222.9z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-location.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-location.svg
new file mode 100644
index 00000000..d15131c7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-location.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M256,32c-79.529,0-144,64.471-144,144c0,112,144,304,144,304s144-192,144-304C400,96.471,335.529,32,256,32z M256,222.9
+ c-25.9,0-46.9-21-46.9-46.9s21-46.9,46.9-46.9s46.9,21,46.9,46.9S281.9,222.9,256,222.9z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-locked-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-locked-outline.svg
new file mode 100644
index 00000000..8c951256
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-locked-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M360,224v-72c0-57.43-46.562-104-103.984-104C198.562,48,152,94.57,152,152v72H96v240h320V224H360z M168,152
+ c0-48.523,39.484-88,88.016-88C304.531,64,344,103.477,344,152v72H168V152z M400,448H112V240h288V448z"/>
+ </g>
+ <path d="M256,288c-17.673,0-32,14.327-32,32c0,14.91,10.198,27.439,24,30.992V384h16v-33.008c13.802-3.553,24-16.082,24-30.992
+ C288,302.327,273.673,288,256,288z M256,336c-8.822,0-16-7.178-16-16s7.178-16,16-16s16,7.178,16,16S264.822,336,256,336z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-locked.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-locked.svg
new file mode 100644
index 00000000..621572fd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-locked.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M360,224v-72c0-57.43-46.562-104-103.984-104C198.562,48,152,94.57,152,152v72H96v240h320V224H360z M264,350.992V384h-16
+ v-33.008c-13.802-3.553-24-16.082-24-30.992c0-17.673,14.327-32,32-32s32,14.327,32,32C288,334.91,277.802,347.439,264,350.992z
+ M344,224H168v-72c0-48.523,39.484-88,88.016-88C304.531,64,344,103.477,344,152V224z"/>
+ <path d="M256,304c-8.822,0-16,7.178-16,16s7.178,16,16,16s16-7.178,16-16S264.822,304,256,304z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-loop-strong.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-loop-strong.svg
new file mode 100644
index 00000000..9edcdfaa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-loop-strong.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M256,48c-75.033,0-144.531,40.658-181.373,106.107l-1.963,3.485l20.915,11.771l1.962-3.485
+ C128.138,107.973,189.621,72,256,72c101.458,0,184,82.542,184,184c0,12.509-1.262,25.007-3.749,37.147l-0.803,3.918l23.511,4.819
+ l0.804-3.919C462.574,284.244,464,270.125,464,256C464,141.309,370.691,48,256,48z"/>
+ <path d="M416.459,346.119C383.862,404.027,322.379,440,256,440c-101.458,0-184-82.542-184-184c0-12.512,1.262-25.011,3.75-37.15
+ l0.803-3.918l-23.511-4.819l-0.804,3.918C49.426,227.75,48,241.87,48,256c0,114.691,93.309,208,208,208
+ c75.033,0,144.531-40.658,181.373-106.109l1.963-3.485l-20.915-11.771L416.459,346.119z"/>
+ </g>
+ <polygon points="384,256 448,320 512,256 "/>
+ <polygon points="0,256 64,192 128,256 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-loop.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-loop.svg
new file mode 100644
index 00000000..18efda65
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-loop.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="489.373,256 448,297.373 405.627,256 394.813,266.813 448,320 500.687,267.313 "/>
+ <g>
+ <path d="M459.994,255.509c-0.002-0.577,0.013-1.157,0.007-1.733l-0.029-0.003C458.771,142.311,367.742,52,256,52
+ c-73.59,0-141.753,39.878-177.888,104.071l13.943,7.848C125.359,104.754,188.18,68,256,68
+ c103.273,0,187.355,83.708,187.985,186.836c0.038,6.882-0.281,13.83-1.017,20.831l15.912,1.674
+ c0.755-7.168,1.105-14.286,1.111-21.341H460C460,255.836,459.994,255.673,459.994,255.509z"/>
+ <path d="M419.944,348.081C386.641,407.246,323.82,444,256,444c-103.475,0-187.688-84.032-187.993-187.437
+ c-0.015-6.686,0.31-13.434,1.024-20.23l-15.912-1.674c-0.754,7.168-1.104,14.286-1.108,21.341H52c0,0.472,0.015,0.939,0.018,1.41
+ c0.006,0.975-0.006,1.952,0.015,2.924l0.022-0.003C54.369,370.825,144.962,460,256,460c73.59,0,141.753-39.878,177.888-104.071
+ L419.944,348.081z"/>
+ <g>
+ <polygon points="64,192 11.313,244.687 22.627,256 64,214.627 105.373,256 116.687,244.687 "/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medical-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medical-outline.svg
new file mode 100644
index 00000000..831a19da
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medical-outline.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M438,187.713l-31.927-55.426L288,200.574V64h-64v136.574l-118.073-68.287l-31.938,55.426L192.092,256L73.998,324.287
+ l31.928,55.426L224,311.426V448h64V311.426l118.072,68.287l31.939-55.426L319.908,256L438,187.713z M416.176,330.125l-15.963,27.866
+ L272,284v148h-32V284l-128.213,74l-15.969-27.785l128.228-74.197L95.822,181.861l15.964-27.859L240,228V80h32v148l128.213-74
+ l15.969,27.785l-128.228,74.179L416.176,330.125z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medical.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medical.svg
new file mode 100644
index 00000000..f713d868
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medical.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M438,187.713l-31.927-55.426L288,200.574V64h-64v136.574l-118.073-68.287l-31.938,55.426L192.092,256L73.998,324.287
+ l31.928,55.426L224,311.426V448h64V311.426l118.072,68.287l31.939-55.426L319.908,256L438,187.713z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medkit-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medkit-outline.svg
new file mode 100644
index 00000000..40c58517
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medkit-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M272,208v48v16h16h48v32h-48h-16v16v48h-32v-48v-16h-16h-48v-32h48h16v-16v-48H272 M288,192h-64v64h-64v64h64v64h64v-64
+ h64v-64h-64V192L288,192z"/>
+ </g>
+ <path d="M336,128V96c-0.5-18.2-13.6-32-32.2-32h-99.1C186.1,64,176,77.7,176,96v32H48v320h416V128H336z M192,98.1
+ c0-10.2,2.9-18.1,13.7-18.1h97.1c10.4,0,17.2,7.7,17.2,18.1V128H192V98.1z M448,432H64V144h384V432z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medkit.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medkit.svg
new file mode 100644
index 00000000..4eb5d94e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medkit.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="272,272 272,256 272,208 240,208 240,256 240,272 224,272 176,272 176,304 224,304 240,304 240,320 240,368
+ 272,368 272,320 272,304 288,304 336,304 336,272 288,272 "/>
+ <path d="M336,128V96c-0.5-18.2-13.6-32-32.2-32h-99.1C186.1,64,176,77.7,176,96v32H48v320h416V128H336z M192,98.1
+ c0-10.2,2.9-18.1,13.7-18.1h97.1c10.4,0,17.2,7.7,17.2,18.1V128H192V98.1z M352,320h-64v64h-64v-64h-64v-64h64v-64h64v64h64V320z"
+ />
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic-off.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic-off.svg
new file mode 100644
index 00000000..da69e6c3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic-off.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <rect x="264.2" y="1.1" transform="matrix(0.8629 -0.5053 0.5053 0.8629 -92.0515 172.66)" width="16" height="509.8"/>
+ <path d="M256.2,353.4c12.3,0,23.8-2.9,34.2-8.2L177,152.4V270C177,316,212.4,353.4,256.2,353.4z"/>
+ <path d="M335,270V115.5c0-46-35.2-83.5-79-83.5c-25.4,0-47.8,12.6-62.3,32.2l136.9,233.3C333.5,288.9,335,279.6,335,270z"/>
+ <path d="M384,271.7V192h-17v79.7c0,21.5-6.2,41.6-17.1,58.5l9.9,17C375.1,326,384,299.9,384,271.7z"/>
+ <path d="M267,399.2c17-1.2,33-5.8,47.3-13l-9.4-16.1c-14.5,7-30.7,10.9-47.7,10.9c-60.3,0-110.1-49-110.1-109.1V192h-19v79.7
+ c0,67.2,53,122.6,120,127.4V462h-73v18h161v-18h-69V399.2z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic-outline.svg
new file mode 100644
index 00000000..829d61b9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic-outline.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,32c-43.7,0-79,37.5-79,83.5V270c0,46,35.3,83.5,79,83.5c43.7,0,79-37.5,79-83.5V115.5C335,69.5,299.7,32,256,32z
+ M319,270c0,37.2-28.3,67.5-63,67.5c-34.7,0-63-30.3-63-67.5V115.5c0-37.2,28.3-67.5,63-67.5c34.7,0,63,30.3,63,67.5V270z"/>
+ <path d="M367,192v79.7c0,60.2-49.8,109.2-110,109.2c-60.2,0-110-49-110-109.2V192h-19v79.7c0,67.2,53,122.6,120,127.5V462h-73v18
+ h161v-18h-69v-62.8c66-4.9,117-60.3,117-127.5V192H367z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic.svg
new file mode 100644
index 00000000..cf73a7b8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,353.5c43.7,0,79-37.5,79-83.5V115.5c0-46-35.3-83.5-79-83.5c-43.7,0-79,37.5-79,83.5V270
+ C177,316,212.3,353.5,256,353.5z"/>
+ <path d="M367,192v79.7c0,60.2-49.8,109.2-110,109.2c-60.2,0-110-49-110-109.2V192h-19v79.7c0,67.2,53,122.6,120,127.5V462h-73v18
+ h161v-18h-69v-62.8c66-4.9,117-60.3,117-127.5V192H367z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus-empty.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus-empty.svg
new file mode 100644
index 00000000..7c294f8f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus-empty.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M384,265H128v-17h256V265z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus-outline.svg
new file mode 100644
index 00000000..668b4045
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus-outline.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <g>
+ <path d="M256,48C141.1,48,48,141.1,48,256s93.1,208,208,208c114.9,0,208-93.1,208-208S370.9,48,256,48z M256,446.7
+ c-105.1,0-190.7-85.5-190.7-190.7c0-105.1,85.5-190.7,190.7-190.7c105.1,0,190.7,85.5,190.7,190.7
+ C446.7,361.1,361.1,446.7,256,446.7z"/>
+ </g>
+ </g>
+ <rect x="128" y="248" width="256" height="17"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus.svg
new file mode 100644
index 00000000..077900dc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,48C141.1,48,48,141.1,48,256s93.1,208,208,208c114.9,0,208-93.1,208-208S370.9,48,256,48z M384,265H128v-17h256V265z"
+ />
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-monitor-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-monitor-outline.svg
new file mode 100644
index 00000000..386e94f4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-monitor-outline.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M496,384V96H16v288h175v16h-64v16h257v-16h-64v-16H496z M32,112h448v256H32V112z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-monitor.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-monitor.svg
new file mode 100644
index 00000000..9bd65ed2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-monitor.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M496,384V96H16v288h175v16h-64v16h257v-16h-64v-16H496z M32,112h448v256H32V112z"/>
+<g>
+ <rect x="48" y="128" width="416" height="224"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-moon-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-moon-outline.svg
new file mode 100644
index 00000000..5b8e1de2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-moon-outline.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M343.1,315c-1.8,0.1-3.5,0.1-5.3,0.1c-29.1,0-56.5-11.3-77.1-31.9c-20.6-20.6-31.9-48-31.9-77.1
+ c0-16.6,3.7-32.6,10.6-47.1c3.1-6.4,6.8-12.5,11.1-18.2c-7.6,0.8-14.9,2.4-22,4.6c-46.8,14.8-80.7,58.5-80.7,110.2
+ c0,63.8,51.7,115.5,115.5,115.5c35.3,0,66.8-15.8,88-40.7c4.8-5.7,9.2-11.9,12.8-18.5C357.3,313.6,350.3,314.7,343.1,315z
+ M263.3,355.1c-54.9,0-99.5-44.6-99.5-99.5c0-39.1,22.6-72.9,55.4-89.2c-4.2,12.5-6.4,25.8-6.4,39.7c0,65.9,51,119.9,115.6,124.7
+ C311,346,288.2,355.1,263.3,355.1z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-moon.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-moon.svg
new file mode 100644
index 00000000..059f2b9a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-moon.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M343.1,315c-1.8,0.1-3.5,0.1-5.3,0.1c-29.1,0-56.5-11.3-77.1-31.9c-20.6-20.6-31.9-48-31.9-77.1
+ c0-16.6,3.7-32.6,10.6-47.1c3.1-6.4,6.8-12.5,11.1-18.2c-7.6,0.8-14.9,2.4-22,4.6c-46.8,14.8-80.7,58.5-80.7,110.2
+ c0,63.8,51.7,115.5,115.5,115.5c35.3,0,66.8-15.8,88-40.7c4.8-5.7,9.2-11.9,12.8-18.5C357.3,313.6,350.3,314.7,343.1,315z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-more-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-more-outline.svg
new file mode 100644
index 00000000..010cd1ad
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-more-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,238c9.9,0,18,8.1,18,18s-8.1,18-18,18s-18-8.1-18-18S246.1,238,256,238 M256,224c-17.7,0-32,14.3-32,32s14.3,32,32,32
+ c17.7,0,32-14.3,32-32S273.7,224,256,224L256,224z"/>
+ <path d="M128.4,238c9.9,0,18,8.1,18,18s-8.1,18-18,18c-9.9,0-18-8.1-18-18S118.5,238,128.4,238 M128.4,224c-17.7,0-32,14.3-32,32
+ s14.3,32,32,32c17.7,0,32-14.3,32-32S146,224,128.4,224L128.4,224z"/>
+ <path d="M384,238c9.9,0,18,8.1,18,18s-8.1,18-18,18s-18-8.1-18-18S374.1,238,384,238 M384,224c-17.7,0-32,14.3-32,32s14.3,32,32,32
+ s32-14.3,32-32S401.7,224,384,224L384,224z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-more.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-more.svg
new file mode 100644
index 00000000..9768cd87
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-more.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,224c-17.7,0-32,14.3-32,32s14.3,32,32,32c17.7,0,32-14.3,32-32S273.7,224,256,224L256,224z"/>
+ <path d="M128.4,224c-17.7,0-32,14.3-32,32s14.3,32,32,32c17.7,0,32-14.3,32-32S146,224,128.4,224L128.4,224z"/>
+ <path d="M384,224c-17.7,0-32,14.3-32,32s14.3,32,32,32s32-14.3,32-32S401.7,224,384,224L384,224z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-musical-note.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-musical-note.svg
new file mode 100644
index 00000000..2ee22164
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-musical-note.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M352.1,102.3c0-0.1,0-0.2,0-0.2c-0.1-0.3-0.1-0.5-0.2-0.8c0,0,0-0.1,0-0.1c-0.6-1.5-1.8-3-3.5-3.4l-2-0.4L256,78v272.6
+ c-8,0-22.4,0.4-44.5,1.3c-41.8,1.6-51.4,21.6-51.4,40.9c0,24.6,13.2,43.1,61.5,41c51.8-2.3,51.4-48.5,51.4-81.7V159.6l73.6,13.5l0,0
+ c3,0.6,5.4-2.3,5.4-5.3v-64.4C352,103,352.1,102.6,352.1,102.3z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-musical-notes.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-musical-notes.svg
new file mode 100644
index 00000000..0fe310c5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-musical-notes.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M416,319.9V78l-224,34.6v237.2c-9,0-20.9,0.4-43.5,1.3c-42.6,1.6-52.5,21.8-52.5,41.3c0,24.9,13.5,43.5,62.6,41.4
+ c52.8-2.3,50.3-49,50.3-82.5V189.8l191-32v160.6c-9,0-19.9,0.4-42.6,1.3c-42.6,1.6-52.5,21.8-52.5,41.3c0,24.9,13,43.5,62.2,41.4
+ C420,400.1,416,353.4,416,319.9z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-navigate-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-navigate-outline.svg
new file mode 100644
index 00000000..74e4180b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-navigate-outline.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,64.5c51.1,0,99.2,19.9,135.4,56.1s56.1,84.2,56.1,135.4s-19.9,99.2-56.1,135.4s-84.2,56.1-135.4,56.1
+ s-99.2-19.9-135.4-56.1C84.5,355.2,64.5,307.1,64.5,256s19.9-99.2,56.1-135.4C156.8,84.5,204.9,64.5,256,64.5 M256,48
+ C141.1,48,48,141.1,48,256c0,114.9,93.1,208,208,208c114.9,0,208-93.1,208-208C464,141.1,370.9,48,256,48L256,48z"/>
+ <polygon points="352,160 128.3,256 256,256 256,384 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-navigate.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-navigate.svg
new file mode 100644
index 00000000..2a265c9e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-navigate.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,48C141.1,48,48,141.1,48,256c0,114.9,93.1,208,208,208c114.9,0,208-93.1,208-208C464,141.1,370.9,48,256,48z M256,384
+ V256H128.3L352,160L256,384z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-nutrition-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-nutrition-outline.svg
new file mode 100644
index 00000000..b8d04ea4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-nutrition-outline.svg
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M358,233.855l0.413-0.039c-0.137-0.137-0.046-0.101-0.185-0.237L279.798,155h-0.004c-5.833-6-14.193-10.154-23.485-10.154
+ c-11.811,0-22.115,6.154-27.635,16.154h-0.007c0,0-7.09,10.994-18.27,28.874l32.531,39.637c2.939,3.769,3.296,7.801,1.411,9.689
+ l-0.114,0.071c-0.909,0.909-2.021,1.33-3.274,1.33c-1.908,0-4.142-0.99-6.485-2.768l-35.872-29.418
+ c-23.546,37.655-56.677,90.634-83.45,133.451l19.072,23.337c2.939,3.77,3.296,7.884,1.41,9.772l-0.114,0.114
+ c-0.911,0.913-2.028,1.342-3.287,1.342c-1.905,0-4.136-0.981-6.472-2.755l-21.067-16.533C84.734,389.051,70,412.464,68,414.366
+ v0.003c-3,5.062-4.085,11.132-4.085,17.664c0,17.655,14.657,31.967,32.285,31.967c7.821,0,14.57-3.395,20.799-7.5l114.651-84.109
+ l-28.838-35.358c-2.94-3.769-3.268-7.887-1.382-9.775l0.128-0.114c0.912-0.912,2.034-1.341,3.294-1.341
+ c1.905,0,4.14,0.981,6.476,2.755l37.864,31.59C304.03,319.902,355.082,283,355.082,283h0.005c7.839-6,12.473-15.711,12.473-26.238
+ c0-8.704-3.56-17.14-9.56-22.904V233.855z M345.531,269.834c-2.664,1.934-46.692,33.932-95.764,69.899l-28.272-23.483l-0.26-0.223
+ l-0.274-0.211c-5.245-3.981-10.663-5.998-16.108-5.998c-5.465,0-10.592,2.097-14.458,5.909l-0.064,0.062l-0.083,0.082l-0.083,0.083
+ c-7.808,7.821-7.761,20.823,0.111,30.917l0.11,0.143l0.113,0.138l18.223,22.312l-100.656,73.896
+ c-5.066,3.304-8.427,4.657-11.542,4.657c-8.822,0-16-7.171-16-15.983c0-3.086,0.694-6.045,2.017-8.623
+ c2.391-3.161,6.6-9.876,18.655-29.351c2.543-4.108,5.252-8.487,8.134-13.129l6.39,5.176l0.195,0.156l0.2,0.152
+ c5.245,3.981,10.665,6,16.111,6c5.517,0,10.692-2.139,14.571-6.023l0.114-0.113c7.806-7.817,7.756-20.82-0.118-30.916l-0.113-0.144
+ l-0.115-0.142l-11.814-14.455l43.693-69.872l24.059-38.474l21.855,17.922l0.231,0.19l0.24,0.181
+ c5.254,3.988,10.678,6.01,16.123,6.01c4.954,0,9.631-1.725,13.339-4.89l0.461-0.337l0.871-0.874
+ c7.79-7.803,7.74-20.778-0.118-30.854l-0.12-0.153l-0.124-0.15l-25.239-30.539c2.957-4.703,5.457-8.491,7.405-11.488l5.209-8.494
+ c2.777-5.025,7.761-8.157,13.673-8.157c4.367,0,8.76,2.042,12.057,5.43l4.701,4.928h0.122L342,240.286v0.376l5.186,4.716
+ c2.793,2.69,4.539,6.782,4.539,11.227C351.725,261.801,349.467,266.728,345.531,269.834z"/>
+ <polygon points="439.994,115.175 435.216,117.938 343.578,170.93 407.313,60.358 409.83,55.992 396.011,48 393.523,52.313
+ 322.748,175.098 339.418,191.794 443.38,131.674 447.974,129.018 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-nutrition.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-nutrition.svg
new file mode 100644
index 00000000..375b45e5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-nutrition.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M359,233.62l-0.106-0.039c-0.136-0.138-0.306-0.443-0.444-0.579L279.551,154h-0.004c-5.848-6-14.23-10.168-23.547-10.168
+ c-11.842,0-22.174,6.168-27.708,16.168h-0.007c0,0-7.109,11.351-18.318,29.249l32.617,39.85c2.947,3.772,3.305,7.895,1.414,9.785
+ l-0.114,0.114c-2.296,2.296-5.894,1.535-9.785-1.414l-35.967-29.439c-23.608,37.693-56.827,90.731-83.671,133.592l19.123,23.362
+ c2.947,3.772,3.305,7.895,1.414,9.785l-0.114,0.114c-2.296,2.296-5.894,1.535-9.785-1.414l-20.22-16.55
+ C84.874,388.974,70.194,412.411,69,414.315v0.003c-3,5.066-5,11.144-5,17.682c0,17.674,14.244,32,31.918,32
+ c7.842,0,14.383-3.398,20.628-7.508l114.842-84.195l-28.971-35.395c-2.947-3.772-3.305-7.895-1.414-9.785l0.114-0.114
+ c2.296-2.296,5.894-1.534,9.785,1.415l37.963,31.215C303.85,319.348,355.035,282,355.035,282h0.005
+ c7.859-6,13.024-15.319,13.024-25.857c0-8.713-3.064-16.75-9.064-22.521V233.62z"/>
+ <polygon points="448,138.781 431.514,111.087 365.284,149.299 414.515,64.086 386.896,48 316.897,169.084 345.485,197.672 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paper-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paper-outline.svg
new file mode 100644
index 00000000..7704053f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paper-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M112,64v16v320h16V80h304v337.143c0,8.205-6.652,14.857-14.857,14.857H94.857C86.652,432,80,425.348,80,417.143V128h16v-16
+ H64v305.143C64,434.157,77.843,448,94.857,448h322.285C434.157,448,448,434.157,448,417.143V64H112z"/>
+ <rect x="160" y="112" width="128" height="16"/>
+ <rect x="160" y="192" width="240" height="16"/>
+ <rect x="160" y="272" width="192" height="16"/>
+ <rect x="160" y="352" width="240" height="16"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paper.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paper.svg
new file mode 100644
index 00000000..5c0f3bfb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paper.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M112,64v16v32v288H96V112H64v305.143C64,434.157,77.843,448,94.857,448h322.285C434.157,448,448,434.157,448,417.143V64H112
+ z M160,112h128v16H160V112z M160,272h192v16H160V272z M400,368H160v-16h240V368z M400,208H160v-16h240V208z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paperplane-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paperplane-outline.svg
new file mode 100644
index 00000000..ceb46f16
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paperplane-outline.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M96,249.6l116.6,51.3L269.8,416L416,96L96,249.6z M228.1,296.5l155.7-166.2L269.2,379.2L228.1,296.5z M381.8,128.3
+ L216.8,285.4L134,249L381.8,128.3z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paperplane.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paperplane.svg
new file mode 100644
index 00000000..6b74591d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paperplane.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="96,249.6 202,296.3 416,96 "/>
+ <polygon points="416,96 217.9,311.7 269.8,416 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-partlysunny-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-partlysunny-outline.svg
new file mode 100644
index 00000000..f5010f9d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-partlysunny-outline.svg
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <g>
+ <g>
+ <rect x="208" y="96" class="st0" width="16" height="54"/>
+ <rect x="64" y="240" class="st0" width="55" height="16"/>
+ <polygon class="st0" points="107.5,149.1 118.5,138 149.9,169.6 138.9,180.7 "/>
+ <polygon class="st0" points="287.4,179.7 276.4,168.6 307.7,137 318.8,148.1 "/>
+ <polygon class="st0" points="120.5,352.5 109.5,341.4 140.9,309.8 151.9,320.9 "/>
+ </g>
+ <g>
+ <path class="st0" d="M192.6,294.9c-20.2-8.1-34.6-27.9-34.6-51.1c0-30.3,24.5-55,54.7-55c15.6,0,29.7,6.6,39.6,17.2
+ c4.8-3.5,9.5-6.2,13.6-8.2c-12.9-15.1-32-24.7-53.3-24.7c-38.7,0-70.3,31.7-70.3,70.7c0,27.4,15.6,51.2,38.3,62.9
+ C184.3,301.5,188.5,297.7,192.6,294.9z"/>
+ </g>
+ </g>
+ <path class="st0" d="M299,239.8c14.5,0,28.1,4.8,39.3,13.9c10.9,8.9,18.6,21.3,21.7,34.9l3.1,14l14.2-1.8c2.1-0.3,4.1-0.4,6.1-0.4
+ c26.9,0,48.8,22.1,48.8,49.2c0,27.1-21.9,49.2-48.8,49.2H225.7c-9.5,0-18.5-3.9-25.4-10.8c-6.8-7-10.6-16.2-10.6-25.9
+ c0-18.6,14.5-33.8,33.2-36.9c1.6-0.3,8.8-1.2,14.2-1.7c0,0-0.5-5.3-0.6-9.6c-0.1-4.3-0.1-9.4-0.1-11.5
+ C236.5,268,264.5,239.8,299,239.8 M299,224c-43.3,0-78.3,35.2-78.3,78.5c0,2.6,0.1,5.2,0.4,7.8c-26.4,2.3-47.1,25.5-47.1,52.6
+ c0,28.6,23.2,53.1,51.7,53.1h157.7c35.7,0,64.6-29.9,64.6-65.7c0-35.8-28.9-65.3-64.6-65.3c-2.7,0-5.4,0-8,0.3
+ C367.5,250.3,336.3,224,299,224L299,224z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-partlysunny.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-partlysunny.svg
new file mode 100644
index 00000000..1f20c73f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-partlysunny.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <g>
+ <g>
+ <rect x="208" y="96" class="st0" width="16" height="54"/>
+ <rect x="64" y="240" class="st0" width="55" height="16"/>
+ <polygon class="st0" points="107.5,149.1 118.5,138 149.9,169.6 138.9,180.7 "/>
+ <polygon class="st0" points="287.4,179.7 276.4,168.6 307.7,137 318.8,148.1 "/>
+ <polygon class="st0" points="120.5,352.5 109.5,341.4 140.9,309.8 151.9,320.9 "/>
+ </g>
+ <path class="st0" d="M299,224c-43.3,0-78.3,35.2-78.3,78.5c0,2.6,0.1,5.2,0.4,7.8c-26.4,2.3-47.1,25.5-47.1,52.6
+ c0,28.6,23.2,53.1,51.7,53.1h157.7c35.7,0,64.6-29.9,64.6-65.7c0-35.8-28.9-65.3-64.6-65.3c-2.7,0-5.4,0-8,0.3
+ C367.5,250.3,336.3,224,299,224L299,224z"/>
+ </g>
+ <path class="st0" d="M264.7,196.3c-12.9-14.3-31.4-23.3-52-23.3c-38.7,0-70.3,31.7-70.3,70.7c0,27.4,15.6,51.2,38.3,62.9
+ c0,0,0-0.1,0-0.1c0,0,0.1,0.1,0.1,0.1c4.5-12.1,11.4-19.8,22.6-25.6c0.2-0.1,0.4-0.2,0.7-0.4c0.2-0.1,0.5-0.2,0.7-0.3
+ c-0.2-2.3-0.3-4.7-0.3-7c-0.3-31.9,30.2-70.5,61-75.4c0.1-0.1,0.3-0.1,0.4-0.2C265.5,197.3,265.1,196.8,264.7,196.3z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pause-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pause-outline.svg
new file mode 100644
index 00000000..c1907cf6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pause-outline.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M191,112v288h-47V112H191 M207,96h-79v320h79V96L207,96z"/>
+ <path d="M368,112v288h-47V112H368 M384,96h-79v320h79V96L384,96z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pause.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pause.svg
new file mode 100644
index 00000000..acf5ee2b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pause.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <rect x="128" y="96" width="79" height="320"/>
+ <rect x="305" y="96" width="79" height="320"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paw-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paw-outline.svg
new file mode 100644
index 00000000..78d693c1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paw-outline.svg
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M443.827,195.5c-4.383-11.73-11.753-20.212-21.317-24.524c-4.389-1.975-8.995-2.976-13.688-2.976
+ c-20.025,0-40.372,18.667-50.632,46.454c-12.698,34.42-5.315,68.135,17.173,78.423c4.522,2.071,9.365,3.123,14.394,3.123
+ c20.396,0,41.126-17.119,51.581-42.596C449.238,234.121,450.168,212.477,443.827,195.5z M426.214,246.295
+ c-7.836,18.898-22.994,32.098-36.862,32.098c-2.809,0-5.488-0.569-7.968-1.694c-14.121-6.394-17.862-31.059-8.518-56.152
+ c7.775-20.817,22.448-35.355,35.683-35.355c2.51,0,4.979,0.533,7.34,1.588c6.88,3.067,10.622,9.712,12.551,14.745
+ C433.35,214.332,432.518,231.068,426.214,246.295z"/>
+ <path d="M153.811,214.454C143.551,186.667,123.204,168,103.179,168c-4.693,0-9.3,1.001-13.689,2.976
+ c-9.565,4.312-16.934,12.794-21.317,24.524c-6.341,16.977-5.411,38.621,2.49,57.904C81.118,278.881,101.848,296,122.244,296
+ c5.028,0,9.871-1.052,14.394-3.123C159.126,282.589,166.509,248.874,153.811,214.454z M130.616,276.698
+ c-2.479,1.125-5.16,1.694-7.968,1.694c-13.868,0-29.026-13.199-36.862-32.098c-6.304-15.227-7.136-31.963-2.226-44.771
+ c1.929-5.033,5.671-11.678,12.551-14.745c2.361-1.055,4.83-1.588,7.34-1.588c13.234,0,27.907,14.538,35.683,35.355
+ C148.479,245.64,144.737,270.305,130.616,276.698z"/>
+ <path d="M198.347,210.601c1.855,0.081,3.727,0.03,5.563-0.151c10.787-1.059,20.54-6.594,28.207-16.008
+ c12.371-15.191,15.806-38.974,13.201-63.439C241.336,93.3,221.469,65.161,194.776,64c0,0-3.811,0.008-5.75,0.193
+ c-11.776,1.164-22.481,7.283-30.957,17.695c-12.291,15.101-18.198,37.57-15.803,60.104
+ C146.202,179.269,170.836,209.404,198.347,210.601z M171.047,91.831c3.923-4.739,10.51-10.577,19.62-11.476
+ c1.143-0.113,2.288-0.146,3.404-0.098c18.207,0.792,31.859,23.271,34.936,52.428c2.146,20.15-0.148,40.055-9.845,51.779
+ c-4.874,5.898-10.556,9.204-16.881,9.825c-1.081,0.104-2.167,0.133-3.229,0.087c-19.257-0.838-37.414-25.091-40.473-54.067
+ C156.611,121.779,161.273,103.656,171.047,91.831z"/>
+ <path d="M256,240c-64,0-128,76.074-128,149.128c0,21.798,10.932,39.331,21.667,46.517C162.925,444.516,172.269,448,191.704,448
+ c23.093,0,29.325-8.078,40.136-15.205c7.819-5.152,14.572-9.605,24.161-9.605s16.342,4.453,24.16,9.605
+ C290.972,439.922,297.203,448,320.297,448c19.434,0,28.778-3.484,42.036-12.355C373.068,428.459,384,410.926,384,389.128
+ C384,316.074,320,240,256,240z M353.963,420.776c-10.964,7.337-17.366,9.778-33.666,9.778c-14.225,0-18.624-3.201-25.911-8.51
+ c-1.848-1.344-3.759-2.736-5.946-4.177c-8.619-5.682-18.39-12.123-32.439-12.123s-23.82,6.441-32.438,12.121
+ c-2.189,1.442-4.1,2.835-5.947,4.179c-7.287,5.309-11.686,8.51-25.911,8.51c-16.3,0-22.703-2.441-33.667-9.778
+ C152.395,417,144,405.456,144,389.128c0-30.277,13.377-64.231,35.783-90.823c10.886-12.921,23.517-23.6,36.526-30.885
+ C229.713,259.917,243.067,256,256,256c12.934,0,26.287,3.917,39.691,11.42c13.01,7.285,25.64,17.964,36.525,30.885
+ C354.623,324.896,368,358.851,368,389.128C368,405.456,359.605,417,353.963,420.776z"/>
+ <path d="M308.281,210.265c1.836,0.182,3.709,0.232,5.563,0.151c27.511-1.196,52.146-31.332,56.081-68.607
+ c2.395-22.534-3.514-45.004-15.804-60.104c-8.476-10.412-18.783-16.228-30.56-17.392c-1.939-0.186-6.146-0.312-6.146-0.312
+ c-26.693,1.161-46.561,29.115-50.542,66.817c-2.604,24.466,0.83,48.248,13.2,63.439
+ C287.741,203.671,297.494,209.206,308.281,210.265z M283.186,132.501c3.076-29.156,16.729-51.636,34.936-52.428
+ c1.115-0.048,2.261-0.016,3.404,0.098c9.109,0.898,15.696,6.736,19.619,11.476c9.774,11.825,14.436,29.948,12.468,48.479
+ c-3.06,28.977-21.216,53.229-40.474,54.067c-1.061,0.046-2.146,0.017-3.229-0.087c-6.324-0.621-12.007-3.927-16.881-9.825
+ C283.334,172.556,281.039,152.651,283.186,132.501z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paw.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paw.svg
new file mode 100644
index 00000000..c83a883e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paw.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M443.827,195.5c-4.383-11.73-11.753-20.212-21.317-24.524c-4.389-1.975-8.995-2.976-13.688-2.976
+ c-20.025,0-40.372,18.667-50.632,46.454c-12.698,34.42-5.315,68.135,17.173,78.423c4.522,2.071,9.365,3.123,14.394,3.123
+ c20.396,0,41.126-17.119,51.581-42.596C449.238,234.121,450.168,212.477,443.827,195.5z"/>
+ <path d="M153.811,214.454C143.551,186.667,123.204,168,103.179,168c-4.693,0-9.3,1.001-13.689,2.976
+ c-9.565,4.312-16.934,12.794-21.317,24.524c-6.341,16.977-5.411,38.621,2.49,57.904C81.118,278.881,101.848,296,122.244,296
+ c5.028,0,9.871-1.052,14.394-3.123C159.126,282.589,166.509,248.874,153.811,214.454z"/>
+ <path d="M198.347,210.601c1.855,0.081,3.727,0.03,5.563-0.151c10.787-1.059,20.54-6.594,28.207-16.008
+ c12.371-15.191,15.806-38.974,13.201-63.439C241.336,93.3,221.469,65.161,194.776,64c0,0-3.811,0.008-5.75,0.193
+ c-11.776,1.164-22.481,7.283-30.957,17.695c-12.291,15.101-18.198,37.57-15.803,60.104
+ C146.202,179.269,170.836,209.404,198.347,210.601z"/>
+ <path d="M256,240c-64,0-128,76.074-128,149.128c0,21.798,10.932,39.331,21.667,46.517C162.925,444.516,172.269,448,191.704,448
+ c23.093,0,29.325-8.078,40.136-15.205c7.819-5.152,14.572-9.605,24.161-9.605s16.342,4.453,24.16,9.605
+ C290.972,439.922,297.203,448,320.297,448c19.434,0,28.778-3.484,42.036-12.355C373.068,428.459,384,410.926,384,389.128
+ C384,316.074,320,240,256,240z"/>
+ <path d="M308.281,210.265c1.836,0.182,3.709,0.232,5.563,0.151c27.511-1.196,52.146-31.332,56.081-68.607
+ c2.395-22.534-3.514-45.004-15.804-60.104c-8.476-10.412-18.783-16.228-30.56-17.392c-1.939-0.186-6.146-0.312-6.146-0.312
+ c-26.693,1.161-46.561,29.115-50.542,66.817c-2.604,24.466,0.83,48.248,13.2,63.439
+ C287.741,203.671,297.494,209.206,308.281,210.265z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-people-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-people-outline.svg
new file mode 100644
index 00000000..df702908
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-people-outline.svg
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M256,112L256,112L256,112z"/>
+ <path d="M349.2,334.8c-13.5-4.7-28.1-5-41.6-9.7c-4.1-1.4-12.2-3.1-13.9-7.8c-1.6-4.6-1.6-10-1.9-14.8c-0.2-3.8-0.3-7.6-0.3-11.4
+ c0-2.5,6.4-7.8,7.8-10.1c5.4-9,5.9-21.1,6.9-31.3c8.7,2.4,9.8-13.7,11.3-18.6c1.1-3.4,7.8-26.8-2.6-23.6c2.5-4.4,3.5-9.8,4.2-14.7
+ c2-12.8,2.8-26.8-1.1-39.3c-8.1-26-33-40.6-59.3-41.4c-26.7-0.9-53.5,11.9-63.5,37.8c-4.8,12.6-4.4,26.3-2.8,39.5
+ c0.7,6,1.7,12.7,4.7,18.1c-9.7-2.9-4.5,17.7-3.4,21.3c1.6,5.1,3,23.4,12.1,20.9c0.8,8.1,1.7,16.4,3.9,24.3
+ c1.5,5.3,4.6,9.8,8.2,13.9c1.8,2,2.7,2.2,2.6,4.8c-0.1,7.8,0.1,16.2-1.9,23.8c-2,7.6-18.7,10.8-25.4,12.2
+ c-18,3.7-34.6,5.4-49.6,16.6C126.1,358.2,117,378.3,117,400c83.3,0,166.6,0,249.9,0c9.4,0,18.7,0,28.1,0
+ C395,370.5,377.2,344.5,349.2,334.8C338,330.9,360.5,338.7,349.2,334.8z M147.1,363.6c5.6-5.9,12.7-11.1,20.4-14
+ c10.5-4,22.4-3.8,33.3-6.6c9-2.3,20.2-5.9,27.2-12.4c6.4-6,7.1-15.2,7.7-23.5c0.5-7,0.4-13.9,0.4-20.9c0-4.9-5.7-7.7-8.5-11.6
+ c-4.5-6.1-4.7-15.2-5.6-22.5c-0.4-3.2-0.5-7.3-3.2-9.5c-3-2.4-5.2-3.7-6.7-7.5c-2-5.2-2.7-10.8-4.3-16.2c-1-3.5,2.5-6.8,3.9-9.7
+ c2.6-5.3-1.9-13.5-2.8-19c-2.8-16.4-2.7-34.3,9.1-47.3c23.7-26.2,78-17.9,85.8,18.9c2.4,11.5,0.9,24.9-2.3,36.1
+ c-1.4,4.8-3,8.3-0.2,13c4.2,6.8,2.4,11.2,0.4,18.8c-1.6,6.3-3.6,9.1-8.4,13c-4,3.2-3.4,11.2-4.1,15.8c-0.8,5.6-1.3,11.5-4.7,16.2
+ c-1.3,1.8-8.4,7.4-8.4,9.3c0,11-0.5,22.2,1.4,33.1c2.6,15.5,15.6,19.2,28.6,24.5c13.2,5.1,28.5,3.2,41.3,9.5
+ c13.2,6.5,25.9,18.4,29.7,33.1c-79.3,0-158.6,0-237.9,0c-1.4,0-2.8,0-4.2,0C136.9,375.9,141.5,369.6,147.1,363.6
+ C156.3,353.9,141.2,369.9,147.1,363.6z"/>
+ </g>
+ <path d="M144.1,322c7-3.5,14.6-4.3,22.3-5.1c2.8-0.3,4.1-2.2,2-4.9c-4-5.1-17.8-6.1-23.6-8.4c-3.6-1.4-4.6-2.7-4.9-6.7
+ c-0.1-1.8-1.1-9.8,0.3-11.1c1-1,7.3-0.6,8.7-0.8c5.7-0.7,11.5-1.9,16.9-4c2.3-0.9,4.5-2,6.5-3.4c2.4-1.8-1.8-6.2-2.9-8.6
+ c-3.4-7.5-4.9-15.7-5.4-23.9c-1-16.1,1.5-32.3-1.5-48.3c-4.5-24.5-23.4-36.8-47.5-36.8c-14.9,0-29.6,5.1-37.9,18.1
+ c-9.2,14.3-8.7,32.1-8.2,48.4c0.3,9.3,0.7,18.7-0.6,28c-0.6,4-1.5,7.9-2.9,11.7c-1.1,2.9-6.7,10.1-4.5,11.6
+ c8.3,5.9,22.3,7.9,32.3,7.1c0.3,4.9,1.2,11.2-0.6,15.8c-2.8,7.2-23.7,9.1-30,11.2C45,317.8,32,332.5,32,352c18.3,0,36.5,0,54.8,0
+ c8.2,0,16.4,0,24.7,0c1.3,0,6.3-9.3,7.7-10.8C126.2,333.4,134.8,326.7,144.1,322C153.1,317.5,129.5,329.4,144.1,322z M102.8,336
+ c-16.3,0-32.6,0-48.9,0c7.1-11.8,24.9-11,36.6-15.2c10.8-3.9,17.7-10.5,18.8-22c0.1-1.3,0.2-29.2-0.9-29.2
+ c-8.7-0.3-17.8-0.1-26.5-1.4c6.9-22.3,0.3-45.3,4-67.8c2.7-16.3,13.1-25.3,29.7-25.3c15.9,0,27.7,7.4,31.1,23.4
+ c4.8,23.2-2,46.9,5.4,69.9c-5.5,1.4-11.3,1.6-17,1.8c-2.8,0.1-5.7,0.2-8.5,0.3c-1.8,0.1-1.2,3.2-1.3,4.7c-1,10.9-5,28.1,3.7,36.9
+ C119.4,318.1,109,326.4,102.8,336z"/>
+ <path d="M399.8,352c26.7,0,53.5,0,80.2,0c0-19.5-13.1-34.3-30.7-40.1c-8.1-2.6-23.7-3.4-29.5-10.4c-2.9-3.5-1.3-12.4-1-16.6
+ c4.4,0.4,9.2-0.3,13.7-0.9c4.1-0.6,8.1-1.4,12-2.8c1.8-0.7,3.6-1.4,5.3-2.4c3.9-2.3,2.1-2.7,0.1-6.1c-10.9-18.3-6-41.5-6.5-61.6
+ c-0.4-16.7-4.8-35-20-44.4c-13.7-8.5-34-8.8-48.7-2.8c-42.4,17-17.4,73.2-31.9,105.4c-2.5,5.4-6.1,7.3,0.2,10.5
+ c3.5,1.8,7.3,3,11.1,3.9c5.8,1.4,11.8,2.2,17.8,2.4c1,0,0.3,12.6,0,13.9c-1.1,4.9-11.8,6.3-15.8,7.4c-4.1,1.1-10.9,1.4-12.9,5.7
+ c-3,6.4,9.9,4.8,13.1,5.4c10.3,1.9,19.4,7.6,27.4,14.1C389.6,337.4,397.6,344.2,399.8,352z M399.4,324.9c-5.1-4.7-10.4-9.3-16.3-13
+ c8.8-8.8,4.7-25.9,3.7-36.9c-0.6-6.3-2-4.7-8.3-4.9c-6-0.2-12.8,0.1-18.5-1.8c7.2-22.3,1.3-45.2,5-67.9
+ c2.8-17.1,14.5-25.5,31.5-25.5c15.4,0,26,7.7,29.2,23c4.9,23.1-2.6,47,4.5,70c-8.5,1.3-17.3,1-25.9,1.3c-2.1,0.1-1.9,25.1-1.7,27.3
+ c0.7,11.7,6.1,18.8,17.2,23.3c12.1,4.9,31,3.6,38.4,15.9c-9.3,0-18.5,0-27.8,0c-5.6,0-11.2,0-16.9,0
+ C406.4,335.8,404.6,329.6,399.4,324.9C394.4,320.3,403.4,328.5,399.4,324.9z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-people.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-people.svg
new file mode 100644
index 00000000..d478f537
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-people.svg
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M349.2,334.8C360.5,338.7,338,330.9,349.2,334.8L349.2,334.8z"/>
+ <path d="M349.2,334.8c-13.5-4.7-28.1-5-41.6-9.7c-4.1-1.4-12.2-3.1-13.9-7.8c-1.6-4.6-1.6-10-1.9-14.8c-0.2-3.8-0.3-7.6-0.3-11.4
+ c0-2.5,6.4-7.8,7.8-10.1c5.4-9,5.9-21.1,6.9-31.3c8.7,2.4,9.8-13.7,11.3-18.6c1.1-3.4,7.8-26.8-2.6-23.6c2.5-4.4,3.5-9.8,4.2-14.7
+ c2-12.8,2.8-26.8-1.1-39.3c-8.1-26-33-40.6-59.3-41.4c-26.7-0.9-53.5,11.9-63.5,37.8c-4.8,12.6-4.4,26.3-2.8,39.5
+ c0.7,6,1.7,12.7,4.7,18.1c-9.7-2.9-4.5,17.7-3.4,21.3c1.6,5.1,3,23.4,12.1,20.9c0.8,8.1,1.7,16.4,3.9,24.3
+ c1.5,5.3,4.6,9.8,8.2,13.9c1.8,2,2.7,2.2,2.6,4.8c-0.1,7.8,0.1,16.2-1.9,23.8c-2,7.6-18.7,10.8-25.4,12.2
+ c-18,3.7-34.6,5.4-49.6,16.6C126.1,358.2,117,378.3,117,400c83.3,0,166.6,0,249.9,0c9.4,0,18.7,0,28.1,0
+ C395,370.5,377.2,344.5,349.2,334.8z"/>
+ <path d="M143.3,322.5c0.6-0.3,1.2-0.6,1.6-0.8c-0.3,0.1-0.6,0.3-0.8,0.4C143.8,322.2,143.6,322.3,143.3,322.5z"/>
+ <path d="M143.3,322.5c-3.4,1.7-7.5,3.8,0.8-0.4c3-1.5,2.4-1.2,0.8-0.4c6.8-3.2,14.1-4,21.4-4.7c2.8-0.3,4.1-2.2,2-4.9
+ c-4-5.1-17.8-6.1-23.6-8.4c-3.6-1.4-4.6-2.7-4.9-6.7c-0.1-1.8-1.1-9.8,0.3-11.1c1-1,7.3-0.6,8.7-0.8c5.7-0.7,11.5-1.9,16.9-4
+ c2.3-0.9,4.5-2,6.5-3.4c2.4-1.8-1.8-6.2-2.9-8.6c-3.4-7.5-4.9-15.7-5.4-23.9c-1-16.1,1.5-32.3-1.5-48.3
+ c-4.5-24.5-23.4-36.8-47.5-36.8c-14.9,0-29.6,5.1-37.9,18.1c-9.2,14.3-8.7,32.1-8.2,48.4c0.3,9.3,0.7,18.7-0.6,28
+ c-0.6,4-1.5,7.9-2.9,11.7c-1.1,2.9-6.7,10.1-4.5,11.6c8.3,5.9,22.3,7.9,32.3,7.1c0.3,4.9,1.2,11.2-0.6,15.8
+ c-2.8,7.2-23.7,9.1-30,11.2C45,317.8,32,332,32,352c18.3,0,36.5,0,54.8,0c8.2,0,16.4,0,24.7,0c1.3,0,6.3-9.3,7.7-10.8
+ C126,333.7,134.3,327.2,143.3,322.5z"/>
+ <path d="M449.3,311.9c-8.1-2.6-23.7-3.4-29.5-10.4c-2.9-3.5-1.3-12.4-1-16.6c4.4,0.4,9.2-0.3,13.7-0.9c4.1-0.6,8.1-1.4,12-2.8
+ c1.8-0.7,3.6-1.4,5.3-2.4c3.9-2.3,2.1-2.7,0.1-6.1c-10.9-18.3-6-41.5-6.5-61.6c-0.4-16.7-4.8-35-20-44.4c-13.7-8.5-34-8.8-48.7-2.8
+ c-42.4,17-17.4,73.2-31.9,105.4c-2.5,5.4-6.1,7.3,0.2,10.5c3.5,1.8,7.3,3,11.1,3.9c5.8,1.4,11.8,2.2,17.8,2.4c1,0,0.3,12.6,0,13.9
+ c-1.1,4.9-11.8,6.3-15.8,7.4c-4.1,1.1-10.9,1.4-12.9,5.7c-3,6.4,9.9,4.8,13.1,5.4c10.3,1.9,19.4,7.6,27.4,14.1
+ c6,4.9,14.1,11.5,16.3,19.5c26.7,0,53.5,0,80.2,0C480,332,466.9,317.7,449.3,311.9z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-person-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-person-outline.svg
new file mode 100644
index 00000000..23a0bc19
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-person-outline.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M202.4,201.7L202.4,201.7L202.4,201.7z"/>
+ <path d="M363.3,363.9c-12.9-4.6-31.4-6.2-43.2-8.8c-6.8-1.5-16.7-5.3-20-9.2c-3.3-4-1.3-40.9-1.3-40.9s6.1-9.6,9.4-18
+ s6.9-31.4,6.9-31.4s6.8,0,9.2-11.9c2.6-13,6.6-18.4,6.1-28.1c-0.5-9-5.2-9.5-5.7-9.5l0,0c0,0,4.9-13.6,5.6-42.4
+ C331.1,129.6,305,96,256,96s-75,33.5-74.3,67.6c0.6,28.7,5.6,42.4,5.6,42.4l0,0c-0.5,0-5.2,0.5-5.7,9.5c-0.5,9.7,3.6,14.9,6.1,27.9
+ c2.4,11.9,9.2,12,9.2,12s3.6,23.1,6.9,31.5c3.3,8.5,9.4,18,9.4,18s2,36.9-1.3,40.9c-3.3,4-13.2,7.7-20,9.2
+ c-11.9,2.6-30.3,4.3-43.2,8.9C135.8,368.5,96,384,96,416h160h160C416,384,376.2,368.5,363.3,363.9z M256,400H118.7
+ c2-3,4.7-5.1,8.2-7.6c7-5.1,16.1-9.8,27.1-13.6c6.8-2.4,16.7-4,25.4-5.3c5.7-0.9,11.1-1.7,15.9-2.8c3.4-0.8,20.8-5,28.8-14.6
+ c4.5-5.4,5.8-12.7,5.6-32.3c-0.1-10-0.6-19.3-0.6-19.7l-0.2-4.2l-2.3-3.5c-1.5-2.3-5.8-9.5-8-15.3c-1.8-4.7-4.6-19.2-6-28.1
+ c0,0,0.4,1-0.5-3.7c-0.9-4.7-8.4-4.3-9.4-8c-0.9-3.6-1.8-6.9-4.3-18.2c-2.5-11.3,2.8-11.2,3.9-16.2c0.6-3.1,0-5.7,0-5.8l0,0
+ c-0.3-1-4.1-13.4-4.7-37.7c-0.3-13.2,4.6-25.6,13.8-34.9c10.6-10.8,26-16.5,44.5-16.5c19,0,34,5.7,44.6,16.5
+ c9.2,9.3,14.1,21.7,13.8,34.9c-0.5,24.2-4.3,36.6-4.7,37.7l0,0c0,0.1-0.6,1.7-0.4,5.2c0.2,5.4,6.8,5.5,4.3,16.8
+ c-2.5,11.3-3.4,14.6-4.3,18.2c-0.9,3.6-8.5,3.3-9.4,8c-0.9,4.7-0.5,3.7-0.5,3.7c-1.4,8.9-4.2,23.4-6,28.1c-2.3,5.8-6.6,13-8,15.3
+ l-2.3,3.5l-0.2,4.2c0,0.4-0.5,9.7-0.6,19.7c-0.2,19.6,1.1,26.9,5.6,32.3c8,9.5,25.4,13.8,28.8,14.6c4.8,1.1,10.2,1.9,15.9,2.8
+ c8.7,1.3,18.6,2.9,25.4,5.3c11,3.9,20.2,8.6,27.1,13.7c3.5,2.5,6.2,4.6,8.2,7.6L256,400L256,400z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-person.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-person.svg
new file mode 100644
index 00000000..d9b5d999
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-person.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M363.3,363.9c-12.9-4.6-31.4-6.2-43.2-8.8c-6.8-1.5-16.7-5.3-20-9.2c-3.3-4-1.3-40.9-1.3-40.9s6.1-9.6,9.4-18
+ s6.9-31.4,6.9-31.4s6.8,0,9.2-11.9c2.6-13,6.6-18.4,6.1-28.1c-0.5-9-5.2-9.5-5.7-9.5l0,0c0,0,4.9-13.6,5.6-42.4
+ C331.1,129.6,305,96,256,96s-75,33.5-74.3,67.6c0.6,28.7,5.6,42.4,5.6,42.4l0,0c-0.5,0-5.2,0.5-5.7,9.5c-0.5,9.7,3.6,14.9,6.1,27.9
+ c2.4,11.9,9.2,12,9.2,12s3.6,23.1,6.9,31.5c3.3,8.5,9.4,18,9.4,18s2,36.9-1.3,40.9c-3.3,4-13.2,7.7-20,9.2
+ c-11.9,2.6-30.3,4.3-43.2,8.9C135.8,368.5,96,384,96,416h160h160C416,384,376.2,368.5,363.3,363.9z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-personadd-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-personadd-outline.svg
new file mode 100644
index 00000000..acd809d8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-personadd-outline.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="416,153 391,153 391,128 377,128 377,153 352,153 352,167 377,167 377,192 391,192 391,167 416,167 "/>
+ <g>
+ <path d="M202.4,201.7C202.4,201.7,202.4,201.7,202.4,201.7L202.4,201.7z"/>
+ <path d="M363.3,363.9c-12.9-4.6-31.4-6.2-43.2-8.8c-6.8-1.5-16.7-5.3-20-9.2c-3.3-4-1.3-40.9-1.3-40.9s6.1-9.6,9.4-18
+ c3.3-8.4,6.9-31.4,6.9-31.4s6.8,0,9.2-11.9c2.6-13,6.6-18.4,6.1-28.1c-0.5-9-5.2-9.5-5.7-9.5c0,0,0,0,0,0s4.9-13.6,5.6-42.4
+ C331.1,129.6,305,96,256,96c-49,0-75,33.5-74.3,67.6c0.6,28.7,5.6,42.4,5.6,42.4s0,0,0,0c-0.5,0-5.2,0.5-5.7,9.5
+ c-0.5,9.7,3.6,14.9,6.1,27.9c2.4,11.9,9.2,12,9.2,12s3.6,23.1,6.9,31.5c3.3,8.5,9.4,18,9.4,18s2,36.9-1.3,40.9
+ c-3.3,4-13.2,7.7-20,9.2c-11.9,2.6-30.3,4.3-43.2,8.9C135.8,368.5,96,384,96,416h160h160C416,384,376.2,368.5,363.3,363.9z
+ M256,400H118.7c2-3,4.7-5.1,8.2-7.6c7-5.1,16.1-9.8,27.1-13.6c6.8-2.4,16.7-4,25.4-5.3c5.7-0.9,11.1-1.7,15.9-2.8
+ c3.4-0.8,20.8-5,28.8-14.6c4.5-5.4,5.8-12.7,5.6-32.3c-0.1-10-0.6-19.3-0.6-19.7l-0.2-4.2l-2.3-3.5c-1.5-2.3-5.8-9.5-8-15.3
+ c-1.8-4.7-4.6-19.2-6-28.1c0,0,0.4,1-0.5-3.7c-0.9-4.7-8.4-4.3-9.4-8c-0.9-3.6-1.8-6.9-4.3-18.2c-2.5-11.3,2.8-11.2,3.9-16.2
+ c0.6-3.1,0-5.7,0-5.8c0,0,0,0,0,0c-0.3-1-4.1-13.4-4.7-37.7c-0.3-13.2,4.6-25.6,13.8-34.9c10.6-10.8,26-16.5,44.5-16.5
+ c19,0,34,5.7,44.6,16.5c9.2,9.3,14.1,21.7,13.8,34.9c-0.5,24.2-4.3,36.6-4.7,37.7c0,0,0,0,0,0c0,0.1-0.6,1.7-0.4,5.2
+ c0.2,5.4,6.8,5.5,4.3,16.8c-2.5,11.3-3.4,14.6-4.3,18.2c-0.9,3.6-8.5,3.3-9.4,8s-0.5,3.7-0.5,3.7c-1.4,8.9-4.2,23.4-6,28.1
+ c-2.3,5.8-6.6,13-8,15.3l-2.3,3.5l-0.2,4.2c0,0.4-0.5,9.7-0.6,19.7c-0.2,19.6,1.1,26.9,5.6,32.3c8,9.5,25.4,13.8,28.8,14.6
+ c4.8,1.1,10.2,1.9,15.9,2.8c8.7,1.3,18.6,2.9,25.4,5.3c11,3.9,20.2,8.6,27.1,13.7c3.5,2.5,6.2,4.6,8.2,7.6H256z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-personadd.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-personadd.svg
new file mode 100644
index 00000000..1ecf3429
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-personadd.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="416,153 391,153 391,128 377,128 377,153 352,153 352,167 377,167 377,192 391,192 391,167 416,167 "/>
+ <g>
+ <path d="M363.3,363.9c-12.9-4.6-31.4-6.2-43.2-8.8c-6.8-1.5-16.7-5.3-20-9.2c-3.3-4-1.3-40.9-1.3-40.9s6.1-9.6,9.4-18
+ c3.3-8.4,6.9-31.4,6.9-31.4s6.8,0,9.2-11.9c2.6-13,6.6-18.4,6.1-28.1c-0.5-9-5.2-9.5-5.7-9.5c0,0,0,0,0,0s4.9-13.6,5.6-42.4
+ C331.1,129.6,305,96,256,96c-49,0-75,33.5-74.3,67.6c0.6,28.7,5.6,42.4,5.6,42.4s0,0,0,0c-0.5,0-5.2,0.5-5.7,9.5
+ c-0.5,9.7,3.6,14.9,6.1,27.9c2.4,11.9,9.2,12,9.2,12s3.6,23.1,6.9,31.5c3.3,8.5,9.4,18,9.4,18s2,36.9-1.3,40.9
+ c-3.3,4-13.2,7.7-20,9.2c-11.9,2.6-30.3,4.3-43.2,8.9C135.8,368.5,96,384,96,416h160h160C416,384,376.2,368.5,363.3,363.9z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-photos-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-photos-outline.svg
new file mode 100644
index 00000000..df323c13
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-photos-outline.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M96,128v320h384V128H96z M464,432H112V144h352V432z"/>
+ <polygon points="32,64 32,384 80,384 80,368 48,368 48,80 400,80 400,112 416,112 416,64 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-photos.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-photos.svg
new file mode 100644
index 00000000..9a3b09e9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-photos.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M96,128v320h384V128H96z"/>
+ <polygon points="416,64 32,64 32,384 80,384 80,112 416,112 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pie-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pie-outline.svg
new file mode 100644
index 00000000..6c79a5d9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pie-outline.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M288,80.826c45.293,3.705,87.354,23.024,119.809,55.494C444.044,172.57,464,220.744,464,272.043
+ c0,25.924-5.08,51.042-15.099,74.703c-9.68,22.859-23.54,43.384-41.194,61.024c-17.654,17.639-38.204,31.481-61.08,41.151
+ c-23.673,10.01-48.823,15.081-74.752,15.081c-41.193,0-80.47-12.847-113.584-37.146c-15.95-11.705-29.957-25.733-41.633-41.692
+ c-8.378-11.453-15.422-23.724-21.041-36.634l180.259-45.008L288,300.496V288V81 M272,64v224L74.245,337.376
+ C101.653,420.221,179.841,480,271.875,480C386.75,480,480,386.875,480,272S387,64,272,64L272,64z"/>
+ <path d="M240,48.181v214.943L59.658,308.854c-9.117-23.568-11.197-56.973-11.158-69.496v-0.036v-0.035
+ c0-47.311,16.465-93.746,45.173-127.398c16.735-19.618,37.502-34.981,61.721-45.663C180.099,55.331,208.519,49.274,240,48.181
+ M256,32h-5.5C90.5,32,32,148.25,32,239.287c0,0,0.25,56.666,18.91,88.291L256,275.573V32L256,32z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pie.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pie.svg
new file mode 100644
index 00000000..13e2e345
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pie.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M272,64v224L74.245,337.376C101.653,420.221,179.841,480,271.875,480C386.75,480,480,386.875,480,272S387,64,272,64L272,64
+ z"/>
+ <path d="M256,32h-5.5C90.5,32,32,148.25,32,239.287c0,0,0.25,56.666,18.91,88.291L256,275.573V32L256,32z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pint-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pint-outline.svg
new file mode 100644
index 00000000..63753e05
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pint-outline.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M368,170.085c0-21.022-0.973-88.554-19.308-125.013C344.244,36.228,336.25,32,316.999,32H195.001
+ c-19.25,0-27.246,4.197-31.693,13.041C144.973,81.5,144,149.25,144,170.272c0,98,32,100.353,32,180.853c0,39.5-16,71.402-16,99.402
+ c0,27,9,29.473,32,29.473h128c23,0,32-2.535,32-29.535c0-28-16-59.715-16-99.215C336,270.75,368,268.085,368,170.085z
+ M177.602,51.983c0.778-1.546,1.339-1.763,2.53-2.295c1.977-0.884,6.161-1.688,14.869-1.688h121.998
+ c8.708,0,12.893,0.803,14.869,1.687c1.19,0.532,1.752,0.872,2.53,2.418c8.029,15.967,13.601,42.611,16.105,75.896H161.496
+ C164.001,94.653,169.572,67.951,177.602,51.983z M334.631,462.636C332.76,463.377,327.844,464,320,464H192
+ c-7.844,0-12.761-0.623-14.639-1.359c-0.394-0.93-1.361-4.166-1.361-12.27c0-10.856,3.016-23.16,6.508-37.334
+ c4.449-18.059,9.492-38.557,9.492-61.943c0-40.997-7.993-63.802-15.724-85.842C168.274,242.438,160,218.838,160,170.155
+ c0-9.025,0.191-17.756,0.558-26.155h190.886c0.365,8.376,0.557,17.083,0.557,26.085c0,48.688-8.276,72.302-16.28,95.169
+ c-7.728,22.079-15.72,44.895-15.72,85.887c0,23.39,5.043,43.822,9.493,61.856c3.491,14.15,6.507,26.368,6.507,37.222
+ C336,458.355,335.024,461.713,334.631,462.636z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pint.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pint.svg
new file mode 100644
index 00000000..0f6f784e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pint.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M368,170.085c0-21.022-0.973-88.554-19.308-125.013C344.244,36.228,336.25,32,316.999,32H195.001
+ c-19.25,0-27.246,4.197-31.693,13.041C144.973,81.5,144,149.25,144,170.272c0,98,32,100.353,32,180.853c0,39.5-16,71.402-16,99.402
+ c0,27,9,29.473,32,29.473h128c23,0,32-2.535,32-29.535c0-28-16-59.715-16-99.215C336,270.75,368,268.085,368,170.085z
+ M177.602,51.983c0.778-1.546,1.339-1.763,2.53-2.295c1.977-0.884,6.161-1.688,14.869-1.688h121.998
+ c8.708,0,12.893,0.803,14.869,1.687c1.19,0.532,1.752,0.872,2.53,2.418c8.029,15.967,13.601,42.611,16.105,75.896H161.496
+ C164.001,94.653,169.572,67.951,177.602,51.983z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-play-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-play-outline.svg
new file mode 100644
index 00000000..8e95177e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-play-outline.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M144,124.9L353.8,256L144,387.1V124.9 M128,96v320l256-160L128,96L128,96z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-play.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-play.svg
new file mode 100644
index 00000000..48366336
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-play.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M128,96v320l256-160L128,96L128,96z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus-empty.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus-empty.svg
new file mode 100644
index 00000000..4fdb3bf4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus-empty.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M384,265H264v119h-17V265H128v-17h119V128h17v120h120V265z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus-outline.svg
new file mode 100644
index 00000000..3979af47
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus-outline.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <g>
+ <path d="M256,48C141.1,48,48,141.1,48,256s93.1,208,208,208c114.9,0,208-93.1,208-208S370.9,48,256,48z M256,446.7
+ c-105.1,0-190.7-85.5-190.7-190.7S150.9,65.3,256,65.3S446.7,150.9,446.7,256S361.1,446.7,256,446.7z"/>
+ </g>
+ </g>
+ <g>
+ <polygon points="264.1,128 247.3,128 247.3,247.9 128,247.9 128,264.7 247.3,264.7 247.3,384 264.1,384 264.1,264.7 384,264.7
+ 384,247.9 264.1,247.9 "/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus.svg
new file mode 100644
index 00000000..73f7272c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,48C141.1,48,48,141.1,48,256s93.1,208,208,208c114.9,0,208-93.1,208-208S370.9,48,256,48z M384,265H264v119h-17V265
+ H128v-17h119V128h17v120h120V265z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetag-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetag-outline.svg
new file mode 100644
index 00000000..59e41e33
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetag-outline.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M464,32H304L48,320l160,160l256-288V32z M448,184L208.125,456L72.062,320L311.587,48H448V184z"/>
+ <path d="M368,160c17.645,0,32-14.355,32-32s-14.355-32-32-32s-32,14.355-32,32S350.355,160,368,160z M368,112
+ c8.836,0,16,7.163,16,16s-7.164,16-16,16s-16-7.163-16-16S359.164,112,368,112z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetag.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetag.svg
new file mode 100644
index 00000000..577a9c70
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetag.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <circle cx="368" cy="128" r="16"/>
+ <path d="M304,32L48,320l160,160l256-288V32H304z M368,160c-17.645,0-32-14.355-32-32s14.355-32,32-32s32,14.355,32,32
+ S385.645,160,368,160z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetags-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetags-outline.svg
new file mode 100644
index 00000000..ea8650c2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetags-outline.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M448,64V32H288L32,320l160,160l23.471-23.904L240,480l240-272V64H448z M192,457.371L54.39,320L294.621,48H432v16v16
+ v105.377l-216.555,247.99l-11.34,11.363L192,457.371z M464,201.377L240,457.371l-13.182-12.65L448,192V80h16V201.377z"/>
+ <path d="M352,160c17.645,0,32-14.355,32-32s-14.355-32-32-32s-32,14.355-32,32S334.355,160,352,160z M352,112
+ c8.836,0,16,7.163,16,16s-7.164,16-16,16s-16-7.163-16-16S343.164,112,352,112z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetags.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetags.svg
new file mode 100644
index 00000000..67f45a46
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetags.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <polygon points="464,64 464,201.377 227.153,467.48 240,480 480,208 480,64 "/>
+ </g>
+ <g>
+ <path d="M288,32L32,320l160,160l23.471-23.904l11.348-11.375L448,192V80V64V32H288z M352,160c-17.645,0-32-14.355-32-32
+ s14.355-32,32-32s32,14.355,32,32S369.645,160,352,160z"/>
+ <circle cx="352" cy="128" r="16"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-printer-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-printer-outline.svg
new file mode 100644
index 00000000..a0530d7a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-printer-outline.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M432.5,112H400V64H112v48H80.5C62.9,112,48,125.8,48,143.3v158.4c0,17.5,14.9,32.3,32.5,32.3H128v114h256V334h48.5
+ c17.6,0,31.5-14.8,31.5-32.3V143.3C464,125.8,450.1,112,432.5,112z M128,80h256v32H128V80z M368,432H144V240h224V432z M448,301.7
+ c0,8.7-6.7,16.3-15.5,16.3H384v-94H128v94H80.5c-8.8,0-16.5-7.6-16.5-16.3V143.3c0-8.7,7.7-15.3,16.5-15.3H432h0.5
+ c8.8,0,15.5,6.6,15.5,15.3V301.7z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-printer.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-printer.svg
new file mode 100644
index 00000000..70b36892
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-printer.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <rect x="128" y="224" width="256" height="224"/>
+</g>
+<g>
+ <rect x="127.5" y="224.5" width="256" height="224"/>
+ <g>
+ <rect x="111.5" y="64.5" width="288" height="32"/>
+ <path d="M432.5,112.5h-352c-17.645,0-33,12.842-33,30.309v158.393c0,17.468,15.355,33.299,33,33.299h31v-126h288v126h33
+ c17.645,0,31-15.831,31-33.299V142.809C463.5,125.342,450.145,112.5,432.5,112.5z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pulse-strong.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pulse-strong.svg
new file mode 100644
index 00000000..c1542904
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pulse-strong.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M448,273.001c-21.27,0-39.296,13.999-45.596,32.999h-38.857l-28.361-85.417c-2.176-6.553-8.303-10.956-15.183-10.956
+ c-0.112,0-0.224,0-0.335,0.004c-7.016,0.145-13.117,4.844-15.049,11.588l-44.484,155.262L207.782,62.373
+ C206.535,54.893,200.333,48,192,48s-13.693,5.776-15.525,13.135L115.496,306H16v31.999h112c7.348,0,13.75-5.003,15.525-12.134
+ l45.368-182.177l51.324,307.94c1.229,7.377,7.397,11.92,14.864,12.344C255.389,463.99,255.695,464,256,464
+ c7.097,0,13.406-3.701,15.381-10.594l49.744-173.617l15.689,47.252c2.173,6.543,8.292,10.958,15.186,10.958h51.108
+ C409.973,355.999,427.477,369,448,369c26.511,0,48-22.492,48-49C496,293.491,474.511,273.001,448,273.001z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pulse.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pulse.svg
new file mode 100644
index 00000000..f347850a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pulse.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M448,288c-15.268,0-28.029,10.695-31.223,25h-59.004l-30.181-90.896c-1.105-3.329-4.246-5.543-7.759-5.478
+ c-3.508,0.072-6.559,2.422-7.524,5.795L258.067,411.74L199.892,62.685c-0.624-3.74-3.787-6.528-7.576-6.679
+ c-3.809-0.139-7.161,2.382-8.078,6.061L121.748,313H32v16h96c3.674,0,6.875-2.502,7.763-6.066l54.685-219.591l57.661,345.973
+ c0.615,3.688,3.703,6.459,7.437,6.672c0.153,0.009,0.307,0.013,0.459,0.013c3.549,0,6.699-2.35,7.687-5.797l56.872-198.496
+ l23.845,71.813c1.087,3.271,4.146,5.479,7.593,5.479h65.292c3.89,13.289,16.161,23,30.708,23c17.674,0,32-14.327,32-32
+ S465.674,288,448,288z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rainy-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rainy-outline.svg
new file mode 100644
index 00000000..815f6aa7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rainy-outline.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<path class="st0" d="M332.1,179.4c-2.8,0-5.7-0.1-8.4,0.3c-8.3-36.8-35.2-67.6-80.3-67.6c-50.9,0-82.3,38-82.3,83.6
+ c0,2.8,0.1,5.5,0.4,8.2c-27.7,2.5-49.5,31.3-49.5,59.8c0,29.2,22.9,54.6,51.6,56.2l-24.5,34.4c-1.1,1.6-2,3.4-2,5.5
+ c0,4.6,3.7,8.3,8.3,8.3c3,0,5.6-1.6,7.1-4l31-43.8h36.1l-46.1,65.8c-1.2,1.6-2.1,3.6-2.1,5.6c0,4.6,3.7,8.3,8.3,8.3
+ c3,0,5.6-1.8,7.2-4.3l52.6-75.5h37.9l-24.9,34.4c-1.2,1.6-2.2,3.8-2.2,5.6c0,4.6,3.7,8.3,8.3,8.3c3.1,0,5.4-1.7,7.2-4.1l31.6-44.3
+ h34.7c0.1,0,0.3-0.1,0.4-0.1l-46.1,65.9c-1.3,1.7-2.3,3.6-2.3,5.8c0,4.6,3.7,8.3,8.3,8.3c3.2,0,5.5-2,7.4-4.5l55.5-79.8
+ c26-9.9,44.6-35.8,44.6-65.2C400,212.8,369.6,179.4,332.1,179.4z M332.1,302.1H290l-0.1-0.1l-0.1,0.1H166.4
+ c-10,0-19.5-4.6-26.7-11.9c-7.2-7.3-11.1-17.2-11.1-27.4c0-19.6,15.2-39.8,34.9-43c1.7-0.3,9.2-1.4,15-1.9c0,0-0.5-5.6-0.7-10.2
+ c-0.1-4.6-0.1-9.9-0.1-12.1c0-36.4,29.5-66.9,65.8-66.9c15.2,0,29.5,5.1,41.3,14.7c11.5,9.3,19.6,25.4,22.8,39.7l3.3,14.7l14.9-1.9
+ c2.2-0.3,4.3-0.4,6.4-0.4c28.3,0,51.3,25.9,51.3,54.4C383.4,278.3,360.4,302.1,332.1,302.1z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rainy.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rainy.svg
new file mode 100644
index 00000000..143caf0e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rainy.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<path class="st0" d="M332.1,179.4c-2.8,0-5.7-0.1-8.4,0.3c-8.3-36.8-35.2-67.6-80.3-67.6c-50.9,0-82.3,38-82.3,83.6
+ c0,2.8,0.1,5.5,0.4,8.2c-27.7,2.5-49.5,31.3-49.5,59.8c0,29.2,22.9,54.6,51.6,56.2l-24.5,34.4c-1.1,1.6-2,3.4-2,5.5
+ c0,4.6,3.7,8.3,8.3,8.3c3,0,5.6-1.6,7.1-4l31-43.8h36.1l-46.1,65.8c-1.2,1.6-2.1,3.6-2.1,5.6c0,4.6,3.7,8.3,8.3,8.3
+ c3,0,5.6-1.8,7.2-4.3l52.6-75.5h37.9l-24.9,34.4c-1.2,1.6-2.2,3.8-2.2,5.6c0,4.6,3.7,8.3,8.3,8.3c3.1,0,5.4-1.7,7.2-4.1l31.6-44.3
+ h34.7c0.1,0,0.3-0.1,0.4-0.1l-46.1,65.9c-1.3,1.7-2.3,3.6-2.3,5.8c0,4.6,3.7,8.3,8.3,8.3c3.2,0,5.5-2,7.4-4.5l55.5-79.8
+ c26-9.9,44.6-35.8,44.6-65.2C400,212.8,369.6,179.4,332.1,179.4z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-recording-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-recording-outline.svg
new file mode 100644
index 00000000..20995a38
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-recording-outline.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M386.2,144c-60.6,0-109.8,50.1-109.8,112c0,40.4,21,75.7,52.5,95.4H183.1c31.5-19.7,52.5-55,52.5-95.4
+ c0-61.9-49.2-112-109.8-112C65.2,144,16,194.1,16,256c0,61.9,49.2,112,109.8,112h260.4c60.6,0,109.8-50.1,109.8-112
+ C496,194.1,446.8,144,386.2,144z M32.3,256c0-52.6,42-95.4,93.5-95.4c51.6,0,93.5,42.8,93.5,95.4s-42,95.4-93.5,95.4
+ C74.2,351.4,32.3,308.6,32.3,256z M386.2,351.4c-51.6,0-93.5-42.8-93.5-95.4s42-95.4,93.5-95.4s93.5,42.8,93.5,95.4
+ S437.8,351.4,386.2,351.4z"/>
+<path d="M384,208c26.5,0,48,21.5,48,48c0,26.5-21.5,48-48,48s-48-21.5-48-48C336,229.5,357.5,208,384,208 M384,192
+ c-35.3,0-64,28.7-64,64c0,35.3,28.7,64,64,64s64-28.7,64-64C448,220.7,419.3,192,384,192L384,192z"/>
+<path d="M128,208c26.5,0,48,21.5,48,48c0,26.5-21.5,48-48,48s-48-21.5-48-48C80,229.5,101.5,208,128,208 M128,192
+ c-35.3,0-64,28.7-64,64c0,35.3,28.7,64,64,64s64-28.7,64-64C192,220.7,163.3,192,128,192L128,192z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-recording.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-recording.svg
new file mode 100644
index 00000000..97ecfed7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-recording.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M386.2,144c-60.6,0-109.8,49.9-109.8,111.8c0,40.4,21,76.2,52.5,95.2H183.1c31.5-19,52.5-54.8,52.5-95.2
+ c0-61.9-49.2-111.9-109.8-111.9C65.2,143.9,16,194.1,16,255.9C16,317.8,65.2,368,125.8,368h260.4c60.6,0,109.8-50.1,109.8-112
+ C496,194.1,446.8,144,386.2,144z M128,320c-35.3,0-64-28.7-64-64c0-35.3,28.7-64,64-64s64,28.7,64,64C192,291.3,163.3,320,128,320z
+ M384,320c-35.3,0-64-28.7-64-64c0-35.3,28.7-64,64-64s64,28.7,64,64C448,291.3,419.3,320,384,320z"/>
+ <path d="M384,208c-26.5,0-48,21.5-48,48c0,26.5,21.5,48,48,48s48-21.5,48-48C432,229.5,410.5,208,384,208z"/>
+ <path d="M128,208c-26.5,0-48,21.5-48,48c0,26.5,21.5,48,48,48s48-21.5,48-48C176,229.5,154.5,208,128,208z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-redo-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-redo-outline.svg
new file mode 100644
index 00000000..02a6d2cc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-redo-outline.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M64,400h10.3l19.2-31.2c20.5-32.7,44.9-62.8,75.8-76.6c24.4-10.9,46.7-18.9,86.7-20V352l192-128L256,96v80.3
+ c-63,2.8-108.1,20.7-143.3,56.2c-52.3,52.7-48.7,119-48.7,135.7C64.1,377.1,64,389.9,64,400z M272,192v-64.7l148.1,96.8L272,320.8
+ V256c-91,0-144.6,24.6-192.2,105.4C79.8,361.4,71,192,272,192z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-redo.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-redo.svg
new file mode 100644
index 00000000..abd3c15a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-redo.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M64,400h10.3l19.2-31.2c20.5-32.7,44.9-62.8,75.8-76.6c24.4-10.9,46.7-18.9,86.7-20V352l192-128L256,96v80.3
+ c-63,2.8-108.1,20.7-143.3,56.2c-52.3,52.7-48.7,119-48.7,135.7C64.1,377.1,64,389.9,64,400z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh-empty.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh-empty.svg
new file mode 100644
index 00000000..bf6b8410
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh-empty.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,384.1c-70.7,0-128-57.3-128-128.1c0-70.8,57.3-128.1,128-128.1V84l96,64l-96,55.7v-55.8
+ c-59.6,0-108.1,48.5-108.1,108.1c0,59.6,48.5,108.1,108.1,108.1S364.1,316,364.1,256H384C384,327,326.7,384.1,256,384.1z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh-outline.svg
new file mode 100644
index 00000000..c2048a17
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh-outline.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M364.1,256c0,60-48.5,108.2-108.1,108.2S147.9,315.7,147.9,256c0-59.6,48.5-108.1,108.1-108.1v55.8l96-55.7l-96-64v44
+ c-70.7,0-128,57.4-128,128.1c0,70.8,57.3,128.1,128,128.1c70.7,0,128-57.1,128-128.1H364.1z"/>
+<g>
+ <g>
+ <path d="M256,48C141.1,48,48,141.1,48,256s93.1,208,208,208c114.9,0,208-93.1,208-208S370.9,48,256,48z M256,446.7
+ c-105.1,0-190.7-85.5-190.7-190.7c0-105.1,85.5-190.7,190.7-190.7c105.1,0,190.7,85.5,190.7,190.7
+ C446.7,361.1,361.1,446.7,256,446.7z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh.svg
new file mode 100644
index 00000000..95bc848a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,48C141.1,48,48,141.1,48,256s93.1,208,208,208c114.9,0,208-93.1,208-208S370.9,48,256,48z M256,384.1
+ c-70.7,0-128-57.3-128-128.1c0-70.8,57.3-128.1,128-128.1V84l96,64l-96,55.7v-55.8c-59.6,0-108.1,48.5-108.1,108.1
+ c0,59.6,48.5,108.1,108.1,108.1S364.1,316,364.1,256H384C384,327,326.7,384.1,256,384.1z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reload.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reload.svg
new file mode 100644
index 00000000..c730d6db
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reload.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g id="PL_x5F_Reset_1_">
+ <path d="M256,64c105.9,0,191.7,85.7,191.9,191.5l55-52.5l9,9.1L441.6,280L375,212.1l9-9.1l51.1,52.4
+ C434.8,156.9,354.6,76.8,256,76.8c-98.8,0-179.2,80.4-179.2,179.2c0,98.8,80.4,179.2,179.2,179.2c78.6,0,145.5-51,169.5-121.6
+ l12.4,3.5C412.3,393.2,340.6,448,256,448c-106,0-192-86-192-192S150,64,256,64z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reverse-camera-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reverse-camera-outline.svg
new file mode 100644
index 00000000..49dd4b14
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reverse-camera-outline.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M301.815,318.608c-13.114,11.029-28.956,17.356-45.815,17.356c-36.36,0-66.286-28.965-70.89-61.965h30.61l-38.87-50
+ l-37.534,50h29.479c4.696,42,41.717,78,87.205,78c20.9,0,41.17-7.566,57.076-21.218l2.37-2.159l-11.599-11.662L301.815,318.608z"/>
+ <path d="M315.736,198.885c-16.188-14.775-37.402-22.839-59.736-22.839c-20.9,0-41.169,7.556-57.075,21.206l-2.371,2.052
+ l11.599,11.61l2.033-1.706c12.927-10.872,29.197-17.005,45.814-17.005c36.343,0,66.274,28.797,70.891,63.797h-30.644l38.846,51.225
+ L372.719,256h-29.512C340.966,236,331.275,213.064,315.736,198.885z"/>
+ <path d="M417.5,160h-61.725c-32.105-36-42.219-48-54.525-48h-88.5c-12.314,0-22.167,12-54.521,48H145v-16h-34v16H97.5
+ C79.855,160,64,173.217,64,190.684v176.018C64,384.169,79.855,400,97.5,400h320c17.645,0,30.5-15.831,30.5-33.299V190.684
+ C448,173.217,435.145,160,417.5,160z M432,366.701c0,9.263-6.229,17.299-14.5,17.299h-320c-8.738,0-17.5-8.664-17.5-17.299V190.684
+ C80,182.518,88.126,176,97.5,176h60.729c0,0,4.124,0,6.133,0s3.225-0.199,5.768-3.2s7.702-10.008,11.08-13.795
+ c11.296-12.666,19.457-21.915,25.316-27.132c4.746-4.225,6.211-3.873,6.225-3.873h88.5c0.016,0,1.611-0.363,6.709,4.219
+ c6.141,5.521,14.705,16.84,26.558,30.198c2.888,3.255,7.214,8.11,9.317,10.44s4.252,3.143,5.771,3.143s6.17,0,6.17,0H417.5
+ c8.832,0,14.5,5.965,14.5,14.684V366.701z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reverse-camera.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reverse-camera.svg
new file mode 100644
index 00000000..4acec0a6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reverse-camera.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M417.5,160h-61.725c-32.105-36-42.219-48-54.525-48h-88.5c-12.314,0-22.167,12-54.521,48H145v-16h-34v16H97.5
+ C79.855,160,64,173.217,64,190.684v176.018C64,384.169,79.855,400,97.5,400h320c17.645,0,30.5-15.831,30.5-33.299V190.684
+ C448,173.217,435.145,160,417.5,160z M313.076,330.782C297.17,344.434,276.9,352,256,352c-45.487,0-82.509-36-87.205-78h-29.479
+ l37.534-50l38.87,50h-30.61c4.604,33,34.53,61.965,70.89,61.965c16.859,0,32.701-6.327,45.815-17.356l2.032-1.647l11.599,11.662
+ L313.076,330.782z M335.094,307.225L296.248,256h30.644c-4.617-35-34.548-63.797-70.891-63.797
+ c-16.618,0-32.888,6.133-45.814,17.005l-2.033,1.706l-11.599-11.61l2.371-2.052c15.905-13.65,36.175-21.206,57.075-21.206
+ c22.333,0,43.548,8.063,59.736,22.839C331.275,213.064,340.966,236,343.207,256h29.512L335.094,307.225z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rewind-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rewind-outline.svg
new file mode 100644
index 00000000..2b722c86
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rewind-outline.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M464,155v201.9L280.5,256L464,155 M240,156v77.7v27.1v95.6L64,256l176-100.2 M256,128L32,256l224,128V260.8L480,384V128
+ L256,251.2V128L256,128z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rewind.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rewind.svg
new file mode 100644
index 00000000..808e3a4e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rewind.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,128L32,256l224,128V260.8L480,384V128L256,251.2V128L256,128z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rose-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rose-outline.svg
new file mode 100644
index 00000000..30e04110
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rose-outline.svg
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M379.769,153.431c-29.777,55.586-17.604,99.504-6.645,139.039C378.717,312.648,384,331.708,384,351.889
+ c0,15.897-2.956,30.873-8.785,44.51c-5.727,13.396-14.104,25.212-24.898,35.12C327.169,452.768,294.555,464,256,464
+ s-71.169-11.232-94.316-32.481c-10.795-9.908-19.172-21.725-24.898-35.12c-5.829-13.637-8.785-28.612-8.785-44.51
+ c0-31.65,6.92-55.999,21.775-76.626c13.061-18.134,32.646-34.094,63.505-51.749l6.506-3.725
+ c20.197-11.57,27.001-15.467,43.976-23.588c31.845-15.234,66.513-28.387,103.041-39.094
+ C371.088,155.851,375.412,154.625,379.769,153.431 M416,128c-18.863,4.163-36.75,8.786-53.697,13.753
+ c-40.457,11.858-75.509,25.693-105.445,40.015c-19.271,9.219-26.236,13.393-51.522,27.859C147.001,243,112,278.926,112,351.889
+ S167.635,480,256,480s144-55.148,144-128.111S338.999,224,416,128L416,128z"/>
+ <path d="M133.516,123.147c21.432,6.955,47.724,16.977,69.799,29.846c6.385,3.723,12.092,7.493,17.092,11.291
+ c-5.504,2.905-10.895,5.855-16.138,8.833c-7.212,4.096-14.359,8.362-21.243,12.679c-10.484,6.574-20.435,13.308-29.789,20.156
+ C152.637,180.034,147.555,151.15,133.516,123.147 M96,96c41.475,47.079,44.624,103.891,39.382,144.741
+ c12.772-11.274,31.177-25.734,56.144-41.389c6.442-4.041,13.312-8.158,20.645-12.322c11.578-6.575,23.538-12.822,35.834-18.765
+ c-9.113-10.898-22.07-20.606-36.631-29.095C162.631,110.756,96,96,96,96L96,96z"/>
+ <path d="M344.629,80.697c5.309,7.227,12.393,17.661,17.66,27.726c-29.863,8.433-65.994,21.145-94.967,33.476
+ c-5.963-6.235-12.982-12.294-21.006-18.135c17.437-15.757,38.773-27.668,63.652-35.506
+ C324.518,83.675,337.016,81.612,344.629,80.697 M352,64c0,0-78.623,2.321-130.681,62.469c16.629,9.903,29.735,20.503,38.959,31.533
+ l2.724,3.257c37.152-16.794,88.131-34.085,120.998-42.009C377.617,95.827,352,64,352,64L352,64z"/>
+ <path d="M181.229,53.532c9.241,6.122,22.68,16.481,35.999,31.924c-4.851,4.201-9.487,8.623-13.888,13.247
+ c-14.024-7.088-24.951-12.192-36.826-16.602C170.174,73.63,175.095,63.788,181.229,53.532 M176,32
+ c-15.256,22.406-25.684,45.299-30.336,59.997c21.111,6.355,35.475,13.215,61.389,26.574c9.505-11.4,20.415-21.626,32.605-30.543
+ C210.342,47.655,176,32,176,32L176,32z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rose.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rose.svg
new file mode 100644
index 00000000..7bf76c5f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rose.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M416,128c-18.863,4.163-36.75,8.786-53.697,13.753c-40.457,11.858-75.509,25.693-105.445,40.015
+ c-19.271,9.219-26.236,13.393-51.522,27.859C147.001,243,112,278.926,112,351.889S167.635,480,256,480s144-55.148,144-128.111
+ S338.999,224,416,128L416,128z"/>
+ <path d="M96,96c41.475,47.079,44.624,103.891,39.382,144.741c12.772-11.274,31.177-25.734,56.144-41.389
+ c6.442-4.041,13.312-8.158,20.645-12.322c11.578-6.575,23.538-12.822,35.834-18.765c-9.113-10.898-22.07-20.606-36.631-29.095
+ C162.631,110.756,96,96,96,96L96,96z"/>
+ <path d="M352,64c0,0-78.623,2.321-130.681,62.469c16.629,9.903,29.735,20.503,38.959,31.533l2.724,3.257
+ c37.152-16.794,88.131-34.085,120.998-42.009C377.617,95.827,352,64,352,64L352,64z"/>
+ <path d="M176,32c-15.256,22.406-25.684,45.299-30.336,59.997c21.111,6.355,35.475,13.215,61.389,26.574
+ c9.505-11.4,20.415-21.626,32.605-30.543C210.342,47.655,176,32,176,32L176,32z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-search-strong.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-search-strong.svg
new file mode 100644
index 00000000..6960eb1a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-search-strong.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M344.5,298c15-23.6,23.8-51.6,23.8-81.7c0-84.1-68.1-152.3-152.1-152.3C132.1,64,64,132.2,64,216.3
+ c0,84.1,68.1,152.3,152.1,152.3c30.5,0,58.9-9,82.7-24.4l6.9-4.8L414.3,448l33.7-34.3L339.5,305.1L344.5,298z M301.4,131.2
+ c22.7,22.7,35.2,52.9,35.2,85c0,32.1-12.5,62.3-35.2,85c-22.7,22.7-52.9,35.2-85,35.2c-32.1,0-62.3-12.5-85-35.2
+ c-22.7-22.7-35.2-52.9-35.2-85c0-32.1,12.5-62.3,35.2-85c22.7-22.7,52.9-35.2,85-35.2C248.5,96,278.7,108.5,301.4,131.2z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-search.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-search.svg
new file mode 100644
index 00000000..ff477918
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-search.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M448.3,424.7L335,311.3c20.8-26,33.3-59.1,33.3-95.1c0-84.1-68.1-152.2-152-152.2c-84,0-152,68.2-152,152.2
+ s68.1,152.2,152,152.2c36.2,0,69.4-12.7,95.5-33.8L425,448L448.3,424.7z M120.1,312.6c-25.7-25.7-39.8-59.9-39.8-96.3
+ s14.2-70.6,39.8-96.3S180,80,216.3,80c36.3,0,70.5,14.2,96.2,39.9s39.8,59.9,39.8,96.3s-14.2,70.6-39.8,96.3
+ c-25.7,25.7-59.9,39.9-96.2,39.9C180,352.5,145.8,338.3,120.1,312.6z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-settings-strong.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-settings-strong.svg
new file mode 100644
index 00000000..cb15e18b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-settings-strong.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M32,376h283.35c6.186-14.112,20.281-24,36.65-24s30.465,9.888,36.65,24H480v32h-91.35c-6.186,14.112-20.281,24-36.65,24
+ s-30.465-9.888-36.65-24H32"/>
+ <path d="M32,240h91.35c6.186-14.112,20.281-24,36.65-24s30.465,9.888,36.65,24H480v32H196.65c-6.186,14.112-20.281,24-36.65,24
+ s-30.465-9.888-36.65-24H32"/>
+ <path d="M32,104h283.35c6.186-14.112,20.281-24,36.65-24s30.465,9.888,36.65,24H480v32h-91.35c-6.186,14.112-20.281,24-36.65,24
+ s-30.465-9.888-36.65-24H32"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-settings.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-settings.svg
new file mode 100644
index 00000000..bb60a997
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-settings.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M352,104c8.837,0,16,7.163,16,16s-7.163,16-16,16s-16-7.163-16-16S343.163,104,352,104 M352,88c-17.645,0-32,14.355-32,32
+ s14.355,32,32,32s32-14.355,32-32S369.645,88,352,88L352,88z"/>
+ <path d="M352,376c8.837,0,16,7.163,16,16s-7.163,16-16,16s-16-7.163-16-16S343.163,376,352,376 M352,360c-17.645,0-32,14.355-32,32
+ s14.355,32,32,32s32-14.355,32-32S369.645,360,352,360L352,360z"/>
+ <g>
+ <path d="M160,240c8.837,0,16,7.163,16,16s-7.163,16-16,16s-16-7.163-16-16S151.163,240,160,240 M160,224
+ c-17.645,0-32,14.355-32,32s14.355,32,32,32s32-14.355,32-32S177.645,224,160,224L160,224z"/>
+ <g>
+ <path d="M207.32,248H480v16H207.32c0.439-2.604,0.68-5.273,0.68-8S207.76,250.604,207.32,248z"/>
+ <path d="M112,256c0,2.727,0.24,5.396,0.68,8H32v-16h80.68C112.24,250.604,112,253.273,112,256z"/>
+ <path d="M399.32,384H480v16h-80.68c0.439-2.604,0.68-5.273,0.68-8S399.76,386.604,399.32,384z"/>
+ <path d="M304,392c0,2.727,0.24,5.396,0.68,8H32v-16h272.68C304.24,386.604,304,389.273,304,392z"/>
+ <path d="M399.32,112H480v16h-80.68c0.439-2.604,0.68-5.273,0.68-8S399.76,114.604,399.32,112z"/>
+ <path d="M304.68,112c-0.439,2.604-0.68,5.273-0.68,8s0.24,5.396,0.68,8H32v-16H304.68z"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-shuffle-strong.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-shuffle-strong.svg
new file mode 100644
index 00000000..006b090d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-shuffle-strong.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M365.419,152h13.81l-50.738,41.584l20.308,24.572L448,136l-99.136-84l-20.368,24.978L379.679,120h-14.26
+ c-103.727,0-146.494,79.62-180.857,143.727c-1.362,2.542-2.715,4.99-4.06,7.488l-0.059,0.095c-1.591,2.953-3.176,6.114-4.76,9.038
+ c-35.562,65.63-66.893,83.214-111.684,83.641V396c37.625,0,57.563-9.451,72.236-18.178c24.935-14.831,47.042-44.559,67.583-82.467
+ c1.541-2.844,3.083-5.752,4.632-8.626l0.225-0.438c1.459-2.711,2.922-5.273,4.39-8.014C246.369,216.113,280.808,152,365.419,152z"
+ />
+ <path d="M348.798,293.844l-20.308,24.572L379.229,360h-13.81c-70.728,0-106.396-44.801-135.649-95.812l-17.648,32.618
+ C243.556,346.626,287.116,392,365.419,392h14.26l-51.183,43.022L348.864,460L448,376L348.798,293.844z"/>
+ <path d="M175.684,231.652c1.584,2.924,3.169,6.085,4.76,9.038l0.059,0.095c1.218,2.262,2.442,4.49,3.675,6.777
+ c5.82-10.73,11.98-21.748,18.695-32.649c-20.273-37.079-42.083-66.132-66.636-80.735C121.563,125.451,101.625,116,64,116v32.011
+ C108.791,148.438,140.122,166.022,175.684,231.652z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-shuffle.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-shuffle.svg
new file mode 100644
index 00000000..84bdbcbc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-shuffle.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M362.121,207.146L352,194.854L413.784,144h-46.117c-93.327,0-129.147,74.511-163.787,138.832
+ c-1.62,3.008-3.233,6.004-4.846,8.979c-19.836,36.607-40.979,61.242-64.64,75.314C120.573,375.346,101.401,384,64,384v-16.25
+ c47.937,0,83.098-13.673,120.966-83.561c1.606-2.965,3.214-5.949,4.827-8.944C224.943,209.977,264.784,128,367.667,128h46.28
+ L352,76.146L362.121,64L448,136L362.121,207.146z"/>
+ <g>
+ <path d="M199.034,220.189c-19.836-36.607-40.979-61.242-64.64-75.314C120.573,136.654,101.401,128,64,128v16.25
+ c47.937,0,83.098,13.673,120.966,83.561c1.606,2.964,3.214,5.948,4.827,8.944c0.438,0.812,0.875,1.627,1.314,2.444
+ c3.01-5.438,6.107-10.917,9.339-16.394C199.977,221.935,199.504,221.056,199.034,220.189z"/>
+ <path d="M362.121,304.854L352,317.146L413.784,368h-46.117c-72.693,0-110.496-45.207-140.028-95.592
+ c-1.768,3.275-3.525,6.551-5.273,9.814c-1.175,2.192-2.344,4.37-3.513,6.545C249.621,338.777,291.254,384,367.667,384h46.28
+ L352,435.854L362.121,448L448,376L362.121,304.854z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipbackward-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipbackward-outline.svg
new file mode 100644
index 00000000..2bbaa94a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipbackward-outline.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M96,96v320h79V274.2L416,416V96L175,237.8V96H96z M175.6,256l7.6-4.4L400,124v0v264L183.1,260.4L175.6,256z M112,112h47
+ v125.8v28v8.5V400h-47V112z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipbackward.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipbackward.svg
new file mode 100644
index 00000000..6f8dc87f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipbackward.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M96,96v320h79V274.2L416,416V96L175,237.8V96H96z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipforward-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipforward-outline.svg
new file mode 100644
index 00000000..1c9e1f5b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipforward-outline.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M337,96v141.8L96,96v320l241-141.8V416h79V96H337z M328.9,260.4L112,388V124v0l216.9,127.6l7.6,4.4L328.9,260.4z M400,400
+ h-47V274.2v-8.5v-28V112h47V400z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipforward.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipforward.svg
new file mode 100644
index 00000000..139a170b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipforward.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M337,96v141.8L96,96v320l241-141.8V416h79V96H337z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-snowy.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-snowy.svg
new file mode 100644
index 00000000..2dd8a843
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-snowy.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<path class="st0" d="M379.9,317l-28.7-16.3c6.1-5.8,13-9.7,20.7-12.3c4.3-1.4,6.5-5.9,5.1-10.1c-1.4-4.2-6-6.5-10.3-5.1
+ c-11.6,3.8-22.2,11-30.1,19.2L272.3,256l64.2-36.4c8.4,9.1,18.6,15.4,30.2,19.2c4.3,1.4,8.9-0.8,10.3-5c1.4-4.2-0.8-8.7-5.1-10.1
+ c-7.8-2.6-14.8-6.5-20.9-12.3l28.8-16.3c3.9-2.2,5.2-7.1,3-10.9s-7.2-5.1-11.1-2.9L343,197.3c-2-8.1-2.1-15.9-0.5-23.8
+ c0.9-4.3-2-8.5-6.4-9.4c-4.4-0.9-8.7,1.9-9.6,6.2c-2.4,11.8-1.4,24.4,1.8,35.2L264,242.2v-73c11-2.7,22.4-8.1,31.5-16.1
+ c3.3-2.9,3.6-8,0.7-11.3c-2.9-3.3-7.9-3.6-11.3-0.7c-6,5.3-12.9,9.2-20.9,11.5V120c0-4.4-3.6-8-8-8c-4.4,0-8,3.6-8,8v32.7
+ c-8-2.3-14.8-6.2-20.9-11.6c-3.3-2.9-8.4-2.6-11.3,0.7c-2.9,3.3-2.6,8.4,0.7,11.3c9.1,8,19.5,13.5,31.5,16.1v73l-64.5-36.6
+ c3.2-10.9,4.2-23.5,1.9-35.2c-0.9-4.3-5.2-7.1-9.6-6.2c-4.4,0.9-7.2,5-6.4,9.4c1.6,7.9,1.6,15.7-0.5,23.8L140.3,181
+ c-3.9-2.2-8.9-0.9-11.1,2.9c-2.2,3.8-0.9,8.7,3,10.9l28.8,16.3c-6.1,5.8-13,9.7-20.8,12.3c-4.3,1.4-6.5,6-5.1,10.1
+ c1.4,4.2,6.1,6.4,10.3,5c11.6-3.9,21.8-10.1,30.2-19.2l64.3,36.5l-64.4,36.5c-7.9-8.2-18.6-15.3-30.1-19.2
+ c-4.3-1.4-8.8,0.9-10.3,5.1c-1.4,4.2,0.8,8.7,5.1,10.1c7.7,2.6,14.6,6.5,20.7,12.3l-28.7,16.3c-3.9,2.2-5.2,7.1-3,10.9
+ s7.2,5.1,11.1,2.9l28.8-16.3c2.1,8.1,2.1,15.9,0.4,23.9c-0.9,4.3,2,8.5,6.4,9.4c4.4,0.9,8.7-1.9,9.6-6.3c2.4-11.8,1.9-23.6-1.9-35.3
+ l64.5-36.6v73.1c-12,2.6-22.4,8.1-31.5,16.1c-3.3,2.9-3.6,8-0.7,11.3c2.9,3.3,7.9,3.6,11.3,0.7c6.1-5.4,12.9-9.3,20.9-11.6V392
+ c0,4.4,3.6,8,8,8c4.4,0,8-3.6,8-8v-32.6c8,2.3,14.8,6.2,20.9,11.5c3.3,2.9,8.3,2.6,11.3-0.7c2.9-3.3,2.6-8.4-0.7-11.3
+ c-9-7.9-20.4-13.4-31.4-16.1v-73.1l64.4,36.5c-3.8,11.7-4.2,23.5-1.8,35.3c0.9,4.3,5.2,7.1,9.6,6.3c4.4-0.9,7.3-5.1,6.4-9.4
+ c-1.6-8-1.6-15.8,0.4-23.9l28.8,16.3c3.9,2.2,8.9,0.9,11.1-2.9C385.2,324.1,383.8,319.2,379.9,317z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-speedometer-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-speedometer-outline.svg
new file mode 100644
index 00000000..28949166
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-speedometer-outline.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,64C132.288,64,32,164.226,32,287.938c0,56.975,21.283,108.97,56.316,148.5c3.551,4.006,7.241,7.82,11.066,11.562
+ c3.059-3.49,6.232-6.834,9.539-10.141c0.48-0.48,0.972-0.947,1.456-1.422c18.78-18.426,40.521-32.949,64.664-43.161
+ c25.633-10.842,52.871-16.339,80.958-16.339s55.325,5.497,80.958,16.339c24.144,10.212,45.884,24.735,64.664,43.161
+ c0.484,0.475,0.976,0.941,1.456,1.422c3.307,3.307,6.48,6.65,9.539,10.141c3.825-3.742,7.516-7.557,11.066-11.562
+ c35.033-39.53,56.316-91.525,56.316-148.5C480,164.226,379.712,64,256,64z M447.661,369.177
+ c-8.663,20.481-20.429,39.092-35.044,55.776c-40.39-39.51-95.653-63.945-156.617-63.945s-116.228,24.33-156.617,63.84
+ c-14.615-16.685-26.381-35.172-35.044-55.653c-9.81-23.19-15.228-47.694-16.173-72.694H79.5v-16H48.166
+ c0.945-25,6.363-50.048,16.173-73.239c9.372-22.157,22.376-42.431,38.692-60.11l26.932,26.893l5.496-5.538l5.277-5.264l-0.02-0.027
+ l0.547-0.552l-26.951-26.984c17.862-16.647,38.004-29.894,60.479-39.4c23.191-9.81,47.708-15.229,72.708-16.174V117.5h16V80.104
+ c26,0.945,50.017,6.363,73.208,16.173c22.437,9.49,42.921,22.706,60.762,39.312l-26.975,27.069l0.577,0.547l-0.004,0.019
+ l5.285,5.246l5.5,5.503l27.026-27.057c16.356,17.703,29.392,38.148,38.78,60.345c9.81,23.191,15.229,48.239,16.174,73.239H431.5v16
+ h32.334C462.889,321.5,457.471,345.986,447.661,369.177z"/>
+ <path d="M368.479,174.545l-85.484,73.727c-7.697-5.255-16.992-8.334-26.994-8.334c-26.467,0-48,21.533-48,48
+ c0,10.479,3.385,20.178,9.106,28.08l-11.948,11.948l11.312,11.313l12.033-12.033c7.795,5.469,17.273,8.691,27.496,8.691
+ c26.467,0,48-21.533,48-48c0-10.387-3.327-20.005-8.956-27.868l74.849-84.11L368.479,174.545z M256,319.938
+ c-17.673,0-32-14.326-32-32c0-17.673,14.327-32,32-32s32,14.327,32,32C288,305.611,273.673,319.938,256,319.938z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-speedometer.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-speedometer.svg
new file mode 100644
index 00000000..4117c002
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-speedometer.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M417,278.742V278h29.814c-0.931-23-6.056-45.609-14.831-66.151c-8.643-20.228-20.503-38.665-35.257-54.562l-24.867,24.646
+ l-11.229-10.992l24.788-24.679c-16.187-14.836-34.86-26.742-55.515-35.392C308.479,101.897,286,97.092,263,96.186V130h-1.008H248
+ V96.186c-23,0.894-44.95,5.699-66.404,14.685c-20.353,8.523-38.958,20.457-55.315,35.471l24.796,24.583l-0.549,0.549l0.001,0.006
+ l-0.29,0.335l-10.27,10.203l-24.779-24.479c-14.77,15.932-26.604,34.243-35.176,54.309C71.241,232.388,66.117,255,65.187,278H94v16
+ h-0.776H65.187c0.926,22,5.915,44.432,14.829,65.297c7.689,18.001,18.398,34.664,31.831,49.926
+ c38.785-37.377,89.958-57.928,144.154-57.928c54.113,0,105.286,20.676,144.154,58.135c13.354-15.175,24.061-31.979,31.83-50.166
+ C440.9,338.396,445.889,316,446.814,294H417V278.742z M304,287.938c0,26.467-21.533,48-48,48c-10.223,0-19.701-3.223-27.496-8.691
+ l-12.033,12.033l-11.312-11.313l11.948-11.948c-5.722-7.902-9.106-17.602-9.106-28.08c0-26.467,21.533-48,48-48
+ c10.002,0,19.297,3.079,26.994,8.334l73.484-65.727l1.414,1.414l-62.849,76.11C300.673,267.933,304,277.551,304,287.938z"/>
+ <path d="M256,64C132.288,64,32,164.226,32,287.938c0,56.975,21.283,108.97,56.316,148.5c3.551,4.006,7.241,7.82,11.066,11.562
+ h22.193c31.713-39.103,80.144-64.096,134.424-64.096S358.711,408.897,390.424,448h22.193c3.825-3.742,7.516-7.557,11.066-11.562
+ c35.033-39.53,56.316-91.525,56.316-148.5C480,164.226,379.712,64,256,64z M410.744,420.797
+ c-3.051,3.408-6.392,6.863-10.213,10.564l-0.376,0.365l-0.348-0.393c-2.629-2.97-5.493-5.985-8.759-9.22
+ c-0.275-0.271-0.555-0.539-0.834-0.807l-0.504-0.485c-17.258-16.766-37.234-29.967-59.375-39.238
+ c-23.535-9.856-48.545-14.854-74.336-14.854c-25.791,0-50.801,4.998-74.336,14.854c-22.14,9.271-42.117,22.473-59.375,39.238
+ l-0.504,0.485c-0.279,0.268-0.558,0.535-0.833,0.807c-3.266,3.234-6.13,6.25-8.759,9.22l-0.348,0.393l-0.377-0.365
+ c-3.821-3.701-7.162-7.156-10.212-10.564c-33.514-37.441-51.971-85.629-51.971-135.685c0-54.666,21.502-106.053,60.545-144.694
+ C148.87,101.779,200.781,80.5,256,80.5c55.22,0,107.13,21.279,146.17,59.918c39.043,38.642,60.545,90.029,60.545,144.694
+ C462.715,335.168,444.259,383.355,410.744,420.797z"/>
+ <circle cx="256" cy="287.938" r="32"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star-half.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star-half.svg
new file mode 100644
index 00000000..183b2f55
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star-half.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M172.248,304.931l-54.677,159.073L256,365.37l138.445,98.634L339.76,304.937L480,207H308.613L256,48.005L203.402,207H32
+ L172.248,304.931z M256,100.75L297,224h131l-108,74.711l42.623,122.481L256,345.257V100.75z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star-outline.svg
new file mode 100644
index 00000000..868de184
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star-outline.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M480,207H308.6L256,47.9L203.4,207H32l140.2,97.9L117.6,464L256,365.4L394.4,464l-54.7-159.1L480,207z M362.6,421.2
+ l-106.6-76l-106.6,76L192,298.7L84,224h131l41-123.3L297,224h131l-108,74.6L362.6,421.2z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star.svg
new file mode 100644
index 00000000..74f7f026
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M480,207H308.6L256,47.9L203.4,207H32l140.2,97.9L117.6,464L256,365.4L394.4,464l-54.7-159.1L480,207z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-stopwatch-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-stopwatch-outline.svg
new file mode 100644
index 00000000..66cf46da
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-stopwatch-outline.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M397.6,146.7l-1.8-1.7h18.4l8.5,7.8l22.5-22.8l-40.8-40.3L381.2,112l8.8,9.2v18.6l-5-4.7c-31.3-28.3-70-45.2-113-48.9V48
+ h-32v38h-2c-43.7,3-85,22.5-116,53v-17.8l8.9-9.2L108,89.8L67.2,130l22.5,22.8l8.5-7.8H116c-0.3,0-0.7,0.7-1,1.1
+ C82.2,181.2,64,227,64,274.6C64,379,150.1,464,256.1,464C361.9,464,448,379.1,448,274.7C448,227.1,430,181.6,397.6,146.7z
+ M256.3,445.7c-95.5,0-173.1-76.7-173.1-170.9c0-94.3,77.7-170.9,173.1-170.9c95.5,0,173.1,76.7,173.1,170.9
+ C429.5,369,351.8,445.7,256.3,445.7z"/>
+ <path d="M264,257.3V128h-16v129.4c-12.5,4.3-24,16.5-24,30.3c0,14.7,10,27,24,30.5l8,17.8l0,0l8-17.8c14-3.5,24-15.8,24-30.5
+ C288,273.2,277.5,261,264,257.3z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-stopwatch.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-stopwatch.svg
new file mode 100644
index 00000000..ff2e680a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-stopwatch.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M397.6,146.7l-1.8-1.7h18.4l8.5,7.8l22.5-22.8l-40.8-40.3L381.2,112l8.8,9.2v18.6l-5-4.7c-31.3-28.3-70-45.2-113-48.9V48
+ h-32v38h-2c-43.7,3-85,22.5-116,53v-17.8l8.9-9.2L108,89.8L67.2,130l22.5,22.8l8.5-7.8H116c-0.3,0-0.7,0.7-1,1.1
+ C82.2,181.2,64,227,64,274.6C64,379,150.1,464,256.1,464C361.9,464,448,379.1,448,274.7C448,227.1,430,181.6,397.6,146.7z
+ M264,318.2l-8,17.8l-8-17.8c-14-3.5-24-15.8-24-30.5c0-13.8,11.5-26,24-30.3V128h16v129.3c13.5,3.7,24,15.9,24,30.4
+ C288,302.4,278,314.7,264,318.2z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-sunny-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-sunny-outline.svg
new file mode 100644
index 00000000..3beb31f4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-sunny-outline.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <rect x="247" y="96" class="st0" width="18" height="56"/>
+ <rect x="247" y="356" class="st0" width="18" height="60"/>
+ <rect x="360" y="247" class="st0" width="56" height="18"/>
+ <rect x="96" y="247" class="st0" width="60" height="18"/>
+
+ <rect x="339" y="317.4" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 834.4009 337.0126)" class="st0" width="16.8" height="47.8"/>
+
+ <rect x="162.2" y="140.7" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 407.7248 160.277)" class="st0" width="16.8" height="47.9"/>
+
+ <rect x="339" y="140.7" transform="matrix(0.7071 0.7071 -0.7071 0.7071 218.1171 -197.4504)" class="st0" width="16.8" height="47.8"/>
+
+ <rect x="162.2" y="317.4" transform="matrix(0.707 0.7072 -0.7072 0.707 291.3531 -20.7056)" class="st0" width="16.8" height="47.9"/>
+ <path class="st0" d="M256,331.8c-41.8,0-75.8-34-75.8-75.8s34-75.8,75.8-75.8c41.8,0,75.8,34,75.8,75.8S297.8,331.8,256,331.8z
+ M256,197.1c-32.5,0-58.9,26.4-58.9,58.9s26.4,58.9,58.9,58.9c32.5,0,58.9-26.4,58.9-58.9S288.5,197.1,256,197.1z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-sunny.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-sunny.svg
new file mode 100644
index 00000000..5793306e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-sunny.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <rect x="247" y="96" class="st0" width="18" height="56"/>
+ <rect x="247" y="356" class="st0" width="18" height="60"/>
+ <rect x="360" y="247" class="st0" width="56" height="18"/>
+ <rect x="96" y="247" class="st0" width="60" height="18"/>
+
+ <rect x="339" y="317.4" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 834.4009 337.0126)" class="st0" width="16.8" height="47.8"/>
+
+ <rect x="162.2" y="140.7" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 407.7248 160.277)" class="st0" width="16.8" height="47.9"/>
+
+ <rect x="339" y="140.7" transform="matrix(0.7071 0.7071 -0.7071 0.7071 218.1171 -197.4504)" class="st0" width="16.8" height="47.8"/>
+
+ <rect x="162.2" y="317.4" transform="matrix(0.707 0.7072 -0.7072 0.707 291.3531 -20.7056)" class="st0" width="16.8" height="47.9"/>
+ <path class="st0" d="M256,331.8c-41.8,0-75.8-34-75.8-75.8s34-75.8,75.8-75.8c41.8,0,75.8,34,75.8,75.8S297.8,331.8,256,331.8z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-telephone-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-telephone-outline.svg
new file mode 100644
index 00000000..d34da021
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-telephone-outline.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M415.9,335.5c-14.6-15-56.1-43.1-83.3-43.1c-6.3,0-11.8,1.4-16.3,4.3c-13.3,8.5-23.9,15.1-29,15.1c-2.8,0-5.8-2.5-12.4-8.2
+ l-1.1-1c-18.3-15.9-22.2-20-29.3-27.4l-1.8-1.9c-1.3-1.3-2.4-2.5-3.5-3.6c-6.2-6.4-10.7-11-26.6-29l-0.7-0.8
+ c-7.6-8.6-12.6-14.2-12.9-18.3c-0.3-4,3.2-10.5,12.1-22.6c10.8-14.6,11.2-32.6,1.3-53.5c-7.9-16.5-20.8-32.3-32.2-46.2l-1-1.2
+ c-9.8-12-21.2-18-33.9-18c-14.1,0-25.8,7.6-32,11.6c-0.5,0.3-1,0.7-1.5,1c-13.9,8.8-24,20.9-27.8,33.2c-5.7,18.5-9.5,42.5,17.8,92.4
+ c23.6,43.2,45,72.2,79,107.1c32,32.8,46.2,43.4,78,66.4c35.4,25.6,69.4,40.3,93.2,40.3c22.1,0,39.5,0,64.3-29.9
+ C442.3,370.8,431.5,351.6,415.9,335.5z M404.4,391.4c-20,24.2-31.5,24.2-52.3,24.2c-20.3,0-51.8-14-84.2-37.3
+ c-31-22.4-44.8-32.7-75.9-64.6c-32.9-33.7-53.6-61.8-76.4-103.5c-24.1-44.1-21.4-63.4-16.5-79.3c2.6-8.5,10.4-17.6,21-24.2
+ c0.5-0.3,1-0.7,1.6-1c5.3-3.4,14.1-9.1,23.7-9.1c8,0,15.1,4,21.9,12.3l1,1.2c25.5,31.2,45.4,58.8,30.4,79.2
+ c-10.6,14.3-16.2,24-15.3,34c0.8,9.7,7.3,17,17.1,28l0.7,0.8c16.1,18.2,20.7,23,27.1,29.5c1.1,1.1,2.2,2.3,3.5,3.6l1.8,1.9
+ c7.4,7.7,11.5,11.9,30.3,28.4l1.1,1c8,7,13.9,12.1,22.5,12.1c8.9,0,18.7-5.6,37.3-17.5c1.9-1.2,4.6-1.9,8-1.9
+ c21.7,0,59.1,24.8,72.2,38.3C417,359.7,423,368.9,404.4,391.4z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-telephone.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-telephone.svg
new file mode 100644
index 00000000..794e51a7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-telephone.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M415.9,335.5c-14.6-15-56.1-43.1-83.3-43.1c-6.3,0-11.8,1.4-16.3,4.3c-13.3,8.5-23.9,15.1-29,15.1c-2.8,0-5.8-2.5-12.4-8.2
+ l-1.1-1c-18.3-15.9-22.2-20-29.3-27.4l-1.8-1.9c-1.3-1.3-2.4-2.5-3.5-3.6c-6.2-6.4-10.7-11-26.6-29l-0.7-0.8
+ c-7.6-8.6-12.6-14.2-12.9-18.3c-0.3-4,3.2-10.5,12.1-22.6c10.8-14.6,11.2-32.6,1.3-53.5c-7.9-16.5-20.8-32.3-32.2-46.2l-1-1.2
+ c-9.8-12-21.2-18-33.9-18c-14.1,0-25.8,7.6-32,11.6c-0.5,0.3-1,0.7-1.5,1c-13.9,8.8-24,20.9-27.8,33.2c-5.7,18.5-9.5,42.5,17.8,92.4
+ c23.6,43.2,45,72.2,79,107.1c32,32.8,46.2,43.4,78,66.4c35.4,25.6,69.4,40.3,93.2,40.3c22.1,0,39.5,0,64.3-29.9
+ C442.3,370.8,431.5,351.6,415.9,335.5z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-tennisball-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-tennisball-outline.svg
new file mode 100644
index 00000000..aa743654
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-tennisball-outline.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M464,256c0-114.863-93.13-208-208-208C141.137,48,48,141.136,48,256c0,114.863,93.137,208,208,208
+ c2.541,0,5.068-0.062,7.587-0.152c0.479-0.017,0.957-0.034,1.435-0.055c0.942-0.04,1.884-0.083,2.823-0.136
+ c0.85-0.047,1.698-0.104,2.547-0.161c0.639-0.044,1.279-0.08,1.917-0.13c1.354-0.104,2.705-0.221,4.055-0.352
+ c0-0.003,0-0.006,0-0.009c97.47-9.474,175.229-86.229,186.274-183.223c0.02-0.001,0.038,0,0.057-0.001
+ c0.604-5.315,1.002-10.667,1.196-16.05c-0.016,0.001-0.032,0.001-0.049,0.001C463.937,261.166,464,258.591,464,256z M446.665,256
+ c0,2.568-0.066,5.121-0.167,7.664c-23.639-1.076-46.677-6.106-68.616-15.005c-25.791-10.458-48.938-25.831-68.797-45.691
+ c-19.86-19.86-35.233-43.007-45.692-68.797c-8.903-21.956-13.935-45.014-15.006-68.67c2.527-0.1,5.063-0.165,7.614-0.165
+ C361.13,65.335,446.665,150.869,446.665,256z M65.337,256c0-1.318,0.023-2.631,0.05-3.942c22.476,1.379,44.388,6.337,65.3,14.817
+ c25.791,10.458,48.938,25.831,68.798,45.691c19.86,19.859,35.232,43.007,45.691,68.798c8.474,20.896,13.43,42.792,14.814,65.249
+ c-1.328,0.027-2.656,0.051-3.99,0.051C150.87,446.664,65.336,361.13,65.337,256z M275.943,445.623
+ c-3.273-52.566-24.974-104.198-65.145-144.369c-40.186-40.186-91.84-61.889-144.427-65.15
+ c9.172-88.053,78.52-158.478,166.074-169.313c2.595,53.64,24.36,106.525,65.326,147.49c40.949,40.952,93.811,62.713,147.433,65.322
+ C434.351,367.118,363.957,436.432,275.943,445.623z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-tennisball.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-tennisball.svg
new file mode 100644
index 00000000..1939c456
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-tennisball.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M48.05,251.556c-0.001,0.039-0.003,0.077-0.004,0.116c0,0,0.002,0,0.003,0C48.049,251.634,48.049,251.595,48.05,251.556z"
+ />
+ <path d="M260.311,463.915c0.066-0.002,0.133-0.006,0.199-0.007c-0.066,0.001-0.133,0.001-0.199,0.004
+ C260.311,463.912,260.311,463.913,260.311,463.915z"/>
+ <path d="M256,48.001c-2.586,0-5.29,0.064-7.852,0.158L248,48.153c0,0.003,0,0.004,0,0.006c-5,0.199-10,0.602-16,1.205
+ c0-0.002,0-0.004,0-0.008c0,0.005,0.083,0.008,0.072,0.012c-96.974,11.061-173.654,88.975-183.13,186.41
+ c-0.004,0.018,0.045,0.222,0.042,0.222c0.003,0,0.004,0,0.007,0c-0.513,5-0.826,10-0.936,16c-0.001,0-0.003,0-0.004,0l0.003-0.152
+ c-0.028,1.43-0.054,2.777-0.054,4.215c0,114.852,92.977,207.938,207.841,207.938c6.856,0,14.159-0.383,20.159-1.031
+ c0,0.002,0,0.006,0,0.006c0-0.004,0.213-0.008,0.24-0.014c97.436-9.486,175.247-86.086,186.312-183.036
+ c0.004-0.014,0.088,0.074,0.092,0.074c-0.002,0-0.006,0-0.008,0c0.889-8,1.363-15.859,1.363-23.904
+ C464,141.245,370.87,48.001,256,48.001z M130.63,266.853c-20.895-8.474-42.788-13.43-65.244-14.816
+ c0.11-5.374,0.438-10.695,0.986-15.952c52.568,3.275,104.203,24.977,144.375,65.146c40.172,40.169,61.876,91.797,65.152,144.359
+ c-5.257,0.548-10.579,0.876-15.954,0.985c-1.385-22.453-6.342-44.344-14.816-65.236c-10.459-25.79-25.834-48.937-45.696-68.795
+ C179.572,292.684,156.423,277.311,130.63,266.853z M297.722,214.265c-40.964-40.959-62.731-93.835-65.332-147.467
+ c5.25-0.652,10.568-1.08,15.941-1.293c1.073,23.65,6.105,46.702,15.007,68.654c10.461,25.79,25.835,48.936,45.696,68.795
+ c19.862,19.859,43.01,35.232,68.803,45.691c21.954,8.901,45.008,13.933,68.66,15.007c-0.213,5.37-0.643,10.689-1.293,15.939
+ C391.564,276.989,338.686,255.225,297.722,214.265z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-thunderstorm-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-thunderstorm-outline.svg
new file mode 100644
index 00000000..f49c64ea
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-thunderstorm-outline.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <polygon class="st0" points="312,272 272,272 288,224 216,224 201,304 253.3,304 224,400 "/>
+ <g>
+ <path class="st0" d="M328.4,172.7c-2.7,0-5.4,0-8,0.3c-7.9-35-39.1-61.4-76.4-61.4c-43.3,0-78.3,35.2-78.3,78.5
+ c0,2.6,0.1,5.2,0.4,7.8c-26.4,2.3-47.1,25.7-47.1,52.8c0,28.6,23.2,53.3,51.7,53.3H182v-17h-11.3c-9.5,0-18.5-4.1-25.4-11
+ c-6.8-7-10.6-16.3-10.6-26c0-18.6,14.5-33.8,33.2-36.9c1.6-0.3,8.8-1.3,14.2-1.8c0,0-0.5-5.3-0.6-9.6c-0.1-4.3-0.1-9.4-0.1-11.5
+ c0-34.6,28.1-62.7,62.6-62.7c14.5,0,28.1,4.8,39.3,13.9c10.9,8.9,18.6,21.3,21.7,34.9l3.1,14l14.2-1.8c2.1-0.3,4.1-0.4,6.1-0.4
+ c26.9,0,48.8,22.3,48.8,49.4c0,27.1-21.9,49.4-48.8,49.4H320v17h8.4c35.7,0,64.6-30.1,64.6-65.9
+ C393,202.4,364.1,172.7,328.4,172.7z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-thunderstorm.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-thunderstorm.svg
new file mode 100644
index 00000000..73afbf0e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-thunderstorm.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <polygon class="st0" points="272,272 288,224 216,224 201,304 253.3,304 224,400 290,304 312,272 "/>
+ <path class="st0" d="M202.7,208l107.5,0l-16,48H312h30.4l-33,48h19c35.7,0,64.6-30.1,64.6-65.9c0-35.8-28.9-65.5-64.6-65.5
+ c-2.7,0-5.4,0-8,0.3c-7.9-35-39.1-61.4-76.4-61.4c-43.3,0-78.3,35.2-78.3,78.5c0,2.6,0.1,5.2,0.4,7.8
+ c-26.4,2.3-47.1,25.7-47.1,52.8c0,28.6,23.2,53.3,51.7,53.3h14"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-time-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-time-outline.svg
new file mode 100644
index 00000000..9276bc63
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-time-outline.svg
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <g>
+ <path class="st0" d="M256,32C132.3,32,32,132.3,32,256c0,123.7,100.3,224,224,224c123.7,0,224-100.3,224-224
+ C480,132.3,379.7,32,256,32z M403.1,403.1c-19.1,19.1-41.4,34.1-66.1,44.6c-25.6,10.8-52.9,16.3-81,16.3c-28.1,0-55.3-5.5-81-16.3
+ c-24.8-10.5-47-25.5-66.1-44.6C89.8,384,74.8,361.7,64.3,337C53.5,311.3,48,284.1,48,256c0-28.1,5.5-55.3,16.3-81
+ c10.5-24.8,25.5-47,44.6-66.1C128,89.8,150.3,74.8,175,64.3C200.7,53.5,227.9,48,256,48c28.1,0,55.3,5.5,81,16.3
+ c24.8,10.5,47,25.5,66.1,44.6c19.1,19.1,34.1,41.4,44.6,66.1c10.8,25.6,16.3,52.9,16.3,81c0,28.1-5.5,55.3-16.3,81
+ C437.2,361.7,422.2,384,403.1,403.1z"/>
+ <circle class="st0" cx="256" cy="80" r="8"/>
+ <circle class="st0" cx="256" cy="432" r="8"/>
+ <circle class="st0" cx="432" cy="256" r="8"/>
+ <circle class="st0" cx="80" cy="256" r="8"/>
+ <circle class="st0" cx="168" cy="103.6" r="8"/>
+ <circle class="st0" cx="344" cy="408.4" r="8"/>
+ <circle class="st0" cx="408.4" cy="168" r="8"/>
+ <circle class="st0" cx="103.6" cy="344" r="8"/>
+ <circle class="st0" cx="103.6" cy="168" r="8"/>
+ <circle class="st0" cx="408.4" cy="344" r="8"/>
+ <circle class="st0" cx="344" cy="103.6" r="8"/>
+ <circle class="st0" cx="168" cy="408.4" r="8"/>
+ </g>
+ <path class="st0" d="M269.9,248c-2.9-5-8.1-7.8-13.4-8l-38-63.4c-2.3-3.8-7.2-5-11-2.7c-3.8,2.3-5,7.2-2.7,11l37.6,62.9
+ c-2.9,4.8-3.2,11.1-0.2,16.3c1.5,2.5,3.5,4.5,5.9,5.8V392c0,4.4,3.6,8,8,8c4.4,0,8-3.6,8-8V269.9
+ C271.7,265.4,274.3,255.7,269.9,248z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-time.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-time.svg
new file mode 100644
index 00000000..0d0bc47b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-time.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <path class="st0" d="M256,32C132.3,32,32,132.3,32,256c0,123.7,100.3,224,224,224c123.7,0,224-100.3,224-224
+ C480,132.3,379.7,32,256,32z M256,72c4.4,0,8,3.6,8,8s-3.6,8-8,8s-8-3.6-8-8S251.6,72,256,72z M80,264c-4.4,0-8-3.6-8-8
+ c0-4.4,3.6-8,8-8s8,3.6,8,8C88,260.4,84.4,264,80,264z M107.6,350.9c-3.8,2.2-8.7,0.9-10.9-2.9c-2.2-3.8-0.9-8.7,2.9-10.9
+ c3.8-2.2,8.7-0.9,10.9,2.9C112.7,343.8,111.4,348.7,107.6,350.9z M110.5,172c-2.2,3.8-7.1,5.1-10.9,2.9c-3.8-2.2-5.1-7.1-2.9-10.9
+ s7.1-5.1,10.9-2.9C111.4,163.3,112.7,168.2,110.5,172z M164,96.7c3.8-2.2,8.7-0.9,10.9,2.9c2.2,3.8,0.9,8.7-2.9,10.9
+ c-3.8,2.2-8.7,0.9-10.9-2.9C158.9,103.8,160.2,98.9,164,96.7z M174.9,412.4c-2.2,3.8-7.1,5.1-10.9,2.9c-3.8-2.2-5.1-7.1-2.9-10.9
+ c2.2-3.8,7.1-5.1,10.9-2.9S177.1,408.6,174.9,412.4z M256,440c-4.4,0-8-3.6-8-8s3.6-8,8-8s8,3.6,8,8S260.4,440,256,440z M264,269.9
+ V392c0,4.4-3.6,8-8,8c-4.4,0-8-3.6-8-8V269.8c-2.4-1.4-4.4-3.3-5.9-5.8c-3-5.2-2.7-11.5,0.2-16.3l-37.6-62.9c-2.3-3.8-1-8.7,2.7-11
+ c3.8-2.3,8.7-1,11,2.7l38,63.4c5.4,0.1,10.6,3,13.4,8C274.3,255.7,271.7,265.4,264,269.9z M348,415.3c-3.8,2.2-8.7,0.9-10.9-2.9
+ c-2.2-3.8-0.9-8.7,2.9-10.9c3.8-2.2,8.7-0.9,10.9,2.9C353.1,408.2,351.8,413.1,348,415.3z M350.9,107.6c-2.2,3.8-7.1,5.1-10.9,2.9
+ c-3.8-2.2-5.1-7.1-2.9-10.9c2.2-3.8,7.1-5.1,10.9-2.9C351.8,98.9,353.1,103.8,350.9,107.6z M415.3,348c-2.2,3.8-7.1,5.1-10.9,2.9
+ c-3.8-2.2-5.1-7.1-2.9-10.9c2.2-3.8,7.1-5.1,10.9-2.9C416.2,339.3,417.6,344.2,415.3,348z M412.4,174.9c-3.8,2.2-8.7,0.9-10.9-2.9
+ c-2.2-3.8-0.9-8.7,2.9-10.9c3.8-2.2,8.7-0.9,10.9,2.9C417.6,167.8,416.2,172.7,412.4,174.9z M432,264c-4.4,0-8-3.6-8-8
+ c0-4.4,3.6-8,8-8s8,3.6,8,8C440,260.4,436.4,264,432,264z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-timer-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-timer-outline.svg
new file mode 100644
index 00000000..d2d852c9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-timer-outline.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M236.6,271.6c4.6,5.7,11.5,9.4,19.4,9.4c13.8,0,25-11.2,25-25c0-7.3-3.2-13.8-8.2-18.4c-0.6-0.7-1.3-1.5-2.2-2.2
+ c0,0-117.7-87.5-120.3-85.2c-2.6,2.3,85.3,120.2,85.3,120.2C235.8,270.8,236.3,271.2,236.6,271.6z"/>
+<path d="M256.2,48L256.2,48H256v112h16V65.3c97.8,8.3,175.3,90.5,175.3,190.5c0,105.5-85.7,191.4-191.2,191.4
+ c-105.5,0-191.3-85.8-191.3-191.3c0-52.8,21.5-100.6,56.1-135.2L109,108.9C71.3,146.6,48,198.6,48,256c0,114.9,93.1,208,208,208
+ c114.9,0,208-93.1,208-208C464,141.1,371,48,256.2,48z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-timer.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-timer.svg
new file mode 100644
index 00000000..10ebab9e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-timer.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,48C141.1,48,48,141.1,48,256c0,114.9,93.1,208,208,208c114.9,0,208-93.1,208-208C464,141.1,370.9,48,256,48z
+ M150.5,150.5c2.6-2.3,119.9,84.9,119.9,84.9c1,0.7,1.6,1.5,2.2,2.2c5,4.6,8.2,11,8.2,18.3c0,13.7-11.1,24.9-24.9,24.9
+ c-7.8,0-14.7-3.7-19.3-9.4c-0.4-0.4-0.8-0.7-1.1-1.1C235.6,270.4,148,152.9,150.5,150.5z M256.1,447.2
+ c-105.7,0-191.4-85.7-191.4-191.4c0-52.8,21.4-100.7,56-135.3l11.8,11.8c-31.6,31.6-51.2,75.3-51.2,123.5
+ c0,96.3,78.4,174.7,174.7,174.7s174.5-78.4,174.5-174.7c0-90.3-70.5-165.1-158.5-174V160h-16V64.4c105.7,0,191.5,85.7,191.5,191.4
+ C447.5,361.5,361.7,447.2,256.1,447.2z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-toggle-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-toggle-outline.svg
new file mode 100644
index 00000000..2677364c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-toggle-outline.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M128,320c26.467,0,48,21.533,48,48s-21.533,48-48,48s-48-21.533-48-48S101.533,320,128,320 M128,304
+ c-35.346,0-64,28.654-64,64c0,35.347,28.654,64,64,64s64-28.653,64-64C192,332.654,163.346,304,128,304L128,304z"/>
+ <path d="M383.25,288c44.388,0,80.625,36.112,80.625,80.5S427.888,448,383.5,448h-255C84.112,448,48,412.888,48,368.5
+ S84.112,288,128.5,288H383 M383.5,272h-255C75.205,272,32,315.205,32,368.5S75.205,464,128.5,464h255
+ c53.295,0,96.5-42.205,96.5-95.5S436.795,272,383.5,272L383.5,272z"/>
+ </g>
+ <g>
+ <path d="M384,96c26.467,0,48,21.533,48,48s-21.533,48-48,48s-48-21.533-48-48S357.533,96,384,96 M384,80
+ c-35.346,0-64,28.654-64,64c0,35.347,28.654,64,64,64s64-28.653,64-64C448,108.654,419.346,80,384,80L384,80z"/>
+ <path d="M129,64h254.5c44.388,0,80.5,36.112,80.5,80.5S427.888,224,383.5,224h-255c-44.388,0-80.375-35.112-80.375-79.5
+ S84.362,64,128.75,64 M128.5,48C75.205,48,32,91.205,32,144.5S75.205,240,128.5,240h255c53.295,0,96.5-42.205,96.5-95.5
+ S436.795,48,383.5,48H128.5L128.5,48z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-toggle.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-toggle.svg
new file mode 100644
index 00000000..f4374246
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-toggle.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M128,320c-26.467,0-48,21.533-48,48s21.533,48,48,48s48-21.533,48-48S154.467,320,128,320z"/>
+ <path d="M383.5,272h-255C75.205,272,32,315.205,32,368.5S75.205,464,128.5,464h255c53.295,0,96.5-42.205,96.5-95.5
+ S436.795,272,383.5,272z M128,432c-35.346,0-64-28.653-64-64c0-35.346,28.654-64,64-64s64,28.654,64,64
+ C192,403.347,163.346,432,128,432z"/>
+ <path d="M384,192c26.467,0,48-21.533,48-48s-21.533-48-48-48s-48,21.533-48,48S357.533,192,384,192z"/>
+ <path d="M128.5,240h255c53.295,0,96.5-42.205,96.5-95.5S436.795,48,383.5,48h-255C75.205,48,32,91.205,32,144.5
+ S75.205,240,128.5,240z M384,80c35.346,0,64,28.654,64,64c0,35.347-28.654,64-64,64s-64-28.653-64-64
+ C320,108.654,348.654,80,384,80z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-trash-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-trash-outline.svg
new file mode 100644
index 00000000..2b362bbf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-trash-outline.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M400,113.3h-80v-20c0-16.2-13.1-29.3-29.3-29.3h-69.5C205.1,64,192,77.1,192,93.3v20h-80V128h21.1l23.6,290.7
+ c0,16.2,13.1,29.3,29.3,29.3h141c16.2,0,29.3-13.1,29.3-29.3L379.6,128H400V113.3z M206.6,93.3c0-8.1,6.6-14.7,14.6-14.7h69.5
+ c8.1,0,14.6,6.6,14.6,14.7v20h-98.7V93.3z M341.6,417.9l0,0.4v0.4c0,8.1-6.6,14.7-14.6,14.7H186c-8.1,0-14.6-6.6-14.6-14.7v-0.4
+ l0-0.4L147.7,128h217.2L341.6,417.9z"/>
+ <g>
+ <rect x="249" y="160" width="14" height="241"/>
+ <polygon points="320,160 305.4,160 294.7,401 309.3,401 "/>
+ <polygon points="206.5,160 192,160 202.7,401 217.3,401 "/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-trash.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-trash.svg
new file mode 100644
index 00000000..1b645676
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-trash.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M320,113V93.3c0-16.2-13.1-29.3-29.3-29.3h-69.5C205.1,64,192,77.1,192,93.3V113h-80v15h21.1l23.6,290.7
+ c0,16.2,13.1,29.3,29.3,29.3h141c16.2,0,29.3-13.1,29.3-29.3L379.6,128H400v-15H320z M207,93.3c0-8.1,6.2-14.3,14.3-14.3h69.5
+ c8.1,0,14.3,6.2,14.3,14.3V113h-98V93.3H207z M202.7,401L192,160h14.5l10.9,241H202.7z M263,401h-14V160h14V401z M309.3,401h-14.6
+ l10.8-241H320L309.3,401z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-undo-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-undo-outline.svg
new file mode 100644
index 00000000..03c35e30
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-undo-outline.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M447.9,368.2c0-16.8,3.6-83.1-48.7-135.7c-35.2-35.4-80.3-53.4-143.3-56.2V96L64,224l192,128v-79.8
+ c40,1.1,62.4,9.1,86.7,20c30.9,13.8,55.3,44,75.8,76.6l19.2,31.2H448C448,389.9,447.9,377.1,447.9,368.2z M432.2,361.4
+ C384.6,280.6,331,256,240,256v64.8L91.9,224.1L240,127.3V192C441,192,432.2,361.4,432.2,361.4z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-undo.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-undo.svg
new file mode 100644
index 00000000..e1bd3f15
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-undo.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M447.9,368.2c0-16.8,3.6-83.1-48.7-135.7c-35.2-35.4-80.3-53.4-143.3-56.2V96L64,224l192,128v-79.8
+ c40,1.1,62.4,9.1,86.7,20c30.9,13.8,55.3,44,75.8,76.6l19.2,31.2H448C448,389.9,447.9,377.1,447.9,368.2z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-unlocked-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-unlocked-outline.svg
new file mode 100644
index 00000000..ed67ed4f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-unlocked-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,288c-17.673,0-32,14.327-32,32c0,14.91,10.198,27.439,24,30.992V384h16v-33.008c13.802-3.553,24-16.082,24-30.992
+ C288,302.327,273.673,288,256,288z M256,336c-8.822,0-16-7.178-16-16s7.178-16,16-16s16,7.178,16,16S264.822,336,256,336z"/>
+ <g>
+ <path d="M168,224v-72c0-48.523,39.484-88,88.016-88C304.531,64,344,103.477,344,152v8h16v-8c0-57.43-46.562-104-103.984-104
+ C198.562,48,152,94.57,152,152v72H96v240h320V224H168z M400,448H112V240h288V448z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-unlocked.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-unlocked.svg
new file mode 100644
index 00000000..e547e801
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-unlocked.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,304c-8.822,0-16,7.178-16,16s7.178,16,16,16s16-7.178,16-16S264.822,304,256,304z"/>
+ <path d="M168,224v-72c0-48.523,39.484-88,88.016-88C304.531,64,344,103.477,344,152v8h16v-8c0-57.43-46.562-104-103.984-104
+ C198.562,48,152,94.57,152,152v72H96v240h320V224H168z M264,350.992V384h-16v-33.008c-13.802-3.553-24-16.082-24-30.992
+ c0-17.673,14.327-32,32-32s32,14.327,32,32C288,334.91,277.802,347.439,264,350.992z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-upload-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-upload-outline.svg
new file mode 100644
index 00000000..e836efa4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-upload-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <polygon points="288,144 288,160 400,160 400,432 112,432 112,160 224,160 224,144 96,144 96,448 416,448 416,144 "/>
+ </g>
+ <g>
+ <polygon points="193.1,118.1 181.5,106.5 256,32 330.5,106.5 318.9,118.1 264.2,63.4 264.2,306.4 247.8,306.4 247.8,63.4 "/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-upload.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-upload.svg
new file mode 100644
index 00000000..5352c0af
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-upload.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="264,144 264,306 248,306 248,144 96,144 96,448 416,448 416,144 "/>
+ <polygon points="264,63.4 318.8,118.1 330.4,106.5 256,32 181.5,106.5 193.2,118.1 248,63.4 248,144 264,144 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-videocam-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-videocam-outline.svg
new file mode 100644
index 00000000..11cc9bbe
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-videocam-outline.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M303.7,128h-221C63.9,128,47,142.1,47,160.7v187.9c0,18.6,16.9,35.4,35.7,35.4h221c18.8,0,33.3-16.8,33.3-35.4V160.7
+ C337,142.1,322.5,128,303.7,128z M320,348.6c0,9.3-6.9,18.4-16.3,18.4h-221c-9.4,0-18.7-9.1-18.7-18.4V160.7
+ c0-9.3,9-15.5,18.4-15.5l221,0.1c9.4,0,16.6,6.1,16.6,15.4V348.6z"/>
+ <path d="M367,213v85.6l98,53.4V160L367,213z M448,190v132.3l-64-33.5v-65.6l64.1-33.6L448,190z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-videocam.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-videocam.svg
new file mode 100644
index 00000000..dbcbceec
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-videocam.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M303.7,128h-221C63.9,128,47,142.1,47,160.7v187.9c0,18.6,16.9,35.4,35.7,35.4h221c18.8,0,33.3-16.8,33.3-35.4V160.7
+ C337,142.1,322.5,128,303.7,128z"/>
+ <path d="M367,213v85.6l98,53.4V160L367,213z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-volume-high.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-volume-high.svg
new file mode 100644
index 00000000..7f62cac4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-volume-high.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <g>
+ <path d="M374.1,128l-13.6,10.3C384.6,171.2,399,211.9,399,256c0,44.1-14.4,84.8-38.6,117.7l13.6,10.3c26.3-35.7,41.9-80,41.9-128
+ C415.9,208,400.4,163.7,374.1,128z"/>
+ <path d="M320,351.8c20-26.8,32-59.9,32-95.8s-12-69-32-95.8l-13.6,10.1c17.9,24,28.6,53.6,28.6,85.7s-10.7,61.7-28.6,85.7
+ L320,351.8z"/>
+ <path d="M273.1,319.9c13.7-17.9,21.9-39.9,21.9-63.9c0-24-8.2-46-21.9-63.9l-13.5,9.8c11.6,15.1,18.5,33.8,18.5,54.1
+ s-6.9,38.9-18.5,54.1L273.1,319.9z"/>
+ </g>
+ </g>
+ <polygon points="153.9,216 96,216 96,296 153.9,296 224,352 224,160 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-volume-low.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-volume-low.svg
new file mode 100644
index 00000000..127e9766
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-volume-low.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="249.9,216 192,216 192,296 249.9,296 320,352 320,160 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-wineglass-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-wineglass-outline.svg
new file mode 100644
index 00000000..c193875c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-wineglass-outline.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M264,308.988c0-21.975,20.458-38.674,40.247-54.824c7.907-6.453,15.37-12.547,21.519-18.962
+ C352.313,207.505,352,183.458,352,164.144V160c0-44.25-30.816-124.558-32.02-128H256h-64c-1.203,3.442-32,83.5-32,128v4.144
+ c0,19.273-0.323,43.361,26.225,71.059c6.148,6.415,13.617,12.509,21.523,18.962c19.789,16.15,40.252,32.85,40.252,54.824V464h-72v16
+ h80h80v-16h-72V308.988z M202.729,48H256h53.251c5.359,15.99,19.509,62.712,24.836,96H177.894
+ C183.221,110.712,197.37,63.99,202.729,48z M256,273.416c-2.968,0-5.248-0.92-7.17-2.754c0.001,0.009,0.003,0.018,0.005,0.026
+ c-8.804-10.807-20.234-20.158-30.971-28.92c-7.517-6.135-14.617-11.929-20.089-17.637c-22.054-23.008-21.928-40.916-21.795-59.875
+ c0.01-1.428-0.068-2.849,0.02-4.255h159.98c0.088,1.406,0.01,2.828,0.021,4.255c0.133,18.959,0.259,36.867-21.795,59.875
+ c-5.472,5.708-12.57,11.502-20.087,17.637c-10.737,8.762-22.165,18.114-30.969,28.92c0.002-0.009,0.009-0.018,0.01-0.026
+ C261.238,272.496,259,273.416,256,273.416z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-wineglass.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-wineglass.svg
new file mode 100644
index 00000000..4ac498d6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-wineglass.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M264,308.988c0-21.975,20.458-38.674,40.247-54.824c7.907-6.453,15.37-12.547,21.519-18.962
+ C352.313,207.505,352,183.458,352,164.144V160c0-44.25-30.816-124.558-32.02-128H256h-64c-1.203,3.442-32,83.5-32,128v4.144
+ c0,19.273-0.323,43.361,26.225,71.059c6.148,6.415,13.617,12.509,21.523,18.962c19.789,16.15,40.252,32.85,40.252,54.824V464h-72v16
+ h80h80v-16h-72V308.988z M202.729,48H256h53.251c5.359,15.99,19.509,62.712,24.836,96H177.894
+ C183.221,110.712,197.37,63.99,202.729,48z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-world-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-world-outline.svg
new file mode 100644
index 00000000..a90af05c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-world-outline.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,48c-0.1,0-0.1,0-0.2,0c0,0,0,0-0.1,0c-0.1,0-0.2,0-0.2,0C140.8,48.3,48,141.3,48,256c0,114.7,92.8,207.7,207.5,208
+ c0.1,0,0.2,0,0.2,0c0,0,0.1,0,0.1,0c0.1,0,0.1,0,0.2,0c114.9,0,208-93.1,208-208C464,141.1,370.9,48,256,48z M264.3,172.5
+ c22.1-0.6,43.5-3.5,64.2-8.5c6.2,24.5,10.1,52.8,10.7,83.8h-74.9V172.5z M264.3,155.8V66c22.4,6.2,45.2,36.1,59.6,82
+ C304.7,152.6,284.8,155.2,264.3,155.8z M247.7,65.8v90.1c-20.7-0.6-40.8-3.3-60.1-8C202.2,101.7,225.1,71.6,247.7,65.8z
+ M247.7,172.5v75.2h-75.4c0.6-31,4.5-59.3,10.7-83.8C203.8,168.9,225.5,171.9,247.7,172.5z M155.5,247.7H64.9
+ c1.8-42.8,17.8-82,43.3-113c18.5,10.2,38.2,18.6,58.8,24.8C160.2,186,156.2,215.9,155.5,247.7z M155.5,264.3
+ c0.6,31.7,4.6,61.7,11.4,88.2c-20.6,6.3-40.2,14.6-58.8,24.8c-25.5-31-41.4-70.2-43.3-113H155.5z M172.3,264.3h75.4v75.1
+ c-22.2,0.6-43.9,3.6-64.7,8.7C176.8,323.6,172.9,295.3,172.3,264.3z M247.7,356.1v90.2c-22.6-5.9-45.5-35.9-60.1-82.1
+ C206.9,359.4,227,356.7,247.7,356.1z M264.3,446v-90c20.5,0.6,40.4,3.3,59.7,7.9C309.5,409.9,286.8,439.8,264.3,446z M264.3,339.4
+ v-75.1h74.9c-0.6,30.9-4.5,59.2-10.7,83.7C307.8,343,286.4,340,264.3,339.4z M355.9,264.3h91.2c-1.8,42.8-17.8,81.9-43.3,113
+ c-18.7-10.3-38.5-18.7-59.3-25C351.3,325.8,355.3,296,355.9,264.3z M355.9,247.7c-0.6-31.7-4.6-61.6-11.3-88.1
+ c20.8-6.3,40.6-14.7,59.2-24.9c25.5,31,41.5,70.2,43.3,113.1H355.9z M392.4,121.9c-16.6,8.8-34,16.1-52.3,21.6
+ c-9.7-31.3-23.4-56.8-39.5-73.6C336,78.4,367.6,96.8,392.4,121.9z M210.8,70.1c-16.1,16.7-29.7,42.2-39.3,73.3
+ c-18.1-5.5-35.4-12.7-51.8-21.5C144.2,96.9,175.6,78.6,210.8,70.1z M119.6,390c16.4-8.8,33.8-16,51.8-21.5
+ c9.7,31.2,23.3,56.6,39.4,73.4C175.6,433.4,144.2,415.1,119.6,390z M300.6,442.1c16.2-16.8,29.8-42.3,39.6-73.7
+ c18.3,5.5,35.7,12.8,52.3,21.6C367.7,415.2,336,433.6,300.6,442.1z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-world.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-world.svg
new file mode 100644
index 00000000..97d6a83c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-world.svg
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,48c-0.1,0-0.1,0-0.2,0c0,0,0,0-0.1,0c-0.1,0-0.2,0-0.2,0C140.8,48.3,48,141.3,48,256c0,114.7,92.8,207.7,207.5,208
+ c0.1,0,0.2,0,0.2,0c0,0,0.1,0,0.1,0c0.1,0,0.1,0,0.2,0c114.9,0,208-93.1,208-208C464,141.1,370.9,48,256,48z M256,447.4
+ c-0.1,0-0.1,0-0.2,0c0,0,0,0-0.1,0c-0.1,0-0.2,0-0.2,0C150.1,447.1,64.6,361.5,64.6,256c0-105.5,85.4-191.1,190.9-191.3
+ c0.1,0,0.1,0,0.2,0c0,0,0.1,0,0.1,0c0.1,0,0.1,0,0.2,0c105.7,0,191.4,85.7,191.4,191.4C447.4,361.7,361.7,447.4,256,447.4z"/>
+ <path d="M322.3,171.8c-18.7,4.5-38,7.2-57.9,7.8v68.1H332C331.4,219.6,327.9,194.1,322.3,171.8z"/>
+ <path d="M264.3,82.5v81.9c18.5-0.6,36.5-3,53.8-7.2C305,115.8,284.6,88.6,264.3,82.5z"/>
+ <path d="M193.4,157.1c17.5,4.2,35.6,6.7,54.2,7.3V82.3C227.3,88.2,206.6,115.4,193.4,157.1z"/>
+ <path d="M380.6,133.4c-22.6-23-51.5-39.8-83.9-47.5c14.8,15.3,27.2,38.7,36.1,67.3C349.5,148.1,365.5,141.5,380.6,133.4z"/>
+ <path d="M347.3,247.7h83.3c-1.8-38.8-16.3-74.4-39.5-102.6c-17.1,9.4-35.2,17.1-54.1,22.8C343.1,191.9,346.7,219,347.3,247.7z"/>
+ <path d="M179.5,247.7h68.2v-68.1c-20.1-0.6-39.6-3.3-58.4-7.9C183.6,194,180.1,219.6,179.5,247.7z"/>
+ <path d="M332,264.3h-67.7v68c19.9,0.6,39.3,3.2,58,7.8C327.9,317.9,331.4,292.3,332,264.3z"/>
+ <path d="M189.3,340.2c18.8-4.6,38.3-7.3,58.4-7.9v-68h-68.2C180.1,292.4,183.6,318,189.3,340.2z"/>
+ <path d="M247.7,429.6v-82.1c-18.6,0.6-36.8,3.1-54.3,7.3C206.6,396.5,227.3,423.8,247.7,429.6z"/>
+ <path d="M296.7,426.1c32.4-7.8,61.3-24.5,84-47.6c-15.1-8.1-31.1-14.7-47.8-19.8C324,387.4,311.5,410.7,296.7,426.1z"/>
+ <path d="M214.7,86.1c-32.1,7.8-60.8,24.5-83.3,47.4c15,8,30.8,14.6,47.3,19.6C187.6,124.6,200,101.4,214.7,86.1z"/>
+ <path d="M337,344.1c19,5.7,37.1,13.4,54.2,22.8c23.2-28.2,37.7-63.8,39.5-102.6h-83.3C346.7,293,343.1,320,337,344.1z"/>
+ <path d="M264.3,347.5v82c20.3-6.1,40.7-33.3,53.8-74.8C300.8,350.5,282.8,348.1,264.3,347.5z"/>
+ <path d="M174.6,167.8c-18.8-5.7-36.8-13.3-53.7-22.7c-23.2,28.2-37.7,63.8-39.5,102.6h82.9C164.8,218.9,168.5,191.8,174.6,167.8z"
+ />
+ <path d="M164.2,264.3H81.3c1.8,38.8,16.3,74.4,39.5,102.6c16.9-9.3,34.9-17,53.7-22.7C168.5,320.2,164.8,293.1,164.2,264.3z"/>
+ <path d="M131.3,378.5c22.5,22.9,51.2,39.6,83.4,47.4c-14.7-15.3-27.1-38.6-36-67.1C162.2,363.9,146.3,370.5,131.3,378.5z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ipad.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ipad.svg
new file mode 100644
index 00000000..b1263d90
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ipad.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M112,72.8v366.4c0,4.9,3.9,8.8,8.8,8.8h270.4c4.9,0,8.8-3.9,8.8-8.8V72.8c0-4.9-3.9-8.8-8.8-8.8H120.8
+ C115.9,64,112,67.9,112,72.8z M256,437.6c-7.5,0-13.6-6-13.6-13.5c0-7.5,6.1-13.6,13.6-13.6c7.4,0,13.5,6.1,13.5,13.6
+ C269.6,431.6,263.5,437.6,256,437.6z M144,118.6c0-3.5,2.7-6.6,6-6.6h211.2c3.4,0,6.8,3.1,6.8,6.6v275.2c0,3.5-3.4,6.3-6.8,6.3H150
+ c-3.4,0-6-2.8-6-6.3V118.6z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/iphone.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/iphone.svg
new file mode 100644
index 00000000..31b50736
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/iphone.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M328.2,64H183.8C170.7,64,160,74.7,160,87.9v336.3c0,13.1,10.7,23.8,23.8,23.8h144.3c13.1,0,23.8-10.7,23.8-23.8V87.9
+ C352,74.7,341.3,64,328.2,64z M240,99.9c0-2.1,1.7-3.9,3.9-3.9h24.3c2.1,0,3.9,1.7,3.9,3.9v0.3c0,2.1-1.7,3.9-3.9,3.9h-24.3
+ c-2.1,0-3.9-1.7-3.9-3.9V99.9z M228,96c2.2,0,4,1.8,4,4c0,2.2-1.8,4-4,4s-4-1.8-4-4C224,97.8,225.8,96,228,96z M256,432.1
+ c-8.9,0-16.1-7.2-16.1-16.1c0-8.9,7.2-16.1,16.1-16.1c8.9,0,16.1,7.2,16.1,16.1C272.1,424.9,264.8,432.1,256,432.1z M336,384H176
+ V128h160V384z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ipod.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ipod.svg
new file mode 100644
index 00000000..ad02aec3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ipod.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,311c-17.7,0-32,14.3-32,32c0,17.6,14.3,32,32,32c17.6,0,32-14.3,32-32C288,325.3,273.7,311,256,311z"/>
+ <path d="M340.4,64H171.6C156.4,64,144,76.2,144,91.7v328.7c0,15.5,12.4,27.7,27.6,27.7h168.8c15.2,0,27.6-12.2,27.6-27.7V91.7
+ C368,76.2,355.6,64,340.4,64z M256.1,416.1c-39.8,0-72.1-32.2-72.1-72c0-39.7,32.3-72,72.1-72c39.7,0,71.9,32.3,71.9,72
+ C328,383.9,295.8,416.1,256.1,416.1z M335.9,226.8c-0.8,7.6-7,13.2-14.7,13.2h-131c-8.2,0-14.2-6.2-14.2-14.6V110.9
+ c0-7.5,5-13.7,12-14.9l135.8,0c6.5,1.2,11.5,6.6,12.2,13.3L335.9,226.8z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/jet.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/jet.svg
new file mode 100644
index 00000000..c7238e20
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/jet.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<path class="st0" d="M314.8,368.5L419,403l-3-52.7L302,247c0,0-25.9-173.7-28.2-192.3C268.5,14.4,255.9,0,255.9,0
+ s-12.5,14.4-17.6,54.6C235.9,73.3,210,247,210,247L96,350.3L93,403l104.2-34.5l1.4,12.3l-52.7,58.3l18.3,27.4l73.3-9.1l18.3,54.6
+ l18.5-54.6l73.4,9.1l18.3-27.4l-52.7-58.3L314.8,368.5z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/key.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/key.svg
new file mode 100644
index 00000000..3bc445dc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/key.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M304.3,301c0,0-5.4-28-7.3-90c-1.9-62-9-142.5-9-142.5c-2.5-28-11.8-36.5-32-36.5c-9.4,0-20.5,2.3-23.3,3.3
+ c-9.4,3.6-8.7,11.6-8.7,22.5l0,17.8c0,3.2,1.2,6,3.2,8.2l0.8,0.8l4.1,4.1c0.4,0.3,0.1,0.7,0.4,1c1.9,2.2,3.1,5,3.1,8.1l0,24.5
+ c0,3.2-1.2,3.2-3.2,5.3c-0.2,0.3-0.5,0.6-0.8,0.8l-4.4,4.4c-0.1,0.1-0.3,0.3-0.4,0.4c-2.1,2.2-3.4,5.2-3.4,8.4l0,7.2
+ c0,3.1,1.1,5.9,3.1,8.1c0,0,0.1,0.1,0.1,0.1l0.8,0.8c0,0,0.1,0.1,0.1,0.1l4,4c0.4,0.3,0.7,0.7,1,1c1.9,2.2,3.1,5,3.1,8.1
+ c0,0.7-0.1,8.1-0.2,8.8c-0.4,2.3-1.5,4.4-3,6.1c-0.2,0.3-0.5,0.6-0.8,0.8l-3.9,3.9l-1.4,1.5c-0.5,0.6-0.7,1.3-1.1,2.1
+ c-0.9,1.7-1.2,3.7-1.2,5.9v7.8c0,2.9-0.1,5.7-0.2,8.6c0.2,2.4,7.2,5.7,7.2,10.5v20.4c0,6.2-10.5,7-11,11.3
+ c-4.7,25.4-11.9,41.8-11.9,41.8c-28.7,16.6-48,47.6-48,83.2c0,53,43,96,96,96s96-43,96-96C352,348.6,332.8,317.7,304.3,301z
+ M256,448c-17.7,0-32-14.3-32-32s14.3-32,32-32s32,14.3,32,32S273.7,448,256,448z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/knife.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/knife.svg
new file mode 100644
index 00000000..c70faa3b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/knife.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M285.7,32c-3.3,0-6,1.4-8,3.8C259,58.7,224,116.1,224,250.1c0,39.2,33,39.2,32,69.4c0,0.1,0,0.3,0,0.4
+ c-2,47.1-14.9,111.1-16,130.3c-0.4,15.2,9.7,29.8,24.1,29.8c0.1,0,0.1,0,0.2,0c0,0,0.1,0,0.2,0c14.4,0,23.5-14.4,23.5-29.6V38.3
+ C288,33.3,287.5,32,285.7,32z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/laptop.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/laptop.svg
new file mode 100644
index 00000000..669df211
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/laptop.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M480,106.3c0-5.6-4.1-10.3-9.6-10.3H42.2c-5.5,0-10.2,4.6-10.2,10.3V368h448V106.3z M448,336H64V128h384V336z"/>
+ <path d="M0,388.7C70.2,408.6,115.8,416,256,416c140.2,0,185.8-7.3,256-27.3V384H0V388.7z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/leaf.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/leaf.svg
new file mode 100644
index 00000000..da913165
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/leaf.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M456.7,378.7c-52.5-8-56.5-15.7-56.5-15.7c10.8-64.9-22.7-147.1-77.4-191.6c-72.8-59.2-183.5-16.2-269.7-106.2
+ c-20.1-21-8.4,235.5,99.5,332.7c78.9,71,171.8,49.2,197.3,37.6c23.1-10.6,39.3-29.9,39.3-29.9c42.1,13,62.9,12.2,62.9,12.2
+ C466.9,419.6,474.4,381.4,456.7,378.7z M360.6,383.1c-138.2-40.9-242.1-184.5-242.1-184.5s91.2,107.7,252,160.2
+ C370.7,366.9,365.9,378.5,360.6,383.1z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/levels.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/levels.svg
new file mode 100644
index 00000000..34d7254f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/levels.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M127,99.2V80c0-8.8-7.2-16-16-16s-16,7.2-16,16v21.5c-8.5,5.8-14,15.5-14,26.5s5.5,20.7,14,26.5V432c0,8.8,7.2,16,16,16
+ s16-7.2,16-16V156.8c10.7-5.2,18-16.1,18-28.8S137.7,104.4,127,99.2z"/>
+ <path d="M223,292.9V80c0-8.8-7.2-16-16-16s-16,7.2-16,16v211.7c-10.1,5.4-17,16-17,28.3s6.9,22.9,17,28.3V432c0,8.8,7.2,16,16,16
+ s16-7.2,16-16v-84.9c9-5.7,15-15.7,15-27.1S232,298.6,223,292.9z"/>
+ <path d="M319,163.3V80c0-8.8-7.2-16-16-16s-16,7.2-16,16v83.3c-9.6,5.5-16,15.9-16,27.7s6.4,22.2,16,27.7V432c0,8.8,7.2,16,16,16
+ s16-7.2,16-16V218.7c9.6-5.5,16-15.9,16-27.7S328.6,168.8,319,163.3z"/>
+ <path d="M431,383c0-11.8-6.4-22.2-16-27.7V80c0-8.8-7.2-16-16-16s-16,7.2-16,16v275.3c-9.6,5.5-16,15.9-16,27.7s6.4,22.2,16,27.7
+ V432c0,8.8,7.2,16,16,16s16-7.2,16-16v-21.3C424.6,405.2,431,394.8,431,383z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/lightbulb.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/lightbulb.svg
new file mode 100644
index 00000000..65d968b1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/lightbulb.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,32c-70.7,0-128,55.4-128,123.8c0,4.9,0.3,9.7,0.9,14.5c0.6,5.4,1.6,10.6,3,15.7c0.1,0.5,0.3,1.1,0.4,1.6
+ c16.6,62.8,45.3,71.5,58.9,167.6c0,0.2,0.1,0.4,0.1,0.5c1.5,9.2,9.8,12.3,19.8,12.3H301c10,0,18.2-3.1,19.7-12.3
+ c0-0.2,0.1-0.4,0.1-0.5c13.6-96.1,42.3-104.7,58.9-167.6c0.2-0.5,0.3-1,0.4-1.6c1.3-5.1,2.3-10.4,3-15.7c0.6-4.7,0.9-9.6,0.9-14.5
+ C384,87.4,326.7,32,256,32z"/>
+ <path d="M317.8,396.5c0.1-0.2,0.3-0.4,0.4-0.6c1.1-1.7,1.7-3.6,1.7-5.7c0-3.5,1.6-6.2-6.5-6.2H198.6c-8.1,0-6.5,2.1-6.5,6.2
+ c0,2.1,0.6,4,1.7,5.7c0.1,0.2,0.3,0.4,0.5,0.6c0,0.1,0.1,0.1,0.1,0.2c1.7,2.6,2.7,4.4,2.7,7.6c0,3.1-0.9,4.9-2.6,7.5
+ c-0.3,0.4-0.5,0.7-0.7,1c-1,1.7-1.6,3.6-1.6,5.6c0,2.1,0.6,4,1.7,5.8c0.1,0.2,0.3,0.4,0.4,0.6c1.8,2.7,2.8,4.5,2.8,7.8
+ c0,3.1-0.9,4.9-2.6,7.4c-0.2,0.4-0.5,0.7-0.8,1.1c-1,1.7-1.6,3.6-1.6,5.6c0,5.4,4.3,10.1,10.2,11.6c0.3,0.1,0.6,0.1,0.9,0.2
+ c6,1.4,12.2,1.6,18.5,2.5c0.7,0.1,1.4,0.2,2.2,0.3c5.6,1,10.3,3.9,13.4,7.7l0,0c3.8,5.3,10.8,11,18.8,11c7.6,0,14.3-5.4,18.2-10.4
+ h0c3-4.2,8-7.3,13.9-8.4c0.7-0.1,1.4-0.3,2.2-0.3c6.3-0.9,12.5-1.1,18.5-2.5c0.3-0.1,0.6-0.1,0.9-0.2c5.9-1.6,10.2-6.2,10.2-11.6
+ c0-2-0.6-3.9-1.6-5.6c-0.3-0.4-0.5-0.7-0.8-1.1c-1.6-2.6-2.6-4.3-2.6-7.4c0-3.2,1-5.1,2.8-7.8c0.1-0.2,0.3-0.4,0.4-0.6
+ c1.1-1.7,1.7-3.7,1.7-5.8c0-2-0.6-3.9-1.6-5.6c-0.3-0.3-0.5-0.7-0.7-1c-1.6-2.6-2.6-4.3-2.6-7.5c0-3.2,1-5,2.7-7.6
+ C317.7,396.7,317.7,396.6,317.8,396.5z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/link.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/link.svg
new file mode 100644
index 00000000..97465186
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/link.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256.5,208H256v0C256.2,208,256.3,208,256.5,208z"/>
+ <path d="M368.5,160H320c0,0,26,17,31.6,48H368h0.5c17.6,0,31.5,13.9,31.5,31.5v32c0,17.6-13.9,32.5-31.5,32.5h-112
+ c-17.6,0-32.5-14.9-32.5-32.5V240h-48v31.5c0,11.5,2.5,22.5,6.9,32.5c12.6,28.2,40.9,48,73.6,48h112c44.2,0,79.5-36.3,79.5-80.5
+ v-32C448,195.3,412.7,160,368.5,160z"/>
+ <path d="M329.6,208c-12.1-28.3-40.1-48-73.1-48h-112c-44.2,0-80.5,35.3-80.5,79.5v32c0,44.2,36.3,80.5,80.5,80.5H192
+ c0,0-25.8-17-32.1-48h-15.4c-17.6,0-32.5-14.9-32.5-32.5v-32c0-17.6,14.9-31.5,32.5-31.5H256h0.5c17.6,0,31.5,13.9,31.5,31.5v32
+ c0,0.2,0,0.3,0,0.5h48c0-0.2,0-0.3,0-0.5v-32C336,228.3,333.7,217.6,329.6,208z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-a.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-a.svg
new file mode 100644
index 00000000..b41fdfc3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-a.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <circle cx="256" cy="96" r="64"/>
+ <circle cx="96" cy="256" r="48"/>
+ <circle cx="368" cy="144" r="8"/>
+ <path d="M180.1,107.6c-19.9-20.1-52.2-20.1-72.1,0c-19.9,20.1-19.9,52.7,0,72.8c19.9,20.1,52.2,20.1,72.1,0
+ C200,160.3,200,127.7,180.1,107.6z"/>
+ <circle cx="416" cy="256" r="16"/>
+ <circle cx="369" cy="369" r="24"/>
+ <circle cx="256" cy="416" r="32"/>
+ <circle cx="144" cy="368" r="40"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-b.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-b.svg
new file mode 100644
index 00000000..b3254f65
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-b.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M288,160c0,17.7-14.3,32-32,32l0,0c-17.7,0-32-14.3-32-32V64c0-17.7,14.3-32,32-32l0,0c17.7,0,32,14.3,32,32V160z"/>
+ <path d="M256,320c-17.7,0-32,14.3-32,32v96c0,17.7,14.3,32,32,32s32-14.3,32-32v-96C288,334.3,273.7,320,256,320L256,320z"/>
+ <path d="M448,224h-96c-17.7,0-32,14.3-32,32s14.3,32,32,32h96c17.7,0,32-14.3,32-32S465.7,224,448,224L448,224z"/>
+ <path d="M160,224H64c-17.7,0-32,14.3-32,32s14.3,32,32,32h96c17.7,0,32-14.3,32-32S177.7,224,160,224L160,224z"/>
+ <path d="M346.5,210.7c-12.5,12.5-32.8,12.5-45.3,0l0,0c-12.5-12.5-12.5-32.8,0-45.3l67.9-67.9c12.5-12.5,32.8-12.5,45.3,0l0,0
+ c12.5,12.5,12.5,32.8,0,45.3L346.5,210.7z"/>
+ <path d="M210.7,301.3c-12.5-12.5-32.8-12.5-45.3,0l-67.9,67.9c-12.5,12.5-12.5,32.8,0,45.3c12.5,12.5,32.8,12.5,45.3,0l67.9-67.9
+ C223.2,334,223.2,313.8,210.7,301.3L210.7,301.3z"/>
+ <path d="M414.4,369.1l-67.9-67.9c-12.5-12.5-32.8-12.5-45.3,0c-12.5,12.5-12.5,32.8,0,45.3l67.9,67.9c12.5,12.5,32.8,12.5,45.3,0
+ C426.9,401.9,426.9,381.6,414.4,369.1L414.4,369.1z"/>
+ <path d="M210.7,165.5l-67.9-67.9c-12.5-12.5-32.8-12.5-45.3,0c-12.5,12.5-12.5,32.8,0,45.3l67.9,67.9c12.5,12.5,32.8,12.5,45.3,0
+ S223.2,178,210.7,165.5L210.7,165.5z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-c.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-c.svg
new file mode 100644
index 00000000..e8cf4ebc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-c.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M479.8,226.1c-1.4-8.7-3.1-17.3-5.3-25.8c-2.8-10.8-6.4-21.5-10.8-31.8c-8.9-21.2-21.1-41-35.9-58.6
+ c-16-18.9-35.3-35.2-56.7-47.7C350,49.8,327,41,303,36.1c-12.4-2.5-24.9-4-37.6-4.1c-9.9-0.1-19.8,0.3-29.6,1.2
+ c-25.5,2.5-50.7,9.6-73.9,20.5c-19.9,9.4-38.4,21.6-54.8,36.2c-16.4,14.6-30.7,31.6-42.2,50.3c-12.7,20.8-22.2,43.5-27.4,67.3
+ c-4.2,19-6.2,38.6-5.2,58.1c0.9,18.9,3.8,37.8,9.5,55.9c3.6,11.5,7.9,22.7,13.3,33.6c5.3,10.7,11.5,21,18.4,30.7
+ c13.8,19.3,30.6,36.4,49.8,50.5c19.6,14.5,41.7,25.7,64.9,33.1c24.2,7.7,49.9,11.3,75.3,10.4c24.8-0.8,49.4-5.6,72.6-14.5
+ c22.3-8.6,43.2-20.9,61.5-36.3c9.2-7.8,17.4-16.6,25.1-25.9c7.8-9.4,14.8-19.3,20.6-30c5-9.2,9.2-18.8,12.8-28.5
+ c1.8-4.8,3.5-9.6,4.9-14.6c1.5-5.3,2.6-10.8,3.6-16.2c1.5-8.5,2.1-17.3,1.3-25.9c-0.7,3.8-1.3,7.5-2.2,11.2
+ c-1.1,4.3-2.5,8.5-4.1,12.6c-3.2,8.7-7.2,17.1-11,25.5c-4.9,10.7-10.6,20.9-16.8,30.8c-3.2,5.1-6.5,10.1-10.1,14.9
+ c-3.6,4.8-7.7,9.4-11.8,13.9c-8.2,9.1-17.1,17.2-27,24.4c-10.1,7.4-20.8,13.9-32.1,19.3c-22.6,11-47.3,17.6-72.3,19.8
+ c-25.6,2.2-51.7-0.3-76.3-7.6c-23.4-6.9-45.6-18.1-65.1-32.8c-18.9-14.3-35.3-31.9-48.2-51.8C75.4,347.8,66.1,324.9,61,301
+ c-1.3-6.2-2.3-12.6-3-18.9c-0.6-5.4-1.1-10.9-1.3-16.4c-0.3-11.3,0.4-23,2.1-34.2c3.7-24.6,11.7-48.3,24.1-69.9
+ c11-19.3,25.3-36.7,42.1-51.4c16.8-14.8,36-26.7,56.8-35.1c12-4.9,24.6-8.5,37.4-10.9c6.5-1.2,13-2.2,19.5-2.7
+ c3.2-0.3,6.3-0.3,9.5-0.6c1.3,0,2.6,0.1,3.9,0.1c21.7-0.4,43.5,2.4,64.2,8.9c22.3,7,43.3,18.3,61.5,33c19.1,15.4,35,34.4,47,55.8
+ c10.2,18.2,17.5,37.8,21.9,58.2c1,4.7,1.8,9.4,2.6,14.1c0.7,4.3,3.1,8.3,6.8,10.7c7.8,5.2,18.7,1.7,22.5-6.7
+ C479.9,232.1,480.3,229,479.8,226.1z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-d.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-d.svg
new file mode 100644
index 00000000..bdedb934
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-d.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M432,240h-80c-8.8,0-16,7.2-16,16s7.2,16,16,16h80c8.8,0,16-7.2,16-16S440.8,240,432,240z"/>
+ <path d="M176,256c0-8.8-7.2-16-16-16H80c-8.8,0-16,7.2-16,16s7.2,16,16,16h80C168.8,272,176,264.8,176,256z"/>
+ <path d="M256,336c-8.8,0-16,7.2-16,16v80c0,8.8,7.2,16,16,16s16-7.2,16-16v-80C272,343.2,264.8,336,256,336z"/>
+ <path d="M256,64c-8.8,0-16,7.2-16,16v80c0,8.8,7.2,16,16,16s16-7.2,16-16V80C272,71.2,264.8,64,256,64z"/>
+ <path d="M325.3,216c4.4,7.7,14.2,10.3,21.9,5.9l69.3-40c7.7-4.4,10.3-14.2,5.9-21.9s-14.2-10.3-21.9-5.9l-69.3,40
+ C323.5,198.6,320.9,208.3,325.3,216z"/>
+ <path d="M186.7,296c-4.4-7.7-14.2-10.3-21.9-5.9l-69.3,40c-7.7,4.4-10.3,14.2-5.9,21.9s14.2,10.3,21.9,5.9l69.3-40
+ C188.5,313.4,191.1,303.7,186.7,296z"/>
+ <path d="M317.9,331.1c-4.4-7.7-14.2-10.3-21.9-5.9s-10.3,14.2-5.9,21.9l40,69.3c4.4,7.7,14.2,10.3,21.9,5.9
+ c7.7-4.4,10.3-14.2,5.9-21.9L317.9,331.1z"/>
+ <path d="M181.9,95.6c-4.4-7.7-14.2-10.3-21.9-5.9c-7.7,4.4-10.3,14.2-5.9,21.9l40,69.3c4.4,7.7,14.2,10.3,21.9,5.9
+ s10.3-14.2,5.9-21.9L181.9,95.6z"/>
+ <path d="M296,186.7c7.7,4.4,17.4,1.8,21.9-5.9l40-69.3c4.4-7.7,1.8-17.4-5.9-21.9c-7.7-4.4-17.4-1.8-21.9,5.9l-40,69.3
+ C285.7,172.5,288.3,182.3,296,186.7z"/>
+ <path d="M216,325.3c-7.7-4.4-17.4-1.8-21.9,5.9l-40,69.3c-4.4,7.7-1.8,17.4,5.9,21.9c7.7,4.4,17.4,1.8,21.9-5.9l40-69.3
+ C226.3,339.5,223.7,329.7,216,325.3z"/>
+ <path d="M416.4,330.1l-69.3-40c-7.7-4.4-17.4-1.8-21.9,5.9c-4.4,7.7-1.8,17.4,5.9,21.9l69.3,40c7.7,4.4,17.4,1.8,21.9-5.9
+ C426.7,344.3,424.1,334.6,416.4,330.1z"/>
+ <path d="M95.6,181.9l69.3,40c7.7,4.4,17.4,1.8,21.9-5.9s1.8-17.4-5.9-21.9l-69.3-40c-7.7-4.4-17.4-1.8-21.9,5.9
+ C85.3,167.7,87.9,177.4,95.6,181.9z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/location.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/location.svg
new file mode 100644
index 00000000..60c274d2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/location.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,64c-65.9,0-119.3,53.7-119.3,120c0,114.6,119.3,264,119.3,264s119.3-149.4,119.3-264C375.3,117.7,321.9,64,256,64z
+ M256,242.2c-31.2,0-56.4-25.4-56.4-56.7c0-31.3,25.3-56.8,56.4-56.8c31.2,0,56.4,25.4,56.4,56.8
+ C312.4,216.8,287.2,242.2,256,242.2z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/lock-combination.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/lock-combination.svg
new file mode 100644
index 00000000..c06e0009
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/lock-combination.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M384,176.905V128C384,57.308,326.692,0,256,0S128,57.308,128,128v48.906C88.725,212.062,64,263.141,64,320
+ c0,106.039,85.962,192,192,192c106.039,0,192-85.961,192-192C448,263.141,423.275,212.062,384,176.905z M160,128
+ c0-52.935,43.065-96,96-96s96,43.065,96,96v25.692C323.759,137.355,290.973,128,256,128s-67.759,9.355-96,25.693V128z M256,480
+ c-88.366,0-160-71.634-160-160s71.634-160,160-160s160,71.634,160,160S344.366,480,256,480z"/>
+ <path d="M256,176c-79.529,0-144,64.472-144,144s64.471,144,144,144s144-64.472,144-144S335.529,176,256,176z M378.533,353.487
+ l-24.12-7.896l-3.926,12.19l24.161,7.912c-3.661,9.776-8.462,18.965-14.252,27.409l-10.56-7.737l-3.74,5.184l10.555,7.734
+ c-6.129,8.047-13.189,15.324-21.028,21.682l-14.982-20.787l-10.284,7.532l14.976,20.776c-8.479,5.556-17.657,10.12-27.398,13.532
+ l-3.96-12.294l-6.049,1.982l4.924,12.262C283.335,445.77,273,447.497,264,448v-12.659V429h-16v6.341V448
+ c-11-0.506-19.705-2.244-29.243-5.065l3.948-11.206l-6.25-2.106l-3.539,11.224c-9.557-3.393-18.531-7.895-26.864-13.359
+ l14.997-20.774l-10.27-7.534l-14.977,20.787c-7.809-6.333-14.841-13.575-20.953-21.583l9.556-6.998l-3.971-5.507l-9.562,7
+ c-5.718-8.381-10.469-17.497-14.093-27.186l24.162-7.914l-3.926-12.188l-24.121,7.897c-2.49-9.431-3.954-18.488-4.258-29.487H134
+ v-6.805l-5.993-0.002c0.223-10.606,0.672-20.88,3.266-30.682l24.921,7.9l4.347-12.188l-23.966-7.914
+ c3.585-9.57,8.36-18.583,13.985-26.879l10.339,7.533l3.759-5.184l-10.292-7.545c6.221-8.253,13.424-15.707,21.434-22.197
+ l14.984,20.787l10.284-7.536l-14.975-20.774c8.405-5.514,17.512-10.05,27.16-13.449l3.955,12.247l6.044-1.98l-4.62-12.231
+ C228.21,194.258,237,192.508,248,192v12.66V211h16v-6.34V192c9,0.498,19.159,2.198,28.585,4.951l-4.761,13.28l6.182,2.106
+ l4.174-13.312c9.696,3.408,18.778,7.957,27.208,13.491l-15.002,20.775l10.267,7.535l14.975-20.787
+ c7.935,6.432,15.069,13.812,21.255,21.977l-11.299,8.268l3.975,5.512l11.276-8.26c5.595,8.271,10.247,17.243,13.816,26.775
+ l-24.165,7.914l3.928,12.188l24.12-7.9c2.586,9.802,5.251,20.075,5.47,30.683L376,317.192V324h6.789
+ C382.486,334.999,381.02,344.057,378.533,353.487z"/>
+ <circle cx="256" cy="320" r="81"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/locked.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/locked.svg
new file mode 100644
index 00000000..4690abc8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/locked.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M86.4,480h339.2c12.3,0,22.4-9.9,22.4-22.1V246c0-12.2-10-22-22.4-22H404v-30.9c0-41.5-16.2-87.6-42.6-115.4
+ C335.1,49.9,297.4,32,256.1,32c-0.1,0-0.1,0-0.1,0c0,0-0.1,0-0.1,0c-41.3,0-79,17.9-105.3,45.6c-26.4,27.8-42.6,73.9-42.6,115.4V224
+ H89h-2.6C74,224,64,233.9,64,246v211.9C64,470.1,74,480,86.4,480z M161,193.1c0-27.3,9.9-61.1,28.1-80.3l0,0l0-0.3
+ C206.7,93.9,231,83,255.9,83h0.1h0.1c24.9,0,49.2,10.9,66.8,29.5l0,0.2l-0.1,0.1c18.3,19.2,28.1,53,28.1,80.3V224h-17.5h-155H161
+ V193.1z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/log-in.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/log-in.svg
new file mode 100644
index 00000000..580dfe25
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/log-in.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M255.988,32C160.473,32,78.934,91.804,46.727,176h34.639c9.396-20.484,22.457-39.35,38.868-55.762
+ C156.497,83.973,204.709,64,255.988,64c51.286,0,99.504,19.973,135.771,56.239C428.027,156.505,448,204.719,448,256
+ c0,51.285-19.973,99.501-56.239,135.765C355.494,428.029,307.275,448,255.988,448c-51.281,0-99.493-19.971-135.755-56.234
+ C103.821,375.354,90.76,356.486,81.362,336H46.725c32.206,84.201,113.746,144,209.264,144C379.703,480,480,379.715,480,256
+ C480,132.298,379.703,32,255.988,32z"/>
+ <polygon points="206.863,323.883 229.49,346.51 320,256 229.49,165.49 206.862,188.118 258.745,240 32,240 32,272 258.745,272 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/log-out.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/log-out.svg
new file mode 100644
index 00000000..e8a3d06a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/log-out.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="366.863,323.883 389.49,346.51 480,256 389.49,165.49 366.862,188.118 418.745,240 192,240 192,272 418.745,272
+ "/>
+ <g>
+ <path d="M391.491,391.766C355.229,428.029,307.018,448,255.736,448c-51.287,0-99.506-19.971-135.772-56.235
+ C83.697,355.501,64,307.285,64,256c0-51.281,19.697-99.495,55.965-135.761C156.232,83.973,204.45,64,255.736,64
+ c51.279,0,99.491,19.973,135.755,56.238c2.527,2.528,4.966,5.121,7.333,7.762h40.731c-40.474-58.028-107.709-96-183.819-96
+ C132.021,32,32,132.298,32,256c0,123.715,100.021,224,223.736,224c76.112,0,143.35-37.97,183.822-96h-40.73
+ C396.46,386.643,394.021,389.236,391.491,391.766z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/loop.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/loop.svg
new file mode 100644
index 00000000..72ccc5f0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/loop.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M273.4,300.5l-0.3,58c48.9-8.2,86.3-51,86.3-102.5c0-15.9-3.6-31-10-44.5c-2.8-5.8-6-11.3-9.8-16.5l47.1-43.5
+ c1.1,1.3,2.1,2.7,3.1,4c20.9,28,33.2,62.8,33.2,100.5c0,1.2,0,2.5,0,3.7c-1.5,71.5-47.6,132-111.4,154.6
+ c-12.3,4.3-25.2,7.3-38.5,8.7l-0.1,57l-76.2-67L170.6,390l44.4-38.7L273.4,300.5z"/>
+ <path d="M89,252.3c1.6-72.1,48.3-133,112.9-155.2c11.7-4,24-6.8,36.8-8.1l0.1-57l76.1,66.9l26.2,23.1l-44.3,38.6l-58.4,50.9
+ l0.2-57.9c-48.8,8.3-86,51.1-86,102.4c0,16,3.6,31.1,10.1,44.7c2.7,5.8,6,11.2,9.7,16.3l-47,43.6c-1.3-1.6-2.6-3.3-3.8-5
+ C101.1,327.7,89,293.3,89,256C89,254.8,89,253.5,89,252.3z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/magnet.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/magnet.svg
new file mode 100644
index 00000000..3696d318
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/magnet.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,32C141,32.5,64,109.6,64,231.8c0,48.8,2.1,76.8,14.5,127.8c15.9,65.7,39.1,113.3,39.1,113.3l0.6,1.3
+ c1.9,3.4,5.5,5.8,9.8,5.8c1.4,0,2.7-0.2,4-0.7l1.7-0.8l50.3-20.7l1.8-0.8c3.3-1.9,5.5-5.3,5.5-9.3c-0.2-1.4-0.4-2.8-1-4
+ c-0.1-0.1-0.1-0.2-0.2-0.4c-7-16-27.2-59.2-37-101.1c-9.9-41.9-13.5-62.4-13.5-107.7C139.6,163.4,192,112,256,112
+ c64,0,116.4,51.4,116.4,122.5c0,45.3-3.7,65.8-13.6,107.7c-9.9,41.9-30,85.2-37,101.1c-0.1,0.2-0.1,0.3-0.2,0.4
+ c-0.6,1.2-0.8,2.6-1,4c0,4,2.2,7.4,5.5,9.3l1.8,0.8l50.3,20.7l1.7,0.8c1.3,0.5,2.6,0.7,4,0.7c4.3,0,7.9-2.4,9.8-5.8l0.6-1.3
+ c0,0,23.2-47.6,39.1-113.3c12.4-51,14.5-79,14.5-127.8C448,109.6,371,32.5,256,32z M173,444.2c0.1,0.2,0.2,0.5,0.3,0.7l-42.8,17.6
+ c-5.4-11.8-22.7-51-35.7-104.4l42.5-12.3C146.5,385,164.4,425,173,444.2z M381.4,462.5l-42.8-17.6c0.1-0.2,0.2-0.4,0.3-0.7
+ c8.6-19.2,26.4-59.2,35.6-98.4l42.5,12.3C404.1,411.5,386.8,450.7,381.4,462.5z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/male.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/male.svg
new file mode 100644
index 00000000..941be49e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/male.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M480,192V32H320l63,63l-68.7,68.7C284.8,141.3,247.9,128,208,128c-97.2,0-176,78.8-176,176s78.8,176,176,176
+ s176-78.8,176-176c0-39.9-13.3-76.8-35.7-106.3L417,129L480,192z M298.5,394.5C274.3,418.7,242.2,432,208,432s-66.3-13.3-90.5-37.5
+ C93.3,370.3,80,338.2,80,304s13.3-66.3,37.5-90.5c24.2-24.2,56.3-37.5,90.5-37.5s66.3,13.3,90.5,37.5S336,269.8,336,304
+ S322.7,370.3,298.5,394.5z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/man.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/man.svg
new file mode 100644
index 00000000..b4a02cf7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/man.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,106.6c20.6,0.1,37.3-16.6,37.3-37.3c0-20.6-16.7-37.3-37.3-37.3c-20.6,0-37.3,16.7-37.3,37.3
+ C218.7,89.9,235.4,106.6,256,106.6z"/>
+<g>
+ <path d="M293.4,115H256h-37.4c-28.2,0-46.6,24.8-46.6,48.4V277c0,22,31,22,31,0V172h6v285.6c0,30.4,42,29.4,43,0V293h7h1v164.7
+ c1.7,31.2,43,28.2,43-0.1V172h5v105c0,22,32,22,32,0V163.4C340,139.9,321.5,115,293.4,115z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/map.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/map.svg
new file mode 100644
index 00000000..40f3363a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/map.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M473.152,136.58L368.594,66.307c-4.644-3.076-10.365-3.076-15.031,0l-97.094,65.195l-97.109-65.195
+ c-4.643-3.076-10.444-3.076-15.062,0L39.344,136.58c-4.399,2.949-7.344,8.272-7.344,14.05V431.6c0,5.904,3.07,11.347,7.663,14.271
+ c4.62,2.877,10.382,2.829,14.904-0.223l97.188-65.197l97.181,65.197c4.666,3.1,10.44,3.1,15.084,0l97.158-65.197l97.151,65.197
+ c2.311,1.55,4.912,2.353,7.538,2.353c2.455,0,4.709-0.747,6.969-2.13c4.594-2.924,7.165-8.366,7.165-14.271v-280.97
+ C480,144.852,477.575,139.529,473.152,136.58z M135,353.248l-71,49.404v-241.75l71-49.428V353.248z M167,352.766v-122.7
+ c1.167,0.756,2.31,1.526,3.389,2.301l9.333-12.996c-3.904-2.804-8.292-5.501-12.722-7.705V110.992l73,48.992v108.574
+ c-5.372-1.855-10.586-4.37-15.893-7.682l-8.471,13.574c6.848,4.273,13.621,7.467,20.704,9.765l3.66-11.286v128.806L167,352.766z
+ M272,401.734V288.369c0.349-0.021,0.693-0.03,1.043-0.054c2.91-0.198,5.777-0.517,8.518-0.946l-2.479-15.807
+ c-2.268,0.355-4.65,0.619-7.082,0.786V159.984l73-48.992V229.78l-4.844-4.372c-2.997,3.319-5.833,6.575-8.575,9.725
+ c-1.806,2.073-3.578,4.108-5.339,6.095l11.974,10.613c1.791-2.021,3.595-4.091,5.431-6.2c0.443-0.509,0.905-1.035,1.354-1.549
+ v108.675L272,401.734z M448,401.652l-71-48.438v-136.91c3.785-1.715,7.679-2.992,11.639-3.792l-3.166-15.683
+ c-2.858,0.577-5.687,1.339-8.473,2.281v-87.671l71,48.461V401.652z"/>
+ <path d="M129.285,221.111c2.218-1.195-1.353-1.071,1.012-1.837l-4.928-15.222c-3.282,1.062-6.502,2.439-9.571,4.093
+ c-3.824,2.062-7.745,4.916-11.339,8.253l10.888,11.724C117.963,225.694,126.639,222.538,129.285,221.111z"/>
+ <path d="M296.802,266.127l6.985,14.395c6.596-3.201,12.842-7.445,19.095-12.974l-10.599-11.987
+ C307.135,260.113,302.071,263.569,296.802,266.127z"/>
+ <path d="M99.364,256.006c1.893-5.926,3.528-11.044,7.129-16.304l-13.204-9.037c-4.924,7.194-7.081,13.944-9.167,20.471
+ l-0.242,0.758l15.238,4.879L99.364,256.006z"/>
+ <path d="M198.311,237.753c-1.007-1.204-2.014-2.408-3.032-3.603l-12.178,10.379c0.986,1.156,1.961,2.322,2.936,3.488
+ c3.593,4.296,7.308,8.739,11.61,12.809l10.996-11.624C205.02,245.775,201.761,241.878,198.311,237.753z"/>
+ <polygon points="408.156,229.657 418.5,219.314 428.844,229.657 440.156,218.342 429.814,208 440.156,197.657 428.844,186.342
+ 418.5,196.685 408.156,186.342 396.844,197.657 407.186,208 396.844,218.342 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/medkit.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/medkit.svg
new file mode 100644
index 00000000..1e827a75
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/medkit.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M472.2,144H352v-30.7C351,85.1,330.3,64,300.8,64H256h-44.8c-29.4,0-50.2,21.1-51.2,49.3V144H39.8c-4.4,0-7.8,3.6-7.8,8
+ v288c0,4.4,3.3,8,7.8,8h432.5c4.4,0,7.8-3.6,7.8-8V152C480,147.6,476.7,144,472.2,144z M192,117.2c0-0.4,0-0.7,0-1s0-0.6,0-1
+ c0-9.7,8.6-19.3,18.8-19.3H256h45.2c10.1,0,18.8,9.5,18.8,19.3c0,0.3,0,0.6,0,1s0,0.6,0,1V144H192V117.2z M352,320h-64v64h-64v-64
+ h-64v-64h64v-64h64v64h64V320z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/merge.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/merge.svg
new file mode 100644
index 00000000..d055d31b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/merge.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M384,224c-23.637,0-44.307,12.89-55.391,32H319c-42.464,0-79.99-17.904-111.535-53.214
+ c-20.356-22.787-33.493-48.869-37.856-58.218C183.301,132.822,192,115.413,192,96c0-35.29-28.71-64-64-64S64,60.71,64,96
+ c0,23.637,12.89,44.307,32,55.391v209.219C76.89,371.693,64,392.363,64,416c0,35.29,28.71,64,64,64s64-28.71,64-64
+ c0-23.637-12.89-44.307-32-55.391V245.692C203.553,294.307,258.468,320,319,320h9.609c11.084,19.11,31.754,32,55.391,32
+ c35.29,0,64-28.71,64-64S419.29,224,384,224z M128,64c17.673,0,32,14.327,32,32s-14.327,32-32,32s-32-14.327-32-32
+ S110.327,64,128,64z M128,448c-17.673,0-32-14.327-32-32s14.327-32,32-32s32,14.327,32,32S145.673,448,128,448z M384,320
+ c-17.673,0-32-14.327-32-32s14.327-32,32-32s32,14.327,32,32S401.673,320,384,320z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-a.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-a.svg
new file mode 100644
index 00000000..32dbe94d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-a.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M112.1,238.1l-0.1,13.6c0.1,65.6,46,120.6,108.1,136.2c1.3,0.1,2.6,0.5,3.8,0.9c5.9,2,10.1,6.9,12.1,12.8v58.7
+ c0,10.9,8.9,19.7,20,19.7h0.1c11.1,0,19.9-8.8,19.9-19.7v-58.8c2-5.9,6.1-10.7,12-12.7c1.2-0.4,2.5-0.8,3.9-0.9
+ C354,372.3,400,317.3,400,251.7v-13.6c0-10.4-8.9-18.9-19.5-18.9c-10.6,0-19.5,8.4-19.5,18.9v13.6c0,28.5-11.5,54.1-30.6,72.8
+ c-19.2,18.6-45.3,30.2-74.5,30.2c-29.2,0-55.1-11.5-74.2-30.2c-19.1-18.7-30.7-44.4-30.7-72.8v-13.6c0-10.4-8.8-18.9-19.5-18.9
+ C120.9,219.2,112.1,227.7,112.1,238.1z"/>
+ <path d="M179,107.7v143.8c0,41.8,34.7,75.7,77.5,75.7c42.8,0,77.5-33.9,77.5-75.7V107.7c0-41.8-34.7-75.7-77.5-75.7
+ C213.7,32,179,65.9,179,107.7z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-b.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-b.svg
new file mode 100644
index 00000000..c4a9e812
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-b.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256.4,32c-35.1,0.1-65.8,23.2-76.8,59.3c-5.6,18.5-3.5,44.8-1.2,54.5c2.3,9.7,7.3,19.9,13.2,28.3
+ c2.8,4.2,6.7,7.4,11.2,9.2c0.6,0.3,1.3,0.5,2,0.8c3.3,1.1,6.5,2.2,10.1,3.1c11.8,3,27.1,4.7,41.1,4.8v0c0,0,0.6,0,0.7,0
+ c0.3,0,0.3,0,1.3,0v-0.1c14-0.1,27.3-1.7,39.1-4.8c3.6-0.9,6.9-2,10.2-3.1c0.7-0.2,1.3-0.5,1.9-0.8c4.5-1.8,8.4-5,11.2-9.2
+ c5.9-8.4,10.8-18.6,13.2-28.3c2.3-9.7,4.4-36-1.2-54.5C321.4,55.2,291.6,32.1,256.4,32z"/>
+ <path d="M295.3,201.1c-0.4,0-0.7,0-1.1,0.1c-0.6,0.1-1.3,0.3-1.9,0.4c-2,0.4-4.1,0.8-6.1,1.2c-9.2,1.5-18.9,2.3-29,2.4
+ c-10.1-0.1-22.3-0.9-31-2.4c-2.1-0.4-4.2-0.8-6.2-1.2c-0.6-0.1-1.3-0.3-1.9-0.4c-0.4-0.1-0.8-0.1-1.1-0.1c-6.1,0-11,5.3-11.2,11.9
+ c0.1,0.8,0.2,1.6,0.2,2.4c4.8,67.2,16.8,240.7,18.2,252c0,0,2.8,12.7,32.1,12.6c0,0,0,0,0,0c29.2,0.1,32.1-12.6,32.1-12.6
+ c1.4-11.3,13.4-184.8,18.2-252c0-0.8,0.1-1.6,0.2-2.4C306.3,206.4,301.4,201.1,295.3,201.1z M266,281.7c0,6-4.5,10.9-10,10.9
+ c-5.5,0-10-4.9-10-10.9V249c0-6,4.5-10.9,10-10.9c5.5,0,10,4.9,10,10.9V281.7z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-c.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-c.svg
new file mode 100644
index 00000000..42f1b046
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-c.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M329.2,32H182.9C152.5,32,128,55.4,128,84.4V112h152v37H128v43h152v37H128v43h152v37H128v41.8c0,29,24.5,52.2,54.9,52.2H213
+ v77h86v-77h30.2c30.3,0,54.8-23.2,54.8-52.2V309h-59v-37h59v-43h-59v-37h59v-43h-59v-37h59V84.4C384,55.4,359.5,32,329.2,32z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus-circled.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus-circled.svg
new file mode 100644
index 00000000..ccfc53fc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus-circled.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,32C132.3,32,32,132.3,32,256s100.3,224,224,224s224-100.3,224-224S379.7,32,256,32z M384,272H128v-32h256V272z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus-round.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus-round.svg
new file mode 100644
index 00000000..3364cd29
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus-round.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M417.4,224H94.6C77.7,224,64,238.3,64,256c0,17.7,13.7,32,30.6,32h322.8c16.9,0,30.6-14.3,30.6-32
+ C448,238.3,434.3,224,417.4,224z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus.svg
new file mode 100644
index 00000000..0ef5565b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<rect x="64" y="224" width="384" height="64"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/model-s.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/model-s.svg
new file mode 100644
index 00000000..085b1347
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/model-s.svg
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M508.8,390.9c-0.6,4.1-1.6,8.1-3.1,11.2c-2.7,5.5-5.3,6-15.5,5.5c-13.2-0.6-32.1,0-52.1,0.8c0,5.5,0.2,8.1,0.2,8.1
+ c1.3,15.1,8.1,15.6,10.8,15.6c3,0,39.2,0,43,0s7.3,0,10-1.8c3.5-2.3,5-9,6.3-20.7c0.2-1.7,0.3-3.9,0.4-6.5c0,0,0-0.1,0-0.1
+ c0-0.8,0.1-1.8,0.1-2.9c0-0.4,0-0.8,0-1.1c0,0,0,0,0,0C508.9,396.3,508.9,393.3,508.8,390.9z"/>
+ <path d="M3,390.9c0.6,4.1,1.6,8.1,3.1,11.2c2.7,5.5,5.3,6,15.5,5.5c13.2-0.6,32.1,0,52.1,0.8c0,5.5-0.2,8.1-0.2,8.1
+ c-1.3,15.1-8.1,15.6-10.8,15.6c-3,0-39.2,0-43,0s-7,0-10-1.8c-3.6-2.1-5-9-6.3-20.7c-0.2-1.7-0.3-3.9-0.4-6.5c0,0,0-0.1,0-0.1
+ c0-0.8-0.1-1.8-0.1-2.9c0-0.4,0-0.8,0-1.1c0,0,0,0,0,0C3,396.3,3,393.3,3,390.9z"/>
+ <path d="M512,296.6c0-30.7-4-60.7-5.6-64c-1.2-2.4-8.9-8.7-26.4-20.6c-17.7-12.1-17.3-10.3-20.5-18.2c2.9-0.9,5.7-2.6,7.4-2.8
+ c3.8-0.4,4,3.2,11.9,3.2s25-2.1,28.5-5.6c3.5-3.5,4.6-4.7,4.6-7.8s-1.8-9.5-5.2-13.3s-17.9-5.7-26.4-6.8s-9.7,0-11.9,1.4
+ c-3.5,2.2-3.7,22.3-3.7,22.3l-8.3,0.2c-5.4-13.3-12.9-40.1-24.6-61.2c-12.8-23-26.2-30.2-31.8-32c-5.5-1.7-10.5-2.9-48-6.7
+ c-38.3-4-68.8-4.5-96-4.5s-57.7,0.6-96,4.5c-37.5,3.9-42.5,5-48,6.7c-5.5,1.7-19,9-31.8,32c-11.7,21.1-19.2,47.9-24.6,61.2
+ l-8.3-0.2c0,0-0.1-20.1-3.7-22.3c-2.2-1.4-3.4-2.6-11.9-1.4s-23,3-26.4,6.8s-5.2,10.2-5.2,13.3s1.1,4.4,4.6,7.8
+ c3.5,3.5,20.6,5.6,28.5,5.6s8.1-3.6,11.9-3.2c1.7,0.2,4.6,1.9,7.4,2.8c-3.3,7.9-2.8,6.1-20.5,18.2c-17.5,12-25.3,18.2-26.4,20.6
+ C4,235.9,0,265.9,0,296.6s2.2,58.3,2.2,68.1c0,4.1,0,11.3,0.9,18.2c0.6,4.1,1.5,8.1,3.1,11.2c2.7,5.5,5.2,6,15.5,5.5
+ c13.2-0.6,32.3,0,52,0.8c13.2,0.5,26.7,1,38.7,1.3c30,0.6,21.2-4.4,34-4.2c12.8,0.2,63.3,2.3,109.5,2.3s96.8-2.1,109.5-2.3
+ c12.8-0.2,4,4.8,34,4.2c12-0.2,25.5-0.8,38.7-1.3c19.7-0.7,38.9-1.4,52-0.8c10.3,0.5,12.8,0,15.5-5.5c1.5-3.1,2.5-7.1,3.1-11.2
+ c1-6.9,0.9-14.1,0.9-18.2C509.8,355,512,327.3,512,296.6z M86.2,145.2c4.8-11.2,19.2-33.7,26.2-37.7c1.7-1,16.6-5.7,53.9-8.2
+ c34.3-2.3,72.2-3.2,89.8-3.2s55.5,0.9,89.8,3.2c37.2,2.5,52.3,7.1,53.9,8.2c9,6.2,21.4,26.5,26.2,37.7c4.8,11.2,11.2,33.2,10,36.2
+ c-1.2,3,1.2,4.5-15,3.2c-16.1-1.2-117.2-2.5-164.8-2.5c-47.5,0-148.6,1.3-164.8,2.5c-16.2,1.2-13.8-0.2-15-3.2
+ C75,178.4,81.4,156.5,86.2,145.2z M123,270.4c-7.2,1.8-11.5,5.7-20.5,5.6c-9,0-33.3-4.1-38.5-4.3c-5.2-0.2-9.8,3.5-12.5,4.2
+ s-8-1.2-16-3.7s-12.7-1.8-15.3-12.7c-2.7-10.8,0-26.3,0-26.3c17.3-0.8,34,0.8,65.3,9.6c31.3,8.8,48.7,25.7,48.7,25.7
+ S130.2,268.6,123,270.4z M358.2,349.2c-14.3,1.9-74.2,2.4-102.2,2.4c-28,0-87.9-0.6-102.2-2.4c-14.6-1.9-33.6-19.4-20.5-33.3
+ c17.7-18.9,14.4-18.3,54.6-23.5c34.8-4.5,61.2-4.7,68.1-4.7c6.8,0,33.3,0.3,68.1,4.7c40.2,5.2,36.9,4.6,54.6,23.5
+ C391.8,329.8,372.8,347.3,358.2,349.2z M491.8,259.6c-2.7,10.8-7.3,10.2-15.3,12.7s-13.3,4.3-16,3.7s-7.3-4.3-12.5-4.2
+ c-5.2,0.2-29.5,4.3-38.5,4.3c-9,0-13.3-3.8-20.5-5.6c-7.2-1.8-11.2-1.8-11.2-1.8s17.3-17,48.7-25.7c31.3-8.8,48-10.4,65.3-9.6
+ C491.8,233.2,494.5,248.7,491.8,259.6z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/monitor.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/monitor.svg
new file mode 100644
index 00000000..acd51f7f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/monitor.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M468.7,64H43.3c-6,0-11.3,5-11.3,11.1v265.7c0,6.2,5.2,11.1,11.3,11.1h425.4c6,0,11.3-5,11.3-11.1V75.1
+ C480,69,474.8,64,468.7,64z M448,320H64V96h384V320z"/>
+ <path d="M302.5,448c28-0.5,41.5-3.9,29-12.5c-12.5-8.7-28.5-15.3-29-22.5c-0.3-3.7-1.7-45-1.7-45H256h-44.8c0,0-1.5,41.3-1.7,45
+ c-0.5,7.1-16.5,13.8-29,22.5c-12.5,8.7,1,12,29,12.5H302.5z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/more.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/more.svg
new file mode 100644
index 00000000..55294f5d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/more.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M113.7,304C86.2,304,64,282.6,64,256c0-26.5,22.2-48,49.7-48c27.6,0,49.8,21.5,49.8,48C163.5,282.6,141.3,304,113.7,304z"
+ />
+ <path d="M256,304c-27.5,0-49.8-21.4-49.8-48c0-26.5,22.3-48,49.8-48c27.5,0,49.7,21.5,49.7,48C305.7,282.6,283.5,304,256,304z"/>
+ <path d="M398.2,304c-27.5,0-49.8-21.4-49.8-48c0-26.5,22.2-48,49.8-48c27.5,0,49.8,21.5,49.8,48C448,282.6,425.8,304,398.2,304z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mouse.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mouse.svg
new file mode 100644
index 00000000..31585834
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mouse.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,32c-0.46,0-0.917,0.011-1.376,0.015l5.747,0.057C258.92,32.029,257.464,32,256,32z"/>
+ <path d="M378.553,193.211c-0.195,0.064-0.414,0.16-0.619,0.269c-34.234,13.289-76.337,22.52-121.886,22.475
+ c-45.52-0.076-87.626-9.398-121.81-22.772c-0.19-0.104-0.429-0.192-0.647-0.265c-1.531-0.554-3.146-0.897-4.841-0.917
+ c-0.254-0.001-0.5-0.013-0.75,0v176.012C128,429.892,185.308,480,256,480c21.992,0,42.687-4.803,60.766-13.355
+ c0.095-0.045,0.191-0.087,0.286-0.133c0.026-0.013,0.054-0.026,0.08-0.039c4.87-2.344,9.581-4.963,14.122-7.828
+ C363.219,438.275,384,405.271,384,368.012V192c-0.191-0.008-0.496,0-0.689,0C381.584,192.014,380.092,192.651,378.553,193.211z
+ M317.132,466.424c-0.026,0.013-0.054,0.026-0.08,0.039c-0.095,0.045-0.191,0.088-0.286,0.133c0.095-0.045,0.191-0.088,0.286-0.133
+ C317.078,466.45,317.105,466.437,317.132,466.424c4.87-2.342,9.581-4.961,14.122-7.825
+ C326.758,461.463,322.044,464.083,317.132,466.424z"/>
+ <path d="M331.254,458.599c-4.541,2.864-9.252,5.483-14.122,7.825C322.044,464.083,326.758,461.463,331.254,458.599z"/>
+ <path d="M260.371,32.072l-5.747-0.057C184.566,32.662,128,82.547,128,144v22.708c2.158,2.024,4.593,3.755,7.251,5.115
+ c0.673,0.337,1.386,0.659,2.059,0.996c0.032,0.027,0.077,0.01,0.109,0.036c22.757,10.35,51.429,15.801,83.415,19.006
+ c0.694,0.078,1.397,0.107,2.148,0.12C234.24,191.997,239.996,192,240,181.411V96c0-8.836,7.164-16,16-16c8.836,0,16,7.164,16,16
+ v86.328c-0.088,9.672,5.926,9.72,17.2,9.749c0.717-0.016,1.415-0.045,2.081-0.105c0.062-0.003,0.141,0.005,0.244-0.02
+ c31.682-3.119,60.143-8.405,82.808-18.59c1.162-0.545,2.291-1.056,3.407-1.581c2.271-1.232,4.365-2.743,6.26-4.466V144
+ C384,83.425,329.039,34.09,260.371,32.072z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/music-note.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/music-note.svg
new file mode 100644
index 00000000..51a07b97
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/music-note.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M426,32.1c-2.2,0-5.1,0.6-5.1,0.6L203.3,65.9C189.5,69.6,177,83,176,97.5V384h-61v-0.1c-28,0-51.1,20-51.1,48
+ s23.1,48,51.3,48h36.2c15.3,0,28.9-6.9,38.3-17.5c0.1-0.1,0.3-0.1,0.4-0.2c0.6-0.6,1-1.5,1.5-2.1c1.3-1.6,2.4-3.2,3.4-5
+ C204.6,441,208,422.3,208,414V182l208-38c0,0,0,136,0,192h-60.5c-28.3,0-51.2,19.9-51.2,48s22.9,48,51.2,48h37.2
+ c18.2,0,34.1-6,43.2-21c0,0,0.1,0,0.2,0c9-12,12-30.2,12-54.9c0-24.8,0-302.8,0-302.8C448,41.6,438.1,32.1,426,32.1z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navicon-round.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navicon-round.svg
new file mode 100644
index 00000000..f3adc265
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navicon-round.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M417.4,224H94.6C77.7,224,64,238.3,64,256c0,17.7,13.7,32,30.6,32h322.8c16.9,0,30.6-14.3,30.6-32
+ C448,238.3,434.3,224,417.4,224z"/>
+ <path d="M417.4,96H94.6C77.7,96,64,110.3,64,128c0,17.7,13.7,32,30.6,32h322.8c16.9,0,30.6-14.3,30.6-32
+ C448,110.3,434.3,96,417.4,96z"/>
+ <path d="M417.4,352H94.6C77.7,352,64,366.3,64,384c0,17.7,13.7,32,30.6,32h322.8c16.9,0,30.6-14.3,30.6-32
+ C448,366.3,434.3,352,417.4,352z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navicon.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navicon.svg
new file mode 100644
index 00000000..7323a62d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navicon.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <rect x="96" y="241" width="320" height="32"/>
+ <rect x="96" y="145" width="320" height="32"/>
+ <rect x="96" y="337" width="320" height="32"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navigate.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navigate.svg
new file mode 100644
index 00000000..ad3338f1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navigate.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="480,32 32,224 288,224 288,480 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/network.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/network.svg
new file mode 100644
index 00000000..c00db46e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/network.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M448,96c0-35.29-28.71-64-64-64s-64,28.71-64,64c0,23.637,12.89,44.307,32,55.391v52.832l-96,48l-96-48v-52.832
+ c19.11-11.084,32-31.754,32-55.391c0-35.29-28.71-64-64-64S64,60.71,64,96c0,23.637,12.89,44.307,32,55.391v92.387l128,64v52.832
+ c-19.11,11.084-32,31.754-32,55.391c0,35.29,28.71,64,64,64s64-28.71,64-64c0-23.637-12.89-44.307-32-55.391v-52.832l128-64v-92.387
+ C435.11,140.307,448,119.637,448,96z M128,64c17.673,0,32,14.327,32,32s-14.327,32-32,32s-32-14.327-32-32S110.327,64,128,64z
+ M256,448c-17.673,0-32-14.327-32-32s14.327-32,32-32s32,14.327,32,32S273.673,448,256,448z M384,128c-17.673,0-32-14.327-32-32
+ s14.327-32,32-32s32,14.327,32,32S401.673,128,384,128z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/no-smoking.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/no-smoking.svg
new file mode 100644
index 00000000..3cd5697e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/no-smoking.svg
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <rect x="360" y="256" class="st0" width="16" height="48"/>
+ <polygon class="st0" points="112,304 249.6,304 201.6,256 112,256 "/>
+ <path class="st0" d="M364.5,60.1c-0.4-0.2-0.7-0.4-1-0.6c-10.9-6-22.5-10.7-34.4-14.8c-1.8-0.6-3.6-1.2-5.4-1.8
+ C302.3,36.1,279.6,32,256,32C132.3,32,32,132.3,32,256c0,84.3,46.6,157.6,115.4,195.8c0.4,0.2,0.7,0.5,1.1,0.7
+ c10.9,6,22.5,10.7,34.4,14.8c1.8,0.6,3.6,1.2,5.4,1.8c21.4,6.8,44,10.9,67.7,10.9c123.7,0,224-100.3,224-224
+ C480,171.7,433.4,98.3,364.5,60.1z M256,426.4c-9.3,0-18.4-0.9-27.2-2.4c-9.8-1.6-19.3-4.1-28.5-7.3c-1.9-0.6-3.8-1.2-5.6-1.9
+ c-6.5-2.5-12.9-5.3-19-8.6c-53.6-28.7-90.1-85.2-90.1-150.3c0-37.2,12.4-71.4,32.7-99.4l237.2,237.2
+ C327.4,414,293.2,426.4,256,426.4z M393.8,355.4L156.6,118.2c28-20.2,62.1-32.6,99.4-32.6c9.3,0,18.3,0.9,27.2,2.4
+ c9.8,1.6,19.3,4.1,28.5,7.3c1.8,0.6,3.7,1.2,5.6,1.9c6.2,2.4,12.2,5,18,8.1c54.2,28.5,91.2,85.3,91.2,150.8
+ C426.4,293.3,414,327.4,393.8,355.4z"/>
+ <polygon class="st0" points="352,298 352,256 310,256 "/>
+ <rect x="384" y="256" class="st0" width="16" height="48"/>
+ <path class="st0" d="M360.1,212.7c-8.8-4.1-22-5.7-45.6-5.7c-1.2,0-2.4,0-3.6,0c-12.7,0.1-15.9-0.1-20-6.1
+ c-2.8-4.2-1-14.8,3.7-21.9c1.6-2.4,1.8-5.6,0.4-8.2c-1.4-2.6-4.1-4.2-7-4.3c-0.1,0-9.4-0.1-18.3-3.9c-10.6-4.5-15.6-12.1-15.6-23.1
+ c0-25.8,21.8-27.7,22.8-27.7v-16c-12,0-38.8,11-38.8,43.7c0,17.5,9,31,25.7,38c4.2,1.7,8.4,2.9,12,3.6c-3.3,9.8-3.6,20.9,1.7,28.7
+ c9,13.3,20.3,13.2,33.3,13.1c1.1,0,2.3,0,3.5,0c26.3,0,34.6,2.3,38.9,4.3c5.7,2.6,6.8,11.5,6.6,19.7c0,0.7,0,0.4,0,1h16
+ c0-0.4,0-0.4,0-1C375.8,239.8,376.1,220.1,360.1,212.7z"/>
+ <path class="st0" d="M400,248c0-25.7-3-43.2-9.1-53.6C382.3,180,368.5,172,352,172h-17.4c2.9-8.3,5.4-19.8,3.5-30.9
+ c-3.2-18.8-19.1-30-43.1-30v16c21,0,26.1,9.1,27.4,16.7c2.5,14.5-6.8,32.1-6.9,32.3c-1.4,2.5-1.3,5.5,0.1,7.9
+ c1.4,2.4,4.1,3.9,6.9,3.9H352c10.9,0,19.4,4.9,25.1,14.6c3.1,5.3,6.9,17.5,6.9,45.4H400z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/nuclear.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/nuclear.svg
new file mode 100644
index 00000000..ef31f138
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/nuclear.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <circle cx="256" cy="272" r="48"/>
+ <circle cx="256" cy="272" r="48"/>
+ </g>
+ <g>
+ <path d="M480,272H320c0,23.9-13.1,44.7-32.6,55.7L365.6,464C433.1,425.4,480,355.3,480,272z"/>
+ <path d="M256,208c11.7,0,22.7,3.2,32.1,8.7l80.6-138.3C335.6,59.1,297.1,48,256,48c-41.2,0-79.9,11.2-113.1,30.6l79.8,138.8
+ C232.4,211.4,243.8,208,256,208z"/>
+ <path d="M192,272H32c0,83.3,46.9,153.4,114.4,192l78.2-136.3C205.1,316.7,192,295.9,192,272z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/outlet.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/outlet.svg
new file mode 100644
index 00000000..990f64d5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/outlet.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M369.541,32H142.359C81.521,32,32,82.574,32,144.604v222.79C32,429.426,81.521,480,142.359,480h227.182
+ C430.479,480,480,429.426,480,367.395v-222.79C480,82.574,430.479,32,369.541,32z M175,250.954v0.67
+ c0,10.882-9.09,20.376-19.875,20.376h-23.27C121.073,272,112,262.506,112,251.624v-0.67V149.512v-1.351
+ c1-10.768,9.193-20.161,19.855-20.161h23.27c10.886,0,19.875,9.847,19.875,20.831V250.954z M297,395.74v2.68
+ c0,11.439-8.872,17.58-20.1,17.58H256h-20.898C223.872,416,215,407.859,215,396.42v-0.68v-28.637
+ c0-23.33,18.118-42.287,40.999-42.287c22.883,0,41.001,18.957,41.001,42.287V395.74z M400,250.954v0.67
+ c0,10.882-9.071,20.376-19.855,20.376h-24.27C345.093,272,336,262.506,336,251.624v-0.67V149.512v-1.351
+ c1-10.768,9.215-20.161,19.875-20.161h24.27c10.784,0,19.855,9.847,19.855,20.831V250.954z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paintbrush.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paintbrush.svg
new file mode 100644
index 00000000..597f84ae
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paintbrush.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M149.515,283.349c-51.921,0-83.939,45.661-83.939,95.085c0,22.691-10.071,39.153-33.575,48.104
+ c17.907,34.678,87.777,41.157,117.515,35.797c35.642-6.426,80.077-24.873,90.654-76.969
+ C252.48,324.739,201.434,283.349,149.515,283.349z"/>
+ <path d="M467.638,60.356c-12.955-12.948-29.964-17.292-44.92-5.35L247.598,209.1c-8.648-2.371-16.525-1.869-22.909,2.346
+ L165.896,260.4c-1.611,1.611-1.545,4.304,0.066,5.914c0.499,0.501,1.064,0.79,1.697,0.98c0.642,0.034,1.264,0.059,1.899,0.103
+ c0.019-0.002,0.036-0.01,0.054-0.014c47.938,3.432,91.034,36.754,89.3,89.506c-0.016,0.505-0.029,1.007-0.054,1.516
+ c0.123,0.848,0.5,1.664,1.149,2.315c1.595,1.593,4.168,1.605,5.781,0.044c0.018-0.018,0.037-0.027,0.055-0.044
+ c0.063-0.063,0.106-0.137,0.164-0.2l50.457-57.342c4.216-6.374,4.72-14.24,2.355-22.875l154.169-175.047
+ C484.939,90.308,480.592,73.308,467.638,60.356z"/>
+ <polygon points="165.887,260.409 165.896,260.4 165.888,260.407 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paintbucket.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paintbucket.svg
new file mode 100644
index 00000000..046eea6f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paintbucket.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M128,64l39.667,72.102L16,288l197.604,192l163.328-160l58.33-12.307L160,32L128,64z M325.131,288H104.857L215,177.863
+ L325.131,288z"/>
+ <path d="M435.262,307.693c0,0-60.734,66.179-60.732,99.207c0,33.028,27.192,59.803,60.731,59.801
+ c33.548,0.002,60.74-26.772,60.739-59.801C496.001,373.872,435.262,307.693,435.262,307.693z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paper-airplane.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paper-airplane.svg
new file mode 100644
index 00000000..47c1973f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paper-airplane.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<path class="st0" d="M32,272l128,48l16,160l80-112l112,112L480,32L32,272z M350.7,417.4L256,320l128-176L192,297.8l-82.6-31
+ l322-172.5L350.7,417.4z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paperclip.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paperclip.svg
new file mode 100644
index 00000000..ee1bd36f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paperclip.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M324.6,154.9c-6.3-0.1-11.4,5.1-11.4,11.6L313,361.3c-0.1,43.8-29.7,63.4-57.2,63.2c-27.5-0.3-57.1-20.4-57-64.1
+ c0-33.5,0.2-167.7,0.3-234.8c0-15.4,6-27.4,16.8-33.7c10.6-6.2,24.4-6.1,35,0.3c10.8,6.5,16.7,18.6,16.7,34l-0.3,224.5
+ c0,7.3-1.7,13.3-4.7,17.1c-1.9,2.4-4.4,3.8-6.9,3.8c-5.6-0.1-11.4-7.3-11.3-20.8c0,0,0.2-166.3,0.3-172.7c0-6.5-5.1-11.8-11.4-11.8
+ c-6.3,0-11.4,5.2-11.4,11.7l-0.3,172.7c0,29,17.2,44.3,34.2,44.5c9.4,0.1,18.3-4.4,24.6-12.4c6.3-8,9.7-19,9.7-31.8l0.3-224.5
+ c0-23.8-10.2-43.6-28.1-54.3c-17.5-10.6-40.3-10.8-57.9-0.5c-17.9,10.5-28.2,30.1-28.3,53.9c-0.1,67-0.2,201.2-0.3,234.8
+ c-0.1,57.2,40.1,87.4,79.8,87.8c20.5,0.2,41.1-7.7,56.3-23.1c14.2-14.5,23.7-35.7,23.7-63.4l0.1-194.9
+ C336,160.2,330.9,154.9,324.6,154.9z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pause.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pause.svg
new file mode 100644
index 00000000..dd8b47dd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pause.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M224,435.8V76.1c0-6.7-5.4-12.1-12.2-12.1h-71.6c-6.8,0-12.2,5.4-12.2,12.1v359.7c0,6.7,5.4,12.2,12.2,12.2h71.6
+ C218.6,448,224,442.6,224,435.8z"/>
+ <path d="M371.8,64h-71.6c-6.7,0-12.2,5.4-12.2,12.1v359.7c0,6.7,5.4,12.2,12.2,12.2h71.6c6.7,0,12.2-5.4,12.2-12.2V76.1
+ C384,69.4,378.6,64,371.8,64z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person-add.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person-add.svg
new file mode 100644
index 00000000..2e1520ea
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person-add.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="429,328 429,277 480,277 480,235 429,235 429,184 387,184 387,235 336,235 336,277 387,277 387,328 "/>
+ <path d="M416,448c0,0,0-26.4-2.2-40.2c-1.8-10.9-16.9-25.3-81.1-48.9c-63.2-23.2-59.3-11.9-59.3-54.6c0-27.7,14.1-11.6,23.1-64.2
+ c3.5-20.7,6.3-6.9,13.9-40.1c4-17.4-2.7-18.7-1.9-27c0.8-8.3,1.6-15.7,3.1-32.7C313.4,119.3,293.9,64,224,64
+ c-69.9,0-89.4,55.3-87.5,76.4c1.5,16.9,2.3,24.4,3.1,32.7c0.8,8.3-5.9,9.6-1.9,27c7.6,33.1,10.4,19.3,13.9,40.1
+ c9,52.6,23.1,36.5,23.1,64.2c0,42.8,3.9,31.5-59.3,54.6c-64.2,23.5-79.4,38-81.1,48.9C32,421.6,32,448,32,448h192H416z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person-stalker.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person-stalker.svg
new file mode 100644
index 00000000..c4606769
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person-stalker.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M425.3,324.8c-41.4-15.7-38.9-9.4-38.9-38.5c0-18.8,9.3-11.9,15.2-47.7c2.3-14.1,4.2-4.7,9.1-27.3
+ c2.6-11.8-1.8-12.7-1.2-18.3c0.5-5.6,1-10.7,2-22.2c1.2-14.4-11.6-52-57.4-52c-45.8,0-58.6,37.6-57.4,52c0.9,11.6,1.5,16.6,2,22.2
+ c0.5,5.6-3.8,6.5-1.2,18.3c4.9,22.6,6.8,13.1,9.1,27.3c5.9,35.8,15.1,29,15.1,47.7c0,13.4,3.1,19-14.9,27.5
+ c5.4,1.9,11.7,4.2,19.3,7.1c54.4,20.7,53.1,40.8,54.5,50.3c1,6.5,1.5,58.3,1.7,76.8H480c0,0,0-80.5-1.5-89.9
+ C477.4,350.7,467.5,340.9,425.3,324.8z"/>
+ <path d="M357,448c0,0,0-14.1-0.2-30.4c-0.2-18.6-0.7-40-1.7-46.4c-1.5-9.5-14.3-22.2-68.6-42.9c-7.5-2.8-13.8-5.1-19.3-7.1
+ c-33.3-11.8-30.9-15.7-30.9-48c0-24.3,12-8.5,19.6-54.6c3-18.2,5.4-6.1,11.7-35.2c3.4-15.2-2.3-16.4-1.6-23.7
+ c0.7-7.3,1.4-13.8,2.6-28.7c1.6-18.5-14.9-67.1-74.1-67.1c-59.2,0-75.6,48.5-74.1,67.1c1.2,14.9,1.9,21.4,2.7,28.7
+ c0.7,7.3-5,8.4-1.6,23.7c6.4,29.1,8.8,17,11.8,35.2c7.6,46.1,19.5,30.3,19.5,54.6c0,37.6,3.3,34.8-50.2,55.1
+ c-54.3,20.7-67.1,33.4-68.6,42.9C32,383.3,32,448,32,448h162.5H357z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person.svg
new file mode 100644
index 00000000..aac76d4c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M448,448c0,0,0-26.4-2.2-40.2c-1.8-10.9-16.9-25.3-81.1-48.9c-63.2-23.2-59.3-11.9-59.3-54.6c0-27.7,14.1-11.6,23.1-64.2
+ c3.5-20.7,6.3-6.9,13.9-40.1c4-17.4-2.7-18.7-1.9-27c0.8-8.3,1.6-15.7,3.1-32.7C345.4,119.3,325.9,64,256,64
+ c-69.9,0-89.4,55.3-87.5,76.4c1.5,16.9,2.3,24.4,3.1,32.7c0.8,8.3-5.9,9.6-1.9,27c7.6,33.1,10.4,19.3,13.9,40.1
+ c9,52.6,23.1,36.5,23.1,64.2c0,42.8,3.9,31.5-59.3,54.6c-64.2,23.5-79.4,38-81.1,48.9C64,421.6,64,448,64,448h192H448z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pie-graph.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pie-graph.svg
new file mode 100644
index 00000000..5054884e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pie-graph.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M32.6,256h32H256V64.6v-32c-5-0.4-10.6-0.6-16-0.6C125.1,32,32,125.1,32,240C32,245.4,32.2,251,32.6,256z"/>
+ <path d="M109.8,402.2C147.9,449.6,206.4,480,272,480c114.9,0,208-93.1,208-208c0-65.6-30.4-124.1-77.8-162.2
+ C370.5,84.3,331,67.9,288,64.6V288H64.6C67.9,331,84.3,370.5,109.8,402.2z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pin.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pin.svg
new file mode 100644
index 00000000..7bdc8775
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pin.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M331.8,228C331.8,228,331.8,228,331.8,228c-1.2-0.5-2.4-1-3.5-1.7c-7-4-12.2-10.9-13.9-19.2L295.9,89.4l-0.2-5.8
+ c0-7.1,4.1-10.2,10-13l0,0c0.7-0.3,1.4-0.6,2.1-0.9c7.2-3.4,12.1-7.8,12.1-16.3c0-20.1-6.5-21.4-18.2-21.4h-91.3
+ c-11.7,0-18.2,1.2-18.2,21.4c0,8.5,4.9,12.9,12.1,16.3c0.7,0.3,1.4,0.5,2.1,0.9c0,0,0,0,0,0c5.9,2.9,10,6,10,13l-0.2,5.8
+ l-18.5,117.7c-1.7,8.3-6.9,15.2-13.9,19.2c-1.1,0.7-2.3,1.2-3.5,1.7c0,0,0,0,0,0c-19.7,10.2-36.2,30.8-36.2,54.7
+ c0,15.9,3.5,21.3,15.2,21.3H240l12,176h8l12-176h80.8c11.7,0,15.2-4.7,15.2-21.3C368,258.8,351.5,238.2,331.8,228z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pinpoint.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pinpoint.svg
new file mode 100644
index 00000000..d18b9bbd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pinpoint.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,32C132.3,32,32,132.3,32,256c0,123.7,100.3,224,224,224c123.7,0,224-100.3,224-224C480,132.3,379.7,32,256,32z
+ M391.8,391.8c-32.5,32.5-74.6,51.9-119.8,55.6L264,384h-16l-7.9,63.3c-45.3-3.7-87.4-23.1-119.8-55.6
+ c-32.5-32.5-51.9-74.6-55.6-119.8L128,264v-16l-63.3-7.9c3.7-45.3,23.1-87.4,55.6-119.8c32.5-32.5,74.6-51.9,119.8-55.6L248,128h16
+ l7.9-63.3c45.3,3.7,87.4,23.1,119.8,55.6c32.5,32.5,51.9,74.6,55.6,119.8L384,248v16l63.3,7.9C443.6,317.2,424.2,359.3,391.8,391.8z
+ "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pizza.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pizza.svg
new file mode 100644
index 00000000..4595a207
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pizza.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M394.619,130.445c-42.658-18.924-89.266-28.472-138.649-28.425c-49.373-0.047-99.27,10.262-138.641,27.979
+ c-7.396,3.312-14.004,8.957-9.296,19.479S255.941,480,255.941,480l147.621-329.874C406.452,143.25,404.318,134.748,394.619,130.445
+ z M191.983,192.015c-17.67,0-31.995-14.323-31.995-31.993c0-17.669,14.325-31.992,31.995-31.992
+ c17.671,0,31.996,14.323,31.996,31.992C223.979,177.691,209.654,192.015,191.983,192.015z M255.975,338.981
+ c-17.671,0-31.995-14.323-31.995-31.993s14.324-31.992,31.995-31.992c17.67,0,31.995,14.322,31.995,31.992
+ S273.645,338.981,255.975,338.981z M319.965,224.007c-17.67,0-31.995-14.322-31.995-31.992s14.325-31.993,31.995-31.993
+ c17.671,0,31.996,14.323,31.996,31.993S337.636,224.007,319.965,224.007z"/>
+ <path d="M421.79,66c-47.808-20.603-106.867-33.977-165.811-34c-58.931,0-116.944,12.136-165.82,33.446
+ C85.83,67.334,80,71.016,80,79.227c0,2.523,0.907,4.922,0.907,4.922l7.98,19.194c2.531,4.865,7.944,8.18,13.798,8.18
+ c1.645,0,3.936-0.331,6.65-1.476c44.9-18.929,94.471-29.588,146.644-29.564c52.175-0.023,105.63,11.64,146.634,29.561
+ c3.296,1.44,5.173,1.472,6.663,1.472c6.009,0,11.158-3.274,13.727-8.053l8.04-19.342c0.577-1.558,0.957-3.287,0.957-4.768
+ C432,72,427.614,68.51,421.79,66z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plane.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plane.svg
new file mode 100644
index 00000000..6f577479
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plane.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M281.7,311.9c0.4-6.9,8.3-4.5,8.3-4.5l62,12.6l128,48.7c0-24-3.8-26.5-9.4-30.7L288,207c0,0-4.9-60-4.9-112.9
+ c0-24.5-11.8-78.1-27.1-78.1s-27.1,54.4-27.1,78.1c0,50.2-4.9,112.9-4.9,112.9L41.4,338c-7.1,5-9.4,7.7-9.4,30.7L160,320l61.9-12.6
+ c0,0,7.9-2.4,8.3,4.5c0.4,6.9-1.2,69.1,5.9,102.1c0.9,4.4-2.5,4.7-4.8,7.4l-51.9,32.8c-1.7,1.9-2.5,7.3-2.5,7.3l-1,18.5l68-16l12,32
+ l12-32l68,16l-1-18.5c0.1,0-0.7-5.4-2.4-7.3l-51.9-32.8c-2.3-2.7-5.7-3-4.8-7.4C282.7,381,281.3,318.8,281.7,311.9z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/planet.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/planet.svg
new file mode 100644
index 00000000..8a9dfad0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/planet.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M96.298,265.705C101.315,349.55,170.887,416,255.988,416c37.957,0,72.818-13.227,100.25-35.311
+ C317.23,369.554,274,353.922,229.562,334.617C180.731,313.404,134.957,289.677,96.298,265.705z"/>
+ <path d="M107.381,196.629c39.911,27.11,92.07,55.13,147.679,79.287c43.591,18.938,87.113,34.555,125.859,45.164
+ c6.496,1.779,12.834,3.406,18.988,4.883c1.685-3.462,3.249-6.994,4.688-10.591c7.341-18.358,11.386-38.393,11.386-59.372
+ c0-3.26-0.109-6.493-0.301-9.705C410.661,162.45,341.09,96,255.988,96c-37.956,0-72.817,13.227-100.248,35.311
+ c-18.296,14.729-33.284,33.398-43.67,54.726C110.383,189.499,108.819,193.032,107.381,196.629z"/>
+ <path d="M429.667,284.531c-1.256,11.562-2.377,13.627-5.891,24.695c16.878,12.039,31.032,23.706,41.137,33.938
+ c3.285,3.328,5.875,6.225,7.912,8.702c-1.684,0.084-3.557,0.133-5.631,0.133c-21.886,0-54.026-5.5-90.501-15.488
+ c-39.467-10.806-83.73-26.685-128.008-45.92c-58.931-25.6-114.158-55.541-155.51-84.307c-19.081-13.275-35.027-26.226-46.113-37.45
+ c-3.285-3.328-5.875-6.225-7.912-8.702c1.683-0.084,3.556-0.133,5.632-0.133c15.308,0,35.637,2.694,58.952,7.729
+ c5.825-10.004,6.979-12.701,14.663-21.409C92.663,137,66.625,130.522,44.784,128c-24.403-2.818-40.34,5.521-43.984,17.14
+ C-10.274,180.457,95,258.718,235.936,319.942C330.498,361.022,417.104,384,467.194,384c24.565,0,40.338-5.521,43.982-17.141
+ C517.516,346.643,486.965,320,429.667,284.531z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/play.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/play.svg
new file mode 100644
index 00000000..c7817bdd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/play.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M405.2,232.9L126.8,67.2c-3.4-2-6.9-3.2-10.9-3.2c-10.9,0-19.8,9-19.8,20H96v344h0.1c0,11,8.9,20,19.8,20
+ c4.1,0,7.5-1.4,11.2-3.4l278.1-165.5c6.6-5.5,10.8-13.8,10.8-23.1C416,246.7,411.8,238.5,405.2,232.9z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/playstation.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/playstation.svg
new file mode 100644
index 00000000..f29f851f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/playstation.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <path class="st0" d="M399.8,203c-0.8-17.1-3.3-34.5-10.8-50.1c-4.1-8.6-9.7-16.5-16.5-23.2c-6.3-6.4-13.6-11.7-21.3-16.3
+ c-17.1-10.2-37.5-17-84.4-31S192,64,192,64v358.3l79.9,25.7c0,0,0.1-198.8,0.1-299.5v-3.8c0-9.3,7.5-16.8,16.1-16.8h0.5
+ c8.5,0,15.5,7.5,15.5,16.8v2.2v131.1c11,5.3,29.2,9.3,41.8,9.1c8.3,0.2,16.7-1.7,24-5.7c7.6-4.1,13.9-10.4,18.4-17.8
+ c5.1-8.3,8.2-17.8,9.9-27.3C400.1,225.5,400.2,214.2,399.8,203z"/>
+ <path class="st0" d="M86.7,357.8c27.4-9.8,89.3-29.5,89.3-29.5v-47.2c0,0-76.5,24.8-111.3,37.1c-8.6,3.1-17.3,5.9-25.7,9.5
+ c-9.8,4.1-19.4,8.7-28.1,14.8c-3.8,2.6-7.2,5.9-9.2,10.1c-2,4.2-2.2,9.2-0.5,13.6c2,5.1,5.8,9.3,10.1,12.6
+ c7.8,5.9,17.1,9.5,26.4,12.2c28.4,9.4,58.4,14,88.4,13.3c14.5-0.2,36-1.9,50-4.4v-42c0,0-11,2.5-41.3,12.5c-4.6,1.5-9.2,3.3-14,4.3
+ c-7.1,1.6-14.4,2.1-21.6,2.2c-6.5-0.3-13.2-0.7-19.3-3.1c-2.2-1-4.6-2.2-5.5-4.6c-0.8-2,0.3-4,1.7-5.4
+ C78.9,360.9,82.9,359.3,86.7,357.8z"/>
+ <path class="st0" d="M512,345.9c-0.1-6-3.7-11.2-7.9-15c-7.1-6.3-15.9-10.3-24.7-13.5c-5.5-1.9-9.3-3.3-14.7-5
+ c-25.2-8.2-51.9-11.2-78.3-11.3c-8,0.3-23.1,0.5-31,1.4c-21.9,2.5-67.3,15.4-67.3,15.4v48.8c0,0,67.5-21.6,96.5-31.8
+ c9.7-3.3,20.1-4.6,30.3-4.6c6.5,0.2,13.2,0.7,19.4,3.1c2.2,0.9,4.5,2.2,5.5,4.5c0.9,2.6-0.9,5-2.9,6.5c-4.7,3.8-10.7,5.3-16.2,7.4
+ C379.7,366.3,288,396.5,288,396.5v47c0,0,117.2-39.6,170.8-58.8c8.9-3.3,17.9-6.1,26.4-10.4c7.9-4,15.8-8.6,21.8-15.3
+ C510.1,355.4,512,351,512,345.9z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus-circled.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus-circled.svg
new file mode 100644
index 00000000..4550c4b6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus-circled.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,32C132.3,32,32,132.3,32,256s100.3,224,224,224s224-100.3,224-224S379.7,32,256,32z M384,272H272v112h-32V272H128v-32
+ h112V128h32v112h112V272z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus-round.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus-round.svg
new file mode 100644
index 00000000..b2d86e50
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus-round.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M417.4,224H288V94.6c0-16.9-14.3-30.6-32-30.6c-17.7,0-32,13.7-32,30.6V224H94.6C77.7,224,64,238.3,64,256
+ c0,17.7,13.7,32,30.6,32H224v129.4c0,16.9,14.3,30.6,32,30.6c17.7,0,32-13.7,32-30.6V288h129.4c16.9,0,30.6-14.3,30.6-32
+ C448,238.3,434.3,224,417.4,224z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus.svg
new file mode 100644
index 00000000..c4b273c4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<polygon points="448,224 288,224 288,64 224,64 224,224 64,224 64,288 224,288 224,448 288,448 288,288 448,288 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/podium.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/podium.svg
new file mode 100644
index 00000000..482b3d75
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/podium.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <rect x="32" y="256" width="128" height="192"/>
+ <rect x="192" y="160" width="128" height="288"/>
+ <rect x="352" y="320" width="128" height="128"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pound.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pound.svg
new file mode 100644
index 00000000..14138467
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pound.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M125.2,352.3H32v-54.6h101.2l13.1-83.3H47v-54.6h107.2L176,32h63.9l-21.8,127.7h105.6L345.5,32h63.1l-21.8,127.7H480v54.6
+ H378.1l-12.3,83.3H465v54.6H358.5L336,480h-63.1l21.8-127.7H188.3L166.5,480h-63.1L125.2,352.3z M209.4,214.3L197,297.7h105.6
+ l12.3-83.3H209.4z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/power.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/power.svg
new file mode 100644
index 00000000..636b2876
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/power.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,256c-17.7,0-32-14.3-32-32V64c0-17.7,14.3-32,32-32s32,14.3,32,32v160C288,241.7,273.7,256,256,256z"/>
+ <path d="M379,68.8L379,68.8c-5-3-10.8-4.8-17-4.8c-17.7,0-32,14.3-32,32c0,6.2,1.8,12,4.8,16.9c2,3.2,4.6,6.1,7.6,8.4
+ c1.2,0.9,2.4,1.7,3.7,2.5c8.1,5.6,15.8,11.9,23,19.1C399.4,173.1,416,213.3,416,256c0,42.7-16.6,82.9-46.9,113.1
+ C338.9,399.4,298.7,416,256,416c-42.7,0-82.9-16.6-113.1-46.9C112.6,338.9,96,298.7,96,256c0-42.7,16.6-82.9,46.9-113.1
+ c7.1-7.1,14.8-13.5,22.9-19c1.4-0.8,2.6-1.6,3.9-2.6c3-2.3,5.5-5.1,7.5-8.3c3.1-4.9,4.8-10.7,4.8-16.9c0-17.7-14.3-32-32-32
+ c-6.2,0-12,1.8-16.9,4.8l-0.1-0.1C72.2,108.8,32,177.7,32,256c0,123.7,100.3,224,224,224c123.7,0,224-100.3,224-224
+ C480,177.7,439.8,108.8,379,68.8z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pricetag.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pricetag.svg
new file mode 100644
index 00000000..22335f43
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pricetag.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M471,261.4L471,261.4C471,261.4,471,261.4,471,261.4L260.9,49.8c0,0,0,0,0,0l-1.5-1.5c0,0-0.4,0-0.4,0
+ c-8.3-7.9-17.9-12-29.9-12.3v0l-99.7-3.7l-4.4-0.2c-11.2,0.2-22.2,4.5-30.7,13.1L45.1,94.3c-9,9-13.1,20.9-13.1,32.7c0,0,0,0,0,0.1
+ l0.3,4.2l6.7,97.3c0,0.1,0,0.2,0,0.2v1.9c0,0,0,0,0,0c1,8.7,4.5,17.3,10.4,24.4l5.5,5.4l206.3,208.8l3.1,3.1
+ c11.9,10.5,30,10,41.3-1.4l165.4-166.6C482.8,292.6,483,273.3,471,261.4z M144,192c-26.5,0-48-21.5-48-48s21.5-48,48-48
+ s48,21.5,48,48S170.5,192,144,192z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pricetags.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pricetags.svg
new file mode 100644
index 00000000..e62d8c41
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pricetags.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M472,239.2L472,239.2C472,239.2,471.9,239.2,472,239.2L282.1,48.1c0,0,0,0,0,0l-1.4-1.4c0,0-0.5,0-0.5,0
+ c-7.5-7.2-16.1-10.9-27.1-11.1v0l-89.9-3.3l-3.9-0.1c-10.1,0.1-20,4.1-27.7,11.8l-27.1,27.2c7.4-6.6,16.6-10,26-10.1l3.8,0.1
+ l89.8,3.3v0c11,0.2,19.7,3.9,27.2,11.1c0,0,0.4,0,0.5,0l1.4,1.4c0,0,0,0,0,0L443,268.1c0,0,0,0,0,0v0c10,10.8,10.7,28.2,0,38.9
+ l29-28.9C482.6,267.4,482,250,472,239.2z"/>
+ <path d="M428,282.5c0,0,0.3,0,0.3,0L238.6,91.4c0,0,0,0,0,0l-1.3-1.4c0,0-0.3,0-0.3,0c-7.5-7.2-15.9-10.9-26.9-11.1v0l-90.1-3.3
+ l-4-0.1c-9.2,0.1-18.2,3.4-25.6,9.8c-0.3,0.3-0.7,0.6-1,0.9c-0.4,0.4-0.8,0.8-1.2,1.2l-44.3,44.5c-8.1,8.1-11.9,18.9-11.9,29.5
+ c0,0,0,0,0,0.1l0.1,3.8l5.9,87.9c0,0.1,0,0.1,0,0.2v1.7c0,0,0,0,0,0c1,7.9,4.2,15.6,9.6,22l5.1,4.9L239,470.4l2.8,2.8
+ c10.7,9.4,27.1,9,37.3-1.3l13.1-13.2c0.5-0.4,0.9-0.8,1.4-1.3l26.9-27c-0.2,0.1-0.3,0.2-0.5,0.4l108.3-109.3
+ C438.9,310.8,439,293.3,428,282.5L428,282.5z M110.6,139.5c6.6-4,14.3-6.3,22.6-6.3c23.9,0,43.4,19.4,43.4,43.4
+ c0,8.3-2.3,16-6.3,22.6c-7.6,12.5-21.3,20.8-37,20.8c-23.9,0-43.4-19.4-43.4-43.4C89.8,160.8,98.1,147.1,110.6,139.5z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/printer.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/printer.svg
new file mode 100644
index 00000000..4f270765
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/printer.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M423.8,128H384V64H128v64H88.2C60.3,128,32,144.9,32,182.6v123.8c0,38,28.3,61.6,56.2,61.6c0,0,30.4,0,39.8,0v112h5h11h224
+ h8h8V368c10.3,0,39.8,0,39.8,0c27.9,0,56.2-22.6,56.2-53.6V182.6C480,146.9,451.8,128,423.8,128z M368,464H144V288h224V464z
+ M368,128H144V80h224V128z M416,192h-17v-16h17V192z"/>
+ <rect x="160" y="320" width="192" height="16"/>
+ <rect x="160" y="368" width="192" height="16"/>
+ <rect x="160" y="416" width="192" height="16"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pull-request.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pull-request.svg
new file mode 100644
index 00000000..c311934e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pull-request.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M128,64c-35.29,0-64,28.71-64,64c0,23.637,12.89,44.307,32,55.391v177.219C76.89,371.693,64,392.363,64,416
+ c0,35.29,28.71,64,64,64s64-28.71,64-64c0-23.637-12.89-44.307-32-55.391V183.391c19.11-11.084,32-31.754,32-55.391
+ C192,92.71,163.29,64,128,64z M128,448c-17.673,0-32-14.327-32-32s14.327-32,32-32s32,14.327,32,32S145.673,448,128,448z M128,160
+ c-17.673,0-32-14.327-32-32s14.327-32,32-32s32,14.327,32,32S145.673,160,128,160z"/>
+ <path d="M415,360.034V204.989c0-33.987-10.49-61.002-31.18-80.294c-22.111-20.618-54.314-30.388-95.82-29.106V32l-96,96l96,96v-64
+ c26.5,0,42.67,2.642,52.175,11.504c7.183,6.698,10.825,17.964,10.825,33.485v156.196c-18.562,11.217-31,31.589-31,54.814
+ c0,35.29,28.71,64,64,64s64-28.71,64-64C448,391.951,434.662,370.969,415,360.034z M384,448c-17.673,0-32-14.327-32-32
+ s14.327-32,32-32s32,14.327,32,32S401.673,448,384,448z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/qr-scanner.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/qr-scanner.svg
new file mode 100644
index 00000000..82a6cd13
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/qr-scanner.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M96,124.171c0-6.938,5.232-12.171,12.171-12.171H176V64h-66.829C75.717,64,48,90.717,48,124.171V192h48V124.171z"/>
+ <path d="M403.579,64H336v48h67.219c6.938,0,12.781,5.232,12.781,12.171V192h48v-67.829C464,90.717,437.033,64,403.579,64z"/>
+ <path d="M416,386.829c0,6.938-5.232,12.171-12.171,12.171H336v49h67.829C437.283,448,464,420.283,464,386.829V320h-48V386.829z"/>
+ <path d="M108.171,399C101.232,399,96,393.768,96,386.829V320H48v66.829C48,420.283,75.717,448,109.171,448H176v-49H108.171z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/quote.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/quote.svg
new file mode 100644
index 00000000..74b11a06
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/quote.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M192,64c-40.646,0-72.483,11.229-94.627,33.373C75.229,119.517,64,151.354,64,192v256h160V192h-96
+ c0-23.056,4.922-39.666,14.627-49.373C152.334,132.922,168.944,128,192,128"/>
+ </g>
+ <g>
+ <path d="M416,64c-40.646,0-72.483,11.229-94.627,33.373C299.229,119.517,288,151.354,288,192v256h160V192h-96
+ c0-23.056,4.922-39.666,14.627-49.373C376.334,132.922,392.944,128,416,128"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/radio-waves.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/radio-waves.svg
new file mode 100644
index 00000000..aad96c68
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/radio-waves.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <circle cx="256" cy="256" r="64"/>
+ <g>
+ <path d="M144,256c0-36.9,18.553-69.208,46.314-87.034l-23.141-24.512c-6.26,4.608-12.18,9.833-17.684,15.663
+ C125.314,185.729,112,219.781,112,256c0,36.219,13.314,70.271,37.49,95.883c5.504,5.829,11.424,11.055,17.684,15.662
+ l23.141-24.511C162.553,325.208,144,292.9,144,256z"/>
+ <path d="M368,256c0,36.9-18.553,69.208-46.314,87.034l23.141,24.511c6.26-4.607,12.18-9.833,17.684-15.662
+ C386.686,326.271,400,292.219,400,256c0-36.219-13.314-70.271-37.49-95.882c-5.504-5.83-11.424-11.055-17.684-15.663
+ l-23.141,24.512C349.447,186.792,368,219.1,368,256z"/>
+ <path d="M64,256c0-55.578,25.251-104.907,64.263-135.817L105.433,96c-5.999,5-11.739,10.396-17.197,16.178
+ c-17.622,18.669-31.462,40.417-41.134,64.641C37.081,201.917,32,228.556,32,256c0,27.443,5.081,54.084,15.102,79.181
+ c9.672,24.226,23.512,45.973,41.134,64.642c5.458,5.781,11.198,11.177,17.197,16.178l22.829-24.183
+ C89.251,360.907,64,311.578,64,256z"/>
+ <path d="M448,256c0,55.578-25.251,104.907-64.262,135.817l22.828,23.848c6-5.001,11.74-10.062,17.198-15.843
+ c17.622-18.669,31.462-40.416,41.134-64.642C474.918,310.084,480,283.443,480,256c0-27.444-5.082-54.083-15.102-79.181
+ c-9.672-24.225-23.512-45.972-41.134-64.641C418.307,106.396,412.566,101,406.566,96l-22.829,24.183
+ C422.749,151.093,448,200.422,448,256z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/record.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/record.svg
new file mode 100644
index 00000000..44b9b41f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/record.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,464c114.9,0,208-93.1,208-208c0-114.9-93.1-208-208-208C141.1,48,48,141.1,48,256C48,370.9,141.1,464,256,464z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/refresh.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/refresh.svg
new file mode 100644
index 00000000..c3f07c66
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/refresh.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M416,352l96-111.9h-64.7c-2.3-27.9-10.5-54-23.5-77.3c-27.4-49.2-75.8-85.1-133-95.6c-0.7-0.1-1.5-0.3-2.2-0.4
+ c-0.5-0.1-0.9-0.2-1.4-0.2C277.1,64.9,266.6,64,256,64c-0.1,0-0.3,0-0.4,0c0,0,0,0,0,0c-90.9,0.2-167,63.6-186.7,148.6
+ c0,0,0,0.1,0,0.1c-0.3,1.1-0.5,2.2-0.7,3.3c-0.1,0.5-0.2,0.9-0.3,1.4c-0.1,0.7-0.3,1.4-0.4,2.1c-0.2,0.9-0.3,1.7-0.5,2.6
+ c-0.1,0.4-0.1,0.7-0.2,1.1c-0.2,1.2-0.4,2.4-0.6,3.6c0,0.1,0,0.1,0,0.2c-1,6.3-1.6,12.7-1.9,19.1c0,0.3,0,0.6,0,0.8
+ c-0.1,1.4-0.1,2.7-0.2,4.1c0,1.6-0.1,3.3-0.1,5c0,1.7,0,3.3,0.1,5c0,1.4,0.1,2.7,0.2,4.1c0,0.3,0,0.6,0,0.9c0.3,6.5,1,12.9,1.9,19.1
+ c0,0.1,0,0.1,0,0.2c0.2,1.2,0.4,2.4,0.6,3.6c0.1,0.4,0.1,0.7,0.2,1.1c0.2,0.9,0.3,1.8,0.5,2.6c0.1,0.7,0.3,1.4,0.4,2.1
+ c0.1,0.5,0.2,1,0.3,1.4c0.2,1.1,0.5,2.2,0.7,3.2c0,0,0,0.1,0,0.1c19.7,85,96.1,148.4,187.1,148.6c42.9-0.1,83.1-14.2,116.9-40.7
+ l7.5-5.9l-43.2-46.2l-6.2,4.6c-22.1,16.3-47.5,24.2-75,24.2c-70.6,0-128-57-128-128c0-71,57.4-128,128-128
+ c66.4,0,122.8,46.6,129.5,112H312L416,352z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/reply-all.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/reply-all.svg
new file mode 100644
index 00000000..17286eeb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/reply-all.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M304.5,192v-80L152.7,255.8L304.5,390v-91.9c68,0,107.9,8.9,159.1,101.9C463.6,400,457.5,192,304.5,192z"/>
+ <g>
+ <polygon points="47.5,256 191.5,382.5 191.5,324 109.3,256 191.5,177.4 191.5,120.4 "/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/reply.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/reply.svg
new file mode 100644
index 00000000..39e4e581
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/reply.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M448,400c0,0-36.8-208-224-208v-80L64,256l160,134.4v-92.3C325.6,298.1,395,307,448,400z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ribbon-a.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ribbon-a.svg
new file mode 100644
index 00000000..24d1e1b0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ribbon-a.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M352,32l-82.9,176.612c39.996,3.608,75.273,23.554,99.096,53.128L432,128L352,32z"/>
+ <path d="M160,32l82.9,176.612c-39.996,3.608-75.273,23.554-99.096,53.128L80,128L160,32z"/>
+ <polygon points="269.092,32 256,32 176,32 228.572,144 256,144 283.428,144 336,32 "/>
+ <path d="M256,224c-70.692,0-128,57.308-128,128s57.308,128,128,128s128-57.308,128-128S326.692,224,256,224z M256,448
+ c-53.02,0-96-42.98-96-96s42.98-96,96-96s96,42.98,96,96S309.02,448,256,448z"/>
+ <path d="M256,264c-48.523,0-88,39.477-88,88s39.477,88,88,88s88-39.477,88-88S304.523,264,256,264z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ribbon-b.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ribbon-b.svg
new file mode 100644
index 00000000..9e7a4b63
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ribbon-b.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M256,72c-48.523,0-88,39.477-88,88s39.477,88,88,88s88-39.477,88-88S304.523,72,256,72z"/>
+ <path d="M256,32c-70.692,0-128,57.308-128,128s57.308,128,128,128s128-57.308,128-128S326.692,32,256,32z M256,256
+ c-53.02,0-96-42.98-96-96s42.98-96,96-96s96,42.98,96,96S309.02,256,256,256z"/>
+ </g>
+ <g>
+ <path d="M147.092,254.21L64,400h96l48,80l48-105.807l33.641-74.154C278.848,302.623,267.585,304,256,304
+ C212.495,304,173.497,284.707,147.092,254.21z"/>
+ <path d="M364.908,254.211c-15.077,17.412-34.26,31.172-56.043,39.774l-44.752,98.092L304,480l48-80h96L364.908,254.211z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/sad-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/sad-outline.svg
new file mode 100644
index 00000000..86ae5761
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/sad-outline.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <g>
+ <path d="M399.283,283.797c-5.1-16.379-14.22-29.995-33.802-37.263s-35.265-2.877-49.868,6.15
+ c-7.615,4.707-10.029,14.019-4.214,22.123c2.049,2.854,5.019,4.717,8.376,5.963c5.059,1.876,10.584,1.678,14.965-1.036
+ c4.778-2.957,10.644-6.526,19.607-3.199c9.01,3.343,11.103,9.839,12.752,15.161c1.551,4.952,5.62,8.724,10.693,10.606
+ c3.357,1.246,6.816,1.774,10.236,0.938C396.895,301.056,401.944,292.333,399.283,283.797z"/>
+ <path d="M196.549,252.685c-14.603-9.027-30.286-13.418-49.868-6.15s-28.702,20.884-33.802,37.263
+ c-2.661,8.536,2.389,17.259,11.255,19.443c3.42,0.837,6.878,0.309,10.236-0.938c5.073-1.883,9.143-5.654,10.693-10.606
+ c1.649-5.322,3.743-11.818,12.752-15.161c8.964-3.327,14.829,0.242,19.607,3.199c4.381,2.714,9.907,2.912,14.965,1.036
+ c3.357-1.246,6.327-3.108,8.376-5.963C206.578,266.703,204.164,257.392,196.549,252.685z"/>
+ </g>
+ <path d="M256,32C132.288,32,32,132.288,32,256s100.288,224,224,224s224-100.288,224-224S379.712,32,256,32z M391.765,391.765
+ C355.5,428.028,307.285,448,256,448s-99.5-19.972-135.765-56.235C83.972,355.5,64,307.285,64,256s19.972-99.5,56.235-135.765
+ C156.5,83.972,204.715,64,256,64s99.5,19.972,135.765,56.235C428.028,156.5,448,204.715,448,256S428.028,355.5,391.765,391.765z"
+ />
+ </g>
+ <path d="M349.119,359.176C348.013,357.59,321,320,256,320c-65.261,0-92.014,37.59-93.121,39.176
+ c-5.057,7.247-3.283,17.221,3.963,22.278c2.789,1.946,5.982,2.881,9.143,2.881c5.052,0,10.024-2.388,13.135-6.845
+ C189.296,377.239,208.02,352,256,352c48,0,66.703,25.239,66.879,25.49c3.11,4.457,8.081,6.845,13.134,6.845
+ c3.161,0,6.354-0.935,9.144-2.881C352.402,376.396,354.177,366.423,349.119,359.176z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/sad.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/sad.svg
new file mode 100644
index 00000000..ca584516
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/sad.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256,32C132.288,32,32,132.288,32,256s100.288,224,224,224s224-100.288,224-224S379.712,32,256,32z M145.062,291.696
+ c-1.551,4.952-5.62,8.724-10.693,10.606c-3.358,1.246-6.816,1.774-10.236,0.938c-8.866-2.185-13.916-10.907-11.255-19.443
+ c5.101-16.379,14.22-29.995,33.802-37.263s35.265-2.877,49.868,6.15c7.615,4.707,10.029,14.019,4.214,22.123
+ c-2.049,2.854-5.019,4.717-8.376,5.963c-5.059,1.876-10.584,1.678-14.965-1.036c-4.778-2.957-10.643-6.526-19.607-3.199
+ C148.805,279.878,146.712,286.374,145.062,291.696z M345.156,381.454c-2.789,1.946-5.982,2.881-9.144,2.881
+ c-5.053,0-10.023-2.388-13.134-6.845C322.703,377.239,304,352,256,352c-47.98,0-66.704,25.239-66.879,25.49
+ c-3.111,4.457-8.083,6.845-13.135,6.845c-3.161,0-6.354-0.935-9.143-2.881c-7.246-5.058-9.021-15.031-3.963-22.278
+ C163.986,357.59,190.739,320,256,320c65,0,92.013,37.59,93.119,39.176C354.177,366.423,352.402,376.396,345.156,381.454z
+ M388.029,303.24c-3.42,0.837-6.879,0.309-10.236-0.938c-5.073-1.883-9.143-5.654-10.693-10.606
+ c-1.649-5.322-3.742-11.818-12.752-15.161c-8.964-3.327-14.829,0.242-19.607,3.199c-4.381,2.714-9.906,2.912-14.965,1.036
+ c-3.357-1.246-6.327-3.108-8.376-5.963c-5.815-8.104-3.401-17.416,4.214-22.123c14.604-9.027,30.286-13.418,49.868-6.15
+ s28.702,20.884,33.802,37.263C401.944,292.333,396.895,301.056,388.029,303.24z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/scissors.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/scissors.svg
new file mode 100644
index 00000000..264e7c2b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/scissors.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M405.178,115.667c13.314-32.667,17.309-64-5.326-83.667L255.726,224l-16.976,23c0,0-27.627,40.011-37.28,58.667
+ s-19.306,39.333-27.294,54c-7.01,12.871-10.438,15.221-14.322,11.548c-0.506-0.591-1.026-1.168-1.553-1.736
+ c-0.037-0.047-0.073-0.09-0.11-0.138c-1.143-1.472-2.75-3.002-4.635-4.467C144.195,356.795,132.548,352,119.92,352
+ C89.037,352,64,380.653,64,416s25.037,64,55.92,64c25.282,0,46.635-19.205,53.553-45.561l-0.004,0.043
+ c0,0,13.355-41.482,32.661-71.482c19.306-30,49.596-43,49.596-43l31.954-32C287.68,288,391.863,148.334,405.178,115.667z
+ M119.92,448c-15.418,0-27.918-14.353-27.918-32s12.5-32,27.918-32c15.419,0,27.918,14.353,27.918,32S135.339,448,119.92,448z
+ M256,288c-8.836,0-16-7.163-16-16c0-8.836,7.164-16,16-16c8.837,0,16,7.164,16,16C272,280.837,264.837,288,256,288z"/>
+ <path d="M207.28,265.255c9.18-14.114,17.671-26.43,18.304-27.346l0.143-0.208l0.15-0.203l16.976-23l0.038-0.052l0.039-0.052
+ l2.941-3.918L111.896,32c-22.634,19.667-18.64,51-5.326,83.667C116.523,140.087,177.249,224.29,207.28,265.255z"/>
+ <path d="M391.828,352c-12.628,0-24.275,4.795-33.637,12.874c-1.885,1.465-3.492,2.995-4.635,4.467
+ c-0.037,0.048-0.072,0.091-0.109,0.138c-0.526,0.568-1.047,1.146-1.553,1.736c-3.884,3.673-7.312,1.323-14.322-11.548
+ c-7.988-14.667-17.641-35.344-27.294-54c-1.77-3.421-4.146-7.561-6.843-12.038c-1.272,1.712-2.264,3.043-2.932,3.938l-0.688,0.924
+ l-0.813,0.815l-28.688,28.729c10.433,6.855,24.565,18.276,35.306,34.965c19.305,30,32.66,71.482,32.66,71.482l-0.004-0.043
+ C345.193,460.795,366.546,480,391.828,480C422.711,480,448,451.347,448,416S422.711,352,391.828,352z M391.828,448
+ c-15.42,0-27.918-14.353-27.918-32s12.498-32,27.918-32c15.418,0,27.918,14.353,27.918,32S407.246,448,391.828,448z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/search.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/search.svg
new file mode 100644
index 00000000..92fd69d9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/search.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M445,386.7l-84.8-85.9c13.8-24.1,21-50.9,21-77.9c0-87.6-71.2-158.9-158.6-158.9C135.2,64,64,135.3,64,222.9
+ c0,87.6,71.2,158.9,158.6,158.9c27.9,0,55.5-7.7,80.1-22.4l84.4,85.6c1.9,1.9,4.6,3.1,7.3,3.1c2.7,0,5.4-1.1,7.3-3.1l43.3-43.8
+ C449,397.1,449,390.7,445,386.7z M222.6,125.9c53.4,0,96.8,43.5,96.8,97c0,53.5-43.4,97-96.8,97c-53.4,0-96.8-43.5-96.8-97
+ C125.8,169.4,169.2,125.9,222.6,125.9z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/settings.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/settings.svg
new file mode 100644
index 00000000..33485603
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/settings.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M450,138.3l-47.7,48.5l-2.7,2.8l-1.6,1.7c-1.1,0.8-2.4,1.2-3.9,1.2c-1.6,0-3.1-0.6-4.3-1.6l-0.9-0.9l-2.7-2.7l-41.3-42.1
+ l-2.2-2.2l-1.7-1.7c-1-1.5-1.6-3.4-1.6-5.3c0-1.7,0.6-3.2,1.6-4.4l0.7-0.8l2.6-2.6l47.9-48.7c-5.1-10.1-24.7-14.9-35.1-14.1
+ c-17.1,1.3-34.7,7-52.8,25.5c-0.7,0.8-1.5,1.6-2.2,2.3C277.5,120,272.6,156,282.6,189c0.7,1.4,1.3,3.1,1.6,4.6
+ c1.1,5.5-0.4,10.2-4,13.5l-37.9,36.4c-11.8-12-13.5-13.6-13.5-13.6c-2-2-6-3.3-9.5-1.2l-5.9,3.6c-22.7-23.1-32.3-32.4-35.4-43.6
+ c-3.2-11.7-0.3-27.3,2.7-33.1c2.5-4.6,10.3-8.9,16.9-9.4l8.6,8.8c2,2,5.1,2,7.1,0l30.9-31.4c2-2,2-5.3,0-7.3l-49.9-50.7
+ c-2-2-5.2-2-7.1,0l-30.9,31.4c-2,2-2,5.3,0,7.3l3.3,3.4c0,4.9-0.7,12.5-4.7,16.6c-6.2,6.3-18.5-1-26.5,4.7
+ c-7.9,5.6-17.9,14.6-24.3,21c-6.3,6.4-30.5,31.8-47.8,74.6c-17.3,42.8-4,82.5,5.4,92.9c5,5.5,14.1,11.1,12.5,0.7
+ c-1.6-10.5-4.2-46.9,7.7-61.8c11.9-14.9,27.6-27.1,48-28.1c19.6-1,30.9,5.7,56.3,31.5l-2.8,5.2c-1.8,3.4-0.8,7.7,1.2,9.7
+ c0,0,1.5,1.6,12.1,12.4l-97.2,93.2c-16.2,14.3-15.3,40.5-0.3,56c15.2,15.2,41.1,16.3,55.2-0.2l91.4-98.6
+ c49.1,52.3,93.3,107.4,93.3,107.4c2,2,5.2,2,7.1,0l49.9-50.7c2-2,2-5.2,0-7.3c0,0-55.2-45.7-107-96.2l35.5-38.3
+ c3.3-3.7,7.9-5.2,13.3-4.1c1.5,0.3,3.1,1,4.5,1.7c32.4,10.2,67.8,5.2,94-19.8c0.8-0.7,1.5-1.5,2.3-2.3c18.1-18.4,23.7-36.4,25-53.8
+ C464.7,163.5,460.2,143.8,450,138.3z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/share.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/share.svg
new file mode 100644
index 00000000..f0e12669
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/share.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M352,377.9H102.4V198.2h57.5c0,0,14.1-19.7,42.7-38.2H83.2c-10.6,0-19.2,8.5-19.2,19.1v217.9c0,10.5,8.6,19.1,19.2,19.1
+ h288c10.6,0,19.2-8.5,19.2-19.1V288L352,319.4V377.9z M320,224v63.9l128-95.5L320,96v59.7C165.2,155.7,160,320,160,320
+ C203.8,248.5,236,224,320,224z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/shuffle.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/shuffle.svg
new file mode 100644
index 00000000..039ee28a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/shuffle.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M370.1,181.3H399v47.3l81-83.2L399,64v54h-28.9c-82.7,0-129.4,61.9-170.6,116.5c-37,49.1-69,95.4-120.6,95.4H32v63.3h46.9
+ c82.7,0,129.4-65.8,170.6-120.4C286.5,223.7,318.4,181.3,370.1,181.3z M153.2,217.5c3.5-4.6,7.1-9.3,10.7-14.1
+ c8.8-11.6,18-23.9,28-36.1c-29.6-27.9-65.3-48.5-113-48.5H32v63.3c0,0,13.3-0.6,46.9,0C111.4,182.8,131.8,196.2,153.2,217.5z
+ M399,330.4h-28.9c-31.5,0-55.7-15.8-78.2-39.3c-2.2,3-4.5,6-6.8,9c-9.9,13.1-20.5,27.2-32.2,41.1c30.4,29.9,67.2,52.5,117.2,52.5
+ H399V448l81-81.4l-81-83.2V330.4z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/skip-backward.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/skip-backward.svg
new file mode 100644
index 00000000..065d3443
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/skip-backward.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<path class="st0" d="M75.7,96h8.1c6.7,0,12.2,5,12.2,11.7v113.5L283.1,98.7c2.5-1.7,5.1-2.3,8.1-2.3c8.3,0,15.4,7,15.4,17v63.1
+ l118.5-78.2c2.5-1.7,5-2.3,8.1-2.3c8.3,0,14.9,7.4,14.9,17.4v286c0,10-6.7,16.5-15,16.5c-3.1,0-5.4-1.2-8.2-2.9l-118.3-77.6v64
+ c0,10-7.2,16.5-15.5,16.5c-3.1,0-5.5-1.2-8.2-2.9L96,290.8v113c0,6.7-5.4,12.2-12.2,12.2h-8.1c-6.7,0-11.7-5.5-11.7-12.2V107.7
+ C64,101,68.9,96,75.7,96z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/skip-forward.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/skip-forward.svg
new file mode 100644
index 00000000..e563a047
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/skip-forward.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<path class="st0" d="M436.3,96h-8.1c-6.7,0-12.2,5-12.2,11.7v113.5L228.9,98.7c-2.5-1.7-5.1-2.3-8.1-2.3c-8.3,0-15.4,7-15.4,17v63.1
+ L86.9,98.3c-2.5-1.7-5.1-2.3-8.1-2.3c-8.3,0-14.9,7.4-14.9,17.4v286c0,10,6.7,16.5,15,16.5c3.1,0,5.4-1.2,8.2-2.9l118.3-77.6v64
+ c0,10,7.2,16.5,15.5,16.5c3.1,0,5.5-1.2,8.2-2.9L416,290.8v113c0,6.7,5.4,12.2,12.2,12.2h8.1c6.7,0,11.7-5.5,11.7-12.2V107.7
+ C448,101,443.1,96,436.3,96z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-android-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-android-outline.svg
new file mode 100644
index 00000000..3cb896bc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-android-outline.svg
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M352,208v60.5V357h-22.5H313v15.5V424c0,4.4-3,7.9-7.3,8l0,0l-0.1,0c-0.1,0-0.2,0-0.3,0c-1.6,0-3.1-0.6-4.3-1.6l-0.1-0.1
+ l-0.4-0.1c-2-1.6-3.4-4-3.4-6.2v-51.5V357h-15.5h-49H216v15.5V424c0,4.4-3.6,8-8,8s-8-3.6-8-8v-51.5V357h-15.5H160v-88.6V208H352
+ M368,192H144v76.4V358c0,6.9,5.5,15,12.4,15H184v51c0,13.3,10.7,24,24,24s24-10.7,24-24v-51h49v51c0,7.5,3.9,14.2,9.3,18.6
+ c3.9,3.4,9.3,5.4,15,5.4c0.1,0,0.3,0,0.4,0c0.1,0-0.3,0-0.2,0c13.3,0,23.6-10.7,23.6-24v-51h28.6c7,0,10.4-8.1,10.4-14.9v-89.6
+ V192L368,192z"/>
+ <path d="M408,192c4.4,0,8,3.6,8,8v96c0,4.4-3.6,8-8,8s-8-3.6-8-8v-96C400,195.6,403.6,192,408,192 M408,176c-13.3,0-24,10.7-24,24
+ v96c0,13.3,10.7,24,24,24s24-10.7,24-24v-96C432,186.7,421.3,176,408,176L408,176z"/>
+ <path d="M104,192c4.4,0,8,3.6,8,8v96c0,4.4-3.6,8-8,8s-8-3.6-8-8v-96C96,195.6,99.6,192,104,192 M104,176c-13.3,0-24,10.7-24,24
+ v96c0,13.3,10.7,24,24,24s24-10.7,24-24v-96C128,186.7,117.3,176,104,176L104,176z"/>
+ </g>
+ <g>
+ <path d="M255,94.3l0.9,0h0h0c14.2,0,27.3,1.9,38.8,5.6l10,4.4c28.7,12.6,39.9,37.4,44.4,55.7H162.8c4.4-18.6,15.6-43.6,44.1-56
+ l10.3-4.5C228.5,96.1,241.2,94.3,255,94.3 M185.4,64c-0.5,0-1.2,0.2-1.8,0.8c-1.1,0.8-1.7,1.8-1.3,2.5l18.3,22.1
+ c-48.2,20.9-55.4,71.7-56.4,86.7h223.6c-1.1-15-8.2-65.1-56.6-86.4l18.5-22.2c0.4-0.5-0.2-1.7-1.3-2.6c-0.7-0.5-1.5-0.8-2-0.8
+ c-0.3,0-0.5,0.1-0.7,0.3l-19.2,22.7c-13.6-5.4-30.2-8.8-50.6-8.8c-0.3,0-0.6,0-1,0c-20,0-36.4,3.3-49.8,8.5l-19-22.5
+ C186.1,64.1,185.8,64,185.4,64L185.4,64z"/>
+ </g>
+</g>
+<path d="M206.6,138.9c-7.4,0-13.5-6-13.5-13.3c0-7.3,6-13.3,13.5-13.3c7.4,0,13.5,6,13.5,13.3C220.1,132.9,214.1,138.9,206.6,138.9z
+ "/>
+<path d="M305,138.9c-7.4,0-13.5-6-13.5-13.3c0-7.3,6-13.3,13.5-13.3c7.4,0,13.5,6,13.5,13.3C318.5,132.9,312.4,138.9,305,138.9z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-android.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-android.svg
new file mode 100644
index 00000000..37681c0a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-android.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M144,268.4V358c0,6.9,4.5,14,11.4,14H184v52c0,13.3,10.7,24,24,24s24-10.7,24-24v-52h49v52c0,7.5,3.4,14.2,8.8,18.6
+ c3.9,3.4,9.1,5.4,14.7,5.4c0.1,0,0.2,0,0.3,0c0.1,0,0.1,0,0.2,0c13.3,0,24-10.7,24-24v-52h27.6c7,0,11.4-7.1,11.4-13.9v-89.6V192
+ H144V268.4z"/>
+ <path d="M408,176c-13.3,0-24,10.7-24,24v96c0,13.3,10.7,24,24,24s24-10.7,24-24v-96C432,186.7,421.3,176,408,176z"/>
+ <path d="M104,176c-13.3,0-24,10.7-24,24v96c0,13.3,10.7,24,24,24s24-10.7,24-24v-96C128,186.7,117.3,176,104,176z"/>
+ </g>
+ <g>
+ <path d="M311.2,89.1l18.5-21.9c0.4-0.5-0.2-1.6-1.3-2.5c-1.1-0.8-2.4-1-2.7-0.4l-19.2,22.8c-13.6-5.4-30.2-8.8-50.6-8.8
+ c-20.5-0.1-37.2,3.2-50.8,8.5l-19-22.4c-0.4-0.5-1.6-0.4-2.7,0.4c-1.1,0.8-1.7,1.8-1.3,2.5l18.3,21.6
+ c-48.2,20.9-55.4,72.2-56.4,87.2h223.6C366.7,161,359.6,110.4,311.2,89.1z M206.8,138.9c-7.4,0-13.5-6-13.5-13.3
+ c0-7.3,6-13.3,13.5-13.3c7.4,0,13.5,6,13.5,13.3C220.3,132.9,214.3,138.9,206.8,138.9z M305.2,138.9c-7.4,0-13.5-6-13.5-13.3
+ c0-7.3,6-13.3,13.5-13.3c7.4,0,13.5,6,13.5,13.3C318.7,132.9,312.6,138.9,305.2,138.9z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-angular-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-angular-outline.svg
new file mode 100644
index 00000000..8124cc7b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-angular-outline.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M255.982,64l187.967,69.105l-39.17,230.389l-148.881,79.949l-148.812-80.051L68.031,133.11L255.982,64 M255.981,32L32,112
+ l46.12,272L256,480l177.75-96L480,112L255.981,32L255.981,32z"/>
+ <path d="M344,352h40L256,72L128,352h40l26.584-56h122.827L344,352z M213.573,256l42.419-89.356L298.419,256H213.573z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-angular.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-angular.svg
new file mode 100644
index 00000000..9ed830a3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-angular.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="213.573,256 298.419,256 255.992,166.644 "/>
+ <path d="M255.981,32L32,112l46.12,272L256,480l177.75-96L480,112L255.981,32z M344,352l-26.589-56H194.584L168,352h-40L256,72
+ l128,280H344z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-apple-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-apple-outline.svg
new file mode 100644
index 00000000..aecaec8f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-apple-outline.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M333.6,169.9c16.3,0,33.2,7.4,47.4,20.4c-9.9,8.5-17.9,18.7-23.7,30.2c-8,16-11.6,34.3-10.2,52.7
+ c1.3,18.7,7.6,36.6,18,51.8c8,11.6,18.2,21.2,30,28.3c-5,10.7-9.2,18.4-16.8,30.5c-8.4,13.1-30.5,48-52,48.2l-0.4,0
+ c-7.4,0-12.2-2.2-19.3-5.6c-10-4.7-22.3-10.6-43.4-10.6l-0.6,0c-21.1,0.1-33.8,5.9-43.9,10.6c-7.4,3.4-12.3,5.7-19.9,5.7l-0.4,0
+ c-19.6-0.2-37.5-24.3-50.8-45.2c-19.3-30.4-31.7-65.6-34.9-99.1c-2.9-30.5,2-58.5,13.5-76.7c8-12.7,18.5-23.3,30.4-30.6
+ c11.2-6.8,23-10.4,34.2-10.4c12.4,0,22.7,3.8,33.7,7.8c11.5,4.2,23.5,8.6,37.7,8.6c13.6,0,24.3-4.2,34.6-8.2
+ C308,173.9,318.2,169.9,333.6,169.9 M333.6,153.9c-33.6,0-47.8,16.5-71.2,16.5c-24,0-42.3-16.4-71.4-16.4
+ c-28.5,0-58.9,17.9-78.2,48.4c-27.1,43-22.5,124,21.4,193c15.7,24.7,36.7,52.4,64.2,52.7c0.2,0,0.3,0,0.5,0
+ c23.9,0,31-16.1,63.9-16.3c0.2,0,0.3,0,0.5,0c32.4,0,38.9,16.2,62.7,16.2c0.2,0,0.3,0,0.5,0c27.5-0.3,49.6-31,65.3-55.6
+ c11.3-17.7,15.5-26.6,24.2-46.6c-63.5-24.8-73.7-117.4-10.9-152.9C385.9,168.2,359,153.9,333.6,153.9L333.6,153.9z"/>
+ <path d="M309.9,84.5c-2.7,14.9-10.5,26.8-14.6,32.2c-7.4,9.8-18,17.4-28.8,21.1c0.5-3,1.3-6.1,2.4-9.2c3.5-10.2,8.9-18.2,12.8-23.1
+ C288.8,96.7,299.3,89.1,309.9,84.5 M326.2,64c-20,1.4-43.3,14.5-57,31.6c-12.4,15.5-22.6,38.5-18.6,60.8c0.5,0,1,0,1.6,0
+ c21.3,0,43.1-13.2,55.8-30.1C320.3,110.2,329.6,87.4,326.2,64L326.2,64z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-apple.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-apple.svg
new file mode 100644
index 00000000..68ab6482
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-apple.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M333.6,153.9c-33.6,0-47.8,16.5-71.2,16.5c-24,0-42.3-16.4-71.4-16.4c-28.5,0-58.9,17.9-78.2,48.4
+ c-27.1,43-22.5,124,21.4,193c15.7,24.7,36.7,52.4,64.2,52.7c0.2,0,0.3,0,0.5,0c23.9,0,31-16.1,63.9-16.3c0.2,0,0.3,0,0.5,0
+ c32.4,0,38.9,16.2,62.7,16.2c0.2,0,0.3,0,0.5,0c27.5-0.3,49.6-31,65.3-55.6c11.3-17.7,15.5-26.6,24.2-46.6
+ c-63.5-24.8-73.7-117.4-10.9-152.9C385.9,168.2,359,153.9,333.6,153.9L333.6,153.9z"/>
+ <path d="M326.2,64c-20,1.4-43.3,14.5-57,31.6c-12.4,15.5-22.6,38.5-18.6,60.8c0.5,0,1,0,1.6,0c21.3,0,43.1-13.2,55.8-30.1
+ C320.3,110.2,329.6,87.4,326.2,64L326.2,64z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-bitcoin-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-bitcoin-outline.svg
new file mode 100644
index 00000000..f990a441
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-bitcoin-outline.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M279.7,48v47v15.1l15.1,0.8c16.9,0.9,28.8,3.3,40.7,7.9c13.8,5.3,24.2,12.6,31.1,21.7c5.7,7.6,9,19.4,10,36.2
+ c0.6,8.8-1,17.1-2.6,22c-1.5,4.4-5.3,11.3-11.1,16.4c-5.4,4.8-8.6,6.7-12.3,8.4l-42.1,19.3l45,10.8c7.4,1.8,14,4.4,21.4,8.5
+ c13.2,7.3,18,15.1,21.2,22.5c2.9,6.7,4.6,22.2,3.9,36.2c-0.7,13.4-4.4,31.5-12.6,42.3c-8.6,11.2-21.3,20.1-37.8,26.3
+ c-13.6,5.1-31.1,8.1-54.5,9.3l-15.2,0.7v15.2V464h-8v-48v-16h-16H224h-16v16v48h-9v-48v-16h-16h-67.2l3-16h12.8
+ c8.6,0,12.1-0.4,17.5-3c0.2-0.1,0.4-0.2,0.7-0.3c8.1-3.7,11-10.6,12.2-13.6c0.1-0.3,0.3-0.7,0.3-0.8c2.9-5.9,3-13.1,3-24.4v-178
+ c0-11.7-0.1-13.6-3.1-19.5c-2.9-5.8-7.3-10.1-13.4-13c-5.9-2.8-13.2-3.4-24.5-3.4h-12.9v-16h71.6h16V96V48h9v48v16h16h31.8h16V96
+ V48H279.7 M295.7,32h-39.9v64H224V32h-40.9v64H96v48h28.4c8.7,0,14.5,0.3,17.6,1.8c3.1,1.5,4.7,3.3,6,5.8c1.3,2.5,1.4,3.1,1.4,12.3
+ v178c0,9-0.1,14.7-0.9,17.6c-1.2,2.7-2.2,5.2-5.3,6.6c-3.1,1.4-2.9,1.9-11.6,1.9h-27.4L96,416h87.1v64H224v-64h31.8v64h39.9v-65.4
+ c26-1.3,44.4-4.7,59.3-10.3c19.3-7.2,34.3-17.7,44.9-31.5c10.5-13.8,15-34.9,15.9-51.2c0.8-14.5-0.7-33.2-5.2-43.4
+ c-5-11.5-12.7-21.6-28.1-30.1c-8.1-4.5-16.1-7.8-25.4-10c5.4-2.5,9.9-5.4,16.3-11c7.5-6.6,13-15.7,15.6-23.3
+ c2.6-7.5,4.1-18,3.5-28.2c-1.1-16.8-4.4-33.1-13.2-44.8c-8.8-11.7-21.7-20.7-38.1-27c-12.6-4.8-25.5-7.8-45.5-8.9V32L295.7,32z"/>
+ <g>
+ <polygon points="256,150 224,150 224,224 256,224 256,150 "/>
+ <path d="M256,272h-32v90h32V272L256,272z"/>
+ <path d="M296,153.9v65.6c6-2.9,9.5-6.8,13.3-11.7c4.6-6,7-12.9,7-20.7c0-8.1-2.4-15-6.7-20.8C305.7,161.2,302,156.4,296,153.9
+ L296,153.9z"/>
+ <path d="M296,273.6v82.8c2-0.6,3.8-0.8,5.8-1.6c9.8-3.8,15.8-7.9,23.6-14.7c7.5-6.6,9.7-15.9,9.7-26.6c0-9.1-3.3-16.9-7.9-23.2
+ c-4.6-6.3-11.7-9.9-19.4-13.2C304.1,275.4,301,274.4,296,273.6L296,273.6z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-bitcoin.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-bitcoin.svg
new file mode 100644
index 00000000..e31622f7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-bitcoin.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M410.5,279.2c-5-11.5-12.7-21.6-28.1-30.1c-8.2-4.5-16.1-7.8-25.4-10c5.4-2.5,10-5.4,16.3-11c7.5-6.6,13.1-15.7,15.6-23.3
+ c2.6-7.5,4.1-18,3.5-28.2c-1.1-16.8-4.4-33.1-13.2-44.8c-8.8-11.7-21.2-20.7-37.6-27c-12.6-4.8-25.5-7.8-45.5-8.9V32h-40v64h-32V32
+ h-41v64H96v48h27.9c8.7,0,14.6,0.8,17.6,2.3c3.1,1.5,5.3,3.5,6.5,6c1.3,2.5,1.9,8.4,1.9,17.5V343c0,9-0.6,14.8-1.9,17.4
+ c-1.3,2.6-2,4.9-5.1,6.3c-3.1,1.4-3.2,1.3-11.8,1.3h-26.4L96,416h87v64h41v-64h32v64h40v-64.4c26-1.3,44.5-4.7,59.4-10.3
+ c19.3-7.2,34.1-17.7,44.7-31.5c10.6-13.8,14.9-34.9,15.8-51.2C416.6,308.1,415,289.4,410.5,279.2z M224,150h32v74h-32V150z M224,362
+ v-90h32v90H224z M296,153.9c6,2.5,9.9,7.5,13.8,12.7c4.3,5.7,6.5,13.3,6.5,21.4c0,7.8-2.9,14.5-7.5,20.5c-3.8,4.9-6.8,8.3-12.8,11.1
+ V153.9z M324.8,340.6c-7.8,6.9-12.3,10.1-22.1,13.8c-2,0.8-4.7,1.4-6.7,1.9v-82.8c5,0.8,7.6,1.8,11.3,3.4
+ c7.8,3.3,15.2,6.9,19.8,13.2c4.6,6.3,8,15.6,8,24.7C335.1,325.7,332.3,334,324.8,340.6z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-buffer-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-buffer-outline.svg
new file mode 100644
index 00000000..b6bef7d7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-buffer-outline.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M70.7,164.5l169.2,81.7c4.4,2.1,10.3,3.2,16.1,3.2s11.7-1.1,16.1-3.2l169.2-81.7c8.9-4.3,8.9-11.3,0-15.6L272.1,67.2
+ c-4.4-2.1-10.3-3.2-16.1-3.2s-11.7,1.1-16.1,3.2L70.7,148.9C61.8,153.2,61.8,160.2,70.7,164.5z M246.8,81.6
+ c1.6-0.8,4.9-1.6,9.2-1.6c4.3,0,7.5,0.8,9.2,1.6l155.5,75.1l-155.5,75.1c-1.6,0.8-4.9,1.6-9.2,1.6c-4.3,0-7.5-0.8-9.2-1.6
+ L91.3,156.7L246.8,81.6z"/>
+ <path d="M441.3,248.2c0,0-30.9-14.9-35-16.9s-5.2-1.9-9.5,0.1s-124.8,60.2-124.8,60.2c-4.5,2.1-10.3,3.2-16.1,3.2
+ s-11.7-1.1-16.1-3.2c0,0-117.3-56.6-122.8-59.3c-6-2.9-7.7-2.9-13.1-0.3c-5.6,2.7-33.4,16.1-33.4,16.1c-8.9,4.3-8.9,11.3,0,15.6
+ l169.2,81.7c4.4,2.1,10.3,3.2,16.1,3.2s11.7-1.1,16.1-3.2l169.2-81.7C450.2,259.5,450.2,252.5,441.3,248.2z M265.2,331.1
+ c-1.6,0.8-4.9,1.6-9.2,1.6c-4.3,0-7.5-0.8-9.2-1.6L91.3,256l18.9-9.1l122.7,59.3c6.4,3.1,14.6,4.8,23.1,4.8s16.6-1.7,23.1-4.8
+ l122.7-59.3l18.9,9.1L265.2,331.1z"/>
+ </g>
+ <path d="M441.3,347.5c0,0-30.9-14.9-35-16.9s-5.2-1.9-9.5,0.1S272.1,391,272.1,391c-4.5,2.1-10.3,3.2-16.1,3.2s-11.7-1.1-16.1-3.2
+ c0,0-117.3-56.6-122.8-59.3c-6-2.9-7.7-2.9-13.1-0.3c-5.6,2.7-33.4,16.1-33.4,16.1c-8.9,4.3-8.9,11.3,0,15.6l169.2,81.7
+ c4.4,2.2,10.3,3.2,16.1,3.2s11.7-1.1,16.1-3.2l169.2-81.7C450.2,358.8,450.2,351.8,441.3,347.5z M265.2,430.4
+ c-1.6,0.8-4.9,1.6-9.2,1.6c-4.3,0-7.5-0.8-9.2-1.6L91.3,355.3l18.9-9.1l122.7,59.3c6.4,3.1,14.6,4.8,23.1,4.8s16.6-1.7,23.1-4.8
+ l122.7-59.3l18.9,9.1L265.2,430.4z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-buffer.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-buffer.svg
new file mode 100644
index 00000000..595b1410
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-buffer.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M70.7,164.5l169.2,81.7c4.4,2.1,10.3,3.2,16.1,3.2s11.7-1.1,16.1-3.2l169.2-81.7c8.9-4.3,8.9-11.3,0-15.6L272.1,67.2
+ c-4.4-2.1-10.3-3.2-16.1-3.2s-11.7,1.1-16.1,3.2L70.7,148.9C61.8,153.2,61.8,160.2,70.7,164.5z"/>
+ <path d="M441.3,248.2c0,0-30.9-14.9-35-16.9s-5.2-1.9-9.5,0.1s-124.8,60.2-124.8,60.2c-4.5,2.1-10.3,3.2-16.1,3.2
+ s-11.7-1.1-16.1-3.2c0,0-117.3-56.6-122.8-59.3c-6-2.9-7.7-2.9-13.1-0.3c-5.6,2.7-33.4,16.1-33.4,16.1c-8.9,4.3-8.9,11.3,0,15.6
+ l169.2,81.7c4.4,2.1,10.3,3.2,16.1,3.2s11.7-1.1,16.1-3.2l169.2-81.7C450.2,259.5,450.2,252.5,441.3,248.2z"/>
+ </g>
+ <path d="M441.3,347.5c0,0-30.9-14.9-35-16.9s-5.2-1.9-9.5,0.1S272.1,391,272.1,391c-4.5,2.1-10.3,3.2-16.1,3.2s-11.7-1.1-16.1-3.2
+ c0,0-117.3-56.6-122.8-59.3c-6-2.9-7.7-2.9-13.1-0.3c-5.6,2.7-33.4,16.1-33.4,16.1c-8.9,4.3-8.9,11.3,0,15.6l169.2,81.7
+ c4.4,2.2,10.3,3.2,16.1,3.2s11.7-1.1,16.1-3.2l169.2-81.7C450.2,358.8,450.2,351.8,441.3,347.5z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-chrome-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-chrome-outline.svg
new file mode 100644
index 00000000..161af4d1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-chrome-outline.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g id="Icon">
+ <g>
+ <path d="M256,32C132.8,32,32,132.8,32,256s100.8,224,224,224s224-100.8,224-224S379.2,32,256,32z M256,76.799
+ c66.084,0,124.315,35.843,154.558,89.602H256c-43.685,0-79.517,31.358-87.358,71.684l-53.758-92.969
+ C147.358,103.685,198.884,76.799,256,76.799z M323.2,256c0,36.957-30.243,67.2-67.2,67.2s-67.2-30.243-67.2-67.2
+ s30.243-67.2,67.2-67.2S323.2,219.043,323.2,256z M76.799,256c0-32.484,8.958-62.716,24.644-89.6L178.715,300.8l0,0
+ c15.685,26.885,43.685,44.8,77.285,44.8c10.085,0,20.157-2.241,29.116-5.6l-53.758,92.958C144,421.758,76.799,346.715,76.799,256z
+ M256,435.201L333.285,300.8l0,0c7.831-13.442,12.314-28,12.314-44.8c0-26.885-12.314-50.399-31.358-67.2h107.517
+ c8.957,21.284,13.443,43.685,13.443,67.2C435.201,354.557,354.557,435.201,256,435.201z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-chrome.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-chrome.svg
new file mode 100644
index 00000000..7ee33d6c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-chrome.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M188.8,255.925c0,36.946,30.243,67.178,67.2,67.178s67.199-30.231,67.199-67.178c0-36.945-30.242-67.179-67.199-67.179
+ S188.8,218.98,188.8,255.925z"/>
+ <path d="M476.752,217.795c-0.009,0.005-0.016,0.038-0.024,0.042c-1.701-9.877-4.04-19.838-6.989-28.838h-0.107
+ c2.983,9,5.352,19,7.072,29h-0.002c-1.719-10-4.088-20-7.07-29h-155.39c19.044,17,31.358,40.175,31.358,67.052
+ c0,16.796-4.484,31.284-12.314,44.724L231.044,478.452c0,0-0.009,0.264-0.014,0.264l-0.01,0.284c0.005,0,0.009,0,0.015,0
+ l-0.005-0.262c8.203,0.92,16.531,1.262,24.97,1.262c6.842,0,13.609-0.393,20.299-1.002c10.135-0.911,20.077-2.519,29.777-4.733
+ C405.68,451.525,480,362.404,480,255.941C480,242.942,478.879,230.188,476.752,217.795z"/>
+ <path d="M256,345.496c-33.601,0-61.601-17.91-77.285-44.785L76.006,123.047l-0.137-0.236
+ c-10.293,13.896-19.015,29.022-25.903,45.123C38.407,194.945,32,224.686,32,255.925c0,62.695,25.784,119.36,67.316,160.009
+ c29.342,28.719,66.545,49.433,108.088,58.619l0.029-0.051l77.683-134.604C276.157,343.256,266.085,345.496,256,345.496z"/>
+ <path d="M91.292,104.575l77.35,133.25C176.483,197.513,212.315,166,256,166h205.172c-6.921-15-15.594-30.324-25.779-43.938
+ c0.039,0.021,0.078,0.053,0.117,0.074C445.644,135.712,454.278,151,461.172,166h0.172c-6.884-15-15.514-30.38-25.668-43.99
+ c-0.115-0.06-0.229-0.168-0.342-0.257C394.475,67.267,329.359,32,256,32c-26.372,0-51.673,4.569-75.172,12.936
+ c-34.615,12.327-65.303,32.917-89.687,59.406l0.142,0.243C91.286,104.581,91.289,104.578,91.292,104.575z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-codepen-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-codepen-outline.svg
new file mode 100644
index 00000000..a76d0235
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-codepen-outline.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M387.547,203.724c-41.135-27.326-82.225-54.721-123.261-82.195
+ c-5.844-3.912-11.12-3.802-16.938,0.095c-40.785,27.313-81.818,54.546-122.724,81.676c-5.103,3.384-7.624,7.575-7.624,13.716
+ v79.729c0,6.174,2.484,10.342,7.594,13.73c40.906,27.13,81.841,54.361,122.625,81.676c5.81,3.891,11.131,4.055,16.984,0.137
+ c41.035-27.474,82.145-54.873,123.286-82.188c4.858-3.226,7.511-7.309,7.511-13.094v-80.623
+ C395,210.667,392.225,206.83,387.547,203.724z M268,152.484l93.055,62.218l-39.751,26.467c-0.919,0.603-2.923,0.604-3.839,0
+ c-15.944-10.501-31.816-21.113-47.627-31.815c-1.033-0.699-1.828-2.319-1.838-3.52V152.484z M244,152.765v51.706
+ c-0.024,1.825-1.313,4.316-2.799,5.334c-15.258,10.451-30.655,20.701-46.109,30.86c-1.17,0.77-3.547,1.148-4.566,0.485
+ c-13.116-8.531-26.087-17.284-39.787-26.443C181.967,193.889,244,152.765,244,152.765z M141,237.116l29.622,19.771L141,276.725
+ V237.116z M244,361.317c0,0-62.034-41.412-93.196-62.187l38.871-26.154c2.072-1.442,3.473-1.344,5.502,0.029
+ c15.32,10.36,30.74,20.572,46.062,30.93c1.208,0.815,2.749,2.371,2.761,3.596V361.317z M258.949,282.892
+ c-1.824,1.108-4.512,1.046-6.26-0.111l-38.842-25.865c0,0,17.108-11.493,25.356-17.023c4.701-3.152,9.346-6.393,14.164-9.355
+ c1.132-0.696,3.532-0.97,4.743-0.168c5.773,3.829,39.854,26.53,39.854,26.53L258.949,282.892z M268,361.102v-51.346
+ c-0.026-2.871,0.449-4.602,2.861-6.189c15.198-10.006,30.332-20.11,45.386-30.332c2.335-1.586,3.92-1.623,6.265-0.019
+ l38.527,25.882L268,361.102z M370,276.676l-29.59-19.743L370,237.06V276.676z"/>
+ <path d="M256,64c51.285,0,99.5,19.972,135.765,56.235C428.028,156.5,448,204.715,448,256s-19.972,99.5-56.235,135.765
+ C355.5,428.028,307.285,448,256,448s-99.5-19.972-135.765-56.235C83.972,355.5,64,307.285,64,256s19.972-99.5,56.235-135.765
+ C156.5,83.972,204.715,64,256,64 M256,32C132.288,32,32,132.288,32,256s100.288,224,224,224s224-100.288,224-224S379.712,32,256,32
+ L256,32z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-codepen.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-codepen.svg
new file mode 100644
index 00000000..5f56bfbb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-codepen.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M241.239,303.936c-15.322-10.357-30.742-20.569-46.062-30.93c-2.03-1.373-3.43-1.472-5.502-0.029l-38.871,26.154
+ C181.966,319.905,244,361.317,244,361.317v-53.786C243.988,306.307,242.447,304.751,241.239,303.936z"/>
+ <path d="M195.092,240.666c15.454-10.16,30.851-20.409,46.109-30.86c1.486-1.018,2.775-3.509,2.799-5.334v-51.706
+ c0,0-62.033,41.124-93.262,61.942c13.7,9.159,26.671,17.913,39.787,26.443C191.545,241.813,193.921,241.435,195.092,240.666z"/>
+ <path d="M269.838,209.354c15.811,10.703,31.683,21.314,47.627,31.815c0.916,0.604,2.92,0.602,3.839,0l39.751-26.467L268,152.484
+ v53.35C268.01,207.035,268.805,208.655,269.838,209.354z"/>
+ <path d="M258.109,230.369c-1.21-0.802-3.611-0.528-4.743,0.168c-4.817,2.962-9.463,6.203-14.164,9.355
+ c-8.248,5.53-25.356,17.023-25.356,17.023l38.842,25.865c1.748,1.157,4.436,1.22,6.26,0.111l39.014-25.993
+ C297.963,256.898,263.883,234.197,258.109,230.369z"/>
+ <polygon points="141,237.116 141,276.725 170.622,256.887 "/>
+ <path d="M256,32C132.288,32,32,132.288,32,256s100.288,224,224,224s224-100.288,224-224S379.712,32,256,32z M395,297.006
+ c0,5.785-2.652,9.868-7.511,13.094c-41.142,27.314-82.251,54.714-123.286,82.188c-5.854,3.918-11.174,3.754-16.984-0.137
+ c-40.783-27.314-81.719-54.546-122.625-81.676c-5.11-3.389-7.594-7.557-7.594-13.73v-79.729c0-6.141,2.521-10.332,7.624-13.716
+ c40.906-27.13,81.939-54.363,122.724-81.676c5.818-3.896,11.094-4.007,16.938-0.095c41.036,27.474,82.126,54.869,123.261,82.195
+ c4.678,3.106,7.453,6.943,7.453,12.66V297.006z"/>
+ <path d="M316.247,273.234c-15.054,10.222-30.188,20.326-45.386,30.332c-2.412,1.588-2.888,3.318-2.861,6.189v51.346l93.039-62.004
+ l-38.527-25.882C320.167,271.611,318.582,271.648,316.247,273.234z"/>
+ <polygon points="370,276.676 370,237.06 340.41,256.933 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-css3-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-css3-outline.svg
new file mode 100644
index 00000000..37c25cf1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-css3-outline.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M354.676,366.898l-98.608,28.125l-98.458-28.248L150.864,289h48.253l3.433,39.563l53.586,15.163l0.132,0.273h0.034
+ l53.467-14.852L315.381,265H203l-4-50h120.646l4.396-51H140l-4-49h240.58L354.676,366.898z"/>
+ <path d="M64,32l34.936,403.301L255.769,480l157.245-44.705L448,32H64z M383.041,410.51l-127.262,36.187l-126.867-36.169L98.896,64
+ H413.1L383.041,410.51z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-css3.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-css3.svg
new file mode 100644
index 00000000..df8a1d0a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-css3.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g transform="translate(336 96)">
+ <g id="icon-css3">
+ <path d="M-79.718,243.488L-79.718,243.488z"/>
+ <path d="M-272-64l34.946,403.219L-80.233,384l157.259-44.85L112-64H-272z M18.676,270.898l-98.607,28.125l-98.458-28.248
+ L-185.136,193h48.253l3.433,39.562l53.586,15.163l0.132,0.273h0.034l53.467-14.852L-20.619,169H-133l-4-50h120.646l4.396-51H-196
+ l-4-49H40.58L18.676,270.898z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-designernews-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-designernews-outline.svg
new file mode 100644
index 00000000..82b63233
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-designernews-outline.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="290.9,145.9 226.5,96 291.1,198.8 "/>
+ <g>
+ <path d="M32.5,260"/>
+ <path d="M329,96v80.3V260h-35.9l-63.2-98l1.7,98H191V152.9l-37.1-29.1c1,1.2,2.1,2.4,3,3.6c10,13.8,15,30.7,15,50.5
+ c0,48.9-30.5,82-76.8,82H32l200.1,156H480V214.7L329,96z M464,400H237.7L78.6,276h16.5c13.5,0,26.2-2.7,37.7-7.4
+ c11.5-4.7,21.4-11.8,29.8-20.7c4.8-5.1,9.4-11,12.4-17.1v28.7V276h16.2h40.4H248l-0.3-16.5l-0.7-41.9l32.6,50.7l4.7,7.6h8.8h36.8
+ H345v-16.5v-83.1v-47l0.2,0.3L464,222.4V400z"/>
+ </g>
+ <path d="M90.6,150.4c11,0,23.7,3.2,23.7,28.8c0,6.9-1,16.3-6,21.8c-3.6,3.9-9.6,6-17.7,6H87v-57h3 M90.7,134H71v89h19.5
+ c26,0,39.9-15.6,39.9-43.9C130.4,150.3,116.1,134,90.7,134L90.7,134z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-designernews.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-designernews.svg
new file mode 100644
index 00000000..a8edefc9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-designernews.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <polygon points="290.4,145 227,96 290.6,198.2 "/>
+ </g>
+ <g>
+ <path d="M329,96v79.6V259h-36.4l-63.2-98.6l1.7,98.6H191V152l-37.3-29.3c1,1.2,2,2.4,2.9,3.7c10,13.9,15,30.5,15,50.5
+ c0,49.2-30.6,82.1-76.9,82.1H32v0.4L231.6,416H480V214.1L329,96z"/>
+ </g>
+ <g>
+ <path d="M129.9,178.1c0-29-14.2-45.1-39.7-45.1H71v89h19C116,222,129.9,206.6,129.9,178.1z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dribbble-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dribbble-outline.svg
new file mode 100644
index 00000000..92477c8c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dribbble-outline.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,64C150,64,64,150,64,256c0,106.1,86,192,192,192s192-85.9,192-192C448,150,362,64,256,64z M377.9,152.5
+ c21.6,25.4,35.3,57.6,37.7,92.9c-34.6-1.8-76-1.8-109.2,1.3c-4.2-10.6-8.5-21-13.2-31C331.5,199.1,361,177.3,377.9,152.5z M256,96
+ c38.8,0,74.4,13.8,102.1,36.8c-17.4,22-44.7,41.1-78.7,55.6c-18.6-34.4-40-64-62.8-87.3C229.3,97.9,242.4,96,256,96z M183.6,113.5
+ c23.1,23,44.8,52.3,63.8,86.6c-36.1,11-77.5,17.3-121.7,17.3c-8.4,0-16.6-0.3-24.7-0.8C112.5,171.5,143,134.1,183.6,113.5z
+ M96.3,248.4c9.1,0.4,18.3,0.6,27.6,0.5c50.4-0.6,97.3-8.5,137.6-21.4c3.8,7.9,7.4,16,10.8,24.3c-5.5,1.3-10.4,2.7-14.3,4.3
+ c-55.1,23.1-98.5,60.4-122,105.5c-24.8-28.2-40-65.1-40-105.6C96,253.4,96.1,250.9,96.3,248.4z M256,416c-37,0-71-12.6-98.1-33.7
+ c21.3-42.2,59.3-77.1,107.2-98.8c4.5-2.1,10.5-3.8,17.4-5.3c5.7,15.8,10.8,32.2,15.3,49.2c6.9,26.5,11.8,52.7,14.8,78.1
+ C295,412.2,276,416,256,416z M342.5,390.5c-3-25.7-7.9-52.1-14.9-78.9c-3.4-13-7.3-25.6-11.5-37.9c31.4-2.6,69-2.2,98.9,0
+ C409.6,322.8,382,365,342.5,390.5z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dribbble.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dribbble.svg
new file mode 100644
index 00000000..8cfe9742
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dribbble.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M256,64C150,64,64,150,64,256c0,106.1,86,192,192,192s192-85.9,192-192C448,150,362,64,256,64z M256,415.5
+ c-88.1,0-159.5-71.4-159.5-159.5c0-88.1,71.4-159.5,159.5-159.5c88.1,0,159.5,71.4,159.5,159.5C415.5,344.1,344.1,415.5,256,415.5
+ z"/>
+ </g>
+ <g>
+ <path d="M306.3,246.7c23.4-2.2,50.9-2.9,77.2-2.4c-2.3-25.4-12-48.7-27-67.6c-16.5,14.9-38,28.1-63.3,39
+ C297.8,225.7,302.1,236.1,306.3,246.7z"/>
+ <path d="M335.4,155.6C313.6,138.3,286,128,256,128c-5.1,0-10.2,0.3-15.2,0.9c13.8,17.7,26.7,37.6,38.6,59.5
+ C301.1,179.2,320,168.1,335.4,155.6z"/>
+ <path d="M205.9,138.2c-34.1,14.5-60.7,43.4-72,79.1c41.1-0.7,79.6-7,113.4-17.3C234.7,177,220.7,156.3,205.9,138.2z"/>
+ <path d="M383,272.2c-22.3-0.6-46-0.2-66.9,1.5c4.1,12.3,8.1,24.9,11.5,37.9c3.8,14.6,7,29.1,9.6,43.4
+ C361.8,334.7,378.8,305.4,383,272.2z"/>
+ <path d="M258,256.1c3.9-1.6,8.8-3,14.3-4.3c-3.4-8.3-7.1-16.4-10.8-24.3c-39.1,12.6-84.6,20.3-133.3,21.3
+ c-0.1,2.4-0.2,4.8-0.2,7.3c0,29.1,9.7,55.9,26,77.4C178.9,301,214.9,274.2,258,256.1z"/>
+ <path d="M282.6,278.2c-6.9,1.5-12.9,3.2-17.4,5.3c-37.1,16.8-68.3,41.6-90.4,71.5c22.1,18.2,50.4,29,81.2,29
+ c18.5,0,36-3.9,51.8-10.9c-2.7-15.1-6-30.3-10-45.7C293.4,310.5,288.2,294,282.6,278.2z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dropbox-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dropbox-outline.svg
new file mode 100644
index 00000000..7f0f67bd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dropbox-outline.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M177,77.1L64,151l78.3,63L256,143.2L177,77.1z M91.4,153.3l84.5-56.8l52.9,46L143.4,195L91.4,153.3z"/>
+ <path d="M369.8,213L256,284.1l79,66.1l19-12.6v20.2L256,417l-98-58.5V338l19,12.2l79-66.1L142.2,213L64,276.3l78,51.5v39.4
+ l114,67.8l114-68.5v-39.2l78-51.2L369.8,213z M143.4,230.9l85.4,55.4l-52.9,44.1l-84.5-55.8L143.4,230.9z M283.2,286.3l85.4-55.4
+ l52.1,43.6l-84.5,55.8L283.2,286.3z"/>
+ <path d="M448,151L335,77.1l-79,66.1l113.8,70.8L448,151z M283.2,142.6l52.9-46l84.5,56.8L368.6,195L283.2,142.6z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dropbox.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dropbox.svg
new file mode 100644
index 00000000..df15e205
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dropbox.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="177,77 64,150.9 142.1,213.6 256,143.1 "/>
+ <polygon points="64,276.3 177,350.2 256,284.1 142.1,213.6 "/>
+ <polygon points="256,284.1 335,350.2 448,276.3 369.9,213.6 "/>
+ <polygon points="448,150.9 335,77 256,143.1 369.9,213.6 "/>
+ <polygon points="256.2,298.3 176.4,364.3 142,342.1 142,367 256,435 370,367 370,342.1 335.8,364.3 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-euro-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-euro-outline.svg
new file mode 100644
index 00000000..91fcf4a2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-euro-outline.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M310.143,64c31.337,0,59.096,2.607,88.137,8.364l-5.06,34.148c-29.405-4.319-55.659-6.429-79.853-6.429
+ c-35.025,0-58.535,6.153-74.129,19.365C220.142,135.627,218,158.428,218,174.17v2.33V193h15.867h120.184l-2.383,16H233.867H218
+ v15.5v48V289h15.867h105.885l-2.384,16H233.867H218v15.5v12.33c0,19.546,2.338,44.061,21.084,60.274
+ c15.042,13.01,37.921,18.812,74.258,18.812c24.534,0,50.197-2.055,79.771-6.42l5.014,34.138
+ c-29.031,5.759-56.741,8.366-87.977,8.366c-52.591,0-91.43-9.08-115.565-26.987C172.615,404.711,162,380.361,162,346.57V320.5V305
+ h-16.133H112v-16h33.867H162v-16.5v-48V209h-16.133H112v-16h33.867H162v-16.5v-11.07c0-33.791,10.613-58.142,32.582-74.442
+ C218.715,73.08,257.552,64,310.143,64 M310.209,48C195.479,48,146,89.225,146,165.43V177H96v48h50v48H96v48h50v25.57
+ C146,422.774,195.481,464,310.211,464c35.25,0,67.777-3.123,105.789-11.866l-9.411-64.96c-37.323,6.244-66.942,8.742-93.206,8.742
+ c-64.275,0-79.383-18.739-79.383-63.086V321h117.162l7.148-48H234v-48h131.461l7.149-48H234v-2.83
+ c0-35.92,15.159-58.086,79.434-58.086c26.264,0,55.959,2.498,93.281,8.742L416,60C377.988,51.257,345.458,48,310.209,48L310.209,48
+ z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-euro.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-euro.svg
new file mode 100644
index 00000000..7609507d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-euro.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M234,272v-48h131.094l7.149-48H234v-1.83c0-35.92,14.975-58.086,79.25-58.086c26.264,0,55.867,2.498,93.189,8.742
+ L416,59.866C377.988,51.123,345.306,48,310.057,48C195.326,48,146,89.225,146,165.43V176H96v48h50v48H96v48h50v26.57
+ C146,422.774,195.297,464,310.027,464c35.25,0,67.848-3.123,105.859-11.866l-9.619-64.96c-37.322,6.244-66.781,8.742-93.045,8.742
+ c-64.276,0-79.223-18.739-79.223-63.086V320h116.795l7.148-48H234z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-facebook-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-facebook-outline.svg
new file mode 100644
index 00000000..d50fae4a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-facebook-outline.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M288,192v-38.1c0-17.2,3.8-25.9,30.5-25.9H352V64h-55.9c-68.5,0-91.1,31.4-91.1,85.3V192h-45v64h45v192h83V256h56.4l7.6-64
+ H288z M330.2,240h-41.1H272v15.5V432h-51V255.5V240h-14.9H176v-32h30.1H221v-16.5v-42.2c0-24.5,5.4-41.2,15.5-51.8
+ C247.7,85.5,267.6,80,296.1,80H336v32h-17.5c-12,0-27.5,1.1-37.1,11.7c-8.1,9-9.4,20.1-9.4,30.1v37.6V208h17.1H334L330.2,240z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-facebook.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-facebook.svg
new file mode 100644
index 00000000..ae3d5ed8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-facebook.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M288,192v-38.1c0-17.2,3.8-25.9,30.5-25.9H352V64h-55.9c-68.5,0-91.1,31.4-91.1,85.3V192h-45v64h45v192h83V256h56.4l7.6-64
+ H288z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-foursquare-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-foursquare-outline.svg
new file mode 100644
index 00000000..43959e11
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-foursquare-outline.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M398.484,164.452l-27.399,137.185C372.848,294.486,386.545,224.793,398.484,164.452z"/>
+ <path d="M376.764,32c0,0-205.353,0-238.223,0C105.666,32,96,56.798,96,72.414c0,15.627,0,379.64,0,379.64
+ c0,17.591,9.425,24.117,14.718,26.267c5.299,2.155,19.916,3.971,28.673-6.168c0,0,112.469-131.09,114.4-133.027
+ c2.921-2.931,2.921-3.125,5.844-3.125c5.843,0,49.192,0,72.766,0c30.575,0,35.49-21.676,38.684-34.559l27.399-137.087
+ c6.074-30.702,11.693-58.938,15.053-75.325C421.143,51.944,411.744,32,376.764,32z M376.426,96c0,0-31.575,156.209-36.034,176.834
+ C335,297.771,332.75,304,307,304c-17.605,0-62.375,0-62.375,0c-2.747,0-3.868-0.147-6.049,2.041
+ c-1.443,1.447-78.168,89.562-78.168,89.562c-19.034,23.396-26.909,31.795-29.033,31.795s-3.375,0-3.375-38.408V91.708
+ C128,67.034,128.3,64,157.198,64C181.748,64,352,64,352,64C382,64,382.834,64.833,376.426,96z"/>
+ <path d="M398.484,164.452l15.053-75.374C410.178,105.466,404.559,133.75,398.484,164.452z"/>
+ <path d="M328.573,96c-5.571,0-157.995,0-157.995,0C164.091,96,160,101.594,160,106.586v231.255c0,0.67,0.402,0.975,0.935,0.36
+ c0,0,48.202-55.725,54.056-63.021c5.848-7.289,8.491-8.182,17.233-8.182c0,0,56.695,0,62.212,0c6.549,0,10.24-5.75,10.913-8.982
+ c0.671-3.228,10.536-48.213,11.732-54.119c1.191-5.897-4.214-11.898-9.722-11.898c-5.5,0-64.805,0-64.805,0
+ c-7.803,0-7.554-5.653-7.554-13.476v-5.512c0-7.815-0.282-13.012,7.516-13.012c0,0,70.403,0,75.313,0
+ c4.911,0,10.208-4.442,11.102-8.662l8.468-44.042C338.739,100.823,333.828,96,328.573,96z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-foursquare.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-foursquare.svg
new file mode 100644
index 00000000..840febfc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-foursquare.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M376.764,32c0,0-205.353,0-238.223,0C105.666,32,96,56.798,96,72.414c0,15.627,0,379.64,0,379.64
+ c0,17.591,9.425,24.117,14.718,26.267c5.299,2.155,19.916,3.971,28.673-6.168c0,0,112.469-130.895,114.4-132.834
+ c2.921-2.93,2.921-2.93,5.844-2.93c5.844,0,49.192,0,72.767,0c30.574,0,35.49-21.869,38.684-34.752
+ c2.659-10.789,32.489-163.962,42.452-212.559C421.143,51.993,411.745,32,376.764,32z M371.086,301.637
+ c2.659-10.789,32.489-163.962,42.452-212.559 M362.692,96.67l-9.999,51.734c-1.195,5.65-8.287,11.595-14.863,11.595
+ c-6.575,0-95.917,0-95.917,0C231.473,160,224,166.138,224,176.602v13.448c0,10.473,7.519,17.894,17.965,17.894
+ c0,0,74.482,0,81.848,0c7.374,0,14.61,8.109,13.016,16.005c-1.602,7.908-9.086,46.569-9.984,50.89
+ c-0.902,4.328-5.845,11.725-14.611,11.725c-7.388,0-64.269,0-64.269,0c-11.705,0-15.244,1.533-23.074,11.293
+ c-7.837,9.77-78.256,94.592-78.256,94.592c-0.713,0.822-1.41,0.584-1.41-0.312V95.896c0-6.684,5.793-14.523,14.479-14.523
+ c0,0,183.713,0,191.173,0C357.912,81.372,364.488,88.004,362.692,96.67z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-freebsd-devil.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-freebsd-devil.svg
new file mode 100644
index 00000000..4f7b5ed7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-freebsd-devil.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<path class="st0" d="M502.6,115c-22.5-43.7-58-51-58-51s15.5,32,16,51c0.4,16.1-5.5,28-27.2,33.5s-30.8-2-47.8-17.5
+ S344,104.5,313,103c-40-2-77,9-77,9c-20-25,20-80,20-80c-74.5,29.5-93.7,83.3-96,113.7c-1.9,24.1,8.5,40.8,8.5,40.8s-0.5,27.8-5,42
+ c-3.1,9.8-16.9,25-26,34.5c-12.2,12.7-12.5,38.5,0,57s44,27.5,67,39.5s31.5,21,31.5,21s1,8.3,0.5,15.3s-3.2,14-9,18.2
+ c-5.5,3.9-15.5,0.5-20.5-2s-5-6.2-10.5-8s-7.3-4-6.5-11s2-9-3.5-18.5s-18.5-9.5-29.5-8s-17.3,6.8-17.3,6.8l-16.3-10
+ c0,0,8.5-15.6,5.2-35.6c-7.3-43.8-50-62.8-50-62.8l10.4,44.4c0,0,1.1-2.6,6.4-6.4s8.1-3.6,8.1-3.6s6.6,7.6,9.1,25.3
+ c2.5,18-6.7,27.2-6.7,27.2l-28.3-18l1-14.5L39.8,309L56,345.7l15-4l24,22.7c0,0-15.7,11.7-33,11.7c-11,0-22-6-22-6s-1.4-1-0.8-5.5
+ c0.7-5,6.8-12.5,6.8-12.5H0c0,0,27.3,38.7,65,38.7c31,0,44.2-12.5,44.2-12.5L128,397c0,0,3,5.5,0,7s-7,3.5-9,15s18,29,18,29
+ c21.8,17.8,7,32,7,32h272c-9-13-22.5-18-32-32c0,0-44.8-58.4-1.8-90.4c57.4-42.7,42.8-69.4,41.2-101.4c0,0,31.8-6.6,59.3-33.6
+ S521.6,151.8,502.6,115z M195,203c-16.9,4.5-22.5,35.5-22.5,35.5c1.5-63,57.5-93,65-89s-6.5,39-21,64
+ C216.5,213.5,208.5,199.4,195,203z M232,218c0,0,18-56,37.5-59.5s41.5,21,41.5,62s-26,65.4-42.8,69.2c-16.5,3.8-23,2-23,2
+ s27.5-21.6,23.5-56.8C265.9,210.2,237.3,210.7,232,218z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-github-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-github-outline.svg
new file mode 100644
index 00000000..4e0257a4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-github-outline.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,32C132.3,32,32,134.9,32,261.7c0,101.5,64.2,187.5,153.2,217.9c1.4,0.3,2.6,0.4,3.8,0.4c8.3,0,11.5-6.1,11.5-11.4
+ c0-5.5-0.2-19.9-0.3-39.1c-8.4,1.9-15.9,2.7-22.6,2.7c-43.1,0-52.9-33.5-52.9-33.5c-10.2-26.5-24.9-33.6-24.9-33.6
+ c-19.5-13.7-0.1-14.1,1.4-14.1c0.1,0,0.1,0,0.1,0c22.5,2,34.3,23.8,34.3,23.8c11.2,19.6,26.2,25.1,39.6,25.1c10.5,0,20-3.4,25.6-6
+ c2-14.8,7.8-24.9,14.2-30.7c-49.7-5.8-102-25.5-102-113.5c0-25.1,8.7-45.6,23-61.6c-2.3-5.8-10-29.2,2.2-60.8c0,0,1.6-0.5,5-0.5
+ c8.1,0,26.4,3.1,56.6,24.1c17.9-5.1,37-7.6,56.1-7.7c19,0.1,38.2,2.6,56.1,7.7c30.2-21,48.5-24.1,56.6-24.1c3.4,0,5,0.5,5,0.5
+ c12.2,31.6,4.5,55,2.2,60.8c14.3,16.1,23,36.6,23,61.6c0,88.2-52.4,107.6-102.3,113.3c8,7.1,15.2,21.1,15.2,42.5
+ c0,30.7-0.3,55.5-0.3,63c0,5.4,3.1,11.5,11.4,11.5c1.2,0,2.6-0.1,4-0.4C415.9,449.2,480,363.1,480,261.7C480,134.9,379.7,32,256,32z
+ M177.6,448.1c2.2,0,4.4-0.1,6.7-0.2c0,2.8,0,5.5,0.1,7.9c0,2.4,0,4.6,0.1,6.5c-15.6-5.8-30.3-13.5-44.1-23
+ C150.2,444.6,162.5,448.1,177.6,448.1z M189,375.2c-0.8,2.2-1.5,4.5-2.1,6.9c-3.4,1-7.5,1.8-11.7,1.8c-10.9,0-19-5.4-25.6-16.9
+ c-2.4-4.6-6.8-10.7-12.9-16.3C153.5,364.8,173,371.6,189,375.2z M379,434.1c-15.8,11.9-33,21.3-51,28.2c0-1.9,0-4.1,0-6.5
+ c0-11.9,0-29.8,0-50.4c0-12.4-2.1-22.5-5-30.5c37.2-8.3,92-33.7,92-125.4c0-24.6-7.1-46.5-21.2-65.1c3.1-12.9,5.5-35.6-5.1-63
+ l-2.7-7.1l-7.2-2.4c-1.5-0.5-4.8-1.3-10-1.3c-11.5,0-30.9,4.1-59.5,22.8c-17-4.2-34.8-6.4-53.1-6.4H256h-0.1
+ c-18.3,0-36.2,2.2-53.1,6.4c-28.6-18.7-48-22.8-59.5-22.8c-5.2,0-8.5,0.9-10,1.4l-7.2,2.4l-2.7,7.1c-10.6,27.5-8.2,50.2-5.1,63
+ c-14.1,18.7-21.2,40.6-21.2,65.1c0,49.6,16,79.9,36.6,98.5c-8.1-6.6-18.6-12.1-31.2-13H102h-0.5h-0.3c-13.1,0-22.3,5.4-25.2,14.7
+ c-4.7,14.8,9.8,25,14.6,28.4l0.5,0.6l1.5,0.6c1.6,1,10.1,7,16.9,24.5c2,6.2,6.3,14.5,13.6,22.2c-13.1-11.2-24.8-24-34.9-38.1
+ C61.9,351.2,48,307.5,48,261.7c0-28.9,5.5-56.9,16.4-83.3c10.5-25.5,25.5-48.3,44.7-67.9c19.1-19.6,41.4-35,66.1-45.7
+ C200.8,53.7,228,48,256,48s55.2,5.6,80.8,16.7c24.8,10.7,47,26.1,66.1,45.7c19.1,19.6,34.2,42.5,44.7,67.9
+ c10.9,26.4,16.4,54.4,16.4,83.3c0,45.8-13.8,89.5-40.1,126.3C411.3,405.6,396.2,421.1,379,434.1z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-github.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-github.svg
new file mode 100644
index 00000000..34579ced
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-github.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,32C132.3,32,32,134.9,32,261.7c0,101.5,64.2,187.5,153.2,217.9c1.4,0.3,2.6,0.4,3.8,0.4c8.3,0,11.5-6.1,11.5-11.4
+ c0-5.5-0.2-19.9-0.3-39.1c-8.4,1.9-15.9,2.7-22.6,2.7c-43.1,0-52.9-33.5-52.9-33.5c-10.2-26.5-24.9-33.6-24.9-33.6
+ c-19.5-13.7-0.1-14.1,1.4-14.1c0.1,0,0.1,0,0.1,0c22.5,2,34.3,23.8,34.3,23.8c11.2,19.6,26.2,25.1,39.6,25.1c10.5,0,20-3.4,25.6-6
+ c2-14.8,7.8-24.9,14.2-30.7c-49.7-5.8-102-25.5-102-113.5c0-25.1,8.7-45.6,23-61.6c-2.3-5.8-10-29.2,2.2-60.8c0,0,1.6-0.5,5-0.5
+ c8.1,0,26.4,3.1,56.6,24.1c17.9-5.1,37-7.6,56.1-7.7c19,0.1,38.2,2.6,56.1,7.7c30.2-21,48.5-24.1,56.6-24.1c3.4,0,5,0.5,5,0.5
+ c12.2,31.6,4.5,55,2.2,60.8c14.3,16.1,23,36.6,23,61.6c0,88.2-52.4,107.6-102.3,113.3c8,7.1,15.2,21.1,15.2,42.5
+ c0,30.7-0.3,55.5-0.3,63c0,5.4,3.1,11.5,11.4,11.5c1.2,0,2.6-0.1,4-0.4C415.9,449.2,480,363.1,480,261.7C480,134.9,379.7,32,256,32z
+ "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-google-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-google-outline.svg
new file mode 100644
index 00000000..4dfb1387
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-google-outline.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M319.408,82.141c11.779,9.576,36.43,29.718,36.43,68.043c0,37.295-21.547,54.934-43.094,71.545
+ c-6.695,6.561-14.385,13.608-14.385,24.701c0,11.092,7.689,17.153,13.336,21.671l18.473,14.108
+ c22.598,18.641,43.125,35.795,43.125,70.559c0,47.373-46.721,95.232-135.003,95.232c-74.428,0-110.343-34.766-110.343-72.061
+ c0-18.139,9.245-43.827,39.525-61.48c31.798-19.142,74.952-21.657,98.023-23.172c-7.178-9.078-15.382-18.67-15.382-34.265
+ c0-8.577,2.557-13.609,5.12-19.655c-5.648,0.5-11.283,1-16.42,1c-54.408,0-85.214-39.811-85.214-79.107
+ c0-23.186,10.802-48.902,32.856-67.543C215.724,68.031,250.637,64,278.328,64h105.725l-32.846,18.141H319.408z M282.955,305.896
+ c-4.137-0.501-6.684-0.501-11.793-0.501c-4.629,0-32.348,1.002-53.895,8.049c-11.3,4.046-44.146,16.125-44.146,51.918
+ c0,35.78,35.393,61.467,90.339,61.467c49.283,0,75.432-23.156,75.432-54.404C338.893,346.707,321.971,333.113,282.955,305.896
+ M297.834,210.148c11.824-11.592,12.844-27.73,12.844-36.793c0-36.281-22.086-92.73-64.671-92.73
+ c-13.339,0-27.724,6.547-35.948,16.639c-8.722,10.593-11.284,24.188-11.284,37.281c0,33.764,20.005,89.727,64.163,89.727
+ C275.764,224.271,289.594,218.212,297.834,210.148"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-google.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-google.svg
new file mode 100644
index 00000000..360427ee
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-google.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M325.862,275.558l-18.187-13.653l-0.063-0.051c-5.827-4.579-9.952-8.313-9.952-14.685c0-6.979,5.049-11.824,10.896-17.436
+ l0.466-0.449c20.025-15.171,44.726-34.286,44.726-74.556c0-26.934-11.916-44.729-23.28-57.729h12.969l60.322-33H270.308
+ c-25.324,0-62.68,3.225-94.561,28.576l-0.128,0.25c-21.809,18.111-34.828,44.584-34.828,70.691
+ c0,21.197,8.706,42.159,23.885,57.447c21.428,21.579,48.302,26.127,67.074,26.127c1.462,0,2.956-0.028,4.47-0.093
+ c-0.759,2.969-1.25,6.321-1.25,10.321c0,10.926,3.628,19.301,8.083,26.195c-23.963,1.932-58.148,6.477-84.897,22.278
+ c-39.335,22.562-42.396,55.875-42.396,65.551c0,38.207,35.707,76.762,115.479,76.762c91.611,0,139.543-49.792,139.543-98.979
+ C370.781,311.966,347.945,293.457,325.862,275.558z M200.485,139.894c0-13.359,3.02-23.457,9.255-30.9
+ c6.514-7.852,18.18-13.129,29.028-13.129c19.881,0,32.938,15.008,40.388,27.598c9.199,15.539,14.913,36.095,14.913,53.643
+ c0,4.942,0,19.983-10.188,29.796c-6.951,6.686-18.707,11.353-28.59,11.353c-20.503,0-33.453-14.705-40.707-27.041
+ C204.189,173.53,200.485,153.109,200.485,139.894z M321.6,367.974c0,27.444-25.212,44.493-65.799,44.493
+ c-48.058,0-80.347-20.603-80.347-51.265c0-26.14,21.54-36.789,37.8-42.521c18.944-6.064,44.297-7.305,50.062-7.305
+ c3.907,0,6.087,0,8.683,0.229C308.7,336.816,321.6,347.733,321.6,367.974z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-googleplus-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-googleplus-outline.svg
new file mode 100644
index 00000000..6757ede3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-googleplus-outline.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M223.5,82.1c11.8,9.6,36.4,29.7,36.4,68c0,37.3-21.5,54.9-43.1,71.5c-6.7,6.6-14.4,13.6-14.4,24.7
+ c0,11.1,7.7,17.2,13.3,21.7l18.5,14.1c22.6,18.6,43.1,35.8,43.1,70.6c0,47.4-46.7,95.2-135,95.2C67.9,448,32,413.2,32,375.9
+ c0-18.1,9.2-43.8,39.5-61.5c31.8-19.1,75-21.7,98-23.2c-7.2-9.1-15.4-18.7-15.4-34.3c0-8.6,2.6-13.6,5.1-19.7
+ c-5.6,0.5-11.3,1-16.4,1c-54.4,0-85.2-39.8-85.2-79.1c0-23.2,10.8-48.9,32.9-67.5C119.8,68,154.7,64,182.4,64h105.7l-32.8,18.1
+ H223.5z M187,305.9c-4.1-0.5-6.7-0.5-11.8-0.5c-4.6,0-32.3,1-53.9,8c-11.3,4-44.1,16.1-44.1,51.9c0,35.8,35.4,61.5,90.3,61.5
+ c49.3,0,75.4-23.2,75.4-54.4C242.9,346.7,226,333.1,187,305.9 M201.9,210.1c11.8-11.6,12.8-27.7,12.8-36.8
+ c0-36.3-22.1-92.7-64.7-92.7c-13.3,0-27.7,6.5-35.9,16.6c-8.7,10.6-11.3,24.2-11.3,37.3c0,33.8,20,89.7,64.2,89.7
+ C179.8,224.3,193.6,218.2,201.9,210.1"/>
+ <polygon points="480,142.3 401.7,142.3 401.7,64.1 384,64.1 384,142.3 304.3,142.3 304.3,160.1 384,160.1 384,241 401.7,241
+ 401.7,160.1 480,160.1 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-googleplus.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-googleplus.svg
new file mode 100644
index 00000000..8bfd88d1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-googleplus.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M242.1,275.6l-18.2-13.7l-0.1-0.1c-5.8-4.6-10-8.3-10-14.7c0-7,5-11.8,10.9-17.4l0.5-0.4c20-15.2,44.7-34.3,44.7-74.6
+ c0-26.9-11.9-44.7-23.3-57.7h13L320,64H186.5c-25.3,0-62.7,3.2-94.6,28.6l-0.1,0.3C70,110.9,57,137.4,57,163.5
+ c0,21.2,8.7,42.2,23.9,57.4c21.4,21.6,48.3,26.1,67.1,26.1c1.5,0,3,0,4.5-0.1c-0.8,3-1.2,6.3-1.2,10.3c0,10.9,3.6,19.3,8.1,26.2
+ c-24,1.9-58.1,6.5-84.9,22.3C35.1,328.4,32,361.7,32,371.3c0,38.2,35.7,76.8,115.5,76.8c91.6,0,139.5-49.8,139.5-99
+ C287,312,264.2,293.5,242.1,275.6z M116.7,139.9c0-13.4,3-23.5,9.3-30.9c6.5-7.9,18.2-13.1,29-13.1c19.9,0,32.9,15,40.4,27.6
+ c9.2,15.5,14.9,36.1,14.9,53.6c0,4.9,0,20-10.2,29.8c-7,6.7-18.7,11.4-28.6,11.4c-20.5,0-33.5-14.7-40.7-27
+ C120.4,173.5,116.7,153.1,116.7,139.9z M237.8,368c0,27.4-25.2,44.5-65.8,44.5c-48.1,0-80.3-20.6-80.3-51.3
+ c0-26.1,21.5-36.8,37.8-42.5c18.9-6.1,44.3-7.3,50.1-7.3c3.9,0,6.1,0,8.7,0.2C224.9,336.8,237.8,347.7,237.8,368z"/>
+ <polygon points="402,142 402,64 368,64 368,142 288,142 288,176 368,176 368,257 402,257 402,176 480,176 480,142 "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-hackernews-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-hackernews-outline.svg
new file mode 100644
index 00000000..43083521
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-hackernews-outline.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M416,96v320H96V96H416 M448,64H64v384h384V64L448,64z"/>
+ <g>
+ <path d="M296.7,159H342l-63.9,120v72h-39.9v-72L172,159h47.1l39.7,83.6L296.7,159z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-hackernews.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-hackernews.svg
new file mode 100644
index 00000000..48f9a28b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-hackernews.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M64,64v384h384V64H64z M278,279v72h-40v-72l-66-120h47.1l39.7,83.6l38-83.6H342L278,279z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-html5-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-html5-outline.svg
new file mode 100644
index 00000000..6d3cca4a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-html5-outline.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M64,32l34.936,403.301L255.769,480l157.245-44.705L448,32H64z M383.041,410.51l-127.262,36.187l-126.867-36.169L98.896,64
+ H413.1L383.041,410.51z"/>
+ <polygon points="147.991,264 314.984,264 309.411,327.986 255.991,342.734 202.225,328.064 198.801,289 150.55,289
+ 157.313,366.336 255.991,394.146 354.486,366.163 367.991,215 191.991,215 188,164 371.991,164 376.199,114.316 135.421,114.188
+ "/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-html5.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-html5.svg
new file mode 100644
index 00000000..3cc836db
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-html5.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M64,32l34.936,403.213L255.769,480l157.245-44.854L448,32H64z M371.997,164h-184l3.991,51h176.008l-13.505,151.386
+ l-98.5,28.094l-98.682-27.976L150.545,289h48.254l3.423,39.287l53.769,14.781l53.422-14.915L314.987,264H147.986l-12.571-149.589
+ l240.789,0.016L371.997,164z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-instagram-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-instagram-outline.svg
new file mode 100644
index 00000000..231a34e0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-instagram-outline.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path fill="#231F20" d="M448.5,112c0-26.233-21.267-47.5-47.5-47.5H112c-26.233,0-47.5,21.267-47.5,47.5v289
+ c0,26.233,21.267,47.5,47.5,47.5h289c26.233,0,47.5-21.267,47.5-47.5V112z M257,175.833c44.182,0,80,35.816,80,80s-35.818,80-80,80
+ s-80-35.816-80-80S212.818,175.833,257,175.833z M416.5,160.5c0,8.836-7.163,16-16,16h-48c-8.837,0-16-7.164-16-16v-48
+ c0-8.836,7.163-16,16-16h48c8.837,0,16,7.164,16,16V160.5z M401.5,416.5h-288c-8.822,0-17-8.178-17-17v-175h53.072
+ c-3.008,10-4.572,20.647-4.572,31.583C145,286,156.65,314,177.805,335.154s49.279,32.741,79.195,32.741s58.041-11.681,79.195-32.835
+ S369,286.016,369,256.099c0-10.936-1.563-21.599-4.572-31.599H416.5v175C416.5,408.322,410.322,416.5,401.5,416.5z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-instagram.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-instagram.svg
new file mode 100644
index 00000000..570d2ca2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-instagram.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <circle cx="256" cy="255.833" r="80"/>
+</g>
+<g>
+ <path d="M177.805,176.887c21.154-21.154,49.279-32.929,79.195-32.929s58.041,11.837,79.195,32.991
+ c13.422,13.422,23.011,29.551,28.232,47.551H448.5v-113c0-26.51-20.49-47-47-47h-288c-26.51,0-49,20.49-49,47v113h85.072
+ C154.794,206.5,164.383,190.309,177.805,176.887z M416.5,147.7c0,7.069-5.73,12.8-12.8,12.8h-38.4c-7.069,0-12.8-5.73-12.8-12.8
+ v-38.4c0-7.069,5.73-12.8,12.8-12.8h38.4c7.069,0,12.8,5.73,12.8,12.8V147.7z"/>
+ <path d="M336.195,335.279c-21.154,21.154-49.279,32.679-79.195,32.679s-58.041-11.462-79.195-32.616
+ c-21.115-21.115-32.759-49.842-32.803-78.842H64.5v143c0,26.51,22.49,49,49,49h288c26.51,0,47-22.49,47-49v-143h-79.502
+ C368.955,285.5,357.311,314.164,336.195,335.279z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-javascript-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-javascript-outline.svg
new file mode 100644
index 00000000..df1bd87d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-javascript-outline.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g transform="translate(384 48)">
+ <g id="icon-javascript_1_1_">
+ <path d="M-192,56.001v197.017c0,41.567-9.644,71.988-28.662,90.417c-17.06,16.53-42.061,24.565-76.431,24.565
+ c-12.002,0-25.78-1.496-37.185-3.886l4.09-30.505c7.146,1.269,15.465,2.149,24.774,2.149c21.92,0,37.892-6.459,48.827-19.745
+ C-245.27,302.268-240,282.085-240,252.499V56.001H-192 M-176,40.001h-80v212.498c0,52.58-18.032,67.261-49.412,67.261
+ c-14.705,0-27.948-2.521-38.25-6.063L-352,375.904c14.7,5.062,37.259,8.096,54.907,8.096C-225.045,384-176,350.129-176,253.02
+ V40.001L-176,40.001z"/>
+ <path d="M-1.537,48c24.458,0,45.898,3.146,65.1,9.585l-9.581,32.062C40.37,84.142,21.446,78.71-2.504,78.71
+ c-18.607,0-34.462,4.584-45.849,13.256c-11.732,8.936-18.194,21.583-18.194,35.613c0,34.974,33.062,48.149,71.347,63.405
+ l0.107,0.043l0.108,0.041c26.977,10.299,45.938,22.261,57.969,36.572C74.593,241.451,80,257.543,80,278.284
+ c0,25.177-9.333,46.71-26.99,62.274C32.66,358.497,1.593,367.98-36.833,367.98c-28.052,0-54.698-6.427-72.615-13.979l7.593-31.603
+ c17.579,7.248,41.882,14.382,69.438,14.382c20.28,0,36.629-4.478,48.591-13.306c12.807-9.45,19.857-23.697,19.857-40.119
+ c0-15.348-6.041-27.922-18.469-38.444c-10.157-8.603-24.801-16.048-47.467-24.136c-26.86-9.904-47.359-21.947-60.934-35.795
+ C-105.078,170.455-112,153.829-112,134.154c0-24.149,9.831-45.101,28.43-60.591C-63.49,56.839-35.124,48-1.537,48 M-1.537,32
+ C-78.98,32-128,75.998-128,134.154c0,50.083,37.751,81.44,92.641,101.665c39.7,14.158,55.392,26.808,55.392,47.539
+ c0,22.756-18.139,37.425-52.448,37.425c-31.863,0-60.789-10.64-80.394-21.255v-0.021L-128,362.727
+ c18.639,10.638,53.441,21.255,91.167,21.255C53.854,383.98,96,335.43,96,278.284c0-48.55-26.958-79.9-85.278-102.163
+ c-43.139-17.191-61.27-26.795-61.27-48.542c0-17.2,15.688-32.869,48.043-32.869c31.846,0,53.744,10.707,66.505,17.291l19.125-64
+ C63.125,39.22,36.188,32-1.537,32L-1.537,32z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-javascript.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-javascript.svg
new file mode 100644
index 00000000..0a20e9ce
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-javascript.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g transform="translate(384 48)">
+ <g id="icon-javascript_1_1_">
+ <path d="M-176,40.001h-80v212.498c0,52.58-18.032,67.261-49.412,67.261c-14.705,0-27.948-2.521-38.25-6.063L-352,375.904
+ c14.7,5.062,37.259,8.096,54.907,8.096C-225.045,384-176,350.129-176,253.02V40.001L-176,40.001z"/>
+ <path d="M-1.537,32C-78.98,32-128,75.998-128,134.154c0,50.083,37.751,81.44,92.641,101.665
+ c39.7,14.158,55.392,26.808,55.392,47.539c0,22.756-18.139,37.425-52.448,37.425c-31.863,0-60.789-10.64-80.394-21.255v-0.021
+ L-128,362.727c18.639,10.638,53.441,21.255,91.167,21.255C53.854,383.98,96,335.43,96,278.284c0-48.55-26.958-79.9-85.278-102.163
+ c-43.139-17.191-61.27-26.795-61.27-48.542c0-17.2,15.688-32.869,48.043-32.869c31.846,0,53.744,10.707,66.505,17.291l19.125-64
+ C63.125,39.22,36.188,32-1.537,32L-1.537,32z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-linkedin-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-linkedin-outline.svg
new file mode 100644
index 00000000..8c3dbc77
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-linkedin-outline.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill-rule:evenodd;clip-rule:evenodd;}
+]]>
+</style>
+<g>
+ <g>
+ <path class="st0" d="M182.8,384V212.9h-54.9V384H182.8L182.8,384z M157.4,187c18.3,0,29.7-13.1,29.7-29.5
+ c-0.3-16.7-11.4-29.5-29.4-29.5c-18,0-29.7,12.8-29.7,29.5c0,16.4,11.4,29.5,29,29.5H157.4L157.4,187z"/>
+ <path class="st0" d="M320.6,209c-29.1,0-41.6,16.4-49.6,27.8V213h-55v171h55v-97.4c0-5,0.4-10,1.9-13.5c4-10,13-20.3,28.2-20.3
+ c19.9,0,27.9,15.3,27.9,37.7V384h55v-99.9C384,232.8,356.8,209,320.6,209z"/>
+ </g>
+ <path d="M417.2,64H96.8C79.3,64,64,76.6,64,93.9v321.1c0,17.4,15.3,32.9,32.8,32.9h320.3c17.6,0,30.8-15.6,30.8-32.9V93.9
+ C448,76.6,434.7,64,417.2,64z M414,416c-1.1,0-313.1,0-314.9,0s-3.1-1.4-3.1-3.1S96,99.1,96,98s1-2,2-2s315,0,316,0s2,1,2,2
+ c0,23.3,0,314.9,0,316C416,414.9,415.1,416,414,416z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-linkedin.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-linkedin.svg
new file mode 100644
index 00000000..72cd8239
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-linkedin.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M417.2,64H96.8C79.3,64,64,76.6,64,93.9v321.1c0,17.4,15.3,32.9,32.8,32.9h320.3c17.6,0,30.8-15.6,30.8-32.9V93.9
+ C448,76.6,434.7,64,417.2,64z M183,384h-55V213h55V384z M157.4,187H157c-17.6,0-29-13.1-29-29.5c0-16.7,11.7-29.5,29.7-29.5
+ c18,0,29,12.7,29.4,29.5C187.1,173.9,175.7,187,157.4,187z M384,384h-55v-93.5c0-22.4-8-37.7-27.9-37.7
+ c-15.2,0-24.2,10.3-28.2,20.3c-1.5,3.6-1.9,8.5-1.9,13.5V384h-55V213h55v23.8c8-11.4,20.5-27.8,49.6-27.8
+ c36.1,0,63.4,23.8,63.4,75.1V384z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-markdown.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-markdown.svg
new file mode 100644
index 00000000..fff5d364
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-markdown.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g transform="translate(96 48)">
+ <g id="icon-markdown">
+ <path fill="#231F20" d="M351.659,48H-31.659C-49.496,48-64,62.484-64,80.308v255.349C-64,353.493-49.496,368-31.659,368h383.318
+ C369.496,368,384,353.493,384,335.656V80.308C384,62.484,369.496,48,351.659,48z M188.023,304h-56.048v-96l-42.04,53.878
+ L47.913,208v96H-8.131V112h56.044l42.022,67.98l42.04-67.98h56.048V304L188.023,304z M271.68,304l-69.635-96h42v-96h56.043v96
+ h42.027l-70.453,96H271.68z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-nodejs.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-nodejs.svg
new file mode 100644
index 00000000..2829f03a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-nodejs.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g transform="translate(96 96)">
+ <g id="icon-nodejs_small">
+ <path d="M159.917,384c-5.77,0-11.536-1.562-16.633-4.599l-52.985-32.44c-7.914-4.562-4.023-6.203-1.443-7.141
+ c10.565-3.781,13.713-5.657,24.947-12.285c1.206-0.667,2.747-0.424,3.955,0.322l39.71,23.504c1.476,0.85,3.557,0.85,4.931,0
+ l155.188-92.246c1.475-0.877,2.415-2.646,2.415-4.441V67.869c0-1.85-0.94-3.592-2.449-4.528L162.433-31.331
+ c-1.478-0.894-3.421-0.894-4.898,0L2.516,63.374C0.972,64.277,0,66.072,0,67.869v186.805c0,1.813,0.972,3.513,2.481,4.389
+ l39.929,23.972C66.02,295.239,80,282.865,80,268.424V84.725c0-2.652,2.047-4.727,4.596-4.727h22.809
+ c2.515,0,4.597,2.072,4.597,4.727v183.698c0,32.563-19.353,51.248-49.199,51.248c-9.156,0-16.397,0-36.552-10.279l-41.584-24.781
+ C-25.629,278.459-32,266.965-32,254.656V65.191c0-12.316,6.371-23.784,16.665-29.917L143.35-59.59
+ c10.027-5.88,23.374-5.88,33.332,0l158.65,94.864C345.63,41.423,352,52.899,352,65.191v189.465c0,12.309-6.37,23.75-16.668,29.953
+ l-158.65,94.774c-5.097,3.036-10.832,4.599-16.698,4.599L159.917,384z"/>
+ <path d="M208.943,255.998c-64.61,0-84.006-31.61-84.006-59.271c0-2.629,2.048-4.729,4.562-4.729h20.521
+ c2.282,0,4.227,1.7,4.562,4.016c3.084,21.602,16.748,31.15,54.324,31.15c33.399,0,47.091-10.346,47.091-28.684
+ c0-10.592-3.463-18.424-55.407-23.697c-43.427-4.441-70.288-14.373-70.288-50.295c0-33.135,26.996-52.49,72.234-52.49
+ c46.128,0,76.462,14,79.173,50.829c0.102,1.337-0.368,2.629-1.241,3.644c-0.871,0.965-2.078,1.527-3.353,1.527h-20.591
+ c-2.146,0-4.024-1.562-4.459-3.713c-4.401-16.953-16.97-23.402-49.563-23.402c-36.486,0-40.746,12.753-40.746,22.607
+ c0,11.963,5.031,15.441,54.294,22.172c48.761,6.663,71.933,16.117,71.933,51.552c0,35.781-28.808,58.783-79.075,58.783
+ L208.943,255.998L208.943,255.998z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-octocat.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-octocat.svg
new file mode 100644
index 00000000..57ac1631
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-octocat.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path fill="#231F20" d="M178.354,287.478c-9.123,0-16.928,4.207-23.201,12.833c-6.291,8.478-9.398,18.973-9.398,31.431
+ c0,12.474,3.166,23.008,9.398,31.509c6.273,8.54,14.039,12.771,23.201,12.771c8.494,0,15.889-4.27,22.121-12.771
+ c6.271-8.501,9.398-19.035,9.398-31.509c0-12.419-3.166-22.93-9.398-31.431C194.242,291.724,186.908,287.478,178.354,287.478z"/>
+ <path fill="#231F20" d="M334.668,287.478c-9.045,0-16.891,4.207-23.182,12.833c-6.271,8.478-9.359,18.973-9.359,31.431
+ c0,12.474,3.186,23.008,9.359,31.509c6.291,8.54,14.098,12.771,23.182,12.771c8.533,0,15.906-4.27,22.178-12.771
+ c6.293-8.501,9.418-19.035,9.418-31.509c0-12.419-3.164-22.93-9.418-31.431C350.574,291.724,343.299,287.478,334.668,287.478z"/>
+ <path fill="#231F20" d="M445.777,172h-0.059c0,0,2.793-14.264,0.314-39.18c-2.182-24.916-7.471-47.838-16.123-68.82
+ c0,0-4.422,0.76-12.76,2.896s-22.08,6.299-40.938,14.768c-18.541,8.54-37.986,19.788-58.297,33.505
+ c-13.803-3.934-34.408-5.939-61.994-5.939c-26.289,0-46.914,2.012-61.977,5.945c-44.592-30.859-81.832-47.945-112.092-51.175
+ c-8.594,20.982-13.883,43.991-16.045,68.97c-2.398,24.939,0.432,39.329,0.432,39.329C41.979,198.551,32,236.541,32,267.793
+ c0,24.244,0.658,46.078,6.125,65.48c5.564,19.31,12.662,35.13,21.098,47.221c8.611,12.121,19.012,22.788,31.576,31.938
+ c12.467,9.314,23.988,15.962,34.389,20.216c10.461,4.372,22.375,7.602,35.982,9.861c13.33,2.386,23.438,3.645,30.477,3.996
+ c0,0,28,1.494,64.354,1.494c36.354,0,64.295-1.494,64.295-1.494c7.02-0.352,17.145-1.634,30.535-3.996
+ c13.547-2.299,25.521-5.607,35.941-9.861c10.402-4.293,21.943-10.901,34.469-20.216c12.523-9.032,22.906-19.739,31.518-31.938
+ c8.436-12.091,15.494-27.911,21.098-47.221c5.486-19.402,6.145-41.385,6.145-65.629C480,237.389,469.982,199,445.777,172z
+ M380.383,405.645C352.521,418.736,311.486,424,257.061,424l-2.143-0.039c-54.443,0-95.361-5.248-122.848-18.41
+ c-27.508-13.092-41.271-40.057-41.271-80.738c0-24.33,8.572-43.99,25.482-59.107c7.354-6.515,16.438-11.019,27.645-13.717
+ c11.129-2.558,21.354-2.762,30.969-2.465c9.398,0.415,22.551,2.196,39.344,3.464C231.029,254.285,243.535,256,256,256
+ c11.698,0,27.213-1.957,52.104-3.959c24.99-1.971,43.494-2.971,55.467-1c12.289,2.002,22.986,6.202,32.129,14.742
+ c17.734,15.751,26.602,35.505,26.602,59.084C422.301,365.533,408.164,392.537,380.383,405.645z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-pinterest-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-pinterest-outline.svg
new file mode 100644
index 00000000..e6d63055
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-pinterest-outline.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M256,32C132.3,32,32,132.3,32,256s100.3,224,224,224s224-100.3,224-224S379.7,32,256,32z M391.8,391.8
+ C355.5,428,307.3,448,256,448c-16.2,0-32.1-2-47.4-5.9c2.8-6.3,5.2-12.8,7-19.3c2.8-10,15.8-61.6,15.8-61.6
+ c7.8,14.8,30.5,27.9,54.7,27.9c72,0,120.9-65.6,120.9-153.5c0-66.4-56.3-128.3-141.8-128.3c-106.4,0-160.1,76.3-160.1,139.9
+ c0,38.5,14.6,72.8,45.9,85.6c5.1,2.1,9.7,0.1,11.2-5.6c1-3.9,3.5-13.9,4.6-18c1.5-5.6,0.9-7.6-3.2-12.5c-9-10.7-14.8-24.4-14.8-43.9
+ c0-56.6,42.3-107.3,110.3-107.3c60.1,0,93.2,36.7,93.2,85.8c0,64.6-28.6,119.1-71,119.1c-23.4,0-41-19.4-35.4-43.1
+ c6.7-28.4,19.8-59,19.8-79.5c0-18.3-9.8-33.6-30.2-33.6c-24,0-43.2,24.8-43.2,58c0,21.1,7.2,35.4,7.2,35.4s-24.5,103.9-28.8,122.1
+ c-1.3,5.5-2.2,11.1-2.9,16.8c-17.3-9-33.3-20.6-47.4-34.8C84,355.5,64,307.3,64,256s20-99.5,56.2-135.8C156.5,84,204.7,64,256,64
+ s99.5,20,135.8,56.2C428,156.5,448,204.7,448,256S428,355.5,391.8,391.8z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-pinterest.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-pinterest.svg
new file mode 100644
index 00000000..1f992aa6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-pinterest.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256,32C132.3,32,32,132.3,32,256c0,91.7,55.2,170.5,134.1,205.2c-0.6-15.6-0.1-34.4,3.9-51.4
+ c4.3-18.2,28.8-122.1,28.8-122.1s-7.2-14.3-7.2-35.4c0-33.2,19.2-58,43.2-58c20.4,0,30.2,15.3,30.2,33.6
+ c0,20.5-13.1,51.1-19.8,79.5c-5.6,23.8,11.9,43.1,35.4,43.1c42.4,0,71-54.5,71-119.1c0-49.1-33.1-85.8-93.2-85.8
+ c-67.9,0-110.3,50.7-110.3,107.3c0,19.5,5.8,33.3,14.8,43.9c4.1,4.9,4.7,6.9,3.2,12.5c-1.1,4.1-3.5,14-4.6,18
+ c-1.5,5.7-6.1,7.7-11.2,5.6c-31.3-12.8-45.9-47-45.9-85.6c0-63.6,53.7-139.9,160.1-139.9c85.5,0,141.8,61.9,141.8,128.3
+ c0,87.9-48.9,153.5-120.9,153.5c-24.2,0-46.9-13.1-54.7-27.9c0,0-13,51.6-15.8,61.6c-4.7,17.3-14,34.5-22.5,48
+ c20.1,5.9,41.4,9.2,63.5,9.2c123.7,0,224-100.3,224-224C480,132.3,379.7,32,256,32z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-python.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-python.svg
new file mode 100644
index 00000000..ab523e4b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-python.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M193.46,249.056c3.723-0.67,7.589-1.041,11.586-1.041L201.924,248h103.823c4.503,0,8.806-0.617,12.908-1.754
+ c19.37-5.363,33.345-22.537,33.345-43.663v-30.822v-56.402c0-24.832-21.15-43.484-46.289-47.606
+ c-15.931-2.624-39.258-3.827-55.089-3.749c-15.829,0.086-30.981,1.404-44.277,3.749C167.143,74.576,160,88.928,160,115.359V144h96
+ v16H128.82c-35.628,0-64.538,42.571-64.813,95.242C64.005,255.495,64,255.747,64,256c0,9.523,0.94,18.72,2.685,27.404
+ C74.648,323.07,99.451,352,128.82,352H144v-2.662v-43.273C144,279.238,164.146,254.332,193.46,249.056z M203.656,127.002
+ c-9.592,0-17.384-7.785-17.384-17.403c0-9.664,7.774-17.52,17.384-17.52c9.574,0,17.399,7.855,17.399,17.52
+ C221.056,119.217,213.246,127.002,203.656,127.002z"/>
+ <path d="M443.951,222.543C434.78,186.021,411.033,160,383.18,160H368v2.626v38.046c0,33.915-22.286,58.474-49.489,62.681
+ c-2.737,0.424-5.483,0.646-8.301,0.646H206.351c-4.518,0-8.904,0.584-13.049,1.672C174.18,270.689,160,286.6,160,307.236v32.922
+ v54.305c0,24.832,24.977,39.426,49.481,46.551c29.327,8.531,61.267,10.068,96.366,0C329.15,434.354,352,420.893,352,394.463V368
+ h-96v-16h127.18c25.24,0,47.107-21.365,57.814-52.549C445.474,286.404,448,271.641,448,256
+ C448,244.232,446.567,232.962,443.951,222.543z M307.867,382.82c9.59,0,17.381,7.785,17.381,17.4
+ c0,9.65-7.791,17.521-17.381,17.521c-9.577,0-17.399-7.871-17.399-17.521C290.468,390.59,298.274,382.82,307.867,382.82z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-reddit-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-reddit-outline.svg
new file mode 100644
index 00000000..40553cc1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-reddit-outline.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <circle cx="322.3" cy="288.4" r="31.8"/>
+ <circle cx="190.3" cy="288.4" r="31.8"/>
+ <g>
+ <path d="M480.5,251c0-27.7-22.2-50.2-49.5-50.2c-13,0-24.7,5-33.6,13.3c-33.2-23.4-78.4-38.5-128.7-40.7L292,95.7l69.6,13.9
+ c0.2,24.7,20.1,44.7,44.5,44.7c24.6,0,44.5-20.2,44.5-45.1S430.7,64,406.1,64c-18.6,0-34.5,11.6-41.2,28l-85.2-17l-29.4,98.2
+ l-7.1,0.2c-50.3,2.2-95.5,17.4-128.7,40.7c-8.8-8.3-20.6-13.3-33.6-13.3c-27.3,0-49.5,22.5-49.5,50.2c0,19.6,11,36.5,27.1,44.8
+ c-0.8,4.9-1.2,9.8-1.2,14.8C57.5,386.4,146.4,448,256,448s198.5-61.6,198.5-137.5c0-5-0.4-9.9-1.1-14.8
+ C469.5,287.4,480.5,270.5,480.5,251z M406.1,81.9c14.8,0,26.8,12.2,26.8,27.2c0,15-12,27.2-26.8,27.2c-14.8,0-26.8-12.2-26.8-27.2
+ C379.3,94.1,391.3,81.9,406.1,81.9z M49.2,251c0-17.8,14.3-32.2,31.8-32.2c7.2,0,13.9,2.5,19.2,6.6c-17.3,15.2-30.1,33-37,52.4
+ C54.8,271.9,49.2,262.1,49.2,251z M386.4,392.9c-34.6,23.9-80.9,37.1-130.4,37.1s-95.8-13.2-130.4-37.1
+ c-32.5-22.5-50.4-51.8-50.4-82.4c0-3.2,0.2-6.5,0.6-9.7c0.7-6,2.2-11.9,4.3-17.7c5.6-15.6,16-30.3,30.7-43.4
+ c4.4-3.9,9.2-7.7,14.4-11.3c0.1-0.1,0.3-0.2,0.4-0.3C160.2,204.2,206.5,191,256,191c49.5,0,95.8,13.2,130.4,37.1
+ c0.1,0.1,0.3,0.2,0.4,0.3c5.2,3.6,10,7.4,14.4,11.3c14.7,13.1,25.1,27.8,30.7,43.4c2.1,5.8,3.5,11.7,4.3,17.7
+ c0.4,3.2,0.6,6.4,0.6,9.7C436.8,341.1,418.9,370.4,386.4,392.9z M448.8,277.7c-6.9-19.4-19.7-37.2-37-52.4
+ c5.3-4.1,12-6.6,19.2-6.6c17.5,0,31.8,14.5,31.8,32.2C462.8,262.1,457.2,271.9,448.8,277.7z"/>
+ <path d="M320.5,357.9c-0.2,0.2-24.2,24.2-64.5,24.4c-40.9-0.2-64.4-24.2-64.6-24.4l-12.6,12.4c1.2,1.2,29.6,29.5,77.2,29.7
+ c47.6-0.2,75.9-28.5,77.1-29.7L320.5,357.9z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-reddit.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-reddit.svg
new file mode 100644
index 00000000..e85c3ce1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-reddit.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M480.5,251c0-27.7-22.2-50.2-49.5-50.2c-13,0-24.7,5-33.6,13.3c-32.4-22.8-76.1-37.8-124.9-40.6l21.9-73.2l67.1,13.5
+ c2.3,22.7,21.2,40.4,44.3,40.4c0.1,0,0.1,0,0.2,0c0.1,0,0.1,0,0.2,0c24.6,0,44.5-20.2,44.5-45.1S430.7,64,406.1,64
+ c-0.1,0-0.1,0-0.2,0c0,0-0.1,0-0.1,0c-17.2,0-32,9.8-39.5,24.3l-89.7-18l-30.8,103l-2.5,0.1c-50.3,2.2-95.5,17.4-128.7,40.7
+ c-8.8-8.3-20.6-13.3-33.6-13.3c-27.3,0-49.5,22.5-49.5,50.2c0,19.6,11,36.5,27.1,44.8c-0.8,4.9-1.2,9.8-1.2,14.8
+ C57.5,386.4,146.4,448,256,448s198.5-61.6,198.5-137.5c0-5-0.4-9.9-1.1-14.8C469.5,287.4,480.5,270.5,480.5,251z M65.8,271.1
+ c-6.6-4.5-10.9-12.1-10.9-20.8c0-13.8,11.1-25.1,24.7-25.1c5.6,0,10.8,1.9,15,5.1C81.1,242.2,71.1,256,65.8,271.1z M389.3,109.1
+ c0-9.2,7.4-16.8,16.5-16.8s16.5,7.5,16.5,16.8c0,9.2-7.4,16.8-16.5,16.8S389.3,118.4,389.3,109.1z M158.5,288.4
+ c0-17.6,14.2-31.8,31.8-31.8s31.8,14.2,31.8,31.8c0,17.6-14.2,31.8-31.8,31.8S158.5,306,158.5,288.4z M256,400
+ c-47.6-0.2-76-28.5-77.2-29.7l12.6-12.4c0.2,0.2,23.7,24.2,64.6,24.4c40.3-0.2,64.2-24.2,64.5-24.4l12.6,12.4
+ C331.9,371.5,303.6,399.8,256,400z M322.3,320.2c-17.6,0-31.8-14.2-31.8-31.8c0-17.6,14.2-31.8,31.8-31.8s31.8,14.2,31.8,31.8
+ C354.1,306,339.8,320.2,322.3,320.2z M446.4,271.5c-5.4-15.3-15.6-29.4-29.3-41.4c4.2-3.3,9.5-5.2,15.2-5.2
+ c13.9,0,25.1,11.4,25.1,25.5C457.5,259.2,453.1,266.9,446.4,271.5z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-rss-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-rss-outline.svg
new file mode 100644
index 00000000..efca1cc8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-rss-outline.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M119.9,336.1c-30.8,0-55.9,25.1-55.9,55.8c0,30.8,25.1,55.6,55.9,55.6c30.9,0,55.9-24.9,55.9-55.6
+ C175.8,361.2,150.8,336.1,119.9,336.1z M119.9,431.5c-22,0-39.9-17.8-39.9-39.6c0-21.9,17.9-39.8,39.9-39.8
+ c22,0,39.9,17.9,39.9,39.8C159.8,413.7,141.9,431.5,119.9,431.5z"/>
+ <path d="M64,192v79.9c48,0,94.1,14.2,128,48.1c33.9,33.9,48,79.9,48,128h80C320,308.1,204,192,64,192z M303.5,432h-48
+ c-3.1-49.7-21-92.1-52.2-123.3C172.1,277.4,130,259.5,80,256.4v-47.8c26,1.8,52.1,8,76.7,18.5c28.5,12.2,54.2,29.6,76.4,51.8
+ c22.2,22.2,39.6,47.9,51.8,76.4C295.5,379.9,301.7,405.6,303.5,432z"/>
+ <path d="M64,64v79.9c171,0,303.9,133,303.9,304.1H448C448,236.3,276,64,64,64z M291.4,220.5C235.4,164.4,161,132,80,128.2V80.3
+ C270,88.5,423.5,241.8,431.7,432h-48.2C379.7,351.1,347.3,276.5,291.4,220.5z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-rss.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-rss.svg
new file mode 100644
index 00000000..487aa707
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-rss.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M119.9,336.1c-30.8,0-55.9,25.1-55.9,55.8c0,30.8,25.1,55.6,55.9,55.6c30.9,0,55.9-24.9,55.9-55.6
+ C175.8,361.2,150.8,336.1,119.9,336.1z"/>
+ <path d="M64,192v79.9c48,0,94.1,14.2,128,48.1c33.9,33.9,48,79.9,48,128h80C320,308.1,204,192,64,192z"/>
+ <path d="M64,64v79.9c171,0,303.9,133,303.9,304.1H448C448,236.3,276,64,64,64z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-sass.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-sass.svg
new file mode 100644
index 00000000..08e1dfa8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-sass.svg
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path fill="#231F20" d="M511.784,329.108c-1.67-13.599-9.236-24.146-20.795-32.416c2.857,2.04,5.275,3.766-0.055-0.041
+ c-7.189-5.131-3.38-2.411-0.047-0.032c-28.5-20.301-65.676-15.789-96.733-4.511c-12.447-20.295-12.987-35.783-5.816-57.937
+ c0.929-2.8,0.295-4.354-2.624-5.604c-7.086-3.03-17.291-1.427-24.422,0.463c-2.462,0.646-4.254,1.9-4.8,4.381
+ c-5.154,24.243-21.009,46.448-34.828,66.886c-9.731-18.652-8.96-33.087-2.414-52.516c0.798-2.366,0.431-3.624-1.937-4.879
+ c-7.26-3.757-18.401-1.912-25.8,0.276c-8.509,2.482-21.29,44.594-25.372,52.946c-8.531,17.442-16.091,44.665-30.585,58.502
+ c-12.3-15.807,22.526-51.517,10.882-65.851c-3.938-4.848-11.063-4.723-15.586-0.616c1.085-7.608,1.648-12.609-0.32-19.063
+ c-2.081-6.79-7.361-10.687-15.09-10.49c-17.995,0.527-33.843,13.815-44.641,26.397c-10.277,12.105-37.381,19.627-51.953,26.927
+ c-25.032-21.807-79.221-44.947-80.632-82.081c-1.528-41.846,48.319-70.245,81.597-87.228
+ c43.28-22.104,109.961-49.608,159.138-25.436c13.049,6.414,18.299,20.171,14.707,33.348c-9.368,34.366-47.198,57.293-80.103,67.807
+ c-16.189,5.175-33.969,9.027-51.1,8.026c-22.955-1.343-40.83-15.224-43.281-16.086c-2.049-0.389-1.888,2.261-1.347,3.664
+ c23.816,62.433,144.417,16.681,175.956-15.371c15.189-15.421,24.413-30.365,28.351-53.894c4.616-27.583-15.634-44.842-31.004-51.957
+ C213.212,56.65,105.494,103.89,46.577,152.049c-25.568,20.901-57.552,54.11-42.874,88.946c15.93,37.805,64.736,57.19,96.503,80.312
+ C74.502,334.08,42.344,347.29,25.688,371.24c-9.524,13.729-12.903,28.359-5.811,43.966c12.572,27.568,58.285,15.622,77.573,3.471
+ c17.67-11.13,29.563-26.07,34.7-45.228c4.455-16.609,3.541-33.866-3.856-49.512l28.585-14.458
+ c-7.697,23.076-11.097,52.003,4.881,72.855c6.402,8.338,23.017,8.675,29.817,0.311c8.816-10.943,14.664-24.655,20.503-37.206
+ c-0.682,9.373-1.856,19.996,1.377,28.165c3.71,9.373,12.126,11.291,20.792,5.343c26.52-18.203,43.398-68.652,56.463-98.062
+ c3.552,12.829,7.473,24.548,13.957,36.376c1.602,2.903,1.407,4.774-0.796,7.195c-9.685,10.675-32.826,28.479-35.069,42.899
+ c-0.524,3.371,1.713,6.599,5.686,7.37c15.573,3.108,32.838-2.531,45.482-11.078c13.188-8.922,17.446-21.087,14.245-35.515
+ c-4.576-20.771,10.993-43.98,25.801-61.03c2.719,12.908,6.816,25.331,14.143,36.606c-13.075,11.483-32.58,27.764-29.779,46.939
+ c0.988,6.865,7.135,11.301,14.514,9.736c15.783-3.324,29.416-10.113,39.37-22.146c9.023-10.855,5.792-22.701,1.856-34.635
+ c23.872-6.815,48.022-8.177,71.831-0.027c11.495,3.91,20.755,10.5,26.248,20.818c6.726,12.644,2.939,24.292-10.05,32.604
+ c-3.287,2.104-5.562,3.833-4.45,4.743c1.112,0.911,4.9,2.113,13.284-3.152c8.384-5.267,13.51-12.383,14.823-21.725
+ C512.071,334.28,512.063,331.696,511.784,329.108z M112.946,354.367c-1.358,16.673-9.636,30.193-23.175,41.114
+ c-7.617,6.158-17.102,11.176-26.52,12.092c-9.418,0.917-16.751-1.461-17.378-11.23c-1.764-27.493,40.923-54.424,64.625-62.533
+ c2.02,6.86,3.011,13.666,2.432,20.587L112.946,354.367z M216.048,281.914c-3.903,22.309-14.83,62.347-32.314,78.336
+ c-2.356,2.143-4.61,2.018-5.809-0.771c-10.345-24.059,3.671-73.669,33.082-81.328C214.464,277.262,216.609,278.733,216.048,281.914z
+ M286.359,363.682c8.422-8.962,16.834-17.916,25.269-26.927C312.671,346.776,294.057,366.719,286.359,363.682z M367.073,345.986
+ c-2.348,1.273-7.621,2.515-7.827,0.835c-1.482-12.085,11.816-24.874,20.067-30.867C383.766,327.297,378.495,339.788,367.073,345.986
+ z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-skype-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-skype-outline.svg
new file mode 100644
index 00000000..27e3015a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-skype-outline.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M170.2,96c14,0,27.7,3.9,39.6,11.3l10.3,6.4l12-2c8.5-1.5,17.2-2.2,25.9-2.2c40.5,0,78.5,15.5,107,43.7
+ c28.4,28,44.1,65.3,44.1,104.9c0,10.7-1.2,21.4-3.5,31.8l-2.5,11.1l5.1,10.2c5.1,10.1,7.7,20.9,7.7,32.2
+ c0,40.1-33.3,72.7-74.2,72.7c-12.5,0-24.3-2.9-35.2-8.7l-9.8-5.2l-10.9,2c-9.1,1.7-18.5,2.5-27.8,2.5c-40.5,0-78.5-15.5-107-43.7
+ c-28.4-28-44.1-65.3-44.1-104.9c0-10,1-20.1,3-29.9l2.5-12.2l-6.4-10.7C99.5,194.2,96,181.6,96,168.7C96,128.6,129.3,96,170.2,96
+ M170.2,64C111.6,64,64,110.9,64,168.7c0,19.4,5.3,37.5,14.6,53c-2.4,11.7-3.7,23.9-3.7,36.3c0,99.8,82,180.6,183.1,180.6
+ c11.5,0,22.7-1,33.5-3c15,7.9,32.1,12.4,50.2,12.4c58.7,0,106.2-46.9,106.2-104.7c0-16.7-4-32.5-11.1-46.5
+ c2.8-12.5,4.2-25.4,4.2-38.7c0-99.7-82-180.6-183.2-180.6c-10.7,0-21.1,0.9-31.3,2.6C210.3,69.9,191,64,170.2,64L170.2,64z"/>
+ <path d="M351.9,344.1c-8.5,11.8-21,21.2-37.2,27.8c-16.1,6.6-35.3,9.9-57.3,9.9c-26.3,0-48.3-4.6-65.6-13.6
+ c-12.3-6.6-22.4-15.4-30.2-26.4c-7.8-11-11.7-22-11.7-32.6c0-6.6,2.6-12.3,7.6-17.1c5-4.6,11.5-7,19.1-7c6.3,0,11.7,1.8,16.1,5.5
+ c4.2,3.5,7.8,8.7,10.7,15.5c3.3,7.3,6.8,13.5,10.6,18.4c3.6,4.7,8.7,8.6,15.3,11.7c6.7,3.1,15.6,4.7,26.6,4.7
+ c15.1,0,27.5-3.2,36.8-9.5c9.2-6.1,13.6-13.5,13.6-22.5c0-7.1-2.3-12.7-7.1-17.1c-5-4.6-11.5-8.2-19.6-10.6
+ c-8.3-2.6-19.6-5.3-33.6-8.2c-19-4-35.1-8.8-48-14.2c-13.1-5.5-23.7-13.2-31.5-22.7C159,226.5,155,214.3,155,200
+ c0-13.7,4.2-25.9,12.4-36.5c8.2-10.5,20.1-18.7,35.6-24.3c15.2-5.6,33.3-8.4,53.7-8.4c16.4,0,30.7,1.9,42.7,5.5
+ c12.1,3.7,22.2,8.7,30.3,14.9c8,6.2,14,12.8,17.8,19.7c3.8,7,5.7,13.9,5.7,20.6c0,6.4-2.5,12.3-7.5,17.4c-5,5.1-11.3,7.8-18.8,7.8
+ c-6.8,0-12.1-1.6-15.8-4.8c-3.4-3-7-7.6-10.9-14.3c-4.6-8.5-10.1-15.3-16.4-20.1c-6.2-4.6-16.4-7-30.6-7c-13.1,0-23.8,2.6-31.7,7.7
+ c-7.6,4.9-11.3,10.6-11.3,17.3c0,4.1,1.2,7.5,3.7,10.5c2.6,3.1,6.2,5.9,10.9,8.2c4.8,2.4,9.8,4.3,14.7,5.6
+ c5.1,1.4,13.6,3.5,25.3,6.1c14.9,3.1,28.5,6.7,40.5,10.4c12.2,3.9,22.7,8.6,31.3,14.1c8.8,5.6,15.7,12.9,20.7,21.5
+ c4.9,8.6,7.4,19.4,7.4,31.8C364.7,318.7,360.4,332.3,351.9,344.1z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-skype.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-skype.svg
new file mode 100644
index 00000000..810a7210
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-skype.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M436.9,296.8c2.8-12.5,4.2-25.4,4.2-38.7c0-99.7-82-180.6-183.2-180.6c-10.7,0-21.1,0.9-31.3,2.6
+ C210.3,69.9,191,64,170.2,64C111.6,64,64,110.9,64,168.7c0,19.4,5.3,37.5,14.6,53c-2.4,11.7-3.7,23.9-3.7,36.3
+ c0,99.8,82,180.6,183.1,180.6c11.5,0,22.7-1,33.5-3c15,7.9,32.1,12.4,50.2,12.4c58.7,0,106.2-46.9,106.2-104.7
+ C448,326.6,444,310.8,436.9,296.8z M351.9,344.3c-8.5,11.8-21,21.2-37.2,27.8c-16.1,6.6-35.3,9.9-57.3,9.9
+ c-26.3,0-48.3-4.6-65.6-13.6c-12.3-6.6-22.4-15.4-30.2-26.4c-7.8-11-11.7-22-11.7-32.6c0-6.6,2.6-12.3,7.6-17.1c5-4.6,11.5-7,19.1-7
+ c6.3,0,11.7,1.8,16.1,5.5c4.2,3.5,7.8,8.7,10.7,15.5c3.3,7.3,6.8,13.5,10.6,18.4c3.6,4.7,8.7,8.6,15.3,11.7
+ c6.7,3.1,15.6,4.7,26.6,4.7c15.1,0,27.5-3.2,36.8-9.5c9.2-6.1,13.6-13.5,13.6-22.5c0-7.1-2.3-12.7-7.1-17.1
+ c-5-4.6-11.5-8.2-19.6-10.6c-8.3-2.6-19.6-5.3-33.6-8.2c-19-4-35.1-8.8-48-14.2c-13.1-5.5-23.7-13.2-31.5-22.7
+ c-7.9-9.7-11.8-21.9-11.8-36.2c0-13.7,4.2-25.9,12.4-36.5c8.2-10.5,20.1-18.7,35.6-24.3c15.2-5.6,33.3-8.4,53.7-8.4
+ c16.4,0,30.7,1.9,42.7,5.5c12.1,3.7,22.2,8.7,30.3,14.9c8,6.2,14,12.8,17.8,19.7c3.8,7,5.7,13.9,5.7,20.6c0,6.4-2.5,12.3-7.5,17.4
+ c-5,5.1-11.3,7.8-18.8,7.8c-6.8,0-12.1-1.6-15.8-4.8c-3.4-3-7-7.6-10.9-14.3c-4.6-8.5-10.1-15.3-16.4-20.1c-6.2-4.6-16.4-7-30.6-7
+ c-13.1,0-23.8,2.6-31.7,7.7c-7.6,4.9-11.3,10.6-11.3,17.3c0,4.1,1.2,7.5,3.7,10.5c2.6,3.1,6.2,5.9,10.9,8.2
+ c4.8,2.4,9.8,4.3,14.7,5.6c5.1,1.4,13.6,3.5,25.3,6.1c14.9,3.1,28.5,6.7,40.5,10.4c12.2,3.9,22.7,8.6,31.3,14.1
+ c8.8,5.6,15.7,12.9,20.7,21.5c4.9,8.6,7.4,19.4,7.4,31.8C364.8,318.9,360.5,332.5,351.9,344.3z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-snapchat-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-snapchat-outline.svg
new file mode 100644
index 00000000..773d5d76
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-snapchat-outline.svg
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M256.283,47.553c70.693,0,128,54.682,118,128.931c-2.072,15.388-3.422,31.483-4.26,44.759c0,0,2.402,4.253,12.664,4.253
+ c6.071,0,14.895-1.543,27.596-6.354c2.236-0.847,4.377-1.241,6.377-1.241c7.918,0,13.615,5.931,14.123,12.271
+ c0.426,5.31-4.564,11.199-8.371,13.009c-13.766,6.542-46.991,10.063-46.991,32.638c0,22.576,22.362,46.656,40.862,63.713
+ S480,360.602,480,360.602s0.283,21.57-31.717,29.097c-32,7.524-32.1,5.712-33.25,13.796c-2.133,14.979-1.535,21.378-11.248,21.378
+ c-1.672,0-3.651-0.19-6.002-0.558c-8.23-1.291-19.239-3.644-31.121-3.644c-11.216,0-23.21,2.097-34.379,9.161
+ c-23,14.549-41.283,34.114-76.283,34.114s-53-19.565-76-34.114c-11.17-7.065-23.162-9.161-34.379-9.161
+ c-11.88,0-22.892,2.353-31.121,3.644c-2.352,0.367-4.33,0.558-6.002,0.558c-9.71,0-9.115-6.399-11.248-21.378
+ c-1.151-8.084-1.25-6.27-33.25-13.795s-32-29.097-32-29.097s45.5-4.012,64-21.068c18.5-17.058,40.862-41.134,40.862-63.71
+ c0-22.575-33.226-26.09-46.991-32.632c-3.807-1.81-8.796-7.687-8.371-12.997c0.507-6.336,6.196-12.251,14.107-12.25
+ c2.004,0,4.152,0.38,6.393,1.229c12.749,4.829,21.588,6.342,27.662,6.342c10.204,0,12.598-4.273,12.598-4.273
+ c-0.837-13.275-2.187-29.371-4.259-44.759c-10-74.249,47.307-128.931,118-128.931l0,0 M256.283,32H256
+ c-41.093,0-79.215,16.208-104.591,45.341c-23.982,27.534-34.375,63.345-29.265,101.292c1.416,10.51,2.46,21.231,3.21,30.618
+ c-3.97-0.559-9.686-1.998-17.703-5.034c-3.965-1.502-8.017-2.295-12.043-2.295c-15.641-0.001-28.844,11.852-30.057,27.003
+ c-1.027,12.818,8.235,24.393,17.47,28.783c4.251,2.02,9.181,3.578,14.4,5.232c6.707,2.125,14.309,4.532,19.293,7.703
+ c4.147,2.639,4.147,4.168,4.147,5.182c0,8.66-6.191,24.691-35.688,51.888c-10.499,9.681-39.055,15.501-54.588,16.897l-14.572,1.311
+ L16,360.603c0,1.679,0.312,10.546,6.485,20.319c5.246,8.306,16.073,19.283,37.863,24.407c6.179,1.453,11.186,2.563,15.208,3.454
+ c2.306,0.512,4.555,1.01,6.454,1.453c0.027,0.209,0.054,0.417,0.081,0.623c0.9,7.004,1.611,12.535,4.392,17.75
+ c2.453,4.6,8.574,12.316,22.015,12.316c2.478,0,5.249-0.246,8.472-0.751c1.672-0.263,3.386-0.554,5.2-0.863
+ c7.116-1.212,15.182-2.587,23.451-2.587c10.277,0,18.732,2.188,25.846,6.688c4.531,2.867,8.892,5.972,13.509,9.26
+ C202.967,465.481,223.358,480,256,480c32.726,0,53.293-14.582,71.439-27.446c4.576-3.244,8.898-6.309,13.377-9.142
+ c7.113-4.5,15.568-6.688,25.846-6.688c8.27,0,16.334,1.375,23.449,2.586c1.814,0.311,3.529,0.602,5.202,0.864
+ c3.223,0.505,5.993,0.751,8.472,0.751c13.44,0,19.562-7.715,22.015-12.313c2.781-5.214,3.492-10.746,4.392-17.749
+ c0.027-0.208,0.055-0.418,0.082-0.629c1.898-0.441,4.148-0.941,6.455-1.452c4.023-0.892,9.029-2.001,15.206-3.454
+ c21.851-5.139,32.611-16.17,37.79-24.518c6.098-9.828,6.296-18.736,6.273-20.422l-0.189-14.501l-14.398-1.278
+ c-15.413-1.396-43.8-7.219-54.301-16.9c-16.281-15.011-35.688-36.199-35.688-51.893c0-1.014,0-2.546,4.15-5.186
+ c4.985-3.174,12.589-5.584,19.297-7.71c5.217-1.654,10.144-3.217,14.394-5.236c9.236-4.39,18.498-15.978,17.471-28.807
+ c-1.215-15.166-14.424-27.046-30.072-27.046c-4.021,0-8.068,0.76-12.027,2.259c-8.027,3.041-13.743,4.41-17.705,4.962
+ c0.747-9.319,1.791-20.12,3.211-30.67c5.111-37.948-5.281-73.509-29.264-101.042C335.498,48.208,297.376,32,256.283,32L256.283,32z
+ "/>
+ <path d="M256,229c-20.838,0-40.604-8.29-55.657-23.343c-3.125-3.124-3.124-8.189,0-11.313c3.125-3.124,8.19-3.124,11.313,0
+ C223.688,206.374,239.436,213,256,213c16.387,0,32.15-6.64,44.385-18.698c3.148-3.102,8.213-3.063,11.312,0.082
+ c3.102,3.147,3.064,8.212-0.082,11.313C296.368,220.725,276.617,229,256,229z"/>
+ <ellipse cx="208" cy="152" rx="16" ry="24"/>
+ <ellipse cx="304" cy="152" rx="16" ry="24"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-snapchat.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-snapchat.svg
new file mode 100644
index 00000000..3cfb04fb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-snapchat.svg
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M495.998,360.389l-0.189-14.501l-14.398-1.278c-15.413-1.396-43.8-7.219-54.301-16.9
+ c-16.281-15.011-35.688-36.199-35.688-51.893c0-1.014,0-2.546,4.15-5.186c4.985-3.174,12.589-5.584,19.297-7.71
+ c5.217-1.654,10.144-3.217,14.394-5.236c9.236-4.39,18.498-15.978,17.471-28.807c-1.215-15.166-14.424-27.046-30.072-27.046
+ c-4.021,0-8.068,0.76-12.027,2.259c-8.027,3.041-13.743,4.41-17.705,4.962c0.747-9.319,1.791-20.12,3.211-30.67
+ c5.111-37.948-5.281-73.509-29.264-101.042C335.498,48.208,297.376,32,256.283,32H256c-41.093,0-79.215,16.208-104.591,45.341
+ c-23.982,27.534-34.375,63.345-29.265,101.292c1.416,10.51,2.46,21.231,3.21,30.618c-3.97-0.559-9.686-1.998-17.703-5.034
+ c-3.965-1.502-8.017-2.295-12.043-2.295c-15.641-0.001-28.844,11.852-30.057,27.003c-1.027,12.818,8.235,24.393,17.47,28.783
+ c4.251,2.02,9.181,3.578,14.4,5.232c6.707,2.125,14.309,4.532,19.293,7.703c4.147,2.639,4.147,4.168,4.147,5.182
+ c0,8.66-6.191,24.691-35.688,51.888c-10.499,9.681-39.055,15.501-54.588,16.897l-14.572,1.311L16,360.603
+ c0,1.679,0.312,10.546,6.485,20.319c5.246,8.306,16.073,19.283,37.863,24.407c6.179,1.453,11.186,2.563,15.208,3.454
+ c2.306,0.512,4.555,1.01,6.454,1.453c0.027,0.209,0.054,0.417,0.081,0.623c0.9,7.004,1.611,12.535,4.392,17.75
+ c2.453,4.6,8.574,12.316,22.015,12.316c2.478,0,5.249-0.246,8.472-0.751c1.672-0.263,3.386-0.554,5.2-0.863
+ c7.116-1.212,15.182-2.587,23.451-2.587c10.277,0,18.732,2.188,25.846,6.688c4.531,2.867,8.892,5.972,13.509,9.26
+ C202.967,465.481,223.358,480,256,480c32.726,0,53.293-14.582,71.439-27.446c4.576-3.244,8.898-6.309,13.377-9.142
+ c7.113-4.5,15.568-6.688,25.846-6.688c8.27,0,16.334,1.375,23.449,2.586c1.814,0.311,3.529,0.602,5.202,0.864
+ c3.223,0.505,5.993,0.751,8.472,0.751c13.44,0,19.562-7.715,22.015-12.313c2.781-5.214,3.492-10.746,4.392-17.749
+ c0.027-0.208,0.055-0.418,0.082-0.629c1.898-0.441,4.148-0.941,6.455-1.452c4.023-0.892,9.029-2.001,15.206-3.454
+ c21.851-5.139,32.611-16.17,37.79-24.518C495.822,370.982,496.021,362.074,495.998,360.389z M208,128c8.836,0,16,10.745,16,24
+ s-7.164,24-16,24s-16-10.745-16-24S199.164,128,208,128z M311.615,205.698C296.368,220.725,276.617,229,256,229
+ c-20.838,0-40.604-8.29-55.657-23.343c-3.125-3.124-3.124-8.189,0-11.313c3.125-3.124,8.19-3.124,11.313,0
+ C223.688,206.374,239.436,213,256,213c16.387,0,32.15-6.64,44.385-18.698c3.148-3.102,8.213-3.063,11.312,0.082
+ C314.799,197.531,314.762,202.597,311.615,205.698z M304,176c-8.836,0-16-10.746-16-24s7.164-24,16-24s16,10.746,16,24
+ S312.836,176,304,176z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tumblr-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tumblr-outline.svg
new file mode 100644
index 00000000..9f327c28
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tumblr-outline.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M321.2,396.3c-11.8,0-22.4-2.8-31.5-8.3c-6.9-4.1-11.5-9.6-14-16.4c-2.6-6.9-3.6-22.3-3.6-46.4V224h96v-64h-96V48h-61.9
+ c-2.7,21.5-7.5,44.7-14.5,58.6s-14,25.8-25.6,35.7c-11.6,9.9-25.6,17.9-41.9,23.3V224h48v140.4c0,19,2,33.5,5.9,43.5
+ c4,10,11.1,19.5,21.4,28.4c10.3,8.9,22.8,15.7,37.3,20.5c14.6,4.8,31.4,7.2,50.4,7.2c16.7,0,30.3-1.7,44.7-5.1
+ c14.4-3.4,30.5-9.3,48.2-17.6v-65.6C363.2,389.4,342.3,396.3,321.2,396.3z M368,431c-13.1,5.7-25.1,9.9-35.9,12.4
+ c-13.1,3.1-25.6,4.6-41.1,4.6c-17.2,0-32.5-2.2-45.4-6.4c-12.5-4.1-23.2-10-31.9-17.5c-8.3-7.2-14-14.6-17-22.2
+ c-2.2-5.5-4.8-16.6-4.8-37.6V208H144v-31.3c13.4-5.6,25.5-13,36.3-22.2c13.2-11.2,21.6-24.9,29.6-40.7c7.1-14,11.6-34,14.1-49.8h32
+ v112h96v32h-96v117.1c0,34.6,2.4,46,4.6,52c3.8,10.3,10.8,18.6,21,24.6c11.7,7,25,10.5,39.7,10.5c15.7,0,31.3-3.3,46.7-9.8V431z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tumblr.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tumblr.svg
new file mode 100644
index 00000000..3cd85083
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tumblr.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M321.2,396.3c-11.8,0-22.4-2.8-31.5-8.3c-6.9-4.1-11.5-9.6-14-16.4c-2.6-6.9-3.6-22.3-3.6-46.4V224h96v-64h-96V48h-61.9
+ c-2.7,21.5-7.5,44.7-14.5,58.6c-7,13.9-14,25.8-25.6,35.7c-11.6,9.9-25.6,17.9-41.9,23.3V224h48v140.4c0,19,2,33.5,5.9,43.5
+ c4,10,11.1,19.5,21.4,28.4c10.3,8.9,22.8,15.7,37.3,20.5c14.6,4.8,31.4,7.2,50.4,7.2c16.7,0,30.3-1.7,44.7-5.1
+ c14.4-3.4,30.5-9.3,48.2-17.6v-65.6C363.2,389.4,342.3,396.3,321.2,396.3z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tux.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tux.svg
new file mode 100644
index 00000000..2fb3e4e2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tux.svg
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path fill="#010101" d="M254.7,101.3c-0.6,1-1.2,2-1.7,3.1c1.8-3.5,4.3-6.5,7.4-8.7C258.3,97,256.3,98.8,254.7,101.3
+ C254.1,102.3,256.3,98.8,254.7,101.3z"/>
+ <path fill="#010101" d="M426.3,396c-6.7-4-13.2-11-12-18.8c2.3-15.3,2.5-21.5-0.2-25.8c-1.899-3.2-5.5-5-8.6-5.801
+ c2-2.5,3.1-5.399,3.8-10.899c1.842-14.168-3.239-30.67-6.61-44.243c-4.445-17.9-10.319-34.014-20.432-49.522
+ c-16.489-25.288-37.253-46.804-51.857-73.435c-9.7-29-4.301-47.1-4.801-66.2C324.7,64,298.7,32,261,32h-14c-37.5,0-58,26.9-58,60
+ c0.697,16.666,1.352,33.333,2,50c0.769,19.756,1.98,37.667-8,55.3c-7.033,12.488-19.571,22.43-28.592,33.478
+ c-9.525,11.665-13.06,23.669-17.859,37.619c-5.987,17.401-21.275,30.906-24.886,48.929c-1.658,8.271,2.726,17.857-0.83,24.693
+ c-3.698,7.109-0.813,14.469-2.833,21.682c-3.505,11.729-20.731,10.729-30.215,11.508c-17.602,1.443-11.051,17.988-7.843,29.701
+ c5.598,20.435-19.54,42.078,11.032,50.471c13.989,3.84,28.586,5.13,42.727,8.32c13.981,3.154,26.917,8.612,40.396,13.262
+ c10.469,3.611,20.262,4.146,30.323-1.232c10.982-5.87,18.947-15.083,31.691-17c24.707-3.716,54.829-4.169,79.373,0.63
+ c7.507,1.468,10.075,6.525,14.905,11.766c8.145,8.838,21.514,10.125,32.794,8.22c11.89-2.01,20.846-9.466,29.686-17.112
+ c12.526-10.835,26.137-17.996,40.791-25.547c7.439-3.833,22.178-9.388,24.159-18.903C450.151,406.573,433.642,400.383,426.3,396z
+ M202,451.3c-1.3,13-13.9,20.3-25.4,19.3c-19.502-1.649-37.86-12.237-57.164-15.75c-9.393-1.709-47.351-3.173-46.943-17.079
+ c0.215-7.361,5.751-11.666,7.567-18.415c2.811-10.449-5.753-19.932-6.32-30.16c-0.447-8.081,10.73-7.607,16.288-8.053
+ c8.761-0.702,19.157-2.012,23.572-11.043c1.6-3.3-0.5-15,1.9-21.8c3.527-10.155,15.489-8.949,23.3-4.899
+ c17.762,9.067,28.943,35.546,38.533,51.821C187.058,411.728,204.045,430.843,202,451.3z M318.3,385.7
+ c2.289,11.787,4.224,24.387,1.7,36.3c-2.016,9.516-8.562,15.614-12.7,24c-2.2-6.8,11.3-16.7,9.8-33.7
+ c-0.042-0.475-0.947-10.882-1.036-10.834c-1.979,1.082-3.825,5.075-5.304,6.73c-4.809,5.383-10.771,9.658-16.729,13.677
+ c-13.797,9.306-29.221,15.058-45.83,16.627c-21,2-38-10.5-38-10.5c2.517,8.305,8.992,21,1.1,28.3
+ c1.743-15.648-4.876-28.06-11.6-41.7c46.374-24.639-41.363-64.397-53-79.8c-10.476-13.896-5.553-31.83-2.7-43.5
+ c-3.443,13.775-3.959,41.956,14,46.8c7.922,2.169,5.605-37.071,5.984-41.463c1.58-18.312,7.721-35.997,18.343-51.015
+ c3.399-4.806,1.863-9.533,2.673-15.322c1.693-10.668,7.295-20.547,13.488-29.225c5.169-7.243,1.735-12.618,3.014-21.055
+ c0.727-4.795,5.118,3.193,5.798,4.279c4,6.5,16.7,22.7,24.7,22c13.277-1.161,24.692-15.938,36.015-22.046
+ c3.591-1.937,14.41-5.242,15.866-9.632c1.768-5.33-12.666-0.161-14.114,0.583c-10.782,5.535-31.018,21.448-43.867,15.295
+ c-8.762-4.195-10.691-14.994-17.2-20.5c15.4,13.6,21.5,10.5,27.6,9.1c9.665-2.182,18.797-6.486,27.8-10.5
+ c4.217-1.88,20.107-4.041,22.301-8.7c2.745-5.834-5.05-6.726-8.068-3.58c-6.251,6.515-15.853,8.981-24.097,11.787
+ c-18.885,6.427-37.644,9.131-51.835-8.607c-8.354-10.212,15.558-22.504,22.2-28.8c0,0,1-7.2-0.6-12.7c-1.9-6.5-7.8-9.3-11.9-8.1
+ c-4.1,1.1-8,5.5-6.8,14.8c1,8.3,7,11,7,11s-2.7,3.5-5.2,4.7c0,0-0.8-0.3-3.5-6.3c-2.7-6-6.6-19.5-0.3-31.1
+ c6.3-11.6,19.6-5.2,23.8,3.8c3.9,8.3,2.4,22.7,2.4,22.7c3.358-0.843,6.835-1.3,10.3-1.3c4.242,0,6.814,4.563,10.6,4.8
+ c-0.635,0-0.564-18.124-0.233-20.078c1.099-6.49,4.112-13.619,9.933-17.222c16.087-11.491,34.6,3.916,34.6,21.2
+ c0.024,4.486-0.137,9.215-1.199,13.6c-0.659,2.637-1.582,8.469-5.114,9.177c-1.145,0.23-10.683-0.431-7.985-3.277
+ c12.807-12.812-1.822-38.207-17.4-24.5c-5.601,4.199-5.483,13.833-4.801,20c1.098,9.141,20.51,11.541,26.852,13.78
+ c8.224,2.903,7.943,9.626,6.679,17.116c-1.9,11.26-2.815,18.792,4.381,28.214c7.344,9.616,12.929,20.086,15.915,31.878
+ c1.483,5.859,1.665,10.843,5.621,15.57c5.983,7.151,10.619,14.805,13.291,23.817c5.225,17.621,6.513,35.422,6.162,53.625
+ c-0.5,8.199-2.1,15,8.3,9.699c4-2,6.5-2.899,11-3.699c3.101-6.301,4.4-18.301,4.5-24.301c0.2-13.5-0.3-41.5-27.699-71.5
+ c0,0,28.5,21.7,33,62c2.5,22.301-2,34.4-2,34.4c5.3,1.3,10.8,5.3,13.6,9.8c-0.133-0.22,1.038,1.748,1.179,1.864
+ c-9.811-8.171-31.708-12.859-39.679,0.236c-2,3.3-3.1,7.6-3.2,11.699c-7.1-1.199-12.399,0-16.8,4.9
+ C313.5,358.1,316.3,375.3,318.3,385.7C320.3,396,316.3,375.3,318.3,385.7z M220.6,124.9c-0.2-4.9-2.1-9-4.7-10.8
+ c0.3-0.3,0.8-0.7,1.7-0.4c1.4,0.4,3.5,2.7,4.3,6.3c0.7,2.9,0.4,7.7-1.4,7.7C220.498,126.766,220.531,125.833,220.6,124.9
+ C220.4,120,220.6,125.8,220.6,124.9z M275.3,112.9c0.4-0.3,1.101-0.6,2.3-0.3c1.801,0.4,4.4,2.8,5.301,6.2
+ c0.699,2.8,0.1,7.4-2.2,7.3c-0.005-0.903,0.062-1.803,0.2-2.7C280.8,118.8,278.6,114.8,275.3,112.9
+ C275.7,112.6,278.6,114.8,275.3,112.9z M412.4,432.9c-17.504,7.553-31.304,19.968-47.117,30.19
+ c-13.824,8.937-38.156,8.313-40.022-12.879c-1.565-17.776,4.184-35.288,1.84-53.357c-1.587-12.239-8.534-28.906-2.301-40.854
+ c2.7-5.1,8.101-5.5,12.5-4c3.193,13.267,13.932,23.6,28,23.6c17.031,0,23.542-14.008,34-24.5c3.4,0.2,7.4,1.101,8.8,4.801
+ c2.301,5.8-1.899,17.5-1.8,22.3c0.3,15.7,9,19.2,26.4,29C448,416,436.9,422.3,412.4,432.9C388.3,443.3,436.9,422.3,412.4,432.9z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitch-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitch-outline.svg
new file mode 100644
index 00000000..9f85d6a2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitch-outline.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <g>
+ <path d="M80,32l-32,80v304h96v64h64l64-64h80l112-112V32H80z M416,288l-64,64h-96.001L192,416v-64h-80V80h304V288z"/>
+ </g>
+ <rect x="320" y="143" width="48" height="129"/>
+ <rect x="208" y="143" width="48" height="129"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitch.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitch.svg
new file mode 100644
index 00000000..b3cf6a74
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitch.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M80,32l-32,80v304h96v64h64l64-64h80l112-112V32H80z M256,272h-48V143h48V272z M368,272h-48V143h48V272z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitter-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitter-outline.svg
new file mode 100644
index 00000000..cb687a71
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitter-outline.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M492,109.5c-17.4,7.7-36,12.9-55.6,15.3c20-12,35.4-31,42.6-53.6c-18.7,11.1-39.4,19.2-61.5,23.5
+ C399.8,75.8,374.5,64,346.8,64c-53.5,0-96.8,43.4-96.8,96.9c0,7.6,0.8,15,2.5,22.1C172,179,100.5,140.4,52.8,81.7
+ c-8.3,14.3-13.1,31-13.1,48.7c0,33.6,17.1,63.3,43.1,80.7C67,210.7,52,206.3,39,199c0,0.4,0,0.8,0,1.2c0,47,33.4,86.1,77.7,95
+ c-8.1,2.2-16.7,3.4-25.5,3.4c-6.2,0-12.3-0.6-18.2-1.8c12.3,38.5,48.1,66.5,90.5,67.3c-33.1,26-74.9,41.5-120.3,41.5
+ c-7.8,0-15.5-0.5-23.1-1.4C62.8,432,113.7,448,168.3,448C346.5,448,444,300.3,444,172.2c0-4.2-0.1-8.4-0.3-12.5
+ C462.5,146,479,129,492,109.5z M434.2,146.7l-7,5.1l0.4,8.6c0.2,3.8,0.3,7.8,0.3,11.8c0,30.2-5.9,61.8-17,91.5
+ c-11.7,31.2-28.5,59.4-50,83.8c-23,26.1-50.2,46.5-81.1,60.8c-33.8,15.7-71.3,23.6-111.5,23.6c-28.9,0-57.4-4.8-84.5-14.2
+ c9.9-1.9,19.6-4.6,29.1-7.9c21.7-7.6,41.9-18.7,60.1-33l35.3-27.7l-44.9-0.8c-26.1-0.5-49.7-13.4-64.3-33.9
+ c7.3-0.5,14.5-1.8,21.5-3.7l60.7-20.2l-61.7-10.9c-29.6-5.9-52.8-27.9-61.3-55.8c7.8,2,15.4,2.8,23.9,3.3c0,0,31.8,1.4,55.8-0.1
+ c-13-6.2-46.4-29.2-46.4-29.2c-22.5-15.1-36-40.2-36-67.4c0-6.4,0.8-12.8,2.2-19c21.9,22.4,47,41.1,75.1,55.5
+ c37,19.1,76.9,29.8,118.6,31.9l21.2,1.1l-4.8-20.7c-1.4-5.9-2.1-12.1-2.1-18.5c0-44.4,36.3-80.7,80.9-80.7c22.3,0,43.8,9.3,59,25.6
+ l6.1,6.5l8.7-1.7c4.5-0.9,8.9-1.9,13.3-3.1c-1,1.4-5.7,6.1-11,10.8c-4.5,4-17.8,16.5-17.8,16.5s13,4.1,21.1,5
+ c8.1,0.9,17.4-0.6,18.9-0.8C442.2,141.1,437.2,144.6,434.2,146.7z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitter.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitter.svg
new file mode 100644
index 00000000..c9fb08a8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitter.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M492,109.5c-17.4,7.7-36,12.9-55.6,15.3c20-12,35.4-31,42.6-53.6c-18.7,11.1-39.4,19.2-61.5,23.5
+ C399.8,75.8,374.6,64,346.8,64c-53.5,0-96.8,43.4-96.8,96.9c0,7.6,0.8,15,2.5,22.1c-80.5-4-151.9-42.6-199.6-101.3
+ c-8.3,14.3-13.1,31-13.1,48.7c0,33.6,17.2,63.3,43.2,80.7C67,210.7,52,206.3,39,199c0,0.4,0,0.8,0,1.2c0,47,33.4,86.1,77.7,95
+ c-8.1,2.2-16.7,3.4-25.5,3.4c-6.2,0-12.3-0.6-18.2-1.8c12.3,38.5,48.1,66.5,90.5,67.3c-33.1,26-74.9,41.5-120.3,41.5
+ c-7.8,0-15.5-0.5-23.1-1.4C62.8,432,113.7,448,168.3,448C346.6,448,444,300.3,444,172.2c0-4.2-0.1-8.4-0.3-12.5
+ C462.6,146,479,129,492,109.5z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-usd-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-usd-outline.svg
new file mode 100644
index 00000000..0bf1882a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-usd-outline.svg
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M220.746,102.625c-7.788,1.683-17.44,4.813-24.641,8.529c-9.018,4.649-16.411,10.965-22.604,19.295
+ c-6.706,9.002-10.105,19.989-10.105,32.657c0,17.916,6.197,32.288,18.405,42.702c9.334,7.983,21.504,14.431,36.687,19.165
+ L240,230.667V100.244C240,100.244,231.766,100.244,220.746,102.625z M224,209.699c-12-3.743-23.912-9.088-32.051-16.048
+ c-8.621-7.355-12.673-17.534-12.673-30.545c0-9.241,2.414-16.94,7.004-23.102c4.58-6.161,9.912-11.038,16.88-14.631
+ c6.18-3.189,13.84-5.565,20.84-7.138V209.699z"/>
+ <path d="M348.217,296.725c-8.432-8.289-18.002-14.296-28.414-17.84c-8.949-3.075-17.441-5.848-27.465-8.477L272,265.145v145.188
+ c0,0,12.051-0.642,18.371-1.476s10.703-1.971,16.67-3.798c12.727-3.89,23.309-9.02,31.32-15.25
+ c8.678-6.747,15.145-14.785,19.164-23.907c3.775-8.595,5.706-17.581,5.706-26.711C363.231,320.822,358.188,306.536,348.217,296.725
+ z M342.902,359.471c-2.939,6.673-7.699,12.576-14.303,17.711c-6.602,5.133-15.744,9.328-26.377,12.577
+ c-4.5,1.378-8.223,2.444-14.223,3.236v-107.11c10,2.624,18.18,5.332,26.326,8.131c8.062,2.744,15.748,7.443,22.537,14.116
+ c6.785,6.676,10.309,17.03,10.309,31.06C347.172,346.042,345.834,352.797,342.902,359.471z"/>
+ <path d="M411.387,303.256c-3.119-9.577-7.891-18.561-14.301-26.952c-6.422-8.382-14.396-15.826-23.93-22.331
+ c-9.539-6.498-20.721-11.63-33.553-15.4c-5.143-1.363-14.189-3.506-26.104-6.418c-8.516-2.074-16.5-4.2-25.5-6.367V120.065
+ c9,2.396,15.252,6.202,21.926,10.43c14.279,9.04,23.232,24.505,25.855,45.505h69.174c-0.654-18-4.65-32.76-11.996-46.02
+ c-8.07-14.543-18.977-27.024-32.73-36.956c-13.75-9.922-30.225-17.49-48.377-22.455C303.967,68.416,297,66.605,288,65.386V32h-64
+ v33.167c-7,1.044-15.148,2.445-22.426,4.25c-17.242,4.283-32.388,10.868-45.951,19.764c-13.571,8.905-24.352,20.112-32.604,33.627
+ c-8.251,13.523-12.312,29.52-12.312,48c0,9.585,1.407,18.993,4.157,28.235c2.752,9.241,7.442,17.967,14.042,26.181
+ c6.603,8.214,15.495,15.658,26.687,22.332c11.183,6.672,24.705,12.064,41.576,16.171c9.287,2.345,18.83,4.534,26.83,6.576v119.586
+ c-11-2.919-21.889-7.399-30.678-13.479c-9.17-6.327-16.066-13.953-21.198-23.884c-4.779-9.229-7.073-20.526-7.407-32.526H96
+ c0.695,21,5.25,39.494,13.672,55.371c8.799,16.604,20.533,29.96,35.204,40.562c14.662,10.613,31.393,18.356,51.198,23.491
+ c8.885,2.304,18.926,3.96,27.926,5.23V480h64v-34.54c10-1.069,18.957-2.69,28.527-4.879c18.701-4.273,35.645-11.036,50.316-20.276
+ c14.662-9.24,26.621-21.128,35.611-35.681c8.98-14.541,13.545-32.085,13.545-52.619C416,322.427,414.498,312.841,411.387,303.256z
+ M388.904,376.218c-7.623,12.34-17.873,22.619-30.457,30.55c-13.035,8.21-28.248,14.339-45.219,18.217
+ c-9.059,2.071-17.285,3.564-26.654,4.566L272,431.08V464h-32v-33.244l-13.508-1.943c-9.256-1.307-18.671-2.968-26.271-4.938
+ c-17.865-4.633-32.876-11.51-46.031-21.032c-12.845-9.283-22.77-20.551-30.408-34.967c-5.004-9.437-8.418-20.876-10.268-31.876
+ h36.714c1.529,8,4.162,16.837,7.804,23.869c6.324,12.239,14.979,21.914,26.441,29.823c10.145,7.017,23.81,12.64,35.676,15.724
+ S240,408.667,240,408.667V257.874l-11.786-3.074c-4.952-1.263-11.074-2.583-16.558-3.96c-3.395-0.854-6.814-1.729-10.37-2.626
+ l-0.033-0.017l-0.051-0.017c-14.952-3.64-27.533-8.472-37.411-14.365c-9.487-5.657-17.021-11.92-22.399-18.611
+ c-5.271-6.56-9.029-13.533-11.17-20.722c-2.307-7.755-3.476-15.721-3.476-23.675c0-15.66,3.274-28.636,10.002-39.665
+ c7.097-11.622,16.187-20.973,27.786-28.585c12.201-8.003,25.666-13.764,41.155-17.611c6.334-1.571,12.865-2.901,19.926-3.954
+ L240,78.958V48h32v31.363l13.127,1.877c7.371,0.999,14.236,2.404,22.637,4.699c16.389,4.482,30.91,11.189,43.023,19.929
+ c11.691,8.443,21.182,19.333,28.133,31.862c3.805,6.865,6.504,14.27,8.137,22.27h-38.119c-5.078-19-15.352-33.637-30.172-43.021
+ c-9.254-5.861-17.561-9.215-27.373-12.251C281.766,101.75,272,101.25,272,101.25v137.142l12.529,2.951
+ c7.631,1.837,14.184,3.644,21.453,5.415l3.92,0.938l0.812,0.19c11.373,2.78,19.651,4.799,24.558,6.096
+ c11.084,3.275,20.8,7.721,28.851,13.204c8.078,5.513,14.895,11.853,20.236,18.828c5.291,6.925,9.264,14.393,11.801,22.179
+ c2.562,7.898,3.863,15.91,3.863,23.812C400.023,349.395,396.283,364.271,388.904,376.218z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-usd.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-usd.svg
new file mode 100644
index 00000000..91ba62e1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-usd.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M411.387,303.256c-3.119-9.577-7.891-18.561-14.301-26.952c-6.422-8.382-14.396-15.826-23.93-22.331
+ c-9.539-6.498-20.721-11.63-33.553-15.4c-5.143-1.363-14.189-3.506-26.104-6.418c-8.516-2.074-16.5-4.2-25.5-6.367V120.065
+ c9,2.396,15.252,6.202,21.926,10.43c14.279,9.04,23.232,24.505,25.855,45.505h69.174c-0.654-18-4.65-32.76-11.996-46.02
+ c-8.07-14.543-18.977-27.024-32.73-36.956c-13.75-9.922-30.225-17.49-48.377-22.455C303.967,68.416,297,66.605,288,65.386V32h-64
+ v33.167c-7,1.044-15.148,2.445-22.426,4.25c-17.242,4.283-32.388,10.868-45.951,19.764c-13.571,8.905-24.352,20.112-32.604,33.627
+ c-8.251,13.523-12.312,29.52-12.312,48c0,9.585,1.407,18.993,4.157,28.235c2.752,9.241,7.442,17.967,14.042,26.181
+ c6.603,8.214,15.495,15.658,26.687,22.332c11.183,6.672,24.705,12.064,41.576,16.171c9.287,2.345,18.83,4.534,26.83,6.576v119.586
+ c-11-2.919-21.889-7.399-30.678-13.479c-9.17-6.327-16.066-13.953-21.198-23.884c-4.779-9.229-7.073-20.526-7.407-32.526H96
+ c0.695,21,5.25,39.494,13.672,55.371c8.799,16.604,20.533,29.96,35.204,40.562c14.662,10.613,31.393,18.356,51.198,23.491
+ c8.885,2.304,18.926,3.96,27.926,5.23V480h64v-34.54c10-1.069,18.957-2.69,28.527-4.879c18.701-4.273,35.645-11.036,50.316-20.276
+ c14.662-9.24,26.621-21.128,35.611-35.681c8.98-14.541,13.545-32.085,13.545-52.619C416,322.427,414.498,312.841,411.387,303.256z
+ M224,209.699c-12-3.743-23.912-9.088-32.051-16.048c-8.621-7.355-12.673-17.534-12.673-30.545c0-9.241,2.414-16.94,7.004-23.102
+ c4.58-6.161,9.912-11.038,16.88-14.631c6.18-3.189,13.84-5.565,20.84-7.138V209.699z M342.902,359.471
+ c-2.939,6.673-7.699,12.576-14.303,17.711c-6.602,5.133-15.744,9.328-26.377,12.577c-4.5,1.378-8.223,2.444-14.223,3.236v-107.11
+ c10,2.624,18.18,5.332,26.326,8.131c8.062,2.744,15.748,7.443,22.537,14.116c6.785,6.676,10.309,17.03,10.309,31.06
+ C347.172,346.042,345.834,352.797,342.902,359.471z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-vimeo-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-vimeo-outline.svg
new file mode 100644
index 00000000..91cb5eda
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-vimeo-outline.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M476.9,114c-5-23.4-17.5-38.8-40.6-46.3c-7.4-2.4-16.7-3.7-26.9-3.7c-21.7,0-47.4,6-67.2,20.5
+ c-29.9,21.8-47.6,59.7-53.8,83.8c12.2-5.3,20.8-7.1,31.9-7.1c2.2,0,4.6,0.1,7.1,0.2c15,0.8,24.5,12,24.9,25.3
+ c0.3,9.8-0.2,18.7-3.6,27.7c-10.8,28.7-27.7,56.5-47.6,80.8c-2.9,3.6-6.4,6.9-10,9.9c-4.1,3.4-8,5-11.6,5c-5.2,0-9.9-3.5-13.8-10.2
+ c-5.4-9.3-9-18.9-12.2-29.1c-12.4-39.7-16.8-80.9-23.8-121.6c-3.3-19.5-7-39.8-18-56.9c-10-15.4-24-22.6-41.5-22.6
+ c-2.8,0-5.6,0.2-8.6,0.5c-14.7,1.8-36.9,17.5-47.8,26.4c0,0-56,46.9-81.8,71.4l21.2,27c0,0,17.9-12.5,27.5-18.3
+ c2.9-1.8,6.1-2.8,9.2-2.8c2.9,0,5.7,0.9,8,3c4.5,3.9,9.6,9,12.3,14.1c5.7,10.7,11.2,21.9,14.7,33.4c13.2,44.3,25.5,88.7,37.8,133.3
+ c6.3,22.8,13.9,44.2,28,63.6c13.2,18.2,26.9,26.8,44.3,26.8c8,0,16.8-1.8,26.6-5.4c25.4-9.1,46.6-26.2,66-43.9
+ c33.1-30.2,59.1-65.4,85.5-101.2c20.4-27.7,37.3-55.7,51.4-87C478.5,179.8,484,147.3,476.9,114z M450,203.9
+ c-13.3,29.4-29.1,56.2-49.7,84.1l-0.3,0.4c-26.4,35.7-51.3,69.5-83.1,98.5c-17.8,16.3-37.5,32.4-60.6,40.7c-8.3,3-15.2,4.4-21.2,4.4
+ c-8.2,0-18.4-2.4-31.4-20.2c-13.4-18.4-20.2-39-25.5-58.4c-12.4-45.1-24.6-89.2-37.9-133.6c-3.9-13.2-10.2-25.8-15.9-36.4
+ c-3.2-5.9-8.4-12-15.9-18.6c-5.2-4.5-11.6-6.9-18.6-6.9c-5.9,0-12,1.8-17.5,5.1c-4.5,2.7-10.5,6.7-15.9,10.3l-2.8-3.6
+ c26.9-24.4,68.3-59.1,70.3-60.8C138.8,96.8,155.8,87,163.5,86c2.3-0.3,4.5-0.4,6.6-0.4c12.4,0,21.3,4.9,28.1,15.3
+ c9.5,14.7,12.8,33.9,15.7,50.9c1.6,9.7,3.2,19.6,4.7,29.1c4.8,31.1,9.8,63.3,19.6,94.6c3,9.7,7,21.2,13.6,32.5
+ c8.8,15,19.9,18.1,27.6,18.1c7.4,0,14.7-2.9,21.7-8.6c4.6-3.7,8.7-7.8,12.3-12.2c21.9-26.8,39.3-56.3,50.2-85.3
+ c4.5-12,4.9-23.3,4.6-33.8c-0.6-22.4-17.4-39.6-40-40.9c-2.9-0.2-5.5-0.2-8-0.2c-2.2,0-4.3,0.1-6.3,0.2
+ c8.8-18.1,21.7-36.3,37.7-47.9c15-10.9,36.6-17.5,57.8-17.5c8.3,0,16.1,1,21.9,2.9c17,5.5,26,15.8,29.9,34.4
+ C467.2,145.1,463.4,174.2,450,203.9z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-vimeo.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-vimeo.svg
new file mode 100644
index 00000000..ef74f0bb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-vimeo.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill-rule:evenodd;clip-rule:evenodd;}
+]]>
+</style>
+<path class="st0" d="M476.9,114c-5-23.4-17.5-38.8-40.6-46.3c-23.1-7.5-64.9-4.5-94.1,16.8c-29.9,21.8-47.6,59.7-53.8,83.8
+ c14.7-6.3,24-7.7,39-6.9c15,0.8,24.5,12,24.9,25.3c0.3,9.8-0.2,18.7-3.6,27.7c-10.8,28.7-27.7,56.5-47.6,80.8
+ c-2.9,3.6-6.4,6.9-10,9.9c-10.2,8.3-18.8,6.1-25.4-5.2c-5.4-9.3-9-18.9-12.2-29.1c-12.4-39.7-16.8-80.9-23.8-121.6
+ c-3.3-19.5-7-39.8-18-56.9c-11.6-17.8-28.6-24.6-50-22c-14.7,1.8-36.9,17.5-47.8,26.4c0,0-56,46.9-81.8,71.4l21.2,27
+ c0,0,17.9-12.5,27.5-18.3c5.7-3.4,12.4-4.1,17.2,0.2c4.5,3.9,9.6,9,12.3,14.1c5.7,10.7,11.2,21.9,14.7,33.4
+ c13.2,44.3,25.5,88.7,37.8,133.3c6.3,22.8,13.9,44.2,28,63.6c19.3,26.6,39.6,32.7,70.9,21.5c25.4-9.1,46.6-26.2,66-43.9
+ c33.1-30.2,59.1-65.4,85.5-101.2c20.4-27.7,37.3-55.7,51.4-87C478.5,179.8,484,147.3,476.9,114z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-whatsapp-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-whatsapp-outline.svg
new file mode 100644
index 00000000..3792dec5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-whatsapp-outline.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M209.877,154.114c-4.258-11.323-9.176-10.515-12.45-10.639
+ c-3.277-0.121-6.146-0.061-10.573,0.011c-3.746,0.061-9.882,1.026-15.232,6.413c-5.357,5.378-20.366,18.312-21.404,45.725
+ c-1.031,27.408,18.08,54.643,20.749,58.455c2.667,3.826,36.494,63.236,92.719,87.67c56.231,24.427,56.525,16.981,66.84,16.435
+ c10.325-0.54,33.726-12.246,38.899-25.073c5.172-12.827,5.588-23.979,4.271-26.358c-1.316-2.371-5-3.911-10.51-6.9
+ c-5.516-2.995-32.595-17.498-37.673-19.55c-5.081-2.044-8.787-3.108-12.742,2.329c-3.957,5.422-15.191,17.569-18.596,21.168
+ c-3.42,3.6-6.711,3.934-12.226,0.93c-5.5-2.988-23.373-9.548-44.098-29.317c-16.126-15.38-26.711-34.043-29.779-39.736
+ c-3.069-5.697-0.02-8.604,2.9-11.269c2.618-2.407,5.857-6.301,8.792-9.449c2.919-3.148,3.949-5.43,5.961-9.083
+ c2.007-3.645,1.2-6.932-0.102-9.771C224.32,193.267,214.133,165.437,209.877,154.114z"/>
+ <g>
+ <path d="M260.062,64c50.249,0,97.478,19.402,132.982,54.632C428.482,153.796,448,200.533,448,250.232
+ c0,49.694-19.518,96.43-54.956,131.596c-35.507,35.232-82.735,54.637-132.982,54.637c-31.806,0-63.24-8.023-90.906-23.201
+ l-12.017-6.593l-13.063,4.149l-61.452,19.522l19.375-57.149l4.798-14.151l-7.771-12.763
+ c-17.593-28.898-26.892-62.111-26.892-96.047c0-49.699,19.518-96.436,54.957-131.601C162.596,83.402,209.819,64,260.062,64
+ M260.062,32C138.605,32,40.134,129.701,40.134,250.232c0,41.229,11.532,79.791,31.559,112.687L32,480l121.764-38.682
+ c31.508,17.285,67.745,27.146,106.298,27.146C381.535,468.464,480,370.749,480,250.232C480,129.701,381.535,32,260.062,32
+ L260.062,32z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-whatsapp.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-whatsapp.svg
new file mode 100644
index 00000000..27b2ac50
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-whatsapp.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M260.062,32C138.605,32,40.134,129.701,40.134,250.232c0,41.23,11.532,79.79,31.559,112.687L32,480l121.764-38.682
+ c31.508,17.285,67.745,27.146,106.298,27.146C381.535,468.464,480,370.749,480,250.232C480,129.701,381.535,32,260.062,32z
+ M369.424,333.11c-5.174,12.827-28.574,24.533-38.899,25.072c-10.314,0.547-10.608,7.994-66.84-16.434
+ c-56.225-24.434-90.052-83.844-92.719-87.67c-2.669-3.812-21.78-31.047-20.749-58.455c1.038-27.413,16.047-40.346,21.404-45.725
+ c5.351-5.387,11.486-6.352,15.232-6.413c4.428-0.072,7.296-0.132,10.573-0.011c3.274,0.124,8.192-0.685,12.45,10.639
+ c4.256,11.323,14.443,39.153,15.746,41.989c1.302,2.839,2.108,6.126,0.102,9.771c-2.012,3.653-3.042,5.935-5.961,9.083
+ c-2.935,3.148-6.174,7.042-8.792,9.449c-2.92,2.665-5.97,5.572-2.9,11.269c3.068,5.693,13.653,24.356,29.779,39.736
+ c20.725,19.771,38.598,26.329,44.098,29.317c5.515,3.004,8.806,2.67,12.226-0.929c3.404-3.599,14.639-15.746,18.596-21.169
+ c3.955-5.438,7.661-4.373,12.742-2.329c5.078,2.052,32.157,16.556,37.673,19.551c5.51,2.989,9.193,4.529,10.51,6.9
+ C375.012,309.131,374.596,320.282,369.424,333.11z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-windows-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-windows-outline.svg
new file mode 100644
index 00000000..9e10792f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-windows-outline.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <path class="st0" d="M464,281v180.5l-216-31.3V281H464 M480,265H232v179l248,36V265L480,265z"/>
+ <path class="st0" d="M200,281v142.2L48,401.2V281H200 M216,265H32v150l184,26.7V265L216,265z"/>
+ <path class="st0" d="M464,50v183H248V81.3l216-30.9 M480,32L232,67.4V249h248V32L480,32z"/>
+ <path class="st0" d="M200,88v145H48V109.9l152-21.7 M216,69.7L32,96v153h184V69.7L216,69.7z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-windows.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-windows.svg
new file mode 100644
index 00000000..bf14576b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-windows.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <path class="st0" d="M480,265H232v179l248,36V265L480,265z"/>
+ <path class="st0" d="M216,265H32v150l184,26.7V265L216,265z"/>
+ <path class="st0" d="M480,32L232,67.4V249h248V32L480,32z"/>
+ <path class="st0" d="M216,69.7L32,96v153h184V69.7L216,69.7z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-wordpress-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-wordpress-outline.svg
new file mode 100644
index 00000000..1d6a91bb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-wordpress-outline.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M255.9,64C150.2,64,64,150.2,64,256.1C64,361.9,150.2,448,255.9,448c8.5,0,16.8-0.5,24.9-1.8
+ c85.7-11,153.8-78.7,165.3-164.1c1.3-8.5,1.9-17.2,1.9-26C448,150.2,361.8,64,255.9,64z M83.4,256.1c0-25,5.4-48.8,15-70.2
+ l82.3,225.5C123.1,383.4,83.4,324.3,83.4,256.1z M278.3,427.3c-7.3,0.9-14.8,1.4-22.4,1.4c-16.9,0-33.2-2.5-48.6-7.1l18.8-55h0.1
+ l32.7-95.5L312,416.5c0.4,0.8,0.9,1.6,1.3,2.3C302.1,422.8,290.4,425.6,278.3,427.3z M279.8,175.1c10.4-0.5,19.7-1.6,19.7-1.6
+ c9.4-1,8.2-14.8-1.1-14.2c0,0-28,2.2-46,2.2c-16.9,0-45.5-2.2-45.5-2.2c-9.2-0.6-10.4,13.7-1,14.2c0,0,8.7,1.1,18.1,1.6l26.9,73.7
+ l-37.8,113.3l-62.9-187c10.5-0.5,19.8-1.6,19.8-1.6c9.2-1,8.2-14.8-1.1-14.2c0,0-27.9,2.2-46,2.2c-3.3,0-7.1-0.1-11.1-0.2
+ c30.8-46.8,83.9-77.7,144.1-77.7c45,0,85.9,17.2,116.6,45.2c-0.8,0-1.5-0.1-2.3-0.1c-17,0-29,14.8-29,30.7
+ c0,14.2,8.2,26.2,16.9,40.4c6.6,11.5,14.3,26.3,14.3,47.6c0,14.8-4.4,33.4-13.1,55.7l-17.3,57.6L279.8,175.1z M342.7,405.3
+ l13.7-39.7l39-112.8c9.9-24.6,13.1-44.3,13.1-61.8c0-6.3-0.4-12.3-1.1-17.8c13.5,24.6,21.2,52.8,21.2,82.9c0,8-0.5,15.8-1.5,23.5
+ C419.7,333.3,387.6,379.2,342.7,405.3z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-wordpress.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-wordpress.svg
new file mode 100644
index 00000000..ab77d7e7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-wordpress.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M259,271.3L226.2,367h-0.1l-25.4,73.1c1.8,0.5,3.5,0.9,5.3,1.4c0.1,0,0.2,0,0.3,0c15.8,4.2,32.4,6.5,49.5,6.5
+ c8.5,0,16.8-0.5,24.9-1.8c11.2-1.4,22-3.8,32.5-7.1c0,0,0,0,0,0c2.6-0.8,5.2-1.7,7.8-2.6c-2.8-6-8.8-19.3-9.1-19.9L259,271.3z"/>
+ <path d="M80.8,180.5c-10,22.6-16.8,50.4-16.8,75.5c0,6.3,0.3,12.6,0.9,18.8c6.9,71.2,52.9,131,116.1,157.9c2.6,1.1,5.3,2.2,8,3.2
+ L96,180.6C88,180.3,86.5,180.8,80.8,180.5z"/>
+ <path d="M430.2,175.4c-4.3-9.3-9.4-18.2-15.1-26.6c-1.6-2.4-3.4-4.8-5.1-7.2c-21.5-28.8-50.8-51.4-84.9-64.6
+ C303.7,68.6,280.3,64,255.9,64c-60.3,0-114.2,28-149.4,71.7c-6.5,8-12.3,16.6-17.5,25.6c14.2,0.1,31.8,0.1,33.8,0.1
+ c18.1,0,46-2.2,46-2.2c9.4-0.6,10.4,13.1,1.1,14.2c0,0-9.4,1.1-19.8,1.6l62.9,187l37.8-113.3L224,175.1c-9.4-0.5-18.1-1.6-18.1-1.6
+ c-9.4-0.5-8.2-14.8,1-14.2c0,0,28.5,2.2,45.5,2.2c18.1,0,46-2.2,46-2.2c9.3-0.6,10.5,13.1,1.1,14.2c0,0-9.3,1.1-19.7,1.6
+ l62.3,185.6l17.3-57.6c8.7-22.4,13.1-40.9,13.1-55.7c0-21.3-7.7-36.1-14.3-47.6c-8.7-14.3-16.9-26.3-16.9-40.4
+ c0-15.9,12-30.7,29-30.7c0.7,0,1.5,0,2.2,0c26.2-0.7,34.8,25.3,35.9,43c0,0,0,0.4,0,0.6c0.4,7.2,0.1,12.5,0.1,18.8
+ c0,17.4-3.3,37.1-13.1,61.8l-39,112.8l-22.3,65.7c1.8-0.8,3.5-1.6,5.3-2.5c56.7-27.4,98-82,106.7-146.7c1.3-8.5,1.9-17.2,1.9-26
+ C448,227.3,441.6,199.9,430.2,175.4z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yahoo-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yahoo-outline.svg
new file mode 100644
index 00000000..97ea51f8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yahoo-outline.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M384.6,68.4c-11.3,0-22.5-0.8-32.6-4.4l-96,160L160,64c-10.1,3.6-20.7,4.4-32,4.4c-11.1,0-22.1-0.9-32-4.4l128,212.7V448
+ c10-3.5,20.8-4.4,32-4.4s22,0.9,32,4.4V277L416,64C406.1,67.4,395.7,68.4,384.6,68.4z M274.2,268.5l-2.2,4v4.4v151.3
+ c-5-0.6-11.2-0.7-16-0.7c-4.8,0-10,0.1-16,0.7V276.7v-4.4l-2.4-3.8L127,84.4c0.3,0,0.7,0,1,0c7.6,0,16-0.3,24.7-1.9l89.8,149.8
+ l13.4,22.8l14-22.9l89.8-149.9c9,1.6,17.6,1.7,24.8,1.7c0.2,0,0.3,0,0.5,0L274.2,268.5z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yahoo.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yahoo.svg
new file mode 100644
index 00000000..ef498565
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yahoo.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M384.6,68.4c-11.3,0-22.5-0.8-32.6-4.4l-96,160L160,64c-10.1,3.6-20.7,4.4-32,4.4c-11.1,0-22.1-0.9-32-4.4l128,212.7V448
+ c10-3.5,20.8-4.4,32-4.4s22,0.9,32,4.4V277L416,64C406.1,67.4,395.7,68.4,384.6,68.4z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yen-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yen-outline.svg
new file mode 100644
index 00000000..1d087801
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yen-outline.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M448,32h-80L256,253.128L144,32H64l112.368,208H128v48h73.564L216,319v17h-88v48h88v96h80v-96h88v-48h-88v-17l14.891-31H384
+ v-48h-48.289L448,32z M368,256v16h-67l-21,43v37h88v16h-88v96h-48v-96h-88v-16h88v-35.75L212,272h-68v-16h59.197l-12.752-23.605
+ L90.829,48H134l122,240L378,48h43h0.18l-99.548,184.399L308.891,256H368z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yen.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yen.svg
new file mode 100644
index 00000000..ac2b0294
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yen.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M448,32h-80L256,253.128L144,32H64l112.368,208H128v48h73.564L216,319v17h-88v48h88v96h80v-96h88v-48h-88v-17l14.891-31H384
+ v-48h-48.289L448,32z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-youtube-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-youtube-outline.svg
new file mode 100644
index 00000000..d8833633
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-youtube-outline.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M265,96c65.3,0,118.7,1.1,168.1,3.3l0.7,0h0.7c23.1,0,42,22,42,49.1v1.1l0.1,1.1c2.3,34,3.4,69.3,3.4,104.9v0v0
+ c0.1,35.6-1.1,70.9-3.4,104.9l-0.1,1.1v1.1c0,13.8-4.7,26.6-13.4,36.1c-7.8,8.6-18,13.4-28.6,13.4h-0.8l-0.8,0
+ c-52.9,2.5-108.8,3.8-166.4,3.8c-3.5,0-7.1,0-10.6,0H256h-0.1c-3.6,0-7.2,0-10.8,0c-57.8,0-113.7-1.3-166.2-3.7l-0.8,0h-0.8
+ c-10.6,0-20.7-4.8-28.5-13.4c-8.6-9.5-13.4-22.3-13.4-36.1v-1.1l-0.1-1.1c-2.4-34.1-3.5-69.4-3.3-104.7v-0.1v-0.1
+ c-0.1-35.3,1-70.5,3.3-104.6l0.1-1.1v-1.1c0-27.2,18.8-49.3,41.9-49.3H78l0.7,0c49.5-2.3,102.9-3.3,168.2-3.3h9H265 M265,64
+ c-3,0-6,0-9,0s-6,0-9,0c-57.6,0-114.2,0.8-169.6,3.3c-40.8,0-73.9,36.3-73.9,81.3C1,184.4-0.1,220,0,255.7
+ c-0.1,35.7,0.9,71.3,3.4,107c0,45,33.1,81.6,73.9,81.6c54.8,2.6,110.7,3.8,167.8,3.8c3.6,0,7.3,0,10.9,0c3.6,0,7.2,0,10.7,0
+ c57.1,0,113-1.2,167.9-3.8c40.9,0,74-36.6,74-81.6c2.4-35.7,3.5-71.4,3.4-107.1c0.1-35.7-1-71.3-3.4-107.1c0-45-33.1-81.1-74-81.1
+ C379.2,64.8,322.7,64,265,64L265,64z"/>
+ </g>
+ <g>
+ <path d="M207,353.8V157.4l145,98.2L207,353.8z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-youtube.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-youtube.svg
new file mode 100644
index 00000000..2347549f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-youtube.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M508.6,148.8c0-45-33.1-81.2-74-81.2C379.2,65,322.7,64,265,64c-3,0-6,0-9,0s-6,0-9,0c-57.6,0-114.2,1-169.6,3.6
+ c-40.8,0-73.9,36.4-73.9,81.4C1,184.6-0.1,220.2,0,255.8C-0.1,291.4,1,327,3.4,362.7c0,45,33.1,81.5,73.9,81.5
+ c58.2,2.7,117.9,3.9,178.6,3.8c60.8,0.2,120.3-1,178.6-3.8c40.9,0,74-36.5,74-81.5c2.4-35.7,3.5-71.3,3.4-107
+ C512.1,220.1,511,184.5,508.6,148.8z M207,353.9V157.4l145,98.2L207,353.9z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/soup-can-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/soup-can-outline.svg
new file mode 100644
index 00000000..b1bf3a96
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/soup-can-outline.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M255.82,144c88.269,0,159.824-28.654,159.824-64S344.089,16,255.82,16C167.552,16,95.997,44.654,95.997,80
+ S167.552,144,255.82,144z M255.82,33.041c69.729,0,126.26,19.234,126.26,42.959s-56.531,42.959-126.26,42.959
+ c-69.729,0-126.258-19.234-126.258-42.959S186.091,33.041,255.82,33.041z"/>
+ <path d="M256.57,160c-88.269,0-160.567-28.654-160.567-64c0,0-0.003,33.999,7.997,40v240c0,35.346,63.732,64,152,64
+ c88.269,0,152-28.654,152-64V136c8-7.438,7.708-34.853,7.817-40C414.665,130.946,344.116,160,256.57,160z M376,375.588
+ c0,2.232-7.961,10.682-29.423,18.688C322.853,403.126,290.812,408,256.273,408c-34.539,0-66.83-4.874-90.554-13.725
+ C144.257,386.27,137,377.82,136,375.588v-79.564c18,9.721,42.742,17.115,72.156,20.979l1.588,0.237
+ C215.487,337.308,233.936,352,255.826,352c21.89,0,40.338-14.689,46.084-34.754l1.755-0.244
+ C333.08,313.139,358,305.744,376,296.023V375.588z M376,264.023c-18,9.831-43.476,17.284-73.325,21.11l-2.61,0.195
+ C292.791,268.097,275.723,256,255.859,256c-19.867,0-36.919,12.102-44.19,29.34l-2.514-0.206
+ c-29.85-3.826-55.155-11.279-73.155-21.11v-91.265C170,185.25,211.923,192,256.499,192C300.665,192,343,185.287,376,173.045
+ V264.023z"/>
+ <g>
+ <path d="M274.002,463.58"/>
+ <path d="M256.272,464c0.293,0,0.583-0.006,0.876-0.007c-0.351,0.001-0.699,0.005-1.051,0.005
+ C256.156,463.998,256.214,464,256.272,464z"/>
+ <path d="M408,415.999V400c0,36.001-63.432,64-152,64c-88.569,0-152-28.654-152-64v15.999L96.261,432
+ c0,6.994,2.938,13.725,8.117,20.025C125.37,477.562,185.471,496,256.273,496c70.801,0,130.87-18.438,151.863-43.975
+ c5.18-6.301,7.923-13.031,7.923-20.025L408,415.999z"/>
+ </g>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/soup-can.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/soup-can.svg
new file mode 100644
index 00000000..53e3c291
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/soup-can.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <ellipse cx="256" cy="80" rx="160" ry="64"/>
+ <path d="M256,440c88.365,0,152-28.654,152-64V248c0,28.581-41.612,52.783-104.26,61.002C301.238,333.16,280.82,352,256,352
+ s-45.238-18.84-47.74-42.998C145.612,300.783,104,276.581,104,248v128C104,411.346,167.634,440,256,440z"/>
+ <path d="M256,160c-88.366,0-160-28.654-160-64c0,0,0,32.834,8,40v96c0,28.732,42.049,53.042,105.25,61.134
+ C214.176,271.861,233.229,256,256,256s41.824,15.861,46.75,37.134C365.951,285.042,408,260.732,408,232v-96c8-8.25,8-40,8-40
+ C416,131.346,344.365,160,256,160z"/>
+ <path d="M408,392c0,35.346-63.635,64-152,64c-88.366,0-152-28.654-152-64v23.999L96,432c0,6.994,2.815,13.725,8,20.025
+ C125.016,477.562,185.121,496,256,496c70.879,0,130.984-18.438,152-43.975c5.186-6.301,8-13.031,8-20.025l-8-16.001V392z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/speakerphone.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/speakerphone.svg
new file mode 100644
index 00000000..b41b235c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/speakerphone.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M70.9,181.5c0-41,25-76.5,60.6-91.5h-7.7c-41.1,0-75.1,32.8-81.1,75.2c-6,1-10.7,7.9-10.7,16.1c0,8.6,5.1,15.4,11.6,15.9
+ c7.2,36.4,35.1,65.8,69.7,68.8c0,0,0.1,0,0.1,0c1.4,0,2.8,0.6,4.2,0.9c1.1,0.2,2.2,0.4,3.3,0.7C91,250.5,70.9,218.4,70.9,181.5z"/>
+ <path d="M465.1,91c-1.1-2.9-2.3-5.6-3.5-8.3c-6.5-14.4-14.4-26-23.4-34.6C427,37.6,414.1,32,400.8,32c-8.3,0-16.4,2.2-24.1,6.4
+ c0,0,0,0-0.1,0c-1.2,0.7-2.4,1.3-3.6,2c-49,29-104.1,46.2-162.6,49.4c-6.5,0.4-13,0.2-19.5,0.2h-42.3c-34,15-59,50.5-59,91.5
+ c0,36.8,19.2,69.1,47.8,86.1c13,10.9,41.7,11.7,40,23.9c-1.9,13.2-5.5,21.9-7.8,30.7c-1.3,4.8-23.6,72.9-25.3,144.7
+ c0,2,0,3.7,0.2,6.6c0.2,2.9,2.2,6.4,8.5,6.4h76.8c6.6,0,9.7-3.3,9.3-9.3c-0.2-1.9-0.6-4.3-0.8-6.5c-2.4-23.1-4.6-49.8-3.3-81.6
+ c1.3-34,5.2-51.9,7-61.3c2.1-10.4,7.6-22.4,12.1-30.3c30.8,0.9,92.9,19.3,115.1,28.9c0,0,7.2,3.4,10.1,5.2c7,3.4,14.2,5.1,21.6,5.1
+ c0.9,0,1.8,0,2.7-0.1c12.3-0.7,24.2-9.7,34.7-19.5c9.1-8.5,16.9-20.2,23.4-34.6c1.2-2.8,2.4-5.6,3.5-8.6
+ c9.6-25,14.8-55.9,14.8-88.1C480,147,474.8,116,465.1,91z M442,267.5c-7.8,18.5-18.2,33.3-29.5,33.3c-11.3,0-21.6-14.7-29.4-33.3
+ c-9.1-21.6-14.9-53.1-14.9-88.1c0-35.2,5.8-66.8,15-88.4c7.8-18.4,18.1-29.5,29.3-29.5c11.3,0,21.5,11.2,29.4,29.5
+ c9.2,21.6,15,53.2,15,88.4C456.9,214.4,451.1,245.9,442,267.5z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/speedometer.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/speedometer.svg
new file mode 100644
index 00000000..977e00a2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/speedometer.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M344,256l-84.4,64.2c-1.2-0.1-2.4-0.2-3.6-0.2c-17.7,0-32,14.3-32,32c0,17.7,14.3,32,32,32c17.7,0,32-14.3,32-32
+ c0-1.2-0.1-2.4-0.2-3.6L352,264L344,256z"/>
+ <path d="M256,96C132.3,96,32,196.3,32,320c0,34.4,7.8,66.9,21.6,96h36.1c-15.4-26.6-24.2-56.6-25.5-88H96v-16H64.2
+ c1.2-28.8,8.7-56.5,21.8-81.4l27.5,15.9l8-13.9L94,216.8c7.4-11.6,16.2-22.6,26.2-32.6c10.2-10.1,21.3-19,33.1-26.5l15.8,27.3
+ l13.9-8l-15.8-27.3c24.8-13,52.2-20.3,80.8-21.5V160h16v-31.8c28.6,1.2,56,8.6,80.8,21.5L329.1,177l13.9,8l15.8-27.3
+ c11.8,7.5,22.9,16.4,33.1,26.5c10,10,18.7,20.9,26.2,32.6l-27.4,15.8l8,13.9l27.5-15.9c13.1,24.9,20.6,52.6,21.8,81.4H416v16h31.8
+ c-1.3,31.4-10.1,61.4-25.5,88h36.1c13.8-29.1,21.6-61.6,21.6-96C480,196.3,379.7,96,256,96z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/spoon.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/spoon.svg
new file mode 100644
index 00000000..21e19ed8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/spoon.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M320,160C320,96,293.5,32,256,32s-64,64-64,128l0,0c0.9,25,15.7,54.3,36.6,64.3c0.5,0.2,0.9,0.4,1.4,0.6c0,0,0,0,0.1,0
+ c3.4,1.9,9.8,5.5,9.8,9.7c0,0-16,198.7-16,210.1s5,20.5,10.5,26c5.5,5.5,13.1,9.2,21.3,9.2c0.1,0,0.1,0,0.2,0c0.1,0,0.1,0,0.2,0
+ c8.2,0,15.8-3.7,21.4-9.2c5.5-5.5,10.3-12.9,10.3-26s-16-210.1-16-210.1c0-4.2,6.4-7.9,9.8-9.8l1.7-0.9C304.9,214,320,186,320,160"
+ />
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/star.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/star.svg
new file mode 100644
index 00000000..b8285b7b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/star.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<polygon points="480,200 308.519,200 256.029,32 203.519,200 32,200 170.946,304.209 116,480 256,368 396,480 341.073,304.195 "/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/stats-bars.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/stats-bars.svg
new file mode 100644
index 00000000..59b2c544
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/stats-bars.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <rect x="176" y="96" width="64" height="320"/>
+ <rect x="80" y="320" width="64" height="96"/>
+ <rect x="272" y="256" width="64" height="160"/>
+ <rect x="368" y="192" width="64" height="224"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/steam.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/steam.svg
new file mode 100644
index 00000000..b04c04f2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/steam.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<path id="Gears" class="st0" d="M480,208.2c0,20.5-16.6,37.2-37.2,37.2c-20.5,0-37.2-16.6-37.2-37.2c0-20.5,16.6-37.2,37.2-37.2
+ C463.3,171,480,187.7,480,208.2z M442.6,139c-38.1,0-69,30.7-69.4,68.7L330,269.7c-1.8-0.2-3.6-0.3-5.4-0.3
+ c-9.7,0-18.7,2.7-26.4,7.3l-195.8-78.7c-5.1-23.2-25.9-40.7-50.6-40.7C23.3,157.2,0,180.6,0,209.1c0,28.5,23.3,51.8,51.8,51.8
+ c9.7,0,18.7-2.7,26.4-7.3L274,332.2c5.1,23.3,25.8,40.8,50.6,40.8c26.8,0,49-20.6,51.5-46.7l66.5-48.6c38.3,0,69.4-31,69.4-69.3
+ C512,170.1,480.9,139,442.6,139z M442.6,161.9c25.7,0,46.5,20.9,46.5,46.5c0,25.7-20.9,46.4-46.5,46.4c-25.7,0-46.5-20.8-46.5-46.4
+ C396.1,182.7,416.9,161.9,442.6,161.9z M51.8,170.9c14.6,0,27.3,8.2,33.7,20.2l-18.9-7.6v0.1c-15.3-5.5-32.2,2-38.3,17.1
+ c-6.1,15.2,0.9,32.3,15.7,38.9v0.1l16.1,6.4c-2.6,0.6-5.4,0.9-8.2,0.9c-21.1,0-38.1-17-38.1-38.1C13.7,188,30.7,170.9,51.8,170.9z
+ M324.6,283.1c21.1,0,38.1,17,38.1,38.1c0,21.1-17,38.1-38.1,38.1c-14.7,0-27.4-8.2-33.7-20.3c6.3,2.5,12.5,5,18.8,7.6
+ c15.5,6.2,33.2-1.3,39.4-16.8c6.2-15.5-1.3-33.1-16.9-39.4l-15.9-6.4C319.1,283.5,321.8,283.1,324.6,283.1z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/stop.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/stop.svg
new file mode 100644
index 00000000..2f1ac061
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/stop.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M437.4,64H74.6C68.7,64,64,68.7,64,74.6v362.8c0,5.9,4.7,10.6,10.6,10.6h362.8c5.8,0,10.6-4.7,10.6-10.6V74.6
+ C448,68.7,443.2,64,437.4,64z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thermometer.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thermometer.svg
new file mode 100644
index 00000000..115493d3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thermometer.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M303,335.6V78.4c0-25.7-21-46.5-47-46.5c-26,0-47,20.8-47,46.5v256.8c-20,14.5-32.9,38.2-32.9,64.9c0,44.2,36,80,80.2,80
+ c44.2,0,79.8-35.8,79.8-80C336,373.6,323,350.1,303,335.6z M241,78.4c0-8,6.7-14.5,15-14.5s15,6.5,15,14.5V128h-30V78.4z M272,288
+ h-16v-16h16V288z M272,256h-16v-64h16V256z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thumbsdown.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thumbsdown.svg
new file mode 100644
index 00000000..2902b020
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thumbsdown.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M87.8,252.7C74,257.2,64,270.2,64,285.5c0,19,15.4,34.5,34.5,34.5h102.6c-2,25-10,53.6-1.1,87.3
+ c7.5,28.4,39.4,49.7,52.4,36.8c5-4.9,3.5-15.2,3.5-33.8c0-42.8,17.8-86.1,39.8-108.7c9.4-9.7,25.2-13,40.2-13.6v16h112V64H336v32
+ c-20.6,0.5-52.6-5.2-75.8-6.6c-52-3.1-102,2.4-126.3,8.1c-24.3,5.7-35,13-35,30.6c0,6.4,1.9,12.3,5.1,17.3
+ c-11.8,4.7-20.1,16.2-20.1,29.7c0,7.2,2.4,13.8,6.4,19.2c-11.9,4.6-20.4,16.2-20.4,29.8C70,236.6,77.3,247.5,87.8,252.7z M400,96.3
+ c8.8,0,16,7.1,16,16c0,8.8-7.2,16-16,16s-16-7.1-16-16C384,103.5,391.2,96.3,400,96.3z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thumbsup.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thumbsup.svg
new file mode 100644
index 00000000..bf01b9bf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thumbsup.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M424.2,259.3c13.8-4.5,23.8-17.5,23.8-32.8c0-19-15.4-34.5-34.5-34.5H310.9c2-25,10-53.6,1.1-87.3
+ c-7.5-28.4-39.4-49.7-52.4-36.8c-5,4.9-3.5,15.2-3.5,33.8c0,42.8-17.8,86.1-39.8,108.7c-9.4,9.7-25.2,13-40.2,13.6v-16H64v240h112
+ v-32c20.6-0.5,52.6,5.2,75.8,6.6c52,3.1,102-2.4,126.3-8.1c24.3-5.7,35-13,35-30.6c0-6.4-1.9-12.3-5.1-17.3
+ c11.8-4.7,20.1-16.2,20.1-29.7c0-7.2-2.4-13.8-6.4-19.2c11.9-4.6,20.4-16.2,20.4-29.8C442,275.4,434.7,264.5,424.2,259.3z
+ M112,415.7c-8.8,0-16-7.1-16-16c0-8.8,7.2-16,16-16s16,7.1,16,16C128,408.5,120.8,415.7,112,415.7z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/toggle-filled.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/toggle-filled.svg
new file mode 100644
index 00000000..6680dda0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/toggle-filled.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M352,208c-26.467,0-48,21.533-48,48c0,26.467,21.533,48,48,48s48-21.533,48-48C400,229.533,378.467,208,352,208z"/>
+ <path d="M352,128H160c-70.692,0-128,57.308-128,128s57.308,128,128,128h192c70.692,0,128-57.308,128-128S422.692,128,352,128z
+ M352,336c-44.183,0-80-35.817-80-80s35.817-80,80-80s80,35.817,80,80S396.183,336,352,336z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/toggle.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/toggle.svg
new file mode 100644
index 00000000..b177aa94
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/toggle.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M352,160c52.934,0,96,43.065,96,96s-43.066,96-96,96H160c-52.935,0-96-43.065-96-96s43.065-96,96-96H352 M352,128H160
+ c-70.692,0-128,57.308-128,128s57.308,128,128,128h192c70.692,0,128-57.308,128-128S422.692,128,352,128L352,128z"/>
+ <path d="M160,208c26.467,0,48,21.533,48,48c0,26.467-21.533,48-48,48s-48-21.533-48-48C112,229.533,133.533,208,160,208 M160,176
+ c-44.183,0-80,35.817-80,80s35.817,80,80,80s80-35.817,80-80S204.183,176,160,176L160,176z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/transgender.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/transgender.svg
new file mode 100644
index 00000000..5a43b009
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/transgender.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M368,0v40h69.873l-93.046,91.97c-8.529-8.249-15.132-12.586-15.132-12.586C308.841,104.694,283.422,96,256,96
+ c-34.525,0-65.86,13.669-88.903,35.894l-17.333-17.131l35.833-35.833L153.07,46.403l-36.022,36.021L74.127,40H144V0H0v144h40V67.806
+ l46.085,45.582L50.402,149.07l32.526,32.526l35.862-35.861l22.185,21.942c-8.395,17.065-13.118,36.267-13.118,56.578
+ C127.857,286.884,173,338.989,232,350.25V402h-72v46h72v64h48v-64h72v-46h-72v-51.75c58-11.261,104.222-63.397,104.222-126.025
+ c0-20.202-4.794-39.738-13.094-56.649L472,67.806V144h40V0H368z M255.929,304.402c-44.156,0-80.079-35.968-80.079-80.178
+ c0-44.211,35.923-80.18,80.079-80.18c44.155,0,80.078,35.969,80.078,80.18C336.007,268.435,300.084,304.402,255.929,304.402z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trash-a.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trash-a.svg
new file mode 100644
index 00000000..1631e74d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trash-a.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M341,128V99c0-19.1-14.5-35-34.5-35H205.4C185.5,64,171,79.9,171,99v29H80v32h9.2c0,0,5.4,0.6,8.2,3.4c2.8,2.8,3.9,9,3.9,9
+ l19,241.7c1.5,29.4,1.5,33.9,36,33.9h199.4c34.5,0,34.5-4.4,36-33.8l19-241.6c0,0,1.1-6.3,3.9-9.1c2.8-2.8,8.2-3.4,8.2-3.4h9.2v-32
+ h-91V128z M192,99c0-9.6,7.8-15,17.7-15h91.7c9.9,0,18.6,5.5,18.6,15v29H192V99z M183.5,384l-10.3-192h20.3L204,384H183.5z
+ M267.1,384h-22V192h22V384z M328.7,384h-20.4l10.5-192h20.3L328.7,384z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trash-b.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trash-b.svg
new file mode 100644
index 00000000..f75e2f83
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trash-b.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M413.7,133.4c-2.4-9-4-14-4-14c-2.6-9.3-9.2-9.3-19-10.9l-53.1-6.7c-6.6-1.1-6.6-1.1-9.2-6.8c-8.7-19.6-11.4-31-20.9-31
+ h-103c-9.5,0-12.1,11.4-20.8,31.1c-2.6,5.6-2.6,5.6-9.2,6.8l-53.2,6.7c-9.7,1.6-16.7,2.5-19.3,11.8c0,0-1.2,4.1-3.7,13
+ c-3.2,11.9-4.5,10.6,6.5,10.6h302.4C418.2,144.1,417,145.3,413.7,133.4z"/>
+ <path d="M379.4,176H132.6c-16.6,0-17.4,2.2-16.4,14.7l18.7,242.6c1.6,12.3,2.8,14.8,17.5,14.8h207.2c14.7,0,15.9-2.5,17.5-14.8
+ l18.7-242.6C396.8,178.1,396,176,379.4,176z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trophy.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trophy.svg
new file mode 100644
index 00000000..b1600f40
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trophy.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M479.863,103.342c-0.051-2.833-0.096-5.279-0.096-7.342h-80.835c1.56-34.617,0.512-64,0.512-64s-95.591,0-142.568,0
+ c-0.337,0-0.669,0.022-1,0.056c-0.33-0.034-0.662-0.056-1-0.056c-46.977,0-142.931,0-142.931,0s-1.048,29.383,0.512,64H32.232H32
+ v20.548c0,0.114,0,0.228,0,0.342V128h0.161c0.811,26.096,4.98,60.999,22.333,96.729c14.718,30.307,35.912,55.664,62.996,75.367
+ c22.422,16.312,48.041,28.064,76.205,35.084C209.96,352.539,226,362.109,240,365.957v35.625C238,412.165,225.86,448,141.234,448H128
+ v32h256v-32h-13.178C271.538,448,272,398.666,272,398.666v-32.714c14-3.843,29.73-13.374,45.91-30.644
+ c28.369-7.004,54.072-18.801,76.633-35.213c27.082-19.703,48.262-45.06,62.98-75.367
+ C481.203,175.967,480.326,128.723,479.863,103.342z M83.262,210.745C68.802,180.966,65.018,150.996,64.187,128h50.487
+ c0.868,8.914,1.966,17.701,3.356,25.98c8.513,50.709,20.213,95.493,42.354,135.009C126.546,271.848,99.97,245.149,83.262,210.745z
+ M428.737,210.745c-16.807,34.61-43.603,61.421-77.729,78.55c22.215-39.591,33.816-84.475,42.352-135.314
+ c1.39-8.28,2.488-17.067,3.356-25.98h51.096C446.981,150.996,443.198,180.966,428.737,210.745z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/tshirt-outline.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/tshirt-outline.svg
new file mode 100644
index 00000000..2d2863f2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/tshirt-outline.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M178.249,85.534c18.761,22.976,43.909,34.009,77.445,34.572l0.269-0.106h0.269c22.638,0,41.169-4.861,56.653-15.091
+ c7.801-5.154,14.721-11.47,21.029-19.382l104.461,31.367L426.59,149.41l-38.743-4.685l-37.912-4.589l2.114,38.133L366.176,433
+ H145.824l14.127-254.729l2.106-37.981l-37.782,4.428l-38.854,4.553l-11.767-32.358L178.249,85.534 M320,48
+ c-13.988,27.227-30.771,40.223-63.769,40.223C223.723,87.676,205.722,75,192,48L32,96l32,88l64-7.5L112,465h288l-16-288.5l64,7.75
+ L480,96L320,48L320,48z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/tshirt.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/tshirt.svg
new file mode 100644
index 00000000..6a38c489
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/tshirt.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M480,96L320,48c-13.988,27.227-30.771,40.223-63.769,40.223C223.723,87.676,205.722,75,192,48L32,96l32,88l64-8l-16,288h288
+ l-16-288l64,8L480,96z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/umbrella.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/umbrella.svg
new file mode 100644
index 00000000..df578e51
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/umbrella.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <g>
+ <path d="M376.2,288c0,0.1,0,0.2,0,0.4C376.2,288.2,376.2,288.1,376.2,288L376.2,288z"/>
+ <path d="M136.2,288c0,0.1,0,0.2,0,0.4C136.2,288.2,136.2,288.1,136.2,288L136.2,288z"/>
+ </g>
+ <path d="M272,48.8c0-0.3,0-0.5,0-0.8c0-8.8-7.2-16-16-16c-8.8,0-16,7.2-16,16c0,0.2,0,0.5,0,0.7c-116.3,8-208,103.1-208,221.4
+ c0,3.6,0.2,14.2,0.4,17.8c2.7-26.3,24.7-51.7,51.7-51.7c28.7,0,51.9,23.1,52.1,51.7h0c0.2-28.6,23.4-51.7,52.1-51.7
+ c26.5,0,50.9,21.1,51.7,45.5V416c0,17.9-14.1,32-32,32c-17.1,0-31-14.4-31-32c0-8.8-7.2-16-16-16s-16,7.2-16,16
+ c0,35.3,28.3,64,63,64c17.3,0,33.5-6.7,45.5-18.8c11.9-12,18.5-28.1,18.5-45.2l0-135.3c3.3-32.7,23.4-44.4,52.1-44.4
+ c28.7,0,51.9,23.1,52.1,51.7h0c0.2-28.6,23.4-51.7,52.1-51.7c26.1,0,47.6,26.7,51.4,51.7c0.1-2.8,0.2-9.1,0.2-11.8
+ C480,157.8,388.2,57.3,272,48.8z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/university.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/university.svg
new file mode 100644
index 00000000..ca0a190f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/university.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <polygon points="256,64 32,176.295 64,197.367 64,400 96,416 96,217.849 255.852,320 387.996,234.549 480,174.727 "/>
+ <path d="M390.13,256L256,343.768L120.531,256L112,337.529C128,349.984,224,416,256.002,448C288,416,384,350.031,400,337.561
+ L390.13,256z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/unlocked.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/unlocked.svg
new file mode 100644
index 00000000..51938827
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/unlocked.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M86.4,480h339.2c12.3,0,22.4-9.9,22.4-22.1V246c0-12.2-10-22-22.4-22H161v-30.9c0-27.3,9.9-61.1,28.1-80.3l0,0l0-0.3
+ C206.7,93.9,231,83,255.9,83h0.1h0.1c24.9,0,49.2,10.9,66.8,29.5l0,0.2l0,0.1c11.3,11.9,19.4,29.3,24,47.3h53.4
+ c-5.9-31.3-19.7-61.8-39.2-82.4C334.9,49.9,297.4,32,256.1,32c-0.1,0-0.1,0-0.1,0c0,0-0.1,0-0.1,0c-41.3,0-79,17.9-105.3,45.6
+ c-26.4,27.8-42.6,73.9-42.6,115.4V224H89h-2.6C74,224,64,233.9,64,246v211.9C64,470.1,74,480,86.4,480z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/upload.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/upload.svg
new file mode 100644
index 00000000..12baaf39
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/upload.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M398.1,233.2c0-1.2,0.2-2.4,0.2-3.6c0-65-51.8-117.6-115.7-117.6c-46.1,0-85.7,27.4-104.3,67c-8.1-4.1-17.2-6.5-26.8-6.5
+ c-29.5,0-54.1,21.9-58.8,50.5C57.3,235.2,32,269.1,32,309c0,50.2,40.1,91,89.5,91H224v-80l-48.2,0l80.2-83.7l80.2,83.6l-48.2,0v80
+ h110.3c45.2,0,81.7-37.5,81.7-83.4C480,270.6,443.3,233.3,398.1,233.2z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/usb.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/usb.svg
new file mode 100644
index 00000000..b4318480
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/usb.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M144,220C144,220,144.1,220.1,144,220L144,220z"/>
+ <path d="M384,128.3c0-17.8-14.4-32.2-32.1-32.2c-17.7,0-32.1,14.4-32.1,32.1c0,12.1,6.7,22.7,16.6,28.2c1.3,1.5,2.2,4.5,2.2,6
+ c0,0.1,0,0.2,0,0.4c-0.8,17.6-3.8,31.9-7.1,41.7c-4.3,12.6-38.2,39.6-51.5,42.2c-5.8,1.2-7.9-0.6-7.9-10.2c0,0,0-138.9,0-140.4
+ s0.2-3.5,1.9-5c0,0,0,0,0,0c8.6-5.8,14.3-15.6,14.3-26.8c0-17.8-14.4-32.2-32.1-32.2c-17.7,0-32.1,14.4-32.1,32.2
+ c0,11.3,5.8,21.3,14.6,27c0,0,0.1,0.1,0.1,0.1c0.1,0.1,0.2,0.1,0.4,0.2c0.2,0.1,0.4,0.2,0.6,0.4c2.3,1.5,3.3,3,3.3,4.2
+ c0,1.3,0,189.3,0,196.3s-1.1,12.3-8.4,11.8s-41.7-23.5-51.4-44.1c-4.5-9.5-6.8-18.8-6.8-28h0c0,0,0-0.4,0-0.5
+ c0-3.1,0-11.3,3.2-13.6c7.8-5.9,12.8-15.2,12.8-25.7c0-17.8-14.4-32.2-32.1-32.2S128,174.4,128,192.2c0,11.9,6.5,22.3,16,27.8
+ c2.4,1.5,3,2.9,3.8,10.6s3,24.6,9.1,39.9c7.3,18.6,20.9,32.6,39.7,45.2c13.6,9.3,25.3,16.6,32.1,26.4s10.2,13.5,10.2,27
+ c0,0,0-0.9,0,0c0,12.8-4,14-9.3,17.8c-14.1,8.7-23.5,24.2-23.5,42c0,0.1,0,0.3,0,0.4c0,0.2,0,0.5,0,0.7c0,27.5,22.3,49.8,49.8,49.8
+ c27.5,0,49.8-22.3,49.8-49.8c0-13.3-5.2-25.4-13.7-34.3c-2.9-3.2-6-6-9.6-8.3c-7.5-5.2-10.3-11.5-10.3-18.1v-24.1
+ c0-25.1,4.1-41.1,11.1-53.3c7.3-12.7,18.3-22.6,35.4-34.2c18.8-12.6,32.2-26.6,39.6-45.2c5.7-14.4,7.6-31,8.6-50.9
+ c0.1-1.8,1.4-5.8,3.3-6.8h0C378.4,149,384,139.3,384,128.3z M160.1,208.3c-8.9,0-16.1-7.3-16.1-16.2s7.2-16.2,16.1-16.2
+ s16.1,7.3,16.1,16.2S169,208.3,160.1,208.3z M256,80.3c-8.9,0-16.1-7.3-16.1-16.2S247.1,48,256,48s16.1,7.3,16.1,16.2
+ S264.9,80.3,256,80.3z M351.9,144.3c-8.9,0-16.1-7.3-16.1-16.2S343,112,351.9,112s16.1,7.3,16.1,16.2S360.8,144.3,351.9,144.3z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/videocamera.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/videocamera.svg
new file mode 100644
index 00000000..3d2633e7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/videocamera.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M367,185.3c0-5.1-4-9.3-9.2-9.3H306v-32.2c0-35.2-29.3-63.8-64.9-63.8H63v48h176.1c4.5,0,9.9,5.6,9.9,10.1V176H41.4
+ c-5.2,0-9.4,4.2-9.4,9.3v170.4v55.7v11.3c0,5.1,4.2,9.3,9.4,9.3h316.4c5.2,0,9.2-4.2,9.2-9.3v-64.5l113,34.7v-88.2v-88.2l-113,34.7
+ V185.3z M258.2,341h-10.9H152h-11.9c-19.8,0-35.9-16-35.9-35.8s16.1-35.8,35.9-35.8c19.8,0,35.9,16.2,35.9,36
+ c0,10-4.2,18.6-10.8,25.6h67.9c-6.6-7-10.8-15.6-10.8-25.6c0-19.8,16.1-35.9,35.9-35.9c19.8,0,35.9,15.9,35.9,35.7
+ S278,341,258.2,341z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-high.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-high.svg
new file mode 100644
index 00000000..07323442
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-high.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="231,407.8 231,104.3 136.1,192 32,192 32,320 136.1,320 "/>
+ <path d="M287.1,355.7c20.5-27.9,32.8-62.3,32.8-99.7c0-37.4-12.3-71.8-32.8-99.7l-20.4,15.3c17.4,23.6,27.8,52.7,27.8,84.4
+ c0,31.6-10.4,60.8-27.8,84.3L287.1,355.7z"/>
+ <path d="M353.7,401.7c30-40.7,48-91.1,48-145.7s-18-104.9-48-145.7l-20.4,15.3c26.9,36.4,43,81.5,43,130.4
+ c0,48.9-16.1,93.9-43,130.3L353.7,401.7z"/>
+ <path d="M396.7,79.4c36.4,49.3,57.9,110.5,57.9,176.6c0,66.1-21.5,127.2-57.9,176.6l20.5,15.4c39.4-53.6,62.8-120,62.8-192
+ c0-72-23.4-138.4-62.8-192L396.7,79.4z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-low.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-low.svg
new file mode 100644
index 00000000..c96ed47e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-low.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="311,407.7 311,104.4 216.2,192 112,192 112,320 216.2,320 "/>
+ <path d="M367.2,355.6c20.5-27.8,32.8-62.3,32.8-99.6c0-37.4-12.3-71.8-32.8-99.6l-20.4,15.3c17.4,23.6,27.8,52.7,27.8,84.3
+ c0,31.6-10.4,60.7-27.8,84.3L367.2,355.6z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-medium.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-medium.svg
new file mode 100644
index 00000000..24388ea0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-medium.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="270,407.7 270,104.4 175.3,192 71,192 71,320 175.3,320 "/>
+ <path d="M326.3,355.6c20.5-27.8,32.8-62.3,32.8-99.6c0-37.4-12.3-71.8-32.8-99.6l-20.4,15.3c17.4,23.6,27.8,52.7,27.8,84.3
+ c0,31.6-10.4,60.7-27.8,84.3L326.3,355.6z"/>
+ <path d="M392.8,401.6c30-40.7,48-91,48-145.6s-18-104.9-48-145.6l-20.4,15.3c26.9,36.4,43,81.4,43,130.3c0,48.9-16.1,93.8-43,130.3
+ L392.8,401.6z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-mute.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-mute.svg
new file mode 100644
index 00000000..317b0617
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-mute.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <polygon points="255.9,217 191,217 191,295 255.9,295 303,346.3 303,165.7 "/>
+ <path d="M364.5,60.1c-0.4-0.2-0.7-0.4-1.1-0.6C331.5,42,294.9,32,256,32C132.3,32,32,132.3,32,256c0,84.3,46.6,157.6,115.4,195.9
+ c0.4,0.2,0.7,0.5,1.1,0.7C180.5,470,217.1,480,256,480c123.7,0,224-100.3,224-224C480,171.7,433.4,98.3,364.5,60.1z M393.9,355.4
+ L336,297.1v76.7l19.6,19.9c-28,20.3-62.3,32.7-99.5,32.7c-21.6,0-42.3-4.2-61.3-11.5c-6.5-2.5-12.9-5.3-19-8.6
+ c-53.6-28.7-90.1-85.2-90.1-150.3c0-37.2,12.4-71.4,32.7-99.4l35.3,35.4h76.7l-73.6-73.8c28-20.2,62.1-32.6,99.4-32.6
+ c21.6,0,42.2,4.2,61.3,11.5c6.1,2.4,12.2,5,17.9,8c54.2,28.5,91.3,85.3,91.3,150.8C426.5,293.3,414.2,327.4,393.9,355.4z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wand.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wand.svg
new file mode 100644
index 00000000..e21ddb9a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wand.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+
+ <rect x="238.059" y="206.059" transform="matrix(0.7071 0.7071 -0.7071 0.7071 249.3726 -122.0387)" width="67.882" height="67.882"/>
+
+ <rect x="110.058" y="243.549" transform="matrix(0.7071 0.7071 -0.7071 0.7071 302.3989 5.9646)" width="67.884" height="248.901"/>
+ <rect x="256" y="32" width="32" height="64"/>
+ <rect x="380.451" y="83.55" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 595.0701 477.5923)" width="32" height="63.999"/>
+ <rect x="131.549" y="83.549" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -38.4898 138.1746)" width="32" height="64"/>
+ <rect x="380.451" y="332.451" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -141.5881 387.0668)" width="32" height="64"/>
+ <rect x="416" y="224" width="64" height="32"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/waterdrop.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/waterdrop.svg
new file mode 100644
index 00000000..be14c5eb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/waterdrop.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M271,38.6c-0.3-0.4-0.7-0.7-0.9-1c0,0-0.1-0.1-0.1-0.1c-3.6-3.4-8.5-5.5-13.9-5.5c-5.5,0-10.4,2.1-13.9,5.5
+ c0,0-0.1,0.1-0.1,0.1c-0.3,0.3-0.6,0.6-0.9,1c-6.1,6.3-13.8,14.4-22.4,24.1c-17.4,19.7-38.6,46-58.5,76.8
+ c-33.4,51.8-62.9,116.1-64.1,183.1c0,1.3-0.1,2.7-0.1,4c0,19.7,3.9,38.5,10.9,55.8c4.1,10,9.2,19.4,15.2,28.2
+ C150.7,452.4,200,480,256,480c88.4,0,160-68.7,160-153.4C416,198.7,310.8,79.2,271,38.6z M256,424c-15.8,0-30.7-3.7-43.9-10.1
+ c65.9-14.4,118.4-64.7,135.8-129.5c5.2,12.1,8.2,25.5,8.2,39.6C356,379.2,311.2,424,256,424z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wifi.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wifi.svg
new file mode 100644
index 00000000..6f6bc923
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wifi.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M256.1,96L256.1,96c-79.9,0-155.7,29.9-213.9,84.1L32,189.6l9.9,9.8l32.3,32l9.3,9.2l9.6-8.8
+ c44.5-40.9,102.3-63.5,162.8-63.5c60.5,0,118.4,22.6,162.8,63.5l9.6,8.8l9.3-9.2l32.3-32l9.9-9.8l-10.2-9.5
+ C411.6,125.9,335.7,96,256.1,96z"/>
+ <path d="M397.4,256.4c-38.8-35.1-88.9-54.4-141.1-54.4h-0.1h-0.3h-8.5l-0.1,0.2c-49.2,2-96,21.1-132.6,54.2l-10.5,9.5l10.1,10
+ l32.7,32.4l9.1,9l9.6-8.4c25.3-22.2,57.4-34.5,90.3-34.5c33.1,0,65.2,12.3,90.5,34.5l9.6,8.4l9.1-9l32.7-32.4l10.1-10L397.4,256.4z
+ "/>
+ <path d="M256.2,416l9.6-9.5l52.8-52.2l10.6-10.5l-11.6-9.5c-15.4-11.4-32.4-20-61.5-20c-29,0-44.9,9.4-61.5,20l-11.5,9.5l10.6,10.5
+ l52.8,52.2L256.2,416z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wineglass.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wineglass.svg
new file mode 100644
index 00000000..9148d207
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wineglass.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M294.9,295.4c11-4.1,18-6.9,26.2-11.7c12-6.9,22.8-15.8,31.9-26.1c20.4-22.9,31-51.1,31-86.1c0-49.9-3.7-101.1-8.1-114.7
+ C371.5,43,362.4,32,345.2,32H166.7c-17.1,0-26.2,11.1-30.6,24.6c-4.4,13.5-8.1,64.9-8.1,114.8c0,35.1,10.6,63.2,30.9,86.1
+ c9.1,10.3,19.9,19.1,31.8,26c8.2,4.8,15.1,7.8,26,11.7s22.3,7.5,22.3,31.8v94.2c0,10.7-2.9,19-11.1,24.8c-2.8,2.1-6.3,4.3-14.3,6.5
+ c-31.5,8.6-46.9,15.6-49.2,17.2c-2,1.4-4.5,3.6-4.5,7.1c0,0,13.8,3.1,96.2,3.1c82.4,0,96-3.1,96-3.1c0-3.5-2.5-5.7-4.6-7.1
+ c-2.3-1.6-17.8-8.6-49.4-17.2c-8-2.2-12.2-4.4-15.1-6.5C275,440.3,271,432,271,421.3v-94.2C271,303.1,283.9,299.4,294.9,295.4z
+ M255.9,270.3c-25.4,0-48.5-10-65.5-26.3c-2.7-2.4-5.2-5-7.6-7.7c-15.6-17.5-22.4-36.7-23.1-64.8C159,143.3,159.6,99,167,64h177
+ c6.3,24,9.1,76.8,7.7,107.2c-1.4,30.5-7.2,47.3-22.8,64.9c-2,2.2-3.9,4.3-6.1,6.4C305.7,259.7,282,270.3,255.9,270.3z"/>
+ <path d="M336.2,170.6c0-7.5-0.1-31.9-1.3-52.6c-0.5-8.4-1.2-16-2.1-22h-153c-0.9,3-1.8,11.6-2.5,22c-1.3,18.9-2.1,43.9-1.5,52.9
+ c0.9,13.8,1.5,20.6,4.5,29.4c3.1,9.1,8,17.3,14.6,24.7c2,2.3,4.1,4.4,6.4,6.4c14.2,13.6,33.5,22,54.7,22c21.8,0,41.5-8.8,55.9-23.1
+ c1.8-1.7,3.5-3.5,5.2-5.3c6.6-7.4,11.4-15.5,14.5-24.6C334.7,191.4,336.2,181.1,336.2,170.6z M320,179c0,5-3.9,8.1-8.3,8.1
+ c-1.6,0-3-0.5-4.3-1.3c-2.2-1.4-3.5-3.9-3.5-6.7v-26c0-4.4,3.6-8,8-8s8,3.6,8,8V179z M318.9,131.8c-1.2,1.8-3,3-5.1,3.5
+ c-2.1,0.4-4.3,0-6-1.1c-1.8-1.2-3-3-3.5-5.1c-0.4-2.1,0-4.3,1.1-6c1.2-1.8,3-3,5.1-3.5c2.1-0.4,4.3,0,6,1.1c1.8,1.2,3,3,3.5,5.1
+ C320.5,127.8,320.1,130,318.9,131.8z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/woman.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/woman.svg
new file mode 100644
index 00000000..0819b61d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/woman.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<g>
+ <path d="M190.4,148.6L161,252.9c-6.3,22.8,20.7,31.7,27.3,10.3l26.3-96.2h7.4l-45.2,169H219v127c0,23,32,23,32,0V336h10v127
+ c0,23,31,23,31,0V336h43.4l-46.2-169h8.4l26.3,96.2c6.5,21.9,33.3,12.5,27.3-10.2l-29.4-104.4c-4-11.8-18.2-32.6-42-33.6h-47.3
+ C207.9,116,193.8,136.6,190.4,148.6z"/>
+ <path d="M292.6,69.2c0-20.6-16.4-37.3-36.6-37.3c-20.2,0-36.6,16.7-36.6,37.3c0,20.6,16.4,37.3,36.6,37.3
+ C276.2,106.5,292.6,89.8,292.6,69.2z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wrench.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wrench.svg
new file mode 100644
index 00000000..11458e24
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wrench.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path d="M461.9,114.9l-56.5,56.7l-55.1-10l-9.9-55.1l56.5-56.7c-12.7-12.7-30.8-18.5-44.2-17.8c-13.5,0.7-42.3,8.3-64.6,32
+ c-21.6,22.8-44.3,65.3-24.2,112.5c2.4,5.7,5.1,13.2-2.9,21.2c-8.1,8-215,202.8-215,202.8c-19.4,16.7-18,47.6-0.1,65.6
+ c18.2,17.9,48.9,19,65.6-0.3c0,0,193.2-205.8,202.7-215.1c8.5-8.3,16.1-5.5,21.2-2.9c35.6,18.4,86.3,2.4,112.6-23.9
+ c26.3-26.3,31.1-51.7,31.9-64.7C480.7,146.3,476.2,129.2,461.9,114.9z M91.3,443.2c-6.3,6.2-16.5,6.2-22.7,0
+ c-6.2-6.3-6.2-16.5,0-22.7c6.3-6.2,16.5-6.2,22.7,0C97.5,426.8,97.5,437,91.3,443.2z"/>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/xbox.svg b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/xbox.svg
new file mode 100644
index 00000000..41a4bd31
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/xbox.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<style type="text/css">
+<![CDATA[
+ .st0{fill:#010101;}
+]]>
+</style>
+<g>
+ <path class="st0" d="M126.8,248.3c39.7-58.6,77.9-92.8,77.9-92.8s-42.1-48.9-92.8-67.4l-3.3-0.8C61.7,128.4,32,188.7,32,256
+ c0,50.7,16.9,97.5,45.2,135C77.2,386.6,77.8,320.7,126.8,248.3z"/>
+ <path class="st0" d="M480,256c0-67.3-29.7-127.6-76.6-168.7l-3.2,0.9c-50.7,18.5-92.9,67.4-92.9,67.4s38.2,34.2,77.9,92.8
+ c49,72.4,49.6,138.3,49.5,142.7C463.2,353.5,480,306.7,480,256z"/>
+ <path class="st0" d="M201.2,80.9c29.3,13.1,54.6,34.6,54.6,34.6s25.5-21.4,54.8-34.6c36.8-16.5,64.9-11.3,72.3-9.5
+ C346.8,46.6,303.1,32,256,32c-47.1,0-90.8,14.6-126.9,39.4C136.3,69.6,164.3,64.3,201.2,80.9z"/>
+ <path class="st0" d="M358.7,292.9C312.4,236,255.8,199,255.8,199s-56.3,37-102.7,93.9c-39.8,48.9-54.6,84.8-62.6,107.8l-1.3,4.8
+ c41,45.7,100.5,74.5,166.8,74.5c66.3,0,125.8-28.8,166.8-74.5l-1.4-4.8C413.4,377.7,398.5,341.8,358.7,292.9z"/>
+</g>
+</svg>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/utils/js/browserCheck.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/utils/js/browserCheck.js
new file mode 100644
index 00000000..ad88b2d4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/utils/js/browserCheck.js
@@ -0,0 +1,24 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
+var isFirefox = typeof window.InstallTrigger !== 'undefined';
+var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
+var isChrome = !!window.chrome && !isOpera;
+var isIE = !!document.documentMode;
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/nbook-framecontroller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/nbook-framecontroller.js
new file mode 100644
index 00000000..ee8b46a9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/nbook-framecontroller.js
@@ -0,0 +1,34 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.config(function($routeProvider) {
+ $routeProvider
+
+ //.when('/notebook-frame/:id/:key/:value',{
+ //.when('/notebook-frame/:nid/:qprms',{
+ /*.when('/notebook-frame',{
+ templateUrl: 'app/fusion/notebook-integration/scripts/view-models/notebook-frame.html',
+ controller: 'notebookFrameController'
+ })*/
+
+ .otherwise({
+ templateUrl: 'app/fusion/notebook-integration/scripts/view-models/notebook-viz.html',
+ controller: 'notebookFrameController'
+ });
+})
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/nbookController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/nbookController.js
new file mode 100644
index 00000000..d8492404
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/nbookController.js
@@ -0,0 +1,179 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+
+app.config(function($routeProvider) {
+ $routeProvider
+
+ //.when('/notebook-frame/:id/:key/:value',{
+ //.when('/notebook-frame/:nid/:qprms',{
+ /*.when('/notebook-frame',{
+ templateUrl: 'app/fusion/notebook-integration/scripts/view-models/notebook-frame.html',
+ controller: 'notebookFrameController'
+ })*/
+
+ .otherwise({
+ // templateUrl: 'app/fusion/notebook-integration/scripts/view-models/notebook-frame.html',
+ templateUrl: 'app/fusion/notebook-integration/scripts/view-models/notebookInputs.html',
+ controller: 'nbookController'
+ });
+}).controller('nbookController', ['$scope', '$location','$window','$http', function ($scope,$location,$window,$http) {
+
+ $scope.keyValueList = [{}];
+ console.log('onload nbookController');
+ $scope.submitParameters = function() {
+
+ $scope.iframevisibility = false;
+ console.log('Inside nbook invoke save');
+
+ $scope.postData = {};
+
+ $scope.additionalqueryParams = {};
+
+ //Use this if there is only one 1 query param key value pair
+ $scope.additionalqueryParams.paramKey = $scope.qparamKey;
+ $scope.additionalqueryParams.paramVal = $scope.qparamVal;
+
+
+ // console.log('$scope.additionalqueryParams',$scope.additionalqueryParams);
+ console.log('$scope.notebookvalue',$scope.notebookvalue);
+
+
+ //$scope.postData['notebookid'] = 'a06a9cf14211012e221bf842c168849d';
+ //$scope.postData['param1'] = 'p1';
+ //$scope.postData['param2'] = 'p2';
+
+ //console.log('Report Schedule object', $scope.reportScheduleObject);
+
+
+ /* if ($window.location.search.substr($window.location.search.indexOf("=")+1)) {
+ $scope.queryParams = $window.location.search;
+
+ if ($window.location.search.indexOf("&")!=-1) {
+ $scope.notebookparam = $window.location.search.substring($window.location.search.indexOf("?")+1,$window.location.search.indexOf("&"));
+ $scope.additionalqueryParams = JSON.parse('{"' + decodeURI($scope.queryParams.substr($scope.queryParams.indexOf("&")+1).replace(/&/g, "\",\"").replace(/=/g,"\":\"")) + '"}');
+ console.log('Additional parameters present');
+ }
+ else {
+ $scope.notebookparam = $window.location.search.substr($window.location.search.indexOf("?")+1);
+ console.log('Additional parameters absent');
+ }
+ console.log('add parameters',$scope.additionalqueryParams);
+ // $scope.notebookid = $scope.notebookparam.substring(0,$scope.notebookparam.indexOf("="));
+ $scope.notebookvalue = $scope.notebookparam.substr($scope.notebookparam.indexOf("=")+1);
+ $scope.postData = $window.location.search.substr($window.location.search.indexOf("=")+1);
+ console.log('Notebook value present ',$scope.notebookvalue);
+ }
+ else {
+ $scope.notebookvalue = '833c0a69ec1433fbb2f8752af733cf0e';
+ console.log('Notebook value absent ',$scope.notebookvalue);
+ }*/
+
+ // $http.get("notebook.htm#/notebook-frame", {params : {"a" : "b"}})
+
+ /* $http.get("app/fusion/notebook-integration/scripts/view-models/notebook-frame.html", {params : {"a" : "b"}})
+ .then(function(response) {
+ console.log("Got response from http get ");
+ // window.open ('notebook.htm#/notebook-frame','_self',false);
+ }); */
+
+ // $location.search(1, $scope.additionalqueryParams);
+// }
+ console.log('$scope.additionalqueryParams',$scope.additionalqueryParams);
+// $scope.invokeSaveNotebook() = function() {
+ // window.open ('notebook.htm#/notebook-frame/1/2/3','_self',false);
+
+ //var testurl = 'nbooktest.htm?nid='+$scope.notebookvalue;
+ //var testurl = 'nbooktest.htm?nid='+$scope.notebookvalue+'&'+encodeURIComponent(JSON.stringify($scope.additionalqueryParams));
+ // var testurl = 'notebook.htm#/notebook-frame/' + $scope.notebookvalue + '/' + encodeURIComponent(JSON.stringify($scope.additionalqueryParams));
+
+ console.log('$scope.keyValueList',$scope.keyValueList);
+
+ /*for (var obj in $scope.keyValueList) {
+ for (var prop in obj) {
+ if (obj.hasOwnProperty(prop)) {
+ // or if (Object.prototype.hasOwnProperty.call(obj,prop)) for safety...
+ console.log('property',obj[prop]);
+ //console.log("prop: " + prop.qk + " value: " + obj[prop.qk]);
+ }
+ }
+ }*/
+
+ console.log('$scope.keyValueList.length',$scope.keyValueList.length);
+
+ var qryStr = '';
+ for(var i = 0; i < $scope.keyValueList.length; i++) {
+ var obj = $scope.keyValueList[i];
+ //console.log('obj.qK',obj.qK);
+ if (obj.qK != undefined && obj.qV != undefined) {
+ //console.log('Inside qk defined');
+ if (qryStr!='')
+ qryStr = qryStr+'&'+obj.qK+'='+obj.qV;
+ else
+ qryStr = obj.qK+'='+obj.qV;
+
+ }
+
+ }
+ console.log('qryStr',qryStr);
+
+
+
+ //var testurl = 'nbooktest.htm?nid='+$scope.notebookvalue+'&k1='+$scope.additionalqueryParams.paramKey+'&v1='+$scope.additionalqueryParams.paramVal;
+
+ // var testurl = 'nbooktest.htm?nid='+$scope.notebookvalue+'&'+$scope.additionalqueryParams.paramKey+'='+$scope.additionalqueryParams.paramVal;
+
+ var queryurl = 'nbooktest.htm?nid='+$scope.notebookvalue+'&'+qryStr;
+
+ // var testurl = 'notebook.htm#/notebook-frame';
+
+ window.open (queryurl,'_self',false);
+
+
+ }
+
+ $scope.addKeyValuePairs = function (kv) {
+
+
+ if ($scope.keyValueList.length < 9) {
+ $scope.keyValueList.push({
+
+ });
+ // alert($scope.reportRunJson.rangeAxisList.length);
+ // console.log('$scope.keyValueList',$scope.keyValueList);
+
+ } else {
+ //document.getElementById("addbtn").disabled = true;
+ // $scope.btnactive = false;
+ document.getElementById("addbtn")["disabled"] = true;
+ //document.getElementById("addbtn")["style.background-color"] = "#FFFF00";
+
+ //$('#addbtn').btn('type') = "disabled";
+ }
+ }
+
+ $scope.removeKeyValuePairs = function (index) {
+ $scope.keyValueList.splice(index, 1);
+ if ($scope.keyValueList.length == 8) {
+ document.getElementById("addbtn")["disabled"] = false;
+ }
+ //console.log($scope.hardCodeReport.rangeAxisList)
+ }
+
+}]);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/notebookFrameController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/notebookFrameController.js
new file mode 100644
index 00000000..1285cb02
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/notebookFrameController.js
@@ -0,0 +1,65 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('notebookFrameController', function ($scope,$location,$window,$http,$routeParams) {
+
+ //alert($location.search(1, $scope.additionalqueryParams));
+ //var nid = $routeParams.nid;
+ //var qprms = $routeParams.qprms;
+ //var value = $routeParams.value;
+ //console.log('check id ');
+ var nid = $window.location.search.substr($window.location.search.indexOf("=")+1);
+ console.log('nid',nid);
+ //console.log('qprms',qprms);
+
+ if ($window.location.search.substr($window.location.search.indexOf("=")+1)) {
+ $scope.queryParams = $window.location.search;
+
+ if ($window.location.search.indexOf("&")!=-1) {
+ $scope.notebookparam = $window.location.search.substring($window.location.search.indexOf("?")+1,$window.location.search.indexOf("&"));
+ $scope.additionalqueryParams = JSON.parse('{"' + decodeURI($scope.queryParams.substr($scope.queryParams.indexOf("&")+1).replace(/&/g, "\",\"").replace(/=/g,"\":\"")) + '"}');
+ console.log('Additional parameters present');
+ }
+ else {
+ $scope.notebookparam = $window.location.search.substr($window.location.search.indexOf("?")+1);
+ console.log('Additional parameters absent');
+ }
+ console.log('add parameters',$scope.additionalqueryParams);
+ // $scope.notebookid = $scope.notebookparam.substring(0,$scope.notebookparam.indexOf("="));
+ $scope.notebookvalue = $scope.notebookparam.substr($scope.notebookparam.indexOf("=")+1);
+ //$scope.postData = $window.location.search.substr($window.location.search.indexOf("=")+1);
+ console.log('Notebook value present ',$scope.notebookvalue);
+ }
+ else {
+ $scope.notebookvalue = '833c0a69ec1433fbb2f8752af733cf0e';
+ console.log('Notebook value absent ',$scope.notebookvalue);
+ }
+
+
+
+ $http({method:'POST', url:'rNotebookFE/authCr', data: $scope.notebookvalue, params:{'qparams' : $scope.additionalqueryParams}}).success(function(data, status) {
+ console.log('Data received', data);
+ console.log('Status ', status);
+ document.getElementById('itestframe').src = data;
+
+ })
+
+
+
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/dependency/angular.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/dependency/angular.js
new file mode 100644
index 00000000..9e6a4f4f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/dependency/angular.js
@@ -0,0 +1,29400 @@
+/**
+ * @license AngularJS v1.5.0-beta.2
+ * (c) 2010-2015 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, document, undefined) {'use strict';
+
+/**
+ * @description
+ *
+ * This object provides a utility for producing rich Error messages within
+ * Angular. It can be called as follows:
+ *
+ * var exampleMinErr = minErr('example');
+ * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
+ *
+ * The above creates an instance of minErr in the example namespace. The
+ * resulting error will have a namespaced error code of example.one. The
+ * resulting error will replace {0} with the value of foo, and {1} with the
+ * value of bar. The object is not restricted in the number of arguments it can
+ * take.
+ *
+ * If fewer arguments are specified than necessary for interpolation, the extra
+ * interpolation markers will be preserved in the final string.
+ *
+ * Since data will be parsed statically during a build step, some restrictions
+ * are applied with respect to how minErr instances are created and called.
+ * Instances should have names of the form namespaceMinErr for a minErr created
+ * using minErr('namespace') . Error codes, namespaces and template strings
+ * should all be static strings, not variables or general expressions.
+ *
+ * @param {string} module The namespace to use for the new minErr instance.
+ * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning
+ * error from returned function, for cases when a particular type of error is useful.
+ * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
+ */
+
+function minErr(module, ErrorConstructor) {
+ ErrorConstructor = ErrorConstructor || Error;
+ return function() {
+ var SKIP_INDEXES = 2;
+
+ var templateArgs = arguments,
+ code = templateArgs[0],
+ message = '[' + (module ? module + ':' : '') + code + '] ',
+ template = templateArgs[1],
+ paramPrefix, i;
+
+ message += template.replace(/\{\d+\}/g, function(match) {
+ var index = +match.slice(1, -1),
+ shiftedIndex = index + SKIP_INDEXES;
+
+ if (shiftedIndex < templateArgs.length) {
+ return toDebugString(templateArgs[shiftedIndex]);
+ }
+
+ return match;
+ });
+
+ message += '\nhttp://errors.angularjs.org/1.5.0-beta.2/' +
+ (module ? module + '/' : '') + code;
+
+ for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
+ message += paramPrefix + 'p' + (i - SKIP_INDEXES) + '=' +
+ encodeURIComponent(toDebugString(templateArgs[i]));
+ }
+
+ return new ErrorConstructor(message);
+ };
+}
+
+/* We need to tell jshint what variables are being exported */
+/* global angular: true,
+ msie: true,
+ jqLite: true,
+ jQuery: true,
+ slice: true,
+ splice: true,
+ push: true,
+ toString: true,
+ ngMinErr: true,
+ angularModule: true,
+ uid: true,
+ REGEX_STRING_REGEXP: true,
+ VALIDITY_STATE_PROPERTY: true,
+
+ lowercase: true,
+ uppercase: true,
+ manualLowercase: true,
+ manualUppercase: true,
+ nodeName_: true,
+ isArrayLike: true,
+ forEach: true,
+ forEachSorted: true,
+ reverseParams: true,
+ nextUid: true,
+ setHashKey: true,
+ extend: true,
+ toInt: true,
+ inherit: true,
+ merge: true,
+ noop: true,
+ identity: true,
+ valueFn: true,
+ isUndefined: true,
+ isDefined: true,
+ isObject: true,
+ isBlankObject: true,
+ isString: true,
+ isNumber: true,
+ isDate: true,
+ isArray: true,
+ isFunction: true,
+ isRegExp: true,
+ isWindow: true,
+ isScope: true,
+ isFile: true,
+ isFormData: true,
+ isBlob: true,
+ isBoolean: true,
+ isPromiseLike: true,
+ trim: true,
+ escapeForRegexp: true,
+ isElement: true,
+ makeMap: true,
+ includes: true,
+ arrayRemove: true,
+ copy: true,
+ shallowCopy: true,
+ equals: true,
+ csp: true,
+ jq: true,
+ concat: true,
+ sliceArgs: true,
+ bind: true,
+ toJsonReplacer: true,
+ toJson: true,
+ fromJson: true,
+ convertTimezoneToLocal: true,
+ timezoneToOffset: true,
+ startingTag: true,
+ tryDecodeURIComponent: true,
+ parseKeyValue: true,
+ toKeyValue: true,
+ encodeUriSegment: true,
+ encodeUriQuery: true,
+ angularInit: true,
+ bootstrap: true,
+ getTestability: true,
+ snake_case: true,
+ bindJQuery: true,
+ assertArg: true,
+ assertArgFn: true,
+ assertNotHasOwnProperty: true,
+ getter: true,
+ getBlockNodes: true,
+ hasOwnProperty: true,
+ createMap: true,
+
+ NODE_TYPE_ELEMENT: true,
+ NODE_TYPE_ATTRIBUTE: true,
+ NODE_TYPE_TEXT: true,
+ NODE_TYPE_COMMENT: true,
+ NODE_TYPE_DOCUMENT: true,
+ NODE_TYPE_DOCUMENT_FRAGMENT: true,
+*/
+
+////////////////////////////////////
+
+/**
+ * @ngdoc module
+ * @name ng
+ * @module ng
+ * @description
+ *
+ * # ng (core module)
+ * The ng module is loaded by default when an AngularJS application is started. The module itself
+ * contains the essential components for an AngularJS application to function. The table below
+ * lists a high level breakdown of each of the services/factories, filters, directives and testing
+ * components available within this core module.
+ *
+ * <div doc-module-components="ng"></div>
+ */
+
+var REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
+
+// The name of a form control's ValidityState property.
+// This is used so that it's possible for internal tests to create mock ValidityStates.
+var VALIDITY_STATE_PROPERTY = 'validity';
+
+/**
+ * @ngdoc function
+ * @name angular.lowercase
+ * @module ng
+ * @kind function
+ *
+ * @description Converts the specified string to lowercase.
+ * @param {string} string String to be converted to lowercase.
+ * @returns {string} Lowercased string.
+ */
+var lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;};
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * @ngdoc function
+ * @name angular.uppercase
+ * @module ng
+ * @kind function
+ *
+ * @description Converts the specified string to uppercase.
+ * @param {string} string String to be converted to uppercase.
+ * @returns {string} Uppercased string.
+ */
+var uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;};
+
+
+var manualLowercase = function(s) {
+ /* jshint bitwise: false */
+ return isString(s)
+ ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})
+ : s;
+};
+var manualUppercase = function(s) {
+ /* jshint bitwise: false */
+ return isString(s)
+ ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})
+ : s;
+};
+
+
+// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish
+// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods
+// with correct but slower alternatives.
+if ('i' !== 'I'.toLowerCase()) {
+ lowercase = manualLowercase;
+ uppercase = manualUppercase;
+}
+
+
+var
+ msie, // holds major version number for IE, or NaN if UA is not IE.
+ jqLite, // delay binding since jQuery could be loaded after us.
+ jQuery, // delay binding
+ slice = [].slice,
+ splice = [].splice,
+ push = [].push,
+ toString = Object.prototype.toString,
+ getPrototypeOf = Object.getPrototypeOf,
+ ngMinErr = minErr('ng'),
+
+ /** @name angular */
+ angular = window.angular || (window.angular = {}),
+ angularModule,
+ uid = 0;
+
+/**
+ * documentMode is an IE-only property
+ * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx
+ */
+msie = document.documentMode;
+
+
+/**
+ * @private
+ * @param {*} obj
+ * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments,
+ * String ...)
+ */
+function isArrayLike(obj) {
+
+ // `null`, `undefined` and `window` are not array-like
+ if (obj == null || isWindow(obj)) return false;
+
+ // arrays, strings and jQuery/jqLite objects are array like
+ // * jqLite is either the jQuery or jqLite constructor function
+ // * we have to check the existance of jqLite first as this method is called
+ // via the forEach method when constructing the jqLite object in the first place
+ if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true;
+
+ // Support: iOS 8.2 (not reproducible in simulator)
+ // "length" in obj used to prevent JIT error (gh-11508)
+ var length = "length" in Object(obj) && obj.length;
+
+ // NodeList objects (with `item` method) and
+ // other objects with suitable length characteristics are array-like
+ return isNumber(length) &&
+ (length >= 0 && (length - 1) in obj || typeof obj.item == 'function');
+}
+
+/**
+ * @ngdoc function
+ * @name angular.forEach
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Invokes the `iterator` function once for each item in `obj` collection, which can be either an
+ * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value`
+ * is the value of an object property or an array element, `key` is the object property key or
+ * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional.
+ *
+ * It is worth noting that `.forEach` does not iterate over inherited properties because it filters
+ * using the `hasOwnProperty` method.
+ *
+ * Unlike ES262's
+ * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18),
+ * Providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just
+ * return the value provided.
+ *
+ ```js
+ var values = {name: 'misko', gender: 'male'};
+ var log = [];
+ angular.forEach(values, function(value, key) {
+ this.push(key + ': ' + value);
+ }, log);
+ expect(log).toEqual(['name: misko', 'gender: male']);
+ ```
+ *
+ * @param {Object|Array} obj Object to iterate over.
+ * @param {Function} iterator Iterator function.
+ * @param {Object=} context Object to become context (`this`) for the iterator function.
+ * @returns {Object|Array} Reference to `obj`.
+ */
+
+function forEach(obj, iterator, context) {
+ var key, length;
+ if (obj) {
+ if (isFunction(obj)) {
+ for (key in obj) {
+ // Need to check if hasOwnProperty exists,
+ // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
+ if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ }
+ } else if (isArray(obj) || isArrayLike(obj)) {
+ var isPrimitive = typeof obj !== 'object';
+ for (key = 0, length = obj.length; key < length; key++) {
+ if (isPrimitive || key in obj) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ }
+ } else if (obj.forEach && obj.forEach !== forEach) {
+ obj.forEach(iterator, context, obj);
+ } else if (isBlankObject(obj)) {
+ // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
+ for (key in obj) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ } else if (typeof obj.hasOwnProperty === 'function') {
+ // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed
+ for (key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ }
+ } else {
+ // Slow path for objects which do not have a method `hasOwnProperty`
+ for (key in obj) {
+ if (hasOwnProperty.call(obj, key)) {
+ iterator.call(context, obj[key], key, obj);
+ }
+ }
+ }
+ }
+ return obj;
+}
+
+function forEachSorted(obj, iterator, context) {
+ var keys = Object.keys(obj).sort();
+ for (var i = 0; i < keys.length; i++) {
+ iterator.call(context, obj[keys[i]], keys[i]);
+ }
+ return keys;
+}
+
+
+/**
+ * when using forEach the params are value, key, but it is often useful to have key, value.
+ * @param {function(string, *)} iteratorFn
+ * @returns {function(*, string)}
+ */
+function reverseParams(iteratorFn) {
+ return function(value, key) { iteratorFn(key, value); };
+}
+
+/**
+ * A consistent way of creating unique IDs in angular.
+ *
+ * Using simple numbers allows us to generate 28.6 million unique ids per second for 10 years before
+ * we hit number precision issues in JavaScript.
+ *
+ * Math.pow(2,53) / 60 / 60 / 24 / 365 / 10 = 28.6M
+ *
+ * @returns {number} an unique alpha-numeric string
+ */
+function nextUid() {
+ return ++uid;
+}
+
+
+/**
+ * Set or clear the hashkey for an object.
+ * @param obj object
+ * @param h the hashkey (!truthy to delete the hashkey)
+ */
+function setHashKey(obj, h) {
+ if (h) {
+ obj.$$hashKey = h;
+ } else {
+ delete obj.$$hashKey;
+ }
+}
+
+
+function baseExtend(dst, objs, deep) {
+ var h = dst.$$hashKey;
+
+ for (var i = 0, ii = objs.length; i < ii; ++i) {
+ var obj = objs[i];
+ if (!isObject(obj) && !isFunction(obj)) continue;
+ var keys = Object.keys(obj);
+ for (var j = 0, jj = keys.length; j < jj; j++) {
+ var key = keys[j];
+ var src = obj[key];
+
+ if (deep && isObject(src)) {
+ if (isDate(src)) {
+ dst[key] = new Date(src.valueOf());
+ } else if (isRegExp(src)) {
+ dst[key] = new RegExp(src);
+ } else if (src.nodeName) {
+ dst[key] = src.cloneNode(true);
+ } else if (isElement(src)) {
+ dst[key] = src.clone();
+ } else {
+ if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
+ baseExtend(dst[key], [src], true);
+ }
+ } else {
+ dst[key] = src;
+ }
+ }
+ }
+
+ setHashKey(dst, h);
+ return dst;
+}
+
+/**
+ * @ngdoc function
+ * @name angular.extend
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s)
+ * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so
+ * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`.
+ *
+ * **Note:** Keep in mind that `angular.extend` does not support recursive merge (deep copy). Use
+ * {@link angular.merge} for this.
+ *
+ * @param {Object} dst Destination object.
+ * @param {...Object} src Source object(s).
+ * @returns {Object} Reference to `dst`.
+ */
+function extend(dst) {
+ return baseExtend(dst, slice.call(arguments, 1), false);
+}
+
+
+/**
+* @ngdoc function
+* @name angular.merge
+* @module ng
+* @kind function
+*
+* @description
+* Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s)
+* to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so
+* by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`.
+*
+* Unlike {@link angular.extend extend()}, `merge()` recursively descends into object properties of source
+* objects, performing a deep copy.
+*
+* @param {Object} dst Destination object.
+* @param {...Object} src Source object(s).
+* @returns {Object} Reference to `dst`.
+*/
+function merge(dst) {
+ return baseExtend(dst, slice.call(arguments, 1), true);
+}
+
+
+
+function toInt(str) {
+ return parseInt(str, 10);
+}
+
+
+function inherit(parent, extra) {
+ return extend(Object.create(parent), extra);
+}
+
+/**
+ * @ngdoc function
+ * @name angular.noop
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * A function that performs no operations. This function can be useful when writing code in the
+ * functional style.
+ ```js
+ function foo(callback) {
+ var result = calculateResult();
+ (callback || angular.noop)(result);
+ }
+ ```
+ */
+function noop() {}
+noop.$inject = [];
+
+
+/**
+ * @ngdoc function
+ * @name angular.identity
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * A function that returns its first argument. This function is useful when writing code in the
+ * functional style.
+ *
+ ```js
+ function transformer(transformationFn, value) {
+ return (transformationFn || angular.identity)(value);
+ };
+ ```
+ * @param {*} value to be returned.
+ * @returns {*} the value passed in.
+ */
+function identity($) {return $;}
+identity.$inject = [];
+
+
+function valueFn(value) {return function() {return value;};}
+
+function hasCustomToString(obj) {
+ return isFunction(obj.toString) && obj.toString !== toString;
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isUndefined
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is undefined.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is undefined.
+ */
+function isUndefined(value) {return typeof value === 'undefined';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isDefined
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is defined.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is defined.
+ */
+function isDefined(value) {return typeof value !== 'undefined';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isObject
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not
+ * considered to be objects. Note that JavaScript arrays are objects.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is an `Object` but not `null`.
+ */
+function isObject(value) {
+ // http://jsperf.com/isobject4
+ return value !== null && typeof value === 'object';
+}
+
+
+/**
+ * Determine if a value is an object with a null prototype
+ *
+ * @returns {boolean} True if `value` is an `Object` with a null prototype
+ */
+function isBlankObject(value) {
+ return value !== null && typeof value === 'object' && !getPrototypeOf(value);
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isString
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `String`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `String`.
+ */
+function isString(value) {return typeof value === 'string';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isNumber
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `Number`.
+ *
+ * This includes the "special" numbers `NaN`, `+Infinity` and `-Infinity`.
+ *
+ * If you wish to exclude these then you can use the native
+ * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite)
+ * method.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Number`.
+ */
+function isNumber(value) {return typeof value === 'number';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isDate
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a value is a date.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Date`.
+ */
+function isDate(value) {
+ return toString.call(value) === '[object Date]';
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isArray
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is an `Array`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is an `Array`.
+ */
+var isArray = Array.isArray;
+
+/**
+ * @ngdoc function
+ * @name angular.isFunction
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `Function`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Function`.
+ */
+function isFunction(value) {return typeof value === 'function';}
+
+
+/**
+ * Determines if a value is a regular expression object.
+ *
+ * @private
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `RegExp`.
+ */
+function isRegExp(value) {
+ return toString.call(value) === '[object RegExp]';
+}
+
+
+/**
+ * Checks if `obj` is a window object.
+ *
+ * @private
+ * @param {*} obj Object to check
+ * @returns {boolean} True if `obj` is a window obj.
+ */
+function isWindow(obj) {
+ return obj && obj.window === obj;
+}
+
+
+function isScope(obj) {
+ return obj && obj.$evalAsync && obj.$watch;
+}
+
+
+function isFile(obj) {
+ return toString.call(obj) === '[object File]';
+}
+
+
+function isFormData(obj) {
+ return toString.call(obj) === '[object FormData]';
+}
+
+
+function isBlob(obj) {
+ return toString.call(obj) === '[object Blob]';
+}
+
+
+function isBoolean(value) {
+ return typeof value === 'boolean';
+}
+
+
+function isPromiseLike(obj) {
+ return obj && isFunction(obj.then);
+}
+
+
+var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/;
+function isTypedArray(value) {
+ return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value));
+}
+
+
+var trim = function(value) {
+ return isString(value) ? value.trim() : value;
+};
+
+// Copied from:
+// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021
+// Prereq: s is a string.
+var escapeForRegexp = function(s) {
+ return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1').
+ replace(/\x08/g, '\\x08');
+};
+
+
+/**
+ * @ngdoc function
+ * @name angular.isElement
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a DOM element (or wrapped jQuery element).
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).
+ */
+function isElement(node) {
+ return !!(node &&
+ (node.nodeName // we are a direct element
+ || (node.prop && node.attr && node.find))); // we have an on and find method part of jQuery API
+}
+
+/**
+ * @param str 'key1,key2,...'
+ * @returns {object} in the form of {key1:true, key2:true, ...}
+ */
+function makeMap(str) {
+ var obj = {}, items = str.split(","), i;
+ for (i = 0; i < items.length; i++) {
+ obj[items[i]] = true;
+ }
+ return obj;
+}
+
+
+function nodeName_(element) {
+ return lowercase(element.nodeName || (element[0] && element[0].nodeName));
+}
+
+function includes(array, obj) {
+ return Array.prototype.indexOf.call(array, obj) != -1;
+}
+
+function arrayRemove(array, value) {
+ var index = array.indexOf(value);
+ if (index >= 0) {
+ array.splice(index, 1);
+ }
+ return index;
+}
+
+/**
+ * @ngdoc function
+ * @name angular.copy
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Creates a deep copy of `source`, which should be an object or an array.
+ *
+ * * If no destination is supplied, a copy of the object or array is created.
+ * * If a destination is provided, all of its elements (for arrays) or properties (for objects)
+ * are deleted and then all elements/properties from the source are copied to it.
+ * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.
+ * * If `source` is identical to 'destination' an exception will be thrown.
+ *
+ * @param {*} source The source that will be used to make a copy.
+ * Can be any type, including primitives, `null`, and `undefined`.
+ * @param {(Object|Array)=} destination Destination into which the source is copied. If
+ * provided, must be of the same type as `source`.
+ * @returns {*} The copy or updated `destination`, if `destination` was specified.
+ *
+ * @example
+ <example module="copyExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form novalidate class="simple-form">
+ Name: <input type="text" ng-model="user.name" /><br />
+ E-mail: <input type="email" ng-model="user.email" /><br />
+ Gender: <input type="radio" ng-model="user.gender" value="male" />male
+ <input type="radio" ng-model="user.gender" value="female" />female<br />
+ <button ng-click="reset()">RESET</button>
+ <button ng-click="update(user)">SAVE</button>
+ </form>
+ <pre>form = {{user | json}}</pre>
+ <pre>master = {{master | json}}</pre>
+ </div>
+
+ <script>
+ angular.module('copyExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.master= {};
+
+ $scope.update = function(user) {
+ // Example with 1 argument
+ $scope.master= angular.copy(user);
+ };
+
+ $scope.reset = function() {
+ // Example with 2 arguments
+ angular.copy($scope.master, $scope.user);
+ };
+
+ $scope.reset();
+ }]);
+ </script>
+ </file>
+ </example>
+ */
+function copy(source, destination) {
+ var stackSource = [];
+ var stackDest = [];
+
+ if (destination) {
+ if (isTypedArray(destination)) {
+ throw ngMinErr('cpta', "Can't copy! TypedArray destination cannot be mutated.");
+ }
+ if (source === destination) {
+ throw ngMinErr('cpi', "Can't copy! Source and destination are identical.");
+ }
+
+ // Empty the destination object
+ if (isArray(destination)) {
+ destination.length = 0;
+ } else {
+ forEach(destination, function(value, key) {
+ if (key !== '$$hashKey') {
+ delete destination[key];
+ }
+ });
+ }
+
+ stackSource.push(source);
+ stackDest.push(destination);
+ return copyRecurse(source, destination);
+ }
+
+ return copyElement(source);
+
+ function copyRecurse(source, destination) {
+ var h = destination.$$hashKey;
+ var result, key;
+ if (isArray(source)) {
+ for (var i = 0, ii = source.length; i < ii; i++) {
+ destination.push(copyElement(source[i]));
+ }
+ } else if (isBlankObject(source)) {
+ // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
+ for (key in source) {
+ destination[key] = copyElement(source[key]);
+ }
+ } else if (source && typeof source.hasOwnProperty === 'function') {
+ // Slow path, which must rely on hasOwnProperty
+ for (key in source) {
+ if (source.hasOwnProperty(key)) {
+ destination[key] = copyElement(source[key]);
+ }
+ }
+ } else {
+ // Slowest path --- hasOwnProperty can't be called as a method
+ for (key in source) {
+ if (hasOwnProperty.call(source, key)) {
+ destination[key] = copyElement(source[key]);
+ }
+ }
+ }
+ setHashKey(destination, h);
+ return destination;
+ }
+
+ function copyElement(source) {
+ // Simple values
+ if (!isObject(source)) {
+ return source;
+ }
+
+ // Already copied values
+ var index = stackSource.indexOf(source);
+ if (index !== -1) {
+ return stackDest[index];
+ }
+
+ if (isWindow(source) || isScope(source)) {
+ throw ngMinErr('cpws',
+ "Can't copy! Making copies of Window or Scope instances is not supported.");
+ }
+
+ var needsRecurse = false;
+ var destination;
+
+ if (isArray(source)) {
+ destination = [];
+ needsRecurse = true;
+ } else if (isTypedArray(source)) {
+ destination = new source.constructor(source);
+ } else if (isDate(source)) {
+ destination = new Date(source.getTime());
+ } else if (isRegExp(source)) {
+ destination = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
+ destination.lastIndex = source.lastIndex;
+ } else if (isFunction(source.cloneNode)) {
+ destination = source.cloneNode(true);
+ } else {
+ destination = Object.create(getPrototypeOf(source));
+ needsRecurse = true;
+ }
+
+ stackSource.push(source);
+ stackDest.push(destination);
+
+ return needsRecurse
+ ? copyRecurse(source, destination)
+ : destination;
+ }
+}
+
+/**
+ * Creates a shallow copy of an object, an array or a primitive.
+ *
+ * Assumes that there are no proto properties for objects.
+ */
+function shallowCopy(src, dst) {
+ if (isArray(src)) {
+ dst = dst || [];
+
+ for (var i = 0, ii = src.length; i < ii; i++) {
+ dst[i] = src[i];
+ }
+ } else if (isObject(src)) {
+ dst = dst || {};
+
+ for (var key in src) {
+ if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
+ dst[key] = src[key];
+ }
+ }
+ }
+
+ return dst || src;
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.equals
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if two objects or two values are equivalent. Supports value types, regular
+ * expressions, arrays and objects.
+ *
+ * Two objects or values are considered equivalent if at least one of the following is true:
+ *
+ * * Both objects or values pass `===` comparison.
+ * * Both objects or values are of the same type and all of their properties are equal by
+ * comparing them with `angular.equals`.
+ * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal)
+ * * Both values represent the same regular expression (In JavaScript,
+ * /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual
+ * representation matches).
+ *
+ * During a property comparison, properties of `function` type and properties with names
+ * that begin with `$` are ignored.
+ *
+ * Scope and DOMWindow objects are being compared only by identify (`===`).
+ *
+ * @param {*} o1 Object or value to compare.
+ * @param {*} o2 Object or value to compare.
+ * @returns {boolean} True if arguments are equal.
+ */
+function equals(o1, o2) {
+ if (o1 === o2) return true;
+ if (o1 === null || o2 === null) return false;
+ if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
+ var t1 = typeof o1, t2 = typeof o2, length, key, keySet;
+ if (t1 == t2) {
+ if (t1 == 'object') {
+ if (isArray(o1)) {
+ if (!isArray(o2)) return false;
+ if ((length = o1.length) == o2.length) {
+ for (key = 0; key < length; key++) {
+ if (!equals(o1[key], o2[key])) return false;
+ }
+ return true;
+ }
+ } else if (isDate(o1)) {
+ if (!isDate(o2)) return false;
+ return equals(o1.getTime(), o2.getTime());
+ } else if (isRegExp(o1)) {
+ return isRegExp(o2) ? o1.toString() == o2.toString() : false;
+ } else {
+ if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||
+ isArray(o2) || isDate(o2) || isRegExp(o2)) return false;
+ keySet = createMap();
+ for (key in o1) {
+ if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
+ if (!equals(o1[key], o2[key])) return false;
+ keySet[key] = true;
+ }
+ for (key in o2) {
+ if (!(key in keySet) &&
+ key.charAt(0) !== '$' &&
+ isDefined(o2[key]) &&
+ !isFunction(o2[key])) return false;
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+var csp = function() {
+ if (!isDefined(csp.rules)) {
+
+
+ var ngCspElement = (document.querySelector('[ng-csp]') ||
+ document.querySelector('[data-ng-csp]'));
+
+ if (ngCspElement) {
+ var ngCspAttribute = ngCspElement.getAttribute('ng-csp') ||
+ ngCspElement.getAttribute('data-ng-csp');
+ csp.rules = {
+ noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1),
+ noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1)
+ };
+ } else {
+ csp.rules = {
+ noUnsafeEval: noUnsafeEval(),
+ noInlineStyle: false
+ };
+ }
+ }
+
+ return csp.rules;
+
+ function noUnsafeEval() {
+ try {
+ /* jshint -W031, -W054 */
+ new Function('');
+ /* jshint +W031, +W054 */
+ return false;
+ } catch (e) {
+ return true;
+ }
+ }
+};
+
+/**
+ * @ngdoc directive
+ * @module ng
+ * @name ngJq
+ *
+ * @element ANY
+ * @param {string=} ngJq the name of the library available under `window`
+ * to be used for angular.element
+ * @description
+ * Use this directive to force the angular.element library. This should be
+ * used to force either jqLite by leaving ng-jq blank or setting the name of
+ * the jquery variable under window (eg. jQuery).
+ *
+ * Since angular looks for this directive when it is loaded (doesn't wait for the
+ * DOMContentLoaded event), it must be placed on an element that comes before the script
+ * which loads angular. Also, only the first instance of `ng-jq` will be used and all
+ * others ignored.
+ *
+ * @example
+ * This example shows how to force jqLite using the `ngJq` directive to the `html` tag.
+ ```html
+ <!doctype html>
+ <html ng-app ng-jq>
+ ...
+ ...
+ </html>
+ ```
+ * @example
+ * This example shows how to use a jQuery based library of a different name.
+ * The library name must be available at the top most 'window'.
+ ```html
+ <!doctype html>
+ <html ng-app ng-jq="jQueryLib">
+ ...
+ ...
+ </html>
+ ```
+ */
+var jq = function() {
+ if (isDefined(jq.name_)) return jq.name_;
+ var el;
+ var i, ii = ngAttrPrefixes.length, prefix, name;
+ for (i = 0; i < ii; ++i) {
+ prefix = ngAttrPrefixes[i];
+ if (el = document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]')) {
+ name = el.getAttribute(prefix + 'jq');
+ break;
+ }
+ }
+
+ return (jq.name_ = name);
+};
+
+function concat(array1, array2, index) {
+ return array1.concat(slice.call(array2, index));
+}
+
+function sliceArgs(args, startIndex) {
+ return slice.call(args, startIndex || 0);
+}
+
+
+/* jshint -W101 */
+/**
+ * @ngdoc function
+ * @name angular.bind
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for
+ * `fn`). You can supply optional `args` that are prebound to the function. This feature is also
+ * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as
+ * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application).
+ *
+ * @param {Object} self Context which `fn` should be evaluated in.
+ * @param {function()} fn Function to be bound.
+ * @param {...*} args Optional arguments to be prebound to the `fn` function call.
+ * @returns {function()} Function that wraps the `fn` with all the specified bindings.
+ */
+/* jshint +W101 */
+function bind(self, fn) {
+ var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
+ if (isFunction(fn) && !(fn instanceof RegExp)) {
+ return curryArgs.length
+ ? function() {
+ return arguments.length
+ ? fn.apply(self, concat(curryArgs, arguments, 0))
+ : fn.apply(self, curryArgs);
+ }
+ : function() {
+ return arguments.length
+ ? fn.apply(self, arguments)
+ : fn.call(self);
+ };
+ } else {
+ // in IE, native methods are not functions so they cannot be bound (note: they don't need to be)
+ return fn;
+ }
+}
+
+
+function toJsonReplacer(key, value) {
+ var val = value;
+
+ if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {
+ val = undefined;
+ } else if (isWindow(value)) {
+ val = '$WINDOW';
+ } else if (value && document === value) {
+ val = '$DOCUMENT';
+ } else if (isScope(value)) {
+ val = '$SCOPE';
+ }
+
+ return val;
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.toJson
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be
+ * stripped since angular uses this notation internally.
+ *
+ * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.
+ * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace.
+ * If set to an integer, the JSON output will contain that many spaces per indentation.
+ * @returns {string|undefined} JSON-ified string representing `obj`.
+ */
+function toJson(obj, pretty) {
+ if (typeof obj === 'undefined') return undefined;
+ if (!isNumber(pretty)) {
+ pretty = pretty ? 2 : null;
+ }
+ return JSON.stringify(obj, toJsonReplacer, pretty);
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.fromJson
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Deserializes a JSON string.
+ *
+ * @param {string} json JSON string to deserialize.
+ * @returns {Object|Array|string|number} Deserialized JSON string.
+ */
+function fromJson(json) {
+ return isString(json)
+ ? JSON.parse(json)
+ : json;
+}
+
+
+function timezoneToOffset(timezone, fallback) {
+ var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
+ return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
+}
+
+
+function addDateMinutes(date, minutes) {
+ date = new Date(date.getTime());
+ date.setMinutes(date.getMinutes() + minutes);
+ return date;
+}
+
+
+function convertTimezoneToLocal(date, timezone, reverse) {
+ reverse = reverse ? -1 : 1;
+ var timezoneOffset = timezoneToOffset(timezone, date.getTimezoneOffset());
+ return addDateMinutes(date, reverse * (timezoneOffset - date.getTimezoneOffset()));
+}
+
+
+/**
+ * @returns {string} Returns the string representation of the element.
+ */
+function startingTag(element) {
+ element = jqLite(element).clone();
+ try {
+ // turns out IE does not let you set .html() on elements which
+ // are not allowed to have children. So we just ignore it.
+ element.empty();
+ } catch (e) {}
+ var elemHtml = jqLite('<div>').append(element).html();
+ try {
+ return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :
+ elemHtml.
+ match(/^(<[^>]+>)/)[1].
+ replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });
+ } catch (e) {
+ return lowercase(elemHtml);
+ }
+
+}
+
+
+/////////////////////////////////////////////////
+
+/**
+ * Tries to decode the URI component without throwing an exception.
+ *
+ * @private
+ * @param str value potential URI component to check.
+ * @returns {boolean} True if `value` can be decoded
+ * with the decodeURIComponent function.
+ */
+function tryDecodeURIComponent(value) {
+ try {
+ return decodeURIComponent(value);
+ } catch (e) {
+ // Ignore any invalid uri component
+ }
+}
+
+
+/**
+ * Parses an escaped url query string into key-value pairs.
+ * @returns {Object.<string,boolean|Array>}
+ */
+function parseKeyValue(/**string*/keyValue) {
+ var obj = {};
+ forEach((keyValue || "").split('&'), function(keyValue) {
+ var splitPoint, key, val;
+ if (keyValue) {
+ key = keyValue = keyValue.replace(/\+/g,'%20');
+ splitPoint = keyValue.indexOf('=');
+ if (splitPoint !== -1) {
+ key = keyValue.substring(0, splitPoint);
+ val = keyValue.substring(splitPoint + 1);
+ }
+ key = tryDecodeURIComponent(key);
+ if (isDefined(key)) {
+ val = isDefined(val) ? tryDecodeURIComponent(val) : true;
+ if (!hasOwnProperty.call(obj, key)) {
+ obj[key] = val;
+ } else if (isArray(obj[key])) {
+ obj[key].push(val);
+ } else {
+ obj[key] = [obj[key],val];
+ }
+ }
+ }
+ });
+ return obj;
+}
+
+function toKeyValue(obj) {
+ var parts = [];
+ forEach(obj, function(value, key) {
+ if (isArray(value)) {
+ forEach(value, function(arrayValue) {
+ parts.push(encodeUriQuery(key, true) +
+ (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));
+ });
+ } else {
+ parts.push(encodeUriQuery(key, true) +
+ (value === true ? '' : '=' + encodeUriQuery(value, true)));
+ }
+ });
+ return parts.length ? parts.join('&') : '';
+}
+
+
+/**
+ * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
+ * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
+ * segments:
+ * segment = *pchar
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+function encodeUriSegment(val) {
+ return encodeUriQuery(val, true).
+ replace(/%26/gi, '&').
+ replace(/%3D/gi, '=').
+ replace(/%2B/gi, '+');
+}
+
+
+/**
+ * This method is intended for encoding *key* or *value* parts of query component. We need a custom
+ * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be
+ * encoded per http://tools.ietf.org/html/rfc3986:
+ * query = *( pchar / "/" / "?" )
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+function encodeUriQuery(val, pctEncodeSpaces) {
+ return encodeURIComponent(val).
+ replace(/%40/gi, '@').
+ replace(/%3A/gi, ':').
+ replace(/%24/g, '$').
+ replace(/%2C/gi, ',').
+ replace(/%3B/gi, ';').
+ replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
+}
+
+var ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-'];
+
+function getNgAttribute(element, ngAttr) {
+ var attr, i, ii = ngAttrPrefixes.length;
+ for (i = 0; i < ii; ++i) {
+ attr = ngAttrPrefixes[i] + ngAttr;
+ if (isString(attr = element.getAttribute(attr))) {
+ return attr;
+ }
+ }
+ return null;
+}
+
+/**
+ * @ngdoc directive
+ * @name ngApp
+ * @module ng
+ *
+ * @element ANY
+ * @param {angular.Module} ngApp an optional application
+ * {@link angular.module module} name to load.
+ * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be
+ * created in "strict-di" mode. This means that the application will fail to invoke functions which
+ * do not use explicit function annotation (and are thus unsuitable for minification), as described
+ * in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in
+ * tracking down the root of these bugs.
+ *
+ * @description
+ *
+ * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive
+ * designates the **root element** of the application and is typically placed near the root element
+ * of the page - e.g. on the `<body>` or `<html>` tags.
+ *
+ * Only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`
+ * found in the document will be used to define the root element to auto-bootstrap as an
+ * application. To run multiple applications in an HTML document you must manually bootstrap them using
+ * {@link angular.bootstrap} instead. AngularJS applications cannot be nested within each other.
+ *
+ * You can specify an **AngularJS module** to be used as the root module for the application. This
+ * module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It
+ * should contain the application code needed or have dependencies on other modules that will
+ * contain the code. See {@link angular.module} for more information.
+ *
+ * In the example below if the `ngApp` directive were not placed on the `html` element then the
+ * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`
+ * would not be resolved to `3`.
+ *
+ * `ngApp` is the easiest, and most common way to bootstrap an application.
+ *
+ <example module="ngAppDemo">
+ <file name="index.html">
+ <div ng-controller="ngAppDemoController">
+ I can add: {{a}} + {{b}} = {{ a+b }}
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {
+ $scope.a = 1;
+ $scope.b = 2;
+ });
+ </file>
+ </example>
+ *
+ * Using `ngStrictDi`, you would see something like this:
+ *
+ <example ng-app-included="true">
+ <file name="index.html">
+ <div ng-app="ngAppStrictDemo" ng-strict-di>
+ <div ng-controller="GoodController1">
+ I can add: {{a}} + {{b}} = {{ a+b }}
+
+ <p>This renders because the controller does not fail to
+ instantiate, by using explicit annotation style (see
+ script.js for details)
+ </p>
+ </div>
+
+ <div ng-controller="GoodController2">
+ Name: <input ng-model="name"><br />
+ Hello, {{name}}!
+
+ <p>This renders because the controller does not fail to
+ instantiate, by using explicit annotation style
+ (see script.js for details)
+ </p>
+ </div>
+
+ <div ng-controller="BadController">
+ I can add: {{a}} + {{b}} = {{ a+b }}
+
+ <p>The controller could not be instantiated, due to relying
+ on automatic function annotations (which are disabled in
+ strict mode). As such, the content of this section is not
+ interpolated, and there should be an error in your web console.
+ </p>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('ngAppStrictDemo', [])
+ // BadController will fail to instantiate, due to relying on automatic function annotation,
+ // rather than an explicit annotation
+ .controller('BadController', function($scope) {
+ $scope.a = 1;
+ $scope.b = 2;
+ })
+ // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated,
+ // due to using explicit annotations using the array style and $inject property, respectively.
+ .controller('GoodController1', ['$scope', function($scope) {
+ $scope.a = 1;
+ $scope.b = 2;
+ }])
+ .controller('GoodController2', GoodController2);
+ function GoodController2($scope) {
+ $scope.name = "World";
+ }
+ GoodController2.$inject = ['$scope'];
+ </file>
+ <file name="style.css">
+ div[ng-controller] {
+ margin-bottom: 1em;
+ -webkit-border-radius: 4px;
+ border-radius: 4px;
+ border: 1px solid;
+ padding: .5em;
+ }
+ div[ng-controller^=Good] {
+ border-color: #d6e9c6;
+ background-color: #dff0d8;
+ color: #3c763d;
+ }
+ div[ng-controller^=Bad] {
+ border-color: #ebccd1;
+ background-color: #f2dede;
+ color: #a94442;
+ margin-bottom: 0;
+ }
+ </file>
+ </example>
+ */
+function angularInit(element, bootstrap) {
+ var appElement,
+ module,
+ config = {};
+
+ // The element `element` has priority over any other element
+ forEach(ngAttrPrefixes, function(prefix) {
+ var name = prefix + 'app';
+
+ if (!appElement && element.hasAttribute && element.hasAttribute(name)) {
+ appElement = element;
+ module = element.getAttribute(name);
+ }
+ });
+ forEach(ngAttrPrefixes, function(prefix) {
+ var name = prefix + 'app';
+ var candidate;
+
+ if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) {
+ appElement = candidate;
+ module = candidate.getAttribute(name);
+ }
+ });
+ if (appElement) {
+ config.strictDi = getNgAttribute(appElement, "strict-di") !== null;
+ bootstrap(appElement, module ? [module] : [], config);
+ }
+}
+
+/**
+ * @ngdoc function
+ * @name angular.bootstrap
+ * @module ng
+ * @description
+ * Use this function to manually start up angular application.
+ *
+ * See: {@link guide/bootstrap Bootstrap}
+ *
+ * Note that Protractor based end-to-end tests cannot use this function to bootstrap manually.
+ * They must use {@link ng.directive:ngApp ngApp}.
+ *
+ * Angular will detect if it has been loaded into the browser more than once and only allow the
+ * first loaded script to be bootstrapped and will report a warning to the browser console for
+ * each of the subsequent scripts. This prevents strange results in applications, where otherwise
+ * multiple instances of Angular try to work on the DOM.
+ *
+ * ```html
+ * <!doctype html>
+ * <html>
+ * <body>
+ * <div ng-controller="WelcomeController">
+ * {{greeting}}
+ * </div>
+ *
+ * <script src="angular.js"></script>
+ * <script>
+ * var app = angular.module('demo', [])
+ * .controller('WelcomeController', function($scope) {
+ * $scope.greeting = 'Welcome!';
+ * });
+ * angular.bootstrap(document, ['demo']);
+ * </script>
+ * </body>
+ * </html>
+ * ```
+ *
+ * @param {DOMElement} element DOM element which is the root of angular application.
+ * @param {Array<String|Function|Array>=} modules an array of modules to load into the application.
+ * Each item in the array should be the name of a predefined module or a (DI annotated)
+ * function that will be invoked by the injector as a `config` block.
+ * See: {@link angular.module modules}
+ * @param {Object=} config an object for defining configuration options for the application. The
+ * following keys are supported:
+ *
+ * * `strictDi` - disable automatic function annotation for the application. This is meant to
+ * assist in finding bugs which break minified code. Defaults to `false`.
+ *
+ * @returns {auto.$injector} Returns the newly created injector for this app.
+ */
+function bootstrap(element, modules, config) {
+ if (!isObject(config)) config = {};
+ var defaultConfig = {
+ strictDi: false
+ };
+ config = extend(defaultConfig, config);
+ var doBootstrap = function() {
+ element = jqLite(element);
+
+ if (element.injector()) {
+ var tag = (element[0] === document) ? 'document' : startingTag(element);
+ //Encode angle brackets to prevent input from being sanitized to empty string #8683
+ throw ngMinErr(
+ 'btstrpd',
+ "App Already Bootstrapped with this Element '{0}'",
+ tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
+ }
+
+ modules = modules || [];
+ modules.unshift(['$provide', function($provide) {
+ $provide.value('$rootElement', element);
+ }]);
+
+ if (config.debugInfoEnabled) {
+ // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`.
+ modules.push(['$compileProvider', function($compileProvider) {
+ $compileProvider.debugInfoEnabled(true);
+ }]);
+ }
+
+ modules.unshift('ng');
+ var injector = createInjector(modules, config.strictDi);
+ injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
+ function bootstrapApply(scope, element, compile, injector) {
+ scope.$apply(function() {
+ element.data('$injector', injector);
+ compile(element)(scope);
+ });
+ }]
+ );
+ return injector;
+ };
+
+ var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;
+ var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
+
+ if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {
+ config.debugInfoEnabled = true;
+ window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, '');
+ }
+
+ if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
+ return doBootstrap();
+ }
+
+ window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
+ angular.resumeBootstrap = function(extraModules) {
+ forEach(extraModules, function(module) {
+ modules.push(module);
+ });
+ return doBootstrap();
+ };
+
+ if (isFunction(angular.resumeDeferredBootstrap)) {
+ angular.resumeDeferredBootstrap();
+ }
+}
+
+/**
+ * @ngdoc function
+ * @name angular.reloadWithDebugInfo
+ * @module ng
+ * @description
+ * Use this function to reload the current application with debug information turned on.
+ * This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`.
+ *
+ * See {@link ng.$compileProvider#debugInfoEnabled} for more.
+ */
+function reloadWithDebugInfo() {
+ window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name;
+ window.location.reload();
+}
+
+/**
+ * @name angular.getTestability
+ * @module ng
+ * @description
+ * Get the testability service for the instance of Angular on the given
+ * element.
+ * @param {DOMElement} element DOM element which is the root of angular application.
+ */
+function getTestability(rootElement) {
+ var injector = angular.element(rootElement).injector();
+ if (!injector) {
+ throw ngMinErr('test',
+ 'no injector found for element argument to getTestability');
+ }
+ return injector.get('$$testability');
+}
+
+var SNAKE_CASE_REGEXP = /[A-Z]/g;
+function snake_case(name, separator) {
+ separator = separator || '_';
+ return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
+ return (pos ? separator : '') + letter.toLowerCase();
+ });
+}
+
+var bindJQueryFired = false;
+function bindJQuery() {
+ var originalCleanData;
+
+ if (bindJQueryFired) {
+ return;
+ }
+
+ // bind to jQuery if present;
+ var jqName = jq();
+ jQuery = isUndefined(jqName) ? window.jQuery : // use jQuery (if present)
+ !jqName ? undefined : // use jqLite
+ window[jqName]; // use jQuery specified by `ngJq`
+
+ // Use jQuery if it exists with proper functionality, otherwise default to us.
+ // Angular 1.2+ requires jQuery 1.7+ for on()/off() support.
+ // Angular 1.3+ technically requires at least jQuery 2.1+ but it may work with older
+ // versions. It will not work for sure with jQuery <1.7, though.
+ if (jQuery && jQuery.fn.on) {
+ jqLite = jQuery;
+ extend(jQuery.fn, {
+ scope: JQLitePrototype.scope,
+ isolateScope: JQLitePrototype.isolateScope,
+ controller: JQLitePrototype.controller,
+ injector: JQLitePrototype.injector,
+ inheritedData: JQLitePrototype.inheritedData
+ });
+
+ // All nodes removed from the DOM via various jQuery APIs like .remove()
+ // are passed through jQuery.cleanData. Monkey-patch this method to fire
+ // the $destroy event on all removed nodes.
+ originalCleanData = jQuery.cleanData;
+ jQuery.cleanData = function(elems) {
+ var events;
+ for (var i = 0, elem; (elem = elems[i]) != null; i++) {
+ events = jQuery._data(elem, "events");
+ if (events && events.$destroy) {
+ jQuery(elem).triggerHandler('$destroy');
+ }
+ }
+ originalCleanData(elems);
+ };
+ } else {
+ jqLite = JQLite;
+ }
+
+ angular.element = jqLite;
+
+ // Prevent double-proxying.
+ bindJQueryFired = true;
+}
+
+/**
+ * throw error if the argument is falsy.
+ */
+function assertArg(arg, name, reason) {
+ if (!arg) {
+ throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
+ }
+ return arg;
+}
+
+function assertArgFn(arg, name, acceptArrayAnnotation) {
+ if (acceptArrayAnnotation && isArray(arg)) {
+ arg = arg[arg.length - 1];
+ }
+
+ assertArg(isFunction(arg), name, 'not a function, got ' +
+ (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg));
+ return arg;
+}
+
+/**
+ * throw error if the name given is hasOwnProperty
+ * @param {String} name the name to test
+ * @param {String} context the context in which the name is used, such as module or directive
+ */
+function assertNotHasOwnProperty(name, context) {
+ if (name === 'hasOwnProperty') {
+ throw ngMinErr('badname', "hasOwnProperty is not a valid {0} name", context);
+ }
+}
+
+/**
+ * Return the value accessible from the object by path. Any undefined traversals are ignored
+ * @param {Object} obj starting object
+ * @param {String} path path to traverse
+ * @param {boolean} [bindFnToScope=true]
+ * @returns {Object} value as accessible by path
+ */
+//TODO(misko): this function needs to be removed
+function getter(obj, path, bindFnToScope) {
+ if (!path) return obj;
+ var keys = path.split('.');
+ var key;
+ var lastInstance = obj;
+ var len = keys.length;
+
+ for (var i = 0; i < len; i++) {
+ key = keys[i];
+ if (obj) {
+ obj = (lastInstance = obj)[key];
+ }
+ }
+ if (!bindFnToScope && isFunction(obj)) {
+ return bind(lastInstance, obj);
+ }
+ return obj;
+}
+
+/**
+ * Return the DOM siblings between the first and last node in the given array.
+ * @param {Array} array like object
+ * @returns {Array} the inputted object or a jqLite collection containing the nodes
+ */
+function getBlockNodes(nodes) {
+ // TODO(perf): update `nodes` instead of creating a new object?
+ var node = nodes[0];
+ var endNode = nodes[nodes.length - 1];
+ var blockNodes;
+
+ for (var i = 1; node !== endNode && (node = node.nextSibling); i++) {
+ if (blockNodes || nodes[i] !== node) {
+ if (!blockNodes) {
+ blockNodes = jqLite(slice.call(nodes, 0, i));
+ }
+ blockNodes.push(node);
+ }
+ }
+
+ return blockNodes || nodes;
+}
+
+
+/**
+ * Creates a new object without a prototype. This object is useful for lookup without having to
+ * guard against prototypically inherited properties via hasOwnProperty.
+ *
+ * Related micro-benchmarks:
+ * - http://jsperf.com/object-create2
+ * - http://jsperf.com/proto-map-lookup/2
+ * - http://jsperf.com/for-in-vs-object-keys2
+ *
+ * @returns {Object}
+ */
+function createMap() {
+ return Object.create(null);
+}
+
+var NODE_TYPE_ELEMENT = 1;
+var NODE_TYPE_ATTRIBUTE = 2;
+var NODE_TYPE_TEXT = 3;
+var NODE_TYPE_COMMENT = 8;
+var NODE_TYPE_DOCUMENT = 9;
+var NODE_TYPE_DOCUMENT_FRAGMENT = 11;
+
+/**
+ * @ngdoc type
+ * @name angular.Module
+ * @module ng
+ * @description
+ *
+ * Interface for configuring angular {@link angular.module modules}.
+ */
+
+function setupModuleLoader(window) {
+
+ var $injectorMinErr = minErr('$injector');
+ var ngMinErr = minErr('ng');
+
+ function ensure(obj, name, factory) {
+ return obj[name] || (obj[name] = factory());
+ }
+
+ var angular = ensure(window, 'angular', Object);
+
+ // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
+ angular.$$minErr = angular.$$minErr || minErr;
+
+ return ensure(angular, 'module', function() {
+ /** @type {Object.<string, angular.Module>} */
+ var modules = {};
+
+ /**
+ * @ngdoc function
+ * @name angular.module
+ * @module ng
+ * @description
+ *
+ * The `angular.module` is a global place for creating, registering and retrieving Angular
+ * modules.
+ * All modules (angular core or 3rd party) that should be available to an application must be
+ * registered using this mechanism.
+ *
+ * Passing one argument retrieves an existing {@link angular.Module},
+ * whereas passing more than one argument creates a new {@link angular.Module}
+ *
+ *
+ * # Module
+ *
+ * A module is a collection of services, directives, controllers, filters, and configuration information.
+ * `angular.module` is used to configure the {@link auto.$injector $injector}.
+ *
+ * ```js
+ * // Create a new module
+ * var myModule = angular.module('myModule', []);
+ *
+ * // register a new service
+ * myModule.value('appName', 'MyCoolApp');
+ *
+ * // configure existing services inside initialization blocks.
+ * myModule.config(['$locationProvider', function($locationProvider) {
+ * // Configure existing providers
+ * $locationProvider.hashPrefix('!');
+ * }]);
+ * ```
+ *
+ * Then you can create an injector and load your modules like this:
+ *
+ * ```js
+ * var injector = angular.injector(['ng', 'myModule'])
+ * ```
+ *
+ * However it's more likely that you'll just use
+ * {@link ng.directive:ngApp ngApp} or
+ * {@link angular.bootstrap} to simplify this process for you.
+ *
+ * @param {!string} name The name of the module to create or retrieve.
+ * @param {!Array.<string>=} requires If specified then new module is being created. If
+ * unspecified then the module is being retrieved for further configuration.
+ * @param {Function=} configFn Optional configuration function for the module. Same as
+ * {@link angular.Module#config Module#config()}.
+ * @returns {module} new module with the {@link angular.Module} api.
+ */
+ return function module(name, requires, configFn) {
+ var assertNotHasOwnProperty = function(name, context) {
+ if (name === 'hasOwnProperty') {
+ throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
+ }
+ };
+
+ assertNotHasOwnProperty(name, 'module');
+ if (requires && modules.hasOwnProperty(name)) {
+ modules[name] = null;
+ }
+ return ensure(modules, name, function() {
+ if (!requires) {
+ throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " +
+ "the module name or forgot to load it. If registering a module ensure that you " +
+ "specify the dependencies as the second argument.", name);
+ }
+
+ /** @type {!Array.<Array.<*>>} */
+ var invokeQueue = [];
+
+ /** @type {!Array.<Function>} */
+ var configBlocks = [];
+
+ /** @type {!Array.<Function>} */
+ var runBlocks = [];
+
+ var config = invokeLater('$injector', 'invoke', 'push', configBlocks);
+
+ /** @type {angular.Module} */
+ var moduleInstance = {
+ // Private state
+ _invokeQueue: invokeQueue,
+ _configBlocks: configBlocks,
+ _runBlocks: runBlocks,
+
+ /**
+ * @ngdoc property
+ * @name angular.Module#requires
+ * @module ng
+ *
+ * @description
+ * Holds the list of modules which the injector will load before the current module is
+ * loaded.
+ */
+ requires: requires,
+
+ /**
+ * @ngdoc property
+ * @name angular.Module#name
+ * @module ng
+ *
+ * @description
+ * Name of the module.
+ */
+ name: name,
+
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#provider
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} providerType Construction function for creating new instance of the
+ * service.
+ * @description
+ * See {@link auto.$provide#provider $provide.provider()}.
+ */
+ provider: invokeLaterAndSetModuleName('$provide', 'provider'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#factory
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} providerFunction Function for creating new instance of the service.
+ * @description
+ * See {@link auto.$provide#factory $provide.factory()}.
+ */
+ factory: invokeLaterAndSetModuleName('$provide', 'factory'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#service
+ * @module ng
+ * @param {string} name service name
+ * @param {Function} constructor A constructor function that will be instantiated.
+ * @description
+ * See {@link auto.$provide#service $provide.service()}.
+ */
+ service: invokeLaterAndSetModuleName('$provide', 'service'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#value
+ * @module ng
+ * @param {string} name service name
+ * @param {*} object Service instance object.
+ * @description
+ * See {@link auto.$provide#value $provide.value()}.
+ */
+ value: invokeLater('$provide', 'value'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#constant
+ * @module ng
+ * @param {string} name constant name
+ * @param {*} object Constant value.
+ * @description
+ * Because the constants are fixed, they get applied before other provide methods.
+ * See {@link auto.$provide#constant $provide.constant()}.
+ */
+ constant: invokeLater('$provide', 'constant', 'unshift'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#decorator
+ * @module ng
+ * @param {string} The name of the service to decorate.
+ * @param {Function} This function will be invoked when the service needs to be
+ * instantiated and should return the decorated service instance.
+ * @description
+ * See {@link auto.$provide#decorator $provide.decorator()}.
+ */
+ decorator: invokeLaterAndSetModuleName('$provide', 'decorator'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#animation
+ * @module ng
+ * @param {string} name animation name
+ * @param {Function} animationFactory Factory function for creating new instance of an
+ * animation.
+ * @description
+ *
+ * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
+ *
+ *
+ * Defines an animation hook that can be later used with
+ * {@link $animate $animate} service and directives that use this service.
+ *
+ * ```js
+ * module.animation('.animation-name', function($inject1, $inject2) {
+ * return {
+ * eventName : function(element, done) {
+ * //code to run the animation
+ * //once complete, then run done()
+ * return function cancellationFunction(element) {
+ * //code to cancel the animation
+ * }
+ * }
+ * }
+ * })
+ * ```
+ *
+ * See {@link ng.$animateProvider#register $animateProvider.register()} and
+ * {@link ngAnimate ngAnimate module} for more information.
+ */
+ animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#filter
+ * @module ng
+ * @param {string} name Filter name - this must be a valid angular expression identifier
+ * @param {Function} filterFactory Factory function for creating new instance of filter.
+ * @description
+ * See {@link ng.$filterProvider#register $filterProvider.register()}.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
+ * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
+ * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
+ * (`myapp_subsection_filterx`).
+ * </div>
+ */
+ filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#controller
+ * @module ng
+ * @param {string|Object} name Controller name, or an object map of controllers where the
+ * keys are the names and the values are the constructors.
+ * @param {Function} constructor Controller constructor function.
+ * @description
+ * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
+ */
+ controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#directive
+ * @module ng
+ * @param {string|Object} name Directive name, or an object map of directives where the
+ * keys are the names and the values are the factories.
+ * @param {Function} directiveFactory Factory function for creating new instance of
+ * directives.
+ * @description
+ * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
+ */
+ directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#component
+ * @module ng
+ * @param {string} name Name of the component in camel-case (i.e. myComp which will match as my-comp)
+ * @param {Object} options Component definition object (a simplified
+ * {@link ng.$compile#directive-definition-object directive definition object}),
+ * has the following properties (all optional):
+ *
+ * - `controller` – `{(string|function()=}` – Controller constructor function that should be
+ * associated with newly created scope or the name of a {@link ng.$compile#-controller-
+ * registered controller} if passed as a string. Empty function by default.
+ * - `controllerAs` – `{string=}` – An identifier name for a reference to the controller.
+ * If present, the controller will be published to scope under the `controllerAs` name.
+ * If not present, this will default to be the same as the component name.
+ * - `template` – `{string=|function()=}` – html template as a string or a function that
+ * returns an html template as a string which should be used as the contents of this component.
+ * Empty string by default.
+ *
+ * If `template` is a function, then it is {@link auto.$injector#invoke injected} with
+ * the following locals:
+ *
+ * - `$element` - Current element
+ * - `$attrs` - Current attributes object for the element
+ *
+ * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
+ * template that should be used as the contents of this component.
+ *
+ * If `templateUrl` is a function, then it is {@link auto.$injector#invoke injected} with
+ * the following locals:
+ *
+ * - `$element` - Current element
+ * - `$attrs` - Current attributes object for the element
+ * - `bindings` – `{object=}` – Define DOM attribute binding to component properties.
+ * Component properties are always bound to the component controller and not to the scope.
+ * - `transclude` – `{boolean=}` – Whether {@link $compile#transclusion transclusion} is enabled.
+ * Enabled by default.
+ * - `isolate` – `{boolean=}` – Whether the new scope is isolated. Isolated by default.
+ * - `restrict` - `{string=}` - String of subset of {@link ng.$compile#-restrict- EACM} which
+ * restricts the component to specific directive declaration style. If omitted, this defaults to 'E'.
+ * - `$canActivate` – `{function()=}` – TBD.
+ * - `$routeConfig` – `{object=}` – TBD.
+ *
+ * @description
+ * Register a component definition with the compiler. This is short for registering a specific
+ * subset of directives which represents actual UI components in your application. Component
+ * definitions are very simple and do not require the complexity behind defining directives.
+ * Component definitions usually consist only of the template and the controller backing it.
+ * In order to make the definition easier, components enforce best practices like controllerAs
+ * and default behaviors like scope isolation, restrict to elements and allow transclusion.
+ *
+ * Here are a few examples of how you would usually define components:
+ *
+ * ```js
+ * var myMod = angular.module(...);
+ * myMod.component('myComp', {
+ * template: '<div>My name is {{myComp.name}}</div>',
+ * controller: function() {
+ * this.name = 'shahar';
+ * }
+ * });
+ *
+ * myMod.component('myComp', {
+ * template: '<div>My name is {{myComp.name}}</div>',
+ * bindings: {name: '@'}
+ * });
+ *
+ * myMod.component('myComp', {
+ * templateUrl: 'views/my-comp.html',
+ * controller: 'MyCtrl as ctrl',
+ * bindings: {name: '@'}
+ * });
+ *
+ * ```
+ *
+ * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
+ */
+ component: function(name, options) {
+ function factory($injector) {
+ function makeInjectable(fn) {
+ if (angular.isFunction(fn)) {
+ return function(tElement, tAttrs) {
+ return $injector.invoke(fn, this, {$element: tElement, $attrs: tAttrs});
+ };
+ } else {
+ return fn;
+ }
+ }
+
+ var template = (!options.template && !options.templateUrl ? '' : options.template);
+ return {
+ controller: options.controller || function() {},
+ controllerAs: identifierForController(options.controller) || options.controllerAs || name,
+ template: makeInjectable(template),
+ templateUrl: makeInjectable(options.templateUrl),
+ transclude: options.transclude === undefined ? true : options.transclude,
+ scope: options.isolate === false ? true : {},
+ bindToController: options.bindings || {},
+ restrict: options.restrict || 'E'
+ };
+ }
+
+ if (options.$canActivate) {
+ factory.$canActivate = options.$canActivate;
+ }
+ if (options.$routeConfig) {
+ factory.$routeConfig = options.$routeConfig;
+ }
+ factory.$inject = ['$injector'];
+
+ return moduleInstance.directive(name, factory);
+ },
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#config
+ * @module ng
+ * @param {Function} configFn Execute this function on module load. Useful for service
+ * configuration.
+ * @description
+ * Use this method to register work which needs to be performed on module loading.
+ * For more about how to configure services, see
+ * {@link providers#provider-recipe Provider Recipe}.
+ */
+ config: config,
+
+ /**
+ * @ngdoc method
+ * @name angular.Module#run
+ * @module ng
+ * @param {Function} initializationFn Execute this function after injector creation.
+ * Useful for application initialization.
+ * @description
+ * Use this method to register work which should be performed when the injector is done
+ * loading all modules.
+ */
+ run: function(block) {
+ runBlocks.push(block);
+ return this;
+ }
+ };
+
+ if (configFn) {
+ config(configFn);
+ }
+
+ return moduleInstance;
+
+ /**
+ * @param {string} provider
+ * @param {string} method
+ * @param {String=} insertMethod
+ * @returns {angular.Module}
+ */
+ function invokeLater(provider, method, insertMethod, queue) {
+ if (!queue) queue = invokeQueue;
+ return function() {
+ queue[insertMethod || 'push']([provider, method, arguments]);
+ return moduleInstance;
+ };
+ }
+
+ /**
+ * @param {string} provider
+ * @param {string} method
+ * @returns {angular.Module}
+ */
+ function invokeLaterAndSetModuleName(provider, method) {
+ return function(recipeName, factoryFunction) {
+ if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
+ invokeQueue.push([provider, method, arguments]);
+ return moduleInstance;
+ };
+ }
+ });
+ };
+ });
+
+}
+
+/* global: toDebugString: true */
+
+function serializeObject(obj) {
+ var seen = [];
+
+ return JSON.stringify(obj, function(key, val) {
+ val = toJsonReplacer(key, val);
+ if (isObject(val)) {
+
+ if (seen.indexOf(val) >= 0) return '...';
+
+ seen.push(val);
+ }
+ return val;
+ });
+}
+
+function toDebugString(obj) {
+ if (typeof obj === 'function') {
+ return obj.toString().replace(/ \{[\s\S]*$/, '');
+ } else if (isUndefined(obj)) {
+ return 'undefined';
+ } else if (typeof obj !== 'string') {
+ return serializeObject(obj);
+ }
+ return obj;
+}
+
+/* global angularModule: true,
+ version: true,
+
+ $CompileProvider,
+
+ htmlAnchorDirective,
+ inputDirective,
+ inputDirective,
+ formDirective,
+ scriptDirective,
+ selectDirective,
+ styleDirective,
+ optionDirective,
+ ngBindDirective,
+ ngBindHtmlDirective,
+ ngBindTemplateDirective,
+ ngClassDirective,
+ ngClassEvenDirective,
+ ngClassOddDirective,
+ ngCloakDirective,
+ ngControllerDirective,
+ ngFormDirective,
+ ngHideDirective,
+ ngIfDirective,
+ ngIncludeDirective,
+ ngIncludeFillContentDirective,
+ ngInitDirective,
+ ngNonBindableDirective,
+ ngPluralizeDirective,
+ ngRepeatDirective,
+ ngShowDirective,
+ ngStyleDirective,
+ ngSwitchDirective,
+ ngSwitchWhenDirective,
+ ngSwitchDefaultDirective,
+ ngOptionsDirective,
+ ngTranscludeDirective,
+ ngModelDirective,
+ ngListDirective,
+ ngChangeDirective,
+ patternDirective,
+ patternDirective,
+ requiredDirective,
+ requiredDirective,
+ minlengthDirective,
+ minlengthDirective,
+ maxlengthDirective,
+ maxlengthDirective,
+ ngValueDirective,
+ ngModelOptionsDirective,
+ ngAttributeAliasDirectives,
+ ngEventDirectives,
+
+ $AnchorScrollProvider,
+ $AnimateProvider,
+ $CoreAnimateCssProvider,
+ $$CoreAnimateQueueProvider,
+ $$CoreAnimateRunnerProvider,
+ $BrowserProvider,
+ $CacheFactoryProvider,
+ $ControllerProvider,
+ $DateProvider,
+ $DocumentProvider,
+ $ExceptionHandlerProvider,
+ $FilterProvider,
+ $$ForceReflowProvider,
+ $InterpolateProvider,
+ $IntervalProvider,
+ $$HashMapProvider,
+ $HttpProvider,
+ $HttpParamSerializerProvider,
+ $HttpParamSerializerJQLikeProvider,
+ $HttpBackendProvider,
+ $xhrFactoryProvider,
+ $LocationProvider,
+ $LogProvider,
+ $ParseProvider,
+ $RootScopeProvider,
+ $QProvider,
+ $$QProvider,
+ $$SanitizeUriProvider,
+ $SceProvider,
+ $SceDelegateProvider,
+ $SnifferProvider,
+ $TemplateCacheProvider,
+ $TemplateRequestProvider,
+ $$TestabilityProvider,
+ $TimeoutProvider,
+ $$RAFProvider,
+ $WindowProvider,
+ $$jqLiteProvider,
+ $$CookieReaderProvider
+*/
+
+
+/**
+ * @ngdoc object
+ * @name angular.version
+ * @module ng
+ * @description
+ * An object that contains information about the current AngularJS version.
+ *
+ * This object has the following properties:
+ *
+ * - `full` – `{string}` – Full version string, such as "0.9.18".
+ * - `major` – `{number}` – Major version number, such as "0".
+ * - `minor` – `{number}` – Minor version number, such as "9".
+ * - `dot` – `{number}` – Dot version number, such as "18".
+ * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
+ */
+var version = {
+ full: '1.5.0-beta.2', // all of these placeholder strings will be replaced by grunt's
+ major: 1, // package task
+ minor: 5,
+ dot: 0,
+ codeName: 'effective-delegation'
+};
+
+
+function publishExternalAPI(angular) {
+ extend(angular, {
+ 'bootstrap': bootstrap,
+ 'copy': copy,
+ 'extend': extend,
+ 'merge': merge,
+ 'equals': equals,
+ 'element': jqLite,
+ 'forEach': forEach,
+ 'injector': createInjector,
+ 'noop': noop,
+ 'bind': bind,
+ 'toJson': toJson,
+ 'fromJson': fromJson,
+ 'identity': identity,
+ 'isUndefined': isUndefined,
+ 'isDefined': isDefined,
+ 'isString': isString,
+ 'isFunction': isFunction,
+ 'isObject': isObject,
+ 'isNumber': isNumber,
+ 'isElement': isElement,
+ 'isArray': isArray,
+ 'version': version,
+ 'isDate': isDate,
+ 'lowercase': lowercase,
+ 'uppercase': uppercase,
+ 'callbacks': {counter: 0},
+ 'getTestability': getTestability,
+ '$$minErr': minErr,
+ '$$csp': csp,
+ 'reloadWithDebugInfo': reloadWithDebugInfo
+ });
+
+ angularModule = setupModuleLoader(window);
+
+ angularModule('ng', ['ngLocale'], ['$provide',
+ function ngModule($provide) {
+ // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
+ $provide.provider({
+ $$sanitizeUri: $$SanitizeUriProvider
+ });
+ $provide.provider('$compile', $CompileProvider).
+ directive({
+ a: htmlAnchorDirective,
+ input: inputDirective,
+ textarea: inputDirective,
+ form: formDirective,
+ script: scriptDirective,
+ select: selectDirective,
+ style: styleDirective,
+ option: optionDirective,
+ ngBind: ngBindDirective,
+ ngBindHtml: ngBindHtmlDirective,
+ ngBindTemplate: ngBindTemplateDirective,
+ ngClass: ngClassDirective,
+ ngClassEven: ngClassEvenDirective,
+ ngClassOdd: ngClassOddDirective,
+ ngCloak: ngCloakDirective,
+ ngController: ngControllerDirective,
+ ngForm: ngFormDirective,
+ ngHide: ngHideDirective,
+ ngIf: ngIfDirective,
+ ngInclude: ngIncludeDirective,
+ ngInit: ngInitDirective,
+ ngNonBindable: ngNonBindableDirective,
+ ngPluralize: ngPluralizeDirective,
+ ngRepeat: ngRepeatDirective,
+ ngShow: ngShowDirective,
+ ngStyle: ngStyleDirective,
+ ngSwitch: ngSwitchDirective,
+ ngSwitchWhen: ngSwitchWhenDirective,
+ ngSwitchDefault: ngSwitchDefaultDirective,
+ ngOptions: ngOptionsDirective,
+ ngTransclude: ngTranscludeDirective,
+ ngModel: ngModelDirective,
+ ngList: ngListDirective,
+ ngChange: ngChangeDirective,
+ pattern: patternDirective,
+ ngPattern: patternDirective,
+ required: requiredDirective,
+ ngRequired: requiredDirective,
+ minlength: minlengthDirective,
+ ngMinlength: minlengthDirective,
+ maxlength: maxlengthDirective,
+ ngMaxlength: maxlengthDirective,
+ ngValue: ngValueDirective,
+ ngModelOptions: ngModelOptionsDirective
+ }).
+ directive({
+ ngInclude: ngIncludeFillContentDirective
+ }).
+ directive(ngAttributeAliasDirectives).
+ directive(ngEventDirectives);
+ $provide.provider({
+ $anchorScroll: $AnchorScrollProvider,
+ $animate: $AnimateProvider,
+ $animateCss: $CoreAnimateCssProvider,
+ $$animateQueue: $$CoreAnimateQueueProvider,
+ $$AnimateRunner: $$CoreAnimateRunnerProvider,
+ $browser: $BrowserProvider,
+ $cacheFactory: $CacheFactoryProvider,
+ $controller: $ControllerProvider,
+ $document: $DocumentProvider,
+ $exceptionHandler: $ExceptionHandlerProvider,
+ $filter: $FilterProvider,
+ $$forceReflow: $$ForceReflowProvider,
+ $interpolate: $InterpolateProvider,
+ $interval: $IntervalProvider,
+ $http: $HttpProvider,
+ $httpParamSerializer: $HttpParamSerializerProvider,
+ $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider,
+ $httpBackend: $HttpBackendProvider,
+ $xhrFactory: $xhrFactoryProvider,
+ $location: $LocationProvider,
+ $log: $LogProvider,
+ $parse: $ParseProvider,
+ $rootScope: $RootScopeProvider,
+ $q: $QProvider,
+ $$q: $$QProvider,
+ $sce: $SceProvider,
+ $sceDelegate: $SceDelegateProvider,
+ $sniffer: $SnifferProvider,
+ $templateCache: $TemplateCacheProvider,
+ $templateRequest: $TemplateRequestProvider,
+ $$testability: $$TestabilityProvider,
+ $timeout: $TimeoutProvider,
+ $window: $WindowProvider,
+ $$rAF: $$RAFProvider,
+ $$jqLite: $$jqLiteProvider,
+ $$HashMap: $$HashMapProvider,
+ $$cookieReader: $$CookieReaderProvider
+ });
+ }
+ ]);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* global JQLitePrototype: true,
+ addEventListenerFn: true,
+ removeEventListenerFn: true,
+ BOOLEAN_ATTR: true,
+ ALIASED_ATTR: true,
+*/
+
+//////////////////////////////////
+//JQLite
+//////////////////////////////////
+
+/**
+ * @ngdoc function
+ * @name angular.element
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.
+ *
+ * If jQuery is available, `angular.element` is an alias for the
+ * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element`
+ * delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite."
+ *
+ * <div class="alert alert-success">jqLite is a tiny, API-compatible subset of jQuery that allows
+ * Angular to manipulate the DOM in a cross-browser compatible way. **jqLite** implements only the most
+ * commonly needed functionality with the goal of having a very small footprint.</div>
+ *
+ * To use `jQuery`, simply ensure it is loaded before the `angular.js` file.
+ *
+ * <div class="alert">**Note:** all element references in Angular are always wrapped with jQuery or
+ * jqLite; they are never raw DOM references.</div>
+ *
+ * ## Angular's jqLite
+ * jqLite provides only the following jQuery methods:
+ *
+ * - [`addClass()`](http://api.jquery.com/addClass/)
+ * - [`after()`](http://api.jquery.com/after/)
+ * - [`append()`](http://api.jquery.com/append/)
+ * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters
+ * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData
+ * - [`children()`](http://api.jquery.com/children/) - Does not support selectors
+ * - [`clone()`](http://api.jquery.com/clone/)
+ * - [`contents()`](http://api.jquery.com/contents/)
+ * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`. As a setter, does not convert numbers to strings or append 'px'.
+ * - [`data()`](http://api.jquery.com/data/)
+ * - [`detach()`](http://api.jquery.com/detach/)
+ * - [`empty()`](http://api.jquery.com/empty/)
+ * - [`eq()`](http://api.jquery.com/eq/)
+ * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name
+ * - [`hasClass()`](http://api.jquery.com/hasClass/)
+ * - [`html()`](http://api.jquery.com/html/)
+ * - [`next()`](http://api.jquery.com/next/) - Does not support selectors
+ * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData
+ * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter
+ * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors
+ * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors
+ * - [`prepend()`](http://api.jquery.com/prepend/)
+ * - [`prop()`](http://api.jquery.com/prop/)
+ * - [`ready()`](http://api.jquery.com/ready/)
+ * - [`remove()`](http://api.jquery.com/remove/)
+ * - [`removeAttr()`](http://api.jquery.com/removeAttr/)
+ * - [`removeClass()`](http://api.jquery.com/removeClass/)
+ * - [`removeData()`](http://api.jquery.com/removeData/)
+ * - [`replaceWith()`](http://api.jquery.com/replaceWith/)
+ * - [`text()`](http://api.jquery.com/text/)
+ * - [`toggleClass()`](http://api.jquery.com/toggleClass/)
+ * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers.
+ * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces or event object as parameter
+ * - [`val()`](http://api.jquery.com/val/)
+ * - [`wrap()`](http://api.jquery.com/wrap/)
+ *
+ * ## jQuery/jqLite Extras
+ * Angular also provides the following additional methods and events to both jQuery and jqLite:
+ *
+ * ### Events
+ * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event
+ * on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM
+ * element before it is removed.
+ *
+ * ### Methods
+ * - `controller(name)` - retrieves the controller of the current element or its parent. By default
+ * retrieves controller associated with the `ngController` directive. If `name` is provided as
+ * camelCase directive name, then the controller for this directive will be retrieved (e.g.
+ * `'ngModel'`).
+ * - `injector()` - retrieves the injector of the current element or its parent.
+ * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current
+ * element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to
+ * be enabled.
+ * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the
+ * current element. This getter should be used only on elements that contain a directive which starts a new isolate
+ * scope. Calling `scope()` on this element always returns the original non-isolate scope.
+ * Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled.
+ * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top
+ * parent element is reached.
+ *
+ * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.
+ * @returns {Object} jQuery object.
+ */
+
+JQLite.expando = 'ng339';
+
+var jqCache = JQLite.cache = {},
+ jqId = 1,
+ addEventListenerFn = function(element, type, fn) {
+ element.addEventListener(type, fn, false);
+ },
+ removeEventListenerFn = function(element, type, fn) {
+ element.removeEventListener(type, fn, false);
+ };
+
+/*
+ * !!! This is an undocumented "private" function !!!
+ */
+JQLite._data = function(node) {
+ //jQuery always returns an object on cache miss
+ return this.cache[node[this.expando]] || {};
+};
+
+function jqNextId() { return ++jqId; }
+
+
+var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
+var MOZ_HACK_REGEXP = /^moz([A-Z])/;
+var MOUSE_EVENT_MAP= { mouseleave: "mouseout", mouseenter: "mouseover"};
+var jqLiteMinErr = minErr('jqLite');
+
+/**
+ * Converts snake_case to camelCase.
+ * Also there is special case for Moz prefix starting with upper case letter.
+ * @param name Name to normalize
+ */
+function camelCase(name) {
+ return name.
+ replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
+ return offset ? letter.toUpperCase() : letter;
+ }).
+ replace(MOZ_HACK_REGEXP, 'Moz$1');
+}
+
+var SINGLE_TAG_REGEXP = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/;
+var HTML_REGEXP = /<|&#?\w+;/;
+var TAG_NAME_REGEXP = /<([\w:-]+)/;
+var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi;
+
+var wrapMap = {
+ 'option': [1, '<select multiple="multiple">', '</select>'],
+
+ 'thead': [1, '<table>', '</table>'],
+ 'col': [2, '<table><colgroup>', '</colgroup></table>'],
+ 'tr': [2, '<table><tbody>', '</tbody></table>'],
+ 'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],
+ '_default': [0, "", ""]
+};
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+
+function jqLiteIsTextNode(html) {
+ return !HTML_REGEXP.test(html);
+}
+
+function jqLiteAcceptsData(node) {
+ // The window object can accept data but has no nodeType
+ // Otherwise we are only interested in elements (1) and documents (9)
+ var nodeType = node.nodeType;
+ return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;
+}
+
+function jqLiteHasData(node) {
+ for (var key in jqCache[node.ng339]) {
+ return true;
+ }
+ return false;
+}
+
+function jqLiteCleanData(nodes) {
+ for (var i = 0, ii = nodes.length; i < ii; i++) {
+ jqLiteRemoveData(nodes[i]);
+ }
+}
+
+function jqLiteBuildFragment(html, context) {
+ var tmp, tag, wrap,
+ fragment = context.createDocumentFragment(),
+ nodes = [], i;
+
+ if (jqLiteIsTextNode(html)) {
+ // Convert non-html into a text node
+ nodes.push(context.createTextNode(html));
+ } else {
+ // Convert html into DOM nodes
+ tmp = tmp || fragment.appendChild(context.createElement("div"));
+ tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase();
+ wrap = wrapMap[tag] || wrapMap._default;
+ tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2];
+
+ // Descend through wrappers to the right content
+ i = wrap[0];
+ while (i--) {
+ tmp = tmp.lastChild;
+ }
+
+ nodes = concat(nodes, tmp.childNodes);
+
+ tmp = fragment.firstChild;
+ tmp.textContent = "";
+ }
+
+ // Remove wrapper from fragment
+ fragment.textContent = "";
+ fragment.innerHTML = ""; // Clear inner HTML
+ forEach(nodes, function(node) {
+ fragment.appendChild(node);
+ });
+
+ return fragment;
+}
+
+function jqLiteParseHTML(html, context) {
+ context = context || document;
+ var parsed;
+
+ if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {
+ return [context.createElement(parsed[1])];
+ }
+
+ if ((parsed = jqLiteBuildFragment(html, context))) {
+ return parsed.childNodes;
+ }
+
+ return [];
+}
+
+
+// IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.
+var jqLiteContains = Node.prototype.contains || function(arg) {
+ // jshint bitwise: false
+ return !!(this.compareDocumentPosition(arg) & 16);
+ // jshint bitwise: true
+};
+
+/////////////////////////////////////////////
+function JQLite(element) {
+ if (element instanceof JQLite) {
+ return element;
+ }
+
+ var argIsString;
+
+ if (isString(element)) {
+ element = trim(element);
+ argIsString = true;
+ }
+ if (!(this instanceof JQLite)) {
+ if (argIsString && element.charAt(0) != '<') {
+ throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');
+ }
+ return new JQLite(element);
+ }
+
+ if (argIsString) {
+ jqLiteAddNodes(this, jqLiteParseHTML(element));
+ } else {
+ jqLiteAddNodes(this, element);
+ }
+}
+
+function jqLiteClone(element) {
+ return element.cloneNode(true);
+}
+
+function jqLiteDealoc(element, onlyDescendants) {
+ if (!onlyDescendants) jqLiteRemoveData(element);
+
+ if (element.querySelectorAll) {
+ var descendants = element.querySelectorAll('*');
+ for (var i = 0, l = descendants.length; i < l; i++) {
+ jqLiteRemoveData(descendants[i]);
+ }
+ }
+}
+
+function jqLiteOff(element, type, fn, unsupported) {
+ if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');
+
+ var expandoStore = jqLiteExpandoStore(element);
+ var events = expandoStore && expandoStore.events;
+ var handle = expandoStore && expandoStore.handle;
+
+ if (!handle) return; //no listeners registered
+
+ if (!type) {
+ for (type in events) {
+ if (type !== '$destroy') {
+ removeEventListenerFn(element, type, handle);
+ }
+ delete events[type];
+ }
+ } else {
+
+ var removeHandler = function(type) {
+ var listenerFns = events[type];
+ if (isDefined(fn)) {
+ arrayRemove(listenerFns || [], fn);
+ }
+ if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {
+ removeEventListenerFn(element, type, handle);
+ delete events[type];
+ }
+ };
+
+ forEach(type.split(' '), function(type) {
+ removeHandler(type);
+ if (MOUSE_EVENT_MAP[type]) {
+ removeHandler(MOUSE_EVENT_MAP[type]);
+ }
+ });
+ }
+}
+
+function jqLiteRemoveData(element, name) {
+ var expandoId = element.ng339;
+ var expandoStore = expandoId && jqCache[expandoId];
+
+ if (expandoStore) {
+ if (name) {
+ delete expandoStore.data[name];
+ return;
+ }
+
+ if (expandoStore.handle) {
+ if (expandoStore.events.$destroy) {
+ expandoStore.handle({}, '$destroy');
+ }
+ jqLiteOff(element);
+ }
+ delete jqCache[expandoId];
+ element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it
+ }
+}
+
+
+function jqLiteExpandoStore(element, createIfNecessary) {
+ var expandoId = element.ng339,
+ expandoStore = expandoId && jqCache[expandoId];
+
+ if (createIfNecessary && !expandoStore) {
+ element.ng339 = expandoId = jqNextId();
+ expandoStore = jqCache[expandoId] = {events: {}, data: {}, handle: undefined};
+ }
+
+ return expandoStore;
+}
+
+
+function jqLiteData(element, key, value) {
+ if (jqLiteAcceptsData(element)) {
+
+ var isSimpleSetter = isDefined(value);
+ var isSimpleGetter = !isSimpleSetter && key && !isObject(key);
+ var massGetter = !key;
+ var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter);
+ var data = expandoStore && expandoStore.data;
+
+ if (isSimpleSetter) { // data('key', value)
+ data[key] = value;
+ } else {
+ if (massGetter) { // data()
+ return data;
+ } else {
+ if (isSimpleGetter) { // data('key')
+ // don't force creation of expandoStore if it doesn't exist yet
+ return data && data[key];
+ } else { // mass-setter: data({key1: val1, key2: val2})
+ extend(data, key);
+ }
+ }
+ }
+ }
+}
+
+function jqLiteHasClass(element, selector) {
+ if (!element.getAttribute) return false;
+ return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " ").
+ indexOf(" " + selector + " ") > -1);
+}
+
+function jqLiteRemoveClass(element, cssClasses) {
+ if (cssClasses && element.setAttribute) {
+ forEach(cssClasses.split(' '), function(cssClass) {
+ element.setAttribute('class', trim(
+ (" " + (element.getAttribute('class') || '') + " ")
+ .replace(/[\n\t]/g, " ")
+ .replace(" " + trim(cssClass) + " ", " "))
+ );
+ });
+ }
+}
+
+function jqLiteAddClass(element, cssClasses) {
+ if (cssClasses && element.setAttribute) {
+ var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')
+ .replace(/[\n\t]/g, " ");
+
+ forEach(cssClasses.split(' '), function(cssClass) {
+ cssClass = trim(cssClass);
+ if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {
+ existingClasses += cssClass + ' ';
+ }
+ });
+
+ element.setAttribute('class', trim(existingClasses));
+ }
+}
+
+
+function jqLiteAddNodes(root, elements) {
+ // THIS CODE IS VERY HOT. Don't make changes without benchmarking.
+
+ if (elements) {
+
+ // if a Node (the most common case)
+ if (elements.nodeType) {
+ root[root.length++] = elements;
+ } else {
+ var length = elements.length;
+
+ // if an Array or NodeList and not a Window
+ if (typeof length === 'number' && elements.window !== elements) {
+ if (length) {
+ for (var i = 0; i < length; i++) {
+ root[root.length++] = elements[i];
+ }
+ }
+ } else {
+ root[root.length++] = elements;
+ }
+ }
+ }
+}
+
+
+function jqLiteController(element, name) {
+ return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller');
+}
+
+function jqLiteInheritedData(element, name, value) {
+ // if element is the document object work with the html element instead
+ // this makes $(document).scope() possible
+ if (element.nodeType == NODE_TYPE_DOCUMENT) {
+ element = element.documentElement;
+ }
+ var names = isArray(name) ? name : [name];
+
+ while (element) {
+ for (var i = 0, ii = names.length; i < ii; i++) {
+ if (isDefined(value = jqLite.data(element, names[i]))) return value;
+ }
+
+ // If dealing with a document fragment node with a host element, and no parent, use the host
+ // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM
+ // to lookup parent controllers.
+ element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host);
+ }
+}
+
+function jqLiteEmpty(element) {
+ jqLiteDealoc(element, true);
+ while (element.firstChild) {
+ element.removeChild(element.firstChild);
+ }
+}
+
+function jqLiteRemove(element, keepData) {
+ if (!keepData) jqLiteDealoc(element);
+ var parent = element.parentNode;
+ if (parent) parent.removeChild(element);
+}
+
+
+function jqLiteDocumentLoaded(action, win) {
+ win = win || window;
+ if (win.document.readyState === 'complete') {
+ // Force the action to be run async for consistent behaviour
+ // from the action's point of view
+ // i.e. it will definitely not be in a $apply
+ win.setTimeout(action);
+ } else {
+ // No need to unbind this handler as load is only ever called once
+ jqLite(win).on('load', action);
+ }
+}
+
+//////////////////////////////////////////
+// Functions which are declared directly.
+//////////////////////////////////////////
+var JQLitePrototype = JQLite.prototype = {
+ ready: function(fn) {
+ var fired = false;
+
+ function trigger() {
+ if (fired) return;
+ fired = true;
+ fn();
+ }
+
+ // check if document is already loaded
+ if (document.readyState === 'complete') {
+ setTimeout(trigger);
+ } else {
+ this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9
+ // we can not use jqLite since we are not done loading and jQuery could be loaded later.
+ // jshint -W064
+ JQLite(window).on('load', trigger); // fallback to window.onload for others
+ // jshint +W064
+ }
+ },
+ toString: function() {
+ var value = [];
+ forEach(this, function(e) { value.push('' + e);});
+ return '[' + value.join(', ') + ']';
+ },
+
+ eq: function(index) {
+ return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);
+ },
+
+ length: 0,
+ push: push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+//////////////////////////////////////////
+// Functions iterating getter/setters.
+// these functions return self on setter and
+// value on get.
+//////////////////////////////////////////
+var BOOLEAN_ATTR = {};
+forEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) {
+ BOOLEAN_ATTR[lowercase(value)] = value;
+});
+var BOOLEAN_ELEMENTS = {};
+forEach('input,select,option,textarea,button,form,details'.split(','), function(value) {
+ BOOLEAN_ELEMENTS[value] = true;
+});
+var ALIASED_ATTR = {
+ 'ngMinlength': 'minlength',
+ 'ngMaxlength': 'maxlength',
+ 'ngMin': 'min',
+ 'ngMax': 'max',
+ 'ngPattern': 'pattern'
+};
+
+function getBooleanAttrName(element, name) {
+ // check dom last since we will most likely fail on name
+ var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];
+
+ // booleanAttr is here twice to minimize DOM access
+ return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr;
+}
+
+function getAliasedAttrName(name) {
+ return ALIASED_ATTR[name];
+}
+
+forEach({
+ data: jqLiteData,
+ removeData: jqLiteRemoveData,
+ hasData: jqLiteHasData,
+ cleanData: jqLiteCleanData
+}, function(fn, name) {
+ JQLite[name] = fn;
+});
+
+forEach({
+ data: jqLiteData,
+ inheritedData: jqLiteInheritedData,
+
+ scope: function(element) {
+ // Can't use jqLiteData here directly so we stay compatible with jQuery!
+ return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);
+ },
+
+ isolateScope: function(element) {
+ // Can't use jqLiteData here directly so we stay compatible with jQuery!
+ return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate');
+ },
+
+ controller: jqLiteController,
+
+ injector: function(element) {
+ return jqLiteInheritedData(element, '$injector');
+ },
+
+ removeAttr: function(element, name) {
+ element.removeAttribute(name);
+ },
+
+ hasClass: jqLiteHasClass,
+
+ css: function(element, name, value) {
+ name = camelCase(name);
+
+ if (isDefined(value)) {
+ element.style[name] = value;
+ } else {
+ return element.style[name];
+ }
+ },
+
+ attr: function(element, name, value) {
+ var nodeType = element.nodeType;
+ if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT) {
+ return;
+ }
+ var lowercasedName = lowercase(name);
+ if (BOOLEAN_ATTR[lowercasedName]) {
+ if (isDefined(value)) {
+ if (!!value) {
+ element[name] = true;
+ element.setAttribute(name, lowercasedName);
+ } else {
+ element[name] = false;
+ element.removeAttribute(lowercasedName);
+ }
+ } else {
+ return (element[name] ||
+ (element.attributes.getNamedItem(name) || noop).specified)
+ ? lowercasedName
+ : undefined;
+ }
+ } else if (isDefined(value)) {
+ element.setAttribute(name, value);
+ } else if (element.getAttribute) {
+ // the extra argument "2" is to get the right thing for a.href in IE, see jQuery code
+ // some elements (e.g. Document) don't have get attribute, so return undefined
+ var ret = element.getAttribute(name, 2);
+ // normalize non-existing attributes to undefined (as jQuery)
+ return ret === null ? undefined : ret;
+ }
+ },
+
+ prop: function(element, name, value) {
+ if (isDefined(value)) {
+ element[name] = value;
+ } else {
+ return element[name];
+ }
+ },
+
+ text: (function() {
+ getText.$dv = '';
+ return getText;
+
+ function getText(element, value) {
+ if (isUndefined(value)) {
+ var nodeType = element.nodeType;
+ return (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT) ? element.textContent : '';
+ }
+ element.textContent = value;
+ }
+ })(),
+
+ val: function(element, value) {
+ if (isUndefined(value)) {
+ if (element.multiple && nodeName_(element) === 'select') {
+ var result = [];
+ forEach(element.options, function(option) {
+ if (option.selected) {
+ result.push(option.value || option.text);
+ }
+ });
+ return result.length === 0 ? null : result;
+ }
+ return element.value;
+ }
+ element.value = value;
+ },
+
+ html: function(element, value) {
+ if (isUndefined(value)) {
+ return element.innerHTML;
+ }
+ jqLiteDealoc(element, true);
+ element.innerHTML = value;
+ },
+
+ empty: jqLiteEmpty
+}, function(fn, name) {
+ /**
+ * Properties: writes return selection, reads return first value
+ */
+ JQLite.prototype[name] = function(arg1, arg2) {
+ var i, key;
+ var nodeCount = this.length;
+
+ // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it
+ // in a way that survives minification.
+ // jqLiteEmpty takes no arguments but is a setter.
+ if (fn !== jqLiteEmpty &&
+ (isUndefined((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) {
+ if (isObject(arg1)) {
+
+ // we are a write, but the object properties are the key/values
+ for (i = 0; i < nodeCount; i++) {
+ if (fn === jqLiteData) {
+ // data() takes the whole object in jQuery
+ fn(this[i], arg1);
+ } else {
+ for (key in arg1) {
+ fn(this[i], key, arg1[key]);
+ }
+ }
+ }
+ // return self for chaining
+ return this;
+ } else {
+ // we are a read, so read the first child.
+ // TODO: do we still need this?
+ var value = fn.$dv;
+ // Only if we have $dv do we iterate over all, otherwise it is just the first element.
+ var jj = (isUndefined(value)) ? Math.min(nodeCount, 1) : nodeCount;
+ for (var j = 0; j < jj; j++) {
+ var nodeValue = fn(this[j], arg1, arg2);
+ value = value ? value + nodeValue : nodeValue;
+ }
+ return value;
+ }
+ } else {
+ // we are a write, so apply to all children
+ for (i = 0; i < nodeCount; i++) {
+ fn(this[i], arg1, arg2);
+ }
+ // return self for chaining
+ return this;
+ }
+ };
+});
+
+function createEventHandler(element, events) {
+ var eventHandler = function(event, type) {
+ // jQuery specific api
+ event.isDefaultPrevented = function() {
+ return event.defaultPrevented;
+ };
+
+ var eventFns = events[type || event.type];
+ var eventFnsLength = eventFns ? eventFns.length : 0;
+
+ if (!eventFnsLength) return;
+
+ if (isUndefined(event.immediatePropagationStopped)) {
+ var originalStopImmediatePropagation = event.stopImmediatePropagation;
+ event.stopImmediatePropagation = function() {
+ event.immediatePropagationStopped = true;
+
+ if (event.stopPropagation) {
+ event.stopPropagation();
+ }
+
+ if (originalStopImmediatePropagation) {
+ originalStopImmediatePropagation.call(event);
+ }
+ };
+ }
+
+ event.isImmediatePropagationStopped = function() {
+ return event.immediatePropagationStopped === true;
+ };
+
+ // Some events have special handlers that wrap the real handler
+ var handlerWrapper = eventFns.specialHandlerWrapper || defaultHandlerWrapper;
+
+ // Copy event handlers in case event handlers array is modified during execution.
+ if ((eventFnsLength > 1)) {
+ eventFns = shallowCopy(eventFns);
+ }
+
+ for (var i = 0; i < eventFnsLength; i++) {
+ if (!event.isImmediatePropagationStopped()) {
+ handlerWrapper(element, event, eventFns[i]);
+ }
+ }
+ };
+
+ // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all
+ // events on `element`
+ eventHandler.elem = element;
+ return eventHandler;
+}
+
+function defaultHandlerWrapper(element, event, handler) {
+ handler.call(element, event);
+}
+
+function specialMouseHandlerWrapper(target, event, handler) {
+ // Refer to jQuery's implementation of mouseenter & mouseleave
+ // Read about mouseenter and mouseleave:
+ // http://www.quirksmode.org/js/events_mouse.html#link8
+ var related = event.relatedTarget;
+ // For mousenter/leave call the handler if related is outside the target.
+ // NB: No relatedTarget if the mouse left/entered the browser window
+ if (!related || (related !== target && !jqLiteContains.call(target, related))) {
+ handler.call(target, event);
+ }
+}
+
+//////////////////////////////////////////
+// Functions iterating traversal.
+// These functions chain results into a single
+// selector.
+//////////////////////////////////////////
+forEach({
+ removeData: jqLiteRemoveData,
+
+ on: function jqLiteOn(element, type, fn, unsupported) {
+ if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');
+
+ // Do not add event handlers to non-elements because they will not be cleaned up.
+ if (!jqLiteAcceptsData(element)) {
+ return;
+ }
+
+ var expandoStore = jqLiteExpandoStore(element, true);
+ var events = expandoStore.events;
+ var handle = expandoStore.handle;
+
+ if (!handle) {
+ handle = expandoStore.handle = createEventHandler(element, events);
+ }
+
+ // http://jsperf.com/string-indexof-vs-split
+ var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type];
+ var i = types.length;
+
+ var addHandler = function(type, specialHandlerWrapper, noEventListener) {
+ var eventFns = events[type];
+
+ if (!eventFns) {
+ eventFns = events[type] = [];
+ eventFns.specialHandlerWrapper = specialHandlerWrapper;
+ if (type !== '$destroy' && !noEventListener) {
+ addEventListenerFn(element, type, handle);
+ }
+ }
+
+ eventFns.push(fn);
+ };
+
+ while (i--) {
+ type = types[i];
+ if (MOUSE_EVENT_MAP[type]) {
+ addHandler(MOUSE_EVENT_MAP[type], specialMouseHandlerWrapper);
+ addHandler(type, undefined, true);
+ } else {
+ addHandler(type);
+ }
+ }
+ },
+
+ off: jqLiteOff,
+
+ one: function(element, type, fn) {
+ element = jqLite(element);
+
+ //add the listener twice so that when it is called
+ //you can remove the original function and still be
+ //able to call element.off(ev, fn) normally
+ element.on(type, function onFn() {
+ element.off(type, fn);
+ element.off(type, onFn);
+ });
+ element.on(type, fn);
+ },
+
+ replaceWith: function(element, replaceNode) {
+ var index, parent = element.parentNode;
+ jqLiteDealoc(element);
+ forEach(new JQLite(replaceNode), function(node) {
+ if (index) {
+ parent.insertBefore(node, index.nextSibling);
+ } else {
+ parent.replaceChild(node, element);
+ }
+ index = node;
+ });
+ },
+
+ children: function(element) {
+ var children = [];
+ forEach(element.childNodes, function(element) {
+ if (element.nodeType === NODE_TYPE_ELEMENT) {
+ children.push(element);
+ }
+ });
+ return children;
+ },
+
+ contents: function(element) {
+ return element.contentDocument || element.childNodes || [];
+ },
+
+ append: function(element, node) {
+ var nodeType = element.nodeType;
+ if (nodeType !== NODE_TYPE_ELEMENT && nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT) return;
+
+ node = new JQLite(node);
+
+ for (var i = 0, ii = node.length; i < ii; i++) {
+ var child = node[i];
+ element.appendChild(child);
+ }
+ },
+
+ prepend: function(element, node) {
+ if (element.nodeType === NODE_TYPE_ELEMENT) {
+ var index = element.firstChild;
+ forEach(new JQLite(node), function(child) {
+ element.insertBefore(child, index);
+ });
+ }
+ },
+
+ wrap: function(element, wrapNode) {
+ wrapNode = jqLite(wrapNode).eq(0).clone()[0];
+ var parent = element.parentNode;
+ if (parent) {
+ parent.replaceChild(wrapNode, element);
+ }
+ wrapNode.appendChild(element);
+ },
+
+ remove: jqLiteRemove,
+
+ detach: function(element) {
+ jqLiteRemove(element, true);
+ },
+
+ after: function(element, newElement) {
+ var index = element, parent = element.parentNode;
+ newElement = new JQLite(newElement);
+
+ for (var i = 0, ii = newElement.length; i < ii; i++) {
+ var node = newElement[i];
+ parent.insertBefore(node, index.nextSibling);
+ index = node;
+ }
+ },
+
+ addClass: jqLiteAddClass,
+ removeClass: jqLiteRemoveClass,
+
+ toggleClass: function(element, selector, condition) {
+ if (selector) {
+ forEach(selector.split(' '), function(className) {
+ var classCondition = condition;
+ if (isUndefined(classCondition)) {
+ classCondition = !jqLiteHasClass(element, className);
+ }
+ (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);
+ });
+ }
+ },
+
+ parent: function(element) {
+ var parent = element.parentNode;
+ return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null;
+ },
+
+ next: function(element) {
+ return element.nextElementSibling;
+ },
+
+ find: function(element, selector) {
+ if (element.getElementsByTagName) {
+ return element.getElementsByTagName(selector);
+ } else {
+ return [];
+ }
+ },
+
+ clone: jqLiteClone,
+
+ triggerHandler: function(element, event, extraParameters) {
+
+ var dummyEvent, eventFnsCopy, handlerArgs;
+ var eventName = event.type || event;
+ var expandoStore = jqLiteExpandoStore(element);
+ var events = expandoStore && expandoStore.events;
+ var eventFns = events && events[eventName];
+
+ if (eventFns) {
+ // Create a dummy event to pass to the handlers
+ dummyEvent = {
+ preventDefault: function() { this.defaultPrevented = true; },
+ isDefaultPrevented: function() { return this.defaultPrevented === true; },
+ stopImmediatePropagation: function() { this.immediatePropagationStopped = true; },
+ isImmediatePropagationStopped: function() { return this.immediatePropagationStopped === true; },
+ stopPropagation: noop,
+ type: eventName,
+ target: element
+ };
+
+ // If a custom event was provided then extend our dummy event with it
+ if (event.type) {
+ dummyEvent = extend(dummyEvent, event);
+ }
+
+ // Copy event handlers in case event handlers array is modified during execution.
+ eventFnsCopy = shallowCopy(eventFns);
+ handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent];
+
+ forEach(eventFnsCopy, function(fn) {
+ if (!dummyEvent.isImmediatePropagationStopped()) {
+ fn.apply(element, handlerArgs);
+ }
+ });
+ }
+ }
+}, function(fn, name) {
+ /**
+ * chaining functions
+ */
+ JQLite.prototype[name] = function(arg1, arg2, arg3) {
+ var value;
+
+ for (var i = 0, ii = this.length; i < ii; i++) {
+ if (isUndefined(value)) {
+ value = fn(this[i], arg1, arg2, arg3);
+ if (isDefined(value)) {
+ // any function which returns a value needs to be wrapped
+ value = jqLite(value);
+ }
+ } else {
+ jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));
+ }
+ }
+ return isDefined(value) ? value : this;
+ };
+
+ // bind legacy bind/unbind to on/off
+ JQLite.prototype.bind = JQLite.prototype.on;
+ JQLite.prototype.unbind = JQLite.prototype.off;
+});
+
+
+// Provider for private $$jqLite service
+function $$jqLiteProvider() {
+ this.$get = function $$jqLite() {
+ return extend(JQLite, {
+ hasClass: function(node, classes) {
+ if (node.attr) node = node[0];
+ return jqLiteHasClass(node, classes);
+ },
+ addClass: function(node, classes) {
+ if (node.attr) node = node[0];
+ return jqLiteAddClass(node, classes);
+ },
+ removeClass: function(node, classes) {
+ if (node.attr) node = node[0];
+ return jqLiteRemoveClass(node, classes);
+ }
+ });
+ };
+}
+
+/**
+ * Computes a hash of an 'obj'.
+ * Hash of a:
+ * string is string
+ * number is number as string
+ * object is either result of calling $$hashKey function on the object or uniquely generated id,
+ * that is also assigned to the $$hashKey property of the object.
+ *
+ * @param obj
+ * @returns {string} hash string such that the same input will have the same hash string.
+ * The resulting string key is in 'type:hashKey' format.
+ */
+function hashKey(obj, nextUidFn) {
+ var key = obj && obj.$$hashKey;
+
+ if (key) {
+ if (typeof key === 'function') {
+ key = obj.$$hashKey();
+ }
+ return key;
+ }
+
+ var objType = typeof obj;
+ if (objType == 'function' || (objType == 'object' && obj !== null)) {
+ key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)();
+ } else {
+ key = objType + ':' + obj;
+ }
+
+ return key;
+}
+
+/**
+ * HashMap which can use objects as keys
+ */
+function HashMap(array, isolatedUid) {
+ if (isolatedUid) {
+ var uid = 0;
+ this.nextUid = function() {
+ return ++uid;
+ };
+ }
+ forEach(array, this.put, this);
+}
+HashMap.prototype = {
+ /**
+ * Store key value pair
+ * @param key key to store can be any type
+ * @param value value to store can be any type
+ */
+ put: function(key, value) {
+ this[hashKey(key, this.nextUid)] = value;
+ },
+
+ /**
+ * @param key
+ * @returns {Object} the value for the key
+ */
+ get: function(key) {
+ return this[hashKey(key, this.nextUid)];
+ },
+
+ /**
+ * Remove the key/value pair
+ * @param key
+ */
+ remove: function(key) {
+ var value = this[key = hashKey(key, this.nextUid)];
+ delete this[key];
+ return value;
+ }
+};
+
+var $$HashMapProvider = [function() {
+ this.$get = [function() {
+ return HashMap;
+ }];
+}];
+
+/**
+ * @ngdoc function
+ * @module ng
+ * @name angular.injector
+ * @kind function
+ *
+ * @description
+ * Creates an injector object that can be used for retrieving services as well as for
+ * dependency injection (see {@link guide/di dependency injection}).
+ *
+ * @param {Array.<string|Function>} modules A list of module functions or their aliases. See
+ * {@link angular.module}. The `ng` module must be explicitly added.
+ * @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which
+ * disallows argument name annotation inference.
+ * @returns {injector} Injector object. See {@link auto.$injector $injector}.
+ *
+ * @example
+ * Typical usage
+ * ```js
+ * // create an injector
+ * var $injector = angular.injector(['ng']);
+ *
+ * // use the injector to kick off your application
+ * // use the type inference to auto inject arguments, or use implicit injection
+ * $injector.invoke(function($rootScope, $compile, $document) {
+ * $compile($document)($rootScope);
+ * $rootScope.$digest();
+ * });
+ * ```
+ *
+ * Sometimes you want to get access to the injector of a currently running Angular app
+ * from outside Angular. Perhaps, you want to inject and compile some markup after the
+ * application has been bootstrapped. You can do this using the extra `injector()` added
+ * to JQuery/jqLite elements. See {@link angular.element}.
+ *
+ * *This is fairly rare but could be the case if a third party library is injecting the
+ * markup.*
+ *
+ * In the following example a new block of HTML containing a `ng-controller`
+ * directive is added to the end of the document body by JQuery. We then compile and link
+ * it into the current AngularJS scope.
+ *
+ * ```js
+ * var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>');
+ * $(document.body).append($div);
+ *
+ * angular.element(document).injector().invoke(function($compile) {
+ * var scope = angular.element($div).scope();
+ * $compile($div)(scope);
+ * });
+ * ```
+ */
+
+
+/**
+ * @ngdoc module
+ * @name auto
+ * @description
+ *
+ * Implicit module which gets automatically added to each {@link auto.$injector $injector}.
+ */
+
+var ARROW_ARG = /^([^\(]+?)=>/;
+var FN_ARGS = /^[^\(]*\(\s*([^\)]*)\)/m;
+var FN_ARG_SPLIT = /,/;
+var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
+var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
+var $injectorMinErr = minErr('$injector');
+
+function extractArgs(fn) {
+ var fnText = fn.toString().replace(STRIP_COMMENTS, ''),
+ args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
+ return args;
+}
+
+function anonFn(fn) {
+ // For anonymous functions, showing at the very least the function signature can help in
+ // debugging.
+ var args = extractArgs(fn);
+ if (args) {
+ return 'function(' + (args[1] || '').replace(/[\s\r\n]+/, ' ') + ')';
+ }
+ return 'fn';
+}
+
+function annotate(fn, strictDi, name) {
+ var $inject,
+ argDecl,
+ last;
+
+ if (typeof fn === 'function') {
+ if (!($inject = fn.$inject)) {
+ $inject = [];
+ if (fn.length) {
+ if (strictDi) {
+ if (!isString(name) || !name) {
+ name = fn.name || anonFn(fn);
+ }
+ throw $injectorMinErr('strictdi',
+ '{0} is not using explicit annotation and cannot be invoked in strict mode', name);
+ }
+ argDecl = extractArgs(fn);
+ forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {
+ arg.replace(FN_ARG, function(all, underscore, name) {
+ $inject.push(name);
+ });
+ });
+ }
+ fn.$inject = $inject;
+ }
+ } else if (isArray(fn)) {
+ last = fn.length - 1;
+ assertArgFn(fn[last], 'fn');
+ $inject = fn.slice(0, last);
+ } else {
+ assertArgFn(fn, 'fn', true);
+ }
+ return $inject;
+}
+
+///////////////////////////////////////
+
+/**
+ * @ngdoc service
+ * @name $injector
+ *
+ * @description
+ *
+ * `$injector` is used to retrieve object instances as defined by
+ * {@link auto.$provide provider}, instantiate types, invoke methods,
+ * and load modules.
+ *
+ * The following always holds true:
+ *
+ * ```js
+ * var $injector = angular.injector();
+ * expect($injector.get('$injector')).toBe($injector);
+ * expect($injector.invoke(function($injector) {
+ * return $injector;
+ * })).toBe($injector);
+ * ```
+ *
+ * # Injection Function Annotation
+ *
+ * JavaScript does not have annotations, and annotations are needed for dependency injection. The
+ * following are all valid ways of annotating function with injection arguments and are equivalent.
+ *
+ * ```js
+ * // inferred (only works if code not minified/obfuscated)
+ * $injector.invoke(function(serviceA){});
+ *
+ * // annotated
+ * function explicit(serviceA) {};
+ * explicit.$inject = ['serviceA'];
+ * $injector.invoke(explicit);
+ *
+ * // inline
+ * $injector.invoke(['serviceA', function(serviceA){}]);
+ * ```
+ *
+ * ## Inference
+ *
+ * In JavaScript calling `toString()` on a function returns the function definition. The definition
+ * can then be parsed and the function arguments can be extracted. This method of discovering
+ * annotations is disallowed when the injector is in strict mode.
+ * *NOTE:* This does not work with minification, and obfuscation tools since these tools change the
+ * argument names.
+ *
+ * ## `$inject` Annotation
+ * By adding an `$inject` property onto a function the injection parameters can be specified.
+ *
+ * ## Inline
+ * As an array of injection names, where the last item in the array is the function to call.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#get
+ *
+ * @description
+ * Return an instance of the service.
+ *
+ * @param {string} name The name of the instance to retrieve.
+ * @param {string=} caller An optional string to provide the origin of the function call for error messages.
+ * @return {*} The instance.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#invoke
+ *
+ * @description
+ * Invoke the method and supply the method arguments from the `$injector`.
+ *
+ * @param {Function|Array.<string|Function>} fn The injectable function to invoke. Function parameters are
+ * injected according to the {@link guide/di $inject Annotation} rules.
+ * @param {Object=} self The `this` for the invoked method.
+ * @param {Object=} locals Optional object. If preset then any argument names are read from this
+ * object first, before the `$injector` is consulted.
+ * @returns {*} the value returned by the invoked `fn` function.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#has
+ *
+ * @description
+ * Allows the user to query if the particular service exists.
+ *
+ * @param {string} name Name of the service to query.
+ * @returns {boolean} `true` if injector has given service.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#instantiate
+ * @description
+ * Create a new instance of JS type. The method takes a constructor function, invokes the new
+ * operator, and supplies all of the arguments to the constructor function as specified by the
+ * constructor annotation.
+ *
+ * @param {Function} Type Annotated constructor function.
+ * @param {Object=} locals Optional object. If preset then any argument names are read from this
+ * object first, before the `$injector` is consulted.
+ * @returns {Object} new instance of `Type`.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#annotate
+ *
+ * @description
+ * Returns an array of service names which the function is requesting for injection. This API is
+ * used by the injector to determine which services need to be injected into the function when the
+ * function is invoked. There are three ways in which the function can be annotated with the needed
+ * dependencies.
+ *
+ * # Argument names
+ *
+ * The simplest form is to extract the dependencies from the arguments of the function. This is done
+ * by converting the function into a string using `toString()` method and extracting the argument
+ * names.
+ * ```js
+ * // Given
+ * function MyController($scope, $route) {
+ * // ...
+ * }
+ *
+ * // Then
+ * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+ * ```
+ *
+ * You can disallow this method by using strict injection mode.
+ *
+ * This method does not work with code minification / obfuscation. For this reason the following
+ * annotation strategies are supported.
+ *
+ * # The `$inject` property
+ *
+ * If a function has an `$inject` property and its value is an array of strings, then the strings
+ * represent names of services to be injected into the function.
+ * ```js
+ * // Given
+ * var MyController = function(obfuscatedScope, obfuscatedRoute) {
+ * // ...
+ * }
+ * // Define function dependencies
+ * MyController['$inject'] = ['$scope', '$route'];
+ *
+ * // Then
+ * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+ * ```
+ *
+ * # The array notation
+ *
+ * It is often desirable to inline Injected functions and that's when setting the `$inject` property
+ * is very inconvenient. In these situations using the array notation to specify the dependencies in
+ * a way that survives minification is a better choice:
+ *
+ * ```js
+ * // We wish to write this (not minification / obfuscation safe)
+ * injector.invoke(function($compile, $rootScope) {
+ * // ...
+ * });
+ *
+ * // We are forced to write break inlining
+ * var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {
+ * // ...
+ * };
+ * tmpFn.$inject = ['$compile', '$rootScope'];
+ * injector.invoke(tmpFn);
+ *
+ * // To better support inline function the inline annotation is supported
+ * injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {
+ * // ...
+ * }]);
+ *
+ * // Therefore
+ * expect(injector.annotate(
+ * ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
+ * ).toEqual(['$compile', '$rootScope']);
+ * ```
+ *
+ * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to
+ * be retrieved as described above.
+ *
+ * @param {boolean=} [strictDi=false] Disallow argument name annotation inference.
+ *
+ * @returns {Array.<string>} The names of the services which the function requires.
+ */
+
+
+
+
+/**
+ * @ngdoc service
+ * @name $provide
+ *
+ * @description
+ *
+ * The {@link auto.$provide $provide} service has a number of methods for registering components
+ * with the {@link auto.$injector $injector}. Many of these functions are also exposed on
+ * {@link angular.Module}.
+ *
+ * An Angular **service** is a singleton object created by a **service factory**. These **service
+ * factories** are functions which, in turn, are created by a **service provider**.
+ * The **service providers** are constructor functions. When instantiated they must contain a
+ * property called `$get`, which holds the **service factory** function.
+ *
+ * When you request a service, the {@link auto.$injector $injector} is responsible for finding the
+ * correct **service provider**, instantiating it and then calling its `$get` **service factory**
+ * function to get the instance of the **service**.
+ *
+ * Often services have no configuration options and there is no need to add methods to the service
+ * provider. The provider will be no more than a constructor function with a `$get` property. For
+ * these cases the {@link auto.$provide $provide} service has additional helper methods to register
+ * services without specifying a provider.
+ *
+ * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the
+ * {@link auto.$injector $injector}
+ * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by
+ * providers and services.
+ * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by
+ * services, not providers.
+ * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`,
+ * that will be wrapped in a **service provider** object, whose `$get` property will contain the
+ * given factory function.
+ * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class`
+ * that will be wrapped in a **service provider** object, whose `$get` property will instantiate
+ * a new object using the given constructor function.
+ *
+ * See the individual methods for more information and examples.
+ */
+
+/**
+ * @ngdoc method
+ * @name $provide#provider
+ * @description
+ *
+ * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions
+ * are constructor functions, whose instances are responsible for "providing" a factory for a
+ * service.
+ *
+ * Service provider names start with the name of the service they provide followed by `Provider`.
+ * For example, the {@link ng.$log $log} service has a provider called
+ * {@link ng.$logProvider $logProvider}.
+ *
+ * Service provider objects can have additional methods which allow configuration of the provider
+ * and its service. Importantly, you can configure what kind of service is created by the `$get`
+ * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a
+ * method {@link ng.$logProvider#debugEnabled debugEnabled}
+ * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the
+ * console or not.
+ *
+ * @param {string} name The name of the instance. NOTE: the provider will be available under `name +
+ 'Provider'` key.
+ * @param {(Object|function())} provider If the provider is:
+ *
+ * - `Object`: then it should have a `$get` method. The `$get` method will be invoked using
+ * {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created.
+ * - `Constructor`: a new instance of the provider will be created using
+ * {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`.
+ *
+ * @returns {Object} registered provider instance
+
+ * @example
+ *
+ * The following example shows how to create a simple event tracking service and register it using
+ * {@link auto.$provide#provider $provide.provider()}.
+ *
+ * ```js
+ * // Define the eventTracker provider
+ * function EventTrackerProvider() {
+ * var trackingUrl = '/track';
+ *
+ * // A provider method for configuring where the tracked events should been saved
+ * this.setTrackingUrl = function(url) {
+ * trackingUrl = url;
+ * };
+ *
+ * // The service factory function
+ * this.$get = ['$http', function($http) {
+ * var trackedEvents = {};
+ * return {
+ * // Call this to track an event
+ * event: function(event) {
+ * var count = trackedEvents[event] || 0;
+ * count += 1;
+ * trackedEvents[event] = count;
+ * return count;
+ * },
+ * // Call this to save the tracked events to the trackingUrl
+ * save: function() {
+ * $http.post(trackingUrl, trackedEvents);
+ * }
+ * };
+ * }];
+ * }
+ *
+ * describe('eventTracker', function() {
+ * var postSpy;
+ *
+ * beforeEach(module(function($provide) {
+ * // Register the eventTracker provider
+ * $provide.provider('eventTracker', EventTrackerProvider);
+ * }));
+ *
+ * beforeEach(module(function(eventTrackerProvider) {
+ * // Configure eventTracker provider
+ * eventTrackerProvider.setTrackingUrl('/custom-track');
+ * }));
+ *
+ * it('tracks events', inject(function(eventTracker) {
+ * expect(eventTracker.event('login')).toEqual(1);
+ * expect(eventTracker.event('login')).toEqual(2);
+ * }));
+ *
+ * it('saves to the tracking url', inject(function(eventTracker, $http) {
+ * postSpy = spyOn($http, 'post');
+ * eventTracker.event('login');
+ * eventTracker.save();
+ * expect(postSpy).toHaveBeenCalled();
+ * expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');
+ * expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');
+ * expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });
+ * }));
+ * });
+ * ```
+ */
+
+/**
+ * @ngdoc method
+ * @name $provide#factory
+ * @description
+ *
+ * Register a **service factory**, which will be called to return the service instance.
+ * This is short for registering a service where its provider consists of only a `$get` property,
+ * which is the given service factory function.
+ * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to
+ * configure your service in a provider.
+ *
+ * @param {string} name The name of the instance.
+ * @param {Function|Array.<string|Function>} $getFn The injectable $getFn for the instance creation.
+ * Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here is an example of registering a service
+ * ```js
+ * $provide.factory('ping', ['$http', function($http) {
+ * return function ping() {
+ * return $http.send('/ping');
+ * };
+ * }]);
+ * ```
+ * You would then inject and use this service like this:
+ * ```js
+ * someModule.controller('Ctrl', ['ping', function(ping) {
+ * ping();
+ * }]);
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#service
+ * @description
+ *
+ * Register a **service constructor**, which will be invoked with `new` to create the service
+ * instance.
+ * This is short for registering a service where its provider's `$get` property is the service
+ * constructor function that will be used to instantiate the service instance.
+ *
+ * You should use {@link auto.$provide#service $provide.service(class)} if you define your service
+ * as a type/class.
+ *
+ * @param {string} name The name of the instance.
+ * @param {Function|Array.<string|Function>} constructor An injectable class (constructor function)
+ * that will be instantiated.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here is an example of registering a service using
+ * {@link auto.$provide#service $provide.service(class)}.
+ * ```js
+ * var Ping = function($http) {
+ * this.$http = $http;
+ * };
+ *
+ * Ping.$inject = ['$http'];
+ *
+ * Ping.prototype.send = function() {
+ * return this.$http.get('/ping');
+ * };
+ * $provide.service('ping', Ping);
+ * ```
+ * You would then inject and use this service like this:
+ * ```js
+ * someModule.controller('Ctrl', ['ping', function(ping) {
+ * ping.send();
+ * }]);
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#value
+ * @description
+ *
+ * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a
+ * number, an array, an object or a function. This is short for registering a service where its
+ * provider's `$get` property is a factory function that takes no arguments and returns the **value
+ * service**.
+ *
+ * Value services are similar to constant services, except that they cannot be injected into a
+ * module configuration function (see {@link angular.Module#config}) but they can be overridden by
+ * an Angular
+ * {@link auto.$provide#decorator decorator}.
+ *
+ * @param {string} name The name of the instance.
+ * @param {*} value The value.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here are some examples of creating value services.
+ * ```js
+ * $provide.value('ADMIN_USER', 'admin');
+ *
+ * $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });
+ *
+ * $provide.value('halfOf', function(value) {
+ * return value / 2;
+ * });
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#constant
+ * @description
+ *
+ * Register a **constant service**, such as a string, a number, an array, an object or a function,
+ * with the {@link auto.$injector $injector}. Unlike {@link auto.$provide#value value} it can be
+ * injected into a module configuration function (see {@link angular.Module#config}) and it cannot
+ * be overridden by an Angular {@link auto.$provide#decorator decorator}.
+ *
+ * @param {string} name The name of the constant.
+ * @param {*} value The constant value.
+ * @returns {Object} registered instance
+ *
+ * @example
+ * Here a some examples of creating constants:
+ * ```js
+ * $provide.constant('SHARD_HEIGHT', 306);
+ *
+ * $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);
+ *
+ * $provide.constant('double', function(value) {
+ * return value * 2;
+ * });
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#decorator
+ * @description
+ *
+ * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator
+ * intercepts the creation of a service, allowing it to override or modify the behaviour of the
+ * service. The object returned by the decorator may be the original service, or a new service
+ * object which replaces or wraps and delegates to the original service.
+ *
+ * @param {string} name The name of the service to decorate.
+ * @param {Function|Array.<string|Function>} decorator This function will be invoked when the service needs to be
+ * instantiated and should return the decorated service instance. The function is called using
+ * the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.
+ * Local injection arguments:
+ *
+ * * `$delegate` - The original service instance, which can be monkey patched, configured,
+ * decorated or delegated to.
+ *
+ * @example
+ * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting
+ * calls to {@link ng.$log#error $log.warn()}.
+ * ```js
+ * $provide.decorator('$log', ['$delegate', function($delegate) {
+ * $delegate.warn = $delegate.error;
+ * return $delegate;
+ * }]);
+ * ```
+ */
+
+
+function createInjector(modulesToLoad, strictDi) {
+ strictDi = (strictDi === true);
+ var INSTANTIATING = {},
+ providerSuffix = 'Provider',
+ path = [],
+ loadedModules = new HashMap([], true),
+ providerCache = {
+ $provide: {
+ provider: supportObject(provider),
+ factory: supportObject(factory),
+ service: supportObject(service),
+ value: supportObject(value),
+ constant: supportObject(constant),
+ decorator: decorator
+ }
+ },
+ providerInjector = (providerCache.$injector =
+ createInternalInjector(providerCache, function(serviceName, caller) {
+ if (angular.isString(caller)) {
+ path.push(caller);
+ }
+ throw $injectorMinErr('unpr', "Unknown provider: {0}", path.join(' <- '));
+ })),
+ instanceCache = {},
+ protoInstanceInjector =
+ createInternalInjector(instanceCache, function(serviceName, caller) {
+ var provider = providerInjector.get(serviceName + providerSuffix, caller);
+ return instanceInjector.invoke(
+ provider.$get, provider, undefined, serviceName);
+ }),
+ instanceInjector = protoInstanceInjector;
+
+ providerCache['$injector' + providerSuffix] = { $get: valueFn(protoInstanceInjector) };
+ var runBlocks = loadModules(modulesToLoad);
+ instanceInjector = protoInstanceInjector.get('$injector');
+ instanceInjector.strictDi = strictDi;
+ forEach(runBlocks, function(fn) { if (fn) instanceInjector.invoke(fn); });
+
+ return instanceInjector;
+
+ ////////////////////////////////////
+ // $provider
+ ////////////////////////////////////
+
+ function supportObject(delegate) {
+ return function(key, value) {
+ if (isObject(key)) {
+ forEach(key, reverseParams(delegate));
+ } else {
+ return delegate(key, value);
+ }
+ };
+ }
+
+ function provider(name, provider_) {
+ assertNotHasOwnProperty(name, 'service');
+ if (isFunction(provider_) || isArray(provider_)) {
+ provider_ = providerInjector.instantiate(provider_);
+ }
+ if (!provider_.$get) {
+ throw $injectorMinErr('pget', "Provider '{0}' must define $get factory method.", name);
+ }
+ return providerCache[name + providerSuffix] = provider_;
+ }
+
+ function enforceReturnValue(name, factory) {
+ return function enforcedReturnValue() {
+ var result = instanceInjector.invoke(factory, this);
+ if (isUndefined(result)) {
+ throw $injectorMinErr('undef', "Provider '{0}' must return a value from $get factory method.", name);
+ }
+ return result;
+ };
+ }
+
+ function factory(name, factoryFn, enforce) {
+ return provider(name, {
+ $get: enforce !== false ? enforceReturnValue(name, factoryFn) : factoryFn
+ });
+ }
+
+ function service(name, constructor) {
+ return factory(name, ['$injector', function($injector) {
+ return $injector.instantiate(constructor);
+ }]);
+ }
+
+ function value(name, val) { return factory(name, valueFn(val), false); }
+
+ function constant(name, value) {
+ assertNotHasOwnProperty(name, 'constant');
+ providerCache[name] = value;
+ instanceCache[name] = value;
+ }
+
+ function decorator(serviceName, decorFn) {
+ var origProvider = providerInjector.get(serviceName + providerSuffix),
+ orig$get = origProvider.$get;
+
+ origProvider.$get = function() {
+ var origInstance = instanceInjector.invoke(orig$get, origProvider);
+ return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});
+ };
+ }
+
+ ////////////////////////////////////
+ // Module Loading
+ ////////////////////////////////////
+ function loadModules(modulesToLoad) {
+ assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');
+ var runBlocks = [], moduleFn;
+ forEach(modulesToLoad, function(module) {
+ if (loadedModules.get(module)) return;
+ loadedModules.put(module, true);
+
+ function runInvokeQueue(queue) {
+ var i, ii;
+ for (i = 0, ii = queue.length; i < ii; i++) {
+ var invokeArgs = queue[i],
+ provider = providerInjector.get(invokeArgs[0]);
+
+ provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
+ }
+ }
+
+ try {
+ if (isString(module)) {
+ moduleFn = angularModule(module);
+ runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
+ runInvokeQueue(moduleFn._invokeQueue);
+ runInvokeQueue(moduleFn._configBlocks);
+ } else if (isFunction(module)) {
+ runBlocks.push(providerInjector.invoke(module));
+ } else if (isArray(module)) {
+ runBlocks.push(providerInjector.invoke(module));
+ } else {
+ assertArgFn(module, 'module');
+ }
+ } catch (e) {
+ if (isArray(module)) {
+ module = module[module.length - 1];
+ }
+ if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {
+ // Safari & FF's stack traces don't contain error.message content
+ // unlike those of Chrome and IE
+ // So if stack doesn't contain message, we create a new string that contains both.
+ // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
+ /* jshint -W022 */
+ e = e.message + '\n' + e.stack;
+ }
+ throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
+ module, e.stack || e.message || e);
+ }
+ });
+ return runBlocks;
+ }
+
+ ////////////////////////////////////
+ // internal Injector
+ ////////////////////////////////////
+
+ function createInternalInjector(cache, factory) {
+
+ function getService(serviceName, caller) {
+ if (cache.hasOwnProperty(serviceName)) {
+ if (cache[serviceName] === INSTANTIATING) {
+ throw $injectorMinErr('cdep', 'Circular dependency found: {0}',
+ serviceName + ' <- ' + path.join(' <- '));
+ }
+ return cache[serviceName];
+ } else {
+ try {
+ path.unshift(serviceName);
+ cache[serviceName] = INSTANTIATING;
+ return cache[serviceName] = factory(serviceName, caller);
+ } catch (err) {
+ if (cache[serviceName] === INSTANTIATING) {
+ delete cache[serviceName];
+ }
+ throw err;
+ } finally {
+ path.shift();
+ }
+ }
+ }
+
+ function invoke(fn, self, locals, serviceName) {
+ if (typeof locals === 'string') {
+ serviceName = locals;
+ locals = null;
+ }
+
+ var args = [],
+ $inject = createInjector.$$annotate(fn, strictDi, serviceName),
+ length, i,
+ key;
+
+ for (i = 0, length = $inject.length; i < length; i++) {
+ key = $inject[i];
+ if (typeof key !== 'string') {
+ throw $injectorMinErr('itkn',
+ 'Incorrect injection token! Expected service name as string, got {0}', key);
+ }
+ args.push(
+ locals && locals.hasOwnProperty(key)
+ ? locals[key]
+ : getService(key, serviceName)
+ );
+ }
+ if (isArray(fn)) {
+ fn = fn[length];
+ }
+
+ // http://jsperf.com/angularjs-invoke-apply-vs-switch
+ // #5388
+ return fn.apply(self, args);
+ }
+
+ function instantiate(Type, locals, serviceName) {
+ // Check if Type is annotated and use just the given function at n-1 as parameter
+ // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
+ // Object creation: http://jsperf.com/create-constructor/2
+ var instance = Object.create((isArray(Type) ? Type[Type.length - 1] : Type).prototype || null);
+ var returnedValue = invoke(Type, instance, locals, serviceName);
+
+ return isObject(returnedValue) || isFunction(returnedValue) ? returnedValue : instance;
+ }
+
+ return {
+ invoke: invoke,
+ instantiate: instantiate,
+ get: getService,
+ annotate: createInjector.$$annotate,
+ has: function(name) {
+ return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);
+ }
+ };
+ }
+}
+
+createInjector.$$annotate = annotate;
+
+/**
+ * @ngdoc provider
+ * @name $anchorScrollProvider
+ *
+ * @description
+ * Use `$anchorScrollProvider` to disable automatic scrolling whenever
+ * {@link ng.$location#hash $location.hash()} changes.
+ */
+function $AnchorScrollProvider() {
+
+ var autoScrollingEnabled = true;
+
+ /**
+ * @ngdoc method
+ * @name $anchorScrollProvider#disableAutoScrolling
+ *
+ * @description
+ * By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to
+ * {@link ng.$location#hash $location.hash()} and scroll to the element matching the new hash.<br />
+ * Use this method to disable automatic scrolling.
+ *
+ * If automatic scrolling is disabled, one must explicitly call
+ * {@link ng.$anchorScroll $anchorScroll()} in order to scroll to the element related to the
+ * current hash.
+ */
+ this.disableAutoScrolling = function() {
+ autoScrollingEnabled = false;
+ };
+
+ /**
+ * @ngdoc service
+ * @name $anchorScroll
+ * @kind function
+ * @requires $window
+ * @requires $location
+ * @requires $rootScope
+ *
+ * @description
+ * When called, it scrolls to the element related to the specified `hash` or (if omitted) to the
+ * current value of {@link ng.$location#hash $location.hash()}, according to the rules specified
+ * in the
+ * [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#the-indicated-part-of-the-document).
+ *
+ * It also watches the {@link ng.$location#hash $location.hash()} and automatically scrolls to
+ * match any anchor whenever it changes. This can be disabled by calling
+ * {@link ng.$anchorScrollProvider#disableAutoScrolling $anchorScrollProvider.disableAutoScrolling()}.
+ *
+ * Additionally, you can use its {@link ng.$anchorScroll#yOffset yOffset} property to specify a
+ * vertical scroll-offset (either fixed or dynamic).
+ *
+ * @param {string=} hash The hash specifying the element to scroll to. If omitted, the value of
+ * {@link ng.$location#hash $location.hash()} will be used.
+ *
+ * @property {(number|function|jqLite)} yOffset
+ * If set, specifies a vertical scroll-offset. This is often useful when there are fixed
+ * positioned elements at the top of the page, such as navbars, headers etc.
+ *
+ * `yOffset` can be specified in various ways:
+ * - **number**: A fixed number of pixels to be used as offset.<br /><br />
+ * - **function**: A getter function called everytime `$anchorScroll()` is executed. Must return
+ * a number representing the offset (in pixels).<br /><br />
+ * - **jqLite**: A jqLite/jQuery element to be used for specifying the offset. The distance from
+ * the top of the page to the element's bottom will be used as offset.<br />
+ * **Note**: The element will be taken into account only as long as its `position` is set to
+ * `fixed`. This option is useful, when dealing with responsive navbars/headers that adjust
+ * their height and/or positioning according to the viewport's size.
+ *
+ * <br />
+ * <div class="alert alert-warning">
+ * In order for `yOffset` to work properly, scrolling should take place on the document's root and
+ * not some child element.
+ * </div>
+ *
+ * @example
+ <example module="anchorScrollExample">
+ <file name="index.html">
+ <div id="scrollArea" ng-controller="ScrollController">
+ <a ng-click="gotoBottom()">Go to bottom</a>
+ <a id="bottom"></a> You're at the bottom!
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('anchorScrollExample', [])
+ .controller('ScrollController', ['$scope', '$location', '$anchorScroll',
+ function ($scope, $location, $anchorScroll) {
+ $scope.gotoBottom = function() {
+ // set the location.hash to the id of
+ // the element you wish to scroll to.
+ $location.hash('bottom');
+
+ // call $anchorScroll()
+ $anchorScroll();
+ };
+ }]);
+ </file>
+ <file name="style.css">
+ #scrollArea {
+ height: 280px;
+ overflow: auto;
+ }
+
+ #bottom {
+ display: block;
+ margin-top: 2000px;
+ }
+ </file>
+ </example>
+ *
+ * <hr />
+ * The example below illustrates the use of a vertical scroll-offset (specified as a fixed value).
+ * See {@link ng.$anchorScroll#yOffset $anchorScroll.yOffset} for more details.
+ *
+ * @example
+ <example module="anchorScrollOffsetExample">
+ <file name="index.html">
+ <div class="fixed-header" ng-controller="headerCtrl">
+ <a href="" ng-click="gotoAnchor(x)" ng-repeat="x in [1,2,3,4,5]">
+ Go to anchor {{x}}
+ </a>
+ </div>
+ <div id="anchor{{x}}" class="anchor" ng-repeat="x in [1,2,3,4,5]">
+ Anchor {{x}} of 5
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('anchorScrollOffsetExample', [])
+ .run(['$anchorScroll', function($anchorScroll) {
+ $anchorScroll.yOffset = 50; // always scroll by 50 extra pixels
+ }])
+ .controller('headerCtrl', ['$anchorScroll', '$location', '$scope',
+ function ($anchorScroll, $location, $scope) {
+ $scope.gotoAnchor = function(x) {
+ var newHash = 'anchor' + x;
+ if ($location.hash() !== newHash) {
+ // set the $location.hash to `newHash` and
+ // $anchorScroll will automatically scroll to it
+ $location.hash('anchor' + x);
+ } else {
+ // call $anchorScroll() explicitly,
+ // since $location.hash hasn't changed
+ $anchorScroll();
+ }
+ };
+ }
+ ]);
+ </file>
+ <file name="style.css">
+ body {
+ padding-top: 50px;
+ }
+
+ .anchor {
+ border: 2px dashed DarkOrchid;
+ padding: 10px 10px 200px 10px;
+ }
+
+ .fixed-header {
+ background-color: rgba(0, 0, 0, 0.2);
+ height: 50px;
+ position: fixed;
+ top: 0; left: 0; right: 0;
+ }
+
+ .fixed-header > a {
+ display: inline-block;
+ margin: 5px 15px;
+ }
+ </file>
+ </example>
+ */
+ this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {
+ var document = $window.document;
+
+ // Helper function to get first anchor from a NodeList
+ // (using `Array#some()` instead of `angular#forEach()` since it's more performant
+ // and working in all supported browsers.)
+ function getFirstAnchor(list) {
+ var result = null;
+ Array.prototype.some.call(list, function(element) {
+ if (nodeName_(element) === 'a') {
+ result = element;
+ return true;
+ }
+ });
+ return result;
+ }
+
+ function getYOffset() {
+
+ var offset = scroll.yOffset;
+
+ if (isFunction(offset)) {
+ offset = offset();
+ } else if (isElement(offset)) {
+ var elem = offset[0];
+ var style = $window.getComputedStyle(elem);
+ if (style.position !== 'fixed') {
+ offset = 0;
+ } else {
+ offset = elem.getBoundingClientRect().bottom;
+ }
+ } else if (!isNumber(offset)) {
+ offset = 0;
+ }
+
+ return offset;
+ }
+
+ function scrollTo(elem) {
+ if (elem) {
+ elem.scrollIntoView();
+
+ var offset = getYOffset();
+
+ if (offset) {
+ // `offset` is the number of pixels we should scroll UP in order to align `elem` properly.
+ // This is true ONLY if the call to `elem.scrollIntoView()` initially aligns `elem` at the
+ // top of the viewport.
+ //
+ // IF the number of pixels from the top of `elem` to the end of the page's content is less
+ // than the height of the viewport, then `elem.scrollIntoView()` will align the `elem` some
+ // way down the page.
+ //
+ // This is often the case for elements near the bottom of the page.
+ //
+ // In such cases we do not need to scroll the whole `offset` up, just the difference between
+ // the top of the element and the offset, which is enough to align the top of `elem` at the
+ // desired position.
+ var elemTop = elem.getBoundingClientRect().top;
+ $window.scrollBy(0, elemTop - offset);
+ }
+ } else {
+ $window.scrollTo(0, 0);
+ }
+ }
+
+ function scroll(hash) {
+ hash = isString(hash) ? hash : $location.hash();
+ var elm;
+
+ // empty hash, scroll to the top of the page
+ if (!hash) scrollTo(null);
+
+ // element with given id
+ else if ((elm = document.getElementById(hash))) scrollTo(elm);
+
+ // first anchor with given name :-D
+ else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);
+
+ // no element and hash == 'top', scroll to the top of the page
+ else if (hash === 'top') scrollTo(null);
+ }
+
+ // does not scroll when user clicks on anchor link that is currently on
+ // (no url change, no $location.hash() change), browser native does scroll
+ if (autoScrollingEnabled) {
+ $rootScope.$watch(function autoScrollWatch() {return $location.hash();},
+ function autoScrollWatchAction(newVal, oldVal) {
+ // skip the initial scroll if $location.hash is empty
+ if (newVal === oldVal && newVal === '') return;
+
+ jqLiteDocumentLoaded(function() {
+ $rootScope.$evalAsync(scroll);
+ });
+ });
+ }
+
+ return scroll;
+ }];
+}
+
+var $animateMinErr = minErr('$animate');
+var ELEMENT_NODE = 1;
+var NG_ANIMATE_CLASSNAME = 'ng-animate';
+
+function mergeClasses(a,b) {
+ if (!a && !b) return '';
+ if (!a) return b;
+ if (!b) return a;
+ if (isArray(a)) a = a.join(' ');
+ if (isArray(b)) b = b.join(' ');
+ return a + ' ' + b;
+}
+
+function extractElementNode(element) {
+ for (var i = 0; i < element.length; i++) {
+ var elm = element[i];
+ if (elm.nodeType === ELEMENT_NODE) {
+ return elm;
+ }
+ }
+}
+
+function splitClasses(classes) {
+ if (isString(classes)) {
+ classes = classes.split(' ');
+ }
+
+ // Use createMap() to prevent class assumptions involving property names in
+ // Object.prototype
+ var obj = createMap();
+ forEach(classes, function(klass) {
+ // sometimes the split leaves empty string values
+ // incase extra spaces were applied to the options
+ if (klass.length) {
+ obj[klass] = true;
+ }
+ });
+ return obj;
+}
+
+// if any other type of options value besides an Object value is
+// passed into the $animate.method() animation then this helper code
+// will be run which will ignore it. While this patch is not the
+// greatest solution to this, a lot of existing plugins depend on
+// $animate to either call the callback (< 1.2) or return a promise
+// that can be changed. This helper function ensures that the options
+// are wiped clean incase a callback function is provided.
+function prepareAnimateOptions(options) {
+ return isObject(options)
+ ? options
+ : {};
+}
+
+var $$CoreAnimateRunnerProvider = function() {
+ this.$get = ['$q', '$$rAF', function($q, $$rAF) {
+ function AnimateRunner() {}
+ AnimateRunner.all = noop;
+ AnimateRunner.chain = noop;
+ AnimateRunner.prototype = {
+ end: noop,
+ cancel: noop,
+ resume: noop,
+ pause: noop,
+ complete: noop,
+ then: function(pass, fail) {
+ return $q(function(resolve) {
+ $$rAF(function() {
+ resolve();
+ });
+ }).then(pass, fail);
+ }
+ };
+ return AnimateRunner;
+ }];
+};
+
+// this is prefixed with Core since it conflicts with
+// the animateQueueProvider defined in ngAnimate/animateQueue.js
+var $$CoreAnimateQueueProvider = function() {
+ var postDigestQueue = new HashMap();
+ var postDigestElements = [];
+
+ this.$get = ['$$AnimateRunner', '$rootScope',
+ function($$AnimateRunner, $rootScope) {
+ return {
+ enabled: noop,
+ on: noop,
+ off: noop,
+ pin: noop,
+
+ push: function(element, event, options, domOperation) {
+ domOperation && domOperation();
+
+ options = options || {};
+ options.from && element.css(options.from);
+ options.to && element.css(options.to);
+
+ if (options.addClass || options.removeClass) {
+ addRemoveClassesPostDigest(element, options.addClass, options.removeClass);
+ }
+
+ return new $$AnimateRunner(); // jshint ignore:line
+ }
+ };
+
+
+ function updateData(data, classes, value) {
+ var changed = false;
+ if (classes) {
+ classes = isString(classes) ? classes.split(' ') :
+ isArray(classes) ? classes : [];
+ forEach(classes, function(className) {
+ if (className) {
+ changed = true;
+ data[className] = value;
+ }
+ });
+ }
+ return changed;
+ }
+
+ function handleCSSClassChanges() {
+ forEach(postDigestElements, function(element) {
+ var data = postDigestQueue.get(element);
+ if (data) {
+ var existing = splitClasses(element.attr('class'));
+ var toAdd = '';
+ var toRemove = '';
+ forEach(data, function(status, className) {
+ var hasClass = !!existing[className];
+ if (status !== hasClass) {
+ if (status) {
+ toAdd += (toAdd.length ? ' ' : '') + className;
+ } else {
+ toRemove += (toRemove.length ? ' ' : '') + className;
+ }
+ }
+ });
+
+ forEach(element, function(elm) {
+ toAdd && jqLiteAddClass(elm, toAdd);
+ toRemove && jqLiteRemoveClass(elm, toRemove);
+ });
+ postDigestQueue.remove(element);
+ }
+ });
+ postDigestElements.length = 0;
+ }
+
+
+ function addRemoveClassesPostDigest(element, add, remove) {
+ var data = postDigestQueue.get(element) || {};
+
+ var classesAdded = updateData(data, add, true);
+ var classesRemoved = updateData(data, remove, false);
+
+ if (classesAdded || classesRemoved) {
+
+ postDigestQueue.put(element, data);
+ postDigestElements.push(element);
+
+ if (postDigestElements.length === 1) {
+ $rootScope.$$postDigest(handleCSSClassChanges);
+ }
+ }
+ }
+ }];
+};
+
+/**
+ * @ngdoc provider
+ * @name $animateProvider
+ *
+ * @description
+ * Default implementation of $animate that doesn't perform any animations, instead just
+ * synchronously performs DOM updates and resolves the returned runner promise.
+ *
+ * In order to enable animations the `ngAnimate` module has to be loaded.
+ *
+ * To see the functional implementation check out `src/ngAnimate/animate.js`.
+ */
+var $AnimateProvider = ['$provide', function($provide) {
+ var provider = this;
+
+ this.$$registeredAnimations = Object.create(null);
+
+ /**
+ * @ngdoc method
+ * @name $animateProvider#register
+ *
+ * @description
+ * Registers a new injectable animation factory function. The factory function produces the
+ * animation object which contains callback functions for each event that is expected to be
+ * animated.
+ *
+ * * `eventFn`: `function(element, ... , doneFunction, options)`
+ * The element to animate, the `doneFunction` and the options fed into the animation. Depending
+ * on the type of animation additional arguments will be injected into the animation function. The
+ * list below explains the function signatures for the different animation methods:
+ *
+ * - setClass: function(element, addedClasses, removedClasses, doneFunction, options)
+ * - addClass: function(element, addedClasses, doneFunction, options)
+ * - removeClass: function(element, removedClasses, doneFunction, options)
+ * - enter, leave, move: function(element, doneFunction, options)
+ * - animate: function(element, fromStyles, toStyles, doneFunction, options)
+ *
+ * Make sure to trigger the `doneFunction` once the animation is fully complete.
+ *
+ * ```js
+ * return {
+ * //enter, leave, move signature
+ * eventFn : function(element, done, options) {
+ * //code to run the animation
+ * //once complete, then run done()
+ * return function endFunction(wasCancelled) {
+ * //code to cancel the animation
+ * }
+ * }
+ * }
+ * ```
+ *
+ * @param {string} name The name of the animation (this is what the class-based CSS value will be compared to).
+ * @param {Function} factory The factory function that will be executed to return the animation
+ * object.
+ */
+ this.register = function(name, factory) {
+ if (name && name.charAt(0) !== '.') {
+ throw $animateMinErr('notcsel', "Expecting class selector starting with '.' got '{0}'.", name);
+ }
+
+ var key = name + '-animation';
+ provider.$$registeredAnimations[name.substr(1)] = key;
+ $provide.factory(key, factory);
+ };
+
+ /**
+ * @ngdoc method
+ * @name $animateProvider#classNameFilter
+ *
+ * @description
+ * Sets and/or returns the CSS class regular expression that is checked when performing
+ * an animation. Upon bootstrap the classNameFilter value is not set at all and will
+ * therefore enable $animate to attempt to perform an animation on any element that is triggered.
+ * When setting the `classNameFilter` value, animations will only be performed on elements
+ * that successfully match the filter expression. This in turn can boost performance
+ * for low-powered devices as well as applications containing a lot of structural operations.
+ * @param {RegExp=} expression The className expression which will be checked against all animations
+ * @return {RegExp} The current CSS className expression value. If null then there is no expression value
+ */
+ this.classNameFilter = function(expression) {
+ if (arguments.length === 1) {
+ this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;
+ if (this.$$classNameFilter) {
+ var reservedRegex = new RegExp("(\\s+|\\/)" + NG_ANIMATE_CLASSNAME + "(\\s+|\\/)");
+ if (reservedRegex.test(this.$$classNameFilter.toString())) {
+ throw $animateMinErr('nongcls','$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME);
+
+ }
+ }
+ }
+ return this.$$classNameFilter;
+ };
+
+ this.$get = ['$$animateQueue', function($$animateQueue) {
+ function domInsert(element, parentElement, afterElement) {
+ // if for some reason the previous element was removed
+ // from the dom sometime before this code runs then let's
+ // just stick to using the parent element as the anchor
+ if (afterElement) {
+ var afterNode = extractElementNode(afterElement);
+ if (afterNode && !afterNode.parentNode && !afterNode.previousElementSibling) {
+ afterElement = null;
+ }
+ }
+ afterElement ? afterElement.after(element) : parentElement.prepend(element);
+ }
+
+ /**
+ * @ngdoc service
+ * @name $animate
+ * @description The $animate service exposes a series of DOM utility methods that provide support
+ * for animation hooks. The default behavior is the application of DOM operations, however,
+ * when an animation is detected (and animations are enabled), $animate will do the heavy lifting
+ * to ensure that animation runs with the triggered DOM operation.
+ *
+ * By default $animate doesn't trigger any animations. This is because the `ngAnimate` module isn't
+ * included and only when it is active then the animation hooks that `$animate` triggers will be
+ * functional. Once active then all structural `ng-` directives will trigger animations as they perform
+ * their DOM-related operations (enter, leave and move). Other directives such as `ngClass`,
+ * `ngShow`, `ngHide` and `ngMessages` also provide support for animations.
+ *
+ * It is recommended that the`$animate` service is always used when executing DOM-related procedures within directives.
+ *
+ * To learn more about enabling animation support, click here to visit the
+ * {@link ngAnimate ngAnimate module page}.
+ */
+ return {
+ // we don't call it directly since non-existant arguments may
+ // be interpreted as null within the sub enabled function
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#on
+ * @kind function
+ * @description Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...)
+ * has fired on the given element or among any of its children. Once the listener is fired, the provided callback
+ * is fired with the following params:
+ *
+ * ```js
+ * $animate.on('enter', container,
+ * function callback(element, phase) {
+ * // cool we detected an enter animation within the container
+ * }
+ * );
+ * ```
+ *
+ * @param {string} event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...)
+ * @param {DOMElement} container the container element that will capture each of the animation events that are fired on itself
+ * as well as among its children
+ * @param {Function} callback the callback function that will be fired when the listener is triggered
+ *
+ * The arguments present in the callback function are:
+ * * `element` - The captured DOM element that the animation was fired on.
+ * * `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends).
+ */
+ on: $$animateQueue.on,
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#off
+ * @kind function
+ * @description Deregisters an event listener based on the event which has been associated with the provided element. This method
+ * can be used in three different ways depending on the arguments:
+ *
+ * ```js
+ * // remove all the animation event listeners listening for `enter`
+ * $animate.off('enter');
+ *
+ * // remove all the animation event listeners listening for `enter` on the given element and its children
+ * $animate.off('enter', container);
+ *
+ * // remove the event listener function provided by `listenerFn` that is set
+ * // to listen for `enter` on the given `element` as well as its children
+ * $animate.off('enter', container, callback);
+ * ```
+ *
+ * @param {string} event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...)
+ * @param {DOMElement=} container the container element the event listener was placed on
+ * @param {Function=} callback the callback function that was registered as the listener
+ */
+ off: $$animateQueue.off,
+
+ /**
+ * @ngdoc method
+ * @name $animate#pin
+ * @kind function
+ * @description Associates the provided element with a host parent element to allow the element to be animated even if it exists
+ * outside of the DOM structure of the Angular application. By doing so, any animation triggered via `$animate` can be issued on the
+ * element despite being outside the realm of the application or within another application. Say for example if the application
+ * was bootstrapped on an element that is somewhere inside of the `<body>` tag, but we wanted to allow for an element to be situated
+ * as a direct child of `document.body`, then this can be achieved by pinning the element via `$animate.pin(element)`. Keep in mind
+ * that calling `$animate.pin(element, parentElement)` will not actually insert into the DOM anywhere; it will just create the association.
+ *
+ * Note that this feature is only active when the `ngAnimate` module is used.
+ *
+ * @param {DOMElement} element the external element that will be pinned
+ * @param {DOMElement} parentElement the host parent element that will be associated with the external element
+ */
+ pin: $$animateQueue.pin,
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#enabled
+ * @kind function
+ * @description Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This
+ * function can be called in four ways:
+ *
+ * ```js
+ * // returns true or false
+ * $animate.enabled();
+ *
+ * // changes the enabled state for all animations
+ * $animate.enabled(false);
+ * $animate.enabled(true);
+ *
+ * // returns true or false if animations are enabled for an element
+ * $animate.enabled(element);
+ *
+ * // changes the enabled state for an element and its children
+ * $animate.enabled(element, true);
+ * $animate.enabled(element, false);
+ * ```
+ *
+ * @param {DOMElement=} element the element that will be considered for checking/setting the enabled state
+ * @param {boolean=} enabled whether or not the animations will be enabled for the element
+ *
+ * @return {boolean} whether or not animations are enabled
+ */
+ enabled: $$animateQueue.enabled,
+
+ /**
+ * @ngdoc method
+ * @name $animate#cancel
+ * @kind function
+ * @description Cancels the provided animation.
+ *
+ * @param {Promise} animationPromise The animation promise that is returned when an animation is started.
+ */
+ cancel: function(runner) {
+ runner.end && runner.end();
+ },
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#enter
+ * @kind function
+ * @description Inserts the element into the DOM either after the `after` element (if provided) or
+ * as the first child within the `parent` element and then triggers an animation.
+ * A promise is returned that will be resolved during the next digest once the animation
+ * has completed.
+ *
+ * @param {DOMElement} element the element which will be inserted into the DOM
+ * @param {DOMElement} parent the parent element which will append the element as
+ * a child (so long as the after element is not present)
+ * @param {DOMElement=} after the sibling element after which the element will be appended
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ enter: function(element, parent, after, options) {
+ parent = parent && jqLite(parent);
+ after = after && jqLite(after);
+ parent = parent || after.parent();
+ domInsert(element, parent, after);
+ return $$animateQueue.push(element, 'enter', prepareAnimateOptions(options));
+ },
+
+ /**
+ *
+ * @ngdoc method
+ * @name $animate#move
+ * @kind function
+ * @description Inserts (moves) the element into its new position in the DOM either after
+ * the `after` element (if provided) or as the first child within the `parent` element
+ * and then triggers an animation. A promise is returned that will be resolved
+ * during the next digest once the animation has completed.
+ *
+ * @param {DOMElement} element the element which will be moved into the new DOM position
+ * @param {DOMElement} parent the parent element which will append the element as
+ * a child (so long as the after element is not present)
+ * @param {DOMElement=} after the sibling element after which the element will be appended
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ move: function(element, parent, after, options) {
+ parent = parent && jqLite(parent);
+ after = after && jqLite(after);
+ parent = parent || after.parent();
+ domInsert(element, parent, after);
+ return $$animateQueue.push(element, 'move', prepareAnimateOptions(options));
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#leave
+ * @kind function
+ * @description Triggers an animation and then removes the element from the DOM.
+ * When the function is called a promise is returned that will be resolved during the next
+ * digest once the animation has completed.
+ *
+ * @param {DOMElement} element the element which will be removed from the DOM
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ leave: function(element, options) {
+ return $$animateQueue.push(element, 'leave', prepareAnimateOptions(options), function() {
+ element.remove();
+ });
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#addClass
+ * @kind function
+ *
+ * @description Triggers an addClass animation surrounding the addition of the provided CSS class(es). Upon
+ * execution, the addClass operation will only be handled after the next digest and it will not trigger an
+ * animation if element already contains the CSS class or if the class is removed at a later step.
+ * Note that class-based animations are treated differently compared to structural animations
+ * (like enter, move and leave) since the CSS classes may be added/removed at different points
+ * depending if CSS or JavaScript animations are used.
+ *
+ * @param {DOMElement} element the element which the CSS classes will be applied to
+ * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ addClass: function(element, className, options) {
+ options = prepareAnimateOptions(options);
+ options.addClass = mergeClasses(options.addclass, className);
+ return $$animateQueue.push(element, 'addClass', options);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#removeClass
+ * @kind function
+ *
+ * @description Triggers a removeClass animation surrounding the removal of the provided CSS class(es). Upon
+ * execution, the removeClass operation will only be handled after the next digest and it will not trigger an
+ * animation if element does not contain the CSS class or if the class is added at a later step.
+ * Note that class-based animations are treated differently compared to structural animations
+ * (like enter, move and leave) since the CSS classes may be added/removed at different points
+ * depending if CSS or JavaScript animations are used.
+ *
+ * @param {DOMElement} element the element which the CSS classes will be applied to
+ * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ removeClass: function(element, className, options) {
+ options = prepareAnimateOptions(options);
+ options.removeClass = mergeClasses(options.removeClass, className);
+ return $$animateQueue.push(element, 'removeClass', options);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#setClass
+ * @kind function
+ *
+ * @description Performs both the addition and removal of a CSS classes on an element and (during the process)
+ * triggers an animation surrounding the class addition/removal. Much like `$animate.addClass` and
+ * `$animate.removeClass`, `setClass` will only evaluate the classes being added/removed once a digest has
+ * passed. Note that class-based animations are treated differently compared to structural animations
+ * (like enter, move and leave) since the CSS classes may be added/removed at different points
+ * depending if CSS or JavaScript animations are used.
+ *
+ * @param {DOMElement} element the element which the CSS classes will be applied to
+ * @param {string} add the CSS class(es) that will be added (multiple classes are separated via spaces)
+ * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces)
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ setClass: function(element, add, remove, options) {
+ options = prepareAnimateOptions(options);
+ options.addClass = mergeClasses(options.addClass, add);
+ options.removeClass = mergeClasses(options.removeClass, remove);
+ return $$animateQueue.push(element, 'setClass', options);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $animate#animate
+ * @kind function
+ *
+ * @description Performs an inline animation on the element which applies the provided to and from CSS styles to the element.
+ * If any detected CSS transition, keyframe or JavaScript matches the provided className value then the animation will take
+ * on the provided styles. For example, if a transition animation is set for the given className then the provided from and
+ * to styles will be applied alongside the given transition. If a JavaScript animation is detected then the provided styles
+ * will be given in as function paramters into the `animate` method (or as apart of the `options` parameter).
+ *
+ * @param {DOMElement} element the element which the CSS styles will be applied to
+ * @param {object} from the from (starting) CSS styles that will be applied to the element and across the animation.
+ * @param {object} to the to (destination) CSS styles that will be applied to the element and across the animation.
+ * @param {string=} className an optional CSS class that will be applied to the element for the duration of the animation. If
+ * this value is left as empty then a CSS class of `ng-inline-animate` will be applied to the element.
+ * (Note that if no animation is detected then this value will not be appplied to the element.)
+ * @param {object=} options an optional collection of options/styles that will be applied to the element
+ *
+ * @return {Promise} the animation callback promise
+ */
+ animate: function(element, from, to, className, options) {
+ options = prepareAnimateOptions(options);
+ options.from = options.from ? extend(options.from, from) : from;
+ options.to = options.to ? extend(options.to, to) : to;
+
+ className = className || 'ng-inline-animate';
+ options.tempClasses = mergeClasses(options.tempClasses, className);
+ return $$animateQueue.push(element, 'animate', options);
+ }
+ };
+ }];
+}];
+
+/**
+ * @ngdoc service
+ * @name $animateCss
+ * @kind object
+ *
+ * @description
+ * This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included,
+ * then the `$animateCss` service will actually perform animations.
+ *
+ * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}.
+ */
+var $CoreAnimateCssProvider = function() {
+ this.$get = ['$$rAF', '$q', function($$rAF, $q) {
+
+ var RAFPromise = function() {};
+ RAFPromise.prototype = {
+ done: function(cancel) {
+ this.defer && this.defer[cancel === true ? 'reject' : 'resolve']();
+ },
+ end: function() {
+ this.done();
+ },
+ cancel: function() {
+ this.done(true);
+ },
+ getPromise: function() {
+ if (!this.defer) {
+ this.defer = $q.defer();
+ }
+ return this.defer.promise;
+ },
+ then: function(f1,f2) {
+ return this.getPromise().then(f1,f2);
+ },
+ 'catch': function(f1) {
+ return this.getPromise()['catch'](f1);
+ },
+ 'finally': function(f1) {
+ return this.getPromise()['finally'](f1);
+ }
+ };
+
+ return function(element, options) {
+ // there is no point in applying the styles since
+ // there is no animation that goes on at all in
+ // this version of $animateCss.
+ if (options.cleanupStyles) {
+ options.from = options.to = null;
+ }
+
+ if (options.from) {
+ element.css(options.from);
+ options.from = null;
+ }
+
+ var closed, runner = new RAFPromise();
+ return {
+ start: run,
+ end: run
+ };
+
+ function run() {
+ $$rAF(function() {
+ close();
+ if (!closed) {
+ runner.done();
+ }
+ closed = true;
+ });
+ return runner;
+ }
+
+ function close() {
+ if (options.addClass) {
+ element.addClass(options.addClass);
+ options.addClass = null;
+ }
+ if (options.removeClass) {
+ element.removeClass(options.removeClass);
+ options.removeClass = null;
+ }
+ if (options.to) {
+ element.css(options.to);
+ options.to = null;
+ }
+ }
+ };
+ }];
+};
+
+/* global stripHash: true */
+
+/**
+ * ! This is a private undocumented service !
+ *
+ * @name $browser
+ * @requires $log
+ * @description
+ * This object has two goals:
+ *
+ * - hide all the global state in the browser caused by the window object
+ * - abstract away all the browser specific features and inconsistencies
+ *
+ * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`
+ * service, which can be used for convenient testing of the application without the interaction with
+ * the real browser apis.
+ */
+/**
+ * @param {object} window The global window object.
+ * @param {object} document jQuery wrapped document.
+ * @param {object} $log window.console or an object with the same interface.
+ * @param {object} $sniffer $sniffer service
+ */
+function Browser(window, document, $log, $sniffer) {
+ var self = this,
+ rawDocument = document[0],
+ location = window.location,
+ history = window.history,
+ setTimeout = window.setTimeout,
+ clearTimeout = window.clearTimeout,
+ pendingDeferIds = {};
+
+ self.isMock = false;
+
+ var outstandingRequestCount = 0;
+ var outstandingRequestCallbacks = [];
+
+ // TODO(vojta): remove this temporary api
+ self.$$completeOutstandingRequest = completeOutstandingRequest;
+ self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };
+
+ /**
+ * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`
+ * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.
+ */
+ function completeOutstandingRequest(fn) {
+ try {
+ fn.apply(null, sliceArgs(arguments, 1));
+ } finally {
+ outstandingRequestCount--;
+ if (outstandingRequestCount === 0) {
+ while (outstandingRequestCallbacks.length) {
+ try {
+ outstandingRequestCallbacks.pop()();
+ } catch (e) {
+ $log.error(e);
+ }
+ }
+ }
+ }
+ }
+
+ function getHash(url) {
+ var index = url.indexOf('#');
+ return index === -1 ? '' : url.substr(index);
+ }
+
+ /**
+ * @private
+ * Note: this method is used only by scenario runner
+ * TODO(vojta): prefix this method with $$ ?
+ * @param {function()} callback Function that will be called when no outstanding request
+ */
+ self.notifyWhenNoOutstandingRequests = function(callback) {
+ if (outstandingRequestCount === 0) {
+ callback();
+ } else {
+ outstandingRequestCallbacks.push(callback);
+ }
+ };
+
+ //////////////////////////////////////////////////////////////
+ // URL API
+ //////////////////////////////////////////////////////////////
+
+ var cachedState, lastHistoryState,
+ lastBrowserUrl = location.href,
+ baseElement = document.find('base'),
+ pendingLocation = null;
+
+ cacheState();
+ lastHistoryState = cachedState;
+
+ /**
+ * @name $browser#url
+ *
+ * @description
+ * GETTER:
+ * Without any argument, this method just returns current value of location.href.
+ *
+ * SETTER:
+ * With at least one argument, this method sets url to new value.
+ * If html5 history api supported, pushState/replaceState is used, otherwise
+ * location.href/location.replace is used.
+ * Returns its own instance to allow chaining
+ *
+ * NOTE: this api is intended for use only by the $location service. Please use the
+ * {@link ng.$location $location service} to change url.
+ *
+ * @param {string} url New url (when used as setter)
+ * @param {boolean=} replace Should new url replace current history record?
+ * @param {object=} state object to use with pushState/replaceState
+ */
+ self.url = function(url, replace, state) {
+ // In modern browsers `history.state` is `null` by default; treating it separately
+ // from `undefined` would cause `$browser.url('/foo')` to change `history.state`
+ // to undefined via `pushState`. Instead, let's change `undefined` to `null` here.
+ if (isUndefined(state)) {
+ state = null;
+ }
+
+ // Android Browser BFCache causes location, history reference to become stale.
+ if (location !== window.location) location = window.location;
+ if (history !== window.history) history = window.history;
+
+ // setter
+ if (url) {
+ var sameState = lastHistoryState === state;
+
+ // Don't change anything if previous and current URLs and states match. This also prevents
+ // IE<10 from getting into redirect loop when in LocationHashbangInHtml5Url mode.
+ // See https://github.com/angular/angular.js/commit/ffb2701
+ if (lastBrowserUrl === url && (!$sniffer.history || sameState)) {
+ return self;
+ }
+ var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url);
+ lastBrowserUrl = url;
+ lastHistoryState = state;
+ // Don't use history API if only the hash changed
+ // due to a bug in IE10/IE11 which leads
+ // to not firing a `hashchange` nor `popstate` event
+ // in some cases (see #9143).
+ if ($sniffer.history && (!sameBase || !sameState)) {
+ history[replace ? 'replaceState' : 'pushState'](state, '', url);
+ cacheState();
+ // Do the assignment again so that those two variables are referentially identical.
+ lastHistoryState = cachedState;
+ } else {
+ if (!sameBase || pendingLocation) {
+ pendingLocation = url;
+ }
+ if (replace) {
+ location.replace(url);
+ } else if (!sameBase) {
+ location.href = url;
+ } else {
+ location.hash = getHash(url);
+ }
+ if (location.href !== url) {
+ pendingLocation = url;
+ }
+ }
+ return self;
+ // getter
+ } else {
+ // - pendingLocation is needed as browsers don't allow to read out
+ // the new location.href if a reload happened or if there is a bug like in iOS 9 (see
+ // https://openradar.appspot.com/22186109).
+ // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172
+ return pendingLocation || location.href.replace(/%27/g,"'");
+ }
+ };
+
+ /**
+ * @name $browser#state
+ *
+ * @description
+ * This method is a getter.
+ *
+ * Return history.state or null if history.state is undefined.
+ *
+ * @returns {object} state
+ */
+ self.state = function() {
+ return cachedState;
+ };
+
+ var urlChangeListeners = [],
+ urlChangeInit = false;
+
+ function cacheStateAndFireUrlChange() {
+ pendingLocation = null;
+ cacheState();
+ fireUrlChange();
+ }
+
+ function getCurrentState() {
+ try {
+ return history.state;
+ } catch (e) {
+ // MSIE can reportedly throw when there is no state (UNCONFIRMED).
+ }
+ }
+
+ // This variable should be used *only* inside the cacheState function.
+ var lastCachedState = null;
+ function cacheState() {
+ // This should be the only place in $browser where `history.state` is read.
+ cachedState = getCurrentState();
+ cachedState = isUndefined(cachedState) ? null : cachedState;
+
+ // Prevent callbacks fo fire twice if both hashchange & popstate were fired.
+ if (equals(cachedState, lastCachedState)) {
+ cachedState = lastCachedState;
+ }
+ lastCachedState = cachedState;
+ }
+
+ function fireUrlChange() {
+ if (lastBrowserUrl === self.url() && lastHistoryState === cachedState) {
+ return;
+ }
+
+ lastBrowserUrl = self.url();
+ lastHistoryState = cachedState;
+ forEach(urlChangeListeners, function(listener) {
+ listener(self.url(), cachedState);
+ });
+ }
+
+ /**
+ * @name $browser#onUrlChange
+ *
+ * @description
+ * Register callback function that will be called, when url changes.
+ *
+ * It's only called when the url is changed from outside of angular:
+ * - user types different url into address bar
+ * - user clicks on history (forward/back) button
+ * - user clicks on a link
+ *
+ * It's not called when url is changed by $browser.url() method
+ *
+ * The listener gets called with new url as parameter.
+ *
+ * NOTE: this api is intended for use only by the $location service. Please use the
+ * {@link ng.$location $location service} to monitor url changes in angular apps.
+ *
+ * @param {function(string)} listener Listener function to be called when url changes.
+ * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.
+ */
+ self.onUrlChange = function(callback) {
+ // TODO(vojta): refactor to use node's syntax for events
+ if (!urlChangeInit) {
+ // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)
+ // don't fire popstate when user change the address bar and don't fire hashchange when url
+ // changed by push/replaceState
+
+ // html5 history api - popstate event
+ if ($sniffer.history) jqLite(window).on('popstate', cacheStateAndFireUrlChange);
+ // hashchange event
+ jqLite(window).on('hashchange', cacheStateAndFireUrlChange);
+
+ urlChangeInit = true;
+ }
+
+ urlChangeListeners.push(callback);
+ return callback;
+ };
+
+ /**
+ * @private
+ * Remove popstate and hashchange handler from window.
+ *
+ * NOTE: this api is intended for use only by $rootScope.
+ */
+ self.$$applicationDestroyed = function() {
+ jqLite(window).off('hashchange popstate', cacheStateAndFireUrlChange);
+ };
+
+ /**
+ * Checks whether the url has changed outside of Angular.
+ * Needs to be exported to be able to check for changes that have been done in sync,
+ * as hashchange/popstate events fire in async.
+ */
+ self.$$checkUrlChange = fireUrlChange;
+
+ //////////////////////////////////////////////////////////////
+ // Misc API
+ //////////////////////////////////////////////////////////////
+
+ /**
+ * @name $browser#baseHref
+ *
+ * @description
+ * Returns current <base href>
+ * (always relative - without domain)
+ *
+ * @returns {string} The current base href
+ */
+ self.baseHref = function() {
+ var href = baseElement.attr('href');
+ return href ? href.replace(/^(https?\:)?\/\/[^\/]*/, '') : '';
+ };
+
+ /**
+ * @name $browser#defer
+ * @param {function()} fn A function, who's execution should be deferred.
+ * @param {number=} [delay=0] of milliseconds to defer the function execution.
+ * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.
+ *
+ * @description
+ * Executes a fn asynchronously via `setTimeout(fn, delay)`.
+ *
+ * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using
+ * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed
+ * via `$browser.defer.flush()`.
+ *
+ */
+ self.defer = function(fn, delay) {
+ var timeoutId;
+ outstandingRequestCount++;
+ timeoutId = setTimeout(function() {
+ delete pendingDeferIds[timeoutId];
+ completeOutstandingRequest(fn);
+ }, delay || 0);
+ pendingDeferIds[timeoutId] = true;
+ return timeoutId;
+ };
+
+
+ /**
+ * @name $browser#defer.cancel
+ *
+ * @description
+ * Cancels a deferred task identified with `deferId`.
+ *
+ * @param {*} deferId Token returned by the `$browser.defer` function.
+ * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
+ * canceled.
+ */
+ self.defer.cancel = function(deferId) {
+ if (pendingDeferIds[deferId]) {
+ delete pendingDeferIds[deferId];
+ clearTimeout(deferId);
+ completeOutstandingRequest(noop);
+ return true;
+ }
+ return false;
+ };
+
+}
+
+function $BrowserProvider() {
+ this.$get = ['$window', '$log', '$sniffer', '$document',
+ function($window, $log, $sniffer, $document) {
+ return new Browser($window, $document, $log, $sniffer);
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $cacheFactory
+ *
+ * @description
+ * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to
+ * them.
+ *
+ * ```js
+ *
+ * var cache = $cacheFactory('cacheId');
+ * expect($cacheFactory.get('cacheId')).toBe(cache);
+ * expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
+ *
+ * cache.put("key", "value");
+ * cache.put("another key", "another value");
+ *
+ * // We've specified no options on creation
+ * expect(cache.info()).toEqual({id: 'cacheId', size: 2});
+ *
+ * ```
+ *
+ *
+ * @param {string} cacheId Name or id of the newly created cache.
+ * @param {object=} options Options object that specifies the cache behavior. Properties:
+ *
+ * - `{number=}` `capacity` — turns the cache into LRU cache.
+ *
+ * @returns {object} Newly created cache object with the following set of methods:
+ *
+ * - `{object}` `info()` — Returns id, size, and options of cache.
+ * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns
+ * it.
+ * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.
+ * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.
+ * - `{void}` `removeAll()` — Removes all cached values.
+ * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.
+ *
+ * @example
+ <example module="cacheExampleApp">
+ <file name="index.html">
+ <div ng-controller="CacheController">
+ <input ng-model="newCacheKey" placeholder="Key">
+ <input ng-model="newCacheValue" placeholder="Value">
+ <button ng-click="put(newCacheKey, newCacheValue)">Cache</button>
+
+ <p ng-if="keys.length">Cached Values</p>
+ <div ng-repeat="key in keys">
+ <span ng-bind="key"></span>
+ <span>: </span>
+ <b ng-bind="cache.get(key)"></b>
+ </div>
+
+ <p>Cache Info</p>
+ <div ng-repeat="(key, value) in cache.info()">
+ <span ng-bind="key"></span>
+ <span>: </span>
+ <b ng-bind="value"></b>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('cacheExampleApp', []).
+ controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {
+ $scope.keys = [];
+ $scope.cache = $cacheFactory('cacheId');
+ $scope.put = function(key, value) {
+ if (angular.isUndefined($scope.cache.get(key))) {
+ $scope.keys.push(key);
+ }
+ $scope.cache.put(key, angular.isUndefined(value) ? null : value);
+ };
+ }]);
+ </file>
+ <file name="style.css">
+ p {
+ margin: 10px 0 3px;
+ }
+ </file>
+ </example>
+ */
+function $CacheFactoryProvider() {
+
+ this.$get = function() {
+ var caches = {};
+
+ function cacheFactory(cacheId, options) {
+ if (cacheId in caches) {
+ throw minErr('$cacheFactory')('iid', "CacheId '{0}' is already taken!", cacheId);
+ }
+
+ var size = 0,
+ stats = extend({}, options, {id: cacheId}),
+ data = createMap(),
+ capacity = (options && options.capacity) || Number.MAX_VALUE,
+ lruHash = createMap(),
+ freshEnd = null,
+ staleEnd = null;
+
+ /**
+ * @ngdoc type
+ * @name $cacheFactory.Cache
+ *
+ * @description
+ * A cache object used to store and retrieve data, primarily used by
+ * {@link $http $http} and the {@link ng.directive:script script} directive to cache
+ * templates and other data.
+ *
+ * ```js
+ * angular.module('superCache')
+ * .factory('superCache', ['$cacheFactory', function($cacheFactory) {
+ * return $cacheFactory('super-cache');
+ * }]);
+ * ```
+ *
+ * Example test:
+ *
+ * ```js
+ * it('should behave like a cache', inject(function(superCache) {
+ * superCache.put('key', 'value');
+ * superCache.put('another key', 'another value');
+ *
+ * expect(superCache.info()).toEqual({
+ * id: 'super-cache',
+ * size: 2
+ * });
+ *
+ * superCache.remove('another key');
+ * expect(superCache.get('another key')).toBeUndefined();
+ *
+ * superCache.removeAll();
+ * expect(superCache.info()).toEqual({
+ * id: 'super-cache',
+ * size: 0
+ * });
+ * }));
+ * ```
+ */
+ return caches[cacheId] = {
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#put
+ * @kind function
+ *
+ * @description
+ * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be
+ * retrieved later, and incrementing the size of the cache if the key was not already
+ * present in the cache. If behaving like an LRU cache, it will also remove stale
+ * entries from the set.
+ *
+ * It will not insert undefined values into the cache.
+ *
+ * @param {string} key the key under which the cached data is stored.
+ * @param {*} value the value to store alongside the key. If it is undefined, the key
+ * will not be stored.
+ * @returns {*} the value stored.
+ */
+ put: function(key, value) {
+ if (isUndefined(value)) return;
+ if (capacity < Number.MAX_VALUE) {
+ var lruEntry = lruHash[key] || (lruHash[key] = {key: key});
+
+ refresh(lruEntry);
+ }
+
+ if (!(key in data)) size++;
+ data[key] = value;
+
+ if (size > capacity) {
+ this.remove(staleEnd.key);
+ }
+
+ return value;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#get
+ * @kind function
+ *
+ * @description
+ * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object.
+ *
+ * @param {string} key the key of the data to be retrieved
+ * @returns {*} the value stored.
+ */
+ get: function(key) {
+ if (capacity < Number.MAX_VALUE) {
+ var lruEntry = lruHash[key];
+
+ if (!lruEntry) return;
+
+ refresh(lruEntry);
+ }
+
+ return data[key];
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#remove
+ * @kind function
+ *
+ * @description
+ * Removes an entry from the {@link $cacheFactory.Cache Cache} object.
+ *
+ * @param {string} key the key of the entry to be removed
+ */
+ remove: function(key) {
+ if (capacity < Number.MAX_VALUE) {
+ var lruEntry = lruHash[key];
+
+ if (!lruEntry) return;
+
+ if (lruEntry == freshEnd) freshEnd = lruEntry.p;
+ if (lruEntry == staleEnd) staleEnd = lruEntry.n;
+ link(lruEntry.n,lruEntry.p);
+
+ delete lruHash[key];
+ }
+
+ if (!(key in data)) return;
+
+ delete data[key];
+ size--;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#removeAll
+ * @kind function
+ *
+ * @description
+ * Clears the cache object of any entries.
+ */
+ removeAll: function() {
+ data = createMap();
+ size = 0;
+ lruHash = createMap();
+ freshEnd = staleEnd = null;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#destroy
+ * @kind function
+ *
+ * @description
+ * Destroys the {@link $cacheFactory.Cache Cache} object entirely,
+ * removing it from the {@link $cacheFactory $cacheFactory} set.
+ */
+ destroy: function() {
+ data = null;
+ stats = null;
+ lruHash = null;
+ delete caches[cacheId];
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory.Cache#info
+ * @kind function
+ *
+ * @description
+ * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}.
+ *
+ * @returns {object} an object with the following properties:
+ * <ul>
+ * <li>**id**: the id of the cache instance</li>
+ * <li>**size**: the number of entries kept in the cache instance</li>
+ * <li>**...**: any additional properties from the options object when creating the
+ * cache.</li>
+ * </ul>
+ */
+ info: function() {
+ return extend({}, stats, {size: size});
+ }
+ };
+
+
+ /**
+ * makes the `entry` the freshEnd of the LRU linked list
+ */
+ function refresh(entry) {
+ if (entry != freshEnd) {
+ if (!staleEnd) {
+ staleEnd = entry;
+ } else if (staleEnd == entry) {
+ staleEnd = entry.n;
+ }
+
+ link(entry.n, entry.p);
+ link(entry, freshEnd);
+ freshEnd = entry;
+ freshEnd.n = null;
+ }
+ }
+
+
+ /**
+ * bidirectionally links two entries of the LRU linked list
+ */
+ function link(nextEntry, prevEntry) {
+ if (nextEntry != prevEntry) {
+ if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify
+ if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify
+ }
+ }
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory#info
+ *
+ * @description
+ * Get information about all the caches that have been created
+ *
+ * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info`
+ */
+ cacheFactory.info = function() {
+ var info = {};
+ forEach(caches, function(cache, cacheId) {
+ info[cacheId] = cache.info();
+ });
+ return info;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $cacheFactory#get
+ *
+ * @description
+ * Get access to a cache object by the `cacheId` used when it was created.
+ *
+ * @param {string} cacheId Name or id of a cache to access.
+ * @returns {object} Cache object identified by the cacheId or undefined if no such cache.
+ */
+ cacheFactory.get = function(cacheId) {
+ return caches[cacheId];
+ };
+
+
+ return cacheFactory;
+ };
+}
+
+/**
+ * @ngdoc service
+ * @name $templateCache
+ *
+ * @description
+ * The first time a template is used, it is loaded in the template cache for quick retrieval. You
+ * can load templates directly into the cache in a `script` tag, or by consuming the
+ * `$templateCache` service directly.
+ *
+ * Adding via the `script` tag:
+ *
+ * ```html
+ * <script type="text/ng-template" id="templateId.html">
+ * <p>This is the content of the template</p>
+ * </script>
+ * ```
+ *
+ * **Note:** the `script` tag containing the template does not need to be included in the `head` of
+ * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (IE,
+ * element with ng-app attribute), otherwise the template will be ignored.
+ *
+ * Adding via the `$templateCache` service:
+ *
+ * ```js
+ * var myApp = angular.module('myApp', []);
+ * myApp.run(function($templateCache) {
+ * $templateCache.put('templateId.html', 'This is the content of the template');
+ * });
+ * ```
+ *
+ * To retrieve the template later, simply use it in your HTML:
+ * ```html
+ * <div ng-include=" 'templateId.html' "></div>
+ * ```
+ *
+ * or get it via Javascript:
+ * ```js
+ * $templateCache.get('templateId.html')
+ * ```
+ *
+ * See {@link ng.$cacheFactory $cacheFactory}.
+ *
+ */
+function $TemplateCacheProvider() {
+ this.$get = ['$cacheFactory', function($cacheFactory) {
+ return $cacheFactory('templates');
+ }];
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!
+ *
+ * DOM-related variables:
+ *
+ * - "node" - DOM Node
+ * - "element" - DOM Element or Node
+ * - "$node" or "$element" - jqLite-wrapped node or element
+ *
+ *
+ * Compiler related stuff:
+ *
+ * - "linkFn" - linking fn of a single directive
+ * - "nodeLinkFn" - function that aggregates all linking fns for a particular node
+ * - "childLinkFn" - function that aggregates all linking fns for child nodes of a particular node
+ * - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList)
+ */
+
+
+/**
+ * @ngdoc service
+ * @name $compile
+ * @kind function
+ *
+ * @description
+ * Compiles an HTML string or DOM into a template and produces a template function, which
+ * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together.
+ *
+ * The compilation is a process of walking the DOM tree and matching DOM elements to
+ * {@link ng.$compileProvider#directive directives}.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** This document is an in-depth reference of all directive options.
+ * For a gentle introduction to directives with examples of common use cases,
+ * see the {@link guide/directive directive guide}.
+ * </div>
+ *
+ * ## Comprehensive Directive API
+ *
+ * There are many different options for a directive.
+ *
+ * The difference resides in the return value of the factory function.
+ * You can either return a "Directive Definition Object" (see below) that defines the directive properties,
+ * or just the `postLink` function (all other properties will have the default values).
+ *
+ * <div class="alert alert-success">
+ * **Best Practice:** It's recommended to use the "directive definition object" form.
+ * </div>
+ *
+ * Here's an example directive declared with a Directive Definition Object:
+ *
+ * ```js
+ * var myModule = angular.module(...);
+ *
+ * myModule.directive('directiveName', function factory(injectables) {
+ * var directiveDefinitionObject = {
+ * priority: 0,
+ * template: '<div></div>', // or // function(tElement, tAttrs) { ... },
+ * // or
+ * // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... },
+ * transclude: false,
+ * restrict: 'A',
+ * templateNamespace: 'html',
+ * scope: false,
+ * controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },
+ * controllerAs: 'stringIdentifier',
+ * bindToController: false,
+ * require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],
+ * compile: function compile(tElement, tAttrs, transclude) {
+ * return {
+ * pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ * post: function postLink(scope, iElement, iAttrs, controller) { ... }
+ * }
+ * // or
+ * // return function postLink( ... ) { ... }
+ * },
+ * // or
+ * // link: {
+ * // pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ * // post: function postLink(scope, iElement, iAttrs, controller) { ... }
+ * // }
+ * // or
+ * // link: function postLink( ... ) { ... }
+ * };
+ * return directiveDefinitionObject;
+ * });
+ * ```
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Any unspecified options will use the default value. You can see the default values below.
+ * </div>
+ *
+ * Therefore the above can be simplified as:
+ *
+ * ```js
+ * var myModule = angular.module(...);
+ *
+ * myModule.directive('directiveName', function factory(injectables) {
+ * var directiveDefinitionObject = {
+ * link: function postLink(scope, iElement, iAttrs) { ... }
+ * };
+ * return directiveDefinitionObject;
+ * // or
+ * // return function postLink(scope, iElement, iAttrs) { ... }
+ * });
+ * ```
+ *
+ *
+ *
+ * ### Directive Definition Object
+ *
+ * The directive definition object provides instructions to the {@link ng.$compile
+ * compiler}. The attributes are:
+ *
+ * #### `multiElement`
+ * When this property is set to true, the HTML compiler will collect DOM nodes between
+ * nodes with the attributes `directive-name-start` and `directive-name-end`, and group them
+ * together as the directive elements. It is recommended that this feature be used on directives
+ * which are not strictly behavioural (such as {@link ngClick}), and which
+ * do not manipulate or replace child nodes (such as {@link ngInclude}).
+ *
+ * #### `priority`
+ * When there are multiple directives defined on a single DOM element, sometimes it
+ * is necessary to specify the order in which the directives are applied. The `priority` is used
+ * to sort the directives before their `compile` functions get called. Priority is defined as a
+ * number. Directives with greater numerical `priority` are compiled first. Pre-link functions
+ * are also run in priority order, but post-link functions are run in reverse order. The order
+ * of directives with the same priority is undefined. The default priority is `0`.
+ *
+ * #### `terminal`
+ * If set to true then the current `priority` will be the last set of directives
+ * which will execute (any directives at the current priority will still execute
+ * as the order of execution on same `priority` is undefined). Note that expressions
+ * and other directives used in the directive's template will also be excluded from execution.
+ *
+ * #### `scope`
+ * The scope property can be `true`, an object or a falsy value:
+ *
+ * * **falsy:** No scope will be created for the directive. The directive will use its parent's scope.
+ *
+ * * **`true`:** A new child scope that prototypically inherits from its parent will be created for
+ * the directive's element. If multiple directives on the same element request a new scope,
+ * only one new scope is created. The new scope rule does not apply for the root of the template
+ * since the root of the template always gets a new scope.
+ *
+ * * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's element. The
+ * 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent
+ * scope. This is useful when creating reusable components, which should not accidentally read or modify
+ * data in the parent scope.
+ *
+ * The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the
+ * directive's element. These local properties are useful for aliasing values for templates. The keys in
+ * the object hash map to the name of the property on the isolate scope; the values define how the property
+ * is bound to the parent scope, via matching attributes on the directive's element:
+ *
+ * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is
+ * always a string since DOM attributes are strings. If no `attr` name is specified then the
+ * attribute name is assumed to be the same as the local name.
+ * Given `<widget my-attr="hello {{name}}">` and widget definition
+ * of `scope: { localName:'@myAttr' }`, then widget scope property `localName` will reflect
+ * the interpolated value of `hello {{name}}`. As the `name` attribute changes so will the
+ * `localName` property on the widget scope. The `name` is read from the parent scope (not
+ * component scope).
+ *
+ * * `=` or `=attr` - set up bi-directional binding between a local scope property and the
+ * parent scope property of name defined via the value of the `attr` attribute. If no `attr`
+ * name is specified then the attribute name is assumed to be the same as the local name.
+ * Given `<widget my-attr="parentModel">` and widget definition of
+ * `scope: { localModel:'=myAttr' }`, then widget scope property `localModel` will reflect the
+ * value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected
+ * in `localModel` and any changes in `localModel` will reflect in `parentModel`. If the parent
+ * scope property doesn't exist, it will throw a NON_ASSIGNABLE_MODEL_EXPRESSION exception. You
+ * can avoid this behavior using `=?` or `=?attr` in order to flag the property as optional. If
+ * you want to shallow watch for changes (i.e. $watchCollection instead of $watch) you can use
+ * `=*` or `=*attr` (`=*?` or `=*?attr` if the property is optional).
+ *
+ * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope.
+ * If no `attr` name is specified then the attribute name is assumed to be the same as the
+ * local name. Given `<widget my-attr="count = count + value">` and widget definition of
+ * `scope: { localFn:'&myAttr' }`, then isolate scope property `localFn` will point to
+ * a function wrapper for the `count = count + value` expression. Often it's desirable to
+ * pass data from the isolated scope via an expression to the parent scope, this can be
+ * done by passing a map of local variable names and values into the expression wrapper fn.
+ * For example, if the expression is `increment(amount)` then we can specify the amount value
+ * by calling the `localFn` as `localFn({amount: 22})`.
+ *
+ * In general it's possible to apply more than one directive to one element, but there might be limitations
+ * depending on the type of scope required by the directives. The following points will help explain these limitations.
+ * For simplicity only two directives are taken into account, but it is also applicable for several directives:
+ *
+ * * **no scope** + **no scope** => Two directives which don't require their own scope will use their parent's scope
+ * * **child scope** + **no scope** => Both directives will share one single child scope
+ * * **child scope** + **child scope** => Both directives will share one single child scope
+ * * **isolated scope** + **no scope** => The isolated directive will use it's own created isolated scope. The other directive will use
+ * its parent's scope
+ * * **isolated scope** + **child scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives cannot
+ * be applied to the same element.
+ * * **isolated scope** + **isolated scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives
+ * cannot be applied to the same element.
+ *
+ *
+ * #### `bindToController`
+ * When an isolate scope is used for a component (see above), and `controllerAs` is used, `bindToController: true` will
+ * allow a component to have its properties bound to the controller, rather than to scope. When the controller
+ * is instantiated, the initial values of the isolate scope bindings are already available.
+ *
+ * #### `controller`
+ * Controller constructor function. The controller is instantiated before the
+ * pre-linking phase and can be accessed by other directives (see
+ * `require` attribute). This allows the directives to communicate with each other and augment
+ * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals:
+ *
+ * * `$scope` - Current scope associated with the element
+ * * `$element` - Current element
+ * * `$attrs` - Current attributes object for the element
+ * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope:
+ * `function([scope], cloneLinkingFn, futureParentElement)`.
+ * * `scope`: optional argument to override the scope.
+ * * `cloneLinkingFn`: optional argument to create clones of the original transcluded content.
+ * * `futureParentElement`:
+ * * defines the parent to which the `cloneLinkingFn` will add the cloned elements.
+ * * default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`.
+ * * only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements)
+ * and when the `cloneLinkinFn` is passed,
+ * as those elements need to created and cloned in a special way when they are defined outside their
+ * usual containers (e.g. like `<svg>`).
+ * * See also the `directive.templateNamespace` property.
+ *
+ *
+ * #### `require`
+ * Require another directive and inject its controller as the fourth argument to the linking function. The
+ * `require` takes a string name (or array of strings) of the directive(s) to pass in. If an array is used, the
+ * injected argument will be an array in corresponding order. If no such directive can be
+ * found, or if the directive does not have a controller, then an error is raised (unless no link function
+ * is specified, in which case error checking is skipped). The name can be prefixed with:
+ *
+ * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.
+ * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.
+ * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found.
+ * * `^^` - Locate the required controller by searching the element's parents. Throw an error if not found.
+ * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass
+ * `null` to the `link` fn if not found.
+ * * `?^^` - Attempt to locate the required controller by searching the element's parents, or pass
+ * `null` to the `link` fn if not found.
+ *
+ *
+ * #### `controllerAs`
+ * Identifier name for a reference to the controller in the directive's scope.
+ * This allows the controller to be referenced from the directive template. This is especially
+ * useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible
+ * to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the
+ * `controllerAs` reference might overwrite a property that already exists on the parent scope.
+ *
+ *
+ * #### `restrict`
+ * String of subset of `EACM` which restricts the directive to a specific directive
+ * declaration style. If omitted, the defaults (elements and attributes) are used.
+ *
+ * * `E` - Element name (default): `<my-directive></my-directive>`
+ * * `A` - Attribute (default): `<div my-directive="exp"></div>`
+ * * `C` - Class: `<div class="my-directive: exp;"></div>`
+ * * `M` - Comment: `<!-- directive: my-directive exp -->`
+ *
+ *
+ * #### `templateNamespace`
+ * String representing the document type used by the markup in the template.
+ * AngularJS needs this information as those elements need to be created and cloned
+ * in a special way when they are defined outside their usual containers like `<svg>` and `<math>`.
+ *
+ * * `html` - All root nodes in the template are HTML. Root nodes may also be
+ * top-level elements such as `<svg>` or `<math>`.
+ * * `svg` - The root nodes in the template are SVG elements (excluding `<math>`).
+ * * `math` - The root nodes in the template are MathML elements (excluding `<svg>`).
+ *
+ * If no `templateNamespace` is specified, then the namespace is considered to be `html`.
+ *
+ * #### `template`
+ * HTML markup that may:
+ * * Replace the contents of the directive's element (default).
+ * * Replace the directive's element itself (if `replace` is true - DEPRECATED).
+ * * Wrap the contents of the directive's element (if `transclude` is true).
+ *
+ * Value may be:
+ *
+ * * A string. For example `<div red-on-hover>{{delete_str}}</div>`.
+ * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile`
+ * function api below) and returns a string value.
+ *
+ *
+ * #### `templateUrl`
+ * This is similar to `template` but the template is loaded from the specified URL, asynchronously.
+ *
+ * Because template loading is asynchronous the compiler will suspend compilation of directives on that element
+ * for later when the template has been resolved. In the meantime it will continue to compile and link
+ * sibling and parent elements as though this element had not contained any directives.
+ *
+ * The compiler does not suspend the entire compilation to wait for templates to be loaded because this
+ * would result in the whole app "stalling" until all templates are loaded asynchronously - even in the
+ * case when only one deeply nested directive has `templateUrl`.
+ *
+ * Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}
+ *
+ * You can specify `templateUrl` as a string representing the URL or as a function which takes two
+ * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns
+ * a string value representing the url. In either case, the template URL is passed through {@link
+ * $sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}.
+ *
+ *
+ * #### `replace` ([*DEPRECATED*!], will be removed in next major release - i.e. v2.0)
+ * specify what the template should replace. Defaults to `false`.
+ *
+ * * `true` - the template will replace the directive's element.
+ * * `false` - the template will replace the contents of the directive's element.
+ *
+ * The replacement process migrates all of the attributes / classes from the old element to the new
+ * one. See the {@link guide/directive#template-expanding-directive
+ * Directives Guide} for an example.
+ *
+ * There are very few scenarios where element replacement is required for the application function,
+ * the main one being reusable custom components that are used within SVG contexts
+ * (because SVG doesn't work with custom elements in the DOM tree).
+ *
+ * #### `transclude`
+ * Extract the contents of the element where the directive appears and make it available to the directive.
+ * The contents are compiled and provided to the directive as a **transclusion function**. See the
+ * {@link $compile#transclusion Transclusion} section below.
+ *
+ * There are two kinds of transclusion depending upon whether you want to transclude just the contents of the
+ * directive's element or the entire element:
+ *
+ * * `true` - transclude the content (i.e. the child nodes) of the directive's element.
+ * * `'element'` - transclude the whole of the directive's element including any directives on this
+ * element that defined at a lower priority than this directive. When used, the `template`
+ * property is ignored.
+ *
+ *
+ * #### `compile`
+ *
+ * ```js
+ * function compile(tElement, tAttrs, transclude) { ... }
+ * ```
+ *
+ * The compile function deals with transforming the template DOM. Since most directives do not do
+ * template transformation, it is not used often. The compile function takes the following arguments:
+ *
+ * * `tElement` - template element - The element where the directive has been declared. It is
+ * safe to do template transformation on the element and child elements only.
+ *
+ * * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared
+ * between all directive compile functions.
+ *
+ * * `transclude` - [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`
+ *
+ * <div class="alert alert-warning">
+ * **Note:** The template instance and the link instance may be different objects if the template has
+ * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that
+ * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration
+ * should be done in a linking function rather than in a compile function.
+ * </div>
+
+ * <div class="alert alert-warning">
+ * **Note:** The compile function cannot handle directives that recursively use themselves in their
+ * own templates or compile functions. Compiling these directives results in an infinite loop and a
+ * stack overflow errors.
+ *
+ * This can be avoided by manually using $compile in the postLink function to imperatively compile
+ * a directive's template instead of relying on automatic template compilation via `template` or
+ * `templateUrl` declaration or manual compilation inside the compile function.
+ * </div>
+ *
+ * <div class="alert alert-danger">
+ * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it
+ * e.g. does not know about the right outer scope. Please use the transclude function that is passed
+ * to the link function instead.
+ * </div>
+
+ * A compile function can have a return value which can be either a function or an object.
+ *
+ * * returning a (post-link) function - is equivalent to registering the linking function via the
+ * `link` property of the config object when the compile function is empty.
+ *
+ * * returning an object with function(s) registered via `pre` and `post` properties - allows you to
+ * control when a linking function should be called during the linking phase. See info about
+ * pre-linking and post-linking functions below.
+ *
+ *
+ * #### `link`
+ * This property is used only if the `compile` property is not defined.
+ *
+ * ```js
+ * function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }
+ * ```
+ *
+ * The link function is responsible for registering DOM listeners as well as updating the DOM. It is
+ * executed after the template has been cloned. This is where most of the directive logic will be
+ * put.
+ *
+ * * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the
+ * directive for registering {@link ng.$rootScope.Scope#$watch watches}.
+ *
+ * * `iElement` - instance element - The element where the directive is to be used. It is safe to
+ * manipulate the children of the element only in `postLink` function since the children have
+ * already been linked.
+ *
+ * * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared
+ * between all directive linking functions.
+ *
+ * * `controller` - the directive's required controller instance(s) - Instances are shared
+ * among all directives, which allows the directives to use the controllers as a communication
+ * channel. The exact value depends on the directive's `require` property:
+ * * no controller(s) required: the directive's own controller, or `undefined` if it doesn't have one
+ * * `string`: the controller instance
+ * * `array`: array of controller instances
+ *
+ * If a required controller cannot be found, and it is optional, the instance is `null`,
+ * otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown.
+ *
+ * Note that you can also require the directive's own controller - it will be made available like
+ * any other controller.
+ *
+ * * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.
+ * This is the same as the `$transclude`
+ * parameter of directive controllers, see there for details.
+ * `function([scope], cloneLinkingFn, futureParentElement)`.
+ *
+ * #### Pre-linking function
+ *
+ * Executed before the child elements are linked. Not safe to do DOM transformation since the
+ * compiler linking function will fail to locate the correct elements for linking.
+ *
+ * #### Post-linking function
+ *
+ * Executed after the child elements are linked.
+ *
+ * Note that child elements that contain `templateUrl` directives will not have been compiled
+ * and linked since they are waiting for their template to load asynchronously and their own
+ * compilation and linking has been suspended until that occurs.
+ *
+ * It is safe to do DOM transformation in the post-linking function on elements that are not waiting
+ * for their async templates to be resolved.
+ *
+ *
+ * ### Transclusion
+ *
+ * Transclusion is the process of extracting a collection of DOM elements from one part of the DOM and
+ * copying them to another part of the DOM, while maintaining their connection to the original AngularJS
+ * scope from where they were taken.
+ *
+ * Transclusion is used (often with {@link ngTransclude}) to insert the
+ * original contents of a directive's element into a specified place in the template of the directive.
+ * The benefit of transclusion, over simply moving the DOM elements manually, is that the transcluded
+ * content has access to the properties on the scope from which it was taken, even if the directive
+ * has isolated scope.
+ * See the {@link guide/directive#creating-a-directive-that-wraps-other-elements Directives Guide}.
+ *
+ * This makes it possible for the widget to have private state for its template, while the transcluded
+ * content has access to its originating scope.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** When testing an element transclude directive you must not place the directive at the root of the
+ * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives
+ * Testing Transclusion Directives}.
+ * </div>
+ *
+ * #### Transclusion Functions
+ *
+ * When a directive requests transclusion, the compiler extracts its contents and provides a **transclusion
+ * function** to the directive's `link` function and `controller`. This transclusion function is a special
+ * **linking function** that will return the compiled contents linked to a new transclusion scope.
+ *
+ * <div class="alert alert-info">
+ * If you are just using {@link ngTransclude} then you don't need to worry about this function, since
+ * ngTransclude will deal with it for us.
+ * </div>
+ *
+ * If you want to manually control the insertion and removal of the transcluded content in your directive
+ * then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery
+ * object that contains the compiled DOM, which is linked to the correct transclusion scope.
+ *
+ * When you call a transclusion function you can pass in a **clone attach function**. This function accepts
+ * two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded
+ * content and the `scope` is the newly created transclusion scope, to which the clone is bound.
+ *
+ * <div class="alert alert-info">
+ * **Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a translude function
+ * since you then get a fresh clone of the original DOM and also have access to the new transclusion scope.
+ * </div>
+ *
+ * It is normal practice to attach your transcluded content (`clone`) to the DOM inside your **clone
+ * attach function**:
+ *
+ * ```js
+ * var transcludedContent, transclusionScope;
+ *
+ * $transclude(function(clone, scope) {
+ * element.append(clone);
+ * transcludedContent = clone;
+ * transclusionScope = scope;
+ * });
+ * ```
+ *
+ * Later, if you want to remove the transcluded content from your DOM then you should also destroy the
+ * associated transclusion scope:
+ *
+ * ```js
+ * transcludedContent.remove();
+ * transclusionScope.$destroy();
+ * ```
+ *
+ * <div class="alert alert-info">
+ * **Best Practice**: if you intend to add and remove transcluded content manually in your directive
+ * (by calling the transclude function to get the DOM and calling `element.remove()` to remove it),
+ * then you are also responsible for calling `$destroy` on the transclusion scope.
+ * </div>
+ *
+ * The built-in DOM manipulation directives, such as {@link ngIf}, {@link ngSwitch} and {@link ngRepeat}
+ * automatically destroy their transluded clones as necessary so you do not need to worry about this if
+ * you are simply using {@link ngTransclude} to inject the transclusion into your directive.
+ *
+ *
+ * #### Transclusion Scopes
+ *
+ * When you call a transclude function it returns a DOM fragment that is pre-bound to a **transclusion
+ * scope**. This scope is special, in that it is a child of the directive's scope (and so gets destroyed
+ * when the directive's scope gets destroyed) but it inherits the properties of the scope from which it
+ * was taken.
+ *
+ * For example consider a directive that uses transclusion and isolated scope. The DOM hierarchy might look
+ * like this:
+ *
+ * ```html
+ * <div ng-app>
+ * <div isolate>
+ * <div transclusion>
+ * </div>
+ * </div>
+ * </div>
+ * ```
+ *
+ * The `$parent` scope hierarchy will look like this:
+ *
+ * ```
+ * - $rootScope
+ * - isolate
+ * - transclusion
+ * ```
+ *
+ * but the scopes will inherit prototypically from different scopes to their `$parent`.
+ *
+ * ```
+ * - $rootScope
+ * - transclusion
+ * - isolate
+ * ```
+ *
+ *
+ * ### Attributes
+ *
+ * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the
+ * `link()` or `compile()` functions. It has a variety of uses.
+ *
+ * accessing *Normalized attribute names:*
+ * Directives like 'ngBind' can be expressed in many ways: 'ng:bind', `data-ng-bind`, or 'x-ng-bind'.
+ * the attributes object allows for normalized access to
+ * the attributes.
+ *
+ * * *Directive inter-communication:* All directives share the same instance of the attributes
+ * object which allows the directives to use the attributes object as inter directive
+ * communication.
+ *
+ * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object
+ * allowing other directives to read the interpolated value.
+ *
+ * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes
+ * that contain interpolation (e.g. `src="{{bar}}"`). Not only is this very efficient but it's also
+ * the only way to easily get the actual value because during the linking phase the interpolation
+ * hasn't been evaluated yet and so the value is at this time set to `undefined`.
+ *
+ * ```js
+ * function linkingFn(scope, elm, attrs, ctrl) {
+ * // get the attribute value
+ * console.log(attrs.ngModel);
+ *
+ * // change the attribute
+ * attrs.$set('ngModel', 'new value');
+ *
+ * // observe changes to interpolated attribute
+ * attrs.$observe('ngModel', function(value) {
+ * console.log('ngModel has changed value to ' + value);
+ * });
+ * }
+ * ```
+ *
+ * ## Example
+ *
+ * <div class="alert alert-warning">
+ * **Note**: Typically directives are registered with `module.directive`. The example below is
+ * to illustrate how `$compile` works.
+ * </div>
+ *
+ <example module="compileExample">
+ <file name="index.html">
+ <script>
+ angular.module('compileExample', [], function($compileProvider) {
+ // configure new 'compile' directive by passing a directive
+ // factory function. The factory function injects the '$compile'
+ $compileProvider.directive('compile', function($compile) {
+ // directive factory creates a link function
+ return function(scope, element, attrs) {
+ scope.$watch(
+ function(scope) {
+ // watch the 'compile' expression for changes
+ return scope.$eval(attrs.compile);
+ },
+ function(value) {
+ // when the 'compile' expression changes
+ // assign it into the current DOM
+ element.html(value);
+
+ // compile the new DOM and link it to the current
+ // scope.
+ // NOTE: we only compile .childNodes so that
+ // we don't get into infinite loop compiling ourselves
+ $compile(element.contents())(scope);
+ }
+ );
+ };
+ });
+ })
+ .controller('GreeterController', ['$scope', function($scope) {
+ $scope.name = 'Angular';
+ $scope.html = 'Hello {{name}}';
+ }]);
+ </script>
+ <div ng-controller="GreeterController">
+ <input ng-model="name"> <br/>
+ <textarea ng-model="html"></textarea> <br/>
+ <div compile="html"></div>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should auto compile', function() {
+ var textarea = $('textarea');
+ var output = $('div[compile]');
+ // The initial state reads 'Hello Angular'.
+ expect(output.getText()).toBe('Hello Angular');
+ textarea.clear();
+ textarea.sendKeys('{{name}}!');
+ expect(output.getText()).toBe('Angular!');
+ });
+ </file>
+ </example>
+
+ *
+ *
+ * @param {string|DOMElement} element Element or HTML string to compile into a template function.
+ * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives - DEPRECATED.
+ *
+ * <div class="alert alert-danger">
+ * **Note:** Passing a `transclude` function to the $compile function is deprecated, as it
+ * e.g. will not use the right outer scope. Please pass the transclude function as a
+ * `parentBoundTranscludeFn` to the link function instead.
+ * </div>
+ *
+ * @param {number} maxPriority only apply directives lower than given priority (Only effects the
+ * root element(s), not their children)
+ * @returns {function(scope, cloneAttachFn=, options=)} a link function which is used to bind template
+ * (a DOM element/tree) to a scope. Where:
+ *
+ * * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.
+ * * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the
+ * `template` and call the `cloneAttachFn` function allowing the caller to attach the
+ * cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is
+ * called as: <br/> `cloneAttachFn(clonedElement, scope)` where:
+ *
+ * * `clonedElement` - is a clone of the original `element` passed into the compiler.
+ * * `scope` - is the current scope with which the linking function is working with.
+ *
+ * * `options` - An optional object hash with linking options. If `options` is provided, then the following
+ * keys may be used to control linking behavior:
+ *
+ * * `parentBoundTranscludeFn` - the transclude function made available to
+ * directives; if given, it will be passed through to the link functions of
+ * directives found in `element` during compilation.
+ * * `transcludeControllers` - an object hash with keys that map controller names
+ * to controller instances; if given, it will make the controllers
+ * available to directives.
+ * * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add
+ * the cloned elements; only needed for transcludes that are allowed to contain non html
+ * elements (e.g. SVG elements). See also the directive.controller property.
+ *
+ * Calling the linking function returns the element of the template. It is either the original
+ * element passed in, or the clone of the element if the `cloneAttachFn` is provided.
+ *
+ * After linking the view is not updated until after a call to $digest which typically is done by
+ * Angular automatically.
+ *
+ * If you need access to the bound view, there are two ways to do it:
+ *
+ * - If you are not asking the linking function to clone the template, create the DOM element(s)
+ * before you send them to the compiler and keep this reference around.
+ * ```js
+ * var element = $compile('<p>{{total}}</p>')(scope);
+ * ```
+ *
+ * - if on the other hand, you need the element to be cloned, the view reference from the original
+ * example would not point to the clone, but rather to the original template that was cloned. In
+ * this case, you can access the clone via the cloneAttachFn:
+ * ```js
+ * var templateElement = angular.element('<p>{{total}}</p>'),
+ * scope = ....;
+ *
+ * var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {
+ * //attach the clone to DOM document at the right place
+ * });
+ *
+ * //now we have reference to the cloned DOM via `clonedElement`
+ * ```
+ *
+ *
+ * For information on how the compiler works, see the
+ * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.
+ */
+
+var $compileMinErr = minErr('$compile');
+
+/**
+ * @ngdoc provider
+ * @name $compileProvider
+ *
+ * @description
+ */
+$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
+function $CompileProvider($provide, $$sanitizeUriProvider) {
+ var hasDirectives = {},
+ Suffix = 'Directive',
+ COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\w\-]+)\s+(.*)$/,
+ CLASS_DIRECTIVE_REGEXP = /(([\w\-]+)(?:\:([^;]+))?;?)/,
+ ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),
+ REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/;
+
+ // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes
+ // The assumption is that future DOM event attribute names will begin with
+ // 'on' and be composed of only English letters.
+ var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
+
+ function parseIsolateBindings(scope, directiveName, isController) {
+ var LOCAL_REGEXP = /^\s*([@&]|=(\*?))(\??)\s*(\w*)\s*$/;
+
+ var bindings = {};
+
+ forEach(scope, function(definition, scopeName) {
+ var match = definition.match(LOCAL_REGEXP);
+
+ if (!match) {
+ throw $compileMinErr('iscp',
+ "Invalid {3} for directive '{0}'." +
+ " Definition: {... {1}: '{2}' ...}",
+ directiveName, scopeName, definition,
+ (isController ? "controller bindings definition" :
+ "isolate scope definition"));
+ }
+
+ bindings[scopeName] = {
+ mode: match[1][0],
+ collection: match[2] === '*',
+ optional: match[3] === '?',
+ attrName: match[4] || scopeName
+ };
+ });
+
+ return bindings;
+ }
+
+ function parseDirectiveBindings(directive, directiveName) {
+ var bindings = {
+ isolateScope: null,
+ bindToController: null
+ };
+ if (isObject(directive.scope)) {
+ if (directive.bindToController === true) {
+ bindings.bindToController = parseIsolateBindings(directive.scope,
+ directiveName, true);
+ bindings.isolateScope = {};
+ } else {
+ bindings.isolateScope = parseIsolateBindings(directive.scope,
+ directiveName, false);
+ }
+ }
+ if (isObject(directive.bindToController)) {
+ bindings.bindToController =
+ parseIsolateBindings(directive.bindToController, directiveName, true);
+ }
+ if (isObject(bindings.bindToController)) {
+ var controller = directive.controller;
+ var controllerAs = directive.controllerAs;
+ if (!controller) {
+ // There is no controller, there may or may not be a controllerAs property
+ throw $compileMinErr('noctrl',
+ "Cannot bind to controller without directive '{0}'s controller.",
+ directiveName);
+ } else if (!identifierForController(controller, controllerAs)) {
+ // There is a controller, but no identifier or controllerAs property
+ throw $compileMinErr('noident',
+ "Cannot bind to controller without identifier for directive '{0}'.",
+ directiveName);
+ }
+ }
+ return bindings;
+ }
+
+ function assertValidDirectiveName(name) {
+ var letter = name.charAt(0);
+ if (!letter || letter !== lowercase(letter)) {
+ throw $compileMinErr('baddir', "Directive name '{0}' is invalid. The first character must be a lowercase letter", name);
+ }
+ if (name !== name.trim()) {
+ throw $compileMinErr('baddir',
+ "Directive name '{0}' is invalid. The name should not contain leading or trailing whitespaces",
+ name);
+ }
+ }
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#directive
+ * @kind function
+ *
+ * @description
+ * Register a new directive with the compiler.
+ *
+ * @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which
+ * will match as <code>ng-bind</code>), or an object map of directives where the keys are the
+ * names and the values are the factories.
+ * @param {Function|Array} directiveFactory An injectable directive factory function. See
+ * {@link guide/directive} for more info.
+ * @returns {ng.$compileProvider} Self for chaining.
+ */
+ this.directive = function registerDirective(name, directiveFactory) {
+ assertNotHasOwnProperty(name, 'directive');
+ if (isString(name)) {
+ assertValidDirectiveName(name);
+ assertArg(directiveFactory, 'directiveFactory');
+ if (!hasDirectives.hasOwnProperty(name)) {
+ hasDirectives[name] = [];
+ $provide.factory(name + Suffix, ['$injector', '$exceptionHandler',
+ function($injector, $exceptionHandler) {
+ var directives = [];
+ forEach(hasDirectives[name], function(directiveFactory, index) {
+ try {
+ var directive = $injector.invoke(directiveFactory);
+ if (isFunction(directive)) {
+ directive = { compile: valueFn(directive) };
+ } else if (!directive.compile && directive.link) {
+ directive.compile = valueFn(directive.link);
+ }
+ directive.priority = directive.priority || 0;
+ directive.index = index;
+ directive.name = directive.name || name;
+ directive.require = directive.require || (directive.controller && directive.name);
+ directive.restrict = directive.restrict || 'EA';
+ var bindings = directive.$$bindings =
+ parseDirectiveBindings(directive, directive.name);
+ if (isObject(bindings.isolateScope)) {
+ directive.$$isolateBindings = bindings.isolateScope;
+ }
+ directive.$$moduleName = directiveFactory.$$moduleName;
+ directives.push(directive);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ });
+ return directives;
+ }]);
+ }
+ hasDirectives[name].push(directiveFactory);
+ } else {
+ forEach(name, reverseParams(registerDirective));
+ }
+ return this;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#aHrefSanitizationWhitelist
+ * @kind function
+ *
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during a[href] sanitization.
+ *
+ * The sanitization is a security measure aimed at preventing XSS attacks via html links.
+ *
+ * Any url about to be assigned to a[href] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.aHrefSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp);
+ return this;
+ } else {
+ return $$sanitizeUriProvider.aHrefSanitizationWhitelist();
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#imgSrcSanitizationWhitelist
+ * @kind function
+ *
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during img[src] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to img[src] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.imgSrcSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp);
+ return this;
+ } else {
+ return $$sanitizeUriProvider.imgSrcSanitizationWhitelist();
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $compileProvider#debugInfoEnabled
+ *
+ * @param {boolean=} enabled update the debugInfoEnabled state if provided, otherwise just return the
+ * current debugInfoEnabled state
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ *
+ * @kind function
+ *
+ * @description
+ * Call this method to enable/disable various debug runtime information in the compiler such as adding
+ * binding information and a reference to the current scope on to DOM elements.
+ * If enabled, the compiler will add the following to DOM elements that have been bound to the scope
+ * * `ng-binding` CSS class
+ * * `$binding` data property containing an array of the binding expressions
+ *
+ * You may want to disable this in production for a significant performance boost. See
+ * {@link guide/production#disabling-debug-data Disabling Debug Data} for more.
+ *
+ * The default value is true.
+ */
+ var debugInfoEnabled = true;
+ this.debugInfoEnabled = function(enabled) {
+ if (isDefined(enabled)) {
+ debugInfoEnabled = enabled;
+ return this;
+ }
+ return debugInfoEnabled;
+ };
+
+ this.$get = [
+ '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse',
+ '$controller', '$rootScope', '$document', '$sce', '$animate', '$$sanitizeUri',
+ function($injector, $interpolate, $exceptionHandler, $templateRequest, $parse,
+ $controller, $rootScope, $document, $sce, $animate, $$sanitizeUri) {
+
+ var Attributes = function(element, attributesToCopy) {
+ if (attributesToCopy) {
+ var keys = Object.keys(attributesToCopy);
+ var i, l, key;
+
+ for (i = 0, l = keys.length; i < l; i++) {
+ key = keys[i];
+ this[key] = attributesToCopy[key];
+ }
+ } else {
+ this.$attr = {};
+ }
+
+ this.$$element = element;
+ };
+
+ Attributes.prototype = {
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$normalize
+ * @kind function
+ *
+ * @description
+ * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or
+ * `data-`) to its normalized, camelCase form.
+ *
+ * Also there is special case for Moz prefix starting with upper case letter.
+ *
+ * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}
+ *
+ * @param {string} name Name to normalize
+ */
+ $normalize: directiveNormalize,
+
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$addClass
+ * @kind function
+ *
+ * @description
+ * Adds the CSS class value specified by the classVal parameter to the element. If animations
+ * are enabled then an animation will be triggered for the class addition.
+ *
+ * @param {string} classVal The className value that will be added to the element
+ */
+ $addClass: function(classVal) {
+ if (classVal && classVal.length > 0) {
+ $animate.addClass(this.$$element, classVal);
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$removeClass
+ * @kind function
+ *
+ * @description
+ * Removes the CSS class value specified by the classVal parameter from the element. If
+ * animations are enabled then an animation will be triggered for the class removal.
+ *
+ * @param {string} classVal The className value that will be removed from the element
+ */
+ $removeClass: function(classVal) {
+ if (classVal && classVal.length > 0) {
+ $animate.removeClass(this.$$element, classVal);
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$updateClass
+ * @kind function
+ *
+ * @description
+ * Adds and removes the appropriate CSS class values to the element based on the difference
+ * between the new and old CSS class values (specified as newClasses and oldClasses).
+ *
+ * @param {string} newClasses The current CSS className value
+ * @param {string} oldClasses The former CSS className value
+ */
+ $updateClass: function(newClasses, oldClasses) {
+ var toAdd = tokenDifference(newClasses, oldClasses);
+ if (toAdd && toAdd.length) {
+ $animate.addClass(this.$$element, toAdd);
+ }
+
+ var toRemove = tokenDifference(oldClasses, newClasses);
+ if (toRemove && toRemove.length) {
+ $animate.removeClass(this.$$element, toRemove);
+ }
+ },
+
+ /**
+ * Set a normalized attribute on the element in a way such that all directives
+ * can share the attribute. This function properly handles boolean attributes.
+ * @param {string} key Normalized key. (ie ngAttribute)
+ * @param {string|boolean} value The value to set. If `null` attribute will be deleted.
+ * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.
+ * Defaults to true.
+ * @param {string=} attrName Optional none normalized name. Defaults to key.
+ */
+ $set: function(key, value, writeAttr, attrName) {
+ // TODO: decide whether or not to throw an error if "class"
+ //is set through this function since it may cause $updateClass to
+ //become unstable.
+
+ var node = this.$$element[0],
+ booleanKey = getBooleanAttrName(node, key),
+ aliasedKey = getAliasedAttrName(key),
+ observer = key,
+ nodeName;
+
+ if (booleanKey) {
+ this.$$element.prop(key, value);
+ attrName = booleanKey;
+ } else if (aliasedKey) {
+ this[aliasedKey] = value;
+ observer = aliasedKey;
+ }
+
+ this[key] = value;
+
+ // translate normalized key to actual key
+ if (attrName) {
+ this.$attr[key] = attrName;
+ } else {
+ attrName = this.$attr[key];
+ if (!attrName) {
+ this.$attr[key] = attrName = snake_case(key, '-');
+ }
+ }
+
+ nodeName = nodeName_(this.$$element);
+
+ if ((nodeName === 'a' && (key === 'href' || key === 'xlinkHref')) ||
+ (nodeName === 'img' && key === 'src')) {
+ // sanitize a[href] and img[src] values
+ this[key] = value = $$sanitizeUri(value, key === 'src');
+ } else if (nodeName === 'img' && key === 'srcset') {
+ // sanitize img[srcset] values
+ var result = "";
+
+ // first check if there are spaces because it's not the same pattern
+ var trimmedSrcset = trim(value);
+ // ( 999x ,| 999w ,| ,|, )
+ var srcPattern = /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/;
+ var pattern = /\s/.test(trimmedSrcset) ? srcPattern : /(,)/;
+
+ // split srcset into tuple of uri and descriptor except for the last item
+ var rawUris = trimmedSrcset.split(pattern);
+
+ // for each tuples
+ var nbrUrisWith2parts = Math.floor(rawUris.length / 2);
+ for (var i = 0; i < nbrUrisWith2parts; i++) {
+ var innerIdx = i * 2;
+ // sanitize the uri
+ result += $$sanitizeUri(trim(rawUris[innerIdx]), true);
+ // add the descriptor
+ result += (" " + trim(rawUris[innerIdx + 1]));
+ }
+
+ // split the last item into uri and descriptor
+ var lastTuple = trim(rawUris[i * 2]).split(/\s/);
+
+ // sanitize the last uri
+ result += $$sanitizeUri(trim(lastTuple[0]), true);
+
+ // and add the last descriptor if any
+ if (lastTuple.length === 2) {
+ result += (" " + trim(lastTuple[1]));
+ }
+ this[key] = value = result;
+ }
+
+ if (writeAttr !== false) {
+ if (value === null || isUndefined(value)) {
+ this.$$element.removeAttr(attrName);
+ } else {
+ this.$$element.attr(attrName, value);
+ }
+ }
+
+ // fire observers
+ var $$observers = this.$$observers;
+ $$observers && forEach($$observers[observer], function(fn) {
+ try {
+ fn(value);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ });
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$observe
+ * @kind function
+ *
+ * @description
+ * Observes an interpolated attribute.
+ *
+ * The observer function will be invoked once during the next `$digest` following
+ * compilation. The observer is then invoked whenever the interpolated value
+ * changes.
+ *
+ * @param {string} key Normalized key. (ie ngAttribute) .
+ * @param {function(interpolatedValue)} fn Function that will be called whenever
+ the interpolated value of the attribute changes.
+ * See the {@link guide/directive#text-and-attribute-bindings Directives} guide for more info.
+ * @returns {function()} Returns a deregistration function for this observer.
+ */
+ $observe: function(key, fn) {
+ var attrs = this,
+ $$observers = (attrs.$$observers || (attrs.$$observers = createMap())),
+ listeners = ($$observers[key] || ($$observers[key] = []));
+
+ listeners.push(fn);
+ $rootScope.$evalAsync(function() {
+ if (!listeners.$$inter && attrs.hasOwnProperty(key) && !isUndefined(attrs[key])) {
+ // no one registered attribute interpolation function, so lets call it manually
+ fn(attrs[key]);
+ }
+ });
+
+ return function() {
+ arrayRemove(listeners, fn);
+ };
+ }
+ };
+
+
+ function safeAddClass($element, className) {
+ try {
+ $element.addClass(className);
+ } catch (e) {
+ // ignore, since it means that we are trying to set class on
+ // SVG element, where class name is read-only.
+ }
+ }
+
+
+ var startSymbol = $interpolate.startSymbol(),
+ endSymbol = $interpolate.endSymbol(),
+ denormalizeTemplate = (startSymbol == '{{' || endSymbol == '}}')
+ ? identity
+ : function denormalizeTemplate(template) {
+ return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
+ },
+ NG_ATTR_BINDING = /^ngAttr[A-Z]/;
+ var MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;
+
+ compile.$$addBindingInfo = debugInfoEnabled ? function $$addBindingInfo($element, binding) {
+ var bindings = $element.data('$binding') || [];
+
+ if (isArray(binding)) {
+ bindings = bindings.concat(binding);
+ } else {
+ bindings.push(binding);
+ }
+
+ $element.data('$binding', bindings);
+ } : noop;
+
+ compile.$$addBindingClass = debugInfoEnabled ? function $$addBindingClass($element) {
+ safeAddClass($element, 'ng-binding');
+ } : noop;
+
+ compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo($element, scope, isolated, noTemplate) {
+ var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';
+ $element.data(dataName, scope);
+ } : noop;
+
+ compile.$$addScopeClass = debugInfoEnabled ? function $$addScopeClass($element, isolated) {
+ safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope');
+ } : noop;
+
+ return compile;
+
+ //================================
+
+ function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,
+ previousCompileContext) {
+ if (!($compileNodes instanceof jqLite)) {
+ // jquery always rewraps, whereas we need to preserve the original selector so that we can
+ // modify it.
+ $compileNodes = jqLite($compileNodes);
+ }
+ // We can not compile top level text elements since text nodes can be merged and we will
+ // not be able to attach scope data to them, so we will wrap them in <span>
+ forEach($compileNodes, function(node, index) {
+ if (node.nodeType == NODE_TYPE_TEXT && node.nodeValue.match(/\S+/) /* non-empty */) {
+ $compileNodes[index] = jqLite(node).wrap('<span></span>').parent()[0];
+ }
+ });
+ var compositeLinkFn =
+ compileNodes($compileNodes, transcludeFn, $compileNodes,
+ maxPriority, ignoreDirective, previousCompileContext);
+ compile.$$addScopeClass($compileNodes);
+ var namespace = null;
+ return function publicLinkFn(scope, cloneConnectFn, options) {
+ assertArg(scope, 'scope');
+
+ if (previousCompileContext && previousCompileContext.needsNewScope) {
+ // A parent directive did a replace and a directive on this element asked
+ // for transclusion, which caused us to lose a layer of element on which
+ // we could hold the new transclusion scope, so we will create it manually
+ // here.
+ scope = scope.$parent.$new();
+ }
+
+ options = options || {};
+ var parentBoundTranscludeFn = options.parentBoundTranscludeFn,
+ transcludeControllers = options.transcludeControllers,
+ futureParentElement = options.futureParentElement;
+
+ // When `parentBoundTranscludeFn` is passed, it is a
+ // `controllersBoundTransclude` function (it was previously passed
+ // as `transclude` to directive.link) so we must unwrap it to get
+ // its `boundTranscludeFn`
+ if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude) {
+ parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude;
+ }
+
+ if (!namespace) {
+ namespace = detectNamespaceForChildElements(futureParentElement);
+ }
+ var $linkNode;
+ if (namespace !== 'html') {
+ // When using a directive with replace:true and templateUrl the $compileNodes
+ // (or a child element inside of them)
+ // might change, so we need to recreate the namespace adapted compileNodes
+ // for call to the link function.
+ // Note: This will already clone the nodes...
+ $linkNode = jqLite(
+ wrapTemplate(namespace, jqLite('<div>').append($compileNodes).html())
+ );
+ } else if (cloneConnectFn) {
+ // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart
+ // and sometimes changes the structure of the DOM.
+ $linkNode = JQLitePrototype.clone.call($compileNodes);
+ } else {
+ $linkNode = $compileNodes;
+ }
+
+ if (transcludeControllers) {
+ for (var controllerName in transcludeControllers) {
+ $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance);
+ }
+ }
+
+ compile.$$addScopeInfo($linkNode, scope);
+
+ if (cloneConnectFn) cloneConnectFn($linkNode, scope);
+ if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn);
+ return $linkNode;
+ };
+ }
+
+ function detectNamespaceForChildElements(parentElement) {
+ // TODO: Make this detect MathML as well...
+ var node = parentElement && parentElement[0];
+ if (!node) {
+ return 'html';
+ } else {
+ return nodeName_(node) !== 'foreignobject' && node.toString().match(/SVG/) ? 'svg' : 'html';
+ }
+ }
+
+ /**
+ * Compile function matches each node in nodeList against the directives. Once all directives
+ * for a particular node are collected their compile functions are executed. The compile
+ * functions return values - the linking functions - are combined into a composite linking
+ * function, which is the a linking function for the node.
+ *
+ * @param {NodeList} nodeList an array of nodes or NodeList to compile
+ * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the
+ * scope argument is auto-generated to the new child of the transcluded parent scope.
+ * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then
+ * the rootElement must be set the jqLite collection of the compile root. This is
+ * needed so that the jqLite collection items can be replaced with widgets.
+ * @param {number=} maxPriority Max directive priority.
+ * @returns {Function} A composite linking function of all of the matched directives or null.
+ */
+ function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,
+ previousCompileContext) {
+ var linkFns = [],
+ attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound;
+
+ for (var i = 0; i < nodeList.length; i++) {
+ attrs = new Attributes();
+
+ // we must always refer to nodeList[i] since the nodes can be replaced underneath us.
+ directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,
+ ignoreDirective);
+
+ nodeLinkFn = (directives.length)
+ ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement,
+ null, [], [], previousCompileContext)
+ : null;
+
+ if (nodeLinkFn && nodeLinkFn.scope) {
+ compile.$$addScopeClass(attrs.$$element);
+ }
+
+ childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||
+ !(childNodes = nodeList[i].childNodes) ||
+ !childNodes.length)
+ ? null
+ : compileNodes(childNodes,
+ nodeLinkFn ? (
+ (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement)
+ && nodeLinkFn.transclude) : transcludeFn);
+
+ if (nodeLinkFn || childLinkFn) {
+ linkFns.push(i, nodeLinkFn, childLinkFn);
+ linkFnFound = true;
+ nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn;
+ }
+
+ //use the previous context only for the first element in the virtual group
+ previousCompileContext = null;
+ }
+
+ // return a linking function if we have found anything, null otherwise
+ return linkFnFound ? compositeLinkFn : null;
+
+ function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {
+ var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;
+ var stableNodeList;
+
+
+ if (nodeLinkFnFound) {
+ // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our
+ // offsets don't get screwed up
+ var nodeListLength = nodeList.length;
+ stableNodeList = new Array(nodeListLength);
+
+ // create a sparse array by only copying the elements which have a linkFn
+ for (i = 0; i < linkFns.length; i+=3) {
+ idx = linkFns[i];
+ stableNodeList[idx] = nodeList[idx];
+ }
+ } else {
+ stableNodeList = nodeList;
+ }
+
+ for (i = 0, ii = linkFns.length; i < ii;) {
+ node = stableNodeList[linkFns[i++]];
+ nodeLinkFn = linkFns[i++];
+ childLinkFn = linkFns[i++];
+
+ if (nodeLinkFn) {
+ if (nodeLinkFn.scope) {
+ childScope = scope.$new();
+ compile.$$addScopeInfo(jqLite(node), childScope);
+ } else {
+ childScope = scope;
+ }
+
+ if (nodeLinkFn.transcludeOnThisElement) {
+ childBoundTranscludeFn = createBoundTranscludeFn(
+ scope, nodeLinkFn.transclude, parentBoundTranscludeFn);
+
+ } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {
+ childBoundTranscludeFn = parentBoundTranscludeFn;
+
+ } else if (!parentBoundTranscludeFn && transcludeFn) {
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);
+
+ } else {
+ childBoundTranscludeFn = null;
+ }
+
+ nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn);
+
+ } else if (childLinkFn) {
+ childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);
+ }
+ }
+ }
+ }
+
+ function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {
+
+ var boundTranscludeFn = function(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {
+
+ if (!transcludedScope) {
+ transcludedScope = scope.$new(false, containingScope);
+ transcludedScope.$$transcluded = true;
+ }
+
+ return transcludeFn(transcludedScope, cloneFn, {
+ parentBoundTranscludeFn: previousBoundTranscludeFn,
+ transcludeControllers: controllers,
+ futureParentElement: futureParentElement
+ });
+ };
+
+ // We need to attach the transclusion slots onto the `boundTranscludeFn`
+ // so that they are available inside the `controllersBoundTransclude` function
+ var boundSlots = boundTranscludeFn.$$slots = createMap();
+ for (var slotName in transcludeFn.$$slots) {
+ boundSlots[slotName] = createBoundTranscludeFn(scope, transcludeFn.$$slots[slotName], previousBoundTranscludeFn);
+ }
+
+ return boundTranscludeFn;
+ }
+
+ /**
+ * Looks for directives on the given node and adds them to the directive collection which is
+ * sorted.
+ *
+ * @param node Node to search.
+ * @param directives An array to which the directives are added to. This array is sorted before
+ * the function returns.
+ * @param attrs The shared attrs object which is used to populate the normalized attributes.
+ * @param {number=} maxPriority Max directive priority.
+ */
+ function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {
+ var nodeType = node.nodeType,
+ attrsMap = attrs.$attr,
+ match,
+ className;
+
+ switch (nodeType) {
+ case NODE_TYPE_ELEMENT: /* Element */
+ // use the node name: <directive>
+ addDirective(directives,
+ directiveNormalize(nodeName_(node)), 'E', maxPriority, ignoreDirective);
+
+ // iterate over the attributes
+ for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes,
+ j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {
+ var attrStartName = false;
+ var attrEndName = false;
+
+ attr = nAttrs[j];
+ name = attr.name;
+ value = trim(attr.value);
+
+ // support ngAttr attribute binding
+ ngAttrName = directiveNormalize(name);
+ if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) {
+ name = name.replace(PREFIX_REGEXP, '')
+ .substr(8).replace(/_(.)/g, function(match, letter) {
+ return letter.toUpperCase();
+ });
+ }
+
+ var multiElementMatch = ngAttrName.match(MULTI_ELEMENT_DIR_RE);
+ if (multiElementMatch && directiveIsMultiElement(multiElementMatch[1])) {
+ attrStartName = name;
+ attrEndName = name.substr(0, name.length - 5) + 'end';
+ name = name.substr(0, name.length - 6);
+ }
+
+ nName = directiveNormalize(name.toLowerCase());
+ attrsMap[nName] = name;
+ if (isNgAttr || !attrs.hasOwnProperty(nName)) {
+ attrs[nName] = value;
+ if (getBooleanAttrName(node, nName)) {
+ attrs[nName] = true; // presence means true
+ }
+ }
+ addAttrInterpolateDirective(node, directives, value, nName, isNgAttr);
+ addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,
+ attrEndName);
+ }
+
+ // use class as directive
+ className = node.className;
+ if (isObject(className)) {
+ // Maybe SVGAnimatedString
+ className = className.animVal;
+ }
+ if (isString(className) && className !== '') {
+ while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {
+ nName = directiveNormalize(match[2]);
+ if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {
+ attrs[nName] = trim(match[3]);
+ }
+ className = className.substr(match.index + match[0].length);
+ }
+ }
+ break;
+ case NODE_TYPE_TEXT: /* Text Node */
+ if (msie === 11) {
+ // Workaround for #11781
+ while (node.parentNode && node.nextSibling && node.nextSibling.nodeType === NODE_TYPE_TEXT) {
+ node.nodeValue = node.nodeValue + node.nextSibling.nodeValue;
+ node.parentNode.removeChild(node.nextSibling);
+ }
+ }
+ addTextInterpolateDirective(directives, node.nodeValue);
+ break;
+ case NODE_TYPE_COMMENT: /* Comment */
+ try {
+ match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
+ if (match) {
+ nName = directiveNormalize(match[1]);
+ if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {
+ attrs[nName] = trim(match[2]);
+ }
+ }
+ } catch (e) {
+ // turns out that under some circumstances IE9 throws errors when one attempts to read
+ // comment's node value.
+ // Just ignore it and continue. (Can't seem to reproduce in test case.)
+ }
+ break;
+ }
+
+ directives.sort(byPriority);
+ return directives;
+ }
+
+ /**
+ * Given a node with an directive-start it collects all of the siblings until it finds
+ * directive-end.
+ * @param node
+ * @param attrStart
+ * @param attrEnd
+ * @returns {*}
+ */
+ function groupScan(node, attrStart, attrEnd) {
+ var nodes = [];
+ var depth = 0;
+ if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {
+ do {
+ if (!node) {
+ throw $compileMinErr('uterdir',
+ "Unterminated attribute, found '{0}' but no matching '{1}' found.",
+ attrStart, attrEnd);
+ }
+ if (node.nodeType == NODE_TYPE_ELEMENT) {
+ if (node.hasAttribute(attrStart)) depth++;
+ if (node.hasAttribute(attrEnd)) depth--;
+ }
+ nodes.push(node);
+ node = node.nextSibling;
+ } while (depth > 0);
+ } else {
+ nodes.push(node);
+ }
+
+ return jqLite(nodes);
+ }
+
+ /**
+ * Wrapper for linking function which converts normal linking function into a grouped
+ * linking function.
+ * @param linkFn
+ * @param attrStart
+ * @param attrEnd
+ * @returns {Function}
+ */
+ function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {
+ return function(scope, element, attrs, controllers, transcludeFn) {
+ element = groupScan(element[0], attrStart, attrEnd);
+ return linkFn(scope, element, attrs, controllers, transcludeFn);
+ };
+ }
+
+ /**
+ * A function generator that is used to support both eager and lazy compilation
+ * linking function.
+ * @param eager
+ * @param $compileNodes
+ * @param transcludeFn
+ * @param maxPriority
+ * @param ignoreDirective
+ * @param previousCompileContext
+ * @returns {Function}
+ */
+ function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) {
+ if (eager) {
+ return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
+ }
+
+ var compiled;
+
+ return function() {
+ if (!compiled) {
+ compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
+
+ // Null out all of these references in order to make them eligible for garbage collection
+ // since this is a potentially long lived closure
+ $compileNodes = transcludeFn = previousCompileContext = null;
+ }
+
+ return compiled.apply(this, arguments);
+ };
+ }
+
+ /**
+ * Once the directives have been collected, their compile functions are executed. This method
+ * is responsible for inlining directive templates as well as terminating the application
+ * of the directives if the terminal directive has been reached.
+ *
+ * @param {Array} directives Array of collected directives to execute their compile function.
+ * this needs to be pre-sorted by priority order.
+ * @param {Node} compileNode The raw DOM node to apply the compile functions to
+ * @param {Object} templateAttrs The shared attribute function
+ * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the
+ * scope argument is auto-generated to the new
+ * child of the transcluded parent scope.
+ * @param {JQLite} jqCollection If we are working on the root of the compile tree then this
+ * argument has the root jqLite array so that we can replace nodes
+ * on it.
+ * @param {Object=} originalReplaceDirective An optional directive that will be ignored when
+ * compiling the transclusion.
+ * @param {Array.<Function>} preLinkFns
+ * @param {Array.<Function>} postLinkFns
+ * @param {Object} previousCompileContext Context used for previous compilation of the current
+ * node
+ * @returns {Function} linkFn
+ */
+ function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
+ jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
+ previousCompileContext) {
+ previousCompileContext = previousCompileContext || {};
+
+ var terminalPriority = -Number.MAX_VALUE,
+ newScopeDirective = previousCompileContext.newScopeDirective,
+ controllerDirectives = previousCompileContext.controllerDirectives,
+ newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
+ templateDirective = previousCompileContext.templateDirective,
+ nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
+ hasTranscludeDirective = false,
+ hasTemplate = false,
+ hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
+ $compileNode = templateAttrs.$$element = jqLite(compileNode),
+ directive,
+ directiveName,
+ $template,
+ replaceDirective = originalReplaceDirective,
+ childTranscludeFn = transcludeFn,
+ linkFn,
+ didScanForMultipleTransclusion = false,
+ mightHaveMultipleTransclusionError = false,
+ directiveValue;
+
+ // executes all directives on the current element
+ for (var i = 0, ii = directives.length; i < ii; i++) {
+ directive = directives[i];
+ var attrStart = directive.$$start;
+ var attrEnd = directive.$$end;
+
+ // collect multiblock sections
+ if (attrStart) {
+ $compileNode = groupScan(compileNode, attrStart, attrEnd);
+ }
+ $template = undefined;
+
+ if (terminalPriority > directive.priority) {
+ break; // prevent further processing of directives
+ }
+
+ if (directiveValue = directive.scope) {
+
+ // skip the check for directives with async templates, we'll check the derived sync
+ // directive when the template arrives
+ if (!directive.templateUrl) {
+ if (isObject(directiveValue)) {
+ // This directive is trying to add an isolated scope.
+ // Check that there is no scope of any kind already
+ assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,
+ directive, $compileNode);
+ newIsolateScopeDirective = directive;
+ } else {
+ // This directive is trying to add a child scope.
+ // Check that there is no isolated scope already
+ assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,
+ $compileNode);
+ }
+ }
+
+ newScopeDirective = newScopeDirective || directive;
+ }
+
+ directiveName = directive.name;
+
+ // If we encounter a condition that can result in transclusion on the directive,
+ // then scan ahead in the remaining directives for others that may cause a multiple
+ // transclusion error to be thrown during the compilation process. If a matching directive
+ // is found, then we know that when we encounter a transcluded directive, we need to eagerly
+ // compile the `transclude` function rather than doing it lazily in order to throw
+ // exceptions at the correct time
+ if (!didScanForMultipleTransclusion && ((directive.replace && (directive.templateUrl || directive.template))
+ || (directive.transclude && !directive.$$tlb))) {
+ var candidateDirective;
+
+ for (var scanningIndex = i + 1; candidateDirective = directives[scanningIndex++];) {
+ if ((candidateDirective.transclude && !candidateDirective.$$tlb)
+ || (candidateDirective.replace && (candidateDirective.templateUrl || candidateDirective.template))) {
+ mightHaveMultipleTransclusionError = true;
+ break;
+ }
+ }
+
+ didScanForMultipleTransclusion = true;
+ }
+
+ if (!directive.templateUrl && directive.controller) {
+ directiveValue = directive.controller;
+ controllerDirectives = controllerDirectives || createMap();
+ assertNoDuplicate("'" + directiveName + "' controller",
+ controllerDirectives[directiveName], directive, $compileNode);
+ controllerDirectives[directiveName] = directive;
+ }
+
+ if (directiveValue = directive.transclude) {
+ hasTranscludeDirective = true;
+
+ // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.
+ // This option should only be used by directives that know how to safely handle element transclusion,
+ // where the transcluded nodes are added or replaced after linking.
+ if (!directive.$$tlb) {
+ assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);
+ nonTlbTranscludeDirective = directive;
+ }
+
+ if (directiveValue == 'element') {
+ hasElementTranscludeDirective = true;
+ terminalPriority = directive.priority;
+ $template = $compileNode;
+ $compileNode = templateAttrs.$$element =
+ jqLite(document.createComment(' ' + directiveName + ': ' +
+ templateAttrs[directiveName] + ' '));
+ compileNode = $compileNode[0];
+ replaceWith(jqCollection, sliceArgs($template), compileNode);
+
+ childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, terminalPriority,
+ replaceDirective && replaceDirective.name, {
+ // Don't pass in:
+ // - controllerDirectives - otherwise we'll create duplicates controllers
+ // - newIsolateScopeDirective or templateDirective - combining templates with
+ // element transclusion doesn't make sense.
+ //
+ // We need only nonTlbTranscludeDirective so that we prevent putting transclusion
+ // on the same element more than once.
+ nonTlbTranscludeDirective: nonTlbTranscludeDirective
+ });
+ } else {
+
+ var slots = createMap();
+ $template = jqLite(jqLiteClone(compileNode)).contents();
+
+ if (isObject(directiveValue)) {
+
+ // We have transclusion slots - collect them up and compile them and store their
+ // transclusion functions
+ $template = [];
+ var slotNames = createMap();
+ var filledSlots = createMap();
+
+ // Parse the slot names: if they start with a ? then they are optional
+ forEach(directiveValue, function(slotName, key) {
+ var optional = (slotName.charAt(0) === '?');
+ slotName = optional ? slotName.substring(1) : slotName;
+ slotNames[key] = slotName;
+ slots[slotName] = [];
+ // filledSlots contains `true` for all slots that are either optional or have been
+ // filled. This is used to check that we have not missed any required slots
+ filledSlots[slotName] = optional;
+ });
+
+ // Add the matching elements into their slot
+ forEach($compileNode.children(), function(node) {
+ var slotName = slotNames[directiveNormalize(nodeName_(node))];
+ if (slotName) {
+ filledSlots[slotName] = true;
+ slots[slotName].push(node);
+ } else {
+ $template.push(node);
+ }
+ });
+
+ // Check for required slots that were not filled
+ forEach(filledSlots, function(filled, slotName) {
+ if (!filled) {
+ throw $compileMinErr('reqslot', 'Required transclusion slot `{0}` was not filled.', slotName);
+ }
+ });
+
+ forEach(Object.keys(slots), function(slotName) {
+ slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slots[slotName], transcludeFn);
+ });
+ }
+
+ $compileNode.empty(); // clear contents
+ childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, undefined,
+ undefined, { needsNewScope: directive.$$isolateScope || directive.$$newScope});
+ childTranscludeFn.$$slots = slots;
+ }
+ }
+
+ if (directive.template) {
+ hasTemplate = true;
+ assertNoDuplicate('template', templateDirective, directive, $compileNode);
+ templateDirective = directive;
+
+ directiveValue = (isFunction(directive.template))
+ ? directive.template($compileNode, templateAttrs)
+ : directive.template;
+
+ directiveValue = denormalizeTemplate(directiveValue);
+
+ if (directive.replace) {
+ replaceDirective = directive;
+ if (jqLiteIsTextNode(directiveValue)) {
+ $template = [];
+ } else {
+ $template = removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue)));
+ }
+ compileNode = $template[0];
+
+ if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
+ throw $compileMinErr('tplrt',
+ "Template for directive '{0}' must have exactly one root element. {1}",
+ directiveName, '');
+ }
+
+ replaceWith(jqCollection, $compileNode, compileNode);
+
+ var newTemplateAttrs = {$attr: {}};
+
+ // combine directives from the original node and from the template:
+ // - take the array of directives for this element
+ // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed)
+ // - collect directives from the template and sort them by priority
+ // - combine directives as: processed + template + unprocessed
+ var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs);
+ var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));
+
+ if (newIsolateScopeDirective || newScopeDirective) {
+ // The original directive caused the current element to be replaced but this element
+ // also needs to have a new scope, so we need to tell the template directives
+ // that they would need to get their scope from further up, if they require transclusion
+ markDirectiveScope(templateDirectives, newIsolateScopeDirective, newScopeDirective);
+ }
+ directives = directives.concat(templateDirectives).concat(unprocessedDirectives);
+ mergeTemplateAttributes(templateAttrs, newTemplateAttrs);
+
+ ii = directives.length;
+ } else {
+ $compileNode.html(directiveValue);
+ }
+ }
+
+ if (directive.templateUrl) {
+ hasTemplate = true;
+ assertNoDuplicate('template', templateDirective, directive, $compileNode);
+ templateDirective = directive;
+
+ if (directive.replace) {
+ replaceDirective = directive;
+ }
+
+ nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,
+ templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, {
+ controllerDirectives: controllerDirectives,
+ newScopeDirective: (newScopeDirective !== directive) && newScopeDirective,
+ newIsolateScopeDirective: newIsolateScopeDirective,
+ templateDirective: templateDirective,
+ nonTlbTranscludeDirective: nonTlbTranscludeDirective
+ });
+ ii = directives.length;
+ } else if (directive.compile) {
+ try {
+ linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);
+ if (isFunction(linkFn)) {
+ addLinkFns(null, linkFn, attrStart, attrEnd);
+ } else if (linkFn) {
+ addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd);
+ }
+ } catch (e) {
+ $exceptionHandler(e, startingTag($compileNode));
+ }
+ }
+
+ if (directive.terminal) {
+ nodeLinkFn.terminal = true;
+ terminalPriority = Math.max(terminalPriority, directive.priority);
+ }
+
+ }
+
+ nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;
+ nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective;
+ nodeLinkFn.templateOnThisElement = hasTemplate;
+ nodeLinkFn.transclude = childTranscludeFn;
+
+ previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective;
+
+ // might be normal or delayed nodeLinkFn depending on if templateUrl is present
+ return nodeLinkFn;
+
+ ////////////////////
+
+ function addLinkFns(pre, post, attrStart, attrEnd) {
+ if (pre) {
+ if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);
+ pre.require = directive.require;
+ pre.directiveName = directiveName;
+ if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
+ pre = cloneAndAnnotateFn(pre, {isolateScope: true});
+ }
+ preLinkFns.push(pre);
+ }
+ if (post) {
+ if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);
+ post.require = directive.require;
+ post.directiveName = directiveName;
+ if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
+ post = cloneAndAnnotateFn(post, {isolateScope: true});
+ }
+ postLinkFns.push(post);
+ }
+ }
+
+
+ function getControllers(directiveName, require, $element, elementControllers) {
+ var value;
+
+ if (isString(require)) {
+ var match = require.match(REQUIRE_PREFIX_REGEXP);
+ var name = require.substring(match[0].length);
+ var inheritType = match[1] || match[3];
+ var optional = match[2] === '?';
+
+ //If only parents then start at the parent element
+ if (inheritType === '^^') {
+ $element = $element.parent();
+ //Otherwise attempt getting the controller from elementControllers in case
+ //the element is transcluded (and has no data) and to avoid .data if possible
+ } else {
+ value = elementControllers && elementControllers[name];
+ value = value && value.instance;
+ }
+
+ if (!value) {
+ var dataName = '$' + name + 'Controller';
+ value = inheritType ? $element.inheritedData(dataName) : $element.data(dataName);
+ }
+
+ if (!value && !optional) {
+ throw $compileMinErr('ctreq',
+ "Controller '{0}', required by directive '{1}', can't be found!",
+ name, directiveName);
+ }
+ } else if (isArray(require)) {
+ value = [];
+ for (var i = 0, ii = require.length; i < ii; i++) {
+ value[i] = getControllers(directiveName, require[i], $element, elementControllers);
+ }
+ }
+
+ return value || null;
+ }
+
+ function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope) {
+ var elementControllers = createMap();
+ for (var controllerKey in controllerDirectives) {
+ var directive = controllerDirectives[controllerKey];
+ var locals = {
+ $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,
+ $element: $element,
+ $attrs: attrs,
+ $transclude: transcludeFn
+ };
+
+ var controller = directive.controller;
+ if (controller == '@') {
+ controller = attrs[directive.name];
+ }
+
+ var controllerInstance = $controller(controller, locals, true, directive.controllerAs);
+
+ // For directives with element transclusion the element is a comment,
+ // but jQuery .data doesn't support attaching data to comment nodes as it's hard to
+ // clean up (http://bugs.jquery.com/ticket/8335).
+ // Instead, we save the controllers for the element in a local hash and attach to .data
+ // later, once we have the actual element.
+ elementControllers[directive.name] = controllerInstance;
+ if (!hasElementTranscludeDirective) {
+ $element.data('$' + directive.name + 'Controller', controllerInstance.instance);
+ }
+ }
+ return elementControllers;
+ }
+
+ function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
+ var linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element,
+ attrs, removeScopeBindingWatches, removeControllerBindingWatches;
+
+ if (compileNode === linkNode) {
+ attrs = templateAttrs;
+ $element = templateAttrs.$$element;
+ } else {
+ $element = jqLite(linkNode);
+ attrs = new Attributes($element, templateAttrs);
+ }
+
+ controllerScope = scope;
+ if (newIsolateScopeDirective) {
+ isolateScope = scope.$new(true);
+ } else if (newScopeDirective) {
+ controllerScope = scope.$parent;
+ }
+
+ if (boundTranscludeFn) {
+ // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn`
+ // is later passed as `parentBoundTranscludeFn` to `publicLinkFn`
+ transcludeFn = controllersBoundTransclude;
+ transcludeFn.$$boundTransclude = boundTranscludeFn;
+ }
+
+ if (controllerDirectives) {
+ elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope);
+ }
+
+ if (newIsolateScopeDirective) {
+ // Initialize isolate scope bindings for new isolate scope directive.
+ compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective ||
+ templateDirective === newIsolateScopeDirective.$$originalDirective)));
+ compile.$$addScopeClass($element, true);
+ isolateScope.$$isolateBindings =
+ newIsolateScopeDirective.$$isolateBindings;
+ removeScopeBindingWatches = initializeDirectiveBindings(scope, attrs, isolateScope,
+ isolateScope.$$isolateBindings,
+ newIsolateScopeDirective);
+ if (removeScopeBindingWatches) {
+ isolateScope.$on('$destroy', removeScopeBindingWatches);
+ }
+ }
+
+ // Initialize bindToController bindings
+ for (var name in elementControllers) {
+ var controllerDirective = controllerDirectives[name];
+ var controller = elementControllers[name];
+ var bindings = controllerDirective.$$bindings.bindToController;
+
+ if (controller.identifier && bindings) {
+ removeControllerBindingWatches =
+ initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
+ }
+
+ var controllerResult = controller();
+ if (controllerResult !== controller.instance) {
+ // If the controller constructor has a return value, overwrite the instance
+ // from setupControllers
+ controller.instance = controllerResult;
+ $element.data('$' + controllerDirective.name + 'Controller', controllerResult);
+ removeControllerBindingWatches && removeControllerBindingWatches();
+ removeControllerBindingWatches =
+ initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
+ }
+ }
+
+ // PRELINKING
+ for (i = 0, ii = preLinkFns.length; i < ii; i++) {
+ linkFn = preLinkFns[i];
+ invokeLinkFn(linkFn,
+ linkFn.isolateScope ? isolateScope : scope,
+ $element,
+ attrs,
+ linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),
+ transcludeFn
+ );
+ }
+
+ // RECURSION
+ // We only pass the isolate scope, if the isolate directive has a template,
+ // otherwise the child elements do not belong to the isolate directive.
+ var scopeToChild = scope;
+ if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {
+ scopeToChild = isolateScope;
+ }
+ childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);
+
+ // POSTLINKING
+ for (i = postLinkFns.length - 1; i >= 0; i--) {
+ linkFn = postLinkFns[i];
+ invokeLinkFn(linkFn,
+ linkFn.isolateScope ? isolateScope : scope,
+ $element,
+ attrs,
+ linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),
+ transcludeFn
+ );
+ }
+
+ // This is the function that is injected as `$transclude`.
+ // Note: all arguments are optional!
+ function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement, slotName) {
+ var transcludeControllers;
+ // No scope passed in:
+ if (!isScope(scope)) {
+ slotName = futureParentElement;
+ futureParentElement = cloneAttachFn;
+ cloneAttachFn = scope;
+ scope = undefined;
+ }
+
+ if (hasElementTranscludeDirective) {
+ transcludeControllers = elementControllers;
+ }
+ if (!futureParentElement) {
+ futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element;
+ }
+ if (slotName) {
+ var slotTranscludeFn = boundTranscludeFn.$$slots[slotName];
+ if (!slotTranscludeFn) {
+ throw $compileMinErr('noslot',
+ 'No parent directive that requires a transclusion with slot name "{0}". ' +
+ 'Element: {1}',
+ slotName, startingTag($element));
+ }
+ return slotTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);
+ }
+ return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);
+ }
+ }
+ }
+
+ // Depending upon the context in which a directive finds itself it might need to have a new isolated
+ // or child scope created. For instance:
+ // * if the directive has been pulled into a template because another directive with a higher priority
+ // asked for element transclusion
+ // * if the directive itself asks for transclusion but it is at the root of a template and the original
+ // element was replaced. See https://github.com/angular/angular.js/issues/12936
+ function markDirectiveScope(directives, isolateScope, newScope) {
+ for (var j = 0, jj = directives.length; j < jj; j++) {
+ directives[j] = inherit(directives[j], {$$isolateScope: isolateScope, $$newScope: newScope});
+ }
+ }
+
+ /**
+ * looks up the directive and decorates it with exception handling and proper parameters. We
+ * call this the boundDirective.
+ *
+ * @param {string} name name of the directive to look up.
+ * @param {string} location The directive must be found in specific format.
+ * String containing any of theses characters:
+ *
+ * * `E`: element name
+ * * `A': attribute
+ * * `C`: class
+ * * `M`: comment
+ * @returns {boolean} true if directive was added.
+ */
+ function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,
+ endAttrName) {
+ if (name === ignoreDirective) return null;
+ var match = null;
+ if (hasDirectives.hasOwnProperty(name)) {
+ for (var directive, directives = $injector.get(name + Suffix),
+ i = 0, ii = directives.length; i < ii; i++) {
+ try {
+ directive = directives[i];
+ if ((isUndefined(maxPriority) || maxPriority > directive.priority) &&
+ directive.restrict.indexOf(location) != -1) {
+ if (startAttrName) {
+ directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});
+ }
+ tDirectives.push(directive);
+ match = directive;
+ }
+ } catch (e) { $exceptionHandler(e); }
+ }
+ }
+ return match;
+ }
+
+
+ /**
+ * looks up the directive and returns true if it is a multi-element directive,
+ * and therefore requires DOM nodes between -start and -end markers to be grouped
+ * together.
+ *
+ * @param {string} name name of the directive to look up.
+ * @returns true if directive was registered as multi-element.
+ */
+ function directiveIsMultiElement(name) {
+ if (hasDirectives.hasOwnProperty(name)) {
+ for (var directive, directives = $injector.get(name + Suffix),
+ i = 0, ii = directives.length; i < ii; i++) {
+ directive = directives[i];
+ if (directive.multiElement) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * When the element is replaced with HTML template then the new attributes
+ * on the template need to be merged with the existing attributes in the DOM.
+ * The desired effect is to have both of the attributes present.
+ *
+ * @param {object} dst destination attributes (original DOM)
+ * @param {object} src source attributes (from the directive template)
+ */
+ function mergeTemplateAttributes(dst, src) {
+ var srcAttr = src.$attr,
+ dstAttr = dst.$attr,
+ $element = dst.$$element;
+
+ // reapply the old attributes to the new element
+ forEach(dst, function(value, key) {
+ if (key.charAt(0) != '$') {
+ if (src[key] && src[key] !== value) {
+ value += (key === 'style' ? ';' : ' ') + src[key];
+ }
+ dst.$set(key, value, true, srcAttr[key]);
+ }
+ });
+
+ // copy the new attributes on the old attrs object
+ forEach(src, function(value, key) {
+ if (key == 'class') {
+ safeAddClass($element, value);
+ dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;
+ } else if (key == 'style') {
+ $element.attr('style', $element.attr('style') + ';' + value);
+ dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;
+ // `dst` will never contain hasOwnProperty as DOM parser won't let it.
+ // You will get an "InvalidCharacterError: DOM Exception 5" error if you
+ // have an attribute like "has-own-property" or "data-has-own-property", etc.
+ } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {
+ dst[key] = value;
+ dstAttr[key] = srcAttr[key];
+ }
+ });
+ }
+
+
+ function compileTemplateUrl(directives, $compileNode, tAttrs,
+ $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {
+ var linkQueue = [],
+ afterTemplateNodeLinkFn,
+ afterTemplateChildLinkFn,
+ beforeTemplateCompileNode = $compileNode[0],
+ origAsyncDirective = directives.shift(),
+ derivedSyncDirective = inherit(origAsyncDirective, {
+ templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective
+ }),
+ templateUrl = (isFunction(origAsyncDirective.templateUrl))
+ ? origAsyncDirective.templateUrl($compileNode, tAttrs)
+ : origAsyncDirective.templateUrl,
+ templateNamespace = origAsyncDirective.templateNamespace;
+
+ $compileNode.empty();
+
+ $templateRequest(templateUrl)
+ .then(function(content) {
+ var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;
+
+ content = denormalizeTemplate(content);
+
+ if (origAsyncDirective.replace) {
+ if (jqLiteIsTextNode(content)) {
+ $template = [];
+ } else {
+ $template = removeComments(wrapTemplate(templateNamespace, trim(content)));
+ }
+ compileNode = $template[0];
+
+ if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
+ throw $compileMinErr('tplrt',
+ "Template for directive '{0}' must have exactly one root element. {1}",
+ origAsyncDirective.name, templateUrl);
+ }
+
+ tempTemplateAttrs = {$attr: {}};
+ replaceWith($rootElement, $compileNode, compileNode);
+ var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);
+
+ if (isObject(origAsyncDirective.scope)) {
+ // the original directive that caused the template to be loaded async required
+ // an isolate scope
+ markDirectiveScope(templateDirectives, true);
+ }
+ directives = templateDirectives.concat(directives);
+ mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
+ } else {
+ compileNode = beforeTemplateCompileNode;
+ $compileNode.html(content);
+ }
+
+ directives.unshift(derivedSyncDirective);
+
+ afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,
+ childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,
+ previousCompileContext);
+ forEach($rootElement, function(node, i) {
+ if (node == compileNode) {
+ $rootElement[i] = $compileNode[0];
+ }
+ });
+ afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);
+
+ while (linkQueue.length) {
+ var scope = linkQueue.shift(),
+ beforeTemplateLinkNode = linkQueue.shift(),
+ linkRootElement = linkQueue.shift(),
+ boundTranscludeFn = linkQueue.shift(),
+ linkNode = $compileNode[0];
+
+ if (scope.$$destroyed) continue;
+
+ if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {
+ var oldClasses = beforeTemplateLinkNode.className;
+
+ if (!(previousCompileContext.hasElementTranscludeDirective &&
+ origAsyncDirective.replace)) {
+ // it was cloned therefore we have to clone as well.
+ linkNode = jqLiteClone(compileNode);
+ }
+ replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);
+
+ // Copy in CSS classes from original node
+ safeAddClass(jqLite(linkNode), oldClasses);
+ }
+ if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);
+ } else {
+ childBoundTranscludeFn = boundTranscludeFn;
+ }
+ afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,
+ childBoundTranscludeFn);
+ }
+ linkQueue = null;
+ });
+
+ return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {
+ var childBoundTranscludeFn = boundTranscludeFn;
+ if (scope.$$destroyed) return;
+ if (linkQueue) {
+ linkQueue.push(scope,
+ node,
+ rootElement,
+ childBoundTranscludeFn);
+ } else {
+ if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);
+ }
+ afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn);
+ }
+ };
+ }
+
+
+ /**
+ * Sorting function for bound directives.
+ */
+ function byPriority(a, b) {
+ var diff = b.priority - a.priority;
+ if (diff !== 0) return diff;
+ if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;
+ return a.index - b.index;
+ }
+
+ function assertNoDuplicate(what, previousDirective, directive, element) {
+
+ function wrapModuleNameIfDefined(moduleName) {
+ return moduleName ?
+ (' (module: ' + moduleName + ')') :
+ '';
+ }
+
+ if (previousDirective) {
+ throw $compileMinErr('multidir', 'Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}',
+ previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName),
+ directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element));
+ }
+ }
+
+
+ function addTextInterpolateDirective(directives, text) {
+ var interpolateFn = $interpolate(text, true);
+ if (interpolateFn) {
+ directives.push({
+ priority: 0,
+ compile: function textInterpolateCompileFn(templateNode) {
+ var templateNodeParent = templateNode.parent(),
+ hasCompileParent = !!templateNodeParent.length;
+
+ // When transcluding a template that has bindings in the root
+ // we don't have a parent and thus need to add the class during linking fn.
+ if (hasCompileParent) compile.$$addBindingClass(templateNodeParent);
+
+ return function textInterpolateLinkFn(scope, node) {
+ var parent = node.parent();
+ if (!hasCompileParent) compile.$$addBindingClass(parent);
+ compile.$$addBindingInfo(parent, interpolateFn.expressions);
+ scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {
+ node[0].nodeValue = value;
+ });
+ };
+ }
+ });
+ }
+ }
+
+
+ function wrapTemplate(type, template) {
+ type = lowercase(type || 'html');
+ switch (type) {
+ case 'svg':
+ case 'math':
+ var wrapper = document.createElement('div');
+ wrapper.innerHTML = '<' + type + '>' + template + '</' + type + '>';
+ return wrapper.childNodes[0].childNodes;
+ default:
+ return template;
+ }
+ }
+
+
+ function getTrustedContext(node, attrNormalizedName) {
+ if (attrNormalizedName == "srcdoc") {
+ return $sce.HTML;
+ }
+ var tag = nodeName_(node);
+ // maction[xlink:href] can source SVG. It's not limited to <maction>.
+ if (attrNormalizedName == "xlinkHref" ||
+ (tag == "form" && attrNormalizedName == "action") ||
+ (tag != "img" && (attrNormalizedName == "src" ||
+ attrNormalizedName == "ngSrc"))) {
+ return $sce.RESOURCE_URL;
+ }
+ }
+
+
+ function addAttrInterpolateDirective(node, directives, value, name, allOrNothing) {
+ var trustedContext = getTrustedContext(node, name);
+ allOrNothing = ALL_OR_NOTHING_ATTRS[name] || allOrNothing;
+
+ var interpolateFn = $interpolate(value, true, trustedContext, allOrNothing);
+
+ // no interpolation found -> ignore
+ if (!interpolateFn) return;
+
+
+ if (name === "multiple" && nodeName_(node) === "select") {
+ throw $compileMinErr("selmulti",
+ "Binding to the 'multiple' attribute is not supported. Element: {0}",
+ startingTag(node));
+ }
+
+ directives.push({
+ priority: 100,
+ compile: function() {
+ return {
+ pre: function attrInterpolatePreLinkFn(scope, element, attr) {
+ var $$observers = (attr.$$observers || (attr.$$observers = createMap()));
+
+ if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {
+ throw $compileMinErr('nodomevents',
+ "Interpolations for HTML DOM event attributes are disallowed. Please use the " +
+ "ng- versions (such as ng-click instead of onclick) instead.");
+ }
+
+ // If the attribute has changed since last $interpolate()ed
+ var newValue = attr[name];
+ if (newValue !== value) {
+ // we need to interpolate again since the attribute value has been updated
+ // (e.g. by another directive's compile function)
+ // ensure unset/empty values make interpolateFn falsy
+ interpolateFn = newValue && $interpolate(newValue, true, trustedContext, allOrNothing);
+ value = newValue;
+ }
+
+ // if attribute was updated so that there is no interpolation going on we don't want to
+ // register any observers
+ if (!interpolateFn) return;
+
+ // initialize attr object so that it's ready in case we need the value for isolate
+ // scope initialization, otherwise the value would not be available from isolate
+ // directive's linking fn during linking phase
+ attr[name] = interpolateFn(scope);
+
+ ($$observers[name] || ($$observers[name] = [])).$$inter = true;
+ (attr.$$observers && attr.$$observers[name].$$scope || scope).
+ $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {
+ //special case for class attribute addition + removal
+ //so that class changes can tap into the animation
+ //hooks provided by the $animate service. Be sure to
+ //skip animations when the first digest occurs (when
+ //both the new and the old values are the same) since
+ //the CSS classes are the non-interpolated values
+ if (name === 'class' && newValue != oldValue) {
+ attr.$updateClass(newValue, oldValue);
+ } else {
+ attr.$set(name, newValue);
+ }
+ });
+ }
+ };
+ }
+ });
+ }
+
+
+ /**
+ * This is a special jqLite.replaceWith, which can replace items which
+ * have no parents, provided that the containing jqLite collection is provided.
+ *
+ * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
+ * in the root of the tree.
+ * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep
+ * the shell, but replace its DOM node reference.
+ * @param {Node} newNode The new DOM node.
+ */
+ function replaceWith($rootElement, elementsToRemove, newNode) {
+ var firstElementToRemove = elementsToRemove[0],
+ removeCount = elementsToRemove.length,
+ parent = firstElementToRemove.parentNode,
+ i, ii;
+
+ if ($rootElement) {
+ for (i = 0, ii = $rootElement.length; i < ii; i++) {
+ if ($rootElement[i] == firstElementToRemove) {
+ $rootElement[i++] = newNode;
+ for (var j = i, j2 = j + removeCount - 1,
+ jj = $rootElement.length;
+ j < jj; j++, j2++) {
+ if (j2 < jj) {
+ $rootElement[j] = $rootElement[j2];
+ } else {
+ delete $rootElement[j];
+ }
+ }
+ $rootElement.length -= removeCount - 1;
+
+ // If the replaced element is also the jQuery .context then replace it
+ // .context is a deprecated jQuery api, so we should set it only when jQuery set it
+ // http://api.jquery.com/context/
+ if ($rootElement.context === firstElementToRemove) {
+ $rootElement.context = newNode;
+ }
+ break;
+ }
+ }
+ }
+
+ if (parent) {
+ parent.replaceChild(newNode, firstElementToRemove);
+ }
+
+ // Append all the `elementsToRemove` to a fragment. This will...
+ // - remove them from the DOM
+ // - allow them to still be traversed with .nextSibling
+ // - allow a single fragment.qSA to fetch all elements being removed
+ var fragment = document.createDocumentFragment();
+ for (i = 0; i < removeCount; i++) {
+ fragment.appendChild(elementsToRemove[i]);
+ }
+
+ if (jqLite.hasData(firstElementToRemove)) {
+ // Copy over user data (that includes Angular's $scope etc.). Don't copy private
+ // data here because there's no public interface in jQuery to do that and copying over
+ // event listeners (which is the main use of private data) wouldn't work anyway.
+ jqLite.data(newNode, jqLite.data(firstElementToRemove));
+
+ // Remove $destroy event listeners from `firstElementToRemove`
+ jqLite(firstElementToRemove).off('$destroy');
+ }
+
+ // Cleanup any data/listeners on the elements and children.
+ // This includes invoking the $destroy event on any elements with listeners.
+ jqLite.cleanData(fragment.querySelectorAll('*'));
+
+ // Update the jqLite collection to only contain the `newNode`
+ for (i = 1; i < removeCount; i++) {
+ delete elementsToRemove[i];
+ }
+ elementsToRemove[0] = newNode;
+ elementsToRemove.length = 1;
+ }
+
+
+ function cloneAndAnnotateFn(fn, annotation) {
+ return extend(function() { return fn.apply(null, arguments); }, fn, annotation);
+ }
+
+
+ function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) {
+ try {
+ linkFn(scope, $element, attrs, controllers, transcludeFn);
+ } catch (e) {
+ $exceptionHandler(e, startingTag($element));
+ }
+ }
+
+
+ // Set up $watches for isolate scope and controller bindings. This process
+ // only occurs for isolate scopes and new scopes with controllerAs.
+ function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) {
+ var removeWatchCollection = [];
+ forEach(bindings, function(definition, scopeName) {
+ var attrName = definition.attrName,
+ optional = definition.optional,
+ mode = definition.mode, // @, =, or &
+ lastValue,
+ parentGet, parentSet, compare;
+
+ switch (mode) {
+
+ case '@':
+ if (!optional && !hasOwnProperty.call(attrs, attrName)) {
+ destination[scopeName] = attrs[attrName] = void 0;
+ }
+ attrs.$observe(attrName, function(value) {
+ if (isString(value)) {
+ destination[scopeName] = value;
+ }
+ });
+ attrs.$$observers[attrName].$$scope = scope;
+ if (isString(attrs[attrName])) {
+ // If the attribute has been provided then we trigger an interpolation to ensure
+ // the value is there for use in the link fn
+ destination[scopeName] = $interpolate(attrs[attrName])(scope);
+ }
+ break;
+
+ case '=':
+ if (!hasOwnProperty.call(attrs, attrName)) {
+ if (optional) break;
+ attrs[attrName] = void 0;
+ }
+ if (optional && !attrs[attrName]) break;
+
+ parentGet = $parse(attrs[attrName]);
+ if (parentGet.literal) {
+ compare = equals;
+ } else {
+ compare = function(a, b) { return a === b || (a !== a && b !== b); };
+ }
+ parentSet = parentGet.assign || function() {
+ // reset the change, or we will throw this exception on every $digest
+ lastValue = destination[scopeName] = parentGet(scope);
+ throw $compileMinErr('nonassign',
+ "Expression '{0}' used with directive '{1}' is non-assignable!",
+ attrs[attrName], directive.name);
+ };
+ lastValue = destination[scopeName] = parentGet(scope);
+ var parentValueWatch = function parentValueWatch(parentValue) {
+ if (!compare(parentValue, destination[scopeName])) {
+ // we are out of sync and need to copy
+ if (!compare(parentValue, lastValue)) {
+ // parent changed and it has precedence
+ destination[scopeName] = parentValue;
+ } else {
+ // if the parent can be assigned then do so
+ parentSet(scope, parentValue = destination[scopeName]);
+ }
+ }
+ return lastValue = parentValue;
+ };
+ parentValueWatch.$stateful = true;
+ var removeWatch;
+ if (definition.collection) {
+ removeWatch = scope.$watchCollection(attrs[attrName], parentValueWatch);
+ } else {
+ removeWatch = scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal);
+ }
+ removeWatchCollection.push(removeWatch);
+ break;
+
+ case '&':
+ // Don't assign Object.prototype method to scope
+ parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop;
+
+ // Don't assign noop to destination if expression is not valid
+ if (parentGet === noop && optional) break;
+
+ destination[scopeName] = function(locals) {
+ return parentGet(scope, locals);
+ };
+ break;
+ }
+ });
+
+ return removeWatchCollection.length && function removeWatches() {
+ for (var i = 0, ii = removeWatchCollection.length; i < ii; ++i) {
+ removeWatchCollection[i]();
+ }
+ };
+ }
+ }];
+}
+
+var PREFIX_REGEXP = /^((?:x|data)[\:\-_])/i;
+/**
+ * Converts all accepted directives format into proper directive name.
+ * @param name Name to normalize
+ */
+function directiveNormalize(name) {
+ return camelCase(name.replace(PREFIX_REGEXP, ''));
+}
+
+/**
+ * @ngdoc type
+ * @name $compile.directive.Attributes
+ *
+ * @description
+ * A shared object between directive compile / linking functions which contains normalized DOM
+ * element attributes. The values reflect current binding state `{{ }}`. The normalization is
+ * needed since all of these are treated as equivalent in Angular:
+ *
+ * ```
+ * <span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a">
+ * ```
+ */
+
+/**
+ * @ngdoc property
+ * @name $compile.directive.Attributes#$attr
+ *
+ * @description
+ * A map of DOM element attribute names to the normalized name. This is
+ * needed to do reverse lookup from normalized name back to actual name.
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$set
+ * @kind function
+ *
+ * @description
+ * Set DOM element attribute value.
+ *
+ *
+ * @param {string} name Normalized element attribute name of the property to modify. The name is
+ * reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}
+ * property to the original name.
+ * @param {string} value Value to set the attribute to. The value can be an interpolated string.
+ */
+
+
+
+/**
+ * Closure compiler type information
+ */
+
+function nodesetLinkingFn(
+ /* angular.Scope */ scope,
+ /* NodeList */ nodeList,
+ /* Element */ rootElement,
+ /* function(Function) */ boundTranscludeFn
+) {}
+
+function directiveLinkingFn(
+ /* nodesetLinkingFn */ nodesetLinkingFn,
+ /* angular.Scope */ scope,
+ /* Node */ node,
+ /* Element */ rootElement,
+ /* function(Function) */ boundTranscludeFn
+) {}
+
+function tokenDifference(str1, str2) {
+ var values = '',
+ tokens1 = str1.split(/\s+/),
+ tokens2 = str2.split(/\s+/);
+
+ outer:
+ for (var i = 0; i < tokens1.length; i++) {
+ var token = tokens1[i];
+ for (var j = 0; j < tokens2.length; j++) {
+ if (token == tokens2[j]) continue outer;
+ }
+ values += (values.length > 0 ? ' ' : '') + token;
+ }
+ return values;
+}
+
+function removeComments(jqNodes) {
+ jqNodes = jqLite(jqNodes);
+ var i = jqNodes.length;
+
+ if (i <= 1) {
+ return jqNodes;
+ }
+
+ while (i--) {
+ var node = jqNodes[i];
+ if (node.nodeType === NODE_TYPE_COMMENT) {
+ splice.call(jqNodes, i, 1);
+ }
+ }
+ return jqNodes;
+}
+
+var $controllerMinErr = minErr('$controller');
+
+
+var CNTRL_REG = /^(\S+)(\s+as\s+(\w+))?$/;
+function identifierForController(controller, ident) {
+ if (ident && isString(ident)) return ident;
+ if (isString(controller)) {
+ var match = CNTRL_REG.exec(controller);
+ if (match) return match[3];
+ }
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $controllerProvider
+ * @description
+ * The {@link ng.$controller $controller service} is used by Angular to create new
+ * controllers.
+ *
+ * This provider allows controller registration via the
+ * {@link ng.$controllerProvider#register register} method.
+ */
+function $ControllerProvider() {
+ var controllers = {},
+ globals = false;
+
+ /**
+ * @ngdoc method
+ * @name $controllerProvider#register
+ * @param {string|Object} name Controller name, or an object map of controllers where the keys are
+ * the names and the values are the constructors.
+ * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI
+ * annotations in the array notation).
+ */
+ this.register = function(name, constructor) {
+ assertNotHasOwnProperty(name, 'controller');
+ if (isObject(name)) {
+ extend(controllers, name);
+ } else {
+ controllers[name] = constructor;
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $controllerProvider#allowGlobals
+ * @description If called, allows `$controller` to find controller constructors on `window`
+ */
+ this.allowGlobals = function() {
+ globals = true;
+ };
+
+
+ this.$get = ['$injector', '$window', function($injector, $window) {
+
+ /**
+ * @ngdoc service
+ * @name $controller
+ * @requires $injector
+ *
+ * @param {Function|string} constructor If called with a function then it's considered to be the
+ * controller constructor function. Otherwise it's considered to be a string which is used
+ * to retrieve the controller constructor using the following steps:
+ *
+ * * check if a controller with given name is registered via `$controllerProvider`
+ * * check if evaluating the string on the current scope returns a constructor
+ * * if $controllerProvider#allowGlobals, check `window[constructor]` on the global
+ * `window` object (not recommended)
+ *
+ * The string can use the `controller as property` syntax, where the controller instance is published
+ * as the specified property on the `scope`; the `scope` must be injected into `locals` param for this
+ * to work correctly.
+ *
+ * @param {Object} locals Injection locals for Controller.
+ * @return {Object} Instance of given controller.
+ *
+ * @description
+ * `$controller` service is responsible for instantiating controllers.
+ *
+ * It's just a simple call to {@link auto.$injector $injector}, but extracted into
+ * a service, so that one can override this service with [BC version](https://gist.github.com/1649788).
+ */
+ return function(expression, locals, later, ident) {
+ // PRIVATE API:
+ // param `later` --- indicates that the controller's constructor is invoked at a later time.
+ // If true, $controller will allocate the object with the correct
+ // prototype chain, but will not invoke the controller until a returned
+ // callback is invoked.
+ // param `ident` --- An optional label which overrides the label parsed from the controller
+ // expression, if any.
+ var instance, match, constructor, identifier;
+ later = later === true;
+ if (ident && isString(ident)) {
+ identifier = ident;
+ }
+
+ if (isString(expression)) {
+ match = expression.match(CNTRL_REG);
+ if (!match) {
+ throw $controllerMinErr('ctrlfmt',
+ "Badly formed controller string '{0}'. " +
+ "Must match `__name__ as __id__` or `__name__`.", expression);
+ }
+ constructor = match[1],
+ identifier = identifier || match[3];
+ expression = controllers.hasOwnProperty(constructor)
+ ? controllers[constructor]
+ : getter(locals.$scope, constructor, true) ||
+ (globals ? getter($window, constructor, true) : undefined);
+
+ assertArgFn(expression, constructor, true);
+ }
+
+ if (later) {
+ // Instantiate controller later:
+ // This machinery is used to create an instance of the object before calling the
+ // controller's constructor itself.
+ //
+ // This allows properties to be added to the controller before the constructor is
+ // invoked. Primarily, this is used for isolate scope bindings in $compile.
+ //
+ // This feature is not intended for use by applications, and is thus not documented
+ // publicly.
+ // Object creation: http://jsperf.com/create-constructor/2
+ var controllerPrototype = (isArray(expression) ?
+ expression[expression.length - 1] : expression).prototype;
+ instance = Object.create(controllerPrototype || null);
+
+ if (identifier) {
+ addIdentifier(locals, identifier, instance, constructor || expression.name);
+ }
+
+ var instantiate;
+ return instantiate = extend(function() {
+ var result = $injector.invoke(expression, instance, locals, constructor);
+ if (result !== instance && (isObject(result) || isFunction(result))) {
+ instance = result;
+ if (identifier) {
+ // If result changed, re-assign controllerAs value to scope.
+ addIdentifier(locals, identifier, instance, constructor || expression.name);
+ }
+ }
+ return instance;
+ }, {
+ instance: instance,
+ identifier: identifier
+ });
+ }
+
+ instance = $injector.instantiate(expression, locals, constructor);
+
+ if (identifier) {
+ addIdentifier(locals, identifier, instance, constructor || expression.name);
+ }
+
+ return instance;
+ };
+
+ function addIdentifier(locals, identifier, instance, name) {
+ if (!(locals && isObject(locals.$scope))) {
+ throw minErr('$controller')('noscp',
+ "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",
+ name, identifier);
+ }
+
+ locals.$scope[identifier] = instance;
+ }
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $document
+ * @requires $window
+ *
+ * @description
+ * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.
+ *
+ * @example
+ <example module="documentExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <p>$document title: <b ng-bind="title"></b></p>
+ <p>window.document title: <b ng-bind="windowTitle"></b></p>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('documentExample', [])
+ .controller('ExampleController', ['$scope', '$document', function($scope, $document) {
+ $scope.title = $document[0].title;
+ $scope.windowTitle = angular.element(window.document)[0].title;
+ }]);
+ </file>
+ </example>
+ */
+function $DocumentProvider() {
+ this.$get = ['$window', function(window) {
+ return jqLite(window.document);
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $exceptionHandler
+ * @requires ng.$log
+ *
+ * @description
+ * Any uncaught exception in angular expressions is delegated to this service.
+ * The default implementation simply delegates to `$log.error` which logs it into
+ * the browser console.
+ *
+ * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by
+ * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.
+ *
+ * ## Example:
+ *
+ * ```js
+ * angular.module('exceptionOverride', []).factory('$exceptionHandler', function() {
+ * return function(exception, cause) {
+ * exception.message += ' (caused by "' + cause + '")';
+ * throw exception;
+ * };
+ * });
+ * ```
+ *
+ * This example will override the normal action of `$exceptionHandler`, to make angular
+ * exceptions fail hard when they happen, instead of just logging to the console.
+ *
+ * <hr />
+ * Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind`
+ * methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler}
+ * (unless executed during a digest).
+ *
+ * If you wish, you can manually delegate exceptions, e.g.
+ * `try { ... } catch(e) { $exceptionHandler(e); }`
+ *
+ * @param {Error} exception Exception associated with the error.
+ * @param {string=} cause optional information about the context in which
+ * the error was thrown.
+ *
+ */
+function $ExceptionHandlerProvider() {
+ this.$get = ['$log', function($log) {
+ return function(exception, cause) {
+ $log.error.apply($log, arguments);
+ };
+ }];
+}
+
+var $$ForceReflowProvider = function() {
+ this.$get = ['$document', function($document) {
+ return function(domNode) {
+ //the line below will force the browser to perform a repaint so
+ //that all the animated elements within the animation frame will
+ //be properly updated and drawn on screen. This is required to
+ //ensure that the preparation animation is properly flushed so that
+ //the active state picks up from there. DO NOT REMOVE THIS LINE.
+ //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH
+ //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND
+ //WILL TAKE YEARS AWAY FROM YOUR LIFE.
+ if (domNode) {
+ if (!domNode.nodeType && domNode instanceof jqLite) {
+ domNode = domNode[0];
+ }
+ } else {
+ domNode = $document[0].body;
+ }
+ return domNode.offsetWidth + 1;
+ };
+ }];
+};
+
+var APPLICATION_JSON = 'application/json';
+var CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': APPLICATION_JSON + ';charset=utf-8'};
+var JSON_START = /^\[|^\{(?!\{)/;
+var JSON_ENDS = {
+ '[': /]$/,
+ '{': /}$/
+};
+var JSON_PROTECTION_PREFIX = /^\)\]\}',?\n/;
+var $httpMinErr = minErr('$http');
+var $httpMinErrLegacyFn = function(method) {
+ return function() {
+ throw $httpMinErr('legacy', 'The method `{0}` on the promise returned from `$http` has been disabled.', method);
+ };
+};
+
+function serializeValue(v) {
+ if (isObject(v)) {
+ return isDate(v) ? v.toISOString() : toJson(v);
+ }
+ return v;
+}
+
+
+function $HttpParamSerializerProvider() {
+ /**
+ * @ngdoc service
+ * @name $httpParamSerializer
+ * @description
+ *
+ * Default {@link $http `$http`} params serializer that converts objects to strings
+ * according to the following rules:
+ *
+ * * `{'foo': 'bar'}` results in `foo=bar`
+ * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object)
+ * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element)
+ * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D"` (stringified and encoded representation of an object)
+ *
+ * Note that serializer will sort the request parameters alphabetically.
+ * */
+
+ this.$get = function() {
+ return function ngParamSerializer(params) {
+ if (!params) return '';
+ var parts = [];
+ forEachSorted(params, function(value, key) {
+ if (value === null || isUndefined(value)) return;
+ if (isArray(value)) {
+ forEach(value, function(v, k) {
+ parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v)));
+ });
+ } else {
+ parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value)));
+ }
+ });
+
+ return parts.join('&');
+ };
+ };
+}
+
+function $HttpParamSerializerJQLikeProvider() {
+ /**
+ * @ngdoc service
+ * @name $httpParamSerializerJQLike
+ * @description
+ *
+ * Alternative {@link $http `$http`} params serializer that follows
+ * jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.
+ * The serializer will also sort the params alphabetically.
+ *
+ * To use it for serializing `$http` request parameters, set it as the `paramSerializer` property:
+ *
+ * ```js
+ * $http({
+ * url: myUrl,
+ * method: 'GET',
+ * params: myParams,
+ * paramSerializer: '$httpParamSerializerJQLike'
+ * });
+ * ```
+ *
+ * It is also possible to set it as the default `paramSerializer` in the
+ * {@link $httpProvider#defaults `$httpProvider`}.
+ *
+ * Additionally, you can inject the serializer and use it explicitly, for example to serialize
+ * form data for submission:
+ *
+ * ```js
+ * .controller(function($http, $httpParamSerializerJQLike) {
+ * //...
+ *
+ * $http({
+ * url: myUrl,
+ * method: 'POST',
+ * data: $httpParamSerializerJQLike(myData),
+ * headers: {
+ * 'Content-Type': 'application/x-www-form-urlencoded'
+ * }
+ * });
+ *
+ * });
+ * ```
+ *
+ * */
+ this.$get = function() {
+ return function jQueryLikeParamSerializer(params) {
+ if (!params) return '';
+ var parts = [];
+ serialize(params, '', true);
+ return parts.join('&');
+
+ function serialize(toSerialize, prefix, topLevel) {
+ if (toSerialize === null || isUndefined(toSerialize)) return;
+ if (isArray(toSerialize)) {
+ forEach(toSerialize, function(value, index) {
+ serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']');
+ });
+ } else if (isObject(toSerialize) && !isDate(toSerialize)) {
+ forEachSorted(toSerialize, function(value, key) {
+ serialize(value, prefix +
+ (topLevel ? '' : '[') +
+ key +
+ (topLevel ? '' : ']'));
+ });
+ } else {
+ parts.push(encodeUriQuery(prefix) + '=' + encodeUriQuery(serializeValue(toSerialize)));
+ }
+ }
+ };
+ };
+}
+
+function defaultHttpResponseTransform(data, headers) {
+ if (isString(data)) {
+ // Strip json vulnerability protection prefix and trim whitespace
+ var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim();
+
+ if (tempData) {
+ var contentType = headers('Content-Type');
+ if ((contentType && (contentType.indexOf(APPLICATION_JSON) === 0)) || isJsonLike(tempData)) {
+ data = fromJson(tempData);
+ }
+ }
+ }
+
+ return data;
+}
+
+function isJsonLike(str) {
+ var jsonStart = str.match(JSON_START);
+ return jsonStart && JSON_ENDS[jsonStart[0]].test(str);
+}
+
+/**
+ * Parse headers into key value object
+ *
+ * @param {string} headers Raw headers as a string
+ * @returns {Object} Parsed headers as key value object
+ */
+function parseHeaders(headers) {
+ var parsed = createMap(), i;
+
+ function fillInParsed(key, val) {
+ if (key) {
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
+ }
+ }
+
+ if (isString(headers)) {
+ forEach(headers.split('\n'), function(line) {
+ i = line.indexOf(':');
+ fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));
+ });
+ } else if (isObject(headers)) {
+ forEach(headers, function(headerVal, headerKey) {
+ fillInParsed(lowercase(headerKey), trim(headerVal));
+ });
+ }
+
+ return parsed;
+}
+
+
+/**
+ * Returns a function that provides access to parsed headers.
+ *
+ * Headers are lazy parsed when first requested.
+ * @see parseHeaders
+ *
+ * @param {(string|Object)} headers Headers to provide access to.
+ * @returns {function(string=)} Returns a getter function which if called with:
+ *
+ * - if called with single an argument returns a single header value or null
+ * - if called with no arguments returns an object containing all headers.
+ */
+function headersGetter(headers) {
+ var headersObj;
+
+ return function(name) {
+ if (!headersObj) headersObj = parseHeaders(headers);
+
+ if (name) {
+ var value = headersObj[lowercase(name)];
+ if (value === void 0) {
+ value = null;
+ }
+ return value;
+ }
+
+ return headersObj;
+ };
+}
+
+
+/**
+ * Chain all given functions
+ *
+ * This function is used for both request and response transforming
+ *
+ * @param {*} data Data to transform.
+ * @param {function(string=)} headers HTTP headers getter fn.
+ * @param {number} status HTTP status code of the response.
+ * @param {(Function|Array.<Function>)} fns Function or an array of functions.
+ * @returns {*} Transformed data.
+ */
+function transformData(data, headers, status, fns) {
+ if (isFunction(fns)) {
+ return fns(data, headers, status);
+ }
+
+ forEach(fns, function(fn) {
+ data = fn(data, headers, status);
+ });
+
+ return data;
+}
+
+
+function isSuccess(status) {
+ return 200 <= status && status < 300;
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $httpProvider
+ * @description
+ * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
+ * */
+function $HttpProvider() {
+ /**
+ * @ngdoc property
+ * @name $httpProvider#defaults
+ * @description
+ *
+ * Object containing default values for all {@link ng.$http $http} requests.
+ *
+ * - **`defaults.cache`** - {Object} - an object built with {@link ng.$cacheFactory `$cacheFactory`}
+ * that will provide the cache for all requests who set their `cache` property to `true`.
+ * If you set the `defaults.cache = false` then only requests that specify their own custom
+ * cache object will be cached. See {@link $http#caching $http Caching} for more information.
+ *
+ * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
+ * Defaults value is `'XSRF-TOKEN'`.
+ *
+ * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
+ * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
+ *
+ * - **`defaults.headers`** - {Object} - Default headers for all $http requests.
+ * Refer to {@link ng.$http#setting-http-headers $http} for documentation on
+ * setting default headers.
+ * - **`defaults.headers.common`**
+ * - **`defaults.headers.post`**
+ * - **`defaults.headers.put`**
+ * - **`defaults.headers.patch`**
+ *
+ *
+ * - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function
+ * used to the prepare string representation of request parameters (specified as an object).
+ * If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.
+ * Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.
+ *
+ **/
+ var defaults = this.defaults = {
+ // transform incoming response data
+ transformResponse: [defaultHttpResponseTransform],
+
+ // transform outgoing request data
+ transformRequest: [function(d) {
+ return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d;
+ }],
+
+ // default headers
+ headers: {
+ common: {
+ 'Accept': 'application/json, text/plain, */*'
+ },
+ post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
+ put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
+ patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON)
+ },
+
+ xsrfCookieName: 'XSRF-TOKEN',
+ xsrfHeaderName: 'X-XSRF-TOKEN',
+
+ paramSerializer: '$httpParamSerializer'
+ };
+
+ var useApplyAsync = false;
+ /**
+ * @ngdoc method
+ * @name $httpProvider#useApplyAsync
+ * @description
+ *
+ * Configure $http service to combine processing of multiple http responses received at around
+ * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in
+ * significant performance improvement for bigger applications that make many HTTP requests
+ * concurrently (common during application bootstrap).
+ *
+ * Defaults to false. If no value is specified, returns the current configured value.
+ *
+ * @param {boolean=} value If true, when requests are loaded, they will schedule a deferred
+ * "apply" on the next tick, giving time for subsequent requests in a roughly ~10ms window
+ * to load and share the same digest cycle.
+ *
+ * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.
+ * otherwise, returns the current configured value.
+ **/
+ this.useApplyAsync = function(value) {
+ if (isDefined(value)) {
+ useApplyAsync = !!value;
+ return this;
+ }
+ return useApplyAsync;
+ };
+
+ var useLegacyPromise = true;
+ /**
+ * @ngdoc method
+ * @name $httpProvider#useLegacyPromiseExtensions
+ * @description
+ *
+ * Configure `$http` service to return promises without the shorthand methods `success` and `error`.
+ * This should be used to make sure that applications work without these methods.
+ *
+ * Defaults to true. If no value is specified, returns the current configured value.
+ *
+ * @param {boolean=} value If true, `$http` will return a promise with the deprecated legacy `success` and `error` methods.
+ *
+ * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.
+ * otherwise, returns the current configured value.
+ **/
+ this.useLegacyPromiseExtensions = function(value) {
+ if (isDefined(value)) {
+ useLegacyPromise = !!value;
+ return this;
+ }
+ return useLegacyPromise;
+ };
+
+ /**
+ * @ngdoc property
+ * @name $httpProvider#interceptors
+ * @description
+ *
+ * Array containing service factories for all synchronous or asynchronous {@link ng.$http $http}
+ * pre-processing of request or postprocessing of responses.
+ *
+ * These service factories are ordered by request, i.e. they are applied in the same order as the
+ * array, on request, but reverse order, on response.
+ *
+ * {@link ng.$http#interceptors Interceptors detailed info}
+ **/
+ var interceptorFactories = this.interceptors = [];
+
+ this.$get = ['$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector',
+ function($httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector) {
+
+ var defaultCache = $cacheFactory('$http');
+
+ /**
+ * Make sure that default param serializer is exposed as a function
+ */
+ defaults.paramSerializer = isString(defaults.paramSerializer) ?
+ $injector.get(defaults.paramSerializer) : defaults.paramSerializer;
+
+ /**
+ * Interceptors stored in reverse order. Inner interceptors before outer interceptors.
+ * The reversal is needed so that we can build up the interception chain around the
+ * server request.
+ */
+ var reversedInterceptors = [];
+
+ forEach(interceptorFactories, function(interceptorFactory) {
+ reversedInterceptors.unshift(isString(interceptorFactory)
+ ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));
+ });
+
+ /**
+ * @ngdoc service
+ * @kind function
+ * @name $http
+ * @requires ng.$httpBackend
+ * @requires $cacheFactory
+ * @requires $rootScope
+ * @requires $q
+ * @requires $injector
+ *
+ * @description
+ * The `$http` service is a core Angular service that facilitates communication with the remote
+ * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest)
+ * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP).
+ *
+ * For unit testing applications that use `$http` service, see
+ * {@link ngMock.$httpBackend $httpBackend mock}.
+ *
+ * For a higher level of abstraction, please check out the {@link ngResource.$resource
+ * $resource} service.
+ *
+ * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by
+ * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage
+ * it is important to familiarize yourself with these APIs and the guarantees they provide.
+ *
+ *
+ * ## General usage
+ * The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object} —
+ * that is used to generate an HTTP request and returns a {@link ng.$q promise}.
+ *
+ * ```js
+ * // Simple GET request example:
+ * $http({
+ * method: 'GET',
+ * url: '/someUrl'
+ * }).then(function successCallback(response) {
+ * // this callback will be called asynchronously
+ * // when the response is available
+ * }, function errorCallback(response) {
+ * // called asynchronously if an error occurs
+ * // or server returns response with an error status.
+ * });
+ * ```
+ *
+ * The response object has these properties:
+ *
+ * - **data** – `{string|Object}` – The response body transformed with the transform
+ * functions.
+ * - **status** – `{number}` – HTTP status code of the response.
+ * - **headers** – `{function([headerName])}` – Header getter function.
+ * - **config** – `{Object}` – The configuration object that was used to generate the request.
+ * - **statusText** – `{string}` – HTTP status text of the response.
+ *
+ * A response status code between 200 and 299 is considered a success status and
+ * will result in the success callback being called. Note that if the response is a redirect,
+ * XMLHttpRequest will transparently follow it, meaning that the error callback will not be
+ * called for such responses.
+ *
+ *
+ * ## Shortcut methods
+ *
+ * Shortcut methods are also available. All shortcut methods require passing in the URL, and
+ * request data must be passed in for POST/PUT requests. An optional config can be passed as the
+ * last argument.
+ *
+ * ```js
+ * $http.get('/someUrl', config).then(successCallback, errorCallback);
+ * $http.post('/someUrl', data, config).then(successCallback, errorCallback);
+ * ```
+ *
+ * Complete list of shortcut methods:
+ *
+ * - {@link ng.$http#get $http.get}
+ * - {@link ng.$http#head $http.head}
+ * - {@link ng.$http#post $http.post}
+ * - {@link ng.$http#put $http.put}
+ * - {@link ng.$http#delete $http.delete}
+ * - {@link ng.$http#jsonp $http.jsonp}
+ * - {@link ng.$http#patch $http.patch}
+ *
+ *
+ * ## Writing Unit Tests that use $http
+ * When unit testing (using {@link ngMock ngMock}), it is necessary to call
+ * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending
+ * request using trained responses.
+ *
+ * ```
+ * $httpBackend.expectGET(...);
+ * $http.get(...);
+ * $httpBackend.flush();
+ * ```
+ *
+ * ## Deprecation Notice
+ * <div class="alert alert-danger">
+ * The `$http` legacy promise methods `success` and `error` have been deprecated.
+ * Use the standard `then` method instead.
+ * If {@link $httpProvider#useLegacyPromiseExtensions `$httpProvider.useLegacyPromiseExtensions`} is set to
+ * `false` then these methods will throw {@link $http:legacy `$http/legacy`} error.
+ * </div>
+ *
+ * ## Setting HTTP Headers
+ *
+ * The $http service will automatically add certain HTTP headers to all requests. These defaults
+ * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration
+ * object, which currently contains this default configuration:
+ *
+ * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):
+ * - `Accept: application/json, text/plain, * / *`
+ * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)
+ * - `Content-Type: application/json`
+ * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)
+ * - `Content-Type: application/json`
+ *
+ * To add or overwrite these defaults, simply add or remove a property from these configuration
+ * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object
+ * with the lowercased HTTP method name as the key, e.g.
+ * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }`.
+ *
+ * The defaults can also be set at runtime via the `$http.defaults` object in the same
+ * fashion. For example:
+ *
+ * ```
+ * module.run(function($http) {
+ * $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w';
+ * });
+ * ```
+ *
+ * In addition, you can supply a `headers` property in the config object passed when
+ * calling `$http(config)`, which overrides the defaults without changing them globally.
+ *
+ * To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis,
+ * Use the `headers` property, setting the desired header to `undefined`. For example:
+ *
+ * ```js
+ * var req = {
+ * method: 'POST',
+ * url: 'http://example.com',
+ * headers: {
+ * 'Content-Type': undefined
+ * },
+ * data: { test: 'test' }
+ * }
+ *
+ * $http(req).then(function(){...}, function(){...});
+ * ```
+ *
+ * ## Transforming Requests and Responses
+ *
+ * Both requests and responses can be transformed using transformation functions: `transformRequest`
+ * and `transformResponse`. These properties can be a single function that returns
+ * the transformed value (`function(data, headersGetter, status)`) or an array of such transformation functions,
+ * which allows you to `push` or `unshift` a new transformation function into the transformation chain.
+ *
+ * ### Default Transformations
+ *
+ * The `$httpProvider` provider and `$http` service expose `defaults.transformRequest` and
+ * `defaults.transformResponse` properties. If a request does not provide its own transformations
+ * then these will be applied.
+ *
+ * You can augment or replace the default transformations by modifying these properties by adding to or
+ * replacing the array.
+ *
+ * Angular provides the following default transformations:
+ *
+ * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`):
+ *
+ * - If the `data` property of the request configuration object contains an object, serialize it
+ * into JSON format.
+ *
+ * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`):
+ *
+ * - If XSRF prefix is detected, strip it (see Security Considerations section below).
+ * - If JSON response is detected, deserialize it using a JSON parser.
+ *
+ *
+ * ### Overriding the Default Transformations Per Request
+ *
+ * If you wish override the request/response transformations only for a single request then provide
+ * `transformRequest` and/or `transformResponse` properties on the configuration object passed
+ * into `$http`.
+ *
+ * Note that if you provide these properties on the config object the default transformations will be
+ * overwritten. If you wish to augment the default transformations then you must include them in your
+ * local transformation array.
+ *
+ * The following code demonstrates adding a new response transformation to be run after the default response
+ * transformations have been run.
+ *
+ * ```js
+ * function appendTransform(defaults, transform) {
+ *
+ * // We can't guarantee that the default transformation is an array
+ * defaults = angular.isArray(defaults) ? defaults : [defaults];
+ *
+ * // Append the new transformation to the defaults
+ * return defaults.concat(transform);
+ * }
+ *
+ * $http({
+ * url: '...',
+ * method: 'GET',
+ * transformResponse: appendTransform($http.defaults.transformResponse, function(value) {
+ * return doTransform(value);
+ * })
+ * });
+ * ```
+ *
+ *
+ * ## Caching
+ *
+ * To enable caching, set the request configuration `cache` property to `true` (to use default
+ * cache) or to a custom cache object (built with {@link ng.$cacheFactory `$cacheFactory`}).
+ * When the cache is enabled, `$http` stores the response from the server in the specified
+ * cache. The next time the same request is made, the response is served from the cache without
+ * sending a request to the server.
+ *
+ * Note that even if the response is served from cache, delivery of the data is asynchronous in
+ * the same way that real requests are.
+ *
+ * If there are multiple GET requests for the same URL that should be cached using the same
+ * cache, but the cache is not populated yet, only one request to the server will be made and
+ * the remaining requests will be fulfilled using the response from the first request.
+ *
+ * You can change the default cache to a new object (built with
+ * {@link ng.$cacheFactory `$cacheFactory`}) by updating the
+ * {@link ng.$http#defaults `$http.defaults.cache`} property. All requests who set
+ * their `cache` property to `true` will now use this cache object.
+ *
+ * If you set the default cache to `false` then only requests that specify their own custom
+ * cache object will be cached.
+ *
+ * ## Interceptors
+ *
+ * Before you start creating interceptors, be sure to understand the
+ * {@link ng.$q $q and deferred/promise APIs}.
+ *
+ * For purposes of global error handling, authentication, or any kind of synchronous or
+ * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be
+ * able to intercept requests before they are handed to the server and
+ * responses before they are handed over to the application code that
+ * initiated these requests. The interceptors leverage the {@link ng.$q
+ * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing.
+ *
+ * The interceptors are service factories that are registered with the `$httpProvider` by
+ * adding them to the `$httpProvider.interceptors` array. The factory is called and
+ * injected with dependencies (if specified) and returns the interceptor.
+ *
+ * There are two kinds of interceptors (and two kinds of rejection interceptors):
+ *
+ * * `request`: interceptors get called with a http {@link $http#usage config} object. The function is free to
+ * modify the `config` object or create a new one. The function needs to return the `config`
+ * object directly, or a promise containing the `config` or a new `config` object.
+ * * `requestError`: interceptor gets called when a previous interceptor threw an error or
+ * resolved with a rejection.
+ * * `response`: interceptors get called with http `response` object. The function is free to
+ * modify the `response` object or create a new one. The function needs to return the `response`
+ * object directly, or as a promise containing the `response` or a new `response` object.
+ * * `responseError`: interceptor gets called when a previous interceptor threw an error or
+ * resolved with a rejection.
+ *
+ *
+ * ```js
+ * // register the interceptor as a service
+ * $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
+ * return {
+ * // optional method
+ * 'request': function(config) {
+ * // do something on success
+ * return config;
+ * },
+ *
+ * // optional method
+ * 'requestError': function(rejection) {
+ * // do something on error
+ * if (canRecover(rejection)) {
+ * return responseOrNewPromise
+ * }
+ * return $q.reject(rejection);
+ * },
+ *
+ *
+ *
+ * // optional method
+ * 'response': function(response) {
+ * // do something on success
+ * return response;
+ * },
+ *
+ * // optional method
+ * 'responseError': function(rejection) {
+ * // do something on error
+ * if (canRecover(rejection)) {
+ * return responseOrNewPromise
+ * }
+ * return $q.reject(rejection);
+ * }
+ * };
+ * });
+ *
+ * $httpProvider.interceptors.push('myHttpInterceptor');
+ *
+ *
+ * // alternatively, register the interceptor via an anonymous factory
+ * $httpProvider.interceptors.push(function($q, dependency1, dependency2) {
+ * return {
+ * 'request': function(config) {
+ * // same as above
+ * },
+ *
+ * 'response': function(response) {
+ * // same as above
+ * }
+ * };
+ * });
+ * ```
+ *
+ * ## Security Considerations
+ *
+ * When designing web applications, consider security threats from:
+ *
+ * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)
+ * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
+ *
+ * Both server and the client must cooperate in order to eliminate these threats. Angular comes
+ * pre-configured with strategies that address these issues, but for this to work backend server
+ * cooperation is required.
+ *
+ * ### JSON Vulnerability Protection
+ *
+ * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)
+ * allows third party website to turn your JSON resource URL into
+ * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To
+ * counter this your server can prefix all JSON requests with following string `")]}',\n"`.
+ * Angular will automatically strip the prefix before processing it as JSON.
+ *
+ * For example if your server needs to return:
+ * ```js
+ * ['one','two']
+ * ```
+ *
+ * which is vulnerable to attack, your server can return:
+ * ```js
+ * )]}',
+ * ['one','two']
+ * ```
+ *
+ * Angular will strip the prefix, before processing the JSON.
+ *
+ *
+ * ### Cross Site Request Forgery (XSRF) Protection
+ *
+ * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is a technique by which
+ * an unauthorized site can gain your user's private data. Angular provides a mechanism
+ * to counter XSRF. When performing XHR requests, the $http service reads a token from a cookie
+ * (by default, `XSRF-TOKEN`) and sets it as an HTTP header (`X-XSRF-TOKEN`). Since only
+ * JavaScript that runs on your domain could read the cookie, your server can be assured that
+ * the XHR came from JavaScript running on your domain. The header will not be set for
+ * cross-domain requests.
+ *
+ * To take advantage of this, your server needs to set a token in a JavaScript readable session
+ * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the
+ * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure
+ * that only JavaScript running on your domain could have sent the request. The token must be
+ * unique for each user and must be verifiable by the server (to prevent the JavaScript from
+ * making up its own tokens). We recommend that the token is a digest of your site's
+ * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography&#41;)
+ * for added security.
+ *
+ * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName
+ * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,
+ * or the per-request config object.
+ *
+ * In order to prevent collisions in environments where multiple Angular apps share the
+ * same domain or subdomain, we recommend that each application uses unique cookie name.
+ *
+ * @param {object} config Object describing the request to be made and how it should be
+ * processed. The object has following properties:
+ *
+ * - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)
+ * - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.
+ * - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be serialized
+ * with the `paramSerializer` and appended as GET parameters.
+ * - **data** – `{string|Object}` – Data to be sent as the request message data.
+ * - **headers** – `{Object}` – Map of strings or functions which return strings representing
+ * HTTP headers to send to the server. If the return value of a function is null, the
+ * header will not be sent. Functions accept a config object as an argument.
+ * - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token.
+ * - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token.
+ * - **transformRequest** –
+ * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
+ * transform function or an array of such functions. The transform function takes the http
+ * request body and headers and returns its transformed (typically serialized) version.
+ * See {@link ng.$http#overriding-the-default-transformations-per-request
+ * Overriding the Default Transformations}
+ * - **transformResponse** –
+ * `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` –
+ * transform function or an array of such functions. The transform function takes the http
+ * response body, headers and status and returns its transformed (typically deserialized) version.
+ * See {@link ng.$http#overriding-the-default-transformations-per-request
+ * Overriding the Default TransformationjqLiks}
+ * - **paramSerializer** - `{string|function(Object<string,string>):string}` - A function used to
+ * prepare the string representation of request parameters (specified as an object).
+ * If specified as string, it is interpreted as function registered with the
+ * {@link $injector $injector}, which means you can create your own serializer
+ * by registering it as a {@link auto.$provide#service service}.
+ * The default serializer is the {@link $httpParamSerializer $httpParamSerializer};
+ * alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike}
+ * - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
+ * GET request, otherwise if a cache instance built with
+ * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
+ * caching.
+ * - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}
+ * that should abort the request when resolved.
+ * - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the
+ * XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials)
+ * for more information.
+ * - **responseType** - `{string}` - see
+ * [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype).
+ *
+ * @returns {HttpPromise} Returns a {@link ng.$q `Promise}` that will be resolved to a response object
+ * when the request succeeds or fails.
+ *
+ *
+ * @property {Array.<Object>} pendingRequests Array of config objects for currently pending
+ * requests. This is primarily meant to be used for debugging purposes.
+ *
+ *
+ * @example
+<example module="httpExample">
+<file name="index.html">
+ <div ng-controller="FetchController">
+ <select ng-model="method" aria-label="Request method">
+ <option>GET</option>
+ <option>JSONP</option>
+ </select>
+ <input type="text" ng-model="url" size="80" aria-label="URL" />
+ <button id="fetchbtn" ng-click="fetch()">fetch</button><br>
+ <button id="samplegetbtn" ng-click="updateModel('GET', 'http-hello.html')">Sample GET</button>
+ <button id="samplejsonpbtn"
+ ng-click="updateModel('JSONP',
+ 'https://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">
+ Sample JSONP
+ </button>
+ <button id="invalidjsonpbtn"
+ ng-click="updateModel('JSONP', 'https://angularjs.org/doesntexist&callback=JSON_CALLBACK')">
+ Invalid JSONP
+ </button>
+ <pre>http status code: {{status}}</pre>
+ <pre>http response data: {{data}}</pre>
+ </div>
+</file>
+<file name="script.js">
+ angular.module('httpExample', [])
+ .controller('FetchController', ['$scope', '$http', '$templateCache',
+ function($scope, $http, $templateCache) {
+ $scope.method = 'GET';
+ $scope.url = 'http-hello.html';
+
+ $scope.fetch = function() {
+ $scope.code = null;
+ $scope.response = null;
+
+ $http({method: $scope.method, url: $scope.url, cache: $templateCache}).
+ then(function(response) {
+ $scope.status = response.status;
+ $scope.data = response.data;
+ }, function(response) {
+ $scope.data = response.data || "Request failed";
+ $scope.status = response.status;
+ });
+ };
+
+ $scope.updateModel = function(method, url) {
+ $scope.method = method;
+ $scope.url = url;
+ };
+ }]);
+</file>
+<file name="http-hello.html">
+ Hello, $http!
+</file>
+<file name="protractor.js" type="protractor">
+ var status = element(by.binding('status'));
+ var data = element(by.binding('data'));
+ var fetchBtn = element(by.id('fetchbtn'));
+ var sampleGetBtn = element(by.id('samplegetbtn'));
+ var sampleJsonpBtn = element(by.id('samplejsonpbtn'));
+ var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));
+
+ it('should make an xhr GET request', function() {
+ sampleGetBtn.click();
+ fetchBtn.click();
+ expect(status.getText()).toMatch('200');
+ expect(data.getText()).toMatch(/Hello, \$http!/);
+ });
+
+// Commented out due to flakes. See https://github.com/angular/angular.js/issues/9185
+// it('should make a JSONP request to angularjs.org', function() {
+// sampleJsonpBtn.click();
+// fetchBtn.click();
+// expect(status.getText()).toMatch('200');
+// expect(data.getText()).toMatch(/Super Hero!/);
+// });
+
+ it('should make JSONP request to invalid URL and invoke the error handler',
+ function() {
+ invalidJsonpBtn.click();
+ fetchBtn.click();
+ expect(status.getText()).toMatch('0');
+ expect(data.getText()).toMatch('Request failed');
+ });
+</file>
+</example>
+ */
+ function $http(requestConfig) {
+
+ if (!isObject(requestConfig)) {
+ throw minErr('$http')('badreq', 'Http request configuration must be an object. Received: {0}', requestConfig);
+ }
+
+ var config = extend({
+ method: 'get',
+ transformRequest: defaults.transformRequest,
+ transformResponse: defaults.transformResponse,
+ paramSerializer: defaults.paramSerializer
+ }, requestConfig);
+
+ config.headers = mergeHeaders(requestConfig);
+ config.method = uppercase(config.method);
+ config.paramSerializer = isString(config.paramSerializer) ?
+ $injector.get(config.paramSerializer) : config.paramSerializer;
+
+ var serverRequest = function(config) {
+ var headers = config.headers;
+ var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest);
+
+ // strip content-type if data is undefined
+ if (isUndefined(reqData)) {
+ forEach(headers, function(value, header) {
+ if (lowercase(header) === 'content-type') {
+ delete headers[header];
+ }
+ });
+ }
+
+ if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {
+ config.withCredentials = defaults.withCredentials;
+ }
+
+ // send request
+ return sendReq(config, reqData).then(transformResponse, transformResponse);
+ };
+
+ var chain = [serverRequest, undefined];
+ var promise = $q.when(config);
+
+ // apply interceptors
+ forEach(reversedInterceptors, function(interceptor) {
+ if (interceptor.request || interceptor.requestError) {
+ chain.unshift(interceptor.request, interceptor.requestError);
+ }
+ if (interceptor.response || interceptor.responseError) {
+ chain.push(interceptor.response, interceptor.responseError);
+ }
+ });
+
+ while (chain.length) {
+ var thenFn = chain.shift();
+ var rejectFn = chain.shift();
+
+ promise = promise.then(thenFn, rejectFn);
+ }
+
+ if (useLegacyPromise) {
+ promise.success = function(fn) {
+ assertArgFn(fn, 'fn');
+
+ promise.then(function(response) {
+ fn(response.data, response.status, response.headers, config);
+ });
+ return promise;
+ };
+
+ promise.error = function(fn) {
+ assertArgFn(fn, 'fn');
+
+ promise.then(null, function(response) {
+ fn(response.data, response.status, response.headers, config);
+ });
+ return promise;
+ };
+ } else {
+ promise.success = $httpMinErrLegacyFn('success');
+ promise.error = $httpMinErrLegacyFn('error');
+ }
+
+ return promise;
+
+ function transformResponse(response) {
+ // make a copy since the response must be cacheable
+ var resp = extend({}, response);
+ resp.data = transformData(response.data, response.headers, response.status,
+ config.transformResponse);
+ return (isSuccess(response.status))
+ ? resp
+ : $q.reject(resp);
+ }
+
+ function executeHeaderFns(headers, config) {
+ var headerContent, processedHeaders = {};
+
+ forEach(headers, function(headerFn, header) {
+ if (isFunction(headerFn)) {
+ headerContent = headerFn(config);
+ if (headerContent != null) {
+ processedHeaders[header] = headerContent;
+ }
+ } else {
+ processedHeaders[header] = headerFn;
+ }
+ });
+
+ return processedHeaders;
+ }
+
+ function mergeHeaders(config) {
+ var defHeaders = defaults.headers,
+ reqHeaders = extend({}, config.headers),
+ defHeaderName, lowercaseDefHeaderName, reqHeaderName;
+
+ defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);
+
+ // using for-in instead of forEach to avoid unecessary iteration after header has been found
+ defaultHeadersIteration:
+ for (defHeaderName in defHeaders) {
+ lowercaseDefHeaderName = lowercase(defHeaderName);
+
+ for (reqHeaderName in reqHeaders) {
+ if (lowercase(reqHeaderName) === lowercaseDefHeaderName) {
+ continue defaultHeadersIteration;
+ }
+ }
+
+ reqHeaders[defHeaderName] = defHeaders[defHeaderName];
+ }
+
+ // execute if header value is a function for merged headers
+ return executeHeaderFns(reqHeaders, shallowCopy(config));
+ }
+ }
+
+ $http.pendingRequests = [];
+
+ /**
+ * @ngdoc method
+ * @name $http#get
+ *
+ * @description
+ * Shortcut method to perform `GET` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#delete
+ *
+ * @description
+ * Shortcut method to perform `DELETE` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#head
+ *
+ * @description
+ * Shortcut method to perform `HEAD` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#jsonp
+ *
+ * @description
+ * Shortcut method to perform `JSONP` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request.
+ * The name of the callback should be the string `JSON_CALLBACK`.
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+ createShortMethods('get', 'delete', 'head', 'jsonp');
+
+ /**
+ * @ngdoc method
+ * @name $http#post
+ *
+ * @description
+ * Shortcut method to perform `POST` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {*} data Request content
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#put
+ *
+ * @description
+ * Shortcut method to perform `PUT` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {*} data Request content
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+
+ /**
+ * @ngdoc method
+ * @name $http#patch
+ *
+ * @description
+ * Shortcut method to perform `PATCH` request.
+ *
+ * @param {string} url Relative or absolute URL specifying the destination of the request
+ * @param {*} data Request content
+ * @param {Object=} config Optional configuration object
+ * @returns {HttpPromise} Future object
+ */
+ createShortMethodsWithData('post', 'put', 'patch');
+
+ /**
+ * @ngdoc property
+ * @name $http#defaults
+ *
+ * @description
+ * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of
+ * default headers, withCredentials as well as request and response transformations.
+ *
+ * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above.
+ */
+ $http.defaults = defaults;
+
+
+ return $http;
+
+
+ function createShortMethods(names) {
+ forEach(arguments, function(name) {
+ $http[name] = function(url, config) {
+ return $http(extend({}, config || {}, {
+ method: name,
+ url: url
+ }));
+ };
+ });
+ }
+
+
+ function createShortMethodsWithData(name) {
+ forEach(arguments, function(name) {
+ $http[name] = function(url, data, config) {
+ return $http(extend({}, config || {}, {
+ method: name,
+ url: url,
+ data: data
+ }));
+ };
+ });
+ }
+
+
+ /**
+ * Makes the request.
+ *
+ * !!! ACCESSES CLOSURE VARS:
+ * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests
+ */
+ function sendReq(config, reqData) {
+ var deferred = $q.defer(),
+ promise = deferred.promise,
+ cache,
+ cachedResp,
+ reqHeaders = config.headers,
+ url = buildUrl(config.url, config.paramSerializer(config.params));
+
+ $http.pendingRequests.push(config);
+ promise.then(removePendingReq, removePendingReq);
+
+
+ if ((config.cache || defaults.cache) && config.cache !== false &&
+ (config.method === 'GET' || config.method === 'JSONP')) {
+ cache = isObject(config.cache) ? config.cache
+ : isObject(defaults.cache) ? defaults.cache
+ : defaultCache;
+ }
+
+ if (cache) {
+ cachedResp = cache.get(url);
+ if (isDefined(cachedResp)) {
+ if (isPromiseLike(cachedResp)) {
+ // cached request has already been sent, but there is no response yet
+ cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult);
+ } else {
+ // serving from cache
+ if (isArray(cachedResp)) {
+ resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);
+ } else {
+ resolvePromise(cachedResp, 200, {}, 'OK');
+ }
+ }
+ } else {
+ // put the promise for the non-transformed response into cache as a placeholder
+ cache.put(url, promise);
+ }
+ }
+
+
+ // if we won't have the response in cache, set the xsrf headers and
+ // send the request to the backend
+ if (isUndefined(cachedResp)) {
+ var xsrfValue = urlIsSameOrigin(config.url)
+ ? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName]
+ : undefined;
+ if (xsrfValue) {
+ reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;
+ }
+
+ $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,
+ config.withCredentials, config.responseType);
+ }
+
+ return promise;
+
+
+ /**
+ * Callback registered to $httpBackend():
+ * - caches the response if desired
+ * - resolves the raw $http promise
+ * - calls $apply
+ */
+ function done(status, response, headersString, statusText) {
+ if (cache) {
+ if (isSuccess(status)) {
+ cache.put(url, [status, response, parseHeaders(headersString), statusText]);
+ } else {
+ // remove promise from the cache
+ cache.remove(url);
+ }
+ }
+
+ function resolveHttpPromise() {
+ resolvePromise(response, status, headersString, statusText);
+ }
+
+ if (useApplyAsync) {
+ $rootScope.$applyAsync(resolveHttpPromise);
+ } else {
+ resolveHttpPromise();
+ if (!$rootScope.$$phase) $rootScope.$apply();
+ }
+ }
+
+
+ /**
+ * Resolves the raw $http promise.
+ */
+ function resolvePromise(response, status, headers, statusText) {
+ //status: HTTP response status code, 0, -1 (aborted by timeout / promise)
+ status = status >= -1 ? status : 0;
+
+ (isSuccess(status) ? deferred.resolve : deferred.reject)({
+ data: response,
+ status: status,
+ headers: headersGetter(headers),
+ config: config,
+ statusText: statusText
+ });
+ }
+
+ function resolvePromiseWithResult(result) {
+ resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText);
+ }
+
+ function removePendingReq() {
+ var idx = $http.pendingRequests.indexOf(config);
+ if (idx !== -1) $http.pendingRequests.splice(idx, 1);
+ }
+ }
+
+
+ function buildUrl(url, serializedParams) {
+ if (serializedParams.length > 0) {
+ url += ((url.indexOf('?') == -1) ? '?' : '&') + serializedParams;
+ }
+ return url;
+ }
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $xhrFactory
+ *
+ * @description
+ * Factory function used to create XMLHttpRequest objects.
+ *
+ * Replace or decorate this service to create your own custom XMLHttpRequest objects.
+ *
+ * ```
+ * angular.module('myApp', [])
+ * .factory('$xhrFactory', function() {
+ * return function createXhr(method, url) {
+ * return new window.XMLHttpRequest({mozSystem: true});
+ * };
+ * });
+ * ```
+ *
+ * @param {string} method HTTP method of the request (GET, POST, PUT, ..)
+ * @param {string} url URL of the request.
+ */
+function $xhrFactoryProvider() {
+ this.$get = function() {
+ return function createXhr() {
+ return new window.XMLHttpRequest();
+ };
+ };
+}
+
+/**
+ * @ngdoc service
+ * @name $httpBackend
+ * @requires $window
+ * @requires $document
+ * @requires $xhrFactory
+ *
+ * @description
+ * HTTP backend used by the {@link ng.$http service} that delegates to
+ * XMLHttpRequest object or JSONP and deals with browser incompatibilities.
+ *
+ * You should never need to use this service directly, instead use the higher-level abstractions:
+ * {@link ng.$http $http} or {@link ngResource.$resource $resource}.
+ *
+ * During testing this implementation is swapped with {@link ngMock.$httpBackend mock
+ * $httpBackend} which can be trained with responses.
+ */
+function $HttpBackendProvider() {
+ this.$get = ['$browser', '$window', '$document', '$xhrFactory', function($browser, $window, $document, $xhrFactory) {
+ return createHttpBackend($browser, $xhrFactory, $browser.defer, $window.angular.callbacks, $document[0]);
+ }];
+}
+
+function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {
+ // TODO(vojta): fix the signature
+ return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {
+ $browser.$$incOutstandingRequestCount();
+ url = url || $browser.url();
+
+ if (lowercase(method) == 'jsonp') {
+ var callbackId = '_' + (callbacks.counter++).toString(36);
+ callbacks[callbackId] = function(data) {
+ callbacks[callbackId].data = data;
+ callbacks[callbackId].called = true;
+ };
+
+ var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),
+ callbackId, function(status, text) {
+ completeRequest(callback, status, callbacks[callbackId].data, "", text);
+ callbacks[callbackId] = noop;
+ });
+ } else {
+
+ var xhr = createXhr(method, url);
+
+ xhr.open(method, url, true);
+ forEach(headers, function(value, key) {
+ if (isDefined(value)) {
+ xhr.setRequestHeader(key, value);
+ }
+ });
+
+ xhr.onload = function requestLoaded() {
+ var statusText = xhr.statusText || '';
+
+ // responseText is the old-school way of retrieving response (supported by IE9)
+ // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)
+ var response = ('response' in xhr) ? xhr.response : xhr.responseText;
+
+ // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
+ var status = xhr.status === 1223 ? 204 : xhr.status;
+
+ // fix status code when it is 0 (0 status is undocumented).
+ // Occurs when accessing file resources or on Android 4.1 stock browser
+ // while retrieving files from application cache.
+ if (status === 0) {
+ status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;
+ }
+
+ completeRequest(callback,
+ status,
+ response,
+ xhr.getAllResponseHeaders(),
+ statusText);
+ };
+
+ var requestError = function() {
+ // The response is always empty
+ // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error
+ completeRequest(callback, -1, null, null, '');
+ };
+
+ xhr.onerror = requestError;
+ xhr.onabort = requestError;
+
+ if (withCredentials) {
+ xhr.withCredentials = true;
+ }
+
+ if (responseType) {
+ try {
+ xhr.responseType = responseType;
+ } catch (e) {
+ // WebKit added support for the json responseType value on 09/03/2013
+ // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are
+ // known to throw when setting the value "json" as the response type. Other older
+ // browsers implementing the responseType
+ //
+ // The json response type can be ignored if not supported, because JSON payloads are
+ // parsed on the client-side regardless.
+ if (responseType !== 'json') {
+ throw e;
+ }
+ }
+ }
+
+ xhr.send(isUndefined(post) ? null : post);
+ }
+
+ if (timeout > 0) {
+ var timeoutId = $browserDefer(timeoutRequest, timeout);
+ } else if (isPromiseLike(timeout)) {
+ timeout.then(timeoutRequest);
+ }
+
+
+ function timeoutRequest() {
+ jsonpDone && jsonpDone();
+ xhr && xhr.abort();
+ }
+
+ function completeRequest(callback, status, response, headersString, statusText) {
+ // cancel timeout and subsequent timeout promise resolution
+ if (isDefined(timeoutId)) {
+ $browserDefer.cancel(timeoutId);
+ }
+ jsonpDone = xhr = null;
+
+ callback(status, response, headersString, statusText);
+ $browser.$$completeOutstandingRequest(noop);
+ }
+ };
+
+ function jsonpReq(url, callbackId, done) {
+ // we can't use jQuery/jqLite here because jQuery does crazy stuff with script elements, e.g.:
+ // - fetches local scripts via XHR and evals them
+ // - adds and immediately removes script elements from the document
+ var script = rawDocument.createElement('script'), callback = null;
+ script.type = "text/javascript";
+ script.src = url;
+ script.async = true;
+
+ callback = function(event) {
+ removeEventListenerFn(script, "load", callback);
+ removeEventListenerFn(script, "error", callback);
+ rawDocument.body.removeChild(script);
+ script = null;
+ var status = -1;
+ var text = "unknown";
+
+ if (event) {
+ if (event.type === "load" && !callbacks[callbackId].called) {
+ event = { type: "error" };
+ }
+ text = event.type;
+ status = event.type === "error" ? 404 : 200;
+ }
+
+ if (done) {
+ done(status, text);
+ }
+ };
+
+ addEventListenerFn(script, "load", callback);
+ addEventListenerFn(script, "error", callback);
+ rawDocument.body.appendChild(script);
+ return callback;
+ }
+}
+
+var $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate');
+$interpolateMinErr.throwNoconcat = function(text) {
+ throw $interpolateMinErr('noconcat',
+ "Error while interpolating: {0}\nStrict Contextual Escaping disallows " +
+ "interpolations that concatenate multiple expressions when a trusted value is " +
+ "required. See http://docs.angularjs.org/api/ng.$sce", text);
+};
+
+$interpolateMinErr.interr = function(text, err) {
+ return $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text, err.toString());
+};
+
+/**
+ * @ngdoc provider
+ * @name $interpolateProvider
+ *
+ * @description
+ *
+ * Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
+ *
+ * <div class="alert alert-danger">
+ * This feature is sometimes used to mix different markup languages, e.g. to wrap an Angular
+ * template within a Python Jinja template (or any other template language). Mixing templating
+ * languages is **very dangerous**. The embedding template language will not safely escape Angular
+ * expressions, so any user-controlled values in the template will cause Cross Site Scripting (XSS)
+ * security bugs!
+ * </div>
+ *
+ * @example
+<example module="customInterpolationApp">
+<file name="index.html">
+<script>
+ var customInterpolationApp = angular.module('customInterpolationApp', []);
+
+ customInterpolationApp.config(function($interpolateProvider) {
+ $interpolateProvider.startSymbol('//');
+ $interpolateProvider.endSymbol('//');
+ });
+
+
+ customInterpolationApp.controller('DemoController', function() {
+ this.label = "This binding is brought you by // interpolation symbols.";
+ });
+</script>
+<div ng-app="App" ng-controller="DemoController as demo">
+ //demo.label//
+</div>
+</file>
+<file name="protractor.js" type="protractor">
+ it('should interpolate binding with custom symbols', function() {
+ expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.');
+ });
+</file>
+</example>
+ */
+function $InterpolateProvider() {
+ var startSymbol = '{{';
+ var endSymbol = '}}';
+
+ /**
+ * @ngdoc method
+ * @name $interpolateProvider#startSymbol
+ * @description
+ * Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
+ *
+ * @param {string=} value new value to set the starting symbol to.
+ * @returns {string|self} Returns the symbol when used as getter and self if used as setter.
+ */
+ this.startSymbol = function(value) {
+ if (value) {
+ startSymbol = value;
+ return this;
+ } else {
+ return startSymbol;
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $interpolateProvider#endSymbol
+ * @description
+ * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
+ *
+ * @param {string=} value new value to set the ending symbol to.
+ * @returns {string|self} Returns the symbol when used as getter and self if used as setter.
+ */
+ this.endSymbol = function(value) {
+ if (value) {
+ endSymbol = value;
+ return this;
+ } else {
+ return endSymbol;
+ }
+ };
+
+
+ this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {
+ var startSymbolLength = startSymbol.length,
+ endSymbolLength = endSymbol.length,
+ escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'),
+ escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g');
+
+ function escape(ch) {
+ return '\\\\\\' + ch;
+ }
+
+ function unescapeText(text) {
+ return text.replace(escapedStartRegexp, startSymbol).
+ replace(escapedEndRegexp, endSymbol);
+ }
+
+ function stringify(value) {
+ if (value == null) { // null || undefined
+ return '';
+ }
+ switch (typeof value) {
+ case 'string':
+ break;
+ case 'number':
+ value = '' + value;
+ break;
+ default:
+ value = toJson(value);
+ }
+
+ return value;
+ }
+
+ //TODO: this is the same as the constantWatchDelegate in parse.js
+ function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {
+ var unwatch;
+ return unwatch = scope.$watch(function constantInterpolateWatch(scope) {
+ unwatch();
+ return constantInterp(scope);
+ }, listener, objectEquality);
+ }
+
+ /**
+ * @ngdoc service
+ * @name $interpolate
+ * @kind function
+ *
+ * @requires $parse
+ * @requires $sce
+ *
+ * @description
+ *
+ * Compiles a string with markup into an interpolation function. This service is used by the
+ * HTML {@link ng.$compile $compile} service for data binding. See
+ * {@link ng.$interpolateProvider $interpolateProvider} for configuring the
+ * interpolation markup.
+ *
+ *
+ * ```js
+ * var $interpolate = ...; // injected
+ * var exp = $interpolate('Hello {{name | uppercase}}!');
+ * expect(exp({name:'Angular'})).toEqual('Hello ANGULAR!');
+ * ```
+ *
+ * `$interpolate` takes an optional fourth argument, `allOrNothing`. If `allOrNothing` is
+ * `true`, the interpolation function will return `undefined` unless all embedded expressions
+ * evaluate to a value other than `undefined`.
+ *
+ * ```js
+ * var $interpolate = ...; // injected
+ * var context = {greeting: 'Hello', name: undefined };
+ *
+ * // default "forgiving" mode
+ * var exp = $interpolate('{{greeting}} {{name}}!');
+ * expect(exp(context)).toEqual('Hello !');
+ *
+ * // "allOrNothing" mode
+ * exp = $interpolate('{{greeting}} {{name}}!', false, null, true);
+ * expect(exp(context)).toBeUndefined();
+ * context.name = 'Angular';
+ * expect(exp(context)).toEqual('Hello Angular!');
+ * ```
+ *
+ * `allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior.
+ *
+ * ####Escaped Interpolation
+ * $interpolate provides a mechanism for escaping interpolation markers. Start and end markers
+ * can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash).
+ * It will be rendered as a regular start/end marker, and will not be interpreted as an expression
+ * or binding.
+ *
+ * This enables web-servers to prevent script injection attacks and defacing attacks, to some
+ * degree, while also enabling code examples to work without relying on the
+ * {@link ng.directive:ngNonBindable ngNonBindable} directive.
+ *
+ * **For security purposes, it is strongly encouraged that web servers escape user-supplied data,
+ * replacing angle brackets (&lt;, &gt;) with &amp;lt; and &amp;gt; respectively, and replacing all
+ * interpolation start/end markers with their escaped counterparts.**
+ *
+ * Escaped interpolation markers are only replaced with the actual interpolation markers in rendered
+ * output when the $interpolate service processes the text. So, for HTML elements interpolated
+ * by {@link ng.$compile $compile}, or otherwise interpolated with the `mustHaveExpression` parameter
+ * set to `true`, the interpolated text must contain an unescaped interpolation expression. As such,
+ * this is typically useful only when user-data is used in rendering a template from the server, or
+ * when otherwise untrusted data is used by a directive.
+ *
+ * <example>
+ * <file name="index.html">
+ * <div ng-init="username='A user'">
+ * <p ng-init="apptitle='Escaping demo'">{{apptitle}}: \{\{ username = "defaced value"; \}\}
+ * </p>
+ * <p><strong>{{username}}</strong> attempts to inject code which will deface the
+ * application, but fails to accomplish their task, because the server has correctly
+ * escaped the interpolation start/end markers with REVERSE SOLIDUS U+005C (backslash)
+ * characters.</p>
+ * <p>Instead, the result of the attempted script injection is visible, and can be removed
+ * from the database by an administrator.</p>
+ * </div>
+ * </file>
+ * </example>
+ *
+ * @param {string} text The text with markup to interpolate.
+ * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have
+ * embedded expression in order to return an interpolation function. Strings with no
+ * embedded expression will return null for the interpolation function.
+ * @param {string=} trustedContext when provided, the returned function passes the interpolated
+ * result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult,
+ * trustedContext)} before returning it. Refer to the {@link ng.$sce $sce} service that
+ * provides Strict Contextual Escaping for details.
+ * @param {boolean=} allOrNothing if `true`, then the returned function returns undefined
+ * unless all embedded expressions evaluate to a value other than `undefined`.
+ * @returns {function(context)} an interpolation function which is used to compute the
+ * interpolated string. The function has these parameters:
+ *
+ * - `context`: evaluation context for all expressions embedded in the interpolated text
+ */
+ function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {
+ // Provide a quick exit and simplified result function for text with no interpolation
+ if (!text.length || text.indexOf(startSymbol) === -1) {
+ var constantInterp;
+ if (!mustHaveExpression) {
+ var unescapedText = unescapeText(text);
+ constantInterp = valueFn(unescapedText);
+ constantInterp.exp = text;
+ constantInterp.expressions = [];
+ constantInterp.$$watchDelegate = constantWatchDelegate;
+ }
+ return constantInterp;
+ }
+
+ allOrNothing = !!allOrNothing;
+ var startIndex,
+ endIndex,
+ index = 0,
+ expressions = [],
+ parseFns = [],
+ textLength = text.length,
+ exp,
+ concat = [],
+ expressionPositions = [];
+
+ while (index < textLength) {
+ if (((startIndex = text.indexOf(startSymbol, index)) != -1) &&
+ ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1)) {
+ if (index !== startIndex) {
+ concat.push(unescapeText(text.substring(index, startIndex)));
+ }
+ exp = text.substring(startIndex + startSymbolLength, endIndex);
+ expressions.push(exp);
+ parseFns.push($parse(exp, parseStringifyInterceptor));
+ index = endIndex + endSymbolLength;
+ expressionPositions.push(concat.length);
+ concat.push('');
+ } else {
+ // we did not find an interpolation, so we have to add the remainder to the separators array
+ if (index !== textLength) {
+ concat.push(unescapeText(text.substring(index)));
+ }
+ break;
+ }
+ }
+
+ // Concatenating expressions makes it hard to reason about whether some combination of
+ // concatenated values are unsafe to use and could easily lead to XSS. By requiring that a
+ // single expression be used for iframe[src], object[src], etc., we ensure that the value
+ // that's used is assigned or constructed by some JS code somewhere that is more testable or
+ // make it obvious that you bound the value to some user controlled value. This helps reduce
+ // the load when auditing for XSS issues.
+ if (trustedContext && concat.length > 1) {
+ $interpolateMinErr.throwNoconcat(text);
+ }
+
+ if (!mustHaveExpression || expressions.length) {
+ var compute = function(values) {
+ for (var i = 0, ii = expressions.length; i < ii; i++) {
+ if (allOrNothing && isUndefined(values[i])) return;
+ concat[expressionPositions[i]] = values[i];
+ }
+ return concat.join('');
+ };
+
+ var getValue = function(value) {
+ return trustedContext ?
+ $sce.getTrusted(trustedContext, value) :
+ $sce.valueOf(value);
+ };
+
+ return extend(function interpolationFn(context) {
+ var i = 0;
+ var ii = expressions.length;
+ var values = new Array(ii);
+
+ try {
+ for (; i < ii; i++) {
+ values[i] = parseFns[i](context);
+ }
+
+ return compute(values);
+ } catch (err) {
+ $exceptionHandler($interpolateMinErr.interr(text, err));
+ }
+
+ }, {
+ // all of these properties are undocumented for now
+ exp: text, //just for compatibility with regular watchers created via $watch
+ expressions: expressions,
+ $$watchDelegate: function(scope, listener) {
+ var lastValue;
+ return scope.$watchGroup(parseFns, function interpolateFnWatcher(values, oldValues) {
+ var currValue = compute(values);
+ if (isFunction(listener)) {
+ listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope);
+ }
+ lastValue = currValue;
+ });
+ }
+ });
+ }
+
+ function parseStringifyInterceptor(value) {
+ try {
+ value = getValue(value);
+ return allOrNothing && !isDefined(value) ? value : stringify(value);
+ } catch (err) {
+ $exceptionHandler($interpolateMinErr.interr(text, err));
+ }
+ }
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $interpolate#startSymbol
+ * @description
+ * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
+ *
+ * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change
+ * the symbol.
+ *
+ * @returns {string} start symbol.
+ */
+ $interpolate.startSymbol = function() {
+ return startSymbol;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name $interpolate#endSymbol
+ * @description
+ * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
+ *
+ * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change
+ * the symbol.
+ *
+ * @returns {string} end symbol.
+ */
+ $interpolate.endSymbol = function() {
+ return endSymbol;
+ };
+
+ return $interpolate;
+ }];
+}
+
+function $IntervalProvider() {
+ this.$get = ['$rootScope', '$window', '$q', '$$q', '$browser',
+ function($rootScope, $window, $q, $$q, $browser) {
+ var intervals = {};
+
+
+ /**
+ * @ngdoc service
+ * @name $interval
+ *
+ * @description
+ * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay`
+ * milliseconds.
+ *
+ * The return value of registering an interval function is a promise. This promise will be
+ * notified upon each tick of the interval, and will be resolved after `count` iterations, or
+ * run indefinitely if `count` is not defined. The value of the notification will be the
+ * number of iterations that have run.
+ * To cancel an interval, call `$interval.cancel(promise)`.
+ *
+ * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to
+ * move forward by `millis` milliseconds and trigger any functions scheduled to run in that
+ * time.
+ *
+ * <div class="alert alert-warning">
+ * **Note**: Intervals created by this service must be explicitly destroyed when you are finished
+ * with them. In particular they are not automatically destroyed when a controller's scope or a
+ * directive's element are destroyed.
+ * You should take this into consideration and make sure to always cancel the interval at the
+ * appropriate moment. See the example below for more details on how and when to do this.
+ * </div>
+ *
+ * @param {function()} fn A function that should be called repeatedly.
+ * @param {number} delay Number of milliseconds between each function call.
+ * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat
+ * indefinitely.
+ * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
+ * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
+ * @param {...*=} Pass additional parameters to the executed function.
+ * @returns {promise} A promise which will be notified on each iteration.
+ *
+ * @example
+ * <example module="intervalExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('intervalExample', [])
+ * .controller('ExampleController', ['$scope', '$interval',
+ * function($scope, $interval) {
+ * $scope.format = 'M/d/yy h:mm:ss a';
+ * $scope.blood_1 = 100;
+ * $scope.blood_2 = 120;
+ *
+ * var stop;
+ * $scope.fight = function() {
+ * // Don't start a new fight if we are already fighting
+ * if ( angular.isDefined(stop) ) return;
+ *
+ * stop = $interval(function() {
+ * if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {
+ * $scope.blood_1 = $scope.blood_1 - 3;
+ * $scope.blood_2 = $scope.blood_2 - 4;
+ * } else {
+ * $scope.stopFight();
+ * }
+ * }, 100);
+ * };
+ *
+ * $scope.stopFight = function() {
+ * if (angular.isDefined(stop)) {
+ * $interval.cancel(stop);
+ * stop = undefined;
+ * }
+ * };
+ *
+ * $scope.resetFight = function() {
+ * $scope.blood_1 = 100;
+ * $scope.blood_2 = 120;
+ * };
+ *
+ * $scope.$on('$destroy', function() {
+ * // Make sure that the interval is destroyed too
+ * $scope.stopFight();
+ * });
+ * }])
+ * // Register the 'myCurrentTime' directive factory method.
+ * // We inject $interval and dateFilter service since the factory method is DI.
+ * .directive('myCurrentTime', ['$interval', 'dateFilter',
+ * function($interval, dateFilter) {
+ * // return the directive link function. (compile function not needed)
+ * return function(scope, element, attrs) {
+ * var format, // date format
+ * stopTime; // so that we can cancel the time updates
+ *
+ * // used to update the UI
+ * function updateTime() {
+ * element.text(dateFilter(new Date(), format));
+ * }
+ *
+ * // watch the expression, and update the UI on change.
+ * scope.$watch(attrs.myCurrentTime, function(value) {
+ * format = value;
+ * updateTime();
+ * });
+ *
+ * stopTime = $interval(updateTime, 1000);
+ *
+ * // listen on DOM destroy (removal) event, and cancel the next UI update
+ * // to prevent updating time after the DOM element was removed.
+ * element.on('$destroy', function() {
+ * $interval.cancel(stopTime);
+ * });
+ * }
+ * }]);
+ * </script>
+ *
+ * <div>
+ * <div ng-controller="ExampleController">
+ * <label>Date format: <input ng-model="format"></label> <hr/>
+ * Current time is: <span my-current-time="format"></span>
+ * <hr/>
+ * Blood 1 : <font color='red'>{{blood_1}}</font>
+ * Blood 2 : <font color='red'>{{blood_2}}</font>
+ * <button type="button" data-ng-click="fight()">Fight</button>
+ * <button type="button" data-ng-click="stopFight()">StopFight</button>
+ * <button type="button" data-ng-click="resetFight()">resetFight</button>
+ * </div>
+ * </div>
+ *
+ * </file>
+ * </example>
+ */
+ function interval(fn, delay, count, invokeApply) {
+ var hasParams = arguments.length > 4,
+ args = hasParams ? sliceArgs(arguments, 4) : [],
+ setInterval = $window.setInterval,
+ clearInterval = $window.clearInterval,
+ iteration = 0,
+ skipApply = (isDefined(invokeApply) && !invokeApply),
+ deferred = (skipApply ? $$q : $q).defer(),
+ promise = deferred.promise;
+
+ count = isDefined(count) ? count : 0;
+
+ promise.$$intervalId = setInterval(function tick() {
+ if (skipApply) {
+ $browser.defer(callback);
+ } else {
+ $rootScope.$evalAsync(callback);
+ }
+ deferred.notify(iteration++);
+
+ if (count > 0 && iteration >= count) {
+ deferred.resolve(iteration);
+ clearInterval(promise.$$intervalId);
+ delete intervals[promise.$$intervalId];
+ }
+
+ if (!skipApply) $rootScope.$apply();
+
+ }, delay);
+
+ intervals[promise.$$intervalId] = deferred;
+
+ return promise;
+
+ function callback() {
+ if (!hasParams) {
+ fn(iteration);
+ } else {
+ fn.apply(null, args);
+ }
+ }
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $interval#cancel
+ *
+ * @description
+ * Cancels a task associated with the `promise`.
+ *
+ * @param {Promise=} promise returned by the `$interval` function.
+ * @returns {boolean} Returns `true` if the task was successfully canceled.
+ */
+ interval.cancel = function(promise) {
+ if (promise && promise.$$intervalId in intervals) {
+ intervals[promise.$$intervalId].reject('canceled');
+ $window.clearInterval(promise.$$intervalId);
+ delete intervals[promise.$$intervalId];
+ return true;
+ }
+ return false;
+ };
+
+ return interval;
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $locale
+ *
+ * @description
+ * $locale service provides localization rules for various Angular components. As of right now the
+ * only public api is:
+ *
+ * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)
+ */
+
+var PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/,
+ DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
+var $locationMinErr = minErr('$location');
+
+
+/**
+ * Encode path using encodeUriSegment, ignoring forward slashes
+ *
+ * @param {string} path Path to encode
+ * @returns {string}
+ */
+function encodePath(path) {
+ var segments = path.split('/'),
+ i = segments.length;
+
+ while (i--) {
+ segments[i] = encodeUriSegment(segments[i]);
+ }
+
+ return segments.join('/');
+}
+
+function parseAbsoluteUrl(absoluteUrl, locationObj) {
+ var parsedUrl = urlResolve(absoluteUrl);
+
+ locationObj.$$protocol = parsedUrl.protocol;
+ locationObj.$$host = parsedUrl.hostname;
+ locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;
+}
+
+
+function parseAppUrl(relativeUrl, locationObj) {
+ var prefixed = (relativeUrl.charAt(0) !== '/');
+ if (prefixed) {
+ relativeUrl = '/' + relativeUrl;
+ }
+ var match = urlResolve(relativeUrl);
+ locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?
+ match.pathname.substring(1) : match.pathname);
+ locationObj.$$search = parseKeyValue(match.search);
+ locationObj.$$hash = decodeURIComponent(match.hash);
+
+ // make sure path starts with '/';
+ if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') {
+ locationObj.$$path = '/' + locationObj.$$path;
+ }
+}
+
+
+/**
+ *
+ * @param {string} begin
+ * @param {string} whole
+ * @returns {string} returns text from whole after begin or undefined if it does not begin with
+ * expected string.
+ */
+function beginsWith(begin, whole) {
+ if (whole.indexOf(begin) === 0) {
+ return whole.substr(begin.length);
+ }
+}
+
+
+function stripHash(url) {
+ var index = url.indexOf('#');
+ return index == -1 ? url : url.substr(0, index);
+}
+
+function trimEmptyHash(url) {
+ return url.replace(/(#.+)|#$/, '$1');
+}
+
+
+function stripFile(url) {
+ return url.substr(0, stripHash(url).lastIndexOf('/') + 1);
+}
+
+/* return the server only (scheme://host:port) */
+function serverBase(url) {
+ return url.substring(0, url.indexOf('/', url.indexOf('//') + 2));
+}
+
+
+/**
+ * LocationHtml5Url represents an url
+ * This object is exposed as $location service when HTML5 mode is enabled and supported
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} appBaseNoFile application base URL stripped of any filename
+ * @param {string} basePrefix url path prefix
+ */
+function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
+ this.$$html5 = true;
+ basePrefix = basePrefix || '';
+ parseAbsoluteUrl(appBase, this);
+
+
+ /**
+ * Parse given html5 (regular) url string into properties
+ * @param {string} url HTML5 url
+ * @private
+ */
+ this.$$parse = function(url) {
+ var pathUrl = beginsWith(appBaseNoFile, url);
+ if (!isString(pathUrl)) {
+ throw $locationMinErr('ipthprfx', 'Invalid url "{0}", missing path prefix "{1}".', url,
+ appBaseNoFile);
+ }
+
+ parseAppUrl(pathUrl, this);
+
+ if (!this.$$path) {
+ this.$$path = '/';
+ }
+
+ this.$$compose();
+ };
+
+ /**
+ * Compose url and update `absUrl` property
+ * @private
+ */
+ this.$$compose = function() {
+ var search = toKeyValue(this.$$search),
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+ this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'
+ };
+
+ this.$$parseLinkUrl = function(url, relHref) {
+ if (relHref && relHref[0] === '#') {
+ // special case for links to hash fragments:
+ // keep the old url and only replace the hash fragment
+ this.hash(relHref.slice(1));
+ return true;
+ }
+ var appUrl, prevAppUrl;
+ var rewrittenUrl;
+
+ if (isDefined(appUrl = beginsWith(appBase, url))) {
+ prevAppUrl = appUrl;
+ if (isDefined(appUrl = beginsWith(basePrefix, appUrl))) {
+ rewrittenUrl = appBaseNoFile + (beginsWith('/', appUrl) || appUrl);
+ } else {
+ rewrittenUrl = appBase + prevAppUrl;
+ }
+ } else if (isDefined(appUrl = beginsWith(appBaseNoFile, url))) {
+ rewrittenUrl = appBaseNoFile + appUrl;
+ } else if (appBaseNoFile == url + '/') {
+ rewrittenUrl = appBaseNoFile;
+ }
+ if (rewrittenUrl) {
+ this.$$parse(rewrittenUrl);
+ }
+ return !!rewrittenUrl;
+ };
+}
+
+
+/**
+ * LocationHashbangUrl represents url
+ * This object is exposed as $location service when developer doesn't opt into html5 mode.
+ * It also serves as the base class for html5 mode fallback on legacy browsers.
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} appBaseNoFile application base URL stripped of any filename
+ * @param {string} hashPrefix hashbang prefix
+ */
+function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
+
+ parseAbsoluteUrl(appBase, this);
+
+
+ /**
+ * Parse given hashbang url into properties
+ * @param {string} url Hashbang url
+ * @private
+ */
+ this.$$parse = function(url) {
+ var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);
+ var withoutHashUrl;
+
+ if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === '#') {
+
+ // The rest of the url starts with a hash so we have
+ // got either a hashbang path or a plain hash fragment
+ withoutHashUrl = beginsWith(hashPrefix, withoutBaseUrl);
+ if (isUndefined(withoutHashUrl)) {
+ // There was no hashbang prefix so we just have a hash fragment
+ withoutHashUrl = withoutBaseUrl;
+ }
+
+ } else {
+ // There was no hashbang path nor hash fragment:
+ // If we are in HTML5 mode we use what is left as the path;
+ // Otherwise we ignore what is left
+ if (this.$$html5) {
+ withoutHashUrl = withoutBaseUrl;
+ } else {
+ withoutHashUrl = '';
+ if (isUndefined(withoutBaseUrl)) {
+ appBase = url;
+ this.replace();
+ }
+ }
+ }
+
+ parseAppUrl(withoutHashUrl, this);
+
+ this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);
+
+ this.$$compose();
+
+ /*
+ * In Windows, on an anchor node on documents loaded from
+ * the filesystem, the browser will return a pathname
+ * prefixed with the drive name ('/C:/path') when a
+ * pathname without a drive is set:
+ * * a.setAttribute('href', '/foo')
+ * * a.pathname === '/C:/foo' //true
+ *
+ * Inside of Angular, we're always using pathnames that
+ * do not include drive names for routing.
+ */
+ function removeWindowsDriveName(path, url, base) {
+ /*
+ Matches paths for file protocol on windows,
+ such as /C:/foo/bar, and captures only /foo/bar.
+ */
+ var windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
+
+ var firstPathSegmentMatch;
+
+ //Get the relative path from the input URL.
+ if (url.indexOf(base) === 0) {
+ url = url.replace(base, '');
+ }
+
+ // The input URL intentionally contains a first path segment that ends with a colon.
+ if (windowsFilePathExp.exec(url)) {
+ return path;
+ }
+
+ firstPathSegmentMatch = windowsFilePathExp.exec(path);
+ return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
+ }
+ };
+
+ /**
+ * Compose hashbang url and update `absUrl` property
+ * @private
+ */
+ this.$$compose = function() {
+ var search = toKeyValue(this.$$search),
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+ this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');
+ };
+
+ this.$$parseLinkUrl = function(url, relHref) {
+ if (stripHash(appBase) == stripHash(url)) {
+ this.$$parse(url);
+ return true;
+ }
+ return false;
+ };
+}
+
+
+/**
+ * LocationHashbangUrl represents url
+ * This object is exposed as $location service when html5 history api is enabled but the browser
+ * does not support it.
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} appBaseNoFile application base URL stripped of any filename
+ * @param {string} hashPrefix hashbang prefix
+ */
+function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
+ this.$$html5 = true;
+ LocationHashbangUrl.apply(this, arguments);
+
+ this.$$parseLinkUrl = function(url, relHref) {
+ if (relHref && relHref[0] === '#') {
+ // special case for links to hash fragments:
+ // keep the old url and only replace the hash fragment
+ this.hash(relHref.slice(1));
+ return true;
+ }
+
+ var rewrittenUrl;
+ var appUrl;
+
+ if (appBase == stripHash(url)) {
+ rewrittenUrl = url;
+ } else if ((appUrl = beginsWith(appBaseNoFile, url))) {
+ rewrittenUrl = appBase + hashPrefix + appUrl;
+ } else if (appBaseNoFile === url + '/') {
+ rewrittenUrl = appBaseNoFile;
+ }
+ if (rewrittenUrl) {
+ this.$$parse(rewrittenUrl);
+ }
+ return !!rewrittenUrl;
+ };
+
+ this.$$compose = function() {
+ var search = toKeyValue(this.$$search),
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+ // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#'
+ this.$$absUrl = appBase + hashPrefix + this.$$url;
+ };
+
+}
+
+
+var locationPrototype = {
+
+ /**
+ * Are we in html5 mode?
+ * @private
+ */
+ $$html5: false,
+
+ /**
+ * Has any change been replacing?
+ * @private
+ */
+ $$replace: false,
+
+ /**
+ * @ngdoc method
+ * @name $location#absUrl
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return full url representation with all segments encoded according to rules specified in
+ * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var absUrl = $location.absUrl();
+ * // => "http://example.com/#/some/path?foo=bar&baz=xoxo"
+ * ```
+ *
+ * @return {string} full url
+ */
+ absUrl: locationGetter('$$absUrl'),
+
+ /**
+ * @ngdoc method
+ * @name $location#url
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return url (e.g. `/path?a=b#hash`) when called without any parameter.
+ *
+ * Change path, search and hash, when called with parameter and return `$location`.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var url = $location.url();
+ * // => "/some/path?foo=bar&baz=xoxo"
+ * ```
+ *
+ * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)
+ * @return {string} url
+ */
+ url: function(url) {
+ if (isUndefined(url)) {
+ return this.$$url;
+ }
+
+ var match = PATH_MATCH.exec(url);
+ if (match[1] || url === '') this.path(decodeURIComponent(match[1]));
+ if (match[2] || match[1] || url === '') this.search(match[3] || '');
+ this.hash(match[5] || '');
+
+ return this;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $location#protocol
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return protocol of current url.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var protocol = $location.protocol();
+ * // => "http"
+ * ```
+ *
+ * @return {string} protocol of current url
+ */
+ protocol: locationGetter('$$protocol'),
+
+ /**
+ * @ngdoc method
+ * @name $location#host
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return host of current url.
+ *
+ * Note: compared to the non-angular version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var host = $location.host();
+ * // => "example.com"
+ *
+ * // given url http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo
+ * host = $location.host();
+ * // => "example.com"
+ * host = location.host;
+ * // => "example.com:8080"
+ * ```
+ *
+ * @return {string} host of current url.
+ */
+ host: locationGetter('$$host'),
+
+ /**
+ * @ngdoc method
+ * @name $location#port
+ *
+ * @description
+ * This method is getter only.
+ *
+ * Return port of current url.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var port = $location.port();
+ * // => 80
+ * ```
+ *
+ * @return {Number} port
+ */
+ port: locationGetter('$$port'),
+
+ /**
+ * @ngdoc method
+ * @name $location#path
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return path of current url when called without any parameter.
+ *
+ * Change path when called with parameter and return `$location`.
+ *
+ * Note: Path should always begin with forward slash (/), this method will add the forward slash
+ * if it is missing.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var path = $location.path();
+ * // => "/some/path"
+ * ```
+ *
+ * @param {(string|number)=} path New path
+ * @return {string} path
+ */
+ path: locationGetterSetter('$$path', function(path) {
+ path = path !== null ? path.toString() : '';
+ return path.charAt(0) == '/' ? path : '/' + path;
+ }),
+
+ /**
+ * @ngdoc method
+ * @name $location#search
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return search part (as object) of current url when called without any parameter.
+ *
+ * Change search part when called with parameter and return `$location`.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+ * var searchObject = $location.search();
+ * // => {foo: 'bar', baz: 'xoxo'}
+ *
+ * // set foo to 'yipee'
+ * $location.search('foo', 'yipee');
+ * // $location.search() => {foo: 'yipee', baz: 'xoxo'}
+ * ```
+ *
+ * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or
+ * hash object.
+ *
+ * When called with a single argument the method acts as a setter, setting the `search` component
+ * of `$location` to the specified value.
+ *
+ * If the argument is a hash object containing an array of values, these values will be encoded
+ * as duplicate search parameters in the url.
+ *
+ * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`
+ * will override only a single search property.
+ *
+ * If `paramValue` is an array, it will override the property of the `search` component of
+ * `$location` specified via the first argument.
+ *
+ * If `paramValue` is `null`, the property specified via the first argument will be deleted.
+ *
+ * If `paramValue` is `true`, the property specified via the first argument will be added with no
+ * value nor trailing equal sign.
+ *
+ * @return {Object} If called with no arguments returns the parsed `search` object. If called with
+ * one or more arguments returns `$location` object itself.
+ */
+ search: function(search, paramValue) {
+ switch (arguments.length) {
+ case 0:
+ return this.$$search;
+ case 1:
+ if (isString(search) || isNumber(search)) {
+ search = search.toString();
+ this.$$search = parseKeyValue(search);
+ } else if (isObject(search)) {
+ search = copy(search, {});
+ // remove object undefined or null properties
+ forEach(search, function(value, key) {
+ if (value == null) delete search[key];
+ });
+
+ this.$$search = search;
+ } else {
+ throw $locationMinErr('isrcharg',
+ 'The first argument of the `$location#search()` call must be a string or an object.');
+ }
+ break;
+ default:
+ if (isUndefined(paramValue) || paramValue === null) {
+ delete this.$$search[search];
+ } else {
+ this.$$search[search] = paramValue;
+ }
+ }
+
+ this.$$compose();
+ return this;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $location#hash
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Returns the hash fragment when called without any parameters.
+ *
+ * Changes the hash fragment when called with a parameter and returns `$location`.
+ *
+ *
+ * ```js
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
+ * var hash = $location.hash();
+ * // => "hashValue"
+ * ```
+ *
+ * @param {(string|number)=} hash New hash fragment
+ * @return {string} hash
+ */
+ hash: locationGetterSetter('$$hash', function(hash) {
+ return hash !== null ? hash.toString() : '';
+ }),
+
+ /**
+ * @ngdoc method
+ * @name $location#replace
+ *
+ * @description
+ * If called, all changes to $location during the current `$digest` will replace the current history
+ * record, instead of adding a new one.
+ */
+ replace: function() {
+ this.$$replace = true;
+ return this;
+ }
+};
+
+forEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], function(Location) {
+ Location.prototype = Object.create(locationPrototype);
+
+ /**
+ * @ngdoc method
+ * @name $location#state
+ *
+ * @description
+ * This method is getter / setter.
+ *
+ * Return the history state object when called without any parameter.
+ *
+ * Change the history state object when called with one parameter and return `$location`.
+ * The state object is later passed to `pushState` or `replaceState`.
+ *
+ * NOTE: This method is supported only in HTML5 mode and only in browsers supporting
+ * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support
+ * older browsers (like IE9 or Android < 4.0), don't use this method.
+ *
+ * @param {object=} state State object for pushState or replaceState
+ * @return {object} state
+ */
+ Location.prototype.state = function(state) {
+ if (!arguments.length) {
+ return this.$$state;
+ }
+
+ if (Location !== LocationHtml5Url || !this.$$html5) {
+ throw $locationMinErr('nostate', 'History API state support is available only ' +
+ 'in HTML5 mode and only in browsers supporting HTML5 History API');
+ }
+ // The user might modify `stateObject` after invoking `$location.state(stateObject)`
+ // but we're changing the $$state reference to $browser.state() during the $digest
+ // so the modification window is narrow.
+ this.$$state = isUndefined(state) ? null : state;
+
+ return this;
+ };
+});
+
+
+function locationGetter(property) {
+ return function() {
+ return this[property];
+ };
+}
+
+
+function locationGetterSetter(property, preprocess) {
+ return function(value) {
+ if (isUndefined(value)) {
+ return this[property];
+ }
+
+ this[property] = preprocess(value);
+ this.$$compose();
+
+ return this;
+ };
+}
+
+
+/**
+ * @ngdoc service
+ * @name $location
+ *
+ * @requires $rootElement
+ *
+ * @description
+ * The $location service parses the URL in the browser address bar (based on the
+ * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL
+ * available to your application. Changes to the URL in the address bar are reflected into
+ * $location service and changes to $location are reflected into the browser address bar.
+ *
+ * **The $location service:**
+ *
+ * - Exposes the current URL in the browser address bar, so you can
+ * - Watch and observe the URL.
+ * - Change the URL.
+ * - Synchronizes the URL with the browser when the user
+ * - Changes the address bar.
+ * - Clicks the back or forward button (or clicks a History link).
+ * - Clicks on a link.
+ * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
+ *
+ * For more information see {@link guide/$location Developer Guide: Using $location}
+ */
+
+/**
+ * @ngdoc provider
+ * @name $locationProvider
+ * @description
+ * Use the `$locationProvider` to configure how the application deep linking paths are stored.
+ */
+function $LocationProvider() {
+ var hashPrefix = '',
+ html5Mode = {
+ enabled: false,
+ requireBase: true,
+ rewriteLinks: true
+ };
+
+ /**
+ * @ngdoc method
+ * @name $locationProvider#hashPrefix
+ * @description
+ * @param {string=} prefix Prefix for hash part (containing path and search)
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ */
+ this.hashPrefix = function(prefix) {
+ if (isDefined(prefix)) {
+ hashPrefix = prefix;
+ return this;
+ } else {
+ return hashPrefix;
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $locationProvider#html5Mode
+ * @description
+ * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value.
+ * If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported
+ * properties:
+ * - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to
+ * change urls where supported. Will fall back to hash-prefixed paths in browsers that do not
+ * support `pushState`.
+ * - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies
+ * whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are
+ * true, and a base tag is not present, an error will be thrown when `$location` is injected.
+ * See the {@link guide/$location $location guide for more information}
+ * - **rewriteLinks** - `{boolean}` - (default: `true`) When html5Mode is enabled,
+ * enables/disables url rewriting for relative links.
+ *
+ * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter
+ */
+ this.html5Mode = function(mode) {
+ if (isBoolean(mode)) {
+ html5Mode.enabled = mode;
+ return this;
+ } else if (isObject(mode)) {
+
+ if (isBoolean(mode.enabled)) {
+ html5Mode.enabled = mode.enabled;
+ }
+
+ if (isBoolean(mode.requireBase)) {
+ html5Mode.requireBase = mode.requireBase;
+ }
+
+ if (isBoolean(mode.rewriteLinks)) {
+ html5Mode.rewriteLinks = mode.rewriteLinks;
+ }
+
+ return this;
+ } else {
+ return html5Mode;
+ }
+ };
+
+ /**
+ * @ngdoc event
+ * @name $location#$locationChangeStart
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted before a URL will change.
+ *
+ * This change can be prevented by calling
+ * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more
+ * details about event object. Upon successful change
+ * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired.
+ *
+ * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
+ * the browser supports the HTML5 History API.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {string} newUrl New URL
+ * @param {string=} oldUrl URL that was before it was changed.
+ * @param {string=} newState New history state object
+ * @param {string=} oldState History state object that was before it was changed.
+ */
+
+ /**
+ * @ngdoc event
+ * @name $location#$locationChangeSuccess
+ * @eventType broadcast on root scope
+ * @description
+ * Broadcasted after a URL was changed.
+ *
+ * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
+ * the browser supports the HTML5 History API.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {string} newUrl New URL
+ * @param {string=} oldUrl URL that was before it was changed.
+ * @param {string=} newState New history state object
+ * @param {string=} oldState History state object that was before it was changed.
+ */
+
+ this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', '$window',
+ function($rootScope, $browser, $sniffer, $rootElement, $window) {
+ var $location,
+ LocationMode,
+ baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to ''
+ initialUrl = $browser.url(),
+ appBase;
+
+ if (html5Mode.enabled) {
+ if (!baseHref && html5Mode.requireBase) {
+ throw $locationMinErr('nobase',
+ "$location in HTML5 mode requires a <base> tag to be present!");
+ }
+ appBase = serverBase(initialUrl) + (baseHref || '/');
+ LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;
+ } else {
+ appBase = stripHash(initialUrl);
+ LocationMode = LocationHashbangUrl;
+ }
+ var appBaseNoFile = stripFile(appBase);
+
+ $location = new LocationMode(appBase, appBaseNoFile, '#' + hashPrefix);
+ $location.$$parseLinkUrl(initialUrl, initialUrl);
+
+ $location.$$state = $browser.state();
+
+ var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
+
+ function setBrowserUrlWithFallback(url, replace, state) {
+ var oldUrl = $location.url();
+ var oldState = $location.$$state;
+ try {
+ $browser.url(url, replace, state);
+
+ // Make sure $location.state() returns referentially identical (not just deeply equal)
+ // state object; this makes possible quick checking if the state changed in the digest
+ // loop. Checking deep equality would be too expensive.
+ $location.$$state = $browser.state();
+ } catch (e) {
+ // Restore old values if pushState fails
+ $location.url(oldUrl);
+ $location.$$state = oldState;
+
+ throw e;
+ }
+ }
+
+ $rootElement.on('click', function(event) {
+ // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
+ // currently we open nice url link and redirect then
+
+ if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which == 2 || event.button == 2) return;
+
+ var elm = jqLite(event.target);
+
+ // traverse the DOM up to find first A tag
+ while (nodeName_(elm[0]) !== 'a') {
+ // ignore rewriting if no A tag (reached root element, or no parent - removed from document)
+ if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;
+ }
+
+ var absHref = elm.prop('href');
+ // get the actual href attribute - see
+ // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx
+ var relHref = elm.attr('href') || elm.attr('xlink:href');
+
+ if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {
+ // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during
+ // an animation.
+ absHref = urlResolve(absHref.animVal).href;
+ }
+
+ // Ignore when url is started with javascript: or mailto:
+ if (IGNORE_URI_REGEXP.test(absHref)) return;
+
+ if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) {
+ if ($location.$$parseLinkUrl(absHref, relHref)) {
+ // We do a preventDefault for all urls that are part of the angular application,
+ // in html5mode and also without, so that we are able to abort navigation without
+ // getting double entries in the location history.
+ event.preventDefault();
+ // update location manually
+ if ($location.absUrl() != $browser.url()) {
+ $rootScope.$apply();
+ // hack to work around FF6 bug 684208 when scenario runner clicks on links
+ $window.angular['ff-684208-preventDefault'] = true;
+ }
+ }
+ }
+ });
+
+
+ // rewrite hashbang url <> html5 url
+ if (trimEmptyHash($location.absUrl()) != trimEmptyHash(initialUrl)) {
+ $browser.url($location.absUrl(), true);
+ }
+
+ var initializing = true;
+
+ // update $location when $browser url changes
+ $browser.onUrlChange(function(newUrl, newState) {
+
+ if (isUndefined(beginsWith(appBaseNoFile, newUrl))) {
+ // If we are navigating outside of the app then force a reload
+ $window.location.href = newUrl;
+ return;
+ }
+
+ $rootScope.$evalAsync(function() {
+ var oldUrl = $location.absUrl();
+ var oldState = $location.$$state;
+ var defaultPrevented;
+ newUrl = trimEmptyHash(newUrl);
+ $location.$$parse(newUrl);
+ $location.$$state = newState;
+
+ defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
+ newState, oldState).defaultPrevented;
+
+ // if the location was changed by a `$locationChangeStart` handler then stop
+ // processing this location change
+ if ($location.absUrl() !== newUrl) return;
+
+ if (defaultPrevented) {
+ $location.$$parse(oldUrl);
+ $location.$$state = oldState;
+ setBrowserUrlWithFallback(oldUrl, false, oldState);
+ } else {
+ initializing = false;
+ afterLocationChange(oldUrl, oldState);
+ }
+ });
+ if (!$rootScope.$$phase) $rootScope.$digest();
+ });
+
+ // update browser
+ $rootScope.$watch(function $locationWatch() {
+ var oldUrl = trimEmptyHash($browser.url());
+ var newUrl = trimEmptyHash($location.absUrl());
+ var oldState = $browser.state();
+ var currentReplace = $location.$$replace;
+ var urlOrStateChanged = oldUrl !== newUrl ||
+ ($location.$$html5 && $sniffer.history && oldState !== $location.$$state);
+
+ if (initializing || urlOrStateChanged) {
+ initializing = false;
+
+ $rootScope.$evalAsync(function() {
+ var newUrl = $location.absUrl();
+ var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
+ $location.$$state, oldState).defaultPrevented;
+
+ // if the location was changed by a `$locationChangeStart` handler then stop
+ // processing this location change
+ if ($location.absUrl() !== newUrl) return;
+
+ if (defaultPrevented) {
+ $location.$$parse(oldUrl);
+ $location.$$state = oldState;
+ } else {
+ if (urlOrStateChanged) {
+ setBrowserUrlWithFallback(newUrl, currentReplace,
+ oldState === $location.$$state ? null : $location.$$state);
+ }
+ afterLocationChange(oldUrl, oldState);
+ }
+ });
+ }
+
+ $location.$$replace = false;
+
+ // we don't need to return anything because $evalAsync will make the digest loop dirty when
+ // there is a change
+ });
+
+ return $location;
+
+ function afterLocationChange(oldUrl, oldState) {
+ $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl,
+ $location.$$state, oldState);
+ }
+}];
+}
+
+/**
+ * @ngdoc service
+ * @name $log
+ * @requires $window
+ *
+ * @description
+ * Simple service for logging. Default implementation safely writes the message
+ * into the browser's console (if present).
+ *
+ * The main purpose of this service is to simplify debugging and troubleshooting.
+ *
+ * The default is to log `debug` messages. You can use
+ * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.
+ *
+ * @example
+ <example module="logExample">
+ <file name="script.js">
+ angular.module('logExample', [])
+ .controller('LogController', ['$scope', '$log', function($scope, $log) {
+ $scope.$log = $log;
+ $scope.message = 'Hello World!';
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="LogController">
+ <p>Reload this page with open console, enter text and hit the log button...</p>
+ <label>Message:
+ <input type="text" ng-model="message" /></label>
+ <button ng-click="$log.log(message)">log</button>
+ <button ng-click="$log.warn(message)">warn</button>
+ <button ng-click="$log.info(message)">info</button>
+ <button ng-click="$log.error(message)">error</button>
+ <button ng-click="$log.debug(message)">debug</button>
+ </div>
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc provider
+ * @name $logProvider
+ * @description
+ * Use the `$logProvider` to configure how the application logs messages
+ */
+function $LogProvider() {
+ var debug = true,
+ self = this;
+
+ /**
+ * @ngdoc method
+ * @name $logProvider#debugEnabled
+ * @description
+ * @param {boolean=} flag enable or disable debug level messages
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ */
+ this.debugEnabled = function(flag) {
+ if (isDefined(flag)) {
+ debug = flag;
+ return this;
+ } else {
+ return debug;
+ }
+ };
+
+ this.$get = ['$window', function($window) {
+ return {
+ /**
+ * @ngdoc method
+ * @name $log#log
+ *
+ * @description
+ * Write a log message
+ */
+ log: consoleLog('log'),
+
+ /**
+ * @ngdoc method
+ * @name $log#info
+ *
+ * @description
+ * Write an information message
+ */
+ info: consoleLog('info'),
+
+ /**
+ * @ngdoc method
+ * @name $log#warn
+ *
+ * @description
+ * Write a warning message
+ */
+ warn: consoleLog('warn'),
+
+ /**
+ * @ngdoc method
+ * @name $log#error
+ *
+ * @description
+ * Write an error message
+ */
+ error: consoleLog('error'),
+
+ /**
+ * @ngdoc method
+ * @name $log#debug
+ *
+ * @description
+ * Write a debug message
+ */
+ debug: (function() {
+ var fn = consoleLog('debug');
+
+ return function() {
+ if (debug) {
+ fn.apply(self, arguments);
+ }
+ };
+ }())
+ };
+
+ function formatError(arg) {
+ if (arg instanceof Error) {
+ if (arg.stack) {
+ arg = (arg.message && arg.stack.indexOf(arg.message) === -1)
+ ? 'Error: ' + arg.message + '\n' + arg.stack
+ : arg.stack;
+ } else if (arg.sourceURL) {
+ arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line;
+ }
+ }
+ return arg;
+ }
+
+ function consoleLog(type) {
+ var console = $window.console || {},
+ logFn = console[type] || console.log || noop,
+ hasApply = false;
+
+ // Note: reading logFn.apply throws an error in IE11 in IE8 document mode.
+ // The reason behind this is that console.log has type "object" in IE8...
+ try {
+ hasApply = !!logFn.apply;
+ } catch (e) {}
+
+ if (hasApply) {
+ return function() {
+ var args = [];
+ forEach(arguments, function(arg) {
+ args.push(formatError(arg));
+ });
+ return logFn.apply(console, args);
+ };
+ }
+
+ // we are IE which either doesn't have window.console => this is noop and we do nothing,
+ // or we are IE where console.log doesn't have apply so we log at least first 2 args
+ return function(arg1, arg2) {
+ logFn(arg1, arg2 == null ? '' : arg2);
+ };
+ }
+ }];
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+var $parseMinErr = minErr('$parse');
+
+// Sandboxing Angular Expressions
+// ------------------------------
+// Angular expressions are generally considered safe because these expressions only have direct
+// access to `$scope` and locals. However, one can obtain the ability to execute arbitrary JS code by
+// obtaining a reference to native JS functions such as the Function constructor.
+//
+// As an example, consider the following Angular expression:
+//
+// {}.toString.constructor('alert("evil JS code")')
+//
+// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits
+// against the expression language, but not to prevent exploits that were enabled by exposing
+// sensitive JavaScript or browser APIs on Scope. Exposing such objects on a Scope is never a good
+// practice and therefore we are not even trying to protect against interaction with an object
+// explicitly exposed in this way.
+//
+// In general, it is not possible to access a Window object from an angular expression unless a
+// window or some DOM object that has a reference to window is published onto a Scope.
+// Similarly we prevent invocations of function known to be dangerous, as well as assignments to
+// native objects.
+//
+// See https://docs.angularjs.org/guide/security
+
+
+function ensureSafeMemberName(name, fullExpression) {
+ if (name === "__defineGetter__" || name === "__defineSetter__"
+ || name === "__lookupGetter__" || name === "__lookupSetter__"
+ || name === "__proto__") {
+ throw $parseMinErr('isecfld',
+ 'Attempting to access a disallowed field in Angular expressions! '
+ + 'Expression: {0}', fullExpression);
+ }
+ return name;
+}
+
+function getStringValue(name, fullExpression) {
+ // From the JavaScript docs:
+ // Property names must be strings. This means that non-string objects cannot be used
+ // as keys in an object. Any non-string object, including a number, is typecasted
+ // into a string via the toString method.
+ //
+ // So, to ensure that we are checking the same `name` that JavaScript would use,
+ // we cast it to a string, if possible.
+ // Doing `name + ''` can cause a repl error if the result to `toString` is not a string,
+ // this is, this will handle objects that misbehave.
+ name = name + '';
+ if (!isString(name)) {
+ throw $parseMinErr('iseccst',
+ 'Cannot convert object to primitive value! '
+ + 'Expression: {0}', fullExpression);
+ }
+ return name;
+}
+
+function ensureSafeObject(obj, fullExpression) {
+ // nifty check if obj is Function that is fast and works across iframes and other contexts
+ if (obj) {
+ if (obj.constructor === obj) {
+ throw $parseMinErr('isecfn',
+ 'Referencing Function in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (// isWindow(obj)
+ obj.window === obj) {
+ throw $parseMinErr('isecwindow',
+ 'Referencing the Window in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (// isElement(obj)
+ obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) {
+ throw $parseMinErr('isecdom',
+ 'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (// block Object so that we can't get hold of dangerous Object.* methods
+ obj === Object) {
+ throw $parseMinErr('isecobj',
+ 'Referencing Object in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ }
+ }
+ return obj;
+}
+
+var CALL = Function.prototype.call;
+var APPLY = Function.prototype.apply;
+var BIND = Function.prototype.bind;
+
+function ensureSafeFunction(obj, fullExpression) {
+ if (obj) {
+ if (obj.constructor === obj) {
+ throw $parseMinErr('isecfn',
+ 'Referencing Function in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ } else if (obj === CALL || obj === APPLY || obj === BIND) {
+ throw $parseMinErr('isecff',
+ 'Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}',
+ fullExpression);
+ }
+ }
+}
+
+function ensureSafeAssignContext(obj, fullExpression) {
+ if (obj) {
+ if (obj === (0).constructor || obj === (false).constructor || obj === ''.constructor ||
+ obj === {}.constructor || obj === [].constructor || obj === Function.constructor) {
+ throw $parseMinErr('isecaf',
+ 'Assigning to a constructor is disallowed! Expression: {0}', fullExpression);
+ }
+ }
+}
+
+var OPERATORS = createMap();
+forEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function(operator) { OPERATORS[operator] = true; });
+var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'};
+
+
+/////////////////////////////////////////
+
+
+/**
+ * @constructor
+ */
+var Lexer = function(options) {
+ this.options = options;
+};
+
+Lexer.prototype = {
+ constructor: Lexer,
+
+ lex: function(text) {
+ this.text = text;
+ this.index = 0;
+ this.tokens = [];
+
+ while (this.index < this.text.length) {
+ var ch = this.text.charAt(this.index);
+ if (ch === '"' || ch === "'") {
+ this.readString(ch);
+ } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) {
+ this.readNumber();
+ } else if (this.isIdent(ch)) {
+ this.readIdent();
+ } else if (this.is(ch, '(){}[].,;:?')) {
+ this.tokens.push({index: this.index, text: ch});
+ this.index++;
+ } else if (this.isWhitespace(ch)) {
+ this.index++;
+ } else {
+ var ch2 = ch + this.peek();
+ var ch3 = ch2 + this.peek(2);
+ var op1 = OPERATORS[ch];
+ var op2 = OPERATORS[ch2];
+ var op3 = OPERATORS[ch3];
+ if (op1 || op2 || op3) {
+ var token = op3 ? ch3 : (op2 ? ch2 : ch);
+ this.tokens.push({index: this.index, text: token, operator: true});
+ this.index += token.length;
+ } else {
+ this.throwError('Unexpected next character ', this.index, this.index + 1);
+ }
+ }
+ }
+ return this.tokens;
+ },
+
+ is: function(ch, chars) {
+ return chars.indexOf(ch) !== -1;
+ },
+
+ peek: function(i) {
+ var num = i || 1;
+ return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;
+ },
+
+ isNumber: function(ch) {
+ return ('0' <= ch && ch <= '9') && typeof ch === "string";
+ },
+
+ isWhitespace: function(ch) {
+ // IE treats non-breaking space as \u00A0
+ return (ch === ' ' || ch === '\r' || ch === '\t' ||
+ ch === '\n' || ch === '\v' || ch === '\u00A0');
+ },
+
+ isIdent: function(ch) {
+ return ('a' <= ch && ch <= 'z' ||
+ 'A' <= ch && ch <= 'Z' ||
+ '_' === ch || ch === '$');
+ },
+
+ isExpOperator: function(ch) {
+ return (ch === '-' || ch === '+' || this.isNumber(ch));
+ },
+
+ throwError: function(error, start, end) {
+ end = end || this.index;
+ var colStr = (isDefined(start)
+ ? 's ' + start + '-' + this.index + ' [' + this.text.substring(start, end) + ']'
+ : ' ' + end);
+ throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].',
+ error, colStr, this.text);
+ },
+
+ readNumber: function() {
+ var number = '';
+ var start = this.index;
+ while (this.index < this.text.length) {
+ var ch = lowercase(this.text.charAt(this.index));
+ if (ch == '.' || this.isNumber(ch)) {
+ number += ch;
+ } else {
+ var peekCh = this.peek();
+ if (ch == 'e' && this.isExpOperator(peekCh)) {
+ number += ch;
+ } else if (this.isExpOperator(ch) &&
+ peekCh && this.isNumber(peekCh) &&
+ number.charAt(number.length - 1) == 'e') {
+ number += ch;
+ } else if (this.isExpOperator(ch) &&
+ (!peekCh || !this.isNumber(peekCh)) &&
+ number.charAt(number.length - 1) == 'e') {
+ this.throwError('Invalid exponent');
+ } else {
+ break;
+ }
+ }
+ this.index++;
+ }
+ this.tokens.push({
+ index: start,
+ text: number,
+ constant: true,
+ value: Number(number)
+ });
+ },
+
+ readIdent: function() {
+ var start = this.index;
+ while (this.index < this.text.length) {
+ var ch = this.text.charAt(this.index);
+ if (!(this.isIdent(ch) || this.isNumber(ch))) {
+ break;
+ }
+ this.index++;
+ }
+ this.tokens.push({
+ index: start,
+ text: this.text.slice(start, this.index),
+ identifier: true
+ });
+ },
+
+ readString: function(quote) {
+ var start = this.index;
+ this.index++;
+ var string = '';
+ var rawString = quote;
+ var escape = false;
+ while (this.index < this.text.length) {
+ var ch = this.text.charAt(this.index);
+ rawString += ch;
+ if (escape) {
+ if (ch === 'u') {
+ var hex = this.text.substring(this.index + 1, this.index + 5);
+ if (!hex.match(/[\da-f]{4}/i)) {
+ this.throwError('Invalid unicode escape [\\u' + hex + ']');
+ }
+ this.index += 4;
+ string += String.fromCharCode(parseInt(hex, 16));
+ } else {
+ var rep = ESCAPE[ch];
+ string = string + (rep || ch);
+ }
+ escape = false;
+ } else if (ch === '\\') {
+ escape = true;
+ } else if (ch === quote) {
+ this.index++;
+ this.tokens.push({
+ index: start,
+ text: rawString,
+ constant: true,
+ value: string
+ });
+ return;
+ } else {
+ string += ch;
+ }
+ this.index++;
+ }
+ this.throwError('Unterminated quote', start);
+ }
+};
+
+var AST = function(lexer, options) {
+ this.lexer = lexer;
+ this.options = options;
+};
+
+AST.Program = 'Program';
+AST.ExpressionStatement = 'ExpressionStatement';
+AST.AssignmentExpression = 'AssignmentExpression';
+AST.ConditionalExpression = 'ConditionalExpression';
+AST.LogicalExpression = 'LogicalExpression';
+AST.BinaryExpression = 'BinaryExpression';
+AST.UnaryExpression = 'UnaryExpression';
+AST.CallExpression = 'CallExpression';
+AST.MemberExpression = 'MemberExpression';
+AST.Identifier = 'Identifier';
+AST.Literal = 'Literal';
+AST.ArrayExpression = 'ArrayExpression';
+AST.Property = 'Property';
+AST.ObjectExpression = 'ObjectExpression';
+AST.ThisExpression = 'ThisExpression';
+
+// Internal use only
+AST.NGValueParameter = 'NGValueParameter';
+
+AST.prototype = {
+ ast: function(text) {
+ this.text = text;
+ this.tokens = this.lexer.lex(text);
+
+ var value = this.program();
+
+ if (this.tokens.length !== 0) {
+ this.throwError('is an unexpected token', this.tokens[0]);
+ }
+
+ return value;
+ },
+
+ program: function() {
+ var body = [];
+ while (true) {
+ if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']'))
+ body.push(this.expressionStatement());
+ if (!this.expect(';')) {
+ return { type: AST.Program, body: body};
+ }
+ }
+ },
+
+ expressionStatement: function() {
+ return { type: AST.ExpressionStatement, expression: this.filterChain() };
+ },
+
+ filterChain: function() {
+ var left = this.expression();
+ var token;
+ while ((token = this.expect('|'))) {
+ left = this.filter(left);
+ }
+ return left;
+ },
+
+ expression: function() {
+ return this.assignment();
+ },
+
+ assignment: function() {
+ var result = this.ternary();
+ if (this.expect('=')) {
+ result = { type: AST.AssignmentExpression, left: result, right: this.assignment(), operator: '='};
+ }
+ return result;
+ },
+
+ ternary: function() {
+ var test = this.logicalOR();
+ var alternate;
+ var consequent;
+ if (this.expect('?')) {
+ alternate = this.expression();
+ if (this.consume(':')) {
+ consequent = this.expression();
+ return { type: AST.ConditionalExpression, test: test, alternate: alternate, consequent: consequent};
+ }
+ }
+ return test;
+ },
+
+ logicalOR: function() {
+ var left = this.logicalAND();
+ while (this.expect('||')) {
+ left = { type: AST.LogicalExpression, operator: '||', left: left, right: this.logicalAND() };
+ }
+ return left;
+ },
+
+ logicalAND: function() {
+ var left = this.equality();
+ while (this.expect('&&')) {
+ left = { type: AST.LogicalExpression, operator: '&&', left: left, right: this.equality()};
+ }
+ return left;
+ },
+
+ equality: function() {
+ var left = this.relational();
+ var token;
+ while ((token = this.expect('==','!=','===','!=='))) {
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.relational() };
+ }
+ return left;
+ },
+
+ relational: function() {
+ var left = this.additive();
+ var token;
+ while ((token = this.expect('<', '>', '<=', '>='))) {
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.additive() };
+ }
+ return left;
+ },
+
+ additive: function() {
+ var left = this.multiplicative();
+ var token;
+ while ((token = this.expect('+','-'))) {
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.multiplicative() };
+ }
+ return left;
+ },
+
+ multiplicative: function() {
+ var left = this.unary();
+ var token;
+ while ((token = this.expect('*','/','%'))) {
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.unary() };
+ }
+ return left;
+ },
+
+ unary: function() {
+ var token;
+ if ((token = this.expect('+', '-', '!'))) {
+ return { type: AST.UnaryExpression, operator: token.text, prefix: true, argument: this.unary() };
+ } else {
+ return this.primary();
+ }
+ },
+
+ primary: function() {
+ var primary;
+ if (this.expect('(')) {
+ primary = this.filterChain();
+ this.consume(')');
+ } else if (this.expect('[')) {
+ primary = this.arrayDeclaration();
+ } else if (this.expect('{')) {
+ primary = this.object();
+ } else if (this.constants.hasOwnProperty(this.peek().text)) {
+ primary = copy(this.constants[this.consume().text]);
+ } else if (this.peek().identifier) {
+ primary = this.identifier();
+ } else if (this.peek().constant) {
+ primary = this.constant();
+ } else {
+ this.throwError('not a primary expression', this.peek());
+ }
+
+ var next;
+ while ((next = this.expect('(', '[', '.'))) {
+ if (next.text === '(') {
+ primary = {type: AST.CallExpression, callee: primary, arguments: this.parseArguments() };
+ this.consume(')');
+ } else if (next.text === '[') {
+ primary = { type: AST.MemberExpression, object: primary, property: this.expression(), computed: true };
+ this.consume(']');
+ } else if (next.text === '.') {
+ primary = { type: AST.MemberExpression, object: primary, property: this.identifier(), computed: false };
+ } else {
+ this.throwError('IMPOSSIBLE');
+ }
+ }
+ return primary;
+ },
+
+ filter: function(baseExpression) {
+ var args = [baseExpression];
+ var result = {type: AST.CallExpression, callee: this.identifier(), arguments: args, filter: true};
+
+ while (this.expect(':')) {
+ args.push(this.expression());
+ }
+
+ return result;
+ },
+
+ parseArguments: function() {
+ var args = [];
+ if (this.peekToken().text !== ')') {
+ do {
+ args.push(this.expression());
+ } while (this.expect(','));
+ }
+ return args;
+ },
+
+ identifier: function() {
+ var token = this.consume();
+ if (!token.identifier) {
+ this.throwError('is not a valid identifier', token);
+ }
+ return { type: AST.Identifier, name: token.text };
+ },
+
+ constant: function() {
+ // TODO check that it is a constant
+ return { type: AST.Literal, value: this.consume().value };
+ },
+
+ arrayDeclaration: function() {
+ var elements = [];
+ if (this.peekToken().text !== ']') {
+ do {
+ if (this.peek(']')) {
+ // Support trailing commas per ES5.1.
+ break;
+ }
+ elements.push(this.expression());
+ } while (this.expect(','));
+ }
+ this.consume(']');
+
+ return { type: AST.ArrayExpression, elements: elements };
+ },
+
+ object: function() {
+ var properties = [], property;
+ if (this.peekToken().text !== '}') {
+ do {
+ if (this.peek('}')) {
+ // Support trailing commas per ES5.1.
+ break;
+ }
+ property = {type: AST.Property, kind: 'init'};
+ if (this.peek().constant) {
+ property.key = this.constant();
+ } else if (this.peek().identifier) {
+ property.key = this.identifier();
+ } else {
+ this.throwError("invalid key", this.peek());
+ }
+ this.consume(':');
+ property.value = this.expression();
+ properties.push(property);
+ } while (this.expect(','));
+ }
+ this.consume('}');
+
+ return {type: AST.ObjectExpression, properties: properties };
+ },
+
+ throwError: function(msg, token) {
+ throw $parseMinErr('syntax',
+ 'Syntax Error: Token \'{0}\' {1} at column {2} of the expression [{3}] starting at [{4}].',
+ token.text, msg, (token.index + 1), this.text, this.text.substring(token.index));
+ },
+
+ consume: function(e1) {
+ if (this.tokens.length === 0) {
+ throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);
+ }
+
+ var token = this.expect(e1);
+ if (!token) {
+ this.throwError('is unexpected, expecting [' + e1 + ']', this.peek());
+ }
+ return token;
+ },
+
+ peekToken: function() {
+ if (this.tokens.length === 0) {
+ throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);
+ }
+ return this.tokens[0];
+ },
+
+ peek: function(e1, e2, e3, e4) {
+ return this.peekAhead(0, e1, e2, e3, e4);
+ },
+
+ peekAhead: function(i, e1, e2, e3, e4) {
+ if (this.tokens.length > i) {
+ var token = this.tokens[i];
+ var t = token.text;
+ if (t === e1 || t === e2 || t === e3 || t === e4 ||
+ (!e1 && !e2 && !e3 && !e4)) {
+ return token;
+ }
+ }
+ return false;
+ },
+
+ expect: function(e1, e2, e3, e4) {
+ var token = this.peek(e1, e2, e3, e4);
+ if (token) {
+ this.tokens.shift();
+ return token;
+ }
+ return false;
+ },
+
+
+ /* `undefined` is not a constant, it is an identifier,
+ * but using it as an identifier is not supported
+ */
+ constants: {
+ 'true': { type: AST.Literal, value: true },
+ 'false': { type: AST.Literal, value: false },
+ 'null': { type: AST.Literal, value: null },
+ 'undefined': {type: AST.Literal, value: undefined },
+ 'this': {type: AST.ThisExpression }
+ }
+};
+
+function ifDefined(v, d) {
+ return typeof v !== 'undefined' ? v : d;
+}
+
+function plusFn(l, r) {
+ if (typeof l === 'undefined') return r;
+ if (typeof r === 'undefined') return l;
+ return l + r;
+}
+
+function isStateless($filter, filterName) {
+ var fn = $filter(filterName);
+ return !fn.$stateful;
+}
+
+function findConstantAndWatchExpressions(ast, $filter) {
+ var allConstants;
+ var argsToWatch;
+ switch (ast.type) {
+ case AST.Program:
+ allConstants = true;
+ forEach(ast.body, function(expr) {
+ findConstantAndWatchExpressions(expr.expression, $filter);
+ allConstants = allConstants && expr.expression.constant;
+ });
+ ast.constant = allConstants;
+ break;
+ case AST.Literal:
+ ast.constant = true;
+ ast.toWatch = [];
+ break;
+ case AST.UnaryExpression:
+ findConstantAndWatchExpressions(ast.argument, $filter);
+ ast.constant = ast.argument.constant;
+ ast.toWatch = ast.argument.toWatch;
+ break;
+ case AST.BinaryExpression:
+ findConstantAndWatchExpressions(ast.left, $filter);
+ findConstantAndWatchExpressions(ast.right, $filter);
+ ast.constant = ast.left.constant && ast.right.constant;
+ ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch);
+ break;
+ case AST.LogicalExpression:
+ findConstantAndWatchExpressions(ast.left, $filter);
+ findConstantAndWatchExpressions(ast.right, $filter);
+ ast.constant = ast.left.constant && ast.right.constant;
+ ast.toWatch = ast.constant ? [] : [ast];
+ break;
+ case AST.ConditionalExpression:
+ findConstantAndWatchExpressions(ast.test, $filter);
+ findConstantAndWatchExpressions(ast.alternate, $filter);
+ findConstantAndWatchExpressions(ast.consequent, $filter);
+ ast.constant = ast.test.constant && ast.alternate.constant && ast.consequent.constant;
+ ast.toWatch = ast.constant ? [] : [ast];
+ break;
+ case AST.Identifier:
+ ast.constant = false;
+ ast.toWatch = [ast];
+ break;
+ case AST.MemberExpression:
+ findConstantAndWatchExpressions(ast.object, $filter);
+ if (ast.computed) {
+ findConstantAndWatchExpressions(ast.property, $filter);
+ }
+ ast.constant = ast.object.constant && (!ast.computed || ast.property.constant);
+ ast.toWatch = [ast];
+ break;
+ case AST.CallExpression:
+ allConstants = ast.filter ? isStateless($filter, ast.callee.name) : false;
+ argsToWatch = [];
+ forEach(ast.arguments, function(expr) {
+ findConstantAndWatchExpressions(expr, $filter);
+ allConstants = allConstants && expr.constant;
+ if (!expr.constant) {
+ argsToWatch.push.apply(argsToWatch, expr.toWatch);
+ }
+ });
+ ast.constant = allConstants;
+ ast.toWatch = ast.filter && isStateless($filter, ast.callee.name) ? argsToWatch : [ast];
+ break;
+ case AST.AssignmentExpression:
+ findConstantAndWatchExpressions(ast.left, $filter);
+ findConstantAndWatchExpressions(ast.right, $filter);
+ ast.constant = ast.left.constant && ast.right.constant;
+ ast.toWatch = [ast];
+ break;
+ case AST.ArrayExpression:
+ allConstants = true;
+ argsToWatch = [];
+ forEach(ast.elements, function(expr) {
+ findConstantAndWatchExpressions(expr, $filter);
+ allConstants = allConstants && expr.constant;
+ if (!expr.constant) {
+ argsToWatch.push.apply(argsToWatch, expr.toWatch);
+ }
+ });
+ ast.constant = allConstants;
+ ast.toWatch = argsToWatch;
+ break;
+ case AST.ObjectExpression:
+ allConstants = true;
+ argsToWatch = [];
+ forEach(ast.properties, function(property) {
+ findConstantAndWatchExpressions(property.value, $filter);
+ allConstants = allConstants && property.value.constant;
+ if (!property.value.constant) {
+ argsToWatch.push.apply(argsToWatch, property.value.toWatch);
+ }
+ });
+ ast.constant = allConstants;
+ ast.toWatch = argsToWatch;
+ break;
+ case AST.ThisExpression:
+ ast.constant = false;
+ ast.toWatch = [];
+ break;
+ }
+}
+
+function getInputs(body) {
+ if (body.length != 1) return;
+ var lastExpression = body[0].expression;
+ var candidate = lastExpression.toWatch;
+ if (candidate.length !== 1) return candidate;
+ return candidate[0] !== lastExpression ? candidate : undefined;
+}
+
+function isAssignable(ast) {
+ return ast.type === AST.Identifier || ast.type === AST.MemberExpression;
+}
+
+function assignableAST(ast) {
+ if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) {
+ return {type: AST.AssignmentExpression, left: ast.body[0].expression, right: {type: AST.NGValueParameter}, operator: '='};
+ }
+}
+
+function isLiteral(ast) {
+ return ast.body.length === 0 ||
+ ast.body.length === 1 && (
+ ast.body[0].expression.type === AST.Literal ||
+ ast.body[0].expression.type === AST.ArrayExpression ||
+ ast.body[0].expression.type === AST.ObjectExpression);
+}
+
+function isConstant(ast) {
+ return ast.constant;
+}
+
+function ASTCompiler(astBuilder, $filter) {
+ this.astBuilder = astBuilder;
+ this.$filter = $filter;
+}
+
+ASTCompiler.prototype = {
+ compile: function(expression, expensiveChecks) {
+ var self = this;
+ var ast = this.astBuilder.ast(expression);
+ this.state = {
+ nextId: 0,
+ filters: {},
+ expensiveChecks: expensiveChecks,
+ fn: {vars: [], body: [], own: {}},
+ assign: {vars: [], body: [], own: {}},
+ inputs: []
+ };
+ findConstantAndWatchExpressions(ast, self.$filter);
+ var extra = '';
+ var assignable;
+ this.stage = 'assign';
+ if ((assignable = assignableAST(ast))) {
+ this.state.computing = 'assign';
+ var result = this.nextId();
+ this.recurse(assignable, result);
+ this.return_(result);
+ extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l');
+ }
+ var toWatch = getInputs(ast.body);
+ self.stage = 'inputs';
+ forEach(toWatch, function(watch, key) {
+ var fnKey = 'fn' + key;
+ self.state[fnKey] = {vars: [], body: [], own: {}};
+ self.state.computing = fnKey;
+ var intoId = self.nextId();
+ self.recurse(watch, intoId);
+ self.return_(intoId);
+ self.state.inputs.push(fnKey);
+ watch.watchId = key;
+ });
+ this.state.computing = 'fn';
+ this.stage = 'main';
+ this.recurse(ast);
+ var fnString =
+ // The build and minification steps remove the string "use strict" from the code, but this is done using a regex.
+ // This is a workaround for this until we do a better job at only removing the prefix only when we should.
+ '"' + this.USE + ' ' + this.STRICT + '";\n' +
+ this.filterPrefix() +
+ 'var fn=' + this.generateFunction('fn', 's,l,a,i') +
+ extra +
+ this.watchFns() +
+ 'return fn;';
+
+ /* jshint -W054 */
+ var fn = (new Function('$filter',
+ 'ensureSafeMemberName',
+ 'ensureSafeObject',
+ 'ensureSafeFunction',
+ 'getStringValue',
+ 'ensureSafeAssignContext',
+ 'ifDefined',
+ 'plus',
+ 'text',
+ fnString))(
+ this.$filter,
+ ensureSafeMemberName,
+ ensureSafeObject,
+ ensureSafeFunction,
+ getStringValue,
+ ensureSafeAssignContext,
+ ifDefined,
+ plusFn,
+ expression);
+ /* jshint +W054 */
+ this.state = this.stage = undefined;
+ fn.literal = isLiteral(ast);
+ fn.constant = isConstant(ast);
+ return fn;
+ },
+
+ USE: 'use',
+
+ STRICT: 'strict',
+
+ watchFns: function() {
+ var result = [];
+ var fns = this.state.inputs;
+ var self = this;
+ forEach(fns, function(name) {
+ result.push('var ' + name + '=' + self.generateFunction(name, 's'));
+ });
+ if (fns.length) {
+ result.push('fn.inputs=[' + fns.join(',') + '];');
+ }
+ return result.join('');
+ },
+
+ generateFunction: function(name, params) {
+ return 'function(' + params + '){' +
+ this.varsPrefix(name) +
+ this.body(name) +
+ '};';
+ },
+
+ filterPrefix: function() {
+ var parts = [];
+ var self = this;
+ forEach(this.state.filters, function(id, filter) {
+ parts.push(id + '=$filter(' + self.escape(filter) + ')');
+ });
+ if (parts.length) return 'var ' + parts.join(',') + ';';
+ return '';
+ },
+
+ varsPrefix: function(section) {
+ return this.state[section].vars.length ? 'var ' + this.state[section].vars.join(',') + ';' : '';
+ },
+
+ body: function(section) {
+ return this.state[section].body.join('');
+ },
+
+ recurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
+ var left, right, self = this, args, expression;
+ recursionFn = recursionFn || noop;
+ if (!skipWatchIdCheck && isDefined(ast.watchId)) {
+ intoId = intoId || this.nextId();
+ this.if_('i',
+ this.lazyAssign(intoId, this.computedMember('i', ast.watchId)),
+ this.lazyRecurse(ast, intoId, nameId, recursionFn, create, true)
+ );
+ return;
+ }
+ switch (ast.type) {
+ case AST.Program:
+ forEach(ast.body, function(expression, pos) {
+ self.recurse(expression.expression, undefined, undefined, function(expr) { right = expr; });
+ if (pos !== ast.body.length - 1) {
+ self.current().body.push(right, ';');
+ } else {
+ self.return_(right);
+ }
+ });
+ break;
+ case AST.Literal:
+ expression = this.escape(ast.value);
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.UnaryExpression:
+ this.recurse(ast.argument, undefined, undefined, function(expr) { right = expr; });
+ expression = ast.operator + '(' + this.ifDefined(right, 0) + ')';
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.BinaryExpression:
+ this.recurse(ast.left, undefined, undefined, function(expr) { left = expr; });
+ this.recurse(ast.right, undefined, undefined, function(expr) { right = expr; });
+ if (ast.operator === '+') {
+ expression = this.plus(left, right);
+ } else if (ast.operator === '-') {
+ expression = this.ifDefined(left, 0) + ast.operator + this.ifDefined(right, 0);
+ } else {
+ expression = '(' + left + ')' + ast.operator + '(' + right + ')';
+ }
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.LogicalExpression:
+ intoId = intoId || this.nextId();
+ self.recurse(ast.left, intoId);
+ self.if_(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId));
+ recursionFn(intoId);
+ break;
+ case AST.ConditionalExpression:
+ intoId = intoId || this.nextId();
+ self.recurse(ast.test, intoId);
+ self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId));
+ recursionFn(intoId);
+ break;
+ case AST.Identifier:
+ intoId = intoId || this.nextId();
+ if (nameId) {
+ nameId.context = self.stage === 'inputs' ? 's' : this.assign(this.nextId(), this.getHasOwnProperty('l', ast.name) + '?l:s');
+ nameId.computed = false;
+ nameId.name = ast.name;
+ }
+ ensureSafeMemberName(ast.name);
+ self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)),
+ function() {
+ self.if_(self.stage === 'inputs' || 's', function() {
+ if (create && create !== 1) {
+ self.if_(
+ self.not(self.nonComputedMember('s', ast.name)),
+ self.lazyAssign(self.nonComputedMember('s', ast.name), '{}'));
+ }
+ self.assign(intoId, self.nonComputedMember('s', ast.name));
+ });
+ }, intoId && self.lazyAssign(intoId, self.nonComputedMember('l', ast.name))
+ );
+ if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.name)) {
+ self.addEnsureSafeObject(intoId);
+ }
+ recursionFn(intoId);
+ break;
+ case AST.MemberExpression:
+ left = nameId && (nameId.context = this.nextId()) || this.nextId();
+ intoId = intoId || this.nextId();
+ self.recurse(ast.object, left, undefined, function() {
+ self.if_(self.notNull(left), function() {
+ if (ast.computed) {
+ right = self.nextId();
+ self.recurse(ast.property, right);
+ self.getStringValue(right);
+ self.addEnsureSafeMemberName(right);
+ if (create && create !== 1) {
+ self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}'));
+ }
+ expression = self.ensureSafeObject(self.computedMember(left, right));
+ self.assign(intoId, expression);
+ if (nameId) {
+ nameId.computed = true;
+ nameId.name = right;
+ }
+ } else {
+ ensureSafeMemberName(ast.property.name);
+ if (create && create !== 1) {
+ self.if_(self.not(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}'));
+ }
+ expression = self.nonComputedMember(left, ast.property.name);
+ if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.property.name)) {
+ expression = self.ensureSafeObject(expression);
+ }
+ self.assign(intoId, expression);
+ if (nameId) {
+ nameId.computed = false;
+ nameId.name = ast.property.name;
+ }
+ }
+ }, function() {
+ self.assign(intoId, 'undefined');
+ });
+ recursionFn(intoId);
+ }, !!create);
+ break;
+ case AST.CallExpression:
+ intoId = intoId || this.nextId();
+ if (ast.filter) {
+ right = self.filter(ast.callee.name);
+ args = [];
+ forEach(ast.arguments, function(expr) {
+ var argument = self.nextId();
+ self.recurse(expr, argument);
+ args.push(argument);
+ });
+ expression = right + '(' + args.join(',') + ')';
+ self.assign(intoId, expression);
+ recursionFn(intoId);
+ } else {
+ right = self.nextId();
+ left = {};
+ args = [];
+ self.recurse(ast.callee, right, left, function() {
+ self.if_(self.notNull(right), function() {
+ self.addEnsureSafeFunction(right);
+ forEach(ast.arguments, function(expr) {
+ self.recurse(expr, self.nextId(), undefined, function(argument) {
+ args.push(self.ensureSafeObject(argument));
+ });
+ });
+ if (left.name) {
+ if (!self.state.expensiveChecks) {
+ self.addEnsureSafeObject(left.context);
+ }
+ expression = self.member(left.context, left.name, left.computed) + '(' + args.join(',') + ')';
+ } else {
+ expression = right + '(' + args.join(',') + ')';
+ }
+ expression = self.ensureSafeObject(expression);
+ self.assign(intoId, expression);
+ }, function() {
+ self.assign(intoId, 'undefined');
+ });
+ recursionFn(intoId);
+ });
+ }
+ break;
+ case AST.AssignmentExpression:
+ right = this.nextId();
+ left = {};
+ if (!isAssignable(ast.left)) {
+ throw $parseMinErr('lval', 'Trying to assign a value to a non l-value');
+ }
+ this.recurse(ast.left, undefined, left, function() {
+ self.if_(self.notNull(left.context), function() {
+ self.recurse(ast.right, right);
+ self.addEnsureSafeObject(self.member(left.context, left.name, left.computed));
+ self.addEnsureSafeAssignContext(left.context);
+ expression = self.member(left.context, left.name, left.computed) + ast.operator + right;
+ self.assign(intoId, expression);
+ recursionFn(intoId || expression);
+ });
+ }, 1);
+ break;
+ case AST.ArrayExpression:
+ args = [];
+ forEach(ast.elements, function(expr) {
+ self.recurse(expr, self.nextId(), undefined, function(argument) {
+ args.push(argument);
+ });
+ });
+ expression = '[' + args.join(',') + ']';
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.ObjectExpression:
+ args = [];
+ forEach(ast.properties, function(property) {
+ self.recurse(property.value, self.nextId(), undefined, function(expr) {
+ args.push(self.escape(
+ property.key.type === AST.Identifier ? property.key.name :
+ ('' + property.key.value)) +
+ ':' + expr);
+ });
+ });
+ expression = '{' + args.join(',') + '}';
+ this.assign(intoId, expression);
+ recursionFn(expression);
+ break;
+ case AST.ThisExpression:
+ this.assign(intoId, 's');
+ recursionFn('s');
+ break;
+ case AST.NGValueParameter:
+ this.assign(intoId, 'v');
+ recursionFn('v');
+ break;
+ }
+ },
+
+ getHasOwnProperty: function(element, property) {
+ var key = element + '.' + property;
+ var own = this.current().own;
+ if (!own.hasOwnProperty(key)) {
+ own[key] = this.nextId(false, element + '&&(' + this.escape(property) + ' in ' + element + ')');
+ }
+ return own[key];
+ },
+
+ assign: function(id, value) {
+ if (!id) return;
+ this.current().body.push(id, '=', value, ';');
+ return id;
+ },
+
+ filter: function(filterName) {
+ if (!this.state.filters.hasOwnProperty(filterName)) {
+ this.state.filters[filterName] = this.nextId(true);
+ }
+ return this.state.filters[filterName];
+ },
+
+ ifDefined: function(id, defaultValue) {
+ return 'ifDefined(' + id + ',' + this.escape(defaultValue) + ')';
+ },
+
+ plus: function(left, right) {
+ return 'plus(' + left + ',' + right + ')';
+ },
+
+ return_: function(id) {
+ this.current().body.push('return ', id, ';');
+ },
+
+ if_: function(test, alternate, consequent) {
+ if (test === true) {
+ alternate();
+ } else {
+ var body = this.current().body;
+ body.push('if(', test, '){');
+ alternate();
+ body.push('}');
+ if (consequent) {
+ body.push('else{');
+ consequent();
+ body.push('}');
+ }
+ }
+ },
+
+ not: function(expression) {
+ return '!(' + expression + ')';
+ },
+
+ notNull: function(expression) {
+ return expression + '!=null';
+ },
+
+ nonComputedMember: function(left, right) {
+ return left + '.' + right;
+ },
+
+ computedMember: function(left, right) {
+ return left + '[' + right + ']';
+ },
+
+ member: function(left, right, computed) {
+ if (computed) return this.computedMember(left, right);
+ return this.nonComputedMember(left, right);
+ },
+
+ addEnsureSafeObject: function(item) {
+ this.current().body.push(this.ensureSafeObject(item), ';');
+ },
+
+ addEnsureSafeMemberName: function(item) {
+ this.current().body.push(this.ensureSafeMemberName(item), ';');
+ },
+
+ addEnsureSafeFunction: function(item) {
+ this.current().body.push(this.ensureSafeFunction(item), ';');
+ },
+
+ addEnsureSafeAssignContext: function(item) {
+ this.current().body.push(this.ensureSafeAssignContext(item), ';');
+ },
+
+ ensureSafeObject: function(item) {
+ return 'ensureSafeObject(' + item + ',text)';
+ },
+
+ ensureSafeMemberName: function(item) {
+ return 'ensureSafeMemberName(' + item + ',text)';
+ },
+
+ ensureSafeFunction: function(item) {
+ return 'ensureSafeFunction(' + item + ',text)';
+ },
+
+ getStringValue: function(item) {
+ this.assign(item, 'getStringValue(' + item + ',text)');
+ },
+
+ ensureSafeAssignContext: function(item) {
+ return 'ensureSafeAssignContext(' + item + ',text)';
+ },
+
+ lazyRecurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
+ var self = this;
+ return function() {
+ self.recurse(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck);
+ };
+ },
+
+ lazyAssign: function(id, value) {
+ var self = this;
+ return function() {
+ self.assign(id, value);
+ };
+ },
+
+ stringEscapeRegex: /[^ a-zA-Z0-9]/g,
+
+ stringEscapeFn: function(c) {
+ return '\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4);
+ },
+
+ escape: function(value) {
+ if (isString(value)) return "'" + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + "'";
+ if (isNumber(value)) return value.toString();
+ if (value === true) return 'true';
+ if (value === false) return 'false';
+ if (value === null) return 'null';
+ if (typeof value === 'undefined') return 'undefined';
+
+ throw $parseMinErr('esc', 'IMPOSSIBLE');
+ },
+
+ nextId: function(skip, init) {
+ var id = 'v' + (this.state.nextId++);
+ if (!skip) {
+ this.current().vars.push(id + (init ? '=' + init : ''));
+ }
+ return id;
+ },
+
+ current: function() {
+ return this.state[this.state.computing];
+ }
+};
+
+
+function ASTInterpreter(astBuilder, $filter) {
+ this.astBuilder = astBuilder;
+ this.$filter = $filter;
+}
+
+ASTInterpreter.prototype = {
+ compile: function(expression, expensiveChecks) {
+ var self = this;
+ var ast = this.astBuilder.ast(expression);
+ this.expression = expression;
+ this.expensiveChecks = expensiveChecks;
+ findConstantAndWatchExpressions(ast, self.$filter);
+ var assignable;
+ var assign;
+ if ((assignable = assignableAST(ast))) {
+ assign = this.recurse(assignable);
+ }
+ var toWatch = getInputs(ast.body);
+ var inputs;
+ if (toWatch) {
+ inputs = [];
+ forEach(toWatch, function(watch, key) {
+ var input = self.recurse(watch);
+ watch.input = input;
+ inputs.push(input);
+ watch.watchId = key;
+ });
+ }
+ var expressions = [];
+ forEach(ast.body, function(expression) {
+ expressions.push(self.recurse(expression.expression));
+ });
+ var fn = ast.body.length === 0 ? function() {} :
+ ast.body.length === 1 ? expressions[0] :
+ function(scope, locals) {
+ var lastValue;
+ forEach(expressions, function(exp) {
+ lastValue = exp(scope, locals);
+ });
+ return lastValue;
+ };
+ if (assign) {
+ fn.assign = function(scope, value, locals) {
+ return assign(scope, locals, value);
+ };
+ }
+ if (inputs) {
+ fn.inputs = inputs;
+ }
+ fn.literal = isLiteral(ast);
+ fn.constant = isConstant(ast);
+ return fn;
+ },
+
+ recurse: function(ast, context, create) {
+ var left, right, self = this, args, expression;
+ if (ast.input) {
+ return this.inputs(ast.input, ast.watchId);
+ }
+ switch (ast.type) {
+ case AST.Literal:
+ return this.value(ast.value, context);
+ case AST.UnaryExpression:
+ right = this.recurse(ast.argument);
+ return this['unary' + ast.operator](right, context);
+ case AST.BinaryExpression:
+ left = this.recurse(ast.left);
+ right = this.recurse(ast.right);
+ return this['binary' + ast.operator](left, right, context);
+ case AST.LogicalExpression:
+ left = this.recurse(ast.left);
+ right = this.recurse(ast.right);
+ return this['binary' + ast.operator](left, right, context);
+ case AST.ConditionalExpression:
+ return this['ternary?:'](
+ this.recurse(ast.test),
+ this.recurse(ast.alternate),
+ this.recurse(ast.consequent),
+ context
+ );
+ case AST.Identifier:
+ ensureSafeMemberName(ast.name, self.expression);
+ return self.identifier(ast.name,
+ self.expensiveChecks || isPossiblyDangerousMemberName(ast.name),
+ context, create, self.expression);
+ case AST.MemberExpression:
+ left = this.recurse(ast.object, false, !!create);
+ if (!ast.computed) {
+ ensureSafeMemberName(ast.property.name, self.expression);
+ right = ast.property.name;
+ }
+ if (ast.computed) right = this.recurse(ast.property);
+ return ast.computed ?
+ this.computedMember(left, right, context, create, self.expression) :
+ this.nonComputedMember(left, right, self.expensiveChecks, context, create, self.expression);
+ case AST.CallExpression:
+ args = [];
+ forEach(ast.arguments, function(expr) {
+ args.push(self.recurse(expr));
+ });
+ if (ast.filter) right = this.$filter(ast.callee.name);
+ if (!ast.filter) right = this.recurse(ast.callee, true);
+ return ast.filter ?
+ function(scope, locals, assign, inputs) {
+ var values = [];
+ for (var i = 0; i < args.length; ++i) {
+ values.push(args[i](scope, locals, assign, inputs));
+ }
+ var value = right.apply(undefined, values, inputs);
+ return context ? {context: undefined, name: undefined, value: value} : value;
+ } :
+ function(scope, locals, assign, inputs) {
+ var rhs = right(scope, locals, assign, inputs);
+ var value;
+ if (rhs.value != null) {
+ ensureSafeObject(rhs.context, self.expression);
+ ensureSafeFunction(rhs.value, self.expression);
+ var values = [];
+ for (var i = 0; i < args.length; ++i) {
+ values.push(ensureSafeObject(args[i](scope, locals, assign, inputs), self.expression));
+ }
+ value = ensureSafeObject(rhs.value.apply(rhs.context, values), self.expression);
+ }
+ return context ? {value: value} : value;
+ };
+ case AST.AssignmentExpression:
+ left = this.recurse(ast.left, true, 1);
+ right = this.recurse(ast.right);
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ var rhs = right(scope, locals, assign, inputs);
+ ensureSafeObject(lhs.value, self.expression);
+ ensureSafeAssignContext(lhs.context);
+ lhs.context[lhs.name] = rhs;
+ return context ? {value: rhs} : rhs;
+ };
+ case AST.ArrayExpression:
+ args = [];
+ forEach(ast.elements, function(expr) {
+ args.push(self.recurse(expr));
+ });
+ return function(scope, locals, assign, inputs) {
+ var value = [];
+ for (var i = 0; i < args.length; ++i) {
+ value.push(args[i](scope, locals, assign, inputs));
+ }
+ return context ? {value: value} : value;
+ };
+ case AST.ObjectExpression:
+ args = [];
+ forEach(ast.properties, function(property) {
+ args.push({key: property.key.type === AST.Identifier ?
+ property.key.name :
+ ('' + property.key.value),
+ value: self.recurse(property.value)
+ });
+ });
+ return function(scope, locals, assign, inputs) {
+ var value = {};
+ for (var i = 0; i < args.length; ++i) {
+ value[args[i].key] = args[i].value(scope, locals, assign, inputs);
+ }
+ return context ? {value: value} : value;
+ };
+ case AST.ThisExpression:
+ return function(scope) {
+ return context ? {value: scope} : scope;
+ };
+ case AST.NGValueParameter:
+ return function(scope, locals, assign, inputs) {
+ return context ? {value: assign} : assign;
+ };
+ }
+ },
+
+ 'unary+': function(argument, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = argument(scope, locals, assign, inputs);
+ if (isDefined(arg)) {
+ arg = +arg;
+ } else {
+ arg = 0;
+ }
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'unary-': function(argument, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = argument(scope, locals, assign, inputs);
+ if (isDefined(arg)) {
+ arg = -arg;
+ } else {
+ arg = 0;
+ }
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'unary!': function(argument, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = !argument(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary+': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ var rhs = right(scope, locals, assign, inputs);
+ var arg = plusFn(lhs, rhs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary-': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ var rhs = right(scope, locals, assign, inputs);
+ var arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary*': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) * right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary/': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) / right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary%': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) % right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary===': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) === right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary!==': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) !== right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary==': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary!=': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary<': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) < right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary>': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) > right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary<=': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) <= right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary>=': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) >= right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary&&': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) && right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'binary||': function(left, right, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = left(scope, locals, assign, inputs) || right(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ 'ternary?:': function(test, alternate, consequent, context) {
+ return function(scope, locals, assign, inputs) {
+ var arg = test(scope, locals, assign, inputs) ? alternate(scope, locals, assign, inputs) : consequent(scope, locals, assign, inputs);
+ return context ? {value: arg} : arg;
+ };
+ },
+ value: function(value, context) {
+ return function() { return context ? {context: undefined, name: undefined, value: value} : value; };
+ },
+ identifier: function(name, expensiveChecks, context, create, expression) {
+ return function(scope, locals, assign, inputs) {
+ var base = locals && (name in locals) ? locals : scope;
+ if (create && create !== 1 && base && !(base[name])) {
+ base[name] = {};
+ }
+ var value = base ? base[name] : undefined;
+ if (expensiveChecks) {
+ ensureSafeObject(value, expression);
+ }
+ if (context) {
+ return {context: base, name: name, value: value};
+ } else {
+ return value;
+ }
+ };
+ },
+ computedMember: function(left, right, context, create, expression) {
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ var rhs;
+ var value;
+ if (lhs != null) {
+ rhs = right(scope, locals, assign, inputs);
+ rhs = getStringValue(rhs);
+ ensureSafeMemberName(rhs, expression);
+ if (create && create !== 1 && lhs && !(lhs[rhs])) {
+ lhs[rhs] = {};
+ }
+ value = lhs[rhs];
+ ensureSafeObject(value, expression);
+ }
+ if (context) {
+ return {context: lhs, name: rhs, value: value};
+ } else {
+ return value;
+ }
+ };
+ },
+ nonComputedMember: function(left, right, expensiveChecks, context, create, expression) {
+ return function(scope, locals, assign, inputs) {
+ var lhs = left(scope, locals, assign, inputs);
+ if (create && create !== 1 && lhs && !(lhs[right])) {
+ lhs[right] = {};
+ }
+ var value = lhs != null ? lhs[right] : undefined;
+ if (expensiveChecks || isPossiblyDangerousMemberName(right)) {
+ ensureSafeObject(value, expression);
+ }
+ if (context) {
+ return {context: lhs, name: right, value: value};
+ } else {
+ return value;
+ }
+ };
+ },
+ inputs: function(input, watchId) {
+ return function(scope, value, locals, inputs) {
+ if (inputs) return inputs[watchId];
+ return input(scope, value, locals);
+ };
+ }
+};
+
+/**
+ * @constructor
+ */
+var Parser = function(lexer, $filter, options) {
+ this.lexer = lexer;
+ this.$filter = $filter;
+ this.options = options;
+ this.ast = new AST(this.lexer);
+ this.astCompiler = options.csp ? new ASTInterpreter(this.ast, $filter) :
+ new ASTCompiler(this.ast, $filter);
+};
+
+Parser.prototype = {
+ constructor: Parser,
+
+ parse: function(text) {
+ return this.astCompiler.compile(text, this.options.expensiveChecks);
+ }
+};
+
+var getterFnCacheDefault = createMap();
+var getterFnCacheExpensive = createMap();
+
+function isPossiblyDangerousMemberName(name) {
+ return name == 'constructor';
+}
+
+var objectValueOf = Object.prototype.valueOf;
+
+function getValueOf(value) {
+ return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value);
+}
+
+///////////////////////////////////
+
+/**
+ * @ngdoc service
+ * @name $parse
+ * @kind function
+ *
+ * @description
+ *
+ * Converts Angular {@link guide/expression expression} into a function.
+ *
+ * ```js
+ * var getter = $parse('user.name');
+ * var setter = getter.assign;
+ * var context = {user:{name:'angular'}};
+ * var locals = {user:{name:'local'}};
+ *
+ * expect(getter(context)).toEqual('angular');
+ * setter(context, 'newValue');
+ * expect(context.user.name).toEqual('newValue');
+ * expect(getter(context, locals)).toEqual('local');
+ * ```
+ *
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ *
+ * The returned function also has the following properties:
+ * * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript
+ * literal.
+ * * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript
+ * constant literals.
+ * * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be
+ * set to a function to change its value on the given context.
+ *
+ */
+
+
+/**
+ * @ngdoc provider
+ * @name $parseProvider
+ *
+ * @description
+ * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}
+ * service.
+ */
+function $ParseProvider() {
+ var cacheDefault = createMap();
+ var cacheExpensive = createMap();
+
+ this.$get = ['$filter', function($filter) {
+ var noUnsafeEval = csp().noUnsafeEval;
+ var $parseOptions = {
+ csp: noUnsafeEval,
+ expensiveChecks: false
+ },
+ $parseOptionsExpensive = {
+ csp: noUnsafeEval,
+ expensiveChecks: true
+ };
+
+ return function $parse(exp, interceptorFn, expensiveChecks) {
+ var parsedExpression, oneTime, cacheKey;
+
+ switch (typeof exp) {
+ case 'string':
+ exp = exp.trim();
+ cacheKey = exp;
+
+ var cache = (expensiveChecks ? cacheExpensive : cacheDefault);
+ parsedExpression = cache[cacheKey];
+
+ if (!parsedExpression) {
+ if (exp.charAt(0) === ':' && exp.charAt(1) === ':') {
+ oneTime = true;
+ exp = exp.substring(2);
+ }
+ var parseOptions = expensiveChecks ? $parseOptionsExpensive : $parseOptions;
+ var lexer = new Lexer(parseOptions);
+ var parser = new Parser(lexer, $filter, parseOptions);
+ parsedExpression = parser.parse(exp);
+ if (parsedExpression.constant) {
+ parsedExpression.$$watchDelegate = constantWatchDelegate;
+ } else if (oneTime) {
+ parsedExpression.$$watchDelegate = parsedExpression.literal ?
+ oneTimeLiteralWatchDelegate : oneTimeWatchDelegate;
+ } else if (parsedExpression.inputs) {
+ parsedExpression.$$watchDelegate = inputsWatchDelegate;
+ }
+ cache[cacheKey] = parsedExpression;
+ }
+ return addInterceptor(parsedExpression, interceptorFn);
+
+ case 'function':
+ return addInterceptor(exp, interceptorFn);
+
+ default:
+ return noop;
+ }
+ };
+
+ function expressionInputDirtyCheck(newValue, oldValueOfValue) {
+
+ if (newValue == null || oldValueOfValue == null) { // null/undefined
+ return newValue === oldValueOfValue;
+ }
+
+ if (typeof newValue === 'object') {
+
+ // attempt to convert the value to a primitive type
+ // TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can
+ // be cheaply dirty-checked
+ newValue = getValueOf(newValue);
+
+ if (typeof newValue === 'object') {
+ // objects/arrays are not supported - deep-watching them would be too expensive
+ return false;
+ }
+
+ // fall-through to the primitive equality check
+ }
+
+ //Primitive or NaN
+ return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue);
+ }
+
+ function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) {
+ var inputExpressions = parsedExpression.inputs;
+ var lastResult;
+
+ if (inputExpressions.length === 1) {
+ var oldInputValueOf = expressionInputDirtyCheck; // init to something unique so that equals check fails
+ inputExpressions = inputExpressions[0];
+ return scope.$watch(function expressionInputWatch(scope) {
+ var newInputValue = inputExpressions(scope);
+ if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf)) {
+ lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]);
+ oldInputValueOf = newInputValue && getValueOf(newInputValue);
+ }
+ return lastResult;
+ }, listener, objectEquality, prettyPrintExpression);
+ }
+
+ var oldInputValueOfValues = [];
+ var oldInputValues = [];
+ for (var i = 0, ii = inputExpressions.length; i < ii; i++) {
+ oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails
+ oldInputValues[i] = null;
+ }
+
+ return scope.$watch(function expressionInputsWatch(scope) {
+ var changed = false;
+
+ for (var i = 0, ii = inputExpressions.length; i < ii; i++) {
+ var newInputValue = inputExpressions[i](scope);
+ if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) {
+ oldInputValues[i] = newInputValue;
+ oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue);
+ }
+ }
+
+ if (changed) {
+ lastResult = parsedExpression(scope, undefined, undefined, oldInputValues);
+ }
+
+ return lastResult;
+ }, listener, objectEquality, prettyPrintExpression);
+ }
+
+ function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression) {
+ var unwatch, lastValue;
+ return unwatch = scope.$watch(function oneTimeWatch(scope) {
+ return parsedExpression(scope);
+ }, function oneTimeListener(value, old, scope) {
+ lastValue = value;
+ if (isFunction(listener)) {
+ listener.apply(this, arguments);
+ }
+ if (isDefined(value)) {
+ scope.$$postDigest(function() {
+ if (isDefined(lastValue)) {
+ unwatch();
+ }
+ });
+ }
+ }, objectEquality);
+ }
+
+ function oneTimeLiteralWatchDelegate(scope, listener, objectEquality, parsedExpression) {
+ var unwatch, lastValue;
+ return unwatch = scope.$watch(function oneTimeWatch(scope) {
+ return parsedExpression(scope);
+ }, function oneTimeListener(value, old, scope) {
+ lastValue = value;
+ if (isFunction(listener)) {
+ listener.call(this, value, old, scope);
+ }
+ if (isAllDefined(value)) {
+ scope.$$postDigest(function() {
+ if (isAllDefined(lastValue)) unwatch();
+ });
+ }
+ }, objectEquality);
+
+ function isAllDefined(value) {
+ var allDefined = true;
+ forEach(value, function(val) {
+ if (!isDefined(val)) allDefined = false;
+ });
+ return allDefined;
+ }
+ }
+
+ function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) {
+ var unwatch;
+ return unwatch = scope.$watch(function constantWatch(scope) {
+ unwatch();
+ return parsedExpression(scope);
+ }, listener, objectEquality);
+ }
+
+ function addInterceptor(parsedExpression, interceptorFn) {
+ if (!interceptorFn) return parsedExpression;
+ var watchDelegate = parsedExpression.$$watchDelegate;
+ var useInputs = false;
+
+ var regularWatch =
+ watchDelegate !== oneTimeLiteralWatchDelegate &&
+ watchDelegate !== oneTimeWatchDelegate;
+
+ var fn = regularWatch ? function regularInterceptedExpression(scope, locals, assign, inputs) {
+ var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs);
+ return interceptorFn(value, scope, locals);
+ } : function oneTimeInterceptedExpression(scope, locals, assign, inputs) {
+ var value = parsedExpression(scope, locals, assign, inputs);
+ var result = interceptorFn(value, scope, locals);
+ // we only return the interceptor's result if the
+ // initial value is defined (for bind-once)
+ return isDefined(value) ? result : value;
+ };
+
+ // Propagate $$watchDelegates other then inputsWatchDelegate
+ if (parsedExpression.$$watchDelegate &&
+ parsedExpression.$$watchDelegate !== inputsWatchDelegate) {
+ fn.$$watchDelegate = parsedExpression.$$watchDelegate;
+ } else if (!interceptorFn.$stateful) {
+ // If there is an interceptor, but no watchDelegate then treat the interceptor like
+ // we treat filters - it is assumed to be a pure function unless flagged with $stateful
+ fn.$$watchDelegate = inputsWatchDelegate;
+ useInputs = !parsedExpression.inputs;
+ fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression];
+ }
+
+ return fn;
+ }
+ }];
+}
+
+/**
+ * @ngdoc service
+ * @name $q
+ * @requires $rootScope
+ *
+ * @description
+ * A service that helps you run functions asynchronously, and use their return values (or exceptions)
+ * when they are done processing.
+ *
+ * This is an implementation of promises/deferred objects inspired by
+ * [Kris Kowal's Q](https://github.com/kriskowal/q).
+ *
+ * $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred
+ * implementations, and the other which resembles ES6 promises to some degree.
+ *
+ * # $q constructor
+ *
+ * The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver`
+ * function as the first argument. This is similar to the native Promise implementation from ES6 Harmony,
+ * see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
+ *
+ * While the constructor-style use is supported, not all of the supporting methods from ES6 Harmony promises are
+ * available yet.
+ *
+ * It can be used like so:
+ *
+ * ```js
+ * // for the purpose of this example let's assume that variables `$q` and `okToGreet`
+ * // are available in the current lexical scope (they could have been injected or passed in).
+ *
+ * function asyncGreet(name) {
+ * // perform some asynchronous operation, resolve or reject the promise when appropriate.
+ * return $q(function(resolve, reject) {
+ * setTimeout(function() {
+ * if (okToGreet(name)) {
+ * resolve('Hello, ' + name + '!');
+ * } else {
+ * reject('Greeting ' + name + ' is not allowed.');
+ * }
+ * }, 1000);
+ * });
+ * }
+ *
+ * var promise = asyncGreet('Robin Hood');
+ * promise.then(function(greeting) {
+ * alert('Success: ' + greeting);
+ * }, function(reason) {
+ * alert('Failed: ' + reason);
+ * });
+ * ```
+ *
+ * Note: progress/notify callbacks are not currently supported via the ES6-style interface.
+ *
+ * Note: unlike ES6 behaviour, an exception thrown in the constructor function will NOT implicitly reject the promise.
+ *
+ * However, the more traditional CommonJS-style usage is still available, and documented below.
+ *
+ * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an
+ * interface for interacting with an object that represents the result of an action that is
+ * performed asynchronously, and may or may not be finished at any given point in time.
+ *
+ * From the perspective of dealing with error handling, deferred and promise APIs are to
+ * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.
+ *
+ * ```js
+ * // for the purpose of this example let's assume that variables `$q` and `okToGreet`
+ * // are available in the current lexical scope (they could have been injected or passed in).
+ *
+ * function asyncGreet(name) {
+ * var deferred = $q.defer();
+ *
+ * setTimeout(function() {
+ * deferred.notify('About to greet ' + name + '.');
+ *
+ * if (okToGreet(name)) {
+ * deferred.resolve('Hello, ' + name + '!');
+ * } else {
+ * deferred.reject('Greeting ' + name + ' is not allowed.');
+ * }
+ * }, 1000);
+ *
+ * return deferred.promise;
+ * }
+ *
+ * var promise = asyncGreet('Robin Hood');
+ * promise.then(function(greeting) {
+ * alert('Success: ' + greeting);
+ * }, function(reason) {
+ * alert('Failed: ' + reason);
+ * }, function(update) {
+ * alert('Got notification: ' + update);
+ * });
+ * ```
+ *
+ * At first it might not be obvious why this extra complexity is worth the trouble. The payoff
+ * comes in the way of guarantees that promise and deferred APIs make, see
+ * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md.
+ *
+ * Additionally the promise api allows for composition that is very hard to do with the
+ * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.
+ * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the
+ * section on serial or parallel joining of promises.
+ *
+ * # The Deferred API
+ *
+ * A new instance of deferred is constructed by calling `$q.defer()`.
+ *
+ * The purpose of the deferred object is to expose the associated Promise instance as well as APIs
+ * that can be used for signaling the successful or unsuccessful completion, as well as the status
+ * of the task.
+ *
+ * **Methods**
+ *
+ * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection
+ * constructed via `$q.reject`, the promise will be rejected instead.
+ * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to
+ * resolving it with a rejection constructed via `$q.reject`.
+ * - `notify(value)` - provides updates on the status of the promise's execution. This may be called
+ * multiple times before the promise is either resolved or rejected.
+ *
+ * **Properties**
+ *
+ * - promise – `{Promise}` – promise object associated with this deferred.
+ *
+ *
+ * # The Promise API
+ *
+ * A new promise instance is created when a deferred instance is created and can be retrieved by
+ * calling `deferred.promise`.
+ *
+ * The purpose of the promise object is to allow for interested parties to get access to the result
+ * of the deferred task when it completes.
+ *
+ * **Methods**
+ *
+ * - `then(successCallback, errorCallback, notifyCallback)` – regardless of when the promise was or
+ * will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously
+ * as soon as the result is available. The callbacks are called with a single argument: the result
+ * or rejection reason. Additionally, the notify callback may be called zero or more times to
+ * provide a progress indication, before the promise is resolved or rejected.
+ *
+ * This method *returns a new promise* which is resolved or rejected via the return value of the
+ * `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved
+ * with the value which is resolved in that promise using
+ * [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)).
+ * It also notifies via the return value of the `notifyCallback` method. The promise cannot be
+ * resolved or rejected from the notifyCallback method.
+ *
+ * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`
+ *
+ * - `finally(callback, notifyCallback)` – allows you to observe either the fulfillment or rejection of a promise,
+ * but to do so without modifying the final value. This is useful to release resources or do some
+ * clean-up that needs to be done whether the promise was rejected or resolved. See the [full
+ * specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for
+ * more information.
+ *
+ * # Chaining promises
+ *
+ * Because calling the `then` method of a promise returns a new derived promise, it is easily
+ * possible to create a chain of promises:
+ *
+ * ```js
+ * promiseB = promiseA.then(function(result) {
+ * return result + 1;
+ * });
+ *
+ * // promiseB will be resolved immediately after promiseA is resolved and its value
+ * // will be the result of promiseA incremented by 1
+ * ```
+ *
+ * It is possible to create chains of any length and since a promise can be resolved with another
+ * promise (which will defer its resolution further), it is possible to pause/defer resolution of
+ * the promises at any point in the chain. This makes it possible to implement powerful APIs like
+ * $http's response interceptors.
+ *
+ *
+ * # Differences between Kris Kowal's Q and $q
+ *
+ * There are two main differences:
+ *
+ * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation
+ * mechanism in angular, which means faster propagation of resolution or rejection into your
+ * models and avoiding unnecessary browser repaints, which would result in flickering UI.
+ * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains
+ * all the important functionality needed for common async tasks.
+ *
+ * # Testing
+ *
+ * ```js
+ * it('should simulate promise', inject(function($q, $rootScope) {
+ * var deferred = $q.defer();
+ * var promise = deferred.promise;
+ * var resolvedValue;
+ *
+ * promise.then(function(value) { resolvedValue = value; });
+ * expect(resolvedValue).toBeUndefined();
+ *
+ * // Simulate resolving of promise
+ * deferred.resolve(123);
+ * // Note that the 'then' function does not get called synchronously.
+ * // This is because we want the promise API to always be async, whether or not
+ * // it got called synchronously or asynchronously.
+ * expect(resolvedValue).toBeUndefined();
+ *
+ * // Propagate promise resolution to 'then' functions using $apply().
+ * $rootScope.$apply();
+ * expect(resolvedValue).toEqual(123);
+ * }));
+ * ```
+ *
+ * @param {function(function, function)} resolver Function which is responsible for resolving or
+ * rejecting the newly created promise. The first parameter is a function which resolves the
+ * promise, the second parameter is a function which rejects the promise.
+ *
+ * @returns {Promise} The newly created promise.
+ */
+function $QProvider() {
+
+ this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {
+ return qFactory(function(callback) {
+ $rootScope.$evalAsync(callback);
+ }, $exceptionHandler);
+ }];
+}
+
+function $$QProvider() {
+ this.$get = ['$browser', '$exceptionHandler', function($browser, $exceptionHandler) {
+ return qFactory(function(callback) {
+ $browser.defer(callback);
+ }, $exceptionHandler);
+ }];
+}
+
+/**
+ * Constructs a promise manager.
+ *
+ * @param {function(function)} nextTick Function for executing functions in the next turn.
+ * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for
+ * debugging purposes.
+ * @returns {object} Promise manager.
+ */
+function qFactory(nextTick, exceptionHandler) {
+ var $qMinErr = minErr('$q', TypeError);
+
+ /**
+ * @ngdoc method
+ * @name ng.$q#defer
+ * @kind function
+ *
+ * @description
+ * Creates a `Deferred` object which represents a task which will finish in the future.
+ *
+ * @returns {Deferred} Returns a new instance of deferred.
+ */
+ var defer = function() {
+ var d = new Deferred();
+ //Necessary to support unbound execution :/
+ d.resolve = simpleBind(d, d.resolve);
+ d.reject = simpleBind(d, d.reject);
+ d.notify = simpleBind(d, d.notify);
+ return d;
+ };
+
+ function Promise() {
+ this.$$state = { status: 0 };
+ }
+
+ extend(Promise.prototype, {
+ then: function(onFulfilled, onRejected, progressBack) {
+ if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) {
+ return this;
+ }
+ var result = new Deferred();
+
+ this.$$state.pending = this.$$state.pending || [];
+ this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);
+ if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);
+
+ return result.promise;
+ },
+
+ "catch": function(callback) {
+ return this.then(null, callback);
+ },
+
+ "finally": function(callback, progressBack) {
+ return this.then(function(value) {
+ return handleCallback(value, true, callback);
+ }, function(error) {
+ return handleCallback(error, false, callback);
+ }, progressBack);
+ }
+ });
+
+ //Faster, more basic than angular.bind http://jsperf.com/angular-bind-vs-custom-vs-native
+ function simpleBind(context, fn) {
+ return function(value) {
+ fn.call(context, value);
+ };
+ }
+
+ function processQueue(state) {
+ var fn, deferred, pending;
+
+ pending = state.pending;
+ state.processScheduled = false;
+ state.pending = undefined;
+ for (var i = 0, ii = pending.length; i < ii; ++i) {
+ deferred = pending[i][0];
+ fn = pending[i][state.status];
+ try {
+ if (isFunction(fn)) {
+ deferred.resolve(fn(state.value));
+ } else if (state.status === 1) {
+ deferred.resolve(state.value);
+ } else {
+ deferred.reject(state.value);
+ }
+ } catch (e) {
+ deferred.reject(e);
+ exceptionHandler(e);
+ }
+ }
+ }
+
+ function scheduleProcessQueue(state) {
+ if (state.processScheduled || !state.pending) return;
+ state.processScheduled = true;
+ nextTick(function() { processQueue(state); });
+ }
+
+ function Deferred() {
+ this.promise = new Promise();
+ }
+
+ extend(Deferred.prototype, {
+ resolve: function(val) {
+ if (this.promise.$$state.status) return;
+ if (val === this.promise) {
+ this.$$reject($qMinErr(
+ 'qcycle',
+ "Expected promise to be resolved with value other than itself '{0}'",
+ val));
+ } else {
+ this.$$resolve(val);
+ }
+
+ },
+
+ $$resolve: function(val) {
+ var then;
+ var that = this;
+ var done = false;
+ try {
+ if ((isObject(val) || isFunction(val))) then = val && val.then;
+ if (isFunction(then)) {
+ this.promise.$$state.status = -1;
+ then.call(val, resolvePromise, rejectPromise, simpleBind(this, this.notify));
+ } else {
+ this.promise.$$state.value = val;
+ this.promise.$$state.status = 1;
+ scheduleProcessQueue(this.promise.$$state);
+ }
+ } catch (e) {
+ rejectPromise(e);
+ exceptionHandler(e);
+ }
+
+ function resolvePromise(val) {
+ if (done) return;
+ done = true;
+ that.$$resolve(val);
+ }
+ function rejectPromise(val) {
+ if (done) return;
+ done = true;
+ that.$$reject(val);
+ }
+ },
+
+ reject: function(reason) {
+ if (this.promise.$$state.status) return;
+ this.$$reject(reason);
+ },
+
+ $$reject: function(reason) {
+ this.promise.$$state.value = reason;
+ this.promise.$$state.status = 2;
+ scheduleProcessQueue(this.promise.$$state);
+ },
+
+ notify: function(progress) {
+ var callbacks = this.promise.$$state.pending;
+
+ if ((this.promise.$$state.status <= 0) && callbacks && callbacks.length) {
+ nextTick(function() {
+ var callback, result;
+ for (var i = 0, ii = callbacks.length; i < ii; i++) {
+ result = callbacks[i][0];
+ callback = callbacks[i][3];
+ try {
+ result.notify(isFunction(callback) ? callback(progress) : progress);
+ } catch (e) {
+ exceptionHandler(e);
+ }
+ }
+ });
+ }
+ }
+ });
+
+ /**
+ * @ngdoc method
+ * @name $q#reject
+ * @kind function
+ *
+ * @description
+ * Creates a promise that is resolved as rejected with the specified `reason`. This api should be
+ * used to forward rejection in a chain of promises. If you are dealing with the last promise in
+ * a promise chain, you don't need to worry about it.
+ *
+ * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of
+ * `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via
+ * a promise error callback and you want to forward the error to the promise derived from the
+ * current promise, you have to "rethrow" the error by returning a rejection constructed via
+ * `reject`.
+ *
+ * ```js
+ * promiseB = promiseA.then(function(result) {
+ * // success: do something and resolve promiseB
+ * // with the old or a new result
+ * return result;
+ * }, function(reason) {
+ * // error: handle the error if possible and
+ * // resolve promiseB with newPromiseOrValue,
+ * // otherwise forward the rejection to promiseB
+ * if (canHandle(reason)) {
+ * // handle the error and recover
+ * return newPromiseOrValue;
+ * }
+ * return $q.reject(reason);
+ * });
+ * ```
+ *
+ * @param {*} reason Constant, message, exception or an object representing the rejection reason.
+ * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.
+ */
+ var reject = function(reason) {
+ var result = new Deferred();
+ result.reject(reason);
+ return result.promise;
+ };
+
+ var makePromise = function makePromise(value, resolved) {
+ var result = new Deferred();
+ if (resolved) {
+ result.resolve(value);
+ } else {
+ result.reject(value);
+ }
+ return result.promise;
+ };
+
+ var handleCallback = function handleCallback(value, isResolved, callback) {
+ var callbackOutput = null;
+ try {
+ if (isFunction(callback)) callbackOutput = callback();
+ } catch (e) {
+ return makePromise(e, false);
+ }
+ if (isPromiseLike(callbackOutput)) {
+ return callbackOutput.then(function() {
+ return makePromise(value, isResolved);
+ }, function(error) {
+ return makePromise(error, false);
+ });
+ } else {
+ return makePromise(value, isResolved);
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $q#when
+ * @kind function
+ *
+ * @description
+ * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.
+ * This is useful when you are dealing with an object that might or might not be a promise, or if
+ * the promise comes from a source that can't be trusted.
+ *
+ * @param {*} value Value or a promise
+ * @param {Function=} successCallback
+ * @param {Function=} errorCallback
+ * @param {Function=} progressCallback
+ * @returns {Promise} Returns a promise of the passed value or promise
+ */
+
+
+ var when = function(value, callback, errback, progressBack) {
+ var result = new Deferred();
+ result.resolve(value);
+ return result.promise.then(callback, errback, progressBack);
+ };
+
+ /**
+ * @ngdoc method
+ * @name $q#resolve
+ * @kind function
+ *
+ * @description
+ * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6.
+ *
+ * @param {*} value Value or a promise
+ * @param {Function=} successCallback
+ * @param {Function=} errorCallback
+ * @param {Function=} progressCallback
+ * @returns {Promise} Returns a promise of the passed value or promise
+ */
+ var resolve = when;
+
+ /**
+ * @ngdoc method
+ * @name $q#all
+ * @kind function
+ *
+ * @description
+ * Combines multiple promises into a single promise that is resolved when all of the input
+ * promises are resolved.
+ *
+ * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.
+ * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values,
+ * each value corresponding to the promise at the same index/key in the `promises` array/hash.
+ * If any of the promises is resolved with a rejection, this resulting promise will be rejected
+ * with the same rejection value.
+ */
+
+ function all(promises) {
+ var deferred = new Deferred(),
+ counter = 0,
+ results = isArray(promises) ? [] : {};
+
+ forEach(promises, function(promise, key) {
+ counter++;
+ when(promise).then(function(value) {
+ if (results.hasOwnProperty(key)) return;
+ results[key] = value;
+ if (!(--counter)) deferred.resolve(results);
+ }, function(reason) {
+ if (results.hasOwnProperty(key)) return;
+ deferred.reject(reason);
+ });
+ });
+
+ if (counter === 0) {
+ deferred.resolve(results);
+ }
+
+ return deferred.promise;
+ }
+
+ var $Q = function Q(resolver) {
+ if (!isFunction(resolver)) {
+ throw $qMinErr('norslvr', "Expected resolverFn, got '{0}'", resolver);
+ }
+
+ if (!(this instanceof Q)) {
+ // More useful when $Q is the Promise itself.
+ return new Q(resolver);
+ }
+
+ var deferred = new Deferred();
+
+ function resolveFn(value) {
+ deferred.resolve(value);
+ }
+
+ function rejectFn(reason) {
+ deferred.reject(reason);
+ }
+
+ resolver(resolveFn, rejectFn);
+
+ return deferred.promise;
+ };
+
+ $Q.defer = defer;
+ $Q.reject = reject;
+ $Q.when = when;
+ $Q.resolve = resolve;
+ $Q.all = all;
+
+ return $Q;
+}
+
+function $$RAFProvider() { //rAF
+ this.$get = ['$window', '$timeout', function($window, $timeout) {
+ var requestAnimationFrame = $window.requestAnimationFrame ||
+ $window.webkitRequestAnimationFrame;
+
+ var cancelAnimationFrame = $window.cancelAnimationFrame ||
+ $window.webkitCancelAnimationFrame ||
+ $window.webkitCancelRequestAnimationFrame;
+
+ var rafSupported = !!requestAnimationFrame;
+ var raf = rafSupported
+ ? function(fn) {
+ var id = requestAnimationFrame(fn);
+ return function() {
+ cancelAnimationFrame(id);
+ };
+ }
+ : function(fn) {
+ var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666
+ return function() {
+ $timeout.cancel(timer);
+ };
+ };
+
+ raf.supported = rafSupported;
+
+ return raf;
+ }];
+}
+
+/**
+ * DESIGN NOTES
+ *
+ * The design decisions behind the scope are heavily favored for speed and memory consumption.
+ *
+ * The typical use of scope is to watch the expressions, which most of the time return the same
+ * value as last time so we optimize the operation.
+ *
+ * Closures construction is expensive in terms of speed as well as memory:
+ * - No closures, instead use prototypical inheritance for API
+ * - Internal state needs to be stored on scope directly, which means that private state is
+ * exposed as $$____ properties
+ *
+ * Loop operations are optimized by using while(count--) { ... }
+ * - This means that in order to keep the same order of execution as addition we have to add
+ * items to the array at the beginning (unshift) instead of at the end (push)
+ *
+ * Child scopes are created and removed often
+ * - Using an array would be slow since inserts in the middle are expensive; so we use linked lists
+ *
+ * There are fewer watches than observers. This is why you don't want the observer to be implemented
+ * in the same way as watch. Watch requires return of the initialization function which is expensive
+ * to construct.
+ */
+
+
+/**
+ * @ngdoc provider
+ * @name $rootScopeProvider
+ * @description
+ *
+ * Provider for the $rootScope service.
+ */
+
+/**
+ * @ngdoc method
+ * @name $rootScopeProvider#digestTtl
+ * @description
+ *
+ * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and
+ * assuming that the model is unstable.
+ *
+ * The current default is 10 iterations.
+ *
+ * In complex applications it's possible that the dependencies between `$watch`s will result in
+ * several digest iterations. However if an application needs more than the default 10 digest
+ * iterations for its model to stabilize then you should investigate what is causing the model to
+ * continuously change during the digest.
+ *
+ * Increasing the TTL could have performance implications, so you should not change it without
+ * proper justification.
+ *
+ * @param {number} limit The number of digest iterations.
+ */
+
+
+/**
+ * @ngdoc service
+ * @name $rootScope
+ * @description
+ *
+ * Every application has a single root {@link ng.$rootScope.Scope scope}.
+ * All other scopes are descendant scopes of the root scope. Scopes provide separation
+ * between the model and the view, via a mechanism for watching the model for changes.
+ * They also provide event emission/broadcast and subscription facility. See the
+ * {@link guide/scope developer guide on scopes}.
+ */
+function $RootScopeProvider() {
+ var TTL = 10;
+ var $rootScopeMinErr = minErr('$rootScope');
+ var lastDirtyWatch = null;
+ var applyAsyncId = null;
+
+ this.digestTtl = function(value) {
+ if (arguments.length) {
+ TTL = value;
+ }
+ return TTL;
+ };
+
+ function createChildScopeClass(parent) {
+ function ChildScope() {
+ this.$$watchers = this.$$nextSibling =
+ this.$$childHead = this.$$childTail = null;
+ this.$$listeners = {};
+ this.$$listenerCount = {};
+ this.$$watchersCount = 0;
+ this.$id = nextUid();
+ this.$$ChildScope = null;
+ }
+ ChildScope.prototype = parent;
+ return ChildScope;
+ }
+
+ this.$get = ['$exceptionHandler', '$parse', '$browser',
+ function($exceptionHandler, $parse, $browser) {
+
+ function destroyChildScope($event) {
+ $event.currentScope.$$destroyed = true;
+ }
+
+ function cleanUpScope($scope) {
+
+ if (msie === 9) {
+ // There is a memory leak in IE9 if all child scopes are not disconnected
+ // completely when a scope is destroyed. So this code will recurse up through
+ // all this scopes children
+ //
+ // See issue https://github.com/angular/angular.js/issues/10706
+ $scope.$$childHead && cleanUpScope($scope.$$childHead);
+ $scope.$$nextSibling && cleanUpScope($scope.$$nextSibling);
+ }
+
+ // The code below works around IE9 and V8's memory leaks
+ //
+ // See:
+ // - https://code.google.com/p/v8/issues/detail?id=2073#c26
+ // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
+ // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
+
+ $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead =
+ $scope.$$childTail = $scope.$root = $scope.$$watchers = null;
+ }
+
+ /**
+ * @ngdoc type
+ * @name $rootScope.Scope
+ *
+ * @description
+ * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the
+ * {@link auto.$injector $injector}. Child scopes are created using the
+ * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
+ * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for
+ * an in-depth introduction and usage examples.
+ *
+ *
+ * # Inheritance
+ * A scope can inherit from a parent scope, as in this example:
+ * ```js
+ var parent = $rootScope;
+ var child = parent.$new();
+
+ parent.salutation = "Hello";
+ expect(child.salutation).toEqual('Hello');
+
+ child.salutation = "Welcome";
+ expect(child.salutation).toEqual('Welcome');
+ expect(parent.salutation).toEqual('Hello');
+ * ```
+ *
+ * When interacting with `Scope` in tests, additional helper methods are available on the
+ * instances of `Scope` type. See {@link ngMock.$rootScope.Scope ngMock Scope} for additional
+ * details.
+ *
+ *
+ * @param {Object.<string, function()>=} providers Map of service factory which need to be
+ * provided for the current scope. Defaults to {@link ng}.
+ * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should
+ * append/override services provided by `providers`. This is handy
+ * when unit-testing and having the need to override a default
+ * service.
+ * @returns {Object} Newly created scope.
+ *
+ */
+ function Scope() {
+ this.$id = nextUid();
+ this.$$phase = this.$parent = this.$$watchers =
+ this.$$nextSibling = this.$$prevSibling =
+ this.$$childHead = this.$$childTail = null;
+ this.$root = this;
+ this.$$destroyed = false;
+ this.$$listeners = {};
+ this.$$listenerCount = {};
+ this.$$watchersCount = 0;
+ this.$$isolateBindings = null;
+ }
+
+ /**
+ * @ngdoc property
+ * @name $rootScope.Scope#$id
+ *
+ * @description
+ * Unique scope ID (monotonically increasing) useful for debugging.
+ */
+
+ /**
+ * @ngdoc property
+ * @name $rootScope.Scope#$parent
+ *
+ * @description
+ * Reference to the parent scope.
+ */
+
+ /**
+ * @ngdoc property
+ * @name $rootScope.Scope#$root
+ *
+ * @description
+ * Reference to the root scope.
+ */
+
+ Scope.prototype = {
+ constructor: Scope,
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$new
+ * @kind function
+ *
+ * @description
+ * Creates a new child {@link ng.$rootScope.Scope scope}.
+ *
+ * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event.
+ * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.
+ *
+ * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is
+ * desired for the scope and its child scopes to be permanently detached from the parent and
+ * thus stop participating in model change detection and listener notification by invoking.
+ *
+ * @param {boolean} isolate If true, then the scope does not prototypically inherit from the
+ * parent scope. The scope is isolated, as it can not see parent scope properties.
+ * When creating widgets, it is useful for the widget to not accidentally read parent
+ * state.
+ *
+ * @param {Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent`
+ * of the newly created scope. Defaults to `this` scope if not provided.
+ * This is used when creating a transclude scope to correctly place it
+ * in the scope hierarchy while maintaining the correct prototypical
+ * inheritance.
+ *
+ * @returns {Object} The newly created child scope.
+ *
+ */
+ $new: function(isolate, parent) {
+ var child;
+
+ parent = parent || this;
+
+ if (isolate) {
+ child = new Scope();
+ child.$root = this.$root;
+ } else {
+ // Only create a child scope class if somebody asks for one,
+ // but cache it to allow the VM to optimize lookups.
+ if (!this.$$ChildScope) {
+ this.$$ChildScope = createChildScopeClass(this);
+ }
+ child = new this.$$ChildScope();
+ }
+ child.$parent = parent;
+ child.$$prevSibling = parent.$$childTail;
+ if (parent.$$childHead) {
+ parent.$$childTail.$$nextSibling = child;
+ parent.$$childTail = child;
+ } else {
+ parent.$$childHead = parent.$$childTail = child;
+ }
+
+ // When the new scope is not isolated or we inherit from `this`, and
+ // the parent scope is destroyed, the property `$$destroyed` is inherited
+ // prototypically. In all other cases, this property needs to be set
+ // when the parent scope is destroyed.
+ // The listener needs to be added after the parent is set
+ if (isolate || parent != this) child.$on('$destroy', destroyChildScope);
+
+ return child;
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$watch
+ * @kind function
+ *
+ * @description
+ * Registers a `listener` callback to be executed whenever the `watchExpression` changes.
+ *
+ * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest
+ * $digest()} and should return the value that will be watched. (`watchExpression` should not change
+ * its value when executed multiple times with the same input because it may be executed multiple
+ * times by {@link ng.$rootScope.Scope#$digest $digest()}. That is, `watchExpression` should be
+ * [idempotent](http://en.wikipedia.org/wiki/Idempotence).
+ * - The `listener` is called only when the value from the current `watchExpression` and the
+ * previous call to `watchExpression` are not equal (with the exception of the initial run,
+ * see below). Inequality is determined according to reference inequality,
+ * [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators)
+ * via the `!==` Javascript operator, unless `objectEquality == true`
+ * (see next point)
+ * - When `objectEquality == true`, inequality of the `watchExpression` is determined
+ * according to the {@link angular.equals} function. To save the value of the object for
+ * later comparison, the {@link angular.copy} function is used. This therefore means that
+ * watching complex objects will have adverse memory and performance implications.
+ * - The watch `listener` may change the model, which may trigger other `listener`s to fire.
+ * This is achieved by rerunning the watchers until no changes are detected. The rerun
+ * iteration limit is 10 to prevent an infinite loop deadlock.
+ *
+ *
+ * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,
+ * you can register a `watchExpression` function with no `listener`. (Be prepared for
+ * multiple calls to your `watchExpression` because it will execute multiple times in a
+ * single {@link ng.$rootScope.Scope#$digest $digest} cycle if a change is detected.)
+ *
+ * After a watcher is registered with the scope, the `listener` fn is called asynchronously
+ * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the
+ * watcher. In rare cases, this is undesirable because the listener is called when the result
+ * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you
+ * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the
+ * listener was called due to initialization.
+ *
+ *
+ *
+ * # Example
+ * ```js
+ // let's assume that scope was dependency injected as the $rootScope
+ var scope = $rootScope;
+ scope.name = 'misko';
+ scope.counter = 0;
+
+ expect(scope.counter).toEqual(0);
+ scope.$watch('name', function(newValue, oldValue) {
+ scope.counter = scope.counter + 1;
+ });
+ expect(scope.counter).toEqual(0);
+
+ scope.$digest();
+ // the listener is always called during the first $digest loop after it was registered
+ expect(scope.counter).toEqual(1);
+
+ scope.$digest();
+ // but now it will not be called unless the value changes
+ expect(scope.counter).toEqual(1);
+
+ scope.name = 'adam';
+ scope.$digest();
+ expect(scope.counter).toEqual(2);
+
+
+
+ // Using a function as a watchExpression
+ var food;
+ scope.foodCounter = 0;
+ expect(scope.foodCounter).toEqual(0);
+ scope.$watch(
+ // This function returns the value being watched. It is called for each turn of the $digest loop
+ function() { return food; },
+ // This is the change listener, called when the value returned from the above function changes
+ function(newValue, oldValue) {
+ if ( newValue !== oldValue ) {
+ // Only increment the counter if the value changed
+ scope.foodCounter = scope.foodCounter + 1;
+ }
+ }
+ );
+ // No digest has been run so the counter will be zero
+ expect(scope.foodCounter).toEqual(0);
+
+ // Run the digest but since food has not changed count will still be zero
+ scope.$digest();
+ expect(scope.foodCounter).toEqual(0);
+
+ // Update food and run digest. Now the counter will increment
+ food = 'cheeseburger';
+ scope.$digest();
+ expect(scope.foodCounter).toEqual(1);
+
+ * ```
+ *
+ *
+ *
+ * @param {(function()|string)} watchExpression Expression that is evaluated on each
+ * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers
+ * a call to the `listener`.
+ *
+ * - `string`: Evaluated as {@link guide/expression expression}
+ * - `function(scope)`: called with current `scope` as a parameter.
+ * @param {function(newVal, oldVal, scope)} listener Callback called whenever the value
+ * of `watchExpression` changes.
+ *
+ * - `newVal` contains the current value of the `watchExpression`
+ * - `oldVal` contains the previous value of the `watchExpression`
+ * - `scope` refers to the current scope
+ * @param {boolean=} [objectEquality=false] Compare for object equality using {@link angular.equals} instead of
+ * comparing for reference equality.
+ * @returns {function()} Returns a deregistration function for this listener.
+ */
+ $watch: function(watchExp, listener, objectEquality, prettyPrintExpression) {
+ var get = $parse(watchExp);
+
+ if (get.$$watchDelegate) {
+ return get.$$watchDelegate(this, listener, objectEquality, get, watchExp);
+ }
+ var scope = this,
+ array = scope.$$watchers,
+ watcher = {
+ fn: listener,
+ last: initWatchVal,
+ get: get,
+ exp: prettyPrintExpression || watchExp,
+ eq: !!objectEquality
+ };
+
+ lastDirtyWatch = null;
+
+ if (!isFunction(listener)) {
+ watcher.fn = noop;
+ }
+
+ if (!array) {
+ array = scope.$$watchers = [];
+ }
+ // we use unshift since we use a while loop in $digest for speed.
+ // the while loop reads in reverse order.
+ array.unshift(watcher);
+ incrementWatchersCount(this, 1);
+
+ return function deregisterWatch() {
+ if (arrayRemove(array, watcher) >= 0) {
+ incrementWatchersCount(scope, -1);
+ }
+ lastDirtyWatch = null;
+ };
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$watchGroup
+ * @kind function
+ *
+ * @description
+ * A variant of {@link ng.$rootScope.Scope#$watch $watch()} where it watches an array of `watchExpressions`.
+ * If any one expression in the collection changes the `listener` is executed.
+ *
+ * - The items in the `watchExpressions` array are observed via standard $watch operation and are examined on every
+ * call to $digest() to see if any items changes.
+ * - The `listener` is called whenever any expression in the `watchExpressions` array changes.
+ *
+ * @param {Array.<string|Function(scope)>} watchExpressions Array of expressions that will be individually
+ * watched using {@link ng.$rootScope.Scope#$watch $watch()}
+ *
+ * @param {function(newValues, oldValues, scope)} listener Callback called whenever the return value of any
+ * expression in `watchExpressions` changes
+ * The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching
+ * those of `watchExpression`
+ * and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching
+ * those of `watchExpression`
+ * The `scope` refers to the current scope.
+ * @returns {function()} Returns a de-registration function for all listeners.
+ */
+ $watchGroup: function(watchExpressions, listener) {
+ var oldValues = new Array(watchExpressions.length);
+ var newValues = new Array(watchExpressions.length);
+ var deregisterFns = [];
+ var self = this;
+ var changeReactionScheduled = false;
+ var firstRun = true;
+
+ if (!watchExpressions.length) {
+ // No expressions means we call the listener ASAP
+ var shouldCall = true;
+ self.$evalAsync(function() {
+ if (shouldCall) listener(newValues, newValues, self);
+ });
+ return function deregisterWatchGroup() {
+ shouldCall = false;
+ };
+ }
+
+ if (watchExpressions.length === 1) {
+ // Special case size of one
+ return this.$watch(watchExpressions[0], function watchGroupAction(value, oldValue, scope) {
+ newValues[0] = value;
+ oldValues[0] = oldValue;
+ listener(newValues, (value === oldValue) ? newValues : oldValues, scope);
+ });
+ }
+
+ forEach(watchExpressions, function(expr, i) {
+ var unwatchFn = self.$watch(expr, function watchGroupSubAction(value, oldValue) {
+ newValues[i] = value;
+ oldValues[i] = oldValue;
+ if (!changeReactionScheduled) {
+ changeReactionScheduled = true;
+ self.$evalAsync(watchGroupAction);
+ }
+ });
+ deregisterFns.push(unwatchFn);
+ });
+
+ function watchGroupAction() {
+ changeReactionScheduled = false;
+
+ if (firstRun) {
+ firstRun = false;
+ listener(newValues, newValues, self);
+ } else {
+ listener(newValues, oldValues, self);
+ }
+ }
+
+ return function deregisterWatchGroup() {
+ while (deregisterFns.length) {
+ deregisterFns.shift()();
+ }
+ };
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$watchCollection
+ * @kind function
+ *
+ * @description
+ * Shallow watches the properties of an object and fires whenever any of the properties change
+ * (for arrays, this implies watching the array items; for object maps, this implies watching
+ * the properties). If a change is detected, the `listener` callback is fired.
+ *
+ * - The `obj` collection is observed via standard $watch operation and is examined on every
+ * call to $digest() to see if any items have been added, removed, or moved.
+ * - The `listener` is called whenever anything within the `obj` has changed. Examples include
+ * adding, removing, and moving items belonging to an object or array.
+ *
+ *
+ * # Example
+ * ```js
+ $scope.names = ['igor', 'matias', 'misko', 'james'];
+ $scope.dataCount = 4;
+
+ $scope.$watchCollection('names', function(newNames, oldNames) {
+ $scope.dataCount = newNames.length;
+ });
+
+ expect($scope.dataCount).toEqual(4);
+ $scope.$digest();
+
+ //still at 4 ... no changes
+ expect($scope.dataCount).toEqual(4);
+
+ $scope.names.pop();
+ $scope.$digest();
+
+ //now there's been a change
+ expect($scope.dataCount).toEqual(3);
+ * ```
+ *
+ *
+ * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The
+ * expression value should evaluate to an object or an array which is observed on each
+ * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the
+ * collection will trigger a call to the `listener`.
+ *
+ * @param {function(newCollection, oldCollection, scope)} listener a callback function called
+ * when a change is detected.
+ * - The `newCollection` object is the newly modified data obtained from the `obj` expression
+ * - The `oldCollection` object is a copy of the former collection data.
+ * Due to performance considerations, the`oldCollection` value is computed only if the
+ * `listener` function declares two or more arguments.
+ * - The `scope` argument refers to the current scope.
+ *
+ * @returns {function()} Returns a de-registration function for this listener. When the
+ * de-registration function is executed, the internal watch operation is terminated.
+ */
+ $watchCollection: function(obj, listener) {
+ $watchCollectionInterceptor.$stateful = true;
+
+ var self = this;
+ // the current value, updated on each dirty-check run
+ var newValue;
+ // a shallow copy of the newValue from the last dirty-check run,
+ // updated to match newValue during dirty-check run
+ var oldValue;
+ // a shallow copy of the newValue from when the last change happened
+ var veryOldValue;
+ // only track veryOldValue if the listener is asking for it
+ var trackVeryOldValue = (listener.length > 1);
+ var changeDetected = 0;
+ var changeDetector = $parse(obj, $watchCollectionInterceptor);
+ var internalArray = [];
+ var internalObject = {};
+ var initRun = true;
+ var oldLength = 0;
+
+ function $watchCollectionInterceptor(_value) {
+ newValue = _value;
+ var newLength, key, bothNaN, newItem, oldItem;
+
+ // If the new value is undefined, then return undefined as the watch may be a one-time watch
+ if (isUndefined(newValue)) return;
+
+ if (!isObject(newValue)) { // if primitive
+ if (oldValue !== newValue) {
+ oldValue = newValue;
+ changeDetected++;
+ }
+ } else if (isArrayLike(newValue)) {
+ if (oldValue !== internalArray) {
+ // we are transitioning from something which was not an array into array.
+ oldValue = internalArray;
+ oldLength = oldValue.length = 0;
+ changeDetected++;
+ }
+
+ newLength = newValue.length;
+
+ if (oldLength !== newLength) {
+ // if lengths do not match we need to trigger change notification
+ changeDetected++;
+ oldValue.length = oldLength = newLength;
+ }
+ // copy the items to oldValue and look for changes.
+ for (var i = 0; i < newLength; i++) {
+ oldItem = oldValue[i];
+ newItem = newValue[i];
+
+ bothNaN = (oldItem !== oldItem) && (newItem !== newItem);
+ if (!bothNaN && (oldItem !== newItem)) {
+ changeDetected++;
+ oldValue[i] = newItem;
+ }
+ }
+ } else {
+ if (oldValue !== internalObject) {
+ // we are transitioning from something which was not an object into object.
+ oldValue = internalObject = {};
+ oldLength = 0;
+ changeDetected++;
+ }
+ // copy the items to oldValue and look for changes.
+ newLength = 0;
+ for (key in newValue) {
+ if (hasOwnProperty.call(newValue, key)) {
+ newLength++;
+ newItem = newValue[key];
+ oldItem = oldValue[key];
+
+ if (key in oldValue) {
+ bothNaN = (oldItem !== oldItem) && (newItem !== newItem);
+ if (!bothNaN && (oldItem !== newItem)) {
+ changeDetected++;
+ oldValue[key] = newItem;
+ }
+ } else {
+ oldLength++;
+ oldValue[key] = newItem;
+ changeDetected++;
+ }
+ }
+ }
+ if (oldLength > newLength) {
+ // we used to have more keys, need to find them and destroy them.
+ changeDetected++;
+ for (key in oldValue) {
+ if (!hasOwnProperty.call(newValue, key)) {
+ oldLength--;
+ delete oldValue[key];
+ }
+ }
+ }
+ }
+ return changeDetected;
+ }
+
+ function $watchCollectionAction() {
+ if (initRun) {
+ initRun = false;
+ listener(newValue, newValue, self);
+ } else {
+ listener(newValue, veryOldValue, self);
+ }
+
+ // make a copy for the next time a collection is changed
+ if (trackVeryOldValue) {
+ if (!isObject(newValue)) {
+ //primitive
+ veryOldValue = newValue;
+ } else if (isArrayLike(newValue)) {
+ veryOldValue = new Array(newValue.length);
+ for (var i = 0; i < newValue.length; i++) {
+ veryOldValue[i] = newValue[i];
+ }
+ } else { // if object
+ veryOldValue = {};
+ for (var key in newValue) {
+ if (hasOwnProperty.call(newValue, key)) {
+ veryOldValue[key] = newValue[key];
+ }
+ }
+ }
+ }
+ }
+
+ return this.$watch(changeDetector, $watchCollectionAction);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$digest
+ * @kind function
+ *
+ * @description
+ * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and
+ * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change
+ * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}
+ * until no more listeners are firing. This means that it is possible to get into an infinite
+ * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of
+ * iterations exceeds 10.
+ *
+ * Usually, you don't call `$digest()` directly in
+ * {@link ng.directive:ngController controllers} or in
+ * {@link ng.$compileProvider#directive directives}.
+ * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within
+ * a {@link ng.$compileProvider#directive directive}), which will force a `$digest()`.
+ *
+ * If you want to be notified whenever `$digest()` is called,
+ * you can register a `watchExpression` function with
+ * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.
+ *
+ * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
+ *
+ * # Example
+ * ```js
+ var scope = ...;
+ scope.name = 'misko';
+ scope.counter = 0;
+
+ expect(scope.counter).toEqual(0);
+ scope.$watch('name', function(newValue, oldValue) {
+ scope.counter = scope.counter + 1;
+ });
+ expect(scope.counter).toEqual(0);
+
+ scope.$digest();
+ // the listener is always called during the first $digest loop after it was registered
+ expect(scope.counter).toEqual(1);
+
+ scope.$digest();
+ // but now it will not be called unless the value changes
+ expect(scope.counter).toEqual(1);
+
+ scope.name = 'adam';
+ scope.$digest();
+ expect(scope.counter).toEqual(2);
+ * ```
+ *
+ */
+ $digest: function() {
+ var watch, value, last,
+ watchers,
+ length,
+ dirty, ttl = TTL,
+ next, current, target = this,
+ watchLog = [],
+ logIdx, logMsg, asyncTask;
+
+ beginPhase('$digest');
+ // Check for changes to browser url that happened in sync before the call to $digest
+ $browser.$$checkUrlChange();
+
+ if (this === $rootScope && applyAsyncId !== null) {
+ // If this is the root scope, and $applyAsync has scheduled a deferred $apply(), then
+ // cancel the scheduled $apply and flush the queue of expressions to be evaluated.
+ $browser.defer.cancel(applyAsyncId);
+ flushApplyAsync();
+ }
+
+ lastDirtyWatch = null;
+
+ do { // "while dirty" loop
+ dirty = false;
+ current = target;
+
+ while (asyncQueue.length) {
+ try {
+ asyncTask = asyncQueue.shift();
+ asyncTask.scope.$eval(asyncTask.expression, asyncTask.locals);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ lastDirtyWatch = null;
+ }
+
+ traverseScopesLoop:
+ do { // "traverse the scopes" loop
+ if ((watchers = current.$$watchers)) {
+ // process our watches
+ length = watchers.length;
+ while (length--) {
+ try {
+ watch = watchers[length];
+ // Most common watches are on primitives, in which case we can short
+ // circuit it with === operator, only when === fails do we use .equals
+ if (watch) {
+ if ((value = watch.get(current)) !== (last = watch.last) &&
+ !(watch.eq
+ ? equals(value, last)
+ : (typeof value === 'number' && typeof last === 'number'
+ && isNaN(value) && isNaN(last)))) {
+ dirty = true;
+ lastDirtyWatch = watch;
+ watch.last = watch.eq ? copy(value, null) : value;
+ watch.fn(value, ((last === initWatchVal) ? value : last), current);
+ if (ttl < 5) {
+ logIdx = 4 - ttl;
+ if (!watchLog[logIdx]) watchLog[logIdx] = [];
+ watchLog[logIdx].push({
+ msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp,
+ newVal: value,
+ oldVal: last
+ });
+ }
+ } else if (watch === lastDirtyWatch) {
+ // If the most recently dirty watcher is now clean, short circuit since the remaining watchers
+ // have already been tested.
+ dirty = false;
+ break traverseScopesLoop;
+ }
+ }
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ }
+
+ // Insanity Warning: scope depth-first traversal
+ // yes, this code is a bit crazy, but it works and we have tests to prove it!
+ // this piece should be kept in sync with the traversal in $broadcast
+ if (!(next = ((current.$$watchersCount && current.$$childHead) ||
+ (current !== target && current.$$nextSibling)))) {
+ while (current !== target && !(next = current.$$nextSibling)) {
+ current = current.$parent;
+ }
+ }
+ } while ((current = next));
+
+ // `break traverseScopesLoop;` takes us to here
+
+ if ((dirty || asyncQueue.length) && !(ttl--)) {
+ clearPhase();
+ throw $rootScopeMinErr('infdig',
+ '{0} $digest() iterations reached. Aborting!\n' +
+ 'Watchers fired in the last 5 iterations: {1}',
+ TTL, watchLog);
+ }
+
+ } while (dirty || asyncQueue.length);
+
+ clearPhase();
+
+ while (postDigestQueue.length) {
+ try {
+ postDigestQueue.shift()();
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ },
+
+
+ /**
+ * @ngdoc event
+ * @name $rootScope.Scope#$destroy
+ * @eventType broadcast on scope being destroyed
+ *
+ * @description
+ * Broadcasted when a scope and its children are being destroyed.
+ *
+ * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
+ * clean up DOM bindings before an element is removed from the DOM.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$destroy
+ * @kind function
+ *
+ * @description
+ * Removes the current scope (and all of its children) from the parent scope. Removal implies
+ * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer
+ * propagate to the current scope and its children. Removal also implies that the current
+ * scope is eligible for garbage collection.
+ *
+ * The `$destroy()` is usually used by directives such as
+ * {@link ng.directive:ngRepeat ngRepeat} for managing the
+ * unrolling of the loop.
+ *
+ * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.
+ * Application code can register a `$destroy` event handler that will give it a chance to
+ * perform any necessary cleanup.
+ *
+ * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
+ * clean up DOM bindings before an element is removed from the DOM.
+ */
+ $destroy: function() {
+ // We can't destroy a scope that has been already destroyed.
+ if (this.$$destroyed) return;
+ var parent = this.$parent;
+
+ this.$broadcast('$destroy');
+ this.$$destroyed = true;
+
+ if (this === $rootScope) {
+ //Remove handlers attached to window when $rootScope is removed
+ $browser.$$applicationDestroyed();
+ }
+
+ incrementWatchersCount(this, -this.$$watchersCount);
+ for (var eventName in this.$$listenerCount) {
+ decrementListenerCount(this, this.$$listenerCount[eventName], eventName);
+ }
+
+ // sever all the references to parent scopes (after this cleanup, the current scope should
+ // not be retained by any of our references and should be eligible for garbage collection)
+ if (parent && parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
+ if (parent && parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
+ if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
+ if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
+
+ // Disable listeners, watchers and apply/digest methods
+ this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop;
+ this.$on = this.$watch = this.$watchGroup = function() { return noop; };
+ this.$$listeners = {};
+
+ // Disconnect the next sibling to prevent `cleanUpScope` destroying those too
+ this.$$nextSibling = null;
+ cleanUpScope(this);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$eval
+ * @kind function
+ *
+ * @description
+ * Executes the `expression` on the current scope and returns the result. Any exceptions in
+ * the expression are propagated (uncaught). This is useful when evaluating Angular
+ * expressions.
+ *
+ * # Example
+ * ```js
+ var scope = ng.$rootScope.Scope();
+ scope.a = 1;
+ scope.b = 2;
+
+ expect(scope.$eval('a+b')).toEqual(3);
+ expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
+ * ```
+ *
+ * @param {(string|function())=} expression An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with the current `scope` parameter.
+ *
+ * @param {(object)=} locals Local variables object, useful for overriding values in scope.
+ * @returns {*} The result of evaluating the expression.
+ */
+ $eval: function(expr, locals) {
+ return $parse(expr)(this, locals);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$evalAsync
+ * @kind function
+ *
+ * @description
+ * Executes the expression on the current scope at a later point in time.
+ *
+ * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only
+ * that:
+ *
+ * - it will execute after the function that scheduled the evaluation (preferably before DOM
+ * rendering).
+ * - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after
+ * `expression` execution.
+ *
+ * Any exceptions from the execution of the expression are forwarded to the
+ * {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle
+ * will be scheduled. However, it is encouraged to always call code that changes the model
+ * from within an `$apply` call. That includes code evaluated via `$evalAsync`.
+ *
+ * @param {(string|function())=} expression An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with the current `scope` parameter.
+ *
+ * @param {(object)=} locals Local variables object, useful for overriding values in scope.
+ */
+ $evalAsync: function(expr, locals) {
+ // if we are outside of an $digest loop and this is the first time we are scheduling async
+ // task also schedule async auto-flush
+ if (!$rootScope.$$phase && !asyncQueue.length) {
+ $browser.defer(function() {
+ if (asyncQueue.length) {
+ $rootScope.$digest();
+ }
+ });
+ }
+
+ asyncQueue.push({scope: this, expression: expr, locals: locals});
+ },
+
+ $$postDigest: function(fn) {
+ postDigestQueue.push(fn);
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$apply
+ * @kind function
+ *
+ * @description
+ * `$apply()` is used to execute an expression in angular from outside of the angular
+ * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).
+ * Because we are calling into the angular framework we need to perform proper scope life
+ * cycle of {@link ng.$exceptionHandler exception handling},
+ * {@link ng.$rootScope.Scope#$digest executing watches}.
+ *
+ * ## Life cycle
+ *
+ * # Pseudo-Code of `$apply()`
+ * ```js
+ function $apply(expr) {
+ try {
+ return $eval(expr);
+ } catch (e) {
+ $exceptionHandler(e);
+ } finally {
+ $root.$digest();
+ }
+ }
+ * ```
+ *
+ *
+ * Scope's `$apply()` method transitions through the following stages:
+ *
+ * 1. The {@link guide/expression expression} is executed using the
+ * {@link ng.$rootScope.Scope#$eval $eval()} method.
+ * 2. Any exceptions from the execution of the expression are forwarded to the
+ * {@link ng.$exceptionHandler $exceptionHandler} service.
+ * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the
+ * expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.
+ *
+ *
+ * @param {(string|function())=} exp An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with current `scope` parameter.
+ *
+ * @returns {*} The result of evaluating the expression.
+ */
+ $apply: function(expr) {
+ try {
+ beginPhase('$apply');
+ try {
+ return this.$eval(expr);
+ } finally {
+ clearPhase();
+ }
+ } catch (e) {
+ $exceptionHandler(e);
+ } finally {
+ try {
+ $rootScope.$digest();
+ } catch (e) {
+ $exceptionHandler(e);
+ throw e;
+ }
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$applyAsync
+ * @kind function
+ *
+ * @description
+ * Schedule the invocation of $apply to occur at a later time. The actual time difference
+ * varies across browsers, but is typically around ~10 milliseconds.
+ *
+ * This can be used to queue up multiple expressions which need to be evaluated in the same
+ * digest.
+ *
+ * @param {(string|function())=} exp An angular expression to be executed.
+ *
+ * - `string`: execute using the rules as defined in {@link guide/expression expression}.
+ * - `function(scope)`: execute the function with current `scope` parameter.
+ */
+ $applyAsync: function(expr) {
+ var scope = this;
+ expr && applyAsyncQueue.push($applyAsyncExpression);
+ scheduleApplyAsync();
+
+ function $applyAsyncExpression() {
+ scope.$eval(expr);
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$on
+ * @kind function
+ *
+ * @description
+ * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for
+ * discussion of event life cycle.
+ *
+ * The event listener function format is: `function(event, args...)`. The `event` object
+ * passed into the listener has the following attributes:
+ *
+ * - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or
+ * `$broadcast`-ed.
+ * - `currentScope` - `{Scope}`: the scope that is currently handling the event. Once the
+ * event propagates through the scope hierarchy, this property is set to null.
+ * - `name` - `{string}`: name of the event.
+ * - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel
+ * further event propagation (available only for events that were `$emit`-ed).
+ * - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag
+ * to true.
+ * - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
+ *
+ * @param {string} name Event name to listen on.
+ * @param {function(event, ...args)} listener Function to call when the event is emitted.
+ * @returns {function()} Returns a deregistration function for this listener.
+ */
+ $on: function(name, listener) {
+ var namedListeners = this.$$listeners[name];
+ if (!namedListeners) {
+ this.$$listeners[name] = namedListeners = [];
+ }
+ namedListeners.push(listener);
+
+ var current = this;
+ do {
+ if (!current.$$listenerCount[name]) {
+ current.$$listenerCount[name] = 0;
+ }
+ current.$$listenerCount[name]++;
+ } while ((current = current.$parent));
+
+ var self = this;
+ return function() {
+ var indexOfListener = namedListeners.indexOf(listener);
+ if (indexOfListener !== -1) {
+ namedListeners[indexOfListener] = null;
+ decrementListenerCount(self, 1, name);
+ }
+ };
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$emit
+ * @kind function
+ *
+ * @description
+ * Dispatches an event `name` upwards through the scope hierarchy notifying the
+ * registered {@link ng.$rootScope.Scope#$on} listeners.
+ *
+ * The event life cycle starts at the scope on which `$emit` was called. All
+ * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
+ * notified. Afterwards, the event traverses upwards toward the root scope and calls all
+ * registered listeners along the way. The event will stop propagating if one of the listeners
+ * cancels it.
+ *
+ * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
+ * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * @param {string} name Event name to emit.
+ * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
+ * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).
+ */
+ $emit: function(name, args) {
+ var empty = [],
+ namedListeners,
+ scope = this,
+ stopPropagation = false,
+ event = {
+ name: name,
+ targetScope: scope,
+ stopPropagation: function() {stopPropagation = true;},
+ preventDefault: function() {
+ event.defaultPrevented = true;
+ },
+ defaultPrevented: false
+ },
+ listenerArgs = concat([event], arguments, 1),
+ i, length;
+
+ do {
+ namedListeners = scope.$$listeners[name] || empty;
+ event.currentScope = scope;
+ for (i = 0, length = namedListeners.length; i < length; i++) {
+
+ // if listeners were deregistered, defragment the array
+ if (!namedListeners[i]) {
+ namedListeners.splice(i, 1);
+ i--;
+ length--;
+ continue;
+ }
+ try {
+ //allow all listeners attached to the current scope to run
+ namedListeners[i].apply(null, listenerArgs);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ //if any listener on the current scope stops propagation, prevent bubbling
+ if (stopPropagation) {
+ event.currentScope = null;
+ return event;
+ }
+ //traverse upwards
+ scope = scope.$parent;
+ } while (scope);
+
+ event.currentScope = null;
+
+ return event;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name $rootScope.Scope#$broadcast
+ * @kind function
+ *
+ * @description
+ * Dispatches an event `name` downwards to all child scopes (and their children) notifying the
+ * registered {@link ng.$rootScope.Scope#$on} listeners.
+ *
+ * The event life cycle starts at the scope on which `$broadcast` was called. All
+ * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
+ * notified. Afterwards, the event propagates to all direct and indirect scopes of the current
+ * scope and calls all registered listeners along the way. The event cannot be canceled.
+ *
+ * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
+ * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * @param {string} name Event name to broadcast.
+ * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
+ * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
+ */
+ $broadcast: function(name, args) {
+ var target = this,
+ current = target,
+ next = target,
+ event = {
+ name: name,
+ targetScope: target,
+ preventDefault: function() {
+ event.defaultPrevented = true;
+ },
+ defaultPrevented: false
+ };
+
+ if (!target.$$listenerCount[name]) return event;
+
+ var listenerArgs = concat([event], arguments, 1),
+ listeners, i, length;
+
+ //down while you can, then up and next sibling or up and next sibling until back at root
+ while ((current = next)) {
+ event.currentScope = current;
+ listeners = current.$$listeners[name] || [];
+ for (i = 0, length = listeners.length; i < length; i++) {
+ // if listeners were deregistered, defragment the array
+ if (!listeners[i]) {
+ listeners.splice(i, 1);
+ i--;
+ length--;
+ continue;
+ }
+
+ try {
+ listeners[i].apply(null, listenerArgs);
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+
+ // Insanity Warning: scope depth-first traversal
+ // yes, this code is a bit crazy, but it works and we have tests to prove it!
+ // this piece should be kept in sync with the traversal in $digest
+ // (though it differs due to having the extra check for $$listenerCount)
+ if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||
+ (current !== target && current.$$nextSibling)))) {
+ while (current !== target && !(next = current.$$nextSibling)) {
+ current = current.$parent;
+ }
+ }
+ }
+
+ event.currentScope = null;
+ return event;
+ }
+ };
+
+ var $rootScope = new Scope();
+
+ //The internal queues. Expose them on the $rootScope for debugging/testing purposes.
+ var asyncQueue = $rootScope.$$asyncQueue = [];
+ var postDigestQueue = $rootScope.$$postDigestQueue = [];
+ var applyAsyncQueue = $rootScope.$$applyAsyncQueue = [];
+
+ return $rootScope;
+
+
+ function beginPhase(phase) {
+ if ($rootScope.$$phase) {
+ throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);
+ }
+
+ $rootScope.$$phase = phase;
+ }
+
+ function clearPhase() {
+ $rootScope.$$phase = null;
+ }
+
+ function incrementWatchersCount(current, count) {
+ do {
+ current.$$watchersCount += count;
+ } while ((current = current.$parent));
+ }
+
+ function decrementListenerCount(current, count, name) {
+ do {
+ current.$$listenerCount[name] -= count;
+
+ if (current.$$listenerCount[name] === 0) {
+ delete current.$$listenerCount[name];
+ }
+ } while ((current = current.$parent));
+ }
+
+ /**
+ * function used as an initial value for watchers.
+ * because it's unique we can easily tell it apart from other values
+ */
+ function initWatchVal() {}
+
+ function flushApplyAsync() {
+ while (applyAsyncQueue.length) {
+ try {
+ applyAsyncQueue.shift()();
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ }
+ applyAsyncId = null;
+ }
+
+ function scheduleApplyAsync() {
+ if (applyAsyncId === null) {
+ applyAsyncId = $browser.defer(function() {
+ $rootScope.$apply(flushApplyAsync);
+ });
+ }
+ }
+ }];
+}
+
+/**
+ * @description
+ * Private service to sanitize uris for links and images. Used by $compile and $sanitize.
+ */
+function $$SanitizeUriProvider() {
+ var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/,
+ imgSrcSanitizationWhitelist = /^\s*((https?|ftp|file|blob):|data:image\/)/;
+
+ /**
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during a[href] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to a[href] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.aHrefSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ aHrefSanitizationWhitelist = regexp;
+ return this;
+ }
+ return aHrefSanitizationWhitelist;
+ };
+
+
+ /**
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during img[src] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to img[src] via data-binding is first normalized and turned into
+ * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`
+ * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+ * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.imgSrcSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ imgSrcSanitizationWhitelist = regexp;
+ return this;
+ }
+ return imgSrcSanitizationWhitelist;
+ };
+
+ this.$get = function() {
+ return function sanitizeUri(uri, isImage) {
+ var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;
+ var normalizedVal;
+ normalizedVal = urlResolve(uri).href;
+ if (normalizedVal !== '' && !normalizedVal.match(regex)) {
+ return 'unsafe:' + normalizedVal;
+ }
+ return uri;
+ };
+ };
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Any commits to this file should be reviewed with security in mind. *
+ * Changes to this file can potentially create security vulnerabilities. *
+ * An approval from 2 Core members with history of modifying *
+ * this file is required. *
+ * *
+ * Does the change somehow allow for arbitrary javascript to be executed? *
+ * Or allows for someone to change the prototype of built-in objects? *
+ * Or gives undesired access to variables likes document or window? *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+var $sceMinErr = minErr('$sce');
+
+var SCE_CONTEXTS = {
+ HTML: 'html',
+ CSS: 'css',
+ URL: 'url',
+ // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a
+ // url. (e.g. ng-include, script src, templateUrl)
+ RESOURCE_URL: 'resourceUrl',
+ JS: 'js'
+};
+
+// Helper functions follow.
+
+function adjustMatcher(matcher) {
+ if (matcher === 'self') {
+ return matcher;
+ } else if (isString(matcher)) {
+ // Strings match exactly except for 2 wildcards - '*' and '**'.
+ // '*' matches any character except those from the set ':/.?&'.
+ // '**' matches any character (like .* in a RegExp).
+ // More than 2 *'s raises an error as it's ill defined.
+ if (matcher.indexOf('***') > -1) {
+ throw $sceMinErr('iwcard',
+ 'Illegal sequence *** in string matcher. String: {0}', matcher);
+ }
+ matcher = escapeForRegexp(matcher).
+ replace('\\*\\*', '.*').
+ replace('\\*', '[^:/.?&;]*');
+ return new RegExp('^' + matcher + '$');
+ } else if (isRegExp(matcher)) {
+ // The only other type of matcher allowed is a Regexp.
+ // Match entire URL / disallow partial matches.
+ // Flags are reset (i.e. no global, ignoreCase or multiline)
+ return new RegExp('^' + matcher.source + '$');
+ } else {
+ throw $sceMinErr('imatcher',
+ 'Matchers may only be "self", string patterns or RegExp objects');
+ }
+}
+
+
+function adjustMatchers(matchers) {
+ var adjustedMatchers = [];
+ if (isDefined(matchers)) {
+ forEach(matchers, function(matcher) {
+ adjustedMatchers.push(adjustMatcher(matcher));
+ });
+ }
+ return adjustedMatchers;
+}
+
+
+/**
+ * @ngdoc service
+ * @name $sceDelegate
+ * @kind function
+ *
+ * @description
+ *
+ * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict
+ * Contextual Escaping (SCE)} services to AngularJS.
+ *
+ * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of
+ * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS. This is
+ * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to
+ * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things
+ * work because `$sce` delegates to `$sceDelegate` for these operations.
+ *
+ * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.
+ *
+ * The default instance of `$sceDelegate` should work out of the box with little pain. While you
+ * can override it completely to change the behavior of `$sce`, the common case would
+ * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting
+ * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as
+ * templates. Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist
+ * $sceDelegateProvider.resourceUrlWhitelist} and {@link
+ * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+ */
+
+/**
+ * @ngdoc provider
+ * @name $sceDelegateProvider
+ * @description
+ *
+ * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate
+ * $sceDelegate} service. This allows one to get/set the whitelists and blacklists used to ensure
+ * that the URLs used for sourcing Angular templates are safe. Refer {@link
+ * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and
+ * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+ *
+ * For the general details about this service in Angular, read the main page for {@link ng.$sce
+ * Strict Contextual Escaping (SCE)}.
+ *
+ * **Example**: Consider the following case. <a name="example"></a>
+ *
+ * - your app is hosted at url `http://myapp.example.com/`
+ * - but some of your templates are hosted on other domains you control such as
+ * `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.
+ * - and you have an open redirect at `http://myapp.example.com/clickThru?...`.
+ *
+ * Here is what a secure configuration for this scenario might look like:
+ *
+ * ```
+ * angular.module('myApp', []).config(function($sceDelegateProvider) {
+ * $sceDelegateProvider.resourceUrlWhitelist([
+ * // Allow same origin resource loads.
+ * 'self',
+ * // Allow loading from our assets domain. Notice the difference between * and **.
+ * 'http://srv*.assets.example.com/**'
+ * ]);
+ *
+ * // The blacklist overrides the whitelist so the open redirect here is blocked.
+ * $sceDelegateProvider.resourceUrlBlacklist([
+ * 'http://myapp.example.com/clickThru**'
+ * ]);
+ * });
+ * ```
+ */
+
+function $SceDelegateProvider() {
+ this.SCE_CONTEXTS = SCE_CONTEXTS;
+
+ // Resource URLs can also be trusted by policy.
+ var resourceUrlWhitelist = ['self'],
+ resourceUrlBlacklist = [];
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegateProvider#resourceUrlWhitelist
+ * @kind function
+ *
+ * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
+ * provided. This must be an array or null. A snapshot of this array is used so further
+ * changes to the array are ignored.
+ *
+ * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+ * allowed in this array.
+ *
+ * Note: **an empty whitelist array will block all URLs**!
+ *
+ * @return {Array} the currently set whitelist array.
+ *
+ * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
+ * same origin resource requests.
+ *
+ * @description
+ * Sets/Gets the whitelist of trusted resource URLs.
+ */
+ this.resourceUrlWhitelist = function(value) {
+ if (arguments.length) {
+ resourceUrlWhitelist = adjustMatchers(value);
+ }
+ return resourceUrlWhitelist;
+ };
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegateProvider#resourceUrlBlacklist
+ * @kind function
+ *
+ * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
+ * provided. This must be an array or null. A snapshot of this array is used so further
+ * changes to the array are ignored.
+ *
+ * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+ * allowed in this array.
+ *
+ * The typical usage for the blacklist is to **block
+ * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
+ * these would otherwise be trusted but actually return content from the redirected domain.
+ *
+ * Finally, **the blacklist overrides the whitelist** and has the final say.
+ *
+ * @return {Array} the currently set blacklist array.
+ *
+ * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there
+ * is no blacklist.)
+ *
+ * @description
+ * Sets/Gets the blacklist of trusted resource URLs.
+ */
+
+ this.resourceUrlBlacklist = function(value) {
+ if (arguments.length) {
+ resourceUrlBlacklist = adjustMatchers(value);
+ }
+ return resourceUrlBlacklist;
+ };
+
+ this.$get = ['$injector', function($injector) {
+
+ var htmlSanitizer = function htmlSanitizer(html) {
+ throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
+ };
+
+ if ($injector.has('$sanitize')) {
+ htmlSanitizer = $injector.get('$sanitize');
+ }
+
+
+ function matchUrl(matcher, parsedUrl) {
+ if (matcher === 'self') {
+ return urlIsSameOrigin(parsedUrl);
+ } else {
+ // definitely a regex. See adjustMatchers()
+ return !!matcher.exec(parsedUrl.href);
+ }
+ }
+
+ function isResourceUrlAllowedByPolicy(url) {
+ var parsedUrl = urlResolve(url.toString());
+ var i, n, allowed = false;
+ // Ensure that at least one item from the whitelist allows this url.
+ for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) {
+ if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {
+ allowed = true;
+ break;
+ }
+ }
+ if (allowed) {
+ // Ensure that no item from the blacklist blocked this url.
+ for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) {
+ if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {
+ allowed = false;
+ break;
+ }
+ }
+ }
+ return allowed;
+ }
+
+ function generateHolderType(Base) {
+ var holderType = function TrustedValueHolderType(trustedValue) {
+ this.$$unwrapTrustedValue = function() {
+ return trustedValue;
+ };
+ };
+ if (Base) {
+ holderType.prototype = new Base();
+ }
+ holderType.prototype.valueOf = function sceValueOf() {
+ return this.$$unwrapTrustedValue();
+ };
+ holderType.prototype.toString = function sceToString() {
+ return this.$$unwrapTrustedValue().toString();
+ };
+ return holderType;
+ }
+
+ var trustedValueHolderBase = generateHolderType(),
+ byType = {};
+
+ byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase);
+ byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]);
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegate#trustAs
+ *
+ * @description
+ * Returns an object that is trusted by angular for use in specified strict
+ * contextual escaping contexts (such as ng-bind-html, ng-include, any src
+ * attribute interpolation, any dom event binding attribute interpolation
+ * such as for onclick, etc.) that uses the provided value.
+ * See {@link ng.$sce $sce} for enabling strict contextual escaping.
+ *
+ * @param {string} type The kind of context in which this value is safe for use. e.g. url,
+ * resourceUrl, html, js and css.
+ * @param {*} value The value that that should be considered trusted/safe.
+ * @returns {*} A value that can be used to stand in for the provided `value` in places
+ * where Angular expects a $sce.trustAs() return value.
+ */
+ function trustAs(type, trustedValue) {
+ var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
+ if (!Constructor) {
+ throw $sceMinErr('icontext',
+ 'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',
+ type, trustedValue);
+ }
+ if (trustedValue === null || isUndefined(trustedValue) || trustedValue === '') {
+ return trustedValue;
+ }
+ // All the current contexts in SCE_CONTEXTS happen to be strings. In order to avoid trusting
+ // mutable objects, we ensure here that the value passed in is actually a string.
+ if (typeof trustedValue !== 'string') {
+ throw $sceMinErr('itype',
+ 'Attempted to trust a non-string value in a content requiring a string: Context: {0}',
+ type);
+ }
+ return new Constructor(trustedValue);
+ }
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegate#valueOf
+ *
+ * @description
+ * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link
+ * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.
+ *
+ * If the passed parameter is not a value that had been returned by {@link
+ * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.
+ *
+ * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}
+ * call or anything else.
+ * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`} if `value` is the result of such a call. Otherwise, returns
+ * `value` unchanged.
+ */
+ function valueOf(maybeTrusted) {
+ if (maybeTrusted instanceof trustedValueHolderBase) {
+ return maybeTrusted.$$unwrapTrustedValue();
+ } else {
+ return maybeTrusted;
+ }
+ }
+
+ /**
+ * @ngdoc method
+ * @name $sceDelegate#getTrusted
+ *
+ * @description
+ * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and
+ * returns the originally supplied value if the queried context type is a supertype of the
+ * created type. If this condition isn't satisfied, throws an exception.
+ *
+ * <div class="alert alert-danger">
+ * Disabling auto-escaping is extremely dangerous, it usually creates a Cross Site Scripting
+ * (XSS) vulnerability in your application.
+ * </div>
+ *
+ * @param {string} type The kind of context in which this value is to be used.
+ * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`} call.
+ * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs
+ * `$sceDelegate.trustAs`} if valid in this context. Otherwise, throws an exception.
+ */
+ function getTrusted(type, maybeTrusted) {
+ if (maybeTrusted === null || isUndefined(maybeTrusted) || maybeTrusted === '') {
+ return maybeTrusted;
+ }
+ var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
+ if (constructor && maybeTrusted instanceof constructor) {
+ return maybeTrusted.$$unwrapTrustedValue();
+ }
+ // If we get here, then we may only take one of two actions.
+ // 1. sanitize the value for the requested type, or
+ // 2. throw an exception.
+ if (type === SCE_CONTEXTS.RESOURCE_URL) {
+ if (isResourceUrlAllowedByPolicy(maybeTrusted)) {
+ return maybeTrusted;
+ } else {
+ throw $sceMinErr('insecurl',
+ 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}',
+ maybeTrusted.toString());
+ }
+ } else if (type === SCE_CONTEXTS.HTML) {
+ return htmlSanitizer(maybeTrusted);
+ }
+ throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
+ }
+
+ return { trustAs: trustAs,
+ getTrusted: getTrusted,
+ valueOf: valueOf };
+ }];
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $sceProvider
+ * @description
+ *
+ * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.
+ * - enable/disable Strict Contextual Escaping (SCE) in a module
+ * - override the default implementation with a custom delegate
+ *
+ * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}.
+ */
+
+/* jshint maxlen: false*/
+
+/**
+ * @ngdoc service
+ * @name $sce
+ * @kind function
+ *
+ * @description
+ *
+ * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS.
+ *
+ * # Strict Contextual Escaping
+ *
+ * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain
+ * contexts to result in a value that is marked as safe to use for that context. One example of
+ * such a context is binding arbitrary html controlled by the user via `ng-bind-html`. We refer
+ * to these contexts as privileged or SCE contexts.
+ *
+ * As of version 1.2, Angular ships with SCE enabled by default.
+ *
+ * Note: When enabled (the default), IE<11 in quirks mode is not supported. In this mode, IE<11 allow
+ * one to execute arbitrary javascript by the use of the expression() syntax. Refer
+ * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them.
+ * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>`
+ * to the top of your HTML document.
+ *
+ * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for
+ * security vulnerabilities such as XSS, clickjacking, etc. a lot easier.
+ *
+ * Here's an example of a binding in a privileged context:
+ *
+ * ```
+ * <input ng-model="userHtml" aria-label="User input">
+ * <div ng-bind-html="userHtml"></div>
+ * ```
+ *
+ * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user. With SCE
+ * disabled, this application allows the user to render arbitrary HTML into the DIV.
+ * In a more realistic example, one may be rendering user comments, blog articles, etc. via
+ * bindings. (HTML is just one example of a context where rendering user controlled input creates
+ * security vulnerabilities.)
+ *
+ * For the case of HTML, you might use a library, either on the client side, or on the server side,
+ * to sanitize unsafe HTML before binding to the value and rendering it in the document.
+ *
+ * How would you ensure that every place that used these types of bindings was bound to a value that
+ * was sanitized by your library (or returned as safe for rendering by your server?) How can you
+ * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some
+ * properties/fields and forgot to update the binding to the sanitized value?
+ *
+ * To be secure by default, you want to ensure that any such bindings are disallowed unless you can
+ * determine that something explicitly says it's safe to use a value for binding in that
+ * context. You can then audit your code (a simple grep would do) to ensure that this is only done
+ * for those values that you can easily tell are safe - because they were received from your server,
+ * sanitized by your library, etc. You can organize your codebase to help with this - perhaps
+ * allowing only the files in a specific directory to do this. Ensuring that the internal API
+ * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.
+ *
+ * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}
+ * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to
+ * obtain values that will be accepted by SCE / privileged contexts.
+ *
+ *
+ * ## How does it work?
+ *
+ * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted
+ * $sce.getTrusted(context, value)} rather than to the value directly. Directives use {@link
+ * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the
+ * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.
+ *
+ * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link
+ * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly
+ * simplified):
+ *
+ * ```
+ * var ngBindHtmlDirective = ['$sce', function($sce) {
+ * return function(scope, element, attr) {
+ * scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {
+ * element.html(value || '');
+ * });
+ * };
+ * }];
+ * ```
+ *
+ * ## Impact on loading templates
+ *
+ * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as
+ * `templateUrl`'s specified by {@link guide/directive directives}.
+ *
+ * By default, Angular only loads templates from the same domain and protocol as the application
+ * document. This is done by calling {@link ng.$sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl} on the template URL. To load templates from other domains and/or
+ * protocols, you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist
+ * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.
+ *
+ * *Please note*:
+ * The browser's
+ * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+ * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
+ * policy apply in addition to this and may further restrict whether the template is successfully
+ * loaded. This means that without the right CORS policy, loading templates from a different domain
+ * won't work on all browsers. Also, loading templates from `file://` URL does not work on some
+ * browsers.
+ *
+ * ## This feels like too much overhead
+ *
+ * It's important to remember that SCE only applies to interpolation expressions.
+ *
+ * If your expressions are constant literals, they're automatically trusted and you don't need to
+ * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g.
+ * `<div ng-bind-html="'<b>implicitly trusted</b>'"></div>`) just works.
+ *
+ * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them
+ * through {@link ng.$sce#getTrusted $sce.getTrusted}. SCE doesn't play a role here.
+ *
+ * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load
+ * templates in `ng-include` from your application's domain without having to even know about SCE.
+ * It blocks loading templates from other domains or loading templates over http from an https
+ * served document. You can change these by setting your own custom {@link
+ * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link
+ * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs.
+ *
+ * This significantly reduces the overhead. It is far easier to pay the small overhead and have an
+ * application that's secure and can be audited to verify that with much more ease than bolting
+ * security onto an application later.
+ *
+ * <a name="contexts"></a>
+ * ## What trusted context types are supported?
+ *
+ * | Context | Notes |
+ * |---------------------|----------------|
+ * | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. |
+ * | `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. |
+ * | `$sce.URL` | For URLs that are safe to follow as links. Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |
+ * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application. Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.) <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |
+ * | `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. |
+ *
+ * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name="resourceUrlPatternItem"></a>
+ *
+ * Each element in these arrays must be one of the following:
+ *
+ * - **'self'**
+ * - The special **string**, `'self'`, can be used to match against all URLs of the **same
+ * domain** as the application document using the **same protocol**.
+ * - **String** (except the special value `'self'`)
+ * - The string is matched against the full *normalized / absolute URL* of the resource
+ * being tested (substring matches are not good enough.)
+ * - There are exactly **two wildcard sequences** - `*` and `**`. All other characters
+ * match themselves.
+ * - `*`: matches zero or more occurrences of any character other than one of the following 6
+ * characters: '`:`', '`/`', '`.`', '`?`', '`&`' and '`;`'. It's a useful wildcard for use
+ * in a whitelist.
+ * - `**`: matches zero or more occurrences of *any* character. As such, it's not
+ * appropriate for use in a scheme, domain, etc. as it would match too much. (e.g.
+ * http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might
+ * not have been the intention.) Its usage at the very end of the path is ok. (e.g.
+ * http://foo.example.com/templates/**).
+ * - **RegExp** (*see caveat below*)
+ * - *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax
+ * (and all the inevitable escaping) makes them *harder to maintain*. It's easy to
+ * accidentally introduce a bug when one updates a complex expression (imho, all regexes should
+ * have good test coverage). For instance, the use of `.` in the regex is correct only in a
+ * small number of cases. A `.` character in the regex used when matching the scheme or a
+ * subdomain could be matched against a `:` or literal `.` that was likely not intended. It
+ * is highly recommended to use the string patterns and only fall back to regular expressions
+ * as a last resort.
+ * - The regular expression must be an instance of RegExp (i.e. not a string.) It is
+ * matched against the **entire** *normalized / absolute URL* of the resource being tested
+ * (even when the RegExp did not have the `^` and `$` codes.) In addition, any flags
+ * present on the RegExp (such as multiline, global, ignoreCase) are ignored.
+ * - If you are generating your JavaScript from some other templating engine (not
+ * recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)),
+ * remember to escape your regular expression (and be aware that you might need more than
+ * one level of escaping depending on your templating engine and the way you interpolated
+ * the value.) Do make use of your platform's escaping mechanism as it might be good
+ * enough before coding your own. E.g. Ruby has
+ * [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape)
+ * and Python has [re.escape](http://docs.python.org/library/re.html#re.escape).
+ * Javascript lacks a similar built in function for escaping. Take a look at Google
+ * Closure library's [goog.string.regExpEscape(s)](
+ * http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962).
+ *
+ * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example.
+ *
+ * ## Show me an example using SCE.
+ *
+ * <example module="mySceApp" deps="angular-sanitize.js">
+ * <file name="index.html">
+ * <div ng-controller="AppController as myCtrl">
+ * <i ng-bind-html="myCtrl.explicitlyTrustedHtml" id="explicitlyTrustedHtml"></i><br><br>
+ * <b>User comments</b><br>
+ * By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when
+ * $sanitize is available. If $sanitize isn't available, this results in an error instead of an
+ * exploit.
+ * <div class="well">
+ * <div ng-repeat="userComment in myCtrl.userComments">
+ * <b>{{userComment.name}}</b>:
+ * <span ng-bind-html="userComment.htmlComment" class="htmlComment"></span>
+ * <br>
+ * </div>
+ * </div>
+ * </div>
+ * </file>
+ *
+ * <file name="script.js">
+ * angular.module('mySceApp', ['ngSanitize'])
+ * .controller('AppController', ['$http', '$templateCache', '$sce',
+ * function($http, $templateCache, $sce) {
+ * var self = this;
+ * $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) {
+ * self.userComments = userComments;
+ * });
+ * self.explicitlyTrustedHtml = $sce.trustAsHtml(
+ * '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
+ * 'sanitization.&quot;">Hover over this text.</span>');
+ * }]);
+ * </file>
+ *
+ * <file name="test_data.json">
+ * [
+ * { "name": "Alice",
+ * "htmlComment":
+ * "<span onmouseover='this.textContent=\"PWN3D!\"'>Is <i>anyone</i> reading this?</span>"
+ * },
+ * { "name": "Bob",
+ * "htmlComment": "<i>Yes!</i> Am I the only other one?"
+ * }
+ * ]
+ * </file>
+ *
+ * <file name="protractor.js" type="protractor">
+ * describe('SCE doc demo', function() {
+ * it('should sanitize untrusted values', function() {
+ * expect(element.all(by.css('.htmlComment')).first().getInnerHtml())
+ * .toBe('<span>Is <i>anyone</i> reading this?</span>');
+ * });
+ *
+ * it('should NOT sanitize explicitly trusted values', function() {
+ * expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(
+ * '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
+ * 'sanitization.&quot;">Hover over this text.</span>');
+ * });
+ * });
+ * </file>
+ * </example>
+ *
+ *
+ *
+ * ## Can I disable SCE completely?
+ *
+ * Yes, you can. However, this is strongly discouraged. SCE gives you a lot of security benefits
+ * for little coding overhead. It will be much harder to take an SCE disabled application and
+ * either secure it on your own or enable SCE at a later stage. It might make sense to disable SCE
+ * for cases where you have a lot of existing code that was written before SCE was introduced and
+ * you're migrating them a module at a time.
+ *
+ * That said, here's how you can completely disable SCE:
+ *
+ * ```
+ * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
+ * // Completely disable SCE. For demonstration purposes only!
+ * // Do not use in new projects.
+ * $sceProvider.enabled(false);
+ * });
+ * ```
+ *
+ */
+/* jshint maxlen: 100 */
+
+function $SceProvider() {
+ var enabled = true;
+
+ /**
+ * @ngdoc method
+ * @name $sceProvider#enabled
+ * @kind function
+ *
+ * @param {boolean=} value If provided, then enables/disables SCE.
+ * @return {boolean} true if SCE is enabled, false otherwise.
+ *
+ * @description
+ * Enables/disables SCE and returns the current value.
+ */
+ this.enabled = function(value) {
+ if (arguments.length) {
+ enabled = !!value;
+ }
+ return enabled;
+ };
+
+
+ /* Design notes on the default implementation for SCE.
+ *
+ * The API contract for the SCE delegate
+ * -------------------------------------
+ * The SCE delegate object must provide the following 3 methods:
+ *
+ * - trustAs(contextEnum, value)
+ * This method is used to tell the SCE service that the provided value is OK to use in the
+ * contexts specified by contextEnum. It must return an object that will be accepted by
+ * getTrusted() for a compatible contextEnum and return this value.
+ *
+ * - valueOf(value)
+ * For values that were not produced by trustAs(), return them as is. For values that were
+ * produced by trustAs(), return the corresponding input value to trustAs. Basically, if
+ * trustAs is wrapping the given values into some type, this operation unwraps it when given
+ * such a value.
+ *
+ * - getTrusted(contextEnum, value)
+ * This function should return the a value that is safe to use in the context specified by
+ * contextEnum or throw and exception otherwise.
+ *
+ * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be
+ * opaque or wrapped in some holder object. That happens to be an implementation detail. For
+ * instance, an implementation could maintain a registry of all trusted objects by context. In
+ * such a case, trustAs() would return the same object that was passed in. getTrusted() would
+ * return the same object passed in if it was found in the registry under a compatible context or
+ * throw an exception otherwise. An implementation might only wrap values some of the time based
+ * on some criteria. getTrusted() might return a value and not throw an exception for special
+ * constants or objects even if not wrapped. All such implementations fulfill this contract.
+ *
+ *
+ * A note on the inheritance model for SCE contexts
+ * ------------------------------------------------
+ * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types. This
+ * is purely an implementation details.
+ *
+ * The contract is simply this:
+ *
+ * getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value)
+ * will also succeed.
+ *
+ * Inheritance happens to capture this in a natural way. In some future, we
+ * may not use inheritance anymore. That is OK because no code outside of
+ * sce.js and sceSpecs.js would need to be aware of this detail.
+ */
+
+ this.$get = ['$parse', '$sceDelegate', function(
+ $parse, $sceDelegate) {
+ // Prereq: Ensure that we're not running in IE<11 quirks mode. In that mode, IE < 11 allow
+ // the "expression(javascript expression)" syntax which is insecure.
+ if (enabled && msie < 8) {
+ throw $sceMinErr('iequirks',
+ 'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' +
+ 'mode. You can fix this by adding the text <!doctype html> to the top of your HTML ' +
+ 'document. See http://docs.angularjs.org/api/ng.$sce for more information.');
+ }
+
+ var sce = shallowCopy(SCE_CONTEXTS);
+
+ /**
+ * @ngdoc method
+ * @name $sce#isEnabled
+ * @kind function
+ *
+ * @return {Boolean} true if SCE is enabled, false otherwise. If you want to set the value, you
+ * have to do it at module config time on {@link ng.$sceProvider $sceProvider}.
+ *
+ * @description
+ * Returns a boolean indicating if SCE is enabled.
+ */
+ sce.isEnabled = function() {
+ return enabled;
+ };
+ sce.trustAs = $sceDelegate.trustAs;
+ sce.getTrusted = $sceDelegate.getTrusted;
+ sce.valueOf = $sceDelegate.valueOf;
+
+ if (!enabled) {
+ sce.trustAs = sce.getTrusted = function(type, value) { return value; };
+ sce.valueOf = identity;
+ }
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAs
+ *
+ * @description
+ * Converts Angular {@link guide/expression expression} into a function. This is like {@link
+ * ng.$parse $parse} and is identical when the expression is a literal constant. Otherwise, it
+ * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,
+ * *result*)}
+ *
+ * @param {string} type The kind of SCE context in which this result will be used.
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+ sce.parseAs = function sceParseAs(type, expr) {
+ var parsed = $parse(expr);
+ if (parsed.literal && parsed.constant) {
+ return parsed;
+ } else {
+ return $parse(expr, function(value) {
+ return sce.getTrusted(type, value);
+ });
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAs
+ *
+ * @description
+ * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. As such,
+ * returns an object that is trusted by angular for use in specified strict contextual
+ * escaping contexts (such as ng-bind-html, ng-include, any src attribute
+ * interpolation, any dom event binding attribute interpolation such as for onclick, etc.)
+ * that uses the provided value. See * {@link ng.$sce $sce} for enabling strict contextual
+ * escaping.
+ *
+ * @param {string} type The kind of context in which this value is safe for use. e.g. url,
+ * resourceUrl, html, js and css.
+ * @param {*} value The value that that should be considered trusted/safe.
+ * @returns {*} A value that can be used to stand in for the provided `value` in places
+ * where Angular expects a $sce.trustAs() return value.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsHtml
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsHtml(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml
+ * $sce.getTrustedHtml(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsUrl
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsUrl(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl
+ * $sce.getTrustedUrl(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsResourceUrl
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsResourceUrl(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the return
+ * value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#trustAsJs
+ *
+ * @description
+ * Shorthand method. `$sce.trustAsJs(value)` →
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}
+ *
+ * @param {*} value The value to trustAs.
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs
+ * $sce.getTrustedJs(value)} to obtain the original value. (privileged directives
+ * only accept expressions that are either literal constants or are the
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrusted
+ *
+ * @description
+ * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}. As such,
+ * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the
+ * originally supplied value if the queried context type is a supertype of the created type.
+ * If this condition isn't satisfied, throws an exception.
+ *
+ * @param {string} type The kind of context in which this value is to be used.
+ * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}
+ * call.
+ * @returns {*} The value the was originally provided to
+ * {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.
+ * Otherwise, throws an exception.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedHtml
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedHtml(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedCss
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedCss(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedUrl
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedUrl(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedResourceUrl
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedResourceUrl(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}
+ *
+ * @param {*} value The value to pass to `$sceDelegate.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#getTrustedJs
+ *
+ * @description
+ * Shorthand method. `$sce.getTrustedJs(value)` →
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}
+ *
+ * @param {*} value The value to pass to `$sce.getTrusted`.
+ * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsHtml
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsHtml(expression string)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsCss
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsCss(value)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsUrl
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsUrl(value)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsResourceUrl
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsResourceUrl(value)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ /**
+ * @ngdoc method
+ * @name $sce#parseAsJs
+ *
+ * @description
+ * Shorthand method. `$sce.parseAsJs(value)` →
+ * {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`}
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (typically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
+ */
+
+ // Shorthand delegations.
+ var parse = sce.parseAs,
+ getTrusted = sce.getTrusted,
+ trustAs = sce.trustAs;
+
+ forEach(SCE_CONTEXTS, function(enumValue, name) {
+ var lName = lowercase(name);
+ sce[camelCase("parse_as_" + lName)] = function(expr) {
+ return parse(enumValue, expr);
+ };
+ sce[camelCase("get_trusted_" + lName)] = function(value) {
+ return getTrusted(enumValue, value);
+ };
+ sce[camelCase("trust_as_" + lName)] = function(value) {
+ return trustAs(enumValue, value);
+ };
+ });
+
+ return sce;
+ }];
+}
+
+/**
+ * !!! This is an undocumented "private" service !!!
+ *
+ * @name $sniffer
+ * @requires $window
+ * @requires $document
+ *
+ * @property {boolean} history Does the browser support html5 history api ?
+ * @property {boolean} transitions Does the browser support CSS transition events ?
+ * @property {boolean} animations Does the browser support CSS animation events ?
+ *
+ * @description
+ * This is very simple implementation of testing browser's features.
+ */
+function $SnifferProvider() {
+ this.$get = ['$window', '$document', function($window, $document) {
+ var eventSupport = {},
+ android =
+ toInt((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
+ boxee = /Boxee/i.test(($window.navigator || {}).userAgent),
+ document = $document[0] || {},
+ vendorPrefix,
+ vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/,
+ bodyStyle = document.body && document.body.style,
+ transitions = false,
+ animations = false,
+ match;
+
+ if (bodyStyle) {
+ for (var prop in bodyStyle) {
+ if (match = vendorRegex.exec(prop)) {
+ vendorPrefix = match[0];
+ vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);
+ break;
+ }
+ }
+
+ if (!vendorPrefix) {
+ vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';
+ }
+
+ transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));
+ animations = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));
+
+ if (android && (!transitions || !animations)) {
+ transitions = isString(bodyStyle.webkitTransition);
+ animations = isString(bodyStyle.webkitAnimation);
+ }
+ }
+
+
+ return {
+ // Android has history.pushState, but it does not update location correctly
+ // so let's not use the history API at all.
+ // http://code.google.com/p/android/issues/detail?id=17471
+ // https://github.com/angular/angular.js/issues/904
+
+ // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has
+ // so let's not use the history API also
+ // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined
+ // jshint -W018
+ history: !!($window.history && $window.history.pushState && !(android < 4) && !boxee),
+ // jshint +W018
+ hasEvent: function(event) {
+ // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
+ // it. In particular the event is not fired when backspace or delete key are pressed or
+ // when cut operation is performed.
+ // IE10+ implements 'input' event but it erroneously fires under various situations,
+ // e.g. when placeholder changes, or a form is focused.
+ if (event === 'input' && msie <= 11) return false;
+
+ if (isUndefined(eventSupport[event])) {
+ var divElm = document.createElement('div');
+ eventSupport[event] = 'on' + event in divElm;
+ }
+
+ return eventSupport[event];
+ },
+ csp: csp(),
+ vendorPrefix: vendorPrefix,
+ transitions: transitions,
+ animations: animations,
+ android: android
+ };
+ }];
+}
+
+var $compileMinErr = minErr('$compile');
+
+/**
+ * @ngdoc provider
+ * @name $templateRequestProvider
+ * @description
+ * Used to configure the options passed to the {@link $http} service when making a template request.
+ *
+ * For example, it can be used for specifying the "Accept" header that is sent to the server, when
+ * requesting a template.
+ */
+function $TemplateRequestProvider() {
+
+ var httpOptions;
+
+ /**
+ * @ngdoc method
+ * @name $templateRequestProvider#httpOptions
+ * @description
+ * The options to be passed to the {@link $http} service when making the request.
+ * You can use this to override options such as the "Accept" header for template requests.
+ *
+ * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the
+ * options if not overridden here.
+ *
+ * @param {string=} value new value for the {@link $http} options.
+ * @returns {string|self} Returns the {@link $http} options when used as getter and self if used as setter.
+ */
+ this.httpOptions = function(val) {
+ if (val) {
+ httpOptions = val;
+ return this;
+ }
+ return httpOptions;
+ };
+
+ /**
+ * @ngdoc service
+ * @name $templateRequest
+ *
+ * @description
+ * The `$templateRequest` service runs security checks then downloads the provided template using
+ * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request
+ * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the
+ * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the
+ * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted
+ * when `tpl` is of type string and `$templateCache` has the matching entry.
+ *
+ * If you want to pass custom options to the `$http` service, such as setting the Accept header you
+ * can configure this via {@link $templateRequestProvider#httpOptions}.
+ *
+ * @param {string|TrustedResourceUrl} tpl The HTTP request template URL
+ * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty
+ *
+ * @return {Promise} a promise for the HTTP response data of the given URL.
+ *
+ * @property {number} totalPendingRequests total amount of pending template requests being downloaded.
+ */
+ this.$get = ['$templateCache', '$http', '$q', '$sce', function($templateCache, $http, $q, $sce) {
+
+ function handleRequestFn(tpl, ignoreRequestError) {
+ handleRequestFn.totalPendingRequests++;
+
+ // We consider the template cache holds only trusted templates, so
+ // there's no need to go through whitelisting again for keys that already
+ // are included in there. This also makes Angular accept any script
+ // directive, no matter its name. However, we still need to unwrap trusted
+ // types.
+ if (!isString(tpl) || !$templateCache.get(tpl)) {
+ tpl = $sce.getTrustedResourceUrl(tpl);
+ }
+
+ var transformResponse = $http.defaults && $http.defaults.transformResponse;
+
+ if (isArray(transformResponse)) {
+ transformResponse = transformResponse.filter(function(transformer) {
+ return transformer !== defaultHttpResponseTransform;
+ });
+ } else if (transformResponse === defaultHttpResponseTransform) {
+ transformResponse = null;
+ }
+
+ return $http.get(tpl, extend({
+ cache: $templateCache,
+ transformResponse: transformResponse
+ }, httpOptions))
+ ['finally'](function() {
+ handleRequestFn.totalPendingRequests--;
+ })
+ .then(function(response) {
+ $templateCache.put(tpl, response.data);
+ return response.data;
+ }, handleError);
+
+ function handleError(resp) {
+ if (!ignoreRequestError) {
+ throw $compileMinErr('tpload', 'Failed to load template: {0} (HTTP status: {1} {2})',
+ tpl, resp.status, resp.statusText);
+ }
+ return $q.reject(resp);
+ }
+ }
+
+ handleRequestFn.totalPendingRequests = 0;
+
+ return handleRequestFn;
+ }];
+}
+
+function $$TestabilityProvider() {
+ this.$get = ['$rootScope', '$browser', '$location',
+ function($rootScope, $browser, $location) {
+
+ /**
+ * @name $testability
+ *
+ * @description
+ * The private $$testability service provides a collection of methods for use when debugging
+ * or by automated test and debugging tools.
+ */
+ var testability = {};
+
+ /**
+ * @name $$testability#findBindings
+ *
+ * @description
+ * Returns an array of elements that are bound (via ng-bind or {{}})
+ * to expressions matching the input.
+ *
+ * @param {Element} element The element root to search from.
+ * @param {string} expression The binding expression to match.
+ * @param {boolean} opt_exactMatch If true, only returns exact matches
+ * for the expression. Filters and whitespace are ignored.
+ */
+ testability.findBindings = function(element, expression, opt_exactMatch) {
+ var bindings = element.getElementsByClassName('ng-binding');
+ var matches = [];
+ forEach(bindings, function(binding) {
+ var dataBinding = angular.element(binding).data('$binding');
+ if (dataBinding) {
+ forEach(dataBinding, function(bindingName) {
+ if (opt_exactMatch) {
+ var matcher = new RegExp('(^|\\s)' + escapeForRegexp(expression) + '(\\s|\\||$)');
+ if (matcher.test(bindingName)) {
+ matches.push(binding);
+ }
+ } else {
+ if (bindingName.indexOf(expression) != -1) {
+ matches.push(binding);
+ }
+ }
+ });
+ }
+ });
+ return matches;
+ };
+
+ /**
+ * @name $$testability#findModels
+ *
+ * @description
+ * Returns an array of elements that are two-way found via ng-model to
+ * expressions matching the input.
+ *
+ * @param {Element} element The element root to search from.
+ * @param {string} expression The model expression to match.
+ * @param {boolean} opt_exactMatch If true, only returns exact matches
+ * for the expression.
+ */
+ testability.findModels = function(element, expression, opt_exactMatch) {
+ var prefixes = ['ng-', 'data-ng-', 'ng\\:'];
+ for (var p = 0; p < prefixes.length; ++p) {
+ var attributeEquals = opt_exactMatch ? '=' : '*=';
+ var selector = '[' + prefixes[p] + 'model' + attributeEquals + '"' + expression + '"]';
+ var elements = element.querySelectorAll(selector);
+ if (elements.length) {
+ return elements;
+ }
+ }
+ };
+
+ /**
+ * @name $$testability#getLocation
+ *
+ * @description
+ * Shortcut for getting the location in a browser agnostic way. Returns
+ * the path, search, and hash. (e.g. /path?a=b#hash)
+ */
+ testability.getLocation = function() {
+ return $location.url();
+ };
+
+ /**
+ * @name $$testability#setLocation
+ *
+ * @description
+ * Shortcut for navigating to a location without doing a full page reload.
+ *
+ * @param {string} url The location url (path, search and hash,
+ * e.g. /path?a=b#hash) to go to.
+ */
+ testability.setLocation = function(url) {
+ if (url !== $location.url()) {
+ $location.url(url);
+ $rootScope.$digest();
+ }
+ };
+
+ /**
+ * @name $$testability#whenStable
+ *
+ * @description
+ * Calls the callback when $timeout and $http requests are completed.
+ *
+ * @param {function} callback
+ */
+ testability.whenStable = function(callback) {
+ $browser.notifyWhenNoOutstandingRequests(callback);
+ };
+
+ return testability;
+ }];
+}
+
+function $TimeoutProvider() {
+ this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler',
+ function($rootScope, $browser, $q, $$q, $exceptionHandler) {
+
+ var deferreds = {};
+
+
+ /**
+ * @ngdoc service
+ * @name $timeout
+ *
+ * @description
+ * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch
+ * block and delegates any exceptions to
+ * {@link ng.$exceptionHandler $exceptionHandler} service.
+ *
+ * The return value of calling `$timeout` is a promise, which will be resolved when
+ * the delay has passed and the timeout function, if provided, is executed.
+ *
+ * To cancel a timeout request, call `$timeout.cancel(promise)`.
+ *
+ * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to
+ * synchronously flush the queue of deferred functions.
+ *
+ * If you only want a promise that will be resolved after some specified delay
+ * then you can call `$timeout` without the `fn` function.
+ *
+ * @param {function()=} fn A function, whose execution should be delayed.
+ * @param {number=} [delay=0] Delay in milliseconds.
+ * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
+ * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
+ * @param {...*=} Pass additional parameters to the executed function.
+ * @returns {Promise} Promise that will be resolved when the timeout is reached. The value this
+ * promise will be resolved with is the return value of the `fn` function.
+ *
+ */
+ function timeout(fn, delay, invokeApply) {
+ if (!isFunction(fn)) {
+ invokeApply = delay;
+ delay = fn;
+ fn = noop;
+ }
+
+ var args = sliceArgs(arguments, 3),
+ skipApply = (isDefined(invokeApply) && !invokeApply),
+ deferred = (skipApply ? $$q : $q).defer(),
+ promise = deferred.promise,
+ timeoutId;
+
+ timeoutId = $browser.defer(function() {
+ try {
+ deferred.resolve(fn.apply(null, args));
+ } catch (e) {
+ deferred.reject(e);
+ $exceptionHandler(e);
+ }
+ finally {
+ delete deferreds[promise.$$timeoutId];
+ }
+
+ if (!skipApply) $rootScope.$apply();
+ }, delay);
+
+ promise.$$timeoutId = timeoutId;
+ deferreds[timeoutId] = deferred;
+
+ return promise;
+ }
+
+
+ /**
+ * @ngdoc method
+ * @name $timeout#cancel
+ *
+ * @description
+ * Cancels a task associated with the `promise`. As a result of this, the promise will be
+ * resolved with a rejection.
+ *
+ * @param {Promise=} promise Promise returned by the `$timeout` function.
+ * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
+ * canceled.
+ */
+ timeout.cancel = function(promise) {
+ if (promise && promise.$$timeoutId in deferreds) {
+ deferreds[promise.$$timeoutId].reject('canceled');
+ delete deferreds[promise.$$timeoutId];
+ return $browser.defer.cancel(promise.$$timeoutId);
+ }
+ return false;
+ };
+
+ return timeout;
+ }];
+}
+
+// NOTE: The usage of window and document instead of $window and $document here is
+// deliberate. This service depends on the specific behavior of anchor nodes created by the
+// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and
+// cause us to break tests. In addition, when the browser resolves a URL for XHR, it
+// doesn't know about mocked locations and resolves URLs to the real document - which is
+// exactly the behavior needed here. There is little value is mocking these out for this
+// service.
+var urlParsingNode = document.createElement("a");
+var originUrl = urlResolve(window.location.href);
+
+
+/**
+ *
+ * Implementation Notes for non-IE browsers
+ * ----------------------------------------
+ * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,
+ * results both in the normalizing and parsing of the URL. Normalizing means that a relative
+ * URL will be resolved into an absolute URL in the context of the application document.
+ * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related
+ * properties are all populated to reflect the normalized URL. This approach has wide
+ * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See
+ * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
+ *
+ * Implementation Notes for IE
+ * ---------------------------
+ * IE <= 10 normalizes the URL when assigned to the anchor node similar to the other
+ * browsers. However, the parsed components will not be set if the URL assigned did not specify
+ * them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We
+ * work around that by performing the parsing in a 2nd step by taking a previously normalized
+ * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the
+ * properties such as protocol, hostname, port, etc.
+ *
+ * References:
+ * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement
+ * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
+ * http://url.spec.whatwg.org/#urlutils
+ * https://github.com/angular/angular.js/pull/2902
+ * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
+ *
+ * @kind function
+ * @param {string} url The URL to be parsed.
+ * @description Normalizes and parses a URL.
+ * @returns {object} Returns the normalized URL as a dictionary.
+ *
+ * | member name | Description |
+ * |---------------|----------------|
+ * | href | A normalized version of the provided URL if it was not an absolute URL |
+ * | protocol | The protocol including the trailing colon |
+ * | host | The host and port (if the port is non-default) of the normalizedUrl |
+ * | search | The search params, minus the question mark |
+ * | hash | The hash string, minus the hash symbol
+ * | hostname | The hostname
+ * | port | The port, without ":"
+ * | pathname | The pathname, beginning with "/"
+ *
+ */
+function urlResolve(url) {
+ var href = url;
+
+ if (msie) {
+ // Normalize before parse. Refer Implementation Notes on why this is
+ // done in two steps on IE.
+ urlParsingNode.setAttribute("href", href);
+ href = urlParsingNode.href;
+ }
+
+ urlParsingNode.setAttribute('href', href);
+
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
+ return {
+ href: urlParsingNode.href,
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
+ host: urlParsingNode.host,
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
+ hostname: urlParsingNode.hostname,
+ port: urlParsingNode.port,
+ pathname: (urlParsingNode.pathname.charAt(0) === '/')
+ ? urlParsingNode.pathname
+ : '/' + urlParsingNode.pathname
+ };
+}
+
+/**
+ * Parse a request URL and determine whether this is a same-origin request as the application document.
+ *
+ * @param {string|object} requestUrl The url of the request as a string that will be resolved
+ * or a parsed URL object.
+ * @returns {boolean} Whether the request is for the same origin as the application document.
+ */
+function urlIsSameOrigin(requestUrl) {
+ var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;
+ return (parsed.protocol === originUrl.protocol &&
+ parsed.host === originUrl.host);
+}
+
+/**
+ * @ngdoc service
+ * @name $window
+ *
+ * @description
+ * A reference to the browser's `window` object. While `window`
+ * is globally available in JavaScript, it causes testability problems, because
+ * it is a global variable. In angular we always refer to it through the
+ * `$window` service, so it may be overridden, removed or mocked for testing.
+ *
+ * Expressions, like the one defined for the `ngClick` directive in the example
+ * below, are evaluated with respect to the current scope. Therefore, there is
+ * no risk of inadvertently coding in a dependency on a global value in such an
+ * expression.
+ *
+ * @example
+ <example module="windowExample">
+ <file name="index.html">
+ <script>
+ angular.module('windowExample', [])
+ .controller('ExampleController', ['$scope', '$window', function($scope, $window) {
+ $scope.greeting = 'Hello, World!';
+ $scope.doGreeting = function(greeting) {
+ $window.alert(greeting);
+ };
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <input type="text" ng-model="greeting" aria-label="greeting" />
+ <button ng-click="doGreeting(greeting)">ALERT</button>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should display the greeting in the input box', function() {
+ element(by.model('greeting')).sendKeys('Hello, E2E Tests');
+ // If we click the button it will block the test runner
+ // element(':button').click();
+ });
+ </file>
+ </example>
+ */
+function $WindowProvider() {
+ this.$get = valueFn(window);
+}
+
+/**
+ * @name $$cookieReader
+ * @requires $document
+ *
+ * @description
+ * This is a private service for reading cookies used by $http and ngCookies
+ *
+ * @return {Object} a key/value map of the current cookies
+ */
+function $$CookieReader($document) {
+ var rawDocument = $document[0] || {};
+ var lastCookies = {};
+ var lastCookieString = '';
+
+ function safeDecodeURIComponent(str) {
+ try {
+ return decodeURIComponent(str);
+ } catch (e) {
+ return str;
+ }
+ }
+
+ return function() {
+ var cookieArray, cookie, i, index, name;
+ var currentCookieString = rawDocument.cookie || '';
+
+ if (currentCookieString !== lastCookieString) {
+ lastCookieString = currentCookieString;
+ cookieArray = lastCookieString.split('; ');
+ lastCookies = {};
+
+ for (i = 0; i < cookieArray.length; i++) {
+ cookie = cookieArray[i];
+ index = cookie.indexOf('=');
+ if (index > 0) { //ignore nameless cookies
+ name = safeDecodeURIComponent(cookie.substring(0, index));
+ // the first value that is seen for a cookie is the most
+ // specific one. values for the same cookie name that
+ // follow are for less specific paths.
+ if (isUndefined(lastCookies[name])) {
+ lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1));
+ }
+ }
+ }
+ }
+ return lastCookies;
+ };
+}
+
+$$CookieReader.$inject = ['$document'];
+
+function $$CookieReaderProvider() {
+ this.$get = $$CookieReader;
+}
+
+/* global currencyFilter: true,
+ dateFilter: true,
+ filterFilter: true,
+ jsonFilter: true,
+ limitToFilter: true,
+ lowercaseFilter: true,
+ numberFilter: true,
+ orderByFilter: true,
+ uppercaseFilter: true,
+ */
+
+/**
+ * @ngdoc provider
+ * @name $filterProvider
+ * @description
+ *
+ * Filters are just functions which transform input to an output. However filters need to be
+ * Dependency Injected. To achieve this a filter definition consists of a factory function which is
+ * annotated with dependencies and is responsible for creating a filter function.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
+ * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
+ * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
+ * (`myapp_subsection_filterx`).
+ * </div>
+ *
+ * ```js
+ * // Filter registration
+ * function MyModule($provide, $filterProvider) {
+ * // create a service to demonstrate injection (not always needed)
+ * $provide.value('greet', function(name){
+ * return 'Hello ' + name + '!';
+ * });
+ *
+ * // register a filter factory which uses the
+ * // greet service to demonstrate DI.
+ * $filterProvider.register('greet', function(greet){
+ * // return the filter function which uses the greet service
+ * // to generate salutation
+ * return function(text) {
+ * // filters need to be forgiving so check input validity
+ * return text && greet(text) || text;
+ * };
+ * });
+ * }
+ * ```
+ *
+ * The filter function is registered with the `$injector` under the filter name suffix with
+ * `Filter`.
+ *
+ * ```js
+ * it('should be the same instance', inject(
+ * function($filterProvider) {
+ * $filterProvider.register('reverse', function(){
+ * return ...;
+ * });
+ * },
+ * function($filter, reverseFilter) {
+ * expect($filter('reverse')).toBe(reverseFilter);
+ * });
+ * ```
+ *
+ *
+ * For more information about how angular filters work, and how to create your own filters, see
+ * {@link guide/filter Filters} in the Angular Developer Guide.
+ */
+
+/**
+ * @ngdoc service
+ * @name $filter
+ * @kind function
+ * @description
+ * Filters are used for formatting data displayed to the user.
+ *
+ * The general syntax in templates is as follows:
+ *
+ * {{ expression [| filter_name[:parameter_value] ... ] }}
+ *
+ * @param {String} name Name of the filter function to retrieve
+ * @return {Function} the filter function
+ * @example
+ <example name="$filter" module="filterExample">
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <h3>{{ originalText }}</h3>
+ <h3>{{ filteredText }}</h3>
+ </div>
+ </file>
+
+ <file name="script.js">
+ angular.module('filterExample', [])
+ .controller('MainCtrl', function($scope, $filter) {
+ $scope.originalText = 'hello';
+ $scope.filteredText = $filter('uppercase')($scope.originalText);
+ });
+ </file>
+ </example>
+ */
+$FilterProvider.$inject = ['$provide'];
+function $FilterProvider($provide) {
+ var suffix = 'Filter';
+
+ /**
+ * @ngdoc method
+ * @name $filterProvider#register
+ * @param {string|Object} name Name of the filter function, or an object map of filters where
+ * the keys are the filter names and the values are the filter factories.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
+ * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
+ * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
+ * (`myapp_subsection_filterx`).
+ * </div>
+ * @param {Function} factory If the first argument was a string, a factory function for the filter to be registered.
+ * @returns {Object} Registered filter instance, or if a map of filters was provided then a map
+ * of the registered filter instances.
+ */
+ function register(name, factory) {
+ if (isObject(name)) {
+ var filters = {};
+ forEach(name, function(filter, key) {
+ filters[key] = register(key, filter);
+ });
+ return filters;
+ } else {
+ return $provide.factory(name + suffix, factory);
+ }
+ }
+ this.register = register;
+
+ this.$get = ['$injector', function($injector) {
+ return function(name) {
+ return $injector.get(name + suffix);
+ };
+ }];
+
+ ////////////////////////////////////////
+
+ /* global
+ currencyFilter: false,
+ dateFilter: false,
+ filterFilter: false,
+ jsonFilter: false,
+ limitToFilter: false,
+ lowercaseFilter: false,
+ numberFilter: false,
+ orderByFilter: false,
+ uppercaseFilter: false,
+ */
+
+ register('currency', currencyFilter);
+ register('date', dateFilter);
+ register('filter', filterFilter);
+ register('json', jsonFilter);
+ register('limitTo', limitToFilter);
+ register('lowercase', lowercaseFilter);
+ register('number', numberFilter);
+ register('orderBy', orderByFilter);
+ register('uppercase', uppercaseFilter);
+}
+
+/**
+ * @ngdoc filter
+ * @name filter
+ * @kind function
+ *
+ * @description
+ * Selects a subset of items from `array` and returns it as a new array.
+ *
+ * @param {Array} array The source array.
+ * @param {string|Object|function()} expression The predicate to be used for selecting items from
+ * `array`.
+ *
+ * Can be one of:
+ *
+ * - `string`: The string is used for matching against the contents of the `array`. All strings or
+ * objects with string properties in `array` that match this string will be returned. This also
+ * applies to nested object properties.
+ * The predicate can be negated by prefixing the string with `!`.
+ *
+ * - `Object`: A pattern object can be used to filter specific properties on objects contained
+ * by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items
+ * which have property `name` containing "M" and property `phone` containing "1". A special
+ * property name `$` can be used (as in `{$:"text"}`) to accept a match against any
+ * property of the object or its nested object properties. That's equivalent to the simple
+ * substring match with a `string` as described above. The predicate can be negated by prefixing
+ * the string with `!`.
+ * For example `{name: "!M"}` predicate will return an array of items which have property `name`
+ * not containing "M".
+ *
+ * Note that a named property will match properties on the same level only, while the special
+ * `$` property will match properties on the same level or deeper. E.g. an array item like
+ * `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but
+ * **will** be matched by `{$: 'John'}`.
+ *
+ * - `function(value, index, array)`: A predicate function can be used to write arbitrary filters.
+ * The function is called for each element of the array, with the element, its index, and
+ * the entire array itself as arguments.
+ *
+ * The final result is an array of those elements that the predicate returned true for.
+ *
+ * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in
+ * determining if the expected value (from the filter expression) and actual value (from
+ * the object in the array) should be considered a match.
+ *
+ * Can be one of:
+ *
+ * - `function(actual, expected)`:
+ * The function will be given the object value and the predicate value to compare and
+ * should return true if both values should be considered equal.
+ *
+ * - `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`.
+ * This is essentially strict comparison of expected and actual.
+ *
+ * - `false|undefined`: A short hand for a function which will look for a substring match in case
+ * insensitive way.
+ *
+ * Primitive values are converted to strings. Objects are not compared against primitives,
+ * unless they have a custom `toString` method (e.g. `Date` objects).
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <div ng-init="friends = [{name:'John', phone:'555-1276'},
+ {name:'Mary', phone:'800-BIG-MARY'},
+ {name:'Mike', phone:'555-4321'},
+ {name:'Adam', phone:'555-5678'},
+ {name:'Julie', phone:'555-8765'},
+ {name:'Juliette', phone:'555-5678'}]"></div>
+
+ <label>Search: <input ng-model="searchText"></label>
+ <table id="searchTextResults">
+ <tr><th>Name</th><th>Phone</th></tr>
+ <tr ng-repeat="friend in friends | filter:searchText">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ </tr>
+ </table>
+ <hr>
+ <label>Any: <input ng-model="search.$"></label> <br>
+ <label>Name only <input ng-model="search.name"></label><br>
+ <label>Phone only <input ng-model="search.phone"></label><br>
+ <label>Equality <input type="checkbox" ng-model="strict"></label><br>
+ <table id="searchObjResults">
+ <tr><th>Name</th><th>Phone</th></tr>
+ <tr ng-repeat="friendObj in friends | filter:search:strict">
+ <td>{{friendObj.name}}</td>
+ <td>{{friendObj.phone}}</td>
+ </tr>
+ </table>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var expectFriendNames = function(expectedNames, key) {
+ element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) {
+ arr.forEach(function(wd, i) {
+ expect(wd.getText()).toMatch(expectedNames[i]);
+ });
+ });
+ };
+
+ it('should search across all fields when filtering with a string', function() {
+ var searchText = element(by.model('searchText'));
+ searchText.clear();
+ searchText.sendKeys('m');
+ expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend');
+
+ searchText.clear();
+ searchText.sendKeys('76');
+ expectFriendNames(['John', 'Julie'], 'friend');
+ });
+
+ it('should search in specific fields when filtering with a predicate object', function() {
+ var searchAny = element(by.model('search.$'));
+ searchAny.clear();
+ searchAny.sendKeys('i');
+ expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj');
+ });
+ it('should use a equal comparison when comparator is true', function() {
+ var searchName = element(by.model('search.name'));
+ var strict = element(by.model('strict'));
+ searchName.clear();
+ searchName.sendKeys('Julie');
+ strict.click();
+ expectFriendNames(['Julie'], 'friendObj');
+ });
+ </file>
+ </example>
+ */
+function filterFilter() {
+ return function(array, expression, comparator) {
+ if (!isArrayLike(array)) {
+ if (array == null) {
+ return array;
+ } else {
+ throw minErr('filter')('notarray', 'Expected array but received: {0}', array);
+ }
+ }
+
+ var expressionType = getTypeForFilter(expression);
+ var predicateFn;
+ var matchAgainstAnyProp;
+
+ switch (expressionType) {
+ case 'function':
+ predicateFn = expression;
+ break;
+ case 'boolean':
+ case 'null':
+ case 'number':
+ case 'string':
+ matchAgainstAnyProp = true;
+ //jshint -W086
+ case 'object':
+ //jshint +W086
+ predicateFn = createPredicateFn(expression, comparator, matchAgainstAnyProp);
+ break;
+ default:
+ return array;
+ }
+
+ return Array.prototype.filter.call(array, predicateFn);
+ };
+}
+
+// Helper functions for `filterFilter`
+function createPredicateFn(expression, comparator, matchAgainstAnyProp) {
+ var shouldMatchPrimitives = isObject(expression) && ('$' in expression);
+ var predicateFn;
+
+ if (comparator === true) {
+ comparator = equals;
+ } else if (!isFunction(comparator)) {
+ comparator = function(actual, expected) {
+ if (isUndefined(actual)) {
+ // No substring matching against `undefined`
+ return false;
+ }
+ if ((actual === null) || (expected === null)) {
+ // No substring matching against `null`; only match against `null`
+ return actual === expected;
+ }
+ if (isObject(expected) || (isObject(actual) && !hasCustomToString(actual))) {
+ // Should not compare primitives against objects, unless they have custom `toString` method
+ return false;
+ }
+
+ actual = lowercase('' + actual);
+ expected = lowercase('' + expected);
+ return actual.indexOf(expected) !== -1;
+ };
+ }
+
+ predicateFn = function(item) {
+ if (shouldMatchPrimitives && !isObject(item)) {
+ return deepCompare(item, expression.$, comparator, false);
+ }
+ return deepCompare(item, expression, comparator, matchAgainstAnyProp);
+ };
+
+ return predicateFn;
+}
+
+function deepCompare(actual, expected, comparator, matchAgainstAnyProp, dontMatchWholeObject) {
+ var actualType = getTypeForFilter(actual);
+ var expectedType = getTypeForFilter(expected);
+
+ if ((expectedType === 'string') && (expected.charAt(0) === '!')) {
+ return !deepCompare(actual, expected.substring(1), comparator, matchAgainstAnyProp);
+ } else if (isArray(actual)) {
+ // In case `actual` is an array, consider it a match
+ // if ANY of it's items matches `expected`
+ return actual.some(function(item) {
+ return deepCompare(item, expected, comparator, matchAgainstAnyProp);
+ });
+ }
+
+ switch (actualType) {
+ case 'object':
+ var key;
+ if (matchAgainstAnyProp) {
+ for (key in actual) {
+ if ((key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, true)) {
+ return true;
+ }
+ }
+ return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, false);
+ } else if (expectedType === 'object') {
+ for (key in expected) {
+ var expectedVal = expected[key];
+ if (isFunction(expectedVal) || isUndefined(expectedVal)) {
+ continue;
+ }
+
+ var matchAnyProperty = key === '$';
+ var actualVal = matchAnyProperty ? actual : actual[key];
+ if (!deepCompare(actualVal, expectedVal, comparator, matchAnyProperty, matchAnyProperty)) {
+ return false;
+ }
+ }
+ return true;
+ } else {
+ return comparator(actual, expected);
+ }
+ break;
+ case 'function':
+ return false;
+ default:
+ return comparator(actual, expected);
+ }
+}
+
+// Used for easily differentiating between `null` and actual `object`
+function getTypeForFilter(val) {
+ return (val === null) ? 'null' : typeof val;
+}
+
+/**
+ * @ngdoc filter
+ * @name currency
+ * @kind function
+ *
+ * @description
+ * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default
+ * symbol for current locale is used.
+ *
+ * @param {number} amount Input to filter.
+ * @param {string=} symbol Currency symbol or identifier to be displayed.
+ * @param {number=} fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale
+ * @returns {string} Formatted number.
+ *
+ *
+ * @example
+ <example module="currencyExample">
+ <file name="index.html">
+ <script>
+ angular.module('currencyExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.amount = 1234.56;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <input type="number" ng-model="amount" aria-label="amount"> <br>
+ default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br>
+ custom currency identifier (USD$): <span id="currency-custom">{{amount | currency:"USD$"}}</span>
+ no fractions (0): <span id="currency-no-fractions">{{amount | currency:"USD$":0}}</span>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should init with 1234.56', function() {
+ expect(element(by.id('currency-default')).getText()).toBe('$1,234.56');
+ expect(element(by.id('currency-custom')).getText()).toBe('USD$1,234.56');
+ expect(element(by.id('currency-no-fractions')).getText()).toBe('USD$1,235');
+ });
+ it('should update', function() {
+ if (browser.params.browser == 'safari') {
+ // Safari does not understand the minus key. See
+ // https://github.com/angular/protractor/issues/481
+ return;
+ }
+ element(by.model('amount')).clear();
+ element(by.model('amount')).sendKeys('-1234');
+ expect(element(by.id('currency-default')).getText()).toBe('-$1,234.00');
+ expect(element(by.id('currency-custom')).getText()).toBe('-USD$1,234.00');
+ expect(element(by.id('currency-no-fractions')).getText()).toBe('-USD$1,234');
+ });
+ </file>
+ </example>
+ */
+currencyFilter.$inject = ['$locale'];
+function currencyFilter($locale) {
+ var formats = $locale.NUMBER_FORMATS;
+ return function(amount, currencySymbol, fractionSize) {
+ if (isUndefined(currencySymbol)) {
+ currencySymbol = formats.CURRENCY_SYM;
+ }
+
+ if (isUndefined(fractionSize)) {
+ fractionSize = formats.PATTERNS[1].maxFrac;
+ }
+
+ // if null or undefined pass it through
+ return (amount == null)
+ ? amount
+ : formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize).
+ replace(/\u00A4/g, currencySymbol);
+ };
+}
+
+/**
+ * @ngdoc filter
+ * @name number
+ * @kind function
+ *
+ * @description
+ * Formats a number as text.
+ *
+ * If the input is null or undefined, it will just be returned.
+ * If the input is infinite (Infinity/-Infinity) the Infinity symbol '∞' is returned.
+ * If the input is not a number an empty string is returned.
+ *
+ *
+ * @param {number|string} number Number to format.
+ * @param {(number|string)=} fractionSize Number of decimal places to round the number to.
+ * If this is not provided then the fraction size is computed from the current locale's number
+ * formatting pattern. In the case of the default locale, it will be 3.
+ * @returns {string} Number rounded to decimalPlaces and places a “,†after each third digit.
+ *
+ * @example
+ <example module="numberFilterExample">
+ <file name="index.html">
+ <script>
+ angular.module('numberFilterExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.val = 1234.56789;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>Enter number: <input ng-model='val'></label><br>
+ Default formatting: <span id='number-default'>{{val | number}}</span><br>
+ No fractions: <span>{{val | number:0}}</span><br>
+ Negative number: <span>{{-val | number:4}}</span>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should format numbers', function() {
+ expect(element(by.id('number-default')).getText()).toBe('1,234.568');
+ expect(element(by.binding('val | number:0')).getText()).toBe('1,235');
+ expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');
+ });
+
+ it('should update', function() {
+ element(by.model('val')).clear();
+ element(by.model('val')).sendKeys('3374.333');
+ expect(element(by.id('number-default')).getText()).toBe('3,374.333');
+ expect(element(by.binding('val | number:0')).getText()).toBe('3,374');
+ expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330');
+ });
+ </file>
+ </example>
+ */
+
+
+numberFilter.$inject = ['$locale'];
+function numberFilter($locale) {
+ var formats = $locale.NUMBER_FORMATS;
+ return function(number, fractionSize) {
+
+ // if null or undefined pass it through
+ return (number == null)
+ ? number
+ : formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,
+ fractionSize);
+ };
+}
+
+var DECIMAL_SEP = '.';
+function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
+ if (isObject(number)) return '';
+
+ var isNegative = number < 0;
+ number = Math.abs(number);
+
+ var isInfinity = number === Infinity;
+ if (!isInfinity && !isFinite(number)) return '';
+
+ var numStr = number + '',
+ formatedText = '',
+ hasExponent = false,
+ parts = [];
+
+ if (isInfinity) formatedText = '\u221e';
+
+ if (!isInfinity && numStr.indexOf('e') !== -1) {
+ var match = numStr.match(/([\d\.]+)e(-?)(\d+)/);
+ if (match && match[2] == '-' && match[3] > fractionSize + 1) {
+ number = 0;
+ } else {
+ formatedText = numStr;
+ hasExponent = true;
+ }
+ }
+
+ if (!isInfinity && !hasExponent) {
+ var fractionLen = (numStr.split(DECIMAL_SEP)[1] || '').length;
+
+ // determine fractionSize if it is not specified
+ if (isUndefined(fractionSize)) {
+ fractionSize = Math.min(Math.max(pattern.minFrac, fractionLen), pattern.maxFrac);
+ }
+
+ // safely round numbers in JS without hitting imprecisions of floating-point arithmetics
+ // inspired by:
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round
+ number = +(Math.round(+(number.toString() + 'e' + fractionSize)).toString() + 'e' + -fractionSize);
+
+ var fraction = ('' + number).split(DECIMAL_SEP);
+ var whole = fraction[0];
+ fraction = fraction[1] || '';
+
+ var i, pos = 0,
+ lgroup = pattern.lgSize,
+ group = pattern.gSize;
+
+ if (whole.length >= (lgroup + group)) {
+ pos = whole.length - lgroup;
+ for (i = 0; i < pos; i++) {
+ if ((pos - i) % group === 0 && i !== 0) {
+ formatedText += groupSep;
+ }
+ formatedText += whole.charAt(i);
+ }
+ }
+
+ for (i = pos; i < whole.length; i++) {
+ if ((whole.length - i) % lgroup === 0 && i !== 0) {
+ formatedText += groupSep;
+ }
+ formatedText += whole.charAt(i);
+ }
+
+ // format fraction part.
+ while (fraction.length < fractionSize) {
+ fraction += '0';
+ }
+
+ if (fractionSize && fractionSize !== "0") formatedText += decimalSep + fraction.substr(0, fractionSize);
+ } else {
+ if (fractionSize > 0 && number < 1) {
+ formatedText = number.toFixed(fractionSize);
+ number = parseFloat(formatedText);
+ formatedText = formatedText.replace(DECIMAL_SEP, decimalSep);
+ }
+ }
+
+ if (number === 0) {
+ isNegative = false;
+ }
+
+ parts.push(isNegative ? pattern.negPre : pattern.posPre,
+ formatedText,
+ isNegative ? pattern.negSuf : pattern.posSuf);
+ return parts.join('');
+}
+
+function padNumber(num, digits, trim) {
+ var neg = '';
+ if (num < 0) {
+ neg = '-';
+ num = -num;
+ }
+ num = '' + num;
+ while (num.length < digits) num = '0' + num;
+ if (trim) {
+ num = num.substr(num.length - digits);
+ }
+ return neg + num;
+}
+
+
+function dateGetter(name, size, offset, trim) {
+ offset = offset || 0;
+ return function(date) {
+ var value = date['get' + name]();
+ if (offset > 0 || value > -offset) {
+ value += offset;
+ }
+ if (value === 0 && offset == -12) value = 12;
+ return padNumber(value, size, trim);
+ };
+}
+
+function dateStrGetter(name, shortForm) {
+ return function(date, formats) {
+ var value = date['get' + name]();
+ var get = uppercase(shortForm ? ('SHORT' + name) : name);
+
+ return formats[get][value];
+ };
+}
+
+function timeZoneGetter(date, formats, offset) {
+ var zone = -1 * offset;
+ var paddedZone = (zone >= 0) ? "+" : "";
+
+ paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
+ padNumber(Math.abs(zone % 60), 2);
+
+ return paddedZone;
+}
+
+function getFirstThursdayOfYear(year) {
+ // 0 = index of January
+ var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay();
+ // 4 = index of Thursday (+1 to account for 1st = 5)
+ // 11 = index of *next* Thursday (+1 account for 1st = 12)
+ return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst);
+}
+
+function getThursdayThisWeek(datetime) {
+ return new Date(datetime.getFullYear(), datetime.getMonth(),
+ // 4 = index of Thursday
+ datetime.getDate() + (4 - datetime.getDay()));
+}
+
+function weekGetter(size) {
+ return function(date) {
+ var firstThurs = getFirstThursdayOfYear(date.getFullYear()),
+ thisThurs = getThursdayThisWeek(date);
+
+ var diff = +thisThurs - +firstThurs,
+ result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week
+
+ return padNumber(result, size);
+ };
+}
+
+function ampmGetter(date, formats) {
+ return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];
+}
+
+function eraGetter(date, formats) {
+ return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1];
+}
+
+function longEraGetter(date, formats) {
+ return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1];
+}
+
+var DATE_FORMATS = {
+ yyyy: dateGetter('FullYear', 4),
+ yy: dateGetter('FullYear', 2, 0, true),
+ y: dateGetter('FullYear', 1),
+ MMMM: dateStrGetter('Month'),
+ MMM: dateStrGetter('Month', true),
+ MM: dateGetter('Month', 2, 1),
+ M: dateGetter('Month', 1, 1),
+ dd: dateGetter('Date', 2),
+ d: dateGetter('Date', 1),
+ HH: dateGetter('Hours', 2),
+ H: dateGetter('Hours', 1),
+ hh: dateGetter('Hours', 2, -12),
+ h: dateGetter('Hours', 1, -12),
+ mm: dateGetter('Minutes', 2),
+ m: dateGetter('Minutes', 1),
+ ss: dateGetter('Seconds', 2),
+ s: dateGetter('Seconds', 1),
+ // while ISO 8601 requires fractions to be prefixed with `.` or `,`
+ // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions
+ sss: dateGetter('Milliseconds', 3),
+ EEEE: dateStrGetter('Day'),
+ EEE: dateStrGetter('Day', true),
+ a: ampmGetter,
+ Z: timeZoneGetter,
+ ww: weekGetter(2),
+ w: weekGetter(1),
+ G: eraGetter,
+ GG: eraGetter,
+ GGG: eraGetter,
+ GGGG: longEraGetter
+};
+
+var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,
+ NUMBER_STRING = /^\-?\d+$/;
+
+/**
+ * @ngdoc filter
+ * @name date
+ * @kind function
+ *
+ * @description
+ * Formats `date` to a string based on the requested `format`.
+ *
+ * `format` string can be composed of the following elements:
+ *
+ * * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)
+ * * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
+ * * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)
+ * * `'MMMM'`: Month in year (January-December)
+ * * `'MMM'`: Month in year (Jan-Dec)
+ * * `'MM'`: Month in year, padded (01-12)
+ * * `'M'`: Month in year (1-12)
+ * * `'dd'`: Day in month, padded (01-31)
+ * * `'d'`: Day in month (1-31)
+ * * `'EEEE'`: Day in Week,(Sunday-Saturday)
+ * * `'EEE'`: Day in Week, (Sun-Sat)
+ * * `'HH'`: Hour in day, padded (00-23)
+ * * `'H'`: Hour in day (0-23)
+ * * `'hh'`: Hour in AM/PM, padded (01-12)
+ * * `'h'`: Hour in AM/PM, (1-12)
+ * * `'mm'`: Minute in hour, padded (00-59)
+ * * `'m'`: Minute in hour (0-59)
+ * * `'ss'`: Second in minute, padded (00-59)
+ * * `'s'`: Second in minute (0-59)
+ * * `'sss'`: Millisecond in second, padded (000-999)
+ * * `'a'`: AM/PM marker
+ * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)
+ * * `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year
+ * * `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year
+ * * `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD')
+ * * `'GGGG'`: The long form of the era string (e.g. 'Anno Domini')
+ *
+ * `format` string can also be one of the following predefined
+ * {@link guide/i18n localizable formats}:
+ *
+ * * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale
+ * (e.g. Sep 3, 2010 12:05:08 PM)
+ * * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 PM)
+ * * `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` for en_US locale
+ * (e.g. Friday, September 3, 2010)
+ * * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010)
+ * * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010)
+ * * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)
+ * * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 PM)
+ * * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 PM)
+ *
+ * `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g.
+ * `"h 'in the morning'"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence
+ * (e.g. `"h 'o''clock'"`).
+ *
+ * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
+ * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its
+ * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is
+ * specified in the string input, the time is considered to be in the local timezone.
+ * @param {string=} format Formatting rules (see Description). If not specified,
+ * `mediumDate` is used.
+ * @param {string=} timezone Timezone to be used for formatting. It understands UTC/GMT and the
+ * continental US time zone abbreviations, but for general use, use a time zone offset, for
+ * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
+ * If not specified, the timezone of the browser will be used.
+ * @returns {string} Formatted string or the input if input is not recognized as date/millis.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:
+ <span>{{1288323623006 | date:'medium'}}</span><br>
+ <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:
+ <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>
+ <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:
+ <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>
+ <span ng-non-bindable>{{1288323623006 | date:"MM/dd/yyyy 'at' h:mma"}}</span>:
+ <span>{{'1288323623006' | date:"MM/dd/yyyy 'at' h:mma"}}</span><br>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should format date', function() {
+ expect(element(by.binding("1288323623006 | date:'medium'")).getText()).
+ toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/);
+ expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()).
+ toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/);
+ expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()).
+ toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
+ expect(element(by.binding("'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"")).getText()).
+ toMatch(/10\/2\d\/2010 at \d{1,2}:\d{2}(AM|PM)/);
+ });
+ </file>
+ </example>
+ */
+dateFilter.$inject = ['$locale'];
+function dateFilter($locale) {
+
+
+ var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
+ // 1 2 3 4 5 6 7 8 9 10 11
+ function jsonStringToDate(string) {
+ var match;
+ if (match = string.match(R_ISO8601_STR)) {
+ var date = new Date(0),
+ tzHour = 0,
+ tzMin = 0,
+ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,
+ timeSetter = match[8] ? date.setUTCHours : date.setHours;
+
+ if (match[9]) {
+ tzHour = toInt(match[9] + match[10]);
+ tzMin = toInt(match[9] + match[11]);
+ }
+ dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3]));
+ var h = toInt(match[4] || 0) - tzHour;
+ var m = toInt(match[5] || 0) - tzMin;
+ var s = toInt(match[6] || 0);
+ var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
+ timeSetter.call(date, h, m, s, ms);
+ return date;
+ }
+ return string;
+ }
+
+
+ return function(date, format, timezone) {
+ var text = '',
+ parts = [],
+ fn, match;
+
+ format = format || 'mediumDate';
+ format = $locale.DATETIME_FORMATS[format] || format;
+ if (isString(date)) {
+ date = NUMBER_STRING.test(date) ? toInt(date) : jsonStringToDate(date);
+ }
+
+ if (isNumber(date)) {
+ date = new Date(date);
+ }
+
+ if (!isDate(date) || !isFinite(date.getTime())) {
+ return date;
+ }
+
+ while (format) {
+ match = DATE_FORMATS_SPLIT.exec(format);
+ if (match) {
+ parts = concat(parts, match, 1);
+ format = parts.pop();
+ } else {
+ parts.push(format);
+ format = null;
+ }
+ }
+
+ var dateTimezoneOffset = date.getTimezoneOffset();
+ if (timezone) {
+ dateTimezoneOffset = timezoneToOffset(timezone, date.getTimezoneOffset());
+ date = convertTimezoneToLocal(date, timezone, true);
+ }
+ forEach(parts, function(value) {
+ fn = DATE_FORMATS[value];
+ text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset)
+ : value.replace(/(^'|'$)/g, '').replace(/''/g, "'");
+ });
+
+ return text;
+ };
+}
+
+
+/**
+ * @ngdoc filter
+ * @name json
+ * @kind function
+ *
+ * @description
+ * Allows you to convert a JavaScript object into JSON string.
+ *
+ * This filter is mostly useful for debugging. When using the double curly {{value}} notation
+ * the binding is automatically converted to JSON.
+ *
+ * @param {*} object Any JavaScript object (including arrays and primitive types) to filter.
+ * @param {number=} spacing The number of spaces to use per indentation, defaults to 2.
+ * @returns {string} JSON string.
+ *
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <pre id="default-spacing">{{ {'name':'value'} | json }}</pre>
+ <pre id="custom-spacing">{{ {'name':'value'} | json:4 }}</pre>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should jsonify filtered objects', function() {
+ expect(element(by.id('default-spacing')).getText()).toMatch(/\{\n "name": ?"value"\n}/);
+ expect(element(by.id('custom-spacing')).getText()).toMatch(/\{\n "name": ?"value"\n}/);
+ });
+ </file>
+ </example>
+ *
+ */
+function jsonFilter() {
+ return function(object, spacing) {
+ if (isUndefined(spacing)) {
+ spacing = 2;
+ }
+ return toJson(object, spacing);
+ };
+}
+
+
+/**
+ * @ngdoc filter
+ * @name lowercase
+ * @kind function
+ * @description
+ * Converts string to lowercase.
+ * @see angular.lowercase
+ */
+var lowercaseFilter = valueFn(lowercase);
+
+
+/**
+ * @ngdoc filter
+ * @name uppercase
+ * @kind function
+ * @description
+ * Converts string to uppercase.
+ * @see angular.uppercase
+ */
+var uppercaseFilter = valueFn(uppercase);
+
+/**
+ * @ngdoc filter
+ * @name limitTo
+ * @kind function
+ *
+ * @description
+ * Creates a new array or string containing only a specified number of elements. The elements
+ * are taken from either the beginning or the end of the source array, string or number, as specified by
+ * the value and sign (positive or negative) of `limit`. If a number is used as input, it is
+ * converted to a string.
+ *
+ * @param {Array|string|number} input Source array, string or number to be limited.
+ * @param {string|number} limit The length of the returned array or string. If the `limit` number
+ * is positive, `limit` number of items from the beginning of the source array/string are copied.
+ * If the number is negative, `limit` number of items from the end of the source array/string
+ * are copied. The `limit` will be trimmed if it exceeds `array.length`. If `limit` is undefined,
+ * the input will be returned unchanged.
+ * @param {(string|number)=} begin Index at which to begin limitation. As a negative index, `begin`
+ * indicates an offset from the end of `input`. Defaults to `0`.
+ * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array
+ * had less than `limit` elements.
+ *
+ * @example
+ <example module="limitToExample">
+ <file name="index.html">
+ <script>
+ angular.module('limitToExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.numbers = [1,2,3,4,5,6,7,8,9];
+ $scope.letters = "abcdefghi";
+ $scope.longNumber = 2345432342;
+ $scope.numLimit = 3;
+ $scope.letterLimit = 3;
+ $scope.longNumberLimit = 3;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>
+ Limit {{numbers}} to:
+ <input type="number" step="1" ng-model="numLimit">
+ </label>
+ <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>
+ <label>
+ Limit {{letters}} to:
+ <input type="number" step="1" ng-model="letterLimit">
+ </label>
+ <p>Output letters: {{ letters | limitTo:letterLimit }}</p>
+ <label>
+ Limit {{longNumber}} to:
+ <input type="number" step="1" ng-model="longNumberLimit">
+ </label>
+ <p>Output long number: {{ longNumber | limitTo:longNumberLimit }}</p>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var numLimitInput = element(by.model('numLimit'));
+ var letterLimitInput = element(by.model('letterLimit'));
+ var longNumberLimitInput = element(by.model('longNumberLimit'));
+ var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));
+ var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));
+ var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit'));
+
+ it('should limit the number array to first three items', function() {
+ expect(numLimitInput.getAttribute('value')).toBe('3');
+ expect(letterLimitInput.getAttribute('value')).toBe('3');
+ expect(longNumberLimitInput.getAttribute('value')).toBe('3');
+ expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');
+ expect(limitedLetters.getText()).toEqual('Output letters: abc');
+ expect(limitedLongNumber.getText()).toEqual('Output long number: 234');
+ });
+
+ // There is a bug in safari and protractor that doesn't like the minus key
+ // it('should update the output when -3 is entered', function() {
+ // numLimitInput.clear();
+ // numLimitInput.sendKeys('-3');
+ // letterLimitInput.clear();
+ // letterLimitInput.sendKeys('-3');
+ // longNumberLimitInput.clear();
+ // longNumberLimitInput.sendKeys('-3');
+ // expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');
+ // expect(limitedLetters.getText()).toEqual('Output letters: ghi');
+ // expect(limitedLongNumber.getText()).toEqual('Output long number: 342');
+ // });
+
+ it('should not exceed the maximum size of input array', function() {
+ numLimitInput.clear();
+ numLimitInput.sendKeys('100');
+ letterLimitInput.clear();
+ letterLimitInput.sendKeys('100');
+ longNumberLimitInput.clear();
+ longNumberLimitInput.sendKeys('100');
+ expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');
+ expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');
+ expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342');
+ });
+ </file>
+ </example>
+*/
+function limitToFilter() {
+ return function(input, limit, begin) {
+ if (Math.abs(Number(limit)) === Infinity) {
+ limit = Number(limit);
+ } else {
+ limit = toInt(limit);
+ }
+ if (isNaN(limit)) return input;
+
+ if (isNumber(input)) input = input.toString();
+ if (!isArray(input) && !isString(input)) return input;
+
+ begin = (!begin || isNaN(begin)) ? 0 : toInt(begin);
+ begin = (begin < 0) ? Math.max(0, input.length + begin) : begin;
+
+ if (limit >= 0) {
+ return input.slice(begin, begin + limit);
+ } else {
+ if (begin === 0) {
+ return input.slice(limit, input.length);
+ } else {
+ return input.slice(Math.max(0, begin + limit), begin);
+ }
+ }
+ };
+}
+
+/**
+ * @ngdoc filter
+ * @name orderBy
+ * @kind function
+ *
+ * @description
+ * Orders a specified `array` by the `expression` predicate. It is ordered alphabetically
+ * for strings and numerically for numbers. Note: if you notice numbers are not being sorted
+ * as expected, make sure they are actually being saved as numbers and not strings.
+ * Array-like values (e.g. NodeLists, jQuery objects, TypedArrays, Strings, etc) are also supported.
+ *
+ * @param {Array} array The array (or array-like object) to sort.
+ * @param {function(*)|string|Array.<(function(*)|string)>=} expression A predicate to be
+ * used by the comparator to determine the order of elements.
+ *
+ * Can be one of:
+ *
+ * - `function`: Getter function. The result of this function will be sorted using the
+ * `<`, `===`, `>` operator.
+ * - `string`: An Angular expression. The result of this expression is used to compare elements
+ * (for example `name` to sort by a property called `name` or `name.substr(0, 3)` to sort by
+ * 3 first characters of a property called `name`). The result of a constant expression
+ * is interpreted as a property name to be used in comparisons (for example `"special name"`
+ * to sort object by the value of their `special name` property). An expression can be
+ * optionally prefixed with `+` or `-` to control ascending or descending sort order
+ * (for example, `+name` or `-name`). If no property is provided, (e.g. `'+'`) then the array
+ * element itself is used to compare where sorting.
+ * - `Array`: An array of function or string predicates. The first predicate in the array
+ * is used for sorting, but when two items are equivalent, the next predicate is used.
+ *
+ * If the predicate is missing or empty then it defaults to `'+'`.
+ *
+ * @param {boolean=} reverse Reverse the order of the array.
+ * @returns {Array} Sorted copy of the source array.
+ *
+ *
+ * @example
+ * The example below demonstrates a simple ngRepeat, where the data is sorted
+ * by age in descending order (predicate is set to `'-age'`).
+ * `reverse` is not set, which means it defaults to `false`.
+ <example module="orderByExample">
+ <file name="index.html">
+ <script>
+ angular.module('orderByExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.friends =
+ [{name:'John', phone:'555-1212', age:10},
+ {name:'Mary', phone:'555-9876', age:19},
+ {name:'Mike', phone:'555-4321', age:21},
+ {name:'Adam', phone:'555-5678', age:35},
+ {name:'Julie', phone:'555-8765', age:29}];
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <table class="friend">
+ <tr>
+ <th>Name</th>
+ <th>Phone Number</th>
+ <th>Age</th>
+ </tr>
+ <tr ng-repeat="friend in friends | orderBy:'-age'">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ <td>{{friend.age}}</td>
+ </tr>
+ </table>
+ </div>
+ </file>
+ </example>
+ *
+ * The predicate and reverse parameters can be controlled dynamically through scope properties,
+ * as shown in the next example.
+ * @example
+ <example module="orderByExample">
+ <file name="index.html">
+ <script>
+ angular.module('orderByExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.friends =
+ [{name:'John', phone:'555-1212', age:10},
+ {name:'Mary', phone:'555-9876', age:19},
+ {name:'Mike', phone:'555-4321', age:21},
+ {name:'Adam', phone:'555-5678', age:35},
+ {name:'Julie', phone:'555-8765', age:29}];
+ $scope.predicate = 'age';
+ $scope.reverse = true;
+ $scope.order = function(predicate) {
+ $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
+ $scope.predicate = predicate;
+ };
+ }]);
+ </script>
+ <style type="text/css">
+ .sortorder:after {
+ content: '\25b2';
+ }
+ .sortorder.reverse:after {
+ content: '\25bc';
+ }
+ </style>
+ <div ng-controller="ExampleController">
+ <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
+ <hr/>
+ [ <a href="" ng-click="predicate=''">unsorted</a> ]
+ <table class="friend">
+ <tr>
+ <th>
+ <a href="" ng-click="order('name')">Name</a>
+ <span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
+ </th>
+ <th>
+ <a href="" ng-click="order('phone')">Phone Number</a>
+ <span class="sortorder" ng-show="predicate === 'phone'" ng-class="{reverse:reverse}"></span>
+ </th>
+ <th>
+ <a href="" ng-click="order('age')">Age</a>
+ <span class="sortorder" ng-show="predicate === 'age'" ng-class="{reverse:reverse}"></span>
+ </th>
+ </tr>
+ <tr ng-repeat="friend in friends | orderBy:predicate:reverse">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ <td>{{friend.age}}</td>
+ </tr>
+ </table>
+ </div>
+ </file>
+ </example>
+ *
+ * It's also possible to call the orderBy filter manually, by injecting `$filter`, retrieving the
+ * filter routine with `$filter('orderBy')`, and calling the returned filter routine with the
+ * desired parameters.
+ *
+ * Example:
+ *
+ * @example
+ <example module="orderByExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <table class="friend">
+ <tr>
+ <th><a href="" ng-click="reverse=false;order('name', false)">Name</a>
+ (<a href="" ng-click="order('-name',false)">^</a>)</th>
+ <th><a href="" ng-click="reverse=!reverse;order('phone', reverse)">Phone Number</a></th>
+ <th><a href="" ng-click="reverse=!reverse;order('age',reverse)">Age</a></th>
+ </tr>
+ <tr ng-repeat="friend in friends">
+ <td>{{friend.name}}</td>
+ <td>{{friend.phone}}</td>
+ <td>{{friend.age}}</td>
+ </tr>
+ </table>
+ </div>
+ </file>
+
+ <file name="script.js">
+ angular.module('orderByExample', [])
+ .controller('ExampleController', ['$scope', '$filter', function($scope, $filter) {
+ var orderBy = $filter('orderBy');
+ $scope.friends = [
+ { name: 'John', phone: '555-1212', age: 10 },
+ { name: 'Mary', phone: '555-9876', age: 19 },
+ { name: 'Mike', phone: '555-4321', age: 21 },
+ { name: 'Adam', phone: '555-5678', age: 35 },
+ { name: 'Julie', phone: '555-8765', age: 29 }
+ ];
+ $scope.order = function(predicate, reverse) {
+ $scope.friends = orderBy($scope.friends, predicate, reverse);
+ };
+ $scope.order('-age',false);
+ }]);
+ </file>
+</example>
+ */
+orderByFilter.$inject = ['$parse'];
+function orderByFilter($parse) {
+ return function(array, sortPredicate, reverseOrder) {
+
+ if (array == null) return array;
+ if (!isArrayLike(array)) {
+ throw minErr('orderBy')('notarray', 'Expected array but received: {0}', array);
+ }
+
+ if (!isArray(sortPredicate)) { sortPredicate = [sortPredicate]; }
+ if (sortPredicate.length === 0) { sortPredicate = ['+']; }
+
+ var predicates = processPredicates(sortPredicate, reverseOrder);
+ // Add a predicate at the end that evaluates to the element index. This makes the
+ // sort stable as it works as a tie-breaker when all the input predicates cannot
+ // distinguish between two elements.
+ predicates.push({ get: function() { return {}; }, descending: reverseOrder ? -1 : 1});
+
+ // The next three lines are a version of a Swartzian Transform idiom from Perl
+ // (sometimes called the Decorate-Sort-Undecorate idiom)
+ // See https://en.wikipedia.org/wiki/Schwartzian_transform
+ var compareValues = Array.prototype.map.call(array, getComparisonObject);
+ compareValues.sort(doComparison);
+ array = compareValues.map(function(item) { return item.value; });
+
+ return array;
+
+ function getComparisonObject(value, index) {
+ return {
+ value: value,
+ predicateValues: predicates.map(function(predicate) {
+ return getPredicateValue(predicate.get(value), index);
+ })
+ };
+ }
+
+ function doComparison(v1, v2) {
+ var result = 0;
+ for (var index=0, length = predicates.length; index < length; ++index) {
+ result = compare(v1.predicateValues[index], v2.predicateValues[index]) * predicates[index].descending;
+ if (result) break;
+ }
+ return result;
+ }
+ };
+
+ function processPredicates(sortPredicate, reverseOrder) {
+ reverseOrder = reverseOrder ? -1 : 1;
+ return sortPredicate.map(function(predicate) {
+ var descending = 1, get = identity;
+
+ if (isFunction(predicate)) {
+ get = predicate;
+ } else if (isString(predicate)) {
+ if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {
+ descending = predicate.charAt(0) == '-' ? -1 : 1;
+ predicate = predicate.substring(1);
+ }
+ if (predicate !== '') {
+ get = $parse(predicate);
+ if (get.constant) {
+ var key = get();
+ get = function(value) { return value[key]; };
+ }
+ }
+ }
+ return { get: get, descending: descending * reverseOrder };
+ });
+ }
+
+ function isPrimitive(value) {
+ switch (typeof value) {
+ case 'number': /* falls through */
+ case 'boolean': /* falls through */
+ case 'string':
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ function objectValue(value, index) {
+ // If `valueOf` is a valid function use that
+ if (typeof value.valueOf === 'function') {
+ value = value.valueOf();
+ if (isPrimitive(value)) return value;
+ }
+ // If `toString` is a valid function and not the one from `Object.prototype` use that
+ if (hasCustomToString(value)) {
+ value = value.toString();
+ if (isPrimitive(value)) return value;
+ }
+ // We have a basic object so we use the position of the object in the collection
+ return index;
+ }
+
+ function getPredicateValue(value, index) {
+ var type = typeof value;
+ if (value === null) {
+ type = 'string';
+ value = 'null';
+ } else if (type === 'string') {
+ value = value.toLowerCase();
+ } else if (type === 'object') {
+ value = objectValue(value, index);
+ }
+ return { value: value, type: type };
+ }
+
+ function compare(v1, v2) {
+ var result = 0;
+ if (v1.type === v2.type) {
+ if (v1.value !== v2.value) {
+ result = v1.value < v2.value ? -1 : 1;
+ }
+ } else {
+ result = v1.type < v2.type ? -1 : 1;
+ }
+ return result;
+ }
+}
+
+function ngDirective(directive) {
+ if (isFunction(directive)) {
+ directive = {
+ link: directive
+ };
+ }
+ directive.restrict = directive.restrict || 'AC';
+ return valueFn(directive);
+}
+
+/**
+ * @ngdoc directive
+ * @name a
+ * @restrict E
+ *
+ * @description
+ * Modifies the default behavior of the html A tag so that the default action is prevented when
+ * the href attribute is empty.
+ *
+ * This change permits the easy creation of action links with the `ngClick` directive
+ * without changing the location or causing page reloads, e.g.:
+ * `<a href="" ng-click="list.addItem()">Add Item</a>`
+ */
+var htmlAnchorDirective = valueFn({
+ restrict: 'E',
+ compile: function(element, attr) {
+ if (!attr.href && !attr.xlinkHref) {
+ return function(scope, element) {
+ // If the linked element is not an anchor tag anymore, do nothing
+ if (element[0].nodeName.toLowerCase() !== 'a') return;
+
+ // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.
+ var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?
+ 'xlink:href' : 'href';
+ element.on('click', function(event) {
+ // if we have no href url, then don't navigate anywhere.
+ if (!element.attr(href)) {
+ event.preventDefault();
+ }
+ });
+ };
+ }
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngHref
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in an href attribute will
+ * make the link go to the wrong URL if the user clicks it before
+ * Angular has a chance to replace the `{{hash}}` markup with its
+ * value. Until Angular replaces the markup the link will be broken
+ * and will most likely return a 404 error. The `ngHref` directive
+ * solves this problem.
+ *
+ * The wrong way to write it:
+ * ```html
+ * <a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
+ * ```
+ *
+ * @element A
+ * @param {template} ngHref any string which can contain `{{}}` markup.
+ *
+ * @example
+ * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes
+ * in links and their different behaviors:
+ <example>
+ <file name="index.html">
+ <input ng-model="value" /><br />
+ <a id="link-1" href ng-click="value = 1">link 1</a> (link, don't reload)<br />
+ <a id="link-2" href="" ng-click="value = 2">link 2</a> (link, don't reload)<br />
+ <a id="link-3" ng-href="/{{'123'}}">link 3</a> (link, reload!)<br />
+ <a id="link-4" href="" name="xx" ng-click="value = 4">anchor</a> (link, don't reload)<br />
+ <a id="link-5" name="xxx" ng-click="value = 5">anchor</a> (no link)<br />
+ <a id="link-6" ng-href="{{value}}">link</a> (link, change location)
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should execute ng-click but not reload when href without value', function() {
+ element(by.id('link-1')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('1');
+ expect(element(by.id('link-1')).getAttribute('href')).toBe('');
+ });
+
+ it('should execute ng-click but not reload when href empty string', function() {
+ element(by.id('link-2')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('2');
+ expect(element(by.id('link-2')).getAttribute('href')).toBe('');
+ });
+
+ it('should execute ng-click and change url when ng-href specified', function() {
+ expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\/123$/);
+
+ element(by.id('link-3')).click();
+
+ // At this point, we navigate away from an Angular page, so we need
+ // to use browser.driver to get the base webdriver.
+
+ browser.wait(function() {
+ return browser.driver.getCurrentUrl().then(function(url) {
+ return url.match(/\/123$/);
+ });
+ }, 5000, 'page should navigate to /123');
+ });
+
+ it('should execute ng-click but not reload when href empty string and name specified', function() {
+ element(by.id('link-4')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('4');
+ expect(element(by.id('link-4')).getAttribute('href')).toBe('');
+ });
+
+ it('should execute ng-click but not reload when no href but name specified', function() {
+ element(by.id('link-5')).click();
+ expect(element(by.model('value')).getAttribute('value')).toEqual('5');
+ expect(element(by.id('link-5')).getAttribute('href')).toBe(null);
+ });
+
+ it('should only change url when only ng-href', function() {
+ element(by.model('value')).clear();
+ element(by.model('value')).sendKeys('6');
+ expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\/6$/);
+
+ element(by.id('link-6')).click();
+
+ // At this point, we navigate away from an Angular page, so we need
+ // to use browser.driver to get the base webdriver.
+ browser.wait(function() {
+ return browser.driver.getCurrentUrl().then(function(url) {
+ return url.match(/\/6$/);
+ });
+ }, 5000, 'page should navigate to /6');
+ });
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngSrc
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in a `src` attribute doesn't
+ * work right: The browser will fetch from the URL with the literal
+ * text `{{hash}}` until Angular replaces the expression inside
+ * `{{hash}}`. The `ngSrc` directive solves this problem.
+ *
+ * The buggy way to write it:
+ * ```html
+ * <img src="http://www.gravatar.com/avatar/{{hash}}" alt="Description"/>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <img ng-src="http://www.gravatar.com/avatar/{{hash}}" alt="Description" />
+ * ```
+ *
+ * @element IMG
+ * @param {template} ngSrc any string which can contain `{{}}` markup.
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngSrcset
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't
+ * work right: The browser will fetch from the URL with the literal
+ * text `{{hash}}` until Angular replaces the expression inside
+ * `{{hash}}`. The `ngSrcset` directive solves this problem.
+ *
+ * The buggy way to write it:
+ * ```html
+ * <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description"/>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description" />
+ * ```
+ *
+ * @element IMG
+ * @param {template} ngSrcset any string which can contain `{{}}` markup.
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngDisabled
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * This directive sets the `disabled` attribute on the element if the
+ * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `disabled`
+ * attribute. The following example would make the button enabled on Chrome/Firefox
+ * but not on older IEs:
+ *
+ * ```html
+ * <!-- See below for an example of ng-disabled being used correctly -->
+ * <div ng-init="isDisabled = false">
+ * <button disabled="{{isDisabled}}">Disabled</button>
+ * </div>
+ * ```
+ *
+ * This is because the HTML specification does not require browsers to preserve the values of
+ * boolean attributes such as `disabled` (Their presence means true and their absence means false.)
+ * If we put an Angular interpolation expression into such an attribute then the
+ * binding information would be lost when the browser removes the attribute.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Click me to toggle: <input type="checkbox" ng-model="checked"></label><br/>
+ <button ng-model="button" ng-disabled="checked">Button</button>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should toggle button', function() {
+ expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();
+ element(by.model('checked')).click();
+ expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element INPUT
+ * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy,
+ * then the `disabled` attribute will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngChecked
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ * Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.
+ *
+ * Note that this directive should not be used together with {@link ngModel `ngModel`},
+ * as this can lead to unexpected behavior.
+ *
+ * ### Why do we need `ngChecked`?
+ *
+ * The HTML specification does not require browsers to preserve the values of boolean attributes
+ * such as checked. (Their presence means true and their absence means false.)
+ * If we put an Angular interpolation expression into such an attribute then the
+ * binding information would be lost when the browser removes the attribute.
+ * The `ngChecked` directive solves this problem for the `checked` attribute.
+ * This complementary directive is not removed by the browser and so provides
+ * a permanent reliable place to store the binding information.
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Check me to check both: <input type="checkbox" ng-model="master"></label><br/>
+ <input id="checkSlave" type="checkbox" ng-checked="master" aria-label="Slave input">
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check both checkBoxes', function() {
+ expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy();
+ element(by.model('master')).click();
+ expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element INPUT
+ * @param {expression} ngChecked If the {@link guide/expression expression} is truthy,
+ * then the `checked` attribute will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngReadonly
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ * The HTML specification does not require browsers to preserve the values of boolean attributes
+ * such as readonly. (Their presence means true and their absence means false.)
+ * If we put an Angular interpolation expression into such an attribute then the
+ * binding information would be lost when the browser removes the attribute.
+ * The `ngReadonly` directive solves this problem for the `readonly` attribute.
+ * This complementary directive is not removed by the browser and so provides
+ * a permanent reliable place to store the binding information.
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Check me to make text readonly: <input type="checkbox" ng-model="checked"></label><br/>
+ <input type="text" ng-readonly="checked" value="I'm Angular" aria-label="Readonly field" />
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should toggle readonly attr', function() {
+ expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeFalsy();
+ element(by.model('checked')).click();
+ expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element INPUT
+ * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy,
+ * then special attribute "readonly" will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngSelected
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ * The HTML specification does not require browsers to preserve the values of boolean attributes
+ * such as selected. (Their presence means true and their absence means false.)
+ * If we put an Angular interpolation expression into such an attribute then the
+ * binding information would be lost when the browser removes the attribute.
+ * The `ngSelected` directive solves this problem for the `selected` attribute.
+ * This complementary directive is not removed by the browser and so provides
+ * a permanent reliable place to store the binding information.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Check me to select: <input type="checkbox" ng-model="selected"></label><br/>
+ <select aria-label="ngSelected demo">
+ <option>Hello!</option>
+ <option id="greet" ng-selected="selected">Greetings!</option>
+ </select>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should select Greetings!', function() {
+ expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();
+ element(by.model('selected')).click();
+ expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element OPTION
+ * @param {expression} ngSelected If the {@link guide/expression expression} is truthy,
+ * then special attribute "selected" will be set on the element
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngOpen
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ * The HTML specification does not require browsers to preserve the values of boolean attributes
+ * such as open. (Their presence means true and their absence means false.)
+ * If we put an Angular interpolation expression into such an attribute then the
+ * binding information would be lost when the browser removes the attribute.
+ * The `ngOpen` directive solves this problem for the `open` attribute.
+ * This complementary directive is not removed by the browser and so provides
+ * a permanent reliable place to store the binding information.
+ * @example
+ <example>
+ <file name="index.html">
+ <label>Check me check multiple: <input type="checkbox" ng-model="open"></label><br/>
+ <details id="details" ng-open="open">
+ <summary>Show/Hide me</summary>
+ </details>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should toggle open', function() {
+ expect(element(by.id('details')).getAttribute('open')).toBeFalsy();
+ element(by.model('open')).click();
+ expect(element(by.id('details')).getAttribute('open')).toBeTruthy();
+ });
+ </file>
+ </example>
+ *
+ * @element DETAILS
+ * @param {expression} ngOpen If the {@link guide/expression expression} is truthy,
+ * then special attribute "open" will be set on the element
+ */
+
+var ngAttributeAliasDirectives = {};
+
+// boolean attrs are evaluated
+forEach(BOOLEAN_ATTR, function(propName, attrName) {
+ // binding to multiple is not supported
+ if (propName == "multiple") return;
+
+ function defaultLinkFn(scope, element, attr) {
+ scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
+ attr.$set(attrName, !!value);
+ });
+ }
+
+ var normalized = directiveNormalize('ng-' + attrName);
+ var linkFn = defaultLinkFn;
+
+ if (propName === 'checked') {
+ linkFn = function(scope, element, attr) {
+ // ensuring ngChecked doesn't interfere with ngModel when both are set on the same input
+ if (attr.ngModel !== attr[normalized]) {
+ defaultLinkFn(scope, element, attr);
+ }
+ };
+ }
+
+ ngAttributeAliasDirectives[normalized] = function() {
+ return {
+ restrict: 'A',
+ priority: 100,
+ link: linkFn
+ };
+ };
+});
+
+// aliased input attrs are evaluated
+forEach(ALIASED_ATTR, function(htmlAttr, ngAttr) {
+ ngAttributeAliasDirectives[ngAttr] = function() {
+ return {
+ priority: 100,
+ link: function(scope, element, attr) {
+ //special case ngPattern when a literal regular expression value
+ //is used as the expression (this way we don't have to watch anything).
+ if (ngAttr === "ngPattern" && attr.ngPattern.charAt(0) == "/") {
+ var match = attr.ngPattern.match(REGEX_STRING_REGEXP);
+ if (match) {
+ attr.$set("ngPattern", new RegExp(match[1], match[2]));
+ return;
+ }
+ }
+
+ scope.$watch(attr[ngAttr], function ngAttrAliasWatchAction(value) {
+ attr.$set(ngAttr, value);
+ });
+ }
+ };
+ };
+});
+
+// ng-src, ng-srcset, ng-href are interpolated
+forEach(['src', 'srcset', 'href'], function(attrName) {
+ var normalized = directiveNormalize('ng-' + attrName);
+ ngAttributeAliasDirectives[normalized] = function() {
+ return {
+ priority: 99, // it needs to run after the attributes are interpolated
+ link: function(scope, element, attr) {
+ var propName = attrName,
+ name = attrName;
+
+ if (attrName === 'href' &&
+ toString.call(element.prop('href')) === '[object SVGAnimatedString]') {
+ name = 'xlinkHref';
+ attr.$attr[name] = 'xlink:href';
+ propName = null;
+ }
+
+ attr.$observe(normalized, function(value) {
+ if (!value) {
+ if (attrName === 'href') {
+ attr.$set(name, null);
+ }
+ return;
+ }
+
+ attr.$set(name, value);
+
+ // on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist
+ // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need
+ // to set the property as well to achieve the desired effect.
+ // we use attr[attrName] value since $set can sanitize the url.
+ if (msie && propName) element.prop(propName, attr[name]);
+ });
+ }
+ };
+ };
+});
+
+/* global -nullFormCtrl, -SUBMITTED_CLASS, addSetValidityMethod: true
+ */
+var nullFormCtrl = {
+ $addControl: noop,
+ $$renameControl: nullFormRenameControl,
+ $removeControl: noop,
+ $setValidity: noop,
+ $setDirty: noop,
+ $setPristine: noop,
+ $setSubmitted: noop
+},
+SUBMITTED_CLASS = 'ng-submitted';
+
+function nullFormRenameControl(control, name) {
+ control.$name = name;
+}
+
+/**
+ * @ngdoc type
+ * @name form.FormController
+ *
+ * @property {boolean} $pristine True if user has not interacted with the form yet.
+ * @property {boolean} $dirty True if user has already interacted with the form.
+ * @property {boolean} $valid True if all of the containing forms and controls are valid.
+ * @property {boolean} $invalid True if at least one containing control or form is invalid.
+ * @property {boolean} $pending True if at least one containing control or form is pending.
+ * @property {boolean} $submitted True if user has submitted the form even if its invalid.
+ *
+ * @property {Object} $error Is an object hash, containing references to controls or
+ * forms with failing validators, where:
+ *
+ * - keys are validation tokens (error names),
+ * - values are arrays of controls or forms that have a failing validator for given error name.
+ *
+ * Built-in validation tokens:
+ *
+ * - `email`
+ * - `max`
+ * - `maxlength`
+ * - `min`
+ * - `minlength`
+ * - `number`
+ * - `pattern`
+ * - `required`
+ * - `url`
+ * - `date`
+ * - `datetimelocal`
+ * - `time`
+ * - `week`
+ * - `month`
+ *
+ * @description
+ * `FormController` keeps track of all its controls and nested forms as well as the state of them,
+ * such as being valid/invalid or dirty/pristine.
+ *
+ * Each {@link ng.directive:form form} directive creates an instance
+ * of `FormController`.
+ *
+ */
+//asks for $scope to fool the BC controller module
+FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate'];
+function FormController(element, attrs, $scope, $animate, $interpolate) {
+ var form = this,
+ controls = [];
+
+ // init state
+ form.$error = {};
+ form.$$success = {};
+ form.$pending = undefined;
+ form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope);
+ form.$dirty = false;
+ form.$pristine = true;
+ form.$valid = true;
+ form.$invalid = false;
+ form.$submitted = false;
+ form.$$parentForm = nullFormCtrl;
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$rollbackViewValue
+ *
+ * @description
+ * Rollback all form controls pending updates to the `$modelValue`.
+ *
+ * Updates may be pending by a debounced event or because the input is waiting for a some future
+ * event defined in `ng-model-options`. This method is typically needed by the reset button of
+ * a form that uses `ng-model-options` to pend updates.
+ */
+ form.$rollbackViewValue = function() {
+ forEach(controls, function(control) {
+ control.$rollbackViewValue();
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$commitViewValue
+ *
+ * @description
+ * Commit all form controls pending updates to the `$modelValue`.
+ *
+ * Updates may be pending by a debounced event or because the input is waiting for a some future
+ * event defined in `ng-model-options`. This method is rarely needed as `NgModelController`
+ * usually handles calling this in response to input events.
+ */
+ form.$commitViewValue = function() {
+ forEach(controls, function(control) {
+ control.$commitViewValue();
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$addControl
+ * @param {object} control control object, either a {@link form.FormController} or an
+ * {@link ngModel.NgModelController}
+ *
+ * @description
+ * Register a control with the form. Input elements using ngModelController do this automatically
+ * when they are linked.
+ *
+ * Note that the current state of the control will not be reflected on the new parent form. This
+ * is not an issue with normal use, as freshly compiled and linked controls are in a `$pristine`
+ * state.
+ *
+ * However, if the method is used programmatically, for example by adding dynamically created controls,
+ * or controls that have been previously removed without destroying their corresponding DOM element,
+ * it's the developers responsiblity to make sure the current state propagates to the parent form.
+ *
+ * For example, if an input control is added that is already `$dirty` and has `$error` properties,
+ * calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form.
+ */
+ form.$addControl = function(control) {
+ // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored
+ // and not added to the scope. Now we throw an error.
+ assertNotHasOwnProperty(control.$name, 'input');
+ controls.push(control);
+
+ if (control.$name) {
+ form[control.$name] = control;
+ }
+
+ control.$$parentForm = form;
+ };
+
+ // Private API: rename a form control
+ form.$$renameControl = function(control, newName) {
+ var oldName = control.$name;
+
+ if (form[oldName] === control) {
+ delete form[oldName];
+ }
+ form[newName] = control;
+ control.$name = newName;
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$removeControl
+ * @param {object} control control object, either a {@link form.FormController} or an
+ * {@link ngModel.NgModelController}
+ *
+ * @description
+ * Deregister a control from the form.
+ *
+ * Input elements using ngModelController do this automatically when they are destroyed.
+ *
+ * Note that only the removed control's validation state (`$errors`etc.) will be removed from the
+ * form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be
+ * different from case to case. For example, removing the only `$dirty` control from a form may or
+ * may not mean that the form is still `$dirty`.
+ */
+ form.$removeControl = function(control) {
+ if (control.$name && form[control.$name] === control) {
+ delete form[control.$name];
+ }
+ forEach(form.$pending, function(value, name) {
+ form.$setValidity(name, null, control);
+ });
+ forEach(form.$error, function(value, name) {
+ form.$setValidity(name, null, control);
+ });
+ forEach(form.$$success, function(value, name) {
+ form.$setValidity(name, null, control);
+ });
+
+ arrayRemove(controls, control);
+ control.$$parentForm = nullFormCtrl;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setValidity
+ *
+ * @description
+ * Sets the validity of a form control.
+ *
+ * This method will also propagate to parent forms.
+ */
+ addSetValidityMethod({
+ ctrl: this,
+ $element: element,
+ set: function(object, property, controller) {
+ var list = object[property];
+ if (!list) {
+ object[property] = [controller];
+ } else {
+ var index = list.indexOf(controller);
+ if (index === -1) {
+ list.push(controller);
+ }
+ }
+ },
+ unset: function(object, property, controller) {
+ var list = object[property];
+ if (!list) {
+ return;
+ }
+ arrayRemove(list, controller);
+ if (list.length === 0) {
+ delete object[property];
+ }
+ },
+ $animate: $animate
+ });
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setDirty
+ *
+ * @description
+ * Sets the form to a dirty state.
+ *
+ * This method can be called to add the 'ng-dirty' class and set the form to a dirty
+ * state (ng-dirty class). This method will also propagate to parent forms.
+ */
+ form.$setDirty = function() {
+ $animate.removeClass(element, PRISTINE_CLASS);
+ $animate.addClass(element, DIRTY_CLASS);
+ form.$dirty = true;
+ form.$pristine = false;
+ form.$$parentForm.$setDirty();
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setPristine
+ *
+ * @description
+ * Sets the form to its pristine state.
+ *
+ * This method can be called to remove the 'ng-dirty' class and set the form to its pristine
+ * state (ng-pristine class). This method will also propagate to all the controls contained
+ * in this form.
+ *
+ * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after
+ * saving or resetting it.
+ */
+ form.$setPristine = function() {
+ $animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS);
+ form.$dirty = false;
+ form.$pristine = true;
+ form.$submitted = false;
+ forEach(controls, function(control) {
+ control.$setPristine();
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setUntouched
+ *
+ * @description
+ * Sets the form to its untouched state.
+ *
+ * This method can be called to remove the 'ng-touched' class and set the form controls to their
+ * untouched state (ng-untouched class).
+ *
+ * Setting a form controls back to their untouched state is often useful when setting the form
+ * back to its pristine state.
+ */
+ form.$setUntouched = function() {
+ forEach(controls, function(control) {
+ control.$setUntouched();
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name form.FormController#$setSubmitted
+ *
+ * @description
+ * Sets the form to its submitted state.
+ */
+ form.$setSubmitted = function() {
+ $animate.addClass(element, SUBMITTED_CLASS);
+ form.$submitted = true;
+ form.$$parentForm.$setSubmitted();
+ };
+}
+
+/**
+ * @ngdoc directive
+ * @name ngForm
+ * @restrict EAC
+ *
+ * @description
+ * Nestable alias of {@link ng.directive:form `form`} directive. HTML
+ * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a
+ * sub-group of controls needs to be determined.
+ *
+ * Note: the purpose of `ngForm` is to group controls,
+ * but not to be a replacement for the `<form>` tag with all of its capabilities
+ * (e.g. posting to the server, ...).
+ *
+ * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into
+ * related scope, under this name.
+ *
+ */
+
+ /**
+ * @ngdoc directive
+ * @name form
+ * @restrict E
+ *
+ * @description
+ * Directive that instantiates
+ * {@link form.FormController FormController}.
+ *
+ * If the `name` attribute is specified, the form controller is published onto the current scope under
+ * this name.
+ *
+ * # Alias: {@link ng.directive:ngForm `ngForm`}
+ *
+ * In Angular, forms can be nested. This means that the outer form is valid when all of the child
+ * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so
+ * Angular provides the {@link ng.directive:ngForm `ngForm`} directive which behaves identically to
+ * `<form>` but can be nested. This allows you to have nested forms, which is very useful when
+ * using Angular validation directives in forms that are dynamically generated using the
+ * {@link ng.directive:ngRepeat `ngRepeat`} directive. Since you cannot dynamically generate the `name`
+ * attribute of input elements using interpolation, you have to wrap each set of repeated inputs in an
+ * `ngForm` directive and nest these in an outer `form` element.
+ *
+ *
+ * # CSS classes
+ * - `ng-valid` is set if the form is valid.
+ * - `ng-invalid` is set if the form is invalid.
+ * - `ng-pending` is set if the form is pending.
+ * - `ng-pristine` is set if the form is pristine.
+ * - `ng-dirty` is set if the form is dirty.
+ * - `ng-submitted` is set if the form was submitted.
+ *
+ * Keep in mind that ngAnimate can detect each of these classes when added and removed.
+ *
+ *
+ * # Submitting a form and preventing the default action
+ *
+ * Since the role of forms in client-side Angular applications is different than in classical
+ * roundtrip apps, it is desirable for the browser not to translate the form submission into a full
+ * page reload that sends the data to the server. Instead some javascript logic should be triggered
+ * to handle the form submission in an application-specific way.
+ *
+ * For this reason, Angular prevents the default action (form submission to the server) unless the
+ * `<form>` element has an `action` attribute specified.
+ *
+ * You can use one of the following two ways to specify what javascript method should be called when
+ * a form is submitted:
+ *
+ * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element
+ * - {@link ng.directive:ngClick ngClick} directive on the first
+ * button or input field of type submit (input[type=submit])
+ *
+ * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}
+ * or {@link ng.directive:ngClick ngClick} directives.
+ * This is because of the following form submission rules in the HTML specification:
+ *
+ * - If a form has only one input field then hitting enter in this field triggers form submit
+ * (`ngSubmit`)
+ * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter
+ * doesn't trigger submit
+ * - if a form has one or more input fields and one or more buttons or input[type=submit] then
+ * hitting enter in any of the input fields will trigger the click handler on the *first* button or
+ * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)
+ *
+ * Any pending `ngModelOptions` changes will take place immediately when an enclosing form is
+ * submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`
+ * to have access to the updated model.
+ *
+ * ## Animation Hooks
+ *
+ * Animations in ngForm are triggered when any of the associated CSS classes are added and removed.
+ * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any
+ * other validations that are performed within the form. Animations in ngForm are similar to how
+ * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well
+ * as JS animations.
+ *
+ * The following example shows a simple way to utilize CSS transitions to style a form element
+ * that has been rendered as invalid after it has been validated:
+ *
+ * <pre>
+ * //be sure to include ngAnimate as a module to hook into more
+ * //advanced animations
+ * .my-form {
+ * transition:0.5s linear all;
+ * background: white;
+ * }
+ * .my-form.ng-invalid {
+ * background: red;
+ * color:white;
+ * }
+ * </pre>
+ *
+ * @example
+ <example deps="angular-animate.js" animations="true" fixBase="true" module="formExample">
+ <file name="index.html">
+ <script>
+ angular.module('formExample', [])
+ .controller('FormController', ['$scope', function($scope) {
+ $scope.userType = 'guest';
+ }]);
+ </script>
+ <style>
+ .my-form {
+ transition:all linear 0.5s;
+ background: transparent;
+ }
+ .my-form.ng-invalid {
+ background: red;
+ }
+ </style>
+ <form name="myForm" ng-controller="FormController" class="my-form">
+ userType: <input name="input" ng-model="userType" required>
+ <span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
+ <code>userType = {{userType}}</code><br>
+ <code>myForm.input.$valid = {{myForm.input.$valid}}</code><br>
+ <code>myForm.input.$error = {{myForm.input.$error}}</code><br>
+ <code>myForm.$valid = {{myForm.$valid}}</code><br>
+ <code>myForm.$error.required = {{!!myForm.$error.required}}</code><br>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should initialize to model', function() {
+ var userType = element(by.binding('userType'));
+ var valid = element(by.binding('myForm.input.$valid'));
+
+ expect(userType.getText()).toContain('guest');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ var userType = element(by.binding('userType'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var userInput = element(by.model('userType'));
+
+ userInput.clear();
+ userInput.sendKeys('');
+
+ expect(userType.getText()).toEqual('userType =');
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ *
+ * @param {string=} name Name of the form. If specified, the form controller will be published into
+ * related scope, under this name.
+ */
+var formDirectiveFactory = function(isNgForm) {
+ return ['$timeout', '$parse', function($timeout, $parse) {
+ var formDirective = {
+ name: 'form',
+ restrict: isNgForm ? 'EAC' : 'E',
+ require: ['form', '^^?form'], //first is the form's own ctrl, second is an optional parent form
+ controller: FormController,
+ compile: function ngFormCompile(formElement, attr) {
+ // Setup initial state of the control
+ formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS);
+
+ var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false);
+
+ return {
+ pre: function ngFormPreLink(scope, formElement, attr, ctrls) {
+ var controller = ctrls[0];
+
+ // if `action` attr is not present on the form, prevent the default action (submission)
+ if (!('action' in attr)) {
+ // we can't use jq events because if a form is destroyed during submission the default
+ // action is not prevented. see #1238
+ //
+ // IE 9 is not affected because it doesn't fire a submit event and try to do a full
+ // page reload if the form was destroyed by submission of the form via a click handler
+ // on a button in the form. Looks like an IE9 specific bug.
+ var handleFormSubmission = function(event) {
+ scope.$apply(function() {
+ controller.$commitViewValue();
+ controller.$setSubmitted();
+ });
+
+ event.preventDefault();
+ };
+
+ addEventListenerFn(formElement[0], 'submit', handleFormSubmission);
+
+ // unregister the preventDefault listener so that we don't not leak memory but in a
+ // way that will achieve the prevention of the default action.
+ formElement.on('$destroy', function() {
+ $timeout(function() {
+ removeEventListenerFn(formElement[0], 'submit', handleFormSubmission);
+ }, 0, false);
+ });
+ }
+
+ var parentFormCtrl = ctrls[1] || controller.$$parentForm;
+ parentFormCtrl.$addControl(controller);
+
+ var setter = nameAttr ? getSetter(controller.$name) : noop;
+
+ if (nameAttr) {
+ setter(scope, controller);
+ attr.$observe(nameAttr, function(newValue) {
+ if (controller.$name === newValue) return;
+ setter(scope, undefined);
+ controller.$$parentForm.$$renameControl(controller, newValue);
+ setter = getSetter(controller.$name);
+ setter(scope, controller);
+ });
+ }
+ formElement.on('$destroy', function() {
+ controller.$$parentForm.$removeControl(controller);
+ setter(scope, undefined);
+ extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
+ });
+ }
+ };
+ }
+ };
+
+ return formDirective;
+
+ function getSetter(expression) {
+ if (expression === '') {
+ //create an assignable expression, so forms with an empty name can be renamed later
+ return $parse('this[""]').assign;
+ }
+ return $parse(expression).assign || noop;
+ }
+ }];
+};
+
+var formDirective = formDirectiveFactory();
+var ngFormDirective = formDirectiveFactory(true);
+
+/* global VALID_CLASS: false,
+ INVALID_CLASS: false,
+ PRISTINE_CLASS: false,
+ DIRTY_CLASS: false,
+ UNTOUCHED_CLASS: false,
+ TOUCHED_CLASS: false,
+ ngModelMinErr: false,
+*/
+
+// Regex code is obtained from SO: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231
+var ISO_DATE_REGEXP = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/;
+// See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987)
+var URL_REGEXP = /^[A-Za-z][A-Za-z\d.+-]*:\/*(?:\w+(?::\w+)?@)?[^\s/]+(?::\d+)?(?:\/[\w#!:.?+=&%@\-/]*)?$/;
+var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
+var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/;
+var DATE_REGEXP = /^(\d{4})-(\d{2})-(\d{2})$/;
+var DATETIMELOCAL_REGEXP = /^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/;
+var WEEK_REGEXP = /^(\d{4})-W(\d\d)$/;
+var MONTH_REGEXP = /^(\d{4})-(\d\d)$/;
+var TIME_REGEXP = /^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/;
+
+var inputType = {
+
+ /**
+ * @ngdoc input
+ * @name input[text]
+ *
+ * @description
+ * Standard HTML text input with angular data binding, inherited by most of the `input` elements.
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Adds `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+ * any length.
+ * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+ * that contains the regular expression body that will be converted to a regular expression
+ * as in the ngPattern directive.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match
+ * a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ * This parameter is ignored for input[type=password] controls, which will never trim the
+ * input.
+ *
+ * @example
+ <example name="text-input-directive" module="textInputExample">
+ <file name="index.html">
+ <script>
+ angular.module('textInputExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.example = {
+ text: 'guest',
+ word: /^\s*\w*\s*$/
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>Single word:
+ <input type="text" name="input" ng-model="example.text"
+ ng-pattern="example.word" required ng-trim="false">
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.pattern">
+ Single word only!</span>
+ </div>
+ <tt>text = {{example.text}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var text = element(by.binding('example.text'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.text'));
+
+ it('should initialize to model', function() {
+ expect(text.getText()).toContain('guest');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+
+ expect(text.getText()).toEqual('text =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if multi word', function() {
+ input.clear();
+ input.sendKeys('hello world');
+
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'text': textInputType,
+
+ /**
+ * @ngdoc input
+ * @name input[date]
+ *
+ * @description
+ * Input with date validation and transformation. In browsers that do not yet support
+ * the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601
+ * date format (yyyy-MM-dd), for example: `2009-01-06`. Since many
+ * modern browsers do not yet support this input type, it is important to provide cues to users on the
+ * expected input format via a placeholder or label.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a
+ * valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute
+ * (e.g. `min="{{minDate | date:'yyyy-MM-dd'}}"`). Note that `min` will also add native HTML5
+ * constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be
+ * a valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute
+ * (e.g. `max="{{maxDate | date:'yyyy-MM-dd'}}"`). Note that `max` will also add native HTML5
+ * constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO date string
+ * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO date string
+ * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="date-input-directive" module="dateInputExample">
+ <file name="index.html">
+ <script>
+ angular.module('dateInputExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(2013, 9, 22)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label for="exampleInput">Pick a date in 2013:</label>
+ <input type="date" id="exampleInput" name="input" ng-model="example.value"
+ placeholder="yyyy-MM-dd" min="2013-01-01" max="2013-12-31" required />
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.date">
+ Not a valid date!</span>
+ </div>
+ <tt>value = {{example.value | date: "yyyy-MM-dd"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "yyyy-MM-dd"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (see https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('2013-10-22');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('2015-01-01');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'date': createDateInputType('date', DATE_REGEXP,
+ createDateParser(DATE_REGEXP, ['yyyy', 'MM', 'dd']),
+ 'yyyy-MM-dd'),
+
+ /**
+ * @ngdoc input
+ * @name input[datetime-local]
+ *
+ * @description
+ * Input with datetime validation and transformation. In browsers that do not yet support
+ * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+ * local datetime format (yyyy-MM-ddTHH:mm:ss), for example: `2010-12-28T14:57:00`.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation
+ * inside this attribute (e.g. `min="{{minDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`).
+ * Note that `min` will also add native HTML5 constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation
+ * inside this attribute (e.g. `max="{{maxDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`).
+ * Note that `max` will also add native HTML5 constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation error key to the Date / ISO datetime string
+ * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation error key to the Date / ISO datetime string
+ * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="datetimelocal-input-directive" module="dateExample">
+ <file name="index.html">
+ <script>
+ angular.module('dateExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(2010, 11, 28, 14, 57)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label for="exampleInput">Pick a date between in 2013:</label>
+ <input type="datetime-local" id="exampleInput" name="input" ng-model="example.value"
+ placeholder="yyyy-MM-ddTHH:mm:ss" min="2001-01-01T00:00:00" max="2013-12-31T00:00:00" required />
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.datetimelocal">
+ Not a valid date!</span>
+ </div>
+ <tt>value = {{example.value | date: "yyyy-MM-ddTHH:mm:ss"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "yyyy-MM-ddTHH:mm:ss"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('2010-12-28T14:57:00');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('2015-01-01T23:59:00');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'datetime-local': createDateInputType('datetimelocal', DATETIMELOCAL_REGEXP,
+ createDateParser(DATETIMELOCAL_REGEXP, ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss', 'sss']),
+ 'yyyy-MM-ddTHH:mm:ss.sss'),
+
+ /**
+ * @ngdoc input
+ * @name input[time]
+ *
+ * @description
+ * Input with time validation and transformation. In browsers that do not yet support
+ * the HTML5 time input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+ * local time format (HH:mm:ss), for example: `14:57:00`. Model must be a Date object. This binding will always output a
+ * Date object to the model of January 1, 1970, or local date `new Date(1970, 0, 1, HH, mm, ss)`.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this
+ * attribute (e.g. `min="{{minTime | date:'HH:mm:ss'}}"`). Note that `min` will also add
+ * native HTML5 constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this
+ * attribute (e.g. `max="{{maxTime | date:'HH:mm:ss'}}"`). Note that `max` will also add
+ * native HTML5 constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO time string the
+ * `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO time string the
+ * `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="time-input-directive" module="timeExample">
+ <file name="index.html">
+ <script>
+ angular.module('timeExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(1970, 0, 1, 14, 57, 0)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label for="exampleInput">Pick a between 8am and 5pm:</label>
+ <input type="time" id="exampleInput" name="input" ng-model="example.value"
+ placeholder="HH:mm:ss" min="08:00:00" max="17:00:00" required />
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.time">
+ Not a valid date!</span>
+ </div>
+ <tt>value = {{example.value | date: "HH:mm:ss"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "HH:mm:ss"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('14:57:00');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('23:59:00');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'time': createDateInputType('time', TIME_REGEXP,
+ createDateParser(TIME_REGEXP, ['HH', 'mm', 'ss', 'sss']),
+ 'HH:mm:ss.sss'),
+
+ /**
+ * @ngdoc input
+ * @name input[week]
+ *
+ * @description
+ * Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support
+ * the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+ * week format (yyyy-W##), for example: `2013-W02`.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this
+ * attribute (e.g. `min="{{minWeek | date:'yyyy-Www'}}"`). Note that `min` will also add
+ * native HTML5 constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this
+ * attribute (e.g. `max="{{maxWeek | date:'yyyy-Www'}}"`). Note that `max` will also add
+ * native HTML5 constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string
+ * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string
+ * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="week-input-directive" module="weekExample">
+ <file name="index.html">
+ <script>
+ angular.module('weekExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(2013, 0, 3)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label>Pick a date between in 2013:
+ <input id="exampleInput" type="week" name="input" ng-model="example.value"
+ placeholder="YYYY-W##" min="2012-W32"
+ max="2013-W52" required />
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.week">
+ Not a valid date!</span>
+ </div>
+ <tt>value = {{example.value | date: "yyyy-Www"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "yyyy-Www"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('2013-W01');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('2015-W01');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'week': createDateInputType('week', WEEK_REGEXP, weekParser, 'yyyy-Www'),
+
+ /**
+ * @ngdoc input
+ * @name input[month]
+ *
+ * @description
+ * Input with month validation and transformation. In browsers that do not yet support
+ * the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+ * month format (yyyy-MM), for example: `2009-01`.
+ *
+ * The model must always be a Date object, otherwise Angular will throw an error.
+ * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+ * If the model is not set to the first of the month, the next view to model update will set it
+ * to the first of the month.
+ *
+ * The timezone to be used to read/write the `Date` instance in the model can be defined using
+ * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this
+ * attribute (e.g. `min="{{minMonth | date:'yyyy-MM'}}"`). Note that `min` will also add
+ * native HTML5 constraint validation.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this
+ * attribute (e.g. `max="{{maxMonth | date:'yyyy-MM'}}"`). Note that `max` will also add
+ * native HTML5 constraint validation.
+ * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string
+ * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+ * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string
+ * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="month-input-directive" module="monthExample">
+ <file name="index.html">
+ <script>
+ angular.module('monthExample', [])
+ .controller('DateController', ['$scope', function($scope) {
+ $scope.example = {
+ value: new Date(2013, 9, 1)
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="DateController as dateCtrl">
+ <label for="exampleInput">Pick a month in 2013:</label>
+ <input id="exampleInput" type="month" name="input" ng-model="example.value"
+ placeholder="yyyy-MM" min="2013-01" max="2013-12" required />
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.month">
+ Not a valid month!</span>
+ </div>
+ <tt>value = {{example.value | date: "yyyy-MM"}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value | date: "yyyy-MM"'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ // currently protractor/webdriver does not support
+ // sending keys to all known HTML5 input controls
+ // for various browsers (https://github.com/angular/protractor/issues/562).
+ function setInput(val) {
+ // set the value of the element and force validation.
+ var scr = "var ipt = document.getElementById('exampleInput'); " +
+ "ipt.value = '" + val + "';" +
+ "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+ browser.executeScript(scr);
+ }
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('2013-10');
+ expect(valid.getText()).toContain('myForm.input.$valid = true');
+ });
+
+ it('should be invalid if empty', function() {
+ setInput('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+
+ it('should be invalid if over max', function() {
+ setInput('2015-01');
+ expect(value.getText()).toContain('');
+ expect(valid.getText()).toContain('myForm.input.$valid = false');
+ });
+ </file>
+ </example>
+ */
+ 'month': createDateInputType('month', MONTH_REGEXP,
+ createDateParser(MONTH_REGEXP, ['yyyy', 'MM']),
+ 'yyyy-MM'),
+
+ /**
+ * @ngdoc input
+ * @name input[number]
+ *
+ * @description
+ * Text input with number validation and transformation. Sets the `number` validation
+ * error if not a valid number.
+ *
+ * <div class="alert alert-warning">
+ * The model must always be of type `number` otherwise Angular will throw an error.
+ * Be aware that a string containing a number is not enough. See the {@link ngModel:numfmt}
+ * error docs for more information and an example of how to convert your model if necessary.
+ * </div>
+ *
+ * ## Issues with HTML5 constraint validation
+ *
+ * In browsers that follow the
+ * [HTML5 specification](https://html.spec.whatwg.org/multipage/forms.html#number-state-%28type=number%29),
+ * `input[number]` does not work as expected with {@link ngModelOptions `ngModelOptions.allowInvalid`}.
+ * If a non-number is entered in the input, the browser will report the value as an empty string,
+ * which means the view / model values in `ngModel` and subsequently the scope value
+ * will also be an empty string.
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+ * any length.
+ * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+ * that contains the regular expression body that will be converted to a regular expression
+ * as in the ngPattern directive.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match
+ * a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="number-input-directive" module="numberExample">
+ <file name="index.html">
+ <script>
+ angular.module('numberExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.example = {
+ value: 12
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>Number:
+ <input type="number" name="input" ng-model="example.value"
+ min="0" max="99" required>
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.number">
+ Not valid number!</span>
+ </div>
+ <tt>value = {{example.value}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var value = element(by.binding('example.value'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('example.value'));
+
+ it('should initialize to model', function() {
+ expect(value.getText()).toContain('12');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if over max', function() {
+ input.clear();
+ input.sendKeys('123');
+ expect(value.getText()).toEqual('value =');
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'number': numberInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[url]
+ *
+ * @description
+ * Text input with URL validation. Sets the `url` validation error key if the content is not a
+ * valid URL.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** `input[url]` uses a regex to validate urls that is derived from the regex
+ * used in Chromium. If you need stricter validation, you can use `ng-pattern` or modify
+ * the built-in validators (see the {@link guide/forms Forms guide})
+ * </div>
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+ * any length.
+ * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+ * that contains the regular expression body that will be converted to a regular expression
+ * as in the ngPattern directive.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match
+ * a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="url-input-directive" module="urlExample">
+ <file name="index.html">
+ <script>
+ angular.module('urlExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.url = {
+ text: 'http://google.com'
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>URL:
+ <input type="url" name="input" ng-model="url.text" required>
+ <label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.url">
+ Not valid url!</span>
+ </div>
+ <tt>text = {{url.text}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var text = element(by.binding('url.text'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('url.text'));
+
+ it('should initialize to model', function() {
+ expect(text.getText()).toContain('http://google.com');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+
+ expect(text.getText()).toEqual('text =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if not url', function() {
+ input.clear();
+ input.sendKeys('box');
+
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'url': urlInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[email]
+ *
+ * @description
+ * Text input with email validation. Sets the `email` validation error key if not a valid email
+ * address.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex
+ * used in Chromium. If you need stricter validation (e.g. requiring a top-level domain), you can
+ * use `ng-pattern` or modify the built-in validators (see the {@link guide/forms Forms guide})
+ * </div>
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+ * any length.
+ * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+ * that contains the regular expression body that will be converted to a regular expression
+ * as in the ngPattern directive.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match
+ * a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="email-input-directive" module="emailExample">
+ <file name="index.html">
+ <script>
+ angular.module('emailExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.email = {
+ text: 'me@example.com'
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>Email:
+ <input type="email" name="input" ng-model="email.text" required>
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.input.$error.required">
+ Required!</span>
+ <span class="error" ng-show="myForm.input.$error.email">
+ Not valid email!</span>
+ </div>
+ <tt>text = {{email.text}}</tt><br/>
+ <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+ <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var text = element(by.binding('email.text'));
+ var valid = element(by.binding('myForm.input.$valid'));
+ var input = element(by.model('email.text'));
+
+ it('should initialize to model', function() {
+ expect(text.getText()).toContain('me@example.com');
+ expect(valid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty', function() {
+ input.clear();
+ input.sendKeys('');
+ expect(text.getText()).toEqual('text =');
+ expect(valid.getText()).toContain('false');
+ });
+
+ it('should be invalid if not email', function() {
+ input.clear();
+ input.sendKeys('xxx');
+
+ expect(valid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+ 'email': emailInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[radio]
+ *
+ * @description
+ * HTML radio button.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string} value The value to which the `ngModel` expression should be set when selected.
+ * Note that `value` only supports `string` values, i.e. the scope model needs to be a string,
+ * too. Use `ngValue` if you need complex models (`number`, `object`, ...).
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {string} ngValue Angular expression to which `ngModel` will be be set when the radio
+ * is selected. Should be used instead of the `value` attribute if you need
+ * a non-string `ngModel` (`boolean`, `array`, ...).
+ *
+ * @example
+ <example name="radio-input-directive" module="radioExample">
+ <file name="index.html">
+ <script>
+ angular.module('radioExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.color = {
+ name: 'blue'
+ };
+ $scope.specialValue = {
+ "id": "12345",
+ "value": "green"
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>
+ <input type="radio" ng-model="color.name" value="red">
+ Red
+ </label><br/>
+ <label>
+ <input type="radio" ng-model="color.name" ng-value="specialValue">
+ Green
+ </label><br/>
+ <label>
+ <input type="radio" ng-model="color.name" value="blue">
+ Blue
+ </label><br/>
+ <tt>color = {{color.name | json}}</tt><br/>
+ </form>
+ Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`.
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should change state', function() {
+ var color = element(by.binding('color.name'));
+
+ expect(color.getText()).toContain('blue');
+
+ element.all(by.model('color.name')).get(0).click();
+
+ expect(color.getText()).toContain('red');
+ });
+ </file>
+ </example>
+ */
+ 'radio': radioInputType,
+
+
+ /**
+ * @ngdoc input
+ * @name input[checkbox]
+ *
+ * @description
+ * HTML checkbox.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {expression=} ngTrueValue The value to which the expression should be set when selected.
+ * @param {expression=} ngFalseValue The value to which the expression should be set when not selected.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ *
+ * @example
+ <example name="checkbox-input-directive" module="checkboxExample">
+ <file name="index.html">
+ <script>
+ angular.module('checkboxExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.checkboxModel = {
+ value1 : true,
+ value2 : 'YES'
+ };
+ }]);
+ </script>
+ <form name="myForm" ng-controller="ExampleController">
+ <label>Value1:
+ <input type="checkbox" ng-model="checkboxModel.value1">
+ </label><br/>
+ <label>Value2:
+ <input type="checkbox" ng-model="checkboxModel.value2"
+ ng-true-value="'YES'" ng-false-value="'NO'">
+ </label><br/>
+ <tt>value1 = {{checkboxModel.value1}}</tt><br/>
+ <tt>value2 = {{checkboxModel.value2}}</tt><br/>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should change state', function() {
+ var value1 = element(by.binding('checkboxModel.value1'));
+ var value2 = element(by.binding('checkboxModel.value2'));
+
+ expect(value1.getText()).toContain('true');
+ expect(value2.getText()).toContain('YES');
+
+ element(by.model('checkboxModel.value1')).click();
+ element(by.model('checkboxModel.value2')).click();
+
+ expect(value1.getText()).toContain('false');
+ expect(value2.getText()).toContain('NO');
+ });
+ </file>
+ </example>
+ */
+ 'checkbox': checkboxInputType,
+
+ 'hidden': noop,
+ 'button': noop,
+ 'submit': noop,
+ 'reset': noop,
+ 'file': noop
+};
+
+function stringBasedInputType(ctrl) {
+ ctrl.$formatters.push(function(value) {
+ return ctrl.$isEmpty(value) ? value : value.toString();
+ });
+}
+
+function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+ stringBasedInputType(ctrl);
+}
+
+function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ var type = lowercase(element[0].type);
+
+ // In composition mode, users are still inputing intermediate text buffer,
+ // hold the listener until composition is done.
+ // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent
+ if (!$sniffer.android) {
+ var composing = false;
+
+ element.on('compositionstart', function(data) {
+ composing = true;
+ });
+
+ element.on('compositionend', function() {
+ composing = false;
+ listener();
+ });
+ }
+
+ var listener = function(ev) {
+ if (timeout) {
+ $browser.defer.cancel(timeout);
+ timeout = null;
+ }
+ if (composing) return;
+ var value = element.val(),
+ event = ev && ev.type;
+
+ // By default we will trim the value
+ // If the attribute ng-trim exists we will avoid trimming
+ // If input type is 'password', the value is never trimmed
+ if (type !== 'password' && (!attr.ngTrim || attr.ngTrim !== 'false')) {
+ value = trim(value);
+ }
+
+ // If a control is suffering from bad input (due to native validators), browsers discard its
+ // value, so it may be necessary to revalidate (by calling $setViewValue again) even if the
+ // control's value is the same empty value twice in a row.
+ if (ctrl.$viewValue !== value || (value === '' && ctrl.$$hasNativeValidators)) {
+ ctrl.$setViewValue(value, event);
+ }
+ };
+
+ // if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the
+ // input event on backspace, delete or cut
+ if ($sniffer.hasEvent('input')) {
+ element.on('input', listener);
+ } else {
+ var timeout;
+
+ var deferListener = function(ev, input, origValue) {
+ if (!timeout) {
+ timeout = $browser.defer(function() {
+ timeout = null;
+ if (!input || input.value !== origValue) {
+ listener(ev);
+ }
+ });
+ }
+ };
+
+ element.on('keydown', function(event) {
+ var key = event.keyCode;
+
+ // ignore
+ // command modifiers arrows
+ if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;
+
+ deferListener(event, this, this.value);
+ });
+
+ // if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it
+ if ($sniffer.hasEvent('paste')) {
+ element.on('paste cut', deferListener);
+ }
+ }
+
+ // if user paste into input using mouse on older browser
+ // or form autocomplete on newer browser, we need "change" event to catch it
+ element.on('change', listener);
+
+ ctrl.$render = function() {
+ // Workaround for Firefox validation #12102.
+ var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue;
+ if (element.val() !== value) {
+ element.val(value);
+ }
+ };
+}
+
+function weekParser(isoWeek, existingDate) {
+ if (isDate(isoWeek)) {
+ return isoWeek;
+ }
+
+ if (isString(isoWeek)) {
+ WEEK_REGEXP.lastIndex = 0;
+ var parts = WEEK_REGEXP.exec(isoWeek);
+ if (parts) {
+ var year = +parts[1],
+ week = +parts[2],
+ hours = 0,
+ minutes = 0,
+ seconds = 0,
+ milliseconds = 0,
+ firstThurs = getFirstThursdayOfYear(year),
+ addDays = (week - 1) * 7;
+
+ if (existingDate) {
+ hours = existingDate.getHours();
+ minutes = existingDate.getMinutes();
+ seconds = existingDate.getSeconds();
+ milliseconds = existingDate.getMilliseconds();
+ }
+
+ return new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds);
+ }
+ }
+
+ return NaN;
+}
+
+function createDateParser(regexp, mapping) {
+ return function(iso, date) {
+ var parts, map;
+
+ if (isDate(iso)) {
+ return iso;
+ }
+
+ if (isString(iso)) {
+ // When a date is JSON'ified to wraps itself inside of an extra
+ // set of double quotes. This makes the date parsing code unable
+ // to match the date string and parse it as a date.
+ if (iso.charAt(0) == '"' && iso.charAt(iso.length - 1) == '"') {
+ iso = iso.substring(1, iso.length - 1);
+ }
+ if (ISO_DATE_REGEXP.test(iso)) {
+ return new Date(iso);
+ }
+ regexp.lastIndex = 0;
+ parts = regexp.exec(iso);
+
+ if (parts) {
+ parts.shift();
+ if (date) {
+ map = {
+ yyyy: date.getFullYear(),
+ MM: date.getMonth() + 1,
+ dd: date.getDate(),
+ HH: date.getHours(),
+ mm: date.getMinutes(),
+ ss: date.getSeconds(),
+ sss: date.getMilliseconds() / 1000
+ };
+ } else {
+ map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 };
+ }
+
+ forEach(parts, function(part, index) {
+ if (index < mapping.length) {
+ map[mapping[index]] = +part;
+ }
+ });
+ return new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, map.sss * 1000 || 0);
+ }
+ }
+
+ return NaN;
+ };
+}
+
+function createDateInputType(type, regexp, parseDate, format) {
+ return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter) {
+ badInputChecker(scope, element, attr, ctrl);
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+ var timezone = ctrl && ctrl.$options && ctrl.$options.timezone;
+ var previousDate;
+
+ ctrl.$$parserName = type;
+ ctrl.$parsers.push(function(value) {
+ if (ctrl.$isEmpty(value)) return null;
+ if (regexp.test(value)) {
+ // Note: We cannot read ctrl.$modelValue, as there might be a different
+ // parser/formatter in the processing chain so that the model
+ // contains some different data format!
+ var parsedDate = parseDate(value, previousDate);
+ if (timezone) {
+ parsedDate = convertTimezoneToLocal(parsedDate, timezone);
+ }
+ return parsedDate;
+ }
+ return undefined;
+ });
+
+ ctrl.$formatters.push(function(value) {
+ if (value && !isDate(value)) {
+ throw ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value);
+ }
+ if (isValidDate(value)) {
+ previousDate = value;
+ if (previousDate && timezone) {
+ previousDate = convertTimezoneToLocal(previousDate, timezone, true);
+ }
+ return $filter('date')(value, format, timezone);
+ } else {
+ previousDate = null;
+ return '';
+ }
+ });
+
+ if (isDefined(attr.min) || attr.ngMin) {
+ var minVal;
+ ctrl.$validators.min = function(value) {
+ return !isValidDate(value) || isUndefined(minVal) || parseDate(value) >= minVal;
+ };
+ attr.$observe('min', function(val) {
+ minVal = parseObservedDateValue(val);
+ ctrl.$validate();
+ });
+ }
+
+ if (isDefined(attr.max) || attr.ngMax) {
+ var maxVal;
+ ctrl.$validators.max = function(value) {
+ return !isValidDate(value) || isUndefined(maxVal) || parseDate(value) <= maxVal;
+ };
+ attr.$observe('max', function(val) {
+ maxVal = parseObservedDateValue(val);
+ ctrl.$validate();
+ });
+ }
+
+ function isValidDate(value) {
+ // Invalid Date: getTime() returns NaN
+ return value && !(value.getTime && value.getTime() !== value.getTime());
+ }
+
+ function parseObservedDateValue(val) {
+ return isDefined(val) && !isDate(val) ? parseDate(val) || undefined : val;
+ }
+ };
+}
+
+function badInputChecker(scope, element, attr, ctrl) {
+ var node = element[0];
+ var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity);
+ if (nativeValidation) {
+ ctrl.$parsers.push(function(value) {
+ var validity = element.prop(VALIDITY_STATE_PROPERTY) || {};
+ return validity.badInput || validity.typeMismatch ? undefined : value;
+ });
+ }
+}
+
+function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ badInputChecker(scope, element, attr, ctrl);
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+
+ ctrl.$$parserName = 'number';
+ ctrl.$parsers.push(function(value) {
+ if (ctrl.$isEmpty(value)) return null;
+ if (NUMBER_REGEXP.test(value)) return parseFloat(value);
+ return undefined;
+ });
+
+ ctrl.$formatters.push(function(value) {
+ if (!ctrl.$isEmpty(value)) {
+ if (!isNumber(value)) {
+ throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);
+ }
+ value = value.toString();
+ }
+ return value;
+ });
+
+ if (isDefined(attr.min) || attr.ngMin) {
+ var minVal;
+ ctrl.$validators.min = function(value) {
+ return ctrl.$isEmpty(value) || isUndefined(minVal) || value >= minVal;
+ };
+
+ attr.$observe('min', function(val) {
+ if (isDefined(val) && !isNumber(val)) {
+ val = parseFloat(val, 10);
+ }
+ minVal = isNumber(val) && !isNaN(val) ? val : undefined;
+ // TODO(matsko): implement validateLater to reduce number of validations
+ ctrl.$validate();
+ });
+ }
+
+ if (isDefined(attr.max) || attr.ngMax) {
+ var maxVal;
+ ctrl.$validators.max = function(value) {
+ return ctrl.$isEmpty(value) || isUndefined(maxVal) || value <= maxVal;
+ };
+
+ attr.$observe('max', function(val) {
+ if (isDefined(val) && !isNumber(val)) {
+ val = parseFloat(val, 10);
+ }
+ maxVal = isNumber(val) && !isNaN(val) ? val : undefined;
+ // TODO(matsko): implement validateLater to reduce number of validations
+ ctrl.$validate();
+ });
+ }
+}
+
+function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ // Note: no badInputChecker here by purpose as `url` is only a validation
+ // in browsers, i.e. we can always read out input.value even if it is not valid!
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+ stringBasedInputType(ctrl);
+
+ ctrl.$$parserName = 'url';
+ ctrl.$validators.url = function(modelValue, viewValue) {
+ var value = modelValue || viewValue;
+ return ctrl.$isEmpty(value) || URL_REGEXP.test(value);
+ };
+}
+
+function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+ // Note: no badInputChecker here by purpose as `url` is only a validation
+ // in browsers, i.e. we can always read out input.value even if it is not valid!
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+ stringBasedInputType(ctrl);
+
+ ctrl.$$parserName = 'email';
+ ctrl.$validators.email = function(modelValue, viewValue) {
+ var value = modelValue || viewValue;
+ return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value);
+ };
+}
+
+function radioInputType(scope, element, attr, ctrl) {
+ // make the name unique, if not defined
+ if (isUndefined(attr.name)) {
+ element.attr('name', nextUid());
+ }
+
+ var listener = function(ev) {
+ if (element[0].checked) {
+ ctrl.$setViewValue(attr.value, ev && ev.type);
+ }
+ };
+
+ element.on('click', listener);
+
+ ctrl.$render = function() {
+ var value = attr.value;
+ element[0].checked = (value == ctrl.$viewValue);
+ };
+
+ attr.$observe('value', ctrl.$render);
+}
+
+function parseConstantExpr($parse, context, name, expression, fallback) {
+ var parseFn;
+ if (isDefined(expression)) {
+ parseFn = $parse(expression);
+ if (!parseFn.constant) {
+ throw ngModelMinErr('constexpr', 'Expected constant expression for `{0}`, but saw ' +
+ '`{1}`.', name, expression);
+ }
+ return parseFn(context);
+ }
+ return fallback;
+}
+
+function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
+ var trueValue = parseConstantExpr($parse, scope, 'ngTrueValue', attr.ngTrueValue, true);
+ var falseValue = parseConstantExpr($parse, scope, 'ngFalseValue', attr.ngFalseValue, false);
+
+ var listener = function(ev) {
+ ctrl.$setViewValue(element[0].checked, ev && ev.type);
+ };
+
+ element.on('click', listener);
+
+ ctrl.$render = function() {
+ element[0].checked = ctrl.$viewValue;
+ };
+
+ // Override the standard `$isEmpty` because the $viewValue of an empty checkbox is always set to `false`
+ // This is because of the parser below, which compares the `$modelValue` with `trueValue` to convert
+ // it to a boolean.
+ ctrl.$isEmpty = function(value) {
+ return value === false;
+ };
+
+ ctrl.$formatters.push(function(value) {
+ return equals(value, trueValue);
+ });
+
+ ctrl.$parsers.push(function(value) {
+ return value ? trueValue : falseValue;
+ });
+}
+
+
+/**
+ * @ngdoc directive
+ * @name textarea
+ * @restrict E
+ *
+ * @description
+ * HTML textarea element control with angular data-binding. The data-binding and validation
+ * properties of this element are exactly the same as those of the
+ * {@link ng.directive:input input element}.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any
+ * length.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match
+ * a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name input
+ * @restrict E
+ *
+ * @description
+ * HTML input element control. When used together with {@link ngModel `ngModel`}, it provides data-binding,
+ * input state control, and validation.
+ * Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Not every feature offered is available for all input types.
+ * Specifically, data binding and event handling via `ng-model` is unsupported for `input[file]`.
+ * </div>
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {boolean=} ngRequired Sets `required` attribute if set to true
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ * minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any
+ * length.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match
+ * a RegExp found by evaluating the Angular expression given in the attribute value.
+ * If the expression evaluates to a RegExp object, then this is used directly.
+ * If the expression evaluates to a string, then it will be converted to a RegExp
+ * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ * `new RegExp('^abc$')`.<br />
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ * interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ * This parameter is ignored for input[type=password] controls, which will never trim the
+ * input.
+ *
+ * @example
+ <example name="input-directive" module="inputExample">
+ <file name="index.html">
+ <script>
+ angular.module('inputExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.user = {name: 'guest', last: 'visitor'};
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <form name="myForm">
+ <label>
+ User name:
+ <input type="text" name="userName" ng-model="user.name" required>
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.userName.$error.required">
+ Required!</span>
+ </div>
+ <label>
+ Last name:
+ <input type="text" name="lastName" ng-model="user.last"
+ ng-minlength="3" ng-maxlength="10">
+ </label>
+ <div role="alert">
+ <span class="error" ng-show="myForm.lastName.$error.minlength">
+ Too short!</span>
+ <span class="error" ng-show="myForm.lastName.$error.maxlength">
+ Too long!</span>
+ </div>
+ </form>
+ <hr>
+ <tt>user = {{user}}</tt><br/>
+ <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br/>
+ <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br/>
+ <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br/>
+ <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br/>
+ <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br/>
+ <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br/>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var user = element(by.exactBinding('user'));
+ var userNameValid = element(by.binding('myForm.userName.$valid'));
+ var lastNameValid = element(by.binding('myForm.lastName.$valid'));
+ var lastNameError = element(by.binding('myForm.lastName.$error'));
+ var formValid = element(by.binding('myForm.$valid'));
+ var userNameInput = element(by.model('user.name'));
+ var userLastInput = element(by.model('user.last'));
+
+ it('should initialize to model', function() {
+ expect(user.getText()).toContain('{"name":"guest","last":"visitor"}');
+ expect(userNameValid.getText()).toContain('true');
+ expect(formValid.getText()).toContain('true');
+ });
+
+ it('should be invalid if empty when required', function() {
+ userNameInput.clear();
+ userNameInput.sendKeys('');
+
+ expect(user.getText()).toContain('{"last":"visitor"}');
+ expect(userNameValid.getText()).toContain('false');
+ expect(formValid.getText()).toContain('false');
+ });
+
+ it('should be valid if empty when min length is set', function() {
+ userLastInput.clear();
+ userLastInput.sendKeys('');
+
+ expect(user.getText()).toContain('{"name":"guest","last":""}');
+ expect(lastNameValid.getText()).toContain('true');
+ expect(formValid.getText()).toContain('true');
+ });
+
+ it('should be invalid if less than required min length', function() {
+ userLastInput.clear();
+ userLastInput.sendKeys('xx');
+
+ expect(user.getText()).toContain('{"name":"guest"}');
+ expect(lastNameValid.getText()).toContain('false');
+ expect(lastNameError.getText()).toContain('minlength');
+ expect(formValid.getText()).toContain('false');
+ });
+
+ it('should be invalid if longer than max length', function() {
+ userLastInput.clear();
+ userLastInput.sendKeys('some ridiculously long name');
+
+ expect(user.getText()).toContain('{"name":"guest"}');
+ expect(lastNameValid.getText()).toContain('false');
+ expect(lastNameError.getText()).toContain('maxlength');
+ expect(formValid.getText()).toContain('false');
+ });
+ </file>
+ </example>
+ */
+var inputDirective = ['$browser', '$sniffer', '$filter', '$parse',
+ function($browser, $sniffer, $filter, $parse) {
+ return {
+ restrict: 'E',
+ require: ['?ngModel'],
+ link: {
+ pre: function(scope, element, attr, ctrls) {
+ if (ctrls[0]) {
+ (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrls[0], $sniffer,
+ $browser, $filter, $parse);
+ }
+ }
+ }
+ };
+}];
+
+
+
+var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
+/**
+ * @ngdoc directive
+ * @name ngValue
+ *
+ * @description
+ * Binds the given expression to the value of `<option>` or {@link input[radio] `input[radio]`},
+ * so that when the element is selected, the {@link ngModel `ngModel`} of that element is set to
+ * the bound value.
+ *
+ * `ngValue` is useful when dynamically generating lists of radio buttons using
+ * {@link ngRepeat `ngRepeat`}, as shown below.
+ *
+ * Likewise, `ngValue` can be used to generate `<option>` elements for
+ * the {@link select `select`} element. In that case however, only strings are supported
+ * for the `value `attribute, so the resulting `ngModel` will always be a string.
+ * Support for `select` models with non-string values is available via `ngOptions`.
+ *
+ * @element input
+ * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute
+ * of the `input` element
+ *
+ * @example
+ <example name="ngValue-directive" module="valueExample">
+ <file name="index.html">
+ <script>
+ angular.module('valueExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.names = ['pizza', 'unicorns', 'robots'];
+ $scope.my = { favorite: 'unicorns' };
+ }]);
+ </script>
+ <form ng-controller="ExampleController">
+ <h2>Which is your favorite?</h2>
+ <label ng-repeat="name in names" for="{{name}}">
+ {{name}}
+ <input type="radio"
+ ng-model="my.favorite"
+ ng-value="name"
+ id="{{name}}"
+ name="favorite">
+ </label>
+ <div>You chose {{my.favorite}}</div>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ var favorite = element(by.binding('my.favorite'));
+
+ it('should initialize to model', function() {
+ expect(favorite.getText()).toContain('unicorns');
+ });
+ it('should bind the values to the inputs', function() {
+ element.all(by.model('my.favorite')).get(0).click();
+ expect(favorite.getText()).toContain('pizza');
+ });
+ </file>
+ </example>
+ */
+var ngValueDirective = function() {
+ return {
+ restrict: 'A',
+ priority: 100,
+ compile: function(tpl, tplAttr) {
+ if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {
+ return function ngValueConstantLink(scope, elm, attr) {
+ attr.$set('value', scope.$eval(attr.ngValue));
+ };
+ } else {
+ return function ngValueLink(scope, elm, attr) {
+ scope.$watch(attr.ngValue, function valueWatchAction(value) {
+ attr.$set('value', value);
+ });
+ };
+ }
+ }
+ };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngBind
+ * @restrict AC
+ *
+ * @description
+ * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element
+ * with the value of a given expression, and to update the text content when the value of that
+ * expression changes.
+ *
+ * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like
+ * `{{ expression }}` which is similar but less verbose.
+ *
+ * It is preferable to use `ngBind` instead of `{{ expression }}` if a template is momentarily
+ * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an
+ * element attribute, it makes the bindings invisible to the user while the page is loading.
+ *
+ * An alternative solution to this problem would be using the
+ * {@link ng.directive:ngCloak ngCloak} directive.
+ *
+ *
+ * @element ANY
+ * @param {expression} ngBind {@link guide/expression Expression} to evaluate.
+ *
+ * @example
+ * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
+ <example module="bindExample">
+ <file name="index.html">
+ <script>
+ angular.module('bindExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.name = 'Whirled';
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>Enter name: <input type="text" ng-model="name"></label><br>
+ Hello <span ng-bind="name"></span>!
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-bind', function() {
+ var nameInput = element(by.model('name'));
+
+ expect(element(by.binding('name')).getText()).toBe('Whirled');
+ nameInput.clear();
+ nameInput.sendKeys('world');
+ expect(element(by.binding('name')).getText()).toBe('world');
+ });
+ </file>
+ </example>
+ */
+var ngBindDirective = ['$compile', function($compile) {
+ return {
+ restrict: 'AC',
+ compile: function ngBindCompile(templateElement) {
+ $compile.$$addBindingClass(templateElement);
+ return function ngBindLink(scope, element, attr) {
+ $compile.$$addBindingInfo(element, attr.ngBind);
+ element = element[0];
+ scope.$watch(attr.ngBind, function ngBindWatchAction(value) {
+ element.textContent = isUndefined(value) ? '' : value;
+ });
+ };
+ }
+ };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngBindTemplate
+ *
+ * @description
+ * The `ngBindTemplate` directive specifies that the element
+ * text content should be replaced with the interpolation of the template
+ * in the `ngBindTemplate` attribute.
+ * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}`
+ * expressions. This directive is needed since some HTML elements
+ * (such as TITLE and OPTION) cannot contain SPAN elements.
+ *
+ * @element ANY
+ * @param {string} ngBindTemplate template of form
+ * <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.
+ *
+ * @example
+ * Try it here: enter text in text box and watch the greeting change.
+ <example module="bindExample">
+ <file name="index.html">
+ <script>
+ angular.module('bindExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.salutation = 'Hello';
+ $scope.name = 'World';
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>Salutation: <input type="text" ng-model="salutation"></label><br>
+ <label>Name: <input type="text" ng-model="name"></label><br>
+ <pre ng-bind-template="{{salutation}} {{name}}!"></pre>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-bind', function() {
+ var salutationElem = element(by.binding('salutation'));
+ var salutationInput = element(by.model('salutation'));
+ var nameInput = element(by.model('name'));
+
+ expect(salutationElem.getText()).toBe('Hello World!');
+
+ salutationInput.clear();
+ salutationInput.sendKeys('Greetings');
+ nameInput.clear();
+ nameInput.sendKeys('user');
+
+ expect(salutationElem.getText()).toBe('Greetings user!');
+ });
+ </file>
+ </example>
+ */
+var ngBindTemplateDirective = ['$interpolate', '$compile', function($interpolate, $compile) {
+ return {
+ compile: function ngBindTemplateCompile(templateElement) {
+ $compile.$$addBindingClass(templateElement);
+ return function ngBindTemplateLink(scope, element, attr) {
+ var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));
+ $compile.$$addBindingInfo(element, interpolateFn.expressions);
+ element = element[0];
+ attr.$observe('ngBindTemplate', function(value) {
+ element.textContent = isUndefined(value) ? '' : value;
+ });
+ };
+ }
+ };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngBindHtml
+ *
+ * @description
+ * Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default,
+ * the resulting HTML content will be sanitized using the {@link ngSanitize.$sanitize $sanitize} service.
+ * To utilize this functionality, ensure that `$sanitize` is available, for example, by including {@link
+ * ngSanitize} in your module's dependencies (not in core Angular). In order to use {@link ngSanitize}
+ * in your module's dependencies, you need to include "angular-sanitize.js" in your application.
+ *
+ * You may also bypass sanitization for values you know are safe. To do so, bind to
+ * an explicitly trusted value via {@link ng.$sce#trustAsHtml $sce.trustAsHtml}. See the example
+ * under {@link ng.$sce#show-me-an-example-using-sce- Strict Contextual Escaping (SCE)}.
+ *
+ * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you
+ * will have an exception (instead of an exploit.)
+ *
+ * @element ANY
+ * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.
+ *
+ * @example
+
+ <example module="bindHtmlExample" deps="angular-sanitize.js">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <p ng-bind-html="myHTML"></p>
+ </div>
+ </file>
+
+ <file name="script.js">
+ angular.module('bindHtmlExample', ['ngSanitize'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.myHTML =
+ 'I am an <code>HTML</code>string with ' +
+ '<a href="#">links!</a> and other <em>stuff</em>';
+ }]);
+ </file>
+
+ <file name="protractor.js" type="protractor">
+ it('should check ng-bind-html', function() {
+ expect(element(by.binding('myHTML')).getText()).toBe(
+ 'I am an HTMLstring with links! and other stuff');
+ });
+ </file>
+ </example>
+ */
+var ngBindHtmlDirective = ['$sce', '$parse', '$compile', function($sce, $parse, $compile) {
+ return {
+ restrict: 'A',
+ compile: function ngBindHtmlCompile(tElement, tAttrs) {
+ var ngBindHtmlGetter = $parse(tAttrs.ngBindHtml);
+ var ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, function getStringValue(value) {
+ return (value || '').toString();
+ });
+ $compile.$$addBindingClass(tElement);
+
+ return function ngBindHtmlLink(scope, element, attr) {
+ $compile.$$addBindingInfo(element, attr.ngBindHtml);
+
+ scope.$watch(ngBindHtmlWatch, function ngBindHtmlWatchAction() {
+ // we re-evaluate the expr because we want a TrustedValueHolderType
+ // for $sce, not a string
+ element.html($sce.getTrustedHtml(ngBindHtmlGetter(scope)) || '');
+ });
+ };
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngChange
+ *
+ * @description
+ * Evaluate the given expression when the user changes the input.
+ * The expression is evaluated immediately, unlike the JavaScript onchange event
+ * which only triggers at the end of a change (usually, when the user leaves the
+ * form element or presses the return key).
+ *
+ * The `ngChange` expression is only evaluated when a change in the input value causes
+ * a new value to be committed to the model.
+ *
+ * It will not be evaluated:
+ * * if the value returned from the `$parsers` transformation pipeline has not changed
+ * * if the input has continued to be invalid since the model will stay `null`
+ * * if the model is changed programmatically and not by a change to the input value
+ *
+ *
+ * Note, this directive requires `ngModel` to be present.
+ *
+ * @element input
+ * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change
+ * in input value.
+ *
+ * @example
+ * <example name="ngChange-directive" module="changeExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('changeExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.counter = 0;
+ * $scope.change = function() {
+ * $scope.counter++;
+ * };
+ * }]);
+ * </script>
+ * <div ng-controller="ExampleController">
+ * <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" />
+ * <input type="checkbox" ng-model="confirmed" id="ng-change-example2" />
+ * <label for="ng-change-example2">Confirmed</label><br />
+ * <tt>debug = {{confirmed}}</tt><br/>
+ * <tt>counter = {{counter}}</tt><br/>
+ * </div>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * var counter = element(by.binding('counter'));
+ * var debug = element(by.binding('confirmed'));
+ *
+ * it('should evaluate the expression if changing from view', function() {
+ * expect(counter.getText()).toContain('0');
+ *
+ * element(by.id('ng-change-example1')).click();
+ *
+ * expect(counter.getText()).toContain('1');
+ * expect(debug.getText()).toContain('true');
+ * });
+ *
+ * it('should not evaluate the expression if changing from model', function() {
+ * element(by.id('ng-change-example2')).click();
+
+ * expect(counter.getText()).toContain('0');
+ * expect(debug.getText()).toContain('true');
+ * });
+ * </file>
+ * </example>
+ */
+var ngChangeDirective = valueFn({
+ restrict: 'A',
+ require: 'ngModel',
+ link: function(scope, element, attr, ctrl) {
+ ctrl.$viewChangeListeners.push(function() {
+ scope.$eval(attr.ngChange);
+ });
+ }
+});
+
+function classDirective(name, selector) {
+ name = 'ngClass' + name;
+ return ['$animate', function($animate) {
+ return {
+ restrict: 'AC',
+ link: function(scope, element, attr) {
+ var oldVal;
+
+ scope.$watch(attr[name], ngClassWatchAction, true);
+
+ attr.$observe('class', function(value) {
+ ngClassWatchAction(scope.$eval(attr[name]));
+ });
+
+
+ if (name !== 'ngClass') {
+ scope.$watch('$index', function($index, old$index) {
+ // jshint bitwise: false
+ var mod = $index & 1;
+ if (mod !== (old$index & 1)) {
+ var classes = arrayClasses(scope.$eval(attr[name]));
+ mod === selector ?
+ addClasses(classes) :
+ removeClasses(classes);
+ }
+ });
+ }
+
+ function addClasses(classes) {
+ var newClasses = digestClassCounts(classes, 1);
+ attr.$addClass(newClasses);
+ }
+
+ function removeClasses(classes) {
+ var newClasses = digestClassCounts(classes, -1);
+ attr.$removeClass(newClasses);
+ }
+
+ function digestClassCounts(classes, count) {
+ // Use createMap() to prevent class assumptions involving property
+ // names in Object.prototype
+ var classCounts = element.data('$classCounts') || createMap();
+ var classesToUpdate = [];
+ forEach(classes, function(className) {
+ if (count > 0 || classCounts[className]) {
+ classCounts[className] = (classCounts[className] || 0) + count;
+ if (classCounts[className] === +(count > 0)) {
+ classesToUpdate.push(className);
+ }
+ }
+ });
+ element.data('$classCounts', classCounts);
+ return classesToUpdate.join(' ');
+ }
+
+ function updateClasses(oldClasses, newClasses) {
+ var toAdd = arrayDifference(newClasses, oldClasses);
+ var toRemove = arrayDifference(oldClasses, newClasses);
+ toAdd = digestClassCounts(toAdd, 1);
+ toRemove = digestClassCounts(toRemove, -1);
+ if (toAdd && toAdd.length) {
+ $animate.addClass(element, toAdd);
+ }
+ if (toRemove && toRemove.length) {
+ $animate.removeClass(element, toRemove);
+ }
+ }
+
+ function ngClassWatchAction(newVal) {
+ if (selector === true || scope.$index % 2 === selector) {
+ var newClasses = arrayClasses(newVal || []);
+ if (!oldVal) {
+ addClasses(newClasses);
+ } else if (!equals(newVal,oldVal)) {
+ var oldClasses = arrayClasses(oldVal);
+ updateClasses(oldClasses, newClasses);
+ }
+ }
+ oldVal = shallowCopy(newVal);
+ }
+ }
+ };
+
+ function arrayDifference(tokens1, tokens2) {
+ var values = [];
+
+ outer:
+ for (var i = 0; i < tokens1.length; i++) {
+ var token = tokens1[i];
+ for (var j = 0; j < tokens2.length; j++) {
+ if (token == tokens2[j]) continue outer;
+ }
+ values.push(token);
+ }
+ return values;
+ }
+
+ function arrayClasses(classVal) {
+ var classes = [];
+ if (isArray(classVal)) {
+ forEach(classVal, function(v) {
+ classes = classes.concat(arrayClasses(v));
+ });
+ return classes;
+ } else if (isString(classVal)) {
+ return classVal.split(' ');
+ } else if (isObject(classVal)) {
+ forEach(classVal, function(v, k) {
+ if (v) {
+ classes = classes.concat(k.split(' '));
+ }
+ });
+ return classes;
+ }
+ return classVal;
+ }
+ }];
+}
+
+/**
+ * @ngdoc directive
+ * @name ngClass
+ * @restrict AC
+ *
+ * @description
+ * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding
+ * an expression that represents all classes to be added.
+ *
+ * The directive operates in three different ways, depending on which of three types the expression
+ * evaluates to:
+ *
+ * 1. If the expression evaluates to a string, the string should be one or more space-delimited class
+ * names.
+ *
+ * 2. If the expression evaluates to an object, then for each key-value pair of the
+ * object with a truthy value the corresponding key is used as a class name.
+ *
+ * 3. If the expression evaluates to an array, each element of the array should either be a string as in
+ * type 1 or an object as in type 2. This means that you can mix strings and objects together in an array
+ * to give you more control over what CSS classes appear. See the code below for an example of this.
+ *
+ *
+ * The directive won't add duplicate classes if a particular class was already set.
+ *
+ * When the expression changes, the previously added classes are removed and only then are the
+ * new classes added.
+ *
+ * @animations
+ * **add** - happens just before the class is applied to the elements
+ *
+ * **remove** - happens just before the class is removed from the element
+ *
+ * @element ANY
+ * @param {expression} ngClass {@link guide/expression Expression} to eval. The result
+ * of the evaluation can be a string representing space delimited class
+ * names, an array, or a map of class names to boolean values. In the case of a map, the
+ * names of the properties whose values are truthy will be added as css classes to the
+ * element.
+ *
+ * @example Example that demonstrates basic bindings via ngClass directive.
+ <example>
+ <file name="index.html">
+ <p ng-class="{strike: deleted, bold: important, 'has-error': error}">Map Syntax Example</p>
+ <label>
+ <input type="checkbox" ng-model="deleted">
+ deleted (apply "strike" class)
+ </label><br>
+ <label>
+ <input type="checkbox" ng-model="important">
+ important (apply "bold" class)
+ </label><br>
+ <label>
+ <input type="checkbox" ng-model="error">
+ error (apply "has-error" class)
+ </label>
+ <hr>
+ <p ng-class="style">Using String Syntax</p>
+ <input type="text" ng-model="style"
+ placeholder="Type: bold strike red" aria-label="Type: bold strike red">
+ <hr>
+ <p ng-class="[style1, style2, style3]">Using Array Syntax</p>
+ <input ng-model="style1"
+ placeholder="Type: bold, strike or red" aria-label="Type: bold, strike or red"><br>
+ <input ng-model="style2"
+ placeholder="Type: bold, strike or red" aria-label="Type: bold, strike or red 2"><br>
+ <input ng-model="style3"
+ placeholder="Type: bold, strike or red" aria-label="Type: bold, strike or red 3"><br>
+ <hr>
+ <p ng-class="[style4, {orange: warning}]">Using Array and Map Syntax</p>
+ <input ng-model="style4" placeholder="Type: bold, strike" aria-label="Type: bold, strike"><br>
+ <label><input type="checkbox" ng-model="warning"> warning (apply "orange" class)</label>
+ </file>
+ <file name="style.css">
+ .strike {
+ text-decoration: line-through;
+ }
+ .bold {
+ font-weight: bold;
+ }
+ .red {
+ color: red;
+ }
+ .has-error {
+ color: red;
+ background-color: yellow;
+ }
+ .orange {
+ color: orange;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var ps = element.all(by.css('p'));
+
+ it('should let you toggle the class', function() {
+
+ expect(ps.first().getAttribute('class')).not.toMatch(/bold/);
+ expect(ps.first().getAttribute('class')).not.toMatch(/has-error/);
+
+ element(by.model('important')).click();
+ expect(ps.first().getAttribute('class')).toMatch(/bold/);
+
+ element(by.model('error')).click();
+ expect(ps.first().getAttribute('class')).toMatch(/has-error/);
+ });
+
+ it('should let you toggle string example', function() {
+ expect(ps.get(1).getAttribute('class')).toBe('');
+ element(by.model('style')).clear();
+ element(by.model('style')).sendKeys('red');
+ expect(ps.get(1).getAttribute('class')).toBe('red');
+ });
+
+ it('array example should have 3 classes', function() {
+ expect(ps.get(2).getAttribute('class')).toBe('');
+ element(by.model('style1')).sendKeys('bold');
+ element(by.model('style2')).sendKeys('strike');
+ element(by.model('style3')).sendKeys('red');
+ expect(ps.get(2).getAttribute('class')).toBe('bold strike red');
+ });
+
+ it('array with map example should have 2 classes', function() {
+ expect(ps.last().getAttribute('class')).toBe('');
+ element(by.model('style4')).sendKeys('bold');
+ element(by.model('warning')).click();
+ expect(ps.last().getAttribute('class')).toBe('bold orange');
+ });
+ </file>
+ </example>
+
+ ## Animations
+
+ The example below demonstrates how to perform animations using ngClass.
+
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <input id="setbtn" type="button" value="set" ng-click="myVar='my-class'">
+ <input id="clearbtn" type="button" value="clear" ng-click="myVar=''">
+ <br>
+ <span class="base-class" ng-class="myVar">Sample Text</span>
+ </file>
+ <file name="style.css">
+ .base-class {
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+ }
+
+ .base-class.my-class {
+ color: red;
+ font-size:3em;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-class', function() {
+ expect(element(by.css('.base-class')).getAttribute('class')).not.
+ toMatch(/my-class/);
+
+ element(by.id('setbtn')).click();
+
+ expect(element(by.css('.base-class')).getAttribute('class')).
+ toMatch(/my-class/);
+
+ element(by.id('clearbtn')).click();
+
+ expect(element(by.css('.base-class')).getAttribute('class')).not.
+ toMatch(/my-class/);
+ });
+ </file>
+ </example>
+
+
+ ## ngClass and pre-existing CSS3 Transitions/Animations
+ The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.
+ Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder
+ any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure
+ to view the step by step details of {@link $animate#addClass $animate.addClass} and
+ {@link $animate#removeClass $animate.removeClass}.
+ */
+var ngClassDirective = classDirective('', true);
+
+/**
+ * @ngdoc directive
+ * @name ngClassOdd
+ * @restrict AC
+ *
+ * @description
+ * The `ngClassOdd` and `ngClassEven` directives work exactly as
+ * {@link ng.directive:ngClass ngClass}, except they work in
+ * conjunction with `ngRepeat` and take effect only on odd (even) rows.
+ *
+ * This directive can be applied only within the scope of an
+ * {@link ng.directive:ngRepeat ngRepeat}.
+ *
+ * @element ANY
+ * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result
+ * of the evaluation can be a string representing space delimited class names or an array.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
+ <li ng-repeat="name in names">
+ <span ng-class-odd="'odd'" ng-class-even="'even'">
+ {{name}}
+ </span>
+ </li>
+ </ol>
+ </file>
+ <file name="style.css">
+ .odd {
+ color: red;
+ }
+ .even {
+ color: blue;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-class-odd and ng-class-even', function() {
+ expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
+ toMatch(/odd/);
+ expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
+ toMatch(/even/);
+ });
+ </file>
+ </example>
+ */
+var ngClassOddDirective = classDirective('Odd', 0);
+
+/**
+ * @ngdoc directive
+ * @name ngClassEven
+ * @restrict AC
+ *
+ * @description
+ * The `ngClassOdd` and `ngClassEven` directives work exactly as
+ * {@link ng.directive:ngClass ngClass}, except they work in
+ * conjunction with `ngRepeat` and take effect only on odd (even) rows.
+ *
+ * This directive can be applied only within the scope of an
+ * {@link ng.directive:ngRepeat ngRepeat}.
+ *
+ * @element ANY
+ * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The
+ * result of the evaluation can be a string representing space delimited class names or an array.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
+ <li ng-repeat="name in names">
+ <span ng-class-odd="'odd'" ng-class-even="'even'">
+ {{name}} &nbsp; &nbsp; &nbsp;
+ </span>
+ </li>
+ </ol>
+ </file>
+ <file name="style.css">
+ .odd {
+ color: red;
+ }
+ .even {
+ color: blue;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-class-odd and ng-class-even', function() {
+ expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
+ toMatch(/odd/);
+ expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
+ toMatch(/even/);
+ });
+ </file>
+ </example>
+ */
+var ngClassEvenDirective = classDirective('Even', 1);
+
+/**
+ * @ngdoc directive
+ * @name ngCloak
+ * @restrict AC
+ *
+ * @description
+ * The `ngCloak` directive is used to prevent the Angular html template from being briefly
+ * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this
+ * directive to avoid the undesirable flicker effect caused by the html template display.
+ *
+ * The directive can be applied to the `<body>` element, but the preferred usage is to apply
+ * multiple `ngCloak` directives to small portions of the page to permit progressive rendering
+ * of the browser view.
+ *
+ * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and
+ * `angular.min.js`.
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```css
+ * [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
+ * display: none !important;
+ * }
+ * ```
+ *
+ * When this css rule is loaded by the browser, all html elements (including their children) that
+ * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive
+ * during the compilation of the template it deletes the `ngCloak` element attribute, making
+ * the compiled element visible.
+ *
+ * For the best result, the `angular.js` script must be loaded in the head section of the html
+ * document; alternatively, the css rule above must be included in the external stylesheet of the
+ * application.
+ *
+ * @element ANY
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <div id="template1" ng-cloak>{{ 'hello' }}</div>
+ <div id="template2" class="ng-cloak">{{ 'world' }}</div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should remove the template directive and css class', function() {
+ expect($('#template1').getAttribute('ng-cloak')).
+ toBeNull();
+ expect($('#template2').getAttribute('ng-cloak')).
+ toBeNull();
+ });
+ </file>
+ </example>
+ *
+ */
+var ngCloakDirective = ngDirective({
+ compile: function(element, attr) {
+ attr.$set('ngCloak', undefined);
+ element.removeClass('ng-cloak');
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngController
+ *
+ * @description
+ * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular
+ * supports the principles behind the Model-View-Controller design pattern.
+ *
+ * MVC components in angular:
+ *
+ * * Model — Models are the properties of a scope; scopes are attached to the DOM where scope properties
+ * are accessed through bindings.
+ * * View — The template (HTML with data bindings) that is rendered into the View.
+ * * Controller — The `ngController` directive specifies a Controller class; the class contains business
+ * logic behind the application to decorate the scope with functions and values
+ *
+ * Note that you can also attach controllers to the DOM by declaring it in a route definition
+ * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller
+ * again using `ng-controller` in the template itself. This will cause the controller to be attached
+ * and executed twice.
+ *
+ * @element ANY
+ * @scope
+ * @priority 500
+ * @param {expression} ngController Name of a constructor function registered with the current
+ * {@link ng.$controllerProvider $controllerProvider} or an {@link guide/expression expression}
+ * that on the current scope evaluates to a constructor function.
+ *
+ * The controller instance can be published into a scope property by specifying
+ * `ng-controller="as propertyName"`.
+ *
+ * If the current `$controllerProvider` is configured to use globals (via
+ * {@link ng.$controllerProvider#allowGlobals `$controllerProvider.allowGlobals()` }), this may
+ * also be the name of a globally accessible constructor function (not recommended).
+ *
+ * @example
+ * Here is a simple form for editing user contact information. Adding, removing, clearing, and
+ * greeting are methods declared on the controller (see source tab). These methods can
+ * easily be called from the angular markup. Any changes to the data are automatically reflected
+ * in the View without the need for a manual update.
+ *
+ * Two different declaration styles are included below:
+ *
+ * * one binds methods and properties directly onto the controller using `this`:
+ * `ng-controller="SettingsController1 as settings"`
+ * * one injects `$scope` into the controller:
+ * `ng-controller="SettingsController2"`
+ *
+ * The second option is more common in the Angular community, and is generally used in boilerplates
+ * and in this guide. However, there are advantages to binding properties directly to the controller
+ * and avoiding scope.
+ *
+ * * Using `controller as` makes it obvious which controller you are accessing in the template when
+ * multiple controllers apply to an element.
+ * * If you are writing your controllers as classes you have easier access to the properties and
+ * methods, which will appear on the scope, from inside the controller code.
+ * * Since there is always a `.` in the bindings, you don't have to worry about prototypal
+ * inheritance masking primitives.
+ *
+ * This example demonstrates the `controller as` syntax.
+ *
+ * <example name="ngControllerAs" module="controllerAsExample">
+ * <file name="index.html">
+ * <div id="ctrl-as-exmpl" ng-controller="SettingsController1 as settings">
+ * <label>Name: <input type="text" ng-model="settings.name"/></label>
+ * <button ng-click="settings.greet()">greet</button><br/>
+ * Contact:
+ * <ul>
+ * <li ng-repeat="contact in settings.contacts">
+ * <select ng-model="contact.type" aria-label="Contact method" id="select_{{$index}}">
+ * <option>phone</option>
+ * <option>email</option>
+ * </select>
+ * <input type="text" ng-model="contact.value" aria-labelledby="select_{{$index}}" />
+ * <button ng-click="settings.clearContact(contact)">clear</button>
+ * <button ng-click="settings.removeContact(contact)" aria-label="Remove">X</button>
+ * </li>
+ * <li><button ng-click="settings.addContact()">add</button></li>
+ * </ul>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('controllerAsExample', [])
+ * .controller('SettingsController1', SettingsController1);
+ *
+ * function SettingsController1() {
+ * this.name = "John Smith";
+ * this.contacts = [
+ * {type: 'phone', value: '408 555 1212'},
+ * {type: 'email', value: 'john.smith@example.org'} ];
+ * }
+ *
+ * SettingsController1.prototype.greet = function() {
+ * alert(this.name);
+ * };
+ *
+ * SettingsController1.prototype.addContact = function() {
+ * this.contacts.push({type: 'email', value: 'yourname@example.org'});
+ * };
+ *
+ * SettingsController1.prototype.removeContact = function(contactToRemove) {
+ * var index = this.contacts.indexOf(contactToRemove);
+ * this.contacts.splice(index, 1);
+ * };
+ *
+ * SettingsController1.prototype.clearContact = function(contact) {
+ * contact.type = 'phone';
+ * contact.value = '';
+ * };
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should check controller as', function() {
+ * var container = element(by.id('ctrl-as-exmpl'));
+ * expect(container.element(by.model('settings.name'))
+ * .getAttribute('value')).toBe('John Smith');
+ *
+ * var firstRepeat =
+ * container.element(by.repeater('contact in settings.contacts').row(0));
+ * var secondRepeat =
+ * container.element(by.repeater('contact in settings.contacts').row(1));
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('408 555 1212');
+ *
+ * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('john.smith@example.org');
+ *
+ * firstRepeat.element(by.buttonText('clear')).click();
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('');
+ *
+ * container.element(by.buttonText('add')).click();
+ *
+ * expect(container.element(by.repeater('contact in settings.contacts').row(2))
+ * .element(by.model('contact.value'))
+ * .getAttribute('value'))
+ * .toBe('yourname@example.org');
+ * });
+ * </file>
+ * </example>
+ *
+ * This example demonstrates the "attach to `$scope`" style of controller.
+ *
+ * <example name="ngController" module="controllerExample">
+ * <file name="index.html">
+ * <div id="ctrl-exmpl" ng-controller="SettingsController2">
+ * <label>Name: <input type="text" ng-model="name"/></label>
+ * <button ng-click="greet()">greet</button><br/>
+ * Contact:
+ * <ul>
+ * <li ng-repeat="contact in contacts">
+ * <select ng-model="contact.type" id="select_{{$index}}">
+ * <option>phone</option>
+ * <option>email</option>
+ * </select>
+ * <input type="text" ng-model="contact.value" aria-labelledby="select_{{$index}}" />
+ * <button ng-click="clearContact(contact)">clear</button>
+ * <button ng-click="removeContact(contact)">X</button>
+ * </li>
+ * <li>[ <button ng-click="addContact()">add</button> ]</li>
+ * </ul>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('controllerExample', [])
+ * .controller('SettingsController2', ['$scope', SettingsController2]);
+ *
+ * function SettingsController2($scope) {
+ * $scope.name = "John Smith";
+ * $scope.contacts = [
+ * {type:'phone', value:'408 555 1212'},
+ * {type:'email', value:'john.smith@example.org'} ];
+ *
+ * $scope.greet = function() {
+ * alert($scope.name);
+ * };
+ *
+ * $scope.addContact = function() {
+ * $scope.contacts.push({type:'email', value:'yourname@example.org'});
+ * };
+ *
+ * $scope.removeContact = function(contactToRemove) {
+ * var index = $scope.contacts.indexOf(contactToRemove);
+ * $scope.contacts.splice(index, 1);
+ * };
+ *
+ * $scope.clearContact = function(contact) {
+ * contact.type = 'phone';
+ * contact.value = '';
+ * };
+ * }
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should check controller', function() {
+ * var container = element(by.id('ctrl-exmpl'));
+ *
+ * expect(container.element(by.model('name'))
+ * .getAttribute('value')).toBe('John Smith');
+ *
+ * var firstRepeat =
+ * container.element(by.repeater('contact in contacts').row(0));
+ * var secondRepeat =
+ * container.element(by.repeater('contact in contacts').row(1));
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('408 555 1212');
+ * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('john.smith@example.org');
+ *
+ * firstRepeat.element(by.buttonText('clear')).click();
+ *
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ * .toBe('');
+ *
+ * container.element(by.buttonText('add')).click();
+ *
+ * expect(container.element(by.repeater('contact in contacts').row(2))
+ * .element(by.model('contact.value'))
+ * .getAttribute('value'))
+ * .toBe('yourname@example.org');
+ * });
+ * </file>
+ *</example>
+
+ */
+var ngControllerDirective = [function() {
+ return {
+ restrict: 'A',
+ scope: true,
+ controller: '@',
+ priority: 500
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngCsp
+ *
+ * @element html
+ * @description
+ *
+ * Angular has some features that can break certain
+ * [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) rules.
+ *
+ * If you intend to implement these rules then you must tell Angular not to use these features.
+ *
+ * This is necessary when developing things like Google Chrome Extensions or Universal Windows Apps.
+ *
+ *
+ * The following rules affect Angular:
+ *
+ * * `unsafe-eval`: this rule forbids apps to use `eval` or `Function(string)` generated functions
+ * (among other things). Angular makes use of this in the {@link $parse} service to provide a 30%
+ * increase in the speed of evaluating Angular expressions.
+ *
+ * * `unsafe-inline`: this rule forbids apps from inject custom styles into the document. Angular
+ * makes use of this to include some CSS rules (e.g. {@link ngCloak} and {@link ngHide}).
+ * To make these directives work when a CSP rule is blocking inline styles, you must link to the
+ * `angular-csp.css` in your HTML manually.
+ *
+ * If you do not provide `ngCsp` then Angular tries to autodetect if CSP is blocking unsafe-eval
+ * and automatically deactivates this feature in the {@link $parse} service. This autodetection,
+ * however, triggers a CSP error to be logged in the console:
+ *
+ * ```
+ * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of
+ * script in the following Content Security Policy directive: "default-src 'self'". Note that
+ * 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
+ * ```
+ *
+ * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`
+ * directive on an element of the HTML document that appears before the `<script>` tag that loads
+ * the `angular.js` file.
+ *
+ * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*
+ *
+ * You can specify which of the CSP related Angular features should be deactivated by providing
+ * a value for the `ng-csp` attribute. The options are as follows:
+ *
+ * * no-inline-style: this stops Angular from injecting CSS styles into the DOM
+ *
+ * * no-unsafe-eval: this stops Angular from optimising $parse with unsafe eval of strings
+ *
+ * You can use these values in the following combinations:
+ *
+ *
+ * * No declaration means that Angular will assume that you can do inline styles, but it will do
+ * a runtime check for unsafe-eval. E.g. `<body>`. This is backwardly compatible with previous versions
+ * of Angular.
+ *
+ * * A simple `ng-csp` (or `data-ng-csp`) attribute will tell Angular to deactivate both inline
+ * styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous versions
+ * of Angular.
+ *
+ * * Specifying only `no-unsafe-eval` tells Angular that we must not use eval, but that we can inject
+ * inline styles. E.g. `<body ng-csp="no-unsafe-eval">`.
+ *
+ * * Specifying only `no-inline-style` tells Angular that we must not inject styles, but that we can
+ * run eval - no automcatic check for unsafe eval will occur. E.g. `<body ng-csp="no-inline-style">`
+ *
+ * * Specifying both `no-unsafe-eval` and `no-inline-style` tells Angular that we must not inject
+ * styles nor use eval, which is the same as an empty: ng-csp.
+ * E.g.`<body ng-csp="no-inline-style;no-unsafe-eval">`
+ *
+ * @example
+ * This example shows how to apply the `ngCsp` directive to the `html` tag.
+ ```html
+ <!doctype html>
+ <html ng-app ng-csp>
+ ...
+ ...
+ </html>
+ ```
+ * @example
+ // Note: the suffix `.csp` in the example name triggers
+ // csp mode in our http server!
+ <example name="example.csp" module="cspExample" ng-csp="true">
+ <file name="index.html">
+ <div ng-controller="MainController as ctrl">
+ <div>
+ <button ng-click="ctrl.inc()" id="inc">Increment</button>
+ <span id="counter">
+ {{ctrl.counter}}
+ </span>
+ </div>
+
+ <div>
+ <button ng-click="ctrl.evil()" id="evil">Evil</button>
+ <span id="evilError">
+ {{ctrl.evilError}}
+ </span>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('cspExample', [])
+ .controller('MainController', function() {
+ this.counter = 0;
+ this.inc = function() {
+ this.counter++;
+ };
+ this.evil = function() {
+ // jshint evil:true
+ try {
+ eval('1+2');
+ } catch (e) {
+ this.evilError = e.message;
+ }
+ };
+ });
+ </file>
+ <file name="protractor.js" type="protractor">
+ var util, webdriver;
+
+ var incBtn = element(by.id('inc'));
+ var counter = element(by.id('counter'));
+ var evilBtn = element(by.id('evil'));
+ var evilError = element(by.id('evilError'));
+
+ function getAndClearSevereErrors() {
+ return browser.manage().logs().get('browser').then(function(browserLog) {
+ return browserLog.filter(function(logEntry) {
+ return logEntry.level.value > webdriver.logging.Level.WARNING.value;
+ });
+ });
+ }
+
+ function clearErrors() {
+ getAndClearSevereErrors();
+ }
+
+ function expectNoErrors() {
+ getAndClearSevereErrors().then(function(filteredLog) {
+ expect(filteredLog.length).toEqual(0);
+ if (filteredLog.length) {
+ console.log('browser console errors: ' + util.inspect(filteredLog));
+ }
+ });
+ }
+
+ function expectError(regex) {
+ getAndClearSevereErrors().then(function(filteredLog) {
+ var found = false;
+ filteredLog.forEach(function(log) {
+ if (log.message.match(regex)) {
+ found = true;
+ }
+ });
+ if (!found) {
+ throw new Error('expected an error that matches ' + regex);
+ }
+ });
+ }
+
+ beforeEach(function() {
+ util = require('util');
+ webdriver = require('protractor/node_modules/selenium-webdriver');
+ });
+
+ // For now, we only test on Chrome,
+ // as Safari does not load the page with Protractor's injected scripts,
+ // and Firefox webdriver always disables content security policy (#6358)
+ if (browser.params.browser !== 'chrome') {
+ return;
+ }
+
+ it('should not report errors when the page is loaded', function() {
+ // clear errors so we are not dependent on previous tests
+ clearErrors();
+ // Need to reload the page as the page is already loaded when
+ // we come here
+ browser.driver.getCurrentUrl().then(function(url) {
+ browser.get(url);
+ });
+ expectNoErrors();
+ });
+
+ it('should evaluate expressions', function() {
+ expect(counter.getText()).toEqual('0');
+ incBtn.click();
+ expect(counter.getText()).toEqual('1');
+ expectNoErrors();
+ });
+
+ it('should throw and report an error when using "eval"', function() {
+ evilBtn.click();
+ expect(evilError.getText()).toMatch(/Content Security Policy/);
+ expectError(/Content Security Policy/);
+ });
+ </file>
+ </example>
+ */
+
+// ngCsp is not implemented as a proper directive any more, because we need it be processed while we
+// bootstrap the system (before $parse is instantiated), for this reason we just have
+// the csp() fn that looks for the `ng-csp` attribute anywhere in the current doc
+
+/**
+ * @ngdoc directive
+ * @name ngClick
+ *
+ * @description
+ * The ngClick directive allows you to specify custom behavior when
+ * an element is clicked.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon
+ * click. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-click="count = count + 1" ng-init="count=0">
+ Increment
+ </button>
+ <span>
+ count: {{count}}
+ </span>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-click', function() {
+ expect(element(by.binding('count')).getText()).toMatch('0');
+ element(by.css('button')).click();
+ expect(element(by.binding('count')).getText()).toMatch('1');
+ });
+ </file>
+ </example>
+ */
+/*
+ * A collection of directives that allows creation of custom event handlers that are defined as
+ * angular expressions and are compiled and executed within the current scope.
+ */
+var ngEventDirectives = {};
+
+// For events that might fire synchronously during DOM manipulation
+// we need to execute their event handlers asynchronously using $evalAsync,
+// so that they are not executed in an inconsistent state.
+var forceAsyncEvents = {
+ 'blur': true,
+ 'focus': true
+};
+forEach(
+ 'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),
+ function(eventName) {
+ var directiveName = directiveNormalize('ng-' + eventName);
+ ngEventDirectives[directiveName] = ['$parse', '$rootScope', function($parse, $rootScope) {
+ return {
+ restrict: 'A',
+ compile: function($element, attr) {
+ // We expose the powerful $event object on the scope that provides access to the Window,
+ // etc. that isn't protected by the fast paths in $parse. We explicitly request better
+ // checks at the cost of speed since event handler expressions are not executed as
+ // frequently as regular change detection.
+ var fn = $parse(attr[directiveName], /* interceptorFn */ null, /* expensiveChecks */ true);
+ return function ngEventHandler(scope, element) {
+ element.on(eventName, function(event) {
+ var callback = function() {
+ fn(scope, {$event:event});
+ };
+ if (forceAsyncEvents[eventName] && $rootScope.$$phase) {
+ scope.$evalAsync(callback);
+ } else {
+ scope.$apply(callback);
+ }
+ });
+ };
+ }
+ };
+ }];
+ }
+);
+
+/**
+ * @ngdoc directive
+ * @name ngDblclick
+ *
+ * @description
+ * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon
+ * a dblclick. (The Event object is available as `$event`)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-dblclick="count = count + 1" ng-init="count=0">
+ Increment (on double click)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMousedown
+ *
+ * @description
+ * The ngMousedown directive allows you to specify custom behavior on mousedown event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon
+ * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mousedown="count = count + 1" ng-init="count=0">
+ Increment (on mouse down)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseup
+ *
+ * @description
+ * Specify custom behavior on mouseup event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon
+ * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseup="count = count + 1" ng-init="count=0">
+ Increment (on mouse up)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngMouseover
+ *
+ * @description
+ * Specify custom behavior on mouseover event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon
+ * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseover="count = count + 1" ng-init="count=0">
+ Increment (when mouse is over)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseenter
+ *
+ * @description
+ * Specify custom behavior on mouseenter event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon
+ * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseenter="count = count + 1" ng-init="count=0">
+ Increment (when mouse enters)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseleave
+ *
+ * @description
+ * Specify custom behavior on mouseleave event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon
+ * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mouseleave="count = count + 1" ng-init="count=0">
+ Increment (when mouse leaves)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMousemove
+ *
+ * @description
+ * Specify custom behavior on mousemove event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon
+ * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <button ng-mousemove="count = count + 1" ng-init="count=0">
+ Increment (when mouse moves)
+ </button>
+ count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeydown
+ *
+ * @description
+ * Specify custom behavior on keydown event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon
+ * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-keydown="count = count + 1" ng-init="count=0">
+ key down count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeyup
+ *
+ * @description
+ * Specify custom behavior on keyup event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon
+ * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <p>Typing in the input box below updates the key count</p>
+ <input ng-keyup="count = count + 1" ng-init="count=0"> key up count: {{count}}
+
+ <p>Typing in the input box below updates the keycode</p>
+ <input ng-keyup="event=$event">
+ <p>event keyCode: {{ event.keyCode }}</p>
+ <p>event altKey: {{ event.altKey }}</p>
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeypress
+ *
+ * @description
+ * Specify custom behavior on keypress event.
+ *
+ * @element ANY
+ * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon
+ * keypress. ({@link guide/expression#-event- Event object is available as `$event`}
+ * and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-keypress="count = count + 1" ng-init="count=0">
+ key press count: {{count}}
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngSubmit
+ *
+ * @description
+ * Enables binding angular expressions to onsubmit events.
+ *
+ * Additionally it prevents the default action (which for form means sending the request to the
+ * server and reloading the current page), but only if the form does not contain `action`,
+ * `data-action`, or `x-action` attributes.
+ *
+ * <div class="alert alert-warning">
+ * **Warning:** Be careful not to cause "double-submission" by using both the `ngClick` and
+ * `ngSubmit` handlers together. See the
+ * {@link form#submitting-a-form-and-preventing-the-default-action `form` directive documentation}
+ * for a detailed discussion of when `ngSubmit` may be triggered.
+ * </div>
+ *
+ * @element form
+ * @priority 0
+ * @param {expression} ngSubmit {@link guide/expression Expression} to eval.
+ * ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example module="submitExample">
+ <file name="index.html">
+ <script>
+ angular.module('submitExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.list = [];
+ $scope.text = 'hello';
+ $scope.submit = function() {
+ if ($scope.text) {
+ $scope.list.push(this.text);
+ $scope.text = '';
+ }
+ };
+ }]);
+ </script>
+ <form ng-submit="submit()" ng-controller="ExampleController">
+ Enter text and hit enter:
+ <input type="text" ng-model="text" name="text" />
+ <input type="submit" id="submit" value="Submit" />
+ <pre>list={{list}}</pre>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-submit', function() {
+ expect(element(by.binding('list')).getText()).toBe('list=[]');
+ element(by.css('#submit')).click();
+ expect(element(by.binding('list')).getText()).toContain('hello');
+ expect(element(by.model('text')).getAttribute('value')).toBe('');
+ });
+ it('should ignore empty strings', function() {
+ expect(element(by.binding('list')).getText()).toBe('list=[]');
+ element(by.css('#submit')).click();
+ element(by.css('#submit')).click();
+ expect(element(by.binding('list')).getText()).toContain('hello');
+ });
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngFocus
+ *
+ * @description
+ * Specify custom behavior on focus event.
+ *
+ * Note: As the `focus` event is executed synchronously when calling `input.focus()`
+ * AngularJS executes the expression using `scope.$evalAsync` if the event is fired
+ * during an `$apply` to ensure a consistent state.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon
+ * focus. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ * See {@link ng.directive:ngClick ngClick}
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngBlur
+ *
+ * @description
+ * Specify custom behavior on blur event.
+ *
+ * A [blur event](https://developer.mozilla.org/en-US/docs/Web/Events/blur) fires when
+ * an element has lost focus.
+ *
+ * Note: As the `blur` event is executed synchronously also during DOM manipulations
+ * (e.g. removing a focussed input),
+ * AngularJS executes the expression using `scope.$evalAsync` if the event is fired
+ * during an `$apply` to ensure a consistent state.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon
+ * blur. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ * See {@link ng.directive:ngClick ngClick}
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngCopy
+ *
+ * @description
+ * Specify custom behavior on copy event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon
+ * copy. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-copy="copied=true" ng-init="copied=false; value='copy me'" ng-model="value">
+ copied: {{copied}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngCut
+ *
+ * @description
+ * Specify custom behavior on cut event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon
+ * cut. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-cut="cut=true" ng-init="cut=false; value='cut me'" ng-model="value">
+ cut: {{cut}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngPaste
+ *
+ * @description
+ * Specify custom behavior on paste event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon
+ * paste. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input ng-paste="paste=true" ng-init="paste=false" placeholder='paste here'>
+ pasted: {{paste}}
+ </file>
+ </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngIf
+ * @restrict A
+ * @multiElement
+ *
+ * @description
+ * The `ngIf` directive removes or recreates a portion of the DOM tree based on an
+ * {expression}. If the expression assigned to `ngIf` evaluates to a false
+ * value then the element is removed from the DOM, otherwise a clone of the
+ * element is reinserted into the DOM.
+ *
+ * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the
+ * element in the DOM rather than changing its visibility via the `display` css property. A common
+ * case when this difference is significant is when using css selectors that rely on an element's
+ * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes.
+ *
+ * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope
+ * is created when the element is restored. The scope created within `ngIf` inherits from
+ * its parent scope using
+ * [prototypal inheritance](https://github.com/angular/angular.js/wiki/Understanding-Scopes#javascript-prototypal-inheritance).
+ * An important implication of this is if `ngModel` is used within `ngIf` to bind to
+ * a javascript primitive defined in the parent scope. In this case any modifications made to the
+ * variable within the child scope will override (hide) the value in the parent scope.
+ *
+ * Also, `ngIf` recreates elements using their compiled state. An example of this behavior
+ * is if an element's class attribute is directly modified after it's compiled, using something like
+ * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element
+ * the added class will be lost because the original compiled state is used to regenerate the element.
+ *
+ * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter`
+ * and `leave` effects.
+ *
+ * @animations
+ * enter - happens just after the `ngIf` contents change and a new DOM element is created and injected into the `ngIf` container
+ * leave - happens just before the `ngIf` contents are removed from the DOM
+ *
+ * @element ANY
+ * @scope
+ * @priority 600
+ * @param {expression} ngIf If the {@link guide/expression expression} is falsy then
+ * the element is removed from the DOM tree. If it is truthy a copy of the compiled
+ * element is added to the DOM tree.
+ *
+ * @example
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <label>Click me: <input type="checkbox" ng-model="checked" ng-init="checked=true" /></label><br/>
+ Show when checked:
+ <span ng-if="checked" class="animate-if">
+ This is removed when the checkbox is unchecked.
+ </span>
+ </file>
+ <file name="animations.css">
+ .animate-if {
+ background:white;
+ border:1px solid black;
+ padding:10px;
+ }
+
+ .animate-if.ng-enter, .animate-if.ng-leave {
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+ }
+
+ .animate-if.ng-enter,
+ .animate-if.ng-leave.ng-leave-active {
+ opacity:0;
+ }
+
+ .animate-if.ng-leave,
+ .animate-if.ng-enter.ng-enter-active {
+ opacity:1;
+ }
+ </file>
+ </example>
+ */
+var ngIfDirective = ['$animate', function($animate) {
+ return {
+ multiElement: true,
+ transclude: 'element',
+ priority: 600,
+ terminal: true,
+ restrict: 'A',
+ $$tlb: true,
+ link: function($scope, $element, $attr, ctrl, $transclude) {
+ var block, childScope, previousElements;
+ $scope.$watch($attr.ngIf, function ngIfWatchAction(value) {
+
+ if (value) {
+ if (!childScope) {
+ $transclude(function(clone, newScope) {
+ childScope = newScope;
+ clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ');
+ // Note: We only need the first/last node of the cloned nodes.
+ // However, we need to keep the reference to the jqlite wrapper as it might be changed later
+ // by a directive with templateUrl when its template arrives.
+ block = {
+ clone: clone
+ };
+ $animate.enter(clone, $element.parent(), $element);
+ });
+ }
+ } else {
+ if (previousElements) {
+ previousElements.remove();
+ previousElements = null;
+ }
+ if (childScope) {
+ childScope.$destroy();
+ childScope = null;
+ }
+ if (block) {
+ previousElements = getBlockNodes(block.clone);
+ $animate.leave(previousElements).then(function() {
+ previousElements = null;
+ });
+ block = null;
+ }
+ }
+ });
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngInclude
+ * @restrict ECA
+ *
+ * @description
+ * Fetches, compiles and includes an external HTML fragment.
+ *
+ * By default, the template URL is restricted to the same domain and protocol as the
+ * application document. This is done by calling {@link $sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols
+ * you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist them} or
+ * {@link $sce#trustAsResourceUrl wrap them} as trusted values. Refer to Angular's {@link
+ * ng.$sce Strict Contextual Escaping}.
+ *
+ * In addition, the browser's
+ * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+ * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
+ * policy may further restrict whether the template is successfully loaded.
+ * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://`
+ * access on some browsers.
+ *
+ * @animations
+ * enter - animation is used to bring new content into the browser.
+ * leave - animation is used to animate existing content away.
+ *
+ * The enter and leave animation occur concurrently.
+ *
+ * @scope
+ * @priority 400
+ *
+ * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,
+ * make sure you wrap it in **single** quotes, e.g. `src="'myPartialTemplate.html'"`.
+ * @param {string=} onload Expression to evaluate when a new partial is loaded.
+ * <div class="alert alert-warning">
+ * **Note:** When using onload on SVG elements in IE11, the browser will try to call
+ * a function with the name on the window element, which will usually throw a
+ * "function is undefined" error. To fix this, you can instead use `data-onload` or a
+ * different form that {@link guide/directive#normalization matches} `onload`.
+ * </div>
+ *
+ * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll
+ * $anchorScroll} to scroll the viewport after the content is loaded.
+ *
+ * - If the attribute is not set, disable scrolling.
+ * - If the attribute is set without value, enable scrolling.
+ * - Otherwise enable scrolling only if the expression evaluates to truthy value.
+ *
+ * @example
+ <example module="includeExample" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <select ng-model="template" ng-options="t.name for t in templates">
+ <option value="">(blank)</option>
+ </select>
+ url of the template: <code>{{template.url}}</code>
+ <hr/>
+ <div class="slide-animate-container">
+ <div class="slide-animate" ng-include="template.url"></div>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('includeExample', ['ngAnimate'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.templates =
+ [ { name: 'template1.html', url: 'template1.html'},
+ { name: 'template2.html', url: 'template2.html'} ];
+ $scope.template = $scope.templates[0];
+ }]);
+ </file>
+ <file name="template1.html">
+ Content of template1.html
+ </file>
+ <file name="template2.html">
+ Content of template2.html
+ </file>
+ <file name="animations.css">
+ .slide-animate-container {
+ position:relative;
+ background:white;
+ border:1px solid black;
+ height:40px;
+ overflow:hidden;
+ }
+
+ .slide-animate {
+ padding:10px;
+ }
+
+ .slide-animate.ng-enter, .slide-animate.ng-leave {
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+
+ position:absolute;
+ top:0;
+ left:0;
+ right:0;
+ bottom:0;
+ display:block;
+ padding:10px;
+ }
+
+ .slide-animate.ng-enter {
+ top:-50px;
+ }
+ .slide-animate.ng-enter.ng-enter-active {
+ top:0;
+ }
+
+ .slide-animate.ng-leave {
+ top:0;
+ }
+ .slide-animate.ng-leave.ng-leave-active {
+ top:50px;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var templateSelect = element(by.model('template'));
+ var includeElem = element(by.css('[ng-include]'));
+
+ it('should load template1.html', function() {
+ expect(includeElem.getText()).toMatch(/Content of template1.html/);
+ });
+
+ it('should load template2.html', function() {
+ if (browser.params.browser == 'firefox') {
+ // Firefox can't handle using selects
+ // See https://github.com/angular/protractor/issues/480
+ return;
+ }
+ templateSelect.click();
+ templateSelect.all(by.css('option')).get(2).click();
+ expect(includeElem.getText()).toMatch(/Content of template2.html/);
+ });
+
+ it('should change to blank', function() {
+ if (browser.params.browser == 'firefox') {
+ // Firefox can't handle using selects
+ return;
+ }
+ templateSelect.click();
+ templateSelect.all(by.css('option')).get(0).click();
+ expect(includeElem.isPresent()).toBe(false);
+ });
+ </file>
+ </example>
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentRequested
+ * @eventType emit on the scope ngInclude was declared in
+ * @description
+ * Emitted every time the ngInclude content is requested.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {String} src URL of content to load.
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentLoaded
+ * @eventType emit on the current ngInclude scope
+ * @description
+ * Emitted every time the ngInclude content is reloaded.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {String} src URL of content to load.
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentError
+ * @eventType emit on the scope ngInclude was declared in
+ * @description
+ * Emitted when a template HTTP request yields an erroneous response (status < 200 || status > 299)
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {String} src URL of content to load.
+ */
+var ngIncludeDirective = ['$templateRequest', '$anchorScroll', '$animate',
+ function($templateRequest, $anchorScroll, $animate) {
+ return {
+ restrict: 'ECA',
+ priority: 400,
+ terminal: true,
+ transclude: 'element',
+ controller: angular.noop,
+ compile: function(element, attr) {
+ var srcExp = attr.ngInclude || attr.src,
+ onloadExp = attr.onload || '',
+ autoScrollExp = attr.autoscroll;
+
+ return function(scope, $element, $attr, ctrl, $transclude) {
+ var changeCounter = 0,
+ currentScope,
+ previousElement,
+ currentElement;
+
+ var cleanupLastIncludeContent = function() {
+ if (previousElement) {
+ previousElement.remove();
+ previousElement = null;
+ }
+ if (currentScope) {
+ currentScope.$destroy();
+ currentScope = null;
+ }
+ if (currentElement) {
+ $animate.leave(currentElement).then(function() {
+ previousElement = null;
+ });
+ previousElement = currentElement;
+ currentElement = null;
+ }
+ };
+
+ scope.$watch(srcExp, function ngIncludeWatchAction(src) {
+ var afterAnimation = function() {
+ if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {
+ $anchorScroll();
+ }
+ };
+ var thisChangeId = ++changeCounter;
+
+ if (src) {
+ //set the 2nd param to true to ignore the template request error so that the inner
+ //contents and scope can be cleaned up.
+ $templateRequest(src, true).then(function(response) {
+ if (thisChangeId !== changeCounter) return;
+ var newScope = scope.$new();
+ ctrl.template = response;
+
+ // Note: This will also link all children of ng-include that were contained in the original
+ // html. If that content contains controllers, ... they could pollute/change the scope.
+ // However, using ng-include on an element with additional content does not make sense...
+ // Note: We can't remove them in the cloneAttchFn of $transclude as that
+ // function is called before linking the content, which would apply child
+ // directives to non existing elements.
+ var clone = $transclude(newScope, function(clone) {
+ cleanupLastIncludeContent();
+ $animate.enter(clone, null, $element).then(afterAnimation);
+ });
+
+ currentScope = newScope;
+ currentElement = clone;
+
+ currentScope.$emit('$includeContentLoaded', src);
+ scope.$eval(onloadExp);
+ }, function() {
+ if (thisChangeId === changeCounter) {
+ cleanupLastIncludeContent();
+ scope.$emit('$includeContentError', src);
+ }
+ });
+ scope.$emit('$includeContentRequested', src);
+ } else {
+ cleanupLastIncludeContent();
+ ctrl.template = null;
+ }
+ });
+ };
+ }
+ };
+}];
+
+// This directive is called during the $transclude call of the first `ngInclude` directive.
+// It will replace and compile the content of the element with the loaded template.
+// We need this directive so that the element content is already filled when
+// the link function of another directive on the same element as ngInclude
+// is called.
+var ngIncludeFillContentDirective = ['$compile',
+ function($compile) {
+ return {
+ restrict: 'ECA',
+ priority: -400,
+ require: 'ngInclude',
+ link: function(scope, $element, $attr, ctrl) {
+ if (/SVG/.test($element[0].toString())) {
+ // WebKit: https://bugs.webkit.org/show_bug.cgi?id=135698 --- SVG elements do not
+ // support innerHTML, so detect this here and try to generate the contents
+ // specially.
+ $element.empty();
+ $compile(jqLiteBuildFragment(ctrl.template, document).childNodes)(scope,
+ function namespaceAdaptedClone(clone) {
+ $element.append(clone);
+ }, {futureParentElement: $element});
+ return;
+ }
+
+ $element.html(ctrl.template);
+ $compile($element.contents())(scope);
+ }
+ };
+ }];
+
+/**
+ * @ngdoc directive
+ * @name ngInit
+ * @restrict AC
+ *
+ * @description
+ * The `ngInit` directive allows you to evaluate an expression in the
+ * current scope.
+ *
+ * <div class="alert alert-danger">
+ * This directive can be abused to add unnecessary amounts of logic into your templates.
+ * There are only a few appropriate uses of `ngInit`, such as for aliasing special properties of
+ * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below; and for injecting data via
+ * server side scripting. Besides these few cases, you should use {@link guide/controller controllers}
+ * rather than `ngInit` to initialize values on a scope.
+ * </div>
+ *
+ * <div class="alert alert-warning">
+ * **Note**: If you have assignment in `ngInit` along with a {@link ng.$filter `filter`}, make
+ * sure you have parentheses to ensure correct operator precedence:
+ * <pre class="prettyprint">
+ * `<div ng-init="test1 = ($index | toString)"></div>`
+ * </pre>
+ * </div>
+ *
+ * @priority 450
+ *
+ * @element ANY
+ * @param {expression} ngInit {@link guide/expression Expression} to eval.
+ *
+ * @example
+ <example module="initExample">
+ <file name="index.html">
+ <script>
+ angular.module('initExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.list = [['a', 'b'], ['c', 'd']];
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <div ng-repeat="innerList in list" ng-init="outerIndex = $index">
+ <div ng-repeat="value in innerList" ng-init="innerIndex = $index">
+ <span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
+ </div>
+ </div>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should alias index positions', function() {
+ var elements = element.all(by.css('.example-init'));
+ expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;');
+ expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;');
+ expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;');
+ expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;');
+ });
+ </file>
+ </example>
+ */
+var ngInitDirective = ngDirective({
+ priority: 450,
+ compile: function() {
+ return {
+ pre: function(scope, element, attrs) {
+ scope.$eval(attrs.ngInit);
+ }
+ };
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngList
+ *
+ * @description
+ * Text input that converts between a delimited string and an array of strings. The default
+ * delimiter is a comma followed by a space - equivalent to `ng-list=", "`. You can specify a custom
+ * delimiter as the value of the `ngList` attribute - for example, `ng-list=" | "`.
+ *
+ * The behaviour of the directive is affected by the use of the `ngTrim` attribute.
+ * * If `ngTrim` is set to `"false"` then whitespace around both the separator and each
+ * list item is respected. This implies that the user of the directive is responsible for
+ * dealing with whitespace but also allows you to use whitespace as a delimiter, such as a
+ * tab or newline character.
+ * * Otherwise whitespace around the delimiter is ignored when splitting (although it is respected
+ * when joining the list items back together) and whitespace around each list item is stripped
+ * before it is added to the model.
+ *
+ * ### Example with Validation
+ *
+ * <example name="ngList-directive" module="listExample">
+ * <file name="app.js">
+ * angular.module('listExample', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.names = ['morpheus', 'neo', 'trinity'];
+ * }]);
+ * </file>
+ * <file name="index.html">
+ * <form name="myForm" ng-controller="ExampleController">
+ * <label>List: <input name="namesInput" ng-model="names" ng-list required></label>
+ * <span role="alert">
+ * <span class="error" ng-show="myForm.namesInput.$error.required">
+ * Required!</span>
+ * </span>
+ * <br>
+ * <tt>names = {{names}}</tt><br/>
+ * <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>
+ * <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>
+ * <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ * <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ * </form>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * var listInput = element(by.model('names'));
+ * var names = element(by.exactBinding('names'));
+ * var valid = element(by.binding('myForm.namesInput.$valid'));
+ * var error = element(by.css('span.error'));
+ *
+ * it('should initialize to model', function() {
+ * expect(names.getText()).toContain('["morpheus","neo","trinity"]');
+ * expect(valid.getText()).toContain('true');
+ * expect(error.getCssValue('display')).toBe('none');
+ * });
+ *
+ * it('should be invalid if empty', function() {
+ * listInput.clear();
+ * listInput.sendKeys('');
+ *
+ * expect(names.getText()).toContain('');
+ * expect(valid.getText()).toContain('false');
+ * expect(error.getCssValue('display')).not.toBe('none');
+ * });
+ * </file>
+ * </example>
+ *
+ * ### Example - splitting on newline
+ * <example name="ngList-directive-newlines">
+ * <file name="index.html">
+ * <textarea ng-model="list" ng-list="&#10;" ng-trim="false"></textarea>
+ * <pre>{{ list | json }}</pre>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it("should split the text by newlines", function() {
+ * var listInput = element(by.model('list'));
+ * var output = element(by.binding('list | json'));
+ * listInput.sendKeys('abc\ndef\nghi');
+ * expect(output.getText()).toContain('[\n "abc",\n "def",\n "ghi"\n]');
+ * });
+ * </file>
+ * </example>
+ *
+ * @element input
+ * @param {string=} ngList optional delimiter that should be used to split the value.
+ */
+var ngListDirective = function() {
+ return {
+ restrict: 'A',
+ priority: 100,
+ require: 'ngModel',
+ link: function(scope, element, attr, ctrl) {
+ // We want to control whitespace trimming so we use this convoluted approach
+ // to access the ngList attribute, which doesn't pre-trim the attribute
+ var ngList = element.attr(attr.$attr.ngList) || ', ';
+ var trimValues = attr.ngTrim !== 'false';
+ var separator = trimValues ? trim(ngList) : ngList;
+
+ var parse = function(viewValue) {
+ // If the viewValue is invalid (say required but empty) it will be `undefined`
+ if (isUndefined(viewValue)) return;
+
+ var list = [];
+
+ if (viewValue) {
+ forEach(viewValue.split(separator), function(value) {
+ if (value) list.push(trimValues ? trim(value) : value);
+ });
+ }
+
+ return list;
+ };
+
+ ctrl.$parsers.push(parse);
+ ctrl.$formatters.push(function(value) {
+ if (isArray(value)) {
+ return value.join(ngList);
+ }
+
+ return undefined;
+ });
+
+ // Override the standard $isEmpty because an empty array means the input is empty.
+ ctrl.$isEmpty = function(value) {
+ return !value || !value.length;
+ };
+ }
+ };
+};
+
+/* global VALID_CLASS: true,
+ INVALID_CLASS: true,
+ PRISTINE_CLASS: true,
+ DIRTY_CLASS: true,
+ UNTOUCHED_CLASS: true,
+ TOUCHED_CLASS: true,
+*/
+
+var VALID_CLASS = 'ng-valid',
+ INVALID_CLASS = 'ng-invalid',
+ PRISTINE_CLASS = 'ng-pristine',
+ DIRTY_CLASS = 'ng-dirty',
+ UNTOUCHED_CLASS = 'ng-untouched',
+ TOUCHED_CLASS = 'ng-touched',
+ PENDING_CLASS = 'ng-pending',
+ EMPTY_CLASS = 'ng-empty',
+ NOT_EMPTY_CLASS = 'ng-not-empty';
+
+var ngModelMinErr = minErr('ngModel');
+
+/**
+ * @ngdoc type
+ * @name ngModel.NgModelController
+ *
+ * @property {*} $viewValue The actual value from the control's view. For `input` elements, this is a
+ * String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue
+ * is set.
+ * @property {*} $modelValue The value in the model that the control is bound to.
+ * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever
+ the control reads value from the DOM. The functions are called in array order, each passing
+ its return value through to the next. The last return value is forwarded to the
+ {@link ngModel.NgModelController#$validators `$validators`} collection.
+
+Parsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue
+`$viewValue`}.
+
+Returning `undefined` from a parser means a parse error occurred. In that case,
+no {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel`
+will be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`}
+is set to `true`. The parse error is stored in `ngModel.$error.parse`.
+
+ *
+ * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever
+ the model value changes. The functions are called in reverse array order, each passing the value through to the
+ next. The last return value is used as the actual DOM value.
+ Used to format / convert values for display in the control.
+ * ```js
+ * function formatter(value) {
+ * if (value) {
+ * return value.toUpperCase();
+ * }
+ * }
+ * ngModel.$formatters.push(formatter);
+ * ```
+ *
+ * @property {Object.<string, function>} $validators A collection of validators that are applied
+ * whenever the model value changes. The key value within the object refers to the name of the
+ * validator while the function refers to the validation operation. The validation operation is
+ * provided with the model value as an argument and must return a true or false value depending
+ * on the response of that validation.
+ *
+ * ```js
+ * ngModel.$validators.validCharacters = function(modelValue, viewValue) {
+ * var value = modelValue || viewValue;
+ * return /[0-9]+/.test(value) &&
+ * /[a-z]+/.test(value) &&
+ * /[A-Z]+/.test(value) &&
+ * /\W+/.test(value);
+ * };
+ * ```
+ *
+ * @property {Object.<string, function>} $asyncValidators A collection of validations that are expected to
+ * perform an asynchronous validation (e.g. a HTTP request). The validation function that is provided
+ * is expected to return a promise when it is run during the model validation process. Once the promise
+ * is delivered then the validation status will be set to true when fulfilled and false when rejected.
+ * When the asynchronous validators are triggered, each of the validators will run in parallel and the model
+ * value will only be updated once all validators have been fulfilled. As long as an asynchronous validator
+ * is unfulfilled, its key will be added to the controllers `$pending` property. Also, all asynchronous validators
+ * will only run once all synchronous validators have passed.
+ *
+ * Please note that if $http is used then it is important that the server returns a success HTTP response code
+ * in order to fulfill the validation and a status level of `4xx` in order to reject the validation.
+ *
+ * ```js
+ * ngModel.$asyncValidators.uniqueUsername = function(modelValue, viewValue) {
+ * var value = modelValue || viewValue;
+ *
+ * // Lookup user by username
+ * return $http.get('/api/users/' + value).
+ * then(function resolved() {
+ * //username exists, this means validation fails
+ * return $q.reject('exists');
+ * }, function rejected() {
+ * //username does not exist, therefore this validation passes
+ * return true;
+ * });
+ * };
+ * ```
+ *
+ * @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the
+ * view value has changed. It is called with no arguments, and its return value is ignored.
+ * This can be used in place of additional $watches against the model value.
+ *
+ * @property {Object} $error An object hash with all failing validator ids as keys.
+ * @property {Object} $pending An object hash with all pending validator ids as keys.
+ *
+ * @property {boolean} $untouched True if control has not lost focus yet.
+ * @property {boolean} $touched True if control has lost focus.
+ * @property {boolean} $pristine True if user has not interacted with the control yet.
+ * @property {boolean} $dirty True if user has already interacted with the control.
+ * @property {boolean} $valid True if there is no error.
+ * @property {boolean} $invalid True if at least one error on the control.
+ * @property {string} $name The name attribute of the control.
+ *
+ * @description
+ *
+ * `NgModelController` provides API for the {@link ngModel `ngModel`} directive.
+ * The controller contains services for data-binding, validation, CSS updates, and value formatting
+ * and parsing. It purposefully does not contain any logic which deals with DOM rendering or
+ * listening to DOM events.
+ * Such DOM related logic should be provided by other directives which make use of
+ * `NgModelController` for data-binding to control elements.
+ * Angular provides this DOM logic for most {@link input `input`} elements.
+ * At the end of this page you can find a {@link ngModel.NgModelController#custom-control-example
+ * custom control example} that uses `ngModelController` to bind to `contenteditable` elements.
+ *
+ * @example
+ * ### Custom Control Example
+ * This example shows how to use `NgModelController` with a custom control to achieve
+ * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)
+ * collaborate together to achieve the desired result.
+ *
+ * `contenteditable` is an HTML5 attribute, which tells the browser to let the element
+ * contents be edited in place by the user.
+ *
+ * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize}
+ * module to automatically remove "bad" content like inline event listener (e.g. `<span onclick="...">`).
+ * However, as we are using `$sce` the model can still decide to provide unsafe content if it marks
+ * that content using the `$sce` service.
+ *
+ * <example name="NgModelController" module="customControl" deps="angular-sanitize.js">
+ <file name="style.css">
+ [contenteditable] {
+ border: 1px solid black;
+ background-color: white;
+ min-height: 20px;
+ }
+
+ .ng-invalid {
+ border: 1px solid red;
+ }
+
+ </file>
+ <file name="script.js">
+ angular.module('customControl', ['ngSanitize']).
+ directive('contenteditable', ['$sce', function($sce) {
+ return {
+ restrict: 'A', // only activate on element attribute
+ require: '?ngModel', // get a hold of NgModelController
+ link: function(scope, element, attrs, ngModel) {
+ if (!ngModel) return; // do nothing if no ng-model
+
+ // Specify how UI should be updated
+ ngModel.$render = function() {
+ element.html($sce.getTrustedHtml(ngModel.$viewValue || ''));
+ };
+
+ // Listen for change events to enable binding
+ element.on('blur keyup change', function() {
+ scope.$evalAsync(read);
+ });
+ read(); // initialize
+
+ // Write data to the model
+ function read() {
+ var html = element.html();
+ // When we clear the content editable the browser leaves a <br> behind
+ // If strip-br attribute is provided then we strip this out
+ if ( attrs.stripBr && html == '<br>' ) {
+ html = '';
+ }
+ ngModel.$setViewValue(html);
+ }
+ }
+ };
+ }]);
+ </file>
+ <file name="index.html">
+ <form name="myForm">
+ <div contenteditable
+ name="myWidget" ng-model="userContent"
+ strip-br="true"
+ required>Change me!</div>
+ <span ng-show="myForm.myWidget.$error.required">Required!</span>
+ <hr>
+ <textarea ng-model="userContent" aria-label="Dynamic textarea"></textarea>
+ </form>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should data-bind and become invalid', function() {
+ if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') {
+ // SafariDriver can't handle contenteditable
+ // and Firefox driver can't clear contenteditables very well
+ return;
+ }
+ var contentEditable = element(by.css('[contenteditable]'));
+ var content = 'Change me!';
+
+ expect(contentEditable.getText()).toEqual(content);
+
+ contentEditable.clear();
+ contentEditable.sendKeys(protractor.Key.BACK_SPACE);
+ expect(contentEditable.getText()).toEqual('');
+ expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/);
+ });
+ </file>
+ * </example>
+ *
+ *
+ */
+var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$rootScope', '$q', '$interpolate',
+ function($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $rootScope, $q, $interpolate) {
+ this.$viewValue = Number.NaN;
+ this.$modelValue = Number.NaN;
+ this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity.
+ this.$validators = {};
+ this.$asyncValidators = {};
+ this.$parsers = [];
+ this.$formatters = [];
+ this.$viewChangeListeners = [];
+ this.$untouched = true;
+ this.$touched = false;
+ this.$pristine = true;
+ this.$dirty = false;
+ this.$valid = true;
+ this.$invalid = false;
+ this.$error = {}; // keep invalid keys here
+ this.$$success = {}; // keep valid keys here
+ this.$pending = undefined; // keep pending keys here
+ this.$name = $interpolate($attr.name || '', false)($scope);
+ this.$$parentForm = nullFormCtrl;
+
+ var parsedNgModel = $parse($attr.ngModel),
+ parsedNgModelAssign = parsedNgModel.assign,
+ ngModelGet = parsedNgModel,
+ ngModelSet = parsedNgModelAssign,
+ pendingDebounce = null,
+ parserValid,
+ ctrl = this;
+
+ this.$$setOptions = function(options) {
+ ctrl.$options = options;
+ if (options && options.getterSetter) {
+ var invokeModelGetter = $parse($attr.ngModel + '()'),
+ invokeModelSetter = $parse($attr.ngModel + '($$$p)');
+
+ ngModelGet = function($scope) {
+ var modelValue = parsedNgModel($scope);
+ if (isFunction(modelValue)) {
+ modelValue = invokeModelGetter($scope);
+ }
+ return modelValue;
+ };
+ ngModelSet = function($scope, newValue) {
+ if (isFunction(parsedNgModel($scope))) {
+ invokeModelSetter($scope, {$$$p: ctrl.$modelValue});
+ } else {
+ parsedNgModelAssign($scope, ctrl.$modelValue);
+ }
+ };
+ } else if (!parsedNgModel.assign) {
+ throw ngModelMinErr('nonassign', "Expression '{0}' is non-assignable. Element: {1}",
+ $attr.ngModel, startingTag($element));
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$render
+ *
+ * @description
+ * Called when the view needs to be updated. It is expected that the user of the ng-model
+ * directive will implement this method.
+ *
+ * The `$render()` method is invoked in the following situations:
+ *
+ * * `$rollbackViewValue()` is called. If we are rolling back the view value to the last
+ * committed value then `$render()` is called to update the input control.
+ * * The value referenced by `ng-model` is changed programmatically and both the `$modelValue` and
+ * the `$viewValue` are different from last time.
+ *
+ * Since `ng-model` does not do a deep watch, `$render()` is only invoked if the values of
+ * `$modelValue` and `$viewValue` are actually different from their previous value. If `$modelValue`
+ * or `$viewValue` are objects (rather than a string or number) then `$render()` will not be
+ * invoked if you only change a property on the objects.
+ */
+ this.$render = noop;
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$isEmpty
+ *
+ * @description
+ * This is called when we need to determine if the value of an input is empty.
+ *
+ * For instance, the required directive does this to work out if the input has data or not.
+ *
+ * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.
+ *
+ * You can override this for input directives whose concept of being empty is different from the
+ * default. The `checkboxInputType` directive does this because in its case a value of `false`
+ * implies empty.
+ *
+ * @param {*} value The value of the input to check for emptiness.
+ * @returns {boolean} True if `value` is "empty".
+ */
+ this.$isEmpty = function(value) {
+ return isUndefined(value) || value === '' || value === null || value !== value;
+ };
+
+ this.$$updateEmptyClasses = function(value) {
+ if (ctrl.$isEmpty(value)) {
+ $animate.removeClass($element, NOT_EMPTY_CLASS);
+ $animate.addClass($element, EMPTY_CLASS);
+ } else {
+ $animate.removeClass($element, EMPTY_CLASS);
+ $animate.addClass($element, NOT_EMPTY_CLASS);
+ }
+ };
+
+
+ var currentValidationRunId = 0;
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setValidity
+ *
+ * @description
+ * Change the validity state, and notify the form.
+ *
+ * This method can be called within $parsers/$formatters or a custom validation implementation.
+ * However, in most cases it should be sufficient to use the `ngModel.$validators` and
+ * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically.
+ *
+ * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned
+ * to either `$error[validationErrorKey]` or `$pending[validationErrorKey]`
+ * (for unfulfilled `$asyncValidators`), so that it is available for data-binding.
+ * The `validationErrorKey` should be in camelCase and will get converted into dash-case
+ * for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`
+ * class and can be bound to as `{{someForm.someControl.$error.myError}}` .
+ * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined),
+ * or skipped (null). Pending is used for unfulfilled `$asyncValidators`.
+ * Skipped is used by Angular when validators do not run because of parse errors and
+ * when `$asyncValidators` do not run because any of the `$validators` failed.
+ */
+ addSetValidityMethod({
+ ctrl: this,
+ $element: $element,
+ set: function(object, property) {
+ object[property] = true;
+ },
+ unset: function(object, property) {
+ delete object[property];
+ },
+ $animate: $animate
+ });
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setPristine
+ *
+ * @description
+ * Sets the control to its pristine state.
+ *
+ * This method can be called to remove the `ng-dirty` class and set the control to its pristine
+ * state (`ng-pristine` class). A model is considered to be pristine when the control
+ * has not been changed from when first compiled.
+ */
+ this.$setPristine = function() {
+ ctrl.$dirty = false;
+ ctrl.$pristine = true;
+ $animate.removeClass($element, DIRTY_CLASS);
+ $animate.addClass($element, PRISTINE_CLASS);
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setDirty
+ *
+ * @description
+ * Sets the control to its dirty state.
+ *
+ * This method can be called to remove the `ng-pristine` class and set the control to its dirty
+ * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed
+ * from when first compiled.
+ */
+ this.$setDirty = function() {
+ ctrl.$dirty = true;
+ ctrl.$pristine = false;
+ $animate.removeClass($element, PRISTINE_CLASS);
+ $animate.addClass($element, DIRTY_CLASS);
+ ctrl.$$parentForm.$setDirty();
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setUntouched
+ *
+ * @description
+ * Sets the control to its untouched state.
+ *
+ * This method can be called to remove the `ng-touched` class and set the control to its
+ * untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched
+ * by default, however this function can be used to restore that state if the model has
+ * already been touched by the user.
+ */
+ this.$setUntouched = function() {
+ ctrl.$touched = false;
+ ctrl.$untouched = true;
+ $animate.setClass($element, UNTOUCHED_CLASS, TOUCHED_CLASS);
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setTouched
+ *
+ * @description
+ * Sets the control to its touched state.
+ *
+ * This method can be called to remove the `ng-untouched` class and set the control to its
+ * touched state (`ng-touched` class). A model is considered to be touched when the user has
+ * first focused the control element and then shifted focus away from the control (blur event).
+ */
+ this.$setTouched = function() {
+ ctrl.$touched = true;
+ ctrl.$untouched = false;
+ $animate.setClass($element, TOUCHED_CLASS, UNTOUCHED_CLASS);
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$rollbackViewValue
+ *
+ * @description
+ * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`,
+ * which may be caused by a pending debounced event or because the input is waiting for a some
+ * future event.
+ *
+ * If you have an input that uses `ng-model-options` to set up debounced events or events such
+ * as blur you can have a situation where there is a period when the `$viewValue`
+ * is out of synch with the ngModel's `$modelValue`.
+ *
+ * In this case, you can run into difficulties if you try to update the ngModel's `$modelValue`
+ * programmatically before these debounced/future events have resolved/occurred, because Angular's
+ * dirty checking mechanism is not able to tell whether the model has actually changed or not.
+ *
+ * The `$rollbackViewValue()` method should be called before programmatically changing the model of an
+ * input which may have such events pending. This is important in order to make sure that the
+ * input field will be updated with the new model value and any pending operations are cancelled.
+ *
+ * <example name="ng-model-cancel-update" module="cancel-update-example">
+ * <file name="app.js">
+ * angular.module('cancel-update-example', [])
+ *
+ * .controller('CancelUpdateController', ['$scope', function($scope) {
+ * $scope.resetWithCancel = function(e) {
+ * if (e.keyCode == 27) {
+ * $scope.myForm.myInput1.$rollbackViewValue();
+ * $scope.myValue = '';
+ * }
+ * };
+ * $scope.resetWithoutCancel = function(e) {
+ * if (e.keyCode == 27) {
+ * $scope.myValue = '';
+ * }
+ * };
+ * }]);
+ * </file>
+ * <file name="index.html">
+ * <div ng-controller="CancelUpdateController">
+ * <p>Try typing something in each input. See that the model only updates when you
+ * blur off the input.
+ * </p>
+ * <p>Now see what happens if you start typing then press the Escape key</p>
+ *
+ * <form name="myForm" ng-model-options="{ updateOn: 'blur' }">
+ * <p id="inputDescription1">With $rollbackViewValue()</p>
+ * <input name="myInput1" aria-describedby="inputDescription1" ng-model="myValue"
+ * ng-keydown="resetWithCancel($event)"><br/>
+ * myValue: "{{ myValue }}"
+ *
+ * <p id="inputDescription2">Without $rollbackViewValue()</p>
+ * <input name="myInput2" aria-describedby="inputDescription2" ng-model="myValue"
+ * ng-keydown="resetWithoutCancel($event)"><br/>
+ * myValue: "{{ myValue }}"
+ * </form>
+ * </div>
+ * </file>
+ * </example>
+ */
+ this.$rollbackViewValue = function() {
+ $timeout.cancel(pendingDebounce);
+ ctrl.$viewValue = ctrl.$$lastCommittedViewValue;
+ ctrl.$render();
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$validate
+ *
+ * @description
+ * Runs each of the registered validators (first synchronous validators and then
+ * asynchronous validators).
+ * If the validity changes to invalid, the model will be set to `undefined`,
+ * unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.
+ * If the validity changes to valid, it will set the model to the last available valid
+ * `$modelValue`, i.e. either the last parsed value or the last value set from the scope.
+ */
+ this.$validate = function() {
+ // ignore $validate before model is initialized
+ if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {
+ return;
+ }
+
+ var viewValue = ctrl.$$lastCommittedViewValue;
+ // Note: we use the $$rawModelValue as $modelValue might have been
+ // set to undefined during a view -> model update that found validation
+ // errors. We can't parse the view here, since that could change
+ // the model although neither viewValue nor the model on the scope changed
+ var modelValue = ctrl.$$rawModelValue;
+
+ var prevValid = ctrl.$valid;
+ var prevModelValue = ctrl.$modelValue;
+
+ var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;
+
+ ctrl.$$runValidators(modelValue, viewValue, function(allValid) {
+ // If there was no change in validity, don't update the model
+ // This prevents changing an invalid modelValue to undefined
+ if (!allowInvalid && prevValid !== allValid) {
+ // Note: Don't check ctrl.$valid here, as we could have
+ // external validators (e.g. calculated on the server),
+ // that just call $setValidity and need the model value
+ // to calculate their validity.
+ ctrl.$modelValue = allValid ? modelValue : undefined;
+
+ if (ctrl.$modelValue !== prevModelValue) {
+ ctrl.$$writeModelToScope();
+ }
+ }
+ });
+
+ };
+
+ this.$$runValidators = function(modelValue, viewValue, doneCallback) {
+ currentValidationRunId++;
+ var localValidationRunId = currentValidationRunId;
+
+ // check parser error
+ if (!processParseErrors()) {
+ validationDone(false);
+ return;
+ }
+ if (!processSyncValidators()) {
+ validationDone(false);
+ return;
+ }
+ processAsyncValidators();
+
+ function processParseErrors() {
+ var errorKey = ctrl.$$parserName || 'parse';
+ if (isUndefined(parserValid)) {
+ setValidity(errorKey, null);
+ } else {
+ if (!parserValid) {
+ forEach(ctrl.$validators, function(v, name) {
+ setValidity(name, null);
+ });
+ forEach(ctrl.$asyncValidators, function(v, name) {
+ setValidity(name, null);
+ });
+ }
+ // Set the parse error last, to prevent unsetting it, should a $validators key == parserName
+ setValidity(errorKey, parserValid);
+ return parserValid;
+ }
+ return true;
+ }
+
+ function processSyncValidators() {
+ var syncValidatorsValid = true;
+ forEach(ctrl.$validators, function(validator, name) {
+ var result = validator(modelValue, viewValue);
+ syncValidatorsValid = syncValidatorsValid && result;
+ setValidity(name, result);
+ });
+ if (!syncValidatorsValid) {
+ forEach(ctrl.$asyncValidators, function(v, name) {
+ setValidity(name, null);
+ });
+ return false;
+ }
+ return true;
+ }
+
+ function processAsyncValidators() {
+ var validatorPromises = [];
+ var allValid = true;
+ forEach(ctrl.$asyncValidators, function(validator, name) {
+ var promise = validator(modelValue, viewValue);
+ if (!isPromiseLike(promise)) {
+ throw ngModelMinErr("$asyncValidators",
+ "Expected asynchronous validator to return a promise but got '{0}' instead.", promise);
+ }
+ setValidity(name, undefined);
+ validatorPromises.push(promise.then(function() {
+ setValidity(name, true);
+ }, function(error) {
+ allValid = false;
+ setValidity(name, false);
+ }));
+ });
+ if (!validatorPromises.length) {
+ validationDone(true);
+ } else {
+ $q.all(validatorPromises).then(function() {
+ validationDone(allValid);
+ }, noop);
+ }
+ }
+
+ function setValidity(name, isValid) {
+ if (localValidationRunId === currentValidationRunId) {
+ ctrl.$setValidity(name, isValid);
+ }
+ }
+
+ function validationDone(allValid) {
+ if (localValidationRunId === currentValidationRunId) {
+
+ doneCallback(allValid);
+ }
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$commitViewValue
+ *
+ * @description
+ * Commit a pending update to the `$modelValue`.
+ *
+ * Updates may be pending by a debounced event or because the input is waiting for a some future
+ * event defined in `ng-model-options`. this method is rarely needed as `NgModelController`
+ * usually handles calling this in response to input events.
+ */
+ this.$commitViewValue = function() {
+ var viewValue = ctrl.$viewValue;
+
+ $timeout.cancel(pendingDebounce);
+
+ // If the view value has not changed then we should just exit, except in the case where there is
+ // a native validator on the element. In this case the validation state may have changed even though
+ // the viewValue has stayed empty.
+ if (ctrl.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !ctrl.$$hasNativeValidators)) {
+ return;
+ }
+ ctrl.$$updateEmptyClasses(viewValue);
+ ctrl.$$lastCommittedViewValue = viewValue;
+
+ // change to dirty
+ if (ctrl.$pristine) {
+ this.$setDirty();
+ }
+ this.$$parseAndValidate();
+ };
+
+ this.$$parseAndValidate = function() {
+ var viewValue = ctrl.$$lastCommittedViewValue;
+ var modelValue = viewValue;
+ parserValid = isUndefined(modelValue) ? undefined : true;
+
+ if (parserValid) {
+ for (var i = 0; i < ctrl.$parsers.length; i++) {
+ modelValue = ctrl.$parsers[i](modelValue);
+ if (isUndefined(modelValue)) {
+ parserValid = false;
+ break;
+ }
+ }
+ }
+ if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {
+ // ctrl.$modelValue has not been touched yet...
+ ctrl.$modelValue = ngModelGet($scope);
+ }
+ var prevModelValue = ctrl.$modelValue;
+ var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;
+ ctrl.$$rawModelValue = modelValue;
+
+ if (allowInvalid) {
+ ctrl.$modelValue = modelValue;
+ writeToModelIfNeeded();
+ }
+
+ // Pass the $$lastCommittedViewValue here, because the cached viewValue might be out of date.
+ // This can happen if e.g. $setViewValue is called from inside a parser
+ ctrl.$$runValidators(modelValue, ctrl.$$lastCommittedViewValue, function(allValid) {
+ if (!allowInvalid) {
+ // Note: Don't check ctrl.$valid here, as we could have
+ // external validators (e.g. calculated on the server),
+ // that just call $setValidity and need the model value
+ // to calculate their validity.
+ ctrl.$modelValue = allValid ? modelValue : undefined;
+ writeToModelIfNeeded();
+ }
+ });
+
+ function writeToModelIfNeeded() {
+ if (ctrl.$modelValue !== prevModelValue) {
+ ctrl.$$writeModelToScope();
+ }
+ }
+ };
+
+ this.$$writeModelToScope = function() {
+ ngModelSet($scope, ctrl.$modelValue);
+ forEach(ctrl.$viewChangeListeners, function(listener) {
+ try {
+ listener();
+ } catch (e) {
+ $exceptionHandler(e);
+ }
+ });
+ };
+
+ /**
+ * @ngdoc method
+ * @name ngModel.NgModelController#$setViewValue
+ *
+ * @description
+ * Update the view value.
+ *
+ * This method should be called when a control wants to change the view value; typically,
+ * this is done from within a DOM event handler. For example, the {@link ng.directive:input input}
+ * directive calls it when the value of the input changes and {@link ng.directive:select select}
+ * calls it when an option is selected.
+ *
+ * When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers`
+ * and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged
+ * value sent directly for processing, finally to be applied to `$modelValue` and then the
+ * **expression** specified in the `ng-model` attribute. Lastly, all the registered change listeners,
+ * in the `$viewChangeListeners` list, are called.
+ *
+ * In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn`
+ * and the `default` trigger is not listed, all those actions will remain pending until one of the
+ * `updateOn` events is triggered on the DOM element.
+ * All these actions will be debounced if the {@link ng.directive:ngModelOptions ngModelOptions}
+ * directive is used with a custom debounce for this particular event.
+ * Note that a `$digest` is only triggered once the `updateOn` events are fired, or if `debounce`
+ * is specified, once the timer runs out.
+ *
+ * When used with standard inputs, the view value will always be a string (which is in some cases
+ * parsed into another type, such as a `Date` object for `input[date]`.)
+ * However, custom controls might also pass objects to this method. In this case, we should make
+ * a copy of the object before passing it to `$setViewValue`. This is because `ngModel` does not
+ * perform a deep watch of objects, it only looks for a change of identity. If you only change
+ * the property of the object then ngModel will not realise that the object has changed and
+ * will not invoke the `$parsers` and `$validators` pipelines. For this reason, you should
+ * not change properties of the copy once it has been passed to `$setViewValue`.
+ * Otherwise you may cause the model value on the scope to change incorrectly.
+ *
+ * <div class="alert alert-info">
+ * In any case, the value passed to the method should always reflect the current value
+ * of the control. For example, if you are calling `$setViewValue` for an input element,
+ * you should pass the input DOM value. Otherwise, the control and the scope model become
+ * out of sync. It's also important to note that `$setViewValue` does not call `$render` or change
+ * the control's DOM value in any way. If we want to change the control's DOM value
+ * programmatically, we should update the `ngModel` scope expression. Its new value will be
+ * picked up by the model controller, which will run it through the `$formatters`, `$render` it
+ * to update the DOM, and finally call `$validate` on it.
+ * </div>
+ *
+ * @param {*} value value from the view.
+ * @param {string} trigger Event that triggered the update.
+ */
+ this.$setViewValue = function(value, trigger) {
+ ctrl.$viewValue = value;
+ if (!ctrl.$options || ctrl.$options.updateOnDefault) {
+ ctrl.$$debounceViewValueCommit(trigger);
+ }
+ };
+
+ this.$$debounceViewValueCommit = function(trigger) {
+ var debounceDelay = 0,
+ options = ctrl.$options,
+ debounce;
+
+ if (options && isDefined(options.debounce)) {
+ debounce = options.debounce;
+ if (isNumber(debounce)) {
+ debounceDelay = debounce;
+ } else if (isNumber(debounce[trigger])) {
+ debounceDelay = debounce[trigger];
+ } else if (isNumber(debounce['default'])) {
+ debounceDelay = debounce['default'];
+ }
+ }
+
+ $timeout.cancel(pendingDebounce);
+ if (debounceDelay) {
+ pendingDebounce = $timeout(function() {
+ ctrl.$commitViewValue();
+ }, debounceDelay);
+ } else if ($rootScope.$$phase) {
+ ctrl.$commitViewValue();
+ } else {
+ $scope.$apply(function() {
+ ctrl.$commitViewValue();
+ });
+ }
+ };
+
+ // model -> value
+ // Note: we cannot use a normal scope.$watch as we want to detect the following:
+ // 1. scope value is 'a'
+ // 2. user enters 'b'
+ // 3. ng-change kicks in and reverts scope value to 'a'
+ // -> scope value did not change since the last digest as
+ // ng-change executes in apply phase
+ // 4. view should be changed back to 'a'
+ $scope.$watch(function ngModelWatch() {
+ var modelValue = ngModelGet($scope);
+
+ // if scope model value and ngModel value are out of sync
+ // TODO(perf): why not move this to the action fn?
+ if (modelValue !== ctrl.$modelValue &&
+ // checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator
+ (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue)
+ ) {
+ ctrl.$modelValue = ctrl.$$rawModelValue = modelValue;
+ parserValid = undefined;
+
+ var formatters = ctrl.$formatters,
+ idx = formatters.length;
+
+ var viewValue = modelValue;
+ while (idx--) {
+ viewValue = formatters[idx](viewValue);
+ }
+ if (ctrl.$viewValue !== viewValue) {
+ ctrl.$$updateEmptyClasses(viewValue);
+ ctrl.$viewValue = ctrl.$$lastCommittedViewValue = viewValue;
+ ctrl.$render();
+
+ ctrl.$$runValidators(modelValue, viewValue, noop);
+ }
+ }
+
+ return modelValue;
+ });
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngModel
+ *
+ * @element input
+ * @priority 1
+ *
+ * @description
+ * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a
+ * property on the scope using {@link ngModel.NgModelController NgModelController},
+ * which is created and exposed by this directive.
+ *
+ * `ngModel` is responsible for:
+ *
+ * - Binding the view into the model, which other directives such as `input`, `textarea` or `select`
+ * require.
+ * - Providing validation behavior (i.e. required, number, email, url).
+ * - Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors).
+ * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`,
+ * `ng-untouched`, `ng-empty`, `ng-not-empty`) including animations.
+ * - Registering the control with its parent {@link ng.directive:form form}.
+ *
+ * Note: `ngModel` will try to bind to the property given by evaluating the expression on the
+ * current scope. If the property doesn't already exist on this scope, it will be created
+ * implicitly and added to the scope.
+ *
+ * For best practices on using `ngModel`, see:
+ *
+ * - [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes)
+ *
+ * For basic examples, how to use `ngModel`, see:
+ *
+ * - {@link ng.directive:input input}
+ * - {@link input[text] text}
+ * - {@link input[checkbox] checkbox}
+ * - {@link input[radio] radio}
+ * - {@link input[number] number}
+ * - {@link input[email] email}
+ * - {@link input[url] url}
+ * - {@link input[date] date}
+ * - {@link input[datetime-local] datetime-local}
+ * - {@link input[time] time}
+ * - {@link input[month] month}
+ * - {@link input[week] week}
+ * - {@link ng.directive:select select}
+ * - {@link ng.directive:textarea textarea}
+ *
+ * # CSS classes
+ * The following CSS classes are added and removed on the associated input/select/textarea element
+ * depending on the validity of the model.
+ *
+ * - `ng-valid`: the model is valid
+ * - `ng-invalid`: the model is invalid
+ * - `ng-valid-[key]`: for each valid key added by `$setValidity`
+ * - `ng-invalid-[key]`: for each invalid key added by `$setValidity`
+ * - `ng-pristine`: the control hasn't been interacted with yet
+ * - `ng-dirty`: the control has been interacted with
+ * - `ng-touched`: the control has been blurred
+ * - `ng-untouched`: the control hasn't been blurred
+ * - `ng-pending`: any `$asyncValidators` are unfulfilled
+ * - `ng-empty`: the view does not contain a value or the value is deemed "empty", as defined
+ * by the {@link ngModel.NgModelController#$isEmpty} method
+ * - `ng-not-empty`: the view contains a non-empty value
+ *
+ * Keep in mind that ngAnimate can detect each of these classes when added and removed.
+ *
+ * ## Animation Hooks
+ *
+ * Animations within models are triggered when any of the associated CSS classes are added and removed
+ * on the input element which is attached to the model. These classes include: `.ng-pristine`, `.ng-dirty`,
+ * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.
+ * The animations that are triggered within ngModel are similar to how they work in ngClass and
+ * animations can be hooked into using CSS transitions, keyframes as well as JS animations.
+ *
+ * The following example shows a simple way to utilize CSS transitions to style an input element
+ * that has been rendered as invalid after it has been validated:
+ *
+ * <pre>
+ * //be sure to include ngAnimate as a module to hook into more
+ * //advanced animations
+ * .my-input {
+ * transition:0.5s linear all;
+ * background: white;
+ * }
+ * .my-input.ng-invalid {
+ * background: red;
+ * color:white;
+ * }
+ * </pre>
+ *
+ * @example
+ * <example deps="angular-animate.js" animations="true" fixBase="true" module="inputExample">
+ <file name="index.html">
+ <script>
+ angular.module('inputExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.val = '1';
+ }]);
+ </script>
+ <style>
+ .my-input {
+ transition:all linear 0.5s;
+ background: transparent;
+ }
+ .my-input.ng-invalid {
+ color:white;
+ background: red;
+ }
+ </style>
+ <p id="inputDescription">
+ Update input to see transitions when valid/invalid.
+ Integer is a valid value.
+ </p>
+ <form name="testForm" ng-controller="ExampleController">
+ <input ng-model="val" ng-pattern="/^\d+$/" name="anim" class="my-input"
+ aria-describedby="inputDescription" />
+ </form>
+ </file>
+ * </example>
+ *
+ * ## Binding to a getter/setter
+ *
+ * Sometimes it's helpful to bind `ngModel` to a getter/setter function. A getter/setter is a
+ * function that returns a representation of the model when called with zero arguments, and sets
+ * the internal state of a model when called with an argument. It's sometimes useful to use this
+ * for models that have an internal representation that's different from what the model exposes
+ * to the view.
+ *
+ * <div class="alert alert-success">
+ * **Best Practice:** It's best to keep getters fast because Angular is likely to call them more
+ * frequently than other parts of your code.
+ * </div>
+ *
+ * You use this behavior by adding `ng-model-options="{ getterSetter: true }"` to an element that
+ * has `ng-model` attached to it. You can also add `ng-model-options="{ getterSetter: true }"` to
+ * a `<form>`, which will enable this behavior for all `<input>`s within it. See
+ * {@link ng.directive:ngModelOptions `ngModelOptions`} for more.
+ *
+ * The following example shows how to use `ngModel` with a getter/setter:
+ *
+ * @example
+ * <example name="ngModel-getter-setter" module="getterSetterExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form name="userForm">
+ <label>Name:
+ <input type="text" name="userName"
+ ng-model="user.name"
+ ng-model-options="{ getterSetter: true }" />
+ </label>
+ </form>
+ <pre>user.name = <span ng-bind="user.name()"></span></pre>
+ </div>
+ </file>
+ <file name="app.js">
+ angular.module('getterSetterExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ var _name = 'Brian';
+ $scope.user = {
+ name: function(newName) {
+ // Note that newName can be undefined for two reasons:
+ // 1. Because it is called as a getter and thus called with no arguments
+ // 2. Because the property should actually be set to undefined. This happens e.g. if the
+ // input is invalid
+ return arguments.length ? (_name = newName) : _name;
+ }
+ };
+ }]);
+ </file>
+ * </example>
+ */
+var ngModelDirective = ['$rootScope', function($rootScope) {
+ return {
+ restrict: 'A',
+ require: ['ngModel', '^?form', '^?ngModelOptions'],
+ controller: NgModelController,
+ // Prelink needs to run before any input directive
+ // so that we can set the NgModelOptions in NgModelController
+ // before anyone else uses it.
+ priority: 1,
+ compile: function ngModelCompile(element) {
+ // Setup initial state of the control
+ element.addClass(PRISTINE_CLASS).addClass(UNTOUCHED_CLASS).addClass(VALID_CLASS);
+
+ return {
+ pre: function ngModelPreLink(scope, element, attr, ctrls) {
+ var modelCtrl = ctrls[0],
+ formCtrl = ctrls[1] || modelCtrl.$$parentForm;
+
+ modelCtrl.$$setOptions(ctrls[2] && ctrls[2].$options);
+
+ // notify others, especially parent forms
+ formCtrl.$addControl(modelCtrl);
+
+ attr.$observe('name', function(newValue) {
+ if (modelCtrl.$name !== newValue) {
+ modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue);
+ }
+ });
+
+ scope.$on('$destroy', function() {
+ modelCtrl.$$parentForm.$removeControl(modelCtrl);
+ });
+ },
+ post: function ngModelPostLink(scope, element, attr, ctrls) {
+ var modelCtrl = ctrls[0];
+ if (modelCtrl.$options && modelCtrl.$options.updateOn) {
+ element.on(modelCtrl.$options.updateOn, function(ev) {
+ modelCtrl.$$debounceViewValueCommit(ev && ev.type);
+ });
+ }
+
+ element.on('blur', function(ev) {
+ if (modelCtrl.$touched) return;
+
+ if ($rootScope.$$phase) {
+ scope.$evalAsync(modelCtrl.$setTouched);
+ } else {
+ scope.$apply(modelCtrl.$setTouched);
+ }
+ });
+ }
+ };
+ }
+ };
+}];
+
+var DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/;
+
+/**
+ * @ngdoc directive
+ * @name ngModelOptions
+ *
+ * @description
+ * Allows tuning how model updates are done. Using `ngModelOptions` you can specify a custom list of
+ * events that will trigger a model update and/or a debouncing delay so that the actual update only
+ * takes place when a timer expires; this timer will be reset after another change takes place.
+ *
+ * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might
+ * be different from the value in the actual model. This means that if you update the model you
+ * should also invoke {@link ngModel.NgModelController `$rollbackViewValue`} on the relevant input field in
+ * order to make sure it is synchronized with the model and that any debounced action is canceled.
+ *
+ * The easiest way to reference the control's {@link ngModel.NgModelController `$rollbackViewValue`}
+ * method is by making sure the input is placed inside a form that has a `name` attribute. This is
+ * important because `form` controllers are published to the related scope under the name in their
+ * `name` attribute.
+ *
+ * Any pending changes will take place immediately when an enclosing form is submitted via the
+ * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`
+ * to have access to the updated model.
+ *
+ * `ngModelOptions` has an effect on the element it's declared on and its descendants.
+ *
+ * @param {Object} ngModelOptions options to apply to the current model. Valid keys are:
+ * - `updateOn`: string specifying which event should the input be bound to. You can set several
+ * events using an space delimited list. There is a special event called `default` that
+ * matches the default events belonging of the control.
+ * - `debounce`: integer value which contains the debounce model update value in milliseconds. A
+ * value of 0 triggers an immediate update. If an object is supplied instead, you can specify a
+ * custom value for each event. For example:
+ * `ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 500, 'blur': 0 } }"`
+ * - `allowInvalid`: boolean value which indicates that the model can be set with values that did
+ * not validate correctly instead of the default behavior of setting the model to undefined.
+ * - `getterSetter`: boolean value which determines whether or not to treat functions bound to
+ `ngModel` as getters/setters.
+ * - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for
+ * `<input type="date">`, `<input type="time">`, ... . It understands UTC/GMT and the
+ * continental US time zone abbreviations, but for general use, use a time zone offset, for
+ * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
+ * If not specified, the timezone of the browser will be used.
+ *
+ * @example
+
+ The following example shows how to override immediate updates. Changes on the inputs within the
+ form will update the model only when the control loses focus (blur event). If `escape` key is
+ pressed while the input field is focused, the value is reset to the value in the current model.
+
+ <example name="ngModelOptions-directive-blur" module="optionsExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form name="userForm">
+ <label>Name:
+ <input type="text" name="userName"
+ ng-model="user.name"
+ ng-model-options="{ updateOn: 'blur' }"
+ ng-keyup="cancel($event)" />
+ </label><br />
+ <label>Other data:
+ <input type="text" ng-model="user.data" />
+ </label><br />
+ </form>
+ <pre>user.name = <span ng-bind="user.name"></span></pre>
+ <pre>user.data = <span ng-bind="user.data"></span></pre>
+ </div>
+ </file>
+ <file name="app.js">
+ angular.module('optionsExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.user = { name: 'John', data: '' };
+
+ $scope.cancel = function(e) {
+ if (e.keyCode == 27) {
+ $scope.userForm.userName.$rollbackViewValue();
+ }
+ };
+ }]);
+ </file>
+ <file name="protractor.js" type="protractor">
+ var model = element(by.binding('user.name'));
+ var input = element(by.model('user.name'));
+ var other = element(by.model('user.data'));
+
+ it('should allow custom events', function() {
+ input.sendKeys(' Doe');
+ input.click();
+ expect(model.getText()).toEqual('John');
+ other.click();
+ expect(model.getText()).toEqual('John Doe');
+ });
+
+ it('should $rollbackViewValue when model changes', function() {
+ input.sendKeys(' Doe');
+ expect(input.getAttribute('value')).toEqual('John Doe');
+ input.sendKeys(protractor.Key.ESCAPE);
+ expect(input.getAttribute('value')).toEqual('John');
+ other.click();
+ expect(model.getText()).toEqual('John');
+ });
+ </file>
+ </example>
+
+ This one shows how to debounce model changes. Model will be updated only 1 sec after last change.
+ If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.
+
+ <example name="ngModelOptions-directive-debounce" module="optionsExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form name="userForm">
+ <label>Name:
+ <input type="text" name="userName"
+ ng-model="user.name"
+ ng-model-options="{ debounce: 1000 }" />
+ </label>
+ <button ng-click="userForm.userName.$rollbackViewValue(); user.name=''">Clear</button>
+ <br />
+ </form>
+ <pre>user.name = <span ng-bind="user.name"></span></pre>
+ </div>
+ </file>
+ <file name="app.js">
+ angular.module('optionsExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.user = { name: 'Igor' };
+ }]);
+ </file>
+ </example>
+
+ This one shows how to bind to getter/setters:
+
+ <example name="ngModelOptions-directive-getter-setter" module="getterSetterExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form name="userForm">
+ <label>Name:
+ <input type="text" name="userName"
+ ng-model="user.name"
+ ng-model-options="{ getterSetter: true }" />
+ </label>
+ </form>
+ <pre>user.name = <span ng-bind="user.name()"></span></pre>
+ </div>
+ </file>
+ <file name="app.js">
+ angular.module('getterSetterExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ var _name = 'Brian';
+ $scope.user = {
+ name: function(newName) {
+ // Note that newName can be undefined for two reasons:
+ // 1. Because it is called as a getter and thus called with no arguments
+ // 2. Because the property should actually be set to undefined. This happens e.g. if the
+ // input is invalid
+ return arguments.length ? (_name = newName) : _name;
+ }
+ };
+ }]);
+ </file>
+ </example>
+ */
+var ngModelOptionsDirective = function() {
+ return {
+ restrict: 'A',
+ controller: ['$scope', '$attrs', function($scope, $attrs) {
+ var that = this;
+ this.$options = copy($scope.$eval($attrs.ngModelOptions));
+ // Allow adding/overriding bound events
+ if (isDefined(this.$options.updateOn)) {
+ this.$options.updateOnDefault = false;
+ // extract "default" pseudo-event from list of events that can trigger a model update
+ this.$options.updateOn = trim(this.$options.updateOn.replace(DEFAULT_REGEXP, function() {
+ that.$options.updateOnDefault = true;
+ return ' ';
+ }));
+ } else {
+ this.$options.updateOnDefault = true;
+ }
+ }]
+ };
+};
+
+
+
+// helper methods
+function addSetValidityMethod(context) {
+ var ctrl = context.ctrl,
+ $element = context.$element,
+ classCache = {},
+ set = context.set,
+ unset = context.unset,
+ $animate = context.$animate;
+
+ classCache[INVALID_CLASS] = !(classCache[VALID_CLASS] = $element.hasClass(VALID_CLASS));
+
+ ctrl.$setValidity = setValidity;
+
+ function setValidity(validationErrorKey, state, controller) {
+ if (isUndefined(state)) {
+ createAndSet('$pending', validationErrorKey, controller);
+ } else {
+ unsetAndCleanup('$pending', validationErrorKey, controller);
+ }
+ if (!isBoolean(state)) {
+ unset(ctrl.$error, validationErrorKey, controller);
+ unset(ctrl.$$success, validationErrorKey, controller);
+ } else {
+ if (state) {
+ unset(ctrl.$error, validationErrorKey, controller);
+ set(ctrl.$$success, validationErrorKey, controller);
+ } else {
+ set(ctrl.$error, validationErrorKey, controller);
+ unset(ctrl.$$success, validationErrorKey, controller);
+ }
+ }
+ if (ctrl.$pending) {
+ cachedToggleClass(PENDING_CLASS, true);
+ ctrl.$valid = ctrl.$invalid = undefined;
+ toggleValidationCss('', null);
+ } else {
+ cachedToggleClass(PENDING_CLASS, false);
+ ctrl.$valid = isObjectEmpty(ctrl.$error);
+ ctrl.$invalid = !ctrl.$valid;
+ toggleValidationCss('', ctrl.$valid);
+ }
+
+ // re-read the state as the set/unset methods could have
+ // combined state in ctrl.$error[validationError] (used for forms),
+ // where setting/unsetting only increments/decrements the value,
+ // and does not replace it.
+ var combinedState;
+ if (ctrl.$pending && ctrl.$pending[validationErrorKey]) {
+ combinedState = undefined;
+ } else if (ctrl.$error[validationErrorKey]) {
+ combinedState = false;
+ } else if (ctrl.$$success[validationErrorKey]) {
+ combinedState = true;
+ } else {
+ combinedState = null;
+ }
+
+ toggleValidationCss(validationErrorKey, combinedState);
+ ctrl.$$parentForm.$setValidity(validationErrorKey, combinedState, ctrl);
+ }
+
+ function createAndSet(name, value, controller) {
+ if (!ctrl[name]) {
+ ctrl[name] = {};
+ }
+ set(ctrl[name], value, controller);
+ }
+
+ function unsetAndCleanup(name, value, controller) {
+ if (ctrl[name]) {
+ unset(ctrl[name], value, controller);
+ }
+ if (isObjectEmpty(ctrl[name])) {
+ ctrl[name] = undefined;
+ }
+ }
+
+ function cachedToggleClass(className, switchValue) {
+ if (switchValue && !classCache[className]) {
+ $animate.addClass($element, className);
+ classCache[className] = true;
+ } else if (!switchValue && classCache[className]) {
+ $animate.removeClass($element, className);
+ classCache[className] = false;
+ }
+ }
+
+ function toggleValidationCss(validationErrorKey, isValid) {
+ validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
+
+ cachedToggleClass(VALID_CLASS + validationErrorKey, isValid === true);
+ cachedToggleClass(INVALID_CLASS + validationErrorKey, isValid === false);
+ }
+}
+
+function isObjectEmpty(obj) {
+ if (obj) {
+ for (var prop in obj) {
+ if (obj.hasOwnProperty(prop)) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+/**
+ * @ngdoc directive
+ * @name ngNonBindable
+ * @restrict AC
+ * @priority 1000
+ *
+ * @description
+ * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current
+ * DOM element. This is useful if the element contains what appears to be Angular directives and
+ * bindings but which should be ignored by Angular. This could be the case if you have a site that
+ * displays snippets of code, for instance.
+ *
+ * @element ANY
+ *
+ * @example
+ * In this example there are two locations where a simple interpolation binding (`{{}}`) is present,
+ * but the one wrapped in `ngNonBindable` is left alone.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <div>Normal: {{1 + 2}}</div>
+ <div ng-non-bindable>Ignored: {{1 + 2}}</div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-non-bindable', function() {
+ expect(element(by.binding('1 + 2')).getText()).toContain('3');
+ expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/);
+ });
+ </file>
+ </example>
+ */
+var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
+
+/* global jqLiteRemove */
+
+var ngOptionsMinErr = minErr('ngOptions');
+
+/**
+ * @ngdoc directive
+ * @name ngOptions
+ * @restrict A
+ *
+ * @description
+ *
+ * The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
+ * elements for the `<select>` element using the array or object obtained by evaluating the
+ * `ngOptions` comprehension expression.
+ *
+ * In many cases, `ngRepeat` can be used on `<option>` elements instead of `ngOptions` to achieve a
+ * similar result. However, `ngOptions` provides some benefits such as reducing memory and
+ * increasing speed by not creating a new scope for each repeated instance, as well as providing
+ * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the
+ * comprehension expression. `ngOptions` should be used when the `<select>` model needs to be bound
+ * to a non-string value. This is because an option element can only be bound to string values at
+ * present.
+ *
+ * When an item in the `<select>` menu is selected, the array element or object property
+ * represented by the selected option will be bound to the model identified by the `ngModel`
+ * directive.
+ *
+ * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can
+ * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
+ * option. See example below for demonstration.
+ *
+ * ## Complex Models (objects or collections)
+ *
+ * By default, `ngModel` watches the model by reference, not value. This is important to know when
+ * binding the select to a model that is an object or a collection.
+ *
+ * One issue occurs if you want to preselect an option. For example, if you set
+ * the model to an object that is equal to an object in your collection, `ngOptions` won't be able to set the selection,
+ * because the objects are not identical. So by default, you should always reference the item in your collection
+ * for preselections, e.g.: `$scope.selected = $scope.collection[3]`.
+ *
+ * Another solution is to use a `track by` clause, because then `ngOptions` will track the identity
+ * of the item not by reference, but by the result of the `track by` expression. For example, if your
+ * collection items have an id property, you would `track by item.id`.
+ *
+ * A different issue with objects or collections is that ngModel won't detect if an object property or
+ * a collection item changes. For that reason, `ngOptions` additionally watches the model using
+ * `$watchCollection`, when the expression contains a `track by` clause or the the select has the `multiple` attribute.
+ * This allows ngOptions to trigger a re-rendering of the options even if the actual object/collection
+ * has not changed identity, but only a property on the object or an item in the collection changes.
+ *
+ * Note that `$watchCollection` does a shallow comparison of the properties of the object (or the items in the collection
+ * if the model is an array). This means that changing a property deeper than the first level inside the
+ * object/collection will not trigger a re-rendering.
+ *
+ * ## `select` **`as`**
+ *
+ * Using `select` **`as`** will bind the result of the `select` expression to the model, but
+ * the value of the `<select>` and `<option>` html elements will be either the index (for array data sources)
+ * or property name (for object data sources) of the value within the collection. If a **`track by`** expression
+ * is used, the result of that expression will be set as the value of the `option` and `select` elements.
+ *
+ *
+ * ### `select` **`as`** and **`track by`**
+ *
+ * <div class="alert alert-warning">
+ * Be careful when using `select` **`as`** and **`track by`** in the same expression.
+ * </div>
+ *
+ * Given this array of items on the $scope:
+ *
+ * ```js
+ * $scope.items = [{
+ * id: 1,
+ * label: 'aLabel',
+ * subItem: { name: 'aSubItem' }
+ * }, {
+ * id: 2,
+ * label: 'bLabel',
+ * subItem: { name: 'bSubItem' }
+ * }];
+ * ```
+ *
+ * This will work:
+ *
+ * ```html
+ * <select ng-options="item as item.label for item in items track by item.id" ng-model="selected"></select>
+ * ```
+ * ```js
+ * $scope.selected = $scope.items[0];
+ * ```
+ *
+ * but this will not work:
+ *
+ * ```html
+ * <select ng-options="item.subItem as item.label for item in items track by item.id" ng-model="selected"></select>
+ * ```
+ * ```js
+ * $scope.selected = $scope.items[0].subItem;
+ * ```
+ *
+ * In both examples, the **`track by`** expression is applied successfully to each `item` in the
+ * `items` array. Because the selected option has been set programmatically in the controller, the
+ * **`track by`** expression is also applied to the `ngModel` value. In the first example, the
+ * `ngModel` value is `items[0]` and the **`track by`** expression evaluates to `items[0].id` with
+ * no issue. In the second example, the `ngModel` value is `items[0].subItem` and the **`track by`**
+ * expression evaluates to `items[0].subItem.id` (which is undefined). As a result, the model value
+ * is not matched against any `<option>` and the `<select>` appears as having no selected value.
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required The control is considered valid only if value is entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ * `required` when you want to data-bind to the `required` attribute.
+ * @param {comprehension_expression=} ngOptions in one of the following forms:
+ *
+ * * for array data sources:
+ * * `label` **`for`** `value` **`in`** `array`
+ * * `select` **`as`** `label` **`for`** `value` **`in`** `array`
+ * * `label` **`group by`** `group` **`for`** `value` **`in`** `array`
+ * * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array`
+ * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
+ * * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
+ * * `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr`
+ * (for including a filter with `track by`)
+ * * for object data sources:
+ * * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+ * * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+ * * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`
+ * * `label` **`disable when`** `disable` **`for (`**`key`**`,`** `value`**`) in`** `object`
+ * * `select` **`as`** `label` **`group by`** `group`
+ * **`for` `(`**`key`**`,`** `value`**`) in`** `object`
+ * * `select` **`as`** `label` **`disable when`** `disable`
+ * **`for` `(`**`key`**`,`** `value`**`) in`** `object`
+ *
+ * Where:
+ *
+ * * `array` / `object`: an expression which evaluates to an array / object to iterate over.
+ * * `value`: local variable which will refer to each item in the `array` or each property value
+ * of `object` during iteration.
+ * * `key`: local variable which will refer to a property name in `object` during iteration.
+ * * `label`: The result of this expression will be the label for `<option>` element. The
+ * `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).
+ * * `select`: The result of this expression will be bound to the model of the parent `<select>`
+ * element. If not specified, `select` expression will default to `value`.
+ * * `group`: The result of this expression will be used to group options using the `<optgroup>`
+ * DOM element.
+ * * `disable`: The result of this expression will be used to disable the rendered `<option>`
+ * element. Return `true` to disable.
+ * * `trackexpr`: Used when working with an array of objects. The result of this expression will be
+ * used to identify the objects in the array. The `trackexpr` will most likely refer to the
+ * `value` variable (e.g. `value.propertyName`). With this the selection is preserved
+ * even when the options are recreated (e.g. reloaded from the server).
+ *
+ * @example
+ <example module="selectExample">
+ <file name="index.html">
+ <script>
+ angular.module('selectExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.colors = [
+ {name:'black', shade:'dark'},
+ {name:'white', shade:'light', notAnOption: true},
+ {name:'red', shade:'dark'},
+ {name:'blue', shade:'dark', notAnOption: true},
+ {name:'yellow', shade:'light', notAnOption: false}
+ ];
+ $scope.myColor = $scope.colors[2]; // red
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <ul>
+ <li ng-repeat="color in colors">
+ <label>Name: <input ng-model="color.name"></label>
+ <label><input type="checkbox" ng-model="color.notAnOption"> Disabled?</label>
+ <button ng-click="colors.splice($index, 1)" aria-label="Remove">X</button>
+ </li>
+ <li>
+ <button ng-click="colors.push({})">add</button>
+ </li>
+ </ul>
+ <hr/>
+ <label>Color (null not allowed):
+ <select ng-model="myColor" ng-options="color.name for color in colors"></select>
+ </label><br/>
+ <label>Color (null allowed):
+ <span class="nullable">
+ <select ng-model="myColor" ng-options="color.name for color in colors">
+ <option value="">-- choose color --</option>
+ </select>
+ </span></label><br/>
+
+ <label>Color grouped by shade:
+ <select ng-model="myColor" ng-options="color.name group by color.shade for color in colors">
+ </select>
+ </label><br/>
+
+ <label>Color grouped by shade, with some disabled:
+ <select ng-model="myColor"
+ ng-options="color.name group by color.shade disable when color.notAnOption for color in colors">
+ </select>
+ </label><br/>
+
+
+
+ Select <button ng-click="myColor = { name:'not in list', shade: 'other' }">bogus</button>.
+ <br/>
+ <hr/>
+ Currently selected: {{ {selected_color:myColor} }}
+ <div style="border:solid 1px black; height:20px"
+ ng-style="{'background-color':myColor.name}">
+ </div>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should check ng-options', function() {
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');
+ element.all(by.model('myColor')).first().click();
+ element.all(by.css('select[ng-model="myColor"] option')).first().click();
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');
+ element(by.css('.nullable select[ng-model="myColor"]')).click();
+ element.all(by.css('.nullable select[ng-model="myColor"] option')).first().click();
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');
+ });
+ </file>
+ </example>
+ */
+
+// jshint maxlen: false
+// //00001111111111000000000002222222222000000000000000000000333333333300000000000000000000000004444444444400000000000005555555555555550000000006666666666666660000000777777777777777000000000000000888888888800000000000000000009999999999
+var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/;
+ // 1: value expression (valueFn)
+ // 2: label expression (displayFn)
+ // 3: group by expression (groupByFn)
+ // 4: disable when expression (disableWhenFn)
+ // 5: array item variable name
+ // 6: object item key variable name
+ // 7: object item value variable name
+ // 8: collection expression
+ // 9: track by expression
+// jshint maxlen: 100
+
+
+var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
+
+ function parseOptionsExpression(optionsExp, selectElement, scope) {
+
+ var match = optionsExp.match(NG_OPTIONS_REGEXP);
+ if (!(match)) {
+ throw ngOptionsMinErr('iexp',
+ "Expected expression in form of " +
+ "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
+ " but got '{0}'. Element: {1}",
+ optionsExp, startingTag(selectElement));
+ }
+
+ // Extract the parts from the ngOptions expression
+
+ // The variable name for the value of the item in the collection
+ var valueName = match[5] || match[7];
+ // The variable name for the key of the item in the collection
+ var keyName = match[6];
+
+ // An expression that generates the viewValue for an option if there is a label expression
+ var selectAs = / as /.test(match[0]) && match[1];
+ // An expression that is used to track the id of each object in the options collection
+ var trackBy = match[9];
+ // An expression that generates the viewValue for an option if there is no label expression
+ var valueFn = $parse(match[2] ? match[1] : valueName);
+ var selectAsFn = selectAs && $parse(selectAs);
+ var viewValueFn = selectAsFn || valueFn;
+ var trackByFn = trackBy && $parse(trackBy);
+
+ // Get the value by which we are going to track the option
+ // if we have a trackFn then use that (passing scope and locals)
+ // otherwise just hash the given viewValue
+ var getTrackByValueFn = trackBy ?
+ function(value, locals) { return trackByFn(scope, locals); } :
+ function getHashOfValue(value) { return hashKey(value); };
+ var getTrackByValue = function(value, key) {
+ return getTrackByValueFn(value, getLocals(value, key));
+ };
+
+ var displayFn = $parse(match[2] || match[1]);
+ var groupByFn = $parse(match[3] || '');
+ var disableWhenFn = $parse(match[4] || '');
+ var valuesFn = $parse(match[8]);
+
+ var locals = {};
+ var getLocals = keyName ? function(value, key) {
+ locals[keyName] = key;
+ locals[valueName] = value;
+ return locals;
+ } : function(value) {
+ locals[valueName] = value;
+ return locals;
+ };
+
+
+ function Option(selectValue, viewValue, label, group, disabled) {
+ this.selectValue = selectValue;
+ this.viewValue = viewValue;
+ this.label = label;
+ this.group = group;
+ this.disabled = disabled;
+ }
+
+ function getOptionValuesKeys(optionValues) {
+ var optionValuesKeys;
+
+ if (!keyName && isArrayLike(optionValues)) {
+ optionValuesKeys = optionValues;
+ } else {
+ // if object, extract keys, in enumeration order, unsorted
+ optionValuesKeys = [];
+ for (var itemKey in optionValues) {
+ if (optionValues.hasOwnProperty(itemKey) && itemKey.charAt(0) !== '$') {
+ optionValuesKeys.push(itemKey);
+ }
+ }
+ }
+ return optionValuesKeys;
+ }
+
+ return {
+ trackBy: trackBy,
+ getTrackByValue: getTrackByValue,
+ getWatchables: $parse(valuesFn, function(optionValues) {
+ // Create a collection of things that we would like to watch (watchedArray)
+ // so that they can all be watched using a single $watchCollection
+ // that only runs the handler once if anything changes
+ var watchedArray = [];
+ optionValues = optionValues || [];
+
+ var optionValuesKeys = getOptionValuesKeys(optionValues);
+ var optionValuesLength = optionValuesKeys.length;
+ for (var index = 0; index < optionValuesLength; index++) {
+ var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];
+ var value = optionValues[key];
+
+ var locals = getLocals(optionValues[key], key);
+ var selectValue = getTrackByValueFn(optionValues[key], locals);
+ watchedArray.push(selectValue);
+
+ // Only need to watch the displayFn if there is a specific label expression
+ if (match[2] || match[1]) {
+ var label = displayFn(scope, locals);
+ watchedArray.push(label);
+ }
+
+ // Only need to watch the disableWhenFn if there is a specific disable expression
+ if (match[4]) {
+ var disableWhen = disableWhenFn(scope, locals);
+ watchedArray.push(disableWhen);
+ }
+ }
+ return watchedArray;
+ }),
+
+ getOptions: function() {
+
+ var optionItems = [];
+ var selectValueMap = {};
+
+ // The option values were already computed in the `getWatchables` fn,
+ // which must have been called to trigger `getOptions`
+ var optionValues = valuesFn(scope) || [];
+ var optionValuesKeys = getOptionValuesKeys(optionValues);
+ var optionValuesLength = optionValuesKeys.length;
+
+ for (var index = 0; index < optionValuesLength; index++) {
+ var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];
+ var value = optionValues[key];
+ var locals = getLocals(value, key);
+ var viewValue = viewValueFn(scope, locals);
+ var selectValue = getTrackByValueFn(viewValue, locals);
+ var label = displayFn(scope, locals);
+ var group = groupByFn(scope, locals);
+ var disabled = disableWhenFn(scope, locals);
+ var optionItem = new Option(selectValue, viewValue, label, group, disabled);
+
+ optionItems.push(optionItem);
+ selectValueMap[selectValue] = optionItem;
+ }
+
+ return {
+ items: optionItems,
+ selectValueMap: selectValueMap,
+ getOptionFromViewValue: function(value) {
+ return selectValueMap[getTrackByValue(value)];
+ },
+ getViewValueFromOption: function(option) {
+ // If the viewValue could be an object that may be mutated by the application,
+ // we need to make a copy and not return the reference to the value on the option.
+ return trackBy ? angular.copy(option.viewValue) : option.viewValue;
+ }
+ };
+ }
+ };
+ }
+
+
+ // we can't just jqLite('<option>') since jqLite is not smart enough
+ // to create it in <select> and IE barfs otherwise.
+ var optionTemplate = document.createElement('option'),
+ optGroupTemplate = document.createElement('optgroup');
+
+ function ngOptionsPostLink(scope, selectElement, attr, ctrls) {
+
+ var selectCtrl = ctrls[0];
+ var ngModelCtrl = ctrls[1];
+ var multiple = attr.multiple;
+
+ // The emptyOption allows the application developer to provide their own custom "empty"
+ // option when the viewValue does not match any of the option values.
+ var emptyOption;
+ for (var i = 0, children = selectElement.children(), ii = children.length; i < ii; i++) {
+ if (children[i].value === '') {
+ emptyOption = children.eq(i);
+ break;
+ }
+ }
+
+ var providedEmptyOption = !!emptyOption;
+
+ var unknownOption = jqLite(optionTemplate.cloneNode(false));
+ unknownOption.val('?');
+
+ var options;
+ var ngOptions = parseOptionsExpression(attr.ngOptions, selectElement, scope);
+
+
+ var renderEmptyOption = function() {
+ if (!providedEmptyOption) {
+ selectElement.prepend(emptyOption);
+ }
+ selectElement.val('');
+ emptyOption.prop('selected', true); // needed for IE
+ emptyOption.attr('selected', true);
+ };
+
+ var removeEmptyOption = function() {
+ if (!providedEmptyOption) {
+ emptyOption.remove();
+ }
+ };
+
+
+ var renderUnknownOption = function() {
+ selectElement.prepend(unknownOption);
+ selectElement.val('?');
+ unknownOption.prop('selected', true); // needed for IE
+ unknownOption.attr('selected', true);
+ };
+
+ var removeUnknownOption = function() {
+ unknownOption.remove();
+ };
+
+ // Update the controller methods for multiple selectable options
+ if (!multiple) {
+
+ selectCtrl.writeValue = function writeNgOptionsValue(value) {
+ var option = options.getOptionFromViewValue(value);
+
+ if (option && !option.disabled) {
+ if (selectElement[0].value !== option.selectValue) {
+ removeUnknownOption();
+ removeEmptyOption();
+
+ selectElement[0].value = option.selectValue;
+ option.element.selected = true;
+ option.element.setAttribute('selected', 'selected');
+ }
+ } else {
+ if (value === null || providedEmptyOption) {
+ removeUnknownOption();
+ renderEmptyOption();
+ } else {
+ removeEmptyOption();
+ renderUnknownOption();
+ }
+ }
+ };
+
+ selectCtrl.readValue = function readNgOptionsValue() {
+
+ var selectedOption = options.selectValueMap[selectElement.val()];
+
+ if (selectedOption && !selectedOption.disabled) {
+ removeEmptyOption();
+ removeUnknownOption();
+ return options.getViewValueFromOption(selectedOption);
+ }
+ return null;
+ };
+
+ // If we are using `track by` then we must watch the tracked value on the model
+ // since ngModel only watches for object identity change
+ if (ngOptions.trackBy) {
+ scope.$watch(
+ function() { return ngOptions.getTrackByValue(ngModelCtrl.$viewValue); },
+ function() { ngModelCtrl.$render(); }
+ );
+ }
+
+ } else {
+
+ ngModelCtrl.$isEmpty = function(value) {
+ return !value || value.length === 0;
+ };
+
+
+ selectCtrl.writeValue = function writeNgOptionsMultiple(value) {
+ options.items.forEach(function(option) {
+ option.element.selected = false;
+ });
+
+ if (value) {
+ value.forEach(function(item) {
+ var option = options.getOptionFromViewValue(item);
+ if (option && !option.disabled) option.element.selected = true;
+ });
+ }
+ };
+
+
+ selectCtrl.readValue = function readNgOptionsMultiple() {
+ var selectedValues = selectElement.val() || [],
+ selections = [];
+
+ forEach(selectedValues, function(value) {
+ var option = options.selectValueMap[value];
+ if (option && !option.disabled) selections.push(options.getViewValueFromOption(option));
+ });
+
+ return selections;
+ };
+
+ // If we are using `track by` then we must watch these tracked values on the model
+ // since ngModel only watches for object identity change
+ if (ngOptions.trackBy) {
+
+ scope.$watchCollection(function() {
+ if (isArray(ngModelCtrl.$viewValue)) {
+ return ngModelCtrl.$viewValue.map(function(value) {
+ return ngOptions.getTrackByValue(value);
+ });
+ }
+ }, function() {
+ ngModelCtrl.$render();
+ });
+
+ }
+ }
+
+
+ if (providedEmptyOption) {
+
+ // we need to remove it before calling selectElement.empty() because otherwise IE will
+ // remove the label from the element. wtf?
+ emptyOption.remove();
+
+ // compile the element since there might be bindings in it
+ $compile(emptyOption)(scope);
+
+ // remove the class, which is added automatically because we recompile the element and it
+ // becomes the compilation root
+ emptyOption.removeClass('ng-scope');
+ } else {
+ emptyOption = jqLite(optionTemplate.cloneNode(false));
+ }
+
+ // We need to do this here to ensure that the options object is defined
+ // when we first hit it in writeNgOptionsValue
+ updateOptions();
+
+ // We will re-render the option elements if the option values or labels change
+ scope.$watchCollection(ngOptions.getWatchables, updateOptions);
+
+ // ------------------------------------------------------------------ //
+
+
+ function updateOptionElement(option, element) {
+ option.element = element;
+ element.disabled = option.disabled;
+ // NOTE: The label must be set before the value, otherwise IE10/11/EDGE create unresponsive
+ // selects in certain circumstances when multiple selects are next to each other and display
+ // the option list in listbox style, i.e. the select is [multiple], or specifies a [size].
+ // See https://github.com/angular/angular.js/issues/11314 for more info.
+ // This is unfortunately untestable with unit / e2e tests
+ if (option.label !== element.label) {
+ element.label = option.label;
+ element.textContent = option.label;
+ }
+ if (option.value !== element.value) element.value = option.selectValue;
+ }
+
+ function addOrReuseElement(parent, current, type, templateElement) {
+ var element;
+ // Check whether we can reuse the next element
+ if (current && lowercase(current.nodeName) === type) {
+ // The next element is the right type so reuse it
+ element = current;
+ } else {
+ // The next element is not the right type so create a new one
+ element = templateElement.cloneNode(false);
+ if (!current) {
+ // There are no more elements so just append it to the select
+ parent.appendChild(element);
+ } else {
+ // The next element is not a group so insert the new one
+ parent.insertBefore(element, current);
+ }
+ }
+ return element;
+ }
+
+
+ function removeExcessElements(current) {
+ var next;
+ while (current) {
+ next = current.nextSibling;
+ jqLiteRemove(current);
+ current = next;
+ }
+ }
+
+
+ function skipEmptyAndUnknownOptions(current) {
+ var emptyOption_ = emptyOption && emptyOption[0];
+ var unknownOption_ = unknownOption && unknownOption[0];
+
+ // We cannot rely on the extracted empty option being the same as the compiled empty option,
+ // because the compiled empty option might have been replaced by a comment because
+ // it had an "element" transclusion directive on it (such as ngIf)
+ if (emptyOption_ || unknownOption_) {
+ while (current &&
+ (current === emptyOption_ ||
+ current === unknownOption_ ||
+ current.nodeType === NODE_TYPE_COMMENT ||
+ current.value === '')) {
+ current = current.nextSibling;
+ }
+ }
+ return current;
+ }
+
+
+ function updateOptions() {
+
+ var previousValue = options && selectCtrl.readValue();
+
+ options = ngOptions.getOptions();
+
+ var groupMap = {};
+ var currentElement = selectElement[0].firstChild;
+
+ // Ensure that the empty option is always there if it was explicitly provided
+ if (providedEmptyOption) {
+ selectElement.prepend(emptyOption);
+ }
+
+ currentElement = skipEmptyAndUnknownOptions(currentElement);
+
+ options.items.forEach(function updateOption(option) {
+ var group;
+ var groupElement;
+ var optionElement;
+
+ if (isDefined(option.group)) {
+
+ // This option is to live in a group
+ // See if we have already created this group
+ group = groupMap[option.group];
+
+ if (!group) {
+
+ // We have not already created this group
+ groupElement = addOrReuseElement(selectElement[0],
+ currentElement,
+ 'optgroup',
+ optGroupTemplate);
+ // Move to the next element
+ currentElement = groupElement.nextSibling;
+
+ // Update the label on the group element
+ groupElement.label = option.group;
+
+ // Store it for use later
+ group = groupMap[option.group] = {
+ groupElement: groupElement,
+ currentOptionElement: groupElement.firstChild
+ };
+
+ }
+
+ // So now we have a group for this option we add the option to the group
+ optionElement = addOrReuseElement(group.groupElement,
+ group.currentOptionElement,
+ 'option',
+ optionTemplate);
+ updateOptionElement(option, optionElement);
+ // Move to the next element
+ group.currentOptionElement = optionElement.nextSibling;
+
+ } else {
+
+ // This option is not in a group
+ optionElement = addOrReuseElement(selectElement[0],
+ currentElement,
+ 'option',
+ optionTemplate);
+ updateOptionElement(option, optionElement);
+ // Move to the next element
+ currentElement = optionElement.nextSibling;
+ }
+ });
+
+
+ // Now remove all excess options and group
+ Object.keys(groupMap).forEach(function(key) {
+ removeExcessElements(groupMap[key].currentOptionElement);
+ });
+ removeExcessElements(currentElement);
+
+ ngModelCtrl.$render();
+
+ // Check to see if the value has changed due to the update to the options
+ if (!ngModelCtrl.$isEmpty(previousValue)) {
+ var nextValue = selectCtrl.readValue();
+ if (ngOptions.trackBy ? !equals(previousValue, nextValue) : previousValue !== nextValue) {
+ ngModelCtrl.$setViewValue(nextValue);
+ ngModelCtrl.$render();
+ }
+ }
+
+ }
+ }
+
+ return {
+ restrict: 'A',
+ terminal: true,
+ require: ['select', 'ngModel'],
+ link: {
+ pre: function ngOptionsPreLink(scope, selectElement, attr, ctrls) {
+ // Deactivate the SelectController.register method to prevent
+ // option directives from accidentally registering themselves
+ // (and unwanted $destroy handlers etc.)
+ ctrls[0].registerOption = noop;
+ },
+ post: ngOptionsPostLink
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngPluralize
+ * @restrict EA
+ *
+ * @description
+ * `ngPluralize` is a directive that displays messages according to en-US localization rules.
+ * These rules are bundled with angular.js, but can be overridden
+ * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive
+ * by specifying the mappings between
+ * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
+ * and the strings to be displayed.
+ *
+ * # Plural categories and explicit number rules
+ * There are two
+ * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
+ * in Angular's default en-US locale: "one" and "other".
+ *
+ * While a plural category may match many numbers (for example, in en-US locale, "other" can match
+ * any number that is not 1), an explicit number rule can only match one number. For example, the
+ * explicit number rule for "3" matches the number 3. There are examples of plural categories
+ * and explicit number rules throughout the rest of this documentation.
+ *
+ * # Configuring ngPluralize
+ * You configure ngPluralize by providing 2 attributes: `count` and `when`.
+ * You can also provide an optional attribute, `offset`.
+ *
+ * The value of the `count` attribute can be either a string or an {@link guide/expression
+ * Angular expression}; these are evaluated on the current scope for its bound value.
+ *
+ * The `when` attribute specifies the mappings between plural categories and the actual
+ * string to be displayed. The value of the attribute should be a JSON object.
+ *
+ * The following example shows how to configure ngPluralize:
+ *
+ * ```html
+ * <ng-pluralize count="personCount"
+ when="{'0': 'Nobody is viewing.',
+ * 'one': '1 person is viewing.',
+ * 'other': '{} people are viewing.'}">
+ * </ng-pluralize>
+ *```
+ *
+ * In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not
+ * specify this rule, 0 would be matched to the "other" category and "0 people are viewing"
+ * would be shown instead of "Nobody is viewing". You can specify an explicit number rule for
+ * other numbers, for example 12, so that instead of showing "12 people are viewing", you can
+ * show "a dozen people are viewing".
+ *
+ * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted
+ * into pluralized strings. In the previous example, Angular will replace `{}` with
+ * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder
+ * for <span ng-non-bindable>{{numberExpression}}</span>.
+ *
+ * If no rule is defined for a category, then an empty string is displayed and a warning is generated.
+ * Note that some locales define more categories than `one` and `other`. For example, fr-fr defines `few` and `many`.
+ *
+ * # Configuring ngPluralize with offset
+ * The `offset` attribute allows further customization of pluralized text, which can result in
+ * a better user experience. For example, instead of the message "4 people are viewing this document",
+ * you might display "John, Kate and 2 others are viewing this document".
+ * The offset attribute allows you to offset a number by any desired value.
+ * Let's take a look at an example:
+ *
+ * ```html
+ * <ng-pluralize count="personCount" offset=2
+ * when="{'0': 'Nobody is viewing.',
+ * '1': '{{person1}} is viewing.',
+ * '2': '{{person1}} and {{person2}} are viewing.',
+ * 'one': '{{person1}}, {{person2}} and one other person are viewing.',
+ * 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
+ * </ng-pluralize>
+ * ```
+ *
+ * Notice that we are still using two plural categories(one, other), but we added
+ * three explicit number rules 0, 1 and 2.
+ * When one person, perhaps John, views the document, "John is viewing" will be shown.
+ * When three people view the document, no explicit number rule is found, so
+ * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.
+ * In this case, plural category 'one' is matched and "John, Mary and one other person are viewing"
+ * is shown.
+ *
+ * Note that when you specify offsets, you must provide explicit number rules for
+ * numbers from 0 up to and including the offset. If you use an offset of 3, for example,
+ * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for
+ * plural categories "one" and "other".
+ *
+ * @param {string|expression} count The variable to be bound to.
+ * @param {string} when The mapping between plural category to its corresponding strings.
+ * @param {number=} offset Offset to deduct from the total number.
+ *
+ * @example
+ <example module="pluralizeExample">
+ <file name="index.html">
+ <script>
+ angular.module('pluralizeExample', [])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.person1 = 'Igor';
+ $scope.person2 = 'Misko';
+ $scope.personCount = 1;
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <label>Person 1:<input type="text" ng-model="person1" value="Igor" /></label><br/>
+ <label>Person 2:<input type="text" ng-model="person2" value="Misko" /></label><br/>
+ <label>Number of People:<input type="text" ng-model="personCount" value="1" /></label><br/>
+
+ <!--- Example with simple pluralization rules for en locale --->
+ Without Offset:
+ <ng-pluralize count="personCount"
+ when="{'0': 'Nobody is viewing.',
+ 'one': '1 person is viewing.',
+ 'other': '{} people are viewing.'}">
+ </ng-pluralize><br>
+
+ <!--- Example with offset --->
+ With Offset(2):
+ <ng-pluralize count="personCount" offset=2
+ when="{'0': 'Nobody is viewing.',
+ '1': '{{person1}} is viewing.',
+ '2': '{{person1}} and {{person2}} are viewing.',
+ 'one': '{{person1}}, {{person2}} and one other person are viewing.',
+ 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
+ </ng-pluralize>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should show correct pluralized string', function() {
+ var withoutOffset = element.all(by.css('ng-pluralize')).get(0);
+ var withOffset = element.all(by.css('ng-pluralize')).get(1);
+ var countInput = element(by.model('personCount'));
+
+ expect(withoutOffset.getText()).toEqual('1 person is viewing.');
+ expect(withOffset.getText()).toEqual('Igor is viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('0');
+
+ expect(withoutOffset.getText()).toEqual('Nobody is viewing.');
+ expect(withOffset.getText()).toEqual('Nobody is viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('2');
+
+ expect(withoutOffset.getText()).toEqual('2 people are viewing.');
+ expect(withOffset.getText()).toEqual('Igor and Misko are viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('3');
+
+ expect(withoutOffset.getText()).toEqual('3 people are viewing.');
+ expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.');
+
+ countInput.clear();
+ countInput.sendKeys('4');
+
+ expect(withoutOffset.getText()).toEqual('4 people are viewing.');
+ expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.');
+ });
+ it('should show data-bound names', function() {
+ var withOffset = element.all(by.css('ng-pluralize')).get(1);
+ var personCount = element(by.model('personCount'));
+ var person1 = element(by.model('person1'));
+ var person2 = element(by.model('person2'));
+ personCount.clear();
+ personCount.sendKeys('4');
+ person1.clear();
+ person1.sendKeys('Di');
+ person2.clear();
+ person2.sendKeys('Vojta');
+ expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.');
+ });
+ </file>
+ </example>
+ */
+var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale, $interpolate, $log) {
+ var BRACE = /{}/g,
+ IS_WHEN = /^when(Minus)?(.+)$/;
+
+ return {
+ link: function(scope, element, attr) {
+ var numberExp = attr.count,
+ whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs
+ offset = attr.offset || 0,
+ whens = scope.$eval(whenExp) || {},
+ whensExpFns = {},
+ startSymbol = $interpolate.startSymbol(),
+ endSymbol = $interpolate.endSymbol(),
+ braceReplacement = startSymbol + numberExp + '-' + offset + endSymbol,
+ watchRemover = angular.noop,
+ lastCount;
+
+ forEach(attr, function(expression, attributeName) {
+ var tmpMatch = IS_WHEN.exec(attributeName);
+ if (tmpMatch) {
+ var whenKey = (tmpMatch[1] ? '-' : '') + lowercase(tmpMatch[2]);
+ whens[whenKey] = element.attr(attr.$attr[attributeName]);
+ }
+ });
+ forEach(whens, function(expression, key) {
+ whensExpFns[key] = $interpolate(expression.replace(BRACE, braceReplacement));
+
+ });
+
+ scope.$watch(numberExp, function ngPluralizeWatchAction(newVal) {
+ var count = parseFloat(newVal);
+ var countIsNaN = isNaN(count);
+
+ if (!countIsNaN && !(count in whens)) {
+ // If an explicit number rule such as 1, 2, 3... is defined, just use it.
+ // Otherwise, check it against pluralization rules in $locale service.
+ count = $locale.pluralCat(count - offset);
+ }
+
+ // If both `count` and `lastCount` are NaN, we don't need to re-register a watch.
+ // In JS `NaN !== NaN`, so we have to exlicitly check.
+ if ((count !== lastCount) && !(countIsNaN && isNumber(lastCount) && isNaN(lastCount))) {
+ watchRemover();
+ var whenExpFn = whensExpFns[count];
+ if (isUndefined(whenExpFn)) {
+ if (newVal != null) {
+ $log.debug("ngPluralize: no rule defined for '" + count + "' in " + whenExp);
+ }
+ watchRemover = noop;
+ updateElementText();
+ } else {
+ watchRemover = scope.$watch(whenExpFn, updateElementText);
+ }
+ lastCount = count;
+ }
+ });
+
+ function updateElementText(newText) {
+ element.text(newText || '');
+ }
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngRepeat
+ * @multiElement
+ *
+ * @description
+ * The `ngRepeat` directive instantiates a template once per item from a collection. Each template
+ * instance gets its own scope, where the given loop variable is set to the current collection item,
+ * and `$index` is set to the item index or key.
+ *
+ * Special properties are exposed on the local scope of each template instance, including:
+ *
+ * | Variable | Type | Details |
+ * |-----------|-----------------|-----------------------------------------------------------------------------|
+ * | `$index` | {@type number} | iterator offset of the repeated element (0..length-1) |
+ * | `$first` | {@type boolean} | true if the repeated element is first in the iterator. |
+ * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |
+ * | `$last` | {@type boolean} | true if the repeated element is last in the iterator. |
+ * | `$even` | {@type boolean} | true if the iterator position `$index` is even (otherwise false). |
+ * | `$odd` | {@type boolean} | true if the iterator position `$index` is odd (otherwise false). |
+ *
+ * <div class="alert alert-info">
+ * Creating aliases for these properties is possible with {@link ng.directive:ngInit `ngInit`}.
+ * This may be useful when, for instance, nesting ngRepeats.
+ * </div>
+ *
+ *
+ * # Iterating over object properties
+ *
+ * It is possible to get `ngRepeat` to iterate over the properties of an object using the following
+ * syntax:
+ *
+ * ```js
+ * <div ng-repeat="(key, value) in myObj"> ... </div>
+ * ```
+ *
+ * You need to be aware that the JavaScript specification does not define the order of keys
+ * returned for an object. (To mitigate this in Angular 1.3 the `ngRepeat` directive
+ * used to sort the keys alphabetically.)
+ *
+ * Version 1.4 removed the alphabetic sorting. We now rely on the order returned by the browser
+ * when running `for key in myObj`. It seems that browsers generally follow the strategy of providing
+ * keys in the order in which they were defined, although there are exceptions when keys are deleted
+ * and reinstated. See the [MDN page on `delete` for more info](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete#Cross-browser_notes).
+ *
+ * If this is not desired, the recommended workaround is to convert your object into an array
+ * that is sorted into the order that you prefer before providing it to `ngRepeat`. You could
+ * do this with a filter such as [toArrayFilter](http://ngmodules.org/modules/angular-toArrayFilter)
+ * or implement a `$watch` on the object yourself.
+ *
+ *
+ * # Tracking and Duplicates
+ *
+ * `ngRepeat` uses {@link $rootScope.Scope#$watchCollection $watchCollection} to detect changes in
+ * the collection. When a change happens, ngRepeat then makes the corresponding changes to the DOM:
+ *
+ * * When an item is added, a new instance of the template is added to the DOM.
+ * * When an item is removed, its template instance is removed from the DOM.
+ * * When items are reordered, their respective templates are reordered in the DOM.
+ *
+ * To minimize creation of DOM elements, `ngRepeat` uses a function
+ * to "keep track" of all items in the collection and their corresponding DOM elements.
+ * For example, if an item is added to the collection, ngRepeat will know that all other items
+ * already have DOM elements, and will not re-render them.
+ *
+ * The default tracking function (which tracks items by their identity) does not allow
+ * duplicate items in arrays. This is because when there are duplicates, it is not possible
+ * to maintain a one-to-one mapping between collection items and DOM elements.
+ *
+ * If you do need to repeat duplicate items, you can substitute the default tracking behavior
+ * with your own using the `track by` expression.
+ *
+ * For example, you may track items by the index of each item in the collection, using the
+ * special scope property `$index`:
+ * ```html
+ * <div ng-repeat="n in [42, 42, 43, 43] track by $index">
+ * {{n}}
+ * </div>
+ * ```
+ *
+ * You may also use arbitrary expressions in `track by`, including references to custom functions
+ * on the scope:
+ * ```html
+ * <div ng-repeat="n in [42, 42, 43, 43] track by myTrackingFunction(n)">
+ * {{n}}
+ * </div>
+ * ```
+ *
+ * <div class="alert alert-success">
+ * If you are working with objects that have an identifier property, you should track
+ * by the identifier instead of the whole object. Should you reload your data later, `ngRepeat`
+ * will not have to rebuild the DOM elements for items it has already rendered, even if the
+ * JavaScript objects in the collection have been substituted for new ones. For large collections,
+ * this signifincantly improves rendering performance. If you don't have a unique identifier,
+ * `track by $index` can also provide a performance boost.
+ * </div>
+ * ```html
+ * <div ng-repeat="model in collection track by model.id">
+ * {{model.name}}
+ * </div>
+ * ```
+ *
+ * When no `track by` expression is provided, it is equivalent to tracking by the built-in
+ * `$id` function, which tracks items by their identity:
+ * ```html
+ * <div ng-repeat="obj in collection track by $id(obj)">
+ * {{obj.prop}}
+ * </div>
+ * ```
+ *
+ * <div class="alert alert-warning">
+ * **Note:** `track by` must always be the last expression:
+ * </div>
+ * ```
+ * <div ng-repeat="model in collection | orderBy: 'id' as filtered_result track by model.id">
+ * {{model.name}}
+ * </div>
+ * ```
+ *
+ * # Special repeat start and end points
+ * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending
+ * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.
+ * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on)
+ * up to and including the ending HTML tag where **ng-repeat-end** is placed.
+ *
+ * The example below makes use of this feature:
+ * ```html
+ * <header ng-repeat-start="item in items">
+ * Header {{ item }}
+ * </header>
+ * <div class="body">
+ * Body {{ item }}
+ * </div>
+ * <footer ng-repeat-end>
+ * Footer {{ item }}
+ * </footer>
+ * ```
+ *
+ * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to:
+ * ```html
+ * <header>
+ * Header A
+ * </header>
+ * <div class="body">
+ * Body A
+ * </div>
+ * <footer>
+ * Footer A
+ * </footer>
+ * <header>
+ * Header B
+ * </header>
+ * <div class="body">
+ * Body B
+ * </div>
+ * <footer>
+ * Footer B
+ * </footer>
+ * ```
+ *
+ * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such
+ * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).
+ *
+ * @animations
+ * **.enter** - when a new item is added to the list or when an item is revealed after a filter
+ *
+ * **.leave** - when an item is removed from the list or when an item is filtered out
+ *
+ * **.move** - when an adjacent item is filtered out causing a reorder or when the item contents are reordered
+ *
+ * @element ANY
+ * @scope
+ * @priority 1000
+ * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These
+ * formats are currently supported:
+ *
+ * * `variable in expression` – where variable is the user defined loop variable and `expression`
+ * is a scope expression giving the collection to enumerate.
+ *
+ * For example: `album in artist.albums`.
+ *
+ * * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,
+ * and `expression` is the scope expression giving the collection to enumerate.
+ *
+ * For example: `(name, age) in {'adam':10, 'amalie':12}`.
+ *
+ * * `variable in expression track by tracking_expression` – You can also provide an optional tracking expression
+ * which can be used to associate the objects in the collection with the DOM elements. If no tracking expression
+ * is specified, ng-repeat associates elements by identity. It is an error to have
+ * more than one tracking expression value resolve to the same key. (This would mean that two distinct objects are
+ * mapped to the same DOM element, which is not possible.)
+ *
+ * Note that the tracking expression must come last, after any filters, and the alias expression.
+ *
+ * For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements
+ * will be associated by item identity in the array.
+ *
+ * For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique
+ * `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements
+ * with the corresponding item in the array by identity. Moving the same object in array would move the DOM
+ * element in the same way in the DOM.
+ *
+ * For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this
+ * case the object identity does not matter. Two objects are considered equivalent as long as their `id`
+ * property is same.
+ *
+ * For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter
+ * to items in conjunction with a tracking expression.
+ *
+ * * `variable in expression as alias_expression` – You can also provide an optional alias expression which will then store the
+ * intermediate results of the repeater after the filters have been applied. Typically this is used to render a special message
+ * when a filter is active on the repeater, but the filtered result set is empty.
+ *
+ * For example: `item in items | filter:x as results` will store the fragment of the repeated items as `results`, but only after
+ * the items have been processed through the filter.
+ *
+ * Please note that `as [variable name] is not an operator but rather a part of ngRepeat micro-syntax so it can be used only at the end
+ * (and not as operator, inside an expression).
+ *
+ * For example: `item in items | filter : x | orderBy : order | limitTo : limit as results` .
+ *
+ * @example
+ * This example initializes the scope to a list of names and
+ * then uses `ngRepeat` to display every person:
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <div ng-init="friends = [
+ {name:'John', age:25, gender:'boy'},
+ {name:'Jessie', age:30, gender:'girl'},
+ {name:'Johanna', age:28, gender:'girl'},
+ {name:'Joy', age:15, gender:'girl'},
+ {name:'Mary', age:28, gender:'girl'},
+ {name:'Peter', age:95, gender:'boy'},
+ {name:'Sebastian', age:50, gender:'boy'},
+ {name:'Erika', age:27, gender:'girl'},
+ {name:'Patrick', age:40, gender:'boy'},
+ {name:'Samantha', age:60, gender:'girl'}
+ ]">
+ I have {{friends.length}} friends. They are:
+ <input type="search" ng-model="q" placeholder="filter friends..." aria-label="filter friends" />
+ <ul class="example-animate-container">
+ <li class="animate-repeat" ng-repeat="friend in friends | filter:q as results">
+ [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
+ </li>
+ <li class="animate-repeat" ng-if="results.length == 0">
+ <strong>No results found...</strong>
+ </li>
+ </ul>
+ </div>
+ </file>
+ <file name="animations.css">
+ .example-animate-container {
+ background:white;
+ border:1px solid black;
+ list-style:none;
+ margin:0;
+ padding:0 10px;
+ }
+
+ .animate-repeat {
+ line-height:40px;
+ list-style:none;
+ box-sizing:border-box;
+ }
+
+ .animate-repeat.ng-move,
+ .animate-repeat.ng-enter,
+ .animate-repeat.ng-leave {
+ transition:all linear 0.5s;
+ }
+
+ .animate-repeat.ng-leave.ng-leave-active,
+ .animate-repeat.ng-move,
+ .animate-repeat.ng-enter {
+ opacity:0;
+ max-height:0;
+ }
+
+ .animate-repeat.ng-leave,
+ .animate-repeat.ng-move.ng-move-active,
+ .animate-repeat.ng-enter.ng-enter-active {
+ opacity:1;
+ max-height:40px;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var friends = element.all(by.repeater('friend in friends'));
+
+ it('should render initial data set', function() {
+ expect(friends.count()).toBe(10);
+ expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.');
+ expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.');
+ expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.');
+ expect(element(by.binding('friends.length')).getText())
+ .toMatch("I have 10 friends. They are:");
+ });
+
+ it('should update repeater when filter predicate changes', function() {
+ expect(friends.count()).toBe(10);
+
+ element(by.model('q')).sendKeys('ma');
+
+ expect(friends.count()).toBe(2);
+ expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');
+ expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.');
+ });
+ </file>
+ </example>
+ */
+var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
+ var NG_REMOVED = '$$NG_REMOVED';
+ var ngRepeatMinErr = minErr('ngRepeat');
+
+ var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {
+ // TODO(perf): generate setters to shave off ~40ms or 1-1.5%
+ scope[valueIdentifier] = value;
+ if (keyIdentifier) scope[keyIdentifier] = key;
+ scope.$index = index;
+ scope.$first = (index === 0);
+ scope.$last = (index === (arrayLength - 1));
+ scope.$middle = !(scope.$first || scope.$last);
+ // jshint bitwise: false
+ scope.$odd = !(scope.$even = (index&1) === 0);
+ // jshint bitwise: true
+ };
+
+ var getBlockStart = function(block) {
+ return block.clone[0];
+ };
+
+ var getBlockEnd = function(block) {
+ return block.clone[block.clone.length - 1];
+ };
+
+
+ return {
+ restrict: 'A',
+ multiElement: true,
+ transclude: 'element',
+ priority: 1000,
+ terminal: true,
+ $$tlb: true,
+ compile: function ngRepeatCompile($element, $attr) {
+ var expression = $attr.ngRepeat;
+ var ngRepeatEndComment = document.createComment(' end ngRepeat: ' + expression + ' ');
+
+ var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
+
+ if (!match) {
+ throw ngRepeatMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",
+ expression);
+ }
+
+ var lhs = match[1];
+ var rhs = match[2];
+ var aliasAs = match[3];
+ var trackByExp = match[4];
+
+ match = lhs.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/);
+
+ if (!match) {
+ throw ngRepeatMinErr('iidexp', "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",
+ lhs);
+ }
+ var valueIdentifier = match[3] || match[1];
+ var keyIdentifier = match[2];
+
+ if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) ||
+ /^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(aliasAs))) {
+ throw ngRepeatMinErr('badident', "alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.",
+ aliasAs);
+ }
+
+ var trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn;
+ var hashFnLocals = {$id: hashKey};
+
+ if (trackByExp) {
+ trackByExpGetter = $parse(trackByExp);
+ } else {
+ trackByIdArrayFn = function(key, value) {
+ return hashKey(value);
+ };
+ trackByIdObjFn = function(key) {
+ return key;
+ };
+ }
+
+ return function ngRepeatLink($scope, $element, $attr, ctrl, $transclude) {
+
+ if (trackByExpGetter) {
+ trackByIdExpFn = function(key, value, index) {
+ // assign key, value, and $index to the locals so that they can be used in hash functions
+ if (keyIdentifier) hashFnLocals[keyIdentifier] = key;
+ hashFnLocals[valueIdentifier] = value;
+ hashFnLocals.$index = index;
+ return trackByExpGetter($scope, hashFnLocals);
+ };
+ }
+
+ // Store a list of elements from previous run. This is a hash where key is the item from the
+ // iterator, and the value is objects with following properties.
+ // - scope: bound scope
+ // - element: previous element.
+ // - index: position
+ //
+ // We are using no-proto object so that we don't need to guard against inherited props via
+ // hasOwnProperty.
+ var lastBlockMap = createMap();
+
+ //watch props
+ $scope.$watchCollection(rhs, function ngRepeatAction(collection) {
+ var index, length,
+ previousNode = $element[0], // node that cloned nodes should be inserted after
+ // initialized to the comment node anchor
+ nextNode,
+ // Same as lastBlockMap but it has the current state. It will become the
+ // lastBlockMap on the next iteration.
+ nextBlockMap = createMap(),
+ collectionLength,
+ key, value, // key/value of iteration
+ trackById,
+ trackByIdFn,
+ collectionKeys,
+ block, // last object information {scope, element, id}
+ nextBlockOrder,
+ elementsToRemove;
+
+ if (aliasAs) {
+ $scope[aliasAs] = collection;
+ }
+
+ if (isArrayLike(collection)) {
+ collectionKeys = collection;
+ trackByIdFn = trackByIdExpFn || trackByIdArrayFn;
+ } else {
+ trackByIdFn = trackByIdExpFn || trackByIdObjFn;
+ // if object, extract keys, in enumeration order, unsorted
+ collectionKeys = [];
+ for (var itemKey in collection) {
+ if (hasOwnProperty.call(collection, itemKey) && itemKey.charAt(0) !== '$') {
+ collectionKeys.push(itemKey);
+ }
+ }
+ }
+
+ collectionLength = collectionKeys.length;
+ nextBlockOrder = new Array(collectionLength);
+
+ // locate existing items
+ for (index = 0; index < collectionLength; index++) {
+ key = (collection === collectionKeys) ? index : collectionKeys[index];
+ value = collection[key];
+ trackById = trackByIdFn(key, value, index);
+ if (lastBlockMap[trackById]) {
+ // found previously seen block
+ block = lastBlockMap[trackById];
+ delete lastBlockMap[trackById];
+ nextBlockMap[trackById] = block;
+ nextBlockOrder[index] = block;
+ } else if (nextBlockMap[trackById]) {
+ // if collision detected. restore lastBlockMap and throw an error
+ forEach(nextBlockOrder, function(block) {
+ if (block && block.scope) lastBlockMap[block.id] = block;
+ });
+ throw ngRepeatMinErr('dupes',
+ "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}",
+ expression, trackById, value);
+ } else {
+ // new never before seen block
+ nextBlockOrder[index] = {id: trackById, scope: undefined, clone: undefined};
+ nextBlockMap[trackById] = true;
+ }
+ }
+
+ // remove leftover items
+ for (var blockKey in lastBlockMap) {
+ block = lastBlockMap[blockKey];
+ elementsToRemove = getBlockNodes(block.clone);
+ $animate.leave(elementsToRemove);
+ if (elementsToRemove[0].parentNode) {
+ // if the element was not removed yet because of pending animation, mark it as deleted
+ // so that we can ignore it later
+ for (index = 0, length = elementsToRemove.length; index < length; index++) {
+ elementsToRemove[index][NG_REMOVED] = true;
+ }
+ }
+ block.scope.$destroy();
+ }
+
+ // we are not using forEach for perf reasons (trying to avoid #call)
+ for (index = 0; index < collectionLength; index++) {
+ key = (collection === collectionKeys) ? index : collectionKeys[index];
+ value = collection[key];
+ block = nextBlockOrder[index];
+
+ if (block.scope) {
+ // if we have already seen this object, then we need to reuse the
+ // associated scope/element
+
+ nextNode = previousNode;
+
+ // skip nodes that are already pending removal via leave animation
+ do {
+ nextNode = nextNode.nextSibling;
+ } while (nextNode && nextNode[NG_REMOVED]);
+
+ if (getBlockStart(block) != nextNode) {
+ // existing item which got moved
+ $animate.move(getBlockNodes(block.clone), null, jqLite(previousNode));
+ }
+ previousNode = getBlockEnd(block);
+ updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);
+ } else {
+ // new item which we don't know about
+ $transclude(function ngRepeatTransclude(clone, scope) {
+ block.scope = scope;
+ // http://jsperf.com/clone-vs-createcomment
+ var endNode = ngRepeatEndComment.cloneNode(false);
+ clone[clone.length++] = endNode;
+
+ // TODO(perf): support naked previousNode in `enter` to avoid creation of jqLite wrapper?
+ $animate.enter(clone, null, jqLite(previousNode));
+ previousNode = endNode;
+ // Note: We only need the first/last node of the cloned nodes.
+ // However, we need to keep the reference to the jqlite wrapper as it might be changed later
+ // by a directive with templateUrl when its template arrives.
+ block.clone = clone;
+ nextBlockMap[block.id] = block;
+ updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);
+ });
+ }
+ }
+ lastBlockMap = nextBlockMap;
+ });
+ };
+ }
+ };
+}];
+
+var NG_HIDE_CLASS = 'ng-hide';
+var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
+/**
+ * @ngdoc directive
+ * @name ngShow
+ * @multiElement
+ *
+ * @description
+ * The `ngShow` directive shows or hides the given HTML element based on the expression
+ * provided to the `ngShow` attribute. The element is shown or hidden by removing or adding
+ * the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+ * in AngularJS and sets the display style to none (using an !important flag).
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```html
+ * <!-- when $scope.myValue is truthy (element is visible) -->
+ * <div ng-show="myValue"></div>
+ *
+ * <!-- when $scope.myValue is falsy (element is hidden) -->
+ * <div ng-show="myValue" class="ng-hide"></div>
+ * ```
+ *
+ * When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added to the class
+ * attribute on the element causing it to become hidden. When truthy, the `.ng-hide` CSS class is removed
+ * from the element causing the element not to appear hidden.
+ *
+ * ## Why is !important used?
+ *
+ * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
+ * can be easily overridden by heavier selectors. For example, something as simple
+ * as changing the display style on a HTML list item would make hidden elements appear visible.
+ * This also becomes a bigger issue when dealing with CSS frameworks.
+ *
+ * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+ * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+ * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
+ *
+ * ### Overriding `.ng-hide`
+ *
+ * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
+ * class CSS. Note that the selector that needs to be used is actually `.ng-hide:not(.ng-hide-animate)` to cope
+ * with extra animation classes that can be added.
+ *
+ * ```css
+ * .ng-hide:not(.ng-hide-animate) {
+ * /&#42; this is just another form of hiding an element &#42;/
+ * display: block!important;
+ * position: absolute;
+ * top: -9999px;
+ * left: -9999px;
+ * }
+ * ```
+ *
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
+ *
+ * ## A note about animations with `ngShow`
+ *
+ * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+ * is true and false. This system works like the animation system present with ngClass except that
+ * you must also include the !important flag to override the display property
+ * so that you can perform an animation when the element is hidden during the time of the animation.
+ *
+ * ```css
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
+ * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ * /&#42; this is required as of 1.3x to properly
+ * apply all styling in a show/hide animation &#42;/
+ * transition: 0s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add-active,
+ * .my-element.ng-hide-remove-active {
+ * /&#42; the transition is defined in the active class &#42;/
+ * transition: 1s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add { ... }
+ * .my-element.ng-hide-add.ng-hide-add-active { ... }
+ * .my-element.ng-hide-remove { ... }
+ * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+ * ```
+ *
+ * Keep in mind that, as of AngularJS version 1.3.0-beta.11, there is no need to change the display
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
+ *
+ * @animations
+ * addClass: `.ng-hide` - happens after the `ngShow` expression evaluates to a truthy value and the just before contents are set to visible
+ * removeClass: `.ng-hide` - happens after the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden
+ *
+ * @element ANY
+ * @param {expression} ngShow If the {@link guide/expression expression} is truthy
+ * then the element is shown or hidden respectively.
+ *
+ * @example
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ Click me: <input type="checkbox" ng-model="checked" aria-label="Toggle ngHide"><br/>
+ <div>
+ Show:
+ <div class="check-element animate-show" ng-show="checked">
+ <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+ </div>
+ </div>
+ <div>
+ Hide:
+ <div class="check-element animate-show" ng-hide="checked">
+ <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+ </div>
+ </div>
+ </file>
+ <file name="glyphicons.css">
+ @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);
+ </file>
+ <file name="animations.css">
+ .animate-show {
+ line-height: 20px;
+ opacity: 1;
+ padding: 10px;
+ border: 1px solid black;
+ background: white;
+ }
+
+ .animate-show.ng-hide-add, .animate-show.ng-hide-remove {
+ transition: all linear 0.5s;
+ }
+
+ .animate-show.ng-hide {
+ line-height: 0;
+ opacity: 0;
+ padding: 0 10px;
+ }
+
+ .check-element {
+ padding: 10px;
+ border: 1px solid black;
+ background: white;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+ var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+ it('should check ng-show / ng-hide', function() {
+ expect(thumbsUp.isDisplayed()).toBeFalsy();
+ expect(thumbsDown.isDisplayed()).toBeTruthy();
+
+ element(by.model('checked')).click();
+
+ expect(thumbsUp.isDisplayed()).toBeTruthy();
+ expect(thumbsDown.isDisplayed()).toBeFalsy();
+ });
+ </file>
+ </example>
+ */
+var ngShowDirective = ['$animate', function($animate) {
+ return {
+ restrict: 'A',
+ multiElement: true,
+ link: function(scope, element, attr) {
+ scope.$watch(attr.ngShow, function ngShowWatchAction(value) {
+ // we're adding a temporary, animation-specific class for ng-hide since this way
+ // we can control when the element is actually displayed on screen without having
+ // to have a global/greedy CSS selector that breaks when other animations are run.
+ // Read: https://github.com/angular/angular.js/issues/9103#issuecomment-58335845
+ $animate[value ? 'removeClass' : 'addClass'](element, NG_HIDE_CLASS, {
+ tempClasses: NG_HIDE_IN_PROGRESS_CLASS
+ });
+ });
+ }
+ };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngHide
+ * @multiElement
+ *
+ * @description
+ * The `ngHide` directive shows or hides the given HTML element based on the expression
+ * provided to the `ngHide` attribute. The element is shown or hidden by removing or adding
+ * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+ * in AngularJS and sets the display style to none (using an !important flag).
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```html
+ * <!-- when $scope.myValue is truthy (element is hidden) -->
+ * <div ng-hide="myValue" class="ng-hide"></div>
+ *
+ * <!-- when $scope.myValue is falsy (element is visible) -->
+ * <div ng-hide="myValue"></div>
+ * ```
+ *
+ * When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added to the class
+ * attribute on the element causing it to become hidden. When falsy, the `.ng-hide` CSS class is removed
+ * from the element causing the element not to appear hidden.
+ *
+ * ## Why is !important used?
+ *
+ * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
+ * can be easily overridden by heavier selectors. For example, something as simple
+ * as changing the display style on a HTML list item would make hidden elements appear visible.
+ * This also becomes a bigger issue when dealing with CSS frameworks.
+ *
+ * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+ * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+ * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
+ *
+ * ### Overriding `.ng-hide`
+ *
+ * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
+ * class in CSS:
+ *
+ * ```css
+ * .ng-hide {
+ * /&#42; this is just another form of hiding an element &#42;/
+ * display: block!important;
+ * position: absolute;
+ * top: -9999px;
+ * left: -9999px;
+ * }
+ * ```
+ *
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
+ *
+ * ## A note about animations with `ngHide`
+ *
+ * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+ * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`
+ * CSS class is added and removed for you instead of your own CSS class.
+ *
+ * ```css
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
+ * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ * transition: 0.5s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add { ... }
+ * .my-element.ng-hide-add.ng-hide-add-active { ... }
+ * .my-element.ng-hide-remove { ... }
+ * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+ * ```
+ *
+ * Keep in mind that, as of AngularJS version 1.3.0-beta.11, there is no need to change the display
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
+ *
+ * @animations
+ * removeClass: `.ng-hide` - happens after the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden
+ * addClass: `.ng-hide` - happens after the `ngHide` expression evaluates to a non truthy value and just before the contents are set to visible
+ *
+ * @element ANY
+ * @param {expression} ngHide If the {@link guide/expression expression} is truthy then
+ * the element is shown or hidden respectively.
+ *
+ * @example
+ <example module="ngAnimate" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ Click me: <input type="checkbox" ng-model="checked" aria-label="Toggle ngShow"><br/>
+ <div>
+ Show:
+ <div class="check-element animate-hide" ng-show="checked">
+ <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+ </div>
+ </div>
+ <div>
+ Hide:
+ <div class="check-element animate-hide" ng-hide="checked">
+ <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+ </div>
+ </div>
+ </file>
+ <file name="glyphicons.css">
+ @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);
+ </file>
+ <file name="animations.css">
+ .animate-hide {
+ transition: all linear 0.5s;
+ line-height: 20px;
+ opacity: 1;
+ padding: 10px;
+ border: 1px solid black;
+ background: white;
+ }
+
+ .animate-hide.ng-hide {
+ line-height: 0;
+ opacity: 0;
+ padding: 0 10px;
+ }
+
+ .check-element {
+ padding: 10px;
+ border: 1px solid black;
+ background: white;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+ var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+ it('should check ng-show / ng-hide', function() {
+ expect(thumbsUp.isDisplayed()).toBeFalsy();
+ expect(thumbsDown.isDisplayed()).toBeTruthy();
+
+ element(by.model('checked')).click();
+
+ expect(thumbsUp.isDisplayed()).toBeTruthy();
+ expect(thumbsDown.isDisplayed()).toBeFalsy();
+ });
+ </file>
+ </example>
+ */
+var ngHideDirective = ['$animate', function($animate) {
+ return {
+ restrict: 'A',
+ multiElement: true,
+ link: function(scope, element, attr) {
+ scope.$watch(attr.ngHide, function ngHideWatchAction(value) {
+ // The comment inside of the ngShowDirective explains why we add and
+ // remove a temporary class for the show/hide animation
+ $animate[value ? 'addClass' : 'removeClass'](element,NG_HIDE_CLASS, {
+ tempClasses: NG_HIDE_IN_PROGRESS_CLASS
+ });
+ });
+ }
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngStyle
+ * @restrict AC
+ *
+ * @description
+ * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.
+ *
+ * @element ANY
+ * @param {expression} ngStyle
+ *
+ * {@link guide/expression Expression} which evals to an
+ * object whose keys are CSS style names and values are corresponding values for those CSS
+ * keys.
+ *
+ * Since some CSS style names are not valid keys for an object, they must be quoted.
+ * See the 'background-color' style in the example below.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <input type="button" value="set color" ng-click="myStyle={color:'red'}">
+ <input type="button" value="set background" ng-click="myStyle={'background-color':'blue'}">
+ <input type="button" value="clear" ng-click="myStyle={}">
+ <br/>
+ <span ng-style="myStyle">Sample Text</span>
+ <pre>myStyle={{myStyle}}</pre>
+ </file>
+ <file name="style.css">
+ span {
+ color: black;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var colorSpan = element(by.css('span'));
+
+ it('should check ng-style', function() {
+ expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
+ element(by.css('input[value=\'set color\']')).click();
+ expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');
+ element(by.css('input[value=clear]')).click();
+ expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
+ });
+ </file>
+ </example>
+ */
+var ngStyleDirective = ngDirective(function(scope, element, attr) {
+ scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
+ if (oldStyles && (newStyles !== oldStyles)) {
+ forEach(oldStyles, function(val, style) { element.css(style, '');});
+ }
+ if (newStyles) element.css(newStyles);
+ }, true);
+});
+
+/**
+ * @ngdoc directive
+ * @name ngSwitch
+ * @restrict EA
+ *
+ * @description
+ * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.
+ * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location
+ * as specified in the template.
+ *
+ * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
+ * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element
+ * matches the value obtained from the evaluated expression. In other words, you define a container element
+ * (where you place the directive), place an expression on the **`on="..."` attribute**
+ * (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place
+ * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on
+ * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default
+ * attribute is displayed.
+ *
+ * <div class="alert alert-info">
+ * Be aware that the attribute values to match against cannot be expressions. They are interpreted
+ * as literal string values to match against.
+ * For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the
+ * value of the expression `$scope.someVal`.
+ * </div>
+
+ * @animations
+ * enter - happens after the ngSwitch contents change and the matched child element is placed inside the container
+ * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM
+ *
+ * @usage
+ *
+ * ```
+ * <ANY ng-switch="expression">
+ * <ANY ng-switch-when="matchValue1">...</ANY>
+ * <ANY ng-switch-when="matchValue2">...</ANY>
+ * <ANY ng-switch-default>...</ANY>
+ * </ANY>
+ * ```
+ *
+ *
+ * @scope
+ * @priority 1200
+ * @param {*} ngSwitch|on expression to match against <code>ng-switch-when</code>.
+ * On child elements add:
+ *
+ * * `ngSwitchWhen`: the case statement to match against. If match then this
+ * case will be displayed. If the same match appears multiple times, all the
+ * elements will be displayed.
+ * * `ngSwitchDefault`: the default case when no other case match. If there
+ * are multiple default cases, all of them will be displayed when no other
+ * case match.
+ *
+ *
+ * @example
+ <example module="switchExample" deps="angular-animate.js" animations="true">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <select ng-model="selection" ng-options="item for item in items">
+ </select>
+ <code>selection={{selection}}</code>
+ <hr/>
+ <div class="animate-switch-container"
+ ng-switch on="selection">
+ <div class="animate-switch" ng-switch-when="settings">Settings Div</div>
+ <div class="animate-switch" ng-switch-when="home">Home Span</div>
+ <div class="animate-switch" ng-switch-default>default</div>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('switchExample', ['ngAnimate'])
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.items = ['settings', 'home', 'other'];
+ $scope.selection = $scope.items[0];
+ }]);
+ </file>
+ <file name="animations.css">
+ .animate-switch-container {
+ position:relative;
+ background:white;
+ border:1px solid black;
+ height:40px;
+ overflow:hidden;
+ }
+
+ .animate-switch {
+ padding:10px;
+ }
+
+ .animate-switch.ng-animate {
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+
+ position:absolute;
+ top:0;
+ left:0;
+ right:0;
+ bottom:0;
+ }
+
+ .animate-switch.ng-leave.ng-leave-active,
+ .animate-switch.ng-enter {
+ top:-50px;
+ }
+ .animate-switch.ng-leave,
+ .animate-switch.ng-enter.ng-enter-active {
+ top:0;
+ }
+ </file>
+ <file name="protractor.js" type="protractor">
+ var switchElem = element(by.css('[ng-switch]'));
+ var select = element(by.model('selection'));
+
+ it('should start in settings', function() {
+ expect(switchElem.getText()).toMatch(/Settings Div/);
+ });
+ it('should change to home', function() {
+ select.all(by.css('option')).get(1).click();
+ expect(switchElem.getText()).toMatch(/Home Span/);
+ });
+ it('should select default', function() {
+ select.all(by.css('option')).get(2).click();
+ expect(switchElem.getText()).toMatch(/default/);
+ });
+ </file>
+ </example>
+ */
+var ngSwitchDirective = ['$animate', function($animate) {
+ return {
+ require: 'ngSwitch',
+
+ // asks for $scope to fool the BC controller module
+ controller: ['$scope', function ngSwitchController() {
+ this.cases = {};
+ }],
+ link: function(scope, element, attr, ngSwitchController) {
+ var watchExpr = attr.ngSwitch || attr.on,
+ selectedTranscludes = [],
+ selectedElements = [],
+ previousLeaveAnimations = [],
+ selectedScopes = [];
+
+ var spliceFactory = function(array, index) {
+ return function() { array.splice(index, 1); };
+ };
+
+ scope.$watch(watchExpr, function ngSwitchWatchAction(value) {
+ var i, ii;
+ for (i = 0, ii = previousLeaveAnimations.length; i < ii; ++i) {
+ $animate.cancel(previousLeaveAnimations[i]);
+ }
+ previousLeaveAnimations.length = 0;
+
+ for (i = 0, ii = selectedScopes.length; i < ii; ++i) {
+ var selected = getBlockNodes(selectedElements[i].clone);
+ selectedScopes[i].$destroy();
+ var promise = previousLeaveAnimations[i] = $animate.leave(selected);
+ promise.then(spliceFactory(previousLeaveAnimations, i));
+ }
+
+ selectedElements.length = 0;
+ selectedScopes.length = 0;
+
+ if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {
+ forEach(selectedTranscludes, function(selectedTransclude) {
+ selectedTransclude.transclude(function(caseElement, selectedScope) {
+ selectedScopes.push(selectedScope);
+ var anchor = selectedTransclude.element;
+ caseElement[caseElement.length++] = document.createComment(' end ngSwitchWhen: ');
+ var block = { clone: caseElement };
+
+ selectedElements.push(block);
+ $animate.enter(caseElement, anchor.parent(), anchor);
+ });
+ });
+ }
+ });
+ }
+ };
+}];
+
+var ngSwitchWhenDirective = ngDirective({
+ transclude: 'element',
+ priority: 1200,
+ require: '^ngSwitch',
+ multiElement: true,
+ link: function(scope, element, attrs, ctrl, $transclude) {
+ ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);
+ ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });
+ }
+});
+
+var ngSwitchDefaultDirective = ngDirective({
+ transclude: 'element',
+ priority: 1200,
+ require: '^ngSwitch',
+ multiElement: true,
+ link: function(scope, element, attr, ctrl, $transclude) {
+ ctrl.cases['?'] = (ctrl.cases['?'] || []);
+ ctrl.cases['?'].push({ transclude: $transclude, element: element });
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngTransclude
+ * @restrict EAC
+ *
+ * @description
+ * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
+ *
+ * You can specify that you want to insert a named transclusion slot, instead of the default slot, by providing the slot name
+ * as the value of the `ng-transclude` or `ng-transclude-slot` attribute.
+ *
+ * Any existing content of the element that this directive is placed on will be removed before the transcluded content is inserted.
+ *
+ * @element ANY
+ *
+ * @param {string} ngTransclude|ngTranscludeSlot the name of the slot to insert at this point. If this is not provided or empty then
+ * the default slot is used.
+ *
+ * @example
+ * ### Default transclusion
+ * This example demonstrates simple transclusion.
+ <example name="simpleTranscludeExample" module="transcludeExample">
+ <file name="index.html">
+ <script>
+ angular.module('transcludeExample', [])
+ .directive('pane', function(){
+ return {
+ restrict: 'E',
+ transclude: true,
+ scope: { title:'@' },
+ template: '<div style="border: 1px solid black;">' +
+ '<div style="background-color: gray">{{title}}</div>' +
+ '<ng-transclude></ng-transclude>' +
+ '</div>'
+ };
+ })
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.title = 'Lorem Ipsum';
+ $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
+ }]);
+ </script>
+ <div ng-controller="ExampleController">
+ <input ng-model="title" aria-label="title"> <br/>
+ <textarea ng-model="text" aria-label="text"></textarea> <br/>
+ <pane title="{{title}}">{{text}}</pane>
+ </div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should have transcluded', function() {
+ var titleElement = element(by.model('title'));
+ titleElement.clear();
+ titleElement.sendKeys('TITLE');
+ var textElement = element(by.model('text'));
+ textElement.clear();
+ textElement.sendKeys('TEXT');
+ expect(element(by.binding('title')).getText()).toEqual('TITLE');
+ expect(element(by.binding('text')).getText()).toEqual('TEXT');
+ });
+ </file>
+ </example>
+ *
+ * @example
+ * ### Multi-slot transclusion
+ <example name="multiSlotTranscludeExample" module="multiSlotTranscludeExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <input ng-model="title" aria-label="title"> <br/>
+ <textarea ng-model="text" aria-label="text"></textarea> <br/>
+ <pane>
+ <pane-title><a ng-href="{{link}}">{{title}}</a></pane-title>
+ <pane-body><p>{{text}}</p></pane-body>
+ </pane>
+ </div>
+ </file>
+ <file name="app.js">
+ angular.module('multiSlotTranscludeExample', [])
+ .directive('pane', function(){
+ return {
+ restrict: 'E',
+ transclude: {
+ 'paneTitle': '?title',
+ 'paneBody': 'body'
+ },
+ template: '<div style="border: 1px solid black;">' +
+ '<div ng-transclude="title" style="background-color: gray"></div>' +
+ '<div ng-transclude="body"></div>' +
+ '</div>'
+ };
+ })
+ .controller('ExampleController', ['$scope', function($scope) {
+ $scope.title = 'Lorem Ipsum';
+ $scope.link = "https://google.com";
+ $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
+ }]);
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should have transcluded the title and the body', function() {
+ var titleElement = element(by.model('title'));
+ titleElement.clear();
+ titleElement.sendKeys('TITLE');
+ var textElement = element(by.model('text'));
+ textElement.clear();
+ textElement.sendKeys('TEXT');
+ expect(element(by.binding('title')).getText()).toEqual('TITLE');
+ expect(element(by.binding('text')).getText()).toEqual('TEXT');
+ });
+ </file>
+ </example> */
+var ngTranscludeMinErr = minErr('ngTransclude');
+var ngTranscludeDirective = ngDirective({
+ restrict: 'EAC',
+ link: function($scope, $element, $attrs, controller, $transclude) {
+
+ function ngTranscludeCloneAttachFn(clone) {
+ $element.empty();
+ $element.append(clone);
+ }
+
+ if (!$transclude) {
+ throw ngTranscludeMinErr('orphan',
+ 'Illegal use of ngTransclude directive in the template! ' +
+ 'No parent directive that requires a transclusion found. ' +
+ 'Element: {0}',
+ startingTag($element));
+ }
+
+ $transclude(ngTranscludeCloneAttachFn, null, $attrs.ngTransclude || $attrs.ngTranscludeSlot);
+ }
+});
+
+/**
+ * @ngdoc directive
+ * @name script
+ * @restrict E
+ *
+ * @description
+ * Load the content of a `<script>` element into {@link ng.$templateCache `$templateCache`}, so that the
+ * template can be used by {@link ng.directive:ngInclude `ngInclude`},
+ * {@link ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the
+ * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be
+ * assigned through the element's `id`, which can then be used as a directive's `templateUrl`.
+ *
+ * @param {string} type Must be set to `'text/ng-template'`.
+ * @param {string} id Cache name of the template.
+ *
+ * @example
+ <example>
+ <file name="index.html">
+ <script type="text/ng-template" id="/tpl.html">
+ Content of the template.
+ </script>
+
+ <a ng-click="currentTpl='/tpl.html'" id="tpl-link">Load inlined template</a>
+ <div id="tpl-content" ng-include src="currentTpl"></div>
+ </file>
+ <file name="protractor.js" type="protractor">
+ it('should load template defined inside script tag', function() {
+ element(by.css('#tpl-link')).click();
+ expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);
+ });
+ </file>
+ </example>
+ */
+var scriptDirective = ['$templateCache', function($templateCache) {
+ return {
+ restrict: 'E',
+ terminal: true,
+ compile: function(element, attr) {
+ if (attr.type == 'text/ng-template') {
+ var templateUrl = attr.id,
+ text = element[0].text;
+
+ $templateCache.put(templateUrl, text);
+ }
+ }
+ };
+}];
+
+var noopNgModelController = { $setViewValue: noop, $render: noop };
+
+function chromeHack(optionElement) {
+ // Workaround for https://code.google.com/p/chromium/issues/detail?id=381459
+ // Adding an <option selected="selected"> element to a <select required="required"> should
+ // automatically select the new element
+ if (optionElement[0].hasAttribute('selected')) {
+ optionElement[0].selected = true;
+ }
+}
+
+/**
+ * @ngdoc type
+ * @name select.SelectController
+ * @description
+ * The controller for the `<select>` directive. This provides support for reading
+ * and writing the selected value(s) of the control and also coordinates dynamically
+ * added `<option>` elements, perhaps by an `ngRepeat` directive.
+ */
+var SelectController =
+ ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {
+
+ var self = this,
+ optionsMap = new HashMap();
+
+ // If the ngModel doesn't get provided then provide a dummy noop version to prevent errors
+ self.ngModelCtrl = noopNgModelController;
+
+ // The "unknown" option is one that is prepended to the list if the viewValue
+ // does not match any of the options. When it is rendered the value of the unknown
+ // option is '? XXX ?' where XXX is the hashKey of the value that is not known.
+ //
+ // We can't just jqLite('<option>') since jqLite is not smart enough
+ // to create it in <select> and IE barfs otherwise.
+ self.unknownOption = jqLite(document.createElement('option'));
+ self.renderUnknownOption = function(val) {
+ var unknownVal = '? ' + hashKey(val) + ' ?';
+ self.unknownOption.val(unknownVal);
+ $element.prepend(self.unknownOption);
+ $element.val(unknownVal);
+ };
+
+ $scope.$on('$destroy', function() {
+ // disable unknown option so that we don't do work when the whole select is being destroyed
+ self.renderUnknownOption = noop;
+ });
+
+ self.removeUnknownOption = function() {
+ if (self.unknownOption.parent()) self.unknownOption.remove();
+ };
+
+
+ // Read the value of the select control, the implementation of this changes depending
+ // upon whether the select can have multiple values and whether ngOptions is at work.
+ self.readValue = function readSingleValue() {
+ self.removeUnknownOption();
+ return $element.val();
+ };
+
+
+ // Write the value to the select control, the implementation of this changes depending
+ // upon whether the select can have multiple values and whether ngOptions is at work.
+ self.writeValue = function writeSingleValue(value) {
+ if (self.hasOption(value)) {
+ self.removeUnknownOption();
+ $element.val(value);
+ if (value === '') self.emptyOption.prop('selected', true); // to make IE9 happy
+ } else {
+ if (value == null && self.emptyOption) {
+ self.removeUnknownOption();
+ $element.val('');
+ } else {
+ self.renderUnknownOption(value);
+ }
+ }
+ };
+
+
+ // Tell the select control that an option, with the given value, has been added
+ self.addOption = function(value, element) {
+ assertNotHasOwnProperty(value, '"option value"');
+ if (value === '') {
+ self.emptyOption = element;
+ }
+ var count = optionsMap.get(value) || 0;
+ optionsMap.put(value, count + 1);
+ self.ngModelCtrl.$render();
+ chromeHack(element);
+ };
+
+ // Tell the select control that an option, with the given value, has been removed
+ self.removeOption = function(value) {
+ var count = optionsMap.get(value);
+ if (count) {
+ if (count === 1) {
+ optionsMap.remove(value);
+ if (value === '') {
+ self.emptyOption = undefined;
+ }
+ } else {
+ optionsMap.put(value, count - 1);
+ }
+ }
+ };
+
+ // Check whether the select control has an option matching the given value
+ self.hasOption = function(value) {
+ return !!optionsMap.get(value);
+ };
+
+
+ self.registerOption = function(optionScope, optionElement, optionAttrs, interpolateValueFn, interpolateTextFn) {
+
+ if (interpolateValueFn) {
+ // The value attribute is interpolated
+ var oldVal;
+ optionAttrs.$observe('value', function valueAttributeObserveAction(newVal) {
+ if (isDefined(oldVal)) {
+ self.removeOption(oldVal);
+ }
+ oldVal = newVal;
+ self.addOption(newVal, optionElement);
+ });
+ } else if (interpolateTextFn) {
+ // The text content is interpolated
+ optionScope.$watch(interpolateTextFn, function interpolateWatchAction(newVal, oldVal) {
+ optionAttrs.$set('value', newVal);
+ if (oldVal !== newVal) {
+ self.removeOption(oldVal);
+ }
+ self.addOption(newVal, optionElement);
+ });
+ } else {
+ // The value attribute is static
+ self.addOption(optionAttrs.value, optionElement);
+ }
+
+ optionElement.on('$destroy', function() {
+ self.removeOption(optionAttrs.value);
+ self.ngModelCtrl.$render();
+ });
+ };
+}];
+
+/**
+ * @ngdoc directive
+ * @name select
+ * @restrict E
+ *
+ * @description
+ * HTML `SELECT` element with angular data-binding.
+ *
+ * The `select` directive is used together with {@link ngModel `ngModel`} to provide data-binding
+ * between the scope and the `<select>` control (including setting default values).
+ * ÃŒt also handles dynamic `<option>` elements, which can be added using the {@link ngRepeat `ngRepeat}` or
+ * {@link ngOptions `ngOptions`} directives.
+ *
+ * When an item in the `<select>` menu is selected, the value of the selected option will be bound
+ * to the model identified by the `ngModel` directive. With static or repeated options, this is
+ * the content of the `value` attribute or the textContent of the `<option>`, if the value attribute is missing.
+ * If you want dynamic value attributes, you can use interpolation inside the value attribute.
+ *
+ * <div class="alert alert-warning">
+ * Note that the value of a `select` directive used without `ngOptions` is always a string.
+ * When the model needs to be bound to a non-string value, you must either explictly convert it
+ * using a directive (see example below) or use `ngOptions` to specify the set of options.
+ * This is because an option element can only be bound to string values at present.
+ * </div>
+ *
+ * If the viewValue of `ngModel` does not match any of the options, then the control
+ * will automatically add an "unknown" option, which it then removes when the mismatch is resolved.
+ *
+ * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can
+ * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
+ * option. See example below for demonstration.
+ *
+ * <div class="alert alert-info">
+ * In many cases, `ngRepeat` can be used on `<option>` elements instead of {@link ng.directive:ngOptions
+ * ngOptions} to achieve a similar result. However, `ngOptions` provides some benefits, such as
+ * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the
+ * comprehension expression, and additionally in reducing memory and increasing speed by not creating
+ * a new scope for each repeated instance.
+ * </div>
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} multiple Allows multiple options to be selected. The selected values will be
+ * bound to the model as an array.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds required attribute and required validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use ngRequired instead of required
+ * when you want to data-bind to the required attribute.
+ * @param {string=} ngChange Angular expression to be executed when selected option(s) changes due to user
+ * interaction with the select element.
+ * @param {string=} ngOptions sets the options that the select is populated with and defines what is
+ * set on the model on selection. See {@link ngOptions `ngOptions`}.
+ *
+ * @example
+ * ### Simple `select` elements with static options
+ *
+ * <example name="static-select" module="staticSelect">
+ * <file name="index.html">
+ * <div ng-controller="ExampleController">
+ * <form name="myForm">
+ * <label for="singleSelect"> Single select: </label><br>
+ * <select name="singleSelect" ng-model="data.singleSelect">
+ * <option value="option-1">Option 1</option>
+ * <option value="option-2">Option 2</option>
+ * </select><br>
+ *
+ * <label for="singleSelect"> Single select with "not selected" option and dynamic option values: </label><br>
+ * <select name="singleSelect" id="singleSelect" ng-model="data.singleSelect">
+ * <option value="">---Please select---</option> <!-- not selected / blank option -->
+ * <option value="{{data.option1}}">Option 1</option> <!-- interpolation -->
+ * <option value="option-2">Option 2</option>
+ * </select><br>
+ * <button ng-click="forceUnknownOption()">Force unknown option</button><br>
+ * <tt>singleSelect = {{data.singleSelect}}</tt>
+ *
+ * <hr>
+ * <label for="multipleSelect"> Multiple select: </label><br>
+ * <select name="multipleSelect" id="multipleSelect" ng-model="data.multipleSelect" multiple>
+ * <option value="option-1">Option 1</option>
+ * <option value="option-2">Option 2</option>
+ * <option value="option-3">Option 3</option>
+ * </select><br>
+ * <tt>multipleSelect = {{data.multipleSelect}}</tt><br/>
+ * </form>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('staticSelect', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.data = {
+ * singleSelect: null,
+ * multipleSelect: [],
+ * option1: 'option-1',
+ * };
+ *
+ * $scope.forceUnknownOption = function() {
+ * $scope.data.singleSelect = 'nonsense';
+ * };
+ * }]);
+ * </file>
+ *</example>
+ *
+ * ### Using `ngRepeat` to generate `select` options
+ * <example name="ngrepeat-select" module="ngrepeatSelect">
+ * <file name="index.html">
+ * <div ng-controller="ExampleController">
+ * <form name="myForm">
+ * <label for="repeatSelect"> Repeat select: </label>
+ * <select name="repeatSelect" id="repeatSelect" ng-model="data.repeatSelect">
+ * <option ng-repeat="option in data.availableOptions" value="{{option.id}}">{{option.name}}</option>
+ * </select>
+ * </form>
+ * <hr>
+ * <tt>repeatSelect = {{data.repeatSelect}}</tt><br/>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('ngrepeatSelect', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.data = {
+ * repeatSelect: null,
+ * availableOptions: [
+ * {id: '1', name: 'Option A'},
+ * {id: '2', name: 'Option B'},
+ * {id: '3', name: 'Option C'}
+ * ],
+ * };
+ * }]);
+ * </file>
+ *</example>
+ *
+ *
+ * ### Using `select` with `ngOptions` and setting a default value
+ * See the {@link ngOptions ngOptions documentation} for more `ngOptions` usage examples.
+ *
+ * <example name="select-with-default-values" module="defaultValueSelect">
+ * <file name="index.html">
+ * <div ng-controller="ExampleController">
+ * <form name="myForm">
+ * <label for="mySelect">Make a choice:</label>
+ * <select name="mySelect" id="mySelect"
+ * ng-options="option.name for option in data.availableOptions track by option.id"
+ * ng-model="data.selectedOption"></select>
+ * </form>
+ * <hr>
+ * <tt>option = {{data.selectedOption}}</tt><br/>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ * angular.module('defaultValueSelect', [])
+ * .controller('ExampleController', ['$scope', function($scope) {
+ * $scope.data = {
+ * availableOptions: [
+ * {id: '1', name: 'Option A'},
+ * {id: '2', name: 'Option B'},
+ * {id: '3', name: 'Option C'}
+ * ],
+ * selectedOption: {id: '3', name: 'Option C'} //This sets the default value of the select in the ui
+ * };
+ * }]);
+ * </file>
+ *</example>
+ *
+ *
+ * ### Binding `select` to a non-string value via `ngModel` parsing / formatting
+ *
+ * <example name="select-with-non-string-options" module="nonStringSelect">
+ * <file name="index.html">
+ * <select ng-model="model.id" convert-to-number>
+ * <option value="0">Zero</option>
+ * <option value="1">One</option>
+ * <option value="2">Two</option>
+ * </select>
+ * {{ model }}
+ * </file>
+ * <file name="app.js">
+ * angular.module('nonStringSelect', [])
+ * .run(function($rootScope) {
+ * $rootScope.model = { id: 2 };
+ * })
+ * .directive('convertToNumber', function() {
+ * return {
+ * require: 'ngModel',
+ * link: function(scope, element, attrs, ngModel) {
+ * ngModel.$parsers.push(function(val) {
+ * return parseInt(val, 10);
+ * });
+ * ngModel.$formatters.push(function(val) {
+ * return '' + val;
+ * });
+ * }
+ * };
+ * });
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should initialize to model', function() {
+ * var select = element(by.css('select'));
+ * expect(element(by.model('model.id')).$('option:checked').getText()).toEqual('Two');
+ * });
+ * </file>
+ * </example>
+ *
+ */
+var selectDirective = function() {
+
+ return {
+ restrict: 'E',
+ require: ['select', '?ngModel'],
+ controller: SelectController,
+ priority: 1,
+ link: {
+ pre: selectPreLink
+ }
+ };
+
+ function selectPreLink(scope, element, attr, ctrls) {
+
+ // if ngModel is not defined, we don't need to do anything
+ var ngModelCtrl = ctrls[1];
+ if (!ngModelCtrl) return;
+
+ var selectCtrl = ctrls[0];
+
+ selectCtrl.ngModelCtrl = ngModelCtrl;
+
+ // We delegate rendering to the `writeValue` method, which can be changed
+ // if the select can have multiple selected values or if the options are being
+ // generated by `ngOptions`
+ ngModelCtrl.$render = function() {
+ selectCtrl.writeValue(ngModelCtrl.$viewValue);
+ };
+
+ // When the selected item(s) changes we delegate getting the value of the select control
+ // to the `readValue` method, which can be changed if the select can have multiple
+ // selected values or if the options are being generated by `ngOptions`
+ element.on('change', function() {
+ scope.$apply(function() {
+ ngModelCtrl.$setViewValue(selectCtrl.readValue());
+ });
+ });
+
+ // If the select allows multiple values then we need to modify how we read and write
+ // values from and to the control; also what it means for the value to be empty and
+ // we have to add an extra watch since ngModel doesn't work well with arrays - it
+ // doesn't trigger rendering if only an item in the array changes.
+ if (attr.multiple) {
+
+ // Read value now needs to check each option to see if it is selected
+ selectCtrl.readValue = function readMultipleValue() {
+ var array = [];
+ forEach(element.find('option'), function(option) {
+ if (option.selected) {
+ array.push(option.value);
+ }
+ });
+ return array;
+ };
+
+ // Write value now needs to set the selected property of each matching option
+ selectCtrl.writeValue = function writeMultipleValue(value) {
+ var items = new HashMap(value);
+ forEach(element.find('option'), function(option) {
+ option.selected = isDefined(items.get(option.value));
+ });
+ };
+
+ // we have to do it on each watch since ngModel watches reference, but
+ // we need to work of an array, so we need to see if anything was inserted/removed
+ var lastView, lastViewRef = NaN;
+ scope.$watch(function selectMultipleWatch() {
+ if (lastViewRef === ngModelCtrl.$viewValue && !equals(lastView, ngModelCtrl.$viewValue)) {
+ lastView = shallowCopy(ngModelCtrl.$viewValue);
+ ngModelCtrl.$render();
+ }
+ lastViewRef = ngModelCtrl.$viewValue;
+ });
+
+ // If we are a multiple select then value is now a collection
+ // so the meaning of $isEmpty changes
+ ngModelCtrl.$isEmpty = function(value) {
+ return !value || value.length === 0;
+ };
+
+ }
+ }
+};
+
+
+// The option directive is purely designed to communicate the existence (or lack of)
+// of dynamically created (and destroyed) option elements to their containing select
+// directive via its controller.
+var optionDirective = ['$interpolate', function($interpolate) {
+ return {
+ restrict: 'E',
+ priority: 100,
+ compile: function(element, attr) {
+
+ if (isDefined(attr.value)) {
+ // If the value attribute is defined, check if it contains an interpolation
+ var interpolateValueFn = $interpolate(attr.value, true);
+ } else {
+ // If the value attribute is not defined then we fall back to the
+ // text content of the option element, which may be interpolated
+ var interpolateTextFn = $interpolate(element.text(), true);
+ if (!interpolateTextFn) {
+ attr.$set('value', element.text());
+ }
+ }
+
+ return function(scope, element, attr) {
+
+ // This is an optimization over using ^^ since we don't want to have to search
+ // all the way to the root of the DOM for every single option element
+ var selectCtrlName = '$selectController',
+ parent = element.parent(),
+ selectCtrl = parent.data(selectCtrlName) ||
+ parent.parent().data(selectCtrlName); // in case we are in optgroup
+
+ if (selectCtrl) {
+ selectCtrl.registerOption(scope, element, attr, interpolateValueFn, interpolateTextFn);
+ }
+ };
+ }
+ };
+}];
+
+var styleDirective = valueFn({
+ restrict: 'E',
+ terminal: false
+});
+
+var requiredDirective = function() {
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ if (!ctrl) return;
+ attr.required = true; // force truthy in case we are on non input element
+
+ ctrl.$validators.required = function(modelValue, viewValue) {
+ return !attr.required || !ctrl.$isEmpty(viewValue);
+ };
+
+ attr.$observe('required', function() {
+ ctrl.$validate();
+ });
+ }
+ };
+};
+
+
+var patternDirective = function() {
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ if (!ctrl) return;
+
+ var regexp, patternExp = attr.ngPattern || attr.pattern;
+ attr.$observe('pattern', function(regex) {
+ if (isString(regex) && regex.length > 0) {
+ regex = new RegExp('^' + regex + '$');
+ }
+
+ if (regex && !regex.test) {
+ throw minErr('ngPattern')('noregexp',
+ 'Expected {0} to be a RegExp but was {1}. Element: {2}', patternExp,
+ regex, startingTag(elm));
+ }
+
+ regexp = regex || undefined;
+ ctrl.$validate();
+ });
+
+ ctrl.$validators.pattern = function(modelValue, viewValue) {
+ // HTML5 pattern constraint validates the input value, so we validate the viewValue
+ return ctrl.$isEmpty(viewValue) || isUndefined(regexp) || regexp.test(viewValue);
+ };
+ }
+ };
+};
+
+
+var maxlengthDirective = function() {
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ if (!ctrl) return;
+
+ var maxlength = -1;
+ attr.$observe('maxlength', function(value) {
+ var intVal = toInt(value);
+ maxlength = isNaN(intVal) ? -1 : intVal;
+ ctrl.$validate();
+ });
+ ctrl.$validators.maxlength = function(modelValue, viewValue) {
+ return (maxlength < 0) || ctrl.$isEmpty(viewValue) || (viewValue.length <= maxlength);
+ };
+ }
+ };
+};
+
+var minlengthDirective = function() {
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ if (!ctrl) return;
+
+ var minlength = 0;
+ attr.$observe('minlength', function(value) {
+ minlength = toInt(value) || 0;
+ ctrl.$validate();
+ });
+ ctrl.$validators.minlength = function(modelValue, viewValue) {
+ return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;
+ };
+ }
+ };
+};
+
+if (window.angular.bootstrap) {
+ //AngularJS is already loaded, so we can return here...
+ console.log('WARNING: Tried to load angular more than once.');
+ return;
+}
+
+//try to bind to jquery now so that one can write jqLite(document).ready()
+//but we will rebind on bootstrap again.
+bindJQuery();
+
+publishExternalAPI(angular);
+
+angular.module("ngLocale", [], ["$provide", function($provide) {
+var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
+function getDecimals(n) {
+ n = n + '';
+ var i = n.indexOf('.');
+ return (i == -1) ? 0 : n.length - i - 1;
+}
+
+function getVF(n, opt_precision) {
+ var v = opt_precision;
+
+ if (undefined === v) {
+ v = Math.min(getDecimals(n), 3);
+ }
+
+ var base = Math.pow(10, v);
+ var f = ((n * base) | 0) % base;
+ return {v: v, f: f};
+}
+
+$provide.value("$locale", {
+ "DATETIME_FORMATS": {
+ "AMPMS": [
+ "AM",
+ "PM"
+ ],
+ "DAY": [
+ "Sunday",
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday"
+ ],
+ "ERANAMES": [
+ "Before Christ",
+ "Anno Domini"
+ ],
+ "ERAS": [
+ "BC",
+ "AD"
+ ],
+ "FIRSTDAYOFWEEK": 6,
+ "MONTH": [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"
+ ],
+ "SHORTDAY": [
+ "Sun",
+ "Mon",
+ "Tue",
+ "Wed",
+ "Thu",
+ "Fri",
+ "Sat"
+ ],
+ "SHORTMONTH": [
+ "Jan",
+ "Feb",
+ "Mar",
+ "Apr",
+ "May",
+ "Jun",
+ "Jul",
+ "Aug",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dec"
+ ],
+ "WEEKENDRANGE": [
+ 5,
+ 6
+ ],
+ "fullDate": "EEEE, MMMM d, y",
+ "longDate": "MMMM d, y",
+ "medium": "MMM d, y h:mm:ss a",
+ "mediumDate": "MMM d, y",
+ "mediumTime": "h:mm:ss a",
+ "short": "M/d/yy h:mm a",
+ "shortDate": "M/d/yy",
+ "shortTime": "h:mm a"
+ },
+ "NUMBER_FORMATS": {
+ "CURRENCY_SYM": "$",
+ "DECIMAL_SEP": ".",
+ "GROUP_SEP": ",",
+ "PATTERNS": [
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "maxFrac": 3,
+ "minFrac": 0,
+ "minInt": 1,
+ "negPre": "-",
+ "negSuf": "",
+ "posPre": "",
+ "posSuf": ""
+ },
+ {
+ "gSize": 3,
+ "lgSize": 3,
+ "maxFrac": 2,
+ "minFrac": 2,
+ "minInt": 1,
+ "negPre": "-\u00a4",
+ "negSuf": "",
+ "posPre": "\u00a4",
+ "posSuf": ""
+ }
+ ]
+ },
+ "id": "en-us",
+ "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
+});
+}]);
+
+ jqLite(document).ready(function() {
+ angularInit(document, bootstrap);
+ });
+
+})(window, document);
+
+!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>'); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook-frame.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook-frame.html
new file mode 100644
index 00000000..5428c6c6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook-frame.html
@@ -0,0 +1,85 @@
+<!-- <!DOCTYPE html>
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<html>
+<head>
+<meta charset="ISO-8859-1">
+<title>Insert title here</title>
+</head>
+<body>
+<div style="min-height:500px" data-ng-init="invokeSaveNotebook()">
+
+
+ <div><iframe id='itestfr' width="1400" height="1400"></iframe></div>
+
+
+ </div>
+
+</body>
+</html> -->
+
+<!-- <div ng-controller="notebookFrameController" style="min-height:500px">
+
+
+ <div><iframe id='itestframe' width="1400" height="1400"></iframe></div>
+
+
+ </div> -->
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta http-equiv="cache-control" content="max-age=0" />
+ <meta http-equiv="cache-control" content="no-cache" />
+ <meta http-equiv="expires" content="0" />
+ <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
+ <meta http-equiv="pragma" content="no-cache"/>
+
+ <script src= "app/fusion/scripts/utils/page-resource.js"></script>
+
+ <script>
+ // loadjscssfile("app/fusion/notebook-integration/scripts/controllers/notebookController.js", "js");
+
+ loadjscssfile("app/fusion/notebook-integration/scripts/controllers/notebookFrameController.js", "js");
+ loadjscssfile("app/fusion/notebook-integration/scripts/controllers/nbook-framecontroller.js", "js");
+
+ </script>
+
+
+
+
+ </head>
+ <body class="appBody" ng-app="abs">
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_edit.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_add.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_role.html'"></div>
+ <div q-header></div>
+ <div q-menu class="appLeftMenu"></div>
+ <div ng-view style="min-height: 450px;margin-top:-50px;margin-left:210px;margin-right:110px;"></div>
+ <div q-footer class="appFooter"></div>
+ </body>
+</html>
+
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook-viz.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook-viz.html
new file mode 100644
index 00000000..3c0afd29
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook-viz.html
@@ -0,0 +1,26 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+ <div style="min-height:500px">
+
+
+ <div><iframe id='itestframe' width="1400" height="1400"></iframe></div>
+
+
+ </div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook.htm b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook.htm
new file mode 100644
index 00000000..bfd74ad3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook.htm
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<html>
+ <head>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta http-equiv="cache-control" content="max-age=0" />
+ <meta http-equiv="cache-control" content="no-cache" />
+ <meta http-equiv="expires" content="0" />
+ <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
+ <meta http-equiv="pragma" content="no-cache"/>
+
+ <script src= "app/fusion/scripts/utils/page-resource.js"></script>
+ <!-- Icons -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ionicons-2.0.1/css/ionicons.css" />
+ <script>
+ // loadjscssfile("app/fusion/notebook-integration/scripts/controllers/notebookController.js", "js");
+ loadjscssfile("app/fusion/notebook-integration/scripts/controllers/nbookController.js", "js");
+ </script>
+
+
+
+
+ </head>
+ <body class="appBody" ng-app="abs">
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_edit.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_add.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_role.html'"></div>
+ <div q-header></div>
+ <div q-menu class="appLeftMenu"></div>
+ <div ng-view style="min-height: 450px;margin-top:-50px;margin-left:210px;margin-right:110px;"></div>
+ <div q-footer class="appFooter"></div>
+ </body>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebookInputs.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebookInputs.html
new file mode 100644
index 00000000..0a28b50e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebookInputs.html
@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<html>
+<head>
+<meta charset="ISO-8859-1">
+<title></title>
+</head>
+<body>
+
+<div style="min-height:500px">
+ <br>
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Notebook ID:</label><BR>
+ <input type="text" name="notebookid" maxlength=200 ng-model="notebookvalue" style="width:180px"/>
+ </div>
+ <BR>
+
+ <!-- Use this for only 1 key value query parameter
+ <div class="fn-ebz-container">
+
+ <label class="fn-ebz-text-label">Key</label><BR>
+ <input type="text" name="key" maxlength=200 ng-model="qparamKey" style="width:180px"/>
+ </div>
+
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Value</label><BR>
+ <input type="text" name="val" maxlength=200 ng-model="qparamVal" style="width:180px"/>
+ </div> -->
+
+
+
+ <!-- Use this for multiple key value query parameters -->
+ <div style="border:2px;border-style:solid;border-color:#808080;margin-bottom:9px">
+ <div ng-repeat="kv in keyValueList">
+ <div style="margin-left:5px">
+
+ <div class="fn-ebz-container">
+
+ <label class="fn-ebz-text-label">Key</label><BR>
+ <input type="text" name="key" maxlength=100 ng-model="kv.qK" style="width:180px"/>
+ </div>
+
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Value</label><BR>
+ <input type="text" name="val" maxlength=100 ng-model="kv.qV" style="width:180px"/>
+ </div>
+
+ <div class="fn-ebz-container" style="position:relative; top: 25px;">
+ <button href="javascript:void(0)" id="addbtn" ng-show="{{$index==0}}" style="float: right;" att-button size="small" att-accessibility-click="13,32"
+ ng-click="addKeyValuePairs(kv);" >Add</button>
+ <a href="javascript:void(0)" ng-show="{{$index>0}}" style="float: right;" att-button size="small" att-accessibility-click="13,32" ng-click="removeKeyValuePairs($index);" >
+ Remove</a>
+ </div>
+ </div>
+ </div>
+ </div>
+
+
+
+
+ <BR>
+
+ <div class="fn-ebz-container">
+ <a att-button btn-type="primary" att-accessibility-click="13,32" ng-click="submitParameters();">Submit</a>
+ </div>
+
+ <!-- <div ng-show="iframevisibility"><iframe id='itestfr' width="1400" height="1400"></iframe></div> -->
+
+</div>
+</body>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/angular-gridster.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/angular-gridster.js
new file mode 100644
index 00000000..985fa434
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/angular-gridster.js
@@ -0,0 +1,2244 @@
+/*global define:true*/
+(function(root, factory) {
+
+ 'use strict';
+
+ if (typeof define === 'function' && define.amd) {
+ // AMD
+ define(['angular'], factory);
+ } else if (typeof exports === 'object') {
+ // CommonJS
+ module.exports = factory(require('angular'));
+ } else {
+ // Browser, nothing "exported". Only registered as a module with angular.
+ factory(root.angular);
+ }
+}(this, function(angular) {
+
+ 'use strict';
+
+ var ie8 = false;
+
+ var getInternetExplorerVersion = function ()
+ // Returns the version of Internet Explorer >4 or
+ // undefined(indicating the use of another browser).
+ {
+ var isIE10 = (eval("/*@cc_on!@*/false") && document.documentMode === 10);
+ if (isIE10) {
+ return 10;
+ }
+ var v = 3,
+ div = document.createElement('div'),
+ all = div.getElementsByTagName('i');
+ do {
+ div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->';
+ } while (all[0]);
+ return v > 4 ? v : undefined;
+ };
+
+ var browserVersion = getInternetExplorerVersion();
+
+ if (browserVersion && browserVersion < 9) {
+ ie8 = true;
+ }
+
+ // This returned angular module 'gridster' is what is exported.
+ return angular.module('attGridsterLib', [])
+
+ .constant('gridsterConfig', {
+ columns: 6, // number of columns in the grid
+ pushing: true, // whether to push other items out of the way
+ floating: true, // whether to automatically float items up so they stack
+ swapping: true, // whether or not to have items switch places instead of push down if they are the same size
+ width: 'auto', // width of the grid. "auto" will expand the grid to its parent container
+ colWidth: 'auto', // width of grid columns. "auto" will divide the width of the grid evenly among the columns
+ rowHeight: 'match', // height of grid rows. 'match' will make it the same as the column width, a numeric value will be interpreted as pixels, '/2' is half the column width, '*5' is five times the column width, etc.
+ margins: [10, 10], // margins in between grid items
+ outerMargin: false,
+ isMobile: false, // toggle mobile view
+ mobileBreakPoint: 100, // width threshold to toggle mobile mode
+ mobileModeEnabled: true, // whether or not to toggle mobile mode when screen width is less than mobileBreakPoint
+ minColumns: 1, // minimum amount of columns the grid can scale down to
+ minRows: 1, // minimum amount of rows to show if the grid is empty
+ maxRows: 100, // maximum amount of rows in the grid
+ defaultSizeX: 1, // default width of an item in columns
+ defaultSizeY: 1, // default height of an item in rows
+ minSizeX: 1, // minimum column width of an item
+ maxSizeX: null, // maximum column width of an item
+ minSizeY: 1, // minumum row height of an item
+ maxSizeY: null, // maximum row height of an item
+ saveGridItemCalculatedHeightInMobile: false, // grid item height in mobile display. true- to use the calculated height by sizeY given
+ resizable: { // options to pass to resizable handler
+ enabled: false,
+ handles: ['s', 'e', 'n', 'w', 'se', 'ne', 'sw', 'nw']
+ },
+ draggable: { // options to pass to draggable handler
+ enabled: true,
+ scrollSensitivity: 20, // Distance in pixels from the edge of the viewport after which the viewport should scroll, relative to pointer
+ scrollSpeed: 15 // Speed at which the window should scroll once the mouse pointer gets within scrollSensitivity distance
+ }
+ })
+
+ .controller('GridsterCtrl', ['gridsterConfig', '$timeout',
+ function(gridsterConfig, $timeout) {
+
+ var gridster = this;
+
+ /**
+ * Create options from gridsterConfig constant
+ */
+ angular.extend(this, gridsterConfig);
+
+ this.resizable = angular.extend({}, gridsterConfig.resizable || {});
+ this.draggable = angular.extend({}, gridsterConfig.draggable || {});
+
+ var flag = false;
+ this.layoutChanged = function() {
+ if (flag) {
+ return;
+ }
+ flag = true;
+ $timeout(function() {
+ flag = false;
+ if (gridster.loaded) {
+ gridster.floatItemsUp();
+ }
+ gridster.updateHeight(gridster.movingItem ? gridster.movingItem.sizeY : 0);
+ }, 30);
+ };
+
+ /**
+ * A positional array of the items in the grid
+ */
+ this.grid = [];
+
+ /**
+ * Clean up after yourself
+ */
+ this.destroy = function() {
+ // empty the grid to cut back on the possibility
+ // of circular references
+ if (this.grid) {
+ this.grid = [];
+ }
+ this.$element = null;
+ };
+
+ /**
+ * Overrides default options
+ *
+ * @param {Object} options The options to override
+ */
+ this.setOptions = function(options) {
+ if (!options) {
+ return;
+ }
+
+ options = angular.extend({}, options);
+
+ // all this to avoid using jQuery...
+ if (options.draggable) {
+ angular.extend(this.draggable, options.draggable);
+ delete(options.draggable);
+ }
+ if (options.resizable) {
+ angular.extend(this.resizable, options.resizable);
+ delete(options.resizable);
+ }
+
+ angular.extend(this, options);
+
+ if (!this.margins || this.margins.length !== 2) {
+ this.margins = [0, 0];
+ } else {
+ for (var x = 0, l = this.margins.length; x < l; ++x) {
+ this.margins[x] = parseInt(this.margins[x], 10);
+ if (isNaN(this.margins[x])) {
+ this.margins[x] = 0;
+ }
+ }
+ }
+ };
+
+ /**
+ * Check if item can occupy a specified position in the grid
+ *
+ * @param {Object} item The item in question
+ * @param {Number} row The row index
+ * @param {Number} column The column index
+ * @returns {Boolean} True if if item fits
+ */
+ this.canItemOccupy = function(item, row, column) {
+ return row > -1 && column > -1 && item.sizeX + column <= this.columns && item.sizeY + row <= this.maxRows;
+ };
+
+ /**
+ * Set the item in the first suitable position
+ *
+ * @param {Object} item The item to insert
+ */
+ this.autoSetItemPosition = function(item) {
+ // walk through each row and column looking for a place it will fit
+ for (var rowIndex = 0; rowIndex < this.maxRows; ++rowIndex) {
+ for (var colIndex = 0; colIndex < this.columns; ++colIndex) {
+ // only insert if position is not already taken and it can fit
+ var items = this.getItems(rowIndex, colIndex, item.sizeX, item.sizeY, item);
+ if (items.length === 0 && this.canItemOccupy(item, rowIndex, colIndex)) {
+ this.putItem(item, rowIndex, colIndex);
+ return;
+ }
+ }
+ }
+ throw new Error('Unable to place item!');
+ };
+
+ /**
+ * Gets items at a specific coordinate
+ *
+ * @param {Number} row
+ * @param {Number} column
+ * @param {Number} sizeX
+ * @param {Number} sizeY
+ * @param {Array} excludeItems An array of items to exclude from selection
+ * @returns {Array} Items that match the criteria
+ */
+ this.getItems = function(row, column, sizeX, sizeY, excludeItems) {
+ var items = [];
+ if (!sizeX || !sizeY) {
+ sizeX = sizeY = 1;
+ }
+ if (excludeItems && !(excludeItems instanceof Array)) {
+ excludeItems = [excludeItems];
+ }
+ for (var h = 0; h < sizeY; ++h) {
+ for (var w = 0; w < sizeX; ++w) {
+ var item = this.getItem(row + h, column + w, excludeItems);
+ if (item && (!excludeItems || excludeItems.indexOf(item) === -1) && items.indexOf(item) === -1) {
+ items.push(item);
+ }
+ }
+ }
+ return items;
+ };
+
+ /**
+ * @param {Array} items
+ * @returns {Object} An item that represents the bounding box of the items
+ */
+ this.getBoundingBox = function(items) {
+
+ if (items.length === 0) {
+ return null;
+ }
+ if (items.length === 1) {
+ return {
+ row: items[0].row,
+ col: items[0].col,
+ sizeY: items[0].sizeY,
+ sizeX: items[0].sizeX
+ };
+ }
+
+ var maxRow = 0;
+ var maxCol = 0;
+ var minRow = 9999;
+ var minCol = 9999;
+
+ for (var i = 0, l = items.length; i < l; ++i) {
+ var item = items[i];
+ minRow = Math.min(item.row, minRow);
+ minCol = Math.min(item.col, minCol);
+ maxRow = Math.max(item.row + item.sizeY, maxRow);
+ maxCol = Math.max(item.col + item.sizeX, maxCol);
+ }
+
+ return {
+ row: minRow,
+ col: minCol,
+ sizeY: maxRow - minRow,
+ sizeX: maxCol - minCol
+ };
+ };
+
+
+ /**
+ * Removes an item from the grid
+ *
+ * @param {Object} item
+ */
+ this.removeItem = function(item) {
+ for (var rowIndex = 0, l = this.grid.length; rowIndex < l; ++rowIndex) {
+ var columns = this.grid[rowIndex];
+ if (!columns) {
+ continue;
+ }
+ var index = columns.indexOf(item);
+ if (index !== -1) {
+ columns[index] = null;
+ break;
+ }
+ }
+ this.layoutChanged();
+ };
+
+ /**
+ * Returns the item at a specified coordinate
+ *
+ * @param {Number} row
+ * @param {Number} column
+ * @param {Array} excludeItems Items to exclude from selection
+ * @returns {Object} The matched item or null
+ */
+ this.getItem = function(row, column, excludeItems) {
+ if (excludeItems && !(excludeItems instanceof Array)) {
+ excludeItems = [excludeItems];
+ }
+ var sizeY = 1;
+ while (row > -1) {
+ var sizeX = 1,
+ col = column;
+ while (col > -1) {
+ var items = this.grid[row];
+ if (items) {
+ var item = items[col];
+ if (item && (!excludeItems || excludeItems.indexOf(item) === -1) && item.sizeX >= sizeX && item.sizeY >= sizeY) {
+ return item;
+ }
+ }
+ ++sizeX;
+ --col;
+ }
+ --row;
+ ++sizeY;
+ }
+ return null;
+ };
+
+ /**
+ * Insert an array of items into the grid
+ *
+ * @param {Array} items An array of items to insert
+ */
+ this.putItems = function(items) {
+ for (var i = 0, l = items.length; i < l; ++i) {
+ this.putItem(items[i]);
+ }
+ };
+
+ /**
+ * Insert a single item into the grid
+ *
+ * @param {Object} item The item to insert
+ * @param {Number} row (Optional) Specifies the items row index
+ * @param {Number} column (Optional) Specifies the items column index
+ * @param {Array} ignoreItems
+ */
+ this.putItem = function(item, row, column, ignoreItems) {
+ // auto place item if no row specified
+ if (typeof row === 'undefined' || row === null) {
+ row = item.row;
+ column = item.col;
+ if (typeof row === 'undefined' || row === null) {
+ this.autoSetItemPosition(item);
+ return;
+ }
+ }
+
+ // keep item within allowed bounds
+ if (!this.canItemOccupy(item, row, column)) {
+ column = Math.min(this.columns - item.sizeX, Math.max(0, column));
+ row = Math.min(this.maxRows - item.sizeY, Math.max(0, row));
+ }
+
+ // check if item is already in grid
+ if (item.oldRow !== null && typeof item.oldRow !== 'undefined') {
+ var samePosition = item.oldRow === row && item.oldColumn === column;
+ var inGrid = this.grid[row] && this.grid[row][column] === item;
+ if (samePosition && inGrid) {
+ item.row = row;
+ item.col = column;
+ return;
+ } else {
+ // remove from old position
+ var oldRow = this.grid[item.oldRow];
+ if (oldRow && oldRow[item.oldColumn] === item) {
+ delete oldRow[item.oldColumn];
+ }
+ }
+ }
+
+ item.oldRow = item.row = row;
+ item.oldColumn = item.col = column;
+
+ this.moveOverlappingItems(item, ignoreItems);
+
+ if (!this.grid[row]) {
+ this.grid[row] = [];
+ }
+ this.grid[row][column] = item;
+
+ if (this.movingItem === item) {
+ this.floatItemUp(item);
+ }
+ this.layoutChanged();
+ };
+
+ /**
+ * Trade row and column if item1 with item2
+ *
+ * @param {Object} item1
+ * @param {Object} item2
+ */
+ this.swapItems = function(item1, item2) {
+ this.grid[item1.row][item1.col] = item2;
+ this.grid[item2.row][item2.col] = item1;
+
+ var item1Row = item1.row;
+ var item1Col = item1.col;
+ item1.row = item2.row;
+ item1.col = item2.col;
+ item2.row = item1Row;
+ item2.col = item1Col;
+ };
+
+ /**
+ * Prevents items from being overlapped
+ *
+ * @param {Object} item The item that should remain
+ * @param {Array} ignoreItems
+ */
+ this.moveOverlappingItems = function(item, ignoreItems) {
+ // don't move item, so ignore it
+ if (!ignoreItems) {
+ ignoreItems = [item];
+ } else if (ignoreItems.indexOf(item) === -1) {
+ ignoreItems = ignoreItems.slice(0);
+ ignoreItems.push(item);
+ }
+
+ // get the items in the space occupied by the item's coordinates
+ var overlappingItems = this.getItems(
+ item.row,
+ item.col,
+ item.sizeX,
+ item.sizeY,
+ ignoreItems
+ );
+ this.moveItemsDown(overlappingItems, item.row + item.sizeY, ignoreItems);
+ };
+
+ /**
+ * Moves an array of items to a specified row
+ *
+ * @param {Array} items The items to move
+ * @param {Number} newRow The target row
+ * @param {Array} ignoreItems
+ */
+ this.moveItemsDown = function(items, newRow, ignoreItems) {
+ if (!items || items.length === 0) {
+ return;
+ }
+ items.sort(function(a, b) {
+ return a.row - b.row;
+ });
+
+ ignoreItems = ignoreItems ? ignoreItems.slice(0) : [];
+ var topRows = {},
+ item, i, l;
+
+ // calculate the top rows in each column
+ for (i = 0, l = items.length; i < l; ++i) {
+ item = items[i];
+ var topRow = topRows[item.col];
+ if (typeof topRow === 'undefined' || item.row < topRow) {
+ topRows[item.col] = item.row;
+ }
+ }
+
+ // move each item down from the top row in its column to the row
+ for (i = 0, l = items.length; i < l; ++i) {
+ item = items[i];
+ var rowsToMove = newRow - topRows[item.col];
+ this.moveItemDown(item, item.row + rowsToMove, ignoreItems);
+ ignoreItems.push(item);
+ }
+ };
+
+ /**
+ * Moves an item down to a specified row
+ *
+ * @param {Object} item The item to move
+ * @param {Number} newRow The target row
+ * @param {Array} ignoreItems
+ */
+ this.moveItemDown = function(item, newRow, ignoreItems) {
+ if (item.row >= newRow) {
+ return;
+ }
+ while (item.row < newRow) {
+ ++item.row;
+ this.moveOverlappingItems(item, ignoreItems);
+ }
+ this.putItem(item, item.row, item.col, ignoreItems);
+ };
+
+ /**
+ * Moves all items up as much as possible
+ */
+ this.floatItemsUp = function() {
+ if (this.floating === false) {
+ return;
+ }
+ for (var rowIndex = 0, l = this.grid.length; rowIndex < l; ++rowIndex) {
+ var columns = this.grid[rowIndex];
+ if (!columns) {
+ continue;
+ }
+ for (var colIndex = 0, len = columns.length; colIndex < len; ++colIndex) {
+ var item = columns[colIndex];
+ if (item) {
+ this.floatItemUp(item);
+ }
+ }
+ }
+ };
+
+ /**
+ * Float an item up to the most suitable row
+ *
+ * @param {Object} item The item to move
+ */
+ this.floatItemUp = function(item) {
+ if (this.floating === false) {
+ return;
+ }
+ var colIndex = item.col,
+ sizeY = item.sizeY,
+ sizeX = item.sizeX,
+ bestRow = null,
+ bestColumn = null,
+ rowIndex = item.row - 1;
+
+ while (rowIndex > -1) {
+ var items = this.getItems(rowIndex, colIndex, sizeX, sizeY, item);
+ if (items.length !== 0) {
+ break;
+ }
+ bestRow = rowIndex;
+ bestColumn = colIndex;
+ --rowIndex;
+ }
+ if (bestRow !== null) {
+ this.putItem(item, bestRow, bestColumn);
+ }
+ };
+
+ /**
+ * Update gridsters height
+ *
+ * @param {Number} plus (Optional) Additional height to add
+ */
+ this.updateHeight = function(plus) {
+ var maxHeight = this.minRows;
+ plus = plus || 0;
+ for (var rowIndex = this.grid.length; rowIndex >= 0; --rowIndex) {
+ var columns = this.grid[rowIndex];
+ if (!columns) {
+ continue;
+ }
+ for (var colIndex = 0, len = columns.length; colIndex < len; ++colIndex) {
+ if (columns[colIndex]) {
+ maxHeight = Math.max(maxHeight, rowIndex + plus + columns[colIndex].sizeY);
+ }
+ }
+ }
+ this.gridHeight = this.maxRows - maxHeight > 0 ? Math.min(this.maxRows, maxHeight) : Math.max(this.maxRows, maxHeight);
+ };
+
+ /**
+ * Returns the number of rows that will fit in given amount of pixels
+ *
+ * @param {Number} pixels
+ * @param {Boolean} ceilOrFloor (Optional) Determines rounding method
+ */
+ this.pixelsToRows = function(pixels, ceilOrFloor) {
+ if (ceilOrFloor === true) {
+ return Math.ceil(pixels / this.curRowHeight);
+ } else if (ceilOrFloor === false) {
+ return Math.floor(pixels / this.curRowHeight);
+ }
+
+ return Math.round(pixels / this.curRowHeight);
+ };
+
+ /**
+ * Returns the number of columns that will fit in a given amount of pixels
+ *
+ * @param {Number} pixels
+ * @param {Boolean} ceilOrFloor (Optional) Determines rounding method
+ * @returns {Number} The number of columns
+ */
+ this.pixelsToColumns = function(pixels, ceilOrFloor) {
+ if (ceilOrFloor === true) {
+ return Math.ceil(pixels / this.curColWidth);
+ } else if (ceilOrFloor === false) {
+ return Math.floor(pixels / this.curColWidth);
+ }
+
+ return Math.round(pixels / this.curColWidth);
+ };
+ }
+ ])
+
+ .directive('gridsterPreview', function() {
+ return {
+ replace: true,
+ scope: true,
+ require: '^gridster',
+ template: '<div ng-style="previewStyle()" class="gridster-item gridster-preview-holder"></div>',
+ link: function(scope, $el, attrs, gridster) {
+
+ /**
+ * @returns {Object} style object for preview element
+ */
+ scope.previewStyle = function() {
+
+ if (!gridster.movingItem) {
+ return {
+ display: 'none'
+ };
+ }
+
+ return {
+ display: 'block',
+ height: (gridster.movingItem.sizeY * gridster.curRowHeight - gridster.margins[0]) + 'px',
+ width: (gridster.movingItem.sizeX * gridster.curColWidth - gridster.margins[1]) + 'px',
+ top: (gridster.movingItem.row * gridster.curRowHeight + (gridster.outerMargin ? gridster.margins[0] : 0)) + 'px',
+ left: (gridster.movingItem.col * gridster.curColWidth + (gridster.outerMargin ? gridster.margins[1] : 0)) + 'px'
+ };
+ };
+ }
+ };
+ })
+
+ /**
+ * The gridster directive
+ *
+ * @param {Function} $timeout
+ * @param {Object} $window
+ * @param {Object} $rootScope
+ * @param {Function} gridsterDebounce
+ */
+ .directive('gridster', ['$timeout', '$window', '$rootScope', 'gridsterDebounce',
+ function($timeout, $window, $rootScope, gridsterDebounce) {
+ return {
+ scope: true,
+ restrict: 'EAC',
+ controller: 'GridsterCtrl',
+ controllerAs: 'gridster',
+ compile: function($tplElem) {
+
+ $tplElem.prepend('<div ng-if="gridster.movingItem" gridster-preview></div>');
+
+ return function(scope, $elem, attrs, gridster) {
+ gridster.loaded = false;
+
+ gridster.$element = $elem;
+
+ scope.gridster = gridster;
+
+ $elem.addClass('gridster');
+
+ var isVisible = function(ele) {
+ return ele.style.visibility !== 'hidden' && ele.style.display !== 'none';
+ };
+
+ function refresh(config) {
+ gridster.setOptions(config);
+
+ if (!isVisible($elem[0])) {
+ return;
+ }
+
+ // resolve "auto" & "match" values
+ if (gridster.width === 'auto') {
+ gridster.curWidth = $elem[0].offsetWidth || parseInt($elem.css('width'), 10);
+ } else {
+ gridster.curWidth = gridster.width;
+ }
+
+ if (gridster.colWidth === 'auto') {
+ gridster.curColWidth = (gridster.curWidth + (gridster.outerMargin ? -gridster.margins[1] : gridster.margins[1])) / gridster.columns;
+ } else {
+ gridster.curColWidth = gridster.colWidth;
+ }
+
+ gridster.curRowHeight = gridster.rowHeight;
+ if (typeof gridster.rowHeight === 'string') {
+ if (gridster.rowHeight === 'match') {
+ gridster.curRowHeight = Math.round(gridster.curColWidth);
+ } else if (gridster.rowHeight.indexOf('*') !== -1) {
+ gridster.curRowHeight = Math.round(gridster.curColWidth * gridster.rowHeight.replace('*', '').replace(' ', ''));
+ } else if (gridster.rowHeight.indexOf('/') !== -1) {
+ gridster.curRowHeight = Math.round(gridster.curColWidth / gridster.rowHeight.replace('/', '').replace(' ', ''));
+ }
+ }
+
+ gridster.isMobile = gridster.mobileModeEnabled && gridster.curWidth <= gridster.mobileBreakPoint;
+
+ // loop through all items and reset their CSS
+ for (var rowIndex = 0, l = gridster.grid.length; rowIndex < l; ++rowIndex) {
+ var columns = gridster.grid[rowIndex];
+ if (!columns) {
+ continue;
+ }
+
+ for (var colIndex = 0, len = columns.length; colIndex < len; ++colIndex) {
+ if (columns[colIndex]) {
+ var item = columns[colIndex];
+ item.setElementPosition();
+ item.setElementSizeY();
+ item.setElementSizeX();
+ }
+ }
+ }
+
+ updateHeight();
+ }
+
+ var optionsKey = attrs.gridster;
+ if (optionsKey) {
+ scope.$parent.$watch(optionsKey, function(newConfig) {
+ refresh(newConfig);
+ }, true);
+ } else {
+ refresh({});
+ }
+
+ scope.$watch(function() {
+ return gridster.loaded;
+ }, function() {
+ if (gridster.loaded) {
+ $elem.addClass('gridster-loaded');
+ } else {
+ $elem.removeClass('gridster-loaded');
+ }
+ });
+
+ scope.$watch(function() {
+ return gridster.isMobile;
+ }, function() {
+ if (gridster.isMobile) {
+ $elem.addClass('gridster-mobile').removeClass('gridster-desktop');
+ } else {
+ $elem.removeClass('gridster-mobile').addClass('gridster-desktop');
+ }
+ $rootScope.$broadcast('gridster-mobile-changed', gridster);
+ });
+
+ scope.$watch(function() {
+ return gridster.draggable;
+ }, function() {
+ $rootScope.$broadcast('gridster-draggable-changed', gridster);
+ }, true);
+
+ scope.$watch(function() {
+ return gridster.resizable;
+ }, function() {
+ $rootScope.$broadcast('gridster-resizable-changed', gridster);
+ }, true);
+
+ function updateHeight() {
+ if(gridster.gridHeight){ //need to put this check, otherwise fail in IE8
+ $elem.css('height', (gridster.gridHeight * gridster.curRowHeight) + (gridster.outerMargin ? gridster.margins[0] : -gridster.margins[0]) + 'px');
+ }
+ }
+
+ scope.$watch(function() {
+ return gridster.gridHeight;
+ }, updateHeight);
+
+ scope.$watch(function() {
+ return gridster.movingItem;
+ }, function() {
+ gridster.updateHeight(gridster.movingItem ? gridster.movingItem.sizeY : 0);
+ });
+
+ var prevWidth = $elem[0].offsetWidth || parseInt($elem.css('width'), 10);
+
+ var resize = function() {
+ var width = $elem[0].offsetWidth || parseInt($elem.css('width'), 10);
+
+ if (!width || width === prevWidth || gridster.movingItem) {
+ return;
+ }
+ prevWidth = width;
+
+ if (gridster.loaded) {
+ $elem.removeClass('gridster-loaded');
+ }
+
+ refresh();
+
+ if (gridster.loaded) {
+ $elem.addClass('gridster-loaded');
+ }
+
+ $rootScope.$broadcast('gridster-resized', [width, $elem[0].offsetHeight], gridster);
+ };
+
+ // track element width changes any way we can
+ var onResize = gridsterDebounce(function onResize() {
+ resize();
+ $timeout(function() {
+ scope.$apply();
+ });
+ }, 100);
+
+ scope.$watch(function() {
+ return isVisible($elem[0]);
+ }, onResize);
+
+ // see https://github.com/sdecima/javascript-detect-element-resize
+ if (typeof window.addResizeListener === 'function') {
+ window.addResizeListener($elem[0], onResize);
+ } else {
+ scope.$watch(function() {
+ return $elem[0].offsetWidth || parseInt($elem.css('width'), 10);
+ }, resize);
+ }
+ var $win = angular.element($window);
+ $win.on('resize', onResize);
+
+ // be sure to cleanup
+ scope.$on('$destroy', function() {
+ gridster.destroy();
+ $win.off('resize', onResize);
+ if (typeof window.removeResizeListener === 'function') {
+ window.removeResizeListener($elem[0], onResize);
+ }
+ });
+
+ // allow a little time to place items before floating up
+ $timeout(function() {
+ scope.$watch('gridster.floating', function() {
+ gridster.floatItemsUp();
+ });
+ gridster.loaded = true;
+ }, 100);
+ };
+ }
+ };
+ }
+ ])
+
+ .controller('GridsterItemCtrl', function() {
+ this.$element = null;
+ this.gridster = null;
+ this.row = null;
+ this.col = null;
+ this.sizeX = null;
+ this.sizeY = null;
+ this.minSizeX = 0;
+ this.minSizeY = 0;
+ this.maxSizeX = null;
+ this.maxSizeY = null;
+
+ this.init = function($element, gridster) {
+ this.$element = $element;
+ this.gridster = gridster;
+ this.sizeX = gridster.defaultSizeX;
+ this.sizeY = gridster.defaultSizeY;
+ };
+
+ this.destroy = function() {
+ // set these to null to avoid the possibility of circular references
+ this.gridster = null;
+ this.$element = null;
+ };
+
+ /**
+ * Returns the items most important attributes
+ */
+ this.toJSON = function() {
+ return {
+ row: this.row,
+ col: this.col,
+ sizeY: this.sizeY,
+ sizeX: this.sizeX
+ };
+ };
+
+ this.isMoving = function() {
+ return this.gridster.movingItem === this;
+ };
+
+ /**
+ * Set the items position
+ *
+ * @param {Number} row
+ * @param {Number} column
+ */
+ this.setPosition = function(row, column) {
+ this.gridster.putItem(this, row, column);
+
+ if (!this.isMoving()) {
+ this.setElementPosition();
+ }
+ };
+
+ /**
+ * Sets a specified size property
+ *
+ * @param {String} key Can be either "x" or "y"
+ * @param {Number} value The size amount
+ * @param {Boolean} preventMove
+ */
+ this.setSize = function(key, value, preventMove) {
+ key = key.toUpperCase();
+ var camelCase = 'size' + key,
+ titleCase = 'Size' + key;
+ if (value === '') {
+ return;
+ }
+ value = parseInt(value, 10);
+ if (isNaN(value) || value === 0) {
+ value = this.gridster['default' + titleCase];
+ }
+ var max = key === 'X' ? this.gridster.columns : this.gridster.maxRows;
+ if (this['max' + titleCase]) {
+ max = Math.min(this['max' + titleCase], max);
+ }
+ if (this.gridster['max' + titleCase]) {
+ max = Math.min(this.gridster['max' + titleCase], max);
+ }
+ if (key === 'X' && this.cols) {
+ max -= this.cols;
+ } else if (key === 'Y' && this.rows) {
+ max -= this.rows;
+ }
+
+ var min = 0;
+ if (this['min' + titleCase]) {
+ min = Math.max(this['min' + titleCase], min);
+ }
+ if (this.gridster['min' + titleCase]) {
+ min = Math.max(this.gridster['min' + titleCase], min);
+ }
+
+ value = Math.max(Math.min(value, max), min);
+
+ var changed = (this[camelCase] !== value || (this['old' + titleCase] && this['old' + titleCase] !== value));
+ this['old' + titleCase] = this[camelCase] = value;
+
+ if (!this.isMoving()) {
+ this['setElement' + titleCase]();
+ }
+ if (!preventMove && changed) {
+ this.gridster.moveOverlappingItems(this);
+ this.gridster.layoutChanged();
+ }
+
+ return changed;
+ };
+
+ /**
+ * Sets the items sizeY property
+ *
+ * @param {Number} rows
+ * @param {Boolean} preventMove
+ */
+ this.setSizeY = function(rows, preventMove) {
+ return this.setSize('Y', rows, preventMove);
+ };
+
+ /**
+ * Sets the items sizeX property
+ *
+ * @param {Number} columns
+ * @param {Boolean} preventMove
+ */
+ this.setSizeX = function(columns, preventMove) {
+ return this.setSize('X', columns, preventMove);
+ };
+
+ /**
+ * Sets an elements position on the page
+ */
+ this.setElementPosition = function() {
+ if (this.gridster.isMobile) {
+ this.$element.css({
+ marginLeft: this.gridster.margins[0] + 'px',
+ marginRight: this.gridster.margins[0] + 'px',
+ marginTop: this.gridster.margins[1] + 'px',
+ marginBottom: this.gridster.margins[1] + 'px',
+ top: '',
+ left: ''
+ });
+ } else {
+ this.$element.css({
+ margin: 0,
+ top: (this.row * this.gridster.curRowHeight + (this.gridster.outerMargin ? this.gridster.margins[0] : 0)) + 'px',
+ left: (this.col * this.gridster.curColWidth + (this.gridster.outerMargin ? this.gridster.margins[1] : 0)) + 'px'
+ });
+ }
+ };
+
+ /**
+ * Sets an elements height
+ */
+ this.setElementSizeY = function() {
+ if (this.gridster.isMobile && !this.gridster.saveGridItemCalculatedHeightInMobile) {
+ this.$element.css('height', '');
+ } else {
+ var computedHeight = (this.sizeY * this.gridster.curRowHeight - this.gridster.margins[0]) + 'px';
+ //this.$element.css('height', computedHeight);
+ this.$element.attr('style', this.$element.attr('style') + '; ' + 'height: '+computedHeight+' !important;');
+ }
+ };
+
+ /**
+ * Sets an elements width
+ */
+ this.setElementSizeX = function() {
+ if (this.gridster.isMobile) {
+ this.$element.css('width', '');
+ } else {
+ this.$element.css('width', (this.sizeX * this.gridster.curColWidth - this.gridster.margins[1]) + 'px');
+ }
+ };
+
+ /**
+ * Gets an element's width
+ */
+ this.getElementSizeX = function() {
+ return (this.sizeX * this.gridster.curColWidth - this.gridster.margins[1]);
+ };
+
+ /**
+ * Gets an element's height
+ */
+ this.getElementSizeY = function() {
+ return (this.sizeY * this.gridster.curRowHeight - this.gridster.margins[0]);
+ };
+
+ })
+
+ .factory('GridsterTouch', [function() {
+ return function GridsterTouch(target, startEvent, moveEvent, endEvent) {
+ var lastXYById = {};
+
+ // Opera doesn't have Object.keys so we use this wrapper
+ var numberOfKeys = function(theObject) {
+ if (Object.keys) {
+ return Object.keys(theObject).length;
+ }
+
+ var n = 0,
+ key;
+ for (key in theObject) {
+ ++n;
+ }
+
+ return n;
+ };
+
+ // this calculates the delta needed to convert pageX/Y to offsetX/Y because offsetX/Y don't exist in the TouchEvent object or in Firefox's MouseEvent object
+ var computeDocumentToElementDelta = function(theElement) {
+ var elementLeft = 0;
+ var elementTop = 0;
+ var oldIEUserAgent = navigator.userAgent.match(/\bMSIE\b/);
+
+ for (var offsetElement = theElement; offsetElement != null; offsetElement = offsetElement.offsetParent) {
+ // the following is a major hack for versions of IE less than 8 to avoid an apparent problem on the IEBlog with double-counting the offsets
+ // this may not be a general solution to IE7's problem with offsetLeft/offsetParent
+ if (oldIEUserAgent &&
+ (!document.documentMode || document.documentMode < 8) &&
+ offsetElement.currentStyle.position === 'relative' && offsetElement.offsetParent && offsetElement.offsetParent.currentStyle.position === 'relative' && offsetElement.offsetLeft === offsetElement.offsetParent.offsetLeft) {
+ // add only the top
+ elementTop += offsetElement.offsetTop;
+ } else {
+ elementLeft += offsetElement.offsetLeft;
+ elementTop += offsetElement.offsetTop;
+ }
+ }
+
+ return {
+ x: elementLeft,
+ y: elementTop
+ };
+ };
+
+ // cache the delta from the document to our event target (reinitialized each mousedown/MSPointerDown/touchstart)
+ var documentToTargetDelta = computeDocumentToElementDelta(target);
+
+ // common event handler for the mouse/pointer/touch models and their down/start, move, up/end, and cancel events
+ var doEvent = function(theEvtObj) {
+
+ if (theEvtObj.type === 'mousemove' && numberOfKeys(lastXYById) === 0) {
+ return;
+ }
+
+ var prevent = true;
+
+ var pointerList = theEvtObj.changedTouches ? theEvtObj.changedTouches : [theEvtObj];
+
+ for (var i = 0; i < pointerList.length; ++i) {
+ var pointerObj = pointerList[i];
+ var pointerId = (typeof pointerObj.identifier !== 'undefined') ? pointerObj.identifier : (typeof pointerObj.pointerId !== 'undefined') ? pointerObj.pointerId : 1;
+
+ // use the pageX/Y coordinates to compute target-relative coordinates when we have them (in ie < 9, we need to do a little work to put them there)
+ if (typeof pointerObj.pageX === 'undefined') {
+
+ // initialize assuming our source element is our target
+ if(!ie8){
+ pointerObj.pageX = pointerObj.offsetX + documentToTargetDelta.x;
+ pointerObj.pageY = pointerObj.offsetY + documentToTargetDelta.y;
+ }
+ else{
+ pointerObj.pageX = pointerObj.clientX;
+ pointerObj.pageY = pointerObj.clientY;
+ }
+
+ if (pointerObj.srcElement.offsetParent === target && document.documentMode && document.documentMode === 8 && pointerObj.type === 'mousedown') {
+ // source element is a child piece of VML, we're in IE8, and we've not called setCapture yet - add the origin of the source element
+ pointerObj.pageX += pointerObj.srcElement.offsetLeft;
+ pointerObj.pageY += pointerObj.srcElement.offsetTop;
+ } else if (pointerObj.srcElement !== target && !document.documentMode || document.documentMode < 8) {
+ // source element isn't the target (most likely it's a child piece of VML) and we're in a version of IE before IE8 -
+ // the offsetX/Y values are unpredictable so use the clientX/Y values and adjust by the scroll offsets of its parents
+ // to get the document-relative coordinates (the same as pageX/Y)
+ var sx = -2,
+ sy = -2; // adjust for old IE's 2-pixel border
+ for (var scrollElement = pointerObj.srcElement; scrollElement !== null; scrollElement = scrollElement.parentNode) {
+ sx += scrollElement.scrollLeft ? scrollElement.scrollLeft : 0;
+ sy += scrollElement.scrollTop ? scrollElement.scrollTop : 0;
+ }
+
+ pointerObj.pageX = pointerObj.clientX + sx;
+ pointerObj.pageY = pointerObj.clientY + sy;
+ }
+ }
+
+
+ var pageX = pointerObj.pageX;
+ var pageY = pointerObj.pageY;
+
+ if (theEvtObj.type.match(/(start|down)$/i)) {
+ // clause for processing MSPointerDown, touchstart, and mousedown
+
+ // refresh the document-to-target delta on start in case the target has moved relative to document
+ documentToTargetDelta = computeDocumentToElementDelta(target);
+
+ // protect against failing to get an up or end on this pointerId
+ if (lastXYById[pointerId]) {
+ if (endEvent) {
+ endEvent({
+ target: theEvtObj.target,
+ which: theEvtObj.which,
+ pointerId: pointerId,
+ pageX: pageX,
+ pageY: pageY
+ });
+ }
+
+ delete lastXYById[pointerId];
+ }
+
+ if (startEvent) {
+ if (prevent) {
+ prevent = startEvent({
+ target: theEvtObj.target,
+ which: theEvtObj.which,
+ pointerId: pointerId,
+ pageX: pageX,
+ pageY: pageY
+ });
+ }
+ }
+
+ // init last page positions for this pointer
+ lastXYById[pointerId] = {
+ x: pageX,
+ y: pageY
+ };
+
+ // IE pointer model
+ if (target.msSetPointerCapture) {
+ target.msSetPointerCapture(pointerId);
+ } else if (theEvtObj.type === 'mousedown' && numberOfKeys(lastXYById) === 1) {
+ if (useSetReleaseCapture) {
+ target.setCapture(true);
+ } else {
+ document.addEventListener('mousemove', doEvent, false);
+ document.addEventListener('mouseup', doEvent, false);
+ }
+ }
+ } else if (theEvtObj.type.match(/move$/i)) {
+ // clause handles mousemove, MSPointerMove, and touchmove
+
+ if (lastXYById[pointerId] && !(lastXYById[pointerId].x === pageX && lastXYById[pointerId].y === pageY)) {
+ // only extend if the pointer is down and it's not the same as the last point
+
+ if (moveEvent && prevent) {
+ prevent = moveEvent({
+ target: theEvtObj.target,
+ which: theEvtObj.which,
+ pointerId: pointerId,
+ pageX: pageX,
+ pageY: pageY
+ });
+ }
+
+ // update last page positions for this pointer
+ lastXYById[pointerId].x = pageX;
+ lastXYById[pointerId].y = pageY;
+ }
+ } else if (lastXYById[pointerId] && theEvtObj.type.match(/(up|end|cancel)$/i)) {
+ // clause handles up/end/cancel
+
+ if (endEvent && prevent) {
+ prevent = endEvent({
+ target: theEvtObj.target,
+ which: theEvtObj.which,
+ pointerId: pointerId,
+ pageX: pageX,
+ pageY: pageY
+ });
+ }
+
+ // delete last page positions for this pointer
+ delete lastXYById[pointerId];
+
+ // in the Microsoft pointer model, release the capture for this pointer
+ // in the mouse model, release the capture or remove document-level event handlers if there are no down points
+ // nothing is required for the iOS touch model because capture is implied on touchstart
+ if (target.msReleasePointerCapture) {
+ target.msReleasePointerCapture(pointerId);
+ } else if (theEvtObj.type === 'mouseup' && numberOfKeys(lastXYById) === 0) {
+ if (useSetReleaseCapture) {
+ target.releaseCapture();
+ } else {
+ document.removeEventListener('mousemove', doEvent, false);
+ document.removeEventListener('mouseup', doEvent, false);
+ }
+ }
+ }
+ }
+
+ if (prevent) {
+ if (theEvtObj.preventDefault) {
+ theEvtObj.preventDefault();
+ }
+
+ if (theEvtObj.preventManipulation) {
+ theEvtObj.preventManipulation();
+ }
+
+ if (theEvtObj.preventMouseEvent) {
+ theEvtObj.preventMouseEvent();
+ }
+ }
+ };
+
+ var useSetReleaseCapture = false;
+ // saving the settings for contentZooming and touchaction before activation
+ var contentZooming, msTouchAction;
+
+ this.enable = function() {
+
+ if (window.navigator.msPointerEnabled) {
+ // Microsoft pointer model
+ target.addEventListener('MSPointerDown', doEvent, false);
+ target.addEventListener('MSPointerMove', doEvent, false);
+ target.addEventListener('MSPointerUp', doEvent, false);
+ target.addEventListener('MSPointerCancel', doEvent, false);
+
+ // css way to prevent panning in our target area
+ if (typeof target.style.msContentZooming !== 'undefined') {
+ contentZooming = target.style.msContentZooming;
+ target.style.msContentZooming = 'none';
+ }
+
+ // new in Windows Consumer Preview: css way to prevent all built-in touch actions on our target
+ // without this, you cannot touch draw on the element because IE will intercept the touch events
+ if (typeof target.style.msTouchAction !== 'undefined') {
+ msTouchAction = target.style.msTouchAction;
+ target.style.msTouchAction = 'none';
+ }
+ } else if (target.addEventListener) {
+ // iOS touch model
+ target.addEventListener('touchstart', doEvent, false);
+ target.addEventListener('touchmove', doEvent, false);
+ target.addEventListener('touchend', doEvent, false);
+ target.addEventListener('touchcancel', doEvent, false);
+
+ // mouse model
+ target.addEventListener('mousedown', doEvent, false);
+
+ // mouse model with capture
+ // rejecting gecko because, unlike ie, firefox does not send events to target when the mouse is outside target
+ if (target.setCapture && !window.navigator.userAgent.match(/\bGecko\b/)) {
+ useSetReleaseCapture = true;
+
+ target.addEventListener('mousemove', doEvent, false);
+ target.addEventListener('mouseup', doEvent, false);
+ }
+ } else if (target.attachEvent && target.setCapture) {
+ // legacy IE mode - mouse with capture
+ useSetReleaseCapture = true;
+ target.attachEvent('onmousedown', function() {
+ doEvent(window.event);
+ window.event.returnValue = false;
+ return false;
+ });
+ target.attachEvent('onmousemove', function() {
+ doEvent(window.event);
+ window.event.returnValue = false;
+ return false;
+ });
+ target.attachEvent('onmouseup', function() {
+ doEvent(window.event);
+ window.event.returnValue = false;
+ return false;
+ });
+ }
+ };
+
+ this.disable = function() {
+ if (window.navigator.msPointerEnabled) {
+ // Microsoft pointer model
+ target.removeEventListener('MSPointerDown', doEvent, false);
+ target.removeEventListener('MSPointerMove', doEvent, false);
+ target.removeEventListener('MSPointerUp', doEvent, false);
+ target.removeEventListener('MSPointerCancel', doEvent, false);
+
+ // reset zooming to saved value
+ if (contentZooming) {
+ target.style.msContentZooming = contentZooming;
+ }
+
+ // reset touch action setting
+ if (msTouchAction) {
+ target.style.msTouchAction = msTouchAction;
+ }
+ } else if (target.removeEventListener) {
+ // iOS touch model
+ target.removeEventListener('touchstart', doEvent, false);
+ target.removeEventListener('touchmove', doEvent, false);
+ target.removeEventListener('touchend', doEvent, false);
+ target.removeEventListener('touchcancel', doEvent, false);
+
+ // mouse model
+ target.removeEventListener('mousedown', doEvent, false);
+
+ // mouse model with capture
+ // rejecting gecko because, unlike ie, firefox does not send events to target when the mouse is outside target
+ if (target.setCapture && !window.navigator.userAgent.match(/\bGecko\b/)) {
+ useSetReleaseCapture = true;
+
+ target.removeEventListener('mousemove', doEvent, false);
+ target.removeEventListener('mouseup', doEvent, false);
+ }
+ } else if (target.detachEvent && target.setCapture) {
+ // legacy IE mode - mouse with capture
+ useSetReleaseCapture = true;
+ target.detachEvent('onmousedown');
+ target.detachEvent('onmousemove');
+ target.detachEvent('onmouseup');
+ }
+ };
+
+ return this;
+ };
+ }])
+
+ .factory('GridsterDraggable', ['$document', '$timeout', '$window', 'GridsterTouch',
+ function($document, $timeout, $window, GridsterTouch) {
+ function GridsterDraggable($el, scope, gridster, item, itemOptions) {
+
+ var elmX, elmY, elmW, elmH,
+
+ mouseX = 0,
+ mouseY = 0,
+ lastMouseX = 0,
+ lastMouseY = 0,
+ mOffX = 0,
+ mOffY = 0,
+
+ minTop = 0,
+ maxTop = 9999,
+ minLeft = 0,
+ realdocument = $document[0];
+
+ var originalCol, originalRow;
+ var inputTags = ['select', 'input', 'textarea', 'button'];
+
+ var gridsterItemDragElement = $el[0].querySelector('[gridster-item-drag]');
+ //console.log(gridsterItemDragElement);
+ var isDraggableAreaDefined = gridsterItemDragElement?true:false;
+ //console.log(isDraggableAreaDefined);
+
+ function mouseDown(e) {
+
+ if(ie8){
+ e.target = window.event.srcElement;
+ e.which = window.event.button;
+ }
+
+ if(isDraggableAreaDefined && (!gridsterItemDragElement.contains(e.target))){
+ return false;
+ }
+
+ if (inputTags.indexOf(e.target.nodeName.toLowerCase()) !== -1) {
+ return false;
+ }
+
+ var $target = angular.element(e.target);
+
+ // exit, if a resize handle was hit
+ if ($target.hasClass('gridster-item-resizable-handler')) {
+ return false;
+ }
+
+ // exit, if the target has it's own click event
+ if ($target.attr('onclick') || $target.attr('ng-click')) {
+ return false;
+ }
+
+ // only works if you have jQuery
+ if ($target.closest && $target.closest('.gridster-no-drag').length) {
+ return false;
+ }
+
+ switch (e.which) {
+ case 1:
+ // left mouse button
+ break;
+ case 2:
+ case 3:
+ // right or middle mouse button
+ return;
+ }
+
+ lastMouseX = e.pageX;
+ lastMouseY = e.pageY;
+
+ elmX = parseInt($el.css('left'), 10);
+ elmY = parseInt($el.css('top'), 10);
+ elmW = $el[0].offsetWidth;
+ elmH = $el[0].offsetHeight;
+
+ originalCol = item.col;
+ originalRow = item.row;
+
+ dragStart(e);
+
+ return true;
+ }
+
+ function mouseMove(e) {
+ if (!$el.hasClass('gridster-item-moving') || $el.hasClass('gridster-item-resizing')) {
+ return false;
+ }
+
+ var maxLeft = gridster.curWidth - 1;
+
+ // Get the current mouse position.
+ mouseX = e.pageX;
+ mouseY = e.pageY;
+
+ // Get the deltas
+ var diffX = mouseX - lastMouseX + mOffX;
+ var diffY = mouseY - lastMouseY + mOffY;
+ mOffX = mOffY = 0;
+
+ // Update last processed mouse positions.
+ lastMouseX = mouseX;
+ lastMouseY = mouseY;
+
+ var dX = diffX,
+ dY = diffY;
+ if (elmX + dX < minLeft) {
+ diffX = minLeft - elmX;
+ mOffX = dX - diffX;
+ } else if (elmX + elmW + dX > maxLeft) {
+ diffX = maxLeft - elmX - elmW;
+ mOffX = dX - diffX;
+ }
+
+ if (elmY + dY < minTop) {
+ diffY = minTop - elmY;
+ mOffY = dY - diffY;
+ } else if (elmY + elmH + dY > maxTop) {
+ diffY = maxTop - elmY - elmH;
+ mOffY = dY - diffY;
+ }
+ elmX += diffX;
+ elmY += diffY;
+
+ // set new position
+ $el.css({
+ 'top': elmY + 'px',
+ 'left': elmX + 'px'
+ });
+
+ drag(e);
+
+ return true;
+ }
+
+ function mouseUp(e) {
+ if (!$el.hasClass('gridster-item-moving') || $el.hasClass('gridster-item-resizing')) {
+ return false;
+ }
+
+ mOffX = mOffY = 0;
+
+ dragStop(e);
+
+ return true;
+ }
+
+ function dragStart(event) {
+ $el.addClass('gridster-item-moving');
+ gridster.movingItem = item;
+
+ gridster.updateHeight(item.sizeY);
+ scope.$apply(function() {
+ if (gridster.draggable && gridster.draggable.start) {
+ gridster.draggable.start(event, $el, itemOptions);
+ }
+ });
+ }
+
+ function drag(event) {
+ var oldRow = item.row,
+ oldCol = item.col,
+ hasCallback = gridster.draggable && gridster.draggable.drag,
+ scrollSensitivity = gridster.draggable.scrollSensitivity,
+ scrollSpeed = gridster.draggable.scrollSpeed;
+
+ var row = gridster.pixelsToRows(elmY);
+ var col = gridster.pixelsToColumns(elmX);
+
+ var itemsInTheWay = gridster.getItems(row, col, item.sizeX, item.sizeY, item);
+ var hasItemsInTheWay = itemsInTheWay.length !== 0;
+
+ if (gridster.swapping === true && hasItemsInTheWay) {
+ var boundingBoxItem = gridster.getBoundingBox(itemsInTheWay),
+ sameSize = boundingBoxItem.sizeX === item.sizeX && boundingBoxItem.sizeY === item.sizeY,
+ sameRow = boundingBoxItem.row === oldRow,
+ sameCol = boundingBoxItem.col === oldCol,
+ samePosition = boundingBoxItem.row === row && boundingBoxItem.col === col,
+ inline = sameRow || sameCol;
+
+ if (sameSize && itemsInTheWay.length === 1) {
+ if (samePosition) {
+ gridster.swapItems(item, itemsInTheWay[0]);
+ } else if (inline) {
+ return;
+ }
+ } else if (boundingBoxItem.sizeX <= item.sizeX && boundingBoxItem.sizeY <= item.sizeY && inline) {
+ var emptyRow = item.row <= row ? item.row : row + item.sizeY,
+ emptyCol = item.col <= col ? item.col : col + item.sizeX,
+ rowOffset = emptyRow - boundingBoxItem.row,
+ colOffset = emptyCol - boundingBoxItem.col;
+
+ for (var i = 0, l = itemsInTheWay.length; i < l; ++i) {
+ var itemInTheWay = itemsInTheWay[i];
+
+ var itemsInFreeSpace = gridster.getItems(
+ itemInTheWay.row + rowOffset,
+ itemInTheWay.col + colOffset,
+ itemInTheWay.sizeX,
+ itemInTheWay.sizeY,
+ item
+ );
+
+ if (itemsInFreeSpace.length === 0) {
+ gridster.putItem(itemInTheWay, itemInTheWay.row + rowOffset, itemInTheWay.col + colOffset);
+ }
+ }
+ }
+ }
+
+ if (gridster.pushing !== false || !hasItemsInTheWay) {
+ item.row = row;
+ item.col = col;
+ }
+
+ if(($window.navigator.appName === 'Microsoft Internet Explorer' && !ie8) || $window.navigator.userAgent.indexOf("Firefox")!==-1){
+ if (event.pageY - realdocument.documentElement.scrollTop < scrollSensitivity) {
+ realdocument.documentElement.scrollTop = realdocument.documentElement.scrollTop - scrollSpeed;
+ } else if ($window.innerHeight - (event.pageY - realdocument.documentElement.scrollTop) < scrollSensitivity) {
+ realdocument.documentElement.scrollTop = realdocument.documentElement.scrollTop + scrollSpeed;
+ }
+ }
+ else{
+ if (event.pageY - realdocument.body.scrollTop < scrollSensitivity) {
+ realdocument.body.scrollTop = realdocument.body.scrollTop - scrollSpeed;
+ } else if ($window.innerHeight - (event.pageY - realdocument.body.scrollTop) < scrollSensitivity) {
+ realdocument.body.scrollTop = realdocument.body.scrollTop + scrollSpeed;
+ }
+ }
+
+
+
+ if (event.pageX - realdocument.body.scrollLeft < scrollSensitivity) {
+ realdocument.body.scrollLeft = realdocument.body.scrollLeft - scrollSpeed;
+ } else if ($window.innerWidth - (event.pageX - realdocument.body.scrollLeft) < scrollSensitivity) {
+ realdocument.body.scrollLeft = realdocument.body.scrollLeft + scrollSpeed;
+ }
+
+ if (hasCallback || oldRow !== item.row || oldCol !== item.col) {
+ scope.$apply(function() {
+ if (hasCallback) {
+ gridster.draggable.drag(event, $el, itemOptions);
+ }
+ });
+ }
+ }
+
+ function dragStop(event) {
+ $el.removeClass('gridster-item-moving');
+ var row = gridster.pixelsToRows(elmY);
+ var col = gridster.pixelsToColumns(elmX);
+ if (gridster.pushing !== false || gridster.getItems(row, col, item.sizeX, item.sizeY, item).length === 0) {
+ item.row = row;
+ item.col = col;
+ }
+ gridster.movingItem = null;
+ item.setPosition(item.row, item.col);
+
+ scope.$apply(function() {
+ if (gridster.draggable && gridster.draggable.stop) {
+ gridster.draggable.stop(event, $el, itemOptions);
+ }
+ });
+ }
+
+ var enabled = null;
+ var $dragHandles = null;
+ var unifiedInputs = [];
+
+ this.enable = function() {
+ if (enabled === true) {
+ return;
+ }
+
+ // disable and timeout required for some template rendering
+ $timeout(function() {
+ // disable any existing draghandles
+ for (var u = 0, ul = unifiedInputs.length; u < ul; ++u) {
+ unifiedInputs[u].disable();
+ }
+ unifiedInputs = [];
+
+ if (gridster.draggable && gridster.draggable.handle) {
+ $dragHandles = angular.element($el[0].querySelectorAll(gridster.draggable.handle));
+ if ($dragHandles.length === 0) {
+ // fall back to element if handle not found...
+ $dragHandles = $el;
+ }
+ } else {
+ $dragHandles = $el;
+ }
+
+ for (var h = 0, hl = $dragHandles.length; h < hl; ++h) {
+ unifiedInputs[h] = new GridsterTouch($dragHandles[h], mouseDown, mouseMove, mouseUp);
+ unifiedInputs[h].enable();
+ }
+
+ enabled = true;
+ });
+ };
+
+ this.disable = function() {
+ if (enabled === false) {
+ return;
+ }
+
+ // timeout to avoid race contition with the enable timeout
+ $timeout(function() {
+
+ for (var u = 0, ul = unifiedInputs.length; u < ul; ++u) {
+ unifiedInputs[u].disable();
+ }
+
+ unifiedInputs = [];
+ enabled = false;
+ });
+ };
+
+ this.toggle = function(enabled) {
+ if (enabled) {
+ this.enable();
+ } else {
+ this.disable();
+ }
+ };
+
+ this.destroy = function() {
+ this.disable();
+ };
+ }
+
+ return GridsterDraggable;
+ }
+ ])
+
+ .factory('GridsterResizable', ['GridsterTouch', function(GridsterTouch) {
+ function GridsterResizable($el, scope, gridster, item, itemOptions) {
+
+ function ResizeHandle(handleClass) {
+
+ var hClass = handleClass;
+
+ var elmX, elmY, elmW, elmH,
+
+ mouseX = 0,
+ mouseY = 0,
+ lastMouseX = 0,
+ lastMouseY = 0,
+ mOffX = 0,
+ mOffY = 0,
+
+ minTop = 0,
+ maxTop = 9999,
+ minLeft = 0;
+
+ var getMinHeight = function() {
+ return (item.minSizeY ? item.minSizeY : 1) * gridster.curRowHeight - gridster.margins[0];
+ };
+ var getMinWidth = function() {
+ return (item.minSizeX ? item.minSizeX : 1) * gridster.curColWidth - gridster.margins[1];
+ };
+
+ var originalWidth, originalHeight;
+ var savedDraggable;
+
+ function mouseDown(e) {
+ switch (e.which) {
+ case 1:
+ // left mouse button
+ break;
+ case 2:
+ case 3:
+ // right or middle mouse button
+ return;
+ }
+
+ // save the draggable setting to restore after resize
+ savedDraggable = gridster.draggable.enabled;
+ if (savedDraggable) {
+ gridster.draggable.enabled = false;
+ scope.$broadcast('gridster-draggable-changed', gridster);
+ }
+
+ // Get the current mouse position.
+ lastMouseX = e.pageX;
+ lastMouseY = e.pageY;
+
+ // Record current widget dimensions
+ elmX = parseInt($el.css('left'), 10);
+ elmY = parseInt($el.css('top'), 10);
+ elmW = $el[0].offsetWidth;
+ elmH = $el[0].offsetHeight;
+
+ originalWidth = item.sizeX;
+ originalHeight = item.sizeY;
+
+ resizeStart(e);
+
+ return true;
+ }
+
+ function resizeStart(e) {
+ $el.addClass('gridster-item-moving');
+ $el.addClass('gridster-item-resizing');
+
+ gridster.movingItem = item;
+
+ item.setElementSizeX();
+ item.setElementSizeY();
+ item.setElementPosition();
+ gridster.updateHeight(1);
+
+ scope.$apply(function() {
+ // callback
+ if (gridster.resizable && gridster.resizable.start) {
+ gridster.resizable.start(e, $el, itemOptions); // options is the item model
+ }
+ });
+ }
+
+ function mouseMove(e) {
+ var maxLeft = gridster.curWidth - 1;
+
+ // Get the current mouse position.
+ mouseX = e.pageX;
+ mouseY = e.pageY;
+
+ // Get the deltas
+ var diffX = mouseX - lastMouseX + mOffX;
+ var diffY = mouseY - lastMouseY + mOffY;
+ mOffX = mOffY = 0;
+
+ // Update last processed mouse positions.
+ lastMouseX = mouseX;
+ lastMouseY = mouseY;
+
+ var dY = diffY,
+ dX = diffX;
+
+ if (hClass.indexOf('n') >= 0) {
+ if (elmH - dY < getMinHeight()) {
+ diffY = elmH - getMinHeight();
+ mOffY = dY - diffY;
+ } else if (elmY + dY < minTop) {
+ diffY = minTop - elmY;
+ mOffY = dY - diffY;
+ }
+ elmY += diffY;
+ elmH -= diffY;
+ }
+ if (hClass.indexOf('s') >= 0) {
+ if (elmH + dY < getMinHeight()) {
+ diffY = getMinHeight() - elmH;
+ mOffY = dY - diffY;
+ } else if (elmY + elmH + dY > maxTop) {
+ diffY = maxTop - elmY - elmH;
+ mOffY = dY - diffY;
+ }
+ elmH += diffY;
+ }
+ if (hClass.indexOf('w') >= 0) {
+ if (elmW - dX < getMinWidth()) {
+ diffX = elmW - getMinWidth();
+ mOffX = dX - diffX;
+ } else if (elmX + dX < minLeft) {
+ diffX = minLeft - elmX;
+ mOffX = dX - diffX;
+ }
+ elmX += diffX;
+ elmW -= diffX;
+ }
+ if (hClass.indexOf('e') >= 0) {
+ if (elmW + dX < getMinWidth()) {
+ diffX = getMinWidth() - elmW;
+ mOffX = dX - diffX;
+ } else if (elmX + elmW + dX > maxLeft) {
+ diffX = maxLeft - elmX - elmW;
+ mOffX = dX - diffX;
+ }
+ elmW += diffX;
+ }
+
+ // set new position
+ $el.css({
+ 'top': elmY + 'px',
+ 'left': elmX + 'px',
+ 'width': elmW + 'px',
+ 'height': elmH + 'px'
+ });
+
+ resize(e);
+
+ return true;
+ }
+
+ function mouseUp(e) {
+ // restore draggable setting to its original state
+ if (gridster.draggable.enabled !== savedDraggable) {
+ gridster.draggable.enabled = savedDraggable;
+ scope.$broadcast('gridster-draggable-changed', gridster);
+ }
+
+ mOffX = mOffY = 0;
+
+ resizeStop(e);
+
+ return true;
+ }
+
+ function resize(e) {
+ var oldRow = item.row,
+ oldCol = item.col,
+ oldSizeX = item.sizeX,
+ oldSizeY = item.sizeY,
+ hasCallback = gridster.resizable && gridster.resizable.resize;
+
+ var col = item.col;
+ // only change column if grabbing left edge
+ if (['w', 'nw', 'sw'].indexOf(handleClass) !== -1) {
+ col = gridster.pixelsToColumns(elmX, false);
+ }
+
+ var row = item.row;
+ // only change row if grabbing top edge
+ if (['n', 'ne', 'nw'].indexOf(handleClass) !== -1) {
+ row = gridster.pixelsToRows(elmY, false);
+ }
+
+ var sizeX = item.sizeX;
+ // only change row if grabbing left or right edge
+ if (['n', 's'].indexOf(handleClass) === -1) {
+ sizeX = gridster.pixelsToColumns(elmW, true);
+ }
+
+ var sizeY = item.sizeY;
+ // only change row if grabbing top or bottom edge
+ if (['e', 'w'].indexOf(handleClass) === -1) {
+ sizeY = gridster.pixelsToRows(elmH, true);
+ }
+
+ if (gridster.pushing !== false || gridster.getItems(row, col, sizeX, sizeY, item).length === 0) {
+ item.row = row;
+ item.col = col;
+ item.sizeX = sizeX;
+ item.sizeY = sizeY;
+ }
+ var isChanged = item.row !== oldRow || item.col !== oldCol || item.sizeX !== oldSizeX || item.sizeY !== oldSizeY;
+
+ if (hasCallback || isChanged) {
+ scope.$apply(function() {
+ if (hasCallback) {
+ gridster.resizable.resize(e, $el, itemOptions); // options is the item model
+ }
+ });
+ }
+ }
+
+ function resizeStop(e) {
+ $el.removeClass('gridster-item-moving');
+ $el.removeClass('gridster-item-resizing');
+
+ gridster.movingItem = null;
+
+ item.setPosition(item.row, item.col);
+ item.setSizeY(item.sizeY);
+ item.setSizeX(item.sizeX);
+
+ scope.$apply(function() {
+ if (gridster.resizable && gridster.resizable.stop) {
+ gridster.resizable.stop(e, $el, itemOptions); // options is the item model
+ }
+ });
+ }
+
+ var $dragHandle = null;
+ var unifiedInput;
+
+ this.enable = function() {
+ if (!$dragHandle) {
+ $dragHandle = angular.element('<div class="gridster-item-resizable-handler handle-' + hClass + '"></div>');
+ $el.append($dragHandle);
+ }
+
+ unifiedInput = new GridsterTouch($dragHandle[0], mouseDown, mouseMove, mouseUp);
+ unifiedInput.enable();
+ };
+
+ this.disable = function() {
+ if ($dragHandle) {
+ $dragHandle.remove();
+ $dragHandle = null;
+ }
+
+ unifiedInput.disable();
+ unifiedInput = undefined;
+ };
+
+ this.destroy = function() {
+ this.disable();
+ };
+ }
+
+ var handles = [];
+ var handlesOpts = gridster.resizable.handles;
+ if (typeof handlesOpts === 'string') {
+ handlesOpts = gridster.resizable.handles.split(',');
+ }
+ var enabled = false;
+
+ for (var c = 0, l = handlesOpts.length; c < l; c++) {
+ handles.push(new ResizeHandle(handlesOpts[c]));
+ }
+
+ this.enable = function() {
+ if (enabled) {
+ return;
+ }
+ for (var c = 0, l = handles.length; c < l; c++) {
+ handles[c].enable();
+ }
+ enabled = true;
+ };
+
+ this.disable = function() {
+ if (!enabled) {
+ return;
+ }
+ for (var c = 0, l = handles.length; c < l; c++) {
+ handles[c].disable();
+ }
+ enabled = false;
+ };
+
+ this.toggle = function(enabled) {
+ if (enabled) {
+ this.enable();
+ } else {
+ this.disable();
+ }
+ };
+
+ this.destroy = function() {
+ for (var c = 0, l = handles.length; c < l; c++) {
+ handles[c].destroy();
+ }
+ };
+ }
+ return GridsterResizable;
+ }])
+
+ .factory('gridsterDebounce', function() {
+ return function gridsterDebounce(func, wait, immediate) {
+ var timeout;
+ return function() {
+ var context = this,
+ args = arguments;
+ var later = function() {
+ timeout = null;
+ if (!immediate) {
+ func.apply(context, args);
+ }
+ };
+ var callNow = immediate && !timeout;
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ if (callNow) {
+ func.apply(context, args);
+ }
+ };
+ };
+ })
+
+ /**
+ * GridsterItem directive
+ * @param $parse
+ * @param GridsterDraggable
+ * @param GridsterResizable
+ * @param gridsterDebounce
+ */
+ .directive('gridsterItem', ['$parse', 'GridsterDraggable', 'GridsterResizable', 'gridsterDebounce',
+ function($parse, GridsterDraggable, GridsterResizable, gridsterDebounce) {
+ return {
+ scope: true,
+ restrict: 'EA',
+ controller: 'GridsterItemCtrl',
+ controllerAs: 'gridsterItem',
+ require: ['^gridster', 'gridsterItem'],
+ link: function(scope, $el, attrs, controllers) {
+ var optionsKey = attrs.gridsterItem,
+ options;
+
+ var gridster = controllers[0],
+ item = controllers[1];
+
+ scope.gridster = gridster;
+
+
+ // bind the item's position properties
+ // options can be an object specified by gridster-item="object"
+ // or the options can be the element html attributes object
+ if (optionsKey) {
+ var $optionsGetter = $parse(optionsKey);
+ options = $optionsGetter(scope) || {};
+ if (!options && $optionsGetter.assign) {
+ options = {
+ row: item.row,
+ col: item.col,
+ sizeX: item.sizeX,
+ sizeY: item.sizeY,
+ minSizeX: 0,
+ minSizeY: 0,
+ maxSizeX: null,
+ maxSizeY: null
+ };
+ $optionsGetter.assign(scope, options);
+ }
+ } else {
+ options = attrs;
+ }
+
+ item.init($el, gridster);
+
+ $el.addClass('gridster-item');
+
+ var aspects = ['minSizeX', 'maxSizeX', 'minSizeY', 'maxSizeY', 'sizeX', 'sizeY', 'row', 'col'],
+ $getters = {};
+
+ var expressions = [];
+ var aspectFn = function(aspect) {
+ var expression;
+ if (typeof options[aspect] === 'string') {
+ // watch the expression in the scope
+ expression = options[aspect];
+ } else if (typeof options[aspect.toLowerCase()] === 'string') {
+ // watch the expression in the scope
+ expression = options[aspect.toLowerCase()];
+ } else if (optionsKey) {
+ // watch the expression on the options object in the scope
+ expression = optionsKey + '.' + aspect;
+ } else {
+ return;
+ }
+ expressions.push('"' + aspect + '":' + expression);
+ $getters[aspect] = $parse(expression);
+
+ // initial set
+ var val = $getters[aspect](scope);
+ if (typeof val === 'number') {
+ item[aspect] = val;
+ }
+ };
+
+ for (var i = 0, l = aspects.length; i < l; ++i) {
+ aspectFn(aspects[i]);
+ }
+
+ var watchExpressions = '{' + expressions.join(',') + '}';
+
+ // when the value changes externally, update the internal item object
+ scope.$watchCollection(watchExpressions, function(newVals, oldVals) {
+ for (var aspect in newVals) {
+ var newVal = newVals[aspect];
+ var oldVal = oldVals[aspect];
+ if (oldVal === newVal) {
+ continue;
+ }
+ newVal = parseInt(newVal, 10);
+ if (!isNaN(newVal)) {
+ item[aspect] = newVal;
+ }
+ }
+ });
+
+ function positionChanged() {
+ // call setPosition so the element and gridster controller are updated
+ item.setPosition(item.row, item.col);
+
+ // when internal item position changes, update externally bound values
+ if ($getters.row && $getters.row.assign) {
+ $getters.row.assign(scope, item.row);
+ }
+ if ($getters.col && $getters.col.assign) {
+ $getters.col.assign(scope, item.col);
+ }
+ }
+ scope.$watch(function() {
+ return item.row + ',' + item.col;
+ }, positionChanged);
+
+ function sizeChanged() {
+ var changedX = item.setSizeX(item.sizeX, true);
+ if (changedX && $getters.sizeX && $getters.sizeX.assign) {
+ $getters.sizeX.assign(scope, item.sizeX);
+ }
+ var changedY = item.setSizeY(item.sizeY, true);
+ if (changedY && $getters.sizeY && $getters.sizeY.assign) {
+ $getters.sizeY.assign(scope, item.sizeY);
+ }
+
+ if (changedX || changedY) {
+ item.gridster.moveOverlappingItems(item);
+ gridster.layoutChanged();
+ scope.$broadcast('gridster-item-resized', item);
+ }
+ }
+
+ scope.$watch(function() {
+ return item.sizeY + ',' + item.sizeX + ',' + item.minSizeX + ',' + item.maxSizeX + ',' + item.minSizeY + ',' + item.maxSizeY;
+ }, sizeChanged);
+
+ var draggable = new GridsterDraggable($el, scope, gridster, item, options);
+ var resizable = new GridsterResizable($el, scope, gridster, item, options);
+
+ var updateResizable = function() {
+ resizable.toggle(!gridster.isMobile && gridster.resizable && gridster.resizable.enabled);
+ };
+ updateResizable();
+
+ var updateDraggable = function() {
+ draggable.toggle(!gridster.isMobile && gridster.draggable && gridster.draggable.enabled);
+ };
+ updateDraggable();
+
+ scope.$on('gridster-draggable-changed', updateDraggable);
+ scope.$on('gridster-resizable-changed', updateResizable);
+ scope.$on('gridster-resized', updateResizable);
+ scope.$on('gridster-mobile-changed', function() {
+ updateResizable();
+ updateDraggable();
+ });
+
+ function whichTransitionEvent() {
+ var el = document.createElement('div');
+ var transitions = {
+ 'transition': 'transitionend',
+ 'OTransition': 'oTransitionEnd',
+ 'MozTransition': 'transitionend',
+ 'WebkitTransition': 'webkitTransitionEnd'
+ };
+ for (var t in transitions) {
+ if (el.style[t] !== undefined) {
+ return transitions[t];
+ }
+ }
+ }
+
+ var debouncedTransitionEndPublisher = gridsterDebounce(function() {
+ scope.$apply(function() {
+ scope.$broadcast('gridster-item-transition-end', item);
+ });
+ }, 50);
+
+ if(whichTransitionEvent()){ //check for IE8, as it evaluates to null
+ $el.on(whichTransitionEvent(), debouncedTransitionEndPublisher);
+ }
+
+ scope.$broadcast('gridster-item-initialized', item);
+
+ return scope.$on('$destroy', function() {
+ try {
+ resizable.destroy();
+ draggable.destroy();
+ } catch (e) {}
+
+ try {
+ gridster.removeItem(item);
+ } catch (e) {}
+
+ try {
+ item.destroy();
+ } catch (e) {}
+ });
+ }
+ };
+ }
+ ])
+
+ .directive('gridsterNoDrag', function() {
+ return {
+ restrict: 'A',
+ link: function(scope, $element) {
+ $element.addClass('gridster-no-drag');
+ }
+ };
+ })
+
+ ;
+
+}));
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/ui-gridster-tpls.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/ui-gridster-tpls.js
new file mode 100644
index 00000000..3ca3db7d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/ui-gridster-tpls.js
@@ -0,0 +1,168 @@
+/**
+* FileName ui-gridster
+* Version 0.0.1
+* Build number ad58c6f4f8f8fd7f04ac457f95d76f09
+* Date 08/17/2015
+*/
+
+
+(function(angular, window){
+angular.module("att.gridster", ["att.gridster.tpls", "att.gridster.utilities","att.gridster.gridster"]);
+angular.module("att.gridster.tpls", ["template/gridster/gridster.html","template/gridster/gridsterItem.html","template/gridster/gridsterItemBody.html","template/gridster/gridsterItemFooter.html","template/gridster/gridsterItemHeader.html"]);
+angular.module('att.gridster.utilities', [])
+ .factory('$extendObj', [function() {
+ var _extendDeep = function(dst) {
+ angular.forEach(arguments, function(obj) {
+ if (obj !== dst) {
+ angular.forEach(obj, function(value, key) {
+ if (dst[key] && dst[key].constructor && dst[key].constructor === Object) {
+ _extendDeep(dst[key], value);
+ } else {
+ dst[key] = value;
+ }
+ });
+ }
+ });
+ return dst;
+ };
+ return {
+ extendDeep: _extendDeep
+ };
+ }]);
+
+angular.module('att.gridster.gridster', ['attGridsterLib', 'att.gridster.utilities'])
+ .config(['$compileProvider', function($compileProvider) {
+ $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|javascript):/);
+ }])
+ .constant('attGridsterConfig',
+ {
+ columns: 3,
+ margins: [10, 10],
+ outerMargin: true,
+ pushing: true,
+ floating: true,
+ swapping: true,
+ draggable: {
+ enabled: true
+ }
+ })
+ .directive('attGridster', ['attGridsterConfig', '$extendObj', function(attGridsterConfig, $extendObj) {
+ return {
+ restrict: 'EA',
+ scope: {
+ attGridsterOptions: '=?'
+ },
+ templateUrl: 'template/gridster/gridster.html',
+ replace: false,
+ transclude: true,
+ controller: [function() {}],
+ link: function(scope) {
+ if (angular.isDefined(scope.attGridsterOptions)) {
+ attGridsterConfig = $extendObj.extendDeep(attGridsterConfig, scope.attGridsterOptions);
+ }
+ scope.attGridsterConfig = attGridsterConfig;
+ }
+ };
+ }])
+ .directive('attGridsterItem', ['$timeout', function($timeout) {
+ return {
+ restrict: 'EA',
+ require: ['^attGridster'],
+ scope: {
+ attGridsterItem: '='
+ },
+ templateUrl: 'template/gridster/gridsterItem.html',
+ replace: false,
+ transclude: true,
+ controller: [function() {}]
+ };
+ }])
+ .directive('attGridsterItemHeader', [function() {
+ return {
+ restrict: 'EA',
+ require: ['^attGridsterItem'],
+ scope: {
+ headerText: '@',
+ subHeaderText: '@?'
+ },
+ templateUrl: 'template/gridster/gridsterItemHeader.html',
+ replace: true,
+ transclude: true,
+ link: function(scope, element) {
+ if (angular.isDefined(scope.subHeaderText) && scope.subHeaderText) {
+ angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("tabindex", "0");
+ angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("aria-label", scope.subHeaderText);
+ }
+ }
+ };
+ }])
+ .directive('attGridsterItemBody', [function() {
+ return {
+ restrict: 'EA',
+ require: ['^attGridsterItem'],
+ scope: {},
+ templateUrl: 'template/gridster/gridsterItemBody.html',
+ replace: true,
+ transclude: true
+ };
+ }])
+ .directive('attGridsterItemFooter', ['$location', function($location) {
+ return {
+ restrict: 'EA',
+ require: ['^attGridsterItem'],
+ scope: {
+ attGridsterItemFooterLink: '@?'
+ },
+ templateUrl: 'template/gridster/gridsterItemFooter.html',
+ replace: true,
+ transclude: true,
+ controller: ['$scope', function($scope) {
+ $scope.clickOnFooterLink = function(evt) {
+ evt.preventDefault();
+ evt.stopPropagation();
+ if ($scope.attGridsterItemFooterLink) {
+ $location.url($scope.attGridsterItemFooterLink);
+ }
+ };
+ }],
+ link: function(scope, element) {
+ if (angular.isDefined(scope.attGridsterItemFooterLink) && scope.attGridsterItemFooterLink) {
+ element.attr("role", "link");
+ }
+ }
+ };
+ }]);
+angular.module("template/gridster/gridster.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/gridster/gridster.html",
+ "<div gridster='attGridsterConfig'><div ng-transclude></div></div>");
+}]);
+
+angular.module("template/gridster/gridsterItem.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/gridster/gridsterItem.html",
+ "<div gridster-item='attGridsterItem' class=\"gridster-item-container\" ng-transclude></div>");
+}]);
+
+angular.module("template/gridster/gridsterItemBody.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/gridster/gridsterItemBody.html",
+ "<div class=\"gridster-item-body\" ng-transclude></div>");
+}]);
+
+angular.module("template/gridster/gridsterItemFooter.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/gridster/gridsterItemFooter.html",
+ "<div class=\"gridster-item-footer\" ng-click=\"clickOnFooterLink($event)\" tabindex=\"0\" ng-keydown=\"(($event.keyCode && $event.keyCode === 13) || ($event.which && $event.which === 13)) && clickOnFooterLink($event)\" >\n" +
+ " <span class=\"gridster-item-footer-content\" ng-transclude></span>\n" +
+ "</div>");
+}]);
+
+angular.module("template/gridster/gridsterItemHeader.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/gridster/gridsterItemHeader.html",
+ "<div class=\"gridster-item-header\">\n" +
+ " <img gridster-item-drag src=\"static/fusion/images/att_angular_gridster/grips.png\" alt=\"||\" aria-label=\"Tap/Click to move\" class=\"gridster-item-handle\" />\n" +
+ " <span class=\"gridster-item-header-content\" tabindex=\"0\" role=\"presentation\" aria-label=\"{{headerText}}\">{{headerText}}</span>\n" +
+ " <span class=\"gridster-item-sub-header-content\" role=\"presentation\">{{subHeaderText}}</span>\n" +
+ " <div class=\"gridster-item-header-buttons-container\" ng-transclude></div>\n" +
+ "</div>");
+}]);
+
+return {}
+})(angular, window); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/adminController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/adminController.js
new file mode 100644
index 00000000..a99be9fe
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/adminController.js
@@ -0,0 +1,65 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.config(function($routeProvider) {
+ $routeProvider
+
+
+ .when('/role_function_list', {
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/role_function_list.html',
+ controller: 'roleFunctionListController'
+ })
+
+ .when('/admin_menu_edit', {
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/admin_menu_edit.html',
+ controller: 'AdminMenuEditController'
+ })
+ .when('/role/:roleId', {
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/role.html',
+ controller: 'roleController'
+ })
+ .when('/jcs_admin', {
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/jcs_admin.html',
+ controller: 'cacheAdminController'
+ })
+ .when('/broadcast_list', {
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/broadcast_list.html',
+ controller: 'broadcastListController'
+ })
+ .when('/broadcast/:messageLocationId/:messageLocation/:messageId', {
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/broadcast.html',
+ controller: 'broadcastController'
+ })
+ .when('/broadcast/:messageLocationId/:messageLocation', {
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/broadcast.html',
+ controller: 'broadcastController'
+ })
+ .when('/collaborate_list', {
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/collaborate_list.html',
+ controller: 'collaborateListController'
+ })
+ .when('/usage_list', {
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/usage_list.html',
+ controller: 'usageListController'
+ })
+ .otherwise({
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/role_list.html',
+ controller : "roleListController"
+ });
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/admin_menu_edit.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/admin_menu_edit.js
new file mode 100644
index 00000000..54d58a45
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/admin_menu_edit.js
@@ -0,0 +1,230 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('AdminMenuEditController', function ($scope, AdminService, modalService, $modal, $route){
+ $( "#dialog" ).hide();
+
+/* AdminService.getRoleFunctionList().then(function(data){
+
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.availableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions);
+
+ //$scope.resetMenu();
+
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });*/
+ $scope.init = function () {
+ $scope.numberOfRecordstoShow=20;
+ AdminService.getFnMenuItems().then(function(data){
+ var j = data;
+ $scope.data =JSON.parse(j.data);
+ $scope.fnMenuItems =($scope.data.fnMenuItems);
+
+ },function(error){
+ console.log("failed");
+ //reloadPageOnce();
+ });
+ }
+ $scope.init();
+ $scope.mapActiveStatus = function(status){
+ if(status)
+ status = "Y";
+ else
+ status = "N";
+ return status;
+
+ };
+
+
+ $scope.addNewFnMenuItemModalPopup = function(availableFnMenuItem) {
+ $scope.editFnMenuItem = null;
+ var modalInstance = $modal.open({
+ templateUrl: 'fn_menu_add_popup.html',
+ controller: 'fn_menu_popupController',
+ resolve: {
+ message: function () {
+ var message = {
+ availableFnMenuItem: $scope.editFnMenuItem
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ console.log('response', response);
+ $scope.availableFnMenuItems=response.availableFnMenuItems;
+ $route.reload();
+ });
+ };
+
+ $scope.removeMenuItem = function(fnMenuItem) {
+ modalService.popupConfirmWin("Confirm","You are about to delete the menu item "+fnMenuItem.label+". Do you want to continue?",
+ function(){
+ var uuu = "admin_fn_menu/removeMenuItem.htm";
+ var postData={fnMenuItem: fnMenuItem};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.fnMenuItem=data.fnMenuItem;});
+ $route.reload();
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while deleting: "+ data.responseText);
+ }
+ });
+
+ })
+
+ };
+
+ $scope.editRoleFunction = null;
+ var dialog = null;
+ $scope.editRoleFunctionPopup = function(availableRoleFunction) {
+ $scope.editRoleFunction = availableRoleFunction;
+ $( "#dialog" ).dialog({
+ modal: true
+ });
+ };
+
+ $scope.editMenuItemModalPopup = function(availableFnMenuItem) {
+ $scope.editFnMenuItem = availableFnMenuItem;
+ var modalInstance = $modal.open({
+ templateUrl: 'fn_menu_add_popup.html',
+ controller: 'fn_menu_popupController',
+ resolve: {
+ message: function () {
+ var message = {
+ availableFnMenuItem: $scope.editFnMenuItem
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ $scope.availableFnMenuItems=response.availableFnMenuItems;
+ $route.reload();
+ });
+ };
+
+ $scope.editRoleFunctionModalPopup = function(availableRoleFunction) {
+ $scope.editRoleFunction = availableRoleFunction;
+ var modalInstance = $modal.open({
+ templateUrl: 'edit_role_function_popup.html',
+ controller: 'rolefunctionpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ availableRoleFunction: $scope.editRoleFunction
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ console.log('response', response);
+ $scope.availableRoleFunctions=response.availableRoleFunctions;
+ });
+ };
+
+ $scope.addNewRoleFunctionModalPopup = function(availableRoleFunction) {
+ $scope.editRoleFunction = null;
+ var modalInstance = $modal.open({
+ templateUrl: 'edit_role_function_popup.html',
+ controller: 'rolefunctionpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ availableRoleFunction: $scope.editRoleFunction
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ console.log('response', response);
+ $scope.availableRoleFunctions=response.availableRoleFunctions;
+ });
+ };
+
+ $scope.addNewRoleFunctionPopup = function() {
+ $scope.editRoleFunction = null;
+ $( "#dialog" ).dialog({
+ modal: true
+ });
+ };
+
+ $scope.saveRoleFunction = function(availableRoleFunction) {
+ var uuu = "role_function_list/saveRoleFunction.htm";
+ var postData={availableRoleFunction: availableRoleFunction};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.availableRoleFunctions=[];$scope.$apply();
+ $scope.availableRoleFunctions=data.availableRoleFunctions;});
+ //alert("Update Successful.") ;
+ console.log($scope.availableRoleFunctions);
+
+ $scope.editRoleFunction = null;
+ $( "#dialog" ).dialog("close");
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+ };
+
+
+ $scope.removeRole = function(availableRoleFunction) {
+ modalService.popupConfirmWin("Confirm","You are about to delete the role function "+availableRoleFunction.name+". Do you want to continue?",
+ function(){
+ var uuu = "role_function_list/removeRoleFunction.htm";
+ var postData={availableRoleFunction: availableRoleFunction};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.availableRoleFunctions=data.availableRoleFunctions;});
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while deleting: "+ data.responseText);
+ }
+ });
+
+ })
+
+ };
+
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/ase-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/ase-controller.js
new file mode 100644
index 00000000..45fc31ac
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/ase-controller.js
@@ -0,0 +1,22 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('aseCtrl', function ($scope){
+/* do nothing yet*/
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-controller.js
new file mode 100644
index 00000000..77ee22f5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-controller.js
@@ -0,0 +1,79 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('broadcastController', function ($scope, modalService, $modal,AdminService,$routeParams){
+ //$scope.broadcastMessage=${broadcastMessage};
+ //$scope.broadcastSites=${broadcastSites};
+ //console.log($scope.broadcastMessage);
+ $scope.broadcastMessage=[];
+ $scope.broadcastSites=[];
+ AdminService.getBroadcast($routeParams.messageLocationId, $routeParams.messageLocation, $routeParams.messageId).then(function(data){
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.broadcastMessage=JSON.parse($scope.data.broadcastMessage);
+ $scope.broadcastSites=JSON.parse($scope.data.broadcastSites);
+ console.log($scope.broadcastMessage);
+ console.log($scope.broadcastMessage.id);
+ console.log($scope.broadcastSites);
+ //$scope.resetMenu();
+
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+ $scope.save = function() {
+ var uuu = "broadcast/save";
+ var postData={broadcastMessage: $scope.broadcastMessage};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ window.location.href = "admin#/broadcast_list";
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+ };
+
+ $scope.close = function() {
+ window.location.href = "admin#/broadcast_list";
+};
+
+});
+
+$(function() {
+ $( "#startDatepicker" ).datepicker();
+ $( "#endDatepicker" ).datepicker();
+
+ $( "#startDatepicker" ).change(function() {
+ var tempStartDate = moment($( "#startDatepicker" ).val()).format('YYYY-MM-DD hh:mm:ss.S');
+ $( "#startDateHidden" ).val(tempStartDate.toString());
+ //alert( $( "#startDateHidden" ).val() );
+ });
+ $( "#endDatepicker" ).change(function() {
+ var tempEndDate = moment($( "#endDatepicker" ).val()).format('YYYY-MM-DD hh:mm:ss.S');
+ $( "#endDateHidden" ).val(tempEndDate.toString());
+ //alert( $( "#endDateHidden" ).val() );
+ });
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-list-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-list-controller.js
new file mode 100644
index 00000000..cb10a29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-list-controller.js
@@ -0,0 +1,120 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('broadcastListController', function ($scope, modalService, $modal,AdminService){
+ //$scope.broadcastMessage=${broadcastMessage};
+ //$scope.broadcastSites=${broadcastSites};
+ //console.log($scope.broadcastMessage);
+ var messagesMap = {};
+ AdminService.getBroadcastList().then(function(data){
+
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.messagesList=(($scope.data.messagesList===null) ? [""]:$scope.data.messagesList);
+ $scope.messageLocations=(($scope.data.messageLocations===null) ? [""]:$scope.data.messageLocations);
+ console.log("messages: "+$scope.messagesList);
+ console.log("location: "+$scope.messageLocations);
+ $.each($scope.messageLocations, function(i, a){
+ //var result = [];
+ angular.forEach($scope.messagesList, function(value, key) {
+ if (key+'' === a.value+'') {
+ //var objsJSON = JSON.parse(value);
+
+ $.each(value, function(i, a){
+ var startDateLong = a.startDate;
+ var tempStartDate = new Date(startDateLong);
+ tempStartDate = moment(tempStartDate).format('DD MMM YYYY hh:mmA zz');//03 Jun 2013 04:15PM EDT
+ a.displayStartDate=tempStartDate.toString();
+
+ var endDateLong = a.endDate;
+ var tempEndDate = new Date(endDateLong);
+ tempEndDate = moment(tempEndDate).format('DD MMM YYYY hh:mmA zz');//03 Jun 2013 04:15PM EDT
+ a.displayEndDate=tempEndDate.toString();
+ });
+ a.messages = value;
+ }
+ });
+ console.log(a.messages);
+ });
+
+ //$scope.resetMenu();
+
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+
+ $scope.editMessage = function(location) {
+
+ editMessage(location.value, location.label);
+ };
+
+ $scope.toggleActive = function(broadcastMessage) {
+
+ //alert('deleted'+role.name);
+ var uuu = "broadcast_list/toggleActive";
+ var postData={broadcastMessage:broadcastMessage};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ //window.location.reload();
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while toggling: "+ data.responseText);
+
+ }
+ });
+
+
+ };
+
+ $scope.remove = function(broadcastMessage) {
+
+ //alert('deleted'+role.name);
+ var uuu = "broadcast_list/remove";
+ var postData={broadcastMessage:broadcastMessage};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ window.location.reload();
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while deleting: "+ data.responseText);
+ }
+ });
+
+
+ };
+
+});
+
+function editMessage(messageLocationId, messageLocation, messageId) {
+ window.location='admin#/broadcast/'+messageLocationId + '/' + messageLocation + ((messageId != null) ? '/' + messageId : '');
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/collaborate-list-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/collaborate-list-controller.js
new file mode 100644
index 00000000..5b0b9342
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/collaborate-list-controller.js
@@ -0,0 +1,63 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller("collaborateListController", function ($scope,$http,modalService, $modal,AdminService) {
+ // Table Data
+ AdminService.getCollaborateList().then(function(data){
+
+ var j = data;
+ $scope.tableData = JSON.parse(j.data);
+ //$scope.resetMenu();
+
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+ $scope.viewPerPage = 20;
+ $scope.scrollViewsPerPage = 2;
+ $scope.currentPage = 1;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+ /* modalService.showSuccess('','Modal Sample') ; */
+ for(x in $scope.tableData){
+ if($scope.tableData[x].active_yn=='Y')
+ $scope.tableData[x].active_yn=true;
+ else
+ $scope.tableData[x].active_yn=false;
+ }
+ $scope.openCollaboration = function(chatId){
+ openInNewTab('collaboration?chat_id=' + chatId);
+ }
+
+ $scope.toggleProfileActive = function(profileId) {
+ modalService.popupConfirmWin("Confirm","You are about to change user's active status. Do you want to continue?",
+ function(){
+ $http.get("profile/toggleProfileActive?profile_id="+profileId).success(function(){});
+
+ })
+ };
+
+});
+
+function openInNewTab(url) {
+ var win = window.open(url, '_blank');
+ win.focus();
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/fn_menu_add_popup_controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/fn_menu_add_popup_controller.js
new file mode 100644
index 00000000..e0179946
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/fn_menu_add_popup_controller.js
@@ -0,0 +1,281 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+var fn_menu_popupController = function ($scope, $modalInstance, message, $http){ /// examine the LeftMenuService
+ if(message.availableFnMenuItem==null)
+ $scope.label='Add New Menu Item'
+
+ else{
+ $scope.label='Edit Menu Item'
+ //$scope.disableParentId=true;
+ }
+
+ $scope.getParentData = function(){
+ var uuu = "admin_fn_menu/get_parent_list"
+ $.ajax({
+ type : 'GET',
+ url : uuu,
+ dataType: 'json', // data type expected from server
+ contentType: 'application/json',
+ //data: JSON.stringify(postData), // data type sent to server
+ success : function(data){
+ $scope.$apply(function(){
+ //$scope.availableRoleFunctions=[];$scope.$apply();
+ $scope.parentListSelectData=data; // data from server
+ menuItems = $scope.parentListSelectData;
+ var heirarchicalMenuItems = [];
+ var children = [];
+ for ( var i=0; i<menuItems.length; i++){
+ for(var j=0; j<menuItems.length; j++){
+ if(menuItems[j][2]==menuItems[i][0])
+ children.push(
+ {
+ menuId: menuItems[j][0],
+ label: menuItems[j][1]
+ }
+ );
+ }
+ if(children.length!=0){
+ heirarchicalMenuItems.push(
+ {
+
+ menuId: menuItems[i][0],
+ label: menuItems[i][1],
+ children: children.sort($scope.sortItems("label"))
+ }
+
+ );
+ }
+ children = [];
+
+ }
+ heirarchicalMenuItems.sort($scope.sortItems("label"));
+ $scope.childListSelectData = heirarchicalMenuItems;
+ //console.log(data);
+ });
+ //$scope.editRoleFunction = null;
+ ///$modalInstance.close({functionCDselectData:$scope.functionCDselectData});
+ },
+ error : function(data){
+ alert("Parent Data not available !");
+ }
+ });
+
+ };
+
+ $scope.sortItems = function(prop){
+ return function(a, b) {
+ if (a[prop] > b[prop]) {
+ return 1;
+ } else if (a[prop] < b[prop]) {
+ return -1;
+ }
+ return 0;
+ }
+
+ };
+
+ $scope.getParentLabel = function(parentId, parentListSelectData){
+ var element;
+ element = parentListSelectData[0];
+ for (var i=0; i<parentListSelectData.length; i++){
+
+ element = parentListSelectData[i];
+ if (element[0] == parentId)
+ return element[1];
+ else "---";
+ }
+ };
+
+
+ $scope.getFunctionCDselectData = function(){
+ var uuu = "admin_fn_menu/get_function_cd_list"
+ $.ajax({
+ type : 'GET',
+ url : uuu,
+ dataType: 'json', // data type expected from server
+ contentType: 'application/json',
+ //data: JSON.stringify(postData), // data type sent to server
+ success : function(data){
+ $scope.$apply(function(){
+ //$scope.availableRoleFunctions=[];$scope.$apply();
+ $scope.functionCDselectData=data;
+ });
+ //alert("Update Successful.") ;
+ //$scope.editRoleFunction = null;
+ ///$modalInstance.close({functionCDselectData:$scope.functionCDselectData});
+ },
+ error : function(data){
+ alert("Function Code Data not available !");
+ }
+ });
+
+ };
+
+ if(message.availableFnMenuItem){
+ $scope.addFnMenuItem = message.availableFnMenuItem;
+ } else {
+ $scope.addFnMenuItem = {};
+ }
+ $scope.addFnMenuItem.menuSetCode = "APP";
+
+ $scope.statusOptions = [
+ {index: 0, value: 'true', title: 'Y'},
+ {index: 1, value: 'false', title: 'N'}
+ ];
+ $scope.selectedValue = $scope.statusOptions[0];
+
+ $scope.separator = {
+ availableOptions:[
+ {value: 'true', name: 'Y'},
+ {value: 'false', name: 'N'}
+ ],
+
+ selectedOption: {value: 'true', name: 'Y'}
+
+ };
+
+
+ $scope.activeStatusOptions = [
+ {index: 0, value: 'true', title: 'Y'},
+ {index: 1, value: 'false', title: 'N'}
+ ];
+ $scope.activeSelectedValue = $scope.activeStatusOptions[0];
+
+ $scope.separatorStatusOptions = [
+ {index: 0, value: 'true', title: 'Y'},
+ {index: 1, value: 'false', title: 'N'}
+ ];
+ $scope.separatorSelectedValue = $scope.separatorStatusOptions[1];
+
+ $scope.active = {
+ availableOptions:[
+ {value: 'true', name: 'Y'},
+ {value: 'false', name: 'N'}
+ ],
+
+ selectedOption: {value: 'true', name: 'Y'}
+
+ };
+
+
+ $scope.updateFnMenu = function(availableFnMenuItem) {
+ // form validation
+ if( document.getElementById("popupAddMenuItemImageSrc").value == "" ) availableFnMenuItem.imageSrc = "N/A";
+ if( document.getElementById("popupAddMenuItemTarget").value == "" ) availableFnMenuItem.target = "N/A";
+ if( document.getElementById("popupAddMenuItemExternalUrl").value == "" ) availableFnMenuItem.externalUrl = "N/A";
+ if( document.getElementById("popupAddMenuItemQueryString").value == "" ) availableFnMenuItem.queryString = "N/A";
+ if( document.getElementById("popupAddMenuItemServlet").value == "" ) availableFnMenuItem.servlet = "N/A";
+
+ validationRule = /^\S{3,}$/;
+ var selectedFunction = document.getElementById("repeatSelect");
+ var selectedFunctionText = selectedFunction.options[selectedFunction.selectedIndex].text;
+ if(
+ (document.getElementById("popupAddMenuItemLabel").value == "" || document.getElementById("popupAddMenuItemLabel").value.replace(" ", "").length == 0 ) ||//!validationRule.test(document.getElementById("popupAddMenuItemLabel").value)) ||
+ document.getElementById("popupAddMenuItemParentId").value == "" ||
+ document.getElementById("popupAddMenuItemAction").value == "" ||
+ selectedFunctionText == "" ||
+ document.getElementById("popupAddMenuItemSortOrder").value == "" ||
+ document.getElementById("popupAddMenuItemMenuSetCode").value == ""
+ )
+ {
+ alert("please provide valid entries !");
+ }
+
+ else{
+ var uuu = "admin_fn_menu/updateFnMenu.htm";
+ var postData={availableFnMenuItem: availableFnMenuItem};
+
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ //dataType: 'json', // data type expected from server
+ contentType: 'application/json',
+ data: JSON.stringify(postData), // data type sent to server
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.availableFnMenuItems=data.availableFnMenuItems;
+ });
+
+ $modalInstance.close({availableFnMenuItems:$scope.availableRoleFunctions});
+ },
+ error : function(data){
+ alert("Error while saving.");
+ }
+ });
+
+ }
+ $scope.getLeftMenuItems(); // get left menu items again from database
+
+ };
+
+ $scope.getLeftMenuItems = function() {
+ return $http.get('get_menu')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ var leftChildData=[];
+ var leftParentData=[];
+ var leftMenuItems = [];
+ var j = response;
+ try{
+ if(j && j !== "null" && j!== "undefined"){
+ leftParentData = JSON.parse(j.data);
+ leftChildData = JSON.parse(j.data2);
+ }else{
+ throw "Get Left Menu respsone is not an object/is empty";
+ }
+ try{
+ var leftChildItemList = leftChildData;
+ var pageUrl = window.location.href.split('/')[window.location.href.split('/').length-1];
+ var leftParentList = leftParentData;
+ for (var i = 0; i < leftParentList.length; i++) {
+ $scope.item = {
+ parentLabel : leftParentList[i].label,
+ parentAction : leftParentList[i].action,
+ parentImageSrc : leftParentList[i].imageSrc,
+ open:pageUrl==leftParentList[i].action?true:false,
+ childItemList : leftChildItemList[i]==null?'x':leftChildItemList[i]
+ }
+ leftMenuItems.push($scope.item);
+ };
+
+ $scope.leftMenuItems = leftMenuItems;
+
+ }catch(err){
+ console.log("error happened while trying to set left menu structure: "+err);
+ }
+ }catch (e) {
+ console.log("error happened while trying to get left menu items: "+e);
+ reloadPageOnce();
+ return;
+ }
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ };
+
+ $scope.close = function() {
+ $modalInstance.close();
+ };
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/jcs-admin-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/jcs-admin-controller.js
new file mode 100644
index 00000000..3891c5eb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/jcs-admin-controller.js
@@ -0,0 +1,83 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('cacheAdminController', function ($scope,$interval,$http,$modal,modalService,AdminService){
+
+ AdminService.getCacheRegions().then(function(data){
+
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.regions =$scope.data;
+ //$scope.resetMenu();
+
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+ $scope.clearAll = function() {
+ modalService.popupConfirmWin("Confirm",'You are about to clear all of the items for all cache regions. Do you want to continue?',
+ function(){
+ $http.get("jcs_admin/clearAll").success(function(response){$scope.regions=response;});
+
+ })
+ };
+
+ $scope.clearRegion = function(cacheName) {
+ modalService.popupConfirmWin("Confirm",'You are about to clear all of the items in the cache region "' + cacheName + '". Do you want to continue?',
+ function(){
+ $http.get("jcs_admin/clearRegion?cacheName="+cacheName).success(function(response){$scope.regions=response;});
+
+ })
+ };
+
+ $scope.clearItem = function(cacheName,key) {
+ modalService.popupConfirmWin("Confirm",'You are about to clear this item from the cache region "' + cacheName + '". Do you want to continue?',
+ function(){
+ $http.get("jcs_admin/clearItem?keyName="+key+"&cacheName="+cacheName).success(function(response){$scope.regions=response;});
+
+ })
+ };
+
+ $scope.showRegionDetails = function(cacheName) {
+ $http.get("jcs_admin/showRegionDetails?cacheName="+cacheName).success(function(response){modalService.showSuccess('',response);});
+ };
+
+ $scope.showItemDetails = function(cacheName,key) {
+ $http.get("jcs_admin/showItemDetails?keyName="+key+"&cacheName="+cacheName).success(function(response){
+ var message = "CacheName: "+ response.cacheName
+ +"\nkey: "+response.key
+ +"\nIS_SPOOL: "+response.attr.IS_SPOOL
+ +"\nIS_LATERAL: "+response.attr.IS_LATERAL
+ +"\nIS_REMOTE: "+response.attr.IS_REMOTE
+ +"\nIS_ETERNAL: "+response.attr.IS_ETERNAL
+ +"\nversion: "+response.attr.version
+ +"\nmaxLifeSeconds: "+response.attr.maxLifeSeconds
+ +"\nmaxIdleTimeSeconds: "+response.attr.maxIdleTimeSeconds
+ +"\nsize: "+response.attr.size
+ +"\ncreateTime: "+response.attr.createTime
+ +"\nlastAccessTime: "+response.attr.lastAccessTime
+ +"\nidleTime: "+response.attr.idleTime
+ +"\ntimeToLiveSeconds: "+response.attr.timeToLiveSeconds
+ +"\nisSpool: "+response.attr.isSpool
+ +"\nisLateral: "+response.attr.isLateral
+ +"\nisRemote: "+response.attr.isRemote
+ +"\nisEternal: "+response.attr.isEternal;
+ modalService.showSuccess('',message);});
+ };
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/modelpopupController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/modelpopupController.js
new file mode 100644
index 00000000..8d66d728
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/modelpopupController.js
@@ -0,0 +1,40 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+var modalpopupController = function ($scope, $modalInstance, message){
+
+ $scope.message = message;
+
+
+ $scope.hello = function () {
+ $modalInstance.close($scope.digitPattern);
+ };
+ $modalInstance.ok = function() {
+ //add the ok functionality
+ alert("Logout");
+ };
+ $modalInstance.cancel = function() {
+ //add the cancel functionality
+ alert("Keep Log in");
+ };
+ $modalInstance.cancelbutton = function() {
+ //add the cancel functionality
+ alert("Modal Waring popup close event");
+ };
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/post-search-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/post-search-controller.js
new file mode 100644
index 00000000..edb2cc53
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/post-search-controller.js
@@ -0,0 +1,202 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('postSearchCtrl', function ($scope,$http,ProfileService,modalService){
+
+ $scope.viewPerPage = 200;
+ $scope.currentPage = 1;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+
+ $scope.noResultsString = "";
+
+ ProfileService.getPostProfile().then(function(data){
+
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+
+ $scope.postSearchBean =JSON.parse($scope.data.postSearchBean);
+ $scope.profileList =JSON.parse($scope.data.profileList);
+ $scope.ngexistingUsers=JSON.parse($scope.data.existingUsers);
+ $scope.ocisortByList=JSON.parse($scope.data.sortByList);
+
+ //$scope.resetMenu();
+
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+ $scope.sortByList = [];
+ if($scope.ocisortByList)
+ $.each($scope.ocisortByList, function(i, a){
+ var sortBy = {"index":i, "value":a.value, "title":a.label};
+ $scope.sortByList.push(sortBy);
+ });
+ ;
+
+ $scope.search = function(postSearchBean) {
+ console.log(postSearchBean);
+ var uuu = "post_search/search";
+ var postData={postSearchBean:postSearchBean};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.profileList=data.users;
+ //$scope.postSearchBean={};
+ console.log($scope.profileList);
+ if($scope.profileList.length == 0)
+ $scope.noResultsString = "There is currently no one in WEBPHONE matching your search criteria.";
+ else
+ $scope.noResultsString = "";
+ });
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while searching: "+ data.responseText);
+ }
+ });
+
+ };
+
+ $scope.reset = function() {
+ $scope.postSearchBean={};
+ $scope.profileList=[];
+ $scope.noResultsString = "";
+ //console.log($scope.postSearchBean);
+ };
+
+ $scope.process = function() {
+ $scope.prepareProfileSelection();
+ var uuu = "post_search/process";
+ var postData={postSearchBean:$scope.postSearchBean};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.profileList=data.users;
+ //$scope.postSearchBean={};
+ $scope.ngexistingUsers=data.existingUsers;
+ $scope.postSearchBean.selected=null;
+ });
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while searching: "+ data.responseText);
+ }
+ });
+
+ };
+ $scope.importProfileList=[];
+ $scope.toggleSelection = function(profile) {
+ if(profile.selected)
+ $scope.importProfileList.push(profile);
+ else{
+ var index = $scope.importProfileList.indexOf(profile);
+ if(index>=0)
+ $scope.importProfileList.splice(index, 1);
+ }
+ };
+
+ $scope.prepareProfileSelection = function() {
+ if($scope.importProfileList)
+ $.each($scope.importProfileList, function(i, profile){
+ $scope.preparePostSearchBean(profile);
+ });
+ ;
+ }
+
+ $scope.preparePostSearchBean = function(profile) {
+ //console.log('Importing: '+profile.orgUserId);
+ //console.log('ngexistinguser:'+$scope.ngexistingUsers[profile.orgUserId])
+ if($scope.postSearchBean.selected==null){
+ $scope.postSearchBean.selected=[];
+ $scope.postSearchBean.postOrgUserId=[];
+ $scope.postSearchBean.postHrid=[];
+ $scope.postSearchBean.postFirstName=[];
+ $scope.postSearchBean.postLastName=[];
+ $scope.postSearchBean.postOrgCode=[];
+ $scope.postSearchBean.postPhone=[];
+ $scope.postSearchBean.postEmail=[];
+ $scope.postSearchBean.postAddress1=[];
+ $scope.postSearchBean.postAddress2=[];
+ $scope.postSearchBean.postCity=[];
+ $scope.postSearchBean.postState=[];
+ $scope.postSearchBean.postZipCode=[];
+ $scope.postSearchBean.postLocationClli=[];
+ $scope.postSearchBean.postBusinessCountryCode=[];
+ $scope.postSearchBean.postBusinessCountryName=[];
+ $scope.postSearchBean.postDepartment=[];
+ $scope.postSearchBean.postDepartmentName=[];
+ $scope.postSearchBean.postBusinessUnit=[];
+ $scope.postSearchBean.postBusinessUnitName=[];
+ $scope.postSearchBean.postJobTitle=[];
+ $scope.postSearchBean.postOrgManagerUserId=[];
+ $scope.postSearchBean.postCommandChain=[];
+ $scope.postSearchBean.postCompanyCode=[];
+ $scope.postSearchBean.postCompany=[];
+ $scope.postSearchBean.postCostCenter=[];
+ $scope.postSearchBean.postSiloStatus=[];
+ $scope.postSearchBean.postFinancialLocCode=[];
+ }
+
+ $scope.postSearchBean.selected.push(profile.orgUserId);
+ $scope.postSearchBean.postOrgUserId.push(profile.orgUserId);
+ $scope.postSearchBean.postHrid.push(profile.hrid);
+ $scope.postSearchBean.postFirstName.push(profile.firstName);
+ $scope.postSearchBean.postLastName.push(profile.lastName);
+ $scope.postSearchBean.postOrgCode.push(profile.orgCode);
+ $scope.postSearchBean.postPhone.push(profile.phone);
+ $scope.postSearchBean.postEmail.push(profile.email);
+ $scope.postSearchBean.postAddress1.push(profile.address1);
+ $scope.postSearchBean.postAddress2.push(profile.address2);
+ $scope.postSearchBean.postCity.push(profile.city);
+ $scope.postSearchBean.postState.push(profile.state);
+ if(profile.zipCodeSuffix==null)
+ $scope.postSearchBean.postZipCode.push(profile.zipCode);
+ else
+ $scope.postSearchBean.postZipCode.push(profile.zipCode+'-'+profile.zipCodeSuffix);
+ $scope.postSearchBean.postLocationClli.push(profile.locationClli);
+ $scope.postSearchBean.postBusinessCountryCode.push(profile.businessCountryCode);
+ $scope.postSearchBean.postBusinessCountryName.push(profile.businessCountryName);
+ $scope.postSearchBean.postDepartment.push(profile.department);
+ $scope.postSearchBean.postDepartmentName.push(profile.departmentName);
+ $scope.postSearchBean.postBusinessUnit.push(profile.businessUnit);
+ $scope.postSearchBean.postBusinessUnitName.push(profile.businessUnitName);
+ $scope.postSearchBean.postJobTitle.push(profile.jobTitle);
+ $scope.postSearchBean.postOrgManagerUserId.push(profile.orgManagerUserId);
+ $scope.postSearchBean.postCommandChain.push(profile.commandChain);
+ $scope.postSearchBean.postCompanyCode.push(profile.companyCode);
+ $scope.postSearchBean.postCompany.push(profile.company);
+ $scope.postSearchBean.postCostCenter.push(profile.costCenter);
+ $scope.postSearchBean.postSiloStatus.push(profile.siloStatus);
+ $scope.postSearchBean.postFinancialLocCode.push(profile.financialLocCode);
+ };
+
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-controller.js
new file mode 100644
index 00000000..aa0066b0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-controller.js
@@ -0,0 +1,286 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('profileController', function ($scope,$http,ProfileService,$routeParams,modalService){
+ $scope.tableData=[];
+ $scope.profile=[];
+ $scope.ociavailableRoles=[];
+ $scope.ociTimeZones;
+ $scope.ociCountries;
+ var stateList=[];
+ $scope.availableRoles = [];
+ $scope.timeZones = [];
+ $scope.selectedTimeZone = null;
+ $scope.countries = [];
+ $scope.selectedCountry = null;
+
+ ProfileService.getProfileDetail($routeParams.profileId).then(function(data){
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.profile =JSON.parse($scope.data.profile);
+ $scope.ociavailableRoles =JSON.parse($scope.data.availableRoles);
+ $scope.ociTimeZones=JSON.parse($scope.data.timeZones);
+ $scope.ociCountries=JSON.parse($scope.data.countries);
+ stateList=JSON.parse($scope.data.stateList);
+ $scope.orgUserId=$scope.profile.orgUserId;
+ $scope.orgManagerUserId=$scope.profile.orgManagerUserId;
+
+
+ if($scope.ociavailableRoles)
+ $.each($scope.ociavailableRoles, function(i, a){
+ var availableRole = a;
+ availableRole.selected = false;
+ $.each($scope.profile.roles, function(j, b){
+ if(a.id === b.id) {
+ availableRole.selected = true;
+ }
+ });
+ $scope.availableRoles.push(availableRole);
+ });
+ ;
+
+ /*$scope.ociTimeZones = ${model.timeZones};*/
+
+ if($scope.ociTimeZones){
+ $.each($scope.ociTimeZones, function(i, a){
+ var timeZone = {"index":i, "value":a.value, "title":a.label};
+ $scope.timeZones.push(timeZone);
+ if($scope.profile.timeZoneId !== null && a.value === $scope.profile.timeZoneId.toString()){
+ $scope.selectedTimeZone = timeZone;
+ }
+ });
+ };
+
+ /*$scope.ociCountries = ${model.countries};*/
+
+ //alert($scope.ociCountries[0].label);
+ if($scope.ociCountries)
+ $.each($scope.ociCountries, function(i, a){
+ var country = {"index":i, "value":a.value, "title":a.label};
+ $scope.countries.push(country);
+ if(a.value === $scope.profile.country){
+ $scope.selectedCountry = country;
+ }
+ });
+ ;
+
+ /*var stateList=${model.stateList};*/
+ //alert(stateList[0].label);
+ stateList = stateList== null? []: stateList;
+ var selectedState= $scope.profile.state ? $scope.profile.state:"";
+ $scope.stateList = initDropdownWithLookUp(stateList,selectedState );
+
+ //$scope.resetMenu();
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+ /*$scope.profile=${model.profile};*/
+ $scope.orgUserId=$scope.profile.orgUserId;
+ $scope.orgManagerUserId=$scope.profile.orgManagerUserId;
+
+ $scope.viewPerPage = 2;
+ $scope.currentPage = 1;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+
+ $( "#dialog" ).hide();
+
+ /*$scope.ociavailableRoles=${model.availableRoles};*/
+ //modalService.showFailure('Error','') ;
+
+
+ $scope.saveProfile = function() {
+ var uuu = "profile/saveProfile?profile_id=" + $routeParams.profileId;
+ var postData={profile: $scope.profile,
+ selectedCountry:$scope.selectedCountry!=null?$scope.selectedCountry.value:"",
+ selectedState:$scope.stateList.selected!=null?$scope.stateList.selected.value:"",
+ selectedTimeZone:$scope.selectedTimeZone!=null?$scope.selectedTimeZone.value:""
+ };
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ modalService.showSuccess("Success","Update Successful.");
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+ };
+
+ $scope.addNewRolePopup = function(role) {
+ $( "#dialog" ).dialog({
+ modal: true,
+ width: 500,
+ height:600
+ });
+ $(".ui-dialog").css("z-index",2001);
+ $(".ui-dialog-titlebar").hide();
+ };
+
+ $scope.toggleRole = function(selected,availableRole) {
+ $scope.profileTemp=$scope.profile;
+ $scope.profile={};
+ //alert('toggleRole: '+selected);
+ if(!selected) {
+ //remove role
+ var uuu = "profile/removeRole?profile_id=" + $routeParams.profileId;
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to remove the role "+availableRole.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?",
+ function(){
+ var postData={role:availableRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.profile=data;});
+ },
+ error : function(data){
+ $scope.$apply(function(){$scope.profile=$scope.profileTemp;});
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+ },
+ function(){
+ availableRole.selected=!availableRole.selected;
+ });
+
+
+ } else {
+ //add role
+ var uuu = "profile/addNewRole?profile_id=" + $routeParams.profileId;
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to add the role "+availableRole.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?",
+ function(){
+ var postData={role:availableRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.profile=data;});
+ },
+ error : function(data){
+ $scope.$apply(function(){$scope.profile=$scope.profileTemp;});
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ },function(){
+ availableRole.selected=!availableRole.selected;
+ })
+
+ }
+
+
+ };
+
+ $scope.removeRole = function(role) {
+
+
+ modalService.popupConfirmWin("Confirm","You are about to remove the role "+role.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?",
+ function(){
+ $scope.profileTemp=$scope.profile;
+ $scope.profile={};
+ var uuu = "profile/removeRole?profile_id=" + $routeParams.profileId;
+ var postData={role:role};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.profile=data;
+ $.each($scope.availableRoles, function(k, c){
+ if(c.id === role.id) {
+ c.selected = false;
+ }
+ });
+ });
+
+ },
+ error : function(data){
+ $scope.$apply(function(){$scope.profile=$scope.profileTemp;});
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ })
+
+
+ };
+
+ function initDropdownWithLookUp(arr,selectedValue){
+ var dropdownArray=[];
+ var selected = null;
+ if(arr){
+ for(var i = 0,l = arr.length; i < l; i++) {
+ var option = {
+ "index" : i ,
+ "value" : arr[i].value,
+ "title" : arr[i].label
+ };
+ dropdownArray.push(option);
+ if(arr[i].value === selectedValue){
+ selected = option;
+ }
+ }
+ }
+ var dropDown={};
+ dropDown.options = dropdownArray;
+ dropDown.selected = selected;
+ return dropDown;
+ };
+
+ $scope.doRolePopup = function() {
+ var modalInstance = $modal.open({
+ templateUrl: 'roles_popup.html',
+ controller: 'rolepopupController',
+ resolve: {
+ message: function () {
+ var message ={
+ availableRoles: $scope.availableRoles
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function (opts) {
+ if(opts!=null){
+ $scope.profile=opts.profile;
+ }
+ });
+ }
+
+ $scope.close = function(){
+ $('#dialog').dialog('close');
+ }
+
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-search-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-search-controller.js
new file mode 100644
index 00000000..6da82dcc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-search-controller.js
@@ -0,0 +1,80 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('profileSearchCtrl', function($scope, $http,ProfileService,modalService){
+
+ $scope.showInput = true;
+ $scope.totalPages1 = 5;
+ $scope.viewPerPage1 = 8;
+ $scope.currentPage1 = 1;
+
+ $scope.$watch('viewPerPage1', function(val) {
+ ProfileService.getProfilePagination($scope.currentPage1, val).then(function(data){
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.tableData =JSON.parse($scope.data.profileList);
+ $scope.totalPages1 =JSON.parse($scope.data.totalPage);
+ for(x in $scope.tableData){
+ if($scope.tableData[x].active_yn=='Y')
+ $scope.tableData[x].active_yn=true;
+ else
+ $scope.tableData[x].active_yn=false;
+ }
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+ });
+
+ $scope.customHandler = function(num) {
+ $scope.currentPage1 = num;
+ ProfileService.getProfilePagination($scope.currentPage1,$scope.viewPerPage1).then(function(data){
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.tableData =JSON.parse($scope.data.profileList);
+ $scope.totalPages1 =JSON.parse($scope.data.totalPage);
+ for(x in $scope.tableData){
+ if($scope.tableData[x].active_yn=='Y')
+ $scope.tableData[x].active_yn=true;
+ else
+ $scope.tableData[x].active_yn=false;
+ }
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+ };
+
+ $scope.editRow = function(profileId){
+ window.location = 'userProfile#/profile/' + profileId;
+ };
+
+ $scope.toggleProfileActive = function(rowData) {
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to change user's active status. Do you want to continue?",
+ function(){
+ $http.get("profile/toggleProfileActive?profile_id="+rowData.id).success(function(){});
+ },
+ function(){
+ rowData.active=!rowData.active;
+ })
+ };
+
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profileController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profileController.js
new file mode 100644
index 00000000..4b30e40e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profileController.js
@@ -0,0 +1,38 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.config(function($routeProvider) {
+ $routeProvider
+ .when('/profile/:profileId', {
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/profile_detail.html',
+ controller: 'profileController'
+ })
+ .when('/post_search', {
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/post_search.html',
+ controller: 'postSearchCtrl'
+ })
+ .when('/self_profile', {
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/self_profile.html',
+ controller: 'selfProfileController'
+ })
+ .otherwise({
+ templateUrl: 'app/fusion/scripts/view-models/profile-page/profile_search.html',
+ controller : "profileSearchCtrl"
+ });
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-controller.js
new file mode 100644
index 00000000..50913af8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-controller.js
@@ -0,0 +1,226 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('roleController', function ($scope, modalService, $modal, AdminService,$routeParams){
+ //$scope.role=${role};
+ //console.log($scope.role.roleFunctions);
+
+ $( "#dialogRoleFunction" ).hide();
+ $( "#dialogChildRole" ).hide();
+
+ //$scope.ociavailableRoleFunctions=${availableRoleFunctions};
+
+ AdminService.getRole($routeParams.roleId).then(function(data){
+
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+
+ $scope.role =JSON.parse($scope.data.role);
+ console.log($scope.role);
+
+ $scope.ociavailableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions);
+ console.log($scope.ociavailableRoleFunctions);
+ $scope.availableRoleFunctions=[];
+
+ if($scope.ociavailableRoleFunctions)
+ $.each($scope.ociavailableRoleFunctions, function(i, a){
+ var availableRoleFunction = a;
+ availableRoleFunction.selected = false;
+ $.each($scope.role.roleFunctions, function(j, b){
+ if(a.code === b.code) {
+ availableRoleFunction.selected = true;
+ }
+ });
+ $scope.availableRoleFunctions.push(availableRoleFunction);
+ });
+
+
+ $scope.ociavailableRoles=JSON.parse($scope.data.availableRoles);
+ console.log($scope.ociavailableRoles);
+ console.log("testing roles if exist");
+ $scope.availableRoles=[];
+
+ if($scope.ociavailableRoles)
+ $.each($scope.ociavailableRoles, function(i, a){
+ var availableRole = a;
+ availableRole.selected = false;
+ if($scope.role.childRoles){
+ $.each($scope.role.childRoles, function(j, b){
+ if(a.id === b.id) {
+ availableRole.selected = true;
+ }
+ });
+ };
+ $scope.availableRoles.push(availableRole);
+ });
+
+
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+ $scope.saveRole = function() {
+ var exists = false;
+ for(x in $scope.availableRoles){
+ console.log($scope.availableRoles[x].name);
+ if($scope.availableRoles[x].name==$scope.role.name){
+ modalService.showFailure("Warning", "Role already exists.");
+ exists = true;
+ //$modalInstance.close({availableRoleFunctions:message.availableRoleFunctions});
+ }
+ }
+ if(!exists){
+ var uuu = "role/saveRole.htm?role_id="+$routeParams.roleId;
+ var postData={role: $scope.role, childRoles: $scope.role.childRoles, roleFunctions : $scope.role.roleFunctions};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ modalService.showSuccess("Success","Update Successful.");
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+ }
+
+ };
+
+ $scope.addNewRoleFunctionModalPopup = function() {
+ var modalInstance = $modal.open({
+ templateUrl: 'role_functions_popup.html',
+ controller: 'rolepopupController',
+ backdrop: 'static',
+ resolve: {
+ roleId: function () {
+ return $routeParams.roleId;
+ },
+ role: function () {
+ return $scope.role;
+ },
+ availableRoles: function () {
+ return $scope.ociavailableRoles;
+ },
+ availableRoleFunctions: function () {
+ return $scope.ociavailableRoleFunctions;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ console.log('response', response);
+ $scope.role=response.role;
+ });
+ };
+
+ $scope.addNewChildRoleModalPopup = function() {
+ var modalInstance = $modal.open({
+ templateUrl: 'child_roles_popup.html',
+ controller: 'rolepopupController',
+ backdrop: 'static',
+ resolve: {
+ roleId: function () {
+ return $routeParams.roleId;
+ },
+ role: function () {
+ return $scope.role;
+ },
+ availableRoles: function () {
+ return $scope.ociavailableRoles;
+ },
+ availableRoleFunctions: function () {
+ return $scope.ociavailableRoleFunctions;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ console.log('response', response);
+ $scope.role=response.role;
+ });
+ };
+
+
+
+ $scope.removeRoleFunction = function(roleFunction) {
+ modalService.popupConfirmWin("Confirm","You are about to remove the role function "+roleFunction.name+" from the role for "+$scope.role.name+". Do you want to continue?",
+ function(){
+ var uuu = "role/removeRoleFunction.htm?role_id=" + $routeParams.roleId;
+ var postData={roleFunction:roleFunction};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.role=data.role;
+ $.each($scope.availableRoleFunctions, function(k, c){
+ if(c.code === roleFunction.code) {
+ c.selected = false;
+ }
+ });
+ });
+
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ })
+
+ };
+
+ $scope.removeChildRole = function(childRole) {
+ modalService.popupConfirmWin("Confirm","You are about to remove the child role "+childRole.name+" from the role for "+$scope.role.name+". Do you want to continue?",
+ function(){
+ var uuu = "role/removeChildRole.htm?role_id=" + $routeParams.roleId;
+ var postData={childRole:childRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.role=data.role;
+ $.each($scope.availableRoles, function(k, c){
+ if(c.id === childRole.id) {
+ c.selected = false;
+ }
+ });
+ });
+
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ })
+
+ };
+
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-function-list-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-function-list-controller.js
new file mode 100644
index 00000000..eedac3e0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-function-list-controller.js
@@ -0,0 +1,157 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('roleFunctionListController', function ($scope, AdminService, modalService, $modal){
+ $( "#dialog" ).hide();
+
+ AdminService.getRoleFunctionList().then(function(data){
+
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.availableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions);
+
+ //$scope.resetMenu();
+
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+ $scope.editRoleFunction = null;
+ var dialog = null;
+ $scope.editRoleFunctionPopup = function(availableRoleFunction) {
+ $scope.editRoleFunction = availableRoleFunction;
+ $( "#dialog" ).dialog({
+ modal: true
+ });
+ };
+
+ $scope.editRoleFunctionModalPopup = function(availableRoleFunction) {
+ $scope.editRoleFunction = availableRoleFunction;
+ $scope.availableRoleFunctionsTemp=$scope.availableRoleFunctions;
+ $scope.availableRoleFunctions={};
+ var modalInstance = $modal.open({
+ templateUrl: 'edit_role_function_popup.html',
+ controller: 'rolefunctionpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ availableRoleFunction: $scope.editRoleFunction,
+ availableRoleFunctions: $scope.availableRoleFunctionsTemp
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ console.log('response', response);
+ if(response!=null)
+ $scope.availableRoleFunctions=response.availableRoleFunctions;
+ else
+ $scope.availableRoleFunctions=$scope.availableRoleFunctionsTemp;
+ });
+ };
+
+ $scope.addNewRoleFunctionModalPopup = function(availableRoleFunction) {
+ $scope.editRoleFunction = null;
+ $scope.availableRoleFunctionsTemp=$scope.availableRoleFunctions;
+ $scope.availableRoleFunctions={};
+ var modalInstance = $modal.open({
+ templateUrl: 'edit_role_function_popup.html',
+ controller: 'rolefunctionpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ availableRoleFunction: $scope.editRoleFunction,
+ availableRoleFunctions: $scope.availableRoleFunctionsTemp
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ console.log('response', response);
+ if(response!=null)
+ $scope.availableRoleFunctions=response.availableRoleFunctions;
+ else
+ $scope.availableRoleFunctions=$scope.availableRoleFunctionsTemp;
+ });
+ };
+
+ $scope.addNewRoleFunctionPopup = function() {
+ $scope.editRoleFunction = null;
+ $( "#dialog" ).dialog({
+ modal: true
+ });
+ };
+
+ $scope.saveRoleFunction = function(availableRoleFunction) {
+ var uuu = "role_function_list/saveRoleFunction.htm";
+ var postData={availableRoleFunction: availableRoleFunction};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.availableRoleFunctions=[];$scope.$apply();
+ $scope.availableRoleFunctions=data.availableRoleFunctions;});
+ //alert("Update Successful.") ;
+ console.log($scope.availableRoleFunctions);
+
+ $scope.editRoleFunction = null;
+ $( "#dialog" ).dialog("close");
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+ };
+
+
+ $scope.removeRole = function(availableRoleFunction) {
+ modalService.popupConfirmWin("Confirm","You are about to delete the role function "+availableRoleFunction.name+". Do you want to continue?",
+ function(){
+ $scope.availableRoleFunctionsTemp=$scope.availableRoleFunctions;
+ $scope.availableRoleFunctions={};
+ var uuu = "role_function_list/removeRoleFunction.htm";
+ var postData={availableRoleFunction: availableRoleFunction};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.availableRoleFunctions=data.availableRoleFunctions;});
+ },
+ error : function(data){
+ console.log(data);
+ $scope.$apply(function(){$scope.availableRoleFunctions=$scope.availableRoleFunctionsTemp;});
+ modalService.showFailure("Fail","Error while deleting: "+ data.responseText);
+ }
+ });
+
+ })
+
+ };
+
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-list-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-list-controller.js
new file mode 100644
index 00000000..a16d61ef
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-list-controller.js
@@ -0,0 +1,102 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('roleListController', function ($scope,AdminService,modalService){
+
+ AdminService.getRoles().then(function(data){
+
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.availableRoles =JSON.parse($scope.data.availableRoles);
+
+ //$scope.resetMenu();
+
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+ //console.log($scope.availableRoles);
+ $scope.toggleRole = function(selected,availableRole) {
+ //alert('toggleRole: '+selected);
+ var toggleType = null;
+ if(selected) {
+ toggleType = "activate";
+ } else {
+ toggleType = "inactivate";
+ }
+
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to "+toggleType+" the test role "+availableRole.name+". Do you want to continue?",
+ function(){
+ var uuu = "role_list/toggleRole";
+
+ var postData={role:availableRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ console.log(data);
+ $scope.$apply(function(){$scope.availableRoles=data.availableRoles;});
+ console.log($scope.availableRoles);
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ },
+ function(){
+ availableRole.active=!availableRole.active;
+ })
+
+
+ };
+
+ $scope.removeRole = function(role) {
+
+ modalService.popupConfirmWin("Confirm","You are about to delete the role "+role.name+". Do you want to continue?",
+ function(){
+ var uuu = "role_list/removeRole";
+ var postData={role:role};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.availableRoles=data.availableRoles;});
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while deleting: "+ data.responseText);
+ }
+ });
+
+ })
+
+
+ };
+
+
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolefunctionpopupController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolefunctionpopupController.js
new file mode 100644
index 00000000..14aea22c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolefunctionpopupController.js
@@ -0,0 +1,84 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+var rolefunctionpopupController = function ($scope, modalService, $modalInstance, message, $http,AdminService){
+ if(message.availableRoleFunction==null) {
+ $scope.label='Add Role Function';
+ var tempText = "";
+ }
+ else{
+ $scope.label='Edit Role Function'
+ $scope.disableCd=true;
+ var tempText = new String(message.availableRoleFunction.name);
+ $scope.editRoleFunction = message.availableRoleFunction;
+ }
+
+ $scope.tempText = tempText;
+
+ $scope.saveRoleFunction = function(availableRoleFunction) {
+ var uuu = "role_function_list/saveRoleFunction.htm";
+ var postData={availableRoleFunction: availableRoleFunction};
+
+ if(availableRoleFunction==null){
+ modalService.showFailure("Warning", "Please enter valid role function details.");
+ }
+ var exists = false;
+ for(x in message.availableRoleFunctions){
+ console.log(message.availableRoleFunctions[x].name);
+ if(message.availableRoleFunctions[x].name==availableRoleFunction.name){
+ modalService.showFailure("Warning", "Role Function already exists.");
+ exists = true;
+ availableRoleFunction.name = $scope.tempText;
+ }
+ }
+
+ if(!exists && availableRoleFunction.name.trim() != '' && availableRoleFunction.code.trim() != ''){
+ $http.post(uuu, JSON.stringify(postData)).then(function(res){
+ console.log("data");
+// console.log(res.data);
+// $scope.availableRoleFunctionsTemp = res.data.availableRoleFunctions;
+ AdminService.getRoleFunctionList().then(function(data){
+
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.availableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions);
+
+ //$scope.resetMenu();
+ $modalInstance.close();
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ $modalInstance.close();
+ });
+
+
+ });
+
+
+
+
+ }
+ };
+
+
+
+ $scope.close = function() {
+ $modalInstance.close();
+ };
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolepopupmodelController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolepopupmodelController.js
new file mode 100644
index 00000000..f8ecfadd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolepopupmodelController.js
@@ -0,0 +1,205 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+var rolepopupController = function ($scope, $modalInstance, role, roleId, availableRoles, availableRoleFunctions,AdminService,modalService){
+
+ $scope.role = role;
+ console.log($scope.role);
+ if($scope.role.childRoles==null){
+ $scope.role.childRoles=[];
+ }
+
+ $scope.ociavailableRoles=availableRoles;
+ console.log($scope.ociavailableRoles);
+
+ $scope.availableRoles=[];
+ if($scope.ociavailableRoles)
+ $.each($scope.ociavailableRoles, function(i, a){
+ var availableRole = a;
+ availableRole.selected = false;
+ if($scope.role.childRoles){
+ $.each($scope.role.childRoles, function(j, b){
+ if(a.id === b.id) {
+ availableRole.selected = true;
+ }
+ });
+ };
+ $scope.availableRoles.push(availableRole);
+ });
+
+ $scope.ociavailableRoleFunctions = availableRoleFunctions;
+ console.log($scope.ociavailableRoleFunctions);
+ $scope.availableRoleFunctions = [];
+ if($scope.ociavailableRoleFunctions)
+ $.each($scope.ociavailableRoleFunctions, function(i, a){
+ var availableRoleFunction = a;
+ availableRoleFunction.selected = false;
+ $.each($scope.role.roleFunctions, function(j, b){
+ if(a.code === b.code) {
+ availableRoleFunction.selected = true;
+ }
+ });
+ $scope.availableRoleFunctions.push(availableRoleFunction);
+ });
+ //$scope.resetMenu();
+
+ $scope.toggleRoleFunction = function(selected,availableRoleFunction) {
+ //alert('toggleRole: '+selected);
+
+ if(!selected) {
+ //remove role function
+ if(role.id==null){
+ var index = $scope.role.roleFunctions.indexOf(availableRoleFunction);
+ if(index>=0)
+ $scope.role.roleFunctions.splice(index, 1);
+ return;
+ }
+ var uuu = "role/removeRoleFunction.htm?role_id=" + roleId;
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to remove the role function "+availableRoleFunction.name+" from the role for "+$scope.role.name+". Do you want to continue?",
+ function(){
+ var postData={roleFunction:availableRoleFunction};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.role=data.role;});
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ },
+ function(){
+ availableRoleFunction.selected=!availableRoleFunction.selected;
+ })
+
+ } else {
+ //add role function
+ if(role.id==null){
+ $scope.role.roleFunctions.push(availableRoleFunction);
+ return;
+ }
+ var uuu = "role/addRoleFunction.htm?role_id=" + roleId;
+
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to add the role function "+availableRoleFunction.name+" to the role for "+$scope.role.name+". Do you want to continue?",
+ function(){
+ var postData={roleFunction:availableRoleFunction};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.role=data.role;});
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ },
+ function(){
+ availableRoleFunction.selected=!availableRoleFunction.selected;
+ })
+ }
+
+
+ };
+
+ $scope.toggleChildRole = function(selected,availableRole) {
+ //alert('toggleRole: '+selected);
+
+ if(!selected) {
+ //remove role
+ if(role.id==null){
+ var index = $scope.role.childRoles.indexOf(availableRole);
+ if(index>=0)
+ $scope.role.childRoles.splice(index, 1);
+ return;
+ }
+ var uuu = "role/removeChildRole.htm?role_id=" + roleId;
+
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to remove the child role "+availableRole.name+" from the role for "+$scope.role.name+". Do you want to continue?",
+ function(){
+ var postData={childRole:availableRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ console.log('role',data.role);
+ $scope.$apply(function(){$scope.role=data.role;});
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ },
+ function(){
+ availableRole.selected=true;
+ })
+
+ } else {
+ //add role
+ if(role.id==null){
+ $scope.role.childRoles.push(availableRole);
+ return;
+ }
+ var uuu = "role/addChildRole.htm?role_id=" + roleId;
+
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to add the child role "+availableRole.name+" to the role for "+$scope.role.name+". Do you want to continue?",
+ function(){
+ var postData={childRole:availableRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.role=data.role;});
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ },
+ function(){
+ availableRole.selected=false;
+ })
+ }
+
+
+ };
+
+ $scope.close = function() {
+ console.log('role', $scope.role);
+ $modalInstance.close({role:$scope.role});
+ };
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/self-profile-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/self-profile-controller.js
new file mode 100644
index 00000000..b82dae30
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/self-profile-controller.js
@@ -0,0 +1,284 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('selfProfileController', function ($scope,$http,ProfileService,$routeParams,modalService){
+ $scope.tableData=[];
+ $scope.profile=[];
+ $scope.ociavailableRoles=[];
+ $scope.ociTimeZones;
+ $scope.ociCountries;
+ var stateList=[];
+ $scope.availableRoles = [];
+ $scope.timeZones = [];
+ $scope.selectedTimeZone = null;
+ $scope.countries = [];
+ $scope.selectedCountry = null;
+ $scope.isUserSystemAdmin = false;
+
+ ProfileService.getSelfProfileDetail().then(function(data){
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.profile =JSON.parse($scope.data.profile);
+ $scope.profileId = $scope.profile.id;
+ $scope.ociavailableRoles =JSON.parse($scope.data.availableRoles);
+ $scope.ociTimeZones=JSON.parse($scope.data.timeZones);
+ $scope.ociCountries=JSON.parse($scope.data.countries);
+ stateList=JSON.parse($scope.data.stateList);
+ $scope.orgUserId=$scope.profile.orgUserId;
+ $scope.orgManagerUserId=$scope.profile.orgManagerUserId;
+
+ if($scope.ociavailableRoles)
+ $.each($scope.ociavailableRoles, function(i, a){
+ var availableRole = a;
+ availableRole.selected = false;
+ $.each($scope.profile.roles, function(j, b){
+ if(a.id === b.id) {
+ availableRole.selected = true;
+ if(a.id === 1){
+ $scope.isUserSystemAdmin = true;
+ }
+ }
+ });
+ $scope.availableRoles.push(availableRole);
+ });
+ ;
+
+ /*$scope.ociTimeZones = ${model.timeZones};*/
+
+ if($scope.ociTimeZones){
+ $.each($scope.ociTimeZones, function(i, a){
+ var timeZone = {"index":i, "value":a.value, "title":a.label};
+ $scope.timeZones.push(timeZone);
+ if($scope.profile.timeZoneId !== null && a.value === $scope.profile.timeZoneId.toString()){
+ $scope.selectedTimeZone = timeZone;
+ }
+ });
+ };
+
+ /*$scope.ociCountries = ${model.countries};*/
+
+ //alert($scope.ociCountries[0].label);
+ if($scope.ociCountries)
+ $.each($scope.ociCountries, function(i, a){
+ var country = {"index":i, "value":a.value, "title":a.label};
+ $scope.countries.push(country);
+ if(a.value === $scope.profile.country){
+ $scope.selectedCountry = country;
+ }
+ });
+ ;
+
+ /*var stateList=${model.stateList};*/
+ //alert(stateList[0].label);
+ stateList = stateList== null? []: stateList;
+ var selectedState= $scope.profile.state ? $scope.profile.state:"";
+ $scope.stateList = initDropdownWithLookUp(stateList,selectedState );
+
+ //$scope.resetMenu();
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+ /*$scope.profile=${model.profile};*/
+ $scope.orgUserId=$scope.profile.orgUserId;
+ $scope.orgManagerUserId=$scope.profile.orgManagerUserId;
+
+ $scope.viewPerPage = 2;
+ $scope.currentPage = 1;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+
+ $( "#dialog" ).hide();
+
+ /*$scope.ociavailableRoles=${model.availableRoles};*/
+ //modalService.showFailure('Error','') ;
+
+
+ $scope.saveProfile = function() {
+ var uuu = "profile/saveProfile?profile_id=" + $scope.profileId;;
+ var postData={profile: $scope.profile,
+ selectedCountry:$scope.selectedCountry!=null?$scope.selectedCountry.value:"",
+ selectedState:$scope.stateList.selected!=null?$scope.stateList.selected.value:"",
+ selectedTimeZone:$scope.selectedTimeZone!=null?$scope.selectedTimeZone.value:""
+ };
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ modalService.showSuccess("Success","Update Successful.");
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+ };
+
+ $scope.addNewRolePopup = function(role) {
+ $( "#dialog" ).dialog({
+ modal: true,
+ width: 500,
+ height:600
+ });
+
+ $(".ui-dialog").css("z-index",10002);
+ $(".ui-dialog-titlebar").hide();
+ };
+
+ $scope.toggleRole = function(selected,availableRole) {
+ //alert('toggleRole: '+selected);
+ if(!selected) {
+ //remove role
+ var uuu = "profile/removeRole?profile_id=" + $scope.profileId;;
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to remove the role "+availableRole.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?",
+ function(){
+ var postData={role:availableRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.profile=data;});
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+ },
+ function(){
+ availableRole.selected=!availableRole.selected;
+ });
+
+
+ } else {
+ //add role
+ var uuu = "profile/addNewRole?profile_id=" + $scope.profileId;;
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to add the role "+availableRole.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?",
+ function(){
+ var postData={role:availableRole};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.profile=data;});
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ },function(){
+ availableRole.selected=!availableRole.selected;
+ })
+
+ }
+
+
+ };
+
+ $scope.removeRole = function(role) {
+
+
+ modalService.popupConfirmWin("Confirm","You are about to remove the role "+role.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?",
+ function(){
+ var uuu = "profile/removeRole?profile_id=" + $scope.profileId;;
+ var postData={role:role};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.profile=data;
+ $.each($scope.availableRoles, function(k, c){
+ if(c.id === role.id) {
+ c.selected = false;
+ }
+ });
+ });
+
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+
+ })
+
+
+ };
+
+ function initDropdownWithLookUp(arr,selectedValue){
+ var dropdownArray=[];
+ var selected = null;
+ if(arr){
+ for(var i = 0,l = arr.length; i < l; i++) {
+ var option = {
+ "index" : i ,
+ "value" : arr[i].value,
+ "title" : arr[i].label
+ };
+ dropdownArray.push(option);
+ if(arr[i].value === selectedValue){
+ selected = option;
+ }
+ }
+ }
+ var dropDown={};
+ dropDown.options = dropdownArray;
+ dropDown.selected = selected;
+ return dropDown;
+ };
+
+ $scope.doRolePopup = function() {
+ var modalInstance = $modal.open({
+ templateUrl: 'roles_popup.html',
+ controller: 'rolepopupController',
+ resolve: {
+ message: function () {
+ var message ={
+ availableRoles: $scope.availableRoles
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function (opts) {
+ if(opts!=null){
+ $scope.profile=opts.profile;
+ }
+ });
+ }
+
+ $scope.close = function(){
+ $('#dialog').dialog('close');
+ }
+
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/usage-list-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/usage-list-controller.js
new file mode 100644
index 00000000..b495b934
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/usage-list-controller.js
@@ -0,0 +1,41 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('usageListController', function ($scope,$interval,$http,$modal,modalService,AdminService){
+
+ AdminService.getUsageList().then(function(data){
+
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.users =$scope.data;
+ //$scope.resetMenu();
+
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+ $scope.removeSession = function(sessionId) {
+ modalService.popupConfirmWin("Confirm","You are about to expel this user from the application. All of their unsaved data will be lost. Do you want to continue?",
+ function(){
+ $http.get("usage_list/removeSession?deleteSessionId="+sessionId).success(function(response){$scope.users=response;});
+ })
+
+ }
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowApp.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowApp.js
new file mode 100644
index 00000000..0a5c8019
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowApp.js
@@ -0,0 +1,24 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+angular.module('att.abs.helper', []);
+angular.module('quantum', []);
+
+var app=angular.module("workflowApp", ["att.abs", "att.abs.helper","modalServices",
+ "att.gridster","checklist-model","ngRoute", "ui.bootstrap"]);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowController.js
new file mode 100644
index 00000000..169a8868
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowController.js
@@ -0,0 +1,509 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('workflowsController', function($scope, $http, $uibModal, $log, modalService, $modal) {
+
+ $scope.viewPerPage = 5;
+ $scope.scrollViewsPerPage = 20;
+ $scope.currentPage = 2;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+ $scope.radio = {
+ value: ""
+ };
+
+
+ $scope.showModal = false;
+ $scope.toggleModal = function(){
+ $scope.showModal = !$scope.showModal;
+ };
+
+ $scope.workflow = {};
+ $scope.workflow.active = "true";
+
+ $scope.updateAllWorkflowStatus = function() {
+ angular.forEach($scope.workflows,function(value){
+ $scope.checkWorkflowStatus(value);
+ })
+ }
+
+ $scope.fetchWorkflowsList = function() {
+ $http.get('workflows/list').then(function(workflowList){
+ console.log('Got new list from server = ' + workflowList.data);
+ $scope.workflows = workflowList.data;
+ $scope.updateAllWorkflowStatus();
+ });
+ };
+
+ $scope.addNewWorkflow = function(newWorkflow) {
+ $http.post('workflows/addWorkflow/', JSON.stringify(newWorkflow)).success(function() {
+ $scope.fetchWorkflowsList();
+ });
+
+ $scope.workflow.name = '';
+
+ };
+
+ $scope.updateWorkflow = function (workflowToEdit) {
+ //workflowToEdit.active='true';
+ var modalInstance = $uibModal.open({
+ animation: $scope.animationsEnabled,
+ templateUrl: 'app/fusion/scripts/view-models/workflows/workflow-new.html',
+ //size : modalSize,
+ controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) {
+ $scope.workflow = workflowToEdit;
+ $scope.ok = function() {
+ console.log('Updating existing workflow ... ' + JSON.stringify($scope.workflow));
+ $http.post('workflows/editWorkflow/', JSON.stringify($scope.workflow)).then(function(returnedWorkflow){
+ console.log('Returned Workflow = ' + JSON.stringify(returnedWorkflow));
+ $uibModalInstance.close($scope.workflow);
+ });
+ };
+
+ $scope.cancel = function() {
+ $uibModalInstance.dismiss();
+ };
+ }],
+ //End of inner controller
+ resolve: {
+ workflow: function() {
+ console.log('Passing ' + JSON.stringify($scope.workflow));
+ return $scope.workflow;
+ }
+ }
+ });
+
+ modalInstance.result.then(function (editedWorkFlow) {
+ //Need to convert to proper date - later
+ delete editedWorkFlow.created;
+ delete editedWorkFlow.updated;
+
+ delete editedWorkFlow.createdBy;
+ delete editedWorkFlow.modifiedBy;
+
+ console.log('selected Item ' + JSON.stringify(editedWorkFlow));
+ $scope.$emit('workflowAdded', editedWorkFlow);
+
+ }, function () {
+ $log.info('Modal dismissed at: ' + new Date());
+ });
+ };
+
+ $scope.reset = function(){
+ console.log("Resetting ....");
+ };
+
+ $scope.update = function(){
+ console.log("updating ....");
+ };
+
+ $scope.createWorkflow = function (modalSize) {
+
+ var modalInstance = $uibModal.open({
+ animation: $scope.animationsEnabled,
+ templateUrl: 'app/fusion/scripts/view-models/workflows/workflow-new.html',
+ size : modalSize,
+ controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) {
+ $scope.workflow = {};
+ $scope.workflow.active = 'true';
+ $scope.ok = function() {
+ console.log('Saving new workflow ... ' + JSON.stringify($scope.workflow));
+ $http.post('workflows/addWorkflow/', JSON.stringify($scope.workflow)).then(function(returnedWorkflow){
+ console.log('Returned Workflow = ' + JSON.stringify(returnedWorkflow));
+ $uibModalInstance.close($scope.workflow);
+ });
+ };
+/* console.log(size);*/
+ $scope.cancel = function() {
+ $uibModalInstance.dismiss();
+ };
+ }],
+ //End of inner controller
+ resolve: {
+ workflow: function() {
+ console.log('Passing ' + JSON.stringify($scope.workflow));
+ return $scope.workflow;
+ }
+ }
+ });
+
+ modalInstance.result.then(function (newWorkflow) {
+ console.log('selected Item ' + JSON.stringify(newWorkflow));
+ $scope.$emit('workflowAdded', newWorkflow);
+
+ }, function () {
+ $log.info('Modal dismissed at: ' + new Date());
+ });
+ };//End of createWorkflow function
+
+
+ $scope.removeWorkflow = function(workflowToRemove){
+ var modalInstance = $uibModal.open({
+ animation: $scope.animationsEnabled,
+ templateUrl: 'app/fusion/scripts/view-models/workflows/workflow-remove.html',
+ controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) {
+ $scope.workflowToRemove = workflowToRemove;
+ $scope.ok = function() {
+ console.log('Removing workflow ... ' + JSON.stringify($scope.workflowToRemove) + ' on client request.');
+ $http.post('workflows/removeWorkflow/', JSON.stringify($scope.workflowToRemove.id)).then(function(){
+ console.log('Workflow successfully removed !!!');
+ $uibModalInstance.close();
+ });
+ };
+
+ $scope.cancel = function() {
+ $uibModalInstance.dismiss();
+ };
+ }]
+ });
+
+ modalInstance.result.then(function () {
+ $scope.$emit('workflowRemoved');
+ }, function () {
+ $log.info('Modal dismissed at: ' + new Date());
+ });
+
+ };
+
+
+
+ $scope.scheduleWorkflow = function(workflowToSchedule){
+ var modalInstance = $uibModal.open({
+ animation: $scope.animationsEnabled,
+ templateUrl: 'app/fusion/scripts/view-models/workflows/workflow-schedule.html',
+ size:'lg',
+
+ controller: ['$scope', '$uibModalInstance', '$http','dateFilter', function ($scope, $uibModalInstance, $http,dateFilter) {
+
+ $scope.workflowToSchedule = workflowToSchedule;
+ $scope.dt = new Date();
+ $scope.dt2 = new Date();
+ $scope.dateformat = 'MM/dd/yyyy',
+ $scope.datetimeformat = "hh:mm a";
+
+ $scope.recurrenceOptions =[{
+ index:0, value:'One-Time', title:'One-Time'
+ },{
+ index:1, value: 'Hourly',title:'Hourly'
+ },{
+ index:2, value: 'Daily',title:'Daily'
+ },{
+ index:3, value: 'Weekly',title:'Weekly'
+ }]
+ $scope.selectRecurrenceOpt = $scope.recurrenceOptions[0];
+
+ $scope.hours = [];
+ for (var i=0; i<24; i++){
+ var newObj={}
+ newObj.index = i;
+ newObj.value = ""+i;
+ newObj.title = ""+i;
+ $scope.hours.push(newObj);
+ }
+
+ $scope.minutes = [];
+ for (var i=0; i<60; i++){
+ var newObj={}
+ newObj.index = i;
+ newObj.value = ""+i;
+ newObj.title = ""+i;
+ $scope.minutes.push(newObj);
+ }
+
+ $scope.AMPMOptions =[
+ {
+ index:0, value:'AM', title:'AM'
+ },{
+ index:1, value: 'PM',title:'PM'
+ }]
+
+ $scope.selectFirstHour =$scope.hours[0];
+ $scope.selectFirstMinute =$scope.minutes[0];
+
+ $scope.selectLastHour =$scope.hours[0];
+ $scope.selectLastMinute =$scope.minutes[0];
+
+ $scope.selectStartAMPMOption=$scope.AMPMOptions[0];
+ $scope.selectLastAMPMOption=$scope.AMPMOptions[0];
+
+ var GenerateCronExpression = function(trigger_dt, RecurrenceOpt) {
+ var CRON_sec = trigger_dt.getSeconds();
+ var CRON_min = trigger_dt.getMinutes();
+ var CRON_hr = trigger_dt.getHours();
+ var CRON_date= trigger_dt.getDate();
+ var CRON_month = trigger_dt.toLocaleString('en-US', {month: 'short'}).toUpperCase();
+ var CRON_day = trigger_dt.toLocaleString('en-US', {weekday: 'short'}).toUpperCase();
+ var CRON_year = trigger_dt.getFullYear();
+ if (RecurrenceOpt ==="One-Time") {
+ CRON_day = '?'
+ } else {
+ if (RecurrenceOpt ==="Hourly") {
+ CRON_hr = '*';
+ CRON_date = '*'
+ CRON_month = '*'
+ CRON_day = '?'
+ CRON_year = '*'
+ } else if (RecurrenceOpt ==="Daily") {
+ CRON_date = '*'
+ CRON_month = '*'
+ CRON_day = '?'
+ CRON_year = '*'
+ } else if (RecurrenceOpt ==="Weekly") {
+ CRON_date = '*'
+ CRON_month = '*'
+ CRON_year = '*'
+ }
+ }
+
+ var CRON_Expression = [CRON_sec, CRON_min, CRON_hr, CRON_date, CRON_month, CRON_day, CRON_year];
+ return CRON_Expression.join(" ");
+ }
+
+ $scope.ok = function() {
+
+ // DateTime for the start time: it should be noted that the start time
+ // for a CRON job should be prior to the trigger time.
+ $scope.trigger_dt = new Date( $scope.dt.getFullYear() +
+ "-" + ("0"+($scope.dt.getMonth()+1)).slice(-2) +
+ "-" +("0"+ $scope.dt.getDate()).slice(-2) +
+ " " + ("0" + $scope.selectFirstHour.value).slice(-2) +
+ ":" +("0" + $scope.selectFirstMinute.value).slice(-2) +
+ ":00.0");
+
+ $scope.startDateTime_CRON = GenerateCronExpression($scope.trigger_dt, $scope.selectRecurrenceOpt.value)
+
+ //roll back the the start date time by 30 seconds (start time should be 30 seconds prior to trigger time)
+ dt_st = new Date($scope.trigger_dt - 30*1000)
+
+ startDateTime = dt_st.getFullYear() +
+ "-" + ("0"+(dt_st.getMonth()+1)).slice(-2) +
+ "-" +("0"+ dt_st.getDate()).slice(-2) +
+ " " + ("0" + dt_st.getHours()).slice(-2) +
+ ":" +("0" + dt_st.getMinutes()).slice(-2) +
+ ":" + ("0" + dt_st.getSeconds()).slice(-2) +".0";
+ $scope.startDateTime = startDateTime;
+
+ $scope.endDateTime = $scope.dt2.getFullYear() +
+ "-" + ("0"+($scope.dt2.getMonth()+1)).slice(-2) +
+ "-" +("0"+ $scope.dt2.getDate()).slice(-2) +
+ " " + ("0"+ $scope.selectLastHour.value).slice(-2) +
+ ":" +("0" + $scope.selectLastMinute.value).slice(-2) +
+ ":00.0"
+
+ $scope.WorkflowScheduleObject = {};
+ $scope.WorkflowScheduleObject['startDateTime_CRON'] = $scope.startDateTime_CRON;
+ $scope.WorkflowScheduleObject['startDateTime'] = $scope.startDateTime;
+ $scope.WorkflowScheduleObject['endDateTime'] = $scope.endDateTime;
+ $scope.WorkflowScheduleObject['workflowKey'] = $scope.workflowToSchedule.workflowKey;
+ $scope.WorkflowScheduleObject['recurrence'] = $scope.selectRecurrenceOpt.value;
+ $scope.WorkflowScheduleObject['workflow_arguments'] = "test";
+ $scope.WorkflowScheduleObject['workflow_server_url'] = $scope.workflowToSchedule.runLink;
+
+
+ TimeFromNowToStart = new Date($scope.startDateTime)-new Date()
+ TimeStartToEnd = new Date($scope.endDateTime)-new Date($scope.startDateTime)
+
+ if (TimeFromNowToStart<=0) {
+ console.log("invalid start time input")
+ alert("Please ensure the scheduled start date time is later than current time.")
+ return;
+ }
+ if (TimeStartToEnd<=0) {
+ console.log("invalid end time input")
+ alert("Please ensure the schduled end date time is later than the start time.")
+ return;
+ }
+ // if successful then save and close
+ $scope.saveCronJob($scope.WorkflowScheduleObject);
+ $uibModalInstance.close();
+
+ };
+
+ $scope.saveCronJob = function(cronJobData){
+
+ console.log('saving cron job data: ' + cronJobData);
+ var uuu = "workflows/saveCronJob.htm";
+ var postData={cronJobDataObj: cronJobData};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ //dataType: 'json', // data type expected from server
+ contentType: 'application/json',
+ data: JSON.stringify(postData), // data type sent to server
+ success : function(data){
+ $scope.$apply(function(){
+ //$scope.availableRoleFunctions=[];$scope.$apply();
+ // new // $scope.availableFnMenuItems=data.availableFnMenuItems;
+ }
+ );
+ //alert("Update Successful.") ;
+ //$scope.editRoleFunction = null;
+ // new /// $modalInstance.close({availableFnMenuItems:$scope.availableRoleFunctions});
+ },
+ error : function(data){
+ alert("Error while saving.");
+ }
+ });
+
+ };
+
+ $scope.cancel = function() {
+ console.log("cancel triggered")
+ $uibModalInstance.dismiss();
+ };
+ }]
+ });
+
+ modalInstance.result.then(function () {
+ $scope.$emit('workflowRemoved');
+ }, function () {
+ $log.info('Modal dismissed at: ' + new Date());
+ });
+
+ };
+
+
+
+
+
+
+
+
+ $scope.previewWorkflow = function(workflowToPreview,modalSize){
+ var modalInstance = $uibModal.open({
+ animation: $scope.animationsEnabled,
+ templateUrl: 'app/fusion/scripts/view-models/workflows/workflow-preview.html',
+ size:modalSize,
+ controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) {
+ $scope.workflowToPreview = workflowToPreview;
+ console.log('previewWorkFlow invoked');
+ console.log($scope.workflowToPreview);
+
+ $scope.cancel = function() {
+ $uibModalInstance.dismiss();
+ };
+ }]
+ });
+
+ modalInstance.result.then(function () {
+ $scope.$emit('workflowRemoved');
+ }, function () {
+ $log.info('Modal dismissed at: ' + new Date());
+ });
+
+ };
+
+
+ /* change work flow status based on the boolean variable "suspendBool" which corresponds whether
+ * we would like to suspend or activate a workflow specified by key. */
+ $scope.changeWorkflowStatus = function(workflowToChangeStatus,suspendBool){
+ if (workflowToChangeStatus!==null) {
+ var statusUrl= workflowToChangeStatus.runLink+"/engine-rest/process-definition/key/"+workflowToChangeStatus.workflowKey
+ var suspendedUrl= statusUrl+"/suspended"
+ var xmlHttp = new XMLHttpRequest();
+ xmlHttp.open('PUT', suspendedUrl, false);
+ xmlHttp.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
+ xmlHttp.onload = function() {
+ if (suspendBool) {
+ console.log("process definition is now suspended");
+ workflowToChangeStatus.active="false"
+ } else {
+ console.log("process definition is now activated");
+ workflowToChangeStatus.active="true"
+ }
+ };
+ xmlHttp.send(JSON.stringify({
+ "suspended" : suspendBool,
+ "includeProcessInstances" : true,
+ "executionDate" : "2013-11-21T10:49:45"
+ }));
+ }
+
+ };
+
+ $scope.activateWorkflow = function(workflowToActivate){
+ $scope.changeWorkflowStatus(workflowToActivate,false)
+
+ };
+
+ $scope.suspendWorkflow = function(workflowToActivate){
+ $scope.changeWorkflowStatus(workflowToActivate,true)
+ };
+
+ $scope.checkWorkflowStatus = function(workflow) {
+ if (workflow!==null) {
+ var statusUrl= workflow.runLink+"/engine-rest/process-definition/key/"+workflow.workflowKey
+ var xmlHttp3 = new XMLHttpRequest();
+ xmlHttp3.open('GET', statusUrl, true);
+ xmlHttp3.withCredentials = true;
+ xmlHttp3.send();
+ xmlHttp3.onreadystatechange = function() {
+ if (xmlHttp3.readyState == 4 && xmlHttp3.status == 200) {
+ // do something with the response in the variable data
+ var temp = JSON.parse(xmlHttp3.responseText)
+ if (temp.suspended == false){
+ console.log("Activated")
+ workflow.active="true"
+ } else {
+ console.log("Suspended")
+ workflow.active="false"
+ }
+ }
+ }
+ }
+ };
+
+ $scope.StartWorkflowInstance = function(workflowToStart){
+ if (workflowToStart!==null) {
+ var statusUrl= workflowToStart.runLink+"/engine-rest/process-definition/key/"+workflowToStart.workflowKey
+ var suspendedUrl= statusUrl+"/submit-form"
+ var xmlHttp = new XMLHttpRequest();
+ xmlHttp.open('POST', suspendedUrl, false);
+ xmlHttp.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
+ xmlHttp.onload = function() {
+ };
+ xmlHttp.send(JSON.stringify({
+ "variables": {
+ "customerId": {"value":"asdasda","type":"String"},
+ "amount":{"value":"100","type":"String"}
+ }
+ }));
+ }
+
+ };
+
+
+ $scope.$on('workflowAdded', function(event, newWorkflow) {
+ console.log("New Workflow to be added in list scope " + JSON.stringify(newWorkflow));
+ //$scope.workflows.push(newWorkflow);
+ $scope.fetchWorkflowsList();
+ console.log('newly added workflow = ' + JSON.stringify(newWorkflow));
+ });
+
+ $scope.$on('workflowRemoved', function(event) {
+ $scope.fetchWorkflowsList();
+ });
+
+ $scope.fetchWorkflowsList();
+
+
+
+});
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowRouting.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowRouting.js
new file mode 100644
index 00000000..81fe4e28
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowRouting.js
@@ -0,0 +1,26 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.config(function($routeProvider) {
+ $routeProvider
+ .when('/all', {
+ templateUrl: 'app/fusion/scripts/view-models/workflows/workflow-listing.html',
+ controller: 'workflowsController'
+ })
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/footer.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/footer.js
new file mode 100644
index 00000000..a2dab75c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/footer.js
@@ -0,0 +1,30 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.directive('qFooter', function () {
+ return {
+ restrict: 'A', //This menas that it will be used as an attribute and NOT as an element. I don't like creating custom HTML elements
+ replace: false,
+ templateUrl: "app/fusion/scripts/view-models/footer.html",
+ controller: ['$scope', '$filter', function ($scope, $filter) {
+ // Your behaviour goes here :)
+ }]
+ }
+});
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/header.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/header.js
new file mode 100644
index 00000000..bc90d200
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/header.js
@@ -0,0 +1,504 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.directive('qHeader', function () {
+ return {
+ restrict: 'A', //This menas that it will be used as an attribute and NOT as an element. I don't like creating custom HTML elements
+ replace: false,
+ templateUrl: "app/fusion/scripts/view-models/header.html",
+ controller: ['$scope', '$filter','$http','$timeout', '$log','UserInfoService', '$window', '$cookies', function ($scope, $filter, $http, $timeout, $log,UserInfoService, $window, $cookies) {
+
+ /*Define fields*/
+ $scope.userName;
+ $scope.userFirstName;
+ $scope.redirectUrl;
+ $scope.contactUsUrl;
+ $scope.getAccessUrl;
+ $scope.childData=[];
+ $scope.parentData=[];
+ $scope.menuItems = [];
+ $scope.loadMenufail=false;
+ $scope.megaMenuDataObject=[];
+ $scope.activeClickSubMenu = {
+ x: ''
+ };
+ $scope.activeClickMenu = {
+ x: ''
+ };
+ $scope.favoritesMenuItems = [];
+ $scope.favoriteItemsCount = 0;
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = false;
+ $scope.favoritesWindow = false;
+
+ /*Menu Structure*/
+ var menuStructureConvert = function(menuItems) {
+ console.log(menuItems);
+ $scope.megaMenuDataObjectTemp =
+ [
+ {
+ text: "ECOMP",
+ children: menuItems
+ },
+ {
+ text: "Help",
+ children: [
+ {
+ text:"Contact Us",
+ url:$scope.contactUsUrl
+ },
+ {
+ text:"Get Access",
+ url:$scope.getAccessUrl
+ }]
+ }
+ ];
+ return $scope.megaMenuDataObjectTemp;
+ };
+
+ /***************functions**************/
+ /*Put user info into fields*/
+ $scope.inputUserInfo = function(userInfo){
+ if (typeof(userInfo) != "undefined" && userInfo!=null && userInfo!=''){
+ if(typeof(userInfo.USER_FIRST_NAME) != "undefined" && userInfo.USER_FIRST_NAME!=null){
+ $scope.userFirstName = userInfo.USER_FIRST_NAME;
+ }
+ }
+ }
+ /*getting user info from session*/
+ $scope.getUserNameFromSession = function(){
+ UserInfoService.getFunctionalMenuStaticDetailSession()
+ .then(function (res) {
+ $scope.contactUsUrl=res.contactUsLink;
+ $scope.userName = res.userName;
+ $scope.userFirstName = res.firstName;
+ $scope.redirectUrl = res.portalUrl;
+ $scope.getAccessUrl = res.getAccessUrl;
+ });
+ }
+ $scope.getTopMenuStaticInfo=function() {
+ var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext();
+ promise.then(
+ function(res) {
+ if(res==null || res==''){
+ $log.info('failed getting static User information');
+ $scope.getUserNameFromSession();
+ }else{
+ $log.info('Received static User information');
+
+ var resData = res;
+ console.log(resData);
+ $scope.inputUserInfo(resData);
+ $scope.userName = $scope.firstName+ ' '+ $scope.lastName;
+ }
+ },
+ function(err) {
+ $log.info('failed getting static User information');
+ }
+ );
+ }
+
+ $scope.returnToPortal=function(){
+ window.location.href = $scope.redirectUrl;
+ }
+
+ var unflatten = function( array, parent, tree ){
+ tree = typeof tree !== 'undefined' ? tree : [];
+ parent = typeof parent !== 'undefined' ? parent : { menuId: null };
+ var children = _.filter( array, function(child){ return child.parentMenuId == parent.menuId; });
+ if( !_.isEmpty( children ) ){
+ if( parent.menuId === null ){
+ tree = children;
+ }else{
+ parent['children'] = children
+ }
+ _.each( children, function( child ){ unflatten( array, child ) } );
+ }
+ return tree;
+ }
+
+ $scope.getMenu=function() {
+ $scope.getTopMenuStaticInfo();
+ $http({
+ method: "GET",
+ url: 'get_functional_menu',
+// TIMEOUT USED FOR LOCAL TESTING ONLY
+// timeout: 100
+ }).success(function (response) {
+
+ if (response == '101: Timeout') {
+ $log.debug('Timeout attempting to get_functional_menu');
+ $scope.megaMenuDataObject = menuStructureConvert("");
+// $scope.createErrorMenu();
+ //$scope.loadMenufail=true;
+ } else {
+ if(typeof response != 'undefined' && response.length!=0 && typeof response[0] != 'undefined' && typeof response[0].error!="undefined"){
+ $log.debug('Timeout attempting to get_functional_menu');
+ $scope.menuItems = unflatten( response);
+ $scope.megaMenuDataObject = menuStructureConvert($scope.menuItems);
+// $scope.createErrorMenu();
+ //$scope.loadMenufail=true;
+ }else{
+ $scope.loadMenufail=false;
+ $scope.contactUsURL = response.contactUsLink;
+ $log.debug('functional_menu',response);
+ $scope.megaMenuDataObject = menuStructureConvert("");
+ }
+ }
+ }).error(function (response){
+ $scope.megaMenuDataObject = menuStructureConvert("");
+// $scope.createErrorMenu();
+ //$scope.loadMenufail=true;
+ $log.debug('REST API failed get_functional_menu...');
+ });
+
+ }
+
+ $scope.adjustHeader=function() {
+ $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
+
+ if($scope.showHeader == true) {
+ $scope.drawer_margin_top = 70;
+ $scope.drawer_custom_top = 54;
+ $scope.toggle_drawer_top = 55;
+ }
+ else {
+
+ $scope.drawer_margin_top = 60;
+ $scope.drawer_custom_top = 0;
+ $scope.toggle_drawer_top = 10;
+ }
+
+ }
+
+ $scope.getMenu();
+ $scope.adjustHeader();
+
+/* **************************************************************************/
+/* Logic for the favorite menus is here */
+
+ $scope.loadFavorites = function () {
+ $log.debug('loadFavorites has happened.');
+ if ($scope.favoritesMenuItems == '') {
+ $scope.generateFavoriteItems();
+ $log.debug('loadFavorites is calling generateFavoriteItems()');
+ } else {
+ $log.debug('loadFavorites is NOT calling generateFavoriteItems()');
+ }
+ }
+
+ $scope.goToUrl = function (item) {
+ $log.info("goToUrl called")
+ $log.info(item);
+
+ var url = item.url;
+ var restrictedApp = item.restrictedApp;
+ $log.debug('Restricted app status is: ' + restrictedApp);
+ if (!url) {
+ $log.info('No url found for this application, doing nothing..');
+ return;
+ }
+ if (restrictedApp) {
+ $window.open(url, '_blank');
+ } else {
+ $window.open(url, '_self');
+ }
+
+ }
+
+ $scope.submenuLevelAction = function(index, column) {
+ if ($scope.favoritesMenuItems == '') {
+ $scope.generateFavoriteItems();
+ $log.debug('submenuLevelAction is calling generateFavoriteItems()');
+ }
+ $log.debug('item hovered/clicked: ' + index + '; column = ' + column);
+ if (column == 2) { // 2 is Design
+ $scope.favoritesWindow = false;
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = false;
+ }
+ if (index=='Favorites' && $scope.favoriteItemsCount != 0) {
+ $log.debug('Showing Favorites window');
+ $scope.favoritesWindow = true;
+ $scope.showFavorites = true;
+ $scope.emptyFavorites = false;
+ }
+ if (index=='Favorites' && $scope.favoriteItemsCount == 0) {
+ $log.debug('Hiding Favorites window in favor of No Favorites Window');
+ $scope.favoritesWindow = true;
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = true;
+ }
+ if (column > 2) {
+ $scope.favoritesWindow = false;
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = false;
+ }
+ };
+
+ $scope.hideFavoritesWindow = function() {
+ $log.debug('$scope.hideFavoritesWindow has been called');
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = false;
+ }
+
+ $scope.isUrlFavorite = function (menuId) {
+// $log.debug('array objects in menu favorites = ' + $scope.favoriteItemsCount + '; menuId=' + menuId);
+ var jsonMenu = JSON.stringify($scope.favoritesMenuItems);
+ var isMenuFavorite = jsonMenu.indexOf('menuId\":' + menuId);
+ if (isMenuFavorite==-1) {
+ return false;
+ } else {
+ return true;
+ }
+
+ }
+
+ $scope.generateFavoriteItems = function() {
+ $http({
+ method: "GET",
+ url: 'get_favorites',
+// TIMEOUT USED FOR LOCAL TESTING ONLY
+// timeout: 100
+ }).success(function (response) {
+ if (response == '101: Timeout') {
+ $log.error('Timeout attempting to get_favorites_menu');
+ } else {
+ if(typeof response != 'undefined' && response.length!=0 && typeof response[0] != 'undefined' && typeof response[0].error!="undefined"){
+ $log.error('REST API failed get_favorites' + response);
+ }else{
+ $log.debug('get_favorites = ' + JSON.stringify(response));
+ $scope.favoritesMenuItems = response;
+ $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length;
+ $log.info('number of favorite menus: ' + $scope.favoriteItemsCount);
+ }
+ }
+ }).error(function (response){
+ $log.error('REST API failed get_favorites' + response);
+//createFavoriteErrorMenu() USED FOR LOCAL TESTING ONLY
+// $scope.createFavoriteErrorMenu();
+ });
+ }
+
+ $scope.createFavoriteErrorMenu=function() {
+ $scope.favoritesMenuItems = [];
+ $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length;
+ $log.info('number of favorite menus: ' + $scope.favoriteItemsCount);
+ }
+
+ /* end of Favorite Menu code */
+ /* **************************************************************************/
+
+
+ /* **************************************************************************/
+ // THIS IS USED FOR LOCAL TESTING ONLY
+ /* **************************************************************************/
+ $scope.createErrorMenu=function() {
+ $log.debug('Creating fake menu now...');
+// $scope.loadMenufail=true;
+ $scope.menuItems = [
+ {
+ "menuId": 1,
+ "column": 2,
+ "text": "Design",
+ "parentMenuId": null,
+ "url": ""
+ },
+ {
+ "menuId": 2,
+ "column": 3,
+ "text": "Infrastructure Ordering",
+ "parentMenuId": null,
+ "url": ""
+ },
+ {
+ "menuId": 3,
+ "column": 4,
+ "text": "Service Creation",
+ "parentMenuId": null,
+ "url": ""
+ },
+ {
+ "menuId": 4,
+ "column": 5,
+ "text": "Service Mgmt",
+ "parentMenuId": null,
+ "url": ""
+ },
+ {
+ "menuId": 90,
+ "column": 1,
+ "text": "Google",
+ "parentMenuId": 1,
+ "url": ""
+ },
+ {
+ "menuId": 91,
+ "column": 1,
+ "text": "Mike Little's Coffee Cup",
+ "parentMenuId": 2,
+ "url": ""
+ },
+ {
+ "menuId": 92,
+ "column": 2,
+ "text": "Andy and his Astrophotgraphy",
+ "parentMenuId": 3,
+ "url": ""
+ },
+ {
+ "menuId": 93,
+ "column": 1,
+ "text": "JSONLint",
+ "parentMenuId": 4,
+ "url": ""
+ },
+ {
+ "menuId": 94,
+ "column": 2,
+ "text": "HROneStop",
+ "parentMenuId": 4,
+ "url": ""
+ },
+ {
+ "menuId": 95,
+ "column": 2,
+ "text": "4th Level App4a R16",
+ "parentMenuId": 4,
+ "url": ""
+ },
+ {
+ "menuId": 96,
+ "column": 3,
+ "text": "3rd Level App1c R200",
+ "parentMenuId": 4,
+ "url": ""
+ },
+ {
+ "menuId": 97,
+ "column": 1,
+ "text": "3rd Level App4b R16",
+ "parentMenuId": 5,
+ "url": ""
+ },
+ {
+ "menuId": 98,
+ "column": 2,
+ "text": "3rd Level App2b R16",
+ "parentMenuId": 5,
+ "url": ""
+ },
+ {
+ "menuId": 99,
+ "column": 1,
+ "text": "Favorites",
+ "parentMenuId": null,
+ "url": ""
+ }
+ ];
+ $scope.menuItems = unflatten( $scope.menuItems );
+ //remove this
+ $scope.megaMenuDataObject = menuStructureConvert($scope.menuItems);
+ }
+ }]
+ }
+});
+
+app.filter("ellipsis", function(){
+ return function(text, length){
+ if (text) {
+ var ellipsis = text.length > length ? "..." : "";
+ return text.slice(0, length) + ellipsis;
+ };
+ return text;
+ }
+});
+
+function reloadPageOnce() {
+ if( window.localStorage )
+ {
+ if( !localStorage.getItem('firstLoad') )
+ {
+ localStorage['firstLoad'] = true;
+ window.location.reload();
+ }
+ else
+ localStorage.removeItem('firstLoad');
+ }
+}
+app.controller('loginSnippetCtrl', function ($scope,$http, $log,UserInfoService){
+ /*Define fields*/
+ $scope.userProfile={
+ firstName:'',
+ lastName:'',
+ fullName:'',
+ email:'',
+ userid:''
+ }
+ /*Put user info into fields*/
+ $scope.inputUserInfo = function(userInfo){
+ if (typeof(userInfo) != "undefined" && userInfo!=null && userInfo!=''){
+ if (typeof(userInfo.USER_FIRST_NAME) != "undefined" && userInfo.USER_FIRST_NAME!=null && userInfo.USER_FIRST_NAME!='')
+ $scope.userProfile.firstName = userInfo.USER_FIRST_NAME;
+ if (typeof(userInfo.USER_LAST_NAME) != "undefined" && userInfo.USER_LAST_NAME!=null && userInfo.USER_LAST_NAME!='')
+ $scope.userProfile.lastName = userInfo.USER_LAST_NAME;
+ if (typeof(userInfo.USER_EMAIL) != "undefined" && userInfo.USER_EMAIL!=null && userInfo.USER_EMAIL!='')
+ $scope.userProfile.email = userInfo.USER_EMAIL;
+ if (typeof(userInfo.USER_ORGUSERID) != "undefined" && userInfo.USER_ORGUSERID!=null && userInfo.USER_ORGUSERID!='')
+ $scope.userProfile.userid = userInfo.USER_ORGUSERID;
+ }
+ }
+ /*getting user info from session*/
+ $scope.getUserNameFromSession = function(){
+ UserInfoService.getFunctionalMenuStaticDetailSession()
+ .then(function (response) {
+ $scope.userProfile.fullName = response.userName;
+ $scope.userProfile.userid = response.userid;
+ $scope.userProfile.email = response.email;
+ });
+ }
+ /*getting user info from shared context*/
+ $scope.getUserName=function() {
+ var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext();
+ promise.then(
+ function(res) {
+ if(res==null || res==''){
+ $log.info('Getting User information from session');
+ $scope.getUserNameFromSession();
+
+ }else{
+ $log.info('Received User information from shared context',res);
+ var resData = res;
+ console.log(resData);
+ $scope.inputUserInfo(resData);
+ $scope.userProfile.fullName = $scope.userProfile.firstName+ ' '+ $scope.userProfile.lastName;
+ }
+ },
+ function(err) {
+ console.log('error');
+ }
+ );
+ };
+ /*call the get user info function*/
+ try{
+ $scope.getUserName();
+ }catch(err){
+ $log.info('Error while getting User information',err);
+ }
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/leftMenu.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/leftMenu.js
new file mode 100644
index 00000000..737cb801
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/leftMenu.js
@@ -0,0 +1,203 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+
+app.directive('qMenu', function () {
+ return {
+ restrict: 'A', //This menas that it will be used as an attribute and NOT as an element. I don't like creating custom HTML elements
+ replace: false,
+ templateUrl: "app/fusion/scripts/view-models/left_menu.html",
+ controller: ['$scope', '$filter','$http','$timeout','$cookies','LeftMenuService', function ($scope, $filter, $http,$timeout,$cookies,LeftMenuService) {
+
+ $scope.leftChildData=[];
+ $scope.leftParentData=[];
+ $scope.leftMenuItems = [];
+ $scope.app_name = "";
+ $scope.app_name_full;
+ LeftMenuService.getLeftMenu().then(function(response){
+ var j = response;
+ try{
+ if(j && j !== "null" && j!== "undefined"){
+ $scope.leftParentData = JSON.parse(j.data);
+ $scope.leftChildData = JSON.parse(j.data2);
+ }else{
+ throw "Get Left Menu respsone is not an object/is empty";
+ }
+ try{
+ var leftChildItemList = $scope.leftChildData;
+ var pageUrl = window.location.href.split('/')[window.location.href.split('/').length-1];
+ var leftParentList =$scope.leftParentData;
+ for (var i = 0; i < leftParentList.length; i++) {
+ $scope.item = {
+ parentLabel : leftParentList[i].label,
+ parentAction : leftParentList[i].action,
+ parentImageSrc : leftParentList[i].imageSrc,
+ open:pageUrl==leftParentList[i].action?true:false,
+ childItemList : leftChildItemList[i]
+ }
+ $scope.leftMenuItems.push($scope.item);
+ };
+ }catch(err){
+ console.log("error happened while trying to set left menu structure"+err);
+ }
+ }catch (e) {
+ console.log("error happened while trying to get left menu items"+e);
+ reloadPageOnce();
+ return;
+ }
+ },function(error){
+ console.log("error happened while calling getLeftMenu"+error);
+ });
+
+ LeftMenuService.getAppName().then(function(response){
+ var j = response;
+ try{
+ if(j && j !== "null" && j!== "undefined"){
+ console.log("app name is " + $scope.app_name);
+ $scope.app_name_full = j.data;
+ var processed_app_name = j.data;
+ var n = processed_app_name.length;
+ if (n > 15) {
+ n = 15;
+ }
+ $scope.app_name = processed_app_name.substr(0, n);
+ }else{
+ throw "Get app_name respsone is not an object/is empty";
+ }
+ }catch (e) {
+ console.log("error happened while trying to get app name "+e);
+ return;
+ }
+ },function(error){
+ console.log("error happened while calling getAppName "+error);
+ });
+
+ $scope.adjustHeader=function() {
+ $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
+
+ if($scope.showHeader == true) {
+ $scope.drawer_margin_top = 50;
+ $scope.drawer_custom_top = 20;
+ $scope.toggle_drawer_top = 55;
+ }
+ else {
+
+ $scope.drawer_margin_top = 0;
+ $scope.drawer_custom_top = 0;
+ $scope.toggle_drawer_top = 0;
+ }
+
+
+ };
+
+ $scope.adjustHLeftMenu = function (type){
+ $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
+
+ if($scope.showHeader == true) {
+ $scope.drawer_margin_top = 60;
+ $scope.drawer_custom_top = 54;
+ $scope.toggle_drawer_top = 55;
+ }
+ else {
+
+ $scope.drawer_margin_top = 50;
+ $scope.drawer_custom_top = 0;
+ $scope.toggle_drawer_top = 10;
+ }
+ if(type=='burgerIcon'){
+ return { "top": $scope.toggle_drawer_top+"px"};
+ }else if(type=='leftMenu'){
+ return { "margin-top": $scope.drawer_margin_top+"px"};
+ }else
+ return;
+ }
+ $scope.adjustHeader();
+ $scope.drawerOpen = true;
+
+ $scope.toggleDrawer = function() {
+ $scope.drawerOpen = !($scope.drawerOpen);
+ if ($scope.drawerOpen) {
+ // setCookie('drawerOpen','open',30);
+ $scope.arrowShow = true;
+
+
+ if (document.getElementById('fnMenueContent')!=null)
+ document.getElementById('fnMenueContent').style.marginLeft = "0px";
+
+ if (document.getElementById('rightContentAdmin')!=null)
+ document.getElementById('rightContentAdmin').style.marginLeft = "210px";
+
+ else if (document.getElementById('rightContentProfile')!=null)
+ document.getElementById('rightContentProfile').style.marginLeft = "210px";
+
+
+
+ } else {
+
+ $scope.arrowShow = false;
+
+ if (document.getElementById('fnMenueContent')!=null)
+ document.getElementById('fnMenueContent').style.marginLeft = "-150px";
+
+ if (document.getElementById('rightContentAdmin')!=null) {
+ document.getElementById('rightContentAdmin').style.marginLeft = "50px";
+
+ }
+
+ else if (document.getElementById('rightContentProfile')!=null)
+ document.getElementById('rightContentProfile').style.marginLeft = "50px";
+
+
+
+
+ }
+ };
+
+ $timeout(function() {
+ detectScrollEvent();
+ }, 800);
+ }]
+ }
+
+});
+$(window).scroll(function() {
+ if ($('.att-drawer').is(':visible')) {
+ detectScrollEvent();
+ }
+
+});
+
+function detectScrollEvent() {
+ try{
+ var footerOff = $('#footerContainer').offset().top;
+ var headOff = $('#headerContainer').offset().top;
+ var winHeight = $(window).height();
+ if ((footerOff - headOff) <= winHeight) {
+ $('.att-drawer').css({
+ "height" : footerOff - headOff - 55
+ });
+ } else {
+ $('.att-drawer').css({
+ "height" : "94vh"
+ });
+ }
+ }catch(err){
+ console.log(err)
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/jquery.resize.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/jquery.resize.js
new file mode 100644
index 00000000..1ebd6c95
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/jquery.resize.js
@@ -0,0 +1,139 @@
+/*!
+ * jquery.resize.js 0.0.1 - https://github.com/yckart/jquery.resize.js
+ * Resize-event for DOM-Nodes
+ *
+ * @see http://workingdraft.de/113/
+ * @see http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/
+ *
+ * Copyright (c) 2013 Yannick Albert (http://yckart.com)
+ * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php).
+ * 2013/04/01
+ */
+
+(function(factory) {
+ if(typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], factory);
+ } else if(typeof exports === 'object') {
+ // Node/CommonJS style for Browserify
+ module.exports = factory;
+ } else {
+ // Browser globals
+ factory(jQuery);
+ }
+}(function($) {
+
+ function addFlowListener(element, type, fn) {
+ var flow = type == 'over';
+ element.addEventListener('OverflowEvent' in window ? 'overflowchanged' : type + 'flow', function(e) {
+ if(e.type == (type + 'flow') || ((e.orient == 0 && e.horizontalOverflow == flow) || (e.orient == 1 && e.verticalOverflow == flow) || (e.orient == 2 && e.horizontalOverflow == flow && e.verticalOverflow == flow))) {
+ e.flow = type;
+ return fn.call(this, e);
+ }
+ }, false);
+ };
+
+ function fireEvent(element, type, data, options) {
+ var options = options || {},
+ event = document.createEvent('Event');
+ event.initEvent(type, 'bubbles' in options ? options.bubbles : true, 'cancelable' in options ? options.cancelable : true);
+ for(var z in data) event[z] = data[z];
+ element.dispatchEvent(event);
+ };
+
+ $.event.special.resize = {
+ setup: function() {
+ var element = this;
+ var resize = 'onresize' in element;
+ if(!resize && !element._resizeSensor) {
+ var sensor = element._resizeSensor = document.createElement('div');
+ sensor.className = 'resize-sensor';
+ sensor.innerHTML = '<div class="resize-overflow"><div></div></div><div class="resize-underflow"><div></div></div>';
+
+ var x = 0,
+ y = 0,
+ first = sensor.firstElementChild.firstChild,
+ last = sensor.lastElementChild.firstChild,
+ matchFlow = function(event) {
+ var change = false,
+ width = element.offsetWidth;
+ if(x != width) {
+ first.style.width = width - 1 + 'px';
+ last.style.width = width + 1 + 'px';
+ change = true;
+ x = width;
+ }
+ var height = element.offsetHeight;
+ if(y != height) {
+ first.style.height = height - 1 + 'px';
+ last.style.height = height + 1 + 'px';
+ change = true;
+ y = height;
+ }
+ if(change && event.currentTarget != element) fireEvent(element, 'resize');
+ };
+
+ if(getComputedStyle(element).position == 'static') {
+ element.style.position = 'relative';
+ element._resizeSensor._resetPosition = true;
+ }
+ addFlowListener(sensor, 'over', matchFlow);
+ addFlowListener(sensor, 'under', matchFlow);
+ addFlowListener(sensor.firstElementChild, 'over', matchFlow);
+ addFlowListener(sensor.lastElementChild, 'under', matchFlow);
+ element.appendChild(sensor);
+ matchFlow({});
+ }
+ var events = element._flowEvents || (element._flowEvents = []);
+ if(events.indexOf(handler) == -1) events.push(handler);
+ if(!resize) element.addEventListener('resize', handler, false);
+ element.onresize = function(e) {
+ events.forEach(function(fn) {
+ fn.call(element, e);
+ });
+ };
+ },
+
+ teardown: function() {
+ var element = this;
+ var index = element._flowEvents.indexOf(handler);
+ if(index > -1) element._flowEvents.splice(index, 1);
+ if(!element._flowEvents.length) {
+ var sensor = element._resizeSensor;
+ if(sensor) {
+ element.removeChild(sensor);
+ if(sensor._resetPosition) element.style.position = 'static';
+ delete element._resizeSensor;
+ }
+ if('onresize' in element) element.onresize = null;
+ delete element._flowEvents;
+ }
+ element.removeEventListener('resize', handler);
+ }
+ };
+
+ $.fn.extend({
+ resize: function(fn) {
+ return fn ? this.bind("resize", fn) : this.trigger("resize");
+ },
+
+ unresize: function(fn) {
+ return this.unbind("resize", fn);
+ }
+ });
+
+
+ function handler(event) {
+ var orgEvent = event || window.event,
+ args = [].slice.call(arguments, 1);
+
+ event = $.event.fix(orgEvent);
+ event.type = "resize";
+
+ // Add event to the front of the arguments
+ args.unshift(event);
+
+ return($.event.dispatch || $.event.handle).apply(this, args);
+ }
+
+})); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/debug.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/debug.js
new file mode 100644
index 00000000..eff36a25
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/debug.js
@@ -0,0 +1,329 @@
+/**
+ * debugData
+ *
+ * Pass me a data structure {} and I'll output all the key/value pairs - recursively
+ *
+ * @example var HTML = debugData( oElem.style, "Element.style", { keys: "top,left,width,height", recurse: true, sort: true, display: true, returnHTML: true });
+ *
+ * @param Object o_Data A JSON-style data structure
+ * @param String s_Title Title for dialog (optional)
+ * @param Hash options Pass additional options in a hash
+ */
+function debugData (o_Data, s_Title, options) {
+ options = options || {};
+ var
+ str=(s_Title||s_Title==='' ? s_Title : 'DATA')
+ , dType=$.type(o_Data)
+ // maintain backward compatibility with OLD 'recurseData' param
+ , recurse=($.type(options)==='boolean' ? options : options.recurse !==false)
+ , keys=(options.keys?','+options.keys+',':false)
+ , display=options.display !==false
+ , html=options.returnHTML !==false
+ , sort=!!options.sort
+ , prefix=options.indent ? ' ' : ''
+ , D=[], i=0 // Array to hold data, i=counter
+ , hasSubKeys = false
+ , k, t, skip, x, type // loop vars
+ ;
+ if (dType!=='object' && dType!=='array') {
+ if (options.display) alert( (s_Title || 'debugData') +': '+ o_Data );
+ return o_Data;
+ }
+ if (dType==='object' && $.isPlainObject(o_Data))
+ dType='hash';
+
+ if (o_Data.jquery) {
+ str=s_Title+'jQuery Collection ('+ o_Data.length +')\n context="'+ o_Data.context +'"';
+ }
+ else if (o_Data.nodeName) {
+ str=s_Title+o_Data.tagName;
+ var id = o_Data.id, cls=o_Data.className, src=o_Data.src, hrf=o_Data.href;
+ if (id) str+='\n id="'+ id+'"';
+ if (cls) str+='\n class="'+ cls+'"';
+ if (src) str+='\n src="'+ src+'"';
+ if (hrf) str+='\n href="'+ hrf+'"';
+ }
+ else {
+ parse(o_Data,prefix,dType); // recursive parsing
+ if (sort && !hasSubKeys) D.sort(); // sort by keyName - but NOT if has subKeys!
+ if (str) str += '\n***'+ '****************************'.substr(0,str.length) +'\n';
+ str += D.join('\n'); // add line-breaks
+ }
+
+ if (display) alert(str); // display data
+ if (html) str=str.replace(/\n/g, ' <br>').replace(/ /g, ' &nbsp;'); // format as HTML
+ return str;
+
+ function parse ( data, prefix, parentType ) {
+ var first = true;
+ try {
+ $.each( data, function (key, val) {
+ skip = (keys && keys.indexOf(','+key+',') === -1);
+ type = $.type(val);
+ if (type==='object' && $.isPlainObject(val))
+ type = 'hash';
+ k = prefix + (first ? ' ' : ', ');
+ first = false;
+
+ if (parentType!=='array') // no key-names for array items
+ k += key+': '; // NOT an array
+
+ if (type==="date" || type==="regexp") {
+ val = val.toString();
+ type = "string";
+ }
+ if (type==="string") { // STRING
+ if (!skip) D[i++] = k +'"'+ val +'"';
+ }
+ // NULL, UNDEFINED, NUMBER or BOOLEAN
+ else if (/^(null|undefined|number|boolean)/.test(type)) {
+ if (!skip) D[i++] = k + val;
+ }
+ else if (type==="function") { // FUNCTION
+ if (!skip) D[i++] = k +'function()';
+ }
+ else if (type==="array") { // ARRAY
+ if (!skip) {
+ D[i++] = k +'[';
+ parse( val, prefix+' ',type); // RECURSE
+ D[i++] = prefix +' ]';
+ }
+ }
+ else if (val.jquery) { // JQUERY OBJECT
+ if (!skip) D[i++] = k +'jQuery ('+ val.length +') context="'+ val.context +'"';
+ }
+ else if (val.nodeName) { // DOM ELEMENT
+ var id = val.id, cls=val.className, src=val.src, hrf=val.href;
+ if (skip) D[i++] = k +' '+
+ id ? 'id="'+ id+'"' :
+ src ? 'src="'+ src+'"' :
+ hrf ? 'href="'+ hrf+'"' :
+ cls ? 'class="'+cls+'"' :
+ '';
+ }
+ else if (type==="hash") { // JSON
+ if (!recurse || $.isEmptyObject(val)) { // show an empty hash
+ if (!skip) D[i++] = k +'{ }';
+ }
+ else { // recurse into JSON hash - indent output
+ D[i++] = k +'{';
+ parse( val, prefix+' ',type); // RECURSE
+ D[i++] = prefix +' }';
+ }
+ }
+ else { // OBJECT
+ if (!skip) D[i++] = k +'OBJECT'; // NOT a hash
+ }
+ });
+ } catch (e) {}
+ }
+};
+
+function debugStackTrace (s_Title, options) {
+ var
+ callstack = []
+ , isCallstackPopulated = false
+ ;
+ try {
+ i.dont.exist += 0; // doesn't exist- that's the point
+ } catch(e) {
+ if (e.stack) { // Firefox
+ var lines = e.stack.split('\n');
+ for (var i=0, len=lines.length; i<len; i++) {
+ if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
+ callstack.push(lines[i]);
+ }
+ }
+ //Remove call to printStackTrace()
+ callstack.shift();
+ isCallstackPopulated = true;
+ }
+ else if (window.opera && e.message) { // Opera
+ var lines = e.message.split('\n');
+ for (var i=0, len=lines.length; i<len; i++) {
+ if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
+ var entry = lines[i];
+ //Append next line also since it has the file info
+ if (lines[i+1]) {
+ entry += ' at ' + lines[i+1];
+ i++;
+ }
+ callstack.push(entry);
+ }
+ }
+ //Remove call to printStackTrace()
+ callstack.shift();
+ isCallstackPopulated = true;
+ }
+ }
+
+ if (!isCallstackPopulated) { // IE and Safari
+ var currentFunction = arguments.callee.caller;
+ while (currentFunction) {
+ var fn = currentFunction.toString();
+ var fname = fn.substring(fn.indexOf('function') + 8, fn.indexOf('')) || 'anonymous';
+ callstack.push(fname);
+ currentFunction = currentFunction.caller;
+ }
+ }
+
+ debugData( callstack, s_Title, options );
+};
+
+if (!window.console) window.console = { log: debugData };
+
+if (!window.console.trace)
+ window.console.trace = function (s_Title) {
+ window.console.log( debugStackTrace(s_Title, { display: false, returnHTML: false, sort: false }) );
+ };
+
+// add method to output 'hash data' inside an string
+window.console.data = function (data, title) {
+ var w = { array: ['[',']'], object: ['{','}'], string: ['"','"'], number: ['',''], function: ['','()'] }
+ , x = $.type( data )
+ , obj = x.match(/(object|array)/)
+ , delim = !obj ? ['',''] : x === 'object' ? ['{\n','\n}'] : ['[\n','\n]']
+ , opts = { display: false, returnHTML: false, sort: false }
+ , debug = debugData( data, '', opts)
+ ;
+ console.log(
+ (title ? title +' = ' : '')
+ + delim[0]
+ + ($.type(debug) === 'string' ? debug.replace(/ /g, '\t') : debug)
+ + delim[1]
+ );
+};
+
+
+/**
+ * timer
+ *
+ * Utility for debug timing of events
+ * Can track multiple timers and returns either a total time or interval from last event
+ * @param String timerName Name of the timer - defaults to debugTimer
+ * @param String action Keyword for action or return-value...
+ * action: 'reset' = reset; 'clear' = delete; 'total' = ms since init; 'step' or '' = ms since last event
+ */
+/**
+ * timer
+ *
+ * Utility method for timing performance
+ * Can track multiple timers and returns either a total time or interval from last event
+ *
+ * returns time-data: {
+ * start: Date Object
+ * , last: Date Object
+ * , step: 99 // time since 'last'
+ * , total: 99 // time since 'start'
+ * }
+ *
+ * USAGE SAMPLES
+ * =============
+ * timer('name'); // create/init timer
+ * timer('name', 'reset'); // re-init timer
+ * timer('name', 'clear'); // clear/remove timer
+ * var i = timer('name'); // how long since last timer request?
+ * var i = timer('name', 'total'); // how long since timer started?
+ *
+ * @param String timerName Name of the timer - defaults to debugTimer
+ * @param String action Keyword for action or return-value...
+ * @param Hash options Options to customize return data
+ * action: 'reset' = reset; 'clear' = delete; 'total' = ms since init; 'step' or '' = ms since last event
+ */
+function timer (timerName, action, options) {
+ var
+ name = timerName || 'debugTimer'
+ , Timer = window[ name ]
+ , defaults = {
+ returnString: true
+ , padNumbers: true
+ , timePrefix: ''
+ , timeSuffix: ''
+ }
+ ;
+
+ // init the timer first time called
+ if (!Timer || action == 'reset') { // init timer
+ Timer = window[ name ] = {
+ start: new Date()
+ , last: new Date()
+ , step: 0 // time since 'last'
+ , total: 0 // time since 'start'
+ , options: $.extend({}, defaults, options)
+ };
+ }
+ else if (action == 'clear') { // remove timer
+ window[ name ] = null;
+ return null;
+ }
+ else { // update existing timer
+ Timer.step = (new Date()) - Timer.last; // time since 'last'
+ Timer.total = (new Date()) - Timer.start; // time since 'start'
+ Timer.last = new Date();
+ }
+
+ var
+ time = (action == 'total') ? Timer.total : Timer.step
+ , o = Timer.options // alias
+ ;
+
+ if (o.returnString) {
+ time += ""; // convert integer to string
+ // pad time to 4 chars with underscores
+ if (o.padNumbers)
+ switch (time.length) {
+ case 1: time = "&ensp;&ensp;&ensp;"+ time; break;
+ case 2: time = "&ensp;&ensp;"+ time; break;
+ case 3: time = "&ensp;"+ time; break;
+ }
+ // add prefix and suffix
+ if (o.timePrefix || o.timeSuffix)
+ time = o.timePrefix + time + o.timeSuffix;
+ }
+
+ return time;
+};
+
+
+/**
+ * showOptions
+ *
+ * Pass a layout-options object, and the pane/key you want to display
+ */
+function showOptions (Layout, key, debugOpts) {
+ var data = Layout.options;
+ $.each(key.split("."), function() {
+ data = data[this]; // recurse through multiple key-levels
+ });
+ debugData( data, 'options.'+key, debugOpts );
+};
+
+/**
+ * showState
+ *
+ * Pass a layout-options object, and the pane/key you want to display
+ */
+function showState (Layout, key, debugOpts) {
+ var data = Layout.state;
+ $.each(key.split("."), function() {
+ data = data[this]; // recurse through multiple key-levels
+ });
+ debugData( data, 'state.'+key, debugOpts );
+};
+
+
+
+
+function debugWindow ( content, options ) {
+ var defaults = {
+ css: {
+ position: 'fixed'
+ , top: 0
+ }
+ };
+ $.extend( true, (options || {}), defaults );
+ var $W = $('<div></div>')
+ .html( content.replace(/\n/g, '<br>').replace(/ /g, ' &nbsp;') ) // format as HTML
+ .css( options.css )
+ ;
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery-latest.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery-latest.js
new file mode 100644
index 00000000..1c998bab
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery-latest.js
@@ -0,0 +1,9555 @@
+/*!
+ * jQuery JavaScript Library v1.9.0
+ * http://jquery.com/
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ *
+ * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2013-1-14
+ */
+(function( window, undefined ) {
+"use strict";
+var
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // The deferred used on DOM ready
+ readyList,
+
+ // Use the correct document accordingly with window argument (sandbox)
+ document = window.document,
+ location = window.location,
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // [[Class]] -> type pairs
+ class2type = {},
+
+ // List of deleted data cache ids, so we can reuse them
+ core_deletedIds = [],
+
+ core_version = "1.9.0",
+
+ // Save a reference to some core methods
+ core_concat = core_deletedIds.concat,
+ core_push = core_deletedIds.push,
+ core_slice = core_deletedIds.slice,
+ core_indexOf = core_deletedIds.indexOf,
+ core_toString = class2type.toString,
+ core_hasOwn = class2type.hasOwnProperty,
+ core_trim = core_version.trim,
+
+ // Define a local copy of jQuery
+ jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context, rootjQuery );
+ },
+
+ // Used for matching numbers
+ core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
+
+ // Used for splitting on whitespace
+ core_rnotwhite = /\S+/g,
+
+ // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
+
+ // A simple way to check for HTML strings
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
+ // Strict HTML recognition (#11290: must start with <)
+ rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
+
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
+
+ // Matches dashed string for camelizing
+ rmsPrefix = /^-ms-/,
+ rdashAlpha = /-([\da-z])/gi,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return letter.toUpperCase();
+ },
+
+ // The ready event handler and self cleanup method
+ DOMContentLoaded = function() {
+ if ( document.addEventListener ) {
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+ jQuery.ready();
+ } else if ( document.readyState === "complete" ) {
+ // we're here because readyState === "complete" in oldIE
+ // which is good enough for us to call the dom ready!
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
+ jQuery.ready();
+ }
+ };
+
+jQuery.fn = jQuery.prototype = {
+ // The current version of jQuery being used
+ jquery: core_version,
+
+ constructor: jQuery,
+ init: function( selector, context, rootjQuery ) {
+ var match, elem;
+
+ // HANDLE: $(""), $(null), $(undefined), $(false)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+ // Assume that strings that start and end with <> are HTML and skip the regex check
+ match = [ null, selector, null ];
+
+ } else {
+ match = rquickExpr.exec( selector );
+ }
+
+ // Match html or make sure no context is specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ context = context instanceof jQuery ? context[0] : context;
+
+ // scripts is true for back-compat
+ jQuery.merge( this, jQuery.parseHTML(
+ match[1],
+ context && context.nodeType ? context.ownerDocument || context : document,
+ true
+ ) );
+
+ // HANDLE: $(html, props)
+ if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
+ for ( match in context ) {
+ // Properties of context are called as methods if possible
+ if ( jQuery.isFunction( this[ match ] ) ) {
+ this[ match ]( context[ match ] );
+
+ // ...and otherwise set as attributes
+ } else {
+ this.attr( match, context[ match ] );
+ }
+ }
+ }
+
+ return this;
+
+ // HANDLE: $(#id)
+ } else {
+ elem = document.getElementById( match[2] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return ( context || rootjQuery ).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return this.constructor( context ).find( selector );
+ }
+
+ // HANDLE: $(DOMElement)
+ } else if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
+
+ if ( selector.selector !== undefined ) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.makeArray( selector, this );
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ toArray: function() {
+ return core_slice.call( this );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == null ?
+
+ // Return a 'clean' array
+ this.toArray() :
+
+ // Return just the object
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems ) {
+
+ // Build a new jQuery matched element set
+ var ret = jQuery.merge( this.constructor(), elems );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+ ret.context = this.context;
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ ready: function( fn ) {
+ // Add the callback
+ jQuery.ready.promise().done( fn );
+
+ return this;
+ },
+
+ slice: function() {
+ return this.pushStack( core_slice.apply( this, arguments ) );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ eq: function( i ) {
+ var len = this.length,
+ j = +i + ( i < 0 ? len : 0 );
+ return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ end: function() {
+ return this.prevObject || this.constructor(null);
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: core_push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+ var options, name, src, copy, copyIsArray, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
+
+ // extend jQuery itself if only one argument is passed
+ if ( length === i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && jQuery.isArray(src) ? src : [];
+
+ } else {
+ clone = src && jQuery.isPlainObject(src) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ if ( window.$ === jQuery ) {
+ window.$ = _$;
+ }
+
+ if ( deep && window.jQuery === jQuery ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
+ },
+
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // A counter to track how many items to wait for before
+ // the ready event fires. See #6781
+ readyWait: 1,
+
+ // Hold (or release) the ready event
+ holdReady: function( hold ) {
+ if ( hold ) {
+ jQuery.readyWait++;
+ } else {
+ jQuery.ready( true );
+ }
+ },
+
+ // Handle when the DOM is ready
+ ready: function( wait ) {
+
+ // Abort if there are pending holds or we're already ready
+ if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
+ return;
+ }
+
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready );
+ }
+
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If a normal DOM Ready event fired, decrement, and wait if need be
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
+ return;
+ }
+
+ // If there are functions bound, to execute
+ readyList.resolveWith( document, [ jQuery ] );
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger("ready").off("ready");
+ }
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return jQuery.type(obj) === "function";
+ },
+
+ isArray: Array.isArray || function( obj ) {
+ return jQuery.type(obj) === "array";
+ },
+
+ isWindow: function( obj ) {
+ return obj != null && obj == obj.window;
+ },
+
+ isNumeric: function( obj ) {
+ return !isNaN( parseFloat(obj) ) && isFinite( obj );
+ },
+
+ type: function( obj ) {
+ if ( obj == null ) {
+ return String( obj );
+ }
+ return typeof obj === "object" || typeof obj === "function" ?
+ class2type[ core_toString.call(obj) ] || "object" :
+ typeof obj;
+ },
+
+ isPlainObject: function( obj ) {
+ // Must be an Object.
+ // Because of IE, we also have to check the presence of the constructor property.
+ // Make sure that DOM nodes and window objects don't pass through, as well
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ try {
+ // Not own constructor property must be Object
+ if ( obj.constructor &&
+ !core_hasOwn.call(obj, "constructor") &&
+ !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+ } catch ( e ) {
+ // IE8,9 Will throw exceptions on certain host objects #9897
+ return false;
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+
+ var key;
+ for ( key in obj ) {}
+
+ return key === undefined || core_hasOwn.call( obj, key );
+ },
+
+ isEmptyObject: function( obj ) {
+ var name;
+ for ( name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ error: function( msg ) {
+ throw new Error( msg );
+ },
+
+ // data: string of html
+ // context (optional): If specified, the fragment will be created in this context, defaults to document
+ // keepScripts (optional): If true, will include scripts passed in the html string
+ parseHTML: function( data, context, keepScripts ) {
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ if ( typeof context === "boolean" ) {
+ keepScripts = context;
+ context = false;
+ }
+ context = context || document;
+
+ var parsed = rsingleTag.exec( data ),
+ scripts = !keepScripts && [];
+
+ // Single tag
+ if ( parsed ) {
+ return [ context.createElement( parsed[1] ) ];
+ }
+
+ parsed = jQuery.buildFragment( [ data ], context, scripts );
+ if ( scripts ) {
+ jQuery( scripts ).remove();
+ }
+ return jQuery.merge( [], parsed.childNodes );
+ },
+
+ parseJSON: function( data ) {
+ // Attempt to parse using the native JSON parser first
+ if ( window.JSON && window.JSON.parse ) {
+ return window.JSON.parse( data );
+ }
+
+ if ( data === null ) {
+ return data;
+ }
+
+ if ( typeof data === "string" ) {
+
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
+ data = jQuery.trim( data );
+
+ if ( data ) {
+ // Make sure the incoming data is actual JSON
+ // Logic borrowed from http://json.org/json2.js
+ if ( rvalidchars.test( data.replace( rvalidescape, "@" )
+ .replace( rvalidtokens, "]" )
+ .replace( rvalidbraces, "")) ) {
+
+ return ( new Function( "return " + data ) )();
+ }
+ }
+ }
+
+ jQuery.error( "Invalid JSON: " + data );
+ },
+
+ // Cross-browser xml parsing
+ parseXML: function( data ) {
+ var xml, tmp;
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ try {
+ if ( window.DOMParser ) { // Standard
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } else { // IE
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
+ xml.async = "false";
+ xml.loadXML( data );
+ }
+ } catch( e ) {
+ xml = undefined;
+ }
+ if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
+ jQuery.error( "Invalid XML: " + data );
+ }
+ return xml;
+ },
+
+ noop: function() {},
+
+ // Evaluates a script in a global context
+ // Workarounds based on findings by Jim Driscoll
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
+ globalEval: function( data ) {
+ if ( data && jQuery.trim( data ) ) {
+ // We use execScript on Internet Explorer
+ // We use an anonymous function so that context is window
+ // rather than jQuery in Firefox
+ ( window.execScript || function( data ) {
+ window[ "eval" ].call( window, data );
+ } )( data );
+ }
+ },
+
+ // Convert dashed to camelCase; used by the css and data modules
+ // Microsoft forgot to hump their vendor prefix (#9572)
+ camelCase: function( string ) {
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
+ },
+
+ // args is for internal usage only
+ each: function( obj, callback, args ) {
+ var value,
+ i = 0,
+ length = obj.length,
+ isArray = isArraylike( obj );
+
+ if ( args ) {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+ }
+
+ return obj;
+ },
+
+ // Use native String.trim function wherever possible
+ trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
+ function( text ) {
+ return text == null ?
+ "" :
+ core_trim.call( text );
+ } :
+
+ // Otherwise use our own trimming functionality
+ function( text ) {
+ return text == null ?
+ "" :
+ ( text + "" ).replace( rtrim, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( arr, results ) {
+ var ret = results || [];
+
+ if ( arr != null ) {
+ if ( isArraylike( Object(arr) ) ) {
+ jQuery.merge( ret,
+ typeof arr === "string" ?
+ [ arr ] : arr
+ );
+ } else {
+ core_push.call( ret, arr );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, arr, i ) {
+ var len;
+
+ if ( arr ) {
+ if ( core_indexOf ) {
+ return core_indexOf.call( arr, elem, i );
+ }
+
+ len = arr.length;
+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
+
+ for ( ; i < len; i++ ) {
+ // Skip accessing in sparse arrays
+ if ( i in arr && arr[ i ] === elem ) {
+ return i;
+ }
+ }
+ }
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ var l = second.length,
+ i = first.length,
+ j = 0;
+
+ if ( typeof l === "number" ) {
+ for ( ; j < l; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+ } else {
+ while ( second[j] !== undefined ) {
+ first[ i++ ] = second[ j++ ];
+ }
+ }
+
+ first.length = i;
+
+ return first;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var retVal,
+ ret = [],
+ i = 0,
+ length = elems.length;
+ inv = !!inv;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( ; i < length; i++ ) {
+ retVal = !!callback( elems[ i ], i );
+ if ( inv !== retVal ) {
+ ret.push( elems[ i ] );
+ }
+ }
+
+ return ret;
+ },
+
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var value,
+ i = 0,
+ length = elems.length,
+ isArray = isArraylike( elems ),
+ ret = [];
+
+ // Go through the array, translating each of the items to their
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+
+ // Go through every key on the object,
+ } else {
+ for ( i in elems ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+ }
+
+ // Flatten any nested arrays
+ return core_concat.apply( [], ret );
+ },
+
+ // A global GUID counter for objects
+ guid: 1,
+
+ // Bind a function to a context, optionally partially applying any
+ // arguments.
+ proxy: function( fn, context ) {
+ var tmp, args, proxy;
+
+ if ( typeof context === "string" ) {
+ tmp = fn[ context ];
+ context = fn;
+ fn = tmp;
+ }
+
+ // Quick check to determine if target is callable, in the spec
+ // this throws a TypeError, but we will just return undefined.
+ if ( !jQuery.isFunction( fn ) ) {
+ return undefined;
+ }
+
+ // Simulated bind
+ args = core_slice.call( arguments, 2 );
+ proxy = function() {
+ return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
+ };
+
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || jQuery.guid++;
+
+ return proxy;
+ },
+
+ // Multifunctional method to get and set values of a collection
+ // The value/s can optionally be executed if it's a function
+ access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
+ var i = 0,
+ length = elems.length,
+ bulk = key == null;
+
+ // Sets many values
+ if ( jQuery.type( key ) === "object" ) {
+ chainable = true;
+ for ( i in key ) {
+ jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
+ }
+
+ // Sets one value
+ } else if ( value !== undefined ) {
+ chainable = true;
+
+ if ( !jQuery.isFunction( value ) ) {
+ raw = true;
+ }
+
+ if ( bulk ) {
+ // Bulk operations run against the entire set
+ if ( raw ) {
+ fn.call( elems, value );
+ fn = null;
+
+ // ...except when executing function values
+ } else {
+ bulk = fn;
+ fn = function( elem, key, value ) {
+ return bulk.call( jQuery( elem ), value );
+ };
+ }
+ }
+
+ if ( fn ) {
+ for ( ; i < length; i++ ) {
+ fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
+ }
+ }
+ }
+
+ return chainable ?
+ elems :
+
+ // Gets
+ bulk ?
+ fn.call( elems ) :
+ length ? fn( elems[0], key ) : emptyGet;
+ },
+
+ now: function() {
+ return ( new Date() ).getTime();
+ }
+});
+
+jQuery.ready.promise = function( obj ) {
+ if ( !readyList ) {
+
+ readyList = jQuery.Deferred();
+
+ // Catch cases where $(document).ready() is called after the browser event has already occurred.
+ // we once tried to use readyState "interactive" here, but it caused issues like the one
+ // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
+ if ( document.readyState === "complete" ) {
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ setTimeout( jQuery.ready );
+
+ // Standards-based browsers support DOMContentLoaded
+ } else if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", jQuery.ready, false );
+
+ // If IE event model is used
+ } else {
+ // Ensure firing before onload, maybe late but safe also for iframes
+ document.attachEvent( "onreadystatechange", DOMContentLoaded );
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", jQuery.ready );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var top = false;
+
+ try {
+ top = window.frameElement == null && document.documentElement;
+ } catch(e) {}
+
+ if ( top && top.doScroll ) {
+ (function doScrollCheck() {
+ if ( !jQuery.isReady ) {
+
+ try {
+ // Use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ top.doScroll("left");
+ } catch(e) {
+ return setTimeout( doScrollCheck, 50 );
+ }
+
+ // and execute any waiting functions
+ jQuery.ready();
+ }
+ })();
+ }
+ }
+ }
+ return readyList.promise( obj );
+};
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+function isArraylike( obj ) {
+ var length = obj.length,
+ type = jQuery.type( obj );
+
+ if ( jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ if ( obj.nodeType === 1 && length ) {
+ return true;
+ }
+
+ return type === "array" || type !== "function" &&
+ ( length === 0 ||
+ typeof length === "number" && length > 0 && ( length - 1 ) in obj );
+}
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+// String to Object options format cache
+var optionsCache = {};
+
+// Convert String-formatted options into Object-formatted ones and store in cache
+function createOptions( options ) {
+ var object = optionsCache[ options ] = {};
+ jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
+ object[ flag ] = true;
+ });
+ return object;
+}
+
+/*
+ * Create a callback list using the following parameters:
+ *
+ * options: an optional list of space-separated options that will change how
+ * the callback list behaves or a more traditional option object
+ *
+ * By default a callback list will act like an event callback list and can be
+ * "fired" multiple times.
+ *
+ * Possible options:
+ *
+ * once: will ensure the callback list can only be fired once (like a Deferred)
+ *
+ * memory: will keep track of previous values and will call any callback added
+ * after the list has been fired right away with the latest "memorized"
+ * values (like a Deferred)
+ *
+ * unique: will ensure a callback can only be added once (no duplicate in the list)
+ *
+ * stopOnFalse: interrupt callings when a callback returns false
+ *
+ */
+jQuery.Callbacks = function( options ) {
+
+ // Convert options from String-formatted to Object-formatted if needed
+ // (we check in cache first)
+ options = typeof options === "string" ?
+ ( optionsCache[ options ] || createOptions( options ) ) :
+ jQuery.extend( {}, options );
+
+ var // Last fire value (for non-forgettable lists)
+ memory,
+ // Flag to know if list was already fired
+ fired,
+ // Flag to know if list is currently firing
+ firing,
+ // First callback to fire (used internally by add and fireWith)
+ firingStart,
+ // End of the loop when firing
+ firingLength,
+ // Index of currently firing callback (modified by remove if needed)
+ firingIndex,
+ // Actual callback list
+ list = [],
+ // Stack of fire calls for repeatable lists
+ stack = !options.once && [],
+ // Fire callbacks
+ fire = function( data ) {
+ memory = options.memory && data;
+ fired = true;
+ firingIndex = firingStart || 0;
+ firingStart = 0;
+ firingLength = list.length;
+ firing = true;
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+ if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
+ memory = false; // To prevent further calls using add
+ break;
+ }
+ }
+ firing = false;
+ if ( list ) {
+ if ( stack ) {
+ if ( stack.length ) {
+ fire( stack.shift() );
+ }
+ } else if ( memory ) {
+ list = [];
+ } else {
+ self.disable();
+ }
+ }
+ },
+ // Actual Callbacks object
+ self = {
+ // Add a callback or a collection of callbacks to the list
+ add: function() {
+ if ( list ) {
+ // First, we save the current length
+ var start = list.length;
+ (function add( args ) {
+ jQuery.each( args, function( _, arg ) {
+ var type = jQuery.type( arg );
+ if ( type === "function" ) {
+ if ( !options.unique || !self.has( arg ) ) {
+ list.push( arg );
+ }
+ } else if ( arg && arg.length && type !== "string" ) {
+ // Inspect recursively
+ add( arg );
+ }
+ });
+ })( arguments );
+ // Do we need to add the callbacks to the
+ // current firing batch?
+ if ( firing ) {
+ firingLength = list.length;
+ // With memory, if we're not firing then
+ // we should call right away
+ } else if ( memory ) {
+ firingStart = start;
+ fire( memory );
+ }
+ }
+ return this;
+ },
+ // Remove a callback from the list
+ remove: function() {
+ if ( list ) {
+ jQuery.each( arguments, function( _, arg ) {
+ var index;
+ while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
+ list.splice( index, 1 );
+ // Handle firing indexes
+ if ( firing ) {
+ if ( index <= firingLength ) {
+ firingLength--;
+ }
+ if ( index <= firingIndex ) {
+ firingIndex--;
+ }
+ }
+ }
+ });
+ }
+ return this;
+ },
+ // Control if a given callback is in the list
+ has: function( fn ) {
+ return jQuery.inArray( fn, list ) > -1;
+ },
+ // Remove all callbacks from the list
+ empty: function() {
+ list = [];
+ return this;
+ },
+ // Have the list do nothing anymore
+ disable: function() {
+ list = stack = memory = undefined;
+ return this;
+ },
+ // Is it disabled?
+ disabled: function() {
+ return !list;
+ },
+ // Lock the list in its current state
+ lock: function() {
+ stack = undefined;
+ if ( !memory ) {
+ self.disable();
+ }
+ return this;
+ },
+ // Is it locked?
+ locked: function() {
+ return !stack;
+ },
+ // Call all callbacks with the given context and arguments
+ fireWith: function( context, args ) {
+ args = args || [];
+ args = [ context, args.slice ? args.slice() : args ];
+ if ( list && ( !fired || stack ) ) {
+ if ( firing ) {
+ stack.push( args );
+ } else {
+ fire( args );
+ }
+ }
+ return this;
+ },
+ // Call all the callbacks with the given arguments
+ fire: function() {
+ self.fireWith( this, arguments );
+ return this;
+ },
+ // To know if the callbacks have already been called at least once
+ fired: function() {
+ return !!fired;
+ }
+ };
+
+ return self;
+};
+jQuery.extend({
+
+ Deferred: function( func ) {
+ var tuples = [
+ // action, add listener, listener list, final state
+ [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
+ [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
+ [ "notify", "progress", jQuery.Callbacks("memory") ]
+ ],
+ state = "pending",
+ promise = {
+ state: function() {
+ return state;
+ },
+ always: function() {
+ deferred.done( arguments ).fail( arguments );
+ return this;
+ },
+ then: function( /* fnDone, fnFail, fnProgress */ ) {
+ var fns = arguments;
+ return jQuery.Deferred(function( newDefer ) {
+ jQuery.each( tuples, function( i, tuple ) {
+ var action = tuple[ 0 ],
+ fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
+ // deferred[ done | fail | progress ] for forwarding actions to newDefer
+ deferred[ tuple[1] ](function() {
+ var returned = fn && fn.apply( this, arguments );
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
+ returned.promise()
+ .done( newDefer.resolve )
+ .fail( newDefer.reject )
+ .progress( newDefer.notify );
+ } else {
+ newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
+ }
+ });
+ });
+ fns = null;
+ }).promise();
+ },
+ // Get a promise for this deferred
+ // If obj is provided, the promise aspect is added to the object
+ promise: function( obj ) {
+ return obj != null ? jQuery.extend( obj, promise ) : promise;
+ }
+ },
+ deferred = {};
+
+ // Keep pipe for back-compat
+ promise.pipe = promise.then;
+
+ // Add list-specific methods
+ jQuery.each( tuples, function( i, tuple ) {
+ var list = tuple[ 2 ],
+ stateString = tuple[ 3 ];
+
+ // promise[ done | fail | progress ] = list.add
+ promise[ tuple[1] ] = list.add;
+
+ // Handle state
+ if ( stateString ) {
+ list.add(function() {
+ // state = [ resolved | rejected ]
+ state = stateString;
+
+ // [ reject_list | resolve_list ].disable; progress_list.lock
+ }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
+ }
+
+ // deferred[ resolve | reject | notify ]
+ deferred[ tuple[0] ] = function() {
+ deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
+ return this;
+ };
+ deferred[ tuple[0] + "With" ] = list.fireWith;
+ });
+
+ // Make the deferred a promise
+ promise.promise( deferred );
+
+ // Call given func if any
+ if ( func ) {
+ func.call( deferred, deferred );
+ }
+
+ // All done!
+ return deferred;
+ },
+
+ // Deferred helper
+ when: function( subordinate /* , ..., subordinateN */ ) {
+ var i = 0,
+ resolveValues = core_slice.call( arguments ),
+ length = resolveValues.length,
+
+ // the count of uncompleted subordinates
+ remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
+
+ // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
+ deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
+
+ // Update function for both resolve and progress values
+ updateFunc = function( i, contexts, values ) {
+ return function( value ) {
+ contexts[ i ] = this;
+ values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
+ if( values === progressValues ) {
+ deferred.notifyWith( contexts, values );
+ } else if ( !( --remaining ) ) {
+ deferred.resolveWith( contexts, values );
+ }
+ };
+ },
+
+ progressValues, progressContexts, resolveContexts;
+
+ // add listeners to Deferred subordinates; treat others as resolved
+ if ( length > 1 ) {
+ progressValues = new Array( length );
+ progressContexts = new Array( length );
+ resolveContexts = new Array( length );
+ for ( ; i < length; i++ ) {
+ if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
+ resolveValues[ i ].promise()
+ .done( updateFunc( i, resolveContexts, resolveValues ) )
+ .fail( deferred.reject )
+ .progress( updateFunc( i, progressContexts, progressValues ) );
+ } else {
+ --remaining;
+ }
+ }
+ }
+
+ // if we're not waiting on anything, resolve the master
+ if ( !remaining ) {
+ deferred.resolveWith( resolveContexts, resolveValues );
+ }
+
+ return deferred.promise();
+ }
+});
+jQuery.support = (function() {
+
+ var support, all, a, select, opt, input, fragment, eventName, isSupported, i,
+ div = document.createElement("div");
+
+ // Setup
+ div.setAttribute( "className", "t" );
+ div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+
+ // Support tests won't run in some limited or non-browser environments
+ all = div.getElementsByTagName("*");
+ a = div.getElementsByTagName("a")[ 0 ];
+ if ( !all || !a || !all.length ) {
+ return {};
+ }
+
+ // First batch of tests
+ select = document.createElement("select");
+ opt = select.appendChild( document.createElement("option") );
+ input = div.getElementsByTagName("input")[ 0 ];
+
+ a.style.cssText = "top:1px;float:left;opacity:.5";
+ support = {
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+ getSetAttribute: div.className !== "t",
+
+ // IE strips leading whitespace when .innerHTML is used
+ leadingWhitespace: div.firstChild.nodeType === 3,
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ tbody: !div.getElementsByTagName("tbody").length,
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ htmlSerialize: !!div.getElementsByTagName("link").length,
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText instead)
+ style: /top/.test( a.getAttribute("style") ),
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ hrefNormalized: a.getAttribute("href") === "/a",
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ // Use a regex to work around a WebKit issue. See #5145
+ opacity: /^0.5/.test( a.style.opacity ),
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ cssFloat: !!a.style.cssFloat,
+
+ // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
+ checkOn: !!input.value,
+
+ // Make sure that a selected-by-default option has a working selected property.
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+ optSelected: opt.selected,
+
+ // Tests for enctype support on a form (#6743)
+ enctype: !!document.createElement("form").enctype,
+
+ // Makes sure cloning an html5 element does not cause problems
+ // Where outerHTML is undefined, this still works
+ html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
+
+ // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
+ boxModel: document.compatMode === "CSS1Compat",
+
+ // Will be defined later
+ deleteExpando: true,
+ noCloneEvent: true,
+ inlineBlockNeedsLayout: false,
+ shrinkWrapBlocks: false,
+ reliableMarginRight: true,
+ boxSizingReliable: true,
+ pixelPosition: false
+ };
+
+ // Make sure checked status is properly cloned
+ input.checked = true;
+ support.noCloneChecked = input.cloneNode( true ).checked;
+
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as disabled)
+ select.disabled = true;
+ support.optDisabled = !opt.disabled;
+
+ // Support: IE<9
+ try {
+ delete div.test;
+ } catch( e ) {
+ support.deleteExpando = false;
+ }
+
+ // Check if we can trust getAttribute("value")
+ input = document.createElement("input");
+ input.setAttribute( "value", "" );
+ support.input = input.getAttribute( "value" ) === "";
+
+ // Check if an input maintains its value after becoming a radio
+ input.value = "t";
+ input.setAttribute( "type", "radio" );
+ support.radioValue = input.value === "t";
+
+ // #11217 - WebKit loses check when the name is after the checked attribute
+ input.setAttribute( "checked", "t" );
+ input.setAttribute( "name", "t" );
+
+ fragment = document.createDocumentFragment();
+ fragment.appendChild( input );
+
+ // Check if a disconnected checkbox will retain its checked
+ // value of true after appended to the DOM (IE6/7)
+ support.appendChecked = input.checked;
+
+ // WebKit doesn't clone checked state correctly in fragments
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+ // Support: IE<9
+ // Opera does not clone events (and typeof div.attachEvent === undefined).
+ // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
+ if ( div.attachEvent ) {
+ div.attachEvent( "onclick", function() {
+ support.noCloneEvent = false;
+ });
+
+ div.cloneNode( true ).click();
+ }
+
+ // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
+ // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
+ for ( i in { submit: true, change: true, focusin: true }) {
+ div.setAttribute( eventName = "on" + i, "t" );
+
+ support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
+ }
+
+ div.style.backgroundClip = "content-box";
+ div.cloneNode( true ).style.backgroundClip = "";
+ support.clearCloneStyle = div.style.backgroundClip === "content-box";
+
+ // Run tests that need a body at doc ready
+ jQuery(function() {
+ var container, marginDiv, tds,
+ divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
+ body = document.getElementsByTagName("body")[0];
+
+ if ( !body ) {
+ // Return for frameset docs that don't have a body
+ return;
+ }
+
+ container = document.createElement("div");
+ container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
+
+ body.appendChild( container ).appendChild( div );
+
+ // Support: IE8
+ // Check if table cells still have offsetWidth/Height when they are set
+ // to display:none and there are still other visible table cells in a
+ // table row; if so, offsetWidth/Height are not reliable for use when
+ // determining if an element has been hidden directly using
+ // display:none (it is still safe to use offsets if a parent element is
+ // hidden; don safety goggles and see bug #4512 for more information).
+ div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
+ tds = div.getElementsByTagName("td");
+ tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+ tds[ 0 ].style.display = "";
+ tds[ 1 ].style.display = "none";
+
+ // Support: IE8
+ // Check if empty table cells still have offsetWidth/Height
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+ // Check box-sizing and margin behavior
+ div.innerHTML = "";
+ div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
+ support.boxSizing = ( div.offsetWidth === 4 );
+ support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
+
+ // Use window.getComputedStyle because jsdom on node.js will break without it.
+ if ( window.getComputedStyle ) {
+ support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
+ support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
+
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. (#3333)
+ // Fails in WebKit before Feb 2011 nightlies
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ marginDiv = div.appendChild( document.createElement("div") );
+ marginDiv.style.cssText = div.style.cssText = divReset;
+ marginDiv.style.marginRight = marginDiv.style.width = "0";
+ div.style.width = "1px";
+
+ support.reliableMarginRight =
+ !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
+ }
+
+ if ( typeof div.style.zoom !== "undefined" ) {
+ // Support: IE<8
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ div.innerHTML = "";
+ div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
+
+ // Support: IE6
+ // Check if elements with layout shrink-wrap their children
+ div.style.display = "block";
+ div.innerHTML = "<div></div>";
+ div.firstChild.style.width = "5px";
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
+
+ // Prevent IE 6 from affecting layout for positioned elements #11048
+ // Prevent IE from shrinking the body in IE 7 mode #12869
+ body.style.zoom = 1;
+ }
+
+ body.removeChild( container );
+
+ // Null elements to avoid leaks in IE
+ container = div = tds = marginDiv = null;
+ });
+
+ // Null elements to avoid leaks in IE
+ all = select = fragment = opt = a = input = null;
+
+ return support;
+})();
+
+var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
+ rmultiDash = /([A-Z])/g;
+
+function internalData( elem, name, data, pvt /* Internal Use Only */ ){
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var thisCache, ret,
+ internalKey = jQuery.expando,
+ getByName = typeof name === "string",
+
+ // We have to handle DOM nodes and JS objects differently because IE6-7
+ // can't GC object references properly across the DOM-JS boundary
+ isNode = elem.nodeType,
+
+ // Only DOM nodes need the global jQuery cache; JS object data is
+ // attached directly to the object so GC can occur automatically
+ cache = isNode ? jQuery.cache : elem,
+
+ // Only defining an ID for JS objects if its cache already exists allows
+ // the code to shortcut on the same path as a DOM node with no cache
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
+
+ // Avoid doing any more work than we need to when trying to get data on an
+ // object that has no data at all
+ if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
+ return;
+ }
+
+ if ( !id ) {
+ // Only DOM nodes need a new unique ID for each element since their data
+ // ends up in the global cache
+ if ( isNode ) {
+ elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++;
+ } else {
+ id = internalKey;
+ }
+ }
+
+ if ( !cache[ id ] ) {
+ cache[ id ] = {};
+
+ // Avoids exposing jQuery metadata on plain JS objects when the object
+ // is serialized using JSON.stringify
+ if ( !isNode ) {
+ cache[ id ].toJSON = jQuery.noop;
+ }
+ }
+
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
+ // shallow copied over onto the existing cache
+ if ( typeof name === "object" || typeof name === "function" ) {
+ if ( pvt ) {
+ cache[ id ] = jQuery.extend( cache[ id ], name );
+ } else {
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
+ }
+ }
+
+ thisCache = cache[ id ];
+
+ // jQuery data() is stored in a separate object inside the object's internal data
+ // cache in order to avoid key collisions between internal data and user-defined
+ // data.
+ if ( !pvt ) {
+ if ( !thisCache.data ) {
+ thisCache.data = {};
+ }
+
+ thisCache = thisCache.data;
+ }
+
+ if ( data !== undefined ) {
+ thisCache[ jQuery.camelCase( name ) ] = data;
+ }
+
+ // Check for both converted-to-camel and non-converted data property names
+ // If a data property was specified
+ if ( getByName ) {
+
+ // First Try to find as-is property data
+ ret = thisCache[ name ];
+
+ // Test for null|undefined property data
+ if ( ret == null ) {
+
+ // Try to find the camelCased property
+ ret = thisCache[ jQuery.camelCase( name ) ];
+ }
+ } else {
+ ret = thisCache;
+ }
+
+ return ret;
+}
+
+function internalRemoveData( elem, name, pvt /* For internal use only */ ){
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var thisCache, i, l,
+
+ isNode = elem.nodeType,
+
+ // See jQuery.data for more information
+ cache = isNode ? jQuery.cache : elem,
+ id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
+
+ // If there is already no cache entry for this object, there is no
+ // purpose in continuing
+ if ( !cache[ id ] ) {
+ return;
+ }
+
+ if ( name ) {
+
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
+
+ if ( thisCache ) {
+
+ // Support array or space separated string names for data keys
+ if ( !jQuery.isArray( name ) ) {
+
+ // try the string as a key before any manipulation
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+
+ // split the camel cased version by spaces unless a key with the spaces exists
+ name = jQuery.camelCase( name );
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+ name = name.split(" ");
+ }
+ }
+ } else {
+ // If "name" is an array of keys...
+ // When data is initially created, via ("key", "val") signature,
+ // keys will be converted to camelCase.
+ // Since there is no way to tell _how_ a key was added, remove
+ // both plain key and camelCase key. #12786
+ // This will only penalize the array argument path.
+ name = name.concat( jQuery.map( name, jQuery.camelCase ) );
+ }
+
+ for ( i = 0, l = name.length; i < l; i++ ) {
+ delete thisCache[ name[i] ];
+ }
+
+ // If there is no data left in the cache, we want to continue
+ // and let the cache object itself get destroyed
+ if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
+ return;
+ }
+ }
+ }
+
+ // See jQuery.data for more information
+ if ( !pvt ) {
+ delete cache[ id ].data;
+
+ // Don't destroy the parent cache unless the internal data object
+ // had been the only thing left in it
+ if ( !isEmptyDataObject( cache[ id ] ) ) {
+ return;
+ }
+ }
+
+ // Destroy the cache
+ if ( isNode ) {
+ jQuery.cleanData( [ elem ], true );
+
+ // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
+ } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
+ delete cache[ id ];
+
+ // When all else fails, null
+ } else {
+ cache[ id ] = null;
+ }
+}
+
+jQuery.extend({
+ cache: {},
+
+ // Unique for each copy of jQuery on the page
+ // Non-digits removed to match rinlinejQuery
+ expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "embed": true,
+ // Ban all objects except for Flash (which handle expandos)
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
+ "applet": true
+ },
+
+ hasData: function( elem ) {
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+ return !!elem && !isEmptyDataObject( elem );
+ },
+
+ data: function( elem, name, data ) {
+ return internalData( elem, name, data, false );
+ },
+
+ removeData: function( elem, name ) {
+ return internalRemoveData( elem, name, false );
+ },
+
+ // For internal use only.
+ _data: function( elem, name, data ) {
+ return internalData( elem, name, data, true );
+ },
+
+ _removeData: function( elem, name ) {
+ return internalRemoveData( elem, name, true );
+ },
+
+ // A method for determining if a DOM node can handle the data expando
+ acceptData: function( elem ) {
+ var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+ // nodes accept data unless otherwise specified; rejection can be conditional
+ return !noData || noData !== true && elem.getAttribute("classid") === noData;
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ var attrs, name,
+ elem = this[0],
+ i = 0,
+ data = null;
+
+ // Gets all values
+ if ( key === undefined ) {
+ if ( this.length ) {
+ data = jQuery.data( elem );
+
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
+ attrs = elem.attributes;
+ for ( ; i < attrs.length; i++ ) {
+ name = attrs[i].name;
+
+ if ( !name.indexOf( "data-" ) ) {
+ name = jQuery.camelCase( name.substring(5) );
+
+ dataAttr( elem, name, data[ name ] );
+ }
+ }
+ jQuery._data( elem, "parsedAttrs", true );
+ }
+ }
+
+ return data;
+ }
+
+ // Sets multiple values
+ if ( typeof key === "object" ) {
+ return this.each(function() {
+ jQuery.data( this, key );
+ });
+ }
+
+ return jQuery.access( this, function( value ) {
+
+ if ( value === undefined ) {
+ // Try to fetch any internally stored data first
+ return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
+ }
+
+ this.each(function() {
+ jQuery.data( this, key, value );
+ });
+ }, null, value, arguments.length > 1, null, true );
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ jQuery.removeData( this, key );
+ });
+ }
+});
+
+function dataAttr( elem, key, data ) {
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
+
+ data = elem.getAttribute( name );
+
+ if ( typeof data === "string" ) {
+ try {
+ data = data === "true" ? true :
+ data === "false" ? false :
+ data === "null" ? null :
+ // Only convert to a number if it doesn't change the string
+ +data + "" === data ? +data :
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ jQuery.data( elem, key, data );
+
+ } else {
+ data = undefined;
+ }
+ }
+
+ return data;
+}
+
+// checks a cache object for emptiness
+function isEmptyDataObject( obj ) {
+ var name;
+ for ( name in obj ) {
+
+ // if the public data object is empty, the private is still empty
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
+ continue;
+ }
+ if ( name !== "toJSON" ) {
+ return false;
+ }
+ }
+
+ return true;
+}
+jQuery.extend({
+ queue: function( elem, type, data ) {
+ var queue;
+
+ if ( elem ) {
+ type = ( type || "fx" ) + "queue";
+ queue = jQuery._data( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !queue || jQuery.isArray(data) ) {
+ queue = jQuery._data( elem, type, jQuery.makeArray(data) );
+ } else {
+ queue.push( data );
+ }
+ }
+ return queue || [];
+ }
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ),
+ startLength = queue.length,
+ fn = queue.shift(),
+ hooks = jQuery._queueHooks( elem, type ),
+ next = function() {
+ jQuery.dequeue( elem, type );
+ };
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ startLength--;
+ }
+
+ hooks.cur = fn;
+ if ( fn ) {
+
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift( "inprogress" );
+ }
+
+ // clear up the last queue stop function
+ delete hooks.stop;
+ fn.call( elem, next, hooks );
+ }
+
+ if ( !startLength && hooks ) {
+ hooks.empty.fire();
+ }
+ },
+
+ // not intended for public consumption - generates a queueHooks object, or returns the current one
+ _queueHooks: function( elem, type ) {
+ var key = type + "queueHooks";
+ return jQuery._data( elem, key ) || jQuery._data( elem, key, {
+ empty: jQuery.Callbacks("once memory").add(function() {
+ jQuery._removeData( elem, type + "queue" );
+ jQuery._removeData( elem, key );
+ })
+ });
+ }
+});
+
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ var setter = 2;
+
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ setter--;
+ }
+
+ if ( arguments.length < setter ) {
+ return jQuery.queue( this[0], type );
+ }
+
+ return data === undefined ?
+ this :
+ this.each(function() {
+ var queue = jQuery.queue( this, type, data );
+
+ // ensure a hooks for this queue
+ jQuery._queueHooks( this, type );
+
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function( next, hooks ) {
+ var timeout = setTimeout( next, time );
+ hooks.stop = function() {
+ clearTimeout( timeout );
+ };
+ });
+ },
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ },
+ // Get a promise resolved when queues of a certain type
+ // are emptied (fx is the type by default)
+ promise: function( type, obj ) {
+ var tmp,
+ count = 1,
+ defer = jQuery.Deferred(),
+ elements = this,
+ i = this.length,
+ resolve = function() {
+ if ( !( --count ) ) {
+ defer.resolveWith( elements, [ elements ] );
+ }
+ };
+
+ if ( typeof type !== "string" ) {
+ obj = type;
+ type = undefined;
+ }
+ type = type || "fx";
+
+ while( i-- ) {
+ tmp = jQuery._data( elements[ i ], type + "queueHooks" );
+ if ( tmp && tmp.empty ) {
+ count++;
+ tmp.empty.add( resolve );
+ }
+ }
+ resolve();
+ return defer.promise( obj );
+ }
+});
+var nodeHook, boolHook,
+ rclass = /[\t\r\n]/g,
+ rreturn = /\r/g,
+ rfocusable = /^(?:input|select|textarea|button|object)$/i,
+ rclickable = /^(?:a|area)$/i,
+ rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,
+ ruseDefault = /^(?:checked|selected)$/i,
+ getSetAttribute = jQuery.support.getSetAttribute,
+ getSetInput = jQuery.support.input;
+
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
+ },
+
+ removeAttr: function( name ) {
+ return this.each(function() {
+ jQuery.removeAttr( this, name );
+ });
+ },
+
+ prop: function( name, value ) {
+ return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
+ },
+
+ removeProp: function( name ) {
+ name = jQuery.propFix[ name ] || name;
+ return this.each(function() {
+ // try/catch handles cases where IE balks (such as removing a property on window)
+ try {
+ this[ name ] = undefined;
+ delete this[ name ];
+ } catch( e ) {}
+ });
+ },
+
+ addClass: function( value ) {
+ var classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).addClass( value.call( this, j, this.className ) );
+ });
+ }
+
+ if ( proceed ) {
+ // The disjunction here is for better compressibility (see removeClass)
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ " "
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
+ cur += clazz + " ";
+ }
+ }
+ elem.className = jQuery.trim( cur );
+
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ var classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = arguments.length === 0 || typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).removeClass( value.call( this, j, this.className ) );
+ });
+ }
+ if ( proceed ) {
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ // This expression is here for better compressibility (see addClass)
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ ""
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ // Remove *all* instances
+ while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
+ cur = cur.replace( " " + clazz + " ", " " );
+ }
+ }
+ elem.className = value ? jQuery.trim( cur ) : "";
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value,
+ isBool = typeof stateVal === "boolean";
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( i ) {
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+ });
+ }
+
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className,
+ i = 0,
+ self = jQuery( this ),
+ state = stateVal,
+ classNames = value.match( core_rnotwhite ) || [];
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space separated list
+ state = isBool ? state : !self.hasClass( className );
+ self[ state ? "addClass" : "removeClass" ]( className );
+ }
+
+ // Toggle whole class name
+ } else if ( type === "undefined" || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery._data( this, "__className__", this.className );
+ }
+
+ // If the element has a class name or if we're passed "false",
+ // then remove the whole classname (if there was one, the above saved it).
+ // Otherwise bring back whatever was previously saved (if anything),
+ // falling back to the empty string if nothing was stored.
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
+ }
+ });
+ },
+
+ hasClass: function( selector ) {
+ var className = " " + selector + " ",
+ i = 0,
+ l = this.length;
+ for ( ; i < l; i++ ) {
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ val: function( value ) {
+ var hooks, ret, isFunction,
+ elem = this[0];
+
+ if ( !arguments.length ) {
+ if ( elem ) {
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
+
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+ return ret;
+ }
+
+ ret = elem.value;
+
+ return typeof ret === "string" ?
+ // handle most common string cases
+ ret.replace(rreturn, "") :
+ // handle cases where value is null/undef or number
+ ret == null ? "" : ret;
+ }
+
+ return;
+ }
+
+ isFunction = jQuery.isFunction( value );
+
+ return this.each(function( i ) {
+ var val,
+ self = jQuery(this);
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call( this, i, self.val() );
+ } else {
+ val = value;
+ }
+
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+ } else if ( typeof val === "number" ) {
+ val += "";
+ } else if ( jQuery.isArray( val ) ) {
+ val = jQuery.map(val, function ( value ) {
+ return value == null ? "" : value + "";
+ });
+ }
+
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
+
+ // If set returns undefined, fall back to normal setting
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+ this.value = val;
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ valHooks: {
+ option: {
+ get: function( elem ) {
+ // attributes.value is undefined in Blackberry 4.7 but
+ // uses .value. See #6932
+ var val = elem.attributes.value;
+ return !val || val.specified ? elem.value : elem.text;
+ }
+ },
+ select: {
+ get: function( elem ) {
+ var value, option,
+ options = elem.options,
+ index = elem.selectedIndex,
+ one = elem.type === "select-one" || index < 0,
+ values = one ? null : [],
+ max = one ? index + 1 : options.length,
+ i = index < 0 ?
+ max :
+ one ? index : 0;
+
+ // Loop through all the selected options
+ for ( ; i < max; i++ ) {
+ option = options[ i ];
+
+ // oldIE doesn't update selected after form reset (#2551)
+ if ( ( option.selected || i === index ) &&
+ // Don't return options that are disabled or in a disabled optgroup
+ ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
+ ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
+
+ // Get the specific value for the option
+ value = jQuery( option ).val();
+
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ return values;
+ },
+
+ set: function( elem, value ) {
+ var values = jQuery.makeArray( value );
+
+ jQuery(elem).find("option").each(function() {
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
+ });
+
+ if ( !values.length ) {
+ elem.selectedIndex = -1;
+ }
+ return values;
+ }
+ }
+ },
+
+ attr: function( elem, name, value ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set attributes on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ // Fallback to prop when attributes are not supported
+ if ( typeof elem.getAttribute === "undefined" ) {
+ return jQuery.prop( elem, name, value );
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ // All attributes are lowercase
+ // Grab necessary hook if one is defined
+ if ( notxml ) {
+ name = name.toLowerCase();
+ hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
+ }
+
+ if ( value !== undefined ) {
+
+ if ( value === null ) {
+ jQuery.removeAttr( elem, name );
+
+ } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ elem.setAttribute( name, value + "" );
+ return value;
+ }
+
+ } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+
+ // In IE9+, Flash objects don't have .getAttribute (#12945)
+ // Support: IE9+
+ if ( typeof elem.getAttribute !== "undefined" ) {
+ ret = elem.getAttribute( name );
+ }
+
+ // Non-existent attributes return null, we normalize to undefined
+ return ret == null ?
+ undefined :
+ ret;
+ }
+ },
+
+ removeAttr: function( elem, value ) {
+ var name, propName,
+ i = 0,
+ attrNames = value && value.match( core_rnotwhite );
+
+ if ( attrNames && elem.nodeType === 1 ) {
+ while ( (name = attrNames[i++]) ) {
+ propName = jQuery.propFix[ name ] || name;
+
+ // Boolean attributes get special treatment (#10870)
+ if ( rboolean.test( name ) ) {
+ // Set corresponding property to false for boolean attributes
+ // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8
+ if ( !getSetAttribute && ruseDefault.test( name ) ) {
+ elem[ jQuery.camelCase( "default-" + name ) ] =
+ elem[ propName ] = false;
+ } else {
+ elem[ propName ] = false;
+ }
+
+ // See #9699 for explanation of this approach (setting first, then removal)
+ } else {
+ jQuery.attr( elem, name, "" );
+ }
+
+ elem.removeAttribute( getSetAttribute ? name : propName );
+ }
+ }
+ },
+
+ attrHooks: {
+ type: {
+ set: function( elem, value ) {
+ if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
+ // Setting the type on a radio button after the value resets the value in IE6-9
+ // Reset value to default in case type is set after value during creation
+ var val = elem.value;
+ elem.setAttribute( "type", value );
+ if ( val ) {
+ elem.value = val;
+ }
+ return value;
+ }
+ }
+ }
+ },
+
+ propFix: {
+ tabindex: "tabIndex",
+ readonly: "readOnly",
+ "for": "htmlFor",
+ "class": "className",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ cellpadding: "cellPadding",
+ rowspan: "rowSpan",
+ colspan: "colSpan",
+ usemap: "useMap",
+ frameborder: "frameBorder",
+ contenteditable: "contentEditable"
+ },
+
+ prop: function( elem, name, value ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set properties on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
+
+ if ( value !== undefined ) {
+ if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ return ( elem[ name ] = value );
+ }
+
+ } else {
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+ return elem[ name ];
+ }
+ }
+ },
+
+ propHooks: {
+ tabIndex: {
+ get: function( elem ) {
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ var attributeNode = elem.getAttributeNode("tabindex");
+
+ return attributeNode && attributeNode.specified ?
+ parseInt( attributeNode.value, 10 ) :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ undefined;
+ }
+ }
+ }
+});
+
+// Hook for boolean attributes
+boolHook = {
+ get: function( elem, name ) {
+ var
+ // Use .prop to determine if this attribute is understood as boolean
+ prop = jQuery.prop( elem, name ),
+
+ // Fetch it accordingly
+ attr = typeof prop === "boolean" && elem.getAttribute( name ),
+ detail = typeof prop === "boolean" ?
+
+ getSetInput && getSetAttribute ?
+ attr != null :
+ // oldIE fabricates an empty string for missing boolean attributes
+ // and conflates checked/selected into attroperties
+ ruseDefault.test( name ) ?
+ elem[ jQuery.camelCase( "default-" + name ) ] :
+ !!attr :
+
+ // fetch an attribute node for properties not recognized as boolean
+ elem.getAttributeNode( name );
+
+ return detail && detail.value !== false ?
+ name.toLowerCase() :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ if ( value === false ) {
+ // Remove boolean attributes when set to false
+ jQuery.removeAttr( elem, name );
+ } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
+ // IE<8 needs the *property* name
+ elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
+
+ // Use defaultChecked and defaultSelected for oldIE
+ } else {
+ elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
+ }
+
+ return name;
+ }
+};
+
+// fix oldIE value attroperty
+if ( !getSetInput || !getSetAttribute ) {
+ jQuery.attrHooks.value = {
+ get: function( elem, name ) {
+ var ret = elem.getAttributeNode( name );
+ return jQuery.nodeName( elem, "input" ) ?
+
+ // Ignore the value *property* by using defaultValue
+ elem.defaultValue :
+
+ ret && ret.specified ? ret.value : undefined;
+ },
+ set: function( elem, value, name ) {
+ if ( jQuery.nodeName( elem, "input" ) ) {
+ // Does not return so that setAttribute is also used
+ elem.defaultValue = value;
+ } else {
+ // Use nodeHook if defined (#1954); otherwise setAttribute is fine
+ return nodeHook && nodeHook.set( elem, value, name );
+ }
+ }
+ };
+}
+
+// IE6/7 do not support getting/setting some attributes with get/setAttribute
+if ( !getSetAttribute ) {
+
+ // Use this for any attribute in IE6/7
+ // This fixes almost every IE6/7 issue
+ nodeHook = jQuery.valHooks.button = {
+ get: function( elem, name ) {
+ var ret = elem.getAttributeNode( name );
+ return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ?
+ ret.value :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ // Set the existing or create a new attribute node
+ var ret = elem.getAttributeNode( name );
+ if ( !ret ) {
+ elem.setAttributeNode(
+ (ret = elem.ownerDocument.createAttribute( name ))
+ );
+ }
+
+ ret.value = value += "";
+
+ // Break association with cloned elements by also using setAttribute (#9646)
+ return name === "value" || value === elem.getAttribute( name ) ?
+ value :
+ undefined;
+ }
+ };
+
+ // Set contenteditable to false on removals(#10429)
+ // Setting to empty string throws an error as an invalid value
+ jQuery.attrHooks.contenteditable = {
+ get: nodeHook.get,
+ set: function( elem, value, name ) {
+ nodeHook.set( elem, value === "" ? false : value, name );
+ }
+ };
+
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )
+ // This is for removals
+ jQuery.each([ "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ set: function( elem, value ) {
+ if ( value === "" ) {
+ elem.setAttribute( name, "auto" );
+ return value;
+ }
+ }
+ });
+ });
+}
+
+
+// Some attributes require a special call on IE
+// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+if ( !jQuery.support.hrefNormalized ) {
+ jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ get: function( elem ) {
+ var ret = elem.getAttribute( name, 2 );
+ return ret == null ? undefined : ret;
+ }
+ });
+ });
+
+ // href/src property should get the full normalized URL (#10299/#12915)
+ jQuery.each([ "href", "src" ], function( i, name ) {
+ jQuery.propHooks[ name ] = {
+ get: function( elem ) {
+ return elem.getAttribute( name, 4 );
+ }
+ };
+ });
+}
+
+if ( !jQuery.support.style ) {
+ jQuery.attrHooks.style = {
+ get: function( elem ) {
+ // Return undefined in the case of empty string
+ // Note: IE uppercases css property names, but if we were to .toLowerCase()
+ // .cssText, that would destroy case senstitivity in URL's, like in "background"
+ return elem.style.cssText || undefined;
+ },
+ set: function( elem, value ) {
+ return ( elem.style.cssText = value + "" );
+ }
+ };
+}
+
+// Safari mis-reports the default selected property of an option
+// Accessing the parent's selectedIndex property fixes it
+if ( !jQuery.support.optSelected ) {
+ jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
+ get: function( elem ) {
+ var parent = elem.parentNode;
+
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
+ return null;
+ }
+ });
+}
+
+// IE6/7 call enctype encoding
+if ( !jQuery.support.enctype ) {
+ jQuery.propFix.enctype = "encoding";
+}
+
+// Radios and checkboxes getter/setter
+if ( !jQuery.support.checkOn ) {
+ jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = {
+ get: function( elem ) {
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ }
+ };
+ });
+}
+jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
+ set: function( elem, value ) {
+ if ( jQuery.isArray( value ) ) {
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+ }
+ }
+ });
+});
+var rformElems = /^(?:input|select|textarea)$/i,
+ rkeyEvent = /^key/,
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+ rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
+
+function returnTrue() {
+ return true;
+}
+
+function returnFalse() {
+ return false;
+}
+
+/*
+ * Helper functions for managing events -- not part of the public interface.
+ * Props to Dean Edwards' addEvent library for many of the ideas.
+ */
+jQuery.event = {
+
+ global: {},
+
+ add: function( elem, types, handler, data, selector ) {
+
+ var handleObjIn, eventHandle, tmp,
+ events, t, handleObj,
+ special, handlers, type, namespaces, origType,
+ // Don't attach events to noData or text/comment nodes (but allow plain objects)
+ elemData = elem.nodeType !== 3 && elem.nodeType !== 8 && jQuery._data( elem );
+
+ if ( !elemData ) {
+ return;
+ }
+
+ // Caller can pass in an object of custom data in lieu of the handler
+ if ( handler.handler ) {
+ handleObjIn = handler;
+ handler = handleObjIn.handler;
+ selector = handleObjIn.selector;
+ }
+
+ // Make sure that the handler has a unique ID, used to find/remove it later
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
+
+ // Init the element's event structure and main handler, if this is the first
+ if ( !(events = elemData.events) ) {
+ events = elemData.events = {};
+ }
+ if ( !(eventHandle = elemData.handle) ) {
+ eventHandle = elemData.handle = function( e ) {
+ // Discard the second event of a jQuery.event.trigger() and
+ // when an event is called after a page has unloaded
+ return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
+ jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
+ undefined;
+ };
+ // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
+ eventHandle.elem = elem;
+ }
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // If event changes its type, use the special event handlers for the changed type
+ special = jQuery.event.special[ type ] || {};
+
+ // If selector defined, determine special event api type, otherwise given type
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+
+ // Update special based on newly reset type
+ special = jQuery.event.special[ type ] || {};
+
+ // handleObj is passed to all event handlers
+ handleObj = jQuery.extend({
+ type: type,
+ origType: origType,
+ data: data,
+ handler: handler,
+ guid: handler.guid,
+ selector: selector,
+ needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
+ namespace: namespaces.join(".")
+ }, handleObjIn );
+
+ // Init the event handler queue if we're the first
+ if ( !(handlers = events[ type ]) ) {
+ handlers = events[ type ] = [];
+ handlers.delegateCount = 0;
+
+ // Only use addEventListener/attachEvent if the special events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ // Bind the global event handler to the element
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, eventHandle );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ special.add.call( elem, handleObj );
+
+ if ( !handleObj.handler.guid ) {
+ handleObj.handler.guid = handler.guid;
+ }
+ }
+
+ // Add to the element's handler list, delegates in front
+ if ( selector ) {
+ handlers.splice( handlers.delegateCount++, 0, handleObj );
+ } else {
+ handlers.push( handleObj );
+ }
+
+ // Keep track of which events have ever been used, for event optimization
+ jQuery.event.global[ type ] = true;
+ }
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, selector, mappedTypes ) {
+
+ var j, origCount, tmp,
+ events, t, handleObj,
+ special, handlers, type, namespaces, origType,
+ elemData = jQuery.hasData( elem ) && jQuery._data( elem );
+
+ if ( !elemData || !(events = elemData.events) ) {
+ return;
+ }
+
+ // Once for each type.namespace in types; type may be omitted
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // Unbind all events (on this namespace, if provided) for the element
+ if ( !type ) {
+ for ( type in events ) {
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
+ }
+ continue;
+ }
+
+ special = jQuery.event.special[ type ] || {};
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+ handlers = events[ type ] || [];
+ tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
+
+ // Remove matching events
+ origCount = j = handlers.length;
+ while ( j-- ) {
+ handleObj = handlers[ j ];
+
+ if ( ( mappedTypes || origType === handleObj.origType ) &&
+ ( !handler || handler.guid === handleObj.guid ) &&
+ ( !tmp || tmp.test( handleObj.namespace ) ) &&
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
+ handlers.splice( j, 1 );
+
+ if ( handleObj.selector ) {
+ handlers.delegateCount--;
+ }
+ if ( special.remove ) {
+ special.remove.call( elem, handleObj );
+ }
+ }
+ }
+
+ // Remove generic event handler if we removed something and no more handlers exist
+ // (avoids potential for endless recursion during removal of special event handlers)
+ if ( origCount && !handlers.length ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
+ jQuery.removeEvent( elem, type, elemData.handle );
+ }
+
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ delete elemData.handle;
+
+ // removeData also checks for emptiness and clears the expando if empty
+ // so use it instead of delete
+ jQuery._removeData( elem, "events" );
+ }
+ },
+
+ trigger: function( event, data, elem, onlyHandlers ) {
+
+ var i, cur, tmp, bubbleType, ontype, handle, special,
+ eventPath = [ elem || document ],
+ type = event.type || event,
+ namespaces = event.namespace ? event.namespace.split(".") : [];
+
+ cur = tmp = elem = elem || document;
+
+ // Don't do events on text and comment nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
+ return;
+ }
+
+ if ( type.indexOf(".") >= 0 ) {
+ // Namespaced trigger; create a regexp to match event type in handle()
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ namespaces.sort();
+ }
+ ontype = type.indexOf(":") < 0 && "on" + type;
+
+ // Caller can pass in a jQuery.Event object, Object, or just an event type string
+ event = event[ jQuery.expando ] ?
+ event :
+ new jQuery.Event( type, typeof event === "object" && event );
+
+ event.isTrigger = true;
+ event.namespace = namespaces.join(".");
+ event.namespace_re = event.namespace ?
+ new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
+ null;
+
+ // Clean up the event in case it is being reused
+ event.result = undefined;
+ if ( !event.target ) {
+ event.target = elem;
+ }
+
+ // Clone any incoming data and prepend the event, creating the handler arg list
+ data = data == null ?
+ [ event ] :
+ jQuery.makeArray( data, [ event ] );
+
+ // Allow special events to draw outside the lines
+ special = jQuery.event.special[ type ] || {};
+ if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
+ return;
+ }
+
+ // Determine event propagation path in advance, per W3C events spec (#9951)
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+ bubbleType = special.delegateType || type;
+ if ( !rfocusMorph.test( bubbleType + type ) ) {
+ cur = cur.parentNode;
+ }
+ for ( ; cur; cur = cur.parentNode ) {
+ eventPath.push( cur );
+ tmp = cur;
+ }
+
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
+ if ( tmp === (elem.ownerDocument || document) ) {
+ eventPath.push( tmp.defaultView || tmp.parentWindow || window );
+ }
+ }
+
+ // Fire handlers on the event path
+ i = 0;
+ while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
+
+ event.type = i > 1 ?
+ bubbleType :
+ special.bindType || type;
+
+ // jQuery handler
+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
+ if ( handle ) {
+ handle.apply( cur, data );
+ }
+
+ // Native handler
+ handle = ontype && cur[ ontype ];
+ if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
+ event.preventDefault();
+ }
+ }
+ event.type = type;
+
+ // If nobody prevented the default action, do it now
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
+
+ if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
+ !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
+
+ // Call a native DOM method on the target with the same name name as the event.
+ // Can't use an .isFunction() check here because IE6/7 fails that test.
+ // Don't do default actions on window, that's where global variables be (#6170)
+ if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
+
+ // Don't re-trigger an onFOO event when we call its FOO() method
+ tmp = elem[ ontype ];
+
+ if ( tmp ) {
+ elem[ ontype ] = null;
+ }
+
+ // Prevent re-triggering of the same event, since we already bubbled it above
+ jQuery.event.triggered = type;
+ try {
+ elem[ type ]();
+ } catch ( e ) {
+ // IE<9 dies on focus/blur to hidden element (#1486,#12518)
+ // only reproducible on winXP IE8 native, not IE9 in IE8 mode
+ }
+ jQuery.event.triggered = undefined;
+
+ if ( tmp ) {
+ elem[ ontype ] = tmp;
+ }
+ }
+ }
+ }
+
+ return event.result;
+ },
+
+ dispatch: function( event ) {
+
+ // Make a writable jQuery.Event from the native event object
+ event = jQuery.event.fix( event );
+
+ var i, j, ret, matched, handleObj,
+ handlerQueue = [],
+ args = core_slice.call( arguments ),
+ handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
+ special = jQuery.event.special[ event.type ] || {};
+
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event
+ args[0] = event;
+ event.delegateTarget = this;
+
+ // Call the preDispatch hook for the mapped type, and let it bail if desired
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
+ return;
+ }
+
+ // Determine handlers
+ handlerQueue = jQuery.event.handlers.call( this, event, handlers );
+
+ // Run delegates first; they may want to stop propagation beneath us
+ i = 0;
+ while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
+ event.currentTarget = matched.elem;
+
+ j = 0;
+ while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
+
+ // Triggered event must either 1) have no namespace, or
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+ if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
+
+ event.handleObj = handleObj;
+ event.data = handleObj.data;
+
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+ .apply( matched.elem, args );
+
+ if ( ret !== undefined ) {
+ if ( (event.result = ret) === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+ }
+ }
+ }
+
+ // Call the postDispatch hook for the mapped type
+ if ( special.postDispatch ) {
+ special.postDispatch.call( this, event );
+ }
+
+ return event.result;
+ },
+
+ handlers: function( event, handlers ) {
+ var i, matches, sel, handleObj,
+ handlerQueue = [],
+ delegateCount = handlers.delegateCount,
+ cur = event.target;
+
+ // Find delegate handlers
+ // Black-hole SVG <use> instance trees (#13180)
+ // Avoid non-left-click bubbling in Firefox (#3861)
+ if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
+
+ for ( ; cur != this; cur = cur.parentNode || this ) {
+
+ // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
+ if ( cur.disabled !== true || event.type !== "click" ) {
+ matches = [];
+ for ( i = 0; i < delegateCount; i++ ) {
+ handleObj = handlers[ i ];
+
+ // Don't conflict with Object.prototype properties (#13203)
+ sel = handleObj.selector + " ";
+
+ if ( matches[ sel ] === undefined ) {
+ matches[ sel ] = handleObj.needsContext ?
+ jQuery( sel, this ).index( cur ) >= 0 :
+ jQuery.find( sel, this, null, [ cur ] ).length;
+ }
+ if ( matches[ sel ] ) {
+ matches.push( handleObj );
+ }
+ }
+ if ( matches.length ) {
+ handlerQueue.push({ elem: cur, handlers: matches });
+ }
+ }
+ }
+ }
+
+ // Add the remaining (directly-bound) handlers
+ if ( delegateCount < handlers.length ) {
+ handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
+ }
+
+ return handlerQueue;
+ },
+
+ fix: function( event ) {
+ if ( event[ jQuery.expando ] ) {
+ return event;
+ }
+
+ // Create a writable copy of the event object and normalize some properties
+ var i, prop,
+ originalEvent = event,
+ fixHook = jQuery.event.fixHooks[ event.type ] || {},
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
+
+ event = new jQuery.Event( originalEvent );
+
+ i = copy.length;
+ while ( i-- ) {
+ prop = copy[ i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Support: IE<9
+ // Fix target property (#1925)
+ if ( !event.target ) {
+ event.target = originalEvent.srcElement || document;
+ }
+
+ // Support: Chrome 23+, Safari?
+ // Target should not be a text node (#504, #13143)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
+
+ // Support: IE<9
+ // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
+ event.metaKey = !!event.metaKey;
+
+ return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
+ },
+
+ // Includes some event props shared by KeyEvent and MouseEvent
+ props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
+
+ fixHooks: {},
+
+ keyHooks: {
+ props: "char charCode key keyCode".split(" "),
+ filter: function( event, original ) {
+
+ // Add which for key events
+ if ( event.which == null ) {
+ event.which = original.charCode != null ? original.charCode : original.keyCode;
+ }
+
+ return event;
+ }
+ },
+
+ mouseHooks: {
+ props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
+ filter: function( event, original ) {
+ var eventDoc, doc, body,
+ button = original.button,
+ fromElement = original.fromElement;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && original.clientX != null ) {
+ eventDoc = event.target.ownerDocument || document;
+ doc = eventDoc.documentElement;
+ body = eventDoc.body;
+
+ event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
+ event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
+ }
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && fromElement ) {
+ event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
+ }
+
+ // Add which for click: 1 === left; 2 === middle; 3 === right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && button !== undefined ) {
+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
+ }
+
+ return event;
+ }
+ },
+
+ special: {
+ load: {
+ // Prevent triggered image.load events from bubbling to window.load
+ noBubble: true
+ },
+ click: {
+ // For checkbox, fire native event so checked state will be right
+ trigger: function() {
+ if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
+ this.click();
+ return false;
+ }
+ }
+ },
+ focus: {
+ // Fire native event if possible so blur/focus sequence is correct
+ trigger: function() {
+ if ( this !== document.activeElement && this.focus ) {
+ try {
+ this.focus();
+ return false;
+ } catch ( e ) {
+ // Support: IE<9
+ // If we error on focus to hidden element (#1486, #12518),
+ // let .trigger() run the handlers
+ }
+ }
+ },
+ delegateType: "focusin"
+ },
+ blur: {
+ trigger: function() {
+ if ( this === document.activeElement && this.blur ) {
+ this.blur();
+ return false;
+ }
+ },
+ delegateType: "focusout"
+ },
+
+ beforeunload: {
+ postDispatch: function( event ) {
+
+ // Even when returnValue equals to undefined Firefox will still show alert
+ if ( event.result !== undefined ) {
+ event.originalEvent.returnValue = event.result;
+ }
+ }
+ }
+ },
+
+ simulate: function( type, elem, event, bubble ) {
+ // Piggyback on a donor event to simulate a different one.
+ // Fake originalEvent to avoid donor's stopPropagation, but if the
+ // simulated event prevents default then we do the same on the donor.
+ var e = jQuery.extend(
+ new jQuery.Event(),
+ event,
+ { type: type,
+ isSimulated: true,
+ originalEvent: {}
+ }
+ );
+ if ( bubble ) {
+ jQuery.event.trigger( e, null, elem );
+ } else {
+ jQuery.event.dispatch.call( elem, e );
+ }
+ if ( e.isDefaultPrevented() ) {
+ event.preventDefault();
+ }
+ }
+};
+
+jQuery.removeEvent = document.removeEventListener ?
+ function( elem, type, handle ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
+ } :
+ function( elem, type, handle ) {
+ var name = "on" + type;
+
+ if ( elem.detachEvent ) {
+
+ // #8545, #7054, preventing memory leaks for custom events in IE6-8
+ // detachEvent needed property on element, by name of that event, to properly expose it to GC
+ if ( typeof elem[ name ] === "undefined" ) {
+ elem[ name ] = null;
+ }
+
+ elem.detachEvent( name, handle );
+ }
+ };
+
+jQuery.Event = function( src, props ) {
+ // Allow instantiation without the 'new' keyword
+ if ( !(this instanceof jQuery.Event) ) {
+ return new jQuery.Event( src, props );
+ }
+
+ // Event object
+ if ( src && src.type ) {
+ this.originalEvent = src;
+ this.type = src.type;
+
+ // Events bubbling up the document may have been marked as prevented
+ // by a handler lower down the tree; reflect the correct value.
+ this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
+ src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
+
+ // Event type
+ } else {
+ this.type = src;
+ }
+
+ // Put explicitly provided properties onto the event object
+ if ( props ) {
+ jQuery.extend( this, props );
+ }
+
+ // Create a timestamp if incoming event doesn't have one
+ this.timeStamp = src && src.timeStamp || jQuery.now();
+
+ // Mark it as fixed
+ this[ jQuery.expando ] = true;
+};
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse,
+
+ preventDefault: function() {
+ var e = this.originalEvent;
+
+ this.isDefaultPrevented = returnTrue;
+ if ( !e ) {
+ return;
+ }
+
+ // If preventDefault exists, run it on the original event
+ if ( e.preventDefault ) {
+ e.preventDefault();
+
+ // Support: IE
+ // Otherwise set the returnValue property of the original event to false
+ } else {
+ e.returnValue = false;
+ }
+ },
+ stopPropagation: function() {
+ var e = this.originalEvent;
+
+ this.isPropagationStopped = returnTrue;
+ if ( !e ) {
+ return;
+ }
+ // If stopPropagation exists, run it on the original event
+ if ( e.stopPropagation ) {
+ e.stopPropagation();
+ }
+
+ // Support: IE
+ // Set the cancelBubble property of the original event to true
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation: function() {
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ }
+};
+
+// Create mouseenter/leave events using mouseover/out and event-time checks
+jQuery.each({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+}, function( orig, fix ) {
+ jQuery.event.special[ orig ] = {
+ delegateType: fix,
+ bindType: fix,
+
+ handle: function( event ) {
+ var ret,
+ target = this,
+ related = event.relatedTarget,
+ handleObj = event.handleObj;
+
+ // For mousenter/leave call the handler if related is outside the target.
+ // NB: No relatedTarget if the mouse left/entered the browser window
+ if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
+ event.type = handleObj.origType;
+ ret = handleObj.handler.apply( this, arguments );
+ event.type = fix;
+ }
+ return ret;
+ }
+ };
+});
+
+// IE submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+ jQuery.event.special.submit = {
+ setup: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Lazy-add a submit handler when a descendant form may potentially be submitted
+ jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
+ // Node name check avoids a VML-related crash in IE (#9807)
+ var elem = e.target,
+ form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
+ if ( form && !jQuery._data( form, "submitBubbles" ) ) {
+ jQuery.event.add( form, "submit._submit", function( event ) {
+ event._submit_bubble = true;
+ });
+ jQuery._data( form, "submitBubbles", true );
+ }
+ });
+ // return undefined since we don't need an event listener
+ },
+
+ postDispatch: function( event ) {
+ // If form was submitted by the user, bubble the event up the tree
+ if ( event._submit_bubble ) {
+ delete event._submit_bubble;
+ if ( this.parentNode && !event.isTrigger ) {
+ jQuery.event.simulate( "submit", this.parentNode, event, true );
+ }
+ }
+ },
+
+ teardown: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
+ jQuery.event.remove( this, "._submit" );
+ }
+ };
+}
+
+// IE change delegation and checkbox/radio fix
+if ( !jQuery.support.changeBubbles ) {
+
+ jQuery.event.special.change = {
+
+ setup: function() {
+
+ if ( rformElems.test( this.nodeName ) ) {
+ // IE doesn't fire change on a check/radio until blur; trigger it on click
+ // after a propertychange. Eat the blur-change in special.change.handle.
+ // This still fires onchange a second time for check/radio after blur.
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ jQuery.event.add( this, "propertychange._change", function( event ) {
+ if ( event.originalEvent.propertyName === "checked" ) {
+ this._just_changed = true;
+ }
+ });
+ jQuery.event.add( this, "click._change", function( event ) {
+ if ( this._just_changed && !event.isTrigger ) {
+ this._just_changed = false;
+ }
+ // Allow triggered, simulated change events (#11500)
+ jQuery.event.simulate( "change", this, event, true );
+ });
+ }
+ return false;
+ }
+ // Delegated event; lazy-add a change handler on descendant inputs
+ jQuery.event.add( this, "beforeactivate._change", function( e ) {
+ var elem = e.target;
+
+ if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
+ jQuery.event.add( elem, "change._change", function( event ) {
+ if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
+ jQuery.event.simulate( "change", this.parentNode, event, true );
+ }
+ });
+ jQuery._data( elem, "changeBubbles", true );
+ }
+ });
+ },
+
+ handle: function( event ) {
+ var elem = event.target;
+
+ // Swallow native change events from checkbox/radio, we already triggered them above
+ if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
+ return event.handleObj.handler.apply( this, arguments );
+ }
+ },
+
+ teardown: function() {
+ jQuery.event.remove( this, "._change" );
+
+ return !rformElems.test( this.nodeName );
+ }
+ };
+}
+
+// Create "bubbling" focus and blur events
+if ( !jQuery.support.focusinBubbles ) {
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+
+ // Attach a single capturing handler while someone wants focusin/focusout
+ var attaches = 0,
+ handler = function( event ) {
+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
+ };
+
+ jQuery.event.special[ fix ] = {
+ setup: function() {
+ if ( attaches++ === 0 ) {
+ document.addEventListener( orig, handler, true );
+ }
+ },
+ teardown: function() {
+ if ( --attaches === 0 ) {
+ document.removeEventListener( orig, handler, true );
+ }
+ }
+ };
+ });
+}
+
+jQuery.fn.extend({
+
+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
+ var origFn, type;
+
+ // Types can be a map of types/handlers
+ if ( typeof types === "object" ) {
+ // ( types-Object, selector, data )
+ if ( typeof selector !== "string" ) {
+ // ( types-Object, data )
+ data = data || selector;
+ selector = undefined;
+ }
+ for ( type in types ) {
+ this.on( type, selector, data, types[ type ], one );
+ }
+ return this;
+ }
+
+ if ( data == null && fn == null ) {
+ // ( types, fn )
+ fn = selector;
+ data = selector = undefined;
+ } else if ( fn == null ) {
+ if ( typeof selector === "string" ) {
+ // ( types, selector, fn )
+ fn = data;
+ data = undefined;
+ } else {
+ // ( types, data, fn )
+ fn = data;
+ data = selector;
+ selector = undefined;
+ }
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ } else if ( !fn ) {
+ return this;
+ }
+
+ if ( one === 1 ) {
+ origFn = fn;
+ fn = function( event ) {
+ // Can use an empty set, since event contains the info
+ jQuery().off( event );
+ return origFn.apply( this, arguments );
+ };
+ // Use same guid so caller can remove using origFn
+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
+ }
+ return this.each( function() {
+ jQuery.event.add( this, types, fn, data, selector );
+ });
+ },
+ one: function( types, selector, data, fn ) {
+ return this.on( types, selector, data, fn, 1 );
+ },
+ off: function( types, selector, fn ) {
+ var handleObj, type;
+ if ( types && types.preventDefault && types.handleObj ) {
+ // ( event ) dispatched jQuery.Event
+ handleObj = types.handleObj;
+ jQuery( types.delegateTarget ).off(
+ handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
+ handleObj.selector,
+ handleObj.handler
+ );
+ return this;
+ }
+ if ( typeof types === "object" ) {
+ // ( types-object [, selector] )
+ for ( type in types ) {
+ this.off( type, selector, types[ type ] );
+ }
+ return this;
+ }
+ if ( selector === false || typeof selector === "function" ) {
+ // ( types [, fn] )
+ fn = selector;
+ selector = undefined;
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ }
+ return this.each(function() {
+ jQuery.event.remove( this, types, fn, selector );
+ });
+ },
+
+ bind: function( types, data, fn ) {
+ return this.on( types, null, data, fn );
+ },
+ unbind: function( types, fn ) {
+ return this.off( types, null, fn );
+ },
+
+ delegate: function( selector, types, data, fn ) {
+ return this.on( types, selector, data, fn );
+ },
+ undelegate: function( selector, types, fn ) {
+ // ( namespace ) or ( selector, types [, fn] )
+ return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+ triggerHandler: function( type, data ) {
+ var elem = this[0];
+ if ( elem ) {
+ return jQuery.event.trigger( type, data, elem, true );
+ }
+ },
+
+ hover: function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+ }
+});
+
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+ "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( data, fn ) {
+ return arguments.length > 0 ?
+ this.on( name, null, data, fn ) :
+ this.trigger( name );
+ };
+
+ if ( rkeyEvent.test( name ) ) {
+ jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
+ }
+
+ if ( rmouseEvent.test( name ) ) {
+ jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
+ }
+});
+/*!
+ * Sizzle CSS Selector Engine
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license
+ * http://sizzlejs.com/
+ */
+(function( window, undefined ) {
+
+var i,
+ cachedruns,
+ Expr,
+ getText,
+ isXML,
+ compile,
+ hasDuplicate,
+ outermostContext,
+
+ // Local document vars
+ setDocument,
+ document,
+ docElem,
+ documentIsXML,
+ rbuggyQSA,
+ rbuggyMatches,
+ matches,
+ contains,
+ sortOrder,
+
+ // Instance-specific data
+ expando = "sizzle" + -(new Date()),
+ preferredDoc = window.document,
+ support = {},
+ dirruns = 0,
+ done = 0,
+ classCache = createCache(),
+ tokenCache = createCache(),
+ compilerCache = createCache(),
+
+ // General-purpose constants
+ strundefined = typeof undefined,
+ MAX_NEGATIVE = 1 << 31,
+
+ // Array methods
+ arr = [],
+ pop = arr.pop,
+ push = arr.push,
+ slice = arr.slice,
+ // Use a stripped-down indexOf if we can't use a native one
+ indexOf = arr.indexOf || function( elem ) {
+ var i = 0,
+ len = this.length;
+ for ( ; i < len; i++ ) {
+ if ( this[i] === elem ) {
+ return i;
+ }
+ }
+ return -1;
+ },
+
+
+ // Regular expressions
+
+ // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
+ whitespace = "[\\x20\\t\\r\\n\\f]",
+ // http://www.w3.org/TR/css3-syntax/#characters
+ characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
+
+ // Loosely modeled on CSS identifier characters
+ // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
+ // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
+ identifier = characterEncoding.replace( "w", "w#" ),
+
+ // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
+ operators = "([*^$|!~]?=)",
+ attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
+ "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
+
+ // Prefer arguments quoted,
+ // then not containing pseudos/brackets,
+ // then attribute selectors/non-parenthetical expressions,
+ // then anything else
+ // These preferences are here to reduce the number of selectors
+ // needing tokenize in the PSEUDO preFilter
+ pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
+
+ // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
+
+ rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
+ rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
+ rpseudo = new RegExp( pseudos ),
+ ridentifier = new RegExp( "^" + identifier + "$" ),
+
+ matchExpr = {
+ "ID": new RegExp( "^#(" + characterEncoding + ")" ),
+ "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
+ "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
+ "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
+ "ATTR": new RegExp( "^" + attributes ),
+ "PSEUDO": new RegExp( "^" + pseudos ),
+ "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
+ "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
+ "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
+ // For use in libraries implementing .is()
+ // We use this for POS matching in `select`
+ "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
+ whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
+ },
+
+ rsibling = /[\x20\t\r\n\f]*[+~]/,
+
+ rnative = /\{\s*\[native code\]\s*\}/,
+
+ // Easily-parseable/retrievable ID or TAG or CLASS selectors
+ rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
+
+ rinputs = /^(?:input|select|textarea|button)$/i,
+ rheader = /^h\d$/i,
+
+ rescape = /'|\\/g,
+ rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
+
+ // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
+ runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
+ funescape = function( _, escaped ) {
+ var high = "0x" + escaped - 0x10000;
+ // NaN means non-codepoint
+ return high !== high ?
+ escaped :
+ // BMP codepoint
+ high < 0 ?
+ String.fromCharCode( high + 0x10000 ) :
+ // Supplemental Plane codepoint (surrogate pair)
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
+ };
+
+// Use a stripped-down slice if we can't use a native one
+try {
+ slice.call( docElem.childNodes, 0 )[0].nodeType;
+} catch ( e ) {
+ slice = function( i ) {
+ var elem,
+ results = [];
+ for ( ; (elem = this[i]); i++ ) {
+ results.push( elem );
+ }
+ return results;
+ };
+}
+
+/**
+ * For feature detection
+ * @param {Function} fn The function to test for native support
+ */
+function isNative( fn ) {
+ return rnative.test( fn + "" );
+}
+
+/**
+ * Create key-value caches of limited size
+ * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
+ * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
+ * deleting the oldest entry
+ */
+function createCache() {
+ var cache,
+ keys = [];
+
+ return (cache = function( key, value ) {
+ // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
+ if ( keys.push( key += " " ) > Expr.cacheLength ) {
+ // Only keep the most recent entries
+ delete cache[ keys.shift() ];
+ }
+ return (cache[ key ] = value);
+ });
+}
+
+/**
+ * Mark a function for special use by Sizzle
+ * @param {Function} fn The function to mark
+ */
+function markFunction( fn ) {
+ fn[ expando ] = true;
+ return fn;
+}
+
+/**
+ * Support testing using an element
+ * @param {Function} fn Passed the created div and expects a boolean result
+ */
+function assert( fn ) {
+ var div = document.createElement("div");
+
+ try {
+ return fn( div );
+ } catch (e) {
+ return false;
+ } finally {
+ // release memory in IE
+ div = null;
+ }
+}
+
+function Sizzle( selector, context, results, seed ) {
+ var match, elem, m, nodeType,
+ // QSA vars
+ i, groups, old, nid, newContext, newSelector;
+
+ if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
+ setDocument( context );
+ }
+
+ context = context || document;
+ results = results || [];
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
+ return [];
+ }
+
+ if ( !documentIsXML && !seed ) {
+
+ // Shortcuts
+ if ( (match = rquickExpr.exec( selector )) ) {
+ // Speed-up: Sizzle("#ID")
+ if ( (m = match[1]) ) {
+ if ( nodeType === 9 ) {
+ elem = context.getElementById( m );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE, Opera, and Webkit return items
+ // by name instead of ID
+ if ( elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ } else {
+ return results;
+ }
+ } else {
+ // Context is not a document
+ if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
+ contains( context, elem ) && elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ }
+
+ // Speed-up: Sizzle("TAG")
+ } else if ( match[2] ) {
+ push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
+ return results;
+
+ // Speed-up: Sizzle(".CLASS")
+ } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
+ push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
+ return results;
+ }
+ }
+
+ // QSA path
+ if ( support.qsa && !rbuggyQSA.test(selector) ) {
+ old = true;
+ nid = expando;
+ newContext = context;
+ newSelector = nodeType === 9 && selector;
+
+ // qSA works strangely on Element-rooted queries
+ // We can work around this by specifying an extra ID on the root
+ // and working up from there (Thanks to Andrew Dupont for the technique)
+ // IE 8 doesn't work on object elements
+ if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+ groups = tokenize( selector );
+
+ if ( (old = context.getAttribute("id")) ) {
+ nid = old.replace( rescape, "\\$&" );
+ } else {
+ context.setAttribute( "id", nid );
+ }
+ nid = "[id='" + nid + "'] ";
+
+ i = groups.length;
+ while ( i-- ) {
+ groups[i] = nid + toSelector( groups[i] );
+ }
+ newContext = rsibling.test( selector ) && context.parentNode || context;
+ newSelector = groups.join(",");
+ }
+
+ if ( newSelector ) {
+ try {
+ push.apply( results, slice.call( newContext.querySelectorAll(
+ newSelector
+ ), 0 ) );
+ return results;
+ } catch(qsaError) {
+ } finally {
+ if ( !old ) {
+ context.removeAttribute("id");
+ }
+ }
+ }
+ }
+ }
+
+ // All others
+ return select( selector.replace( rtrim, "$1" ), context, results, seed );
+}
+
+/**
+ * Detect xml
+ * @param {Element|Object} elem An element or a document
+ */
+isXML = Sizzle.isXML = function( elem ) {
+ // documentElement is verified for cases where it doesn't yet exist
+ // (such as loading iframes in IE - #4833)
+ var documentElement = elem && (elem.ownerDocument || elem).documentElement;
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+/**
+ * Sets document-related variables once based on the current document
+ * @param {Element|Object} [doc] An element or document object to use to set the document
+ * @returns {Object} Returns the current document
+ */
+setDocument = Sizzle.setDocument = function( node ) {
+ var doc = node ? node.ownerDocument || node : preferredDoc;
+
+ // If no document and documentElement is available, return
+ if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
+ return document;
+ }
+
+ // Set our document
+ document = doc;
+ docElem = doc.documentElement;
+
+ // Support tests
+ documentIsXML = isXML( doc );
+
+ // Check if getElementsByTagName("*") returns only elements
+ support.tagNameNoComments = assert(function( div ) {
+ div.appendChild( doc.createComment("") );
+ return !div.getElementsByTagName("*").length;
+ });
+
+ // Check if attributes should be retrieved by attribute nodes
+ support.attributes = assert(function( div ) {
+ div.innerHTML = "<select></select>";
+ var type = typeof div.lastChild.getAttribute("multiple");
+ // IE8 returns a string for some attributes even when not present
+ return type !== "boolean" && type !== "string";
+ });
+
+ // Check if getElementsByClassName can be trusted
+ support.getByClassName = assert(function( div ) {
+ // Opera can't find a second classname (in 9.6)
+ div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
+ if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
+ return false;
+ }
+
+ // Safari 3.2 caches class attributes and doesn't catch changes
+ div.lastChild.className = "e";
+ return div.getElementsByClassName("e").length === 2;
+ });
+
+ // Check if getElementById returns elements by name
+ // Check if getElementsByName privileges form controls or returns elements by ID
+ support.getByName = assert(function( div ) {
+ // Inject content
+ div.id = expando + 0;
+ div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
+ docElem.insertBefore( div, docElem.firstChild );
+
+ // Test
+ var pass = doc.getElementsByName &&
+ // buggy browsers will return fewer than the correct 2
+ doc.getElementsByName( expando ).length === 2 +
+ // buggy browsers will return more than the correct 0
+ doc.getElementsByName( expando + 0 ).length;
+ support.getIdNotName = !doc.getElementById( expando );
+
+ // Cleanup
+ docElem.removeChild( div );
+
+ return pass;
+ });
+
+ // IE6/7 return modified attributes
+ Expr.attrHandle = assert(function( div ) {
+ div.innerHTML = "<a href='#'></a>";
+ return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
+ div.firstChild.getAttribute("href") === "#";
+ }) ?
+ {} :
+ {
+ "href": function( elem ) {
+ return elem.getAttribute( "href", 2 );
+ },
+ "type": function( elem ) {
+ return elem.getAttribute("type");
+ }
+ };
+
+ // ID find and filter
+ if ( support.getIdNotName ) {
+ Expr.find["ID"] = function( id, context ) {
+ if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
+ var m = context.getElementById( id );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [m] : [];
+ }
+ };
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ return elem.getAttribute("id") === attrId;
+ };
+ };
+ } else {
+ Expr.find["ID"] = function( id, context ) {
+ if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
+ var m = context.getElementById( id );
+
+ return m ?
+ m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
+ [m] :
+ undefined :
+ [];
+ }
+ };
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
+ return node && node.value === attrId;
+ };
+ };
+ }
+
+ // Tag
+ Expr.find["TAG"] = support.tagNameNoComments ?
+ function( tag, context ) {
+ if ( typeof context.getElementsByTagName !== strundefined ) {
+ return context.getElementsByTagName( tag );
+ }
+ } :
+ function( tag, context ) {
+ var elem,
+ tmp = [],
+ i = 0,
+ results = context.getElementsByTagName( tag );
+
+ // Filter out possible comments
+ if ( tag === "*" ) {
+ for ( ; (elem = results[i]); i++ ) {
+ if ( elem.nodeType === 1 ) {
+ tmp.push( elem );
+ }
+ }
+
+ return tmp;
+ }
+ return results;
+ };
+
+ // Name
+ Expr.find["NAME"] = support.getByName && function( tag, context ) {
+ if ( typeof context.getElementsByName !== strundefined ) {
+ return context.getElementsByName( name );
+ }
+ };
+
+ // Class
+ Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
+ if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
+ return context.getElementsByClassName( className );
+ }
+ };
+
+ // QSA and matchesSelector support
+
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
+ rbuggyMatches = [];
+
+ // qSa(:focus) reports false when true (Chrome 21),
+ // no need to also add to buggyMatches since matches checks buggyQSA
+ // A support test would require too much code (would include document ready)
+ rbuggyQSA = [ ":focus" ];
+
+ if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
+ // Build QSA regex
+ // Regex strategy adopted from Diego Perini
+ assert(function( div ) {
+ // Select is set to empty string on purpose
+ // This is to test IE's treatment of not explictly
+ // setting a boolean content attribute,
+ // since its presence should be enough
+ // http://bugs.jquery.com/ticket/12359
+ div.innerHTML = "<select><option selected=''></option></select>";
+
+ // IE8 - Some boolean attributes are not treated correctly
+ if ( !div.querySelectorAll("[selected]").length ) {
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
+ }
+
+ // Webkit/Opera - :checked should return selected option elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":checked").length ) {
+ rbuggyQSA.push(":checked");
+ }
+ });
+
+ assert(function( div ) {
+
+ // Opera 10-12/IE8 - ^= $= *= and empty values
+ // Should not select anything
+ div.innerHTML = "<input type='hidden' i=''/>";
+ if ( div.querySelectorAll("[i^='']").length ) {
+ rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
+ }
+
+ // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":enabled").length ) {
+ rbuggyQSA.push( ":enabled", ":disabled" );
+ }
+
+ // Opera 10-11 does not throw on post-comma invalid pseudos
+ div.querySelectorAll("*,:x");
+ rbuggyQSA.push(",.*:");
+ });
+ }
+
+ if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
+ docElem.mozMatchesSelector ||
+ docElem.webkitMatchesSelector ||
+ docElem.oMatchesSelector ||
+ docElem.msMatchesSelector) )) ) {
+
+ assert(function( div ) {
+ // Check to see if it's possible to do matchesSelector
+ // on a disconnected node (IE 9)
+ support.disconnectedMatch = matches.call( div, "div" );
+
+ // This should fail with an exception
+ // Gecko does not error, returns false instead
+ matches.call( div, "[s!='']:x" );
+ rbuggyMatches.push( "!=", pseudos );
+ });
+ }
+
+ rbuggyQSA = new RegExp( rbuggyQSA.join("|") );
+ rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
+
+ // Element contains another
+ // Purposefully does not implement inclusive descendent
+ // As in, an element does not contain itself
+ contains = isNative(docElem.contains) || docElem.compareDocumentPosition ?
+ function( a, b ) {
+ var adown = a.nodeType === 9 ? a.documentElement : a,
+ bup = b && b.parentNode;
+ return a === bup || !!( bup && bup.nodeType === 1 && (
+ adown.contains ?
+ adown.contains( bup ) :
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
+ ));
+ } :
+ function( a, b ) {
+ if ( b ) {
+ while ( (b = b.parentNode) ) {
+ if ( b === a ) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ // Document order sorting
+ sortOrder = docElem.compareDocumentPosition ?
+ function( a, b ) {
+ var compare;
+
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
+ if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
+ if ( a === doc || contains( preferredDoc, a ) ) {
+ return -1;
+ }
+ if ( b === doc || contains( preferredDoc, b ) ) {
+ return 1;
+ }
+ return 0;
+ }
+ return compare & 4 ? -1 : 1;
+ }
+
+ return a.compareDocumentPosition ? -1 : 1;
+ } :
+ function( a, b ) {
+ var cur,
+ i = 0,
+ aup = a.parentNode,
+ bup = b.parentNode,
+ ap = [ a ],
+ bp = [ b ];
+
+ // The nodes are identical, we can exit early
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+
+ // Fallback to using sourceIndex (in IE) if it's available on both nodes
+ } else if ( a.sourceIndex && b.sourceIndex ) {
+ return ( ~b.sourceIndex || MAX_NEGATIVE ) - ( contains( preferredDoc, a ) && ~a.sourceIndex || MAX_NEGATIVE );
+
+ // Parentless nodes are either documents or disconnected
+ } else if ( !aup || !bup ) {
+ return a === doc ? -1 :
+ b === doc ? 1 :
+ aup ? -1 :
+ bup ? 1 :
+ 0;
+
+ // If the nodes are siblings, we can do a quick check
+ } else if ( aup === bup ) {
+ return siblingCheck( a, b );
+ }
+
+ // Otherwise we need full lists of their ancestors for comparison
+ cur = a;
+ while ( (cur = cur.parentNode) ) {
+ ap.unshift( cur );
+ }
+ cur = b;
+ while ( (cur = cur.parentNode) ) {
+ bp.unshift( cur );
+ }
+
+ // Walk down the tree looking for a discrepancy
+ while ( ap[i] === bp[i] ) {
+ i++;
+ }
+
+ return i ?
+ // Do a sibling check if the nodes have a common ancestor
+ siblingCheck( ap[i], bp[i] ) :
+
+ // Otherwise nodes in our document sort first
+ ap[i] === preferredDoc ? -1 :
+ bp[i] === preferredDoc ? 1 :
+ 0;
+ };
+
+ // Always assume the presence of duplicates if sort doesn't
+ // pass them to our comparison function (as in Google Chrome).
+ hasDuplicate = false;
+ [0, 0].sort( sortOrder );
+ support.detectDuplicates = hasDuplicate;
+
+ return document;
+};
+
+Sizzle.matches = function( expr, elements ) {
+ return Sizzle( expr, null, null, elements );
+};
+
+Sizzle.matchesSelector = function( elem, expr ) {
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ // Make sure that attribute selectors are quoted
+ expr = expr.replace( rattributeQuotes, "='$1']" );
+
+ // rbuggyQSA always contains :focus, so no need for an existence check
+ if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {
+ try {
+ var ret = matches.call( elem, expr );
+
+ // IE 9's matchesSelector returns false on disconnected nodes
+ if ( ret || support.disconnectedMatch ||
+ // As well, disconnected nodes are said to be in a document
+ // fragment in IE 9
+ elem.document && elem.document.nodeType !== 11 ) {
+ return ret;
+ }
+ } catch(e) {}
+ }
+
+ return Sizzle( expr, document, null, [elem] ).length > 0;
+};
+
+Sizzle.contains = function( context, elem ) {
+ // Set document vars if needed
+ if ( ( context.ownerDocument || context ) !== document ) {
+ setDocument( context );
+ }
+ return contains( context, elem );
+};
+
+Sizzle.attr = function( elem, name ) {
+ var val;
+
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ if ( !documentIsXML ) {
+ name = name.toLowerCase();
+ }
+ if ( (val = Expr.attrHandle[ name ]) ) {
+ return val( elem );
+ }
+ if ( documentIsXML || support.attributes ) {
+ return elem.getAttribute( name );
+ }
+ return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ?
+ name :
+ val && val.specified ? val.value : null;
+};
+
+Sizzle.error = function( msg ) {
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+// Document sorting and removing duplicates
+Sizzle.uniqueSort = function( results ) {
+ var elem,
+ duplicates = [],
+ i = 1,
+ j = 0;
+
+ // Unless we *know* we can detect duplicates, assume their presence
+ hasDuplicate = !support.detectDuplicates;
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ for ( ; (elem = results[i]); i++ ) {
+ if ( elem === results[ i - 1 ] ) {
+ j = duplicates.push( i );
+ }
+ }
+ while ( j-- ) {
+ results.splice( duplicates[ j ], 1 );
+ }
+ }
+
+ return results;
+};
+
+function siblingCheck( a, b ) {
+ var cur = a && b && a.nextSibling;
+
+ for ( ; cur; cur = cur.nextSibling ) {
+ if ( cur === b ) {
+ return -1;
+ }
+ }
+
+ return a ? 1 : -1;
+}
+
+// Returns a function to use in pseudos for input types
+function createInputPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === type;
+ };
+}
+
+// Returns a function to use in pseudos for buttons
+function createButtonPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && elem.type === type;
+ };
+}
+
+// Returns a function to use in pseudos for positionals
+function createPositionalPseudo( fn ) {
+ return markFunction(function( argument ) {
+ argument = +argument;
+ return markFunction(function( seed, matches ) {
+ var j,
+ matchIndexes = fn( [], seed.length, argument ),
+ i = matchIndexes.length;
+
+ // Match elements found at the specified indexes
+ while ( i-- ) {
+ if ( seed[ (j = matchIndexes[i]) ] ) {
+ seed[j] = !(matches[j] = seed[j]);
+ }
+ }
+ });
+ });
+}
+
+/**
+ * Utility function for retrieving the text value of an array of DOM nodes
+ * @param {Array|Element} elem
+ */
+getText = Sizzle.getText = function( elem ) {
+ var node,
+ ret = "",
+ i = 0,
+ nodeType = elem.nodeType;
+
+ if ( !nodeType ) {
+ // If no nodeType, this is expected to be an array
+ for ( ; (node = elem[i]); i++ ) {
+ // Do not traverse comment nodes
+ ret += getText( node );
+ }
+ } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+ // Use textContent for elements
+ // innerText usage removed for consistency of new lines (see #11153)
+ if ( typeof elem.textContent === "string" ) {
+ return elem.textContent;
+ } else {
+ // Traverse its children
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ ret += getText( elem );
+ }
+ }
+ } else if ( nodeType === 3 || nodeType === 4 ) {
+ return elem.nodeValue;
+ }
+ // Do not include comment or processing instruction nodes
+
+ return ret;
+};
+
+Expr = Sizzle.selectors = {
+
+ // Can be adjusted by the user
+ cacheLength: 50,
+
+ createPseudo: markFunction,
+
+ match: matchExpr,
+
+ find: {},
+
+ relative: {
+ ">": { dir: "parentNode", first: true },
+ " ": { dir: "parentNode" },
+ "+": { dir: "previousSibling", first: true },
+ "~": { dir: "previousSibling" }
+ },
+
+ preFilter: {
+ "ATTR": function( match ) {
+ match[1] = match[1].replace( runescape, funescape );
+
+ // Move the given value to match[3] whether quoted or unquoted
+ match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
+
+ if ( match[2] === "~=" ) {
+ match[3] = " " + match[3] + " ";
+ }
+
+ return match.slice( 0, 4 );
+ },
+
+ "CHILD": function( match ) {
+ /* matches from matchExpr["CHILD"]
+ 1 type (only|nth|...)
+ 2 what (child|of-type)
+ 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
+ 4 xn-component of xn+y argument ([+-]?\d*n|)
+ 5 sign of xn-component
+ 6 x of xn-component
+ 7 sign of y-component
+ 8 y of y-component
+ */
+ match[1] = match[1].toLowerCase();
+
+ if ( match[1].slice( 0, 3 ) === "nth" ) {
+ // nth-* requires argument
+ if ( !match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ // numeric x and y parameters for Expr.filter.CHILD
+ // remember that false/true cast respectively to 0/1
+ match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
+ match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
+
+ // other types prohibit arguments
+ } else if ( match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ return match;
+ },
+
+ "PSEUDO": function( match ) {
+ var excess,
+ unquoted = !match[5] && match[2];
+
+ if ( matchExpr["CHILD"].test( match[0] ) ) {
+ return null;
+ }
+
+ // Accept quoted arguments as-is
+ if ( match[4] ) {
+ match[2] = match[4];
+
+ // Strip excess characters from unquoted arguments
+ } else if ( unquoted && rpseudo.test( unquoted ) &&
+ // Get excess from tokenize (recursively)
+ (excess = tokenize( unquoted, true )) &&
+ // advance to the next closing parenthesis
+ (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
+
+ // excess is a negative index
+ match[0] = match[0].slice( 0, excess );
+ match[2] = unquoted.slice( 0, excess );
+ }
+
+ // Return only captures needed by the pseudo filter method (type and argument)
+ return match.slice( 0, 3 );
+ }
+ },
+
+ filter: {
+
+ "TAG": function( nodeName ) {
+ if ( nodeName === "*" ) {
+ return function() { return true; };
+ }
+
+ nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
+ return function( elem ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
+ };
+ },
+
+ "CLASS": function( className ) {
+ var pattern = classCache[ className + " " ];
+
+ return pattern ||
+ (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
+ classCache( className, function( elem ) {
+ return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
+ });
+ },
+
+ "ATTR": function( name, operator, check ) {
+ return function( elem ) {
+ var result = Sizzle.attr( elem, name );
+
+ if ( result == null ) {
+ return operator === "!=";
+ }
+ if ( !operator ) {
+ return true;
+ }
+
+ result += "";
+
+ return operator === "=" ? result === check :
+ operator === "!=" ? result !== check :
+ operator === "^=" ? check && result.indexOf( check ) === 0 :
+ operator === "*=" ? check && result.indexOf( check ) > -1 :
+ operator === "$=" ? check && result.substr( result.length - check.length ) === check :
+ operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
+ operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" :
+ false;
+ };
+ },
+
+ "CHILD": function( type, what, argument, first, last ) {
+ var simple = type.slice( 0, 3 ) !== "nth",
+ forward = type.slice( -4 ) !== "last",
+ ofType = what === "of-type";
+
+ return first === 1 && last === 0 ?
+
+ // Shortcut for :nth-*(n)
+ function( elem ) {
+ return !!elem.parentNode;
+ } :
+
+ function( elem, context, xml ) {
+ var cache, outerCache, node, diff, nodeIndex, start,
+ dir = simple !== forward ? "nextSibling" : "previousSibling",
+ parent = elem.parentNode,
+ name = ofType && elem.nodeName.toLowerCase(),
+ useCache = !xml && !ofType;
+
+ if ( parent ) {
+
+ // :(first|last|only)-(child|of-type)
+ if ( simple ) {
+ while ( dir ) {
+ node = elem;
+ while ( (node = node[ dir ]) ) {
+ if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
+ return false;
+ }
+ }
+ // Reverse direction for :only-* (if we haven't yet done so)
+ start = dir = type === "only" && !start && "nextSibling";
+ }
+ return true;
+ }
+
+ start = [ forward ? parent.firstChild : parent.lastChild ];
+
+ // non-xml :nth-child(...) stores cache data on `parent`
+ if ( forward && useCache ) {
+ // Seek `elem` from a previously-cached index
+ outerCache = parent[ expando ] || (parent[ expando ] = {});
+ cache = outerCache[ type ] || [];
+ nodeIndex = cache[0] === dirruns && cache[1];
+ diff = cache[0] === dirruns && cache[2];
+ node = nodeIndex && parent.childNodes[ nodeIndex ];
+
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+
+ // Fallback to seeking `elem` from the start
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ // When found, cache indexes on `parent` and break
+ if ( node.nodeType === 1 && ++diff && node === elem ) {
+ outerCache[ type ] = [ dirruns, nodeIndex, diff ];
+ break;
+ }
+ }
+
+ // Use previously-cached element index if available
+ } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
+ diff = cache[1];
+
+ // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
+ } else {
+ // Use the same loop as above to seek `elem` from the start
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
+ // Cache the index of each encountered element
+ if ( useCache ) {
+ (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
+ }
+
+ if ( node === elem ) {
+ break;
+ }
+ }
+ }
+ }
+
+ // Incorporate the offset, then check against cycle size
+ diff -= last;
+ return diff === first || ( diff % first === 0 && diff / first >= 0 );
+ }
+ };
+ },
+
+ "PSEUDO": function( pseudo, argument ) {
+ // pseudo-class names are case-insensitive
+ // http://www.w3.org/TR/selectors/#pseudo-classes
+ // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
+ // Remember that setFilters inherits from pseudos
+ var args,
+ fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
+ Sizzle.error( "unsupported pseudo: " + pseudo );
+
+ // The user may use createPseudo to indicate that
+ // arguments are needed to create the filter function
+ // just as Sizzle does
+ if ( fn[ expando ] ) {
+ return fn( argument );
+ }
+
+ // But maintain support for old signatures
+ if ( fn.length > 1 ) {
+ args = [ pseudo, pseudo, "", argument ];
+ return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
+ markFunction(function( seed, matches ) {
+ var idx,
+ matched = fn( seed, argument ),
+ i = matched.length;
+ while ( i-- ) {
+ idx = indexOf.call( seed, matched[i] );
+ seed[ idx ] = !( matches[ idx ] = matched[i] );
+ }
+ }) :
+ function( elem ) {
+ return fn( elem, 0, args );
+ };
+ }
+
+ return fn;
+ }
+ },
+
+ pseudos: {
+ // Potentially complex pseudos
+ "not": markFunction(function( selector ) {
+ // Trim the selector passed to compile
+ // to avoid treating leading and trailing
+ // spaces as combinators
+ var input = [],
+ results = [],
+ matcher = compile( selector.replace( rtrim, "$1" ) );
+
+ return matcher[ expando ] ?
+ markFunction(function( seed, matches, context, xml ) {
+ var elem,
+ unmatched = matcher( seed, null, xml, [] ),
+ i = seed.length;
+
+ // Match elements unmatched by `matcher`
+ while ( i-- ) {
+ if ( (elem = unmatched[i]) ) {
+ seed[i] = !(matches[i] = elem);
+ }
+ }
+ }) :
+ function( elem, context, xml ) {
+ input[0] = elem;
+ matcher( input, null, xml, results );
+ return !results.pop();
+ };
+ }),
+
+ "has": markFunction(function( selector ) {
+ return function( elem ) {
+ return Sizzle( selector, elem ).length > 0;
+ };
+ }),
+
+ "contains": markFunction(function( text ) {
+ return function( elem ) {
+ return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
+ };
+ }),
+
+ // "Whether an element is represented by a :lang() selector
+ // is based solely on the element's language value
+ // being equal to the identifier C,
+ // or beginning with the identifier C immediately followed by "-".
+ // The matching of C against the element's language value is performed case-insensitively.
+ // The identifier C does not have to be a valid language name."
+ // http://www.w3.org/TR/selectors/#lang-pseudo
+ "lang": markFunction( function( lang ) {
+ // lang value must be a valid identifider
+ if ( !ridentifier.test(lang || "") ) {
+ Sizzle.error( "unsupported lang: " + lang );
+ }
+ lang = lang.replace( runescape, funescape ).toLowerCase();
+ return function( elem ) {
+ var elemLang;
+ do {
+ if ( (elemLang = documentIsXML ?
+ elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
+ elem.lang) ) {
+
+ elemLang = elemLang.toLowerCase();
+ return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
+ }
+ } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
+ return false;
+ };
+ }),
+
+ // Miscellaneous
+ "target": function( elem ) {
+ var hash = window.location && window.location.hash;
+ return hash && hash.slice( 1 ) === elem.id;
+ },
+
+ "root": function( elem ) {
+ return elem === docElem;
+ },
+
+ "focus": function( elem ) {
+ return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
+ },
+
+ // Boolean properties
+ "enabled": function( elem ) {
+ return elem.disabled === false;
+ },
+
+ "disabled": function( elem ) {
+ return elem.disabled === true;
+ },
+
+ "checked": function( elem ) {
+ // In CSS3, :checked should return both checked and selected elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ var nodeName = elem.nodeName.toLowerCase();
+ return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
+ },
+
+ "selected": function( elem ) {
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ if ( elem.parentNode ) {
+ elem.parentNode.selectedIndex;
+ }
+
+ return elem.selected === true;
+ },
+
+ // Contents
+ "empty": function( elem ) {
+ // http://www.w3.org/TR/selectors/#empty-pseudo
+ // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
+ // not comment, processing instructions, or others
+ // Thanks to Diego Perini for the nodeName shortcut
+ // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ "parent": function( elem ) {
+ return !Expr.pseudos["empty"]( elem );
+ },
+
+ // Element/input types
+ "header": function( elem ) {
+ return rheader.test( elem.nodeName );
+ },
+
+ "input": function( elem ) {
+ return rinputs.test( elem.nodeName );
+ },
+
+ "button": function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === "button" || name === "button";
+ },
+
+ "text": function( elem ) {
+ var attr;
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
+ // use getAttribute instead to test this case
+ return elem.nodeName.toLowerCase() === "input" &&
+ elem.type === "text" &&
+ ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
+ },
+
+ // Position-in-collection
+ "first": createPositionalPseudo(function() {
+ return [ 0 ];
+ }),
+
+ "last": createPositionalPseudo(function( matchIndexes, length ) {
+ return [ length - 1 ];
+ }),
+
+ "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ return [ argument < 0 ? argument + length : argument ];
+ }),
+
+ "even": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 0;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "odd": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 1;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; --i >= 0; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; ++i < length; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ })
+ }
+};
+
+// Add button/input type pseudos
+for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
+ Expr.pseudos[ i ] = createInputPseudo( i );
+}
+for ( i in { submit: true, reset: true } ) {
+ Expr.pseudos[ i ] = createButtonPseudo( i );
+}
+
+function tokenize( selector, parseOnly ) {
+ var matched, match, tokens, type,
+ soFar, groups, preFilters,
+ cached = tokenCache[ selector + " " ];
+
+ if ( cached ) {
+ return parseOnly ? 0 : cached.slice( 0 );
+ }
+
+ soFar = selector;
+ groups = [];
+ preFilters = Expr.preFilter;
+
+ while ( soFar ) {
+
+ // Comma and first run
+ if ( !matched || (match = rcomma.exec( soFar )) ) {
+ if ( match ) {
+ // Don't consume trailing commas as valid
+ soFar = soFar.slice( match[0].length ) || soFar;
+ }
+ groups.push( tokens = [] );
+ }
+
+ matched = false;
+
+ // Combinators
+ if ( (match = rcombinators.exec( soFar )) ) {
+ matched = match.shift();
+ tokens.push( {
+ value: matched,
+ // Cast descendant combinators to space
+ type: match[0].replace( rtrim, " " )
+ } );
+ soFar = soFar.slice( matched.length );
+ }
+
+ // Filters
+ for ( type in Expr.filter ) {
+ if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
+ (match = preFilters[ type ]( match ))) ) {
+ matched = match.shift();
+ tokens.push( {
+ value: matched,
+ type: type,
+ matches: match
+ } );
+ soFar = soFar.slice( matched.length );
+ }
+ }
+
+ if ( !matched ) {
+ break;
+ }
+ }
+
+ // Return the length of the invalid excess
+ // if we're just parsing
+ // Otherwise, throw an error or return tokens
+ return parseOnly ?
+ soFar.length :
+ soFar ?
+ Sizzle.error( selector ) :
+ // Cache the tokens
+ tokenCache( selector, groups ).slice( 0 );
+}
+
+function toSelector( tokens ) {
+ var i = 0,
+ len = tokens.length,
+ selector = "";
+ for ( ; i < len; i++ ) {
+ selector += tokens[i].value;
+ }
+ return selector;
+}
+
+function addCombinator( matcher, combinator, base ) {
+ var dir = combinator.dir,
+ checkNonElements = base && combinator.dir === "parentNode",
+ doneName = done++;
+
+ return combinator.first ?
+ // Check against closest ancestor/preceding element
+ function( elem, context, xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ return matcher( elem, context, xml );
+ }
+ }
+ } :
+
+ // Check against all ancestor/preceding elements
+ function( elem, context, xml ) {
+ var data, cache, outerCache,
+ dirkey = dirruns + " " + doneName;
+
+ // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
+ if ( xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ if ( matcher( elem, context, xml ) ) {
+ return true;
+ }
+ }
+ }
+ } else {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ outerCache = elem[ expando ] || (elem[ expando ] = {});
+ if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
+ if ( (data = cache[1]) === true || data === cachedruns ) {
+ return data === true;
+ }
+ } else {
+ cache = outerCache[ dir ] = [ dirkey ];
+ cache[1] = matcher( elem, context, xml ) || cachedruns;
+ if ( cache[1] === true ) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ };
+}
+
+function elementMatcher( matchers ) {
+ return matchers.length > 1 ?
+ function( elem, context, xml ) {
+ var i = matchers.length;
+ while ( i-- ) {
+ if ( !matchers[i]( elem, context, xml ) ) {
+ return false;
+ }
+ }
+ return true;
+ } :
+ matchers[0];
+}
+
+function condense( unmatched, map, filter, context, xml ) {
+ var elem,
+ newUnmatched = [],
+ i = 0,
+ len = unmatched.length,
+ mapped = map != null;
+
+ for ( ; i < len; i++ ) {
+ if ( (elem = unmatched[i]) ) {
+ if ( !filter || filter( elem, context, xml ) ) {
+ newUnmatched.push( elem );
+ if ( mapped ) {
+ map.push( i );
+ }
+ }
+ }
+ }
+
+ return newUnmatched;
+}
+
+function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
+ if ( postFilter && !postFilter[ expando ] ) {
+ postFilter = setMatcher( postFilter );
+ }
+ if ( postFinder && !postFinder[ expando ] ) {
+ postFinder = setMatcher( postFinder, postSelector );
+ }
+ return markFunction(function( seed, results, context, xml ) {
+ var temp, i, elem,
+ preMap = [],
+ postMap = [],
+ preexisting = results.length,
+
+ // Get initial elements from seed or context
+ elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
+
+ // Prefilter to get matcher input, preserving a map for seed-results synchronization
+ matcherIn = preFilter && ( seed || !selector ) ?
+ condense( elems, preMap, preFilter, context, xml ) :
+ elems,
+
+ matcherOut = matcher ?
+ // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
+ postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
+
+ // ...intermediate processing is necessary
+ [] :
+
+ // ...otherwise use results directly
+ results :
+ matcherIn;
+
+ // Find primary matches
+ if ( matcher ) {
+ matcher( matcherIn, matcherOut, context, xml );
+ }
+
+ // Apply postFilter
+ if ( postFilter ) {
+ temp = condense( matcherOut, postMap );
+ postFilter( temp, [], context, xml );
+
+ // Un-match failing elements by moving them back to matcherIn
+ i = temp.length;
+ while ( i-- ) {
+ if ( (elem = temp[i]) ) {
+ matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
+ }
+ }
+ }
+
+ if ( seed ) {
+ if ( postFinder || preFilter ) {
+ if ( postFinder ) {
+ // Get the final matcherOut by condensing this intermediate into postFinder contexts
+ temp = [];
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) ) {
+ // Restore matcherIn since elem is not yet a final match
+ temp.push( (matcherIn[i] = elem) );
+ }
+ }
+ postFinder( null, (matcherOut = []), temp, xml );
+ }
+
+ // Move matched elements from seed to results to keep them synchronized
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) &&
+ (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
+
+ seed[temp] = !(results[temp] = elem);
+ }
+ }
+ }
+
+ // Add elements to results, through postFinder if defined
+ } else {
+ matcherOut = condense(
+ matcherOut === results ?
+ matcherOut.splice( preexisting, matcherOut.length ) :
+ matcherOut
+ );
+ if ( postFinder ) {
+ postFinder( null, results, matcherOut, xml );
+ } else {
+ push.apply( results, matcherOut );
+ }
+ }
+ });
+}
+
+function matcherFromTokens( tokens ) {
+ var checkContext, matcher, j,
+ len = tokens.length,
+ leadingRelative = Expr.relative[ tokens[0].type ],
+ implicitRelative = leadingRelative || Expr.relative[" "],
+ i = leadingRelative ? 1 : 0,
+
+ // The foundational matcher ensures that elements are reachable from top-level context(s)
+ matchContext = addCombinator( function( elem ) {
+ return elem === checkContext;
+ }, implicitRelative, true ),
+ matchAnyContext = addCombinator( function( elem ) {
+ return indexOf.call( checkContext, elem ) > -1;
+ }, implicitRelative, true ),
+ matchers = [ function( elem, context, xml ) {
+ return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
+ (checkContext = context).nodeType ?
+ matchContext( elem, context, xml ) :
+ matchAnyContext( elem, context, xml ) );
+ } ];
+
+ for ( ; i < len; i++ ) {
+ if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
+ matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
+ } else {
+ matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
+
+ // Return special upon seeing a positional matcher
+ if ( matcher[ expando ] ) {
+ // Find the next relative operator (if any) for proper handling
+ j = ++i;
+ for ( ; j < len; j++ ) {
+ if ( Expr.relative[ tokens[j].type ] ) {
+ break;
+ }
+ }
+ return setMatcher(
+ i > 1 && elementMatcher( matchers ),
+ i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),
+ matcher,
+ i < j && matcherFromTokens( tokens.slice( i, j ) ),
+ j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
+ j < len && toSelector( tokens )
+ );
+ }
+ matchers.push( matcher );
+ }
+ }
+
+ return elementMatcher( matchers );
+}
+
+function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
+ // A counter to specify which element is currently being matched
+ var matcherCachedRuns = 0,
+ bySet = setMatchers.length > 0,
+ byElement = elementMatchers.length > 0,
+ superMatcher = function( seed, context, xml, results, expandContext ) {
+ var elem, j, matcher,
+ setMatched = [],
+ matchedCount = 0,
+ i = "0",
+ unmatched = seed && [],
+ outermost = expandContext != null,
+ contextBackup = outermostContext,
+ // We must always have either seed elements or context
+ elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
+ // Nested matchers should use non-integer dirruns
+ dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);
+
+ if ( outermost ) {
+ outermostContext = context !== document && context;
+ cachedruns = matcherCachedRuns;
+ }
+
+ // Add elements passing elementMatchers directly to results
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ if ( byElement && elem ) {
+ for ( j = 0; (matcher = elementMatchers[j]); j++ ) {
+ if ( matcher( elem, context, xml ) ) {
+ results.push( elem );
+ break;
+ }
+ }
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ cachedruns = ++matcherCachedRuns;
+ }
+ }
+
+ // Track unmatched elements for set filters
+ if ( bySet ) {
+ // They will have gone through all possible matchers
+ if ( (elem = !matcher && elem) ) {
+ matchedCount--;
+ }
+
+ // Lengthen the array for every element, matched or not
+ if ( seed ) {
+ unmatched.push( elem );
+ }
+ }
+ }
+
+ // Apply set filters to unmatched elements
+ // `i` starts as a string, so matchedCount would equal "00" if there are no elements
+ matchedCount += i;
+ if ( bySet && i !== matchedCount ) {
+ for ( j = 0; (matcher = setMatchers[j]); j++ ) {
+ matcher( unmatched, setMatched, context, xml );
+ }
+
+ if ( seed ) {
+ // Reintegrate element matches to eliminate the need for sorting
+ if ( matchedCount > 0 ) {
+ while ( i-- ) {
+ if ( !(unmatched[i] || setMatched[i]) ) {
+ setMatched[i] = pop.call( results );
+ }
+ }
+ }
+
+ // Discard index placeholder values to get only actual matches
+ setMatched = condense( setMatched );
+ }
+
+ // Add matches to results
+ push.apply( results, setMatched );
+
+ // Seedless set matches succeeding multiple successful matchers stipulate sorting
+ if ( outermost && !seed && setMatched.length > 0 &&
+ ( matchedCount + setMatchers.length ) > 1 ) {
+
+ Sizzle.uniqueSort( results );
+ }
+ }
+
+ // Override manipulation of globals by nested matchers
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ outermostContext = contextBackup;
+ }
+
+ return unmatched;
+ };
+
+ return bySet ?
+ markFunction( superMatcher ) :
+ superMatcher;
+}
+
+compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
+ var i,
+ setMatchers = [],
+ elementMatchers = [],
+ cached = compilerCache[ selector + " " ];
+
+ if ( !cached ) {
+ // Generate a function of recursive functions that can be used to check each element
+ if ( !group ) {
+ group = tokenize( selector );
+ }
+ i = group.length;
+ while ( i-- ) {
+ cached = matcherFromTokens( group[i] );
+ if ( cached[ expando ] ) {
+ setMatchers.push( cached );
+ } else {
+ elementMatchers.push( cached );
+ }
+ }
+
+ // Cache the compiled function
+ cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
+ }
+ return cached;
+};
+
+function multipleContexts( selector, contexts, results ) {
+ var i = 0,
+ len = contexts.length;
+ for ( ; i < len; i++ ) {
+ Sizzle( selector, contexts[i], results );
+ }
+ return results;
+}
+
+function select( selector, context, results, seed ) {
+ var i, tokens, token, type, find,
+ match = tokenize( selector );
+
+ if ( !seed ) {
+ // Try to minimize operations if there is only one group
+ if ( match.length === 1 ) {
+
+ // Take a shortcut and set the context if the root selector is an ID
+ tokens = match[0] = match[0].slice( 0 );
+ if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
+ context.nodeType === 9 && !documentIsXML &&
+ Expr.relative[ tokens[1].type ] ) {
+
+ context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
+ if ( !context ) {
+ return results;
+ }
+
+ selector = selector.slice( tokens.shift().value.length );
+ }
+
+ // Fetch a seed set for right-to-left matching
+ for ( i = matchExpr["needsContext"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) {
+ token = tokens[i];
+
+ // Abort if we hit a combinator
+ if ( Expr.relative[ (type = token.type) ] ) {
+ break;
+ }
+ if ( (find = Expr.find[ type ]) ) {
+ // Search, expanding context for leading sibling combinators
+ if ( (seed = find(
+ token.matches[0].replace( runescape, funescape ),
+ rsibling.test( tokens[0].type ) && context.parentNode || context
+ )) ) {
+
+ // If seed is empty or no tokens remain, we can return early
+ tokens.splice( i, 1 );
+ selector = seed.length && toSelector( tokens );
+ if ( !selector ) {
+ push.apply( results, slice.call( seed, 0 ) );
+ return results;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Compile and execute a filtering function
+ // Provide `match` to avoid retokenization if we modified the selector above
+ compile( selector, match )(
+ seed,
+ context,
+ documentIsXML,
+ results,
+ rsibling.test( selector )
+ );
+ return results;
+}
+
+// Deprecated
+Expr.pseudos["nth"] = Expr.pseudos["eq"];
+
+// Easy API for creating new setFilters
+function setFilters() {}
+Expr.filters = setFilters.prototype = Expr.pseudos;
+Expr.setFilters = new setFilters();
+
+// Initialize with the default document
+setDocument();
+
+// Override sizzle attribute retrieval
+Sizzle.attr = jQuery.attr;
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.pseudos;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+
+
+})( window );
+var runtil = /Until$/,
+ rparentsprev = /^(?:parents|prev(?:Until|All))/,
+ isSimple = /^.[^:#\[\.,]*$/,
+ rneedsContext = jQuery.expr.match.needsContext,
+ // methods guaranteed to produce a unique set when starting from a unique set
+ guaranteedUnique = {
+ children: true,
+ contents: true,
+ next: true,
+ prev: true
+ };
+
+jQuery.fn.extend({
+ find: function( selector ) {
+ var i, ret, self;
+
+ if ( typeof selector !== "string" ) {
+ self = this;
+ return this.pushStack( jQuery( selector ).filter(function() {
+ for ( i = 0; i < self.length; i++ ) {
+ if ( jQuery.contains( self[ i ], this ) ) {
+ return true;
+ }
+ }
+ }) );
+ }
+
+ ret = [];
+ for ( i = 0; i < this.length; i++ ) {
+ jQuery.find( selector, this[ i ], ret );
+ }
+
+ // Needed because $( selector, context ) becomes $( context ).find( selector )
+ ret = this.pushStack( jQuery.unique( ret ) );
+ ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;
+ return ret;
+ },
+
+ has: function( target ) {
+ var i,
+ targets = jQuery( target, this ),
+ len = targets.length;
+
+ return this.filter(function() {
+ for ( i = 0; i < len; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
+
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector, false) );
+ },
+
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector, true) );
+ },
+
+ is: function( selector ) {
+ return !!selector && (
+ typeof selector === "string" ?
+ // If this is a positional/relative selector, check membership in the returned set
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
+ rneedsContext.test( selector ) ?
+ jQuery( selector, this.context ).index( this[0] ) >= 0 :
+ jQuery.filter( selector, this ).length > 0 :
+ this.filter( selector ).length > 0 );
+ },
+
+ closest: function( selectors, context ) {
+ var cur,
+ i = 0,
+ l = this.length,
+ ret = [],
+ pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
+ jQuery( selectors, context || this.context ) :
+ 0;
+
+ for ( ; i < l; i++ ) {
+ cur = this[i];
+
+ while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
+ ret.push( cur );
+ break;
+ }
+ cur = cur.parentNode;
+ }
+ }
+
+ return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+
+ // No argument, return index in parent
+ if ( !elem ) {
+ return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
+ }
+
+ // index in selector
+ if ( typeof elem === "string" ) {
+ return jQuery.inArray( this[0], jQuery( elem ) );
+ }
+
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem.jquery ? elem[0] : elem, this );
+ },
+
+ add: function( selector, context ) {
+ var set = typeof selector === "string" ?
+ jQuery( selector, context ) :
+ jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
+ all = jQuery.merge( this.get(), set );
+
+ return this.pushStack( jQuery.unique(all) );
+ },
+
+ addBack: function( selector ) {
+ return this.add( selector == null ?
+ this.prevObject : this.prevObject.filter(selector)
+ );
+ }
+});
+
+jQuery.fn.andSelf = jQuery.fn.addBack;
+
+function sibling( cur, dir ) {
+ do {
+ cur = cur[ dir ];
+ } while ( cur && cur.nodeType !== 1 );
+
+ return cur;
+}
+
+jQuery.each({
+ parent: function( elem ) {
+ var parent = elem.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function( elem ) {
+ return jQuery.dir( elem, "parentNode" );
+ },
+ parentsUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "parentNode", until );
+ },
+ next: function( elem ) {
+ return sibling( elem, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return sibling( elem, "previousSibling" );
+ },
+ nextAll: function( elem ) {
+ return jQuery.dir( elem, "nextSibling" );
+ },
+ prevAll: function( elem ) {
+ return jQuery.dir( elem, "previousSibling" );
+ },
+ nextUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "nextSibling", until );
+ },
+ prevUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "previousSibling", until );
+ },
+ siblings: function( elem ) {
+ return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
+ },
+ children: function( elem ) {
+ return jQuery.sibling( elem.firstChild );
+ },
+ contents: function( elem ) {
+ return jQuery.nodeName( elem, "iframe" ) ?
+ elem.contentDocument || elem.contentWindow.document :
+ jQuery.merge( [], elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var ret = jQuery.map( this, fn, until );
+
+ if ( !runtil.test( name ) ) {
+ selector = until;
+ }
+
+ if ( selector && typeof selector === "string" ) {
+ ret = jQuery.filter( selector, ret );
+ }
+
+ ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
+
+ if ( this.length > 1 && rparentsprev.test( name ) ) {
+ ret = ret.reverse();
+ }
+
+ return this.pushStack( ret );
+ };
+});
+
+jQuery.extend({
+ filter: function( expr, elems, not ) {
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return elems.length === 1 ?
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
+ jQuery.find.matches(expr, elems);
+ },
+
+ dir: function( elem, dir, until ) {
+ var matched = [],
+ cur = elem[ dir ];
+
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+ if ( cur.nodeType === 1 ) {
+ matched.push( cur );
+ }
+ cur = cur[dir];
+ }
+ return matched;
+ },
+
+ sibling: function( n, elem ) {
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType === 1 && n !== elem ) {
+ r.push( n );
+ }
+ }
+
+ return r;
+ }
+});
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, keep ) {
+
+ // Can't pass null or undefined to indexOf in Firefox 4
+ // Set to 0 to skip string check
+ qualifier = qualifier || 0;
+
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ var retVal = !!qualifier.call( elem, i, elem );
+ return retVal === keep;
+ });
+
+ } else if ( qualifier.nodeType ) {
+ return jQuery.grep(elements, function( elem ) {
+ return ( elem === qualifier ) === keep;
+ });
+
+ } else if ( typeof qualifier === "string" ) {
+ var filtered = jQuery.grep(elements, function( elem ) {
+ return elem.nodeType === 1;
+ });
+
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter(qualifier, filtered, !keep);
+ } else {
+ qualifier = jQuery.filter( qualifier, filtered );
+ }
+ }
+
+ return jQuery.grep(elements, function( elem ) {
+ return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
+ });
+}
+function createSafeFragment( document ) {
+ var list = nodeNames.split( "|" ),
+ safeFrag = document.createDocumentFragment();
+
+ if ( safeFrag.createElement ) {
+ while ( list.length ) {
+ safeFrag.createElement(
+ list.pop()
+ );
+ }
+ }
+ return safeFrag;
+}
+
+var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
+ "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
+ rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
+ rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
+ rleadingWhitespace = /^\s+/,
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
+ rtagName = /<([\w:]+)/,
+ rtbody = /<tbody/i,
+ rhtml = /<|&#?\w+;/,
+ rnoInnerhtml = /<(?:script|style|link)/i,
+ manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
+ // checked="checked" or checked
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+ rscriptType = /^$|\/(?:java|ecma)script/i,
+ rscriptTypeMasked = /^true\/(.*)/,
+ rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
+
+ // We have to close these tags to support XHTML (#13200)
+ wrapMap = {
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
+ area: [ 1, "<map>", "</map>" ],
+ param: [ 1, "<object>", "</object>" ],
+ thead: [ 1, "<table>", "</table>" ],
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+
+ // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
+ // unless wrapped in a div with non-breaking characters in front of it.
+ _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
+ },
+ safeFragment = createSafeFragment( document ),
+ fragmentDiv = safeFragment.appendChild( document.createElement("div") );
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+jQuery.fn.extend({
+ text: function( value ) {
+ return jQuery.access( this, function( value ) {
+ return value === undefined ?
+ jQuery.text( this ) :
+ this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
+ }, null, value, arguments.length );
+ },
+
+ wrapAll: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapAll( html.call(this, i) );
+ });
+ }
+
+ if ( this[0] ) {
+ // The elements to wrap the target around
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
+
+ if ( this[0].parentNode ) {
+ wrap.insertBefore( this[0] );
+ }
+
+ wrap.map(function() {
+ var elem = this;
+
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
+ elem = elem.firstChild;
+ }
+
+ return elem;
+ }).append( this );
+ }
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapInner( html.call(this, i) );
+ });
+ }
+
+ return this.each(function() {
+ var self = jQuery( this ),
+ contents = self.contents();
+
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
+ });
+ },
+
+ wrap: function( html ) {
+ var isFunction = jQuery.isFunction( html );
+
+ return this.each(function(i) {
+ jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
+ });
+ },
+
+ unwrap: function() {
+ return this.parent().each(function() {
+ if ( !jQuery.nodeName( this, "body" ) ) {
+ jQuery( this ).replaceWith( this.childNodes );
+ }
+ }).end();
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ this.appendChild( elem );
+ }
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ this.insertBefore( elem, this.firstChild );
+ }
+ });
+ },
+
+ before: function() {
+ return this.domManip( arguments, false, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this );
+ }
+ });
+ },
+
+ after: function() {
+ return this.domManip( arguments, false, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ }
+ });
+ },
+
+ // keepData is for internal use only--do not document
+ remove: function( selector, keepData ) {
+ var elem,
+ i = 0;
+
+ for ( ; (elem = this[i]) != null; i++ ) {
+ if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
+ if ( !keepData && elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem ) );
+ }
+
+ if ( elem.parentNode ) {
+ if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
+ setGlobalEval( getAll( elem, "script" ) );
+ }
+ elem.parentNode.removeChild( elem );
+ }
+ }
+ }
+
+ return this;
+ },
+
+ empty: function() {
+ var elem,
+ i = 0;
+
+ for ( ; (elem = this[i]) != null; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem, false ) );
+ }
+
+ // Remove any remaining nodes
+ while ( elem.firstChild ) {
+ elem.removeChild( elem.firstChild );
+ }
+
+ // If this is a select, ensure that it displays empty (#12336)
+ // Support: IE<9
+ if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
+ elem.options.length = 0;
+ }
+ }
+
+ return this;
+ },
+
+ clone: function( dataAndEvents, deepDataAndEvents ) {
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
+
+ return this.map( function () {
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
+ });
+ },
+
+ html: function( value ) {
+ return jQuery.access( this, function( value ) {
+ var elem = this[0] || {},
+ i = 0,
+ l = this.length;
+
+ if ( value === undefined ) {
+ return elem.nodeType === 1 ?
+ elem.innerHTML.replace( rinlinejQuery, "" ) :
+ undefined;
+ }
+
+ // See if we can take a shortcut and just use innerHTML
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+ ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
+ ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
+ !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
+
+ value = value.replace( rxhtmlTag, "<$1></$2>" );
+
+ try {
+ for (; i < l; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ elem = this[i] || {};
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem, false ) );
+ elem.innerHTML = value;
+ }
+ }
+
+ elem = 0;
+
+ // If using innerHTML throws an exception, use the fallback method
+ } catch(e) {}
+ }
+
+ if ( elem ) {
+ this.empty().append( value );
+ }
+ }, null, value, arguments.length );
+ },
+
+ replaceWith: function( value ) {
+ var isFunc = jQuery.isFunction( value );
+
+ // Make sure that the elements are removed from the DOM before they are inserted
+ // this can help fix replacing a parent with child elements
+ if ( !isFunc && typeof value !== "string" ) {
+ value = jQuery( value ).not( this ).detach();
+ }
+
+ return this.domManip( [ value ], true, function( elem ) {
+ var next = this.nextSibling,
+ parent = this.parentNode;
+
+ if ( parent && this.nodeType === 1 || this.nodeType === 11 ) {
+
+ jQuery( this ).remove();
+
+ if ( next ) {
+ next.parentNode.insertBefore( elem, next );
+ } else {
+ parent.appendChild( elem );
+ }
+ }
+ });
+ },
+
+ detach: function( selector ) {
+ return this.remove( selector, true );
+ },
+
+ domManip: function( args, table, callback ) {
+
+ // Flatten any nested arrays
+ args = core_concat.apply( [], args );
+
+ var fragment, first, scripts, hasScripts, node, doc,
+ i = 0,
+ l = this.length,
+ set = this,
+ iNoClone = l - 1,
+ value = args[0],
+ isFunction = jQuery.isFunction( value );
+
+ // We can't cloneNode fragments that contain checked, in WebKit
+ if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
+ return this.each(function( index ) {
+ var self = set.eq( index );
+ if ( isFunction ) {
+ args[0] = value.call( this, index, table ? self.html() : undefined );
+ }
+ self.domManip( args, table, callback );
+ });
+ }
+
+ if ( l ) {
+ fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
+ first = fragment.firstChild;
+
+ if ( fragment.childNodes.length === 1 ) {
+ fragment = first;
+ }
+
+ if ( first ) {
+ table = table && jQuery.nodeName( first, "tr" );
+ scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
+ hasScripts = scripts.length;
+
+ // Use the original fragment for the last item instead of the first because it can end up
+ // being emptied incorrectly in certain situations (#8070).
+ for ( ; i < l; i++ ) {
+ node = fragment;
+
+ if ( i !== iNoClone ) {
+ node = jQuery.clone( node, true, true );
+
+ // Keep references to cloned scripts for later restoration
+ if ( hasScripts ) {
+ jQuery.merge( scripts, getAll( node, "script" ) );
+ }
+ }
+
+ callback.call(
+ table && jQuery.nodeName( this[i], "table" ) ?
+ findOrAppend( this[i], "tbody" ) :
+ this[i],
+ node,
+ i
+ );
+ }
+
+ if ( hasScripts ) {
+ doc = scripts[ scripts.length - 1 ].ownerDocument;
+
+ // Reenable scripts
+ jQuery.map( scripts, restoreScript );
+
+ // Evaluate executable scripts on first document insertion
+ for ( i = 0; i < hasScripts; i++ ) {
+ node = scripts[ i ];
+ if ( rscriptType.test( node.type || "" ) &&
+ !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
+
+ if ( node.src ) {
+ // Hope ajax is available...
+ jQuery.ajax({
+ url: node.src,
+ type: "GET",
+ dataType: "script",
+ async: false,
+ global: false,
+ "throws": true
+ });
+ } else {
+ jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
+ }
+ }
+ }
+ }
+
+ // Fix #11809: Avoid leaking memory
+ fragment = first = null;
+ }
+ }
+
+ return this;
+ }
+});
+
+function findOrAppend( elem, tag ) {
+ return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
+}
+
+// Replace/restore the type attribute of script elements for safe DOM manipulation
+function disableScript( elem ) {
+ var attr = elem.getAttributeNode("type");
+ elem.type = ( attr && attr.specified ) + "/" + elem.type;
+ return elem;
+}
+function restoreScript( elem ) {
+ var match = rscriptTypeMasked.exec( elem.type );
+ if ( match ) {
+ elem.type = match[1];
+ } else {
+ elem.removeAttribute("type");
+ }
+ return elem;
+}
+
+// Mark scripts as having already been evaluated
+function setGlobalEval( elems, refElements ) {
+ var elem,
+ i = 0;
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
+ }
+}
+
+function cloneCopyEvent( src, dest ) {
+
+ if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
+ return;
+ }
+
+ var type, i, l,
+ oldData = jQuery._data( src ),
+ curData = jQuery._data( dest, oldData ),
+ events = oldData.events;
+
+ if ( events ) {
+ delete curData.handle;
+ curData.events = {};
+
+ for ( type in events ) {
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {
+ jQuery.event.add( dest, type, events[ type ][ i ] );
+ }
+ }
+ }
+
+ // make the cloned public data object a copy from the original
+ if ( curData.data ) {
+ curData.data = jQuery.extend( {}, curData.data );
+ }
+}
+
+function fixCloneNodeIssues( src, dest ) {
+ var nodeName, data, e;
+
+ // We do not need to do anything for non-Elements
+ if ( dest.nodeType !== 1 ) {
+ return;
+ }
+
+ nodeName = dest.nodeName.toLowerCase();
+
+ // IE6-8 copies events bound via attachEvent when using cloneNode.
+ if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
+ data = jQuery._data( dest );
+
+ for ( e in data.events ) {
+ jQuery.removeEvent( dest, e, data.handle );
+ }
+
+ // Event data gets referenced instead of copied if the expando gets copied too
+ dest.removeAttribute( jQuery.expando );
+ }
+
+ // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
+ if ( nodeName === "script" && dest.text !== src.text ) {
+ disableScript( dest ).text = src.text;
+ restoreScript( dest );
+
+ // IE6-10 improperly clones children of object elements using classid.
+ // IE10 throws NoModificationAllowedError if parent is null, #12132.
+ } else if ( nodeName === "object" ) {
+ if ( dest.parentNode ) {
+ dest.outerHTML = src.outerHTML;
+ }
+
+ // This path appears unavoidable for IE9. When cloning an object
+ // element in IE9, the outerHTML strategy above is not sufficient.
+ // If the src has innerHTML and the destination does not,
+ // copy the src.innerHTML into the dest.innerHTML. #10324
+ if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
+ dest.innerHTML = src.innerHTML;
+ }
+
+ } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
+ // IE6-8 fails to persist the checked state of a cloned checkbox
+ // or radio button. Worse, IE6-7 fail to give the cloned element
+ // a checked appearance if the defaultChecked value isn't also set
+
+ dest.defaultChecked = dest.checked = src.checked;
+
+ // IE6-7 get confused and end up setting the value of a cloned
+ // checkbox/radio button to an empty string instead of "on"
+ if ( dest.value !== src.value ) {
+ dest.value = src.value;
+ }
+
+ // IE6-8 fails to return the selected option to the default selected
+ // state when cloning options
+ } else if ( nodeName === "option" ) {
+ dest.defaultSelected = dest.selected = src.defaultSelected;
+
+ // IE6-8 fails to set the defaultValue to the correct value when
+ // cloning other types of input fields
+ } else if ( nodeName === "input" || nodeName === "textarea" ) {
+ dest.defaultValue = src.defaultValue;
+ }
+}
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function( name, original ) {
+ jQuery.fn[ name ] = function( selector ) {
+ var elems,
+ i = 0,
+ ret = [],
+ insert = jQuery( selector ),
+ last = insert.length - 1;
+
+ for ( ; i <= last; i++ ) {
+ elems = i === last ? this : this.clone(true);
+ jQuery( insert[i] )[ original ]( elems );
+
+ // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
+ core_push.apply( ret, elems.get() );
+ }
+
+ return this.pushStack( ret );
+ };
+});
+
+function getAll( context, tag ) {
+ var elems, elem,
+ i = 0,
+ found = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( tag || "*" ) :
+ typeof context.querySelectorAll !== "undefined" ? context.querySelectorAll( tag || "*" ) :
+ undefined;
+
+ if ( !found ) {
+ for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
+ if ( !tag || jQuery.nodeName( elem, tag ) ) {
+ found.push( elem );
+ } else {
+ jQuery.merge( found, getAll( elem, tag ) );
+ }
+ }
+ }
+
+ return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
+ jQuery.merge( [ context ], found ) :
+ found;
+}
+
+// Used in buildFragment, fixes the defaultChecked property
+function fixDefaultChecked( elem ) {
+ if ( manipulation_rcheckableType.test( elem.type ) ) {
+ elem.defaultChecked = elem.checked;
+ }
+}
+
+jQuery.extend({
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) {
+ var destElements, srcElements, node, i, clone,
+ inPage = jQuery.contains( elem.ownerDocument, elem );
+
+ if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
+ clone = elem.cloneNode( true );
+
+ // IE<=8 does not properly clone detached, unknown element nodes
+ } else {
+ fragmentDiv.innerHTML = elem.outerHTML;
+ fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
+ }
+
+ if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
+ (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
+
+ // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
+ destElements = getAll( clone );
+ srcElements = getAll( elem );
+
+ // Fix all IE cloning issues
+ for ( i = 0; (node = srcElements[i]) != null; ++i ) {
+ // Ensure that the destination node is not null; Fixes #9587
+ if ( destElements[i] ) {
+ fixCloneNodeIssues( node, destElements[i] );
+ }
+ }
+ }
+
+ // Copy the events from the original to the clone
+ if ( dataAndEvents ) {
+ if ( deepDataAndEvents ) {
+ srcElements = srcElements || getAll( elem );
+ destElements = destElements || getAll( clone );
+
+ for ( i = 0; (node = srcElements[i]) != null; i++ ) {
+ cloneCopyEvent( node, destElements[i] );
+ }
+ } else {
+ cloneCopyEvent( elem, clone );
+ }
+ }
+
+ // Preserve script evaluation history
+ destElements = getAll( clone, "script" );
+ if ( destElements.length > 0 ) {
+ setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
+ }
+
+ destElements = srcElements = node = null;
+
+ // Return the cloned set
+ return clone;
+ },
+
+ buildFragment: function( elems, context, scripts, selection ) {
+ var contains, elem, tag, tmp, wrap, tbody, j,
+ l = elems.length,
+
+ // Ensure a safe fragment
+ safe = createSafeFragment( context ),
+
+ nodes = [],
+ i = 0;
+
+ for ( ; i < l; i++ ) {
+ elem = elems[ i ];
+
+ if ( elem || elem === 0 ) {
+
+ // Add nodes directly
+ if ( jQuery.type( elem ) === "object" ) {
+ jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
+
+ // Convert non-html into a text node
+ } else if ( !rhtml.test( elem ) ) {
+ nodes.push( context.createTextNode( elem ) );
+
+ // Convert html into DOM nodes
+ } else {
+ tmp = tmp || safe.appendChild( context.createElement("div") );
+
+ // Deserialize a standard representation
+ tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
+ wrap = wrapMap[ tag ] || wrapMap._default;
+
+ tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
+
+ // Descend through wrappers to the right content
+ j = wrap[0];
+ while ( j-- ) {
+ tmp = tmp.lastChild;
+ }
+
+ // Manually add leading whitespace removed by IE
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+ nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
+ }
+
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( !jQuery.support.tbody ) {
+
+ // String was a <table>, *may* have spurious <tbody>
+ elem = tag === "table" && !rtbody.test( elem ) ?
+ tmp.firstChild :
+
+ // String was a bare <thead> or <tfoot>
+ wrap[1] === "<table>" && !rtbody.test( elem ) ?
+ tmp :
+ 0;
+
+ j = elem && elem.childNodes.length;
+ while ( j-- ) {
+ if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
+ elem.removeChild( tbody );
+ }
+ }
+ }
+
+ jQuery.merge( nodes, tmp.childNodes );
+
+ // Fix #12392 for WebKit and IE > 9
+ tmp.textContent = "";
+
+ // Fix #12392 for oldIE
+ while ( tmp.firstChild ) {
+ tmp.removeChild( tmp.firstChild );
+ }
+
+ // Remember the top-level container for proper cleanup
+ tmp = safe.lastChild;
+ }
+ }
+ }
+
+ // Fix #11356: Clear elements from fragment
+ if ( tmp ) {
+ safe.removeChild( tmp );
+ }
+
+ // Reset defaultChecked for any radios and checkboxes
+ // about to be appended to the DOM in IE 6/7 (#8060)
+ if ( !jQuery.support.appendChecked ) {
+ jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
+ }
+
+ i = 0;
+ while ( (elem = nodes[ i++ ]) ) {
+
+ // #4087 - If origin and destination elements are the same, and this is
+ // that element, do not do anything
+ if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
+ continue;
+ }
+
+ contains = jQuery.contains( elem.ownerDocument, elem );
+
+ // Append to fragment
+ tmp = getAll( safe.appendChild( elem ), "script" );
+
+ // Preserve script evaluation history
+ if ( contains ) {
+ setGlobalEval( tmp );
+ }
+
+ // Capture executables
+ if ( scripts ) {
+ j = 0;
+ while ( (elem = tmp[ j++ ]) ) {
+ if ( rscriptType.test( elem.type || "" ) ) {
+ scripts.push( elem );
+ }
+ }
+ }
+ }
+
+ tmp = null;
+
+ return safe;
+ },
+
+ cleanData: function( elems, /* internal */ acceptData ) {
+ var data, id, elem, type,
+ i = 0,
+ internalKey = jQuery.expando,
+ cache = jQuery.cache,
+ deleteExpando = jQuery.support.deleteExpando,
+ special = jQuery.event.special;
+
+ for ( ; (elem = elems[i]) != null; i++ ) {
+
+ if ( acceptData || jQuery.acceptData( elem ) ) {
+
+ id = elem[ internalKey ];
+ data = id && cache[ id ];
+
+ if ( data ) {
+ if ( data.events ) {
+ for ( type in data.events ) {
+ if ( special[ type ] ) {
+ jQuery.event.remove( elem, type );
+
+ // This is a shortcut to avoid jQuery.event.remove's overhead
+ } else {
+ jQuery.removeEvent( elem, type, data.handle );
+ }
+ }
+ }
+
+ // Remove cache only if it was not already removed by jQuery.event.remove
+ if ( cache[ id ] ) {
+
+ delete cache[ id ];
+
+ // IE does not allow us to delete expando properties from nodes,
+ // nor does it have a removeAttribute function on Document nodes;
+ // we must handle all of these cases
+ if ( deleteExpando ) {
+ delete elem[ internalKey ];
+
+ } else if ( typeof elem.removeAttribute !== "undefined" ) {
+ elem.removeAttribute( internalKey );
+
+ } else {
+ elem[ internalKey ] = null;
+ }
+
+ core_deletedIds.push( id );
+ }
+ }
+ }
+ }
+ }
+});
+var curCSS, getStyles, iframe,
+ ralpha = /alpha\([^)]*\)/i,
+ ropacity = /opacity\s*=\s*([^)]*)/,
+ rposition = /^(top|right|bottom|left)$/,
+ // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
+ // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
+ rdisplayswap = /^(none|table(?!-c[ea]).+)/,
+ rmargin = /^margin/,
+ rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
+ rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
+ rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
+ elemdisplay = { BODY: "block" },
+
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
+ cssNormalTransform = {
+ letterSpacing: 0,
+ fontWeight: 400
+ },
+
+ cssExpand = [ "Top", "Right", "Bottom", "Left" ],
+ cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
+
+// return a css property mapped to a potentially vendor prefixed property
+function vendorPropName( style, name ) {
+
+ // shortcut for names that are not vendor prefixed
+ if ( name in style ) {
+ return name;
+ }
+
+ // check for vendor prefixed names
+ var capName = name.charAt(0).toUpperCase() + name.slice(1),
+ origName = name,
+ i = cssPrefixes.length;
+
+ while ( i-- ) {
+ name = cssPrefixes[ i ] + capName;
+ if ( name in style ) {
+ return name;
+ }
+ }
+
+ return origName;
+}
+
+function isHidden( elem, el ) {
+ // isHidden might be called from jQuery#filter function;
+ // in that case, element will be second argument
+ elem = el || elem;
+ return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
+}
+
+function showHide( elements, show ) {
+ var elem,
+ values = [],
+ index = 0,
+ length = elements.length;
+
+ for ( ; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+ values[ index ] = jQuery._data( elem, "olddisplay" );
+ if ( show ) {
+ // Reset the inline display of this element to learn if it is
+ // being hidden by cascaded rules or not
+ if ( !values[ index ] && elem.style.display === "none" ) {
+ elem.style.display = "";
+ }
+
+ // Set elements which have been overridden with display: none
+ // in a stylesheet to whatever the default browser style is
+ // for such an element
+ if ( elem.style.display === "" && isHidden( elem ) ) {
+ values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
+ }
+ } else if ( !values[ index ] && !isHidden( elem ) ) {
+ jQuery._data( elem, "olddisplay", jQuery.css( elem, "display" ) );
+ }
+ }
+
+ // Set the display of most of the elements in a second loop
+ // to avoid the constant reflow
+ for ( index = 0; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+ if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
+ elem.style.display = show ? values[ index ] || "" : "none";
+ }
+ }
+
+ return elements;
+}
+
+jQuery.fn.extend({
+ css: function( name, value ) {
+ return jQuery.access( this, function( elem, name, value ) {
+ var styles, len,
+ map = {},
+ i = 0;
+
+ if ( jQuery.isArray( name ) ) {
+ styles = getStyles( elem );
+ len = name.length;
+
+ for ( ; i < len; i++ ) {
+ map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
+ }
+
+ return map;
+ }
+
+ return value !== undefined ?
+ jQuery.style( elem, name, value ) :
+ jQuery.css( elem, name );
+ }, name, value, arguments.length > 1 );
+ },
+ show: function() {
+ return showHide( this, true );
+ },
+ hide: function() {
+ return showHide( this );
+ },
+ toggle: function( state ) {
+ var bool = typeof state === "boolean";
+
+ return this.each(function() {
+ if ( bool ? state : isHidden( this ) ) {
+ jQuery( this ).show();
+ } else {
+ jQuery( this ).hide();
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ // Add in style property hooks for overriding the default
+ // behavior of getting and setting a style property
+ cssHooks: {
+ opacity: {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // We should always get a number back from opacity
+ var ret = curCSS( elem, "opacity" );
+ return ret === "" ? "1" : ret;
+ }
+ }
+ }
+ },
+
+ // Exclude the following css properties to add px
+ cssNumber: {
+ "columnCount": true,
+ "fillOpacity": true,
+ "fontWeight": true,
+ "lineHeight": true,
+ "opacity": true,
+ "orphans": true,
+ "widows": true,
+ "zIndex": true,
+ "zoom": true
+ },
+
+ // Add in properties whose names you wish to fix before
+ // setting or getting the value
+ cssProps: {
+ // normalize float css property
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
+ },
+
+ // Get and set the style property on a DOM Node
+ style: function( elem, name, value, extra ) {
+ // Don't set styles on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
+ return;
+ }
+
+ // Make sure that we're working with the right name
+ var ret, type, hooks,
+ origName = jQuery.camelCase( name ),
+ style = elem.style;
+
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+ // Check if we're setting a value
+ if ( value !== undefined ) {
+ type = typeof value;
+
+ // convert relative number strings (+= or -=) to relative numbers. #7345
+ if ( type === "string" && (ret = rrelNum.exec( value )) ) {
+ value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
+ // Fixes bug #9237
+ type = "number";
+ }
+
+ // Make sure that NaN and null values aren't set. See: #7116
+ if ( value == null || type === "number" && isNaN( value ) ) {
+ return;
+ }
+
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
+ if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
+ value += "px";
+ }
+
+ // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
+ // but it would mean to define eight (for every problematic property) identical functions
+ if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
+ style[ name ] = "inherit";
+ }
+
+ // If a hook was provided, use that value, otherwise just set the specified value
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
+
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
+ // Fixes bug #5509
+ try {
+ style[ name ] = value;
+ } catch(e) {}
+ }
+
+ } else {
+ // If a hook was provided get the non-computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+ return ret;
+ }
+
+ // Otherwise just get the value from the style object
+ return style[ name ];
+ }
+ },
+
+ css: function( elem, name, extra, styles ) {
+ var val, num, hooks,
+ origName = jQuery.camelCase( name );
+
+ // Make sure that we're working with the right name
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+ // If a hook was provided get the computed value from there
+ if ( hooks && "get" in hooks ) {
+ val = hooks.get( elem, true, extra );
+ }
+
+ // Otherwise, if a way to get the computed value exists, use that
+ if ( val === undefined ) {
+ val = curCSS( elem, name, styles );
+ }
+
+ //convert "normal" to computed value
+ if ( val === "normal" && name in cssNormalTransform ) {
+ val = cssNormalTransform[ name ];
+ }
+
+ // Return, converting to number if forced or a qualifier was provided and val looks numeric
+ if ( extra ) {
+ num = parseFloat( val );
+ return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
+ }
+ return val;
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback, args ) {
+ var ret, name,
+ old = {};
+
+ // Remember the old values, and insert the new ones
+ for ( name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ ret = callback.apply( elem, args || [] );
+
+ // Revert the old values
+ for ( name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
+
+ return ret;
+ }
+});
+
+// NOTE: we've included the "window" in window.getComputedStyle
+// because jsdom on node.js will break without it.
+if ( window.getComputedStyle ) {
+ getStyles = function( elem ) {
+ return window.getComputedStyle( elem, null );
+ };
+
+ curCSS = function( elem, name, _computed ) {
+ var width, minWidth, maxWidth,
+ computed = _computed || getStyles( elem ),
+
+ // getPropertyValue is only needed for .css('filter') in IE9, see #12537
+ ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
+ style = elem.style;
+
+ if ( computed ) {
+
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
+ ret = jQuery.style( elem, name );
+ }
+
+ // A tribute to the "awesome hack by Dean Edwards"
+ // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
+ // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
+ // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
+ if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
+
+ // Remember the original values
+ width = style.width;
+ minWidth = style.minWidth;
+ maxWidth = style.maxWidth;
+
+ // Put in the new values to get a computed value out
+ style.minWidth = style.maxWidth = style.width = ret;
+ ret = computed.width;
+
+ // Revert the changed values
+ style.width = width;
+ style.minWidth = minWidth;
+ style.maxWidth = maxWidth;
+ }
+ }
+
+ return ret;
+ };
+} else if ( document.documentElement.currentStyle ) {
+ getStyles = function( elem ) {
+ return elem.currentStyle;
+ };
+
+ curCSS = function( elem, name, _computed ) {
+ var left, rs, rsLeft,
+ computed = _computed || getStyles( elem ),
+ ret = computed ? computed[ name ] : undefined,
+ style = elem.style;
+
+ // Avoid setting ret to empty string here
+ // so we don't default to auto
+ if ( ret == null && style && style[ name ] ) {
+ ret = style[ name ];
+ }
+
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ // but not position css attributes, as those are proportional to the parent element instead
+ // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
+ if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
+
+ // Remember the original values
+ left = style.left;
+ rs = elem.runtimeStyle;
+ rsLeft = rs && rs.left;
+
+ // Put in the new values to get a computed value out
+ if ( rsLeft ) {
+ rs.left = elem.currentStyle.left;
+ }
+ style.left = name === "fontSize" ? "1em" : ret;
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ if ( rsLeft ) {
+ rs.left = rsLeft;
+ }
+ }
+
+ return ret === "" ? "auto" : ret;
+ };
+}
+
+function setPositiveNumber( elem, value, subtract ) {
+ var matches = rnumsplit.exec( value );
+ return matches ?
+ // Guard against undefined "subtract", e.g., when used as in cssHooks
+ Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
+ value;
+}
+
+function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
+ var i = extra === ( isBorderBox ? "border" : "content" ) ?
+ // If we already have the right measurement, avoid augmentation
+ 4 :
+ // Otherwise initialize for horizontal or vertical properties
+ name === "width" ? 1 : 0,
+
+ val = 0;
+
+ for ( ; i < 4; i += 2 ) {
+ // both box models exclude margin, so add it if we want it
+ if ( extra === "margin" ) {
+ val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
+ }
+
+ if ( isBorderBox ) {
+ // border-box includes padding, so remove it if we want content
+ if ( extra === "content" ) {
+ val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+ }
+
+ // at this point, extra isn't border nor margin, so remove border
+ if ( extra !== "margin" ) {
+ val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ } else {
+ // at this point, extra isn't content, so add padding
+ val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+
+ // at this point, extra isn't content nor padding, so add border
+ if ( extra !== "padding" ) {
+ val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ }
+ }
+
+ return val;
+}
+
+function getWidthOrHeight( elem, name, extra ) {
+
+ // Start with offset property, which is equivalent to the border-box value
+ var valueIsBorderBox = true,
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
+ styles = getStyles( elem ),
+ isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
+
+ // some non-html elements return undefined for offsetWidth, so check for null/undefined
+ // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
+ // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
+ if ( val <= 0 || val == null ) {
+ // Fall back to computed then uncomputed css if necessary
+ val = curCSS( elem, name, styles );
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ];
+ }
+
+ // Computed unit is not pixels. Stop here and return.
+ if ( rnumnonpx.test(val) ) {
+ return val;
+ }
+
+ // we need the check for style in case a browser which returns unreliable values
+ // for getComputedStyle silently falls back to the reliable elem.style
+ valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
+
+ // Normalize "", auto, and prepare for extra
+ val = parseFloat( val ) || 0;
+ }
+
+ // use the active box-sizing model to add/subtract irrelevant styles
+ return ( val +
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra || ( isBorderBox ? "border" : "content" ),
+ valueIsBorderBox,
+ styles
+ )
+ ) + "px";
+}
+
+// Try to determine the default display value of an element
+function css_defaultDisplay( nodeName ) {
+ var doc = document,
+ display = elemdisplay[ nodeName ];
+
+ if ( !display ) {
+ display = actualDisplay( nodeName, doc );
+
+ // If the simple way fails, read from inside an iframe
+ if ( display === "none" || !display ) {
+ // Use the already-created iframe if possible
+ iframe = ( iframe ||
+ jQuery("<iframe frameborder='0' width='0' height='0'/>")
+ .css( "cssText", "display:block !important" )
+ ).appendTo( doc.documentElement );
+
+ // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
+ doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
+ doc.write("<!doctype html><html><body>");
+ doc.close();
+
+ display = actualDisplay( nodeName, doc );
+ iframe.detach();
+ }
+
+ // Store the correct default display
+ elemdisplay[ nodeName ] = display;
+ }
+
+ return display;
+}
+
+// Called ONLY from within css_defaultDisplay
+function actualDisplay( name, doc ) {
+ var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
+ display = jQuery.css( elem[0], "display" );
+ elem.remove();
+ return display;
+}
+
+jQuery.each([ "height", "width" ], function( i, name ) {
+ jQuery.cssHooks[ name ] = {
+ get: function( elem, computed, extra ) {
+ if ( computed ) {
+ // certain elements can have dimension info if we invisibly show them
+ // however, it must have a current display style that would benefit from this
+ return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
+ jQuery.swap( elem, cssShow, function() {
+ return getWidthOrHeight( elem, name, extra );
+ }) :
+ getWidthOrHeight( elem, name, extra );
+ }
+ },
+
+ set: function( elem, value, extra ) {
+ var styles = extra && getStyles( elem );
+ return setPositiveNumber( elem, value, extra ?
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra,
+ jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
+ styles
+ ) : 0
+ );
+ }
+ };
+});
+
+if ( !jQuery.support.opacity ) {
+ jQuery.cssHooks.opacity = {
+ get: function( elem, computed ) {
+ // IE uses filters for opacity
+ return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
+ ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
+ computed ? "1" : "";
+ },
+
+ set: function( elem, value ) {
+ var style = elem.style,
+ currentStyle = elem.currentStyle,
+ opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
+ filter = currentStyle && currentStyle.filter || style.filter || "";
+
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ style.zoom = 1;
+
+ // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
+ // if value === "", then remove inline opacity #12685
+ if ( ( value >= 1 || value === "" ) &&
+ jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
+ style.removeAttribute ) {
+
+ // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
+ // if "filter:" is present at all, clearType is disabled, we want to avoid this
+ // style.removeAttribute is IE Only, but so apparently is this code path...
+ style.removeAttribute( "filter" );
+
+ // if there is no filter style applied in a css rule or unset inline opacity, we are done
+ if ( value === "" || currentStyle && !currentStyle.filter ) {
+ return;
+ }
+ }
+
+ // otherwise, set new filter values
+ style.filter = ralpha.test( filter ) ?
+ filter.replace( ralpha, opacity ) :
+ filter + " " + opacity;
+ }
+ };
+}
+
+// These hooks cannot be added until DOM ready because the support test
+// for it is not run until after DOM ready
+jQuery(function() {
+ if ( !jQuery.support.reliableMarginRight ) {
+ jQuery.cssHooks.marginRight = {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ // Work around by temporarily setting element display to inline-block
+ return jQuery.swap( elem, { "display": "inline-block" },
+ curCSS, [ elem, "marginRight" ] );
+ }
+ }
+ };
+ }
+
+ // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
+ // getComputedStyle returns percent when specified for top/left/bottom/right
+ // rather than make the css module depend on the offset module, we just check for it here
+ if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
+ jQuery.each( [ "top", "left" ], function( i, prop ) {
+ jQuery.cssHooks[ prop ] = {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ computed = curCSS( elem, prop );
+ // if curCSS returns percentage, fallback to offset
+ return rnumnonpx.test( computed ) ?
+ jQuery( elem ).position()[ prop ] + "px" :
+ computed;
+ }
+ }
+ };
+ });
+ }
+
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.hidden = function( elem ) {
+ return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
+ };
+
+ jQuery.expr.filters.visible = function( elem ) {
+ return !jQuery.expr.filters.hidden( elem );
+ };
+}
+
+// These hooks are used by animate to expand properties
+jQuery.each({
+ margin: "",
+ padding: "",
+ border: "Width"
+}, function( prefix, suffix ) {
+ jQuery.cssHooks[ prefix + suffix ] = {
+ expand: function( value ) {
+ var i = 0,
+ expanded = {},
+
+ // assumes a single number if not a string
+ parts = typeof value === "string" ? value.split(" ") : [ value ];
+
+ for ( ; i < 4; i++ ) {
+ expanded[ prefix + cssExpand[ i ] + suffix ] =
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
+ }
+
+ return expanded;
+ }
+ };
+
+ if ( !rmargin.test( prefix ) ) {
+ jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
+ }
+});
+var r20 = /%20/g,
+ rbracket = /\[\]$/,
+ rCRLF = /\r?\n/g,
+ rsubmitterTypes = /^(?:submit|button|image|reset)$/i,
+ rsubmittable = /^(?:input|select|textarea|keygen)/i;
+
+jQuery.fn.extend({
+ serialize: function() {
+ return jQuery.param( this.serializeArray() );
+ },
+ serializeArray: function() {
+ return this.map(function(){
+ // Can add propHook for "elements" to filter or add form elements
+ var elements = jQuery.prop( this, "elements" );
+ return elements ? jQuery.makeArray( elements ) : this;
+ })
+ .filter(function(){
+ var type = this.type;
+ // Use .is(":disabled") so that fieldset[disabled] works
+ return this.name && !jQuery( this ).is( ":disabled" ) &&
+ rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
+ ( this.checked || !manipulation_rcheckableType.test( type ) );
+ })
+ .map(function( i, elem ){
+ var val = jQuery( this ).val();
+
+ return val == null ?
+ null :
+ jQuery.isArray( val ) ?
+ jQuery.map( val, function( val ){
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }) :
+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }).get();
+ }
+});
+
+//Serialize an array of form elements or a set of
+//key/values into a query string
+jQuery.param = function( a, traditional ) {
+ var prefix,
+ s = [],
+ add = function( key, value ) {
+ // If value is a function, invoke it and return its value
+ value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
+ };
+
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
+ if ( traditional === undefined ) {
+ traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
+ }
+
+ // If an array was passed in, assume that it is an array of form elements.
+ if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
+ // Serialize the form elements
+ jQuery.each( a, function() {
+ add( this.name, this.value );
+ });
+
+ } else {
+ // If traditional, encode the "old" way (the way 1.3.2 or older
+ // did it), otherwise encode params recursively.
+ for ( prefix in a ) {
+ buildParams( prefix, a[ prefix ], traditional, add );
+ }
+ }
+
+ // Return the resulting serialization
+ return s.join( "&" ).replace( r20, "+" );
+};
+
+function buildParams( prefix, obj, traditional, add ) {
+ var name;
+
+ if ( jQuery.isArray( obj ) ) {
+ // Serialize array item.
+ jQuery.each( obj, function( i, v ) {
+ if ( traditional || rbracket.test( prefix ) ) {
+ // Treat each array item as a scalar.
+ add( prefix, v );
+
+ } else {
+ // Item is non-scalar (array or object), encode its numeric index.
+ buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
+ }
+ });
+
+ } else if ( !traditional && jQuery.type( obj ) === "object" ) {
+ // Serialize object item.
+ for ( name in obj ) {
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
+ }
+
+ } else {
+ // Serialize scalar item.
+ add( prefix, obj );
+ }
+}
+var
+ // Document location
+ ajaxLocParts,
+ ajaxLocation,
+
+ ajax_nonce = jQuery.now(),
+
+ ajax_rquery = /\?/,
+ rhash = /#.*$/,
+ rts = /([?&])_=[^&]*/,
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
+ // #7653, #8125, #8152: local protocol detection
+ rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
+ rnoContent = /^(?:GET|HEAD)$/,
+ rprotocol = /^\/\//,
+ rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
+
+ // Keep a copy of the old load method
+ _load = jQuery.fn.load,
+
+ /* Prefilters
+ * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
+ * 2) These are called:
+ * - BEFORE asking for a transport
+ * - AFTER param serialization (s.data is a string if s.processData is true)
+ * 3) key is the dataType
+ * 4) the catchall symbol "*" can be used
+ * 5) execution will start with transport dataType and THEN continue down to "*" if needed
+ */
+ prefilters = {},
+
+ /* Transports bindings
+ * 1) key is the dataType
+ * 2) the catchall symbol "*" can be used
+ * 3) selection will start with transport dataType and THEN go to "*" if needed
+ */
+ transports = {},
+
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
+ allTypes = "*/".concat("*");
+
+// #8138, IE may throw an exception when accessing
+// a field from window.location if document.domain has been set
+try {
+ ajaxLocation = location.href;
+} catch( e ) {
+ // Use the href attribute of an A element
+ // since IE will modify it given document.location
+ ajaxLocation = document.createElement( "a" );
+ ajaxLocation.href = "";
+ ajaxLocation = ajaxLocation.href;
+}
+
+// Segment location into parts
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
+
+// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
+function addToPrefiltersOrTransports( structure ) {
+
+ // dataTypeExpression is optional and defaults to "*"
+ return function( dataTypeExpression, func ) {
+
+ if ( typeof dataTypeExpression !== "string" ) {
+ func = dataTypeExpression;
+ dataTypeExpression = "*";
+ }
+
+ var dataType,
+ i = 0,
+ dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
+
+ if ( jQuery.isFunction( func ) ) {
+ // For each dataType in the dataTypeExpression
+ while ( (dataType = dataTypes[i++]) ) {
+ // Prepend if requested
+ if ( dataType[0] === "+" ) {
+ dataType = dataType.slice( 1 ) || "*";
+ (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
+
+ // Otherwise append
+ } else {
+ (structure[ dataType ] = structure[ dataType ] || []).push( func );
+ }
+ }
+ }
+ };
+}
+
+// Base inspection function for prefilters and transports
+function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
+
+ var inspected = {},
+ seekingTransport = ( structure === transports );
+
+ function inspect( dataType ) {
+ var selected;
+ inspected[ dataType ] = true;
+ jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
+ var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
+ if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
+ options.dataTypes.unshift( dataTypeOrTransport );
+ inspect( dataTypeOrTransport );
+ return false;
+ } else if ( seekingTransport ) {
+ return !( selected = dataTypeOrTransport );
+ }
+ });
+ return selected;
+ }
+
+ return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
+}
+
+// A special extend for ajax options
+// that takes "flat" options (not to be deep extended)
+// Fixes #9887
+function ajaxExtend( target, src ) {
+ var key, deep,
+ flatOptions = jQuery.ajaxSettings.flatOptions || {};
+
+ for ( key in src ) {
+ if ( src[ key ] !== undefined ) {
+ ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
+ }
+ }
+ if ( deep ) {
+ jQuery.extend( true, target, deep );
+ }
+
+ return target;
+}
+
+jQuery.fn.load = function( url, params, callback ) {
+ if ( typeof url !== "string" && _load ) {
+ return _load.apply( this, arguments );
+ }
+
+ var selector, type, response,
+ self = this,
+ off = url.indexOf(" ");
+
+ if ( off >= 0 ) {
+ selector = url.slice( off, url.length );
+ url = url.slice( 0, off );
+ }
+
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+
+ // We assume that it's the callback
+ callback = params;
+ params = undefined;
+
+ // Otherwise, build a param string
+ } else if ( params && typeof params === "object" ) {
+ type = "POST";
+ }
+
+ // If we have elements to modify, make the request
+ if ( self.length > 0 ) {
+ jQuery.ajax({
+ url: url,
+
+ // if "type" variable is undefined, then "GET" method will be used
+ type: type,
+ dataType: "html",
+ data: params
+ }).done(function( responseText ) {
+
+ // Save response for use in complete callback
+ response = arguments;
+
+ self.html( selector ?
+
+ // If a selector was specified, locate the right elements in a dummy div
+ // Exclude scripts to avoid IE 'Permission Denied' errors
+ jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
+
+ // Otherwise use the full result
+ responseText );
+
+ }).complete( callback && function( jqXHR, status ) {
+ self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
+ });
+ }
+
+ return this;
+};
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
+ jQuery.fn[ type ] = function( fn ){
+ return this.on( type, fn );
+ };
+});
+
+jQuery.each( [ "get", "post" ], function( i, method ) {
+ jQuery[ method ] = function( url, data, callback, type ) {
+ // shift arguments if data argument was omitted
+ if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
+ callback = data;
+ data = undefined;
+ }
+
+ return jQuery.ajax({
+ url: url,
+ type: method,
+ dataType: type,
+ data: data,
+ success: callback
+ });
+ };
+});
+
+jQuery.extend({
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+ etag: {},
+
+ ajaxSettings: {
+ url: ajaxLocation,
+ type: "GET",
+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
+ global: true,
+ processData: true,
+ async: true,
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",
+ /*
+ timeout: 0,
+ data: null,
+ dataType: null,
+ username: null,
+ password: null,
+ cache: null,
+ throws: false,
+ traditional: false,
+ headers: {},
+ */
+
+ accepts: {
+ "*": allTypes,
+ text: "text/plain",
+ html: "text/html",
+ xml: "application/xml, text/xml",
+ json: "application/json, text/javascript"
+ },
+
+ contents: {
+ xml: /xml/,
+ html: /html/,
+ json: /json/
+ },
+
+ responseFields: {
+ xml: "responseXML",
+ text: "responseText"
+ },
+
+ // Data converters
+ // Keys separate source (or catchall "*") and destination types with a single space
+ converters: {
+
+ // Convert anything to text
+ "* text": window.String,
+
+ // Text to html (true = no transformation)
+ "text html": true,
+
+ // Evaluate text as a json expression
+ "text json": jQuery.parseJSON,
+
+ // Parse text as xml
+ "text xml": jQuery.parseXML
+ },
+
+ // For options that shouldn't be deep extended:
+ // you can add your own custom options here if
+ // and when you create one that shouldn't be
+ // deep extended (see ajaxExtend)
+ flatOptions: {
+ url: true,
+ context: true
+ }
+ },
+
+ // Creates a full fledged settings object into target
+ // with both ajaxSettings and settings fields.
+ // If target is omitted, writes into ajaxSettings.
+ ajaxSetup: function( target, settings ) {
+ return settings ?
+
+ // Building a settings object
+ ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
+
+ // Extending ajaxSettings
+ ajaxExtend( jQuery.ajaxSettings, target );
+ },
+
+ ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
+ ajaxTransport: addToPrefiltersOrTransports( transports ),
+
+ // Main method
+ ajax: function( url, options ) {
+
+ // If url is an object, simulate pre-1.5 signature
+ if ( typeof url === "object" ) {
+ options = url;
+ url = undefined;
+ }
+
+ // Force options to be an object
+ options = options || {};
+
+ var transport,
+ // URL without anti-cache param
+ cacheURL,
+ // Response headers
+ responseHeadersString,
+ responseHeaders,
+ // timeout handle
+ timeoutTimer,
+ // Cross-domain detection vars
+ parts,
+ // To know if global events are to be dispatched
+ fireGlobals,
+ // Loop variable
+ i,
+ // Create the final options object
+ s = jQuery.ajaxSetup( {}, options ),
+ // Callbacks context
+ callbackContext = s.context || s,
+ // Context for global events is callbackContext if it is a DOM node or jQuery collection
+ globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
+ jQuery( callbackContext ) :
+ jQuery.event,
+ // Deferreds
+ deferred = jQuery.Deferred(),
+ completeDeferred = jQuery.Callbacks("once memory"),
+ // Status-dependent callbacks
+ statusCode = s.statusCode || {},
+ // Headers (they are sent all at once)
+ requestHeaders = {},
+ requestHeadersNames = {},
+ // The jqXHR state
+ state = 0,
+ // Default abort message
+ strAbort = "canceled",
+ // Fake xhr
+ jqXHR = {
+ readyState: 0,
+
+ // Builds headers hashtable if needed
+ getResponseHeader: function( key ) {
+ var match;
+ if ( state === 2 ) {
+ if ( !responseHeaders ) {
+ responseHeaders = {};
+ while ( (match = rheaders.exec( responseHeadersString )) ) {
+ responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
+ }
+ }
+ match = responseHeaders[ key.toLowerCase() ];
+ }
+ return match == null ? null : match;
+ },
+
+ // Raw string
+ getAllResponseHeaders: function() {
+ return state === 2 ? responseHeadersString : null;
+ },
+
+ // Caches the header
+ setRequestHeader: function( name, value ) {
+ var lname = name.toLowerCase();
+ if ( !state ) {
+ name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
+ requestHeaders[ name ] = value;
+ }
+ return this;
+ },
+
+ // Overrides response content-type header
+ overrideMimeType: function( type ) {
+ if ( !state ) {
+ s.mimeType = type;
+ }
+ return this;
+ },
+
+ // Status-dependent callbacks
+ statusCode: function( map ) {
+ var code;
+ if ( map ) {
+ if ( state < 2 ) {
+ for ( code in map ) {
+ // Lazy-add the new callback in a way that preserves old ones
+ statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
+ }
+ } else {
+ // Execute the appropriate callbacks
+ jqXHR.always( map[ jqXHR.status ] );
+ }
+ }
+ return this;
+ },
+
+ // Cancel the request
+ abort: function( statusText ) {
+ var finalText = statusText || strAbort;
+ if ( transport ) {
+ transport.abort( finalText );
+ }
+ done( 0, finalText );
+ return this;
+ }
+ };
+
+ // Attach deferreds
+ deferred.promise( jqXHR ).complete = completeDeferred.add;
+ jqXHR.success = jqXHR.done;
+ jqXHR.error = jqXHR.fail;
+
+ // Remove hash character (#7531: and string promotion)
+ // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
+ // Handle falsy url in the settings object (#10093: consistency with old signature)
+ // We also use the url parameter if available
+ s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
+
+ // Alias method option to type as per ticket #12004
+ s.type = options.method || options.type || s.method || s.type;
+
+ // Extract dataTypes list
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
+
+ // A cross-domain request is in order when we have a protocol:host:port mismatch
+ if ( s.crossDomain == null ) {
+ parts = rurl.exec( s.url.toLowerCase() );
+ s.crossDomain = !!( parts &&
+ ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
+ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
+ ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
+ );
+ }
+
+ // Convert data if not already a string
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
+ s.data = jQuery.param( s.data, s.traditional );
+ }
+
+ // Apply prefilters
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
+
+ // If request was aborted inside a prefilter, stop there
+ if ( state === 2 ) {
+ return jqXHR;
+ }
+
+ // We can fire global events as of now if asked to
+ fireGlobals = s.global;
+
+ // Watch for a new set of requests
+ if ( fireGlobals && jQuery.active++ === 0 ) {
+ jQuery.event.trigger("ajaxStart");
+ }
+
+ // Uppercase the type
+ s.type = s.type.toUpperCase();
+
+ // Determine if request has content
+ s.hasContent = !rnoContent.test( s.type );
+
+ // Save the URL in case we're toying with the If-Modified-Since
+ // and/or If-None-Match header later on
+ cacheURL = s.url;
+
+ // More options handling for requests with no content
+ if ( !s.hasContent ) {
+
+ // If data is available, append data to url
+ if ( s.data ) {
+ cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
+ // #9682: remove data so that it's not used in an eventual retry
+ delete s.data;
+ }
+
+ // Add anti-cache in url if needed
+ if ( s.cache === false ) {
+ s.url = rts.test( cacheURL ) ?
+
+ // If there is already a '_' parameter, set its value
+ cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
+
+ // Otherwise add one to the end
+ cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
+ }
+ }
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ if ( jQuery.lastModified[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
+ }
+ if ( jQuery.etag[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
+ }
+ }
+
+ // Set the correct header, if data is being sent
+ if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
+ jqXHR.setRequestHeader( "Content-Type", s.contentType );
+ }
+
+ // Set the Accepts header for the server, depending on the dataType
+ jqXHR.setRequestHeader(
+ "Accept",
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
+ s.accepts[ "*" ]
+ );
+
+ // Check for headers option
+ for ( i in s.headers ) {
+ jqXHR.setRequestHeader( i, s.headers[ i ] );
+ }
+
+ // Allow custom headers/mimetypes and early abort
+ if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
+ // Abort if not done already and return
+ return jqXHR.abort();
+ }
+
+ // aborting is no longer a cancellation
+ strAbort = "abort";
+
+ // Install callbacks on deferreds
+ for ( i in { success: 1, error: 1, complete: 1 } ) {
+ jqXHR[ i ]( s[ i ] );
+ }
+
+ // Get transport
+ transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
+
+ // If no transport, we auto-abort
+ if ( !transport ) {
+ done( -1, "No Transport" );
+ } else {
+ jqXHR.readyState = 1;
+
+ // Send global event
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
+ }
+ // Timeout
+ if ( s.async && s.timeout > 0 ) {
+ timeoutTimer = setTimeout(function() {
+ jqXHR.abort("timeout");
+ }, s.timeout );
+ }
+
+ try {
+ state = 1;
+ transport.send( requestHeaders, done );
+ } catch ( e ) {
+ // Propagate exception as error if not done
+ if ( state < 2 ) {
+ done( -1, e );
+ // Simply rethrow otherwise
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ // Callback for when everything is done
+ function done( status, nativeStatusText, responses, headers ) {
+ var isSuccess, success, error, response, modified,
+ statusText = nativeStatusText;
+
+ // Called once
+ if ( state === 2 ) {
+ return;
+ }
+
+ // State is "done" now
+ state = 2;
+
+ // Clear timeout if it exists
+ if ( timeoutTimer ) {
+ clearTimeout( timeoutTimer );
+ }
+
+ // Dereference transport for early garbage collection
+ // (no matter how long the jqXHR object will be used)
+ transport = undefined;
+
+ // Cache response headers
+ responseHeadersString = headers || "";
+
+ // Set readyState
+ jqXHR.readyState = status > 0 ? 4 : 0;
+
+ // Get response data
+ if ( responses ) {
+ response = ajaxHandleResponses( s, jqXHR, responses );
+ }
+
+ // If successful, handle type chaining
+ if ( status >= 200 && status < 300 || status === 304 ) {
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ modified = jqXHR.getResponseHeader("Last-Modified");
+ if ( modified ) {
+ jQuery.lastModified[ cacheURL ] = modified;
+ }
+ modified = jqXHR.getResponseHeader("etag");
+ if ( modified ) {
+ jQuery.etag[ cacheURL ] = modified;
+ }
+ }
+
+ // If not modified
+ if ( status === 304 ) {
+ isSuccess = true;
+ statusText = "notmodified";
+
+ // If we have data
+ } else {
+ isSuccess = ajaxConvert( s, response );
+ statusText = isSuccess.state;
+ success = isSuccess.data;
+ error = isSuccess.error;
+ isSuccess = !error;
+ }
+ } else {
+ // We extract error from statusText
+ // then normalize statusText and status for non-aborts
+ error = statusText;
+ if ( status || !statusText ) {
+ statusText = "error";
+ if ( status < 0 ) {
+ status = 0;
+ }
+ }
+ }
+
+ // Set data for the fake xhr object
+ jqXHR.status = status;
+ jqXHR.statusText = ( nativeStatusText || statusText ) + "";
+
+ // Success/Error
+ if ( isSuccess ) {
+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
+ } else {
+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
+ }
+
+ // Status-dependent callbacks
+ jqXHR.statusCode( statusCode );
+ statusCode = undefined;
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
+ [ jqXHR, s, isSuccess ? success : error ] );
+ }
+
+ // Complete
+ completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
+ // Handle the global AJAX counter
+ if ( !( --jQuery.active ) ) {
+ jQuery.event.trigger("ajaxStop");
+ }
+ }
+ }
+
+ return jqXHR;
+ },
+
+ getScript: function( url, callback ) {
+ return jQuery.get( url, undefined, callback, "script" );
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get( url, data, callback, "json" );
+ }
+});
+
+/* Handles responses to an ajax request:
+ * - sets all responseXXX fields accordingly
+ * - finds the right dataType (mediates between content-type and expected dataType)
+ * - returns the corresponding response
+ */
+function ajaxHandleResponses( s, jqXHR, responses ) {
+
+ var ct, type, finalDataType, firstDataType,
+ contents = s.contents,
+ dataTypes = s.dataTypes,
+ responseFields = s.responseFields;
+
+ // Fill responseXXX fields
+ for ( type in responseFields ) {
+ if ( type in responses ) {
+ jqXHR[ responseFields[type] ] = responses[ type ];
+ }
+ }
+
+ // Remove auto dataType and get content-type in the process
+ while( dataTypes[ 0 ] === "*" ) {
+ dataTypes.shift();
+ if ( ct === undefined ) {
+ ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
+ }
+ }
+
+ // Check if we're dealing with a known content-type
+ if ( ct ) {
+ for ( type in contents ) {
+ if ( contents[ type ] && contents[ type ].test( ct ) ) {
+ dataTypes.unshift( type );
+ break;
+ }
+ }
+ }
+
+ // Check to see if we have a response for the expected dataType
+ if ( dataTypes[ 0 ] in responses ) {
+ finalDataType = dataTypes[ 0 ];
+ } else {
+ // Try convertible dataTypes
+ for ( type in responses ) {
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
+ finalDataType = type;
+ break;
+ }
+ if ( !firstDataType ) {
+ firstDataType = type;
+ }
+ }
+ // Or just use first one
+ finalDataType = finalDataType || firstDataType;
+ }
+
+ // If we found a dataType
+ // We add the dataType to the list if needed
+ // and return the corresponding response
+ if ( finalDataType ) {
+ if ( finalDataType !== dataTypes[ 0 ] ) {
+ dataTypes.unshift( finalDataType );
+ }
+ return responses[ finalDataType ];
+ }
+}
+
+// Chain conversions given the request and the original response
+function ajaxConvert( s, response ) {
+
+ var conv, conv2, current, tmp,
+ converters = {},
+ i = 0,
+ // Work with a copy of dataTypes in case we need to modify it for conversion
+ dataTypes = s.dataTypes.slice(),
+ prev = dataTypes[ 0 ];
+
+ // Apply the dataFilter if provided
+ if ( s.dataFilter ) {
+ response = s.dataFilter( response, s.dataType );
+ }
+
+ // Create converters map with lowercased keys
+ if ( dataTypes[ 1 ] ) {
+ for ( conv in s.converters ) {
+ converters[ conv.toLowerCase() ] = s.converters[ conv ];
+ }
+ }
+
+ // Convert to each sequential dataType, tolerating list modification
+ for ( ; (current = dataTypes[++i]); ) {
+
+ // There's only work to do if current dataType is non-auto
+ if ( current !== "*" ) {
+
+ // Convert response if prev dataType is non-auto and differs from current
+ if ( prev !== "*" && prev !== current ) {
+
+ // Seek a direct converter
+ conv = converters[ prev + " " + current ] || converters[ "* " + current ];
+
+ // If none found, seek a pair
+ if ( !conv ) {
+ for ( conv2 in converters ) {
+
+ // If conv2 outputs current
+ tmp = conv2.split(" ");
+ if ( tmp[ 1 ] === current ) {
+
+ // If prev can be converted to accepted input
+ conv = converters[ prev + " " + tmp[ 0 ] ] ||
+ converters[ "* " + tmp[ 0 ] ];
+ if ( conv ) {
+ // Condense equivalence converters
+ if ( conv === true ) {
+ conv = converters[ conv2 ];
+
+ // Otherwise, insert the intermediate dataType
+ } else if ( converters[ conv2 ] !== true ) {
+ current = tmp[ 0 ];
+ dataTypes.splice( i--, 0, current );
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ // Apply converter (if not an equivalence)
+ if ( conv !== true ) {
+
+ // Unless errors are allowed to bubble, catch and return them
+ if ( conv && s["throws"] ) {
+ response = conv( response );
+ } else {
+ try {
+ response = conv( response );
+ } catch ( e ) {
+ return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
+ }
+ }
+ }
+ }
+
+ // Update prev for next iteration
+ prev = current;
+ }
+ }
+
+ return { state: "success", data: response };
+}
+// Install script dataType
+jQuery.ajaxSetup({
+ accepts: {
+ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
+ },
+ contents: {
+ script: /(?:java|ecma)script/
+ },
+ converters: {
+ "text script": function( text ) {
+ jQuery.globalEval( text );
+ return text;
+ }
+ }
+});
+
+// Handle cache's special case and global
+jQuery.ajaxPrefilter( "script", function( s ) {
+ if ( s.cache === undefined ) {
+ s.cache = false;
+ }
+ if ( s.crossDomain ) {
+ s.type = "GET";
+ s.global = false;
+ }
+});
+
+// Bind script tag hack transport
+jQuery.ajaxTransport( "script", function(s) {
+
+ // This transport only deals with cross domain requests
+ if ( s.crossDomain ) {
+
+ var script,
+ head = document.head || jQuery("head")[0] || document.documentElement;
+
+ return {
+
+ send: function( _, callback ) {
+
+ script = document.createElement("script");
+
+ script.async = true;
+
+ if ( s.scriptCharset ) {
+ script.charset = s.scriptCharset;
+ }
+
+ script.src = s.url;
+
+ // Attach handlers for all browsers
+ script.onload = script.onreadystatechange = function( _, isAbort ) {
+
+ if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
+
+ // Handle memory leak in IE
+ script.onload = script.onreadystatechange = null;
+
+ // Remove the script
+ if ( script.parentNode ) {
+ script.parentNode.removeChild( script );
+ }
+
+ // Dereference the script
+ script = null;
+
+ // Callback if not abort
+ if ( !isAbort ) {
+ callback( 200, "success" );
+ }
+ }
+ };
+
+ // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
+ // Use native DOM manipulation to avoid our domManip AJAX trickery
+ head.insertBefore( script, head.firstChild );
+ },
+
+ abort: function() {
+ if ( script ) {
+ script.onload( undefined, true );
+ }
+ }
+ };
+ }
+});
+var oldCallbacks = [],
+ rjsonp = /(=)\?(?=&|$)|\?\?/;
+
+// Default jsonp settings
+jQuery.ajaxSetup({
+ jsonp: "callback",
+ jsonpCallback: function() {
+ var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
+ this[ callback ] = true;
+ return callback;
+ }
+});
+
+// Detect, normalize options and install callbacks for jsonp requests
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
+
+ var callbackName, overwritten, responseContainer,
+ jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
+ "url" :
+ typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
+ );
+
+ // Handle iff the expected data type is "jsonp" or we have a parameter to set
+ if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
+
+ // Get callback name, remembering preexisting value associated with it
+ callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
+ s.jsonpCallback() :
+ s.jsonpCallback;
+
+ // Insert callback into url or form data
+ if ( jsonProp ) {
+ s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
+ } else if ( s.jsonp !== false ) {
+ s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
+ }
+
+ // Use data converter to retrieve json after script execution
+ s.converters["script json"] = function() {
+ if ( !responseContainer ) {
+ jQuery.error( callbackName + " was not called" );
+ }
+ return responseContainer[ 0 ];
+ };
+
+ // force json dataType
+ s.dataTypes[ 0 ] = "json";
+
+ // Install callback
+ overwritten = window[ callbackName ];
+ window[ callbackName ] = function() {
+ responseContainer = arguments;
+ };
+
+ // Clean-up function (fires after converters)
+ jqXHR.always(function() {
+ // Restore preexisting value
+ window[ callbackName ] = overwritten;
+
+ // Save back as free
+ if ( s[ callbackName ] ) {
+ // make sure that re-using the options doesn't screw things around
+ s.jsonpCallback = originalSettings.jsonpCallback;
+
+ // save the callback name for future use
+ oldCallbacks.push( callbackName );
+ }
+
+ // Call if it was a function and we have a response
+ if ( responseContainer && jQuery.isFunction( overwritten ) ) {
+ overwritten( responseContainer[ 0 ] );
+ }
+
+ responseContainer = overwritten = undefined;
+ });
+
+ // Delegate to script
+ return "script";
+ }
+});
+var xhrCallbacks, xhrSupported,
+ xhrId = 0,
+ // #5280: Internet Explorer will keep connections alive if we don't abort on unload
+ xhrOnUnloadAbort = window.ActiveXObject && function() {
+ // Abort all pending requests
+ var key;
+ for ( key in xhrCallbacks ) {
+ xhrCallbacks[ key ]( undefined, true );
+ }
+ };
+
+// Functions to create xhrs
+function createStandardXHR() {
+ try {
+ return new window.XMLHttpRequest();
+ } catch( e ) {}
+}
+
+function createActiveXHR() {
+ try {
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
+ } catch( e ) {}
+}
+
+// Create the request object
+// (This is still attached to ajaxSettings for backward compatibility)
+jQuery.ajaxSettings.xhr = window.ActiveXObject ?
+ /* Microsoft failed to properly
+ * implement the XMLHttpRequest in IE7 (can't request local files),
+ * so we use the ActiveXObject when it is available
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
+ * we need a fallback.
+ */
+ function() {
+ return !this.isLocal && createStandardXHR() || createActiveXHR();
+ } :
+ // For all other browsers, use the standard XMLHttpRequest object
+ createStandardXHR;
+
+// Determine support properties
+xhrSupported = jQuery.ajaxSettings.xhr();
+jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
+xhrSupported = jQuery.support.ajax = !!xhrSupported;
+
+// Create transport if the browser can provide an xhr
+if ( xhrSupported ) {
+
+ jQuery.ajaxTransport(function( s ) {
+ // Cross domain only allowed if supported through XMLHttpRequest
+ if ( !s.crossDomain || jQuery.support.cors ) {
+
+ var callback;
+
+ return {
+ send: function( headers, complete ) {
+
+ // Get a new xhr
+ var handle, i,
+ xhr = s.xhr();
+
+ // Open the socket
+ // Passing null username, generates a login popup on Opera (#2865)
+ if ( s.username ) {
+ xhr.open( s.type, s.url, s.async, s.username, s.password );
+ } else {
+ xhr.open( s.type, s.url, s.async );
+ }
+
+ // Apply custom fields if provided
+ if ( s.xhrFields ) {
+ for ( i in s.xhrFields ) {
+ xhr[ i ] = s.xhrFields[ i ];
+ }
+ }
+
+ // Override mime type if needed
+ if ( s.mimeType && xhr.overrideMimeType ) {
+ xhr.overrideMimeType( s.mimeType );
+ }
+
+ // X-Requested-With header
+ // For cross-domain requests, seeing as conditions for a preflight are
+ // akin to a jigsaw puzzle, we simply never set it to be sure.
+ // (it can always be set on a per-request basis or even using ajaxSetup)
+ // For same-domain requests, won't change header if already provided.
+ if ( !s.crossDomain && !headers["X-Requested-With"] ) {
+ headers["X-Requested-With"] = "XMLHttpRequest";
+ }
+
+ // Need an extra try/catch for cross domain requests in Firefox 3
+ try {
+ for ( i in headers ) {
+ xhr.setRequestHeader( i, headers[ i ] );
+ }
+ } catch( err ) {}
+
+ // Do send the request
+ // This may raise an exception which is actually
+ // handled in jQuery.ajax (so no try/catch here)
+ xhr.send( ( s.hasContent && s.data ) || null );
+
+ // Listener
+ callback = function( _, isAbort ) {
+
+ var status,
+ statusText,
+ responseHeaders,
+ responses,
+ xml;
+
+ // Firefox throws exceptions when accessing properties
+ // of an xhr when a network error occurred
+ // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
+ try {
+
+ // Was never called and is aborted or complete
+ if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
+
+ // Only called once
+ callback = undefined;
+
+ // Do not keep as active anymore
+ if ( handle ) {
+ xhr.onreadystatechange = jQuery.noop;
+ if ( xhrOnUnloadAbort ) {
+ delete xhrCallbacks[ handle ];
+ }
+ }
+
+ // If it's an abort
+ if ( isAbort ) {
+ // Abort it manually if needed
+ if ( xhr.readyState !== 4 ) {
+ xhr.abort();
+ }
+ } else {
+ responses = {};
+ status = xhr.status;
+ xml = xhr.responseXML;
+ responseHeaders = xhr.getAllResponseHeaders();
+
+ // Construct response list
+ if ( xml && xml.documentElement /* #4958 */ ) {
+ responses.xml = xml;
+ }
+
+ // When requesting binary data, IE6-9 will throw an exception
+ // on any attempt to access responseText (#11426)
+ if ( typeof xhr.responseText === "string" ) {
+ responses.text = xhr.responseText;
+ }
+
+ // Firefox throws an exception when accessing
+ // statusText for faulty cross-domain requests
+ try {
+ statusText = xhr.statusText;
+ } catch( e ) {
+ // We normalize with Webkit giving an empty statusText
+ statusText = "";
+ }
+
+ // Filter status for non standard behaviors
+
+ // If the request is local and we have data: assume a success
+ // (success with no data won't get notified, that's the best we
+ // can do given current implementations)
+ if ( !status && s.isLocal && !s.crossDomain ) {
+ status = responses.text ? 200 : 404;
+ // IE - #1450: sometimes returns 1223 when it should be 204
+ } else if ( status === 1223 ) {
+ status = 204;
+ }
+ }
+ }
+ } catch( firefoxAccessException ) {
+ if ( !isAbort ) {
+ complete( -1, firefoxAccessException );
+ }
+ }
+
+ // Call complete if needed
+ if ( responses ) {
+ complete( status, statusText, responses, responseHeaders );
+ }
+ };
+
+ if ( !s.async ) {
+ // if we're in sync mode we fire the callback
+ callback();
+ } else if ( xhr.readyState === 4 ) {
+ // (IE6 & IE7) if it's in cache and has been
+ // retrieved directly we need to fire the callback
+ setTimeout( callback );
+ } else {
+ handle = ++xhrId;
+ if ( xhrOnUnloadAbort ) {
+ // Create the active xhrs callbacks list if needed
+ // and attach the unload handler
+ if ( !xhrCallbacks ) {
+ xhrCallbacks = {};
+ jQuery( window ).unload( xhrOnUnloadAbort );
+ }
+ // Add to list of active xhrs callbacks
+ xhrCallbacks[ handle ] = callback;
+ }
+ xhr.onreadystatechange = callback;
+ }
+ },
+
+ abort: function() {
+ if ( callback ) {
+ callback( undefined, true );
+ }
+ }
+ };
+ }
+ });
+}
+var fxNow, timerId,
+ rfxtypes = /^(?:toggle|show|hide)$/,
+ rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
+ rrun = /queueHooks$/,
+ animationPrefilters = [ defaultPrefilter ],
+ tweeners = {
+ "*": [function( prop, value ) {
+ var end, unit,
+ tween = this.createTween( prop, value ),
+ parts = rfxnum.exec( value ),
+ target = tween.cur(),
+ start = +target || 0,
+ scale = 1,
+ maxIterations = 20;
+
+ if ( parts ) {
+ end = +parts[2];
+ unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+
+ // We need to compute starting value
+ if ( unit !== "px" && start ) {
+ // Iteratively approximate from a nonzero starting point
+ // Prefer the current property, because this process will be trivial if it uses the same units
+ // Fallback to end or a simple constant
+ start = jQuery.css( tween.elem, prop, true ) || end || 1;
+
+ do {
+ // If previous iteration zeroed out, double until we get *something*
+ // Use a string for doubling factor so we don't accidentally see scale as unchanged below
+ scale = scale || ".5";
+
+ // Adjust and apply
+ start = start / scale;
+ jQuery.style( tween.elem, prop, start + unit );
+
+ // Update scale, tolerating zero or NaN from tween.cur()
+ // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
+ } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
+ }
+
+ tween.unit = unit;
+ tween.start = start;
+ // If a +=/-= token was provided, we're doing a relative animation
+ tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
+ }
+ return tween;
+ }]
+ };
+
+// Animations created synchronously will run synchronously
+function createFxNow() {
+ setTimeout(function() {
+ fxNow = undefined;
+ });
+ return ( fxNow = jQuery.now() );
+}
+
+function createTweens( animation, props ) {
+ jQuery.each( props, function( prop, value ) {
+ var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
+ index = 0,
+ length = collection.length;
+ for ( ; index < length; index++ ) {
+ if ( collection[ index ].call( animation, prop, value ) ) {
+
+ // we're done with this property
+ return;
+ }
+ }
+ });
+}
+
+function Animation( elem, properties, options ) {
+ var result,
+ stopped,
+ index = 0,
+ length = animationPrefilters.length,
+ deferred = jQuery.Deferred().always( function() {
+ // don't match elem in the :animated selector
+ delete tick.elem;
+ }),
+ tick = function() {
+ if ( stopped ) {
+ return false;
+ }
+ var currentTime = fxNow || createFxNow(),
+ remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
+ // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
+ temp = remaining / animation.duration || 0,
+ percent = 1 - temp,
+ index = 0,
+ length = animation.tweens.length;
+
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( percent );
+ }
+
+ deferred.notifyWith( elem, [ animation, percent, remaining ]);
+
+ if ( percent < 1 && length ) {
+ return remaining;
+ } else {
+ deferred.resolveWith( elem, [ animation ] );
+ return false;
+ }
+ },
+ animation = deferred.promise({
+ elem: elem,
+ props: jQuery.extend( {}, properties ),
+ opts: jQuery.extend( true, { specialEasing: {} }, options ),
+ originalProperties: properties,
+ originalOptions: options,
+ startTime: fxNow || createFxNow(),
+ duration: options.duration,
+ tweens: [],
+ createTween: function( prop, end ) {
+ var tween = jQuery.Tween( elem, animation.opts, prop, end,
+ animation.opts.specialEasing[ prop ] || animation.opts.easing );
+ animation.tweens.push( tween );
+ return tween;
+ },
+ stop: function( gotoEnd ) {
+ var index = 0,
+ // if we are going to the end, we want to run all the tweens
+ // otherwise we skip this part
+ length = gotoEnd ? animation.tweens.length : 0;
+ if ( stopped ) {
+ return this;
+ }
+ stopped = true;
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( 1 );
+ }
+
+ // resolve when we played the last frame
+ // otherwise, reject
+ if ( gotoEnd ) {
+ deferred.resolveWith( elem, [ animation, gotoEnd ] );
+ } else {
+ deferred.rejectWith( elem, [ animation, gotoEnd ] );
+ }
+ return this;
+ }
+ }),
+ props = animation.props;
+
+ propFilter( props, animation.opts.specialEasing );
+
+ for ( ; index < length ; index++ ) {
+ result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
+ if ( result ) {
+ return result;
+ }
+ }
+
+ createTweens( animation, props );
+
+ if ( jQuery.isFunction( animation.opts.start ) ) {
+ animation.opts.start.call( elem, animation );
+ }
+
+ jQuery.fx.timer(
+ jQuery.extend( tick, {
+ elem: elem,
+ anim: animation,
+ queue: animation.opts.queue
+ })
+ );
+
+ // attach callbacks from options
+ return animation.progress( animation.opts.progress )
+ .done( animation.opts.done, animation.opts.complete )
+ .fail( animation.opts.fail )
+ .always( animation.opts.always );
+}
+
+function propFilter( props, specialEasing ) {
+ var index, name, easing, value, hooks;
+
+ // camelCase, specialEasing and expand cssHook pass
+ for ( index in props ) {
+ name = jQuery.camelCase( index );
+ easing = specialEasing[ name ];
+ value = props[ index ];
+ if ( jQuery.isArray( value ) ) {
+ easing = value[ 1 ];
+ value = props[ index ] = value[ 0 ];
+ }
+
+ if ( index !== name ) {
+ props[ name ] = value;
+ delete props[ index ];
+ }
+
+ hooks = jQuery.cssHooks[ name ];
+ if ( hooks && "expand" in hooks ) {
+ value = hooks.expand( value );
+ delete props[ name ];
+
+ // not quite $.extend, this wont overwrite keys already present.
+ // also - reusing 'index' from above because we have the correct "name"
+ for ( index in value ) {
+ if ( !( index in props ) ) {
+ props[ index ] = value[ index ];
+ specialEasing[ index ] = easing;
+ }
+ }
+ } else {
+ specialEasing[ name ] = easing;
+ }
+ }
+}
+
+jQuery.Animation = jQuery.extend( Animation, {
+
+ tweener: function( props, callback ) {
+ if ( jQuery.isFunction( props ) ) {
+ callback = props;
+ props = [ "*" ];
+ } else {
+ props = props.split(" ");
+ }
+
+ var prop,
+ index = 0,
+ length = props.length;
+
+ for ( ; index < length ; index++ ) {
+ prop = props[ index ];
+ tweeners[ prop ] = tweeners[ prop ] || [];
+ tweeners[ prop ].unshift( callback );
+ }
+ },
+
+ prefilter: function( callback, prepend ) {
+ if ( prepend ) {
+ animationPrefilters.unshift( callback );
+ } else {
+ animationPrefilters.push( callback );
+ }
+ }
+});
+
+function defaultPrefilter( elem, props, opts ) {
+ /*jshint validthis:true */
+ var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
+ anim = this,
+ style = elem.style,
+ orig = {},
+ handled = [],
+ hidden = elem.nodeType && isHidden( elem );
+
+ // handle queue: false promises
+ if ( !opts.queue ) {
+ hooks = jQuery._queueHooks( elem, "fx" );
+ if ( hooks.unqueued == null ) {
+ hooks.unqueued = 0;
+ oldfire = hooks.empty.fire;
+ hooks.empty.fire = function() {
+ if ( !hooks.unqueued ) {
+ oldfire();
+ }
+ };
+ }
+ hooks.unqueued++;
+
+ anim.always(function() {
+ // doing this makes sure that the complete handler will be called
+ // before this completes
+ anim.always(function() {
+ hooks.unqueued--;
+ if ( !jQuery.queue( elem, "fx" ).length ) {
+ hooks.empty.fire();
+ }
+ });
+ });
+ }
+
+ // height/width overflow pass
+ if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
+ // Make sure that nothing sneaks out
+ // Record all 3 overflow attributes because IE does not
+ // change the overflow attribute when overflowX and
+ // overflowY are set to the same value
+ opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
+
+ // Set display property to inline-block for height/width
+ // animations on inline elements that are having width/height animated
+ if ( jQuery.css( elem, "display" ) === "inline" &&
+ jQuery.css( elem, "float" ) === "none" ) {
+
+ // inline-level elements accept inline-block;
+ // block-level elements need to be inline with layout
+ if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
+ style.display = "inline-block";
+
+ } else {
+ style.zoom = 1;
+ }
+ }
+ }
+
+ if ( opts.overflow ) {
+ style.overflow = "hidden";
+ if ( !jQuery.support.shrinkWrapBlocks ) {
+ anim.done(function() {
+ style.overflow = opts.overflow[ 0 ];
+ style.overflowX = opts.overflow[ 1 ];
+ style.overflowY = opts.overflow[ 2 ];
+ });
+ }
+ }
+
+
+ // show/hide pass
+ for ( index in props ) {
+ value = props[ index ];
+ if ( rfxtypes.exec( value ) ) {
+ delete props[ index ];
+ toggle = toggle || value === "toggle";
+ if ( value === ( hidden ? "hide" : "show" ) ) {
+ continue;
+ }
+ handled.push( index );
+ }
+ }
+
+ length = handled.length;
+ if ( length ) {
+ dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
+ if ( "hidden" in dataShow ) {
+ hidden = dataShow.hidden;
+ }
+
+ // store state if its toggle - enables .stop().toggle() to "reverse"
+ if ( toggle ) {
+ dataShow.hidden = !hidden;
+ }
+ if ( hidden ) {
+ jQuery( elem ).show();
+ } else {
+ anim.done(function() {
+ jQuery( elem ).hide();
+ });
+ }
+ anim.done(function() {
+ var prop;
+ jQuery._removeData( elem, "fxshow" );
+ for ( prop in orig ) {
+ jQuery.style( elem, prop, orig[ prop ] );
+ }
+ });
+ for ( index = 0 ; index < length ; index++ ) {
+ prop = handled[ index ];
+ tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
+ orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
+
+ if ( !( prop in dataShow ) ) {
+ dataShow[ prop ] = tween.start;
+ if ( hidden ) {
+ tween.end = tween.start;
+ tween.start = prop === "width" || prop === "height" ? 1 : 0;
+ }
+ }
+ }
+ }
+}
+
+function Tween( elem, options, prop, end, easing ) {
+ return new Tween.prototype.init( elem, options, prop, end, easing );
+}
+jQuery.Tween = Tween;
+
+Tween.prototype = {
+ constructor: Tween,
+ init: function( elem, options, prop, end, easing, unit ) {
+ this.elem = elem;
+ this.prop = prop;
+ this.easing = easing || "swing";
+ this.options = options;
+ this.start = this.now = this.cur();
+ this.end = end;
+ this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+ },
+ cur: function() {
+ var hooks = Tween.propHooks[ this.prop ];
+
+ return hooks && hooks.get ?
+ hooks.get( this ) :
+ Tween.propHooks._default.get( this );
+ },
+ run: function( percent ) {
+ var eased,
+ hooks = Tween.propHooks[ this.prop ];
+
+ if ( this.options.duration ) {
+ this.pos = eased = jQuery.easing[ this.easing ](
+ percent, this.options.duration * percent, 0, 1, this.options.duration
+ );
+ } else {
+ this.pos = eased = percent;
+ }
+ this.now = ( this.end - this.start ) * eased + this.start;
+
+ if ( this.options.step ) {
+ this.options.step.call( this.elem, this.now, this );
+ }
+
+ if ( hooks && hooks.set ) {
+ hooks.set( this );
+ } else {
+ Tween.propHooks._default.set( this );
+ }
+ return this;
+ }
+};
+
+Tween.prototype.init.prototype = Tween.prototype;
+
+Tween.propHooks = {
+ _default: {
+ get: function( tween ) {
+ var result;
+
+ if ( tween.elem[ tween.prop ] != null &&
+ (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
+ return tween.elem[ tween.prop ];
+ }
+
+ // passing a non empty string as a 3rd parameter to .css will automatically
+ // attempt a parseFloat and fallback to a string if the parse fails
+ // so, simple values such as "10px" are parsed to Float.
+ // complex values such as "rotate(1rad)" are returned as is.
+ result = jQuery.css( tween.elem, tween.prop, "auto" );
+ // Empty strings, null, undefined and "auto" are converted to 0.
+ return !result || result === "auto" ? 0 : result;
+ },
+ set: function( tween ) {
+ // use step hook for back compat - use cssHook if its there - use .style if its
+ // available and use plain properties where available
+ if ( jQuery.fx.step[ tween.prop ] ) {
+ jQuery.fx.step[ tween.prop ]( tween );
+ } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
+ jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
+ } else {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+ }
+};
+
+// Remove in 2.0 - this supports IE8's panic based approach
+// to setting things on disconnected nodes
+
+Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
+ set: function( tween ) {
+ if ( tween.elem.nodeType && tween.elem.parentNode ) {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+};
+
+jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
+ var cssFn = jQuery.fn[ name ];
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return speed == null || typeof speed === "boolean" ?
+ cssFn.apply( this, arguments ) :
+ this.animate( genFx( name, true ), speed, easing, callback );
+ };
+});
+
+jQuery.fn.extend({
+ fadeTo: function( speed, to, easing, callback ) {
+
+ // show any hidden elements after setting opacity to 0
+ return this.filter( isHidden ).css( "opacity", 0 ).show()
+
+ // animate to the value specified
+ .end().animate({ opacity: to }, speed, easing, callback );
+ },
+ animate: function( prop, speed, easing, callback ) {
+ var empty = jQuery.isEmptyObject( prop ),
+ optall = jQuery.speed( speed, easing, callback ),
+ doAnimation = function() {
+ // Operate on a copy of prop so per-property easing won't be lost
+ var anim = Animation( this, jQuery.extend( {}, prop ), optall );
+ doAnimation.finish = function() {
+ anim.stop( true );
+ };
+ // Empty animations, or finishing resolves immediately
+ if ( empty || jQuery._data( this, "finish" ) ) {
+ anim.stop( true );
+ }
+ };
+ doAnimation.finish = doAnimation;
+
+ return empty || optall.queue === false ?
+ this.each( doAnimation ) :
+ this.queue( optall.queue, doAnimation );
+ },
+ stop: function( type, clearQueue, gotoEnd ) {
+ var stopQueue = function( hooks ) {
+ var stop = hooks.stop;
+ delete hooks.stop;
+ stop( gotoEnd );
+ };
+
+ if ( typeof type !== "string" ) {
+ gotoEnd = clearQueue;
+ clearQueue = type;
+ type = undefined;
+ }
+ if ( clearQueue && type !== false ) {
+ this.queue( type || "fx", [] );
+ }
+
+ return this.each(function() {
+ var dequeue = true,
+ index = type != null && type + "queueHooks",
+ timers = jQuery.timers,
+ data = jQuery._data( this );
+
+ if ( index ) {
+ if ( data[ index ] && data[ index ].stop ) {
+ stopQueue( data[ index ] );
+ }
+ } else {
+ for ( index in data ) {
+ if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
+ stopQueue( data[ index ] );
+ }
+ }
+ }
+
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
+ timers[ index ].anim.stop( gotoEnd );
+ dequeue = false;
+ timers.splice( index, 1 );
+ }
+ }
+
+ // start the next in the queue if the last step wasn't forced
+ // timers currently will call their complete callbacks, which will dequeue
+ // but only if they were gotoEnd
+ if ( dequeue || !gotoEnd ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ finish: function( type ) {
+ if ( type !== false ) {
+ type = type || "fx";
+ }
+ return this.each(function() {
+ var index,
+ data = jQuery._data( this ),
+ queue = data[ type + "queue" ],
+ hooks = data[ type + "queueHooks" ],
+ timers = jQuery.timers,
+ length = queue ? queue.length : 0;
+
+ // enable finishing flag on private data
+ data.finish = true;
+
+ // empty the queue first
+ jQuery.queue( this, type, [] );
+
+ if ( hooks && hooks.cur && hooks.cur.finish ) {
+ hooks.cur.finish.call( this );
+ }
+
+ // look for any active animations, and finish them
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
+ timers[ index ].anim.stop( true );
+ timers.splice( index, 1 );
+ }
+ }
+
+ // look for any animations in the old queue and finish them
+ for ( index = 0; index < length; index++ ) {
+ if ( queue[ index ] && queue[ index ].finish ) {
+ queue[ index ].finish.call( this );
+ }
+ }
+
+ // turn off finishing flag
+ delete data.finish;
+ });
+ }
+});
+
+// Generate parameters to create a standard animation
+function genFx( type, includeWidth ) {
+ var which,
+ attrs = { height: type },
+ i = 0;
+
+ // if we include width, step value is 1 to do all cssExpand values,
+ // if we don't include width, step value is 2 to skip over Left and Right
+ includeWidth = includeWidth? 1 : 0;
+ for( ; i < 4 ; i += 2 - includeWidth ) {
+ which = cssExpand[ i ];
+ attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
+ }
+
+ if ( includeWidth ) {
+ attrs.opacity = attrs.width = type;
+ }
+
+ return attrs;
+}
+
+// Generate shortcuts for custom animations
+jQuery.each({
+ slideDown: genFx("show"),
+ slideUp: genFx("hide"),
+ slideToggle: genFx("toggle"),
+ fadeIn: { opacity: "show" },
+ fadeOut: { opacity: "hide" },
+ fadeToggle: { opacity: "toggle" }
+}, function( name, props ) {
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return this.animate( props, speed, easing, callback );
+ };
+});
+
+jQuery.speed = function( speed, easing, fn ) {
+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
+ };
+
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
+
+ // normalize opt.queue - true/undefined/null -> "fx"
+ if ( opt.queue == null || opt.queue === true ) {
+ opt.queue = "fx";
+ }
+
+ // Queueing
+ opt.old = opt.complete;
+
+ opt.complete = function() {
+ if ( jQuery.isFunction( opt.old ) ) {
+ opt.old.call( this );
+ }
+
+ if ( opt.queue ) {
+ jQuery.dequeue( this, opt.queue );
+ }
+ };
+
+ return opt;
+};
+
+jQuery.easing = {
+ linear: function( p ) {
+ return p;
+ },
+ swing: function( p ) {
+ return 0.5 - Math.cos( p*Math.PI ) / 2;
+ }
+};
+
+jQuery.timers = [];
+jQuery.fx = Tween.prototype.init;
+jQuery.fx.tick = function() {
+ var timer,
+ timers = jQuery.timers,
+ i = 0;
+
+ fxNow = jQuery.now();
+
+ for ( ; i < timers.length; i++ ) {
+ timer = timers[ i ];
+ // Checks the timer has not already been removed
+ if ( !timer() && timers[ i ] === timer ) {
+ timers.splice( i--, 1 );
+ }
+ }
+
+ if ( !timers.length ) {
+ jQuery.fx.stop();
+ }
+ fxNow = undefined;
+};
+
+jQuery.fx.timer = function( timer ) {
+ if ( timer() && jQuery.timers.push( timer ) ) {
+ jQuery.fx.start();
+ }
+};
+
+jQuery.fx.interval = 13;
+
+jQuery.fx.start = function() {
+ if ( !timerId ) {
+ timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
+ }
+};
+
+jQuery.fx.stop = function() {
+ clearInterval( timerId );
+ timerId = null;
+};
+
+jQuery.fx.speeds = {
+ slow: 600,
+ fast: 200,
+ // Default speed
+ _default: 400
+};
+
+// Back Compat <1.8 extension point
+jQuery.fx.step = {};
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.animated = function( elem ) {
+ return jQuery.grep(jQuery.timers, function( fn ) {
+ return elem === fn.elem;
+ }).length;
+ };
+}
+jQuery.fn.offset = function( options ) {
+ if ( arguments.length ) {
+ return options === undefined ?
+ this :
+ this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ var docElem, win,
+ box = { top: 0, left: 0 },
+ elem = this[ 0 ],
+ doc = elem && elem.ownerDocument;
+
+ if ( !doc ) {
+ return;
+ }
+
+ docElem = doc.documentElement;
+
+ // Make sure it's not a disconnected DOM node
+ if ( !jQuery.contains( docElem, elem ) ) {
+ return box;
+ }
+
+ // If we don't have gBCR, just use 0,0 rather than error
+ // BlackBerry 5, iOS 3 (original iPhone)
+ if ( typeof elem.getBoundingClientRect !== "undefined" ) {
+ box = elem.getBoundingClientRect();
+ }
+ win = getWindow( doc );
+ return {
+ top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
+ left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
+ };
+};
+
+jQuery.offset = {
+
+ setOffset: function( elem, options, i ) {
+ var position = jQuery.css( elem, "position" );
+
+ // set position first, in-case top/left are set even on static elem
+ if ( position === "static" ) {
+ elem.style.position = "relative";
+ }
+
+ var curElem = jQuery( elem ),
+ curOffset = curElem.offset(),
+ curCSSTop = jQuery.css( elem, "top" ),
+ curCSSLeft = jQuery.css( elem, "left" ),
+ calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
+ props = {}, curPosition = {}, curTop, curLeft;
+
+ // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
+ if ( calculatePosition ) {
+ curPosition = curElem.position();
+ curTop = curPosition.top;
+ curLeft = curPosition.left;
+ } else {
+ curTop = parseFloat( curCSSTop ) || 0;
+ curLeft = parseFloat( curCSSLeft ) || 0;
+ }
+
+ if ( jQuery.isFunction( options ) ) {
+ options = options.call( elem, i, curOffset );
+ }
+
+ if ( options.top != null ) {
+ props.top = ( options.top - curOffset.top ) + curTop;
+ }
+ if ( options.left != null ) {
+ props.left = ( options.left - curOffset.left ) + curLeft;
+ }
+
+ if ( "using" in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
+ }
+};
+
+
+jQuery.fn.extend({
+
+ position: function() {
+ if ( !this[ 0 ] ) {
+ return;
+ }
+
+ var offsetParent, offset,
+ parentOffset = { top: 0, left: 0 },
+ elem = this[ 0 ];
+
+ // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
+ if ( jQuery.css( elem, "position" ) === "fixed" ) {
+ // we assume that getBoundingClientRect is available when computed position is fixed
+ offset = elem.getBoundingClientRect();
+ } else {
+ // Get *real* offsetParent
+ offsetParent = this.offsetParent();
+
+ // Get correct offsets
+ offset = this.offset();
+ if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
+ parentOffset = offsetParent.offset();
+ }
+
+ // Add offsetParent borders
+ parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
+ parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
+ }
+
+ // Subtract parent offsets and element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ return {
+ top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
+ left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
+ };
+ },
+
+ offsetParent: function() {
+ return this.map(function() {
+ var offsetParent = this.offsetParent || document.documentElement;
+ while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
+ offsetParent = offsetParent.offsetParent;
+ }
+ return offsetParent || document.documentElement;
+ });
+ }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
+ var top = /Y/.test( prop );
+
+ jQuery.fn[ method ] = function( val ) {
+ return jQuery.access( this, function( elem, method, val ) {
+ var win = getWindow( elem );
+
+ if ( val === undefined ) {
+ return win ? (prop in win) ? win[ prop ] :
+ win.document.documentElement[ method ] :
+ elem[ method ];
+ }
+
+ if ( win ) {
+ win.scrollTo(
+ !top ? val : jQuery( win ).scrollLeft(),
+ top ? val : jQuery( win ).scrollTop()
+ );
+
+ } else {
+ elem[ method ] = val;
+ }
+ }, method, val, arguments.length, null );
+ };
+});
+
+function getWindow( elem ) {
+ return jQuery.isWindow( elem ) ?
+ elem :
+ elem.nodeType === 9 ?
+ elem.defaultView || elem.parentWindow :
+ false;
+}
+// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
+jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
+ jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
+ // margin is only for outerHeight, outerWidth
+ jQuery.fn[ funcName ] = function( margin, value ) {
+ var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
+ extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
+
+ return jQuery.access( this, function( elem, type, value ) {
+ var doc;
+
+ if ( jQuery.isWindow( elem ) ) {
+ // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
+ // isn't a whole lot we can do. See pull request at this URL for discussion:
+ // https://github.com/jquery/jquery/pull/764
+ return elem.document.documentElement[ "client" + name ];
+ }
+
+ // Get document width or height
+ if ( elem.nodeType === 9 ) {
+ doc = elem.documentElement;
+
+ // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
+ // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
+ return Math.max(
+ elem.body[ "scroll" + name ], doc[ "scroll" + name ],
+ elem.body[ "offset" + name ], doc[ "offset" + name ],
+ doc[ "client" + name ]
+ );
+ }
+
+ return value === undefined ?
+ // Get width or height on the element, requesting but not forcing parseFloat
+ jQuery.css( elem, type, extra ) :
+
+ // Set width or height on the element
+ jQuery.style( elem, type, value, extra );
+ }, type, chainable ? margin : undefined, chainable, null );
+ };
+ });
+});
+// Limit scope pollution from any deprecated API
+// (function() {
+
+// })();
+// Expose jQuery to the global object
+window.jQuery = window.$ = jQuery;
+
+// Expose jQuery as an AMD module, but only for AMD loaders that
+// understand the issues with loading multiple versions of jQuery
+// in a page that all might call define(). The loader will indicate
+// they have special allowances for multiple jQuery versions by
+// specifying define.amd.jQuery = true. Register as a named module,
+// since jQuery can be concatenated with other files that may use define,
+// but not use a proper concatenation script that understands anonymous
+// AMD modules. A named AMD is safest and most robust way to register.
+// Lowercase jquery is used because AMD module names are derived from
+// file names, and jQuery is normally delivered in a lowercase file name.
+// Do this after creating the global so that if an AMD module wants to call
+// noConflict to hide this version of jQuery, it will work.
+if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
+ define( "jquery", [], function () { return jQuery; } );
+}
+
+})( window ); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery-ui-latest.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery-ui-latest.js
new file mode 100644
index 00000000..aa83af97
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery-ui-latest.js
@@ -0,0 +1,14879 @@
+/*! jQuery UI - v1.9.2 - 2012-11-23
+* http://jqueryui.com
+* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.slider.js, jquery.ui.sortable.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
+* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */
+
+(function( $, undefined ) {
+
+var uuid = 0,
+ runiqueId = /^ui-id-\d+$/;
+
+// prevent duplicate loading
+// this is only a problem because we proxy existing functions
+// and we don't want to double proxy them
+$.ui = $.ui || {};
+if ( $.ui.version ) {
+ return;
+}
+
+$.extend( $.ui, {
+ version: "1.9.2",
+
+ keyCode: {
+ BACKSPACE: 8,
+ COMMA: 188,
+ DELETE: 46,
+ DOWN: 40,
+ END: 35,
+ ENTER: 13,
+ ESCAPE: 27,
+ HOME: 36,
+ LEFT: 37,
+ NUMPAD_ADD: 107,
+ NUMPAD_DECIMAL: 110,
+ NUMPAD_DIVIDE: 111,
+ NUMPAD_ENTER: 108,
+ NUMPAD_MULTIPLY: 106,
+ NUMPAD_SUBTRACT: 109,
+ PAGE_DOWN: 34,
+ PAGE_UP: 33,
+ PERIOD: 190,
+ RIGHT: 39,
+ SPACE: 32,
+ TAB: 9,
+ UP: 38
+ }
+});
+
+// plugins
+$.fn.extend({
+ _focus: $.fn.focus,
+ focus: function( delay, fn ) {
+ return typeof delay === "number" ?
+ this.each(function() {
+ var elem = this;
+ setTimeout(function() {
+ $( elem ).focus();
+ if ( fn ) {
+ fn.call( elem );
+ }
+ }, delay );
+ }) :
+ this._focus.apply( this, arguments );
+ },
+
+ scrollParent: function() {
+ var scrollParent;
+ if (($.ui.ie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
+ scrollParent = this.parents().filter(function() {
+ return (/(relative|absolute|fixed)/).test($.css(this,'position')) && (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x'));
+ }).eq(0);
+ } else {
+ scrollParent = this.parents().filter(function() {
+ return (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x'));
+ }).eq(0);
+ }
+
+ return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
+ },
+
+ zIndex: function( zIndex ) {
+ if ( zIndex !== undefined ) {
+ return this.css( "zIndex", zIndex );
+ }
+
+ if ( this.length ) {
+ var elem = $( this[ 0 ] ), position, value;
+ while ( elem.length && elem[ 0 ] !== document ) {
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
+ // This makes behavior of this function consistent across browsers
+ // WebKit always returns auto if the element is positioned
+ position = elem.css( "position" );
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
+ // IE returns 0 when zIndex is not specified
+ // other browsers return a string
+ // we ignore the case of nested elements with an explicit value of 0
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
+ value = parseInt( elem.css( "zIndex" ), 10 );
+ if ( !isNaN( value ) && value !== 0 ) {
+ return value;
+ }
+ }
+ elem = elem.parent();
+ }
+ }
+
+ return 0;
+ },
+
+ uniqueId: function() {
+ return this.each(function() {
+ if ( !this.id ) {
+ this.id = "ui-id-" + (++uuid);
+ }
+ });
+ },
+
+ removeUniqueId: function() {
+ return this.each(function() {
+ if ( runiqueId.test( this.id ) ) {
+ $( this ).removeAttr( "id" );
+ }
+ });
+ }
+});
+
+// selectors
+function focusable( element, isTabIndexNotNaN ) {
+ var map, mapName, img,
+ nodeName = element.nodeName.toLowerCase();
+ if ( "area" === nodeName ) {
+ map = element.parentNode;
+ mapName = map.name;
+ if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
+ return false;
+ }
+ img = $( "img[usemap=#" + mapName + "]" )[0];
+ return !!img && visible( img );
+ }
+ return ( /input|select|textarea|button|object/.test( nodeName ) ?
+ !element.disabled :
+ "a" === nodeName ?
+ element.href || isTabIndexNotNaN :
+ isTabIndexNotNaN) &&
+ // the element and all of its ancestors must be visible
+ visible( element );
+}
+
+function visible( element ) {
+ return $.expr.filters.visible( element ) &&
+ !$( element ).parents().andSelf().filter(function() {
+ return $.css( this, "visibility" ) === "hidden";
+ }).length;
+}
+
+$.extend( $.expr[ ":" ], {
+ data: $.expr.createPseudo ?
+ $.expr.createPseudo(function( dataName ) {
+ return function( elem ) {
+ return !!$.data( elem, dataName );
+ };
+ }) :
+ // support: jQuery <1.8
+ function( elem, i, match ) {
+ return !!$.data( elem, match[ 3 ] );
+ },
+
+ focusable: function( element ) {
+ return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
+ },
+
+ tabbable: function( element ) {
+ var tabIndex = $.attr( element, "tabindex" ),
+ isTabIndexNaN = isNaN( tabIndex );
+ return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
+ }
+});
+
+// support
+$(function() {
+ var body = document.body,
+ div = body.appendChild( div = document.createElement( "div" ) );
+
+ // access offsetHeight before setting the style to prevent a layout bug
+ // in IE 9 which causes the element to continue to take up space even
+ // after it is removed from the DOM (#8026)
+ div.offsetHeight;
+
+ $.extend( div.style, {
+ minHeight: "100px",
+ height: "auto",
+ padding: 0,
+ borderWidth: 0
+ });
+
+ $.support.minHeight = div.offsetHeight === 100;
+ $.support.selectstart = "onselectstart" in div;
+
+ // set display to none to avoid a layout bug in IE
+ // http://dev.jquery.com/ticket/4014
+ body.removeChild( div ).style.display = "none";
+});
+
+// support: jQuery <1.8
+if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
+ $.each( [ "Width", "Height" ], function( i, name ) {
+ var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
+ type = name.toLowerCase(),
+ orig = {
+ innerWidth: $.fn.innerWidth,
+ innerHeight: $.fn.innerHeight,
+ outerWidth: $.fn.outerWidth,
+ outerHeight: $.fn.outerHeight
+ };
+
+ function reduce( elem, size, border, margin ) {
+ $.each( side, function() {
+ size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
+ if ( border ) {
+ size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
+ }
+ if ( margin ) {
+ size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
+ }
+ });
+ return size;
+ }
+
+ $.fn[ "inner" + name ] = function( size ) {
+ if ( size === undefined ) {
+ return orig[ "inner" + name ].call( this );
+ }
+
+ return this.each(function() {
+ $( this ).css( type, reduce( this, size ) + "px" );
+ });
+ };
+
+ $.fn[ "outer" + name] = function( size, margin ) {
+ if ( typeof size !== "number" ) {
+ return orig[ "outer" + name ].call( this, size );
+ }
+
+ return this.each(function() {
+ $( this).css( type, reduce( this, size, true, margin ) + "px" );
+ });
+ };
+ });
+}
+
+// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
+if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
+ $.fn.removeData = (function( removeData ) {
+ return function( key ) {
+ if ( arguments.length ) {
+ return removeData.call( this, $.camelCase( key ) );
+ } else {
+ return removeData.call( this );
+ }
+ };
+ })( $.fn.removeData );
+}
+
+
+
+
+
+// deprecated
+
+(function() {
+ var uaMatch = /msie ([\w.]+)/.exec( navigator.userAgent.toLowerCase() ) || [];
+ $.ui.ie = uaMatch.length ? true : false;
+ $.ui.ie6 = parseFloat( uaMatch[ 1 ], 10 ) === 6;
+})();
+
+$.fn.extend({
+ disableSelection: function() {
+ return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
+ ".ui-disableSelection", function( event ) {
+ event.preventDefault();
+ });
+ },
+
+ enableSelection: function() {
+ return this.unbind( ".ui-disableSelection" );
+ }
+});
+
+$.extend( $.ui, {
+ // $.ui.plugin is deprecated. Use the proxy pattern instead.
+ plugin: {
+ add: function( module, option, set ) {
+ var i,
+ proto = $.ui[ module ].prototype;
+ for ( i in set ) {
+ proto.plugins[ i ] = proto.plugins[ i ] || [];
+ proto.plugins[ i ].push( [ option, set[ i ] ] );
+ }
+ },
+ call: function( instance, name, args ) {
+ var i,
+ set = instance.plugins[ name ];
+ if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
+ return;
+ }
+
+ for ( i = 0; i < set.length; i++ ) {
+ if ( instance.options[ set[ i ][ 0 ] ] ) {
+ set[ i ][ 1 ].apply( instance.element, args );
+ }
+ }
+ }
+ },
+
+ contains: $.contains,
+
+ // only used by resizable
+ hasScroll: function( el, a ) {
+
+ //If overflow is hidden, the element might have extra content, but the user wants to hide it
+ if ( $( el ).css( "overflow" ) === "hidden") {
+ return false;
+ }
+
+ var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
+ has = false;
+
+ if ( el[ scroll ] > 0 ) {
+ return true;
+ }
+
+ // TODO: determine which cases actually cause this to happen
+ // if the element doesn't have the scroll set, see if it's possible to
+ // set the scroll
+ el[ scroll ] = 1;
+ has = ( el[ scroll ] > 0 );
+ el[ scroll ] = 0;
+ return has;
+ },
+
+ // these are odd functions, fix the API or move into individual plugins
+ isOverAxis: function( x, reference, size ) {
+ //Determines when x coordinate is over "b" element axis
+ return ( x > reference ) && ( x < ( reference + size ) );
+ },
+ isOver: function( y, x, top, left, height, width ) {
+ //Determines when x, y coordinates is over "b" element
+ return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
+ }
+});
+
+})( jQuery );
+(function( $, undefined ) {
+
+var uuid = 0,
+ slice = Array.prototype.slice,
+ _cleanData = $.cleanData;
+$.cleanData = function( elems ) {
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ try {
+ $( elem ).triggerHandler( "remove" );
+ // http://bugs.jquery.com/ticket/8235
+ } catch( e ) {}
+ }
+ _cleanData( elems );
+};
+
+$.widget = function( name, base, prototype ) {
+ var fullName, existingConstructor, constructor, basePrototype,
+ namespace = name.split( "." )[ 0 ];
+
+ name = name.split( "." )[ 1 ];
+ fullName = namespace + "-" + name;
+
+ if ( !prototype ) {
+ prototype = base;
+ base = $.Widget;
+ }
+
+ // create selector for plugin
+ $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
+ return !!$.data( elem, fullName );
+ };
+
+ $[ namespace ] = $[ namespace ] || {};
+ existingConstructor = $[ namespace ][ name ];
+ constructor = $[ namespace ][ name ] = function( options, element ) {
+ // allow instantiation without "new" keyword
+ if ( !this._createWidget ) {
+ return new constructor( options, element );
+ }
+
+ // allow instantiation without initializing for simple inheritance
+ // must use "new" keyword (the code above always passes args)
+ if ( arguments.length ) {
+ this._createWidget( options, element );
+ }
+ };
+ // extend with the existing constructor to carry over any static properties
+ $.extend( constructor, existingConstructor, {
+ version: prototype.version,
+ // copy the object used to create the prototype in case we need to
+ // redefine the widget later
+ _proto: $.extend( {}, prototype ),
+ // track widgets that inherit from this widget in case this widget is
+ // redefined after a widget inherits from it
+ _childConstructors: []
+ });
+
+ basePrototype = new base();
+ // we need to make the options hash a property directly on the new instance
+ // otherwise we'll modify the options hash on the prototype that we're
+ // inheriting from
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );
+ $.each( prototype, function( prop, value ) {
+ if ( $.isFunction( value ) ) {
+ prototype[ prop ] = (function() {
+ var _super = function() {
+ return base.prototype[ prop ].apply( this, arguments );
+ },
+ _superApply = function( args ) {
+ return base.prototype[ prop ].apply( this, args );
+ };
+ return function() {
+ var __super = this._super,
+ __superApply = this._superApply,
+ returnValue;
+
+ this._super = _super;
+ this._superApply = _superApply;
+
+ returnValue = value.apply( this, arguments );
+
+ this._super = __super;
+ this._superApply = __superApply;
+
+ return returnValue;
+ };
+ })();
+ }
+ });
+ constructor.prototype = $.widget.extend( basePrototype, {
+ // TODO: remove support for widgetEventPrefix
+ // always use the name + a colon as the prefix, e.g., draggable:start
+ // don't prefix for widgets that aren't DOM-based
+ widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
+ }, prototype, {
+ constructor: constructor,
+ namespace: namespace,
+ widgetName: name,
+ // TODO remove widgetBaseClass, see #8155
+ widgetBaseClass: fullName,
+ widgetFullName: fullName
+ });
+
+ // If this widget is being redefined then we need to find all widgets that
+ // are inheriting from it and redefine all of them so that they inherit from
+ // the new version of this widget. We're essentially trying to replace one
+ // level in the prototype chain.
+ if ( existingConstructor ) {
+ $.each( existingConstructor._childConstructors, function( i, child ) {
+ var childPrototype = child.prototype;
+
+ // redefine the child widget using the same prototype that was
+ // originally used, but inherit from the new version of the base
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
+ });
+ // remove the list of existing child constructors from the old constructor
+ // so the old child constructors can be garbage collected
+ delete existingConstructor._childConstructors;
+ } else {
+ base._childConstructors.push( constructor );
+ }
+
+ $.widget.bridge( name, constructor );
+};
+
+$.widget.extend = function( target ) {
+ var input = slice.call( arguments, 1 ),
+ inputIndex = 0,
+ inputLength = input.length,
+ key,
+ value;
+ for ( ; inputIndex < inputLength; inputIndex++ ) {
+ for ( key in input[ inputIndex ] ) {
+ value = input[ inputIndex ][ key ];
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
+ // Clone objects
+ if ( $.isPlainObject( value ) ) {
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
+ $.widget.extend( {}, target[ key ], value ) :
+ // Don't extend strings, arrays, etc. with objects
+ $.widget.extend( {}, value );
+ // Copy everything else by reference
+ } else {
+ target[ key ] = value;
+ }
+ }
+ }
+ }
+ return target;
+};
+
+$.widget.bridge = function( name, object ) {
+ var fullName = object.prototype.widgetFullName || name;
+ $.fn[ name ] = function( options ) {
+ var isMethodCall = typeof options === "string",
+ args = slice.call( arguments, 1 ),
+ returnValue = this;
+
+ // allow multiple hashes to be passed on init
+ options = !isMethodCall && args.length ?
+ $.widget.extend.apply( null, [ options ].concat(args) ) :
+ options;
+
+ if ( isMethodCall ) {
+ this.each(function() {
+ var methodValue,
+ instance = $.data( this, fullName );
+ if ( !instance ) {
+ return $.error( "cannot call methods on " + name + " prior to initialization; " +
+ "attempted to call method '" + options + "'" );
+ }
+ if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
+ return $.error( "no such method '" + options + "' for " + name + " widget instance" );
+ }
+ methodValue = instance[ options ].apply( instance, args );
+ if ( methodValue !== instance && methodValue !== undefined ) {
+ returnValue = methodValue && methodValue.jquery ?
+ returnValue.pushStack( methodValue.get() ) :
+ methodValue;
+ return false;
+ }
+ });
+ } else {
+ this.each(function() {
+ var instance = $.data( this, fullName );
+ if ( instance ) {
+ instance.option( options || {} )._init();
+ } else {
+ $.data( this, fullName, new object( options, this ) );
+ }
+ });
+ }
+
+ return returnValue;
+ };
+};
+
+$.Widget = function( /* options, element */ ) {};
+$.Widget._childConstructors = [];
+
+$.Widget.prototype = {
+ widgetName: "widget",
+ widgetEventPrefix: "",
+ defaultElement: "<div>",
+ options: {
+ disabled: false,
+
+ // callbacks
+ create: null
+ },
+ _createWidget: function( options, element ) {
+ element = $( element || this.defaultElement || this )[ 0 ];
+ this.element = $( element );
+ this.uuid = uuid++;
+ this.eventNamespace = "." + this.widgetName + this.uuid;
+ this.options = $.widget.extend( {},
+ this.options,
+ this._getCreateOptions(),
+ options );
+
+ this.bindings = $();
+ this.hoverable = $();
+ this.focusable = $();
+
+ if ( element !== this ) {
+ // 1.9 BC for #7810
+ // TODO remove dual storage
+ $.data( element, this.widgetName, this );
+ $.data( element, this.widgetFullName, this );
+ this._on( true, this.element, {
+ remove: function( event ) {
+ if ( event.target === element ) {
+ this.destroy();
+ }
+ }
+ });
+ this.document = $( element.style ?
+ // element within the document
+ element.ownerDocument :
+ // element is window or document
+ element.document || element );
+ this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
+ }
+
+ this._create();
+ this._trigger( "create", null, this._getCreateEventData() );
+ this._init();
+ },
+ _getCreateOptions: $.noop,
+ _getCreateEventData: $.noop,
+ _create: $.noop,
+ _init: $.noop,
+
+ destroy: function() {
+ this._destroy();
+ // we can probably remove the unbind calls in 2.0
+ // all event bindings should go through this._on()
+ this.element
+ .unbind( this.eventNamespace )
+ // 1.9 BC for #7810
+ // TODO remove dual storage
+ .removeData( this.widgetName )
+ .removeData( this.widgetFullName )
+ // support: jquery <1.6.3
+ // http://bugs.jquery.com/ticket/9413
+ .removeData( $.camelCase( this.widgetFullName ) );
+ this.widget()
+ .unbind( this.eventNamespace )
+ .removeAttr( "aria-disabled" )
+ .removeClass(
+ this.widgetFullName + "-disabled " +
+ "ui-state-disabled" );
+
+ // clean up events and states
+ this.bindings.unbind( this.eventNamespace );
+ this.hoverable.removeClass( "ui-state-hover" );
+ this.focusable.removeClass( "ui-state-focus" );
+ },
+ _destroy: $.noop,
+
+ widget: function() {
+ return this.element;
+ },
+
+ option: function( key, value ) {
+ var options = key,
+ parts,
+ curOption,
+ i;
+
+ if ( arguments.length === 0 ) {
+ // don't return a reference to the internal hash
+ return $.widget.extend( {}, this.options );
+ }
+
+ if ( typeof key === "string" ) {
+ // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
+ options = {};
+ parts = key.split( "." );
+ key = parts.shift();
+ if ( parts.length ) {
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
+ for ( i = 0; i < parts.length - 1; i++ ) {
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
+ curOption = curOption[ parts[ i ] ];
+ }
+ key = parts.pop();
+ if ( value === undefined ) {
+ return curOption[ key ] === undefined ? null : curOption[ key ];
+ }
+ curOption[ key ] = value;
+ } else {
+ if ( value === undefined ) {
+ return this.options[ key ] === undefined ? null : this.options[ key ];
+ }
+ options[ key ] = value;
+ }
+ }
+
+ this._setOptions( options );
+
+ return this;
+ },
+ _setOptions: function( options ) {
+ var key;
+
+ for ( key in options ) {
+ this._setOption( key, options[ key ] );
+ }
+
+ return this;
+ },
+ _setOption: function( key, value ) {
+ this.options[ key ] = value;
+
+ if ( key === "disabled" ) {
+ this.widget()
+ .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
+ .attr( "aria-disabled", value );
+ this.hoverable.removeClass( "ui-state-hover" );
+ this.focusable.removeClass( "ui-state-focus" );
+ }
+
+ return this;
+ },
+
+ enable: function() {
+ return this._setOption( "disabled", false );
+ },
+ disable: function() {
+ return this._setOption( "disabled", true );
+ },
+
+ _on: function( suppressDisabledCheck, element, handlers ) {
+ var delegateElement,
+ instance = this;
+
+ // no suppressDisabledCheck flag, shuffle arguments
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
+ handlers = element;
+ element = suppressDisabledCheck;
+ suppressDisabledCheck = false;
+ }
+
+ // no element argument, shuffle and use this.element
+ if ( !handlers ) {
+ handlers = element;
+ element = this.element;
+ delegateElement = this.widget();
+ } else {
+ // accept selectors, DOM elements
+ element = delegateElement = $( element );
+ this.bindings = this.bindings.add( element );
+ }
+
+ $.each( handlers, function( event, handler ) {
+ function handlerProxy() {
+ // allow widgets to customize the disabled handling
+ // - disabled as an array instead of boolean
+ // - disabled class as method for disabling individual parts
+ if ( !suppressDisabledCheck &&
+ ( instance.options.disabled === true ||
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
+ return;
+ }
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
+ .apply( instance, arguments );
+ }
+
+ // copy the guid so direct unbinding works
+ if ( typeof handler !== "string" ) {
+ handlerProxy.guid = handler.guid =
+ handler.guid || handlerProxy.guid || $.guid++;
+ }
+
+ var match = event.match( /^(\w+)\s*(.*)$/ ),
+ eventName = match[1] + instance.eventNamespace,
+ selector = match[2];
+ if ( selector ) {
+ delegateElement.delegate( selector, eventName, handlerProxy );
+ } else {
+ element.bind( eventName, handlerProxy );
+ }
+ });
+ },
+
+ _off: function( element, eventName ) {
+ eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
+ element.unbind( eventName ).undelegate( eventName );
+ },
+
+ _delay: function( handler, delay ) {
+ function handlerProxy() {
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
+ .apply( instance, arguments );
+ }
+ var instance = this;
+ return setTimeout( handlerProxy, delay || 0 );
+ },
+
+ _hoverable: function( element ) {
+ this.hoverable = this.hoverable.add( element );
+ this._on( element, {
+ mouseenter: function( event ) {
+ $( event.currentTarget ).addClass( "ui-state-hover" );
+ },
+ mouseleave: function( event ) {
+ $( event.currentTarget ).removeClass( "ui-state-hover" );
+ }
+ });
+ },
+
+ _focusable: function( element ) {
+ this.focusable = this.focusable.add( element );
+ this._on( element, {
+ focusin: function( event ) {
+ $( event.currentTarget ).addClass( "ui-state-focus" );
+ },
+ focusout: function( event ) {
+ $( event.currentTarget ).removeClass( "ui-state-focus" );
+ }
+ });
+ },
+
+ _trigger: function( type, event, data ) {
+ var prop, orig,
+ callback = this.options[ type ];
+
+ data = data || {};
+ event = $.Event( event );
+ event.type = ( type === this.widgetEventPrefix ?
+ type :
+ this.widgetEventPrefix + type ).toLowerCase();
+ // the original event may come from any element
+ // so we need to reset the target on the new event
+ event.target = this.element[ 0 ];
+
+ // copy original event properties over to the new event
+ orig = event.originalEvent;
+ if ( orig ) {
+ for ( prop in orig ) {
+ if ( !( prop in event ) ) {
+ event[ prop ] = orig[ prop ];
+ }
+ }
+ }
+
+ this.element.trigger( event, data );
+ return !( $.isFunction( callback ) &&
+ callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
+ event.isDefaultPrevented() );
+ }
+};
+
+$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
+ if ( typeof options === "string" ) {
+ options = { effect: options };
+ }
+ var hasOptions,
+ effectName = !options ?
+ method :
+ options === true || typeof options === "number" ?
+ defaultEffect :
+ options.effect || defaultEffect;
+ options = options || {};
+ if ( typeof options === "number" ) {
+ options = { duration: options };
+ }
+ hasOptions = !$.isEmptyObject( options );
+ options.complete = callback;
+ if ( options.delay ) {
+ element.delay( options.delay );
+ }
+ if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) {
+ element[ method ]( options );
+ } else if ( effectName !== method && element[ effectName ] ) {
+ element[ effectName ]( options.duration, options.easing, callback );
+ } else {
+ element.queue(function( next ) {
+ $( this )[ method ]();
+ if ( callback ) {
+ callback.call( element[ 0 ] );
+ }
+ next();
+ });
+ }
+ };
+});
+
+// DEPRECATED
+if ( $.uiBackCompat !== false ) {
+ $.Widget.prototype._getCreateOptions = function() {
+ return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
+ };
+}
+
+})( jQuery );
+(function( $, undefined ) {
+
+var mouseHandled = false;
+$( document ).mouseup( function( e ) {
+ mouseHandled = false;
+});
+
+$.widget("ui.mouse", {
+ version: "1.9.2",
+ options: {
+ cancel: 'input,textarea,button,select,option',
+ distance: 1,
+ delay: 0
+ },
+ _mouseInit: function() {
+ var that = this;
+
+ this.element
+ .bind('mousedown.'+this.widgetName, function(event) {
+ return that._mouseDown(event);
+ })
+ .bind('click.'+this.widgetName, function(event) {
+ if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) {
+ $.removeData(event.target, that.widgetName + '.preventClickEvent');
+ event.stopImmediatePropagation();
+ return false;
+ }
+ });
+
+ this.started = false;
+ },
+
+ // TODO: make sure destroying one instance of mouse doesn't mess with
+ // other instances of mouse
+ _mouseDestroy: function() {
+ this.element.unbind('.'+this.widgetName);
+ if ( this._mouseMoveDelegate ) {
+ $(document)
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+ }
+ },
+
+ _mouseDown: function(event) {
+ // don't let more than one widget handle mouseStart
+ if( mouseHandled ) { return; }
+
+ // we may have missed mouseup (out of window)
+ (this._mouseStarted && this._mouseUp(event));
+
+ this._mouseDownEvent = event;
+
+ var that = this,
+ btnIsLeft = (event.which === 1),
+ // event.target.nodeName works around a bug in IE 8 with
+ // disabled inputs (#7620)
+ elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
+ if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
+ return true;
+ }
+
+ this.mouseDelayMet = !this.options.delay;
+ if (!this.mouseDelayMet) {
+ this._mouseDelayTimer = setTimeout(function() {
+ that.mouseDelayMet = true;
+ }, this.options.delay);
+ }
+
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+ this._mouseStarted = (this._mouseStart(event) !== false);
+ if (!this._mouseStarted) {
+ event.preventDefault();
+ return true;
+ }
+ }
+
+ // Click event may never have fired (Gecko & Opera)
+ if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
+ $.removeData(event.target, this.widgetName + '.preventClickEvent');
+ }
+
+ // these delegates are required to keep context
+ this._mouseMoveDelegate = function(event) {
+ return that._mouseMove(event);
+ };
+ this._mouseUpDelegate = function(event) {
+ return that._mouseUp(event);
+ };
+ $(document)
+ .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+ .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+
+ event.preventDefault();
+
+ mouseHandled = true;
+ return true;
+ },
+
+ _mouseMove: function(event) {
+ // IE mouseup check - mouseup happened when mouse was out of window
+ if ($.ui.ie && !(document.documentMode >= 9) && !event.button) {
+ return this._mouseUp(event);
+ }
+
+ if (this._mouseStarted) {
+ this._mouseDrag(event);
+ return event.preventDefault();
+ }
+
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+ this._mouseStarted =
+ (this._mouseStart(this._mouseDownEvent, event) !== false);
+ (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
+ }
+
+ return !this._mouseStarted;
+ },
+
+ _mouseUp: function(event) {
+ $(document)
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+
+ if (this._mouseStarted) {
+ this._mouseStarted = false;
+
+ if (event.target === this._mouseDownEvent.target) {
+ $.data(event.target, this.widgetName + '.preventClickEvent', true);
+ }
+
+ this._mouseStop(event);
+ }
+
+ return false;
+ },
+
+ _mouseDistanceMet: function(event) {
+ return (Math.max(
+ Math.abs(this._mouseDownEvent.pageX - event.pageX),
+ Math.abs(this._mouseDownEvent.pageY - event.pageY)
+ ) >= this.options.distance
+ );
+ },
+
+ _mouseDelayMet: function(event) {
+ return this.mouseDelayMet;
+ },
+
+ // These are placeholder methods, to be overriden by extending plugin
+ _mouseStart: function(event) {},
+ _mouseDrag: function(event) {},
+ _mouseStop: function(event) {},
+ _mouseCapture: function(event) { return true; }
+});
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.ui = $.ui || {};
+
+var cachedScrollbarWidth,
+ max = Math.max,
+ abs = Math.abs,
+ round = Math.round,
+ rhorizontal = /left|center|right/,
+ rvertical = /top|center|bottom/,
+ roffset = /[\+\-]\d+%?/,
+ rposition = /^\w+/,
+ rpercent = /%$/,
+ _position = $.fn.position;
+
+function getOffsets( offsets, width, height ) {
+ return [
+ parseInt( offsets[ 0 ], 10 ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
+ parseInt( offsets[ 1 ], 10 ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
+ ];
+}
+function parseCss( element, property ) {
+ return parseInt( $.css( element, property ), 10 ) || 0;
+}
+
+$.position = {
+ scrollbarWidth: function() {
+ if ( cachedScrollbarWidth !== undefined ) {
+ return cachedScrollbarWidth;
+ }
+ var w1, w2,
+ div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
+ innerDiv = div.children()[0];
+
+ $( "body" ).append( div );
+ w1 = innerDiv.offsetWidth;
+ div.css( "overflow", "scroll" );
+
+ w2 = innerDiv.offsetWidth;
+
+ if ( w1 === w2 ) {
+ w2 = div[0].clientWidth;
+ }
+
+ div.remove();
+
+ return (cachedScrollbarWidth = w1 - w2);
+ },
+ getScrollInfo: function( within ) {
+ var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ),
+ overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ),
+ hasOverflowX = overflowX === "scroll" ||
+ ( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
+ hasOverflowY = overflowY === "scroll" ||
+ ( overflowY === "auto" && within.height < within.element[0].scrollHeight );
+ return {
+ width: hasOverflowX ? $.position.scrollbarWidth() : 0,
+ height: hasOverflowY ? $.position.scrollbarWidth() : 0
+ };
+ },
+ getWithinInfo: function( element ) {
+ var withinElement = $( element || window ),
+ isWindow = $.isWindow( withinElement[0] );
+ return {
+ element: withinElement,
+ isWindow: isWindow,
+ offset: withinElement.offset() || { left: 0, top: 0 },
+ scrollLeft: withinElement.scrollLeft(),
+ scrollTop: withinElement.scrollTop(),
+ width: isWindow ? withinElement.width() : withinElement.outerWidth(),
+ height: isWindow ? withinElement.height() : withinElement.outerHeight()
+ };
+ }
+};
+
+$.fn.position = function( options ) {
+ if ( !options || !options.of ) {
+ return _position.apply( this, arguments );
+ }
+
+ // make a copy, we don't want to modify arguments
+ options = $.extend( {}, options );
+
+ var atOffset, targetWidth, targetHeight, targetOffset, basePosition,
+ target = $( options.of ),
+ within = $.position.getWithinInfo( options.within ),
+ scrollInfo = $.position.getScrollInfo( within ),
+ targetElem = target[0],
+ collision = ( options.collision || "flip" ).split( " " ),
+ offsets = {};
+
+ if ( targetElem.nodeType === 9 ) {
+ targetWidth = target.width();
+ targetHeight = target.height();
+ targetOffset = { top: 0, left: 0 };
+ } else if ( $.isWindow( targetElem ) ) {
+ targetWidth = target.width();
+ targetHeight = target.height();
+ targetOffset = { top: target.scrollTop(), left: target.scrollLeft() };
+ } else if ( targetElem.preventDefault ) {
+ // force left top to allow flipping
+ options.at = "left top";
+ targetWidth = targetHeight = 0;
+ targetOffset = { top: targetElem.pageY, left: targetElem.pageX };
+ } else {
+ targetWidth = target.outerWidth();
+ targetHeight = target.outerHeight();
+ targetOffset = target.offset();
+ }
+ // clone to reuse original targetOffset later
+ basePosition = $.extend( {}, targetOffset );
+
+ // force my and at to have valid horizontal and vertical positions
+ // if a value is missing or invalid, it will be converted to center
+ $.each( [ "my", "at" ], function() {
+ var pos = ( options[ this ] || "" ).split( " " ),
+ horizontalOffset,
+ verticalOffset;
+
+ if ( pos.length === 1) {
+ pos = rhorizontal.test( pos[ 0 ] ) ?
+ pos.concat( [ "center" ] ) :
+ rvertical.test( pos[ 0 ] ) ?
+ [ "center" ].concat( pos ) :
+ [ "center", "center" ];
+ }
+ pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
+ pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
+
+ // calculate offsets
+ horizontalOffset = roffset.exec( pos[ 0 ] );
+ verticalOffset = roffset.exec( pos[ 1 ] );
+ offsets[ this ] = [
+ horizontalOffset ? horizontalOffset[ 0 ] : 0,
+ verticalOffset ? verticalOffset[ 0 ] : 0
+ ];
+
+ // reduce to just the positions without the offsets
+ options[ this ] = [
+ rposition.exec( pos[ 0 ] )[ 0 ],
+ rposition.exec( pos[ 1 ] )[ 0 ]
+ ];
+ });
+
+ // normalize collision option
+ if ( collision.length === 1 ) {
+ collision[ 1 ] = collision[ 0 ];
+ }
+
+ if ( options.at[ 0 ] === "right" ) {
+ basePosition.left += targetWidth;
+ } else if ( options.at[ 0 ] === "center" ) {
+ basePosition.left += targetWidth / 2;
+ }
+
+ if ( options.at[ 1 ] === "bottom" ) {
+ basePosition.top += targetHeight;
+ } else if ( options.at[ 1 ] === "center" ) {
+ basePosition.top += targetHeight / 2;
+ }
+
+ atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
+ basePosition.left += atOffset[ 0 ];
+ basePosition.top += atOffset[ 1 ];
+
+ return this.each(function() {
+ var collisionPosition, using,
+ elem = $( this ),
+ elemWidth = elem.outerWidth(),
+ elemHeight = elem.outerHeight(),
+ marginLeft = parseCss( this, "marginLeft" ),
+ marginTop = parseCss( this, "marginTop" ),
+ collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
+ collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
+ position = $.extend( {}, basePosition ),
+ myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
+
+ if ( options.my[ 0 ] === "right" ) {
+ position.left -= elemWidth;
+ } else if ( options.my[ 0 ] === "center" ) {
+ position.left -= elemWidth / 2;
+ }
+
+ if ( options.my[ 1 ] === "bottom" ) {
+ position.top -= elemHeight;
+ } else if ( options.my[ 1 ] === "center" ) {
+ position.top -= elemHeight / 2;
+ }
+
+ position.left += myOffset[ 0 ];
+ position.top += myOffset[ 1 ];
+
+ // if the browser doesn't support fractions, then round for consistent results
+ if ( !$.support.offsetFractions ) {
+ position.left = round( position.left );
+ position.top = round( position.top );
+ }
+
+ collisionPosition = {
+ marginLeft: marginLeft,
+ marginTop: marginTop
+ };
+
+ $.each( [ "left", "top" ], function( i, dir ) {
+ if ( $.ui.position[ collision[ i ] ] ) {
+ $.ui.position[ collision[ i ] ][ dir ]( position, {
+ targetWidth: targetWidth,
+ targetHeight: targetHeight,
+ elemWidth: elemWidth,
+ elemHeight: elemHeight,
+ collisionPosition: collisionPosition,
+ collisionWidth: collisionWidth,
+ collisionHeight: collisionHeight,
+ offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
+ my: options.my,
+ at: options.at,
+ within: within,
+ elem : elem
+ });
+ }
+ });
+
+ if ( $.fn.bgiframe ) {
+ elem.bgiframe();
+ }
+
+ if ( options.using ) {
+ // adds feedback as second argument to using callback, if present
+ using = function( props ) {
+ var left = targetOffset.left - position.left,
+ right = left + targetWidth - elemWidth,
+ top = targetOffset.top - position.top,
+ bottom = top + targetHeight - elemHeight,
+ feedback = {
+ target: {
+ element: target,
+ left: targetOffset.left,
+ top: targetOffset.top,
+ width: targetWidth,
+ height: targetHeight
+ },
+ element: {
+ element: elem,
+ left: position.left,
+ top: position.top,
+ width: elemWidth,
+ height: elemHeight
+ },
+ horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
+ vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
+ };
+ if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
+ feedback.horizontal = "center";
+ }
+ if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
+ feedback.vertical = "middle";
+ }
+ if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
+ feedback.important = "horizontal";
+ } else {
+ feedback.important = "vertical";
+ }
+ options.using.call( this, props, feedback );
+ };
+ }
+
+ elem.offset( $.extend( position, { using: using } ) );
+ });
+};
+
+$.ui.position = {
+ fit: {
+ left: function( position, data ) {
+ var within = data.within,
+ withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
+ outerWidth = within.width,
+ collisionPosLeft = position.left - data.collisionPosition.marginLeft,
+ overLeft = withinOffset - collisionPosLeft,
+ overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
+ newOverRight;
+
+ // element is wider than within
+ if ( data.collisionWidth > outerWidth ) {
+ // element is initially over the left side of within
+ if ( overLeft > 0 && overRight <= 0 ) {
+ newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
+ position.left += overLeft - newOverRight;
+ // element is initially over right side of within
+ } else if ( overRight > 0 && overLeft <= 0 ) {
+ position.left = withinOffset;
+ // element is initially over both left and right sides of within
+ } else {
+ if ( overLeft > overRight ) {
+ position.left = withinOffset + outerWidth - data.collisionWidth;
+ } else {
+ position.left = withinOffset;
+ }
+ }
+ // too far left -> align with left edge
+ } else if ( overLeft > 0 ) {
+ position.left += overLeft;
+ // too far right -> align with right edge
+ } else if ( overRight > 0 ) {
+ position.left -= overRight;
+ // adjust based on position and margin
+ } else {
+ position.left = max( position.left - collisionPosLeft, position.left );
+ }
+ },
+ top: function( position, data ) {
+ var within = data.within,
+ withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
+ outerHeight = data.within.height,
+ collisionPosTop = position.top - data.collisionPosition.marginTop,
+ overTop = withinOffset - collisionPosTop,
+ overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
+ newOverBottom;
+
+ // element is taller than within
+ if ( data.collisionHeight > outerHeight ) {
+ // element is initially over the top of within
+ if ( overTop > 0 && overBottom <= 0 ) {
+ newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
+ position.top += overTop - newOverBottom;
+ // element is initially over bottom of within
+ } else if ( overBottom > 0 && overTop <= 0 ) {
+ position.top = withinOffset;
+ // element is initially over both top and bottom of within
+ } else {
+ if ( overTop > overBottom ) {
+ position.top = withinOffset + outerHeight - data.collisionHeight;
+ } else {
+ position.top = withinOffset;
+ }
+ }
+ // too far up -> align with top
+ } else if ( overTop > 0 ) {
+ position.top += overTop;
+ // too far down -> align with bottom edge
+ } else if ( overBottom > 0 ) {
+ position.top -= overBottom;
+ // adjust based on position and margin
+ } else {
+ position.top = max( position.top - collisionPosTop, position.top );
+ }
+ }
+ },
+ flip: {
+ left: function( position, data ) {
+ var within = data.within,
+ withinOffset = within.offset.left + within.scrollLeft,
+ outerWidth = within.width,
+ offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
+ collisionPosLeft = position.left - data.collisionPosition.marginLeft,
+ overLeft = collisionPosLeft - offsetLeft,
+ overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
+ myOffset = data.my[ 0 ] === "left" ?
+ -data.elemWidth :
+ data.my[ 0 ] === "right" ?
+ data.elemWidth :
+ 0,
+ atOffset = data.at[ 0 ] === "left" ?
+ data.targetWidth :
+ data.at[ 0 ] === "right" ?
+ -data.targetWidth :
+ 0,
+ offset = -2 * data.offset[ 0 ],
+ newOverRight,
+ newOverLeft;
+
+ if ( overLeft < 0 ) {
+ newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
+ if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
+ position.left += myOffset + atOffset + offset;
+ }
+ }
+ else if ( overRight > 0 ) {
+ newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
+ if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
+ position.left += myOffset + atOffset + offset;
+ }
+ }
+ },
+ top: function( position, data ) {
+ var within = data.within,
+ withinOffset = within.offset.top + within.scrollTop,
+ outerHeight = within.height,
+ offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
+ collisionPosTop = position.top - data.collisionPosition.marginTop,
+ overTop = collisionPosTop - offsetTop,
+ overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
+ top = data.my[ 1 ] === "top",
+ myOffset = top ?
+ -data.elemHeight :
+ data.my[ 1 ] === "bottom" ?
+ data.elemHeight :
+ 0,
+ atOffset = data.at[ 1 ] === "top" ?
+ data.targetHeight :
+ data.at[ 1 ] === "bottom" ?
+ -data.targetHeight :
+ 0,
+ offset = -2 * data.offset[ 1 ],
+ newOverTop,
+ newOverBottom;
+ if ( overTop < 0 ) {
+ newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
+ if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
+ position.top += myOffset + atOffset + offset;
+ }
+ }
+ else if ( overBottom > 0 ) {
+ newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
+ if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
+ position.top += myOffset + atOffset + offset;
+ }
+ }
+ }
+ },
+ flipfit: {
+ left: function() {
+ $.ui.position.flip.left.apply( this, arguments );
+ $.ui.position.fit.left.apply( this, arguments );
+ },
+ top: function() {
+ $.ui.position.flip.top.apply( this, arguments );
+ $.ui.position.fit.top.apply( this, arguments );
+ }
+ }
+};
+
+// fraction support test
+(function () {
+ var testElement, testElementParent, testElementStyle, offsetLeft, i,
+ body = document.getElementsByTagName( "body" )[ 0 ],
+ div = document.createElement( "div" );
+
+ //Create a "fake body" for testing based on method used in jQuery.support
+ testElement = document.createElement( body ? "div" : "body" );
+ testElementStyle = {
+ visibility: "hidden",
+ width: 0,
+ height: 0,
+ border: 0,
+ margin: 0,
+ background: "none"
+ };
+ if ( body ) {
+ $.extend( testElementStyle, {
+ position: "absolute",
+ left: "-1000px",
+ top: "-1000px"
+ });
+ }
+ for ( i in testElementStyle ) {
+ testElement.style[ i ] = testElementStyle[ i ];
+ }
+ testElement.appendChild( div );
+ testElementParent = body || document.documentElement;
+ testElementParent.insertBefore( testElement, testElementParent.firstChild );
+
+ div.style.cssText = "position: absolute; left: 10.7432222px;";
+
+ offsetLeft = $( div ).offset().left;
+ $.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11;
+
+ testElement.innerHTML = "";
+ testElementParent.removeChild( testElement );
+})();
+
+// DEPRECATED
+if ( $.uiBackCompat !== false ) {
+ // offset option
+ (function( $ ) {
+ var _position = $.fn.position;
+ $.fn.position = function( options ) {
+ if ( !options || !options.offset ) {
+ return _position.call( this, options );
+ }
+ var offset = options.offset.split( " " ),
+ at = options.at.split( " " );
+ if ( offset.length === 1 ) {
+ offset[ 1 ] = offset[ 0 ];
+ }
+ if ( /^\d/.test( offset[ 0 ] ) ) {
+ offset[ 0 ] = "+" + offset[ 0 ];
+ }
+ if ( /^\d/.test( offset[ 1 ] ) ) {
+ offset[ 1 ] = "+" + offset[ 1 ];
+ }
+ if ( at.length === 1 ) {
+ if ( /left|center|right/.test( at[ 0 ] ) ) {
+ at[ 1 ] = "center";
+ } else {
+ at[ 1 ] = at[ 0 ];
+ at[ 0 ] = "center";
+ }
+ }
+ return _position.call( this, $.extend( options, {
+ at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ],
+ offset: undefined
+ } ) );
+ };
+ }( jQuery ) );
+}
+
+}( jQuery ) );
+(function( $, undefined ) {
+
+var uid = 0,
+ hideProps = {},
+ showProps = {};
+
+hideProps.height = hideProps.paddingTop = hideProps.paddingBottom =
+ hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide";
+showProps.height = showProps.paddingTop = showProps.paddingBottom =
+ showProps.borderTopWidth = showProps.borderBottomWidth = "show";
+
+$.widget( "ui.accordion", {
+ version: "1.9.2",
+ options: {
+ active: 0,
+ animate: {},
+ collapsible: false,
+ event: "click",
+ header: "> li > :first-child,> :not(li):even",
+ heightStyle: "auto",
+ icons: {
+ activeHeader: "ui-icon-triangle-1-s",
+ header: "ui-icon-triangle-1-e"
+ },
+
+ // callbacks
+ activate: null,
+ beforeActivate: null
+ },
+
+ _create: function() {
+ var accordionId = this.accordionId = "ui-accordion-" +
+ (this.element.attr( "id" ) || ++uid),
+ options = this.options;
+
+ this.prevShow = this.prevHide = $();
+ this.element.addClass( "ui-accordion ui-widget ui-helper-reset" );
+
+ this.headers = this.element.find( options.header )
+ .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" );
+ this._hoverable( this.headers );
+ this._focusable( this.headers );
+
+ this.headers.next()
+ .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
+ .hide();
+
+ // don't allow collapsible: false and active: false / null
+ if ( !options.collapsible && (options.active === false || options.active == null) ) {
+ options.active = 0;
+ }
+ // handle negative values
+ if ( options.active < 0 ) {
+ options.active += this.headers.length;
+ }
+ this.active = this._findActive( options.active )
+ .addClass( "ui-accordion-header-active ui-state-active" )
+ .toggleClass( "ui-corner-all ui-corner-top" );
+ this.active.next()
+ .addClass( "ui-accordion-content-active" )
+ .show();
+
+ this._createIcons();
+ this.refresh();
+
+ // ARIA
+ this.element.attr( "role", "tablist" );
+
+ this.headers
+ .attr( "role", "tab" )
+ .each(function( i ) {
+ var header = $( this ),
+ headerId = header.attr( "id" ),
+ panel = header.next(),
+ panelId = panel.attr( "id" );
+ if ( !headerId ) {
+ headerId = accordionId + "-header-" + i;
+ header.attr( "id", headerId );
+ }
+ if ( !panelId ) {
+ panelId = accordionId + "-panel-" + i;
+ panel.attr( "id", panelId );
+ }
+ header.attr( "aria-controls", panelId );
+ panel.attr( "aria-labelledby", headerId );
+ })
+ .next()
+ .attr( "role", "tabpanel" );
+
+ this.headers
+ .not( this.active )
+ .attr({
+ "aria-selected": "false",
+ tabIndex: -1
+ })
+ .next()
+ .attr({
+ "aria-expanded": "false",
+ "aria-hidden": "true"
+ })
+ .hide();
+
+ // make sure at least one header is in the tab order
+ if ( !this.active.length ) {
+ this.headers.eq( 0 ).attr( "tabIndex", 0 );
+ } else {
+ this.active.attr({
+ "aria-selected": "true",
+ tabIndex: 0
+ })
+ .next()
+ .attr({
+ "aria-expanded": "true",
+ "aria-hidden": "false"
+ });
+ }
+
+ this._on( this.headers, { keydown: "_keydown" });
+ this._on( this.headers.next(), { keydown: "_panelKeyDown" });
+ this._setupEvents( options.event );
+ },
+
+ _getCreateEventData: function() {
+ return {
+ header: this.active,
+ content: !this.active.length ? $() : this.active.next()
+ };
+ },
+
+ _createIcons: function() {
+ var icons = this.options.icons;
+ if ( icons ) {
+ $( "<span>" )
+ .addClass( "ui-accordion-header-icon ui-icon " + icons.header )
+ .prependTo( this.headers );
+ this.active.children( ".ui-accordion-header-icon" )
+ .removeClass( icons.header )
+ .addClass( icons.activeHeader );
+ this.headers.addClass( "ui-accordion-icons" );
+ }
+ },
+
+ _destroyIcons: function() {
+ this.headers
+ .removeClass( "ui-accordion-icons" )
+ .children( ".ui-accordion-header-icon" )
+ .remove();
+ },
+
+ _destroy: function() {
+ var contents;
+
+ // clean up main element
+ this.element
+ .removeClass( "ui-accordion ui-widget ui-helper-reset" )
+ .removeAttr( "role" );
+
+ // clean up headers
+ this.headers
+ .removeClass( "ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-selected" )
+ .removeAttr( "aria-controls" )
+ .removeAttr( "tabIndex" )
+ .each(function() {
+ if ( /^ui-accordion/.test( this.id ) ) {
+ this.removeAttribute( "id" );
+ }
+ });
+ this._destroyIcons();
+
+ // clean up content panels
+ contents = this.headers.next()
+ .css( "display", "" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-expanded" )
+ .removeAttr( "aria-hidden" )
+ .removeAttr( "aria-labelledby" )
+ .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" )
+ .each(function() {
+ if ( /^ui-accordion/.test( this.id ) ) {
+ this.removeAttribute( "id" );
+ }
+ });
+ if ( this.options.heightStyle !== "content" ) {
+ contents.css( "height", "" );
+ }
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "active" ) {
+ // _activate() will handle invalid values and update this.options
+ this._activate( value );
+ return;
+ }
+
+ if ( key === "event" ) {
+ if ( this.options.event ) {
+ this._off( this.headers, this.options.event );
+ }
+ this._setupEvents( value );
+ }
+
+ this._super( key, value );
+
+ // setting collapsible: false while collapsed; open first panel
+ if ( key === "collapsible" && !value && this.options.active === false ) {
+ this._activate( 0 );
+ }
+
+ if ( key === "icons" ) {
+ this._destroyIcons();
+ if ( value ) {
+ this._createIcons();
+ }
+ }
+
+ // #5332 - opacity doesn't cascade to positioned elements in IE
+ // so we need to add the disabled class to the headers and panels
+ if ( key === "disabled" ) {
+ this.headers.add( this.headers.next() )
+ .toggleClass( "ui-state-disabled", !!value );
+ }
+ },
+
+ _keydown: function( event ) {
+ if ( event.altKey || event.ctrlKey ) {
+ return;
+ }
+
+ var keyCode = $.ui.keyCode,
+ length = this.headers.length,
+ currentIndex = this.headers.index( event.target ),
+ toFocus = false;
+
+ switch ( event.keyCode ) {
+ case keyCode.RIGHT:
+ case keyCode.DOWN:
+ toFocus = this.headers[ ( currentIndex + 1 ) % length ];
+ break;
+ case keyCode.LEFT:
+ case keyCode.UP:
+ toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
+ break;
+ case keyCode.SPACE:
+ case keyCode.ENTER:
+ this._eventHandler( event );
+ break;
+ case keyCode.HOME:
+ toFocus = this.headers[ 0 ];
+ break;
+ case keyCode.END:
+ toFocus = this.headers[ length - 1 ];
+ break;
+ }
+
+ if ( toFocus ) {
+ $( event.target ).attr( "tabIndex", -1 );
+ $( toFocus ).attr( "tabIndex", 0 );
+ toFocus.focus();
+ event.preventDefault();
+ }
+ },
+
+ _panelKeyDown : function( event ) {
+ if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
+ $( event.currentTarget ).prev().focus();
+ }
+ },
+
+ refresh: function() {
+ var maxHeight, overflow,
+ heightStyle = this.options.heightStyle,
+ parent = this.element.parent();
+
+
+ if ( heightStyle === "fill" ) {
+ // IE 6 treats height like minHeight, so we need to turn off overflow
+ // in order to get a reliable height
+ // we use the minHeight support test because we assume that only
+ // browsers that don't support minHeight will treat height as minHeight
+ if ( !$.support.minHeight ) {
+ overflow = parent.css( "overflow" );
+ parent.css( "overflow", "hidden");
+ }
+ maxHeight = parent.height();
+ this.element.siblings( ":visible" ).each(function() {
+ var elem = $( this ),
+ position = elem.css( "position" );
+
+ if ( position === "absolute" || position === "fixed" ) {
+ return;
+ }
+ maxHeight -= elem.outerHeight( true );
+ });
+ if ( overflow ) {
+ parent.css( "overflow", overflow );
+ }
+
+ this.headers.each(function() {
+ maxHeight -= $( this ).outerHeight( true );
+ });
+
+ this.headers.next()
+ .each(function() {
+ $( this ).height( Math.max( 0, maxHeight -
+ $( this ).innerHeight() + $( this ).height() ) );
+ })
+ .css( "overflow", "auto" );
+ } else if ( heightStyle === "auto" ) {
+ maxHeight = 0;
+ this.headers.next()
+ .each(function() {
+ maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
+ })
+ .height( maxHeight );
+ }
+ },
+
+ _activate: function( index ) {
+ var active = this._findActive( index )[ 0 ];
+
+ // trying to activate the already active panel
+ if ( active === this.active[ 0 ] ) {
+ return;
+ }
+
+ // trying to collapse, simulate a click on the currently active header
+ active = active || this.active[ 0 ];
+
+ this._eventHandler({
+ target: active,
+ currentTarget: active,
+ preventDefault: $.noop
+ });
+ },
+
+ _findActive: function( selector ) {
+ return typeof selector === "number" ? this.headers.eq( selector ) : $();
+ },
+
+ _setupEvents: function( event ) {
+ var events = {};
+ if ( !event ) {
+ return;
+ }
+ $.each( event.split(" "), function( index, eventName ) {
+ events[ eventName ] = "_eventHandler";
+ });
+ this._on( this.headers, events );
+ },
+
+ _eventHandler: function( event ) {
+ var options = this.options,
+ active = this.active,
+ clicked = $( event.currentTarget ),
+ clickedIsActive = clicked[ 0 ] === active[ 0 ],
+ collapsing = clickedIsActive && options.collapsible,
+ toShow = collapsing ? $() : clicked.next(),
+ toHide = active.next(),
+ eventData = {
+ oldHeader: active,
+ oldPanel: toHide,
+ newHeader: collapsing ? $() : clicked,
+ newPanel: toShow
+ };
+
+ event.preventDefault();
+
+ if (
+ // click on active header, but not collapsible
+ ( clickedIsActive && !options.collapsible ) ||
+ // allow canceling activation
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
+ return;
+ }
+
+ options.active = collapsing ? false : this.headers.index( clicked );
+
+ // when the call to ._toggle() comes after the class changes
+ // it causes a very odd bug in IE 8 (see #6720)
+ this.active = clickedIsActive ? $() : clicked;
+ this._toggle( eventData );
+
+ // switch classes
+ // corner classes on the previously active header stay after the animation
+ active.removeClass( "ui-accordion-header-active ui-state-active" );
+ if ( options.icons ) {
+ active.children( ".ui-accordion-header-icon" )
+ .removeClass( options.icons.activeHeader )
+ .addClass( options.icons.header );
+ }
+
+ if ( !clickedIsActive ) {
+ clicked
+ .removeClass( "ui-corner-all" )
+ .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
+ if ( options.icons ) {
+ clicked.children( ".ui-accordion-header-icon" )
+ .removeClass( options.icons.header )
+ .addClass( options.icons.activeHeader );
+ }
+
+ clicked
+ .next()
+ .addClass( "ui-accordion-content-active" );
+ }
+ },
+
+ _toggle: function( data ) {
+ var toShow = data.newPanel,
+ toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
+
+ // handle activating a panel during the animation for another activation
+ this.prevShow.add( this.prevHide ).stop( true, true );
+ this.prevShow = toShow;
+ this.prevHide = toHide;
+
+ if ( this.options.animate ) {
+ this._animate( toShow, toHide, data );
+ } else {
+ toHide.hide();
+ toShow.show();
+ this._toggleComplete( data );
+ }
+
+ toHide.attr({
+ "aria-expanded": "false",
+ "aria-hidden": "true"
+ });
+ toHide.prev().attr( "aria-selected", "false" );
+ // if we're switching panels, remove the old header from the tab order
+ // if we're opening from collapsed state, remove the previous header from the tab order
+ // if we're collapsing, then keep the collapsing header in the tab order
+ if ( toShow.length && toHide.length ) {
+ toHide.prev().attr( "tabIndex", -1 );
+ } else if ( toShow.length ) {
+ this.headers.filter(function() {
+ return $( this ).attr( "tabIndex" ) === 0;
+ })
+ .attr( "tabIndex", -1 );
+ }
+
+ toShow
+ .attr({
+ "aria-expanded": "true",
+ "aria-hidden": "false"
+ })
+ .prev()
+ .attr({
+ "aria-selected": "true",
+ tabIndex: 0
+ });
+ },
+
+ _animate: function( toShow, toHide, data ) {
+ var total, easing, duration,
+ that = this,
+ adjust = 0,
+ down = toShow.length &&
+ ( !toHide.length || ( toShow.index() < toHide.index() ) ),
+ animate = this.options.animate || {},
+ options = down && animate.down || animate,
+ complete = function() {
+ that._toggleComplete( data );
+ };
+
+ if ( typeof options === "number" ) {
+ duration = options;
+ }
+ if ( typeof options === "string" ) {
+ easing = options;
+ }
+ // fall back from options to animation in case of partial down settings
+ easing = easing || options.easing || animate.easing;
+ duration = duration || options.duration || animate.duration;
+
+ if ( !toHide.length ) {
+ return toShow.animate( showProps, duration, easing, complete );
+ }
+ if ( !toShow.length ) {
+ return toHide.animate( hideProps, duration, easing, complete );
+ }
+
+ total = toShow.show().outerHeight();
+ toHide.animate( hideProps, {
+ duration: duration,
+ easing: easing,
+ step: function( now, fx ) {
+ fx.now = Math.round( now );
+ }
+ });
+ toShow
+ .hide()
+ .animate( showProps, {
+ duration: duration,
+ easing: easing,
+ complete: complete,
+ step: function( now, fx ) {
+ fx.now = Math.round( now );
+ if ( fx.prop !== "height" ) {
+ adjust += fx.now;
+ } else if ( that.options.heightStyle !== "content" ) {
+ fx.now = Math.round( total - toHide.outerHeight() - adjust );
+ adjust = 0;
+ }
+ }
+ });
+ },
+
+ _toggleComplete: function( data ) {
+ var toHide = data.oldPanel;
+
+ toHide
+ .removeClass( "ui-accordion-content-active" )
+ .prev()
+ .removeClass( "ui-corner-top" )
+ .addClass( "ui-corner-all" );
+
+ // Work around for rendering bug in IE (#5421)
+ if ( toHide.length ) {
+ toHide.parent()[0].className = toHide.parent()[0].className;
+ }
+
+ this._trigger( "activate", null, data );
+ }
+});
+
+
+
+// DEPRECATED
+if ( $.uiBackCompat !== false ) {
+ // navigation options
+ (function( $, prototype ) {
+ $.extend( prototype.options, {
+ navigation: false,
+ navigationFilter: function() {
+ return this.href.toLowerCase() === location.href.toLowerCase();
+ }
+ });
+
+ var _create = prototype._create;
+ prototype._create = function() {
+ if ( this.options.navigation ) {
+ var that = this,
+ headers = this.element.find( this.options.header ),
+ content = headers.next(),
+ current = headers.add( content )
+ .find( "a" )
+ .filter( this.options.navigationFilter )
+ [ 0 ];
+ if ( current ) {
+ headers.add( content ).each( function( index ) {
+ if ( $.contains( this, current ) ) {
+ that.options.active = Math.floor( index / 2 );
+ return false;
+ }
+ });
+ }
+ }
+ _create.call( this );
+ };
+ }( jQuery, jQuery.ui.accordion.prototype ) );
+
+ // height options
+ (function( $, prototype ) {
+ $.extend( prototype.options, {
+ heightStyle: null, // remove default so we fall back to old values
+ autoHeight: true, // use heightStyle: "auto"
+ clearStyle: false, // use heightStyle: "content"
+ fillSpace: false // use heightStyle: "fill"
+ });
+
+ var _create = prototype._create,
+ _setOption = prototype._setOption;
+
+ $.extend( prototype, {
+ _create: function() {
+ this.options.heightStyle = this.options.heightStyle ||
+ this._mergeHeightStyle();
+
+ _create.call( this );
+ },
+
+ _setOption: function( key ) {
+ if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) {
+ this.options.heightStyle = this._mergeHeightStyle();
+ }
+ _setOption.apply( this, arguments );
+ },
+
+ _mergeHeightStyle: function() {
+ var options = this.options;
+
+ if ( options.fillSpace ) {
+ return "fill";
+ }
+
+ if ( options.clearStyle ) {
+ return "content";
+ }
+
+ if ( options.autoHeight ) {
+ return "auto";
+ }
+ }
+ });
+ }( jQuery, jQuery.ui.accordion.prototype ) );
+
+ // icon options
+ (function( $, prototype ) {
+ $.extend( prototype.options.icons, {
+ activeHeader: null, // remove default so we fall back to old values
+ headerSelected: "ui-icon-triangle-1-s"
+ });
+
+ var _createIcons = prototype._createIcons;
+ prototype._createIcons = function() {
+ if ( this.options.icons ) {
+ this.options.icons.activeHeader = this.options.icons.activeHeader ||
+ this.options.icons.headerSelected;
+ }
+ _createIcons.call( this );
+ };
+ }( jQuery, jQuery.ui.accordion.prototype ) );
+
+ // expanded active option, activate method
+ (function( $, prototype ) {
+ prototype.activate = prototype._activate;
+
+ var _findActive = prototype._findActive;
+ prototype._findActive = function( index ) {
+ if ( index === -1 ) {
+ index = false;
+ }
+ if ( index && typeof index !== "number" ) {
+ index = this.headers.index( this.headers.filter( index ) );
+ if ( index === -1 ) {
+ index = false;
+ }
+ }
+ return _findActive.call( this, index );
+ };
+ }( jQuery, jQuery.ui.accordion.prototype ) );
+
+ // resize method
+ jQuery.ui.accordion.prototype.resize = jQuery.ui.accordion.prototype.refresh;
+
+ // change events
+ (function( $, prototype ) {
+ $.extend( prototype.options, {
+ change: null,
+ changestart: null
+ });
+
+ var _trigger = prototype._trigger;
+ prototype._trigger = function( type, event, data ) {
+ var ret = _trigger.apply( this, arguments );
+ if ( !ret ) {
+ return false;
+ }
+
+ if ( type === "beforeActivate" ) {
+ ret = _trigger.call( this, "changestart", event, {
+ oldHeader: data.oldHeader,
+ oldContent: data.oldPanel,
+ newHeader: data.newHeader,
+ newContent: data.newPanel
+ });
+ } else if ( type === "activate" ) {
+ ret = _trigger.call( this, "change", event, {
+ oldHeader: data.oldHeader,
+ oldContent: data.oldPanel,
+ newHeader: data.newHeader,
+ newContent: data.newPanel
+ });
+ }
+ return ret;
+ };
+ }( jQuery, jQuery.ui.accordion.prototype ) );
+
+ // animated option
+ // NOTE: this only provides support for "slide", "bounceslide", and easings
+ // not the full $.ui.accordion.animations API
+ (function( $, prototype ) {
+ $.extend( prototype.options, {
+ animate: null,
+ animated: "slide"
+ });
+
+ var _create = prototype._create;
+ prototype._create = function() {
+ var options = this.options;
+ if ( options.animate === null ) {
+ if ( !options.animated ) {
+ options.animate = false;
+ } else if ( options.animated === "slide" ) {
+ options.animate = 300;
+ } else if ( options.animated === "bounceslide" ) {
+ options.animate = {
+ duration: 200,
+ down: {
+ easing: "easeOutBounce",
+ duration: 1000
+ }
+ };
+ } else {
+ options.animate = options.animated;
+ }
+ }
+
+ _create.call( this );
+ };
+ }( jQuery, jQuery.ui.accordion.prototype ) );
+}
+
+})( jQuery );
+(function( $, undefined ) {
+
+// used to prevent race conditions with remote data sources
+var requestIndex = 0;
+
+$.widget( "ui.autocomplete", {
+ version: "1.9.2",
+ defaultElement: "<input>",
+ options: {
+ appendTo: "body",
+ autoFocus: false,
+ delay: 300,
+ minLength: 1,
+ position: {
+ my: "left top",
+ at: "left bottom",
+ collision: "none"
+ },
+ source: null,
+
+ // callbacks
+ change: null,
+ close: null,
+ focus: null,
+ open: null,
+ response: null,
+ search: null,
+ select: null
+ },
+
+ pending: 0,
+
+ _create: function() {
+ // Some browsers only repeat keydown events, not keypress events,
+ // so we use the suppressKeyPress flag to determine if we've already
+ // handled the keydown event. #7269
+ // Unfortunately the code for & in keypress is the same as the up arrow,
+ // so we use the suppressKeyPressRepeat flag to avoid handling keypress
+ // events when we know the keydown event was used to modify the
+ // search term. #7799
+ var suppressKeyPress, suppressKeyPressRepeat, suppressInput;
+
+ this.isMultiLine = this._isMultiLine();
+ this.valueMethod = this.element[ this.element.is( "input,textarea" ) ? "val" : "text" ];
+ this.isNewMenu = true;
+
+ this.element
+ .addClass( "ui-autocomplete-input" )
+ .attr( "autocomplete", "off" );
+
+ this._on( this.element, {
+ keydown: function( event ) {
+ if ( this.element.prop( "readOnly" ) ) {
+ suppressKeyPress = true;
+ suppressInput = true;
+ suppressKeyPressRepeat = true;
+ return;
+ }
+
+ suppressKeyPress = false;
+ suppressInput = false;
+ suppressKeyPressRepeat = false;
+ var keyCode = $.ui.keyCode;
+ switch( event.keyCode ) {
+ case keyCode.PAGE_UP:
+ suppressKeyPress = true;
+ this._move( "previousPage", event );
+ break;
+ case keyCode.PAGE_DOWN:
+ suppressKeyPress = true;
+ this._move( "nextPage", event );
+ break;
+ case keyCode.UP:
+ suppressKeyPress = true;
+ this._keyEvent( "previous", event );
+ break;
+ case keyCode.DOWN:
+ suppressKeyPress = true;
+ this._keyEvent( "next", event );
+ break;
+ case keyCode.ENTER:
+ case keyCode.NUMPAD_ENTER:
+ // when menu is open and has focus
+ if ( this.menu.active ) {
+ // #6055 - Opera still allows the keypress to occur
+ // which causes forms to submit
+ suppressKeyPress = true;
+ event.preventDefault();
+ this.menu.select( event );
+ }
+ break;
+ case keyCode.TAB:
+ if ( this.menu.active ) {
+ this.menu.select( event );
+ }
+ break;
+ case keyCode.ESCAPE:
+ if ( this.menu.element.is( ":visible" ) ) {
+ this._value( this.term );
+ this.close( event );
+ // Different browsers have different default behavior for escape
+ // Single press can mean undo or clear
+ // Double press in IE means clear the whole form
+ event.preventDefault();
+ }
+ break;
+ default:
+ suppressKeyPressRepeat = true;
+ // search timeout should be triggered before the input value is changed
+ this._searchTimeout( event );
+ break;
+ }
+ },
+ keypress: function( event ) {
+ if ( suppressKeyPress ) {
+ suppressKeyPress = false;
+ event.preventDefault();
+ return;
+ }
+ if ( suppressKeyPressRepeat ) {
+ return;
+ }
+
+ // replicate some key handlers to allow them to repeat in Firefox and Opera
+ var keyCode = $.ui.keyCode;
+ switch( event.keyCode ) {
+ case keyCode.PAGE_UP:
+ this._move( "previousPage", event );
+ break;
+ case keyCode.PAGE_DOWN:
+ this._move( "nextPage", event );
+ break;
+ case keyCode.UP:
+ this._keyEvent( "previous", event );
+ break;
+ case keyCode.DOWN:
+ this._keyEvent( "next", event );
+ break;
+ }
+ },
+ input: function( event ) {
+ if ( suppressInput ) {
+ suppressInput = false;
+ event.preventDefault();
+ return;
+ }
+ this._searchTimeout( event );
+ },
+ focus: function() {
+ this.selectedItem = null;
+ this.previous = this._value();
+ },
+ blur: function( event ) {
+ if ( this.cancelBlur ) {
+ delete this.cancelBlur;
+ return;
+ }
+
+ clearTimeout( this.searching );
+ this.close( event );
+ this._change( event );
+ }
+ });
+
+ this._initSource();
+ this.menu = $( "<ul>" )
+ .addClass( "ui-autocomplete" )
+ .appendTo( this.document.find( this.options.appendTo || "body" )[ 0 ] )
+ .menu({
+ // custom key handling for now
+ input: $(),
+ // disable ARIA support, the live region takes care of that
+ role: null
+ })
+ .zIndex( this.element.zIndex() + 1 )
+ .hide()
+ .data( "menu" );
+
+ this._on( this.menu.element, {
+ mousedown: function( event ) {
+ // prevent moving focus out of the text field
+ event.preventDefault();
+
+ // IE doesn't prevent moving focus even with event.preventDefault()
+ // so we set a flag to know when we should ignore the blur event
+ this.cancelBlur = true;
+ this._delay(function() {
+ delete this.cancelBlur;
+ });
+
+ // clicking on the scrollbar causes focus to shift to the body
+ // but we can't detect a mouseup or a click immediately afterward
+ // so we have to track the next mousedown and close the menu if
+ // the user clicks somewhere outside of the autocomplete
+ var menuElement = this.menu.element[ 0 ];
+ if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
+ this._delay(function() {
+ var that = this;
+ this.document.one( "mousedown", function( event ) {
+ if ( event.target !== that.element[ 0 ] &&
+ event.target !== menuElement &&
+ !$.contains( menuElement, event.target ) ) {
+ that.close();
+ }
+ });
+ });
+ }
+ },
+ menufocus: function( event, ui ) {
+ // #7024 - Prevent accidental activation of menu items in Firefox
+ if ( this.isNewMenu ) {
+ this.isNewMenu = false;
+ if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
+ this.menu.blur();
+
+ this.document.one( "mousemove", function() {
+ $( event.target ).trigger( event.originalEvent );
+ });
+
+ return;
+ }
+ }
+
+ // back compat for _renderItem using item.autocomplete, via #7810
+ // TODO remove the fallback, see #8156
+ var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" );
+ if ( false !== this._trigger( "focus", event, { item: item } ) ) {
+ // use value to match what will end up in the input, if it was a key event
+ if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
+ this._value( item.value );
+ }
+ } else {
+ // Normally the input is populated with the item's value as the
+ // menu is navigated, causing screen readers to notice a change and
+ // announce the item. Since the focus event was canceled, this doesn't
+ // happen, so we update the live region so that screen readers can
+ // still notice the change and announce it.
+ this.liveRegion.text( item.value );
+ }
+ },
+ menuselect: function( event, ui ) {
+ // back compat for _renderItem using item.autocomplete, via #7810
+ // TODO remove the fallback, see #8156
+ var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ),
+ previous = this.previous;
+
+ // only trigger when focus was lost (click on menu)
+ if ( this.element[0] !== this.document[0].activeElement ) {
+ this.element.focus();
+ this.previous = previous;
+ // #6109 - IE triggers two focus events and the second
+ // is asynchronous, so we need to reset the previous
+ // term synchronously and asynchronously :-(
+ this._delay(function() {
+ this.previous = previous;
+ this.selectedItem = item;
+ });
+ }
+
+ if ( false !== this._trigger( "select", event, { item: item } ) ) {
+ this._value( item.value );
+ }
+ // reset the term after the select event
+ // this allows custom select handling to work properly
+ this.term = this._value();
+
+ this.close( event );
+ this.selectedItem = item;
+ }
+ });
+
+ this.liveRegion = $( "<span>", {
+ role: "status",
+ "aria-live": "polite"
+ })
+ .addClass( "ui-helper-hidden-accessible" )
+ .insertAfter( this.element );
+
+ if ( $.fn.bgiframe ) {
+ this.menu.element.bgiframe();
+ }
+
+ // turning off autocomplete prevents the browser from remembering the
+ // value when navigating through history, so we re-enable autocomplete
+ // if the page is unloaded before the widget is destroyed. #7790
+ this._on( this.window, {
+ beforeunload: function() {
+ this.element.removeAttr( "autocomplete" );
+ }
+ });
+ },
+
+ _destroy: function() {
+ clearTimeout( this.searching );
+ this.element
+ .removeClass( "ui-autocomplete-input" )
+ .removeAttr( "autocomplete" );
+ this.menu.element.remove();
+ this.liveRegion.remove();
+ },
+
+ _setOption: function( key, value ) {
+ this._super( key, value );
+ if ( key === "source" ) {
+ this._initSource();
+ }
+ if ( key === "appendTo" ) {
+ this.menu.element.appendTo( this.document.find( value || "body" )[0] );
+ }
+ if ( key === "disabled" && value && this.xhr ) {
+ this.xhr.abort();
+ }
+ },
+
+ _isMultiLine: function() {
+ // Textareas are always multi-line
+ if ( this.element.is( "textarea" ) ) {
+ return true;
+ }
+ // Inputs are always single-line, even if inside a contentEditable element
+ // IE also treats inputs as contentEditable
+ if ( this.element.is( "input" ) ) {
+ return false;
+ }
+ // All other element types are determined by whether or not they're contentEditable
+ return this.element.prop( "isContentEditable" );
+ },
+
+ _initSource: function() {
+ var array, url,
+ that = this;
+ if ( $.isArray(this.options.source) ) {
+ array = this.options.source;
+ this.source = function( request, response ) {
+ response( $.ui.autocomplete.filter( array, request.term ) );
+ };
+ } else if ( typeof this.options.source === "string" ) {
+ url = this.options.source;
+ this.source = function( request, response ) {
+ if ( that.xhr ) {
+ that.xhr.abort();
+ }
+ that.xhr = $.ajax({
+ url: url,
+ data: request,
+ dataType: "json",
+ success: function( data ) {
+ response( data );
+ },
+ error: function() {
+ response( [] );
+ }
+ });
+ };
+ } else {
+ this.source = this.options.source;
+ }
+ },
+
+ _searchTimeout: function( event ) {
+ clearTimeout( this.searching );
+ this.searching = this._delay(function() {
+ // only search if the value has changed
+ if ( this.term !== this._value() ) {
+ this.selectedItem = null;
+ this.search( null, event );
+ }
+ }, this.options.delay );
+ },
+
+ search: function( value, event ) {
+ value = value != null ? value : this._value();
+
+ // always save the actual value, not the one passed as an argument
+ this.term = this._value();
+
+ if ( value.length < this.options.minLength ) {
+ return this.close( event );
+ }
+
+ if ( this._trigger( "search", event ) === false ) {
+ return;
+ }
+
+ return this._search( value );
+ },
+
+ _search: function( value ) {
+ this.pending++;
+ this.element.addClass( "ui-autocomplete-loading" );
+ this.cancelSearch = false;
+
+ this.source( { term: value }, this._response() );
+ },
+
+ _response: function() {
+ var that = this,
+ index = ++requestIndex;
+
+ return function( content ) {
+ if ( index === requestIndex ) {
+ that.__response( content );
+ }
+
+ that.pending--;
+ if ( !that.pending ) {
+ that.element.removeClass( "ui-autocomplete-loading" );
+ }
+ };
+ },
+
+ __response: function( content ) {
+ if ( content ) {
+ content = this._normalize( content );
+ }
+ this._trigger( "response", null, { content: content } );
+ if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
+ this._suggest( content );
+ this._trigger( "open" );
+ } else {
+ // use ._close() instead of .close() so we don't cancel future searches
+ this._close();
+ }
+ },
+
+ close: function( event ) {
+ this.cancelSearch = true;
+ this._close( event );
+ },
+
+ _close: function( event ) {
+ if ( this.menu.element.is( ":visible" ) ) {
+ this.menu.element.hide();
+ this.menu.blur();
+ this.isNewMenu = true;
+ this._trigger( "close", event );
+ }
+ },
+
+ _change: function( event ) {
+ if ( this.previous !== this._value() ) {
+ this._trigger( "change", event, { item: this.selectedItem } );
+ }
+ },
+
+ _normalize: function( items ) {
+ // assume all items have the right format when the first item is complete
+ if ( items.length && items[0].label && items[0].value ) {
+ return items;
+ }
+ return $.map( items, function( item ) {
+ if ( typeof item === "string" ) {
+ return {
+ label: item,
+ value: item
+ };
+ }
+ return $.extend({
+ label: item.label || item.value,
+ value: item.value || item.label
+ }, item );
+ });
+ },
+
+ _suggest: function( items ) {
+ var ul = this.menu.element
+ .empty()
+ .zIndex( this.element.zIndex() + 1 );
+ this._renderMenu( ul, items );
+ this.menu.refresh();
+
+ // size and position menu
+ ul.show();
+ this._resizeMenu();
+ ul.position( $.extend({
+ of: this.element
+ }, this.options.position ));
+
+ if ( this.options.autoFocus ) {
+ this.menu.next();
+ }
+ },
+
+ _resizeMenu: function() {
+ var ul = this.menu.element;
+ ul.outerWidth( Math.max(
+ // Firefox wraps long text (possibly a rounding bug)
+ // so we add 1px to avoid the wrapping (#7513)
+ ul.width( "" ).outerWidth() + 1,
+ this.element.outerWidth()
+ ) );
+ },
+
+ _renderMenu: function( ul, items ) {
+ var that = this;
+ $.each( items, function( index, item ) {
+ that._renderItemData( ul, item );
+ });
+ },
+
+ _renderItemData: function( ul, item ) {
+ return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
+ },
+
+ _renderItem: function( ul, item ) {
+ return $( "<li>" )
+ .append( $( "<a>" ).text( item.label ) )
+ .appendTo( ul );
+ },
+
+ _move: function( direction, event ) {
+ if ( !this.menu.element.is( ":visible" ) ) {
+ this.search( null, event );
+ return;
+ }
+ if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
+ this.menu.isLastItem() && /^next/.test( direction ) ) {
+ this._value( this.term );
+ this.menu.blur();
+ return;
+ }
+ this.menu[ direction ]( event );
+ },
+
+ widget: function() {
+ return this.menu.element;
+ },
+
+ _value: function() {
+ return this.valueMethod.apply( this.element, arguments );
+ },
+
+ _keyEvent: function( keyEvent, event ) {
+ if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
+ this._move( keyEvent, event );
+
+ // prevents moving cursor to beginning/end of the text field in some browsers
+ event.preventDefault();
+ }
+ }
+});
+
+$.extend( $.ui.autocomplete, {
+ escapeRegex: function( value ) {
+ return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
+ },
+ filter: function(array, term) {
+ var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
+ return $.grep( array, function(value) {
+ return matcher.test( value.label || value.value || value );
+ });
+ }
+});
+
+
+// live region extension, adding a `messages` option
+// NOTE: This is an experimental API. We are still investigating
+// a full solution for string manipulation and internationalization.
+$.widget( "ui.autocomplete", $.ui.autocomplete, {
+ options: {
+ messages: {
+ noResults: "No search results.",
+ results: function( amount ) {
+ return amount + ( amount > 1 ? " results are" : " result is" ) +
+ " available, use up and down arrow keys to navigate.";
+ }
+ }
+ },
+
+ __response: function( content ) {
+ var message;
+ this._superApply( arguments );
+ if ( this.options.disabled || this.cancelSearch ) {
+ return;
+ }
+ if ( content && content.length ) {
+ message = this.options.messages.results( content.length );
+ } else {
+ message = this.options.messages.noResults;
+ }
+ this.liveRegion.text( message );
+ }
+});
+
+
+}( jQuery ));
+(function( $, undefined ) {
+
+var lastActive, startXPos, startYPos, clickDragged,
+ baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
+ stateClasses = "ui-state-hover ui-state-active ",
+ typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
+ formResetHandler = function() {
+ var buttons = $( this ).find( ":ui-button" );
+ setTimeout(function() {
+ buttons.button( "refresh" );
+ }, 1 );
+ },
+ radioGroup = function( radio ) {
+ var name = radio.name,
+ form = radio.form,
+ radios = $( [] );
+ if ( name ) {
+ if ( form ) {
+ radios = $( form ).find( "[name='" + name + "']" );
+ } else {
+ radios = $( "[name='" + name + "']", radio.ownerDocument )
+ .filter(function() {
+ return !this.form;
+ });
+ }
+ }
+ return radios;
+ };
+
+$.widget( "ui.button", {
+ version: "1.9.2",
+ defaultElement: "<button>",
+ options: {
+ disabled: null,
+ text: true,
+ label: null,
+ icons: {
+ primary: null,
+ secondary: null
+ }
+ },
+ _create: function() {
+ this.element.closest( "form" )
+ .unbind( "reset" + this.eventNamespace )
+ .bind( "reset" + this.eventNamespace, formResetHandler );
+
+ if ( typeof this.options.disabled !== "boolean" ) {
+ this.options.disabled = !!this.element.prop( "disabled" );
+ } else {
+ this.element.prop( "disabled", this.options.disabled );
+ }
+
+ this._determineButtonType();
+ this.hasTitle = !!this.buttonElement.attr( "title" );
+
+ var that = this,
+ options = this.options,
+ toggleButton = this.type === "checkbox" || this.type === "radio",
+ activeClass = !toggleButton ? "ui-state-active" : "",
+ focusClass = "ui-state-focus";
+
+ if ( options.label === null ) {
+ options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
+ }
+
+ this._hoverable( this.buttonElement );
+
+ this.buttonElement
+ .addClass( baseClasses )
+ .attr( "role", "button" )
+ .bind( "mouseenter" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return;
+ }
+ if ( this === lastActive ) {
+ $( this ).addClass( "ui-state-active" );
+ }
+ })
+ .bind( "mouseleave" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return;
+ }
+ $( this ).removeClass( activeClass );
+ })
+ .bind( "click" + this.eventNamespace, function( event ) {
+ if ( options.disabled ) {
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ }
+ });
+
+ this.element
+ .bind( "focus" + this.eventNamespace, function() {
+ // no need to check disabled, focus won't be triggered anyway
+ that.buttonElement.addClass( focusClass );
+ })
+ .bind( "blur" + this.eventNamespace, function() {
+ that.buttonElement.removeClass( focusClass );
+ });
+
+ if ( toggleButton ) {
+ this.element.bind( "change" + this.eventNamespace, function() {
+ if ( clickDragged ) {
+ return;
+ }
+ that.refresh();
+ });
+ // if mouse moves between mousedown and mouseup (drag) set clickDragged flag
+ // prevents issue where button state changes but checkbox/radio checked state
+ // does not in Firefox (see ticket #6970)
+ this.buttonElement
+ .bind( "mousedown" + this.eventNamespace, function( event ) {
+ if ( options.disabled ) {
+ return;
+ }
+ clickDragged = false;
+ startXPos = event.pageX;
+ startYPos = event.pageY;
+ })
+ .bind( "mouseup" + this.eventNamespace, function( event ) {
+ if ( options.disabled ) {
+ return;
+ }
+ if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
+ clickDragged = true;
+ }
+ });
+ }
+
+ if ( this.type === "checkbox" ) {
+ this.buttonElement.bind( "click" + this.eventNamespace, function() {
+ if ( options.disabled || clickDragged ) {
+ return false;
+ }
+ $( this ).toggleClass( "ui-state-active" );
+ that.buttonElement.attr( "aria-pressed", that.element[0].checked );
+ });
+ } else if ( this.type === "radio" ) {
+ this.buttonElement.bind( "click" + this.eventNamespace, function() {
+ if ( options.disabled || clickDragged ) {
+ return false;
+ }
+ $( this ).addClass( "ui-state-active" );
+ that.buttonElement.attr( "aria-pressed", "true" );
+
+ var radio = that.element[ 0 ];
+ radioGroup( radio )
+ .not( radio )
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ });
+ } else {
+ this.buttonElement
+ .bind( "mousedown" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).addClass( "ui-state-active" );
+ lastActive = this;
+ that.document.one( "mouseup", function() {
+ lastActive = null;
+ });
+ })
+ .bind( "mouseup" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).removeClass( "ui-state-active" );
+ })
+ .bind( "keydown" + this.eventNamespace, function(event) {
+ if ( options.disabled ) {
+ return false;
+ }
+ if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
+ $( this ).addClass( "ui-state-active" );
+ }
+ })
+ .bind( "keyup" + this.eventNamespace, function() {
+ $( this ).removeClass( "ui-state-active" );
+ });
+
+ if ( this.buttonElement.is("a") ) {
+ this.buttonElement.keyup(function(event) {
+ if ( event.keyCode === $.ui.keyCode.SPACE ) {
+ // TODO pass through original event correctly (just as 2nd argument doesn't work)
+ $( this ).click();
+ }
+ });
+ }
+ }
+
+ // TODO: pull out $.Widget's handling for the disabled option into
+ // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
+ // be overridden by individual plugins
+ this._setOption( "disabled", options.disabled );
+ this._resetButton();
+ },
+
+ _determineButtonType: function() {
+ var ancestor, labelSelector, checked;
+
+ if ( this.element.is("[type=checkbox]") ) {
+ this.type = "checkbox";
+ } else if ( this.element.is("[type=radio]") ) {
+ this.type = "radio";
+ } else if ( this.element.is("input") ) {
+ this.type = "input";
+ } else {
+ this.type = "button";
+ }
+
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ // we don't search against the document in case the element
+ // is disconnected from the DOM
+ ancestor = this.element.parents().last();
+ labelSelector = "label[for='" + this.element.attr("id") + "']";
+ this.buttonElement = ancestor.find( labelSelector );
+ if ( !this.buttonElement.length ) {
+ ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
+ this.buttonElement = ancestor.filter( labelSelector );
+ if ( !this.buttonElement.length ) {
+ this.buttonElement = ancestor.find( labelSelector );
+ }
+ }
+ this.element.addClass( "ui-helper-hidden-accessible" );
+
+ checked = this.element.is( ":checked" );
+ if ( checked ) {
+ this.buttonElement.addClass( "ui-state-active" );
+ }
+ this.buttonElement.prop( "aria-pressed", checked );
+ } else {
+ this.buttonElement = this.element;
+ }
+ },
+
+ widget: function() {
+ return this.buttonElement;
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass( "ui-helper-hidden-accessible" );
+ this.buttonElement
+ .removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
+ .removeAttr( "role" )
+ .removeAttr( "aria-pressed" )
+ .html( this.buttonElement.find(".ui-button-text").html() );
+
+ if ( !this.hasTitle ) {
+ this.buttonElement.removeAttr( "title" );
+ }
+ },
+
+ _setOption: function( key, value ) {
+ this._super( key, value );
+ if ( key === "disabled" ) {
+ if ( value ) {
+ this.element.prop( "disabled", true );
+ } else {
+ this.element.prop( "disabled", false );
+ }
+ return;
+ }
+ this._resetButton();
+ },
+
+ refresh: function() {
+ //See #8237 & #8828
+ var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
+
+ if ( isDisabled !== this.options.disabled ) {
+ this._setOption( "disabled", isDisabled );
+ }
+ if ( this.type === "radio" ) {
+ radioGroup( this.element[0] ).each(function() {
+ if ( $( this ).is( ":checked" ) ) {
+ $( this ).button( "widget" )
+ .addClass( "ui-state-active" )
+ .attr( "aria-pressed", "true" );
+ } else {
+ $( this ).button( "widget" )
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ }
+ });
+ } else if ( this.type === "checkbox" ) {
+ if ( this.element.is( ":checked" ) ) {
+ this.buttonElement
+ .addClass( "ui-state-active" )
+ .attr( "aria-pressed", "true" );
+ } else {
+ this.buttonElement
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ }
+ }
+ },
+
+ _resetButton: function() {
+ if ( this.type === "input" ) {
+ if ( this.options.label ) {
+ this.element.val( this.options.label );
+ }
+ return;
+ }
+ var buttonElement = this.buttonElement.removeClass( typeClasses ),
+ buttonText = $( "<span></span>", this.document[0] )
+ .addClass( "ui-button-text" )
+ .html( this.options.label )
+ .appendTo( buttonElement.empty() )
+ .text(),
+ icons = this.options.icons,
+ multipleIcons = icons.primary && icons.secondary,
+ buttonClasses = [];
+
+ if ( icons.primary || icons.secondary ) {
+ if ( this.options.text ) {
+ buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
+ }
+
+ if ( icons.primary ) {
+ buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
+ }
+
+ if ( icons.secondary ) {
+ buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
+ }
+
+ if ( !this.options.text ) {
+ buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
+
+ if ( !this.hasTitle ) {
+ buttonElement.attr( "title", $.trim( buttonText ) );
+ }
+ }
+ } else {
+ buttonClasses.push( "ui-button-text-only" );
+ }
+ buttonElement.addClass( buttonClasses.join( " " ) );
+ }
+});
+
+$.widget( "ui.buttonset", {
+ version: "1.9.2",
+ options: {
+ items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)"
+ },
+
+ _create: function() {
+ this.element.addClass( "ui-buttonset" );
+ },
+
+ _init: function() {
+ this.refresh();
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "disabled" ) {
+ this.buttons.button( "option", key, value );
+ }
+
+ this._super( key, value );
+ },
+
+ refresh: function() {
+ var rtl = this.element.css( "direction" ) === "rtl";
+
+ this.buttons = this.element.find( this.options.items )
+ .filter( ":ui-button" )
+ .button( "refresh" )
+ .end()
+ .not( ":ui-button" )
+ .button()
+ .end()
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
+ .filter( ":first" )
+ .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
+ .end()
+ .filter( ":last" )
+ .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
+ .end()
+ .end();
+ },
+
+ _destroy: function() {
+ this.element.removeClass( "ui-buttonset" );
+ this.buttons
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-corner-left ui-corner-right" )
+ .end()
+ .button( "destroy" );
+ }
+});
+
+}( jQuery ) );
+(function( $, undefined ) {
+
+$.extend($.ui, { datepicker: { version: "1.9.2" } });
+
+var PROP_NAME = 'datepicker';
+var dpuuid = new Date().getTime();
+var instActive;
+
+/* Date picker manager.
+ Use the singleton instance of this class, $.datepicker, to interact with the date picker.
+ Settings for (groups of) date pickers are maintained in an instance object,
+ allowing multiple different settings on the same page. */
+
+function Datepicker() {
+ this.debug = false; // Change this to true to start debugging
+ this._curInst = null; // The current instance in use
+ this._keyEvent = false; // If the last event was a key event
+ this._disabledInputs = []; // List of date picker inputs that have been disabled
+ this._datepickerShowing = false; // True if the popup picker is showing , false if not
+ this._inDialog = false; // True if showing within a "dialog", false if not
+ this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
+ this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
+ this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
+ this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
+ this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
+ this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
+ this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
+ this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
+ this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
+ this.regional = []; // Available regional settings, indexed by language code
+ this.regional[''] = { // Default regional settings
+ closeText: 'Done', // Display text for close link
+ prevText: 'Prev', // Display text for previous month link
+ nextText: 'Next', // Display text for next month link
+ currentText: 'Today', // Display text for current month link
+ monthNames: ['January','February','March','April','May','June',
+ 'July','August','September','October','November','December'], // Names of months for drop-down and formatting
+ monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
+ dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
+ dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
+ dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
+ weekHeader: 'Wk', // Column header for week of the year
+ dateFormat: 'mm/dd/yy', // See format options on parseDate
+ firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
+ isRTL: false, // True if right-to-left language, false if left-to-right
+ showMonthAfterYear: false, // True if the year select precedes month, false for month then year
+ yearSuffix: '' // Additional text to append to the year in the month headers
+ };
+ this._defaults = { // Global defaults for all the date picker instances
+ showOn: 'focus', // 'focus' for popup on focus,
+ // 'button' for trigger button, or 'both' for either
+ showAnim: 'fadeIn', // Name of jQuery animation for popup
+ showOptions: {}, // Options for enhanced animations
+ defaultDate: null, // Used when field is blank: actual date,
+ // +/-number for offset from today, null for today
+ appendText: '', // Display text following the input box, e.g. showing the format
+ buttonText: '...', // Text for trigger button
+ buttonImage: '', // URL for trigger button image
+ buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
+ hideIfNoPrevNext: false, // True to hide next/previous month links
+ // if not applicable, false to just disable them
+ navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
+ gotoCurrent: false, // True if today link goes back to current selection instead
+ changeMonth: false, // True if month can be selected directly, false if only prev/next
+ changeYear: false, // True if year can be selected directly, false if only prev/next
+ yearRange: 'c-10:c+10', // Range of years to display in drop-down,
+ // either relative to today's year (-nn:+nn), relative to currently displayed year
+ // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
+ showOtherMonths: false, // True to show dates in other months, false to leave blank
+ selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
+ showWeek: false, // True to show week of the year, false to not show it
+ calculateWeek: this.iso8601Week, // How to calculate the week of the year,
+ // takes a Date and returns the number of the week for it
+ shortYearCutoff: '+10', // Short year values < this are in the current century,
+ // > this are in the previous century,
+ // string value starting with '+' for current year + value
+ minDate: null, // The earliest selectable date, or null for no limit
+ maxDate: null, // The latest selectable date, or null for no limit
+ duration: 'fast', // Duration of display/closure
+ beforeShowDay: null, // Function that takes a date and returns an array with
+ // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
+ // [2] = cell title (optional), e.g. $.datepicker.noWeekends
+ beforeShow: null, // Function that takes an input field and
+ // returns a set of custom settings for the date picker
+ onSelect: null, // Define a callback function when a date is selected
+ onChangeMonthYear: null, // Define a callback function when the month or year is changed
+ onClose: null, // Define a callback function when the datepicker is closed
+ numberOfMonths: 1, // Number of months to show at a time
+ showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
+ stepMonths: 1, // Number of months to step back/forward
+ stepBigMonths: 12, // Number of months to step back/forward for the big links
+ altField: '', // Selector for an alternate field to store selected dates into
+ altFormat: '', // The date format to use for the alternate field
+ constrainInput: true, // The input is constrained by the current date format
+ showButtonPanel: false, // True to show button panel, false to not show it
+ autoSize: false, // True to size the input for the date format, false to leave as is
+ disabled: false // The initial disabled state
+ };
+ $.extend(this._defaults, this.regional['']);
+ this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'));
+}
+
+$.extend(Datepicker.prototype, {
+ /* Class name added to elements to indicate already configured with a date picker. */
+ markerClassName: 'hasDatepicker',
+
+ //Keep track of the maximum number of rows displayed (see #7043)
+ maxRows: 4,
+
+ /* Debug logging (if enabled). */
+ log: function () {
+ if (this.debug)
+ console.log.apply('', arguments);
+ },
+
+ // TODO rename to "widget" when switching to widget factory
+ _widgetDatepicker: function() {
+ return this.dpDiv;
+ },
+
+ /* Override the default settings for all instances of the date picker.
+ @param settings object - the new settings to use as defaults (anonymous object)
+ @return the manager object */
+ setDefaults: function(settings) {
+ extendRemove(this._defaults, settings || {});
+ return this;
+ },
+
+ /* Attach the date picker to a jQuery selection.
+ @param target element - the target input field or division or span
+ @param settings object - the new settings to use for this date picker instance (anonymous) */
+ _attachDatepicker: function(target, settings) {
+ // check for settings on the control itself - in namespace 'date:'
+ var inlineSettings = null;
+ for (var attrName in this._defaults) {
+ var attrValue = target.getAttribute('date:' + attrName);
+ if (attrValue) {
+ inlineSettings = inlineSettings || {};
+ try {
+ inlineSettings[attrName] = eval(attrValue);
+ } catch (err) {
+ inlineSettings[attrName] = attrValue;
+ }
+ }
+ }
+ var nodeName = target.nodeName.toLowerCase();
+ var inline = (nodeName == 'div' || nodeName == 'span');
+ if (!target.id) {
+ this.uuid += 1;
+ target.id = 'dp' + this.uuid;
+ }
+ var inst = this._newInst($(target), inline);
+ inst.settings = $.extend({}, settings || {}, inlineSettings || {});
+ if (nodeName == 'input') {
+ this._connectDatepicker(target, inst);
+ } else if (inline) {
+ this._inlineDatepicker(target, inst);
+ }
+ },
+
+ /* Create a new instance object. */
+ _newInst: function(target, inline) {
+ var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
+ return {id: id, input: target, // associated target
+ selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
+ drawMonth: 0, drawYear: 0, // month being drawn
+ inline: inline, // is datepicker inline or not
+ dpDiv: (!inline ? this.dpDiv : // presentation div
+ bindHover($('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')))};
+ },
+
+ /* Attach the date picker to an input field. */
+ _connectDatepicker: function(target, inst) {
+ var input = $(target);
+ inst.append = $([]);
+ inst.trigger = $([]);
+ if (input.hasClass(this.markerClassName))
+ return;
+ this._attachments(input, inst);
+ input.addClass(this.markerClassName).keydown(this._doKeyDown).
+ keypress(this._doKeyPress).keyup(this._doKeyUp).
+ bind("setData.datepicker", function(event, key, value) {
+ inst.settings[key] = value;
+ }).bind("getData.datepicker", function(event, key) {
+ return this._get(inst, key);
+ });
+ this._autoSize(inst);
+ $.data(target, PROP_NAME, inst);
+ //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
+ if( inst.settings.disabled ) {
+ this._disableDatepicker( target );
+ }
+ },
+
+ /* Make attachments based on settings. */
+ _attachments: function(input, inst) {
+ var appendText = this._get(inst, 'appendText');
+ var isRTL = this._get(inst, 'isRTL');
+ if (inst.append)
+ inst.append.remove();
+ if (appendText) {
+ inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
+ input[isRTL ? 'before' : 'after'](inst.append);
+ }
+ input.unbind('focus', this._showDatepicker);
+ if (inst.trigger)
+ inst.trigger.remove();
+ var showOn = this._get(inst, 'showOn');
+ if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
+ input.focus(this._showDatepicker);
+ if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
+ var buttonText = this._get(inst, 'buttonText');
+ var buttonImage = this._get(inst, 'buttonImage');
+ inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
+ $('<img/>').addClass(this._triggerClass).
+ attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
+ $('<button type="button"></button>').addClass(this._triggerClass).
+ html(buttonImage == '' ? buttonText : $('<img/>').attr(
+ { src:buttonImage, alt:buttonText, title:buttonText })));
+ input[isRTL ? 'before' : 'after'](inst.trigger);
+ inst.trigger.click(function() {
+ if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
+ $.datepicker._hideDatepicker();
+ else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) {
+ $.datepicker._hideDatepicker();
+ $.datepicker._showDatepicker(input[0]);
+ } else
+ $.datepicker._showDatepicker(input[0]);
+ return false;
+ });
+ }
+ },
+
+ /* Apply the maximum length for the date format. */
+ _autoSize: function(inst) {
+ if (this._get(inst, 'autoSize') && !inst.inline) {
+ var date = new Date(2009, 12 - 1, 20); // Ensure double digits
+ var dateFormat = this._get(inst, 'dateFormat');
+ if (dateFormat.match(/[DM]/)) {
+ var findMax = function(names) {
+ var max = 0;
+ var maxI = 0;
+ for (var i = 0; i < names.length; i++) {
+ if (names[i].length > max) {
+ max = names[i].length;
+ maxI = i;
+ }
+ }
+ return maxI;
+ };
+ date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
+ 'monthNames' : 'monthNamesShort'))));
+ date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
+ 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
+ }
+ inst.input.attr('size', this._formatDate(inst, date).length);
+ }
+ },
+
+ /* Attach an inline date picker to a div. */
+ _inlineDatepicker: function(target, inst) {
+ var divSpan = $(target);
+ if (divSpan.hasClass(this.markerClassName))
+ return;
+ divSpan.addClass(this.markerClassName).append(inst.dpDiv).
+ bind("setData.datepicker", function(event, key, value){
+ inst.settings[key] = value;
+ }).bind("getData.datepicker", function(event, key){
+ return this._get(inst, key);
+ });
+ $.data(target, PROP_NAME, inst);
+ this._setDate(inst, this._getDefaultDate(inst), true);
+ this._updateDatepicker(inst);
+ this._updateAlternate(inst);
+ //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
+ if( inst.settings.disabled ) {
+ this._disableDatepicker( target );
+ }
+ // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
+ // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
+ inst.dpDiv.css( "display", "block" );
+ },
+
+ /* Pop-up the date picker in a "dialog" box.
+ @param input element - ignored
+ @param date string or Date - the initial date to display
+ @param onSelect function - the function to call when a date is selected
+ @param settings object - update the dialog date picker instance's settings (anonymous object)
+ @param pos int[2] - coordinates for the dialog's position within the screen or
+ event - with x/y coordinates or
+ leave empty for default (screen centre)
+ @return the manager object */
+ _dialogDatepicker: function(input, date, onSelect, settings, pos) {
+ var inst = this._dialogInst; // internal instance
+ if (!inst) {
+ this.uuid += 1;
+ var id = 'dp' + this.uuid;
+ this._dialogInput = $('<input type="text" id="' + id +
+ '" style="position: absolute; top: -100px; width: 0px;"/>');
+ this._dialogInput.keydown(this._doKeyDown);
+ $('body').append(this._dialogInput);
+ inst = this._dialogInst = this._newInst(this._dialogInput, false);
+ inst.settings = {};
+ $.data(this._dialogInput[0], PROP_NAME, inst);
+ }
+ extendRemove(inst.settings, settings || {});
+ date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
+ this._dialogInput.val(date);
+
+ this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
+ if (!this._pos) {
+ var browserWidth = document.documentElement.clientWidth;
+ var browserHeight = document.documentElement.clientHeight;
+ var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
+ var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+ this._pos = // should use actual width/height below
+ [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
+ }
+
+ // move input on screen for focus, but hidden behind dialog
+ this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
+ inst.settings.onSelect = onSelect;
+ this._inDialog = true;
+ this.dpDiv.addClass(this._dialogClass);
+ this._showDatepicker(this._dialogInput[0]);
+ if ($.blockUI)
+ $.blockUI(this.dpDiv);
+ $.data(this._dialogInput[0], PROP_NAME, inst);
+ return this;
+ },
+
+ /* Detach a datepicker from its control.
+ @param target element - the target input field or division or span */
+ _destroyDatepicker: function(target) {
+ var $target = $(target);
+ var inst = $.data(target, PROP_NAME);
+ if (!$target.hasClass(this.markerClassName)) {
+ return;
+ }
+ var nodeName = target.nodeName.toLowerCase();
+ $.removeData(target, PROP_NAME);
+ if (nodeName == 'input') {
+ inst.append.remove();
+ inst.trigger.remove();
+ $target.removeClass(this.markerClassName).
+ unbind('focus', this._showDatepicker).
+ unbind('keydown', this._doKeyDown).
+ unbind('keypress', this._doKeyPress).
+ unbind('keyup', this._doKeyUp);
+ } else if (nodeName == 'div' || nodeName == 'span')
+ $target.removeClass(this.markerClassName).empty();
+ },
+
+ /* Enable the date picker to a jQuery selection.
+ @param target element - the target input field or division or span */
+ _enableDatepicker: function(target) {
+ var $target = $(target);
+ var inst = $.data(target, PROP_NAME);
+ if (!$target.hasClass(this.markerClassName)) {
+ return;
+ }
+ var nodeName = target.nodeName.toLowerCase();
+ if (nodeName == 'input') {
+ target.disabled = false;
+ inst.trigger.filter('button').
+ each(function() { this.disabled = false; }).end().
+ filter('img').css({opacity: '1.0', cursor: ''});
+ }
+ else if (nodeName == 'div' || nodeName == 'span') {
+ var inline = $target.children('.' + this._inlineClass);
+ inline.children().removeClass('ui-state-disabled');
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
+ prop("disabled", false);
+ }
+ this._disabledInputs = $.map(this._disabledInputs,
+ function(value) { return (value == target ? null : value); }); // delete entry
+ },
+
+ /* Disable the date picker to a jQuery selection.
+ @param target element - the target input field or division or span */
+ _disableDatepicker: function(target) {
+ var $target = $(target);
+ var inst = $.data(target, PROP_NAME);
+ if (!$target.hasClass(this.markerClassName)) {
+ return;
+ }
+ var nodeName = target.nodeName.toLowerCase();
+ if (nodeName == 'input') {
+ target.disabled = true;
+ inst.trigger.filter('button').
+ each(function() { this.disabled = true; }).end().
+ filter('img').css({opacity: '0.5', cursor: 'default'});
+ }
+ else if (nodeName == 'div' || nodeName == 'span') {
+ var inline = $target.children('.' + this._inlineClass);
+ inline.children().addClass('ui-state-disabled');
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
+ prop("disabled", true);
+ }
+ this._disabledInputs = $.map(this._disabledInputs,
+ function(value) { return (value == target ? null : value); }); // delete entry
+ this._disabledInputs[this._disabledInputs.length] = target;
+ },
+
+ /* Is the first field in a jQuery collection disabled as a datepicker?
+ @param target element - the target input field or division or span
+ @return boolean - true if disabled, false if enabled */
+ _isDisabledDatepicker: function(target) {
+ if (!target) {
+ return false;
+ }
+ for (var i = 0; i < this._disabledInputs.length; i++) {
+ if (this._disabledInputs[i] == target)
+ return true;
+ }
+ return false;
+ },
+
+ /* Retrieve the instance data for the target control.
+ @param target element - the target input field or division or span
+ @return object - the associated instance data
+ @throws error if a jQuery problem getting data */
+ _getInst: function(target) {
+ try {
+ return $.data(target, PROP_NAME);
+ }
+ catch (err) {
+ throw 'Missing instance data for this datepicker';
+ }
+ },
+
+ /* Update or retrieve the settings for a date picker attached to an input field or division.
+ @param target element - the target input field or division or span
+ @param name object - the new settings to update or
+ string - the name of the setting to change or retrieve,
+ when retrieving also 'all' for all instance settings or
+ 'defaults' for all global defaults
+ @param value any - the new value for the setting
+ (omit if above is an object or to retrieve a value) */
+ _optionDatepicker: function(target, name, value) {
+ var inst = this._getInst(target);
+ if (arguments.length == 2 && typeof name == 'string') {
+ return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
+ (inst ? (name == 'all' ? $.extend({}, inst.settings) :
+ this._get(inst, name)) : null));
+ }
+ var settings = name || {};
+ if (typeof name == 'string') {
+ settings = {};
+ settings[name] = value;
+ }
+ if (inst) {
+ if (this._curInst == inst) {
+ this._hideDatepicker();
+ }
+ var date = this._getDateDatepicker(target, true);
+ var minDate = this._getMinMaxDate(inst, 'min');
+ var maxDate = this._getMinMaxDate(inst, 'max');
+ extendRemove(inst.settings, settings);
+ // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
+ if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)
+ inst.settings.minDate = this._formatDate(inst, minDate);
+ if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)
+ inst.settings.maxDate = this._formatDate(inst, maxDate);
+ this._attachments($(target), inst);
+ this._autoSize(inst);
+ this._setDate(inst, date);
+ this._updateAlternate(inst);
+ this._updateDatepicker(inst);
+ }
+ },
+
+ // change method deprecated
+ _changeDatepicker: function(target, name, value) {
+ this._optionDatepicker(target, name, value);
+ },
+
+ /* Redraw the date picker attached to an input field or division.
+ @param target element - the target input field or division or span */
+ _refreshDatepicker: function(target) {
+ var inst = this._getInst(target);
+ if (inst) {
+ this._updateDatepicker(inst);
+ }
+ },
+
+ /* Set the dates for a jQuery selection.
+ @param target element - the target input field or division or span
+ @param date Date - the new date */
+ _setDateDatepicker: function(target, date) {
+ var inst = this._getInst(target);
+ if (inst) {
+ this._setDate(inst, date);
+ this._updateDatepicker(inst);
+ this._updateAlternate(inst);
+ }
+ },
+
+ /* Get the date(s) for the first entry in a jQuery selection.
+ @param target element - the target input field or division or span
+ @param noDefault boolean - true if no default date is to be used
+ @return Date - the current date */
+ _getDateDatepicker: function(target, noDefault) {
+ var inst = this._getInst(target);
+ if (inst && !inst.inline)
+ this._setDateFromField(inst, noDefault);
+ return (inst ? this._getDate(inst) : null);
+ },
+
+ /* Handle keystrokes. */
+ _doKeyDown: function(event) {
+ var inst = $.datepicker._getInst(event.target);
+ var handled = true;
+ var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
+ inst._keyEvent = true;
+ if ($.datepicker._datepickerShowing)
+ switch (event.keyCode) {
+ case 9: $.datepicker._hideDatepicker();
+ handled = false;
+ break; // hide on tab out
+ case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
+ $.datepicker._currentClass + ')', inst.dpDiv);
+ if (sel[0])
+ $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
+ var onSelect = $.datepicker._get(inst, 'onSelect');
+ if (onSelect) {
+ var dateStr = $.datepicker._formatDate(inst);
+
+ // trigger custom callback
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
+ }
+ else
+ $.datepicker._hideDatepicker();
+ return false; // don't submit the form
+ break; // select the value on enter
+ case 27: $.datepicker._hideDatepicker();
+ break; // hide on escape
+ case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ -$.datepicker._get(inst, 'stepBigMonths') :
+ -$.datepicker._get(inst, 'stepMonths')), 'M');
+ break; // previous month/year on page up/+ ctrl
+ case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ +$.datepicker._get(inst, 'stepBigMonths') :
+ +$.datepicker._get(inst, 'stepMonths')), 'M');
+ break; // next month/year on page down/+ ctrl
+ case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
+ handled = event.ctrlKey || event.metaKey;
+ break; // clear on ctrl or command +end
+ case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
+ handled = event.ctrlKey || event.metaKey;
+ break; // current on ctrl or command +home
+ case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
+ handled = event.ctrlKey || event.metaKey;
+ // -1 day on ctrl or command +left
+ if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ -$.datepicker._get(inst, 'stepBigMonths') :
+ -$.datepicker._get(inst, 'stepMonths')), 'M');
+ // next month/year on alt +left on Mac
+ break;
+ case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
+ handled = event.ctrlKey || event.metaKey;
+ break; // -1 week on ctrl or command +up
+ case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
+ handled = event.ctrlKey || event.metaKey;
+ // +1 day on ctrl or command +right
+ if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ +$.datepicker._get(inst, 'stepBigMonths') :
+ +$.datepicker._get(inst, 'stepMonths')), 'M');
+ // next month/year on alt +right
+ break;
+ case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
+ handled = event.ctrlKey || event.metaKey;
+ break; // +1 week on ctrl or command +down
+ default: handled = false;
+ }
+ else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
+ $.datepicker._showDatepicker(this);
+ else {
+ handled = false;
+ }
+ if (handled) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ },
+
+ /* Filter entered characters - based on date format. */
+ _doKeyPress: function(event) {
+ var inst = $.datepicker._getInst(event.target);
+ if ($.datepicker._get(inst, 'constrainInput')) {
+ var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
+ var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
+ return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
+ }
+ },
+
+ /* Synchronise manual entry and field/alternate field. */
+ _doKeyUp: function(event) {
+ var inst = $.datepicker._getInst(event.target);
+ if (inst.input.val() != inst.lastVal) {
+ try {
+ var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
+ (inst.input ? inst.input.val() : null),
+ $.datepicker._getFormatConfig(inst));
+ if (date) { // only if valid
+ $.datepicker._setDateFromField(inst);
+ $.datepicker._updateAlternate(inst);
+ $.datepicker._updateDatepicker(inst);
+ }
+ }
+ catch (err) {
+ $.datepicker.log(err);
+ }
+ }
+ return true;
+ },
+
+ /* Pop-up the date picker for a given input field.
+ If false returned from beforeShow event handler do not show.
+ @param input element - the input field attached to the date picker or
+ event - if triggered by focus */
+ _showDatepicker: function(input) {
+ input = input.target || input;
+ if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
+ input = $('input', input.parentNode)[0];
+ if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
+ return;
+ var inst = $.datepicker._getInst(input);
+ if ($.datepicker._curInst && $.datepicker._curInst != inst) {
+ $.datepicker._curInst.dpDiv.stop(true, true);
+ if ( inst && $.datepicker._datepickerShowing ) {
+ $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
+ }
+ }
+ var beforeShow = $.datepicker._get(inst, 'beforeShow');
+ var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
+ if(beforeShowSettings === false){
+ //false
+ return;
+ }
+ extendRemove(inst.settings, beforeShowSettings);
+ inst.lastVal = null;
+ $.datepicker._lastInput = input;
+ $.datepicker._setDateFromField(inst);
+ if ($.datepicker._inDialog) // hide cursor
+ input.value = '';
+ if (!$.datepicker._pos) { // position below input
+ $.datepicker._pos = $.datepicker._findPos(input);
+ $.datepicker._pos[1] += input.offsetHeight; // add the height
+ }
+ var isFixed = false;
+ $(input).parents().each(function() {
+ isFixed |= $(this).css('position') == 'fixed';
+ return !isFixed;
+ });
+ var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
+ $.datepicker._pos = null;
+ //to avoid flashes on Firefox
+ inst.dpDiv.empty();
+ // determine sizing offscreen
+ inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
+ $.datepicker._updateDatepicker(inst);
+ // fix width for dynamic number of date pickers
+ // and adjust position before showing
+ offset = $.datepicker._checkOffset(inst, offset, isFixed);
+ inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
+ 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
+ left: offset.left + 'px', top: offset.top + 'px'});
+ if (!inst.inline) {
+ var showAnim = $.datepicker._get(inst, 'showAnim');
+ var duration = $.datepicker._get(inst, 'duration');
+ var postProcess = function() {
+ var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
+ if( !! cover.length ){
+ var borders = $.datepicker._getBorders(inst.dpDiv);
+ cover.css({left: -borders[0], top: -borders[1],
+ width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
+ }
+ };
+ inst.dpDiv.zIndex($(input).zIndex()+1);
+ $.datepicker._datepickerShowing = true;
+
+ // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
+ if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) )
+ inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
+ else
+ inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
+ if (!showAnim || !duration)
+ postProcess();
+ if (inst.input.is(':visible') && !inst.input.is(':disabled'))
+ inst.input.focus();
+ $.datepicker._curInst = inst;
+ }
+ },
+
+ /* Generate the date picker content. */
+ _updateDatepicker: function(inst) {
+ this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
+ var borders = $.datepicker._getBorders(inst.dpDiv);
+ instActive = inst; // for delegate hover events
+ inst.dpDiv.empty().append(this._generateHTML(inst));
+ this._attachHandlers(inst);
+ var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
+ if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
+ cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
+ }
+ inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover();
+ var numMonths = this._getNumberOfMonths(inst);
+ var cols = numMonths[1];
+ var width = 17;
+ inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
+ if (cols > 1)
+ inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
+ inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
+ 'Class']('ui-datepicker-multi');
+ inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
+ 'Class']('ui-datepicker-rtl');
+ if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
+ // #6694 - don't focus the input if it's already focused
+ // this breaks the change event in IE
+ inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
+ inst.input.focus();
+ // deffered render of the years select (to avoid flashes on Firefox)
+ if( inst.yearshtml ){
+ var origyearshtml = inst.yearshtml;
+ setTimeout(function(){
+ //assure that inst.yearshtml didn't change.
+ if( origyearshtml === inst.yearshtml && inst.yearshtml ){
+ inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
+ }
+ origyearshtml = inst.yearshtml = null;
+ }, 0);
+ }
+ },
+
+ /* Retrieve the size of left and top borders for an element.
+ @param elem (jQuery object) the element of interest
+ @return (number[2]) the left and top borders */
+ _getBorders: function(elem) {
+ var convert = function(value) {
+ return {thin: 1, medium: 2, thick: 3}[value] || value;
+ };
+ return [parseFloat(convert(elem.css('border-left-width'))),
+ parseFloat(convert(elem.css('border-top-width')))];
+ },
+
+ /* Check positioning to remain on screen. */
+ _checkOffset: function(inst, offset, isFixed) {
+ var dpWidth = inst.dpDiv.outerWidth();
+ var dpHeight = inst.dpDiv.outerHeight();
+ var inputWidth = inst.input ? inst.input.outerWidth() : 0;
+ var inputHeight = inst.input ? inst.input.outerHeight() : 0;
+ var viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft());
+ var viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
+
+ offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
+ offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
+ offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
+
+ // now check if datepicker is showing outside window viewport - move to a better place if so.
+ offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
+ Math.abs(offset.left + dpWidth - viewWidth) : 0);
+ offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
+ Math.abs(dpHeight + inputHeight) : 0);
+
+ return offset;
+ },
+
+ /* Find an object's position on the screen. */
+ _findPos: function(obj) {
+ var inst = this._getInst(obj);
+ var isRTL = this._get(inst, 'isRTL');
+ while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {
+ obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
+ }
+ var position = $(obj).offset();
+ return [position.left, position.top];
+ },
+
+ /* Hide the date picker from view.
+ @param input element - the input field attached to the date picker */
+ _hideDatepicker: function(input) {
+ var inst = this._curInst;
+ if (!inst || (input && inst != $.data(input, PROP_NAME)))
+ return;
+ if (this._datepickerShowing) {
+ var showAnim = this._get(inst, 'showAnim');
+ var duration = this._get(inst, 'duration');
+ var postProcess = function() {
+ $.datepicker._tidyDialog(inst);
+ };
+
+ // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
+ if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) )
+ inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
+ else
+ inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
+ (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
+ if (!showAnim)
+ postProcess();
+ this._datepickerShowing = false;
+ var onClose = this._get(inst, 'onClose');
+ if (onClose)
+ onClose.apply((inst.input ? inst.input[0] : null),
+ [(inst.input ? inst.input.val() : ''), inst]);
+ this._lastInput = null;
+ if (this._inDialog) {
+ this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
+ if ($.blockUI) {
+ $.unblockUI();
+ $('body').append(this.dpDiv);
+ }
+ }
+ this._inDialog = false;
+ }
+ },
+
+ /* Tidy up after a dialog display. */
+ _tidyDialog: function(inst) {
+ inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
+ },
+
+ /* Close date picker if clicked elsewhere. */
+ _checkExternalClick: function(event) {
+ if (!$.datepicker._curInst)
+ return;
+
+ var $target = $(event.target),
+ inst = $.datepicker._getInst($target[0]);
+
+ if ( ( ( $target[0].id != $.datepicker._mainDivId &&
+ $target.parents('#' + $.datepicker._mainDivId).length == 0 &&
+ !$target.hasClass($.datepicker.markerClassName) &&
+ !$target.closest("." + $.datepicker._triggerClass).length &&
+ $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
+ ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) )
+ $.datepicker._hideDatepicker();
+ },
+
+ /* Adjust one of the date sub-fields. */
+ _adjustDate: function(id, offset, period) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ if (this._isDisabledDatepicker(target[0])) {
+ return;
+ }
+ this._adjustInstDate(inst, offset +
+ (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
+ period);
+ this._updateDatepicker(inst);
+ },
+
+ /* Action for current link. */
+ _gotoToday: function(id) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
+ inst.selectedDay = inst.currentDay;
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth;
+ inst.drawYear = inst.selectedYear = inst.currentYear;
+ }
+ else {
+ var date = new Date();
+ inst.selectedDay = date.getDate();
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
+ inst.drawYear = inst.selectedYear = date.getFullYear();
+ }
+ this._notifyChange(inst);
+ this._adjustDate(target);
+ },
+
+ /* Action for selecting a new month/year. */
+ _selectMonthYear: function(id, select, period) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
+ inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
+ parseInt(select.options[select.selectedIndex].value,10);
+ this._notifyChange(inst);
+ this._adjustDate(target);
+ },
+
+ /* Action for selecting a day. */
+ _selectDay: function(id, month, year, td) {
+ var target = $(id);
+ if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
+ return;
+ }
+ var inst = this._getInst(target[0]);
+ inst.selectedDay = inst.currentDay = $('a', td).html();
+ inst.selectedMonth = inst.currentMonth = month;
+ inst.selectedYear = inst.currentYear = year;
+ this._selectDate(id, this._formatDate(inst,
+ inst.currentDay, inst.currentMonth, inst.currentYear));
+ },
+
+ /* Erase the input field and hide the date picker. */
+ _clearDate: function(id) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ this._selectDate(target, '');
+ },
+
+ /* Update the input field with the selected date. */
+ _selectDate: function(id, dateStr) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
+ if (inst.input)
+ inst.input.val(dateStr);
+ this._updateAlternate(inst);
+ var onSelect = this._get(inst, 'onSelect');
+ if (onSelect)
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
+ else if (inst.input)
+ inst.input.trigger('change'); // fire the change event
+ if (inst.inline)
+ this._updateDatepicker(inst);
+ else {
+ this._hideDatepicker();
+ this._lastInput = inst.input[0];
+ if (typeof(inst.input[0]) != 'object')
+ inst.input.focus(); // restore focus
+ this._lastInput = null;
+ }
+ },
+
+ /* Update any alternate field to synchronise with the main field. */
+ _updateAlternate: function(inst) {
+ var altField = this._get(inst, 'altField');
+ if (altField) { // update alternate field too
+ var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
+ var date = this._getDate(inst);
+ var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
+ $(altField).each(function() { $(this).val(dateStr); });
+ }
+ },
+
+ /* Set as beforeShowDay function to prevent selection of weekends.
+ @param date Date - the date to customise
+ @return [boolean, string] - is this date selectable?, what is its CSS class? */
+ noWeekends: function(date) {
+ var day = date.getDay();
+ return [(day > 0 && day < 6), ''];
+ },
+
+ /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
+ @param date Date - the date to get the week for
+ @return number - the number of the week within the year that contains this date */
+ iso8601Week: function(date) {
+ var checkDate = new Date(date.getTime());
+ // Find Thursday of this week starting on Monday
+ checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
+ var time = checkDate.getTime();
+ checkDate.setMonth(0); // Compare with Jan 1
+ checkDate.setDate(1);
+ return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
+ },
+
+ /* Parse a string value into a date object.
+ See formatDate below for the possible formats.
+
+ @param format string - the expected format of the date
+ @param value string - the date in the above format
+ @param settings Object - attributes include:
+ shortYearCutoff number - the cutoff year for determining the century (optional)
+ dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
+ dayNames string[7] - names of the days from Sunday (optional)
+ monthNamesShort string[12] - abbreviated names of the months (optional)
+ monthNames string[12] - names of the months (optional)
+ @return Date - the extracted date value or null if value is blank */
+ parseDate: function (format, value, settings) {
+ if (format == null || value == null)
+ throw 'Invalid arguments';
+ value = (typeof value == 'object' ? value.toString() : value + '');
+ if (value == '')
+ return null;
+ var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
+ shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
+ var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
+ var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
+ var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
+ var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
+ var year = -1;
+ var month = -1;
+ var day = -1;
+ var doy = -1;
+ var literal = false;
+ // Check whether a format character is doubled
+ var lookAhead = function(match) {
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+ if (matches)
+ iFormat++;
+ return matches;
+ };
+ // Extract a number from the string value
+ var getNumber = function(match) {
+ var isDoubled = lookAhead(match);
+ var size = (match == '@' ? 14 : (match == '!' ? 20 :
+ (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2))));
+ var digits = new RegExp('^\\d{1,' + size + '}');
+ var num = value.substring(iValue).match(digits);
+ if (!num)
+ throw 'Missing number at position ' + iValue;
+ iValue += num[0].length;
+ return parseInt(num[0], 10);
+ };
+ // Extract a name from the string value and convert to an index
+ var getName = function(match, shortNames, longNames) {
+ var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
+ return [ [k, v] ];
+ }).sort(function (a, b) {
+ return -(a[1].length - b[1].length);
+ });
+ var index = -1;
+ $.each(names, function (i, pair) {
+ var name = pair[1];
+ if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) {
+ index = pair[0];
+ iValue += name.length;
+ return false;
+ }
+ });
+ if (index != -1)
+ return index + 1;
+ else
+ throw 'Unknown name at position ' + iValue;
+ };
+ // Confirm that a literal character matches the string value
+ var checkLiteral = function() {
+ if (value.charAt(iValue) != format.charAt(iFormat))
+ throw 'Unexpected literal at position ' + iValue;
+ iValue++;
+ };
+ var iValue = 0;
+ for (var iFormat = 0; iFormat < format.length; iFormat++) {
+ if (literal)
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+ literal = false;
+ else
+ checkLiteral();
+ else
+ switch (format.charAt(iFormat)) {
+ case 'd':
+ day = getNumber('d');
+ break;
+ case 'D':
+ getName('D', dayNamesShort, dayNames);
+ break;
+ case 'o':
+ doy = getNumber('o');
+ break;
+ case 'm':
+ month = getNumber('m');
+ break;
+ case 'M':
+ month = getName('M', monthNamesShort, monthNames);
+ break;
+ case 'y':
+ year = getNumber('y');
+ break;
+ case '@':
+ var date = new Date(getNumber('@'));
+ year = date.getFullYear();
+ month = date.getMonth() + 1;
+ day = date.getDate();
+ break;
+ case '!':
+ var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
+ year = date.getFullYear();
+ month = date.getMonth() + 1;
+ day = date.getDate();
+ break;
+ case "'":
+ if (lookAhead("'"))
+ checkLiteral();
+ else
+ literal = true;
+ break;
+ default:
+ checkLiteral();
+ }
+ }
+ if (iValue < value.length){
+ var extra = value.substr(iValue);
+ if (!/^\s+/.test(extra)) {
+ throw "Extra/unparsed characters found in date: " + extra;
+ }
+ }
+ if (year == -1)
+ year = new Date().getFullYear();
+ else if (year < 100)
+ year += new Date().getFullYear() - new Date().getFullYear() % 100 +
+ (year <= shortYearCutoff ? 0 : -100);
+ if (doy > -1) {
+ month = 1;
+ day = doy;
+ do {
+ var dim = this._getDaysInMonth(year, month - 1);
+ if (day <= dim)
+ break;
+ month++;
+ day -= dim;
+ } while (true);
+ }
+ var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
+ if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
+ throw 'Invalid date'; // E.g. 31/02/00
+ return date;
+ },
+
+ /* Standard date formats. */
+ ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
+ COOKIE: 'D, dd M yy',
+ ISO_8601: 'yy-mm-dd',
+ RFC_822: 'D, d M y',
+ RFC_850: 'DD, dd-M-y',
+ RFC_1036: 'D, d M y',
+ RFC_1123: 'D, d M yy',
+ RFC_2822: 'D, d M yy',
+ RSS: 'D, d M y', // RFC 822
+ TICKS: '!',
+ TIMESTAMP: '@',
+ W3C: 'yy-mm-dd', // ISO 8601
+
+ _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
+ Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
+
+ /* Format a date object into a string value.
+ The format can be combinations of the following:
+ d - day of month (no leading zero)
+ dd - day of month (two digit)
+ o - day of year (no leading zeros)
+ oo - day of year (three digit)
+ D - day name short
+ DD - day name long
+ m - month of year (no leading zero)
+ mm - month of year (two digit)
+ M - month name short
+ MM - month name long
+ y - year (two digit)
+ yy - year (four digit)
+ @ - Unix timestamp (ms since 01/01/1970)
+ ! - Windows ticks (100ns since 01/01/0001)
+ '...' - literal text
+ '' - single quote
+
+ @param format string - the desired format of the date
+ @param date Date - the date value to format
+ @param settings Object - attributes include:
+ dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
+ dayNames string[7] - names of the days from Sunday (optional)
+ monthNamesShort string[12] - abbreviated names of the months (optional)
+ monthNames string[12] - names of the months (optional)
+ @return string - the date in the above format */
+ formatDate: function (format, date, settings) {
+ if (!date)
+ return '';
+ var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
+ var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
+ var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
+ var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
+ // Check whether a format character is doubled
+ var lookAhead = function(match) {
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+ if (matches)
+ iFormat++;
+ return matches;
+ };
+ // Format a number, with leading zero if necessary
+ var formatNumber = function(match, value, len) {
+ var num = '' + value;
+ if (lookAhead(match))
+ while (num.length < len)
+ num = '0' + num;
+ return num;
+ };
+ // Format a name, short or long as requested
+ var formatName = function(match, value, shortNames, longNames) {
+ return (lookAhead(match) ? longNames[value] : shortNames[value]);
+ };
+ var output = '';
+ var literal = false;
+ if (date)
+ for (var iFormat = 0; iFormat < format.length; iFormat++) {
+ if (literal)
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+ literal = false;
+ else
+ output += format.charAt(iFormat);
+ else
+ switch (format.charAt(iFormat)) {
+ case 'd':
+ output += formatNumber('d', date.getDate(), 2);
+ break;
+ case 'D':
+ output += formatName('D', date.getDay(), dayNamesShort, dayNames);
+ break;
+ case 'o':
+ output += formatNumber('o',
+ Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
+ break;
+ case 'm':
+ output += formatNumber('m', date.getMonth() + 1, 2);
+ break;
+ case 'M':
+ output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
+ break;
+ case 'y':
+ output += (lookAhead('y') ? date.getFullYear() :
+ (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
+ break;
+ case '@':
+ output += date.getTime();
+ break;
+ case '!':
+ output += date.getTime() * 10000 + this._ticksTo1970;
+ break;
+ case "'":
+ if (lookAhead("'"))
+ output += "'";
+ else
+ literal = true;
+ break;
+ default:
+ output += format.charAt(iFormat);
+ }
+ }
+ return output;
+ },
+
+ /* Extract all possible characters from the date format. */
+ _possibleChars: function (format) {
+ var chars = '';
+ var literal = false;
+ // Check whether a format character is doubled
+ var lookAhead = function(match) {
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+ if (matches)
+ iFormat++;
+ return matches;
+ };
+ for (var iFormat = 0; iFormat < format.length; iFormat++)
+ if (literal)
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+ literal = false;
+ else
+ chars += format.charAt(iFormat);
+ else
+ switch (format.charAt(iFormat)) {
+ case 'd': case 'm': case 'y': case '@':
+ chars += '0123456789';
+ break;
+ case 'D': case 'M':
+ return null; // Accept anything
+ case "'":
+ if (lookAhead("'"))
+ chars += "'";
+ else
+ literal = true;
+ break;
+ default:
+ chars += format.charAt(iFormat);
+ }
+ return chars;
+ },
+
+ /* Get a setting value, defaulting if necessary. */
+ _get: function(inst, name) {
+ return inst.settings[name] !== undefined ?
+ inst.settings[name] : this._defaults[name];
+ },
+
+ /* Parse existing date and initialise date picker. */
+ _setDateFromField: function(inst, noDefault) {
+ if (inst.input.val() == inst.lastVal) {
+ return;
+ }
+ var dateFormat = this._get(inst, 'dateFormat');
+ var dates = inst.lastVal = inst.input ? inst.input.val() : null;
+ var date, defaultDate;
+ date = defaultDate = this._getDefaultDate(inst);
+ var settings = this._getFormatConfig(inst);
+ try {
+ date = this.parseDate(dateFormat, dates, settings) || defaultDate;
+ } catch (event) {
+ this.log(event);
+ dates = (noDefault ? '' : dates);
+ }
+ inst.selectedDay = date.getDate();
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
+ inst.drawYear = inst.selectedYear = date.getFullYear();
+ inst.currentDay = (dates ? date.getDate() : 0);
+ inst.currentMonth = (dates ? date.getMonth() : 0);
+ inst.currentYear = (dates ? date.getFullYear() : 0);
+ this._adjustInstDate(inst);
+ },
+
+ /* Retrieve the default date shown on opening. */
+ _getDefaultDate: function(inst) {
+ return this._restrictMinMax(inst,
+ this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
+ },
+
+ /* A date may be specified as an exact value or a relative one. */
+ _determineDate: function(inst, date, defaultDate) {
+ var offsetNumeric = function(offset) {
+ var date = new Date();
+ date.setDate(date.getDate() + offset);
+ return date;
+ };
+ var offsetString = function(offset) {
+ try {
+ return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
+ offset, $.datepicker._getFormatConfig(inst));
+ }
+ catch (e) {
+ // Ignore
+ }
+ var date = (offset.toLowerCase().match(/^c/) ?
+ $.datepicker._getDate(inst) : null) || new Date();
+ var year = date.getFullYear();
+ var month = date.getMonth();
+ var day = date.getDate();
+ var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
+ var matches = pattern.exec(offset);
+ while (matches) {
+ switch (matches[2] || 'd') {
+ case 'd' : case 'D' :
+ day += parseInt(matches[1],10); break;
+ case 'w' : case 'W' :
+ day += parseInt(matches[1],10) * 7; break;
+ case 'm' : case 'M' :
+ month += parseInt(matches[1],10);
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
+ break;
+ case 'y': case 'Y' :
+ year += parseInt(matches[1],10);
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
+ break;
+ }
+ matches = pattern.exec(offset);
+ }
+ return new Date(year, month, day);
+ };
+ var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) :
+ (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
+ newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate);
+ if (newDate) {
+ newDate.setHours(0);
+ newDate.setMinutes(0);
+ newDate.setSeconds(0);
+ newDate.setMilliseconds(0);
+ }
+ return this._daylightSavingAdjust(newDate);
+ },
+
+ /* Handle switch to/from daylight saving.
+ Hours may be non-zero on daylight saving cut-over:
+ > 12 when midnight changeover, but then cannot generate
+ midnight datetime, so jump to 1AM, otherwise reset.
+ @param date (Date) the date to check
+ @return (Date) the corrected date */
+ _daylightSavingAdjust: function(date) {
+ if (!date) return null;
+ date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
+ return date;
+ },
+
+ /* Set the date(s) directly. */
+ _setDate: function(inst, date, noChange) {
+ var clear = !date;
+ var origMonth = inst.selectedMonth;
+ var origYear = inst.selectedYear;
+ var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
+ inst.selectedDay = inst.currentDay = newDate.getDate();
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
+ inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
+ if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
+ this._notifyChange(inst);
+ this._adjustInstDate(inst);
+ if (inst.input) {
+ inst.input.val(clear ? '' : this._formatDate(inst));
+ }
+ },
+
+ /* Retrieve the date(s) directly. */
+ _getDate: function(inst) {
+ var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
+ this._daylightSavingAdjust(new Date(
+ inst.currentYear, inst.currentMonth, inst.currentDay)));
+ return startDate;
+ },
+
+ /* Attach the onxxx handlers. These are declared statically so
+ * they work with static code transformers like Caja.
+ */
+ _attachHandlers: function(inst) {
+ var stepMonths = this._get(inst, 'stepMonths');
+ var id = '#' + inst.id.replace( /\\\\/g, "\\" );
+ inst.dpDiv.find('[data-handler]').map(function () {
+ var handler = {
+ prev: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, -stepMonths, 'M');
+ },
+ next: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, +stepMonths, 'M');
+ },
+ hide: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._hideDatepicker();
+ },
+ today: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._gotoToday(id);
+ },
+ selectDay: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._selectDay(id, +this.getAttribute('data-month'), +this.getAttribute('data-year'), this);
+ return false;
+ },
+ selectMonth: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'M');
+ return false;
+ },
+ selectYear: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'Y');
+ return false;
+ }
+ };
+ $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]);
+ });
+ },
+
+ /* Generate the HTML for the current state of the date picker. */
+ _generateHTML: function(inst) {
+ var today = new Date();
+ today = this._daylightSavingAdjust(
+ new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
+ var isRTL = this._get(inst, 'isRTL');
+ var showButtonPanel = this._get(inst, 'showButtonPanel');
+ var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
+ var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
+ var numMonths = this._getNumberOfMonths(inst);
+ var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
+ var stepMonths = this._get(inst, 'stepMonths');
+ var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
+ var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
+ new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
+ var minDate = this._getMinMaxDate(inst, 'min');
+ var maxDate = this._getMinMaxDate(inst, 'max');
+ var drawMonth = inst.drawMonth - showCurrentAtPos;
+ var drawYear = inst.drawYear;
+ if (drawMonth < 0) {
+ drawMonth += 12;
+ drawYear--;
+ }
+ if (maxDate) {
+ var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
+ maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
+ maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
+ while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
+ drawMonth--;
+ if (drawMonth < 0) {
+ drawMonth = 11;
+ drawYear--;
+ }
+ }
+ }
+ inst.drawMonth = drawMonth;
+ inst.drawYear = drawYear;
+ var prevText = this._get(inst, 'prevText');
+ prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
+ this._getFormatConfig(inst)));
+ var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
+ '<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click"' +
+ ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
+ (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>'));
+ var nextText = this._get(inst, 'nextText');
+ nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
+ this._getFormatConfig(inst)));
+ var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
+ '<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click"' +
+ ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
+ (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>'));
+ var currentText = this._get(inst, 'currentText');
+ var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
+ currentText = (!navigationAsDateFormat ? currentText :
+ this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
+ var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">' +
+ this._get(inst, 'closeText') + '</button>' : '');
+ var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
+ (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click"' +
+ '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
+ var firstDay = parseInt(this._get(inst, 'firstDay'),10);
+ firstDay = (isNaN(firstDay) ? 0 : firstDay);
+ var showWeek = this._get(inst, 'showWeek');
+ var dayNames = this._get(inst, 'dayNames');
+ var dayNamesShort = this._get(inst, 'dayNamesShort');
+ var dayNamesMin = this._get(inst, 'dayNamesMin');
+ var monthNames = this._get(inst, 'monthNames');
+ var monthNamesShort = this._get(inst, 'monthNamesShort');
+ var beforeShowDay = this._get(inst, 'beforeShowDay');
+ var showOtherMonths = this._get(inst, 'showOtherMonths');
+ var selectOtherMonths = this._get(inst, 'selectOtherMonths');
+ var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
+ var defaultDate = this._getDefaultDate(inst);
+ var html = '';
+ for (var row = 0; row < numMonths[0]; row++) {
+ var group = '';
+ this.maxRows = 4;
+ for (var col = 0; col < numMonths[1]; col++) {
+ var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
+ var cornerClass = ' ui-corner-all';
+ var calender = '';
+ if (isMultiMonth) {
+ calender += '<div class="ui-datepicker-group';
+ if (numMonths[1] > 1)
+ switch (col) {
+ case 0: calender += ' ui-datepicker-group-first';
+ cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
+ case numMonths[1]-1: calender += ' ui-datepicker-group-last';
+ cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
+ default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
+ }
+ calender += '">';
+ }
+ calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
+ (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
+ (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
+ this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
+ row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
+ '</div><table class="ui-datepicker-calendar"><thead>' +
+ '<tr>';
+ var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
+ for (var dow = 0; dow < 7; dow++) { // days of the week
+ var day = (dow + firstDay) % 7;
+ thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
+ '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
+ }
+ calender += thead + '</tr></thead><tbody>';
+ var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
+ if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
+ inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
+ var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
+ var curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
+ var numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
+ this.maxRows = numRows;
+ var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
+ for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
+ calender += '<tr>';
+ var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
+ this._get(inst, 'calculateWeek')(printDate) + '</td>');
+ for (var dow = 0; dow < 7; dow++) { // create date picker days
+ var daySettings = (beforeShowDay ?
+ beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
+ var otherMonth = (printDate.getMonth() != drawMonth);
+ var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
+ (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
+ tbody += '<td class="' +
+ ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
+ (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
+ ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
+ (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
+ // or defaultDate is current printedDate and defaultDate is selectedDate
+ ' ' + this._dayOverClass : '') + // highlight selected day
+ (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
+ (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
+ (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
+ (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
+ ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
+ (unselectable ? '' : ' data-handler="selectDay" data-event="click" data-month="' + printDate.getMonth() + '" data-year="' + printDate.getFullYear() + '"') + '>' + // actions
+ (otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months
+ (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
+ (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
+ (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
+ (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
+ '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
+ printDate.setDate(printDate.getDate() + 1);
+ printDate = this._daylightSavingAdjust(printDate);
+ }
+ calender += tbody + '</tr>';
+ }
+ drawMonth++;
+ if (drawMonth > 11) {
+ drawMonth = 0;
+ drawYear++;
+ }
+ calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
+ ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
+ group += calender;
+ }
+ html += group;
+ }
+ html += buttonPanel + ($.ui.ie6 && !inst.inline ?
+ '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
+ inst._keyEvent = false;
+ return html;
+ },
+
+ /* Generate the month and year header. */
+ _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
+ secondary, monthNames, monthNamesShort) {
+ var changeMonth = this._get(inst, 'changeMonth');
+ var changeYear = this._get(inst, 'changeYear');
+ var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
+ var html = '<div class="ui-datepicker-title">';
+ var monthHtml = '';
+ // month selection
+ if (secondary || !changeMonth)
+ monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
+ else {
+ var inMinYear = (minDate && minDate.getFullYear() == drawYear);
+ var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
+ monthHtml += '<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';
+ for (var month = 0; month < 12; month++) {
+ if ((!inMinYear || month >= minDate.getMonth()) &&
+ (!inMaxYear || month <= maxDate.getMonth()))
+ monthHtml += '<option value="' + month + '"' +
+ (month == drawMonth ? ' selected="selected"' : '') +
+ '>' + monthNamesShort[month] + '</option>';
+ }
+ monthHtml += '</select>';
+ }
+ if (!showMonthAfterYear)
+ html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
+ // year selection
+ if ( !inst.yearshtml ) {
+ inst.yearshtml = '';
+ if (secondary || !changeYear)
+ html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
+ else {
+ // determine range of years to display
+ var years = this._get(inst, 'yearRange').split(':');
+ var thisYear = new Date().getFullYear();
+ var determineYear = function(value) {
+ var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
+ (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
+ parseInt(value, 10)));
+ return (isNaN(year) ? thisYear : year);
+ };
+ var year = determineYear(years[0]);
+ var endYear = Math.max(year, determineYear(years[1] || ''));
+ year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
+ endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
+ inst.yearshtml += '<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';
+ for (; year <= endYear; year++) {
+ inst.yearshtml += '<option value="' + year + '"' +
+ (year == drawYear ? ' selected="selected"' : '') +
+ '>' + year + '</option>';
+ }
+ inst.yearshtml += '</select>';
+
+ html += inst.yearshtml;
+ inst.yearshtml = null;
+ }
+ }
+ html += this._get(inst, 'yearSuffix');
+ if (showMonthAfterYear)
+ html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;
+ html += '</div>'; // Close datepicker_header
+ return html;
+ },
+
+ /* Adjust one of the date sub-fields. */
+ _adjustInstDate: function(inst, offset, period) {
+ var year = inst.drawYear + (period == 'Y' ? offset : 0);
+ var month = inst.drawMonth + (period == 'M' ? offset : 0);
+ var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
+ (period == 'D' ? offset : 0);
+ var date = this._restrictMinMax(inst,
+ this._daylightSavingAdjust(new Date(year, month, day)));
+ inst.selectedDay = date.getDate();
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
+ inst.drawYear = inst.selectedYear = date.getFullYear();
+ if (period == 'M' || period == 'Y')
+ this._notifyChange(inst);
+ },
+
+ /* Ensure a date is within any min/max bounds. */
+ _restrictMinMax: function(inst, date) {
+ var minDate = this._getMinMaxDate(inst, 'min');
+ var maxDate = this._getMinMaxDate(inst, 'max');
+ var newDate = (minDate && date < minDate ? minDate : date);
+ newDate = (maxDate && newDate > maxDate ? maxDate : newDate);
+ return newDate;
+ },
+
+ /* Notify change of month/year. */
+ _notifyChange: function(inst) {
+ var onChange = this._get(inst, 'onChangeMonthYear');
+ if (onChange)
+ onChange.apply((inst.input ? inst.input[0] : null),
+ [inst.selectedYear, inst.selectedMonth + 1, inst]);
+ },
+
+ /* Determine the number of months to show. */
+ _getNumberOfMonths: function(inst) {
+ var numMonths = this._get(inst, 'numberOfMonths');
+ return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
+ },
+
+ /* Determine the current maximum date - ensure no time components are set. */
+ _getMinMaxDate: function(inst, minMax) {
+ return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
+ },
+
+ /* Find the number of days in a given month. */
+ _getDaysInMonth: function(year, month) {
+ return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
+ },
+
+ /* Find the day of the week of the first of a month. */
+ _getFirstDayOfMonth: function(year, month) {
+ return new Date(year, month, 1).getDay();
+ },
+
+ /* Determines if we should allow a "next/prev" month display change. */
+ _canAdjustMonth: function(inst, offset, curYear, curMonth) {
+ var numMonths = this._getNumberOfMonths(inst);
+ var date = this._daylightSavingAdjust(new Date(curYear,
+ curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
+ if (offset < 0)
+ date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
+ return this._isInRange(inst, date);
+ },
+
+ /* Is the given date in the accepted range? */
+ _isInRange: function(inst, date) {
+ var minDate = this._getMinMaxDate(inst, 'min');
+ var maxDate = this._getMinMaxDate(inst, 'max');
+ return ((!minDate || date.getTime() >= minDate.getTime()) &&
+ (!maxDate || date.getTime() <= maxDate.getTime()));
+ },
+
+ /* Provide the configuration settings for formatting/parsing. */
+ _getFormatConfig: function(inst) {
+ var shortYearCutoff = this._get(inst, 'shortYearCutoff');
+ shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
+ return {shortYearCutoff: shortYearCutoff,
+ dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
+ monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
+ },
+
+ /* Format the given date for display. */
+ _formatDate: function(inst, day, month, year) {
+ if (!day) {
+ inst.currentDay = inst.selectedDay;
+ inst.currentMonth = inst.selectedMonth;
+ inst.currentYear = inst.selectedYear;
+ }
+ var date = (day ? (typeof day == 'object' ? day :
+ this._daylightSavingAdjust(new Date(year, month, day))) :
+ this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
+ return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
+ }
+});
+
+/*
+ * Bind hover events for datepicker elements.
+ * Done via delegate so the binding only occurs once in the lifetime of the parent div.
+ * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
+ */
+function bindHover(dpDiv) {
+ var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';
+ return dpDiv.delegate(selector, 'mouseout', function() {
+ $(this).removeClass('ui-state-hover');
+ if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
+ if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
+ })
+ .delegate(selector, 'mouseover', function(){
+ if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {
+ $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
+ $(this).addClass('ui-state-hover');
+ if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
+ if (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
+ }
+ });
+}
+
+/* jQuery extend now ignores nulls! */
+function extendRemove(target, props) {
+ $.extend(target, props);
+ for (var name in props)
+ if (props[name] == null || props[name] == undefined)
+ target[name] = props[name];
+ return target;
+};
+
+/* Invoke the datepicker functionality.
+ @param options string - a command, optionally followed by additional parameters or
+ Object - settings for attaching new datepicker functionality
+ @return jQuery object */
+$.fn.datepicker = function(options){
+
+ /* Verify an empty collection wasn't passed - Fixes #6976 */
+ if ( !this.length ) {
+ return this;
+ }
+
+ /* Initialise the date picker. */
+ if (!$.datepicker.initialized) {
+ $(document).mousedown($.datepicker._checkExternalClick).
+ find(document.body).append($.datepicker.dpDiv);
+ $.datepicker.initialized = true;
+ }
+
+ var otherArgs = Array.prototype.slice.call(arguments, 1);
+ if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
+ return $.datepicker['_' + options + 'Datepicker'].
+ apply($.datepicker, [this[0]].concat(otherArgs));
+ if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
+ return $.datepicker['_' + options + 'Datepicker'].
+ apply($.datepicker, [this[0]].concat(otherArgs));
+ return this.each(function() {
+ typeof options == 'string' ?
+ $.datepicker['_' + options + 'Datepicker'].
+ apply($.datepicker, [this].concat(otherArgs)) :
+ $.datepicker._attachDatepicker(this, options);
+ });
+};
+
+$.datepicker = new Datepicker(); // singleton instance
+$.datepicker.initialized = false;
+$.datepicker.uuid = new Date().getTime();
+$.datepicker.version = "1.9.2";
+
+// Workaround for #4055
+// Add another global to avoid noConflict issues with inline event handlers
+window['DP_jQuery_' + dpuuid] = $;
+
+})(jQuery);
+(function( $, undefined ) {
+
+var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ",
+ sizeRelatedOptions = {
+ buttons: true,
+ height: true,
+ maxHeight: true,
+ maxWidth: true,
+ minHeight: true,
+ minWidth: true,
+ width: true
+ },
+ resizableRelatedOptions = {
+ maxHeight: true,
+ maxWidth: true,
+ minHeight: true,
+ minWidth: true
+ };
+
+$.widget("ui.dialog", {
+ version: "1.9.2",
+ options: {
+ autoOpen: true,
+ buttons: {},
+ closeOnEscape: true,
+ closeText: "close",
+ dialogClass: "",
+ draggable: true,
+ hide: null,
+ height: "auto",
+ maxHeight: false,
+ maxWidth: false,
+ minHeight: 150,
+ minWidth: 150,
+ modal: false,
+ position: {
+ my: "center",
+ at: "center",
+ of: window,
+ collision: "fit",
+ // ensure that the titlebar is never outside the document
+ using: function( pos ) {
+ var topOffset = $( this ).css( pos ).offset().top;
+ if ( topOffset < 0 ) {
+ $( this ).css( "top", pos.top - topOffset );
+ }
+ }
+ },
+ resizable: true,
+ show: null,
+ stack: true,
+ title: "",
+ width: 300,
+ zIndex: 1000
+ },
+
+ _create: function() {
+ this.originalTitle = this.element.attr( "title" );
+ // #5742 - .attr() might return a DOMElement
+ if ( typeof this.originalTitle !== "string" ) {
+ this.originalTitle = "";
+ }
+ this.oldPosition = {
+ parent: this.element.parent(),
+ index: this.element.parent().children().index( this.element )
+ };
+ this.options.title = this.options.title || this.originalTitle;
+ var that = this,
+ options = this.options,
+
+ title = options.title || "&#160;",
+ uiDialog,
+ uiDialogTitlebar,
+ uiDialogTitlebarClose,
+ uiDialogTitle,
+ uiDialogButtonPane;
+
+ uiDialog = ( this.uiDialog = $( "<div>" ) )
+ .addClass( uiDialogClasses + options.dialogClass )
+ .css({
+ display: "none",
+ outline: 0, // TODO: move to stylesheet
+ zIndex: options.zIndex
+ })
+ // setting tabIndex makes the div focusable
+ .attr( "tabIndex", -1)
+ .keydown(function( event ) {
+ if ( options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
+ event.keyCode === $.ui.keyCode.ESCAPE ) {
+ that.close( event );
+ event.preventDefault();
+ }
+ })
+ .mousedown(function( event ) {
+ that.moveToTop( false, event );
+ })
+ .appendTo( "body" );
+
+ this.element
+ .show()
+ .removeAttr( "title" )
+ .addClass( "ui-dialog-content ui-widget-content" )
+ .appendTo( uiDialog );
+
+ uiDialogTitlebar = ( this.uiDialogTitlebar = $( "<div>" ) )
+ .addClass( "ui-dialog-titlebar ui-widget-header " +
+ "ui-corner-all ui-helper-clearfix" )
+ .bind( "mousedown", function() {
+ // Dialog isn't getting focus when dragging (#8063)
+ uiDialog.focus();
+ })
+ .prependTo( uiDialog );
+
+ uiDialogTitlebarClose = $( "<a href='#'></a>" )
+ .addClass( "ui-dialog-titlebar-close ui-corner-all" )
+ .attr( "role", "button" )
+ .click(function( event ) {
+ event.preventDefault();
+ that.close( event );
+ })
+ .appendTo( uiDialogTitlebar );
+
+ ( this.uiDialogTitlebarCloseText = $( "<span>" ) )
+ .addClass( "ui-icon ui-icon-closethick" )
+ .text( options.closeText )
+ .appendTo( uiDialogTitlebarClose );
+
+ uiDialogTitle = $( "<span>" )
+ .uniqueId()
+ .addClass( "ui-dialog-title" )
+ .html( title )
+ .prependTo( uiDialogTitlebar );
+
+ uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
+ .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
+
+ ( this.uiButtonSet = $( "<div>" ) )
+ .addClass( "ui-dialog-buttonset" )
+ .appendTo( uiDialogButtonPane );
+
+ uiDialog.attr({
+ role: "dialog",
+ "aria-labelledby": uiDialogTitle.attr( "id" )
+ });
+
+ uiDialogTitlebar.find( "*" ).add( uiDialogTitlebar ).disableSelection();
+ this._hoverable( uiDialogTitlebarClose );
+ this._focusable( uiDialogTitlebarClose );
+
+ if ( options.draggable && $.fn.draggable ) {
+ this._makeDraggable();
+ }
+ if ( options.resizable && $.fn.resizable ) {
+ this._makeResizable();
+ }
+
+ this._createButtons( options.buttons );
+ this._isOpen = false;
+
+ if ( $.fn.bgiframe ) {
+ uiDialog.bgiframe();
+ }
+
+ // prevent tabbing out of modal dialogs
+ this._on( uiDialog, { keydown: function( event ) {
+ if ( !options.modal || event.keyCode !== $.ui.keyCode.TAB ) {
+ return;
+ }
+
+ var tabbables = $( ":tabbable", uiDialog ),
+ first = tabbables.filter( ":first" ),
+ last = tabbables.filter( ":last" );
+
+ if ( event.target === last[0] && !event.shiftKey ) {
+ first.focus( 1 );
+ return false;
+ } else if ( event.target === first[0] && event.shiftKey ) {
+ last.focus( 1 );
+ return false;
+ }
+ }});
+ },
+
+ _init: function() {
+ if ( this.options.autoOpen ) {
+ this.open();
+ }
+ },
+
+ _destroy: function() {
+ var next,
+ oldPosition = this.oldPosition;
+
+ if ( this.overlay ) {
+ this.overlay.destroy();
+ }
+ this.uiDialog.hide();
+ this.element
+ .removeClass( "ui-dialog-content ui-widget-content" )
+ .hide()
+ .appendTo( "body" );
+ this.uiDialog.remove();
+
+ if ( this.originalTitle ) {
+ this.element.attr( "title", this.originalTitle );
+ }
+
+ next = oldPosition.parent.children().eq( oldPosition.index );
+ // Don't try to place the dialog next to itself (#8613)
+ if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
+ next.before( this.element );
+ } else {
+ oldPosition.parent.append( this.element );
+ }
+ },
+
+ widget: function() {
+ return this.uiDialog;
+ },
+
+ close: function( event ) {
+ var that = this,
+ maxZ, thisZ;
+
+ if ( !this._isOpen ) {
+ return;
+ }
+
+ if ( false === this._trigger( "beforeClose", event ) ) {
+ return;
+ }
+
+ this._isOpen = false;
+
+ if ( this.overlay ) {
+ this.overlay.destroy();
+ }
+
+ if ( this.options.hide ) {
+ this._hide( this.uiDialog, this.options.hide, function() {
+ that._trigger( "close", event );
+ });
+ } else {
+ this.uiDialog.hide();
+ this._trigger( "close", event );
+ }
+
+ $.ui.dialog.overlay.resize();
+
+ // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
+ if ( this.options.modal ) {
+ maxZ = 0;
+ $( ".ui-dialog" ).each(function() {
+ if ( this !== that.uiDialog[0] ) {
+ thisZ = $( this ).css( "z-index" );
+ if ( !isNaN( thisZ ) ) {
+ maxZ = Math.max( maxZ, thisZ );
+ }
+ }
+ });
+ $.ui.dialog.maxZ = maxZ;
+ }
+
+ return this;
+ },
+
+ isOpen: function() {
+ return this._isOpen;
+ },
+
+ // the force parameter allows us to move modal dialogs to their correct
+ // position on open
+ moveToTop: function( force, event ) {
+ var options = this.options,
+ saveScroll;
+
+ if ( ( options.modal && !force ) ||
+ ( !options.stack && !options.modal ) ) {
+ return this._trigger( "focus", event );
+ }
+
+ if ( options.zIndex > $.ui.dialog.maxZ ) {
+ $.ui.dialog.maxZ = options.zIndex;
+ }
+ if ( this.overlay ) {
+ $.ui.dialog.maxZ += 1;
+ $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ;
+ this.overlay.$el.css( "z-index", $.ui.dialog.overlay.maxZ );
+ }
+
+ // Save and then restore scroll
+ // Opera 9.5+ resets when parent z-index is changed.
+ // http://bugs.jqueryui.com/ticket/3193
+ saveScroll = {
+ scrollTop: this.element.scrollTop(),
+ scrollLeft: this.element.scrollLeft()
+ };
+ $.ui.dialog.maxZ += 1;
+ this.uiDialog.css( "z-index", $.ui.dialog.maxZ );
+ this.element.attr( saveScroll );
+ this._trigger( "focus", event );
+
+ return this;
+ },
+
+ open: function() {
+ if ( this._isOpen ) {
+ return;
+ }
+
+ var hasFocus,
+ options = this.options,
+ uiDialog = this.uiDialog;
+
+ this._size();
+ this._position( options.position );
+ uiDialog.show( options.show );
+ this.overlay = options.modal ? new $.ui.dialog.overlay( this ) : null;
+ this.moveToTop( true );
+
+ // set focus to the first tabbable element in the content area or the first button
+ // if there are no tabbable elements, set focus on the dialog itself
+ hasFocus = this.element.find( ":tabbable" );
+ if ( !hasFocus.length ) {
+ hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
+ if ( !hasFocus.length ) {
+ hasFocus = uiDialog;
+ }
+ }
+ hasFocus.eq( 0 ).focus();
+
+ this._isOpen = true;
+ this._trigger( "open" );
+
+ return this;
+ },
+
+ _createButtons: function( buttons ) {
+ var that = this,
+ hasButtons = false;
+
+ // if we already have a button pane, remove it
+ this.uiDialogButtonPane.remove();
+ this.uiButtonSet.empty();
+
+ if ( typeof buttons === "object" && buttons !== null ) {
+ $.each( buttons, function() {
+ return !(hasButtons = true);
+ });
+ }
+ if ( hasButtons ) {
+ $.each( buttons, function( name, props ) {
+ var button, click;
+ props = $.isFunction( props ) ?
+ { click: props, text: name } :
+ props;
+ // Default to a non-submitting button
+ props = $.extend( { type: "button" }, props );
+ // Change the context for the click callback to be the main element
+ click = props.click;
+ props.click = function() {
+ click.apply( that.element[0], arguments );
+ };
+ button = $( "<button></button>", props )
+ .appendTo( that.uiButtonSet );
+ if ( $.fn.button ) {
+ button.button();
+ }
+ });
+ this.uiDialog.addClass( "ui-dialog-buttons" );
+ this.uiDialogButtonPane.appendTo( this.uiDialog );
+ } else {
+ this.uiDialog.removeClass( "ui-dialog-buttons" );
+ }
+ },
+
+ _makeDraggable: function() {
+ var that = this,
+ options = this.options;
+
+ function filteredUi( ui ) {
+ return {
+ position: ui.position,
+ offset: ui.offset
+ };
+ }
+
+ this.uiDialog.draggable({
+ cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
+ handle: ".ui-dialog-titlebar",
+ containment: "document",
+ start: function( event, ui ) {
+ $( this )
+ .addClass( "ui-dialog-dragging" );
+ that._trigger( "dragStart", event, filteredUi( ui ) );
+ },
+ drag: function( event, ui ) {
+ that._trigger( "drag", event, filteredUi( ui ) );
+ },
+ stop: function( event, ui ) {
+ options.position = [
+ ui.position.left - that.document.scrollLeft(),
+ ui.position.top - that.document.scrollTop()
+ ];
+ $( this )
+ .removeClass( "ui-dialog-dragging" );
+ that._trigger( "dragStop", event, filteredUi( ui ) );
+ $.ui.dialog.overlay.resize();
+ }
+ });
+ },
+
+ _makeResizable: function( handles ) {
+ handles = (handles === undefined ? this.options.resizable : handles);
+ var that = this,
+ options = this.options,
+ // .ui-resizable has position: relative defined in the stylesheet
+ // but dialogs have to use absolute or fixed positioning
+ position = this.uiDialog.css( "position" ),
+ resizeHandles = typeof handles === 'string' ?
+ handles :
+ "n,e,s,w,se,sw,ne,nw";
+
+ function filteredUi( ui ) {
+ return {
+ originalPosition: ui.originalPosition,
+ originalSize: ui.originalSize,
+ position: ui.position,
+ size: ui.size
+ };
+ }
+
+ this.uiDialog.resizable({
+ cancel: ".ui-dialog-content",
+ containment: "document",
+ alsoResize: this.element,
+ maxWidth: options.maxWidth,
+ maxHeight: options.maxHeight,
+ minWidth: options.minWidth,
+ minHeight: this._minHeight(),
+ handles: resizeHandles,
+ start: function( event, ui ) {
+ $( this ).addClass( "ui-dialog-resizing" );
+ that._trigger( "resizeStart", event, filteredUi( ui ) );
+ },
+ resize: function( event, ui ) {
+ that._trigger( "resize", event, filteredUi( ui ) );
+ },
+ stop: function( event, ui ) {
+ $( this ).removeClass( "ui-dialog-resizing" );
+ options.height = $( this ).height();
+ options.width = $( this ).width();
+ that._trigger( "resizeStop", event, filteredUi( ui ) );
+ $.ui.dialog.overlay.resize();
+ }
+ })
+ .css( "position", position )
+ .find( ".ui-resizable-se" )
+ .addClass( "ui-icon ui-icon-grip-diagonal-se" );
+ },
+
+ _minHeight: function() {
+ var options = this.options;
+
+ if ( options.height === "auto" ) {
+ return options.minHeight;
+ } else {
+ return Math.min( options.minHeight, options.height );
+ }
+ },
+
+ _position: function( position ) {
+ var myAt = [],
+ offset = [ 0, 0 ],
+ isVisible;
+
+ if ( position ) {
+ // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
+ // if (typeof position == 'string' || $.isArray(position)) {
+ // myAt = $.isArray(position) ? position : position.split(' ');
+
+ if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) {
+ myAt = position.split ? position.split( " " ) : [ position[ 0 ], position[ 1 ] ];
+ if ( myAt.length === 1 ) {
+ myAt[ 1 ] = myAt[ 0 ];
+ }
+
+ $.each( [ "left", "top" ], function( i, offsetPosition ) {
+ if ( +myAt[ i ] === myAt[ i ] ) {
+ offset[ i ] = myAt[ i ];
+ myAt[ i ] = offsetPosition;
+ }
+ });
+
+ position = {
+ my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " +
+ myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]),
+ at: myAt.join( " " )
+ };
+ }
+
+ position = $.extend( {}, $.ui.dialog.prototype.options.position, position );
+ } else {
+ position = $.ui.dialog.prototype.options.position;
+ }
+
+ // need to show the dialog to get the actual offset in the position plugin
+ isVisible = this.uiDialog.is( ":visible" );
+ if ( !isVisible ) {
+ this.uiDialog.show();
+ }
+ this.uiDialog.position( position );
+ if ( !isVisible ) {
+ this.uiDialog.hide();
+ }
+ },
+
+ _setOptions: function( options ) {
+ var that = this,
+ resizableOptions = {},
+ resize = false;
+
+ $.each( options, function( key, value ) {
+ that._setOption( key, value );
+
+ if ( key in sizeRelatedOptions ) {
+ resize = true;
+ }
+ if ( key in resizableRelatedOptions ) {
+ resizableOptions[ key ] = value;
+ }
+ });
+
+ if ( resize ) {
+ this._size();
+ }
+ if ( this.uiDialog.is( ":data(resizable)" ) ) {
+ this.uiDialog.resizable( "option", resizableOptions );
+ }
+ },
+
+ _setOption: function( key, value ) {
+ var isDraggable, isResizable,
+ uiDialog = this.uiDialog;
+
+ switch ( key ) {
+ case "buttons":
+ this._createButtons( value );
+ break;
+ case "closeText":
+ // ensure that we always pass a string
+ this.uiDialogTitlebarCloseText.text( "" + value );
+ break;
+ case "dialogClass":
+ uiDialog
+ .removeClass( this.options.dialogClass )
+ .addClass( uiDialogClasses + value );
+ break;
+ case "disabled":
+ if ( value ) {
+ uiDialog.addClass( "ui-dialog-disabled" );
+ } else {
+ uiDialog.removeClass( "ui-dialog-disabled" );
+ }
+ break;
+ case "draggable":
+ isDraggable = uiDialog.is( ":data(draggable)" );
+ if ( isDraggable && !value ) {
+ uiDialog.draggable( "destroy" );
+ }
+
+ if ( !isDraggable && value ) {
+ this._makeDraggable();
+ }
+ break;
+ case "position":
+ this._position( value );
+ break;
+ case "resizable":
+ // currently resizable, becoming non-resizable
+ isResizable = uiDialog.is( ":data(resizable)" );
+ if ( isResizable && !value ) {
+ uiDialog.resizable( "destroy" );
+ }
+
+ // currently resizable, changing handles
+ if ( isResizable && typeof value === "string" ) {
+ uiDialog.resizable( "option", "handles", value );
+ }
+
+ // currently non-resizable, becoming resizable
+ if ( !isResizable && value !== false ) {
+ this._makeResizable( value );
+ }
+ break;
+ case "title":
+ // convert whatever was passed in o a string, for html() to not throw up
+ $( ".ui-dialog-title", this.uiDialogTitlebar )
+ .html( "" + ( value || "&#160;" ) );
+ break;
+ }
+
+ this._super( key, value );
+ },
+
+ _size: function() {
+ /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
+ * divs will both have width and height set, so we need to reset them
+ */
+ var nonContentHeight, minContentHeight, autoHeight,
+ options = this.options,
+ isVisible = this.uiDialog.is( ":visible" );
+
+ // reset content sizing
+ this.element.show().css({
+ width: "auto",
+ minHeight: 0,
+ height: 0
+ });
+
+ if ( options.minWidth > options.width ) {
+ options.width = options.minWidth;
+ }
+
+ // reset wrapper sizing
+ // determine the height of all the non-content elements
+ nonContentHeight = this.uiDialog.css({
+ height: "auto",
+ width: options.width
+ })
+ .outerHeight();
+ minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
+
+ if ( options.height === "auto" ) {
+ // only needed for IE6 support
+ if ( $.support.minHeight ) {
+ this.element.css({
+ minHeight: minContentHeight,
+ height: "auto"
+ });
+ } else {
+ this.uiDialog.show();
+ autoHeight = this.element.css( "height", "auto" ).height();
+ if ( !isVisible ) {
+ this.uiDialog.hide();
+ }
+ this.element.height( Math.max( autoHeight, minContentHeight ) );
+ }
+ } else {
+ this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
+ }
+
+ if (this.uiDialog.is( ":data(resizable)" ) ) {
+ this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
+ }
+ }
+});
+
+$.extend($.ui.dialog, {
+ uuid: 0,
+ maxZ: 0,
+
+ getTitleId: function($el) {
+ var id = $el.attr( "id" );
+ if ( !id ) {
+ this.uuid += 1;
+ id = this.uuid;
+ }
+ return "ui-dialog-title-" + id;
+ },
+
+ overlay: function( dialog ) {
+ this.$el = $.ui.dialog.overlay.create( dialog );
+ }
+});
+
+$.extend( $.ui.dialog.overlay, {
+ instances: [],
+ // reuse old instances due to IE memory leak with alpha transparency (see #5185)
+ oldInstances: [],
+ maxZ: 0,
+ events: $.map(
+ "focus,mousedown,mouseup,keydown,keypress,click".split( "," ),
+ function( event ) {
+ return event + ".dialog-overlay";
+ }
+ ).join( " " ),
+ create: function( dialog ) {
+ if ( this.instances.length === 0 ) {
+ // prevent use of anchors and inputs
+ // we use a setTimeout in case the overlay is created from an
+ // event that we're going to be cancelling (see #2804)
+ setTimeout(function() {
+ // handle $(el).dialog().dialog('close') (see #4065)
+ if ( $.ui.dialog.overlay.instances.length ) {
+ $( document ).bind( $.ui.dialog.overlay.events, function( event ) {
+ // stop events if the z-index of the target is < the z-index of the overlay
+ // we cannot return true when we don't want to cancel the event (#3523)
+ if ( $( event.target ).zIndex() < $.ui.dialog.overlay.maxZ ) {
+ return false;
+ }
+ });
+ }
+ }, 1 );
+
+ // handle window resize
+ $( window ).bind( "resize.dialog-overlay", $.ui.dialog.overlay.resize );
+ }
+
+ var $el = ( this.oldInstances.pop() || $( "<div>" ).addClass( "ui-widget-overlay" ) );
+
+ // allow closing by pressing the escape key
+ $( document ).bind( "keydown.dialog-overlay", function( event ) {
+ var instances = $.ui.dialog.overlay.instances;
+ // only react to the event if we're the top overlay
+ if ( instances.length !== 0 && instances[ instances.length - 1 ] === $el &&
+ dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
+ event.keyCode === $.ui.keyCode.ESCAPE ) {
+
+ dialog.close( event );
+ event.preventDefault();
+ }
+ });
+
+ $el.appendTo( document.body ).css({
+ width: this.width(),
+ height: this.height()
+ });
+
+ if ( $.fn.bgiframe ) {
+ $el.bgiframe();
+ }
+
+ this.instances.push( $el );
+ return $el;
+ },
+
+ destroy: function( $el ) {
+ var indexOf = $.inArray( $el, this.instances ),
+ maxZ = 0;
+
+ if ( indexOf !== -1 ) {
+ this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] );
+ }
+
+ if ( this.instances.length === 0 ) {
+ $( [ document, window ] ).unbind( ".dialog-overlay" );
+ }
+
+ $el.height( 0 ).width( 0 ).remove();
+
+ // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
+ $.each( this.instances, function() {
+ maxZ = Math.max( maxZ, this.css( "z-index" ) );
+ });
+ this.maxZ = maxZ;
+ },
+
+ height: function() {
+ var scrollHeight,
+ offsetHeight;
+ // handle IE
+ if ( $.ui.ie ) {
+ scrollHeight = Math.max(
+ document.documentElement.scrollHeight,
+ document.body.scrollHeight
+ );
+ offsetHeight = Math.max(
+ document.documentElement.offsetHeight,
+ document.body.offsetHeight
+ );
+
+ if ( scrollHeight < offsetHeight ) {
+ return $( window ).height() + "px";
+ } else {
+ return scrollHeight + "px";
+ }
+ // handle "good" browsers
+ } else {
+ return $( document ).height() + "px";
+ }
+ },
+
+ width: function() {
+ var scrollWidth,
+ offsetWidth;
+ // handle IE
+ if ( $.ui.ie ) {
+ scrollWidth = Math.max(
+ document.documentElement.scrollWidth,
+ document.body.scrollWidth
+ );
+ offsetWidth = Math.max(
+ document.documentElement.offsetWidth,
+ document.body.offsetWidth
+ );
+
+ if ( scrollWidth < offsetWidth ) {
+ return $( window ).width() + "px";
+ } else {
+ return scrollWidth + "px";
+ }
+ // handle "good" browsers
+ } else {
+ return $( document ).width() + "px";
+ }
+ },
+
+ resize: function() {
+ /* If the dialog is draggable and the user drags it past the
+ * right edge of the window, the document becomes wider so we
+ * need to stretch the overlay. If the user then drags the
+ * dialog back to the left, the document will become narrower,
+ * so we need to shrink the overlay to the appropriate size.
+ * This is handled by shrinking the overlay before setting it
+ * to the full document size.
+ */
+ var $overlays = $( [] );
+ $.each( $.ui.dialog.overlay.instances, function() {
+ $overlays = $overlays.add( this );
+ });
+
+ $overlays.css({
+ width: 0,
+ height: 0
+ }).css({
+ width: $.ui.dialog.overlay.width(),
+ height: $.ui.dialog.overlay.height()
+ });
+ }
+});
+
+$.extend( $.ui.dialog.overlay.prototype, {
+ destroy: function() {
+ $.ui.dialog.overlay.destroy( this.$el );
+ }
+});
+
+}( jQuery ) );
+(function( $, undefined ) {
+
+$.widget("ui.draggable", $.ui.mouse, {
+ version: "1.9.2",
+ widgetEventPrefix: "drag",
+ options: {
+ addClasses: true,
+ appendTo: "parent",
+ axis: false,
+ connectToSortable: false,
+ containment: false,
+ cursor: "auto",
+ cursorAt: false,
+ grid: false,
+ handle: false,
+ helper: "original",
+ iframeFix: false,
+ opacity: false,
+ refreshPositions: false,
+ revert: false,
+ revertDuration: 500,
+ scope: "default",
+ scroll: true,
+ scrollSensitivity: 20,
+ scrollSpeed: 20,
+ snap: false,
+ snapMode: "both",
+ snapTolerance: 20,
+ stack: false,
+ zIndex: false
+ },
+ _create: function() {
+
+ if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
+ this.element[0].style.position = 'relative';
+
+ (this.options.addClasses && this.element.addClass("ui-draggable"));
+ (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
+
+ this._mouseInit();
+
+ },
+
+ _destroy: function() {
+ this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
+ this._mouseDestroy();
+ },
+
+ _mouseCapture: function(event) {
+
+ var o = this.options;
+
+ // among others, prevent a drag on a resizable-handle
+ if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
+ return false;
+
+ //Quit if we're not on a valid handle
+ this.handle = this._getHandle(event);
+ if (!this.handle)
+ return false;
+
+ $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
+ $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
+ .css({
+ width: this.offsetWidth+"px", height: this.offsetHeight+"px",
+ position: "absolute", opacity: "0.001", zIndex: 1000
+ })
+ .css($(this).offset())
+ .appendTo("body");
+ });
+
+ return true;
+
+ },
+
+ _mouseStart: function(event) {
+
+ var o = this.options;
+
+ //Create and append the visible helper
+ this.helper = this._createHelper(event);
+
+ this.helper.addClass("ui-draggable-dragging");
+
+ //Cache the helper size
+ this._cacheHelperProportions();
+
+ //If ddmanager is used for droppables, set the global draggable
+ if($.ui.ddmanager)
+ $.ui.ddmanager.current = this;
+
+ /*
+ * - Position generation -
+ * This block generates everything position related - it's the core of draggables.
+ */
+
+ //Cache the margins of the original element
+ this._cacheMargins();
+
+ //Store the helper's css position
+ this.cssPosition = this.helper.css("position");
+ this.scrollParent = this.helper.scrollParent();
+
+ //The element's absolute position on the page minus margins
+ this.offset = this.positionAbs = this.element.offset();
+ this.offset = {
+ top: this.offset.top - this.margins.top,
+ left: this.offset.left - this.margins.left
+ };
+
+ $.extend(this.offset, {
+ click: { //Where the click happened, relative to the element
+ left: event.pageX - this.offset.left,
+ top: event.pageY - this.offset.top
+ },
+ parent: this._getParentOffset(),
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
+ });
+
+ //Generate the original position
+ this.originalPosition = this.position = this._generatePosition(event);
+ this.originalPageX = event.pageX;
+ this.originalPageY = event.pageY;
+
+ //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
+
+ //Set a containment if given in the options
+ if(o.containment)
+ this._setContainment();
+
+ //Trigger event + callbacks
+ if(this._trigger("start", event) === false) {
+ this._clear();
+ return false;
+ }
+
+ //Recache the helper size
+ this._cacheHelperProportions();
+
+ //Prepare the droppable offsets
+ if ($.ui.ddmanager && !o.dropBehaviour)
+ $.ui.ddmanager.prepareOffsets(this, event);
+
+
+ this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+
+ //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
+ if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
+
+ return true;
+ },
+
+ _mouseDrag: function(event, noPropagation) {
+
+ //Compute the helpers position
+ this.position = this._generatePosition(event);
+ this.positionAbs = this._convertPositionTo("absolute");
+
+ //Call plugins and callbacks and use the resulting position if something is returned
+ if (!noPropagation) {
+ var ui = this._uiHash();
+ if(this._trigger('drag', event, ui) === false) {
+ this._mouseUp({});
+ return false;
+ }
+ this.position = ui.position;
+ }
+
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
+
+ return false;
+ },
+
+ _mouseStop: function(event) {
+
+ //If we are using droppables, inform the manager about the drop
+ var dropped = false;
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
+ dropped = $.ui.ddmanager.drop(this, event);
+
+ //if a drop comes from outside (a sortable)
+ if(this.dropped) {
+ dropped = this.dropped;
+ this.dropped = false;
+ }
+
+ //if the original element is no longer in the DOM don't bother to continue (see #8269)
+ var element = this.element[0], elementInDom = false;
+ while ( element && (element = element.parentNode) ) {
+ if (element == document ) {
+ elementInDom = true;
+ }
+ }
+ if ( !elementInDom && this.options.helper === "original" )
+ return false;
+
+ if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
+ var that = this;
+ $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
+ if(that._trigger("stop", event) !== false) {
+ that._clear();
+ }
+ });
+ } else {
+ if(this._trigger("stop", event) !== false) {
+ this._clear();
+ }
+ }
+
+ return false;
+ },
+
+ _mouseUp: function(event) {
+ //Remove frame helpers
+ $("div.ui-draggable-iframeFix").each(function() {
+ this.parentNode.removeChild(this);
+ });
+
+ //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
+ if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
+
+ return $.ui.mouse.prototype._mouseUp.call(this, event);
+ },
+
+ cancel: function() {
+
+ if(this.helper.is(".ui-draggable-dragging")) {
+ this._mouseUp({});
+ } else {
+ this._clear();
+ }
+
+ return this;
+
+ },
+
+ _getHandle: function(event) {
+
+ var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
+ $(this.options.handle, this.element)
+ .find("*")
+ .andSelf()
+ .each(function() {
+ if(this == event.target) handle = true;
+ });
+
+ return handle;
+
+ },
+
+ _createHelper: function(event) {
+
+ var o = this.options;
+ var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
+
+ if(!helper.parents('body').length)
+ helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
+
+ if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
+ helper.css("position", "absolute");
+
+ return helper;
+
+ },
+
+ _adjustOffsetFromHelper: function(obj) {
+ if (typeof obj == 'string') {
+ obj = obj.split(' ');
+ }
+ if ($.isArray(obj)) {
+ obj = {left: +obj[0], top: +obj[1] || 0};
+ }
+ if ('left' in obj) {
+ this.offset.click.left = obj.left + this.margins.left;
+ }
+ if ('right' in obj) {
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+ }
+ if ('top' in obj) {
+ this.offset.click.top = obj.top + this.margins.top;
+ }
+ if ('bottom' in obj) {
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+ }
+ },
+
+ _getParentOffset: function() {
+
+ //Get the offsetParent and cache its position
+ this.offsetParent = this.helper.offsetParent();
+ var po = this.offsetParent.offset();
+
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
+ po.left += this.scrollParent.scrollLeft();
+ po.top += this.scrollParent.scrollTop();
+ }
+
+ if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
+ po = { top: 0, left: 0 };
+
+ return {
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+ };
+
+ },
+
+ _getRelativeOffset: function() {
+
+ if(this.cssPosition == "relative") {
+ var p = this.element.position();
+ return {
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
+ };
+ } else {
+ return { top: 0, left: 0 };
+ }
+
+ },
+
+ _cacheMargins: function() {
+ this.margins = {
+ left: (parseInt(this.element.css("marginLeft"),10) || 0),
+ top: (parseInt(this.element.css("marginTop"),10) || 0),
+ right: (parseInt(this.element.css("marginRight"),10) || 0),
+ bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
+ };
+ },
+
+ _cacheHelperProportions: function() {
+ this.helperProportions = {
+ width: this.helper.outerWidth(),
+ height: this.helper.outerHeight()
+ };
+ },
+
+ _setContainment: function() {
+
+ var o = this.options;
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
+ o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
+ o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
+ (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
+ (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+ ];
+
+ if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
+ var c = $(o.containment);
+ var ce = c[0]; if(!ce) return;
+ var co = c.offset();
+ var over = ($(ce).css("overflow") != 'hidden');
+
+ this.containment = [
+ (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
+ (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
+ (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,
+ (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom
+ ];
+ this.relative_container = c;
+
+ } else if(o.containment.constructor == Array) {
+ this.containment = o.containment;
+ }
+
+ },
+
+ _convertPositionTo: function(d, pos) {
+
+ if(!pos) pos = this.position;
+ var mod = d == "absolute" ? 1 : -1;
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+ return {
+ top: (
+ pos.top // The absolute mouse position
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+ ),
+ left: (
+ pos.left // The absolute mouse position
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+ )
+ };
+
+ },
+
+ _generatePosition: function(event) {
+
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+ var pageX = event.pageX;
+ var pageY = event.pageY;
+
+ /*
+ * - Position constraining -
+ * Constrain the position to a mix of grid, containment.
+ */
+
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
+ var containment;
+ if(this.containment) {
+ if (this.relative_container){
+ var co = this.relative_container.offset();
+ containment = [ this.containment[0] + co.left,
+ this.containment[1] + co.top,
+ this.containment[2] + co.left,
+ this.containment[3] + co.top ];
+ }
+ else {
+ containment = this.containment;
+ }
+
+ if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top;
+ if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top;
+ }
+
+ if(o.grid) {
+ //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
+ var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
+ pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+
+ var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
+ pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+ }
+
+ }
+
+ return {
+ top: (
+ pageY // The absolute mouse position
+ - this.offset.click.top // Click offset (relative to the element)
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+ ),
+ left: (
+ pageX // The absolute mouse position
+ - this.offset.click.left // Click offset (relative to the element)
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+ )
+ };
+
+ },
+
+ _clear: function() {
+ this.helper.removeClass("ui-draggable-dragging");
+ if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
+ //if($.ui.ddmanager) $.ui.ddmanager.current = null;
+ this.helper = null;
+ this.cancelHelperRemoval = false;
+ },
+
+ // From now on bulk stuff - mainly helpers
+
+ _trigger: function(type, event, ui) {
+ ui = ui || this._uiHash();
+ $.ui.plugin.call(this, type, [event, ui]);
+ if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
+ return $.Widget.prototype._trigger.call(this, type, event, ui);
+ },
+
+ plugins: {},
+
+ _uiHash: function(event) {
+ return {
+ helper: this.helper,
+ position: this.position,
+ originalPosition: this.originalPosition,
+ offset: this.positionAbs
+ };
+ }
+
+});
+
+$.ui.plugin.add("draggable", "connectToSortable", {
+ start: function(event, ui) {
+
+ var inst = $(this).data("draggable"), o = inst.options,
+ uiSortable = $.extend({}, ui, { item: inst.element });
+ inst.sortables = [];
+ $(o.connectToSortable).each(function() {
+ var sortable = $.data(this, 'sortable');
+ if (sortable && !sortable.options.disabled) {
+ inst.sortables.push({
+ instance: sortable,
+ shouldRevert: sortable.options.revert
+ });
+ sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
+ sortable._trigger("activate", event, uiSortable);
+ }
+ });
+
+ },
+ stop: function(event, ui) {
+
+ //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
+ var inst = $(this).data("draggable"),
+ uiSortable = $.extend({}, ui, { item: inst.element });
+
+ $.each(inst.sortables, function() {
+ if(this.instance.isOver) {
+
+ this.instance.isOver = 0;
+
+ inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
+ this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
+
+ //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
+ if(this.shouldRevert) this.instance.options.revert = true;
+
+ //Trigger the stop of the sortable
+ this.instance._mouseStop(event);
+
+ this.instance.options.helper = this.instance.options._helper;
+
+ //If the helper has been the original item, restore properties in the sortable
+ if(inst.options.helper == 'original')
+ this.instance.currentItem.css({ top: 'auto', left: 'auto' });
+
+ } else {
+ this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
+ this.instance._trigger("deactivate", event, uiSortable);
+ }
+
+ });
+
+ },
+ drag: function(event, ui) {
+
+ var inst = $(this).data("draggable"), that = this;
+
+ var checkPos = function(o) {
+ var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
+ var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
+ var itemHeight = o.height, itemWidth = o.width;
+ var itemTop = o.top, itemLeft = o.left;
+
+ return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
+ };
+
+ $.each(inst.sortables, function(i) {
+
+ var innermostIntersecting = false;
+ var thisSortable = this;
+ //Copy over some variables to allow calling the sortable's native _intersectsWith
+ this.instance.positionAbs = inst.positionAbs;
+ this.instance.helperProportions = inst.helperProportions;
+ this.instance.offset.click = inst.offset.click;
+
+ if(this.instance._intersectsWith(this.instance.containerCache)) {
+ innermostIntersecting = true;
+ $.each(inst.sortables, function () {
+ this.instance.positionAbs = inst.positionAbs;
+ this.instance.helperProportions = inst.helperProportions;
+ this.instance.offset.click = inst.offset.click;
+ if (this != thisSortable
+ && this.instance._intersectsWith(this.instance.containerCache)
+ && $.ui.contains(thisSortable.instance.element[0], this.instance.element[0]))
+ innermostIntersecting = false;
+ return innermostIntersecting;
+ });
+ }
+
+
+ if(innermostIntersecting) {
+ //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
+ if(!this.instance.isOver) {
+
+ this.instance.isOver = 1;
+ //Now we fake the start of dragging for the sortable instance,
+ //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
+ //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
+ this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
+ this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
+ this.instance.options.helper = function() { return ui.helper[0]; };
+
+ event.target = this.instance.currentItem[0];
+ this.instance._mouseCapture(event, true);
+ this.instance._mouseStart(event, true, true);
+
+ //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
+ this.instance.offset.click.top = inst.offset.click.top;
+ this.instance.offset.click.left = inst.offset.click.left;
+ this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
+ this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
+
+ inst._trigger("toSortable", event);
+ inst.dropped = this.instance.element; //draggable revert needs that
+ //hack so receive/update callbacks work (mostly)
+ inst.currentItem = inst.element;
+ this.instance.fromOutside = inst;
+
+ }
+
+ //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
+ if(this.instance.currentItem) this.instance._mouseDrag(event);
+
+ } else {
+
+ //If it doesn't intersect with the sortable, and it intersected before,
+ //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
+ if(this.instance.isOver) {
+
+ this.instance.isOver = 0;
+ this.instance.cancelHelperRemoval = true;
+
+ //Prevent reverting on this forced stop
+ this.instance.options.revert = false;
+
+ // The out event needs to be triggered independently
+ this.instance._trigger('out', event, this.instance._uiHash(this.instance));
+
+ this.instance._mouseStop(event, true);
+ this.instance.options.helper = this.instance.options._helper;
+
+ //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
+ this.instance.currentItem.remove();
+ if(this.instance.placeholder) this.instance.placeholder.remove();
+
+ inst._trigger("fromSortable", event);
+ inst.dropped = false; //draggable revert needs that
+ }
+
+ };
+
+ });
+
+ }
+});
+
+$.ui.plugin.add("draggable", "cursor", {
+ start: function(event, ui) {
+ var t = $('body'), o = $(this).data('draggable').options;
+ if (t.css("cursor")) o._cursor = t.css("cursor");
+ t.css("cursor", o.cursor);
+ },
+ stop: function(event, ui) {
+ var o = $(this).data('draggable').options;
+ if (o._cursor) $('body').css("cursor", o._cursor);
+ }
+});
+
+$.ui.plugin.add("draggable", "opacity", {
+ start: function(event, ui) {
+ var t = $(ui.helper), o = $(this).data('draggable').options;
+ if(t.css("opacity")) o._opacity = t.css("opacity");
+ t.css('opacity', o.opacity);
+ },
+ stop: function(event, ui) {
+ var o = $(this).data('draggable').options;
+ if(o._opacity) $(ui.helper).css('opacity', o._opacity);
+ }
+});
+
+$.ui.plugin.add("draggable", "scroll", {
+ start: function(event, ui) {
+ var i = $(this).data("draggable");
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
+ },
+ drag: function(event, ui) {
+
+ var i = $(this).data("draggable"), o = i.options, scrolled = false;
+
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
+
+ if(!o.axis || o.axis != 'x') {
+ if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
+ else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
+ }
+
+ if(!o.axis || o.axis != 'y') {
+ if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
+ else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
+ }
+
+ } else {
+
+ if(!o.axis || o.axis != 'x') {
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+ else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+ }
+
+ if(!o.axis || o.axis != 'y') {
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+ else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+ }
+
+ }
+
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
+ $.ui.ddmanager.prepareOffsets(i, event);
+
+ }
+});
+
+$.ui.plugin.add("draggable", "snap", {
+ start: function(event, ui) {
+
+ var i = $(this).data("draggable"), o = i.options;
+ i.snapElements = [];
+
+ $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
+ var $t = $(this); var $o = $t.offset();
+ if(this != i.element[0]) i.snapElements.push({
+ item: this,
+ width: $t.outerWidth(), height: $t.outerHeight(),
+ top: $o.top, left: $o.left
+ });
+ });
+
+ },
+ drag: function(event, ui) {
+
+ var inst = $(this).data("draggable"), o = inst.options;
+ var d = o.snapTolerance;
+
+ var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
+ y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
+
+ for (var i = inst.snapElements.length - 1; i >= 0; i--){
+
+ var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
+ t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
+
+ //Yes, I know, this is insane ;)
+ if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
+ if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+ inst.snapElements[i].snapping = false;
+ continue;
+ }
+
+ if(o.snapMode != 'inner') {
+ var ts = Math.abs(t - y2) <= d;
+ var bs = Math.abs(b - y1) <= d;
+ var ls = Math.abs(l - x2) <= d;
+ var rs = Math.abs(r - x1) <= d;
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
+ }
+
+ var first = (ts || bs || ls || rs);
+
+ if(o.snapMode != 'outer') {
+ var ts = Math.abs(t - y1) <= d;
+ var bs = Math.abs(b - y2) <= d;
+ var ls = Math.abs(l - x1) <= d;
+ var rs = Math.abs(r - x2) <= d;
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
+ }
+
+ if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
+ (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+ inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
+
+ };
+
+ }
+});
+
+$.ui.plugin.add("draggable", "stack", {
+ start: function(event, ui) {
+
+ var o = $(this).data("draggable").options;
+
+ var group = $.makeArray($(o.stack)).sort(function(a,b) {
+ return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
+ });
+ if (!group.length) { return; }
+
+ var min = parseInt(group[0].style.zIndex) || 0;
+ $(group).each(function(i) {
+ this.style.zIndex = min + i;
+ });
+
+ this[0].style.zIndex = min + group.length;
+
+ }
+});
+
+$.ui.plugin.add("draggable", "zIndex", {
+ start: function(event, ui) {
+ var t = $(ui.helper), o = $(this).data("draggable").options;
+ if(t.css("zIndex")) o._zIndex = t.css("zIndex");
+ t.css('zIndex', o.zIndex);
+ },
+ stop: function(event, ui) {
+ var o = $(this).data("draggable").options;
+ if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
+ }
+});
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.widget("ui.droppable", {
+ version: "1.9.2",
+ widgetEventPrefix: "drop",
+ options: {
+ accept: '*',
+ activeClass: false,
+ addClasses: true,
+ greedy: false,
+ hoverClass: false,
+ scope: 'default',
+ tolerance: 'intersect'
+ },
+ _create: function() {
+
+ var o = this.options, accept = o.accept;
+ this.isover = 0; this.isout = 1;
+
+ this.accept = $.isFunction(accept) ? accept : function(d) {
+ return d.is(accept);
+ };
+
+ //Store the droppable's proportions
+ this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
+
+ // Add the reference and positions to the manager
+ $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
+ $.ui.ddmanager.droppables[o.scope].push(this);
+
+ (o.addClasses && this.element.addClass("ui-droppable"));
+
+ },
+
+ _destroy: function() {
+ var drop = $.ui.ddmanager.droppables[this.options.scope];
+ for ( var i = 0; i < drop.length; i++ )
+ if ( drop[i] == this )
+ drop.splice(i, 1);
+
+ this.element.removeClass("ui-droppable ui-droppable-disabled");
+ },
+
+ _setOption: function(key, value) {
+
+ if(key == 'accept') {
+ this.accept = $.isFunction(value) ? value : function(d) {
+ return d.is(value);
+ };
+ }
+ $.Widget.prototype._setOption.apply(this, arguments);
+ },
+
+ _activate: function(event) {
+ var draggable = $.ui.ddmanager.current;
+ if(this.options.activeClass) this.element.addClass(this.options.activeClass);
+ (draggable && this._trigger('activate', event, this.ui(draggable)));
+ },
+
+ _deactivate: function(event) {
+ var draggable = $.ui.ddmanager.current;
+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
+ (draggable && this._trigger('deactivate', event, this.ui(draggable)));
+ },
+
+ _over: function(event) {
+
+ var draggable = $.ui.ddmanager.current;
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
+
+ if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
+ this._trigger('over', event, this.ui(draggable));
+ }
+
+ },
+
+ _out: function(event) {
+
+ var draggable = $.ui.ddmanager.current;
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
+
+ if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
+ this._trigger('out', event, this.ui(draggable));
+ }
+
+ },
+
+ _drop: function(event,custom) {
+
+ var draggable = custom || $.ui.ddmanager.current;
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
+
+ var childrenIntersection = false;
+ this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
+ var inst = $.data(this, 'droppable');
+ if(
+ inst.options.greedy
+ && !inst.options.disabled
+ && inst.options.scope == draggable.options.scope
+ && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
+ && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
+ ) { childrenIntersection = true; return false; }
+ });
+ if(childrenIntersection) return false;
+
+ if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
+ this._trigger('drop', event, this.ui(draggable));
+ return this.element;
+ }
+
+ return false;
+
+ },
+
+ ui: function(c) {
+ return {
+ draggable: (c.currentItem || c.element),
+ helper: c.helper,
+ position: c.position,
+ offset: c.positionAbs
+ };
+ }
+
+});
+
+$.ui.intersect = function(draggable, droppable, toleranceMode) {
+
+ if (!droppable.offset) return false;
+
+ var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
+ y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
+ var l = droppable.offset.left, r = l + droppable.proportions.width,
+ t = droppable.offset.top, b = t + droppable.proportions.height;
+
+ switch (toleranceMode) {
+ case 'fit':
+ return (l <= x1 && x2 <= r
+ && t <= y1 && y2 <= b);
+ break;
+ case 'intersect':
+ return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
+ && x2 - (draggable.helperProportions.width / 2) < r // Left Half
+ && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
+ && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
+ break;
+ case 'pointer':
+ var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
+ draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
+ isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
+ return isOver;
+ break;
+ case 'touch':
+ return (
+ (y1 >= t && y1 <= b) || // Top edge touching
+ (y2 >= t && y2 <= b) || // Bottom edge touching
+ (y1 < t && y2 > b) // Surrounded vertically
+ ) && (
+ (x1 >= l && x1 <= r) || // Left edge touching
+ (x2 >= l && x2 <= r) || // Right edge touching
+ (x1 < l && x2 > r) // Surrounded horizontally
+ );
+ break;
+ default:
+ return false;
+ break;
+ }
+
+};
+
+/*
+ This manager tracks offsets of draggables and droppables
+*/
+$.ui.ddmanager = {
+ current: null,
+ droppables: { 'default': [] },
+ prepareOffsets: function(t, event) {
+
+ var m = $.ui.ddmanager.droppables[t.options.scope] || [];
+ var type = event ? event.type : null; // workaround for #2317
+ var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
+
+ droppablesLoop: for (var i = 0; i < m.length; i++) {
+
+ if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
+ for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
+ m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
+
+ if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
+
+ m[i].offset = m[i].element.offset();
+ m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
+
+ }
+
+ },
+ drop: function(draggable, event) {
+
+ var dropped = false;
+ $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
+
+ if(!this.options) return;
+ if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
+ dropped = this._drop.call(this, event) || dropped;
+
+ if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ this.isout = 1; this.isover = 0;
+ this._deactivate.call(this, event);
+ }
+
+ });
+ return dropped;
+
+ },
+ dragStart: function( draggable, event ) {
+ //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
+ draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
+ if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
+ });
+ },
+ drag: function(draggable, event) {
+
+ //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
+ if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
+
+ //Run through all droppables and check their positions based on specific tolerance options
+ $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
+
+ if(this.options.disabled || this.greedyChild || !this.visible) return;
+ var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
+
+ var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
+ if(!c) return;
+
+ var parentInstance;
+ if (this.options.greedy) {
+ // find droppable parents with same scope
+ var scope = this.options.scope;
+ var parent = this.element.parents(':data(droppable)').filter(function () {
+ return $.data(this, 'droppable').options.scope === scope;
+ });
+
+ if (parent.length) {
+ parentInstance = $.data(parent[0], 'droppable');
+ parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
+ }
+ }
+
+ // we just moved into a greedy child
+ if (parentInstance && c == 'isover') {
+ parentInstance['isover'] = 0;
+ parentInstance['isout'] = 1;
+ parentInstance._out.call(parentInstance, event);
+ }
+
+ this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
+ this[c == "isover" ? "_over" : "_out"].call(this, event);
+
+ // we just moved out of a greedy child
+ if (parentInstance && c == 'isout') {
+ parentInstance['isout'] = 0;
+ parentInstance['isover'] = 1;
+ parentInstance._over.call(parentInstance, event);
+ }
+ });
+
+ },
+ dragStop: function( draggable, event ) {
+ draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
+ //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
+ if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
+ }
+};
+
+})(jQuery);
+;(jQuery.effects || (function($, undefined) {
+
+var backCompat = $.uiBackCompat !== false,
+ // prefix used for storing data on .data()
+ dataSpace = "ui-effects-";
+
+$.effects = {
+ effect: {}
+};
+
+/*!
+ * jQuery Color Animations v2.0.0
+ * http://jquery.com/
+ *
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * Date: Mon Aug 13 13:41:02 2012 -0500
+ */
+(function( jQuery, undefined ) {
+
+ var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "),
+
+ // plusequals test for += 100 -= 100
+ rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
+ // a set of RE's that can match strings and generate color tuples.
+ stringParsers = [{
+ re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
+ parse: function( execResult ) {
+ return [
+ execResult[ 1 ],
+ execResult[ 2 ],
+ execResult[ 3 ],
+ execResult[ 4 ]
+ ];
+ }
+ }, {
+ re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
+ parse: function( execResult ) {
+ return [
+ execResult[ 1 ] * 2.55,
+ execResult[ 2 ] * 2.55,
+ execResult[ 3 ] * 2.55,
+ execResult[ 4 ]
+ ];
+ }
+ }, {
+ // this regex ignores A-F because it's compared against an already lowercased string
+ re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
+ parse: function( execResult ) {
+ return [
+ parseInt( execResult[ 1 ], 16 ),
+ parseInt( execResult[ 2 ], 16 ),
+ parseInt( execResult[ 3 ], 16 )
+ ];
+ }
+ }, {
+ // this regex ignores A-F because it's compared against an already lowercased string
+ re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
+ parse: function( execResult ) {
+ return [
+ parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
+ parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
+ parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
+ ];
+ }
+ }, {
+ re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
+ space: "hsla",
+ parse: function( execResult ) {
+ return [
+ execResult[ 1 ],
+ execResult[ 2 ] / 100,
+ execResult[ 3 ] / 100,
+ execResult[ 4 ]
+ ];
+ }
+ }],
+
+ // jQuery.Color( )
+ color = jQuery.Color = function( color, green, blue, alpha ) {
+ return new jQuery.Color.fn.parse( color, green, blue, alpha );
+ },
+ spaces = {
+ rgba: {
+ props: {
+ red: {
+ idx: 0,
+ type: "byte"
+ },
+ green: {
+ idx: 1,
+ type: "byte"
+ },
+ blue: {
+ idx: 2,
+ type: "byte"
+ }
+ }
+ },
+
+ hsla: {
+ props: {
+ hue: {
+ idx: 0,
+ type: "degrees"
+ },
+ saturation: {
+ idx: 1,
+ type: "percent"
+ },
+ lightness: {
+ idx: 2,
+ type: "percent"
+ }
+ }
+ }
+ },
+ propTypes = {
+ "byte": {
+ floor: true,
+ max: 255
+ },
+ "percent": {
+ max: 1
+ },
+ "degrees": {
+ mod: 360,
+ floor: true
+ }
+ },
+ support = color.support = {},
+
+ // element for support tests
+ supportElem = jQuery( "<p>" )[ 0 ],
+
+ // colors = jQuery.Color.names
+ colors,
+
+ // local aliases of functions called often
+ each = jQuery.each;
+
+// determine rgba support immediately
+supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
+support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
+
+// define cache name and alpha properties
+// for rgba and hsla spaces
+each( spaces, function( spaceName, space ) {
+ space.cache = "_" + spaceName;
+ space.props.alpha = {
+ idx: 3,
+ type: "percent",
+ def: 1
+ };
+});
+
+function clamp( value, prop, allowEmpty ) {
+ var type = propTypes[ prop.type ] || {};
+
+ if ( value == null ) {
+ return (allowEmpty || !prop.def) ? null : prop.def;
+ }
+
+ // ~~ is an short way of doing floor for positive numbers
+ value = type.floor ? ~~value : parseFloat( value );
+
+ // IE will pass in empty strings as value for alpha,
+ // which will hit this case
+ if ( isNaN( value ) ) {
+ return prop.def;
+ }
+
+ if ( type.mod ) {
+ // we add mod before modding to make sure that negatives values
+ // get converted properly: -10 -> 350
+ return (value + type.mod) % type.mod;
+ }
+
+ // for now all property types without mod have min and max
+ return 0 > value ? 0 : type.max < value ? type.max : value;
+}
+
+function stringParse( string ) {
+ var inst = color(),
+ rgba = inst._rgba = [];
+
+ string = string.toLowerCase();
+
+ each( stringParsers, function( i, parser ) {
+ var parsed,
+ match = parser.re.exec( string ),
+ values = match && parser.parse( match ),
+ spaceName = parser.space || "rgba";
+
+ if ( values ) {
+ parsed = inst[ spaceName ]( values );
+
+ // if this was an rgba parse the assignment might happen twice
+ // oh well....
+ inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
+ rgba = inst._rgba = parsed._rgba;
+
+ // exit each( stringParsers ) here because we matched
+ return false;
+ }
+ });
+
+ // Found a stringParser that handled it
+ if ( rgba.length ) {
+
+ // if this came from a parsed string, force "transparent" when alpha is 0
+ // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
+ if ( rgba.join() === "0,0,0,0" ) {
+ jQuery.extend( rgba, colors.transparent );
+ }
+ return inst;
+ }
+
+ // named colors
+ return colors[ string ];
+}
+
+color.fn = jQuery.extend( color.prototype, {
+ parse: function( red, green, blue, alpha ) {
+ if ( red === undefined ) {
+ this._rgba = [ null, null, null, null ];
+ return this;
+ }
+ if ( red.jquery || red.nodeType ) {
+ red = jQuery( red ).css( green );
+ green = undefined;
+ }
+
+ var inst = this,
+ type = jQuery.type( red ),
+ rgba = this._rgba = [];
+
+ // more than 1 argument specified - assume ( red, green, blue, alpha )
+ if ( green !== undefined ) {
+ red = [ red, green, blue, alpha ];
+ type = "array";
+ }
+
+ if ( type === "string" ) {
+ return this.parse( stringParse( red ) || colors._default );
+ }
+
+ if ( type === "array" ) {
+ each( spaces.rgba.props, function( key, prop ) {
+ rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
+ });
+ return this;
+ }
+
+ if ( type === "object" ) {
+ if ( red instanceof color ) {
+ each( spaces, function( spaceName, space ) {
+ if ( red[ space.cache ] ) {
+ inst[ space.cache ] = red[ space.cache ].slice();
+ }
+ });
+ } else {
+ each( spaces, function( spaceName, space ) {
+ var cache = space.cache;
+ each( space.props, function( key, prop ) {
+
+ // if the cache doesn't exist, and we know how to convert
+ if ( !inst[ cache ] && space.to ) {
+
+ // if the value was null, we don't need to copy it
+ // if the key was alpha, we don't need to copy it either
+ if ( key === "alpha" || red[ key ] == null ) {
+ return;
+ }
+ inst[ cache ] = space.to( inst._rgba );
+ }
+
+ // this is the only case where we allow nulls for ALL properties.
+ // call clamp with alwaysAllowEmpty
+ inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
+ });
+
+ // everything defined but alpha?
+ if ( inst[ cache ] && $.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
+ // use the default of 1
+ inst[ cache ][ 3 ] = 1;
+ if ( space.from ) {
+ inst._rgba = space.from( inst[ cache ] );
+ }
+ }
+ });
+ }
+ return this;
+ }
+ },
+ is: function( compare ) {
+ var is = color( compare ),
+ same = true,
+ inst = this;
+
+ each( spaces, function( _, space ) {
+ var localCache,
+ isCache = is[ space.cache ];
+ if (isCache) {
+ localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
+ each( space.props, function( _, prop ) {
+ if ( isCache[ prop.idx ] != null ) {
+ same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
+ return same;
+ }
+ });
+ }
+ return same;
+ });
+ return same;
+ },
+ _space: function() {
+ var used = [],
+ inst = this;
+ each( spaces, function( spaceName, space ) {
+ if ( inst[ space.cache ] ) {
+ used.push( spaceName );
+ }
+ });
+ return used.pop();
+ },
+ transition: function( other, distance ) {
+ var end = color( other ),
+ spaceName = end._space(),
+ space = spaces[ spaceName ],
+ startColor = this.alpha() === 0 ? color( "transparent" ) : this,
+ start = startColor[ space.cache ] || space.to( startColor._rgba ),
+ result = start.slice();
+
+ end = end[ space.cache ];
+ each( space.props, function( key, prop ) {
+ var index = prop.idx,
+ startValue = start[ index ],
+ endValue = end[ index ],
+ type = propTypes[ prop.type ] || {};
+
+ // if null, don't override start value
+ if ( endValue === null ) {
+ return;
+ }
+ // if null - use end
+ if ( startValue === null ) {
+ result[ index ] = endValue;
+ } else {
+ if ( type.mod ) {
+ if ( endValue - startValue > type.mod / 2 ) {
+ startValue += type.mod;
+ } else if ( startValue - endValue > type.mod / 2 ) {
+ startValue -= type.mod;
+ }
+ }
+ result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
+ }
+ });
+ return this[ spaceName ]( result );
+ },
+ blend: function( opaque ) {
+ // if we are already opaque - return ourself
+ if ( this._rgba[ 3 ] === 1 ) {
+ return this;
+ }
+
+ var rgb = this._rgba.slice(),
+ a = rgb.pop(),
+ blend = color( opaque )._rgba;
+
+ return color( jQuery.map( rgb, function( v, i ) {
+ return ( 1 - a ) * blend[ i ] + a * v;
+ }));
+ },
+ toRgbaString: function() {
+ var prefix = "rgba(",
+ rgba = jQuery.map( this._rgba, function( v, i ) {
+ return v == null ? ( i > 2 ? 1 : 0 ) : v;
+ });
+
+ if ( rgba[ 3 ] === 1 ) {
+ rgba.pop();
+ prefix = "rgb(";
+ }
+
+ return prefix + rgba.join() + ")";
+ },
+ toHslaString: function() {
+ var prefix = "hsla(",
+ hsla = jQuery.map( this.hsla(), function( v, i ) {
+ if ( v == null ) {
+ v = i > 2 ? 1 : 0;
+ }
+
+ // catch 1 and 2
+ if ( i && i < 3 ) {
+ v = Math.round( v * 100 ) + "%";
+ }
+ return v;
+ });
+
+ if ( hsla[ 3 ] === 1 ) {
+ hsla.pop();
+ prefix = "hsl(";
+ }
+ return prefix + hsla.join() + ")";
+ },
+ toHexString: function( includeAlpha ) {
+ var rgba = this._rgba.slice(),
+ alpha = rgba.pop();
+
+ if ( includeAlpha ) {
+ rgba.push( ~~( alpha * 255 ) );
+ }
+
+ return "#" + jQuery.map( rgba, function( v ) {
+
+ // default to 0 when nulls exist
+ v = ( v || 0 ).toString( 16 );
+ return v.length === 1 ? "0" + v : v;
+ }).join("");
+ },
+ toString: function() {
+ return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
+ }
+});
+color.fn.parse.prototype = color.fn;
+
+// hsla conversions adapted from:
+// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
+
+function hue2rgb( p, q, h ) {
+ h = ( h + 1 ) % 1;
+ if ( h * 6 < 1 ) {
+ return p + (q - p) * h * 6;
+ }
+ if ( h * 2 < 1) {
+ return q;
+ }
+ if ( h * 3 < 2 ) {
+ return p + (q - p) * ((2/3) - h) * 6;
+ }
+ return p;
+}
+
+spaces.hsla.to = function ( rgba ) {
+ if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
+ return [ null, null, null, rgba[ 3 ] ];
+ }
+ var r = rgba[ 0 ] / 255,
+ g = rgba[ 1 ] / 255,
+ b = rgba[ 2 ] / 255,
+ a = rgba[ 3 ],
+ max = Math.max( r, g, b ),
+ min = Math.min( r, g, b ),
+ diff = max - min,
+ add = max + min,
+ l = add * 0.5,
+ h, s;
+
+ if ( min === max ) {
+ h = 0;
+ } else if ( r === max ) {
+ h = ( 60 * ( g - b ) / diff ) + 360;
+ } else if ( g === max ) {
+ h = ( 60 * ( b - r ) / diff ) + 120;
+ } else {
+ h = ( 60 * ( r - g ) / diff ) + 240;
+ }
+
+ if ( l === 0 || l === 1 ) {
+ s = l;
+ } else if ( l <= 0.5 ) {
+ s = diff / add;
+ } else {
+ s = diff / ( 2 - add );
+ }
+ return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
+};
+
+spaces.hsla.from = function ( hsla ) {
+ if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
+ return [ null, null, null, hsla[ 3 ] ];
+ }
+ var h = hsla[ 0 ] / 360,
+ s = hsla[ 1 ],
+ l = hsla[ 2 ],
+ a = hsla[ 3 ],
+ q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
+ p = 2 * l - q;
+
+ return [
+ Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
+ Math.round( hue2rgb( p, q, h ) * 255 ),
+ Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
+ a
+ ];
+};
+
+
+each( spaces, function( spaceName, space ) {
+ var props = space.props,
+ cache = space.cache,
+ to = space.to,
+ from = space.from;
+
+ // makes rgba() and hsla()
+ color.fn[ spaceName ] = function( value ) {
+
+ // generate a cache for this space if it doesn't exist
+ if ( to && !this[ cache ] ) {
+ this[ cache ] = to( this._rgba );
+ }
+ if ( value === undefined ) {
+ return this[ cache ].slice();
+ }
+
+ var ret,
+ type = jQuery.type( value ),
+ arr = ( type === "array" || type === "object" ) ? value : arguments,
+ local = this[ cache ].slice();
+
+ each( props, function( key, prop ) {
+ var val = arr[ type === "object" ? key : prop.idx ];
+ if ( val == null ) {
+ val = local[ prop.idx ];
+ }
+ local[ prop.idx ] = clamp( val, prop );
+ });
+
+ if ( from ) {
+ ret = color( from( local ) );
+ ret[ cache ] = local;
+ return ret;
+ } else {
+ return color( local );
+ }
+ };
+
+ // makes red() green() blue() alpha() hue() saturation() lightness()
+ each( props, function( key, prop ) {
+ // alpha is included in more than one space
+ if ( color.fn[ key ] ) {
+ return;
+ }
+ color.fn[ key ] = function( value ) {
+ var vtype = jQuery.type( value ),
+ fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
+ local = this[ fn ](),
+ cur = local[ prop.idx ],
+ match;
+
+ if ( vtype === "undefined" ) {
+ return cur;
+ }
+
+ if ( vtype === "function" ) {
+ value = value.call( this, cur );
+ vtype = jQuery.type( value );
+ }
+ if ( value == null && prop.empty ) {
+ return this;
+ }
+ if ( vtype === "string" ) {
+ match = rplusequals.exec( value );
+ if ( match ) {
+ value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
+ }
+ }
+ local[ prop.idx ] = value;
+ return this[ fn ]( local );
+ };
+ });
+});
+
+// add .fx.step functions
+each( stepHooks, function( i, hook ) {
+ jQuery.cssHooks[ hook ] = {
+ set: function( elem, value ) {
+ var parsed, curElem,
+ backgroundColor = "";
+
+ if ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) {
+ value = color( parsed || value );
+ if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
+ curElem = hook === "backgroundColor" ? elem.parentNode : elem;
+ while (
+ (backgroundColor === "" || backgroundColor === "transparent") &&
+ curElem && curElem.style
+ ) {
+ try {
+ backgroundColor = jQuery.css( curElem, "backgroundColor" );
+ curElem = curElem.parentNode;
+ } catch ( e ) {
+ }
+ }
+
+ value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
+ backgroundColor :
+ "_default" );
+ }
+
+ value = value.toRgbaString();
+ }
+ try {
+ elem.style[ hook ] = value;
+ } catch( error ) {
+ // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
+ }
+ }
+ };
+ jQuery.fx.step[ hook ] = function( fx ) {
+ if ( !fx.colorInit ) {
+ fx.start = color( fx.elem, hook );
+ fx.end = color( fx.end );
+ fx.colorInit = true;
+ }
+ jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
+ };
+});
+
+jQuery.cssHooks.borderColor = {
+ expand: function( value ) {
+ var expanded = {};
+
+ each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
+ expanded[ "border" + part + "Color" ] = value;
+ });
+ return expanded;
+ }
+};
+
+// Basic color names only.
+// Usage of any of the other color names requires adding yourself or including
+// jquery.color.svg-names.js.
+colors = jQuery.Color.names = {
+ // 4.1. Basic color keywords
+ aqua: "#00ffff",
+ black: "#000000",
+ blue: "#0000ff",
+ fuchsia: "#ff00ff",
+ gray: "#808080",
+ green: "#008000",
+ lime: "#00ff00",
+ maroon: "#800000",
+ navy: "#000080",
+ olive: "#808000",
+ purple: "#800080",
+ red: "#ff0000",
+ silver: "#c0c0c0",
+ teal: "#008080",
+ white: "#ffffff",
+ yellow: "#ffff00",
+
+ // 4.2.3. "transparent" color keyword
+ transparent: [ null, null, null, 0 ],
+
+ _default: "#ffffff"
+};
+
+})( jQuery );
+
+
+
+/******************************************************************************/
+/****************************** CLASS ANIMATIONS ******************************/
+/******************************************************************************/
+(function() {
+
+var classAnimationActions = [ "add", "remove", "toggle" ],
+ shorthandStyles = {
+ border: 1,
+ borderBottom: 1,
+ borderColor: 1,
+ borderLeft: 1,
+ borderRight: 1,
+ borderTop: 1,
+ borderWidth: 1,
+ margin: 1,
+ padding: 1
+ };
+
+$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
+ $.fx.step[ prop ] = function( fx ) {
+ if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
+ jQuery.style( fx.elem, prop, fx.end );
+ fx.setAttr = true;
+ }
+ };
+});
+
+function getElementStyles() {
+ var style = this.ownerDocument.defaultView ?
+ this.ownerDocument.defaultView.getComputedStyle( this, null ) :
+ this.currentStyle,
+ newStyle = {},
+ key,
+ len;
+
+ // webkit enumerates style porperties
+ if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
+ len = style.length;
+ while ( len-- ) {
+ key = style[ len ];
+ if ( typeof style[ key ] === "string" ) {
+ newStyle[ $.camelCase( key ) ] = style[ key ];
+ }
+ }
+ } else {
+ for ( key in style ) {
+ if ( typeof style[ key ] === "string" ) {
+ newStyle[ key ] = style[ key ];
+ }
+ }
+ }
+
+ return newStyle;
+}
+
+
+function styleDifference( oldStyle, newStyle ) {
+ var diff = {},
+ name, value;
+
+ for ( name in newStyle ) {
+ value = newStyle[ name ];
+ if ( oldStyle[ name ] !== value ) {
+ if ( !shorthandStyles[ name ] ) {
+ if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
+ diff[ name ] = value;
+ }
+ }
+ }
+ }
+
+ return diff;
+}
+
+$.effects.animateClass = function( value, duration, easing, callback ) {
+ var o = $.speed( duration, easing, callback );
+
+ return this.queue( function() {
+ var animated = $( this ),
+ baseClass = animated.attr( "class" ) || "",
+ applyClassChange,
+ allAnimations = o.children ? animated.find( "*" ).andSelf() : animated;
+
+ // map the animated objects to store the original styles.
+ allAnimations = allAnimations.map(function() {
+ var el = $( this );
+ return {
+ el: el,
+ start: getElementStyles.call( this )
+ };
+ });
+
+ // apply class change
+ applyClassChange = function() {
+ $.each( classAnimationActions, function(i, action) {
+ if ( value[ action ] ) {
+ animated[ action + "Class" ]( value[ action ] );
+ }
+ });
+ };
+ applyClassChange();
+
+ // map all animated objects again - calculate new styles and diff
+ allAnimations = allAnimations.map(function() {
+ this.end = getElementStyles.call( this.el[ 0 ] );
+ this.diff = styleDifference( this.start, this.end );
+ return this;
+ });
+
+ // apply original class
+ animated.attr( "class", baseClass );
+
+ // map all animated objects again - this time collecting a promise
+ allAnimations = allAnimations.map(function() {
+ var styleInfo = this,
+ dfd = $.Deferred(),
+ opts = jQuery.extend({}, o, {
+ queue: false,
+ complete: function() {
+ dfd.resolve( styleInfo );
+ }
+ });
+
+ this.el.animate( this.diff, opts );
+ return dfd.promise();
+ });
+
+ // once all animations have completed:
+ $.when.apply( $, allAnimations.get() ).done(function() {
+
+ // set the final class
+ applyClassChange();
+
+ // for each animated element,
+ // clear all css properties that were animated
+ $.each( arguments, function() {
+ var el = this.el;
+ $.each( this.diff, function(key) {
+ el.css( key, '' );
+ });
+ });
+
+ // this is guarnteed to be there if you use jQuery.speed()
+ // it also handles dequeuing the next anim...
+ o.complete.call( animated[ 0 ] );
+ });
+ });
+};
+
+$.fn.extend({
+ _addClass: $.fn.addClass,
+ addClass: function( classNames, speed, easing, callback ) {
+ return speed ?
+ $.effects.animateClass.call( this,
+ { add: classNames }, speed, easing, callback ) :
+ this._addClass( classNames );
+ },
+
+ _removeClass: $.fn.removeClass,
+ removeClass: function( classNames, speed, easing, callback ) {
+ return speed ?
+ $.effects.animateClass.call( this,
+ { remove: classNames }, speed, easing, callback ) :
+ this._removeClass( classNames );
+ },
+
+ _toggleClass: $.fn.toggleClass,
+ toggleClass: function( classNames, force, speed, easing, callback ) {
+ if ( typeof force === "boolean" || force === undefined ) {
+ if ( !speed ) {
+ // without speed parameter
+ return this._toggleClass( classNames, force );
+ } else {
+ return $.effects.animateClass.call( this,
+ (force ? { add: classNames } : { remove: classNames }),
+ speed, easing, callback );
+ }
+ } else {
+ // without force parameter
+ return $.effects.animateClass.call( this,
+ { toggle: classNames }, force, speed, easing );
+ }
+ },
+
+ switchClass: function( remove, add, speed, easing, callback) {
+ return $.effects.animateClass.call( this, {
+ add: add,
+ remove: remove
+ }, speed, easing, callback );
+ }
+});
+
+})();
+
+/******************************************************************************/
+/*********************************** EFFECTS **********************************/
+/******************************************************************************/
+
+(function() {
+
+$.extend( $.effects, {
+ version: "1.9.2",
+
+ // Saves a set of properties in a data storage
+ save: function( element, set ) {
+ for( var i=0; i < set.length; i++ ) {
+ if ( set[ i ] !== null ) {
+ element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
+ }
+ }
+ },
+
+ // Restores a set of previously saved properties from a data storage
+ restore: function( element, set ) {
+ var val, i;
+ for( i=0; i < set.length; i++ ) {
+ if ( set[ i ] !== null ) {
+ val = element.data( dataSpace + set[ i ] );
+ // support: jQuery 1.6.2
+ // http://bugs.jquery.com/ticket/9917
+ // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
+ // We can't differentiate between "" and 0 here, so we just assume
+ // empty string since it's likely to be a more common value...
+ if ( val === undefined ) {
+ val = "";
+ }
+ element.css( set[ i ], val );
+ }
+ }
+ },
+
+ setMode: function( el, mode ) {
+ if (mode === "toggle") {
+ mode = el.is( ":hidden" ) ? "show" : "hide";
+ }
+ return mode;
+ },
+
+ // Translates a [top,left] array into a baseline value
+ // this should be a little more flexible in the future to handle a string & hash
+ getBaseline: function( origin, original ) {
+ var y, x;
+ switch ( origin[ 0 ] ) {
+ case "top": y = 0; break;
+ case "middle": y = 0.5; break;
+ case "bottom": y = 1; break;
+ default: y = origin[ 0 ] / original.height;
+ }
+ switch ( origin[ 1 ] ) {
+ case "left": x = 0; break;
+ case "center": x = 0.5; break;
+ case "right": x = 1; break;
+ default: x = origin[ 1 ] / original.width;
+ }
+ return {
+ x: x,
+ y: y
+ };
+ },
+
+ // Wraps the element around a wrapper that copies position properties
+ createWrapper: function( element ) {
+
+ // if the element is already wrapped, return it
+ if ( element.parent().is( ".ui-effects-wrapper" )) {
+ return element.parent();
+ }
+
+ // wrap the element
+ var props = {
+ width: element.outerWidth(true),
+ height: element.outerHeight(true),
+ "float": element.css( "float" )
+ },
+ wrapper = $( "<div></div>" )
+ .addClass( "ui-effects-wrapper" )
+ .css({
+ fontSize: "100%",
+ background: "transparent",
+ border: "none",
+ margin: 0,
+ padding: 0
+ }),
+ // Store the size in case width/height are defined in % - Fixes #5245
+ size = {
+ width: element.width(),
+ height: element.height()
+ },
+ active = document.activeElement;
+
+ // support: Firefox
+ // Firefox incorrectly exposes anonymous content
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
+ try {
+ active.id;
+ } catch( e ) {
+ active = document.body;
+ }
+
+ element.wrap( wrapper );
+
+ // Fixes #7595 - Elements lose focus when wrapped.
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
+ $( active ).focus();
+ }
+
+ wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
+
+ // transfer positioning properties to the wrapper
+ if ( element.css( "position" ) === "static" ) {
+ wrapper.css({ position: "relative" });
+ element.css({ position: "relative" });
+ } else {
+ $.extend( props, {
+ position: element.css( "position" ),
+ zIndex: element.css( "z-index" )
+ });
+ $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
+ props[ pos ] = element.css( pos );
+ if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
+ props[ pos ] = "auto";
+ }
+ });
+ element.css({
+ position: "relative",
+ top: 0,
+ left: 0,
+ right: "auto",
+ bottom: "auto"
+ });
+ }
+ element.css(size);
+
+ return wrapper.css( props ).show();
+ },
+
+ removeWrapper: function( element ) {
+ var active = document.activeElement;
+
+ if ( element.parent().is( ".ui-effects-wrapper" ) ) {
+ element.parent().replaceWith( element );
+
+ // Fixes #7595 - Elements lose focus when wrapped.
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
+ $( active ).focus();
+ }
+ }
+
+
+ return element;
+ },
+
+ setTransition: function( element, list, factor, value ) {
+ value = value || {};
+ $.each( list, function( i, x ) {
+ var unit = element.cssUnit( x );
+ if ( unit[ 0 ] > 0 ) {
+ value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
+ }
+ });
+ return value;
+ }
+});
+
+// return an effect options object for the given parameters:
+function _normalizeArguments( effect, options, speed, callback ) {
+
+ // allow passing all options as the first parameter
+ if ( $.isPlainObject( effect ) ) {
+ options = effect;
+ effect = effect.effect;
+ }
+
+ // convert to an object
+ effect = { effect: effect };
+
+ // catch (effect, null, ...)
+ if ( options == null ) {
+ options = {};
+ }
+
+ // catch (effect, callback)
+ if ( $.isFunction( options ) ) {
+ callback = options;
+ speed = null;
+ options = {};
+ }
+
+ // catch (effect, speed, ?)
+ if ( typeof options === "number" || $.fx.speeds[ options ] ) {
+ callback = speed;
+ speed = options;
+ options = {};
+ }
+
+ // catch (effect, options, callback)
+ if ( $.isFunction( speed ) ) {
+ callback = speed;
+ speed = null;
+ }
+
+ // add options to effect
+ if ( options ) {
+ $.extend( effect, options );
+ }
+
+ speed = speed || options.duration;
+ effect.duration = $.fx.off ? 0 :
+ typeof speed === "number" ? speed :
+ speed in $.fx.speeds ? $.fx.speeds[ speed ] :
+ $.fx.speeds._default;
+
+ effect.complete = callback || options.complete;
+
+ return effect;
+}
+
+function standardSpeed( speed ) {
+ // valid standard speeds
+ if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
+ return true;
+ }
+
+ // invalid strings - treat as "normal" speed
+ if ( typeof speed === "string" && !$.effects.effect[ speed ] ) {
+ // TODO: remove in 2.0 (#7115)
+ if ( backCompat && $.effects[ speed ] ) {
+ return false;
+ }
+ return true;
+ }
+
+ return false;
+}
+
+$.fn.extend({
+ effect: function( /* effect, options, speed, callback */ ) {
+ var args = _normalizeArguments.apply( this, arguments ),
+ mode = args.mode,
+ queue = args.queue,
+ effectMethod = $.effects.effect[ args.effect ],
+
+ // DEPRECATED: remove in 2.0 (#7115)
+ oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ];
+
+ if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) {
+ // delegate to the original method (e.g., .show()) if possible
+ if ( mode ) {
+ return this[ mode ]( args.duration, args.complete );
+ } else {
+ return this.each( function() {
+ if ( args.complete ) {
+ args.complete.call( this );
+ }
+ });
+ }
+ }
+
+ function run( next ) {
+ var elem = $( this ),
+ complete = args.complete,
+ mode = args.mode;
+
+ function done() {
+ if ( $.isFunction( complete ) ) {
+ complete.call( elem[0] );
+ }
+ if ( $.isFunction( next ) ) {
+ next();
+ }
+ }
+
+ // if the element is hiddden and mode is hide,
+ // or element is visible and mode is show
+ if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
+ done();
+ } else {
+ effectMethod.call( elem[0], args, done );
+ }
+ }
+
+ // TODO: remove this check in 2.0, effectMethod will always be true
+ if ( effectMethod ) {
+ return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
+ } else {
+ // DEPRECATED: remove in 2.0 (#7115)
+ return oldEffectMethod.call(this, {
+ options: args,
+ duration: args.duration,
+ callback: args.complete,
+ mode: args.mode
+ });
+ }
+ },
+
+ _show: $.fn.show,
+ show: function( speed ) {
+ if ( standardSpeed( speed ) ) {
+ return this._show.apply( this, arguments );
+ } else {
+ var args = _normalizeArguments.apply( this, arguments );
+ args.mode = "show";
+ return this.effect.call( this, args );
+ }
+ },
+
+ _hide: $.fn.hide,
+ hide: function( speed ) {
+ if ( standardSpeed( speed ) ) {
+ return this._hide.apply( this, arguments );
+ } else {
+ var args = _normalizeArguments.apply( this, arguments );
+ args.mode = "hide";
+ return this.effect.call( this, args );
+ }
+ },
+
+ // jQuery core overloads toggle and creates _toggle
+ __toggle: $.fn.toggle,
+ toggle: function( speed ) {
+ if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
+ return this.__toggle.apply( this, arguments );
+ } else {
+ var args = _normalizeArguments.apply( this, arguments );
+ args.mode = "toggle";
+ return this.effect.call( this, args );
+ }
+ },
+
+ // helper functions
+ cssUnit: function(key) {
+ var style = this.css( key ),
+ val = [];
+
+ $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
+ if ( style.indexOf( unit ) > 0 ) {
+ val = [ parseFloat( style ), unit ];
+ }
+ });
+ return val;
+ }
+});
+
+})();
+
+/******************************************************************************/
+/*********************************** EASING ***********************************/
+/******************************************************************************/
+
+(function() {
+
+// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
+
+var baseEasings = {};
+
+$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
+ baseEasings[ name ] = function( p ) {
+ return Math.pow( p, i + 2 );
+ };
+});
+
+$.extend( baseEasings, {
+ Sine: function ( p ) {
+ return 1 - Math.cos( p * Math.PI / 2 );
+ },
+ Circ: function ( p ) {
+ return 1 - Math.sqrt( 1 - p * p );
+ },
+ Elastic: function( p ) {
+ return p === 0 || p === 1 ? p :
+ -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
+ },
+ Back: function( p ) {
+ return p * p * ( 3 * p - 2 );
+ },
+ Bounce: function ( p ) {
+ var pow2,
+ bounce = 4;
+
+ while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
+ return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
+ }
+});
+
+$.each( baseEasings, function( name, easeIn ) {
+ $.easing[ "easeIn" + name ] = easeIn;
+ $.easing[ "easeOut" + name ] = function( p ) {
+ return 1 - easeIn( 1 - p );
+ };
+ $.easing[ "easeInOut" + name ] = function( p ) {
+ return p < 0.5 ?
+ easeIn( p * 2 ) / 2 :
+ 1 - easeIn( p * -2 + 2 ) / 2;
+ };
+});
+
+})();
+
+})(jQuery));
+(function( $, undefined ) {
+
+var rvertical = /up|down|vertical/,
+ rpositivemotion = /up|left|vertical|horizontal/;
+
+$.effects.effect.blind = function( o, done ) {
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ direction = o.direction || "up",
+ vertical = rvertical.test( direction ),
+ ref = vertical ? "height" : "width",
+ ref2 = vertical ? "top" : "left",
+ motion = rpositivemotion.test( direction ),
+ animation = {},
+ show = mode === "show",
+ wrapper, distance, margin;
+
+ // if already wrapped, the wrapper's properties are my property. #6245
+ if ( el.parent().is( ".ui-effects-wrapper" ) ) {
+ $.effects.save( el.parent(), props );
+ } else {
+ $.effects.save( el, props );
+ }
+ el.show();
+ wrapper = $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+
+ distance = wrapper[ ref ]();
+ margin = parseFloat( wrapper.css( ref2 ) ) || 0;
+
+ animation[ ref ] = show ? distance : 0;
+ if ( !motion ) {
+ el
+ .css( vertical ? "bottom" : "right", 0 )
+ .css( vertical ? "top" : "left", "auto" )
+ .css({ position: "absolute" });
+
+ animation[ ref2 ] = show ? margin : distance + margin;
+ }
+
+ // start at 0 if we are showing
+ if ( show ) {
+ wrapper.css( ref, 0 );
+ if ( ! motion ) {
+ wrapper.css( ref2, margin + distance );
+ }
+ }
+
+ // Animate
+ wrapper.animate( animation, {
+ duration: o.duration,
+ easing: o.easing,
+ queue: false,
+ complete: function() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.bounce = function( o, done ) {
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+
+ // defaults:
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ hide = mode === "hide",
+ show = mode === "show",
+ direction = o.direction || "up",
+ distance = o.distance,
+ times = o.times || 5,
+
+ // number of internal animations
+ anims = times * 2 + ( show || hide ? 1 : 0 ),
+ speed = o.duration / anims,
+ easing = o.easing,
+
+ // utility:
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
+ motion = ( direction === "up" || direction === "left" ),
+ i,
+ upAnim,
+ downAnim,
+
+ // we will need to re-assemble the queue to stack our animations in place
+ queue = el.queue(),
+ queuelen = queue.length;
+
+ // Avoid touching opacity to prevent clearType and PNG issues in IE
+ if ( show || hide ) {
+ props.push( "opacity" );
+ }
+
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el ); // Create Wrapper
+
+ // default distance for the BIGGEST bounce is the outer Distance / 3
+ if ( !distance ) {
+ distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
+ }
+
+ if ( show ) {
+ downAnim = { opacity: 1 };
+ downAnim[ ref ] = 0;
+
+ // if we are showing, force opacity 0 and set the initial position
+ // then do the "first" animation
+ el.css( "opacity", 0 )
+ .css( ref, motion ? -distance * 2 : distance * 2 )
+ .animate( downAnim, speed, easing );
+ }
+
+ // start at the smallest distance if we are hiding
+ if ( hide ) {
+ distance = distance / Math.pow( 2, times - 1 );
+ }
+
+ downAnim = {};
+ downAnim[ ref ] = 0;
+ // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
+ for ( i = 0; i < times; i++ ) {
+ upAnim = {};
+ upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
+
+ el.animate( upAnim, speed, easing )
+ .animate( downAnim, speed, easing );
+
+ distance = hide ? distance * 2 : distance / 2;
+ }
+
+ // Last Bounce when Hiding
+ if ( hide ) {
+ upAnim = { opacity: 0 };
+ upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
+
+ el.animate( upAnim, speed, easing );
+ }
+
+ el.queue(function() {
+ if ( hide ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ });
+
+ // inject all the animations we just queued to be first in line (after "inprogress")
+ if ( queuelen > 1) {
+ queue.splice.apply( queue,
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ }
+ el.dequeue();
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.clip = function( o, done ) {
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+ direction = o.direction || "vertical",
+ vert = direction === "vertical",
+ size = vert ? "height" : "width",
+ position = vert ? "top" : "left",
+ animation = {},
+ wrapper, animate, distance;
+
+ // Save & Show
+ $.effects.save( el, props );
+ el.show();
+
+ // Create Wrapper
+ wrapper = $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+ animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
+ distance = animate[ size ]();
+
+ // Shift
+ if ( show ) {
+ animate.css( size, 0 );
+ animate.css( position, distance / 2 );
+ }
+
+ // Create Animation Object:
+ animation[ size ] = show ? distance : 0;
+ animation[ position ] = show ? 0 : distance / 2;
+
+ // Animate
+ animate.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( !show ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.drop = function( o, done ) {
+
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+ direction = o.direction || "left",
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
+ motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
+ animation = {
+ opacity: show ? 1 : 0
+ },
+ distance;
+
+ // Adjust
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el );
+
+ distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2;
+
+ if ( show ) {
+ el
+ .css( "opacity", 0 )
+ .css( ref, motion === "pos" ? -distance : distance );
+ }
+
+ // Animation
+ animation[ ref ] = ( show ?
+ ( motion === "pos" ? "+=" : "-=" ) :
+ ( motion === "pos" ? "-=" : "+=" ) ) +
+ distance;
+
+ // Animate
+ el.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.explode = function( o, done ) {
+
+ var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
+ cells = rows,
+ el = $( this ),
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+
+ // show and then visibility:hidden the element before calculating offset
+ offset = el.show().css( "visibility", "hidden" ).offset(),
+
+ // width and height of a piece
+ width = Math.ceil( el.outerWidth() / cells ),
+ height = Math.ceil( el.outerHeight() / rows ),
+ pieces = [],
+
+ // loop
+ i, j, left, top, mx, my;
+
+ // children animate complete:
+ function childComplete() {
+ pieces.push( this );
+ if ( pieces.length === rows * cells ) {
+ animComplete();
+ }
+ }
+
+ // clone the element for each row and cell.
+ for( i = 0; i < rows ; i++ ) { // ===>
+ top = offset.top + i * height;
+ my = i - ( rows - 1 ) / 2 ;
+
+ for( j = 0; j < cells ; j++ ) { // |||
+ left = offset.left + j * width;
+ mx = j - ( cells - 1 ) / 2 ;
+
+ // Create a clone of the now hidden main element that will be absolute positioned
+ // within a wrapper div off the -left and -top equal to size of our pieces
+ el
+ .clone()
+ .appendTo( "body" )
+ .wrap( "<div></div>" )
+ .css({
+ position: "absolute",
+ visibility: "visible",
+ left: -j * width,
+ top: -i * height
+ })
+
+ // select the wrapper - make it overflow: hidden and absolute positioned based on
+ // where the original was located +left and +top equal to the size of pieces
+ .parent()
+ .addClass( "ui-effects-explode" )
+ .css({
+ position: "absolute",
+ overflow: "hidden",
+ width: width,
+ height: height,
+ left: left + ( show ? mx * width : 0 ),
+ top: top + ( show ? my * height : 0 ),
+ opacity: show ? 0 : 1
+ }).animate({
+ left: left + ( show ? 0 : mx * width ),
+ top: top + ( show ? 0 : my * height ),
+ opacity: show ? 1 : 0
+ }, o.duration || 500, o.easing, childComplete );
+ }
+ }
+
+ function animComplete() {
+ el.css({
+ visibility: "visible"
+ });
+ $( pieces ).remove();
+ if ( !show ) {
+ el.hide();
+ }
+ done();
+ }
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.fade = function( o, done ) {
+ var el = $( this ),
+ mode = $.effects.setMode( el, o.mode || "toggle" );
+
+ el.animate({
+ opacity: mode
+ }, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: done
+ });
+};
+
+})( jQuery );
+(function( $, undefined ) {
+
+$.effects.effect.fold = function( o, done ) {
+
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+ hide = mode === "hide",
+ size = o.size || 15,
+ percent = /([0-9]+)%/.exec( size ),
+ horizFirst = !!o.horizFirst,
+ widthFirst = show !== horizFirst,
+ ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
+ duration = o.duration / 2,
+ wrapper, distance,
+ animation1 = {},
+ animation2 = {};
+
+ $.effects.save( el, props );
+ el.show();
+
+ // Create Wrapper
+ wrapper = $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+ distance = widthFirst ?
+ [ wrapper.width(), wrapper.height() ] :
+ [ wrapper.height(), wrapper.width() ];
+
+ if ( percent ) {
+ size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
+ }
+ if ( show ) {
+ wrapper.css( horizFirst ? {
+ height: 0,
+ width: size
+ } : {
+ height: size,
+ width: 0
+ });
+ }
+
+ // Animation
+ animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
+ animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
+
+ // Animate
+ wrapper
+ .animate( animation1, duration, o.easing )
+ .animate( animation2, duration, o.easing, function() {
+ if ( hide ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ });
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.highlight = function( o, done ) {
+ var elem = $( this ),
+ props = [ "backgroundImage", "backgroundColor", "opacity" ],
+ mode = $.effects.setMode( elem, o.mode || "show" ),
+ animation = {
+ backgroundColor: elem.css( "backgroundColor" )
+ };
+
+ if (mode === "hide") {
+ animation.opacity = 0;
+ }
+
+ $.effects.save( elem, props );
+
+ elem
+ .show()
+ .css({
+ backgroundImage: "none",
+ backgroundColor: o.color || "#ffff99"
+ })
+ .animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( mode === "hide" ) {
+ elem.hide();
+ }
+ $.effects.restore( elem, props );
+ done();
+ }
+ });
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.pulsate = function( o, done ) {
+ var elem = $( this ),
+ mode = $.effects.setMode( elem, o.mode || "show" ),
+ show = mode === "show",
+ hide = mode === "hide",
+ showhide = ( show || mode === "hide" ),
+
+ // showing or hiding leaves of the "last" animation
+ anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
+ duration = o.duration / anims,
+ animateTo = 0,
+ queue = elem.queue(),
+ queuelen = queue.length,
+ i;
+
+ if ( show || !elem.is(":visible")) {
+ elem.css( "opacity", 0 ).show();
+ animateTo = 1;
+ }
+
+ // anims - 1 opacity "toggles"
+ for ( i = 1; i < anims; i++ ) {
+ elem.animate({
+ opacity: animateTo
+ }, duration, o.easing );
+ animateTo = 1 - animateTo;
+ }
+
+ elem.animate({
+ opacity: animateTo
+ }, duration, o.easing);
+
+ elem.queue(function() {
+ if ( hide ) {
+ elem.hide();
+ }
+ done();
+ });
+
+ // We just queued up "anims" animations, we need to put them next in the queue
+ if ( queuelen > 1 ) {
+ queue.splice.apply( queue,
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ }
+ elem.dequeue();
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.puff = function( o, done ) {
+ var elem = $( this ),
+ mode = $.effects.setMode( elem, o.mode || "hide" ),
+ hide = mode === "hide",
+ percent = parseInt( o.percent, 10 ) || 150,
+ factor = percent / 100,
+ original = {
+ height: elem.height(),
+ width: elem.width(),
+ outerHeight: elem.outerHeight(),
+ outerWidth: elem.outerWidth()
+ };
+
+ $.extend( o, {
+ effect: "scale",
+ queue: false,
+ fade: true,
+ mode: mode,
+ complete: done,
+ percent: hide ? percent : 100,
+ from: hide ?
+ original :
+ {
+ height: original.height * factor,
+ width: original.width * factor,
+ outerHeight: original.outerHeight * factor,
+ outerWidth: original.outerWidth * factor
+ }
+ });
+
+ elem.effect( o );
+};
+
+$.effects.effect.scale = function( o, done ) {
+
+ // Create element
+ var el = $( this ),
+ options = $.extend( true, {}, o ),
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ percent = parseInt( o.percent, 10 ) ||
+ ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
+ direction = o.direction || "both",
+ origin = o.origin,
+ original = {
+ height: el.height(),
+ width: el.width(),
+ outerHeight: el.outerHeight(),
+ outerWidth: el.outerWidth()
+ },
+ factor = {
+ y: direction !== "horizontal" ? (percent / 100) : 1,
+ x: direction !== "vertical" ? (percent / 100) : 1
+ };
+
+ // We are going to pass this effect to the size effect:
+ options.effect = "size";
+ options.queue = false;
+ options.complete = done;
+
+ // Set default origin and restore for show/hide
+ if ( mode !== "effect" ) {
+ options.origin = origin || ["middle","center"];
+ options.restore = true;
+ }
+
+ options.from = o.from || ( mode === "show" ? {
+ height: 0,
+ width: 0,
+ outerHeight: 0,
+ outerWidth: 0
+ } : original );
+ options.to = {
+ height: original.height * factor.y,
+ width: original.width * factor.x,
+ outerHeight: original.outerHeight * factor.y,
+ outerWidth: original.outerWidth * factor.x
+ };
+
+ // Fade option to support puff
+ if ( options.fade ) {
+ if ( mode === "show" ) {
+ options.from.opacity = 0;
+ options.to.opacity = 1;
+ }
+ if ( mode === "hide" ) {
+ options.from.opacity = 1;
+ options.to.opacity = 0;
+ }
+ }
+
+ // Animate
+ el.effect( options );
+
+};
+
+$.effects.effect.size = function( o, done ) {
+
+ // Create element
+ var original, baseline, factor,
+ el = $( this ),
+ props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
+
+ // Always restore
+ props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
+
+ // Copy for children
+ props2 = [ "width", "height", "overflow" ],
+ cProps = [ "fontSize" ],
+ vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
+ hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
+
+ // Set options
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ restore = o.restore || mode !== "effect",
+ scale = o.scale || "both",
+ origin = o.origin || [ "middle", "center" ],
+ position = el.css( "position" ),
+ props = restore ? props0 : props1,
+ zero = {
+ height: 0,
+ width: 0,
+ outerHeight: 0,
+ outerWidth: 0
+ };
+
+ if ( mode === "show" ) {
+ el.show();
+ }
+ original = {
+ height: el.height(),
+ width: el.width(),
+ outerHeight: el.outerHeight(),
+ outerWidth: el.outerWidth()
+ };
+
+ if ( o.mode === "toggle" && mode === "show" ) {
+ el.from = o.to || zero;
+ el.to = o.from || original;
+ } else {
+ el.from = o.from || ( mode === "show" ? zero : original );
+ el.to = o.to || ( mode === "hide" ? zero : original );
+ }
+
+ // Set scaling factor
+ factor = {
+ from: {
+ y: el.from.height / original.height,
+ x: el.from.width / original.width
+ },
+ to: {
+ y: el.to.height / original.height,
+ x: el.to.width / original.width
+ }
+ };
+
+ // Scale the css box
+ if ( scale === "box" || scale === "both" ) {
+
+ // Vertical props scaling
+ if ( factor.from.y !== factor.to.y ) {
+ props = props.concat( vProps );
+ el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
+ el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
+ }
+
+ // Horizontal props scaling
+ if ( factor.from.x !== factor.to.x ) {
+ props = props.concat( hProps );
+ el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
+ el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
+ }
+ }
+
+ // Scale the content
+ if ( scale === "content" || scale === "both" ) {
+
+ // Vertical props scaling
+ if ( factor.from.y !== factor.to.y ) {
+ props = props.concat( cProps ).concat( props2 );
+ el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
+ el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
+ }
+ }
+
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el );
+ el.css( "overflow", "hidden" ).css( el.from );
+
+ // Adjust
+ if (origin) { // Calculate baseline shifts
+ baseline = $.effects.getBaseline( origin, original );
+ el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
+ el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
+ el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
+ el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
+ }
+ el.css( el.from ); // set top & left
+
+ // Animate
+ if ( scale === "content" || scale === "both" ) { // Scale the children
+
+ // Add margins/font-size
+ vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
+ hProps = hProps.concat([ "marginLeft", "marginRight" ]);
+ props2 = props0.concat(vProps).concat(hProps);
+
+ el.find( "*[width]" ).each( function(){
+ var child = $( this ),
+ c_original = {
+ height: child.height(),
+ width: child.width(),
+ outerHeight: child.outerHeight(),
+ outerWidth: child.outerWidth()
+ };
+ if (restore) {
+ $.effects.save(child, props2);
+ }
+
+ child.from = {
+ height: c_original.height * factor.from.y,
+ width: c_original.width * factor.from.x,
+ outerHeight: c_original.outerHeight * factor.from.y,
+ outerWidth: c_original.outerWidth * factor.from.x
+ };
+ child.to = {
+ height: c_original.height * factor.to.y,
+ width: c_original.width * factor.to.x,
+ outerHeight: c_original.height * factor.to.y,
+ outerWidth: c_original.width * factor.to.x
+ };
+
+ // Vertical props scaling
+ if ( factor.from.y !== factor.to.y ) {
+ child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
+ child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
+ }
+
+ // Horizontal props scaling
+ if ( factor.from.x !== factor.to.x ) {
+ child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
+ child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
+ }
+
+ // Animate children
+ child.css( child.from );
+ child.animate( child.to, o.duration, o.easing, function() {
+
+ // Restore children
+ if ( restore ) {
+ $.effects.restore( child, props2 );
+ }
+ });
+ });
+ }
+
+ // Animate
+ el.animate( el.to, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( el.to.opacity === 0 ) {
+ el.css( "opacity", el.from.opacity );
+ }
+ if( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ if ( !restore ) {
+
+ // we need to calculate our new positioning based on the scaling
+ if ( position === "static" ) {
+ el.css({
+ position: "relative",
+ top: el.to.top,
+ left: el.to.left
+ });
+ } else {
+ $.each([ "top", "left" ], function( idx, pos ) {
+ el.css( pos, function( _, str ) {
+ var val = parseInt( str, 10 ),
+ toRef = idx ? el.to.left : el.to.top;
+
+ // if original was "auto", recalculate the new value from wrapper
+ if ( str === "auto" ) {
+ return toRef + "px";
+ }
+
+ return val + toRef + "px";
+ });
+ });
+ }
+ }
+
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.shake = function( o, done ) {
+
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ direction = o.direction || "left",
+ distance = o.distance || 20,
+ times = o.times || 3,
+ anims = times * 2 + 1,
+ speed = Math.round(o.duration/anims),
+ ref = (direction === "up" || direction === "down") ? "top" : "left",
+ positiveMotion = (direction === "up" || direction === "left"),
+ animation = {},
+ animation1 = {},
+ animation2 = {},
+ i,
+
+ // we will need to re-assemble the queue to stack our animations in place
+ queue = el.queue(),
+ queuelen = queue.length;
+
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el );
+
+ // Animation
+ animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
+ animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
+ animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
+
+ // Animate
+ el.animate( animation, speed, o.easing );
+
+ // Shakes
+ for ( i = 1; i < times; i++ ) {
+ el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
+ }
+ el
+ .animate( animation1, speed, o.easing )
+ .animate( animation, speed / 2, o.easing )
+ .queue(function() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ });
+
+ // inject all the animations we just queued to be first in line (after "inprogress")
+ if ( queuelen > 1) {
+ queue.splice.apply( queue,
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ }
+ el.dequeue();
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.slide = function( o, done ) {
+
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
+ mode = $.effects.setMode( el, o.mode || "show" ),
+ show = mode === "show",
+ direction = o.direction || "left",
+ ref = (direction === "up" || direction === "down") ? "top" : "left",
+ positiveMotion = (direction === "up" || direction === "left"),
+ distance,
+ animation = {};
+
+ // Adjust
+ $.effects.save( el, props );
+ el.show();
+ distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
+
+ $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+
+ if ( show ) {
+ el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
+ }
+
+ // Animation
+ animation[ ref ] = ( show ?
+ ( positiveMotion ? "+=" : "-=") :
+ ( positiveMotion ? "-=" : "+=")) +
+ distance;
+
+ // Animate
+ el.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.transfer = function( o, done ) {
+ var elem = $( this ),
+ target = $( o.to ),
+ targetFixed = target.css( "position" ) === "fixed",
+ body = $("body"),
+ fixTop = targetFixed ? body.scrollTop() : 0,
+ fixLeft = targetFixed ? body.scrollLeft() : 0,
+ endPosition = target.offset(),
+ animation = {
+ top: endPosition.top - fixTop ,
+ left: endPosition.left - fixLeft ,
+ height: target.innerHeight(),
+ width: target.innerWidth()
+ },
+ startPosition = elem.offset(),
+ transfer = $( '<div class="ui-effects-transfer"></div>' )
+ .appendTo( document.body )
+ .addClass( o.className )
+ .css({
+ top: startPosition.top - fixTop ,
+ left: startPosition.left - fixLeft ,
+ height: elem.innerHeight(),
+ width: elem.innerWidth(),
+ position: targetFixed ? "fixed" : "absolute"
+ })
+ .animate( animation, o.duration, o.easing, function() {
+ transfer.remove();
+ done();
+ });
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+var mouseHandled = false;
+
+$.widget( "ui.menu", {
+ version: "1.9.2",
+ defaultElement: "<ul>",
+ delay: 300,
+ options: {
+ icons: {
+ submenu: "ui-icon-carat-1-e"
+ },
+ menus: "ul",
+ position: {
+ my: "left top",
+ at: "right top"
+ },
+ role: "menu",
+
+ // callbacks
+ blur: null,
+ focus: null,
+ select: null
+ },
+
+ _create: function() {
+ this.activeMenu = this.element;
+ this.element
+ .uniqueId()
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+ .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
+ .attr({
+ role: this.options.role,
+ tabIndex: 0
+ })
+ // need to catch all clicks on disabled menu
+ // not possible through _on
+ .bind( "click" + this.eventNamespace, $.proxy(function( event ) {
+ if ( this.options.disabled ) {
+ event.preventDefault();
+ }
+ }, this ));
+
+ if ( this.options.disabled ) {
+ this.element
+ .addClass( "ui-state-disabled" )
+ .attr( "aria-disabled", "true" );
+ }
+
+ this._on({
+ // Prevent focus from sticking to links inside menu after clicking
+ // them (focus should always stay on UL during navigation).
+ "mousedown .ui-menu-item > a": function( event ) {
+ event.preventDefault();
+ },
+ "click .ui-state-disabled > a": function( event ) {
+ event.preventDefault();
+ },
+ "click .ui-menu-item:has(a)": function( event ) {
+ var target = $( event.target ).closest( ".ui-menu-item" );
+ if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) {
+ mouseHandled = true;
+
+ this.select( event );
+ // Open submenu on click
+ if ( target.has( ".ui-menu" ).length ) {
+ this.expand( event );
+ } else if ( !this.element.is( ":focus" ) ) {
+ // Redirect focus to the menu
+ this.element.trigger( "focus", [ true ] );
+
+ // If the active item is on the top level, let it stay active.
+ // Otherwise, blur the active item since it is no longer visible.
+ if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
+ clearTimeout( this.timer );
+ }
+ }
+ }
+ },
+ "mouseenter .ui-menu-item": function( event ) {
+ var target = $( event.currentTarget );
+ // Remove ui-state-active class from siblings of the newly focused menu item
+ // to avoid a jump caused by adjacent elements both having a class with a border
+ target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
+ this.focus( event, target );
+ },
+ mouseleave: "collapseAll",
+ "mouseleave .ui-menu": "collapseAll",
+ focus: function( event, keepActiveItem ) {
+ // If there's already an active item, keep it active
+ // If not, activate the first item
+ var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 );
+
+ if ( !keepActiveItem ) {
+ this.focus( event, item );
+ }
+ },
+ blur: function( event ) {
+ this._delay(function() {
+ if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
+ this.collapseAll( event );
+ }
+ });
+ },
+ keydown: "_keydown"
+ });
+
+ this.refresh();
+
+ // Clicks outside of a menu collapse any open menus
+ this._on( this.document, {
+ click: function( event ) {
+ if ( !$( event.target ).closest( ".ui-menu" ).length ) {
+ this.collapseAll( event );
+ }
+
+ // Reset the mouseHandled flag
+ mouseHandled = false;
+ }
+ });
+ },
+
+ _destroy: function() {
+ // Destroy (sub)menus
+ this.element
+ .removeAttr( "aria-activedescendant" )
+ .find( ".ui-menu" ).andSelf()
+ .removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
+ .removeAttr( "role" )
+ .removeAttr( "tabIndex" )
+ .removeAttr( "aria-labelledby" )
+ .removeAttr( "aria-expanded" )
+ .removeAttr( "aria-hidden" )
+ .removeAttr( "aria-disabled" )
+ .removeUniqueId()
+ .show();
+
+ // Destroy menu items
+ this.element.find( ".ui-menu-item" )
+ .removeClass( "ui-menu-item" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-disabled" )
+ .children( "a" )
+ .removeUniqueId()
+ .removeClass( "ui-corner-all ui-state-hover" )
+ .removeAttr( "tabIndex" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-haspopup" )
+ .children().each( function() {
+ var elem = $( this );
+ if ( elem.data( "ui-menu-submenu-carat" ) ) {
+ elem.remove();
+ }
+ });
+
+ // Destroy menu dividers
+ this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
+ },
+
+ _keydown: function( event ) {
+ var match, prev, character, skip, regex,
+ preventDefault = true;
+
+ function escape( value ) {
+ return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
+ }
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.PAGE_UP:
+ this.previousPage( event );
+ break;
+ case $.ui.keyCode.PAGE_DOWN:
+ this.nextPage( event );
+ break;
+ case $.ui.keyCode.HOME:
+ this._move( "first", "first", event );
+ break;
+ case $.ui.keyCode.END:
+ this._move( "last", "last", event );
+ break;
+ case $.ui.keyCode.UP:
+ this.previous( event );
+ break;
+ case $.ui.keyCode.DOWN:
+ this.next( event );
+ break;
+ case $.ui.keyCode.LEFT:
+ this.collapse( event );
+ break;
+ case $.ui.keyCode.RIGHT:
+ if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
+ this.expand( event );
+ }
+ break;
+ case $.ui.keyCode.ENTER:
+ case $.ui.keyCode.SPACE:
+ this._activate( event );
+ break;
+ case $.ui.keyCode.ESCAPE:
+ this.collapse( event );
+ break;
+ default:
+ preventDefault = false;
+ prev = this.previousFilter || "";
+ character = String.fromCharCode( event.keyCode );
+ skip = false;
+
+ clearTimeout( this.filterTimer );
+
+ if ( character === prev ) {
+ skip = true;
+ } else {
+ character = prev + character;
+ }
+
+ regex = new RegExp( "^" + escape( character ), "i" );
+ match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
+ return regex.test( $( this ).children( "a" ).text() );
+ });
+ match = skip && match.index( this.active.next() ) !== -1 ?
+ this.active.nextAll( ".ui-menu-item" ) :
+ match;
+
+ // If no matches on the current filter, reset to the last character pressed
+ // to move down the menu to the first item that starts with that character
+ if ( !match.length ) {
+ character = String.fromCharCode( event.keyCode );
+ regex = new RegExp( "^" + escape( character ), "i" );
+ match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
+ return regex.test( $( this ).children( "a" ).text() );
+ });
+ }
+
+ if ( match.length ) {
+ this.focus( event, match );
+ if ( match.length > 1 ) {
+ this.previousFilter = character;
+ this.filterTimer = this._delay(function() {
+ delete this.previousFilter;
+ }, 1000 );
+ } else {
+ delete this.previousFilter;
+ }
+ } else {
+ delete this.previousFilter;
+ }
+ }
+
+ if ( preventDefault ) {
+ event.preventDefault();
+ }
+ },
+
+ _activate: function( event ) {
+ if ( !this.active.is( ".ui-state-disabled" ) ) {
+ if ( this.active.children( "a[aria-haspopup='true']" ).length ) {
+ this.expand( event );
+ } else {
+ this.select( event );
+ }
+ }
+ },
+
+ refresh: function() {
+ var menus,
+ icon = this.options.icons.submenu,
+ submenus = this.element.find( this.options.menus );
+
+ // Initialize nested menus
+ submenus.filter( ":not(.ui-menu)" )
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+ .hide()
+ .attr({
+ role: this.options.role,
+ "aria-hidden": "true",
+ "aria-expanded": "false"
+ })
+ .each(function() {
+ var menu = $( this ),
+ item = menu.prev( "a" ),
+ submenuCarat = $( "<span>" )
+ .addClass( "ui-menu-icon ui-icon " + icon )
+ .data( "ui-menu-submenu-carat", true );
+
+ item
+ .attr( "aria-haspopup", "true" )
+ .prepend( submenuCarat );
+ menu.attr( "aria-labelledby", item.attr( "id" ) );
+ });
+
+ menus = submenus.add( this.element );
+
+ // Don't refresh list items that are already adapted
+ menus.children( ":not(.ui-menu-item):has(a)" )
+ .addClass( "ui-menu-item" )
+ .attr( "role", "presentation" )
+ .children( "a" )
+ .uniqueId()
+ .addClass( "ui-corner-all" )
+ .attr({
+ tabIndex: -1,
+ role: this._itemRole()
+ });
+
+ // Initialize unlinked menu-items containing spaces and/or dashes only as dividers
+ menus.children( ":not(.ui-menu-item)" ).each(function() {
+ var item = $( this );
+ // hyphen, em dash, en dash
+ if ( !/[^\-—–\s]/.test( item.text() ) ) {
+ item.addClass( "ui-widget-content ui-menu-divider" );
+ }
+ });
+
+ // Add aria-disabled attribute to any disabled menu item
+ menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
+
+ // If the active item has been removed, blur the menu
+ if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
+ this.blur();
+ }
+ },
+
+ _itemRole: function() {
+ return {
+ menu: "menuitem",
+ listbox: "option"
+ }[ this.options.role ];
+ },
+
+ focus: function( event, item ) {
+ var nested, focused;
+ this.blur( event, event && event.type === "focus" );
+
+ this._scrollIntoView( item );
+
+ this.active = item.first();
+ focused = this.active.children( "a" ).addClass( "ui-state-focus" );
+ // Only update aria-activedescendant if there's a role
+ // otherwise we assume focus is managed elsewhere
+ if ( this.options.role ) {
+ this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
+ }
+
+ // Highlight active parent menu item, if any
+ this.active
+ .parent()
+ .closest( ".ui-menu-item" )
+ .children( "a:first" )
+ .addClass( "ui-state-active" );
+
+ if ( event && event.type === "keydown" ) {
+ this._close();
+ } else {
+ this.timer = this._delay(function() {
+ this._close();
+ }, this.delay );
+ }
+
+ nested = item.children( ".ui-menu" );
+ if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
+ this._startOpening(nested);
+ }
+ this.activeMenu = item.parent();
+
+ this._trigger( "focus", event, { item: item } );
+ },
+
+ _scrollIntoView: function( item ) {
+ var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
+ if ( this._hasScroll() ) {
+ borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
+ paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
+ offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
+ scroll = this.activeMenu.scrollTop();
+ elementHeight = this.activeMenu.height();
+ itemHeight = item.height();
+
+ if ( offset < 0 ) {
+ this.activeMenu.scrollTop( scroll + offset );
+ } else if ( offset + itemHeight > elementHeight ) {
+ this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
+ }
+ }
+ },
+
+ blur: function( event, fromFocus ) {
+ if ( !fromFocus ) {
+ clearTimeout( this.timer );
+ }
+
+ if ( !this.active ) {
+ return;
+ }
+
+ this.active.children( "a" ).removeClass( "ui-state-focus" );
+ this.active = null;
+
+ this._trigger( "blur", event, { item: this.active } );
+ },
+
+ _startOpening: function( submenu ) {
+ clearTimeout( this.timer );
+
+ // Don't open if already open fixes a Firefox bug that caused a .5 pixel
+ // shift in the submenu position when mousing over the carat icon
+ if ( submenu.attr( "aria-hidden" ) !== "true" ) {
+ return;
+ }
+
+ this.timer = this._delay(function() {
+ this._close();
+ this._open( submenu );
+ }, this.delay );
+ },
+
+ _open: function( submenu ) {
+ var position = $.extend({
+ of: this.active
+ }, this.options.position );
+
+ clearTimeout( this.timer );
+ this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
+ .hide()
+ .attr( "aria-hidden", "true" );
+
+ submenu
+ .show()
+ .removeAttr( "aria-hidden" )
+ .attr( "aria-expanded", "true" )
+ .position( position );
+ },
+
+ collapseAll: function( event, all ) {
+ clearTimeout( this.timer );
+ this.timer = this._delay(function() {
+ // If we were passed an event, look for the submenu that contains the event
+ var currentMenu = all ? this.element :
+ $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
+
+ // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
+ if ( !currentMenu.length ) {
+ currentMenu = this.element;
+ }
+
+ this._close( currentMenu );
+
+ this.blur( event );
+ this.activeMenu = currentMenu;
+ }, this.delay );
+ },
+
+ // With no arguments, closes the currently active menu - if nothing is active
+ // it closes all menus. If passed an argument, it will search for menus BELOW
+ _close: function( startMenu ) {
+ if ( !startMenu ) {
+ startMenu = this.active ? this.active.parent() : this.element;
+ }
+
+ startMenu
+ .find( ".ui-menu" )
+ .hide()
+ .attr( "aria-hidden", "true" )
+ .attr( "aria-expanded", "false" )
+ .end()
+ .find( "a.ui-state-active" )
+ .removeClass( "ui-state-active" );
+ },
+
+ collapse: function( event ) {
+ var newItem = this.active &&
+ this.active.parent().closest( ".ui-menu-item", this.element );
+ if ( newItem && newItem.length ) {
+ this._close();
+ this.focus( event, newItem );
+ }
+ },
+
+ expand: function( event ) {
+ var newItem = this.active &&
+ this.active
+ .children( ".ui-menu " )
+ .children( ".ui-menu-item" )
+ .first();
+
+ if ( newItem && newItem.length ) {
+ this._open( newItem.parent() );
+
+ // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
+ this._delay(function() {
+ this.focus( event, newItem );
+ });
+ }
+ },
+
+ next: function( event ) {
+ this._move( "next", "first", event );
+ },
+
+ previous: function( event ) {
+ this._move( "prev", "last", event );
+ },
+
+ isFirstItem: function() {
+ return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
+ },
+
+ isLastItem: function() {
+ return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
+ },
+
+ _move: function( direction, filter, event ) {
+ var next;
+ if ( this.active ) {
+ if ( direction === "first" || direction === "last" ) {
+ next = this.active
+ [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
+ .eq( -1 );
+ } else {
+ next = this.active
+ [ direction + "All" ]( ".ui-menu-item" )
+ .eq( 0 );
+ }
+ }
+ if ( !next || !next.length || !this.active ) {
+ next = this.activeMenu.children( ".ui-menu-item" )[ filter ]();
+ }
+
+ this.focus( event, next );
+ },
+
+ nextPage: function( event ) {
+ var item, base, height;
+
+ if ( !this.active ) {
+ this.next( event );
+ return;
+ }
+ if ( this.isLastItem() ) {
+ return;
+ }
+ if ( this._hasScroll() ) {
+ base = this.active.offset().top;
+ height = this.element.height();
+ this.active.nextAll( ".ui-menu-item" ).each(function() {
+ item = $( this );
+ return item.offset().top - base - height < 0;
+ });
+
+ this.focus( event, item );
+ } else {
+ this.focus( event, this.activeMenu.children( ".ui-menu-item" )
+ [ !this.active ? "first" : "last" ]() );
+ }
+ },
+
+ previousPage: function( event ) {
+ var item, base, height;
+ if ( !this.active ) {
+ this.next( event );
+ return;
+ }
+ if ( this.isFirstItem() ) {
+ return;
+ }
+ if ( this._hasScroll() ) {
+ base = this.active.offset().top;
+ height = this.element.height();
+ this.active.prevAll( ".ui-menu-item" ).each(function() {
+ item = $( this );
+ return item.offset().top - base + height > 0;
+ });
+
+ this.focus( event, item );
+ } else {
+ this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
+ }
+ },
+
+ _hasScroll: function() {
+ return this.element.outerHeight() < this.element.prop( "scrollHeight" );
+ },
+
+ select: function( event ) {
+ // TODO: It should never be possible to not have an active item at this
+ // point, but the tests don't trigger mouseenter before click.
+ this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
+ var ui = { item: this.active };
+ if ( !this.active.has( ".ui-menu" ).length ) {
+ this.collapseAll( event, true );
+ }
+ this._trigger( "select", event, ui );
+ }
+});
+
+}( jQuery ));
+(function( $, undefined ) {
+
+$.widget( "ui.progressbar", {
+ version: "1.9.2",
+ options: {
+ value: 0,
+ max: 100
+ },
+
+ min: 0,
+
+ _create: function() {
+ this.element
+ .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+ .attr({
+ role: "progressbar",
+ "aria-valuemin": this.min,
+ "aria-valuemax": this.options.max,
+ "aria-valuenow": this._value()
+ });
+
+ this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
+ .appendTo( this.element );
+
+ this.oldValue = this._value();
+ this._refreshValue();
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-valuemin" )
+ .removeAttr( "aria-valuemax" )
+ .removeAttr( "aria-valuenow" );
+
+ this.valueDiv.remove();
+ },
+
+ value: function( newValue ) {
+ if ( newValue === undefined ) {
+ return this._value();
+ }
+
+ this._setOption( "value", newValue );
+ return this;
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "value" ) {
+ this.options.value = value;
+ this._refreshValue();
+ if ( this._value() === this.options.max ) {
+ this._trigger( "complete" );
+ }
+ }
+
+ this._super( key, value );
+ },
+
+ _value: function() {
+ var val = this.options.value;
+ // normalize invalid value
+ if ( typeof val !== "number" ) {
+ val = 0;
+ }
+ return Math.min( this.options.max, Math.max( this.min, val ) );
+ },
+
+ _percentage: function() {
+ return 100 * this._value() / this.options.max;
+ },
+
+ _refreshValue: function() {
+ var value = this.value(),
+ percentage = this._percentage();
+
+ if ( this.oldValue !== value ) {
+ this.oldValue = value;
+ this._trigger( "change" );
+ }
+
+ this.valueDiv
+ .toggle( value > this.min )
+ .toggleClass( "ui-corner-right", value === this.options.max )
+ .width( percentage.toFixed(0) + "%" );
+ this.element.attr( "aria-valuenow", value );
+ }
+});
+
+})( jQuery );
+(function( $, undefined ) {
+
+$.widget("ui.resizable", $.ui.mouse, {
+ version: "1.9.2",
+ widgetEventPrefix: "resize",
+ options: {
+ alsoResize: false,
+ animate: false,
+ animateDuration: "slow",
+ animateEasing: "swing",
+ aspectRatio: false,
+ autoHide: false,
+ containment: false,
+ ghost: false,
+ grid: false,
+ handles: "e,s,se",
+ helper: false,
+ maxHeight: null,
+ maxWidth: null,
+ minHeight: 10,
+ minWidth: 10,
+ zIndex: 1000
+ },
+ _create: function() {
+
+ var that = this, o = this.options;
+ this.element.addClass("ui-resizable");
+
+ $.extend(this, {
+ _aspectRatio: !!(o.aspectRatio),
+ aspectRatio: o.aspectRatio,
+ originalElement: this.element,
+ _proportionallyResizeElements: [],
+ _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
+ });
+
+ //Wrap the element if it cannot hold child nodes
+ if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
+
+ //Create a wrapper element and set the wrapper to the new current internal element
+ this.element.wrap(
+ $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
+ position: this.element.css('position'),
+ width: this.element.outerWidth(),
+ height: this.element.outerHeight(),
+ top: this.element.css('top'),
+ left: this.element.css('left')
+ })
+ );
+
+ //Overwrite the original this.element
+ this.element = this.element.parent().data(
+ "resizable", this.element.data('resizable')
+ );
+
+ this.elementIsWrapper = true;
+
+ //Move margins to the wrapper
+ this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
+ this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
+
+ //Prevent Safari textarea resize
+ this.originalResizeStyle = this.originalElement.css('resize');
+ this.originalElement.css('resize', 'none');
+
+ //Push the actual element to our proportionallyResize internal array
+ this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
+
+ // avoid IE jump (hard set the margin)
+ this.originalElement.css({ margin: this.originalElement.css('margin') });
+
+ // fix handlers offset
+ this._proportionallyResize();
+
+ }
+
+ this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' });
+ if(this.handles.constructor == String) {
+
+ if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
+ var n = this.handles.split(","); this.handles = {};
+
+ for(var i = 0; i < n.length; i++) {
+
+ var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
+ var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
+
+ // Apply zIndex to all handles - see #7960
+ axis.css({ zIndex: o.zIndex });
+
+ //TODO : What's going on here?
+ if ('se' == handle) {
+ axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
+ };
+
+ //Insert into internal handles object and append to element
+ this.handles[handle] = '.ui-resizable-'+handle;
+ this.element.append(axis);
+ }
+
+ }
+
+ this._renderAxis = function(target) {
+
+ target = target || this.element;
+
+ for(var i in this.handles) {
+
+ if(this.handles[i].constructor == String)
+ this.handles[i] = $(this.handles[i], this.element).show();
+
+ //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
+ if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
+
+ var axis = $(this.handles[i], this.element), padWrapper = 0;
+
+ //Checking the correct pad and border
+ padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
+
+ //The padding type i have to apply...
+ var padPos = [ 'padding',
+ /ne|nw|n/.test(i) ? 'Top' :
+ /se|sw|s/.test(i) ? 'Bottom' :
+ /^e$/.test(i) ? 'Right' : 'Left' ].join("");
+
+ target.css(padPos, padWrapper);
+
+ this._proportionallyResize();
+
+ }
+
+ //TODO: What's that good for? There's not anything to be executed left
+ if(!$(this.handles[i]).length)
+ continue;
+
+ }
+ };
+
+ //TODO: make renderAxis a prototype function
+ this._renderAxis(this.element);
+
+ this._handles = $('.ui-resizable-handle', this.element)
+ .disableSelection();
+
+ //Matching axis name
+ this._handles.mouseover(function() {
+ if (!that.resizing) {
+ if (this.className)
+ var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
+ //Axis, default = se
+ that.axis = axis && axis[1] ? axis[1] : 'se';
+ }
+ });
+
+ //If we want to auto hide the elements
+ if (o.autoHide) {
+ this._handles.hide();
+ $(this.element)
+ .addClass("ui-resizable-autohide")
+ .mouseenter(function() {
+ if (o.disabled) return;
+ $(this).removeClass("ui-resizable-autohide");
+ that._handles.show();
+ })
+ .mouseleave(function(){
+ if (o.disabled) return;
+ if (!that.resizing) {
+ $(this).addClass("ui-resizable-autohide");
+ that._handles.hide();
+ }
+ });
+ }
+
+ //Initialize the mouse interaction
+ this._mouseInit();
+
+ },
+
+ _destroy: function() {
+
+ this._mouseDestroy();
+
+ var _destroy = function(exp) {
+ $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
+ .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
+ };
+
+ //TODO: Unwrap at same DOM position
+ if (this.elementIsWrapper) {
+ _destroy(this.element);
+ var wrapper = this.element;
+ this.originalElement.css({
+ position: wrapper.css('position'),
+ width: wrapper.outerWidth(),
+ height: wrapper.outerHeight(),
+ top: wrapper.css('top'),
+ left: wrapper.css('left')
+ }).insertAfter( wrapper );
+ wrapper.remove();
+ }
+
+ this.originalElement.css('resize', this.originalResizeStyle);
+ _destroy(this.originalElement);
+
+ return this;
+ },
+
+ _mouseCapture: function(event) {
+ var handle = false;
+ for (var i in this.handles) {
+ if ($(this.handles[i])[0] == event.target) {
+ handle = true;
+ }
+ }
+
+ return !this.options.disabled && handle;
+ },
+
+ _mouseStart: function(event) {
+
+ var o = this.options, iniPos = this.element.position(), el = this.element;
+
+ this.resizing = true;
+ this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
+
+ // bugfix for http://dev.jquery.com/ticket/1749
+ if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
+ el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
+ }
+
+ this._renderProxy();
+
+ var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
+
+ if (o.containment) {
+ curleft += $(o.containment).scrollLeft() || 0;
+ curtop += $(o.containment).scrollTop() || 0;
+ }
+
+ //Store needed variables
+ this.offset = this.helper.offset();
+ this.position = { left: curleft, top: curtop };
+ this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+ this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+ this.originalPosition = { left: curleft, top: curtop };
+ this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
+ this.originalMousePosition = { left: event.pageX, top: event.pageY };
+
+ //Aspect Ratio
+ this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
+
+ var cursor = $('.ui-resizable-' + this.axis).css('cursor');
+ $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
+
+ el.addClass("ui-resizable-resizing");
+ this._propagate("start", event);
+ return true;
+ },
+
+ _mouseDrag: function(event) {
+
+ //Increase performance, avoid regex
+ var el = this.helper, o = this.options, props = {},
+ that = this, smp = this.originalMousePosition, a = this.axis;
+
+ var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
+ var trigger = this._change[a];
+ if (!trigger) return false;
+
+ // Calculate the attrs that will be change
+ var data = trigger.apply(this, [event, dx, dy]);
+
+ // Put this in the mouseDrag handler since the user can start pressing shift while resizing
+ this._updateVirtualBoundaries(event.shiftKey);
+ if (this._aspectRatio || event.shiftKey)
+ data = this._updateRatio(data, event);
+
+ data = this._respectSize(data, event);
+
+ // plugins callbacks need to be called first
+ this._propagate("resize", event);
+
+ el.css({
+ top: this.position.top + "px", left: this.position.left + "px",
+ width: this.size.width + "px", height: this.size.height + "px"
+ });
+
+ if (!this._helper && this._proportionallyResizeElements.length)
+ this._proportionallyResize();
+
+ this._updateCache(data);
+
+ // calling the user callback at the end
+ this._trigger('resize', event, this.ui());
+
+ return false;
+ },
+
+ _mouseStop: function(event) {
+
+ this.resizing = false;
+ var o = this.options, that = this;
+
+ if(this._helper) {
+ var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height,
+ soffsetw = ista ? 0 : that.sizeDiff.width;
+
+ var s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) },
+ left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null,
+ top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null;
+
+ if (!o.animate)
+ this.element.css($.extend(s, { top: top, left: left }));
+
+ that.helper.height(that.size.height);
+ that.helper.width(that.size.width);
+
+ if (this._helper && !o.animate) this._proportionallyResize();
+ }
+
+ $('body').css('cursor', 'auto');
+
+ this.element.removeClass("ui-resizable-resizing");
+
+ this._propagate("stop", event);
+
+ if (this._helper) this.helper.remove();
+ return false;
+
+ },
+
+ _updateVirtualBoundaries: function(forceAspectRatio) {
+ var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b;
+
+ b = {
+ minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
+ maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
+ minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
+ maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
+ };
+
+ if(this._aspectRatio || forceAspectRatio) {
+ // We want to create an enclosing box whose aspect ration is the requested one
+ // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
+ pMinWidth = b.minHeight * this.aspectRatio;
+ pMinHeight = b.minWidth / this.aspectRatio;
+ pMaxWidth = b.maxHeight * this.aspectRatio;
+ pMaxHeight = b.maxWidth / this.aspectRatio;
+
+ if(pMinWidth > b.minWidth) b.minWidth = pMinWidth;
+ if(pMinHeight > b.minHeight) b.minHeight = pMinHeight;
+ if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth;
+ if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight;
+ }
+ this._vBoundaries = b;
+ },
+
+ _updateCache: function(data) {
+ var o = this.options;
+ this.offset = this.helper.offset();
+ if (isNumber(data.left)) this.position.left = data.left;
+ if (isNumber(data.top)) this.position.top = data.top;
+ if (isNumber(data.height)) this.size.height = data.height;
+ if (isNumber(data.width)) this.size.width = data.width;
+ },
+
+ _updateRatio: function(data, event) {
+
+ var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
+
+ if (isNumber(data.height)) data.width = (data.height * this.aspectRatio);
+ else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio);
+
+ if (a == 'sw') {
+ data.left = cpos.left + (csize.width - data.width);
+ data.top = null;
+ }
+ if (a == 'nw') {
+ data.top = cpos.top + (csize.height - data.height);
+ data.left = cpos.left + (csize.width - data.width);
+ }
+
+ return data;
+ },
+
+ _respectSize: function(data, event) {
+
+ var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
+ ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
+ isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
+
+ if (isminw) data.width = o.minWidth;
+ if (isminh) data.height = o.minHeight;
+ if (ismaxw) data.width = o.maxWidth;
+ if (ismaxh) data.height = o.maxHeight;
+
+ var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
+ var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
+
+ if (isminw && cw) data.left = dw - o.minWidth;
+ if (ismaxw && cw) data.left = dw - o.maxWidth;
+ if (isminh && ch) data.top = dh - o.minHeight;
+ if (ismaxh && ch) data.top = dh - o.maxHeight;
+
+ // fixing jump error on top/left - bug #2330
+ var isNotwh = !data.width && !data.height;
+ if (isNotwh && !data.left && data.top) data.top = null;
+ else if (isNotwh && !data.top && data.left) data.left = null;
+
+ return data;
+ },
+
+ _proportionallyResize: function() {
+
+ var o = this.options;
+ if (!this._proportionallyResizeElements.length) return;
+ var element = this.helper || this.element;
+
+ for (var i=0; i < this._proportionallyResizeElements.length; i++) {
+
+ var prel = this._proportionallyResizeElements[i];
+
+ if (!this.borderDif) {
+ var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
+ p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
+
+ this.borderDif = $.map(b, function(v, i) {
+ var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
+ return border + padding;
+ });
+ }
+
+ prel.css({
+ height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
+ width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
+ });
+
+ };
+
+ },
+
+ _renderProxy: function() {
+
+ var el = this.element, o = this.options;
+ this.elementOffset = el.offset();
+
+ if(this._helper) {
+
+ this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
+
+ // fix ie6 offset TODO: This seems broken
+ var ie6offset = ($.ui.ie6 ? 1 : 0),
+ pxyoffset = ( $.ui.ie6 ? 2 : -1 );
+
+ this.helper.addClass(this._helper).css({
+ width: this.element.outerWidth() + pxyoffset,
+ height: this.element.outerHeight() + pxyoffset,
+ position: 'absolute',
+ left: this.elementOffset.left - ie6offset +'px',
+ top: this.elementOffset.top - ie6offset +'px',
+ zIndex: ++o.zIndex //TODO: Don't modify option
+ });
+
+ this.helper
+ .appendTo("body")
+ .disableSelection();
+
+ } else {
+ this.helper = this.element;
+ }
+
+ },
+
+ _change: {
+ e: function(event, dx, dy) {
+ return { width: this.originalSize.width + dx };
+ },
+ w: function(event, dx, dy) {
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+ return { left: sp.left + dx, width: cs.width - dx };
+ },
+ n: function(event, dx, dy) {
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+ return { top: sp.top + dy, height: cs.height - dy };
+ },
+ s: function(event, dx, dy) {
+ return { height: this.originalSize.height + dy };
+ },
+ se: function(event, dx, dy) {
+ return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
+ },
+ sw: function(event, dx, dy) {
+ return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
+ },
+ ne: function(event, dx, dy) {
+ return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
+ },
+ nw: function(event, dx, dy) {
+ return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
+ }
+ },
+
+ _propagate: function(n, event) {
+ $.ui.plugin.call(this, n, [event, this.ui()]);
+ (n != "resize" && this._trigger(n, event, this.ui()));
+ },
+
+ plugins: {},
+
+ ui: function() {
+ return {
+ originalElement: this.originalElement,
+ element: this.element,
+ helper: this.helper,
+ position: this.position,
+ size: this.size,
+ originalSize: this.originalSize,
+ originalPosition: this.originalPosition
+ };
+ }
+
+});
+
+/*
+ * Resizable Extensions
+ */
+
+$.ui.plugin.add("resizable", "alsoResize", {
+
+ start: function (event, ui) {
+ var that = $(this).data("resizable"), o = that.options;
+
+ var _store = function (exp) {
+ $(exp).each(function() {
+ var el = $(this);
+ el.data("resizable-alsoresize", {
+ width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
+ left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10)
+ });
+ });
+ };
+
+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
+ if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
+ else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
+ }else{
+ _store(o.alsoResize);
+ }
+ },
+
+ resize: function (event, ui) {
+ var that = $(this).data("resizable"), o = that.options, os = that.originalSize, op = that.originalPosition;
+
+ var delta = {
+ height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
+ top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0
+ },
+
+ _alsoResize = function (exp, c) {
+ $(exp).each(function() {
+ var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
+ css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
+
+ $.each(css, function (i, prop) {
+ var sum = (start[prop]||0) + (delta[prop]||0);
+ if (sum && sum >= 0)
+ style[prop] = sum || null;
+ });
+
+ el.css(style);
+ });
+ };
+
+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
+ $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
+ }else{
+ _alsoResize(o.alsoResize);
+ }
+ },
+
+ stop: function (event, ui) {
+ $(this).removeData("resizable-alsoresize");
+ }
+});
+
+$.ui.plugin.add("resizable", "animate", {
+
+ stop: function(event, ui) {
+ var that = $(this).data("resizable"), o = that.options;
+
+ var pr = that._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height,
+ soffsetw = ista ? 0 : that.sizeDiff.width;
+
+ var style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
+ left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null,
+ top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null;
+
+ that.element.animate(
+ $.extend(style, top && left ? { top: top, left: left } : {}), {
+ duration: o.animateDuration,
+ easing: o.animateEasing,
+ step: function() {
+
+ var data = {
+ width: parseInt(that.element.css('width'), 10),
+ height: parseInt(that.element.css('height'), 10),
+ top: parseInt(that.element.css('top'), 10),
+ left: parseInt(that.element.css('left'), 10)
+ };
+
+ if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
+
+ // propagating resize, and updating values for each animation step
+ that._updateCache(data);
+ that._propagate("resize", event);
+
+ }
+ }
+ );
+ }
+
+});
+
+$.ui.plugin.add("resizable", "containment", {
+
+ start: function(event, ui) {
+ var that = $(this).data("resizable"), o = that.options, el = that.element;
+ var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
+ if (!ce) return;
+
+ that.containerElement = $(ce);
+
+ if (/document/.test(oc) || oc == document) {
+ that.containerOffset = { left: 0, top: 0 };
+ that.containerPosition = { left: 0, top: 0 };
+
+ that.parentData = {
+ element: $(document), left: 0, top: 0,
+ width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
+ };
+ }
+
+ // i'm a node, so compute top, left, right, bottom
+ else {
+ var element = $(ce), p = [];
+ $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
+
+ that.containerOffset = element.offset();
+ that.containerPosition = element.position();
+ that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
+
+ var co = that.containerOffset, ch = that.containerSize.height, cw = that.containerSize.width,
+ width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
+
+ that.parentData = {
+ element: ce, left: co.left, top: co.top, width: width, height: height
+ };
+ }
+ },
+
+ resize: function(event, ui) {
+ var that = $(this).data("resizable"), o = that.options,
+ ps = that.containerSize, co = that.containerOffset, cs = that.size, cp = that.position,
+ pRatio = that._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = that.containerElement;
+
+ if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
+
+ if (cp.left < (that._helper ? co.left : 0)) {
+ that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left));
+ if (pRatio) that.size.height = that.size.width / that.aspectRatio;
+ that.position.left = o.helper ? co.left : 0;
+ }
+
+ if (cp.top < (that._helper ? co.top : 0)) {
+ that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top);
+ if (pRatio) that.size.width = that.size.height * that.aspectRatio;
+ that.position.top = that._helper ? co.top : 0;
+ }
+
+ that.offset.left = that.parentData.left+that.position.left;
+ that.offset.top = that.parentData.top+that.position.top;
+
+ var woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width ),
+ hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height );
+
+ var isParent = that.containerElement.get(0) == that.element.parent().get(0),
+ isOffsetRelative = /relative|absolute/.test(that.containerElement.css('position'));
+
+ if(isParent && isOffsetRelative) woset -= that.parentData.left;
+
+ if (woset + that.size.width >= that.parentData.width) {
+ that.size.width = that.parentData.width - woset;
+ if (pRatio) that.size.height = that.size.width / that.aspectRatio;
+ }
+
+ if (hoset + that.size.height >= that.parentData.height) {
+ that.size.height = that.parentData.height - hoset;
+ if (pRatio) that.size.width = that.size.height * that.aspectRatio;
+ }
+ },
+
+ stop: function(event, ui){
+ var that = $(this).data("resizable"), o = that.options, cp = that.position,
+ co = that.containerOffset, cop = that.containerPosition, ce = that.containerElement;
+
+ var helper = $(that.helper), ho = helper.offset(), w = helper.outerWidth() - that.sizeDiff.width, h = helper.outerHeight() - that.sizeDiff.height;
+
+ if (that._helper && !o.animate && (/relative/).test(ce.css('position')))
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
+
+ if (that._helper && !o.animate && (/static/).test(ce.css('position')))
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
+
+ }
+});
+
+$.ui.plugin.add("resizable", "ghost", {
+
+ start: function(event, ui) {
+
+ var that = $(this).data("resizable"), o = that.options, cs = that.size;
+
+ that.ghost = that.originalElement.clone();
+ that.ghost
+ .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
+ .addClass('ui-resizable-ghost')
+ .addClass(typeof o.ghost == 'string' ? o.ghost : '');
+
+ that.ghost.appendTo(that.helper);
+
+ },
+
+ resize: function(event, ui){
+ var that = $(this).data("resizable"), o = that.options;
+ if (that.ghost) that.ghost.css({ position: 'relative', height: that.size.height, width: that.size.width });
+ },
+
+ stop: function(event, ui){
+ var that = $(this).data("resizable"), o = that.options;
+ if (that.ghost && that.helper) that.helper.get(0).removeChild(that.ghost.get(0));
+ }
+
+});
+
+$.ui.plugin.add("resizable", "grid", {
+
+ resize: function(event, ui) {
+ var that = $(this).data("resizable"), o = that.options, cs = that.size, os = that.originalSize, op = that.originalPosition, a = that.axis, ratio = o._aspectRatio || event.shiftKey;
+ o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
+ var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
+
+ if (/^(se|s|e)$/.test(a)) {
+ that.size.width = os.width + ox;
+ that.size.height = os.height + oy;
+ }
+ else if (/^(ne)$/.test(a)) {
+ that.size.width = os.width + ox;
+ that.size.height = os.height + oy;
+ that.position.top = op.top - oy;
+ }
+ else if (/^(sw)$/.test(a)) {
+ that.size.width = os.width + ox;
+ that.size.height = os.height + oy;
+ that.position.left = op.left - ox;
+ }
+ else {
+ that.size.width = os.width + ox;
+ that.size.height = os.height + oy;
+ that.position.top = op.top - oy;
+ that.position.left = op.left - ox;
+ }
+ }
+
+});
+
+var num = function(v) {
+ return parseInt(v, 10) || 0;
+};
+
+var isNumber = function(value) {
+ return !isNaN(parseInt(value, 10));
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.widget("ui.selectable", $.ui.mouse, {
+ version: "1.9.2",
+ options: {
+ appendTo: 'body',
+ autoRefresh: true,
+ distance: 0,
+ filter: '*',
+ tolerance: 'touch'
+ },
+ _create: function() {
+ var that = this;
+
+ this.element.addClass("ui-selectable");
+
+ this.dragged = false;
+
+ // cache selectee children based on filter
+ var selectees;
+ this.refresh = function() {
+ selectees = $(that.options.filter, that.element[0]);
+ selectees.addClass("ui-selectee");
+ selectees.each(function() {
+ var $this = $(this);
+ var pos = $this.offset();
+ $.data(this, "selectable-item", {
+ element: this,
+ $element: $this,
+ left: pos.left,
+ top: pos.top,
+ right: pos.left + $this.outerWidth(),
+ bottom: pos.top + $this.outerHeight(),
+ startselected: false,
+ selected: $this.hasClass('ui-selected'),
+ selecting: $this.hasClass('ui-selecting'),
+ unselecting: $this.hasClass('ui-unselecting')
+ });
+ });
+ };
+ this.refresh();
+
+ this.selectees = selectees.addClass("ui-selectee");
+
+ this._mouseInit();
+
+ this.helper = $("<div class='ui-selectable-helper'></div>");
+ },
+
+ _destroy: function() {
+ this.selectees
+ .removeClass("ui-selectee")
+ .removeData("selectable-item");
+ this.element
+ .removeClass("ui-selectable ui-selectable-disabled");
+ this._mouseDestroy();
+ },
+
+ _mouseStart: function(event) {
+ var that = this;
+
+ this.opos = [event.pageX, event.pageY];
+
+ if (this.options.disabled)
+ return;
+
+ var options = this.options;
+
+ this.selectees = $(options.filter, this.element[0]);
+
+ this._trigger("start", event);
+
+ $(options.appendTo).append(this.helper);
+ // position helper (lasso)
+ this.helper.css({
+ "left": event.clientX,
+ "top": event.clientY,
+ "width": 0,
+ "height": 0
+ });
+
+ if (options.autoRefresh) {
+ this.refresh();
+ }
+
+ this.selectees.filter('.ui-selected').each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.startselected = true;
+ if (!event.metaKey && !event.ctrlKey) {
+ selectee.$element.removeClass('ui-selected');
+ selectee.selected = false;
+ selectee.$element.addClass('ui-unselecting');
+ selectee.unselecting = true;
+ // selectable UNSELECTING callback
+ that._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ });
+
+ $(event.target).parents().andSelf().each(function() {
+ var selectee = $.data(this, "selectable-item");
+ if (selectee) {
+ var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
+ selectee.$element
+ .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
+ .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
+ selectee.unselecting = !doSelect;
+ selectee.selecting = doSelect;
+ selectee.selected = doSelect;
+ // selectable (UN)SELECTING callback
+ if (doSelect) {
+ that._trigger("selecting", event, {
+ selecting: selectee.element
+ });
+ } else {
+ that._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ return false;
+ }
+ });
+
+ },
+
+ _mouseDrag: function(event) {
+ var that = this;
+ this.dragged = true;
+
+ if (this.options.disabled)
+ return;
+
+ var options = this.options;
+
+ var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
+ if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
+ if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
+ this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
+
+ this.selectees.each(function() {
+ var selectee = $.data(this, "selectable-item");
+ //prevent helper from being selected if appendTo: selectable
+ if (!selectee || selectee.element == that.element[0])
+ return;
+ var hit = false;
+ if (options.tolerance == 'touch') {
+ hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
+ } else if (options.tolerance == 'fit') {
+ hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
+ }
+
+ if (hit) {
+ // SELECT
+ if (selectee.selected) {
+ selectee.$element.removeClass('ui-selected');
+ selectee.selected = false;
+ }
+ if (selectee.unselecting) {
+ selectee.$element.removeClass('ui-unselecting');
+ selectee.unselecting = false;
+ }
+ if (!selectee.selecting) {
+ selectee.$element.addClass('ui-selecting');
+ selectee.selecting = true;
+ // selectable SELECTING callback
+ that._trigger("selecting", event, {
+ selecting: selectee.element
+ });
+ }
+ } else {
+ // UNSELECT
+ if (selectee.selecting) {
+ if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
+ selectee.$element.removeClass('ui-selecting');
+ selectee.selecting = false;
+ selectee.$element.addClass('ui-selected');
+ selectee.selected = true;
+ } else {
+ selectee.$element.removeClass('ui-selecting');
+ selectee.selecting = false;
+ if (selectee.startselected) {
+ selectee.$element.addClass('ui-unselecting');
+ selectee.unselecting = true;
+ }
+ // selectable UNSELECTING callback
+ that._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ }
+ if (selectee.selected) {
+ if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
+ selectee.$element.removeClass('ui-selected');
+ selectee.selected = false;
+
+ selectee.$element.addClass('ui-unselecting');
+ selectee.unselecting = true;
+ // selectable UNSELECTING callback
+ that._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ }
+ }
+ });
+
+ return false;
+ },
+
+ _mouseStop: function(event) {
+ var that = this;
+
+ this.dragged = false;
+
+ var options = this.options;
+
+ $('.ui-unselecting', this.element[0]).each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.$element.removeClass('ui-unselecting');
+ selectee.unselecting = false;
+ selectee.startselected = false;
+ that._trigger("unselected", event, {
+ unselected: selectee.element
+ });
+ });
+ $('.ui-selecting', this.element[0]).each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
+ selectee.selecting = false;
+ selectee.selected = true;
+ selectee.startselected = true;
+ that._trigger("selected", event, {
+ selected: selectee.element
+ });
+ });
+ this._trigger("stop", event);
+
+ this.helper.remove();
+
+ return false;
+ }
+
+});
+
+})(jQuery);
+(function( $, undefined ) {
+
+// number of pages in a slider
+// (how many times can you page up/down to go through the whole range)
+var numPages = 5;
+
+$.widget( "ui.slider", $.ui.mouse, {
+ version: "1.9.2",
+ widgetEventPrefix: "slide",
+
+ options: {
+ animate: false,
+ distance: 0,
+ max: 100,
+ min: 0,
+ orientation: "horizontal",
+ range: false,
+ step: 1,
+ value: 0,
+ values: null
+ },
+
+ _create: function() {
+ var i, handleCount,
+ o = this.options,
+ existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
+ handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
+ handles = [];
+
+ this._keySliding = false;
+ this._mouseSliding = false;
+ this._animateOff = true;
+ this._handleIndex = null;
+ this._detectOrientation();
+ this._mouseInit();
+
+ this.element
+ .addClass( "ui-slider" +
+ " ui-slider-" + this.orientation +
+ " ui-widget" +
+ " ui-widget-content" +
+ " ui-corner-all" +
+ ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) );
+
+ this.range = $([]);
+
+ if ( o.range ) {
+ if ( o.range === true ) {
+ if ( !o.values ) {
+ o.values = [ this._valueMin(), this._valueMin() ];
+ }
+ if ( o.values.length && o.values.length !== 2 ) {
+ o.values = [ o.values[0], o.values[0] ];
+ }
+ }
+
+ this.range = $( "<div></div>" )
+ .appendTo( this.element )
+ .addClass( "ui-slider-range" +
+ // note: this isn't the most fittingly semantic framework class for this element,
+ // but worked best visually with a variety of themes
+ " ui-widget-header" +
+ ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );
+ }
+
+ handleCount = ( o.values && o.values.length ) || 1;
+
+ for ( i = existingHandles.length; i < handleCount; i++ ) {
+ handles.push( handle );
+ }
+
+ this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
+
+ this.handle = this.handles.eq( 0 );
+
+ this.handles.add( this.range ).filter( "a" )
+ .click(function( event ) {
+ event.preventDefault();
+ })
+ .mouseenter(function() {
+ if ( !o.disabled ) {
+ $( this ).addClass( "ui-state-hover" );
+ }
+ })
+ .mouseleave(function() {
+ $( this ).removeClass( "ui-state-hover" );
+ })
+ .focus(function() {
+ if ( !o.disabled ) {
+ $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
+ $( this ).addClass( "ui-state-focus" );
+ } else {
+ $( this ).blur();
+ }
+ })
+ .blur(function() {
+ $( this ).removeClass( "ui-state-focus" );
+ });
+
+ this.handles.each(function( i ) {
+ $( this ).data( "ui-slider-handle-index", i );
+ });
+
+ this._on( this.handles, {
+ keydown: function( event ) {
+ var allowed, curVal, newVal, step,
+ index = $( event.target ).data( "ui-slider-handle-index" );
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.HOME:
+ case $.ui.keyCode.END:
+ case $.ui.keyCode.PAGE_UP:
+ case $.ui.keyCode.PAGE_DOWN:
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.RIGHT:
+ case $.ui.keyCode.DOWN:
+ case $.ui.keyCode.LEFT:
+ event.preventDefault();
+ if ( !this._keySliding ) {
+ this._keySliding = true;
+ $( event.target ).addClass( "ui-state-active" );
+ allowed = this._start( event, index );
+ if ( allowed === false ) {
+ return;
+ }
+ }
+ break;
+ }
+
+ step = this.options.step;
+ if ( this.options.values && this.options.values.length ) {
+ curVal = newVal = this.values( index );
+ } else {
+ curVal = newVal = this.value();
+ }
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.HOME:
+ newVal = this._valueMin();
+ break;
+ case $.ui.keyCode.END:
+ newVal = this._valueMax();
+ break;
+ case $.ui.keyCode.PAGE_UP:
+ newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) );
+ break;
+ case $.ui.keyCode.PAGE_DOWN:
+ newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) );
+ break;
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.RIGHT:
+ if ( curVal === this._valueMax() ) {
+ return;
+ }
+ newVal = this._trimAlignValue( curVal + step );
+ break;
+ case $.ui.keyCode.DOWN:
+ case $.ui.keyCode.LEFT:
+ if ( curVal === this._valueMin() ) {
+ return;
+ }
+ newVal = this._trimAlignValue( curVal - step );
+ break;
+ }
+
+ this._slide( event, index, newVal );
+ },
+ keyup: function( event ) {
+ var index = $( event.target ).data( "ui-slider-handle-index" );
+
+ if ( this._keySliding ) {
+ this._keySliding = false;
+ this._stop( event, index );
+ this._change( event, index );
+ $( event.target ).removeClass( "ui-state-active" );
+ }
+ }
+ });
+
+ this._refreshValue();
+
+ this._animateOff = false;
+ },
+
+ _destroy: function() {
+ this.handles.remove();
+ this.range.remove();
+
+ this.element
+ .removeClass( "ui-slider" +
+ " ui-slider-horizontal" +
+ " ui-slider-vertical" +
+ " ui-slider-disabled" +
+ " ui-widget" +
+ " ui-widget-content" +
+ " ui-corner-all" );
+
+ this._mouseDestroy();
+ },
+
+ _mouseCapture: function( event ) {
+ var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
+ that = this,
+ o = this.options;
+
+ if ( o.disabled ) {
+ return false;
+ }
+
+ this.elementSize = {
+ width: this.element.outerWidth(),
+ height: this.element.outerHeight()
+ };
+ this.elementOffset = this.element.offset();
+
+ position = { x: event.pageX, y: event.pageY };
+ normValue = this._normValueFromMouse( position );
+ distance = this._valueMax() - this._valueMin() + 1;
+ this.handles.each(function( i ) {
+ var thisDistance = Math.abs( normValue - that.values(i) );
+ if ( distance > thisDistance ) {
+ distance = thisDistance;
+ closestHandle = $( this );
+ index = i;
+ }
+ });
+
+ // workaround for bug #3736 (if both handles of a range are at 0,
+ // the first is always used as the one with least distance,
+ // and moving it is obviously prevented by preventing negative ranges)
+ if( o.range === true && this.values(1) === o.min ) {
+ index += 1;
+ closestHandle = $( this.handles[index] );
+ }
+
+ allowed = this._start( event, index );
+ if ( allowed === false ) {
+ return false;
+ }
+ this._mouseSliding = true;
+
+ this._handleIndex = index;
+
+ closestHandle
+ .addClass( "ui-state-active" )
+ .focus();
+
+ offset = closestHandle.offset();
+ mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
+ this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
+ left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
+ top: event.pageY - offset.top -
+ ( closestHandle.height() / 2 ) -
+ ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
+ ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
+ ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
+ };
+
+ if ( !this.handles.hasClass( "ui-state-hover" ) ) {
+ this._slide( event, index, normValue );
+ }
+ this._animateOff = true;
+ return true;
+ },
+
+ _mouseStart: function() {
+ return true;
+ },
+
+ _mouseDrag: function( event ) {
+ var position = { x: event.pageX, y: event.pageY },
+ normValue = this._normValueFromMouse( position );
+
+ this._slide( event, this._handleIndex, normValue );
+
+ return false;
+ },
+
+ _mouseStop: function( event ) {
+ this.handles.removeClass( "ui-state-active" );
+ this._mouseSliding = false;
+
+ this._stop( event, this._handleIndex );
+ this._change( event, this._handleIndex );
+
+ this._handleIndex = null;
+ this._clickOffset = null;
+ this._animateOff = false;
+
+ return false;
+ },
+
+ _detectOrientation: function() {
+ this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
+ },
+
+ _normValueFromMouse: function( position ) {
+ var pixelTotal,
+ pixelMouse,
+ percentMouse,
+ valueTotal,
+ valueMouse;
+
+ if ( this.orientation === "horizontal" ) {
+ pixelTotal = this.elementSize.width;
+ pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
+ } else {
+ pixelTotal = this.elementSize.height;
+ pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
+ }
+
+ percentMouse = ( pixelMouse / pixelTotal );
+ if ( percentMouse > 1 ) {
+ percentMouse = 1;
+ }
+ if ( percentMouse < 0 ) {
+ percentMouse = 0;
+ }
+ if ( this.orientation === "vertical" ) {
+ percentMouse = 1 - percentMouse;
+ }
+
+ valueTotal = this._valueMax() - this._valueMin();
+ valueMouse = this._valueMin() + percentMouse * valueTotal;
+
+ return this._trimAlignValue( valueMouse );
+ },
+
+ _start: function( event, index ) {
+ var uiHash = {
+ handle: this.handles[ index ],
+ value: this.value()
+ };
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
+ uiHash.values = this.values();
+ }
+ return this._trigger( "start", event, uiHash );
+ },
+
+ _slide: function( event, index, newVal ) {
+ var otherVal,
+ newValues,
+ allowed;
+
+ if ( this.options.values && this.options.values.length ) {
+ otherVal = this.values( index ? 0 : 1 );
+
+ if ( ( this.options.values.length === 2 && this.options.range === true ) &&
+ ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
+ ) {
+ newVal = otherVal;
+ }
+
+ if ( newVal !== this.values( index ) ) {
+ newValues = this.values();
+ newValues[ index ] = newVal;
+ // A slide can be canceled by returning false from the slide callback
+ allowed = this._trigger( "slide", event, {
+ handle: this.handles[ index ],
+ value: newVal,
+ values: newValues
+ } );
+ otherVal = this.values( index ? 0 : 1 );
+ if ( allowed !== false ) {
+ this.values( index, newVal, true );
+ }
+ }
+ } else {
+ if ( newVal !== this.value() ) {
+ // A slide can be canceled by returning false from the slide callback
+ allowed = this._trigger( "slide", event, {
+ handle: this.handles[ index ],
+ value: newVal
+ } );
+ if ( allowed !== false ) {
+ this.value( newVal );
+ }
+ }
+ }
+ },
+
+ _stop: function( event, index ) {
+ var uiHash = {
+ handle: this.handles[ index ],
+ value: this.value()
+ };
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
+ uiHash.values = this.values();
+ }
+
+ this._trigger( "stop", event, uiHash );
+ },
+
+ _change: function( event, index ) {
+ if ( !this._keySliding && !this._mouseSliding ) {
+ var uiHash = {
+ handle: this.handles[ index ],
+ value: this.value()
+ };
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
+ uiHash.values = this.values();
+ }
+
+ this._trigger( "change", event, uiHash );
+ }
+ },
+
+ value: function( newValue ) {
+ if ( arguments.length ) {
+ this.options.value = this._trimAlignValue( newValue );
+ this._refreshValue();
+ this._change( null, 0 );
+ return;
+ }
+
+ return this._value();
+ },
+
+ values: function( index, newValue ) {
+ var vals,
+ newValues,
+ i;
+
+ if ( arguments.length > 1 ) {
+ this.options.values[ index ] = this._trimAlignValue( newValue );
+ this._refreshValue();
+ this._change( null, index );
+ return;
+ }
+
+ if ( arguments.length ) {
+ if ( $.isArray( arguments[ 0 ] ) ) {
+ vals = this.options.values;
+ newValues = arguments[ 0 ];
+ for ( i = 0; i < vals.length; i += 1 ) {
+ vals[ i ] = this._trimAlignValue( newValues[ i ] );
+ this._change( null, i );
+ }
+ this._refreshValue();
+ } else {
+ if ( this.options.values && this.options.values.length ) {
+ return this._values( index );
+ } else {
+ return this.value();
+ }
+ }
+ } else {
+ return this._values();
+ }
+ },
+
+ _setOption: function( key, value ) {
+ var i,
+ valsLength = 0;
+
+ if ( $.isArray( this.options.values ) ) {
+ valsLength = this.options.values.length;
+ }
+
+ $.Widget.prototype._setOption.apply( this, arguments );
+
+ switch ( key ) {
+ case "disabled":
+ if ( value ) {
+ this.handles.filter( ".ui-state-focus" ).blur();
+ this.handles.removeClass( "ui-state-hover" );
+ this.handles.prop( "disabled", true );
+ this.element.addClass( "ui-disabled" );
+ } else {
+ this.handles.prop( "disabled", false );
+ this.element.removeClass( "ui-disabled" );
+ }
+ break;
+ case "orientation":
+ this._detectOrientation();
+ this.element
+ .removeClass( "ui-slider-horizontal ui-slider-vertical" )
+ .addClass( "ui-slider-" + this.orientation );
+ this._refreshValue();
+ break;
+ case "value":
+ this._animateOff = true;
+ this._refreshValue();
+ this._change( null, 0 );
+ this._animateOff = false;
+ break;
+ case "values":
+ this._animateOff = true;
+ this._refreshValue();
+ for ( i = 0; i < valsLength; i += 1 ) {
+ this._change( null, i );
+ }
+ this._animateOff = false;
+ break;
+ case "min":
+ case "max":
+ this._animateOff = true;
+ this._refreshValue();
+ this._animateOff = false;
+ break;
+ }
+ },
+
+ //internal value getter
+ // _value() returns value trimmed by min and max, aligned by step
+ _value: function() {
+ var val = this.options.value;
+ val = this._trimAlignValue( val );
+
+ return val;
+ },
+
+ //internal values getter
+ // _values() returns array of values trimmed by min and max, aligned by step
+ // _values( index ) returns single value trimmed by min and max, aligned by step
+ _values: function( index ) {
+ var val,
+ vals,
+ i;
+
+ if ( arguments.length ) {
+ val = this.options.values[ index ];
+ val = this._trimAlignValue( val );
+
+ return val;
+ } else {
+ // .slice() creates a copy of the array
+ // this copy gets trimmed by min and max and then returned
+ vals = this.options.values.slice();
+ for ( i = 0; i < vals.length; i+= 1) {
+ vals[ i ] = this._trimAlignValue( vals[ i ] );
+ }
+
+ return vals;
+ }
+ },
+
+ // returns the step-aligned value that val is closest to, between (inclusive) min and max
+ _trimAlignValue: function( val ) {
+ if ( val <= this._valueMin() ) {
+ return this._valueMin();
+ }
+ if ( val >= this._valueMax() ) {
+ return this._valueMax();
+ }
+ var step = ( this.options.step > 0 ) ? this.options.step : 1,
+ valModStep = (val - this._valueMin()) % step,
+ alignValue = val - valModStep;
+
+ if ( Math.abs(valModStep) * 2 >= step ) {
+ alignValue += ( valModStep > 0 ) ? step : ( -step );
+ }
+
+ // Since JavaScript has problems with large floats, round
+ // the final value to 5 digits after the decimal point (see #4124)
+ return parseFloat( alignValue.toFixed(5) );
+ },
+
+ _valueMin: function() {
+ return this.options.min;
+ },
+
+ _valueMax: function() {
+ return this.options.max;
+ },
+
+ _refreshValue: function() {
+ var lastValPercent, valPercent, value, valueMin, valueMax,
+ oRange = this.options.range,
+ o = this.options,
+ that = this,
+ animate = ( !this._animateOff ) ? o.animate : false,
+ _set = {};
+
+ if ( this.options.values && this.options.values.length ) {
+ this.handles.each(function( i ) {
+ valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
+ _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+ $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+ if ( that.options.range === true ) {
+ if ( that.orientation === "horizontal" ) {
+ if ( i === 0 ) {
+ that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
+ }
+ if ( i === 1 ) {
+ that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ } else {
+ if ( i === 0 ) {
+ that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
+ }
+ if ( i === 1 ) {
+ that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ }
+ }
+ lastValPercent = valPercent;
+ });
+ } else {
+ value = this.value();
+ valueMin = this._valueMin();
+ valueMax = this._valueMax();
+ valPercent = ( valueMax !== valueMin ) ?
+ ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
+ 0;
+ _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+ this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+
+ if ( oRange === "min" && this.orientation === "horizontal" ) {
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
+ }
+ if ( oRange === "max" && this.orientation === "horizontal" ) {
+ this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ if ( oRange === "min" && this.orientation === "vertical" ) {
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
+ }
+ if ( oRange === "max" && this.orientation === "vertical" ) {
+ this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ }
+ }
+
+});
+
+}(jQuery));
+(function( $, undefined ) {
+
+$.widget("ui.sortable", $.ui.mouse, {
+ version: "1.9.2",
+ widgetEventPrefix: "sort",
+ ready: false,
+ options: {
+ appendTo: "parent",
+ axis: false,
+ connectWith: false,
+ containment: false,
+ cursor: 'auto',
+ cursorAt: false,
+ dropOnEmpty: true,
+ forcePlaceholderSize: false,
+ forceHelperSize: false,
+ grid: false,
+ handle: false,
+ helper: "original",
+ items: '> *',
+ opacity: false,
+ placeholder: false,
+ revert: false,
+ scroll: true,
+ scrollSensitivity: 20,
+ scrollSpeed: 20,
+ scope: "default",
+ tolerance: "intersect",
+ zIndex: 1000
+ },
+ _create: function() {
+
+ var o = this.options;
+ this.containerCache = {};
+ this.element.addClass("ui-sortable");
+
+ //Get the items
+ this.refresh();
+
+ //Let's determine if the items are being displayed horizontally
+ this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false;
+
+ //Let's determine the parent's offset
+ this.offset = this.element.offset();
+
+ //Initialize mouse events for interaction
+ this._mouseInit();
+
+ //We're ready to go
+ this.ready = true
+
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass("ui-sortable ui-sortable-disabled");
+ this._mouseDestroy();
+
+ for ( var i = this.items.length - 1; i >= 0; i-- )
+ this.items[i].item.removeData(this.widgetName + "-item");
+
+ return this;
+ },
+
+ _setOption: function(key, value){
+ if ( key === "disabled" ) {
+ this.options[ key ] = value;
+
+ this.widget().toggleClass( "ui-sortable-disabled", !!value );
+ } else {
+ // Don't call widget base _setOption for disable as it adds ui-state-disabled class
+ $.Widget.prototype._setOption.apply(this, arguments);
+ }
+ },
+
+ _mouseCapture: function(event, overrideHandle) {
+ var that = this;
+
+ if (this.reverting) {
+ return false;
+ }
+
+ if(this.options.disabled || this.options.type == 'static') return false;
+
+ //We have to refresh the items data once first
+ this._refreshItems(event);
+
+ //Find out if the clicked node (or one of its parents) is a actual item in this.items
+ var currentItem = null, nodes = $(event.target).parents().each(function() {
+ if($.data(this, that.widgetName + '-item') == that) {
+ currentItem = $(this);
+ return false;
+ }
+ });
+ if($.data(event.target, that.widgetName + '-item') == that) currentItem = $(event.target);
+
+ if(!currentItem) return false;
+ if(this.options.handle && !overrideHandle) {
+ var validHandle = false;
+
+ $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
+ if(!validHandle) return false;
+ }
+
+ this.currentItem = currentItem;
+ this._removeCurrentsFromItems();
+ return true;
+
+ },
+
+ _mouseStart: function(event, overrideHandle, noActivation) {
+
+ var o = this.options;
+ this.currentContainer = this;
+
+ //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
+ this.refreshPositions();
+
+ //Create and append the visible helper
+ this.helper = this._createHelper(event);
+
+ //Cache the helper size
+ this._cacheHelperProportions();
+
+ /*
+ * - Position generation -
+ * This block generates everything position related - it's the core of draggables.
+ */
+
+ //Cache the margins of the original element
+ this._cacheMargins();
+
+ //Get the next scrolling parent
+ this.scrollParent = this.helper.scrollParent();
+
+ //The element's absolute position on the page minus margins
+ this.offset = this.currentItem.offset();
+ this.offset = {
+ top: this.offset.top - this.margins.top,
+ left: this.offset.left - this.margins.left
+ };
+
+ $.extend(this.offset, {
+ click: { //Where the click happened, relative to the element
+ left: event.pageX - this.offset.left,
+ top: event.pageY - this.offset.top
+ },
+ parent: this._getParentOffset(),
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
+ });
+
+ // Only after we got the offset, we can change the helper's position to absolute
+ // TODO: Still need to figure out a way to make relative sorting possible
+ this.helper.css("position", "absolute");
+ this.cssPosition = this.helper.css("position");
+
+ //Generate the original position
+ this.originalPosition = this._generatePosition(event);
+ this.originalPageX = event.pageX;
+ this.originalPageY = event.pageY;
+
+ //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
+
+ //Cache the former DOM position
+ this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
+
+ //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
+ if(this.helper[0] != this.currentItem[0]) {
+ this.currentItem.hide();
+ }
+
+ //Create the placeholder
+ this._createPlaceholder();
+
+ //Set a containment if given in the options
+ if(o.containment)
+ this._setContainment();
+
+ if(o.cursor) { // cursor option
+ if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
+ $('body').css("cursor", o.cursor);
+ }
+
+ if(o.opacity) { // opacity option
+ if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
+ this.helper.css("opacity", o.opacity);
+ }
+
+ if(o.zIndex) { // zIndex option
+ if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
+ this.helper.css("zIndex", o.zIndex);
+ }
+
+ //Prepare scrolling
+ if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
+ this.overflowOffset = this.scrollParent.offset();
+
+ //Call callbacks
+ this._trigger("start", event, this._uiHash());
+
+ //Recache the helper size
+ if(!this._preserveHelperProportions)
+ this._cacheHelperProportions();
+
+
+ //Post 'activate' events to possible containers
+ if(!noActivation) {
+ for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); }
+ }
+
+ //Prepare possible droppables
+ if($.ui.ddmanager)
+ $.ui.ddmanager.current = this;
+
+ if ($.ui.ddmanager && !o.dropBehaviour)
+ $.ui.ddmanager.prepareOffsets(this, event);
+
+ this.dragging = true;
+
+ this.helper.addClass("ui-sortable-helper");
+ this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+ return true;
+
+ },
+
+ _mouseDrag: function(event) {
+
+ //Compute the helpers position
+ this.position = this._generatePosition(event);
+ this.positionAbs = this._convertPositionTo("absolute");
+
+ if (!this.lastPositionAbs) {
+ this.lastPositionAbs = this.positionAbs;
+ }
+
+ //Do scrolling
+ if(this.options.scroll) {
+ var o = this.options, scrolled = false;
+ if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
+
+ if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
+ else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
+
+ if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
+ else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
+
+ } else {
+
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+ else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+ else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+
+ }
+
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
+ $.ui.ddmanager.prepareOffsets(this, event);
+ }
+
+ //Regenerate the absolute position used for position checks
+ this.positionAbs = this._convertPositionTo("absolute");
+
+ //Set the helper position
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
+
+ //Rearrange
+ for (var i = this.items.length - 1; i >= 0; i--) {
+
+ //Cache variables and intersection, continue if no intersection
+ var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
+ if (!intersection) continue;
+
+ // Only put the placeholder inside the current Container, skip all
+ // items form other containers. This works because when moving
+ // an item from one container to another the
+ // currentContainer is switched before the placeholder is moved.
+ //
+ // Without this moving items in "sub-sortables" can cause the placeholder to jitter
+ // beetween the outer and inner container.
+ if (item.instance !== this.currentContainer) continue;
+
+ if (itemElement != this.currentItem[0] //cannot intersect with itself
+ && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
+ && !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
+ && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
+ //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
+ ) {
+
+ this.direction = intersection == 1 ? "down" : "up";
+
+ if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
+ this._rearrange(event, item);
+ } else {
+ break;
+ }
+
+ this._trigger("change", event, this._uiHash());
+ break;
+ }
+ }
+
+ //Post events to containers
+ this._contactContainers(event);
+
+ //Interconnect with droppables
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
+
+ //Call callbacks
+ this._trigger('sort', event, this._uiHash());
+
+ this.lastPositionAbs = this.positionAbs;
+ return false;
+
+ },
+
+ _mouseStop: function(event, noPropagation) {
+
+ if(!event) return;
+
+ //If we are using droppables, inform the manager about the drop
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
+ $.ui.ddmanager.drop(this, event);
+
+ if(this.options.revert) {
+ var that = this;
+ var cur = this.placeholder.offset();
+
+ this.reverting = true;
+
+ $(this.helper).animate({
+ left: cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
+ top: cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
+ }, parseInt(this.options.revert, 10) || 500, function() {
+ that._clear(event);
+ });
+ } else {
+ this._clear(event, noPropagation);
+ }
+
+ return false;
+
+ },
+
+ cancel: function() {
+
+ if(this.dragging) {
+
+ this._mouseUp({ target: null });
+
+ if(this.options.helper == "original")
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
+ else
+ this.currentItem.show();
+
+ //Post deactivating events to containers
+ for (var i = this.containers.length - 1; i >= 0; i--){
+ this.containers[i]._trigger("deactivate", null, this._uiHash(this));
+ if(this.containers[i].containerCache.over) {
+ this.containers[i]._trigger("out", null, this._uiHash(this));
+ this.containers[i].containerCache.over = 0;
+ }
+ }
+
+ }
+
+ if (this.placeholder) {
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+ if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+ if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
+
+ $.extend(this, {
+ helper: null,
+ dragging: false,
+ reverting: false,
+ _noFinalSort: null
+ });
+
+ if(this.domPosition.prev) {
+ $(this.domPosition.prev).after(this.currentItem);
+ } else {
+ $(this.domPosition.parent).prepend(this.currentItem);
+ }
+ }
+
+ return this;
+
+ },
+
+ serialize: function(o) {
+
+ var items = this._getItemsAsjQuery(o && o.connected);
+ var str = []; o = o || {};
+
+ $(items).each(function() {
+ var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
+ if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
+ });
+
+ if(!str.length && o.key) {
+ str.push(o.key + '=');
+ }
+
+ return str.join('&');
+
+ },
+
+ toArray: function(o) {
+
+ var items = this._getItemsAsjQuery(o && o.connected);
+ var ret = []; o = o || {};
+
+ items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
+ return ret;
+
+ },
+
+ /* Be careful with the following core functions */
+ _intersectsWith: function(item) {
+
+ var x1 = this.positionAbs.left,
+ x2 = x1 + this.helperProportions.width,
+ y1 = this.positionAbs.top,
+ y2 = y1 + this.helperProportions.height;
+
+ var l = item.left,
+ r = l + item.width,
+ t = item.top,
+ b = t + item.height;
+
+ var dyClick = this.offset.click.top,
+ dxClick = this.offset.click.left;
+
+ var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
+
+ if( this.options.tolerance == "pointer"
+ || this.options.forcePointerForContainers
+ || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
+ ) {
+ return isOverElement;
+ } else {
+
+ return (l < x1 + (this.helperProportions.width / 2) // Right Half
+ && x2 - (this.helperProportions.width / 2) < r // Left Half
+ && t < y1 + (this.helperProportions.height / 2) // Bottom Half
+ && y2 - (this.helperProportions.height / 2) < b ); // Top Half
+
+ }
+ },
+
+ _intersectsWithPointer: function(item) {
+
+ var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
+ isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
+ isOverElement = isOverElementHeight && isOverElementWidth,
+ verticalDirection = this._getDragVerticalDirection(),
+ horizontalDirection = this._getDragHorizontalDirection();
+
+ if (!isOverElement)
+ return false;
+
+ return this.floating ?
+ ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
+ : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
+
+ },
+
+ _intersectsWithSides: function(item) {
+
+ var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
+ isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
+ verticalDirection = this._getDragVerticalDirection(),
+ horizontalDirection = this._getDragHorizontalDirection();
+
+ if (this.floating && horizontalDirection) {
+ return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
+ } else {
+ return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
+ }
+
+ },
+
+ _getDragVerticalDirection: function() {
+ var delta = this.positionAbs.top - this.lastPositionAbs.top;
+ return delta != 0 && (delta > 0 ? "down" : "up");
+ },
+
+ _getDragHorizontalDirection: function() {
+ var delta = this.positionAbs.left - this.lastPositionAbs.left;
+ return delta != 0 && (delta > 0 ? "right" : "left");
+ },
+
+ refresh: function(event) {
+ this._refreshItems(event);
+ this.refreshPositions();
+ return this;
+ },
+
+ _connectWith: function() {
+ var options = this.options;
+ return options.connectWith.constructor == String
+ ? [options.connectWith]
+ : options.connectWith;
+ },
+
+ _getItemsAsjQuery: function(connected) {
+
+ var items = [];
+ var queries = [];
+ var connectWith = this._connectWith();
+
+ if(connectWith && connected) {
+ for (var i = connectWith.length - 1; i >= 0; i--){
+ var cur = $(connectWith[i]);
+ for (var j = cur.length - 1; j >= 0; j--){
+ var inst = $.data(cur[j], this.widgetName);
+ if(inst && inst != this && !inst.options.disabled) {
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
+ }
+ };
+ };
+ }
+
+ queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
+
+ for (var i = queries.length - 1; i >= 0; i--){
+ queries[i][0].each(function() {
+ items.push(this);
+ });
+ };
+
+ return $(items);
+
+ },
+
+ _removeCurrentsFromItems: function() {
+
+ var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
+
+ this.items = $.grep(this.items, function (item) {
+ for (var j=0; j < list.length; j++) {
+ if(list[j] == item.item[0])
+ return false;
+ };
+ return true;
+ });
+
+ },
+
+ _refreshItems: function(event) {
+
+ this.items = [];
+ this.containers = [this];
+ var items = this.items;
+ var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
+ var connectWith = this._connectWith();
+
+ if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
+ for (var i = connectWith.length - 1; i >= 0; i--){
+ var cur = $(connectWith[i]);
+ for (var j = cur.length - 1; j >= 0; j--){
+ var inst = $.data(cur[j], this.widgetName);
+ if(inst && inst != this && !inst.options.disabled) {
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
+ this.containers.push(inst);
+ }
+ };
+ };
+ }
+
+ for (var i = queries.length - 1; i >= 0; i--) {
+ var targetData = queries[i][1];
+ var _queries = queries[i][0];
+
+ for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
+ var item = $(_queries[j]);
+
+ item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager)
+
+ items.push({
+ item: item,
+ instance: targetData,
+ width: 0, height: 0,
+ left: 0, top: 0
+ });
+ };
+ };
+
+ },
+
+ refreshPositions: function(fast) {
+
+ //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
+ if(this.offsetParent && this.helper) {
+ this.offset.parent = this._getParentOffset();
+ }
+
+ for (var i = this.items.length - 1; i >= 0; i--){
+ var item = this.items[i];
+
+ //We ignore calculating positions of all connected containers when we're not over them
+ if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])
+ continue;
+
+ var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
+
+ if (!fast) {
+ item.width = t.outerWidth();
+ item.height = t.outerHeight();
+ }
+
+ var p = t.offset();
+ item.left = p.left;
+ item.top = p.top;
+ };
+
+ if(this.options.custom && this.options.custom.refreshContainers) {
+ this.options.custom.refreshContainers.call(this);
+ } else {
+ for (var i = this.containers.length - 1; i >= 0; i--){
+ var p = this.containers[i].element.offset();
+ this.containers[i].containerCache.left = p.left;
+ this.containers[i].containerCache.top = p.top;
+ this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
+ this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
+ };
+ }
+
+ return this;
+ },
+
+ _createPlaceholder: function(that) {
+ that = that || this;
+ var o = that.options;
+
+ if(!o.placeholder || o.placeholder.constructor == String) {
+ var className = o.placeholder;
+ o.placeholder = {
+ element: function() {
+
+ var el = $(document.createElement(that.currentItem[0].nodeName))
+ .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
+ .removeClass("ui-sortable-helper")[0];
+
+ if(!className)
+ el.style.visibility = "hidden";
+
+ return el;
+ },
+ update: function(container, p) {
+
+ // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
+ // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
+ if(className && !o.forcePlaceholderSize) return;
+
+ //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
+ if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css('paddingTop')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); };
+ if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); };
+ }
+ };
+ }
+
+ //Create the placeholder
+ that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
+
+ //Append it after the actual current item
+ that.currentItem.after(that.placeholder);
+
+ //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
+ o.placeholder.update(that, that.placeholder);
+
+ },
+
+ _contactContainers: function(event) {
+
+ // get innermost container that intersects with item
+ var innermostContainer = null, innermostIndex = null;
+
+
+ for (var i = this.containers.length - 1; i >= 0; i--){
+
+ // never consider a container that's located within the item itself
+ if($.contains(this.currentItem[0], this.containers[i].element[0]))
+ continue;
+
+ if(this._intersectsWith(this.containers[i].containerCache)) {
+
+ // if we've already found a container and it's more "inner" than this, then continue
+ if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0]))
+ continue;
+
+ innermostContainer = this.containers[i];
+ innermostIndex = i;
+
+ } else {
+ // container doesn't intersect. trigger "out" event if necessary
+ if(this.containers[i].containerCache.over) {
+ this.containers[i]._trigger("out", event, this._uiHash(this));
+ this.containers[i].containerCache.over = 0;
+ }
+ }
+
+ }
+
+ // if no intersecting containers found, return
+ if(!innermostContainer) return;
+
+ // move the item into the container if it's not there already
+ if(this.containers.length === 1) {
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+ this.containers[innermostIndex].containerCache.over = 1;
+ } else {
+
+ //When entering a new container, we will find the item with the least distance and append our item near it
+ var dist = 10000; var itemWithLeastDistance = null;
+ var posProperty = this.containers[innermostIndex].floating ? 'left' : 'top';
+ var sizeProperty = this.containers[innermostIndex].floating ? 'width' : 'height';
+ var base = this.positionAbs[posProperty] + this.offset.click[posProperty];
+ for (var j = this.items.length - 1; j >= 0; j--) {
+ if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
+ if(this.items[j].item[0] == this.currentItem[0]) continue;
+ var cur = this.items[j].item.offset()[posProperty];
+ var nearBottom = false;
+ if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){
+ nearBottom = true;
+ cur += this.items[j][sizeProperty];
+ }
+
+ if(Math.abs(cur - base) < dist) {
+ dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
+ this.direction = nearBottom ? "up": "down";
+ }
+ }
+
+ if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
+ return;
+
+ this.currentContainer = this.containers[innermostIndex];
+ itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
+ this._trigger("change", event, this._uiHash());
+ this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
+
+ //Update the placeholder
+ this.options.placeholder.update(this.currentContainer, this.placeholder);
+
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+ this.containers[innermostIndex].containerCache.over = 1;
+ }
+
+
+ },
+
+ _createHelper: function(event) {
+
+ var o = this.options;
+ var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
+
+ if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
+ $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
+
+ if(helper[0] == this.currentItem[0])
+ this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
+
+ if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
+ if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
+
+ return helper;
+
+ },
+
+ _adjustOffsetFromHelper: function(obj) {
+ if (typeof obj == 'string') {
+ obj = obj.split(' ');
+ }
+ if ($.isArray(obj)) {
+ obj = {left: +obj[0], top: +obj[1] || 0};
+ }
+ if ('left' in obj) {
+ this.offset.click.left = obj.left + this.margins.left;
+ }
+ if ('right' in obj) {
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+ }
+ if ('top' in obj) {
+ this.offset.click.top = obj.top + this.margins.top;
+ }
+ if ('bottom' in obj) {
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+ }
+ },
+
+ _getParentOffset: function() {
+
+
+ //Get the offsetParent and cache its position
+ this.offsetParent = this.helper.offsetParent();
+ var po = this.offsetParent.offset();
+
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
+ po.left += this.scrollParent.scrollLeft();
+ po.top += this.scrollParent.scrollTop();
+ }
+
+ if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
+ po = { top: 0, left: 0 };
+
+ return {
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+ };
+
+ },
+
+ _getRelativeOffset: function() {
+
+ if(this.cssPosition == "relative") {
+ var p = this.currentItem.position();
+ return {
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
+ };
+ } else {
+ return { top: 0, left: 0 };
+ }
+
+ },
+
+ _cacheMargins: function() {
+ this.margins = {
+ left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
+ top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
+ };
+ },
+
+ _cacheHelperProportions: function() {
+ this.helperProportions = {
+ width: this.helper.outerWidth(),
+ height: this.helper.outerHeight()
+ };
+ },
+
+ _setContainment: function() {
+
+ var o = this.options;
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
+ 0 - this.offset.relative.left - this.offset.parent.left,
+ 0 - this.offset.relative.top - this.offset.parent.top,
+ $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
+ ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+ ];
+
+ if(!(/^(document|window|parent)$/).test(o.containment)) {
+ var ce = $(o.containment)[0];
+ var co = $(o.containment).offset();
+ var over = ($(ce).css("overflow") != 'hidden');
+
+ this.containment = [
+ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
+ co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
+ co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
+ co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
+ ];
+ }
+
+ },
+
+ _convertPositionTo: function(d, pos) {
+
+ if(!pos) pos = this.position;
+ var mod = d == "absolute" ? 1 : -1;
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+ return {
+ top: (
+ pos.top // The absolute mouse position
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+ ),
+ left: (
+ pos.left // The absolute mouse position
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+ )
+ };
+
+ },
+
+ _generatePosition: function(event) {
+
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+ // This is another very weird special case that only happens for relative elements:
+ // 1. If the css position is relative
+ // 2. and the scroll parent is the document or similar to the offset parent
+ // we have to refresh the relative offset during the scroll so there are no jumps
+ if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
+ this.offset.relative = this._getRelativeOffset();
+ }
+
+ var pageX = event.pageX;
+ var pageY = event.pageY;
+
+ /*
+ * - Position constraining -
+ * Constrain the position to a mix of grid, containment.
+ */
+
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
+
+ if(this.containment) {
+ if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
+ if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
+ }
+
+ if(o.grid) {
+ var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
+ pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+
+ var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
+ pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+ }
+
+ }
+
+ return {
+ top: (
+ pageY // The absolute mouse position
+ - this.offset.click.top // Click offset (relative to the element)
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+ ),
+ left: (
+ pageX // The absolute mouse position
+ - this.offset.click.left // Click offset (relative to the element)
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+ )
+ };
+
+ },
+
+ _rearrange: function(event, i, a, hardRefresh) {
+
+ a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
+
+ //Various things done here to improve the performance:
+ // 1. we create a setTimeout, that calls refreshPositions
+ // 2. on the instance, we have a counter variable, that get's higher after every append
+ // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
+ // 4. this lets only the last addition to the timeout stack through
+ this.counter = this.counter ? ++this.counter : 1;
+ var counter = this.counter;
+
+ this._delay(function() {
+ if(counter == this.counter) this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
+ });
+
+ },
+
+ _clear: function(event, noPropagation) {
+
+ this.reverting = false;
+ // We delay all events that have to be triggered to after the point where the placeholder has been removed and
+ // everything else normalized again
+ var delayedTriggers = [];
+
+ // We first have to update the dom position of the actual currentItem
+ // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
+ if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem);
+ this._noFinalSort = null;
+
+ if(this.helper[0] == this.currentItem[0]) {
+ for(var i in this._storedCSS) {
+ if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
+ }
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
+ } else {
+ this.currentItem.show();
+ }
+
+ if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
+ if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
+
+ // Check if the items Container has Changed and trigger appropriate
+ // events.
+ if (this !== this.currentContainer) {
+ if(!noPropagation) {
+ delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
+ }
+ }
+
+
+ //Post events to containers
+ for (var i = this.containers.length - 1; i >= 0; i--){
+ if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
+ if(this.containers[i].containerCache.over) {
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
+ this.containers[i].containerCache.over = 0;
+ }
+ }
+
+ //Do what was originally in plugins
+ if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
+ if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
+ if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
+
+ this.dragging = false;
+ if(this.cancelHelperRemoval) {
+ if(!noPropagation) {
+ this._trigger("beforeStop", event, this._uiHash());
+ for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
+ this._trigger("stop", event, this._uiHash());
+ }
+
+ this.fromOutside = false;
+ return false;
+ }
+
+ if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
+
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+ this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+
+ if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
+
+ if(!noPropagation) {
+ for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
+ this._trigger("stop", event, this._uiHash());
+ }
+
+ this.fromOutside = false;
+ return true;
+
+ },
+
+ _trigger: function() {
+ if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
+ this.cancel();
+ }
+ },
+
+ _uiHash: function(_inst) {
+ var inst = _inst || this;
+ return {
+ helper: inst.helper,
+ placeholder: inst.placeholder || $([]),
+ position: inst.position,
+ originalPosition: inst.originalPosition,
+ offset: inst.positionAbs,
+ item: inst.currentItem,
+ sender: _inst ? _inst.element : null
+ };
+ }
+
+});
+
+})(jQuery);
+(function( $ ) {
+
+function modifier( fn ) {
+ return function() {
+ var previous = this.element.val();
+ fn.apply( this, arguments );
+ this._refresh();
+ if ( previous !== this.element.val() ) {
+ this._trigger( "change" );
+ }
+ };
+}
+
+$.widget( "ui.spinner", {
+ version: "1.9.2",
+ defaultElement: "<input>",
+ widgetEventPrefix: "spin",
+ options: {
+ culture: null,
+ icons: {
+ down: "ui-icon-triangle-1-s",
+ up: "ui-icon-triangle-1-n"
+ },
+ incremental: true,
+ max: null,
+ min: null,
+ numberFormat: null,
+ page: 10,
+ step: 1,
+
+ change: null,
+ spin: null,
+ start: null,
+ stop: null
+ },
+
+ _create: function() {
+ // handle string values that need to be parsed
+ this._setOption( "max", this.options.max );
+ this._setOption( "min", this.options.min );
+ this._setOption( "step", this.options.step );
+
+ // format the value, but don't constrain
+ this._value( this.element.val(), true );
+
+ this._draw();
+ this._on( this._events );
+ this._refresh();
+
+ // turning off autocomplete prevents the browser from remembering the
+ // value when navigating through history, so we re-enable autocomplete
+ // if the page is unloaded before the widget is destroyed. #7790
+ this._on( this.window, {
+ beforeunload: function() {
+ this.element.removeAttr( "autocomplete" );
+ }
+ });
+ },
+
+ _getCreateOptions: function() {
+ var options = {},
+ element = this.element;
+
+ $.each( [ "min", "max", "step" ], function( i, option ) {
+ var value = element.attr( option );
+ if ( value !== undefined && value.length ) {
+ options[ option ] = value;
+ }
+ });
+
+ return options;
+ },
+
+ _events: {
+ keydown: function( event ) {
+ if ( this._start( event ) && this._keydown( event ) ) {
+ event.preventDefault();
+ }
+ },
+ keyup: "_stop",
+ focus: function() {
+ this.previous = this.element.val();
+ },
+ blur: function( event ) {
+ if ( this.cancelBlur ) {
+ delete this.cancelBlur;
+ return;
+ }
+
+ this._refresh();
+ if ( this.previous !== this.element.val() ) {
+ this._trigger( "change", event );
+ }
+ },
+ mousewheel: function( event, delta ) {
+ if ( !delta ) {
+ return;
+ }
+ if ( !this.spinning && !this._start( event ) ) {
+ return false;
+ }
+
+ this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
+ clearTimeout( this.mousewheelTimer );
+ this.mousewheelTimer = this._delay(function() {
+ if ( this.spinning ) {
+ this._stop( event );
+ }
+ }, 100 );
+ event.preventDefault();
+ },
+ "mousedown .ui-spinner-button": function( event ) {
+ var previous;
+
+ // We never want the buttons to have focus; whenever the user is
+ // interacting with the spinner, the focus should be on the input.
+ // If the input is focused then this.previous is properly set from
+ // when the input first received focus. If the input is not focused
+ // then we need to set this.previous based on the value before spinning.
+ previous = this.element[0] === this.document[0].activeElement ?
+ this.previous : this.element.val();
+ function checkFocus() {
+ var isActive = this.element[0] === this.document[0].activeElement;
+ if ( !isActive ) {
+ this.element.focus();
+ this.previous = previous;
+ // support: IE
+ // IE sets focus asynchronously, so we need to check if focus
+ // moved off of the input because the user clicked on the button.
+ this._delay(function() {
+ this.previous = previous;
+ });
+ }
+ }
+
+ // ensure focus is on (or stays on) the text field
+ event.preventDefault();
+ checkFocus.call( this );
+
+ // support: IE
+ // IE doesn't prevent moving focus even with event.preventDefault()
+ // so we set a flag to know when we should ignore the blur event
+ // and check (again) if focus moved off of the input.
+ this.cancelBlur = true;
+ this._delay(function() {
+ delete this.cancelBlur;
+ checkFocus.call( this );
+ });
+
+ if ( this._start( event ) === false ) {
+ return;
+ }
+
+ this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
+ },
+ "mouseup .ui-spinner-button": "_stop",
+ "mouseenter .ui-spinner-button": function( event ) {
+ // button will add ui-state-active if mouse was down while mouseleave and kept down
+ if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
+ return;
+ }
+
+ if ( this._start( event ) === false ) {
+ return false;
+ }
+ this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
+ },
+ // TODO: do we really want to consider this a stop?
+ // shouldn't we just stop the repeater and wait until mouseup before
+ // we trigger the stop event?
+ "mouseleave .ui-spinner-button": "_stop"
+ },
+
+ _draw: function() {
+ var uiSpinner = this.uiSpinner = this.element
+ .addClass( "ui-spinner-input" )
+ .attr( "autocomplete", "off" )
+ .wrap( this._uiSpinnerHtml() )
+ .parent()
+ // add buttons
+ .append( this._buttonHtml() );
+
+ this.element.attr( "role", "spinbutton" );
+
+ // button bindings
+ this.buttons = uiSpinner.find( ".ui-spinner-button" )
+ .attr( "tabIndex", -1 )
+ .button()
+ .removeClass( "ui-corner-all" );
+
+ // IE 6 doesn't understand height: 50% for the buttons
+ // unless the wrapper has an explicit height
+ if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
+ uiSpinner.height() > 0 ) {
+ uiSpinner.height( uiSpinner.height() );
+ }
+
+ // disable spinner if element was already disabled
+ if ( this.options.disabled ) {
+ this.disable();
+ }
+ },
+
+ _keydown: function( event ) {
+ var options = this.options,
+ keyCode = $.ui.keyCode;
+
+ switch ( event.keyCode ) {
+ case keyCode.UP:
+ this._repeat( null, 1, event );
+ return true;
+ case keyCode.DOWN:
+ this._repeat( null, -1, event );
+ return true;
+ case keyCode.PAGE_UP:
+ this._repeat( null, options.page, event );
+ return true;
+ case keyCode.PAGE_DOWN:
+ this._repeat( null, -options.page, event );
+ return true;
+ }
+
+ return false;
+ },
+
+ _uiSpinnerHtml: function() {
+ return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
+ },
+
+ _buttonHtml: function() {
+ return "" +
+ "<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
+ "<span class='ui-icon " + this.options.icons.up + "'>&#9650;</span>" +
+ "</a>" +
+ "<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
+ "<span class='ui-icon " + this.options.icons.down + "'>&#9660;</span>" +
+ "</a>";
+ },
+
+ _start: function( event ) {
+ if ( !this.spinning && this._trigger( "start", event ) === false ) {
+ return false;
+ }
+
+ if ( !this.counter ) {
+ this.counter = 1;
+ }
+ this.spinning = true;
+ return true;
+ },
+
+ _repeat: function( i, steps, event ) {
+ i = i || 500;
+
+ clearTimeout( this.timer );
+ this.timer = this._delay(function() {
+ this._repeat( 40, steps, event );
+ }, i );
+
+ this._spin( steps * this.options.step, event );
+ },
+
+ _spin: function( step, event ) {
+ var value = this.value() || 0;
+
+ if ( !this.counter ) {
+ this.counter = 1;
+ }
+
+ value = this._adjustValue( value + step * this._increment( this.counter ) );
+
+ if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
+ this._value( value );
+ this.counter++;
+ }
+ },
+
+ _increment: function( i ) {
+ var incremental = this.options.incremental;
+
+ if ( incremental ) {
+ return $.isFunction( incremental ) ?
+ incremental( i ) :
+ Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 );
+ }
+
+ return 1;
+ },
+
+ _precision: function() {
+ var precision = this._precisionOf( this.options.step );
+ if ( this.options.min !== null ) {
+ precision = Math.max( precision, this._precisionOf( this.options.min ) );
+ }
+ return precision;
+ },
+
+ _precisionOf: function( num ) {
+ var str = num.toString(),
+ decimal = str.indexOf( "." );
+ return decimal === -1 ? 0 : str.length - decimal - 1;
+ },
+
+ _adjustValue: function( value ) {
+ var base, aboveMin,
+ options = this.options;
+
+ // make sure we're at a valid step
+ // - find out where we are relative to the base (min or 0)
+ base = options.min !== null ? options.min : 0;
+ aboveMin = value - base;
+ // - round to the nearest step
+ aboveMin = Math.round(aboveMin / options.step) * options.step;
+ // - rounding is based on 0, so adjust back to our base
+ value = base + aboveMin;
+
+ // fix precision from bad JS floating point math
+ value = parseFloat( value.toFixed( this._precision() ) );
+
+ // clamp the value
+ if ( options.max !== null && value > options.max) {
+ return options.max;
+ }
+ if ( options.min !== null && value < options.min ) {
+ return options.min;
+ }
+
+ return value;
+ },
+
+ _stop: function( event ) {
+ if ( !this.spinning ) {
+ return;
+ }
+
+ clearTimeout( this.timer );
+ clearTimeout( this.mousewheelTimer );
+ this.counter = 0;
+ this.spinning = false;
+ this._trigger( "stop", event );
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "culture" || key === "numberFormat" ) {
+ var prevValue = this._parse( this.element.val() );
+ this.options[ key ] = value;
+ this.element.val( this._format( prevValue ) );
+ return;
+ }
+
+ if ( key === "max" || key === "min" || key === "step" ) {
+ if ( typeof value === "string" ) {
+ value = this._parse( value );
+ }
+ }
+
+ this._super( key, value );
+
+ if ( key === "disabled" ) {
+ if ( value ) {
+ this.element.prop( "disabled", true );
+ this.buttons.button( "disable" );
+ } else {
+ this.element.prop( "disabled", false );
+ this.buttons.button( "enable" );
+ }
+ }
+ },
+
+ _setOptions: modifier(function( options ) {
+ this._super( options );
+ this._value( this.element.val() );
+ }),
+
+ _parse: function( val ) {
+ if ( typeof val === "string" && val !== "" ) {
+ val = window.Globalize && this.options.numberFormat ?
+ Globalize.parseFloat( val, 10, this.options.culture ) : +val;
+ }
+ return val === "" || isNaN( val ) ? null : val;
+ },
+
+ _format: function( value ) {
+ if ( value === "" ) {
+ return "";
+ }
+ return window.Globalize && this.options.numberFormat ?
+ Globalize.format( value, this.options.numberFormat, this.options.culture ) :
+ value;
+ },
+
+ _refresh: function() {
+ this.element.attr({
+ "aria-valuemin": this.options.min,
+ "aria-valuemax": this.options.max,
+ // TODO: what should we do with values that can't be parsed?
+ "aria-valuenow": this._parse( this.element.val() )
+ });
+ },
+
+ // update the value without triggering change
+ _value: function( value, allowAny ) {
+ var parsed;
+ if ( value !== "" ) {
+ parsed = this._parse( value );
+ if ( parsed !== null ) {
+ if ( !allowAny ) {
+ parsed = this._adjustValue( parsed );
+ }
+ value = this._format( parsed );
+ }
+ }
+ this.element.val( value );
+ this._refresh();
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass( "ui-spinner-input" )
+ .prop( "disabled", false )
+ .removeAttr( "autocomplete" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-valuemin" )
+ .removeAttr( "aria-valuemax" )
+ .removeAttr( "aria-valuenow" );
+ this.uiSpinner.replaceWith( this.element );
+ },
+
+ stepUp: modifier(function( steps ) {
+ this._stepUp( steps );
+ }),
+ _stepUp: function( steps ) {
+ this._spin( (steps || 1) * this.options.step );
+ },
+
+ stepDown: modifier(function( steps ) {
+ this._stepDown( steps );
+ }),
+ _stepDown: function( steps ) {
+ this._spin( (steps || 1) * -this.options.step );
+ },
+
+ pageUp: modifier(function( pages ) {
+ this._stepUp( (pages || 1) * this.options.page );
+ }),
+
+ pageDown: modifier(function( pages ) {
+ this._stepDown( (pages || 1) * this.options.page );
+ }),
+
+ value: function( newVal ) {
+ if ( !arguments.length ) {
+ return this._parse( this.element.val() );
+ }
+ modifier( this._value ).call( this, newVal );
+ },
+
+ widget: function() {
+ return this.uiSpinner;
+ }
+});
+
+}( jQuery ) );
+(function( $, undefined ) {
+
+var tabId = 0,
+ rhash = /#.*$/;
+
+function getNextTabId() {
+ return ++tabId;
+}
+
+function isLocal( anchor ) {
+ return anchor.hash.length > 1 &&
+ anchor.href.replace( rhash, "" ) ===
+ location.href.replace( rhash, "" )
+ // support: Safari 5.1
+ // Safari 5.1 doesn't encode spaces in window.location
+ // but it does encode spaces from anchors (#8777)
+ .replace( /\s/g, "%20" );
+}
+
+$.widget( "ui.tabs", {
+ version: "1.9.2",
+ delay: 300,
+ options: {
+ active: null,
+ collapsible: false,
+ event: "click",
+ heightStyle: "content",
+ hide: null,
+ show: null,
+
+ // callbacks
+ activate: null,
+ beforeActivate: null,
+ beforeLoad: null,
+ load: null
+ },
+
+ _create: function() {
+ var that = this,
+ options = this.options,
+ active = options.active,
+ locationHash = location.hash.substring( 1 );
+
+ this.running = false;
+
+ this.element
+ .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
+ .toggleClass( "ui-tabs-collapsible", options.collapsible )
+ // Prevent users from focusing disabled tabs via click
+ .delegate( ".ui-tabs-nav > li", "mousedown" + this.eventNamespace, function( event ) {
+ if ( $( this ).is( ".ui-state-disabled" ) ) {
+ event.preventDefault();
+ }
+ })
+ // support: IE <9
+ // Preventing the default action in mousedown doesn't prevent IE
+ // from focusing the element, so if the anchor gets focused, blur.
+ // We don't have to worry about focusing the previously focused
+ // element since clicking on a non-focusable element should focus
+ // the body anyway.
+ .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
+ if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
+ this.blur();
+ }
+ });
+
+ this._processTabs();
+
+ if ( active === null ) {
+ // check the fragment identifier in the URL
+ if ( locationHash ) {
+ this.tabs.each(function( i, tab ) {
+ if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
+ active = i;
+ return false;
+ }
+ });
+ }
+
+ // check for a tab marked active via a class
+ if ( active === null ) {
+ active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
+ }
+
+ // no active tab, set to false
+ if ( active === null || active === -1 ) {
+ active = this.tabs.length ? 0 : false;
+ }
+ }
+
+ // handle numbers: negative, out of range
+ if ( active !== false ) {
+ active = this.tabs.index( this.tabs.eq( active ) );
+ if ( active === -1 ) {
+ active = options.collapsible ? false : 0;
+ }
+ }
+ options.active = active;
+
+ // don't allow collapsible: false and active: false
+ if ( !options.collapsible && options.active === false && this.anchors.length ) {
+ options.active = 0;
+ }
+
+ // Take disabling tabs via class attribute from HTML
+ // into account and update option properly.
+ if ( $.isArray( options.disabled ) ) {
+ options.disabled = $.unique( options.disabled.concat(
+ $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
+ return that.tabs.index( li );
+ })
+ ) ).sort();
+ }
+
+ // check for length avoids error when initializing empty list
+ if ( this.options.active !== false && this.anchors.length ) {
+ this.active = this._findActive( this.options.active );
+ } else {
+ this.active = $();
+ }
+
+ this._refresh();
+
+ if ( this.active.length ) {
+ this.load( options.active );
+ }
+ },
+
+ _getCreateEventData: function() {
+ return {
+ tab: this.active,
+ panel: !this.active.length ? $() : this._getPanelForTab( this.active )
+ };
+ },
+
+ _tabKeydown: function( event ) {
+ var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
+ selectedIndex = this.tabs.index( focusedTab ),
+ goingForward = true;
+
+ if ( this._handlePageNav( event ) ) {
+ return;
+ }
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.RIGHT:
+ case $.ui.keyCode.DOWN:
+ selectedIndex++;
+ break;
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.LEFT:
+ goingForward = false;
+ selectedIndex--;
+ break;
+ case $.ui.keyCode.END:
+ selectedIndex = this.anchors.length - 1;
+ break;
+ case $.ui.keyCode.HOME:
+ selectedIndex = 0;
+ break;
+ case $.ui.keyCode.SPACE:
+ // Activate only, no collapsing
+ event.preventDefault();
+ clearTimeout( this.activating );
+ this._activate( selectedIndex );
+ return;
+ case $.ui.keyCode.ENTER:
+ // Toggle (cancel delayed activation, allow collapsing)
+ event.preventDefault();
+ clearTimeout( this.activating );
+ // Determine if we should collapse or activate
+ this._activate( selectedIndex === this.options.active ? false : selectedIndex );
+ return;
+ default:
+ return;
+ }
+
+ // Focus the appropriate tab, based on which key was pressed
+ event.preventDefault();
+ clearTimeout( this.activating );
+ selectedIndex = this._focusNextTab( selectedIndex, goingForward );
+
+ // Navigating with control key will prevent automatic activation
+ if ( !event.ctrlKey ) {
+ // Update aria-selected immediately so that AT think the tab is already selected.
+ // Otherwise AT may confuse the user by stating that they need to activate the tab,
+ // but the tab will already be activated by the time the announcement finishes.
+ focusedTab.attr( "aria-selected", "false" );
+ this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
+
+ this.activating = this._delay(function() {
+ this.option( "active", selectedIndex );
+ }, this.delay );
+ }
+ },
+
+ _panelKeydown: function( event ) {
+ if ( this._handlePageNav( event ) ) {
+ return;
+ }
+
+ // Ctrl+up moves focus to the current tab
+ if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
+ event.preventDefault();
+ this.active.focus();
+ }
+ },
+
+ // Alt+page up/down moves focus to the previous/next tab (and activates)
+ _handlePageNav: function( event ) {
+ if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
+ this._activate( this._focusNextTab( this.options.active - 1, false ) );
+ return true;
+ }
+ if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
+ this._activate( this._focusNextTab( this.options.active + 1, true ) );
+ return true;
+ }
+ },
+
+ _findNextTab: function( index, goingForward ) {
+ var lastTabIndex = this.tabs.length - 1;
+
+ function constrain() {
+ if ( index > lastTabIndex ) {
+ index = 0;
+ }
+ if ( index < 0 ) {
+ index = lastTabIndex;
+ }
+ return index;
+ }
+
+ while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
+ index = goingForward ? index + 1 : index - 1;
+ }
+
+ return index;
+ },
+
+ _focusNextTab: function( index, goingForward ) {
+ index = this._findNextTab( index, goingForward );
+ this.tabs.eq( index ).focus();
+ return index;
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "active" ) {
+ // _activate() will handle invalid values and update this.options
+ this._activate( value );
+ return;
+ }
+
+ if ( key === "disabled" ) {
+ // don't use the widget factory's disabled handling
+ this._setupDisabled( value );
+ return;
+ }
+
+ this._super( key, value);
+
+ if ( key === "collapsible" ) {
+ this.element.toggleClass( "ui-tabs-collapsible", value );
+ // Setting collapsible: false while collapsed; open first panel
+ if ( !value && this.options.active === false ) {
+ this._activate( 0 );
+ }
+ }
+
+ if ( key === "event" ) {
+ this._setupEvents( value );
+ }
+
+ if ( key === "heightStyle" ) {
+ this._setupHeightStyle( value );
+ }
+ },
+
+ _tabId: function( tab ) {
+ return tab.attr( "aria-controls" ) || "ui-tabs-" + getNextTabId();
+ },
+
+ _sanitizeSelector: function( hash ) {
+ return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
+ },
+
+ refresh: function() {
+ var options = this.options,
+ lis = this.tablist.children( ":has(a[href])" );
+
+ // get disabled tabs from class attribute from HTML
+ // this will get converted to a boolean if needed in _refresh()
+ options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
+ return lis.index( tab );
+ });
+
+ this._processTabs();
+
+ // was collapsed or no tabs
+ if ( options.active === false || !this.anchors.length ) {
+ options.active = false;
+ this.active = $();
+ // was active, but active tab is gone
+ } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
+ // all remaining tabs are disabled
+ if ( this.tabs.length === options.disabled.length ) {
+ options.active = false;
+ this.active = $();
+ // activate previous tab
+ } else {
+ this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
+ }
+ // was active, active tab still exists
+ } else {
+ // make sure active index is correct
+ options.active = this.tabs.index( this.active );
+ }
+
+ this._refresh();
+ },
+
+ _refresh: function() {
+ this._setupDisabled( this.options.disabled );
+ this._setupEvents( this.options.event );
+ this._setupHeightStyle( this.options.heightStyle );
+
+ this.tabs.not( this.active ).attr({
+ "aria-selected": "false",
+ tabIndex: -1
+ });
+ this.panels.not( this._getPanelForTab( this.active ) )
+ .hide()
+ .attr({
+ "aria-expanded": "false",
+ "aria-hidden": "true"
+ });
+
+ // Make sure one tab is in the tab order
+ if ( !this.active.length ) {
+ this.tabs.eq( 0 ).attr( "tabIndex", 0 );
+ } else {
+ this.active
+ .addClass( "ui-tabs-active ui-state-active" )
+ .attr({
+ "aria-selected": "true",
+ tabIndex: 0
+ });
+ this._getPanelForTab( this.active )
+ .show()
+ .attr({
+ "aria-expanded": "true",
+ "aria-hidden": "false"
+ });
+ }
+ },
+
+ _processTabs: function() {
+ var that = this;
+
+ this.tablist = this._getList()
+ .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
+ .attr( "role", "tablist" );
+
+ this.tabs = this.tablist.find( "> li:has(a[href])" )
+ .addClass( "ui-state-default ui-corner-top" )
+ .attr({
+ role: "tab",
+ tabIndex: -1
+ });
+
+ this.anchors = this.tabs.map(function() {
+ return $( "a", this )[ 0 ];
+ })
+ .addClass( "ui-tabs-anchor" )
+ .attr({
+ role: "presentation",
+ tabIndex: -1
+ });
+
+ this.panels = $();
+
+ this.anchors.each(function( i, anchor ) {
+ var selector, panel, panelId,
+ anchorId = $( anchor ).uniqueId().attr( "id" ),
+ tab = $( anchor ).closest( "li" ),
+ originalAriaControls = tab.attr( "aria-controls" );
+
+ // inline tab
+ if ( isLocal( anchor ) ) {
+ selector = anchor.hash;
+ panel = that.element.find( that._sanitizeSelector( selector ) );
+ // remote tab
+ } else {
+ panelId = that._tabId( tab );
+ selector = "#" + panelId;
+ panel = that.element.find( selector );
+ if ( !panel.length ) {
+ panel = that._createPanel( panelId );
+ panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
+ }
+ panel.attr( "aria-live", "polite" );
+ }
+
+ if ( panel.length) {
+ that.panels = that.panels.add( panel );
+ }
+ if ( originalAriaControls ) {
+ tab.data( "ui-tabs-aria-controls", originalAriaControls );
+ }
+ tab.attr({
+ "aria-controls": selector.substring( 1 ),
+ "aria-labelledby": anchorId
+ });
+ panel.attr( "aria-labelledby", anchorId );
+ });
+
+ this.panels
+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+ .attr( "role", "tabpanel" );
+ },
+
+ // allow overriding how to find the list for rare usage scenarios (#7715)
+ _getList: function() {
+ return this.element.find( "ol,ul" ).eq( 0 );
+ },
+
+ _createPanel: function( id ) {
+ return $( "<div>" )
+ .attr( "id", id )
+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+ .data( "ui-tabs-destroy", true );
+ },
+
+ _setupDisabled: function( disabled ) {
+ if ( $.isArray( disabled ) ) {
+ if ( !disabled.length ) {
+ disabled = false;
+ } else if ( disabled.length === this.anchors.length ) {
+ disabled = true;
+ }
+ }
+
+ // disable tabs
+ for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) {
+ if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
+ $( li )
+ .addClass( "ui-state-disabled" )
+ .attr( "aria-disabled", "true" );
+ } else {
+ $( li )
+ .removeClass( "ui-state-disabled" )
+ .removeAttr( "aria-disabled" );
+ }
+ }
+
+ this.options.disabled = disabled;
+ },
+
+ _setupEvents: function( event ) {
+ var events = {
+ click: function( event ) {
+ event.preventDefault();
+ }
+ };
+ if ( event ) {
+ $.each( event.split(" "), function( index, eventName ) {
+ events[ eventName ] = "_eventHandler";
+ });
+ }
+
+ this._off( this.anchors.add( this.tabs ).add( this.panels ) );
+ this._on( this.anchors, events );
+ this._on( this.tabs, { keydown: "_tabKeydown" } );
+ this._on( this.panels, { keydown: "_panelKeydown" } );
+
+ this._focusable( this.tabs );
+ this._hoverable( this.tabs );
+ },
+
+ _setupHeightStyle: function( heightStyle ) {
+ var maxHeight, overflow,
+ parent = this.element.parent();
+
+ if ( heightStyle === "fill" ) {
+ // IE 6 treats height like minHeight, so we need to turn off overflow
+ // in order to get a reliable height
+ // we use the minHeight support test because we assume that only
+ // browsers that don't support minHeight will treat height as minHeight
+ if ( !$.support.minHeight ) {
+ overflow = parent.css( "overflow" );
+ parent.css( "overflow", "hidden");
+ }
+ maxHeight = parent.height();
+ this.element.siblings( ":visible" ).each(function() {
+ var elem = $( this ),
+ position = elem.css( "position" );
+
+ if ( position === "absolute" || position === "fixed" ) {
+ return;
+ }
+ maxHeight -= elem.outerHeight( true );
+ });
+ if ( overflow ) {
+ parent.css( "overflow", overflow );
+ }
+
+ this.element.children().not( this.panels ).each(function() {
+ maxHeight -= $( this ).outerHeight( true );
+ });
+
+ this.panels.each(function() {
+ $( this ).height( Math.max( 0, maxHeight -
+ $( this ).innerHeight() + $( this ).height() ) );
+ })
+ .css( "overflow", "auto" );
+ } else if ( heightStyle === "auto" ) {
+ maxHeight = 0;
+ this.panels.each(function() {
+ maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
+ }).height( maxHeight );
+ }
+ },
+
+ _eventHandler: function( event ) {
+ var options = this.options,
+ active = this.active,
+ anchor = $( event.currentTarget ),
+ tab = anchor.closest( "li" ),
+ clickedIsActive = tab[ 0 ] === active[ 0 ],
+ collapsing = clickedIsActive && options.collapsible,
+ toShow = collapsing ? $() : this._getPanelForTab( tab ),
+ toHide = !active.length ? $() : this._getPanelForTab( active ),
+ eventData = {
+ oldTab: active,
+ oldPanel: toHide,
+ newTab: collapsing ? $() : tab,
+ newPanel: toShow
+ };
+
+ event.preventDefault();
+
+ if ( tab.hasClass( "ui-state-disabled" ) ||
+ // tab is already loading
+ tab.hasClass( "ui-tabs-loading" ) ||
+ // can't switch durning an animation
+ this.running ||
+ // click on active header, but not collapsible
+ ( clickedIsActive && !options.collapsible ) ||
+ // allow canceling activation
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
+ return;
+ }
+
+ options.active = collapsing ? false : this.tabs.index( tab );
+
+ this.active = clickedIsActive ? $() : tab;
+ if ( this.xhr ) {
+ this.xhr.abort();
+ }
+
+ if ( !toHide.length && !toShow.length ) {
+ $.error( "jQuery UI Tabs: Mismatching fragment identifier." );
+ }
+
+ if ( toShow.length ) {
+ this.load( this.tabs.index( tab ), event );
+ }
+ this._toggle( event, eventData );
+ },
+
+ // handles show/hide for selecting tabs
+ _toggle: function( event, eventData ) {
+ var that = this,
+ toShow = eventData.newPanel,
+ toHide = eventData.oldPanel;
+
+ this.running = true;
+
+ function complete() {
+ that.running = false;
+ that._trigger( "activate", event, eventData );
+ }
+
+ function show() {
+ eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
+
+ if ( toShow.length && that.options.show ) {
+ that._show( toShow, that.options.show, complete );
+ } else {
+ toShow.show();
+ complete();
+ }
+ }
+
+ // start out by hiding, then showing, then completing
+ if ( toHide.length && this.options.hide ) {
+ this._hide( toHide, this.options.hide, function() {
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+ show();
+ });
+ } else {
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+ toHide.hide();
+ show();
+ }
+
+ toHide.attr({
+ "aria-expanded": "false",
+ "aria-hidden": "true"
+ });
+ eventData.oldTab.attr( "aria-selected", "false" );
+ // If we're switching tabs, remove the old tab from the tab order.
+ // If we're opening from collapsed state, remove the previous tab from the tab order.
+ // If we're collapsing, then keep the collapsing tab in the tab order.
+ if ( toShow.length && toHide.length ) {
+ eventData.oldTab.attr( "tabIndex", -1 );
+ } else if ( toShow.length ) {
+ this.tabs.filter(function() {
+ return $( this ).attr( "tabIndex" ) === 0;
+ })
+ .attr( "tabIndex", -1 );
+ }
+
+ toShow.attr({
+ "aria-expanded": "true",
+ "aria-hidden": "false"
+ });
+ eventData.newTab.attr({
+ "aria-selected": "true",
+ tabIndex: 0
+ });
+ },
+
+ _activate: function( index ) {
+ var anchor,
+ active = this._findActive( index );
+
+ // trying to activate the already active panel
+ if ( active[ 0 ] === this.active[ 0 ] ) {
+ return;
+ }
+
+ // trying to collapse, simulate a click on the current active header
+ if ( !active.length ) {
+ active = this.active;
+ }
+
+ anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
+ this._eventHandler({
+ target: anchor,
+ currentTarget: anchor,
+ preventDefault: $.noop
+ });
+ },
+
+ _findActive: function( index ) {
+ return index === false ? $() : this.tabs.eq( index );
+ },
+
+ _getIndex: function( index ) {
+ // meta-function to give users option to provide a href string instead of a numerical index.
+ if ( typeof index === "string" ) {
+ index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
+ }
+
+ return index;
+ },
+
+ _destroy: function() {
+ if ( this.xhr ) {
+ this.xhr.abort();
+ }
+
+ this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );
+
+ this.tablist
+ .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
+ .removeAttr( "role" );
+
+ this.anchors
+ .removeClass( "ui-tabs-anchor" )
+ .removeAttr( "role" )
+ .removeAttr( "tabIndex" )
+ .removeData( "href.tabs" )
+ .removeData( "load.tabs" )
+ .removeUniqueId();
+
+ this.tabs.add( this.panels ).each(function() {
+ if ( $.data( this, "ui-tabs-destroy" ) ) {
+ $( this ).remove();
+ } else {
+ $( this )
+ .removeClass( "ui-state-default ui-state-active ui-state-disabled " +
+ "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" )
+ .removeAttr( "tabIndex" )
+ .removeAttr( "aria-live" )
+ .removeAttr( "aria-busy" )
+ .removeAttr( "aria-selected" )
+ .removeAttr( "aria-labelledby" )
+ .removeAttr( "aria-hidden" )
+ .removeAttr( "aria-expanded" )
+ .removeAttr( "role" );
+ }
+ });
+
+ this.tabs.each(function() {
+ var li = $( this ),
+ prev = li.data( "ui-tabs-aria-controls" );
+ if ( prev ) {
+ li.attr( "aria-controls", prev );
+ } else {
+ li.removeAttr( "aria-controls" );
+ }
+ });
+
+ this.panels.show();
+
+ if ( this.options.heightStyle !== "content" ) {
+ this.panels.css( "height", "" );
+ }
+ },
+
+ enable: function( index ) {
+ var disabled = this.options.disabled;
+ if ( disabled === false ) {
+ return;
+ }
+
+ if ( index === undefined ) {
+ disabled = false;
+ } else {
+ index = this._getIndex( index );
+ if ( $.isArray( disabled ) ) {
+ disabled = $.map( disabled, function( num ) {
+ return num !== index ? num : null;
+ });
+ } else {
+ disabled = $.map( this.tabs, function( li, num ) {
+ return num !== index ? num : null;
+ });
+ }
+ }
+ this._setupDisabled( disabled );
+ },
+
+ disable: function( index ) {
+ var disabled = this.options.disabled;
+ if ( disabled === true ) {
+ return;
+ }
+
+ if ( index === undefined ) {
+ disabled = true;
+ } else {
+ index = this._getIndex( index );
+ if ( $.inArray( index, disabled ) !== -1 ) {
+ return;
+ }
+ if ( $.isArray( disabled ) ) {
+ disabled = $.merge( [ index ], disabled ).sort();
+ } else {
+ disabled = [ index ];
+ }
+ }
+ this._setupDisabled( disabled );
+ },
+
+ load: function( index, event ) {
+ index = this._getIndex( index );
+ var that = this,
+ tab = this.tabs.eq( index ),
+ anchor = tab.find( ".ui-tabs-anchor" ),
+ panel = this._getPanelForTab( tab ),
+ eventData = {
+ tab: tab,
+ panel: panel
+ };
+
+ // not remote
+ if ( isLocal( anchor[ 0 ] ) ) {
+ return;
+ }
+
+ this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
+
+ // support: jQuery <1.8
+ // jQuery <1.8 returns false if the request is canceled in beforeSend,
+ // but as of 1.8, $.ajax() always returns a jqXHR object.
+ if ( this.xhr && this.xhr.statusText !== "canceled" ) {
+ tab.addClass( "ui-tabs-loading" );
+ panel.attr( "aria-busy", "true" );
+
+ this.xhr
+ .success(function( response ) {
+ // support: jQuery <1.8
+ // http://bugs.jquery.com/ticket/11778
+ setTimeout(function() {
+ panel.html( response );
+ that._trigger( "load", event, eventData );
+ }, 1 );
+ })
+ .complete(function( jqXHR, status ) {
+ // support: jQuery <1.8
+ // http://bugs.jquery.com/ticket/11778
+ setTimeout(function() {
+ if ( status === "abort" ) {
+ that.panels.stop( false, true );
+ }
+
+ tab.removeClass( "ui-tabs-loading" );
+ panel.removeAttr( "aria-busy" );
+
+ if ( jqXHR === that.xhr ) {
+ delete that.xhr;
+ }
+ }, 1 );
+ });
+ }
+ },
+
+ // TODO: Remove this function in 1.10 when ajaxOptions is removed
+ _ajaxSettings: function( anchor, event, eventData ) {
+ var that = this;
+ return {
+ url: anchor.attr( "href" ),
+ beforeSend: function( jqXHR, settings ) {
+ return that._trigger( "beforeLoad", event,
+ $.extend( { jqXHR : jqXHR, ajaxSettings: settings }, eventData ) );
+ }
+ };
+ },
+
+ _getPanelForTab: function( tab ) {
+ var id = $( tab ).attr( "aria-controls" );
+ return this.element.find( this._sanitizeSelector( "#" + id ) );
+ }
+});
+
+// DEPRECATED
+if ( $.uiBackCompat !== false ) {
+
+ // helper method for a lot of the back compat extensions
+ $.ui.tabs.prototype._ui = function( tab, panel ) {
+ return {
+ tab: tab,
+ panel: panel,
+ index: this.anchors.index( tab )
+ };
+ };
+
+ // url method
+ $.widget( "ui.tabs", $.ui.tabs, {
+ url: function( index, url ) {
+ this.anchors.eq( index ).attr( "href", url );
+ }
+ });
+
+ // TODO: Remove _ajaxSettings() method when removing this extension
+ // ajaxOptions and cache options
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ ajaxOptions: null,
+ cache: false
+ },
+
+ _create: function() {
+ this._super();
+
+ var that = this;
+
+ this._on({ tabsbeforeload: function( event, ui ) {
+ // tab is already cached
+ if ( $.data( ui.tab[ 0 ], "cache.tabs" ) ) {
+ event.preventDefault();
+ return;
+ }
+
+ ui.jqXHR.success(function() {
+ if ( that.options.cache ) {
+ $.data( ui.tab[ 0 ], "cache.tabs", true );
+ }
+ });
+ }});
+ },
+
+ _ajaxSettings: function( anchor, event, ui ) {
+ var ajaxOptions = this.options.ajaxOptions;
+ return $.extend( {}, ajaxOptions, {
+ error: function( xhr, status ) {
+ try {
+ // Passing index avoid a race condition when this method is
+ // called after the user has selected another tab.
+ // Pass the anchor that initiated this request allows
+ // loadError to manipulate the tab content panel via $(a.hash)
+ ajaxOptions.error(
+ xhr, status, ui.tab.closest( "li" ).index(), ui.tab[ 0 ] );
+ }
+ catch ( error ) {}
+ }
+ }, this._superApply( arguments ) );
+ },
+
+ _setOption: function( key, value ) {
+ // reset cache if switching from cached to not cached
+ if ( key === "cache" && value === false ) {
+ this.anchors.removeData( "cache.tabs" );
+ }
+ this._super( key, value );
+ },
+
+ _destroy: function() {
+ this.anchors.removeData( "cache.tabs" );
+ this._super();
+ },
+
+ url: function( index ){
+ this.anchors.eq( index ).removeData( "cache.tabs" );
+ this._superApply( arguments );
+ }
+ });
+
+ // abort method
+ $.widget( "ui.tabs", $.ui.tabs, {
+ abort: function() {
+ if ( this.xhr ) {
+ this.xhr.abort();
+ }
+ }
+ });
+
+ // spinner
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ spinner: "<em>Loading&#8230;</em>"
+ },
+ _create: function() {
+ this._super();
+ this._on({
+ tabsbeforeload: function( event, ui ) {
+ // Don't react to nested tabs or tabs that don't use a spinner
+ if ( event.target !== this.element[ 0 ] ||
+ !this.options.spinner ) {
+ return;
+ }
+
+ var span = ui.tab.find( "span" ),
+ html = span.html();
+ span.html( this.options.spinner );
+ ui.jqXHR.complete(function() {
+ span.html( html );
+ });
+ }
+ });
+ }
+ });
+
+ // enable/disable events
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ enable: null,
+ disable: null
+ },
+
+ enable: function( index ) {
+ var options = this.options,
+ trigger;
+
+ if ( index && options.disabled === true ||
+ ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) !== -1 ) ) {
+ trigger = true;
+ }
+
+ this._superApply( arguments );
+
+ if ( trigger ) {
+ this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
+ }
+ },
+
+ disable: function( index ) {
+ var options = this.options,
+ trigger;
+
+ if ( index && options.disabled === false ||
+ ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) === -1 ) ) {
+ trigger = true;
+ }
+
+ this._superApply( arguments );
+
+ if ( trigger ) {
+ this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
+ }
+ }
+ });
+
+ // add/remove methods and events
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ add: null,
+ remove: null,
+ tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
+ },
+
+ add: function( url, label, index ) {
+ if ( index === undefined ) {
+ index = this.anchors.length;
+ }
+
+ var doInsertAfter, panel,
+ options = this.options,
+ li = $( options.tabTemplate
+ .replace( /#\{href\}/g, url )
+ .replace( /#\{label\}/g, label ) ),
+ id = !url.indexOf( "#" ) ?
+ url.replace( "#", "" ) :
+ this._tabId( li );
+
+ li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true );
+ li.attr( "aria-controls", id );
+
+ doInsertAfter = index >= this.tabs.length;
+
+ // try to find an existing element before creating a new one
+ panel = this.element.find( "#" + id );
+ if ( !panel.length ) {
+ panel = this._createPanel( id );
+ if ( doInsertAfter ) {
+ if ( index > 0 ) {
+ panel.insertAfter( this.panels.eq( -1 ) );
+ } else {
+ panel.appendTo( this.element );
+ }
+ } else {
+ panel.insertBefore( this.panels[ index ] );
+ }
+ }
+ panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ).hide();
+
+ if ( doInsertAfter ) {
+ li.appendTo( this.tablist );
+ } else {
+ li.insertBefore( this.tabs[ index ] );
+ }
+
+ options.disabled = $.map( options.disabled, function( n ) {
+ return n >= index ? ++n : n;
+ });
+
+ this.refresh();
+ if ( this.tabs.length === 1 && options.active === false ) {
+ this.option( "active", 0 );
+ }
+
+ this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
+ return this;
+ },
+
+ remove: function( index ) {
+ index = this._getIndex( index );
+ var options = this.options,
+ tab = this.tabs.eq( index ).remove(),
+ panel = this._getPanelForTab( tab ).remove();
+
+ // If selected tab was removed focus tab to the right or
+ // in case the last tab was removed the tab to the left.
+ // We check for more than 2 tabs, because if there are only 2,
+ // then when we remove this tab, there will only be one tab left
+ // so we don't need to detect which tab to activate.
+ if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 2 ) {
+ this._activate( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
+ }
+
+ options.disabled = $.map(
+ $.grep( options.disabled, function( n ) {
+ return n !== index;
+ }),
+ function( n ) {
+ return n >= index ? --n : n;
+ });
+
+ this.refresh();
+
+ this._trigger( "remove", null, this._ui( tab.find( "a" )[ 0 ], panel[ 0 ] ) );
+ return this;
+ }
+ });
+
+ // length method
+ $.widget( "ui.tabs", $.ui.tabs, {
+ length: function() {
+ return this.anchors.length;
+ }
+ });
+
+ // panel ids (idPrefix option + title attribute)
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ idPrefix: "ui-tabs-"
+ },
+
+ _tabId: function( tab ) {
+ var a = tab.is( "li" ) ? tab.find( "a[href]" ) : tab;
+ a = a[0];
+ return $( a ).closest( "li" ).attr( "aria-controls" ) ||
+ a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF\-]/g, "" ) ||
+ this.options.idPrefix + getNextTabId();
+ }
+ });
+
+ // _createPanel method
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ panelTemplate: "<div></div>"
+ },
+
+ _createPanel: function( id ) {
+ return $( this.options.panelTemplate )
+ .attr( "id", id )
+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+ .data( "ui-tabs-destroy", true );
+ }
+ });
+
+ // selected option
+ $.widget( "ui.tabs", $.ui.tabs, {
+ _create: function() {
+ var options = this.options;
+ if ( options.active === null && options.selected !== undefined ) {
+ options.active = options.selected === -1 ? false : options.selected;
+ }
+ this._super();
+ options.selected = options.active;
+ if ( options.selected === false ) {
+ options.selected = -1;
+ }
+ },
+
+ _setOption: function( key, value ) {
+ if ( key !== "selected" ) {
+ return this._super( key, value );
+ }
+
+ var options = this.options;
+ this._super( "active", value === -1 ? false : value );
+ options.selected = options.active;
+ if ( options.selected === false ) {
+ options.selected = -1;
+ }
+ },
+
+ _eventHandler: function() {
+ this._superApply( arguments );
+ this.options.selected = this.options.active;
+ if ( this.options.selected === false ) {
+ this.options.selected = -1;
+ }
+ }
+ });
+
+ // show and select event
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ show: null,
+ select: null
+ },
+ _create: function() {
+ this._super();
+ if ( this.options.active !== false ) {
+ this._trigger( "show", null, this._ui(
+ this.active.find( ".ui-tabs-anchor" )[ 0 ],
+ this._getPanelForTab( this.active )[ 0 ] ) );
+ }
+ },
+ _trigger: function( type, event, data ) {
+ var tab, panel,
+ ret = this._superApply( arguments );
+
+ if ( !ret ) {
+ return false;
+ }
+
+ if ( type === "beforeActivate" ) {
+ tab = data.newTab.length ? data.newTab : data.oldTab;
+ panel = data.newPanel.length ? data.newPanel : data.oldPanel;
+ ret = this._super( "select", event, {
+ tab: tab.find( ".ui-tabs-anchor" )[ 0],
+ panel: panel[ 0 ],
+ index: tab.closest( "li" ).index()
+ });
+ } else if ( type === "activate" && data.newTab.length ) {
+ ret = this._super( "show", event, {
+ tab: data.newTab.find( ".ui-tabs-anchor" )[ 0 ],
+ panel: data.newPanel[ 0 ],
+ index: data.newTab.closest( "li" ).index()
+ });
+ }
+ return ret;
+ }
+ });
+
+ // select method
+ $.widget( "ui.tabs", $.ui.tabs, {
+ select: function( index ) {
+ index = this._getIndex( index );
+ if ( index === -1 ) {
+ if ( this.options.collapsible && this.options.selected !== -1 ) {
+ index = this.options.selected;
+ } else {
+ return;
+ }
+ }
+ this.anchors.eq( index ).trigger( this.options.event + this.eventNamespace );
+ }
+ });
+
+ // cookie option
+ (function() {
+
+ var listId = 0;
+
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ cookie: null // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
+ },
+ _create: function() {
+ var options = this.options,
+ active;
+ if ( options.active == null && options.cookie ) {
+ active = parseInt( this._cookie(), 10 );
+ if ( active === -1 ) {
+ active = false;
+ }
+ options.active = active;
+ }
+ this._super();
+ },
+ _cookie: function( active ) {
+ var cookie = [ this.cookie ||
+ ( this.cookie = this.options.cookie.name || "ui-tabs-" + (++listId) ) ];
+ if ( arguments.length ) {
+ cookie.push( active === false ? -1 : active );
+ cookie.push( this.options.cookie );
+ }
+ return $.cookie.apply( null, cookie );
+ },
+ _refresh: function() {
+ this._super();
+ if ( this.options.cookie ) {
+ this._cookie( this.options.active, this.options.cookie );
+ }
+ },
+ _eventHandler: function() {
+ this._superApply( arguments );
+ if ( this.options.cookie ) {
+ this._cookie( this.options.active, this.options.cookie );
+ }
+ },
+ _destroy: function() {
+ this._super();
+ if ( this.options.cookie ) {
+ this._cookie( null, this.options.cookie );
+ }
+ }
+ });
+
+ })();
+
+ // load event
+ $.widget( "ui.tabs", $.ui.tabs, {
+ _trigger: function( type, event, data ) {
+ var _data = $.extend( {}, data );
+ if ( type === "load" ) {
+ _data.panel = _data.panel[ 0 ];
+ _data.tab = _data.tab.find( ".ui-tabs-anchor" )[ 0 ];
+ }
+ return this._super( type, event, _data );
+ }
+ });
+
+ // fx option
+ // The new animation options (show, hide) conflict with the old show callback.
+ // The old fx option wins over show/hide anyway (always favor back-compat).
+ // If a user wants to use the new animation API, they must give up the old API.
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ fx: null // e.g. { height: "toggle", opacity: "toggle", duration: 200 }
+ },
+
+ _getFx: function() {
+ var hide, show,
+ fx = this.options.fx;
+
+ if ( fx ) {
+ if ( $.isArray( fx ) ) {
+ hide = fx[ 0 ];
+ show = fx[ 1 ];
+ } else {
+ hide = show = fx;
+ }
+ }
+
+ return fx ? { show: show, hide: hide } : null;
+ },
+
+ _toggle: function( event, eventData ) {
+ var that = this,
+ toShow = eventData.newPanel,
+ toHide = eventData.oldPanel,
+ fx = this._getFx();
+
+ if ( !fx ) {
+ return this._super( event, eventData );
+ }
+
+ that.running = true;
+
+ function complete() {
+ that.running = false;
+ that._trigger( "activate", event, eventData );
+ }
+
+ function show() {
+ eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
+
+ if ( toShow.length && fx.show ) {
+ toShow
+ .animate( fx.show, fx.show.duration, function() {
+ complete();
+ });
+ } else {
+ toShow.show();
+ complete();
+ }
+ }
+
+ // start out by hiding, then showing, then completing
+ if ( toHide.length && fx.hide ) {
+ toHide.animate( fx.hide, fx.hide.duration, function() {
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+ show();
+ });
+ } else {
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+ toHide.hide();
+ show();
+ }
+ }
+ });
+}
+
+})( jQuery );
+(function( $ ) {
+
+var increments = 0;
+
+function addDescribedBy( elem, id ) {
+ var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
+ describedby.push( id );
+ elem
+ .data( "ui-tooltip-id", id )
+ .attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
+}
+
+function removeDescribedBy( elem ) {
+ var id = elem.data( "ui-tooltip-id" ),
+ describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
+ index = $.inArray( id, describedby );
+ if ( index !== -1 ) {
+ describedby.splice( index, 1 );
+ }
+
+ elem.removeData( "ui-tooltip-id" );
+ describedby = $.trim( describedby.join( " " ) );
+ if ( describedby ) {
+ elem.attr( "aria-describedby", describedby );
+ } else {
+ elem.removeAttr( "aria-describedby" );
+ }
+}
+
+$.widget( "ui.tooltip", {
+ version: "1.9.2",
+ options: {
+ content: function() {
+ return $( this ).attr( "title" );
+ },
+ hide: true,
+ // Disabled elements have inconsistent behavior across browsers (#8661)
+ items: "[title]:not([disabled])",
+ position: {
+ my: "left top+15",
+ at: "left bottom",
+ collision: "flipfit flip"
+ },
+ show: true,
+ tooltipClass: null,
+ track: false,
+
+ // callbacks
+ close: null,
+ open: null
+ },
+
+ _create: function() {
+ this._on({
+ mouseover: "open",
+ focusin: "open"
+ });
+
+ // IDs of generated tooltips, needed for destroy
+ this.tooltips = {};
+ // IDs of parent tooltips where we removed the title attribute
+ this.parents = {};
+
+ if ( this.options.disabled ) {
+ this._disable();
+ }
+ },
+
+ _setOption: function( key, value ) {
+ var that = this;
+
+ if ( key === "disabled" ) {
+ this[ value ? "_disable" : "_enable" ]();
+ this.options[ key ] = value;
+ // disable element style changes
+ return;
+ }
+
+ this._super( key, value );
+
+ if ( key === "content" ) {
+ $.each( this.tooltips, function( id, element ) {
+ that._updateContent( element );
+ });
+ }
+ },
+
+ _disable: function() {
+ var that = this;
+
+ // close open tooltips
+ $.each( this.tooltips, function( id, element ) {
+ var event = $.Event( "blur" );
+ event.target = event.currentTarget = element[0];
+ that.close( event, true );
+ });
+
+ // remove title attributes to prevent native tooltips
+ this.element.find( this.options.items ).andSelf().each(function() {
+ var element = $( this );
+ if ( element.is( "[title]" ) ) {
+ element
+ .data( "ui-tooltip-title", element.attr( "title" ) )
+ .attr( "title", "" );
+ }
+ });
+ },
+
+ _enable: function() {
+ // restore title attributes
+ this.element.find( this.options.items ).andSelf().each(function() {
+ var element = $( this );
+ if ( element.data( "ui-tooltip-title" ) ) {
+ element.attr( "title", element.data( "ui-tooltip-title" ) );
+ }
+ });
+ },
+
+ open: function( event ) {
+ var that = this,
+ target = $( event ? event.target : this.element )
+ // we need closest here due to mouseover bubbling,
+ // but always pointing at the same event target
+ .closest( this.options.items );
+
+ // No element to show a tooltip for or the tooltip is already open
+ if ( !target.length || target.data( "ui-tooltip-id" ) ) {
+ return;
+ }
+
+ if ( target.attr( "title" ) ) {
+ target.data( "ui-tooltip-title", target.attr( "title" ) );
+ }
+
+ target.data( "ui-tooltip-open", true );
+
+ // kill parent tooltips, custom or native, for hover
+ if ( event && event.type === "mouseover" ) {
+ target.parents().each(function() {
+ var parent = $( this ),
+ blurEvent;
+ if ( parent.data( "ui-tooltip-open" ) ) {
+ blurEvent = $.Event( "blur" );
+ blurEvent.target = blurEvent.currentTarget = this;
+ that.close( blurEvent, true );
+ }
+ if ( parent.attr( "title" ) ) {
+ parent.uniqueId();
+ that.parents[ this.id ] = {
+ element: this,
+ title: parent.attr( "title" )
+ };
+ parent.attr( "title", "" );
+ }
+ });
+ }
+
+ this._updateContent( target, event );
+ },
+
+ _updateContent: function( target, event ) {
+ var content,
+ contentOption = this.options.content,
+ that = this,
+ eventType = event ? event.type : null;
+
+ if ( typeof contentOption === "string" ) {
+ return this._open( event, target, contentOption );
+ }
+
+ content = contentOption.call( target[0], function( response ) {
+ // ignore async response if tooltip was closed already
+ if ( !target.data( "ui-tooltip-open" ) ) {
+ return;
+ }
+ // IE may instantly serve a cached response for ajax requests
+ // delay this call to _open so the other call to _open runs first
+ that._delay(function() {
+ // jQuery creates a special event for focusin when it doesn't
+ // exist natively. To improve performance, the native event
+ // object is reused and the type is changed. Therefore, we can't
+ // rely on the type being correct after the event finished
+ // bubbling, so we set it back to the previous value. (#8740)
+ if ( event ) {
+ event.type = eventType;
+ }
+ this._open( event, target, response );
+ });
+ });
+ if ( content ) {
+ this._open( event, target, content );
+ }
+ },
+
+ _open: function( event, target, content ) {
+ var tooltip, events, delayedShow,
+ positionOption = $.extend( {}, this.options.position );
+
+ if ( !content ) {
+ return;
+ }
+
+ // Content can be updated multiple times. If the tooltip already
+ // exists, then just update the content and bail.
+ tooltip = this._find( target );
+ if ( tooltip.length ) {
+ tooltip.find( ".ui-tooltip-content" ).html( content );
+ return;
+ }
+
+ // if we have a title, clear it to prevent the native tooltip
+ // we have to check first to avoid defining a title if none exists
+ // (we don't want to cause an element to start matching [title])
+ //
+ // We use removeAttr only for key events, to allow IE to export the correct
+ // accessible attributes. For mouse events, set to empty string to avoid
+ // native tooltip showing up (happens only when removing inside mouseover).
+ if ( target.is( "[title]" ) ) {
+ if ( event && event.type === "mouseover" ) {
+ target.attr( "title", "" );
+ } else {
+ target.removeAttr( "title" );
+ }
+ }
+
+ tooltip = this._tooltip( target );
+ addDescribedBy( target, tooltip.attr( "id" ) );
+ tooltip.find( ".ui-tooltip-content" ).html( content );
+
+ function position( event ) {
+ positionOption.of = event;
+ if ( tooltip.is( ":hidden" ) ) {
+ return;
+ }
+ tooltip.position( positionOption );
+ }
+ if ( this.options.track && event && /^mouse/.test( event.type ) ) {
+ this._on( this.document, {
+ mousemove: position
+ });
+ // trigger once to override element-relative positioning
+ position( event );
+ } else {
+ tooltip.position( $.extend({
+ of: target
+ }, this.options.position ) );
+ }
+
+ tooltip.hide();
+
+ this._show( tooltip, this.options.show );
+ // Handle tracking tooltips that are shown with a delay (#8644). As soon
+ // as the tooltip is visible, position the tooltip using the most recent
+ // event.
+ if ( this.options.show && this.options.show.delay ) {
+ delayedShow = setInterval(function() {
+ if ( tooltip.is( ":visible" ) ) {
+ position( positionOption.of );
+ clearInterval( delayedShow );
+ }
+ }, $.fx.interval );
+ }
+
+ this._trigger( "open", event, { tooltip: tooltip } );
+
+ events = {
+ keyup: function( event ) {
+ if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
+ var fakeEvent = $.Event(event);
+ fakeEvent.currentTarget = target[0];
+ this.close( fakeEvent, true );
+ }
+ },
+ remove: function() {
+ this._removeTooltip( tooltip );
+ }
+ };
+ if ( !event || event.type === "mouseover" ) {
+ events.mouseleave = "close";
+ }
+ if ( !event || event.type === "focusin" ) {
+ events.focusout = "close";
+ }
+ this._on( true, target, events );
+ },
+
+ close: function( event ) {
+ var that = this,
+ target = $( event ? event.currentTarget : this.element ),
+ tooltip = this._find( target );
+
+ // disabling closes the tooltip, so we need to track when we're closing
+ // to avoid an infinite loop in case the tooltip becomes disabled on close
+ if ( this.closing ) {
+ return;
+ }
+
+ // only set title if we had one before (see comment in _open())
+ if ( target.data( "ui-tooltip-title" ) ) {
+ target.attr( "title", target.data( "ui-tooltip-title" ) );
+ }
+
+ removeDescribedBy( target );
+
+ tooltip.stop( true );
+ this._hide( tooltip, this.options.hide, function() {
+ that._removeTooltip( $( this ) );
+ });
+
+ target.removeData( "ui-tooltip-open" );
+ this._off( target, "mouseleave focusout keyup" );
+ // Remove 'remove' binding only on delegated targets
+ if ( target[0] !== this.element[0] ) {
+ this._off( target, "remove" );
+ }
+ this._off( this.document, "mousemove" );
+
+ if ( event && event.type === "mouseleave" ) {
+ $.each( this.parents, function( id, parent ) {
+ $( parent.element ).attr( "title", parent.title );
+ delete that.parents[ id ];
+ });
+ }
+
+ this.closing = true;
+ this._trigger( "close", event, { tooltip: tooltip } );
+ this.closing = false;
+ },
+
+ _tooltip: function( element ) {
+ var id = "ui-tooltip-" + increments++,
+ tooltip = $( "<div>" )
+ .attr({
+ id: id,
+ role: "tooltip"
+ })
+ .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
+ ( this.options.tooltipClass || "" ) );
+ $( "<div>" )
+ .addClass( "ui-tooltip-content" )
+ .appendTo( tooltip );
+ tooltip.appendTo( this.document[0].body );
+ if ( $.fn.bgiframe ) {
+ tooltip.bgiframe();
+ }
+ this.tooltips[ id ] = element;
+ return tooltip;
+ },
+
+ _find: function( target ) {
+ var id = target.data( "ui-tooltip-id" );
+ return id ? $( "#" + id ) : $();
+ },
+
+ _removeTooltip: function( tooltip ) {
+ tooltip.remove();
+ delete this.tooltips[ tooltip.attr( "id" ) ];
+ },
+
+ _destroy: function() {
+ var that = this;
+
+ // close open tooltips
+ $.each( this.tooltips, function( id, element ) {
+ // Delegate to close method to handle common cleanup
+ var event = $.Event( "blur" );
+ event.target = event.currentTarget = element[0];
+ that.close( event, true );
+
+ // Remove immediately; destroying an open tooltip doesn't use the
+ // hide animation
+ $( "#" + id ).remove();
+
+ // Restore the title
+ if ( element.data( "ui-tooltip-title" ) ) {
+ element.attr( "title", element.data( "ui-tooltip-title" ) );
+ element.removeData( "ui-tooltip-title" );
+ }
+ });
+ }
+});
+
+}( jQuery ) ); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery.layout-latest.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery.layout-latest.js
new file mode 100644
index 00000000..434724d9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery.layout-latest.js
@@ -0,0 +1,6086 @@
+/**
+ * @preserve
+ * jquery.layout 1.4.3
+ * $Date: 2015/03/13 22:37:04 $
+ * $Rev: 1.0403 $
+ *
+ * Copyright (c) 2014 Kevin Dalman (http://jquery-dev.com)
+ * Based on work by Fabrizio Balliano (http://www.fabrizioballiano.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * SEE: http://layout.jquery-dev.com/LICENSE.txt
+ *
+ * Changelog: http://layout.jquery-dev.com/changelog.cfm
+ *
+ * Docs: http://layout.jquery-dev.com/documentation.html
+ * Tips: http://layout.jquery-dev.com/tips.html
+ * Help: http://groups.google.com/group/jquery-ui-layout
+ */
+
+/* JavaDoc Info: http://code.google.com/closure/compiler/docs/js-for-compiler.html
+ * {!Object} non-nullable type (never NULL)
+ * {?string} nullable type (sometimes NULL) - default for {Object}
+ * {number=} optional parameter
+ * {*} ALL types
+ */
+/* TODO for jQ 2.0
+ * change .andSelf() to .addBack()
+ * check $.fn.disableSelection - this is in jQuery UI 1.9.x
+ */
+
+// NOTE: For best readability, view with a fixed-width font and tabs equal to 4-chars
+
+;(function ($) {
+
+// alias Math methods - used a lot!
+var min = Math.min
+, max = Math.max
+, round = Math.floor
+
+, isStr = function (v) { return $.type(v) === "string"; }
+
+ /**
+ * @param {!Object} Instance
+ * @param {Array.<string>} a_fn
+ */
+, runPluginCallbacks = function (Instance, a_fn) {
+ if ($.isArray(a_fn))
+ for (var i=0, c=a_fn.length; i<c; i++) {
+ var fn = a_fn[i];
+ try {
+ if (isStr(fn)) // 'name' of a function
+ fn = eval(fn);
+ if ($.isFunction(fn))
+ g(fn)( Instance );
+ } catch (ex) {}
+ }
+ function g (f) { return f; }; // compiler hack
+ }
+;
+
+/*
+ * GENERIC $.layout METHODS - used by all layouts
+ */
+$.layout = {
+
+ version: "1.4.3"
+, revision: 1.0403 // eg: 1.4.1 final = 1.0401 - major(n+).minor(nn)+patch(nn+)
+
+ // $.layout.browser REPLACES $.browser
+, browser: {} // set below
+
+ // *PREDEFINED* EFFECTS & DEFAULTS
+ // MUST list effect here - OR MUST set an fxSettings option (can be an empty hash: {})
+, effects: {
+
+ // Pane Open/Close Animations
+ slide: {
+ all: { duration: "fast" } // eg: duration: 1000, easing: "easeOutBounce"
+ , north: { direction: "up" }
+ , south: { direction: "down" }
+ , east: { direction: "right"}
+ , west: { direction: "left" }
+ }
+ , drop: {
+ all: { duration: "slow" }
+ , north: { direction: "up" }
+ , south: { direction: "down" }
+ , east: { direction: "right"}
+ , west: { direction: "left" }
+ }
+ , scale: {
+ all: { duration: "fast" }
+ }
+ // these are not recommended, but can be used
+ , blind: {}
+ , clip: {}
+ , explode: {}
+ , fade: {}
+ , fold: {}
+ , puff: {}
+
+ // Pane Resize Animations
+ , size: {
+ all: { easing: "swing" }
+ }
+ }
+
+ // INTERNAL CONFIG DATA - DO NOT CHANGE THIS!
+, config: {
+ optionRootKeys: "effects,panes,north,south,west,east,center".split(",")
+ , allPanes: "north,south,west,east,center".split(",")
+ , borderPanes: "north,south,west,east".split(",")
+ , oppositeEdge: {
+ north: "south"
+ , south: "north"
+ , east: "west"
+ , west: "east"
+ }
+ // offscreen data
+ , offscreenCSS: { left: "-99999px", right: "auto" } // used by hide/close if useOffscreenClose=true
+ , offscreenReset: "offscreenReset" // key used for data
+ // CSS used in multiple places
+ , hidden: { visibility: "hidden" }
+ , visible: { visibility: "visible" }
+ // layout element settings
+ , resizers: {
+ cssReq: {
+ position: "absolute"
+ , padding: 0
+ , margin: 0
+ , fontSize: "1px"
+ , textAlign: "left" // to counter-act "center" alignment!
+ , overflow: "hidden" // prevent toggler-button from overflowing
+ // SEE $.layout.defaults.zIndexes.resizer_normal
+ }
+ , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true
+ background: "#DDD"
+ , border: "none"
+ }
+ }
+ , togglers: {
+ cssReq: {
+ position: "absolute"
+ , display: "block"
+ , padding: 0
+ , margin: 0
+ , overflow: "hidden"
+ , textAlign: "center"
+ , fontSize: "1px"
+ , cursor: "pointer"
+ , zIndex: 1
+ }
+ , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true
+ background: "#AAA"
+ }
+ }
+ , content: {
+ cssReq: {
+ position: "relative" /* contain floated or positioned elements */
+ }
+ , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true
+ overflow: "auto"
+ , padding: "10px"
+ }
+ , cssDemoPane: { // DEMO CSS - REMOVE scrolling from 'pane' when it has a content-div
+ overflow: "hidden"
+ , padding: 0
+ }
+ }
+ , panes: { // defaults for ALL panes - overridden by 'per-pane settings' below
+ cssReq: {
+ position: "absolute"
+ , margin: 0
+ // $.layout.defaults.zIndexes.pane_normal
+ }
+ , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true
+ padding: "10px"
+ , background: "#FFF"
+ , border: "1px solid #BBB"
+ , overflow: "auto"
+ }
+ }
+ , north: {
+ side: "top"
+ , sizeType: "Height"
+ , dir: "horz"
+ , cssReq: {
+ top: 0
+ , bottom: "auto"
+ , left: 0
+ , right: 0
+ , width: "auto"
+ // height: DYNAMIC
+ }
+ }
+ , south: {
+ side: "bottom"
+ , sizeType: "Height"
+ , dir: "horz"
+ , cssReq: {
+ top: "auto"
+ , bottom: 0
+ , left: 0
+ , right: 0
+ , width: "auto"
+ // height: DYNAMIC
+ }
+ }
+ , east: {
+ side: "right"
+ , sizeType: "Width"
+ , dir: "vert"
+ , cssReq: {
+ left: "auto"
+ , right: 0
+ , top: "auto" // DYNAMIC
+ , bottom: "auto" // DYNAMIC
+ , height: "auto"
+ // width: DYNAMIC
+ }
+ }
+ , west: {
+ side: "left"
+ , sizeType: "Width"
+ , dir: "vert"
+ , cssReq: {
+ left: 0
+ , right: "auto"
+ , top: "auto" // DYNAMIC
+ , bottom: "auto" // DYNAMIC
+ , height: "auto"
+ // width: DYNAMIC
+ }
+ }
+ , center: {
+ dir: "center"
+ , cssReq: {
+ left: "auto" // DYNAMIC
+ , right: "auto" // DYNAMIC
+ , top: "auto" // DYNAMIC
+ , bottom: "auto" // DYNAMIC
+ , height: "auto"
+ , width: "auto"
+ }
+ }
+ }
+
+ // CALLBACK FUNCTION NAMESPACE - used to store reusable callback functions
+, callbacks: {}
+
+, getParentPaneElem: function (el) {
+ // must pass either a container or pane element
+ var $el = $(el)
+ , layout = $el.data("layout") || $el.data("parentLayout");
+ if (layout) {
+ var $cont = layout.container;
+ // see if this container is directly-nested inside an outer-pane
+ if ($cont.data("layoutPane")) return $cont;
+ var $pane = $cont.closest("."+ $.layout.defaults.panes.paneClass);
+ // if a pane was found, return it
+ if ($pane.data("layoutPane")) return $pane;
+ }
+ return null;
+ }
+
+, getParentPaneInstance: function (el) {
+ // must pass either a container or pane element
+ var $pane = $.layout.getParentPaneElem(el);
+ return $pane ? $pane.data("layoutPane") : null;
+ }
+
+, getParentLayoutInstance: function (el) {
+ // must pass either a container or pane element
+ var $pane = $.layout.getParentPaneElem(el);
+ return $pane ? $pane.data("parentLayout") : null;
+ }
+
+, getEventObject: function (evt) {
+ return typeof evt === "object" && evt.stopPropagation ? evt : null;
+ }
+, parsePaneName: function (evt_or_pane) {
+ var evt = $.layout.getEventObject( evt_or_pane )
+ , pane = evt_or_pane;
+ if (evt) {
+ // ALWAYS stop propagation of events triggered in Layout!
+ evt.stopPropagation();
+ pane = $(this).data("layoutEdge");
+ }
+ if (pane && !/^(west|east|north|south|center)$/.test(pane)) {
+ $.layout.msg('LAYOUT ERROR - Invalid pane-name: "'+ pane +'"');
+ pane = "error";
+ }
+ return pane;
+ }
+
+
+ // LAYOUT-PLUGIN REGISTRATION
+ // more plugins can added beyond this default list
+, plugins: {
+ draggable: !!$.fn.draggable // resizing
+ , effects: {
+ core: !!$.effects // animimations (specific effects tested by initOptions)
+ , slide: $.effects && ($.effects.slide || ($.effects.effect && $.effects.effect.slide)) // default effect
+ }
+ }
+
+// arrays of plugin or other methods to be triggered for events in *each layout* - will be passed 'Instance'
+, onCreate: [] // runs when layout is just starting to be created - right after options are set
+, onLoad: [] // runs after layout container and global events init, but before initPanes is called
+, onReady: [] // runs after initialization *completes* - ie, after initPanes completes successfully
+, onDestroy: [] // runs after layout is destroyed
+, onUnload: [] // runs after layout is destroyed OR when page unloads
+, afterOpen: [] // runs after setAsOpen() completes
+, afterClose: [] // runs after setAsClosed() completes
+
+ /*
+ * GENERIC UTILITY METHODS
+ */
+
+ // calculate and return the scrollbar width, as an integer
+, scrollbarWidth: function () { return window.scrollbarWidth || $.layout.getScrollbarSize('width'); }
+, scrollbarHeight: function () { return window.scrollbarHeight || $.layout.getScrollbarSize('height'); }
+, getScrollbarSize: function (dim) {
+ var $c = $('<div style="position: absolute; top: -10000px; left: -10000px; width: 100px; height: 100px; border: 0; overflow: scroll;"></div>').appendTo("body")
+ , d = { width: $c.outerWidth - $c[0].clientWidth, height: 100 - $c[0].clientHeight };
+ $c.remove();
+ window.scrollbarWidth = d.width;
+ window.scrollbarHeight = d.height;
+ return dim.match(/^(width|height)$/) ? d[dim] : d;
+ }
+
+
+, disableTextSelection: function () {
+ var $d = $(document)
+ , s = 'textSelectionDisabled'
+ , x = 'textSelectionInitialized'
+ ;
+ if ($.fn.disableSelection) {
+ if (!$d.data(x)) // document hasn't been initialized yet
+ $d.on('mouseup', $.layout.enableTextSelection ).data(x, true);
+ if (!$d.data(s))
+ $d.disableSelection().data(s, true);
+ }
+ }
+, enableTextSelection: function () {
+ var $d = $(document)
+ , s = 'textSelectionDisabled';
+ if ($.fn.enableSelection && $d.data(s))
+ $d.enableSelection().data(s, false);
+ }
+
+
+ /**
+ * Returns hash container 'display' and 'visibility'
+ *
+ * @see $.swap() - swaps CSS, runs callback, resets CSS
+ * @param {!Object} $E jQuery element
+ * @param {boolean=} [force=false] Run even if display != none
+ * @return {!Object} Returns current style props, if applicable
+ */
+, showInvisibly: function ($E, force) {
+ if ($E && $E.length && (force || $E.css("display") === "none")) { // only if not *already hidden*
+ var s = $E[0].style
+ // save ONLY the 'style' props because that is what we must restore
+ , CSS = { display: s.display || '', visibility: s.visibility || '' };
+ // show element 'invisibly' so can be measured
+ $E.css({ display: "block", visibility: "hidden" });
+ return CSS;
+ }
+ return {};
+ }
+
+ /**
+ * Returns data for setting size of an element (container or a pane).
+ *
+ * @see _create(), onWindowResize() for container, plus others for pane
+ * @return JSON Returns a hash of all dimensions: top, bottom, left, right, outerWidth, innerHeight, etc
+ */
+, getElementDimensions: function ($E, inset) {
+ var
+ // dimensions hash - start with current data IF passed
+ d = { css: {}, inset: {} }
+ , x = d.css // CSS hash
+ , i = { bottom: 0 } // TEMP insets (bottom = complier hack)
+ , N = $.layout.cssNum
+ , R = Math.round
+ , off = $E.offset()
+ , b, p, ei // TEMP border, padding
+ ;
+ d.offsetLeft = off.left;
+ d.offsetTop = off.top;
+
+ if (!inset) inset = {}; // simplify logic below
+
+ $.each("Left,Right,Top,Bottom".split(","), function (idx, e) { // e = edge
+ b = x["border" + e] = $.layout.borderWidth($E, e);
+ p = x["padding"+ e] = $.layout.cssNum($E, "padding"+e);
+ ei = e.toLowerCase();
+ d.inset[ei] = inset[ei] >= 0 ? inset[ei] : p; // any missing insetX value = paddingX
+ i[ei] = d.inset[ei] + b; // total offset of content from outer side
+ });
+
+ x.width = R($E.width());
+ x.height = R($E.height());
+ x.top = N($E,"top",true);
+ x.bottom = N($E,"bottom",true);
+ x.left = N($E,"left",true);
+ x.right = N($E,"right",true);
+
+ d.outerWidth = R($E.outerWidth());
+ d.outerHeight = R($E.outerHeight());
+ // calc the TRUE inner-dimensions, even in quirks-mode!
+ d.innerWidth = max(0, d.outerWidth - i.left - i.right);
+ d.innerHeight = max(0, d.outerHeight - i.top - i.bottom);
+ // layoutWidth/Height is used in calcs for manual resizing
+ // layoutW/H only differs from innerW/H when in quirks-mode - then is like outerW/H
+ d.layoutWidth = R($E.innerWidth());
+ d.layoutHeight = R($E.innerHeight());
+
+ //if ($E.prop('tagName') === 'BODY') { debugData( d, $E.prop('tagName') ); } // DEBUG
+
+ //d.visible = $E.is(":visible");// && x.width > 0 && x.height > 0;
+
+ return d;
+ }
+
+, getElementStyles: function ($E, list) {
+ var
+ CSS = {}
+ , style = $E[0].style
+ , props = list.split(",")
+ , sides = "Top,Bottom,Left,Right".split(",")
+ , attrs = "Color,Style,Width".split(",")
+ , p, s, a, i, j, k
+ ;
+ for (i=0; i < props.length; i++) {
+ p = props[i];
+ if (p.match(/(border|padding|margin)$/))
+ for (j=0; j < 4; j++) {
+ s = sides[j];
+ if (p === "border")
+ for (k=0; k < 3; k++) {
+ a = attrs[k];
+ CSS[p+s+a] = style[p+s+a];
+ }
+ else
+ CSS[p+s] = style[p+s];
+ }
+ else
+ CSS[p] = style[p];
+ };
+ return CSS
+ }
+
+ /**
+ * Return the innerWidth for the current browser/doctype
+ *
+ * @see initPanes(), sizeMidPanes(), initHandles(), sizeHandles()
+ * @param {Array.<Object>} $E Must pass a jQuery object - first element is processed
+ * @param {number=} outerWidth (optional) Can pass a width, allowing calculations BEFORE element is resized
+ * @return {number} Returns the innerWidth of the elem by subtracting padding and borders
+ */
+, cssWidth: function ($E, outerWidth) {
+ // a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed
+ if (outerWidth <= 0) return 0;
+
+ var lb = $.layout.browser
+ , bs = !lb.boxModel ? "border-box" : lb.boxSizing ? $E.css("boxSizing") : "content-box"
+ , b = $.layout.borderWidth
+ , n = $.layout.cssNum
+ , W = outerWidth
+ ;
+ // strip border and/or padding from outerWidth to get CSS Width
+ if (bs !== "border-box")
+ W -= (b($E, "Left") + b($E, "Right"));
+ if (bs === "content-box")
+ W -= (n($E, "paddingLeft") + n($E, "paddingRight"));
+ return max(0,W);
+ }
+
+ /**
+ * Return the innerHeight for the current browser/doctype
+ *
+ * @see initPanes(), sizeMidPanes(), initHandles(), sizeHandles()
+ * @param {Array.<Object>} $E Must pass a jQuery object - first element is processed
+ * @param {number=} outerHeight (optional) Can pass a width, allowing calculations BEFORE element is resized
+ * @return {number} Returns the innerHeight of the elem by subtracting padding and borders
+ */
+, cssHeight: function ($E, outerHeight) {
+ // a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed
+ if (outerHeight <= 0) return 0;
+
+ var lb = $.layout.browser
+ , bs = !lb.boxModel ? "border-box" : lb.boxSizing ? $E.css("boxSizing") : "content-box"
+ , b = $.layout.borderWidth
+ , n = $.layout.cssNum
+ , H = outerHeight
+ ;
+ // strip border and/or padding from outerHeight to get CSS Height
+ if (bs !== "border-box")
+ H -= (b($E, "Top") + b($E, "Bottom"));
+ if (bs === "content-box")
+ H -= (n($E, "paddingTop") + n($E, "paddingBottom"));
+ return max(0,H);
+ }
+
+ /**
+ * Returns the 'current CSS numeric value' for a CSS property - 0 if property does not exist
+ *
+ * @see Called by many methods
+ * @param {Array.<Object>} $E Must pass a jQuery object - first element is processed
+ * @param {string} prop The name of the CSS property, eg: top, width, etc.
+ * @param {boolean=} [allowAuto=false] true = return 'auto' if that is value; false = return 0
+ * @return {(string|number)} Usually used to get an integer value for position (top, left) or size (height, width)
+ */
+, cssNum: function ($E, prop, allowAuto) {
+ if (!$E.jquery) $E = $($E);
+ var CSS = $.layout.showInvisibly($E)
+ , p = $.css($E[0], prop, true)
+ , v = allowAuto && p=="auto" ? p : Math.round(parseFloat(p) || 0);
+ $E.css( CSS ); // RESET
+ return v;
+ }
+
+, borderWidth: function (el, side) {
+ if (el.jquery) el = el[0];
+ var b = "border"+ side.substr(0,1).toUpperCase() + side.substr(1); // left => Left
+ return $.css(el, b+"Style", true) === "none" ? 0 : Math.round(parseFloat($.css(el, b+"Width", true)) || 0);
+ }
+
+ /**
+ * Mouse-tracking utility - FUTURE REFERENCE
+ *
+ * init: if (!window.mouse) {
+ * window.mouse = { x: 0, y: 0 };
+ * $(document).mousemove( $.layout.trackMouse );
+ * }
+ *
+ * @param {Object} evt
+ *
+, trackMouse: function (evt) {
+ window.mouse = { x: evt.clientX, y: evt.clientY };
+ }
+ */
+
+ /**
+ * SUBROUTINE for preventPrematureSlideClose option
+ *
+ * @param {Object} evt
+ * @param {Object=} el
+ */
+, isMouseOverElem: function (evt, el) {
+ var
+ $E = $(el || this)
+ , d = $E.offset()
+ , T = d.top
+ , L = d.left
+ , R = L + $E.outerWidth()
+ , B = T + $E.outerHeight()
+ , x = evt.pageX // evt.clientX ?
+ , y = evt.pageY // evt.clientY ?
+ ;
+ // if X & Y are < 0, probably means is over an open SELECT
+ return ($.layout.browser.msie && x < 0 && y < 0) || ((x >= L && x <= R) && (y >= T && y <= B));
+ }
+
+ /**
+ * Message/Logging Utility
+ *
+ * @example $.layout.msg("My message"); // log text
+ * @example $.layout.msg("My message", true); // alert text
+ * @example $.layout.msg({ foo: "bar" }, "Title"); // log hash-data, with custom title
+ * @example $.layout.msg({ foo: "bar" }, true, "Title", { sort: false }); -OR-
+ * @example $.layout.msg({ foo: "bar" }, "Title", { sort: false, display: true }); // alert hash-data
+ *
+ * @param {(Object|string)} info String message OR Hash/Array
+ * @param {(Boolean|string|Object)=} [popup=false] True means alert-box - can be skipped
+ * @param {(Object|string)=} [debugTitle=""] Title for Hash data - can be skipped
+ * @param {Object=} [debugOpts] Extra options for debug output
+ */
+, msg: function (info, popup, debugTitle, debugOpts) {
+ if ($.isPlainObject(info) && window.debugData) {
+ if (typeof popup === "string") {
+ debugOpts = debugTitle;
+ debugTitle = popup;
+ }
+ else if (typeof debugTitle === "object") {
+ debugOpts = debugTitle;
+ debugTitle = null;
+ }
+ var t = debugTitle || "log( <object> )"
+ , o = $.extend({ sort: false, returnHTML: false, display: false }, debugOpts);
+ if (popup === true || o.display)
+ debugData( info, t, o );
+ else if (window.console)
+ console.log(debugData( info, t, o ));
+ }
+ else if (popup)
+ alert(info);
+ else if (window.console)
+ console.log(info);
+ else {
+ var id = "#layoutLogger"
+ , $l = $(id);
+ if (!$l.length)
+ $l = createLog();
+ $l.children("ul").append('<li style="padding: 4px 10px; margin: 0; border-top: 1px solid #CCC;">'+ info.replace(/\</g,"&lt;").replace(/\>/g,"&gt;") +'</li>');
+ }
+
+ function createLog () {
+ var pos = $.support.fixedPosition ? 'fixed' : 'absolute'
+ , $e = $('<div id="layoutLogger" style="position: '+ pos +'; top: 5px; z-index: 999999; max-width: 25%; overflow: hidden; border: 1px solid #000; border-radius: 5px; background: #FBFBFB; box-shadow: 0 2px 10px rgba(0,0,0,0.3);">'
+ + '<div style="font-size: 13px; font-weight: bold; padding: 5px 10px; background: #F6F6F6; border-radius: 5px 5px 0 0; cursor: move;">'
+ + '<span style="float: right; padding-left: 7px; cursor: pointer;" title="Remove Console" onclick="$(this).closest(\'#layoutLogger\').remove()">X</span>Layout console.log</div>'
+ + '<ul style="font-size: 13px; font-weight: none; list-style: none; margin: 0; padding: 0 0 2px;"></ul>'
+ + '</div>'
+ ).appendTo("body");
+ $e.css('left', $(window).width() - $e.outerWidth() - 5)
+ if ($.ui.draggable) $e.draggable({ handle: ':first-child' });
+ return $e;
+ };
+ }
+
+};
+
+
+/*
+ * $.layout.browser REPLACES removed $.browser, with extra data
+ * Parsing code here adapted from jQuery 1.8 $.browse
+ */
+(function(){
+ var u = navigator.userAgent.toLowerCase()
+ , m = /(chrome)[ \/]([\w.]+)/.exec( u )
+ || /(webkit)[ \/]([\w.]+)/.exec( u )
+ || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( u )
+ || /(msie) ([\w.]+)/.exec( u )
+ || u.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( u )
+ || []
+ , b = m[1] || ""
+ , v = m[2] || 0
+ , ie = b === "msie"
+ , cm = document.compatMode
+ , $s = $.support
+ , bs = $s.boxSizing !== undefined ? $s.boxSizing : $s.boxSizingReliable
+ , bm = !ie || !cm || cm === "CSS1Compat" || $s.boxModel || false
+ , lb = $.layout.browser = {
+ version: v
+ , safari: b === "webkit" // webkit (NOT chrome) = safari
+ , webkit: b === "chrome" // chrome = webkit
+ , msie: ie
+ , isIE6: ie && v == 6
+ // ONLY IE reverts to old box-model - Note that compatMode was deprecated as of IE8
+ , boxModel: bm
+ , boxSizing: !!(typeof bs === "function" ? bs() : bs)
+ };
+ ;
+ if (b) lb[b] = true; // set CURRENT browser
+ /* OLD versions of jQuery only set $.support.boxModel after page is loaded
+ * so if this is IE, use support.boxModel to test for quirks-mode (ONLY IE changes boxModel) */
+ if (!bm && !cm) $(function(){ lb.boxModel = $s.boxModel; });
+})();
+
+
+// DEFAULT OPTIONS
+$.layout.defaults = {
+/*
+ * LAYOUT & LAYOUT-CONTAINER OPTIONS
+ * - none of these options are applicable to individual panes
+ */
+ name: "" // Not required, but useful for buttons and used for the state-cookie
+, containerClass: "ui-layout-container" // layout-container element
+, inset: null // custom container-inset values (override padding)
+, scrollToBookmarkOnLoad: true // after creating a layout, scroll to bookmark in URL (.../page.htm#myBookmark)
+, resizeWithWindow: true // bind thisLayout.resizeAll() to the window.resize event
+, resizeWithWindowDelay: 200 // delay calling resizeAll because makes window resizing very jerky
+, resizeWithWindowMaxDelay: 0 // 0 = none - force resize every XX ms while window is being resized
+, maskPanesEarly: false // true = create pane-masks on resizer.mouseDown instead of waiting for resizer.dragstart
+, onresizeall_start: null // CALLBACK when resizeAll() STARTS - NOT pane-specific
+, onresizeall_end: null // CALLBACK when resizeAll() ENDS - NOT pane-specific
+, onload_start: null // CALLBACK when Layout inits - after options initialized, but before elements
+, onload_end: null // CALLBACK when Layout inits - after EVERYTHING has been initialized
+, onunload_start: null // CALLBACK when Layout is destroyed OR onWindowUnload
+, onunload_end: null // CALLBACK when Layout is destroyed OR onWindowUnload
+, initPanes: true // false = DO NOT initialize the panes onLoad - will init later
+, showErrorMessages: true // enables fatal error messages to warn developers of common errors
+, showDebugMessages: false // display console-and-alert debug msgs - IF this Layout version _has_ debugging code!
+// Changing this zIndex value will cause other zIndex values to automatically change
+, zIndex: null // the PANE zIndex - resizers and masks will be +1
+// DO NOT CHANGE the zIndex values below unless you clearly understand their relationships
+, zIndexes: { // set _default_ z-index values here...
+ pane_normal: 0 // normal z-index for panes
+ , content_mask: 1 // applied to overlays used to mask content INSIDE panes during resizing
+ , resizer_normal: 2 // normal z-index for resizer-bars
+ , pane_sliding: 100 // applied to *BOTH* the pane and its resizer when a pane is 'slid open'
+ , pane_animate: 1000 // applied to the pane when being animated - not applied to the resizer
+ , resizer_drag: 10000 // applied to the CLONED resizer-bar when being 'dragged'
+ }
+, errors: {
+ pane: "pane" // description of "layout pane element" - used only in error messages
+ , selector: "selector" // description of "jQuery-selector" - used only in error messages
+ , addButtonError: "Error Adding Button\nInvalid "
+ , containerMissing: "UI Layout Initialization Error\nThe specified layout-container does not exist."
+ , centerPaneMissing: "UI Layout Initialization Error\nThe center-pane element does not exist.\nThe center-pane is a required element."
+ , noContainerHeight: "UI Layout Initialization Warning\nThe layout-container \"CONTAINER\" has no height.\nTherefore the layout is 0-height and hence 'invisible'!"
+ , callbackError: "UI Layout Callback Error\nThe EVENT callback is not a valid function."
+ }
+/*
+ * PANE DEFAULT SETTINGS
+ * - settings under the 'panes' key become the default settings for *all panes*
+ * - ALL pane-options can also be set specifically for each panes, which will override these 'default values'
+ */
+, panes: { // default options for 'all panes' - will be overridden by 'per-pane settings'
+ applyDemoStyles: false // NOTE: renamed from applyDefaultStyles for clarity
+ , closable: true // pane can open & close
+ , resizable: true // when open, pane can be resized
+ , slidable: true // when closed, pane can 'slide open' over other panes - closes on mouse-out
+ , initClosed: false // true = init pane as 'closed'
+ , initHidden: false // true = init pane as 'hidden' - no resizer-bar/spacing
+ // SELECTORS
+ //, paneSelector: "" // MUST be pane-specific - jQuery selector for pane
+ , contentSelector: ".ui-layout-content" // INNER div/element to auto-size so only it scrolls, not the entire pane!
+ , contentIgnoreSelector: ".ui-layout-ignore" // element(s) to 'ignore' when measuring 'content'
+ , findNestedContent: false // true = $P.find(contentSelector), false = $P.children(contentSelector)
+ // GENERIC ROOT-CLASSES - for auto-generated classNames
+ , paneClass: "ui-layout-pane" // Layout Pane
+ , resizerClass: "ui-layout-resizer" // Resizer Bar
+ , togglerClass: "ui-layout-toggler" // Toggler Button
+ , buttonClass: "ui-layout-button" // CUSTOM Buttons - eg: '[ui-layout-button]-toggle/-open/-close/-pin'
+ // ELEMENT SIZE & SPACING
+ //, size: 100 // MUST be pane-specific -initial size of pane
+ , minSize: 0 // when manually resizing a pane
+ , maxSize: 0 // ditto, 0 = no limit
+ , spacing_open: 6 // space between pane and adjacent panes - when pane is 'open'
+ , spacing_closed: 6 // ditto - when pane is 'closed'
+ , togglerLength_open: 50 // Length = WIDTH of toggler button on north/south sides - HEIGHT on east/west sides
+ , togglerLength_closed: 50 // 100% OR -1 means 'full height/width of resizer bar' - 0 means 'hidden'
+ , togglerAlign_open: "center" // top/left, bottom/right, center, OR...
+ , togglerAlign_closed: "center" // 1 => nn = offset from top/left, -1 => -nn == offset from bottom/right
+ , togglerContent_open: "" // text or HTML to put INSIDE the toggler
+ , togglerContent_closed: "" // ditto
+ // RESIZING OPTIONS
+ , resizerDblClickToggle: true //
+ , autoResize: true // IF size is 'auto' or a percentage, then recalc 'pixel size' whenever the layout resizes
+ , autoReopen: true // IF a pane was auto-closed due to noRoom, reopen it when there is room? False = leave it closed
+ , resizerDragOpacity: 1 // option for ui.draggable
+ //, resizerCursor: "" // MUST be pane-specific - cursor when over resizer-bar
+ , maskContents: false // true = add DIV-mask over-or-inside this pane so can 'drag' over IFRAMES
+ , maskObjects: false // true = add IFRAME-mask over-or-inside this pane to cover objects/applets - content-mask will overlay this mask
+ , maskZindex: null // will override zIndexes.content_mask if specified - not applicable to iframe-panes
+ , resizingGrid: false // grid size that the resizers will snap-to during resizing, eg: [20,20]
+ , livePaneResizing: false // true = LIVE Resizing as resizer is dragged
+ , liveContentResizing: false // true = re-measure header/footer heights as resizer is dragged
+ , liveResizingTolerance: 1 // how many px change before pane resizes, to control performance
+ // SLIDING OPTIONS
+ , sliderCursor: "pointer" // cursor when resizer-bar will trigger 'sliding'
+ , slideTrigger_open: "click" // click, dblclick, mouseenter
+ , slideTrigger_close: "mouseleave"// click, mouseleave
+ , slideDelay_open: 300 // applies only for mouseenter event - 0 = instant open
+ , slideDelay_close: 300 // applies only for mouseleave event (300ms is the minimum!)
+ , hideTogglerOnSlide: false // when pane is slid-open, should the toggler show?
+ , preventQuickSlideClose: $.layout.browser.webkit // Chrome triggers slideClosed as it is opening
+ , preventPrematureSlideClose: false // handle incorrect mouseleave trigger, like when over a SELECT-list in IE
+ // PANE-SPECIFIC TIPS & MESSAGES
+ , tips: {
+ Open: "Open" // eg: "Open Pane"
+ , Close: "Close"
+ , Resize: "Resize"
+ , Slide: "Slide Open"
+ , Pin: "Pin"
+ , Unpin: "Un-Pin"
+ , noRoomToOpen: "Not enough room to show this panel." // alert if user tries to open a pane that cannot
+ , minSizeWarning: "Panel has reached its minimum size" // displays in browser statusbar
+ , maxSizeWarning: "Panel has reached its maximum size" // ditto
+ }
+ // HOT-KEYS & MISC
+ , showOverflowOnHover: false // will bind allowOverflow() utility to pane.onMouseOver
+ , enableCursorHotkey: true // enabled 'cursor' hotkeys
+ //, customHotkey: "" // MUST be pane-specific - EITHER a charCode OR a character
+ , customHotkeyModifier: "SHIFT" // either 'SHIFT', 'CTRL' or 'CTRL+SHIFT' - NOT 'ALT'
+ // PANE ANIMATION
+ // NOTE: fxSss_open, fxSss_close & fxSss_size options (eg: fxName_open) are auto-generated if not passed
+ , fxName: "slide" // ('none' or blank), slide, drop, scale -- only relevant to 'open' & 'close', NOT 'size'
+ , fxSpeed: null // slow, normal, fast, 200, nnn - if passed, will OVERRIDE fxSettings.duration
+ , fxSettings: {} // can be passed, eg: { easing: "easeOutBounce", duration: 1500 }
+ , fxOpacityFix: true // tries to fix opacity in IE to restore anti-aliasing after animation
+ , animatePaneSizing: false // true = animate resizing after dragging resizer-bar OR sizePane() is called
+ /* NOTE: Action-specific FX options are auto-generated from the options above if not specifically set:
+ fxName_open: "slide" // 'Open' pane animation
+ fnName_close: "slide" // 'Close' pane animation
+ fxName_size: "slide" // 'Size' pane animation - when animatePaneSizing = true
+ fxSpeed_open: null
+ fxSpeed_close: null
+ fxSpeed_size: null
+ fxSettings_open: {}
+ fxSettings_close: {}
+ fxSettings_size: {}
+ */
+ // CHILD/NESTED LAYOUTS
+ , children: null // Layout-options for nested/child layout - even {} is valid as options
+ , containerSelector: '' // if child is NOT 'directly nested', a selector to find it/them (can have more than one child layout!)
+ , initChildren: true // true = child layout will be created as soon as _this_ layout completes initialization
+ , destroyChildren: true // true = destroy child-layout if this pane is destroyed
+ , resizeChildren: true // true = trigger child-layout.resizeAll() when this pane is resized
+ // EVENT TRIGGERING
+ , triggerEventsOnLoad: false // true = trigger onopen OR onclose callbacks when layout initializes
+ , triggerEventsDuringLiveResize: true // true = trigger onresize callback REPEATEDLY if livePaneResizing==true
+ // PANE CALLBACKS
+ , onshow_start: null // CALLBACK when pane STARTS to Show - BEFORE onopen/onhide_start
+ , onshow_end: null // CALLBACK when pane ENDS being Shown - AFTER onopen/onhide_end
+ , onhide_start: null // CALLBACK when pane STARTS to Close - BEFORE onclose_start
+ , onhide_end: null // CALLBACK when pane ENDS being Closed - AFTER onclose_end
+ , onopen_start: null // CALLBACK when pane STARTS to Open
+ , onopen_end: null // CALLBACK when pane ENDS being Opened
+ , onclose_start: null // CALLBACK when pane STARTS to Close
+ , onclose_end: null // CALLBACK when pane ENDS being Closed
+ , onresize_start: null // CALLBACK when pane STARTS being Resized ***FOR ANY REASON***
+ , onresize_end: null // CALLBACK when pane ENDS being Resized ***FOR ANY REASON***
+ , onsizecontent_start: null // CALLBACK when sizing of content-element STARTS
+ , onsizecontent_end: null // CALLBACK when sizing of content-element ENDS
+ , onswap_start: null // CALLBACK when pane STARTS to Swap
+ , onswap_end: null // CALLBACK when pane ENDS being Swapped
+ , ondrag_start: null // CALLBACK when pane STARTS being ***MANUALLY*** Resized
+ , ondrag_end: null // CALLBACK when pane ENDS being ***MANUALLY*** Resized
+ }
+/*
+ * PANE-SPECIFIC SETTINGS
+ * - options listed below MUST be specified per-pane - they CANNOT be set under 'panes'
+ * - all options under the 'panes' key can also be set specifically for any pane
+ * - most options under the 'panes' key apply only to 'border-panes' - NOT the the center-pane
+ */
+, north: {
+ paneSelector: ".ui-layout-north"
+ , size: "auto" // eg: "auto", "30%", .30, 200
+ , resizerCursor: "n-resize" // custom = url(myCursor.cur)
+ , customHotkey: "" // EITHER a charCode (43) OR a character ("o")
+ }
+, south: {
+ paneSelector: ".ui-layout-south"
+ , size: "50%"//"auto"
+ , resizerCursor: "s-resize"
+ , customHotkey: ""
+ , initClosed: true
+ }
+, east: {
+ paneSelector: ".ui-layout-east"
+ , size: "5%"//200
+ , resizerCursor: "e-resize"
+ , customHotkey: ""
+ }
+, west: {
+ paneSelector: ".ui-layout-west"
+ , size: "70%" //200
+ , resizerCursor: "w-resize"
+ , customHotkey: ""
+ , initClosed: true
+ }
+, center: {
+ paneSelector: ".ui-layout-center"
+ , size: "30%"//"auto"
+ , minWidth: 0
+ , minHeight: 0
+ }
+};
+
+$.layout.optionsMap = {
+ // layout/global options - NOT pane-options
+ layout: ("name,instanceKey,stateManagement,effects,inset,zIndexes,errors,"
+ + "zIndex,scrollToBookmarkOnLoad,showErrorMessages,maskPanesEarly,"
+ + "outset,resizeWithWindow,resizeWithWindowDelay,resizeWithWindowMaxDelay,"
+ + "onresizeall,onresizeall_start,onresizeall_end,onload,onload_start,onload_end,onunload,onunload_start,onunload_end").split(",")
+// borderPanes: [ ALL options that are NOT specified as 'layout' ]
+ // default.panes options that apply to the center-pane (most options apply _only_ to border-panes)
+, center: ("paneClass,contentSelector,contentIgnoreSelector,findNestedContent,applyDemoStyles,triggerEventsOnLoad,"
+ + "showOverflowOnHover,maskContents,maskObjects,liveContentResizing,"
+ + "containerSelector,children,initChildren,resizeChildren,destroyChildren,"
+ + "onresize,onresize_start,onresize_end,onsizecontent,onsizecontent_start,onsizecontent_end").split(",")
+ // options that MUST be specifically set 'per-pane' - CANNOT set in the panes (defaults) key
+, noDefault: ("paneSelector,resizerCursor,customHotkey").split(",")
+};
+
+/**
+ * Processes options passed in converts flat-format data into subkey (JSON) format
+ * In flat-format, subkeys are _currently_ separated with 2 underscores, like north__optName
+ * Plugins may also call this method so they can transform their own data
+ *
+ * @param {!Object} hash Data/options passed by user - may be a single level or nested levels
+ * @param {boolean=} [addKeys=false] Should the primary layout.options keys be added if they do not exist?
+ * @return {Object} Returns hash of minWidth & minHeight
+ */
+$.layout.transformData = function (hash, addKeys) {
+ var json = addKeys ? { panes: {}, center: {} } : {} // init return object
+ , branch, optKey, keys, key, val, i, c;
+
+ if (typeof hash !== "object") return json; // no options passed
+
+ // convert all 'flat-keys' to 'sub-key' format
+ for (optKey in hash) {
+ branch = json;
+ val = hash[ optKey ];
+ keys = optKey.split("__"); // eg: west__size or north__fxSettings__duration
+ c = keys.length - 1;
+ // convert underscore-delimited to subkeys
+ for (i=0; i <= c; i++) {
+ key = keys[i];
+ if (i === c) { // last key = value
+ if ($.isPlainObject( val ))
+ branch[key] = $.layout.transformData( val ); // RECURSE
+ else
+ branch[key] = val;
+ }
+ else {
+ if (!branch[key])
+ branch[key] = {}; // create the subkey
+ // recurse to sub-key for next loop - if not done
+ branch = branch[key];
+ }
+ }
+ }
+ return json;
+};
+
+// INTERNAL CONFIG DATA - DO NOT CHANGE THIS!
+$.layout.backwardCompatibility = {
+ // data used by renameOldOptions()
+ map: {
+ // OLD Option Name: NEW Option Name
+ applyDefaultStyles: "applyDemoStyles"
+ // CHILD/NESTED LAYOUTS
+ , childOptions: "children"
+ , initChildLayout: "initChildren"
+ , destroyChildLayout: "destroyChildren"
+ , resizeChildLayout: "resizeChildren"
+ , resizeNestedLayout: "resizeChildren"
+ // MISC Options
+ , resizeWhileDragging: "livePaneResizing"
+ , resizeContentWhileDragging: "liveContentResizing"
+ , triggerEventsWhileDragging: "triggerEventsDuringLiveResize"
+ , maskIframesOnResize: "maskContents"
+ // STATE MANAGEMENT
+ , useStateCookie: "stateManagement.enabled"
+ , "cookie.autoLoad": "stateManagement.autoLoad"
+ , "cookie.autoSave": "stateManagement.autoSave"
+ , "cookie.keys": "stateManagement.stateKeys"
+ , "cookie.name": "stateManagement.cookie.name"
+ , "cookie.domain": "stateManagement.cookie.domain"
+ , "cookie.path": "stateManagement.cookie.path"
+ , "cookie.expires": "stateManagement.cookie.expires"
+ , "cookie.secure": "stateManagement.cookie.secure"
+ // OLD Language options
+ , noRoomToOpenTip: "tips.noRoomToOpen"
+ , togglerTip_open: "tips.Close" // open = Close
+ , togglerTip_closed: "tips.Open" // closed = Open
+ , resizerTip: "tips.Resize"
+ , sliderTip: "tips.Slide"
+ }
+
+/**
+* @param {Object} opts
+*/
+, renameOptions: function (opts) {
+ var map = $.layout.backwardCompatibility.map
+ , oldData, newData, value
+ ;
+ for (var itemPath in map) {
+ oldData = getBranch( itemPath );
+ value = oldData.branch[ oldData.key ];
+ if (value !== undefined) {
+ newData = getBranch( map[itemPath], true );
+ newData.branch[ newData.key ] = value;
+ delete oldData.branch[ oldData.key ];
+ }
+ }
+
+ /**
+ * @param {string} path
+ * @param {boolean=} [create=false] Create path if does not exist
+ */
+ function getBranch (path, create) {
+ var a = path.split(".") // split keys into array
+ , c = a.length - 1
+ , D = { branch: opts, key: a[c] } // init branch at top & set key (last item)
+ , i = 0, k, undef;
+ for (; i<c; i++) { // skip the last key (data)
+ k = a[i];
+ if (D.branch[ k ] == undefined) { // child-key does not exist
+ if (create) {
+ D.branch = D.branch[ k ] = {}; // create child-branch
+ }
+ else // can't go any farther
+ D.branch = {}; // branch is undefined
+ }
+ else
+ D.branch = D.branch[ k ]; // get child-branch
+ }
+ return D;
+ };
+ }
+
+/**
+* @param {Object} opts
+*/
+, renameAllOptions: function (opts) {
+ var ren = $.layout.backwardCompatibility.renameOptions;
+ // rename root (layout) options
+ ren( opts );
+ // rename 'defaults' to 'panes'
+ if (opts.defaults) {
+ if (typeof opts.panes !== "object")
+ opts.panes = {};
+ $.extend(true, opts.panes, opts.defaults);
+ delete opts.defaults;
+ }
+ // rename options in the the options.panes key
+ if (opts.panes) ren( opts.panes );
+ // rename options inside *each pane key*, eg: options.west
+ $.each($.layout.config.allPanes, function (i, pane) {
+ if (opts[pane]) ren( opts[pane] );
+ });
+ return opts;
+ }
+};
+
+
+
+
+/* ============================================================
+ * BEGIN WIDGET: $( selector ).layout( {options} );
+ * ============================================================
+ */
+$.fn.layout = function (opts) {
+ var
+
+ // local aliases to global data
+ browser = $.layout.browser
+, _c = $.layout.config
+
+ // local aliases to utlity methods
+, cssW = $.layout.cssWidth
+, cssH = $.layout.cssHeight
+, elDims = $.layout.getElementDimensions
+, styles = $.layout.getElementStyles
+, evtObj = $.layout.getEventObject
+, evtPane = $.layout.parsePaneName
+
+/**
+ * options - populated by initOptions()
+ */
+, options = $.extend(true, {}, $.layout.defaults)
+, effects = options.effects = $.extend(true, {}, $.layout.effects)
+
+/**
+ * layout-state object
+ */
+, state = {
+ // generate unique ID to use for event.namespace so can unbind only events added by 'this layout'
+ id: "layout"+ $.now() // code uses alias: sID
+ , initialized: false
+ , paneResizing: false
+ , panesSliding: {}
+ , container: { // list all keys referenced in code to avoid compiler error msgs
+ innerWidth: 0
+ , innerHeight: 0
+ , outerWidth: 0
+ , outerHeight: 0
+ , layoutWidth: 0
+ , layoutHeight: 0
+ }
+ , north: { childIdx: 0 }
+ , south: { childIdx: 0 }
+ , east: { childIdx: 0 }
+ , west: { childIdx: 0 }
+ , center: { childIdx: 0 }
+ }
+
+/**
+ * parent/child-layout pointers
+ */
+//, hasParentLayout = false - exists ONLY inside Instance so can be set externally
+, children = {
+ north: null
+ , south: null
+ , east: null
+ , west: null
+ , center: null
+ }
+
+/*
+ * ###########################
+ * INTERNAL HELPER FUNCTIONS
+ * ###########################
+ */
+
+ /**
+ * Manages all internal timers
+ */
+, timer = {
+ data: {}
+ , set: function (s, fn, ms) { timer.clear(s); timer.data[s] = setTimeout(fn, ms); }
+ , clear: function (s) { var t=timer.data; if (t[s]) {clearTimeout(t[s]); delete t[s];} }
+ }
+
+ /**
+ * Alert or console.log a message - IF option is enabled.
+ *
+ * @param {(string|!Object)} msg Message (or debug-data) to display
+ * @param {boolean=} [popup=false] True by default, means 'alert', false means use console.log
+ * @param {boolean=} [debug=false] True means is a widget debugging message
+ */
+, _log = function (msg, popup, debug) {
+ var o = options;
+ if ((o.showErrorMessages && !debug) || (debug && o.showDebugMessages))
+ $.layout.msg( o.name +' / '+ msg, (popup !== false) );
+ return false;
+ }
+
+ /**
+ * Executes a Callback function after a trigger event, like resize, open or close
+ *
+ * @param {string} evtName Name of the layout callback, eg "onresize_start"
+ * @param {(string|boolean)=} [pane=""] This is passed only so we can pass the 'pane object' to the callback
+ * @param {(string|boolean)=} [skipBoundEvents=false] True = do not run events bound to the elements - only the callbacks set in options
+ */
+, _runCallbacks = function (evtName, pane, skipBoundEvents) {
+ var hasPane = pane && isStr(pane)
+ , s = hasPane ? state[pane] : state
+ , o = hasPane ? options[pane] : options
+ , lName = options.name
+ // names like onopen and onopen_end separate are interchangeable in options...
+ , lng = evtName + (evtName.match(/_/) ? "" : "_end")
+ , shrt = lng.match(/_end$/) ? lng.substr(0, lng.length - 4) : ""
+ , fn = o[lng] || o[shrt]
+ , retVal = "NC" // NC = No Callback
+ , args = []
+ , $P = hasPane ? $Ps[pane] : 0
+ ;
+ if (hasPane && !$P) // a pane is specified, but does not exist!
+ return retVal;
+ if ( !hasPane && $.type(pane) === "boolean" ) {
+ skipBoundEvents = pane; // allow pane param to be skipped for Layout callback
+ pane = "";
+ }
+
+ // first trigger the callback set in the options
+ if (fn) {
+ try {
+ // convert function name (string) to function object
+ if (isStr( fn )) {
+ if (fn.match(/,/)) {
+ // function name cannot contain a comma,
+ // so must be a function name AND a parameter to pass
+ args = fn.split(",")
+ , fn = eval(args[0]);
+ }
+ else // just the name of an external function?
+ fn = eval(fn);
+ }
+ // execute the callback, if exists
+ if ($.isFunction( fn )) {
+ if (args.length)
+ retVal = g(fn)(args[1]); // pass the argument parsed from 'list'
+ else if ( hasPane )
+ // pass data: pane-name, pane-element, pane-state, pane-options, and layout-name
+ retVal = g(fn)( pane, $Ps[pane], s, o, lName );
+ else // must be a layout/container callback - pass suitable info
+ retVal = g(fn)( Instance, s, o, lName );
+ }
+ }
+ catch (ex) {
+ _log( options.errors.callbackError.replace(/EVENT/, $.trim((pane || "") +" "+ lng)), false );
+ if ($.type(ex) === "string" && string.length)
+ _log("Exception: "+ ex, false );
+ }
+ }
+
+ // trigger additional events bound directly to the pane
+ if (!skipBoundEvents && retVal !== false) {
+ if ( hasPane ) { // PANE events can be bound to each pane-elements
+ o = options[pane];
+ s = state[pane];
+ $P.triggerHandler("layoutpane"+ lng, [ pane, $P, s, o, lName ]);
+ if (shrt)
+ $P.triggerHandler("layoutpane"+ shrt, [ pane, $P, s, o, lName ]);
+ }
+ else { // LAYOUT events can be bound to the container-element
+ $N.triggerHandler("layout"+ lng, [ Instance, s, o, lName ]);
+ if (shrt)
+ $N.triggerHandler("layout"+ shrt, [ Instance, s, o, lName ]);
+ }
+ }
+
+ // ALWAYS resizeChildren after an onresize_end event - even during initialization
+ // IGNORE onsizecontent_end event because causes child-layouts to resize TWICE
+ if (hasPane && evtName === "onresize_end") // BAD: || evtName === "onsizecontent_end"
+ resizeChildren(pane+"", true); // compiler hack -force string
+
+ return retVal;
+
+ function g (f) { return f; }; // compiler hack
+ }
+
+
+ /**
+ * cure iframe display issues in IE & other browsers
+ */
+, _fixIframe = function (pane) {
+ if (browser.mozilla) return; // skip FireFox - it auto-refreshes iframes onShow
+ var $P = $Ps[pane];
+ // if the 'pane' is an iframe, do it
+ if (state[pane].tagName === "IFRAME")
+ $P.css(_c.hidden).css(_c.visible);
+ else // ditto for any iframes INSIDE the pane
+ $P.find('IFRAME').css(_c.hidden).css(_c.visible);
+ }
+
+ /**
+ * @param {string} pane Can accept ONLY a 'pane' (east, west, etc)
+ * @param {number=} outerSize (optional) Can pass a width, allowing calculations BEFORE element is resized
+ * @return {number} Returns the innerHeight/Width of el by subtracting padding and borders
+ */
+, cssSize = function (pane, outerSize) {
+ var fn = _c[pane].dir=="horz" ? cssH : cssW;
+ return fn($Ps[pane], outerSize);
+ }
+
+ /**
+ * @param {string} pane Can accept ONLY a 'pane' (east, west, etc)
+ * @return {Object} Returns hash of minWidth & minHeight
+ */
+, cssMinDims = function (pane) {
+ // minWidth/Height means CSS width/height = 1px
+ var $P = $Ps[pane]
+ , dir = _c[pane].dir
+ , d = {
+ minWidth: 1001 - cssW($P, 1000)
+ , minHeight: 1001 - cssH($P, 1000)
+ }
+ ;
+ if (dir === "horz") d.minSize = d.minHeight;
+ if (dir === "vert") d.minSize = d.minWidth;
+ return d;
+ }
+
+ // TODO: see if these methods can be made more useful...
+ // TODO: *maybe* return cssW/H from these so caller can use this info
+
+ /**
+ * @param {(string|!Object)} el
+ * @param {number=} outerWidth
+ * @param {boolean=} [autoHide=false]
+ */
+, setOuterWidth = function (el, outerWidth, autoHide) {
+ var $E = el, w;
+ if (isStr(el)) $E = $Ps[el]; // west
+ else if (!el.jquery) $E = $(el);
+ w = cssW($E, outerWidth);
+ $E.css({ width: w });
+ if (w > 0) {
+ if (autoHide && $E.data('autoHidden') && $E.innerHeight() > 0) {
+ $E.show().data('autoHidden', false);
+ if (!browser.mozilla) // FireFox refreshes iframes - IE does not
+ // make hidden, then visible to 'refresh' display after animation
+ $E.css(_c.hidden).css(_c.visible);
+ }
+ }
+ else if (autoHide && !$E.data('autoHidden'))
+ $E.hide().data('autoHidden', true);
+ }
+
+ /**
+ * @param {(string|!Object)} el
+ * @param {number=} outerHeight
+ * @param {boolean=} [autoHide=false]
+ */
+, setOuterHeight = function (el, outerHeight, autoHide) {
+ var $E = el, h;
+ if (isStr(el)) $E = $Ps[el]; // west
+ else if (!el.jquery) $E = $(el);
+ h = cssH($E, outerHeight);
+ $E.css({ height: h, visibility: "visible" }); // may have been 'hidden' by sizeContent
+ if (h > 0 && $E.innerWidth() > 0) {
+ if (autoHide && $E.data('autoHidden')) {
+ $E.show().data('autoHidden', false);
+ if (!browser.mozilla) // FireFox refreshes iframes - IE does not
+ $E.css(_c.hidden).css(_c.visible);
+ }
+ }
+ else if (autoHide && !$E.data('autoHidden'))
+ $E.hide().data('autoHidden', true);
+ }
+
+
+ /**
+ * Converts any 'size' params to a pixel/integer size, if not already
+ * If 'auto' or a decimal/percentage is passed as 'size', a pixel-size is calculated
+ *
+ /**
+ * @param {string} pane
+ * @param {(string|number)=} size
+ * @param {string=} [dir]
+ * @return {number}
+ */
+, _parseSize = function (pane, size, dir) {
+ if (!dir) dir = _c[pane].dir;
+
+ if (isStr(size) && size.match(/%/))
+ size = (size === '100%') ? -1 : parseInt(size, 10) / 100; // convert % to decimal
+
+ if (size === 0)
+ return 0;
+ else if (size >= 1)
+ return parseInt(size, 10);
+
+ var o = options, avail = 0;
+ if (dir=="horz") // north or south or center.minHeight
+ avail = sC.innerHeight - ($Ps.north ? o.north.spacing_open : 0) - ($Ps.south ? o.south.spacing_open : 0);
+ else if (dir=="vert") // east or west or center.minWidth
+ avail = sC.innerWidth - ($Ps.west ? o.west.spacing_open : 0) - ($Ps.east ? o.east.spacing_open : 0);
+
+ if (size === -1) // -1 == 100%
+ return avail;
+ else if (size > 0) // percentage, eg: .25
+ return round(avail * size);
+ else if (pane=="center")
+ return 0;
+ else { // size < 0 || size=='auto' || size==Missing || size==Invalid
+ // auto-size the pane
+ var dim = (dir === "horz" ? "height" : "width")
+ , $P = $Ps[pane]
+ , $C = dim === 'height' ? $Cs[pane] : false
+ , vis = $.layout.showInvisibly($P) // show pane invisibly if hidden
+ , szP = $P.css(dim) // SAVE current pane size
+ , szC = $C ? $C.css(dim) : 0 // SAVE current content size
+ ;
+ $P.css(dim, "auto");
+ if ($C) $C.css(dim, "auto");
+ size = (dim === "height") ? $P.outerHeight() : $P.outerWidth(); // MEASURE
+ $P.css(dim, szP).css(vis); // RESET size & visibility
+ if ($C) $C.css(dim, szC);
+ return size;
+ }
+ }
+
+ /**
+ * Calculates current 'size' (outer-width or outer-height) of a border-pane - optionally with 'pane-spacing' added
+ *
+ * @param {(string|!Object)} pane
+ * @param {boolean=} [inclSpace=false]
+ * @return {number} Returns EITHER Width for east/west panes OR Height for north/south panes
+ */
+, getPaneSize = function (pane, inclSpace) {
+ var
+ $P = $Ps[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , oSp = (inclSpace ? o.spacing_open : 0)
+ , cSp = (inclSpace ? o.spacing_closed : 0)
+ ;
+ if (!$P || s.isHidden)
+ return 0;
+ else if (s.isClosed || (s.isSliding && inclSpace))
+ return cSp;
+ else if (_c[pane].dir === "horz")
+ return $P.outerHeight() + oSp;
+ else // dir === "vert"
+ return $P.outerWidth() + oSp;
+ }
+
+ /**
+ * Calculate min/max pane dimensions and limits for resizing
+ *
+ * @param {string} pane
+ * @param {boolean=} [slide=false]
+ */
+, setSizeLimits = function (pane, slide) {
+ if (!isInitialized()) return;
+ var
+ o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , dir = c.dir
+ , type = c.sizeType.toLowerCase()
+ , isSliding = (slide != undefined ? slide : s.isSliding) // only open() passes 'slide' param
+ , $P = $Ps[pane]
+ , paneSpacing = o.spacing_open
+ // measure the pane on the *opposite side* from this pane
+ , altPane = _c.oppositeEdge[pane]
+ , altS = state[altPane]
+ , $altP = $Ps[altPane]
+ , altPaneSize = (!$altP || altS.isVisible===false || altS.isSliding ? 0 : (dir=="horz" ? $altP.outerHeight() : $altP.outerWidth()))
+ , altPaneSpacing = ((!$altP || altS.isHidden ? 0 : options[altPane][ altS.isClosed !== false ? "spacing_closed" : "spacing_open" ]) || 0)
+ // limitSize prevents this pane from 'overlapping' opposite pane
+ , containerSize = (dir=="horz" ? sC.innerHeight : sC.innerWidth)
+ , minCenterDims = cssMinDims("center")
+ , minCenterSize = dir=="horz" ? max(options.center.minHeight, minCenterDims.minHeight) : max(options.center.minWidth, minCenterDims.minWidth)
+ // if pane is 'sliding', then ignore center and alt-pane sizes - because 'overlays' them
+ , limitSize = (containerSize - paneSpacing - (isSliding ? 0 : (_parseSize("center", minCenterSize, dir) + altPaneSize + altPaneSpacing)))
+ , minSize = s.minSize = max( _parseSize(pane, o.minSize), cssMinDims(pane).minSize )
+ , maxSize = s.maxSize = min( (o.maxSize ? _parseSize(pane, o.maxSize) : 100000), limitSize )
+ , r = s.resizerPosition = {} // used to set resizing limits
+ , top = sC.inset.top
+ , left = sC.inset.left
+ , W = sC.innerWidth
+ , H = sC.innerHeight
+ , rW = o.spacing_open // subtract resizer-width to get top/left position for south/east
+ ;
+ switch (pane) {
+ case "north": r.min = top + minSize;
+ r.max = top + maxSize;
+ break;
+ case "west": r.min = left + minSize;
+ r.max = left + maxSize;
+ break;
+ case "south": r.min = top + H - maxSize - rW;
+ r.max = top + H - minSize - rW;
+ break;
+ case "east": r.min = left + W - maxSize - rW;
+ r.max = left + W - minSize - rW;
+ break;
+ };
+ }
+
+ /**
+ * Returns data for setting the size/position of center pane. Also used to set Height for east/west panes
+ *
+ * @return JSON Returns a hash of all dimensions: top, bottom, left, right, (outer) width and (outer) height
+ */
+, calcNewCenterPaneDims = function () {
+ var d = {
+ top: getPaneSize("north", true) // true = include 'spacing' value for pane
+ , bottom: getPaneSize("south", true)
+ , left: getPaneSize("west", true)
+ , right: getPaneSize("east", true)
+ , width: 0
+ , height: 0
+ };
+
+ // NOTE: sC = state.container
+ // calc center-pane outer dimensions
+ d.width = sC.innerWidth - d.left - d.right; // outerWidth
+ d.height = sC.innerHeight - d.bottom - d.top; // outerHeight
+ // add the 'container border/padding' to get final positions relative to the container
+ d.top += sC.inset.top;
+ d.bottom += sC.inset.bottom;
+ d.left += sC.inset.left;
+ d.right += sC.inset.right;
+
+ return d;
+ }
+
+
+ /**
+ * @param {!Object} el
+ * @param {boolean=} [allStates=false]
+ */
+, getHoverClasses = function (el, allStates) {
+ var
+ $El = $(el)
+ , type = $El.data("layoutRole")
+ , pane = $El.data("layoutEdge")
+ , o = options[pane]
+ , root = o[type +"Class"]
+ , _pane = "-"+ pane // eg: "-west"
+ , _open = "-open"
+ , _closed = "-closed"
+ , _slide = "-sliding"
+ , _hover = "-hover " // NOTE the trailing space
+ , _state = $El.hasClass(root+_closed) ? _closed : _open
+ , _alt = _state === _closed ? _open : _closed
+ , classes = (root+_hover) + (root+_pane+_hover) + (root+_state+_hover) + (root+_pane+_state+_hover)
+ ;
+ if (allStates) // when 'removing' classes, also remove alternate-state classes
+ classes += (root+_alt+_hover) + (root+_pane+_alt+_hover);
+
+ if (type=="resizer" && $El.hasClass(root+_slide))
+ classes += (root+_slide+_hover) + (root+_pane+_slide+_hover);
+
+ return $.trim(classes);
+ }
+, addHover = function (evt, el) {
+ var $E = $(el || this);
+ if (evt && $E.data("layoutRole") === "toggler")
+ evt.stopPropagation(); // prevent triggering 'slide' on Resizer-bar
+ $E.addClass( getHoverClasses($E) );
+ }
+, removeHover = function (evt, el) {
+ var $E = $(el || this);
+ $E.removeClass( getHoverClasses($E, true) );
+ }
+
+, onResizerEnter = function (evt) { // ALSO called by toggler.mouseenter
+ var pane = $(this).data("layoutEdge")
+ , s = state[pane]
+ , $d = $(document)
+ ;
+ // ignore closed-panes and mouse moving back & forth over resizer!
+ // also ignore if ANY pane is currently resizing
+ if ( s.isResizing || state.paneResizing ) return;
+
+ if (options.maskPanesEarly)
+ showMasks( pane, { resizing: true });
+ }
+, onResizerLeave = function (evt, el) {
+ var e = el || this // el is only passed when called by the timer
+ , pane = $(e).data("layoutEdge")
+ , name = pane +"ResizerLeave"
+ , $d = $(document)
+ ;
+ timer.clear(pane+"_openSlider"); // cancel slideOpen timer, if set
+ timer.clear(name); // cancel enableSelection timer - may re/set below
+ // this method calls itself on a timer because it needs to allow
+ // enough time for dragging to kick-in and set the isResizing flag
+ // dragging has a 100ms delay set, so this delay must be >100
+ if (!el) // 1st call - mouseleave event
+ timer.set(name, function(){ onResizerLeave(evt, e); }, 200);
+ // if user is resizing, dragStop will reset everything, so skip it here
+ else if (options.maskPanesEarly && !state.paneResizing) // 2nd call - by timer
+ hideMasks();
+ }
+
+/*
+ * ###########################
+ * INITIALIZATION METHODS
+ * ###########################
+ */
+
+ /**
+ * Initialize the layout - called automatically whenever an instance of layout is created
+ *
+ * @see none - triggered onInit
+ * @return mixed true = fully initialized | false = panes not initialized (yet) | 'cancel' = abort
+ */
+, _create = function () {
+ // initialize config/options
+ initOptions();
+ var o = options
+ , s = state;
+
+ // TEMP state so isInitialized returns true during init process
+ s.creatingLayout = true;
+
+ // init plugins for this layout, if there are any (eg: stateManagement)
+ runPluginCallbacks( Instance, $.layout.onCreate );
+
+ // options & state have been initialized, so now run beforeLoad callback
+ // onload will CANCEL layout creation if it returns false
+ if (false === _runCallbacks("onload_start"))
+ return 'cancel';
+
+ // initialize the container element
+ _initContainer();
+
+ // bind hotkey function - keyDown - if required
+ initHotkeys();
+
+ // bind window.onunload
+ $(window).bind("unload."+ sID, unload);
+
+ // init plugins for this layout, if there are any (eg: customButtons)
+ runPluginCallbacks( Instance, $.layout.onLoad );
+
+ // if layout elements are hidden, then layout WILL NOT complete initialization!
+ // initLayoutElements will set initialized=true and run the onload callback IF successful
+ if (o.initPanes) _initLayoutElements();
+
+ delete s.creatingLayout;
+
+ return state.initialized;
+ }
+
+ /**
+ * Initialize the layout IF not already
+ *
+ * @see All methods in Instance run this test
+ * @return boolean true = layoutElements have been initialized | false = panes are not initialized (yet)
+ */
+, isInitialized = function () {
+ if (state.initialized || state.creatingLayout) return true; // already initialized
+ else return _initLayoutElements(); // try to init panes NOW
+ }
+
+ /**
+ * Initialize the layout - called automatically whenever an instance of layout is created
+ *
+ * @see _create() & isInitialized
+ * @param {boolean=} [retry=false] // indicates this is a 2nd try
+ * @return An object pointer to the instance created
+ */
+, _initLayoutElements = function (retry) {
+ // initialize config/options
+ var o = options;
+ // CANNOT init panes inside a hidden container!
+ if (!$N.is(":visible")) {
+ // handle Chrome bug where popup window 'has no height'
+ // if layout is BODY element, try again in 50ms
+ // SEE: http://layout.jquery-dev.com/samples/test_popup_window.html
+ if ( !retry && browser.webkit && $N[0].tagName === "BODY" )
+ setTimeout(function(){ _initLayoutElements(true); }, 50);
+ return false;
+ }
+
+ // a center pane is required, so make sure it exists
+ if (!getPane("center").length) {
+ return _log( o.errors.centerPaneMissing );
+ }
+
+ // TEMP state so isInitialized returns true during init process
+ state.creatingLayout = true;
+
+ // update Container dims
+ $.extend(sC, elDims( $N, o.inset )); // passing inset means DO NOT include insetX values
+
+ // initialize all layout elements
+ initPanes(); // size & position panes - calls initHandles() - which calls initResizable()
+
+ if (o.scrollToBookmarkOnLoad) {
+ var l = self.location;
+ if (l.hash) l.replace( l.hash ); // scrollTo Bookmark
+ }
+
+ // check to see if this layout 'nested' inside a pane
+ if (Instance.hasParentLayout)
+ o.resizeWithWindow = false;
+ // bind resizeAll() for 'this layout instance' to window.resize event
+ else if (o.resizeWithWindow)
+ $(window).bind("resize."+ sID, windowResize);
+
+ delete state.creatingLayout;
+ state.initialized = true;
+
+ // init plugins for this layout, if there are any
+ runPluginCallbacks( Instance, $.layout.onReady );
+
+ // now run the onload callback, if exists
+ _runCallbacks("onload_end");
+
+ return true; // elements initialized successfully
+ }
+
+ /**
+ * Initialize nested layouts for a specific pane - can optionally pass layout-options
+ *
+ * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west
+ * @param {Object=} [opts] Layout-options - if passed, will OVERRRIDE options[pane].children
+ * @return An object pointer to the layout instance created - or null
+ */
+, createChildren = function (evt_or_pane, opts) {
+ var pane = evtPane.call(this, evt_or_pane)
+ , $P = $Ps[pane]
+ ;
+ if (!$P) return;
+ var $C = $Cs[pane]
+ , s = state[pane]
+ , o = options[pane]
+ , sm = options.stateManagement || {}
+ , cos = opts ? (o.children = opts) : o.children
+ ;
+ if ( $.isPlainObject( cos ) )
+ cos = [ cos ]; // convert a hash to a 1-elem array
+ else if (!cos || !$.isArray( cos ))
+ return;
+
+ $.each( cos, function (idx, co) {
+ if ( !$.isPlainObject( co ) ) return;
+
+ // determine which element is supposed to be the 'child container'
+ // if pane has a 'containerSelector' OR a 'content-div', use those instead of the pane
+ var $containers = co.containerSelector ? $P.find( co.containerSelector ) : ($C || $P);
+
+ $containers.each(function(){
+ var $cont = $(this)
+ , child = $cont.data("layout") // see if a child-layout ALREADY exists on this element
+ ;
+ // if no layout exists, but children are set, try to create the layout now
+ if (!child) {
+ // TODO: see about moving this to the stateManagement plugin, as a method
+ // set a unique child-instance key for this layout, if not already set
+ setInstanceKey({ container: $cont, options: co }, s );
+ // If THIS layout has a hash in stateManagement.autoLoad,
+ // then see if it also contains state-data for this child-layout
+ // If so, copy the stateData to child.options.stateManagement.autoLoad
+ if ( sm.includeChildren && state.stateData[pane] ) {
+ // THIS layout's state was cached when its state was loaded
+ var paneChildren = state.stateData[pane].children || {}
+ , childState = paneChildren[ co.instanceKey ]
+ , co_sm = co.stateManagement || (co.stateManagement = { autoLoad: true })
+ ;
+ // COPY the stateData into the autoLoad key
+ if ( co_sm.autoLoad === true && childState ) {
+ co_sm.autoSave = false; // disable autoSave because saving handled by parent-layout
+ co_sm.includeChildren = true; // cascade option - FOR NOW
+ co_sm.autoLoad = $.extend(true, {}, childState); // COPY the state-hash
+ }
+ }
+
+ // create the layout
+ child = $cont.layout( co );
+
+ // if successful, update data
+ if (child) {
+ // add the child and update all layout-pointers
+ // MAY have already been done by child-layout calling parent.refreshChildren()
+ refreshChildren( pane, child );
+ }
+ }
+ });
+ });
+ }
+
+, setInstanceKey = function (child, parentPaneState) {
+ // create a named key for use in state and instance branches
+ var $c = child.container
+ , o = child.options
+ , sm = o.stateManagement
+ , key = o.instanceKey || $c.data("layoutInstanceKey")
+ ;
+ if (!key) key = (sm && sm.cookie ? sm.cookie.name : '') || o.name; // look for a name/key
+ if (!key) key = "layout"+ (++parentPaneState.childIdx); // if no name/key found, generate one
+ else key = key.replace(/[^\w-]/gi, '_').replace(/_{2,}/g, '_'); // ensure is valid as a hash key
+ o.instanceKey = key;
+ $c.data("layoutInstanceKey", key); // useful if layout is destroyed and then recreated
+ return key;
+ }
+
+ /**
+ * @param {string} pane The pane being opened, ie: north, south, east, or west
+ * @param {Object=} newChild New child-layout Instance to add to this pane
+ */
+, refreshChildren = function (pane, newChild) {
+ var $P = $Ps[pane]
+ , pC = children[pane]
+ , s = state[pane]
+ , o
+ ;
+ // check for destroy()ed layouts and update the child pointers & arrays
+ if ($.isPlainObject( pC )) {
+ $.each( pC, function (key, child) {
+ if (child.destroyed) delete pC[key]
+ });
+ // if no more children, remove the children hash
+ if ($.isEmptyObject( pC ))
+ pC = children[pane] = null; // clear children hash
+ }
+
+ // see if there is a directly-nested layout inside this pane
+ // if there is, then there can be only ONE child-layout, so check that...
+ if (!newChild && !pC) {
+ newChild = $P.data("layout");
+ }
+
+ // if a newChild instance was passed, add it to children[pane]
+ if (newChild) {
+ // update child.state
+ newChild.hasParentLayout = true; // set parent-flag in child
+ // instanceKey is a key-name used in both state and children
+ o = newChild.options;
+ // set a unique child-instance key for this layout, if not already set
+ setInstanceKey( newChild, s );
+ // add pointer to pane.children hash
+ if (!pC) pC = children[pane] = {}; // create an empty children hash
+ pC[ o.instanceKey ] = newChild.container.data("layout"); // add childLayout instance
+ }
+
+ // ALWAYS refresh the pane.children alias, even if null
+ Instance[pane].children = children[pane];
+
+ // if newChild was NOT passed - see if there is a child layout NOW
+ if (!newChild) {
+ createChildren(pane); // MAY create a child and re-call this method
+ }
+ }
+
+, windowResize = function () {
+ var o = options
+ , delay = Number(o.resizeWithWindowDelay);
+ if (delay < 10) delay = 100; // MUST have a delay!
+ // resizing uses a delay-loop because the resize event fires repeatly - except in FF, but delay anyway
+ timer.clear("winResize"); // if already running
+ timer.set("winResize", function(){
+ timer.clear("winResize");
+ timer.clear("winResizeRepeater");
+ var dims = elDims( $N, o.inset );
+ // only trigger resizeAll() if container has changed size
+ if (dims.innerWidth !== sC.innerWidth || dims.innerHeight !== sC.innerHeight)
+ resizeAll();
+ }, delay);
+ // ALSO set fixed-delay timer, if not already running
+ if (!timer.data["winResizeRepeater"]) setWindowResizeRepeater();
+ }
+
+, setWindowResizeRepeater = function () {
+ var delay = Number(options.resizeWithWindowMaxDelay);
+ if (delay > 0)
+ timer.set("winResizeRepeater", function(){ setWindowResizeRepeater(); resizeAll(); }, delay);
+ }
+
+, unload = function () {
+ var o = options;
+
+ _runCallbacks("onunload_start");
+
+ // trigger plugin callabacks for this layout (eg: stateManagement)
+ runPluginCallbacks( Instance, $.layout.onUnload );
+
+ _runCallbacks("onunload_end");
+ }
+
+ /**
+ * Validate and initialize container CSS and events
+ *
+ * @see _create()
+ */
+, _initContainer = function () {
+ var
+ N = $N[0]
+ , $H = $("html")
+ , tag = sC.tagName = N.tagName
+ , id = sC.id = N.id
+ , cls = sC.className = N.className
+ , o = options
+ , name = o.name
+ , props = "position,margin,padding,border"
+ , css = "layoutCSS"
+ , CSS = {}
+ , hid = "hidden" // used A LOT!
+ // see if this container is a 'pane' inside an outer-layout
+ , parent = $N.data("parentLayout") // parent-layout Instance
+ , pane = $N.data("layoutEdge") // pane-name in parent-layout
+ , isChild = parent && pane
+ , num = $.layout.cssNum
+ , $parent, n
+ ;
+ // sC = state.container
+ sC.selector = $N.selector.split(".slice")[0];
+ sC.ref = (o.name ? o.name +' layout / ' : '') + tag + (id ? "#"+id : cls ? '.['+cls+']' : ''); // used in messages
+ sC.isBody = (tag === "BODY");
+
+ // try to find a parent-layout
+ if (!isChild && !sC.isBody) {
+ $parent = $N.closest("."+ $.layout.defaults.panes.paneClass);
+ parent = $parent.data("parentLayout");
+ pane = $parent.data("layoutEdge");
+ isChild = parent && pane;
+ }
+
+ $N .data({
+ layout: Instance
+ , layoutContainer: sID // FLAG to indicate this is a layout-container - contains unique internal ID
+ })
+ .addClass(o.containerClass)
+ ;
+ var layoutMethods = {
+ destroy: ''
+ , initPanes: ''
+ , resizeAll: 'resizeAll'
+ , resize: 'resizeAll'
+ };
+ // loop hash and bind all methods - include layoutID namespacing
+ for (name in layoutMethods) {
+ $N.bind("layout"+ name.toLowerCase() +"."+ sID, Instance[ layoutMethods[name] || name ]);
+ }
+
+ // if this container is another layout's 'pane', then set child/parent pointers
+ if (isChild) {
+ // update parent flag
+ Instance.hasParentLayout = true;
+ // set pointers to THIS child-layout (Instance) in parent-layout
+ parent.refreshChildren( pane, Instance );
+ }
+
+ // SAVE original container CSS for use in destroy()
+ if (!$N.data(css)) {
+ // handle props like overflow different for BODY & HTML - has 'system default' values
+ if (sC.isBody) {
+ // SAVE <BODY> CSS
+ $N.data(css, $.extend( styles($N, props), {
+ height: $N.css("height")
+ , overflow: $N.css("overflow")
+ , overflowX: $N.css("overflowX")
+ , overflowY: $N.css("overflowY")
+ }));
+ // ALSO SAVE <HTML> CSS
+ $H.data(css, $.extend( styles($H, 'padding'), {
+ height: "auto" // FF would return a fixed px-size!
+ , overflow: $H.css("overflow")
+ , overflowX: $H.css("overflowX")
+ , overflowY: $H.css("overflowY")
+ }));
+ }
+ else // handle props normally for non-body elements
+ $N.data(css, styles($N, props+",top,bottom,left,right,width,height,overflow,overflowX,overflowY") );
+ }
+
+ try {
+ // common container CSS
+ CSS = {
+ overflow: hid
+ , overflowX: hid
+ , overflowY: hid
+ };
+ $N.css( CSS );
+
+ if (o.inset && !$.isPlainObject(o.inset)) {
+ // can specify a single number for equal outset all-around
+ n = parseInt(o.inset, 10) || 0
+ o.inset = {
+ top: n
+ , bottom: n
+ , left: n
+ , right: n
+ };
+ }
+
+ // format html & body if this is a full page layout
+ if (sC.isBody) {
+ // if HTML has padding, use this as an outer-spacing around BODY
+ if (!o.outset) {
+ // use padding from parent-elem (HTML) as outset
+ o.outset = {
+ top: num($H, "paddingTop")
+ , bottom: num($H, "paddingBottom")
+ , left: num($H, "paddingLeft")
+ , right: num($H, "paddingRight")
+ };
+ }
+ else if (!$.isPlainObject(o.outset)) {
+ // can specify a single number for equal outset all-around
+ n = parseInt(o.outset, 10) || 0
+ o.outset = {
+ top: n
+ , bottom: n
+ , left: n
+ , right: n
+ };
+ }
+ // HTML
+ $H.css( CSS ).css({
+ height: "100%"
+ , border: "none" // no border or padding allowed when using height = 100%
+ , padding: 0 // ditto
+ , margin: 0
+ });
+ // BODY
+ if (browser.isIE6) {
+ // IE6 CANNOT use the trick of setting absolute positioning on all 4 sides - must have 'height'
+ $N.css({
+ width: "100%"
+ , height: "100%"
+ , border: "none" // no border or padding allowed when using height = 100%
+ , padding: 0 // ditto
+ , margin: 0
+ , position: "relative"
+ });
+ // convert body padding to an inset option - the border cannot be measured in IE6!
+ if (!o.inset) o.inset = elDims( $N ).inset;
+ }
+ else { // use absolute positioning for BODY to allow borders & padding without overflow
+ $N.css({
+ width: "auto"
+ , height: "auto"
+ , margin: 0
+ , position: "absolute" // allows for border and padding on BODY
+ });
+ // apply edge-positioning created above
+ $N.css( o.outset );
+ }
+ // set current layout-container dimensions
+ $.extend(sC, elDims( $N, o.inset )); // passing inset means DO NOT include insetX values
+ }
+ else {
+ // container MUST have 'position'
+ var p = $N.css("position");
+ if (!p || !p.match(/(fixed|absolute|relative)/))
+ $N.css("position","relative");
+
+ // set current layout-container dimensions
+ if ( $N.is(":visible") ) {
+ $.extend(sC, elDims( $N, o.inset )); // passing inset means DO NOT change insetX (padding) values
+ if (sC.innerHeight < 1) // container has no 'height' - warn developer
+ _log( o.errors.noContainerHeight.replace(/CONTAINER/, sC.ref) );
+ }
+ }
+
+ // if container has min-width/height, then enable scrollbar(s)
+ if ( num($N, "minWidth") ) $N.parent().css("overflowX","auto");
+ if ( num($N, "minHeight") ) $N.parent().css("overflowY","auto");
+
+ } catch (ex) {}
+ }
+
+ /**
+ * Bind layout hotkeys - if options enabled
+ *
+ * @see _create() and addPane()
+ * @param {string=} [panes=""] The edge(s) to process
+ */
+, initHotkeys = function (panes) {
+ panes = panes ? panes.split(",") : _c.borderPanes;
+ // bind keyDown to capture hotkeys, if option enabled for ANY pane
+ $.each(panes, function (i, pane) {
+ var o = options[pane];
+ if (o.enableCursorHotkey || o.customHotkey) {
+ $(document).bind("keydown."+ sID, keyDown); // only need to bind this ONCE
+ return false; // BREAK - binding was done
+ }
+ });
+ }
+
+ /**
+ * Build final OPTIONS data
+ *
+ * @see _create()
+ */
+, initOptions = function () {
+ var data, d, pane, key, val, i, c, o;
+
+ // reprocess user's layout-options to have correct options sub-key structure
+ opts = $.layout.transformData( opts, true ); // panes = default subkey
+
+ // auto-rename old options for backward compatibility
+ opts = $.layout.backwardCompatibility.renameAllOptions( opts );
+
+ // if user-options has 'panes' key (pane-defaults), clean it...
+ if (!$.isEmptyObject(opts.panes)) {
+ // REMOVE any pane-defaults that MUST be set per-pane
+ data = $.layout.optionsMap.noDefault;
+ for (i=0, c=data.length; i<c; i++) {
+ key = data[i];
+ delete opts.panes[key]; // OK if does not exist
+ }
+ // REMOVE any layout-options specified under opts.panes
+ data = $.layout.optionsMap.layout;
+ for (i=0, c=data.length; i<c; i++) {
+ key = data[i];
+ delete opts.panes[key]; // OK if does not exist
+ }
+ }
+
+ // MOVE any NON-layout-options from opts-root to opts.panes
+ data = $.layout.optionsMap.layout;
+ var rootKeys = $.layout.config.optionRootKeys;
+ for (key in opts) {
+ val = opts[key];
+ if ($.inArray(key, rootKeys) < 0 && $.inArray(key, data) < 0) {
+ if (!opts.panes[key])
+ opts.panes[key] = $.isPlainObject(val) ? $.extend(true, {}, val) : val;
+ delete opts[key]
+ }
+ }
+
+ // START by updating ALL options from opts
+ $.extend(true, options, opts);
+
+ // CREATE final options (and config) for EACH pane
+ $.each(_c.allPanes, function (i, pane) {
+
+ // apply 'pane-defaults' to CONFIG.[PANE]
+ _c[pane] = $.extend(true, {}, _c.panes, _c[pane]);
+
+ d = options.panes;
+ o = options[pane];
+
+ // center-pane uses SOME keys in defaults.panes branch
+ if (pane === 'center') {
+ // ONLY copy keys from opts.panes listed in: $.layout.optionsMap.center
+ data = $.layout.optionsMap.center; // list of 'center-pane keys'
+ for (i=0, c=data.length; i<c; i++) { // loop the list...
+ key = data[i];
+ // only need to use pane-default if pane-specific value not set
+ if (!opts.center[key] && (opts.panes[key] || !o[key]))
+ o[key] = d[key]; // pane-default
+ }
+ }
+ else {
+ // border-panes use ALL keys in defaults.panes branch
+ o = options[pane] = $.extend(true, {}, d, o); // re-apply pane-specific opts AFTER pane-defaults
+ createFxOptions( pane );
+ // ensure all border-pane-specific base-classes exist
+ if (!o.resizerClass) o.resizerClass = "ui-layout-resizer";
+ if (!o.togglerClass) o.togglerClass = "ui-layout-toggler";
+ }
+ // ensure we have base pane-class (ALL panes)
+ if (!o.paneClass) o.paneClass = "ui-layout-pane";
+ });
+
+ // update options.zIndexes if a zIndex-option specified
+ var zo = opts.zIndex
+ , z = options.zIndexes;
+ if (zo > 0) {
+ z.pane_normal = zo;
+ z.content_mask = max(zo+1, z.content_mask); // MIN = +1
+ z.resizer_normal = max(zo+2, z.resizer_normal); // MIN = +2
+ }
+
+ // DELETE 'panes' key now that we are done - values were copied to EACH pane
+ delete options.panes;
+
+
+ function createFxOptions ( pane ) {
+ var o = options[pane]
+ , d = options.panes;
+ // ensure fxSettings key to avoid errors
+ if (!o.fxSettings) o.fxSettings = {};
+ if (!d.fxSettings) d.fxSettings = {};
+
+ $.each(["_open","_close","_size"], function (i,n) {
+ var
+ sName = "fxName"+ n
+ , sSpeed = "fxSpeed"+ n
+ , sSettings = "fxSettings"+ n
+ // recalculate fxName according to specificity rules
+ , fxName = o[sName] =
+ o[sName] // options.west.fxName_open
+ || d[sName] // options.panes.fxName_open
+ || o.fxName // options.west.fxName
+ || d.fxName // options.panes.fxName
+ || "none" // MEANS $.layout.defaults.panes.fxName == "" || false || null || 0
+ , fxExists = $.effects && ($.effects[fxName] || ($.effects.effect && $.effects.effect[fxName]))
+ ;
+ // validate fxName to ensure is valid effect - MUST have effect-config data in options.effects
+ if (fxName === "none" || !options.effects[fxName] || !fxExists)
+ fxName = o[sName] = "none"; // effect not loaded OR unrecognized fxName
+
+ // set vars for effects subkeys to simplify logic
+ var fx = options.effects[fxName] || {} // effects.slide
+ , fx_all = fx.all || null // effects.slide.all
+ , fx_pane = fx[pane] || null // effects.slide.west
+ ;
+ // create fxSpeed[_open|_close|_size]
+ o[sSpeed] =
+ o[sSpeed] // options.west.fxSpeed_open
+ || d[sSpeed] // options.west.fxSpeed_open
+ || o.fxSpeed // options.west.fxSpeed
+ || d.fxSpeed // options.panes.fxSpeed
+ || null // DEFAULT - let fxSetting.duration control speed
+ ;
+ // create fxSettings[_open|_close|_size]
+ o[sSettings] = $.extend(
+ true
+ , {}
+ , fx_all // effects.slide.all
+ , fx_pane // effects.slide.west
+ , d.fxSettings // options.panes.fxSettings
+ , o.fxSettings // options.west.fxSettings
+ , d[sSettings] // options.panes.fxSettings_open
+ , o[sSettings] // options.west.fxSettings_open
+ );
+ });
+
+ // DONE creating action-specific-settings for this pane,
+ // so DELETE generic options - are no longer meaningful
+ delete o.fxName;
+ delete o.fxSpeed;
+ delete o.fxSettings;
+ }
+ }
+
+ /**
+ * Initialize module objects, styling, size and position for all panes
+ *
+ * @see _initElements()
+ * @param {string} pane The pane to process
+ */
+, getPane = function (pane) {
+ var sel = options[pane].paneSelector
+ if (sel.substr(0,1)==="#") // ID selector
+ // NOTE: elements selected 'by ID' DO NOT have to be 'children'
+ return $N.find(sel).eq(0);
+ else { // class or other selector
+ var $P = $N.children(sel).eq(0);
+ // look for the pane nested inside a 'form' element
+ return $P.length ? $P : $N.children("form:first").children(sel).eq(0);
+ }
+ }
+
+ /**
+ * @param {Object=} evt
+ */
+, initPanes = function (evt) {
+ // stopPropagation if called by trigger("layoutinitpanes") - use evtPane utility
+ evtPane(evt);
+
+ // NOTE: do north & south FIRST so we can measure their height - do center LAST
+ $.each(_c.allPanes, function (idx, pane) {
+ addPane( pane, true );
+ });
+
+ // init the pane-handles NOW in case we have to hide or close the pane below
+ initHandles();
+
+ // now that all panes have been initialized and initially-sized,
+ // make sure there is really enough space available for each pane
+ $.each(_c.borderPanes, function (i, pane) {
+ if ($Ps[pane] && state[pane].isVisible) { // pane is OPEN
+ setSizeLimits(pane);
+ makePaneFit(pane); // pane may be Closed, Hidden or Resized by makePaneFit()
+ }
+ });
+ // size center-pane AGAIN in case we 'closed' a border-pane in loop above
+ sizeMidPanes("center");
+
+ // Chrome/Webkit sometimes fires callbacks BEFORE it completes resizing!
+ // Before RC30.3, there was a 10ms delay here, but that caused layout
+ // to load asynchrously, which is BAD, so try skipping delay for now
+
+ // process pane contents and callbacks, and init/resize child-layout if exists
+ $.each(_c.allPanes, function (idx, pane) {
+ afterInitPane(pane);
+ });
+ }
+
+ /**
+ * Add a pane to the layout - subroutine of initPanes()
+ *
+ * @see initPanes()
+ * @param {string} pane The pane to process
+ * @param {boolean=} [force=false] Size content after init
+ */
+, addPane = function (pane, force) {
+ if ( !force && !isInitialized() ) return;
+ var
+ o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , dir = c.dir
+ , fx = s.fx
+ , spacing = o.spacing_open || 0
+ , isCenter = (pane === "center")
+ , CSS = {}
+ , $P = $Ps[pane]
+ , size, minSize, maxSize, child
+ ;
+ // if pane-pointer already exists, remove the old one first
+ if ($P)
+ removePane( pane, false, true, false );
+ else
+ $Cs[pane] = false; // init
+
+ $P = $Ps[pane] = getPane(pane);
+ if (!$P.length) {
+ $Ps[pane] = false; // logic
+ return;
+ }
+
+ // SAVE original Pane CSS
+ if (!$P.data("layoutCSS")) {
+ var props = "position,top,left,bottom,right,width,height,overflow,zIndex,display,backgroundColor,padding,margin,border";
+ $P.data("layoutCSS", styles($P, props));
+ }
+
+ // create alias for pane data in Instance - initHandles will add more
+ Instance[pane] = {
+ name: pane
+ , pane: $Ps[pane]
+ , content: $Cs[pane]
+ , options: options[pane]
+ , state: state[pane]
+ , children: children[pane]
+ };
+
+ // add classes, attributes & events
+ $P .data({
+ parentLayout: Instance // pointer to Layout Instance
+ , layoutPane: Instance[pane] // NEW pointer to pane-alias-object
+ , layoutEdge: pane
+ , layoutRole: "pane"
+ })
+ .css(c.cssReq).css("zIndex", options.zIndexes.pane_normal)
+ .css(o.applyDemoStyles ? c.cssDemo : {}) // demo styles
+ .addClass( o.paneClass +" "+ o.paneClass+"-"+pane ) // default = "ui-layout-pane ui-layout-pane-west" - may be a dupe of 'paneSelector'
+ .bind("mouseenter."+ sID, addHover )
+ .bind("mouseleave."+ sID, removeHover )
+ ;
+ var paneMethods = {
+ hide: ''
+ , show: ''
+ , toggle: ''
+ , close: ''
+ , open: ''
+ , slideOpen: ''
+ , slideClose: ''
+ , slideToggle: ''
+ , size: 'sizePane'
+ , sizePane: 'sizePane'
+ , sizeContent: ''
+ , sizeHandles: ''
+ , enableClosable: ''
+ , disableClosable: ''
+ , enableSlideable: ''
+ , disableSlideable: ''
+ , enableResizable: ''
+ , disableResizable: ''
+ , swapPanes: 'swapPanes'
+ , swap: 'swapPanes'
+ , move: 'swapPanes'
+ , removePane: 'removePane'
+ , remove: 'removePane'
+ , createChildren: ''
+ , resizeChildren: ''
+ , resizeAll: 'resizeAll'
+ , resizeLayout: 'resizeAll'
+ }
+ , name;
+ // loop hash and bind all methods - include layoutID namespacing
+ for (name in paneMethods) {
+ $P.bind("layoutpane"+ name.toLowerCase() +"."+ sID, Instance[ paneMethods[name] || name ]);
+ }
+
+ // see if this pane has a 'scrolling-content element'
+ initContent(pane, false); // false = do NOT sizeContent() - called later
+
+ if (!isCenter) {
+ // call _parseSize AFTER applying pane classes & styles - but before making visible (if hidden)
+ // if o.size is auto or not valid, then MEASURE the pane and use that as its 'size'
+ size = s.size = _parseSize(pane, o.size);
+ minSize = _parseSize(pane,o.minSize) || 1;
+ maxSize = _parseSize(pane,o.maxSize) || 100000;
+ if (size > 0) size = max(min(size, maxSize), minSize);
+ s.autoResize = o.autoResize; // used with percentage sizes
+
+ // state for border-panes
+ s.isClosed = false; // true = pane is closed
+ s.isSliding = false; // true = pane is currently open by 'sliding' over adjacent panes
+ s.isResizing= false; // true = pane is in process of being resized
+ s.isHidden = false; // true = pane is hidden - no spacing, resizer or toggler is visible!
+
+ // array for 'pin buttons' whose classNames are auto-updated on pane-open/-close
+ if (!s.pins) s.pins = [];
+ }
+ // states common to ALL panes
+ s.tagName = $P[0].tagName;
+ s.edge = pane; // useful if pane is (or about to be) 'swapped' - easy find out where it is (or is going)
+ s.noRoom = false; // true = pane 'automatically' hidden due to insufficient room - will unhide automatically
+ s.isVisible = true; // false = pane is invisible - closed OR hidden - simplify logic
+
+ // init pane positioning
+ setPanePosition( pane );
+
+ // if pane is not visible,
+ if (dir === "horz") // north or south pane
+ CSS.height = cssH($P, size);
+ else if (dir === "vert") // east or west pane
+ CSS.width = cssW($P, size);
+ //else if (isCenter) {}
+
+ $P.css(CSS); // apply size -- top, bottom & height will be set by sizeMidPanes
+ if (dir != "horz") sizeMidPanes(pane, true); // true = skipCallback
+
+ // if manually adding a pane AFTER layout initialization, then...
+ if (state.initialized) {
+ initHandles( pane );
+ initHotkeys( pane );
+ }
+
+ // close or hide the pane if specified in settings
+ if (o.initClosed && o.closable && !o.initHidden)
+ close(pane, true, true); // true, true = force, noAnimation
+ else if (o.initHidden || o.initClosed)
+ hide(pane); // will be completely invisible - no resizer or spacing
+ else if (!s.noRoom)
+ // make the pane visible - in case was initially hidden
+ $P.css("display","block");
+ // ELSE setAsOpen() - called later by initHandles()
+
+ // RESET visibility now - pane will appear IF display:block
+ $P.css("visibility","visible");
+
+ // check option for auto-handling of pop-ups & drop-downs
+ if (o.showOverflowOnHover)
+ $P.hover( allowOverflow, resetOverflow );
+
+ // if manually adding a pane AFTER layout initialization, then...
+ if (state.initialized) {
+ afterInitPane( pane );
+ }
+ }
+
+, afterInitPane = function (pane) {
+ var $P = $Ps[pane]
+ , s = state[pane]
+ , o = options[pane]
+ ;
+ if (!$P) return;
+
+ // see if there is a directly-nested layout inside this pane
+ if ($P.data("layout"))
+ refreshChildren( pane, $P.data("layout") );
+
+ // process pane contents and callbacks, and init/resize child-layout if exists
+ if (s.isVisible) { // pane is OPEN
+ if (state.initialized) // this pane was added AFTER layout was created
+ resizeAll(); // will also sizeContent
+ else
+ sizeContent(pane);
+
+ if (o.triggerEventsOnLoad)
+ _runCallbacks("onresize_end", pane);
+ else // automatic if onresize called, otherwise call it specifically
+ // resize child - IF inner-layout already exists (created before this layout)
+ resizeChildren(pane, true); // a previously existing childLayout
+ }
+
+ // init childLayouts - even if pane is not visible
+ if (o.initChildren && o.children)
+ createChildren(pane);
+ }
+
+ /**
+ * @param {string=} panes The pane(s) to process
+ */
+, setPanePosition = function (panes) {
+ panes = panes ? panes.split(",") : _c.borderPanes;
+
+ // create toggler DIVs for each pane, and set object pointers for them, eg: $R.north = north toggler DIV
+ $.each(panes, function (i, pane) {
+ var $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , side = _c[pane].side
+ , CSS = {}
+ ;
+ if (!$P) return; // pane does not exist - skip
+
+ // set css-position to account for container borders & padding
+ switch (pane) {
+ case "north": CSS.top = sC.inset.top;
+ CSS.left = sC.inset.left;
+ CSS.right = sC.inset.right;
+ break;
+ case "south": CSS.bottom = sC.inset.bottom;
+ CSS.left = sC.inset.left;
+ CSS.right = sC.inset.right;
+ break;
+ case "west": CSS.left = sC.inset.left; // top, bottom & height set by sizeMidPanes()
+ break;
+ case "east": CSS.right = sC.inset.right; // ditto
+ break;
+ case "center": // top, left, width & height set by sizeMidPanes()
+ }
+ // apply position
+ $P.css(CSS);
+
+ // update resizer position
+ if ($R && s.isClosed)
+ $R.css(side, sC.inset[side]);
+ else if ($R && !s.isHidden)
+ $R.css(side, sC.inset[side] + getPaneSize(pane));
+ });
+ }
+
+ /**
+ * Initialize module objects, styling, size and position for all resize bars and toggler buttons
+ *
+ * @see _create()
+ * @param {string=} [panes=""] The edge(s) to process
+ */
+, initHandles = function (panes) {
+ panes = panes ? panes.split(",") : _c.borderPanes;
+
+ // create toggler DIVs for each pane, and set object pointers for them, eg: $R.north = north toggler DIV
+ $.each(panes, function (i, pane) {
+ var $P = $Ps[pane];
+ $Rs[pane] = false; // INIT
+ $Ts[pane] = false;
+ if (!$P) return; // pane does not exist - skip
+
+ var o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , paneId = o.paneSelector.substr(0,1) === "#" ? o.paneSelector.substr(1) : ""
+ , rClass = o.resizerClass
+ , tClass = o.togglerClass
+ , spacing = (s.isVisible ? o.spacing_open : o.spacing_closed)
+ , _pane = "-"+ pane // used for classNames
+ , _state = (s.isVisible ? "-open" : "-closed") // used for classNames
+ , I = Instance[pane]
+ // INIT RESIZER BAR
+ , $R = I.resizer = $Rs[pane] = $("<div></div>")
+ // INIT TOGGLER BUTTON
+ , $T = I.toggler = (o.closable ? $Ts[pane] = $("<div></div>") : false)
+ ;
+
+ //if (s.isVisible && o.resizable) ... handled by initResizable
+ if (!s.isVisible && o.slidable)
+ $R.attr("title", o.tips.Slide).css("cursor", o.sliderCursor);
+
+ $R // if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "paneLeft-resizer"
+ .attr("id", paneId ? paneId +"-resizer" : "" )
+ .data({
+ parentLayout: Instance
+ , layoutPane: Instance[pane] // NEW pointer to pane-alias-object
+ , layoutEdge: pane
+ , layoutRole: "resizer"
+ })
+ .css(_c.resizers.cssReq).css("zIndex", options.zIndexes.resizer_normal)
+ .css(o.applyDemoStyles ? _c.resizers.cssDemo : {}) // add demo styles
+ .addClass(rClass +" "+ rClass+_pane)
+ .hover(addHover, removeHover) // ALWAYS add hover-classes, even if resizing is not enabled - handle with CSS instead
+ .hover(onResizerEnter, onResizerLeave) // ALWAYS NEED resizer.mouseleave to balance toggler.mouseenter
+ .mousedown($.layout.disableTextSelection) // prevent text-selection OUTSIDE resizer
+ .mouseup($.layout.enableTextSelection) // not really necessary, but just in case
+ .appendTo($N) // append DIV to container
+ ;
+ if ($.fn.disableSelection)
+ $R.disableSelection(); // prevent text-selection INSIDE resizer
+ if (o.resizerDblClickToggle)
+ $R.bind("dblclick."+ sID, toggle );
+
+ if ($T) {
+ $T // if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "#paneLeft-toggler"
+ .attr("id", paneId ? paneId +"-toggler" : "" )
+ .data({
+ parentLayout: Instance
+ , layoutPane: Instance[pane] // NEW pointer to pane-alias-object
+ , layoutEdge: pane
+ , layoutRole: "toggler"
+ })
+ .css(_c.togglers.cssReq) // add base/required styles
+ .css(o.applyDemoStyles ? _c.togglers.cssDemo : {}) // add demo styles
+ .addClass(tClass +" "+ tClass+_pane)
+ .hover(addHover, removeHover) // ALWAYS add hover-classes, even if toggling is not enabled - handle with CSS instead
+ .bind("mouseenter", onResizerEnter) // NEED toggler.mouseenter because mouseenter MAY NOT fire on resizer
+ .appendTo($R) // append SPAN to resizer DIV
+ ;
+ // ADD INNER-SPANS TO TOGGLER
+ if (o.togglerContent_open) // ui-layout-open
+ $("<span>"+ o.togglerContent_open +"</span>")
+ .data({
+ layoutEdge: pane
+ , layoutRole: "togglerContent"
+ })
+ .data("layoutRole", "togglerContent")
+ .data("layoutEdge", pane)
+ .addClass("content content-open")
+ .css("display","none")
+ .appendTo( $T )
+ //.hover( addHover, removeHover ) // use ui-layout-toggler-west-hover .content-open instead!
+ ;
+ if (o.togglerContent_closed) // ui-layout-closed
+ $("<span>"+ o.togglerContent_closed +"</span>")
+ .data({
+ layoutEdge: pane
+ , layoutRole: "togglerContent"
+ })
+ .addClass("content content-closed")
+ .css("display","none")
+ .appendTo( $T )
+ //.hover( addHover, removeHover ) // use ui-layout-toggler-west-hover .content-closed instead!
+ ;
+ // ADD TOGGLER.click/.hover
+ enableClosable(pane);
+ }
+
+ // add Draggable events
+ initResizable(pane);
+
+ // ADD CLASSNAMES & SLIDE-BINDINGS - eg: class="resizer resizer-west resizer-open"
+ if (s.isVisible)
+ setAsOpen(pane); // onOpen will be called, but NOT onResize
+ else {
+ setAsClosed(pane); // onClose will be called
+ bindStartSlidingEvents(pane, true); // will enable events IF option is set
+ }
+
+ });
+
+ // SET ALL HANDLE DIMENSIONS
+ sizeHandles();
+ }
+
+
+ /**
+ * Initialize scrolling ui-layout-content div - if exists
+ *
+ * @see initPane() - or externally after an Ajax injection
+ * @param {string} pane The pane to process
+ * @param {boolean=} [resize=true] Size content after init
+ */
+, initContent = function (pane, resize) {
+ if (!isInitialized()) return;
+ var
+ o = options[pane]
+ , sel = o.contentSelector
+ , I = Instance[pane]
+ , $P = $Ps[pane]
+ , $C
+ ;
+ if (sel) $C = I.content = $Cs[pane] = (o.findNestedContent)
+ ? $P.find(sel).eq(0) // match 1-element only
+ : $P.children(sel).eq(0)
+ ;
+ if ($C && $C.length) {
+ $C.data("layoutRole", "content");
+ // SAVE original Content CSS
+ if (!$C.data("layoutCSS"))
+ $C.data("layoutCSS", styles($C, "height"));
+ $C.css( _c.content.cssReq );
+ if (o.applyDemoStyles) {
+ $C.css( _c.content.cssDemo ); // add padding & overflow: auto to content-div
+ $P.css( _c.content.cssDemoPane ); // REMOVE padding/scrolling from pane
+ }
+ // ensure no vertical scrollbar on pane - will mess up measurements
+ if ($P.css("overflowX").match(/(scroll|auto)/)) {
+ $P.css("overflow", "hidden");
+ }
+ state[pane].content = {}; // init content state
+ if (resize !== false) sizeContent(pane);
+ // sizeContent() is called AFTER init of all elements
+ }
+ else
+ I.content = $Cs[pane] = false;
+ }
+
+
+ /**
+ * Add resize-bars to all panes that specify it in options
+ * -dependancy: $.fn.resizable - will skip if not found
+ *
+ * @see _create()
+ * @param {string=} [panes=""] The edge(s) to process
+ */
+, initResizable = function (panes) {
+ var draggingAvailable = $.layout.plugins.draggable
+ , side // set in start()
+ ;
+ panes = panes ? panes.split(",") : _c.borderPanes;
+
+ $.each(panes, function (idx, pane) {
+ var o = options[pane];
+ if (!draggingAvailable || !$Ps[pane] || !o.resizable) {
+ o.resizable = false;
+ return true; // skip to next
+ }
+
+ var s = state[pane]
+ , z = options.zIndexes
+ , c = _c[pane]
+ , side = c.dir=="horz" ? "top" : "left"
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , base = o.resizerClass
+ , lastPos = 0 // used when live-resizing
+ , r, live // set in start because may change
+ // 'drag' classes are applied to the ORIGINAL resizer-bar while dragging is in process
+ , resizerClass = base+"-drag" // resizer-drag
+ , resizerPaneClass = base+"-"+pane+"-drag" // resizer-north-drag
+ // 'helper' class is applied to the CLONED resizer-bar while it is being dragged
+ , helperClass = base+"-dragging" // resizer-dragging
+ , helperPaneClass = base+"-"+pane+"-dragging" // resizer-north-dragging
+ , helperLimitClass = base+"-dragging-limit" // resizer-drag
+ , helperPaneLimitClass = base+"-"+pane+"-dragging-limit" // resizer-north-drag
+ , helperClassesSet = false // logic var
+ ;
+
+ if (!s.isClosed)
+ $R.attr("title", o.tips.Resize)
+ .css("cursor", o.resizerCursor); // n-resize, s-resize, etc
+
+ $R.draggable({
+ containment: $N[0] // limit resizing to layout container
+ , axis: (c.dir=="horz" ? "y" : "x") // limit resizing to horz or vert axis
+ , delay: 0
+ , distance: 1
+ , grid: o.resizingGrid
+ // basic format for helper - style it using class: .ui-draggable-dragging
+ , helper: "clone"
+ , opacity: o.resizerDragOpacity
+ , addClasses: false // avoid ui-state-disabled class when disabled
+ //, iframeFix: o.draggableIframeFix // TODO: consider using when bug is fixed
+ , zIndex: z.resizer_drag
+
+ , start: function (e, ui) {
+ // REFRESH options & state pointers in case we used swapPanes
+ o = options[pane];
+ s = state[pane];
+ // re-read options
+ live = o.livePaneResizing;
+
+ // ondrag_start callback - will CANCEL hide if returns false
+ // TODO: dragging CANNOT be cancelled like this, so see if there is a way?
+ if (false === _runCallbacks("ondrag_start", pane)) return false;
+
+ s.isResizing = true; // prevent pane from closing while resizing
+ state.paneResizing = pane; // easy to see if ANY pane is resizing
+ timer.clear(pane+"_closeSlider"); // just in case already triggered
+
+ // SET RESIZER LIMITS - used in drag()
+ setSizeLimits(pane); // update pane/resizer state
+ r = s.resizerPosition;
+ lastPos = ui.position[ side ]
+
+ $R.addClass( resizerClass +" "+ resizerPaneClass ); // add drag classes
+ helperClassesSet = false; // reset logic var - see drag()
+
+ // MASK PANES CONTAINING IFRAMES, APPLETS OR OTHER TROUBLESOME ELEMENTS
+ showMasks( pane, { resizing: true });
+ }
+
+ , drag: function (e, ui) {
+ if (!helperClassesSet) { // can only add classes after clone has been added to the DOM
+ //$(".ui-draggable-dragging")
+ ui.helper
+ .addClass( helperClass +" "+ helperPaneClass ) // add helper classes
+ .css({ right: "auto", bottom: "auto" }) // fix dir="rtl" issue
+ .children().css("visibility","hidden") // hide toggler inside dragged resizer-bar
+ ;
+ helperClassesSet = true;
+ // draggable bug!? RE-SET zIndex to prevent E/W resize-bar showing through N/S pane!
+ if (s.isSliding) $Ps[pane].css("zIndex", z.pane_sliding);
+ }
+ // CONTAIN RESIZER-BAR TO RESIZING LIMITS
+ var limit = 0;
+ if (ui.position[side] < r.min) {
+ ui.position[side] = r.min;
+ limit = -1;
+ }
+ else if (ui.position[side] > r.max) {
+ ui.position[side] = r.max;
+ limit = 1;
+ }
+ // ADD/REMOVE dragging-limit CLASS
+ if (limit) {
+ ui.helper.addClass( helperLimitClass +" "+ helperPaneLimitClass ); // at dragging-limit
+ window.defaultStatus = (limit>0 && pane.match(/(north|west)/)) || (limit<0 && pane.match(/(south|east)/)) ? o.tips.maxSizeWarning : o.tips.minSizeWarning;
+ }
+ else {
+ ui.helper.removeClass( helperLimitClass +" "+ helperPaneLimitClass ); // not at dragging-limit
+ window.defaultStatus = "";
+ }
+ // DYNAMICALLY RESIZE PANES IF OPTION ENABLED
+ // won't trigger unless resizer has actually moved!
+ if (live && Math.abs(ui.position[side] - lastPos) >= o.liveResizingTolerance) {
+ lastPos = ui.position[side];
+ resizePanes(e, ui, pane)
+ }
+ }
+
+ , stop: function (e, ui) {
+ $('body').enableSelection(); // RE-ENABLE TEXT SELECTION
+ window.defaultStatus = ""; // clear 'resizing limit' message from statusbar
+ $R.removeClass( resizerClass +" "+ resizerPaneClass ); // remove drag classes from Resizer
+ s.isResizing = false;
+ state.paneResizing = false; // easy to see if ANY pane is resizing
+ resizePanes(e, ui, pane, true); // true = resizingDone
+ }
+
+ });
+ });
+
+ /**
+ * resizePanes
+ *
+ * Sub-routine called from stop() - and drag() if livePaneResizing
+ *
+ * @param {!Object} evt
+ * @param {!Object} ui
+ * @param {string} pane
+ * @param {boolean=} [resizingDone=false]
+ */
+ var resizePanes = function (evt, ui, pane, resizingDone) {
+ var dragPos = ui.position
+ , c = _c[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , resizerPos
+ ;
+ switch (pane) {
+ case "north": resizerPos = dragPos.top; break;
+ case "west": resizerPos = dragPos.left; break;
+ case "south": resizerPos = sC.layoutHeight - dragPos.top - o.spacing_open; break;
+ case "east": resizerPos = sC.layoutWidth - dragPos.left - o.spacing_open; break;
+ };
+ // remove container margin from resizer position to get the pane size
+ var newSize = resizerPos - sC.inset[c.side];
+
+ // Disable OR Resize Mask(s) created in drag.start
+ if (!resizingDone) {
+ // ensure we meet liveResizingTolerance criteria
+ if (Math.abs(newSize - s.size) < o.liveResizingTolerance)
+ return; // SKIP resize this time
+ // resize the pane
+ manualSizePane(pane, newSize, false, true); // true = noAnimation
+ sizeMasks(); // resize all visible masks
+ }
+ else { // resizingDone
+ // ondrag_end callback
+ if (false !== _runCallbacks("ondrag_end", pane))
+ manualSizePane(pane, newSize, false, true); // true = noAnimation
+ hideMasks(true); // true = force hiding all masks even if one is 'sliding'
+ if (s.isSliding) // RE-SHOW 'object-masks' so objects won't show through sliding pane
+ showMasks( pane, { resizing: true });
+ }
+ };
+ }
+
+ /**
+ * sizeMask
+ *
+ * Needed to overlay a DIV over an IFRAME-pane because mask CANNOT be *inside* the pane
+ * Called when mask created, and during livePaneResizing
+ */
+, sizeMask = function () {
+ var $M = $(this)
+ , pane = $M.data("layoutMask") // eg: "west"
+ , s = state[pane]
+ ;
+ // only masks over an IFRAME-pane need manual resizing
+ if (s.tagName == "IFRAME" && s.isVisible) // no need to mask closed/hidden panes
+ $M.css({
+ top: s.offsetTop
+ , left: s.offsetLeft
+ , width: s.outerWidth
+ , height: s.outerHeight
+ });
+ /* ALT Method...
+ var $P = $Ps[pane];
+ $M.css( $P.position() ).css({ width: $P[0].offsetWidth, height: $P[0].offsetHeight });
+ */
+ }
+, sizeMasks = function () {
+ $Ms.each( sizeMask ); // resize all 'visible' masks
+ }
+
+ /**
+ * @param {string} pane The pane being resized, animated or isSliding
+ * @param {Object=} [args] (optional) Options: which masks to apply, and to which panes
+ */
+, showMasks = function (pane, args) {
+ var c = _c[pane]
+ , panes = ["center"]
+ , z = options.zIndexes
+ , a = $.extend({
+ objectsOnly: false
+ , animation: false
+ , resizing: true
+ , sliding: state[pane].isSliding
+ }, args )
+ , o, s
+ ;
+ if (a.resizing)
+ panes.push( pane );
+ if (a.sliding)
+ panes.push( _c.oppositeEdge[pane] ); // ADD the oppositeEdge-pane
+
+ if (c.dir === "horz") {
+ panes.push("west");
+ panes.push("east");
+ }
+
+ $.each(panes, function(i,p){
+ s = state[p];
+ o = options[p];
+ if (s.isVisible && ( o.maskObjects || (!a.objectsOnly && o.maskContents) )) {
+ getMasks(p).each(function(){
+ sizeMask.call(this);
+ this.style.zIndex = s.isSliding ? z.pane_sliding+1 : z.pane_normal+1
+ this.style.display = "block";
+ });
+ }
+ });
+ }
+
+ /**
+ * @param {boolean=} force Hide masks even if a pane is sliding
+ */
+, hideMasks = function (force) {
+ // ensure no pane is resizing - could be a timing issue
+ if (force || !state.paneResizing) {
+ $Ms.hide(); // hide ALL masks
+ }
+ // if ANY pane is sliding, then DO NOT remove masks from panes with maskObjects enabled
+ else if (!force && !$.isEmptyObject( state.panesSliding )) {
+ var i = $Ms.length - 1
+ , p, $M;
+ for (; i >= 0; i--) {
+ $M = $Ms.eq(i);
+ p = $M.data("layoutMask");
+ if (!options[p].maskObjects) {
+ $M.hide();
+ }
+ }
+ }
+ }
+
+ /**
+ * @param {string} pane
+ */
+, getMasks = function (pane) {
+ var $Masks = $([])
+ , $M, i = 0, c = $Ms.length
+ ;
+ for (; i<c; i++) {
+ $M = $Ms.eq(i);
+ if ($M.data("layoutMask") === pane)
+ $Masks = $Masks.add( $M );
+ }
+ if ($Masks.length)
+ return $Masks;
+ else
+ return createMasks(pane);
+ }
+
+ /**
+ * createMasks
+ *
+ * Generates both DIV (ALWAYS used) and IFRAME (optional) elements as masks
+ * An IFRAME mask is created *under* the DIV when maskObjects=true, because a DIV cannot mask an applet
+ *
+ * @param {string} pane
+ */
+, createMasks = function (pane) {
+ var
+ $P = $Ps[pane]
+ , s = state[pane]
+ , o = options[pane]
+ , z = options.zIndexes
+ , isIframe, el, $M, css, i
+ ;
+ if (!o.maskContents && !o.maskObjects) return $([]);
+ // if o.maskObjects=true, then loop TWICE to create BOTH kinds of mask, else only create a DIV
+ for (i=0; i < (o.maskObjects ? 2 : 1); i++) {
+ isIframe = o.maskObjects && i==0;
+ el = document.createElement( isIframe ? "iframe" : "div" );
+ $M = $(el).data("layoutMask", pane); // add data to relate mask to pane
+ el.className = "ui-layout-mask ui-layout-mask-"+ pane; // for user styling
+ css = el.style;
+ // Both DIVs and IFRAMES
+ css.background = "#FFF";
+ css.position = "absolute";
+ css.display = "block";
+ if (isIframe) { // IFRAME-only props
+ el.src = "about:blank";
+ el.frameborder = 0;
+ css.border = 0;
+ css.opacity = 0;
+ css.filter = "Alpha(Opacity='0')";
+ //el.allowTransparency = true; - for IE, but breaks masking ability!
+ }
+ else { // DIV-only props
+ css.opacity = 0.001;
+ css.filter = "Alpha(Opacity='1')";
+ }
+ // if pane IS an IFRAME, then must mask the pane itself
+ if (s.tagName == "IFRAME") {
+ // NOTE sizing done by a subroutine so can be called during live-resizing
+ css.zIndex = z.pane_normal+1; // 1-higher than pane
+ $N.append( el ); // append to LAYOUT CONTAINER
+ }
+ // otherwise put masks *inside the pane* to mask its contents
+ else {
+ $M.addClass("ui-layout-mask-inside-pane");
+ css.zIndex = o.maskZindex || z.content_mask; // usually 1, but customizable
+ css.top = 0;
+ css.left = 0;
+ css.width = "100%";
+ css.height = "100%";
+ $P.append( el ); // append INSIDE pane element
+ }
+ // add Mask to cached array so can be resized & reused
+ $Ms = $Ms.add( el );
+ }
+ return $Ms;
+ }
+
+
+ /**
+ * Destroy this layout and reset all elements
+ *
+ * @param {boolean=} [destroyChildren=false] Destory Child-Layouts first?
+ */
+, destroy = function (evt_or_destroyChildren, destroyChildren) {
+ // UNBIND layout events and remove global object
+ $(window).unbind("."+ sID); // resize & unload
+ $(document).unbind("."+ sID); // keyDown (hotkeys)
+
+ if (typeof evt_or_destroyChildren === "object")
+ // stopPropagation if called by trigger("layoutdestroy") - use evtPane utility
+ evtPane(evt_or_destroyChildren);
+ else // no event, so transfer 1st param to destroyChildren param
+ destroyChildren = evt_or_destroyChildren;
+
+ // need to look for parent layout BEFORE we remove the container data, else skips a level
+ //var parentPane = Instance.hasParentLayout ? $.layout.getParentPaneInstance( $N ) : null;
+
+ // reset layout-container
+ $N .clearQueue()
+ .removeData("layout")
+ .removeData("layoutContainer")
+ .removeClass(options.containerClass)
+ .unbind("."+ sID) // remove ALL Layout events
+ ;
+
+ // remove all mask elements that have been created
+ $Ms.remove();
+
+ // loop all panes to remove layout classes, attributes and bindings
+ $.each(_c.allPanes, function (i, pane) {
+ removePane( pane, false, true, destroyChildren ); // true = skipResize
+ });
+
+ // do NOT reset container CSS if is a 'pane' (or 'content') in an outer-layout - ie, THIS layout is 'nested'
+ var css = "layoutCSS";
+ if ($N.data(css) && !$N.data("layoutRole")) // RESET CSS
+ $N.css( $N.data(css) ).removeData(css);
+
+ // for full-page layouts, also reset the <HTML> CSS
+ if (sC.tagName === "BODY" && ($N = $("html")).data(css)) // RESET <HTML> CSS
+ $N.css( $N.data(css) ).removeData(css);
+
+ // trigger plugins for this layout, if there are any
+ runPluginCallbacks( Instance, $.layout.onDestroy );
+
+ // trigger state-management and onunload callback
+ unload();
+
+ // clear the Instance of everything except for container & options (so could recreate)
+ // RE-CREATE: myLayout = myLayout.container.layout( myLayout.options );
+ for (var n in Instance)
+ if (!n.match(/^(container|options)$/)) delete Instance[ n ];
+ // add a 'destroyed' flag to make it easy to check
+ Instance.destroyed = true;
+
+ // if this is a child layout, CLEAR the child-pointer in the parent
+ /* for now the pointer REMAINS, but with only container, options and destroyed keys
+ if (parentPane) {
+ var layout = parentPane.pane.data("parentLayout")
+ , key = layout.options.instanceKey || 'error';
+ // THIS SYNTAX MAY BE WRONG!
+ parentPane.children[key] = layout.children[ parentPane.name ].children[key] = null;
+ }
+ */
+
+ return Instance; // for coding convenience
+ }
+
+ /**
+ * Remove a pane from the layout - subroutine of destroy()
+ *
+ * @see destroy()
+ * @param {(string|Object)} evt_or_pane The pane to process
+ * @param {boolean=} [remove=false] Remove the DOM element?
+ * @param {boolean=} [skipResize=false] Skip calling resizeAll()?
+ * @param {boolean=} [destroyChild=true] Destroy Child-layouts? If not passed, obeys options setting
+ */
+, removePane = function (evt_or_pane, remove, skipResize, destroyChild) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $P = $Ps[pane]
+ , $C = $Cs[pane]
+ , $R = $Rs[pane]
+ , $T = $Ts[pane]
+ ;
+ // NOTE: elements can still exist even after remove()
+ // so check for missing data(), which is cleared by removed()
+ if ($P && $.isEmptyObject( $P.data() )) $P = false;
+ if ($C && $.isEmptyObject( $C.data() )) $C = false;
+ if ($R && $.isEmptyObject( $R.data() )) $R = false;
+ if ($T && $.isEmptyObject( $T.data() )) $T = false;
+
+ if ($P) $P.stop(true, true);
+
+ var o = options[pane]
+ , s = state[pane]
+ , d = "layout"
+ , css = "layoutCSS"
+ , pC = children[pane]
+ , hasChildren = $.isPlainObject( pC ) && !$.isEmptyObject( pC )
+ , destroy = destroyChild !== undefined ? destroyChild : o.destroyChildren
+ ;
+ // FIRST destroy the child-layout(s)
+ if (hasChildren && destroy) {
+ $.each( pC, function (key, child) {
+ if (!child.destroyed)
+ child.destroy(true);// tell child-layout to destroy ALL its child-layouts too
+ if (child.destroyed) // destroy was successful
+ delete pC[key];
+ });
+ // if no more children, remove the children hash
+ if ($.isEmptyObject( pC )) {
+ pC = children[pane] = null; // clear children hash
+ hasChildren = false;
+ }
+ }
+
+ // Note: can't 'remove' a pane element with non-destroyed children
+ if ($P && remove && !hasChildren)
+ $P.remove(); // remove the pane-element and everything inside it
+ else if ($P && $P[0]) {
+ // create list of ALL pane-classes that need to be removed
+ var root = o.paneClass // default="ui-layout-pane"
+ , pRoot = root +"-"+ pane // eg: "ui-layout-pane-west"
+ , _open = "-open"
+ , _sliding= "-sliding"
+ , _closed = "-closed"
+ , classes = [ root, root+_open, root+_closed, root+_sliding, // generic classes
+ pRoot, pRoot+_open, pRoot+_closed, pRoot+_sliding ] // pane-specific classes
+ ;
+ $.merge(classes, getHoverClasses($P, true)); // ADD hover-classes
+ // remove all Layout classes from pane-element
+ $P .removeClass( classes.join(" ") ) // remove ALL pane-classes
+ .removeData("parentLayout")
+ .removeData("layoutPane")
+ .removeData("layoutRole")
+ .removeData("layoutEdge")
+ .removeData("autoHidden") // in case set
+ .unbind("."+ sID) // remove ALL Layout events
+ // TODO: remove these extra unbind commands when jQuery is fixed
+ //.unbind("mouseenter"+ sID)
+ //.unbind("mouseleave"+ sID)
+ ;
+ // do NOT reset CSS if this pane/content is STILL the container of a nested layout!
+ // the nested layout will reset its 'container' CSS when/if it is destroyed
+ if (hasChildren && $C) {
+ // a content-div may not have a specific width, so give it one to contain the Layout
+ $C.width( $C.width() );
+ $.each( pC, function (key, child) {
+ child.resizeAll(); // resize the Layout
+ });
+ }
+ else if ($C)
+ $C.css( $C.data(css) ).removeData(css).removeData("layoutRole");
+ // remove pane AFTER content in case there was a nested layout
+ if (!$P.data(d))
+ $P.css( $P.data(css) ).removeData(css);
+ }
+
+ // REMOVE pane resizer and toggler elements
+ if ($T) $T.remove();
+ if ($R) $R.remove();
+
+ // CLEAR all pointers and state data
+ Instance[pane] = $Ps[pane] = $Cs[pane] = $Rs[pane] = $Ts[pane] = false;
+ s = { removed: true };
+
+ if (!skipResize)
+ resizeAll();
+ }
+
+
+/*
+ * ###########################
+ * ACTION METHODS
+ * ###########################
+ */
+
+ /**
+ * @param {string} pane
+ */
+, _hidePane = function (pane) {
+ var $P = $Ps[pane]
+ , o = options[pane]
+ , s = $P[0].style
+ ;
+ if (o.useOffscreenClose) {
+ if (!$P.data(_c.offscreenReset))
+ $P.data(_c.offscreenReset, { left: s.left, right: s.right });
+ $P.css( _c.offscreenCSS );
+ }
+ else
+ $P.hide().removeData(_c.offscreenReset);
+ }
+
+ /**
+ * @param {string} pane
+ */
+, _showPane = function (pane) {
+ var $P = $Ps[pane]
+ , o = options[pane]
+ , off = _c.offscreenCSS
+ , old = $P.data(_c.offscreenReset)
+ , s = $P[0].style
+ ;
+ $P .show() // ALWAYS show, just in case
+ .removeData(_c.offscreenReset);
+ if (o.useOffscreenClose && old) {
+ if (s.left == off.left)
+ s.left = old.left;
+ if (s.right == off.right)
+ s.right = old.right;
+ }
+ }
+
+
+ /**
+ * Completely 'hides' a pane, including its spacing - as if it does not exist
+ * The pane is not actually 'removed' from the source, so can use 'show' to un-hide it
+ *
+ * @param {(string|Object)} evt_or_pane The pane being hidden, ie: north, south, east, or west
+ * @param {boolean=} [noAnimation=false]
+ */
+, hide = function (evt_or_pane, noAnimation) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , o = options[pane]
+ , s = state[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ ;
+ if (pane === "center" || !$P || s.isHidden) return; // pane does not exist OR is already hidden
+
+ // onhide_start callback - will CANCEL hide if returns false
+ if (state.initialized && false === _runCallbacks("onhide_start", pane)) return;
+
+ s.isSliding = false; // just in case
+ delete state.panesSliding[pane];
+
+ // now hide the elements
+ if ($R) $R.hide(); // hide resizer-bar
+ if (!state.initialized || s.isClosed) {
+ s.isClosed = true; // to trigger open-animation on show()
+ s.isHidden = true;
+ s.isVisible = false;
+ if (!state.initialized)
+ _hidePane(pane); // no animation when loading page
+ sizeMidPanes(_c[pane].dir === "horz" ? "" : "center");
+ if (state.initialized || o.triggerEventsOnLoad)
+ _runCallbacks("onhide_end", pane);
+ }
+ else {
+ s.isHiding = true; // used by onclose
+ close(pane, false, noAnimation); // adjust all panes to fit
+ }
+ }
+
+ /**
+ * Show a hidden pane - show as 'closed' by default unless openPane = true
+ *
+ * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west
+ * @param {boolean=} [openPane=false]
+ * @param {boolean=} [noAnimation=false]
+ * @param {boolean=} [noAlert=false]
+ */
+, show = function (evt_or_pane, openPane, noAnimation, noAlert) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , o = options[pane]
+ , s = state[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ ;
+ if (pane === "center" || !$P || !s.isHidden) return; // pane does not exist OR is not hidden
+
+ // onshow_start callback - will CANCEL show if returns false
+ if (false === _runCallbacks("onshow_start", pane)) return;
+
+ s.isShowing = true; // used by onopen/onclose
+ //s.isHidden = false; - will be set by open/close - if not cancelled
+ s.isSliding = false; // just in case
+ delete state.panesSliding[pane];
+
+ // now show the elements
+ //if ($R) $R.show(); - will be shown by open/close
+ if (openPane === false)
+ close(pane, true); // true = force
+ else
+ open(pane, false, noAnimation, noAlert); // adjust all panes to fit
+ }
+
+
+ /**
+ * Toggles a pane open/closed by calling either open or close
+ *
+ * @param {(string|Object)} evt_or_pane The pane being toggled, ie: north, south, east, or west
+ * @param {boolean=} [slide=false]
+ */
+, toggle = function (evt_or_pane, slide) {
+ if (!isInitialized()) return;
+ var evt = evtObj(evt_or_pane)
+ , pane = evtPane.call(this, evt_or_pane)
+ , s = state[pane]
+ ;
+ if (evt) // called from to $R.dblclick OR triggerPaneEvent
+ evt.stopImmediatePropagation();
+ if (s.isHidden)
+ show(pane); // will call 'open' after unhiding it
+ else if (s.isClosed)
+ open(pane, !!slide);
+ else
+ close(pane);
+ }
+
+
+ /**
+ * Utility method used during init or other auto-processes
+ *
+ * @param {string} pane The pane being closed
+ * @param {boolean=} [setHandles=false]
+ */
+, _closePane = function (pane, setHandles) {
+ var
+ $P = $Ps[pane]
+ , s = state[pane]
+ ;
+ _hidePane(pane);
+ s.isClosed = true;
+ s.isVisible = false;
+ if (setHandles) setAsClosed(pane);
+ }
+
+ /**
+ * Close the specified pane (animation optional), and resize all other panes as needed
+ *
+ * @param {(string|Object)} evt_or_pane The pane being closed, ie: north, south, east, or west
+ * @param {boolean=} [force=false]
+ * @param {boolean=} [noAnimation=false]
+ * @param {boolean=} [skipCallback=false]
+ */
+, close = function (evt_or_pane, force, noAnimation, skipCallback) {
+ var pane = evtPane.call(this, evt_or_pane);
+ if (pane === "center") return; // validate
+ // if pane has been initialized, but NOT the complete layout, close pane instantly
+ if (!state.initialized && $Ps[pane]) {
+ _closePane(pane, true); // INIT pane as closed
+ return;
+ }
+ if (!isInitialized()) return;
+
+ var
+ $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , $T = $Ts[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , doFX, isShowing, isHiding, wasSliding;
+
+ // QUEUE in case another action/animation is in progress
+ $N.queue(function( queueNext ){
+
+ if ( !$P
+ || (!o.closable && !s.isShowing && !s.isHiding) // invalid request // (!o.resizable && !o.closable) ???
+ || (!force && s.isClosed && !s.isShowing) // already closed
+ ) return queueNext();
+
+ // onclose_start callback - will CANCEL hide if returns false
+ // SKIP if just 'showing' a hidden pane as 'closed'
+ var abort = !s.isShowing && false === _runCallbacks("onclose_start", pane);
+
+ // transfer logic vars to temp vars
+ isShowing = s.isShowing;
+ isHiding = s.isHiding;
+ wasSliding = s.isSliding;
+ // now clear the logic vars (REQUIRED before aborting)
+ delete s.isShowing;
+ delete s.isHiding;
+
+ if (abort) return queueNext();
+
+ doFX = !noAnimation && !s.isClosed && (o.fxName_close != "none");
+ s.isMoving = true;
+ s.isClosed = true;
+ s.isVisible = false;
+ // update isHidden BEFORE sizing panes
+ if (isHiding) s.isHidden = true;
+ else if (isShowing) s.isHidden = false;
+
+ if (s.isSliding) // pane is being closed, so UNBIND trigger events
+ bindStopSlidingEvents(pane, false); // will set isSliding=false
+ else // resize panes adjacent to this one
+ sizeMidPanes(_c[pane].dir === "horz" ? "" : "center", false); // false = NOT skipCallback
+
+ // if this pane has a resizer bar, move it NOW - before animation
+ setAsClosed(pane);
+
+ // CLOSE THE PANE
+ if (doFX) { // animate the close
+ lockPaneForFX(pane, true); // need to set left/top so animation will work
+ $P.hide( o.fxName_close, o.fxSettings_close, o.fxSpeed_close, function () {
+ lockPaneForFX(pane, false); // undo
+ if (s.isClosed) close_2();
+ queueNext();
+ });
+ }
+ else { // hide the pane without animation
+ _hidePane(pane);
+ close_2();
+ queueNext();
+ };
+ });
+
+ // SUBROUTINE
+ function close_2 () {
+ s.isMoving = false;
+ bindStartSlidingEvents(pane, true); // will enable if o.slidable = true
+
+ // if opposite-pane was autoClosed, see if it can be autoOpened now
+ var altPane = _c.oppositeEdge[pane];
+ if (state[ altPane ].noRoom) {
+ setSizeLimits( altPane );
+ makePaneFit( altPane );
+ }
+
+ if (!skipCallback && (state.initialized || o.triggerEventsOnLoad)) {
+ // onclose callback - UNLESS just 'showing' a hidden pane as 'closed'
+ if (!isShowing) _runCallbacks("onclose_end", pane);
+ // onhide OR onshow callback
+ if (isShowing) _runCallbacks("onshow_end", pane);
+ if (isHiding) _runCallbacks("onhide_end", pane);
+ }
+ }
+ }
+
+ /**
+ * @param {string} pane The pane just closed, ie: north, south, east, or west
+ */
+, setAsClosed = function (pane) {
+ if (!$Rs[pane]) return; // handles not initialized yet!
+ var
+ $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , $T = $Ts[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , side = _c[pane].side
+ , rClass = o.resizerClass
+ , tClass = o.togglerClass
+ , _pane = "-"+ pane // used for classNames
+ , _open = "-open"
+ , _sliding= "-sliding"
+ , _closed = "-closed"
+ ;
+ $R
+ .css(side, sC.inset[side]) // move the resizer
+ .removeClass( rClass+_open +" "+ rClass+_pane+_open )
+ .removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding )
+ .addClass( rClass+_closed +" "+ rClass+_pane+_closed )
+ ;
+ // handle already-hidden panes in case called by swap() or a similar method
+ if (s.isHidden) $R.hide(); // hide resizer-bar
+
+ // DISABLE 'resizing' when closed - do this BEFORE bindStartSlidingEvents?
+ if (o.resizable && $.layout.plugins.draggable)
+ $R
+ .draggable("disable")
+ .removeClass("ui-state-disabled") // do NOT apply disabled styling - not suitable here
+ .css("cursor", "default")
+ .attr("title","")
+ ;
+
+ // if pane has a toggler button, adjust that too
+ if ($T) {
+ $T
+ .removeClass( tClass+_open +" "+ tClass+_pane+_open )
+ .addClass( tClass+_closed +" "+ tClass+_pane+_closed )
+ .attr("title", o.tips.Open) // may be blank
+ ;
+ // toggler-content - if exists
+ $T.children(".content-open").hide();
+ $T.children(".content-closed").css("display","block");
+ }
+
+ // sync any 'pin buttons'
+ syncPinBtns(pane, false);
+
+ if (state.initialized) {
+ // resize 'length' and position togglers for adjacent panes
+ sizeHandles();
+ }
+ }
+
+ /**
+ * Open the specified pane (animation optional), and resize all other panes as needed
+ *
+ * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west
+ * @param {boolean=} [slide=false]
+ * @param {boolean=} [noAnimation=false]
+ * @param {boolean=} [noAlert=false]
+ */
+, open = function (evt_or_pane, slide, noAnimation, noAlert) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , $T = $Ts[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , doFX, isShowing
+ ;
+ if (pane === "center") return; // validate
+ // QUEUE in case another action/animation is in progress
+ $N.queue(function( queueNext ){
+
+ if ( !$P
+ || (!o.resizable && !o.closable && !s.isShowing) // invalid request
+ || (s.isVisible && !s.isSliding) // already open
+ ) return queueNext();
+
+ // pane can ALSO be unhidden by just calling show(), so handle this scenario
+ if (s.isHidden && !s.isShowing) {
+ queueNext(); // call before show() because it needs the queue free
+ show(pane, true);
+ return;
+ }
+
+ if (s.autoResize && s.size != o.size) // resize pane to original size set in options
+ sizePane(pane, o.size, true, true, true); // true=skipCallback/noAnimation/forceResize
+ else
+ // make sure there is enough space available to open the pane
+ setSizeLimits(pane, slide);
+
+ // onopen_start callback - will CANCEL open if returns false
+ var cbReturn = _runCallbacks("onopen_start", pane);
+
+ if (cbReturn === "abort")
+ return queueNext();
+
+ // update pane-state again in case options were changed in onopen_start
+ if (cbReturn !== "NC") // NC = "No Callback"
+ setSizeLimits(pane, slide);
+
+ if (s.minSize > s.maxSize) { // INSUFFICIENT ROOM FOR PANE TO OPEN!
+ syncPinBtns(pane, false); // make sure pin-buttons are reset
+ if (!noAlert && o.tips.noRoomToOpen)
+ alert(o.tips.noRoomToOpen);
+ return queueNext(); // ABORT
+ }
+
+ if (slide) // START Sliding - will set isSliding=true
+ bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane
+ else if (s.isSliding) // PIN PANE (stop sliding) - open pane 'normally' instead
+ bindStopSlidingEvents(pane, false); // UNBIND trigger events - will set isSliding=false
+ else if (o.slidable)
+ bindStartSlidingEvents(pane, false); // UNBIND trigger events
+
+ s.noRoom = false; // will be reset by makePaneFit if 'noRoom'
+ makePaneFit(pane);
+
+ // transfer logic var to temp var
+ isShowing = s.isShowing;
+ // now clear the logic var
+ delete s.isShowing;
+
+ doFX = !noAnimation && s.isClosed && (o.fxName_open != "none");
+ s.isMoving = true;
+ s.isVisible = true;
+ s.isClosed = false;
+ // update isHidden BEFORE sizing panes - WHY??? Old?
+ if (isShowing) s.isHidden = false;
+
+ if (doFX) { // ANIMATE
+ // mask adjacent panes with objects
+ lockPaneForFX(pane, true); // need to set left/top so animation will work
+ $P.show( o.fxName_open, o.fxSettings_open, o.fxSpeed_open, function() {
+ lockPaneForFX(pane, false); // undo
+ if (s.isVisible) open_2(); // continue
+ queueNext();
+ });
+ }
+ else { // no animation
+ _showPane(pane);// just show pane and...
+ open_2(); // continue
+ queueNext();
+ };
+ });
+
+ // SUBROUTINE
+ function open_2 () {
+ s.isMoving = false;
+
+ // cure iframe display issues
+ _fixIframe(pane);
+
+ // NOTE: if isSliding, then other panes are NOT 'resized'
+ if (!s.isSliding) { // resize all panes adjacent to this one
+ sizeMidPanes(_c[pane].dir=="vert" ? "center" : "", false); // false = NOT skipCallback
+ }
+
+ // set classes, position handles and execute callbacks...
+ setAsOpen(pane);
+ };
+
+ }
+
+ /**
+ * @param {string} pane The pane just opened, ie: north, south, east, or west
+ * @param {boolean=} [skipCallback=false]
+ */
+, setAsOpen = function (pane, skipCallback) {
+ var
+ $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , $T = $Ts[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , side = _c[pane].side
+ , rClass = o.resizerClass
+ , tClass = o.togglerClass
+ , _pane = "-"+ pane // used for classNames
+ , _open = "-open"
+ , _closed = "-closed"
+ , _sliding= "-sliding"
+ ;
+ $R
+ .css(side, sC.inset[side] + getPaneSize(pane)) // move the resizer
+ .removeClass( rClass+_closed +" "+ rClass+_pane+_closed )
+ .addClass( rClass+_open +" "+ rClass+_pane+_open )
+ ;
+ if (s.isSliding)
+ $R.addClass( rClass+_sliding +" "+ rClass+_pane+_sliding )
+ else // in case 'was sliding'
+ $R.removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding )
+
+ removeHover( 0, $R ); // remove hover classes
+ if (o.resizable && $.layout.plugins.draggable)
+ $R .draggable("enable")
+ .css("cursor", o.resizerCursor)
+ .attr("title", o.tips.Resize);
+ else if (!s.isSliding)
+ $R.css("cursor", "default"); // n-resize, s-resize, etc
+
+ // if pane also has a toggler button, adjust that too
+ if ($T) {
+ $T .removeClass( tClass+_closed +" "+ tClass+_pane+_closed )
+ .addClass( tClass+_open +" "+ tClass+_pane+_open )
+ .attr("title", o.tips.Close); // may be blank
+ removeHover( 0, $T ); // remove hover classes
+ // toggler-content - if exists
+ $T.children(".content-closed").hide();
+ $T.children(".content-open").css("display","block");
+ }
+
+ // sync any 'pin buttons'
+ syncPinBtns(pane, !s.isSliding);
+
+ // update pane-state dimensions - BEFORE resizing content
+ $.extend(s, elDims($P));
+
+ if (state.initialized) {
+ // resize resizer & toggler sizes for all panes
+ sizeHandles();
+ // resize content every time pane opens - to be sure
+ sizeContent(pane, true); // true = remeasure headers/footers, even if 'pane.isMoving'
+ }
+
+ if (!skipCallback && (state.initialized || o.triggerEventsOnLoad) && $P.is(":visible")) {
+ // onopen callback
+ _runCallbacks("onopen_end", pane);
+ // onshow callback - TODO: should this be here?
+ if (s.isShowing) _runCallbacks("onshow_end", pane);
+
+ // ALSO call onresize because layout-size *may* have changed while pane was closed
+ if (state.initialized)
+ _runCallbacks("onresize_end", pane);
+ }
+
+ // TODO: Somehow sizePane("north") is being called after this point???
+ }
+
+
+ /**
+ * slideOpen / slideClose / slideToggle
+ *
+ * Pass-though methods for sliding
+ */
+, slideOpen = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var evt = evtObj(evt_or_pane)
+ , pane = evtPane.call(this, evt_or_pane)
+ , s = state[pane]
+ , delay = options[pane].slideDelay_open
+ ;
+ if (pane === "center") return; // validate
+ // prevent event from triggering on NEW resizer binding created below
+ if (evt) evt.stopImmediatePropagation();
+
+ if (s.isClosed && evt && evt.type === "mouseenter" && delay > 0)
+ // trigger = mouseenter - use a delay
+ timer.set(pane+"_openSlider", open_NOW, delay);
+ else
+ open_NOW(); // will unbind events if is already open
+
+ /**
+ * SUBROUTINE for timed open
+ */
+ function open_NOW () {
+ if (!s.isClosed) // skip if no longer closed!
+ bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane
+ else if (!s.isMoving)
+ open(pane, true); // true = slide - open() will handle binding
+ };
+ }
+
+, slideClose = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var evt = evtObj(evt_or_pane)
+ , pane = evtPane.call(this, evt_or_pane)
+ , o = options[pane]
+ , s = state[pane]
+ , delay = s.isMoving ? 1000 : 300 // MINIMUM delay - option may override
+ ;
+ if (pane === "center") return; // validate
+ if (s.isClosed || s.isResizing)
+ return; // skip if already closed OR in process of resizing
+ else if (o.slideTrigger_close === "click")
+ close_NOW(); // close immediately onClick
+ else if (o.preventQuickSlideClose && s.isMoving)
+ return; // handle Chrome quick-close on slide-open
+ else if (o.preventPrematureSlideClose && evt && $.layout.isMouseOverElem(evt, $Ps[pane]))
+ return; // handle incorrect mouseleave trigger, like when over a SELECT-list in IE
+ else if (evt) // trigger = mouseleave - use a delay
+ // 1 sec delay if 'opening', else .3 sec
+ timer.set(pane+"_closeSlider", close_NOW, max(o.slideDelay_close, delay));
+ else // called programically
+ close_NOW();
+
+ /**
+ * SUBROUTINE for timed close
+ */
+ function close_NOW () {
+ if (s.isClosed) // skip 'close' if already closed!
+ bindStopSlidingEvents(pane, false); // UNBIND trigger events - TODO: is this needed here?
+ else if (!s.isMoving)
+ close(pane); // close will handle unbinding
+ };
+ }
+
+ /**
+ * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west
+ */
+, slideToggle = function (evt_or_pane) {
+ var pane = evtPane.call(this, evt_or_pane);
+ toggle(pane, true);
+ }
+
+
+ /**
+ * Must set left/top on East/South panes so animation will work properly
+ *
+ * @param {string} pane The pane to lock, 'east' or 'south' - any other is ignored!
+ * @param {boolean} doLock true = set left/top, false = remove
+ */
+, lockPaneForFX = function (pane, doLock) {
+ var $P = $Ps[pane]
+ , s = state[pane]
+ , o = options[pane]
+ , z = options.zIndexes
+ ;
+ if (doLock) {
+ showMasks( pane, { animation: true, objectsOnly: true });
+ $P.css({ zIndex: z.pane_animate }); // overlay all elements during animation
+ if (pane=="south")
+ $P.css({ top: sC.inset.top + sC.innerHeight - $P.outerHeight() });
+ else if (pane=="east")
+ $P.css({ left: sC.inset.left + sC.innerWidth - $P.outerWidth() });
+ }
+ else { // animation DONE - RESET CSS
+ hideMasks();
+ $P.css({ zIndex: (s.isSliding ? z.pane_sliding : z.pane_normal) });
+ if (pane=="south")
+ $P.css({ top: "auto" });
+ // if pane is positioned 'off-screen', then DO NOT screw with it!
+ else if (pane=="east" && !$P.css("left").match(/\-99999/))
+ $P.css({ left: "auto" });
+ // fix anti-aliasing in IE - only needed for animations that change opacity
+ if (browser.msie && o.fxOpacityFix && o.fxName_open != "slide" && $P.css("filter") && $P.css("opacity") == 1)
+ $P[0].style.removeAttribute('filter');
+ }
+ }
+
+
+ /**
+ * Toggle sliding functionality of a specific pane on/off by adding removing 'slide open' trigger
+ *
+ * @see open(), close()
+ * @param {string} pane The pane to enable/disable, 'north', 'south', etc.
+ * @param {boolean} enable Enable or Disable sliding?
+ */
+, bindStartSlidingEvents = function (pane, enable) {
+ var o = options[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , evtName = o.slideTrigger_open.toLowerCase()
+ ;
+ if (!$R || (enable && !o.slidable)) return;
+
+ // make sure we have a valid event
+ if (evtName.match(/mouseover/))
+ evtName = o.slideTrigger_open = "mouseenter";
+ else if (!evtName.match(/(click|dblclick|mouseenter)/))
+ evtName = o.slideTrigger_open = "click";
+
+ // must remove double-click-toggle when using dblclick-slide
+ if (o.resizerDblClickToggle && evtName.match(/click/)) {
+ $R[enable ? "unbind" : "bind"]('dblclick.'+ sID, toggle)
+ }
+
+ $R
+ // add or remove event
+ [enable ? "bind" : "unbind"](evtName +'.'+ sID, slideOpen)
+ // set the appropriate cursor & title/tip
+ .css("cursor", enable ? o.sliderCursor : "default")
+ .attr("title", enable ? o.tips.Slide : "")
+ ;
+ }
+
+ /**
+ * Add or remove 'mouseleave' events to 'slide close' when pane is 'sliding' open or closed
+ * Also increases zIndex when pane is sliding open
+ * See bindStartSlidingEvents for code to control 'slide open'
+ *
+ * @see slideOpen(), slideClose()
+ * @param {string} pane The pane to process, 'north', 'south', etc.
+ * @param {boolean} enable Enable or Disable events?
+ */
+, bindStopSlidingEvents = function (pane, enable) {
+ var o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , z = options.zIndexes
+ , evtName = o.slideTrigger_close.toLowerCase()
+ , action = (enable ? "bind" : "unbind")
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ ;
+ timer.clear(pane+"_closeSlider"); // just in case
+
+ if (enable) {
+ s.isSliding = true;
+ state.panesSliding[pane] = true;
+ // remove 'slideOpen' event from resizer
+ // ALSO will raise the zIndex of the pane & resizer
+ bindStartSlidingEvents(pane, false);
+ }
+ else {
+ s.isSliding = false;
+ delete state.panesSliding[pane];
+ }
+
+ // RE/SET zIndex - increases when pane is sliding-open, resets to normal when not
+ $P.css("zIndex", enable ? z.pane_sliding : z.pane_normal);
+ $R.css("zIndex", enable ? z.pane_sliding+2 : z.resizer_normal); // NOTE: mask = pane_sliding+1
+
+ // make sure we have a valid event
+ if (!evtName.match(/(click|mouseleave)/))
+ evtName = o.slideTrigger_close = "mouseleave"; // also catches 'mouseout'
+
+ // add/remove slide triggers
+ $R[action](evtName, slideClose); // base event on resize
+ // need extra events for mouseleave
+ if (evtName === "mouseleave") {
+ // also close on pane.mouseleave
+ $P[action]("mouseleave."+ sID, slideClose);
+ // cancel timer when mouse moves between 'pane' and 'resizer'
+ $R[action]("mouseenter."+ sID, cancelMouseOut);
+ $P[action]("mouseenter."+ sID, cancelMouseOut);
+ }
+
+ if (!enable)
+ timer.clear(pane+"_closeSlider");
+ else if (evtName === "click" && !o.resizable) {
+ // IF pane is not resizable (which already has a cursor and tip)
+ // then set the a cursor & title/tip on resizer when sliding
+ $R.css("cursor", enable ? o.sliderCursor : "default");
+ $R.attr("title", enable ? o.tips.Close : ""); // use Toggler-tip, eg: "Close Pane"
+ }
+
+ // SUBROUTINE for mouseleave timer clearing
+ function cancelMouseOut (evt) {
+ timer.clear(pane+"_closeSlider");
+ evt.stopPropagation();
+ }
+ }
+
+
+ /**
+ * Hides/closes a pane if there is insufficient room - reverses this when there is room again
+ * MUST have already called setSizeLimits() before calling this method
+ *
+ * @param {string} pane The pane being resized
+ * @param {boolean=} [isOpening=false] Called from onOpen?
+ * @param {boolean=} [skipCallback=false] Should the onresize callback be run?
+ * @param {boolean=} [force=false]
+ */
+, makePaneFit = function (pane, isOpening, skipCallback, force) {
+ var o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , isSidePane = c.dir==="vert"
+ , hasRoom = false
+ ;
+ // special handling for center & east/west panes
+ if (pane === "center" || (isSidePane && s.noVerticalRoom)) {
+ // see if there is enough room to display the pane
+ // ERROR: hasRoom = s.minHeight <= s.maxHeight && (isSidePane || s.minWidth <= s.maxWidth);
+ hasRoom = (s.maxHeight >= 0);
+ if (hasRoom && s.noRoom) { // previously hidden due to noRoom, so show now
+ _showPane(pane);
+ if ($R) $R.show();
+ s.isVisible = true;
+ s.noRoom = false;
+ if (isSidePane) s.noVerticalRoom = false;
+ _fixIframe(pane);
+ }
+ else if (!hasRoom && !s.noRoom) { // not currently hidden, so hide now
+ _hidePane(pane);
+ if ($R) $R.hide();
+ s.isVisible = false;
+ s.noRoom = true;
+ }
+ }
+
+ // see if there is enough room to fit the border-pane
+ if (pane === "center") {
+ // ignore center in this block
+ }
+ else if (s.minSize <= s.maxSize) { // pane CAN fit
+ hasRoom = true;
+ if (s.size > s.maxSize) // pane is too big - shrink it
+ sizePane(pane, s.maxSize, skipCallback, true, force); // true = noAnimation
+ else if (s.size < s.minSize) // pane is too small - enlarge it
+ sizePane(pane, s.minSize, skipCallback, true, force); // true = noAnimation
+ // need s.isVisible because new pseudoClose method keeps pane visible, but off-screen
+ else if ($R && s.isVisible && $P.is(":visible")) {
+ // make sure resizer-bar is positioned correctly
+ // handles situation where nested layout was 'hidden' when initialized
+ var pos = s.size + sC.inset[c.side];
+ if ($.layout.cssNum( $R, c.side ) != pos) $R.css( c.side, pos );
+ }
+
+ // if was previously hidden due to noRoom, then RESET because NOW there is room
+ if (s.noRoom) {
+ // s.noRoom state will be set by open or show
+ if (s.wasOpen && o.closable) {
+ if (o.autoReopen)
+ open(pane, false, true, true); // true = noAnimation, true = noAlert
+ else // leave the pane closed, so just update state
+ s.noRoom = false;
+ }
+ else
+ show(pane, s.wasOpen, true, true); // true = noAnimation, true = noAlert
+ }
+ }
+ else { // !hasRoom - pane CANNOT fit
+ if (!s.noRoom) { // pane not set as noRoom yet, so hide or close it now...
+ s.noRoom = true; // update state
+ s.wasOpen = !s.isClosed && !s.isSliding;
+ if (s.isClosed){} // SKIP
+ else if (o.closable) // 'close' if possible
+ close(pane, true, true); // true = force, true = noAnimation
+ else // 'hide' pane if cannot just be closed
+ hide(pane, true); // true = noAnimation
+ }
+ }
+ }
+
+
+ /**
+ * manualSizePane is an exposed flow-through method allowing extra code when pane is 'manually resized'
+ *
+ * @param {(string|Object)} evt_or_pane The pane being resized
+ * @param {number} size The *desired* new size for this pane - will be validated
+ * @param {boolean=} [skipCallback=false] Should the onresize callback be run?
+ * @param {boolean=} [noAnimation=false]
+ * @param {boolean=} [force=false] Force resizing even if does not seem necessary
+ */
+, manualSizePane = function (evt_or_pane, size, skipCallback, noAnimation, force) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , o = options[pane]
+ , s = state[pane]
+ // if resizing callbacks have been delayed and resizing is now DONE, force resizing to complete...
+ , forceResize = force || (o.livePaneResizing && !s.isResizing)
+ ;
+ if (pane === "center") return; // validate
+ // ANY call to manualSizePane disables autoResize - ie, percentage sizing
+ s.autoResize = false;
+ // flow-through...
+ sizePane(pane, size, skipCallback, noAnimation, forceResize); // will animate resize if option enabled
+ }
+
+ /**
+ * sizePane is called only by internal methods whenever a pane needs to be resized
+ *
+ * @param {(string|Object)} evt_or_pane The pane being resized
+ * @param {number} size The *desired* new size for this pane - will be validated
+ * @param {boolean=} [skipCallback=false] Should the onresize callback be run?
+ * @param {boolean=} [noAnimation=false]
+ * @param {boolean=} [force=false] Force resizing even if does not seem necessary
+ */
+, sizePane = function (evt_or_pane, size, skipCallback, noAnimation, force) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane) // probably NEVER called from event?
+ , o = options[pane]
+ , s = state[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , side = _c[pane].side
+ , dimName = _c[pane].sizeType.toLowerCase()
+ , skipResizeWhileDragging = s.isResizing && !o.triggerEventsDuringLiveResize
+ , doFX = noAnimation !== true && o.animatePaneSizing
+ , oldSize, newSize
+ ;
+ if (pane === "center") return; // validate
+ // QUEUE in case another action/animation is in progress
+ $N.queue(function( queueNext ){
+ // calculate 'current' min/max sizes
+ setSizeLimits(pane); // update pane-state
+ oldSize = s.size;
+ size = _parseSize(pane, size); // handle percentages & auto
+ size = max(size, _parseSize(pane, o.minSize));
+ size = min(size, s.maxSize);
+ if (size < s.minSize) { // not enough room for pane!
+ queueNext(); // call before makePaneFit() because it needs the queue free
+ makePaneFit(pane, false, skipCallback); // will hide or close pane
+ return;
+ }
+
+ // IF newSize is same as oldSize, then nothing to do - abort
+ if (!force && size === oldSize)
+ return queueNext();
+
+ s.newSize = size;
+
+ // onresize_start callback CANNOT cancel resizing because this would break the layout!
+ if (!skipCallback && state.initialized && s.isVisible)
+ _runCallbacks("onresize_start", pane);
+
+ // resize the pane, and make sure its visible
+ newSize = cssSize(pane, size);
+
+ if (doFX && $P.is(":visible")) { // ANIMATE
+ var fx = $.layout.effects.size[pane] || $.layout.effects.size.all
+ , easing = o.fxSettings_size.easing || fx.easing
+ , z = options.zIndexes
+ , props = {};
+ props[ dimName ] = newSize +'px';
+ s.isMoving = true;
+ // overlay all elements during animation
+ $P.css({ zIndex: z.pane_animate })
+ .show().animate( props, o.fxSpeed_size, easing, function(){
+ // reset zIndex after animation
+ $P.css({ zIndex: (s.isSliding ? z.pane_sliding : z.pane_normal) });
+ s.isMoving = false;
+ delete s.newSize;
+ sizePane_2(); // continue
+ queueNext();
+ });
+ }
+ else { // no animation
+ $P.css( dimName, newSize ); // resize pane
+ delete s.newSize;
+ // if pane is visible, then
+ if ($P.is(":visible"))
+ sizePane_2(); // continue
+ else {
+ // pane is NOT VISIBLE, so just update state data...
+ // when pane is *next opened*, it will have the new size
+ s.size = size; // update state.size
+ //$.extend(s, elDims($P)); // update state dimensions - CANNOT do this when not visible! }
+ }
+ queueNext();
+ };
+
+ });
+
+ // SUBROUTINE
+ function sizePane_2 () {
+ /* Panes are sometimes not sized precisely in some browsers!?
+ * This code will resize the pane up to 3 times to nudge the pane to the correct size
+ */
+ var actual = dimName==='width' ? $P.outerWidth() : $P.outerHeight()
+ , tries = [{
+ pane: pane
+ , count: 1
+ , target: size
+ , actual: actual
+ , correct: (size === actual)
+ , attempt: size
+ , cssSize: newSize
+ }]
+ , lastTry = tries[0]
+ , thisTry = {}
+ , msg = 'Inaccurate size after resizing the '+ pane +'-pane.'
+ ;
+ while ( !lastTry.correct ) {
+ thisTry = { pane: pane, count: lastTry.count+1, target: size };
+
+ if (lastTry.actual > size)
+ thisTry.attempt = max(0, lastTry.attempt - (lastTry.actual - size));
+ else // lastTry.actual < size
+ thisTry.attempt = max(0, lastTry.attempt + (size - lastTry.actual));
+
+ thisTry.cssSize = cssSize(pane, thisTry.attempt);
+ $P.css( dimName, thisTry.cssSize );
+
+ thisTry.actual = dimName=='width' ? $P.outerWidth() : $P.outerHeight();
+ thisTry.correct = (size === thisTry.actual);
+
+ // log attempts and alert the user of this *non-fatal error* (if showDebugMessages)
+ if ( tries.length === 1) {
+ _log(msg, false, true);
+ _log(lastTry, false, true);
+ }
+ _log(thisTry, false, true);
+ // after 4 tries, is as close as its gonna get!
+ if (tries.length > 3) break;
+
+ tries.push( thisTry );
+ lastTry = tries[ tries.length - 1 ];
+ }
+ // END TESTING CODE
+
+ // update pane-state dimensions
+ s.size = size;
+ $.extend(s, elDims($P));
+
+ if (s.isVisible && $P.is(":visible")) {
+ // reposition the resizer-bar
+ if ($R) $R.css( side, size + sC.inset[side] );
+ // resize the content-div
+ sizeContent(pane);
+ }
+
+ if (!skipCallback && !skipResizeWhileDragging && state.initialized && s.isVisible)
+ _runCallbacks("onresize_end", pane);
+
+ // resize all the adjacent panes, and adjust their toggler buttons
+ // when skipCallback passed, it means the controlling method will handle 'other panes'
+ if (!skipCallback) {
+ // also no callback if live-resize is in progress and NOT triggerEventsDuringLiveResize
+ if (!s.isSliding) sizeMidPanes(_c[pane].dir=="horz" ? "" : "center", skipResizeWhileDragging, force);
+ sizeHandles();
+ }
+
+ // if opposite-pane was autoClosed, see if it can be autoOpened now
+ var altPane = _c.oppositeEdge[pane];
+ if (size < oldSize && state[ altPane ].noRoom) {
+ setSizeLimits( altPane );
+ makePaneFit( altPane, false, skipCallback );
+ }
+
+ // DEBUG - ALERT user/developer so they know there was a sizing problem
+ if (tries.length > 1)
+ _log(msg +'\nSee the Error Console for details.', true, true);
+ }
+ }
+
+ /**
+ * @see initPanes(), sizePane(), resizeAll(), open(), close(), hide()
+ * @param {(Array.<string>|string)} panes The pane(s) being resized, comma-delmited string
+ * @param {boolean=} [skipCallback=false] Should the onresize callback be run?
+ * @param {boolean=} [force=false]
+ */
+, sizeMidPanes = function (panes, skipCallback, force) {
+ panes = (panes ? panes : "east,west,center").split(",");
+
+ $.each(panes, function (i, pane) {
+ if (!$Ps[pane]) return; // NO PANE - skip
+ var
+ o = options[pane]
+ , s = state[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , isCenter= (pane=="center")
+ , hasRoom = true
+ , CSS = {}
+ // if pane is not visible, show it invisibly NOW rather than for *each call* in this script
+ , visCSS = $.layout.showInvisibly($P)
+
+ , newCenter = calcNewCenterPaneDims()
+ ;
+
+ // update pane-state dimensions
+ $.extend(s, elDims($P));
+
+ if (pane === "center") {
+ if (!force && s.isVisible && newCenter.width === s.outerWidth && newCenter.height === s.outerHeight) {
+ $P.css(visCSS);
+ return true; // SKIP - pane already the correct size
+ }
+ // set state for makePaneFit() logic
+ $.extend(s, cssMinDims(pane), {
+ maxWidth: newCenter.width
+ , maxHeight: newCenter.height
+ });
+ CSS = newCenter;
+ s.newWidth = CSS.width;
+ s.newHeight = CSS.height;
+ // convert OUTER width/height to CSS width/height
+ CSS.width = cssW($P, CSS.width);
+ // NEW - allow pane to extend 'below' visible area rather than hide it
+ CSS.height = cssH($P, CSS.height);
+ hasRoom = CSS.width >= 0 && CSS.height >= 0; // height >= 0 = ALWAYS TRUE NOW
+
+ // during layout init, try to shrink east/west panes to make room for center
+ if (!state.initialized && o.minWidth > newCenter.width) {
+ var
+ reqPx = o.minWidth - s.outerWidth
+ , minE = options.east.minSize || 0
+ , minW = options.west.minSize || 0
+ , sizeE = state.east.size
+ , sizeW = state.west.size
+ , newE = sizeE
+ , newW = sizeW
+ ;
+ if (reqPx > 0 && state.east.isVisible && sizeE > minE) {
+ newE = max( sizeE-minE, sizeE-reqPx );
+ reqPx -= sizeE-newE;
+ }
+ if (reqPx > 0 && state.west.isVisible && sizeW > minW) {
+ newW = max( sizeW-minW, sizeW-reqPx );
+ reqPx -= sizeW-newW;
+ }
+ // IF we found enough extra space, then resize the border panes as calculated
+ if (reqPx === 0) {
+ if (sizeE && sizeE != minE)
+ sizePane('east', newE, true, true, force); // true = skipCallback/noAnimation - initPanes will handle when done
+ if (sizeW && sizeW != minW)
+ sizePane('west', newW, true, true, force); // true = skipCallback/noAnimation
+ // now start over!
+ sizeMidPanes('center', skipCallback, force);
+ $P.css(visCSS);
+ return; // abort this loop
+ }
+ }
+ }
+ else { // for east and west, set only the height, which is same as center height
+ // set state.min/maxWidth/Height for makePaneFit() logic
+ if (s.isVisible && !s.noVerticalRoom)
+ $.extend(s, elDims($P), cssMinDims(pane))
+ if (!force && !s.noVerticalRoom && newCenter.height === s.outerHeight) {
+ $P.css(visCSS);
+ return true; // SKIP - pane already the correct size
+ }
+ // east/west have same top, bottom & height as center
+ CSS.top = newCenter.top;
+ CSS.bottom = newCenter.bottom;
+ s.newSize = newCenter.height
+ // NEW - allow pane to extend 'below' visible area rather than hide it
+ CSS.height = cssH($P, newCenter.height);
+ s.maxHeight = CSS.height;
+ hasRoom = (s.maxHeight >= 0); // ALWAYS TRUE NOW
+ if (!hasRoom) s.noVerticalRoom = true; // makePaneFit() logic
+ }
+
+ if (hasRoom) {
+ // resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized
+ if (!skipCallback && state.initialized)
+ _runCallbacks("onresize_start", pane);
+
+ $P.css(CSS); // apply the CSS to pane
+ if (pane !== "center")
+ sizeHandles(pane); // also update resizer length
+ if (s.noRoom && !s.isClosed && !s.isHidden)
+ makePaneFit(pane); // will re-open/show auto-closed/hidden pane
+ if (s.isVisible) {
+ $.extend(s, elDims($P)); // update pane dimensions
+ if (state.initialized) sizeContent(pane); // also resize the contents, if exists
+ }
+ }
+ else if (!s.noRoom && s.isVisible) // no room for pane
+ makePaneFit(pane); // will hide or close pane
+
+ // reset visibility, if necessary
+ $P.css(visCSS);
+
+ delete s.newSize;
+ delete s.newWidth;
+ delete s.newHeight;
+
+ if (!s.isVisible)
+ return true; // DONE - next pane
+
+ /*
+ * Extra CSS for IE6 or IE7 in Quirks-mode - add 'width' to NORTH/SOUTH panes
+ * Normally these panes have only 'left' & 'right' positions so pane auto-sizes
+ * ALSO required when pane is an IFRAME because will NOT default to 'full width'
+ * TODO: Can I use width:100% for a north/south iframe?
+ * TODO: Sounds like a job for $P.outerWidth( sC.innerWidth ) SETTER METHOD
+ */
+ if (pane === "center") { // finished processing midPanes
+ var fix = browser.isIE6 || !browser.boxModel;
+ if ($Ps.north && (fix || state.north.tagName=="IFRAME"))
+ $Ps.north.css("width", cssW($Ps.north, sC.innerWidth));
+ if ($Ps.south && (fix || state.south.tagName=="IFRAME"))
+ $Ps.south.css("width", cssW($Ps.south, sC.innerWidth));
+ }
+
+ // resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized
+ if (!skipCallback && state.initialized)
+ _runCallbacks("onresize_end", pane);
+ });
+ }
+
+
+ /**
+ * @see window.onresize(), callbacks or custom code
+ * @param {(Object|boolean)=} evt_or_refresh If 'true', then also reset pane-positioning
+ */
+, resizeAll = function (evt_or_refresh) {
+ var oldW = sC.innerWidth
+ , oldH = sC.innerHeight
+ ;
+ // stopPropagation if called by trigger("layoutdestroy") - use evtPane utility
+ evtPane(evt_or_refresh);
+
+ // cannot size layout when 'container' is hidden or collapsed
+ if (!$N.is(":visible")) return;
+
+ if (!state.initialized) {
+ _initLayoutElements();
+ return; // no need to resize since we just initialized!
+ }
+
+ if (evt_or_refresh === true && $.isPlainObject(options.outset)) {
+ // update container CSS in case outset option has changed
+ $N.css( options.outset );
+ }
+ // UPDATE container dimensions
+ $.extend(sC, elDims( $N, options.inset ));
+ if (!sC.outerHeight) return;
+
+ // if 'true' passed, refresh pane & handle positioning too
+ if (evt_or_refresh === true) {
+ setPanePosition();
+ }
+
+ // onresizeall_start will CANCEL resizing if returns false
+ // state.container has already been set, so user can access this info for calcuations
+ if (false === _runCallbacks("onresizeall_start")) return false;
+
+ var // see if container is now 'smaller' than before
+ shrunkH = (sC.innerHeight < oldH)
+ , shrunkW = (sC.innerWidth < oldW)
+ , $P, o, s
+ ;
+ // NOTE special order for sizing: S-N-E-W
+ $.each(["south","north","east","west"], function (i, pane) {
+ if (!$Ps[pane]) return; // no pane - SKIP
+ o = options[pane];
+ s = state[pane];
+ if (s.autoResize && s.size != o.size) // resize pane to original size set in options
+ sizePane(pane, o.size, true, true, true); // true=skipCallback/noAnimation/forceResize
+ else {
+ setSizeLimits(pane);
+ makePaneFit(pane, false, true, true); // true=skipCallback/forceResize
+ }
+ });
+
+ sizeMidPanes("", true, true); // true=skipCallback/forceResize
+ sizeHandles(); // reposition the toggler elements
+
+ // trigger all individual pane callbacks AFTER layout has finished resizing
+ $.each(_c.allPanes, function (i, pane) {
+ $P = $Ps[pane];
+ if (!$P) return; // SKIP
+ if (state[pane].isVisible) // undefined for non-existent panes
+ _runCallbacks("onresize_end", pane); // callback - if exists
+ });
+
+ _runCallbacks("onresizeall_end");
+ //_triggerLayoutEvent(pane, 'resizeall');
+ }
+
+ /**
+ * Whenever a pane resizes or opens that has a nested layout, trigger resizeAll
+ *
+ * @param {(string|Object)} evt_or_pane The pane just resized or opened
+ */
+, resizeChildren = function (evt_or_pane, skipRefresh) {
+ var pane = evtPane.call(this, evt_or_pane);
+
+ if (!options[pane].resizeChildren) return;
+
+ // ensure the pane-children are up-to-date
+ if (!skipRefresh) refreshChildren( pane );
+ var pC = children[pane];
+ if ($.isPlainObject( pC )) {
+ // resize one or more children
+ $.each( pC, function (key, child) {
+ if (!child.destroyed) child.resizeAll();
+ });
+ }
+ }
+
+ /**
+ * IF pane has a content-div, then resize all elements inside pane to fit pane-height
+ *
+ * @param {(string|Object)} evt_or_panes The pane(s) being resized
+ * @param {boolean=} [remeasure=false] Should the content (header/footer) be remeasured?
+ */
+, sizeContent = function (evt_or_panes, remeasure) {
+ if (!isInitialized()) return;
+
+ var panes = evtPane.call(this, evt_or_panes);
+ panes = panes ? panes.split(",") : _c.allPanes;
+
+ $.each(panes, function (idx, pane) {
+ var
+ $P = $Ps[pane]
+ , $C = $Cs[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , m = s.content // m = measurements
+ ;
+ if (!$P || !$C || !$P.is(":visible")) return true; // NOT VISIBLE - skip
+
+ // if content-element was REMOVED, update OR remove the pointer
+ if (!$C.length) {
+ initContent(pane, false); // false = do NOT sizeContent() - already there!
+ if (!$C) return; // no replacement element found - pointer have been removed
+ }
+
+ // onsizecontent_start will CANCEL resizing if returns false
+ if (false === _runCallbacks("onsizecontent_start", pane)) return;
+
+ // skip re-measuring offsets if live-resizing
+ if ((!s.isMoving && !s.isResizing) || o.liveContentResizing || remeasure || m.top == undefined) {
+ _measure();
+ // if any footers are below pane-bottom, they may not measure correctly,
+ // so allow pane overflow and re-measure
+ if (m.hiddenFooters > 0 && $P.css("overflow") === "hidden") {
+ $P.css("overflow", "visible");
+ _measure(); // remeasure while overflowing
+ $P.css("overflow", "hidden");
+ }
+ }
+ // NOTE: spaceAbove/Below *includes* the pane paddingTop/Bottom, but not pane.borders
+ var newH = s.innerHeight - (m.spaceAbove - s.css.paddingTop) - (m.spaceBelow - s.css.paddingBottom);
+
+ if (!$C.is(":visible") || m.height != newH) {
+ // size the Content element to fit new pane-size - will autoHide if not enough room
+ setOuterHeight($C, newH, true); // true=autoHide
+ m.height = newH; // save new height
+ };
+
+ if (state.initialized)
+ _runCallbacks("onsizecontent_end", pane);
+
+ function _below ($E) {
+ return max(s.css.paddingBottom, (parseInt($E.css("marginBottom"), 10) || 0));
+ };
+
+ function _measure () {
+ var
+ ignore = options[pane].contentIgnoreSelector
+ , $Fs = $C.nextAll().not(".ui-layout-mask").not(ignore || ":lt(0)") // not :lt(0) = ALL
+ , $Fs_vis = $Fs.filter(':visible')
+ , $F = $Fs_vis.filter(':last')
+ ;
+ m = {
+ top: $C[0].offsetTop
+ , height: $C.outerHeight()
+ , numFooters: $Fs.length
+ , hiddenFooters: $Fs.length - $Fs_vis.length
+ , spaceBelow: 0 // correct if no content footer ($E)
+ }
+ m.spaceAbove = m.top; // just for state - not used in calc
+ m.bottom = m.top + m.height;
+ if ($F.length)
+ //spaceBelow = (LastFooter.top + LastFooter.height) [footerBottom] - Content.bottom + max(LastFooter.marginBottom, pane.paddingBotom)
+ m.spaceBelow = ($F[0].offsetTop + $F.outerHeight()) - m.bottom + _below($F);
+ else // no footer - check marginBottom on Content element itself
+ m.spaceBelow = _below($C);
+ };
+ });
+ }
+
+
+ /**
+ * Called every time a pane is opened, closed, or resized to slide the togglers to 'center' and adjust their length if necessary
+ *
+ * @see initHandles(), open(), close(), resizeAll()
+ * @param {(string|Object)=} evt_or_panes The pane(s) being resized
+ */
+, sizeHandles = function (evt_or_panes) {
+ var panes = evtPane.call(this, evt_or_panes)
+ panes = panes ? panes.split(",") : _c.borderPanes;
+
+ $.each(panes, function (i, pane) {
+ var
+ o = options[pane]
+ , s = state[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , $T = $Ts[pane]
+ , $TC
+ ;
+ if (!$P || !$R) return;
+
+ var
+ dir = _c[pane].dir
+ , _state = (s.isClosed ? "_closed" : "_open")
+ , spacing = o["spacing"+ _state]
+ , togAlign = o["togglerAlign"+ _state]
+ , togLen = o["togglerLength"+ _state]
+ , paneLen
+ , left
+ , offset
+ , CSS = {}
+ ;
+
+ if (spacing === 0) {
+ $R.hide();
+ return;
+ }
+ else if (!s.noRoom && !s.isHidden) // skip if resizer was hidden for any reason
+ $R.show(); // in case was previously hidden
+
+ // Resizer Bar is ALWAYS same width/height of pane it is attached to
+ if (dir === "horz") { // north/south
+ //paneLen = $P.outerWidth(); // s.outerWidth ||
+ paneLen = sC.innerWidth; // handle offscreen-panes
+ s.resizerLength = paneLen;
+ left = $.layout.cssNum($P, "left")
+ $R.css({
+ width: cssW($R, paneLen) // account for borders & padding
+ , height: cssH($R, spacing) // ditto
+ , left: left > -9999 ? left : sC.inset.left // handle offscreen-panes
+ });
+ }
+ else { // east/west
+ paneLen = $P.outerHeight(); // s.outerHeight ||
+ s.resizerLength = paneLen;
+ $R.css({
+ height: cssH($R, paneLen) // account for borders & padding
+ , width: cssW($R, spacing) // ditto
+ , top: sC.inset.top + getPaneSize("north", true) // TODO: what if no North pane?
+ //, top: $.layout.cssNum($Ps["center"], "top")
+ });
+ }
+
+ // remove hover classes
+ removeHover( o, $R );
+
+ if ($T) {
+ if (togLen === 0 || (s.isSliding && o.hideTogglerOnSlide)) {
+ $T.hide(); // always HIDE the toggler when 'sliding'
+ return;
+ }
+ else
+ $T.show(); // in case was previously hidden
+
+ if (!(togLen > 0) || togLen === "100%" || togLen > paneLen) {
+ togLen = paneLen;
+ offset = 0;
+ }
+ else { // calculate 'offset' based on options.PANE.togglerAlign_open/closed
+ if (isStr(togAlign)) {
+ switch (togAlign) {
+ case "top":
+ case "left": offset = 0;
+ break;
+ case "bottom":
+ case "right": offset = paneLen - togLen;
+ break;
+ case "middle":
+ case "center":
+ default: offset = round((paneLen - togLen) / 2); // 'default' catches typos
+ }
+ }
+ else { // togAlign = number
+ var x = parseInt(togAlign, 10); //
+ if (togAlign >= 0) offset = x;
+ else offset = paneLen - togLen + x; // NOTE: x is negative!
+ }
+ }
+
+ if (dir === "horz") { // north/south
+ var width = cssW($T, togLen);
+ $T.css({
+ width: width // account for borders & padding
+ , height: cssH($T, spacing) // ditto
+ , left: offset // TODO: VERIFY that toggler positions correctly for ALL values
+ , top: 0
+ });
+ // CENTER the toggler content SPAN
+ $T.children(".content").each(function(){
+ $TC = $(this);
+ $TC.css("marginLeft", round((width-$TC.outerWidth())/2)); // could be negative
+ });
+ }
+ else { // east/west
+ var height = cssH($T, togLen);
+ $T.css({
+ height: height // account for borders & padding
+ , width: cssW($T, spacing) // ditto
+ , top: offset // POSITION the toggler
+ , left: 0
+ });
+ // CENTER the toggler content SPAN
+ $T.children(".content").each(function(){
+ $TC = $(this);
+ $TC.css("marginTop", round((height-$TC.outerHeight())/2)); // could be negative
+ });
+ }
+
+ // remove ALL hover classes
+ removeHover( 0, $T );
+ }
+
+ // DONE measuring and sizing this resizer/toggler, so can be 'hidden' now
+ if (!state.initialized && (o.initHidden || s.isHidden)) {
+ $R.hide();
+ if ($T) $T.hide();
+ }
+ });
+ }
+
+
+ /**
+ * @param {(string|Object)} evt_or_pane
+ */
+, enableClosable = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $T = $Ts[pane]
+ , o = options[pane]
+ ;
+ if (!$T) return;
+ o.closable = true;
+ $T .bind("click."+ sID, function(evt){ evt.stopPropagation(); toggle(pane); })
+ .css("visibility", "visible")
+ .css("cursor", "pointer")
+ .attr("title", state[pane].isClosed ? o.tips.Open : o.tips.Close) // may be blank
+ .show();
+ }
+ /**
+ * @param {(string|Object)} evt_or_pane
+ * @param {boolean=} [hide=false]
+ */
+, disableClosable = function (evt_or_pane, hide) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $T = $Ts[pane]
+ ;
+ if (!$T) return;
+ options[pane].closable = false;
+ // is closable is disable, then pane MUST be open!
+ if (state[pane].isClosed) open(pane, false, true);
+ $T .unbind("."+ sID)
+ .css("visibility", hide ? "hidden" : "visible") // instead of hide(), which creates logic issues
+ .css("cursor", "default")
+ .attr("title", "");
+ }
+
+
+ /**
+ * @param {(string|Object)} evt_or_pane
+ */
+, enableSlidable = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $R = $Rs[pane]
+ ;
+ if (!$R || !$R.data('draggable')) return;
+ options[pane].slidable = true;
+ if (state[pane].isClosed)
+ bindStartSlidingEvents(pane, true);
+ }
+ /**
+ * @param {(string|Object)} evt_or_pane
+ */
+, disableSlidable = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $R = $Rs[pane]
+ ;
+ if (!$R) return;
+ options[pane].slidable = false;
+ if (state[pane].isSliding)
+ close(pane, false, true);
+ else {
+ bindStartSlidingEvents(pane, false);
+ $R .css("cursor", "default")
+ .attr("title", "");
+ removeHover(null, $R[0]); // in case currently hovered
+ }
+ }
+
+
+ /**
+ * @param {(string|Object)} evt_or_pane
+ */
+, enableResizable = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $R = $Rs[pane]
+ , o = options[pane]
+ ;
+ if (!$R || !$R.data('draggable')) return;
+ o.resizable = true;
+ $R.draggable("enable");
+ if (!state[pane].isClosed)
+ $R .css("cursor", o.resizerCursor)
+ .attr("title", o.tips.Resize);
+ }
+ /**
+ * @param {(string|Object)} evt_or_pane
+ */
+, disableResizable = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $R = $Rs[pane]
+ ;
+ if (!$R || !$R.data('draggable')) return;
+ options[pane].resizable = false;
+ $R .draggable("disable")
+ .css("cursor", "default")
+ .attr("title", "");
+ removeHover(null, $R[0]); // in case currently hovered
+ }
+
+
+ /**
+ * Move a pane from source-side (eg, west) to target-side (eg, east)
+ * If pane exists on target-side, move that to source-side, ie, 'swap' the panes
+ *
+ * @param {(string|Object)} evt_or_pane1 The pane/edge being swapped
+ * @param {string} pane2 ditto
+ */
+, swapPanes = function (evt_or_pane1, pane2) {
+ if (!isInitialized()) return;
+ var pane1 = evtPane.call(this, evt_or_pane1);
+ // change state.edge NOW so callbacks can know where pane is headed...
+ state[pane1].edge = pane2;
+ state[pane2].edge = pane1;
+ // run these even if NOT state.initialized
+ if (false === _runCallbacks("onswap_start", pane1)
+ || false === _runCallbacks("onswap_start", pane2)
+ ) {
+ state[pane1].edge = pane1; // reset
+ state[pane2].edge = pane2;
+ return;
+ }
+
+ var
+ oPane1 = copy( pane1 )
+ , oPane2 = copy( pane2 )
+ , sizes = {}
+ ;
+ sizes[pane1] = oPane1 ? oPane1.state.size : 0;
+ sizes[pane2] = oPane2 ? oPane2.state.size : 0;
+
+ // clear pointers & state
+ $Ps[pane1] = false;
+ $Ps[pane2] = false;
+ state[pane1] = {};
+ state[pane2] = {};
+
+ // ALWAYS remove the resizer & toggler elements
+ if ($Ts[pane1]) $Ts[pane1].remove();
+ if ($Ts[pane2]) $Ts[pane2].remove();
+ if ($Rs[pane1]) $Rs[pane1].remove();
+ if ($Rs[pane2]) $Rs[pane2].remove();
+ $Rs[pane1] = $Rs[pane2] = $Ts[pane1] = $Ts[pane2] = false;
+
+ // transfer element pointers and data to NEW Layout keys
+ move( oPane1, pane2 );
+ move( oPane2, pane1 );
+
+ // cleanup objects
+ oPane1 = oPane2 = sizes = null;
+
+ // make panes 'visible' again
+ if ($Ps[pane1]) $Ps[pane1].css(_c.visible);
+ if ($Ps[pane2]) $Ps[pane2].css(_c.visible);
+
+ // fix any size discrepancies caused by swap
+ resizeAll();
+
+ // run these even if NOT state.initialized
+ _runCallbacks("onswap_end", pane1);
+ _runCallbacks("onswap_end", pane2);
+
+ return;
+
+ function copy (n) { // n = pane
+ var
+ $P = $Ps[n]
+ , $C = $Cs[n]
+ ;
+ return !$P ? false : {
+ pane: n
+ , P: $P ? $P[0] : false
+ , C: $C ? $C[0] : false
+ , state: $.extend(true, {}, state[n])
+ , options: $.extend(true, {}, options[n])
+ }
+ };
+
+ function move (oPane, pane) {
+ if (!oPane) return;
+ var
+ P = oPane.P
+ , C = oPane.C
+ , oldPane = oPane.pane
+ , c = _c[pane]
+ // save pane-options that should be retained
+ , s = $.extend(true, {}, state[pane])
+ , o = options[pane]
+ // RETAIN side-specific FX Settings - more below
+ , fx = { resizerCursor: o.resizerCursor }
+ , re, size, pos
+ ;
+ $.each("fxName,fxSpeed,fxSettings".split(","), function (i, k) {
+ fx[k +"_open"] = o[k +"_open"];
+ fx[k +"_close"] = o[k +"_close"];
+ fx[k +"_size"] = o[k +"_size"];
+ });
+
+ // update object pointers and attributes
+ $Ps[pane] = $(P)
+ .data({
+ layoutPane: Instance[pane] // NEW pointer to pane-alias-object
+ , layoutEdge: pane
+ })
+ .css(_c.hidden)
+ .css(c.cssReq)
+ ;
+ $Cs[pane] = C ? $(C) : false;
+
+ // set options and state
+ options[pane] = $.extend(true, {}, oPane.options, fx);
+ state[pane] = $.extend(true, {}, oPane.state);
+
+ // change classNames on the pane, eg: ui-layout-pane-east ==> ui-layout-pane-west
+ re = new RegExp(o.paneClass +"-"+ oldPane, "g");
+ P.className = P.className.replace(re, o.paneClass +"-"+ pane);
+
+ // ALWAYS regenerate the resizer & toggler elements
+ initHandles(pane); // create the required resizer & toggler
+
+ // if moving to different orientation, then keep 'target' pane size
+ if (c.dir != _c[oldPane].dir) {
+ size = sizes[pane] || 0;
+ setSizeLimits(pane); // update pane-state
+ size = max(size, state[pane].minSize);
+ // use manualSizePane to disable autoResize - not useful after panes are swapped
+ manualSizePane(pane, size, true, true); // true/true = skipCallback/noAnimation
+ }
+ else // move the resizer here
+ $Rs[pane].css(c.side, sC.inset[c.side] + (state[pane].isVisible ? getPaneSize(pane) : 0));
+
+
+ // ADD CLASSNAMES & SLIDE-BINDINGS
+ if (oPane.state.isVisible && !s.isVisible)
+ setAsOpen(pane, true); // true = skipCallback
+ else {
+ setAsClosed(pane);
+ bindStartSlidingEvents(pane, true); // will enable events IF option is set
+ }
+
+ // DESTROY the object
+ oPane = null;
+ };
+ }
+
+
+ /**
+ * INTERNAL method to sync pin-buttons when pane is opened or closed
+ * Unpinned means the pane is 'sliding' - ie, over-top of the adjacent panes
+ *
+ * @see open(), setAsOpen(), setAsClosed()
+ * @param {string} pane These are the params returned to callbacks by layout()
+ * @param {boolean} doPin True means set the pin 'down', False means 'up'
+ */
+, syncPinBtns = function (pane, doPin) {
+ if ($.layout.plugins.buttons)
+ $.each(state[pane].pins, function (i, selector) {
+ $.layout.buttons.setPinState(Instance, $(selector), pane, doPin);
+ });
+ }
+
+; // END var DECLARATIONS
+
+ /**
+ * Capture keys when enableCursorHotkey - toggle pane if hotkey pressed
+ *
+ * @see document.keydown()
+ */
+ function keyDown (evt) {
+ if (!evt) return true;
+ var code = evt.keyCode;
+ if (code < 33) return true; // ignore special keys: ENTER, TAB, etc
+
+ var
+ PANE = {
+ 38: "north" // Up Cursor - $.ui.keyCode.UP
+ , 40: "south" // Down Cursor - $.ui.keyCode.DOWN
+ , 37: "west" // Left Cursor - $.ui.keyCode.LEFT
+ , 39: "east" // Right Cursor - $.ui.keyCode.RIGHT
+ }
+ , ALT = evt.altKey // no worky!
+ , SHIFT = evt.shiftKey
+ , CTRL = evt.ctrlKey
+ , CURSOR = (CTRL && code >= 37 && code <= 40)
+ , o, k, m, pane
+ ;
+
+ if (CURSOR && options[PANE[code]].enableCursorHotkey) // valid cursor-hotkey
+ pane = PANE[code];
+ else if (CTRL || SHIFT) // check to see if this matches a custom-hotkey
+ $.each(_c.borderPanes, function (i, p) { // loop each pane to check its hotkey
+ o = options[p];
+ k = o.customHotkey;
+ m = o.customHotkeyModifier; // if missing or invalid, treated as "CTRL+SHIFT"
+ if ((SHIFT && m=="SHIFT") || (CTRL && m=="CTRL") || (CTRL && SHIFT)) { // Modifier matches
+ if (k && code === (isNaN(k) || k <= 9 ? k.toUpperCase().charCodeAt(0) : k)) { // Key matches
+ pane = p;
+ return false; // BREAK
+ }
+ }
+ });
+
+ // validate pane
+ if (!pane || !$Ps[pane] || !options[pane].closable || state[pane].isHidden)
+ return true;
+
+ toggle(pane);
+
+ evt.stopPropagation();
+ evt.returnValue = false; // CANCEL key
+ return false;
+ };
+
+
+/*
+ * ######################################
+ * UTILITY METHODS
+ * called externally or by initButtons
+ * ######################################
+ */
+
+ /**
+ * Change/reset a pane overflow setting & zIndex to allow popups/drop-downs to work
+ *
+ * @param {Object=} [el] (optional) Can also be 'bound' to a click, mouseOver, or other event
+ */
+ function allowOverflow (el) {
+ if (!isInitialized()) return;
+ if (this && this.tagName) el = this; // BOUND to element
+ var $P;
+ if (isStr(el))
+ $P = $Ps[el];
+ else if ($(el).data("layoutRole"))
+ $P = $(el);
+ else
+ $(el).parents().each(function(){
+ if ($(this).data("layoutRole")) {
+ $P = $(this);
+ return false; // BREAK
+ }
+ });
+ if (!$P || !$P.length) return; // INVALID
+
+ var
+ pane = $P.data("layoutEdge")
+ , s = state[pane]
+ ;
+
+ // if pane is already raised, then reset it before doing it again!
+ // this would happen if allowOverflow is attached to BOTH the pane and an element
+ if (s.cssSaved)
+ resetOverflow(pane); // reset previous CSS before continuing
+
+ // if pane is raised by sliding or resizing, or its closed, then abort
+ if (s.isSliding || s.isResizing || s.isClosed) {
+ s.cssSaved = false;
+ return;
+ }
+
+ var
+ newCSS = { zIndex: (options.zIndexes.resizer_normal + 1) }
+ , curCSS = {}
+ , of = $P.css("overflow")
+ , ofX = $P.css("overflowX")
+ , ofY = $P.css("overflowY")
+ ;
+ // determine which, if any, overflow settings need to be changed
+ if (of != "visible") {
+ curCSS.overflow = of;
+ newCSS.overflow = "visible";
+ }
+ if (ofX && !ofX.match(/(visible|auto)/)) {
+ curCSS.overflowX = ofX;
+ newCSS.overflowX = "visible";
+ }
+ if (ofY && !ofY.match(/(visible|auto)/)) {
+ curCSS.overflowY = ofX;
+ newCSS.overflowY = "visible";
+ }
+
+ // save the current overflow settings - even if blank!
+ s.cssSaved = curCSS;
+
+ // apply new CSS to raise zIndex and, if necessary, make overflow 'visible'
+ $P.css( newCSS );
+
+ // make sure the zIndex of all other panes is normal
+ $.each(_c.allPanes, function(i, p) {
+ if (p != pane) resetOverflow(p);
+ });
+
+ };
+ /**
+ * @param {Object=} [el] (optional) Can also be 'bound' to a click, mouseOver, or other event
+ */
+ function resetOverflow (el) {
+ if (!isInitialized()) return;
+ if (this && this.tagName) el = this; // BOUND to element
+ var $P;
+ if (isStr(el))
+ $P = $Ps[el];
+ else if ($(el).data("layoutRole"))
+ $P = $(el);
+ else
+ $(el).parents().each(function(){
+ if ($(this).data("layoutRole")) {
+ $P = $(this);
+ return false; // BREAK
+ }
+ });
+ if (!$P || !$P.length) return; // INVALID
+
+ var
+ pane = $P.data("layoutEdge")
+ , s = state[pane]
+ , CSS = s.cssSaved || {}
+ ;
+ // reset the zIndex
+ if (!s.isSliding && !s.isResizing)
+ $P.css("zIndex", options.zIndexes.pane_normal);
+
+ // reset Overflow - if necessary
+ $P.css( CSS );
+
+ // clear var
+ s.cssSaved = false;
+ };
+
+/*
+ * #####################
+ * CREATE/RETURN LAYOUT
+ * #####################
+ */
+
+ // validate that container exists
+ var $N = $(this).eq(0); // FIRST matching Container element
+ if (!$N.length) {
+ return _log( options.errors.containerMissing );
+ };
+
+ // Users retrieve Instance of a layout with: $N.layout() OR $N.data("layout")
+ // return the Instance-pointer if layout has already been initialized
+ if ($N.data("layoutContainer") && $N.data("layout"))
+ return $N.data("layout"); // cached pointer
+
+ // init global vars
+ var
+ $Ps = {} // Panes x5 - set in initPanes()
+ , $Cs = {} // Content x5 - set in initPanes()
+ , $Rs = {} // Resizers x4 - set in initHandles()
+ , $Ts = {} // Togglers x4 - set in initHandles()
+ , $Ms = $([]) // Masks - up to 2 masks per pane (IFRAME + DIV)
+ // aliases for code brevity
+ , sC = state.container // alias for easy access to 'container dimensions'
+ , sID = state.id // alias for unique layout ID/namespace - eg: "layout435"
+ ;
+
+ // create Instance object to expose data & option Properties, and primary action Methods
+ var Instance = {
+ // layout data
+ options: options // property - options hash
+ , state: state // property - dimensions hash
+ // object pointers
+ , container: $N // property - object pointers for layout container
+ , panes: $Ps // property - object pointers for ALL Panes: panes.north, panes.center
+ , contents: $Cs // property - object pointers for ALL Content: contents.north, contents.center
+ , resizers: $Rs // property - object pointers for ALL Resizers, eg: resizers.north
+ , togglers: $Ts // property - object pointers for ALL Togglers, eg: togglers.north
+ // border-pane open/close
+ , hide: hide // method - ditto
+ , show: show // method - ditto
+ , toggle: toggle // method - pass a 'pane' ("north", "west", etc)
+ , open: open // method - ditto
+ , close: close // method - ditto
+ , slideOpen: slideOpen // method - ditto
+ , slideClose: slideClose // method - ditto
+ , slideToggle: slideToggle // method - ditto
+ // pane actions
+ , setSizeLimits: setSizeLimits // method - pass a 'pane' - update state min/max data
+ , _sizePane: sizePane // method -intended for user by plugins only!
+ , sizePane: manualSizePane // method - pass a 'pane' AND an 'outer-size' in pixels or percent, or 'auto'
+ , sizeContent: sizeContent // method - pass a 'pane'
+ , swapPanes: swapPanes // method - pass TWO 'panes' - will swap them
+ , showMasks: showMasks // method - pass a 'pane' OR list of panes - default = all panes with mask option set
+ , hideMasks: hideMasks // method - ditto'
+ // pane element methods
+ , initContent: initContent // method - ditto
+ , addPane: addPane // method - pass a 'pane'
+ , removePane: removePane // method - pass a 'pane' to remove from layout, add 'true' to delete the pane-elem
+ , createChildren: createChildren // method - pass a 'pane' and (optional) layout-options (OVERRIDES options[pane].children
+ , refreshChildren: refreshChildren // method - pass a 'pane' and a layout-instance
+ // special pane option setting
+ , enableClosable: enableClosable // method - pass a 'pane'
+ , disableClosable: disableClosable // method - ditto
+ , enableSlidable: enableSlidable // method - ditto
+ , disableSlidable: disableSlidable // method - ditto
+ , enableResizable: enableResizable // method - ditto
+ , disableResizable: disableResizable// method - ditto
+ // utility methods for panes
+ , allowOverflow: allowOverflow // utility - pass calling element (this)
+ , resetOverflow: resetOverflow // utility - ditto
+ // layout control
+ , destroy: destroy // method - no parameters
+ , initPanes: isInitialized // method - no parameters
+ , resizeAll: resizeAll // method - no parameters
+ // callback triggering
+ , runCallbacks: _runCallbacks // method - pass evtName & pane (if a pane-event), eg: trigger("onopen", "west")
+ // alias collections of options, state and children - created in addPane and extended elsewhere
+ , hasParentLayout: false // set by initContainer()
+ , children: children // pointers to child-layouts, eg: Instance.children.west.layoutName
+ , north: false // alias group: { name: pane, pane: $Ps[pane], options: options[pane], state: state[pane], children: children[pane] }
+ , south: false // ditto
+ , west: false // ditto
+ , east: false // ditto
+ , center: false // ditto
+ };
+
+ // create the border layout NOW
+ if (_create() === 'cancel') // onload_start callback returned false to CANCEL layout creation
+ return null;
+ else // true OR false -- if layout-elements did NOT init (hidden or do not exist), can auto-init later
+ return Instance; // return the Instance object
+
+}
+
+
+})( jQuery );
+
+
+
+
+/**
+ * jquery.layout.state 1.2
+ * $Date: 2015/03/13 22:37:04 $
+ *
+ * Copyright (c) 2014
+ * Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * @requires: UI Layout 1.4.0 or higher
+ * @requires: $.ui.cookie (above)
+ *
+ * @see: http://groups.google.com/group/jquery-ui-layout
+ */
+;(function ($) {
+
+if (!$.layout) return;
+
+
+/**
+ * UI COOKIE UTILITY
+ *
+ * A $.cookie OR $.ui.cookie namespace *should be standard*, but until then...
+ * This creates $.ui.cookie so Layout does not need the cookie.jquery.js plugin
+ * NOTE: This utility is REQUIRED by the layout.state plugin
+ *
+ * Cookie methods in Layout are created as part of State Management
+ */
+if (!$.ui) $.ui = {};
+$.ui.cookie = {
+
+ // cookieEnabled is not in DOM specs, but DOES works in all browsers,including IE6
+ acceptsCookies: !!navigator.cookieEnabled
+
+, read: function (name) {
+ var
+ c = document.cookie
+ , cs = c ? c.split(';') : []
+ , pair, data, i
+ ;
+ for (i=0; pair=cs[i]; i++) {
+ data = $.trim(pair).split('='); // name=value => [ name, value ]
+ if (data[0] == name) // found the layout cookie
+ return decodeURIComponent(data[1]);
+ }
+ return null;
+ }
+
+, write: function (name, val, cookieOpts) {
+ var params = ""
+ , date = ""
+ , clear = false
+ , o = cookieOpts || {}
+ , x = o.expires || null
+ , t = $.type(x)
+ ;
+ if (t === "date")
+ date = x;
+ else if (t === "string" && x > 0) {
+ x = parseInt(x,10);
+ t = "number";
+ }
+ if (t === "number") {
+ date = new Date();
+ if (x > 0)
+ date.setDate(date.getDate() + x);
+ else {
+ date.setFullYear(1970);
+ clear = true;
+ }
+ }
+ if (date) params += ";expires="+ date.toUTCString();
+ if (o.path) params += ";path="+ o.path;
+ if (o.domain) params += ";domain="+ o.domain;
+ if (o.secure) params += ";secure";
+ document.cookie = name +"="+ (clear ? "" : encodeURIComponent( val )) + params; // write or clear cookie
+ }
+
+, clear: function (name) {
+ $.ui.cookie.write(name, "", {expires: -1});
+ }
+
+};
+// if cookie.jquery.js is not loaded, create an alias to replicate it
+// this may be useful to other plugins or code dependent on that plugin
+if (!$.cookie) $.cookie = function (k, v, o) {
+ var C = $.ui.cookie;
+ if (v === null)
+ C.clear(k);
+ else if (v === undefined)
+ return C.read(k);
+ else
+ C.write(k, v, o);
+};
+
+
+
+/**
+ * State-management options stored in options.stateManagement, which includes a .cookie hash
+ * Default options saves ALL KEYS for ALL PANES, ie: pane.size, pane.isClosed, pane.isHidden
+ *
+ * // STATE/COOKIE OPTIONS
+ * @example $(el).layout({
+ stateManagement: {
+ enabled: true
+ , stateKeys: "east.size,west.size,east.isClosed,west.isClosed"
+ , cookie: { name: "appLayout", path: "/" }
+ }
+ })
+ * @example $(el).layout({ stateManagement__enabled: true }) // enable auto-state-management using cookies
+ * @example $(el).layout({ stateManagement__cookie: { name: "appLayout", path: "/" } })
+ * @example $(el).layout({ stateManagement__cookie__name: "appLayout", stateManagement__cookie__path: "/" })
+ *
+ * // STATE/COOKIE METHODS
+ * @example myLayout.saveCookie( "west.isClosed,north.size,south.isHidden", {expires: 7} );
+ * @example myLayout.loadCookie();
+ * @example myLayout.deleteCookie();
+ * @example var JSON = myLayout.readState(); // CURRENT Layout State
+ * @example var JSON = myLayout.readCookie(); // SAVED Layout State (from cookie)
+ * @example var JSON = myLayout.state.stateData; // LAST LOADED Layout State (cookie saved in layout.state hash)
+ *
+ * CUSTOM STATE-MANAGEMENT (eg, saved in a database)
+ * @example var JSON = myLayout.readState( "west.isClosed,north.size,south.isHidden" );
+ * @example myLayout.loadState( JSON );
+ */
+
+// tell Layout that the state plugin is available
+$.layout.plugins.stateManagement = true;
+
+// Add State-Management options to layout.defaults
+$.layout.defaults.stateManagement = {
+ enabled: false // true = enable state-management, even if not using cookies
+, autoSave: true // Save a state-cookie when page exits?
+, autoLoad: true // Load the state-cookie when Layout inits?
+, animateLoad: true // animate panes when loading state into an active layout
+, includeChildren: true // recurse into child layouts to include their state as well
+ // List state-data to save - must be pane-specific
+, stateKeys: "north.size,south.size,east.size,west.size,"+
+ "north.isClosed,south.isClosed,east.isClosed,west.isClosed,"+
+ "north.isHidden,south.isHidden,east.isHidden,west.isHidden"
+, cookie: {
+ name: "" // If not specified, will use Layout.name, else just "Layout"
+ , domain: "" // blank = current domain
+ , path: "" // blank = current page, "/" = entire website
+ , expires: "" // 'days' to keep cookie - leave blank for 'session cookie'
+ , secure: false
+ }
+};
+
+// Set stateManagement as a 'layout-option', NOT a 'pane-option'
+$.layout.optionsMap.layout.push("stateManagement");
+// Update config so layout does not move options into the pane-default branch (panes)
+$.layout.config.optionRootKeys.push("stateManagement");
+
+/*
+ * State Management methods
+ */
+$.layout.state = {
+
+ /**
+ * Get the current layout state and save it to a cookie
+ *
+ * myLayout.saveCookie( keys, cookieOpts )
+ *
+ * @param {Object} inst
+ * @param {(string|Array)=} keys
+ * @param {Object=} cookieOpts
+ */
+ saveCookie: function (inst, keys, cookieOpts) {
+ var o = inst.options
+ , sm = o.stateManagement
+ , oC = $.extend(true, {}, sm.cookie, cookieOpts || null)
+ , data = inst.state.stateData = inst.readState( keys || sm.stateKeys ) // read current panes-state
+ ;
+ $.ui.cookie.write( oC.name || o.name || "Layout", $.layout.state.encodeJSON(data), oC );
+ return $.extend(true, {}, data); // return COPY of state.stateData data
+ }
+
+ /**
+ * Remove the state cookie
+ *
+ * @param {Object} inst
+ */
+, deleteCookie: function (inst) {
+ var o = inst.options;
+ $.ui.cookie.clear( o.stateManagement.cookie.name || o.name || "Layout" );
+ }
+
+ /**
+ * Read & return data from the cookie - as JSON
+ *
+ * @param {Object} inst
+ */
+, readCookie: function (inst) {
+ var o = inst.options;
+ var c = $.ui.cookie.read( o.stateManagement.cookie.name || o.name || "Layout" );
+ // convert cookie string back to a hash and return it
+ return c ? $.layout.state.decodeJSON(c) : {};
+ }
+
+ /**
+ * Get data from the cookie and USE IT to loadState
+ *
+ * @param {Object} inst
+ */
+, loadCookie: function (inst) {
+ var c = $.layout.state.readCookie(inst); // READ the cookie
+ if (c && !$.isEmptyObject( c )) {
+ inst.state.stateData = $.extend(true, {}, c); // SET state.stateData
+ inst.loadState(c); // LOAD the retrieved state
+ }
+ return c;
+ }
+
+ /**
+ * Update layout options from the cookie, if one exists
+ *
+ * @param {Object} inst
+ * @param {Object=} stateData
+ * @param {boolean=} animate
+ */
+, loadState: function (inst, data, opts) {
+ if (!$.isPlainObject( data ) || $.isEmptyObject( data )) return;
+
+ // normalize data & cache in the state object
+ data = inst.state.stateData = $.layout.transformData( data ); // panes = default subkey
+
+ // add missing/default state-restore options
+ var smo = inst.options.stateManagement;
+ opts = $.extend({
+ animateLoad: false //smo.animateLoad
+ , includeChildren: smo.includeChildren
+ }, opts );
+
+ if (!inst.state.initialized) {
+ /*
+ * layout NOT initialized, so just update its options
+ */
+ // MUST remove pane.children keys before applying to options
+ // use a copy so we don't remove keys from original data
+ var o = $.extend(true, {}, data);
+ //delete o.center; // center has no state-data - only children
+ $.each($.layout.config.allPanes, function (idx, pane) {
+ if (o[pane]) delete o[pane].children;
+ });
+ // update CURRENT layout-options with saved state data
+ $.extend(true, inst.options, o);
+ }
+ else {
+ /*
+ * layout already initialized, so modify layout's configuration
+ */
+ var noAnimate = !opts.animateLoad
+ , o, c, h, state, open
+ ;
+ $.each($.layout.config.borderPanes, function (idx, pane) {
+ o = data[ pane ];
+ if (!$.isPlainObject( o )) return; // no key, skip pane
+
+ s = o.size;
+ c = o.initClosed;
+ h = o.initHidden;
+ ar = o.autoResize
+ state = inst.state[pane];
+ open = state.isVisible;
+
+ // reset autoResize
+ if (ar)
+ state.autoResize = ar;
+ // resize BEFORE opening
+ if (!open)
+ inst._sizePane(pane, s, false, false, false); // false=skipCallback/noAnimation/forceResize
+ // open/close as necessary - DO NOT CHANGE THIS ORDER!
+ if (h === true) inst.hide(pane, noAnimate);
+ else if (c === true) inst.close(pane, false, noAnimate);
+ else if (c === false) inst.open (pane, false, noAnimate);
+ else if (h === false) inst.show (pane, false, noAnimate);
+ // resize AFTER any other actions
+ if (open)
+ inst._sizePane(pane, s, false, false, noAnimate); // animate resize if option passed
+ });
+
+ /*
+ * RECURSE INTO CHILD-LAYOUTS
+ */
+ if (opts.includeChildren) {
+ var paneStateChildren, childState;
+ $.each(inst.children, function (pane, paneChildren) {
+ paneStateChildren = data[pane] ? data[pane].children : 0;
+ if (paneStateChildren && paneChildren) {
+ $.each(paneChildren, function (stateKey, child) {
+ childState = paneStateChildren[stateKey];
+ if (child && childState)
+ child.loadState( childState );
+ });
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Get the *current layout state* and return it as a hash
+ *
+ * @param {Object=} inst // Layout instance to get state for
+ * @param {object=} [opts] // State-Managements override options
+ */
+, readState: function (inst, opts) {
+ // backward compatility
+ if ($.type(opts) === 'string') opts = { keys: opts };
+ if (!opts) opts = {};
+ var sm = inst.options.stateManagement
+ , ic = opts.includeChildren
+ , recurse = ic !== undefined ? ic : sm.includeChildren
+ , keys = opts.stateKeys || sm.stateKeys
+ , alt = { isClosed: 'initClosed', isHidden: 'initHidden' }
+ , state = inst.state
+ , panes = $.layout.config.allPanes
+ , data = {}
+ , pair, pane, key, val
+ , ps, pC, child, array, count, branch
+ ;
+ if ($.isArray(keys)) keys = keys.join(",");
+ // convert keys to an array and change delimiters from '__' to '.'
+ keys = keys.replace(/__/g, ".").split(',');
+ // loop keys and create a data hash
+ for (var i=0, n=keys.length; i < n; i++) {
+ pair = keys[i].split(".");
+ pane = pair[0];
+ key = pair[1];
+ if ($.inArray(pane, panes) < 0) continue; // bad pane!
+ val = state[ pane ][ key ];
+ if (val == undefined) continue;
+ if (key=="isClosed" && state[pane]["isSliding"])
+ val = true; // if sliding, then *really* isClosed
+ ( data[pane] || (data[pane]={}) )[ alt[key] ? alt[key] : key ] = val;
+ }
+
+ // recurse into the child-layouts for each pane
+ if (recurse) {
+ $.each(panes, function (idx, pane) {
+ pC = inst.children[pane];
+ ps = state.stateData[pane];
+ if ($.isPlainObject( pC ) && !$.isEmptyObject( pC )) {
+ // ensure a key exists for this 'pane', eg: branch = data.center
+ branch = data[pane] || (data[pane] = {});
+ if (!branch.children) branch.children = {};
+ $.each( pC, function (key, child) {
+ // ONLY read state from an initialize layout
+ if ( child.state.initialized )
+ branch.children[ key ] = $.layout.state.readState( child );
+ // if we have PREVIOUS (onLoad) state for this child-layout, KEEP IT!
+ else if ( ps && ps.children && ps.children[ key ] ) {
+ branch.children[ key ] = $.extend(true, {}, ps.children[ key ] );
+ }
+ });
+ }
+ });
+ }
+
+ return data;
+ }
+
+ /**
+ * Stringify a JSON hash so can save in a cookie or db-field
+ */
+, encodeJSON: function (json) {
+ var local = window.JSON || {};
+ return (local.stringify || stringify)(json);
+
+ function stringify (h) {
+ var D=[], i=0, k, v, t // k = key, v = value
+ , a = $.isArray(h)
+ ;
+ for (k in h) {
+ v = h[k];
+ t = typeof v;
+ if (t == 'string') // STRING - add quotes
+ v = '"'+ v +'"';
+ else if (t == 'object') // SUB-KEY - recurse into it
+ v = parse(v);
+ D[i++] = (!a ? '"'+ k +'":' : '') + v;
+ }
+ return (a ? '[' : '{') + D.join(',') + (a ? ']' : '}');
+ };
+ }
+
+ /**
+ * Convert stringified JSON back to a hash object
+ * @see $.parseJSON(), adding in jQuery 1.4.1
+ */
+, decodeJSON: function (str) {
+ try { return $.parseJSON ? $.parseJSON(str) : window["eval"]("("+ str +")") || {}; }
+ catch (e) { return {}; }
+ }
+
+
+, _create: function (inst) {
+ var s = $.layout.state
+ , o = inst.options
+ , sm = o.stateManagement
+ ;
+ // ADD State-Management plugin methods to inst
+ $.extend( inst, {
+ // readCookie - update options from cookie - returns hash of cookie data
+ readCookie: function () { return s.readCookie(inst); }
+ // deleteCookie
+ , deleteCookie: function () { s.deleteCookie(inst); }
+ // saveCookie - optionally pass keys-list and cookie-options (hash)
+ , saveCookie: function (keys, cookieOpts) { return s.saveCookie(inst, keys, cookieOpts); }
+ // loadCookie - readCookie and use to loadState() - returns hash of cookie data
+ , loadCookie: function () { return s.loadCookie(inst); }
+ // loadState - pass a hash of state to use to update options
+ , loadState: function (stateData, opts) { s.loadState(inst, stateData, opts); }
+ // readState - returns hash of current layout-state
+ , readState: function (keys) { return s.readState(inst, keys); }
+ // add JSON utility methods too...
+ , encodeJSON: s.encodeJSON
+ , decodeJSON: s.decodeJSON
+ });
+
+ // init state.stateData key, even if plugin is initially disabled
+ inst.state.stateData = {};
+
+ // autoLoad MUST BE one of: data-array, data-hash, callback-function, or TRUE
+ if ( !sm.autoLoad ) return;
+
+ // When state-data exists in the autoLoad key USE IT,
+ // even if stateManagement.enabled == false
+ if ($.isPlainObject( sm.autoLoad )) {
+ if (!$.isEmptyObject( sm.autoLoad )) {
+ inst.loadState( sm.autoLoad );
+ }
+ }
+ else if ( sm.enabled ) {
+ // update the options from cookie or callback
+ // if options is a function, call it to get stateData
+ if ($.isFunction( sm.autoLoad )) {
+ var d = {};
+ try {
+ d = sm.autoLoad( inst, inst.state, inst.options, inst.options.name || '' ); // try to get data from fn
+ } catch (e) {}
+ if (d && $.isPlainObject( d ) && !$.isEmptyObject( d ))
+ inst.loadState(d);
+ }
+ else // any other truthy value will trigger loadCookie
+ inst.loadCookie();
+ }
+ }
+
+, _unload: function (inst) {
+ var sm = inst.options.stateManagement;
+ if (sm.enabled && sm.autoSave) {
+ // if options is a function, call it to save the stateData
+ if ($.isFunction( sm.autoSave )) {
+ try {
+ sm.autoSave( inst, inst.state, inst.options, inst.options.name || '' ); // try to get data from fn
+ } catch (e) {}
+ }
+ else // any truthy value will trigger saveCookie
+ inst.saveCookie();
+ }
+ }
+
+};
+
+// add state initialization method to Layout's onCreate array of functions
+$.layout.onCreate.push( $.layout.state._create );
+$.layout.onUnload.push( $.layout.state._unload );
+
+})( jQuery );
+
+
+
+/**
+ * @preserve jquery.layout.buttons 1.0
+ * $Date: 2015/03/13 22:37:04 $
+ *
+ * Copyright (c) 2011
+ * Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * @dependancies: UI Layout 1.3.0.rc30.1 or higher
+ *
+ * @support: http://groups.google.com/group/jquery-ui-layout
+ *
+ * Docs: [ to come ]
+ * Tips: [ to come ]
+ */
+;(function ($) {
+
+if (!$.layout) return;
+
+
+// tell Layout that the state plugin is available
+$.layout.plugins.buttons = true;
+
+// Add State-Management options to layout.defaults
+$.layout.defaults.autoBindCustomButtons = false;
+// Set stateManagement as a layout-option, NOT a pane-option
+$.layout.optionsMap.layout.push("autoBindCustomButtons");
+
+var lang = $.layout.language;
+
+/*
+ * Button methods
+ */
+$.layout.buttons = {
+ // set data used by multiple methods below
+ config: {
+ borderPanes: "north,south,west,east"
+ }
+
+ /**
+ * Searches for .ui-layout-button-xxx elements and auto-binds them as layout-buttons
+ *
+ * @see _create()
+ */
+, init: function (inst) {
+ var pre = "ui-layout-button-"
+ , layout = inst.options.name || ""
+ , name;
+ $.each("toggle,open,close,pin,toggle-slide,open-slide".split(","), function (i, action) {
+ $.each($.layout.buttons.config.borderPanes.split(","), function (ii, pane) {
+ $("."+pre+action+"-"+pane).each(function(){
+ // if button was previously 'bound', data.layoutName was set, but is blank if layout has no 'name'
+ name = $(this).data("layoutName") || $(this).attr("layoutName");
+ if (name == undefined || name === layout)
+ inst.bindButton(this, action, pane);
+ });
+ });
+ });
+ }
+
+ /**
+ * Helper function to validate params received by addButton utilities
+ *
+ * Two classes are added to the element, based on the buttonClass...
+ * The type of button is appended to create the 2nd className:
+ * - ui-layout-button-pin
+ * - ui-layout-pane-button-toggle
+ * - ui-layout-pane-button-open
+ * - ui-layout-pane-button-close
+ *
+ * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+ * @param {string} pane Name of the pane the button is for: 'north', 'south', etc.
+ * @return {Array.<Object>} If both params valid, the element matching 'selector' in a jQuery wrapper - otherwise returns null
+ */
+, get: function (inst, selector, pane, action) {
+ var $E = $(selector)
+ , o = inst.options
+ , err = o.showErrorMessages
+ ;
+ if (!$E.length) { // element not found
+ if (err) alert(lang.errButton + lang.selector +": "+ selector);
+ }
+ else if ($.layout.buttons.config.borderPanes.indexOf(pane) === -1) { // invalid 'pane' sepecified
+ if (err) alert(lang.errButton + lang.pane +": "+ pane);
+ $E = $(""); // NO BUTTON
+ }
+ else { // VALID
+ var btn = o[pane].buttonClass +"-"+ action;
+ $E .addClass( btn +" "+ btn +"-"+ pane )
+ .data("layoutName", o.name); // add layout identifier - even if blank!
+ }
+ return $E;
+ }
+
+
+ /**
+ * NEW syntax for binding layout-buttons - will eventually replace addToggle, addOpen, etc.
+ *
+ * @param {(string|!Object)} sel jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+ * @param {string} action
+ * @param {string} pane
+ */
+, bind: function (inst, sel, action, pane) {
+ var _ = $.layout.buttons;
+ switch (action.toLowerCase()) {
+ case "toggle": _.addToggle (inst, sel, pane); break;
+ case "open": _.addOpen (inst, sel, pane); break;
+ case "close": _.addClose (inst, sel, pane); break;
+ case "pin": _.addPin (inst, sel, pane); break;
+ case "toggle-slide": _.addToggle (inst, sel, pane, true); break;
+ case "open-slide": _.addOpen (inst, sel, pane, true); break;
+ }
+ return inst;
+ }
+
+ /**
+ * Add a custom Toggler button for a pane
+ *
+ * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+ * @param {string} pane Name of the pane the button is for: 'north', 'south', etc.
+ * @param {boolean=} slide true = slide-open, false = pin-open
+ */
+, addToggle: function (inst, selector, pane, slide) {
+ $.layout.buttons.get(inst, selector, pane, "toggle")
+ .click(function(evt){
+ inst.toggle(pane, !!slide);
+ evt.stopPropagation();
+ });
+ return inst;
+ }
+
+ /**
+ * Add a custom Open button for a pane
+ *
+ * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+ * @param {string} pane Name of the pane the button is for: 'north', 'south', etc.
+ * @param {boolean=} slide true = slide-open, false = pin-open
+ */
+, addOpen: function (inst, selector, pane, slide) {
+ $.layout.buttons.get(inst, selector, pane, "open")
+ .attr("title", lang.Open)
+ .click(function (evt) {
+ inst.open(pane, !!slide);
+ evt.stopPropagation();
+ });
+ return inst;
+ }
+
+ /**
+ * Add a custom Close button for a pane
+ *
+ * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+ * @param {string} pane Name of the pane the button is for: 'north', 'south', etc.
+ */
+, addClose: function (inst, selector, pane) {
+ $.layout.buttons.get(inst, selector, pane, "close")
+ .attr("title", lang.Close)
+ .click(function (evt) {
+ inst.close(pane);
+ evt.stopPropagation();
+ });
+ return inst;
+ }
+
+ /**
+ * Add a custom Pin button for a pane
+ *
+ * Four classes are added to the element, based on the paneClass for the associated pane...
+ * Assuming the default paneClass and the pin is 'up', these classes are added for a west-pane pin:
+ * - ui-layout-pane-pin
+ * - ui-layout-pane-west-pin
+ * - ui-layout-pane-pin-up
+ * - ui-layout-pane-west-pin-up
+ *
+ * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+ * @param {string} pane Name of the pane the pin is for: 'north', 'south', etc.
+ */
+, addPin: function (inst, selector, pane) {
+ var $E = $.layout.buttons.get(inst, selector, pane, "pin");
+ if ($E.length) {
+ var s = inst.state[pane];
+ $E.click(function (evt) {
+ $.layout.buttons.setPinState(inst, $(this), pane, (s.isSliding || s.isClosed));
+ if (s.isSliding || s.isClosed) inst.open( pane ); // change from sliding to open
+ else inst.close( pane ); // slide-closed
+ evt.stopPropagation();
+ });
+ // add up/down pin attributes and classes
+ $.layout.buttons.setPinState(inst, $E, pane, (!s.isClosed && !s.isSliding));
+ // add this pin to the pane data so we can 'sync it' automatically
+ // PANE.pins key is an array so we can store multiple pins for each pane
+ s.pins.push( selector ); // just save the selector string
+ }
+ return inst;
+ }
+
+ /**
+ * Change the class of the pin button to make it look 'up' or 'down'
+ *
+ * @see addPin(), syncPins()
+ * @param {Array.<Object>} $Pin The pin-span element in a jQuery wrapper
+ * @param {string} pane These are the params returned to callbacks by layout()
+ * @param {boolean} doPin true = set the pin 'down', false = set it 'up'
+ */
+, setPinState: function (inst, $Pin, pane, doPin) {
+ var updown = $Pin.attr("pin");
+ if (updown && doPin === (updown=="down")) return; // already in correct state
+ var
+ pin = inst.options[pane].buttonClass +"-pin"
+ , side = pin +"-"+ pane
+ , UP = pin +"-up "+ side +"-up"
+ , DN = pin +"-down "+side +"-down"
+ ;
+ $Pin
+ .attr("pin", doPin ? "down" : "up") // logic
+ .attr("title", doPin ? lang.Unpin : lang.Pin)
+ .removeClass( doPin ? UP : DN )
+ .addClass( doPin ? DN : UP )
+ ;
+ }
+
+ /**
+ * INTERNAL function to sync 'pin buttons' when pane is opened or closed
+ * Unpinned means the pane is 'sliding' - ie, over-top of the adjacent panes
+ *
+ * @see open(), close()
+ * @param {string} pane These are the params returned to callbacks by layout()
+ * @param {boolean} doPin True means set the pin 'down', False means 'up'
+ */
+, syncPinBtns: function (inst, pane, doPin) {
+ // REAL METHOD IS _INSIDE_ LAYOUT - THIS IS HERE JUST FOR REFERENCE
+ $.each(state[pane].pins, function (i, selector) {
+ $.layout.buttons.setPinState(inst, $(selector), pane, doPin);
+ });
+ }
+
+
+, _load: function (inst) {
+ // ADD Button methods to Layout Instance
+ $.extend( inst, {
+ bindButton: function (selector, action, pane) { return $.layout.buttons.bind(inst, selector, action, pane); }
+ // DEPRECATED METHODS...
+ , addToggleBtn: function (selector, pane, slide) { return $.layout.buttons.addToggle(inst, selector, pane, slide); }
+ , addOpenBtn: function (selector, pane, slide) { return $.layout.buttons.addOpen(inst, selector, pane, slide); }
+ , addCloseBtn: function (selector, pane) { return $.layout.buttons.addClose(inst, selector, pane); }
+ , addPinBtn: function (selector, pane) { return $.layout.buttons.addPin(inst, selector, pane); }
+ });
+
+ // init state array to hold pin-buttons
+ for (var i=0; i<4; i++) {
+ var pane = $.layout.buttons.config.borderPanes[i];
+ inst.state[pane].pins = [];
+ }
+
+ // auto-init buttons onLoad if option is enabled
+ if ( inst.options.autoBindCustomButtons )
+ $.layout.buttons.init(inst);
+ }
+
+, _unload: function (inst) {
+ // TODO: unbind all buttons???
+ }
+
+};
+
+// add initialization method to Layout's onLoad array of functions
+$.layout.onLoad.push( $.layout.buttons._load );
+//$.layout.onUnload.push( $.layout.buttons._unload );
+
+})( jQuery );
+
+
+
+
+/**
+ * jquery.layout.browserZoom 1.0
+ * $Date: 2015/03/13 22:37:04 $
+ *
+ * Copyright (c) 2012
+ * Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * @requires: UI Layout 1.3.0.rc30.1 or higher
+ *
+ * @see: http://groups.google.com/group/jquery-ui-layout
+ *
+ * TODO: Extend logic to handle other problematic zooming in browsers
+ * TODO: Add hotkey/mousewheel bindings to _instantly_ respond to these zoom event
+ */
+(function ($) {
+
+// tell Layout that the plugin is available
+$.layout.plugins.browserZoom = true;
+
+$.layout.defaults.browserZoomCheckInterval = 1000;
+$.layout.optionsMap.layout.push("browserZoomCheckInterval");
+
+/*
+ * browserZoom methods
+ */
+$.layout.browserZoom = {
+
+ _init: function (inst) {
+ // abort if browser does not need this check
+ if ($.layout.browserZoom.ratio() !== false)
+ $.layout.browserZoom._setTimer(inst);
+ }
+
+, _setTimer: function (inst) {
+ // abort if layout destroyed or browser does not need this check
+ if (inst.destroyed) return;
+ var o = inst.options
+ , s = inst.state
+ // don't need check if inst has parentLayout, but check occassionally in case parent destroyed!
+ // MINIMUM 100ms interval, for performance
+ , ms = inst.hasParentLayout ? 5000 : Math.max( o.browserZoomCheckInterval, 100 )
+ ;
+ // set the timer
+ setTimeout(function(){
+ if (inst.destroyed || !o.resizeWithWindow) return;
+ var d = $.layout.browserZoom.ratio();
+ if (d !== s.browserZoom) {
+ s.browserZoom = d;
+ inst.resizeAll();
+ }
+ // set a NEW timeout
+ $.layout.browserZoom._setTimer(inst);
+ }
+ , ms );
+ }
+
+, ratio: function () {
+ var w = window
+ , s = screen
+ , d = document
+ , dE = d.documentElement || d.body
+ , b = $.layout.browser
+ , v = b.version
+ , r, sW, cW
+ ;
+ // we can ignore all browsers that fire window.resize event onZoom
+ if (!b.msie || v > 8)
+ return false; // don't need to track zoom
+ if (s.deviceXDPI && s.systemXDPI) // syntax compiler hack
+ return calc(s.deviceXDPI, s.systemXDPI);
+ // everything below is just for future reference!
+ if (b.webkit && (r = d.body.getBoundingClientRect))
+ return calc((r.left - r.right), d.body.offsetWidth);
+ if (b.webkit && (sW = w.outerWidth))
+ return calc(sW, w.innerWidth);
+ if ((sW = s.width) && (cW = dE.clientWidth))
+ return calc(sW, cW);
+ return false; // no match, so cannot - or don't need to - track zoom
+
+ function calc (x,y) { return (parseInt(x,10) / parseInt(y,10) * 100).toFixed(); }
+ }
+
+};
+// add initialization method to Layout's onLoad array of functions
+$.layout.onReady.push( $.layout.browserZoom._init );
+
+
+})( jQuery );
+
+
+
+
+/**
+ * UI Layout Plugin: Slide-Offscreen Animation
+ *
+ * Prevent panes from being 'hidden' so that an iframes/objects
+ * does not reload/refresh when pane 'opens' again.
+ * This plug-in adds a new animation called "slideOffscreen".
+ * It is identical to the normal "slide" effect, but avoids hiding the element
+ *
+ * Requires Layout 1.3.0.RC30.1 or later for Close offscreen
+ * Requires Layout 1.3.0.RC30.5 or later for Hide, initClosed & initHidden offscreen
+ *
+ * Version: 1.1 - 2012-11-18
+ * Author: Kevin Dalman (kevin@jquery-dev.com)
+ * @preserve jquery.layout.slideOffscreen-1.1.js
+ */
+;(function ($) {
+
+// Add a new "slideOffscreen" effect
+if ($.effects) {
+
+ // add an option so initClosed and initHidden will work
+ $.layout.defaults.panes.useOffscreenClose = false; // user must enable when needed
+ /* set the new animation as the default for all panes
+ $.layout.defaults.panes.fxName = "slideOffscreen";
+ */
+
+ if ($.layout.plugins)
+ $.layout.plugins.effects.slideOffscreen = true;
+
+ // dupe 'slide' effect defaults as new effect defaults
+ $.layout.effects.slideOffscreen = $.extend(true, {}, $.layout.effects.slide);
+
+ // add new effect to jQuery UI
+ $.effects.slideOffscreen = function(o) {
+ return this.queue(function(){
+
+ var fx = $.effects
+ , opt = o.options
+ , $el = $(this)
+ , pane = $el.data('layoutEdge')
+ , state = $el.data('parentLayout').state
+ , dist = state[pane].size
+ , s = this.style
+ , props = ['top','bottom','left','right']
+ // Set options
+ , mode = fx.setMode($el, opt.mode || 'show') // Set Mode
+ , show = (mode == 'show')
+ , dir = opt.direction || 'left' // Default Direction
+ , ref = (dir == 'up' || dir == 'down') ? 'top' : 'left'
+ , pos = (dir == 'up' || dir == 'left')
+ , offscrn = $.layout.config.offscreenCSS || {}
+ , keyLR = $.layout.config.offscreenReset
+ , keyTB = 'offscreenResetTop' // only used internally
+ , animation = {}
+ ;
+ // Animation settings
+ animation[ref] = (show ? (pos ? '+=' : '-=') : (pos ? '-=' : '+=')) + dist;
+
+ if (show) { // show() animation, so save top/bottom but retain left/right set when 'hidden'
+ $el.data(keyTB, { top: s.top, bottom: s.bottom });
+
+ // set the top or left offset in preparation for animation
+ // Note: ALL animations work by shifting the top or left edges
+ if (pos) { // top (north) or left (west)
+ $el.css(ref, isNaN(dist) ? "-" + dist : -dist); // Shift outside the left/top edge
+ }
+ else { // bottom (south) or right (east) - shift all the way across container
+ if (dir === 'right')
+ $el.css({ left: state.container.layoutWidth, right: 'auto' });
+ else // dir === bottom
+ $el.css({ top: state.container.layoutHeight, bottom: 'auto' });
+ }
+ // restore the left/right setting if is a top/bottom animation
+ if (ref === 'top')
+ $el.css( $el.data( keyLR ) || {} );
+ }
+ else { // hide() animation, so save ALL CSS
+ $el.data(keyTB, { top: s.top, bottom: s.bottom });
+ $el.data(keyLR, { left: s.left, right: s.right });
+ }
+
+ // Animate
+ $el.show().animate(animation, { queue: false, duration: o.duration, easing: opt.easing, complete: function(){
+ // Restore top/bottom
+ if ($el.data( keyTB ))
+ $el.css($el.data( keyTB )).removeData( keyTB );
+ if (show) // Restore left/right too
+ $el.css($el.data( keyLR ) || {}).removeData( keyLR );
+ else // Move the pane off-screen (left: -99999, right: 'auto')
+ $el.css( offscrn );
+
+ if (o.callback) o.callback.apply(this, arguments); // Callback
+ $el.dequeue();
+ }});
+
+ });
+ };
+
+}
+
+})( jQuery ); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/modalService.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/modalService.js
new file mode 100644
index 00000000..74c848e8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/modalService.js
@@ -0,0 +1,185 @@
+angular.module("modalServices",[]).service('modalService', ['$modal', function ($modal) {
+
+
+ this.showSuccess = function(heading, messageBody){
+ var modalInstance = $modal.open({
+ templateUrl: 'modal_informative.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ $(".overlayed").css("display","none");
+ $(".loadingId").css("display","none");
+ var message = {
+ title: heading,
+ text: messageBody
+ };
+ return message;
+ }
+ }
+ });
+ };
+ this.showFailure = function(heading, messageBody){
+ var modalInstance = $modal.open({
+ templateUrl: 'modal_warning.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: heading,
+ text: messageBody
+ };
+ return message;
+ }
+ }
+ });
+ };
+
+ this.showMessage = function(heading, messageBody){
+ var modalInstance = $modal.open({
+ templateUrl: 'modal_message.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: heading,
+ text: messageBody
+ };
+ return message;
+ }
+ }
+ });
+ };
+
+ this.showWarning = function(heading, messageBody){
+ var modalInstance = $modal.open({
+ templateUrl: 'modal_warning_message.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: heading,
+ text: messageBody
+ };
+ return message;
+ }
+ }
+ });
+ };
+
+ this.popupConfirmWin = function(title, msgBody, callback){
+ var modalInstance = $modal.open({
+ templateUrl: 'confirmation_informative.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: title,
+ text: msgBody
+ };
+ return message;
+ }
+ }
+ });
+ var args = Array.prototype.slice.call( arguments, 0 );
+ args.splice( 0, 3);
+ modalInstance.result.then(function(){
+ callback.apply(null, args);
+ }, function() {
+ })['finally'](function(){
+ modalInstance = undefined;
+ });
+
+ };
+ this.popupConfirmWinWithCancel = function(title, msgBody, callback,dismissCallback){
+ var modalInstance = $modal.open({
+ templateUrl: 'confirmation_informative.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: title,
+ text: msgBody
+ };
+ return message;
+ }
+ }
+ });
+ var args = Array.prototype.slice.call( arguments, 0 );
+ args.splice( 0, 3);
+ modalInstance.result.then(function(){
+ callback.apply(null, args);
+ }, function() {
+ dismissCallback();
+ })['finally'](function(){
+ modalInstance = undefined;
+ });
+
+ };
+ this.popupDeleteConfirmWin = function(title, msgBody, callback, argForCallBack){
+ var modalInstance = $modal.open({
+ templateUrl: 'confirmation_for_delete.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: title,
+ text: msgBody
+ };
+ return message;
+ }
+ }
+ });
+
+ modalInstance.result.then(function(){
+ callback(argForCallBack);
+ }, function() {
+ })['finally'](function(){
+ modalInstance = undefined;
+ });
+
+ };
+
+ this.popupSuccessRedirectWin = function(title, msgBody, redirectUrl){
+ var modalInstance = $modal.open({
+ templateUrl: 'modal_informative.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: title,
+ text: msgBody
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function() {
+ }, function() {
+ window.location.href=redirectUrl;
+ })['finally'](function(){
+ modalInstance = undefined;
+ });
+ };
+
+ this.popupWarningRedirectWin = function(title, msgBody, redirectUrl){
+ var modalInstance = $modal.open({
+ templateUrl: 'modal_warning_message.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: title,
+ text: msgBody
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function() {
+ }, function() {
+ window.location.href=redirectUrl;
+ })['finally'](function(){
+ modalInstance = undefined;
+ });
+ };
+ }]); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/moment.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/moment.min.js
new file mode 100644
index 00000000..62b1697b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/moment.min.js
@@ -0,0 +1,6 @@
+// moment.js
+// version : 2.1.0
+// author : Tim Wood
+// license : MIT
+// momentjs.com
+!function(t){function e(t,e){return function(n){return u(t.call(this,n),e)}}function n(t,e){return function(n){return this.lang().ordinal(t.call(this,n),e)}}function s(){}function i(t){a(this,t)}function r(t){var e=t.years||t.year||t.y||0,n=t.months||t.month||t.M||0,s=t.weeks||t.week||t.w||0,i=t.days||t.day||t.d||0,r=t.hours||t.hour||t.h||0,a=t.minutes||t.minute||t.m||0,o=t.seconds||t.second||t.s||0,u=t.milliseconds||t.millisecond||t.ms||0;this._input=t,this._milliseconds=u+1e3*o+6e4*a+36e5*r,this._days=i+7*s,this._months=n+12*e,this._data={},this._bubble()}function a(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function o(t){return 0>t?Math.ceil(t):Math.floor(t)}function u(t,e){for(var n=t+"";n.length<e;)n="0"+n;return n}function h(t,e,n,s){var i,r,a=e._milliseconds,o=e._days,u=e._months;a&&t._d.setTime(+t._d+a*n),(o||u)&&(i=t.minute(),r=t.hour()),o&&t.date(t.date()+o*n),u&&t.month(t.month()+u*n),a&&!s&&H.updateOffset(t),(o||u)&&(t.minute(i),t.hour(r))}function d(t){return"[object Array]"===Object.prototype.toString.call(t)}function c(t,e){var n,s=Math.min(t.length,e.length),i=Math.abs(t.length-e.length),r=0;for(n=0;s>n;n++)~~t[n]!==~~e[n]&&r++;return r+i}function f(t){return t?ie[t]||t.toLowerCase().replace(/(.)s$/,"$1"):t}function l(t,e){return e.abbr=t,x[t]||(x[t]=new s),x[t].set(e),x[t]}function _(t){if(!t)return H.fn._lang;if(!x[t]&&A)try{require("./lang/"+t)}catch(e){return H.fn._lang}return x[t]}function m(t){return t.match(/\[.*\]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function y(t){var e,n,s=t.match(E);for(e=0,n=s.length;n>e;e++)s[e]=ue[s[e]]?ue[s[e]]:m(s[e]);return function(i){var r="";for(e=0;n>e;e++)r+=s[e]instanceof Function?s[e].call(i,t):s[e];return r}}function M(t,e){function n(e){return t.lang().longDateFormat(e)||e}for(var s=5;s--&&N.test(e);)e=e.replace(N,n);return re[e]||(re[e]=y(e)),re[e](t)}function g(t,e){switch(t){case"DDDD":return V;case"YYYY":return X;case"YYYYY":return $;case"S":case"SS":case"SSS":case"DDD":return I;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return R;case"a":case"A":return _(e._l)._meridiemParse;case"X":return B;case"Z":case"ZZ":return j;case"T":return q;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return J;default:return new RegExp(t.replace("\\",""))}}function p(t){var e=(j.exec(t)||[])[0],n=(e+"").match(ee)||["-",0,0],s=+(60*n[1])+~~n[2];return"+"===n[0]?-s:s}function D(t,e,n){var s,i=n._a;switch(t){case"M":case"MM":i[1]=null==e?0:~~e-1;break;case"MMM":case"MMMM":s=_(n._l).monthsParse(e),null!=s?i[1]=s:n._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":null!=e&&(i[2]=~~e);break;case"YY":i[0]=~~e+(~~e>68?1900:2e3);break;case"YYYY":case"YYYYY":i[0]=~~e;break;case"a":case"A":n._isPm=_(n._l).isPM(e);break;case"H":case"HH":case"h":case"hh":i[3]=~~e;break;case"m":case"mm":i[4]=~~e;break;case"s":case"ss":i[5]=~~e;break;case"S":case"SS":case"SSS":i[6]=~~(1e3*("0."+e));break;case"X":n._d=new Date(1e3*parseFloat(e));break;case"Z":case"ZZ":n._useUTC=!0,n._tzm=p(e)}null==e&&(n._isValid=!1)}function Y(t){var e,n,s=[];if(!t._d){for(e=0;7>e;e++)t._a[e]=s[e]=null==t._a[e]?2===e?1:0:t._a[e];s[3]+=~~((t._tzm||0)/60),s[4]+=~~((t._tzm||0)%60),n=new Date(0),t._useUTC?(n.setUTCFullYear(s[0],s[1],s[2]),n.setUTCHours(s[3],s[4],s[5],s[6])):(n.setFullYear(s[0],s[1],s[2]),n.setHours(s[3],s[4],s[5],s[6])),t._d=n}}function w(t){var e,n,s=t._f.match(E),i=t._i;for(t._a=[],e=0;e<s.length;e++)n=(g(s[e],t).exec(i)||[])[0],n&&(i=i.slice(i.indexOf(n)+n.length)),ue[s[e]]&&D(s[e],n,t);i&&(t._il=i),t._isPm&&t._a[3]<12&&(t._a[3]+=12),t._isPm===!1&&12===t._a[3]&&(t._a[3]=0),Y(t)}function k(t){var e,n,s,r,o,u=99;for(r=0;r<t._f.length;r++)e=a({},t),e._f=t._f[r],w(e),n=new i(e),o=c(e._a,n.toArray()),n._il&&(o+=n._il.length),u>o&&(u=o,s=n);a(t,s)}function v(t){var e,n=t._i,s=K.exec(n);if(s){for(t._f="YYYY-MM-DD"+(s[2]||" "),e=0;4>e;e++)if(te[e][1].exec(n)){t._f+=te[e][0];break}j.exec(n)&&(t._f+=" Z"),w(t)}else t._d=new Date(n)}function T(e){var n=e._i,s=G.exec(n);n===t?e._d=new Date:s?e._d=new Date(+s[1]):"string"==typeof n?v(e):d(n)?(e._a=n.slice(0),Y(e)):e._d=n instanceof Date?new Date(+n):new Date(n)}function b(t,e,n,s,i){return i.relativeTime(e||1,!!n,t,s)}function S(t,e,n){var s=W(Math.abs(t)/1e3),i=W(s/60),r=W(i/60),a=W(r/24),o=W(a/365),u=45>s&&["s",s]||1===i&&["m"]||45>i&&["mm",i]||1===r&&["h"]||22>r&&["hh",r]||1===a&&["d"]||25>=a&&["dd",a]||45>=a&&["M"]||345>a&&["MM",W(a/30)]||1===o&&["y"]||["yy",o];return u[2]=e,u[3]=t>0,u[4]=n,b.apply({},u)}function F(t,e,n){var s,i=n-e,r=n-t.day();return r>i&&(r-=7),i-7>r&&(r+=7),s=H(t).add("d",r),{week:Math.ceil(s.dayOfYear()/7),year:s.year()}}function O(t){var e=t._i,n=t._f;return null===e||""===e?null:("string"==typeof e&&(t._i=e=_().preparse(e)),H.isMoment(e)?(t=a({},e),t._d=new Date(+e._d)):n?d(n)?k(t):w(t):T(t),new i(t))}function z(t,e){H.fn[t]=H.fn[t+"s"]=function(t){var n=this._isUTC?"UTC":"";return null!=t?(this._d["set"+n+e](t),H.updateOffset(this),this):this._d["get"+n+e]()}}function C(t){H.duration.fn[t]=function(){return this._data[t]}}function L(t,e){H.duration.fn["as"+t]=function(){return+this/e}}for(var H,P,U="2.1.0",W=Math.round,x={},A="undefined"!=typeof module&&module.exports,G=/^\/?Date\((\-?\d+)/i,Z=/(\-)?(\d*)?\.?(\d+)\:(\d+)\:(\d+)\.?(\d{3})?/,E=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,N=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,J=/\d\d?/,I=/\d{1,3}/,V=/\d{3}/,X=/\d{1,4}/,$=/[+\-]?\d{1,6}/,R=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,j=/Z|[\+\-]\d\d:?\d\d/i,q=/T/i,B=/[\+\-]?\d+(\.\d{1,3})?/,K=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,Q="YYYY-MM-DDTHH:mm:ssZ",te=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],ee=/([\+\-]|\d\d)/gi,ne="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),se={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},ie={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",w:"week",M:"month",y:"year"},re={},ae="DDD w W M D d".split(" "),oe="M D H h m s w W".split(" "),ue={M:function(){return this.month()+1},MMM:function(t){return this.lang().monthsShort(this,t)},MMMM:function(t){return this.lang().months(this,t)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(t){return this.lang().weekdaysMin(this,t)},ddd:function(t){return this.lang().weekdaysShort(this,t)},dddd:function(t){return this.lang().weekdays(this,t)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return u(this.year()%100,2)},YYYY:function(){return u(this.year(),4)},YYYYY:function(){return u(this.year(),5)},gg:function(){return u(this.weekYear()%100,2)},gggg:function(){return this.weekYear()},ggggg:function(){return u(this.weekYear(),5)},GG:function(){return u(this.isoWeekYear()%100,2)},GGGG:function(){return this.isoWeekYear()},GGGGG:function(){return u(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return u(~~(this.milliseconds()/10),2)},SSS:function(){return u(this.milliseconds(),3)},Z:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(t/60),2)+":"+u(~~t%60,2)},ZZ:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(10*t/6),4)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()}};ae.length;)P=ae.pop(),ue[P+"o"]=n(ue[P],P);for(;oe.length;)P=oe.pop(),ue[P+P]=e(ue[P],2);for(ue.DDDD=e(ue.DDD,3),s.prototype={set:function(t){var e,n;for(n in t)e=t[n],"function"==typeof e?this[n]=e:this["_"+n]=e},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(t){return this._months[t.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(t){return this._monthsShort[t.month()]},monthsParse:function(t){var e,n,s;for(this._monthsParse||(this._monthsParse=[]),e=0;12>e;e++)if(this._monthsParse[e]||(n=H([2e3,e]),s="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[e]=new RegExp(s.replace(".",""),"i")),this._monthsParse[e].test(t))return e},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(t){return this._weekdays[t.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(t){return this._weekdaysShort[t.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(t){return this._weekdaysMin[t.day()]},weekdaysParse:function(t){var e,n,s;for(this._weekdaysParse||(this._weekdaysParse=[]),e=0;7>e;e++)if(this._weekdaysParse[e]||(n=H([2e3,1]).day(e),s="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[e]=new RegExp(s.replace(".",""),"i")),this._weekdaysParse[e].test(t))return e},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(t){var e=this._longDateFormat[t];return!e&&this._longDateFormat[t.toUpperCase()]&&(e=this._longDateFormat[t.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t]=e),e},isPM:function(t){return"p"===(t+"").toLowerCase()[0]},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(t,e){var n=this._calendar[t];return"function"==typeof n?n.apply(e):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(t,e,n,s){var i=this._relativeTime[n];return"function"==typeof i?i(t,e,n,s):i.replace(/%d/i,t)},pastFuture:function(t,e){var n=this._relativeTime[t>0?"future":"past"];return"function"==typeof n?n(e):n.replace(/%s/i,e)},ordinal:function(t){return this._ordinal.replace("%d",t)},_ordinal:"%d",preparse:function(t){return t},postformat:function(t){return t},week:function(t){return F(t,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6}},H=function(t,e,n){return O({_i:t,_f:e,_l:n,_isUTC:!1})},H.utc=function(t,e,n){return O({_useUTC:!0,_isUTC:!0,_l:n,_i:t,_f:e})},H.unix=function(t){return H(1e3*t)},H.duration=function(t,e){var n,s,i=H.isDuration(t),a="number"==typeof t,o=i?t._input:a?{}:t,u=Z.exec(t);return a?e?o[e]=t:o.milliseconds=t:u&&(n="-"===u[1]?-1:1,o={y:0,d:~~u[2]*n,h:~~u[3]*n,m:~~u[4]*n,s:~~u[5]*n,ms:~~u[6]*n}),s=new r(o),i&&t.hasOwnProperty("_lang")&&(s._lang=t._lang),s},H.version=U,H.defaultFormat=Q,H.updateOffset=function(){},H.lang=function(t,e){return t?(e?l(t,e):x[t]||_(t),H.duration.fn._lang=H.fn._lang=_(t),void 0):H.fn._lang._abbr},H.langData=function(t){return t&&t._lang&&t._lang._abbr&&(t=t._lang._abbr),_(t)},H.isMoment=function(t){return t instanceof i},H.isDuration=function(t){return t instanceof r},H.fn=i.prototype={clone:function(){return H(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){return M(H(this).utc(),"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var t=this;return[t.year(),t.month(),t.date(),t.hours(),t.minutes(),t.seconds(),t.milliseconds()]},isValid:function(){return null==this._isValid&&(this._isValid=this._a?!c(this._a,(this._isUTC?H.utc(this._a):H(this._a)).toArray()):!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(t){var e=M(this,t||H.defaultFormat);return this.lang().postformat(e)},add:function(t,e){var n;return n="string"==typeof t?H.duration(+e,t):H.duration(t,e),h(this,n,1),this},subtract:function(t,e){var n;return n="string"==typeof t?H.duration(+e,t):H.duration(t,e),h(this,n,-1),this},diff:function(t,e,n){var s,i,r=this._isUTC?H(t).zone(this._offset||0):H(t).local(),a=6e4*(this.zone()-r.zone());return e=f(e),"year"===e||"month"===e?(s=432e5*(this.daysInMonth()+r.daysInMonth()),i=12*(this.year()-r.year())+(this.month()-r.month()),i+=(this-H(this).startOf("month")-(r-H(r).startOf("month")))/s,i-=6e4*(this.zone()-H(this).startOf("month").zone()-(r.zone()-H(r).startOf("month").zone()))/s,"year"===e&&(i/=12)):(s=this-r,i="second"===e?s/1e3:"minute"===e?s/6e4:"hour"===e?s/36e5:"day"===e?(s-a)/864e5:"week"===e?(s-a)/6048e5:s),n?i:o(i)},from:function(t,e){return H.duration(this.diff(t)).lang(this.lang()._abbr).humanize(!e)},fromNow:function(t){return this.from(H(),t)},calendar:function(){var t=this.diff(H().startOf("day"),"days",!0),e=-6>t?"sameElse":-1>t?"lastWeek":0>t?"lastDay":1>t?"sameDay":2>t?"nextDay":7>t?"nextWeek":"sameElse";return this.format(this.lang().calendar(e,this))},isLeapYear:function(){var t=this.year();return 0===t%4&&0!==t%100||0===t%400},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(t){var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?"string"==typeof t&&(t=this.lang().weekdaysParse(t),"number"!=typeof t)?this:this.add({d:t-e}):e},month:function(t){var e,n=this._isUTC?"UTC":"";return null!=t?"string"==typeof t&&(t=this.lang().monthsParse(t),"number"!=typeof t)?this:(e=this.date(),this.date(1),this._d["set"+n+"Month"](t),this.date(Math.min(e,this.daysInMonth())),H.updateOffset(this),this):this._d["get"+n+"Month"]()},startOf:function(t){switch(t=f(t)){case"year":this.month(0);case"month":this.date(1);case"week":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),this},endOf:function(t){return this.startOf(t).add(t,1).subtract("ms",1)},isAfter:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)>+H(t).startOf(e)},isBefore:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)<+H(t).startOf(e)},isSame:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)===+H(t).startOf(e)},min:function(t){return t=H.apply(null,arguments),this>t?this:t},max:function(t){return t=H.apply(null,arguments),t>this?this:t},zone:function(t){var e=this._offset||0;return null==t?this._isUTC?e:this._d.getTimezoneOffset():("string"==typeof t&&(t=p(t)),Math.abs(t)<16&&(t=60*t),this._offset=t,this._isUTC=!0,e!==t&&h(this,H.duration(e-t,"m"),1,!0),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},daysInMonth:function(){return H.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(t){var e=W((H(this).startOf("day")-H(this).startOf("year"))/864e5)+1;return null==t?e:this.add("d",t-e)},weekYear:function(t){var e=F(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==t?e:this.add("y",t-e)},isoWeekYear:function(t){var e=F(this,1,4).year;return null==t?e:this.add("y",t-e)},week:function(t){var e=this.lang().week(this);return null==t?e:this.add("d",7*(t-e))},isoWeek:function(t){var e=F(this,1,4).week;return null==t?e:this.add("d",7*(t-e))},weekday:function(t){var e=(this._d.getDay()+7-this.lang()._week.dow)%7;return null==t?e:this.add("d",t-e)},isoWeekday:function(t){return null==t?this.day()||7:this.day(this.day()%7?t:t-7)},lang:function(e){return e===t?this._lang:(this._lang=_(e),this)}},P=0;P<ne.length;P++)z(ne[P].toLowerCase().replace(/s$/,""),ne[P]);z("year","FullYear"),H.fn.days=H.fn.day,H.fn.months=H.fn.month,H.fn.weeks=H.fn.week,H.fn.isoWeeks=H.fn.isoWeek,H.fn.toJSON=H.fn.toISOString,H.duration.fn=r.prototype={_bubble:function(){var t,e,n,s,i=this._milliseconds,r=this._days,a=this._months,u=this._data;u.milliseconds=i%1e3,t=o(i/1e3),u.seconds=t%60,e=o(t/60),u.minutes=e%60,n=o(e/60),u.hours=n%24,r+=o(n/24),u.days=r%30,a+=o(r/30),u.months=a%12,s=o(a/12),u.years=s},weeks:function(){return o(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+2592e6*(this._months%12)+31536e6*~~(this._months/12)},humanize:function(t){var e=+this,n=S(e,!t,this.lang());return t&&(n=this.lang().pastFuture(e,n)),this.lang().postformat(n)},add:function(t,e){var n=H.duration(t,e);return this._milliseconds+=n._milliseconds,this._days+=n._days,this._months+=n._months,this._bubble(),this},subtract:function(t,e){var n=H.duration(t,e);return this._milliseconds-=n._milliseconds,this._days-=n._days,this._months-=n._months,this._bubble(),this},get:function(t){return t=f(t),this[t.toLowerCase()+"s"]()},as:function(t){return t=f(t),this["as"+t.charAt(0).toUpperCase()+t.slice(1)+"s"]()},lang:H.fn.lang};for(P in se)se.hasOwnProperty(P)&&(L(P,se[P]),C(P.toLowerCase()));L("Weeks",6048e5),H.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},H.lang("en",{ordinal:function(t){var e=t%10,n=1===~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),A&&(module.exports=H),"undefined"==typeof ender&&(this.moment=H),"function"==typeof define&&define.amd&&define("moment",[],function(){return H})}.call(this); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/adminService.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/adminService.js
new file mode 100644
index 00000000..85a4d1bd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/adminService.js
@@ -0,0 +1,160 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.factory('AdminService', function ($http, $q) {
+ return {
+ getRoles: function() {
+ return $http.get('get_roles')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getRoleFunctionList: function() {
+ return $http.get('get_role_functions')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getFnMenuItems: function(){
+
+ return $http.get('admin_fn_menu')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getCacheRegions: function() {
+ return $http.get('get_regions')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getUsageList: function() {
+ return $http.get('get_usage_list')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getBroadcastList: function() {
+ return $http.get('get_broadcast_list')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getBroadcast: function(messageLocationId, messageLocation, messageId) {
+ return $http.get('get_broadcast?message_location_id='+messageLocationId + '&message_location=' + messageLocation + ((messageId != null) ? '&message_id=' + messageId : ''))
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getCollaborateList: function() {
+ return $http.get('get_collaborate_list')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getRole: function(roleId) {
+
+ return $http.get('get_role?role_id=' + roleId)
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ }
+ };
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/headerService.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/headerService.js
new file mode 100644
index 00000000..4b4a2ec4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/headerService.js
@@ -0,0 +1,89 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+var menuStructureConvert = function(menuItems) {
+ var megaMenuDataObjectTemp = [
+ {
+ text: "ECOMP",
+ children:menuItems
+ },
+ {
+ text: "Help",
+ children: [{
+ text:"Contact Us",
+ url:"javascript:angular.element('[ng-controller=headerController]').scope().redirectLink('contact');"
+ },
+ {
+ text:"Get Access",
+ url:"javascript:angular.element('[ng-controller=headerController]').scope().redirectLink('access');"
+ }]
+ }
+ ];
+ return megaMenuDataObjectTemp;
+};
+var unflatten = function( array, parent, tree ){
+ tree = typeof tree !== 'undefined' ? tree : [];
+ parent = typeof parent !== 'undefined' ? parent : { menuId: null };
+ var children = _.filter( array, function(child){ return child.parentMenuId == parent.menuId; });
+
+ if( !_.isEmpty( children ) ){
+ if( parent.menuId === null ){
+ tree = children;
+ }else{
+ parent['children'] = children
+ }
+ _.each( children, function( child ){ unflatten( array, child ) } );
+ }
+
+ return tree;
+ }
+app.service('HeaderService', function ($http,$log, $q,UserInfoService) {
+ return{
+
+ getUserNameFromSession : function(){
+ UserInfoService.getFunctionalMenuStaticDetailSession()
+ .then(function (res) {
+ $scope.userName = res.userName;
+ $scope.redirectUrl = res.portalUrl;
+ });
+ },
+ getTopMenuStaticInfo:function() {
+ var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext();
+ promise.then(
+ function(res) {
+ if(res==null || res==''){
+ $log.info('failed getting static User information');
+ this.getUserNameFromSession();
+ }else{
+ $log.info('Received static User information');
+ var resData = res;
+ $scope.inputUserInfo(resData);
+ $scope.userProfile.fullName = $scope.userProfile.firstName+ ' '+ $scope.userProfile.lastName;
+ return $scope.userProfile;
+ }
+ },
+ function(err) {
+ $log.info('failed getting static User information');
+ }
+ );
+ }
+ }
+ }
+);
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/leftMenuService.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/leftMenuService.js
new file mode 100644
index 00000000..17e53c7d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/leftMenuService.js
@@ -0,0 +1,54 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+function isRealValue(obj){
+ return obj && obj !== "null" && obj!== "undefined";
+}
+app.factory('LeftMenuService', function ($http,$log, $q) {
+ return {
+ getLeftMenu: function() {
+ return $http.get('get_menu')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+ getAppName: function() {
+ return $http.get('get_app_name')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ }
+
+ };
+});
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/profileService.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/profileService.js
new file mode 100644
index 00000000..7c73bed9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/profileService.js
@@ -0,0 +1,98 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+
+app.factory('ProfileService', function ($http, $q) {
+ return {
+ getProfile: function() {
+ return $http.get('get_user')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getProfilePagination: function(pageNum,viewPerPage) {
+ return $http.get('get_user_pagination?pageNum=' + pageNum + '&viewPerPage=' + viewPerPage)
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getPostProfile: function() {
+ return $http.get('post_search_sample')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getProfileDetail: function(profileId) {
+ return $http.get('get_profile?profile_id='+profileId)
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getSelfProfileDetail: function() {
+ return $http.get('get_self_profile')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ }
+ };
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/userInfoService.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/userInfoService.js
new file mode 100644
index 00000000..9c0d3c02
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/userInfoService.js
@@ -0,0 +1,51 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.factory('UserInfoService', function ($http, $q,$log) {
+ return {
+ getFunctionalMenuStaticDetailShareContext: function(contextId,key) {
+ var deferred = $q.defer();
+ $http({
+ method: "GET",
+ url: "get_userinfo",
+ }).success( function(res) {
+ if(res==null || res=='')
+ $log.info('Not be able to get User Info via shared context');
+ deferred.resolve(res);
+ }).error( function(status) {
+ deferred.reject(status);
+ });
+ return deferred.promise;
+ },
+ getFunctionalMenuStaticDetailSession: function() {
+ var deferred = $q.defer();
+ $http({
+ method: "GET",
+ url: "get_topMenuInfo",
+ }).success(function(res) {
+ if(res==null || res=='')
+ $log.info('Not be able to get User Info via shared context');
+ deferred.resolve(res);
+ }).error( function(status) {
+ deferred.reject(status);
+ });
+ return deferred.promise;
+ }
+ };
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/socket/peerBroadcast.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/socket/peerBroadcast.js
new file mode 100644
index 00000000..46fa5c92
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/socket/peerBroadcast.js
@@ -0,0 +1,122 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+
+var output = $('#peerBroadcastSection');
+var websocket = '';
+var currentUser = '';
+var remoteUser = '';
+var f = '';
+var popupService;
+
+function setPopupService(_popupService) {
+ popupService = _popupService;
+}
+
+function socketSetup(initialPageVisit,_currentUser, _remoteUser, _f) {
+
+
+
+ if( true) {
+
+ var href = window.location.href;
+ var hostPatt = new RegExp(window.location.host +"/[^/]*");
+ var res = hostPatt.exec(href);
+ var protocol = window.location.protocol.replace("http","ws");
+
+ var signalingServerPath = protocol + "//" + res + "/contact";
+ var wsUri = signalingServerPath;
+ console.log("Connecting to " + wsUri);
+ websocket = new WebSocket(wsUri);
+ //localStorage.notifySocket = JSON.stringify(websocket);
+ //window.top.notifySocket = websocket;
+
+ currentUser = _currentUser;
+ remoteUser = _remoteUser;
+ f = socketSend;
+
+
+ }
+
+ //var websocket = JSON.parse(localStorage.notifySocket || "{}") ;
+ if( websocket != null) {
+ websocket.onopen = function(evt) { onOpen(evt); };
+ websocket.onmessage = function(evt) { onMessage(evt); };
+ websocket.onerror = function(evt) { onError(evt); };
+
+ }
+
+ //if(f != undefined)
+ // f();
+
+ //window.top.notifySocket.send("");
+}
+
+
+function socketSend(currentUser, remoteUser) {
+
+
+
+ websocket.send(JSON.stringify({
+ from: currentUser,
+ to: remoteUser
+ }));
+
+ //window.top.notifySocket.send("");
+}
+
+
+
+
+function onOpen(evt) {
+ console.log("onOpen");
+ //writeToScreen("CONNECTED");
+
+ if(f != undefined)
+ f(currentUser, remoteUser);
+
+}
+
+function onMessage(evt) {
+ if (typeof evt.data == "string") {
+ writeToScreen("RECEIVED (text): " + evt.data);
+
+ if(popupService != undefined) {
+ popupService.showMessage("Call Request","You are being contacted by " + JSON.parse(evt.data).from + ". Please click on the online icon and then click view");
+
+ }
+ //if (confirm("You are being contacted by " + JSON.parse(evt.data).from )) {
+
+ //}
+
+ } else {
+ writeToScreen("RECEIVED (binary): " + evt.data);
+ }
+}
+
+function onError(evt) {
+ writeToScreen('<span style="color: red;">ERROR:</span> ' + evt.data);
+}
+
+function writeToScreen(message) {
+ var pre = document.createElement("p");
+ pre.style.wordWrap = "break-word";
+ pre.innerHTML = message;
+ output.append(pre);
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/page-resource.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/page-resource.js
new file mode 100644
index 00000000..8449ecfc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/page-resource.js
@@ -0,0 +1,95 @@
+function loadjscssfile(filename, filetype){
+ if (filetype=="js"){ //if filename is a external JavaScript file
+ var done = false;
+ var script = document.createElement('script');
+ script.src = filename;
+ script.async = false;
+ document.head.appendChild(script);
+ }else if (filetype=="css"){ //if filename is an external CSS file
+ var fileref=document.createElement("link")
+ fileref.setAttribute("rel", "stylesheet")
+ fileref.setAttribute("type", "text/css")
+ fileref.setAttribute("async", false)
+ fileref.setAttribute("href", filename)
+ document.head.appendChild(fileref);
+ }
+}
+
+function loadResource(){
+ //css
+ loadjscssfile("app/fusion/external/ebz/fn-ebz.css", "css");
+ loadjscssfile("app/fusion/external/ebz/sandbox/styles/demo.css", "css");
+ loadjscssfile("app/fusion/external/ebz/sandbox/styles/base.css", "css");
+ loadjscssfile("app/fusion/external/ebz/sandbox/styles/btn.css", "css");
+ loadjscssfile("app/fusion/external/ebz/sandbox/styles/dtpk.css", "css");
+ loadjscssfile("app/fusion/external/ebz/sandbox/styles/frms.css", "css");
+ loadjscssfile("app/fusion/external/ebz/sandbox/styles/sldr.css", "css");
+ loadjscssfile("app/fusion/external/ebz/sandbox/styles/style.css", "css");
+ loadjscssfile("app/fusion/external/ebz/sandbox/styles/tbs.css", "css");
+ loadjscssfile("app/fusion/external/ebz/ebz_header/portal_ebz_header.css", "css");
+ loadjscssfile("static/fusion/css/jquery-ui.css", "css");
+
+
+ loadjscssfile("app/fusion/external/ebz/ebz_header/header.css", "css");
+ loadjscssfile("app/fusion/external/ebz/ebz_header/footer.css", "css");
+ // Basic AngularJS -->
+ loadjscssfile("app/fusion/external/ebz/angular_js/angular.js", "js");
+ loadjscssfile("app/fusion/external/ebz/angular_js/angular-sanitize.js", "js");
+ loadjscssfile("app/fusion/external/ebz/angular_js/angular-route.min.js", "js");
+ loadjscssfile("app/fusion/external/ebz/angular_js/angular-cookies.js", "js");
+ loadjscssfile("app/fusion/external/ebz/angular_js/gestures.js", "js");
+ loadjscssfile("app/fusion/external/ebz/angular_js/app.js", "js");
+
+ loadjscssfile("app/fusion/external/ebz/sandbox/att-abs-tpls.js", "js");
+
+ // jQuery -->
+ loadjscssfile("static/js/jquery-1.10.2.js", "js");
+ loadjscssfile("static/js/jquery.mask.min.js", "js");
+ loadjscssfile("static/js/jquery-ui.js", "js");
+
+ // AngularJS Gridster -->
+ loadjscssfile("static/fusion/js/att_angular_gridster/ui-gridster-tpls.js", "js");
+ loadjscssfile("static/fusion/js/att_angular_gridster/angular-gridster.js", "js");
+
+ // AngularJS Config -->
+ loadjscssfile("app/fusion/external/ebz/angular_js/checklist-model.js", "js");
+
+ // Utility -->
+ loadjscssfile("app/fusion/scripts/modalService.js", "js");
+ loadjscssfile("app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js", "js");
+
+ // Controller js -->
+ loadjscssfile("app/fusion/scripts/controllers/profile-search-controller.js", "js");
+ loadjscssfile("app/fusion/scripts/controllers/profile-controller.js", "js");
+ loadjscssfile("app/fusion/scripts/controllers/post-search-controller.js", "js");
+ loadjscssfile("app/fusion/scripts/controllers/self-profile-controller.js", "js");
+ loadjscssfile("app/fusion/scripts/controllers/rolefunctionpopupController.js", "js");
+ loadjscssfile("app/fusion/scripts/controllers/modelpopupController.js", "js");
+
+ // Header and Footer -->
+ loadjscssfile("app/fusion/scripts/directives/footer.js", "js");
+ loadjscssfile("app/fusion/external/ebz/js/footer.js", "js");
+ loadjscssfile("app/fusion/scripts/directives/header.js", "js");
+ loadjscssfile("app/fusion/scripts/directives/leftMenu.js", "js");
+
+ // Services -->
+ loadjscssfile("app/fusion/scripts/services/profileService.js", "js");
+ loadjscssfile("app/fusion/scripts/services/userInfoService.js", "js");
+ loadjscssfile("app/fusion/scripts/services/leftMenuService.js", "js");
+ loadjscssfile("app/fusion/scripts/controllers/profileController.js", "js");
+}
+
+window.onload = loadResource();
+window.onload = function(){
+ var appLoadingInterval = setInterval(function(){ loadApp() }, 500);
+ var count=0;
+ function loadApp(){
+ count++
+ if(typeof angular !== 'undefined') {
+ angular.bootstrap(document, ['abs']);
+ clearInterval(appLoadingInterval);
+ }else if(count>10){
+ clearInterval(appLoadingInterval);
+ }
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/sandbox-resources.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/sandbox-resources.html
new file mode 100644
index 00000000..d04eba9c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/sandbox-resources.html
@@ -0,0 +1,9 @@
+
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/demo.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/base.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/btn.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/dtpk.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/frms.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/sldr.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/tbs.css" >
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/admin.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/admin.html
new file mode 100644
index 00000000..f83888d9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/admin.html
@@ -0,0 +1,115 @@
+<!DOCTYPE html>
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<html>
+ <head>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta http-equiv="cache-control" content="max-age=0" />
+ <meta http-equiv="cache-control" content="no-cache" />
+ <meta http-equiv="expires" content="0" />
+ <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
+ <meta http-equiv="pragma" content="no-cache"/>
+ <!-- CSS -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/fn-ebz.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/demo.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/base.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/btn.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/dtpk.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/frms.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/sldr.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/tbs.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/portal_ebz_header.css">
+ <link rel="stylesheet" type="text/css" href="static/fusion/css/jquery-ui.css">
+ <!-- Basic AngularJS -->
+ <script src= "app/fusion/external/ebz/angular_js/angular.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/angular-sanitize.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/angular-route.min.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/angular-cookies.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/app.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/gestures.js"></script>
+ <script src= "app/fusion/external/ebz/sandbox/att-abs-tpls.js" type="text/javascript"></script>
+ <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/0.10.0/lodash.min.js"></script>
+ <script src="app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js"></script>
+
+ <!-- jQuery -->
+ <script src="static/js/jquery-1.10.2.js"></script>
+ <script src="static/js/jquery.mask.min.js" type="text/javascript"></script>
+ <script src="static/js/jquery-ui.js" type="text/javascript"></script>
+ <!-- AngularJS Gridster -->
+ <script src="static/fusion/js/att_angular_gridster/ui-gridster-tpls.js"></script>
+ <script src="static/fusion/js/att_angular_gridster/angular-gridster.js"></script>
+ <!-- AngularJS Config -->
+ <script src= "app/fusion/external/ebz/angular_js/app.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/checklist-model.js"></script>
+ <!-- Utility -->
+ <script src="app/fusion/scripts/modalService.js"></script>
+ <!-- Controller js -->
+ <script src="app/fusion/scripts/controllers/fn_menu_add_popup_controller.js"></script>
+ <script src="app/fusion/scripts/controllers/admin_menu_edit.js"></script>
+ <script src="app/fusion/scripts/controllers/profile-search-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/profile-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/post-search-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/role-list-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/role-function-list-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/rolefunctionpopupController.js"></script>
+ <script src="app/fusion/scripts/controllers/modelpopupController.js"></script>
+ <script src="app/fusion/scripts/controllers/jcs-admin-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/broadcast-list-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/broadcast-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/usage-list-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/collaborate-list-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/role-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/rolepopupmodelController.js"></script>
+ <!-- Header and Footer -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/header.css">
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/footer.css" >
+ <script src="app/fusion/scripts/directives/footer.js"></script>
+ <script src="app/fusion/external/ebz/js/footer.js"></script>
+ <script src="app/fusion/scripts/directives/header.js"></script>
+ <script src="app/fusion/scripts/directives/leftMenu.js"></script>
+ <script src="app/fusion/scripts/services/leftMenuService.js"></script>
+ <link rel="import" href="app/fusion/scripts/view-models/header.html">
+ <!-- Services -->
+ <script src="app/fusion/scripts/services/profileService.js"></script>
+ <script src="app/fusion/scripts/services/adminService.js"></script>
+ <script src="app/fusion/scripts/services/userInfoService.js"></script>
+ <!-- Controller -->
+ <script src="app/fusion/scripts/controllers/adminController.js"></script>
+ <!-- other js lib -->
+ <script type="text/javascript" src="app/fusion/scripts/socket/peerBroadcast.js"></script>
+ <script src="app/fusion/scripts/moment.min.js"></script>
+
+ <!-- Icon -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ionicons-2.0.1/css/ionicons.css" />
+
+ </head>
+ <body class="appBody" ng-app="abs">
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_add.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_role.html'"></div>
+ <div q-header></div>
+ <div q-menu class="appLeftMenu"></div>
+ <div ng-view id="rightContentAdmin" style="min-height: 450px;margin-top:-100px;margin-left:210px;"></div>
+ <div q-footer class="appFooter"></div>
+ </body>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/profile.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/profile.html
new file mode 100644
index 00000000..56c06ebc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/profile.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<html>
+ <head>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
+ <meta http-equiv="cache-control" content="max-age=0" />
+ <meta http-equiv="cache-control" content="no-cache" />
+ <meta http-equiv="expires" content="0" />
+ <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
+ <meta http-equiv="pragma" content="no-cache" />
+
+ <!-- Resources -->
+ <script src= "app/fusion/scripts/utils/page-resource.js"></script>
+
+ <script>
+ loadjscssfile("app/fusion/scripts/controllers/profileController.js", "js");
+ </script>
+
+ <!-- Icon -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ionicons-2.0.1/css/ionicons.css" />
+
+ </head>
+ <body class="appBody">
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal.html'"></div>
+ <div q-header></div>
+ <div q-menu class="appLeftMenu"></div>
+ <div ng-view id="rightContentProfile" style="min-height: 450px;margin-top:-50px;margin-left:210px;margin-right:110px;"></div>
+ <div q-footer class="appFooter"></div>
+ </body>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/footer.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/footer.html
new file mode 100644
index 00000000..56148731
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/footer.html
@@ -0,0 +1,42 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<div>
+
+<div class="footerContainer" id="footerContainer" style="z-index:1000">
+ <div class="footerWrapper" id="footerWrapper">
+
+ <div class="footerItem">
+
+ </div>
+ <div class="attFooterInfo">
+ <div class="footerLastSection">
+ <div id="attFooterLogo" class="attLogo" tabindex='0'></div>
+
+ <br>
+ <div class="privacyPolicy">
+
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/header.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/header.html
new file mode 100644
index 00000000..adb5be35
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/header.html
@@ -0,0 +1,186 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div style="position: relative; z-index: 999;">
+ <div class="headerContainer" id="headerContainer" ng-show="{{showHeader}}">
+ <div style="position: relative; z-index: 999;">
+ <div class="headerContainer" id="headerContainer">
+ <div id="megaMenuContainer" class="megaMenuContainer" style="margin-top: 0; overflow: visible;">
+ <!--for mega Menu-->
+ <!-- Mega Menu parent-tab directive with three models menu-items, active-sub-menu, active-menu -->
+ <div id="topMenu" class="top-megamenu" ng-mouseleave="activeClickSubMenu.x.active=false; activeClickMenu.x.active=false" >
+ <div style="float:left;width:100%;"parent-tab menu-items="megaMenuDataObject" active-sub-menu='activeClickSubMenu.x' active-menu='activeClickMenu.x'>
+ <div parentmenu-tabs mega-menu="true" menu-items="megaMenuDataObject" style="height:55px;">
+ <div style="float:left">
+ <li class="megamenu__item" style="line-height:55px;" ng-click="returnToPortal()">
+ <div></div>
+ <strong style="font-weight: 400 !important; font-family: Arial !important; font-size: 18px;" >ECOMP Portal</strong>
+ </li>
+ <div menu-tabs mega-menu="true" tab-name="item.text" menu-item="item"
+ active-menu="activeClickMenu.x"
+ ng-repeat="item in megaMenuDataObject"
+ style="font-size: 18px;"
+ ng-mousedown="loadFavorites()">
+ <div parentmenu-tabs sub-menu="true" ng-show="activeClickMenu.x.active && item.active"
+ menu-items="activeClickMenu.x.children">
+
+ <!-- Second level menu -->
+ <div menu-tabs sub-menu="true" tab-name="subItem.text"
+ tab-url="subItem.url" menu-item="subItem"
+ ng-repeat="subItem in activeClickMenu.x.children | orderBy : 'column'" active-menu="activeClickSubMenu.x"
+ sub-item-active="{{subItem.active}}" style="float:left;" aria-label="{{subItem.text}}"
+ ng-mouseenter="submenuLevelAction(subItem.text,subItem.column)"
+ ng-mouseleave="submenuLevelAction(subItem.text,subItem.column)"
+ ng-click="submenuLevelAction(subItem.text,subItem.column)" >
+ <i ng-if="subItem.text=='Favorites'" id="favorite-star"
+ class="icon-star favorites-icon-active">
+ </i>
+ </div>
+ <div class="sub__menu" ng-mouseleave="activeClickSubMenu.x.active=false" >
+ <ul ng-show="activeClickSubMenu.x.active" role="menubar" class="columns">
+ <!-- Third level menu -->
+ <div menu-tabs
+ menu-item="subItem"
+ class="columns-div"
+ ng-repeat="subItem in activeClickSubMenu.x.children | orderBy : 'column'"
+ ng-show="activeClickSubMenu.x.active">
+
+ <i id="favorite-selector-third-level"
+ ng-show="isUrlFavorite(subItem.menuId)==false"
+ class="icon-star favorites-icon-inactive"
+ ng-if="subItem.url.length > 1">
+ </i>
+ <i id="favorite-selector-third-level"
+ ng-show="isUrlFavorite(subItem.menuId)"
+ class="icon-star favorites-icon-active"
+ ng-if="subItem.url.length > 1">
+ </i>
+ <span class="title" aria-label="{{subItem.text}}"
+ ng-click="goToUrl(subItem)">{{subItem.text}}</span>
+ <!-- Fourth level menus -->
+ <div att-links-list="">
+ <i id="favorite-selector-fourth-level"
+ class="icon-star favorites-icon-inactive"
+ ng-show="isUrlFavorite(tabValue.menuId)==false"
+ ng-if="tabValue.url.length > 1">
+
+ </i>
+ <i id="favorite-selector-fourth-level"
+ class="icon-star favorites-icon-active"
+ ng-show="isUrlFavorite(tabValue.menuId)"
+ ng-if="tabValue.url.length > 1">
+
+ </i>
+ <span role="menuitem" att-links-list-item=""
+ ng-repeat="tabValue in subItem.children"
+ ng-click="goToUrl(tabValue)"
+ att-accessibility-click="13,32"
+ ng-class="{'disabled': tabValue.disabled}">{{tabValue.text}}</span>
+ </div>
+ <hr ng-show="!$last"/>
+ </div>
+ </ul>
+ <!-- Favorites level menu -->
+ <div class="favorites-window" ng-show='favoritesWindow' ng-mouseleave="hideFavoritesWindow()">
+ <div id="favorites-menu-items" ng-show="showFavorites">
+ <div ng-repeat="subItem in favoritesMenuItems"
+ att-links-list=""
+ style='display: inline'>
+ <i id="favorite-selector-favorites-list"
+ class="icon-star favorites-icon-active"
+ >
+ </i>
+ <a id="favorites-list" aria-label="{{subItem.text}}"
+ ng-click="goToUrl(subItem)"
+ style="margin-left: 3px; margin-right: 20px; text-decoration: none; color: #666666;">
+ {{subItem.text}}
+ </a>
+ </div>
+ <div>
+ <br>
+ <p style='font-weight: 400; font-family: Arial !important;
+ font-size: 18px; text-align: center; background-color: lightgray;
+ width: 400px; margin-left: 25%; margin-right: 25%;'>
+ Manage favorites on ECOMP Portal.
+ </p>
+ </div>
+ </div>
+ <!-- Favorites when empty -->
+ <div id="favorites-empty" ng-show="emptyFavorites" class="favorites-window-empty">
+ <div>
+ <img src="app/fusion/external/ebz/images/no_favorites_star.png">
+ <p class='favoritesLargeText'>No Favorites</p>
+ <p class='favoritesNormalText'>Manage favorites on ECOMP Portal.</p>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div >
+ <li class="megamenu__item" style="line-height:55px;" ng-if="loadMenufail">
+ <strong style="font-weight: 400 !important; font-family: Arial !important; font-size: 18px;" >Unable to load menus</strong>
+ </li>
+ <div style="float:right">
+ <li id="bcLoginSnippet" class="megamenu__item" style="width: 140px;" >
+ <div popover="loginSnippet.html" aria-label="Login Snippet"
+ referby="loginSnippet" att-accessibility-click="13,32" popover-style="\" popover-placement="below" style="width: 200px;">
+ <div class="ion-android-person login-snippet-icon" style="display:inline-block"></div>
+ <div class="login-snippet-text" style="display: inline-block; font-size:12px; margin-left:5px;overflow: hidden; max-height: 31px; overflow: hidden; max-height: 31px; max-width:120px; padding-top: 0px; margin-top: 0px; white-space: nowrap;">{{userFirstName}}</div>
+ </div>
+ </li>
+ <li class="megamenu__item" style="width:120px;">&nbsp;</li>
+ </div>
+
+ </div>
+
+ </div>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+<script type="text/ng-template" id="loginSnippet.html">
+ <div style="line-height: normal; right: 167px; min-height: 200px; height: auto; width: auto; " ng-controller="loginSnippetCtrl" >
+ <div id="reg-header-snippet">
+ <div class="reg-profilePicture" style="min-height: 215px; width: auto; " id="reg-profile-links">
+ <div id="reg-profileImage">
+ <div style="clear: both; height: 80px; position: relative; width: 80px;">
+ <span style=" background-position: -1px -1px; height: 81px;left: 0;position: absolute;top: 0;width: 81px;">&nbsp;</span>
+ </div>
+ </div>
+ <div id="reg-logout-div">
+ <a class="reg-logout-btn" href="logout.htm">Log Out</a>
+ </div>
+ </div>
+ <div tabindex="0" class="reg-profileDetails" id="reg-profiledetails-id">
+ <ul class="reg-Details-table" style="list-style: none;">
+ <li><div class="reg-userName-table"><div id="reg-userName-table-row"><div id="reg-userName-table-cell"><h3 class="att-global-fonts" style="font-size:18px !important;" id="reg-userName">{{userProfile.fullName}}&nbsp;</h3><span class="visuallyhidden">.</span></div></div></div></li>
+ <li><div class="reg-userEmail-label"><span class="reg-userEmail-label-spn">EMAIL<span class="visuallyhidden">:</span></span></div></li>
+ <li><div class="reg-userEmail-value"><span class="reg-userEmail-value-spn">{{userProfile.email}}<span class="visuallyhidden">.</span></span></div></li>
+ <li><div class="reg-userRole-label"><span class="reg-userRole-label-spn">User ID<span class="visuallyhidden">:</span></span></div></li>
+ <li><div class="reg-userRole-value"><span class="reg-userRole-value-spn">{{userProfile.orgUserId}}<span class="visuallyhidden"></span></span></div></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/left_menu.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/left_menu.html
new file mode 100644
index 00000000..84ee6ead
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/left_menu.html
@@ -0,0 +1,41 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div ng-cloak>
+ <span ng-style="adjustHLeftMenu('burgerIcon')" style="z-index:998; position:fixed; left:0%; font-size:35px; margin-left:10px;text-decoration:none;">
+ <a ng-click="toggleDrawer();isOpen = !isOpen" href="javascript:void(0);" class="arrow-icon-left" >
+ <span class="ion-navicon-round"></span></a>
+ <span ng-init="isOpen = true" ng-show="isOpen" style="font-size:16px; position:relative; top:-8px; left:-15px;">&nbsp&nbsp&nbsp {{app_name}}</span>
+ </span>
+ <div att-drawer drawer-slide="left" drawer-custom-top="{{drawer_custom_top}}px" drawer-size="200px" drawer-open="drawerOpen" drawer-custom-height="100%" >
+ <div ng-style="adjustHLeftMenu('leftMenu')">
+ <div class="attDrawer" style="z-index:998">
+ <div class="appLeftMenuAccordDiv">
+ <accordion close-others="true" css="att-accordion--no-box">
+ <accordion-group ng-repeat="parent in leftMenuItems" heading="{{parent.parentLabel}}" parent-link="{{parent.parentAction}}" image-source="{{parent.parentImageSrc}}" child-length="{{parent.childItemList.length}}" is-open="parent.open">
+ <div ng-repeat="subMenu in parent.childItemList" style="font-size:12px; margin-left:10px;">
+ <a href="{{subMenu.action}}" style="font-size:12px; color:#666666;" >{{subMenu.label}}</a>
+ </div>
+ </accordion-group>
+ </accordion>
+ </div>
+ </div>
+ </div>
+ </div>
+</div> \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/admin_menu_edit.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/admin_menu_edit.html
new file mode 100644
index 00000000..ee23635f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/admin_menu_edit.html
@@ -0,0 +1,175 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<div ng-controller="AdminMenuEditController" >
+ <div class="pageTitle">
+ <br>
+ <h1 class="heading1" style="margin-left:0px">Admin Menu Items</h1>
+ <br/>
+ <div style="margin-right: 20px;text-align: justify;text-align-last:auto;">
+ <strong>Add menu item here:</strong>
+ </div>
+ <br/>
+ <a ng-click="addNewFnMenuItemModalPopup();" class="ion-android-apps" style="font-size:40px;" ></a>
+ </div>
+ <br>
+ <div style="margin-right: 20px;text-align: justify;text-align-last:auto;">
+ <strong>Existing menu items:</strong>
+ </div>
+ <br>
+
+
+
+<div style="width: 30%;">
+<table>
+ <tr>
+ <div style="width: 60%;">
+ <td>Number of records to show:</td>
+ </div>
+ <td>
+ <div style="width: 40%;">
+ <input type="text" id="numberOfRecordstoShow" name="numberOfRecordstoShow" ng-model="numberOfRecordstoShow">
+ </div>
+ </td>
+ </tr>
+</table>
+
+</div>
+
+<!-- freeze header
+<div class="scrolling-table" style="width: 100%;">
+ <table att-table table-data="fnMenuItems" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+ <thead att-table-row>
+ <tr align="left">
+ <th att-table-header sortable="true" key="id" default-sort="a">Menu ID</th>
+ <th att-table-header sortable="true" key="label">Label</th>
+ <th att-table-header sortable="true" key="ParentId">ParentId</th>
+ <th att-table-header sortable="true" key="sortOrder">Sort Order</th>
+ <th att-table-header sortable="true" key="action">Action</th>
+ <th att-table-header sortable="true" key="functionCd">Function</th>
+ <th att-table-header sortable="true" key="active">Active</th>
+ <th att-table-header sortable="true" key="servlet">Servlet</th>
+ <th att-table-header sortable="true" key="queryString">Query String</th>
+ <th att-table-header sortable="true" key="externalUrl">External URL</th>
+ <th att-table-header sortable="true" key="target">Target</th>
+ <th att-table-header sortable="true" key="menuSetCode">Menu Set Code</th>
+ <th att-table-header sortable="true" key="separator">Separator</th>
+ <th att-table-header sortable="true" key="imageSrc">Image Source</th>
+
+ <th att-table-header sortable="false" key="edit">Edit</th>
+ <th att-table-header sortable="false" key="delete">Delete</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" >
+ <tr>
+ <td id="att-scroll-table-content" att-scrollbar style="width: 86.5%;padding-right:1%;">
+ <table att-table table-data="fnMenuItems" border="1" view-per-page="scrollViewsPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+ <tbody att-table-row type="body" row-repeat="fnMenuItem in fnMenuItems | limitTo : numberOfRecordstoShow">
+ <tr align="left">
+ <td att-table-body width="1%" >{{ fnMenuItem.id }}</td>
+ <td att-table-body width="3%" align="left" style="word-break:break-all;">{{ fnMenuItem.label }}</td>
+ <td att-table-body width="1%" align="left">{{ fnMenuItem.parentId }}</td>
+ <td att-table-body width="1%" align="left">{{ fnMenuItem.sortOrder }}</td>
+ <td att-table-body width="3%" style="word-break:break-all;">{{ fnMenuItem.action }}</td>
+ <td att-table-body width="1%" style="word-break:break-all;">{{ fnMenuItem.functionCd }}</td>
+ <td att-table-body width="1%" style="word-break:break-all;" align="left">{{ fnMenuItem.active ? "Y" : "N"}}</td>
+ <td att-table-body width="3%" style="word-break:break-all;" align="left">{{ fnMenuItem.servlet }}</td>
+ <td att-table-body width="3%" style="word-break:break-all;" align="left">{{ fnMenuItem.queryString }}</td>
+ <td att-table-body width="3%" style="word-break:break-all;" align="left">{{ fnMenuItem.externalUrl }}</td>
+ <td att-table-body width="3%" style="word-break:break-all;" align="left">{{ fnMenuItem.target }}</td>
+ <td att-table-body width="3%" style="word-break:break-all;" align="left">{{ fnMenuItem.menuSetCode }}</td>
+ <td att-table-body width="3%" style="word-break:break-all;" align="left">{{ fnMenuItem.separator ? "Y" : "N"}}</td>
+ <td att-table-body width="3%" style="word-break:break-all;" align="left">{{ fnMenuItem.imageSrc }}</td>
+
+ <td att-table-body width="1%" align="right">
+ <div ng-click="editMenuItemModalPopup(fnMenuItem);" style="font-size:20px;"><a href="javascript:void(0)" class="icon-edit"></a></div>
+ </td>
+ <td att-table-body width="1%" align="right">
+ <div ng-click="removeMenuItem(fnMenuItem);" style="font-size:20px;"><a href="javascript:void(0)" class="icon-trash"></a></div>
+ </td>
+
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+
+
+
+<br><br><br><br><br><br><br><br><br><br><br><br>
+
+-->
+ <div id="menusTable" title="Menu Items">
+ <table att-table table-data="fnMenuItems" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="true" key="id" default-sort="a">Menu ID</th>
+ <th att-table-header sortable="true" key="label">Label</th>
+ <th att-table-header sortable="true" key="ParentId">ParentId</th>
+ <th att-table-header sortable="true" key="sortOrder">Sort Order</th>
+ <th att-table-header sortable="true" key="action">Action</th>
+ <th att-table-header sortable="true" key="functionCd">Function</th>
+ <th att-table-header sortable="true" key="active">Active</th>
+ <th att-table-header sortable="true" key="servlet">Servlet</th>
+ <th att-table-header sortable="true" key="queryString">Query String</th>
+ <th att-table-header sortable="true" key="externalUrl">External URL</th>
+ <th att-table-header sortable="true" key="target">Target</th>
+ <th att-table-header sortable="true" key="menuSetCode">Menu Set Code</th>
+ <th att-table-header sortable="true" key="separator">Separator</th>
+ <th att-table-header sortable="true" key="imageSrc">Image Source</th>
+
+ <th att-table-header sortable="false" key="edit">Edit</th>
+ <th att-table-header sortable="false" key="delete">Delete</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="fnMenuItem in fnMenuItems | limitTo : numberOfRecordstoShow">
+ <tr>
+ <td att-table-body width="1%" style="word-break:break-all;" ng-bind="fnMenuItem.id"></td>
+ <td att-table-body width="3%" style="word-break:break-all;" ng-bind="fnMenuItem.label"></td>
+ <td att-table-body width="1%" style="word-break:break-all;" ng-bind="fnMenuItem.parentId"></td>
+ <td att-table-body width="1%" style="word-break:break-all;" ng-bind="fnMenuItem.sortOrder"></td>
+ <td att-table-body width="3%" style="word-break:break-all;" ng-bind="fnMenuItem.action"></td>
+ <td att-table-body width="1%" style="word-break:break-all;" ng-bind="fnMenuItem.functionCd"></td>
+ <td att-table-body width="1%" style="word-break:break-all;" ng-bind="fnMenuItem.active ? 'Y' : 'N'"></td>
+ <td att-table-body width="3%" style="word-break:break-all;" ng-bind="fnMenuItem.servlet"></td>
+ <td att-table-body width="3%" style="word-break:break-all;" ng-bind="fnMenuItem.queryString"></td>
+ <td att-table-body width="3%" style="word-break:break-all;" ng-bind="fnMenuItem.externalUrl"></td>
+ <td att-table-body width="3%" style="word-break:break-all;" ng-bind="fnMenuItem.target"></td>
+ <td att-table-body width="3%" style="word-break:break-all;" ng-bind="fnMenuItem.menuSetCode"></td>
+ <td att-table-body width="3%" style="word-break:break-all;" ng-bind="fnMenuItem.separator ? 'Y' : 'N'"></td>
+ <td att-table-body width="3%" style="word-break:break-all;" ng-bind="fnMenuItem.imageSrc"></td>
+
+ <td att-table-body width="1%">
+ <div ng-click="editMenuItemModalPopup(fnMenuItem);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-edit"></a></div>
+ </td>
+ <td att-table-body width="1%">
+ <div ng-click="removeMenuItem(fnMenuItem);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </td>
+ </tr>
+ </tbody>
+
+ </table>
+ </div>
+
+
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast.html
new file mode 100644
index 00000000..a14da056
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast.html
@@ -0,0 +1,61 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div style="width:80%;margin-bottom:20px">
+ <br/>
+ <h1 class="heading1">Broadcast Message Edit</h1>
+ <br/>
+
+ <div ng-controller="broadcastController" >
+ Please edit the broadcast message details below:&nbsp;<br><br>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Message Text:</label><BR>
+ <textarea name="comment" ng-model="broadcastMessage.messageText" rows="5" cols="200" style="height:100px"></textarea>
+ </div>
+ <br>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Start Date:</label><BR>
+ <input type="hidden" name="startDateHidden" ng-model="broadcastMessage.startDate">
+ <input type="text" class="fn-ebz-text" id="startDatepicker" />
+ </div>
+
+ <div class="fn-ebz-container" style="margin-left:3em" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>End Date:</label><BR>
+ <input type="hidden" name="endDateHidden" ng-model="broadcastMessage.endDate">
+ <input type="text" class="fn-ebz-text" id="endDatepicker" />
+ </div>
+
+ <div class="fn-ebz-container" style="margin-left:3em" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Sort Order:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="broadcastMessage.sortOrder"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" style="margin-left:1em" >
+ <label class="fn-ebz-text-label">Server:</label><BR>
+ <div class="form-field" att-select="broadcastSites" ng-model="broadcastMessage.siteCd"></div>
+ </div>
+
+ <br>
+ <div align="left" >
+ <button type="submit" ng-click="save();" att-button btn-type="primary" size="small">Save</button>
+ <button class="button button--information button--small" herf="javascript:void(0)" ng-click="close();">Cancel</button>
+ </div>
+ </div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast_list.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast_list.html
new file mode 100644
index 00000000..e9c4c291
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast_list.html
@@ -0,0 +1,71 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div style="width:80%;">
+
+<div ng-controller="broadcastListController" >
+
+ <h1 class="heading1">Broadcast Messages</h1>
+ <br>
+ <div ng-repeat="location in messageLocations" >
+ {{location.label}} Messages
+ <div title="{{location.label}} Messages">
+
+ <table att-table table-data="location.messages" current-page="1">
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" width="10%">No.</th>
+ <th att-table-header sortable="false" width="30%">Message Text</th>
+ <th att-table-header sortable="false" width="10%">Start Date</th>
+ <th att-table-header sortable="false" width="10%">End Date</th>
+ <th att-table-header sortable="false" width="10%">Sort Order</th>
+ <th att-table-header sortable="false" width="10%">Server</th>
+ <th att-table-header sortable="false" width="10%">Active?</th>
+ <th att-table-header sortable="false" width="10%">Delete?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="message in location.messages" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr>
+ {{message.id}}
+ <td width="10%"><a href="javascript:editMessage({{location.value}},'{{location.label}}',{{message.id}});">{{$index+1}}</a></td>
+ <td width="30%">{{message.messageText}}</td>
+ <td width="10%">
+ {{message.displayStartDate}}
+ </td>
+ <td width="10%">{{message.displayEndDate}}</td>
+ <td width="10%">{{message.sortOrder}}</td>
+ <td width="10%">{{message.siteCd}}</td>
+ <td width="10%">
+ <div ng-click="toggleActive(message);">
+ <input type="checkbox" ng-model="message.active" att-toggle-main ng-true-value="on" ng-false-value="off">
+ </div>
+ </td>
+ <td att-table-body width="10%">
+ <div ng-click="remove(message);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+ </div>
+ <input att-button btn-type="primary" size="small" class="button" type="button" value="Add" ng-click="editMessage(location);"/>
+ <br/><br/><br/>
+ </div>
+ </div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/collaborate_list.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/collaborate_list.html
new file mode 100644
index 00000000..5f07a47b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/collaborate_list.html
@@ -0,0 +1,57 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div ng-controller="collaborateListController">
+ <div>
+ <h1 class="heading1" style="margin-top:20px;">User List</h1>
+ <div style="margin-top:30px">
+ <table att-table table-data="tableData" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header key="id">User ID</th>
+ <th att-table-header key="lastName">Last Name</th>
+ <th att-table-header key="firstName">First Name</th>
+ <th att-table-header key="email">Email</th>
+ <th att-table-header key="orgUserId">User ID</th>
+ <th att-table-header key="online">Online/Offline</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="rowData in tableData">
+ <tr>
+ <td att-table-body ng-bind="rowData['id']">{{rowData.id}}</td>
+ <td att-table-body ng-bind="rowData['lastName']">{{rowData.lastName}}</td>
+ <td att-table-body ng-bind="rowData['firstName']">{{rowData.firstName}}</td>
+ <td att-table-body ng-bind="rowData['email']">{{rowData.email}}</td>
+ <td att-table-body ng-bind="rowData['orgUserId']">{{rowData.orgUserId}}</td>
+ <td att-table-body >
+ <tag-badges ng-hide="rowData.online" style-type="color" class="lred" ng-click="rowData.isActive=true;openCollaboration(rowData.chatId)">Offline</tag-badges>
+ <tag-badges ng-show="rowData.online" style-type="color" class="lgreen" ng-click="rowData.isActive=false;openCollaboration(rowData.chatId)">Online</tag-badges>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <input ng-model="currentPage"></input>
+
+ <a href="JavaScript:void(0);" style= "color:#00547A" onClick="window.open('https://chrome.google.com/webstore/detail/icgmlogfeajbfdffajhoebcfbibfhaen')" id="install-button">
+ Add the Chrome Extension for DescktopCapture and refresh page</a>
+</div>
+<div id="peerBroadcastSection"></div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/jcs_admin.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/jcs_admin.html
new file mode 100644
index 00000000..7da45780
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/jcs_admin.html
@@ -0,0 +1,87 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div ng-controller="cacheAdminController">
+
+ <h1 class="heading1" >Cache Regions</h1>
+ <br/>
+ <div style="margin-right:20px;text-align: justify;text-align-last:auto;">
+ These are the regions which are currently defined in the cache. 'Items' and 'Bytes' refer to the elements currently in memory (not spooled).
+ You can clear all items for a region by clicking on the Clear icon next to the desired region below. You can also <a href="#" ng-click="clearAll();">clear all regions</a>
+ which empties the entire cache.
+ </div>
+
+ <div style="width: 86%; border-top: 1px solid #c4c4c4; margin-top: 0px; margin-bottom:30px; margin-right: 20px; background-color: #fff; padding: 10px 0; color: #646464s">
+ <div style="margin: 0 20px 10px 0px; font-size: 80%; float: left; width: 97%;">
+ <div class="col-md-4"><b>Cache Name</b></div>
+ <div class="col-md-2"><b># of Items</b></div>
+ <div class="col-md-2"><b>Bytes</b></div>
+ <div class="col-md-2"><b>Status</b></div>
+ <div class="col-md-3"><b>Memory Hits</b></div>
+ <div class="col-md-3"><b>Aux Hits</b></div>
+ <div class="col-md-3"><b>Not Found Misses</b></div>
+ <div class="col-md-3"><b>Expired Misses</b></div>
+ <div class="col-md-1"><b>Clear?</b></div>
+ <div class="col-md-1"><b>Items</b></div>
+ </div>
+ <div ng-repeat="region in regions">
+ <div style="margin: 0 20px 10px 0px; font-size: 80%; float: left; width: 97%;">
+ <div class="col-md-4"><a href="#" tooltip="Click to Show Region Details" ng-click="showRegionDetails(region.cacheName);">{{region.cacheName}}</a></div>
+ <div class="col-md-2">{{region.size}}</div>
+ <div class="col-md-2">{{region.byteCount}}</div>
+ <div class="col-md-2">{{region.status}}</div>
+ <div class="col-md-3">{{region.hitCountRam}}</div>
+ <div class="col-md-3">{{region.hitCountAux}}</div>
+ <div class="col-md-3">{{region.missCountNotFound}}</div>
+ <div class="col-md-3">{{region.missCountExpired}}</div>
+ <div class="col-md-1">
+ <div ng-click="clearRegion(region.cacheName);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </div>
+ <div class="col-md-1">
+ <span class="ion-plus-circled col-md-1" ng-class="{minus: bling$index}" ng-hide="plusSign" ng-click="bling$index = !bling$index; plusSign=true" style="display: block;"></span>
+ <span class="ion-minus-circled col-md-1" ng-class="{minus: bling$index}" ng-show="plusSign" ng-click="bling$index = !bling$index; plusSign=false" style="display: block;"></span>
+ </div>
+ </div>
+ <div style="margin: 0px 20px 0px 30px; font-size: 80%; float: left; width: 95%; border-top: 1px solid #e4e4e4; padding-top: 10px"
+ ng-show="bling$index">
+ <span class="att--tree__arrow" style="height: 20px; width: 20px; display: inline-block; float: left"></span>
+ <div class="col-md-12"><b>Key</b></div>
+ <div class="col-md-2"><b>Eternal?</b></div>
+ <div class="col-md-4"><b>Created</b></div>
+ <div class="col-md-2"><b>Max Life</b></div>
+ <div class="col-md-2"><b>Expires</b></div>
+ <div class="col-md-1"><b>Clear?</b></div>
+ </div>
+ <div ng-repeat="item in region.items">
+ <div style="margin: 0px 20px 0px 30px; font-size: 80%; float: left; width: 95%;" ng-show="bling$index">
+ <span class="att--tree__arrow" style="height: 20px; width: 20px; display: inline-block; float: left"></span>
+ <div class="col-md-12"><a href="#" tooltip="Click to Show Item Details" ng-click="showItemDetails(region.cacheName,item.key);">{{item.key}}</a></div>
+ <div class="col-md-2">{{item.eternal}}</div>
+ <div class="col-md-4">{{item.createTime}}</div>
+ <div class="col-md-2">{{item.maxLifeSeconds}}</div>
+ <div class="col-md-2">{{item.expiresInSeconds}}</div>
+ <div class="col-md-1">
+ <div ng-click="clearItem(region.cacheName,item.key);" style="font-size:20px;"><a href="javascript:void(0)" class=""></a></div>
+ </div>
+ </div>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ </div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal.html
new file mode 100644
index 00000000..3cde902c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal.html
@@ -0,0 +1,282 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<script type="text/ng-template" id="modal_informative.html">
+ <div class="modal__informative font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Success!</h2>
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content" style="white-space: pre-wrap;">{{message.text}}</div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Dismiss</button>
+ </div>
+ </div>
+ </script>
+
+
+ <script type="text/ng-template" id="delete_informative.html">
+ <div class="modal__warning font-showcase">
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are you sure you want to delete the profile?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="email_report_informative.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Mailing your report...</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ The report will be sent to your email soon!
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Ok</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="delete_authCode.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are you sure you want to delete the Authorization Code(s)?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="delete_Schedule.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete This Schedule(s) ?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="alternate_number.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete This Number ?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="manage_device.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete This Line Port ?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="delete_virtualOnNet.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete this Virtual On-Net User?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="delete_user_meet_me_conference.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete this Conference?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="confirmation_informative.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">{{message.title}}</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content" style="white-space: pre-wrap;">{{message.text}}<br/></div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+
+ <script type="text/ng-template" id="confirmation_for_delete.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name"> <h2 class="font-showcase-font-name">Are You Sure You Want to Delete This {{message.title}}?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">Deletions are not reversible. {{message.text}}<br/></div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+
+ <script type="text/ng-template" id="modal_warning.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Unable to process your request!</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content" style="white-space: pre-wrap;">Unable to process your request. <br/>{{message.text}}<br/>
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Dismiss</button>
+ </div>
+ </div>
+ </script>
+
+ <script type="text/ng-template" id="modal_warning_message.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Warning</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content" style="white-space: pre-wrap;">{{message.text}}<br/>
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Dismiss</button>
+ </div>
+ </div>
+ </script>
+
+
+
+ <script type="text/ng-template" id="modal_prompt.html">
+ <div class="modal__warning font-showcase">
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Unable to process your request. </h2>
+ <i class="icon-circle-action-close close-modal modal__header--close" ng-click="$dismiss()"></i>
+
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Unable to process your request. <br/> {{message.text}}
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="delete_device.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete This Device?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
+ <script type="text/ng-template" id="delete_multiple_device.html">
+ <div class="modal__warning font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name">Are You Sure You Want to Delete The Device(s)?</h2>
+
+ <div class="modal__header--icon"></div>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ Deletions are not reversible.<br/> {{message.text}}
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$close()">Yes</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="$dismiss()">Cancel</button>
+ </div>
+ </div>
+ </script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_add.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_add.html
new file mode 100644
index 00000000..760f10b5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_add.html
@@ -0,0 +1,155 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<script type="text/ng-template" id="fn_menu_add_popup.html">
+ <div class="modal__informative font-showcase" style="width:1100px;">
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name" style="width: 500px;">{{label}}</h2>
+ </div>
+ <div class="divider-container"><hr> </div>
+
+ <div class="modal__content" >
+ <table>
+ <tr>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Label:</label><br>
+ <input id="popupAddMenuItemLabel" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.label" maxlength="30" />
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" style = "display:none" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Parent:</label><br>
+ <input id="popupAddMenuItemParentId" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.parentId" ng-disabled="disableParentId" maxlength="30" />
+ </div>
+ <div class="fn-ebz-container" ng-init="getParentData();">
+ <form name="parentListForm">
+ <label class="fn-ebz-text-label" for="parentSelect"><sup><b>*</b></sup>Parent:</label><br>
+ <select name="select_projects" id="select_projects" ng-model="addFnMenuItem.parentId">
+ <optgroup label="" ng-repeat="header in childListSelectData">
+ <option label="{{header.label}}" value="{{header.menuId}}" style="color:black;font-weight:bold;">{{header.label}}</option>
+ <option ng-repeat="child in header.children" value="{{child.menuId}}" "{{(addFnMenuItem.parentId===child.menuId) ? 'selected' : '' }}">{{child.label}}</option>
+ </optgroup>
+ </select>
+ <!--
+ <select class="form-field" name="parentSelect" id="parentSelect" ng-model="addFnMenuItem.parentId">
+ <option>{{getParentLabel(addFnMenuItem.parentId, parentListSelectData)}}</option>
+ <option ng-repeat="option in parentListSelectData" value="{{option[0]}}" "{{(addFnMenuItem.parentId===option[0]) ? 'selected' : '' }}">{{option[1]}}</option>
+ </select>
+ -->
+ </form>
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Sort Order:</label><br>
+ <input id="popupAddMenuItemSortOrder" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.sortOrder" ng-disabled="disableSortOrder" maxlength="30" />
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Action:</label><br>
+ <input id="popupAddMenuItemAction" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.action" ng-disabled="disableAction" maxlength="200" />
+ </div>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <div class="fn-ebz-container" ng-init="getFunctionCDselectData();">
+ <form name="functionCDform">
+ <label class="fn-ebz-text-label" for="repeatSelect"><sup><b>*</b></sup>Function:</label><br>
+ <select class="form-field" name="repeatSelect" id="repeatSelect" ng-model="addFnMenuItem.functionCd">
+ <option>{{addFnMenuItem.functionCd}}</option>
+ <option ng-repeat="option in functionCDselectData" value="{{option}}" >{{option}}</option>
+ </select>
+ </form>
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Active:</label><br>
+ <select class="form-field" name="selectActive" ng-model="addFnMenuItem.active">
+ <option ng-repeat="active in activeStatusOptions" value="{{active.value}}" ng-selected="{{active.value}}=={{addFnMenuItem.active}}" >{{active.title}}</option>
+ </select>
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b></b></sup>Servlet:</label><br>
+ <input id="popupAddMenuItemServlet" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.servlet" ng-disabled="disableServlet" maxlength="30" />
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b></b></sup>Query String:</label><br>
+ <input id="popupAddMenuItemQueryString" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.queryString" ng-disabled="disableQueryString" maxlength="30" />
+ </div>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b></b></sup>External URL:</label><br>
+ <input id="popupAddMenuItemExternalUrl" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.externalUrl" ng-disabled="disableExternalUrl" maxlength="30" />
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b></b></sup>Target:</label><br>
+ <input id="popupAddMenuItemTarget" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.target" ng-disabled="disableTarget" maxlength="30" />
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Menu Set Code:</label><br>
+ <input id="popupAddMenuItemMenuSetCode" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.menuSetCode" ng-disabled="disableMenuSetCode" maxlength="30" />
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Separator:</label><br>
+ <select class="form-field" name="select" ng-model="addFnMenuItem.separator">
+ <option ng-repeat="separator in separatorStatusOptions" value="{{separator.value}}" ng-selected="{{separator.value}}=={{addFnMenuItem.separator}}" >{{separator.title}}</option>
+ </select>
+ </div>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b></b></sup>Image Source:</label><br>
+ <input id="popupAddMenuItemImageSrc" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.imageSrc" ng-disabled="disableImageSrc" maxlength="30" />
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="updateFnMenu(addFnMenuItem);">Save</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="close()">Close</button>
+ <!--
+ <div class="modal__footer">
+ </div>
+ -->
+ </div>
+</script>
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_edit.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_edit.html
new file mode 100644
index 00000000..4c23ba6f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_edit.html
@@ -0,0 +1,148 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<script type="text/ng-template" id="edit_menu_item_popup.html">
+
+ <div class="modal__informative font-showcase" style="width:1100px;">
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name" style="width: 500px;">{{label}}</h2>
+ </div>
+ <div class="divider-container"><hr> </div>
+
+ <div class="modal__content" >
+ <table>
+ <tr>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Label:</label><br>
+ <input id="popupAddMenuItemLabel" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.label" maxlength="30" />
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" style = "display:none" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Parent:</label><br>
+ <input id="popupAddMenuItemParentId" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.parentId" ng-disabled="disableParentId" maxlength="30" />
+ </div>
+ <div class="fn-ebz-container" ng-init="getParentData();">
+ <form name="parentListForm">
+ <label class="fn-ebz-text-label" for="parentSelect"><sup><b>*</b></sup>Parent:</label><br>
+ <select class="form-field" name="parentSelect" id="parentSelect" ng-model="addFnMenuItem.parentId">
+ <option>{{getParentLabel(addFnMenuItem.parentId, parentListSelectData)}}</option>
+ <option ng-repeat="option in parentListSelectData" value="{{option[0]}}" "{{(addFnMenuItem.parentId===option[0]) ? 'selected' : '' }}">{{option[1]}}</option>
+ </select>
+ </form>
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Sort Order:</label><br>
+ <input id="popupAddMenuItemSortOrder" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.sortOrder" ng-disabled="disableSortOrder" maxlength="30" />
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Action:</label><br>
+ <input id="popupAddMenuItemAction" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.action" ng-disabled="disableAction" maxlength="30" />
+ </div>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <div class="fn-ebz-container" ng-init="getFunctionCDselectData();">
+ <form name="functionCDform">
+ <label class="fn-ebz-text-label" for="repeatSelect"><sup><b>*</b></sup>Function:</label><br>
+ <select class="form-field" name="repeatSelect" id="repeatSelect" ng-model="addFnMenuItem.functionCd">
+ <option>{{addFnMenuItem.functionCd}}</option>
+ <option ng-repeat="option in functionCDselectData" value="{{option}}" >{{option}}</option>
+ </select>
+ </form>
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Active:</label><br>
+ <select class="form-field" name="selectActive" ng-model="addFnMenuItem.active">
+ <option ng-repeat="active in activeStatusOptions" value="{{active.value}}" ng-selected="{{active.value}}=={{addFnMenuItem.active}}" >{{active.title}}</option>
+ </select>
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b></b></sup>Servlet:</label><br>
+ <input id="popupAddMenuItemServlet" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.servlet" ng-disabled="disableServlet" maxlength="30" />
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b></b></sup>Query String:</label><br>
+ <input id="popupAddMenuItemQueryString" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.queryString" ng-disabled="disableQueryString" maxlength="30" />
+ </div>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b></b></sup>External URL:</label><br>
+ <input id="popupAddMenuItemExternalUrl" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.externalUrl" ng-disabled="disableExternalUrl" maxlength="30" />
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b></b></sup>Target:</label><br>
+ <input id="popupAddMenuItemTarget" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.target" ng-disabled="disableTarget" maxlength="30" />
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Menu Set Code:</label><br>
+ <input id="popupAddMenuItemMenuSetCode" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.menuSetCode" ng-disabled="disableMenuSetCode" maxlength="30" />
+ </div>
+ </td>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Separator:</label><br>
+ <select class="form-field" name="select" ng-model="addFnMenuItem.separator">
+ <option ng-repeat="separator in separatorStatusOptions" value="{{separator.value}}" ng-selected="{{separator.value}}=={{addFnMenuItem.separator}}" >{{separator.title}}</option>
+ </select>
+ </div>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b></b></sup>Image Source:</label><br>
+ <input id="popupAddMenuItemImageSrc" type="text" class="fn-ebz-text" ng-model="addFnMenuItem.imageSrc" ng-disabled="disableImageSrc" maxlength="30" />
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="updateFnMenu(addFnMenuItem);">Save</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="close()">Close</button>
+ <!--
+ <div class="modal__footer">
+ </div>
+ -->
+ </div>
+</script>
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_role.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_role.html
new file mode 100644
index 00000000..4663bd46
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_role.html
@@ -0,0 +1,82 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<script type="text/ng-template" id="role_functions_popup.html">
+ <div class="modal__informative font-showcase" style="width:700px;height:500px;overflow:scroll">
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name" style="width: 500px;">Select Role Functions</h2>
+ </div>
+ <button align="right" class="button button--primary button--small" herf="javascript:void(0)" ng-click="close()">Close</button>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ <table table-data="availableRoleFunctions" att-table>
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" width="10%"> </th>
+ <th att-table-header sortable="false" width="90%">Role Function</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="availableRoleFunction in availableRoleFunctions" style="max-height: 980px;" >
+ <tr>
+
+ <td width="10%">
+ <div ng-click="toggleRoleFunction(availableRoleFunction.selected,availableRoleFunction);">
+ <input type="checkbox" ng-model="availableRoleFunction.selected" att-toggle-main>
+ </div>
+ </td>
+ <td width="90%">{{ availableRoleFunction.name }}</td>
+
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+</script>
+
+
+<script type="text/ng-template" id="child_roles_popup.html">
+ <div class="modal__informative font-showcase" style="width:700px;height:500px;overflow:scroll">
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name" style="width: 500px;">Select Child Roles</h2>
+ </div>
+ <button align="right" class="button button--primary button--small" herf="javascript:void(0)" ng-click="close()">Close</button>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ <table table-data="availableRoles" att-table>
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" width="10%"> </th>
+ <th att-table-header sortable="false" width="90%">Role</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="availableRole in availableRoles" style="max-height: 980px;" >
+ <tr>
+ <td att-table-body width="10%">
+ <div ng-click="toggleChildRole(availableRole.selected,availableRole);">
+ <input type="checkbox" ng-model="availableRole.selected" att-toggle-main>
+ </div>
+ </td>
+ <td att-table-body width="90%">{{ availableRole.name }}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html
new file mode 100644
index 00000000..b9e8ef0e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html
@@ -0,0 +1,46 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<script type="text/ng-template" id="edit_role_function_popup.html">
+ <div class="modal__informative font-showcase" style="width:400px;">
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name" style="width: 500px;">{{label}}</h2>
+ </div>
+ <div class="divider-container"><hr> </div>
+ <div class="modal__content">
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Name:</label><br>
+ <input type="text" class="fn-ebz-text" ng-model="editRoleFunction.name"
+ maxlength="30" />
+ </div>
+ <br/>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Code:</label><br>
+ <input type="text" class="fn-ebz-text" ng-model="editRoleFunction.code" ng-disabled="disableCd"
+ maxlength="30" />
+ </div>
+ </div>
+ <div class="modal__footer">
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="saveRoleFunction(editRoleFunction);">Save</button>
+ <button class="button button--primary button--small" herf="javascript:void(0)" ng-click="close()">Close</button>
+ </div>
+ </div>
+</script>
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/post_search.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/post_search.html
new file mode 100644
index 00000000..2c4846dd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/post_search.html
@@ -0,0 +1,139 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div style="margin-bottom:20px;">
+<h1 class="heading1">User Search</h1>
+ <br>
+ Please enter search criteria below:<br/>
+
+ <div class="fn-ebz-container">
+ Last Name:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postSearchBean.lastName" value="" size="25">
+ </div>
+
+ <div class="fn-ebz-container">
+ First Name:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postSearchBean.firstName" value="" size="25">
+ </div>
+
+ <div class="fn-ebz-container">
+ User ID:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postSearchBean.orgUserId" value="" size="25">
+ </div>
+
+ <div class="fn-ebz-container">
+ Manager User ID:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postSearchBean.orgManagerUserId" value="" size="25">
+ </div>
+ <br>
+ <div class="fn-ebz-container">
+ Organization:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postSearchBean.orgCode" value="" size="25">
+ </div>
+
+ <div class="fn-ebz-container">
+ Email:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postSearchBean.email" value="" size="25">
+ </div>
+ <br>
+ <div>
+ <input att-button btn-type="primary" size="small" class="button" type="submit" value="Search" ng-click="search(postSearchBean);" />
+
+ <input att-button btn-type="primary" size="small" class="button" type="submit" value="Reset" ng-click="reset();"/>
+ </div>
+ <br>
+
+ {{noResultsString}}
+
+ <div ng-if="profileList.length != 0">
+ <table att-table table-data="profileList" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+ <thead att-table-row type="header" >
+ <tr>
+ <th att-table-header width="5%" align="left">No</th>
+ <th att-table-header width="30%" key="lastName" align="left">Name</th>
+ <th att-table-header width="5%" key="orgUserId" align="left">OrgUserId</th>
+ <th att-table-header width="10%" key="orgCode" align="left">Organization</th>
+ <th att-table-header width="20%" align="left">Phone</th>
+ <th att-table-header width="20%" key="email" align="left">Email</th>
+ <th att-table-header width="10%" align="left">Import?</th>
+ </tr>
+ </thead>
+
+ <tbody att-table-row type="body" row-repeat="profile in profileList" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr >
+ <td att-table-body width="5%" align="left">
+ {{$index + 1}}
+ </td>
+ <td att-table-body width="30%" align="left">
+ <div ng-if="ngexistingUsers[profile.orgUserId] == null">
+ {{profile.lastName}},&nbsp;{{profile.firstName}}
+ </div>
+ <div ng-if="ngexistingUsers[profile.orgUserId] != null">
+ <a href="profile.htm?profile_id={{ngexistingUsers[profile.orgUserId]}}" alt="View/Edit Profile">
+ {{profile.lastName}},&nbsp;{{profile.firstName}}
+ </a>
+ </div>
+
+ </td>
+ <td att-table-body width="5%" align="left">
+ {{profile.orgUserId}}
+ </td>
+ <td att-table-body width="10%" align="left">
+ {{profile.orgCode}}
+ </td>
+ <td att-table-body width="20%" align="left">
+ {{profile.phone}}
+ </td>
+ <td att-table-body width="20%" align="left">
+ {{profile.email}}
+ </td>
+
+ <td att-table-body width="10%" align="left">
+ <div ng-if="ngexistingUsers[profile.orgUserId] == null">
+ <div ng-click="toggleSelection(profile);">
+ <input name="selected" type="checkbox" ng-model="profile.selected" att-checkbox/>
+ </div>
+ </div>
+ <div ng-if="ngexistingUsers[profile.orgUserId] != null">
+ Exists
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <div class="fn-ebz-container">
+ Rows Per Page:
+ <input class="fn-ebz-text" type="text" ng-model="viewPerPage" size="5" style="width: 47px;">
+ </div>
+ <div class="fn-ebz-container">
+ Current Page:
+ <input class="fn-ebz-text" type="text" ng-model="currentPage" size="5" style="width: 47px;">
+ </div>
+ <div class="fn-ebz-container">
+ Total Page(s):
+ <input class="fn-ebz-text" type="text" ng-model="totalPage" size="5" readonly="true" style="width: 47px;">
+ </div>
+
+ <div ng-if="profileList.length != 0">
+ <input att-button btn-type="primary" size="small" class="button" type="submit" value="Import" ng-click="process();"/>
+ </div>
+
+ </div>
+
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_detail.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_detail.html
new file mode 100644
index 00000000..c5ef97a7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_detail.html
@@ -0,0 +1,188 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div ng-controller="profileController" >
+ <br/>
+ <h1 class="heading1">Profile Edit</h1>
+ <br/>
+ Please edit the profile details below:&nbsp;<br><br>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>First Name:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.firstName"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Last Name:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.lastName"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">User ID:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.orgUserId"
+ maxlength="30" style="margin-right:0px;" readonly="true"/>
+ </div>
+ &nbsp;
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Manager User ID:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.orgManagerUserId"
+ maxlength="30" style="margin-right:0px;" readonly="true"/>
+ </div>
+<BR>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Login Id:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.loginId"
+ maxlength="30" readonly="true"/>
+ </div>
+
+ <div class="fn-ebz-container" style="margin-right:20px">
+ <label class="fn-ebz-text-label">Password:</label><BR>
+ <input type="password" ng-model="profile.loginPwd"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Phone:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.phone"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Fax:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.fax"
+ maxlength="30" />
+ </div>
+<BR>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Cellular:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.cellular"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Email:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.email"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Address 1:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.address1"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Address 2:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.address2"
+ maxlength="30" />
+ </div>
+<BR>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">City:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.city"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">State:</label><BR>
+ <div class="form-field" att-select="stateList.options" ng-model="stateList.selected"></div>
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Zip Code:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.zipCode"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Country:</label><BR>
+ <div class="form-field" att-select="countries" ng-model="selectedCountry"></div>
+ </div>
+ <BR>
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Time Zone:</label><BR>
+ <div class="form-field" att-select="timeZones" ng-model="selectedTimeZone"></div>
+ </div>
+
+ <div align="left" >
+ <button type="submit" ng-click="saveProfile();" att-button
+ btn-type="primary" size="small">Save</button>
+ </div>
+
+<br>
+ <div class="pageTitle">
+ <label>Roles</label>
+ <a ng-click="addNewRolePopup();" class="ion-plus" size="small"></a>
+
+ </div>
+
+ <table att-table table-data="profile.roles" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+<!-- <table border="1" class="hovertable_1"> -->
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" align="left" width="90%">Name</th>
+ <th att-table-header sortable="false" width="10%">Remove?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="role in profile.roles" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+<!-- <tr ng-repeat="role in profile.roles track by role.id"> -->
+ <tr>
+ <td att-table-body width="90%" >{{ role.name }}</td>
+ <td att-table-body width="10%">
+ <a ng-click="removeRole(role);" ><img src="static/fusion/images/deleteicon.gif"></a>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+
+
+ <div id="dialog" style="overflow:scroll" class="modal__informative font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name" style="color:#157BB2">Select Roles</h2>
+ </div>
+ <button align="right" class="button button--primary button--small" herf="javascript:void(0)" ng-click="close()">Close</button>
+ <div class="divider-container"><hr></div>
+ <div class="modal__content">
+ <table table-data="availableRoles" att-table >
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" width="10%"> </th>
+ <th att-table-header sortable="false" width="90%">Role</th>
+ </tr>
+ </thead>
+
+ <tbody att-table-row type="body" row-repeat="availableRole in availableRoles" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr>
+ <td att-table-body width="10%">
+ <div ng-click="toggleRole(availableRole.selected,availableRole);">
+ <input type="checkbox" ng-model="availableRole.selected" att-toggle-main>
+ </div>
+ </td>
+ <td att-table-body width="90%">{{ availableRole.name }}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+
+
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_search.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_search.html
new file mode 100644
index 00000000..9f49a80f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_search.html
@@ -0,0 +1,72 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div ng-controller="profileSearchCtrl">
+
+ <h1 class="heading1" style="margin-top:10px;">Profile Search</h1>
+
+ <table att-table table-data="tableData" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="true" key="id">User ID</th>
+ <th att-table-header sortable="true" key="lastName">Last Name</th>
+ <th att-table-header sortable="true" key="firstName">First Name</th>
+ <th att-table-header sortable="true" key="email">Email</th>
+ <th att-table-header sortable="true" key="orgUserId">User ID</th>
+ <th att-table-header sortable="true" key="orgManagerUserId">Manager User ID</th>
+ <th att-table-header >Edit</th>
+ <th att-table-header sortable="true" key="active">Active?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="rowData in tableData">
+ <tr>
+ <td att-table-body ng-bind="rowData['id']"></td>
+ <td att-table-body ng-bind="rowData['lastName']"></td>
+ <td att-table-body ng-bind="rowData['firstName']"></td>
+ <td att-table-body ng-bind="rowData['email']"></td>
+ <td att-table-body ng-bind="rowData['orgUserId']"></td>
+ <td att-table-body ng-bind="rowData['orgManagerUserId']"></td>
+ <td att-table-body ><a href="#/profile/{{rowData.id}}" class="ion-edit" style="color: #888;font-size:20px;"></a></td>
+ <td att-table-body >
+ <div ng-click="toggleProfileActive(rowData)">
+ <input type="checkbox" ng-model="rowData.active" att-toggle-main>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div class="fn-ebz-container">
+ Records Per Page:
+ <input class="fn-ebz-text" type="text" ng-model="viewPerPage1" size="5" style="width: 47px;">
+ </div>
+<!-- <div class="fn-ebz-container">
+ Current Page:
+ <input class="fn-ebz-text" type="text" ng-model="currentPage" size="5" style="width: 47px;">
+ </div> -->
+<!-- <div class="fn-ebz-container">
+ Total Page(s):
+ <input class="fn-ebz-text" type="text" ng-model="totalPage1" size="5" readonly="true" style="width: 47px;">
+ </div> -->
+
+<!--Short page count-->
+<div att-pagination total-pages="totalPages1" current-page="currentPage1" click-handler="customHandler"></div>
+
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role.html
new file mode 100644
index 00000000..c312f5b7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role.html
@@ -0,0 +1,118 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div>
+ <div class="bc-style" style="margin-left:-60px;">
+ <ul class="breadcrumb">
+ <li><a href="welcome">Home</a></li>
+ <li><a href="admin#/role_list">Roles</a></li>
+ <li class="active">Role</li>
+ </ul>
+ </div>
+ <h1 class="heading1">Role Edit</h1>
+ <div ng-controller="roleController" >
+ <br>
+ Please edit the role details below:&nbsp;<br>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Name:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="role.name"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Priority:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="role.priority"
+ maxlength="30" />
+ </div>
+
+ <div align="left" >
+ <button type="submit" ng-click="saveRole();" att-button
+ btn-type="primary" size="small">Save</button>
+ </div>
+
+ <br>
+ <div class="pageTitle">
+ <label>Role Functions</label>
+ <a ng-click="addNewRoleFunctionModalPopup();" class="ion-plus" size="small"></a>
+ </div>
+
+ <table table-data="role.roleFunctions" att-table >
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" align="left" width="90%">Name</th>
+ <th att-table-header sortable="false" width="10%">Remove?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="roleFunction in role.roleFunctions" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr>
+ <td att-table-body width="90%" >{{ roleFunction.name }}</td>
+ <td att-table-body width="10%">
+ <div ng-click="removeRoleFunction(roleFunction);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <a href="admin#/role_function_list">Manage Role Functions</a><br><br>
+
+ <div class="pageTitle">
+ <label>Child Roles</label>
+ <a ng-click="addNewChildRoleModalPopup();" class="ion-plus-round" size="small"></a>
+ </div>
+
+ <table table-data="role.childRoles" att-table >
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" align="left" width="90%">Name</th>
+ <th att-table-header sortable="false" width="10%">Remove?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="role in role.childRoles" style="max-height: 980px;" >
+ <tr>
+ <td att-table-body width="90%" >{{ role.name }}</td>
+ <td att-table-body width="10%">
+ <div ng-click="removeChildRole(role);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div id="dialogChildRole" title="Select Child Roles">
+ <table table-data="availableRoles" att-table>
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" width="10%"> </th>
+ <th att-table-header sortable="false" width="90%">Role</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="availableRole in availableRoles" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr>
+ <td att-table-body width="10%">
+ <div ng-click="toggleChildRole(availableRole.selected,availableRole);">
+ <input type="checkbox" ng-model="availableRole.selected" att-toggle-main>
+ </div>
+ </td>
+ <td att-table-body width="90%">{{ availableRole.name }}</td>
+
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_function_list.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_function_list.html
new file mode 100644
index 00000000..b0851036
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_function_list.html
@@ -0,0 +1,88 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div ng-controller="roleFunctionListController" style="width:95%;">
+ <div class="pageTitle">
+
+ <h1 class="heading1" style="margin-left:0px;">Role Functions</h1>
+ <br/>
+ <!-- <a ng-click="addNewRoleFunctionModalPopup();" class="icon-add" size="small" ></a> -->
+ <div align="left" style="marin-bottom: 50px;">
+ <button type="submit" ng-click="addNewRoleFunctionModalPopup();" att-button
+ btn-type="primary" size="small">Create</button>
+ </div>
+ <br><br>
+
+ </div>
+
+ <br>
+ <div style="margin-right: 20px;text-align: justify;text-align-last:auto;">
+ Click on the edit icon to update a role function, the plus icon to add additional role functions, or the delete icon to remove them.
+ </div>
+ <br>
+ <div id="rolesTable" title="Role Functions">
+ <table att-table table-data="availableRoleFunctions" current-page="1">
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header width="70%" key="name" sortable="true">Name</th>
+ <th att-table-header width="10%" key="code" sortable="true">Code</th>
+ <th att-table-header width="10%" sortable="false">Edit?</th>
+ <th att-table-header width="10%" sortable="false">Delete?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="availableRoleFunction in availableRoleFunctions" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr>
+ <td att-table-body width="70%" ng-bind="availableRoleFunction['name']"></td>
+ <td att-table-body width="10%" ng-bind="availableRoleFunction['code']"></td>
+ <td att-table-body width="10%">
+ <!-- <a ng-click="editRoleFunctionPopup(availableRoleFunction);" >
+ <img src="static/fusion/images/editicon.gif">
+ </a> -->
+ <div ng-click="editRoleFunctionModalPopup(availableRoleFunction);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-edit"></a></div>
+ </td>
+ <td att-table-body width="10%">
+ <!-- <a ng-click="removeRole(availableRoleFunction);" ><img src="static/fusion/images/deleteicon.gif"></a> -->
+ <div ng-click="removeRole(availableRoleFunction);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+
+ <div id="dialog" title="Add Role Function">
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Name:</label><br>
+ <input type="text" class="fn-ebz-text" ng-model="editRoleFunction.name"
+ maxlength="30" />
+ </div>
+ <br/>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Code:</label><br>
+ <input type="text" class="fn-ebz-text" ng-model="editRoleFunction.code" ng-disabled="editRoleFunction.code!=null"
+ maxlength="30" />
+ </div>
+ <br/>
+ <button type="submit" ng-click="saveRoleFunction(editRoleFunction);" att-button
+ btn-type="primary" size="small">Save</button>
+
+ </div>
+
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_list.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_list.html
new file mode 100644
index 00000000..1100cbb0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_list.html
@@ -0,0 +1,61 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div class="pageTitle">
+
+ <h1 class="heading1">Roles</h1>
+</div>
+<br>
+Click on a Role to view its details.
+
+<div ng-controller="roleListController" style="margin-bottom:20px;width:100%">
+ <div id="dialog" title="Roles">
+ <table att-table table-data="availableRoles" current-page="1">
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header width="70%" key="name" sortable="true">Name</th>
+ <th att-table-header width="10%" key="priority" sortable="true">Priority</th>
+ <th att-table-header width="10%" key="active" sortable="true">Active?</th>
+ <th att-table-header width="10%" sortable="false">Delete?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="availableRole in availableRoles" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+<!-- <tr ng-repeat="availableRole in availableRoles track by availableRole.id"> -->
+ <tr>
+ <td width="70%"><a href="admin#/role/{{availableRole.id}}">{{ availableRole.name }}</a></td>
+ <td width="10%">{{ availableRole.priority }}</td>
+ <td width="10%">
+ <div ng-click="toggleRole(availableRole.active,availableRole);">
+ <input type="checkbox" ng-model="availableRole.active" att-toggle-main ng-true-value="on" ng-false-value="off">
+ </div>
+ </td>
+ <td att-table-body width="10%">
+ <div ng-click="removeRole(availableRole);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <div align="left" style="marin-bottom: 50px;">
+ <button type="submit" onClick="window.location='admin#/role/0';" att-button
+ btn-type="primary" size="small">Create</button>
+ </div>
+
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/self_profile.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/self_profile.html
new file mode 100644
index 00000000..bc8ddd2f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/self_profile.html
@@ -0,0 +1,183 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+
+ <h1 class="heading1">Self Profile</h1>
+ <br>
+ Please edit the profile details below:&nbsp;<br><br>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>First Name:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.firstName"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Last Name:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.lastName"
+ maxlength="30"/>
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">User ID:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.orgUserId"
+ maxlength="30" style="margin-right:0px;" readonly="true"/>
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Manager User ID:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.orgManagerUserId"
+ maxlength="30" style="margin-right:0px;" readonly="true"/>
+ </div>
+<BR>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Login Id:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.loginId"
+ maxlength="30" readonly="true""/>
+ </div>
+
+ <div class="fn-ebz-container" style="margin-right:20px">
+ <label class="fn-ebz-text-label">Password:</label><BR>
+ <input type="password" ng-model="profile.loginPwd"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Phone:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.phone"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Fax:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.fax"
+ maxlength="30" />
+ </div>
+<BR>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Cellular:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.cellular"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label"><sup><b>*</b></sup>Email:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.email"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Address 1:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.address1"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Address 2:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.address2"
+ maxlength="30" />
+ </div>
+<BR>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">City:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.city"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">State:</label><BR>
+ <div class="form-field" att-select="stateList.options" ng-model="stateList.selected"></div>
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Zip Code:</label><BR>
+ <input type="text" class="fn-ebz-text" ng-model="profile.zipCode"
+ maxlength="30" />
+ </div>
+
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Country:</label><BR>
+ <div class="form-field" att-select="countries" ng-model="selectedCountry"></div>
+ </div>
+ <BR>
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Time Zone:</label><BR>
+ <div class="form-field" att-select="timeZones" ng-model="selectedTimeZone"></div>
+ </div>
+
+ <div align="left" >
+ <button type="submit" ng-click="saveProfile();" att-button
+ btn-type="primary" size="small">Save</button>
+ </div>
+
+<br>
+ <div class="pageTitle">
+ <label>Roles</label>
+ <a ng-click="addNewRolePopup();" ng-show="isUserSystemAdmin" class="ion-plus-round" size="small"></a>
+
+ </div>
+
+ <table att-table table-data="profile.roles" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+<!-- <table border="1" class="hovertable_1"> -->
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" align="left" width="90%">Name</th>
+ <th att-table-header sortable="false" width="10%">Remove?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="role in profile.roles" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+<!-- <tr ng-repeat="role in profile.roles track by role.id"> -->
+ <tr>
+ <td att-table-body width="90%" >{{ role.name }}</td>
+ <td att-table-body width="10%">
+ <a ng-click="removeRole(role);" ><img src="static/fusion/images/deleteicon.gif"></a>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div id="dialog" style="height:500px;overflow:scroll" class="modal__informative font-showcase" >
+ <div class="modal__header">
+ <h2 class="font-showcase-font-name" style="color:#157BB2">Select Roles</h2>
+ </div>
+ <button align="right" class="button button--primary button--small" herf="javascript:void(0)" ng-click="close()">Close</button>
+ <div class="modal__content">
+ <table table-data="availableRoles" att-table >
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" width="10%"> </th>
+ <th att-table-header sortable="false" width="90%">Role</th>
+ </tr>
+ </thead>
+
+ <tbody att-table-row type="body" row-repeat="availableRole in availableRoles" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr>
+ <td att-table-body width="10%">
+ <div ng-click="toggleRole(availableRole.selected,availableRole);">
+ <input type="checkbox" ng-model="availableRole.selected" att-toggle-main>
+ </div>
+ </td>
+ <td att-table-body width="90%">{{ availableRole.name }}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/usage_list.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/usage_list.html
new file mode 100644
index 00000000..27ae72b5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/usage_list.html
@@ -0,0 +1,64 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div ng-controller="usageListController" >
+ <br/>
+ <h1 class="heading1">Users</h1>
+ <br/>
+
+ <div style="margin-right: 20px;text-align: justify;text-align-last:auto;">
+ The following shows all users currently logged into the application. Click the icon to expel a user from the application.
+ </div>
+ <div title="Current User Sessions" style="width: 86%;">
+ <table att-table table-data="users" current-page="1">
+
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="false" width="10%" align="left">Current User Sessions</th>
+ <th att-table-header sortable="false" width="10%" align="center"></th>
+ <th att-table-header sortable="false" width="10%" align="center"></th>
+ <th att-table-header sortable="false" width="10%" align="center"></th>
+ <th att-table-header sortable="false" width="10%" align="center"></th>
+ <th att-table-header sortable="false" width="10%" align="center"></th>
+ </tr>
+ <tr>
+ <th att-table-header sortable="false" width="10%" align="center">User Id</th>
+ <th att-table-header sortable="false" width="10%" align="center">User Name</th>
+ <th att-table-header sortable="false" width="10%" align="center">Email</th>
+ <th att-table-header sortable="false" width="10%" align="center">Last Access Time (minutes)</th>
+ <th att-table-header sortable="false" width="10%" align="center">Time Remaining (minutes)</th>
+ <th att-table-header sortable="false" width="10%" align="center">Expire User Session?</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="user in users" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
+ <tr>
+ <td att-table-body width="10%">{{user.id}}</td>
+ <td att-table-body width="10%">{{user.lastName}}</td>
+ <td att-table-body width="10%">{{user.email}}</td>
+ <td att-table-body width="10%">{{user.lastAccess}}</td>
+ <td att-table-body width="10%">{{user.remaining}}</td>
+ <td att-table-body width="10%"><div ng-hide="user.delete=='yes'">Current Session</div>
+
+ <div ng-click="removeSession(user.sessionId);" ng-hide="user.delete=='no'" style="font-size:20px;text-align:center"><a href="javascript:void(0)" class="ion-trash-b"></a></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-landing.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-landing.html
new file mode 100644
index 00000000..2b5e3b60
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-landing.html
@@ -0,0 +1,130 @@
+<!DOCTYPE html>
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<html>
+ <head>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta http-equiv="cache-control" content="max-age=0" />
+ <meta http-equiv="cache-control" content="no-cache" />
+ <meta http-equiv="expires" content="0" />
+ <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
+ <meta http-equiv="pragma" content="no-cache"/>
+ <!-- CSS -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/fn-ebz.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/demo.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/base.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/btn.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/dtpk.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/frms.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/sldr.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/tbs.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/portal_ebz_header.css">
+ <link rel="stylesheet" type="text/css" href="static/fusion/css/jquery-ui.css">
+ <!-- Basic AngularJS -->
+
+ <script src= "app/fusion/external/angular-1.5/angular.js"></script>
+ <script src= "app/fusion/external/angular-1.5/angular-sanitize.js"></script>
+ <script src= "app/fusion/external/angular-1.5/angular-route.min.js"></script>
+ <script src= "app/fusion/external/angular-1.5/angular-cookies.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/app.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/gestures.js"></script>
+ <script src= "app/fusion/external/ebz/sandbox/att-abs-tpls.js" type="text/javascript"></script>
+ <!-- <script src= "app/fusion/external/scrollable-table/angular-scrollable-table.min.js"></script> -->
+ <!-- jQuery -->
+ <script src="static/js/jquery-1.10.2.js"></script>
+ <script src="static/js/jquery.mask.min.js" type="text/javascript"></script>
+ <script src="static/js/jquery-ui.js" type="text/javascript"></script>
+ <!-- AngularJS Gridster -->
+ <script src="static/fusion/js/att_angular_gridster/ui-gridster-tpls.js"></script>
+ <script src="static/fusion/js/att_angular_gridster/angular-gridster.js"></script>
+ <!-- AngularJS Config -->
+<!-- <script src= "app/fusion/external/ebz/angular_js/app.js"></script> -->
+ <script src= "app/fusion/external/ebz/angular_js/checklist-model.js"></script>
+
+ <!-- Controller js -->
+ <script src="app/fusion/scripts/controllers/fn_menu_add_popup_controller.js"></script>
+ <script src="app/fusion/scripts/controllers/admin_menu_edit.js"></script>
+ <script src="app/fusion/scripts/controllers/profile-search-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/profile-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/post-search-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/role-list-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/role-function-list-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/rolefunctionpopupController.js"></script>
+ <script src="app/fusion/scripts/controllers/modelpopupController.js"></script>
+ <script src="app/fusion/scripts/controllers/jcs-admin-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/broadcast-list-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/broadcast-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/usage-list-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/collaborate-list-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/role-controller.js"></script>
+ <script src="app/fusion/scripts/controllers/rolepopupmodelController.js"></script>
+ <!-- Header and Footer -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/header.css">
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/footer.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/bootstrap/bs.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/styles/workflows/workflows.css" >
+
+ <script src="app/fusion/scripts/directives/footer.js"></script>
+ <script src="app/fusion/external/ebz/js/footer.js"></script>
+ <script src="app/fusion/scripts/directives/header.js"></script>
+ <script src="app/fusion/scripts/directives/leftMenu.js"></script>
+ <script src="app/fusion/scripts/services/leftMenuService.js"></script>
+ <script src="app/fusion/scripts/modalService.js"></script>
+ <link rel="import" href="app/fusion/scripts/view-models/header.html">
+ <!-- Services -->
+ <script src="app/fusion/scripts/services/profileService.js"></script>
+ <script src="app/fusion/scripts/services/adminService.js"></script>
+ <script src="app/fusion/scripts/services/userInfoService.js"></script>
+ <!-- Controller -->
+ <script src="app/fusion/scripts/controllers/workflows/workflowRouting.js"></script>
+ <script src="app/fusion/scripts/controllers/workflows/workflowController.js"></script>
+
+ <!-- Utility -->
+ <script src="app/fusion/scripts/modalService.js"></script>
+
+ <!-- other js lib -->
+ <script type="text/javascript" src="app/fusion/scripts/socket/peerBroadcast.js"></script>
+ <script src="app/fusion/scripts/moment.min.js"></script>
+
+ <script src="app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js"></script>
+
+ <script src="static/fusion/raptor/ebz/date_time_picker.js"></script>
+ <script src="static/fusion/raptor/ebz/moment.js"></script>
+ <link rel="stylesheet" href="static/fusion/raptor/ebz/date_time_picker.css"/>
+ <!-- Icons -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ionicons-2.0.1/css/ionicons.css" />
+ <script>
+ angular.module('abs').requires.push('quantum');
+ </script>
+
+ </head>
+ <body class="appBody" ng-app="abs">
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_add.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_role.html'"></div>
+ <div q-header></div>
+ <div q-menu class="appLeftMenu"></div>
+ <div ng-view style="min-height: 450px;margin-top:-50px;margin-left:210px;"></div>
+ <div q-footer class="appFooter"></div>
+ </body>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-listing.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-listing.html
new file mode 100644
index 00000000..ceb88677
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-listing.html
@@ -0,0 +1,85 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<br/>
+<div>
+ <div>
+ <div align="right">
+ <h3>
+ <button ng-click="createWorkflow('lg')" class="btn btn-primary">Create Workflow</button></h3>
+ </div>
+ <div>
+ <form>
+ <div class="form-group">
+ <input type="text" ng-model="search" placeholder = "Current Workflows - Search one"/>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+
+<!-- <table att-table table-data="tableData" view-per-page="viewPerPage"
+ current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage" ng-show="workflows.length > 0">
+ <thead att-table-row type="header"> -->
+
+
+<table att-table table-data="tableData" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+ <thead att-table-row type="header">
+ <tr class="info">
+ <th att-table-header>Id</th>
+ <th att-table-header>Name</th>
+ <th>Key</th>
+ <th>Description</th>
+ <th>Workflow Server URL</th>
+ <!-- <th>Suspend Link</th> -->
+ <th>View</th>
+ <th>Active</th>
+ <th>Created </th>
+ <th>Created By</th>
+ <th>Action</th>
+ <th>Schedule</th>
+ <th>Edit</th>
+ <th>Delete?</th>
+
+
+ </tr>
+ </thead>
+
+
+ <tbody att-table-row type="body">
+ <tr ng-repeat="workflow in workflows | filter: search">
+ <td>{{workflow.id}}</td>
+ <td>{{workflow.name}}</td>
+ <td>{{workflow.workflowKey}}</td>
+ <td>{{workflow.description}}</td>
+ <td>{{workflow.runLink}}</td>
+ <td><div ng-click="previewWorkflow(workflow,'lg');" style="font-size:20px;"><a href="javascript:void(0)" class="ion-eye"></a></div></td>
+ <!-- <td>{{workflow.suspendLink}}</td> -->
+ <td >{{workflow.active}}</td>
+ <td>{{workflow.created}}</td>
+ <td>{{workflow.createdBy}}</td>
+ <td><div ng-show="workflow.active ==='false'" ng-click="activateWorkflow(workflow)" style="font-size:20px;"><a href="javascript:void(0)" class="ion-play"></a></div>
+ <div ng-show="workflow.active ==='true'" ng-click="suspendWorkflow(workflow)" style="font-size:20px;"><a href="javascript:void(0)" class="ion-pause"></a></div></td>
+ <td><div ng-click="scheduleWorkflow(workflow);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-ios-time"></a></div></td>
+ <td><div ng-click="updateWorkflow(workflow);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-edit"></a></div></td>
+ <td><div ng-click="removeWorkflow(workflow);" style="font-size:20px;"><a href="javascript:void(0)" class="ion-trash-b"></a></div></td>
+ </tr>
+ </tbody>
+</table>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-new.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-new.html
new file mode 100644
index 00000000..4622b928
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-new.html
@@ -0,0 +1,108 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div>
+ <div class="modal-header">
+ <h3 class="modal-title">Create Workflows</h3>
+ </div>
+ <div class="workflow-popup-body">
+ <form name="workflowForm" class="css-form" novalidate>
+
+ <div class="control-group">
+ <label class="fn-ebz-text large" for="workflowName">Name*: </label>
+
+ <div>
+ <input type="text" id="workflowName" class="fn-ebz-text extra-large" ng-model="workflow.name"
+ name="workflowName" required="required" placeholder="Workflow Name" />
+
+ <div ng-show="workflowForm.$submitted || workflowForm.workflowName.$touched">
+ <span ng-show="workflowForm.workflowName.$error.required">Workflow Name is required !!!</span>
+ </div>
+
+ </div>
+ </div>
+
+
+ <div class="control-group">
+ <label class="fn-ebz-text large" for="workflowKey">Key*: </label>
+ <div>
+ <input type="text" id="workflowKey" ng-model="workflow.workflowKey" class="fn-ebz-text extra-large"
+ name="workflowKey" required="required" placeholder="Workflow Key" />
+
+ <div ng-show="workflowForm.$submitted || workflowForm.workflowKey.$touched">
+ <span ng-show="workflowForm.workflowKey.$error.required">Workflow Key is required !!!</span>
+ </div>
+
+ </div>
+ </div>
+
+
+ <div class="control-group">
+ <label class="fn-ebz-text large" for="workflowDescription">Description: </label>
+
+ <div class="controls">
+ <input type="text" ng-model="workflow.description" id = "workflowDescription" name="workflowDescription" class="fn-ebz-text extra-large" placeholder="Brief Description"/>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="fn-ebz-text large" for="workflowRunLink">Workflow Server URL*</label>
+ <div class="controls">
+ <input type = "url" ng-model = "workflow.runLink" id = "workflowRunLink" name = "workflowRunLink" required = "required" class="fn-ebz-text extra-large"/>
+ </div>
+
+ <div ng-show="workflowForm.$submitted || workflowForm.workflowRunLink.$touched">
+ <span ng-show="workflowForm.workflowRunLink.$error.required">Run Link is required !!!</span>
+ <span class="error" ng-show="workflowForm.workflowRunLink.$error.url">Not valid url!</span>
+ </div>
+
+ </div>
+
+ <!-- <div class="control-group">
+ <label class="fn-ebz-text large" for="workflowSuspendLink">Suspend Link*</label>
+ <div class="controls">
+ <input type = "url" ng-model = "workflow.suspendLink" id = "workflowSuspendLink" name = "workflowSuspendLink" required = "required" class="fn-ebz-text extra-large"/>
+ </div>
+
+ <div ng-show="workflowForm.$submitted || workflowForm.workflowSuspendLink.$touched">
+ <span ng-show="workflowForm.workflowSuspendLink.$error.required">Suspend Link is required !!!</span>
+ <span class="error" ng-show="workflowForm.workflowSuspendLink.$error.url">Not valid url!</span>
+ </div>
+ </div> -->
+
+ <div class="control-group">
+ <label class="fn-ebz-text large" for="workflowActive">Active</label>
+ <div class="controls">
+ <!-- <input type = "text" ng-model = "workflow.active" id="workflowActive" name="workflowActive" class="fn-ebz-text extra-large"/> -->
+
+ <input type="radio" ng-model="workflow.active" value="true">Active
+ <input type="radio" ng-model="workflow.active" value="false">Inactive
+
+
+ </div>
+ </div>
+
+ <div class="modal-footer">
+ <a att-button btn-type="primary" ng-click="ok()">OK</a>
+ <a att-button btn-type="primary" ng-click="cancel()">Cancel</a>
+ </div>
+ </form>
+ <br />
+ </div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-preview.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-preview.html
new file mode 100644
index 00000000..80fece4e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-preview.html
@@ -0,0 +1,36 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div>
+ <div class="modal-header">
+ <h3 class="modal-title">View Workflow</h3>
+ </div>
+ <div class="workflow-popup-body">
+ <form name="workflowForm" class="css-form" novalidate>
+
+ <div style="overflow:scroll">
+ <img ng-src="{{workflowToPreview.runLink}}/engine-rest/process-definition/key/{{workflowToPreview.workflowKey}}/diagram">
+ </div>
+ <div class="modal-footer">
+ <button class="fn-ebz-btn large" type="button" ng-click="cancel()">Close</button>
+ </div>
+ </form>
+ <br />
+ </div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-remove.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-remove.html
new file mode 100644
index 00000000..e21efad8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-remove.html
@@ -0,0 +1,38 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div>
+ <div class="modal-header">
+ <h3 class="modal-title">Remove Workflow?</h3>
+ </div>
+ <div class="workflow-popup-body">
+ <form name="workflowForm" class="css-form" novalidate>
+
+ <div class="control-group">
+ <label class="fn-ebz-text large" for="workflowName">Workflow "{{workflowToRemove.name}}" is going to be removed. Are you sure?</label>
+ </div>
+
+ <div class="modal-footer">
+ <a att-button btn-type="primary" ng-click="ok()">OK</a>
+ <a att-button btn-type="primary" ng-click="cancel()">Cancel</a>
+ </div>
+ </form>
+ <br />
+ </div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-schedule.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-schedule.html
new file mode 100644
index 00000000..aebc04fb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-schedule.html
@@ -0,0 +1,116 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div>
+ <div class="modal-header">
+ <h3 class="modal-title">Workflow: {{workflowToSchedule.name}}</h3>
+ <table style="width:60%">
+ <tr><td>Workflow Key:</td> <td>{{workflowToSchedule.workflowKey}}</td></tr>
+ <tr><td>Workflow Description:</td> <td>{{workflowToSchedule.description}}</td></tr>
+ </table>
+ </div>
+
+ <div class="workflow-popup-body">
+ <form name="workflowForm" class="css-form" novalidate>
+
+ <table>
+ <tr>
+ <form name="myForm">
+ <td>
+ <label for="singleSelect"> Recurrence: </label>
+ </td>
+ <td>
+<div class="form-field" att-select="recurrenceOptions" ng-model="selectRecurrenceOpt" placeholder="Select an Option"></div>
+ <br>
+ </td>
+ <td> </td>
+ </form>
+ </tr>
+<tr>
+<td>
+
+</td>
+<td>
+Pick a date:
+</td>
+<td>
+Hour:
+</td>
+<td>
+Minute:
+</td>
+</tr>
+ <tr>
+ <td>
+ <form name="FirstScheduleForm">
+ <label for="dateSelect"> First Schedule: </label>
+ </form>
+ </td>
+ <td>
+ <!--DATEPICKER POPUP-->
+ <input id="datepicker1" type="text" ng-model="dt" att-datepicker>
+ </td>
+ <td>
+ <div class="form-field" att-select="hours" ng-model="selectFirstHour" placeholder="Select an Option"></div>
+ </td>
+ <td>
+ <div class="form-field" att-select="minutes" ng-model="selectFirstMinute" placeholder="Select an Option"></div>
+ </td>
+<!-- <td>
+ <div class="form-field" att-select="AMPMOptions" ng-model="selectStartAMPMOption" placeholder="Select an Option"></div>
+ </td> -->
+</tr>
+<tr>
+ <td>
+ <form name="LastScheduleForm">
+ <label for="dateSelect"> Last Schedule: </label>
+ </form>
+ </td>
+ <td>
+ <input id="datepicker2" type="text" ng-model="dt2" att-datepicker>
+ </td>
+ <td>
+ <div class="form-field" att-select="hours" ng-model="selectLastHour" placeholder="Select an Option"></div>
+ </td>
+ <td>
+ <div class="form-field" att-select="minutes" ng-model="selectLastMinute" placeholder="Select an Option"></div>
+ </td>
+ :
+<!-- <td>
+ <div class="form-field" att-select="AMPMOptions" ng-model="selectLastAMPMOption" placeholder="Select an Option"></div>
+ </td> -->
+
+ </tr>
+<tr>
+<!-- <td>
+ <input id="datepicker3" type="text" ng-model="dt3" date-format="datetimeformat" att-date-time-picker>
+</td>
+ -->
+</tr>
+
+</table>
+ <div class="modal-footer">
+ <a att-button btn-type="primary" ng-click="ok()">OK</a>
+ <a att-button btn-type="primary" ng-click="cancel()">Cancel</a>
+ </div>
+
+ </form>
+ <br />
+ </div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/RTCMultiConnection.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/RTCMultiConnection.js
new file mode 100644
index 00000000..449e8d59
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/RTCMultiConnection.js
@@ -0,0 +1,6788 @@
+// Last time updated at Monday, December 21st, 2015, 5:25:26 PM
+
+// Quick-Demo for newbies: http://jsfiddle.net/c46de0L8/
+// Another simple demo: http://jsfiddle.net/zar6fg60/
+
+// Latest file can be found here: https://cdn.webrtc-experiment.com/RTCMultiConnection.js
+
+// Muaz Khan - www.MuazKhan.com
+// MIT License - www.WebRTC-Experiment.com/licence
+// Documentation - www.RTCMultiConnection.org/docs
+// FAQ - www.RTCMultiConnection.org/FAQ
+// Changes log - www.RTCMultiConnection.org/changes-log/
+// Demos - www.WebRTC-Experiment.com/RTCMultiConnection
+
+// _________________________
+// RTCMultiConnection-v2.2.2
+
+(function() {
+
+ // RMC == RTCMultiConnection
+ // usually page-URL is used as channel-id
+ // you can always override it!
+ // www.RTCMultiConnection.org/docs/channel-id/
+ window.RMCDefaultChannel = location.href.replace(/\/|:|#|\?|\$|\^|%|\.|`|~|!|\+|@|\[|\||]|\|*. /g, '').split('\n').join('').split('\r').join('');
+
+ // www.RTCMultiConnection.org/docs/constructor/
+ window.RTCMultiConnection = function(channel) {
+ // an instance of constructor
+ var connection = this;
+
+ // a reference to RTCMultiSession
+ var rtcMultiSession;
+
+ // setting default channel or channel passed through constructor
+ connection.channel = channel || RMCDefaultChannel;
+
+ // to allow single user to join multiple rooms;
+ // you can change this property at runtime!
+ connection.isAcceptNewSession = true;
+
+ // www.RTCMultiConnection.org/docs/open/
+ connection.open = function(args) {
+ connection.isAcceptNewSession = false;
+
+ // www.RTCMultiConnection.org/docs/session-initiator/
+ // you can always use this property to determine room owner!
+ connection.isInitiator = true;
+
+ var dontTransmit = false;
+
+ // a channel can contain multiple rooms i.e. sessions
+ if (args) {
+ if (isString(args)) {
+ connection.sessionid = args;
+ } else {
+ if (!isNull(args.transmitRoomOnce)) {
+ connection.transmitRoomOnce = args.transmitRoomOnce;
+ }
+
+ if (!isNull(args.dontTransmit)) {
+ dontTransmit = args.dontTransmit;
+ }
+
+ if (!isNull(args.sessionid)) {
+ connection.sessionid = args.sessionid;
+ }
+ }
+ }
+
+ // if firebase && if session initiator
+ if (connection.socket && connection.socket.remove) {
+ connection.socket.remove();
+ }
+
+ if (!connection.sessionid) connection.sessionid = connection.channel;
+ connection.sessionDescription = {
+ sessionid: connection.sessionid,
+ userid: connection.userid,
+ session: connection.session,
+ extra: connection.extra
+ };
+
+ if (!connection.sessionDescriptions[connection.sessionDescription.sessionid]) {
+ connection.numberOfSessions++;
+ connection.sessionDescriptions[connection.sessionDescription.sessionid] = connection.sessionDescription;
+ }
+
+ // connect with signaling channel
+ initRTCMultiSession(function() {
+ // "captureUserMediaOnDemand" is disabled by default.
+ // invoke "getUserMedia" only when first participant found.
+ rtcMultiSession.captureUserMediaOnDemand = args ? !!args.captureUserMediaOnDemand : false;
+
+ if (args && args.onMediaCaptured) {
+ connection.onMediaCaptured = args.onMediaCaptured;
+ }
+
+ // for session-initiator, user-media is captured as soon as "open" is invoked.
+ if (!rtcMultiSession.captureUserMediaOnDemand) captureUserMedia(function() {
+ rtcMultiSession.initSession({
+ sessionDescription: connection.sessionDescription,
+ dontTransmit: dontTransmit
+ });
+
+ invokeMediaCaptured(connection);
+ });
+
+ if (rtcMultiSession.captureUserMediaOnDemand) {
+ rtcMultiSession.initSession({
+ sessionDescription: connection.sessionDescription,
+ dontTransmit: dontTransmit
+ });
+ }
+ });
+ return connection.sessionDescription;
+ };
+
+ // www.RTCMultiConnection.org/docs/connect/
+ connection.connect = function(sessionid) {
+ // a channel can contain multiple rooms i.e. sessions
+ if (sessionid) {
+ connection.sessionid = sessionid;
+ }
+
+ // connect with signaling channel
+ initRTCMultiSession(function() {
+ log('Signaling channel is ready.');
+ });
+
+ return this;
+ };
+
+ // www.RTCMultiConnection.org/docs/join/
+ connection.join = joinSession;
+
+ // www.RTCMultiConnection.org/docs/send/
+ connection.send = function(data, _channel) {
+ if (connection.numberOfConnectedUsers <= 0) {
+ // no connections
+ setTimeout(function() {
+ // try again
+ connection.send(data, _channel);
+ }, 1000);
+ return;
+ }
+
+ // send file/data or /text
+ if (!data)
+ throw 'No file, data or text message to share.';
+
+ // connection.send([file1, file2, file3])
+ // you can share multiple files, strings or data objects using "send" method!
+ if (data instanceof Array && !isNull(data[0].size) && !isNull(data[0].type)) {
+ // this mechanism can cause failure for subsequent packets/data
+ // on Firefox especially; and on chrome as well!
+ // todo: need to use setTimeout instead.
+ for (var i = 0; i < data.length; i++) {
+ data[i].size && data[i].type && connection.send(data[i], _channel);
+ }
+ return;
+ }
+
+ // File or Blob object MUST have "type" and "size" properties
+ if (!isNull(data.size) && !isNull(data.type)) {
+ if (!connection.enableFileSharing) {
+ throw '"enableFileSharing" boolean MUST be "true" to support file sharing.';
+ }
+
+ if (!rtcMultiSession.fileBufferReader) {
+ initFileBufferReader(connection, function(fbr) {
+ rtcMultiSession.fileBufferReader = fbr;
+ connection.send(data, _channel);
+ });
+ return;
+ }
+
+ var extra = merge({
+ userid: connection.userid
+ }, data.extra || connection.extra);
+
+ rtcMultiSession.fileBufferReader.readAsArrayBuffer(data, function(uuid) {
+ rtcMultiSession.fileBufferReader.getNextChunk(uuid, function(nextChunk, isLastChunk, extra) {
+ if (_channel) _channel.send(nextChunk);
+ else rtcMultiSession.send(nextChunk);
+ });
+ }, extra);
+ } else {
+ // to allow longest string messages
+ // and largest data objects
+ // or anything of any size!
+ // to send multiple data objects concurrently!
+
+ TextSender.send({
+ text: data,
+ channel: rtcMultiSession,
+ _channel: _channel,
+ connection: connection
+ });
+ }
+ };
+
+ function initRTCMultiSession(onSignalingReady) {
+ if (screenFrame) {
+ loadScreenFrame();
+ }
+
+ // RTCMultiSession is the backbone object;
+ // this object MUST be initialized once!
+ if (rtcMultiSession) return onSignalingReady();
+
+ // your everything is passed over RTCMultiSession constructor!
+ rtcMultiSession = new RTCMultiSession(connection, onSignalingReady);
+ }
+
+ connection.disconnect = function() {
+ if (rtcMultiSession) rtcMultiSession.disconnect();
+ rtcMultiSession = null;
+ };
+
+ function joinSession(session, joinAs) {
+ if (isString(session)) {
+ connection.skipOnNewSession = true;
+ }
+
+ if (!rtcMultiSession) {
+ log('Signaling channel is not ready. Connecting...');
+ // connect with signaling channel
+ initRTCMultiSession(function() {
+ log('Signaling channel is connected. Joining the session again...');
+ setTimeout(function() {
+ joinSession(session, joinAs);
+ }, 1000);
+ });
+ return;
+ }
+
+ // connection.join('sessionid');
+ if (isString(session)) {
+ if (connection.sessionDescriptions[session]) {
+ session = connection.sessionDescriptions[session];
+ } else
+ return setTimeout(function() {
+ log('Session-Descriptions not found. Rechecking..');
+ joinSession(session, joinAs);
+ }, 1000);
+ }
+
+ // connection.join('sessionid', { audio: true });
+ if (joinAs) {
+ return captureUserMedia(function() {
+ session.oneway = true;
+ joinSession(session);
+ }, joinAs);
+ }
+
+ if (!session || !session.userid || !session.sessionid) {
+ error('missing arguments', arguments);
+
+ var error = 'Invalid data passed over "connection.join" method.';
+ connection.onstatechange({
+ userid: 'browser',
+ extra: {},
+ name: 'Unexpected data detected.',
+ reason: error
+ });
+
+ throw error;
+ }
+
+ if (!connection.dontOverrideSession) {
+ connection.session = session.session;
+ }
+
+ var extra = connection.extra || session.extra || {};
+
+ // todo: need to verify that if-block statement works as expected.
+ // expectations: if it is oneway streaming; or if it is data-only connection
+ // then, it shouldn't capture user-media on participant's side.
+ if (session.oneway || isData(session)) {
+ rtcMultiSession.joinSession(session, extra);
+ } else {
+ captureUserMedia(function() {
+ rtcMultiSession.joinSession(session, extra);
+ });
+ }
+ }
+
+ var isFirstSession = true;
+
+ // www.RTCMultiConnection.org/docs/captureUserMedia/
+
+ function captureUserMedia(callback, _session, dontCheckChromExtension) {
+ // capture user's media resources
+ var session = _session || connection.session;
+
+ if (isEmpty(session)) {
+ if (callback) callback();
+ return;
+ }
+
+ // you can force to skip media capturing!
+ if (connection.dontCaptureUserMedia) {
+ return callback();
+ }
+
+ // if it is data-only connection
+ // if it is one-way connection and current user is participant
+ if (isData(session) || (!connection.isInitiator && session.oneway)) {
+ // www.RTCMultiConnection.org/docs/attachStreams/
+ connection.attachStreams = [];
+ return callback();
+ }
+
+ var constraints = {
+ audio: !!session.audio ? {
+ mandatory: {},
+ optional: [{
+ chromeRenderToAssociatedSink: true
+ }]
+ } : false,
+ video: !!session.video
+ };
+
+ // if custom audio device is selected
+ if (connection._mediaSources.audio) {
+ constraints.audio.optional.push({
+ sourceId: connection._mediaSources.audio
+ });
+ }
+
+ // if custom video device is selected
+ if (connection._mediaSources.video) {
+ constraints.video = {
+ optional: [{
+ sourceId: connection._mediaSources.video
+ }]
+ };
+ }
+
+ // for connection.session = {};
+ if (!session.screen && !constraints.audio && !constraints.video) {
+ return callback();
+ }
+
+ var screen_constraints = {
+ audio: false,
+ video: {
+ mandatory: {
+ chromeMediaSource: DetectRTC.screen.chromeMediaSource,
+ maxWidth: screen.width > 1920 ? screen.width : 1920,
+ maxHeight: screen.height > 1080 ? screen.height : 1080
+ },
+ optional: []
+ }
+ };
+
+ if (isFirefox && session.screen) {
+ if (location.protocol !== 'https:') {
+ return error(SCREEN_COMMON_FAILURE);
+ }
+ warn(Firefox_Screen_Capturing_Warning);
+
+ screen_constraints.video = merge(screen_constraints.video.mandatory, {
+ mozMediaSource: 'window', // mozMediaSource is redundant here
+ mediaSource: 'window' // 'screen' || 'window'
+ });
+
+ // Firefox is supporting audio+screen from single getUserMedia request
+ // audio+video+screen will become audio+screen for Firefox
+ // because Firefox isn't supporting multi-streams feature version < 38
+ // version >38 supports multi-stream sharing.
+ // we can use: firefoxVersion < 38
+ // however capturing audio and screen using single getUserMedia is a better option
+ if (constraints.audio /* && !session.video */ ) {
+ screen_constraints.audio = true;
+ constraints = {};
+ }
+
+ delete screen_constraints.video.chromeMediaSource;
+ }
+
+ // if screen is prompted
+ if (session.screen) {
+ if (isChrome && DetectRTC.screen.extensionid != ReservedExtensionID) {
+ useCustomChromeExtensionForScreenCapturing = true;
+ }
+
+ if (isChrome && !useCustomChromeExtensionForScreenCapturing && !dontCheckChromExtension && !DetectRTC.screen.sourceId) {
+ listenEventHandler('message', onIFrameCallback);
+
+ function onIFrameCallback(event) {
+ if (event.data && event.data.chromeMediaSourceId) {
+ // this event listener is no more needed
+ window.removeEventListener('message', onIFrameCallback);
+
+ var sourceId = event.data.chromeMediaSourceId;
+
+ DetectRTC.screen.sourceId = sourceId;
+ DetectRTC.screen.chromeMediaSource = 'desktop';
+
+ if (sourceId == 'PermissionDeniedError') {
+ var mediaStreamError = {
+ message: location.protocol == 'https:' ? 'User denied to share content of his screen.' : SCREEN_COMMON_FAILURE,
+ name: 'PermissionDeniedError',
+ constraintName: screen_constraints,
+ session: session
+ };
+ currentUserMediaRequest.mutex = false;
+ DetectRTC.screen.sourceId = null;
+ return connection.onMediaError(mediaStreamError);
+ }
+
+ captureUserMedia(callback, _session);
+ }
+
+ if (event.data && event.data.chromeExtensionStatus) {
+ warn('Screen capturing extension status is:', event.data.chromeExtensionStatus);
+ DetectRTC.screen.chromeMediaSource = 'screen';
+ captureUserMedia(callback, _session, true);
+ }
+ }
+
+ if (!screenFrame) {
+ loadScreenFrame();
+ }
+
+ screenFrame.postMessage();
+ return;
+ }
+
+ // check if screen capturing extension is installed.
+ if (isChrome && useCustomChromeExtensionForScreenCapturing && !dontCheckChromExtension && DetectRTC.screen.chromeMediaSource == 'screen' && DetectRTC.screen.extensionid) {
+ if (DetectRTC.screen.extensionid == ReservedExtensionID && document.domain.indexOf('webrtc-experiment.com') == -1) {
+ return captureUserMedia(callback, _session, true);
+ }
+
+ log('checking if chrome extension is installed.');
+ DetectRTC.screen.getChromeExtensionStatus(function(status) {
+ if (status == 'installed-enabled') {
+ DetectRTC.screen.chromeMediaSource = 'desktop';
+ }
+
+ captureUserMedia(callback, _session, true);
+ log('chrome extension is installed?', DetectRTC.screen.chromeMediaSource == 'desktop');
+ });
+ return;
+ }
+
+ if (isChrome && useCustomChromeExtensionForScreenCapturing && DetectRTC.screen.chromeMediaSource == 'desktop' && !DetectRTC.screen.sourceId) {
+ DetectRTC.screen.getSourceId(function(sourceId) {
+ if (sourceId == 'PermissionDeniedError') {
+ var mediaStreamError = {
+ message: 'User denied to share content of his screen.',
+ name: 'PermissionDeniedError',
+ constraintName: screen_constraints,
+ session: session
+ };
+ currentUserMediaRequest.mutex = false;
+ DetectRTC.screen.chromeMediaSource = 'desktop';
+ return connection.onMediaError(mediaStreamError);
+ }
+
+ if (sourceId == 'No-Response') {
+ error('Chrome extension seems not available. Make sure that manifest.json#L16 has valid content-script matches pointing to your URL.');
+ DetectRTC.screen.chromeMediaSource = 'screen';
+ return captureUserMedia(callback, _session, true);
+ }
+
+ captureUserMedia(callback, _session, true);
+ });
+ return;
+ }
+
+ if (isChrome && DetectRTC.screen.chromeMediaSource == 'desktop') {
+ screen_constraints.video.mandatory.chromeMediaSourceId = DetectRTC.screen.sourceId;
+ }
+
+ var _isFirstSession = isFirstSession;
+
+ _captureUserMedia(screen_constraints, constraints.audio || constraints.video ? function() {
+
+ if (_isFirstSession) isFirstSession = true;
+
+ _captureUserMedia(constraints, callback);
+ } : callback);
+ } else _captureUserMedia(constraints, callback, session.audio && !session.video);
+
+ function _captureUserMedia(forcedConstraints, forcedCallback, isRemoveVideoTracks, dontPreventSSLAutoAllowed) {
+ connection.onstatechange({
+ userid: 'browser',
+ extra: {},
+ name: 'fetching-usermedia',
+ reason: 'About to capture user-media with constraints: ' + toStr(forcedConstraints)
+ });
+
+
+ if (connection.preventSSLAutoAllowed && !dontPreventSSLAutoAllowed && isChrome) {
+ // if navigator.customGetUserMediaBar.js is missing
+ if (!navigator.customGetUserMediaBar) {
+ loadScript(connection.resources.customGetUserMediaBar, function() {
+ _captureUserMedia(forcedConstraints, forcedCallback, isRemoveVideoTracks, dontPreventSSLAutoAllowed);
+ });
+ return;
+ }
+
+ navigator.customGetUserMediaBar(forcedConstraints, function() {
+ _captureUserMedia(forcedConstraints, forcedCallback, isRemoveVideoTracks, true);
+ }, function() {
+ connection.onMediaError({
+ name: 'PermissionDeniedError',
+ message: 'User denied permission.',
+ constraintName: forcedConstraints,
+ session: session
+ });
+ });
+ return;
+ }
+
+ var mediaConfig = {
+ onsuccess: function(stream, returnBack, idInstance, streamid) {
+ onStreamSuccessCallback(stream, returnBack, idInstance, streamid, forcedConstraints, forcedCallback, isRemoveVideoTracks, screen_constraints, constraints, session);
+ },
+ onerror: function(e, constraintUsed) {
+ // http://goo.gl/hrwF1a
+ if (isFirefox) {
+ if (e == 'PERMISSION_DENIED') {
+ e = {
+ message: '',
+ name: 'PermissionDeniedError',
+ constraintName: constraintUsed,
+ session: session
+ };
+ }
+ }
+
+ if (isFirefox && constraintUsed.video && constraintUsed.video.mozMediaSource) {
+ mediaStreamError = {
+ message: Firefox_Screen_Capturing_Warning,
+ name: e.name || 'PermissionDeniedError',
+ constraintName: constraintUsed,
+ session: session
+ };
+
+ connection.onMediaError(mediaStreamError);
+ return;
+ }
+
+ if (isString(e)) {
+ return connection.onMediaError({
+ message: 'Unknown Error',
+ name: e,
+ constraintName: constraintUsed,
+ session: session
+ });
+ }
+
+ // it seems that chrome 35+ throws "DevicesNotFoundError" exception
+ // when any of the requested media is either denied or absent
+ if (e.name && (e.name == 'PermissionDeniedError' || e.name == 'DevicesNotFoundError')) {
+ var mediaStreamError = 'Either: ';
+ mediaStreamError += '\n Media resolutions are not permitted.';
+ mediaStreamError += '\n Another application is using same media device.';
+ mediaStreamError += '\n Media device is not attached or drivers not installed.';
+ mediaStreamError += '\n You denied access once and it is still denied.';
+
+ if (e.message && e.message.length) {
+ mediaStreamError += '\n ' + e.message;
+ }
+
+ mediaStreamError = {
+ message: mediaStreamError,
+ name: e.name,
+ constraintName: constraintUsed,
+ session: session
+ };
+
+ connection.onMediaError(mediaStreamError);
+
+ if (isChrome && (session.audio || session.video)) {
+ // todo: this snippet fails if user has two or more
+ // microphone/webcam attached.
+ DetectRTC.load(function() {
+ // it is possible to check presence of the microphone before using it!
+ if (session.audio && !DetectRTC.hasMicrophone) {
+ warn('It seems that you have no microphone attached to your device/system.');
+ session.audio = session.audio = false;
+
+ if (!session.video) {
+ alert('It seems that you are capturing microphone and there is no device available or access is denied. Reloading...');
+ location.reload();
+ }
+ }
+
+ // it is possible to check presence of the webcam before using it!
+ if (session.video && !DetectRTC.hasWebcam) {
+ warn('It seems that you have no webcam attached to your device/system.');
+ session.video = session.video = false;
+
+ if (!session.audio) {
+ alert('It seems that you are capturing webcam and there is no device available or access is denied. Reloading...');
+ location.reload();
+ }
+ }
+
+ if (!DetectRTC.hasMicrophone && !DetectRTC.hasWebcam) {
+ alert('It seems that either both microphone/webcam are not available or access is denied. Reloading...');
+ location.reload();
+ } else if (!connection.getUserMediaPromptedOnce) {
+ // make maximum two tries!
+ connection.getUserMediaPromptedOnce = true;
+ captureUserMedia(callback, session);
+ }
+ });
+ }
+ }
+
+ if (e.name && e.name == 'ConstraintNotSatisfiedError') {
+ var mediaStreamError = 'Either: ';
+ mediaStreamError += '\n You are prompting unknown media resolutions.';
+ mediaStreamError += '\n You are using invalid media constraints.';
+
+ if (e.message && e.message.length) {
+ mediaStreamError += '\n ' + e.message;
+ }
+
+ mediaStreamError = {
+ message: mediaStreamError,
+ name: e.name,
+ constraintName: constraintUsed,
+ session: session
+ };
+
+ connection.onMediaError(mediaStreamError);
+ }
+
+ if (session.screen) {
+ if (isFirefox) {
+ error(Firefox_Screen_Capturing_Warning);
+ } else if (location.protocol !== 'https:') {
+ if (!isNodeWebkit && (location.protocol == 'file:' || location.protocol == 'http:')) {
+ error('You cannot use HTTP or file protocol for screen capturing. You must either use HTTPs or chrome extension page or Node-Webkit page.');
+ }
+ } else {
+ error('Unable to detect actual issue. Maybe "deprecated" screen capturing flag was not set using command line or maybe you clicked "No" button or maybe chrome extension returned invalid "sourceId". Please install chrome-extension: http://bit.ly/webrtc-screen-extension');
+ }
+ }
+
+ currentUserMediaRequest.mutex = false;
+
+ // to make sure same stream can be captured again!
+ var idInstance = JSON.stringify(constraintUsed);
+ if (currentUserMediaRequest.streams[idInstance]) {
+ delete currentUserMediaRequest.streams[idInstance];
+ }
+ },
+ mediaConstraints: connection.mediaConstraints || {}
+ };
+
+ mediaConfig.constraints = forcedConstraints || constraints;
+ mediaConfig.connection = connection;
+ getUserMedia(mediaConfig);
+ }
+ }
+
+ function onStreamSuccessCallback(stream, returnBack, idInstance, streamid, forcedConstraints, forcedCallback, isRemoveVideoTracks, screen_constraints, constraints, session) {
+ if (!streamid) streamid = getRandomString();
+
+ connection.onstatechange({
+ userid: 'browser',
+ extra: {},
+ name: 'usermedia-fetched',
+ reason: 'Captured user media using constraints: ' + toStr(forcedConstraints)
+ });
+
+ if (isRemoveVideoTracks) {
+ stream = convertToAudioStream(stream);
+ }
+
+ connection.localStreamids.push(streamid);
+ stream.onended = function() {
+ if (streamedObject.mediaElement && !streamedObject.mediaElement.parentNode && document.getElementById(stream.streamid)) {
+ streamedObject.mediaElement = document.getElementById(stream.streamid);
+ }
+
+ // when a stream is stopped; it must be removed from "attachStreams" array
+ connection.attachStreams.forEach(function(_stream, index) {
+ if (_stream == stream) {
+ delete connection.attachStreams[index];
+ connection.attachStreams = swap(connection.attachStreams);
+ }
+ });
+
+ onStreamEndedHandler(streamedObject, connection);
+
+ if (connection.streams[streamid]) {
+ connection.removeStream(streamid);
+ }
+
+ // if user clicks "stop" button to close screen sharing
+ var _stream = connection.streams[streamid];
+ if (_stream && _stream.sockets.length) {
+ _stream.sockets.forEach(function(socket) {
+ socket.send({
+ streamid: _stream.streamid,
+ stopped: true
+ });
+ });
+ }
+
+ currentUserMediaRequest.mutex = false;
+ // to make sure same stream can be captured again!
+ if (currentUserMediaRequest.streams[idInstance]) {
+ delete currentUserMediaRequest.streams[idInstance];
+ }
+
+ // to allow re-capturing of the screen
+ DetectRTC.screen.sourceId = null;
+ };
+
+ if (!isIE) {
+ stream.streamid = streamid;
+ stream.isScreen = forcedConstraints == screen_constraints;
+ stream.isVideo = forcedConstraints == constraints && !!constraints.video;
+ stream.isAudio = forcedConstraints == constraints && !!constraints.audio && !constraints.video;
+
+ // if muted stream is negotiated
+ stream.preMuted = {
+ audio: stream.getAudioTracks().length && !stream.getAudioTracks()[0].enabled,
+ video: stream.getVideoTracks().length && !stream.getVideoTracks()[0].enabled
+ };
+ }
+
+ var mediaElement = createMediaElement(stream, session);
+ mediaElement.muted = true;
+
+ var streamedObject = {
+ stream: stream,
+ streamid: streamid,
+ mediaElement: mediaElement,
+ blobURL: mediaElement.mozSrcObject ? URL.createObjectURL(stream) : mediaElement.src,
+ type: 'local',
+ userid: connection.userid,
+ extra: connection.extra,
+ session: session,
+ isVideo: !!stream.isVideo,
+ isAudio: !!stream.isAudio,
+ isScreen: !!stream.isScreen,
+ isInitiator: !!connection.isInitiator,
+ rtcMultiConnection: connection
+ };
+
+ if (isFirstSession) {
+ connection.attachStreams.push(stream);
+ }
+ isFirstSession = false;
+
+ connection.streams[streamid] = connection._getStream(streamedObject);
+
+ if (!returnBack) {
+ connection.onstream(streamedObject);
+ }
+
+ if (connection.setDefaultEventsForMediaElement) {
+ connection.setDefaultEventsForMediaElement(mediaElement, streamid);
+ }
+
+ if (forcedCallback) forcedCallback(stream, streamedObject);
+
+ if (connection.onspeaking) {
+ initHark({
+ stream: stream,
+ streamedObject: streamedObject,
+ connection: connection
+ });
+ }
+ }
+
+ // www.RTCMultiConnection.org/docs/captureUserMedia/
+ connection.captureUserMedia = captureUserMedia;
+
+ // www.RTCMultiConnection.org/docs/leave/
+ connection.leave = function(userid) {
+ if (!rtcMultiSession) return;
+
+ isFirstSession = true;
+
+ if (userid) {
+ connection.eject(userid);
+ return;
+ }
+
+ rtcMultiSession.leave();
+ };
+
+ // www.RTCMultiConnection.org/docs/eject/
+ connection.eject = function(userid) {
+ if (!connection.isInitiator) throw 'Only session-initiator can eject a user.';
+ if (!connection.peers[userid]) throw 'You ejected invalid user.';
+ connection.peers[userid].sendCustomMessage({
+ ejected: true
+ });
+ };
+
+ // www.RTCMultiConnection.org/docs/close/
+ connection.close = function() {
+ // close entire session
+ connection.autoCloseEntireSession = true;
+ connection.leave();
+ };
+
+ // www.RTCMultiConnection.org/docs/renegotiate/
+ connection.renegotiate = function(stream, session) {
+ if (connection.numberOfConnectedUsers <= 0) {
+ // no connections
+ setTimeout(function() {
+ // try again
+ connection.renegotiate(stream, session);
+ }, 1000);
+ return;
+ }
+
+ rtcMultiSession.addStream({
+ renegotiate: session || merge({
+ oneway: true
+ }, connection.session),
+ stream: stream
+ });
+ };
+
+ connection.attachExternalStream = function(stream, isScreen) {
+ var constraints = {};
+ if (stream.getAudioTracks && stream.getAudioTracks().length) {
+ constraints.audio = true;
+ }
+ if (stream.getVideoTracks && stream.getVideoTracks().length) {
+ constraints.video = true;
+ }
+
+ var screen_constraints = {
+ video: {
+ chromeMediaSource: 'fake'
+ }
+ };
+ var forcedConstraints = isScreen ? screen_constraints : constraints;
+ onStreamSuccessCallback(stream, false, '', null, forcedConstraints, false, false, screen_constraints, constraints, constraints);
+ };
+
+ // www.RTCMultiConnection.org/docs/addStream/
+ connection.addStream = function(session, socket) {
+ // www.RTCMultiConnection.org/docs/renegotiation/
+
+ if (connection.numberOfConnectedUsers <= 0) {
+ // no connections
+ setTimeout(function() {
+ // try again
+ connection.addStream(session, socket);
+ }, 1000);
+ return;
+ }
+
+ // renegotiate new media stream
+ if (session) {
+ var isOneWayStreamFromParticipant;
+ if (!connection.isInitiator && session.oneway) {
+ session.oneway = false;
+ isOneWayStreamFromParticipant = true;
+ }
+
+ captureUserMedia(function(stream) {
+ if (isOneWayStreamFromParticipant) {
+ session.oneway = true;
+ }
+ addStream(stream);
+ }, session);
+ } else addStream();
+
+ function addStream(stream) {
+ rtcMultiSession.addStream({
+ stream: stream,
+ renegotiate: session || connection.session,
+ socket: socket
+ });
+ }
+ };
+
+ // www.RTCMultiConnection.org/docs/removeStream/
+ connection.removeStream = function(streamid, dontRenegotiate) {
+ if (connection.numberOfConnectedUsers <= 0) {
+ // no connections
+ setTimeout(function() {
+ // try again
+ connection.removeStream(streamid, dontRenegotiate);
+ }, 1000);
+ return;
+ }
+
+ if (!streamid) streamid = 'all';
+ if (!isString(streamid) || streamid.search(/all|audio|video|screen/gi) != -1) {
+ function _detachStream(_stream, config) {
+ if (config.local && _stream.type != 'local') return;
+ if (config.remote && _stream.type != 'remote') return;
+
+ // connection.removeStream({screen:true});
+ if (config.screen && !!_stream.isScreen) {
+ connection.detachStreams.push(_stream.streamid);
+ }
+
+ // connection.removeStream({audio:true});
+ if (config.audio && !!_stream.isAudio) {
+ connection.detachStreams.push(_stream.streamid);
+ }
+
+ // connection.removeStream({video:true});
+ if (config.video && !!_stream.isVideo) {
+ connection.detachStreams.push(_stream.streamid);
+ }
+
+ // connection.removeStream({});
+ if (!config.audio && !config.video && !config.screen) {
+ connection.detachStreams.push(_stream.streamid);
+ }
+
+ if (connection.detachStreams.indexOf(_stream.streamid) != -1) {
+ log('removing stream', _stream.streamid);
+ onStreamEndedHandler(_stream, connection);
+
+ if (config.stop) {
+ connection.stopMediaStream(_stream.stream);
+ }
+ }
+ }
+
+ for (var stream in connection.streams) {
+ if (connection._skip.indexOf(stream) == -1) {
+ _stream = connection.streams[stream];
+
+ if (streamid == 'all') _detachStream(_stream, {
+ audio: true,
+ video: true,
+ screen: true
+ });
+
+ else if (isString(streamid)) {
+ // connection.removeStream('screen');
+ var config = {};
+ config[streamid] = true;
+ _detachStream(_stream, config);
+ } else _detachStream(_stream, streamid);
+ }
+ }
+
+ if (!dontRenegotiate && connection.detachStreams.length) {
+ connection.renegotiate();
+ }
+
+ return;
+ }
+
+ var stream = connection.streams[streamid];
+
+ // detach pre-attached streams
+ if (!stream) return warn('No such stream exists. Stream-id:', streamid);
+
+ // www.RTCMultiConnection.org/docs/detachStreams/
+ connection.detachStreams.push(stream.streamid);
+
+ log('removing stream', stream.streamid);
+ onStreamEndedHandler(stream, connection);
+
+ // todo: how to allow "stop" function?
+ // connection.stopMediaStream(stream.stream)
+
+ if (!dontRenegotiate) {
+ connection.renegotiate();
+ }
+ };
+
+ connection.switchStream = function(session) {
+ if (connection.numberOfConnectedUsers <= 0) {
+ // no connections
+ setTimeout(function() {
+ // try again
+ connection.switchStream(session);
+ }, 1000);
+ return;
+ }
+
+ connection.removeStream('all', true);
+ connection.addStream(session);
+ };
+
+ // www.RTCMultiConnection.org/docs/sendCustomMessage/
+ connection.sendCustomMessage = function(message) {
+ if (!rtcMultiSession || !rtcMultiSession.defaultSocket) {
+ return setTimeout(function() {
+ connection.sendCustomMessage(message);
+ }, 1000);
+ }
+
+ rtcMultiSession.defaultSocket.send({
+ customMessage: true,
+ message: message
+ });
+ };
+
+ // set RTCMultiConnection defaults on constructor invocation
+ setDefaults(connection);
+ };
+
+ function RTCMultiSession(connection, callbackForSignalingReady) {
+ var socketObjects = {};
+ var sockets = [];
+ var rtcMultiSession = this;
+ var participants = {};
+
+ if (!rtcMultiSession.fileBufferReader && connection.session.data && connection.enableFileSharing) {
+ initFileBufferReader(connection, function(fbr) {
+ rtcMultiSession.fileBufferReader = fbr;
+ });
+ }
+
+ var textReceiver = new TextReceiver(connection);
+
+ function onDataChannelMessage(e) {
+ if (e.data.checkingPresence && connection.channels[e.userid]) {
+ connection.channels[e.userid].send({
+ presenceDetected: true
+ });
+ return;
+ }
+
+ if (e.data.presenceDetected && connection.peers[e.userid]) {
+ connection.peers[e.userid].connected = true;
+ return;
+ }
+
+ if (e.data.type === 'text') {
+ textReceiver.receive(e.data, e.userid, e.extra);
+ } else {
+ if (connection.autoTranslateText) {
+ e.original = e.data;
+ connection.Translator.TranslateText(e.data, function(translatedText) {
+ e.data = translatedText;
+ connection.onmessage(e);
+ });
+ } else connection.onmessage(e);
+ }
+ }
+
+ function onNewSession(session) {
+ if (connection.skipOnNewSession) return;
+
+ if (!session.session) session.session = {};
+ if (!session.extra) session.extra = {};
+
+ // todo: make sure this works as expected.
+ // i.e. "onNewSession" should be fired only for
+ // sessionid that is passed over "connect" method.
+ if (connection.sessionid && session.sessionid != connection.sessionid) return;
+
+ if (connection.onNewSession) {
+ session.join = function(forceSession) {
+ if (!forceSession) return connection.join(session);
+
+ for (var f in forceSession) {
+ session.session[f] = forceSession[f];
+ }
+
+ // keeping previous state
+ var isDontCaptureUserMedia = connection.dontCaptureUserMedia;
+
+ connection.dontCaptureUserMedia = false;
+ connection.captureUserMedia(function() {
+ connection.dontCaptureUserMedia = true;
+ connection.join(session);
+
+ // returning back previous state
+ connection.dontCaptureUserMedia = isDontCaptureUserMedia;
+ }, forceSession);
+ };
+ if (!session.extra) session.extra = {};
+
+ return connection.onNewSession(session);
+ }
+
+ connection.join(session);
+ }
+
+ function updateSocketForLocalStreams(socket) {
+ for (var i = 0; i < connection.localStreamids.length; i++) {
+ var streamid = connection.localStreamids[i];
+ if (connection.streams[streamid]) {
+ // using "sockets" array to keep references of all sockets using
+ // this media stream; so we can fire "onStreamEndedHandler" among all users.
+ connection.streams[streamid].sockets.push(socket);
+ }
+ }
+ }
+
+ function newPrivateSocket(_config) {
+ var socketConfig = {
+ channel: _config.channel,
+ onmessage: socketResponse,
+ onopen: function(_socket) {
+ if (_socket) socket = _socket;
+
+ if (isofferer && !peer) {
+ peerConfig.session = connection.session;
+ if (!peer) peer = new PeerConnection();
+ peer.create('offer', peerConfig);
+ }
+
+ _config.socketIndex = socket.index = sockets.length;
+ socketObjects[socketConfig.channel] = socket;
+ sockets[_config.socketIndex] = socket;
+
+ updateSocketForLocalStreams(socket);
+
+ if (!socket.__push) {
+ socket.__push = socket.send;
+ socket.send = function(message) {
+ message.userid = message.userid || connection.userid;
+ message.extra = message.extra || connection.extra || {};
+
+ socket.__push(message);
+ };
+ }
+ }
+ };
+
+ socketConfig.callback = function(_socket) {
+ socket = _socket;
+ socketConfig.onopen();
+ };
+
+ var socket = connection.openSignalingChannel(socketConfig);
+ if (socket) socketConfig.onopen(socket);
+
+ var isofferer = _config.isofferer,
+ peer;
+
+ var peerConfig = {
+ onopen: onChannelOpened,
+ onicecandidate: function(candidate) {
+ if (!connection.candidates) throw 'ICE candidates are mandatory.';
+ if (!connection.iceProtocols) throw 'At least one must be true; UDP or TCP.';
+
+ var iceCandidates = connection.candidates;
+
+ var stun = iceCandidates.stun;
+ var turn = iceCandidates.turn;
+
+ if (!isNull(iceCandidates.reflexive)) stun = iceCandidates.reflexive;
+ if (!isNull(iceCandidates.relay)) turn = iceCandidates.relay;
+
+ if (!iceCandidates.host && !!candidate.candidate.match(/a=candidate.*typ host/g)) return;
+ if (!turn && !!candidate.candidate.match(/a=candidate.*typ relay/g)) return;
+ if (!stun && !!candidate.candidate.match(/a=candidate.*typ srflx/g)) return;
+
+ var protocol = connection.iceProtocols;
+
+ if (!protocol.udp && !!candidate.candidate.match(/a=candidate.* udp/g)) return;
+ if (!protocol.tcp && !!candidate.candidate.match(/a=candidate.* tcp/g)) return;
+
+ if (!window.selfNPObject) window.selfNPObject = candidate;
+
+ socket && socket.send({
+ candidate: JSON.stringify({
+ candidate: candidate.candidate,
+ sdpMid: candidate.sdpMid,
+ sdpMLineIndex: candidate.sdpMLineIndex
+ })
+ });
+ },
+ onmessage: function(data) {
+ if (!data) return;
+
+ var abToStr = ab2str(data);
+ if (abToStr.indexOf('"userid":') != -1) {
+ abToStr = JSON.parse(abToStr);
+ onDataChannelMessage(abToStr);
+ } else if (data instanceof ArrayBuffer || data instanceof DataView) {
+ if (!connection.enableFileSharing) {
+ throw 'It seems that receiving data is either "Blob" or "File" but file sharing is disabled.';
+ }
+
+ if (!rtcMultiSession.fileBufferReader) {
+ var that = this;
+ initFileBufferReader(connection, function(fbr) {
+ rtcMultiSession.fileBufferReader = fbr;
+ that.onmessage(data);
+ });
+ return;
+ }
+
+ var fileBufferReader = rtcMultiSession.fileBufferReader;
+
+ fileBufferReader.convertToObject(data, function(chunk) {
+ if (chunk.maxChunks || chunk.readyForNextChunk) {
+ // if target peer requested next chunk
+ if (chunk.readyForNextChunk) {
+ fileBufferReader.getNextChunk(chunk.uuid, function(nextChunk, isLastChunk, extra) {
+ rtcMultiSession.send(nextChunk);
+ });
+ return;
+ }
+
+ // if chunk is received
+ fileBufferReader.addChunk(chunk, function(promptNextChunk) {
+ // request next chunk
+ rtcMultiSession.send(promptNextChunk);
+ });
+ return;
+ }
+
+ connection.onmessage({
+ data: chunk,
+ userid: _config.userid,
+ extra: _config.extra
+ });
+ });
+ return;
+ }
+ },
+ onaddstream: function(stream, session) {
+ session = session || _config.renegotiate || connection.session;
+
+ // if it is data-only connection; then return.
+ if (isData(session)) return;
+
+ if (session.screen && (session.audio || session.video)) {
+ if (!_config.gotAudioOrVideo) {
+ // audio/video are fired earlier than screen
+ _config.gotAudioOrVideo = true;
+ session.screen = false;
+ } else {
+ // screen stream is always fired later
+ session.audio = false;
+ session.video = false;
+ }
+ }
+
+ var preMuted = {};
+
+ if (_config.streaminfo) {
+ var streaminfo = _config.streaminfo.split('----');
+ var strInfo = JSON.parse(streaminfo[streaminfo.length - 1]);
+
+ if (!isIE) {
+ stream.streamid = strInfo.streamid;
+ stream.isScreen = !!strInfo.isScreen;
+ stream.isVideo = !!strInfo.isVideo;
+ stream.isAudio = !!strInfo.isAudio;
+ preMuted = strInfo.preMuted;
+ }
+
+ streaminfo.pop();
+ _config.streaminfo = streaminfo.join('----');
+ }
+
+ var mediaElement = createMediaElement(stream, merge({
+ remote: true
+ }, session));
+
+ if (connection.setDefaultEventsForMediaElement) {
+ connection.setDefaultEventsForMediaElement(mediaElement, stream.streamid);
+ }
+
+ if (!isPluginRTC && !stream.getVideoTracks().length) {
+ function eventListener() {
+ setTimeout(function() {
+ mediaElement.muted = false;
+ afterRemoteStreamStartedFlowing({
+ mediaElement: mediaElement,
+ session: session,
+ stream: stream,
+ preMuted: preMuted
+ });
+ }, 3000);
+
+ mediaElement.removeEventListener('play', eventListener);
+ }
+ return mediaElement.addEventListener('play', eventListener, false);
+ }
+
+ waitUntilRemoteStreamStartsFlowing({
+ mediaElement: mediaElement,
+ session: session,
+ stream: stream,
+ preMuted: preMuted
+ });
+ },
+
+ onremovestream: function(stream) {
+ if (stream && stream.streamid) {
+ stream = connection.streams[stream.streamid];
+ if (stream) {
+ log('on:stream:ended via on:remove:stream', stream);
+ onStreamEndedHandler(stream, connection);
+ }
+ } else log('on:remove:stream', stream);
+ },
+
+ onclose: function(e) {
+ e.extra = _config.extra;
+ e.userid = _config.userid;
+ connection.onclose(e);
+
+ // suggested in #71 by "efaj"
+ if (connection.channels[e.userid]) {
+ delete connection.channels[e.userid];
+ }
+ },
+ onerror: function(e) {
+ e.extra = _config.extra;
+ e.userid = _config.userid;
+ connection.onerror(e);
+ },
+
+ oniceconnectionstatechange: function(event) {
+ log('oniceconnectionstatechange', toStr(event));
+
+ if (peer.connection && peer.connection.iceConnectionState == 'connected' && peer.connection.iceGatheringState == 'complete' && peer.connection.signalingState == 'stable' && connection.numberOfConnectedUsers == 1) {
+ connection.onconnected({
+ userid: _config.userid,
+ extra: _config.extra,
+ peer: connection.peers[_config.userid],
+ targetuser: _config.userinfo
+ });
+ }
+
+ if (!connection.isInitiator && peer.connection && peer.connection.iceConnectionState == 'connected' && peer.connection.iceGatheringState == 'complete' && peer.connection.signalingState == 'stable' && connection.numberOfConnectedUsers == 1) {
+ connection.onstatechange({
+ userid: _config.userid,
+ extra: _config.extra,
+ name: 'connected-with-initiator',
+ reason: 'ICE connection state seems connected; gathering state is completed; and signaling state is stable.'
+ });
+ }
+
+ if (connection.peers[_config.userid] && connection.peers[_config.userid].oniceconnectionstatechange) {
+ connection.peers[_config.userid].oniceconnectionstatechange(event);
+ }
+
+ // if ICE connectivity check is failed; renegotiate or redial
+ if (connection.peers[_config.userid] && connection.peers[_config.userid].peer.connection.iceConnectionState == 'failed') {
+ connection.onfailed({
+ userid: _config.userid,
+ extra: _config.extra,
+ peer: connection.peers[_config.userid],
+ targetuser: _config.userinfo
+ });
+ }
+
+ if (connection.peers[_config.userid] && connection.peers[_config.userid].peer.connection.iceConnectionState == 'disconnected') {
+ !peer.connection.renegotiate && connection.ondisconnected({
+ userid: _config.userid,
+ extra: _config.extra,
+ peer: connection.peers[_config.userid],
+ targetuser: _config.userinfo
+ });
+ peer.connection.renegotiate = false;
+ }
+
+ if (!connection.autoReDialOnFailure) return;
+
+ if (connection.peers[_config.userid]) {
+ if (connection.peers[_config.userid].peer.connection.iceConnectionState != 'disconnected') {
+ _config.redialing = false;
+ }
+
+ if (connection.peers[_config.userid].peer.connection.iceConnectionState == 'disconnected' && !_config.redialing) {
+ _config.redialing = true;
+ warn('Peer connection is closed.', toStr(connection.peers[_config.userid].peer.connection), 'ReDialing..');
+ connection.peers[_config.userid].socket.send({
+ redial: true
+ });
+
+ // to make sure all old "remote" streams are also removed!
+ connection.streams.remove({
+ remote: true,
+ userid: _config.userid
+ });
+ }
+ }
+ },
+
+ onsignalingstatechange: function(event) {
+ log('onsignalingstatechange', toStr(event));
+ },
+
+ attachStreams: connection.dontAttachStream ? [] : connection.attachStreams,
+ iceServers: connection.iceServers,
+ rtcConfiguration: connection.rtcConfiguration,
+ bandwidth: connection.bandwidth,
+ sdpConstraints: connection.sdpConstraints,
+ optionalArgument: connection.optionalArgument,
+ disableDtlsSrtp: connection.disableDtlsSrtp,
+ dataChannelDict: connection.dataChannelDict,
+ preferSCTP: connection.preferSCTP,
+
+ onSessionDescription: function(sessionDescription, streaminfo) {
+ sendsdp({
+ sdp: sessionDescription,
+ socket: socket,
+ streaminfo: streaminfo
+ });
+ },
+ trickleIce: connection.trickleIce,
+ processSdp: connection.processSdp,
+ sendStreamId: function(stream) {
+ socket && socket.send({
+ streamid: stream.streamid,
+ isScreen: !!stream.isScreen,
+ isAudio: !!stream.isAudio,
+ isVideo: !!stream.isVideo
+ });
+ },
+ rtcMultiConnection: connection
+ };
+
+ function waitUntilRemoteStreamStartsFlowing(args) {
+ // chrome for android may have some features missing
+ if (isMobileDevice || isPluginRTC || (isNull(connection.waitUntilRemoteStreamStartsFlowing) || !connection.waitUntilRemoteStreamStartsFlowing)) {
+ return afterRemoteStreamStartedFlowing(args);
+ }
+
+ if (!args.numberOfTimes) args.numberOfTimes = 0;
+ args.numberOfTimes++;
+
+ if (!(args.mediaElement.readyState <= HTMLMediaElement.HAVE_CURRENT_DATA || args.mediaElement.paused || args.mediaElement.currentTime <= 0)) {
+ return afterRemoteStreamStartedFlowing(args);
+ }
+
+ if (args.numberOfTimes >= 60) { // wait 60 seconds while video is delivered!
+ return socket.send({
+ failedToReceiveRemoteVideo: true,
+ streamid: args.stream.streamid
+ });
+ }
+
+ setTimeout(function() {
+ log('Waiting for incoming remote stream to be started flowing: ' + args.numberOfTimes + ' seconds.');
+ waitUntilRemoteStreamStartsFlowing(args);
+ }, 900);
+ }
+
+ function initFakeChannel() {
+ if (!connection.fakeDataChannels || connection.channels[_config.userid]) return;
+
+ // for non-data connections; allow fake data sender!
+ if (!connection.session.data) {
+ var fakeChannel = {
+ send: function(data) {
+ socket.send({
+ fakeData: data
+ });
+ },
+ readyState: 'open'
+ };
+ // connection.channels['user-id'].send(data);
+ connection.channels[_config.userid] = {
+ channel: fakeChannel,
+ send: function(data) {
+ this.channel.send(data);
+ }
+ };
+ peerConfig.onopen(fakeChannel);
+ }
+ }
+
+ function afterRemoteStreamStartedFlowing(args) {
+ var mediaElement = args.mediaElement;
+ var session = args.session;
+ var stream = args.stream;
+
+ stream.onended = function() {
+ if (streamedObject.mediaElement && !streamedObject.mediaElement.parentNode && document.getElementById(stream.streamid)) {
+ streamedObject.mediaElement = document.getElementById(stream.streamid);
+ }
+
+ onStreamEndedHandler(streamedObject, connection);
+ };
+
+ var streamedObject = {
+ mediaElement: mediaElement,
+
+ stream: stream,
+ streamid: stream.streamid,
+ session: session || connection.session,
+
+ blobURL: isPluginRTC ? '' : mediaElement.mozSrcObject ? URL.createObjectURL(stream) : mediaElement.src,
+ type: 'remote',
+
+ extra: _config.extra,
+ userid: _config.userid,
+
+ isVideo: isPluginRTC ? !!session.video : !!stream.isVideo,
+ isAudio: isPluginRTC ? !!session.audio && !session.video : !!stream.isAudio,
+ isScreen: !!stream.isScreen,
+ isInitiator: !!_config.isInitiator,
+
+ rtcMultiConnection: connection,
+ socket: socket
+ };
+
+ // connection.streams['stream-id'].mute({audio:true})
+ connection.streams[stream.streamid] = connection._getStream(streamedObject);
+ connection.onstream(streamedObject);
+
+ if (!isEmpty(args.preMuted) && (args.preMuted.audio || args.preMuted.video)) {
+ var fakeObject = merge({}, streamedObject);
+ fakeObject.session = merge(fakeObject.session, args.preMuted);
+
+ fakeObject.isAudio = !!fakeObject.session.audio && !fakeObject.session.video;
+ fakeObject.isVideo = !!fakeObject.session.video;
+ fakeObject.isScreen = false;
+
+ connection.onmute(fakeObject);
+ }
+
+ log('on:add:stream', streamedObject);
+
+ onSessionOpened();
+
+ if (connection.onspeaking) {
+ initHark({
+ stream: stream,
+ streamedObject: streamedObject,
+ connection: connection
+ });
+ }
+ }
+
+ function onChannelOpened(channel) {
+ _config.channel = channel;
+
+ // connection.channels['user-id'].send(data);
+ connection.channels[_config.userid] = {
+ channel: _config.channel,
+ send: function(data) {
+ connection.send(data, this.channel);
+ }
+ };
+
+ connection.onopen({
+ extra: _config.extra,
+ userid: _config.userid,
+ channel: channel
+ });
+
+ // fetch files from file-queue
+ for (var q in connection.fileQueue) {
+ connection.send(connection.fileQueue[q], channel);
+ }
+
+ if (isData(connection.session)) onSessionOpened();
+
+ if (connection.partOfScreen && connection.partOfScreen.sharing) {
+ connection.peers[_config.userid].sharePartOfScreen(connection.partOfScreen);
+ }
+ }
+
+ function updateSocket() {
+ // todo: need to check following {if-block} MUST not affect "redial" process
+ if (socket.userid == _config.userid)
+ return;
+
+ socket.userid = _config.userid;
+ sockets[_config.socketIndex] = socket;
+
+ connection.numberOfConnectedUsers++;
+ // connection.peers['user-id'].addStream({audio:true})
+ connection.peers[_config.userid] = {
+ socket: socket,
+ peer: peer,
+ userid: _config.userid,
+ extra: _config.extra,
+ userinfo: _config.userinfo,
+ addStream: function(session00) {
+ // connection.peers['user-id'].addStream({audio: true, video: true);
+
+ connection.addStream(session00, this.socket);
+ },
+ removeStream: function(streamid) {
+ if (!connection.streams[streamid])
+ return warn('No such stream exists. Stream-id:', streamid);
+
+ this.peer.connection.removeStream(connection.streams[streamid].stream);
+ this.renegotiate();
+ },
+ renegotiate: function(stream, session) {
+ // connection.peers['user-id'].renegotiate();
+
+ connection.renegotiate(stream, session);
+ },
+ changeBandwidth: function(bandwidth) {
+ // connection.peers['user-id'].changeBandwidth();
+
+ if (!bandwidth) throw 'You MUST pass bandwidth object.';
+ if (isString(bandwidth)) throw 'Pass object for bandwidth instead of string; e.g. {audio:10, video:20}';
+
+ // set bandwidth for self
+ this.peer.bandwidth = bandwidth;
+
+ // ask remote user to synchronize bandwidth
+ this.socket.send({
+ changeBandwidth: true,
+ bandwidth: bandwidth
+ });
+ },
+ sendCustomMessage: function(message) {
+ // connection.peers['user-id'].sendCustomMessage();
+
+ this.socket.send({
+ customMessage: true,
+ message: message
+ });
+ },
+ onCustomMessage: function(message) {
+ log('Received "private" message from', this.userid,
+ isString(message) ? message : toStr(message));
+ },
+ drop: function(dontSendMessage) {
+ // connection.peers['user-id'].drop();
+
+ for (var stream in connection.streams) {
+ if (connection._skip.indexOf(stream) == -1) {
+ stream = connection.streams[stream];
+
+ if (stream.userid == connection.userid && stream.type == 'local') {
+ this.peer.connection.removeStream(stream.stream);
+ onStreamEndedHandler(stream, connection);
+ }
+
+ if (stream.type == 'remote' && stream.userid == this.userid) {
+ onStreamEndedHandler(stream, connection);
+ }
+ }
+ }
+
+ !dontSendMessage && this.socket.send({
+ drop: true
+ });
+ },
+ hold: function(holdMLine) {
+ // connection.peers['user-id'].hold();
+
+ if (peer.prevCreateType == 'answer') {
+ this.socket.send({
+ unhold: true,
+ holdMLine: holdMLine || 'both',
+ takeAction: true
+ });
+ return;
+ }
+
+ this.socket.send({
+ hold: true,
+ holdMLine: holdMLine || 'both'
+ });
+
+ this.peer.hold = true;
+ this.fireHoldUnHoldEvents({
+ kind: holdMLine,
+ isHold: true,
+ userid: connection.userid,
+ remoteUser: this.userid
+ });
+ },
+ unhold: function(holdMLine) {
+ // connection.peers['user-id'].unhold();
+
+ if (peer.prevCreateType == 'answer') {
+ this.socket.send({
+ unhold: true,
+ holdMLine: holdMLine || 'both',
+ takeAction: true
+ });
+ return;
+ }
+
+ this.socket.send({
+ unhold: true,
+ holdMLine: holdMLine || 'both'
+ });
+
+ this.peer.hold = false;
+ this.fireHoldUnHoldEvents({
+ kind: holdMLine,
+ isHold: false,
+ userid: connection.userid,
+ remoteUser: this.userid
+ });
+ },
+ fireHoldUnHoldEvents: function(e) {
+ // this method is for inner usages only!
+
+ var isHold = e.isHold;
+ var kind = e.kind;
+ var userid = e.remoteUser || e.userid;
+
+ // hold means inactive a specific media line!
+ // a media line can contain multiple synced sources (ssrc)
+ // i.e. a media line can reference multiple tracks!
+ // that's why hold will affect all relevant tracks in a specific media line!
+ for (var stream in connection.streams) {
+ if (connection._skip.indexOf(stream) == -1) {
+ stream = connection.streams[stream];
+
+ if (stream.userid == userid) {
+ // www.RTCMultiConnection.org/docs/onhold/
+ if (isHold)
+ connection.onhold(merge({
+ kind: kind
+ }, stream));
+
+ // www.RTCMultiConnection.org/docs/onunhold/
+ if (!isHold)
+ connection.onunhold(merge({
+ kind: kind
+ }, stream));
+ }
+ }
+ }
+ },
+ redial: function() {
+ // connection.peers['user-id'].redial();
+
+ // 1st of all; remove all relevant remote media streams
+ for (var stream in connection.streams) {
+ if (connection._skip.indexOf(stream) == -1) {
+ stream = connection.streams[stream];
+
+ if (stream.userid == this.userid && stream.type == 'remote') {
+ onStreamEndedHandler(stream, connection);
+ }
+ }
+ }
+
+ log('ReDialing...');
+
+ socket.send({
+ recreatePeer: true
+ });
+
+ peer = new PeerConnection();
+ peer.create('offer', peerConfig);
+ },
+ sharePartOfScreen: function(args) {
+ // www.RTCMultiConnection.org/docs/onpartofscreen/
+ var that = this;
+ var lastScreenshot = '';
+
+ function partOfScreenCapturer() {
+ // if stopped
+ if (that.stopPartOfScreenSharing) {
+ that.stopPartOfScreenSharing = false;
+
+ if (connection.onpartofscreenstopped) {
+ connection.onpartofscreenstopped();
+ }
+ return;
+ }
+
+ // if paused
+ if (that.pausePartOfScreenSharing) {
+ if (connection.onpartofscreenpaused) {
+ connection.onpartofscreenpaused();
+ }
+
+ return setTimeout(partOfScreenCapturer, args.interval || 200);
+ }
+
+ capturePartOfScreen({
+ element: args.element,
+ connection: connection,
+ callback: function(screenshot) {
+ if (!connection.channels[that.userid]) {
+ throw 'No such data channel exists.';
+ }
+
+ // don't share repeated content
+ if (screenshot != lastScreenshot) {
+ lastScreenshot = screenshot;
+ connection.channels[that.userid].send({
+ screenshot: screenshot,
+ isPartOfScreen: true
+ });
+ }
+
+ // "once" can be used to share single screenshot
+ !args.once && setTimeout(partOfScreenCapturer, args.interval || 200);
+ }
+ });
+ }
+
+ partOfScreenCapturer();
+ },
+ getConnectionStats: function(callback, interval) {
+ if (!callback) throw 'callback is mandatory.';
+
+ if (!window.getConnectionStats) {
+ loadScript(connection.resources.getConnectionStats, invoker);
+ } else invoker();
+
+ function invoker() {
+ RTCPeerConnection.prototype.getConnectionStats = window.getConnectionStats;
+ peer.connection && peer.connection.getConnectionStats(callback, interval);
+ }
+ },
+ takeSnapshot: function(callback) {
+ takeSnapshot({
+ userid: this.userid,
+ connection: connection,
+ callback: callback
+ });
+ }
+ };
+ }
+
+ function onSessionOpened() {
+ // original conferencing infrastructure!
+ if (connection.isInitiator && getLength(participants) && getLength(participants) <= connection.maxParticipantsAllowed) {
+ if (!connection.session.oneway && !connection.session.broadcast) {
+ defaultSocket.send({
+ sessionid: connection.sessionid,
+ newParticipant: _config.userid || socket.channel,
+ userData: {
+ userid: _config.userid || socket.channel,
+ extra: _config.extra
+ }
+ });
+ }
+ }
+
+ // 1st: renegotiation is supported only on chrome
+ // 2nd: must not renegotiate same media multiple times
+ // 3rd: todo: make sure that target-user has no such "renegotiated" media.
+ if (_config.userinfo.browser == 'chrome' && !_config.renegotiatedOnce) {
+ // this code snippet is added to make sure that "previously-renegotiated" streams are also
+ // renegotiated to this new user
+ for (var rSession in connection.renegotiatedSessions) {
+ _config.renegotiatedOnce = true;
+
+ if (connection.renegotiatedSessions[rSession] && connection.renegotiatedSessions[rSession].stream) {
+ connection.peers[_config.userid].renegotiate(connection.renegotiatedSessions[rSession].stream, connection.renegotiatedSessions[rSession].session);
+ }
+ }
+ }
+ }
+
+ function socketResponse(response) {
+ if (isRMSDeleted) return;
+
+ if (response.userid == connection.userid)
+ return;
+
+ if (response.sdp) {
+ _config.userid = response.userid;
+ _config.extra = response.extra || {};
+ _config.renegotiate = response.renegotiate;
+ _config.streaminfo = response.streaminfo;
+ _config.isInitiator = response.isInitiator;
+ _config.userinfo = response.userinfo;
+
+ var sdp = JSON.parse(response.sdp);
+
+ if (sdp.type == 'offer') {
+ // to synchronize SCTP or RTP
+ peerConfig.preferSCTP = !!response.preferSCTP;
+ connection.fakeDataChannels = !!response.fakeDataChannels;
+ }
+
+ // initializing fake channel
+ initFakeChannel();
+
+ sdpInvoker(sdp, response.labels);
+ }
+
+ if (response.candidate) {
+ peer && peer.addIceCandidate(JSON.parse(response.candidate));
+ }
+
+ if (response.streamid) {
+ if (!rtcMultiSession.streamids) {
+ rtcMultiSession.streamids = {};
+ }
+ if (!rtcMultiSession.streamids[response.streamid]) {
+ rtcMultiSession.streamids[response.streamid] = response.streamid;
+ connection.onstreamid(response);
+ }
+ }
+
+ if (response.mute || response.unmute) {
+ if (response.promptMuteUnmute) {
+ if (!connection.privileges.canMuteRemoteStream) {
+ connection.onstatechange({
+ userid: response.userid,
+ extra: response.extra,
+ name: 'mute-request-denied',
+ reason: response.userid + ' tried to mute your stream; however "privileges.canMuteRemoteStream" is "false".'
+ });
+ return;
+ }
+
+ if (connection.streams[response.streamid]) {
+ if (response.mute && !connection.streams[response.streamid].muted) {
+ connection.streams[response.streamid].mute(response.session);
+ }
+ if (response.unmute && connection.streams[response.streamid].muted) {
+ connection.streams[response.streamid].unmute(response.session);
+ }
+ }
+ } else {
+ var streamObject = {};
+ if (connection.streams[response.streamid]) {
+ streamObject = connection.streams[response.streamid];
+ }
+
+ var session = response.session;
+ var fakeObject = merge({}, streamObject);
+ fakeObject.session = session;
+
+ fakeObject.isAudio = !!fakeObject.session.audio && !fakeObject.session.video;
+ fakeObject.isVideo = !!fakeObject.session.video;
+ fakeObject.isScreen = !!fakeObject.session.screen;
+
+ if (response.mute) connection.onmute(fakeObject || response);
+ if (response.unmute) connection.onunmute(fakeObject || response);
+ }
+ }
+
+ if (response.isVolumeChanged) {
+ log('Volume of stream: ' + response.streamid + ' has changed to: ' + response.volume);
+ if (connection.streams[response.streamid]) {
+ var mediaElement = connection.streams[response.streamid].mediaElement;
+ if (mediaElement) mediaElement.volume = response.volume;
+ }
+ }
+
+ // to stop local stream
+ if (response.stopped) {
+ if (connection.streams[response.streamid]) {
+ onStreamEndedHandler(connection.streams[response.streamid], connection);
+ }
+ }
+
+ // to stop remote stream
+ if (response.promptStreamStop /* && !connection.isInitiator */ ) {
+ if (!connection.privileges.canStopRemoteStream) {
+ connection.onstatechange({
+ userid: response.userid,
+ extra: response.extra,
+ name: 'stop-request-denied',
+ reason: response.userid + ' tried to stop your stream; however "privileges.canStopRemoteStream" is "false".'
+ });
+ return;
+ }
+ warn('Remote stream has been manually stopped!');
+ if (connection.streams[response.streamid]) {
+ connection.streams[response.streamid].stop();
+ }
+ }
+
+ if (response.left) {
+ // firefox is unable to stop remote streams
+ // firefox doesn't auto stop streams when peer.close() is called.
+ if (isFirefox) {
+ var userLeft = response.userid;
+ for (var stream in connection.streams) {
+ stream = connection.streams[stream];
+ if (stream.userid == userLeft) {
+ connection.stopMediaStream(stream);
+ onStreamEndedHandler(stream, connection);
+ }
+ }
+ }
+
+ if (peer && peer.connection) {
+ // todo: verify if-block's 2nd condition
+ if (peer.connection.signalingState != 'closed' && peer.connection.iceConnectionState.search(/disconnected|failed/gi) == -1) {
+ peer.connection.close();
+ }
+ peer.connection = null;
+ }
+
+ if (participants[response.userid]) delete participants[response.userid];
+
+ if (response.closeEntireSession) {
+ connection.onSessionClosed(response);
+ connection.leave();
+ return;
+ }
+
+ connection.remove(response.userid);
+
+ onLeaveHandler({
+ userid: response.userid,
+ extra: response.extra || {},
+ entireSessionClosed: !!response.closeEntireSession
+ }, connection);
+ }
+
+ // keeping session active even if initiator leaves
+ if (response.playRoleOfBroadcaster) {
+ if (response.extra) {
+ // clone extra-data from initial moderator
+ connection.extra = merge(connection.extra, response.extra);
+ }
+ if (response.participants) {
+ participants = response.participants;
+
+ // make sure that if 2nd initiator leaves; control is shifted to 3rd person.
+ if (participants[connection.userid]) {
+ delete participants[connection.userid];
+ }
+
+ if (sockets[0] && sockets[0].userid == response.userid) {
+ delete sockets[0];
+ sockets = swap(sockets);
+ }
+
+ if (socketObjects[response.userid]) {
+ delete socketObjects[response.userid];
+ }
+ }
+
+ setTimeout(connection.playRoleOfInitiator, 2000);
+ }
+
+ if (response.changeBandwidth) {
+ if (!connection.peers[response.userid]) throw 'No such peer exists.';
+
+ // synchronize bandwidth
+ connection.peers[response.userid].peer.bandwidth = response.bandwidth;
+
+ // renegotiate to apply bandwidth
+ connection.peers[response.userid].renegotiate();
+ }
+
+ if (response.customMessage) {
+ if (!connection.peers[response.userid]) throw 'No such peer exists.';
+ if (response.message.ejected) {
+ if (connection.sessionDescriptions[connection.sessionid].userid != response.userid) {
+ throw 'only initiator can eject a user.';
+ }
+ // initiator ejected this user
+ connection.leave();
+
+ connection.onSessionClosed({
+ userid: response.userid,
+ extra: response.extra || _config.extra,
+ isEjected: true
+ });
+ } else connection.peers[response.userid].onCustomMessage(response.message);
+ }
+
+ if (response.drop) {
+ if (!connection.peers[response.userid]) throw 'No such peer exists.';
+ connection.peers[response.userid].drop(true);
+ connection.peers[response.userid].renegotiate();
+
+ connection.ondrop(response.userid);
+ }
+
+ if (response.hold || response.unhold) {
+ if (!connection.peers[response.userid]) throw 'No such peer exists.';
+
+ if (response.takeAction) {
+ connection.peers[response.userid][!!response.hold ? 'hold' : 'unhold'](response.holdMLine);
+ return;
+ }
+
+ connection.peers[response.userid].peer.hold = !!response.hold;
+ connection.peers[response.userid].peer.holdMLine = response.holdMLine;
+
+ socket.send({
+ isRenegotiate: true
+ });
+
+ connection.peers[response.userid].fireHoldUnHoldEvents({
+ kind: response.holdMLine,
+ isHold: !!response.hold,
+ userid: response.userid
+ });
+ }
+
+ if (response.isRenegotiate) {
+ connection.peers[response.userid].renegotiate(null, connection.peers[response.userid].peer.session);
+ }
+
+ // fake data channels!
+ if (response.fakeData) {
+ peerConfig.onmessage(response.fakeData);
+ }
+
+ // sometimes we don't need to renegotiate e.g. when peers are disconnected
+ // or if it is firefox
+ if (response.recreatePeer) {
+ peer = new PeerConnection();
+ }
+
+ // remote video failed either out of ICE gathering process or ICE connectivity check-up
+ // or IceAgent was unable to locate valid candidates/ports.
+ if (response.failedToReceiveRemoteVideo) {
+ log('Remote peer hasn\'t received stream: ' + response.streamid + '. Renegotiating...');
+ if (connection.peers[response.userid]) {
+ connection.peers[response.userid].renegotiate();
+ }
+ }
+
+ if (response.redial) {
+ if (connection.peers[response.userid]) {
+ if (connection.peers[response.userid].peer.connection.iceConnectionState != 'disconnected') {
+ _config.redialing = false;
+ }
+
+ if (connection.peers[response.userid].peer.connection.iceConnectionState == 'disconnected' && !_config.redialing) {
+ _config.redialing = true;
+
+ warn('Peer connection is closed.', toStr(connection.peers[response.userid].peer.connection), 'ReDialing..');
+ connection.peers[response.userid].redial();
+ }
+ }
+ }
+ }
+
+ connection.playRoleOfInitiator = function() {
+ connection.dontCaptureUserMedia = true;
+ connection.open();
+ sockets = swap(sockets);
+ connection.dontCaptureUserMedia = false;
+ };
+
+ connection.askToShareParticipants = function() {
+ defaultSocket && defaultSocket.send({
+ askToShareParticipants: true
+ });
+ };
+
+ connection.shareParticipants = function(args) {
+ var message = {
+ joinUsers: participants,
+ userid: connection.userid,
+ extra: connection.extra
+ };
+
+ if (args) {
+ if (args.dontShareWith) message.dontShareWith = args.dontShareWith;
+ if (args.shareWith) message.shareWith = args.shareWith;
+ }
+
+ defaultSocket.send(message);
+ };
+
+ function sdpInvoker(sdp, labels) {
+ if (sdp.type == 'answer') {
+ peer.setRemoteDescription(sdp);
+ updateSocket();
+ return;
+ }
+ if (!_config.renegotiate && sdp.type == 'offer') {
+ peerConfig.offerDescription = sdp;
+
+ peerConfig.session = connection.session;
+ if (!peer) peer = new PeerConnection();
+ peer.create('answer', peerConfig);
+
+ updateSocket();
+ return;
+ }
+
+ var session = _config.renegotiate;
+ // detach streams
+ detachMediaStream(labels, peer.connection);
+
+ if (session.oneway || isData(session)) {
+ createAnswer();
+ delete _config.renegotiate;
+ } else {
+ if (_config.capturing)
+ return;
+
+ _config.capturing = true;
+
+ connection.captureUserMedia(function(stream) {
+ _config.capturing = false;
+
+ peer.addStream(stream);
+
+ connection.renegotiatedSessions[JSON.stringify(_config.renegotiate)] = {
+ session: _config.renegotiate,
+ stream: stream
+ };
+
+ delete _config.renegotiate;
+
+ createAnswer();
+ }, _config.renegotiate);
+ }
+
+ function createAnswer() {
+ peer.recreateAnswer(sdp, session, function(_sdp, streaminfo) {
+ sendsdp({
+ sdp: _sdp,
+ socket: socket,
+ streaminfo: streaminfo
+ });
+ connection.detachStreams = [];
+ });
+ }
+ }
+ }
+
+ function detachMediaStream(labels, peer) {
+ if (!labels) return;
+ for (var i = 0; i < labels.length; i++) {
+ var label = labels[i];
+ if (connection.streams[label]) {
+ peer.removeStream(connection.streams[label].stream);
+ }
+ }
+ }
+
+ function sendsdp(e) {
+ e.socket.send({
+ sdp: JSON.stringify({
+ sdp: e.sdp.sdp,
+ type: e.sdp.type
+ }),
+ renegotiate: !!e.renegotiate ? e.renegotiate : false,
+ streaminfo: e.streaminfo || '',
+ labels: e.labels || [],
+ preferSCTP: !!connection.preferSCTP,
+ fakeDataChannels: !!connection.fakeDataChannels,
+ isInitiator: !!connection.isInitiator,
+ userinfo: {
+ browser: isFirefox ? 'firefox' : 'chrome'
+ }
+ });
+ }
+
+ // sharing new user with existing participants
+
+ function onNewParticipant(response) {
+ var channel = response.newParticipant;
+
+ if (!channel || !!participants[channel] || channel == connection.userid)
+ return;
+
+ var new_channel = connection.token();
+ newPrivateSocket({
+ channel: new_channel,
+ extra: response.userData ? response.userData.extra : response.extra,
+ userid: response.userData ? response.userData.userid : response.userid
+ });
+
+ defaultSocket.send({
+ participant: true,
+ targetUser: channel,
+ channel: new_channel
+ });
+ }
+
+ // if a user leaves
+
+ function clearSession() {
+ connection.numberOfConnectedUsers--;
+
+ var alertMessage = {
+ left: true,
+ extra: connection.extra || {},
+ userid: connection.userid,
+ sessionid: connection.sessionid
+ };
+
+ if (connection.isInitiator) {
+ // if initiator wants to close entire session
+ if (connection.autoCloseEntireSession) {
+ alertMessage.closeEntireSession = true;
+ } else if (sockets[0]) {
+ // shift initiation control to another user
+ sockets[0].send({
+ playRoleOfBroadcaster: true,
+ userid: connection.userid,
+ extra: connection.extra,
+ participants: participants
+ });
+ }
+ }
+
+ sockets.forEach(function(socket, i) {
+ socket.send(alertMessage);
+
+ if (socketObjects[socket.channel]) {
+ delete socketObjects[socket.channel];
+ }
+
+ delete sockets[i];
+ });
+
+ sockets = swap(sockets);
+
+ connection.refresh();
+
+ webAudioMediaStreamSources.forEach(function(mediaStreamSource) {
+ // if source is connected; then chrome will crash on unload.
+ mediaStreamSource.disconnect();
+ });
+
+ webAudioMediaStreamSources = [];
+ }
+
+ // www.RTCMultiConnection.org/docs/remove/
+ connection.remove = function(userid) {
+ if (rtcMultiSession.requestsFrom && rtcMultiSession.requestsFrom[userid]) delete rtcMultiSession.requestsFrom[userid];
+
+ if (connection.peers[userid]) {
+ if (connection.peers[userid].peer && connection.peers[userid].peer.connection) {
+ if (connection.peers[userid].peer.connection.signalingState != 'closed') {
+ connection.peers[userid].peer.connection.close();
+ }
+ connection.peers[userid].peer.connection = null;
+ }
+ delete connection.peers[userid];
+ }
+ if (participants[userid]) {
+ delete participants[userid];
+ }
+
+ for (var stream in connection.streams) {
+ stream = connection.streams[stream];
+ if (stream.userid == userid) {
+ onStreamEndedHandler(stream, connection);
+ delete connection.streams[stream];
+ }
+ }
+
+ if (socketObjects[userid]) {
+ delete socketObjects[userid];
+ }
+ };
+
+ // www.RTCMultiConnection.org/docs/refresh/
+ connection.refresh = function() {
+ // if firebase; remove data from firebase servers
+ if (connection.isInitiator && !!connection.socket && !!connection.socket.remove) {
+ connection.socket.remove();
+ }
+
+ participants = {};
+
+ // to stop/remove self streams
+ for (var i = 0; i < connection.attachStreams.length; i++) {
+ connection.stopMediaStream(connection.attachStreams[i]);
+ }
+
+ // to allow capturing of identical streams
+ currentUserMediaRequest = {
+ streams: [],
+ mutex: false,
+ queueRequests: []
+ };
+
+ rtcMultiSession.isOwnerLeaving = true;
+
+ connection.isInitiator = false;
+ connection.isAcceptNewSession = true;
+ connection.attachMediaStreams = [];
+ connection.sessionDescription = null;
+ connection.sessionDescriptions = {};
+ connection.localStreamids = [];
+ connection.preRecordedMedias = {};
+ connection.snapshots = {};
+
+ connection.numberOfConnectedUsers = 0;
+ connection.numberOfSessions = 0;
+
+ connection.attachStreams = [];
+ connection.detachStreams = [];
+ connection.fileQueue = {};
+ connection.channels = {};
+ connection.renegotiatedSessions = {};
+
+ for (var peer in connection.peers) {
+ if (peer != connection.userid) {
+ delete connection.peers[peer];
+ }
+ }
+
+ // to make sure remote streams are also removed!
+ for (var stream in connection.streams) {
+ if (connection._skip.indexOf(stream) == -1) {
+ onStreamEndedHandler(connection.streams[stream], connection);
+ delete connection.streams[stream];
+ }
+ }
+
+ socketObjects = {};
+ sockets = [];
+ participants = {};
+ };
+
+ // www.RTCMultiConnection.org/docs/reject/
+ connection.reject = function(userid) {
+ if (!isString(userid)) userid = userid.userid;
+ defaultSocket.send({
+ rejectedRequestOf: userid
+ });
+
+ // remove relevant data to allow him join again
+ connection.remove(userid);
+ };
+
+ rtcMultiSession.leaveHandler = function(e) {
+ if (!connection.leaveOnPageUnload) return;
+
+ if (isNull(e.keyCode)) {
+ return clearSession();
+ }
+
+ if (e.keyCode == 116) {
+ clearSession();
+ }
+ };
+
+ listenEventHandler('beforeunload', rtcMultiSession.leaveHandler);
+ listenEventHandler('keyup', rtcMultiSession.leaveHandler);
+
+ rtcMultiSession.onLineOffLineHandler = function() {
+ if (!navigator.onLine) {
+ rtcMultiSession.isOffLine = true;
+ } else if (rtcMultiSession.isOffLine) {
+ rtcMultiSession.isOffLine = !navigator.onLine;
+
+ // defaultSocket = getDefaultSocketRef();
+
+ // pending tasks should be resumed?
+ // sockets should be reconnected?
+ // peers should be re-established?
+ }
+ };
+
+ listenEventHandler('load', rtcMultiSession.onLineOffLineHandler);
+ listenEventHandler('online', rtcMultiSession.onLineOffLineHandler);
+ listenEventHandler('offline', rtcMultiSession.onLineOffLineHandler);
+
+ function onSignalingReady() {
+ if (rtcMultiSession.signalingReady) return;
+ rtcMultiSession.signalingReady = true;
+
+ setTimeout(callbackForSignalingReady, 1000);
+
+ if (!connection.isInitiator) {
+ // as soon as signaling gateway is connected;
+ // user should check existing rooms!
+ defaultSocket && defaultSocket.send({
+ searchingForRooms: true
+ });
+ }
+ }
+
+ function joinParticipants(joinUsers) {
+ for (var user in joinUsers) {
+ if (!participants[joinUsers[user]]) {
+ onNewParticipant({
+ sessionid: connection.sessionid,
+ newParticipant: joinUsers[user],
+ userid: connection.userid,
+ extra: connection.extra
+ });
+ }
+ }
+ }
+
+ function getDefaultSocketRef() {
+ return connection.openSignalingChannel({
+ onmessage: function(response) {
+ // RMS == RTCMultiSession
+ if (isRMSDeleted) return;
+
+ // if message is sent by same user
+ if (response.userid == connection.userid) return;
+
+ if (response.sessionid && response.userid) {
+ if (!connection.sessionDescriptions[response.sessionid]) {
+ connection.numberOfSessions++;
+ connection.sessionDescriptions[response.sessionid] = response;
+
+ // fire "onNewSession" only if:
+ // 1) "isAcceptNewSession" boolean is true
+ // 2) "sessionDescriptions" object isn't having same session i.e. to prevent duplicate invocations
+ if (connection.isAcceptNewSession) {
+
+ if (!connection.dontOverrideSession) {
+ connection.session = response.session;
+ }
+
+ onNewSession(response);
+ }
+ }
+ }
+
+ if (response.newParticipant && !connection.isAcceptNewSession && rtcMultiSession.broadcasterid === response.userid) {
+ if (response.newParticipant != connection.userid) {
+ onNewParticipant(response);
+ }
+ }
+
+ if (getLength(participants) < connection.maxParticipantsAllowed && response.targetUser == connection.userid && response.participant) {
+ if (connection.peers[response.userid] && !connection.peers[response.userid].peer) {
+ delete participants[response.userid];
+ delete connection.peers[response.userid];
+ connection.isAcceptNewSession = true;
+ return acceptRequest(response);
+ }
+
+ if (!participants[response.userid]) {
+ acceptRequest(response);
+ }
+ }
+
+ if (response.acceptedRequestOf == connection.userid) {
+ connection.onstatechange({
+ userid: response.userid,
+ extra: response.extra,
+ name: 'request-accepted',
+ reason: response.userid + ' accepted your participation request.'
+ });
+ }
+
+ if (response.rejectedRequestOf == connection.userid) {
+ connection.onstatechange({
+ userid: response.userid,
+ extra: response.extra,
+ name: 'request-rejected',
+ reason: response.userid + ' rejected your participation request.'
+ });
+ }
+
+ if (response.customMessage) {
+ if (response.message.drop) {
+ connection.ondrop(response.userid);
+
+ connection.attachStreams = [];
+ // "drop" should detach all local streams
+ for (var stream in connection.streams) {
+ if (connection._skip.indexOf(stream) == -1) {
+ stream = connection.streams[stream];
+ if (stream.type == 'local') {
+ connection.detachStreams.push(stream.streamid);
+ onStreamEndedHandler(stream, connection);
+ } else onStreamEndedHandler(stream, connection);
+ }
+ }
+
+ if (response.message.renegotiate) {
+ // renegotiate; so "peer.removeStream" happens.
+ connection.renegotiate();
+ }
+ } else if (connection.onCustomMessage) {
+ connection.onCustomMessage(response.message);
+ }
+ }
+
+ if (connection.isInitiator && response.searchingForRooms) {
+ defaultSocket && defaultSocket.send({
+ sessionDescription: connection.sessionDescription,
+ responseFor: response.userid
+ });
+ }
+
+ if (response.sessionDescription && response.responseFor == connection.userid) {
+ var sessionDescription = response.sessionDescription;
+ if (!connection.sessionDescriptions[sessionDescription.sessionid]) {
+ connection.numberOfSessions++;
+ connection.sessionDescriptions[sessionDescription.sessionid] = sessionDescription;
+ }
+ }
+
+ if (connection.isInitiator && response.askToShareParticipants && defaultSocket) {
+ connection.shareParticipants({
+ shareWith: response.userid
+ });
+ }
+
+ // participants are shared with single user
+ if (response.shareWith == connection.userid && response.dontShareWith != connection.userid && response.joinUsers) {
+ joinParticipants(response.joinUsers);
+ }
+
+ // participants are shared with all users
+ if (!response.shareWith && response.joinUsers) {
+ if (response.dontShareWith) {
+ if (connection.userid != response.dontShareWith) {
+ joinParticipants(response.joinUsers);
+ }
+ } else joinParticipants(response.joinUsers);
+ }
+
+ if (response.messageFor == connection.userid && response.presenceState) {
+ if (response.presenceState == 'checking') {
+ defaultSocket.send({
+ messageFor: response.userid,
+ presenceState: 'available',
+ _config: response._config
+ });
+ log('participant asked for availability');
+ }
+
+ if (response.presenceState == 'available') {
+ rtcMultiSession.presenceState = 'available';
+
+ connection.onstatechange({
+ userid: 'browser',
+ extra: {},
+ name: 'room-available',
+ reason: 'Initiator is available and room is active.'
+ });
+
+ joinSession(response._config);
+ }
+ }
+
+ if (response.donotJoin && response.messageFor == connection.userid) {
+ log(response.userid, 'is not joining your room.');
+ }
+
+ // if initiator disconnects sockets, participants should also disconnect
+ if (response.isDisconnectSockets) {
+ log('Disconnecting your sockets because initiator also disconnected his sockets.');
+ connection.disconnect();
+ }
+ },
+ callback: function(socket) {
+ socket && this.onopen(socket);
+ },
+ onopen: function(socket) {
+ if (socket) defaultSocket = socket;
+ if (onSignalingReady) onSignalingReady();
+
+ rtcMultiSession.defaultSocket = defaultSocket;
+
+ if (!defaultSocket.__push) {
+ defaultSocket.__push = defaultSocket.send;
+ defaultSocket.send = function(message) {
+ message.userid = message.userid || connection.userid;
+ message.extra = message.extra || connection.extra || {};
+
+ defaultSocket.__push(message);
+ };
+ }
+ }
+ });
+ }
+
+ // default-socket is a common socket shared among all users in a specific channel;
+ // to share participation requests; room descriptions; and other stuff.
+ var defaultSocket = getDefaultSocketRef();
+
+ rtcMultiSession.defaultSocket = defaultSocket;
+
+ if (defaultSocket && onSignalingReady) setTimeout(onSignalingReady, 2000);
+
+ if (connection.session.screen) {
+ loadScreenFrame();
+ }
+ // CUSTOM CODE //
+
+ /* Commenting this
+ connection.getExternalIceServers && loadIceFrame(function(iceServers)
+ {
+ connection.iceServers = connection.iceServers.concat(iceServers);
+ });
+ */
+
+ // CUSTOM CODE //
+
+ if (connection.log == false) connection.skipLogs();
+ if (connection.onlog) {
+ log = warn = error = function() {
+ var log = {};
+ var index = 0;
+ Array.prototype.slice.call(arguments).forEach(function(argument) {
+ log[index++] = toStr(argument);
+ });
+ toStr = function(str) {
+ return str;
+ };
+ connection.onlog(log);
+ };
+ }
+
+ function setDirections() {
+ var userMaxParticipantsAllowed = 0;
+
+ // if user has set a custom max participant setting, remember it
+ if (connection.maxParticipantsAllowed != 256) {
+ userMaxParticipantsAllowed = connection.maxParticipantsAllowed;
+ }
+
+ if (connection.direction == 'one-way') connection.session.oneway = true;
+ if (connection.direction == 'one-to-one') connection.maxParticipantsAllowed = 1;
+ if (connection.direction == 'one-to-many') connection.session.broadcast = true;
+ if (connection.direction == 'many-to-many') {
+ if (!connection.maxParticipantsAllowed || connection.maxParticipantsAllowed == 1) {
+ connection.maxParticipantsAllowed = 256;
+ }
+ }
+
+ // if user has set a custom max participant setting, set it back
+ if (userMaxParticipantsAllowed && connection.maxParticipantsAllowed != 1) {
+ connection.maxParticipantsAllowed = userMaxParticipantsAllowed;
+ }
+ }
+
+ // open new session
+ this.initSession = function(args) {
+ rtcMultiSession.isOwnerLeaving = false;
+
+ setDirections();
+ participants = {};
+
+ rtcMultiSession.isOwnerLeaving = false;
+
+ if (!isNull(args.transmitRoomOnce)) {
+ connection.transmitRoomOnce = args.transmitRoomOnce;
+ }
+
+ function transmit() {
+ if (defaultSocket && getLength(participants) < connection.maxParticipantsAllowed && !rtcMultiSession.isOwnerLeaving) {
+ defaultSocket.send(connection.sessionDescription);
+ }
+
+ if (!connection.transmitRoomOnce && !rtcMultiSession.isOwnerLeaving)
+ setTimeout(transmit, connection.interval || 3000);
+ }
+
+ // todo: test and fix next line.
+ if (!args.dontTransmit /* || connection.transmitRoomOnce */ ) transmit();
+ };
+
+ function joinSession(_config, skipOnStateChange) {
+ if (rtcMultiSession.donotJoin && rtcMultiSession.donotJoin == _config.sessionid) {
+ return;
+ }
+
+ // dontOverrideSession allows you force RTCMultiConnection
+ // to not override default session for participants;
+ // by default, session is always overridden and set to the session coming from initiator!
+ if (!connection.dontOverrideSession) {
+ connection.session = _config.session || {};
+ }
+
+ // make sure that inappropriate users shouldn't receive onNewSession event
+ rtcMultiSession.broadcasterid = _config.userid;
+
+ if (_config.sessionid) {
+ // used later to prevent external rooms messages to be used by this user!
+ connection.sessionid = _config.sessionid;
+ }
+
+ connection.isAcceptNewSession = false;
+
+ var channel = getRandomString();
+ newPrivateSocket({
+ channel: channel,
+ extra: _config.extra || {},
+ userid: _config.userid
+ });
+
+ var offers = {};
+ if (connection.attachStreams.length) {
+ var stream = connection.attachStreams[connection.attachStreams.length - 1];
+ if (!!stream.getAudioTracks && stream.getAudioTracks().length) {
+ offers.audio = true;
+ }
+ if (stream.getVideoTracks().length) {
+ offers.video = true;
+ }
+ }
+
+ if (!isEmpty(offers)) {
+ log(toStr(offers));
+ } else log('Seems data-only connection.');
+
+ connection.onstatechange({
+ userid: _config.userid,
+ extra: {},
+ name: 'connecting-with-initiator',
+ reason: 'Checking presence of the initiator; and the room.'
+ });
+
+ defaultSocket.send({
+ participant: true,
+ channel: channel,
+ targetUser: _config.userid,
+ session: connection.session,
+ offers: {
+ audio: !!offers.audio,
+ video: !!offers.video
+ }
+ });
+
+ connection.skipOnNewSession = false;
+ invokeMediaCaptured(connection);
+ }
+
+ // join existing session
+ this.joinSession = function(_config) {
+ if (!defaultSocket)
+ return setTimeout(function() {
+ warn('Default-Socket is not yet initialized.');
+ rtcMultiSession.joinSession(_config);
+ }, 1000);
+
+ _config = _config || {};
+ participants = {};
+
+ rtcMultiSession.presenceState = 'checking';
+
+ connection.onstatechange({
+ userid: _config.userid,
+ extra: _config.extra || {},
+ name: 'detecting-room-presence',
+ reason: 'Checking presence of the room.'
+ });
+
+ function contactInitiator() {
+ defaultSocket.send({
+ messageFor: _config.userid,
+ presenceState: rtcMultiSession.presenceState,
+ _config: {
+ userid: _config.userid,
+ extra: _config.extra || {},
+ sessionid: _config.sessionid,
+ session: _config.session || false
+ }
+ });
+ }
+ contactInitiator();
+
+ function checker() {
+ if (rtcMultiSession.presenceState == 'checking') {
+ warn('Unable to reach initiator. Trying again...');
+ contactInitiator();
+ setTimeout(function() {
+ if (rtcMultiSession.presenceState == 'checking') {
+ connection.onstatechange({
+ userid: _config.userid,
+ extra: _config.extra || {},
+ name: 'room-not-available',
+ reason: 'Initiator seems absent. Waiting for someone to open the room.'
+ });
+
+ connection.isAcceptNewSession = true;
+ setTimeout(checker, 2000);
+ }
+ }, 2000);
+ }
+ }
+
+ setTimeout(checker, 3000);
+ };
+
+ connection.donotJoin = function(sessionid) {
+ rtcMultiSession.donotJoin = sessionid;
+
+ var session = connection.sessionDescriptions[sessionid];
+ if (!session) return;
+
+ defaultSocket.send({
+ donotJoin: true,
+ messageFor: session.userid,
+ sessionid: sessionid
+ });
+
+ participants = {};
+ connection.isAcceptNewSession = true;
+ connection.sessionid = null;
+ };
+
+ // send file/data or text message
+ this.send = function(message, _channel) {
+ if (!(message instanceof ArrayBuffer || message instanceof DataView)) {
+ message = str2ab({
+ extra: connection.extra,
+ userid: connection.userid,
+ data: message
+ });
+ }
+
+ if (_channel) {
+ if (_channel.readyState == 'open') {
+ _channel.send(message);
+ }
+ return;
+ }
+
+ for (var dataChannel in connection.channels) {
+ var channel = connection.channels[dataChannel].channel;
+ if (channel.readyState == 'open') {
+ channel.send(message);
+ }
+ }
+ };
+
+ // leave session
+ this.leave = function() {
+ clearSession();
+ };
+
+ // renegotiate new stream
+ this.addStream = function(e) {
+ var session = e.renegotiate;
+
+ if (!connection.renegotiatedSessions[JSON.stringify(e.renegotiate)]) {
+ connection.renegotiatedSessions[JSON.stringify(e.renegotiate)] = {
+ session: e.renegotiate,
+ stream: e.stream
+ };
+ }
+
+ if (e.socket) {
+ if (e.socket.userid != connection.userid) {
+ addStream(connection.peers[e.socket.userid]);
+ }
+ } else {
+ for (var peer in connection.peers) {
+ if (peer != connection.userid) {
+ addStream(connection.peers[peer]);
+ }
+ }
+ }
+
+ function addStream(_peer) {
+ var socket = _peer.socket;
+
+ if (!socket) {
+ warn(_peer, 'doesn\'t has socket.');
+ return;
+ }
+
+ updateSocketForLocalStreams(socket);
+
+ if (!_peer || !_peer.peer) {
+ throw 'No peer to renegotiate.';
+ }
+
+ var peer = _peer.peer;
+
+ if (e.stream) {
+ if (!peer.attachStreams) {
+ peer.attachStreams = [];
+ }
+
+ peer.attachStreams.push(e.stream);
+ }
+
+ // detaching old streams
+ detachMediaStream(connection.detachStreams, peer.connection);
+
+ if (e.stream && (session.audio || session.video || session.screen)) {
+ peer.addStream(e.stream);
+ }
+
+ peer.recreateOffer(session, function(sdp, streaminfo) {
+ sendsdp({
+ sdp: sdp,
+ socket: socket,
+ renegotiate: session,
+ labels: connection.detachStreams,
+ streaminfo: streaminfo
+ });
+ connection.detachStreams = [];
+ });
+ }
+ };
+
+ // www.RTCMultiConnection.org/docs/request/
+ connection.request = function(userid, extra) {
+ connection.captureUserMedia(function() {
+ // open private socket that will be used to receive offer-sdp
+ newPrivateSocket({
+ channel: connection.userid,
+ extra: extra || {},
+ userid: userid
+ });
+
+ // ask other user to create offer-sdp
+ defaultSocket.send({
+ participant: true,
+ targetUser: userid
+ });
+ });
+ };
+
+ function acceptRequest(response) {
+ if (!rtcMultiSession.requestsFrom) rtcMultiSession.requestsFrom = {};
+ if (rtcMultiSession.requestsFrom[response.userid]) return;
+
+ var obj = {
+ userid: response.userid,
+ extra: response.extra,
+ channel: response.channel || response.userid,
+ session: response.session || connection.session
+ };
+
+ // check how participant is willing to join
+ if (response.offers) {
+ if (response.offers.audio && response.offers.video) {
+ log('target user has both audio/video streams.');
+ } else if (response.offers.audio && !response.offers.video) {
+ log('target user has only audio stream.');
+ } else if (!response.offers.audio && response.offers.video) {
+ log('target user has only video stream.');
+ } else {
+ log('target user has no stream; it seems one-way streaming or data-only connection.');
+ }
+
+ var mandatory = connection.sdpConstraints.mandatory;
+ if (isNull(mandatory.OfferToReceiveAudio)) {
+ connection.sdpConstraints.mandatory.OfferToReceiveAudio = !!response.offers.audio;
+ }
+ if (isNull(mandatory.OfferToReceiveVideo)) {
+ connection.sdpConstraints.mandatory.OfferToReceiveVideo = !!response.offers.video;
+ }
+
+ log('target user\'s SDP has?', toStr(connection.sdpConstraints.mandatory));
+ }
+
+ rtcMultiSession.requestsFrom[response.userid] = obj;
+
+ // www.RTCMultiConnection.org/docs/onRequest/
+ if (connection.onRequest && connection.isInitiator) {
+ connection.onRequest(obj);
+ } else _accept(obj);
+ }
+
+ function _accept(e) {
+ if (rtcMultiSession.captureUserMediaOnDemand) {
+ rtcMultiSession.captureUserMediaOnDemand = false;
+ connection.captureUserMedia(function() {
+ _accept(e);
+
+ invokeMediaCaptured(connection);
+ });
+ return;
+ }
+
+ log('accepting request from', e.userid);
+ participants[e.userid] = e.userid;
+ newPrivateSocket({
+ isofferer: true,
+ userid: e.userid,
+ channel: e.channel,
+ extra: e.extra || {},
+ session: e.session || connection.session
+ });
+ }
+
+ // www.RTCMultiConnection.org/docs/accept/
+ connection.accept = function(e) {
+ // for backward compatibility
+ if (arguments.length > 1 && isString(arguments[0])) {
+ e = {};
+ if (arguments[0]) e.userid = arguments[0];
+ if (arguments[1]) e.extra = arguments[1];
+ if (arguments[2]) e.channel = arguments[2];
+ }
+
+ connection.captureUserMedia(function() {
+ _accept(e);
+ });
+ };
+
+ var isRMSDeleted = false;
+ this.disconnect = function() {
+ this.isOwnerLeaving = true;
+
+ if (!connection.keepStreamsOpened) {
+ for (var streamid in connection.localStreams) {
+ connection.localStreams[streamid].stop();
+ }
+ connection.localStreams = {};
+
+ currentUserMediaRequest = {
+ streams: [],
+ mutex: false,
+ queueRequests: []
+ };
+ }
+
+ if (connection.isInitiator) {
+ defaultSocket.send({
+ isDisconnectSockets: true
+ });
+ }
+
+ connection.refresh();
+
+ rtcMultiSession.defaultSocket = defaultSocket = null;
+ isRMSDeleted = true;
+
+ connection.ondisconnected({
+ userid: connection.userid,
+ extra: connection.extra,
+ peer: connection.peers[connection.userid],
+ isSocketsDisconnected: true
+ });
+
+ // if there is any peer still opened; close it.
+ connection.close();
+
+ window.removeEventListener('beforeunload', rtcMultiSession.leaveHandler);
+ window.removeEventListener('keyup', rtcMultiSession.leaveHandler);
+
+ // it will not work, though :)
+ delete this;
+
+ log('Disconnected your sockets, peers, streams and everything except RTCMultiConnection object.');
+ };
+ }
+
+ var webAudioMediaStreamSources = [];
+
+ function convertToAudioStream(mediaStream) {
+ if (!mediaStream) throw 'MediaStream is mandatory.';
+
+ if (mediaStream.getVideoTracks && !mediaStream.getVideoTracks().length) {
+ return mediaStream;
+ }
+
+ var context = new AudioContext();
+ var mediaStreamSource = context.createMediaStreamSource(mediaStream);
+
+ var destination = context.createMediaStreamDestination();
+ mediaStreamSource.connect(destination);
+
+ webAudioMediaStreamSources.push(mediaStreamSource);
+
+ return destination.stream;
+ }
+
+ var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
+ var isFirefox = typeof window.InstallTrigger !== 'undefined';
+ var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
+ var isChrome = !!window.chrome && !isOpera;
+ var isIE = !!document.documentMode;
+
+ var isPluginRTC = isSafari || isIE;
+
+ var isMobileDevice = !!navigator.userAgent.match(/Android|iPhone|iPad|iPod|BlackBerry|IEMobile/i);
+
+ // detect node-webkit
+ var isNodeWebkit = !!(window.process && (typeof window.process == 'object') && window.process.versions && window.process.versions['node-webkit']);
+
+ window.MediaStream = window.MediaStream || window.webkitMediaStream;
+ window.AudioContext = window.AudioContext || window.webkitAudioContext;
+
+ function getRandomString() {
+ // suggested by @rvulpescu from #154
+ if (window.crypto && crypto.getRandomValues && navigator.userAgent.indexOf('Safari') == -1) {
+ var a = window.crypto.getRandomValues(new Uint32Array(3)),
+ token = '';
+ for (var i = 0, l = a.length; i < l; i++) {
+ token += a[i].toString(36);
+ }
+ return token;
+ } else {
+ return (Math.random() * new Date().getTime()).toString(36).replace(/\./g, '');
+ }
+ }
+
+ var chromeVersion = 50;
+ var matchArray = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
+ if (isChrome && matchArray && matchArray[2]) {
+ chromeVersion = parseInt(matchArray[2], 10);
+ }
+
+ var firefoxVersion = 50;
+ matchArray = navigator.userAgent.match(/Firefox\/(.*)/);
+ if (isFirefox && matchArray && matchArray[1]) {
+ firefoxVersion = parseInt(matchArray[1], 10);
+ }
+
+ function isData(session) {
+ return !session.audio && !session.video && !session.screen && session.data;
+ }
+
+ function isNull(obj) {
+ return typeof obj == 'undefined';
+ }
+
+ function isString(obj) {
+ return typeof obj == 'string';
+ }
+
+ function isEmpty(session) {
+ var length = 0;
+ for (var s in session) {
+ length++;
+ }
+ return length == 0;
+ }
+
+ // this method converts array-buffer into string
+ function ab2str(buf) {
+ var result = '';
+ try {
+ result = String.fromCharCode.apply(null, new Uint16Array(buf));
+ } catch (e) {}
+ return result;
+ }
+
+ // this method converts string into array-buffer
+ function str2ab(str) {
+ if (!isString(str)) str = JSON.stringify(str);
+
+ var buf = new ArrayBuffer(str.length * 2); // 2 bytes for each char
+ var bufView = new Uint16Array(buf);
+ for (var i = 0, strLen = str.length; i < strLen; i++) {
+ bufView[i] = str.charCodeAt(i);
+ }
+ return buf;
+ }
+
+ function swap(arr) {
+ var swapped = [],
+ length = arr.length;
+ for (var i = 0; i < length; i++)
+ if (arr[i] && arr[i] !== true)
+ swapped.push(arr[i]);
+ return swapped;
+ }
+
+ function forEach(obj, callback) {
+ for (var item in obj) {
+ callback(obj[item], item);
+ }
+ }
+
+ var console = window.console || {
+ log: function() {},
+ error: function() {},
+ warn: function() {}
+ };
+
+ function log() {
+ console.log(arguments);
+ }
+
+ function error() {
+ console.error(arguments);
+ }
+
+ function warn() {
+ console.warn(arguments);
+ }
+
+ if (isChrome || isFirefox || isSafari) {
+ var log = console.log.bind(console);
+ var error = console.error.bind(console);
+ var warn = console.warn.bind(console);
+ }
+
+ function toStr(obj) {
+ return JSON.stringify(obj, function(key, value) {
+ if (value && value.sdp) {
+ log(value.sdp.type, '\t', value.sdp.sdp);
+ return '';
+ } else return value;
+ }, '\t');
+ }
+
+ function getLength(obj) {
+ var length = 0;
+ for (var o in obj)
+ if (o) length++;
+ return length;
+ }
+
+ // Get HTMLAudioElement/HTMLVideoElement accordingly
+
+ function createMediaElement(stream, session) {
+ var mediaElement = document.createElement(stream.isAudio ? 'audio' : 'video');
+ mediaElement.id = stream.streamid;
+
+ if (isPluginRTC) {
+ var body = (document.body || document.documentElement);
+ body.insertBefore(mediaElement, body.firstChild);
+
+ setTimeout(function() {
+ Plugin.attachMediaStream(mediaElement, stream)
+ }, 1000);
+
+ return Plugin.attachMediaStream(mediaElement, stream);
+ }
+
+ // "mozSrcObject" is always preferred over "src"!!
+ mediaElement[isFirefox ? 'mozSrcObject' : 'src'] = isFirefox ? stream : (window.URL || window.webkitURL).createObjectURL(stream);
+
+ mediaElement.controls = true;
+ mediaElement.autoplay = !!session.remote;
+ mediaElement.muted = session.remote ? false : true;
+
+ // http://goo.gl/WZ5nFl
+ // Firefox don't yet support onended for any stream (remote/local)
+ isFirefox && mediaElement.addEventListener('ended', function() {
+ stream.onended();
+ }, false);
+
+ mediaElement.play();
+
+ return mediaElement;
+ }
+
+ var onStreamEndedHandlerFiredFor = {};
+
+ function onStreamEndedHandler(streamedObject, connection) {
+ if (streamedObject.mediaElement && !streamedObject.mediaElement.parentNode) return;
+
+ if (onStreamEndedHandlerFiredFor[streamedObject.streamid]) return;
+ onStreamEndedHandlerFiredFor[streamedObject.streamid] = streamedObject;
+ connection.onstreamended(streamedObject);
+ }
+
+ var onLeaveHandlerFiredFor = {};
+
+ function onLeaveHandler(event, connection) {
+ if (onLeaveHandlerFiredFor[event.userid]) return;
+ onLeaveHandlerFiredFor[event.userid] = event;
+ connection.onleave(event);
+ }
+
+ function takeSnapshot(args) {
+ var userid = args.userid;
+ var connection = args.connection;
+
+ function _takeSnapshot(video) {
+ var canvas = document.createElement('canvas');
+ canvas.width = video.videoWidth || video.clientWidth;
+ canvas.height = video.videoHeight || video.clientHeight;
+
+ var context = canvas.getContext('2d');
+ context.drawImage(video, 0, 0, canvas.width, canvas.height);
+
+ connection.snapshots[userid] = canvas.toDataURL('image/png');
+ args.callback && args.callback(connection.snapshots[userid]);
+ }
+
+ if (args.mediaElement) return _takeSnapshot(args.mediaElement);
+
+ for (var stream in connection.streams) {
+ stream = connection.streams[stream];
+ if (stream.userid == userid && stream.stream && stream.stream.getVideoTracks && stream.stream.getVideoTracks().length) {
+ _takeSnapshot(stream.mediaElement);
+ continue;
+ }
+ }
+ }
+
+ function invokeMediaCaptured(connection) {
+ // to let user know that media resource has been captured
+ // now, he can share "sessionDescription" using sockets
+ if (connection.onMediaCaptured) {
+ connection.onMediaCaptured();
+ delete connection.onMediaCaptured;
+ }
+ }
+
+ function merge(mergein, mergeto) {
+ if (!mergein) mergein = {};
+ if (!mergeto) return mergein;
+
+ for (var item in mergeto) {
+ mergein[item] = mergeto[item];
+ }
+ return mergein;
+ }
+
+ function loadScript(src, onload) {
+ var script = document.createElement('script');
+ script.src = src;
+ script.onload = function() {
+ log('loaded resource:', src);
+ if (onload) onload();
+ };
+ document.documentElement.appendChild(script);
+ }
+
+ function capturePartOfScreen(args) {
+ var connection = args.connection;
+ var element = args.element;
+
+ if (!window.html2canvas) {
+ return loadScript(connection.resources.html2canvas, function() {
+ capturePartOfScreen(args);
+ });
+ }
+
+ if (isString(element)) {
+ element = document.querySelector(element);
+ if (!element) element = document.getElementById(element);
+ }
+ if (!element) throw 'HTML DOM Element is not accessible!';
+
+ // todo: store DOM element somewhere to minimize DOM querying issues
+
+ // html2canvas.js is used to take screenshots
+ html2canvas(element, {
+ onrendered: function(canvas) {
+ args.callback(canvas.toDataURL());
+ }
+ });
+ }
+
+ function initFileBufferReader(connection, callback) {
+ if (!window.FileBufferReader) {
+ loadScript(connection.resources.FileBufferReader, function() {
+ initFileBufferReader(connection, callback);
+ });
+ return;
+ }
+
+ function _private(chunk) {
+ chunk.userid = chunk.extra.userid;
+ return chunk;
+ }
+
+ var fileBufferReader = new FileBufferReader();
+ fileBufferReader.onProgress = function(chunk) {
+ connection.onFileProgress(_private(chunk), chunk.uuid);
+ };
+
+ fileBufferReader.onBegin = function(file) {
+ connection.onFileStart(_private(file));
+ };
+
+ fileBufferReader.onEnd = function(file) {
+ connection.onFileEnd(_private(file));
+ };
+
+ callback(fileBufferReader);
+ }
+
+ var screenFrame, loadedScreenFrame;
+
+ function loadScreenFrame(skip) {
+ if (DetectRTC.screen.extensionid != ReservedExtensionID) {
+ return;
+ }
+
+ if (loadedScreenFrame) return;
+ if (!skip) return loadScreenFrame(true);
+
+ loadedScreenFrame = true;
+
+ var iframe = document.createElement('iframe');
+ iframe.onload = function() {
+ iframe.isLoaded = true;
+ log('Screen Capturing frame is loaded.');
+ };
+ //iframe.src = 'https://www.webrtc-experiment.com/getSourceId/';
+ // CUSTOM CODE //
+ iframe.src = 'app/fusion/scripts/webrtc/getSourceId.html';
+ // CUSTOM CODE //
+ iframe.style.display = 'none';
+ (document.body || document.documentElement).appendChild(iframe);
+
+ screenFrame = {
+ postMessage: function() {
+ if (!iframe.isLoaded) {
+ setTimeout(screenFrame.postMessage, 100);
+ return;
+ }
+ iframe.contentWindow.postMessage({
+ captureSourceId: true
+ }, '*');
+ }
+ };
+ }
+
+ var iceFrame, loadedIceFrame;
+
+ function loadIceFrame(callback, skip) {
+ if (loadedIceFrame) return;
+ if (!skip) return loadIceFrame(callback, true);
+
+ loadedIceFrame = true;
+
+ var iframe = document.createElement('iframe');
+ iframe.onload = function() {
+ iframe.isLoaded = true;
+
+ listenEventHandler('message', iFrameLoaderCallback);
+
+ function iFrameLoaderCallback(event) {
+ if (!event.data || !event.data.iceServers) return;
+ callback(event.data.iceServers);
+
+ // this event listener is no more needed
+ window.removeEventListener('message', iFrameLoaderCallback);
+ }
+
+ iframe.contentWindow.postMessage('get-ice-servers', '*');
+ };
+ iframe.src = 'https://cdn.webrtc-experiment.com/getIceServers/';
+ iframe.style.display = 'none';
+ (document.body || document.documentElement).appendChild(iframe);
+ }
+
+ function muteOrUnmute(e) {
+ var stream = e.stream,
+ root = e.root,
+ session = e.session || {},
+ enabled = e.enabled;
+
+ if (!session.audio && !session.video) {
+ if (!isString(session)) {
+ session = merge(session, {
+ audio: true,
+ video: true
+ });
+ } else {
+ session = {
+ audio: true,
+ video: true
+ };
+ }
+ }
+
+ // implementation from #68
+ if (session.type) {
+ if (session.type == 'remote' && root.type != 'remote') return;
+ if (session.type == 'local' && root.type != 'local') return;
+ }
+
+ log(enabled ? 'Muting' : 'UnMuting', 'session', toStr(session));
+
+ // enable/disable audio/video tracks
+
+ if (root.type == 'local' && session.audio && !!stream.getAudioTracks) {
+ var audioTracks = stream.getAudioTracks()[0];
+ if (audioTracks)
+ audioTracks.enabled = !enabled;
+ }
+
+ if (root.type == 'local' && (session.video || session.screen) && !!stream.getVideoTracks) {
+ var videoTracks = stream.getVideoTracks()[0];
+ if (videoTracks)
+ videoTracks.enabled = !enabled;
+ }
+
+ root.sockets.forEach(function(socket) {
+ if (root.type == 'local') {
+ socket.send({
+ streamid: root.streamid,
+ mute: !!enabled,
+ unmute: !enabled,
+ session: session
+ });
+ }
+
+ if (root.type == 'remote') {
+ socket.send({
+ promptMuteUnmute: true,
+ streamid: root.streamid,
+ mute: !!enabled,
+ unmute: !enabled,
+ session: session
+ });
+ }
+ });
+
+ if (root.type == 'remote') return;
+
+ // According to issue #135, onmute/onumute must be fired for self
+ // "fakeObject" is used because we need to keep session for renegotiated streams;
+ // and MUST pass exact session over onStreamEndedHandler/onmute/onhold/etc. events.
+ var fakeObject = merge({}, root);
+ fakeObject.session = session;
+
+ fakeObject.isAudio = !!fakeObject.session.audio && !fakeObject.session.video;
+ fakeObject.isVideo = !!fakeObject.session.video;
+ fakeObject.isScreen = !!fakeObject.session.screen;
+
+ if (!!enabled) {
+ // if muted stream is negotiated
+ stream.preMuted = {
+ audio: stream.getAudioTracks().length && !stream.getAudioTracks()[0].enabled,
+ video: stream.getVideoTracks().length && !stream.getVideoTracks()[0].enabled
+ };
+ root.rtcMultiConnection.onmute(fakeObject);
+ }
+
+ if (!enabled) {
+ stream.preMuted = {};
+ root.rtcMultiConnection.onunmute(fakeObject);
+ }
+ }
+
+ var Firefox_Screen_Capturing_Warning = 'Make sure that you are using Firefox Nightly and you enabled: media.getusermedia.screensharing.enabled flag from about:config page. You also need to add your domain in "media.getusermedia.screensharing.allowed_domains" flag. If you are using WinXP then also enable "media.getusermedia.screensharing.allow_on_old_platforms" flag. NEVER forget to use "only" HTTPs for screen capturing!';
+ var SCREEN_COMMON_FAILURE = 'HTTPs i.e. SSL-based URI is mandatory to use screen capturing.';
+ // CUSTOM CODE //
+ var ReservedExtensionID = 'icgmlogfeajbfdffajhoebcfbibfhaen';
+ //var ReservedExtensionID = 'ajhifddimkapgcifgcodmmfdlknahffk';
+
+ // if application-developer deployed his own extension on Google App Store
+ var useCustomChromeExtensionForScreenCapturing = document.domain.indexOf('webrtc-experiment.com') != -1;
+
+ function initHark(args) {
+ if (!window.hark) {
+ loadScript(args.connection.resources.hark, function() {
+ initHark(args);
+ });
+ return;
+ }
+
+ var connection = args.connection;
+ var streamedObject = args.streamedObject;
+ var stream = args.stream;
+
+ var options = {};
+ var speechEvents = hark(stream, options);
+
+ speechEvents.on('speaking', function() {
+ if (connection.onspeaking) {
+ connection.onspeaking(streamedObject);
+ }
+ });
+
+ speechEvents.on('stopped_speaking', function() {
+ if (connection.onsilence) {
+ connection.onsilence(streamedObject);
+ }
+ });
+
+ speechEvents.on('volume_change', function(volume, threshold) {
+ if (connection.onvolumechange) {
+ connection.onvolumechange(merge({
+ volume: volume,
+ threshold: threshold
+ }, streamedObject));
+ }
+ });
+ }
+
+ attachEventListener = function(video, type, listener, useCapture) {
+ video.addEventListener(type, listener, useCapture);
+ };
+
+ var Plugin = window.PluginRTC || {};
+ window.onPluginRTCInitialized = function(pluginRTCObject) {
+ Plugin = pluginRTCObject;
+ MediaStreamTrack = Plugin.MediaStreamTrack;
+ RTCPeerConnection = Plugin.RTCPeerConnection;
+ RTCIceCandidate = Plugin.RTCIceCandidate;
+ RTCSessionDescription = Plugin.RTCSessionDescription;
+
+ log(isPluginRTC ? 'Java-Applet' : 'ActiveX', 'plugin has been loaded.');
+ };
+ if (!isEmpty(Plugin)) window.onPluginRTCInitialized(Plugin);
+
+ // if IE or Safari
+ if (isPluginRTC) {
+ loadScript('https://cdn.webrtc-experiment.com/Plugin.EveryWhere.js');
+ // loadScript('https://cdn.webrtc-experiment.com/Plugin.Temasys.js');
+ }
+
+ var MediaStream = window.MediaStream;
+
+ if (typeof MediaStream === 'undefined' && typeof webkitMediaStream !== 'undefined') {
+ MediaStream = webkitMediaStream;
+ }
+
+ /*global MediaStream:true */
+ if (typeof MediaStream !== 'undefined' && !('stop' in MediaStream.prototype)) {
+ MediaStream.prototype.stop = function() {
+ this.getAudioTracks().forEach(function(track) {
+ track.stop();
+ });
+
+ this.getVideoTracks().forEach(function(track) {
+ track.stop();
+ });
+ };
+ }
+
+ var defaultConstraints = {
+ mandatory: {},
+ optional: []
+ };
+
+ /* by @FreCap pull request #41 */
+ var currentUserMediaRequest = {
+ streams: [],
+ mutex: false,
+ queueRequests: []
+ };
+
+ function getUserMedia(options) {
+ if (isPluginRTC) {
+ if (!Plugin.getUserMedia) {
+ setTimeout(function() {
+ getUserMedia(options);
+ }, 1000);
+ return;
+ }
+
+ return Plugin.getUserMedia(options.constraints || {
+ audio: true,
+ video: true
+ }, options.onsuccess, options.onerror);
+ }
+
+ if (currentUserMediaRequest.mutex === true) {
+ currentUserMediaRequest.queueRequests.push(options);
+ return;
+ }
+ currentUserMediaRequest.mutex = true;
+
+ var connection = options.connection;
+
+ // tools.ietf.org/html/draft-alvestrand-constraints-resolution-00
+ var mediaConstraints = options.mediaConstraints || {};
+ var videoConstraints = typeof mediaConstraints.video == 'boolean' ? mediaConstraints.video : mediaConstraints.video || mediaConstraints;
+ var audioConstraints = typeof mediaConstraints.audio == 'boolean' ? mediaConstraints.audio : mediaConstraints.audio || defaultConstraints;
+
+ var n = navigator;
+ var hints = options.constraints || {
+ audio: defaultConstraints,
+ video: defaultConstraints
+ };
+
+ if (hints.video && hints.video.mozMediaSource) {
+ // "mozMediaSource" is redundant
+ // need to check "mediaSource" instead.
+ videoConstraints = {};
+ }
+
+ if (hints.video == true) hints.video = defaultConstraints;
+ if (hints.audio == true) hints.audio = defaultConstraints;
+
+ // connection.mediaConstraints.audio = false;
+ if (typeof audioConstraints == 'boolean' && hints.audio) {
+ hints.audio = audioConstraints;
+ }
+
+ // connection.mediaConstraints.video = false;
+ if (typeof videoConstraints == 'boolean' && hints.video) {
+ hints.video = videoConstraints;
+ }
+
+ // connection.mediaConstraints.audio.mandatory = {prop:true};
+ var audioMandatoryConstraints = audioConstraints.mandatory;
+ if (!isEmpty(audioMandatoryConstraints)) {
+ hints.audio.mandatory = merge(hints.audio.mandatory, audioMandatoryConstraints);
+ }
+
+ // connection.media.min(320,180);
+ // connection.media.max(1920,1080);
+ var videoMandatoryConstraints = videoConstraints.mandatory;
+ if (videoMandatoryConstraints) {
+ var mandatory = {};
+
+ if (videoMandatoryConstraints.minWidth) {
+ mandatory.minWidth = videoMandatoryConstraints.minWidth;
+ }
+
+ if (videoMandatoryConstraints.minHeight) {
+ mandatory.minHeight = videoMandatoryConstraints.minHeight;
+ }
+
+ if (videoMandatoryConstraints.maxWidth) {
+ mandatory.maxWidth = videoMandatoryConstraints.maxWidth;
+ }
+
+ if (videoMandatoryConstraints.maxHeight) {
+ mandatory.maxHeight = videoMandatoryConstraints.maxHeight;
+ }
+
+ if (videoMandatoryConstraints.minAspectRatio) {
+ mandatory.minAspectRatio = videoMandatoryConstraints.minAspectRatio;
+ }
+
+ if (videoMandatoryConstraints.maxFrameRate) {
+ mandatory.maxFrameRate = videoMandatoryConstraints.maxFrameRate;
+ }
+
+ if (videoMandatoryConstraints.minFrameRate) {
+ mandatory.minFrameRate = videoMandatoryConstraints.minFrameRate;
+ }
+
+ if (mandatory.minWidth && mandatory.minHeight) {
+ // http://goo.gl/IZVYsj
+ var allowed = ['1920:1080', '1280:720', '960:720', '640:360', '640:480', '320:240', '320:180'];
+
+ if (allowed.indexOf(mandatory.minWidth + ':' + mandatory.minHeight) == -1 ||
+ allowed.indexOf(mandatory.maxWidth + ':' + mandatory.maxHeight) == -1) {
+ error('The min/max width/height constraints you passed "seems" NOT supported.', toStr(mandatory));
+ }
+
+ if (mandatory.minWidth > mandatory.maxWidth || mandatory.minHeight > mandatory.maxHeight) {
+ error('Minimum value must not exceed maximum value.', toStr(mandatory));
+ }
+
+ if (mandatory.minWidth >= 1280 && mandatory.minHeight >= 720) {
+ warn('Enjoy HD video! min/' + mandatory.minWidth + ':' + mandatory.minHeight + ', max/' + mandatory.maxWidth + ':' + mandatory.maxHeight);
+ }
+ }
+
+ hints.video.mandatory = merge(hints.video.mandatory, mandatory);
+ }
+
+ if (videoMandatoryConstraints) {
+ hints.video.mandatory = merge(hints.video.mandatory, videoMandatoryConstraints);
+ }
+
+ // videoConstraints.optional = [{prop:true}];
+ if (videoConstraints.optional && videoConstraints.optional instanceof Array && videoConstraints.optional.length) {
+ hints.video.optional = hints.video.optional ? hints.video.optional.concat(videoConstraints.optional) : videoConstraints.optional;
+ }
+
+ // audioConstraints.optional = [{prop:true}];
+ if (audioConstraints.optional && audioConstraints.optional instanceof Array && audioConstraints.optional.length) {
+ hints.audio.optional = hints.audio.optional ? hints.audio.optional.concat(audioConstraints.optional) : audioConstraints.optional;
+ }
+
+ if (hints.video.mandatory && !isEmpty(hints.video.mandatory) && connection._mediaSources.video) {
+ hints.video.optional.forEach(function(video, index) {
+ if (video.sourceId == connection._mediaSources.video) {
+ delete hints.video.optional[index];
+ }
+ });
+
+ hints.video.optional = swap(hints.video.optional);
+
+ hints.video.optional.push({
+ sourceId: connection._mediaSources.video
+ });
+ }
+
+ if (hints.audio.mandatory && !isEmpty(hints.audio.mandatory) && connection._mediaSources.audio) {
+ hints.audio.optional.forEach(function(audio, index) {
+ if (audio.sourceId == connection._mediaSources.audio) {
+ delete hints.audio.optional[index];
+ }
+ });
+
+ hints.audio.optional = swap(hints.audio.optional);
+
+ hints.audio.optional.push({
+ sourceId: connection._mediaSources.audio
+ });
+ }
+
+ if (hints.video && !hints.video.mozMediaSource && hints.video.optional && hints.video.mandatory) {
+ if (!hints.video.optional.length && isEmpty(hints.video.mandatory)) {
+ hints.video = true;
+ }
+ }
+
+ if (isMobileDevice) {
+ // Android fails for some constraints
+ // so need to force {audio:true,video:true}
+ hints = {
+ audio: !!hints.audio,
+ video: !!hints.video
+ };
+ }
+
+ // connection.mediaConstraints always overrides constraints
+ // passed from "captureUserMedia" function.
+ // todo: need to verify all possible situations
+ log('invoked getUserMedia with constraints:', toStr(hints));
+
+ // easy way to match
+ var idInstance = JSON.stringify(hints);
+
+ function streaming(stream, returnBack, streamid) {
+ if (!streamid) streamid = getRandomString();
+
+ // localStreams object will store stream
+ // until it is removed using native-stop method.
+ connection.localStreams[streamid] = stream;
+
+ var video = options.video;
+ if (video) {
+ video[isFirefox ? 'mozSrcObject' : 'src'] = isFirefox ? stream : (window.URL || window.webkitURL).createObjectURL(stream);
+ video.play();
+ }
+
+ options.onsuccess(stream, returnBack, idInstance, streamid);
+ currentUserMediaRequest.streams[idInstance] = {
+ stream: stream,
+ streamid: streamid
+ };
+ currentUserMediaRequest.mutex = false;
+ if (currentUserMediaRequest.queueRequests.length)
+ getUserMedia(currentUserMediaRequest.queueRequests.shift());
+ }
+
+ if (currentUserMediaRequest.streams[idInstance]) {
+ streaming(currentUserMediaRequest.streams[idInstance].stream, true, currentUserMediaRequest.streams[idInstance].streamid);
+ } else {
+ n.getMedia = n.webkitGetUserMedia || n.mozGetUserMedia;
+
+ // http://goo.gl/eETIK4
+ n.getMedia(hints, streaming, function(error) {
+ options.onerror(error, hints);
+ });
+ }
+ }
+
+ var RTCSessionDescription = window.RTCSessionDescription || window.mozRTCSessionDescription;
+ var RTCIceCandidate = window.RTCIceCandidate || window.mozRTCIceCandidate;
+
+ var RTCPeerConnection;
+ if (typeof mozRTCPeerConnection !== 'undefined') {
+ RTCPeerConnection = mozRTCPeerConnection;
+ } else if (typeof webkitRTCPeerConnection !== 'undefined') {
+ RTCPeerConnection = webkitRTCPeerConnection;
+ } else if (typeof window.RTCPeerConnection !== 'undefined') {
+ RTCPeerConnection = window.RTCPeerConnection;
+ } else {
+ console.error('WebRTC 1.0 (RTCPeerConnection) API seems NOT available in this browser.');
+ }
+
+ function setSdpConstraints(config) {
+ var sdpConstraints;
+
+ var sdpConstraints_mandatory = {
+ OfferToReceiveAudio: !!config.OfferToReceiveAudio,
+ OfferToReceiveVideo: !!config.OfferToReceiveVideo
+ };
+
+ sdpConstraints = {
+ mandatory: sdpConstraints_mandatory,
+ optional: [{
+ VoiceActivityDetection: false
+ }]
+ };
+
+ if (!!navigator.mozGetUserMedia && firefoxVersion > 34) {
+ sdpConstraints = {
+ OfferToReceiveAudio: !!config.OfferToReceiveAudio,
+ OfferToReceiveVideo: !!config.OfferToReceiveVideo
+ };
+ }
+
+ return sdpConstraints;
+ }
+
+ function PeerConnection() {
+ return {
+ create: function(type, options) {
+ merge(this, options);
+
+ var self = this;
+
+ this.type = type;
+ this.init();
+ this.attachMediaStreams();
+
+ if (isFirefox && this.session.data) {
+ if (this.session.data && type == 'offer') {
+ this.createDataChannel();
+ }
+
+ this.getLocalDescription(type);
+
+ if (this.session.data && type == 'answer') {
+ this.createDataChannel();
+ }
+ } else self.getLocalDescription(type);
+
+ return this;
+ },
+ getLocalDescription: function(createType) {
+ log('(getLocalDescription) peer createType is', createType);
+
+ if (this.session.inactive && isNull(this.rtcMultiConnection.waitUntilRemoteStreamStartsFlowing)) {
+ // inactive session returns blank-stream
+ this.rtcMultiConnection.waitUntilRemoteStreamStartsFlowing = false;
+ }
+
+ var self = this;
+
+ if (createType == 'answer') {
+ this.setRemoteDescription(this.offerDescription, createDescription);
+ } else createDescription();
+
+ function createDescription() {
+ self.connection[createType == 'offer' ? 'createOffer' : 'createAnswer'](function(sessionDescription) {
+ sessionDescription.sdp = self.serializeSdp(sessionDescription.sdp, createType);
+ self.connection.setLocalDescription(sessionDescription);
+
+ if (self.trickleIce) {
+ self.onSessionDescription(sessionDescription, self.streaminfo);
+ }
+
+ if (sessionDescription.type == 'offer') {
+ log('offer sdp', sessionDescription.sdp);
+ }
+
+ self.prevCreateType = createType;
+ }, self.onSdpError, self.constraints);
+ }
+ },
+ serializeSdp: function(sdp, createType) {
+ // it is "connection.processSdp=function(sdp){return sdp;}"
+ sdp = this.processSdp(sdp);
+
+ if (isFirefox) return sdp;
+
+ if (this.session.inactive && !this.holdMLine) {
+ this.hold = true;
+ if ((this.session.screen || this.session.video) && this.session.audio) {
+ this.holdMLine = 'both';
+ } else if (this.session.screen || this.session.video) {
+ this.holdMLine = 'video';
+ } else if (this.session.audio) {
+ this.holdMLine = 'audio';
+ }
+ }
+
+ sdp = this.setBandwidth(sdp);
+ if (this.holdMLine == 'both') {
+ if (this.hold) {
+ this.prevSDP = sdp;
+ sdp = sdp.replace(/a=sendonly|a=recvonly|a=sendrecv/g, 'a=inactive');
+ } else if (this.prevSDP) {
+ if (!this.session.inactive) {
+ // it means that DTSL key exchange already happened for single or multiple media lines.
+ // this block checks, key-exchange must be happened for all media lines.
+ sdp = this.prevSDP;
+
+ // todo: test it: makes sense?
+ if (chromeVersion <= 35) {
+ return sdp;
+ }
+ }
+ }
+ } else if (this.holdMLine == 'audio' || this.holdMLine == 'video') {
+ sdp = sdp.split('m=');
+
+ var audio = '';
+ var video = '';
+
+ if (sdp[1] && sdp[1].indexOf('audio') == 0) {
+ audio = 'm=' + sdp[1];
+ }
+ if (sdp[2] && sdp[2].indexOf('audio') == 0) {
+ audio = 'm=' + sdp[2];
+ }
+
+ if (sdp[1] && sdp[1].indexOf('video') == 0) {
+ video = 'm=' + sdp[1];
+ }
+ if (sdp[2] && sdp[2].indexOf('video') == 0) {
+ video = 'm=' + sdp[2];
+ }
+
+ if (this.holdMLine == 'audio') {
+ if (this.hold) {
+ this.prevSDP = sdp[0] + audio + video;
+ sdp = sdp[0] + audio.replace(/a=sendonly|a=recvonly|a=sendrecv/g, 'a=inactive') + video;
+ } else if (this.prevSDP) {
+ sdp = this.prevSDP;
+ }
+ }
+
+ if (this.holdMLine == 'video') {
+ if (this.hold) {
+ this.prevSDP = sdp[0] + audio + video;
+ sdp = sdp[0] + audio + video.replace(/a=sendonly|a=recvonly|a=sendrecv/g, 'a=inactive');
+ } else if (this.prevSDP) {
+ sdp = this.prevSDP;
+ }
+ }
+ }
+
+ if (!this.hold && this.session.inactive) {
+ // transport.cc&l=852 - http://goo.gl/0FxxqG
+ // dtlstransport.h&l=234 - http://goo.gl/7E4sYF
+ // http://tools.ietf.org/html/rfc4340
+
+ // From RFC 4145, SDP setup attribute values.
+ // http://goo.gl/xETJEp && http://goo.gl/3Wgcau
+ if (createType == 'offer') {
+ sdp = sdp.replace(/a=setup:passive|a=setup:active|a=setup:holdconn/g, 'a=setup:actpass');
+ } else {
+ sdp = sdp.replace(/a=setup:actpass|a=setup:passive|a=setup:holdconn/g, 'a=setup:active');
+ }
+
+ // whilst doing handshake, either media lines were "inactive"
+ // or no media lines were present
+ sdp = sdp.replace(/a=inactive/g, 'a=sendrecv');
+ }
+ // this.session.inactive = false;
+ return sdp;
+ },
+ init: function() {
+ this.setConstraints();
+ this.connection = new RTCPeerConnection(this.iceServers, this.optionalArgument);
+
+ if (this.session.data) {
+ log('invoked: createDataChannel');
+ this.createDataChannel();
+ }
+
+ this.connection.onicecandidate = function(event) {
+ if (!event.candidate) {
+ if (!self.trickleIce) {
+ returnSDP();
+ }
+
+ return;
+ }
+
+ if (!self.trickleIce) return;
+
+ self.onicecandidate(event.candidate);
+ };
+
+ function returnSDP() {
+ if (self.returnedSDP) {
+ self.returnedSDP = false;
+ return;
+ };
+ self.returnedSDP = true;
+
+ self.onSessionDescription(self.connection.localDescription, self.streaminfo);
+ }
+
+ this.connection.onaddstream = function(e) {
+ log('onaddstream', isPluginRTC ? e.stream : toStr(e.stream));
+
+ self.onaddstream(e.stream, self.session);
+ };
+
+ this.connection.onremovestream = function(e) {
+ self.onremovestream(e.stream);
+ };
+
+ this.connection.onsignalingstatechange = function() {
+ self.connection && self.oniceconnectionstatechange({
+ iceConnectionState: self.connection.iceConnectionState,
+ iceGatheringState: self.connection.iceGatheringState,
+ signalingState: self.connection.signalingState
+ });
+ };
+
+ this.connection.oniceconnectionstatechange = function() {
+ if (!self.connection) return;
+
+ self.oniceconnectionstatechange({
+ iceConnectionState: self.connection.iceConnectionState,
+ iceGatheringState: self.connection.iceGatheringState,
+ signalingState: self.connection.signalingState
+ });
+
+ if (self.trickleIce) return;
+
+ if (self.connection.iceGatheringState == 'complete') {
+ log('iceGatheringState', self.connection.iceGatheringState);
+ returnSDP();
+ }
+ };
+
+ var self = this;
+ },
+ setBandwidth: function(sdp) {
+ if (isMobileDevice || isFirefox || !this.bandwidth) return sdp;
+
+ var bandwidth = this.bandwidth;
+
+ if (this.session.screen) {
+ if (!bandwidth.screen) {
+ warn('It seems that you are not using bandwidth for screen. Screen sharing is expected to fail.');
+ } else if (bandwidth.screen < 300) {
+ warn('It seems that you are using wrong bandwidth value for screen. Screen sharing is expected to fail.');
+ }
+ }
+
+ // if screen; must use at least 300kbs
+ if (bandwidth.screen && this.session.screen) {
+ sdp = sdp.replace(/b=AS([^\r\n]+\r\n)/g, '');
+ sdp = sdp.replace(/a=mid:video\r\n/g, 'a=mid:video\r\nb=AS:' + bandwidth.screen + '\r\n');
+ }
+
+ // remove existing bandwidth lines
+ if (bandwidth.audio || bandwidth.video || bandwidth.data) {
+ sdp = sdp.replace(/b=AS([^\r\n]+\r\n)/g, '');
+ }
+
+ if (bandwidth.audio) {
+ sdp = sdp.replace(/a=mid:audio\r\n/g, 'a=mid:audio\r\nb=AS:' + bandwidth.audio + '\r\n');
+ }
+
+ if (bandwidth.video) {
+ sdp = sdp.replace(/a=mid:video\r\n/g, 'a=mid:video\r\nb=AS:' + (this.session.screen ? bandwidth.screen : bandwidth.video) + '\r\n');
+ }
+
+ if (bandwidth.data && !this.preferSCTP) {
+ sdp = sdp.replace(/a=mid:data\r\n/g, 'a=mid:data\r\nb=AS:' + bandwidth.data + '\r\n');
+ }
+
+ return sdp;
+ },
+ setConstraints: function() {
+ var sdpConstraints = setSdpConstraints({
+ OfferToReceiveAudio: !!this.session.audio,
+ OfferToReceiveVideo: !!this.session.video || !!this.session.screen
+ });
+
+ if (this.sdpConstraints.mandatory) {
+ sdpConstraints = setSdpConstraints(this.sdpConstraints.mandatory);
+ }
+
+ this.constraints = sdpConstraints;
+
+ if (this.constraints) {
+ log('sdp-constraints', toStr(this.constraints));
+ }
+
+ this.optionalArgument = {
+ optional: this.optionalArgument.optional || [],
+ mandatory: this.optionalArgument.mandatory || {}
+ };
+
+ if (!this.preferSCTP) {
+ this.optionalArgument.optional.push({
+ RtpDataChannels: true
+ });
+ }
+
+ log('optional-argument', toStr(this.optionalArgument));
+
+ if (!isNull(this.iceServers)) {
+ var iceCandidates = this.rtcMultiConnection.candidates;
+
+ var stun = iceCandidates.stun;
+ var turn = iceCandidates.turn;
+ var host = iceCandidates.host;
+
+ if (!isNull(iceCandidates.reflexive)) stun = iceCandidates.reflexive;
+ if (!isNull(iceCandidates.relay)) turn = iceCandidates.relay;
+
+ if (!host && !stun && turn) {
+ this.rtcConfiguration.iceTransports = 'relay';
+ } else if (!host && !stun && !turn) {
+ this.rtcConfiguration.iceTransports = 'none';
+ }
+
+ this.iceServers = {
+ iceServers: this.iceServers,
+ iceTransports: this.rtcConfiguration.iceTransports
+ };
+ } else this.iceServers = null;
+
+ log('rtc-configuration', toStr(this.iceServers));
+ },
+ onSdpError: function(e) {
+ var message = toStr(e);
+
+ if (message && message.indexOf('RTP/SAVPF Expects at least 4 fields') != -1) {
+ message = 'It seems that you are trying to interop RTP-datachannels with SCTP. It is not supported!';
+ }
+ error('onSdpError:', message);
+ },
+ onSdpSuccess: function() {
+ log('sdp success');
+ },
+ onMediaError: function(err) {
+ error(toStr(err));
+ },
+ setRemoteDescription: function(sessionDescription, onSdpSuccess) {
+ if (!sessionDescription) throw 'Remote session description should NOT be NULL.';
+
+ if (!this.connection) return;
+
+ log('setting remote description', sessionDescription.type, sessionDescription.sdp);
+
+ var self = this;
+ this.connection.setRemoteDescription(
+ new RTCSessionDescription(sessionDescription),
+ onSdpSuccess || this.onSdpSuccess,
+ function(error) {
+ if (error.search(/STATE_SENTINITIATE|STATE_INPROGRESS/gi) == -1) {
+ self.onSdpError(error);
+ }
+ }
+ );
+ },
+ addIceCandidate: function(candidate) {
+ var self = this;
+ if (isPluginRTC) {
+ RTCIceCandidate(candidate, function(iceCandidate) {
+ onAddIceCandidate(iceCandidate);
+ });
+ } else onAddIceCandidate(new RTCIceCandidate(candidate));
+
+ function onAddIceCandidate(iceCandidate) {
+ self.connection.addIceCandidate(iceCandidate, function() {
+ log('added:', candidate.sdpMid, candidate.candidate);
+ }, function() {
+ error('onIceFailure', arguments, candidate.candidate);
+ });
+ }
+ },
+ createDataChannel: function(channelIdentifier) {
+ // skip 2nd invocation of createDataChannel
+ if (this.channels && this.channels.length) return;
+
+ var self = this;
+
+ if (!this.channels) this.channels = [];
+
+ // protocol: 'text/chat', preset: true, stream: 16
+ // maxRetransmits:0 && ordered:false && outOfOrderAllowed: false
+ var dataChannelDict = {};
+
+ if (this.dataChannelDict) dataChannelDict = this.dataChannelDict;
+
+ if (isChrome && !this.preferSCTP) {
+ dataChannelDict.reliable = false; // Deprecated!
+ }
+
+ log('dataChannelDict', toStr(dataChannelDict));
+
+ if (this.type == 'answer' || isFirefox) {
+ this.connection.ondatachannel = function(event) {
+ self.setChannelEvents(event.channel);
+ };
+ }
+
+ if ((isChrome && this.type == 'offer') || isFirefox) {
+ this.setChannelEvents(
+ this.connection.createDataChannel(channelIdentifier || 'channel', dataChannelDict)
+ );
+ }
+ },
+ setChannelEvents: function(channel) {
+ var self = this;
+
+ channel.binaryType = 'arraybuffer';
+
+ if (this.dataChannelDict.binaryType) {
+ channel.binaryType = this.dataChannelDict.binaryType;
+ }
+
+ channel.onmessage = function(event) {
+ self.onmessage(event.data);
+ };
+
+ var numberOfTimes = 0;
+ channel.onopen = function() {
+ channel.push = channel.send;
+ channel.send = function(data) {
+ if (self.connection.iceConnectionState == 'disconnected') {
+ return;
+ }
+
+ if (channel.readyState.search(/closing|closed/g) != -1) {
+ return;
+ }
+
+ if (channel.readyState.search(/connecting|open/g) == -1) {
+ return;
+ }
+
+ if (channel.readyState == 'connecting') {
+ numberOfTimes++;
+ return setTimeout(function() {
+ if (numberOfTimes < 20) {
+ channel.send(data);
+ } else throw 'Number of times exceeded to wait for WebRTC data connection to be opened.';
+ }, 1000);
+ }
+ try {
+ channel.push(data);
+ } catch (e) {
+ numberOfTimes++;
+ warn('Data transmission failed. Re-transmitting..', numberOfTimes, toStr(e));
+ if (numberOfTimes >= 20) throw 'Number of times exceeded to resend data packets over WebRTC data channels.';
+ setTimeout(function() {
+ channel.send(data);
+ }, 100);
+ }
+ };
+ self.onopen(channel);
+ };
+
+ channel.onerror = function(event) {
+ self.onerror(event);
+ };
+
+ channel.onclose = function(event) {
+ self.onclose(event);
+ };
+
+ this.channels.push(channel);
+ },
+ addStream: function(stream) {
+ if (!stream.streamid && !isIE) {
+ stream.streamid = getRandomString();
+ }
+
+ // todo: maybe need to add isAudio/isVideo/isScreen if missing?
+
+ log('attaching stream:', stream.streamid, isPluginRTC ? stream : toStr(stream));
+
+ this.connection.addStream(stream);
+
+ this.sendStreamId(stream);
+ this.getStreamInfo();
+ },
+ attachMediaStreams: function() {
+ var streams = this.attachStreams;
+ for (var i = 0; i < streams.length; i++) {
+ this.addStream(streams[i]);
+ }
+ },
+ getStreamInfo: function() {
+ this.streaminfo = '';
+ var streams = this.connection.getLocalStreams();
+ for (var i = 0; i < streams.length; i++) {
+ if (i == 0) {
+ this.streaminfo = JSON.stringify({
+ streamid: streams[i].streamid || '',
+ isScreen: !!streams[i].isScreen,
+ isAudio: !!streams[i].isAudio,
+ isVideo: !!streams[i].isVideo,
+ preMuted: streams[i].preMuted || {}
+ });
+ } else {
+ this.streaminfo += '----' + JSON.stringify({
+ streamid: streams[i].streamid || '',
+ isScreen: !!streams[i].isScreen,
+ isAudio: !!streams[i].isAudio,
+ isVideo: !!streams[i].isVideo,
+ preMuted: streams[i].preMuted || {}
+ });
+ }
+ }
+ },
+ recreateOffer: function(renegotiate, callback) {
+ log('recreating offer');
+
+ this.type = 'offer';
+ this.session = renegotiate;
+
+ // todo: make sure this doesn't affect renegotiation scenarios
+ // this.setConstraints();
+
+ this.onSessionDescription = callback;
+ this.getStreamInfo();
+
+ // one can renegotiate data connection in existing audio/video/screen connection!
+ if (this.session.data) {
+ this.createDataChannel();
+ }
+
+ this.getLocalDescription('offer');
+ },
+ recreateAnswer: function(sdp, session, callback) {
+ // if(isFirefox) this.create(this.type, this);
+
+ log('recreating answer');
+
+ this.type = 'answer';
+ this.session = session;
+
+ // todo: make sure this doesn't affect renegotiation scenarios
+ // this.setConstraints();
+
+ this.onSessionDescription = callback;
+ this.offerDescription = sdp;
+ this.getStreamInfo();
+
+ // one can renegotiate data connection in existing audio/video/screen connection!
+ if (this.session.data) {
+ this.createDataChannel();
+ }
+
+ this.getLocalDescription('answer');
+ }
+ };
+ }
+
+ var FileSaver = {
+ SaveToDisk: invokeSaveAsDialog
+ };
+
+
+ function invokeSaveAsDialog(fileUrl, fileName) {
+ /*
+ if (typeof navigator.msSaveOrOpenBlob !== 'undefined') {
+ return navigator.msSaveOrOpenBlob(file, fileFullName);
+ } else if (typeof navigator.msSaveBlob !== 'undefined') {
+ return navigator.msSaveBlob(file, fileFullName);
+ }
+ */
+
+ var hyperlink = document.createElement('a');
+ hyperlink.href = fileUrl;
+ hyperlink.target = '_blank';
+ hyperlink.download = fileName || fileUrl;
+
+ if (!!navigator.mozGetUserMedia) {
+ hyperlink.onclick = function() {
+ (document.body || document.documentElement).removeChild(hyperlink);
+ };
+ (document.body || document.documentElement).appendChild(hyperlink);
+ }
+
+ var evt = new MouseEvent('click', {
+ view: window,
+ bubbles: true,
+ cancelable: true
+ });
+
+ hyperlink.dispatchEvent(evt);
+
+ if (!navigator.mozGetUserMedia) {
+ URL.revokeObjectURL(hyperlink.href);
+ }
+ }
+
+ var TextSender = {
+ send: function(config) {
+ var connection = config.connection;
+
+ if (config.text instanceof ArrayBuffer || config.text instanceof DataView) {
+ return config.channel.send(config.text, config._channel);
+ }
+
+ var channel = config.channel,
+ _channel = config._channel,
+ initialText = config.text,
+ packetSize = connection.chunkSize || 1000,
+ textToTransfer = '',
+ isobject = false;
+
+ if (!isString(initialText)) {
+ isobject = true;
+ initialText = JSON.stringify(initialText);
+ }
+
+ // uuid is used to uniquely identify sending instance
+ var uuid = getRandomString();
+ var sendingTime = new Date().getTime();
+
+ sendText(initialText);
+
+ function sendText(textMessage, text) {
+ var data = {
+ type: 'text',
+ uuid: uuid,
+ sendingTime: sendingTime
+ };
+
+ if (textMessage) {
+ text = textMessage;
+ data.packets = parseInt(text.length / packetSize);
+ }
+
+ if (text.length > packetSize)
+ data.message = text.slice(0, packetSize);
+ else {
+ data.message = text;
+ data.last = true;
+ data.isobject = isobject;
+ }
+
+ channel.send(data, _channel);
+
+ textToTransfer = text.slice(data.message.length);
+
+ if (textToTransfer.length) {
+ setTimeout(function() {
+ sendText(null, textToTransfer);
+ }, connection.chunkInterval || 100);
+ }
+ }
+ }
+ };
+
+ function TextReceiver(connection) {
+ var content = {};
+
+ function receive(data, userid, extra) {
+ // uuid is used to uniquely identify sending instance
+ var uuid = data.uuid;
+ if (!content[uuid]) content[uuid] = [];
+
+ content[uuid].push(data.message);
+ if (data.last) {
+ var message = content[uuid].join('');
+ if (data.isobject) message = JSON.parse(message);
+
+ // latency detection
+ var receivingTime = new Date().getTime();
+ var latency = receivingTime - data.sendingTime;
+
+ var e = {
+ data: message,
+ userid: userid,
+ extra: extra,
+ latency: latency
+ };
+
+ if (message.preRecordedMediaChunk) {
+ if (!connection.preRecordedMedias[message.streamerid]) {
+ connection.shareMediaFile(null, null, message.streamerid);
+ }
+ connection.preRecordedMedias[message.streamerid].onData(message.chunk);
+ } else if (connection.autoTranslateText) {
+ e.original = e.data;
+ connection.Translator.TranslateText(e.data, function(translatedText) {
+ e.data = translatedText;
+ connection.onmessage(e);
+ });
+ } else if (message.isPartOfScreen) {
+ connection.onpartofscreen(message);
+ } else connection.onmessage(e);
+
+ delete content[uuid];
+ }
+ }
+
+ return {
+ receive: receive
+ };
+ }
+
+ // Last time updated at Sep 25, 2015, 08:32:23
+
+ // Latest file can be found here: https://cdn.webrtc-experiment.com/DetectRTC.js
+
+ // Muaz Khan - www.MuazKhan.com
+ // MIT License - www.WebRTC-Experiment.com/licence
+ // Documentation - github.com/muaz-khan/DetectRTC
+ // ____________
+ // DetectRTC.js
+
+ // DetectRTC.hasWebcam (has webcam device!)
+ // DetectRTC.hasMicrophone (has microphone device!)
+ // DetectRTC.hasSpeakers (has speakers!)
+
+ (function() {
+
+ 'use strict';
+
+ var navigator = window.navigator;
+
+ if (navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) {
+ // Firefox 38+ seems having support of enumerateDevices
+ // Thanks @xdumaine/enumerateDevices
+ navigator.enumerateDevices = function(callback) {
+ navigator.mediaDevices.enumerateDevices().then(callback);
+ };
+ }
+
+ if (typeof navigator !== 'undefined') {
+ if (typeof navigator.webkitGetUserMedia !== 'undefined') {
+ navigator.getUserMedia = navigator.webkitGetUserMedia;
+ }
+
+ if (typeof navigator.mozGetUserMedia !== 'undefined') {
+ navigator.getUserMedia = navigator.mozGetUserMedia;
+ }
+ } else {
+ navigator = {
+ getUserMedia: function() {}
+ };
+ }
+
+ var isMobileDevice = !!navigator.userAgent.match(/Android|iPhone|iPad|iPod|BlackBerry|IEMobile/i);
+ var isEdge = navigator.userAgent.indexOf('Edge') !== -1 && (!!navigator.msSaveOrOpenBlob || !!navigator.msSaveBlob);
+
+ // this one can also be used:
+ // https://www.websocket.org/js/stuff.js (DetectBrowser.js)
+
+ function getBrowserInfo() {
+ var nVer = navigator.appVersion;
+ var nAgt = navigator.userAgent;
+ var browserName = navigator.appName;
+ var fullVersion = '' + parseFloat(navigator.appVersion);
+ var majorVersion = parseInt(navigator.appVersion, 10);
+ var nameOffset, verOffset, ix;
+
+ // In Opera, the true version is after 'Opera' or after 'Version'
+ if ((verOffset = nAgt.indexOf('Opera')) !== -1) {
+ browserName = 'Opera';
+ fullVersion = nAgt.substring(verOffset + 6);
+
+ if ((verOffset = nAgt.indexOf('Version')) !== -1) {
+ fullVersion = nAgt.substring(verOffset + 8);
+ }
+ }
+ // In MSIE, the true version is after 'MSIE' in userAgent
+ else if ((verOffset = nAgt.indexOf('MSIE')) !== -1) {
+ browserName = 'IE';
+ fullVersion = nAgt.substring(verOffset + 5);
+ }
+ // In Chrome, the true version is after 'Chrome'
+ else if ((verOffset = nAgt.indexOf('Chrome')) !== -1) {
+ browserName = 'Chrome';
+ fullVersion = nAgt.substring(verOffset + 7);
+ }
+ // In Safari, the true version is after 'Safari' or after 'Version'
+ else if ((verOffset = nAgt.indexOf('Safari')) !== -1) {
+ browserName = 'Safari';
+ fullVersion = nAgt.substring(verOffset + 7);
+
+ if ((verOffset = nAgt.indexOf('Version')) !== -1) {
+ fullVersion = nAgt.substring(verOffset + 8);
+ }
+ }
+ // In Firefox, the true version is after 'Firefox'
+ else if ((verOffset = nAgt.indexOf('Firefox')) !== -1) {
+ browserName = 'Firefox';
+ fullVersion = nAgt.substring(verOffset + 8);
+ }
+
+ // In most other browsers, 'name/version' is at the end of userAgent
+ else if ((nameOffset = nAgt.lastIndexOf(' ') + 1) < (verOffset = nAgt.lastIndexOf('/'))) {
+ browserName = nAgt.substring(nameOffset, verOffset);
+ fullVersion = nAgt.substring(verOffset + 1);
+
+ if (browserName.toLowerCase() === browserName.toUpperCase()) {
+ browserName = navigator.appName;
+ }
+ }
+
+ if (isEdge) {
+ browserName = 'Edge';
+ // fullVersion = navigator.userAgent.split('Edge/')[1];
+ fullVersion = parseInt(navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)[2], 10);
+ }
+
+ // trim the fullVersion string at semicolon/space if present
+ if ((ix = fullVersion.indexOf(';')) !== -1) {
+ fullVersion = fullVersion.substring(0, ix);
+ }
+
+ if ((ix = fullVersion.indexOf(' ')) !== -1) {
+ fullVersion = fullVersion.substring(0, ix);
+ }
+
+ majorVersion = parseInt('' + fullVersion, 10);
+
+ if (isNaN(majorVersion)) {
+ fullVersion = '' + parseFloat(navigator.appVersion);
+ majorVersion = parseInt(navigator.appVersion, 10);
+ }
+
+ return {
+ fullVersion: fullVersion,
+ version: majorVersion,
+ name: browserName
+ };
+ }
+
+ var isMobile = {
+ Android: function() {
+ return navigator.userAgent.match(/Android/i);
+ },
+ BlackBerry: function() {
+ return navigator.userAgent.match(/BlackBerry/i);
+ },
+ iOS: function() {
+ return navigator.userAgent.match(/iPhone|iPad|iPod/i);
+ },
+ Opera: function() {
+ return navigator.userAgent.match(/Opera Mini/i);
+ },
+ Windows: function() {
+ return navigator.userAgent.match(/IEMobile/i);
+ },
+ any: function() {
+ return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
+ },
+ getOsName: function() {
+ var osName = 'Unknown OS';
+ if (isMobile.Android()) {
+ osName = 'Android';
+ }
+
+ if (isMobile.BlackBerry()) {
+ osName = 'BlackBerry';
+ }
+
+ if (isMobile.iOS()) {
+ osName = 'iOS';
+ }
+
+ if (isMobile.Opera()) {
+ osName = 'Opera Mini';
+ }
+
+ if (isMobile.Windows()) {
+ osName = 'Windows';
+ }
+
+ return osName;
+ }
+ };
+
+ var osName = 'Unknown OS';
+
+ if (isMobile.any()) {
+ osName = isMobile.getOsName();
+ } else {
+ if (navigator.appVersion.indexOf('Win') !== -1) {
+ osName = 'Windows';
+ }
+
+ if (navigator.appVersion.indexOf('Mac') !== -1) {
+ osName = 'MacOS';
+ }
+
+ if (navigator.appVersion.indexOf('X11') !== -1) {
+ osName = 'UNIX';
+ }
+
+ if (navigator.appVersion.indexOf('Linux') !== -1) {
+ osName = 'Linux';
+ }
+ }
+
+
+ var isCanvasSupportsStreamCapturing = false;
+ var isVideoSupportsStreamCapturing = false;
+ ['captureStream', 'mozCaptureStream', 'webkitCaptureStream'].forEach(function(item) {
+ // asdf
+ if (item in document.createElement('canvas')) {
+ isCanvasSupportsStreamCapturing = true;
+ }
+
+ if (item in document.createElement('video')) {
+ isVideoSupportsStreamCapturing = true;
+ }
+ });
+
+ // via: https://github.com/diafygi/webrtc-ips
+ function DetectLocalIPAddress(callback) {
+ getIPs(function(ip) {
+ //local IPs
+ if (ip.match(/^(192\.168\.|169\.254\.|10\.|172\.(1[6-9]|2\d|3[01]))/)) {
+ callback('Local: ' + ip);
+ }
+
+ //assume the rest are public IPs
+ else {
+ callback('Public: ' + ip);
+ }
+ });
+ }
+
+ //get the IP addresses associated with an account
+ function getIPs(callback) {
+ var ipDuplicates = {};
+
+ //compatibility for firefox and chrome
+ var RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
+ var useWebKit = !!window.webkitRTCPeerConnection;
+
+ // bypass naive webrtc blocking using an iframe
+ if (!RTCPeerConnection) {
+ var iframe = document.getElementById('iframe');
+ if (!iframe) {
+ //<iframe id="iframe" sandbox="allow-same-origin" style="display: none"></iframe>
+ throw 'NOTE: you need to have an iframe in the page right above the script tag.';
+ }
+ var win = iframe.contentWindow;
+ RTCPeerConnection = win.RTCPeerConnection || win.mozRTCPeerConnection || win.webkitRTCPeerConnection;
+ useWebKit = !!win.webkitRTCPeerConnection;
+ }
+
+ //minimal requirements for data connection
+ var mediaConstraints = {
+ optional: [{
+ RtpDataChannels: true
+ }]
+ };
+
+ //firefox already has a default stun server in about:config
+ // media.peerconnection.default_iceservers =
+ // [{"url": "stun:stun.services.mozilla.com"}]
+ var servers;
+
+ //add same stun server for chrome
+ if (useWebKit) {
+ servers = {
+ iceServers: [{
+ urls: 'stun:stun.services.mozilla.com'
+ }]
+ };
+
+ if (typeof DetectRTC !== 'undefined' && DetectRTC.browser.isFirefox && DetectRTC.browser.version <= 38) {
+ servers[0] = {
+ url: servers[0].urls
+ };
+ }
+ }
+
+ //construct a new RTCPeerConnection
+ var pc = new RTCPeerConnection(servers, mediaConstraints);
+
+ function handleCandidate(candidate) {
+ //match just the IP address
+ var ipRegex = /([0-9]{1,3}(\.[0-9]{1,3}){3})/;
+ var ipAddress = ipRegex.exec(candidate)[1];
+
+ //remove duplicates
+ if (ipDuplicates[ipAddress] === undefined) {
+ callback(ipAddress);
+ }
+
+ ipDuplicates[ipAddress] = true;
+ }
+
+ //listen for candidate events
+ pc.onicecandidate = function(ice) {
+ //skip non-candidate events
+ if (ice.candidate) {
+ handleCandidate(ice.candidate.candidate);
+ }
+ };
+
+ //create a bogus data channel
+ pc.createDataChannel('');
+
+ //create an offer sdp
+ pc.createOffer(function(result) {
+
+ //trigger the stun server request
+ pc.setLocalDescription(result, function() {}, function() {});
+
+ }, function() {});
+
+ //wait for a while to let everything done
+ setTimeout(function() {
+ //read candidate info from local description
+ var lines = pc.localDescription.sdp.split('\n');
+
+ lines.forEach(function(line) {
+ if (line.indexOf('a=candidate:') === 0) {
+ handleCandidate(line);
+ }
+ });
+ }, 1000);
+ }
+
+ var MediaDevices = [];
+
+ // ---------- Media Devices detection
+ var canEnumerate = false;
+
+ /*global MediaStreamTrack:true */
+ if (typeof MediaStreamTrack !== 'undefined' && 'getSources' in MediaStreamTrack) {
+ canEnumerate = true;
+ } else if (navigator.mediaDevices && !!navigator.mediaDevices.enumerateDevices) {
+ canEnumerate = true;
+ }
+
+ var hasMicrophone = canEnumerate;
+ var hasSpeakers = canEnumerate;
+ var hasWebcam = canEnumerate;
+
+ // http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediadevices
+ // todo: switch to enumerateDevices when landed in canary.
+ function checkDeviceSupport(callback) {
+ // This method is useful only for Chrome!
+
+ if (!navigator.enumerateDevices && window.MediaStreamTrack && window.MediaStreamTrack.getSources) {
+ navigator.enumerateDevices = window.MediaStreamTrack.getSources.bind(window.MediaStreamTrack);
+ }
+
+ if (!navigator.enumerateDevices && navigator.enumerateDevices) {
+ navigator.enumerateDevices = navigator.enumerateDevices.bind(navigator);
+ }
+
+ if (!navigator.enumerateDevices) {
+ if (callback) {
+ callback();
+ }
+ return;
+ }
+
+ MediaDevices = [];
+ navigator.enumerateDevices(function(devices) {
+ devices.forEach(function(_device) {
+ var device = {};
+ for (var d in _device) {
+ device[d] = _device[d];
+ }
+
+ var skip;
+ MediaDevices.forEach(function(d) {
+ if (d.id === device.id) {
+ skip = true;
+ }
+ });
+
+ if (skip) {
+ return;
+ }
+
+ // if it is MediaStreamTrack.getSources
+ if (device.kind === 'audio') {
+ device.kind = 'audioinput';
+ }
+
+ if (device.kind === 'video') {
+ device.kind = 'videoinput';
+ }
+
+ if (!device.deviceId) {
+ device.deviceId = device.id;
+ }
+
+ if (!device.id) {
+ device.id = device.deviceId;
+ }
+
+ if (!device.label) {
+ device.label = 'Please invoke getUserMedia once.';
+ if (!isHTTPs) {
+ device.label = 'HTTPs is required to get label of this ' + device.kind + ' device.';
+ }
+ }
+
+ if (device.kind === 'audioinput' || device.kind === 'audio') {
+ hasMicrophone = true;
+ }
+
+ if (device.kind === 'audiooutput') {
+ hasSpeakers = true;
+ }
+
+ if (device.kind === 'videoinput' || device.kind === 'video') {
+ hasWebcam = true;
+ }
+
+ // there is no 'videoouput' in the spec.
+
+ MediaDevices.push(device);
+ });
+
+ if (typeof DetectRTC !== 'undefined') {
+ DetectRTC.MediaDevices = MediaDevices;
+ DetectRTC.hasMicrophone = hasMicrophone;
+ DetectRTC.hasSpeakers = hasSpeakers;
+ DetectRTC.hasWebcam = hasWebcam;
+ }
+
+ if (callback) {
+ callback();
+ }
+ });
+ }
+
+ // check for microphone/camera support!
+ checkDeviceSupport();
+
+ var DetectRTC = {};
+
+ // ----------
+ // DetectRTC.browser.name || DetectRTC.browser.version || DetectRTC.browser.fullVersion
+ DetectRTC.browser = getBrowserInfo();
+
+ // DetectRTC.isChrome || DetectRTC.isFirefox || DetectRTC.isEdge
+ DetectRTC.browser['is' + DetectRTC.browser.name] = true;
+
+ var isHTTPs = location.protocol === 'https:';
+ var isNodeWebkit = !!(window.process && (typeof window.process === 'object') && window.process.versions && window.process.versions['node-webkit']);
+
+ // --------- Detect if system supports WebRTC 1.0 or WebRTC 1.1.
+ var isWebRTCSupported = false;
+ ['webkitRTCPeerConnection', 'mozRTCPeerConnection', 'RTCIceGatherer'].forEach(function(item) {
+ if (item in window) {
+ isWebRTCSupported = true;
+ }
+ });
+ DetectRTC.isWebRTCSupported = isWebRTCSupported;
+
+ //-------
+ DetectRTC.isORTCSupported = typeof RTCIceGatherer !== 'undefined';
+
+ // --------- Detect if system supports screen capturing API
+ var isScreenCapturingSupported = false;
+ if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 35) {
+ isScreenCapturingSupported = true;
+ } else if (DetectRTC.browser.isFirefox && DetectRTC.browser.version >= 34) {
+ isScreenCapturingSupported = true;
+ }
+
+ if (!isHTTPs) {
+ isScreenCapturingSupported = false;
+ }
+ DetectRTC.isScreenCapturingSupported = isScreenCapturingSupported;
+
+ // --------- Detect if WebAudio API are supported
+ var webAudio = {};
+ ['AudioContext', 'webkitAudioContext', 'mozAudioContext', 'msAudioContext'].forEach(function(item) {
+ if (webAudio.isSupported && webAudio.isCreateMediaStreamSourceSupported) {
+ return;
+ }
+ if (item in window) {
+ webAudio.isSupported = true;
+
+ if ('createMediaStreamSource' in window[item].prototype) {
+ webAudio.isCreateMediaStreamSourceSupported = true;
+ }
+ }
+ });
+ DetectRTC.isAudioContextSupported = webAudio.isSupported;
+ DetectRTC.isCreateMediaStreamSourceSupported = webAudio.isCreateMediaStreamSourceSupported;
+
+ // ---------- Detect if SCTP/RTP channels are supported.
+
+ var isRtpDataChannelsSupported = false;
+ if (DetectRTC.browser.isChrome && DetectRTC.browser.version > 31) {
+ isRtpDataChannelsSupported = true;
+ }
+ DetectRTC.isRtpDataChannelsSupported = isRtpDataChannelsSupported;
+
+ var isSCTPSupportd = false;
+ if (DetectRTC.browser.isFirefox && DetectRTC.browser.version > 28) {
+ isSCTPSupportd = true;
+ } else if (DetectRTC.browser.isChrome && DetectRTC.browser.version > 25) {
+ isSCTPSupportd = true;
+ } else if (DetectRTC.browser.isOpera && DetectRTC.browser.version >= 11) {
+ isSCTPSupportd = true;
+ }
+ DetectRTC.isSctpDataChannelsSupported = isSCTPSupportd;
+
+ // ---------
+
+ DetectRTC.isMobileDevice = isMobileDevice; // "isMobileDevice" boolean is defined in "getBrowserInfo.js"
+
+ // ------
+
+ DetectRTC.isWebSocketsSupported = 'WebSocket' in window && 2 === window.WebSocket.CLOSING;
+ DetectRTC.isWebSocketsBlocked = 'Checking';
+
+ if (DetectRTC.isWebSocketsSupported) {
+ /* CUSTOM CODE */
+ var href = window.location.href;
+ var hostPatt = new RegExp(window.location.host +"/[^/]*");
+ var res = hostPatt.exec(href);
+ var protocol = window.location.protocol.replace("http","ws");
+
+ var signalingServerPath = protocol + "//" + res + "/contact";
+ var websocket = new WebSocket(signalingServerPath)
+ // var websocket = new WebSocket('wss://echo.websocket.org:443/');
+ /* CUSTOM CODE */
+ websocket.onopen = function() {
+ DetectRTC.isWebSocketsBlocked = false;
+
+ if (DetectRTC.loadCallback) {
+ DetectRTC.loadCallback();
+ }
+ };
+ websocket.onerror = function() {
+ DetectRTC.isWebSocketsBlocked = true;
+
+ if (DetectRTC.loadCallback) {
+ DetectRTC.loadCallback();
+ }
+ };
+ }
+
+ // ------
+ var isGetUserMediaSupported = false;
+ if (navigator.getUserMedia) {
+ isGetUserMediaSupported = true;
+ } else if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
+ isGetUserMediaSupported = true;
+ }
+ if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 47 && !isHTTPs) {
+ DetectRTC.isGetUserMediaSupported = 'Requires HTTPs';
+ }
+ DetectRTC.isGetUserMediaSupported = isGetUserMediaSupported;
+
+ // -----------
+ DetectRTC.osName = osName; // "osName" is defined in "detectOSName.js"
+
+ // ----------
+ DetectRTC.isCanvasSupportsStreamCapturing = isCanvasSupportsStreamCapturing;
+ DetectRTC.isVideoSupportsStreamCapturing = isVideoSupportsStreamCapturing;
+
+ // ------
+ DetectRTC.DetectLocalIPAddress = DetectLocalIPAddress;
+
+ // -------
+ DetectRTC.load = function(callback) {
+ this.loadCallback = callback;
+
+ checkDeviceSupport(callback);
+ };
+
+ DetectRTC.MediaDevices = MediaDevices;
+ DetectRTC.hasMicrophone = hasMicrophone;
+ DetectRTC.hasSpeakers = hasSpeakers;
+ DetectRTC.hasWebcam = hasWebcam;
+
+ // ------
+ var isSetSinkIdSupported = false;
+ if ('setSinkId' in document.createElement('video')) {
+ isSetSinkIdSupported = true;
+ }
+ DetectRTC.isSetSinkIdSupported = isSetSinkIdSupported;
+
+ // -----
+ var isRTPSenderReplaceTracksSupported = false;
+ if (DetectRTC.browser.isFirefox /*&& DetectRTC.browser.version > 39*/ ) {
+ /*global mozRTCPeerConnection:true */
+ if ('getSenders' in mozRTCPeerConnection.prototype) {
+ isRTPSenderReplaceTracksSupported = true;
+ }
+ } else if (DetectRTC.browser.isChrome) {
+ /*global webkitRTCPeerConnection:true */
+ if ('getSenders' in webkitRTCPeerConnection.prototype) {
+ isRTPSenderReplaceTracksSupported = true;
+ }
+ }
+ DetectRTC.isRTPSenderReplaceTracksSupported = isRTPSenderReplaceTracksSupported;
+
+ //------
+ var isRemoteStreamProcessingSupported = false;
+ if (DetectRTC.browser.isFirefox && DetectRTC.browser.version > 38) {
+ isRemoteStreamProcessingSupported = true;
+ }
+ DetectRTC.isRemoteStreamProcessingSupported = isRemoteStreamProcessingSupported;
+
+ //-------
+ var isApplyConstraintsSupported = false;
+
+ /*global MediaStreamTrack:true */
+ if (typeof MediaStreamTrack !== 'undefined' && 'applyConstraints' in MediaStreamTrack.prototype) {
+ isApplyConstraintsSupported = true;
+ }
+ DetectRTC.isApplyConstraintsSupported = isApplyConstraintsSupported;
+
+ //-------
+ var isMultiMonitorScreenCapturingSupported = false;
+ if (DetectRTC.browser.isFirefox && DetectRTC.browser.version >= 43) {
+ // version 43 merely supports platforms for multi-monitors
+ // version 44 will support exact multi-monitor selection i.e. you can select any monitor for screen capturing.
+ isMultiMonitorScreenCapturingSupported = true;
+ }
+ DetectRTC.isMultiMonitorScreenCapturingSupported = isMultiMonitorScreenCapturingSupported;
+
+ window.DetectRTC = DetectRTC;
+
+ })();
+
+ // DetectRTC extender
+ var screenCallback;
+
+ DetectRTC.screen = {
+ chromeMediaSource: 'screen',
+ extensionid: ReservedExtensionID,
+ getSourceId: function(callback) {
+ if (!callback) throw '"callback" parameter is mandatory.';
+
+ // make sure that chrome extension is installed.
+ if (!!DetectRTC.screen.status) {
+ onstatus(DetectRTC.screen.status);
+ } else DetectRTC.screen.getChromeExtensionStatus(onstatus);
+
+ function onstatus(status) {
+ if (status == 'installed-enabled') {
+ screenCallback = callback;
+ window.postMessage('get-sourceId', '*');
+ return;
+ }
+
+ DetectRTC.screen.chromeMediaSource = 'screen';
+ callback('No-Response'); // chrome extension isn't available
+ }
+ },
+ onMessageCallback: function(data) {
+ if (!(isString(data) || !!data.sourceId)) return;
+
+ log('chrome message', data);
+
+ // "cancel" button is clicked
+ if (data == 'PermissionDeniedError') {
+ DetectRTC.screen.chromeMediaSource = 'PermissionDeniedError';
+ if (screenCallback) return screenCallback('PermissionDeniedError');
+ else throw new Error('PermissionDeniedError');
+ }
+
+ // extension notified his presence
+ if (data == 'rtcmulticonnection-extension-loaded') {
+ DetectRTC.screen.chromeMediaSource = 'desktop';
+ if (DetectRTC.screen.onScreenCapturingExtensionAvailable) {
+ DetectRTC.screen.onScreenCapturingExtensionAvailable();
+
+ // make sure that this event isn't fired multiple times
+ DetectRTC.screen.onScreenCapturingExtensionAvailable = null;
+ }
+ }
+
+ // extension shared temp sourceId
+ if (data.sourceId) {
+ DetectRTC.screen.sourceId = data.sourceId;
+ if (screenCallback) screenCallback(DetectRTC.screen.sourceId);
+ }
+ },
+ getChromeExtensionStatus: function(extensionid, callback) {
+ function _callback(status) {
+ DetectRTC.screen.status = status;
+ callback(status);
+ }
+
+ if (isFirefox) return _callback('not-chrome');
+
+ if (arguments.length != 2) {
+ callback = extensionid;
+ extensionid = this.extensionid;
+ }
+
+ var image = document.createElement('img');
+ image.src = 'chrome-extension://' + extensionid + '/icon.png';
+ image.onload = function() {
+ DetectRTC.screen.chromeMediaSource = 'screen';
+ window.postMessage('are-you-there', '*');
+ setTimeout(function() {
+ if (DetectRTC.screen.chromeMediaSource == 'screen') {
+ _callback(
+ DetectRTC.screen.chromeMediaSource == 'desktop' ? 'installed-enabled' : 'installed-disabled' /* if chrome extension isn't permitted for current domain, then it will be installed-disabled all the time even if extension is enabled. */
+ );
+ } else _callback('installed-enabled');
+ }, 2000);
+ };
+ image.onerror = function() {
+ _callback('not-installed');
+ };
+ }
+ };
+
+ // if IE
+ if (!window.addEventListener) {
+ window.addEventListener = function(el, eventName, eventHandler) {
+ if (!el.attachEvent) return;
+ el.attachEvent('on' + eventName, eventHandler);
+ };
+ }
+
+ function listenEventHandler(eventName, eventHandler) {
+ window.removeEventListener(eventName, eventHandler);
+ window.addEventListener(eventName, eventHandler, false);
+ }
+
+ window.addEventListener('message', function(event) {
+ if (event.origin != window.location.origin) {
+ return;
+ }
+
+ DetectRTC.screen.onMessageCallback(event.data);
+ });
+
+ function setDefaults(connection) {
+ var DetectRTC = window.DetectRTC || {};
+
+ // www.RTCMultiConnection.org/docs/userid/
+ connection.userid = getRandomString();
+
+ // www.RTCMultiConnection.org/docs/session/
+ connection.session = {
+ audio: true,
+ video: true
+ };
+
+ // www.RTCMultiConnection.org/docs/maxParticipantsAllowed/
+ connection.maxParticipantsAllowed = 256;
+
+ // www.RTCMultiConnection.org/docs/direction/
+ // 'many-to-many' / 'one-to-many' / 'one-to-one' / 'one-way'
+ connection.direction = 'many-to-many';
+
+ // www.RTCMultiConnection.org/docs/mediaConstraints/
+ connection.mediaConstraints = {
+ mandatory: {}, // kept for backward compatibility
+ optional: [], // kept for backward compatibility
+ audio: {
+ mandatory: {},
+ optional: []
+ },
+ video: {
+ mandatory: {},
+ optional: []
+ }
+ };
+
+ // www.RTCMultiConnection.org/docs/candidates/
+ connection.candidates = {
+ host: true,
+ stun: true,
+ turn: true
+ };
+
+ connection.sdpConstraints = {};
+
+ // as @serhanters proposed in #225
+ // it will auto fix "all" renegotiation scenarios
+ connection.sdpConstraints.mandatory = {
+ OfferToReceiveAudio: true,
+ OfferToReceiveVideo: true
+ };
+
+ connection.privileges = {
+ canStopRemoteStream: false, // user can stop remote streams
+ canMuteRemoteStream: false // user can mute remote streams
+ };
+
+ connection.iceProtocols = {
+ tcp: true,
+ udp: true
+ };
+
+ // www.RTCMultiConnection.org/docs/preferSCTP/
+ connection.preferSCTP = isFirefox || chromeVersion >= 32 ? true : false;
+ connection.chunkInterval = isFirefox || chromeVersion >= 32 ? 100 : 500; // 500ms for RTP and 100ms for SCTP
+ connection.chunkSize = isFirefox || chromeVersion >= 32 ? 13 * 1000 : 1000; // 1000 chars for RTP and 13000 chars for SCTP
+
+ // www.RTCMultiConnection.org/docs/fakeDataChannels/
+ connection.fakeDataChannels = false;
+
+ connection.waitUntilRemoteStreamStartsFlowing = null; // NULL == true
+
+ // auto leave on page unload
+ connection.leaveOnPageUnload = true;
+
+ // get ICE-servers from XirSys
+ connection.getExternalIceServers = isChrome;
+
+ // www.RTCMultiConnection.org/docs/UA/
+ connection.UA = {
+ isFirefox: isFirefox,
+ isChrome: isChrome,
+ isMobileDevice: isMobileDevice,
+ version: isChrome ? chromeVersion : firefoxVersion,
+ isNodeWebkit: isNodeWebkit,
+ isSafari: isSafari,
+ isIE: isIE,
+ isOpera: isOpera
+ };
+
+ // file queue: to store previous file objects in memory;
+ // and stream over newly connected peers
+ // www.RTCMultiConnection.org/docs/fileQueue/
+ connection.fileQueue = {};
+
+ // this array is aimed to store all renegotiated streams' session-types
+ connection.renegotiatedSessions = {};
+
+ // www.RTCMultiConnection.org/docs/channels/
+ connection.channels = {};
+
+ // www.RTCMultiConnection.org/docs/extra/
+ connection.extra = {};
+
+ // www.RTCMultiConnection.org/docs/bandwidth/
+ connection.bandwidth = {
+ screen: 300 // 300kbps (dirty workaround)
+ };
+
+ // www.RTCMultiConnection.org/docs/caniuse/
+ connection.caniuse = {
+ RTCPeerConnection: DetectRTC.isWebRTCSupported,
+ getUserMedia: !!navigator.webkitGetUserMedia || !!navigator.mozGetUserMedia,
+ AudioContext: DetectRTC.isAudioContextSupported,
+
+ // there is no way to check whether "getUserMedia" flag is enabled or not!
+ ScreenSharing: DetectRTC.isScreenCapturingSupported,
+ RtpDataChannels: DetectRTC.isRtpDataChannelsSupported,
+ SctpDataChannels: DetectRTC.isSctpDataChannelsSupported
+ };
+
+ // www.RTCMultiConnection.org/docs/snapshots/
+ connection.snapshots = {};
+
+ // www.WebRTC-Experiment.com/demos/MediaStreamTrack.getSources.html
+ connection._mediaSources = {};
+
+ // www.RTCMultiConnection.org/docs/devices/
+ connection.devices = {};
+
+ // www.RTCMultiConnection.org/docs/language/ (to see list of all supported languages)
+ connection.language = 'en';
+
+ // www.RTCMultiConnection.org/docs/autoTranslateText/
+ connection.autoTranslateText = false;
+
+ // please use your own Google Translate API key
+ // Google Translate is a paid service.
+ connection.googKey = 'AIzaSyCgB5hmFY74WYB-EoWkhr9cAGr6TiTHrEE';
+
+ connection.localStreamids = [];
+ connection.localStreams = {};
+
+ // this object stores pre-recorded media streaming uids
+ // multiple pre-recorded media files can be streamed concurrently.
+ connection.preRecordedMedias = {};
+
+ // www.RTCMultiConnection.org/docs/attachStreams/
+ connection.attachStreams = [];
+
+ // www.RTCMultiConnection.org/docs/detachStreams/
+ connection.detachStreams = [];
+
+ connection.optionalArgument = {
+ optional: [{
+ DtlsSrtpKeyAgreement: true
+ }, {
+ googImprovedWifiBwe: true
+ }, {
+ googScreencastMinBitrate: 300
+ }],
+ mandatory: {}
+ };
+
+ connection.dataChannelDict = {};
+
+ // www.RTCMultiConnection.org/docs/dontAttachStream/
+ connection.dontAttachStream = false;
+
+ // www.RTCMultiConnection.org/docs/dontCaptureUserMedia/
+ connection.dontCaptureUserMedia = false;
+
+ // this feature added to keep users privacy and
+ // make sure HTTPs pages NEVER auto capture users media
+ // isChrome && location.protocol == 'https:'
+ connection.preventSSLAutoAllowed = false;
+
+ connection.autoReDialOnFailure = true;
+ connection.isInitiator = false;
+
+ // access DetectRTC.js features directly!
+ connection.DetectRTC = DetectRTC;
+
+ // you can falsify it to merge all ICE in SDP and share only SDP!
+ // such mechanism is useful for SIP/XMPP and XMLHttpRequest signaling
+ // bug: renegotiation fails if "trickleIce" is false
+ connection.trickleIce = true;
+
+ // this object stores list of all sessions in current channel
+ connection.sessionDescriptions = {};
+
+ // this object stores current user's session-description
+ // it is set only for initiator
+ // it is set as soon as "open" method is invoked.
+ connection.sessionDescription = null;
+
+ // resources used in RTCMultiConnection
+ connection.resources = {
+ // CUSTOM CODE //
+ /* Commenting this block as we do not wasnt external dependencies
+ *
+ RecordRTC: 'https://cdn.webrtc-experiment.com/RecordRTC.js',
+ PreRecordedMediaStreamer: 'https://cdn.webrtc-experiment.com/PreRecordedMediaStreamer.js',
+ customGetUserMediaBar: 'https://cdn.webrtc-experiment.com/navigator.customGetUserMediaBar.js',
+ html2canvas: 'https://cdn.webrtc-experiment.com/screenshot.js',
+ hark: 'https://cdn.webrtc-experiment.com/hark.js',
+ firebase: 'https://cdn.webrtc-experiment.com/firebase.js',
+ firebaseio: 'https://webrtc-signaling.firebaseio.com/',
+
+
+
+ getConnectionStats: 'https://cdn.webrtc-experiment.com/getConnectionStats.js',
+ FileBufferReader: 'https://cdn.webrtc-experiment.com/FileBufferReader.js'
+ */
+
+ // CUSTOM CODE //
+
+
+ };
+
+ // www.RTCMultiConnection.org/docs/body/
+ connection.body = document.body || document.documentElement;
+ connection.screenbody = null;// document.body || document.documentElement;
+ connection.videobody = null;//document.body || document.documentElement;
+
+ // www.RTCMultiConnection.org/docs/peers/
+ connection.peers = {};
+
+ // www.RTCMultiConnection.org/docs/firebase/
+ connection.firebase = 'chat';
+
+ connection.numberOfSessions = 0;
+ connection.numberOfConnectedUsers = 0;
+
+ // by default, data-connections will always be getting
+ // FileBufferReader.js if absent.
+ connection.enableFileSharing = true;
+
+ // www.RTCMultiConnection.org/docs/autoSaveToDisk/
+ // to make sure file-saver dialog is not invoked.
+ connection.autoSaveToDisk = false;
+
+ connection.processSdp = function(sdp) {
+ // process sdp here
+ return sdp;
+ };
+
+ // www.RTCMultiConnection.org/docs/onmessage/
+ connection.onmessage = function(e) {
+ log('onmessage', toStr(e));
+ };
+
+ // www.RTCMultiConnection.org/docs/onopen/
+ connection.onopen = function(e) {
+ log('Data connection is opened between you and', e.userid);
+ };
+
+ // www.RTCMultiConnection.org/docs/onerror/
+ connection.onerror = function(e) {
+ error(onerror, toStr(e));
+ };
+
+ // www.RTCMultiConnection.org/docs/onclose/
+ connection.onclose = function(e) {
+ warn('onclose', toStr(e));
+
+ // todo: should we use "stop" or "remove"?
+ // BTW, it is remote user!
+ connection.streams.remove({
+ userid: e.userid
+ });
+ };
+
+ var progressHelper = {};
+
+ // www.RTCMultiConnection.org/docs/onFileStart/
+ connection.onFileStart = function(file) {
+ var div = document.createElement('div');
+ div.title = file.name;
+ div.innerHTML = '<label>0%</label> <progress></progress>';
+ connection.body.insertBefore(div, connection.body.firstChild);
+ progressHelper[file.uuid] = {
+ div: div,
+ progress: div.querySelector('progress'),
+ label: div.querySelector('label')
+ };
+ progressHelper[file.uuid].progress.max = file.maxChunks;
+ };
+
+ // www.RTCMultiConnection.org/docs/onFileProgress/
+ connection.onFileProgress = function(chunk) {
+ var helper = progressHelper[chunk.uuid];
+ if (!helper) return;
+ helper.progress.value = chunk.currentPosition || chunk.maxChunks || helper.progress.max;
+ updateLabel(helper.progress, helper.label);
+ };
+
+ // www.RTCMultiConnection.org/docs/onFileEnd/
+ connection.onFileEnd = function(file) {
+ if (progressHelper[file.uuid]) progressHelper[file.uuid].div.innerHTML = '<a href="' + file.url + '" target="_blank" download="' + file.name + '">' + file.name + '</a>';
+
+ // for backward compatibility
+ if (connection.onFileSent || connection.onFileReceived) {
+ if (connection.onFileSent) connection.onFileSent(file, file.uuid);
+ if (connection.onFileReceived) connection.onFileReceived(file.name, file);
+ }
+ };
+
+ function updateLabel(progress, label) {
+ if (progress.position == -1) return;
+ var position = +progress.position.toFixed(2).split('.')[1] || 100;
+ label.innerHTML = position + '%';
+ }
+
+ // www.RTCMultiConnection.org/docs/onstream/
+ connection.onstream = function(e) {
+ // CUSTOM CODE //
+
+ if(e.isVideo || e.isAudio)
+ {
+ var videoTag = e.mediaElement;
+ var videoType = e.type;
+ var parentDiv = connection.videobody;
+
+ if(videoType == "local")
+ {
+ videoTag.style.top = "auto";
+ videoTag.style.position = "absolute";
+ //videoTag.style.left = (parentDiv.offsetWidth - 160) + "px";
+ videoTag.style.height = "150px";
+ videoTag.style.width = "150px";
+ videoTag.style.zIndex = 1;
+
+ }
+ else if(videoType == "remote")
+ {
+ videoTag.style.top = "auto";
+ videoTag.style.position = "absolute";
+ videoTag.style.zIndex = -1;
+ }
+
+ parentDiv.appendChild(videoTag);
+ }
+ else if(e.isScreen)
+ {
+ var screenTag = e.mediaElement;
+ var screenType = e.type;
+ var parentDiv = connection.screenbody;
+
+ if(screenType == "local")
+ {
+ // no need to display this because the person sharing his/her screen doesn't have to see whats being shared
+ // enabled for demo purposes
+ parentDiv.appendChild(screenTag);
+ }
+ else if(screenType == "remote")
+ {
+ parentDiv.appendChild(screenTag);
+ }
+
+
+ }
+
+ else
+ connection.body.insertBefore(e.mediaElement, connection.body.firstChild);
+
+ // CUSTOM CODE //
+ };
+
+ // www.RTCMultiConnection.org/docs/onStreamEndedHandler/
+ connection.onstreamended = function(e) {
+ log('onStreamEndedHandler:', e);
+
+ if (!e.mediaElement) {
+ return warn('Event.mediaElement is undefined', e);
+ }
+ if (!e.mediaElement.parentNode) {
+ e.mediaElement = document.getElementById(e.streamid);
+
+ if (!e.mediaElement) {
+ return warn('Event.mediaElement is undefined', e);
+ }
+
+ if (!e.mediaElement.parentNode) {
+ return warn('Event.mediElement.parentNode is null.', e);
+ }
+ }
+
+ e.mediaElement.parentNode.removeChild(e.mediaElement);
+ };
+
+ // todo: need to write documentation link
+ connection.onSessionClosed = function(session) {
+ if (session.isEjected) {
+ warn(session.userid, 'ejected you.');
+ } else warn('Session has been closed.', session);
+ };
+
+ // www.RTCMultiConnection.org/docs/onmute/
+ connection.onmute = function(e) {
+ if (e.isVideo && e.mediaElement) {
+ e.mediaElement.pause();
+ e.mediaElement.setAttribute('poster', e.snapshot || connection.resources.muted);
+ }
+ if (e.isAudio && e.mediaElement) {
+ e.mediaElement.muted = true;
+ }
+ };
+
+ // www.RTCMultiConnection.org/docs/onunmute/
+ connection.onunmute = function(e) {
+ if (e.isVideo && e.mediaElement) {
+ e.mediaElement.play();
+ e.mediaElement.removeAttribute('poster');
+ }
+ if (e.isAudio && e.mediaElement) {
+ e.mediaElement.muted = false;
+ }
+ };
+
+ // www.RTCMultiConnection.org/docs/onleave/
+ connection.onleave = function(e) {
+ log('onleave', toStr(e));
+ };
+
+ connection.token = getRandomString;
+
+ connection.peers[connection.userid] = {
+ drop: function() {
+ connection.drop();
+ },
+ renegotiate: function() {},
+ addStream: function() {},
+ hold: function() {},
+ unhold: function() {},
+ changeBandwidth: function() {},
+ sharePartOfScreen: function() {}
+ };
+
+ connection._skip = ['stop', 'mute', 'unmute', '_private', '_selectStreams', 'selectFirst', 'selectAll', 'remove'];
+
+ // www.RTCMultiConnection.org/docs/streams/
+ connection.streams = {
+ mute: function(session) {
+ this._private(session, true);
+ },
+ unmute: function(session) {
+ this._private(session, false);
+ },
+ _private: function(session, enabled) {
+ if (session && !isString(session)) {
+ for (var stream in this) {
+ if (connection._skip.indexOf(stream) == -1) {
+ _muteOrUnMute(this[stream], session, enabled);
+ }
+ }
+
+ function _muteOrUnMute(stream, session, isMute) {
+ if (session.local && stream.type != 'local') return;
+ if (session.remote && stream.type != 'remote') return;
+
+ if (session.isScreen && !stream.isScreen) return;
+ if (session.isAudio && !stream.isAudio) return;
+ if (session.isVideo && !stream.isVideo) return;
+
+ if (isMute) stream.mute(session);
+ else stream.unmute(session);
+ }
+ return;
+ }
+
+ // implementation from #68
+ for (var stream in this) {
+ if (connection._skip.indexOf(stream) == -1) {
+ this[stream]._private(session, enabled);
+ }
+ }
+ },
+ stop: function(type) {
+ var _stream;
+ for (var stream in this) {
+ if (connection._skip.indexOf(stream) == -1) {
+ _stream = this[stream];
+
+ if (!type) _stream.stop();
+
+ else if (isString(type)) {
+ // connection.streams.stop('screen');
+ var config = {};
+ config[type] = true;
+ _stopStream(_stream, config);
+ } else _stopStream(_stream, type);
+ }
+ }
+
+ function _stopStream(_stream, config) {
+ // connection.streams.stop({ remote: true, userid: 'remote-userid' });
+ if (config.userid && _stream.userid != config.userid) return;
+
+ if (config.local && _stream.type != 'local') return;
+ if (config.remote && _stream.type != 'remote') return;
+
+ if (config.screen && !!_stream.isScreen) {
+ _stream.stop();
+ }
+
+ if (config.audio && !!_stream.isAudio) {
+ _stream.stop();
+ }
+
+ if (config.video && !!_stream.isVideo) {
+ _stream.stop();
+ }
+
+ // connection.streams.stop('local');
+ if (!config.audio && !config.video && !config.screen) {
+ _stream.stop();
+ }
+ }
+ },
+ remove: function(type) {
+ var _stream;
+ for (var stream in this) {
+ if (connection._skip.indexOf(stream) == -1) {
+ _stream = this[stream];
+
+ if (!type) _stopAndRemoveStream(_stream, {
+ local: true,
+ remote: true
+ });
+
+ else if (isString(type)) {
+ // connection.streams.stop('screen');
+ var config = {};
+ config[type] = true;
+ _stopAndRemoveStream(_stream, config);
+ } else _stopAndRemoveStream(_stream, type);
+ }
+ }
+
+ function _stopAndRemoveStream(_stream, config) {
+ // connection.streams.remove({ remote: true, userid: 'remote-userid' });
+ if (config.userid && _stream.userid != config.userid) return;
+
+ if (config.local && _stream.type != 'local') return;
+ if (config.remote && _stream.type != 'remote') return;
+
+ if (config.screen && !!_stream.isScreen) {
+ endStream(_stream);
+ }
+
+ if (config.audio && !!_stream.isAudio) {
+ endStream(_stream);
+ }
+
+ if (config.video && !!_stream.isVideo) {
+ endStream(_stream);
+ }
+
+ // connection.streams.remove('local');
+ if (!config.audio && !config.video && !config.screen) {
+ endStream(_stream);
+ }
+ }
+
+ function endStream(_stream) {
+ onStreamEndedHandler(_stream, connection);
+ delete connection.streams[_stream.streamid];
+ }
+ },
+ selectFirst: function(args) {
+ return this._selectStreams(args, false);
+ },
+ selectAll: function(args) {
+ return this._selectStreams(args, true);
+ },
+ _selectStreams: function(args, all) {
+ if (!args || isString(args) || isEmpty(args)) throw 'Invalid arguments.';
+
+ // if userid is used then both local/remote shouldn't be auto-set
+ if (isNull(args.local) && isNull(args.remote) && isNull(args.userid)) {
+ args.local = args.remote = true;
+ }
+
+ if (!args.isAudio && !args.isVideo && !args.isScreen) {
+ args.isAudio = args.isVideo = args.isScreen = true;
+ }
+
+ var selectedStreams = [];
+ for (var stream in this) {
+ if (connection._skip.indexOf(stream) == -1 && (stream = this[stream]) && ((args.local && stream.type == 'local') || (args.remote && stream.type == 'remote') || (args.userid && stream.userid == args.userid))) {
+ if (args.isVideo && stream.isVideo) {
+ selectedStreams.push(stream);
+ }
+
+ if (args.isAudio && stream.isAudio) {
+ selectedStreams.push(stream);
+ }
+
+ if (args.isScreen && stream.isScreen) {
+ selectedStreams.push(stream);
+ }
+ }
+ }
+
+ return !!all ? selectedStreams : selectedStreams[0];
+ }
+ };
+
+ var iceServers = [];
+
+ // CUSTOM CODE //
+ // these servers are provided by research
+ iceServers.push({
+ url: '' /*TODO To test this WebRTC with some open stun and turn test servers*/
+ });
+
+ iceServers.push({
+ url: 'turn:207.140.168.120:3478',
+ credential: 'xxx',
+ username: 'xxx'
+ });
+
+ iceServers.push({
+ url: 'turn:207.140.168.120:443?transport=tcp',
+ credential: 'harmfulmustard',
+ username: 'ambient'
+ });
+
+ /* CHANGED: Fusion: These are servers for testing purposes
+
+ iceServers.push({
+ url: 'stun:stun.l.google.com:19302'
+ });
+
+ iceServers.push({
+ url: 'stun:stun.anyfirewall.com:3478'
+ });
+
+ iceServers.push({
+ url: 'turn:turn.bistri.com:80',
+ credential: 'homeo',
+ username: 'homeo'
+ });
+
+ iceServers.push({
+ url: 'turn:turn.anyfirewall.com:443?transport=tcp',
+ credential: 'webrtc',
+ username: 'webrtc'
+ });
+
+ */
+ // CUSTOM CODE //
+ connection.iceServers = iceServers;
+
+ connection.rtcConfiguration = {
+ iceServers: null,
+ iceTransports: 'all', // none || relay || all - ref: http://goo.gl/40I39K
+ peerIdentity: false
+ };
+
+ // www.RTCMultiConnection.org/docs/media/
+ connection.media = {
+ min: function(width, height) {
+ if (!connection.mediaConstraints.video) return;
+
+ if (!connection.mediaConstraints.video.mandatory) {
+ connection.mediaConstraints.video.mandatory = {};
+ }
+ connection.mediaConstraints.video.mandatory.minWidth = width;
+ connection.mediaConstraints.video.mandatory.minHeight = height;
+ },
+ max: function(width, height) {
+ if (!connection.mediaConstraints.video) return;
+
+ if (!connection.mediaConstraints.video.mandatory) {
+ connection.mediaConstraints.video.mandatory = {};
+ }
+
+ connection.mediaConstraints.video.mandatory.maxWidth = width;
+ connection.mediaConstraints.video.mandatory.maxHeight = height;
+ }
+ };
+
+ connection._getStream = function(event) {
+ var resultingObject = merge({
+ sockets: event.socket ? [event.socket] : []
+ }, event);
+
+ resultingObject.stop = function() {
+ var self = this;
+
+ self.sockets.forEach(function(socket) {
+ if (self.type == 'local') {
+ socket.send({
+ streamid: self.streamid,
+ stopped: true
+ });
+ }
+
+ if (self.type == 'remote') {
+ socket.send({
+ promptStreamStop: true,
+ streamid: self.streamid
+ });
+ }
+ });
+
+ if (self.type == 'remote') return;
+
+ var stream = self.stream;
+ if (stream) self.rtcMultiConnection.stopMediaStream(stream);
+ };
+
+ resultingObject.mute = function(session) {
+ this.muted = true;
+ this._private(session, true);
+ };
+
+ resultingObject.unmute = function(session) {
+ this.muted = false;
+ this._private(session, false);
+ };
+
+ function muteOrUnmuteLocally(session, isPause, mediaElement) {
+ if (!mediaElement) return;
+ var lastPauseState = mediaElement.onpause;
+ var lastPlayState = mediaElement.onplay;
+ mediaElement.onpause = mediaElement.onplay = function() {};
+
+ if (isPause) mediaElement.pause();
+ else mediaElement.play();
+
+ mediaElement.onpause = lastPauseState;
+ mediaElement.onplay = lastPlayState;
+ }
+
+ resultingObject._private = function(session, enabled) {
+ if (session && !isNull(session.sync) && session.sync == false) {
+ muteOrUnmuteLocally(session, enabled, this.mediaElement);
+ return;
+ }
+
+ muteOrUnmute({
+ root: this,
+ session: session,
+ enabled: enabled,
+ stream: this.stream
+ });
+ };
+
+ resultingObject.startRecording = function(session) {
+ var self = this;
+
+ if (!session) {
+ session = {
+ audio: true,
+ video: true
+ };
+ }
+
+ if (isString(session)) {
+ session = {
+ audio: session == 'audio',
+ video: session == 'video'
+ };
+ }
+
+ if (!window.RecordRTC) {
+ return loadScript(self.rtcMultiConnection.resources.RecordRTC, function() {
+ self.startRecording(session);
+ });
+ }
+
+ log('started recording session', session);
+
+ self.videoRecorder = self.audioRecorder = null;
+
+ if (isFirefox) {
+ // firefox supports both audio/video recording in single webm file
+ if (session.video) {
+ self.videoRecorder = RecordRTC(self.stream, {
+ type: 'video'
+ });
+ } else if (session.audio) {
+ self.audioRecorder = RecordRTC(self.stream, {
+ type: 'audio'
+ });
+ }
+ } else if (isChrome) {
+ // chrome supports recording in two separate files: WAV and WebM
+ if (session.video) {
+ self.videoRecorder = RecordRTC(self.stream, {
+ type: 'video'
+ });
+ }
+
+ if (session.audio) {
+ self.audioRecorder = RecordRTC(self.stream, {
+ type: 'audio'
+ });
+ }
+ }
+
+ if (self.audioRecorder) {
+ self.audioRecorder.startRecording();
+ }
+
+ if (self.videoRecorder) self.videoRecorder.startRecording();
+ };
+
+ resultingObject.stopRecording = function(callback, session) {
+ if (!session) {
+ session = {
+ audio: true,
+ video: true
+ };
+ }
+
+ if (isString(session)) {
+ session = {
+ audio: session == 'audio',
+ video: session == 'video'
+ };
+ }
+
+ log('stopped recording session', session);
+
+ var self = this;
+
+ if (session.audio && self.audioRecorder) {
+ self.audioRecorder.stopRecording(function() {
+ if (session.video && self.videoRecorder) {
+ self.videoRecorder.stopRecording(function() {
+ callback({
+ audio: self.audioRecorder.getBlob(),
+ video: self.videoRecorder.getBlob()
+ });
+ });
+ } else callback({
+ audio: self.audioRecorder.getBlob()
+ });
+ });
+ } else if (session.video && self.videoRecorder) {
+ self.videoRecorder.stopRecording(function() {
+ callback({
+ video: self.videoRecorder.getBlob()
+ });
+ });
+ }
+ };
+
+ resultingObject.takeSnapshot = function(callback) {
+ takeSnapshot({
+ mediaElement: this.mediaElement,
+ userid: this.userid,
+ connection: connection,
+ callback: callback
+ });
+ };
+
+ // redundant: kept only for backward compatibility
+ resultingObject.streamObject = resultingObject;
+
+ return resultingObject;
+ };
+
+ // new RTCMultiConnection().set({properties}).connect()
+ connection.set = function(properties) {
+ for (var property in properties) {
+ this[property] = properties[property];
+ }
+ return this;
+ };
+
+ // www.RTCMultiConnection.org/docs/onMediaError/
+ connection.onMediaError = function(event) {
+ error('name', event.name);
+ error('constraintName', toStr(event.constraintName));
+ error('message', event.message);
+ error('original session', event.session);
+ };
+
+ // www.RTCMultiConnection.org/docs/takeSnapshot/
+ connection.takeSnapshot = function(userid, callback) {
+ takeSnapshot({
+ userid: userid,
+ connection: connection,
+ callback: callback
+ });
+ };
+
+ connection.saveToDisk = function(blob, fileName) {
+ if (blob.size && blob.type) FileSaver.SaveToDisk(URL.createObjectURL(blob), fileName || blob.name || blob.type.replace('/', '-') + blob.type.split('/')[1]);
+ else FileSaver.SaveToDisk(blob, fileName);
+ };
+
+ // www.RTCMultiConnection.org/docs/selectDevices/
+ connection.selectDevices = function(device1, device2) {
+ if (device1) select(this.devices[device1]);
+ if (device2) select(this.devices[device2]);
+
+ function select(device) {
+ if (!device) return;
+ connection._mediaSources[device.kind] = device.id;
+ }
+ };
+
+ // www.RTCMultiConnection.org/docs/getDevices/
+ connection.getDevices = function(callback) {
+ // if, not yet fetched.
+ if (!DetectRTC.MediaDevices.length) {
+ return setTimeout(function() {
+ connection.getDevices(callback);
+ }, 1000);
+ }
+
+ // loop over all audio/video input/output devices
+ DetectRTC.MediaDevices.forEach(function(device) {
+ connection.devices[device.deviceId] = device;
+ });
+
+ if (callback) callback(connection.devices);
+ };
+
+ connection.getMediaDevices = connection.enumerateDevices = function(callback) {
+ if (!callback) throw 'callback is mandatory.';
+ connection.getDevices(function() {
+ callback(connection.DetectRTC.MediaDevices);
+ });
+ };
+
+ // www.RTCMultiConnection.org/docs/onCustomMessage/
+ connection.onCustomMessage = function(message) {
+ log('Custom message', message);
+ };
+
+ // www.RTCMultiConnection.org/docs/ondrop/
+ connection.ondrop = function(droppedBy) {
+ log('Media connection is dropped by ' + droppedBy);
+ };
+
+ // www.RTCMultiConnection.org/docs/drop/
+ connection.drop = function(config) {
+ config = config || {};
+ connection.attachStreams = [];
+
+ // "drop" should detach all local streams
+ for (var stream in connection.streams) {
+ if (connection._skip.indexOf(stream) == -1) {
+ stream = connection.streams[stream];
+ if (stream.type == 'local') {
+ connection.detachStreams.push(stream.streamid);
+ onStreamEndedHandler(stream, connection);
+ } else onStreamEndedHandler(stream, connection);
+ }
+ }
+
+ // www.RTCMultiConnection.org/docs/sendCustomMessage/
+ connection.sendCustomMessage({
+ drop: true,
+ dontRenegotiate: isNull(config.renegotiate) ? true : config.renegotiate
+ });
+ };
+
+ // www.RTCMultiConnection.org/docs/Translator/
+ connection.Translator = {
+ TranslateText: function(text, callback) {
+ // if(location.protocol === 'https:') return callback(text);
+
+ var newScript = document.createElement('script');
+ newScript.type = 'text/javascript';
+
+ var sourceText = encodeURIComponent(text); // escape
+
+ var randomNumber = 'method' + connection.token();
+ window[randomNumber] = function(response) {
+ if (response.data && response.data.translations[0] && callback) {
+ callback(response.data.translations[0].translatedText);
+ }
+
+ if (response.error && response.error.message == 'Daily Limit Exceeded') {
+ warn('Text translation failed. Error message: "Daily Limit Exceeded."');
+
+ // returning original text
+ callback(text);
+ }
+ };
+
+ var source = 'https://www.googleapis.com/language/translate/v2?key=' + connection.googKey + '&target=' + (connection.language || 'en-US') + '&callback=window.' + randomNumber + '&q=' + sourceText;
+ newScript.src = source;
+ document.getElementsByTagName('head')[0].appendChild(newScript);
+ }
+ };
+
+ // you can easily override it by setting it NULL!
+ connection.setDefaultEventsForMediaElement = function(mediaElement, streamid) {
+ mediaElement.onpause = function() {
+ if (connection.streams[streamid] && !connection.streams[streamid].muted) {
+ connection.streams[streamid].mute();
+ }
+ };
+
+ // todo: need to make sure that "onplay" EVENT doesn't play self-voice!
+ mediaElement.onplay = function() {
+ if (connection.streams[streamid] && connection.streams[streamid].muted) {
+ connection.streams[streamid].unmute();
+ }
+ };
+
+ var volumeChangeEventFired = false;
+ mediaElement.onvolumechange = function() {
+ if (!volumeChangeEventFired) {
+ volumeChangeEventFired = true;
+ connection.streams[streamid] && setTimeout(function() {
+ var root = connection.streams[streamid];
+ connection.streams[streamid].sockets.forEach(function(socket) {
+ socket.send({
+ streamid: root.streamid,
+ isVolumeChanged: true,
+ volume: mediaElement.volume
+ });
+ });
+ volumeChangeEventFired = false;
+ }, 2000);
+ }
+ };
+ };
+
+ // www.RTCMultiConnection.org/docs/onMediaFile/
+ connection.onMediaFile = function(e) {
+ log('onMediaFile', e);
+ connection.body.appendChild(e.mediaElement);
+ };
+
+ // www.RTCMultiConnection.org/docs/shareMediaFile/
+ // this method handles pre-recorded media streaming
+ connection.shareMediaFile = function(file, video, streamerid) {
+ streamerid = streamerid || connection.token();
+
+ if (!PreRecordedMediaStreamer) {
+ loadScript(connection.resources.PreRecordedMediaStreamer, function() {
+ connection.shareMediaFile(file, video, streamerid);
+ });
+ return streamerid;
+ }
+
+ return PreRecordedMediaStreamer.shareMediaFile({
+ file: file,
+ video: video,
+ streamerid: streamerid,
+ connection: connection
+ });
+ };
+
+ // www.RTCMultiConnection.org/docs/onpartofscreen/
+ connection.onpartofscreen = function(e) {
+ var image = document.createElement('img');
+ image.src = e.screenshot;
+ connection.body.appendChild(image);
+ };
+
+ connection.skipLogs = function() {
+ log = error = warn = function() {};
+ };
+
+ // www.RTCMultiConnection.org/docs/hold/
+ connection.hold = function(mLine) {
+ for (var peer in connection.peers) {
+ connection.peers[peer].hold(mLine);
+ }
+ };
+
+ // www.RTCMultiConnection.org/docs/onhold/
+ connection.onhold = function(track) {
+ log('onhold', track);
+
+ if (track.kind != 'audio') {
+ track.mediaElement.pause();
+ track.mediaElement.setAttribute('poster', track.screenshot || connection.resources.muted);
+ }
+ if (track.kind == 'audio') {
+ track.mediaElement.muted = true;
+ }
+ };
+
+ // www.RTCMultiConnection.org/docs/unhold/
+ connection.unhold = function(mLine) {
+ for (var peer in connection.peers) {
+ connection.peers[peer].unhold(mLine);
+ }
+ };
+
+ // www.RTCMultiConnection.org/docs/onunhold/
+ connection.onunhold = function(track) {
+ log('onunhold', track);
+
+ if (track.kind != 'audio') {
+ track.mediaElement.play();
+ track.mediaElement.removeAttribute('poster');
+ }
+ if (track.kind != 'audio') {
+ track.mediaElement.muted = false;
+ }
+ };
+
+ connection.sharePartOfScreen = function(args) {
+ var lastScreenshot = '';
+
+ function partOfScreenCapturer() {
+ // if stopped
+ if (connection.partOfScreen && !connection.partOfScreen.sharing) {
+ return;
+ }
+
+ capturePartOfScreen({
+ element: args.element,
+ connection: connection,
+ callback: function(screenshot) {
+ // don't share repeated content
+ if (screenshot != lastScreenshot) {
+ lastScreenshot = screenshot;
+
+ for (var channel in connection.channels) {
+ connection.channels[channel].send({
+ screenshot: screenshot,
+ isPartOfScreen: true
+ });
+ }
+ }
+
+ // "once" can be used to share single screenshot
+ !args.once && setTimeout(partOfScreenCapturer, args.interval || 200);
+ }
+ });
+ }
+
+ partOfScreenCapturer();
+
+ connection.partOfScreen = merge({
+ sharing: true
+ }, args);
+ };
+
+ connection.pausePartOfScreenSharing = function() {
+ for (var peer in connection.peers) {
+ connection.peers[peer].pausePartOfScreenSharing = true;
+ }
+
+ if (connection.partOfScreen) {
+ connection.partOfScreen.sharing = false;
+ }
+ };
+
+ connection.resumePartOfScreenSharing = function() {
+ for (var peer in connection.peers) {
+ connection.peers[peer].pausePartOfScreenSharing = false;
+ }
+
+ if (connection.partOfScreen) {
+ connection.partOfScreen.sharing = true;
+ }
+ };
+
+ connection.stopPartOfScreenSharing = function() {
+ for (var peer in connection.peers) {
+ connection.peers[peer].stopPartOfScreenSharing = true;
+ }
+
+ if (connection.partOfScreen) {
+ connection.partOfScreen.sharing = false;
+ }
+ };
+
+ connection.takeScreenshot = function(element, callback) {
+ if (!element || !callback) throw 'Invalid number of arguments.';
+
+ if (!window.html2canvas) {
+ return loadScript(connection.resources.html2canvas, function() {
+ connection.takeScreenshot(element);
+ });
+ }
+
+ if (isString(element)) {
+ element = document.querySelector(element);
+ if (!element) element = document.getElementById(element);
+ }
+ if (!element) throw 'HTML Element is inaccessible!';
+
+ // html2canvas.js is used to take screenshots
+ html2canvas(element, {
+ onrendered: function(canvas) {
+ callback(canvas.toDataURL());
+ }
+ });
+ };
+
+ // this event is fired when RTCMultiConnection detects that chrome extension
+ // for screen capturing is installed and available
+ connection.onScreenCapturingExtensionAvailable = function() {
+ log('It seems that screen capturing extension is installed and available on your system!');
+ };
+
+ if (!isPluginRTC && DetectRTC.screen.onScreenCapturingExtensionAvailable) {
+ DetectRTC.screen.onScreenCapturingExtensionAvailable = function() {
+ connection.onScreenCapturingExtensionAvailable();
+ };
+ }
+
+ connection.changeBandwidth = function(bandwidth) {
+ for (var peer in connection.peers) {
+ connection.peers[peer].changeBandwidth(bandwidth);
+ }
+ };
+
+ connection.convertToAudioStream = function(mediaStream) {
+ convertToAudioStream(mediaStream);
+ };
+
+ connection.onstatechange = function(state) {
+ log('on:state:change (' + state.userid + '):', state.name + ':', state.reason || '');
+ };
+
+ connection.onfailed = function(event) {
+ if (!event.peer.numOfRetries) event.peer.numOfRetries = 0;
+ event.peer.numOfRetries++;
+
+ error('ICE connectivity check is failed. Renegotiating peer connection.');
+ event.peer.numOfRetries < 2 && event.peer.renegotiate();
+
+ if (event.peer.numOfRetries >= 2) event.peer.numOfRetries = 0;
+ };
+
+ connection.onconnected = function(event) {
+ // event.peer.addStream || event.peer.getConnectionStats
+ log('Peer connection has been established between you and', event.userid);
+ };
+
+ connection.ondisconnected = function(event) {
+ error('Peer connection seems has been disconnected between you and', event.userid);
+
+ if (isEmpty(connection.channels)) return;
+ if (!connection.channels[event.userid]) return;
+
+ // use WebRTC data channels to detect user's presence
+ connection.channels[event.userid].send({
+ checkingPresence: true
+ });
+
+ // wait 5 seconds, if target peer didn't response, simply disconnect
+ setTimeout(function() {
+ // iceConnectionState == 'disconnected' occurred out of low-bandwidth
+ // or internet connectivity issues
+ if (connection.peers[event.userid].connected) {
+ delete connection.peers[event.userid].connected;
+ return;
+ }
+
+ // to make sure this user's all remote streams are removed.
+ connection.streams.remove({
+ remote: true,
+ userid: event.userid
+ });
+
+ connection.remove(event.userid);
+ }, 3000);
+ };
+
+ connection.onstreamid = function(event) {
+ // event.isScreen || event.isVideo || event.isAudio
+ log('got remote streamid', event.streamid, 'from', event.userid);
+ };
+
+ connection.stopMediaStream = function(mediaStream) {
+ if (!mediaStream) throw 'MediaStream argument is mandatory.';
+
+ if (connection.keepStreamsOpened) {
+ if (mediaStream.onended) mediaStream.onended();
+ return;
+ }
+
+ // remove stream from "localStreams" object
+ // when native-stop method invoked.
+ if (connection.localStreams[mediaStream.streamid]) {
+ delete connection.localStreams[mediaStream.streamid];
+ }
+
+ if (isFirefox) {
+ // Firefox don't yet support onended for any stream (remote/local)
+ if (mediaStream.onended) mediaStream.onended();
+ }
+
+ // Latest firefox does support mediaStream.getAudioTrack but doesn't support stop on MediaStreamTrack
+ var checkForMediaStreamTrackStop = Boolean(
+ (mediaStream.getAudioTracks || mediaStream.getVideoTracks) && (
+ (mediaStream.getAudioTracks()[0] && !mediaStream.getAudioTracks()[0].stop) ||
+ (mediaStream.getVideoTracks()[0] && !mediaStream.getVideoTracks()[0].stop)
+ )
+ );
+
+ if (!mediaStream.getAudioTracks || checkForMediaStreamTrackStop) {
+ if (mediaStream.stop) {
+ mediaStream.stop();
+ }
+ return;
+ }
+
+ if (mediaStream.getAudioTracks().length && mediaStream.getAudioTracks()[0].stop) {
+ mediaStream.getAudioTracks().forEach(function(track) {
+ track.stop();
+ });
+ }
+
+ if (mediaStream.getVideoTracks().length && mediaStream.getVideoTracks()[0].stop) {
+ mediaStream.getVideoTracks().forEach(function(track) {
+ track.stop();
+ });
+ }
+ };
+
+ connection.changeBandwidth = function(bandwidth) {
+ if (!bandwidth || isString(bandwidth) || isEmpty(bandwidth)) {
+ throw 'Invalid "bandwidth" arguments.';
+ }
+
+ forEach(connection.peers, function(peer) {
+ peer.peer.bandwidth = bandwidth;
+ });
+
+ connection.renegotiate();
+ };
+
+ // www.RTCMultiConnection.org/docs/openSignalingChannel/
+ // http://goo.gl/uvoIcZ
+
+ // CUSTOM CODE
+ var href = window.location.href;
+ var hostPatt = new RegExp(window.location.host +"/[^/]*");
+ var res = hostPatt.exec(href);
+ var protocol = window.location.protocol.replace("http","ws");
+
+ var signalingServerPath = protocol + "//" + res + "/webrtc";
+ var SIGNALING_SERVER = signalingServerPath; //"ws://localhost:80/quantum/webrtc"; //"wss://localhost:80/quantum/webrtc"; --> ws for http and wss for https
+
+ connection.openSignalingChannel = function(config) {
+
+
+ config.channel = config.channel || this.channel;
+ var websocket = new WebSocket(SIGNALING_SERVER);
+ websocket.channel = config.channel;
+ websocket.onopen = function() {
+ websocket.push(JSON.stringify({
+ open: true,
+ channel: config.channel
+ }));
+ if (config.callback)
+ config.callback(websocket);
+ };
+ websocket.onmessage = function(event) {
+ config.onmessage(JSON.parse(event.data));
+ };
+ websocket.push = websocket.send;
+ websocket.send = function(data) {
+ websocket.push(JSON.stringify({
+ data: data,
+ channel: config.channel
+ }));
+ };
+
+ /*
+ // make sure firebase.js is loaded
+ if (!window.Firebase) {
+ return loadScript(connection.resources.firebase, function() {
+ connection.openSignalingChannel(config);
+ });
+ }
+
+ var channel = config.channel || connection.channel;
+
+ if (connection.firebase) {
+ // for custom firebase instances
+ connection.resources.firebaseio = connection.resources.firebaseio.replace('//chat.', '//' + connection.firebase + '.');
+ }
+
+ var firebase = new Firebase(connection.resources.firebaseio + channel);
+ firebase.channel = channel;
+ firebase.on('child_added', function(data) {
+ config.onmessage(data.val());
+ });
+
+ firebase.send = function(data) {
+ // a quick dirty workaround to make sure firebase
+ // shouldn't fail for NULL values.
+ for (var prop in data) {
+ if (isNull(data[prop]) || typeof data[prop] == 'function') {
+ data[prop] = false;
+ }
+ }
+
+ this.push(data);
+ };
+
+ if (!connection.socket)
+ connection.socket = firebase;
+
+ firebase.onDisconnect().remove();
+
+ setTimeout(function() {
+ config.callback(firebase);
+ }, 1);
+
+ */
+ // CUSTOM CODE //
+
+ };
+
+ connection.Plugin = Plugin;
+ }
+
+})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html
new file mode 100644
index 00000000..6f660025
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html
@@ -0,0 +1,78 @@
+
+<script>
+
+var DetectRTC = {};
+
+var screenCallback;
+
+DetectRTC.screen = {
+ chromeMediaSource: 'screen',
+ getSourceId: function (callback) {
+ screenCallback = callback;
+ window.postMessage('get-sourceId', '*');
+ },
+ onMessageCallback: function (data) {
+ // "cancel" button is clicked
+ if (data == 'PermissionDeniedError') {
+ DetectRTC.screen.chromeMediaSource = 'PermissionDeniedError';
+ if (screenCallback) return screenCallback('PermissionDeniedError');
+ else throw new Error('PermissionDeniedError');
+ }
+
+ // extension notified his presence
+ if (data == 'rtcmulticonnection-extension-loaded') {
+ DetectRTC.screen.chromeMediaSource = 'desktop';
+ }
+
+ // extension shared temp sourceId
+ if (data.sourceId) {
+ DetectRTC.screen.sourceId = data.sourceId;
+ if (screenCallback) screenCallback(DetectRTC.screen.sourceId);
+ }
+ },
+ getChromeExtensionStatus: function (callback) {
+ // https://chrome.google.com/webstore/detail/screen-capturing-private/icgmlogfeajbfdffajhoebcfbibfhaen
+ var extensionid = 'icgmlogfeajbfdffajhoebcfbibfhaen';
+
+ var image = document.createElement('img');
+ image.src = 'chrome-extension://' + extensionid + '/icon.png';
+ image.onload = function () {
+ DetectRTC.screen.chromeMediaSource = 'screen';
+ window.postMessage('are-you-there', '*');
+ setTimeout(function () {
+ if (DetectRTC.screen.chromeMediaSource == 'screen') {
+ callback('installed-disabled');
+ } else callback('installed-enabled');
+ }, 2000);
+ };
+ image.onerror = function () {
+ callback('not-installed');
+ };
+ }
+};
+
+window.addEventListener('message', function (event) {
+ if (!event.data || !(typeof event.data == 'string' || event.data.sourceId || event.data.captureSourceId)) return;
+ if (event.data.captureSourceId) captureSourceId();
+
+ DetectRTC.screen.onMessageCallback(event.data);
+});
+
+function captureSourceId() {
+ // check if desktop-capture extension installed.
+ DetectRTC.screen.getChromeExtensionStatus(function (status) {
+ if (status != 'installed-enabled') {
+ window.parent.postMessage({
+ chromeExtensionStatus: status
+ }, '*');
+ return;
+ }
+
+ DetectRTC.screen.getSourceId(function (sourceId) {
+ window.parent.postMessage({
+ chromeMediaSourceId: sourceId
+ }, '*');
+ });
+ });
+}
+</script>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/sandbox-gridster.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/sandbox-gridster.css
new file mode 100644
index 00000000..a9edba8f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/sandbox-gridster.css
@@ -0,0 +1,173 @@
+.gridster {
+ position: relative;
+ margin: auto;
+ /* height: 0
+ */}
+
+.gridster>ul {
+ margin: 0;
+ list-style: none;
+ padding: 0
+}
+
+.gridster-item {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ list-style: none;
+ z-index: 2;
+ position: absolute;
+ display: none
+}
+
+.gridster-loaded {
+ -webkit-transition: height .3s;
+ -moz-transition: height .3s;
+ -o-transition: height .3s;
+ transition: height .3s
+}
+
+.gridster-loaded .gridster-item {
+ display: block;
+ position: absolute;
+ -webkit-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
+ -moz-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
+ -o-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
+ transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
+ -webkit-transition-delay: 50ms;
+ -moz-transition-delay: 50ms;
+ -o-transition-delay: 50ms;
+ transition-delay: 50ms
+}
+
+.gridster-loaded .gridster-preview-holder {
+ display: none;
+ z-index: 1;
+ position: absolute;
+ background-color: #067ab4;
+ /*
+ background-color: rgb(6, 122, 180);
+ -ms-filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#067ab4', endColorstr='#067ab4'); IE
+ opacity: 0.2;
+ */
+ border-color: #fff;
+ -webkit-transition: width .2s, height .3s;
+ -moz-transition: width .2s, height .3s;
+ -o-transition: width .2s, height .3s;
+ transition: width .2s, height .3s;
+ -webkit-transition-delay: 50ms;
+ -moz-transition-delay: 50ms;
+ -o-transition-delay: 50ms;
+ transition-delay: 50ms
+}
+
+.gridster-loaded .gridster-item.gridster-item-moving {
+ -webkit-transition: none;
+ -moz-transition: none;
+ -o-transition: none;
+ transition: none;
+ opacity: 0.9;
+}
+
+.gridster-mobile {
+ height: auto !important
+}
+
+.gridster-mobile .gridster-item {
+ height: auto;
+ position: static;
+ float: none
+}
+
+.gridster-item.ng-leave.ng-leave-active {
+ opacity: 0
+}
+
+.gridster-item.ng-enter {
+ opacity: 1
+}
+
+.gridster-item-moving {
+ z-index: 3
+}
+
+.gridster-item-resizable-handler {
+ position: absolute;
+ font-size: 1px;
+ display: block
+}
+
+.handle-se {
+ cursor: se-resize;
+ width: 0;
+ height: 0;
+ right: 1px;
+ bottom: 1px;
+ border-style: solid;
+ border-width: 0 0 12px 12px;
+ border-color: transparent
+}
+
+.handle-ne {
+ cursor: ne-resize;
+ width: 12px;
+ height: 12px;
+ right: 1px;
+ top: 1px
+}
+
+.handle-nw {
+ cursor: nw-resize;
+ width: 12px;
+ height: 12px;
+ left: 1px;
+ top: 1px
+}
+
+.handle-sw {
+ cursor: sw-resize;
+ width: 12px;
+ height: 12px;
+ left: 1px;
+ bottom: 1px
+}
+
+.handle-e {
+ cursor: e-resize;
+ width: 12px;
+ bottom: 0;
+ right: 1px;
+ top: 0
+}
+
+.handle-s {
+ cursor: s-resize;
+ height: 12px;
+ right: 0;
+ bottom: 1px;
+ left: 0
+}
+
+.handle-n {
+ cursor: n-resize;
+ height: 12px;
+ right: 0;
+ top: 1px;
+ left: 0
+}
+
+.handle-w {
+ cursor: w-resize;
+ width: 12px;
+ left: 1px;
+ top: 0;
+ bottom: 0
+}
+
+.gridster .gridster-item:hover .gridster-box {
+ border: 1.5px solid #B3B2B3
+}
+
+.gridster .gridster-item:hover .handle-se {
+ border-color: transparent transparent #ccc
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/ui-gridster.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/ui-gridster.css
new file mode 100644
index 00000000..827e354e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/ui-gridster.css
@@ -0,0 +1,116 @@
+/* ui-gridster.css */
+.gridster-container {
+ background-color: #EFEFEF;
+ color: #fff;
+ border: 1px dashed;
+ overflow-y: auto;
+ overflow-x: hidden; }
+
+/* app css for attGridtser */
+.gridster-item-container {
+ background-color: #FFFFFF;
+ position: relative;
+ margin-left: auto;
+ margin-right: auto;
+ min-height: 79px;
+ height: 100%; }
+ .gridster-item-container .gridster-item-header {
+ /* gridster-item Header */
+ position: relative;
+ height: 50px !important;
+ border: 1px solid #d3d3d3;
+ border-bottom: 0;
+ background-color: #E5E5E5;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ z-index: 1;
+ -webkit-border-radius: 2px 2px 0 0;
+ -moz-border-radius: 2px 2px 0 0;
+ -ms-border-radius: 2px 2px 0 0;
+ -o-border-radius: 2px 2px 0 0;
+ border-radius: 2px 2px 0 0;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ overflow: hidden;
+ /* IE6-8 */ }
+ .gridster-item-container .gridster-item-header .gridster-item-handle {
+ cursor: move;
+ margin: 12px;
+ position: absolute;
+ top: 0;
+ left: 0;
+ border: 0;
+ vertical-align: middle;
+ -ms-interpolation-mode: bicubic;
+ display: block; }
+ .gridster-item-container .gridster-item-header .gridster-item-header-content {
+ line-height: 44px;
+ margin-left: 26px;
+ font-family: clearviewatt;
+ font-size: 18px;
+ color: #444444;
+ float: left; }
+ .gridster-item-container .gridster-item-header .gridster-item-sub-header-content {
+ position: absolute;
+ top: 29.5px;
+ left: 26px;
+ font-family: clearviewatt;
+ font-size: 12px;
+ color: #444444; }
+ .gridster-item-container .gridster-item-header .gridster-item-header-buttons-container {
+ position: absolute;
+ right: 10px;
+ top: 10px;
+ overflow: hidden;
+ text-align: right;
+ height: 30px;
+ color: #444444; }
+ .gridster-item-container .gridster-item-body {
+ /* gridster-item Body */
+ position: absolute;
+ width: 100%;
+ top: 50px;
+ left: 0;
+ right: 0;
+ bottom: 29px;
+ border: 1px solid #d3d3d3;
+ box-sizing: border-box;
+ overflow: auto;
+ color: #444444;
+ /* text-align: center; */ }
+ .gridster-item-container .gridster-item-footer {
+ /* gridster-item Footer */
+ position: absolute;
+ bottom: 0;
+ width: 100%;
+ height: 29px !important;
+ text-align: left;
+ cursor: pointer;
+ border: 1px solid #d3d3d3;
+ border-top: 0;
+ background-color: #F2F2F2;
+ -webkit-border-radius: 0 0 2px 2px;
+ -moz-border-radius: 0 0 2px 2px;
+ -ms-border-radius: 0 0 2px 2px;
+ -o-border-radius: 0 0 2px 2px;
+ border-radius: 0 0 2px 2px;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ text-decoration: none;
+ /* IE6-8 */ }
+ .gridster-item-container .gridster-item-footer:hover {
+ background-color: #E5E5E5;
+ color: #565656;
+ text-decoration: underline; }
+ .gridster-item-container .gridster-item-footer .gridster-item-footer-content {
+ line-height: 30px;
+ font-family: clearviewatt;
+ font-size: 12px;
+ color: #565656;
+ margin: 20px;
+ text-decoration: none; }
+ .gridster-item-container .gridster-item-footer .gridster-item-footer-content:hover {
+ color: #199ddf;
+ text-decoration: underline; }
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/fusion-sunny.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/fusion-sunny.css
new file mode 100644
index 00000000..c8306156
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/fusion-sunny.css
@@ -0,0 +1,362 @@
+ input, textarea, select, div {
+ font-family: Arial;
+ font-size: 11px;
+ font-weight: normal;
+ }
+
+ form {
+ margin-top: 5px;
+ }
+
+
+ .applicationWindow { border-width: 0px 0px 1px 0px;
+ border-style: solid;
+ border-color: #959595;
+ box-shadow: inset 0 0 10px #000000;
+ margin-top: 10px;
+ margin-bottom: 10px;
+ margin-left: 10px;
+ margin-right: 10px;
+ }
+
+ .feedbackMessage { width: 99%;
+ font-family: Arial;
+ font-size: 11px;
+ color: #1f1f1f;
+ padding: 3px;
+ border: 1px #eeb420 solid;
+ margin: 3px;
+ background: #fff9e5;
+ }
+
+ .menubar {
+ border-width: 0px 0px 0px 1px; border-style: solid; border-color: #959595;
+ }
+
+ .footer {
+ /*clear: both;*/
+ border-width: 0px 1px 0px 1px; border-style: solid; border-color: #959595;
+ font-family: Verdana,Arial,Helvetica, sans-serif;
+ font-size: 9px;
+ padding: 10px 10px 30px 10px;
+ background: white;
+ }
+
+ .pageTitle {
+ font-family: Arial;
+ font-size: 18px;
+ font-weight: bold;
+ margin-top: 5px;
+ }
+
+ .content {
+ border-width: 0px 1px 0px 1px;
+ border-style: solid;
+ border-color: #959595;
+ font-family: Arial;
+ font-size: 11px;
+ padding: 5px;
+ background: white;
+ /*height: 600px;*/
+ }
+
+ .popupContent {
+ font-family: Arial;
+ font-size: 11px;
+ padding: 3px;
+ }
+
+ .logo {
+ border-width: 0px 1px 0px 1px;
+ border-style: solid;
+ border-color: #959595;
+ text-align: right;
+ }
+
+ .sep {
+ border: 1px solid black
+ }
+
+ .attLogo { /*position: relative;*/
+ float:left;
+ padding-top: 25px;
+ padding-left: 25px;
+ }
+
+ .applicationLogo { float:right;
+ padding-top: 25px;
+ padding-right: 25px;
+ }
+
+ .applinkWhite { font-family: Arial;
+ font-size: 13px;
+ font-weight: 900;
+ color: #FFFFFF;
+ text-decoration: none; }
+
+ .terms { font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 9px;
+ }
+
+ .broadcastMessage { color: red; }
+ .broadcastMessageList { color: red; }
+
+ .button {
+ margin: 5px 1px 5px 1px;
+ padding: 3px; }
+
+ .toolbarbutton:hover {
+ color:#005491;
+ }
+
+ .headerText { font-family: Arial;
+ font-size: 15px;
+ font-weight: 700;
+ color: #000000; }
+
+ .headerBackground { background: #336699; }
+
+ .errorMessageText { font-family: Arial;
+ font-size: 11px;
+ font-weight: bold;
+ color: red; }
+
+
+ .normalText { font-family: Arial;
+ font-size: 11px;
+ color: #000000; }
+
+ .normalTextRed { font-family: Arial;
+ font-size: 11px;
+ color: red; }
+
+
+ .smallNormalText { font-family: Arial;
+ font-size: 9px;
+ color: #000000; }
+
+ .tableBorder { border:1px outset teal }
+
+ .validationError { background: #b9eaff; }
+
+ .templatebody {
+ background: url(../images/body_graphic.jpg) repeat-x;
+ /*margin: 40px 80px 40px 80px;*/
+ }
+
+ /*--------------------- General Content ------------------------------------*/
+
+ .relative {
+ position:relative;
+ }
+
+ .clear{
+ clear:both;
+ }
+
+ .left {
+ float: left;
+ }
+
+ .leftCentered{
+ float: left;
+ text-align: center;
+ }
+
+ .right {
+ float: right;
+ }
+
+ .rightAligned{
+ text-align: right;
+ }
+
+ .centered {
+ text-align: center;
+ align: center;
+ }
+
+
+ .noWrap{
+ white-space:nowrap;
+ }
+
+ .disabled {
+ color:gray;
+ cursor:hand;
+ }
+
+ /*--------------------- Tab styles -------------------------------------*/
+
+ .current {
+ font-weight: bold;
+ border-width: 1px 1px 1px 1px;
+ border-color: silver;
+ border-style: solid;
+ }
+
+ .subTab {
+ font-weight:bold;
+ font-family: Arial;
+ font-size: 11px;
+ color: #0F3B82;
+ }
+
+
+ /*--------------------- Grid styles ------------------------------------*/
+
+ /* Grid navigation and header styles */
+ .gridFilterLabel {font-size: 7pt;
+ font-align: justify;
+ font-weight: bold;
+ display: block;}
+
+ .gridFilterText {height: 17px;
+ font-size: 8pt;
+ width: 60%;
+ font-align: justify;}
+
+ .gridNavigationBar { font-family:Arial,Verdana;
+ font-size:11px;
+ font-weight:normal;
+ color:#000;
+ margin: 0px;
+ width: 100%;
+ vertical-align: middle;
+ }
+
+ .gridNavigationBar .navLinks { float: left;
+ margin-right:15px;
+ padding-top: 2px;
+ height: 19px;
+ line-height: 19px;
+ }
+
+ .gridNavigationBar .pageControls { float: left;
+ margin-right: 15px;
+ height: 19px;
+ line-height: 19px;
+ }
+
+ .gridNavigationBar .pageControls input { font-size: 8pt;
+ height: 17px;
+ vertical-align: middle;
+ }
+
+ .gridNavigationBar .pageInfo { float: right;
+ vertical-align: middle;
+ height: 19px;
+ line-height: 19px;
+ }
+
+ .gridNavigationBar .pageInfo input { font-size: 8pt;
+ height: 17px;
+ vertical-align: middle;
+ }
+
+
+ .gridNavigationBar span { padding: 3px; }
+
+ .gridNavigationBar a {
+ text-decoration:underline;
+ color:#000;
+ font-weight:normal;
+ }
+
+ .gridNavigationBar img { vertical-align: middle; }
+
+ .gridBulkUpdateRow {
+ height: 35px;
+ line-height: 35px;
+ }
+
+ .gridBulkUpdateRow input {
+ vertical-align: middle;
+ }
+
+
+ /* dummy class used to lock the form elements of a grid - ex. bulk transaction processing */
+ .alwaysEnabled {}
+
+ .hidden {
+ display: none;
+ }
+
+ .selectedPage {
+ background-color:#C4DFFB;
+ color: white;
+ border-style: solid;
+ border-width: 1px;
+ border-color: gray;
+ padding-left: 3px;
+ padding-right: 3px;
+ vertical-align: middle;
+ }
+
+ .selectedRow{
+ /*background-color:#C4DFFB;*/
+ }
+
+ /* Action Item styles */
+ .actionList {
+ margin-left: -20px;
+ margin-right: -10px;
+ padding-left: 5px;
+ }
+
+ .actionList li {
+ float:left;
+ padding-left: 3px;
+ padding-right: 3px;
+ }
+
+ .actionList li a {
+ text-decoration:none;
+ color:#000;
+ }
+
+ /* Filter Operator List styles */
+
+ .filterList {
+ margin: 0px;
+ }
+
+ .filterList li {
+ list-style-type: none;
+ padding:3px 3px 3px 2px;
+ cursor:hand;
+ font-size:11px;
+ }
+
+ .filterList li:hover {
+ background: #404040;
+ }
+
+ .filterList li a {
+ color: #000;
+ text-decoration: none;
+ }
+
+ .filterList li:hover a {
+ color: white;
+ }
+
+ .filterList li a:hover {
+ text-decoration: none;
+ color: white;
+ }
+
+ .filterListItem a {
+ text-decoration:none;
+ padding:3px 2px 3px 2px;
+ }
+
+
+ /*---------------------- Customized ZK Styles ------------------------------*/
+
+ .z-datebox input, .z-timebox input {
+ font-family: Arial;
+ font-size: 11px;
+ height: 15px;
+ margin-top:1px;
+ }
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/jquery-ui.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/jquery-ui.css
new file mode 100644
index 00000000..1c22746c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/jquery-ui.css
@@ -0,0 +1,1225 @@
+/*! jQuery UI - v1.11.4 - 2015-03-11
+* http://jqueryui.com
+* Includes: core.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, draggable.css, menu.css, progressbar.css, resizable.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
+* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden {
+ display: none;
+}
+.ui-helper-hidden-accessible {
+ border: 0;
+ clip: rect(0 0 0 0);
+ height: 1px;
+ margin: -1px;
+ overflow: hidden;
+ padding: 0;
+ position: absolute;
+ width: 1px;
+}
+.ui-helper-reset {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ outline: 0;
+ line-height: 1.3;
+ text-decoration: none;
+ font-size: 100%;
+ list-style: none;
+}
+.ui-helper-clearfix:before,
+.ui-helper-clearfix:after {
+ content: "";
+ display: table;
+ border-collapse: collapse;
+}
+.ui-helper-clearfix:after {
+ clear: both;
+}
+.ui-helper-clearfix {
+ min-height: 0; /* support: IE7 */
+}
+.ui-helper-zfix {
+ width: 100%;
+ height: 100%;
+ top: 0;
+ left: 0;
+ position: absolute;
+ opacity: 0;
+ filter:Alpha(Opacity=0); /* support: IE8 */
+}
+
+.ui-front {
+ z-index: 100;
+}
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled {
+ cursor: default !important;
+}
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon {
+ display: block;
+ text-indent: -99999px;
+ overflow: hidden;
+ background-repeat: no-repeat;
+}
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+.ui-accordion .ui-accordion-header {
+ display: block;
+ cursor: pointer;
+ position: relative;
+ margin: 2px 0 0 0;
+ padding: .5em .5em .5em .7em;
+ min-height: 0; /* support: IE7 */
+ font-size: 100%;
+}
+.ui-accordion .ui-accordion-icons {
+ padding-left: 2.2em;
+}
+.ui-accordion .ui-accordion-icons .ui-accordion-icons {
+ padding-left: 2.2em;
+}
+.ui-accordion .ui-accordion-header .ui-accordion-header-icon {
+ position: absolute;
+ left: .5em;
+ top: 50%;
+ margin-top: -8px;
+}
+.ui-accordion .ui-accordion-content {
+ padding: 1em 2.2em;
+ border-top: 0;
+ overflow: auto;
+}
+.ui-autocomplete {
+ position: absolute;
+ top: 0;
+ left: 0;
+ cursor: default;
+}
+.ui-button {
+ display: inline-block;
+ position: relative;
+ padding: 0;
+ line-height: normal;
+ margin-right: .1em;
+ cursor: pointer;
+ vertical-align: middle;
+ text-align: center;
+ overflow: visible; /* removes extra width in IE */
+}
+.ui-button,
+.ui-button:link,
+.ui-button:visited,
+.ui-button:hover,
+.ui-button:active {
+ text-decoration: none;
+}
+/* to make room for the icon, a width needs to be set here */
+.ui-button-icon-only {
+ width: 2.2em;
+}
+/* button elements seem to need a little more width */
+button.ui-button-icon-only {
+ width: 2.4em;
+}
+.ui-button-icons-only {
+ width: 3.4em;
+}
+button.ui-button-icons-only {
+ width: 3.7em;
+}
+
+/* button text element */
+.ui-button .ui-button-text {
+ display: block;
+ line-height: normal;
+}
+.ui-button-text-only .ui-button-text {
+ padding: .4em 1em;
+}
+.ui-button-icon-only .ui-button-text,
+.ui-button-icons-only .ui-button-text {
+ padding: .4em;
+ text-indent: -9999999px;
+}
+.ui-button-text-icon-primary .ui-button-text,
+.ui-button-text-icons .ui-button-text {
+ padding: .4em 1em .4em 2.1em;
+}
+.ui-button-text-icon-secondary .ui-button-text,
+.ui-button-text-icons .ui-button-text {
+ padding: .4em 2.1em .4em 1em;
+}
+.ui-button-text-icons .ui-button-text {
+ padding-left: 2.1em;
+ padding-right: 2.1em;
+}
+/* no icon support for input elements, provide padding by default */
+input.ui-button {
+ padding: .4em 1em;
+}
+
+/* button icon element(s) */
+.ui-button-icon-only .ui-icon,
+.ui-button-text-icon-primary .ui-icon,
+.ui-button-text-icon-secondary .ui-icon,
+.ui-button-text-icons .ui-icon,
+.ui-button-icons-only .ui-icon {
+ position: absolute;
+ top: 50%;
+ margin-top: -8px;
+}
+.ui-button-icon-only .ui-icon {
+ left: 50%;
+ margin-left: -8px;
+}
+.ui-button-text-icon-primary .ui-button-icon-primary,
+.ui-button-text-icons .ui-button-icon-primary,
+.ui-button-icons-only .ui-button-icon-primary {
+ left: .5em;
+}
+.ui-button-text-icon-secondary .ui-button-icon-secondary,
+.ui-button-text-icons .ui-button-icon-secondary,
+.ui-button-icons-only .ui-button-icon-secondary {
+ right: .5em;
+}
+
+/* button sets */
+.ui-buttonset {
+ margin-right: 7px;
+}
+.ui-buttonset .ui-button {
+ margin-left: 0;
+ margin-right: -.3em;
+}
+
+/* workarounds */
+/* reset extra padding in Firefox, see h5bp.com/l */
+input.ui-button::-moz-focus-inner,
+button.ui-button::-moz-focus-inner {
+ border: 0;
+ padding: 0;
+}
+.ui-datepicker {
+ width: 17em;
+ padding: .2em .2em 0;
+ display: none;
+}
+.ui-datepicker .ui-datepicker-header {
+ position: relative;
+ padding: .2em 0;
+}
+.ui-datepicker .ui-datepicker-prev,
+.ui-datepicker .ui-datepicker-next {
+ position: absolute;
+ top: 2px;
+ width: 1.8em;
+ height: 1.8em;
+}
+.ui-datepicker .ui-datepicker-prev-hover,
+.ui-datepicker .ui-datepicker-next-hover {
+ top: 1px;
+}
+.ui-datepicker .ui-datepicker-prev {
+ left: 2px;
+}
+.ui-datepicker .ui-datepicker-next {
+ right: 2px;
+}
+.ui-datepicker .ui-datepicker-prev-hover {
+ left: 1px;
+}
+.ui-datepicker .ui-datepicker-next-hover {
+ right: 1px;
+}
+.ui-datepicker .ui-datepicker-prev span,
+.ui-datepicker .ui-datepicker-next span {
+ display: block;
+ position: absolute;
+ left: 50%;
+ margin-left: -8px;
+ top: 50%;
+ margin-top: -8px;
+}
+.ui-datepicker .ui-datepicker-title {
+ margin: 0 2.3em;
+ line-height: 1.8em;
+ text-align: center;
+}
+.ui-datepicker .ui-datepicker-title select {
+ font-size: 1em;
+ margin: 1px 0;
+}
+.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-year {
+ width: 45%;
+}
+.ui-datepicker table {
+ width: 100%;
+ font-size: .9em;
+ border-collapse: collapse;
+ margin: 0 0 .4em;
+}
+.ui-datepicker th {
+ padding: .7em .3em;
+ text-align: center;
+ font-weight: bold;
+ border: 0;
+}
+.ui-datepicker td {
+ border: 0;
+ padding: 1px;
+}
+.ui-datepicker td span,
+.ui-datepicker td a {
+ display: block;
+ padding: .2em;
+ text-align: right;
+ text-decoration: none;
+}
+.ui-datepicker .ui-datepicker-buttonpane {
+ background-image: none;
+ margin: .7em 0 0 0;
+ padding: 0 .2em;
+ border-left: 0;
+ border-right: 0;
+ border-bottom: 0;
+}
+.ui-datepicker .ui-datepicker-buttonpane button {
+ float: right;
+ margin: .5em .2em .4em;
+ cursor: pointer;
+ padding: .2em .6em .3em .6em;
+ width: auto;
+ overflow: visible;
+}
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
+ float: left;
+}
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi {
+ width: auto;
+}
+.ui-datepicker-multi .ui-datepicker-group {
+ float: left;
+}
+.ui-datepicker-multi .ui-datepicker-group table {
+ width: 95%;
+ margin: 0 auto .4em;
+}
+.ui-datepicker-multi-2 .ui-datepicker-group {
+ width: 50%;
+}
+.ui-datepicker-multi-3 .ui-datepicker-group {
+ width: 33.3%;
+}
+.ui-datepicker-multi-4 .ui-datepicker-group {
+ width: 25%;
+}
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
+ border-left-width: 0;
+}
+.ui-datepicker-multi .ui-datepicker-buttonpane {
+ clear: left;
+}
+.ui-datepicker-row-break {
+ clear: both;
+ width: 100%;
+ font-size: 0;
+}
+
+/* RTL support */
+.ui-datepicker-rtl {
+ direction: rtl;
+}
+.ui-datepicker-rtl .ui-datepicker-prev {
+ right: 2px;
+ left: auto;
+}
+.ui-datepicker-rtl .ui-datepicker-next {
+ left: 2px;
+ right: auto;
+}
+.ui-datepicker-rtl .ui-datepicker-prev:hover {
+ right: 1px;
+ left: auto;
+}
+.ui-datepicker-rtl .ui-datepicker-next:hover {
+ left: 1px;
+ right: auto;
+}
+.ui-datepicker-rtl .ui-datepicker-buttonpane {
+ clear: right;
+}
+.ui-datepicker-rtl .ui-datepicker-buttonpane button {
+ float: left;
+}
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
+.ui-datepicker-rtl .ui-datepicker-group {
+ float: right;
+}
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
+ border-right-width: 0;
+ border-left-width: 1px;
+}
+.ui-dialog {
+ overflow: hidden;
+ position: absolute;
+ top: 0;
+ left: 0;
+ padding: .2em;
+ outline: 0;
+}
+.ui-dialog .ui-dialog-titlebar {
+ padding: .4em 1em;
+ position: relative;
+}
+.ui-dialog .ui-dialog-title {
+ float: left;
+ margin: .1em 0;
+ white-space: nowrap;
+ width: 90%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.ui-dialog .ui-dialog-titlebar-close {
+ position: absolute;
+ right: .3em;
+ top: 50%;
+ width: 20px;
+ margin: -10px 0 0 0;
+ padding: 1px;
+ height: 20px;
+}
+.ui-dialog .ui-dialog-content {
+ position: relative;
+ border: 0;
+ padding: .5em 1em;
+ background: none;
+ overflow: auto;
+}
+.ui-dialog .ui-dialog-buttonpane {
+ text-align: left;
+ border-width: 1px 0 0 0;
+ background-image: none;
+ margin-top: .5em;
+ padding: .3em 1em .5em .4em;
+}
+.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
+ float: right;
+}
+.ui-dialog .ui-dialog-buttonpane button {
+ margin: .5em .4em .5em 0;
+ cursor: pointer;
+}
+.ui-dialog .ui-resizable-se {
+ width: 12px;
+ height: 12px;
+ right: -5px;
+ bottom: -5px;
+ background-position: 16px 16px;
+}
+.ui-draggable .ui-dialog-titlebar {
+ cursor: move;
+}
+.ui-draggable-handle {
+ -ms-touch-action: none;
+ touch-action: none;
+}
+.ui-menu {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ display: block;
+ outline: none;
+}
+.ui-menu .ui-menu {
+ position: absolute;
+}
+.ui-menu .ui-menu-item {
+ position: relative;
+ margin: 0;
+ padding: 3px 1em 3px .4em;
+ cursor: pointer;
+ min-height: 0; /* support: IE7 */
+ /* support: IE10, see #8844 */
+ list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");
+}
+.ui-menu .ui-menu-divider {
+ margin: 5px 0;
+ height: 0;
+ font-size: 0;
+ line-height: 0;
+ border-width: 1px 0 0 0;
+}
+.ui-menu .ui-state-focus,
+.ui-menu .ui-state-active {
+ margin: -1px;
+}
+
+/* icon support */
+.ui-menu-icons {
+ position: relative;
+}
+.ui-menu-icons .ui-menu-item {
+ padding-left: 2em;
+}
+
+/* left-aligned */
+.ui-menu .ui-icon {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: .2em;
+ margin: auto 0;
+}
+
+/* right-aligned */
+.ui-menu .ui-menu-icon {
+ left: auto;
+ right: 0;
+}
+.ui-progressbar {
+ height: 2em;
+ text-align: left;
+ overflow: hidden;
+}
+.ui-progressbar .ui-progressbar-value {
+ margin: -1px;
+ height: 100%;
+}
+.ui-progressbar .ui-progressbar-overlay {
+ background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");
+ height: 100%;
+ filter: alpha(opacity=25); /* support: IE8 */
+ opacity: 0.25;
+}
+.ui-progressbar-indeterminate .ui-progressbar-value {
+ background-image: none;
+}
+.ui-resizable {
+ position: relative;
+}
+.ui-resizable-handle {
+ position: absolute;
+ font-size: 0.1px;
+ display: block;
+ -ms-touch-action: none;
+ touch-action: none;
+}
+.ui-resizable-disabled .ui-resizable-handle,
+.ui-resizable-autohide .ui-resizable-handle {
+ display: none;
+}
+.ui-resizable-n {
+ cursor: n-resize;
+ height: 7px;
+ width: 100%;
+ top: -5px;
+ left: 0;
+}
+.ui-resizable-s {
+ cursor: s-resize;
+ height: 7px;
+ width: 100%;
+ bottom: -5px;
+ left: 0;
+}
+.ui-resizable-e {
+ cursor: e-resize;
+ width: 7px;
+ right: -5px;
+ top: 0;
+ height: 100%;
+}
+.ui-resizable-w {
+ cursor: w-resize;
+ width: 7px;
+ left: -5px;
+ top: 0;
+ height: 100%;
+}
+.ui-resizable-se {
+ cursor: se-resize;
+ width: 12px;
+ height: 12px;
+ right: 1px;
+ bottom: 1px;
+}
+.ui-resizable-sw {
+ cursor: sw-resize;
+ width: 9px;
+ height: 9px;
+ left: -5px;
+ bottom: -5px;
+}
+.ui-resizable-nw {
+ cursor: nw-resize;
+ width: 9px;
+ height: 9px;
+ left: -5px;
+ top: -5px;
+}
+.ui-resizable-ne {
+ cursor: ne-resize;
+ width: 9px;
+ height: 9px;
+ right: -5px;
+ top: -5px;
+}
+.ui-selectable {
+ -ms-touch-action: none;
+ touch-action: none;
+}
+.ui-selectable-helper {
+ position: absolute;
+ z-index: 100;
+ border: 1px dotted black;
+}
+.ui-selectmenu-menu {
+ padding: 0;
+ margin: 0;
+ position: absolute;
+ top: 0;
+ left: 0;
+ display: none;
+}
+.ui-selectmenu-menu .ui-menu {
+ overflow: auto;
+ /* Support: IE7 */
+ overflow-x: hidden;
+ padding-bottom: 1px;
+}
+.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup {
+ font-size: 1em;
+ font-weight: bold;
+ line-height: 1.5;
+ padding: 2px 0.4em;
+ margin: 0.5em 0 0 0;
+ height: auto;
+ border: 0;
+}
+.ui-selectmenu-open {
+ display: block;
+}
+.ui-selectmenu-button {
+ display: inline-block;
+ overflow: hidden;
+ position: relative;
+ text-decoration: none;
+ cursor: pointer;
+}
+.ui-selectmenu-button span.ui-icon {
+ right: 0.5em;
+ left: auto;
+ margin-top: -8px;
+ position: absolute;
+ top: 50%;
+}
+.ui-selectmenu-button span.ui-selectmenu-text {
+ text-align: left;
+ padding: 0.4em 2.1em 0.4em 1em;
+ display: block;
+ line-height: 1.4;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.ui-slider {
+ position: relative;
+ text-align: left;
+}
+.ui-slider .ui-slider-handle {
+ position: absolute;
+ z-index: 2;
+ width: 1.2em;
+ height: 1.2em;
+ cursor: default;
+ -ms-touch-action: none;
+ touch-action: none;
+}
+.ui-slider .ui-slider-range {
+ position: absolute;
+ z-index: 1;
+ font-size: .7em;
+ display: block;
+ border: 0;
+ background-position: 0 0;
+}
+
+/* support: IE8 - See #6727 */
+.ui-slider.ui-state-disabled .ui-slider-handle,
+.ui-slider.ui-state-disabled .ui-slider-range {
+ filter: inherit;
+}
+
+.ui-slider-horizontal {
+ height: .8em;
+}
+.ui-slider-horizontal .ui-slider-handle {
+ top: -.3em;
+ margin-left: -.6em;
+}
+.ui-slider-horizontal .ui-slider-range {
+ top: 0;
+ height: 100%;
+}
+.ui-slider-horizontal .ui-slider-range-min {
+ left: 0;
+}
+.ui-slider-horizontal .ui-slider-range-max {
+ right: 0;
+}
+
+.ui-slider-vertical {
+ width: .8em;
+ height: 100px;
+}
+.ui-slider-vertical .ui-slider-handle {
+ left: -.3em;
+ margin-left: 0;
+ margin-bottom: -.6em;
+}
+.ui-slider-vertical .ui-slider-range {
+ left: 0;
+ width: 100%;
+}
+.ui-slider-vertical .ui-slider-range-min {
+ bottom: 0;
+}
+.ui-slider-vertical .ui-slider-range-max {
+ top: 0;
+}
+.ui-sortable-handle {
+ -ms-touch-action: none;
+ touch-action: none;
+}
+.ui-spinner {
+ position: relative;
+ display: inline-block;
+ overflow: hidden;
+ padding: 0;
+ vertical-align: middle;
+}
+.ui-spinner-input {
+ border: none;
+ background: none;
+ color: inherit;
+ padding: 0;
+ margin: .2em 0;
+ vertical-align: middle;
+ margin-left: .4em;
+ margin-right: 22px;
+}
+.ui-spinner-button {
+ width: 16px;
+ height: 50%;
+ font-size: .5em;
+ padding: 0;
+ margin: 0;
+ text-align: center;
+ position: absolute;
+ cursor: default;
+ display: block;
+ overflow: hidden;
+ right: 0;
+}
+/* more specificity required here to override default borders */
+.ui-spinner a.ui-spinner-button {
+ border-top: none;
+ border-bottom: none;
+ border-right: none;
+}
+/* vertically center icon */
+.ui-spinner .ui-icon {
+ position: absolute;
+ margin-top: -8px;
+ top: 50%;
+ left: 0;
+}
+.ui-spinner-up {
+ top: 0;
+}
+.ui-spinner-down {
+ bottom: 0;
+}
+
+/* TR overrides */
+.ui-spinner .ui-icon-triangle-1-s {
+ /* need to fix icons sprite */
+ background-position: -65px -16px;
+}
+.ui-tabs {
+ position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+ padding: .2em;
+}
+.ui-tabs .ui-tabs-nav {
+ margin: 0;
+ padding: .2em .2em 0;
+}
+.ui-tabs .ui-tabs-nav li {
+ list-style: none;
+ float: left;
+ position: relative;
+ top: 0;
+ margin: 1px .2em 0 0;
+ border-bottom-width: 0;
+ padding: 0;
+ white-space: nowrap;
+}
+.ui-tabs .ui-tabs-nav .ui-tabs-anchor {
+ float: left;
+ padding: .5em 1em;
+ text-decoration: none;
+}
+.ui-tabs .ui-tabs-nav li.ui-tabs-active {
+ margin-bottom: -1px;
+ padding-bottom: 1px;
+}
+.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,
+.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,
+.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor {
+ cursor: text;
+}
+.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor {
+ cursor: pointer;
+}
+.ui-tabs .ui-tabs-panel {
+ display: block;
+ border-width: 0;
+ padding: 1em 1.4em;
+ background: none;
+}
+.ui-tooltip {
+ padding: 8px;
+ position: absolute;
+ z-index: 9999;
+ max-width: 300px;
+ -webkit-box-shadow: 0 0 5px #aaa;
+ box-shadow: 0 0 5px #aaa;
+}
+body .ui-tooltip {
+ border-width: 2px;
+}
+
+/* Component containers
+----------------------------------*/
+.ui-widget {
+ font-family: Verdana,Arial,sans-serif;
+ font-size: 1.1em;
+}
+.ui-widget .ui-widget {
+ font-size: 1em;
+}
+.ui-widget input,
+.ui-widget select,
+.ui-widget textarea,
+.ui-widget button {
+ font-family: Verdana,Arial,sans-serif;
+ font-size: 1em;
+}
+.ui-widget-content {
+ border: 1px solid #aaaaaa;
+ background: #ffffff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x;
+ color: #222222;
+}
+.ui-widget-content a {
+ color: #222222;
+}
+.ui-widget-header {
+ border: 1px solid #aaaaaa;
+ background: #cccccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x;
+ color: #222222;
+ font-weight: bold;
+}
+.ui-widget-header a {
+ color: #222222;
+}
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default,
+.ui-widget-content .ui-state-default,
+.ui-widget-header .ui-state-default {
+ border: 1px solid #d3d3d3;
+ background: #e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x;
+ font-weight: normal;
+ color: #555555;
+}
+.ui-state-default a,
+.ui-state-default a:link,
+.ui-state-default a:visited {
+ color: #555555;
+ text-decoration: none;
+}
+.ui-state-hover,
+.ui-widget-content .ui-state-hover,
+.ui-widget-header .ui-state-hover,
+.ui-state-focus,
+.ui-widget-content .ui-state-focus,
+.ui-widget-header .ui-state-focus {
+ border: 1px solid #999999;
+ background: #dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x;
+ font-weight: normal;
+ color: #212121;
+}
+.ui-state-hover a,
+.ui-state-hover a:hover,
+.ui-state-hover a:link,
+.ui-state-hover a:visited,
+.ui-state-focus a,
+.ui-state-focus a:hover,
+.ui-state-focus a:link,
+.ui-state-focus a:visited {
+ color: #212121;
+ text-decoration: none;
+}
+.ui-state-active,
+.ui-widget-content .ui-state-active,
+.ui-widget-header .ui-state-active {
+ border: 1px solid #aaaaaa;
+ background: #ffffff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;
+ font-weight: normal;
+ color: #212121;
+}
+.ui-state-active a,
+.ui-state-active a:link,
+.ui-state-active a:visited {
+ color: #212121;
+ text-decoration: none;
+}
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight,
+.ui-widget-content .ui-state-highlight,
+.ui-widget-header .ui-state-highlight {
+ border: 1px solid #fcefa1;
+ background: #fbf9ee url("images/ui-bg_glass_55_fbf9ee_1x400.png") 50% 50% repeat-x;
+ color: #363636;
+}
+.ui-state-highlight a,
+.ui-widget-content .ui-state-highlight a,
+.ui-widget-header .ui-state-highlight a {
+ color: #363636;
+}
+.ui-state-error,
+.ui-widget-content .ui-state-error,
+.ui-widget-header .ui-state-error {
+ border: 1px solid #cd0a0a;
+ background: #fef1ec url("images/ui-bg_glass_95_fef1ec_1x400.png") 50% 50% repeat-x;
+ color: #cd0a0a;
+}
+.ui-state-error a,
+.ui-widget-content .ui-state-error a,
+.ui-widget-header .ui-state-error a {
+ color: #cd0a0a;
+}
+.ui-state-error-text,
+.ui-widget-content .ui-state-error-text,
+.ui-widget-header .ui-state-error-text {
+ color: #cd0a0a;
+}
+.ui-priority-primary,
+.ui-widget-content .ui-priority-primary,
+.ui-widget-header .ui-priority-primary {
+ font-weight: bold;
+}
+.ui-priority-secondary,
+.ui-widget-content .ui-priority-secondary,
+.ui-widget-header .ui-priority-secondary {
+ opacity: .7;
+ filter:Alpha(Opacity=70); /* support: IE8 */
+ font-weight: normal;
+}
+.ui-state-disabled,
+.ui-widget-content .ui-state-disabled,
+.ui-widget-header .ui-state-disabled {
+ opacity: .35;
+ filter:Alpha(Opacity=35); /* support: IE8 */
+ background-image: none;
+}
+.ui-state-disabled .ui-icon {
+ filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
+}
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon {
+ width: 16px;
+ height: 16px;
+}
+.ui-icon,
+.ui-widget-content .ui-icon {
+ background-image: url("images/ui-icons_222222_256x240.png");
+}
+.ui-widget-header .ui-icon {
+ background-image: url("images/ui-icons_222222_256x240.png");
+}
+.ui-state-default .ui-icon {
+ background-image: url("images/ui-icons_888888_256x240.png");
+}
+.ui-state-hover .ui-icon,
+.ui-state-focus .ui-icon {
+ background-image: url("images/ui-icons_454545_256x240.png");
+}
+.ui-state-active .ui-icon {
+ background-image: url("images/ui-icons_454545_256x240.png");
+}
+.ui-state-highlight .ui-icon {
+ background-image: url("images/ui-icons_2e83ff_256x240.png");
+}
+.ui-state-error .ui-icon,
+.ui-state-error-text .ui-icon {
+ background-image: url("images/ui-icons_cd0a0a_256x240.png");
+}
+
+/* positioning */
+.ui-icon-blank { background-position: 16px 16px; }
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-on { background-position: -96px -144px; }
+.ui-icon-radio-off { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-all,
+.ui-corner-top,
+.ui-corner-left,
+.ui-corner-tl {
+ border-top-left-radius: 4px;
+}
+.ui-corner-all,
+.ui-corner-top,
+.ui-corner-right,
+.ui-corner-tr {
+ border-top-right-radius: 4px;
+}
+.ui-corner-all,
+.ui-corner-bottom,
+.ui-corner-left,
+.ui-corner-bl {
+ border-bottom-left-radius: 4px;
+}
+.ui-corner-all,
+.ui-corner-bottom,
+.ui-corner-right,
+.ui-corner-br {
+ border-bottom-right-radius: 4px;
+}
+
+/* Overlays */
+.ui-widget-overlay {
+ background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;
+ opacity: .3;
+ filter: Alpha(Opacity=30); /* support: IE8 */
+}
+.ui-widget-shadow {
+ margin: -8px 0 0 -8px;
+ padding: 8px;
+ background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;
+ opacity: .3;
+ filter: Alpha(Opacity=30); /* support: IE8 */
+ border-radius: 8px;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/layout/layout-default-latest.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/layout/layout-default-latest.css
new file mode 100644
index 00000000..aa382de3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/layout/layout-default-latest.css
@@ -0,0 +1,224 @@
+/*
+ * Default Layout Theme
+ *
+ * Created for jquery.layout
+ *
+ * Copyright (c) 2010
+ * Fabrizio Balliano (http://www.fabrizioballiano.net)
+ * Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * Last Updated: 2010-02-10
+ * NOTE: For best code readability, view this with a fixed-space font and tabs equal to 4-chars
+ */
+
+/*
+ * DEFAULT FONT
+ * Just to make demo-pages look better - not actually relevant to Layout!
+ */
+body {
+ font-family: Geneva, Arial, Helvetica, sans-serif;
+ font-size: 100%;
+ *font-size: 80%;
+}
+
+/*
+ * PANES & CONTENT-DIVs
+ */
+.ui-layout-pane { /* all 'panes' */
+ background: #FFF;
+ border: 1px solid #BBB;
+ padding: 10px;
+ overflow: auto;
+ /* DO NOT add scrolling (or padding) to 'panes' that have a content-div,
+ otherwise you may get double-scrollbars - on the pane AND on the content-div
+ - use ui-layout-wrapper class if pane has a content-div
+ - use ui-layout-container if pane has an inner-layout
+ */
+ }
+ /* (scrolling) content-div inside pane allows for fixed header(s) and/or footer(s) */
+ .ui-layout-content {
+ padding: 10px;
+ position: relative; /* contain floated or positioned elements */
+ overflow: auto; /* add scrolling to content-div */
+ }
+
+/*
+ * UTILITY CLASSES
+ * Must come AFTER pane-class above so will override
+ * These classes are NOT auto-generated and are NOT used by Layout
+ */
+.layout-child-container,
+.layout-content-container {
+ padding: 0;
+ overflow: hidden;
+}
+.layout-child-container {
+ border: 0; /* remove border because inner-layout-panes probably have borders */
+}
+.layout-scroll {
+ overflow: auto;
+}
+.layout-hide {
+ display: none;
+}
+
+/*
+ * RESIZER-BARS
+ */
+.ui-layout-resizer { /* all 'resizer-bars' */
+ background: #DDD;
+ border: 1px solid #BBB;
+ border-width: 0;
+ }
+ .ui-layout-resizer-drag { /* REAL resizer while resize in progress */
+ }
+ .ui-layout-resizer-hover { /* affects both open and closed states */
+ }
+ /* NOTE: It looks best when 'hover' and 'dragging' are set to the same color,
+ otherwise color shifts while dragging when bar can't keep up with mouse */
+ .ui-layout-resizer-open-hover , /* hover-color to 'resize' */
+ .ui-layout-resizer-dragging { /* resizer beging 'dragging' */
+ background: #C4E1A4;
+ }
+ .ui-layout-resizer-dragging { /* CLONED resizer being dragged */
+ border: 1px solid #BBB;
+ }
+ .ui-layout-resizer-north-dragging,
+ .ui-layout-resizer-south-dragging {
+ border-width: 1px 0;
+ }
+ .ui-layout-resizer-west-dragging,
+ .ui-layout-resizer-east-dragging {
+ border-width: 0 1px;
+ }
+ /* NOTE: Add a 'dragging-limit' color to provide visual feedback when resizer hits min/max size limits */
+ .ui-layout-resizer-dragging-limit { /* CLONED resizer at min or max size-limit */
+ background: #E1A4A4; /* red */
+ }
+
+ .ui-layout-resizer-closed-hover { /* hover-color to 'slide open' */
+ background: #EBD5AA;
+ }
+ .ui-layout-resizer-sliding { /* resizer when pane is 'slid open' */
+ opacity: .10; /* show only a slight shadow */
+ filter: alpha(opacity=10);
+ }
+ .ui-layout-resizer-sliding-hover { /* sliding resizer - hover */
+ opacity: 1.00; /* on-hover, show the resizer-bar normally */
+ filter: alpha(opacity=100);
+ }
+ /* sliding resizer - add 'outside-border' to resizer on-hover
+ * this sample illustrates how to target specific panes and states */
+ .ui-layout-resizer-north-sliding-hover { border-bottom-width: 1px; }
+ .ui-layout-resizer-south-sliding-hover { border-top-width: 1px; }
+ .ui-layout-resizer-west-sliding-hover { border-right-width: 1px; }
+ .ui-layout-resizer-east-sliding-hover { border-left-width: 1px; }
+
+/*
+ * TOGGLER-BUTTONS
+ */
+.ui-layout-toggler {
+ border: 1px solid #BBB; /* match pane-border */
+ background-color: #BBB;
+ }
+ .ui-layout-resizer-hover .ui-layout-toggler {
+ opacity: .60;
+ filter: alpha(opacity=60);
+ }
+ .ui-layout-toggler-hover , /* need when NOT resizable */
+ .ui-layout-resizer-hover .ui-layout-toggler-hover { /* need specificity when IS resizable */
+ background-color: #FC6;
+ opacity: 1.00;
+ filter: alpha(opacity=100);
+ }
+ .ui-layout-toggler-north ,
+ .ui-layout-toggler-south {
+ border-width: 0 1px; /* left/right borders */
+ }
+ .ui-layout-toggler-west ,
+ .ui-layout-toggler-east {
+ border-width: 1px 0; /* top/bottom borders */
+ }
+ /* hide the toggler-button when the pane is 'slid open' */
+ .ui-layout-resizer-sliding .ui-layout-toggler {
+ display: none;
+ }
+ /*
+ * style the text we put INSIDE the togglers
+ */
+ .ui-layout-toggler .content {
+ color: #666;
+ font-size: 12px;
+ font-weight: bold;
+ width: 100%;
+ padding-bottom: 0.35ex; /* to 'vertically center' text inside text-span */
+ }
+
+/*
+ * PANE-MASKS
+ * these styles are hard-coded on mask elems, but are also
+ * included here as !important to ensure will overrides any generic styles
+ */
+.ui-layout-mask {
+ border: none !important;
+ padding: 0 !important;
+ margin: 0 !important;
+ overflow: hidden !important;
+ position: absolute !important;
+ opacity: 0 !important;
+ filter: Alpha(Opacity="0") !important;
+}
+.ui-layout-mask-inside-pane { /* masks always inside pane EXCEPT when pane is an iframe */
+ top: 0 !important;
+ left: 0 !important;
+ width: 100% !important;
+ height: 100% !important;
+}
+div.ui-layout-mask {} /* standard mask for iframes */
+iframe.ui-layout-mask {} /* extra mask for objects/applets */
+
+/*
+ * Default printing styles
+ */
+@media print {
+ /*
+ * Unless you want to print the layout as it appears onscreen,
+ * these html/body styles are needed to allow the content to 'flow'
+ */
+ html {
+ height: auto !important;
+ overflow: visible !important;
+ }
+ body.ui-layout-container {
+ position: static !important;
+ top: auto !important;
+ bottom: auto !important;
+ left: auto !important;
+ right: auto !important;
+ /* only IE6 has container width & height set by Layout */
+ _width: auto !important;
+ _height: auto !important;
+ }
+ .ui-layout-resizer, .ui-layout-toggler {
+ display: none !important;
+ }
+ /*
+ * Default pane print styles disables positioning, borders and backgrounds.
+ * You can modify these styles however it suit your needs.
+ */
+ .ui-layout-pane {
+ border: none !important;
+ background: transparent !important;
+ position: relative !important;
+ top: auto !important;
+ bottom: auto !important;
+ left: auto !important;
+ right: auto !important;
+ width: auto !important;
+ height: auto !important;
+ overflow: visible !important;
+ }
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/workflows/workflows.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/workflows/workflows.css
new file mode 100644
index 00000000..b9d0146c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/workflows/workflows.css
@@ -0,0 +1,50 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+.scrolling-table{
+ width: 1200px;
+}
+.scrolling-table .scroll-viewport {
+ height: 200px !important;
+ width: 99.5% !important;
+ background-color:white;
+}
+
+.scrolling-table .scroll-overview{
+ margin-top:-14px !important;
+}
+
+.scrolling-table .scroll-viewport:hover{
+ background-color:white;
+}
+
+.scrolling-table #att-scroll-table-content{
+ height:200px;
+ position: absolute !important;
+ width:700px;
+ padding-left: 0px;
+ padding-top: 0px;
+ padding-bottom: 0px;
+ padding-right:5px;
+}
+
+.workflow-popup-body{
+ position: relative;
+ padding: 30px;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-list-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-list-controller.js
new file mode 100644
index 00000000..4e624345
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-list-controller.js
@@ -0,0 +1,62 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller("droolsListController", function ($scope,$http,droolsService, modalService, $modal) {
+ // Table Data
+ droolsService.getDrools().then(function(data){
+
+ var j = data;
+ $scope.tableData = JSON.parse(j.data);
+ //$scope.resetMenu();
+
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+ $scope.viewPerPage = 20;
+ $scope.scrollViewsPerPage = 2;
+ $scope.currentPage = 1;
+ $scope.totalPage;
+ $scope.searchCategory = "";
+ $scope.searchString = "";
+ /* modalService.showSuccess('','Modal Sample') ; */
+ for(x in $scope.tableData){
+ if($scope.tableData[x].active_yn=='Y')
+ $scope.tableData[x].active_yn=true;
+ else
+ $scope.tableData[x].active_yn=false;
+ }
+ $scope.openDialog = function(droolFile){
+ droolsService.setSelectedFile(droolFile);
+ $modal.open({
+ templateUrl: 'app/fusionapp/drools/view-models/droolsView.html',
+ controller: 'droolsViewController'
+
+ })
+ }
+
+
+
+});
+
+function openInNewTab(url) {
+ var win = window.open(url, '_blank');
+ win.focus();
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-view-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-view-controller.js
new file mode 100644
index 00000000..c475e175
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-view-controller.js
@@ -0,0 +1,64 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('droolsViewController', function ($scope,modalService,droolsService){
+
+
+ $scope.resultsString = "";
+ // Table Data
+ droolsService.getDroolDetails(droolsService.getSelectedFile()).then(function(data){
+
+ var j = data;
+ $scope.postDroolsBean = JSON.parse(j.data);
+ //execute($scope.postDroolsBean);
+
+ },function(error){
+ console.log("failed");
+ //reloadPageOnce();
+ });
+
+
+
+ $scope.execute = function(postDroolsBean) {
+ console.log(postDroolsBean);
+ var uuu = "post_drools/execute";
+ var postData={postDroolsBean:postDroolsBean};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.resultsString=data.resultsString;
+ console.log($scope.resultsString);
+ });
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while executing: "+ data.responseText);
+ }
+ });
+
+ };
+
+
+
+ });
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/droolsController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/droolsController.js
new file mode 100644
index 00000000..f9c0e234
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/droolsController.js
@@ -0,0 +1,30 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.config(function($routeProvider) {
+ $routeProvider
+ .when('/view', {
+ templateUrl: 'app/fusionapp/drools/view-models/droolsView.html',
+ controller : "droolsViewController"
+ })
+ .otherwise({
+ templateUrl: 'app/fusionapp/drools/view-models/droolsList.html',
+ controller : "droolsListController"
+ });
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/directives/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/directives/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/directives/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/services/droolsService.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/services/droolsService.js
new file mode 100644
index 00000000..d1dbfa6c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/services/droolsService.js
@@ -0,0 +1,76 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.factory('droolsService', function ($http, $q) {
+ return {
+ getDrools: function() {
+ return $http.get('getDrools')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getDroolDetails: function(selectedFile) {
+ return $http.get('getDroolDetails'+'?selectedFile=' + selectedFile )
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getRole: function(roleId) {
+
+ return $http.get('get_role?role_id=' + roleId)
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject(response.data);
+ }
+
+ }, function(response) {
+ // something went wrong
+ return $q.reject(response.data);
+ });
+ },
+
+ getSelectedFile: function() {
+ return this.selectedFile;
+ },
+
+ setSelectedFile: function(_selectedFile) {
+ this.selectedFile = _selectedFile;
+ }
+ };
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/utils/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/utils/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/utils/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsList.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsList.html
new file mode 100644
index 00000000..ca06b3c3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsList.html
@@ -0,0 +1,47 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div ng-controller="droolsListController">
+ <div>
+ <h1 class="heading1" style="margin-top:20px;">Drools List</h1>
+ <div style="margin-top:30px">
+ <table att-table table-data="tableData" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header key="droolsFile">Drools File Name</th>
+ <th att-table-header key="className">Class Name</th>
+ <th att-table-header key="selectedRules">Run Rule</th>
+
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="rowData in tableData">
+ <tr>
+ <td att-table-body ng-bind="rowData['droolsFile']">{{rowData.droolsFile}}</td>
+ <td att-table-body ng-bind="rowData['className']">{{rowData.className}}</td>
+
+ <td att-table-body >
+ <div ng-click="openDialog(rowData.droolsFile)" style="font-size:20px;"><a href="javascript:void(0)" class="icon-play"></a></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <input ng-model="currentPage"></input>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsSinglePage.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsSinglePage.html
new file mode 100644
index 00000000..1d4f1bfd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsSinglePage.html
@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<html>
+ <head>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta http-equiv="cache-control" content="max-age=0" />
+ <meta http-equiv="cache-control" content="no-cache" />
+ <meta http-equiv="expires" content="0" />
+ <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
+ <meta http-equiv="pragma" content="no-cache" />
+ <!-- CSS -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/fn-ebz.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/demo.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/base.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/btn.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/dtpk.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/frms.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/sldr.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/tbs.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/portal_ebz_header.css">
+ <link rel="stylesheet" type="text/css" href="static/fusion/css/jquery-ui.css">
+ <!-- Icons -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ionicons-2.0.1/css/ionicons.css" />
+ <!-- Basic AngularJS -->
+ <script src= "app/fusion/external/ebz/angular_js/angular.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/angular-sanitize.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/angular-route.min.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/app.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/gestures.js"></script>
+ <script src= "app/fusion/external/ebz/sandbox/att-abs-tpls.js" type="text/javascript"></script>
+ <script src="app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/angular-cookies.js"></script>
+ <!-- jQuery -->
+ <script src="static/js/jquery-1.10.2.js"></script>
+ <script src="static/js/jquery.mask.min.js" type="text/javascript"></script>
+ <script src="static/js/jquery-ui.js" type="text/javascript"></script>
+ <!-- AngularJS Gridster -->
+ <script src="static/fusion/js/att_angular_gridster/ui-gridster-tpls.js"></script>
+ <script src="static/fusion/js/att_angular_gridster/angular-gridster.js"></script>
+ <!-- AngularJS Config -->
+ <script src= "app/fusion/external/ebz/angular_js/app.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/checklist-model.js"></script>
+ <!-- Utility -->
+ <script src="app/fusion/scripts/modalService.js"></script>
+ <!-- Controller js -->
+ <script src="app/fusion/scripts/controllers/rolefunctionpopupController.js"></script>
+ <script src="app/fusion/scripts/controllers/modelpopupController.js"></script>
+ <script src="app/fusionapp/drools/controller/droolsController.js"></script>
+ <script src="app/fusionapp/drools/controller/drools-list-controller.js"></script>
+ <script src="app/fusionapp/drools/controller/drools-view-controller.js"></script>
+ <!-- Header and Footer -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/header.css">
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/footer.css" >
+ <script src="app/fusion/scripts/directives/footer.js"></script>
+ <script src="app/fusion/external/ebz/js/footer.js"></script>
+ <script src="app/fusion/scripts/directives/header.js"></script>
+ <script src="app/fusion/scripts/directives/leftMenu.js"></script>
+ <script src="app/fusion/scripts/services/leftMenuService.js"></script>
+
+ <!-- Services -->
+ <script src="app/fusionapp/drools/services/droolsService.js"></script>
+ <script src="app/fusion/scripts/services/userInfoService.js"></script>
+ </head>
+ <body class="appBody" ng-app="abs">
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal.html'"></div>
+ <div q-header></div>
+ <div q-menu class="appLeftMenu"></div>
+ <div id="rightContentAdmin" ng-view style="min-height: 450px;margin-top:-50px;margin-left:210px;margin-right:10px;"></div>
+ <div q-footer class="appFooter"></div>
+ </body>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsView.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsView.html
new file mode 100644
index 00000000..dbe9121a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsView.html
@@ -0,0 +1,61 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div ng-controller="droolsViewController" class="modal__informative font-showcase">
+
+<h1 class="heading1" style="margin-top:20px;">Drools Rule Engine</h1>
+ <br>
+ Please enter below details:<br/>
+
+ <div class="fn-ebz-container">
+ Drools File:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postDroolsBean.droolsFile" value="" size="25">
+ </div>
+
+ <div class="fn-ebz-container">
+ Class Name:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postDroolsBean.className" value="" size="25">
+ </div>
+
+ <div class="fn-ebz-container">
+ Selected Rules:<br/>
+ <input class="fn-ebz-text" type="text" ng-model="postDroolsBean.selectedRules" value="" size="25">
+ </div>
+
+
+ <div>
+ <input att-button btn-type="primary" size="small" class="button" type="submit" value="Execute Rules" ng-click="execute(postDroolsBean);" />
+ </div>
+ <br>
+ {{resultsString}}
+ <br>
+ <br>
+ <br>
+ <br>
+ <br>
+ <br>
+ <br>
+ <br>
+ <br>
+
+
+
+
+</div>
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/external/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/external/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/external/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/fonts/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/fonts/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/fonts/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/images/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/images/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/images/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-controller.js
new file mode 100644
index 00000000..0ea98a9c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-controller.js
@@ -0,0 +1,80 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('samplePageController', function($scope, $http,ProfileService,modalService){
+ $scope.tableData=[];
+ $scope.viewPerPage=20;
+ $scope.scrollViewPerPage=2;
+ $scope.currentPage=1;
+ $scope.totalPage;
+ $scope.searchCategory;
+ $scope.searchString="";
+ $scope.currentPageNum=1;
+ ProfileService.getProfilePagination(1,$scope.viewPerPage).then(function(data){
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.tableData =JSON.parse($scope.data.profileList);
+ $scope.totalPages =JSON.parse($scope.data.totalPage);
+ for(x in $scope.tableData){
+ if($scope.tableData[x].active_yn=='Y')
+ $scope.tableData[x].active_yn=true;
+ else
+ $scope.tableData[x].active_yn=false;
+ }
+ //$scope.resetMenu();
+ },function(error){
+ console.log("failed");
+ reloadPageOnce();
+ });
+
+ $scope.$watch('currentPageNum', function(val) {
+
+ ProfileService.getProfilePagination(val,$scope.viewPerPage).then(function(data){
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.tableData =JSON.parse($scope.data.profileList);
+ $scope.totalPages =JSON.parse($scope.data.totalPage);
+ for(x in $scope.tableData){
+ if($scope.tableData[x].active_yn=='Y')
+ $scope.tableData[x].active_yn=true;
+ else
+ $scope.tableData[x].active_yn=false;
+ }
+ //$scope.resetMenu();
+ },function(error){
+ console.log("failed");
+ });
+
+ });
+
+ $scope.editRow = function(profileId){
+ window.location = 'userProfile#/profile/' + profileId;
+ }
+
+ $scope.toggleProfileActive = function(rowData) {
+ modalService.popupConfirmWinWithCancel("Confirm","You are about to change user's active status. Do you want to continue?",
+ function(){
+ $http.get("profile/toggleProfileActive?profile_id="+rowData.id).success(function(){});
+ },
+ function(){
+ rowData.active=!rowData.active;
+ })
+ };
+
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-iframe-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-iframe-controller.js
new file mode 100644
index 00000000..4ff99cb4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-iframe-controller.js
@@ -0,0 +1,23 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.controller('samplePageWithIframeController', function($scope, $http,ProfileService,modalService){
+
+
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sampleController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sampleController.js
new file mode 100644
index 00000000..3d3daf5f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sampleController.js
@@ -0,0 +1,30 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.config(function($routeProvider) {
+ $routeProvider
+ .when('/iframe', {
+ templateUrl: 'app/fusionapp/scripts/view-models/sampleWithIframe.html',
+ controller : "samplePageWithIframeController"
+ })
+ .otherwise({
+ templateUrl: 'app/fusionapp/scripts/view-models/sample.html',
+ controller : "samplePageController"
+ });
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/directives/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/directives/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/directives/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/utils/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/utils/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/utils/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sample.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sample.html
new file mode 100644
index 00000000..5b555aa4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sample.html
@@ -0,0 +1,60 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div ng-controller="samplePageController">
+
+ <h1 class="heading1" style="margin-top:10px;">Profile Search</h1>
+
+ <table att-table table-data="tableData" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header sortable="true" key="id">User ID</th>
+ <th att-table-header sortable="true" key="lastName">Last Name</th>
+ <th att-table-header sortable="true" key="firstName">First Name</th>
+ <th att-table-header sortable="true" key="email">Email</th>
+ <th att-table-header sortable="true" key="orgUserId">User ID</th>
+ <th att-table-header sortable="true" key="org_manager_userid">Manager User ID</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="rowData in tableData">
+ <tr>
+ <td att-table-body ng-bind="rowData['id']"></td>
+ <td att-table-body ng-bind="rowData['lastName']"></td>
+ <td att-table-body ng-bind="rowData['firstName']"></td>
+ <td att-table-body ng-bind="rowData['email']"></td>
+ <td att-table-body ng-bind="rowData['orgUserId']"></td>
+ <td att-table-body ng-bind="rowData['managerId']"></td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div class="fn-ebz-container">
+ Rows Per Page:
+ <input class="fn-ebz-text" readonly type="text" ng-model="viewPerPage" size="5" style="width: 47px;">
+ </div>
+ <div class="fn-ebz-container">
+ Current Page:
+ <input class="fn-ebz-text" type="text" ng-model="currentPageNum" size="5" style="width: 47px;">
+ </div>
+ <div class="fn-ebz-container">
+ Total Page(s):
+ <input class="fn-ebz-text" type="text" ng-model="totalPages" size="5" readonly="true" style="width: 47px;">
+ </div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sampleWithIframe.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sampleWithIframe.html
new file mode 100644
index 00000000..612e6a8c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sampleWithIframe.html
@@ -0,0 +1,22 @@
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+<div ng-controller="samplePageWithIframeController" style="margin-left: auto;margin-right: auto;height:700px;">
+ <iframe style="margin-top:5px;width:100%;height:100%" frameBorder="0" vspace="0" src="user_profile"></iframe>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/singlePageSample.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/singlePageSample.html
new file mode 100644
index 00000000..7bded9d6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/singlePageSample.html
@@ -0,0 +1,87 @@
+<!DOCTYPE html>
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<html>
+ <head>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta http-equiv="cache-control" content="max-age=0" />
+ <meta http-equiv="cache-control" content="no-cache" />
+ <meta http-equiv="expires" content="0" />
+ <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
+ <meta http-equiv="pragma" content="no-cache" />
+ <!-- CSS -->
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/fn-ebz.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/demo.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/base.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/btn.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/dtpk.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/frms.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/sldr.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/tbs.css" >
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/portal_ebz_header.css">
+ <link rel="stylesheet" type="text/css" href="static/fusion/css/jquery-ui.css">
+ <!-- Basic AngularJS -->
+ <script src= "app/fusion/external/ebz/angular_js/angular.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/angular-sanitize.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/angular-route.min.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/app.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/gestures.js"></script>
+ <script src= "app/fusion/external/ebz/sandbox/att-abs-tpls.js" type="text/javascript"></script>
+ <!-- jQuery -->
+ <script src="static/js/jquery-1.10.2.js"></script>
+ <script src="static/js/jquery.mask.min.js" type="text/javascript"></script>
+ <script src="static/js/jquery-ui.js" type="text/javascript"></script>
+ <!-- AngularJS Gridster -->
+ <script src="static/fusion/js/att_angular_gridster/ui-gridster-tpls.js"></script>
+ <script src="static/fusion/js/att_angular_gridster/angular-gridster.js"></script>
+ <!-- AngularJS Config -->
+ <script src= "app/fusion/external/ebz/angular_js/app.js"></script>
+ <script src= "app/fusion/external/ebz/angular_js/checklist-model.js"></script>
+ <!-- Utility -->
+ <script src="app/fusion/scripts/modalService.js"></script>
+ <!-- Controller js -->
+ <script src="app/fusion/scripts/controllers/rolefunctionpopupController.js"></script>
+ <script src="app/fusion/scripts/controllers/modelpopupController.js"></script>
+ <script src="app/fusionapp/scripts/controller/sampleController.js"></script>
+ <script src="app/fusionapp/scripts/controller/sample-page-controller.js"></script>
+ <script src="app/fusionapp/scripts/controller/sample-page-iframe-controller.js"></script>
+ <!-- Header and Footer -->
+
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/header.css">
+ <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/footer.css" >
+ <script src="app/fusion/scripts/directives/footer.js"></script>
+ <script src="app/fusion/external/ebz/js/footer.js"></script>
+ <script src="app/fusion/scripts/directives/header.js"></script>
+ <script src="app/fusion/scripts/directives/leftMenu.js"></script>
+ <!-- Services -->
+ <script src="app/fusion/scripts/services/profileService.js"></script>
+
+ </head>
+ <body class="appBody" ng-app="abs">
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html'"></div>
+ <div ng-include src="'app/fusion/scripts/view-models/profile-page/popup_modal.html'"></div>
+ <div q-header></div>
+ <div q-menu class="appLeftMenu"></div>
+ <div ng-view style="min-height: 450px;margin-top:-50px;margin-left:210px;margin-right:10px;"></div>
+ <div q-footer class="appFooter"></div>
+ </body>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/styles/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/styles/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/styles/dummy.txt
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/index.jsp b/ecomp-sdk/sdk-app/src/main/webapp/index.jsp
new file mode 100644
index 00000000..f6030c97
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/index.jsp
@@ -0,0 +1,24 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+<%-- Redirected because we can't set the welcome page to a virtual URL. --%>
+<%-- Forward to the intended start page to reduce frustration for new users. --%>
+<c:redirect url="/login.htm"></c:redirect>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/manifest.jsp b/ecomp-sdk/sdk-app/src/main/webapp/manifest.jsp
new file mode 100644
index 00000000..b7345adb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/manifest.jsp
@@ -0,0 +1,47 @@
+<%--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ --%>
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+ pageEncoding="UTF-8"%>
+<%
+ // Read contents of maven-generated manifest file.
+ final String path = "/META-INF/MANIFEST.MF";
+ java.io.InputStream input = getServletContext().getResourceAsStream(path);
+ java.io.InputStreamReader reader = new java.io.InputStreamReader(input, "UTF-8");
+ char [] buf = new char[1024];
+ int length = reader.read(buf, 0, buf.length);
+ final String manifest = new String(buf, 0, length);
+ reader.close();
+ input.close();
+%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Manifest</title>
+</head>
+<body>
+<h2>
+Contents of file <%= path %>:
+</h2>
+<pre>
+<%= manifest %>
+</pre>
+</body>
+</html>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/sandbox-gridster.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/sandbox-gridster.css
new file mode 100644
index 00000000..a9edba8f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/sandbox-gridster.css
@@ -0,0 +1,173 @@
+.gridster {
+ position: relative;
+ margin: auto;
+ /* height: 0
+ */}
+
+.gridster>ul {
+ margin: 0;
+ list-style: none;
+ padding: 0
+}
+
+.gridster-item {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ list-style: none;
+ z-index: 2;
+ position: absolute;
+ display: none
+}
+
+.gridster-loaded {
+ -webkit-transition: height .3s;
+ -moz-transition: height .3s;
+ -o-transition: height .3s;
+ transition: height .3s
+}
+
+.gridster-loaded .gridster-item {
+ display: block;
+ position: absolute;
+ -webkit-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
+ -moz-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
+ -o-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
+ transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
+ -webkit-transition-delay: 50ms;
+ -moz-transition-delay: 50ms;
+ -o-transition-delay: 50ms;
+ transition-delay: 50ms
+}
+
+.gridster-loaded .gridster-preview-holder {
+ display: none;
+ z-index: 1;
+ position: absolute;
+ background-color: #067ab4;
+ /*
+ background-color: rgb(6, 122, 180);
+ -ms-filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#067ab4', endColorstr='#067ab4'); IE
+ opacity: 0.2;
+ */
+ border-color: #fff;
+ -webkit-transition: width .2s, height .3s;
+ -moz-transition: width .2s, height .3s;
+ -o-transition: width .2s, height .3s;
+ transition: width .2s, height .3s;
+ -webkit-transition-delay: 50ms;
+ -moz-transition-delay: 50ms;
+ -o-transition-delay: 50ms;
+ transition-delay: 50ms
+}
+
+.gridster-loaded .gridster-item.gridster-item-moving {
+ -webkit-transition: none;
+ -moz-transition: none;
+ -o-transition: none;
+ transition: none;
+ opacity: 0.9;
+}
+
+.gridster-mobile {
+ height: auto !important
+}
+
+.gridster-mobile .gridster-item {
+ height: auto;
+ position: static;
+ float: none
+}
+
+.gridster-item.ng-leave.ng-leave-active {
+ opacity: 0
+}
+
+.gridster-item.ng-enter {
+ opacity: 1
+}
+
+.gridster-item-moving {
+ z-index: 3
+}
+
+.gridster-item-resizable-handler {
+ position: absolute;
+ font-size: 1px;
+ display: block
+}
+
+.handle-se {
+ cursor: se-resize;
+ width: 0;
+ height: 0;
+ right: 1px;
+ bottom: 1px;
+ border-style: solid;
+ border-width: 0 0 12px 12px;
+ border-color: transparent
+}
+
+.handle-ne {
+ cursor: ne-resize;
+ width: 12px;
+ height: 12px;
+ right: 1px;
+ top: 1px
+}
+
+.handle-nw {
+ cursor: nw-resize;
+ width: 12px;
+ height: 12px;
+ left: 1px;
+ top: 1px
+}
+
+.handle-sw {
+ cursor: sw-resize;
+ width: 12px;
+ height: 12px;
+ left: 1px;
+ bottom: 1px
+}
+
+.handle-e {
+ cursor: e-resize;
+ width: 12px;
+ bottom: 0;
+ right: 1px;
+ top: 0
+}
+
+.handle-s {
+ cursor: s-resize;
+ height: 12px;
+ right: 0;
+ bottom: 1px;
+ left: 0
+}
+
+.handle-n {
+ cursor: n-resize;
+ height: 12px;
+ right: 0;
+ top: 1px;
+ left: 0
+}
+
+.handle-w {
+ cursor: w-resize;
+ width: 12px;
+ left: 1px;
+ top: 0;
+ bottom: 0
+}
+
+.gridster .gridster-item:hover .gridster-box {
+ border: 1.5px solid #B3B2B3
+}
+
+.gridster .gridster-item:hover .handle-se {
+ border-color: transparent transparent #ccc
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/ui-gridster.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/ui-gridster.css
new file mode 100644
index 00000000..827e354e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/ui-gridster.css
@@ -0,0 +1,116 @@
+/* ui-gridster.css */
+.gridster-container {
+ background-color: #EFEFEF;
+ color: #fff;
+ border: 1px dashed;
+ overflow-y: auto;
+ overflow-x: hidden; }
+
+/* app css for attGridtser */
+.gridster-item-container {
+ background-color: #FFFFFF;
+ position: relative;
+ margin-left: auto;
+ margin-right: auto;
+ min-height: 79px;
+ height: 100%; }
+ .gridster-item-container .gridster-item-header {
+ /* gridster-item Header */
+ position: relative;
+ height: 50px !important;
+ border: 1px solid #d3d3d3;
+ border-bottom: 0;
+ background-color: #E5E5E5;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ z-index: 1;
+ -webkit-border-radius: 2px 2px 0 0;
+ -moz-border-radius: 2px 2px 0 0;
+ -ms-border-radius: 2px 2px 0 0;
+ -o-border-radius: 2px 2px 0 0;
+ border-radius: 2px 2px 0 0;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ overflow: hidden;
+ /* IE6-8 */ }
+ .gridster-item-container .gridster-item-header .gridster-item-handle {
+ cursor: move;
+ margin: 12px;
+ position: absolute;
+ top: 0;
+ left: 0;
+ border: 0;
+ vertical-align: middle;
+ -ms-interpolation-mode: bicubic;
+ display: block; }
+ .gridster-item-container .gridster-item-header .gridster-item-header-content {
+ line-height: 44px;
+ margin-left: 26px;
+ font-family: clearviewatt;
+ font-size: 18px;
+ color: #444444;
+ float: left; }
+ .gridster-item-container .gridster-item-header .gridster-item-sub-header-content {
+ position: absolute;
+ top: 29.5px;
+ left: 26px;
+ font-family: clearviewatt;
+ font-size: 12px;
+ color: #444444; }
+ .gridster-item-container .gridster-item-header .gridster-item-header-buttons-container {
+ position: absolute;
+ right: 10px;
+ top: 10px;
+ overflow: hidden;
+ text-align: right;
+ height: 30px;
+ color: #444444; }
+ .gridster-item-container .gridster-item-body {
+ /* gridster-item Body */
+ position: absolute;
+ width: 100%;
+ top: 50px;
+ left: 0;
+ right: 0;
+ bottom: 29px;
+ border: 1px solid #d3d3d3;
+ box-sizing: border-box;
+ overflow: auto;
+ color: #444444;
+ /* text-align: center; */ }
+ .gridster-item-container .gridster-item-footer {
+ /* gridster-item Footer */
+ position: absolute;
+ bottom: 0;
+ width: 100%;
+ height: 29px !important;
+ text-align: left;
+ cursor: pointer;
+ border: 1px solid #d3d3d3;
+ border-top: 0;
+ background-color: #F2F2F2;
+ -webkit-border-radius: 0 0 2px 2px;
+ -moz-border-radius: 0 0 2px 2px;
+ -ms-border-radius: 0 0 2px 2px;
+ -o-border-radius: 0 0 2px 2px;
+ border-radius: 0 0 2px 2px;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ text-decoration: none;
+ /* IE6-8 */ }
+ .gridster-item-container .gridster-item-footer:hover {
+ background-color: #E5E5E5;
+ color: #565656;
+ text-decoration: underline; }
+ .gridster-item-container .gridster-item-footer .gridster-item-footer-content {
+ line-height: 30px;
+ font-family: clearviewatt;
+ font-size: 12px;
+ color: #565656;
+ margin: 20px;
+ text-decoration: none; }
+ .gridster-item-container .gridster-item-footer .gridster-item-footer-content:hover {
+ color: #199ddf;
+ text-decoration: underline; }
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/fusion-sunny.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/fusion-sunny.css
new file mode 100644
index 00000000..c8306156
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/fusion-sunny.css
@@ -0,0 +1,362 @@
+ input, textarea, select, div {
+ font-family: Arial;
+ font-size: 11px;
+ font-weight: normal;
+ }
+
+ form {
+ margin-top: 5px;
+ }
+
+
+ .applicationWindow { border-width: 0px 0px 1px 0px;
+ border-style: solid;
+ border-color: #959595;
+ box-shadow: inset 0 0 10px #000000;
+ margin-top: 10px;
+ margin-bottom: 10px;
+ margin-left: 10px;
+ margin-right: 10px;
+ }
+
+ .feedbackMessage { width: 99%;
+ font-family: Arial;
+ font-size: 11px;
+ color: #1f1f1f;
+ padding: 3px;
+ border: 1px #eeb420 solid;
+ margin: 3px;
+ background: #fff9e5;
+ }
+
+ .menubar {
+ border-width: 0px 0px 0px 1px; border-style: solid; border-color: #959595;
+ }
+
+ .footer {
+ /*clear: both;*/
+ border-width: 0px 1px 0px 1px; border-style: solid; border-color: #959595;
+ font-family: Verdana,Arial,Helvetica, sans-serif;
+ font-size: 9px;
+ padding: 10px 10px 30px 10px;
+ background: white;
+ }
+
+ .pageTitle {
+ font-family: Arial;
+ font-size: 18px;
+ font-weight: bold;
+ margin-top: 5px;
+ }
+
+ .content {
+ border-width: 0px 1px 0px 1px;
+ border-style: solid;
+ border-color: #959595;
+ font-family: Arial;
+ font-size: 11px;
+ padding: 5px;
+ background: white;
+ /*height: 600px;*/
+ }
+
+ .popupContent {
+ font-family: Arial;
+ font-size: 11px;
+ padding: 3px;
+ }
+
+ .logo {
+ border-width: 0px 1px 0px 1px;
+ border-style: solid;
+ border-color: #959595;
+ text-align: right;
+ }
+
+ .sep {
+ border: 1px solid black
+ }
+
+ .attLogo { /*position: relative;*/
+ float:left;
+ padding-top: 25px;
+ padding-left: 25px;
+ }
+
+ .applicationLogo { float:right;
+ padding-top: 25px;
+ padding-right: 25px;
+ }
+
+ .applinkWhite { font-family: Arial;
+ font-size: 13px;
+ font-weight: 900;
+ color: #FFFFFF;
+ text-decoration: none; }
+
+ .terms { font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 9px;
+ }
+
+ .broadcastMessage { color: red; }
+ .broadcastMessageList { color: red; }
+
+ .button {
+ margin: 5px 1px 5px 1px;
+ padding: 3px; }
+
+ .toolbarbutton:hover {
+ color:#005491;
+ }
+
+ .headerText { font-family: Arial;
+ font-size: 15px;
+ font-weight: 700;
+ color: #000000; }
+
+ .headerBackground { background: #336699; }
+
+ .errorMessageText { font-family: Arial;
+ font-size: 11px;
+ font-weight: bold;
+ color: red; }
+
+
+ .normalText { font-family: Arial;
+ font-size: 11px;
+ color: #000000; }
+
+ .normalTextRed { font-family: Arial;
+ font-size: 11px;
+ color: red; }
+
+
+ .smallNormalText { font-family: Arial;
+ font-size: 9px;
+ color: #000000; }
+
+ .tableBorder { border:1px outset teal }
+
+ .validationError { background: #b9eaff; }
+
+ .templatebody {
+ background: url(../images/body_graphic.jpg) repeat-x;
+ /*margin: 40px 80px 40px 80px;*/
+ }
+
+ /*--------------------- General Content ------------------------------------*/
+
+ .relative {
+ position:relative;
+ }
+
+ .clear{
+ clear:both;
+ }
+
+ .left {
+ float: left;
+ }
+
+ .leftCentered{
+ float: left;
+ text-align: center;
+ }
+
+ .right {
+ float: right;
+ }
+
+ .rightAligned{
+ text-align: right;
+ }
+
+ .centered {
+ text-align: center;
+ align: center;
+ }
+
+
+ .noWrap{
+ white-space:nowrap;
+ }
+
+ .disabled {
+ color:gray;
+ cursor:hand;
+ }
+
+ /*--------------------- Tab styles -------------------------------------*/
+
+ .current {
+ font-weight: bold;
+ border-width: 1px 1px 1px 1px;
+ border-color: silver;
+ border-style: solid;
+ }
+
+ .subTab {
+ font-weight:bold;
+ font-family: Arial;
+ font-size: 11px;
+ color: #0F3B82;
+ }
+
+
+ /*--------------------- Grid styles ------------------------------------*/
+
+ /* Grid navigation and header styles */
+ .gridFilterLabel {font-size: 7pt;
+ font-align: justify;
+ font-weight: bold;
+ display: block;}
+
+ .gridFilterText {height: 17px;
+ font-size: 8pt;
+ width: 60%;
+ font-align: justify;}
+
+ .gridNavigationBar { font-family:Arial,Verdana;
+ font-size:11px;
+ font-weight:normal;
+ color:#000;
+ margin: 0px;
+ width: 100%;
+ vertical-align: middle;
+ }
+
+ .gridNavigationBar .navLinks { float: left;
+ margin-right:15px;
+ padding-top: 2px;
+ height: 19px;
+ line-height: 19px;
+ }
+
+ .gridNavigationBar .pageControls { float: left;
+ margin-right: 15px;
+ height: 19px;
+ line-height: 19px;
+ }
+
+ .gridNavigationBar .pageControls input { font-size: 8pt;
+ height: 17px;
+ vertical-align: middle;
+ }
+
+ .gridNavigationBar .pageInfo { float: right;
+ vertical-align: middle;
+ height: 19px;
+ line-height: 19px;
+ }
+
+ .gridNavigationBar .pageInfo input { font-size: 8pt;
+ height: 17px;
+ vertical-align: middle;
+ }
+
+
+ .gridNavigationBar span { padding: 3px; }
+
+ .gridNavigationBar a {
+ text-decoration:underline;
+ color:#000;
+ font-weight:normal;
+ }
+
+ .gridNavigationBar img { vertical-align: middle; }
+
+ .gridBulkUpdateRow {
+ height: 35px;
+ line-height: 35px;
+ }
+
+ .gridBulkUpdateRow input {
+ vertical-align: middle;
+ }
+
+
+ /* dummy class used to lock the form elements of a grid - ex. bulk transaction processing */
+ .alwaysEnabled {}
+
+ .hidden {
+ display: none;
+ }
+
+ .selectedPage {
+ background-color:#C4DFFB;
+ color: white;
+ border-style: solid;
+ border-width: 1px;
+ border-color: gray;
+ padding-left: 3px;
+ padding-right: 3px;
+ vertical-align: middle;
+ }
+
+ .selectedRow{
+ /*background-color:#C4DFFB;*/
+ }
+
+ /* Action Item styles */
+ .actionList {
+ margin-left: -20px;
+ margin-right: -10px;
+ padding-left: 5px;
+ }
+
+ .actionList li {
+ float:left;
+ padding-left: 3px;
+ padding-right: 3px;
+ }
+
+ .actionList li a {
+ text-decoration:none;
+ color:#000;
+ }
+
+ /* Filter Operator List styles */
+
+ .filterList {
+ margin: 0px;
+ }
+
+ .filterList li {
+ list-style-type: none;
+ padding:3px 3px 3px 2px;
+ cursor:hand;
+ font-size:11px;
+ }
+
+ .filterList li:hover {
+ background: #404040;
+ }
+
+ .filterList li a {
+ color: #000;
+ text-decoration: none;
+ }
+
+ .filterList li:hover a {
+ color: white;
+ }
+
+ .filterList li a:hover {
+ text-decoration: none;
+ color: white;
+ }
+
+ .filterListItem a {
+ text-decoration:none;
+ padding:3px 2px 3px 2px;
+ }
+
+
+ /*---------------------- Customized ZK Styles ------------------------------*/
+
+ .z-datebox input, .z-timebox input {
+ font-family: Arial;
+ font-size: 11px;
+ height: 15px;
+ margin-top:1px;
+ }
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/jquery-ui.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/jquery-ui.css
new file mode 100644
index 00000000..1c22746c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/jquery-ui.css
@@ -0,0 +1,1225 @@
+/*! jQuery UI - v1.11.4 - 2015-03-11
+* http://jqueryui.com
+* Includes: core.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, draggable.css, menu.css, progressbar.css, resizable.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
+* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden {
+ display: none;
+}
+.ui-helper-hidden-accessible {
+ border: 0;
+ clip: rect(0 0 0 0);
+ height: 1px;
+ margin: -1px;
+ overflow: hidden;
+ padding: 0;
+ position: absolute;
+ width: 1px;
+}
+.ui-helper-reset {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ outline: 0;
+ line-height: 1.3;
+ text-decoration: none;
+ font-size: 100%;
+ list-style: none;
+}
+.ui-helper-clearfix:before,
+.ui-helper-clearfix:after {
+ content: "";
+ display: table;
+ border-collapse: collapse;
+}
+.ui-helper-clearfix:after {
+ clear: both;
+}
+.ui-helper-clearfix {
+ min-height: 0; /* support: IE7 */
+}
+.ui-helper-zfix {
+ width: 100%;
+ height: 100%;
+ top: 0;
+ left: 0;
+ position: absolute;
+ opacity: 0;
+ filter:Alpha(Opacity=0); /* support: IE8 */
+}
+
+.ui-front {
+ z-index: 100;
+}
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled {
+ cursor: default !important;
+}
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon {
+ display: block;
+ text-indent: -99999px;
+ overflow: hidden;
+ background-repeat: no-repeat;
+}
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+.ui-accordion .ui-accordion-header {
+ display: block;
+ cursor: pointer;
+ position: relative;
+ margin: 2px 0 0 0;
+ padding: .5em .5em .5em .7em;
+ min-height: 0; /* support: IE7 */
+ font-size: 100%;
+}
+.ui-accordion .ui-accordion-icons {
+ padding-left: 2.2em;
+}
+.ui-accordion .ui-accordion-icons .ui-accordion-icons {
+ padding-left: 2.2em;
+}
+.ui-accordion .ui-accordion-header .ui-accordion-header-icon {
+ position: absolute;
+ left: .5em;
+ top: 50%;
+ margin-top: -8px;
+}
+.ui-accordion .ui-accordion-content {
+ padding: 1em 2.2em;
+ border-top: 0;
+ overflow: auto;
+}
+.ui-autocomplete {
+ position: absolute;
+ top: 0;
+ left: 0;
+ cursor: default;
+}
+.ui-button {
+ display: inline-block;
+ position: relative;
+ padding: 0;
+ line-height: normal;
+ margin-right: .1em;
+ cursor: pointer;
+ vertical-align: middle;
+ text-align: center;
+ overflow: visible; /* removes extra width in IE */
+}
+.ui-button,
+.ui-button:link,
+.ui-button:visited,
+.ui-button:hover,
+.ui-button:active {
+ text-decoration: none;
+}
+/* to make room for the icon, a width needs to be set here */
+.ui-button-icon-only {
+ width: 2.2em;
+}
+/* button elements seem to need a little more width */
+button.ui-button-icon-only {
+ width: 2.4em;
+}
+.ui-button-icons-only {
+ width: 3.4em;
+}
+button.ui-button-icons-only {
+ width: 3.7em;
+}
+
+/* button text element */
+.ui-button .ui-button-text {
+ display: block;
+ line-height: normal;
+}
+.ui-button-text-only .ui-button-text {
+ padding: .4em 1em;
+}
+.ui-button-icon-only .ui-button-text,
+.ui-button-icons-only .ui-button-text {
+ padding: .4em;
+ text-indent: -9999999px;
+}
+.ui-button-text-icon-primary .ui-button-text,
+.ui-button-text-icons .ui-button-text {
+ padding: .4em 1em .4em 2.1em;
+}
+.ui-button-text-icon-secondary .ui-button-text,
+.ui-button-text-icons .ui-button-text {
+ padding: .4em 2.1em .4em 1em;
+}
+.ui-button-text-icons .ui-button-text {
+ padding-left: 2.1em;
+ padding-right: 2.1em;
+}
+/* no icon support for input elements, provide padding by default */
+input.ui-button {
+ padding: .4em 1em;
+}
+
+/* button icon element(s) */
+.ui-button-icon-only .ui-icon,
+.ui-button-text-icon-primary .ui-icon,
+.ui-button-text-icon-secondary .ui-icon,
+.ui-button-text-icons .ui-icon,
+.ui-button-icons-only .ui-icon {
+ position: absolute;
+ top: 50%;
+ margin-top: -8px;
+}
+.ui-button-icon-only .ui-icon {
+ left: 50%;
+ margin-left: -8px;
+}
+.ui-button-text-icon-primary .ui-button-icon-primary,
+.ui-button-text-icons .ui-button-icon-primary,
+.ui-button-icons-only .ui-button-icon-primary {
+ left: .5em;
+}
+.ui-button-text-icon-secondary .ui-button-icon-secondary,
+.ui-button-text-icons .ui-button-icon-secondary,
+.ui-button-icons-only .ui-button-icon-secondary {
+ right: .5em;
+}
+
+/* button sets */
+.ui-buttonset {
+ margin-right: 7px;
+}
+.ui-buttonset .ui-button {
+ margin-left: 0;
+ margin-right: -.3em;
+}
+
+/* workarounds */
+/* reset extra padding in Firefox, see h5bp.com/l */
+input.ui-button::-moz-focus-inner,
+button.ui-button::-moz-focus-inner {
+ border: 0;
+ padding: 0;
+}
+.ui-datepicker {
+ width: 17em;
+ padding: .2em .2em 0;
+ display: none;
+}
+.ui-datepicker .ui-datepicker-header {
+ position: relative;
+ padding: .2em 0;
+}
+.ui-datepicker .ui-datepicker-prev,
+.ui-datepicker .ui-datepicker-next {
+ position: absolute;
+ top: 2px;
+ width: 1.8em;
+ height: 1.8em;
+}
+.ui-datepicker .ui-datepicker-prev-hover,
+.ui-datepicker .ui-datepicker-next-hover {
+ top: 1px;
+}
+.ui-datepicker .ui-datepicker-prev {
+ left: 2px;
+}
+.ui-datepicker .ui-datepicker-next {
+ right: 2px;
+}
+.ui-datepicker .ui-datepicker-prev-hover {
+ left: 1px;
+}
+.ui-datepicker .ui-datepicker-next-hover {
+ right: 1px;
+}
+.ui-datepicker .ui-datepicker-prev span,
+.ui-datepicker .ui-datepicker-next span {
+ display: block;
+ position: absolute;
+ left: 50%;
+ margin-left: -8px;
+ top: 50%;
+ margin-top: -8px;
+}
+.ui-datepicker .ui-datepicker-title {
+ margin: 0 2.3em;
+ line-height: 1.8em;
+ text-align: center;
+}
+.ui-datepicker .ui-datepicker-title select {
+ font-size: 1em;
+ margin: 1px 0;
+}
+.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-year {
+ width: 45%;
+}
+.ui-datepicker table {
+ width: 100%;
+ font-size: .9em;
+ border-collapse: collapse;
+ margin: 0 0 .4em;
+}
+.ui-datepicker th {
+ padding: .7em .3em;
+ text-align: center;
+ font-weight: bold;
+ border: 0;
+}
+.ui-datepicker td {
+ border: 0;
+ padding: 1px;
+}
+.ui-datepicker td span,
+.ui-datepicker td a {
+ display: block;
+ padding: .2em;
+ text-align: right;
+ text-decoration: none;
+}
+.ui-datepicker .ui-datepicker-buttonpane {
+ background-image: none;
+ margin: .7em 0 0 0;
+ padding: 0 .2em;
+ border-left: 0;
+ border-right: 0;
+ border-bottom: 0;
+}
+.ui-datepicker .ui-datepicker-buttonpane button {
+ float: right;
+ margin: .5em .2em .4em;
+ cursor: pointer;
+ padding: .2em .6em .3em .6em;
+ width: auto;
+ overflow: visible;
+}
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
+ float: left;
+}
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi {
+ width: auto;
+}
+.ui-datepicker-multi .ui-datepicker-group {
+ float: left;
+}
+.ui-datepicker-multi .ui-datepicker-group table {
+ width: 95%;
+ margin: 0 auto .4em;
+}
+.ui-datepicker-multi-2 .ui-datepicker-group {
+ width: 50%;
+}
+.ui-datepicker-multi-3 .ui-datepicker-group {
+ width: 33.3%;
+}
+.ui-datepicker-multi-4 .ui-datepicker-group {
+ width: 25%;
+}
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
+ border-left-width: 0;
+}
+.ui-datepicker-multi .ui-datepicker-buttonpane {
+ clear: left;
+}
+.ui-datepicker-row-break {
+ clear: both;
+ width: 100%;
+ font-size: 0;
+}
+
+/* RTL support */
+.ui-datepicker-rtl {
+ direction: rtl;
+}
+.ui-datepicker-rtl .ui-datepicker-prev {
+ right: 2px;
+ left: auto;
+}
+.ui-datepicker-rtl .ui-datepicker-next {
+ left: 2px;
+ right: auto;
+}
+.ui-datepicker-rtl .ui-datepicker-prev:hover {
+ right: 1px;
+ left: auto;
+}
+.ui-datepicker-rtl .ui-datepicker-next:hover {
+ left: 1px;
+ right: auto;
+}
+.ui-datepicker-rtl .ui-datepicker-buttonpane {
+ clear: right;
+}
+.ui-datepicker-rtl .ui-datepicker-buttonpane button {
+ float: left;
+}
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
+.ui-datepicker-rtl .ui-datepicker-group {
+ float: right;
+}
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
+ border-right-width: 0;
+ border-left-width: 1px;
+}
+.ui-dialog {
+ overflow: hidden;
+ position: absolute;
+ top: 0;
+ left: 0;
+ padding: .2em;
+ outline: 0;
+}
+.ui-dialog .ui-dialog-titlebar {
+ padding: .4em 1em;
+ position: relative;
+}
+.ui-dialog .ui-dialog-title {
+ float: left;
+ margin: .1em 0;
+ white-space: nowrap;
+ width: 90%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.ui-dialog .ui-dialog-titlebar-close {
+ position: absolute;
+ right: .3em;
+ top: 50%;
+ width: 20px;
+ margin: -10px 0 0 0;
+ padding: 1px;
+ height: 20px;
+}
+.ui-dialog .ui-dialog-content {
+ position: relative;
+ border: 0;
+ padding: .5em 1em;
+ background: none;
+ overflow: auto;
+}
+.ui-dialog .ui-dialog-buttonpane {
+ text-align: left;
+ border-width: 1px 0 0 0;
+ background-image: none;
+ margin-top: .5em;
+ padding: .3em 1em .5em .4em;
+}
+.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
+ float: right;
+}
+.ui-dialog .ui-dialog-buttonpane button {
+ margin: .5em .4em .5em 0;
+ cursor: pointer;
+}
+.ui-dialog .ui-resizable-se {
+ width: 12px;
+ height: 12px;
+ right: -5px;
+ bottom: -5px;
+ background-position: 16px 16px;
+}
+.ui-draggable .ui-dialog-titlebar {
+ cursor: move;
+}
+.ui-draggable-handle {
+ -ms-touch-action: none;
+ touch-action: none;
+}
+.ui-menu {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ display: block;
+ outline: none;
+}
+.ui-menu .ui-menu {
+ position: absolute;
+}
+.ui-menu .ui-menu-item {
+ position: relative;
+ margin: 0;
+ padding: 3px 1em 3px .4em;
+ cursor: pointer;
+ min-height: 0; /* support: IE7 */
+ /* support: IE10, see #8844 */
+ list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");
+}
+.ui-menu .ui-menu-divider {
+ margin: 5px 0;
+ height: 0;
+ font-size: 0;
+ line-height: 0;
+ border-width: 1px 0 0 0;
+}
+.ui-menu .ui-state-focus,
+.ui-menu .ui-state-active {
+ margin: -1px;
+}
+
+/* icon support */
+.ui-menu-icons {
+ position: relative;
+}
+.ui-menu-icons .ui-menu-item {
+ padding-left: 2em;
+}
+
+/* left-aligned */
+.ui-menu .ui-icon {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: .2em;
+ margin: auto 0;
+}
+
+/* right-aligned */
+.ui-menu .ui-menu-icon {
+ left: auto;
+ right: 0;
+}
+.ui-progressbar {
+ height: 2em;
+ text-align: left;
+ overflow: hidden;
+}
+.ui-progressbar .ui-progressbar-value {
+ margin: -1px;
+ height: 100%;
+}
+.ui-progressbar .ui-progressbar-overlay {
+ background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");
+ height: 100%;
+ filter: alpha(opacity=25); /* support: IE8 */
+ opacity: 0.25;
+}
+.ui-progressbar-indeterminate .ui-progressbar-value {
+ background-image: none;
+}
+.ui-resizable {
+ position: relative;
+}
+.ui-resizable-handle {
+ position: absolute;
+ font-size: 0.1px;
+ display: block;
+ -ms-touch-action: none;
+ touch-action: none;
+}
+.ui-resizable-disabled .ui-resizable-handle,
+.ui-resizable-autohide .ui-resizable-handle {
+ display: none;
+}
+.ui-resizable-n {
+ cursor: n-resize;
+ height: 7px;
+ width: 100%;
+ top: -5px;
+ left: 0;
+}
+.ui-resizable-s {
+ cursor: s-resize;
+ height: 7px;
+ width: 100%;
+ bottom: -5px;
+ left: 0;
+}
+.ui-resizable-e {
+ cursor: e-resize;
+ width: 7px;
+ right: -5px;
+ top: 0;
+ height: 100%;
+}
+.ui-resizable-w {
+ cursor: w-resize;
+ width: 7px;
+ left: -5px;
+ top: 0;
+ height: 100%;
+}
+.ui-resizable-se {
+ cursor: se-resize;
+ width: 12px;
+ height: 12px;
+ right: 1px;
+ bottom: 1px;
+}
+.ui-resizable-sw {
+ cursor: sw-resize;
+ width: 9px;
+ height: 9px;
+ left: -5px;
+ bottom: -5px;
+}
+.ui-resizable-nw {
+ cursor: nw-resize;
+ width: 9px;
+ height: 9px;
+ left: -5px;
+ top: -5px;
+}
+.ui-resizable-ne {
+ cursor: ne-resize;
+ width: 9px;
+ height: 9px;
+ right: -5px;
+ top: -5px;
+}
+.ui-selectable {
+ -ms-touch-action: none;
+ touch-action: none;
+}
+.ui-selectable-helper {
+ position: absolute;
+ z-index: 100;
+ border: 1px dotted black;
+}
+.ui-selectmenu-menu {
+ padding: 0;
+ margin: 0;
+ position: absolute;
+ top: 0;
+ left: 0;
+ display: none;
+}
+.ui-selectmenu-menu .ui-menu {
+ overflow: auto;
+ /* Support: IE7 */
+ overflow-x: hidden;
+ padding-bottom: 1px;
+}
+.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup {
+ font-size: 1em;
+ font-weight: bold;
+ line-height: 1.5;
+ padding: 2px 0.4em;
+ margin: 0.5em 0 0 0;
+ height: auto;
+ border: 0;
+}
+.ui-selectmenu-open {
+ display: block;
+}
+.ui-selectmenu-button {
+ display: inline-block;
+ overflow: hidden;
+ position: relative;
+ text-decoration: none;
+ cursor: pointer;
+}
+.ui-selectmenu-button span.ui-icon {
+ right: 0.5em;
+ left: auto;
+ margin-top: -8px;
+ position: absolute;
+ top: 50%;
+}
+.ui-selectmenu-button span.ui-selectmenu-text {
+ text-align: left;
+ padding: 0.4em 2.1em 0.4em 1em;
+ display: block;
+ line-height: 1.4;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.ui-slider {
+ position: relative;
+ text-align: left;
+}
+.ui-slider .ui-slider-handle {
+ position: absolute;
+ z-index: 2;
+ width: 1.2em;
+ height: 1.2em;
+ cursor: default;
+ -ms-touch-action: none;
+ touch-action: none;
+}
+.ui-slider .ui-slider-range {
+ position: absolute;
+ z-index: 1;
+ font-size: .7em;
+ display: block;
+ border: 0;
+ background-position: 0 0;
+}
+
+/* support: IE8 - See #6727 */
+.ui-slider.ui-state-disabled .ui-slider-handle,
+.ui-slider.ui-state-disabled .ui-slider-range {
+ filter: inherit;
+}
+
+.ui-slider-horizontal {
+ height: .8em;
+}
+.ui-slider-horizontal .ui-slider-handle {
+ top: -.3em;
+ margin-left: -.6em;
+}
+.ui-slider-horizontal .ui-slider-range {
+ top: 0;
+ height: 100%;
+}
+.ui-slider-horizontal .ui-slider-range-min {
+ left: 0;
+}
+.ui-slider-horizontal .ui-slider-range-max {
+ right: 0;
+}
+
+.ui-slider-vertical {
+ width: .8em;
+ height: 100px;
+}
+.ui-slider-vertical .ui-slider-handle {
+ left: -.3em;
+ margin-left: 0;
+ margin-bottom: -.6em;
+}
+.ui-slider-vertical .ui-slider-range {
+ left: 0;
+ width: 100%;
+}
+.ui-slider-vertical .ui-slider-range-min {
+ bottom: 0;
+}
+.ui-slider-vertical .ui-slider-range-max {
+ top: 0;
+}
+.ui-sortable-handle {
+ -ms-touch-action: none;
+ touch-action: none;
+}
+.ui-spinner {
+ position: relative;
+ display: inline-block;
+ overflow: hidden;
+ padding: 0;
+ vertical-align: middle;
+}
+.ui-spinner-input {
+ border: none;
+ background: none;
+ color: inherit;
+ padding: 0;
+ margin: .2em 0;
+ vertical-align: middle;
+ margin-left: .4em;
+ margin-right: 22px;
+}
+.ui-spinner-button {
+ width: 16px;
+ height: 50%;
+ font-size: .5em;
+ padding: 0;
+ margin: 0;
+ text-align: center;
+ position: absolute;
+ cursor: default;
+ display: block;
+ overflow: hidden;
+ right: 0;
+}
+/* more specificity required here to override default borders */
+.ui-spinner a.ui-spinner-button {
+ border-top: none;
+ border-bottom: none;
+ border-right: none;
+}
+/* vertically center icon */
+.ui-spinner .ui-icon {
+ position: absolute;
+ margin-top: -8px;
+ top: 50%;
+ left: 0;
+}
+.ui-spinner-up {
+ top: 0;
+}
+.ui-spinner-down {
+ bottom: 0;
+}
+
+/* TR overrides */
+.ui-spinner .ui-icon-triangle-1-s {
+ /* need to fix icons sprite */
+ background-position: -65px -16px;
+}
+.ui-tabs {
+ position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+ padding: .2em;
+}
+.ui-tabs .ui-tabs-nav {
+ margin: 0;
+ padding: .2em .2em 0;
+}
+.ui-tabs .ui-tabs-nav li {
+ list-style: none;
+ float: left;
+ position: relative;
+ top: 0;
+ margin: 1px .2em 0 0;
+ border-bottom-width: 0;
+ padding: 0;
+ white-space: nowrap;
+}
+.ui-tabs .ui-tabs-nav .ui-tabs-anchor {
+ float: left;
+ padding: .5em 1em;
+ text-decoration: none;
+}
+.ui-tabs .ui-tabs-nav li.ui-tabs-active {
+ margin-bottom: -1px;
+ padding-bottom: 1px;
+}
+.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,
+.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,
+.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor {
+ cursor: text;
+}
+.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor {
+ cursor: pointer;
+}
+.ui-tabs .ui-tabs-panel {
+ display: block;
+ border-width: 0;
+ padding: 1em 1.4em;
+ background: none;
+}
+.ui-tooltip {
+ padding: 8px;
+ position: absolute;
+ z-index: 9999;
+ max-width: 300px;
+ -webkit-box-shadow: 0 0 5px #aaa;
+ box-shadow: 0 0 5px #aaa;
+}
+body .ui-tooltip {
+ border-width: 2px;
+}
+
+/* Component containers
+----------------------------------*/
+.ui-widget {
+ font-family: Verdana,Arial,sans-serif;
+ font-size: 1.1em;
+}
+.ui-widget .ui-widget {
+ font-size: 1em;
+}
+.ui-widget input,
+.ui-widget select,
+.ui-widget textarea,
+.ui-widget button {
+ font-family: Verdana,Arial,sans-serif;
+ font-size: 1em;
+}
+.ui-widget-content {
+ border: 1px solid #aaaaaa;
+ background: #ffffff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x;
+ color: #222222;
+}
+.ui-widget-content a {
+ color: #222222;
+}
+.ui-widget-header {
+ border: 1px solid #aaaaaa;
+ background: #cccccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x;
+ color: #222222;
+ font-weight: bold;
+}
+.ui-widget-header a {
+ color: #222222;
+}
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default,
+.ui-widget-content .ui-state-default,
+.ui-widget-header .ui-state-default {
+ border: 1px solid #d3d3d3;
+ background: #e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x;
+ font-weight: normal;
+ color: #555555;
+}
+.ui-state-default a,
+.ui-state-default a:link,
+.ui-state-default a:visited {
+ color: #555555;
+ text-decoration: none;
+}
+.ui-state-hover,
+.ui-widget-content .ui-state-hover,
+.ui-widget-header .ui-state-hover,
+.ui-state-focus,
+.ui-widget-content .ui-state-focus,
+.ui-widget-header .ui-state-focus {
+ border: 1px solid #999999;
+ background: #dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x;
+ font-weight: normal;
+ color: #212121;
+}
+.ui-state-hover a,
+.ui-state-hover a:hover,
+.ui-state-hover a:link,
+.ui-state-hover a:visited,
+.ui-state-focus a,
+.ui-state-focus a:hover,
+.ui-state-focus a:link,
+.ui-state-focus a:visited {
+ color: #212121;
+ text-decoration: none;
+}
+.ui-state-active,
+.ui-widget-content .ui-state-active,
+.ui-widget-header .ui-state-active {
+ border: 1px solid #aaaaaa;
+ background: #ffffff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;
+ font-weight: normal;
+ color: #212121;
+}
+.ui-state-active a,
+.ui-state-active a:link,
+.ui-state-active a:visited {
+ color: #212121;
+ text-decoration: none;
+}
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight,
+.ui-widget-content .ui-state-highlight,
+.ui-widget-header .ui-state-highlight {
+ border: 1px solid #fcefa1;
+ background: #fbf9ee url("images/ui-bg_glass_55_fbf9ee_1x400.png") 50% 50% repeat-x;
+ color: #363636;
+}
+.ui-state-highlight a,
+.ui-widget-content .ui-state-highlight a,
+.ui-widget-header .ui-state-highlight a {
+ color: #363636;
+}
+.ui-state-error,
+.ui-widget-content .ui-state-error,
+.ui-widget-header .ui-state-error {
+ border: 1px solid #cd0a0a;
+ background: #fef1ec url("images/ui-bg_glass_95_fef1ec_1x400.png") 50% 50% repeat-x;
+ color: #cd0a0a;
+}
+.ui-state-error a,
+.ui-widget-content .ui-state-error a,
+.ui-widget-header .ui-state-error a {
+ color: #cd0a0a;
+}
+.ui-state-error-text,
+.ui-widget-content .ui-state-error-text,
+.ui-widget-header .ui-state-error-text {
+ color: #cd0a0a;
+}
+.ui-priority-primary,
+.ui-widget-content .ui-priority-primary,
+.ui-widget-header .ui-priority-primary {
+ font-weight: bold;
+}
+.ui-priority-secondary,
+.ui-widget-content .ui-priority-secondary,
+.ui-widget-header .ui-priority-secondary {
+ opacity: .7;
+ filter:Alpha(Opacity=70); /* support: IE8 */
+ font-weight: normal;
+}
+.ui-state-disabled,
+.ui-widget-content .ui-state-disabled,
+.ui-widget-header .ui-state-disabled {
+ opacity: .35;
+ filter:Alpha(Opacity=35); /* support: IE8 */
+ background-image: none;
+}
+.ui-state-disabled .ui-icon {
+ filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
+}
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon {
+ width: 16px;
+ height: 16px;
+}
+.ui-icon,
+.ui-widget-content .ui-icon {
+ background-image: url("images/ui-icons_222222_256x240.png");
+}
+.ui-widget-header .ui-icon {
+ background-image: url("images/ui-icons_222222_256x240.png");
+}
+.ui-state-default .ui-icon {
+ background-image: url("images/ui-icons_888888_256x240.png");
+}
+.ui-state-hover .ui-icon,
+.ui-state-focus .ui-icon {
+ background-image: url("images/ui-icons_454545_256x240.png");
+}
+.ui-state-active .ui-icon {
+ background-image: url("images/ui-icons_454545_256x240.png");
+}
+.ui-state-highlight .ui-icon {
+ background-image: url("images/ui-icons_2e83ff_256x240.png");
+}
+.ui-state-error .ui-icon,
+.ui-state-error-text .ui-icon {
+ background-image: url("images/ui-icons_cd0a0a_256x240.png");
+}
+
+/* positioning */
+.ui-icon-blank { background-position: 16px 16px; }
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-on { background-position: -96px -144px; }
+.ui-icon-radio-off { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-all,
+.ui-corner-top,
+.ui-corner-left,
+.ui-corner-tl {
+ border-top-left-radius: 4px;
+}
+.ui-corner-all,
+.ui-corner-top,
+.ui-corner-right,
+.ui-corner-tr {
+ border-top-right-radius: 4px;
+}
+.ui-corner-all,
+.ui-corner-bottom,
+.ui-corner-left,
+.ui-corner-bl {
+ border-bottom-left-radius: 4px;
+}
+.ui-corner-all,
+.ui-corner-bottom,
+.ui-corner-right,
+.ui-corner-br {
+ border-bottom-right-radius: 4px;
+}
+
+/* Overlays */
+.ui-widget-overlay {
+ background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;
+ opacity: .3;
+ filter: Alpha(Opacity=30); /* support: IE8 */
+}
+.ui-widget-shadow {
+ margin: -8px 0 0 -8px;
+ padding: 8px;
+ background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;
+ opacity: .3;
+ filter: Alpha(Opacity=30); /* support: IE8 */
+ border-radius: 8px;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/layout/layout-default-latest.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/layout/layout-default-latest.css
new file mode 100644
index 00000000..aa382de3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/layout/layout-default-latest.css
@@ -0,0 +1,224 @@
+/*
+ * Default Layout Theme
+ *
+ * Created for jquery.layout
+ *
+ * Copyright (c) 2010
+ * Fabrizio Balliano (http://www.fabrizioballiano.net)
+ * Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * Last Updated: 2010-02-10
+ * NOTE: For best code readability, view this with a fixed-space font and tabs equal to 4-chars
+ */
+
+/*
+ * DEFAULT FONT
+ * Just to make demo-pages look better - not actually relevant to Layout!
+ */
+body {
+ font-family: Geneva, Arial, Helvetica, sans-serif;
+ font-size: 100%;
+ *font-size: 80%;
+}
+
+/*
+ * PANES & CONTENT-DIVs
+ */
+.ui-layout-pane { /* all 'panes' */
+ background: #FFF;
+ border: 1px solid #BBB;
+ padding: 10px;
+ overflow: auto;
+ /* DO NOT add scrolling (or padding) to 'panes' that have a content-div,
+ otherwise you may get double-scrollbars - on the pane AND on the content-div
+ - use ui-layout-wrapper class if pane has a content-div
+ - use ui-layout-container if pane has an inner-layout
+ */
+ }
+ /* (scrolling) content-div inside pane allows for fixed header(s) and/or footer(s) */
+ .ui-layout-content {
+ padding: 10px;
+ position: relative; /* contain floated or positioned elements */
+ overflow: auto; /* add scrolling to content-div */
+ }
+
+/*
+ * UTILITY CLASSES
+ * Must come AFTER pane-class above so will override
+ * These classes are NOT auto-generated and are NOT used by Layout
+ */
+.layout-child-container,
+.layout-content-container {
+ padding: 0;
+ overflow: hidden;
+}
+.layout-child-container {
+ border: 0; /* remove border because inner-layout-panes probably have borders */
+}
+.layout-scroll {
+ overflow: auto;
+}
+.layout-hide {
+ display: none;
+}
+
+/*
+ * RESIZER-BARS
+ */
+.ui-layout-resizer { /* all 'resizer-bars' */
+ background: #DDD;
+ border: 1px solid #BBB;
+ border-width: 0;
+ }
+ .ui-layout-resizer-drag { /* REAL resizer while resize in progress */
+ }
+ .ui-layout-resizer-hover { /* affects both open and closed states */
+ }
+ /* NOTE: It looks best when 'hover' and 'dragging' are set to the same color,
+ otherwise color shifts while dragging when bar can't keep up with mouse */
+ .ui-layout-resizer-open-hover , /* hover-color to 'resize' */
+ .ui-layout-resizer-dragging { /* resizer beging 'dragging' */
+ background: #C4E1A4;
+ }
+ .ui-layout-resizer-dragging { /* CLONED resizer being dragged */
+ border: 1px solid #BBB;
+ }
+ .ui-layout-resizer-north-dragging,
+ .ui-layout-resizer-south-dragging {
+ border-width: 1px 0;
+ }
+ .ui-layout-resizer-west-dragging,
+ .ui-layout-resizer-east-dragging {
+ border-width: 0 1px;
+ }
+ /* NOTE: Add a 'dragging-limit' color to provide visual feedback when resizer hits min/max size limits */
+ .ui-layout-resizer-dragging-limit { /* CLONED resizer at min or max size-limit */
+ background: #E1A4A4; /* red */
+ }
+
+ .ui-layout-resizer-closed-hover { /* hover-color to 'slide open' */
+ background: #EBD5AA;
+ }
+ .ui-layout-resizer-sliding { /* resizer when pane is 'slid open' */
+ opacity: .10; /* show only a slight shadow */
+ filter: alpha(opacity=10);
+ }
+ .ui-layout-resizer-sliding-hover { /* sliding resizer - hover */
+ opacity: 1.00; /* on-hover, show the resizer-bar normally */
+ filter: alpha(opacity=100);
+ }
+ /* sliding resizer - add 'outside-border' to resizer on-hover
+ * this sample illustrates how to target specific panes and states */
+ .ui-layout-resizer-north-sliding-hover { border-bottom-width: 1px; }
+ .ui-layout-resizer-south-sliding-hover { border-top-width: 1px; }
+ .ui-layout-resizer-west-sliding-hover { border-right-width: 1px; }
+ .ui-layout-resizer-east-sliding-hover { border-left-width: 1px; }
+
+/*
+ * TOGGLER-BUTTONS
+ */
+.ui-layout-toggler {
+ border: 1px solid #BBB; /* match pane-border */
+ background-color: #BBB;
+ }
+ .ui-layout-resizer-hover .ui-layout-toggler {
+ opacity: .60;
+ filter: alpha(opacity=60);
+ }
+ .ui-layout-toggler-hover , /* need when NOT resizable */
+ .ui-layout-resizer-hover .ui-layout-toggler-hover { /* need specificity when IS resizable */
+ background-color: #FC6;
+ opacity: 1.00;
+ filter: alpha(opacity=100);
+ }
+ .ui-layout-toggler-north ,
+ .ui-layout-toggler-south {
+ border-width: 0 1px; /* left/right borders */
+ }
+ .ui-layout-toggler-west ,
+ .ui-layout-toggler-east {
+ border-width: 1px 0; /* top/bottom borders */
+ }
+ /* hide the toggler-button when the pane is 'slid open' */
+ .ui-layout-resizer-sliding .ui-layout-toggler {
+ display: none;
+ }
+ /*
+ * style the text we put INSIDE the togglers
+ */
+ .ui-layout-toggler .content {
+ color: #666;
+ font-size: 12px;
+ font-weight: bold;
+ width: 100%;
+ padding-bottom: 0.35ex; /* to 'vertically center' text inside text-span */
+ }
+
+/*
+ * PANE-MASKS
+ * these styles are hard-coded on mask elems, but are also
+ * included here as !important to ensure will overrides any generic styles
+ */
+.ui-layout-mask {
+ border: none !important;
+ padding: 0 !important;
+ margin: 0 !important;
+ overflow: hidden !important;
+ position: absolute !important;
+ opacity: 0 !important;
+ filter: Alpha(Opacity="0") !important;
+}
+.ui-layout-mask-inside-pane { /* masks always inside pane EXCEPT when pane is an iframe */
+ top: 0 !important;
+ left: 0 !important;
+ width: 100% !important;
+ height: 100% !important;
+}
+div.ui-layout-mask {} /* standard mask for iframes */
+iframe.ui-layout-mask {} /* extra mask for objects/applets */
+
+/*
+ * Default printing styles
+ */
+@media print {
+ /*
+ * Unless you want to print the layout as it appears onscreen,
+ * these html/body styles are needed to allow the content to 'flow'
+ */
+ html {
+ height: auto !important;
+ overflow: visible !important;
+ }
+ body.ui-layout-container {
+ position: static !important;
+ top: auto !important;
+ bottom: auto !important;
+ left: auto !important;
+ right: auto !important;
+ /* only IE6 has container width & height set by Layout */
+ _width: auto !important;
+ _height: auto !important;
+ }
+ .ui-layout-resizer, .ui-layout-toggler {
+ display: none !important;
+ }
+ /*
+ * Default pane print styles disables positioning, borders and backgrounds.
+ * You can modify these styles however it suit your needs.
+ */
+ .ui-layout-pane {
+ border: none !important;
+ background: transparent !important;
+ position: relative !important;
+ top: auto !important;
+ bottom: auto !important;
+ left: auto !important;
+ right: auto !important;
+ width: auto !important;
+ height: auto !important;
+ overflow: visible !important;
+ }
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/css/nv.d3.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/css/nv.d3.css
new file mode 100644
index 00000000..28ccd053
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/css/nv.d3.css
@@ -0,0 +1,656 @@
+
+/********************
+ * HTML CSS
+ */
+
+
+.chartWrap {
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+}
+
+
+/********************
+ * TOOLTIP CSS
+ */
+
+.nvtooltip {
+ position: absolute;
+ background-color: rgba(255,255,255,1);
+ padding: 10px;
+ border: 1px solid #ddd;
+ z-index: 10000;
+
+ font-family: Arial;
+ font-size: 13px;
+
+ transition: opacity 500ms linear;
+ -moz-transition: opacity 500ms linear;
+ -webkit-transition: opacity 500ms linear;
+
+ transition-delay: 500ms;
+ -moz-transition-delay: 500ms;
+ -webkit-transition-delay: 500ms;
+
+ -moz-box-shadow: 4px 4px 8px rgba(0,0,0,.5);
+ -webkit-box-shadow: 4px 4px 8px rgba(0,0,0,.5);
+ box-shadow: 4px 4px 8px rgba(0,0,0,.5);
+
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+
+ pointer-events: none;
+
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+.nvtooltip h3 {
+ margin: 0;
+ padding: 0;
+ text-align: center;
+}
+
+.nvtooltip p {
+ margin: 0;
+ padding: 0;
+ text-align: center;
+}
+
+.nvtooltip span {
+ display: inline-block;
+ margin: 2px 0;
+}
+
+.nvtooltip-pending-removal {
+ position: absolute;
+ pointer-events: none;
+}
+
+
+/********************
+ * SVG CSS
+ */
+
+
+svg {
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ /* Trying to get SVG to act like a greedy block in all browsers */
+ display: block;
+ width:100%;
+ height:100%;
+}
+
+
+svg text {
+ font: normal 12px Arial;
+}
+
+svg .title {
+ font: bold 14px Arial;
+}
+
+.nvd3 .nv-background {
+ fill: white;
+ fill-opacity: 0;
+ /*
+ pointer-events: none;
+ */
+}
+
+.nvd3.nv-noData {
+ font-size: 18px;
+ font-weight: bolf;
+}
+
+
+/**********
+* Brush
+*/
+
+.nv-brush .extent {
+ fill-opacity: .125;
+ shape-rendering: crispEdges;
+}
+
+
+
+/**********
+* Legend
+*/
+
+.nvd3 .nv-legend .nv-series {
+ cursor: pointer;
+}
+
+.nvd3 .nv-legend .disabled circle {
+ fill-opacity: 0;
+}
+
+
+
+/**********
+* Axes
+*/
+
+.nvd3 .nv-axis path {
+ fill: none;
+ stroke: #000;
+ stroke-opacity: .75;
+ shape-rendering: crispEdges;
+}
+
+.nvd3 .nv-axis path.domain {
+ stroke-opacity: .75;
+}
+
+.nvd3 .nv-axis.nv-x path.domain {
+ stroke-opacity: 0;
+}
+
+.nvd3 .nv-axis line {
+ fill: none;
+ stroke: #000;
+ stroke-opacity: .25;
+ shape-rendering: crispEdges;
+}
+
+.nvd3 .nv-axis line.zero {
+ stroke-opacity: .75;
+}
+
+.nvd3 .nv-axis .nv-axisMaxMin text {
+ font-weight: bold;
+}
+
+.nvd3 .x .nv-axis .nv-axisMaxMin text,
+.nvd3 .x2 .nv-axis .nv-axisMaxMin text,
+.nvd3 .x3 .nv-axis .nv-axisMaxMin text {
+ text-anchor: middle
+}
+
+
+
+/**********
+* Brush
+*/
+
+.nv-brush .resize path {
+ fill: #eee;
+ stroke: #666;
+}
+
+
+
+/**********
+* Bars
+*/
+
+.nvd3 .nv-bars .negative rect {
+ zfill: brown;
+}
+
+.nvd3 .nv-bars rect {
+ zfill: steelblue;
+ fill-opacity: .75;
+
+ transition: fill-opacity 250ms linear;
+ -moz-transition: fill-opacity 250ms linear;
+ -webkit-transition: fill-opacity 250ms linear;
+}
+
+.nvd3 .nv-bars rect:hover {
+ fill-opacity: 1;
+}
+
+.nvd3 .nv-bars .hover rect {
+ fill: lightblue;
+}
+
+.nvd3 .nv-bars text {
+ fill: rgba(0,0,0,0);
+}
+
+.nvd3 .nv-bars .hover text {
+ fill: rgba(0,0,0,1);
+}
+
+
+/**********
+* Bars
+*/
+
+.nvd3 .nv-multibar .nv-groups rect,
+.nvd3 .nv-multibarHorizontal .nv-groups rect,
+.nvd3 .nv-discretebar .nv-groups rect {
+ stroke-opacity: 0;
+
+ transition: fill-opacity 250ms linear;
+ -moz-transition: fill-opacity 250ms linear;
+ -webkit-transition: fill-opacity 250ms linear;
+}
+
+.nvd3 .nv-multibar .nv-groups rect:hover,
+.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,
+.nvd3 .nv-discretebar .nv-groups rect:hover {
+ fill-opacity: 1;
+}
+
+.nvd3 .nv-discretebar .nv-groups text,
+.nvd3 .nv-multibarHorizontal .nv-groups text {
+ font-weight: bold;
+ fill: rgba(0,0,0,1);
+ stroke: rgba(0,0,0,0);
+}
+
+/***********
+* Pie Chart
+*/
+
+.nvd3.nv-pie path {
+ stroke-opacity: 0;
+
+ transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
+ -moz-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
+ -webkit-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
+
+}
+
+.nvd3.nv-pie .nv-slice text {
+ stroke: #000;
+ stroke-width: 0;
+}
+
+.nvd3.nv-pie path {
+ stroke: #fff;
+ stroke-width: 1px;
+ stroke-opacity: 1;
+}
+
+.nvd3.nv-pie .hover path {
+ fill-opacity: .7;
+/*
+ stroke-width: 6px;
+ stroke-opacity: 1;
+*/
+}
+
+.nvd3.nv-pie .nv-label rect {
+ fill-opacity: 0;
+ stroke-opacity: 0;
+}
+
+/**********
+* Lines
+*/
+
+.nvd3 .nv-groups path.nv-line {
+ fill: none;
+ stroke-width: 2.5px;
+ /*
+ stroke-linecap: round;
+ shape-rendering: geometricPrecision;
+
+ transition: stroke-width 250ms linear;
+ -moz-transition: stroke-width 250ms linear;
+ -webkit-transition: stroke-width 250ms linear;
+
+ transition-delay: 250ms
+ -moz-transition-delay: 250ms;
+ -webkit-transition-delay: 250ms;
+ */
+}
+
+.nvd3 .nv-groups path.nv-area {
+ stroke: none;
+ /*
+ stroke-linecap: round;
+ shape-rendering: geometricPrecision;
+
+ stroke-width: 2.5px;
+ transition: stroke-width 250ms linear;
+ -moz-transition: stroke-width 250ms linear;
+ -webkit-transition: stroke-width 250ms linear;
+
+ transition-delay: 250ms
+ -moz-transition-delay: 250ms;
+ -webkit-transition-delay: 250ms;
+ */
+}
+
+.nvd3 .nv-line.hover path {
+ stroke-width: 6px;
+}
+
+/*
+.nvd3.scatter .groups .point {
+ fill-opacity: 0.1;
+ stroke-opacity: 0.1;
+}
+ */
+
+.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point {
+ fill-opacity: 0;
+ stroke-opacity: 0;
+}
+
+.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point {
+ fill-opacity: .5 !important;
+ stroke-opacity: .5 !important;
+}
+
+
+.nvd3 .nv-groups .nv-point {
+ transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
+ -moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
+ -webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
+}
+
+.nvd3.nv-scatter .nv-groups .nv-point.hover,
+.nvd3 .nv-groups .nv-point.hover {
+ stroke-width: 20px;
+ fill-opacity: .5 !important;
+ stroke-opacity: .5 !important;
+}
+
+
+.nvd3 .nv-point-paths path {
+ stroke: #aaa;
+ stroke-opacity: 0;
+ fill: #eee;
+ fill-opacity: 0;
+}
+
+
+
+.nvd3 .nv-indexLine {
+ cursor: ew-resize;
+}
+
+
+/**********
+* Distribution
+*/
+
+.nvd3 .nv-distribution {
+ pointer-events: none;
+}
+
+
+
+/**********
+* Scatter
+*/
+
+/* **Attempting to remove this for useVoronoi(false), need to see if it's required anywhere
+.nvd3 .nv-groups .nv-point {
+ pointer-events: none;
+}
+*/
+
+.nvd3 .nv-groups .nv-point.hover {
+ stroke-width: 20px;
+ stroke-opacity: .5;
+}
+
+.nvd3 .nv-scatter .nv-point.hover {
+ fill-opacity: 1;
+}
+
+/*
+.nv-group.hover .nv-point {
+ fill-opacity: 1;
+}
+*/
+
+
+/**********
+* Stacked Area
+*/
+
+.nvd3.nv-stackedarea path.nv-area {
+ fill-opacity: .7;
+ /*
+ stroke-opacity: .65;
+ fill-opacity: 1;
+ */
+ stroke-opacity: 0;
+
+ transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
+ -moz-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
+ -webkit-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
+
+ /*
+ transition-delay: 500ms;
+ -moz-transition-delay: 500ms;
+ -webkit-transition-delay: 500ms;
+ */
+
+}
+
+.nvd3.nv-stackedarea path.nv-area.hover {
+ fill-opacity: .9;
+ /*
+ stroke-opacity: .85;
+ */
+}
+/*
+.d3stackedarea .groups path {
+ stroke-opacity: 0;
+}
+ */
+
+
+
+.nvd3.nv-stackedarea .nv-groups .nv-point {
+ stroke-opacity: 0;
+ fill-opacity: 0;
+}
+
+.nvd3.nv-stackedarea .nv-groups .nv-point.hover {
+ stroke-width: 20px;
+ stroke-opacity: .75;
+ fill-opacity: 1;
+}
+
+
+
+/**********
+* Line Plus Bar
+*/
+
+.nvd3.nv-linePlusBar .nv-bar rect {
+ fill-opacity: .75;
+}
+
+.nvd3.nv-linePlusBar .nv-bar rect:hover {
+ fill-opacity: 1;
+}
+
+
+/**********
+* Bullet
+*/
+
+.nvd3.nv-bullet { font: 10px sans-serif; }
+.nvd3.nv-bullet .nv-measure { fill-opacity: .8; }
+.nvd3.nv-bullet .nv-measure:hover { fill-opacity: 1; }
+.nvd3.nv-bullet .nv-marker { stroke: #000; stroke-width: 2px; }
+.nvd3.nv-bullet .nv-markerTriangle { stroke: #000; fill: #fff; stroke-width: 1.5px; }
+.nvd3.nv-bullet .nv-tick line { stroke: #666; stroke-width: .5px; }
+.nvd3.nv-bullet .nv-range.nv-s0 { fill: #eee; }
+.nvd3.nv-bullet .nv-range.nv-s1 { fill: #ddd; }
+.nvd3.nv-bullet .nv-range.nv-s2 { fill: #ccc; }
+.nvd3.nv-bullet .nv-title { font-size: 14px; font-weight: bold; }
+.nvd3.nv-bullet .nv-subtitle { fill: #999; }
+
+
+.nvd3.nv-bullet .nv-range {
+ fill: #999;
+ fill-opacity: .4;
+}
+.nvd3.nv-bullet .nv-range:hover {
+ fill-opacity: .7;
+}
+
+
+
+/**********
+* Sparkline
+*/
+
+.nvd3.nv-sparkline path {
+ fill: none;
+}
+
+.nvd3.nv-sparklineplus g.nv-hoverValue {
+ pointer-events: none;
+}
+
+.nvd3.nv-sparklineplus .nv-hoverValue line {
+ stroke: #333;
+ stroke-width: 1.5px;
+ }
+
+.nvd3.nv-sparklineplus,
+.nvd3.nv-sparklineplus g {
+ pointer-events: all;
+}
+
+.nvd3 .nv-hoverArea {
+ fill-opacity: 0;
+ stroke-opacity: 0;
+}
+
+.nvd3.nv-sparklineplus .nv-xValue,
+.nvd3.nv-sparklineplus .nv-yValue {
+ /*
+ stroke: #666;
+ */
+ stroke-width: 0;
+ font-size: .9em;
+ font-weight: normal;
+}
+
+.nvd3.nv-sparklineplus .nv-yValue {
+ stroke: #f66;
+}
+
+.nvd3.nv-sparklineplus .nv-maxValue {
+ stroke: #2ca02c;
+ fill: #2ca02c;
+}
+
+.nvd3.nv-sparklineplus .nv-minValue {
+ stroke: #d62728;
+ fill: #d62728;
+}
+
+.nvd3.nv-sparklineplus .nv-currentValue {
+ /*
+ stroke: #444;
+ fill: #000;
+ */
+ font-weight: bold;
+ font-size: 1.1em;
+}
+
+/**********
+* historical stock
+*/
+
+.nvd3.nv-ohlcBar .nv-ticks .nv-tick {
+ stroke-width: 2px;
+}
+
+.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover {
+ stroke-width: 4px;
+}
+
+.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive {
+ stroke: #2ca02c;
+}
+
+.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative {
+ stroke: #d62728;
+}
+
+.nvd3.nv-historicalStockChart .nv-axis .nv-axislabel {
+ font-weight: bold;
+}
+
+.nvd3.nv-historicalStockChart .nv-dragTarget {
+ fill-opacity: 0;
+ stroke: none;
+ cursor: move;
+}
+
+.nvd3 .nv-brush .extent {
+ /*
+ cursor: ew-resize !important;
+ */
+ fill-opacity: 0 !important;
+}
+
+.nvd3 .nv-brushBackground rect {
+ stroke: #000;
+ stroke-width: .4;
+ fill: #fff;
+ fill-opacity: .7;
+}
+
+
+
+/**********
+* Indented Tree
+*/
+
+
+/**
+ * TODO: the following 3 selectors are based on classes used in the example. I should either make them standard and leave them here, or move to a CSS file not included in the library
+ */
+.nvd3.nv-indentedtree .name {
+ margin-left: 5px;
+}
+
+.nvd3.nv-indentedtree .clickable {
+ color: #08C;
+ cursor: pointer;
+}
+
+.nvd3.nv-indentedtree span.clickable:hover {
+ color: #005580;
+ text-decoration: underline;
+}
+
+
+.nvd3.nv-indentedtree .nv-childrenCount {
+ display: inline-block;
+ margin-left: 5px;
+}
+
+.nvd3.nv-indentedtree .nv-treeicon {
+ cursor: pointer;
+ /*
+ cursor: n-resize;
+ */
+}
+
+.nvd3.nv-indentedtree .nv-treeicon.nv-folded {
+ cursor: pointer;
+ /*
+ cursor: s-resize;
+ */
+}
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/cie.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/cie.js
new file mode 100644
index 00000000..45f01329
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/cie.js
@@ -0,0 +1,155 @@
+(function(d3) {
+ var cie = d3.cie = {};
+
+ cie.lab = function(l, a, b) {
+ return arguments.length === 1
+ ? (l instanceof Lab ? lab(l.l, l.a, l.b)
+ : (l instanceof Lch ? lch_lab(l.l, l.c, l.h)
+ : rgb_lab((l = d3.rgb(l)).r, l.g, l.b)))
+ : lab(+l, +a, +b);
+ };
+
+ cie.lch = function(l, c, h) {
+ return arguments.length === 1
+ ? (l instanceof Lch ? lch(l.l, l.c, l.h)
+ : (l instanceof Lab ? lab_lch(l.l, l.a, l.b)
+ : lab_lch((l = rgb_lab((l = d3.rgb(l)).r, l.g, l.b)).l, l.a, l.b)))
+ : lch(+l, +c, +h);
+ };
+
+ cie.interpolateLab = function(a, b) {
+ a = cie.lab(a);
+ b = cie.lab(b);
+ var al = a.l,
+ aa = a.a,
+ ab = a.b,
+ bl = b.l - al,
+ ba = b.a - aa,
+ bb = b.b - ab;
+ return function(t) {
+ return lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
+ };
+ };
+
+ cie.interpolateLch = function(a, b) {
+ a = cie.lch(a);
+ b = cie.lch(b);
+ var al = a.l,
+ ac = a.c,
+ ah = a.h,
+ bl = b.l - al,
+ bc = b.c - ac,
+ bh = b.h - ah;
+ if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; // shortest path
+ return function(t) {
+ return lch_lab(al + bl * t, ac + bc * t, ah + bh * t) + "";
+ };
+ };
+
+ function lab(l, a, b) {
+ return new Lab(l, a, b);
+ }
+
+ function Lab(l, a, b) {
+ this.l = l;
+ this.a = a;
+ this.b = b;
+ }
+
+ Lab.prototype.brighter = function(k) {
+ return lab(Math.min(100, this.l + K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+
+ Lab.prototype.darker = function(k) {
+ return lab(Math.max(0, this.l - K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+
+ Lab.prototype.rgb = function() {
+ return lab_rgb(this.l, this.a, this.b);
+ };
+
+ Lab.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+
+ function lch(l, c, h) {
+ return new Lch(l, c, h);
+ }
+
+ function Lch(l, c, h) {
+ this.l = l;
+ this.c = c;
+ this.h = h;
+ }
+
+ Lch.prototype.brighter = function(k) {
+ return lch(Math.min(100, this.l + K * (arguments.length ? k : 1)), this.c, this.h);
+ };
+
+ Lch.prototype.darker = function(k) {
+ return lch(Math.max(0, this.l - K * (arguments.length ? k : 1)), this.c, this.h);
+ };
+
+ Lch.prototype.rgb = function() {
+ return lch_lab(this.l, this.c, this.h).rgb();
+ };
+
+ Lch.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+
+ // Corresponds roughly to RGB brighter/darker
+ var K = 18;
+
+ // D65 standard referent
+ var X = 0.950470, Y = 1, Z = 1.088830;
+
+ function lab_rgb(l, a, b) {
+ var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
+ x = lab_xyz(x) * X;
+ y = lab_xyz(y) * Y;
+ z = lab_xyz(z) * Z;
+ return d3.rgb(
+ xyz_rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z),
+ xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
+ xyz_rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z)
+ );
+ }
+
+ function rgb_lab(r, g, b) {
+ r = rgb_xyz(r);
+ g = rgb_xyz(g);
+ b = rgb_xyz(b);
+ var x = xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / X),
+ y = xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / Y),
+ z = xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / Z);
+ return lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
+ }
+
+ function lab_lch(l, a, b) {
+ var c = Math.sqrt(a * a + b * b),
+ h = Math.atan2(b, a) / Math.PI * 180;
+ return lch(l, c, h);
+ }
+
+ function lch_lab(l, c, h) {
+ h = h * Math.PI / 180;
+ return lab(l, Math.cos(h) * c, Math.sin(h) * c);
+ }
+
+ function lab_xyz(x) {
+ return x > 0.206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
+ }
+
+ function xyz_lab(x) {
+ return x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
+ }
+
+ function xyz_rgb(r) {
+ return Math.round(255 * (r <= 0.00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055));
+ }
+
+ function rgb_xyz(r) {
+ return (r /= 255) <= 0.04045 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4);
+ }
+})(d3);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/colorbrewer.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/colorbrewer.js
new file mode 100644
index 00000000..2295527b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/colorbrewer.js
@@ -0,0 +1,302 @@
+// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).
+var colorbrewer = {YlGn: {
+3: ["#f7fcb9","#addd8e","#31a354"],
+4: ["#ffffcc","#c2e699","#78c679","#238443"],
+5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"],
+6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],
+7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
+8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
+9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]
+},YlGnBu: {
+3: ["#edf8b1","#7fcdbb","#2c7fb8"],
+4: ["#ffffcc","#a1dab4","#41b6c4","#225ea8"],
+5: ["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],
+6: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],
+7: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],
+8: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],
+9: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]
+},GnBu: {
+3: ["#e0f3db","#a8ddb5","#43a2ca"],
+4: ["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],
+5: ["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],
+6: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],
+7: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],
+8: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],
+9: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]
+},BuGn: {
+3: ["#e5f5f9","#99d8c9","#2ca25f"],
+4: ["#edf8fb","#b2e2e2","#66c2a4","#238b45"],
+5: ["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],
+6: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],
+7: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],
+8: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],
+9: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]
+},PuBuGn: {
+3: ["#ece2f0","#a6bddb","#1c9099"],
+4: ["#f6eff7","#bdc9e1","#67a9cf","#02818a"],
+5: ["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],
+6: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],
+7: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],
+8: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],
+9: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]
+},PuBu: {
+3: ["#ece7f2","#a6bddb","#2b8cbe"],
+4: ["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],
+5: ["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],
+6: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],
+7: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],
+8: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],
+9: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]
+},BuPu: {
+3: ["#e0ecf4","#9ebcda","#8856a7"],
+4: ["#edf8fb","#b3cde3","#8c96c6","#88419d"],
+5: ["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],
+6: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],
+7: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],
+8: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],
+9: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]
+},RdPu: {
+3: ["#fde0dd","#fa9fb5","#c51b8a"],
+4: ["#feebe2","#fbb4b9","#f768a1","#ae017e"],
+5: ["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],
+6: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],
+7: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],
+8: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],
+9: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]
+},PuRd: {
+3: ["#e7e1ef","#c994c7","#dd1c77"],
+4: ["#f1eef6","#d7b5d8","#df65b0","#ce1256"],
+5: ["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],
+6: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],
+7: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],
+8: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],
+9: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]
+},OrRd: {
+3: ["#fee8c8","#fdbb84","#e34a33"],
+4: ["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],
+5: ["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],
+6: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],
+7: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],
+8: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],
+9: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]
+},YlOrRd: {
+3: ["#ffeda0","#feb24c","#f03b20"],
+4: ["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],
+5: ["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],
+6: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],
+7: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],
+8: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],
+9: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]
+},YlOrBr: {
+3: ["#fff7bc","#fec44f","#d95f0e"],
+4: ["#ffffd4","#fed98e","#fe9929","#cc4c02"],
+5: ["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],
+6: ["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],
+7: ["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],
+8: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],
+9: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]
+},Purples: {
+3: ["#efedf5","#bcbddc","#756bb1"],
+4: ["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],
+5: ["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],
+6: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],
+7: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],
+8: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],
+9: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]
+},Blues: {
+3: ["#deebf7","#9ecae1","#3182bd"],
+4: ["#eff3ff","#bdd7e7","#6baed6","#2171b5"],
+5: ["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],
+6: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],
+7: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],
+8: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],
+9: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]
+},Greens: {
+3: ["#e5f5e0","#a1d99b","#31a354"],
+4: ["#edf8e9","#bae4b3","#74c476","#238b45"],
+5: ["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],
+6: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],
+7: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],
+8: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],
+9: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]
+},Oranges: {
+3: ["#fee6ce","#fdae6b","#e6550d"],
+4: ["#feedde","#fdbe85","#fd8d3c","#d94701"],
+5: ["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],
+6: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],
+7: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],
+8: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],
+9: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]
+},Reds: {
+3: ["#fee0d2","#fc9272","#de2d26"],
+4: ["#fee5d9","#fcae91","#fb6a4a","#cb181d"],
+5: ["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],
+6: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],
+7: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],
+8: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],
+9: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]
+},Greys: {
+3: ["#f0f0f0","#bdbdbd","#636363"],
+4: ["#f7f7f7","#cccccc","#969696","#525252"],
+5: ["#f7f7f7","#cccccc","#969696","#636363","#252525"],
+6: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],
+7: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],
+8: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],
+9: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]
+},PuOr: {
+3: ["#f1a340","#f7f7f7","#998ec3"],
+4: ["#e66101","#fdb863","#b2abd2","#5e3c99"],
+5: ["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],
+6: ["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],
+7: ["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],
+8: ["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],
+9: ["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],
+10: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],
+11: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]
+},BrBG: {
+3: ["#d8b365","#f5f5f5","#5ab4ac"],
+4: ["#a6611a","#dfc27d","#80cdc1","#018571"],
+5: ["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],
+6: ["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],
+7: ["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],
+8: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],
+9: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],
+10: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],
+11: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]
+},PRGn: {
+3: ["#af8dc3","#f7f7f7","#7fbf7b"],
+4: ["#7b3294","#c2a5cf","#a6dba0","#008837"],
+5: ["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],
+6: ["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],
+7: ["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],
+8: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],
+9: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],
+10: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],
+11: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]
+},PiYG: {
+3: ["#e9a3c9","#f7f7f7","#a1d76a"],
+4: ["#d01c8b","#f1b6da","#b8e186","#4dac26"],
+5: ["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],
+6: ["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],
+7: ["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],
+8: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],
+9: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],
+10: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],
+11: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]
+},RdBu: {
+3: ["#ef8a62","#f7f7f7","#67a9cf"],
+4: ["#ca0020","#f4a582","#92c5de","#0571b0"],
+5: ["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],
+6: ["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],
+7: ["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],
+8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],
+9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],
+10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],
+11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]
+},RdGy: {
+3: ["#ef8a62","#ffffff","#999999"],
+4: ["#ca0020","#f4a582","#bababa","#404040"],
+5: ["#ca0020","#f4a582","#ffffff","#bababa","#404040"],
+6: ["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],
+7: ["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],
+8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],
+9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],
+10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],
+11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]
+},RdYlBu: {
+3: ["#fc8d59","#ffffbf","#91bfdb"],
+4: ["#d7191c","#fdae61","#abd9e9","#2c7bb6"],
+5: ["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],
+6: ["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],
+7: ["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],
+8: ["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],
+9: ["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],
+10: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],
+11: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]
+},Spectral: {
+3: ["#fc8d59","#ffffbf","#99d594"],
+4: ["#d7191c","#fdae61","#abdda4","#2b83ba"],
+5: ["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],
+6: ["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],
+7: ["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],
+8: ["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],
+9: ["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],
+10: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],
+11: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]
+},RdYlGn: {
+3: ["#fc8d59","#ffffbf","#91cf60"],
+4: ["#d7191c","#fdae61","#a6d96a","#1a9641"],
+5: ["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],
+6: ["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],
+7: ["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],
+8: ["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],
+9: ["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],
+10: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],
+11: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]
+},Accent: {
+3: ["#7fc97f","#beaed4","#fdc086"],
+4: ["#7fc97f","#beaed4","#fdc086","#ffff99"],
+5: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],
+6: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],
+7: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],
+8: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]
+},Dark2: {
+3: ["#1b9e77","#d95f02","#7570b3"],
+4: ["#1b9e77","#d95f02","#7570b3","#e7298a"],
+5: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],
+6: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],
+7: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],
+8: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]
+},Paired: {
+3: ["#a6cee3","#1f78b4","#b2df8a"],
+4: ["#a6cee3","#1f78b4","#b2df8a","#33a02c"],
+5: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],
+6: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],
+7: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],
+8: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],
+9: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],
+10: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],
+11: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],
+12: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]
+},Pastel1: {
+3: ["#fbb4ae","#b3cde3","#ccebc5"],
+4: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],
+5: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],
+6: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],
+7: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],
+8: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],
+9: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]
+},Pastel2: {
+3: ["#b3e2cd","#fdcdac","#cbd5e8"],
+4: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],
+5: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],
+6: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],
+7: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],
+8: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]
+},Set1: {
+3: ["#e41a1c","#377eb8","#4daf4a"],
+4: ["#e41a1c","#377eb8","#4daf4a","#984ea3"],
+5: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],
+6: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],
+7: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],
+8: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],
+9: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]
+},Set2: {
+3: ["#66c2a5","#fc8d62","#8da0cb"],
+4: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],
+5: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],
+6: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],
+7: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],
+8: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"]
+},Set3: {
+3: ["#8dd3c7","#ffffb3","#bebada"],
+4: ["#8dd3c7","#ffffb3","#bebada","#fb8072"],
+5: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],
+6: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],
+7: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],
+8: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],
+9: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],
+10: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],
+11: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],
+12: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]
+}};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js
new file mode 100644
index 00000000..912de8d8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js
@@ -0,0 +1,122 @@
+
+var nv = window.nv || {};
+
+
+nv.version = '1.1.13b';
+nv.dev = true //set false when in production
+
+window.nv = nv;
+
+nv.tooltip = {}; // For the tooltip system
+nv.utils = nv.utils || {}; // Utility subsystem
+nv.models = {}; //stores all the possible models/components
+nv.charts = {}; //stores all the ready to use charts
+nv.graphs = []; //stores all the graphs currently on the page
+nv.logs = {}; //stores some statistics and potential error messages
+
+nv.dispatch = d3.dispatch('render_start', 'render_end');
+
+// *************************************************************************
+// Development render timers - disabled if dev = false
+
+if (nv.dev) {
+ nv.dispatch.on('render_start', function(e) {
+ nv.logs.startTime = +new Date();
+ });
+
+ nv.dispatch.on('render_end', function(e) {
+ nv.logs.endTime = +new Date();
+ nv.logs.totalTime = nv.logs.endTime - nv.logs.startTime;
+ nv.log('total', nv.logs.totalTime); // used for development, to keep track of graph generation times
+ });
+}
+
+// ********************************************
+// Public Core NV functions
+
+// Logs all arguments, and returns the last so you can test things in place
+// Note: in IE8 console.log is an object not a function, and if modernizr is used
+// then calling Function.prototype.bind with with anything other than a function
+// causes a TypeError to be thrown.
+nv.log = function() {
+ if (nv.dev && console.log && console.log.apply)
+ console.log.apply(console, arguments)
+ else if (nv.dev && typeof console.log == "function" && Function.prototype.bind) {
+ var log = Function.prototype.bind.call(console.log, console);
+ log.apply(console, arguments);
+ }
+ return arguments[arguments.length - 1];
+};
+
+
+nv.render = function render(step) {
+ step = step || 1; // number of graphs to generate in each timeout loop
+
+ nv.render.active = true;
+ nv.dispatch.render_start();
+
+ setTimeout(function() {
+ var chart, graph;
+
+ for (var i = 0; i < step && (graph = nv.render.queue[i]); i++) {
+ chart = graph.generate();
+ if (typeof graph.callback == typeof(Function)) graph.callback(chart);
+ nv.graphs.push(chart);
+ }
+
+ nv.render.queue.splice(0, i);
+
+ if (nv.render.queue.length) setTimeout(arguments.callee, 0);
+ else { nv.render.active = false; nv.dispatch.render_end(); }
+ }, 0);
+};
+
+nv.render.active = false;
+nv.render.queue = [];
+
+nv.addGraph = function(obj) {
+ if (typeof arguments[0] === typeof(Function))
+ obj = {generate: arguments[0], callback: arguments[1]};
+
+ nv.render.queue.push(obj);
+
+ if (!nv.render.active) nv.render();
+};
+
+nv.identity = function(d) { return d; };
+
+nv.strip = function(s) { return s.replace(/(\s|&)/g,''); };
+
+function daysInMonth(month,year) {
+ return (new Date(year, month+1, 0)).getDate();
+}
+
+function d3_time_range(floor, step, number) {
+ return function(t0, t1, dt) {
+ var time = floor(t0), times = [];
+ if (time < t0) step(time);
+ if (dt > 1) {
+ while (time < t1) {
+ var date = new Date(+time);
+ if ((number(date) % dt === 0)) times.push(date);
+ step(time);
+ }
+ } else {
+ while (time < t1) { times.push(new Date(+time)); step(time); }
+ }
+ return times;
+ };
+}
+
+d3.time.monthEnd = function(date) {
+ return new Date(date.getFullYear(), date.getMonth(), 0);
+};
+
+d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) {
+ date.setUTCDate(date.getUTCDate() + 1);
+ date.setDate(daysInMonth(date.getMonth() + 1, date.getFullYear()));
+ }, function(date) {
+ return date.getMonth();
+ }
+);
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.js
new file mode 100644
index 00000000..1aaabca2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.js
@@ -0,0 +1,1180 @@
+(function(exports){
+crossfilter.version = "1.0.3";
+function crossfilter_identity(d) {
+ return d;
+}
+crossfilter.permute = permute;
+
+function permute(array, index) {
+ for (var i = 0, n = index.length, copy = new Array(n); i < n; ++i) {
+ copy[i] = array[index[i]];
+ }
+ return copy;
+}
+var bisect = crossfilter.bisect = bisect_by(crossfilter_identity);
+
+bisect.by = bisect_by;
+
+function bisect_by(f) {
+
+ // Locate the insertion point for x in a to maintain sorted order. The
+ // arguments lo and hi may be used to specify a subset of the array which
+ // should be considered; by default the entire array is used. If x is already
+ // present in a, the insertion point will be before (to the left of) any
+ // existing entries. The return value is suitable for use as the first
+ // argument to `array.splice` assuming that a is already sorted.
+ //
+ // The returned insertion point i partitions the array a into two halves so
+ // that all v < x for v in a[lo:i] for the left side and all v >= x for v in
+ // a[i:hi] for the right side.
+ function bisectLeft(a, x, lo, hi) {
+ while (lo < hi) {
+ var mid = lo + hi >> 1;
+ if (f(a[mid]) < x) lo = mid + 1;
+ else hi = mid;
+ }
+ return lo;
+ }
+
+ // Similar to bisectLeft, but returns an insertion point which comes after (to
+ // the right of) any existing entries of x in a.
+ //
+ // The returned insertion point i partitions the array into two halves so that
+ // all v <= x for v in a[lo:i] for the left side and all v > x for v in
+ // a[i:hi] for the right side.
+ function bisectRight(a, x, lo, hi) {
+ while (lo < hi) {
+ var mid = lo + hi >> 1;
+ if (x < f(a[mid])) hi = mid;
+ else lo = mid + 1;
+ }
+ return lo;
+ }
+
+ bisectRight.right = bisectRight;
+ bisectRight.left = bisectLeft;
+ return bisectRight;
+}
+var heap = crossfilter.heap = heap_by(crossfilter_identity);
+
+heap.by = heap_by;
+
+function heap_by(f) {
+
+ // Builds a binary heap within the specified array a[lo:hi]. The heap has the
+ // property such that the parent a[lo+i] is always less than or equal to its
+ // two children: a[lo+2*i+1] and a[lo+2*i+2].
+ function heap(a, lo, hi) {
+ var n = hi - lo,
+ i = (n >>> 1) + 1;
+ while (--i > 0) sift(a, i, n, lo);
+ return a;
+ }
+
+ // Sorts the specified array a[lo:hi] in descending order, assuming it is
+ // already a heap.
+ function sort(a, lo, hi) {
+ var n = hi - lo,
+ t;
+ while (--n > 0) t = a[lo], a[lo] = a[lo + n], a[lo + n] = t, sift(a, 1, n, lo);
+ return a;
+ }
+
+ // Sifts the element a[lo+i-1] down the heap, where the heap is the contiguous
+ // slice of array a[lo:lo+n]. This method can also be used to update the heap
+ // incrementally, without incurring the full cost of reconstructing the heap.
+ function sift(a, i, n, lo) {
+ var d = a[--lo + i],
+ x = f(d),
+ child;
+ while ((child = i << 1) <= n) {
+ if (child < n && f(a[lo + child]) > f(a[lo + child + 1])) child++;
+ if (x <= f(a[lo + child])) break;
+ a[lo + i] = a[lo + child];
+ i = child;
+ }
+ a[lo + i] = d;
+ }
+
+ heap.sort = sort;
+ return heap;
+}
+var heapselect = crossfilter.heapselect = heapselect_by(crossfilter_identity);
+
+heapselect.by = heapselect_by;
+
+function heapselect_by(f) {
+ var heap = heap_by(f);
+
+ // Returns a new array containing the top k elements in the array a[lo:hi].
+ // The returned array is not sorted, but maintains the heap property. If k is
+ // greater than hi - lo, then fewer than k elements will be returned. The
+ // order of elements in a is unchanged by this operation.
+ function heapselect(a, lo, hi, k) {
+ var queue = new Array(k = Math.min(hi - lo, k)),
+ min,
+ i,
+ x,
+ d;
+
+ for (i = 0; i < k; ++i) queue[i] = a[lo++];
+ heap(queue, 0, k);
+
+ if (lo < hi) {
+ min = f(queue[0]);
+ do {
+ if (x = f(d = a[lo]) > min) {
+ queue[0] = d;
+ min = f(heap(queue, 0, k)[0]);
+ }
+ } while (++lo < hi);
+ }
+
+ return queue;
+ }
+
+ return heapselect;
+}
+var insertionsort = crossfilter.insertionsort = insertionsort_by(crossfilter_identity);
+
+insertionsort.by = insertionsort_by;
+
+function insertionsort_by(f) {
+
+ function insertionsort(a, lo, hi) {
+ for (var i = lo + 1; i < hi; ++i) {
+ for (var j = i, t = a[i], x = f(t); j > lo && f(a[j - 1]) > x; --j) {
+ a[j] = a[j - 1];
+ }
+ a[j] = t;
+ }
+ return a;
+ }
+
+ return insertionsort;
+}
+// Algorithm designed by Vladimir Yaroslavskiy.
+// Implementation based on the Dart project; see lib/dart/LICENSE for details.
+
+var quicksort = crossfilter.quicksort = quicksort_by(crossfilter_identity);
+
+quicksort.by = quicksort_by;
+
+function quicksort_by(f) {
+ var insertionsort = insertionsort_by(f);
+
+ function sort(a, lo, hi) {
+ return (hi - lo < quicksort_sizeThreshold
+ ? insertionsort
+ : quicksort)(a, lo, hi);
+ }
+
+ function quicksort(a, lo, hi) {
+
+ // Compute the two pivots by looking at 5 elements.
+ var sixth = (hi - lo) / 6 | 0,
+ i1 = lo + sixth,
+ i5 = hi - 1 - sixth,
+ i3 = lo + hi - 1 >> 1, // The midpoint.
+ i2 = i3 - sixth,
+ i4 = i3 + sixth;
+
+ var e1 = a[i1], x1 = f(e1),
+ e2 = a[i2], x2 = f(e2),
+ e3 = a[i3], x3 = f(e3),
+ e4 = a[i4], x4 = f(e4),
+ e5 = a[i5], x5 = f(e5);
+
+ var t;
+
+ // Sort the selected 5 elements using a sorting network.
+ if (x1 > x2) t = e1, e1 = e2, e2 = t, t = x1, x1 = x2, x2 = t;
+ if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;
+ if (x1 > x3) t = e1, e1 = e3, e3 = t, t = x1, x1 = x3, x3 = t;
+ if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;
+ if (x1 > x4) t = e1, e1 = e4, e4 = t, t = x1, x1 = x4, x4 = t;
+ if (x3 > x4) t = e3, e3 = e4, e4 = t, t = x3, x3 = x4, x4 = t;
+ if (x2 > x5) t = e2, e2 = e5, e5 = t, t = x2, x2 = x5, x5 = t;
+ if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;
+ if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;
+
+ var pivot1 = e2, pivotValue1 = x2,
+ pivot2 = e4, pivotValue2 = x4;
+
+ // e2 and e4 have been saved in the pivot variables. They will be written
+ // back, once the partitioning is finished.
+ a[i1] = e1;
+ a[i2] = a[lo];
+ a[i3] = e3;
+ a[i4] = a[hi - 1];
+ a[i5] = e5;
+
+ var less = lo + 1, // First element in the middle partition.
+ great = hi - 2; // Last element in the middle partition.
+
+ // Note that for value comparison, <, <=, >= and > coerce to a primitive via
+ // Object.prototype.valueOf; == and === do not, so in order to be consistent
+ // with natural order (such as for Date objects), we must do two compares.
+ var pivotsEqual = pivotValue1 <= pivotValue2 && pivotValue1 >= pivotValue2;
+ if (pivotsEqual) {
+
+ // Degenerated case where the partitioning becomes a dutch national flag
+ // problem.
+ //
+ // [ | < pivot | == pivot | unpartitioned | > pivot | ]
+ // ^ ^ ^ ^ ^
+ // left less k great right
+ //
+ // a[left] and a[right] are undefined and are filled after the
+ // partitioning.
+ //
+ // Invariants:
+ // 1) for x in ]left, less[ : x < pivot.
+ // 2) for x in [less, k[ : x == pivot.
+ // 3) for x in ]great, right[ : x > pivot.
+ for (var k = less; k <= great; ++k) {
+ var ek = a[k], xk = f(ek);
+ if (xk < pivotValue1) {
+ if (k !== less) {
+ a[k] = a[less];
+ a[less] = ek;
+ }
+ ++less;
+ } else if (xk > pivotValue1) {
+
+ // Find the first element <= pivot in the range [k - 1, great] and
+ // put [:ek:] there. We know that such an element must exist:
+ // When k == less, then el3 (which is equal to pivot) lies in the
+ // interval. Otherwise a[k - 1] == pivot and the search stops at k-1.
+ // Note that in the latter case invariant 2 will be violated for a
+ // short amount of time. The invariant will be restored when the
+ // pivots are put into their final positions.
+ while (true) {
+ var greatValue = f(a[great]);
+ if (greatValue > pivotValue1) {
+ great--;
+ // This is the only location in the while-loop where a new
+ // iteration is started.
+ continue;
+ } else if (greatValue < pivotValue1) {
+ // Triple exchange.
+ a[k] = a[less];
+ a[less++] = a[great];
+ a[great--] = ek;
+ break;
+ } else {
+ a[k] = a[great];
+ a[great--] = ek;
+ // Note: if great < k then we will exit the outer loop and fix
+ // invariant 2 (which we just violated).
+ break;
+ }
+ }
+ }
+ }
+ } else {
+
+ // We partition the list into three parts:
+ // 1. < pivot1
+ // 2. >= pivot1 && <= pivot2
+ // 3. > pivot2
+ //
+ // During the loop we have:
+ // [ | < pivot1 | >= pivot1 && <= pivot2 | unpartitioned | > pivot2 | ]
+ // ^ ^ ^ ^ ^
+ // left less k great right
+ //
+ // a[left] and a[right] are undefined and are filled after the
+ // partitioning.
+ //
+ // Invariants:
+ // 1. for x in ]left, less[ : x < pivot1
+ // 2. for x in [less, k[ : pivot1 <= x && x <= pivot2
+ // 3. for x in ]great, right[ : x > pivot2
+ for (var k = less; k <= great; k++) {
+ var ek = a[k], xk = f(ek);
+ if (xk < pivotValue1) {
+ if (k !== less) {
+ a[k] = a[less];
+ a[less] = ek;
+ }
+ ++less;
+ } else {
+ if (xk > pivotValue2) {
+ while (true) {
+ var greatValue = f(a[great]);
+ if (greatValue > pivotValue2) {
+ great--;
+ if (great < k) break;
+ // This is the only location inside the loop where a new
+ // iteration is started.
+ continue;
+ } else {
+ // a[great] <= pivot2.
+ if (greatValue < pivotValue1) {
+ // Triple exchange.
+ a[k] = a[less];
+ a[less++] = a[great];
+ a[great--] = ek;
+ } else {
+ // a[great] >= pivot1.
+ a[k] = a[great];
+ a[great--] = ek;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Move pivots into their final positions.
+ // We shrunk the list from both sides (a[left] and a[right] have
+ // meaningless values in them) and now we move elements from the first
+ // and third partition into these locations so that we can store the
+ // pivots.
+ a[lo] = a[less - 1];
+ a[less - 1] = pivot1;
+ a[hi - 1] = a[great + 1];
+ a[great + 1] = pivot2;
+
+ // The list is now partitioned into three partitions:
+ // [ < pivot1 | >= pivot1 && <= pivot2 | > pivot2 ]
+ // ^ ^ ^ ^
+ // left less great right
+
+ // Recursive descent. (Don't include the pivot values.)
+ sort(a, lo, less - 1);
+ sort(a, great + 2, hi);
+
+ if (pivotsEqual) {
+ // All elements in the second partition are equal to the pivot. No
+ // need to sort them.
+ return a;
+ }
+
+ // In theory it should be enough to call _doSort recursively on the second
+ // partition.
+ // The Android source however removes the pivot elements from the recursive
+ // call if the second partition is too large (more than 2/3 of the list).
+ if (less < i1 && great > i5) {
+ var lessValue, greatValue;
+ while ((lessValue = f(a[less])) <= pivotValue1 && lessValue >= pivotValue1) ++less;
+ while ((greatValue = f(a[great])) <= pivotValue2 && greatValue >= pivotValue2) --great;
+
+ // Copy paste of the previous 3-way partitioning with adaptions.
+ //
+ // We partition the list into three parts:
+ // 1. == pivot1
+ // 2. > pivot1 && < pivot2
+ // 3. == pivot2
+ //
+ // During the loop we have:
+ // [ == pivot1 | > pivot1 && < pivot2 | unpartitioned | == pivot2 ]
+ // ^ ^ ^
+ // less k great
+ //
+ // Invariants:
+ // 1. for x in [ *, less[ : x == pivot1
+ // 2. for x in [less, k[ : pivot1 < x && x < pivot2
+ // 3. for x in ]great, * ] : x == pivot2
+ for (var k = less; k <= great; k++) {
+ var ek = a[k], xk = f(ek);
+ if (xk <= pivotValue1 && xk >= pivotValue1) {
+ if (k !== less) {
+ a[k] = a[less];
+ a[less] = ek;
+ }
+ less++;
+ } else {
+ if (xk <= pivotValue2 && xk >= pivotValue2) {
+ while (true) {
+ var greatValue = f(a[great]);
+ if (greatValue <= pivotValue2 && greatValue >= pivotValue2) {
+ great--;
+ if (great < k) break;
+ // This is the only location inside the loop where a new
+ // iteration is started.
+ continue;
+ } else {
+ // a[great] < pivot2.
+ if (greatValue < pivotValue1) {
+ // Triple exchange.
+ a[k] = a[less];
+ a[less++] = a[great];
+ a[great--] = ek;
+ } else {
+ // a[great] == pivot1.
+ a[k] = a[great];
+ a[great--] = ek;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // The second partition has now been cleared of pivot elements and looks
+ // as follows:
+ // [ * | > pivot1 && < pivot2 | * ]
+ // ^ ^
+ // less great
+ // Sort the second partition using recursive descent.
+
+ // The second partition looks as follows:
+ // [ * | >= pivot1 && <= pivot2 | * ]
+ // ^ ^
+ // less great
+ // Simply sort it by recursive descent.
+
+ return sort(a, less, great + 1);
+ }
+
+ return sort;
+}
+
+var quicksort_sizeThreshold = 32;
+var crossfilter_array8 = crossfilter_arrayUntyped,
+ crossfilter_array16 = crossfilter_arrayUntyped,
+ crossfilter_array32 = crossfilter_arrayUntyped,
+ crossfilter_arrayLengthen = crossfilter_identity,
+ crossfilter_arrayWiden = crossfilter_identity;
+
+if (typeof Uint8Array !== "undefined") {
+ crossfilter_array8 = function(n) { return new Uint8Array(n); };
+ crossfilter_array16 = function(n) { return new Uint16Array(n); };
+ crossfilter_array32 = function(n) { return new Uint32Array(n); };
+
+ crossfilter_arrayLengthen = function(array, length) {
+ var copy = new array.constructor(length);
+ copy.set(array);
+ return copy;
+ };
+
+ crossfilter_arrayWiden = function(array, width) {
+ var copy;
+ switch (width) {
+ case 16: copy = crossfilter_array16(array.length); break;
+ case 32: copy = crossfilter_array32(array.length); break;
+ default: throw new Error("invalid array width!");
+ }
+ copy.set(array);
+ return copy;
+ };
+}
+
+function crossfilter_arrayUntyped(n) {
+ return new Array(n);
+}
+function crossfilter_filterExact(bisect, value) {
+ return function(values) {
+ var n = values.length;
+ return [bisect.left(values, value, 0, n), bisect.right(values, value, 0, n)];
+ };
+}
+
+function crossfilter_filterRange(bisect, range) {
+ var min = range[0],
+ max = range[1];
+ return function(values) {
+ var n = values.length;
+ return [bisect.left(values, min, 0, n), bisect.left(values, max, 0, n)];
+ };
+}
+
+function crossfilter_filterAll(values) {
+ return [0, values.length];
+}
+function crossfilter_null() {
+ return null;
+}
+function crossfilter_zero() {
+ return 0;
+}
+function crossfilter_reduceIncrement(p) {
+ return p + 1;
+}
+
+function crossfilter_reduceDecrement(p) {
+ return p - 1;
+}
+
+function crossfilter_reduceAdd(f) {
+ return function(p, v) {
+ return p + +f(v);
+ };
+}
+
+function crossfilter_reduceSubtract(f) {
+ return function(p, v) {
+ return p - f(v);
+ };
+}
+exports.crossfilter = crossfilter;
+
+function crossfilter() {
+ var crossfilter = {
+ add: add,
+ dimension: dimension,
+ groupAll: groupAll,
+ size: size
+ };
+
+ var data = [], // the records
+ n = 0, // the number of records; data.length
+ m = 0, // number of dimensions in use
+ M = 8, // number of dimensions that can fit in `filters`
+ filters = crossfilter_array8(0), // M bits per record; 1 is filtered out
+ filterListeners = [], // when the filters change
+ dataListeners = []; // when data is added
+
+ // Adds the specified new records to this crossfilter.
+ function add(newData) {
+ var n0 = n,
+ n1 = newData.length;
+
+ // If there's actually new data to add…
+ // Merge the new data into the existing data.
+ // Lengthen the filter bitset to handle the new records.
+ // Notify listeners (dimensions and groups) that new data is available.
+ if (n1) {
+ data = data.concat(newData);
+ filters = crossfilter_arrayLengthen(filters, n += n1);
+ dataListeners.forEach(function(l) { l(newData, n0, n1); });
+ }
+
+ return crossfilter;
+ }
+
+ // Adds a new dimension with the specified value accessor function.
+ function dimension(value) {
+ var dimension = {
+ filter: filter,
+ filterExact: filterExact,
+ filterRange: filterRange,
+ filterAll: filterAll,
+ top: top,
+ group: group,
+ groupAll: groupAll
+ };
+
+ var one = 1 << m++, // bit mask, e.g., 00001000
+ zero = ~one, // inverted one, e.g., 11110111
+ values, // sorted, cached array
+ index, // value rank ↦ object id
+ newValues, // temporary array storing newly-added values
+ newIndex, // temporary array storing newly-added index
+ sort = quicksort_by(function(i) { return newValues[i]; }),
+ refilter = crossfilter_filterAll, // for recomputing filter
+ indexListeners = [], // when data is added
+ lo0 = 0,
+ hi0 = 0;
+
+ // Updating a dimension is a two-stage process. First, we must update the
+ // associated filters for the newly-added records. Once all dimensions have
+ // updated their filters, the groups are notified to update.
+ dataListeners.unshift(preAdd);
+ dataListeners.push(postAdd);
+
+ // Incorporate any existing data into this dimension, and make sure that the
+ // filter bitset is wide enough to handle the new dimension.
+ if (m > M) filters = crossfilter_arrayWiden(filters, M <<= 1);
+ preAdd(data, 0, n);
+ postAdd(data, 0, n);
+
+ // Incorporates the specified new records into this dimension.
+ // This function is responsible for updating filters, values, and index.
+ function preAdd(newData, n0, n1) {
+
+ // Permute new values into natural order using a sorted index.
+ newValues = newData.map(value);
+ newIndex = sort(crossfilter_range(n1), 0, n1);
+ newValues = permute(newValues, newIndex);
+
+ // Bisect newValues to determine which new records are selected.
+ var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1], i;
+ for (i = 0; i < lo1; ++i) filters[newIndex[i] + n0] |= one;
+ for (i = hi1; i < n1; ++i) filters[newIndex[i] + n0] |= one;
+
+ // If this dimension previously had no data, then we don't need to do the
+ // more expensive merge operation; use the new values and index as-is.
+ if (!n0) {
+ values = newValues;
+ index = newIndex;
+ lo0 = lo1;
+ hi0 = hi1;
+ return;
+ }
+
+ var oldValues = values,
+ oldIndex = index,
+ i0 = 0,
+ i1 = 0;
+
+ // Otherwise, create new arrays into which to merge new and old.
+ values = new Array(n);
+ index = crossfilter_index(n, n);
+
+ // Merge the old and new sorted values, and old and new index.
+ for (i = 0; i0 < n0 && i1 < n1; ++i) {
+ if (oldValues[i0] < newValues[i1]) {
+ values[i] = oldValues[i0];
+ index[i] = oldIndex[i0++];
+ } else {
+ values[i] = newValues[i1];
+ index[i] = newIndex[i1++] + n0;
+ }
+ }
+
+ // Add any remaining old values.
+ for (; i0 < n0; ++i0, ++i) {
+ values[i] = oldValues[i0];
+ index[i] = oldIndex[i0];
+ }
+
+ // Add any remaining new values.
+ for (; i1 < n1; ++i1, ++i) {
+ values[i] = newValues[i1];
+ index[i] = newIndex[i1] + n0;
+ }
+
+ // Bisect again to recompute lo0 and hi0.
+ bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1];
+ }
+
+ // When all filters have updated, notify index listeners of the new values.
+ function postAdd(newData, n0, n1) {
+ indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); });
+ newValues = newIndex = null;
+ }
+
+ // Updates the selected values based on the specified bounds [lo, hi].
+ // This implementation is used by all the public filter methods.
+ function filterIndex(bounds) {
+ var i,
+ j,
+ k,
+ lo1 = bounds[0],
+ hi1 = bounds[1],
+ added = [],
+ removed = [];
+
+ // Fast incremental update based on previous lo index.
+ if (lo1 < lo0) {
+ for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {
+ filters[k = index[i]] ^= one;
+ added.push(k);
+ }
+ } else if (lo1 > lo0) {
+ for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {
+ filters[k = index[i]] ^= one;
+ removed.push(k);
+ }
+ }
+
+ // Fast incremental update based on previous hi index.
+ if (hi1 > hi0) {
+ for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {
+ filters[k = index[i]] ^= one;
+ added.push(k);
+ }
+ } else if (hi1 < hi0) {
+ for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {
+ filters[k = index[i]] ^= one;
+ removed.push(k);
+ }
+ }
+
+ lo0 = lo1;
+ hi0 = hi1;
+ filterListeners.forEach(function(l) { l(one, added, removed); });
+ return dimension;
+ }
+
+ // Filters this dimension using the specified range, value, or null.
+ // If the range is null, this is equivalent to filterAll.
+ // If the range is an array, this is equivalent to filterRange.
+ // Otherwise, this is equivalent to filterExact.
+ function filter(range) {
+ return range == null
+ ? filterAll() : Array.isArray(range)
+ ? filterRange(range)
+ : filterExact(range);
+ }
+
+ // Filters this dimension to select the exact value.
+ function filterExact(value) {
+ return filterIndex((refilter = crossfilter_filterExact(bisect, value))(values));
+ }
+
+ // Filters this dimension to select the specified range [lo, hi].
+ // The lower bound is inclusive, and the upper bound is exclusive.
+ function filterRange(range) {
+ return filterIndex((refilter = crossfilter_filterRange(bisect, range))(values));
+ }
+
+ // Clears any filters on this dimension.
+ function filterAll() {
+ return filterIndex((refilter = crossfilter_filterAll)(values));
+ }
+
+ // Returns the top K selected records, based on this dimension's order.
+ // Note: observes this dimension's filter, unlike group and groupAll.
+ function top(k) {
+ var array = [],
+ i = hi0,
+ j;
+
+ while (--i >= lo0 && k > 0) {
+ if (!filters[j = index[i]]) {
+ array.push(data[j]);
+ --k;
+ }
+ }
+
+ return array;
+ }
+
+ // Adds a new group to this dimension, using the specified key function.
+ function group(key) {
+ var group = {
+ top: top,
+ all: all,
+ reduce: reduce,
+ reduceCount: reduceCount,
+ reduceSum: reduceSum,
+ order: order,
+ orderNatural: orderNatural,
+ size: size
+ };
+
+ var groups, // array of {key, value}
+ groupIndex, // object id ↦ group id
+ groupWidth = 8,
+ groupCapacity = crossfilter_capacity(groupWidth),
+ k = 0, // cardinality
+ select,
+ heap,
+ reduceAdd,
+ reduceRemove,
+ reduceInitial,
+ update = crossfilter_null,
+ reset = crossfilter_null,
+ resetNeeded = true;
+
+ if (arguments.length < 1) key = crossfilter_identity;
+
+ // The group listens to the crossfilter for when any dimension changes, so
+ // that it can update the associated reduce values. It must also listen to
+ // the parent dimension for when data is added, and compute new keys.
+ filterListeners.push(update);
+ indexListeners.push(add);
+
+ // Incorporate any existing data into the grouping.
+ add(values, index, 0, n);
+
+ // Incorporates the specified new values into this group.
+ // This function is responsible for updating groups and groupIndex.
+ function add(newValues, newIndex, n0, n1) {
+ var oldGroups = groups,
+ reIndex = crossfilter_index(k, groupCapacity),
+ add = reduceAdd,
+ initial = reduceInitial,
+ k0 = k, // old cardinality
+ i0 = 0, // index of old group
+ i1 = 0, // index of new record
+ j, // object id
+ g0, // old group
+ x0, // old key
+ x1, // new key
+ g, // group to add
+ x; // key of group to add
+
+ // If a reset is needed, we don't need to update the reduce values.
+ if (resetNeeded) add = initial = crossfilter_null;
+
+ // Reset the new groups (k is a lower bound).
+ // Also, make sure that groupIndex exists and is long enough.
+ groups = new Array(k), k = 0;
+ groupIndex = k0 > 1 ? crossfilter_arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity);
+
+ // Get the first old key (x0 of g0), if it exists.
+ if (k0) x0 = (g0 = oldGroups[0]).key;
+
+ // Find the first new key (x1), skipping NaN keys.
+ while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;
+
+ // While new keys remain…
+ while (i1 < n1) {
+
+ // Determine the lesser of the two current keys; new and old.
+ // If there are no old keys remaining, then always add the new key.
+ if (g0 && x0 <= x1) {
+ g = g0, x = x0;
+
+ // Record the new index of the old group.
+ reIndex[i0] = k;
+
+ // Retrieve the next old key.
+ if (g0 = oldGroups[++i0]) x0 = g0.key;
+ } else {
+ g = {key: x1, value: initial()}, x = x1;
+ }
+
+ // Add the lesser group.
+ groups[k] = g;
+
+ // Add any selected records belonging to the added group, while
+ // advancing the new key and populating the associated group index.
+ while (!(x1 > x)) {
+ groupIndex[j = newIndex[i1] + n0] = k;
+ if (!(filters[j] & zero)) g.value = add(g.value, data[j]);
+ if (++i1 >= n1) break;
+ x1 = key(newValues[i1]);
+ }
+
+ groupIncrement();
+ }
+
+ // Add any remaining old groups that were greater than all new keys.
+ // No incremental reduce is needed; these groups have no new records.
+ // Also record the new index of the old group.
+ while (i0 < k0) {
+ groups[reIndex[i0] = k] = oldGroups[i0++];
+ groupIncrement();
+ }
+
+ // If we added any new groups before any old groups,
+ // update the group index of all the old records.
+ if (k > i0) for (i0 = 0; i0 < n0; ++i0) {
+ groupIndex[i0] = reIndex[groupIndex[i0]];
+ }
+
+ // Modify the update and reset behavior based on the cardinality.
+ // If the cardinality is less than or equal to one, then the groupIndex
+ // is not needed. If the cardinality is zero, then there are no records
+ // and therefore no groups to update or reset. Note that we also must
+ // change the registered listener to point to the new method.
+ j = filterListeners.indexOf(update);
+ if (k > 1) {
+ update = updateMany;
+ reset = resetMany;
+ } else {
+ if (k === 1) {
+ update = updateOne;
+ reset = resetOne;
+ } else {
+ update = crossfilter_null;
+ reset = crossfilter_null;
+ }
+ groupIndex = null;
+ }
+ filterListeners[j] = update;
+
+ // Count the number of added groups,
+ // and widen the group index as needed.
+ function groupIncrement() {
+ if (++k === groupCapacity) {
+ reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1);
+ groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth);
+ groupCapacity = crossfilter_capacity(groupWidth);
+ }
+ }
+ }
+
+ // Reduces the specified selected or deselected records.
+ // This function is only used when the cardinality is greater than 1.
+ function updateMany(filterOne, added, removed) {
+ if (filterOne === one || resetNeeded) return;
+
+ var i,
+ k,
+ n,
+ g;
+
+ // Add the added values.
+ for (i = 0, n = added.length; i < n; ++i) {
+ if (!(filters[k = added[i]] & zero)) {
+ g = groups[groupIndex[k]];
+ g.value = reduceAdd(g.value, data[k]);
+ }
+ }
+
+ // Remove the removed values.
+ for (i = 0, n = removed.length; i < n; ++i) {
+ if ((filters[k = removed[i]] & zero) === filterOne) {
+ g = groups[groupIndex[k]];
+ g.value = reduceRemove(g.value, data[k]);
+ }
+ }
+ }
+
+ // Reduces the specified selected or deselected records.
+ // This function is only used when the cardinality is 1.
+ function updateOne(filterOne, added, removed) {
+ if (filterOne === one || resetNeeded) return;
+
+ var i,
+ k,
+ n,
+ g = groups[0];
+
+ // Add the added values.
+ for (i = 0, n = added.length; i < n; ++i) {
+ if (!(filters[k = added[i]] & zero)) {
+ g.value = reduceAdd(g.value, data[k]);
+ }
+ }
+
+ // Remove the removed values.
+ for (i = 0, n = removed.length; i < n; ++i) {
+ if ((filters[k = removed[i]] & zero) === filterOne) {
+ g.value = reduceRemove(g.value, data[k]);
+ }
+ }
+ }
+
+ // Recomputes the group reduce values from scratch.
+ // This function is only used when the cardinality is greater than 1.
+ function resetMany() {
+ var i,
+ g;
+
+ // Reset all group values.
+ for (i = 0; i < k; ++i) {
+ groups[i].value = reduceInitial();
+ }
+
+ // Add any selected records.
+ for (i = 0; i < n; ++i) {
+ if (!(filters[i] & zero)) {
+ g = groups[groupIndex[i]];
+ g.value = reduceAdd(g.value, data[i]);
+ }
+ }
+ }
+
+ // Recomputes the group reduce values from scratch.
+ // This function is only used when the cardinality is 1.
+ function resetOne() {
+ var i,
+ g = groups[0];
+
+ // Reset the singleton group values.
+ g.value = reduceInitial();
+
+ // Add any selected records.
+ for (i = 0; i < n; ++i) {
+ if (!(filters[i] & zero)) {
+ g.value = reduceAdd(g.value, data[i]);
+ }
+ }
+ }
+
+ // Returns the array of group values, in the dimension's natural order.
+ function all() {
+ if (resetNeeded) reset(), resetNeeded = false;
+ return groups;
+ }
+
+ // Returns a new array containing the top K group values, in reduce order.
+ function top(k) {
+ var top = select(all(), 0, groups.length, k);
+ return heap.sort(top, 0, top.length);
+ }
+
+ // Sets the reduce behavior for this group to use the specified functions.
+ // This method lazily recomputes the reduce values, waiting until needed.
+ function reduce(add, remove, initial) {
+ reduceAdd = add;
+ reduceRemove = remove;
+ reduceInitial = initial;
+ resetNeeded = true;
+ return group;
+ }
+
+ // A convenience method for reducing by count.
+ function reduceCount() {
+ return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);
+ }
+
+ // A convenience method for reducing by sum(value).
+ function reduceSum(value) {
+ return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);
+ }
+
+ // Sets the reduce order, using the specified accessor.
+ function order(value) {
+ select = heapselect_by(valueOf);
+ heap = heap_by(valueOf);
+ function valueOf(d) { return value(d.value); }
+ return group;
+ }
+
+ // A convenience method for natural ordering by reduce value.
+ function orderNatural() {
+ return order(crossfilter_identity);
+ }
+
+ // Returns the cardinality of this group, irrespective of any filters.
+ function size() {
+ return k;
+ }
+
+ return reduceCount().orderNatural();
+ }
+
+ // A convenience function for generating a singleton group.
+ function groupAll() {
+ var g = group(crossfilter_null), all = g.all;
+ delete g.all;
+ delete g.top;
+ delete g.order;
+ delete g.orderNatural;
+ delete g.size;
+ g.value = function() { return all()[0].value; };
+ return g;
+ }
+
+ return dimension;
+ }
+
+ // A convenience method for groupAll on a dummy dimension.
+ // This implementation can be optimized since it is always cardinality 1.
+ function groupAll() {
+ var group = {
+ reduce: reduce,
+ reduceCount: reduceCount,
+ reduceSum: reduceSum,
+ value: value
+ };
+
+ var reduceValue,
+ reduceAdd,
+ reduceRemove,
+ reduceInitial,
+ resetNeeded = true;
+
+ // The group listens to the crossfilter for when any dimension changes, so
+ // that it can update the reduce value. It must also listen to the parent
+ // dimension for when data is added.
+ filterListeners.push(update);
+ dataListeners.push(add);
+
+ // For consistency; actually a no-op since resetNeeded is true.
+ add(data, 0, n);
+
+ // Incorporates the specified new values into this group.
+ function add(newData, n0, n1) {
+ var i;
+
+ if (resetNeeded) return;
+
+ // Add the added values.
+ for (i = n0; i < n; ++i) {
+ if (!filters[i]) {
+ reduceValue = reduceAdd(reduceValue, data[i]);
+ }
+ }
+ }
+
+ // Reduces the specified selected or deselected records.
+ function update(filterOne, added, removed) {
+ var i,
+ k,
+ n;
+
+ if (resetNeeded) return;
+
+ // Add the added values.
+ for (i = 0, n = added.length; i < n; ++i) {
+ if (!filters[k = added[i]]) {
+ reduceValue = reduceAdd(reduceValue, data[k]);
+ }
+ }
+
+ // Remove the removed values.
+ for (i = 0, n = removed.length; i < n; ++i) {
+ if (filters[k = removed[i]] === filterOne) {
+ reduceValue = reduceRemove(reduceValue, data[k]);
+ }
+ }
+ }
+
+ // Recomputes the group reduce value from scratch.
+ function reset() {
+ var i;
+
+ reduceValue = reduceInitial();
+
+ for (i = 0; i < n; ++i) {
+ if (!filters[i]) {
+ reduceValue = reduceAdd(reduceValue, data[i]);
+ }
+ }
+ }
+
+ // Sets the reduce behavior for this group to use the specified functions.
+ // This method lazily recomputes the reduce value, waiting until needed.
+ function reduce(add, remove, initial) {
+ reduceAdd = add;
+ reduceRemove = remove;
+ reduceInitial = initial;
+ resetNeeded = true;
+ return group;
+ }
+
+ // A convenience method for reducing by count.
+ function reduceCount() {
+ return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);
+ }
+
+ // A convenience method for reducing by sum(value).
+ function reduceSum(value) {
+ return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);
+ }
+
+ // Returns the computed reduce value.
+ function value() {
+ if (resetNeeded) reset(), resetNeeded = false;
+ return reduceValue;
+ }
+
+ return reduceCount();
+ }
+
+ // Returns the number of records in this crossfilter, irrespective of any filters.
+ function size() {
+ return n;
+ }
+
+ return arguments.length
+ ? add(arguments[0])
+ : crossfilter;
+}
+
+// Returns an array of size n, big enough to store ids up to m.
+function crossfilter_index(n, m) {
+ return (m < 0x101
+ ? crossfilter_array8 : m < 0x10001
+ ? crossfilter_array16
+ : crossfilter_array32)(n);
+}
+
+// Constructs a new array of size n, with sequential values from 0 to n - 1.
+function crossfilter_range(n) {
+ var range = crossfilter_index(n, n);
+ for (var i = -1; ++i < n;) range[i] = i;
+ return range;
+}
+
+function crossfilter_capacity(w) {
+ return w === 8
+ ? 0x100 : w === 16
+ ? 0x10000
+ : 0x100000000;
+}
+})(this);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.min.js
new file mode 100644
index 00000000..981f0d64
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.min.js
@@ -0,0 +1 @@
+(function(a){function b(a){return a}function c(a,b){for(var c=0,d=b.length,e=new Array(d);c<d;++c)e[c]=a[b[c]];return e}function e(a){function b(b,c,d,e){while(d<e){var f=d+e>>1;a(b[f])<c?d=f+1:e=f}return d}function c(b,c,d,e){while(d<e){var f=d+e>>1;c<a(b[f])?e=f:d=f+1}return d}return c.right=c,c.left=b,c}function g(a){function b(a,b,c){var e=c-b,f=(e>>>1)+1;while(--f>0)d(a,f,e,b);return a}function c(a,b,c){var e=c-b,f;while(--e>0)f=a[b],a[b]=a[b+e],a[b+e]=f,d(a,1,e,b);return a}function d(b,c,d,e){var f=b[--e+c],g=a(f),h;while((h=c<<1)<=d){h<d&&a(b[e+h])>a(b[e+h+1])&&h++;if(g<=a(b[e+h]))break;b[e+c]=b[e+h],c=h}b[e+c]=f}return b.sort=c,b}function i(a){function c(c,d,e,f){var g=new Array(f=Math.min(e-d,f)),h,i,j,k;for(i=0;i<f;++i)g[i]=c[d++];b(g,0,f);if(d<e){h=a(g[0]);do if(j=a(k=c[d])>h)g[0]=k,h=a(b(g,0,f)[0]);while(++d<e)}return g}var b=g(a);return c}function k(a){function b(b,c,d){for(var e=c+1;e<d;++e){for(var f=e,g=b[e],h=a(g);f>c&&a(b[f-1])>h;--f)b[f]=b[f-1];b[f]=g}return b}return b}function m(a){function c(a,c,e){return(e-c<n?b:d)(a,c,e)}function d(b,d,e){var f=(e-d)/6|0,g=d+f,h=e-1-f,i=d+e-1>>1,j=i-f,k=i+f,l=b[g],m=a(l),n=b[j],o=a(n),p=b[i],q=a(p),r=b[k],s=a(r),t=b[h],u=a(t),v;m>o&&(v=l,l=n,n=v,v=m,m=o,o=v),s>u&&(v=r,r=t,t=v,v=s,s=u,u=v),m>q&&(v=l,l=p,p=v,v=m,m=q,q=v),o>q&&(v=n,n=p,p=v,v=o,o=q,q=v),m>s&&(v=l,l=r,r=v,v=m,m=s,s=v),q>s&&(v=p,p=r,r=v,v=q,q=s,s=v),o>u&&(v=n,n=t,t=v,v=o,o=u,u=v),o>q&&(v=n,n=p,p=v,v=o,o=q,q=v),s>u&&(v=r,r=t,t=v,v=s,s=u,u=v);var w=n,x=o,y=r,z=s;b[g]=l,b[j]=b[d],b[i]=p,b[k]=b[e-1],b[h]=t;var A=d+1,B=e-2,C=x<=z&&x>=z;if(C)for(var D=A;D<=B;++D){var E=b[D],F=a(E);if(F<x)D!==A&&(b[D]=b[A],b[A]=E),++A;else if(F>x)for(;;){var G=a(b[B]);if(G>x){B--;continue}if(G<x){b[D]=b[A],b[A++]=b[B],b[B--]=E;break}b[D]=b[B],b[B--]=E;break}}else for(var D=A;D<=B;D++){var E=b[D],F=a(E);if(F<x)D!==A&&(b[D]=b[A],b[A]=E),++A;else if(F>z)for(;;){var G=a(b[B]);if(G>z){B--;if(B<D)break;continue}G<x?(b[D]=b[A],b[A++]=b[B],b[B--]=E):(b[D]=b[B],b[B--]=E);break}}b[d]=b[A-1],b[A-1]=w,b[e-1]=b[B+1],b[B+1]=y,c(b,d,A-1),c(b,B+2,e);if(C)return b;if(A<g&&B>h){var H,G;while((H=a(b[A]))<=x&&H>=x)++A;while((G=a(b[B]))<=z&&G>=z)--B;for(var D=A;D<=B;D++){var E=b[D],F=a(E);if(F<=x&&F>=x)D!==A&&(b[D]=b[A],b[A]=E),A++;else if(F<=z&&F>=z)for(;;){var G=a(b[B]);if(G<=z&&G>=z){B--;if(B<D)break;continue}G<x?(b[D]=b[A],b[A++]=b[B],b[B--]=E):(b[D]=b[B],b[B--]=E);break}}}return c(b,A,B+1)}var b=k(a);return c}function t(a){return new Array(a)}function u(a,b){return function(c){var d=c.length;return[a.left(c,b,0,d),a.right(c,b,0,d)]}}function v(a,b){var c=b[0],d=b[1];return function(b){var e=b.length;return[a.left(b,c,0,e),a.left(b,d,0,e)]}}function w(a){return[0,a.length]}function x(){return null}function y(){return 0}function z(a){return a+1}function A(a){return a-1}function B(a){return function(b,c){return b+ +a(c)}}function C(a){return function(b,c){return b-a(c)}}function D(){function p(b){var c=f,d=b.length;return d&&(e=e.concat(b),k=r(k,f+=d),n.forEach(function(a){a(b,c,d)})),a}function q(a){function P(b,d,e){H=b.map(a),I=J(F(e),0,e),H=c(H,I);var g=K(H),h=g[0],i=g[1],j;for(j=0;j<h;++j)k[I[j]+d]|=p;for(j=i;j<e;++j)k[I[j]+d]|=p;if(!d){t=H,D=I,N=h,O=i;return}var l=t,m=D,n=0,o=0;t=new Array(f),D=E(f,f);for(j=0;n<d&&o<e;++j)l[n]<H[o]?(t[j]=l[n],D[j]=m[n++]):(t[j]=H[o],D[j]=I[o++]+d);for(;n<d;++n,++j)t[j]=l[n],D[j]=m[n];for(;o<e;++o,++j)t[j]=H[o],D[j]=I[o]+d;g=K(t),N=g[0],O=g[1]}function Q(a,b,c){L.forEach(function(a){a(H,I,b,c)}),H=I=null}function R(a){var b,c,d,e=a[0],f=a[1],g=[],h=[];if(e<N)for(b=e,c=Math.min(N,f);b<c;++b)k[d=D[b]]^=p,g.push(d);else if(e>N)for(b=N,c=Math.min(e,O);b<c;++b)k[d=D[b]]^=p,h.push(d);if(f>O)for(b=Math.max(e,O),c=f;b<c;++b)k[d=D[b]]^=p,g.push(d);else if(f<O)for(b=Math.max(N,f),c=O;b<c;++b)k[d=D[b]]^=p,h.push(d);return N=e,O=f,l.forEach(function(a){a(p,g,h)}),o}function S(a){return a==null?V():Array.isArray(a)?U(a):T(a)}function T(a){return R((K=u(d,a))(t))}function U(a){return R((K=v(d,a))(t))}function V(){return R((K=w)(t))}function W(a){var b=[],c=O,d;while(--c>=N&&a>0)k[d=D[c]]||(b.push(e[d]),--a);return b}function X(a){function K(b,c,g,i){function Q(){++n===m&&(p=s(p,j<<=1),h=s(h,j),m=G(j))}var o=d,p=E(n,m),t=v,u=F,w=n,y=0,z=0,A,B,C,D,K,L;J&&(t=u=x),d=new Array(n),n=0,h=w>1?r(h,f):E(f,m),w&&(C=(B=o[0]).key);while(z<i&&!((D=a(b[z]))>=D))++z;while(z<i){if(B&&C<=D){K=B,L=C,p[y]=n;if(B=o[++y])C=B.key}else K={key:D,value:u()},L=D;d[n]=K;while(!(D>L)){h[A=c[z]+g]=n,k[A]&q||(K.value=t(K.value,e[A]));if(++z>=i)break;D=a(b[z])}Q()}while(y<w)d[p[y]=n]=o[y++],Q();if(n>y)for(y=0;y<g;++y)h[y]=p[h[y]];A=l.indexOf(H),n>1?(H=M,I=O):(n===1?(H=N,I=P):(H=x,I=x),h=null),l[A]=H}function M(a,b,c){if(a===p||J)return;var f,g,i,j;for(f=0,i=b.length;f<i;++f)k[g=b[f]]&q||(j=d[h[g]],j.value=v(j.value,e[g]));for(f=0,i=c.length;f<i;++f)(k[g=c[f]]&q)===a&&(j=d[h[g]],j.value=w(j.value,e[g]))}function N(a,b,c){if(a===p||J)return;var f,g,h,i=d[0];for(f=0,h=b.length;f<h;++f)k[g=b[f]]&q||(i.value=v(i.value,e[g]));for(f=0,h=c.length;f<h;++f)(k[g=c[f]]&q)===a&&(i.value=w(i.value,e[g]))}function O(){var a,b;for(a=0;a<n;++a)d[a].value=F();for(a=0;a<f;++a)k[a]&q||(b=d[h[a]],b.value=v(b.value,e[a]))}function P(){var a,b=d[0];b.value=F();for(a=0;a<f;++a)k[a]&q||(b.value=v(b.value,e[a]))}function Q(){return J&&(I(),J=!1),d}function R(a){var b=o(Q(),0,d.length,a);return u.sort(b,0,b.length)}function S(a,b,d){return v=a,w=b,F=d,J=!0,c}function T(){return S(z,A,y)}function U(a){return S(B(a),C(a),y)}function V(a){function b(b){return a(b.value)}return o=i(b),u=g(b),c}function W(){return V(b)}function X(){return n}var c={top:R,all:Q,reduce:S,reduceCount:T,reduceSum:U,order:V,orderNatural:W,size:X},d,h,j=8,m=G(j),n=0,o,u,v,w,F,H=x,I=x,J=!0;return arguments.length<1&&(a=b),l.push(H),L.push(K),K(t,D,0,f),T().orderNatural()}function Y(){var a=X(x),b=a.all;return delete a.all,delete a.top,delete a.order,delete a.orderNatural,delete a.size,a.value=function(){return b()[0].value},a}var o={filter:S,filterExact:T,filterRange:U,filterAll:V,top:W,group:X,groupAll:Y},p=1<<h++,q=~p,t,D,H,I,J=m(function(a){return H[a]}),K=w,L=[],N=0,O=0;return n.unshift(P),n.push(Q),h>j&&(k=s(k,j<<=1)),P(e,0,f),Q(e,0,f),o}function t(){function i(a,d,g){var i;if(h)return;for(i=d;i<f;++i)k[i]||(b=c(b,e[i]))}function j(a,f,g){var i,j,l;if(h)return;for(i=0,l=f.length;i<l;++i)k[j=f[i]]||(b=c(b,e[j]));for(i=0,l=g.length;i<l;++i)k[j=g[i]]===a&&(b=d(b,e[j]))}function m(){var a;b=g();for(a=0;a<f;++a)k[a]||(b=c(b,e[a]))}function o(b,e,f){return c=b,d=e,g=f,h=!0,a}function p(){return o(z,A,y)}function q(a){return o(B(a),C(a),y)}function r(){return h&&(m(),h=!1),b}var a={reduce:o,reduceCount:p,reduceSum:q,value:r},b,c,d,g,h=!0;return l.push(j),n.push(i),i(e,0,f),p()}function D(){return f}var a={add:p,dimension:q,groupAll:t,size:D},e=[],f=0,h=0,j=8,k=o(0),l=[],n=[];return arguments.length?p(arguments[0]):a}function E(a,b){return(b<257?o:b<65537?p:q)(a)}function F(a){var b=E(a,a);for(var c=-1;++c<a;)b[c]=c;return b}function G(a){return a===8?256:a===16?65536:4294967296}D.version="1.0.3",D.permute=c;var d=D.bisect=e(b);d.by=e;var f=D.heap=g(b);f.by=g;var h=D.heapselect=i(b);h.by=i;var j=D.insertionsort=k(b);j.by=k;var l=D.quicksort=m(b);l.by=m;var n=32,o=t,p=t,q=t,r=b,s=b;typeof Uint8Array!="undefined"&&(o=function(a){return new Uint8Array(a)},p=function(a){return new Uint16Array(a)},q=function(a){return new Uint32Array(a)},r=function(a,b){var c=new a.constructor(b);return c.set(a),c},s=function(a,b){var c;switch(b){case 16:c=p(a.length);break;case 32:c=q(a.length);break;default:throw new Error("invalid array width!")}return c.set(a),c}),a.crossfilter=D})(this); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.geom.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.geom.js
new file mode 100644
index 00000000..a19bb16e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.geom.js
@@ -0,0 +1,816 @@
+(function(){d3.geom = {};
+/**
+ * Computes a contour for a given input grid function using the <a
+ * href="http://en.wikipedia.org/wiki/Marching_squares">marching
+ * squares</a> algorithm. Returns the contour polygon as an array of points.
+ *
+ * @param grid a two-input function(x, y) that returns true for values
+ * inside the contour and false for values outside the contour.
+ * @param start an optional starting point [x, y] on the grid.
+ * @returns polygon [[x1, y1], [x2, y2], …]
+ */
+d3.geom.contour = function(grid, start) {
+ var s = start || d3_geom_contourStart(grid), // starting point
+ c = [], // contour polygon
+ x = s[0], // current x position
+ y = s[1], // current y position
+ dx = 0, // next x direction
+ dy = 0, // next y direction
+ pdx = NaN, // previous x direction
+ pdy = NaN, // previous y direction
+ i = 0;
+
+ do {
+ // determine marching squares index
+ i = 0;
+ if (grid(x-1, y-1)) i += 1;
+ if (grid(x, y-1)) i += 2;
+ if (grid(x-1, y )) i += 4;
+ if (grid(x, y )) i += 8;
+
+ // determine next direction
+ if (i == 6) {
+ dx = pdy == -1 ? -1 : 1;
+ dy = 0;
+ } else if (i == 9) {
+ dx = 0;
+ dy = pdx == 1 ? -1 : 1;
+ } else {
+ dx = d3_geom_contourDx[i];
+ dy = d3_geom_contourDy[i];
+ }
+
+ // update contour polygon
+ if (dx != pdx && dy != pdy) {
+ c.push([x, y]);
+ pdx = dx;
+ pdy = dy;
+ }
+
+ x += dx;
+ y += dy;
+ } while (s[0] != x || s[1] != y);
+
+ return c;
+};
+
+// lookup tables for marching directions
+var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN],
+ d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN];
+
+function d3_geom_contourStart(grid) {
+ var x = 0,
+ y = 0;
+
+ // search for a starting point; begin at origin
+ // and proceed along outward-expanding diagonals
+ while (true) {
+ if (grid(x,y)) {
+ return [x,y];
+ }
+ if (x == 0) {
+ x = y + 1;
+ y = 0;
+ } else {
+ x = x - 1;
+ y = y + 1;
+ }
+ }
+}/**
+ * Computes the 2D convex hull of a set of points using Graham's scanning
+ * algorithm. The algorithm has been implemented as described in Cormen,
+ * Leiserson, and Rivest's Introduction to Algorithms. The running time of
+ * this algorithm is O(n log n), where n is the number of input points.
+ *
+ * @param vertices [[x1, y1], [x2, y2], …]
+ * @returns polygon [[x1, y1], [x2, y2], …]
+ */
+d3.geom.hull = function(vertices) {
+ if (vertices.length < 3) return [];
+
+ var len = vertices.length,
+ plen = len - 1,
+ points = [],
+ stack = [],
+ i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
+
+ // find the starting ref point: leftmost point with the minimum y coord
+ for (i=1; i<len; ++i) {
+ if (vertices[i][1] < vertices[h][1]) {
+ h = i;
+ } else if (vertices[i][1] == vertices[h][1]) {
+ h = (vertices[i][0] < vertices[h][0] ? i : h);
+ }
+ }
+
+ // calculate polar angles from ref point and sort
+ for (i=0; i<len; ++i) {
+ if (i == h) continue;
+ y1 = vertices[i][1] - vertices[h][1];
+ x1 = vertices[i][0] - vertices[h][0];
+ points.push({angle: Math.atan2(y1, x1), index: i});
+ }
+ points.sort(function(a, b) { return a.angle - b.angle; });
+
+ // toss out duplicate angles
+ a = points[0].angle;
+ v = points[0].index;
+ u = 0;
+ for (i=1; i<plen; ++i) {
+ j = points[i].index;
+ if (a == points[i].angle) {
+ // keep angle for point most distant from the reference
+ x1 = vertices[v][0] - vertices[h][0];
+ y1 = vertices[v][1] - vertices[h][1];
+ x2 = vertices[j][0] - vertices[h][0];
+ y2 = vertices[j][1] - vertices[h][1];
+ if ((x1*x1 + y1*y1) >= (x2*x2 + y2*y2)) {
+ points[i].index = -1;
+ } else {
+ points[u].index = -1;
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ } else {
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ }
+
+ // initialize the stack
+ stack.push(h);
+ for (i=0, j=0; i<2; ++j) {
+ if (points[j].index != -1) {
+ stack.push(points[j].index);
+ i++;
+ }
+ }
+ sp = stack.length;
+
+ // do graham's scan
+ for (; j<plen; ++j) {
+ if (points[j].index == -1) continue; // skip tossed out points
+ while (!d3_geom_hullCCW(stack[sp-2], stack[sp-1], points[j].index, vertices)) {
+ --sp;
+ }
+ stack[sp++] = points[j].index;
+ }
+
+ // construct the hull
+ var poly = [];
+ for (i=0; i<sp; ++i) {
+ poly.push(vertices[stack[i]]);
+ }
+ return poly;
+}
+
+// are three points in counter-clockwise order?
+function d3_geom_hullCCW(i1, i2, i3, v) {
+ var t, a, b, c, d, e, f;
+ t = v[i1]; a = t[0]; b = t[1];
+ t = v[i2]; c = t[0]; d = t[1];
+ t = v[i3]; e = t[0]; f = t[1];
+ return ((f-b)*(c-a) - (d-b)*(e-a)) > 0;
+}// Note: requires coordinates to be counterclockwise and convex!
+d3.geom.polygon = function(coordinates) {
+
+ coordinates.area = function() {
+ var i = 0,
+ n = coordinates.length,
+ a = coordinates[n - 1][0] * coordinates[0][1],
+ b = coordinates[n - 1][1] * coordinates[0][0];
+ while (++i < n) {
+ a += coordinates[i - 1][0] * coordinates[i][1];
+ b += coordinates[i - 1][1] * coordinates[i][0];
+ }
+ return (b - a) * .5;
+ };
+
+ coordinates.centroid = function(k) {
+ var i = -1,
+ n = coordinates.length - 1,
+ x = 0,
+ y = 0,
+ a,
+ b,
+ c;
+ if (!arguments.length) k = 1 / (6 * coordinates.area());
+ while (++i < n) {
+ a = coordinates[i];
+ b = coordinates[i + 1];
+ c = a[0] * b[1] - b[0] * a[1];
+ x += (a[0] + b[0]) * c;
+ y += (a[1] + b[1]) * c;
+ }
+ return [x * k, y * k];
+ };
+
+ // The Sutherland-Hodgman clipping algorithm.
+ coordinates.clip = function(subject) {
+ var input,
+ i = -1,
+ n = coordinates.length,
+ j,
+ m,
+ a = coordinates[n - 1],
+ b,
+ c,
+ d;
+ while (++i < n) {
+ input = subject.slice();
+ subject.length = 0;
+ b = coordinates[i];
+ c = input[(m = input.length) - 1];
+ j = -1;
+ while (++j < m) {
+ d = input[j];
+ if (d3_geom_polygonInside(d, a, b)) {
+ if (!d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ subject.push(d);
+ } else if (d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ c = d;
+ }
+ a = b;
+ }
+ return subject;
+ };
+
+ return coordinates;
+};
+
+function d3_geom_polygonInside(p, a, b) {
+ return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
+}
+
+// Intersect two infinite lines cd and ab.
+function d3_geom_polygonIntersect(c, d, a, b) {
+ var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0],
+ y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1],
+ x13 = x1 - x3,
+ x21 = x2 - x1,
+ x43 = x4 - x3,
+ y13 = y1 - y3,
+ y21 = y2 - y1,
+ y43 = y4 - y3,
+ ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21);
+ return [x1 + ua * x21, y1 + ua * y21];
+}
+// Adapted from Nicolas Garcia Belmonte's JIT implementation:
+// http://blog.thejit.org/2010/02/12/voronoi-tessellation/
+// http://blog.thejit.org/assets/voronoijs/voronoi.js
+// See lib/jit/LICENSE for details.
+
+/**
+ * @param vertices [[x1, y1], [x2, y2], …]
+ * @returns polygons [[[x1, y1], [x2, y2], …], …]
+ */
+d3.geom.voronoi = function(vertices) {
+ var polygons = vertices.map(function() { return []; });
+
+ // Note: we expect the caller to clip the polygons, if needed.
+ d3_voronoi_tessellate(vertices, function(e) {
+ var s1,
+ s2,
+ x1,
+ x2,
+ y1,
+ y2;
+ if (e.a == 1 && e.b >= 0) {
+ s1 = e.ep.r;
+ s2 = e.ep.l;
+ } else {
+ s1 = e.ep.l;
+ s2 = e.ep.r;
+ }
+ if (e.a == 1) {
+ y1 = s1 ? s1.y : -1e6;
+ x1 = e.c - e.b * y1;
+ y2 = s2 ? s2.y : 1e6;
+ x2 = e.c - e.b * y2;
+ } else {
+ x1 = s1 ? s1.x : -1e6;
+ y1 = e.c - e.a * x1;
+ x2 = s2 ? s2.x : 1e6;
+ y2 = e.c - e.a * x2;
+ }
+ var v1 = [x1, y1],
+ v2 = [x2, y2];
+ polygons[e.region.l.index].push(v1, v2);
+ polygons[e.region.r.index].push(v1, v2);
+ });
+
+ // Reconnect the polygon segments into counterclockwise loops.
+ return polygons.map(function(polygon, i) {
+ var cx = vertices[i][0],
+ cy = vertices[i][1];
+ polygon.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ return polygon.sort(function(a, b) {
+ return a.angle - b.angle;
+ }).filter(function(d, i) {
+ return !i || (d.angle - polygon[i - 1].angle > 1e-10);
+ });
+ });
+};
+
+var d3_voronoi_opposite = {"l": "r", "r": "l"};
+
+function d3_voronoi_tessellate(vertices, callback) {
+
+ var Sites = {
+ list: vertices
+ .map(function(v, i) {
+ return {
+ index: i,
+ x: v[0],
+ y: v[1]
+ };
+ })
+ .sort(function(a, b) {
+ return a.y < b.y ? -1
+ : a.y > b.y ? 1
+ : a.x < b.x ? -1
+ : a.x > b.x ? 1
+ : 0;
+ }),
+ bottomSite: null
+ };
+
+ var EdgeList = {
+ list: [],
+ leftEnd: null,
+ rightEnd: null,
+
+ init: function() {
+ EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.leftEnd.r = EdgeList.rightEnd;
+ EdgeList.rightEnd.l = EdgeList.leftEnd;
+ EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
+ },
+
+ createHalfEdge: function(edge, side) {
+ return {
+ edge: edge,
+ side: side,
+ vertex: null,
+ "l": null,
+ "r": null
+ };
+ },
+
+ insert: function(lb, he) {
+ he.l = lb;
+ he.r = lb.r;
+ lb.r.l = he;
+ lb.r = he;
+ },
+
+ leftBound: function(p) {
+ var he = EdgeList.leftEnd;
+ do {
+ he = he.r;
+ } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
+ he = he.l;
+ return he;
+ },
+
+ del: function(he) {
+ he.l.r = he.r;
+ he.r.l = he.l;
+ he.edge = null;
+ },
+
+ right: function(he) {
+ return he.r;
+ },
+
+ left: function(he) {
+ return he.l;
+ },
+
+ leftRegion: function(he) {
+ return he.edge == null
+ ? Sites.bottomSite
+ : he.edge.region[he.side];
+ },
+
+ rightRegion: function(he) {
+ return he.edge == null
+ ? Sites.bottomSite
+ : he.edge.region[d3_voronoi_opposite[he.side]];
+ }
+ };
+
+ var Geom = {
+
+ bisect: function(s1, s2) {
+ var newEdge = {
+ region: {"l": s1, "r": s2},
+ ep: {"l": null, "r": null}
+ };
+
+ var dx = s2.x - s1.x,
+ dy = s2.y - s1.y,
+ adx = dx > 0 ? dx : -dx,
+ ady = dy > 0 ? dy : -dy;
+
+ newEdge.c = s1.x * dx + s1.y * dy
+ + (dx * dx + dy * dy) * .5;
+
+ if (adx > ady) {
+ newEdge.a = 1;
+ newEdge.b = dy / dx;
+ newEdge.c /= dx;
+ } else {
+ newEdge.b = 1;
+ newEdge.a = dx / dy;
+ newEdge.c /= dy;
+ }
+
+ return newEdge;
+ },
+
+ intersect: function(el1, el2) {
+ var e1 = el1.edge,
+ e2 = el2.edge;
+ if (!e1 || !e2 || (e1.region.r == e2.region.r)) {
+ return null;
+ }
+ var d = (e1.a * e2.b) - (e1.b * e2.a);
+ if (Math.abs(d) < 1e-10) {
+ return null;
+ }
+ var xint = (e1.c * e2.b - e2.c * e1.b) / d,
+ yint = (e2.c * e1.a - e1.c * e2.a) / d,
+ e1r = e1.region.r,
+ e2r = e2.region.r,
+ el,
+ e;
+ if ((e1r.y < e2r.y) ||
+ (e1r.y == e2r.y && e1r.x < e2r.x)) {
+ el = el1;
+ e = e1;
+ } else {
+ el = el2;
+ e = e2;
+ }
+ var rightOfSite = (xint >= e.region.r.x);
+ if ((rightOfSite && (el.side == "l")) ||
+ (!rightOfSite && (el.side == "r"))) {
+ return null;
+ }
+ return {
+ x: xint,
+ y: yint
+ };
+ },
+
+ rightOf: function(he, p) {
+ var e = he.edge,
+ topsite = e.region.r,
+ rightOfSite = (p.x > topsite.x);
+
+ if (rightOfSite && (he.side == "l")) {
+ return 1;
+ }
+ if (!rightOfSite && (he.side == "r")) {
+ return 0;
+ }
+ if (e.a == 1) {
+ var dyp = p.y - topsite.y,
+ dxp = p.x - topsite.x,
+ fast = 0,
+ above = 0;
+
+ if ((!rightOfSite && (e.b < 0)) ||
+ (rightOfSite && (e.b >= 0))) {
+ above = fast = (dyp >= e.b * dxp);
+ } else {
+ above = ((p.x + p.y * e.b) > e.c);
+ if (e.b < 0) {
+ above = !above;
+ }
+ if (!above) {
+ fast = 1;
+ }
+ }
+ if (!fast) {
+ var dxs = topsite.x - e.region.l.x;
+ above = (e.b * (dxp * dxp - dyp * dyp)) <
+ (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b));
+
+ if (e.b < 0) {
+ above = !above;
+ }
+ }
+ } else /* e.b == 1 */ {
+ var yl = e.c - e.a * p.x,
+ t1 = p.y - yl,
+ t2 = p.x - topsite.x,
+ t3 = yl - topsite.y;
+
+ above = (t1 * t1) > (t2 * t2 + t3 * t3);
+ }
+ return he.side == "l" ? above : !above;
+ },
+
+ endPoint: function(edge, side, site) {
+ edge.ep[side] = site;
+ if (!edge.ep[d3_voronoi_opposite[side]]) return;
+ callback(edge);
+ },
+
+ distance: function(s, t) {
+ var dx = s.x - t.x,
+ dy = s.y - t.y;
+ return Math.sqrt(dx * dx + dy * dy);
+ }
+ };
+
+ var EventQueue = {
+ list: [],
+
+ insert: function(he, site, offset) {
+ he.vertex = site;
+ he.ystar = site.y + offset;
+ for (var i=0, list=EventQueue.list, l=list.length; i<l; i++) {
+ var next = list[i];
+ if (he.ystar > next.ystar ||
+ (he.ystar == next.ystar &&
+ site.x > next.vertex.x)) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ list.splice(i, 0, he);
+ },
+
+ del: function(he) {
+ for (var i=0, ls=EventQueue.list, l=ls.length; i<l && (ls[i] != he); ++i) {}
+ ls.splice(i, 1);
+ },
+
+ empty: function() { return EventQueue.list.length == 0; },
+
+ nextEvent: function(he) {
+ for (var i=0, ls=EventQueue.list, l=ls.length; i<l; ++i) {
+ if (ls[i] == he) return ls[i+1];
+ }
+ return null;
+ },
+
+ min: function() {
+ var elem = EventQueue.list[0];
+ return {
+ x: elem.vertex.x,
+ y: elem.ystar
+ };
+ },
+
+ extractMin: function() {
+ return EventQueue.list.shift();
+ }
+ };
+
+ EdgeList.init();
+ Sites.bottomSite = Sites.list.shift();
+
+ var newSite = Sites.list.shift(), newIntStar;
+ var lbnd, rbnd, llbnd, rrbnd, bisector;
+ var bot, top, temp, p, v;
+ var e, pm;
+
+ while (true) {
+ if (!EventQueue.empty()) {
+ newIntStar = EventQueue.min();
+ }
+ if (newSite && (EventQueue.empty()
+ || newSite.y < newIntStar.y
+ || (newSite.y == newIntStar.y
+ && newSite.x < newIntStar.x))) { //new site is smallest
+ lbnd = EdgeList.leftBound(newSite);
+ rbnd = EdgeList.right(lbnd);
+ bot = EdgeList.rightRegion(lbnd);
+ e = Geom.bisect(bot, newSite);
+ bisector = EdgeList.createHalfEdge(e, "l");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(lbnd, bisector);
+ if (p) {
+ EventQueue.del(lbnd);
+ EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
+ }
+ lbnd = bisector;
+ bisector = EdgeList.createHalfEdge(e, "r");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(bisector, rbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, newSite));
+ }
+ newSite = Sites.list.shift();
+ } else if (!EventQueue.empty()) { //intersection is smallest
+ lbnd = EventQueue.extractMin();
+ llbnd = EdgeList.left(lbnd);
+ rbnd = EdgeList.right(lbnd);
+ rrbnd = EdgeList.right(rbnd);
+ bot = EdgeList.leftRegion(lbnd);
+ top = EdgeList.rightRegion(rbnd);
+ v = lbnd.vertex;
+ Geom.endPoint(lbnd.edge, lbnd.side, v);
+ Geom.endPoint(rbnd.edge, rbnd.side, v);
+ EdgeList.del(lbnd);
+ EventQueue.del(rbnd);
+ EdgeList.del(rbnd);
+ pm = "l";
+ if (bot.y > top.y) {
+ temp = bot;
+ bot = top;
+ top = temp;
+ pm = "r";
+ }
+ e = Geom.bisect(bot, top);
+ bisector = EdgeList.createHalfEdge(e, pm);
+ EdgeList.insert(llbnd, bisector);
+ Geom.endPoint(e, d3_voronoi_opposite[pm], v);
+ p = Geom.intersect(llbnd, bisector);
+ if (p) {
+ EventQueue.del(llbnd);
+ EventQueue.insert(llbnd, p, Geom.distance(p, bot));
+ }
+ p = Geom.intersect(bisector, rrbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, bot));
+ }
+ } else {
+ break;
+ }
+ }//end while
+
+ for (lbnd = EdgeList.right(EdgeList.leftEnd);
+ lbnd != EdgeList.rightEnd;
+ lbnd = EdgeList.right(lbnd)) {
+ callback(lbnd.edge);
+ }
+}
+/**
+* @param vertices [[x1, y1], [x2, y2], …]
+* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …]
+ */
+d3.geom.delaunay = function(vertices) {
+ var edges = vertices.map(function() { return []; }),
+ triangles = [];
+
+ // Use the Voronoi tessellation to determine Delaunay edges.
+ d3_voronoi_tessellate(vertices, function(e) {
+ edges[e.region.l.index].push(vertices[e.region.r.index]);
+ });
+
+ // Reconnect the edges into counterclockwise triangles.
+ edges.forEach(function(edge, i) {
+ var v = vertices[i],
+ cx = v[0],
+ cy = v[1];
+ edge.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ edge.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ for (var j = 0, m = edge.length - 1; j < m; j++) {
+ triangles.push([v, edge[j], edge[j + 1]]);
+ }
+ });
+
+ return triangles;
+};
+/**
+ * Constructs a new quadtree for the specified array of points. A quadtree is a
+ * two-dimensional recursive spatial subdivision. This implementation uses
+ * square partitions, dividing each square into four equally-sized squares. Each
+ * point exists in a unique node; if multiple points are in the same position,
+ * some points may be stored on internal nodes rather than leaf nodes. Quadtrees
+ * can be used to accelerate various spatial operations, such as the Barnes-Hut
+ * approximation for computing n-body forces, or collision detection.
+ *
+ * @param points [[x1, y1], [x2, y2], …]
+ * @return quadtree root {left: boolean, nodes: […], point: [x, y]}
+ */
+d3.geom.quadtree = function(points) {
+ var p,
+ i = -1,
+ n = points.length;
+
+ /* Compute bounds. */
+ var x1 = Number.POSITIVE_INFINITY, y1 = x1,
+ x2 = Number.NEGATIVE_INFINITY, y2 = x2;
+ while (++i < n) {
+ p = points[i];
+ if (p[0] < x1) x1 = p[0];
+ if (p[1] < y1) y1 = p[1];
+ if (p[0] > x2) x2 = p[0];
+ if (p[1] > y2) y2 = p[1];
+ }
+
+ /* Squarify the bounds. */
+ var dx = x2 - x1,
+ dy = y2 - y1;
+ if (dx > dy) y2 = y1 + dx;
+ else x2 = x1 + dy;
+
+ /**
+ * @ignore Recursively inserts the specified point <i>p</i> at the node
+ * <i>n</i> or one of its descendants. The bounds are defined by [<i>x1</i>,
+ * <i>x2</i>] and [<i>y1</i>, <i>y2</i>].
+ */
+ function insert(n, p, x1, y1, x2, y2) {
+ if (isNaN(p[0]) || isNaN(p[1])) return; // ignore invalid points
+ if (n.leaf) {
+ var v = n.point;
+ if (v) {
+ /*
+ * If the point at this leaf node is at the same position as the new
+ * point we are adding, we leave the point associated with the
+ * internal node while adding the new point to a child node. This
+ * avoids infinite recursion.
+ */
+ if ((Math.abs(v[0] - p[0]) + Math.abs(v[1] - p[1])) < .01) {
+ insertChild(n, p, x1, y1, x2, y2);
+ } else {
+ n.point = null;
+ insertChild(n, v, x1, y1, x2, y2);
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ } else {
+ n.point = p;
+ }
+ } else {
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ }
+
+ /**
+ * @ignore Recursively inserts the specified point <i>p</i> into a
+ * descendant of node <i>n</i>. The bounds are defined by [<i>x1</i>,
+ * <i>x2</i>] and [<i>y1</i>, <i>y2</i>].
+ */
+ function insertChild(n, p, x1, y1, x2, y2) {
+ /* Compute the split point, and the quadrant in which to insert p. */
+ var sx = (x1 + x2) * .5,
+ sy = (y1 + y2) * .5,
+ right = p[0] >= sx,
+ bottom = p[1] >= sy,
+ i = (bottom << 1) + right;
+
+ /* Recursively insert into the child node. */
+ n.leaf = false;
+ n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
+
+ /* Update the bounds as we recurse. */
+ if (right) x1 = sx; else x2 = sx;
+ if (bottom) y1 = sy; else y2 = sy;
+ insert(n, p, x1, y1, x2, y2);
+ }
+
+ /* Create the root node. */
+ var root = d3_geom_quadtreeNode();
+
+ /* Insert all points. */
+ i = -1;
+ while (++i < n) insert(root, points[i], x1, y1, x2, y2);
+
+ /* Register a visitor function for the root. */
+ root.visit = function(f) {
+ d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
+ };
+
+ return root;
+};
+
+function d3_geom_quadtreeNode() {
+ return {
+ leaf: true,
+ nodes: [],
+ point: null
+ };
+}
+
+function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
+ if (!f(node, x1, y1, x2, y2)) {
+ var sx = (x1 + x2) * .5,
+ sy = (y1 + y2) * .5,
+ children = node.nodes;
+ if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
+ if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
+ if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
+ if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
+ }
+}
+})() \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.js
new file mode 100644
index 00000000..7655eb78
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.js
@@ -0,0 +1,5 @@
+!function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null===n?0/0:+n}function e(n){return!isNaN(n)}function r(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function u(n){return n.length}function i(n){for(var t=1;n*t%1;)t*=10;return t}function o(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function a(){this._=Object.create(null)}function c(n){return(n+="")===da||n[0]===ma?ma+n:n}function l(n){return(n+="")[0]===ma?n.slice(1):n}function s(n){return c(n)in this._}function f(n){return(n=c(n))in this._&&delete this._[n]}function h(){var n=[];for(var t in this._)n.push(l(t));return n}function g(){var n=0;for(var t in this._)++n;return n}function p(){for(var n in this._)return!1;return!0}function v(){this._=Object.create(null)}function d(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function m(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=ya.length;r>e;++e){var u=ya[e]+t;if(u in n)return u}}function y(){}function M(){}function x(n){function t(){for(var t,r=e,u=-1,i=r.length;++u<i;)(t=r[u].on)&&t.apply(this,arguments);return n}var e=[],r=new a;return t.on=function(t,u){var i,o=r.get(t);return arguments.length<2?o&&o.on:(o&&(o.on=null,e=e.slice(0,i=e.indexOf(o)).concat(e.slice(i+1)),r.remove(t)),u&&e.push(r.set(t,{on:u})),n)},t}function b(){ta.event.preventDefault()}function _(){for(var n,t=ta.event;n=t.sourceEvent;)t=n;return t}function w(n){for(var t=new M,e=0,r=arguments.length;++e<r;)t[arguments[e]]=x(t);return t.of=function(e,r){return function(u){try{var i=u.sourceEvent=ta.event;u.target=n,ta.event=u,t[u.type].apply(e,r)}finally{ta.event=i}}},t}function S(n){return xa(n,ka),n}function k(n){return"function"==typeof n?n:function(){return ba(n,this)}}function E(n){return"function"==typeof n?n:function(){return _a(n,this)}}function A(n,t){function e(){this.removeAttribute(n)}function r(){this.removeAttributeNS(n.space,n.local)}function u(){this.setAttribute(n,t)}function i(){this.setAttributeNS(n.space,n.local,t)}function o(){var e=t.apply(this,arguments);null==e?this.removeAttribute(n):this.setAttribute(n,e)}function a(){var e=t.apply(this,arguments);null==e?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}return n=ta.ns.qualify(n),null==t?n.local?r:e:"function"==typeof t?n.local?a:o:n.local?i:u}function N(n){return n.trim().replace(/\s+/g," ")}function C(n){return new RegExp("(?:^|\\s+)"+ta.requote(n)+"(?:\\s+|$)","g")}function z(n){return(n+"").trim().split(/^|\s+/)}function q(n,t){function e(){for(var e=-1;++e<u;)n[e](this,t)}function r(){for(var e=-1,r=t.apply(this,arguments);++e<u;)n[e](this,r)}n=z(n).map(L);var u=n.length;return"function"==typeof t?r:e}function L(n){var t=C(n);return function(e,r){if(u=e.classList)return r?u.add(n):u.remove(n);var u=e.getAttribute("class")||"";r?(t.lastIndex=0,t.test(u)||e.setAttribute("class",N(u+" "+n))):e.setAttribute("class",N(u.replace(t," ")))}}function T(n,t,e){function r(){this.style.removeProperty(n)}function u(){this.style.setProperty(n,t,e)}function i(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,e)}return null==t?r:"function"==typeof t?i:u}function R(n,t){function e(){delete this[n]}function r(){this[n]=t}function u(){var e=t.apply(this,arguments);null==e?delete this[n]:this[n]=e}return null==t?e:"function"==typeof t?u:r}function D(n){return"function"==typeof n?n:(n=ta.ns.qualify(n)).local?function(){return this.ownerDocument.createElementNS(n.space,n.local)}:function(){return this.ownerDocument.createElementNS(this.namespaceURI,n)}}function P(){var n=this.parentNode;n&&n.removeChild(this)}function U(n){return{__data__:n}}function j(n){return function(){return Sa(this,n)}}function F(t){return arguments.length||(t=n),function(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}}function H(n,t){for(var e=0,r=n.length;r>e;e++)for(var u,i=n[e],o=0,a=i.length;a>o;o++)(u=i[o])&&t(u,o,e);return n}function O(n){return xa(n,Aa),n}function Y(n){var t,e;return function(r,u,i){var o,a=n[i].update,c=a.length;for(i!=e&&(e=i,t=0),u>=t&&(t=u+1);!(o=a[t])&&++t<c;);return o}}function I(n){var t=n.__transition__;t&&++t.active}function Z(n,t,e){function r(){var t=this[o];t&&(this.removeEventListener(n,t,t.$),delete this[o])}function u(){var u=c(t,ra(arguments));r.call(this),this.addEventListener(n,this[o]=u,u.$=e),u._=t}function i(){var t,e=new RegExp("^__on([^.]+)"+ta.requote(n)+"$");for(var r in this)if(t=r.match(e)){var u=this[r];this.removeEventListener(t[1],u,u.$),delete this[r]}}var o="__on"+n,a=n.indexOf("."),c=V;a>0&&(n=n.slice(0,a));var l=Ca.get(n);return l&&(n=l,c=X),a?t?u:r:t?y:i}function V(n,t){return function(e){var r=ta.event;ta.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{ta.event=r}}}function X(n,t){var e=V(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function $(){var n=".dragsuppress-"+ ++qa,t="click"+n,e=ta.select(oa).on("touchmove"+n,b).on("dragstart"+n,b).on("selectstart"+n,b);if(za){var r=ia.style,u=r[za];r[za]="none"}return function(i){if(e.on(n,null),za&&(r[za]=u),i){var o=function(){e.on(t,null)};e.on(t,function(){b(),o()},!0),setTimeout(o,0)}}}function B(n,t){t.changedTouches&&(t=t.changedTouches[0]);var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>La&&(oa.scrollX||oa.scrollY)){e=ta.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e[0][0].getScreenCTM();La=!(u.f||u.e),e.remove()}return La?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}function W(){return ta.event.changedTouches[0].identifier}function J(){return ta.event.target}function G(){return oa}function K(n){return n>0?1:0>n?-1:0}function Q(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function nt(n){return n>1?0:-1>n?Da:Math.acos(n)}function tt(n){return n>1?ja:-1>n?-ja:Math.asin(n)}function et(n){return((n=Math.exp(n))-1/n)/2}function rt(n){return((n=Math.exp(n))+1/n)/2}function ut(n){return((n=Math.exp(2*n))-1)/(n+1)}function it(n){return(n=Math.sin(n/2))*n}function ot(){}function at(n,t,e){return this instanceof at?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof at?new at(n.h,n.s,n.l):bt(""+n,_t,at):new at(n,t,e)}function ct(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?i+(o-i)*n/60:180>n?o:240>n?i+(o-i)*(240-n)/60:i}function u(n){return Math.round(255*r(n))}var i,o;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,i=2*e-o,new mt(u(n+120),u(n),u(n-120))}function lt(n,t,e){return this instanceof lt?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof lt?new lt(n.h,n.c,n.l):n instanceof ft?gt(n.l,n.a,n.b):gt((n=wt((n=ta.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new lt(n,t,e)}function st(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new ft(e,Math.cos(n*=Fa)*t,Math.sin(n)*t)}function ft(n,t,e){return this instanceof ft?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof ft?new ft(n.l,n.a,n.b):n instanceof lt?st(n.h,n.c,n.l):wt((n=mt(n)).r,n.g,n.b):new ft(n,t,e)}function ht(n,t,e){var r=(n+16)/116,u=r+t/500,i=r-e/200;return u=pt(u)*Ja,r=pt(r)*Ga,i=pt(i)*Ka,new mt(dt(3.2404542*u-1.5371385*r-.4985314*i),dt(-.969266*u+1.8760108*r+.041556*i),dt(.0556434*u-.2040259*r+1.0572252*i))}function gt(n,t,e){return n>0?new lt(Math.atan2(e,t)*Ha,Math.sqrt(t*t+e*e),n):new lt(0/0,0/0,n)}function pt(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function vt(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function dt(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function mt(n,t,e){return this instanceof mt?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof mt?new mt(n.r,n.g,n.b):bt(""+n,mt,ct):new mt(n,t,e)}function yt(n){return new mt(n>>16,255&n>>8,255&n)}function Mt(n){return yt(n)+""}function xt(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function bt(n,t,e){var r,u,i,o=0,a=0,c=0;if(r=/([a-z]+)\((.*)\)/i.exec(n))switch(u=r[2].split(","),r[1]){case"hsl":return e(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(kt(u[0]),kt(u[1]),kt(u[2]))}return(i=tc.get(n))?t(i.r,i.g,i.b):(null==n||"#"!==n.charAt(0)||isNaN(i=parseInt(n.slice(1),16))||(4===n.length?(o=(3840&i)>>4,o=o>>4|o,a=240&i,a=a>>4|a,c=15&i,c=c<<4|c):7===n.length&&(o=(16711680&i)>>16,a=(65280&i)>>8,c=255&i)),t(o,a,c))}function _t(n,t,e){var r,u,i=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-i,c=(o+i)/2;return a?(u=.5>c?a/(o+i):a/(2-o-i),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=0/0,u=c>0&&1>c?0:r),new at(r,u,c)}function wt(n,t,e){n=St(n),t=St(t),e=St(e);var r=vt((.4124564*n+.3575761*t+.1804375*e)/Ja),u=vt((.2126729*n+.7151522*t+.072175*e)/Ga),i=vt((.0193339*n+.119192*t+.9503041*e)/Ka);return ft(116*u-16,500*(r-u),200*(u-i))}function St(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function kt(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function Et(n){return"function"==typeof n?n:function(){return n}}function At(n){return n}function Nt(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Ct(t,e,n,r)}}function Ct(n,t,e,r){function u(){var n,t=c.status;if(!t&&qt(c)||t>=200&&300>t||304===t){try{n=e.call(i,c)}catch(r){return o.error.call(i,r),void 0}o.load.call(i,n)}else o.error.call(i,c)}var i={},o=ta.dispatch("beforesend","progress","load","error"),a={},c=new XMLHttpRequest,l=null;return!oa.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=u:c.onreadystatechange=function(){c.readyState>3&&u()},c.onprogress=function(n){var t=ta.event;ta.event=n;try{o.progress.call(i,c)}finally{ta.event=t}},i.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",i)},i.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",i):t},i.responseType=function(n){return arguments.length?(l=n,i):l},i.response=function(n){return e=n,i},["get","post"].forEach(function(n){i[n]=function(){return i.send.apply(i,[n].concat(ra(arguments)))}}),i.send=function(e,r,u){if(2===arguments.length&&"function"==typeof r&&(u=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var s in a)c.setRequestHeader(s,a[s]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=u&&i.on("error",u).on("load",function(n){u(null,n)}),o.beforesend.call(i,c),c.send(null==r?null:r),i},i.abort=function(){return c.abort(),i},ta.rebind(i,o,"on"),null==r?i:i.get(zt(r))}function zt(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function qt(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function Lt(){var n=Tt(),t=Rt()-n;t>24?(isFinite(t)&&(clearTimeout(ic),ic=setTimeout(Lt,t)),uc=0):(uc=1,ac(Lt))}function Tt(){var n=Date.now();for(oc=ec;oc;)n>=oc.t&&(oc.f=oc.c(n-oc.t)),oc=oc.n;return n}function Rt(){for(var n,t=ec,e=1/0;t;)t.f?t=n?n.n=t.n:ec=t.n:(t.t<e&&(e=t.t),t=(n=t).n);return rc=n,e}function Dt(n,t){return t-(n?Math.ceil(Math.log(n)/Math.LN10):1)}function Pt(n,t){var e=Math.pow(10,3*va(8-t));return{scale:t>8?function(n){return n/e}:function(n){return n*e},symbol:n}}function Ut(n){var t=n.decimal,e=n.thousands,r=n.grouping,u=n.currency,i=r&&e?function(n,t){for(var u=n.length,i=[],o=0,a=r[0],c=0;u>0&&a>0&&(c+a+1>t&&(a=Math.max(1,t-c)),i.push(n.substring(u-=a,u+a)),!((c+=a+1)>t));)a=r[o=(o+1)%r.length];return i.reverse().join(e)}:At;return function(n){var e=lc.exec(n),r=e[1]||" ",o=e[2]||">",a=e[3]||"-",c=e[4]||"",l=e[5],s=+e[6],f=e[7],h=e[8],g=e[9],p=1,v="",d="",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(l||"0"===r&&"="===o)&&(l=r="0",o="="),g){case"n":f=!0,g="g";break;case"%":p=100,d="%",g="f";break;case"p":p=100,d="%",g="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+g.toLowerCase());case"c":y=!1;case"d":m=!0,h=0;break;case"s":p=-1,g="r"}"$"===c&&(v=u[0],d=u[1]),"r"!=g||h||(g="g"),null!=h&&("g"==g?h=Math.max(1,Math.min(21,h)):("e"==g||"f"==g)&&(h=Math.max(0,Math.min(20,h)))),g=sc.get(g)||jt;var M=l&&f;return function(n){var e=d;if(m&&n%1)return"";var u=0>n||0===n&&0>1/n?(n=-n,"-"):"-"===a?"":a;if(0>p){var c=ta.formatPrefix(n,h);n=c.scale(n),e=c.symbol+d}else n*=p;n=g(n,h);var x,b,_=n.lastIndexOf(".");if(0>_){var w=y?n.lastIndexOf("e"):-1;0>w?(x=n,b=""):(x=n.substring(0,w),b=n.substring(w))}else x=n.substring(0,_),b=t+n.substring(_+1);!l&&f&&(x=i(x,1/0));var S=v.length+x.length+b.length+(M?0:u.length),k=s>S?new Array(S=s-S+1).join(r):"";return M&&(x=i(k+x,k.length?s-b.length:1/0)),u+=v,n=x+b,("<"===o?u+n+k:">"===o?k+u+n:"^"===o?k.substring(0,S>>=1)+u+n+k.substring(S):u+(M?n:k+n))+e}}}function jt(n){return n+""}function Ft(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(n,t,e){function r(t){var e=n(t),r=i(e,1);return r-t>t-e?e:r}function u(e){return t(e=n(new hc(e-1)),1),e}function i(n,e){return t(n=new hc(+n),e),n}function o(n,r,i){var o=u(n),a=[];if(i>1)for(;r>o;)e(o)%i||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{hc=Ft;var r=new Ft;return r._=n,o(r,t,e)}finally{hc=Date}}n.floor=n,n.round=r,n.ceil=u,n.offset=i,n.range=o;var c=n.utc=Ot(n);return c.floor=c,c.round=Ot(r),c.ceil=Ot(u),c.offset=Ot(i),c.range=a,n}function Ot(n){return function(t,e){try{hc=Ft;var r=new Ft;return r._=t,n(r,e)._}finally{hc=Date}}}function Yt(n){function t(n){function t(t){for(var e,u,i,o=[],a=-1,c=0;++a<r;)37===n.charCodeAt(a)&&(o.push(n.slice(c,a)),null!=(u=pc[e=n.charAt(++a)])&&(e=n.charAt(++a)),(i=N[e])&&(e=i(t,null==u?"e"===e?" ":"0":u)),o.push(e),c=a+1);return o.push(n.slice(c,a)),o.join("")}var r=n.length;return t.parse=function(t){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},u=e(r,n,t,0);if(u!=t.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var i=null!=r.Z&&hc!==Ft,o=new(i?Ft:hc);return"j"in r?o.setFullYear(r.y,0,r.j):"w"in r&&("W"in r||"U"in r)?(o.setFullYear(r.y,0,1),o.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(o.getDay()+5)%7:r.w+7*r.U-(o.getDay()+6)%7)):o.setFullYear(r.y,r.m,r.d),o.setHours(r.H+(0|r.Z/100),r.M+r.Z%100,r.S,r.L),i?o._:o},t.toString=function(){return n},t}function e(n,t,e,r){for(var u,i,o,a=0,c=t.length,l=e.length;c>a;){if(r>=l)return-1;if(u=t.charCodeAt(a++),37===u){if(o=t.charAt(a++),i=C[o in pc?t.charAt(a++):o],!i||(r=i(n,e,r))<0)return-1}else if(u!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){_.lastIndex=0;var r=_.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){x.lastIndex=0;var r=x.exec(t.slice(e));return r?(n.w=b.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){E.lastIndex=0;var r=E.exec(t.slice(e));return r?(n.m=A.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.slice(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,N.c.toString(),t,r)}function c(n,t,r){return e(n,N.x.toString(),t,r)}function l(n,t,r){return e(n,N.X.toString(),t,r)}function s(n,t,e){var r=M.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,g=n.time,p=n.periods,v=n.days,d=n.shortDays,m=n.months,y=n.shortMonths;t.utc=function(n){function e(n){try{hc=Ft;var t=new hc;return t._=n,r(t)}finally{hc=Date}}var r=t(n);return e.parse=function(n){try{hc=Ft;var t=r.parse(n);return t&&t._}finally{hc=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ce;var M=ta.map(),x=Zt(v),b=Vt(v),_=Zt(d),w=Vt(d),S=Zt(m),k=Vt(m),E=Zt(y),A=Vt(y);p.forEach(function(n,t){M.set(n.toLowerCase(),t)});var N={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return y[n.getMonth()]},B:function(n){return m[n.getMonth()]},c:t(f),d:function(n,t){return It(n.getDate(),t,2)},e:function(n,t){return It(n.getDate(),t,2)},H:function(n,t){return It(n.getHours(),t,2)},I:function(n,t){return It(n.getHours()%12||12,t,2)},j:function(n,t){return It(1+fc.dayOfYear(n),t,3)},L:function(n,t){return It(n.getMilliseconds(),t,3)},m:function(n,t){return It(n.getMonth()+1,t,2)},M:function(n,t){return It(n.getMinutes(),t,2)},p:function(n){return p[+(n.getHours()>=12)]},S:function(n,t){return It(n.getSeconds(),t,2)},U:function(n,t){return It(fc.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return It(fc.mondayOfYear(n),t,2)},x:t(h),X:t(g),y:function(n,t){return It(n.getFullYear()%100,t,2)},Y:function(n,t){return It(n.getFullYear()%1e4,t,4)},Z:oe,"%":function(){return"%"}},C={a:r,A:u,b:i,B:o,c:a,d:ne,e:ne,H:ee,I:ee,j:te,L:ie,m:Qt,M:re,p:s,S:ue,U:$t,w:Xt,W:Bt,x:c,X:l,y:Jt,Y:Wt,Z:Gt,"%":ae};return t}function It(n,t,e){var r=0>n?"-":"",u=(r?-n:n)+"",i=u.length;return r+(e>i?new Array(e-i+1).join(t)+u:u)}function Zt(n){return new RegExp("^(?:"+n.map(ta.requote).join("|")+")","i")}function Vt(n){for(var t=new a,e=-1,r=n.length;++e<r;)t.set(n[e].toLowerCase(),e);return t}function Xt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+1));return r?(n.w=+r[0],e+r[0].length):-1}function $t(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e));return r?(n.U=+r[0],e+r[0].length):-1}function Bt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e));return r?(n.W=+r[0],e+r[0].length):-1}function Wt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+4));return r?(n.y=+r[0],e+r[0].length):-1}function Jt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.y=Kt(+r[0]),e+r[0].length):-1}function Gt(n,t,e){return/^[+-]\d{4}$/.test(t=t.slice(e,e+5))?(n.Z=-t,e+5):-1}function Kt(n){return n+(n>68?1900:2e3)}function Qt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function ne(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function te(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function ee(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function re(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function ue(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ie(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function oe(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=0|va(t)/60,u=va(t)%60;return e+It(r,"0",2)+It(u,"0",2)}function ae(n,t,e){dc.lastIndex=0;var r=dc.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ce(n){for(var t=n.length,e=-1;++e<t;)n[e][0]=this(n[e][0]);return function(t){for(var e=0,r=n[e];!r[1](t);)r=n[++e];return r[0](t)}}function le(){}function se(n,t,e){var r=e.s=n+t,u=r-n,i=r-u;e.t=n-i+(t-u)}function fe(n,t){n&&xc.hasOwnProperty(n.type)&&xc[n.type](n,t)}function he(n,t,e){var r,u=-1,i=n.length-e;for(t.lineStart();++u<i;)r=n[u],t.point(r[0],r[1],r[2]);t.lineEnd()}function ge(n,t){var e=-1,r=n.length;for(t.polygonStart();++e<r;)he(n[e],t,1);t.polygonEnd()}function pe(){function n(n,t){n*=Fa,t=t*Fa/2+Da/4;var e=n-r,o=e>=0?1:-1,a=o*e,c=Math.cos(t),l=Math.sin(t),s=i*l,f=u*c+s*Math.cos(a),h=s*o*Math.sin(a);_c.add(Math.atan2(h,f)),r=n,u=c,i=l}var t,e,r,u,i;wc.point=function(o,a){wc.point=n,r=(t=o)*Fa,u=Math.cos(a=(e=a)*Fa/2+Da/4),i=Math.sin(a)},wc.lineEnd=function(){n(t,e)}}function ve(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function de(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function me(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function ye(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function Me(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function xe(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function be(n){return[Math.atan2(n[1],n[0]),tt(n[2])]}function _e(n,t){return va(n[0]-t[0])<Ta&&va(n[1]-t[1])<Ta}function we(n,t){n*=Fa;var e=Math.cos(t*=Fa);Se(e*Math.cos(n),e*Math.sin(n),Math.sin(t))}function Se(n,t,e){++Sc,Ec+=(n-Ec)/Sc,Ac+=(t-Ac)/Sc,Nc+=(e-Nc)/Sc}function ke(){function n(n,u){n*=Fa;var i=Math.cos(u*=Fa),o=i*Math.cos(n),a=i*Math.sin(n),c=Math.sin(u),l=Math.atan2(Math.sqrt((l=e*c-r*a)*l+(l=r*o-t*c)*l+(l=t*a-e*o)*l),t*o+e*a+r*c);kc+=l,Cc+=l*(t+(t=o)),zc+=l*(e+(e=a)),qc+=l*(r+(r=c)),Se(t,e,r)}var t,e,r;Dc.point=function(u,i){u*=Fa;var o=Math.cos(i*=Fa);t=o*Math.cos(u),e=o*Math.sin(u),r=Math.sin(i),Dc.point=n,Se(t,e,r)}}function Ee(){Dc.point=we}function Ae(){function n(n,t){n*=Fa;var e=Math.cos(t*=Fa),o=e*Math.cos(n),a=e*Math.sin(n),c=Math.sin(t),l=u*c-i*a,s=i*o-r*c,f=r*a-u*o,h=Math.sqrt(l*l+s*s+f*f),g=r*o+u*a+i*c,p=h&&-nt(g)/h,v=Math.atan2(h,g);Lc+=p*l,Tc+=p*s,Rc+=p*f,kc+=v,Cc+=v*(r+(r=o)),zc+=v*(u+(u=a)),qc+=v*(i+(i=c)),Se(r,u,i)}var t,e,r,u,i;Dc.point=function(o,a){t=o,e=a,Dc.point=n,o*=Fa;var c=Math.cos(a*=Fa);r=c*Math.cos(o),u=c*Math.sin(o),i=Math.sin(a),Se(r,u,i)},Dc.lineEnd=function(){n(t,e),Dc.lineEnd=Ee,Dc.point=we}}function Ne(n,t){function e(e,r){return e=n(e,r),t(e[0],e[1])}return n.invert&&t.invert&&(e.invert=function(e,r){return e=t.invert(e,r),e&&n.invert(e[0],e[1])}),e}function Ce(){return!0}function ze(n,t,e,r,u){var i=[],o=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,e=n[0],r=n[t];if(_e(e,r)){u.lineStart();for(var a=0;t>a;++a)u.point((e=n[a])[0],e[1]);return u.lineEnd(),void 0}var c=new Le(e,n,null,!0),l=new Le(e,null,c,!1);c.o=l,i.push(c),o.push(l),c=new Le(r,n,null,!1),l=new Le(r,null,c,!0),c.o=l,i.push(c),o.push(l)}}),o.sort(t),qe(i),qe(o),i.length){for(var a=0,c=e,l=o.length;l>a;++a)o[a].e=c=!c;for(var s,f,h=i[0];;){for(var g=h,p=!0;g.v;)if((g=g.n)===h)return;s=g.z,u.lineStart();do{if(g.v=g.o.v=!0,g.e){if(p)for(var a=0,l=s.length;l>a;++a)u.point((f=s[a])[0],f[1]);else r(g.x,g.n.x,1,u);g=g.n}else{if(p){s=g.p.z;for(var a=s.length-1;a>=0;--a)u.point((f=s[a])[0],f[1])}else r(g.x,g.p.x,-1,u);g=g.p}g=g.o,s=g.z,p=!p}while(!g.v);u.lineEnd()}}}function qe(n){if(t=n.length){for(var t,e,r=0,u=n[0];++r<t;)u.n=e=n[r],e.p=u,u=e;u.n=e=n[0],e.p=u}}function Le(n,t,e,r){this.x=n,this.z=t,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function Te(n,t,e,r){return function(u,i){function o(t,e){var r=u(t,e);n(t=r[0],e=r[1])&&i.point(t,e)}function a(n,t){var e=u(n,t);d.point(e[0],e[1])}function c(){y.point=a,d.lineStart()}function l(){y.point=o,d.lineEnd()}function s(n,t){v.push([n,t]);var e=u(n,t);x.point(e[0],e[1])}function f(){x.lineStart(),v=[]}function h(){s(v[0][0],v[0][1]),x.lineEnd();var n,t=x.clean(),e=M.buffer(),r=e.length;if(v.pop(),p.push(v),v=null,r)if(1&t){n=e[0];var u,r=n.length-1,o=-1;if(r>0){for(b||(i.polygonStart(),b=!0),i.lineStart();++o<r;)i.point((u=n[o])[0],u[1]);i.lineEnd()}}else r>1&&2&t&&e.push(e.pop().concat(e.shift())),g.push(e.filter(Re))}var g,p,v,d=t(i),m=u.invert(r[0],r[1]),y={point:o,lineStart:c,lineEnd:l,polygonStart:function(){y.point=s,y.lineStart=f,y.lineEnd=h,g=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=c,y.lineEnd=l,g=ta.merge(g);var n=He(m,p);g.length?(b||(i.polygonStart(),b=!0),ze(g,Pe,n,e,i)):n&&(b||(i.polygonStart(),b=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),g=p=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}},M=De(),x=t(M),b=!1;return y}}function Re(n){return n.length>1}function De(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:y,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Pe(n,t){return((n=n.x)[0]<0?n[1]-ja-Ta:ja-n[1])-((t=t.x)[0]<0?t[1]-ja-Ta:ja-t[1])}function Ue(n){var t,e=0/0,r=0/0,u=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(i,o){var a=i>0?Da:-Da,c=va(i-e);va(c-Da)<Ta?(n.point(e,r=(r+o)/2>0?ja:-ja),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(i,r),t=0):u!==a&&c>=Da&&(va(e-u)<Ta&&(e-=u*Ta),va(i-a)<Ta&&(i-=a*Ta),r=je(e,r,i,o),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),t=0),n.point(e=i,r=o),u=a},lineEnd:function(){n.lineEnd(),e=r=0/0},clean:function(){return 2-t}}}function je(n,t,e,r){var u,i,o=Math.sin(n-e);return va(o)>Ta?Math.atan((Math.sin(t)*(i=Math.cos(r))*Math.sin(e)-Math.sin(r)*(u=Math.cos(t))*Math.sin(n))/(u*i*o)):(t+r)/2}function Fe(n,t,e,r){var u;if(null==n)u=e*ja,r.point(-Da,u),r.point(0,u),r.point(Da,u),r.point(Da,0),r.point(Da,-u),r.point(0,-u),r.point(-Da,-u),r.point(-Da,0),r.point(-Da,u);else if(va(n[0]-t[0])>Ta){var i=n[0]<t[0]?Da:-Da;u=e*i/2,r.point(-i,u),r.point(0,u),r.point(i,u)}else r.point(t[0],t[1])}function He(n,t){var e=n[0],r=n[1],u=[Math.sin(e),-Math.cos(e),0],i=0,o=0;_c.reset();for(var a=0,c=t.length;c>a;++a){var l=t[a],s=l.length;if(s)for(var f=l[0],h=f[0],g=f[1]/2+Da/4,p=Math.sin(g),v=Math.cos(g),d=1;;){d===s&&(d=0),n=l[d];var m=n[0],y=n[1]/2+Da/4,M=Math.sin(y),x=Math.cos(y),b=m-h,_=b>=0?1:-1,w=_*b,S=w>Da,k=p*M;if(_c.add(Math.atan2(k*_*Math.sin(w),v*x+k*Math.cos(w))),i+=S?b+_*Pa:b,S^h>=e^m>=e){var E=me(ve(f),ve(n));xe(E);var A=me(u,E);xe(A);var N=(S^b>=0?-1:1)*tt(A[2]);(r>N||r===N&&(E[0]||E[1]))&&(o+=S^b>=0?1:-1)}if(!d++)break;h=m,p=M,v=x,f=n}}return(-Ta>i||Ta>i&&0>_c)^1&o}function Oe(n){function t(n,t){return Math.cos(n)*Math.cos(t)>i}function e(n){var e,i,c,l,s;return{lineStart:function(){l=c=!1,s=1},point:function(f,h){var g,p=[f,h],v=t(f,h),d=o?v?0:u(f,h):v?u(f+(0>f?Da:-Da),h):0;if(!e&&(l=c=v)&&n.lineStart(),v!==c&&(g=r(e,p),(_e(e,g)||_e(p,g))&&(p[0]+=Ta,p[1]+=Ta,v=t(p[0],p[1]))),v!==c)s=0,v?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(a&&e&&o^v){var m;d&i||!(m=r(p,e,!0))||(s=0,o?(n.lineStart(),n.point(m[0][0],m[0][1]),n.point(m[1][0],m[1][1]),n.lineEnd()):(n.point(m[1][0],m[1][1]),n.lineEnd(),n.lineStart(),n.point(m[0][0],m[0][1])))}!v||e&&_e(e,p)||n.point(p[0],p[1]),e=p,c=v,i=d},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return s|(l&&c)<<1}}}function r(n,t,e){var r=ve(n),u=ve(t),o=[1,0,0],a=me(r,u),c=de(a,a),l=a[0],s=c-l*l;if(!s)return!e&&n;var f=i*c/s,h=-i*l/s,g=me(o,a),p=Me(o,f),v=Me(a,h);ye(p,v);var d=g,m=de(p,d),y=de(d,d),M=m*m-y*(de(p,p)-1);if(!(0>M)){var x=Math.sqrt(M),b=Me(d,(-m-x)/y);if(ye(b,p),b=be(b),!e)return b;var _,w=n[0],S=t[0],k=n[1],E=t[1];w>S&&(_=w,w=S,S=_);var A=S-w,N=va(A-Da)<Ta,C=N||Ta>A;if(!N&&k>E&&(_=k,k=E,E=_),C?N?k+E>0^b[1]<(va(b[0]-w)<Ta?k:E):k<=b[1]&&b[1]<=E:A>Da^(w<=b[0]&&b[0]<=S)){var z=Me(d,(-m+x)/y);return ye(z,p),[b,be(z)]}}}function u(t,e){var r=o?n:Da-n,u=0;return-r>t?u|=1:t>r&&(u|=2),-r>e?u|=4:e>r&&(u|=8),u}var i=Math.cos(n),o=i>0,a=va(i)>Ta,c=pr(n,6*Fa);return Te(t,e,c,o?[0,-n]:[-Da,n-Da])}function Ye(n,t,e,r){return function(u){var i,o=u.a,a=u.b,c=o.x,l=o.y,s=a.x,f=a.y,h=0,g=1,p=s-c,v=f-l;if(i=n-c,p||!(i>0)){if(i/=p,0>p){if(h>i)return;g>i&&(g=i)}else if(p>0){if(i>g)return;i>h&&(h=i)}if(i=e-c,p||!(0>i)){if(i/=p,0>p){if(i>g)return;i>h&&(h=i)}else if(p>0){if(h>i)return;g>i&&(g=i)}if(i=t-l,v||!(i>0)){if(i/=v,0>v){if(h>i)return;g>i&&(g=i)}else if(v>0){if(i>g)return;i>h&&(h=i)}if(i=r-l,v||!(0>i)){if(i/=v,0>v){if(i>g)return;i>h&&(h=i)}else if(v>0){if(h>i)return;g>i&&(g=i)}return h>0&&(u.a={x:c+h*p,y:l+h*v}),1>g&&(u.b={x:c+g*p,y:l+g*v}),u}}}}}}function Ie(n,t,e,r){function u(r,u){return va(r[0]-n)<Ta?u>0?0:3:va(r[0]-e)<Ta?u>0?2:1:va(r[1]-t)<Ta?u>0?1:0:u>0?3:2}function i(n,t){return o(n.x,t.x)}function o(n,t){var e=u(n,1),r=u(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function c(n){for(var t=0,e=d.length,r=n[1],u=0;e>u;++u)for(var i,o=1,a=d[u],c=a.length,l=a[0];c>o;++o)i=a[o],l[1]<=r?i[1]>r&&Q(l,i,n)>0&&++t:i[1]<=r&&Q(l,i,n)<0&&--t,l=i;return 0!==t}function l(i,a,c,l){var s=0,f=0;if(null==i||(s=u(i,c))!==(f=u(a,c))||o(i,a)<0^c>0){do l.point(0===s||3===s?n:e,s>1?r:t);while((s=(s+c+4)%4)!==f)}else l.point(a[0],a[1])}function s(u,i){return u>=n&&e>=u&&i>=t&&r>=i}function f(n,t){s(n,t)&&a.point(n,t)}function h(){C.point=p,d&&d.push(m=[]),S=!0,w=!1,b=_=0/0}function g(){v&&(p(y,M),x&&w&&A.rejoin(),v.push(A.buffer())),C.point=f,w&&a.lineEnd()}function p(n,t){n=Math.max(-Uc,Math.min(Uc,n)),t=Math.max(-Uc,Math.min(Uc,t));var e=s(n,t);if(d&&m.push([n,t]),S)y=n,M=t,x=e,S=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&w)a.point(n,t);else{var r={a:{x:b,y:_},b:{x:n,y:t}};N(r)?(w||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),k=!1):e&&(a.lineStart(),a.point(n,t),k=!1)}b=n,_=t,w=e}var v,d,m,y,M,x,b,_,w,S,k,E=a,A=De(),N=Ye(n,t,e,r),C={point:f,lineStart:h,lineEnd:g,polygonStart:function(){a=A,v=[],d=[],k=!0},polygonEnd:function(){a=E,v=ta.merge(v);var t=c([n,r]),e=k&&t,u=v.length;(e||u)&&(a.polygonStart(),e&&(a.lineStart(),l(null,null,1,a),a.lineEnd()),u&&ze(v,i,t,l,a),a.polygonEnd()),v=d=m=null}};return C}}function Ze(n){var t=0,e=Da/3,r=or(n),u=r(t,e);return u.parallels=function(n){return arguments.length?r(t=n[0]*Da/180,e=n[1]*Da/180):[180*(t/Da),180*(e/Da)]},u}function Ve(n,t){function e(n,t){var e=Math.sqrt(i-2*u*Math.sin(t))/u;return[e*Math.sin(n*=u),o-e*Math.cos(n)]}var r=Math.sin(n),u=(r+Math.sin(t))/2,i=1+r*(2*u-r),o=Math.sqrt(i)/u;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/u,tt((i-(n*n+e*e)*u*u)/(2*u))]},e}function Xe(){function n(n,t){Fc+=u*n-r*t,r=n,u=t}var t,e,r,u;Zc.point=function(i,o){Zc.point=n,t=r=i,e=u=o},Zc.lineEnd=function(){n(t,e)}}function $e(n,t){Hc>n&&(Hc=n),n>Yc&&(Yc=n),Oc>t&&(Oc=t),t>Ic&&(Ic=t)}function Be(){function n(n,t){o.push("M",n,",",t,i)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function u(){o.push("Z")}var i=We(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return i=We(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function We(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Je(n,t){Ec+=n,Ac+=t,++Nc}function Ge(){function n(n,r){var u=n-t,i=r-e,o=Math.sqrt(u*u+i*i);Cc+=o*(t+n)/2,zc+=o*(e+r)/2,qc+=o,Je(t=n,e=r)}var t,e;Xc.point=function(r,u){Xc.point=n,Je(t=r,e=u)}}function Ke(){Xc.point=Je}function Qe(){function n(n,t){var e=n-r,i=t-u,o=Math.sqrt(e*e+i*i);Cc+=o*(r+n)/2,zc+=o*(u+t)/2,qc+=o,o=u*n-r*t,Lc+=o*(r+n),Tc+=o*(u+t),Rc+=3*o,Je(r=n,u=t)}var t,e,r,u;Xc.point=function(i,o){Xc.point=n,Je(t=r=i,e=u=o)},Xc.lineEnd=function(){n(t,e)}}function nr(n){function t(t,e){n.moveTo(t+o,e),n.arc(t,e,o,0,Pa)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function u(){a.point=t}function i(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:u,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=u,a.point=t},pointRadius:function(n){return o=n,a},result:y};return a}function tr(n){function t(n){return(a?r:e)(n)}function e(t){return ur(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){M=0/0,S.point=i,t.lineStart()}function i(e,r){var i=ve([e,r]),o=n(e,r);u(M,x,y,b,_,w,M=o[0],x=o[1],y=e,b=i[0],_=i[1],w=i[2],a,t),t.point(M,x)}function o(){S.point=e,t.lineEnd()}function c(){r(),S.point=l,S.lineEnd=s}function l(n,t){i(f=n,h=t),g=M,p=x,v=b,d=_,m=w,S.point=i}function s(){u(M,x,y,b,_,w,g,p,f,v,d,m,a,t),S.lineEnd=o,o()}var f,h,g,p,v,d,m,y,M,x,b,_,w,S={point:e,lineStart:r,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=c},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function u(t,e,r,a,c,l,s,f,h,g,p,v,d,m){var y=s-t,M=f-e,x=y*y+M*M;if(x>4*i&&d--){var b=a+g,_=c+p,w=l+v,S=Math.sqrt(b*b+_*_+w*w),k=Math.asin(w/=S),E=va(va(w)-1)<Ta||va(r-h)<Ta?(r+h)/2:Math.atan2(_,b),A=n(E,k),N=A[0],C=A[1],z=N-t,q=C-e,L=M*z-y*q;
+(L*L/x>i||va((y*z+M*q)/x-.5)>.3||o>a*g+c*p+l*v)&&(u(t,e,r,a,c,l,N,C,E,b/=S,_/=S,w,d,m),m.point(N,C),u(N,C,E,b,_,w,s,f,h,g,p,v,d,m))}}var i=.5,o=Math.cos(30*Fa),a=16;return t.precision=function(n){return arguments.length?(a=(i=n*n)>0&&16,t):Math.sqrt(i)},t}function er(n){var t=tr(function(t,e){return n([t*Ha,e*Ha])});return function(n){return ar(t(n))}}function rr(n){this.stream=n}function ur(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ir(n){return or(function(){return n})()}function or(n){function t(n){return n=a(n[0]*Fa,n[1]*Fa),[n[0]*h+c,l-n[1]*h]}function e(n){return n=a.invert((n[0]-c)/h,(l-n[1])/h),n&&[n[0]*Ha,n[1]*Ha]}function r(){a=Ne(o=sr(m,y,M),i);var n=i(v,d);return c=g-n[0]*h,l=p+n[1]*h,u()}function u(){return s&&(s.valid=!1,s=null),t}var i,o,a,c,l,s,f=tr(function(n,t){return n=i(n,t),[n[0]*h+c,l-n[1]*h]}),h=150,g=480,p=250,v=0,d=0,m=0,y=0,M=0,x=Pc,b=At,_=null,w=null;return t.stream=function(n){return s&&(s.valid=!1),s=ar(x(o,f(b(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(x=null==n?(_=n,Pc):Oe((_=+n)*Fa),u()):_},t.clipExtent=function(n){return arguments.length?(w=n,b=n?Ie(n[0][0],n[0][1],n[1][0],n[1][1]):At,u()):w},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(v=n[0]%360*Fa,d=n[1]%360*Fa,r()):[v*Ha,d*Ha]},t.rotate=function(n){return arguments.length?(m=n[0]%360*Fa,y=n[1]%360*Fa,M=n.length>2?n[2]%360*Fa:0,r()):[m*Ha,y*Ha,M*Ha]},ta.rebind(t,f,"precision"),function(){return i=n.apply(this,arguments),t.invert=i.invert&&e,r()}}function ar(n){return ur(n,function(t,e){n.point(t*Fa,e*Fa)})}function cr(n,t){return[n,t]}function lr(n,t){return[n>Da?n-Pa:-Da>n?n+Pa:n,t]}function sr(n,t,e){return n?t||e?Ne(hr(n),gr(t,e)):hr(n):t||e?gr(t,e):lr}function fr(n){return function(t,e){return t+=n,[t>Da?t-Pa:-Da>t?t+Pa:t,e]}}function hr(n){var t=fr(n);return t.invert=fr(-n),t}function gr(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*r+a*u;return[Math.atan2(c*i-s*o,a*r-l*u),tt(s*i+c*o)]}var r=Math.cos(n),u=Math.sin(n),i=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*i-c*o;return[Math.atan2(c*i+l*o,a*r+s*u),tt(s*r-a*u)]},e}function pr(n,t){var e=Math.cos(n),r=Math.sin(n);return function(u,i,o,a){var c=o*t;null!=u?(u=vr(e,u),i=vr(e,i),(o>0?i>u:u>i)&&(u+=o*Pa)):(u=n+o*Pa,i=n-.5*c);for(var l,s=u;o>0?s>i:i>s;s-=c)a.point((l=be([e,-r*Math.cos(s),-r*Math.sin(s)]))[0],l[1])}}function vr(n,t){var e=ve(t);e[0]-=n,xe(e);var r=nt(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Ta)%(2*Math.PI)}function dr(n,t,e){var r=ta.range(n,t-Ta,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function mr(n,t,e){var r=ta.range(n,t-Ta,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function yr(n){return n.source}function Mr(n){return n.target}function xr(n,t,e,r){var u=Math.cos(t),i=Math.sin(t),o=Math.cos(r),a=Math.sin(r),c=u*Math.cos(n),l=u*Math.sin(n),s=o*Math.cos(e),f=o*Math.sin(e),h=2*Math.asin(Math.sqrt(it(r-t)+u*o*it(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*c+t*s,u=e*l+t*f,o=e*i+t*a;return[Math.atan2(u,r)*Ha,Math.atan2(o,Math.sqrt(r*r+u*u))*Ha]}:function(){return[n*Ha,t*Ha]};return p.distance=h,p}function br(){function n(n,u){var i=Math.sin(u*=Fa),o=Math.cos(u),a=va((n*=Fa)-t),c=Math.cos(a);$c+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*i-e*o*c)*a),e*i+r*o*c),t=n,e=i,r=o}var t,e,r;Bc.point=function(u,i){t=u*Fa,e=Math.sin(i*=Fa),r=Math.cos(i),Bc.point=n},Bc.lineEnd=function(){Bc.point=Bc.lineEnd=y}}function _r(n,t){function e(t,e){var r=Math.cos(t),u=Math.cos(e),i=n(r*u);return[i*u*Math.sin(t),i*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),u=t(r),i=Math.sin(u),o=Math.cos(u);return[Math.atan2(n*i,r*o),Math.asin(r&&e*i/r)]},e}function wr(n,t){function e(n,t){o>0?-ja+Ta>t&&(t=-ja+Ta):t>ja-Ta&&(t=ja-Ta);var e=o/Math.pow(u(t),i);return[e*Math.sin(i*n),o-e*Math.cos(i*n)]}var r=Math.cos(n),u=function(n){return Math.tan(Da/4+n/2)},i=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(u(t)/u(n)),o=r*Math.pow(u(n),i)/i;return i?(e.invert=function(n,t){var e=o-t,r=K(i)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/i,2*Math.atan(Math.pow(o/r,1/i))-ja]},e):kr}function Sr(n,t){function e(n,t){var e=i-t;return[e*Math.sin(u*n),i-e*Math.cos(u*n)]}var r=Math.cos(n),u=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),i=r/u+n;return va(u)<Ta?cr:(e.invert=function(n,t){var e=i-t;return[Math.atan2(n,e)/u,i-K(u)*Math.sqrt(n*n+e*e)]},e)}function kr(n,t){return[n,Math.log(Math.tan(Da/4+t/2))]}function Er(n){var t,e=ir(n),r=e.scale,u=e.translate,i=e.clipExtent;return e.scale=function(){var n=r.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.translate=function(){var n=u.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.clipExtent=function(n){var o=i.apply(e,arguments);if(o===e){if(t=null==n){var a=Da*r(),c=u();i([[c[0]-a,c[1]-a],[c[0]+a,c[1]+a]])}}else t&&(o=null);return o},e.clipExtent(null)}function Ar(n,t){return[Math.log(Math.tan(Da/4+t/2)),-n]}function Nr(n){return n[0]}function Cr(n){return n[1]}function zr(n){for(var t=n.length,e=[0,1],r=2,u=2;t>u;u++){for(;r>1&&Q(n[e[r-2]],n[e[r-1]],n[u])<=0;)--r;e[r++]=u}return e.slice(0,r)}function qr(n,t){return n[0]-t[0]||n[1]-t[1]}function Lr(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Tr(n,t,e,r){var u=n[0],i=e[0],o=t[0]-u,a=r[0]-i,c=n[1],l=e[1],s=t[1]-c,f=r[1]-l,h=(a*(c-l)-f*(u-i))/(f*o-a*s);return[u+h*o,c+h*s]}function Rr(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Dr(){eu(this),this.edge=this.site=this.circle=null}function Pr(n){var t=ol.pop()||new Dr;return t.site=n,t}function Ur(n){$r(n),rl.remove(n),ol.push(n),eu(n)}function jr(n){var t=n.circle,e=t.x,r=t.cy,u={x:e,y:r},i=n.P,o=n.N,a=[n];Ur(n);for(var c=i;c.circle&&va(e-c.circle.x)<Ta&&va(r-c.circle.cy)<Ta;)i=c.P,a.unshift(c),Ur(c),c=i;a.unshift(c),$r(c);for(var l=o;l.circle&&va(e-l.circle.x)<Ta&&va(r-l.circle.cy)<Ta;)o=l.N,a.push(l),Ur(l),l=o;a.push(l),$r(l);var s,f=a.length;for(s=1;f>s;++s)l=a[s],c=a[s-1],Qr(l.edge,c.site,l.site,u);c=a[0],l=a[f-1],l.edge=Gr(c.site,l.site,null,u),Xr(c),Xr(l)}function Fr(n){for(var t,e,r,u,i=n.x,o=n.y,a=rl._;a;)if(r=Hr(a,o)-i,r>Ta)a=a.L;else{if(u=i-Or(a,o),!(u>Ta)){r>-Ta?(t=a.P,e=a):u>-Ta?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var c=Pr(n);if(rl.insert(t,c),t||e){if(t===e)return $r(t),e=Pr(t.site),rl.insert(c,e),c.edge=e.edge=Gr(t.site,c.site),Xr(t),Xr(e),void 0;if(!e)return c.edge=Gr(t.site,c.site),void 0;$r(t),$r(e);var l=t.site,s=l.x,f=l.y,h=n.x-s,g=n.y-f,p=e.site,v=p.x-s,d=p.y-f,m=2*(h*d-g*v),y=h*h+g*g,M=v*v+d*d,x={x:(d*y-g*M)/m+s,y:(h*M-v*y)/m+f};Qr(e.edge,l,p,x),c.edge=Gr(l,n,null,x),e.edge=Gr(n,p,null,x),Xr(t),Xr(e)}}function Hr(n,t){var e=n.site,r=e.x,u=e.y,i=u-t;if(!i)return r;var o=n.P;if(!o)return-1/0;e=o.site;var a=e.x,c=e.y,l=c-t;if(!l)return a;var s=a-r,f=1/i-1/l,h=s/l;return f?(-h+Math.sqrt(h*h-2*f*(s*s/(-2*l)-c+l/2+u-i/2)))/f+r:(r+a)/2}function Or(n,t){var e=n.N;if(e)return Hr(e,t);var r=n.site;return r.y===t?r.x:1/0}function Yr(n){this.site=n,this.edges=[]}function Ir(n){for(var t,e,r,u,i,o,a,c,l,s,f=n[0][0],h=n[1][0],g=n[0][1],p=n[1][1],v=el,d=v.length;d--;)if(i=v[d],i&&i.prepare())for(a=i.edges,c=a.length,o=0;c>o;)s=a[o].end(),r=s.x,u=s.y,l=a[++o%c].start(),t=l.x,e=l.y,(va(r-t)>Ta||va(u-e)>Ta)&&(a.splice(o,0,new nu(Kr(i.site,s,va(r-f)<Ta&&p-u>Ta?{x:f,y:va(t-f)<Ta?e:p}:va(u-p)<Ta&&h-r>Ta?{x:va(e-p)<Ta?t:h,y:p}:va(r-h)<Ta&&u-g>Ta?{x:h,y:va(t-h)<Ta?e:g}:va(u-g)<Ta&&r-f>Ta?{x:va(e-g)<Ta?t:f,y:g}:null),i.site,null)),++c)}function Zr(n,t){return t.angle-n.angle}function Vr(){eu(this),this.x=this.y=this.arc=this.site=this.cy=null}function Xr(n){var t=n.P,e=n.N;if(t&&e){var r=t.site,u=n.site,i=e.site;if(r!==i){var o=u.x,a=u.y,c=r.x-o,l=r.y-a,s=i.x-o,f=i.y-a,h=2*(c*f-l*s);if(!(h>=-Ra)){var g=c*c+l*l,p=s*s+f*f,v=(f*g-l*p)/h,d=(c*p-s*g)/h,f=d+a,m=al.pop()||new Vr;m.arc=n,m.site=u,m.x=v+o,m.y=f+Math.sqrt(v*v+d*d),m.cy=f,n.circle=m;for(var y=null,M=il._;M;)if(m.y<M.y||m.y===M.y&&m.x<=M.x){if(!M.L){y=M.P;break}M=M.L}else{if(!M.R){y=M;break}M=M.R}il.insert(y,m),y||(ul=m)}}}}function $r(n){var t=n.circle;t&&(t.P||(ul=t.N),il.remove(t),al.push(t),eu(t),n.circle=null)}function Br(n){for(var t,e=tl,r=Ye(n[0][0],n[0][1],n[1][0],n[1][1]),u=e.length;u--;)t=e[u],(!Wr(t,n)||!r(t)||va(t.a.x-t.b.x)<Ta&&va(t.a.y-t.b.y)<Ta)&&(t.a=t.b=null,e.splice(u,1))}function Wr(n,t){var e=n.b;if(e)return!0;var r,u,i=n.a,o=t[0][0],a=t[1][0],c=t[0][1],l=t[1][1],s=n.l,f=n.r,h=s.x,g=s.y,p=f.x,v=f.y,d=(h+p)/2,m=(g+v)/2;if(v===g){if(o>d||d>=a)return;if(h>p){if(i){if(i.y>=l)return}else i={x:d,y:c};e={x:d,y:l}}else{if(i){if(i.y<c)return}else i={x:d,y:l};e={x:d,y:c}}}else if(r=(h-p)/(v-g),u=m-r*d,-1>r||r>1)if(h>p){if(i){if(i.y>=l)return}else i={x:(c-u)/r,y:c};e={x:(l-u)/r,y:l}}else{if(i){if(i.y<c)return}else i={x:(l-u)/r,y:l};e={x:(c-u)/r,y:c}}else if(v>g){if(i){if(i.x>=a)return}else i={x:o,y:r*o+u};e={x:a,y:r*a+u}}else{if(i){if(i.x<o)return}else i={x:a,y:r*a+u};e={x:o,y:r*o+u}}return n.a=i,n.b=e,!0}function Jr(n,t){this.l=n,this.r=t,this.a=this.b=null}function Gr(n,t,e,r){var u=new Jr(n,t);return tl.push(u),e&&Qr(u,n,t,e),r&&Qr(u,t,n,r),el[n.i].edges.push(new nu(u,n,t)),el[t.i].edges.push(new nu(u,t,n)),u}function Kr(n,t,e){var r=new Jr(n,null);return r.a=t,r.b=e,tl.push(r),r}function Qr(n,t,e,r){n.a||n.b?n.l===e?n.b=r:n.a=r:(n.a=r,n.l=t,n.r=e)}function nu(n,t,e){var r=n.a,u=n.b;this.edge=n,this.site=t,this.angle=e?Math.atan2(e.y-t.y,e.x-t.x):n.l===t?Math.atan2(u.x-r.x,r.y-u.y):Math.atan2(r.x-u.x,u.y-r.y)}function tu(){this._=null}function eu(n){n.U=n.C=n.L=n.R=n.P=n.N=null}function ru(n,t){var e=t,r=t.R,u=e.U;u?u.L===e?u.L=r:u.R=r:n._=r,r.U=u,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function uu(n,t){var e=t,r=t.L,u=e.U;u?u.L===e?u.L=r:u.R=r:n._=r,r.U=u,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function iu(n){for(;n.L;)n=n.L;return n}function ou(n,t){var e,r,u,i=n.sort(au).pop();for(tl=[],el=new Array(n.length),rl=new tu,il=new tu;;)if(u=ul,i&&(!u||i.y<u.y||i.y===u.y&&i.x<u.x))(i.x!==e||i.y!==r)&&(el[i.i]=new Yr(i),Fr(i),e=i.x,r=i.y),i=n.pop();else{if(!u)break;jr(u.arc)}t&&(Br(t),Ir(t));var o={cells:el,edges:tl};return rl=il=tl=el=null,o}function au(n,t){return t.y-n.y||t.x-n.x}function cu(n,t,e){return(n.x-e.x)*(t.y-n.y)-(n.x-t.x)*(e.y-n.y)}function lu(n){return n.x}function su(n){return n.y}function fu(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function hu(n,t,e,r,u,i){if(!n(t,e,r,u,i)){var o=.5*(e+u),a=.5*(r+i),c=t.nodes;c[0]&&hu(n,c[0],e,r,o,a),c[1]&&hu(n,c[1],o,r,u,a),c[2]&&hu(n,c[2],e,a,o,i),c[3]&&hu(n,c[3],o,a,u,i)}}function gu(n,t,e,r,u,i,o){var a,c=1/0;return function l(n,s,f,h,g){if(!(s>i||f>o||r>h||u>g)){if(p=n.point){var p,v=t-p[0],d=e-p[1],m=v*v+d*d;if(c>m){var y=Math.sqrt(c=m);r=t-y,u=e-y,i=t+y,o=e+y,a=p}}for(var M=n.nodes,x=.5*(s+h),b=.5*(f+g),_=t>=x,w=e>=b,S=w<<1|_,k=S+4;k>S;++S)if(n=M[3&S])switch(3&S){case 0:l(n,s,f,x,b);break;case 1:l(n,x,f,h,b);break;case 2:l(n,s,b,x,g);break;case 3:l(n,x,b,h,g)}}}(n,r,u,i,o),a}function pu(n,t){n=ta.rgb(n),t=ta.rgb(t);var e=n.r,r=n.g,u=n.b,i=t.r-e,o=t.g-r,a=t.b-u;return function(n){return"#"+xt(Math.round(e+i*n))+xt(Math.round(r+o*n))+xt(Math.round(u+a*n))}}function vu(n,t){var e,r={},u={};for(e in n)e in t?r[e]=yu(n[e],t[e]):u[e]=n[e];for(e in t)e in n||(u[e]=t[e]);return function(n){for(e in r)u[e]=r[e](n);return u}}function du(n,t){return n=+n,t=+t,function(e){return n*(1-e)+t*e}}function mu(n,t){var e,r,u,i=ll.lastIndex=sl.lastIndex=0,o=-1,a=[],c=[];for(n+="",t+="";(e=ll.exec(n))&&(r=sl.exec(t));)(u=r.index)>i&&(u=t.slice(i,u),a[o]?a[o]+=u:a[++o]=u),(e=e[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,c.push({i:o,x:du(e,r)})),i=sl.lastIndex;return i<t.length&&(u=t.slice(i),a[o]?a[o]+=u:a[++o]=u),a.length<2?c[0]?(t=c[0].x,function(n){return t(n)+""}):function(){return t}:(t=c.length,function(n){for(var e,r=0;t>r;++r)a[(e=c[r]).i]=e.x(n);return a.join("")})}function yu(n,t){for(var e,r=ta.interpolators.length;--r>=0&&!(e=ta.interpolators[r](n,t)););return e}function Mu(n,t){var e,r=[],u=[],i=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(yu(n[e],t[e]));for(;i>e;++e)u[e]=n[e];for(;o>e;++e)u[e]=t[e];return function(n){for(e=0;a>e;++e)u[e]=r[e](n);return u}}function xu(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function bu(n){return function(t){return 1-n(1-t)}}function _u(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function wu(n){return n*n}function Su(n){return n*n*n}function ku(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function Eu(n){return function(t){return Math.pow(t,n)}}function Au(n){return 1-Math.cos(n*ja)}function Nu(n){return Math.pow(2,10*(n-1))}function Cu(n){return 1-Math.sqrt(1-n*n)}function zu(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Pa*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Pa/t)}}function qu(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Lu(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Tu(n,t){n=ta.hcl(n),t=ta.hcl(t);var e=n.h,r=n.c,u=n.l,i=t.h-e,o=t.c-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return st(e+i*n,r+o*n,u+a*n)+""}}function Ru(n,t){n=ta.hsl(n),t=ta.hsl(t);var e=n.h,r=n.s,u=n.l,i=t.h-e,o=t.s-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return ct(e+i*n,r+o*n,u+a*n)+""}}function Du(n,t){n=ta.lab(n),t=ta.lab(t);var e=n.l,r=n.a,u=n.b,i=t.l-e,o=t.a-r,a=t.b-u;return function(n){return ht(e+i*n,r+o*n,u+a*n)+""}}function Pu(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Uu(n){var t=[n.a,n.b],e=[n.c,n.d],r=Fu(t),u=ju(t,e),i=Fu(Hu(e,t,-u))||0;t[0]*e[1]<e[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,u*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-e[0],e[1]))*Ha,this.translate=[n.e,n.f],this.scale=[r,i],this.skew=i?Math.atan2(u,i)*Ha:0}function ju(n,t){return n[0]*t[0]+n[1]*t[1]}function Fu(n){var t=Math.sqrt(ju(n,n));return t&&(n[0]/=t,n[1]/=t),t}function Hu(n,t,e){return n[0]+=e*t[0],n[1]+=e*t[1],n}function Ou(n,t){var e,r=[],u=[],i=ta.transform(n),o=ta.transform(t),a=i.translate,c=o.translate,l=i.rotate,s=o.rotate,f=i.skew,h=o.skew,g=i.scale,p=o.scale;return a[0]!=c[0]||a[1]!=c[1]?(r.push("translate(",null,",",null,")"),u.push({i:1,x:du(a[0],c[0])},{i:3,x:du(a[1],c[1])})):c[0]||c[1]?r.push("translate("+c+")"):r.push(""),l!=s?(l-s>180?s+=360:s-l>180&&(l+=360),u.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:du(l,s)})):s&&r.push(r.pop()+"rotate("+s+")"),f!=h?u.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:du(f,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),u.push({i:e-4,x:du(g[0],p[0])},{i:e-2,x:du(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=u.length,function(n){for(var t,i=-1;++i<e;)r[(t=u[i]).i]=t.x(n);return r.join("")}}function Yu(n,t){return t=(t-=n=+n)||1/t,function(e){return(e-n)/t}}function Iu(n,t){return t=(t-=n=+n)||1/t,function(e){return Math.max(0,Math.min(1,(e-n)/t))}}function Zu(n){for(var t=n.source,e=n.target,r=Xu(t,e),u=[t];t!==r;)t=t.parent,u.push(t);for(var i=u.length;e!==r;)u.splice(i,0,e),e=e.parent;return u}function Vu(n){for(var t=[],e=n.parent;null!=e;)t.push(n),n=e,e=e.parent;return t.push(n),t}function Xu(n,t){if(n===t)return n;for(var e=Vu(n),r=Vu(t),u=e.pop(),i=r.pop(),o=null;u===i;)o=u,u=e.pop(),i=r.pop();return o}function $u(n){n.fixed|=2}function Bu(n){n.fixed&=-7}function Wu(n){n.fixed|=4,n.px=n.x,n.py=n.y}function Ju(n){n.fixed&=-5}function Gu(n,t,e){var r=0,u=0;if(n.charge=0,!n.leaf)for(var i,o=n.nodes,a=o.length,c=-1;++c<a;)i=o[c],null!=i&&(Gu(i,t,e),n.charge+=i.charge,r+=i.charge*i.cx,u+=i.charge*i.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var l=t*e[n.point.index];n.charge+=n.pointCharge=l,r+=l*n.point.x,u+=l*n.point.y}n.cx=r/n.charge,n.cy=u/n.charge}function Ku(n,t){return ta.rebind(n,t,"sort","children","value"),n.nodes=n,n.links=ui,n}function Qu(n,t){for(var e=[n];null!=(n=e.pop());)if(t(n),(u=n.children)&&(r=u.length))for(var r,u;--r>=0;)e.push(u[r])}function ni(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(i=n.children)&&(u=i.length))for(var u,i,o=-1;++o<u;)e.push(i[o]);for(;null!=(n=r.pop());)t(n)}function ti(n){return n.children}function ei(n){return n.value}function ri(n,t){return t.value-n.value}function ui(n){return ta.merge(n.map(function(n){return(n.children||[]).map(function(t){return{source:n,target:t}})}))}function ii(n){return n.x}function oi(n){return n.y}function ai(n,t,e){n.y0=t,n.y=e}function ci(n){return ta.range(n.length)}function li(n){for(var t=-1,e=n[0].length,r=[];++t<e;)r[t]=0;return r}function si(n){for(var t,e=1,r=0,u=n[0][1],i=n.length;i>e;++e)(t=n[e][1])>u&&(r=e,u=t);return r}function fi(n){return n.reduce(hi,0)}function hi(n,t){return n+t[1]}function gi(n,t){return pi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function pi(n,t){for(var e=-1,r=+n[0],u=(n[1]-r)/t,i=[];++e<=t;)i[e]=u*e+r;return i}function vi(n){return[ta.min(n),ta.max(n)]}function di(n,t){return n.value-t.value}function mi(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function yi(n,t){n._pack_next=t,t._pack_prev=n}function Mi(n,t){var e=t.x-n.x,r=t.y-n.y,u=n.r+t.r;return.999*u*u>e*e+r*r}function xi(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(l=e.length)){var e,r,u,i,o,a,c,l,s=1/0,f=-1/0,h=1/0,g=-1/0;if(e.forEach(bi),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(u=e[1],u.x=u.r,u.y=0,t(u),l>2))for(i=e[2],Si(r,u,i),t(i),mi(r,i),r._pack_prev=i,mi(i,u),u=r._pack_next,o=3;l>o;o++){Si(r,u,i=e[o]);var p=0,v=1,d=1;for(a=u._pack_next;a!==u;a=a._pack_next,v++)if(Mi(a,i)){p=1;break}if(1==p)for(c=r._pack_prev;c!==a._pack_prev&&!Mi(c,i);c=c._pack_prev,d++);p?(d>v||v==d&&u.r<r.r?yi(r,u=a):yi(r=c,u),o--):(mi(r,i),u=i,t(i))}var m=(s+f)/2,y=(h+g)/2,M=0;for(o=0;l>o;o++)i=e[o],i.x-=m,i.y-=y,M=Math.max(M,i.r+Math.sqrt(i.x*i.x+i.y*i.y));n.r=M,e.forEach(_i)}}function bi(n){n._pack_next=n._pack_prev=n}function _i(n){delete n._pack_next,delete n._pack_prev}function wi(n,t,e,r){var u=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,u)for(var i=-1,o=u.length;++i<o;)wi(u[i],t,e,r)}function Si(n,t,e){var r=n.r+e.r,u=t.x-n.x,i=t.y-n.y;if(r&&(u||i)){var o=t.r+e.r,a=u*u+i*i;o*=o,r*=r;var c=.5+(r-o)/(2*a),l=Math.sqrt(Math.max(0,2*o*(r+a)-(r-=a)*r-o*o))/(2*a);e.x=n.x+c*u+l*i,e.y=n.y+c*i-l*u}else e.x=n.x+r,e.y=n.y}function ki(n,t){return n.parent==t.parent?1:2}function Ei(n){var t=n.children;return t.length?t[0]:n.t}function Ai(n){var t,e=n.children;return(t=e.length)?e[t-1]:n.t}function Ni(n,t,e){var r=e/(t.i-n.i);t.c-=r,t.s+=e,n.c+=r,t.z+=e,t.m+=e}function Ci(n){for(var t,e=0,r=0,u=n.children,i=u.length;--i>=0;)t=u[i],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function zi(n,t,e){return n.a.parent===t.parent?n.a:e}function qi(n){return 1+ta.max(n,function(n){return n.y})}function Li(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Ti(n){var t=n.children;return t&&t.length?Ti(t[0]):n}function Ri(n){var t,e=n.children;return e&&(t=e.length)?Ri(e[t-1]):n}function Di(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Pi(n,t){var e=n.x+t[3],r=n.y+t[0],u=n.dx-t[1]-t[3],i=n.dy-t[0]-t[2];return 0>u&&(e+=u/2,u=0),0>i&&(r+=i/2,i=0),{x:e,y:r,dx:u,dy:i}}function Ui(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function ji(n){return n.rangeExtent?n.rangeExtent():Ui(n.range())}function Fi(n,t,e,r){var u=e(n[0],n[1]),i=r(t[0],t[1]);return function(n){return i(u(n))}}function Hi(n,t){var e,r=0,u=n.length-1,i=n[r],o=n[u];return i>o&&(e=r,r=u,u=e,e=i,i=o,o=e),n[r]=t.floor(i),n[u]=t.ceil(o),n}function Oi(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:bl}function Yi(n,t,e,r){var u=[],i=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++o<=a;)u.push(e(n[o-1],n[o])),i.push(r(t[o-1],t[o]));return function(t){var e=ta.bisect(n,t,1,a)-1;return i[e](u[e](t))}}function Ii(n,t,e,r){function u(){var u=Math.min(n.length,t.length)>2?Yi:Fi,c=r?Iu:Yu;return o=u(n,t,c,e),a=u(t,n,c,yu),i}function i(n){return o(n)}var o,a;return i.invert=function(n){return a(n)},i.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},i.range=function(n){return arguments.length?(t=n,u()):t},i.rangeRound=function(n){return i.range(n).interpolate(Pu)},i.clamp=function(n){return arguments.length?(r=n,u()):r},i.interpolate=function(n){return arguments.length?(e=n,u()):e},i.ticks=function(t){return $i(n,t)},i.tickFormat=function(t,e){return Bi(n,t,e)},i.nice=function(t){return Vi(n,t),u()},i.copy=function(){return Ii(n,t,e,r)},u()}function Zi(n,t){return ta.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Vi(n,t){return Hi(n,Oi(Xi(n,t)[2]))}function Xi(n,t){null==t&&(t=10);var e=Ui(n),r=e[1]-e[0],u=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),i=t/r*u;return.15>=i?u*=10:.35>=i?u*=5:.75>=i&&(u*=2),e[0]=Math.ceil(e[0]/u)*u,e[1]=Math.floor(e[1]/u)*u+.5*u,e[2]=u,e}function $i(n,t){return ta.range.apply(ta,Xi(n,t))}function Bi(n,t,e){var r=Xi(n,t);if(e){var u=lc.exec(e);if(u.shift(),"s"===u[8]){var i=ta.formatPrefix(Math.max(va(r[0]),va(r[1])));return u[7]||(u[7]="."+Wi(i.scale(r[2]))),u[8]="f",e=ta.format(u.join("")),function(n){return e(i.scale(n))+i.symbol}}u[7]||(u[7]="."+Ji(u[8],r)),e=u.join("")}else e=",."+Wi(r[2])+"f";return ta.format(e)}function Wi(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function Ji(n,t){var e=Wi(t[2]);return n in _l?Math.abs(e-Wi(Math.max(va(t[0]),va(t[1]))))+ +("e"!==n):e-2*("%"===n)}function Gi(n,t,e,r){function u(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function i(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(u(t))}return o.invert=function(t){return i(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(u)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(u)),o):t},o.nice=function(){var t=Hi(r.map(u),e?Math:Sl);return n.domain(t),r=t.map(i),o},o.ticks=function(){var n=Ui(r),o=[],a=n[0],c=n[1],l=Math.floor(u(a)),s=Math.ceil(u(c)),f=t%1?2:t;if(isFinite(s-l)){if(e){for(;s>l;l++)for(var h=1;f>h;h++)o.push(i(l)*h);o.push(i(l))}else for(o.push(i(l));l++<s;)for(var h=f-1;h>0;h--)o.push(i(l)*h);for(l=0;o[l]<a;l++);for(s=o.length;o[s-1]>c;s--);o=o.slice(l,s)}return o},o.tickFormat=function(n,t){if(!arguments.length)return wl;arguments.length<2?t=wl:"function"!=typeof t&&(t=ta.format(t));var r,a=Math.max(.1,n/o.ticks().length),c=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(n){return n/i(c(u(n)+r))<=a?t(n):""}},o.copy=function(){return Gi(n.copy(),t,e,r)},Zi(o,n)}function Ki(n,t,e){function r(t){return n(u(t))}var u=Qi(t),i=Qi(1/t);return r.invert=function(t){return i(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(u)),r):e},r.ticks=function(n){return $i(e,n)},r.tickFormat=function(n,t){return Bi(e,n,t)},r.nice=function(n){return r.domain(Vi(e,n))},r.exponent=function(o){return arguments.length?(u=Qi(t=o),i=Qi(1/t),n.domain(e.map(u)),r):t},r.copy=function(){return Ki(n.copy(),t,e)},Zi(r,n)}function Qi(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function no(n,t){function e(e){return i[((u.get(e)||("range"===t.t?u.set(e,n.push(e)):0/0))-1)%i.length]}function r(t,e){return ta.range(n.length).map(function(n){return t+e*n})}var u,i,o;return e.domain=function(r){if(!arguments.length)return n;n=[],u=new a;for(var i,o=-1,c=r.length;++o<c;)u.has(i=r[o])||u.set(i,n.push(i));return e[t.t].apply(e,t.a)},e.range=function(n){return arguments.length?(i=n,o=0,t={t:"range",a:arguments},e):i},e.rangePoints=function(u,a){arguments.length<2&&(a=0);var c=u[0],l=u[1],s=n.length<2?(c=(c+l)/2,0):(l-c)/(n.length-1+a);return i=r(c+s*a/2,s),o=0,t={t:"rangePoints",a:arguments},e},e.rangeRoundPoints=function(u,a){arguments.length<2&&(a=0);var c=u[0],l=u[1],s=n.length<2?(c=l=Math.round((c+l)/2),0):0|(l-c)/(n.length-1+a);return i=r(c+Math.round(s*a/2+(l-c-(n.length-1+a)*s)/2),s),o=0,t={t:"rangeRoundPoints",a:arguments},e},e.rangeBands=function(u,a,c){arguments.length<2&&(a=0),arguments.length<3&&(c=a);var l=u[1]<u[0],s=u[l-0],f=u[1-l],h=(f-s)/(n.length-a+2*c);return i=r(s+h*c,h),l&&i.reverse(),o=h*(1-a),t={t:"rangeBands",a:arguments},e},e.rangeRoundBands=function(u,a,c){arguments.length<2&&(a=0),arguments.length<3&&(c=a);var l=u[1]<u[0],s=u[l-0],f=u[1-l],h=Math.floor((f-s)/(n.length-a+2*c));return i=r(s+Math.round((f-s-(n.length-a)*h)/2),h),l&&i.reverse(),o=Math.round(h*(1-a)),t={t:"rangeRoundBands",a:arguments},e},e.rangeBand=function(){return o},e.rangeExtent=function(){return Ui(t.a[0])},e.copy=function(){return no(n,t)},e.domain(n)}function to(r,u){function i(){var n=0,t=u.length;for(a=[];++n<t;)a[n-1]=ta.quantile(r,n/t);return o}function o(n){return isNaN(n=+n)?void 0:u[ta.bisect(a,n)]}var a;return o.domain=function(u){return arguments.length?(r=u.map(t).filter(e).sort(n),i()):r},o.range=function(n){return arguments.length?(u=n,i()):u},o.quantiles=function(){return a},o.invertExtent=function(n){return n=u.indexOf(n),0>n?[0/0,0/0]:[n>0?a[n-1]:r[0],n<a.length?a[n]:r[r.length-1]]},o.copy=function(){return to(r,u)},i()}function eo(n,t,e){function r(t){return e[Math.max(0,Math.min(o,Math.floor(i*(t-n))))]}function u(){return i=e.length/(t-n),o=e.length-1,r}var i,o;return r.domain=function(e){return arguments.length?(n=+e[0],t=+e[e.length-1],u()):[n,t]},r.range=function(n){return arguments.length?(e=n,u()):e},r.invertExtent=function(t){return t=e.indexOf(t),t=0>t?0/0:t/i+n,[t,t+1/i]},r.copy=function(){return eo(n,t,e)},u()}function ro(n,t){function e(e){return e>=e?t[ta.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return ro(n,t)},e}function uo(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return $i(n,t)},t.tickFormat=function(t,e){return Bi(n,t,e)},t.copy=function(){return uo(n)},t}function io(){return 0}function oo(n){return n.innerRadius}function ao(n){return n.outerRadius}function co(n){return n.startAngle}function lo(n){return n.endAngle}function so(n){return n&&n.padAngle}function fo(n,t,e,r){return(n-e)*t-(t-r)*n>0?0:1}function ho(n,t,e,r,u){var i=n[0]-t[0],o=n[1]-t[1],a=(u?r:-r)/Math.sqrt(i*i+o*o),c=a*o,l=-a*i,s=n[0]+c,f=n[1]+l,h=t[0]+c,g=t[1]+l,p=(s+h)/2,v=(f+g)/2,d=h-s,m=g-f,y=d*d+m*m,M=e-r,x=s*g-h*f,b=(0>m?-1:1)*Math.sqrt(M*M*y-x*x),_=(x*m-d*b)/y,w=(-x*d-m*b)/y,S=(x*m+d*b)/y,k=(-x*d+m*b)/y,E=_-p,A=w-v,N=S-p,C=k-v;return E*E+A*A>N*N+C*C&&(_=S,w=k),[[_-c,w-l],[_*e/M,w*e/M]]}function go(n){function t(t){function o(){l.push("M",i(n(s),a))}for(var c,l=[],s=[],f=-1,h=t.length,g=Et(e),p=Et(r);++f<h;)u.call(this,c=t[f],f)?s.push([+g.call(this,c,f),+p.call(this,c,f)]):s.length&&(o(),s=[]);return s.length&&o(),l.length?l.join(""):null}var e=Nr,r=Cr,u=Ce,i=po,o=i.key,a=.7;return t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.defined=function(n){return arguments.length?(u=n,t):u},t.interpolate=function(n){return arguments.length?(o="function"==typeof n?i=n:(i=zl.get(n)||po).key,t):o},t.tension=function(n){return arguments.length?(a=n,t):a},t}function po(n){return n.join("L")}function vo(n){return po(n)+"Z"}function mo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("H",(r[0]+(r=n[t])[0])/2,"V",r[1]);return e>1&&u.push("H",r[0]),u.join("")}function yo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("V",(r=n[t])[1],"H",r[0]);return u.join("")}function Mo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("H",(r=n[t])[0],"V",r[1]);return u.join("")}function xo(n,t){return n.length<4?po(n):n[1]+wo(n.slice(1,-1),So(n,t))}function bo(n,t){return n.length<3?po(n):n[0]+wo((n.push(n[0]),n),So([n[n.length-2]].concat(n,[n[1]]),t))}function _o(n,t){return n.length<3?po(n):n[0]+wo(n,So(n,t))}function wo(n,t){if(t.length<1||n.length!=t.length&&n.length!=t.length+2)return po(n);var e=n.length!=t.length,r="",u=n[0],i=n[1],o=t[0],a=o,c=1;if(e&&(r+="Q"+(i[0]-2*o[0]/3)+","+(i[1]-2*o[1]/3)+","+i[0]+","+i[1],u=n[1],c=2),t.length>1){a=t[1],i=n[c],c++,r+="C"+(u[0]+o[0])+","+(u[1]+o[1])+","+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1];for(var l=2;l<t.length;l++,c++)i=n[c],a=t[l],r+="S"+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1]}if(e){var s=n[c];r+="Q"+(i[0]+2*a[0]/3)+","+(i[1]+2*a[1]/3)+","+s[0]+","+s[1]}return r}function So(n,t){for(var e,r=[],u=(1-t)/2,i=n[0],o=n[1],a=1,c=n.length;++a<c;)e=i,i=o,o=n[a],r.push([u*(o[0]-e[0]),u*(o[1]-e[1])]);return r}function ko(n){if(n.length<3)return po(n);var t=1,e=n.length,r=n[0],u=r[0],i=r[1],o=[u,u,u,(r=n[1])[0]],a=[i,i,i,r[1]],c=[u,",",i,"L",Co(Tl,o),",",Co(Tl,a)];for(n.push(n[e-1]);++t<=e;)r=n[t],o.shift(),o.push(r[0]),a.shift(),a.push(r[1]),zo(c,o,a);return n.pop(),c.push("L",r),c.join("")}function Eo(n){if(n.length<4)return po(n);for(var t,e=[],r=-1,u=n.length,i=[0],o=[0];++r<3;)t=n[r],i.push(t[0]),o.push(t[1]);for(e.push(Co(Tl,i)+","+Co(Tl,o)),--r;++r<u;)t=n[r],i.shift(),i.push(t[0]),o.shift(),o.push(t[1]),zo(e,i,o);return e.join("")}function Ao(n){for(var t,e,r=-1,u=n.length,i=u+4,o=[],a=[];++r<4;)e=n[r%u],o.push(e[0]),a.push(e[1]);for(t=[Co(Tl,o),",",Co(Tl,a)],--r;++r<i;)e=n[r%u],o.shift(),o.push(e[0]),a.shift(),a.push(e[1]),zo(t,o,a);return t.join("")}function No(n,t){var e=n.length-1;if(e)for(var r,u,i=n[0][0],o=n[0][1],a=n[e][0]-i,c=n[e][1]-o,l=-1;++l<=e;)r=n[l],u=l/e,r[0]=t*r[0]+(1-t)*(i+u*a),r[1]=t*r[1]+(1-t)*(o+u*c);return ko(n)}function Co(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function zo(n,t,e){n.push("C",Co(ql,t),",",Co(ql,e),",",Co(Ll,t),",",Co(Ll,e),",",Co(Tl,t),",",Co(Tl,e))}function qo(n,t){return(t[1]-n[1])/(t[0]-n[0])}function Lo(n){for(var t=0,e=n.length-1,r=[],u=n[0],i=n[1],o=r[0]=qo(u,i);++t<e;)r[t]=(o+(o=qo(u=i,i=n[t+1])))/2;return r[t]=o,r}function To(n){for(var t,e,r,u,i=[],o=Lo(n),a=-1,c=n.length-1;++a<c;)t=qo(n[a],n[a+1]),va(t)<Ta?o[a]=o[a+1]=0:(e=o[a]/t,r=o[a+1]/t,u=e*e+r*r,u>9&&(u=3*t/Math.sqrt(u),o[a]=u*e,o[a+1]=u*r));for(a=-1;++a<=c;)u=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),i.push([u||0,o[a]*u||0]);return i}function Ro(n){return n.length<3?po(n):n[0]+wo(n,To(n))}function Do(n){for(var t,e,r,u=-1,i=n.length;++u<i;)t=n[u],e=t[0],r=t[1]-ja,t[0]=e*Math.cos(r),t[1]=e*Math.sin(r);return n}function Po(n){function t(t){function c(){v.push("M",a(n(m),f),s,l(n(d.reverse()),f),"Z")}for(var h,g,p,v=[],d=[],m=[],y=-1,M=t.length,x=Et(e),b=Et(u),_=e===r?function(){return g}:Et(r),w=u===i?function(){return p}:Et(i);++y<M;)o.call(this,h=t[y],y)?(d.push([g=+x.call(this,h,y),p=+b.call(this,h,y)]),m.push([+_.call(this,h,y),+w.call(this,h,y)])):d.length&&(c(),d=[],m=[]);return d.length&&c(),v.length?v.join(""):null}var e=Nr,r=Nr,u=0,i=Cr,o=Ce,a=po,c=a.key,l=a,s="L",f=.7;return t.x=function(n){return arguments.length?(e=r=n,t):r},t.x0=function(n){return arguments.length?(e=n,t):e},t.x1=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(u=i=n,t):i},t.y0=function(n){return arguments.length?(u=n,t):u},t.y1=function(n){return arguments.length?(i=n,t):i},t.defined=function(n){return arguments.length?(o=n,t):o},t.interpolate=function(n){return arguments.length?(c="function"==typeof n?a=n:(a=zl.get(n)||po).key,l=a.reverse||a,s=a.closed?"M":"L",t):c
+},t.tension=function(n){return arguments.length?(f=n,t):f},t}function Uo(n){return n.radius}function jo(n){return[n.x,n.y]}function Fo(n){return function(){var t=n.apply(this,arguments),e=t[0],r=t[1]-ja;return[e*Math.cos(r),e*Math.sin(r)]}}function Ho(){return 64}function Oo(){return"circle"}function Yo(n){var t=Math.sqrt(n/Da);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+-t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function Io(n,t,e){return xa(n,Fl),n.namespace=t,n.id=e,n}function Zo(n,t,e,r){var u=n.id,i=n.namespace;return H(n,"function"==typeof e?function(n,o,a){n[i][u].tween.set(t,r(e.call(n,n.__data__,o,a)))}:(e=r(e),function(n){n[i][u].tween.set(t,e)}))}function Vo(n){return null==n&&(n=""),function(){this.textContent=n}}function Xo(n){return null==n?"__transition__":"__transition_"+n+"__"}function $o(n,t,e,r,u){var i=n[e]||(n[e]={active:0,count:0}),o=i[r];if(!o){var c=u.time;o=i[r]={tween:new a,time:c,ease:u.ease,delay:u.delay,duration:u.duration},u=null,++i.count,ta.timer(function(u){function a(e){return i.active>r?s(!1):(i.active=r,o.event&&o.event.start.call(n,f,t),o.tween.forEach(function(e,r){(r=r.call(n,f,t))&&d.push(r)}),ta.timer(function(){return v.c=l(e||1)?Ce:l,1},0,c),void 0)}function l(t){if(i.active!==r)return s(!1);for(var e=t/p,u=h(e),o=d.length;o>0;)d[--o].call(n,u);return e>=1?s(!0):void 0}function s(u){return o.event&&o.event[u?"end":"interrupt"].call(n,f,t),--i.count?delete i[r]:delete n[e],1}var f=n.__data__,h=o.ease,g=o.delay,p=o.duration,v=oc,d=[];return v.t=g+c,u>=g?a(u-g):(v.c=a,void 0)},0,c)}}function Bo(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function Wo(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function Jo(n){return n.toISOString()}function Go(n,t,e){function r(t){return n(t)}function u(n,e){var r=n[1]-n[0],u=r/e,i=ta.bisect(Bl,u);return i==Bl.length?[t.year,Xi(n.map(function(n){return n/31536e6}),e)[2]]:i?t[u/Bl[i-1]<Bl[i]/u?i-1:i]:[Gl,Xi(n,e)[2]]}return r.invert=function(t){return Ko(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain(t),r):n.domain().map(Ko)},r.nice=function(n,t){function e(e){return!isNaN(e)&&!n.range(e,Ko(+e+1),t).length}var i=r.domain(),o=Ui(i),a=null==n?u(o,10):"number"==typeof n&&u(o,n);return a&&(n=a[0],t=a[1]),r.domain(Hi(i,t>1?{floor:function(t){for(;e(t=n.floor(t));)t=Ko(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=Ko(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Ui(r.domain()),i=null==n?u(e,10):"number"==typeof n?u(e,n):!n.range&&[{range:n},t];return i&&(n=i[0],t=i[1]),n.range(e[0],Ko(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return Go(n.copy(),t,e)},Zi(r,n)}function Ko(n){return new Date(n)}function Qo(n){return JSON.parse(n.responseText)}function na(n){var t=ua.createRange();return t.selectNode(ua.body),t.createContextualFragment(n.responseText)}var ta={version:"3.5.0pre"};Date.now||(Date.now=function(){return+new Date});var ea=[].slice,ra=function(n){return ea.call(n)},ua=document,ia=ua.documentElement,oa=window;try{ra(ia.childNodes)[0].nodeType}catch(aa){ra=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}try{ua.createElement("div").style.setProperty("opacity",0,"")}catch(ca){var la=oa.Element.prototype,sa=la.setAttribute,fa=la.setAttributeNS,ha=oa.CSSStyleDeclaration.prototype,ga=ha.setProperty;la.setAttribute=function(n,t){sa.call(this,n,t+"")},la.setAttributeNS=function(n,t,e){fa.call(this,n,t,e+"")},ha.setProperty=function(n,t,e){ga.call(this,n,t+"",e)}}ta.ascending=n,ta.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},ta.min=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u<i;)if(null!=(r=n[u])&&r>=r){e=r;break}for(;++u<i;)null!=(r=n[u])&&e>r&&(e=r)}else{for(;++u<i;)if(null!=(r=t.call(n,n[u],u))&&r>=r){e=r;break}for(;++u<i;)null!=(r=t.call(n,n[u],u))&&e>r&&(e=r)}return e},ta.max=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u<i;)if(null!=(r=n[u])&&r>=r){e=r;break}for(;++u<i;)null!=(r=n[u])&&r>e&&(e=r)}else{for(;++u<i;)if(null!=(r=t.call(n,n[u],u))&&r>=r){e=r;break}for(;++u<i;)null!=(r=t.call(n,n[u],u))&&r>e&&(e=r)}return e},ta.extent=function(n,t){var e,r,u,i=-1,o=n.length;if(1===arguments.length){for(;++i<o;)if(null!=(r=n[i])&&r>=r){e=u=r;break}for(;++i<o;)null!=(r=n[i])&&(e>r&&(e=r),r>u&&(u=r))}else{for(;++i<o;)if(null!=(r=t.call(n,n[i],i))&&r>=r){e=u=r;break}for(;++i<o;)null!=(r=t.call(n,n[i],i))&&(e>r&&(e=r),r>u&&(u=r))}return[e,u]},ta.sum=function(n,t){var r,u=0,i=n.length,o=-1;if(1===arguments.length)for(;++o<i;)e(r=+n[o])&&(u+=r);else for(;++o<i;)e(r=+t.call(n,n[o],o))&&(u+=r);return u},ta.mean=function(n,r){var u,i=0,o=n.length,a=-1,c=o;if(1===arguments.length)for(;++a<o;)e(u=t(n[a]))?i+=u:--c;else for(;++a<o;)e(u=t(r.call(n,n[a],a)))?i+=u:--c;return c?i/c:void 0},ta.quantile=function(n,t){var e=(n.length-1)*t+1,r=Math.floor(e),u=+n[r-1],i=e-r;return i?u+i*(n[r]-u):u},ta.median=function(r,u){var i,o=[],a=r.length,c=-1;if(1===arguments.length)for(;++c<a;)e(i=t(r[c]))&&o.push(i);else for(;++c<a;)e(i=t(u.call(r,r[c],c)))&&o.push(i);return o.length?ta.quantile(o.sort(n),.5):void 0};var pa=r(n);ta.bisectLeft=pa.left,ta.bisect=ta.bisectRight=pa.right,ta.bisector=function(t){return r(1===t.length?function(e,r){return n(t(e),r)}:t)},ta.shuffle=function(n,t,e){(i=arguments.length)<3&&(e=n.length,2>i&&(t=0));for(var r,u,i=e-t;i;)u=0|Math.random()*i--,r=n[i+t],n[i+t]=n[u+t],n[u+t]=r;return n},ta.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},ta.pairs=function(n){for(var t,e=0,r=n.length-1,u=n[0],i=new Array(0>r?0:r);r>e;)i[e]=[t=u,u=n[++e]];return i},ta.zip=function(){if(!(r=arguments.length))return[];for(var n=-1,t=ta.min(arguments,u),e=new Array(t);++n<t;)for(var r,i=-1,o=e[n]=new Array(r);++i<r;)o[i]=arguments[i][n];return e},ta.transpose=function(n){return ta.zip.apply(ta,n)},ta.keys=function(n){var t=[];for(var e in n)t.push(e);return t},ta.values=function(n){var t=[];for(var e in n)t.push(n[e]);return t},ta.entries=function(n){var t=[];for(var e in n)t.push({key:e,value:n[e]});return t},ta.merge=function(n){for(var t,e,r,u=n.length,i=-1,o=0;++i<u;)o+=n[i].length;for(e=new Array(o);--u>=0;)for(r=n[u],t=r.length;--t>=0;)e[--o]=r[t];return e};var va=Math.abs;ta.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),1/0===(t-n)/e)throw new Error("infinite range");var r,u=[],o=i(va(e)),a=-1;if(n*=o,t*=o,e*=o,0>e)for(;(r=n+e*++a)>t;)u.push(r/o);else for(;(r=n+e*++a)<t;)u.push(r/o);return u},ta.map=function(n,t){var e=new a;if(n instanceof a)n.forEach(function(n,t){e.set(n,t)});else if(Array.isArray(n)){var r,u=-1,i=n.length;if(1===arguments.length)for(;++u<i;)e.set(u,n[u]);else for(;++u<i;)e.set(t.call(n,r=n[u],u),r)}else for(var o in n)e.set(o,n[o]);return e};var da="__proto__",ma="\x00";o(a,{has:s,get:function(n){return this._[c(n)]},set:function(n,t){return this._[c(n)]=t},remove:f,keys:h,values:function(){var n=[];for(var t in this._)n.push(this._[t]);return n},entries:function(){var n=[];for(var t in this._)n.push({key:l(t),value:this._[t]});return n},size:g,empty:p,forEach:function(n){for(var t in this._)n.call(this,l(t),this._[t])}}),ta.nest=function(){function n(t,o,c){if(c>=i.length)return r?r.call(u,o):e?o.sort(e):o;for(var l,s,f,h,g=-1,p=o.length,v=i[c++],d=new a;++g<p;)(h=d.get(l=v(s=o[g])))?h.push(s):d.set(l,[s]);return t?(s=t(),f=function(e,r){s.set(e,n(t,r,c))}):(s={},f=function(e,r){s[e]=n(t,r,c)}),d.forEach(f),s}function t(n,e){if(e>=i.length)return n;var r=[],u=o[e++];return n.forEach(function(n,u){r.push({key:n,values:t(u,e)})}),u?r.sort(function(n,t){return u(n.key,t.key)}):r}var e,r,u={},i=[],o=[];return u.map=function(t,e){return n(e,t,0)},u.entries=function(e){return t(n(ta.map,e,0),0)},u.key=function(n){return i.push(n),u},u.sortKeys=function(n){return o[i.length-1]=n,u},u.sortValues=function(n){return e=n,u},u.rollup=function(n){return r=n,u},u},ta.set=function(n){var t=new v;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},o(v,{has:s,add:function(n){return this._[c(n+="")]=!0,n},remove:f,values:h,size:g,empty:p,forEach:function(n){for(var t in this._)n.call(this,l(t))}}),ta.behavior={},ta.rebind=function(n,t){for(var e,r=1,u=arguments.length;++r<u;)n[e=arguments[r]]=d(n,t,t[e]);return n};var ya=["webkit","ms","moz","Moz","o","O"];ta.dispatch=function(){for(var n=new M,t=-1,e=arguments.length;++t<e;)n[arguments[t]]=x(n);return n},M.prototype.on=function(n,t){var e=n.indexOf("."),r="";if(e>=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},ta.event=null,ta.requote=function(n){return n.replace(Ma,"\\$&")};var Ma=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,xa={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},ba=function(n,t){return t.querySelector(n)},_a=function(n,t){return t.querySelectorAll(n)},wa=ia.matches||ia[m(ia,"matchesSelector")],Sa=function(n,t){return wa.call(n,t)};"function"==typeof Sizzle&&(ba=function(n,t){return Sizzle(n,t)[0]||null},_a=Sizzle,Sa=Sizzle.matchesSelector),ta.selection=function(){return Na};var ka=ta.selection.prototype=[];ka.select=function(n){var t,e,r,u,i=[];n=k(n);for(var o=-1,a=this.length;++o<a;){i.push(t=[]),t.parentNode=(r=this[o]).parentNode;for(var c=-1,l=r.length;++c<l;)(u=r[c])?(t.push(e=n.call(u,u.__data__,c,o)),e&&"__data__"in u&&(e.__data__=u.__data__)):t.push(null)}return S(i)},ka.selectAll=function(n){var t,e,r=[];n=E(n);for(var u=-1,i=this.length;++u<i;)for(var o=this[u],a=-1,c=o.length;++a<c;)(e=o[a])&&(r.push(t=ra(n.call(e,e.__data__,a,u))),t.parentNode=e);return S(r)};var Ea={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};ta.ns={prefix:Ea,qualify:function(n){var t=n.indexOf(":"),e=n;return t>=0&&(e=n.slice(0,t),n=n.slice(t+1)),Ea.hasOwnProperty(e)?{space:Ea[e],local:n}:n}},ka.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=ta.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(A(t,n[t]));return this}return this.each(A(n,t))},ka.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=z(n)).length,u=-1;if(t=e.classList){for(;++u<r;)if(!t.contains(n[u]))return!1}else for(t=e.getAttribute("class");++u<r;)if(!C(n[u]).test(t))return!1;return!0}for(t in n)this.each(q(t,n[t]));return this}return this.each(q(n,t))},ka.style=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t="");for(e in n)this.each(T(e,n[e],t));return this}if(2>r)return oa.getComputedStyle(this.node(),null).getPropertyValue(n);e=""}return this.each(T(n,t,e))},ka.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(R(t,n[t]));return this}return this.each(R(n,t))},ka.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},ka.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},ka.append=function(n){return n=D(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},ka.insert=function(n,t){return n=D(n),t=k(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},ka.remove=function(){return this.each(P)},ka.data=function(n,t){function e(n,e){var r,u,i,o=n.length,f=e.length,h=Math.min(o,f),g=new Array(f),p=new Array(f),v=new Array(o);if(t){var d,m=new a,y=new Array(o);for(r=-1;++r<o;)m.has(d=t.call(u=n[r],u.__data__,r))?v[r]=u:m.set(d,u),y[r]=d;for(r=-1;++r<f;)(u=m.get(d=t.call(e,i=e[r],r)))?u!==!0&&(g[r]=u,u.__data__=i):p[r]=U(i),m.set(d,!0);for(r=-1;++r<o;)m.get(y[r])!==!0&&(v[r]=n[r])}else{for(r=-1;++r<h;)u=n[r],i=e[r],u?(u.__data__=i,g[r]=u):p[r]=U(i);for(;f>r;++r)p[r]=U(e[r]);for(;o>r;++r)v[r]=n[r]}p.update=g,p.parentNode=g.parentNode=v.parentNode=n.parentNode,c.push(p),l.push(g),s.push(v)}var r,u,i=-1,o=this.length;if(!arguments.length){for(n=new Array(o=(r=this[0]).length);++i<o;)(u=r[i])&&(n[i]=u.__data__);return n}var c=O([]),l=S([]),s=S([]);if("function"==typeof n)for(;++i<o;)e(r=this[i],n.call(r,r.parentNode.__data__,i));else for(;++i<o;)e(r=this[i],n);return l.enter=function(){return c},l.exit=function(){return s},l},ka.datum=function(n){return arguments.length?this.property("__data__",n):this.property("__data__")},ka.filter=function(n){var t,e,r,u=[];"function"!=typeof n&&(n=j(n));for(var i=0,o=this.length;o>i;i++){u.push(t=[]),t.parentNode=(e=this[i]).parentNode;for(var a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return S(u)},ka.order=function(){for(var n=-1,t=this.length;++n<t;)for(var e,r=this[n],u=r.length-1,i=r[u];--u>=0;)(e=r[u])&&(i&&i!==e.nextSibling&&i.parentNode.insertBefore(e,i),i=e);return this},ka.sort=function(n){n=F.apply(this,arguments);for(var t=-1,e=this.length;++t<e;)this[t].sort(n);return this.order()},ka.each=function(n){return H(this,function(t,e,r){n.call(t,t.__data__,e,r)})},ka.call=function(n){var t=ra(arguments);return n.apply(t[0]=this,t),this},ka.empty=function(){return!this.node()},ka.node=function(){for(var n=0,t=this.length;t>n;n++)for(var e=this[n],r=0,u=e.length;u>r;r++){var i=e[r];if(i)return i}return null},ka.size=function(){var n=0;return H(this,function(){++n}),n};var Aa=[];ta.selection.enter=O,ta.selection.enter.prototype=Aa,Aa.append=ka.append,Aa.empty=ka.empty,Aa.node=ka.node,Aa.call=ka.call,Aa.size=ka.size,Aa.select=function(n){for(var t,e,r,u,i,o=[],a=-1,c=this.length;++a<c;){r=(u=this[a]).update,o.push(t=[]),t.parentNode=u.parentNode;for(var l=-1,s=u.length;++l<s;)(i=u[l])?(t.push(r[l]=e=n.call(u.parentNode,i.__data__,l,a)),e.__data__=i.__data__):t.push(null)}return S(o)},Aa.insert=function(n,t){return arguments.length<2&&(t=Y(this)),ka.insert.call(this,n,t)},ka.transition=function(n){for(var t,e,r=Dl||++Hl,u=Xo(n),i=[],o=Pl||{time:Date.now(),ease:ku,delay:0,duration:250},a=-1,c=this.length;++a<c;){i.push(t=[]);for(var l=this[a],s=-1,f=l.length;++s<f;)(e=l[s])&&$o(e,s,u,r,o),t.push(e)}return Io(i,u,r)},ka.interrupt=function(n){var t=Xo(n);return this.each(function(){var n=this[t];n&&++n.active})},ta.select=function(n){var t=["string"==typeof n?ba(n,ua):n];return t.parentNode=ia,S([t])},ta.selectAll=function(n){var t=ra("string"==typeof n?_a(n,ua):n);return t.parentNode=ia,S([t])};var Na=ta.select(ia);ka.on=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(Z(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(Z(n,t,e))};var Ca=ta.map({mouseenter:"mouseover",mouseleave:"mouseout"});Ca.forEach(function(n){"on"+n in ua&&Ca.remove(n)});var za="onselectstart"in ua?null:m(ia.style,"userSelect"),qa=0;ta.mouse=function(n){return B(n,_())};var La=/WebKit/.test(oa.navigator.userAgent)?-1:0;ta.touch=function(n,t,e){if(arguments.length<3&&(e=t,t=_().changedTouches),t)for(var r,u=0,i=t.length;i>u;++u)if((r=t[u]).identifier===e)return B(n,r)},ta.behavior.drag=function(){function n(){this.on("mousedown.drag",u).on("touchstart.drag",i)}function t(n,t,u,i,o){return function(){function a(){var n,e,r=t(h,v);r&&(n=r[0]-M[0],e=r[1]-M[1],p|=n|e,M=r,g({type:"drag",x:r[0]+l[0],y:r[1]+l[1],dx:n,dy:e}))}function c(){t(h,v)&&(m.on(i+d,null).on(o+d,null),y(p&&ta.event.target===f),g({type:"dragend"}))}var l,s=this,f=ta.event.target,h=s.parentNode,g=e.of(s,arguments),p=0,v=n(),d=".drag"+(null==v?"":"-"+v),m=ta.select(u()).on(i+d,a).on(o+d,c),y=$(),M=t(h,v);r?(l=r.apply(s,arguments),l=[l.x-M[0],l.y-M[1]]):l=[0,0],g({type:"dragstart"})}}var e=w(n,"drag","dragstart","dragend"),r=null,u=t(y,ta.mouse,G,"mousemove","mouseup"),i=t(W,ta.touch,J,"touchmove","touchend");return n.origin=function(t){return arguments.length?(r=t,n):r},ta.rebind(n,e,"on")},ta.touches=function(n,t){return arguments.length<2&&(t=_().touches),t?ra(t).map(function(t){var e=B(n,t);return e.identifier=t.identifier,e}):[]};var Ta=1e-6,Ra=Ta*Ta,Da=Math.PI,Pa=2*Da,Ua=Pa-Ta,ja=Da/2,Fa=Da/180,Ha=180/Da,Oa=Math.SQRT2,Ya=2,Ia=4;ta.interpolateZoom=function(n,t){function e(n){var t=n*y;if(m){var e=rt(v),o=i/(Ya*h)*(e*ut(Oa*t+v)-et(v));return[r+o*l,u+o*s,i*e/rt(Oa*t+v)]}return[r+n*l,u+n*s,i*Math.exp(Oa*t)]}var r=n[0],u=n[1],i=n[2],o=t[0],a=t[1],c=t[2],l=o-r,s=a-u,f=l*l+s*s,h=Math.sqrt(f),g=(c*c-i*i+Ia*f)/(2*i*Ya*h),p=(c*c-i*i-Ia*f)/(2*c*Ya*h),v=Math.log(Math.sqrt(g*g+1)-g),d=Math.log(Math.sqrt(p*p+1)-p),m=d-v,y=(m||Math.log(c/i))/Oa;return e.duration=1e3*y,e},ta.behavior.zoom=function(){function n(n){n.on(C,s).on(Xa+".zoom",h).on("dblclick.zoom",g).on(L,f)}function t(n){return[(n[0]-k.x)/k.k,(n[1]-k.y)/k.k]}function e(n){return[n[0]*k.k+k.x,n[1]*k.k+k.y]}function r(n){k.k=Math.max(A[0],Math.min(A[1],n))}function u(n,t){t=e(t),k.x+=n[0]-t[0],k.y+=n[1]-t[1]}function i(t,e,i,o){t.__chart__={x:k.x,y:k.y,k:k.k},r(Math.pow(2,o)),u(v=e,i),ta.select(t).transition().duration(350).call(n.event)}function o(){x&&x.domain(M.range().map(function(n){return(n-k.x)/k.k}).map(M.invert)),S&&S.domain(_.range().map(function(n){return(n-k.y)/k.k}).map(_.invert))}function a(n){N++||n({type:"zoomstart"})}function c(n){o(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function l(n){--N||n({type:"zoomend"}),v=null}function s(){function n(){s=1,u(ta.mouse(r),h),c(o)}function e(){f.on(z,null).on(q,null),g(s&&ta.event.target===i),l(o)}var r=this,i=ta.event.target,o=T.of(r,arguments),s=0,f=ta.select(oa).on(z,n).on(q,e),h=t(ta.mouse(r)),g=$();I(r),a(o)}function f(){function n(){var n=ta.touches(p);return g=k.k,n.forEach(function(n){n.identifier in d&&(d[n.identifier]=t(n))}),n}function e(){var t=ta.event.target;ta.select(t).on(x,o).on(_,h),w.push(t);for(var e=ta.event.changedTouches,r=0,u=e.length;u>r;++r)d[e[r].identifier]=null;var a=n(),c=Date.now();if(1===a.length){if(500>c-y){var l=a[0];i(p,l,d[l.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),b()}y=c}else if(a.length>1){var l=a[0],s=a[1],f=l[0]-s[0],g=l[1]-s[1];m=f*f+g*g}}function o(){var n,t,e,i,o=ta.touches(p);I(p);for(var a=0,l=o.length;l>a;++a,i=null)if(e=o[a],i=d[e.identifier]){if(t)break;n=e,t=i}if(i){var s=(s=e[0]-n[0])*s+(s=e[1]-n[1])*s,f=m&&Math.sqrt(s/m);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+i[0])/2,(t[1]+i[1])/2],r(f*g)}y=null,u(n,t),c(v)}function h(){if(ta.event.touches.length){for(var t=ta.event.changedTouches,e=0,r=t.length;r>e;++e)delete d[t[e].identifier];for(var u in d)return void n()}ta.selectAll(w).on(M,null),S.on(C,s).on(L,f),E(),l(v)}var g,p=this,v=T.of(p,arguments),d={},m=0,M=".zoom-"+ta.event.changedTouches[0].identifier,x="touchmove"+M,_="touchend"+M,w=[],S=ta.select(p),E=$();e(),a(v),S.on(C,null).on(L,e)}function h(){var n=T.of(this,arguments);m?clearTimeout(m):(p=t(v=d||ta.mouse(this)),I(this),a(n)),m=setTimeout(function(){m=null,l(n)},50),b(),r(Math.pow(2,.002*Za())*k.k),u(v,p),c(n)}function g(){var n=ta.mouse(this),e=Math.log(k.k)/Math.LN2;i(this,n,t(n),ta.event.shiftKey?Math.ceil(e)-1:Math.floor(e)+1)}var p,v,d,m,y,M,x,_,S,k={x:0,y:0,k:1},E=[960,500],A=Va,N=0,C="mousedown.zoom",z="mousemove.zoom",q="mouseup.zoom",L="touchstart.zoom",T=w(n,"zoomstart","zoom","zoomend");return n.event=function(n){n.each(function(){var n=T.of(this,arguments),t=k;Dl?ta.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},a(n)}).tween("zoom:zoom",function(){var e=E[0],r=E[1],u=v?v[0]:e/2,i=v?v[1]:r/2,o=ta.interpolateZoom([(u-k.x)/k.k,(i-k.y)/k.k,e/k.k],[(u-t.x)/t.k,(i-t.y)/t.k,e/t.k]);return function(t){var r=o(t),a=e/r[2];this.__chart__=k={x:u-r[0]*a,y:i-r[1]*a,k:a},c(n)}}).each("interrupt.zoom",function(){l(n)}).each("end.zoom",function(){l(n)}):(this.__chart__=k,a(n),c(n),l(n))})},n.translate=function(t){return arguments.length?(k={x:+t[0],y:+t[1],k:k.k},o(),n):[k.x,k.y]},n.scale=function(t){return arguments.length?(k={x:k.x,y:k.y,k:+t},o(),n):k.k},n.scaleExtent=function(t){return arguments.length?(A=null==t?Va:[+t[0],+t[1]],n):A},n.center=function(t){return arguments.length?(d=t&&[+t[0],+t[1]],n):d},n.size=function(t){return arguments.length?(E=t&&[+t[0],+t[1]],n):E},n.x=function(t){return arguments.length?(x=t,M=t.copy(),k={x:0,y:0,k:1},n):x},n.y=function(t){return arguments.length?(S=t,_=t.copy(),k={x:0,y:0,k:1},n):S},ta.rebind(n,T,"on")};var Za,Va=[0,1/0],Xa="onwheel"in ua?(Za=function(){return-ta.event.deltaY*(ta.event.deltaMode?120:1)},"wheel"):"onmousewheel"in ua?(Za=function(){return ta.event.wheelDelta},"mousewheel"):(Za=function(){return-ta.event.detail},"MozMousePixelScroll");ta.color=ot,ot.prototype.toString=function(){return this.rgb()+""},ta.hsl=at;var $a=at.prototype=new ot;$a.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new at(this.h,this.s,this.l/n)},$a.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new at(this.h,this.s,n*this.l)},$a.rgb=function(){return ct(this.h,this.s,this.l)},ta.hcl=lt;var Ba=lt.prototype=new ot;Ba.brighter=function(n){return new lt(this.h,this.c,Math.min(100,this.l+Wa*(arguments.length?n:1)))},Ba.darker=function(n){return new lt(this.h,this.c,Math.max(0,this.l-Wa*(arguments.length?n:1)))},Ba.rgb=function(){return st(this.h,this.c,this.l).rgb()},ta.lab=ft;var Wa=18,Ja=.95047,Ga=1,Ka=1.08883,Qa=ft.prototype=new ot;Qa.brighter=function(n){return new ft(Math.min(100,this.l+Wa*(arguments.length?n:1)),this.a,this.b)},Qa.darker=function(n){return new ft(Math.max(0,this.l-Wa*(arguments.length?n:1)),this.a,this.b)},Qa.rgb=function(){return ht(this.l,this.a,this.b)},ta.rgb=mt;var nc=mt.prototype=new ot;nc.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,u=30;return t||e||r?(t&&u>t&&(t=u),e&&u>e&&(e=u),r&&u>r&&(r=u),new mt(Math.min(255,t/n),Math.min(255,e/n),Math.min(255,r/n))):new mt(u,u,u)},nc.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new mt(n*this.r,n*this.g,n*this.b)},nc.hsl=function(){return _t(this.r,this.g,this.b)},nc.toString=function(){return"#"+xt(this.r)+xt(this.g)+xt(this.b)};var tc=ta.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});tc.forEach(function(n,t){tc.set(n,yt(t))}),ta.functor=Et,ta.xhr=Nt(At),ta.dsv=function(n,t){function e(n,e,i){arguments.length<3&&(i=e,e=null);var o=Ct(n,t,null==e?r:u(e),i);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:u(n)):e},o}function r(n){return e.parse(n.responseText)}function u(n){return function(t){return e.parse(t.responseText,n)}}function i(t){return t.map(o).join(n)}function o(n){return a.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var a=new RegExp('["'+n+"\n]"),c=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var u=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(u(n),e)}:u})},e.parseRows=function(n,t){function e(){if(s>=l)return o;if(u)return u=!1,i;var t=s;if(34===n.charCodeAt(t)){for(var e=t;e++<l;)if(34===n.charCodeAt(e)){if(34!==n.charCodeAt(e+1))break;++e}s=e+2;var r=n.charCodeAt(e+1);return 13===r?(u=!0,10===n.charCodeAt(e+2)&&++s):10===r&&(u=!0),n.slice(t+1,e).replace(/""/g,'"')}for(;l>s;){var r=n.charCodeAt(s++),a=1;if(10===r)u=!0;else if(13===r)u=!0,10===n.charCodeAt(s)&&(++s,++a);else if(r!==c)continue;return n.slice(t,s-a)}return n.slice(t)}for(var r,u,i={},o={},a=[],l=n.length,s=0,f=0;(r=e())!==o;){for(var h=[];r!==i&&r!==o;)h.push(r),r=e();t&&null==(h=t(h,f++))||a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new v,u=[];return t.forEach(function(n){for(var t in n)r.has(t)||u.push(r.add(t))}),[u.map(o).join(n)].concat(t.map(function(t){return u.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(i).join("\n")},e},ta.csv=ta.dsv(",","text/csv"),ta.tsv=ta.dsv(" ","text/tab-separated-values");var ec,rc,uc,ic,oc,ac=oa[m(oa,"requestAnimationFrame")]||function(n){setTimeout(n,17)};ta.timer=function(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var u=e+t,i={c:n,t:u,f:!1,n:null};rc?rc.n=i:ec=i,rc=i,uc||(ic=clearTimeout(ic),uc=1,ac(Lt))},ta.timer.flush=function(){Tt(),Rt()},ta.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var cc=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Pt);ta.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=ta.round(n,Dt(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),cc[8+e/3]};var lc=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,sc=ta.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=ta.round(n,Dt(n,t))).toFixed(Math.max(0,Math.min(20,Dt(n*(1+1e-15),t))))}}),fc=ta.time={},hc=Date;Ft.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){gc.setUTCDate.apply(this._,arguments)},setDay:function(){gc.setUTCDay.apply(this._,arguments)},setFullYear:function(){gc.setUTCFullYear.apply(this._,arguments)},setHours:function(){gc.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){gc.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){gc.setUTCMinutes.apply(this._,arguments)},setMonth:function(){gc.setUTCMonth.apply(this._,arguments)},setSeconds:function(){gc.setUTCSeconds.apply(this._,arguments)},setTime:function(){gc.setTime.apply(this._,arguments)}};var gc=Date.prototype;fc.year=Ht(function(n){return n=fc.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),fc.years=fc.year.range,fc.years.utc=fc.year.utc.range,fc.day=Ht(function(n){var t=new hc(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),fc.days=fc.day.range,fc.days.utc=fc.day.utc.range,fc.dayOfYear=function(n){var t=fc.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=fc[n]=Ht(function(n){return(n=fc.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=fc.year(n).getDay();return Math.floor((fc.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});fc[n+"s"]=e.range,fc[n+"s"].utc=e.utc.range,fc[n+"OfYear"]=function(n){var e=fc.year(n).getDay();return Math.floor((fc.dayOfYear(n)+(e+t)%7)/7)}}),fc.week=fc.sunday,fc.weeks=fc.sunday.range,fc.weeks.utc=fc.sunday.utc.range,fc.weekOfYear=fc.sundayOfYear;var pc={"-":"",_:" ",0:"0"},vc=/^\s*\d+/,dc=/^%/;ta.locale=function(n){return{numberFormat:Ut(n),timeFormat:Yt(n)}};var mc=ta.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});ta.format=mc.numberFormat,ta.geo={},le.prototype={s:0,t:0,add:function(n){se(n,this.t,yc),se(yc.s,this.s,this),this.s?this.t+=yc.t:this.s=yc.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var yc=new le;ta.geo.stream=function(n,t){n&&Mc.hasOwnProperty(n.type)?Mc[n.type](n,t):fe(n,t)};var Mc={Feature:function(n,t){fe(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,u=e.length;++r<u;)fe(e[r].geometry,t)}},xc={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)n=e[r],t.point(n[0],n[1],n[2])},LineString:function(n,t){he(n.coordinates,t,0)},MultiLineString:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)he(e[r],t,0)},Polygon:function(n,t){ge(n.coordinates,t)},MultiPolygon:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)ge(e[r],t)},GeometryCollection:function(n,t){for(var e=n.geometries,r=-1,u=e.length;++r<u;)fe(e[r],t)
+}};ta.geo.area=function(n){return bc=0,ta.geo.stream(n,wc),bc};var bc,_c=new le,wc={sphere:function(){bc+=4*Da},point:y,lineStart:y,lineEnd:y,polygonStart:function(){_c.reset(),wc.lineStart=pe},polygonEnd:function(){var n=2*_c;bc+=0>n?4*Da+n:n,wc.lineStart=wc.lineEnd=wc.point=y}};ta.geo.bounds=function(){function n(n,t){M.push(x=[s=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=ve([t*Fa,e*Fa]);if(m){var u=me(m,r),i=[u[1],-u[0],0],o=me(i,u);xe(o),o=be(o);var c=t-p,l=c>0?1:-1,v=o[0]*Ha*l,d=va(c)>180;if(d^(v>l*p&&l*t>v)){var y=o[1]*Ha;y>g&&(g=y)}else if(v=(v+360)%360-180,d^(v>l*p&&l*t>v)){var y=-o[1]*Ha;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);d?p>t?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t):h>=s?(s>t&&(s=t),t>h&&(h=t)):t>p?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t)}else n(t,e);m=r,p=t}function e(){b.point=t}function r(){x[0]=s,x[1]=h,b.point=n,m=null}function u(n,e){if(m){var r=n-p;y+=va(r)>180?r+(r>0?360:-360):r}else v=n,d=e;wc.point(n,e),t(n,e)}function i(){wc.lineStart()}function o(){u(v,d),wc.lineEnd(),va(y)>Ta&&(s=-(h=180)),x[0]=s,x[1]=h,m=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var s,f,h,g,p,v,d,m,y,M,x,b={point:n,lineStart:e,lineEnd:r,polygonStart:function(){b.point=u,b.lineStart=i,b.lineEnd=o,y=0,wc.polygonStart()},polygonEnd:function(){wc.polygonEnd(),b.point=n,b.lineStart=e,b.lineEnd=r,0>_c?(s=-(h=180),f=-(g=90)):y>Ta?g=90:-Ta>y&&(f=-90),x[0]=s,x[1]=h}};return function(n){g=h=-(s=f=1/0),M=[],ta.geo.stream(n,b);var t=M.length;if(t){M.sort(c);for(var e,r=1,u=M[0],i=[u];t>r;++r)e=M[r],l(e[0],u)||l(e[1],u)?(a(u[0],e[1])>a(u[0],u[1])&&(u[1]=e[1]),a(e[0],u[1])>a(u[0],u[1])&&(u[0]=e[0])):i.push(u=e);for(var o,e,p=-1/0,t=i.length-1,r=0,u=i[t];t>=r;u=e,++r)e=i[r],(o=a(u[1],e[0]))>p&&(p=o,s=e[0],h=u[1])}return M=x=null,1/0===s||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[s,f],[h,g]]}}(),ta.geo.centroid=function(n){Sc=kc=Ec=Ac=Nc=Cc=zc=qc=Lc=Tc=Rc=0,ta.geo.stream(n,Dc);var t=Lc,e=Tc,r=Rc,u=t*t+e*e+r*r;return Ra>u&&(t=Cc,e=zc,r=qc,Ta>kc&&(t=Ec,e=Ac,r=Nc),u=t*t+e*e+r*r,Ra>u)?[0/0,0/0]:[Math.atan2(e,t)*Ha,tt(r/Math.sqrt(u))*Ha]};var Sc,kc,Ec,Ac,Nc,Cc,zc,qc,Lc,Tc,Rc,Dc={sphere:y,point:we,lineStart:ke,lineEnd:Ee,polygonStart:function(){Dc.lineStart=Ae},polygonEnd:function(){Dc.lineStart=ke}},Pc=Te(Ce,Ue,Fe,[-Da,-Da/2]),Uc=1e9;ta.geo.clipExtent=function(){var n,t,e,r,u,i,o={stream:function(n){return u&&(u.valid=!1),u=i(n),u.valid=!0,u},extent:function(a){return arguments.length?(i=Ie(n=+a[0][0],t=+a[0][1],e=+a[1][0],r=+a[1][1]),u&&(u.valid=!1,u=null),o):[[n,t],[e,r]]}};return o.extent([[0,0],[960,500]])},(ta.geo.conicEqualArea=function(){return Ze(Ve)}).raw=Ve,ta.geo.albers=function(){return ta.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ta.geo.albersUsa=function(){function n(n){var i=n[0],o=n[1];return t=null,e(i,o),t||(r(i,o),t)||u(i,o),t}var t,e,r,u,i=ta.geo.albers(),o=ta.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=ta.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=i.scale(),e=i.translate(),r=(n[0]-e[0])/t,u=(n[1]-e[1])/t;return(u>=.12&&.234>u&&r>=-.425&&-.214>r?o:u>=.166&&.234>u&&r>=-.214&&-.115>r?a:i).invert(n)},n.stream=function(n){var t=i.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,u){t.point(n,u),e.point(n,u),r.point(n,u)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(i.precision(t),o.precision(t),a.precision(t),n):i.precision()},n.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),a.scale(t),n.translate(i.translate())):i.scale()},n.translate=function(t){if(!arguments.length)return i.translate();var l=i.scale(),s=+t[0],f=+t[1];return e=i.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,r=o.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+Ta,f+.12*l+Ta],[s-.214*l-Ta,f+.234*l-Ta]]).stream(c).point,u=a.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+Ta,f+.166*l+Ta],[s-.115*l-Ta,f+.234*l-Ta]]).stream(c).point,n},n.scale(1070)};var jc,Fc,Hc,Oc,Yc,Ic,Zc={point:y,lineStart:y,lineEnd:y,polygonStart:function(){Fc=0,Zc.lineStart=Xe},polygonEnd:function(){Zc.lineStart=Zc.lineEnd=Zc.point=y,jc+=va(Fc/2)}},Vc={point:$e,lineStart:y,lineEnd:y,polygonStart:y,polygonEnd:y},Xc={point:Je,lineStart:Ge,lineEnd:Ke,polygonStart:function(){Xc.lineStart=Qe},polygonEnd:function(){Xc.point=Je,Xc.lineStart=Ge,Xc.lineEnd=Ke}};ta.geo.path=function(){function n(n){return n&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=u(i)),ta.geo.stream(n,o)),i.result()}function t(){return o=null,n}var e,r,u,i,o,a=4.5;return n.area=function(n){return jc=0,ta.geo.stream(n,u(Zc)),jc},n.centroid=function(n){return Ec=Ac=Nc=Cc=zc=qc=Lc=Tc=Rc=0,ta.geo.stream(n,u(Xc)),Rc?[Lc/Rc,Tc/Rc]:qc?[Cc/qc,zc/qc]:Nc?[Ec/Nc,Ac/Nc]:[0/0,0/0]},n.bounds=function(n){return Yc=Ic=-(Hc=Oc=1/0),ta.geo.stream(n,u(Vc)),[[Hc,Oc],[Yc,Ic]]},n.projection=function(n){return arguments.length?(u=(e=n)?n.stream||er(n):At,t()):e},n.context=function(n){return arguments.length?(i=null==(r=n)?new Be:new nr(n),"function"!=typeof a&&i.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(i.pointRadius(+t),+t),n):a},n.projection(ta.geo.albersUsa()).context(null)},ta.geo.transform=function(n){return{stream:function(t){var e=new rr(t);for(var r in n)e[r]=n[r];return e}}},rr.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ta.geo.projection=ir,ta.geo.projectionMutator=or,(ta.geo.equirectangular=function(){return ir(cr)}).raw=cr.invert=cr,ta.geo.rotation=function(n){function t(t){return t=n(t[0]*Fa,t[1]*Fa),t[0]*=Ha,t[1]*=Ha,t}return n=sr(n[0]%360*Fa,n[1]*Fa,n.length>2?n[2]*Fa:0),t.invert=function(t){return t=n.invert(t[0]*Fa,t[1]*Fa),t[0]*=Ha,t[1]*=Ha,t},t},lr.invert=cr,ta.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=sr(-n[0]*Fa,-n[1]*Fa,0).invert,u=[];return e(null,null,1,{point:function(n,e){u.push(n=t(n,e)),n[0]*=Ha,n[1]*=Ha}}),{type:"Polygon",coordinates:[u]}}var t,e,r=[0,0],u=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=pr((t=+r)*Fa,u*Fa),n):t},n.precision=function(r){return arguments.length?(e=pr(t*Fa,(u=+r)*Fa),n):u},n.angle(90)},ta.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Fa,u=n[1]*Fa,i=t[1]*Fa,o=Math.sin(r),a=Math.cos(r),c=Math.sin(u),l=Math.cos(u),s=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((e=f*o)*e+(e=l*s-c*f*a)*e),c*s+l*f*a)},ta.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return ta.range(Math.ceil(i/d)*d,u,d).map(h).concat(ta.range(Math.ceil(l/m)*m,c,m).map(g)).concat(ta.range(Math.ceil(r/p)*p,e,p).filter(function(n){return va(n%d)>Ta}).map(s)).concat(ta.range(Math.ceil(a/v)*v,o,v).filter(function(n){return va(n%m)>Ta}).map(f))}var e,r,u,i,o,a,c,l,s,f,h,g,p=10,v=p,d=90,m=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(g(c).slice(1),h(u).reverse().slice(1),g(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(i=+t[0][0],u=+t[1][0],l=+t[0][1],c=+t[1][1],i>u&&(t=i,i=u,u=t),l>c&&(t=l,l=c,c=t),n.precision(y)):[[i,l],[u,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(y)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],m=+t[1],n):[d,m]},n.minorStep=function(t){return arguments.length?(p=+t[0],v=+t[1],n):[p,v]},n.precision=function(t){return arguments.length?(y=+t,s=dr(a,o,90),f=mr(r,e,y),h=dr(l,c,90),g=mr(i,u,y),n):y},n.majorExtent([[-180,-90+Ta],[180,90-Ta]]).minorExtent([[-180,-80-Ta],[180,80+Ta]])},ta.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||u.apply(this,arguments)]}}var t,e,r=yr,u=Mr;return n.distance=function(){return ta.geo.distance(t||r.apply(this,arguments),e||u.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(u=t,e="function"==typeof t?null:t,n):u},n.precision=function(){return arguments.length?n:0},n},ta.geo.interpolate=function(n,t){return xr(n[0]*Fa,n[1]*Fa,t[0]*Fa,t[1]*Fa)},ta.geo.length=function(n){return $c=0,ta.geo.stream(n,Bc),$c};var $c,Bc={sphere:y,point:y,lineStart:br,lineEnd:y,polygonStart:y,polygonEnd:y},Wc=_r(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(ta.geo.azimuthalEqualArea=function(){return ir(Wc)}).raw=Wc;var Jc=_r(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},At);(ta.geo.azimuthalEquidistant=function(){return ir(Jc)}).raw=Jc,(ta.geo.conicConformal=function(){return Ze(wr)}).raw=wr,(ta.geo.conicEquidistant=function(){return Ze(Sr)}).raw=Sr;var Gc=_r(function(n){return 1/n},Math.atan);(ta.geo.gnomonic=function(){return ir(Gc)}).raw=Gc,kr.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-ja]},(ta.geo.mercator=function(){return Er(kr)}).raw=kr;var Kc=_r(function(){return 1},Math.asin);(ta.geo.orthographic=function(){return ir(Kc)}).raw=Kc;var Qc=_r(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(ta.geo.stereographic=function(){return ir(Qc)}).raw=Qc,Ar.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-ja]},(ta.geo.transverseMercator=function(){var n=Er(Ar),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Ar,ta.geom={},ta.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,u=Et(e),i=Et(r),o=n.length,a=[],c=[];for(t=0;o>t;t++)a.push([+u.call(this,n[t],t),+i.call(this,n[t],t),t]);for(a.sort(qr),t=0;o>t;t++)c.push([a[t][0],-a[t][1]]);var l=zr(a),s=zr(c),f=s[0]===l[0],h=s[s.length-1]===l[l.length-1],g=[];for(t=l.length-1;t>=0;--t)g.push(n[a[l[t]][2]]);for(t=+f;t<s.length-h;++t)g.push(n[a[s[t]][2]]);return g}var e=Nr,r=Cr;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t)},ta.geom.polygon=function(n){return xa(n,nl),n};var nl=ta.geom.polygon.prototype=[];nl.area=function(){for(var n,t=-1,e=this.length,r=this[e-1],u=0;++t<e;)n=r,r=this[t],u+=n[1]*r[0]-n[0]*r[1];return.5*u},nl.centroid=function(n){var t,e,r=-1,u=this.length,i=0,o=0,a=this[u-1];for(arguments.length||(n=-1/(6*this.area()));++r<u;)t=a,a=this[r],e=t[0]*a[1]-a[0]*t[1],i+=(t[0]+a[0])*e,o+=(t[1]+a[1])*e;return[i*n,o*n]},nl.clip=function(n){for(var t,e,r,u,i,o,a=Rr(n),c=-1,l=this.length-Rr(this),s=this[l-1];++c<l;){for(t=n.slice(),n.length=0,u=this[c],i=t[(r=t.length-a)-1],e=-1;++e<r;)o=t[e],Lr(o,s,u)?(Lr(i,s,u)||n.push(Tr(i,o,s,u)),n.push(o)):Lr(i,s,u)&&n.push(Tr(i,o,s,u)),i=o;a&&n.push(n[0]),s=u}return n};var tl,el,rl,ul,il,ol=[],al=[];Yr.prototype.prepare=function(){for(var n,t=this.edges,e=t.length;e--;)n=t[e].edge,n.b&&n.a||t.splice(e,1);return t.sort(Zr),t.length},nu.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},tu.prototype={insert:function(n,t){var e,r,u;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=iu(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)r=e.U,e===r.L?(u=r.R,u&&u.C?(e.C=u.C=!1,r.C=!0,n=r):(n===e.R&&(ru(this,e),n=e,e=n.U),e.C=!1,r.C=!0,uu(this,r))):(u=r.L,u&&u.C?(e.C=u.C=!1,r.C=!0,n=r):(n===e.L&&(uu(this,e),n=e,e=n.U),e.C=!1,r.C=!0,ru(this,r))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t,e,r,u=n.U,i=n.L,o=n.R;if(e=i?o?iu(o):i:o,u?u.L===n?u.L=e:u.R=e:this._=e,i&&o?(r=e.C,e.C=n.C,e.L=i,i.U=e,e!==o?(u=e.U,e.U=n.U,n=e.R,u.L=n,e.R=o,o.U=e):(e.U=u,u=e,n=e.R)):(r=n.C,n=e),n&&(n.U=u),!r){if(n&&n.C)return n.C=!1,void 0;do{if(n===this._)break;if(n===u.L){if(t=u.R,t.C&&(t.C=!1,u.C=!0,ru(this,u),t=u.R),t.L&&t.L.C||t.R&&t.R.C){t.R&&t.R.C||(t.L.C=!1,t.C=!0,uu(this,t),t=u.R),t.C=u.C,u.C=t.R.C=!1,ru(this,u),n=this._;break}}else if(t=u.L,t.C&&(t.C=!1,u.C=!0,uu(this,u),t=u.L),t.L&&t.L.C||t.R&&t.R.C){t.L&&t.L.C||(t.R.C=!1,t.C=!0,ru(this,t),t=u.L),t.C=u.C,u.C=t.L.C=!1,uu(this,u),n=this._;break}t.C=!0,n=u,u=u.U}while(!n.C);n&&(n.C=!1)}}},ta.geom.voronoi=function(n){function t(n){var t=new Array(n.length),r=a[0][0],u=a[0][1],i=a[1][0],o=a[1][1];return ou(e(n),a).cells.forEach(function(e,a){var c=e.edges,l=e.site,s=t[a]=c.length?c.map(function(n){var t=n.start();return[t.x,t.y]}):l.x>=r&&l.x<=i&&l.y>=u&&l.y<=o?[[r,o],[i,o],[i,u],[r,u]]:[];s.point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(i(n,t)/Ta)*Ta,y:Math.round(o(n,t)/Ta)*Ta,i:t}})}var r=Nr,u=Cr,i=r,o=u,a=cl;return n?t(n):(t.links=function(n){return ou(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return ou(e(n)).cells.forEach(function(e,r){for(var u,i,o=e.site,a=e.edges.sort(Zr),c=-1,l=a.length,s=a[l-1].edge,f=s.l===o?s.r:s.l;++c<l;)u=s,i=f,s=a[c].edge,f=s.l===o?s.r:s.l,r<i.i&&r<f.i&&cu(o,i,f)<0&&t.push([n[r],n[i.i],n[f.i]])}),t},t.x=function(n){return arguments.length?(i=Et(r=n),t):r},t.y=function(n){return arguments.length?(o=Et(u=n),t):u},t.clipExtent=function(n){return arguments.length?(a=null==n?cl:n,t):a===cl?null:a},t.size=function(n){return arguments.length?t.clipExtent(n&&[[0,0],n]):a===cl?null:a&&a[1]},t)};var cl=[[-1e6,-1e6],[1e6,1e6]];ta.geom.delaunay=function(n){return ta.geom.voronoi().triangles(n)},ta.geom.quadtree=function(n,t,e,r,u){function i(n){function i(n,t,e,r,u,i,o,a){if(!isNaN(e)&&!isNaN(r))if(n.leaf){var c=n.x,s=n.y;if(null!=c)if(va(c-e)+va(s-r)<.01)l(n,t,e,r,u,i,o,a);else{var f=n.point;n.x=n.y=n.point=null,l(n,f,c,s,u,i,o,a),l(n,t,e,r,u,i,o,a)}else n.x=e,n.y=r,n.point=t}else l(n,t,e,r,u,i,o,a)}function l(n,t,e,r,u,o,a,c){var l=.5*(u+a),s=.5*(o+c),f=e>=l,h=r>=s,g=h<<1|f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=fu()),f?u=l:a=l,h?o=s:c=s,i(n,t,e,r,u,o,a,c)}var s,f,h,g,p,v,d,m,y,M=Et(a),x=Et(c);if(null!=t)v=t,d=e,m=r,y=u;else if(m=y=-(v=d=1/0),f=[],h=[],p=n.length,o)for(g=0;p>g;++g)s=n[g],s.x<v&&(v=s.x),s.y<d&&(d=s.y),s.x>m&&(m=s.x),s.y>y&&(y=s.y),f.push(s.x),h.push(s.y);else for(g=0;p>g;++g){var b=+M(s=n[g],g),_=+x(s,g);v>b&&(v=b),d>_&&(d=_),b>m&&(m=b),_>y&&(y=_),f.push(b),h.push(_)}var w=m-v,S=y-d;w>S?y=d+w:m=v+S;var k=fu();if(k.add=function(n){i(k,n,+M(n,++g),+x(n,g),v,d,m,y)},k.visit=function(n){hu(n,k,v,d,m,y)},k.find=function(n){return gu(k,n[0],n[1],v,d,m,y)},g=-1,null==t){for(;++g<p;)i(k,n[g],f[g],h[g],v,d,m,y);--g}else n.forEach(k.add);return f=h=n=s=null,k}var o,a=Nr,c=Cr;return(o=arguments.length)?(a=lu,c=su,3===o&&(u=e,r=t,e=t=0),i(n)):(i.x=function(n){return arguments.length?(a=n,i):a},i.y=function(n){return arguments.length?(c=n,i):c},i.extent=function(n){return arguments.length?(null==n?t=e=r=u=null:(t=+n[0][0],e=+n[0][1],r=+n[1][0],u=+n[1][1]),i):null==t?null:[[t,e],[r,u]]},i.size=function(n){return arguments.length?(null==n?t=e=r=u=null:(t=e=0,r=+n[0],u=+n[1]),i):null==t?null:[r-t,u-e]},i)},ta.interpolateRgb=pu,ta.interpolateObject=vu,ta.interpolateNumber=du,ta.interpolateString=mu;var ll=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sl=new RegExp(ll.source,"g");ta.interpolate=yu,ta.interpolators=[function(n,t){var e=typeof t;return("string"===e?tc.has(t)||/^(#|rgb\(|hsl\()/.test(t)?pu:mu:t instanceof ot?pu:Array.isArray(t)?Mu:"object"===e&&isNaN(t)?vu:du)(n,t)}],ta.interpolateArray=Mu;var fl=function(){return At},hl=ta.map({linear:fl,poly:Eu,quad:function(){return wu},cubic:function(){return Su},sin:function(){return Au},exp:function(){return Nu},circle:function(){return Cu},elastic:zu,back:qu,bounce:function(){return Lu}}),gl=ta.map({"in":At,out:bu,"in-out":_u,"out-in":function(n){return _u(bu(n))}});ta.ease=function(n){var t=n.indexOf("-"),e=t>=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=hl.get(e)||fl,r=gl.get(r)||At,xu(r(e.apply(null,ea.call(arguments,1))))},ta.interpolateHcl=Tu,ta.interpolateHsl=Ru,ta.interpolateLab=Du,ta.interpolateRound=Pu,ta.transform=function(n){var t=ua.createElementNS(ta.ns.prefix.svg,"g");return(ta.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Uu(e?e.matrix:pl)})(n)},Uu.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var pl={a:1,b:0,c:0,d:1,e:0,f:0};ta.interpolateTransform=Ou,ta.layout={},ta.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e<r;)t.push(Zu(n[e]));return t}},ta.layout.chord=function(){function n(){var n,l,f,h,g,p={},v=[],d=ta.range(i),m=[];for(e=[],r=[],n=0,h=-1;++h<i;){for(l=0,g=-1;++g<i;)l+=u[h][g];v.push(l),m.push(ta.range(i)),n+=l}for(o&&d.sort(function(n,t){return o(v[n],v[t])}),a&&m.forEach(function(n,t){n.sort(function(n,e){return a(u[t][n],u[t][e])})}),n=(Pa-s*i)/n,l=0,h=-1;++h<i;){for(f=l,g=-1;++g<i;){var y=d[h],M=m[y][g],x=u[y][M],b=l,_=l+=x*n;p[y+"-"+M]={index:y,subindex:M,startAngle:b,endAngle:_,value:x}}r[y]={index:y,startAngle:f,endAngle:l,value:(l-f)/n},l+=s}for(h=-1;++h<i;)for(g=h-1;++g<i;){var w=p[h+"-"+g],S=p[g+"-"+h];(w.value||S.value)&&e.push(w.value<S.value?{source:S,target:w}:{source:w,target:S})}c&&t()}function t(){e.sort(function(n,t){return c((n.source.value+n.target.value)/2,(t.source.value+t.target.value)/2)})}var e,r,u,i,o,a,c,l={},s=0;return l.matrix=function(n){return arguments.length?(i=(u=n)&&u.length,e=r=null,l):u},l.padding=function(n){return arguments.length?(s=n,e=r=null,l):s},l.sortGroups=function(n){return arguments.length?(o=n,e=r=null,l):o},l.sortSubgroups=function(n){return arguments.length?(a=n,e=null,l):a},l.sortChords=function(n){return arguments.length?(c=n,e&&t(),l):c},l.chords=function(){return e||n(),e},l.groups=function(){return r||n(),r},l},ta.layout.force=function(){function n(n){return function(t,e,r,u){if(t.point!==n){var i=t.cx-n.x,o=t.cy-n.y,a=u-e,c=i*i+o*o;if(c>a*a/d){if(p>c){var l=t.charge/c;n.px-=i*l,n.py-=o*l}return!0}if(t.point&&c&&p>c){var l=t.pointCharge/c;n.px-=i*l,n.py-=o*l}}return!t.charge}}function t(n){n.px=ta.event.x,n.py=ta.event.y,a.resume()}var e,r,u,i,o,a={},c=ta.dispatch("start","tick","end"),l=[1,1],s=.9,f=vl,h=dl,g=-30,p=ml,v=.1,d=.64,m=[],y=[];return a.tick=function(){if((r*=.99)<.005)return c.end({type:"end",alpha:r=0}),!0;var t,e,a,f,h,p,d,M,x,b=m.length,_=y.length;for(e=0;_>e;++e)a=y[e],f=a.source,h=a.target,M=h.x-f.x,x=h.y-f.y,(p=M*M+x*x)&&(p=r*i[e]*((p=Math.sqrt(p))-u[e])/p,M*=p,x*=p,h.x-=M*(d=f.weight/(h.weight+f.weight)),h.y-=x*d,f.x+=M*(d=1-d),f.y+=x*d);if((d=r*v)&&(M=l[0]/2,x=l[1]/2,e=-1,d))for(;++e<b;)a=m[e],a.x+=(M-a.x)*d,a.y+=(x-a.y)*d;if(g)for(Gu(t=ta.geom.quadtree(m),r,o),e=-1;++e<b;)(a=m[e]).fixed||t.visit(n(a));for(e=-1;++e<b;)a=m[e],a.fixed?(a.x=a.px,a.y=a.py):(a.x-=(a.px-(a.px=a.x))*s,a.y-=(a.py-(a.py=a.y))*s);c.tick({type:"tick",alpha:r})},a.nodes=function(n){return arguments.length?(m=n,a):m},a.links=function(n){return arguments.length?(y=n,a):y},a.size=function(n){return arguments.length?(l=n,a):l},a.linkDistance=function(n){return arguments.length?(f="function"==typeof n?n:+n,a):f},a.distance=a.linkDistance,a.linkStrength=function(n){return arguments.length?(h="function"==typeof n?n:+n,a):h},a.friction=function(n){return arguments.length?(s=+n,a):s},a.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,a):g},a.chargeDistance=function(n){return arguments.length?(p=n*n,a):Math.sqrt(p)},a.gravity=function(n){return arguments.length?(v=+n,a):v},a.theta=function(n){return arguments.length?(d=n*n,a):Math.sqrt(d)},a.alpha=function(n){return arguments.length?(n=+n,r?r=n>0?n:0:n>0&&(c.start({type:"start",alpha:r=n}),ta.timer(a.tick)),a):r},a.start=function(){function n(n,r){if(!e){for(e=new Array(c),a=0;c>a;++a)e[a]=[];for(a=0;l>a;++a){var u=y[a];e[u.source.index].push(u.target),e[u.target.index].push(u.source)}}for(var i,o=e[t],a=-1,l=o.length;++a<l;)if(!isNaN(i=o[a][n]))return i;return Math.random()*r}var t,e,r,c=m.length,s=y.length,p=l[0],v=l[1];for(t=0;c>t;++t)(r=m[t]).index=t,r.weight=0;for(t=0;s>t;++t)r=y[t],"number"==typeof r.source&&(r.source=m[r.source]),"number"==typeof r.target&&(r.target=m[r.target]),++r.source.weight,++r.target.weight;for(t=0;c>t;++t)r=m[t],isNaN(r.x)&&(r.x=n("x",p)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(u=[],"function"==typeof f)for(t=0;s>t;++t)u[t]=+f.call(this,y[t],t);else for(t=0;s>t;++t)u[t]=f;if(i=[],"function"==typeof h)for(t=0;s>t;++t)i[t]=+h.call(this,y[t],t);else for(t=0;s>t;++t)i[t]=h;if(o=[],"function"==typeof g)for(t=0;c>t;++t)o[t]=+g.call(this,m[t],t);else for(t=0;c>t;++t)o[t]=g;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){return e||(e=ta.behavior.drag().origin(At).on("dragstart.force",$u).on("drag.force",t).on("dragend.force",Bu)),arguments.length?(this.on("mouseover.force",Wu).on("mouseout.force",Ju).call(e),void 0):e},ta.rebind(a,c,"on")};var vl=20,dl=1,ml=1/0;ta.layout.hierarchy=function(){function n(u){var i,o=[u],a=[];for(u.depth=0;null!=(i=o.pop());)if(a.push(i),(l=e.call(n,i,i.depth))&&(c=l.length)){for(var c,l,s;--c>=0;)o.push(s=l[c]),s.parent=i,s.depth=i.depth+1;r&&(i.value=0),i.children=l}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return ni(u,function(n){var e,u;t&&(e=n.children)&&e.sort(t),r&&(u=n.parent)&&(u.value+=n.value)}),a}var t=ri,e=ti,r=ei;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(Qu(t,function(n){n.children&&(n.value=0)}),ni(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},ta.layout.partition=function(){function n(t,e,r,u){var i=t.children;if(t.x=e,t.y=t.depth*u,t.dx=r,t.dy=u,i&&(o=i.length)){var o,a,c,l=-1;for(r=t.value?r/t.value:0;++l<o;)n(a=i[l],e,c=a.value*r,u),e+=c}}function t(n){var e=n.children,r=0;if(e&&(u=e.length))for(var u,i=-1;++i<u;)r=Math.max(r,t(e[i]));return 1+r}function e(e,i){var o=r.call(this,e,i);return n(o[0],0,u[0],u[1]/t(o[0])),o}var r=ta.layout.hierarchy(),u=[1,1];return e.size=function(n){return arguments.length?(u=n,e):u},Ku(e,r)},ta.layout.pie=function(){function n(o){var a,c=o.length,l=o.map(function(e,r){return+t.call(n,e,r)}),s=+("function"==typeof r?r.apply(this,arguments):r),f=("function"==typeof u?u.apply(this,arguments):u)-s,h=Math.min(Math.abs(f)/c,+("function"==typeof i?i.apply(this,arguments):i)),g=h*(0>f?-1:1),p=(f-c*g)/ta.sum(l),v=ta.range(c),d=[];return null!=e&&v.sort(e===yl?function(n,t){return l[t]-l[n]}:function(n,t){return e(o[n],o[t])}),v.forEach(function(n){d[n]={data:o[n],value:a=l[n],startAngle:s,endAngle:s+=a*p+g,padAngle:h}}),d}var t=Number,e=yl,r=0,u=Pa,i=0;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(u=t,n):u},n.padAngle=function(t){return arguments.length?(i=t,n):i},n};var yl={};ta.layout.stack=function(){function n(a,c){if(!(h=a.length))return a;var l=a.map(function(e,r){return t.call(n,e,r)}),s=l.map(function(t){return t.map(function(t,e){return[i.call(n,t,e),o.call(n,t,e)]})}),f=e.call(n,s,c);l=ta.permute(l,f),s=ta.permute(s,f);var h,g,p,v,d=r.call(n,s,c),m=l[0].length;for(p=0;m>p;++p)for(u.call(n,l[0][p],v=d[p],s[0][p][1]),g=1;h>g;++g)u.call(n,l[g][p],v+=s[g-1][p][1],s[g][p][1]);return a}var t=At,e=ci,r=li,u=ai,i=ii,o=oi;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:Ml.get(t)||ci,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:xl.get(t)||li,n):r},n.x=function(t){return arguments.length?(i=t,n):i},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(u=t,n):u},n};var Ml=ta.map({"inside-out":function(n){var t,e,r=n.length,u=n.map(si),i=n.map(fi),o=ta.range(r).sort(function(n,t){return u[n]-u[t]}),a=0,c=0,l=[],s=[];for(t=0;r>t;++t)e=o[t],c>a?(a+=i[e],l.push(e)):(c+=i[e],s.push(e));return s.reverse().concat(l)},reverse:function(n){return ta.range(n.length).reverse()},"default":ci}),xl=ta.map({silhouette:function(n){var t,e,r,u=n.length,i=n[0].length,o=[],a=0,c=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;i>e;++e)c[e]=(a-o[e])/2;return c},wiggle:function(n){var t,e,r,u,i,o,a,c,l,s=n.length,f=n[0],h=f.length,g=[];for(g[0]=c=l=0,e=1;h>e;++e){for(t=0,u=0;s>t;++t)u+=n[t][e][1];for(t=0,i=0,a=f[e][0]-f[e-1][0];s>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;i+=o*n[t][e][1]}g[e]=c-=u?i/u*a:0,l>c&&(l=c)}for(e=0;h>e;++e)g[e]-=l;return g},expand:function(n){var t,e,r,u=n.length,i=n[0].length,o=1/u,a=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];if(r)for(t=0;u>t;t++)n[t][e][1]/=r;else for(t=0;u>t;t++)n[t][e][1]=o}for(e=0;i>e;++e)a[e]=0;return a},zero:li});ta.layout.histogram=function(){function n(n,i){for(var o,a,c=[],l=n.map(e,this),s=r.call(this,l,i),f=u.call(this,s,l,i),i=-1,h=l.length,g=f.length-1,p=t?1:1/h;++i<g;)o=c[i]=[],o.dx=f[i+1]-(o.x=f[i]),o.y=0;if(g>0)for(i=-1;++i<h;)a=l[i],a>=s[0]&&a<=s[1]&&(o=c[ta.bisect(f,a,1,g)-1],o.y+=p,o.push(n[i]));return c}var t=!0,e=Number,r=vi,u=gi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=Et(t),n):r},n.bins=function(t){return arguments.length?(u="number"==typeof t?function(n){return pi(n,t)}:Et(t),n):u},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},ta.layout.pack=function(){function n(n,i){var o=e.call(this,n,i),a=o[0],c=u[0],l=u[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,ni(a,function(n){n.r=+s(n.value)}),ni(a,xi),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/l))/2;ni(a,function(n){n.r+=f}),ni(a,xi),ni(a,function(n){n.r-=f})}return wi(a,c/2,l/2,t?1:1/Math.max(2*a.r/c,2*a.r/l)),o}var t,e=ta.layout.hierarchy().sort(di),r=0,u=[1,1];return n.size=function(t){return arguments.length?(u=t,n):u},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},Ku(n,e)},ta.layout.tree=function(){function n(n,u){var s=o.call(this,n,u),f=s[0],h=t(f);if(ni(h,e),h.parent.m=-h.z,Qu(h,r),l)Qu(f,i);else{var g=f,p=f,v=f;Qu(f,function(n){n.x<g.x&&(g=n),n.x>p.x&&(p=n),n.depth>v.depth&&(v=n)});var d=a(g,p)/2-g.x,m=c[0]/(p.x+a(p,g)/2+d),y=c[1]/(v.depth||1);Qu(f,function(n){n.x=(n.x+d)*m,n.y=n.depth*y})}return s}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var u,i=t.children,o=0,a=i.length;a>o;++o)r.push((i[o]=u={_:i[o],parent:t,children:(u=i[o].children)&&u.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=u);return e.children[0]}function e(n){var t=n.children,e=n.parent.children,r=n.i?e[n.i-1]:null;if(t.length){Ci(n);var i=(t[0].z+t[t.length-1].z)/2;r?(n.z=r.z+a(n._,r._),n.m=n.z-i):n.z=i}else r&&(n.z=r.z+a(n._,r._));n.parent.A=u(n,r,n.parent.A||e[0])}function r(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function u(n,t,e){if(t){for(var r,u=n,i=n,o=t,c=u.parent.children[0],l=u.m,s=i.m,f=o.m,h=c.m;o=Ai(o),u=Ei(u),o&&u;)c=Ei(c),i=Ai(i),i.a=n,r=o.z+f-u.z-l+a(o._,u._),r>0&&(Ni(zi(o,n,e),n,r),l+=r,s+=r),f+=o.m,l+=u.m,h+=c.m,s+=i.m;o&&!Ai(i)&&(i.t=o,i.m+=f-s),u&&!Ei(c)&&(c.t=u,c.m+=l-h,e=n)}return e}function i(n){n.x*=c[0],n.y=n.depth*c[1]}var o=ta.layout.hierarchy().sort(null).value(null),a=ki,c=[1,1],l=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(l=null==(c=t)?i:null,n):l?null:c},n.nodeSize=function(t){return arguments.length?(l=null==(c=t)?null:i,n):l?c:null},Ku(n,o)},ta.layout.cluster=function(){function n(n,i){var o,a=t.call(this,n,i),c=a[0],l=0;ni(c,function(n){var t=n.children;t&&t.length?(n.x=Li(t),n.y=qi(t)):(n.x=o?l+=e(n,o):0,n.y=0,o=n)});var s=Ti(c),f=Ri(c),h=s.x-e(s,f)/2,g=f.x+e(f,s)/2;return ni(c,u?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=ta.layout.hierarchy().sort(null).value(null),e=ki,r=[1,1],u=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(u=null==(r=t),n):u?null:r},n.nodeSize=function(t){return arguments.length?(u=null!=(r=t),n):u?r:null},Ku(n,t)},ta.layout.treemap=function(){function n(n,t){for(var e,r,u=-1,i=n.length;++u<i;)r=(e=n[u]).value*(0>t?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var i=e.children;if(i&&i.length){var o,a,c,l=f(e),s=[],h=i.slice(),p=1/0,v="slice"===g?l.dx:"dice"===g?l.dy:"slice-dice"===g?1&e.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(n(h,l.dx*l.dy/e.value),s.area=0;(c=h.length)>0;)s.push(o=h[c-1]),s.area+=o.area,"squarify"!==g||(a=r(s,v))<=p?(h.pop(),p=a):(s.area-=s.pop().area,u(s,v,l,!1),v=Math.min(l.dx,l.dy),s.length=s.area=0,p=1/0);s.length&&(u(s,v,l,!0),s.length=s.area=0),i.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var i,o=f(t),a=r.slice(),c=[];for(n(a,o.dx*o.dy/t.value),c.area=0;i=a.pop();)c.push(i),c.area+=i.area,null!=i.z&&(u(c,i.z?o.dx:o.dy,o,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,u=0,i=1/0,o=-1,a=n.length;++o<a;)(e=n[o].area)&&(i>e&&(i=e),e>u&&(u=e));return r*=r,t*=t,r?Math.max(t*u*p/r,r/(t*i*p)):1/0}function u(n,t,e,r){var u,i=-1,o=n.length,a=e.x,l=e.y,s=t?c(n.area/t):0;if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);++i<o;)u=n[i],u.x=a,u.y=l,u.dy=s,a+=u.dx=Math.min(e.x+e.dx-a,s?c(u.area/s):0);u.z=!0,u.dx+=e.x+e.dx-a,e.y+=s,e.dy-=s}else{for((r||s>e.dx)&&(s=e.dx);++i<o;)u=n[i],u.x=a,u.y=l,u.dx=s,l+=u.dy=Math.min(e.y+e.dy-l,s?c(u.area/s):0);u.z=!1,u.dy+=e.y+e.dy-l,e.x+=s,e.dx-=s}}function i(r){var u=o||a(r),i=u[0];return i.x=0,i.y=0,i.dx=l[0],i.dy=l[1],o&&a.revalue(i),n([i],i.dx*i.dy/i.value),(o?e:t)(i),h&&(o=u),u}var o,a=ta.layout.hierarchy(),c=Math.round,l=[1,1],s=null,f=Di,h=!1,g="squarify",p=.5*(1+Math.sqrt(5));return i.size=function(n){return arguments.length?(l=n,i):l},i.padding=function(n){function t(t){var e=n.call(i,t,t.depth);return null==e?Di(t):Pi(t,"number"==typeof e?[e,e,e,e]:e)}function e(t){return Pi(t,n)}if(!arguments.length)return s;var r;return f=null==(s=n)?Di:"function"==(r=typeof n)?t:"number"===r?(n=[n,n,n,n],e):e,i},i.round=function(n){return arguments.length?(c=n?Math.round:Number,i):c!=Number},i.sticky=function(n){return arguments.length?(h=n,o=null,i):h},i.ratio=function(n){return arguments.length?(p=n,i):p},i.mode=function(n){return arguments.length?(g=n+"",i):g},Ku(i,a)},ta.random={normal:function(n,t){var e=arguments.length;return 2>e&&(t=1),1>e&&(n=0),function(){var e,r,u;do e=2*Math.random()-1,r=2*Math.random()-1,u=e*e+r*r;while(!u||u>1);return n+t*e*Math.sqrt(-2*Math.log(u)/u)
+}},logNormal:function(){var n=ta.random.normal.apply(ta,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=ta.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},ta.scale={};var bl={floor:At,ceil:At};ta.scale.linear=function(){return Ii([0,1],[0,1],yu,!1)};var _l={s:1,g:1,p:1,r:1,e:1};ta.scale.log=function(){return Gi(ta.scale.linear().domain([0,1]),10,!0,[1,10])};var wl=ta.format(".0e"),Sl={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};ta.scale.pow=function(){return Ki(ta.scale.linear(),1,[0,1])},ta.scale.sqrt=function(){return ta.scale.pow().exponent(.5)},ta.scale.ordinal=function(){return no([],{t:"range",a:[[]]})},ta.scale.category10=function(){return ta.scale.ordinal().range(kl)},ta.scale.category20=function(){return ta.scale.ordinal().range(El)},ta.scale.category20b=function(){return ta.scale.ordinal().range(Al)},ta.scale.category20c=function(){return ta.scale.ordinal().range(Nl)};var kl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(Mt),El=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(Mt),Al=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(Mt),Nl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(Mt);ta.scale.quantile=function(){return to([],[])},ta.scale.quantize=function(){return eo(0,1,[0,1])},ta.scale.threshold=function(){return ro([.5],[0,1])},ta.scale.identity=function(){return uo([0,1])},ta.svg={},ta.svg.arc=function(){function n(){var n=Math.max(0,+e.apply(this,arguments)),l=Math.max(0,+r.apply(this,arguments)),s=o.apply(this,arguments)-ja,f=a.apply(this,arguments)-ja,h=Math.abs(f-s),g=s>f?0:1;if(n>l&&(p=l,l=n,n=p),h>=Ua)return t(l,g)+(n?t(n,1-g):"")+"Z";var p,v,d,m,y,M,x,b,_,w,S,k,E=0,A=0,N=[];if((m=(+c.apply(this,arguments)||0)/2)&&(d=i===Cl?Math.sqrt(n*n+l*l):+i.apply(this,arguments),g||(A*=-1),l&&(A=tt(d/l*Math.sin(m))),n&&(E=tt(d/n*Math.sin(m)))),l){y=l*Math.cos(s+A),M=l*Math.sin(s+A),x=l*Math.cos(f-A),b=l*Math.sin(f-A);var C=Math.abs(f-s-2*A)<=Da?0:1;if(A&&fo(y,M,x,b)===g^C){var z=(s+f)/2;y=l*Math.cos(z),M=l*Math.sin(z),x=b=null}}else y=M=0;if(n){_=n*Math.cos(f-E),w=n*Math.sin(f-E),S=n*Math.cos(s+E),k=n*Math.sin(s+E);var q=Math.abs(s-f+2*E)<=Da?0:1;if(E&&fo(_,w,S,k)===1-g^q){var L=(s+f)/2;_=n*Math.cos(L),w=n*Math.sin(L),S=k=null}}else _=w=0;if((p=Math.min(Math.abs(l-n)/2,+u.apply(this,arguments)))>.001){v=l>n^g?0:1;var T=null==S?[_,w]:null==x?[y,M]:Tr([y,M],[S,k],[x,b],[_,w]),R=y-T[0],D=M-T[1],P=x-T[0],U=b-T[1],j=1/Math.sin(Math.acos((R*P+D*U)/(Math.sqrt(R*R+D*D)*Math.sqrt(P*P+U*U)))/2),F=Math.sqrt(T[0]*T[0]+T[1]*T[1]);if(null!=x){var H=Math.min(p,(l-F)/(j+1)),O=ho(null==S?[_,w]:[S,k],[y,M],l,H,g),Y=ho([x,b],[_,w],l,H,g);p===H?N.push("M",O[0],"A",H,",",H," 0 0,",v," ",O[1],"A",l,",",l," 0 ",1-g^fo(O[1][0],O[1][1],Y[1][0],Y[1][1]),",",g," ",Y[1],"A",H,",",H," 0 0,",v," ",Y[0]):N.push("M",O[0],"A",H,",",H," 0 1,",v," ",Y[0])}else N.push("M",y,",",M);if(null!=S){var I=Math.min(p,(n-F)/(j-1)),Z=ho([y,M],[S,k],n,-I,g),V=ho([_,w],null==x?[y,M]:[x,b],n,-I,g);p===I?N.push("L",V[0],"A",I,",",I," 0 0,",v," ",V[1],"A",n,",",n," 0 ",g^fo(V[1][0],V[1][1],Z[1][0],Z[1][1]),",",1-g," ",Z[1],"A",I,",",I," 0 0,",v," ",Z[0]):N.push("L",V[0],"A",I,",",I," 0 0,",v," ",Z[0])}else N.push("L",_,",",w)}else N.push("M",y,",",M),null!=x&&N.push("A",l,",",l," 0 ",C,",",g," ",x,",",b),N.push("L",_,",",w),null!=S&&N.push("A",n,",",n," 0 ",q,",",1-g," ",S,",",k);return N.push("Z"),N.join("")}function t(n,t){return"M0,"+n+"A"+n+","+n+" 0 1,"+t+" 0,"+-n+"A"+n+","+n+" 0 1,"+t+" 0,"+n}var e=oo,r=ao,u=io,i=Cl,o=co,a=lo,c=so;return n.innerRadius=function(t){return arguments.length?(e=Et(t),n):e},n.outerRadius=function(t){return arguments.length?(r=Et(t),n):r},n.cornerRadius=function(t){return arguments.length?(u=Et(t),n):u},n.padRadius=function(t){return arguments.length?(i=t==Cl?Cl:Et(t),n):i},n.startAngle=function(t){return arguments.length?(o=Et(t),n):o},n.endAngle=function(t){return arguments.length?(a=Et(t),n):a},n.padAngle=function(t){return arguments.length?(c=Et(t),n):c},n.centroid=function(){var n=(+e.apply(this,arguments)+ +r.apply(this,arguments))/2,t=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-ja;return[Math.cos(t)*n,Math.sin(t)*n]},n};var Cl="auto";ta.svg.line=function(){return go(At)};var zl=ta.map({linear:po,"linear-closed":vo,step:mo,"step-before":yo,"step-after":Mo,basis:ko,"basis-open":Eo,"basis-closed":Ao,bundle:No,cardinal:_o,"cardinal-open":xo,"cardinal-closed":bo,monotone:Ro});zl.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var ql=[0,2/3,1/3,0],Ll=[0,1/3,2/3,0],Tl=[0,1/6,2/3,1/6];ta.svg.line.radial=function(){var n=go(Do);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},yo.reverse=Mo,Mo.reverse=yo,ta.svg.area=function(){return Po(At)},ta.svg.area.radial=function(){var n=Po(Do);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},ta.svg.chord=function(){function n(n,a){var c=t(this,i,n,a),l=t(this,o,n,a);return"M"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(e(c,l)?u(c.r,c.p1,c.r,c.p0):u(c.r,c.p1,l.r,l.p0)+r(l.r,l.p1,l.a1-l.a0)+u(l.r,l.p1,c.r,c.p0))+"Z"}function t(n,t,e,r){var u=t.call(n,e,r),i=a.call(n,u,r),o=c.call(n,u,r)-ja,s=l.call(n,u,r)-ja;return{r:i,a0:o,a1:s,p0:[i*Math.cos(o),i*Math.sin(o)],p1:[i*Math.cos(s),i*Math.sin(s)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>Da)+",1 "+t}function u(n,t,e,r){return"Q 0,0 "+r}var i=yr,o=Mr,a=Uo,c=co,l=lo;return n.radius=function(t){return arguments.length?(a=Et(t),n):a},n.source=function(t){return arguments.length?(i=Et(t),n):i},n.target=function(t){return arguments.length?(o=Et(t),n):o},n.startAngle=function(t){return arguments.length?(c=Et(t),n):c},n.endAngle=function(t){return arguments.length?(l=Et(t),n):l},n},ta.svg.diagonal=function(){function n(n,u){var i=t.call(this,n,u),o=e.call(this,n,u),a=(i.y+o.y)/2,c=[i,{x:i.x,y:a},{x:o.x,y:a},o];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=yr,e=Mr,r=jo;return n.source=function(e){return arguments.length?(t=Et(e),n):t},n.target=function(t){return arguments.length?(e=Et(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},ta.svg.diagonal.radial=function(){var n=ta.svg.diagonal(),t=jo,e=n.projection;return n.projection=function(n){return arguments.length?e(Fo(t=n)):t},n},ta.svg.symbol=function(){function n(n,r){return(Rl.get(t.call(this,n,r))||Yo)(e.call(this,n,r))}var t=Oo,e=Ho;return n.type=function(e){return arguments.length?(t=Et(e),n):t},n.size=function(t){return arguments.length?(e=Et(t),n):e},n};var Rl=ta.map({circle:Yo,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*jl)),e=t*jl;return"M0,"+-t+"L"+e+",0"+" 0,"+t+" "+-e+",0"+"Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/Ul),e=t*Ul/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/Ul),e=t*Ul/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});ta.svg.symbolTypes=Rl.keys();var Dl,Pl,Ul=Math.sqrt(3),jl=Math.tan(30*Fa),Fl=[],Hl=0;Fl.call=ka.call,Fl.empty=ka.empty,Fl.node=ka.node,Fl.size=ka.size,ta.transition=function(n){return arguments.length?Dl?n.transition():n:Na.transition()},ta.transition.prototype=Fl,Fl.select=function(n){var t,e,r,u=this.id,i=this.namespace,o=[];n=k(n);for(var a=-1,c=this.length;++a<c;){o.push(t=[]);for(var l=this[a],s=-1,f=l.length;++s<f;)(r=l[s])&&(e=n.call(r,r.__data__,s,a))?("__data__"in r&&(e.__data__=r.__data__),$o(e,s,i,u,r[i][u]),t.push(e)):t.push(null)}return Io(o,i,u)},Fl.selectAll=function(n){var t,e,r,u,i,o=this.id,a=this.namespace,c=[];n=E(n);for(var l=-1,s=this.length;++l<s;)for(var f=this[l],h=-1,g=f.length;++h<g;)if(r=f[h]){i=r[a][o],e=n.call(r,r.__data__,h,l),c.push(t=[]);for(var p=-1,v=e.length;++p<v;)(u=e[p])&&$o(u,p,a,o,i),t.push(u)}return Io(c,a,o)},Fl.filter=function(n){var t,e,r,u=[];"function"!=typeof n&&(n=j(n));for(var i=0,o=this.length;o>i;i++){u.push(t=[]);for(var e=this[i],a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return Io(u,this.namespace,this.id)},Fl.tween=function(n,t){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(n):H(this,null==t?function(t){t[r][e].tween.remove(n)}:function(u){u[r][e].tween.set(n,t)})},Fl.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function u(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function i(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?Ou:yu,a=ta.ns.qualify(n);return Zo(this,"attr."+n,t,a.local?i:u)},Fl.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(u));return r&&function(n){this.setAttribute(u,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(u.space,u.local));return r&&function(n){this.setAttributeNS(u.space,u.local,r(n))}}var u=ta.ns.qualify(n);return this.tween("attr."+n,u.local?r:e)},Fl.style=function(n,t,e){function r(){this.style.removeProperty(n)}function u(t){return null==t?r:(t+="",function(){var r,u=oa.getComputedStyle(this,null).getPropertyValue(n);return u!==t&&(r=yu(u,t),function(t){this.style.setProperty(n,r(t),e)})})}var i=arguments.length;if(3>i){if("string"!=typeof n){2>i&&(t="");for(e in n)this.style(e,n[e],t);return this}e=""}return Zo(this,"style."+n,t,u)},Fl.styleTween=function(n,t,e){function r(r,u){var i=t.call(this,r,u,oa.getComputedStyle(this,null).getPropertyValue(n));return i&&function(t){this.style.setProperty(n,i(t),e)}}return arguments.length<3&&(e=""),this.tween("style."+n,r)},Fl.text=function(n){return Zo(this,"text",n,Vo)},Fl.remove=function(){var n=this.namespace;return this.each("end.transition",function(){var t;this[n].count<2&&(t=this.parentNode)&&t.removeChild(this)})},Fl.ease=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].ease:("function"!=typeof n&&(n=ta.ease.apply(ta,arguments)),H(this,function(r){r[e][t].ease=n}))},Fl.delay=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].delay:H(this,"function"==typeof n?function(r,u,i){r[e][t].delay=+n.call(r,r.__data__,u,i)}:(n=+n,function(r){r[e][t].delay=n}))},Fl.duration=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].duration:H(this,"function"==typeof n?function(r,u,i){r[e][t].duration=Math.max(1,n.call(r,r.__data__,u,i))}:(n=Math.max(1,n),function(r){r[e][t].duration=n}))},Fl.each=function(n,t){var e=this.id,r=this.namespace;if(arguments.length<2){var u=Pl,i=Dl;Dl=e,H(this,function(t,u,i){Pl=t[r][e],n.call(t,t.__data__,u,i)}),Pl=u,Dl=i}else H(this,function(u){var i=u[r][e];(i.event||(i.event=ta.dispatch("start","end","interrupt"))).on(n,t)});return this},Fl.transition=function(){for(var n,t,e,r,u=this.id,i=++Hl,o=this.namespace,a=[],c=0,l=this.length;l>c;c++){a.push(n=[]);for(var t=this[c],s=0,f=t.length;f>s;s++)(e=t[s])&&(r=e[o][u],$o(e,s,o,i,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),n.push(e)}return Io(a,o,i)},ta.svg.axis=function(){function n(n){n.each(function(){var n,l=ta.select(this),s=this.__chart__||e,f=this.__chart__=e.copy(),h=null==c?f.ticks?f.ticks.apply(f,a):f.domain():c,g=null==t?f.tickFormat?f.tickFormat.apply(f,a):At:t,p=l.selectAll(".tick").data(h,f),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Ta),d=ta.transition(p.exit()).style("opacity",Ta).remove(),m=ta.transition(p.order()).style("opacity",1),y=Math.max(u,0)+o,M=ji(f),x=l.selectAll(".domain").data([0]),b=(x.enter().append("path").attr("class","domain"),ta.transition(x));v.append("line"),v.append("text");var _,w,S,k,E=v.select("line"),A=m.select("line"),N=p.select("text").text(g),C=v.select("text"),z=m.select("text"),q="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(n=Bo,_="x",S="y",w="x2",k="y2",N.attr("dy",0>q?"0em":".71em").style("text-anchor","middle"),b.attr("d","M"+M[0]+","+q*i+"V0H"+M[1]+"V"+q*i)):(n=Wo,_="y",S="x",w="y2",k="x2",N.attr("dy",".32em").style("text-anchor",0>q?"end":"start"),b.attr("d","M"+q*i+","+M[0]+"H0V"+M[1]+"H"+q*i)),E.attr(k,q*u),C.attr(S,q*y),A.attr(w,0).attr(k,q*u),z.attr(_,0).attr(S,q*y),f.rangeBand){var L=f,T=L.rangeBand()/2;s=f=function(n){return L(n)+T}}else s.rangeBand?s=f:d.call(n,f,s);v.call(n,s,f),m.call(n,f,f)})}var t,e=ta.scale.linear(),r=Ol,u=6,i=6,o=3,a=[10],c=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Yl?t+"":Ol,n):r},n.ticks=function(){return arguments.length?(a=arguments,n):a},n.tickValues=function(t){return arguments.length?(c=t,n):c},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(u=+t,i=+arguments[e-1],n):u},n.innerTickSize=function(t){return arguments.length?(u=+t,n):u},n.outerTickSize=function(t){return arguments.length?(i=+t,n):i},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var Ol="bottom",Yl={top:1,right:1,bottom:1,left:1};ta.svg.brush=function(){function n(i){i.each(function(){var i=ta.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",u).on("touchstart.brush",u),o=i.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),i.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=i.selectAll(".resize").data(p,At);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return Il[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var s,f=ta.transition(i),h=ta.transition(o);c&&(s=ji(c),h.attr("x",s[0]).attr("width",s[1]-s[0]),e(f)),l&&(s=ji(l),h.attr("y",s[0]).attr("height",s[1]-s[0]),r(f)),t(f)})}function t(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+s[+/e$/.test(n)]+","+f[+/^s/.test(n)]+")"})}function e(n){n.select(".extent").attr("x",s[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",s[1]-s[0])}function r(n){n.select(".extent").attr("y",f[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function u(){function u(){32==ta.event.keyCode&&(N||(y=null,z[0]-=s[1],z[1]-=f[1],N=2),b())}function p(){32==ta.event.keyCode&&2==N&&(z[0]+=s[1],z[1]+=f[1],N=0,b())}function v(){var n=ta.mouse(x),u=!1;M&&(n[0]+=M[0],n[1]+=M[1]),N||(ta.event.altKey?(y||(y=[(s[0]+s[1])/2,(f[0]+f[1])/2]),z[0]=s[+(n[0]<y[0])],z[1]=f[+(n[1]<y[1])]):y=null),E&&d(n,c,0)&&(e(S),u=!0),A&&d(n,l,1)&&(r(S),u=!0),u&&(t(S),w({type:"brush",mode:N?"move":"resize"}))}function d(n,t,e){var r,u,a=ji(t),c=a[0],l=a[1],p=z[e],v=e?f:s,d=v[1]-v[0];return N&&(c-=p,l-=d+p),r=(e?g:h)?Math.max(c,Math.min(l,n[e])):n[e],N?u=(r+=p)+d:(y&&(p=Math.max(c,Math.min(l,2*y[e]-r))),r>p?(u=r,r=p):u=p),v[0]!=r||v[1]!=u?(e?o=null:i=null,v[0]=r,v[1]=u,!0):void 0}function m(){v(),S.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),ta.select("body").style("cursor",null),q.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),C(),w({type:"brushend"})}var y,M,x=this,_=ta.select(ta.event.target),w=a.of(x,arguments),S=ta.select(x),k=_.datum(),E=!/^(n|s)$/.test(k)&&c,A=!/^(e|w)$/.test(k)&&l,N=_.classed("extent"),C=$(),z=ta.mouse(x),q=ta.select(oa).on("keydown.brush",u).on("keyup.brush",p);if(ta.event.changedTouches?q.on("touchmove.brush",v).on("touchend.brush",m):q.on("mousemove.brush",v).on("mouseup.brush",m),S.interrupt().selectAll("*").interrupt(),N)z[0]=s[0]-z[0],z[1]=f[0]-z[1];else if(k){var L=+/w$/.test(k),T=+/^n/.test(k);M=[s[1-L]-z[0],f[1-T]-z[1]],z[0]=s[L],z[1]=f[T]}else ta.event.altKey&&(y=z.slice());S.style("pointer-events","none").selectAll(".resize").style("display",null),ta.select("body").style("cursor",_.style("cursor")),w({type:"brushstart"}),v()}var i,o,a=w(n,"brushstart","brush","brushend"),c=null,l=null,s=[0,0],f=[0,0],h=!0,g=!0,p=Zl[0];return n.event=function(n){n.each(function(){var n=a.of(this,arguments),t={x:s,y:f,i:i,j:o},e=this.__chart__||t;this.__chart__=t,Dl?ta.select(this).transition().each("start.brush",function(){i=e.i,o=e.j,s=e.x,f=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=Mu(s,t.x),r=Mu(f,t.y);return i=o=null,function(u){s=t.x=e(u),f=t.y=r(u),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){i=t.i,o=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,p=Zl[!c<<1|!l],n):c},n.y=function(t){return arguments.length?(l=t,p=Zl[!c<<1|!l],n):l},n.clamp=function(t){return arguments.length?(c&&l?(h=!!t[0],g=!!t[1]):c?h=!!t:l&&(g=!!t),n):c&&l?[h,g]:c?h:l?g:null},n.extent=function(t){var e,r,u,a,h;return arguments.length?(c&&(e=t[0],r=t[1],l&&(e=e[0],r=r[0]),i=[e,r],c.invert&&(e=c(e),r=c(r)),e>r&&(h=e,e=r,r=h),(e!=s[0]||r!=s[1])&&(s=[e,r])),l&&(u=t[0],a=t[1],c&&(u=u[1],a=a[1]),o=[u,a],l.invert&&(u=l(u),a=l(a)),u>a&&(h=u,u=a,a=h),(u!=f[0]||a!=f[1])&&(f=[u,a])),n):(c&&(i?(e=i[0],r=i[1]):(e=s[0],r=s[1],c.invert&&(e=c.invert(e),r=c.invert(r)),e>r&&(h=e,e=r,r=h))),l&&(o?(u=o[0],a=o[1]):(u=f[0],a=f[1],l.invert&&(u=l.invert(u),a=l.invert(a)),u>a&&(h=u,u=a,a=h))),c&&l?[[e,u],[r,a]]:c?[e,r]:l&&[u,a])},n.clear=function(){return n.empty()||(s=[0,0],f=[0,0],i=o=null),n},n.empty=function(){return!!c&&s[0]==s[1]||!!l&&f[0]==f[1]},ta.rebind(n,a,"on")};var Il={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Zl=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Vl=fc.format=mc.timeFormat,Xl=Vl.utc,$l=Xl("%Y-%m-%dT%H:%M:%S.%LZ");Vl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Jo:$l,Jo.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},Jo.toString=$l.toString,fc.second=Ht(function(n){return new hc(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),fc.seconds=fc.second.range,fc.seconds.utc=fc.second.utc.range,fc.minute=Ht(function(n){return new hc(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),fc.minutes=fc.minute.range,fc.minutes.utc=fc.minute.utc.range,fc.hour=Ht(function(n){var t=n.getTimezoneOffset()/60;return new hc(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),fc.hours=fc.hour.range,fc.hours.utc=fc.hour.utc.range,fc.month=Ht(function(n){return n=fc.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),fc.months=fc.month.range,fc.months.utc=fc.month.utc.range;var Bl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Wl=[[fc.second,1],[fc.second,5],[fc.second,15],[fc.second,30],[fc.minute,1],[fc.minute,5],[fc.minute,15],[fc.minute,30],[fc.hour,1],[fc.hour,3],[fc.hour,6],[fc.hour,12],[fc.day,1],[fc.day,2],[fc.week,1],[fc.month,1],[fc.month,3],[fc.year,1]],Jl=Vl.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",Ce]]),Gl={range:function(n,t,e){return ta.range(Math.ceil(n/e)*e,+t,e).map(Ko)},floor:At,ceil:At};Wl.year=fc.year,fc.scale=function(){return Go(ta.scale.linear(),Wl,Jl)};var Kl=Wl.map(function(n){return[n[0].utc,n[1]]}),Ql=Xl.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",Ce]]);Kl.year=fc.year.utc,fc.scale.utc=function(){return Go(ta.scale.linear(),Kl,Ql)},ta.text=Nt(function(n){return n.responseText}),ta.json=function(n,t){return Ct(n,"application/json",Qo,t)},ta.html=function(n,t){return Ct(n,"text/html",na,t)},ta.xml=Nt(function(n){return n.responseXML}),"function"==typeof define&&define.amd?define(ta):"object"==typeof module&&module.exports&&(module.exports=ta),this.d3=ta}(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.cloud.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.cloud.js
new file mode 100644
index 00000000..44c4f7de
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.cloud.js
@@ -0,0 +1,433 @@
+// Word cloud layout by Jason Davies, http://www.jasondavies.com/word-cloud/
+// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf
+(function() {
+ function cloud() {
+ var size = [256, 256],
+ text = cloudText,
+ font = cloudFont,
+ fontSize = cloudFontSize,
+ fontStyle = cloudFontNormal,
+ fontWeight = cloudFontNormal,
+ rotate = cloudRotate,
+ padding = cloudPadding,
+ spiral = archimedeanSpiral,
+ words = [],
+ timeInterval = Infinity,
+ event = d3.dispatch("word", "end"),
+ timer = null,
+ cloud = {};
+
+ cloud.start = function() {
+ var board = zeroArray((size[0] >> 5) * size[1]),
+ bounds = null,
+ n = words.length,
+ i = -1,
+ tags = [],
+ data = words.map(function(d, i) {
+ d.text = text.call(this, d, i);
+ d.font = font.call(this, d, i);
+ d.style = fontStyle.call(this, d, i);
+ d.weight = fontWeight.call(this, d, i);
+ d.rotate = rotate.call(this, d, i);
+ d.size = ~~fontSize.call(this, d, i);
+ d.padding = padding.call(this, d, i);
+ return d;
+ }).sort(function(a, b) { return b.size - a.size; });
+// createMask();
+/* var bd = 3000;
+ while (bd < 4000) {
+ board[bd] = -1;
+ bd++
+ }
+ */
+ function createMask()
+ {
+ d3.select("body").append("canvas").attr("id", "maskCanvas")
+ maskCanvas = document.getElementById('maskCanvas'),
+ maskCanvas.width = 85;
+ maskCanvas.height = 85;
+ maskContext = maskCanvas.getContext('2d');
+ maskImage = new Image();
+ maskImage.src = 'mask.png';
+ maskImage.onload = function(){
+ maskContext.drawImage(maskImage,0,0,85,85 * maskImage.height / maskImage.width);
+ maskData = maskContext.getImageData(0,0,85,85).data;
+/*
+ var hh = 0;
+ while (hh < maskData.length) {
+ if (hh%4 == 0) {
+ if (maskData[hh] == 0) {
+ board[~~(hh/4)] = -1;
+ }
+ }
+ hh++;
+ }
+ */
+
+ }
+ }
+ if (timer) clearInterval(timer);
+ timer = setInterval(step, 0);
+ step();
+
+ return cloud;
+
+ function step() {
+ var start = +new Date,
+ d;
+ while (+new Date - start < timeInterval && ++i < n && timer) {
+ d = data[i];
+ d.x = (size[0] * (Math.random() + .5)) >> 1;
+ d.y = (size[1] * (Math.random() + .5)) >> 1;
+ cloudSprite(d, data, i);
+ if (d.hasText && place(board, d, bounds)) {
+ tags.push(d);
+ event.word(d);
+ if (bounds) cloudBounds(bounds, d);
+ else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: d.y + d.y1}];
+ // Temporary hack
+ d.x -= size[0] >> 1;
+ d.y -= size[1] >> 1;
+ }
+ }
+ if (i >= n) {
+ cloud.stop();
+ event.end(tags, bounds);
+ }
+ }
+ }
+
+ cloud.stop = function() {
+ if (timer) {
+ clearInterval(timer);
+ timer = null;
+ }
+ return cloud;
+ };
+
+ cloud.timeInterval = function(x) {
+ if (!arguments.length) return timeInterval;
+ timeInterval = x == null ? Infinity : x;
+ return cloud;
+ };
+
+ function place(board, tag, bounds) {
+ var perimeter = [{x: 0, y: 0}, {x: size[0], y: size[1]}],
+ startX = tag.x,
+ startY = tag.y,
+ maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]),
+ s = spiral(size),
+ dt = Math.random() < .5 ? 1 : -1,
+ t = -dt,
+ dxdy,
+ dx,
+ dy;
+
+ while (dxdy = s(t += dt)) {
+ dx = ~~dxdy[0];
+ dy = ~~dxdy[1];
+
+ if (Math.min(dx, dy) > maxDelta) break;
+
+ tag.x = startX + dx;
+ tag.y = startY + dy;
+
+ if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 ||
+ tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue;
+ // TODO only check for collisions within current bounds.
+ if (!bounds || !cloudCollide(tag, board, size[0])) {
+ if (!bounds || collideRects(tag, bounds)) {
+ var sprite = tag.sprite,
+ w = tag.width >> 5,
+ sw = size[0] >> 5,
+ lx = tag.x - (w << 4),
+ sx = lx & 0x7f,
+ msx = 32 - sx,
+ h = tag.y1 - tag.y0,
+ x = (tag.y + tag.y0) * sw + (lx >> 5),
+ last;
+ for (var j = 0; j < h; j++) {
+ last = 0;
+ for (var i = 0; i <= w; i++) {
+ board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0);
+ }
+ x += sw;
+ }
+ delete tag.sprite;
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ cloud.words = function(x) {
+ if (!arguments.length) return words;
+ words = x;
+ return cloud;
+ };
+
+ cloud.size = function(x) {
+ if (!arguments.length) return size;
+ size = [+x[0], +x[1]];
+ return cloud;
+ };
+
+ cloud.font = function(x) {
+ if (!arguments.length) return font;
+ font = d3.functor(x);
+ return cloud;
+ };
+
+ cloud.fontStyle = function(x) {
+ if (!arguments.length) return fontStyle;
+ fontStyle = d3.functor(x);
+ return cloud;
+ };
+
+ cloud.fontWeight = function(x) {
+ if (!arguments.length) return fontWeight;
+ fontWeight = d3.functor(x);
+ return cloud;
+ };
+
+ cloud.rotate = function(x) {
+ if (!arguments.length) return rotate;
+ rotate = d3.functor(x);
+ return cloud;
+ };
+
+ cloud.text = function(x) {
+ if (!arguments.length) return text;
+ text = d3.functor(x);
+ return cloud;
+ };
+
+ cloud.spiral = function(x) {
+ if (!arguments.length) return spiral;
+ spiral = spirals[x + ""] || x;
+ return cloud;
+ };
+
+ cloud.fontSize = function(x) {
+ if (!arguments.length) return fontSize;
+ fontSize = d3.functor(x);
+ return cloud;
+ };
+
+ cloud.padding = function(x) {
+ if (!arguments.length) return padding;
+ padding = d3.functor(x);
+ return cloud;
+ };
+
+ return d3.rebind(cloud, event, "on");
+ }
+
+ function cloudText(d) {
+ return d.text;
+ }
+
+ function cloudFont() {
+ return "serif";
+ }
+
+ function cloudFontNormal() {
+ return "normal";
+ }
+
+ function cloudFontSize(d) {
+ return Math.sqrt(d.value);
+ }
+
+ function cloudRotate() {
+ return (~~(Math.random() * 6) - 3) * 30;
+ }
+
+ function cloudPadding() {
+ return 1;
+ }
+
+ // Fetches a monochrome sprite bitmap for the specified text.
+ // Load in batches for speed.
+ function cloudSprite(d, data, di) {
+ if (d.sprite) return;
+ c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio);
+ var x = 0,
+ y = 0,
+ maxh = 0,
+ n = data.length;
+ --di;
+ while (++di < n) {
+ d = data[di];
+ c.save();
+ c.font = d.style + " " + d.weight + " " + ~~((d.size + 1) / ratio) + "px " + d.font;
+ var w = c.measureText(d.text + "m").width * ratio,
+ h = d.size << 1;
+ if (d.rotate) {
+ var sr = Math.sin(d.rotate * cloudRadians),
+ cr = Math.cos(d.rotate * cloudRadians),
+ wcr = w * cr,
+ wsr = w * sr,
+ hcr = h * cr,
+ hsr = h * sr;
+ w = (Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5 << 5;
+ h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr));
+ } else {
+ w = (w + 0x1f) >> 5 << 5;
+ }
+ if (h > maxh) maxh = h;
+ if (x + w >= (cw << 5)) {
+ x = 0;
+ y += maxh;
+ maxh = 0;
+ }
+ if (y + h >= ch) break;
+ c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio);
+ if (d.rotate) c.rotate(d.rotate * cloudRadians);
+ c.fillText(d.text, 0, 0);
+ if (d.padding) c.lineWidth = 2 * d.padding, c.strokeText(d.text, 0, 0);
+ c.restore();
+ d.width = w;
+ d.height = h;
+ d.xoff = x;
+ d.yoff = y;
+ d.x1 = w >> 1;
+ d.y1 = h >> 1;
+ d.x0 = -d.x1;
+ d.y0 = -d.y1;
+ d.hasText = true;
+ x += w;
+ }
+ var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data,
+ sprite = [];
+ while (--di >= 0) {
+ d = data[di];
+ if (!d.hasText) continue;
+ var w = d.width,
+ w32 = w >> 5,
+ h = d.y1 - d.y0;
+ // Zero the buffer
+ for (var i = 0; i < h * w32; i++) sprite[i] = 0;
+ x = d.xoff;
+ if (x == null) return;
+ y = d.yoff;
+ var seen = 0,
+ seenRow = -1;
+ for (var j = 0; j < h; j++) {
+ for (var i = 0; i < w; i++) {
+ var k = w32 * j + (i >> 5),
+ m = pixels[((y + j) * (cw << 5) + (x + i)) << 2] ? 1 << (31 - (i % 32)) : 0;
+ sprite[k] |= m;
+ seen |= m;
+ }
+ if (seen) seenRow = j;
+ else {
+ d.y0++;
+ h--;
+ j--;
+ y++;
+ }
+ }
+ d.y1 = d.y0 + seenRow;
+ d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32);
+ }
+ }
+
+ // Use mask-based collision detection.
+ function cloudCollide(tag, board, sw) {
+ sw >>= 5;
+ var sprite = tag.sprite,
+ w = tag.width >> 5,
+ lx = tag.x - (w << 4),
+ sx = lx & 0x7f,
+ msx = 32 - sx,
+ h = tag.y1 - tag.y0,
+ x = (tag.y + tag.y0) * sw + (lx >> 5),
+ last;
+ for (var j = 0; j < h; j++) {
+ last = 0;
+ for (var i = 0; i <= w; i++) {
+ if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0))
+ & board[x + i]) return true;
+ }
+ x += sw;
+ }
+ return false;
+ }
+
+ function cloudBounds(bounds, d) {
+ var b0 = bounds[0],
+ b1 = bounds[1];
+ if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0;
+ if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0;
+ if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1;
+ if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1;
+ }
+
+ function collideRects(a, b) {
+ return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y;
+ }
+
+ function archimedeanSpiral(size) {
+ var e = size[0] / size[1];
+ return function(t) {
+ return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)];
+ };
+ }
+
+ function rectangularSpiral(size) {
+ var dy = 4,
+ dx = dy * size[0] / size[1],
+ x = 0,
+ y = 0;
+ return function(t) {
+ var sign = t < 0 ? -1 : 1;
+ // See triangular numbers: T_n = n * (n + 1) / 2.
+ switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) {
+ case 0: x += dx; break;
+ case 1: y += dy; break;
+ case 2: x -= dx; break;
+ default: y -= dy; break;
+ }
+ return [x, y];
+ };
+ }
+
+ // TODO reuse arrays?
+ function zeroArray(n) {
+ var a = [],
+ i = -1;
+ while (++i < n) a[i] = 0;
+ return a;
+ }
+
+ var cloudRadians = Math.PI / 180,
+ cw = 1 << 11 >> 5,
+ ch = 1 << 11,
+ canvas,
+ ratio = 1;
+
+ if (typeof document !== "undefined") {
+ canvas = document.createElement("canvas");
+ canvas.width = 1;
+ canvas.height = 1;
+ ratio = Math.sqrt(canvas.getContext("2d").getImageData(0, 0, 1, 1).data.length >> 2);
+ canvas.width = (cw << 5) / ratio;
+ canvas.height = ch / ratio;
+ } else {
+ // Attempt to use node-canvas.
+ canvas = new Canvas(cw << 5, ch);
+ }
+
+ var c = canvas.getContext("2d"),
+ spirals = {
+ archimedean: archimedeanSpiral,
+ rectangular: rectangularSpiral
+ };
+ c.fillStyle = c.strokeStyle = "red";
+ c.textAlign = "center";
+
+ if (typeof module === "object" && module.exports) module.exports = cloud;
+ else (d3.layout || (d3.layout = {})).cloud = cloud;
+})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.js
new file mode 100644
index 00000000..abc5ebef
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.js
@@ -0,0 +1,908 @@
+(function(){d3.layout = {};
+d3.layout.chord = function() {
+ var chord = {},
+ chords,
+ groups,
+ matrix,
+ n,
+ padding = 0,
+ sortGroups,
+ sortSubgroups,
+ sortChords;
+
+ function relayout() {
+ var subgroups = {},
+ groupSums = [],
+ groupIndex = d3.range(n),
+ subgroupIndex = [],
+ k,
+ x,
+ x0,
+ i,
+ j;
+
+ chords = [];
+ groups = [];
+
+ // Compute the sum.
+ k = 0, i = -1; while (++i < n) {
+ x = 0, j = -1; while (++j < n) {
+ x += matrix[i][j];
+ }
+ groupSums.push(x);
+ subgroupIndex.push(d3.range(n));
+ k += x;
+ }
+
+ // Sort groups…
+ if (sortGroups) {
+ groupIndex.sort(function(a, b) {
+ return sortGroups(groupSums[a], groupSums[b]);
+ });
+ }
+
+ // Sort subgroups…
+ if (sortSubgroups) {
+ subgroupIndex.forEach(function(d, i) {
+ d.sort(function(a, b) {
+ return sortSubgroups(matrix[i][a], matrix[i][b]);
+ });
+ });
+ }
+
+ // Convert the sum to scaling factor for [0, 2pi].
+ // TODO Allow start and end angle to be specified.
+ // TODO Allow padding to be specified as percentage?
+ k = (2 * Math.PI - padding * n) / k;
+
+ // Compute the start and end angle for each group and subgroup.
+ x = 0, i = -1; while (++i < n) {
+ x0 = x, j = -1; while (++j < n) {
+ var di = groupIndex[i],
+ dj = subgroupIndex[i][j],
+ v = matrix[di][dj];
+ subgroups[di + "-" + dj] = {
+ index: di,
+ subindex: dj,
+ startAngle: x,
+ endAngle: x += v * k,
+ value: v
+ };
+ }
+ groups.push({
+ index: di,
+ startAngle: x0,
+ endAngle: x,
+ value: (x - x0) / k
+ });
+ x += padding;
+ }
+
+ // Generate chords for each (non-empty) subgroup-subgroup link.
+ i = -1; while (++i < n) {
+ j = i - 1; while (++j < n) {
+ var source = subgroups[i + "-" + j],
+ target = subgroups[j + "-" + i];
+ if (source.value || target.value) {
+ chords.push({
+ source: source,
+ target: target
+ })
+ }
+ }
+ }
+
+ if (sortChords) resort();
+ }
+
+ function resort() {
+ chords.sort(function(a, b) {
+ a = Math.min(a.source.value, a.target.value);
+ b = Math.min(b.source.value, b.target.value);
+ return sortChords(a, b);
+ });
+ }
+
+ chord.matrix = function(x) {
+ if (!arguments.length) return matrix;
+ n = (matrix = x) && matrix.length;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.padding = function(x) {
+ if (!arguments.length) return padding;
+ padding = x;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.sortGroups = function(x) {
+ if (!arguments.length) return sortGroups;
+ sortGroups = x;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.sortSubgroups = function(x) {
+ if (!arguments.length) return sortSubgroups;
+ sortSubgroups = x;
+ chords = null;
+ return chord;
+ };
+
+ chord.sortChords = function(x) {
+ if (!arguments.length) return sortChords;
+ sortChords = x;
+ if (chords) resort();
+ return chord;
+ };
+
+ chord.chords = function() {
+ if (!chords) relayout();
+ return chords;
+ };
+
+ chord.groups = function() {
+ if (!groups) relayout();
+ return groups;
+ };
+
+ return chord;
+};
+// A rudimentary force layout using Gauss-Seidel.
+d3.layout.force = function() {
+ var force = {},
+ event = d3.dispatch("tick"),
+ size = [1, 1],
+ alpha = .5,
+ distance = 30,
+ interval,
+ nodes,
+ links,
+ distances;
+
+ function tick() {
+ var n = distances.length,
+ i, // current index
+ o, // current link
+ s, // current source
+ t, // current target
+ l, // current distance
+ x, // x-distance
+ y; // y-distance
+
+ // gauss-seidel relaxation
+ for (i = 0; i < n; ++i) {
+ o = distances[i];
+ s = o.source;
+ t = o.target;
+ x = t.x - s.x;
+ y = t.y - s.y;
+ if (l = Math.sqrt(x * x + y * y)) {
+ l = alpha / (o.distance * o.distance) * (l - distance * o.distance) / l;
+ x *= l;
+ y *= l;
+ if (!t.fixed) {
+ t.x -= x;
+ t.y -= y;
+ }
+ if (!s.fixed) {
+ s.x += x;
+ s.y += y;
+ }
+ }
+ }
+
+ event.tick.dispatch({type: "tick"});
+
+ // simulated annealing, basically
+ return (alpha *= .99) < .005;
+ }
+
+ force.on = function(type, listener) {
+ event[type].add(listener);
+ return force;
+ };
+
+ force.nodes = function(x) {
+ if (!arguments.length) return nodes;
+ nodes = x;
+ return force;
+ };
+
+ force.links = function(x) {
+ if (!arguments.length) return links;
+ links = x;
+ return force;
+ };
+
+ force.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return force;
+ };
+
+ force.distance = function(d) {
+ if (!arguments.length) return distance;
+ distance = d;
+ return force;
+ };
+
+ force.start = function() {
+ var i,
+ j,
+ k,
+ n = nodes.length,
+ m = links.length,
+ w = size[0],
+ h = size[1],
+ o;
+
+ var paths = [];
+ for (i = 0; i < n; ++i) {
+ o = nodes[i];
+ o.x = o.x || Math.random() * w;
+ o.y = o.y || Math.random() * h;
+ o.fixed = 0;
+ paths[i] = [];
+ for (j = 0; j < n; ++j) {
+ paths[i][j] = Infinity;
+ }
+ paths[i][i] = 0;
+ }
+
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ paths[o.source][o.target] = 1;
+ paths[o.target][o.source] = 1;
+ o.source = nodes[o.source];
+ o.target = nodes[o.target];
+ }
+
+ // Floyd-Warshall
+ for (k = 0; k < n; ++k) {
+ for (i = 0; i < n; ++i) {
+ for (j = 0; j < n; ++j) {
+ paths[i][j] = Math.min(paths[i][j], paths[i][k] + paths[k][j]);
+ }
+ }
+ }
+
+ distances = [];
+ for (i = 0; i < n; ++i) {
+ for (j = i + 1; j < n; ++j) {
+ distances.push({
+ source: nodes[i],
+ target: nodes[j],
+ distance: paths[i][j] * paths[i][j]
+ });
+ }
+ }
+
+ distances.sort(function(a, b) {
+ return a.distance - b.distance;
+ });
+
+ d3.timer(tick);
+ return force;
+ };
+
+ force.resume = function() {
+ alpha = .1;
+ d3.timer(tick);
+ return force;
+ };
+
+ force.stop = function() {
+ alpha = 0;
+ return force;
+ };
+
+ // use `node.call(force.drag)` to make nodes draggable
+ force.drag = function() {
+ var node, element;
+
+ this
+ .on("mouseover", function(d) { d.fixed = true; })
+ .on("mouseout", function(d) { if (d != node) d.fixed = false; })
+ .on("mousedown", mousedown);
+
+ d3.select(window)
+ .on("mousemove", mousemove)
+ .on("mouseup", mouseup);
+
+ function mousedown(d) {
+ (node = d).fixed = true;
+ element = this;
+ d3.event.preventDefault();
+ }
+
+ function mousemove() {
+ if (!node) return;
+ var m = d3.svg.mouse(element);
+ node.x = m[0];
+ node.y = m[1];
+ force.resume(); // restart annealing
+ }
+
+ function mouseup() {
+ if (!node) return;
+ mousemove();
+ node.fixed = false;
+ node = element = null;
+ }
+
+ return force;
+ };
+
+ return force;
+};
+d3.layout.partition = function() {
+ var hierarchy = d3.layout.hierarchy(),
+ size = [1, 1]; // width, height
+
+ function position(node, x, dx, dy) {
+ var children = node.children;
+ node.x = x;
+ node.y = node.depth * dy;
+ node.dx = dx;
+ node.dy = dy;
+ if (children) {
+ var i = -1,
+ n = children.length,
+ c,
+ d;
+ dx /= node.value;
+ while (++i < n) {
+ position(c = children[i], x, d = c.value * dx, dy);
+ x += d;
+ }
+ }
+ }
+
+ function depth(node) {
+ var children = node.children,
+ d = 0;
+ if (children) {
+ var i = -1,
+ n = children.length;
+ while (++i < n) d = Math.max(d, depth(children[i]));
+ }
+ return 1 + d;
+ }
+
+ function partition(d, i) {
+ var nodes = hierarchy.call(this, d, i);
+ position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
+ return nodes;
+ }
+
+ partition.sort = d3.rebind(partition, hierarchy.sort);
+ partition.children = d3.rebind(partition, hierarchy.children);
+ partition.value = d3.rebind(partition, hierarchy.value);
+
+ partition.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return partition;
+ };
+
+ return partition;
+};
+d3.layout.pie = function() {
+ var value = Number,
+ sort = null,
+ startAngle = 0,
+ endAngle = 2 * Math.PI;
+
+ function pie(data, i) {
+
+ // Compute the start angle.
+ var a = +(typeof startAngle == "function"
+ ? startAngle.apply(this, arguments)
+ : startAngle);
+
+ // Compute the angular range (end - start).
+ var k = (typeof endAngle == "function"
+ ? endAngle.apply(this, arguments)
+ : endAngle) - startAngle;
+
+ // Optionally sort the data.
+ var index = d3.range(data.length);
+ if (sort != null) index.sort(function(i, j) {
+ return sort(data[i], data[j]);
+ });
+
+ // Compute the numeric values for each data element.
+ var values = data.map(value);
+
+ // Convert k into a scale factor from value to angle, using the sum.
+ k /= values.reduce(function(p, d) { return p + d; }, 0);
+
+ // Compute the arcs!
+ var arcs = index.map(function(i) {
+ return {
+ value: d = values[i],
+ startAngle: a,
+ endAngle: a += d * k
+ };
+ });
+
+ // Return the arcs in the original data's order.
+ return data.map(function(d, i) {
+ return arcs[index[i]];
+ });
+ }
+
+ /**
+ * Specifies the value function *x*, which returns a nonnegative numeric value
+ * for each datum. The default value function is `Number`. The value function
+ * is passed two arguments: the current datum and the current index.
+ */
+ pie.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return pie;
+ };
+
+ /**
+ * Specifies a sort comparison operator *x*. The comparator is passed two data
+ * elements from the data array, a and b; it returns a negative value if a is
+ * less than b, a positive value if a is greater than b, and zero if a equals
+ * b.
+ */
+ pie.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return pie;
+ };
+
+ /**
+ * Specifies the overall start angle of the pie chart. Defaults to 0. The
+ * start angle can be specified either as a constant or as a function; in the
+ * case of a function, it is evaluated once per array (as opposed to per
+ * element).
+ */
+ pie.startAngle = function(x) {
+ if (!arguments.length) return startAngle;
+ startAngle = x;
+ return pie;
+ };
+
+ /**
+ * Specifies the overall end angle of the pie chart. Defaults to 2Ï€. The
+ * end angle can be specified either as a constant or as a function; in the
+ * case of a function, it is evaluated once per array (as opposed to per
+ * element).
+ */
+ pie.endAngle = function(x) {
+ if (!arguments.length) return endAngle;
+ endAngle = x;
+ return pie;
+ };
+
+ return pie;
+};
+// data is two-dimensional array of x,y; we populate y0
+// TODO perhaps make the `x`, `y` and `y0` structure customizable
+d3.layout.stack = function() {
+ var order = "default",
+ offset = "zero";
+
+ function stack(data) {
+ var n = data.length,
+ m = data[0].length,
+ i,
+ j,
+ y0;
+
+ // compute the order of series
+ var index = d3_layout_stackOrders[order](data);
+
+ // set y0 on the baseline
+ d3_layout_stackOffsets[offset](data, index);
+
+ // propagate offset to other series
+ for (j = 0; j < m; ++j) {
+ for (i = 1, y0 = data[index[0]][j].y0; i < n; ++i) {
+ data[index[i]][j].y0 = y0 += data[index[i - 1]][j].y;
+ }
+ }
+
+ return data;
+ }
+
+ stack.order = function(x) {
+ if (!arguments.length) return order;
+ order = x;
+ return stack;
+ };
+
+ stack.offset = function(x) {
+ if (!arguments.length) return offset;
+ offset = x;
+ return stack;
+ };
+
+ return stack;
+}
+
+var d3_layout_stackOrders = {
+
+ "inside-out": function(data) {
+ var n = data.length,
+ i,
+ j,
+ max = data.map(d3_layout_stackMaxIndex),
+ sums = data.map(d3_layout_stackReduceSum),
+ index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }),
+ top = 0,
+ bottom = 0,
+ tops = [],
+ bottoms = [];
+ for (i = 0; i < n; i++) {
+ j = index[i];
+ if (top < bottom) {
+ top += sums[j];
+ tops.push(j);
+ } else {
+ bottom += sums[j];
+ bottoms.push(j);
+ }
+ }
+ return bottoms.reverse().concat(tops);
+ },
+
+ "reverse": function(data) {
+ return d3.range(data.length).reverse();
+ },
+
+ "default": function(data) {
+ return d3.range(data.length);
+ }
+
+};
+
+var d3_layout_stackOffsets = {
+
+ "silhouette": function(data, index) {
+ var n = data.length,
+ m = data[0].length,
+ sums = [],
+ max = 0,
+ i,
+ j,
+ o;
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j].y;
+ if (o > max) max = o;
+ sums.push(o);
+ }
+ for (j = 0, i = index[0]; j < m; ++j) {
+ data[i][j].y0 = (max - sums[j]) / 2;
+ }
+ },
+
+ "wiggle": function(data, index) {
+ var n = data.length,
+ x = data[0],
+ m = x.length,
+ max = 0,
+ i,
+ j,
+ k,
+ ii,
+ ik,
+ i0 = index[0],
+ s1,
+ s2,
+ s3,
+ dx,
+ o,
+ o0;
+ data[i0][0].y0 = o = o0 = 0;
+ for (j = 1; j < m; ++j) {
+ for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j].y;
+ for (i = 0, s2 = 0, dx = x[j].x - x[j - 1].x; i < n; ++i) {
+ for (k = 0, ii = index[i], s3 = (data[ii][j].y - data[ii][j - 1].y) / (2 * dx); k < i; ++k) {
+ s3 += (data[ik = index[k]][j].y - data[ik][j - 1].y) / dx;
+ }
+ s2 += s3 * data[ii][j].y;
+ }
+ data[i0][j].y0 = o -= s1 ? s2 / s1 * dx : 0;
+ if (o < o0) o0 = o;
+ }
+ for (j = 0; j < m; ++j) data[i0][j].y0 -= o0;
+ },
+
+ "zero": function(data, index) {
+ var j = 0,
+ m = data[0].length,
+ i0 = index[0];
+ for (; j < m; ++j) data[i0][j].y0 = 0;
+ }
+
+};
+
+function d3_layout_stackReduceSum(d) {
+ return d.reduce(d3_layout_stackSum, 0);
+}
+
+function d3_layout_stackMaxIndex(array) {
+ var i = 1,
+ j = 0,
+ v = array[0].y,
+ k,
+ n = array.length;
+ for (; i < n; ++i) {
+ if ((k = array[i].y) > v) {
+ j = i;
+ v = k;
+ }
+ }
+ return j;
+}
+
+function d3_layout_stackSum(p, d) {
+ return p + d.y;
+}
+d3.layout.hierarchy = function() {
+ var sort = d3_layout_hierarchySort,
+ children = d3_layout_hierarchyChildren,
+ value = d3_layout_hierarchyValue;
+
+ // Recursively compute the node depth and value.
+ // Also converts the data representation into a standard hierarchy structure.
+ function recurse(data, depth, nodes) {
+ var datas = children.call(hierarchy, data, depth),
+ node = {depth: depth, data: data};
+ nodes.push(node);
+ if (datas) {
+ var i = -1,
+ n = datas.length,
+ c = node.children = [],
+ v = 0,
+ j = depth + 1;
+ while (++i < n) {
+ d = recurse(datas[i], j, nodes);
+ if (d.value > 0) { // ignore NaN, negative, etc.
+ c.push(d);
+ v += d.value;
+ d.parent = node;
+ }
+ }
+ if (sort) c.sort(sort);
+ node.value = v;
+ } else {
+ node.value = value.call(hierarchy, data, depth);
+ }
+ return node;
+ }
+
+ // Recursively re-evaluates the node value.
+ function revalue(node, depth) {
+ var children = node.children,
+ v = 0;
+ if (children) {
+ var i = -1,
+ n = children.length,
+ j = depth + 1;
+ while (++i < n) v += revalue(children[i], j);
+ } else {
+ v = value.call(hierarchy, node.data, depth);
+ }
+ return node.value = v;
+ }
+
+ function hierarchy(d) {
+ var nodes = [];
+ recurse(d, 0, nodes);
+ return nodes;
+ }
+
+ hierarchy.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return hierarchy;
+ };
+
+ hierarchy.children = function(x) {
+ if (!arguments.length) return children;
+ children = x;
+ return hierarchy;
+ };
+
+ hierarchy.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return hierarchy;
+ };
+
+ // Re-evaluates the `value` property for the specified hierarchy.
+ hierarchy.revalue = function(root) {
+ revalue(root, 0);
+ return root;
+ };
+
+ return hierarchy;
+}
+
+function d3_layout_hierarchyChildren(d) {
+ return d.children;
+}
+
+function d3_layout_hierarchyValue(d) {
+ return d.value;
+}
+
+function d3_layout_hierarchySort(a, b) {
+ return b.value - a.value;
+}
+// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk
+d3.layout.treemap = function() {
+ var hierarchy = d3.layout.hierarchy(),
+ round = Math.round,
+ size = [1, 1], // width, height
+ sticky = false,
+ stickies;
+
+ // Recursively compute the node area based on value & scale.
+ function scale(node, k) {
+ var children = node.children;
+ node.area = node.value * k;
+ if (children) {
+ var i = -1,
+ n = children.length;
+ while (++i < n) scale(children[i], k);
+ }
+ }
+
+ // Recursively arranges the specified node's children into squarified rows.
+ function squarify(node) {
+ if (!node.children) return;
+ var rect = {x: node.x, y: node.y, dx: node.dx, dy: node.dy},
+ row = [],
+ children = node.children.slice(), // copy-on-write
+ child,
+ best = Infinity, // the best row score so far
+ score, // the current row score
+ u = Math.min(rect.dx, rect.dy), // initial orientation
+ n;
+ row.area = 0;
+ while ((n = children.length) > 0) {
+ row.push(child = children[n - 1]);
+ row.area += child.area;
+ if ((score = worst(row, u)) <= best) { // continue with this orientation
+ children.pop();
+ best = score;
+ } else { // abort, and try a different orientation
+ row.area -= row.pop().area;
+ position(row, u, rect, false);
+ u = Math.min(rect.dx, rect.dy);
+ row.length = row.area = 0;
+ best = Infinity;
+ }
+ }
+ if (row.length) {
+ position(row, u, rect, true);
+ row.length = row.area = 0;
+ }
+ node.children.forEach(squarify);
+ }
+
+ // Recursively resizes the specified node's children into existing rows.
+ // Preserves the existing layout!
+ function stickify(node) {
+ if (!node.children) return;
+ var rect = {x: node.x, y: node.y, dx: node.dx, dy: node.dy},
+ children = node.children.slice(), // copy-on-write
+ child,
+ row = [];
+ row.area = 0;
+ while (child = children.pop()) {
+ row.push(child);
+ row.area += child.area;
+ if (child.z != null) {
+ position(row, child.z ? rect.dx : rect.dy, rect, !children.length);
+ row.length = row.area = 0;
+ }
+ }
+ node.children.forEach(stickify);
+ }
+
+ // Computes the score for the specified row, as the worst aspect ratio.
+ function worst(row, u) {
+ var s = row.area,
+ r,
+ rmax = 0,
+ rmin = Infinity,
+ i = -1,
+ n = row.length;
+ while (++i < n) {
+ r = row[i].area;
+ if (r < rmin) rmin = r;
+ if (r > rmax) rmax = r;
+ }
+ s *= s;
+ u *= u;
+ return Math.max((u * rmax) / s, s / (u * rmin));
+ }
+
+ // Positions the specified row of nodes. Modifies `rect`.
+ function position(row, u, rect, flush) {
+ var i = -1,
+ n = row.length,
+ x = rect.x,
+ y = rect.y,
+ v = u ? round(row.area / u) : 0,
+ o;
+ if (u == rect.dx) { // horizontal subdivision
+ if (flush || v > rect.dy) v = rect.dy; // over+underflow
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dy = v;
+ x += o.dx = round(o.area / v);
+ }
+ o.z = true;
+ o.dx += rect.x + rect.dx - x; // rounding error
+ rect.y += v;
+ rect.dy -= v;
+ } else { // vertical subdivision
+ if (flush || v > rect.dx) v = rect.dx; // over+underflow
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dx = v;
+ y += o.dy = round(o.area / v);
+ }
+ o.z = false;
+ o.dy += rect.y + rect.dy - y; // rounding error
+ rect.x += v;
+ rect.dx -= v;
+ }
+ }
+
+ function treemap(d) {
+ var nodes = stickies || hierarchy(d),
+ root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ root.dx = size[0];
+ root.dy = size[1];
+ if (stickies) hierarchy.revalue(root);
+ scale(root, size[0] * size[1] / root.value);
+ (stickies ? stickify : squarify)(root);
+ if (sticky) stickies = nodes;
+ return nodes;
+ }
+
+ treemap.sort = d3.rebind(treemap, hierarchy.sort);
+ treemap.children = d3.rebind(treemap, hierarchy.children);
+ treemap.value = d3.rebind(treemap, hierarchy.value);
+
+ treemap.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return treemap;
+ };
+
+ treemap.round = function(x) {
+ if (!arguments.length) return round != Number;
+ round = x ? Math.round : Number;
+ return treemap;
+ };
+
+ treemap.sticky = function(x) {
+ if (!arguments.length) return sticky;
+ sticky = x;
+ stickies = null;
+ return treemap;
+ };
+
+ return treemap;
+};
+})() \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.js
new file mode 100644
index 00000000..78c4dbca
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.js
@@ -0,0 +1,7037 @@
+(function() {
+ function d3_class(ctor, properties) {
+ try {
+ for (var key in properties) {
+ Object.defineProperty(ctor.prototype, key, {
+ value: properties[key],
+ enumerable: false
+ });
+ }
+ } catch (e) {
+ ctor.prototype = properties;
+ }
+ }
+ function d3_arrayCopy(pseudoarray) {
+ var i = -1, n = pseudoarray.length, array = [];
+ while (++i < n) array.push(pseudoarray[i]);
+ return array;
+ }
+ function d3_arraySlice(pseudoarray) {
+ return Array.prototype.slice.call(pseudoarray);
+ }
+ function d3_Map() {}
+ function d3_identity(d) {
+ return d;
+ }
+ function d3_this() {
+ return this;
+ }
+ function d3_true() {
+ return true;
+ }
+ function d3_functor(v) {
+ return typeof v === "function" ? v : function() {
+ return v;
+ };
+ }
+ function d3_rebind(target, source, method) {
+ return function() {
+ var value = method.apply(source, arguments);
+ return arguments.length ? target : value;
+ };
+ }
+ function d3_number(x) {
+ return x != null && !isNaN(x);
+ }
+ function d3_zipLength(d) {
+ return d.length;
+ }
+ function d3_splitter(d) {
+ return d == null;
+ }
+ function d3_collapse(s) {
+ return s.trim().replace(/\s+/g, " ");
+ }
+ function d3_range_integerScale(x) {
+ var k = 1;
+ while (x * k % 1) k *= 10;
+ return k;
+ }
+ function d3_dispatch() {}
+ function d3_dispatch_event(dispatch) {
+ function event() {
+ var z = listeners, i = -1, n = z.length, l;
+ while (++i < n) if (l = z[i].on) l.apply(this, arguments);
+ return dispatch;
+ }
+ var listeners = [], listenerByName = new d3_Map;
+ event.on = function(name, listener) {
+ var l = listenerByName.get(name), i;
+ if (arguments.length < 2) return l && l.on;
+ if (l) {
+ l.on = null;
+ listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
+ listenerByName.remove(name);
+ }
+ if (listener) listeners.push(listenerByName.set(name, {
+ on: listener
+ }));
+ return dispatch;
+ };
+ return event;
+ }
+ function d3_format_precision(x, p) {
+ return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1);
+ }
+ function d3_format_typeDefault(x) {
+ return x + "";
+ }
+ function d3_format_group(value) {
+ var i = value.lastIndexOf("."), f = i >= 0 ? value.substring(i) : (i = value.length, ""), t = [];
+ while (i > 0) t.push(value.substring(i -= 3, i + 3));
+ return t.reverse().join(",") + f;
+ }
+ function d3_formatPrefix(d, i) {
+ var k = Math.pow(10, Math.abs(8 - i) * 3);
+ return {
+ scale: i > 8 ? function(d) {
+ return d / k;
+ } : function(d) {
+ return d * k;
+ },
+ symbol: d
+ };
+ }
+ function d3_ease_clamp(f) {
+ return function(t) {
+ return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
+ };
+ }
+ function d3_ease_reverse(f) {
+ return function(t) {
+ return 1 - f(1 - t);
+ };
+ }
+ function d3_ease_reflect(f) {
+ return function(t) {
+ return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));
+ };
+ }
+ function d3_ease_identity(t) {
+ return t;
+ }
+ function d3_ease_poly(e) {
+ return function(t) {
+ return Math.pow(t, e);
+ };
+ }
+ function d3_ease_sin(t) {
+ return 1 - Math.cos(t * Math.PI / 2);
+ }
+ function d3_ease_exp(t) {
+ return Math.pow(2, 10 * (t - 1));
+ }
+ function d3_ease_circle(t) {
+ return 1 - Math.sqrt(1 - t * t);
+ }
+ function d3_ease_elastic(a, p) {
+ var s;
+ if (arguments.length < 2) p = .45;
+ if (arguments.length < 1) {
+ a = 1;
+ s = p / 4;
+ } else s = p / (2 * Math.PI) * Math.asin(1 / a);
+ return function(t) {
+ return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p);
+ };
+ }
+ function d3_ease_back(s) {
+ if (!s) s = 1.70158;
+ return function(t) {
+ return t * t * ((s + 1) * t - s);
+ };
+ }
+ function d3_ease_bounce(t) {
+ return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
+ }
+ function d3_eventCancel() {
+ d3.event.stopPropagation();
+ d3.event.preventDefault();
+ }
+ function d3_eventSource() {
+ var e = d3.event, s;
+ while (s = e.sourceEvent) e = s;
+ return e;
+ }
+ function d3_eventDispatch(target) {
+ var dispatch = new d3_dispatch, i = 0, n = arguments.length;
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
+ dispatch.of = function(thiz, argumentz) {
+ return function(e1) {
+ try {
+ var e0 = e1.sourceEvent = d3.event;
+ e1.target = target;
+ d3.event = e1;
+ dispatch[e1.type].apply(thiz, argumentz);
+ } finally {
+ d3.event = e0;
+ }
+ };
+ };
+ return dispatch;
+ }
+ function d3_transform(m) {
+ var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
+ if (r0[0] * r1[1] < r1[0] * r0[1]) {
+ r0[0] *= -1;
+ r0[1] *= -1;
+ kx *= -1;
+ kz *= -1;
+ }
+ this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees;
+ this.translate = [ m.e, m.f ];
+ this.scale = [ kx, ky ];
+ this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0;
+ }
+ function d3_transformDot(a, b) {
+ return a[0] * b[0] + a[1] * b[1];
+ }
+ function d3_transformNormalize(a) {
+ var k = Math.sqrt(d3_transformDot(a, a));
+ if (k) {
+ a[0] /= k;
+ a[1] /= k;
+ }
+ return k;
+ }
+ function d3_transformCombine(a, b, k) {
+ a[0] += k * b[0];
+ a[1] += k * b[1];
+ return a;
+ }
+ function d3_interpolateByName(name) {
+ return name == "transform" ? d3.interpolateTransform : d3.interpolate;
+ }
+ function d3_uninterpolateNumber(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) {
+ return (x - a) * b;
+ };
+ }
+ function d3_uninterpolateClamp(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) {
+ return Math.max(0, Math.min(1, (x - a) * b));
+ };
+ }
+ function d3_rgb(r, g, b) {
+ return new d3_Rgb(r, g, b);
+ }
+ function d3_Rgb(r, g, b) {
+ this.r = r;
+ this.g = g;
+ this.b = b;
+ }
+ function d3_rgb_hex(v) {
+ return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
+ }
+ function d3_rgb_parse(format, rgb, hsl) {
+ var r = 0, g = 0, b = 0, m1, m2, name;
+ m1 = /([a-z]+)\((.*)\)/i.exec(format);
+ if (m1) {
+ m2 = m1[2].split(",");
+ switch (m1[1]) {
+ case "hsl":
+ {
+ return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);
+ }
+ case "rgb":
+ {
+ return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));
+ }
+ }
+ }
+ if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
+ if (format != null && format.charAt(0) === "#") {
+ if (format.length === 4) {
+ r = format.charAt(1);
+ r += r;
+ g = format.charAt(2);
+ g += g;
+ b = format.charAt(3);
+ b += b;
+ } else if (format.length === 7) {
+ r = format.substring(1, 3);
+ g = format.substring(3, 5);
+ b = format.substring(5, 7);
+ }
+ r = parseInt(r, 16);
+ g = parseInt(g, 16);
+ b = parseInt(b, 16);
+ }
+ return rgb(r, g, b);
+ }
+ function d3_rgb_hsl(r, g, b) {
+ var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2;
+ if (d) {
+ s = l < .5 ? d / (max + min) : d / (2 - max - min);
+ if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4;
+ h *= 60;
+ } else {
+ s = h = 0;
+ }
+ return d3_hsl(h, s, l);
+ }
+ function d3_rgb_lab(r, g, b) {
+ r = d3_rgb_xyz(r);
+ g = d3_rgb_xyz(g);
+ b = d3_rgb_xyz(b);
+ var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z);
+ return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
+ }
+ function d3_rgb_xyz(r) {
+ return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);
+ }
+ function d3_rgb_parseNumber(c) {
+ var f = parseFloat(c);
+ return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
+ }
+ function d3_hsl(h, s, l) {
+ return new d3_Hsl(h, s, l);
+ }
+ function d3_Hsl(h, s, l) {
+ this.h = h;
+ this.s = s;
+ this.l = l;
+ }
+ function d3_hsl_rgb(h, s, l) {
+ function v(h) {
+ if (h > 360) h -= 360; else if (h < 0) h += 360;
+ if (h < 60) return m1 + (m2 - m1) * h / 60;
+ if (h < 180) return m2;
+ if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
+ return m1;
+ }
+ function vv(h) {
+ return Math.round(v(h) * 255);
+ }
+ var m1, m2;
+ h = h % 360;
+ if (h < 0) h += 360;
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
+ l = l < 0 ? 0 : l > 1 ? 1 : l;
+ m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
+ m1 = 2 * l - m2;
+ return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
+ }
+ function d3_hcl(h, c, l) {
+ return new d3_Hcl(h, c, l);
+ }
+ function d3_Hcl(h, c, l) {
+ this.h = h;
+ this.c = c;
+ this.l = l;
+ }
+ function d3_hcl_lab(h, c, l) {
+ return d3_lab(l, Math.cos(h *= Math.PI / 180) * c, Math.sin(h) * c);
+ }
+ function d3_lab(l, a, b) {
+ return new d3_Lab(l, a, b);
+ }
+ function d3_Lab(l, a, b) {
+ this.l = l;
+ this.a = a;
+ this.b = b;
+ }
+ function d3_lab_rgb(l, a, b) {
+ var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
+ x = d3_lab_xyz(x) * d3_lab_X;
+ y = d3_lab_xyz(y) * d3_lab_Y;
+ z = d3_lab_xyz(z) * d3_lab_Z;
+ return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z));
+ }
+ function d3_lab_hcl(l, a, b) {
+ return d3_hcl(Math.atan2(b, a) / Math.PI * 180, Math.sqrt(a * a + b * b), l);
+ }
+ function d3_lab_xyz(x) {
+ return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
+ }
+ function d3_xyz_lab(x) {
+ return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
+ }
+ function d3_xyz_rgb(r) {
+ return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));
+ }
+ function d3_selection(groups) {
+ d3_arraySubclass(groups, d3_selectionPrototype);
+ return groups;
+ }
+ function d3_selection_selector(selector) {
+ return function() {
+ return d3_select(selector, this);
+ };
+ }
+ function d3_selection_selectorAll(selector) {
+ return function() {
+ return d3_selectAll(selector, this);
+ };
+ }
+ function d3_selection_attr(name, value) {
+ function attrNull() {
+ this.removeAttribute(name);
+ }
+ function attrNullNS() {
+ this.removeAttributeNS(name.space, name.local);
+ }
+ function attrConstant() {
+ this.setAttribute(name, value);
+ }
+ function attrConstantNS() {
+ this.setAttributeNS(name.space, name.local, value);
+ }
+ function attrFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);
+ }
+ function attrFunctionNS() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);
+ }
+ name = d3.ns.qualify(name);
+ return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;
+ }
+ function d3_selection_classedRe(name) {
+ return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");
+ }
+ function d3_selection_classed(name, value) {
+ function classedConstant() {
+ var i = -1;
+ while (++i < n) name[i](this, value);
+ }
+ function classedFunction() {
+ var i = -1, x = value.apply(this, arguments);
+ while (++i < n) name[i](this, x);
+ }
+ name = name.trim().split(/\s+/).map(d3_selection_classedName);
+ var n = name.length;
+ return typeof value === "function" ? classedFunction : classedConstant;
+ }
+ function d3_selection_classedName(name) {
+ var re = d3_selection_classedRe(name);
+ return function(node, value) {
+ if (c = node.classList) return value ? c.add(name) : c.remove(name);
+ var c = node.className, cb = c.baseVal != null, cv = cb ? c.baseVal : c;
+ if (value) {
+ re.lastIndex = 0;
+ if (!re.test(cv)) {
+ cv = d3_collapse(cv + " " + name);
+ if (cb) c.baseVal = cv; else node.className = cv;
+ }
+ } else if (cv) {
+ cv = d3_collapse(cv.replace(re, " "));
+ if (cb) c.baseVal = cv; else node.className = cv;
+ }
+ };
+ }
+ function d3_selection_style(name, value, priority) {
+ function styleNull() {
+ this.style.removeProperty(name);
+ }
+ function styleConstant() {
+ this.style.setProperty(name, value, priority);
+ }
+ function styleFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);
+ }
+ return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;
+ }
+ function d3_selection_property(name, value) {
+ function propertyNull() {
+ delete this[name];
+ }
+ function propertyConstant() {
+ this[name] = value;
+ }
+ function propertyFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) delete this[name]; else this[name] = x;
+ }
+ return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;
+ }
+ function d3_selection_dataNode(data) {
+ return {
+ __data__: data
+ };
+ }
+ function d3_selection_filter(selector) {
+ return function() {
+ return d3_selectMatches(this, selector);
+ };
+ }
+ function d3_selection_sortComparator(comparator) {
+ if (!arguments.length) comparator = d3.ascending;
+ return function(a, b) {
+ return comparator(a && a.__data__, b && b.__data__);
+ };
+ }
+ function d3_selection_on(type, listener, capture) {
+ function onRemove() {
+ var wrapper = this[name];
+ if (wrapper) {
+ this.removeEventListener(type, wrapper, wrapper.$);
+ delete this[name];
+ }
+ }
+ function onAdd() {
+ function wrapper(e) {
+ var o = d3.event;
+ d3.event = e;
+ args[0] = node.__data__;
+ try {
+ listener.apply(node, args);
+ } finally {
+ d3.event = o;
+ }
+ }
+ var node = this, args = arguments;
+ onRemove.call(this);
+ this.addEventListener(type, this[name] = wrapper, wrapper.$ = capture);
+ wrapper._ = listener;
+ }
+ var name = "__on" + type, i = type.indexOf(".");
+ if (i > 0) type = type.substring(0, i);
+ return listener ? onAdd : onRemove;
+ }
+ function d3_selection_each(groups, callback) {
+ for (var j = 0, m = groups.length; j < m; j++) {
+ for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {
+ if (node = group[i]) callback(node, i, j);
+ }
+ }
+ return groups;
+ }
+ function d3_selection_enter(selection) {
+ d3_arraySubclass(selection, d3_selection_enterPrototype);
+ return selection;
+ }
+ function d3_transition(groups, id, time) {
+ d3_arraySubclass(groups, d3_transitionPrototype);
+ var tweens = new d3_Map, event = d3.dispatch("start", "end"), ease = d3_transitionEase;
+ groups.id = id;
+ groups.time = time;
+ groups.tween = function(name, tween) {
+ if (arguments.length < 2) return tweens.get(name);
+ if (tween == null) tweens.remove(name); else tweens.set(name, tween);
+ return groups;
+ };
+ groups.ease = function(value) {
+ if (!arguments.length) return ease;
+ ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments);
+ return groups;
+ };
+ groups.each = function(type, listener) {
+ if (arguments.length < 2) return d3_transition_each.call(groups, type);
+ event.on(type, listener);
+ return groups;
+ };
+ d3.timer(function(elapsed) {
+ return d3_selection_each(groups, function(node, i, j) {
+ function start(elapsed) {
+ if (lock.active > id) return stop();
+ lock.active = id;
+ tweens.forEach(function(key, value) {
+ if (value = value.call(node, d, i)) {
+ tweened.push(value);
+ }
+ });
+ event.start.call(node, d, i);
+ if (!tick(elapsed)) d3.timer(tick, 0, time);
+ return 1;
+ }
+ function tick(elapsed) {
+ if (lock.active !== id) return stop();
+ var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length;
+ while (n > 0) {
+ tweened[--n].call(node, e);
+ }
+ if (t >= 1) {
+ stop();
+ d3_transitionId = id;
+ event.end.call(node, d, i);
+ d3_transitionId = 0;
+ return 1;
+ }
+ }
+ function stop() {
+ if (!--lock.count) delete node.__transition__;
+ return 1;
+ }
+ var tweened = [], delay = node.delay, duration = node.duration, lock = (node = node.node).__transition__ || (node.__transition__ = {
+ active: 0,
+ count: 0
+ }), d = node.__data__;
+ ++lock.count;
+ delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time);
+ });
+ }, 0, time);
+ return groups;
+ }
+ function d3_transition_each(callback) {
+ var id = d3_transitionId, ease = d3_transitionEase, delay = d3_transitionDelay, duration = d3_transitionDuration;
+ d3_transitionId = this.id;
+ d3_transitionEase = this.ease();
+ d3_selection_each(this, function(node, i, j) {
+ d3_transitionDelay = node.delay;
+ d3_transitionDuration = node.duration;
+ callback.call(node = node.node, node.__data__, i, j);
+ });
+ d3_transitionId = id;
+ d3_transitionEase = ease;
+ d3_transitionDelay = delay;
+ d3_transitionDuration = duration;
+ return this;
+ }
+ function d3_tweenNull(d, i, a) {
+ return a != "" && d3_tweenRemove;
+ }
+ function d3_tweenByName(b, name) {
+ return d3.tween(b, d3_interpolateByName(name));
+ }
+ function d3_timer_step() {
+ var elapsed, now = Date.now(), t1 = d3_timer_queue;
+ while (t1) {
+ elapsed = now - t1.then;
+ if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+ var delay = d3_timer_flush() - now;
+ if (delay > 24) {
+ if (isFinite(delay)) {
+ clearTimeout(d3_timer_timeout);
+ d3_timer_timeout = setTimeout(d3_timer_step, delay);
+ }
+ d3_timer_interval = 0;
+ } else {
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+ }
+ function d3_timer_flush() {
+ var t0 = null, t1 = d3_timer_queue, then = Infinity;
+ while (t1) {
+ if (t1.flush) {
+ t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
+ } else {
+ then = Math.min(then, t1.then + t1.delay);
+ t1 = (t0 = t1).next;
+ }
+ }
+ return then;
+ }
+ function d3_mousePoint(container, e) {
+ var svg = container.ownerSVGElement || container;
+ if (svg.createSVGPoint) {
+ var point = svg.createSVGPoint();
+ if (d3_mouse_bug44083 < 0 && (window.scrollX || window.scrollY)) {
+ svg = d3.select(document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0);
+ var ctm = svg[0][0].getScreenCTM();
+ d3_mouse_bug44083 = !(ctm.f || ctm.e);
+ svg.remove();
+ }
+ if (d3_mouse_bug44083) {
+ point.x = e.pageX;
+ point.y = e.pageY;
+ } else {
+ point.x = e.clientX;
+ point.y = e.clientY;
+ }
+ point = point.matrixTransform(container.getScreenCTM().inverse());
+ return [ point.x, point.y ];
+ }
+ var rect = container.getBoundingClientRect();
+ return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
+ }
+ function d3_noop() {}
+ function d3_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [ start, stop ] : [ stop, start ];
+ }
+ function d3_scaleRange(scale) {
+ return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
+ }
+ function d3_scale_nice(domain, nice) {
+ var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;
+ if (x1 < x0) {
+ dx = i0, i0 = i1, i1 = dx;
+ dx = x0, x0 = x1, x1 = dx;
+ }
+ if (nice = nice(x1 - x0)) {
+ domain[i0] = nice.floor(x0);
+ domain[i1] = nice.ceil(x1);
+ }
+ return domain;
+ }
+ function d3_scale_niceDefault() {
+ return Math;
+ }
+ function d3_scale_linear(domain, range, interpolate, clamp) {
+ function rescale() {
+ var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
+ output = linear(domain, range, uninterpolate, interpolate);
+ input = linear(range, domain, uninterpolate, d3.interpolate);
+ return scale;
+ }
+ function scale(x) {
+ return output(x);
+ }
+ var output, input;
+ scale.invert = function(y) {
+ return input(y);
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.map(Number);
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.rangeRound = function(x) {
+ return scale.range(x).interpolate(d3.interpolateRound);
+ };
+ scale.clamp = function(x) {
+ if (!arguments.length) return clamp;
+ clamp = x;
+ return rescale();
+ };
+ scale.interpolate = function(x) {
+ if (!arguments.length) return interpolate;
+ interpolate = x;
+ return rescale();
+ };
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(domain, m);
+ };
+ scale.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(domain, m);
+ };
+ scale.nice = function() {
+ d3_scale_nice(domain, d3_scale_linearNice);
+ return rescale();
+ };
+ scale.copy = function() {
+ return d3_scale_linear(domain, range, interpolate, clamp);
+ };
+ return rescale();
+ }
+ function d3_scale_linearRebind(scale, linear) {
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+ }
+ function d3_scale_linearNice(dx) {
+ dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
+ return dx && {
+ floor: function(x) {
+ return Math.floor(x / dx) * dx;
+ },
+ ceil: function(x) {
+ return Math.ceil(x / dx) * dx;
+ }
+ };
+ }
+ function d3_scale_linearTickRange(domain, m) {
+ var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step;
+ if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
+ extent[0] = Math.ceil(extent[0] / step) * step;
+ extent[1] = Math.floor(extent[1] / step) * step + step * .5;
+ extent[2] = step;
+ return extent;
+ }
+ function d3_scale_linearTicks(domain, m) {
+ return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
+ }
+ function d3_scale_linearTickFormat(domain, m) {
+ return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");
+ }
+ function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
+ var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);
+ return function(x) {
+ return i(u(x));
+ };
+ }
+ function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
+ var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;
+ if (domain[k] < domain[0]) {
+ domain = domain.slice().reverse();
+ range = range.slice().reverse();
+ }
+ while (++j <= k) {
+ u.push(uninterpolate(domain[j - 1], domain[j]));
+ i.push(interpolate(range[j - 1], range[j]));
+ }
+ return function(x) {
+ var j = d3.bisect(domain, x, 1, k) - 1;
+ return i[j](u[j](x));
+ };
+ }
+ function d3_scale_log(linear, log) {
+ function scale(x) {
+ return linear(log(x));
+ }
+ var pow = log.pow;
+ scale.invert = function(x) {
+ return pow(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(pow);
+ log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;
+ pow = log.pow;
+ linear.domain(x.map(log));
+ return scale;
+ };
+ scale.nice = function() {
+ linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));
+ return scale;
+ };
+ scale.ticks = function() {
+ var extent = d3_scaleExtent(linear.domain()), ticks = [];
+ if (extent.every(isFinite)) {
+ var i = Math.floor(extent[0]), j = Math.ceil(extent[1]), u = pow(extent[0]), v = pow(extent[1]);
+ if (log === d3_scale_logn) {
+ ticks.push(pow(i));
+ for (; i++ < j; ) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
+ } else {
+ for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
+ ticks.push(pow(i));
+ }
+ for (i = 0; ticks[i] < u; i++) {}
+ for (j = ticks.length; ticks[j - 1] > v; j--) {}
+ ticks = ticks.slice(i, j);
+ }
+ return ticks;
+ };
+ scale.tickFormat = function(n, format) {
+ if (arguments.length < 2) format = d3_scale_logFormat;
+ if (arguments.length < 1) return format;
+ var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), e;
+ return function(d) {
+ return d / pow(f(log(d) + e)) <= k ? format(d) : "";
+ };
+ };
+ scale.copy = function() {
+ return d3_scale_log(linear.copy(), log);
+ };
+ return d3_scale_linearRebind(scale, linear);
+ }
+ function d3_scale_logp(x) {
+ return Math.log(x < 0 ? 0 : x) / Math.LN10;
+ }
+ function d3_scale_logn(x) {
+ return -Math.log(x > 0 ? 0 : -x) / Math.LN10;
+ }
+ function d3_scale_pow(linear, exponent) {
+ function scale(x) {
+ return linear(powp(x));
+ }
+ var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);
+ scale.invert = function(x) {
+ return powb(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(powb);
+ linear.domain(x.map(powp));
+ return scale;
+ };
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(scale.domain(), m);
+ };
+ scale.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(scale.domain(), m);
+ };
+ scale.nice = function() {
+ return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
+ };
+ scale.exponent = function(x) {
+ if (!arguments.length) return exponent;
+ var domain = scale.domain();
+ powp = d3_scale_powPow(exponent = x);
+ powb = d3_scale_powPow(1 / exponent);
+ return scale.domain(domain);
+ };
+ scale.copy = function() {
+ return d3_scale_pow(linear.copy(), exponent);
+ };
+ return d3_scale_linearRebind(scale, linear);
+ }
+ function d3_scale_powPow(e) {
+ return function(x) {
+ return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
+ };
+ }
+ function d3_scale_ordinal(domain, ranger) {
+ function scale(x) {
+ return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length];
+ }
+ function steps(start, step) {
+ return d3.range(domain.length).map(function(i) {
+ return start + step * i;
+ });
+ }
+ var index, range, rangeBand;
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = [];
+ index = new d3_Map;
+ var i = -1, n = x.length, xi;
+ while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
+ return scale[ranger.t].apply(scale, ranger.a);
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ rangeBand = 0;
+ ranger = {
+ t: "range",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangePoints = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding);
+ range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
+ rangeBand = 0;
+ ranger = {
+ t: "rangePoints",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeBands = function(x, padding, outerPadding) {
+ if (arguments.length < 2) padding = 0;
+ if (arguments.length < 3) outerPadding = padding;
+ var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);
+ range = steps(start + step * outerPadding, step);
+ if (reverse) range.reverse();
+ rangeBand = step * (1 - padding);
+ ranger = {
+ t: "rangeBands",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeRoundBands = function(x, padding, outerPadding) {
+ if (arguments.length < 2) padding = 0;
+ if (arguments.length < 3) outerPadding = padding;
+ var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step;
+ range = steps(start + Math.round(error / 2), step);
+ if (reverse) range.reverse();
+ rangeBand = Math.round(step * (1 - padding));
+ ranger = {
+ t: "rangeRoundBands",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeBand = function() {
+ return rangeBand;
+ };
+ scale.rangeExtent = function() {
+ return d3_scaleExtent(ranger.a[0]);
+ };
+ scale.copy = function() {
+ return d3_scale_ordinal(domain, ranger);
+ };
+ return scale.domain(domain);
+ }
+ function d3_scale_quantile(domain, range) {
+ function rescale() {
+ var k = 0, n = domain.length, q = range.length;
+ thresholds = [];
+ while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
+ return scale;
+ }
+ function scale(x) {
+ if (isNaN(x = +x)) return NaN;
+ return range[d3.bisect(thresholds, x)];
+ }
+ var thresholds;
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.filter(function(d) {
+ return !isNaN(d);
+ }).sort(d3.ascending);
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.quantiles = function() {
+ return thresholds;
+ };
+ scale.copy = function() {
+ return d3_scale_quantile(domain, range);
+ };
+ return rescale();
+ }
+ function d3_scale_quantize(x0, x1, range) {
+ function scale(x) {
+ return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
+ }
+ function rescale() {
+ kx = range.length / (x1 - x0);
+ i = range.length - 1;
+ return scale;
+ }
+ var kx, i;
+ scale.domain = function(x) {
+ if (!arguments.length) return [ x0, x1 ];
+ x0 = +x[0];
+ x1 = +x[x.length - 1];
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.copy = function() {
+ return d3_scale_quantize(x0, x1, range);
+ };
+ return rescale();
+ }
+ function d3_scale_threshold(domain, range) {
+ function scale(x) {
+ return range[d3.bisect(domain, x)];
+ }
+ scale.domain = function(_) {
+ if (!arguments.length) return domain;
+ domain = _;
+ return scale;
+ };
+ scale.range = function(_) {
+ if (!arguments.length) return range;
+ range = _;
+ return scale;
+ };
+ scale.copy = function() {
+ return d3_scale_threshold(domain, range);
+ };
+ return scale;
+ }
+ function d3_scale_identity(domain) {
+ function identity(x) {
+ return +x;
+ }
+ identity.invert = identity;
+ identity.domain = identity.range = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.map(identity);
+ return identity;
+ };
+ identity.ticks = function(m) {
+ return d3_scale_linearTicks(domain, m);
+ };
+ identity.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(domain, m);
+ };
+ identity.copy = function() {
+ return d3_scale_identity(domain);
+ };
+ return identity;
+ }
+ function d3_svg_arcInnerRadius(d) {
+ return d.innerRadius;
+ }
+ function d3_svg_arcOuterRadius(d) {
+ return d.outerRadius;
+ }
+ function d3_svg_arcStartAngle(d) {
+ return d.startAngle;
+ }
+ function d3_svg_arcEndAngle(d) {
+ return d.endAngle;
+ }
+ function d3_svg_line(projection) {
+ function line(data) {
+ function segment() {
+ segments.push("M", interpolate(projection(points), tension));
+ }
+ var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
+ while (++i < n) {
+ if (defined.call(this, d = data[i], i)) {
+ points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
+ } else if (points.length) {
+ segment();
+ points = [];
+ }
+ }
+ if (points.length) segment();
+ return segments.length ? segments.join("") : null;
+ }
+ var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
+ line.x = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return line;
+ };
+ line.y = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return line;
+ };
+ line.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return line;
+ };
+ line.interpolate = function(_) {
+ if (!arguments.length) return interpolateKey;
+ if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
+ return line;
+ };
+ line.tension = function(_) {
+ if (!arguments.length) return tension;
+ tension = _;
+ return line;
+ };
+ return line;
+ }
+ function d3_svg_lineX(d) {
+ return d[0];
+ }
+ function d3_svg_lineY(d) {
+ return d[1];
+ }
+ function d3_svg_lineLinear(points) {
+ return points.join("L");
+ }
+ function d3_svg_lineLinearClosed(points) {
+ return d3_svg_lineLinear(points) + "Z";
+ }
+ function d3_svg_lineStepBefore(points) {
+ var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
+ while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
+ return path.join("");
+ }
+ function d3_svg_lineStepAfter(points) {
+ var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
+ while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
+ return path.join("");
+ }
+ function d3_svg_lineCardinalOpen(points, tension) {
+ return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));
+ }
+ function d3_svg_lineCardinalClosed(points, tension) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
+ }
+ function d3_svg_lineCardinal(points, tension, closed) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
+ }
+ function d3_svg_lineHermite(points, tangents) {
+ if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
+ return d3_svg_lineLinear(points);
+ }
+ var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
+ if (quad) {
+ path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
+ p0 = points[1];
+ pi = 2;
+ }
+ if (tangents.length > 1) {
+ t = tangents[1];
+ p = points[pi];
+ pi++;
+ path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
+ for (var i = 2; i < tangents.length; i++, pi++) {
+ p = points[pi];
+ t = tangents[i];
+ path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
+ }
+ }
+ if (quad) {
+ var lp = points[pi];
+ path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
+ }
+ return path;
+ }
+ function d3_svg_lineCardinalTangents(points, tension) {
+ var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
+ while (++i < n) {
+ p0 = p1;
+ p1 = p2;
+ p2 = points[i];
+ tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
+ }
+ return tangents;
+ }
+ function d3_svg_lineBasis(points) {
+ if (points.length < 3) return d3_svg_lineLinear(points);
+ var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ];
+ d3_svg_lineBasisBezier(path, px, py);
+ while (++i < n) {
+ pi = points[i];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ i = -1;
+ while (++i < 2) {
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBasisOpen(points) {
+ if (points.length < 4) return d3_svg_lineLinear(points);
+ var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
+ while (++i < 3) {
+ pi = points[i];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
+ --i;
+ while (++i < n) {
+ pi = points[i];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBasisClosed(points) {
+ var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
+ while (++i < 4) {
+ pi = points[i % n];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
+ --i;
+ while (++i < m) {
+ pi = points[i % n];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBundle(points, tension) {
+ var n = points.length - 1;
+ if (n) {
+ var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
+ while (++i <= n) {
+ p = points[i];
+ t = i / n;
+ p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
+ p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
+ }
+ }
+ return d3_svg_lineBasis(points);
+ }
+ function d3_svg_lineDot4(a, b) {
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
+ }
+ function d3_svg_lineBasisBezier(path, x, y) {
+ path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
+ }
+ function d3_svg_lineSlope(p0, p1) {
+ return (p1[1] - p0[1]) / (p1[0] - p0[0]);
+ }
+ function d3_svg_lineFiniteDifferences(points) {
+ var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
+ while (++i < j) {
+ m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
+ }
+ m[i] = d;
+ return m;
+ }
+ function d3_svg_lineMonotoneTangents(points) {
+ var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
+ while (++i < j) {
+ d = d3_svg_lineSlope(points[i], points[i + 1]);
+ if (Math.abs(d) < 1e-6) {
+ m[i] = m[i + 1] = 0;
+ } else {
+ a = m[i] / d;
+ b = m[i + 1] / d;
+ s = a * a + b * b;
+ if (s > 9) {
+ s = d * 3 / Math.sqrt(s);
+ m[i] = s * a;
+ m[i + 1] = s * b;
+ }
+ }
+ }
+ i = -1;
+ while (++i <= j) {
+ s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
+ tangents.push([ s || 0, m[i] * s || 0 ]);
+ }
+ return tangents;
+ }
+ function d3_svg_lineMonotone(points) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
+ }
+ function d3_svg_lineRadial(points) {
+ var point, i = -1, n = points.length, r, a;
+ while (++i < n) {
+ point = points[i];
+ r = point[0];
+ a = point[1] + d3_svg_arcOffset;
+ point[0] = r * Math.cos(a);
+ point[1] = r * Math.sin(a);
+ }
+ return points;
+ }
+ function d3_svg_area(projection) {
+ function area(data) {
+ function segment() {
+ segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
+ }
+ var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
+ return x;
+ } : d3_functor(x1), fy1 = y0 === y1 ? function() {
+ return y;
+ } : d3_functor(y1), x, y;
+ while (++i < n) {
+ if (defined.call(this, d = data[i], i)) {
+ points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
+ points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
+ } else if (points0.length) {
+ segment();
+ points0 = [];
+ points1 = [];
+ }
+ }
+ if (points0.length) segment();
+ return segments.length ? segments.join("") : null;
+ }
+ var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
+ area.x = function(_) {
+ if (!arguments.length) return x1;
+ x0 = x1 = _;
+ return area;
+ };
+ area.x0 = function(_) {
+ if (!arguments.length) return x0;
+ x0 = _;
+ return area;
+ };
+ area.x1 = function(_) {
+ if (!arguments.length) return x1;
+ x1 = _;
+ return area;
+ };
+ area.y = function(_) {
+ if (!arguments.length) return y1;
+ y0 = y1 = _;
+ return area;
+ };
+ area.y0 = function(_) {
+ if (!arguments.length) return y0;
+ y0 = _;
+ return area;
+ };
+ area.y1 = function(_) {
+ if (!arguments.length) return y1;
+ y1 = _;
+ return area;
+ };
+ area.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return area;
+ };
+ area.interpolate = function(_) {
+ if (!arguments.length) return interpolateKey;
+ if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
+ interpolateReverse = interpolate.reverse || interpolate;
+ L = interpolate.closed ? "M" : "L";
+ return area;
+ };
+ area.tension = function(_) {
+ if (!arguments.length) return tension;
+ tension = _;
+ return area;
+ };
+ return area;
+ }
+ function d3_svg_chordSource(d) {
+ return d.source;
+ }
+ function d3_svg_chordTarget(d) {
+ return d.target;
+ }
+ function d3_svg_chordRadius(d) {
+ return d.radius;
+ }
+ function d3_svg_chordStartAngle(d) {
+ return d.startAngle;
+ }
+ function d3_svg_chordEndAngle(d) {
+ return d.endAngle;
+ }
+ function d3_svg_diagonalProjection(d) {
+ return [ d.x, d.y ];
+ }
+ function d3_svg_diagonalRadialProjection(projection) {
+ return function() {
+ var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset;
+ return [ r * Math.cos(a), r * Math.sin(a) ];
+ };
+ }
+ function d3_svg_symbolSize() {
+ return 64;
+ }
+ function d3_svg_symbolType() {
+ return "circle";
+ }
+ function d3_svg_symbolCircle(size) {
+ var r = Math.sqrt(size / Math.PI);
+ return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
+ }
+ function d3_svg_axisX(selection, x) {
+ selection.attr("transform", function(d) {
+ return "translate(" + x(d) + ",0)";
+ });
+ }
+ function d3_svg_axisY(selection, y) {
+ selection.attr("transform", function(d) {
+ return "translate(0," + y(d) + ")";
+ });
+ }
+ function d3_svg_axisSubdivide(scale, ticks, m) {
+ subticks = [];
+ if (m && ticks.length > 1) {
+ var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v;
+ while (++i < n) {
+ for (j = m; --j > 0; ) {
+ if ((v = +ticks[i] - j * d) >= extent[0]) {
+ subticks.push(v);
+ }
+ }
+ }
+ for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) {
+ subticks.push(v);
+ }
+ }
+ return subticks;
+ }
+ function d3_behavior_zoomDelta() {
+ if (!d3_behavior_zoomDiv) {
+ d3_behavior_zoomDiv = d3.select("body").append("div").style("visibility", "hidden").style("top", 0).style("height", 0).style("width", 0).style("overflow-y", "scroll").append("div").style("height", "2000px").node().parentNode;
+ }
+ var e = d3.event, delta;
+ try {
+ d3_behavior_zoomDiv.scrollTop = 1e3;
+ d3_behavior_zoomDiv.dispatchEvent(e);
+ delta = 1e3 - d3_behavior_zoomDiv.scrollTop;
+ } catch (error) {
+ delta = e.wheelDelta || -e.detail * 5;
+ }
+ return delta;
+ }
+ function d3_layout_bundlePath(link) {
+ var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];
+ while (start !== lca) {
+ start = start.parent;
+ points.push(start);
+ }
+ var k = points.length;
+ while (end !== lca) {
+ points.splice(k, 0, end);
+ end = end.parent;
+ }
+ return points;
+ }
+ function d3_layout_bundleAncestors(node) {
+ var ancestors = [], parent = node.parent;
+ while (parent != null) {
+ ancestors.push(node);
+ node = parent;
+ parent = parent.parent;
+ }
+ ancestors.push(node);
+ return ancestors;
+ }
+ function d3_layout_bundleLeastCommonAncestor(a, b) {
+ if (a === b) return a;
+ var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;
+ while (aNode === bNode) {
+ sharedNode = aNode;
+ aNode = aNodes.pop();
+ bNode = bNodes.pop();
+ }
+ return sharedNode;
+ }
+ function d3_layout_forceDragstart(d) {
+ d.fixed |= 2;
+ }
+ function d3_layout_forceDragend(d) {
+ d.fixed &= 1;
+ }
+ function d3_layout_forceMouseover(d) {
+ d.fixed |= 4;
+ }
+ function d3_layout_forceMouseout(d) {
+ d.fixed &= 3;
+ }
+ function d3_layout_forceAccumulate(quad, alpha, charges) {
+ var cx = 0, cy = 0;
+ quad.charge = 0;
+ if (!quad.leaf) {
+ var nodes = quad.nodes, n = nodes.length, i = -1, c;
+ while (++i < n) {
+ c = nodes[i];
+ if (c == null) continue;
+ d3_layout_forceAccumulate(c, alpha, charges);
+ quad.charge += c.charge;
+ cx += c.charge * c.cx;
+ cy += c.charge * c.cy;
+ }
+ }
+ if (quad.point) {
+ if (!quad.leaf) {
+ quad.point.x += Math.random() - .5;
+ quad.point.y += Math.random() - .5;
+ }
+ var k = alpha * charges[quad.point.index];
+ quad.charge += quad.pointCharge = k;
+ cx += k * quad.point.x;
+ cy += k * quad.point.y;
+ }
+ quad.cx = cx / quad.charge;
+ quad.cy = cy / quad.charge;
+ }
+ function d3_layout_forceLinkDistance(link) {
+ return 20;
+ }
+ function d3_layout_forceLinkStrength(link) {
+ return 1;
+ }
+ function d3_layout_stackX(d) {
+ return d.x;
+ }
+ function d3_layout_stackY(d) {
+ return d.y;
+ }
+ function d3_layout_stackOut(d, y0, y) {
+ d.y0 = y0;
+ d.y = y;
+ }
+ function d3_layout_stackOrderDefault(data) {
+ return d3.range(data.length);
+ }
+ function d3_layout_stackOffsetZero(data) {
+ var j = -1, m = data[0].length, y0 = [];
+ while (++j < m) y0[j] = 0;
+ return y0;
+ }
+ function d3_layout_stackMaxIndex(array) {
+ var i = 1, j = 0, v = array[0][1], k, n = array.length;
+ for (; i < n; ++i) {
+ if ((k = array[i][1]) > v) {
+ j = i;
+ v = k;
+ }
+ }
+ return j;
+ }
+ function d3_layout_stackReduceSum(d) {
+ return d.reduce(d3_layout_stackSum, 0);
+ }
+ function d3_layout_stackSum(p, d) {
+ return p + d[1];
+ }
+ function d3_layout_histogramBinSturges(range, values) {
+ return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
+ }
+ function d3_layout_histogramBinFixed(range, n) {
+ var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];
+ while (++x <= n) f[x] = m * x + b;
+ return f;
+ }
+ function d3_layout_histogramRange(values) {
+ return [ d3.min(values), d3.max(values) ];
+ }
+ function d3_layout_hierarchyRebind(object, hierarchy) {
+ d3.rebind(object, hierarchy, "sort", "children", "value");
+ object.links = d3_layout_hierarchyLinks;
+ object.nodes = function(d) {
+ d3_layout_hierarchyInline = true;
+ return (object.nodes = object)(d);
+ };
+ return object;
+ }
+ function d3_layout_hierarchyChildren(d) {
+ return d.children;
+ }
+ function d3_layout_hierarchyValue(d) {
+ return d.value;
+ }
+ function d3_layout_hierarchySort(a, b) {
+ return b.value - a.value;
+ }
+ function d3_layout_hierarchyLinks(nodes) {
+ return d3.merge(nodes.map(function(parent) {
+ return (parent.children || []).map(function(child) {
+ return {
+ source: parent,
+ target: child
+ };
+ });
+ }));
+ }
+ function d3_layout_packSort(a, b) {
+ return a.value - b.value;
+ }
+ function d3_layout_packInsert(a, b) {
+ var c = a._pack_next;
+ a._pack_next = b;
+ b._pack_prev = a;
+ b._pack_next = c;
+ c._pack_prev = b;
+ }
+ function d3_layout_packSplice(a, b) {
+ a._pack_next = b;
+ b._pack_prev = a;
+ }
+ function d3_layout_packIntersects(a, b) {
+ var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;
+ return dr * dr - dx * dx - dy * dy > .001;
+ }
+ function d3_layout_packSiblings(node) {
+ function bound(node) {
+ xMin = Math.min(node.x - node.r, xMin);
+ xMax = Math.max(node.x + node.r, xMax);
+ yMin = Math.min(node.y - node.r, yMin);
+ yMax = Math.max(node.y + node.r, yMax);
+ }
+ if (!(nodes = node.children) || !(n = nodes.length)) return;
+ var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;
+ nodes.forEach(d3_layout_packLink);
+ a = nodes[0];
+ a.x = -a.r;
+ a.y = 0;
+ bound(a);
+ if (n > 1) {
+ b = nodes[1];
+ b.x = b.r;
+ b.y = 0;
+ bound(b);
+ if (n > 2) {
+ c = nodes[2];
+ d3_layout_packPlace(a, b, c);
+ bound(c);
+ d3_layout_packInsert(a, c);
+ a._pack_prev = c;
+ d3_layout_packInsert(c, b);
+ b = a._pack_next;
+ for (i = 3; i < n; i++) {
+ d3_layout_packPlace(a, b, c = nodes[i]);
+ var isect = 0, s1 = 1, s2 = 1;
+ for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
+ if (d3_layout_packIntersects(j, c)) {
+ isect = 1;
+ break;
+ }
+ }
+ if (isect == 1) {
+ for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
+ if (d3_layout_packIntersects(k, c)) {
+ break;
+ }
+ }
+ }
+ if (isect) {
+ if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);
+ i--;
+ } else {
+ d3_layout_packInsert(a, c);
+ b = c;
+ bound(c);
+ }
+ }
+ }
+ }
+ var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;
+ for (i = 0; i < n; i++) {
+ c = nodes[i];
+ c.x -= cx;
+ c.y -= cy;
+ cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));
+ }
+ node.r = cr;
+ nodes.forEach(d3_layout_packUnlink);
+ }
+ function d3_layout_packLink(node) {
+ node._pack_next = node._pack_prev = node;
+ }
+ function d3_layout_packUnlink(node) {
+ delete node._pack_next;
+ delete node._pack_prev;
+ }
+ function d3_layout_packTransform(node, x, y, k) {
+ var children = node.children;
+ node.x = x += k * node.x;
+ node.y = y += k * node.y;
+ node.r *= k;
+ if (children) {
+ var i = -1, n = children.length;
+ while (++i < n) d3_layout_packTransform(children[i], x, y, k);
+ }
+ }
+ function d3_layout_packPlace(a, b, c) {
+ var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;
+ if (db && (dx || dy)) {
+ var da = b.r + c.r, dc = dx * dx + dy * dy;
+ da *= da;
+ db *= db;
+ var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
+ c.x = a.x + x * dx + y * dy;
+ c.y = a.y + x * dy - y * dx;
+ } else {
+ c.x = a.x + db;
+ c.y = a.y;
+ }
+ }
+ function d3_layout_clusterY(children) {
+ return 1 + d3.max(children, function(child) {
+ return child.y;
+ });
+ }
+ function d3_layout_clusterX(children) {
+ return children.reduce(function(x, child) {
+ return x + child.x;
+ }, 0) / children.length;
+ }
+ function d3_layout_clusterLeft(node) {
+ var children = node.children;
+ return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
+ }
+ function d3_layout_clusterRight(node) {
+ var children = node.children, n;
+ return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
+ }
+ function d3_layout_treeSeparation(a, b) {
+ return a.parent == b.parent ? 1 : 2;
+ }
+ function d3_layout_treeLeft(node) {
+ var children = node.children;
+ return children && children.length ? children[0] : node._tree.thread;
+ }
+ function d3_layout_treeRight(node) {
+ var children = node.children, n;
+ return children && (n = children.length) ? children[n - 1] : node._tree.thread;
+ }
+ function d3_layout_treeSearch(node, compare) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child, n, i = -1;
+ while (++i < n) {
+ if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
+ node = child;
+ }
+ }
+ }
+ return node;
+ }
+ function d3_layout_treeRightmost(a, b) {
+ return a.x - b.x;
+ }
+ function d3_layout_treeLeftmost(a, b) {
+ return b.x - a.x;
+ }
+ function d3_layout_treeDeepest(a, b) {
+ return a.depth - b.depth;
+ }
+ function d3_layout_treeVisitAfter(node, callback) {
+ function visit(node, previousSibling) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child, previousChild = null, i = -1, n;
+ while (++i < n) {
+ child = children[i];
+ visit(child, previousChild);
+ previousChild = child;
+ }
+ }
+ callback(node, previousSibling);
+ }
+ visit(node, null);
+ }
+ function d3_layout_treeShift(node) {
+ var shift = 0, change = 0, children = node.children, i = children.length, child;
+ while (--i >= 0) {
+ child = children[i]._tree;
+ child.prelim += shift;
+ child.mod += shift;
+ shift += child.shift + (change += child.change);
+ }
+ }
+ function d3_layout_treeMove(ancestor, node, shift) {
+ ancestor = ancestor._tree;
+ node = node._tree;
+ var change = shift / (node.number - ancestor.number);
+ ancestor.change += change;
+ node.change -= change;
+ node.shift += shift;
+ node.prelim += shift;
+ node.mod += shift;
+ }
+ function d3_layout_treeAncestor(vim, node, ancestor) {
+ return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor;
+ }
+ function d3_layout_treemapPadNull(node) {
+ return {
+ x: node.x,
+ y: node.y,
+ dx: node.dx,
+ dy: node.dy
+ };
+ }
+ function d3_layout_treemapPad(node, padding) {
+ var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2];
+ if (dx < 0) {
+ x += dx / 2;
+ dx = 0;
+ }
+ if (dy < 0) {
+ y += dy / 2;
+ dy = 0;
+ }
+ return {
+ x: x,
+ y: y,
+ dx: dx,
+ dy: dy
+ };
+ }
+ function d3_dsv(delimiter, mimeType) {
+ function dsv(url, callback) {
+ d3.text(url, mimeType, function(text) {
+ callback(text && dsv.parse(text));
+ });
+ }
+ function formatRow(row) {
+ return row.map(formatValue).join(delimiter);
+ }
+ function formatValue(text) {
+ return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text;
+ }
+ var reParse = new RegExp("\r\n|[" + delimiter + "\r\n]", "g"), reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
+ dsv.parse = function(text) {
+ var header;
+ return dsv.parseRows(text, function(row, i) {
+ if (i) {
+ var o = {}, j = -1, m = header.length;
+ while (++j < m) o[header[j]] = row[j];
+ return o;
+ } else {
+ header = row;
+ return null;
+ }
+ });
+ };
+ dsv.parseRows = function(text, f) {
+ function token() {
+ if (reParse.lastIndex >= text.length) return EOF;
+ if (eol) {
+ eol = false;
+ return EOL;
+ }
+ var j = reParse.lastIndex;
+ if (text.charCodeAt(j) === 34) {
+ var i = j;
+ while (i++ < text.length) {
+ if (text.charCodeAt(i) === 34) {
+ if (text.charCodeAt(i + 1) !== 34) break;
+ i++;
+ }
+ }
+ reParse.lastIndex = i + 2;
+ var c = text.charCodeAt(i + 1);
+ if (c === 13) {
+ eol = true;
+ if (text.charCodeAt(i + 2) === 10) reParse.lastIndex++;
+ } else if (c === 10) {
+ eol = true;
+ }
+ return text.substring(j + 1, i).replace(/""/g, '"');
+ }
+ var m = reParse.exec(text);
+ if (m) {
+ eol = m[0].charCodeAt(0) !== delimiterCode;
+ return text.substring(j, m.index);
+ }
+ reParse.lastIndex = text.length;
+ return text.substring(j);
+ }
+ var EOL = {}, EOF = {}, rows = [], n = 0, t, eol;
+ reParse.lastIndex = 0;
+ while ((t = token()) !== EOF) {
+ var a = [];
+ while (t !== EOL && t !== EOF) {
+ a.push(t);
+ t = token();
+ }
+ if (f && !(a = f(a, n++))) continue;
+ rows.push(a);
+ }
+ return rows;
+ };
+ dsv.format = function(rows) {
+ return rows.map(formatRow).join("\n");
+ };
+ return dsv;
+ }
+ function d3_geo_type(types, defaultValue) {
+ return function(object) {
+ return object && types.hasOwnProperty(object.type) ? types[object.type](object) : defaultValue;
+ };
+ }
+ function d3_path_circle(radius) {
+ return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z";
+ }
+ function d3_geo_bounds(o, f) {
+ if (d3_geo_boundsTypes.hasOwnProperty(o.type)) d3_geo_boundsTypes[o.type](o, f);
+ }
+ function d3_geo_boundsFeature(o, f) {
+ d3_geo_bounds(o.geometry, f);
+ }
+ function d3_geo_boundsFeatureCollection(o, f) {
+ for (var a = o.features, i = 0, n = a.length; i < n; i++) {
+ d3_geo_bounds(a[i].geometry, f);
+ }
+ }
+ function d3_geo_boundsGeometryCollection(o, f) {
+ for (var a = o.geometries, i = 0, n = a.length; i < n; i++) {
+ d3_geo_bounds(a[i], f);
+ }
+ }
+ function d3_geo_boundsLineString(o, f) {
+ for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
+ f.apply(null, a[i]);
+ }
+ }
+ function d3_geo_boundsMultiLineString(o, f) {
+ for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
+ for (var b = a[i], j = 0, m = b.length; j < m; j++) {
+ f.apply(null, b[j]);
+ }
+ }
+ }
+ function d3_geo_boundsMultiPolygon(o, f) {
+ for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
+ for (var b = a[i][0], j = 0, m = b.length; j < m; j++) {
+ f.apply(null, b[j]);
+ }
+ }
+ }
+ function d3_geo_boundsPoint(o, f) {
+ f.apply(null, o.coordinates);
+ }
+ function d3_geo_boundsPolygon(o, f) {
+ for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) {
+ f.apply(null, a[i]);
+ }
+ }
+ function d3_geo_greatArcSource(d) {
+ return d.source;
+ }
+ function d3_geo_greatArcTarget(d) {
+ return d.target;
+ }
+ function d3_geo_greatArcInterpolator() {
+ function interpolate(t) {
+ var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;
+ return [ Math.atan2(y, x) / d3_geo_radians, Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians ];
+ }
+ var x0, y0, cy0, sy0, kx0, ky0, x1, y1, cy1, sy1, kx1, ky1, d, k;
+ interpolate.distance = function() {
+ if (d == null) k = 1 / Math.sin(d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))));
+ return d;
+ };
+ interpolate.source = function(_) {
+ var cx0 = Math.cos(x0 = _[0] * d3_geo_radians), sx0 = Math.sin(x0);
+ cy0 = Math.cos(y0 = _[1] * d3_geo_radians);
+ sy0 = Math.sin(y0);
+ kx0 = cy0 * cx0;
+ ky0 = cy0 * sx0;
+ d = null;
+ return interpolate;
+ };
+ interpolate.target = function(_) {
+ var cx1 = Math.cos(x1 = _[0] * d3_geo_radians), sx1 = Math.sin(x1);
+ cy1 = Math.cos(y1 = _[1] * d3_geo_radians);
+ sy1 = Math.sin(y1);
+ kx1 = cy1 * cx1;
+ ky1 = cy1 * sx1;
+ d = null;
+ return interpolate;
+ };
+ return interpolate;
+ }
+ function d3_geo_greatArcInterpolate(a, b) {
+ var i = d3_geo_greatArcInterpolator().source(a).target(b);
+ i.distance();
+ return i;
+ }
+ function d3_geom_contourStart(grid) {
+ var x = 0, y = 0;
+ while (true) {
+ if (grid(x, y)) {
+ return [ x, y ];
+ }
+ if (x === 0) {
+ x = y + 1;
+ y = 0;
+ } else {
+ x = x - 1;
+ y = y + 1;
+ }
+ }
+ }
+ function d3_geom_hullCCW(i1, i2, i3, v) {
+ var t, a, b, c, d, e, f;
+ t = v[i1];
+ a = t[0];
+ b = t[1];
+ t = v[i2];
+ c = t[0];
+ d = t[1];
+ t = v[i3];
+ e = t[0];
+ f = t[1];
+ return (f - b) * (c - a) - (d - b) * (e - a) > 0;
+ }
+ function d3_geom_polygonInside(p, a, b) {
+ return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
+ }
+ function d3_geom_polygonIntersect(c, d, a, b) {
+ var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], x13 = x1 - x3, x21 = x2 - x1, x43 = x4 - x3, y13 = y1 - y3, y21 = y2 - y1, y43 = y4 - y3, ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21);
+ return [ x1 + ua * x21, y1 + ua * y21 ];
+ }
+ function d3_voronoi_tessellate(vertices, callback) {
+ var Sites = {
+ list: vertices.map(function(v, i) {
+ return {
+ index: i,
+ x: v[0],
+ y: v[1]
+ };
+ }).sort(function(a, b) {
+ return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0;
+ }),
+ bottomSite: null
+ };
+ var EdgeList = {
+ list: [],
+ leftEnd: null,
+ rightEnd: null,
+ init: function() {
+ EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.leftEnd.r = EdgeList.rightEnd;
+ EdgeList.rightEnd.l = EdgeList.leftEnd;
+ EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
+ },
+ createHalfEdge: function(edge, side) {
+ return {
+ edge: edge,
+ side: side,
+ vertex: null,
+ l: null,
+ r: null
+ };
+ },
+ insert: function(lb, he) {
+ he.l = lb;
+ he.r = lb.r;
+ lb.r.l = he;
+ lb.r = he;
+ },
+ leftBound: function(p) {
+ var he = EdgeList.leftEnd;
+ do {
+ he = he.r;
+ } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
+ he = he.l;
+ return he;
+ },
+ del: function(he) {
+ he.l.r = he.r;
+ he.r.l = he.l;
+ he.edge = null;
+ },
+ right: function(he) {
+ return he.r;
+ },
+ left: function(he) {
+ return he.l;
+ },
+ leftRegion: function(he) {
+ return he.edge == null ? Sites.bottomSite : he.edge.region[he.side];
+ },
+ rightRegion: function(he) {
+ return he.edge == null ? Sites.bottomSite : he.edge.region[d3_voronoi_opposite[he.side]];
+ }
+ };
+ var Geom = {
+ bisect: function(s1, s2) {
+ var newEdge = {
+ region: {
+ l: s1,
+ r: s2
+ },
+ ep: {
+ l: null,
+ r: null
+ }
+ };
+ var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy;
+ newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5;
+ if (adx > ady) {
+ newEdge.a = 1;
+ newEdge.b = dy / dx;
+ newEdge.c /= dx;
+ } else {
+ newEdge.b = 1;
+ newEdge.a = dx / dy;
+ newEdge.c /= dy;
+ }
+ return newEdge;
+ },
+ intersect: function(el1, el2) {
+ var e1 = el1.edge, e2 = el2.edge;
+ if (!e1 || !e2 || e1.region.r == e2.region.r) {
+ return null;
+ }
+ var d = e1.a * e2.b - e1.b * e2.a;
+ if (Math.abs(d) < 1e-10) {
+ return null;
+ }
+ var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e;
+ if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) {
+ el = el1;
+ e = e1;
+ } else {
+ el = el2;
+ e = e2;
+ }
+ var rightOfSite = xint >= e.region.r.x;
+ if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") {
+ return null;
+ }
+ return {
+ x: xint,
+ y: yint
+ };
+ },
+ rightOf: function(he, p) {
+ var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x;
+ if (rightOfSite && he.side === "l") {
+ return 1;
+ }
+ if (!rightOfSite && he.side === "r") {
+ return 0;
+ }
+ if (e.a === 1) {
+ var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0;
+ if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) {
+ above = fast = dyp >= e.b * dxp;
+ } else {
+ above = p.x + p.y * e.b > e.c;
+ if (e.b < 0) {
+ above = !above;
+ }
+ if (!above) {
+ fast = 1;
+ }
+ }
+ if (!fast) {
+ var dxs = topsite.x - e.region.l.x;
+ above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b);
+ if (e.b < 0) {
+ above = !above;
+ }
+ }
+ } else {
+ var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y;
+ above = t1 * t1 > t2 * t2 + t3 * t3;
+ }
+ return he.side === "l" ? above : !above;
+ },
+ endPoint: function(edge, side, site) {
+ edge.ep[side] = site;
+ if (!edge.ep[d3_voronoi_opposite[side]]) return;
+ callback(edge);
+ },
+ distance: function(s, t) {
+ var dx = s.x - t.x, dy = s.y - t.y;
+ return Math.sqrt(dx * dx + dy * dy);
+ }
+ };
+ var EventQueue = {
+ list: [],
+ insert: function(he, site, offset) {
+ he.vertex = site;
+ he.ystar = site.y + offset;
+ for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) {
+ var next = list[i];
+ if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ list.splice(i, 0, he);
+ },
+ del: function(he) {
+ for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {}
+ ls.splice(i, 1);
+ },
+ empty: function() {
+ return EventQueue.list.length === 0;
+ },
+ nextEvent: function(he) {
+ for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) {
+ if (ls[i] == he) return ls[i + 1];
+ }
+ return null;
+ },
+ min: function() {
+ var elem = EventQueue.list[0];
+ return {
+ x: elem.vertex.x,
+ y: elem.ystar
+ };
+ },
+ extractMin: function() {
+ return EventQueue.list.shift();
+ }
+ };
+ EdgeList.init();
+ Sites.bottomSite = Sites.list.shift();
+ var newSite = Sites.list.shift(), newIntStar;
+ var lbnd, rbnd, llbnd, rrbnd, bisector;
+ var bot, top, temp, p, v;
+ var e, pm;
+ while (true) {
+ if (!EventQueue.empty()) {
+ newIntStar = EventQueue.min();
+ }
+ if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) {
+ lbnd = EdgeList.leftBound(newSite);
+ rbnd = EdgeList.right(lbnd);
+ bot = EdgeList.rightRegion(lbnd);
+ e = Geom.bisect(bot, newSite);
+ bisector = EdgeList.createHalfEdge(e, "l");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(lbnd, bisector);
+ if (p) {
+ EventQueue.del(lbnd);
+ EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
+ }
+ lbnd = bisector;
+ bisector = EdgeList.createHalfEdge(e, "r");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(bisector, rbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, newSite));
+ }
+ newSite = Sites.list.shift();
+ } else if (!EventQueue.empty()) {
+ lbnd = EventQueue.extractMin();
+ llbnd = EdgeList.left(lbnd);
+ rbnd = EdgeList.right(lbnd);
+ rrbnd = EdgeList.right(rbnd);
+ bot = EdgeList.leftRegion(lbnd);
+ top = EdgeList.rightRegion(rbnd);
+ v = lbnd.vertex;
+ Geom.endPoint(lbnd.edge, lbnd.side, v);
+ Geom.endPoint(rbnd.edge, rbnd.side, v);
+ EdgeList.del(lbnd);
+ EventQueue.del(rbnd);
+ EdgeList.del(rbnd);
+ pm = "l";
+ if (bot.y > top.y) {
+ temp = bot;
+ bot = top;
+ top = temp;
+ pm = "r";
+ }
+ e = Geom.bisect(bot, top);
+ bisector = EdgeList.createHalfEdge(e, pm);
+ EdgeList.insert(llbnd, bisector);
+ Geom.endPoint(e, d3_voronoi_opposite[pm], v);
+ p = Geom.intersect(llbnd, bisector);
+ if (p) {
+ EventQueue.del(llbnd);
+ EventQueue.insert(llbnd, p, Geom.distance(p, bot));
+ }
+ p = Geom.intersect(bisector, rrbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, bot));
+ }
+ } else {
+ break;
+ }
+ }
+ for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) {
+ callback(lbnd.edge);
+ }
+ }
+ function d3_geom_quadtreeNode() {
+ return {
+ leaf: true,
+ nodes: [],
+ point: null
+ };
+ }
+ function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
+ if (!f(node, x1, y1, x2, y2)) {
+ var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;
+ if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
+ if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
+ if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
+ if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
+ }
+ }
+ function d3_geom_quadtreePoint(p) {
+ return {
+ x: p[0],
+ y: p[1]
+ };
+ }
+ function d3_time_utc() {
+ this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);
+ }
+ function d3_time_formatAbbreviate(name) {
+ return name.substring(0, 3);
+ }
+ function d3_time_parse(date, template, string, j) {
+ var c, p, i = 0, n = template.length, m = string.length;
+ while (i < n) {
+ if (j >= m) return -1;
+ c = template.charCodeAt(i++);
+ if (c == 37) {
+ p = d3_time_parsers[template.charAt(i++)];
+ if (!p || (j = p(date, string, j)) < 0) return -1;
+ } else if (c != string.charCodeAt(j++)) {
+ return -1;
+ }
+ }
+ return j;
+ }
+ function d3_time_formatRe(names) {
+ return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i");
+ }
+ function d3_time_formatLookup(names) {
+ var map = new d3_Map, i = -1, n = names.length;
+ while (++i < n) map.set(names[i].toLowerCase(), i);
+ return map;
+ }
+ function d3_time_parseWeekdayAbbrev(date, string, i) {
+ d3_time_dayAbbrevRe.lastIndex = 0;
+ var n = d3_time_dayAbbrevRe.exec(string.substring(i));
+ return n ? i += n[0].length : -1;
+ }
+ function d3_time_parseWeekday(date, string, i) {
+ d3_time_dayRe.lastIndex = 0;
+ var n = d3_time_dayRe.exec(string.substring(i));
+ return n ? i += n[0].length : -1;
+ }
+ function d3_time_parseMonthAbbrev(date, string, i) {
+ d3_time_monthAbbrevRe.lastIndex = 0;
+ var n = d3_time_monthAbbrevRe.exec(string.substring(i));
+ return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
+ }
+ function d3_time_parseMonth(date, string, i) {
+ d3_time_monthRe.lastIndex = 0;
+ var n = d3_time_monthRe.exec(string.substring(i));
+ return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
+ }
+ function d3_time_parseLocaleFull(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
+ }
+ function d3_time_parseLocaleDate(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
+ }
+ function d3_time_parseLocaleTime(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
+ }
+ function d3_time_parseFullYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 4));
+ return n ? (date.y = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1;
+ }
+ function d3_time_expandYear(d) {
+ return d + (d > 68 ? 1900 : 2e3);
+ }
+ function d3_time_parseMonthNumber(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.m = n[0] - 1, i += n[0].length) : -1;
+ }
+ function d3_time_parseDay(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.d = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseHour24(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.H = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseMinutes(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.M = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseSeconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.S = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseMilliseconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 3));
+ return n ? (date.L = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseAmPm(date, string, i) {
+ var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
+ return n == null ? -1 : (date.p = n, i);
+ }
+ function d3_time_zone(d) {
+ var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60;
+ return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm);
+ }
+ function d3_time_formatIsoNative(date) {
+ return date.toISOString();
+ }
+ function d3_time_interval(local, step, number) {
+ function round(date) {
+ var d0 = local(date), d1 = offset(d0, 1);
+ return date - d0 < d1 - date ? d0 : d1;
+ }
+ function ceil(date) {
+ step(date = local(new d3_time(date - 1)), 1);
+ return date;
+ }
+ function offset(date, k) {
+ step(date = new d3_time(+date), k);
+ return date;
+ }
+ function range(t0, t1, dt) {
+ var time = ceil(t0), times = [];
+ if (dt > 1) {
+ while (time < t1) {
+ if (!(number(time) % dt)) times.push(new Date(+time));
+ step(time, 1);
+ }
+ } else {
+ while (time < t1) times.push(new Date(+time)), step(time, 1);
+ }
+ return times;
+ }
+ function range_utc(t0, t1, dt) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time_utc;
+ utc._ = t0;
+ return range(utc, t1, dt);
+ } finally {
+ d3_time = Date;
+ }
+ }
+ local.floor = local;
+ local.round = round;
+ local.ceil = ceil;
+ local.offset = offset;
+ local.range = range;
+ var utc = local.utc = d3_time_interval_utc(local);
+ utc.floor = utc;
+ utc.round = d3_time_interval_utc(round);
+ utc.ceil = d3_time_interval_utc(ceil);
+ utc.offset = d3_time_interval_utc(offset);
+ utc.range = range_utc;
+ return local;
+ }
+ function d3_time_interval_utc(method) {
+ return function(date, k) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time_utc;
+ utc._ = date;
+ return method(utc, k)._;
+ } finally {
+ d3_time = Date;
+ }
+ };
+ }
+ function d3_time_scale(linear, methods, format) {
+ function scale(x) {
+ return linear(x);
+ }
+ scale.invert = function(x) {
+ return d3_time_scaleDate(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
+ linear.domain(x);
+ return scale;
+ };
+ scale.nice = function(m) {
+ return scale.domain(d3_scale_nice(scale.domain(), function() {
+ return m;
+ }));
+ };
+ scale.ticks = function(m, k) {
+ var extent = d3_time_scaleExtent(scale.domain());
+ if (typeof m !== "function") {
+ var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target);
+ if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
+ if (!i) return linear.ticks(m).map(d3_time_scaleDate);
+ if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
+ m = methods[i];
+ k = m[1];
+ m = m[0].range;
+ }
+ return m(extent[0], new Date(+extent[1] + 1), k);
+ };
+ scale.tickFormat = function() {
+ return format;
+ };
+ scale.copy = function() {
+ return d3_time_scale(linear.copy(), methods, format);
+ };
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+ }
+ function d3_time_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [ start, stop ] : [ stop, start ];
+ }
+ function d3_time_scaleDate(t) {
+ return new Date(t);
+ }
+ function d3_time_scaleFormat(formats) {
+ return function(date) {
+ var i = formats.length - 1, f = formats[i];
+ while (!f[1](date)) f = formats[--i];
+ return f[0](date);
+ };
+ }
+ function d3_time_scaleSetYear(y) {
+ var d = new Date(y, 0, 1);
+ d.setFullYear(y);
+ return d;
+ }
+ function d3_time_scaleGetYear(d) {
+ var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1);
+ return y + (d - d0) / (d1 - d0);
+ }
+ function d3_time_scaleUTCSetYear(y) {
+ var d = new Date(Date.UTC(y, 0, 1));
+ d.setUTCFullYear(y);
+ return d;
+ }
+ function d3_time_scaleUTCGetYear(d) {
+ var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1);
+ return y + (d - d0) / (d1 - d0);
+ }
+ if (!Date.now) Date.now = function() {
+ return +(new Date);
+ };
+ try {
+ document.createElement("div").style.setProperty("opacity", 0, "");
+ } catch (error) {
+ var d3_style_prototype = CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
+ d3_style_prototype.setProperty = function(name, value, priority) {
+ d3_style_setProperty.call(this, name, value + "", priority);
+ };
+ }
+ d3 = {
+ version: "2.10.2"
+ };
+ var d3_array = d3_arraySlice;
+ try {
+ d3_array(document.documentElement.childNodes)[0].nodeType;
+ } catch (e) {
+ d3_array = d3_arrayCopy;
+ }
+ var d3_arraySubclass = [].__proto__ ? function(array, prototype) {
+ array.__proto__ = prototype;
+ } : function(array, prototype) {
+ for (var property in prototype) array[property] = prototype[property];
+ };
+ d3.map = function(object) {
+ var map = new d3_Map;
+ for (var key in object) map.set(key, object[key]);
+ return map;
+ };
+ d3_class(d3_Map, {
+ has: function(key) {
+ return d3_map_prefix + key in this;
+ },
+ get: function(key) {
+ return this[d3_map_prefix + key];
+ },
+ set: function(key, value) {
+ return this[d3_map_prefix + key] = value;
+ },
+ remove: function(key) {
+ key = d3_map_prefix + key;
+ return key in this && delete this[key];
+ },
+ keys: function() {
+ var keys = [];
+ this.forEach(function(key) {
+ keys.push(key);
+ });
+ return keys;
+ },
+ values: function() {
+ var values = [];
+ this.forEach(function(key, value) {
+ values.push(value);
+ });
+ return values;
+ },
+ entries: function() {
+ var entries = [];
+ this.forEach(function(key, value) {
+ entries.push({
+ key: key,
+ value: value
+ });
+ });
+ return entries;
+ },
+ forEach: function(f) {
+ for (var key in this) {
+ if (key.charCodeAt(0) === d3_map_prefixCode) {
+ f.call(this, key.substring(1), this[key]);
+ }
+ }
+ }
+ });
+ var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
+ d3.functor = d3_functor;
+ d3.rebind = function(target, source) {
+ var i = 1, n = arguments.length, method;
+ while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
+ return target;
+ };
+ d3.ascending = function(a, b) {
+ return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
+ };
+ d3.descending = function(a, b) {
+ return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
+ };
+ d3.mean = function(array, f) {
+ var n = array.length, a, m = 0, i = -1, j = 0;
+ if (arguments.length === 1) {
+ while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
+ } else {
+ while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
+ }
+ return j ? m : undefined;
+ };
+ d3.median = function(array, f) {
+ if (arguments.length > 1) array = array.map(f);
+ array = array.filter(d3_number);
+ return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
+ };
+ d3.min = function(array, f) {
+ var i = -1, n = array.length, a, b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && a > b) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
+ }
+ return a;
+ };
+ d3.max = function(array, f) {
+ var i = -1, n = array.length, a, b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && b > a) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
+ }
+ return a;
+ };
+ d3.extent = function(array, f) {
+ var i = -1, n = array.length, a, b, c;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
+ while (++i < n) if ((b = array[i]) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ } else {
+ while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ }
+ return [ a, c ];
+ };
+ d3.random = {
+ normal: function(µ, σ) {
+ var n = arguments.length;
+ if (n < 2) σ = 1;
+ if (n < 1) µ = 0;
+ return function() {
+ var x, y, r;
+ do {
+ x = Math.random() * 2 - 1;
+ y = Math.random() * 2 - 1;
+ r = x * x + y * y;
+ } while (!r || r > 1);
+ return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
+ };
+ },
+ logNormal: function(µ, σ) {
+ var n = arguments.length;
+ if (n < 2) σ = 1;
+ if (n < 1) µ = 0;
+ var random = d3.random.normal();
+ return function() {
+ return Math.exp(µ + σ * random());
+ };
+ },
+ irwinHall: function(m) {
+ return function() {
+ for (var s = 0, j = 0; j < m; j++) s += Math.random();
+ return s / m;
+ };
+ }
+ };
+ d3.sum = function(array, f) {
+ var s = 0, n = array.length, a, i = -1;
+ if (arguments.length === 1) {
+ while (++i < n) if (!isNaN(a = +array[i])) s += a;
+ } else {
+ while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
+ }
+ return s;
+ };
+ d3.quantile = function(values, p) {
+ var H = (values.length - 1) * p + 1, h = Math.floor(H), v = values[h - 1], e = H - h;
+ return e ? v + e * (values[h] - v) : v;
+ };
+ d3.transpose = function(matrix) {
+ return d3.zip.apply(d3, matrix);
+ };
+ d3.zip = function() {
+ if (!(n = arguments.length)) return [];
+ for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) {
+ for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) {
+ zip[j] = arguments[j][i];
+ }
+ }
+ return zips;
+ };
+ d3.bisector = function(f) {
+ return {
+ left: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >>> 1;
+ if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid;
+ }
+ return lo;
+ },
+ right: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >>> 1;
+ if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1;
+ }
+ return lo;
+ }
+ };
+ };
+ var d3_bisector = d3.bisector(function(d) {
+ return d;
+ });
+ d3.bisectLeft = d3_bisector.left;
+ d3.bisect = d3.bisectRight = d3_bisector.right;
+ d3.first = function(array, f) {
+ var i = 0, n = array.length, a = array[0], b;
+ if (arguments.length === 1) f = d3.ascending;
+ while (++i < n) {
+ if (f.call(array, a, b = array[i]) > 0) {
+ a = b;
+ }
+ }
+ return a;
+ };
+ d3.last = function(array, f) {
+ var i = 0, n = array.length, a = array[0], b;
+ if (arguments.length === 1) f = d3.ascending;
+ while (++i < n) {
+ if (f.call(array, a, b = array[i]) <= 0) {
+ a = b;
+ }
+ }
+ return a;
+ };
+ d3.nest = function() {
+ function map(array, depth) {
+ if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
+ var i = -1, n = array.length, key = keys[depth++], keyValue, object, valuesByKey = new d3_Map, values, o = {};
+ while (++i < n) {
+ if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
+ values.push(object);
+ } else {
+ valuesByKey.set(keyValue, [ object ]);
+ }
+ }
+ valuesByKey.forEach(function(keyValue, values) {
+ o[keyValue] = map(values, depth);
+ });
+ return o;
+ }
+ function entries(map, depth) {
+ if (depth >= keys.length) return map;
+ var a = [], sortKey = sortKeys[depth++], key;
+ for (key in map) {
+ a.push({
+ key: key,
+ values: entries(map[key], depth)
+ });
+ }
+ if (sortKey) a.sort(function(a, b) {
+ return sortKey(a.key, b.key);
+ });
+ return a;
+ }
+ var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
+ nest.map = function(array) {
+ return map(array, 0);
+ };
+ nest.entries = function(array) {
+ return entries(map(array, 0), 0);
+ };
+ nest.key = function(d) {
+ keys.push(d);
+ return nest;
+ };
+ nest.sortKeys = function(order) {
+ sortKeys[keys.length - 1] = order;
+ return nest;
+ };
+ nest.sortValues = function(order) {
+ sortValues = order;
+ return nest;
+ };
+ nest.rollup = function(f) {
+ rollup = f;
+ return nest;
+ };
+ return nest;
+ };
+ d3.keys = function(map) {
+ var keys = [];
+ for (var key in map) keys.push(key);
+ return keys;
+ };
+ d3.values = function(map) {
+ var values = [];
+ for (var key in map) values.push(map[key]);
+ return values;
+ };
+ d3.entries = function(map) {
+ var entries = [];
+ for (var key in map) entries.push({
+ key: key,
+ value: map[key]
+ });
+ return entries;
+ };
+ d3.permute = function(array, indexes) {
+ var permutes = [], i = -1, n = indexes.length;
+ while (++i < n) permutes[i] = array[indexes[i]];
+ return permutes;
+ };
+ d3.merge = function(arrays) {
+ return Array.prototype.concat.apply([], arrays);
+ };
+ d3.split = function(array, f) {
+ var arrays = [], values = [], value, i = -1, n = array.length;
+ if (arguments.length < 2) f = d3_splitter;
+ while (++i < n) {
+ if (f.call(values, value = array[i], i)) {
+ values = [];
+ } else {
+ if (!values.length) arrays.push(values);
+ values.push(value);
+ }
+ }
+ return arrays;
+ };
+ d3.range = function(start, stop, step) {
+ if (arguments.length < 3) {
+ step = 1;
+ if (arguments.length < 2) {
+ stop = start;
+ start = 0;
+ }
+ }
+ if ((stop - start) / step === Infinity) throw new Error("infinite range");
+ var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j;
+ start *= k, stop *= k, step *= k;
+ if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);
+ return range;
+ };
+ d3.requote = function(s) {
+ return s.replace(d3_requote_re, "\\$&");
+ };
+ var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
+ d3.round = function(x, n) {
+ return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);
+ };
+ d3.xhr = function(url, mime, callback) {
+ var req = new XMLHttpRequest;
+ if (arguments.length < 3) callback = mime, mime = null; else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
+ req.open("GET", url, true);
+ if (mime) req.setRequestHeader("Accept", mime);
+ req.onreadystatechange = function() {
+ if (req.readyState === 4) {
+ var s = req.status;
+ callback(!s && req.response || s >= 200 && s < 300 || s === 304 ? req : null);
+ }
+ };
+ req.send(null);
+ };
+ d3.text = function(url, mime, callback) {
+ function ready(req) {
+ callback(req && req.responseText);
+ }
+ if (arguments.length < 3) {
+ callback = mime;
+ mime = null;
+ }
+ d3.xhr(url, mime, ready);
+ };
+ d3.json = function(url, callback) {
+ d3.text(url, "application/json", function(text) {
+ callback(text ? JSON.parse(text) : null);
+ });
+ };
+ d3.html = function(url, callback) {
+ d3.text(url, "text/html", function(text) {
+ if (text != null) {
+ var range = document.createRange();
+ range.selectNode(document.body);
+ text = range.createContextualFragment(text);
+ }
+ callback(text);
+ });
+ };
+ d3.xml = function(url, mime, callback) {
+ function ready(req) {
+ callback(req && req.responseXML);
+ }
+ if (arguments.length < 3) {
+ callback = mime;
+ mime = null;
+ }
+ d3.xhr(url, mime, ready);
+ };
+ var d3_nsPrefix = {
+ svg: "http://www.w3.org/2000/svg",
+ xhtml: "http://www.w3.org/1999/xhtml",
+ xlink: "http://www.w3.org/1999/xlink",
+ xml: "http://www.w3.org/XML/1998/namespace",
+ xmlns: "http://www.w3.org/2000/xmlns/"
+ };
+ d3.ns = {
+ prefix: d3_nsPrefix,
+ qualify: function(name) {
+ var i = name.indexOf(":"), prefix = name;
+ if (i >= 0) {
+ prefix = name.substring(0, i);
+ name = name.substring(i + 1);
+ }
+ return d3_nsPrefix.hasOwnProperty(prefix) ? {
+ space: d3_nsPrefix[prefix],
+ local: name
+ } : name;
+ }
+ };
+ d3.dispatch = function() {
+ var dispatch = new d3_dispatch, i = -1, n = arguments.length;
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
+ return dispatch;
+ };
+ d3_dispatch.prototype.on = function(type, listener) {
+ var i = type.indexOf("."), name = "";
+ if (i > 0) {
+ name = type.substring(i + 1);
+ type = type.substring(0, i);
+ }
+ return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);
+ };
+ d3.format = function(specifier) {
+ var match = d3_format_re.exec(specifier), fill = match[1] || " ", sign = match[3] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false;
+ if (precision) precision = +precision.substring(1);
+ if (zfill) {
+ fill = "0";
+ if (comma) width -= Math.floor((width - 1) / 4);
+ }
+ switch (type) {
+ case "n":
+ comma = true;
+ type = "g";
+ break;
+ case "%":
+ scale = 100;
+ suffix = "%";
+ type = "f";
+ break;
+ case "p":
+ scale = 100;
+ suffix = "%";
+ type = "r";
+ break;
+ case "d":
+ integer = true;
+ precision = 0;
+ break;
+ case "s":
+ scale = -1;
+ type = "r";
+ break;
+ }
+ if (type == "r" && !precision) type = "g";
+ type = d3_format_types.get(type) || d3_format_typeDefault;
+ return function(value) {
+ if (integer && value % 1) return "";
+ var negative = value < 0 && (value = -value) ? "-" : sign;
+ if (scale < 0) {
+ var prefix = d3.formatPrefix(value, precision);
+ value = prefix.scale(value);
+ suffix = prefix.symbol;
+ } else {
+ value *= scale;
+ }
+ value = type(value, precision);
+ if (zfill) {
+ var length = value.length + negative.length;
+ if (length < width) value = (new Array(width - length + 1)).join(fill) + value;
+ if (comma) value = d3_format_group(value);
+ value = negative + value;
+ } else {
+ if (comma) value = d3_format_group(value);
+ value = negative + value;
+ var length = value.length;
+ if (length < width) value = (new Array(width - length + 1)).join(fill) + value;
+ }
+ return value + suffix;
+ };
+ };
+ var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
+ var d3_format_types = d3.map({
+ g: function(x, p) {
+ return x.toPrecision(p);
+ },
+ e: function(x, p) {
+ return x.toExponential(p);
+ },
+ f: function(x, p) {
+ return x.toFixed(p);
+ },
+ r: function(x, p) {
+ return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p)));
+ }
+ });
+ var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "μ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
+ d3.formatPrefix = function(value, precision) {
+ var i = 0;
+ if (value) {
+ if (value < 0) value *= -1;
+ if (precision) value = d3.round(value, d3_format_precision(value, precision));
+ i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
+ i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
+ }
+ return d3_formatPrefixes[8 + i / 3];
+ };
+ var d3_ease_quad = d3_ease_poly(2), d3_ease_cubic = d3_ease_poly(3), d3_ease_default = function() {
+ return d3_ease_identity;
+ };
+ var d3_ease = d3.map({
+ linear: d3_ease_default,
+ poly: d3_ease_poly,
+ quad: function() {
+ return d3_ease_quad;
+ },
+ cubic: function() {
+ return d3_ease_cubic;
+ },
+ sin: function() {
+ return d3_ease_sin;
+ },
+ exp: function() {
+ return d3_ease_exp;
+ },
+ circle: function() {
+ return d3_ease_circle;
+ },
+ elastic: d3_ease_elastic,
+ back: d3_ease_back,
+ bounce: function() {
+ return d3_ease_bounce;
+ }
+ });
+ var d3_ease_mode = d3.map({
+ "in": d3_ease_identity,
+ out: d3_ease_reverse,
+ "in-out": d3_ease_reflect,
+ "out-in": function(f) {
+ return d3_ease_reflect(d3_ease_reverse(f));
+ }
+ });
+ d3.ease = function(name) {
+ var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in";
+ t = d3_ease.get(t) || d3_ease_default;
+ m = d3_ease_mode.get(m) || d3_ease_identity;
+ return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1))));
+ };
+ d3.event = null;
+ d3.transform = function(string) {
+ var g = document.createElementNS(d3.ns.prefix.svg, "g");
+ return (d3.transform = function(string) {
+ g.setAttribute("transform", string);
+ var t = g.transform.baseVal.consolidate();
+ return new d3_transform(t ? t.matrix : d3_transformIdentity);
+ })(string);
+ };
+ d3_transform.prototype.toString = function() {
+ return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
+ };
+ var d3_transformDegrees = 180 / Math.PI, d3_transformIdentity = {
+ a: 1,
+ b: 0,
+ c: 0,
+ d: 1,
+ e: 0,
+ f: 0
+ };
+ d3.interpolate = function(a, b) {
+ var i = d3.interpolators.length, f;
+ while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;
+ return f;
+ };
+ d3.interpolateNumber = function(a, b) {
+ b -= a;
+ return function(t) {
+ return a + b * t;
+ };
+ };
+ d3.interpolateRound = function(a, b) {
+ b -= a;
+ return function(t) {
+ return Math.round(a + b * t);
+ };
+ };
+ d3.interpolateString = function(a, b) {
+ var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;
+ d3_interpolate_number.lastIndex = 0;
+ for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
+ if (m.index) s.push(b.substring(s0, s1 = m.index));
+ q.push({
+ i: s.length,
+ x: m[0]
+ });
+ s.push(null);
+ s0 = d3_interpolate_number.lastIndex;
+ }
+ if (s0 < b.length) s.push(b.substring(s0));
+ for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
+ o = q[i];
+ if (o.x == m[0]) {
+ if (o.i) {
+ if (s[o.i + 1] == null) {
+ s[o.i - 1] += o.x;
+ s.splice(o.i, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ } else {
+ s[o.i - 1] += o.x + s[o.i + 1];
+ s.splice(o.i, 2);
+ for (j = i + 1; j < n; ++j) q[j].i -= 2;
+ }
+ } else {
+ if (s[o.i + 1] == null) {
+ s[o.i] = o.x;
+ } else {
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ }
+ }
+ q.splice(i, 1);
+ n--;
+ i--;
+ } else {
+ o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
+ }
+ }
+ while (i < n) {
+ o = q.pop();
+ if (s[o.i + 1] == null) {
+ s[o.i] = o.x;
+ } else {
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ }
+ n--;
+ }
+ if (s.length === 1) {
+ return s[0] == null ? q[0].x : function() {
+ return b;
+ };
+ }
+ return function(t) {
+ for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+ };
+ d3.interpolateTransform = function(a, b) {
+ var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale;
+ if (ta[0] != tb[0] || ta[1] != tb[1]) {
+ s.push("translate(", null, ",", null, ")");
+ q.push({
+ i: 1,
+ x: d3.interpolateNumber(ta[0], tb[0])
+ }, {
+ i: 3,
+ x: d3.interpolateNumber(ta[1], tb[1])
+ });
+ } else if (tb[0] || tb[1]) {
+ s.push("translate(" + tb + ")");
+ } else {
+ s.push("");
+ }
+ if (ra != rb) {
+ if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
+ q.push({
+ i: s.push(s.pop() + "rotate(", null, ")") - 2,
+ x: d3.interpolateNumber(ra, rb)
+ });
+ } else if (rb) {
+ s.push(s.pop() + "rotate(" + rb + ")");
+ }
+ if (wa != wb) {
+ q.push({
+ i: s.push(s.pop() + "skewX(", null, ")") - 2,
+ x: d3.interpolateNumber(wa, wb)
+ });
+ } else if (wb) {
+ s.push(s.pop() + "skewX(" + wb + ")");
+ }
+ if (ka[0] != kb[0] || ka[1] != kb[1]) {
+ n = s.push(s.pop() + "scale(", null, ",", null, ")");
+ q.push({
+ i: n - 4,
+ x: d3.interpolateNumber(ka[0], kb[0])
+ }, {
+ i: n - 2,
+ x: d3.interpolateNumber(ka[1], kb[1])
+ });
+ } else if (kb[0] != 1 || kb[1] != 1) {
+ s.push(s.pop() + "scale(" + kb + ")");
+ }
+ n = q.length;
+ return function(t) {
+ var i = -1, o;
+ while (++i < n) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+ };
+ d3.interpolateRgb = function(a, b) {
+ a = d3.rgb(a);
+ b = d3.rgb(b);
+ var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
+ return function(t) {
+ return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));
+ };
+ };
+ d3.interpolateHsl = function(a, b) {
+ a = d3.hsl(a);
+ b = d3.hsl(b);
+ var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0;
+ if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360;
+ return function(t) {
+ return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + "";
+ };
+ };
+ d3.interpolateLab = function(a, b) {
+ a = d3.lab(a);
+ b = d3.lab(b);
+ var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
+ return function(t) {
+ return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
+ };
+ };
+ d3.interpolateHcl = function(a, b) {
+ a = d3.hcl(a);
+ b = d3.hcl(b);
+ var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;
+ if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
+ return function(t) {
+ return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
+ };
+ };
+ d3.interpolateArray = function(a, b) {
+ var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;
+ for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
+ for (; i < na; ++i) c[i] = a[i];
+ for (; i < nb; ++i) c[i] = b[i];
+ return function(t) {
+ for (i = 0; i < n0; ++i) c[i] = x[i](t);
+ return c;
+ };
+ };
+ d3.interpolateObject = function(a, b) {
+ var i = {}, c = {}, k;
+ for (k in a) {
+ if (k in b) {
+ i[k] = d3_interpolateByName(k)(a[k], b[k]);
+ } else {
+ c[k] = a[k];
+ }
+ }
+ for (k in b) {
+ if (!(k in a)) {
+ c[k] = b[k];
+ }
+ }
+ return function(t) {
+ for (k in i) c[k] = i[k](t);
+ return c;
+ };
+ };
+ var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
+ d3.interpolators = [ d3.interpolateObject, function(a, b) {
+ return b instanceof Array && d3.interpolateArray(a, b);
+ }, function(a, b) {
+ return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + "");
+ }, function(a, b) {
+ return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b);
+ }, function(a, b) {
+ return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b);
+ } ];
+ d3.rgb = function(r, g, b) {
+ return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b);
+ };
+ d3_Rgb.prototype.brighter = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ var r = this.r, g = this.g, b = this.b, i = 30;
+ if (!r && !g && !b) return d3_rgb(i, i, i);
+ if (r && r < i) r = i;
+ if (g && g < i) g = i;
+ if (b && b < i) b = i;
+ return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k)));
+ };
+ d3_Rgb.prototype.darker = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b));
+ };
+ d3_Rgb.prototype.hsl = function() {
+ return d3_rgb_hsl(this.r, this.g, this.b);
+ };
+ d3_Rgb.prototype.toString = function() {
+ return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
+ };
+ var d3_rgb_names = d3.map({
+ aliceblue: "#f0f8ff",
+ antiquewhite: "#faebd7",
+ aqua: "#00ffff",
+ aquamarine: "#7fffd4",
+ azure: "#f0ffff",
+ beige: "#f5f5dc",
+ bisque: "#ffe4c4",
+ black: "#000000",
+ blanchedalmond: "#ffebcd",
+ blue: "#0000ff",
+ blueviolet: "#8a2be2",
+ brown: "#a52a2a",
+ burlywood: "#deb887",
+ cadetblue: "#5f9ea0",
+ chartreuse: "#7fff00",
+ chocolate: "#d2691e",
+ coral: "#ff7f50",
+ cornflowerblue: "#6495ed",
+ cornsilk: "#fff8dc",
+ crimson: "#dc143c",
+ cyan: "#00ffff",
+ darkblue: "#00008b",
+ darkcyan: "#008b8b",
+ darkgoldenrod: "#b8860b",
+ darkgray: "#a9a9a9",
+ darkgreen: "#006400",
+ darkgrey: "#a9a9a9",
+ darkkhaki: "#bdb76b",
+ darkmagenta: "#8b008b",
+ darkolivegreen: "#556b2f",
+ darkorange: "#ff8c00",
+ darkorchid: "#9932cc",
+ darkred: "#8b0000",
+ darksalmon: "#e9967a",
+ darkseagreen: "#8fbc8f",
+ darkslateblue: "#483d8b",
+ darkslategray: "#2f4f4f",
+ darkslategrey: "#2f4f4f",
+ darkturquoise: "#00ced1",
+ darkviolet: "#9400d3",
+ deeppink: "#ff1493",
+ deepskyblue: "#00bfff",
+ dimgray: "#696969",
+ dimgrey: "#696969",
+ dodgerblue: "#1e90ff",
+ firebrick: "#b22222",
+ floralwhite: "#fffaf0",
+ forestgreen: "#228b22",
+ fuchsia: "#ff00ff",
+ gainsboro: "#dcdcdc",
+ ghostwhite: "#f8f8ff",
+ gold: "#ffd700",
+ goldenrod: "#daa520",
+ gray: "#808080",
+ green: "#008000",
+ greenyellow: "#adff2f",
+ grey: "#808080",
+ honeydew: "#f0fff0",
+ hotpink: "#ff69b4",
+ indianred: "#cd5c5c",
+ indigo: "#4b0082",
+ ivory: "#fffff0",
+ khaki: "#f0e68c",
+ lavender: "#e6e6fa",
+ lavenderblush: "#fff0f5",
+ lawngreen: "#7cfc00",
+ lemonchiffon: "#fffacd",
+ lightblue: "#add8e6",
+ lightcoral: "#f08080",
+ lightcyan: "#e0ffff",
+ lightgoldenrodyellow: "#fafad2",
+ lightgray: "#d3d3d3",
+ lightgreen: "#90ee90",
+ lightgrey: "#d3d3d3",
+ lightpink: "#ffb6c1",
+ lightsalmon: "#ffa07a",
+ lightseagreen: "#20b2aa",
+ lightskyblue: "#87cefa",
+ lightslategray: "#778899",
+ lightslategrey: "#778899",
+ lightsteelblue: "#b0c4de",
+ lightyellow: "#ffffe0",
+ lime: "#00ff00",
+ limegreen: "#32cd32",
+ linen: "#faf0e6",
+ magenta: "#ff00ff",
+ maroon: "#800000",
+ mediumaquamarine: "#66cdaa",
+ mediumblue: "#0000cd",
+ mediumorchid: "#ba55d3",
+ mediumpurple: "#9370db",
+ mediumseagreen: "#3cb371",
+ mediumslateblue: "#7b68ee",
+ mediumspringgreen: "#00fa9a",
+ mediumturquoise: "#48d1cc",
+ mediumvioletred: "#c71585",
+ midnightblue: "#191970",
+ mintcream: "#f5fffa",
+ mistyrose: "#ffe4e1",
+ moccasin: "#ffe4b5",
+ navajowhite: "#ffdead",
+ navy: "#000080",
+ oldlace: "#fdf5e6",
+ olive: "#808000",
+ olivedrab: "#6b8e23",
+ orange: "#ffa500",
+ orangered: "#ff4500",
+ orchid: "#da70d6",
+ palegoldenrod: "#eee8aa",
+ palegreen: "#98fb98",
+ paleturquoise: "#afeeee",
+ palevioletred: "#db7093",
+ papayawhip: "#ffefd5",
+ peachpuff: "#ffdab9",
+ peru: "#cd853f",
+ pink: "#ffc0cb",
+ plum: "#dda0dd",
+ powderblue: "#b0e0e6",
+ purple: "#800080",
+ red: "#ff0000",
+ rosybrown: "#bc8f8f",
+ royalblue: "#4169e1",
+ saddlebrown: "#8b4513",
+ salmon: "#fa8072",
+ sandybrown: "#f4a460",
+ seagreen: "#2e8b57",
+ seashell: "#fff5ee",
+ sienna: "#a0522d",
+ silver: "#c0c0c0",
+ skyblue: "#87ceeb",
+ slateblue: "#6a5acd",
+ slategray: "#708090",
+ slategrey: "#708090",
+ snow: "#fffafa",
+ springgreen: "#00ff7f",
+ steelblue: "#4682b4",
+ tan: "#d2b48c",
+ teal: "#008080",
+ thistle: "#d8bfd8",
+ tomato: "#ff6347",
+ turquoise: "#40e0d0",
+ violet: "#ee82ee",
+ wheat: "#f5deb3",
+ white: "#ffffff",
+ whitesmoke: "#f5f5f5",
+ yellow: "#ffff00",
+ yellowgreen: "#9acd32"
+ });
+ d3_rgb_names.forEach(function(key, value) {
+ d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
+ });
+ d3.hsl = function(h, s, l) {
+ return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l);
+ };
+ d3_Hsl.prototype.brighter = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, this.l / k);
+ };
+ d3_Hsl.prototype.darker = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, k * this.l);
+ };
+ d3_Hsl.prototype.rgb = function() {
+ return d3_hsl_rgb(this.h, this.s, this.l);
+ };
+ d3_Hsl.prototype.toString = function() {
+ return this.rgb().toString();
+ };
+ d3.hcl = function(h, c, l) {
+ return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l);
+ };
+ d3_Hcl.prototype.brighter = function(k) {
+ return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
+ };
+ d3_Hcl.prototype.darker = function(k) {
+ return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
+ };
+ d3_Hcl.prototype.rgb = function() {
+ return d3_hcl_lab(this.h, this.c, this.l).rgb();
+ };
+ d3_Hcl.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+ d3.lab = function(l, a, b) {
+ return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b);
+ };
+ var d3_lab_K = 18;
+ var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
+ d3_Lab.prototype.brighter = function(k) {
+ return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+ d3_Lab.prototype.darker = function(k) {
+ return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+ d3_Lab.prototype.rgb = function() {
+ return d3_lab_rgb(this.l, this.a, this.b);
+ };
+ d3_Lab.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+ var d3_select = function(s, n) {
+ return n.querySelector(s);
+ }, d3_selectAll = function(s, n) {
+ return n.querySelectorAll(s);
+ }, d3_selectRoot = document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) {
+ return d3_selectMatcher.call(n, s);
+ };
+ if (typeof Sizzle === "function") {
+ d3_select = function(s, n) {
+ return Sizzle(s, n)[0] || null;
+ };
+ d3_selectAll = function(s, n) {
+ return Sizzle.uniqueSort(Sizzle(s, n));
+ };
+ d3_selectMatches = Sizzle.matchesSelector;
+ }
+ var d3_selectionPrototype = [];
+ d3.selection = function() {
+ return d3_selectionRoot;
+ };
+ d3.selection.prototype = d3_selectionPrototype;
+ d3_selectionPrototype.select = function(selector) {
+ var subgroups = [], subgroup, subnode, group, node;
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroup.push(subnode = selector.call(node, node.__data__, i));
+ if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ d3_selectionPrototype.selectAll = function(selector) {
+ var subgroups = [], subgroup, node;
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
+ subgroup.parentNode = node;
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ d3_selectionPrototype.attr = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") {
+ var node = this.node();
+ name = d3.ns.qualify(name);
+ return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);
+ }
+ for (value in name) this.each(d3_selection_attr(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_attr(name, value));
+ };
+ d3_selectionPrototype.classed = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") {
+ var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1;
+ if (value = node.classList) {
+ while (++i < n) if (!value.contains(name[i])) return false;
+ } else {
+ value = node.className;
+ if (value.baseVal != null) value = value.baseVal;
+ while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;
+ }
+ return true;
+ }
+ for (value in name) this.each(d3_selection_classed(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_classed(name, value));
+ };
+ d3_selectionPrototype.style = function(name, value, priority) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof name !== "string") {
+ if (n < 2) value = "";
+ for (priority in name) this.each(d3_selection_style(priority, name[priority], value));
+ return this;
+ }
+ if (n < 2) return window.getComputedStyle(this.node(), null).getPropertyValue(name);
+ priority = "";
+ }
+ return this.each(d3_selection_style(name, value, priority));
+ };
+ d3_selectionPrototype.property = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") return this.node()[name];
+ for (value in name) this.each(d3_selection_property(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_property(name, value));
+ };
+ d3_selectionPrototype.text = function(value) {
+ return arguments.length < 1 ? this.node().textContent : this.each(typeof value === "function" ? function() {
+ var v = value.apply(this, arguments);
+ this.textContent = v == null ? "" : v;
+ } : value == null ? function() {
+ this.textContent = "";
+ } : function() {
+ this.textContent = value;
+ });
+ };
+ d3_selectionPrototype.html = function(value) {
+ return arguments.length < 1 ? this.node().innerHTML : this.each(typeof value === "function" ? function() {
+ var v = value.apply(this, arguments);
+ this.innerHTML = v == null ? "" : v;
+ } : value == null ? function() {
+ this.innerHTML = "";
+ } : function() {
+ this.innerHTML = value;
+ });
+ };
+ d3_selectionPrototype.append = function(name) {
+ function append() {
+ return this.appendChild(document.createElementNS(this.namespaceURI, name));
+ }
+ function appendNS() {
+ return this.appendChild(document.createElementNS(name.space, name.local));
+ }
+ name = d3.ns.qualify(name);
+ return this.select(name.local ? appendNS : append);
+ };
+ d3_selectionPrototype.insert = function(name, before) {
+ function insert() {
+ return this.insertBefore(document.createElementNS(this.namespaceURI, name), d3_select(before, this));
+ }
+ function insertNS() {
+ return this.insertBefore(document.createElementNS(name.space, name.local), d3_select(before, this));
+ }
+ name = d3.ns.qualify(name);
+ return this.select(name.local ? insertNS : insert);
+ };
+ d3_selectionPrototype.remove = function() {
+ return this.each(function() {
+ var parent = this.parentNode;
+ if (parent) parent.removeChild(this);
+ });
+ };
+ d3_selectionPrototype.data = function(value, key) {
+ function bind(group, groupData) {
+ var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), n1 = Math.max(n, m), updateNodes = [], enterNodes = [], exitNodes = [], node, nodeData;
+ if (key) {
+ var nodeByKeyValue = new d3_Map, keyValues = [], keyValue, j = groupData.length;
+ for (i = -1; ++i < n; ) {
+ keyValue = key.call(node = group[i], node.__data__, i);
+ if (nodeByKeyValue.has(keyValue)) {
+ exitNodes[j++] = node;
+ } else {
+ nodeByKeyValue.set(keyValue, node);
+ }
+ keyValues.push(keyValue);
+ }
+ for (i = -1; ++i < m; ) {
+ keyValue = key.call(groupData, nodeData = groupData[i], i);
+ if (nodeByKeyValue.has(keyValue)) {
+ updateNodes[i] = node = nodeByKeyValue.get(keyValue);
+ node.__data__ = nodeData;
+ enterNodes[i] = exitNodes[i] = null;
+ } else {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ nodeByKeyValue.remove(keyValue);
+ }
+ for (i = -1; ++i < n; ) {
+ if (nodeByKeyValue.has(keyValues[i])) {
+ exitNodes[i] = group[i];
+ }
+ }
+ } else {
+ for (i = -1; ++i < n0; ) {
+ node = group[i];
+ nodeData = groupData[i];
+ if (node) {
+ node.__data__ = nodeData;
+ updateNodes[i] = node;
+ enterNodes[i] = exitNodes[i] = null;
+ } else {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ }
+ for (; i < m; ++i) {
+ enterNodes[i] = d3_selection_dataNode(groupData[i]);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ for (; i < n1; ++i) {
+ exitNodes[i] = group[i];
+ enterNodes[i] = updateNodes[i] = null;
+ }
+ }
+ enterNodes.update = updateNodes;
+ enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;
+ enter.push(enterNodes);
+ update.push(updateNodes);
+ exit.push(exitNodes);
+ }
+ var i = -1, n = this.length, group, node;
+ if (!arguments.length) {
+ value = new Array(n = (group = this[0]).length);
+ while (++i < n) {
+ if (node = group[i]) {
+ value[i] = node.__data__;
+ }
+ }
+ return value;
+ }
+ var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);
+ if (typeof value === "function") {
+ while (++i < n) {
+ bind(group = this[i], value.call(group, group.parentNode.__data__, i));
+ }
+ } else {
+ while (++i < n) {
+ bind(group = this[i], value);
+ }
+ }
+ update.enter = function() {
+ return enter;
+ };
+ update.exit = function() {
+ return exit;
+ };
+ return update;
+ };
+ d3_selectionPrototype.datum = d3_selectionPrototype.map = function(value) {
+ return arguments.length < 1 ? this.property("__data__") : this.property("__data__", value);
+ };
+ d3_selectionPrototype.filter = function(filter) {
+ var subgroups = [], subgroup, group, node;
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = 0, n = group.length; i < n; i++) {
+ if ((node = group[i]) && filter.call(node, node.__data__, i)) {
+ subgroup.push(node);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ d3_selectionPrototype.order = function() {
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
+ if (node = group[i]) {
+ if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
+ next = node;
+ }
+ }
+ }
+ return this;
+ };
+ d3_selectionPrototype.sort = function(comparator) {
+ comparator = d3_selection_sortComparator.apply(this, arguments);
+ for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);
+ return this.order();
+ };
+ d3_selectionPrototype.on = function(type, listener, capture) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof type !== "string") {
+ if (n < 2) listener = false;
+ for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
+ return this;
+ }
+ if (n < 2) return (n = this.node()["__on" + type]) && n._;
+ capture = false;
+ }
+ return this.each(d3_selection_on(type, listener, capture));
+ };
+ d3_selectionPrototype.each = function(callback) {
+ return d3_selection_each(this, function(node, i, j) {
+ callback.call(node, node.__data__, i, j);
+ });
+ };
+ d3_selectionPrototype.call = function(callback) {
+ callback.apply(this, (arguments[0] = this, arguments));
+ return this;
+ };
+ d3_selectionPrototype.empty = function() {
+ return !this.node();
+ };
+ d3_selectionPrototype.node = function(callback) {
+ for (var j = 0, m = this.length; j < m; j++) {
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ var node = group[i];
+ if (node) return node;
+ }
+ }
+ return null;
+ };
+ d3_selectionPrototype.transition = function() {
+ var subgroups = [], subgroup, node;
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ subgroup.push((node = group[i]) ? {
+ node: node,
+ delay: d3_transitionDelay,
+ duration: d3_transitionDuration
+ } : null);
+ }
+ }
+ return d3_transition(subgroups, d3_transitionId || ++d3_transitionNextId, Date.now());
+ };
+ var d3_selectionRoot = d3_selection([ [ document ] ]);
+ d3_selectionRoot[0].parentNode = d3_selectRoot;
+ d3.select = function(selector) {
+ return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]);
+ };
+ d3.selectAll = function(selector) {
+ return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]);
+ };
+ var d3_selection_enterPrototype = [];
+ d3.selection.enter = d3_selection_enter;
+ d3.selection.enter.prototype = d3_selection_enterPrototype;
+ d3_selection_enterPrototype.append = d3_selectionPrototype.append;
+ d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
+ d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
+ d3_selection_enterPrototype.node = d3_selectionPrototype.node;
+ d3_selection_enterPrototype.select = function(selector) {
+ var subgroups = [], subgroup, subnode, upgroup, group, node;
+ for (var j = -1, m = this.length; ++j < m; ) {
+ upgroup = (group = this[j]).update;
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = group.parentNode;
+ for (var i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
+ subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ var d3_transitionPrototype = [], d3_transitionNextId = 0, d3_transitionId = 0, d3_transitionDefaultDelay = 0, d3_transitionDefaultDuration = 250, d3_transitionDefaultEase = d3.ease("cubic-in-out"), d3_transitionDelay = d3_transitionDefaultDelay, d3_transitionDuration = d3_transitionDefaultDuration, d3_transitionEase = d3_transitionDefaultEase;
+ d3_transitionPrototype.call = d3_selectionPrototype.call;
+ d3.transition = function(selection) {
+ return arguments.length ? d3_transitionId ? selection.transition() : selection : d3_selectionRoot.transition();
+ };
+ d3.transition.prototype = d3_transitionPrototype;
+ d3_transitionPrototype.select = function(selector) {
+ var subgroups = [], subgroup, subnode, node;
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) {
+ if ("__data__" in node.node) subnode.__data__ = node.node.__data__;
+ subgroup.push({
+ node: subnode,
+ delay: node.delay,
+ duration: node.duration
+ });
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+ };
+ d3_transitionPrototype.selectAll = function(selector) {
+ var subgroups = [], subgroup, subnodes, node;
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subnodes = selector.call(node.node, node.node.__data__, i);
+ subgroups.push(subgroup = []);
+ for (var k = -1, o = subnodes.length; ++k < o; ) {
+ subgroup.push({
+ node: subnodes[k],
+ delay: node.delay,
+ duration: node.duration
+ });
+ }
+ }
+ }
+ }
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+ };
+ d3_transitionPrototype.filter = function(filter) {
+ var subgroups = [], subgroup, group, node;
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ if ((node = group[i]) && filter.call(node.node, node.node.__data__, i)) {
+ subgroup.push(node);
+ }
+ }
+ }
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+ };
+ d3_transitionPrototype.attr = function(name, value) {
+ if (arguments.length < 2) {
+ for (value in name) this.attrTween(value, d3_tweenByName(name[value], value));
+ return this;
+ }
+ return this.attrTween(name, d3_tweenByName(value, name));
+ };
+ d3_transitionPrototype.attrTween = function(nameNS, tween) {
+ function attrTween(d, i) {
+ var f = tween.call(this, d, i, this.getAttribute(name));
+ return f === d3_tweenRemove ? (this.removeAttribute(name), null) : f && function(t) {
+ this.setAttribute(name, f(t));
+ };
+ }
+ function attrTweenNS(d, i) {
+ var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
+ return f === d3_tweenRemove ? (this.removeAttributeNS(name.space, name.local), null) : f && function(t) {
+ this.setAttributeNS(name.space, name.local, f(t));
+ };
+ }
+ var name = d3.ns.qualify(nameNS);
+ return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
+ };
+ d3_transitionPrototype.style = function(name, value, priority) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof name !== "string") {
+ if (n < 2) value = "";
+ for (priority in name) this.styleTween(priority, d3_tweenByName(name[priority], priority), value);
+ return this;
+ }
+ priority = "";
+ }
+ return this.styleTween(name, d3_tweenByName(value, name), priority);
+ };
+ d3_transitionPrototype.styleTween = function(name, tween, priority) {
+ if (arguments.length < 3) priority = "";
+ return this.tween("style." + name, function(d, i) {
+ var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name));
+ return f === d3_tweenRemove ? (this.style.removeProperty(name), null) : f && function(t) {
+ this.style.setProperty(name, f(t), priority);
+ };
+ });
+ };
+ d3_transitionPrototype.text = function(value) {
+ return this.tween("text", function(d, i) {
+ this.textContent = typeof value === "function" ? value.call(this, d, i) : value;
+ });
+ };
+ d3_transitionPrototype.remove = function() {
+ return this.each("end.transition", function() {
+ var p;
+ if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
+ });
+ };
+ d3_transitionPrototype.delay = function(value) {
+ return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
+ node.delay = value.call(node = node.node, node.__data__, i, j) | 0;
+ } : (value = value | 0, function(node) {
+ node.delay = value;
+ }));
+ };
+ d3_transitionPrototype.duration = function(value) {
+ return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
+ node.duration = Math.max(1, value.call(node = node.node, node.__data__, i, j) | 0);
+ } : (value = Math.max(1, value | 0), function(node) {
+ node.duration = value;
+ }));
+ };
+ d3_transitionPrototype.transition = function() {
+ return this.select(d3_this);
+ };
+ d3.tween = function(b, interpolate) {
+ function tweenFunction(d, i, a) {
+ var v = b.call(this, d, i);
+ return v == null ? a != "" && d3_tweenRemove : a != v && interpolate(a, v);
+ }
+ function tweenString(d, i, a) {
+ return a != b && interpolate(a, b);
+ }
+ return typeof b === "function" ? tweenFunction : b == null ? d3_tweenNull : (b += "", tweenString);
+ };
+ var d3_tweenRemove = {};
+ var d3_timer_queue = null, d3_timer_interval, d3_timer_timeout;
+ d3.timer = function(callback, delay, then) {
+ var found = false, t0, t1 = d3_timer_queue;
+ if (arguments.length < 3) {
+ if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return;
+ then = Date.now();
+ }
+ while (t1) {
+ if (t1.callback === callback) {
+ t1.then = then;
+ t1.delay = delay;
+ found = true;
+ break;
+ }
+ t0 = t1;
+ t1 = t1.next;
+ }
+ if (!found) d3_timer_queue = {
+ callback: callback,
+ then: then,
+ delay: delay,
+ next: d3_timer_queue
+ };
+ if (!d3_timer_interval) {
+ d3_timer_timeout = clearTimeout(d3_timer_timeout);
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+ };
+ d3.timer.flush = function() {
+ var elapsed, now = Date.now(), t1 = d3_timer_queue;
+ while (t1) {
+ elapsed = now - t1.then;
+ if (!t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+ d3_timer_flush();
+ };
+ var d3_timer_frame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) {
+ setTimeout(callback, 17);
+ };
+ d3.mouse = function(container) {
+ return d3_mousePoint(container, d3_eventSource());
+ };
+ var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;
+ d3.touches = function(container, touches) {
+ if (arguments.length < 2) touches = d3_eventSource().touches;
+ return touches ? d3_array(touches).map(function(touch) {
+ var point = d3_mousePoint(container, touch);
+ point.identifier = touch.identifier;
+ return point;
+ }) : [];
+ };
+ d3.scale = {};
+ d3.scale.linear = function() {
+ return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3.interpolate, false);
+ };
+ d3.scale.log = function() {
+ return d3_scale_log(d3.scale.linear(), d3_scale_logp);
+ };
+ var d3_scale_logFormat = d3.format(".0e");
+ d3_scale_logp.pow = function(x) {
+ return Math.pow(10, x);
+ };
+ d3_scale_logn.pow = function(x) {
+ return -Math.pow(10, -x);
+ };
+ d3.scale.pow = function() {
+ return d3_scale_pow(d3.scale.linear(), 1);
+ };
+ d3.scale.sqrt = function() {
+ return d3.scale.pow().exponent(.5);
+ };
+ d3.scale.ordinal = function() {
+ return d3_scale_ordinal([], {
+ t: "range",
+ a: [ [] ]
+ });
+ };
+ d3.scale.category10 = function() {
+ return d3.scale.ordinal().range(d3_category10);
+ };
+ d3.scale.category20 = function() {
+ return d3.scale.ordinal().range(d3_category20);
+ };
+ d3.scale.category20b = function() {
+ return d3.scale.ordinal().range(d3_category20b);
+ };
+ d3.scale.category20c = function() {
+ return d3.scale.ordinal().range(d3_category20c);
+ };
+ d3.scale.category50 = function() {
+ return d3.scale.ordinal().range(d3_category50);
+ };
+ var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ];
+ var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ];
+ var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ];
+ var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ];
+ var d3_category50 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#8c864b", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf","#DC143C","#800080","#0000FF","#008000","#D2691E","#FF0000","#000000","#DB7093","#FF00FF","#7B68EE","#1f77b6", "#9edae5", "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#aec7e8", "#e7ba52", "#ffbb78", "#e7cb94", "#98df8a", "#843c39", "#ff9896", "#ad494a", "#c5b0d5", "#d6616b", "#c49c94", "#e7969c", "#f7b6d2", "#fd8d3c", "#c7c7c7", "#7b4173", "#dbdb8d", "#a55194", ];
+ d3.scale.quantile = function() {
+ return d3_scale_quantile([], []);
+ };
+ d3.scale.quantize = function() {
+ return d3_scale_quantize(0, 1, [ 0, 1 ]);
+ };
+ d3.scale.threshold = function() {
+ return d3_scale_threshold([ .5 ], [ 0, 1 ]);
+ };
+ d3.scale.identity = function() {
+ return d3_scale_identity([ 0, 1 ]);
+ };
+ d3.svg = {};
+ d3.svg.arc = function() {
+ function arc() {
+ var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), df = da < Math.PI ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1);
+ return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z";
+ }
+ var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
+ arc.innerRadius = function(v) {
+ if (!arguments.length) return innerRadius;
+ innerRadius = d3_functor(v);
+ return arc;
+ };
+ arc.outerRadius = function(v) {
+ if (!arguments.length) return outerRadius;
+ outerRadius = d3_functor(v);
+ return arc;
+ };
+ arc.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return arc;
+ };
+ arc.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return arc;
+ };
+ arc.centroid = function() {
+ var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
+ return [ Math.cos(a) * r, Math.sin(a) * r ];
+ };
+ return arc;
+ };
+ var d3_svg_arcOffset = -Math.PI / 2, d3_svg_arcMax = 2 * Math.PI - 1e-6;
+ d3.svg.line = function() {
+ return d3_svg_line(d3_identity);
+ };
+ var d3_svg_lineInterpolators = d3.map({
+ linear: d3_svg_lineLinear,
+ "linear-closed": d3_svg_lineLinearClosed,
+ "step-before": d3_svg_lineStepBefore,
+ "step-after": d3_svg_lineStepAfter,
+ basis: d3_svg_lineBasis,
+ "basis-open": d3_svg_lineBasisOpen,
+ "basis-closed": d3_svg_lineBasisClosed,
+ bundle: d3_svg_lineBundle,
+ cardinal: d3_svg_lineCardinal,
+ "cardinal-open": d3_svg_lineCardinalOpen,
+ "cardinal-closed": d3_svg_lineCardinalClosed,
+ monotone: d3_svg_lineMonotone
+ });
+ d3_svg_lineInterpolators.forEach(function(key, value) {
+ value.key = key;
+ value.closed = /-closed$/.test(key);
+ });
+ var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ];
+ d3.svg.line.radial = function() {
+ var line = d3_svg_line(d3_svg_lineRadial);
+ line.radius = line.x, delete line.x;
+ line.angle = line.y, delete line.y;
+ return line;
+ };
+ d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
+ d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
+ d3.svg.area = function() {
+ return d3_svg_area(d3_identity);
+ };
+ d3.svg.area.radial = function() {
+ var area = d3_svg_area(d3_svg_lineRadial);
+ area.radius = area.x, delete area.x;
+ area.innerRadius = area.x0, delete area.x0;
+ area.outerRadius = area.x1, delete area.x1;
+ area.angle = area.y, delete area.y;
+ area.startAngle = area.y0, delete area.y0;
+ area.endAngle = area.y1, delete area.y1;
+ return area;
+ };
+ d3.svg.chord = function() {
+ function chord(d, i) {
+ var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
+ return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z";
+ }
+ function subgroup(self, f, d, i) {
+ var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
+ return {
+ r: r,
+ a0: a0,
+ a1: a1,
+ p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
+ p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
+ };
+ }
+ function equals(a, b) {
+ return a.a0 == b.a0 && a.a1 == b.a1;
+ }
+ function arc(r, p, a) {
+ return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;
+ }
+ function curve(r0, p0, r1, p1) {
+ return "Q 0,0 " + p1;
+ }
+ var source = d3_svg_chordSource, target = d3_svg_chordTarget, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
+ chord.radius = function(v) {
+ if (!arguments.length) return radius;
+ radius = d3_functor(v);
+ return chord;
+ };
+ chord.source = function(v) {
+ if (!arguments.length) return source;
+ source = d3_functor(v);
+ return chord;
+ };
+ chord.target = function(v) {
+ if (!arguments.length) return target;
+ target = d3_functor(v);
+ return chord;
+ };
+ chord.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return chord;
+ };
+ chord.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return chord;
+ };
+ return chord;
+ };
+ d3.svg.diagonal = function() {
+ function diagonal(d, i) {
+ var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
+ x: p0.x,
+ y: m
+ }, {
+ x: p3.x,
+ y: m
+ }, p3 ];
+ p = p.map(projection);
+ return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
+ }
+ var source = d3_svg_chordSource, target = d3_svg_chordTarget, projection = d3_svg_diagonalProjection;
+ diagonal.source = function(x) {
+ if (!arguments.length) return source;
+ source = d3_functor(x);
+ return diagonal;
+ };
+ diagonal.target = function(x) {
+ if (!arguments.length) return target;
+ target = d3_functor(x);
+ return diagonal;
+ };
+ diagonal.projection = function(x) {
+ if (!arguments.length) return projection;
+ projection = x;
+ return diagonal;
+ };
+ return diagonal;
+ };
+ d3.svg.diagonal.radial = function() {
+ var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;
+ diagonal.projection = function(x) {
+ return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;
+ };
+ return diagonal;
+ };
+ d3.svg.mouse = d3.mouse;
+ d3.svg.touches = d3.touches;
+ d3.svg.symbol = function() {
+ function symbol(d, i) {
+ return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));
+ }
+ var type = d3_svg_symbolType, size = d3_svg_symbolSize;
+ symbol.type = function(x) {
+ if (!arguments.length) return type;
+ type = d3_functor(x);
+ return symbol;
+ };
+ symbol.size = function(x) {
+ if (!arguments.length) return size;
+ size = d3_functor(x);
+ return symbol;
+ };
+ return symbol;
+ };
+ var d3_svg_symbols = d3.map({
+ circle: d3_svg_symbolCircle,
+ cross: function(size) {
+ var r = Math.sqrt(size / 5) / 2;
+ return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z";
+ },
+ diamond: function(size) {
+ var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;
+ return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
+ },
+ square: function(size) {
+ var r = Math.sqrt(size) / 2;
+ return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
+ },
+ "triangle-down": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
+ },
+ "triangle-up": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
+ }
+ });
+ d3.svg.symbolTypes = d3_svg_symbols.keys();
+ var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180);
+ d3.svg.axis = function() {
+ function axis(g) {
+ g.each(function() {
+ var g = d3.select(this);
+ var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_;
+ var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1);
+ var tick = g.selectAll("g").data(ticks, String), tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform;
+ var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathEnter = path.enter().append("path").attr("class", "domain"), pathUpdate = d3.transition(path);
+ var scale1 = scale.copy(), scale0 = this.__chart__ || scale1;
+ this.__chart__ = scale1;
+ tickEnter.append("line").attr("class", "tick");
+ tickEnter.append("text");
+ var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
+ switch (orient) {
+ case "bottom":
+ {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
+ lineEnter.attr("y2", tickMajorSize);
+ textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding);
+ lineUpdate.attr("x2", 0).attr("y2", tickMajorSize);
+ textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding);
+ text.attr("dy", ".71em").attr("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
+ break;
+ }
+ case "top":
+ {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", -tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
+ lineEnter.attr("y2", -tickMajorSize);
+ textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
+ lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize);
+ textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
+ text.attr("dy", "0em").attr("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
+ break;
+ }
+ case "left":
+ {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", -tickMinorSize);
+ subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
+ lineEnter.attr("x2", -tickMajorSize);
+ textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
+ lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0);
+ textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0);
+ text.attr("dy", ".32em").attr("text-anchor", "end");
+ pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
+ break;
+ }
+ case "right":
+ {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", tickMinorSize);
+ subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
+ lineEnter.attr("x2", tickMajorSize);
+ textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding);
+ lineUpdate.attr("x2", tickMajorSize).attr("y2", 0);
+ textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0);
+ text.attr("dy", ".32em").attr("text-anchor", "start");
+ pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
+ break;
+ }
+ }
+ if (scale.ticks) {
+ tickEnter.call(tickTransform, scale0);
+ tickUpdate.call(tickTransform, scale1);
+ tickExit.call(tickTransform, scale1);
+ subtickEnter.call(tickTransform, scale0);
+ subtickUpdate.call(tickTransform, scale1);
+ subtickExit.call(tickTransform, scale1);
+ } else {
+ var dx = scale1.rangeBand() / 2, x = function(d) {
+ return scale1(d) + dx;
+ };
+ tickEnter.call(tickTransform, x);
+ tickUpdate.call(tickTransform, x);
+ }
+ });
+ }
+ var scale = d3.scale.linear(), orient = "bottom", tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0;
+ axis.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = x;
+ return axis;
+ };
+ axis.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ return axis;
+ };
+ axis.ticks = function() {
+ if (!arguments.length) return tickArguments_;
+ tickArguments_ = arguments;
+ return axis;
+ };
+ axis.tickValues = function(x) {
+ if (!arguments.length) return tickValues;
+ tickValues = x;
+ return axis;
+ };
+ axis.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat_;
+ tickFormat_ = x;
+ return axis;
+ };
+ axis.tickSize = function(x, y, z) {
+ if (!arguments.length) return tickMajorSize;
+ var n = arguments.length - 1;
+ tickMajorSize = +x;
+ tickMinorSize = n > 1 ? +y : tickMajorSize;
+ tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
+ return axis;
+ };
+ axis.tickPadding = function(x) {
+ if (!arguments.length) return tickPadding;
+ tickPadding = +x;
+ return axis;
+ };
+ axis.tickSubdivide = function(x) {
+ if (!arguments.length) return tickSubdivide;
+ tickSubdivide = +x;
+ return axis;
+ };
+ return axis;
+ };
+ d3.svg.brush = function() {
+ function brush(g) {
+ g.each(function() {
+ var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e;
+ g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
+ bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
+ fg.enter().append("rect").attr("class", "extent").style("cursor", "move");
+ tz.enter().append("g").attr("class", function(d) {
+ return "resize " + d;
+ }).style("cursor", function(d) {
+ return d3_svg_brushCursor[d];
+ }).append("rect").attr("x", function(d) {
+ return /[ew]$/.test(d) ? -3 : null;
+ }).attr("y", function(d) {
+ return /^[ns]/.test(d) ? -3 : null;
+ }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
+ tz.style("display", brush.empty() ? "none" : null);
+ tz.exit().remove();
+ if (x) {
+ e = d3_scaleRange(x);
+ bg.attr("x", e[0]).attr("width", e[1] - e[0]);
+ redrawX(g);
+ }
+ if (y) {
+ e = d3_scaleRange(y);
+ bg.attr("y", e[0]).attr("height", e[1] - e[0]);
+ redrawY(g);
+ }
+ redraw(g);
+ });
+ }
+ function redraw(g) {
+ g.selectAll(".resize").attr("transform", function(d) {
+ return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";
+ });
+ }
+ function redrawX(g) {
+ g.select(".extent").attr("x", extent[0][0]);
+ g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);
+ }
+ function redrawY(g) {
+ g.select(".extent").attr("y", extent[0][1]);
+ g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
+ }
+ function brushstart() {
+ function mouse() {
+ var touches = d3.event.changedTouches;
+ return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
+ }
+ function keydown() {
+ if (d3.event.keyCode == 32) {
+ if (!dragging) {
+ center = null;
+ origin[0] -= extent[1][0];
+ origin[1] -= extent[1][1];
+ dragging = 2;
+ }
+ d3_eventCancel();
+ }
+ }
+ function keyup() {
+ if (d3.event.keyCode == 32 && dragging == 2) {
+ origin[0] += extent[1][0];
+ origin[1] += extent[1][1];
+ dragging = 0;
+ d3_eventCancel();
+ }
+ }
+ function brushmove() {
+ var point = mouse(), moved = false;
+ if (offset) {
+ point[0] += offset[0];
+ point[1] += offset[1];
+ }
+ if (!dragging) {
+ if (d3.event.altKey) {
+ if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ];
+ origin[0] = extent[+(point[0] < center[0])][0];
+ origin[1] = extent[+(point[1] < center[1])][1];
+ } else center = null;
+ }
+ if (resizingX && move1(point, x, 0)) {
+ redrawX(g);
+ moved = true;
+ }
+ if (resizingY && move1(point, y, 1)) {
+ redrawY(g);
+ moved = true;
+ }
+ if (moved) {
+ redraw(g);
+ event_({
+ type: "brush",
+ mode: dragging ? "move" : "resize"
+ });
+ }
+ }
+ function move1(point, scale, i) {
+ var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max;
+ if (dragging) {
+ r0 -= position;
+ r1 -= size + position;
+ }
+ min = Math.max(r0, Math.min(r1, point[i]));
+ if (dragging) {
+ max = (min += position) + size;
+ } else {
+ if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
+ if (position < min) {
+ max = min;
+ min = position;
+ } else {
+ max = position;
+ }
+ }
+ if (extent[0][i] !== min || extent[1][i] !== max) {
+ extentDomain = null;
+ extent[0][i] = min;
+ extent[1][i] = max;
+ return true;
+ }
+ }
+ function brushend() {
+ brushmove();
+ g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
+ d3.select("body").style("cursor", null);
+ w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null);
+ event_({
+ type: "brushend"
+ });
+ d3_eventCancel();
+ }
+ var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset;
+ var w = d3.select(window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup);
+ if (dragging) {
+ origin[0] = extent[0][0] - origin[0];
+ origin[1] = extent[0][1] - origin[1];
+ } else if (resizing) {
+ var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);
+ offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ];
+ origin[0] = extent[ex][0];
+ origin[1] = extent[ey][1];
+ } else if (d3.event.altKey) center = origin.slice();
+ g.style("pointer-events", "none").selectAll(".resize").style("display", null);
+ d3.select("body").style("cursor", eventTarget.style("cursor"));
+ event_({
+ type: "brushstart"
+ });
+ brushmove();
+ d3_eventCancel();
+ }
+ var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain;
+ brush.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ resizes = d3_svg_brushResizes[!x << 1 | !y];
+ return brush;
+ };
+ brush.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ resizes = d3_svg_brushResizes[!x << 1 | !y];
+ return brush;
+ };
+ brush.extent = function(z) {
+ var x0, x1, y0, y1, t;
+ if (!arguments.length) {
+ z = extentDomain || extent;
+ if (x) {
+ x0 = z[0][0], x1 = z[1][0];
+ if (!extentDomain) {
+ x0 = extent[0][0], x1 = extent[1][0];
+ if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ }
+ }
+ if (y) {
+ y0 = z[0][1], y1 = z[1][1];
+ if (!extentDomain) {
+ y0 = extent[0][1], y1 = extent[1][1];
+ if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ }
+ }
+ return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];
+ }
+ extentDomain = [ [ 0, 0 ], [ 0, 0 ] ];
+ if (x) {
+ x0 = z[0], x1 = z[1];
+ if (y) x0 = x0[0], x1 = x1[0];
+ extentDomain[0][0] = x0, extentDomain[1][0] = x1;
+ if (x.invert) x0 = x(x0), x1 = x(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
+ }
+ if (y) {
+ y0 = z[0], y1 = z[1];
+ if (x) y0 = y0[1], y1 = y1[1];
+ extentDomain[0][1] = y0, extentDomain[1][1] = y1;
+ if (y.invert) y0 = y(y0), y1 = y(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
+ }
+ return brush;
+ };
+ brush.clear = function() {
+ extentDomain = null;
+ extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0;
+ return brush;
+ };
+ brush.empty = function() {
+ return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1];
+ };
+ return d3.rebind(brush, event, "on");
+ };
+ var d3_svg_brushCursor = {
+ n: "ns-resize",
+ e: "ew-resize",
+ s: "ns-resize",
+ w: "ew-resize",
+ nw: "nwse-resize",
+ ne: "nesw-resize",
+ se: "nwse-resize",
+ sw: "nesw-resize"
+ };
+ var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];
+ d3.behavior = {};
+ d3.behavior.drag = function() {
+ function drag() {
+ this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);
+ }
+ function mousedown() {
+ function point() {
+ var p = target.parentNode;
+ return touchId ? d3.touches(p).filter(function(p) {
+ return p.identifier === touchId;
+ })[0] : d3.mouse(p);
+ }
+ function dragmove() {
+ if (!target.parentNode) return dragend();
+ var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
+ moved |= dx | dy;
+ origin_ = p;
+ d3_eventCancel();
+ event_({
+ type: "drag",
+ x: p[0] + offset[0],
+ y: p[1] + offset[1],
+ dx: dx,
+ dy: dy
+ });
+ }
+ function dragend() {
+ event_({
+ type: "dragend"
+ });
+ if (moved) {
+ d3_eventCancel();
+ if (d3.event.target === eventTarget) w.on("click.drag", click, true);
+ }
+ w.on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", null);
+ }
+ function click() {
+ d3_eventCancel();
+ w.on("click.drag", null);
+ }
+ var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches && d3.event.changedTouches[0].identifier, offset, origin_ = point(), moved = 0;
+ var w = d3.select(window).on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true);
+ if (origin) {
+ offset = origin.apply(target, arguments);
+ offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
+ } else {
+ offset = [ 0, 0 ];
+ }
+ if (!touchId) d3_eventCancel();
+ event_({
+ type: "dragstart"
+ });
+ }
+ var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null;
+ drag.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ return drag;
+ };
+ return d3.rebind(drag, event, "on");
+ };
+ d3.behavior.zoom = function() {
+ function zoom() {
+ this.on("mousedown.zoom", mousedown).on("mousewheel.zoom", mousewheel).on("mousemove.zoom", mousemove).on("DOMMouseScroll.zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart);
+ }
+ function location(p) {
+ return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ];
+ }
+ function point(l) {
+ return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ];
+ }
+ function scaleTo(s) {
+ scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
+ }
+ function translateTo(p, l) {
+ l = point(l);
+ translate[0] += p[0] - l[0];
+ translate[1] += p[1] - l[1];
+ }
+ function dispatch(event) {
+ if (x1) x1.domain(x0.range().map(function(x) {
+ return (x - translate[0]) / scale;
+ }).map(x0.invert));
+ if (y1) y1.domain(y0.range().map(function(y) {
+ return (y - translate[1]) / scale;
+ }).map(y0.invert));
+ d3.event.preventDefault();
+ event({
+ type: "zoom",
+ scale: scale,
+ translate: translate
+ });
+ }
+ function mousedown() {
+ function mousemove() {
+ moved = 1;
+ translateTo(d3.mouse(target), l);
+ dispatch(event_);
+ }
+ function mouseup() {
+ if (moved) d3_eventCancel();
+ w.on("mousemove.zoom", null).on("mouseup.zoom", null);
+ if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true);
+ }
+ function click() {
+ d3_eventCancel();
+ w.on("click.zoom", null);
+ }
+ var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target));
+ window.focus();
+ d3_eventCancel();
+ }
+ function mousewheel() {
+ if (!translate0) translate0 = location(d3.mouse(this));
+ scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);
+ translateTo(d3.mouse(this), translate0);
+ dispatch(event.of(this, arguments));
+ }
+ function mousemove() {
+ translate0 = null;
+ }
+ function dblclick() {
+ var p = d3.mouse(this), l = location(p);
+ scaleTo(d3.event.shiftKey ? scale / 2 : scale * 2);
+ translateTo(p, l);
+ dispatch(event.of(this, arguments));
+ }
+ function touchstart() {
+ var touches = d3.touches(this), now = Date.now();
+ scale0 = scale;
+ translate0 = {};
+ touches.forEach(function(t) {
+ translate0[t.identifier] = location(t);
+ });
+ d3_eventCancel();
+ if (touches.length === 1) {
+ if (now - touchtime < 500) {
+ var p = touches[0], l = location(touches[0]);
+ scaleTo(scale * 2);
+ translateTo(p, l);
+ dispatch(event.of(this, arguments));
+ }
+ touchtime = now;
+ }
+ }
+ function touchmove() {
+ var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier];
+ if (p1 = touches[1]) {
+ var p1, l1 = translate0[p1.identifier];
+ p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];
+ l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
+ scaleTo(d3.event.scale * scale0);
+ }
+ translateTo(p0, l0);
+ touchtime = null;
+ dispatch(event.of(this, arguments));
+ }
+ var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
+ zoom.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = x.map(Number);
+ return zoom;
+ };
+ zoom.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return zoom;
+ };
+ zoom.scaleExtent = function(x) {
+ if (!arguments.length) return scaleExtent;
+ scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);
+ return zoom;
+ };
+ zoom.x = function(z) {
+ if (!arguments.length) return x1;
+ x1 = z;
+ x0 = z.copy();
+ return zoom;
+ };
+ zoom.y = function(z) {
+ if (!arguments.length) return y1;
+ y1 = z;
+ y0 = z.copy();
+ return zoom;
+ };
+ return d3.rebind(zoom, event, "on");
+ };
+ var d3_behavior_zoomDiv, d3_behavior_zoomInfinity = [ 0, Infinity ];
+ d3.layout = {};
+ d3.layout.bundle = function() {
+ return function(links) {
+ var paths = [], i = -1, n = links.length;
+ while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
+ return paths;
+ };
+ };
+ d3.layout.chord = function() {
+ function relayout() {
+ var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;
+ chords = [];
+ groups = [];
+ k = 0, i = -1;
+ while (++i < n) {
+ x = 0, j = -1;
+ while (++j < n) {
+ x += matrix[i][j];
+ }
+ groupSums.push(x);
+ subgroupIndex.push(d3.range(n));
+ k += x;
+ }
+ if (sortGroups) {
+ groupIndex.sort(function(a, b) {
+ return sortGroups(groupSums[a], groupSums[b]);
+ });
+ }
+ if (sortSubgroups) {
+ subgroupIndex.forEach(function(d, i) {
+ d.sort(function(a, b) {
+ return sortSubgroups(matrix[i][a], matrix[i][b]);
+ });
+ });
+ }
+ k = (2 * Math.PI - padding * n) / k;
+ x = 0, i = -1;
+ while (++i < n) {
+ x0 = x, j = -1;
+ while (++j < n) {
+ var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
+ subgroups[di + "-" + dj] = {
+ index: di,
+ subindex: dj,
+ startAngle: a0,
+ endAngle: a1,
+ value: v
+ };
+ }
+ groups[di] = {
+ index: di,
+ startAngle: x0,
+ endAngle: x,
+ value: (x - x0) / k
+ };
+ x += padding;
+ }
+ i = -1;
+ while (++i < n) {
+ j = i - 1;
+ while (++j < n) {
+ var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
+ if (source.value || target.value) {
+ chords.push(source.value < target.value ? {
+ source: target,
+ target: source
+ } : {
+ source: source,
+ target: target
+ });
+ }
+ }
+ }
+ if (sortChords) resort();
+ }
+ function resort() {
+ chords.sort(function(a, b) {
+ return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
+ });
+ }
+ var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
+ chord.matrix = function(x) {
+ if (!arguments.length) return matrix;
+ n = (matrix = x) && matrix.length;
+ chords = groups = null;
+ return chord;
+ };
+ chord.padding = function(x) {
+ if (!arguments.length) return padding;
+ padding = x;
+ chords = groups = null;
+ return chord;
+ };
+ chord.sortGroups = function(x) {
+ if (!arguments.length) return sortGroups;
+ sortGroups = x;
+ chords = groups = null;
+ return chord;
+ };
+ chord.sortSubgroups = function(x) {
+ if (!arguments.length) return sortSubgroups;
+ sortSubgroups = x;
+ chords = null;
+ return chord;
+ };
+ chord.sortChords = function(x) {
+ if (!arguments.length) return sortChords;
+ sortChords = x;
+ if (chords) resort();
+ return chord;
+ };
+ chord.chords = function() {
+ if (!chords) relayout();
+ return chords;
+ };
+ chord.groups = function() {
+ if (!groups) relayout();
+ return groups;
+ };
+ return chord;
+ };
+ d3.layout.force = function() {
+ function repulse(node) {
+ return function(quad, x1, y1, x2, y2) {
+ if (quad.point !== node) {
+ var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy);
+ if ((x2 - x1) * dn < theta) {
+ var k = quad.charge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ return true;
+ }
+ if (quad.point && isFinite(dn)) {
+ var k = quad.pointCharge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ }
+ }
+ return !quad.charge;
+ };
+ }
+ function dragmove(d) {
+ d.px = d3.event.x;
+ d.py = d3.event.y;
+ force.resume();
+ }
+ var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, interval, nodes = [], links = [], distances, strengths, charges;
+ force.tick = function() {
+ if ((alpha *= .99) < .005) {
+ event.end({
+ type: "end",
+ alpha: alpha = 0
+ });
+ return true;
+ }
+ var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ s = o.source;
+ t = o.target;
+ x = t.x - s.x;
+ y = t.y - s.y;
+ if (l = x * x + y * y) {
+ l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
+ x *= l;
+ y *= l;
+ t.x -= x * (k = s.weight / (t.weight + s.weight));
+ t.y -= y * k;
+ s.x += x * (k = 1 - k);
+ s.y += y * k;
+ }
+ }
+ if (k = alpha * gravity) {
+ x = size[0] / 2;
+ y = size[1] / 2;
+ i = -1;
+ if (k) while (++i < n) {
+ o = nodes[i];
+ o.x += (x - o.x) * k;
+ o.y += (y - o.y) * k;
+ }
+ }
+ if (charge) {
+ d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
+ i = -1;
+ while (++i < n) {
+ if (!(o = nodes[i]).fixed) {
+ q.visit(repulse(o));
+ }
+ }
+ }
+ i = -1;
+ while (++i < n) {
+ o = nodes[i];
+ if (o.fixed) {
+ o.x = o.px;
+ o.y = o.py;
+ } else {
+ o.x -= (o.px - (o.px = o.x)) * friction;
+ o.y -= (o.py - (o.py = o.y)) * friction;
+ }
+ }
+ event.tick({
+ type: "tick",
+ alpha: alpha
+ });
+ };
+ force.nodes = function(x) {
+ if (!arguments.length) return nodes;
+ nodes = x;
+ return force;
+ };
+ force.links = function(x) {
+ if (!arguments.length) return links;
+ links = x;
+ return force;
+ };
+ force.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return force;
+ };
+ force.linkDistance = function(x) {
+ if (!arguments.length) return linkDistance;
+ linkDistance = d3_functor(x);
+ return force;
+ };
+ force.distance = force.linkDistance;
+ force.linkStrength = function(x) {
+ if (!arguments.length) return linkStrength;
+ linkStrength = d3_functor(x);
+ return force;
+ };
+ force.friction = function(x) {
+ if (!arguments.length) return friction;
+ friction = x;
+ return force;
+ };
+ force.charge = function(x) {
+ if (!arguments.length) return charge;
+ charge = typeof x === "function" ? x : +x;
+ return force;
+ };
+ force.gravity = function(x) {
+ if (!arguments.length) return gravity;
+ gravity = x;
+ return force;
+ };
+ force.theta = function(x) {
+ if (!arguments.length) return theta;
+ theta = x;
+ return force;
+ };
+ force.alpha = function(x) {
+ if (!arguments.length) return alpha;
+ if (alpha) {
+ if (x > 0) alpha = x; else alpha = 0;
+ } else if (x > 0) {
+ event.start({
+ type: "start",
+ alpha: alpha = x
+ });
+ d3.timer(force.tick);
+ }
+ return force;
+ };
+ force.start = function() {
+ function position(dimension, size) {
+ var neighbors = neighbor(i), j = -1, m = neighbors.length, x;
+ while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
+ return Math.random() * size;
+ }
+ function neighbor() {
+ if (!neighbors) {
+ neighbors = [];
+ for (j = 0; j < n; ++j) {
+ neighbors[j] = [];
+ }
+ for (j = 0; j < m; ++j) {
+ var o = links[j];
+ neighbors[o.source.index].push(o.target);
+ neighbors[o.target.index].push(o.source);
+ }
+ }
+ return neighbors[i];
+ }
+ var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;
+ for (i = 0; i < n; ++i) {
+ (o = nodes[i]).index = i;
+ o.weight = 0;
+ }
+ distances = [];
+ strengths = [];
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ if (typeof o.source == "number") o.source = nodes[o.source];
+ if (typeof o.target == "number") o.target = nodes[o.target];
+ distances[i] = linkDistance.call(this, o, i);
+ strengths[i] = linkStrength.call(this, o, i);
+ ++o.source.weight;
+ ++o.target.weight;
+ }
+ for (i = 0; i < n; ++i) {
+ o = nodes[i];
+ if (isNaN(o.x)) o.x = position("x", w);
+ if (isNaN(o.y)) o.y = position("y", h);
+ if (isNaN(o.px)) o.px = o.x;
+ if (isNaN(o.py)) o.py = o.y;
+ }
+ charges = [];
+ if (typeof charge === "function") {
+ for (i = 0; i < n; ++i) {
+ charges[i] = +charge.call(this, nodes[i], i);
+ }
+ } else {
+ for (i = 0; i < n; ++i) {
+ charges[i] = charge;
+ }
+ }
+ return force.resume();
+ };
+ force.resume = function() {
+ return force.alpha(.1);
+ };
+ force.stop = function() {
+ return force.alpha(0);
+ };
+ force.drag = function() {
+ if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart", d3_layout_forceDragstart).on("drag", dragmove).on("dragend", d3_layout_forceDragend);
+ this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);
+ };
+ return d3.rebind(force, event, "on");
+ };
+ d3.layout.partition = function() {
+ function position(node, x, dx, dy) {
+ var children = node.children;
+ node.x = x;
+ node.y = node.depth * dy;
+ node.dx = dx;
+ node.dy = dy;
+ if (children && (n = children.length)) {
+ var i = -1, n, c, d;
+ dx = node.value ? dx / node.value : 0;
+ while (++i < n) {
+ position(c = children[i], x, d = c.value * dx, dy);
+ x += d;
+ }
+ }
+ }
+ function depth(node) {
+ var children = node.children, d = 0;
+ if (children && (n = children.length)) {
+ var i = -1, n;
+ while (++i < n) d = Math.max(d, depth(children[i]));
+ }
+ return 1 + d;
+ }
+ function partition(d, i) {
+ var nodes = hierarchy.call(this, d, i);
+ position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];
+ partition.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return partition;
+ };
+ return d3_layout_hierarchyRebind(partition, hierarchy);
+ };
+ d3.layout.pie = function() {
+ function pie(data, i) {
+ var values = data.map(function(d, i) {
+ return +value.call(pie, d, i);
+ });
+ var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle);
+ var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - startAngle) / d3.sum(values);
+ var index = d3.range(data.length);
+ if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
+ return values[j] - values[i];
+ } : function(i, j) {
+ return sort(data[i], data[j]);
+ });
+ var arcs = [];
+ index.forEach(function(i) {
+ var d;
+ arcs[i] = {
+ data: data[i],
+ value: d = values[i],
+ startAngle: a,
+ endAngle: a += d * k
+ };
+ });
+ return arcs;
+ }
+ var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * Math.PI;
+ pie.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return pie;
+ };
+ pie.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return pie;
+ };
+ pie.startAngle = function(x) {
+ if (!arguments.length) return startAngle;
+ startAngle = x;
+ return pie;
+ };
+ pie.endAngle = function(x) {
+ if (!arguments.length) return endAngle;
+ endAngle = x;
+ return pie;
+ };
+ return pie;
+ };
+ var d3_layout_pieSortByValue = {};
+ d3.layout.stack = function() {
+ function stack(data, index) {
+ var series = data.map(function(d, i) {
+ return values.call(stack, d, i);
+ });
+ var points = series.map(function(d, i) {
+ return d.map(function(v, i) {
+ return [ x.call(stack, v, i), y.call(stack, v, i) ];
+ });
+ });
+ var orders = order.call(stack, points, index);
+ series = d3.permute(series, orders);
+ points = d3.permute(points, orders);
+ var offsets = offset.call(stack, points, index);
+ var n = series.length, m = series[0].length, i, j, o;
+ for (j = 0; j < m; ++j) {
+ out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
+ for (i = 1; i < n; ++i) {
+ out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
+ }
+ }
+ return data;
+ }
+ var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
+ stack.values = function(x) {
+ if (!arguments.length) return values;
+ values = x;
+ return stack;
+ };
+ stack.order = function(x) {
+ if (!arguments.length) return order;
+ order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
+ return stack;
+ };
+ stack.offset = function(x) {
+ if (!arguments.length) return offset;
+ offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
+ return stack;
+ };
+ stack.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ return stack;
+ };
+ stack.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ return stack;
+ };
+ stack.out = function(z) {
+ if (!arguments.length) return out;
+ out = z;
+ return stack;
+ };
+ return stack;
+ };
+ var d3_layout_stackOrders = d3.map({
+ "inside-out": function(data) {
+ var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) {
+ return max[a] - max[b];
+ }), top = 0, bottom = 0, tops = [], bottoms = [];
+ for (i = 0; i < n; ++i) {
+ j = index[i];
+ if (top < bottom) {
+ top += sums[j];
+ tops.push(j);
+ } else {
+ bottom += sums[j];
+ bottoms.push(j);
+ }
+ }
+ return bottoms.reverse().concat(tops);
+ },
+ reverse: function(data) {
+ return d3.range(data.length).reverse();
+ },
+ "default": d3_layout_stackOrderDefault
+ });
+ var d3_layout_stackOffsets = d3.map({
+ silhouette: function(data) {
+ var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o > max) max = o;
+ sums.push(o);
+ }
+ for (j = 0; j < m; ++j) {
+ y0[j] = (max - sums[j]) / 2;
+ }
+ return y0;
+ },
+ wiggle: function(data) {
+ var n = data.length, x = data[0], m = x.length, max = 0, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];
+ y0[0] = o = o0 = 0;
+ for (j = 1; j < m; ++j) {
+ for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
+ for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
+ for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
+ s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
+ }
+ s2 += s3 * data[i][j][1];
+ }
+ y0[j] = o -= s1 ? s2 / s1 * dx : 0;
+ if (o < o0) o0 = o;
+ }
+ for (j = 0; j < m; ++j) y0[j] -= o0;
+ return y0;
+ },
+ expand: function(data) {
+ var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k;
+ }
+ for (j = 0; j < m; ++j) y0[j] = 0;
+ return y0;
+ },
+ zero: d3_layout_stackOffsetZero
+ });
+ d3.layout.histogram = function() {
+ function histogram(data, i) {
+ var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x;
+ while (++i < m) {
+ bin = bins[i] = [];
+ bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
+ bin.y = 0;
+ }
+ if (m > 0) {
+ i = -1;
+ while (++i < n) {
+ x = values[i];
+ if (x >= range[0] && x <= range[1]) {
+ bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
+ bin.y += k;
+ bin.push(data[i]);
+ }
+ }
+ }
+ return bins;
+ }
+ var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;
+ histogram.value = function(x) {
+ if (!arguments.length) return valuer;
+ valuer = x;
+ return histogram;
+ };
+ histogram.range = function(x) {
+ if (!arguments.length) return ranger;
+ ranger = d3_functor(x);
+ return histogram;
+ };
+ histogram.bins = function(x) {
+ if (!arguments.length) return binner;
+ binner = typeof x === "number" ? function(range) {
+ return d3_layout_histogramBinFixed(range, x);
+ } : d3_functor(x);
+ return histogram;
+ };
+ histogram.frequency = function(x) {
+ if (!arguments.length) return frequency;
+ frequency = !!x;
+ return histogram;
+ };
+ return histogram;
+ };
+ d3.layout.hierarchy = function() {
+ function recurse(data, depth, nodes) {
+ var childs = children.call(hierarchy, data, depth), node = d3_layout_hierarchyInline ? data : {
+ data: data
+ };
+ node.depth = depth;
+ nodes.push(node);
+ if (childs && (n = childs.length)) {
+ var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d;
+ while (++i < n) {
+ d = recurse(childs[i], j, nodes);
+ d.parent = node;
+ c.push(d);
+ v += d.value;
+ }
+ if (sort) c.sort(sort);
+ if (value) node.value = v;
+ } else if (value) {
+ node.value = +value.call(hierarchy, data, depth) || 0;
+ }
+ return node;
+ }
+ function revalue(node, depth) {
+ var children = node.children, v = 0;
+ if (children && (n = children.length)) {
+ var i = -1, n, j = depth + 1;
+ while (++i < n) v += revalue(children[i], j);
+ } else if (value) {
+ v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0;
+ }
+ if (value) node.value = v;
+ return v;
+ }
+ function hierarchy(d) {
+ var nodes = [];
+ recurse(d, 0, nodes);
+ return nodes;
+ }
+ var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;
+ hierarchy.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return hierarchy;
+ };
+ hierarchy.children = function(x) {
+ if (!arguments.length) return children;
+ children = x;
+ return hierarchy;
+ };
+ hierarchy.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return hierarchy;
+ };
+ hierarchy.revalue = function(root) {
+ revalue(root, 0);
+ return root;
+ };
+ return hierarchy;
+ };
+ var d3_layout_hierarchyInline = false;
+ d3.layout.pack = function() {
+ function pack(d, i) {
+ var nodes = hierarchy.call(this, d, i), root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r = Math.sqrt(d.value);
+ });
+ d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
+ var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h);
+ if (padding > 0) {
+ var dr = padding * k / 2;
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r += dr;
+ });
+ d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r -= dr;
+ });
+ k = Math.max(2 * root.r / w, 2 * root.r / h);
+ }
+ d3_layout_packTransform(root, w / 2, h / 2, 1 / k);
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ];
+ pack.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return pack;
+ };
+ pack.padding = function(_) {
+ if (!arguments.length) return padding;
+ padding = +_;
+ return pack;
+ };
+ return d3_layout_hierarchyRebind(pack, hierarchy);
+ };
+ d3.layout.cluster = function() {
+ function cluster(d, i) {
+ var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0, kx, ky;
+ d3_layout_treeVisitAfter(root, function(node) {
+ var children = node.children;
+ if (children && children.length) {
+ node.x = d3_layout_clusterX(children);
+ node.y = d3_layout_clusterY(children);
+ } else {
+ node.x = previousNode ? x += separation(node, previousNode) : 0;
+ node.y = 0;
+ previousNode = node;
+ }
+ });
+ var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
+ });
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
+ cluster.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return cluster;
+ };
+ cluster.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return cluster;
+ };
+ return d3_layout_hierarchyRebind(cluster, hierarchy);
+ };
+ d3.layout.tree = function() {
+ function tree(d, i) {
+ function firstWalk(node, previousSibling) {
+ var children = node.children, layout = node._tree;
+ if (children && (n = children.length)) {
+ var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;
+ while (++i < n) {
+ child = children[i];
+ firstWalk(child, previousChild);
+ ancestor = apportion(child, previousChild, ancestor);
+ previousChild = child;
+ }
+ d3_layout_treeShift(node);
+ var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ layout.mod = layout.prelim - midpoint;
+ } else {
+ layout.prelim = midpoint;
+ }
+ } else {
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ }
+ }
+ }
+ function secondWalk(node, x) {
+ node.x = node._tree.prelim + x;
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var i = -1, n;
+ x += node._tree.mod;
+ while (++i < n) {
+ secondWalk(children[i], x);
+ }
+ }
+ }
+ function apportion(node, previousSibling, ancestor) {
+ if (previousSibling) {
+ var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift;
+ while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
+ vom = d3_layout_treeLeft(vom);
+ vop = d3_layout_treeRight(vop);
+ vop._tree.ancestor = node;
+ shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
+ if (shift > 0) {
+ d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
+ sip += shift;
+ sop += shift;
+ }
+ sim += vim._tree.mod;
+ sip += vip._tree.mod;
+ som += vom._tree.mod;
+ sop += vop._tree.mod;
+ }
+ if (vim && !d3_layout_treeRight(vop)) {
+ vop._tree.thread = vim;
+ vop._tree.mod += sim - sop;
+ }
+ if (vip && !d3_layout_treeLeft(vom)) {
+ vom._tree.thread = vip;
+ vom._tree.mod += sip - som;
+ ancestor = node;
+ }
+ }
+ return ancestor;
+ }
+ var nodes = hierarchy.call(this, d, i), root = nodes[0];
+ d3_layout_treeVisitAfter(root, function(node, previousSibling) {
+ node._tree = {
+ ancestor: node,
+ prelim: 0,
+ mod: 0,
+ change: 0,
+ shift: 0,
+ number: previousSibling ? previousSibling._tree.number + 1 : 0
+ };
+ });
+ firstWalk(root);
+ secondWalk(root, -root._tree.prelim);
+ var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1;
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = node.depth / y1 * size[1];
+ delete node._tree;
+ });
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
+ tree.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return tree;
+ };
+ tree.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return tree;
+ };
+ return d3_layout_hierarchyRebind(tree, hierarchy);
+ };
+ d3.layout.treemap = function() {
+ function scale(children, k) {
+ var i = -1, n = children.length, child, area;
+ while (++i < n) {
+ area = (child = children[i]).value * (k < 0 ? 0 : k);
+ child.area = isNaN(area) || area <= 0 ? 0 : area;
+ }
+ }
+ function squarify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = Math.min(rect.dx, rect.dy), n;
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while ((n = remaining.length) > 0) {
+ row.push(child = remaining[n - 1]);
+ row.area += child.area;
+ if ((score = worst(row, u)) <= best) {
+ remaining.pop();
+ best = score;
+ } else {
+ row.area -= row.pop().area;
+ position(row, u, rect, false);
+ u = Math.min(rect.dx, rect.dy);
+ row.length = row.area = 0;
+ best = Infinity;
+ }
+ }
+ if (row.length) {
+ position(row, u, rect, true);
+ row.length = row.area = 0;
+ }
+ children.forEach(squarify);
+ }
+ }
+ function stickify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node), remaining = children.slice(), child, row = [];
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while (child = remaining.pop()) {
+ row.push(child);
+ row.area += child.area;
+ if (child.z != null) {
+ position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
+ row.length = row.area = 0;
+ }
+ }
+ children.forEach(stickify);
+ }
+ }
+ function worst(row, u) {
+ var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;
+ while (++i < n) {
+ if (!(r = row[i].area)) continue;
+ if (r < rmin) rmin = r;
+ if (r > rmax) rmax = r;
+ }
+ s *= s;
+ u *= u;
+ return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;
+ }
+ function position(row, u, rect, flush) {
+ var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
+ if (u == rect.dx) {
+ if (flush || v > rect.dy) v = rect.dy;
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dy = v;
+ x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
+ }
+ o.z = true;
+ o.dx += rect.x + rect.dx - x;
+ rect.y += v;
+ rect.dy -= v;
+ } else {
+ if (flush || v > rect.dx) v = rect.dx;
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dx = v;
+ y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
+ }
+ o.z = false;
+ o.dy += rect.y + rect.dy - y;
+ rect.x += v;
+ rect.dx -= v;
+ }
+ }
+ function treemap(d) {
+ var nodes = stickies || hierarchy(d), root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ root.dx = size[0];
+ root.dy = size[1];
+ if (stickies) hierarchy.revalue(root);
+ scale([ root ], root.dx * root.dy / root.value);
+ (stickies ? stickify : squarify)(root);
+ if (sticky) stickies = nodes;
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, ratio = .5 * (1 + Math.sqrt(5));
+ treemap.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return treemap;
+ };
+ treemap.padding = function(x) {
+ function padFunction(node) {
+ var p = x.call(treemap, node, node.depth);
+ return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);
+ }
+ function padConstant(node) {
+ return d3_layout_treemapPad(node, x);
+ }
+ if (!arguments.length) return padding;
+ var type;
+ pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], padConstant) : padConstant;
+ return treemap;
+ };
+ treemap.round = function(x) {
+ if (!arguments.length) return round != Number;
+ round = x ? Math.round : Number;
+ return treemap;
+ };
+ treemap.sticky = function(x) {
+ if (!arguments.length) return sticky;
+ sticky = x;
+ stickies = null;
+ return treemap;
+ };
+ treemap.ratio = function(x) {
+ if (!arguments.length) return ratio;
+ ratio = x;
+ return treemap;
+ };
+ return d3_layout_hierarchyRebind(treemap, hierarchy);
+ };
+ d3.csv = d3_dsv(",", "text/csv");
+ d3.tsv = d3_dsv(" ", "text/tab-separated-values");
+ d3.geo = {};
+ var d3_geo_radians = Math.PI / 180;
+ d3.geo.azimuthal = function() {
+ function azimuthal(coordinates) {
+ var x1 = coordinates[0] * d3_geo_radians - x0, y1 = coordinates[1] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1), cy1 = Math.cos(y1), sy1 = Math.sin(y1), cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null, c, k = mode === "stereographic" ? 1 / (1 + cc) : mode === "gnomonic" ? 1 / cc : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0) : mode === "equalarea" ? Math.sqrt(2 / (1 + cc)) : 1, x = k * cy1 * sx1, y = k * (sy0 * cy1 * cx1 - cy0 * sy1);
+ return [ scale * x + translate[0], scale * y + translate[1] ];
+ }
+ var mode = "orthographic", origin, scale = 200, translate = [ 480, 250 ], x0, y0, cy0, sy0;
+ azimuthal.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p = Math.sqrt(x * x + y * y), c = mode === "stereographic" ? 2 * Math.atan(p) : mode === "gnomonic" ? Math.atan(p) : mode === "equidistant" ? p : mode === "equalarea" ? 2 * Math.asin(.5 * p) : Math.asin(p), sc = Math.sin(c), cc = Math.cos(c);
+ return [ (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians, Math.asin(cc * sy0 - (p ? y * sc * cy0 / p : 0)) / d3_geo_radians ];
+ };
+ azimuthal.mode = function(x) {
+ if (!arguments.length) return mode;
+ mode = x + "";
+ return azimuthal;
+ };
+ azimuthal.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ x0 = origin[0] * d3_geo_radians;
+ y0 = origin[1] * d3_geo_radians;
+ cy0 = Math.cos(y0);
+ sy0 = Math.sin(y0);
+ return azimuthal;
+ };
+ azimuthal.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return azimuthal;
+ };
+ azimuthal.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return azimuthal;
+ };
+ return azimuthal.origin([ 0, 0 ]);
+ };
+ d3.geo.albers = function() {
+ function albers(coordinates) {
+ var t = n * (d3_geo_radians * coordinates[0] - lng0), p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n;
+ return [ scale * p * Math.sin(t) + translate[0], scale * (p * Math.cos(t) - p0) + translate[1] ];
+ }
+ function reload() {
+ var phi1 = d3_geo_radians * parallels[0], phi2 = d3_geo_radians * parallels[1], lat0 = d3_geo_radians * origin[1], s = Math.sin(phi1), c = Math.cos(phi1);
+ lng0 = d3_geo_radians * origin[0];
+ n = .5 * (s + Math.sin(phi2));
+ C = c * c + 2 * n * s;
+ p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n;
+ return albers;
+ }
+ var origin = [ -98, 38 ], parallels = [ 29.5, 45.5 ], scale = 1e3, translate = [ 480, 250 ], lng0, n, C, p0;
+ albers.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p0y = p0 + y, t = Math.atan2(x, p0y), p = Math.sqrt(x * x + p0y * p0y);
+ return [ (lng0 + t / n) / d3_geo_radians, Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians ];
+ };
+ albers.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = [ +x[0], +x[1] ];
+ return reload();
+ };
+ albers.parallels = function(x) {
+ if (!arguments.length) return parallels;
+ parallels = [ +x[0], +x[1] ];
+ return reload();
+ };
+ albers.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return albers;
+ };
+ albers.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return albers;
+ };
+ return reload();
+ };
+ d3.geo.albersUsa = function() {
+ function albersUsa(coordinates) {
+ var lon = coordinates[0], lat = coordinates[1];
+ return (lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48)(coordinates);
+ }
+ var lower48 = d3.geo.albers();
+ var alaska = d3.geo.albers().origin([ -160, 60 ]).parallels([ 55, 65 ]);
+ var hawaii = d3.geo.albers().origin([ -160, 20 ]).parallels([ 8, 18 ]);
+ var puertoRico = d3.geo.albers().origin([ -60, 10 ]).parallels([ 8, 18 ]);
+ albersUsa.scale = function(x) {
+ if (!arguments.length) return lower48.scale();
+ lower48.scale(x);
+ alaska.scale(x * .6);
+ hawaii.scale(x);
+ puertoRico.scale(x * 1.5);
+ return albersUsa.translate(lower48.translate());
+ };
+ albersUsa.translate = function(x) {
+ if (!arguments.length) return lower48.translate();
+ var dz = lower48.scale() / 1e3, dx = x[0], dy = x[1];
+ lower48.translate(x);
+ alaska.translate([ dx - 400 * dz, dy + 170 * dz ]);
+ hawaii.translate([ dx - 190 * dz, dy + 200 * dz ]);
+ puertoRico.translate([ dx + 580 * dz, dy + 430 * dz ]);
+ return albersUsa;
+ };
+ return albersUsa.scale(lower48.scale());
+ };
+ d3.geo.bonne = function() {
+ function bonne(coordinates) {
+ var x = coordinates[0] * d3_geo_radians - x0, y = coordinates[1] * d3_geo_radians - y0;
+ if (y1) {
+ var p = c1 + y1 - y, E = x * Math.cos(y) / p;
+ x = p * Math.sin(E);
+ y = p * Math.cos(E) - c1;
+ } else {
+ x *= Math.cos(y);
+ y *= -1;
+ }
+ return [ scale * x + translate[0], scale * y + translate[1] ];
+ }
+ var scale = 200, translate = [ 480, 250 ], x0, y0, y1, c1;
+ bonne.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
+ if (y1) {
+ var c = c1 + y, p = Math.sqrt(x * x + c * c);
+ y = c1 + y1 - p;
+ x = x0 + p * Math.atan2(x, c) / Math.cos(y);
+ } else {
+ y *= -1;
+ x /= Math.cos(y);
+ }
+ return [ x / d3_geo_radians, y / d3_geo_radians ];
+ };
+ bonne.parallel = function(x) {
+ if (!arguments.length) return y1 / d3_geo_radians;
+ c1 = 1 / Math.tan(y1 = x * d3_geo_radians);
+ return bonne;
+ };
+ bonne.origin = function(x) {
+ if (!arguments.length) return [ x0 / d3_geo_radians, y0 / d3_geo_radians ];
+ x0 = x[0] * d3_geo_radians;
+ y0 = x[1] * d3_geo_radians;
+ return bonne;
+ };
+ bonne.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return bonne;
+ };
+ bonne.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return bonne;
+ };
+ return bonne.origin([ 0, 0 ]).parallel(45);
+ };
+ d3.geo.equirectangular = function() {
+ function equirectangular(coordinates) {
+ var x = coordinates[0] / 360, y = -coordinates[1] / 360;
+ return [ scale * x + translate[0], scale * y + translate[1] ];
+ }
+ var scale = 500, translate = [ 480, 250 ];
+ equirectangular.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
+ return [ 360 * x, -360 * y ];
+ };
+ equirectangular.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return equirectangular;
+ };
+ equirectangular.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return equirectangular;
+ };
+ return equirectangular;
+ };
+ d3.geo.mercator = function() {
+ function mercator(coordinates) {
+ var x = coordinates[0] / 360, y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360;
+ return [ scale * x + translate[0], scale * Math.max(-.5, Math.min(.5, y)) + translate[1] ];
+ }
+ var scale = 500, translate = [ 480, 250 ];
+ mercator.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
+ return [ 360 * x, 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90 ];
+ };
+ mercator.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return mercator;
+ };
+ mercator.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return mercator;
+ };
+ return mercator;
+ };
+ d3.geo.path = function() {
+ function path(d, i) {
+ if (typeof pointRadius === "function") pointCircle = d3_path_circle(pointRadius.apply(this, arguments));
+ pathType(d);
+ var result = buffer.length ? buffer.join("") : null;
+ buffer = [];
+ return result;
+ }
+ function project(coordinates) {
+ return projection(coordinates).join(",");
+ }
+ function polygonArea(coordinates) {
+ var sum = area(coordinates[0]), i = 0, n = coordinates.length;
+ while (++i < n) sum -= area(coordinates[i]);
+ return sum;
+ }
+ function polygonCentroid(coordinates) {
+ var polygon = d3.geom.polygon(coordinates[0].map(projection)), area = polygon.area(), centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1), x = centroid[0], y = centroid[1], z = area, i = 0, n = coordinates.length;
+ while (++i < n) {
+ polygon = d3.geom.polygon(coordinates[i].map(projection));
+ area = polygon.area();
+ centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1);
+ x -= centroid[0];
+ y -= centroid[1];
+ z -= area;
+ }
+ return [ x, y, 6 * z ];
+ }
+ function area(coordinates) {
+ return Math.abs(d3.geom.polygon(coordinates.map(projection)).area());
+ }
+ var pointRadius = 4.5, pointCircle = d3_path_circle(pointRadius), projection = d3.geo.albersUsa(), buffer = [];
+ var pathType = d3_geo_type({
+ FeatureCollection: function(o) {
+ var features = o.features, i = -1, n = features.length;
+ while (++i < n) buffer.push(pathType(features[i].geometry));
+ },
+ Feature: function(o) {
+ pathType(o.geometry);
+ },
+ Point: function(o) {
+ buffer.push("M", project(o.coordinates), pointCircle);
+ },
+ MultiPoint: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length;
+ while (++i < n) buffer.push("M", project(coordinates[i]), pointCircle);
+ },
+ LineString: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length;
+ buffer.push("M");
+ while (++i < n) buffer.push(project(coordinates[i]), "L");
+ buffer.pop();
+ },
+ MultiLineString: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;
+ while (++i < n) {
+ subcoordinates = coordinates[i];
+ j = -1;
+ m = subcoordinates.length;
+ buffer.push("M");
+ while (++j < m) buffer.push(project(subcoordinates[j]), "L");
+ buffer.pop();
+ }
+ },
+ Polygon: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;
+ while (++i < n) {
+ subcoordinates = coordinates[i];
+ j = -1;
+ if ((m = subcoordinates.length - 1) > 0) {
+ buffer.push("M");
+ while (++j < m) buffer.push(project(subcoordinates[j]), "L");
+ buffer[buffer.length - 1] = "Z";
+ }
+ }
+ },
+ MultiPolygon: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m, subsubcoordinates, k, p;
+ while (++i < n) {
+ subcoordinates = coordinates[i];
+ j = -1;
+ m = subcoordinates.length;
+ while (++j < m) {
+ subsubcoordinates = subcoordinates[j];
+ k = -1;
+ if ((p = subsubcoordinates.length - 1) > 0) {
+ buffer.push("M");
+ while (++k < p) buffer.push(project(subsubcoordinates[k]), "L");
+ buffer[buffer.length - 1] = "Z";
+ }
+ }
+ }
+ },
+ GeometryCollection: function(o) {
+ var geometries = o.geometries, i = -1, n = geometries.length;
+ while (++i < n) buffer.push(pathType(geometries[i]));
+ }
+ });
+ var areaType = path.area = d3_geo_type({
+ FeatureCollection: function(o) {
+ var area = 0, features = o.features, i = -1, n = features.length;
+ while (++i < n) area += areaType(features[i]);
+ return area;
+ },
+ Feature: function(o) {
+ return areaType(o.geometry);
+ },
+ Polygon: function(o) {
+ return polygonArea(o.coordinates);
+ },
+ MultiPolygon: function(o) {
+ var sum = 0, coordinates = o.coordinates, i = -1, n = coordinates.length;
+ while (++i < n) sum += polygonArea(coordinates[i]);
+ return sum;
+ },
+ GeometryCollection: function(o) {
+ var sum = 0, geometries = o.geometries, i = -1, n = geometries.length;
+ while (++i < n) sum += areaType(geometries[i]);
+ return sum;
+ }
+ }, 0);
+ var centroidType = path.centroid = d3_geo_type({
+ Feature: function(o) {
+ return centroidType(o.geometry);
+ },
+ Polygon: function(o) {
+ var centroid = polygonCentroid(o.coordinates);
+ return [ centroid[0] / centroid[2], centroid[1] / centroid[2] ];
+ },
+ MultiPolygon: function(o) {
+ var area = 0, coordinates = o.coordinates, centroid, x = 0, y = 0, z = 0, i = -1, n = coordinates.length;
+ while (++i < n) {
+ centroid = polygonCentroid(coordinates[i]);
+ x += centroid[0];
+ y += centroid[1];
+ z += centroid[2];
+ }
+ return [ x / z, y / z ];
+ }
+ });
+ path.projection = function(x) {
+ projection = x;
+ return path;
+ };
+ path.pointRadius = function(x) {
+ if (typeof x === "function") pointRadius = x; else {
+ pointRadius = +x;
+ pointCircle = d3_path_circle(pointRadius);
+ }
+ return path;
+ };
+ return path;
+ };
+ d3.geo.bounds = function(feature) {
+ var left = Infinity, bottom = Infinity, right = -Infinity, top = -Infinity;
+ d3_geo_bounds(feature, function(x, y) {
+ if (x < left) left = x;
+ if (x > right) right = x;
+ if (y < bottom) bottom = y;
+ if (y > top) top = y;
+ });
+ return [ [ left, bottom ], [ right, top ] ];
+ };
+ var d3_geo_boundsTypes = {
+ Feature: d3_geo_boundsFeature,
+ FeatureCollection: d3_geo_boundsFeatureCollection,
+ GeometryCollection: d3_geo_boundsGeometryCollection,
+ LineString: d3_geo_boundsLineString,
+ MultiLineString: d3_geo_boundsMultiLineString,
+ MultiPoint: d3_geo_boundsLineString,
+ MultiPolygon: d3_geo_boundsMultiPolygon,
+ Point: d3_geo_boundsPoint,
+ Polygon: d3_geo_boundsPolygon
+ };
+ d3.geo.circle = function() {
+ function circle() {}
+ function visible(point) {
+ return arc.distance(point) < radians;
+ }
+ function clip(coordinates) {
+ var i = -1, n = coordinates.length, clipped = [], p0, p1, p2, d0, d1;
+ while (++i < n) {
+ d1 = arc.distance(p2 = coordinates[i]);
+ if (d1 < radians) {
+ if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));
+ clipped.push(p2);
+ p0 = p1 = null;
+ } else {
+ p1 = p2;
+ if (!p0 && clipped.length) {
+ clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0)));
+ p0 = p1;
+ }
+ }
+ d0 = d1;
+ }
+ p0 = coordinates[0];
+ p1 = clipped[0];
+ if (p1 && p2[0] === p0[0] && p2[1] === p0[1] && !(p2[0] === p1[0] && p2[1] === p1[1])) {
+ clipped.push(p1);
+ }
+ return resample(clipped);
+ }
+ function resample(coordinates) {
+ var i = 0, n = coordinates.length, j, m, resampled = n ? [ coordinates[0] ] : coordinates, resamples, origin = arc.source();
+ while (++i < n) {
+ resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates;
+ for (j = 0, m = resamples.length; ++j < m; ) resampled.push(resamples[j]);
+ }
+ arc.source(origin);
+ return resampled;
+ }
+ var origin = [ 0, 0 ], degrees = 90 - .01, radians = degrees * d3_geo_radians, arc = d3.geo.greatArc().source(origin).target(d3_identity);
+ circle.clip = function(d) {
+ if (typeof origin === "function") arc.source(origin.apply(this, arguments));
+ return clipType(d) || null;
+ };
+ var clipType = d3_geo_type({
+ FeatureCollection: function(o) {
+ var features = o.features.map(clipType).filter(d3_identity);
+ return features && (o = Object.create(o), o.features = features, o);
+ },
+ Feature: function(o) {
+ var geometry = clipType(o.geometry);
+ return geometry && (o = Object.create(o), o.geometry = geometry, o);
+ },
+ Point: function(o) {
+ return visible(o.coordinates) && o;
+ },
+ MultiPoint: function(o) {
+ var coordinates = o.coordinates.filter(visible);
+ return coordinates.length && {
+ type: o.type,
+ coordinates: coordinates
+ };
+ },
+ LineString: function(o) {
+ var coordinates = clip(o.coordinates);
+ return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+ MultiLineString: function(o) {
+ var coordinates = o.coordinates.map(clip).filter(function(d) {
+ return d.length;
+ });
+ return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+ Polygon: function(o) {
+ var coordinates = o.coordinates.map(clip);
+ return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+ MultiPolygon: function(o) {
+ var coordinates = o.coordinates.map(function(d) {
+ return d.map(clip);
+ }).filter(function(d) {
+ return d[0].length;
+ });
+ return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+ GeometryCollection: function(o) {
+ var geometries = o.geometries.map(clipType).filter(d3_identity);
+ return geometries.length && (o = Object.create(o), o.geometries = geometries, o);
+ }
+ });
+ circle.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ if (typeof origin !== "function") arc.source(origin);
+ return circle;
+ };
+ circle.angle = function(x) {
+ if (!arguments.length) return degrees;
+ radians = (degrees = +x) * d3_geo_radians;
+ return circle;
+ };
+ return d3.rebind(circle, arc, "precision");
+ };
+ d3.geo.greatArc = function() {
+ function greatArc() {
+ var d = greatArc.distance.apply(this, arguments), t = 0, dt = precision / d, coordinates = [ p0 ];
+ while ((t += dt) < 1) coordinates.push(interpolate(t));
+ coordinates.push(p1);
+ return {
+ type: "LineString",
+ coordinates: coordinates
+ };
+ }
+ var source = d3_geo_greatArcSource, p0, target = d3_geo_greatArcTarget, p1, precision = 6 * d3_geo_radians, interpolate = d3_geo_greatArcInterpolator();
+ greatArc.distance = function() {
+ if (typeof source === "function") interpolate.source(p0 = source.apply(this, arguments));
+ if (typeof target === "function") interpolate.target(p1 = target.apply(this, arguments));
+ return interpolate.distance();
+ };
+ greatArc.source = function(_) {
+ if (!arguments.length) return source;
+ source = _;
+ if (typeof source !== "function") interpolate.source(p0 = source);
+ return greatArc;
+ };
+ greatArc.target = function(_) {
+ if (!arguments.length) return target;
+ target = _;
+ if (typeof target !== "function") interpolate.target(p1 = target);
+ return greatArc;
+ };
+ greatArc.precision = function(_) {
+ if (!arguments.length) return precision / d3_geo_radians;
+ precision = _ * d3_geo_radians;
+ return greatArc;
+ };
+ return greatArc;
+ };
+ d3.geo.greatCircle = d3.geo.circle;
+ d3.geom = {};
+ d3.geom.contour = function(grid, start) {
+ var s = start || d3_geom_contourStart(grid), c = [], x = s[0], y = s[1], dx = 0, dy = 0, pdx = NaN, pdy = NaN, i = 0;
+ do {
+ i = 0;
+ if (grid(x - 1, y - 1)) i += 1;
+ if (grid(x, y - 1)) i += 2;
+ if (grid(x - 1, y)) i += 4;
+ if (grid(x, y)) i += 8;
+ if (i === 6) {
+ dx = pdy === -1 ? -1 : 1;
+ dy = 0;
+ } else if (i === 9) {
+ dx = 0;
+ dy = pdx === 1 ? -1 : 1;
+ } else {
+ dx = d3_geom_contourDx[i];
+ dy = d3_geom_contourDy[i];
+ }
+ if (dx != pdx && dy != pdy) {
+ c.push([ x, y ]);
+ pdx = dx;
+ pdy = dy;
+ }
+ x += dx;
+ y += dy;
+ } while (s[0] != x || s[1] != y);
+ return c;
+ };
+ var d3_geom_contourDx = [ 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 0, 0, -1, 0, -1, NaN ], d3_geom_contourDy = [ 0, -1, 0, 0, 0, -1, 0, 0, 1, -1, 1, 1, 0, -1, 0, NaN ];
+ d3.geom.hull = function(vertices) {
+ if (vertices.length < 3) return [];
+ var len = vertices.length, plen = len - 1, points = [], stack = [], i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
+ for (i = 1; i < len; ++i) {
+ if (vertices[i][1] < vertices[h][1]) {
+ h = i;
+ } else if (vertices[i][1] == vertices[h][1]) {
+ h = vertices[i][0] < vertices[h][0] ? i : h;
+ }
+ }
+ for (i = 0; i < len; ++i) {
+ if (i === h) continue;
+ y1 = vertices[i][1] - vertices[h][1];
+ x1 = vertices[i][0] - vertices[h][0];
+ points.push({
+ angle: Math.atan2(y1, x1),
+ index: i
+ });
+ }
+ points.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ a = points[0].angle;
+ v = points[0].index;
+ u = 0;
+ for (i = 1; i < plen; ++i) {
+ j = points[i].index;
+ if (a == points[i].angle) {
+ x1 = vertices[v][0] - vertices[h][0];
+ y1 = vertices[v][1] - vertices[h][1];
+ x2 = vertices[j][0] - vertices[h][0];
+ y2 = vertices[j][1] - vertices[h][1];
+ if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) {
+ points[i].index = -1;
+ } else {
+ points[u].index = -1;
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ } else {
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ }
+ stack.push(h);
+ for (i = 0, j = 0; i < 2; ++j) {
+ if (points[j].index !== -1) {
+ stack.push(points[j].index);
+ i++;
+ }
+ }
+ sp = stack.length;
+ for (; j < plen; ++j) {
+ if (points[j].index === -1) continue;
+ while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) {
+ --sp;
+ }
+ stack[sp++] = points[j].index;
+ }
+ var poly = [];
+ for (i = 0; i < sp; ++i) {
+ poly.push(vertices[stack[i]]);
+ }
+ return poly;
+ };
+ d3.geom.polygon = function(coordinates) {
+ coordinates.area = function() {
+ var i = 0, n = coordinates.length, a = coordinates[n - 1][0] * coordinates[0][1], b = coordinates[n - 1][1] * coordinates[0][0];
+ while (++i < n) {
+ a += coordinates[i - 1][0] * coordinates[i][1];
+ b += coordinates[i - 1][1] * coordinates[i][0];
+ }
+ return (b - a) * .5;
+ };
+ coordinates.centroid = function(k) {
+ var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c;
+ if (!arguments.length) k = -1 / (6 * coordinates.area());
+ while (++i < n) {
+ a = b;
+ b = coordinates[i];
+ c = a[0] * b[1] - b[0] * a[1];
+ x += (a[0] + b[0]) * c;
+ y += (a[1] + b[1]) * c;
+ }
+ return [ x * k, y * k ];
+ };
+ coordinates.clip = function(subject) {
+ var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d;
+ while (++i < n) {
+ input = subject.slice();
+ subject.length = 0;
+ b = coordinates[i];
+ c = input[(m = input.length) - 1];
+ j = -1;
+ while (++j < m) {
+ d = input[j];
+ if (d3_geom_polygonInside(d, a, b)) {
+ if (!d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ subject.push(d);
+ } else if (d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ c = d;
+ }
+ a = b;
+ }
+ return subject;
+ };
+ return coordinates;
+ };
+ d3.geom.voronoi = function(vertices) {
+ var polygons = vertices.map(function() {
+ return [];
+ });
+ d3_voronoi_tessellate(vertices, function(e) {
+ var s1, s2, x1, x2, y1, y2;
+ if (e.a === 1 && e.b >= 0) {
+ s1 = e.ep.r;
+ s2 = e.ep.l;
+ } else {
+ s1 = e.ep.l;
+ s2 = e.ep.r;
+ }
+ if (e.a === 1) {
+ y1 = s1 ? s1.y : -1e6;
+ x1 = e.c - e.b * y1;
+ y2 = s2 ? s2.y : 1e6;
+ x2 = e.c - e.b * y2;
+ } else {
+ x1 = s1 ? s1.x : -1e6;
+ y1 = e.c - e.a * x1;
+ x2 = s2 ? s2.x : 1e6;
+ y2 = e.c - e.a * x2;
+ }
+ var v1 = [ x1, y1 ], v2 = [ x2, y2 ];
+ polygons[e.region.l.index].push(v1, v2);
+ polygons[e.region.r.index].push(v1, v2);
+ });
+ return polygons.map(function(polygon, i) {
+ var cx = vertices[i][0], cy = vertices[i][1];
+ polygon.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ return polygon.sort(function(a, b) {
+ return a.angle - b.angle;
+ }).filter(function(d, i) {
+ return !i || d.angle - polygon[i - 1].angle > 1e-10;
+ });
+ });
+ };
+ var d3_voronoi_opposite = {
+ l: "r",
+ r: "l"
+ };
+ d3.geom.delaunay = function(vertices) {
+ var edges = vertices.map(function() {
+ return [];
+ }), triangles = [];
+ d3_voronoi_tessellate(vertices, function(e) {
+ edges[e.region.l.index].push(vertices[e.region.r.index]);
+ });
+ edges.forEach(function(edge, i) {
+ var v = vertices[i], cx = v[0], cy = v[1];
+ edge.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ edge.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ for (var j = 0, m = edge.length - 1; j < m; j++) {
+ triangles.push([ v, edge[j], edge[j + 1] ]);
+ }
+ });
+ return triangles;
+ };
+ d3.geom.quadtree = function(points, x1, y1, x2, y2) {
+ function insert(n, p, x1, y1, x2, y2) {
+ if (isNaN(p.x) || isNaN(p.y)) return;
+ if (n.leaf) {
+ var v = n.point;
+ if (v) {
+ if (Math.abs(v.x - p.x) + Math.abs(v.y - p.y) < .01) {
+ insertChild(n, p, x1, y1, x2, y2);
+ } else {
+ n.point = null;
+ insertChild(n, v, x1, y1, x2, y2);
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ } else {
+ n.point = p;
+ }
+ } else {
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ }
+ function insertChild(n, p, x1, y1, x2, y2) {
+ var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = p.x >= sx, bottom = p.y >= sy, i = (bottom << 1) + right;
+ n.leaf = false;
+ n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
+ if (right) x1 = sx; else x2 = sx;
+ if (bottom) y1 = sy; else y2 = sy;
+ insert(n, p, x1, y1, x2, y2);
+ }
+ var p, i = -1, n = points.length;
+ if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint);
+ if (arguments.length < 5) {
+ if (arguments.length === 3) {
+ y2 = x2 = y1;
+ y1 = x1;
+ } else {
+ x1 = y1 = Infinity;
+ x2 = y2 = -Infinity;
+ while (++i < n) {
+ p = points[i];
+ if (p.x < x1) x1 = p.x;
+ if (p.y < y1) y1 = p.y;
+ if (p.x > x2) x2 = p.x;
+ if (p.y > y2) y2 = p.y;
+ }
+ var dx = x2 - x1, dy = y2 - y1;
+ if (dx > dy) y2 = y1 + dx; else x2 = x1 + dy;
+ }
+ }
+ var root = d3_geom_quadtreeNode();
+ root.add = function(p) {
+ insert(root, p, x1, y1, x2, y2);
+ };
+ root.visit = function(f) {
+ d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
+ };
+ points.forEach(root.add);
+ return root;
+ };
+ d3.time = {};
+ var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
+ d3_time_utc.prototype = {
+ getDate: function() {
+ return this._.getUTCDate();
+ },
+ getDay: function() {
+ return this._.getUTCDay();
+ },
+ getFullYear: function() {
+ return this._.getUTCFullYear();
+ },
+ getHours: function() {
+ return this._.getUTCHours();
+ },
+ getMilliseconds: function() {
+ return this._.getUTCMilliseconds();
+ },
+ getMinutes: function() {
+ return this._.getUTCMinutes();
+ },
+ getMonth: function() {
+ return this._.getUTCMonth();
+ },
+ getSeconds: function() {
+ return this._.getUTCSeconds();
+ },
+ getTime: function() {
+ return this._.getTime();
+ },
+ getTimezoneOffset: function() {
+ return 0;
+ },
+ valueOf: function() {
+ return this._.valueOf();
+ },
+ setDate: function() {
+ d3_time_prototype.setUTCDate.apply(this._, arguments);
+ },
+ setDay: function() {
+ d3_time_prototype.setUTCDay.apply(this._, arguments);
+ },
+ setFullYear: function() {
+ d3_time_prototype.setUTCFullYear.apply(this._, arguments);
+ },
+ setHours: function() {
+ d3_time_prototype.setUTCHours.apply(this._, arguments);
+ },
+ setMilliseconds: function() {
+ d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);
+ },
+ setMinutes: function() {
+ d3_time_prototype.setUTCMinutes.apply(this._, arguments);
+ },
+ setMonth: function() {
+ d3_time_prototype.setUTCMonth.apply(this._, arguments);
+ },
+ setSeconds: function() {
+ d3_time_prototype.setUTCSeconds.apply(this._, arguments);
+ },
+ setTime: function() {
+ d3_time_prototype.setTime.apply(this._, arguments);
+ }
+ };
+ var d3_time_prototype = Date.prototype;
+ var d3_time_formatDateTime = "%a %b %e %H:%M:%S %Y", d3_time_formatDate = "%m/%d/%y", d3_time_formatTime = "%H:%M:%S";
+ var d3_time_days = d3_time_daySymbols, d3_time_dayAbbreviations = d3_time_days.map(d3_time_formatAbbreviate), d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = d3_time_months.map(d3_time_formatAbbreviate);
+ d3.time.format = function(template) {
+ function format(date) {
+ var string = [], i = -1, j = 0, c, f;
+ while (++i < n) {
+ if (template.charCodeAt(i) == 37) {
+ string.push(template.substring(j, i), (f = d3_time_formats[c = template.charAt(++i)]) ? f(date) : c);
+ j = i + 1;
+ }
+ }
+ string.push(template.substring(j, i));
+ return string.join("");
+ }
+ var n = template.length;
+ format.parse = function(string) {
+ var d = {
+ y: 1900,
+ m: 0,
+ d: 1,
+ H: 0,
+ M: 0,
+ S: 0,
+ L: 0
+ }, i = d3_time_parse(d, template, string, 0);
+ if (i != string.length) return null;
+ if ("p" in d) d.H = d.H % 12 + d.p * 12;
+ var date = new d3_time;
+ date.setFullYear(d.y, d.m, d.d);
+ date.setHours(d.H, d.M, d.S, d.L);
+ return date;
+ };
+ format.toString = function() {
+ return template;
+ };
+ return format;
+ };
+ var d3_time_zfill2 = d3.format("02d"), d3_time_zfill3 = d3.format("03d"), d3_time_zfill4 = d3.format("04d"), d3_time_sfill2 = d3.format("2d");
+ var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations);
+ var d3_time_formats = {
+ a: function(d) {
+ return d3_time_dayAbbreviations[d.getDay()];
+ },
+ A: function(d) {
+ return d3_time_days[d.getDay()];
+ },
+ b: function(d) {
+ return d3_time_monthAbbreviations[d.getMonth()];
+ },
+ B: function(d) {
+ return d3_time_months[d.getMonth()];
+ },
+ c: d3.time.format(d3_time_formatDateTime),
+ d: function(d) {
+ return d3_time_zfill2(d.getDate());
+ },
+ e: function(d) {
+ return d3_time_sfill2(d.getDate());
+ },
+ H: function(d) {
+ return d3_time_zfill2(d.getHours());
+ },
+ I: function(d) {
+ return d3_time_zfill2(d.getHours() % 12 || 12);
+ },
+ j: function(d) {
+ return d3_time_zfill3(1 + d3.time.dayOfYear(d));
+ },
+ L: function(d) {
+ return d3_time_zfill3(d.getMilliseconds());
+ },
+ m: function(d) {
+ return d3_time_zfill2(d.getMonth() + 1);
+ },
+ M: function(d) {
+ return d3_time_zfill2(d.getMinutes());
+ },
+ p: function(d) {
+ return d.getHours() >= 12 ? "PM" : "AM";
+ },
+ S: function(d) {
+ return d3_time_zfill2(d.getSeconds());
+ },
+ U: function(d) {
+ return d3_time_zfill2(d3.time.sundayOfYear(d));
+ },
+ w: function(d) {
+ return d.getDay();
+ },
+ W: function(d) {
+ return d3_time_zfill2(d3.time.mondayOfYear(d));
+ },
+ x: d3.time.format(d3_time_formatDate),
+ X: d3.time.format(d3_time_formatTime),
+ y: function(d) {
+ return d3_time_zfill2(d.getFullYear() % 100);
+ },
+ Y: function(d) {
+ return d3_time_zfill4(d.getFullYear() % 1e4);
+ },
+ Z: d3_time_zone,
+ "%": function(d) {
+ return "%";
+ }
+ };
+ var d3_time_parsers = {
+ a: d3_time_parseWeekdayAbbrev,
+ A: d3_time_parseWeekday,
+ b: d3_time_parseMonthAbbrev,
+ B: d3_time_parseMonth,
+ c: d3_time_parseLocaleFull,
+ d: d3_time_parseDay,
+ e: d3_time_parseDay,
+ H: d3_time_parseHour24,
+ I: d3_time_parseHour24,
+ L: d3_time_parseMilliseconds,
+ m: d3_time_parseMonthNumber,
+ M: d3_time_parseMinutes,
+ p: d3_time_parseAmPm,
+ S: d3_time_parseSeconds,
+ x: d3_time_parseLocaleDate,
+ X: d3_time_parseLocaleTime,
+ y: d3_time_parseYear,
+ Y: d3_time_parseFullYear
+ };
+ var d3_time_numberRe = /^\s*\d+/;
+ var d3_time_amPmLookup = d3.map({
+ am: 0,
+ pm: 1
+ });
+ d3.time.format.utc = function(template) {
+ function format(date) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time;
+ utc._ = date;
+ return local(utc);
+ } finally {
+ d3_time = Date;
+ }
+ }
+ var local = d3.time.format(template);
+ format.parse = function(string) {
+ try {
+ d3_time = d3_time_utc;
+ var date = local.parse(string);
+ return date && date._;
+ } finally {
+ d3_time = Date;
+ }
+ };
+ format.toString = local.toString;
+ return format;
+ };
+ var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
+ d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso;
+ d3_time_formatIsoNative.parse = function(string) {
+ var date = new Date(string);
+ return isNaN(date) ? null : date;
+ };
+ d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
+ d3.time.second = d3_time_interval(function(date) {
+ return new d3_time(Math.floor(date / 1e3) * 1e3);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 1e3);
+ }, function(date) {
+ return date.getSeconds();
+ });
+ d3.time.seconds = d3.time.second.range;
+ d3.time.seconds.utc = d3.time.second.utc.range;
+ d3.time.minute = d3_time_interval(function(date) {
+ return new d3_time(Math.floor(date / 6e4) * 6e4);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 6e4);
+ }, function(date) {
+ return date.getMinutes();
+ });
+ d3.time.minutes = d3.time.minute.range;
+ d3.time.minutes.utc = d3.time.minute.utc.range;
+ d3.time.hour = d3_time_interval(function(date) {
+ var timezone = date.getTimezoneOffset() / 60;
+ return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 36e5);
+ }, function(date) {
+ return date.getHours();
+ });
+ d3.time.hours = d3.time.hour.range;
+ d3.time.hours.utc = d3.time.hour.utc.range;
+ d3.time.day = d3_time_interval(function(date) {
+ var day = new d3_time(1970, 0);
+ day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
+ return day;
+ }, function(date, offset) {
+ date.setDate(date.getDate() + offset);
+ }, function(date) {
+ return date.getDate() - 1;
+ });
+ d3.time.days = d3.time.day.range;
+ d3.time.days.utc = d3.time.day.utc.range;
+ d3.time.dayOfYear = function(date) {
+ var year = d3.time.year(date);
+ return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
+ };
+ d3_time_daySymbols.forEach(function(day, i) {
+ day = day.toLowerCase();
+ i = 7 - i;
+ var interval = d3.time[day] = d3_time_interval(function(date) {
+ (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
+ return date;
+ }, function(date, offset) {
+ date.setDate(date.getDate() + Math.floor(offset) * 7);
+ }, function(date) {
+ var day = d3.time.year(date).getDay();
+ return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
+ });
+ d3.time[day + "s"] = interval.range;
+ d3.time[day + "s"].utc = interval.utc.range;
+ d3.time[day + "OfYear"] = function(date) {
+ var day = d3.time.year(date).getDay();
+ return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7);
+ };
+ });
+ d3.time.week = d3.time.sunday;
+ d3.time.weeks = d3.time.sunday.range;
+ d3.time.weeks.utc = d3.time.sunday.utc.range;
+ d3.time.weekOfYear = d3.time.sundayOfYear;
+ d3.time.month = d3_time_interval(function(date) {
+ date = d3.time.day(date);
+ date.setDate(1);
+ return date;
+ }, function(date, offset) {
+ date.setMonth(date.getMonth() + offset);
+ }, function(date) {
+ return date.getMonth();
+ });
+ d3.time.months = d3.time.month.range;
+ d3.time.months.utc = d3.time.month.utc.range;
+ d3.time.year = d3_time_interval(function(date) {
+ date = d3.time.day(date);
+ date.setMonth(0, 1);
+ return date;
+ }, function(date, offset) {
+ date.setFullYear(date.getFullYear() + offset);
+ }, function(date) {
+ return date.getFullYear();
+ });
+ d3.time.years = d3.time.year.range;
+ d3.time.years.utc = d3.time.year.utc.range;
+ var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];
+ var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ];
+ var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), function(d) {
+ return true;
+ } ], [ d3.time.format("%B"), function(d) {
+ return d.getMonth();
+ } ], [ d3.time.format("%b %d"), function(d) {
+ return d.getDate() != 1;
+ } ], [ d3.time.format("%a %d"), function(d) {
+ return d.getDay() && d.getDate() != 1;
+ } ], [ d3.time.format("%I %p"), function(d) {
+ return d.getHours();
+ } ], [ d3.time.format("%I:%M"), function(d) {
+ return d.getMinutes();
+ } ], [ d3.time.format(":%S"), function(d) {
+ return d.getSeconds();
+ } ], [ d3.time.format(".%L"), function(d) {
+ return d.getMilliseconds();
+ } ] ];
+ var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
+ d3_time_scaleLocalMethods.year = function(extent, m) {
+ return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);
+ };
+ d3.time.scale = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
+ };
+ var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
+ return [ m[0].utc, m[1] ];
+ });
+ var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), function(d) {
+ return true;
+ } ], [ d3.time.format.utc("%B"), function(d) {
+ return d.getUTCMonth();
+ } ], [ d3.time.format.utc("%b %d"), function(d) {
+ return d.getUTCDate() != 1;
+ } ], [ d3.time.format.utc("%a %d"), function(d) {
+ return d.getUTCDay() && d.getUTCDate() != 1;
+ } ], [ d3.time.format.utc("%I %p"), function(d) {
+ return d.getUTCHours();
+ } ], [ d3.time.format.utc("%I:%M"), function(d) {
+ return d.getUTCMinutes();
+ } ], [ d3.time.format.utc(":%S"), function(d) {
+ return d.getUTCSeconds();
+ } ], [ d3.time.format.utc(".%L"), function(d) {
+ return d.getUTCMilliseconds();
+ } ] ];
+ var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
+ d3_time_scaleUTCMethods.year = function(extent, m) {
+ return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);
+ };
+ d3.time.scale.utc = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
+ };
+})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.min.js
new file mode 100644
index 00000000..cc47f1ea
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.min.js
@@ -0,0 +1,4 @@
+(function(){function e(e,t){try{for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}catch(r){e.prototype=t}}function t(e){var t=-1,n=e.length,r=[];while(++t<n)r.push(e[t]);return r}function n(e){return Array.prototype.slice.call(e)}function r(){}function i(e){return e}function s(){return this}function o(){return!0}function u(e){return typeof e=="function"?e:function(){return e}}function a(e,t,n){return function(){var r=n.apply(t,arguments);return arguments.length?e:r}}function f(e){return e!=null&&!isNaN(e)}function l(e){return e.length}function c(e){return e==null}function h(e){return e.trim().replace(/\s+/g," ")}function p(e){var t=1;while(e*t%1)t*=10;return t}function d(){}function v(e){function t(){var t=n,r=-1,i=t.length,s;while(++r<i)(s=t[r].on)&&s.apply(this,arguments);return e}var n=[],i=new r;return t.on=function(t,r){var s=i.get(t),o;return arguments.length<2?s&&s.on:(s&&(s.on=null,n=n.slice(0,o=n.indexOf(s)).concat(n.slice(o+1)),i.remove(t)),r&&n.push(i.set(t,{on:r})),e)},t}function m(e,t){return t-(e?1+Math.floor(Math.log(e+Math.pow(10,1+Math.floor(Math.log(e)/Math.LN10)-t))/Math.LN10):1)}function g(e){return e+""}function y(e){var t=e.lastIndexOf("."),n=t>=0?e.substring(t):(t=e.length,""),r=[];while(t>0)r.push(e.substring(t-=3,t+3));return r.reverse().join(",")+n}function b(e,t){var n=Math.pow(10,Math.abs(8-t)*3);return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}function w(e){return function(t){return t<=0?0:t>=1?1:e(t)}}function E(e){return function(t){return 1-e(1-t)}}function S(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function x(e){return e}function T(e){return function(t){return Math.pow(t,e)}}function N(e){return 1-Math.cos(e*Math.PI/2)}function C(e){return Math.pow(2,10*(e-1))}function k(e){return 1-Math.sqrt(1-e*e)}function L(e,t){var n;return arguments.length<2&&(t=.45),arguments.length<1?(e=1,n=t/4):n=t/(2*Math.PI)*Math.asin(1/e),function(r){return 1+e*Math.pow(2,10*-r)*Math.sin((r-n)*2*Math.PI/t)}}function A(e){return e||(e=1.70158),function(t){return t*t*((e+1)*t-e)}}function O(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function M(){d3.event.stopPropagation(),d3.event.preventDefault()}function _(){var e=d3.event,t;while(t=e.sourceEvent)e=t;return e}function D(e){var t=new d,n=0,r=arguments.length;while(++n<r)t[arguments[n]]=v(t);return t.of=function(n,r){return function(i){try{var s=i.sourceEvent=d3.event;i.target=e,d3.event=i,t[i.type].apply(n,r)}finally{d3.event=s}}},t}function P(e){var t=[e.a,e.b],n=[e.c,e.d],r=B(t),i=H(t,n),s=B(j(n,t,-i))||0;t[0]*n[1]<n[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,i*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-n[0],n[1]))*fs,this.translate=[e.e,e.f],this.scale=[r,s],this.skew=s?Math.atan2(i,s)*fs:0}function H(e,t){return e[0]*t[0]+e[1]*t[1]}function B(e){var t=Math.sqrt(H(e,e));return t&&(e[0]/=t,e[1]/=t),t}function j(e,t,n){return e[0]+=n*t[0],e[1]+=n*t[1],e}function F(e){return e=="transform"?d3.interpolateTransform:d3.interpolate}function I(e,t){return t=t-(e=+e)?1/(t-e):0,function(n){return(n-e)*t}}function q(e,t){return t=t-(e=+e)?1/(t-e):0,function(n){return Math.max(0,Math.min(1,(n-e)*t))}}function R(e,t,n){return new U(e,t,n)}function U(e,t,n){this.r=e,this.g=t,this.b=n}function z(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function W(e,t,n){var r=0,i=0,s=0,o,u,a;o=/([a-z]+)\((.*)\)/i.exec(e);if(o){u=o[2].split(",");switch(o[1]){case"hsl":return n(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(J(u[0]),J(u[1]),J(u[2]))}}return(a=hs.get(e))?t(a.r,a.g,a.b):(e!=null&&e.charAt(0)==="#"&&(e.length===4?(r=e.charAt(1),r+=r,i=e.charAt(2),i+=i,s=e.charAt(3),s+=s):e.length===7&&(r=e.substring(1,3),i=e.substring(3,5),s=e.substring(5,7)),r=parseInt(r,16),i=parseInt(i,16),s=parseInt(s,16)),t(r,i,s))}function X(e,t,n){var r=Math.min(e/=255,t/=255,n/=255),i=Math.max(e,t,n),s=i-r,o,u,a=(i+r)/2;return s?(u=a<.5?s/(i+r):s/(2-i-r),e==i?o=(t-n)/s+(t<n?6:0):t==i?o=(n-e)/s+2:o=(e-t)/s+4,o*=60):u=o=0,K(o,u,a)}function V(e,t,n){e=$(e),t=$(t),n=$(n);var r=ot((.4124564*e+.3575761*t+.1804375*n)/ds),i=ot((.2126729*e+.7151522*t+.072175*n)/vs),s=ot((.0193339*e+.119192*t+.9503041*n)/ms);return tt(116*i-16,500*(r-i),200*(i-s))}function $(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function J(e){var t=parseFloat(e);return e.charAt(e.length-1)==="%"?Math.round(t*2.55):t}function K(e,t,n){return new Q(e,t,n)}function Q(e,t,n){this.h=e,this.s=t,this.l=n}function G(e,t,n){function r(e){return e>360?e-=360:e<0&&(e+=360),e<60?s+(o-s)*e/60:e<180?o:e<240?s+(o-s)*(240-e)/60:s}function i(e){return Math.round(r(e)*255)}var s,o;return e%=360,e<0&&(e+=360),t=t<0?0:t>1?1:t,n=n<0?0:n>1?1:n,o=n<=.5?n*(1+t):n+t-n*t,s=2*n-o,R(i(e+120),i(e),i(e-120))}function Y(e,t,n){return new Z(e,t,n)}function Z(e,t,n){this.h=e,this.c=t,this.l=n}function et(e,t,n){return tt(n,Math.cos(e*=Math.PI/180)*t,Math.sin(e)*t)}function tt(e,t,n){return new nt(e,t,n)}function nt(e,t,n){this.l=e,this.a=t,this.b=n}function rt(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;return i=st(i)*ds,r=st(r)*vs,s=st(s)*ms,R(ut(3.2404542*i-1.5371385*r-.4985314*s),ut(-0.969266*i+1.8760108*r+.041556*s),ut(.0556434*i-.2040259*r+1.0572252*s))}function it(e,t,n){return Y(Math.atan2(n,t)/Math.PI*180,Math.sqrt(t*t+n*n),e)}function st(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function ot(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function ut(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function at(e){return Ki(e,Ss),e}function ft(e){return function(){return gs(e,this)}}function lt(e){return function(){return ys(e,this)}}function ct(e,t){function n(){this.removeAttribute(e)}function r(){this.removeAttributeNS(e.space,e.local)}function i(){this.setAttribute(e,t)}function s(){this.setAttributeNS(e.space,e.local,t)}function o(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}function u(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}return e=d3.ns.qualify(e),t==null?e.local?r:n:typeof t=="function"?e.local?u:o:e.local?s:i}function ht(e){return new RegExp("(?:^|\\s+)"+d3.requote(e)+"(?:\\s+|$)","g")}function pt(e,t){function n(){var n=-1;while(++n<i)e[n](this,t)}function r(){var n=-1,r=t.apply(this,arguments);while(++n<i)e[n](this,r)}e=e.trim().split(/\s+/).map(dt);var i=e.length;return typeof t=="function"?r:n}function dt(e){var t=ht(e);return function(n,r){if(i=n.classList)return r?i.add(e):i.remove(e);var i=n.className,s=i.baseVal!=null,o=s?i.baseVal:i;r?(t.lastIndex=0,t.test(o)||(o=h(o+" "+e),s?i.baseVal=o:n.className=o)):o&&(o=h(o.replace(t," ")),s?i.baseVal=o:n.className=o)}}function vt(e,t,n){function r(){this.style.removeProperty(e)}function i(){this.style.setProperty(e,t,n)}function s(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}return t==null?r:typeof t=="function"?s:i}function mt(e,t){function n(){delete this[e]}function r(){this[e]=t}function i(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}return t==null?n:typeof t=="function"?i:r}function gt(e){return{__data__:e}}function yt(e){return function(){return Es(this,e)}}function bt(e){return arguments.length||(e=d3.ascending),function(t,n){return e(t&&t.__data__,n&&n.__data__)}}function wt(e,t,n){function r(){var t=this[s];t&&(this.removeEventListener(e,t,t.$),delete this[s])}function i(){function i(e){var n=d3.event;d3.event=e,u[0]=o.__data__;try{t.apply(o,u)}finally{d3.event=n}}var o=this,u=arguments;r.call(this),this.addEventListener(e,this[s]=i,i.$=n),i._=t}var s="__on"+e,o=e.indexOf(".");return o>0&&(e=e.substring(0,o)),t?i:r}function Et(e,t){for(var n=0,r=e.length;n<r;n++)for(var i=e[n],s=0,o=i.length,u;s<o;s++)(u=i[s])&&t(u,s,n);return e}function St(e){return Ki(e,Ts),e}function xt(e,t,n){Ki(e,Ns);var i=new r,s=d3.dispatch("start","end"),o=Ds;return e.id=t,e.time=n,e.tween=function(t,n){return arguments.length<2?i.get(t):(n==null?i.remove(t):i.set(t,n),e)},e.ease=function(t){return arguments.length?(o=typeof t=="function"?t:d3.ease.apply(d3,arguments),e):o},e.each=function(t,n){return arguments.length<2?Tt.call(e,t):(s.on(t,n),e)},d3.timer(function(r){return Et(e,function(e,u,a){function f(r){return v.active>t?c():(v.active=t,i.forEach(function(t,n){(n=n.call(e,m,u))&&h.push(n)}),s.start.call(e,m,u),l(r)||d3.timer(l,0,n),1)}function l(n){if(v.active!==t)return c();var r=(n-p)/d,i=o(r),a=h.length;while(a>0)h[--a].call(e,i);if(r>=1)return c(),ks=t,s.end.call(e,m,u),ks=0,1}function c(){return--v.count||delete e.__transition__,1}var h=[],p=e.delay,d=e.duration,v=(e=e.node).__transition__||(e.__transition__={active:0,count:0}),m=e.__data__;++v.count,p<=r?f(r):d3.timer(f,p,n)})},0,n),e}function Tt(e){var t=ks,n=Ds,r=Ms,i=_s;return ks=this.id,Ds=this.ease(),Et(this,function(t,n,r){Ms=t.delay,_s=t.duration,e.call(t=t.node,t.__data__,n,r)}),ks=t,Ds=n,Ms=r,_s=i,this}function Nt(e,t,n){return n!=""&&Ps}function Ct(e,t){return d3.tween(e,F(t))}function kt(){var e,t=Date.now(),n=Hs;while(n)e=t-n.then,e>=n.delay&&(n.flush=n.callback(e)),n=n.next;var r=Lt()-t;r>24?(isFinite(r)&&(clearTimeout(js),js=setTimeout(kt,r)),Bs=0):(Bs=1,Fs(kt))}function Lt(){var e=null,t=Hs,n=Infinity;while(t)t.flush?t=e?e.next=t.next:Hs=t.next:(n=Math.min(n,t.then+t.delay),t=(e=t).next);return n}function At(e,t){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();if(Is<0&&(window.scrollX||window.scrollY)){n=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0);var i=n[0][0].getScreenCTM();Is=!i.f&&!i.e,n.remove()}return Is?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}function Ot(){}function Mt(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function _t(e){return e.rangeExtent?e.rangeExtent():Mt(e.range())}function Dt(e,t){var n=0,r=e.length-1,i=e[n],s=e[r],o;s<i&&(o=n,n=r,r=o,o=i,i=s,s=o);if(t=t(s-i))e[n]=t.floor(i),e[r]=t.ceil(s);return e}function Pt(){return Math}function Ht(e,t,n,r){function i(){var i=Math.min(e.length,t.length)>2?Ut:Rt,a=r?q:I;return o=i(e,t,a,n),u=i(t,e,a,d3.interpolate),s}function s(e){return o(e)}var o,u;return s.invert=function(e){return u(e)},s.domain=function(t){return arguments.length?(e=t.map(Number),i()):e},s.range=function(e){return arguments.length?(t=e,i()):t},s.rangeRound=function(e){return s.range(e).interpolate(d3.interpolateRound)},s.clamp=function(e){return arguments.length?(r=e,i()):r},s.interpolate=function(e){return arguments.length?(n=e,i()):n},s.ticks=function(t){return It(e,t)},s.tickFormat=function(t){return qt(e,t)},s.nice=function(){return Dt(e,jt),i()},s.copy=function(){return Ht(e,t,n,r)},i()}function Bt(e,t){return d3.rebind(e,t,"range","rangeRound","interpolate","clamp")}function jt(e){return e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1),e&&{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}}function Ft(e,t){var n=Mt(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;return s<=.15?i*=10:s<=.35?i*=5:s<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+i*.5,n[2]=i,n}function It(e,t){return d3.range.apply(d3,Ft(e,t))}function qt(e,t){return d3.format(",."+Math.max(0,-Math.floor(Math.log(Ft(e,t)[2])/Math.LN10+.01))+"f")}function Rt(e,t,n,r){var i=n(e[0],e[1]),s=r(t[0],t[1]);return function(e){return s(i(e))}}function Ut(e,t,n,r){var i=[],s=[],o=0,u=Math.min(e.length,t.length)-1;e[u]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());while(++o<=u)i.push(n(e[o-1],e[o])),s.push(r(t[o-1],t[o]));return function(t){var n=d3.bisect(e,t,1,u)-1;return s[n](i[n](t))}}function zt(e,t){function n(n){return e(t(n))}var r=t.pow;return n.invert=function(t){return r(e.invert(t))},n.domain=function(i){return arguments.length?(t=i[0]<0?Xt:Wt,r=t.pow,e.domain(i.map(t)),n):e.domain().map(r)},n.nice=function(){return e.domain(Dt(e.domain(),Pt)),n},n.ticks=function(){var n=Mt(e.domain()),i=[];if(n.every(isFinite)){var s=Math.floor(n[0]),o=Math.ceil(n[1]),u=r(n[0]),a=r(n[1]);if(t===Xt){i.push(r(s));for(;s++<o;)for(var f=9;f>0;f--)i.push(r(s)*f)}else{for(;s<o;s++)for(var f=1;f<10;f++)i.push(r(s)*f);i.push(r(s))}for(s=0;i[s]<u;s++);for(o=i.length;i[o-1]>a;o--);i=i.slice(s,o)}return i},n.tickFormat=function(e,i){arguments.length<2&&(i=qs);if(arguments.length<1)return i;var s=Math.max(.1,e/n.ticks().length),o=t===Xt?(u=-1e-12,Math.floor):(u=1e-12,Math.ceil),u;return function(e){return e/r(o(t(e)+u))<=s?i(e):""}},n.copy=function(){return zt(e.copy(),t)},Bt(n,e)}function Wt(e){return Math.log(e<0?0:e)/Math.LN10}function Xt(e){return-Math.log(e>0?0:-e)/Math.LN10}function Vt(e,t){function n(t){return e(r(t))}var r=$t(t),i=$t(1/t);return n.invert=function(t){return i(e.invert(t))},n.domain=function(t){return arguments.length?(e.domain(t.map(r)),n):e.domain().map(i)},n.ticks=function(e){return It(n.domain(),e)},n.tickFormat=function(e){return qt(n.domain(),e)},n.nice=function(){return n.domain(Dt(n.domain(),jt))},n.exponent=function(e){if(!arguments.length)return t;var s=n.domain();return r=$t(t=e),i=$t(1/t),n.domain(s)},n.copy=function(){return Vt(e.copy(),t)},Bt(n,e)}function $t(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Jt(e,t){function n(t){return o[((s.get(t)||s.set(t,e.push(t)))-1)%o.length]}function i(t,n){return d3.range(e.length).map(function(e){return t+n*e})}var s,o,u;return n.domain=function(i){if(!arguments.length)return e;e=[],s=new r;var o=-1,u=i.length,a;while(++o<u)s.has(a=i[o])||s.set(a,e.push(a));return n[t.t].apply(n,t.a)},n.range=function(e){return arguments.length?(o=e,u=0,t={t:"range",a:arguments},n):o},n.rangePoints=function(r,s){arguments.length<2&&(s=0);var a=r[0],f=r[1],l=(f-a)/(Math.max(1,e.length-1)+s);return o=i(e.length<2?(a+f)/2:a+l*s/2,l),u=0,t={t:"rangePoints",a:arguments},n},n.rangeBands=function(r,s,a){arguments.length<2&&(s=0),arguments.length<3&&(a=s);var f=r[1]<r[0],l=r[f-0],c=r[1-f],h=(c-l)/(e.length-s+2*a);return o=i(l+h*a,h),f&&o.reverse(),u=h*(1-s),t={t:"rangeBands",a:arguments},n},n.rangeRoundBands=function(r,s,a){arguments.length<2&&(s=0),arguments.length<3&&(a=s);var f=r[1]<r[0],l=r[f-0],c=r[1-f],h=Math.floor((c-l)/(e.length-s+2*a)),p=c-l-(e.length-s)*h;return o=i(l+Math.round(p/2),h),f&&o.reverse(),u=Math.round(h*(1-s)),t={t:"rangeRoundBands",a:arguments},n},n.rangeBand=function(){return u},n.rangeExtent=function(){return Mt(t.a[0])},n.copy=function(){return Jt(e,t)},n.domain(e)}function Kt(e,t){function n(){var n=0,s=e.length,o=t.length;i=[];while(++n<o)i[n-1]=d3.quantile(e,n/o);return r}function r(e){return isNaN(e=+e)?NaN:t[d3.bisect(i,e)]}var i;return r.domain=function(t){return arguments.length?(e=t.filter(function(e){return!isNaN(e)}).sort(d3.ascending),n()):e},r.range=function(e){return arguments.length?(t=e,n()):t},r.quantiles=function(){return i},r.copy=function(){return Kt(e,t)},n()}function Qt(e,t,n){function r(t){return n[Math.max(0,Math.min(o,Math.floor(s*(t-e))))]}function i(){return s=n.length/(t-e),o=n.length-1,r}var s,o;return r.domain=function(n){return arguments.length?(e=+n[0],t=+n[n.length-1],i()):[e,t]},r.range=function(e){return arguments.length?(n=e,i()):n},r.copy=function(){return Qt(e,t,n)},i()}function Gt(e,t){function n(n){return t[d3.bisect(e,n)]}return n.domain=function(t){return arguments.length?(e=t,n):e},n.range=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return Gt(e,t)},n}function Yt(e){function t(e){return+e}return t.invert=t,t.domain=t.range=function(n){return arguments.length?(e=n.map(t),t):e},t.ticks=function(t){return It(e,t)},t.tickFormat=function(t){return qt(e,t)},t.copy=function(){return Yt(e)},t}function Zt(e){return e.innerRadius}function en(e){return e.outerRadius}function tn(e){return e.startAngle}function nn(e){return e.endAngle}function rn(e){function t(t){function o(){a.push("M",s(e(l),f))}var a=[],l=[],c=-1,h=t.length,p,d=u(n),v=u(r);while(++c<h)i.call(this,p=t[c],c)?l.push([+d.call(this,p,c),+v.call(this,p,c)]):l.length&&(o(),l=[]);return l.length&&o(),a.length?a.join(""):null}var n=sn,r=on,i=o,s=un,a=s.key,f=.7;return t.x=function(e){return arguments.length?(n=e,t):n},t.y=function(e){return arguments.length?(r=e,t):r},t.defined=function(e){return arguments.length?(i=e,t):i},t.interpolate=function(e){return arguments.length?(typeof e=="function"?a=s=e:a=(s=$s.get(e)||un).key,t):a},t.tension=function(e){return arguments.length?(f=e,t):f},t}function sn(e){return e[0]}function on(e){return e[1]}function un(e){return e.join("L")}function an(e){return un(e)+"Z"}function fn(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("V",(r=e[t])[1],"H",r[0]);return i.join("")}function ln(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("H",(r=e[t])[0],"V",r[1]);return i.join("")}function cn(e,t){return e.length<4?un(e):e[1]+dn(e.slice(1,e.length-1),vn(e,t))}function hn(e,t){return e.length<3?un(e):e[0]+dn((e.push(e[0]),e),vn([e[e.length-2]].concat(e,[e[1]]),t))}function pn(e,t,n){return e.length<3?un(e):e[0]+dn(e,vn(e,t))}function dn(e,t){if(t.length<1||e.length!=t.length&&e.length!=t.length+2)return un(e);var n=e.length!=t.length,r="",i=e[0],s=e[1],o=t[0],u=o,a=1;n&&(r+="Q"+(s[0]-o[0]*2/3)+","+(s[1]-o[1]*2/3)+","+s[0]+","+s[1],i=e[1],a=2);if(t.length>1){u=t[1],s=e[a],a++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f<t.length;f++,a++)s=e[a],u=t[f],r+="S"+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1]}if(n){var l=e[a];r+="Q"+(s[0]+u[0]*2/3)+","+(s[1]+u[1]*2/3)+","+l[0]+","+l[1]}return r}function vn(e,t){var n=[],r=(1-t)/2,i,s=e[0],o=e[1],u=1,a=e.length;while(++u<a)i=s,s=o,o=e[u],n.push([r*(o[0]-i[0]),r*(o[1]-i[1])]);return n}function mn(e){if(e.length<3)return un(e);var t=1,n=e.length,r=e[0],i=r[0],s=r[1],o=[i,i,i,(r=e[1])[0]],u=[s,s,s,r[1]],a=[i,",",s];En(a,o,u);while(++t<n)r=e[t],o.shift(),o.push(r[0]),u.shift(),u.push(r[1]),En(a,o,u);t=-1;while(++t<2)o.shift(),o.push(r[0]),u.shift(),u.push(r[1]),En(a,o,u);return a.join("")}function gn(e){if(e.length<4)return un(e);var t=[],n=-1,r=e.length,i,s=[0],o=[0];while(++n<3)i=e[n],s.push(i[0]),o.push(i[1]);t.push(wn(Qs,s)+","+wn(Qs,o)),--n;while(++n<r)i=e[n],s.shift(),s.push(i[0]),o.shift(),o.push(i[1]),En(t,s,o);return t.join("")}function yn(e){var t,n=-1,r=e.length,i=r+4,s,o=[],u=[];while(++n<4)s=e[n%r],o.push(s[0]),u.push(s[1]);t=[wn(Qs,o),",",wn(Qs,u)],--n;while(++n<i)s=e[n%r],o.shift(),o.push(s[0]),u.shift(),u.push(s[1]),En(t,o,u);return t.join("")}function bn(e,t){var n=e.length-1;if(n){var r=e[0][0],i=e[0][1],s=e[n][0]-r,o=e[n][1]-i,u=-1,a,f;while(++u<=n)a=e[u],f=u/n,a[0]=t*a[0]+(1-t)*(r+f*s),a[1]=t*a[1]+(1-t)*(i+f*o)}return mn(e)}function wn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function En(e,t,n){e.push("C",wn(Js,t),",",wn(Js,n),",",wn(Ks,t),",",wn(Ks,n),",",wn(Qs,t),",",wn(Qs,n))}function Sn(e,t){return(t[1]-e[1])/(t[0]-e[0])}function xn(e){var t=0,n=e.length-1,r=[],i=e[0],s=e[1],o=r[0]=Sn(i,s);while(++t<n)r[t]=(o+(o=Sn(i=s,s=e[t+1])))/2;return r[t]=o,r}function Tn(e){var t=[],n,r,i,s,o=xn(e),u=-1,a=e.length-1;while(++u<a)n=Sn(e[u],e[u+1]),Math.abs(n)<1e-6?o[u]=o[u+1]=0:(r=o[u]/n,i=o[u+1]/n,s=r*r+i*i,s>9&&(s=n*3/Math.sqrt(s),o[u]=s*r,o[u+1]=s*i));u=-1;while(++u<=a)s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u])),t.push([s||0,o[u]*s||0]);return t}function Nn(e){return e.length<3?un(e):e[0]+dn(e,Tn(e))}function Cn(e){var t,n=-1,r=e.length,i,s;while(++n<r)t=e[n],i=t[0],s=t[1]+Xs,t[0]=i*Math.cos(s),t[1]=i*Math.sin(s);return e}function kn(e){function t(t){function o(){l.push("M",f(e(v),p),h,c(e(d.reverse()),p),"Z")}var l=[],d=[],v=[],m=-1,g=t.length,y,b=u(n),w=u(i),E=n===r?function(){return x}:u(r),S=i===s?function(){return T}:u(s),x,T;while(++m<g)a.call(this,y=t[m],m)?(d.push([x=+b.call(this,y,m),T=+w.call(this,y,m)]),v.push([+E.call(this,y,m),+S.call(this,y,m)])):d.length&&(o(),d=[],v=[]);return d.length&&o(),l.length?l.join(""):null}var n=sn,r=sn,i=0,s=on,a=o,f=un,l=f.key,c=f,h="L",p=.7;return t.x=function(e){return arguments.length?(n=r=e,t):r},t.x0=function(e){return arguments.length?(n=e,t):n},t.x1=function(e){return arguments.length?(r=e,t):r},t.y=function(e){return arguments.length?(i=s=e,t):s},t.y0=function(e){return arguments.length?(i=e,t):i},t.y1=function(e){return arguments.length?(s=e,t):s},t.defined=function(e){return arguments.length?(a=e,t):a},t.interpolate=function(e){return arguments.length?(typeof e=="function"?l=f=e:l=(f=$s.get(e)||un).key,c=f.reverse||f,h=f.closed?"M":"L",t):l},t.tension=function(e){return arguments.length?(p=e,t):p},t}function Ln(e){return e.source}function An(e){return e.target}function On(e){return e.radius}function Mn(e){return e.startAngle}function _n(e){return e.endAngle}function Dn(e){return[e.x,e.y]}function Pn(e){return function(){var t=e.apply(this,arguments),n=t[0],r=t[1]+Xs;return[n*Math.cos(r),n*Math.sin(r)]}}function Hn(){return 64}function Bn(){return"circle"}function jn(e){var t=Math.sqrt(e/Math.PI);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+ -t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function Fn(e,t){e.attr("transform",function(e){return"translate("+t(e)+",0)"})}function In(e,t){e.attr("transform",function(e){return"translate(0,"+t(e)+")"})}function qn(e,t,n){i=[];if(n&&t.length>1){var r=Mt(e.domain()),i,s=-1,o=t.length,u=(t[1]-t[0])/++n,a,f;while(++s<o)for(a=n;--a>0;)(f=+t[s]-a*u)>=r[0]&&i.push(f);for(--s,a=0;++a<n&&(f=+t[s]+a*u)<r[1];)i.push(f)}return i}function Rn(){no||(no=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var e=d3.event,t;try{no.scrollTop=1e3,no.dispatchEvent(e),t=1e3-no.scrollTop}catch(n){t=e.wheelDelta||-e.detail*5}return t}function Un(e){var t=e.source,n=e.target,r=Wn(t,n),i=[t];while(t!==r)t=t.parent,i.push(t);var s=i.length;while(n!==r)i.splice(s,0,n),n=n.parent;return i}function zn(e){var t=[],n=e.parent;while(n!=null)t.push(e),e=n,n=n.parent;return t.push(e),t}function Wn(e,t){if(e===t)return e;var n=zn(e),r=zn(t),i=n.pop(),s=r.pop(),o=null;while(i===s)o=i,i=n.pop(),s=r.pop();return o}function Xn(e){e.fixed|=2}function Vn(e){e.fixed&=1}function $n(e){e.fixed|=4}function Jn(e){e.fixed&=3}function Kn(e,t,n){var r=0,i=0;e.charge=0;if(!e.leaf){var s=e.nodes,o=s.length,u=-1,a;while(++u<o){a=s[u];if(a==null)continue;Kn(a,t,n),e.charge+=a.charge,r+=a.charge*a.cx,i+=a.charge*a.cy}}if(e.point){e.leaf||(e.point.x+=Math.random()-.5,e.point.y+=Math.random()-.5);var f=t*n[e.point.index];e.charge+=e.pointCharge=f,r+=f*e.point.x,i+=f*e.point.y}e.cx=r/e.charge,e.cy=i/e.charge}function Qn(e){return 20}function Gn(e){return 1}function Yn(e){return e.x}function Zn(e){return e.y}function er(e,t,n){e.y0=t,e.y=n}function tr(e){return d3.range(e.length)}function nr(e){var t=-1,n=e[0].length,r=[];while(++t<n)r[t]=0;return r}function rr(e){var t=1,n=0,r=e[0][1],i,s=e.length;for(;t<s;++t)(i=e[t][1])>r&&(n=t,r=i);return n}function ir(e){return e.reduce(sr,0)}function sr(e,t){return e+t[1]}function or(e,t){return ur(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function ur(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function ar(e){return[d3.min(e),d3.max(e)]}function fr(e,t){return d3.rebind(e,t,"sort","children","value"),e.links=pr,e.nodes=function(t){return uo=!0,(e.nodes=e)(t)},e}function lr(e){return e.children}function cr(e){return e.value}function hr(e,t){return t.value-e.value}function pr(e){return d3.merge(e.map(function(e){return(e.children||[]).map(function(t){return{source:e,target:t}})}))}function dr(e,t){return e.value-t.value}function vr(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function mr(e,t){e._pack_next=t,t._pack_prev=e}function gr(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return i*i-n*n-r*r>.001}function yr(e){function t(e){r=Math.min(e.x-e.r,r),i=Math.max(e.x+e.r,i),s=Math.min(e.y-e.r,s),o=Math.max(e.y+e.r,o)}if(!(n=e.children)||!(p=n.length))return;var n,r=Infinity,i=-Infinity,s=Infinity,o=-Infinity,u,a,f,l,c,h,p;n.forEach(br),u=n[0],u.x=-u.r,u.y=0,t(u);if(p>1){a=n[1],a.x=a.r,a.y=0,t(a);if(p>2){f=n[2],Sr(u,a,f),t(f),vr(u,f),u._pack_prev=f,vr(f,a),a=u._pack_next;for(l=3;l<p;l++){Sr(u,a,f=n[l]);var d=0,v=1,m=1;for(c=a._pack_next;c!==a;c=c._pack_next,v++)if(gr(c,f)){d=1;break}if(d==1)for(h=u._pack_prev;h!==c._pack_prev;h=h._pack_prev,m++)if(gr(h,f))break;d?(v<m||v==m&&a.r<u.r?mr(u,a=c):mr(u=h,a),l--):(vr(u,f),a=f,t(f))}}}var g=(r+i)/2,y=(s+o)/2,b=0;for(l=0;l<p;l++)f=n[l],f.x-=g,f.y-=y,b=Math.max(b,f.r+Math.sqrt(f.x*f.x+f.y*f.y));e.r=b,n.forEach(wr)}function br(e){e._pack_next=e._pack_prev=e}function wr(e){delete e._pack_next,delete e._pack_prev}function Er(e,t,n,r){var i=e.children;e.x=t+=r*e.x,e.y=n+=r*e.y,e.r*=r;if(i){var s=-1,o=i.length;while(++s<o)Er(i[s],t,n,r)}}function Sr(e,t,n){var r=e.r+n.r,i=t.x-e.x,s=t.y-e.y;if(r&&(i||s)){var o=t.r+n.r,u=i*i+s*s;o*=o,r*=r;var a=.5+(r-o)/(2*u),f=Math.sqrt(Math.max(0,2*o*(r+u)-(r-=u)*r-o*o))/(2*u);n.x=e.x+a*i+f*s,n.y=e.y+a*s-f*i}else n.x=e.x+r,n.y=e.y}function xr(e){return 1+d3.max(e,function(e){return e.y})}function Tr(e){return e.reduce(function(e,t){return e+t.x},0)/e.length}function Nr(e){var t=e.children;return t&&t.length?Nr(t[0]):e}function Cr(e){var t=e.children,n;return t&&(n=t.length)?Cr(t[n-1]):e}function kr(e,t){return e.parent==t.parent?1:2}function Lr(e){var t=e.children;return t&&t.length?t[0]:e._tree.thread}function Ar(e){var t=e.children,n;return t&&(n=t.length)?t[n-1]:e._tree.thread}function Or(e,t){var n=e.children;if(n&&(i=n.length)){var r,i,s=-1;while(++s<i)t(r=Or(n[s],t),e)>0&&(e=r)}return e}function Mr(e,t){return e.x-t.x}function _r(e,t){return t.x-e.x}function Dr(e,t){return e.depth-t.depth}function Pr(e,t){function n(e,r){var i=e.children;if(i&&(a=i.length)){var s,o=null,u=-1,a;while(++u<a)s=i[u],n(s,o),o=s}t(e,r)}n(e,null)}function Hr(e){var t=0,n=0,r=e.children,i=r.length,s;while(--i>=0)s=r[i]._tree,s.prelim+=t,s.mod+=t,t+=s.shift+(n+=s.change)}function Br(e,t,n){e=e._tree,t=t._tree;var r=n/(t.number-e.number);e.change+=r,t.change-=r,t.shift+=n,t.prelim+=n,t.mod+=n}function jr(e,t,n){return e._tree.ancestor.parent==t.parent?e._tree.ancestor:n}function Fr(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function Ir(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],s=e.dy-t[0]-t[2];return i<0&&(n+=i/2,i=0),s<0&&(r+=s/2,s=0),{x:n,y:r,dx:i,dy:s}}function qr(e,t){function n(e,r){d3.text(e,t,function(e){r(e&&n.parse(e))})}function r(t){return t.map(i).join(e)}function i(e){return o.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var s=new RegExp("\r\n|["+e+"\r\n]","g"),o=new RegExp('["'+e+"\n]"),u=e.charCodeAt(0);return n.parse=function(e){var t;return n.parseRows(e,function(e,n){if(n){var r={},i=-1,s=t.length;while(++i<s)r[t[i]]=e[i];return r}return t=e,null})},n.parseRows=function(e,t){function n(){if(s.lastIndex>=e.length)return i;if(l)return l=!1,r;var t=s.lastIndex;if(e.charCodeAt(t)===34){var n=t;while(n++<e.length)if(e.charCodeAt(n)===34){if(e.charCodeAt(n+1)!==34)break;n++}s.lastIndex=n+2;var o=e.charCodeAt(n+1);return o===13?(l=!0,e.charCodeAt(n+2)===10&&s.lastIndex++):o===10&&(l=!0),e.substring(t+1,n).replace(/""/g,'"')}var a=s.exec(e);return a?(l=a[0].charCodeAt(0)!==u,e.substring(t,a.index)):(s.lastIndex=e.length,e.substring(t))}var r={},i={},o=[],a=0,f,l;s.lastIndex=0;while((f=n())!==i){var c=[];while(f!==r&&f!==i)c.push(f),f=n();if(t&&!(c=t(c,a++)))continue;o.push(c)}return o},n.format=function(e){return e.map(r).join("\n")},n}function Rr(e,t){return function(n){return n&&e.hasOwnProperty(n.type)?e[n.type](n):t}}function Ur(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+ -2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}function zr(e,t){fo.hasOwnProperty(e.type)&&fo[e.type](e,t)}function Wr(e,t){zr(e.geometry,t)}function Xr(e,t){for(var n=e.features,r=0,i=n.length;r<i;r++)zr(n[r].geometry,t)}function Vr(e,t){for(var n=e.geometries,r=0,i=n.length;r<i;r++)zr(n[r],t)}function $r(e,t){for(var n=e.coordinates,r=0,i=n.length;r<i;r++)t.apply(null,n[r])}function Jr(e,t){for(var n=e.coordinates,r=0,i=n.length;r<i;r++)for(var s=n[r],o=0,u=s.length;o<u;o++)t.apply(null,s[o])}function Kr(e,t){for(var n=e.coordinates,r=0,i=n.length;r<i;r++)for(var s=n[r][0],o=0,u=s.length;o<u;o++)t.apply(null,s[o])}function Qr(e,t){t.apply(null,e.coordinates)}function Gr(e,t){for(var n=e.coordinates[0],r=0,i=n.length;r<i;r++)t.apply(null,n[r])}function Yr(e){return e.source}function Zr(e){return e.target}function ei(){function e(e){var t=Math.sin(e*=p)*d,n=Math.sin(p-e)*d,r=n*s+t*c,u=n*o+t*h,a=n*i+t*l;return[Math.atan2(u,r)/ao,Math.atan2(a,Math.sqrt(r*r+u*u))/ao]}var t,n,r,i,s,o,u,a,f,l,c,h,p,d;return e.distance=function(){return p==null&&(d=1/Math.sin(p=Math.acos(Math.max(-1,Math.min(1,i*l+r*f*Math.cos(u-t)))))),p},e.source=function(u){var a=Math.cos(t=u[0]*ao),f=Math.sin(t);return r=Math.cos(n=u[1]*ao),i=Math.sin(n),s=r*a,o=r*f,p=null,e},e.target=function(t){var n=Math.cos(u=t[0]*ao),r=Math.sin(u);return f=Math.cos(a=t[1]*ao),l=Math.sin(a),c=f*n,h=f*r,p=null,e},e}function ti(e,t){var n=ei().source(e).target(t);return n.distance(),n}function ni(e){var t=0,n=0;for(;;){if(e(t,n))return[t,n];t===0?(t=n+1,n=0):(t-=1,n+=1)}}function ri(e,t,n,r){var i,s,o,u,a,f,l;return i=r[e],s=i[0],o=i[1],i=r[t],u=i[0],a=i[1],i=r[n],f=i[0],l=i[1],(l-o)*(u-s)-(a-o)*(f-s)>0}function ii(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function si(e,t,n,r){var i=e[0],s=t[0],o=n[0],u=r[0],a=e[1],f=t[1],l=n[1],c=r[1],h=i-o,p=s-i,d=u-o,v=a-l,m=f-a,g=c-l,y=(d*v-g*h)/(g*p-d*m);return[i+y*p,a+y*m]}function oi(e,t){var n={list:e.map(function(e,t){return{index:t,x:e[0],y:e[1]}}).sort(function(e,t){return e.y<t.y?-1:e.y>t.y?1:e.x<t.x?-1:e.x>t.x?1:0}),bottomSite:null},r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l"),r.rightEnd=r.createHalfEdge(null,"l"),r.leftEnd.r=r.rightEnd,r.rightEnd.l=r.leftEnd,r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(e,t){return{edge:e,side:t,vertex:null,l:null,r:null}},insert:function(e,t){t.l=e,t.r=e.r,e.r.l=t,e.r=t},leftBound:function(e){var t=r.leftEnd;do t=t.r;while(t!=r.rightEnd&&i.rightOf(t,e));return t=t.l,t},del:function(e){e.l.r=e.r,e.r.l=e.l,e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[ho[e.side]]}},i={bisect:function(e,t){var n={region:{l:e,r:t},ep:{l:null,r:null}},r=t.x-e.x,i=t.y-e.y,s=r>0?r:-r,o=i>0?i:-i;return n.c=e.x*r+e.y*i+(r*r+i*i)*.5,s>o?(n.a=1,n.b=i/r,n.c/=r):(n.b=1,n.a=r/i,n.c/=i),n},intersect:function(e,t){var n=e.edge,r=t.edge;if(!n||!r||n.region.r==r.region.r)return null;var i=n.a*r.b-n.b*r.a;if(Math.abs(i)<1e-10)return null;var s=(n.c*r.b-r.c*n.b)/i,o=(r.c*n.a-n.c*r.a)/i,u=n.region.r,a=r.region.r,f,l;u.y<a.y||u.y==a.y&&u.x<a.x?(f=e,l=n):(f=t,l=r);var c=s>=l.region.r.x;return c&&f.side==="l"||!c&&f.side==="r"?null:{x:s,y:o}},rightOf:function(e,t){var n=e.edge,r=n.region.r,i=t.x>r.x;if(i&&e.side==="l")return 1;if(!i&&e.side==="r")return 0;if(n.a===1){var s=t.y-r.y,o=t.x-r.x,u=0,a=0;!i&&n.b<0||i&&n.b>=0?a=u=s>=n.b*o:(a=t.x+t.y*n.b>n.c,n.b<0&&(a=!a),a||(u=1));if(!u){var f=r.x-n.region.l.x;a=n.b*(o*o-s*s)<f*s*(1+2*o/f+n.b*n.b),n.b<0&&(a=!a)}}else{var l=n.c-n.a*t.x,c=t.y-l,h=t.x-r.x,p=l-r.y;a=c*c>h*h+p*p}return e.side==="l"?a:!a},endPoint:function(e,n,r){e.ep[n]=r;if(!e.ep[ho[n]])return;t(e)},distance:function(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}},s={list:[],insert:function(e,t,n){e.vertex=t,e.ystar=t.y+n;for(var r=0,i=s.list,o=i.length;r<o;r++){var u=i[r];if(e.ystar>u.ystar||e.ystar==u.ystar&&t.x>u.vertex.x)continue;break}i.splice(r,0,e)},del:function(e){for(var t=0,n=s.list,r=n.length;t<r&&n[t]!=e;++t);n.splice(t,1)},empty:function(){return s.list.length===0},nextEvent:function(e){for(var t=0,n=s.list,r=n.length;t<r;++t)if(n[t]==e)return n[t+1];return null},min:function(){var e=s.list[0];return{x:e.vertex.x,y:e.ystar}},extractMin:function(){return s.list.shift()}};r.init(),n.bottomSite=n.list.shift();var o=n.list.shift(),u,a,f,l,c,h,p,d,v,m,g,y,b;for(;;){s.empty()||(u=s.min());if(o&&(s.empty()||o.y<u.y||o.y==u.y&&o.x<u.x))a=r.leftBound(o),f=r.right(a),p=r.rightRegion(a),y=i.bisect(p,o),h=r.createHalfEdge(y,"l"),r.insert(a,h),m=i.intersect(a,h),m&&(s.del(a),s.insert(a,m,i.distance(m,o))),a=h,h=r.createHalfEdge(y,"r"
+),r.insert(a,h),m=i.intersect(h,f),m&&s.insert(h,m,i.distance(m,o)),o=n.list.shift();else{if(!!s.empty())break;a=s.extractMin(),l=r.left(a),f=r.right(a),c=r.right(f),p=r.leftRegion(a),d=r.rightRegion(f),g=a.vertex,i.endPoint(a.edge,a.side,g),i.endPoint(f.edge,f.side,g),r.del(a),s.del(f),r.del(f),b="l",p.y>d.y&&(v=p,p=d,d=v,b="r"),y=i.bisect(p,d),h=r.createHalfEdge(y,b),r.insert(l,h),i.endPoint(y,ho[b],g),m=i.intersect(l,h),m&&(s.del(l),s.insert(l,m,i.distance(m,p))),m=i.intersect(h,c),m&&s.insert(h,m,i.distance(m,p))}}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a))t(a.edge)}function ui(){return{leaf:!0,nodes:[],point:null}}function ai(e,t,n,r,i,s){if(!e(t,n,r,i,s)){var o=(n+i)*.5,u=(r+s)*.5,a=t.nodes;a[0]&&ai(e,a[0],n,r,o,u),a[1]&&ai(e,a[1],o,r,i,u),a[2]&&ai(e,a[2],n,u,o,s),a[3]&&ai(e,a[3],o,u,i,s)}}function fi(e){return{x:e[0],y:e[1]}}function li(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function ci(e){return e.substring(0,3)}function hi(e,t,n,r){var i,s,o=0,u=t.length,a=n.length;while(o<u){if(r>=a)return-1;i=t.charCodeAt(o++);if(i==37){s=Ho[t.charAt(o++)];if(!s||(r=s(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function pi(e){return new RegExp("^(?:"+e.map(d3.requote).join("|")+")","i")}function di(e){var t=new r,n=-1,i=e.length;while(++n<i)t.set(e[n].toLowerCase(),n);return t}function vi(e,t,n){Ao.lastIndex=0;var r=Ao.exec(t.substring(n));return r?n+=r[0].length:-1}function mi(e,t,n){Lo.lastIndex=0;var r=Lo.exec(t.substring(n));return r?n+=r[0].length:-1}function gi(e,t,n){_o.lastIndex=0;var r=_o.exec(t.substring(n));return r?(e.m=Do.get(r[0].toLowerCase()),n+=r[0].length):-1}function yi(e,t,n){Oo.lastIndex=0;var r=Oo.exec(t.substring(n));return r?(e.m=Mo.get(r[0].toLowerCase()),n+=r[0].length):-1}function bi(e,t,n){return hi(e,Po.c.toString(),t,n)}function wi(e,t,n){return hi(e,Po.x.toString(),t,n)}function Ei(e,t,n){return hi(e,Po.X.toString(),t,n)}function Si(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+4));return r?(e.y=+r[0],n+=r[0].length):-1}function xi(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.y=Ti(+r[0]),n+=r[0].length):-1}function Ti(e){return e+(e>68?1900:2e3)}function Ni(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.m=r[0]-1,n+=r[0].length):-1}function Ci(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.d=+r[0],n+=r[0].length):-1}function ki(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.H=+r[0],n+=r[0].length):-1}function Li(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.M=+r[0],n+=r[0].length):-1}function Ai(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.S=+r[0],n+=r[0].length):-1}function Oi(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+3));return r?(e.L=+r[0],n+=r[0].length):-1}function Mi(e,t,n){var r=jo.get(t.substring(n,n+=2).toLowerCase());return r==null?-1:(e.p=r,n)}function _i(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return n+To(r)+To(i)}function Di(e){return e.toISOString()}function Pi(e,t,n){function r(t){var n=e(t),r=s(n,1);return t-n<r-t?n:r}function i(n){return t(n=e(new po(n-1)),1),n}function s(e,n){return t(e=new po(+e),n),e}function o(e,r,s){var o=i(e),u=[];if(s>1)while(o<r)n(o)%s||u.push(new Date(+o)),t(o,1);else while(o<r)u.push(new Date(+o)),t(o,1);return u}function u(e,t,n){try{po=li;var r=new li;return r._=e,o(r,t,n)}finally{po=Date}}e.floor=e,e.round=r,e.ceil=i,e.offset=s,e.range=o;var a=e.utc=Hi(e);return a.floor=a,a.round=Hi(r),a.ceil=Hi(i),a.offset=Hi(s),a.range=u,e}function Hi(e){return function(t,n){try{po=li;var r=new li;return r._=t,e(r,n)._}finally{po=Date}}}function Bi(e,t,n){function r(t){return e(t)}return r.invert=function(t){return Fi(e.invert(t))},r.domain=function(t){return arguments.length?(e.domain(t),r):e.domain().map(Fi)},r.nice=function(e){return r.domain(Dt(r.domain(),function(){return e}))},r.ticks=function(n,i){var s=ji(r.domain());if(typeof n!="function"){var o=s[1]-s[0],u=o/n,a=d3.bisect(Io,u);if(a==Io.length)return t.year(s,n);if(!a)return e.ticks(n).map(Fi);Math.log(u/Io[a-1])<Math.log(Io[a]/u)&&--a,n=t[a],i=n[1],n=n[0].range}return n(s[0],new Date(+s[1]+1),i)},r.tickFormat=function(){return n},r.copy=function(){return Bi(e.copy(),t,n)},d3.rebind(r,e,"range","rangeRound","interpolate","clamp")}function ji(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function Fi(e){return new Date(e)}function Ii(e){return function(t){var n=e.length-1,r=e[n];while(!r[1](t))r=e[--n];return r[0](t)}}function qi(e){var t=new Date(e,0,1);return t.setFullYear(e),t}function Ri(e){var t=e.getFullYear(),n=qi(t),r=qi(t+1);return t+(e-n)/(r-n)}function Ui(e){var t=new Date(Date.UTC(e,0,1));return t.setUTCFullYear(e),t}function zi(e){var t=e.getUTCFullYear(),n=Ui(t),r=Ui(t+1);return t+(e-n)/(r-n)}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(Wi){var Xi=CSSStyleDeclaration.prototype,Vi=Xi.setProperty;Xi.setProperty=function(e,t,n){Vi.call(this,e,t+"",n)}}d3={version:"2.10.2"};var $i=n;try{$i(document.documentElement.childNodes)[0].nodeType}catch(Ji){$i=t}var Ki=[].__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]};d3.map=function(e){var t=new r;for(var n in e)t.set(n,e[n]);return t},e(r,{has:function(e){return Qi+e in this},get:function(e){return this[Qi+e]},set:function(e,t){return this[Qi+e]=t},remove:function(e){return e=Qi+e,e in this&&delete this[e]},keys:function(){var e=[];return this.forEach(function(t){e.push(t)}),e},values:function(){var e=[];return this.forEach(function(t,n){e.push(n)}),e},entries:function(){var e=[];return this.forEach(function(t,n){e.push({key:t,value:n})}),e},forEach:function(e){for(var t in this)t.charCodeAt(0)===Gi&&e.call(this,t.substring(1),this[t])}});var Qi="\0",Gi=Qi.charCodeAt(0);d3.functor=u,d3.rebind=function(e,t){var n=1,r=arguments.length,i;while(++n<r)e[i=arguments[n]]=a(e,t,t[i]);return e},d3.ascending=function(e,t){return e<t?-1:e>t?1:e>=t?0:NaN},d3.descending=function(e,t){return t<e?-1:t>e?1:t>=e?0:NaN},d3.mean=function(e,t){var n=e.length,r,i=0,s=-1,o=0;if(arguments.length===1)while(++s<n)f(r=e[s])&&(i+=(r-i)/++o);else while(++s<n)f(r=t.call(e,e[s],s))&&(i+=(r-i)/++o);return o?i:undefined},d3.median=function(e,t){return arguments.length>1&&(e=e.map(t)),e=e.filter(f),e.length?d3.quantile(e.sort(d3.ascending),.5):undefined},d3.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)(s=e[n])!=null&&i>s&&(i=s)}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)(s=t.call(e,e[n],n))!=null&&i>s&&(i=s)}return i},d3.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)(s=e[n])!=null&&s>i&&(i=s)}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)(s=t.call(e,e[n],n))!=null&&s>i&&(i=s)}return i},d3.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++n<r&&((i=o=e[n])==null||i!=i))i=o=undefined;while(++n<r)(s=e[n])!=null&&(i>s&&(i=s),o<s&&(o=s))}else{while(++n<r&&((i=o=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)(s=t.call(e,e[n],n))!=null&&(i>s&&(i=s),o<s&&(o=s))}return[i,o]},d3.random={normal:function(e,t){var n=arguments.length;return n<2&&(t=1),n<1&&(e=0),function(){var n,r,i;do n=Math.random()*2-1,r=Math.random()*2-1,i=n*n+r*r;while(!i||i>1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(e,t){var n=arguments.length;n<2&&(t=1),n<1&&(e=0);var r=d3.random.normal();return function(){return Math.exp(e+t*r())}},irwinHall:function(e){return function(){for(var t=0,n=0;n<e;n++)t+=Math.random();return t/e}}},d3.sum=function(e,t){var n=0,r=e.length,i,s=-1;if(arguments.length===1)while(++s<r)isNaN(i=+e[s])||(n+=i);else while(++s<r)isNaN(i=+t.call(e,e[s],s))||(n+=i);return n},d3.quantile=function(e,t){var n=(e.length-1)*t+1,r=Math.floor(n),i=e[r-1],s=n-r;return s?i+s*(e[r]-i):i},d3.transpose=function(e){return d3.zip.apply(d3,e)},d3.zip=function(){if(!(i=arguments.length))return[];for(var e=-1,t=d3.min(arguments,l),n=new Array(t);++e<t;)for(var r=-1,i,s=n[e]=new Array(i);++r<i;)s[r]=arguments[r][e];return n},d3.bisector=function(e){return{left:function(t,n,r,i){arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);while(r<i){var s=r+i>>>1;e.call(t,t[s],s)<n?r=s+1:i=s}return r},right:function(t,n,r,i){arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);while(r<i){var s=r+i>>>1;n<e.call(t,t[s],s)?i=s:r=s+1}return r}}};var Yi=d3.bisector(function(e){return e});d3.bisectLeft=Yi.left,d3.bisect=d3.bisectRight=Yi.right,d3.first=function(e,t){var n=0,r=e.length,i=e[0],s;arguments.length===1&&(t=d3.ascending);while(++n<r)t.call(e,i,s=e[n])>0&&(i=s);return i},d3.last=function(e,t){var n=0,r=e.length,i=e[0],s;arguments.length===1&&(t=d3.ascending);while(++n<r)t.call(e,i,s=e[n])<=0&&(i=s);return i},d3.nest=function(){function e(t,s){if(s>=i.length)return u?u.call(n,t):o?t.sort(o):t;var a=-1,f=t.length,l=i[s++],c,h,p=new r,d,v={};while(++a<f)(d=p.get(c=l(h=t[a])))?d.push(h):p.set(c,[h]);return p.forEach(function(t,n){v[t]=e(n,s)}),v}function t(e,n){if(n>=i.length)return e;var r=[],o=s[n++],u;for(u in e)r.push({key:u,values:t(e[u],n)});return o&&r.sort(function(e,t){return o(e.key,t.key)}),r}var n={},i=[],s=[],o,u;return n.map=function(t){return e(t,0)},n.entries=function(n){return t(e(n,0),0)},n.key=function(e){return i.push(e),n},n.sortKeys=function(e){return s[i.length-1]=e,n},n.sortValues=function(e){return o=e,n},n.rollup=function(e){return u=e,n},n},d3.keys=function(e){var t=[];for(var n in e)t.push(n);return t},d3.values=function(e){var t=[];for(var n in e)t.push(e[n]);return t},d3.entries=function(e){var t=[];for(var n in e)t.push({key:n,value:e[n]});return t},d3.permute=function(e,t){var n=[],r=-1,i=t.length;while(++r<i)n[r]=e[t[r]];return n},d3.merge=function(e){return Array.prototype.concat.apply([],e)},d3.split=function(e,t){var n=[],r=[],i,s=-1,o=e.length;arguments.length<2&&(t=c);while(++s<o)t.call(r,i=e[s],s)?r=[]:(r.length||n.push(r),r.push(i));return n},d3.range=function(e,t,n){arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0));if((t-e)/n===Infinity)throw new Error("infinite range");var r=[],i=p(Math.abs(n)),s=-1,o;e*=i,t*=i,n*=i;if(n<0)while((o=e+n*++s)>t)r.push(o/i);else while((o=e+n*++s)<t)r.push(o/i);return r},d3.requote=function(e){return e.replace(Zi,"\\$&")};var Zi=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)},d3.xhr=function(e,t,n){var r=new XMLHttpRequest;arguments.length<3?(n=t,t=null):t&&r.overrideMimeType&&r.overrideMimeType(t),r.open("GET",e,!0),t&&r.setRequestHeader("Accept",t),r.onreadystatechange=function(){if(r.readyState===4){var e=r.status;n(!e&&r.response||e>=200&&e<300||e===304?r:null)}},r.send(null)},d3.text=function(e,t,n){function r(e){n(e&&e.responseText)}arguments.length<3&&(n=t,t=null),d3.xhr(e,t,r)},d3.json=function(e,t){d3.text(e,"application/json",function(e){t(e?JSON.parse(e):null)})},d3.html=function(e,t){d3.text(e,"text/html",function(e){if(e!=null){var n=document.createRange();n.selectNode(document.body),e=n.createContextualFragment(e)}t(e)})},d3.xml=function(e,t,n){function r(e){n(e&&e.responseXML)}arguments.length<3&&(n=t,t=null),d3.xhr(e,t,r)};var es={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:es,qualify:function(e){var t=e.indexOf(":"),n=e;return t>=0&&(n=e.substring(0,t),e=e.substring(t+1)),es.hasOwnProperty(n)?{space:es[n],local:e}:e}},d3.dispatch=function(){var e=new d,t=-1,n=arguments.length;while(++t<n)e[arguments[t]]=v(e);return e},d.prototype.on=function(e,t){var n=e.indexOf("."),r="";return n>0&&(r=e.substring(n+1),e=e.substring(0,n)),arguments.length<2?this[e].on(r):this[e].on(r,t)},d3.format=function(e){var t=ts.exec(e),n=t[1]||" ",r=t[3]||"",i=t[5],s=+t[6],o=t[7],u=t[8],a=t[9],f=1,l="",c=!1;u&&(u=+u.substring(1)),i&&(n="0",o&&(s-=Math.floor((s-1)/4)));switch(a){case"n":o=!0,a="g";break;case"%":f=100,l="%",a="f";break;case"p":f=100,l="%",a="r";break;case"d":c=!0,u=0;break;case"s":f=-1,a="r"}return a=="r"&&!u&&(a="g"),a=ns.get(a)||g,function(e){if(c&&e%1)return"";var t=e<0&&(e=-e)?"-":r;if(f<0){var h=d3.formatPrefix(e,u);e=h.scale(e),l=h.symbol}else e*=f;e=a(e,u);if(i){var p=e.length+t.length;p<s&&(e=(new Array(s-p+1)).join(n)+e),o&&(e=y(e)),e=t+e}else{o&&(e=y(e)),e=t+e;var p=e.length;p<s&&(e=(new Array(s-p+1)).join(n)+e)}return e+l}};var ts=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,ns=d3.map({g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(e,t){return d3.round(e,t=m(e,t)).toFixed(Math.max(0,Math.min(20,t)))}}),rs=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(b);d3.formatPrefix=function(e,t){var n=0;return e&&(e<0&&(e*=-1),t&&(e=d3.round(e,m(e,t))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,Math.floor((n<=0?n+1:n-1)/3)*3))),rs[8+n/3]};var is=T(2),ss=T(3),os=function(){return x},us=d3.map({linear:os,poly:T,quad:function(){return is},cubic:function(){return ss},sin:function(){return N},exp:function(){return C},circle:function(){return k},elastic:L,back:A,bounce:function(){return O}}),as=d3.map({"in":x,out:E,"in-out":S,"out-in":function(e){return S(E(e))}});d3.ease=function(e){var t=e.indexOf("-"),n=t>=0?e.substring(0,t):e,r=t>=0?e.substring(t+1):"in";return n=us.get(n)||os,r=as.get(r)||x,w(r(n.apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.transform=function(e){var t=document.createElementNS(d3.ns.prefix.svg,"g");return(d3.transform=function(e){t.setAttribute("transform",e);var n=t.transform.baseVal.consolidate();return new P(n?n.matrix:ls)})(e)},P.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var fs=180/Math.PI,ls={a:1,b:0,c:0,d:1,e:0,f:0};d3.interpolate=function(e,t){var n=d3.interpolators.length,r;while(--n>=0&&!(r=d3.interpolators[n](e,t)));return r},d3.interpolateNumber=function(e,t){return t-=e,function(n){return e+t*n}},d3.interpolateRound=function(e,t){return t-=e,function(n){return Math.round(e+t*n)}},d3.interpolateString=function(e,t){var n,r,i,s=0,o=0,u=[],a=[],f,l;cs.lastIndex=0;for(r=0;n=cs.exec(t);++r)n.index&&u.push(t.substring(s,o=n.index)),a.push({i:u.length,x:n[0]}),u.push(null),s=cs.lastIndex;s<t.length&&u.push(t.substring(s));for(r=0,f=a.length;(n=cs.exec(e))&&r<f;++r){l=a[r];if(l.x==n[0]){if(l.i)if(u[l.i+1]==null){u[l.i-1]+=l.x,u.splice(l.i,1);for(i=r+1;i<f;++i)a[i].i--}else{u[l.i-1]+=l.x+u[l.i+1],u.splice(l.i,2);for(i=r+1;i<f;++i)a[i].i-=2}else if(u[l.i+1]==null)u[l.i]=l.x;else{u[l.i]=l.x+u[l.i+1],u.splice(l.i+1,1);for(i=r+1;i<f;++i)a[i].i--}a.splice(r,1),f--,r--}else l.x=d3.interpolateNumber(parseFloat(n[0]),parseFloat(l.x))}while(r<f)l=a.pop(),u[l.i+1]==null?u[l.i]=l.x:(u[l.i]=l.x+u[l.i+1],u.splice(l.i+1,1)),f--;return u.length===1?u[0]==null?a[0].x:function(){return t}:function(e){for(r=0;r<f;++r)u[(l=a[r]).i]=l.x(e);return u.join("")}},d3.interpolateTransform=function(e,t){var n=[],r=[],i,s=d3.transform(e),o=d3.transform(t),u=s.translate,a=o.translate,f=s.rotate,l=o.rotate,c=s.skew,h=o.skew,p=s.scale,d=o.scale;return u[0]!=a[0]||u[1]!=a[1]?(n.push("translate(",null,",",null,")"),r.push({i:1,x:d3.interpolateNumber(u[0],a[0])},{i:3,x:d3.interpolateNumber(u[1],a[1])})):a[0]||a[1]?n.push("translate("+a+")"):n.push(""),f!=l?(f-l>180?l+=360:l-f>180&&(f+=360),r.push({i:n.push(n.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(f,l)})):l&&n.push(n.pop()+"rotate("+l+")"),c!=h?r.push({i:n.push(n.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(c,h)}):h&&n.push(n.pop()+"skewX("+h+")"),p[0]!=d[0]||p[1]!=d[1]?(i=n.push(n.pop()+"scale(",null,",",null,")"),r.push({i:i-4,x:d3.interpolateNumber(p[0],d[0])},{i:i-2,x:d3.interpolateNumber(p[1],d[1])})):(d[0]!=1||d[1]!=1)&&n.push(n.pop()+"scale("+d+")"),i=r.length,function(e){var t=-1,s;while(++t<i)n[(s=r[t]).i]=s.x(e);return n.join("")}},d3.interpolateRgb=function(e,t){e=d3.rgb(e),t=d3.rgb(t);var n=e.r,r=e.g,i=e.b,s=t.r-n,o=t.g-r,u=t.b-i;return function(e){return"#"+z(Math.round(n+s*e))+z(Math.round(r+o*e))+z(Math.round(i+u*e))}},d3.interpolateHsl=function(e,t){e=d3.hsl(e),t=d3.hsl(t);var n=e.h,r=e.s,i=e.l,s=t.h-n,o=t.s-r,u=t.l-i;return s>180?s-=360:s<-180&&(s+=360),function(e){return G(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateLab=function(e,t){e=d3.lab(e),t=d3.lab(t);var n=e.l,r=e.a,i=e.b,s=t.l-n,o=t.a-r,u=t.b-i;return function(e){return rt(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateHcl=function(e,t){e=d3.hcl(e),t=d3.hcl(t);var n=e.h,r=e.c,i=e.l,s=t.h-n,o=t.c-r,u=t.l-i;return s>180?s-=360:s<-180&&(s+=360),function(e){return et(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateArray=function(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u<o;++u)n.push(d3.interpolate(e[u],t[u]));for(;u<i;++u)r[u]=e[u];for(;u<s;++u)r[u]=t[u];return function(e){for(u=0;u<o;++u)r[u]=n[u](e);return r}},d3.interpolateObject=function(e,t){var n={},r={},i;for(i in e)i in t?n[i]=F(i)(e[i],t[i]):r[i]=e[i];for(i in t)i in e||(r[i]=t[i]);return function(e){for(i in n)r[i]=n[i](e);return r}};var cs=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;d3.interpolators=[d3.interpolateObject,function(e,t){return t instanceof Array&&d3.interpolateArray(e,t)},function(e,t){return(typeof e=="string"||typeof t=="string")&&d3.interpolateString(e+"",t+"")},function(e,t){return(typeof t=="string"?hs.has(t)||/^(#|rgb\(|hsl\()/.test(t):t instanceof U||t instanceof Q)&&d3.interpolateRgb(e,t)},function(e,t){return!isNaN(e=+e)&&!isNaN(t=+t)&&d3.interpolateNumber(e,t)}],d3.rgb=function(e,t,n){return arguments.length===1?e instanceof U?R(e.r,e.g,e.b):W(""+e,R,G):R(~~e,~~t,~~n)},U.prototype.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,n=this.g,r=this.b,i=30;return!t&&!n&&!r?R(i,i,i):(t&&t<i&&(t=i),n&&n<i&&(n=i),r&&r<i&&(r=i),R(Math.min(255,Math.floor(t/e)),Math.min(255,Math.floor(n/e)),Math.min(255,Math.floor(r/e))))},U.prototype.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),R(Math.floor(e*this.r),Math.floor(e*this.g),Math.floor(e*this.b))},U.prototype.hsl=function(){return X(this.r,this.g,this.b)},U.prototype.toString=function(){return"#"+z(this.r)+z(this.g)+z(this.b)};var hs=d3.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});hs.forEach(function(e,t){hs.set(e,W(t,R,G))}),d3.hsl=function(e,t,n){return arguments.length===1?e instanceof Q?K(e.h,e.s,e.l):W(""+e,X,K):K(+e,+t,+n)},Q.prototype.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),K(this.h,this.s,this.l/e)},Q.prototype.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),K(this.h,this.s,e*this.l)},Q.prototype.rgb=function(){return G(this.h,this.s,this.l)},Q.prototype.toString=function(){return this.rgb().toString()},d3.hcl=function(e,t,n){return arguments.length===1?e instanceof Z?Y(e.h,e.c,e.l):e instanceof nt?it(e.l,e.a,e.b):it((e=V((e=d3.rgb(e)).r,e.g,e.b)).l,e.a,e.b):Y(+e,+t,+n)},Z.prototype.brighter=function(e){return Y(this.h,this.c,Math.min(100,this.l+ps*(arguments.length?e:1)))},Z.prototype.darker=function(e){return Y(this.h,this.c,Math.max(0,this.l-ps*(arguments.length?e:1)))},Z.prototype.rgb=function(){return et(this.h,this.c,this.l).rgb()},Z.prototype.toString=function(){return this.rgb()+""},d3.lab=function(e,t,n){return arguments.length===1?e instanceof nt?tt(e.l,e.a,e.b):e instanceof Z?et(e.l,e.c,e.h):V((e=d3.rgb(e)).r,e.g,e.b):tt(+e,+t,+n)};var ps=18,ds=.95047,vs=1,ms=1.08883;nt.prototype.brighter=function(e){return tt(Math.min(100,this.l+ps*(arguments.length?e:1)),this.a,this.b)},nt.prototype.darker=function(e){return tt(Math.max(0,this.l-ps*(arguments.length?e:1)),this.a,this.b)},nt.prototype.rgb=function(){return rt(this.l,this.a,this.b)},nt.prototype.toString=function(){return this.rgb()+""};var gs=function(e,t){return t.querySelector(e)},ys=function(e,t){return t.querySelectorAll(e)},bs=document.documentElement,ws=bs.matchesSelector||bs.webkitMatchesSelector||bs.mozMatchesSelector||bs.msMatchesSelector||bs.oMatchesSelector,Es=function(e,t){return ws.call(e,t)};typeof Sizzle=="function"&&(gs=function(e,t){return Sizzle(e,t)[0]||null},ys=function(e,t){return Sizzle.uniqueSort(Sizzle(e,t))},Es=Sizzle.matchesSelector);var Ss=[];d3.selection=function(){return xs},d3.selection.prototype=Ss,Ss.select=function(e){var t=[],n,r,i,s;typeof e!="function"&&(e=ft(e));for(var o=-1,u=this.length;++o<u;){t.push(n=[]),n.parentNode=(i=this[o]).parentNode;for(var a=-1,f=i.length;++a<f;)(s=i[a])?(n.push(r=e.call(s,s.__data__,a)),r&&"__data__"in s&&(r.__data__=s.__data__)):n.push(null)}return at(t)},Ss.selectAll=function(e){var t=[],n,r;typeof e!="function"&&(e=lt(e));for(var i=-1,s=this.length;++i<s;)for(var o=this[i],u=-1,a=o.length;++u<a;)if(r=o[u])t.push(n=$i(e.call(r,r.__data__,u))),n.parentNode=r;return at(t)},Ss.attr=function(e,t){if(arguments.length<2){if(typeof e=="string"){var n=this.node();return e=d3.ns.qualify(e),e.local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(t in e)this.each(ct(t,e[t]));return this}return this.each(ct(e,t))},Ss.classed=function(e,t){if(arguments.length<2){if(typeof e=="string"){var n=this.node(),r=(e=e.trim().split(/^|\s+/g)).length,i=-1;if(t=n.classList){while(++i<r)if(!t.contains(e[i]))return!1}else{t=n.className,t.baseVal!=null&&(t=t.baseVal);while(++i<r)if(!ht(e[i]).test(t))return!1}return!0}for(t in e)this.each(pt(t,e[t]));return this}return this.each(pt(e,t))},Ss.style=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t="");for(n in e)this.each(vt(n,e[n],t));return this}if(r<2)return window.getComputedStyle(this.node(),null).getPropertyValue(e);n=""}return this.each(vt(e,t,n))},Ss.property=function(e,t){if(arguments.length<2){if(typeof e=="string")return this.node()[e];for(t in e)this.each(mt(t,e[t]));return this}return this.each(mt(e,t))},Ss.text=function(e){return arguments.length<1?this.node().textContent:this.each(typeof e=="function"?function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}:e==null?function(){this.textContent=""}:function(){this.textContent=e})},Ss.html=function(e){return arguments.length<1?this.node().innerHTML:this.each(typeof e=="function"?function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}:e==null?function(){this.innerHTML=""}:function(){this.innerHTML=e})},Ss.append=function(e){function t(){return this.appendChild(document.createElementNS(this.namespaceURI,e))}function n(){return this.appendChild(document.createElementNS(e.space,e.local))}return e=d3.ns.qualify(e),this.select(e.local?n:t)},Ss.insert=function(e,t){function n(){return this.insertBefore(document.createElementNS(this.namespaceURI,e),gs(t,this))}function r(){return this.insertBefore(document.createElementNS(e.space,e.local),gs(t,this))}return e=d3.ns.qualify(e),this.select(e.local?r:n)},Ss.remove=function(){return this.each(function(){var e=this.parentNode;e&&e.removeChild(this)})},Ss.data=function(e,t){function n(e,n){var i,s=e.length,o=n.length,u=Math.min(s,o),c=Math.max(s,o),h=[],p=[],d=[],v,m;if(t){var g=new r,y=[],b,w=n.length;for(i=-1;++i<s;)b=t.call(v=e[i],v.__data__,i),g.has(b)?d[w++]=v:g.set(b,v),y.push(b);for(i=-1;++i<o;)b=t.call(n,m=n[i],i),g.has(b)?(h[i]=v=g.get(b),v.__data__=m,p[i]=d[i]=null):(p[i]=gt(m),h[i]=d[i]=null),g.remove(b);for(i=-1;++i<s;)g.has(y[i])&&(d[i]=e[i])}else{for(i=-1;++i<u;)v=e[i],m=n[i],v?(v.__data__=m,h[i]=v,p[i]=d[i]=null):(p[i]=gt(m),h[i]=d[i]=null);for(;i<o;++i)p[i]=gt(n[i]),h[i]=d[i]=null;for(;i<c;++i)d[i]=e[i],p[i]=h[i]=null}p.update=h,p.parentNode=h.parentNode=d.parentNode=e.parentNode,a.push(p),f.push(h),l.push(d)}var i=-1,s=this.length,o,u;if(!arguments.length){e=new Array(s=(o=this[0]).length);while(++i<s)if(u=o[i])e[i]=u.__data__;return e}var a=St([]),f=at([]),l=at([]);if(typeof e=="function")while(++i<s)n(o=this[i],e.call(o,o.parentNode.__data__,i));else while(++i<s)n(o=this[i],e);return f.enter=function(){return a},f.exit=function(){return l},f},Ss.datum=Ss.map=function(e){return arguments.length<1?this.property("__data__"):this.property("__data__",e)},Ss.filter=function(e){var t=[],n,r,i;typeof e!="function"&&(e=yt(e));for(var s=0,o=this.length;s<o;s++){t.push(n=[]),n.parentNode=(r=this[s]).parentNode;for(var u=0,a=r.length;u<a;u++)(i=r[u])&&e.call(i,i.__data__,u)&&n.push(i)}return at(t)},Ss.order=function(){for(var e=-1,t=this.length;++e<t;)for(var n=this[e],r=n.length-1,i=n[r],s;--r>=0;)if(s=n[r])i&&i!==s.nextSibling&&i.parentNode.insertBefore(s,i),i=s;return this},Ss.sort=function(e){e=bt.apply(this,arguments);for(var t=-1,n=this.length;++t<n;)this[t].sort(e);return this.order()},Ss.on=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t=!1);for(n in e)this.each(wt(n,e[n],t));return this}if(r<2)return(r=this.node()["__on"+e])&&r._;n=!1}return this.each(wt(e,t,n))},Ss.each=function(e){return Et(this,function(t,n,r){e.call(t,t.__data__,n,r)})},Ss.call=function(e){return e.apply(this,(arguments[0]=this,arguments)),this},Ss.empty=function(){return!this.node()},Ss.node=function(e){for(var t=0,n=this.length;t<n;t++)for(var r=this[t],i=0,s=r.length;i<s;i++){var o=r[i];if(o)return o}return null},Ss.transition=function(){var e=[],t,n;for(var r=-1,i=this.length;++r<i;){e.push(t=[]);for(var s=this[r],o=-1,u=s.length;++o<u;)t.push((n=s[o])?{node:n,delay:Ms,duration:_s}:null)}return xt(e,ks||++Cs,Date.now())};var xs=at([[document]]);xs[0].parentNode=bs,d3.select=function(e){return typeof e=="string"?xs.select(e):at([[e]])},d3.selectAll=function(e){return typeof e=="string"?xs.selectAll(e):at([$i(e)])};var Ts=[];d3.selection.enter=St,d3.selection.enter.prototype=Ts,Ts.append=Ss.append,Ts.insert=Ss.insert,Ts.empty=Ss.empty,Ts.node=Ss.node,Ts.select=function(e){var t=[],n,r,i,s,o;for(var u=-1,a=this.length;++u<a;){i=(s=this[u]).update,t.push(n=[]),n.parentNode=s.parentNode;for(var f=-1,l=s.length;++f<l;)(o=s[f])?(n.push(i[f]=r=e.call(s.parentNode,o.__data__,f)),r.__data__=o.__data__):n.push(null)}return at(t)};var Ns=[],Cs=0,ks=0,Ls=0,As=250,Os=d3.ease("cubic-in-out"),Ms=Ls,_s=As,Ds=Os;Ns.call=Ss.call,d3.transition=function(e){return arguments.length?ks?e.transition():e:xs.transition()},d3.transition.prototype=Ns,Ns.select=function(e){var t=[],n,r,i;typeof e!="function"&&(e=ft(e));for(var s=-1,o=this.length;++s<o;){t.push(n=[]);for(var u=this[s],a=-1,f=u.length;++a<f;)(i=u[a])&&(r=e.call(i.node,i.node.__data__,a))?("__data__"in i.node&&(r.__data__=i.node.__data__),n.push({node:r,delay:i.delay,duration:i.duration})):n.push(null)}return xt(t,this.id,this.time).ease(this.ease())},Ns.selectAll=function(e){var t=[],n,r,i;typeof e!="function"&&(e=lt(e));for(var s=-1,o=this.length;++s<o;)for(var u=this[s],a=-1,f=u.length;++a<f;)if(i=u[a]){r=e.call(i.node,i.node.__data__,a),t.push(n=[]);for(var l=-1,c=r.length;++l<c;)n.push({node:r[l],delay:i.delay,duration:i.duration})}return xt(t,this.id,this.time).ease(this.ease())},Ns.filter=function(e){var t=[],n,r,i;typeof e!="function"&&(e=yt(e));for(var s=0,o=this.length;s<o;s++){t.push(n=[]);for(var r=this[s],u=0,a=r.length;u<a;u++)(i=r[u])&&e.call(i.node,i.node.__data__,u)&&n.push(i)}return xt(t,this.id,this.time).ease(this.ease())},Ns.attr=function(e,t){if(arguments.length<2){for(t in e)this.attrTween(t,Ct(e[t],t));return this}return this.attrTween(e,Ct(t,e))},Ns.attrTween=function(e,t){function n(e,n){var r=t.call(this,e,n,this.getAttribute(i));return r===Ps?(this.removeAttribute(i),null):r&&function(e){this.setAttribute(i,r(e))}}function r(e,n){var r=t.call(this,e,n,this.getAttributeNS(i.space,i.local));return r===Ps?(this.removeAttributeNS(i.space,i.local),null):r&&function(e){this.setAttributeNS(i.space,i.local,r(e))}}var i=d3.ns.qualify(e);return this.tween("attr."+e,i.local?r:n)},Ns.style=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t="");for(n in e)this.styleTween(n,Ct(e[n],n),t);return this}n=""}return this.styleTween(e,Ct(t,e),n)},Ns.styleTween=function(e,t,n){return arguments.length<3&&(n=""),this.tween("style."+e,function(r,i){var s=t.call(this,r,i,window.getComputedStyle(this,null).getPropertyValue(e));return s===Ps?(this.style.removeProperty(e),null):s&&function(t){this.style.setProperty(e,s(t),n)}})},Ns.text=function(e){return this.tween("text",function(t,n){this.textContent=typeof e=="function"?e.call(this,t,n):e})},Ns.remove=function(){return this.each("end.transition",function(){var e;!this.__transition__&&(e=this.parentNode)&&e.removeChild(this)})},Ns.delay=function(e){return Et(this,typeof e=="function"?function(t,n,r){t.delay=e.call(t=t.node,t.__data__,n,r)|0}:(e|=0,function(t){t.delay=e}))},Ns.duration=function(e){return Et(this,typeof e=="function"?function(t,n,r){t.duration=Math.max(1,e.call(t=t.node,t.__data__,n,r)|0)}:(e=Math.max(1,e|0),function(t){t.duration=e}))},Ns.transition=function(){return this.select(s)},d3.tween=function(e,t){function n(n,r,i){var s=e.call(this,n,r);return s==null?i!=""&&Ps:i!=s&&t(i,s)}function r(n,r,i){return i!=e&&t(i,e)}return typeof e=="function"?n:e==null?Nt:(e+="",r)};var Ps={},Hs=null,Bs,js;d3.timer=function(e,t,n){var r=!1,i,s=Hs;if(arguments.length<3){if(arguments.length<2)t=0;else if(!isFinite(t))return;n=Date.now()}while(s){if(s.callback===e){s.then=n,s.delay=t,r=!0;break}i=s,s=s.next}r||(Hs={callback:e,then:n,delay:t,next:Hs}),Bs||(js=clearTimeout(js),Bs=1,Fs(kt))},d3.timer.flush=function(){var e,t=Date.now(),n=Hs;while(n)e=t-n.then,n.delay||(n.flush=n.callback(e)),n=n.next;Lt()};var Fs=window.requestAnimationFrame||window.webkitRequestAnimationFrame||
+window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,17)};d3.mouse=function(e){return At(e,_())};var Is=/WebKit/.test(navigator.userAgent)?-1:0;d3.touches=function(e,t){return arguments.length<2&&(t=_().touches),t?$i(t).map(function(t){var n=At(e,t);return n.identifier=t.identifier,n}):[]},d3.scale={},d3.scale.linear=function(){return Ht([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return zt(d3.scale.linear(),Wt)};var qs=d3.format(".0e");Wt.pow=function(e){return Math.pow(10,e)},Xt.pow=function(e){return-Math.pow(10,-e)},d3.scale.pow=function(){return Vt(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return Jt([],{t:"range",a:[[]]})},d3.scale.category10=function(){return d3.scale.ordinal().range(Rs)},d3.scale.category20=function(){return d3.scale.ordinal().range(Us)},d3.scale.category20b=function(){return d3.scale.ordinal().range(zs)},d3.scale.category20c=function(){return d3.scale.ordinal().range(Ws)};var Rs=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Us=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],zs=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],Ws=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return Kt([],[])},d3.scale.quantize=function(){return Qt(0,1,[0,1])},d3.scale.threshold=function(){return Gt([.5],[0,1])},d3.scale.identity=function(){return Yt([0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=t.apply(this,arguments),s=n.apply(this,arguments),o=r.apply(this,arguments)+Xs,u=i.apply(this,arguments)+Xs,a=(u<o&&(a=o,o=u,u=a),u-o),f=a<Math.PI?"0":"1",l=Math.cos(o),c=Math.sin(o),h=Math.cos(u),p=Math.sin(u);return a>=Vs?e?"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"Z":e?"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L"+e*h+","+e*p+"A"+e+","+e+" 0 "+f+",0 "+e*l+","+e*c+"Z":"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L0,0"+"Z"}var t=Zt,n=en,r=tn,i=nn;return e.innerRadius=function(n){return arguments.length?(t=u(n),e):t},e.outerRadius=function(t){return arguments.length?(n=u(t),e):n},e.startAngle=function(t){return arguments.length?(r=u(t),e):r},e.endAngle=function(t){return arguments.length?(i=u(t),e):i},e.centroid=function(){var e=(t.apply(this,arguments)+n.apply(this,arguments))/2,s=(r.apply(this,arguments)+i.apply(this,arguments))/2+Xs;return[Math.cos(s)*e,Math.sin(s)*e]},e};var Xs=-Math.PI/2,Vs=2*Math.PI-1e-6;d3.svg.line=function(){return rn(i)};var $s=d3.map({linear:un,"linear-closed":an,"step-before":fn,"step-after":ln,basis:mn,"basis-open":gn,"basis-closed":yn,bundle:bn,cardinal:pn,"cardinal-open":cn,"cardinal-closed":hn,monotone:Nn});$s.forEach(function(e,t){t.key=e,t.closed=/-closed$/.test(e)});var Js=[0,2/3,1/3,0],Ks=[0,1/3,2/3,0],Qs=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var e=rn(Cn);return e.radius=e.x,delete e.x,e.angle=e.y,delete e.y,e},fn.reverse=ln,ln.reverse=fn,d3.svg.area=function(){return kn(i)},d3.svg.area.radial=function(){var e=kn(Cn);return e.radius=e.x,delete e.x,e.innerRadius=e.x0,delete e.x0,e.outerRadius=e.x1,delete e.x1,e.angle=e.y,delete e.y,e.startAngle=e.y0,delete e.y0,e.endAngle=e.y1,delete e.y1,e},d3.svg.chord=function(){function e(e,u){var a=t(this,s,e,u),f=t(this,o,e,u);return"M"+a.p0+r(a.r,a.p1,a.a1-a.a0)+(n(a,f)?i(a.r,a.p1,a.r,a.p0):i(a.r,a.p1,f.r,f.p0)+r(f.r,f.p1,f.a1-f.a0)+i(f.r,f.p1,a.r,a.p0))+"Z"}function t(e,t,n,r){var i=t.call(e,n,r),s=a.call(e,i,r),o=f.call(e,i,r)+Xs,u=l.call(e,i,r)+Xs;return{r:s,a0:o,a1:u,p0:[s*Math.cos(o),s*Math.sin(o)],p1:[s*Math.cos(u),s*Math.sin(u)]}}function n(e,t){return e.a0==t.a0&&e.a1==t.a1}function r(e,t,n){return"A"+e+","+e+" 0 "+ +(n>Math.PI)+",1 "+t}function i(e,t,n,r){return"Q 0,0 "+r}var s=Ln,o=An,a=On,f=tn,l=nn;return e.radius=function(t){return arguments.length?(a=u(t),e):a},e.source=function(t){return arguments.length?(s=u(t),e):s},e.target=function(t){return arguments.length?(o=u(t),e):o},e.startAngle=function(t){return arguments.length?(f=u(t),e):f},e.endAngle=function(t){return arguments.length?(l=u(t),e):l},e},d3.svg.diagonal=function(){function e(e,i){var s=t.call(this,e,i),o=n.call(this,e,i),u=(s.y+o.y)/2,a=[s,{x:s.x,y:u},{x:o.x,y:u},o];return a=a.map(r),"M"+a[0]+"C"+a[1]+" "+a[2]+" "+a[3]}var t=Ln,n=An,r=Dn;return e.source=function(n){return arguments.length?(t=u(n),e):t},e.target=function(t){return arguments.length?(n=u(t),e):n},e.projection=function(t){return arguments.length?(r=t,e):r},e},d3.svg.diagonal.radial=function(){var e=d3.svg.diagonal(),t=Dn,n=e.projection;return e.projection=function(e){return arguments.length?n(Pn(t=e)):t},e},d3.svg.mouse=d3.mouse,d3.svg.touches=d3.touches,d3.svg.symbol=function(){function e(e,r){return(Gs.get(t.call(this,e,r))||jn)(n.call(this,e,r))}var t=Bn,n=Hn;return e.type=function(n){return arguments.length?(t=u(n),e):t},e.size=function(t){return arguments.length?(n=u(t),e):n},e};var Gs=d3.map({circle:jn,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+ -3*t+","+ -t+"H"+ -t+"V"+ -3*t+"H"+t+"V"+ -t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+ -t+"V"+t+"H"+ -3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*Zs)),n=t*Zs;return"M0,"+ -t+"L"+n+",0"+" 0,"+t+" "+ -n+",0"+"Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+ -t+","+ -t+"L"+t+","+ -t+" "+t+","+t+" "+ -t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/Ys),n=t*Ys/2;return"M0,"+n+"L"+t+","+ -n+" "+ -t+","+ -n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/Ys),n=t*Ys/2;return"M0,"+ -n+"L"+t+","+n+" "+ -t+","+n+"Z"}});d3.svg.symbolTypes=Gs.keys();var Ys=Math.sqrt(3),Zs=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function e(e){e.each(function(){var e=d3.select(this),c=a==null?t.ticks?t.ticks.apply(t,u):t.domain():a,h=f==null?t.tickFormat?t.tickFormat.apply(t,u):String:f,p=qn(t,c,l),d=e.selectAll(".minor").data(p,String),v=d.enter().insert("line","g").attr("class","tick minor").style("opacity",1e-6),m=d3.transition(d.exit()).style("opacity",1e-6).remove(),g=d3.transition(d).style("opacity",1),y=e.selectAll("g").data(c,String),b=y.enter().insert("g","path").style("opacity",1e-6),w=d3.transition(y.exit()).style("opacity",1e-6).remove(),E=d3.transition(y).style("opacity",1),S,x=_t(t),T=e.selectAll(".domain").data([0]),N=T.enter().append("path").attr("class","domain"),C=d3.transition(T),k=t.copy(),L=this.__chart__||k;this.__chart__=k,b.append("line").attr("class","tick"),b.append("text");var A=b.select("line"),O=E.select("line"),M=y.select("text").text(h),_=b.select("text"),D=E.select("text");switch(n){case"bottom":S=Fn,v.attr("y2",i),g.attr("x2",0).attr("y2",i),A.attr("y2",r),_.attr("y",Math.max(r,0)+o),O.attr("x2",0).attr("y2",r),D.attr("x",0).attr("y",Math.max(r,0)+o),M.attr("dy",".71em").attr("text-anchor","middle"),C.attr("d","M"+x[0]+","+s+"V0H"+x[1]+"V"+s);break;case"top":S=Fn,v.attr("y2",-i),g.attr("x2",0).attr("y2",-i),A.attr("y2",-r),_.attr("y",-(Math.max(r,0)+o)),O.attr("x2",0).attr("y2",-r),D.attr("x",0).attr("y",-(Math.max(r,0)+o)),M.attr("dy","0em").attr("text-anchor","middle"),C.attr("d","M"+x[0]+","+ -s+"V0H"+x[1]+"V"+ -s);break;case"left":S=In,v.attr("x2",-i),g.attr("x2",-i).attr("y2",0),A.attr("x2",-r),_.attr("x",-(Math.max(r,0)+o)),O.attr("x2",-r).attr("y2",0),D.attr("x",-(Math.max(r,0)+o)).attr("y",0),M.attr("dy",".32em").attr("text-anchor","end"),C.attr("d","M"+ -s+","+x[0]+"H0V"+x[1]+"H"+ -s);break;case"right":S=In,v.attr("x2",i),g.attr("x2",i).attr("y2",0),A.attr("x2",r),_.attr("x",Math.max(r,0)+o),O.attr("x2",r).attr("y2",0),D.attr("x",Math.max(r,0)+o).attr("y",0),M.attr("dy",".32em").attr("text-anchor","start"),C.attr("d","M"+s+","+x[0]+"H0V"+x[1]+"H"+s)}if(t.ticks)b.call(S,L),E.call(S,k),w.call(S,k),v.call(S,L),g.call(S,k),m.call(S,k);else{var P=k.rangeBand()/2,H=function(e){return k(e)+P};b.call(S,H),E.call(S,H)}})}var t=d3.scale.linear(),n="bottom",r=6,i=6,s=6,o=3,u=[10],a=null,f,l=0;return e.scale=function(n){return arguments.length?(t=n,e):t},e.orient=function(t){return arguments.length?(n=t,e):n},e.ticks=function(){return arguments.length?(u=arguments,e):u},e.tickValues=function(t){return arguments.length?(a=t,e):a},e.tickFormat=function(t){return arguments.length?(f=t,e):f},e.tickSize=function(t,n,o){if(!arguments.length)return r;var u=arguments.length-1;return r=+t,i=u>1?+n:r,s=u>0?+arguments[u]:r,e},e.tickPadding=function(t){return arguments.length?(o=+t,e):o},e.tickSubdivide=function(t){return arguments.length?(l=+t,e):l},e},d3.svg.brush=function(){function e(s){s.each(function(){var s=d3.select(this),f=s.selectAll(".background").data([0]),l=s.selectAll(".extent").data([0]),c=s.selectAll(".resize").data(a,String),h;s.style("pointer-events","all").on("mousedown.brush",i).on("touchstart.brush",i),f.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),l.enter().append("rect").attr("class","extent").style("cursor","move"),c.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return eo[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),c.style("display",e.empty()?"none":null),c.exit().remove(),o&&(h=_t(o),f.attr("x",h[0]).attr("width",h[1]-h[0]),n(s)),u&&(h=_t(u),f.attr("y",h[0]).attr("height",h[1]-h[0]),r(s)),t(s)})}function t(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+f[+/e$/.test(e)][0]+","+f[+/^s/.test(e)][1]+")"})}function n(e){e.select(".extent").attr("x",f[0][0]),e.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1][0]-f[0][0])}function r(e){e.select(".extent").attr("y",f[0][1]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1][1]-f[0][1])}function i(){function i(){var e=d3.event.changedTouches;return e?d3.touches(v,e)[0]:d3.mouse(v)}function a(){d3.event.keyCode==32&&(S||(x=null,T[0]-=f[1][0],T[1]-=f[1][1],S=2),M())}function c(){d3.event.keyCode==32&&S==2&&(T[0]+=f[1][0],T[1]+=f[1][1],S=0,M())}function h(){var e=i(),s=!1;N&&(e[0]+=N[0],e[1]+=N[1]),S||(d3.event.altKey?(x||(x=[(f[0][0]+f[1][0])/2,(f[0][1]+f[1][1])/2]),T[0]=f[+(e[0]<x[0])][0],T[1]=f[+(e[1]<x[1])][1]):x=null),w&&p(e,o,0)&&(n(y),s=!0),E&&p(e,u,1)&&(r(y),s=!0),s&&(t(y),g({type:"brush",mode:S?"move":"resize"}))}function p(e,t,n){var r=_t(t),i=r[0],s=r[1],o=T[n],u=f[1][n]-f[0][n],a,c;S&&(i-=o,s-=u+o),a=Math.max(i,Math.min(s,e[n])),S?c=(a+=o)+u:(x&&(o=Math.max(i,Math.min(s,2*x[n]-a))),o<a?(c=a,a=o):c=o);if(f[0][n]!==a||f[1][n]!==c)return l=null,f[0][n]=a,f[1][n]=c,!0}function d(){h(),y.style("pointer-events","all").selectAll(".resize").style("display",e.empty()?"none":null),d3.select("body").style("cursor",null),C.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),g({type:"brushend"}),M()}var v=this,m=d3.select(d3.event.target),g=s.of(v,arguments),y=d3.select(v),b=m.datum(),w=!/^(n|s)$/.test(b)&&o,E=!/^(e|w)$/.test(b)&&u,S=m.classed("extent"),x,T=i(),N,C=d3.select(window).on("mousemove.brush",h).on("mouseup.brush",d).on("touchmove.brush",h).on("touchend.brush",d).on("keydown.brush",a).on("keyup.brush",c);if(S)T[0]=f[0][0]-T[0],T[1]=f[0][1]-T[1];else if(b){var k=+/w$/.test(b),L=+/^n/.test(b);N=[f[1-k][0]-T[0],f[1-L][1]-T[1]],T[0]=f[k][0],T[1]=f[L][1]}else d3.event.altKey&&(x=T.slice());y.style("pointer-events","none").selectAll(".resize").style("display",null),d3.select("body").style("cursor",m.style("cursor")),g({type:"brushstart"}),h(),M()}var s=D(e,"brushstart","brush","brushend"),o=null,u=null,a=to[0],f=[[0,0],[0,0]],l;return e.x=function(t){return arguments.length?(o=t,a=to[!o<<1|!u],e):o},e.y=function(t){return arguments.length?(u=t,a=to[!o<<1|!u],e):u},e.extent=function(t){var n,r,i,s,a;return arguments.length?(l=[[0,0],[0,0]],o&&(n=t[0],r=t[1],u&&(n=n[0],r=r[0]),l[0][0]=n,l[1][0]=r,o.invert&&(n=o(n),r=o(r)),r<n&&(a=n,n=r,r=a),f[0][0]=n|0,f[1][0]=r|0),u&&(i=t[0],s=t[1],o&&(i=i[1],s=s[1]),l[0][1]=i,l[1][1]=s,u.invert&&(i=u(i),s=u(s)),s<i&&(a=i,i=s,s=a),f[0][1]=i|0,f[1][1]=s|0),e):(t=l||f,o&&(n=t[0][0],r=t[1][0],l||(n=f[0][0],r=f[1][0],o.invert&&(n=o.invert(n),r=o.invert(r)),r<n&&(a=n,n=r,r=a))),u&&(i=t[0][1],s=t[1][1],l||(i=f[0][1],s=f[1][1],u.invert&&(i=u.invert(i),s=u.invert(s)),s<i&&(a=i,i=s,s=a))),o&&u?[[n,i],[r,s]]:o?[n,r]:u&&[i,s])},e.clear=function(){return l=null,f[0][0]=f[0][1]=f[1][0]=f[1][1]=0,e},e.empty=function(){return o&&f[0][0]===f[1][0]||u&&f[0][1]===f[1][1]},d3.rebind(e,s,"on")};var eo={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},to=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];d3.behavior={},d3.behavior.drag=function(){function e(){this.on("mousedown.drag",t).on("touchstart.drag",t)}function t(){function e(){var e=o.parentNode;return f?d3.touches(e).filter(function(e){return e.identifier===f})[0]:d3.mouse(e)}function t(){if(!o.parentNode)return i();var t=e(),n=t[0]-c[0],r=t[1]-c[1];h|=n|r,c=t,M(),u({type:"drag",x:t[0]+l[0],y:t[1]+l[1],dx:n,dy:r})}function i(){u({type:"dragend"}),h&&(M(),d3.event.target===a&&p.on("click.drag",s,!0)),p.on(f?"touchmove.drag-"+f:"mousemove.drag",null).on(f?"touchend.drag-"+f:"mouseup.drag",null)}function s(){M(),p.on("click.drag",null)}var o=this,u=n.of(o,arguments),a=d3.event.target,f=d3.event.touches&&d3.event.changedTouches[0].identifier,l,c=e(),h=0,p=d3.select(window).on(f?"touchmove.drag-"+f:"mousemove.drag",t).on(f?"touchend.drag-"+f:"mouseup.drag",i,!0);r?(l=r.apply(o,arguments),l=[l.x-c[0],l.y-c[1]]):l=[0,0],f||M(),u({type:"dragstart"})}var n=D(e,"drag","dragstart","dragend"),r=null;return e.origin=function(t){return arguments.length?(r=t,e):r},d3.rebind(e,n,"on")},d3.behavior.zoom=function(){function e(){this.on("mousedown.zoom",o).on("mousewheel.zoom",u).on("mousemove.zoom",a).on("DOMMouseScroll.zoom",u).on("dblclick.zoom",f).on("touchstart.zoom",l).on("touchmove.zoom",c).on("touchend.zoom",l)}function t(e){return[(e[0]-h[0])/d,(e[1]-h[1])/d]}function n(e){return[e[0]*d+h[0],e[1]*d+h[1]]}function r(e){d=Math.max(m[0],Math.min(m[1],e))}function i(e,t){t=n(t),h[0]+=e[0]-t[0],h[1]+=e[1]-t[1]}function s(e){b&&b.domain(y.range().map(function(e){return(e-h[0])/d}).map(y.invert)),E&&E.domain(w.range().map(function(e){return(e-h[1])/d}).map(w.invert)),d3.event.preventDefault(),e({type:"zoom",scale:d,translate:h})}function o(){function e(){f=1,i(d3.mouse(o),c),s(u)}function n(){f&&M(),l.on("mousemove.zoom",null).on("mouseup.zoom",null),f&&d3.event.target===a&&l.on("click.zoom",r,!0)}function r(){M(),l.on("click.zoom",null)}var o=this,u=g.of(o,arguments),a=d3.event.target,f=0,l=d3.select(window).on("mousemove.zoom",e).on("mouseup.zoom",n),c=t(d3.mouse(o));window.focus(),M()}function u(){p||(p=t(d3.mouse(this))),r(Math.pow(2,Rn()*.002)*d),i(d3.mouse(this),p),s(g.of(this,arguments))}function a(){p=null}function f(){var e=d3.mouse(this),n=t(e);r(d3.event.shiftKey?d/2:d*2),i(e,n),s(g.of(this,arguments))}function l(){var e=d3.touches(this),n=Date.now();v=d,p={},e.forEach(function(e){p[e.identifier]=t(e)}),M();if(e.length===1){if(n-S<500){var o=e[0],u=t(e[0]);r(d*2),i(o,u),s(g.of(this,arguments))}S=n}}function c(){var e=d3.touches(this),t=e[0],n=p[t.identifier];if(o=e[1]){var o,u=p[o.identifier];t=[(t[0]+o[0])/2,(t[1]+o[1])/2],n=[(n[0]+u[0])/2,(n[1]+u[1])/2],r(d3.event.scale*v)}i(t,n),S=null,s(g.of(this,arguments))}var h=[0,0],p,d=1,v,m=ro,g=D(e,"zoom"),y,b,w,E,S;return e.translate=function(t){return arguments.length?(h=t.map(Number),e):h},e.scale=function(t){return arguments.length?(d=+t,e):d},e.scaleExtent=function(t){return arguments.length?(m=t==null?ro:t.map(Number),e):m},e.x=function(t){return arguments.length?(b=t,y=t.copy(),e):b},e.y=function(t){return arguments.length?(E=t,w=t.copy(),e):E},d3.rebind(e,g,"on")};var no,ro=[0,Infinity];d3.layout={},d3.layout.bundle=function(){return function(e){var t=[],n=-1,r=e.length;while(++n<r)t.push(Un(e[n]));return t}},d3.layout.chord=function(){function e(){var e={},n=[],c=d3.range(o),h=[],p,d,v,m,g;r=[],i=[],p=0,m=-1;while(++m<o){d=0,g=-1;while(++g<o)d+=s[m][g];n.push(d),h.push(d3.range(o)),p+=d}a&&c.sort(function(e,t){return a(n[e],n[t])}),f&&h.forEach(function(e,t){e.sort(function(e,n){return f(s[t][e],s[t][n])})}),p=(2*Math.PI-u*o)/p,d=0,m=-1;while(++m<o){v=d,g=-1;while(++g<o){var y=c[m],b=h[y][g],w=s[y][b],E=d,S=d+=w*p;e[y+"-"+b]={index:y,subindex:b,startAngle:E,endAngle:S,value:w}}i[y]={index:y,startAngle:v,endAngle:d,value:(d-v)/p},d+=u}m=-1;while(++m<o){g=m-1;while(++g<o){var x=e[m+"-"+g],T=e[g+"-"+m];(x.value||T.value)&&r.push(x.value<T.value?{source:T,target:x}:{source:x,target:T})}}l&&t()}function t(){r.sort(function(e,t){return l((e.source.value+e.target.value)/2,(t.source.value+t.target.value)/2)})}var n={},r,i,s,o,u=0,a,f,l;return n.matrix=function(e){return arguments.length?(o=(s=e)&&s.length,r=i=null,n):s},n.padding=function(e){return arguments.length?(u=e,r=i=null,n):u},n.sortGroups=function(e){return arguments.length?(a=e,r=i=null,n):a},n.sortSubgroups=function(e){return arguments.length?(f=e,r=null,n):f},n.sortChords=function(e){return arguments.length?(l=e,r&&t(),n):l},n.chords=function(){return r||e(),r},n.groups=function(){return i||e(),i},n},d3.layout.force=function(){function e(e){return function(t,n,r,i,s){if(t.point!==e){var o=t.cx-e.x,u=t.cy-e.y,a=1/Math.sqrt(o*o+u*u);if((i-n)*a<d){var f=t.charge*a*a;return e.px-=o*f,e.py-=u*f,!0}if(t.point&&isFinite(a)){var f=t.pointCharge*a*a;e.px-=o*f,e.py-=u*f}}return!t.charge}}function t(e){e.px=d3.event.x,e.py=d3.event.y,n.resume()}var n={},r=d3.dispatch("start","tick","end"),s=[1,1],o,a,f=.9,l=Qn,c=Gn,h=-30,p=.1,d=.8,v,m=[],g=[],y,b,w;return n.tick=function(){if((a*=.99)<.005)return r.end({type:"end",alpha:a=0}),!0;var t=m.length,n=g.length,i,o,u,l,c,d,v,E,S;for(o=0;o<n;++o){u=g[o],l=u.source,c=u.target,E=c.x-l.x,S=c.y-l.y;if(d=E*E+S*S)d=a*b[o]*((d=Math.sqrt(d))-y[o])/d,E*=d,S*=d,c.x-=E*(v=l.weight/(c.weight+l.weight)),c.y-=S*v,l.x+=E*(v=1-v),l.y+=S*v}if(v=a*p){E=s[0]/2,S=s[1]/2,o=-1;if(v)while(++o<t)u=m[o],u.x+=(E-u.x)*v,u.y+=(S-u.y)*v}if(h){Kn(i=d3.geom.quadtree(m),a,w),o=-1;while(++o<t)(u=m[o]).fixed||i.visit(e(u))}o=-1;while(++o<t)u=m[o],u.fixed?(u.x=u.px,u.y=u.py):(u.x-=(u.px-(u.px=u.x))*f,u.y-=(u.py-(u.py=u.y))*f);r.tick({type:"tick",alpha:a})},n.nodes=function(e){return arguments.length?(m=e,n):m},n.links=function(e){return arguments.length?(g=e,n):g},n.size=function(e){return arguments.length?(s=e,n):s},n.linkDistance=function(e){return arguments.length?(l=u(e),n):l},n.distance=n.linkDistance,n.linkStrength=function(e){return arguments.length?(c=u(e),n):c},n.friction=function(e){return arguments.length?(f=e,n):f},n.charge=function(e){return arguments.length?(h=typeof e=="function"?e:+e,n):h},n.gravity=function(e){return arguments.length?(p=e,n):p},n.theta=function(e){return arguments.length?(d=e,n):d},n.alpha=function(e){return arguments.length?(a?e>0?a=e:a=0:e>0&&(r.start({type:"start",alpha:a=e}),d3.timer(n.tick)),n):a},n.start=function(){function e(e,n){var i=t(r),s=-1,o=i.length,u;while(++s<o)if(!isNaN(u=i[s][e]))return u;return Math.random()*n}function t(){if(!p){p=[];for(i=0;i<o;++i)p[i]=[];for(i=0;i<u;++i){var e=g[i];p[e.source.index].push(e.target),p[e.target.index].push(e.source)}}return p[r]}var r,i,o=m.length,u=g.length,a=s[0],f=s[1],p,d;for(r=0;r<o;++r)(d=m[r]).index=r,d.weight=0;y=[],b=[];for(r=0;r<u;++r)d=g[r],typeof d.source=="number"&&(d.source=m[d.source]),typeof d.target=="number"&&(d.target=m[d.target]),y[r]=l.call(this,d,r),b[r]=c.call(this,d,r),++d.source.weight,++d.target.weight;for(r=0;r<o;++r)d=m[r],isNaN(d.x)&&(d.x=e("x",a)),isNaN(d.y)&&(d.y=e("y",f)),isNaN(d.px)&&(d.px=d.x),isNaN(d.py)&&(d.py=d.y);w=[];if(typeof h=="function")for(r=0;r<o;++r)w[r]=+h.call(this,m[r],r);else for(r=0;r<o;++r)w[r]=h;return n.resume()},n.resume=function(){return n.alpha(.1)},n.stop=function(){return n.alpha(0)},n.drag=function(){o||(o=d3.behavior.drag().origin(i).on("dragstart",Xn).on("drag",t).on("dragend",Vn)),this.on("mouseover.force",$n).on("mouseout.force",Jn).call(o)},d3.rebind(n,r,"on")},d3.layout.partition=function(){function e(t,n,r,i){var s=t.children;t.x=n,t.y=t.depth*i,t.dx=r,t.dy=i;if(s&&(u=s.length)){var o=-1,u,a,f;r=t.value?r/t.value:0;while(++o<u)e(a=s[o],n,f=a.value*r,i),n+=f}}function t(e){var n=e.children,r=0;if(n&&(s=n.length)){var i=-1,s;while(++i<s)r=Math.max(r,t(n[i]))}return 1+r}function n(n,s){var o=r.call(this,n,s);return e(o[0],0,i[0],i[1]/t(o[0])),o}var r=d3.layout.hierarchy(),i=[1,1];return n.size=function(e){return arguments.length?(i=e,n):i},fr(n,r)},d3.layout.pie=function(){function e(s,o){var u=s.map(function(n,r){return+t.call(e,n,r)}),a=+(typeof r=="function"?r.apply(this,arguments):r),f=((typeof i=="function"?i.apply(this,arguments):i)-r)/d3.sum(u),l=d3.range(s.length);n!=null&&l.sort(n===io?function(e,t){return u[t]-u[e]}:function(e,t){return n(s[e],s[t])});var c=[];return l.forEach(function(e){var t;c[e]={data:s[e],value:t=u[e],startAngle:a,endAngle:a+=t*f}}),c}var t=Number,n=io,r=0,i=2*Math.PI;return e.value=function(n){return arguments.length?(t=n,e):t},e.sort=function(t){return arguments.length?(n=t,e):n},e.startAngle=function(t){return arguments.length?(r=t,e):r},e.endAngle=function(t){return arguments.length?(i=t,e):i},e};var io={};d3.layout.stack=function(){function e(i,a){var f=i.map(function(n,r){return t.call(e,n,r)}),l=f.map(function(t,n){return t.map(function(t,n){return[o.call(e,t,n),u.call(e,t,n)]})}),c=n.call(e,l,a);f=d3.permute(f,c),l=d3.permute(l,c);var h=r.call(e,l,a),p=f.length,d=f[0].length,v,m,g;for(m=0;m<d;++m){s.call(e,f[0][m],g=h[m],l[0][m][1]);for(v=1;v<p;++v)s.call(e,f[v][m],g+=l[v-1][m][1],l[v][m][1])}return i}var t=i,n=tr,r=nr,s=er,o=Yn,u=Zn;return e.values=function(n){return arguments.length?(t=n,e):t},e.order=function(t){return arguments.length?(n=typeof t=="function"?t:so.get(t)||tr,e):n},e.offset=function(t){return arguments.length?(r=typeof t=="function"?t:oo.get(t)||nr,e):r},e.x=function(t){return arguments.length?(o=t,e):o},e.y=function(t){return arguments.length?(u=t,e):u},e.out=function(t){return arguments.length?(s=t,e):s},e};var so=d3.map({"inside-out":function(e){var t=e.length,n,r,i=e.map(rr),s=e.map(ir),o=d3.range(t).sort(function(e,t){return i[e]-i[t]}),u=0,a=0,f=[],l=[];for(n=0;n<t;++n)r=o[n],u<a?(u+=s[r],f.push(r)):(a+=s[r],l.push(r));return l.reverse().concat(f)},reverse:function(e){return d3.range(e.length).reverse()},"default":tr}),oo=d3.map({silhouette:function(e){var t=e.length,n=e[0].length,r=[],i=0,s,o,u,a=[];for(o=0;o<n;++o){for(s=0,u=0;s<t;s++)u+=e[s][o][1];u>i&&(i=u),r.push(u)}for(o=0;o<n;++o)a[o]=(i-r[o])/2;return a},wiggle:function(e){var t=e.length,n=e[0],r=n.length,i=0,s,o,u,a,f,l,c,h,p,d=[];d[0]=h=p=0;for(o=1;o<r;++o){for(s=0,a=0;s<t;++s)a+=e[s][o][1];for(s=0,f=0,c=n[o][0]-n[o-1][0];s<t;++s){for(u=0,l=(e[s][o][1]-e[s][o-1][1])/(2*c);u<s;++u)l+=(e[u][o][1]-e[u][o-1][1])/c;f+=l*e[s][o][1]}d[o]=h-=a?f/a*c:0,h<p&&(p=h)}for(o=0;o<r;++o)d[o]-=p;return d},expand:function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,u=[];for(s=0;s<n;++s){for(i=0,o=0;i<t;i++)o+=e[i][s][1];if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)u[s]=0;return u},zero:nr});d3.layout.histogram=function(){function e(e,s){var o=[],u=e.map(n,this),a=r.call(this,u,s),f=i.call(this,a,u,s),l,s=-1,c=u.length,h=f.length-1,p=t?1:1/c,d;while(++s<h)l=o[s]=[],l.dx=f[s+1]-(l.x=f[s]),l.y=0;if(h>0){s=-1;while(++s<c)d=u[s],d>=a[0]&&d<=a[1]&&(l=o[d3.bisect(f,d,1,h)-1],l.y+=p,l.push(e[s]))}return o}var t=!0,n=Number,r=ar,i=or;return e.value=function(t){return arguments.length?(n=t,e):n},e.range=function(t){return arguments.length?(r=u(t),e):r},e.bins=function(t){return arguments.length?(i=typeof t=="number"?function(e){return ur(e,t)}:u(t),e):i},e.frequency=function(n){return arguments.length?(t=!!n,e):t},e},d3.layout.hierarchy=function(){function e(t,o,u){var a=i.call(n,t,o),f=uo?t:{data:t};f.depth=o,u.push(f);if(a&&(c=a.length)){var l=-1,c,h=f.children=[],p=0,d=o+1,v;while(++l<c)v=e(a[l],d,u),v.parent=f,h.push(v),p+=v.value;r&&h.sort(r),s&&(f.value=p)}else s&&(f.value=+s.call(n,t,o)||0);return f}function t(e,r){var i=e.children,o=0;if(i&&(a=i.length)){var u=-1,a,f=r+1;while(++u<a)o+=t(i[u],f)}else s&&(o=+s.call(n,uo?e:e.data,r)||0);return s&&(e.value=o),o}function n(t){var n=[];return e(t,0,n),n}var r=hr,i=lr,s=cr;return n.sort=function(e){return arguments.length?(r=e,n):r},n.children=function(e){return arguments.length?(i=e,n):i},n.value=function(e){return arguments.length?(s=e,n):s},n.revalue=function(e){return t(e,0),e},n};var uo=!1;d3.layout.pack=function(){function e(e,i){var s=t.call(this,e,i),o=s[0];o.x=0,o.y=0,Pr(o,function(e){e.r=Math.sqrt(e.value)}),Pr(o,yr);var u=r[0],a=r[1],f=Math.max(2*o.r/u,2*o.r/a);if(n>0){var l=n*f/2;Pr(o,function(e){e.r+=l}),Pr(o,yr),Pr(o,function(e){e.r-=l}),f=Math.max(2*o.r/u,2*o.r/a)}return Er(o,u/2,a/2,1/f),s}var t=d3.layout.hierarchy().sort(dr),n=0,r=[1,1];return e.size=function(t){return arguments.length?(r=t,e):r},e.padding=function(t){return arguments.length?(n=+t,e):n},fr(e,t)},d3.layout.cluster=function(){function e(e,i){var s=t.call(this,e,i),o=s[0],u,a=0,f,l;Pr(o,function(e){var t=e.children;t&&t.length?(e.x=Tr(t),e.y=xr(t)):(e.x=u?a+=n(e,u):0,e.y=0,u=e)});var c=Nr(o),h=Cr(o),p=c.x-n(c,h)/2,d=h.x+n(h,c)/2;return Pr(o,function(e){e.x=(e.x-p)/(d-p)*r[0],e.y=(1-(o.y?e.y/o.y:1))*r[1]}),s}var t=d3.layout.hierarchy().sort(null).value(null),n=kr,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},fr(e,t)},d3.layout.tree=function(){function e(e,i){function s(e,t){var r=e.children,i=e._tree;if(r&&(o=r.length)){var o,a=r[0],f,l=a,c,h=-1;while(++h<o)c=r[h],s(c,f),l=u(c,f,l),f=c;Hr(e);var p=.5*(a._tree.prelim+c._tree.prelim);t?(i.prelim=t._tree.prelim+n(e,t),i.mod=i.prelim-p):i.prelim=p}else t&&(i.prelim=t._tree.prelim+n(e,t))}function o(e,t){e.x=e._tree.prelim+t;var n=e.children;if(n&&(i=n.length)){var r=-1,i;t+=e._tree.mod;while(++r<i)o(n[r],t)}}function u(e,t,r){if(t){var i=e,s=e,o=t,u=e.parent.children[0],a=i._tree.mod,f=s._tree.mod,l=o._tree.mod,c=u._tree.mod,h;while(o=Ar(o),i=Lr(i),o&&i)u=Lr(u),s=Ar(s),s._tree.ancestor=e,h=o._tree.prelim+l-i._tree.prelim-a+n(o,i),h>0&&(Br(jr(o,e,r),e,h),a+=h,f+=h),l+=o._tree.mod,a+=i._tree.mod,c+=u._tree.mod,f+=s._tree.mod;o&&!Ar(s)&&(s._tree.thread=o,s._tree.mod+=l-f),i&&!Lr(u)&&(u._tree.thread=i,u._tree.mod+=a-c,r=e)}return r}var a=t.call(this,e,i),f=a[0];Pr(f,function(e,t){e._tree={ancestor:e,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),s(f),o(f,-f._tree.prelim);var l=Or(f,_r),c=Or(f,Mr),h=Or(f,Dr),p=l.x-n(l,c)/2,d=c.x+n(c,l)/2,v=h.depth||1;return Pr(f,function(e){e.x=(e.x-p)/(d-p)*r[0],e.y=e.depth/v*r[1],delete e._tree}),a}var t=d3.layout.hierarchy().sort(null).value(null),n=kr,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},fr(e,t)},d3.layout.treemap=function(){function e(e,t){var n=-1,r=e.length,i,s;while(++n<r)s=(i=e[n]).value*(t<0?0:t),i.area=isNaN(s)||s<=0?0:s}function t(n){var s=n.children;if(s&&s.length){var o=l(n),u=[],a=s.slice(),f,c=Infinity,h,p=Math.min(o.dx,o.dy),d;e(a,o.dx*o.dy/n.value),u.area=0;while((d=a.length)>0)u.push(f=a[d-1]),u.area+=f.area,(h=r(u,p))<=c?(a.pop(),c=h):(u.area-=u.pop().area,i(u,p,o,!1),p=Math.min(o.dx,o.dy),u.length=u.area=0,c=Infinity);u.length&&(i(u,p,o,!0),u.length=u.area=0),s.forEach(t)}}function n(t){var r=t.children;if(r&&r.length){var s=l(t),o=r.slice(),u,a=[];e(o,s.dx*s.dy/t.value),a.area=0;while(u=o.pop())a.push(u),a.area+=u.area,u.z!=null&&(i(a,u.z?s.dx:s.dy,s,!o.length),a.length=a.area=0);r.forEach(n)}}function r(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++o<u){if(!(r=e[o].area))continue;r<s&&(s=r),r>i&&(i=r)}return n*=n,t*=t,n?Math.max(t*i*p/n,n/(t*s*p)):Infinity}function i(e,t,n,r){var i=-1,s=e.length,o=n.x,a=n.y,f=t?u(e.area/t):0,l;if(t==n.dx){if(r||f>n.dy)f=n.dy;while(++i<s)l=e[i],l.x=o,l.y=a,l.dy=f,o+=l.dx=Math.min(n.x+n.dx-o,f?u(l.area/f):0);l.z=!0,l.dx+=n.x+n.dx-o,n.y+=f,n.dy-=f}else{if(r||f>n.dx)f=n.dx;while(++i<s)l=e[i],l.x=o,l.y=a,l.dx=f,a+=l.dy=Math.min(n.y+n.dy-a,f?u(l.area/f):0);l.z=!1,l.dy+=n.y+n.dy-a,n.x+=f,n.dx-=f}}function s(r){var i=h||o(r),s=i[0];return s.x=0,s.y=0,s.dx=a[0],s.dy=a[1],h&&o.revalue(s),e([s],s.dx*s.dy/s.value),(h?n:t)(s),c&&(h=i),i}var o=d3.layout.hierarchy(),u=Math.round,a=[1,1],f=null,l=Fr,c=!1,h,p=.5*(1+Math.sqrt(5));return s.size=function(e){return arguments.length?(a=e,s):a},s.padding=function(e){function t(t){var n=e.call(s,t,t.depth);return n==null?Fr(t):Ir(t,typeof n=="number"?[n,n,n,n]:n)}function n(t){return Ir(t,e)}if(!arguments.length)return f;var r;return l=(f=e)==null?Fr:(r=typeof e)==="function"?t:r==="number"?(e=[e,e,e,e],n):n,s},s.round=function(e){return arguments.length?(u=e?Math.round:Number,s):u!=Number},s.sticky=function(e){return arguments.length?(c=e,h=null,s):c},s.ratio=function(e){return arguments.length?(p=e,s):p},fr(s,o)},d3.csv=qr(",","text/csv"),d3.tsv=qr(" ","text/tab-separated-values"),d3.geo={};var ao=Math.PI/180;d3.geo.azimuthal=function(){function e(e){var n=e[0]*ao-s,o=e[1]*ao,f=Math.cos(n),l=Math.sin(n),c=Math.cos(o),h=Math.sin(o),p=t!=="orthographic"?a*h+u*c*f:null,d,v=t==="stereographic"?1/(1+p):t==="gnomonic"?1/p:t==="equidistant"?(d=Math.acos(p),d?d/Math.sin(d):0):t==="equalarea"?Math.sqrt(2/(1+p)):1,m=v*c*l,g=v*(a*c*f-u*h);return[r*m+i[0],r*g+i[1]]}var t="orthographic",n,r=200,i=[480,250],s,o,u,a;return e.invert=function(e){var n=(e[0]-i[0])/r,o=(e[1]-i[1])/r,f=Math.sqrt(n*n+o*o),l=t==="stereographic"?2*Math.atan(f):t==="gnomonic"?Math.atan(f):t==="equidistant"?f:t==="equalarea"?2*Math.asin(.5*f):Math.asin(f),c=Math.sin(l),h=Math.cos(l);return[(s+Math.atan2(n*c,f*u*h+o*a*c))/ao,Math.asin(h*a-(f?o*c*u/f:0))/ao]},e.mode=function(n){return arguments.length?(t=n+"",e):t},e.origin=function(t){return arguments.length?(n=t,s=n[0]*ao,o=n[1]*ao,u=Math.cos(o),a=Math.sin(o),e):n},e.scale=function(t){return arguments.length?(r=+t,e):r},e.translate=function(t){return arguments.length?(i=[+t[0],+t[1]],e):i},e.origin([0,0])},d3.geo.albers=function(){function e(e){var t=u*(ao*e[0]-o),n=Math.sqrt(a-2*u*Math.sin(ao*e[1]))/u;return[i*n*Math.sin(t)+s[0],i*(n*Math.cos(t)-f)+s[1]]}function t(){var t=ao*r[0],i=ao*r[1],s=ao*n[1],l=Math.sin(t),c=Math.cos(t);return o=ao*n[0],u=.5*(l+Math.sin(i)),a=c*c+2*u*l,f=Math.sqrt(a-2*u*Math.sin(s))/u,e}var n=[-98,38],r=[29.5,45.5],i=1e3,s=[480,250],o,u,a,f;return e.invert=function(e){var t=(e[0]-s[0])/i,n=(e[1]-s[1])/i,r=f+n,l=Math.atan2(t,r),c=Math.sqrt(t*t+r*r);return[(o+l/u)/ao,Math.asin((a-c*c*u*u)/(2*u))/ao]},e.origin=function(e){return arguments.length?(n=[+e[0],+e[1]],t()):n},e.parallels=function(e){return arguments.length?(r=[+e[0],+e[1]],t()):r},e.scale=function(t){return arguments.length?(i=+t,e):i},e.translate=function(t){return arguments.length?(s=[+t[0],+t[1]],e):s},t()},d3.geo.albersUsa=function(){function e(e){var s=e[0],o=e[1];return(o>50?n:s<-140?r:o<21?i:t)(e)}var t=d3.geo.albers(),n=d3.geo.albers().origin([-160,60]).parallels([55,65]),r=d3.geo.albers().origin([-160,20]).parallels([8,18]),i=d3.geo.albers().origin([-60,10]).parallels([8,18]);return e.scale=function(s){return arguments.length?(t.scale(s),n.scale(s*.6),r.scale(s),i.scale(s*1.5),e.translate(t.translate())):t.scale()},e.translate=function(s){if(!arguments.length)return t.translate();var o=t.scale()/1e3,u=s[0],a=s[1];return t.translate(s),n.translate([u-400*o,a+170*o]),r.translate([u-190*o,a+200*o]),i.translate([u+580*o,a+430*o]),e},e.scale(t.scale())},d3.geo.bonne=function(){function e(e){var u=e[0]*ao-r,a=e[1]*ao-i;if(s){var f=o+s-a,l=u*Math.cos(a)/f;u=f*Math.sin(l),a=f*Math.cos(l)-o}else u*=Math.cos(a),a*=-1;return[t*u+n[0],t*a+n[1]]}var t=200,n=[480,250],r,i,s,o;return e.invert=function(e){var i=(e[0]-n[0])/t,u=(e[1]-n[1])/t;if(s){var a=o+u,f=Math.sqrt(i*i+a*a);u=o+s-f,i=r+f*Math.atan2(i,a)/Math.cos(u)}else u*=-1,i/=Math.cos(u);return[i/ao,u/ao]},e.parallel=function(t){return arguments.length?(o=1/Math.tan
+(s=t*ao),e):s/ao},e.origin=function(t){return arguments.length?(r=t[0]*ao,i=t[1]*ao,e):[r/ao,i/ao]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e.origin([0,0]).parallel(45)},d3.geo.equirectangular=function(){function e(e){var r=e[0]/360,i=-e[1]/360;return[t*r+n[0],t*i+n[1]]}var t=500,n=[480,250];return e.invert=function(e){var r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return[360*r,-360*i]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e},d3.geo.mercator=function(){function e(e){var r=e[0]/360,i=-(Math.log(Math.tan(Math.PI/4+e[1]*ao/2))/ao)/360;return[t*r+n[0],t*Math.max(-0.5,Math.min(.5,i))+n[1]]}var t=500,n=[480,250];return e.invert=function(e){var r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return[360*r,2*Math.atan(Math.exp(-360*i*ao))/ao-90]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e},d3.geo.path=function(){function e(e,t){typeof s=="function"&&(o=Ur(s.apply(this,arguments))),f(e);var n=a.length?a.join(""):null;return a=[],n}function t(e){return u(e).join(",")}function n(e){var t=i(e[0]),n=0,r=e.length;while(++n<r)t-=i(e[n]);return t}function r(e){var t=d3.geom.polygon(e[0].map(u)),n=t.area(),r=t.centroid(n<0?(n*=-1,1):-1),i=r[0],s=r[1],o=n,a=0,f=e.length;while(++a<f)t=d3.geom.polygon(e[a].map(u)),n=t.area(),r=t.centroid(n<0?(n*=-1,1):-1),i-=r[0],s-=r[1],o-=n;return[i,s,6*o]}function i(e){return Math.abs(d3.geom.polygon(e.map(u)).area())}var s=4.5,o=Ur(s),u=d3.geo.albersUsa(),a=[],f=Rr({FeatureCollection:function(e){var t=e.features,n=-1,r=t.length;while(++n<r)a.push(f(t[n].geometry))},Feature:function(e){f(e.geometry)},Point:function(e){a.push("M",t(e.coordinates),o)},MultiPoint:function(e){var n=e.coordinates,r=-1,i=n.length;while(++r<i)a.push("M",t(n[r]),o)},LineString:function(e){var n=e.coordinates,r=-1,i=n.length;a.push("M");while(++r<i)a.push(t(n[r]),"L");a.pop()},MultiLineString:function(e){var n=e.coordinates,r=-1,i=n.length,s,o,u;while(++r<i){s=n[r],o=-1,u=s.length,a.push("M");while(++o<u)a.push(t(s[o]),"L");a.pop()}},Polygon:function(e){var n=e.coordinates,r=-1,i=n.length,s,o,u;while(++r<i){s=n[r],o=-1;if((u=s.length-1)>0){a.push("M");while(++o<u)a.push(t(s[o]),"L");a[a.length-1]="Z"}}},MultiPolygon:function(e){var n=e.coordinates,r=-1,i=n.length,s,o,u,f,l,c;while(++r<i){s=n[r],o=-1,u=s.length;while(++o<u){f=s[o],l=-1;if((c=f.length-1)>0){a.push("M");while(++l<c)a.push(t(f[l]),"L");a[a.length-1]="Z"}}}},GeometryCollection:function(e){var t=e.geometries,n=-1,r=t.length;while(++n<r)a.push(f(t[n]))}}),l=e.area=Rr({FeatureCollection:function(e){var t=0,n=e.features,r=-1,i=n.length;while(++r<i)t+=l(n[r]);return t},Feature:function(e){return l(e.geometry)},Polygon:function(e){return n(e.coordinates)},MultiPolygon:function(e){var t=0,r=e.coordinates,i=-1,s=r.length;while(++i<s)t+=n(r[i]);return t},GeometryCollection:function(e){var t=0,n=e.geometries,r=-1,i=n.length;while(++r<i)t+=l(n[r]);return t}},0),c=e.centroid=Rr({Feature:function(e){return c(e.geometry)},Polygon:function(e){var t=r(e.coordinates);return[t[0]/t[2],t[1]/t[2]]},MultiPolygon:function(e){var t=0,n=e.coordinates,i,s=0,o=0,u=0,a=-1,f=n.length;while(++a<f)i=r(n[a]),s+=i[0],o+=i[1],u+=i[2];return[s/u,o/u]}});return e.projection=function(t){return u=t,e},e.pointRadius=function(t){return typeof t=="function"?s=t:(s=+t,o=Ur(s)),e},e},d3.geo.bounds=function(e){var t=Infinity,n=Infinity,r=-Infinity,i=-Infinity;return zr(e,function(e,s){e<t&&(t=e),e>r&&(r=e),s<n&&(n=s),s>i&&(i=s)}),[[t,n],[r,i]]};var fo={Feature:Wr,FeatureCollection:Xr,GeometryCollection:Vr,LineString:$r,MultiLineString:Jr,MultiPoint:$r,MultiPolygon:Kr,Point:Qr,Polygon:Gr};d3.geo.circle=function(){function e(){}function t(e){return a.distance(e)<u}function n(e){var t=-1,n=e.length,i=[],s,o,f,l,c;while(++t<n)c=a.distance(f=e[t]),c<u?(o&&i.push(ti(o,f)((l-u)/(l-c))),i.push(f),s=o=null):(o=f,!s&&i.length&&(i.push(ti(i[i.length-1],o)((u-l)/(c-l))),s=o)),l=c;return s=e[0],o=i[0],o&&f[0]===s[0]&&f[1]===s[1]&&(f[0]!==o[0]||f[1]!==o[1])&&i.push(o),r(i)}function r(e){var t=0,n=e.length,r,i,s=n?[e[0]]:e,o,u=a.source();while(++t<n){o=a.source(e[t-1])(e[t]).coordinates;for(r=0,i=o.length;++r<i;)s.push(o[r])}return a.source(u),s}var s=[0,0],o=89.99,u=o*ao,a=d3.geo.greatArc().source(s).target(i);e.clip=function(e){return typeof s=="function"&&a.source(s.apply(this,arguments)),f(e)||null};var f=Rr({FeatureCollection:function(e){var t=e.features.map(f).filter(i);return t&&(e=Object.create(e),e.features=t,e)},Feature:function(e){var t=f(e.geometry);return t&&(e=Object.create(e),e.geometry=t,e)},Point:function(e){return t(e.coordinates)&&e},MultiPoint:function(e){var n=e.coordinates.filter(t);return n.length&&{type:e.type,coordinates:n}},LineString:function(e){var t=n(e.coordinates);return t.length&&(e=Object.create(e),e.coordinates=t,e)},MultiLineString:function(e){var t=e.coordinates.map(n).filter(function(e){return e.length});return t.length&&(e=Object.create(e),e.coordinates=t,e)},Polygon:function(e){var t=e.coordinates.map(n);return t[0].length&&(e=Object.create(e),e.coordinates=t,e)},MultiPolygon:function(e){var t=e.coordinates.map(function(e){return e.map(n)}).filter(function(e){return e[0].length});return t.length&&(e=Object.create(e),e.coordinates=t,e)},GeometryCollection:function(e){var t=e.geometries.map(f).filter(i);return t.length&&(e=Object.create(e),e.geometries=t,e)}});return e.origin=function(t){return arguments.length?(s=t,typeof s!="function"&&a.source(s),e):s},e.angle=function(t){return arguments.length?(u=(o=+t)*ao,e):o},d3.rebind(e,a,"precision")},d3.geo.greatArc=function(){function e(){var t=e.distance.apply(this,arguments),r=0,u=s/t,a=[n];while((r+=u)<1)a.push(o(r));return a.push(i),{type:"LineString",coordinates:a}}var t=Yr,n,r=Zr,i,s=6*ao,o=ei();return e.distance=function(){return typeof t=="function"&&o.source(n=t.apply(this,arguments)),typeof r=="function"&&o.target(i=r.apply(this,arguments)),o.distance()},e.source=function(r){return arguments.length?(t=r,typeof t!="function"&&o.source(n=t),e):t},e.target=function(t){return arguments.length?(r=t,typeof r!="function"&&o.target(i=r),e):r},e.precision=function(t){return arguments.length?(s=t*ao,e):s/ao},e},d3.geo.greatCircle=d3.geo.circle,d3.geom={},d3.geom.contour=function(e,t){var n=t||ni(e),r=[],i=n[0],s=n[1],o=0,u=0,a=NaN,f=NaN,l=0;do l=0,e(i-1,s-1)&&(l+=1),e(i,s-1)&&(l+=2),e(i-1,s)&&(l+=4),e(i,s)&&(l+=8),l===6?(o=f===-1?-1:1,u=0):l===9?(o=0,u=a===1?-1:1):(o=lo[l],u=co[l]),o!=a&&u!=f&&(r.push([i,s]),a=o,f=u),i+=o,s+=u;while(n[0]!=i||n[1]!=s);return r};var lo=[1,0,1,1,-1,0,-1,1,0,0,0,0,-1,0,-1,NaN],co=[0,-1,0,0,0,-1,0,0,1,-1,1,1,0,-1,0,NaN];d3.geom.hull=function(e){if(e.length<3)return[];var t=e.length,n=t-1,r=[],i=[],s,o,u=0,a,f,l,c,h,p,d,v;for(s=1;s<t;++s)e[s][1]<e[u][1]?u=s:e[s][1]==e[u][1]&&(u=e[s][0]<e[u][0]?s:u);for(s=0;s<t;++s){if(s===u)continue;f=e[s][1]-e[u][1],a=e[s][0]-e[u][0],r.push({angle:Math.atan2(f,a),index:s})}r.sort(function(e,t){return e.angle-t.angle}),d=r[0].angle,p=r[0].index,h=0;for(s=1;s<n;++s)o=r[s].index,d==r[s].angle?(a=e[p][0]-e[u][0],f=e[p][1]-e[u][1],l=e[o][0]-e[u][0],c=e[o][1]-e[u][1],a*a+f*f>=l*l+c*c?r[s].index=-1:(r[h].index=-1,d=r[s].angle,h=s,p=o)):(d=r[s].angle,h=s,p=o);i.push(u);for(s=0,o=0;s<2;++o)r[o].index!==-1&&(i.push(r[o].index),s++);v=i.length;for(;o<n;++o){if(r[o].index===-1)continue;while(!ri(i[v-2],i[v-1],r[o].index,e))--v;i[v++]=r[o].index}var m=[];for(s=0;s<v;++s)m.push(e[i[s]]);return m},d3.geom.polygon=function(e){return e.area=function(){var t=0,n=e.length,r=e[n-1][0]*e[0][1],i=e[n-1][1]*e[0][0];while(++t<n)r+=e[t-1][0]*e[t][1],i+=e[t-1][1]*e[t][0];return(i-r)*.5},e.centroid=function(t){var n=-1,r=e.length,i=0,s=0,o,u=e[r-1],a;arguments.length||(t=-1/(6*e.area()));while(++n<r)o=u,u=e[n],a=o[0]*u[1]-u[0]*o[1],i+=(o[0]+u[0])*a,s+=(o[1]+u[1])*a;return[i*t,s*t]},e.clip=function(t){var n,r=-1,i=e.length,s,o,u=e[i-1],a,f,l;while(++r<i){n=t.slice(),t.length=0,a=e[r],f=n[(o=n.length)-1],s=-1;while(++s<o)l=n[s],ii(l,u,a)?(ii(f,u,a)||t.push(si(f,l,u,a)),t.push(l)):ii(f,u,a)&&t.push(si(f,l,u,a)),f=l;u=a}return t},e},d3.geom.voronoi=function(e){var t=e.map(function(){return[]});return oi(e,function(e){var n,r,i,s,o,u;e.a===1&&e.b>=0?(n=e.ep.r,r=e.ep.l):(n=e.ep.l,r=e.ep.r),e.a===1?(o=n?n.y:-1e6,i=e.c-e.b*o,u=r?r.y:1e6,s=e.c-e.b*u):(i=n?n.x:-1e6,o=e.c-e.a*i,s=r?r.x:1e6,u=e.c-e.a*s);var a=[i,o],f=[s,u];t[e.region.l.index].push(a,f),t[e.region.r.index].push(a,f)}),t.map(function(t,n){var r=e[n][0],i=e[n][1];return t.forEach(function(e){e.angle=Math.atan2(e[0]-r,e[1]-i)}),t.sort(function(e,t){return e.angle-t.angle}).filter(function(e,n){return!n||e.angle-t[n-1].angle>1e-10})})};var ho={l:"r",r:"l"};d3.geom.delaunay=function(e){var t=e.map(function(){return[]}),n=[];return oi(e,function(n){t[n.region.l.index].push(e[n.region.r.index])}),t.forEach(function(t,r){var i=e[r],s=i[0],o=i[1];t.forEach(function(e){e.angle=Math.atan2(e[0]-s,e[1]-o)}),t.sort(function(e,t){return e.angle-t.angle});for(var u=0,a=t.length-1;u<a;u++)n.push([i,t[u],t[u+1]])}),n},d3.geom.quadtree=function(e,t,n,r,i){function s(e,t,n,r,i,s){if(isNaN(t.x)||isNaN(t.y))return;if(e.leaf){var u=e.point;u?Math.abs(u.x-t.x)+Math.abs(u.y-t.y)<.01?o(e,t,n,r,i,s):(e.point=null,o(e,u,n,r,i,s),o(e,t,n,r,i,s)):e.point=t}else o(e,t,n,r,i,s)}function o(e,t,n,r,i,o){var u=(n+i)*.5,a=(r+o)*.5,f=t.x>=u,l=t.y>=a,c=(l<<1)+f;e.leaf=!1,e=e.nodes[c]||(e.nodes[c]=ui()),f?n=u:i=u,l?r=a:o=a,s(e,t,n,r,i,o)}var u,a=-1,f=e.length;f&&isNaN(e[0].x)&&(e=e.map(fi));if(arguments.length<5)if(arguments.length===3)i=r=n,n=t;else{t=n=Infinity,r=i=-Infinity;while(++a<f)u=e[a],u.x<t&&(t=u.x),u.y<n&&(n=u.y),u.x>r&&(r=u.x),u.y>i&&(i=u.y);var l=r-t,c=i-n;l>c?i=n+l:r=t+c}var h=ui();return h.add=function(e){s(h,e,t,n,r,i)},h.visit=function(e){ai(e,h,t,n,r,i)},e.forEach(h.add),h},d3.time={};var po=Date,vo=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];li.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){mo.setUTCDate.apply(this._,arguments)},setDay:function(){mo.setUTCDay.apply(this._,arguments)},setFullYear:function(){mo.setUTCFullYear.apply(this._,arguments)},setHours:function(){mo.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){mo.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){mo.setUTCMinutes.apply(this._,arguments)},setMonth:function(){mo.setUTCMonth.apply(this._,arguments)},setSeconds:function(){mo.setUTCSeconds.apply(this._,arguments)},setTime:function(){mo.setTime.apply(this._,arguments)}};var mo=Date.prototype,go="%a %b %e %H:%M:%S %Y",yo="%m/%d/%y",bo="%H:%M:%S",wo=vo,Eo=wo.map(ci),So=["January","February","March","April","May","June","July","August","September","October","November","December"],xo=So.map(ci);d3.time.format=function(e){function t(t){var r=[],i=-1,s=0,o,u;while(++i<n)e.charCodeAt(i)==37&&(r.push(e.substring(s,i),(u=Po[o=e.charAt(++i)])?u(t):o),s=i+1);return r.push(e.substring(s,i)),r.join("")}var n=e.length;return t.parse=function(t){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},r=hi(n,e,t,0);if(r!=t.length)return null;"p"in n&&(n.H=n.H%12+n.p*12);var i=new po;return i.setFullYear(n.y,n.m,n.d),i.setHours(n.H,n.M,n.S,n.L),i},t.toString=function(){return e},t};var To=d3.format("02d"),No=d3.format("03d"),Co=d3.format("04d"),ko=d3.format("2d"),Lo=pi(wo),Ao=pi(Eo),Oo=pi(So),Mo=di(So),_o=pi(xo),Do=di(xo),Po={a:function(e){return Eo[e.getDay()]},A:function(e){return wo[e.getDay()]},b:function(e){return xo[e.getMonth()]},B:function(e){return So[e.getMonth()]},c:d3.time.format(go),d:function(e){return To(e.getDate())},e:function(e){return ko(e.getDate())},H:function(e){return To(e.getHours())},I:function(e){return To(e.getHours()%12||12)},j:function(e){return No(1+d3.time.dayOfYear(e))},L:function(e){return No(e.getMilliseconds())},m:function(e){return To(e.getMonth()+1)},M:function(e){return To(e.getMinutes())},p:function(e){return e.getHours()>=12?"PM":"AM"},S:function(e){return To(e.getSeconds())},U:function(e){return To(d3.time.sundayOfYear(e))},w:function(e){return e.getDay()},W:function(e){return To(d3.time.mondayOfYear(e))},x:d3.time.format(yo),X:d3.time.format(bo),y:function(e){return To(e.getFullYear()%100)},Y:function(e){return Co(e.getFullYear()%1e4)},Z:_i,"%":function(e){return"%"}},Ho={a:vi,A:mi,b:gi,B:yi,c:bi,d:Ci,e:Ci,H:ki,I:ki,L:Oi,m:Ni,M:Li,p:Mi,S:Ai,x:wi,X:Ei,y:xi,Y:Si},Bo=/^\s*\d+/,jo=d3.map({am:0,pm:1});d3.time.format.utc=function(e){function t(e){try{po=li;var t=new po;return t._=e,n(t)}finally{po=Date}}var n=d3.time.format(e);return t.parse=function(e){try{po=li;var t=n.parse(e);return t&&t._}finally{po=Date}},t.toString=n.toString,t};var Fo=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?Di:Fo,Di.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Di.toString=Fo.toString,d3.time.second=Pi(function(e){return new po(Math.floor(e/1e3)*1e3)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*1e3)},function(e){return e.getSeconds()}),d3.time.seconds=d3.time.second.range,d3.time.seconds.utc=d3.time.second.utc.range,d3.time.minute=Pi(function(e){return new po(Math.floor(e/6e4)*6e4)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*6e4)},function(e){return e.getMinutes()}),d3.time.minutes=d3.time.minute.range,d3.time.minutes.utc=d3.time.minute.utc.range,d3.time.hour=Pi(function(e){var t=e.getTimezoneOffset()/60;return new po((Math.floor(e/36e5-t)+t)*36e5)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*36e5)},function(e){return e.getHours()}),d3.time.hours=d3.time.hour.range,d3.time.hours.utc=d3.time.hour.utc.range,d3.time.day=Pi(function(e){var t=new po(1970,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1}),d3.time.days=d3.time.day.range,d3.time.days.utc=d3.time.day.utc.range,d3.time.dayOfYear=function(e){var t=d3.time.year(e);return Math.floor((e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5)},vo.forEach(function(e,t){e=e.toLowerCase(),t=7-t;var n=d3.time[e]=Pi(function(e){return(e=d3.time.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e},function(e,t){e.setDate(e.getDate()+Math.floor(t)*7)},function(e){var n=d3.time.year(e).getDay();return Math.floor((d3.time.dayOfYear(e)+(n+t)%7)/7)-(n!==t)});d3.time[e+"s"]=n.range,d3.time[e+"s"].utc=n.utc.range,d3.time[e+"OfYear"]=function(e){var n=d3.time.year(e).getDay();return Math.floor((d3.time.dayOfYear(e)+(n+t)%7)/7)}}),d3.time.week=d3.time.sunday,d3.time.weeks=d3.time.sunday.range,d3.time.weeks.utc=d3.time.sunday.utc.range,d3.time.weekOfYear=d3.time.sundayOfYear,d3.time.month=Pi(function(e){return e=d3.time.day(e),e.setDate(1),e},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()}),d3.time.months=d3.time.month.range,d3.time.months.utc=d3.time.month.utc.range,d3.time.year=Pi(function(e){return e=d3.time.day(e),e.setMonth(0,1),e},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()}),d3.time.years=d3.time.year.range,d3.time.years.utc=d3.time.year.utc.range;var Io=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],qo=[[d3.time.second,1],[d3.time.second,5],[d3.time.second,15],[d3.time.second,30],[d3.time.minute,1],[d3.time.minute,5],[d3.time.minute,15],[d3.time.minute,30],[d3.time.hour,1],[d3.time.hour,3],[d3.time.hour,6],[d3.time.hour,12],[d3.time.day,1],[d3.time.day,2],[d3.time.week,1],[d3.time.month,1],[d3.time.month,3],[d3.time.year,1]],Ro=[[d3.time.format("%Y"),function(e){return!0}],[d3.time.format("%B"),function(e){return e.getMonth()}],[d3.time.format("%b %d"),function(e){return e.getDate()!=1}],[d3.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[d3.time.format("%I %p"),function(e){return e.getHours()}],[d3.time.format("%I:%M"),function(e){return e.getMinutes()}],[d3.time.format(":%S"),function(e){return e.getSeconds()}],[d3.time.format(".%L"),function(e){return e.getMilliseconds()}]],Uo=d3.scale.linear(),zo=Ii(Ro);qo.year=function(e,t){return Uo.domain(e.map(Ri)).ticks(t).map(qi)},d3.time.scale=function(){return Bi(d3.scale.linear(),qo,zo)};var Wo=qo.map(function(e){return[e[0].utc,e[1]]}),Xo=[[d3.time.format.utc("%Y"),function(e){return!0}],[d3.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[d3.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[d3.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[d3.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[d3.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[d3.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[d3.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]],Vo=Ii(Xo);Wo.year=function(e,t){return Uo.domain(e.map(zi)).ticks(t).map(Ui)},d3.time.scale.utc=function(){return Bi(d3.scale.linear(),Wo,Vo)}})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v3.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v3.min.js
new file mode 100644
index 00000000..7975878f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v3.min.js
@@ -0,0 +1 @@
+d3=function(){function o(e){return e!=null&&!isNaN(e)}function a(e){return e.length}function f(e){var t=1;while(e*t%1)t*=10;return t}function l(e,t){try{for(var n in t){Object.defineProperty(e.prototype,n,{value:t[n],enumerable:false})}}catch(r){e.prototype=t}}function c(){}function d(){}function v(e,t,n){return function(){var r=n.apply(t,arguments);return r===t?e:r}}function m(){}function g(e){function r(){var n=t,r=-1,i=n.length,s;while(++r<i)if(s=n[r].on)s.apply(this,arguments);return e}var t=[],n=new c;r.on=function(r,i){var s=n.get(r),o;if(arguments.length<2)return s&&s.on;if(s){s.on=null;t=t.slice(0,o=t.indexOf(s)).concat(t.slice(o+1));n.remove(r)}if(i)t.push(n.set(r,{on:i}));return e};return r}function y(){e.event.stopPropagation();e.event.preventDefault()}function w(){var t=e.event,n;while(n=t.sourceEvent)t=n;return t}function E(e,t){function n(){e.on(t,null)}e.on(t,function(){y();n()},true);setTimeout(n,0)}function S(t){var n=new m,r=0,i=arguments.length;while(++r<i)n[arguments[r]]=g(n);n.of=function(r,i){return function(s){try{var o=s.sourceEvent=e.event;s.target=t;e.event=s;n[s.type].apply(r,i)}finally{e.event=o}}};return n}function T(r,i){var s=r.ownerSVGElement||r;if(s.createSVGPoint){var o=s.createSVGPoint();if(x<0&&(n.scrollX||n.scrollY)){s=e.select(t.body).append("svg").style("position","absolute").style("top",0).style("left",0);var u=s[0][0].getScreenCTM();x=!(u.f||u.e);s.remove()}if(x){o.x=i.pageX;o.y=i.pageY}else{o.x=i.clientX;o.y=i.clientY}o=o.matrixTransform(r.getScreenCTM().inverse());return[o.x,o.y]}var a=r.getBoundingClientRect();return[i.clientX-a.left-r.clientLeft,i.clientY-a.top-r.clientTop]}function C(e){var t=-1,n=e.length,r=[];while(++t<n)r.push(e[t]);return r}function k(e){return Array.prototype.slice.call(e)}function O(e){A(e,B);return e}function j(e){return function(){return M(e,this)}}function F(e){return function(){return _(e,this)}}function q(t,n){function r(){this.removeAttribute(t)}function i(){this.removeAttributeNS(t.space,t.local)}function s(){this.setAttribute(t,n)}function o(){this.setAttributeNS(t.space,t.local,n)}function u(){var e=n.apply(this,arguments);if(e==null)this.removeAttribute(t);else this.setAttribute(t,e)}function a(){var e=n.apply(this,arguments);if(e==null)this.removeAttributeNS(t.space,t.local);else this.setAttributeNS(t.space,t.local,e)}t=e.ns.qualify(t);return n==null?t.local?i:r:typeof n==="function"?t.local?a:u:t.local?o:s}function R(e){return e.trim().replace(/\s+/g," ")}function z(t){return new RegExp("(?:^|\\s+)"+e.requote(t)+"(?:\\s+|$)","g")}function W(e,t){function r(){var r=-1;while(++r<n)e[r](this,t)}function i(){var r=-1,i=t.apply(this,arguments);while(++r<n)e[r](this,i)}e=e.trim().split(/\s+/).map(X);var n=e.length;return typeof t==="function"?i:r}function X(e){var t=z(e);return function(n,r){if(i=n.classList)return r?i.add(e):i.remove(e);var i=n.getAttribute("class")||"";if(r){t.lastIndex=0;if(!t.test(i))n.setAttribute("class",R(i+" "+e))}else{n.setAttribute("class",R(i.replace(t," ")))}}}function V(e,t,n){function r(){this.style.removeProperty(e)}function i(){this.style.setProperty(e,t,n)}function s(){var r=t.apply(this,arguments);if(r==null)this.style.removeProperty(e);else this.style.setProperty(e,r,n)}return t==null?r:typeof t==="function"?s:i}function $(e,t){function n(){delete this[e]}function r(){this[e]=t}function i(){var n=t.apply(this,arguments);if(n==null)delete this[e];else this[e]=n}return t==null?n:typeof t==="function"?i:r}function J(e){return{__data__:e}}function K(e){return function(){return H(this,e)}}function Q(t){if(!arguments.length)t=e.ascending;return function(e,n){return!e-!n||t(e.__data__,n.__data__)}}function G(){}function Y(t,n,r){function a(){var e=this[i];if(e){this.removeEventListener(t,e,e.$);delete this[i]}}function f(){var e=o(n,N(arguments));a.call(this);this.addEventListener(t,this[i]=e,e.$=r);e._=n}function l(){var n=new RegExp("^__on([^.]+)"+e.requote(t)+"$"),r;for(var i in this){if(r=i.match(n)){var s=this[i];this.removeEventListener(r[1],s,s.$);delete this[i]}}}var i="__on"+t,s=t.indexOf("."),o=et;if(s>0)t=t.substring(0,s);var u=Z.get(t);if(u)t=u,o=tt;return s?n?f:a:n?G:l}function et(t,n){return function(r){var i=e.event;e.event=r;n[0]=this.__data__;try{t.apply(this,n)}finally{e.event=i}}}function tt(e,t){var n=et(e,t);return function(e){var t=this,r=e.relatedTarget;if(!r||r!==t&&!(r.compareDocumentPosition(t)&8)){n.call(t,e)}}}function nt(e,t){for(var n=0,r=e.length;n<r;n++){for(var i=e[n],s=0,o=i.length,u;s<o;s++){if(u=i[s])t(u,s,n)}}return e}function rt(e){A(e,it);return e}function ft(){}function lt(e,t,n){return new ct(e,t,n)}function ct(e,t,n){this.h=e;this.s=t;this.l=n}function pt(e,t,n){function s(e){if(e>360)e-=360;else if(e<0)e+=360;if(e<60)return r+(i-r)*e/60;if(e<180)return i;if(e<240)return r+(i-r)*(240-e)/60;return r}function o(e){return Math.round(s(e)*255)}var r,i;e=e%360;if(e<0)e+=360;t=t<0?0:t>1?1:t;n=n<0?0:n>1?1:n;i=n<=.5?n*(1+t):n+t-n*t;r=2*n-i;return qt(o(e+120),o(e),o(e-120))}function yt(e){return e>0?1:e<0?-1:0}function bt(e){return Math.acos(Math.max(-1,Math.min(1,e)))}function wt(e){return e>1?dt/2:e<-1?-dt/2:Math.asin(e)}function Et(e){return(Math.exp(e)-Math.exp(-e))/2}function St(e){return(Math.exp(e)+Math.exp(-e))/2}function xt(e){return(e=Math.sin(e/2))*e}function Tt(e,t,n){return new Nt(e,t,n)}function Nt(e,t,n){this.h=e;this.c=t;this.l=n}function kt(e,t,n){return Lt(n,Math.cos(e*=mt)*t,Math.sin(e)*t)}function Lt(e,t,n){return new At(e,t,n)}function At(e,t,n){this.l=e;this.a=t;this.b=n}function Ht(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;i=jt(i)*Mt;r=jt(r)*_t;s=jt(s)*Dt;return qt(It(3.2404542*i-1.5371385*r-.4985314*s),It(-.969266*i+1.8760108*r+.041556*s),It(.0556434*i-.2040259*r+1.0572252*s))}function Bt(e,t,n){return Tt(Math.atan2(n,t)*gt,Math.sqrt(t*t+n*n),e)}function jt(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function Ft(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function It(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function qt(e,t,n){return new Rt(e,t,n)}function Rt(e,t,n){this.r=e;this.g=t;this.b=n}function zt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function Wt(e,t,n){var r=0,i=0,s=0,o,u,a;o=/([a-z]+)\((.*)\)/i.exec(e);if(o){u=o[2].split(",");switch(o[1]){case"hsl":{return n(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100)};case"rgb":{return t(Jt(u[0]),Jt(u[1]),Jt(u[2]))}}}if(a=Kt.get(e))return t(a.r,a.g,a.b);if(e!=null&&e.charAt(0)==="#"){if(e.length===4){r=e.charAt(1);r+=r;i=e.charAt(2);i+=i;s=e.charAt(3);s+=s}else if(e.length===7){r=e.substring(1,3);i=e.substring(3,5);s=e.substring(5,7)}r=parseInt(r,16);i=parseInt(i,16);s=parseInt(s,16)}return t(r,i,s)}function Xt(e,t,n){var r=Math.min(e/=255,t/=255,n/=255),i=Math.max(e,t,n),s=i-r,o,u,a=(i+r)/2;if(s){u=a<.5?s/(i+r):s/(2-i-r);if(e==i)o=(t-n)/s+(t<n?6:0);else if(t==i)o=(n-e)/s+2;else o=(e-t)/s+4;o*=60}else{u=o=0}return lt(o,u,a)}function Vt(e,t,n){e=$t(e);t=$t(t);n=$t(n);var r=Ft((.4124564*e+.3575761*t+.1804375*n)/Mt),i=Ft((.2126729*e+.7151522*t+.072175*n)/_t),s=Ft((.0193339*e+.119192*t+.9503041*n)/Dt);return Lt(116*i-16,500*(r-i),200*(i-s))}function $t(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Jt(e){var t=parseFloat(e);return e.charAt(e.length-1)==="%"?Math.round(t*2.55):t}function Qt(e){return typeof e==="function"?e:function(){return e}}function Gt(e){return e}function Yt(e){return e.length===1?function(t,n){e(t==null?n:null)}:e}function Zt(t,n){function s(t,r,i){if(arguments.length<3)i=r,r=null;var s=e.xhr(t,n,i);s.row=function(e){return arguments.length?s.response((r=e)==null?o:u(e)):r};return s.row(r)}function o(e){return s.parse(e.responseText)}function u(e){return function(t){return s.parse(t.responseText,e)}}function a(e){return e.map(f).join(t)}function f(e){return r.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var r=new RegExp('["'+t+"\n]"),i=t.charCodeAt(0);s.parse=function(e,t){var n;return s.parseRows(e,function(e,r){if(n)return n(e,r-1);var i=new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}");n=t?function(e,n){return t(i(e),n)}:i})};s.parseRows=function(e,t){function c(){if(u>=o)return r;if(l)return l=false,n;var t=u;if(e.charCodeAt(t)===34){var s=t;while(s++<o){if(e.charCodeAt(s)===34){if(e.charCodeAt(s+1)!==34)break;++s}}u=s+2;var a=e.charCodeAt(s+1);if(a===13){l=true;if(e.charCodeAt(s+2)===10)++u}else if(a===10){l=true}return e.substring(t+1,s).replace(/""/g,'"')}while(u<o){var a=e.charCodeAt(u++),f=1;if(a===10)l=true;else if(a===13){l=true;if(e.charCodeAt(u)===10)++u,++f}else if(a!==i)continue;return e.substring(t,u-f)}return e.substring(t)}var n={},r={},s=[],o=e.length,u=0,a=0,f,l;while((f=c())!==r){var h=[];while(f!==n&&f!==r){h.push(f);f=c()}if(t&&!(h=t(h,a++)))continue;s.push(h)}return s};s.format=function(e){if(Array.isArray(e[0]))return s.formatRows(e);var n=new d,r=[];e.forEach(function(e){for(var t in e){if(!n.has(t)){r.push(n.add(t))}}});return[r.map(f).join(t)].concat(e.map(function(e){return r.map(function(t){return f(e[t])}).join(t)})).join("\n")};s.formatRows=function(e){return e.map(a).join("\n")};return s}function on(){var e,t=Date.now(),n=nn;while(n){e=t-n.then;if(e>=n.delay)n.flush=n.callback(e);n=n.next}var r=un()-t;if(r>24){if(isFinite(r)){clearTimeout(sn);sn=setTimeout(on,r)}rn=0}else{rn=1;an(on)}}function un(){var e=null,t=nn,n=Infinity;while(t){if(t.flush){delete tn[t.callback.id];t=e?e.next=t.next:nn=t.next}else{n=Math.min(n,t.then+t.delay);t=(e=t).next}}return n}function pn(e,t){var n=Math.pow(10,Math.abs(8-t)*3);return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}function mn(e,t){return t-(e?Math.ceil(Math.log(e)/Math.LN10):1)}function gn(e){return e+""}function wn(e,t){if(e&&Sn.hasOwnProperty(e.type)){Sn[e.type](e,t)}}function xn(e,t,n){var r=-1,i=e.length-n,s;t.lineStart();while(++r<i)s=e[r],t.point(s[0],s[1]);t.lineEnd()}function Tn(e,t){var n=-1,r=e.length;t.polygonStart();while(++n<r)xn(e[n],t,1);t.polygonEnd()}function An(){function s(e,t){e*=mt;t=t*mt/2+dt/4;var s=e-n,o=Math.cos(t),u=Math.sin(t),a=i*u,f=Cn,l=kn,c=r*o+a*Math.cos(s),h=a*Math.sin(s);Cn=f*c-l*h;kn=l*c+f*h;n=e,r=o,i=u}var e,t,n,r,i;Ln.point=function(o,u){Ln.point=s;n=(e=o)*mt,r=Math.cos(u=(t=u)*mt/2+dt/4),i=Math.sin(u)};Ln.lineEnd=function(){s(e,t)}}function On(t){function u(e,t){if(e<n)n=e;if(e>i)i=e;if(t<r)r=t;if(t>s)s=t}function a(){o.point=o.lineEnd=G}var n,r,i,s;var o={point:u,lineStart:G,lineEnd:G,polygonStart:function(){o.lineEnd=a},polygonEnd:function(){o.point=u}};return function(u){s=i=-(n=r=Infinity);e.geo.stream(u,t(o));return[[n,r],[i,s]]}}function jn(e,t){if(Mn)return;++_n;e*=mt;var n=Math.cos(t*=mt);Dn+=(n*Math.cos(e)-Dn)/_n;Pn+=(n*Math.sin(e)-Pn)/_n;Hn+=(Math.sin(t)-Hn)/_n}function Fn(){var e,t;Mn=1;In();Mn=2;var n=Bn.point;Bn.point=function(r,i){n(e=r,t=i)};Bn.lineEnd=function(){Bn.point(e,t);qn();Bn.lineEnd=qn}}function In(){function r(r,i){r*=mt;var s=Math.cos(i*=mt),o=s*Math.cos(r),u=s*Math.sin(r),a=Math.sin(i),f=Math.atan2(Math.sqrt((f=t*a-n*u)*f+(f=n*o-e*a)*f+(f=e*u-t*o)*f),e*o+t*u+n*a);_n+=f;Dn+=f*(e+(e=o));Pn+=f*(t+(t=u));Hn+=f*(n+(n=a))}var e,t,n;if(Mn>1)return;if(Mn<1){Mn=1;_n=Dn=Pn=Hn=0}Bn.point=function(i,s){i*=mt;var o=Math.cos(s*=mt);e=o*Math.cos(i);t=o*Math.sin(i);n=Math.sin(s);Bn.point=r}}function qn(){Bn.point=jn}function Rn(e){var t=e[0],n=e[1],r=Math.cos(n);return[r*Math.cos(t),r*Math.sin(t),Math.sin(n)]}function Un(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function zn(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Wn(e,t){e[0]+=t[0];e[1]+=t[1];e[2]+=t[2]}function Xn(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Vn(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t;e[1]/=t;e[2]/=t}function $n(){return true}function Jn(e){return[Math.atan2(e[1],e[0]),Math.asin(Math.max(-1,Math.min(1,e[2])))]}function Kn(e,t){return Math.abs(e[0]-t[0])<vt&&Math.abs(e[1]-t[1])<vt}function Qn(e,t,n,r,i){var s=[],o=[];e.forEach(function(e){if((t=e.length-1)<=0)return;var t,n=e[0],r=e[t];if(Kn(n,r)){i.lineStart();for(var u=0;u<t;++u)i.point((n=e[u])[0],n[1]);i.lineEnd();return}var a={point:n,points:e,other:null,visited:false,entry:true,subject:true},f={point:n,points:[n],other:a,visited:false,entry:false,subject:false};a.other=f;s.push(a);o.push(f);a={point:r,points:[r],other:null,visited:false,entry:false,subject:true};f={point:r,points:[r],other:a,visited:false,entry:true,subject:false};a.other=f;s.push(a);o.push(f)});o.sort(t);Gn(s);Gn(o);if(!s.length)return;if(n)for(var u=1,a=!n(o[0].point),f=o.length;u<f;++u){o[u].entry=a=!a}var l=s[0],c,h,p;while(1){c=l;while(c.visited)if((c=c.next)===l)return;h=c.points;i.lineStart();do{c.visited=c.other.visited=true;if(c.entry){if(c.subject){for(var u=0;u<h.length;u++)i.point((p=h[u])[0],p[1])}else{r(c.point,c.next.point,1,i)}c=c.next}else{if(c.subject){h=c.prev.points;for(var u=h.length;--u>=0;)i.point((p=h[u])[0],p[1])}else{r(c.point,c.prev.point,-1,i)}c=c.prev}c=c.other;h=c.points}while(!c.visited);i.lineEnd()}}function Gn(e){if(!(t=e.length))return;var t,n=0,r=e[0],i;while(++n<t){r.next=i=e[n];i.prev=r;r=i}r.next=i=e[0];i.prev=r}function Yn(t,n,r){return function(i){function u(e,n){if(t(e,n))i.point(e,n)}function a(e,t){s.point(e,t)}function f(){o.point=a;s.lineStart()}function l(){o.point=u;s.lineEnd()}function y(e,t){m.point(e,t);g.push([e,t])}function b(){m.lineStart();g=[]}function w(){y(g[0][0],g[0][1]);m.lineEnd();var e=m.clean(),t=v.buffer(),n,r=t.length;if(!r){d=true;p+=tr(g,-1);g=null;return}g=null;if(e&1){n=t[0];h+=tr(n,1);var r=n.length-1,s=-1,o;i.lineStart();while(++s<r)i.point((o=n[s])[0],o[1]);i.lineEnd();return}if(r>1&&e&2)t.push(t.pop().concat(t.shift()));c.push(t.filter(Zn))}var s=n(i);var o={point:u,lineStart:f,lineEnd:l,polygonStart:function(){o.point=y;o.lineStart=b;o.lineEnd=w;d=false;p=h=0;c=[];i.polygonStart()},polygonEnd:function(){o.point=u;o.lineStart=f;o.lineEnd=l;c=e.merge(c);if(c.length){Qn(c,nr,null,r,i)}else if(h<-vt||d&&p<-vt){i.lineStart();r(null,null,1,i);i.lineEnd()}i.polygonEnd();c=null},sphere:function(){i.polygonStart();i.lineStart();r(null,null,1,i);i.lineEnd();i.polygonEnd()}};var c,h,p,d;var v=er(),m=n(v),g;return o}}function Zn(e){return e.length>1}function er(){var e=[],t;return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:G,buffer:function(){var n=e;e=[];t=null;return n},rejoin:function(){if(e.length>1)e.push(e.pop().concat(e.shift()))}}}function tr(e,t){if(!(n=e.length))return 0;var n,r=0,i=0,s=e[0],o=s[0],u=s[1],a=Math.cos(u),f=Math.atan2(t*Math.sin(o)*a,Math.sin(u)),l=1-t*Math.cos(o)*a,c=f,h,p;while(++r<n){s=e[r];a=Math.cos(u=s[1]);h=Math.atan2(t*Math.sin(o=s[0])*a,Math.sin(u));p=1-t*Math.cos(o)*a;if(Math.abs(l-2)<vt&&Math.abs(p-2)<vt)continue;if(Math.abs(p)<vt||Math.abs(l)<vt){}else if(Math.abs(Math.abs(h-f)-dt)<vt){if(p+l>2)i+=4*(h-f)}else if(Math.abs(l-2)<vt)i+=4*(h-c);else i+=((3*dt+h-f)%(2*dt)-dt)*(l+p);c=f,f=h,l=p}return i}function nr(e,t){return((e=e.point)[0]<0?e[1]-dt/2-vt:dt/2-e[1])-((t=t.point)[0]<0?t[1]-dt/2-vt:dt/2-t[1])}function ir(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart();i=1},point:function(s,o){var u=s>0?dt:-dt,a=Math.abs(s-t);if(Math.abs(a-dt)<vt){e.point(t,n=(n+o)/2>0?dt/2:-dt/2);e.point(r,n);e.lineEnd();e.lineStart();e.point(u,n);e.point(s,n);i=0}else if(r!==u&&a>=dt){if(Math.abs(t-r)<vt)t-=r*vt;if(Math.abs(s-u)<vt)s-=u*vt;n=sr(t,n,s,o);e.point(r,n);e.lineEnd();e.lineStart();e.point(u,n);i=0}e.point(t=s,n=o);r=u},lineEnd:function(){e.lineEnd();t=n=NaN},clean:function(){return 2-i}}}function sr(e,t,n,r){var i,s,o=Math.sin(e-n);return Math.abs(o)>vt?Math.atan((Math.sin(t)*(s=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(t))*Math.sin(e))/(i*s*o)):(t+r)/2}function or(e,t,n,r){var i;if(e==null){i=n*dt/2;r.point(-dt,i);r.point(0,i);r.point(dt,i);r.point(dt,0);r.point(dt,-i);r.point(0,-i);r.point(-dt,-i);r.point(-dt,0);r.point(-dt,i)}else if(Math.abs(e[0]-t[0])>vt){var s=(e[0]<t[0]?1:-1)*dt;i=n*s/2;r.point(-s,i);r.point(0,i);r.point(s,i)}else{r.point(t[0],t[1])}}function ur(e){function s(e,n){return Math.cos(e)*Math.cos(n)>t}function o(e){var t,i,o,f,l;return{lineStart:function(){f=o=false;l=1},point:function(c,h){var p=[c,h],d,v=s(c,h),m=n?v?0:a(c,h):v?a(c+(c<0?dt:-dt),h):0;if(!t&&(f=o=v))e.lineStart();if(v!==o){d=u(t,p);if(Kn(t,d)||Kn(p,d)){p[0]+=vt;p[1]+=vt;v=s(p[0],p[1])}}if(v!==o){l=0;if(v){e.lineStart();d=u(p,t);e.point(d[0],d[1])}else{d=u(t,p);e.point(d[0],d[1]);e.lineEnd()}t=d}else if(r&&t&&n^v){var g;if(!(m&i)&&(g=u(p,t,true))){l=0;if(n){e.lineStart();e.point(g[0][0],g[0][1]);e.point(g[1][0],g[1][1]);e.lineEnd()}else{e.point(g[1][0],g[1][1]);e.lineEnd();e.lineStart();e.point(g[0][0],g[0][1])}}}if(v&&(!t||!Kn(t,p))){e.point(p[0],p[1])}t=p,o=v,i=m},lineEnd:function(){if(o)e.lineEnd();t=null},clean:function(){return l|(f&&o)<<1}}}function u(e,n,r){var i=Rn(e),s=Rn(n);var o=[1,0,0],u=zn(i,s),a=Un(u,u),f=u[0],l=a-f*f;if(!l)return!r&&e;var c=t*a/l,h=-t*f/l,p=zn(o,u),d=Xn(o,c),v=Xn(u,h);Wn(d,v);var m=p,g=Un(d,m),y=Un(m,m),b=g*g-y*(Un(d,d)-1);if(b<0)return;var w=Math.sqrt(b),E=Xn(m,(-g-w)/y);Wn(E,d);E=Jn(E);if(!r)return E;var S=e[0],x=n[0],T=e[1],N=n[1],C;if(x<S)C=S,S=x,x=C;var k=x-S,L=Math.abs(k-dt)<vt,A=L||k<vt;if(!L&&N<T)C=T,T=N,N=C;if(A?L?T+N>0^E[1]<(Math.abs(E[0]-S)<vt?T:N):T<=E[1]&&E[1]<=N:k>dt^(S<=E[0]&&E[0]<=x)){var O=Xn(m,(-g+w)/y);Wn(O,d);return[E,Jn(O)]}}function a(t,r){var i=n?e:dt-e,s=0;if(t<-i)s|=1;else if(t>i)s|=2;if(r<-i)s|=4;else if(r>i)s|=8;return s}var t=Math.cos(e),n=t>0,r=Math.abs(t)>vt,i=Er(e,6*mt);return Yn(s,o,i)}function fr(t,n,r,i){function s(e,i){return Math.abs(e[0]-t)<vt?i>0?0:3:Math.abs(e[0]-r)<vt?i>0?2:1:Math.abs(e[1]-n)<vt?i>0?1:0:i>0?3:2}function o(e,t){return u(e.point,t.point)}function u(e,t){var n=s(e,1),r=s(t,1);return n!==r?n-r:n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]}function a(e,s){var o=s[0]-e[0],u=s[1]-e[1],a=[0,1];if(Math.abs(o)<vt&&Math.abs(u)<vt)return t<=e[0]&&e[0]<=r&&n<=e[1]&&e[1]<=i;if(lr(t-e[0],o,a)&&lr(e[0]-r,-o,a)&&lr(n-e[1],u,a)&&lr(e[1]-i,-u,a)){if(a[1]<1){s[0]=e[0]+a[1]*o;s[1]=e[1]+a[1]*u}if(a[0]>0){e[0]+=a[0]*o;e[1]+=a[0]*u}return true}return false}return function(f){function m(e){var o=s(e,-1),u=g([o===0||o===3?t:r,o>1?i:n]);return u}function g(e){var t=0,n=p.length,r=e[1];for(var i=0;i<n;++i){for(var s=1,o=p[i],u=o.length,a=o[0];s<u;++s){b=o[s];if(a[1]<=r){if(b[1]>r&&y(a,b,e)>0)++t}else{if(b[1]<=r&&y(a,b,e)<0)--t}a=b}}return t!==0}function y(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1])}function w(e,o,a,f){var l=0,c=0;if(e==null||(l=s(e,a))!==(c=s(o,a))||u(e,o)<0^a>0){do{f.point(l===0||l===3?t:r,l>1?i:n)}while((l=(l+a+4)%4)!==c)}else{f.point(o[0],o[1])}}function E(e,s){return t<=e&&e<=r&&n<=s&&s<=i}function S(e,t){if(E(e,t))f.point(e,t)}function O(){v.point=_;if(p)p.push(d=[]);A=true;L=false;C=k=NaN}function M(){if(h){_(x,T);if(N&&L)c.rejoin();h.push(c.buffer())}v.point=S;if(L)f.lineEnd()}function _(e,t){e=Math.max(-ar,Math.min(ar,e));t=Math.max(-ar,Math.min(ar,t));var n=E(e,t);if(p)d.push([e,t]);if(A){x=e,T=t,N=n;A=false;if(n){f.lineStart();f.point(e,t)}}else{if(n&&L)f.point(e,t);else{var r=[C,k],i=[e,t];if(a(r,i)){if(!L){f.lineStart();f.point(r[0],r[1])}f.point(i[0],i[1]);if(!n)f.lineEnd()}else{f.lineStart();f.point(e,t)}}}C=e,k=t,L=n}var l=f,c=er(),h,p,d;var v={point:S,lineStart:O,lineEnd:M,polygonStart:function(){f=c;h=[];p=[]},polygonEnd:function(){f=l;if((h=e.merge(h)).length){f.polygonStart();Qn(h,o,m,w,f);f.polygonEnd()}else if(g([t,n])){f.polygonStart(),f.lineStart();w(null,null,1,f);f.lineEnd(),f.polygonEnd()}h=p=d=null}};var x,T,N,C,k,L,A;return v}}function lr(e,t,n){if(Math.abs(t)<vt)return e<=0;var r=e/t;if(t>0){if(r>n[1])return false;if(r>n[0])n[0]=r}else{if(r<n[0])return false;if(r<n[1])n[1]=r}return true}function cr(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}if(e.invert&&t.invert)n.invert=function(n,r){return n=t.invert(n,r),n&&e.invert(n[0],n[1])};return n}function hr(e){function r(t){function c(n,r){n=e(n,r);t.point(n[0],n[1])}function h(){s=NaN;l.point=p;t.lineStart()}function p(l,c){var h=Rn([l,c]),p=e(l,c);i(s,o,r,u,a,f,s=p[0],o=p[1],r=l,u=h[0],a=h[1],f=h[2],n,t);t.point(s,o)}function d(){l.point=c;t.lineEnd()}function v(){var e,c,v,m,g,y,b;h();l.point=function(t,n){p(e=t,c=n),v=s,m=o,g=u,y=a,b=f;l.point=p};l.lineEnd=function(){i(s,o,r,u,a,f,v,m,e,g,y,b,n,t);l.lineEnd=d;d()}}var r,s,o,u,a,f;var l={point:c,lineStart:h,lineEnd:d,polygonStart:function(){t.polygonStart();l.lineStart=v},polygonEnd:function(){t.polygonEnd();l.lineStart=h}};return l}function i(n,r,s,o,u,a,f,l,c,h,p,d,v,m){var g=f-n,y=l-r,b=g*g+y*y;if(b>4*t&&v--){var w=o+h,E=u+p,S=a+d,x=Math.sqrt(w*w+E*E+S*S),T=Math.asin(S/=x),N=Math.abs(Math.abs(S)-1)<vt?(s+c)/2:Math.atan2(E,w),C=e(N,T),k=C[0],L=C[1],A=k-n,O=L-r,M=y*A-g*O;if(M*M/b>t||Math.abs((g*A+y*O)/b-.5)>.3){i(n,r,s,o,u,a,k,L,N,w/=x,E/=x,S,v,m);m.point(k,L);i(k,L,N,w,E,S,f,l,c,h,p,d,v,m)}}}var t=.5,n=16;r.precision=function(e){if(!arguments.length)return Math.sqrt(t);n=(t=e*e)>0&&16;return r};return r}function pr(e){return dr(function(){return e})()}function dr(t){function w(e){e=i(e[0]*mt,e[1]*mt);return[e[0]*o+d,v-e[1]*o]}function E(e){e=i.invert((e[0]-d)/o,(v-e[1])/o);return e&&[e[0]*gt,e[1]*gt]}function S(){i=cr(r=gr(c,h,p),n);var e=n(f,l);d=u-e[0]*o;v=a+e[1]*o;return w}var n,r,i,s=hr(function(e,t){e=n(e,t);return[e[0]*o+d,v-e[1]*o]}),o=150,u=480,a=250,f=0,l=0,c=0,h=0,p=0,d,v,m=rr,g=Gt,y=null,b=null;w.stream=function(e){return vr(r,m(s(g(e))))};w.clipAngle=function(e){if(!arguments.length)return y;m=e==null?(y=e,rr):ur((y=+e)*mt);return w};w.clipExtent=function(e){if(!arguments.length)return b;b=e;g=e==null?Gt:fr(e[0][0],e[0][1],e[1][0],e[1][1]);return w};w.scale=function(e){if(!arguments.length)return o;o=+e;return S()};w.translate=function(e){if(!arguments.length)return[u,a];u=+e[0];a=+e[1];return S()};w.center=function(e){if(!arguments.length)return[f*gt,l*gt];f=e[0]%360*mt;l=e[1]%360*mt;return S()};w.rotate=function(e){if(!arguments.length)return[c*gt,h*gt,p*gt];c=e[0]%360*mt;h=e[1]%360*mt;p=e.length>2?e[2]%360*mt:0;return S()};e.rebind(w,s,"precision");return function(){n=t.apply(this,arguments);w.invert=n.invert&&E;return S()}}function vr(e,t){return{point:function(n,r){r=e(n*mt,r*mt),n=r[0];t.point(n>dt?n-2*dt:n<-dt?n+2*dt:n,r[1])},sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function mr(e,t){return[e,t]}function gr(e,t,n){return e?t||n?cr(br(e),wr(t,n)):br(e):t||n?wr(t,n):mr}function yr(e){return function(t,n){return t+=e,[t>dt?t-2*dt:t<-dt?t+2*dt:t,n]}}function br(e){var t=yr(e);t.invert=yr(-e);return t}function wr(e,t){function o(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*n+u*r;return[Math.atan2(a*i-l*s,u*n-f*r),Math.asin(Math.max(-1,Math.min(1,l*i+a*s)))]}var n=Math.cos(e),r=Math.sin(e),i=Math.cos(t),s=Math.sin(t);o.invert=function(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*i-a*s;return[Math.atan2(a*i+f*s,u*n+l*r),Math.asin(Math.max(-1,Math.min(1,l*n-u*r)))]};return o}function Er(e,t){var n=Math.cos(e),r=Math.sin(e);return function(i,s,o,u){if(i!=null){i=Sr(n,i);s=Sr(n,s);if(o>0?i<s:i>s)i+=o*2*dt}else{i=e+o*2*dt;s=e}var a;for(var f=o*t,l=i;o>0?l>s:l<s;l-=f){u.point((a=Jn([n,-r*Math.cos(l),-r*Math.sin(l)]))[0],a[1])}}}function Sr(e,t){var n=Rn(t);n[0]-=e;Vn(n);var r=bt(-n[1]);return((-n[2]<0?-r:r)+2*Math.PI-vt)%(2*Math.PI)}function xr(t,n,r){var i=e.range(t,n-vt,r).concat(n);return function(e){return i.map(function(t){return[e,t]})}}function Tr(t,n,r){var i=e.range(t,n-vt,r).concat(n);return function(e){return i.map(function(t){return[t,e]})}}function Nr(e){return e.source}function Cr(e){return e.target}function kr(e,t,n,r){var i=Math.cos(t),s=Math.sin(t),o=Math.cos(r),u=Math.sin(r),a=i*Math.cos(e),f=i*Math.sin(e),l=o*Math.cos(n),c=o*Math.sin(n),h=2*Math.asin(Math.sqrt(xt(r-t)+i*o*xt(n-e))),p=1/Math.sin(h);var d=h?function(e){var t=Math.sin(e*=h)*p,n=Math.sin(h-e)*p,r=n*a+t*l,i=n*f+t*c,o=n*s+t*u;return[Math.atan2(i,r)*gt,Math.atan2(o,Math.sqrt(r*r+i*i))*gt]}:function(){return[e*gt,t*gt]};d.distance=h;return d}function Or(){function r(r,i){var s=Math.sin(i*=mt),o=Math.cos(i),u=Math.abs((r*=mt)-e),a=Math.cos(u);Lr+=Math.atan2(Math.sqrt((u=o*Math.sin(u))*u+(u=n*s-t*o*a)*u),t*s+n*o*a);e=r,t=s,n=o}var e,t,n;Ar.point=function(i,s){e=i*mt,t=Math.sin(s*=mt),n=Math.cos(s);Ar.point=r};Ar.lineEnd=function(){Ar.point=Ar.lineEnd=G}}function Mr(e){var t=0,n=dt/3,r=dr(e),i=r(t,n);i.parallels=function(e){if(!arguments.length)return[t/dt*180,n/dt*180];return r(t=e[0]*dt/180,n=e[1]*dt/180)};return i}function _r(e,t){function o(e,t){var n=Math.sqrt(i-2*r*Math.sin(t))/r;return[n*Math.sin(e*=r),s-n*Math.cos(e)]}var n=Math.sin(e),r=(n+Math.sin(t))/2,i=1+n*(2*r-n),s=Math.sqrt(i)/r;o.invert=function(e,t){var n=s-t;return[Math.atan2(e,n)/r,Math.asin((i-(e*e+n*n)*r*r)/(2*r))]};return o}function Dr(e,t){var n=e(t[0]),r=e([.5*(t[0][0]+t[1][0]),t[0][1]]),i=e([t[1][0],t[0][1]]),s=e(t[1]);var o=r[1]-n[1],u=r[0]-n[0],a=i[1]-r[1],f=i[0]-r[0];var l=o/u,c=a/f;var h=.5*(l*c*(n[1]-i[1])+c*(n[0]+r[0])-l*(r[0]+i[0]))/(c-l),p=(.5*(n[0]+r[0])-h)/l+.5*(n[1]+r[1]);var d=s[0]-h,v=s[1]-p,m=n[0]-h,g=n[1]-p,y=d*d+v*v,b=m*m+g*g;var w=Math.atan2(v,d),E=Math.atan2(g,m);return function(t){var n=t[0]-h,r=t[1]-p,i=n*n+r*r,s=Math.atan2(r,n);if(y<i&&i<b&&w<s&&s<E)return e.invert(t)}}function jr(){function i(e,t){Hr+=r*e-n*t;n=e,r=t}var e,t,n,r;Br.point=function(s,o){Br.point=i;e=n=s,t=r=o};Br.lineEnd=function(){i(e,t)}}function Fr(){function r(n,r){t.push("M",n,",",r,e)}function i(e,r){t.push("M",e,",",r);n.point=s}function s(e,n){t.push("L",e,",",n)}function o(){n.point=r}function u(){t.push("Z")}var e=Xr(4.5),t=[];var n={point:r,lineStart:function(){n.point=i},lineEnd:o,polygonStart:function(){n.lineEnd=u},polygonEnd:function(){n.lineEnd=o;n.point=r},pointRadius:function(t){e=Xr(t);return n},result:function(){if(t.length){var e=t.join("");t=[];return e}}};return n}function qr(e,t){if(Mn)return;Dn+=e;Pn+=t;++Hn}function Rr(){function n(n,r){var i=n-e,s=r-t,o=Math.sqrt(i*i+s*s);Dn+=o*(e+n)/2;Pn+=o*(t+r)/2;Hn+=o;e=n,t=r}var e,t;if(Mn!==1){if(Mn<1){Mn=1;Dn=Pn=Hn=0}else return}Ir.point=function(r,i){Ir.point=n;e=r,t=i}}function Ur(){Ir.point=qr}function zr(){function i(e,t){var i=r*e-n*t;Dn+=i*(n+e);Pn+=i*(r+t);Hn+=i*3;n=e,r=t}var e,t,n,r;if(Mn<2){Mn=2;Dn=Pn=Hn=0}Ir.point=function(s,o){Ir.point=i;e=n=s,t=r=o};Ir.lineEnd=function(){i(e,t)}}function Wr(e){function r(n,r){e.moveTo(n,r);e.arc(n,r,t,0,2*dt)}function i(t,r){e.moveTo(t,r);n.point=s}function s(t,n){e.lineTo(t,n)}function o(){n.point=r}function u(){e.closePath()}var t=4.5;var n={point:r,lineStart:function(){n.point=i},lineEnd:o,polygonStart:function(){n.lineEnd=u},polygonEnd:function(){n.lineEnd=o;n.point=r},pointRadius:function(e){t=e;return n},result:G};return n}function Xr(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+ -2*e+"a"+e+","+e+" 0 1,1 0,"+ +2*e+"z"}function Vr(e){var t=hr(function(t,n){return e([t*gt,n*gt])});return function(e){e=t(e);return{point:function(t,n){e.point(t*mt,n*mt)},sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}}function $r(e,t){function n(t,n){var r=Math.cos(t),i=Math.cos(n),s=e(r*i);return[s*i*Math.sin(t),s*Math.sin(n)]}n.invert=function(e,n){var r=Math.sqrt(e*e+n*n),i=t(r),s=Math.sin(i),o=Math.cos(i);return[Math.atan2(e*s,r*o),Math.asin(r&&n*s/r)]};return n}function Qr(e,t){function o(e,t){var n=Math.abs(Math.abs(t)-dt/2)<vt?0:s/Math.pow(r(t),i);return[n*Math.sin(i*e),s-n*Math.cos(i*e)]}var n=Math.cos(e),r=function(e){return Math.tan(dt/4+e/2)},i=e===t?Math.sin(e):Math.log(n/Math.cos(t))/Math.log(r(t)/r(e)),s=n*Math.pow(r(e),i)/i;if(!i)return Zr;o.invert=function(e,t){var n=s-t,r=yt(i)*Math.sqrt(e*e+n*n);return[Math.atan2(e,n)/i,2*Math.atan(Math.pow(s/r,1/i))-dt/2]};return o}function Gr(e,t){function s(e,t){var n=i-t;return[n*Math.sin(r*e),i-n*Math.cos(r*e)]}var n=Math.cos(e),r=e===t?Math.sin(e):(n-Math.cos(t))/(t-e),i=n/r+e;if(Math.abs(r)<vt)return mr;s.invert=function(e,t){var n=i-t;return[Math.atan2(e,n)/r,i-yt(r)*Math.sqrt(e*e+n*n)]};return s}function Zr(e,t){return[e,Math.log(Math.tan(dt/4+t/2))]}function ei(e){var t=pr(e),n=t.scale,r=t.translate,i=t.clipExtent,s;t.scale=function(){var e=n.apply(t,arguments);return e===t?s?t.clipExtent(null):t:e};t.translate=function(){var e=r.apply(t,arguments);return e===t?s?t.clipExtent(null):t:e};t.clipExtent=function(e){var o=i.apply(t,arguments);if(o===t){if(s=e==null){var u=dt*n(),a=r();i([[a[0]-u,a[1]-u],[a[0]+u,a[1]+u]])}}else if(s){o=null}return o};return t.clipExtent(null)}function ri(e,t){var n=Math.cos(t)*Math.sin(e);return[Math.log((1+n)/(1-n))/2,Math.atan2(Math.tan(t),Math.cos(e))]}function ii(e){function u(s){function d(){u.push("M",i(e(a),o))}var u=[],a=[],f=-1,l=s.length,c,h=Qt(t),p=Qt(n);while(++f<l){if(r.call(this,c=s[f],f)){a.push([+h.call(this,c,f),+p.call(this,c,f)])}else if(a.length){d();a=[]}}if(a.length)d();return u.length?u.join(""):null}var t=si,n=oi,r=$n,i=ai,s=i.key,o=.7;u.x=function(e){if(!arguments.length)return t;t=e;return u};u.y=function(e){if(!arguments.length)return n;n=e;return u};u.defined=function(e){if(!arguments.length)return r;r=e;return u};u.interpolate=function(e){if(!arguments.length)return s;if(typeof e==="function")s=i=e;else s=(i=ui.get(e)||ai).key;return u};u.tension=function(e){if(!arguments.length)return o;o=e;return u};return u}function si(e){return e[0]}function oi(e){return e[1]}function ai(e){return e.join("L")}function fi(e){return ai(e)+"Z"}function li(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("V",(r=e[t])[1],"H",r[0]);return i.join("")}function ci(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("H",(r=e[t])[0],"V",r[1]);return i.join("")}function hi(e,t){return e.length<4?ai(e):e[1]+vi(e.slice(1,e.length-1),mi(e,t))}function pi(e,t){return e.length<3?ai(e):e[0]+vi((e.push(e[0]),e),mi([e[e.length-2]].concat(e,[e[1]]),t))}function di(e,t){return e.length<3?ai(e):e[0]+vi(e,mi(e,t))}function vi(e,t){if(t.length<1||e.length!=t.length&&e.length!=t.length+2){return ai(e)}var n=e.length!=t.length,r="",i=e[0],s=e[1],o=t[0],u=o,a=1;if(n){r+="Q"+(s[0]-o[0]*2/3)+","+(s[1]-o[1]*2/3)+","+s[0]+","+s[1];i=e[1];a=2}if(t.length>1){u=t[1];s=e[a];a++;r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f<t.length;f++,a++){s=e[a];u=t[f];r+="S"+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1]}}if(n){var l=e[a];r+="Q"+(s[0]+u[0]*2/3)+","+(s[1]+u[1]*2/3)+","+l[0]+","+l[1]}return r}function mi(e,t){var n=[],r=(1-t)/2,i,s=e[0],o=e[1],u=1,a=e.length;while(++u<a){i=s;s=o;o=e[u];n.push([r*(o[0]-i[0]),r*(o[1]-i[1])])}return n}function gi(e){if(e.length<3)return ai(e);var t=1,n=e.length,r=e[0],i=r[0],s=r[1],o=[i,i,i,(r=e[1])[0]],u=[s,s,s,r[1]],a=[i,",",s];Ni(a,o,u);while(++t<n){r=e[t];o.shift();o.push(r[0]);u.shift();u.push(r[1]);Ni(a,o,u)}t=-1;while(++t<2){o.shift();o.push(r[0]);u.shift();u.push(r[1]);Ni(a,o,u)}return a.join("")}function yi(e){if(e.length<4)return ai(e);var t=[],n=-1,r=e.length,i,s=[0],o=[0];while(++n<3){i=e[n];s.push(i[0]);o.push(i[1])}t.push(Ei(Ti,s)+","+Ei(Ti,o));--n;while(++n<r){i=e[n];s.shift();s.push(i[0]);o.shift();o.push(i[1]);Ni(t,s,o)}return t.join("")}function bi(e){var t,n=-1,r=e.length,i=r+4,s,o=[],u=[];while(++n<4){s=e[n%r];o.push(s[0]);u.push(s[1])}t=[Ei(Ti,o),",",Ei(Ti,u)];--n;while(++n<i){s=e[n%r];o.shift();o.push(s[0]);u.shift();u.push(s[1]);Ni(t,o,u)}return t.join("")}function wi(e,t){var n=e.length-1;if(n){var r=e[0][0],i=e[0][1],s=e[n][0]-r,o=e[n][1]-i,u=-1,a,f;while(++u<=n){a=e[u];f=u/n;a[0]=t*a[0]+(1-t)*(r+f*s);a[1]=t*a[1]+(1-t)*(i+f*o)}}return gi(e)}function Ei(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Ni(e,t,n){e.push("C",Ei(Si,t),",",Ei(Si,n),",",Ei(xi,t),",",Ei(xi,n),",",Ei(Ti,t),",",Ei(Ti,n))}function Ci(e,t){return(t[1]-e[1])/(t[0]-e[0])}function ki(e){var t=0,n=e.length-1,r=[],i=e[0],s=e[1],o=r[0]=Ci(i,s);while(++t<n){r[t]=(o+(o=Ci(i=s,s=e[t+1])))/2}r[t]=o;return r}function Li(e){var t=[],n,r,i,s,o=ki(e),u=-1,a=e.length-1;while(++u<a){n=Ci(e[u],e[u+1]);if(Math.abs(n)<1e-6){o[u]=o[u+1]=0}else{r=o[u]/n;i=o[u+1]/n;s=r*r+i*i;if(s>9){s=n*3/Math.sqrt(s);o[u]=s*r;o[u+1]=s*i}}}u=-1;while(++u<=a){s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u]));t.push([s||0,o[u]*s||0])}return t}function Ai(e){return e.length<3?ai(e):e[0]+vi(e,Li(e))}function Oi(e,t,n,r){var i,s,o,u,a,f,l;i=r[e];s=i[0];o=i[1];i=r[t];u=i[0];a=i[1];i=r[n];f=i[0];l=i[1];return(l-o)*(u-s)-(a-o)*(f-s)>0}function Mi(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function _i(e,t,n,r){var i=e[0],s=n[0],o=t[0]-i,u=r[0]-s,a=e[1],f=n[1],l=t[1]-a,c=r[1]-f,h=(u*(a-f)-c*(i-s))/(c*o-u*l);return[i+h*o,a+h*l]}function Pi(e,t){var n={list:e.map(function(e,t){return{index:t,x:e[0],y:e[1]}}).sort(function(e,t){return e.y<t.y?-1:e.y>t.y?1:e.x<t.x?-1:e.x>t.x?1:0}),bottomSite:null};var r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l");r.rightEnd=r.createHalfEdge(null,"l");r.leftEnd.r=r.rightEnd;r.rightEnd.l=r.leftEnd;r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(e,t){return{edge:e,side:t,vertex:null,l:null,r:null}},insert:function(e,t){t.l=e;t.r=e.r;e.r.l=t;e.r=t},leftBound:function(e){var t=r.leftEnd;do{t=t.r}while(t!=r.rightEnd&&i.rightOf(t,e));t=t.l;return t},del:function(e){e.l.r=e.r;e.r.l=e.l;e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[Di[e.side]]}};var i={bisect:function(e,t){var n={region:{l:e,r:t},ep:{l:null,r:null}};var r=t.x-e.x,i=t.y-e.y,s=r>0?r:-r,o=i>0?i:-i;n.c=e.x*r+e.y*i+(r*r+i*i)*.5;if(s>o){n.a=1;n.b=i/r;n.c/=r}else{n.b=1;n.a=r/i;n.c/=i}return n},intersect:function(e,t){var n=e.edge,r=t.edge;if(!n||!r||n.region.r==r.region.r){return null}var i=n.a*r.b-n.b*r.a;if(Math.abs(i)<1e-10){return null}var s=(n.c*r.b-r.c*n.b)/i,o=(r.c*n.a-n.c*r.a)/i,u=n.region.r,a=r.region.r,f,l;if(u.y<a.y||u.y==a.y&&u.x<a.x){f=e;l=n}else{f=t;l=r}var c=s>=l.region.r.x;if(c&&f.side==="l"||!c&&f.side==="r"){return null}return{x:s,y:o}},rightOf:function(e,t){var n=e.edge,r=n.region.r,i=t.x>r.x;if(i&&e.side==="l"){return 1}if(!i&&e.side==="r"){return 0}if(n.a===1){var s=t.y-r.y,o=t.x-r.x,u=0,a=0;if(!i&&n.b<0||i&&n.b>=0){a=u=s>=n.b*o}else{a=t.x+t.y*n.b>n.c;if(n.b<0){a=!a}if(!a){u=1}}if(!u){var f=r.x-n.region.l.x;a=n.b*(o*o-s*s)<f*s*(1+2*o/f+n.b*n.b);if(n.b<0){a=!a}}}else{var l=n.c-n.a*t.x,c=t.y-l,h=t.x-r.x,p=l-r.y;a=c*c>h*h+p*p}return e.side==="l"?a:!a},endPoint:function(e,n,r){e.ep[n]=r;if(!e.ep[Di[n]])return;t(e)},distance:function(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}};var s={list:[],insert:function(e,t,n){e.vertex=t;e.ystar=t.y+n;for(var r=0,i=s.list,o=i.length;r<o;r++){var u=i[r];if(e.ystar>u.ystar||e.ystar==u.ystar&&t.x>u.vertex.x){continue}else{break}}i.splice(r,0,e)},del:function(e){for(var t=0,n=s.list,r=n.length;t<r&&n[t]!=e;++t){}n.splice(t,1)},empty:function(){return s.list.length===0},nextEvent:function(e){for(var t=0,n=s.list,r=n.length;t<r;++t){if(n[t]==e)return n[t+1]}return null},min:function(){var e=s.list[0];return{x:e.vertex.x,y:e.ystar}},extractMin:function(){return s.list.shift()}};r.init();n.bottomSite=n.list.shift();var o=n.list.shift(),u;var a,f,l,c,h;var p,d,v,m,g;var y,b;while(true){if(!s.empty()){u=s.min()}if(o&&(s.empty()||o.y<u.y||o.y==u.y&&o.x<u.x)){a=r.leftBound(o);f=r.right(a);p=r.rightRegion(a);y=i.bisect(p,o);h=r.createHalfEdge(y,"l");r.insert(a,h);m=i.intersect(a,h);if(m){s.del(a);s.insert(a,m,i.distance(m,o))}a=h;h=r.createHalfEdge(y,"r");r.insert(a,h);m=i.intersect(h,f);if(m){s.insert(h,m,i.distance(m,o))}o=n.list.shift()}else if(!s.empty()){a=s.extractMin();l=r.left(a);f=r.right(a);c=r.right(f);p=r.leftRegion(a);d=r.rightRegion(f);g=a.vertex;i.endPoint(a.edge,a.side,g);i.endPoint(f.edge,f.side,g);r.del(a);s.del(f);r.del(f);b="l";if(p.y>d.y){v=p;p=d;d=v;b="r"}y=i.bisect(p,d);h=r.createHalfEdge(y,b);r.insert(l,h);i.endPoint(y,Di[b],g);m=i.intersect(l,h);if(m){s.del(l);s.insert(l,m,i.distance(m,p))}m=i.intersect(h,c);if(m){s.insert(h,m,i.distance(m,p))}}else{break}}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a)){t(a.edge)}}function Hi(e){return e.x}function Bi(e){return e.y}function ji(){return{leaf:true,nodes:[],point:null,x:null,y:null}}function Fi(e,t,n,r,i,s){if(!e(t,n,r,i,s)){var o=(n+i)*.5,u=(r+s)*.5,a=t.nodes;if(a[0])Fi(e,a[0],n,r,o,u);if(a[1])Fi(e,a[1],o,r,i,u);if(a[2])Fi(e,a[2],n,u,o,s);if(a[3])Fi(e,a[3],o,u,i,s)}}function Ii(t,n){t=e.rgb(t);n=e.rgb(n);var r=t.r,i=t.g,s=t.b,o=n.r-r,u=n.g-i,a=n.b-s;return function(e){return"#"+zt(Math.round(r+o*e))+zt(Math.round(i+u*e))+zt(Math.round(s+a*e))}}function qi(e){var t=[e.a,e.b],n=[e.c,e.d],r=Ui(t),i=Ri(t,n),s=Ui(zi(n,t,-i))||0;if(t[0]*n[1]<n[0]*t[1]){t[0]*=-1;t[1]*=-1;r*=-1;i*=-1}this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-n[0],n[1]))*gt;this.translate=[e.e,e.f];this.scale=[r,s];this.skew=s?Math.atan2(i,s)*gt:0}function Ri(e,t){return e[0]*t[0]+e[1]*t[1]}function Ui(e){var t=Math.sqrt(Ri(e,e));if(t){e[0]/=t;e[1]/=t}return t}function zi(e,t,n){e[0]+=n*t[0];e[1]+=n*t[1];return e}function Xi(e,t){t-=e=+e;return function(n){return e+t*n}}function Vi(t,n){var r=[],i=[],s,o=e.transform(t),u=e.transform(n),a=o.translate,f=u.translate,l=o.rotate,c=u.rotate,h=o.skew,p=u.skew,d=o.scale,v=u.scale;if(a[0]!=f[0]||a[1]!=f[1]){r.push("translate(",null,",",null,")");i.push({i:1,x:Xi(a[0],f[0])},{i:3,x:Xi(a[1],f[1])})}else if(f[0]||f[1]){r.push("translate("+f+")")}else{r.push("")}if(l!=c){if(l-c>180)c+=360;else if(c-l>180)l+=360;i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:Xi(l,c)})}else if(c){r.push(r.pop()+"rotate("+c+")")}if(h!=p){i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:Xi(h,p)})}else if(p){r.push(r.pop()+"skewX("+p+")")}if(d[0]!=v[0]||d[1]!=v[1]){s=r.push(r.pop()+"scale(",null,",",null,")");i.push({i:s-4,x:Xi(d[0],v[0])},{i:s-2,x:Xi(d[1],v[1])})}else if(v[0]!=1||v[1]!=1){r.push(r.pop()+"scale("+v+")")}s=i.length;return function(e){var t=-1,n;while(++t<s)r[(n=i[t]).i]=n.x(e);return r.join("")}}function $i(e,t){var n={},r={},i;for(i in e){if(i in t){n[i]=Gi(i)(e[i],t[i])}else{r[i]=e[i]}}for(i in t){if(!(i in e)){r[i]=t[i]}}return function(e){for(i in n)r[i]=n[i](e);return r}}function Ji(e,t){var n,r,i,s=0,o=0,u=[],a=[],f,l;e=e+"",t=t+"";Ki.lastIndex=0;for(r=0;n=Ki.exec(t);++r){if(n.index)u.push(t.substring(s,o=n.index));a.push({i:u.length,x:n[0]});u.push(null);s=Ki.lastIndex}if(s<t.length)u.push(t.substring(s));for(r=0,f=a.length;(n=Ki.exec(e))&&r<f;++r){l=a[r];if(l.x==n[0]){if(l.i){if(u[l.i+1]==null){u[l.i-1]+=l.x;u.splice(l.i,1);for(i=r+1;i<f;++i)a[i].i--}else{u[l.i-1]+=l.x+u[l.i+1];u.splice(l.i,2);for(i=r+1;i<f;++i)a[i].i-=2}}else{if(u[l.i+1]==null){u[l.i]=l.x}else{u[l.i]=l.x+u[l.i+1];u.splice(l.i+1,1);for(i=r+1;i<f;++i)a[i].i--}}a.splice(r,1);f--;r--}else{l.x=Xi(parseFloat(n[0]),parseFloat(l.x))}}while(r<f){l=a.pop();if(u[l.i+1]==null){u[l.i]=l.x}else{u[l.i]=l.x+u[l.i+1];u.splice(l.i+1,1)}f--}if(u.length===1){return u[0]==null?a[0].x:function(){return t}}return function(e){for(r=0;r<f;++r)u[(l=a[r]).i]=l.x(e);return u.join("")}}function Qi(t,n){var r=e.interpolators.length,i;while(--r>=0&&!(i=e.interpolators[r](t,n)));return i}function Gi(e){return e=="transform"?Vi:Qi}function Yi(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u<o;++u)n.push(Qi(e[u],t[u]));for(;u<i;++u)r[u]=e[u];for(;u<s;++u)r[u]=t[u];return function(e){for(u=0;u<o;++u)r[u]=n[u](e);return r}}function ns(e){return function(t){return t<=0?0:t>=1?1:e(t)}}function rs(e){return function(t){return 1-e(1-t)}}function is(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function ss(e){return e*e}function os(e){return e*e*e}function us(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function as(e){return function(t){return Math.pow(t,e)}}function fs(e){return 1-Math.cos(e*dt/2)}function ls(e){return Math.pow(2,10*(e-1))}function cs(e){return 1-Math.sqrt(1-e*e)}function hs(e,t){var n;if(arguments.length<2)t=.45;if(arguments.length)n=t/(2*dt)*Math.asin(1/e);else e=1,n=t/4;return function(r){return 1+e*Math.pow(2,10*-r)*Math.sin((r-n)*2*dt/t)}}function ps(e){if(!e)e=1.70158;return function(t){return t*t*((e+1)*t-e)}}function ds(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function vs(t,n){t=e.hcl(t);n=e.hcl(n);var r=t.h,i=t.c,s=t.l,o=n.h-r,u=n.c-i,a=n.l-s;if(o>180)o-=360;else if(o<-180)o+=360;return function(e){return kt(r+o*e,i+u*e,s+a*e)+""}}function ms(t,n){t=e.hsl(t);n=e.hsl(n);var r=t.h,i=t.s,s=t.l,o=n.h-r,u=n.s-i,a=n.l-s;if(o>180)o-=360;else if(o<-180)o+=360;return function(e){return pt(r+o*e,i+u*e,s+a*e)+""}}function gs(t,n){t=e.lab(t);n=e.lab(n);var r=t.l,i=t.a,s=t.b,o=n.l-r,u=n.a-i,a=n.b-s;return function(e){return Ht(r+o*e,i+u*e,s+a*e)+""}}function ys(e,t){t-=e;return function(n){return Math.round(e+t*n)}}function bs(e,t){t=t-(e=+e)?1/(t-e):0;return function(n){return(n-e)*t}}function ws(e,t){t=t-(e=+e)?1/(t-e):0;return function(n){return Math.max(0,Math.min(1,(n-e)*t))}}function Es(e){var t=e.source,n=e.target,r=xs(t,n),i=[t];while(t!==r){t=t.parent;i.push(t)}var s=i.length;while(n!==r){i.splice(s,0,n);n=n.parent}return i}function Ss(e){var t=[],n=e.parent;while(n!=null){t.push(e);e=n;n=n.parent}t.push(e);return t}function xs(e,t){if(e===t)return e;var n=Ss(e),r=Ss(t),i=n.pop(),s=r.pop(),o=null;while(i===s){o=i;i=n.pop();s=r.pop()}return o}function Ts(e){e.fixed|=2}function Ns(e){e.fixed&=~6}function Cs(e){e.fixed|=4;e.px=e.x,e.py=e.y}function ks(e){e.fixed&=~4}function Ls(e,t,n){var r=0,i=0;e.charge=0;if(!e.leaf){var s=e.nodes,o=s.length,u=-1,a;while(++u<o){a=s[u];if(a==null)continue;Ls(a,t,n);e.charge+=a.charge;r+=a.charge*a.cx;i+=a.charge*a.cy}}if(e.point){if(!e.leaf){e.point.x+=Math.random()-.5;e.point.y+=Math.random()-.5}var f=t*n[e.point.index];e.charge+=e.pointCharge=f;r+=f*e.point.x;i+=f*e.point.y}e.cx=r/e.charge;e.cy=i/e.charge}function Ms(t,n){e.rebind(t,n,"sort","children","value");t.nodes=t;t.links=Hs;return t}function _s(e){return e.children}function Ds(e){return e.value}function Ps(e,t){return t.value-e.value}function Hs(t){return e.merge(t.map(function(e){return(e.children||[]).map(function(t){return{source:e,target:t}})}))}function js(e){return e.x}function Fs(e){return e.y}function Is(e,t,n){e.y0=t;e.y=n}function Us(t){return e.range(t.length)}function zs(e){var t=-1,n=e[0].length,r=[];while(++t<n)r[t]=0;return r}function Ws(e){var t=1,n=0,r=e[0][1],i,s=e.length;for(;t<s;++t){if((i=e[t][1])>r){n=t;r=i}}return n}function Xs(e){return e.reduce(Vs,0)}function Vs(e,t){return e+t[1]}function $s(e,t){return Js(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Js(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function Ks(t){return[e.min(t),e.max(t)]}function Qs(e,t){return e.parent==t.parent?1:2}function Gs(e){var t=e.children;return t&&t.length?t[0]:e._tree.thread}function Ys(e){var t=e.children,n;return t&&(n=t.length)?t[n-1]:e._tree.thread}function Zs(e,t){var n=e.children;if(n&&(i=n.length)){var r,i,s=-1;while(++s<i){if(t(r=Zs(n[s],t),e)>0){e=r}}}return e}function eo(e,t){return e.x-t.x}function to(e,t){return t.x-e.x}function no(e,t){return e.depth-t.depth}function ro(e,t){function n(e,r){var i=e.children;if(i&&(a=i.length)){var s,o=null,u=-1,a;while(++u<a){s=i[u];n(s,o);o=s}}t(e,r)}n(e,null)}function io(e){var t=0,n=0,r=e.children,i=r.length,s;while(--i>=0){s=r[i]._tree;s.prelim+=t;s.mod+=t;t+=s.shift+(n+=s.change)}}function so(e,t,n){e=e._tree;t=t._tree;var r=n/(t.number-e.number);e.change+=r;t.change-=r;t.shift+=n;t.prelim+=n;t.mod+=n}function oo(e,t,n){return e._tree.ancestor.parent==t.parent?e._tree.ancestor:n}function uo(e,t){return e.value-t.value}function ao(e,t){var n=e._pack_next;e._pack_next=t;t._pack_prev=e;t._pack_next=n;n._pack_prev=t}function fo(e,t){e._pack_next=t;t._pack_prev=e}function lo(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return i*i-n*n-r*r>.001}function co(e){function p(e){n=Math.min(e.x-e.r,n);r=Math.max(e.x+e.r,r);i=Math.min(e.y-e.r,i);s=Math.max(e.y+e.r,s)}if(!(t=e.children)||!(h=t.length))return;var t,n=Infinity,r=-Infinity,i=Infinity,s=-Infinity,o,u,a,f,l,c,h;t.forEach(ho);o=t[0];o.x=-o.r;o.y=0;p(o);if(h>1){u=t[1];u.x=u.r;u.y=0;p(u);if(h>2){a=t[2];mo(o,u,a);p(a);ao(o,a);o._pack_prev=a;ao(a,u);u=o._pack_next;for(f=3;f<h;f++){mo(o,u,a=t[f]);var d=0,v=1,m=1;for(l=u._pack_next;l!==u;l=l._pack_next,v++){if(lo(l,a)){d=1;break}}if(d==1){for(c=o._pack_prev;c!==l._pack_prev;c=c._pack_prev,m++){if(lo(c,a)){break}}}if(d){if(v<m||v==m&&u.r<o.r)fo(o,u=l);else fo(o=c,u);f--}else{ao(o,a);u=a;p(a)}}}}var g=(n+r)/2,y=(i+s)/2,b=0;for(f=0;f<h;f++){a=t[f];a.x-=g;a.y-=y;b=Math.max(b,a.r+Math.sqrt(a.x*a.x+a.y*a.y))}e.r=b;t.forEach(po)}function ho(e){e._pack_next=e._pack_prev=e}function po(e){delete e._pack_next;delete e._pack_prev}function vo(e,t,n,r){var i=e.children;e.x=t+=r*e.x;e.y=n+=r*e.y;e.r*=r;if(i){var s=-1,o=i.length;while(++s<o)vo(i[s],t,n,r)}}function mo(e,t,n){var r=e.r+n.r,i=t.x-e.x,s=t.y-e.y;if(r&&(i||s)){var o=t.r+n.r,u=i*i+s*s;o*=o;r*=r;var a=.5+(r-o)/(2*u),f=Math.sqrt(Math.max(0,2*o*(r+u)-(r-=u)*r-o*o))/(2*u);n.x=e.x+a*i+f*s;n.y=e.y+a*s-f*i}else{n.x=e.x+r;n.y=e.y}}function go(t){return 1+e.max(t,function(e){return e.y})}function yo(e){return e.reduce(function(e,t){return e+t.x},0)/e.length}function bo(e){var t=e.children;return t&&t.length?bo(t[0]):e}function wo(e){var t=e.children,n;return t&&(n=t.length)?wo(t[n-1]):e}function Eo(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function So(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],s=e.dy-t[0]-t[2];if(i<0){n+=i/2;i=0}if(s<0){r+=s/2;s=0}return{x:n,y:r,dx:i,dy:s}}function xo(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function To(e){return e.rangeExtent?e.rangeExtent():xo(e.range())}function No(e,t,n,r){var i=n(e[0],e[1]),s=r(t[0],t[1]);return function(e){return s(i(e))}}function Co(e,t){var n=0,r=e.length-1,i=e[n],s=e[r],o;if(s<i){o=n,n=r,r=o;o=i,i=s,s=o}if(t=t(s-i)){e[n]=t.floor(i);e[r]=t.ceil(s)}return e}function ko(t,n,r,i){var s=[],o=[],u=0,a=Math.min(t.length,n.length)-1;if(t[a]<t[0]){t=t.slice().reverse();n=n.slice().reverse()}while(++u<=a){s.push(r(t[u-1],t[u]));o.push(i(n[u-1],n[u]))}return function(n){var r=e.bisect(t,n,1,a)-1;return o[r](s[r](n))}}function Lo(e,t,n,r){function o(){var o=Math.min(e.length,t.length)>2?ko:No,a=r?ws:bs;i=o(e,t,a,n);s=o(t,e,a,Qi);return u}function u(e){return i(e)}var i,s;u.invert=function(e){return s(e)};u.domain=function(t){if(!arguments.length)return e;e=t.map(Number);return o()};u.range=function(e){if(!arguments.length)return t;t=e;return o()};u.rangeRound=function(e){return u.range(e).interpolate(ys)};u.clamp=function(e){if(!arguments.length)return r;r=e;return o()};u.interpolate=function(e){if(!arguments.length)return n;n=e;return o()};u.ticks=function(t){return _o(e,t)};u.tickFormat=function(t,n){return Do(e,t,n)};u.nice=function(){Co(e,Oo);return o()};u.copy=function(){return Lo(e,t,n,r)};return o()}function Ao(t,n){return e.rebind(t,n,"range","rangeRound","interpolate","clamp")}function Oo(e){e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1);return e&&{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}}function Mo(e,t){var n=xo(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;if(s<=.15)i*=10;else if(s<=.35)i*=5;else if(s<=.75)i*=2;n[0]=Math.ceil(n[0]/i)*i;n[1]=Math.floor(n[1]/i)*i+i*.5;n[2]=i;return n}function _o(t,n){return e.range.apply(e,Mo(t,n))}function Do(t,n,r){var i=-Math.floor(Math.log(Mo(t,n)[2])/Math.LN10+.01);return e.format(r?r.replace(dn,function(e,t,n,r,s,o,u,a,f,l){return[t,n,r,s,o,u,a,f||"."+(i-(l==="%")*2),l].join("")}):",."+i+"f")}function Po(e,t,n,r){function i(t){return e(n(t))}i.invert=function(t){return r(e.invert(t))};i.domain=function(t){if(!arguments.length)return e.domain().map(r);if(t[0]<0)n=Fo,r=Io;else n=Bo,r=jo;e.domain(t.map(n));return i};i.base=function(e){if(!arguments.length)return t;t=+e;return i};i.nice=function(){e.domain(Co(e.domain(),qo(t)));return i};i.ticks=function(){var i=xo(e.domain()),s=[];if(i.every(isFinite)){var o=Math.log(t),u=Math.floor(i[0]/o),a=Math.ceil(i[1]/o),f=r(i[0]),l=r(i[1]),c=t%1?2:t;if(n===Fo){s.push(-Math.pow(t,-u));for(;u++<a;)for(var h=c-1;h>0;h--)s.push(-Math.pow(t,-u)*h)}else{for(;u<a;u++)for(var h=1;h<c;h++)s.push(Math.pow(t,u)*h);s.push(Math.pow(t,u))}for(u=0;s[u]<f;u++){}for(a=s.length;s[a-1]>l;a--){}s=s.slice(u,a)}return s};i.tickFormat=function(e,s){if(arguments.length<2)s=Ho;if(!arguments.length)return s;var o=Math.log(t),u=Math.max(.1,e/i.ticks().length),a=n===Fo?(f=-1e-12,Math.floor):(f=1e-12,Math.ceil),f;return function(e){return e/r(o*a(n(e)/o+f))<=u?s(e):""}};i.copy=function(){return Po(e.copy(),t,n,r)};return Ao(i,e)}function Bo(e){return Math.log(e<0?0:e)}function jo(e){return Math.exp(e)}function Fo(e){return-Math.log(e>0?0:-e)}function Io(e){return-Math.exp(-e)}function qo(e){e=Math.log(e);var t={floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}};return function(){return t}}function Ro(e,t){function i(t){return e(n(t))}var n=Uo(t),r=Uo(1/t);i.invert=function(t){return r(e.invert(t))};i.domain=function(t){if(!arguments.length)return e.domain().map(r);e.domain(t.map(n));return i};i.ticks=function(e){return _o(i.domain(),e)};i.tickFormat=function(e,t){return Do(i.domain(),e,t)};i.nice=function(){return i.domain(Co(i.domain(),Oo))};i.exponent=function(e){if(!arguments.length)return t;var s=i.domain();n=Uo(t=e);r=Uo(1/t);return i.domain(s)};i.copy=function(){return Ro(e.copy(),t)};return Ao(i,e)}function Uo(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function zo(t,n){function o(e){return i[((r.get(e)||r.set(e,t.push(e)))-1)%i.length]}function u(n,r){return e.range(t.length).map(function(e){return n+r*e})}var r,i,s;o.domain=function(e){if(!arguments.length)return t;t=[];r=new c;var i=-1,s=e.length,u;while(++i<s)if(!r.has(u=e[i]))r.set(u,t.push(u));return o[n.t].apply(o,n.a)};o.range=function(e){if(!arguments.length)return i;i=e;s=0;n={t:"range",a:arguments};return o};o.rangePoints=function(e,r){if(arguments.length<2)r=0;var a=e[0],f=e[1],l=(f-a)/(Math.max(1,t.length-1)+r);i=u(t.length<2?(a+f)/2:a+l*r/2,l);s=0;n={t:"rangePoints",a:arguments};return o};o.rangeBands=function(e,r,a){if(arguments.length<2)r=0;if(arguments.length<3)a=r;var f=e[1]<e[0],l=e[f-0],c=e[1-f],h=(c-l)/(t.length-r+2*a);i=u(l+h*a,h);if(f)i.reverse();s=h*(1-r);n={t:"rangeBands",a:arguments};return o};o.rangeRoundBands=function(e,r,a){if(arguments.length<2)r=0;if(arguments.length<3)a=r;var f=e[1]<e[0],l=e[f-0],c=e[1-f],h=Math.floor((c-l)/(t.length-r+2*a)),p=c-l-(t.length-r)*h;i=u(l+Math.round(p/2),h);if(f)i.reverse();s=Math.round(h*(1-r));n={t:"rangeRoundBands",a:arguments};return o};o.rangeBand=function(){if(s<=50)return s;else return 50};o.rangeExtent=function(){return xo(n.a[0])};o.copy=function(){return zo(t,n)};return o.domain(t)}function Ko(t,n){function i(){var i=0,o=n.length;r=[];while(++i<o)r[i-1]=e.quantile(t,i/o);return s}function s(t){if(isNaN(t=+t))return NaN;return n[e.bisect(r,t)]}var r;s.domain=function(n){if(!arguments.length)return t;t=n.filter(function(e){return!isNaN(e)}).sort(e.ascending);return i()};s.range=function(e){if(!arguments.length)return n;n=e;return i()};s.quantiles=function(){return r};s.copy=function(){return Ko(t,n)};return i()}function Qo(e,t,n){function s(t){return n[Math.max(0,Math.min(i,Math.floor(r*(t-e))))]}function o(){r=n.length/(t-e);i=n.length-1;return s}var r,i;s.domain=function(n){if(!arguments.length)return[e,t];e=+n[0];t=+n[n.length-1];return o()};s.range=function(e){if(!arguments.length)return n;n=e;return o()};s.copy=function(){return Qo(e,t,n)};return o()}function Go(t,n){function r(r){return n[e.bisect(t,r)]}r.domain=function(e){if(!arguments.length)return t;t=e;return r};r.range=function(e){if(!arguments.length)return n;n=e;return r};r.copy=function(){return Go(t,n)};return r}function Yo(e){function t(e){return+e}t.invert=t;t.domain=t.range=function(n){if(!arguments.length)return e;e=n.map(t);return t};t.ticks=function(t){return _o(e,t)};t.tickFormat=function(t,n){return Do(e,t,n)};t.copy=function(){return Yo(e)};return t}function tu(e){return e.innerRadius}function nu(e){return e.outerRadius}function ru(e){return e.startAngle}function iu(e){return e.endAngle}function su(e){var t,n=-1,r=e.length,i,s;while(++n<r){t=e[n];i=t[0];s=t[1]+Zo;t[0]=i*Math.cos(s);t[1]=i*Math.sin(s)}return e}function ou(e){function c(u){function x(){c.push("M",o(e(p),l),f,a(e(h.reverse()),l),"Z")}var c=[],h=[],p=[],d=-1,v=u.length,m,g=Qt(t),y=Qt(r),b=t===n?function(){return E}:Qt(n),w=r===i?function(){return S}:Qt(i),E,S;while(++d<v){if(s.call(this,m=u[d],d)){h.push([E=+g.call(this,m,d),S=+y.call(this,m,d)]);p.push([+b.call(this,m,d),+w.call(this,m,d)])}else if(h.length){x();h=[];p=[]}}if(h.length)x();return c.length?c.join(""):null}var t=si,n=si,r=0,i=oi,s=$n,o=ai,u=o.key,a=o,f="L",l=.7;c.x=function(e){if(!arguments.length)return n;t=n=e;return c};c.x0=function(e){if(!arguments.length)return t;t=e;return c};c.x1=function(e){if(!arguments.length)return n;n=e;return c};c.y=function(e){if(!arguments.length)return i;r=i=e;return c};c.y0=function(e){if(!arguments.length)return r;r=e;return c};c.y1=function(e){if(!arguments.length)return i;i=e;return c};c.defined=function(e){if(!arguments.length)return s;s=e;return c};c.interpolate=function(e){if(!arguments.length)return u;if(typeof e==="function")u=o=e;else u=(o=ui.get(e)||ai).key;a=o.reverse||o;f=o.closed?"M":"L";return c};c.tension=function(e){if(!arguments.length)return l;l=e;return c};return c}function uu(e){return e.radius}function au(e){return[e.x,e.y]}function fu(e){return function(){var t=e.apply(this,arguments),n=t[0],r=t[1]+Zo;return[n*Math.cos(r),n*Math.sin(r)]}}function lu(){return 64}function cu(){return"circle"}function hu(e){var t=Math.sqrt(e/dt);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+ -t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function mu(e,t){A(e,gu);e.id=t;return e}function Eu(e,t,n,r){var i=e.id;return nt(e,typeof n==="function"?function(e,s,o){e.__transition__[i].tween.set(t,r(n.call(e,e.__data__,s,o)))}:(n=r(n),function(e){e.__transition__[i].tween.set(t,n)}))}function Su(e){if(e==null)e="";return function(){this.textContent=e}}function xu(t,n,r,i){var s=t.__transition__||(t.__transition__={active:0,count:0}),o=s[r];if(!o){var u=i.time;o=s[r]={tween:new c,event:e.dispatch("start","end"),time:u,ease:i.ease,delay:i.delay,duration:i.duration};++s.count;e.timer(function(i){function d(i){if(s.active>r)return m();s.active=r;l.start.call(t,a,n);o.tween.forEach(function(e,r){if(r=r.call(t,a,n)){p.push(r)}});if(!v(i))e.timer(v,0,u);return 1}function v(e){if(s.active!==r)return m();var i=(e-c)/h,o=f(i),u=p.length;while(u>0){p[--u].call(t,o)}if(i>=1){m();l.end.call(t,a,n);return 1}}function m(){if(--s.count)delete s[r];else delete t.__transition__;return 1}var a=t.__data__,f=o.ease,l=o.event,c=o.delay,h=o.duration,p=[];return c<=i?d(i):e.timer(d,c,u),1},0,u);return o}}function Cu(e,t){e.attr("transform",function(e){return"translate("+t(e)+",0)"})}function ku(e,t){e.attr("transform",function(e){return"translate(0,"+t(e)+")"})}function Lu(e,t,n){i=[];if(n&&t.length>1){var r=xo(e.domain()),i,s=-1,o=t.length,u=(t[1]-t[0])/++n,a,f;while(++s<o){for(a=n;--a>0;){if((f=+t[s]-a*u)>=r[0]){i.push(f)}}}for(--s,a=0;++a<n&&(f=+t[s]+a*u)<r[1];){i.push(f)}}return i}function Du(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Uu(e,t,n){function r(t){var n=e(t),r=s(n,1);return t-n<r-t?n:r}function i(n){t(n=e(new Mu(n-1)),1);return n}function s(e,n){t(e=new Mu(+e),n);return e}function o(e,r,s){var o=i(e),u=[];if(s>1){while(o<r){if(!(n(o)%s))u.push(new Date(+o));t(o,1)}}else{while(o<r)u.push(new Date(+o)),t(o,1)}return u}function u(e,t,n){try{Mu=Du;var r=new Du;r._=e;return o(r,t,n)}finally{Mu=Date}}e.floor=e;e.round=r;e.ceil=i;e.offset=s;e.range=o;var a=e.utc=zu(e);a.floor=a;a.round=zu(r);a.ceil=zu(i);a.offset=zu(s);a.range=u;return e}function zu(e){return function(t,n){try{Mu=Du;var r=new Du;r._=t;return e(r,n)._}finally{Mu=Date}}}function Wu(e,t,n,r){var i,s,o=0,u=t.length,a=n.length;while(o<u){if(r>=a)return-1;i=t.charCodeAt(o++);if(i===37){s=na[t.charAt(o++)];if(!s||(r=s(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++)){return-1}}return r}function Xu(t){return new RegExp("^(?:"+t.map(e.requote).join("|")+")","i")}function Vu(e){var t=new c,n=-1,r=e.length;while(++n<r)t.set(e[n].toLowerCase(),n);return t}function $u(e,t,n){e+="";var r=e.length;return r<n?(new Array(n-r+1)).join(t)+e:e}function ra(e,t,n){Ku.lastIndex=0;var r=Ku.exec(t.substring(n));return r?n+=r[0].length:-1}function ia(e,t,n){Ju.lastIndex=0;var r=Ju.exec(t.substring(n));return r?n+=r[0].length:-1}function sa(e,t,n){Yu.lastIndex=0;var r=Yu.exec(t.substring(n));return r?(e.m=Zu.get(r[0].toLowerCase()),n+=r[0].length):-1}function oa(e,t,n){Qu.lastIndex=0;var r=Qu.exec(t.substring(n));return r?(e.m=Gu.get(r[0].toLowerCase()),n+=r[0].length):-1}function ua(e,t,n){return Wu(e,ta.c.toString(),t,n)}function aa(e,t,n){return Wu(e,ta.x.toString(),t,n)}function fa(e,t,n){return Wu(e,ta.X.toString(),t,n)}function la(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+4));return r?(e.y=+r[0],n+=r[0].length):-1}function ca(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.y=ha(+r[0]),n+=r[0].length):-1}function ha(e){return e+(e>68?1900:2e3)}function pa(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.m=r[0]-1,n+=r[0].length):-1}function da(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.d=+r[0],n+=r[0].length):-1}function va(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.H=+r[0],n+=r[0].length):-1}function ma(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.M=+r[0],n+=r[0].length):-1}function ga(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.S=+r[0],n+=r[0].length):-1}function ya(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+3));return r?(e.L=+r[0],n+=r[0].length):-1}function wa(e,t,n){var r=Ea.get(t.substring(n,n+=2).toLowerCase());return r==null?-1:(e.p=r,n)}function Sa(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return n+$u(r,"0",2)+$u(i,"0",2)}function Ta(e){return e.toISOString()}function Na(t,n,r){function i(e){return t(e)}i.invert=function(e){return ka(t.invert(e))};i.domain=function(e){if(!arguments.length)return t.domain().map(ka);t.domain(e);return i};i.nice=function(e){return i.domain(Co(i.domain(),function(){return e}))};i.ticks=function(r,s){var o=Ca(i.domain());if(typeof r!=="function"){var u=o[1]-o[0],a=u/r,f=e.bisect(Ma,a);if(f==Ma.length)return n.year(o,r);if(!f)return t.ticks(r).map(ka);if(Math.log(a/Ma[f-1])<Math.log(Ma[f]/a))--f;r=n[f];s=r[1];r=r[0].range}return r(o[0],new Date(+o[1]+1),s)};i.tickFormat=function(){return r};i.copy=function(){return Na(t.copy(),n,r)};return e.rebind(i,t,"range","rangeRound","interpolate","clamp")}function Ca(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function ka(e){return new Date(e)}function La(e){return function(t){var n=e.length-1,r=e[n];while(!r[1](t))r=e[--n];return r[0](t)}}function Aa(e){var t=new Date(e,0,1);t.setFullYear(e);return t}function Oa(e){var t=e.getFullYear(),n=Aa(t),r=Aa(t+1);return t+(e-n)/(r-n)}function Ia(e){var t=new Date(Date.UTC(e,0,1));t.setUTCFullYear(e);return t}function qa(e){var t=e.getUTCFullYear(),n=Ia(t),r=Ia(t+1);return t+(e-n)/(r-n)}function Ra(e){return e.responseText}function Ua(e){return JSON.parse(e.responseText)}function za(e){var n=t.createRange();n.selectNode(t.body);return n.createContextualFragment(e.responseText)}function Wa(e){return e.responseXML}var e={version:"3.1.5"};if(!Date.now)Date.now=function(){return+(new Date)};var t=document,n=window;try{t.createElement("div").style.setProperty("opacity",0,"")}catch(r){var i=n.CSSStyleDeclaration.prototype,s=i.setProperty;i.setProperty=function(e,t,n){s.call(this,e,t+"",n)}}e.ascending=function(e,t){return e<t?-1:e>t?1:e>=t?0:NaN};e.descending=function(e,t){return t<e?-1:t>e?1:t>=e?0:NaN};e.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)if((s=e[n])!=null&&i>s)i=s}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)if((s=t.call(e,e[n],n))!=null&&i>s)i=s}return i};e.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)if((s=e[n])!=null&&s>i)i=s}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)if((s=t.call(e,e[n],n))!=null&&s>i)i=s}return i};e.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++n<r&&((i=o=e[n])==null||i!=i))i=o=undefined;while(++n<r)if((s=e[n])!=null){if(i>s)i=s;if(o<s)o=s}}else{while(++n<r&&((i=o=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)if((s=t.call(e,e[n],n))!=null){if(i>s)i=s;if(o<s)o=s}}return[i,o]};e.sum=function(e,t){var n=0,r=e.length,i,s=-1;if(arguments.length===1){while(++s<r)if(!isNaN(i=+e[s]))n+=i}else{while(++s<r)if(!isNaN(i=+t.call(e,e[s],s)))n+=i}return n};e.mean=function(e,t){var n=e.length,r,i=0,s=-1,u=0;if(arguments.length===1){while(++s<n)if(o(r=e[s]))i+=(r-i)/++u}else{while(++s<n)if(o(r=t.call(e,e[s],s)))i+=(r-i)/++u}return u?i:undefined};e.quantile=function(e,t){var n=(e.length-1)*t+1,r=Math.floor(n),i=+e[r-1],s=n-r;return s?i+s*(e[r]-i):i};e.median=function(t,n){if(arguments.length>1)t=t.map(n);t=t.filter(o);return t.length?e.quantile(t.sort(e.ascending),.5):undefined};e.bisector=function(e){return{left:function(t,n,r,i){if(arguments.length<3)r=0;if(arguments.length<4)i=t.length;while(r<i){var s=r+i>>>1;if(e.call(t,t[s],s)<n)r=s+1;else i=s}return r},right:function(t,n,r,i){if(arguments.length<3)r=0;if(arguments.length<4)i=t.length;while(r<i){var s=r+i>>>1;if(n<e.call(t,t[s],s))i=s;else r=s+1}return r}}};var u=e.bisector(function(e){return e});e.bisectLeft=u.left;e.bisect=e.bisectRight=u.right;e.shuffle=function(e){var t=e.length,n,r;while(t){r=Math.random()*t--|0;n=e[t],e[t]=e[r],e[r]=n}return e};e.permute=function(e,t){var n=[],r=-1,i=t.length;while(++r<i)n[r]=e[t[r]];return n};e.zip=function(){if(!(s=arguments.length))return[];for(var t=-1,n=e.min(arguments,a),r=new Array(n);++t<n;){for(var i=-1,s,o=r[t]=new Array(s);++i<s;){o[i]=arguments[i][t]}}return r};e.transpose=function(t){return e.zip.apply(e,t)};e.keys=function(e){var t=[];for(var n in e)t.push(n);return t};e.values=function(e){var t=[];for(var n in e)t.push(e[n]);return t};e.entries=function(e){var t=[];for(var n in e)t.push({key:n,value:e[n]});return t};e.merge=function(e){return Array.prototype.concat.apply([],e)};e.range=function(e,t,n){if(arguments.length<3){n=1;if(arguments.length<2){t=e;e=0}}if((t-e)/n===Infinity)throw new Error("infinite range");var r=[],i=f(Math.abs(n)),s=-1,o;e*=i,t*=i,n*=i;if(n<0)while((o=e+n*++s)>t)r.push(o/i);else while((o=e+n*++s)<t)r.push(o/i);return r};e.map=function(e){var t=new c;for(var n in e)t.set(n,e[n]);return t};l(c,{has:function(e){return h+e in this},get:function(e){return this[h+e]},set:function(e,t){return this[h+e]=t},remove:function(e){e=h+e;return e in this&&delete this[e]},keys:function(){var e=[];this.forEach(function(t){e.push(t)});return e},values:function(){var e=[];this.forEach(function(t,n){e.push(n)});return e},entries:function(){var e=[];this.forEach(function(t,n){e.push({key:t,value:n})});return e},forEach:function(e){for(var t in this){if(t.charCodeAt(0)===p){e.call(this,t.substring(1),this[t])}}}});var h="\0",p=h.charCodeAt(0);e.nest=function(){function o(e,r,u){if(u>=n.length)return s?s.call(t,r):i?r.sort(i):r;var a=-1,f=r.length,l=n[u++],h,p,d,v=new c,m;while(++a<f){if(m=v.get(h=l(p=r[a]))){m.push(p)}else{v.set(h,[p])}}if(e){p=e();d=function(t,n){p.set(t,o(e,n,u))}}else{p={};d=function(t,n){p[t]=o(e,n,u)}}v.forEach(d);return p}function u(e,t){if(t>=n.length)return e;var i=[],s=r[t++];e.forEach(function(e,n){i.push({key:e,values:u(n,t)})});return s?i.sort(function(e,t){return s(e.key,t.key)}):i}var t={},n=[],r=[],i,s;t.map=function(e,t){return o(t,e,0)};t.entries=function(t){return u(o(e.map,t,0),0)};t.key=function(e){n.push(e);return t};t.sortKeys=function(e){r[n.length-1]=e;return t};t.sortValues=function(e){i=e;return t};t.rollup=function(e){s=e;return t};return t};e.set=function(e){var t=new d;if(e)for(var n=0;n<e.length;n++)t.add(e[n]);return t};l(d,{has:function(e){return h+e in this},add:function(e){this[h+e]=true;return e},remove:function(e){e=h+e;return e in this&&delete this[e]},values:function(){var e=[];this.forEach(function(t){e.push(t)});return e},forEach:function(e){for(var t in this){if(t.charCodeAt(0)===p){e.call(this,t.substring(1))}}}});e.behavior={};e.rebind=function(e,t){var n=1,r=arguments.length,i;while(++n<r)e[i=arguments[n]]=v(e,t,t[i]);return e};e.dispatch=function(){var e=new m,t=-1,n=arguments.length;while(++t<n)e[arguments[t]]=g(e);return e};m.prototype.on=function(e,t){var n=e.indexOf("."),r="";if(n>=0){r=e.substring(n+1);e=e.substring(0,n)}if(e)return arguments.length<2?this[e].on(r):this[e].on(r,t);if(arguments.length===2){if(t==null)for(e in this){if(this.hasOwnProperty(e))this[e].on(r,null)}return this}};e.event=null;e.mouse=function(e){return T(e,w())};var x=/WebKit/.test(n.navigator.userAgent)?-1:0;var N=k;try{N(t.documentElement.childNodes)[0].nodeType}catch(L){N=C}var A=[].__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]};e.touches=function(e,t){if(arguments.length<2)t=w().touches;return t?N(t).map(function(t){var n=T(e,t);n.identifier=t.identifier;return n}):[]};e.behavior.drag=function(){function i(){this.on("mousedown.drag",s).on("touchstart.drag",s)}function s(){function h(){var t=i.parentNode;return u!=null?e.touches(t).filter(function(e){return e.identifier===u})[0]:e.mouse(t)}function p(){if(!i.parentNode)return d();var e=h(),t=e[0]-f[0],n=e[1]-f[1];l|=t|n;f=e;y();s({type:"drag",x:e[0]+a[0],y:e[1]+a[1],dx:t,dy:n})}function d(){s({type:"dragend"});if(l){y();if(e.event.target===o)E(c,"click")}c.on(u!=null?"touchmove.drag-"+u:"mousemove.drag",null).on(u!=null?"touchend.drag-"+u:"mouseup.drag",null)}var i=this,s=t.of(i,arguments),o=e.event.target,u=e.event.touches?e.event.changedTouches[0].identifier:null,a,f=h(),l=0;var c=e.select(n).on(u!=null?"touchmove.drag-"+u:"mousemove.drag",p).on(u!=null?"touchend.drag-"+u:"mouseup.drag",d,true);if(r){a=r.apply(i,arguments);a=[a.x-f[0],a.y-f[1]]}else{a=[0,0]}if(u==null)y();s({type:"dragstart"})}var t=S(i,"drag","dragstart","dragend"),r=null;i.origin=function(e){if(!arguments.length)return r;r=e;return i};return e.rebind(i,t,"on")};var M=function(e,t){return t.querySelector(e)},_=function(e,t){return t.querySelectorAll(e)},D=t.documentElement,P=D.matchesSelector||D.webkitMatchesSelector||D.mozMatchesSelector||D.msMatchesSelector||D.oMatchesSelector,H=function(e,t){return P.call(e,t)};if(typeof Sizzle==="function"){M=function(e,t){return Sizzle(e,t)[0]||null};_=function(e,t){return Sizzle.uniqueSort(Sizzle(e,t))};H=Sizzle.matchesSelector}var B=[];e.selection=function(){return st};e.selection.prototype=B;B.select=function(e){var t=[],n,r,i,s;if(typeof e!=="function")e=j(e);for(var o=-1,u=this.length;++o<u;){t.push(n=[]);n.parentNode=(i=this[o]).parentNode;for(var a=-1,f=i.length;++a<f;){if(s=i[a]){n.push(r=e.call(s,s.__data__,a));if(r&&"__data__"in s)r.__data__=s.__data__}else{n.push(null)}}}return O(t)};B.selectAll=function(e){var t=[],n,r;if(typeof e!=="function")e=F(e);for(var i=-1,s=this.length;++i<s;){for(var o=this[i],u=-1,a=o.length;++u<a;){if(r=o[u]){t.push(n=N(e.call(r,r.__data__,u)));n.parentNode=r}}}return O(t)};var I={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};e.ns={prefix:I,qualify:function(e){var t=e.indexOf(":"),n=e;if(t>=0){n=e.substring(0,t);e=e.substring(t+1)}return I.hasOwnProperty(n)?{space:I[n],local:e}:e}};B.attr=function(t,n){if(arguments.length<2){if(typeof t==="string"){var r=this.node();t=e.ns.qualify(t);return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(n in t)this.each(q(n,t[n]));return this}return this.each(q(t,n))};e.requote=function(e){return e.replace(U,"\\$&")};var U=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;B.classed=function(e,t){if(arguments.length<2){if(typeof e==="string"){var n=this.node(),r=(e=e.trim().split(/^|\s+/g)).length,i=-1;if(t=n.classList){while(++i<r)if(!t.contains(e[i]))return false}else{t=n.getAttribute("class");while(++i<r)if(!z(e[i]).test(t))return false}return true}for(t in e)this.each(W(t,e[t]));return this}return this.each(W(e,t))};B.style=function(e,t,r){var i=arguments.length;if(i<3){if(typeof e!=="string"){if(i<2)t="";for(r in e)this.each(V(r,e[r],t));return this}if(i<2)return n.getComputedStyle(this.node(),null).getPropertyValue(e);r=""}return this.each(V(e,t,r))};B.property=function(e,t){if(arguments.length<2){if(typeof e==="string")return this.node()[e];for(t in e)this.each($(t,e[t]));return this}return this.each($(e,t))};B.text=function(e){return arguments.length?this.each(typeof e==="function"?function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}:e==null?function(){this.textContent=""}:function(){this.textContent=e}):this.node().textContent};B.html=function(e){return arguments.length?this.each(typeof e==="function"?function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}:e==null?function(){this.innerHTML=""}:function(){this.innerHTML=e}):this.node().innerHTML};B.append=function(n){function r(){return this.appendChild(t.createElementNS(this.namespaceURI,n))}function i(){return this.appendChild(t.createElementNS(n.space,n.local))}n=e.ns.qualify(n);return this.select(n.local?i:r)};B.insert=function(n,r){function i(e,i){return this.insertBefore(t.createElementNS(this.namespaceURI,n),r.call(this,e,i))}function s(e,i){return this.insertBefore(t.createElementNS(n.space,n.local),r.call(this,e,i))}n=e.ns.qualify(n);if(typeof r!=="function")r=j(r);return this.select(n.local?s:i)};B.remove=function(){return this.each(function(){var e=this.parentNode;if(e)e.removeChild(this)})};B.data=function(e,t){function o(e,n){var r,i=e.length,s=n.length,o=Math.min(i,s),l=new Array(s),h=new Array(s),p=new Array(i),d,v;if(t){var m=new c,g=new c,y=[],b;for(r=-1;++r<i;){b=t.call(d=e[r],d.__data__,r);if(m.has(b)){p[r]=d}else{m.set(b,d)}y.push(b)}for(r=-1;++r<s;){b=t.call(n,v=n[r],r);if(d=m.get(b)){l[r]=d;d.__data__=v}else if(!g.has(b)){h[r]=J(v)}g.set(b,v);m.remove(b)}for(r=-1;++r<i;){if(m.has(y[r])){p[r]=e[r]}}}else{for(r=-1;++r<o;){d=e[r];v=n[r];if(d){d.__data__=v;l[r]=d}else{h[r]=J(v)}}for(;r<s;++r){h[r]=J(n[r])}for(;r<i;++r){p[r]=e[r]}}h.update=l;h.parentNode=l.parentNode=p.parentNode=e.parentNode;u.push(h);a.push(l);f.push(p)}var n=-1,r=this.length,i,s;if(!arguments.length){e=new Array(r=(i=this[0]).length);while(++n<r){if(s=i[n]){e[n]=s.__data__}}return e}var u=rt([]),a=O([]),f=O([]);if(typeof e==="function"){while(++n<r){o(i=this[n],e.call(i,i.parentNode.__data__,n))}}else{while(++n<r){o(i=this[n],e)}}a.enter=function(){return u};a.exit=function(){return f};return a};B.datum=function(e){return arguments.length?this.property("__data__",e):this.property("__data__")};B.filter=function(e){var t=[],n,r,i;if(typeof e!=="function")e=K(e);for(var s=0,o=this.length;s<o;s++){t.push(n=[]);n.parentNode=(r=this[s]).parentNode;for(var u=0,a=r.length;u<a;u++){if((i=r[u])&&e.call(i,i.__data__,u)){n.push(i)}}}return O(t)};B.order=function(){for(var e=-1,t=this.length;++e<t;){for(var n=this[e],r=n.length-1,i=n[r],s;--r>=0;){if(s=n[r]){if(i&&i!==s.nextSibling)i.parentNode.insertBefore(s,i);i=s}}}return this};B.sort=function(e){e=Q.apply(this,arguments);for(var t=-1,n=this.length;++t<n;)this[t].sort(e);return this.order()};B.on=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!=="string"){if(r<2)t=false;for(n in e)this.each(Y(n,e[n],t));return this}if(r<2)return(r=this.node()["__on"+e])&&r._;n=false}return this.each(Y(e,t,n))};var Z=e.map({mouseenter:"mouseover",mouseleave:"mouseout"});Z.forEach(function(e){if("on"+e in t)Z.remove(e)});B.each=function(e){return nt(this,function(t,n,r){e.call(t,t.__data__,n,r)})};B.call=function(e){var t=N(arguments);e.apply(t[0]=this,t);return this};B.empty=function(){return!this.node()};B.node=function(){for(var e=0,t=this.length;e<t;e++){for(var n=this[e],r=0,i=n.length;r<i;r++){var s=n[r];if(s)return s}}return null};var it=[];e.selection.enter=rt;e.selection.enter.prototype=it;it.append=B.append;it.insert=B.insert;it.empty=B.empty;it.node=B.node;it.select=function(e){var t=[],n,r,i,s,o;for(var u=-1,a=this.length;++u<a;){i=(s=this[u]).update;t.push(n=[]);n.parentNode=s.parentNode;for(var f=-1,l=s.length;++f<l;){if(o=s[f]){n.push(i[f]=r=e.call(s.parentNode,o.__data__,f));r.__data__=o.__data__}else{n.push(null)}}}return O(t)};B.transition=function(){var e=bu||++yu,t=[],n,r,i=Object.create(wu);i.time=Date.now();for(var s=-1,o=this.length;++s<o;){t.push(n=[]);for(var u=this[s],a=-1,f=u.length;++a<f;){if(r=u[a])xu(r,a,e,i);n.push(r)}}return mu(t,e)};var st=O([[t]]);st[0].parentNode=D;e.select=function(e){return typeof e==="string"?st.select(e):O([[e]])};e.selectAll=function(e){return typeof e==="string"?st.selectAll(e):O([N(e)])};e.behavior.zoom=function(){function p(){this.on("mousedown.zoom",x).on("mousemove.zoom",N).on(at+".zoom",T).on("dblclick.zoom",C).on("touchstart.zoom",k).on("touchmove.zoom",L).on("touchend.zoom",k)}function d(e){return[(e[0]-t[0])/i,(e[1]-t[1])/i]}function v(e){return[e[0]*i+t[0],e[1]*i+t[1]]}function m(e){i=Math.max(o[0],Math.min(o[1],e))}function g(e,n){n=v(n);t[0]+=e[0]-n[0];t[1]+=e[1]-n[1]}function b(){if(f)f.domain(a.range().map(function(e){return(e-t[0])/i}).map(a.invert));if(c)c.domain(l.range().map(function(e){return(e-t[1])/i}).map(l.invert))}function w(n){b();e.event.preventDefault();n({type:"zoom",scale:i,translate:t})}function x(){function f(){s=1;g(e.mouse(t),a);w(r)}function l(){if(s)y();o.on("mousemove.zoom",null).on("mouseup.zoom",null);if(s&&e.event.target===i)E(o,"click.zoom")}var t=this,r=u.of(t,arguments),i=e.event.target,s=0,o=e.select(n).on("mousemove.zoom",f).on("mouseup.zoom",l),a=d(e.mouse(t));n.focus();y()}function T(){if(!r)r=d(e.mouse(this));m(Math.pow(2,ut()*.002)*i);g(e.mouse(this),r);w(u.of(this,arguments))}function N(){r=null}function C(){var t=e.mouse(this),n=d(t),r=Math.log(i)/Math.LN2;m(Math.pow(2,e.event.shiftKey?Math.ceil(r)-1:Math.floor(r)+1));g(t,n);w(u.of(this,arguments))}function k(){var t=e.touches(this),n=Date.now();s=i;r={};t.forEach(function(e){r[e.identifier]=d(e)});y();if(t.length===1){if(n-h<500){var o=t[0],a=d(t[0]);m(i*2);g(o,a);w(u.of(this,arguments))}h=n}}function L(){var t=e.touches(this),n=t[0],i=r[n.identifier];if(o=t[1]){var o,a=r[o.identifier];n=[(n[0]+o[0])/2,(n[1]+o[1])/2];i=[(i[0]+a[0])/2,(i[1]+a[1])/2];m(e.event.scale*s)}g(n,i);h=null;w(u.of(this,arguments))}var t=[0,0],r,i=1,s,o=ot,u=S(p,"zoom"),a,f,l,c,h;p.translate=function(e){if(!arguments.length)return t;t=e.map(Number);b();return p};p.scale=function(e){if(!arguments.length)return i;i=+e;b();return p};p.scaleExtent=function(e){if(!arguments.length)return o;o=e==null?ot:e.map(Number);return p};p.x=function(e){if(!arguments.length)return f;f=e;a=e.copy();t=[0,0];i=1;return p};p.y=function(e){if(!arguments.length)return c;c=e;l=e.copy();t=[0,0];i=1;return p};return e.rebind(p,u,"on")};var ot=[0,Infinity];var ut,at="onwheel"in t?(ut=function(){return-e.event.deltaY*(e.event.deltaMode?120:1)},"wheel"):"onmousewheel"in t?(ut=function(){return e.event.wheelDelta},"mousewheel"):(ut=function(){return-e.event.detail},"MozMousePixelScroll");ft.prototype.toString=function(){return this.rgb()+""};e.hsl=function(e,t,n){return arguments.length===1?e instanceof ct?lt(e.h,e.s,e.l):Wt(""+e,Xt,lt):lt(+e,+t,+n)};var ht=ct.prototype=new ft;ht.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);return lt(this.h,this.s,this.l/e)};ht.darker=function(e){e=Math.pow(.7,arguments.length?e:1);return lt(this.h,this.s,e*this.l)};ht.rgb=function(){return pt(this.h,this.s,this.l)};var dt=Math.PI,vt=1e-6,mt=dt/180,gt=180/dt;e.hcl=function(t,n,r){return arguments.length===1?t instanceof Nt?Tt(t.h,t.c,t.l):t instanceof At?Bt(t.l,t.a,t.b):Bt((t=Vt((t=e.rgb(t)).r,t.g,t.b)).l,t.a,t.b):Tt(+t,+n,+r)};var Ct=Nt.prototype=new ft;Ct.brighter=function(e){return Tt(this.h,this.c,Math.min(100,this.l+Ot*(arguments.length?e:1)))};Ct.darker=function(e){return Tt(this.h,this.c,Math.max(0,this.l-Ot*(arguments.length?e:1)))};Ct.rgb=function(){return kt(this.h,this.c,this.l).rgb()};e.lab=function(t,n,r){return arguments.length===1?t instanceof At?Lt(t.l,t.a,t.b):t instanceof Nt?kt(t.l,t.c,t.h):Vt((t=e.rgb(t)).r,t.g,t.b):Lt(+t,+n,+r)};var Ot=18;var Mt=.95047,_t=1,Dt=1.08883;var Pt=At.prototype=new ft;Pt.brighter=function(e){return Lt(Math.min(100,this.l+Ot*(arguments.length?e:1)),this.a,this.b)};Pt.darker=function(e){return Lt(Math.max(0,this.l-Ot*(arguments.length?e:1)),this.a,this.b)};Pt.rgb=function(){return Ht(this.l,this.a,this.b)};e.rgb=function(e,t,n){return arguments.length===1?e instanceof Rt?qt(e.r,e.g,e.b):Wt(""+e,qt,pt):qt(~~e,~~t,~~n)};var Ut=Rt.prototype=new ft;Ut.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,n=this.g,r=this.b,i=30;if(!t&&!n&&!r)return qt(i,i,i);if(t&&t<i)t=i;if(n&&n<i)n=i;if(r&&r<i)r=i;return qt(Math.min(255,Math.floor(t/e)),Math.min(255,Math.floor(n/e)),Math.min(255,Math.floor(r/e)))};Ut.darker=function(e){e=Math.pow(.7,arguments.length?e:1);return qt(Math.floor(e*this.r),Math.floor(e*this.g),Math.floor(e*this.b))};Ut.hsl=function(){return Xt(this.r,this.g,this.b)};Ut.toString=function(){return"#"+zt(this.r)+zt(this.g)+zt(this.b)};var Kt=e.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});Kt.forEach(function(e,t){Kt.set(e,Wt(t,qt,pt))});e.functor=Qt;e.xhr=function(t,r,i){function l(){var e=f.status;!e&&f.responseText||e>=200&&e<300||e===304?o.load.call(s,a.call(s,f)):o.error.call(s,f)}var s={},o=e.dispatch("progress","load","error"),u={},a=Gt,f=new(n.XDomainRequest&&/^(http(s)?:)?\/\//.test(t)?XDomainRequest:XMLHttpRequest);"onload"in f?f.onload=f.onerror=l:f.onreadystatechange=function(){f.readyState>3&&l()};f.onprogress=function(t){var n=e.event;e.event=t;try{o.progress.call(s,f)}finally{e.event=n}};s.header=function(e,t){e=(e+"").toLowerCase();if(arguments.length<2)return u[e];if(t==null)delete u[e];else u[e]=t+"";return s};s.mimeType=function(e){if(!arguments.length)return r;r=e==null?null:e+"";return s};s.response=function(e){a=e;return s};["get","post"].forEach(function(e){s[e]=function(){return s.send.apply(s,[e].concat(N(arguments)))}});s.send=function(e,n,i){if(arguments.length===2&&typeof n==="function")i=n,n=null;f.open(e,t,true);if(r!=null&&!("accept"in u))u["accept"]=r+",*/*";if(f.setRequestHeader)for(var o in u)f.setRequestHeader(o,u[o]);if(r!=null&&f.overrideMimeType)f.overrideMimeType(r);if(i!=null)s.on("error",i).on("load",function(e){i(null,e)});f.send(n==null?null:n);return s};s.abort=function(){f.abort();return s};e.rebind(s,o,"on");if(arguments.length===2&&typeof r==="function")i=r,r=null;return i==null?s:s.get(Yt(i))};e.csv=Zt(",","text/csv");e.tsv=Zt(" ","text/tab-separated-values");var en=0,tn={},nn=null,rn,sn;e.timer=function(e,t,n){if(arguments.length<3){if(arguments.length<2)t=0;else if(!isFinite(t))return;n=Date.now()}var r=tn[e.id];if(r&&r.callback===e){r.then=n;r.delay=t}else tn[e.id=++en]=nn={callback:e,then:n,delay:t,next:nn};if(!rn){sn=clearTimeout(sn);rn=1;an(on)}};e.timer.flush=function(){var e,t=Date.now(),n=nn;while(n){e=t-n.then;if(!n.delay)n.flush=n.callback(e);n=n.next}un()};var an=n.requestAnimationFrame||n.webkitRequestAnimationFrame||n.mozRequestAnimationFrame||n.oRequestAnimationFrame||n.msRequestAnimationFrame||function(e){setTimeout(e,17)};var fn=".",ln=",",cn=[3,3];var hn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(pn);e.formatPrefix=function(t,n){var r=0;if(t){if(t<0)t*=-1;if(n)t=e.round(t,mn(t,n));r=1+Math.floor(1e-12+Math.log(t)/Math.LN10);r=Math.max(-24,Math.min(24,Math.floor((r<=0?r+1:r-1)/3)*3))}return hn[8+r/3]};e.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)};e.format=function(t){var n=dn.exec(t),r=n[1]||" ",i=n[2]||">",s=n[3]||"",o=n[4]||"",u=n[5],a=+n[6],f=n[7],l=n[8],c=n[9],h=1,p="",d=false;if(l)l=+l.substring(1);if(u||r==="0"&&i==="="){u=r="0";i="=";if(f)a-=Math.floor((a-1)/4)}switch(c){case"n":f=true;c="g";break;case"%":h=100;p="%";c="f";break;case"p":h=100;p="%";c="r";break;case"b":case"o":case"x":case"X":if(o)o="0"+c.toLowerCase();case"c":case"d":d=true;l=0;break;case"s":h=-1;c="r";break}if(o==="#")o="";if(c=="r"&&!l)c="g";if(l!=null){if(c=="g")l=Math.max(1,Math.min(21,l));else if(c=="e"||c=="f")l=Math.max(0,Math.min(20,l))}c=vn.get(c)||gn;var v=u&&f;return function(t){if(d&&t%1)return"";var n=t<0||t===0&&1/t<0?(t=-t,"-"):s;if(h<0){var m=e.formatPrefix(t,l);t=m.scale(t);p=m.symbol}else{t*=h}t=c(t,l);if(!u&&f)t=yn(t);var g=o.length+t.length+(v?0:n.length),y=g<a?(new Array(g=a-g+1)).join(r):"";if(v)t=yn(y+t);if(fn)t.replace(".",fn);n+=o;return(i==="<"?n+t+y:i===">"?y+n+t:i==="^"?y.substring(0,g>>=1)+n+t+y.substring(g):n+(v?t:y+t))+p}};var dn=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i;var vn=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,n){return(t=e.round(t,mn(t,n))).toFixed(Math.max(0,Math.min(20,mn(t*(1+1e-15),n))))}});var yn=Gt;if(cn){var bn=cn.length;yn=function(e){var t=e.lastIndexOf("."),n=t>=0?"."+e.substring(t+1):(t=e.length,""),r=[],i=0,s=cn[0];while(t>0&&s>0){r.push(e.substring(t-=s,t+s));s=cn[i=(i+1)%bn]}return r.reverse().join(ln||"")+n}}e.geo={};e.geo.stream=function(e,t){if(e&&En.hasOwnProperty(e.type)){En[e.type](e,t)}else{wn(e,t)}};var En={Feature:function(e,t){wn(e.geometry,t)},FeatureCollection:function(e,t){var n=e.features,r=-1,i=n.length;while(++r<i)wn(n[r].geometry,t)}};var Sn={Sphere:function(e,t){t.sphere()},Point:function(e,t){var n=e.coordinates;t.point(n[0],n[1])},MultiPoint:function(e,t){var n=e.coordinates,r=-1,i=n.length,s;while(++r<i)s=n[r],t.point(s[0],s[1])},LineString:function(e,t){xn(e.coordinates,t,0)},MultiLineString:function(e,t){var n=e.coordinates,r=-1,i=n.length;while(++r<i)xn(n[r],t,0)},Polygon:function(e,t){Tn(e.coordinates,t)},MultiPolygon:function(e,t){var n=e.coordinates,r=-1,i=n.length;while(++r<i)Tn(n[r],t)},GeometryCollection:function(e,t){var n=e.geometries,r=-1,i=n.length;while(++r<i)wn(n[r],t)}};e.geo.area=function(t){Nn=0;e.geo.stream(t,Ln);return Nn};var Nn,Cn,kn;var Ln={sphere:function(){Nn+=4*dt},point:G,lineStart:G,lineEnd:G,polygonStart:function(){Cn=1,kn=0;Ln.lineStart=An},polygonEnd:function(){var e=2*Math.atan2(kn,Cn);Nn+=e<0?4*dt+e:e;Ln.lineStart=Ln.lineEnd=Ln.point=G}};e.geo.bounds=On(Gt);e.geo.centroid=function(t){Mn=_n=Dn=Pn=Hn=0;e.geo.stream(t,Bn);var n;if(_n&&Math.abs(n=Math.sqrt(Dn*Dn+Pn*Pn+Hn*Hn))>vt){return[Math.atan2(Pn,Dn)*gt,Math.asin(Math.max(-1,Math.min(1,Hn/n)))*gt]}};var Mn,_n,Dn,Pn,Hn;var Bn={sphere:function(){if(Mn<2){Mn=2;_n=Dn=Pn=Hn=0}},point:jn,lineStart:In,lineEnd:qn,polygonStart:function(){if(Mn<2){Mn=2;_n=Dn=Pn=Hn=0}Bn.lineStart=Fn},polygonEnd:function(){Bn.lineStart=In}};var rr=Yn($n,ir,or);var ar=1e9;e.geo.projection=pr;e.geo.projectionMutator=dr;(e.geo.equirectangular=function(){return pr(mr)}).raw=mr.invert=mr;e.geo.rotation=function(e){function t(t){t=e(t[0]*mt,t[1]*mt);return t[0]*=gt,t[1]*=gt,t}e=gr(e[0]%360*mt,e[1]*mt,e.length>2?e[2]*mt:0);t.invert=function(t){t=e.invert(t[0]*mt,t[1]*mt);return t[0]*=gt,t[1]*=gt,t};return t};e.geo.circle=function(){function i(){var t=typeof e==="function"?e.apply(this,arguments):e,n=gr(-t[0]*mt,-t[1]*mt,0).invert,i=[];r(null,null,1,{point:function(e,t){i.push(e=n(e,t));e[0]*=gt,e[1]*=gt}});return{type:"Polygon",coordinates:[i]}}var e=[0,0],t,n=6,r;i.origin=function(t){if(!arguments.length)return e;e=t;return i};i.angle=function(e){if(!arguments.length)return t;r=Er((t=+e)*mt,n*mt);return i};i.precision=function(e){if(!arguments.length)return n;r=Er(t*mt,(n=+e)*mt);return i};return i.angle(90)};e.geo.distance=function(e,t){var n=(t[0]-e[0])*mt,r=e[1]*mt,i=t[1]*mt,s=Math.sin(n),o=Math.cos(n),u=Math.sin(r),a=Math.cos(r),f=Math.sin(i),l=Math.cos(i),c;return Math.atan2(Math.sqrt((c=l*s)*c+(c=a*f-u*l*o)*c),u*f+a*l*o)};e.geo.graticule=function(){function y(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(i/c)*c,r,c).map(v).concat(e.range(Math.ceil(a/h)*h,u,h).map(m)).concat(e.range(Math.ceil(n/f)*f,t,f).filter(function(e){return Math.abs(e%c)>vt}).map(p)).concat(e.range(Math.ceil(o/l)*l,s,l).filter(function(e){return Math.abs(e%h)>vt}).map(d))}var t,n,r,i,s,o,u,a,f=10,l=f,c=90,h=360,p,d,v,m,g=2.5;y.lines=function(){return b().map(function(e){return{type:"LineString",coordinates:e}})};y.outline=function(){return{type:"Polygon",coordinates:[v(i).concat(m(u).slice(1),v(r).reverse().slice(1),m(a).reverse().slice(1))]}};y.extent=function(e){if(!arguments.length)return y.minorExtent();return y.majorExtent(e).minorExtent(e)};y.majorExtent=function(e){if(!arguments.length)return[[i,a],[r,u]];i=+e[0][0],r=+e[1][0];a=+e[0][1],u=+e[1][1];if(i>r)e=i,i=r,r=e;if(a>u)e=a,a=u,u=e;return y.precision(g)};y.minorExtent=function(e){if(!arguments.length)return[[n,o],[t,s]];n=+e[0][0],t=+e[1][0];o=+e[0][1],s=+e[1][1];if(n>t)e=n,n=t,t=e;if(o>s)e=o,o=s,s=e;return y.precision(g)};y.step=function(e){if(!arguments.length)return y.minorStep();return y.majorStep(e).minorStep(e)};y.majorStep=function(e){if(!arguments.length)return[c,h];c=+e[0],h=+e[1];return y};y.minorStep=function(e){if(!arguments.length)return[f,l];f=+e[0],l=+e[1];return y};y.precision=function(e){if(!arguments.length)return g;g=+e;p=xr(o,s,90);d=Tr(n,t,g);v=xr(a,u,90);m=Tr(i,r,g);return y};return y.majorExtent([[-180,-90+vt],[180,90-vt]]).minorExtent([[-180,-80-vt],[180,80+vt]])};e.geo.greatArc=function(){function s(){return{type:"LineString",coordinates:[n||t.apply(this,arguments),i||r.apply(this,arguments)]}}var t=Nr,n,r=Cr,i;s.distance=function(){return e.geo.distance(n||t.apply(this,arguments),i||r.apply(this,arguments))};s.source=function(e){if(!arguments.length)return t;t=e,n=typeof e==="function"?null:e;return s};s.target=function(e){if(!arguments.length)return r;r=e,i=typeof e==="function"?null:e;return s};s.precision=function(){return arguments.length?s:0};return s};e.geo.interpolate=function(e,t){return kr(e[0]*mt,e[1]*mt,t[0]*mt,t[1]*mt)};e.geo.length=function(t){Lr=0;e.geo.stream(t,Ar);return Lr};var Lr;var Ar={sphere:G,point:G,lineStart:Or,lineEnd:G,polygonStart:G,polygonEnd:G};(e.geo.conicEqualArea=function(){return Mr(_r)}).raw=_r;e.geo.albersUsa=function(){function a(e){return f(e)(e)}function f(e){var s=e[0],o=e[1];return o>50?n:s<-140?r:o<21?i:t}var t=e.geo.conicEqualArea().rotate([98,0]).center([0,38]).parallels([29.5,45.5]);var n=e.geo.conicEqualArea().rotate([160,0]).center([0,60]).parallels([55,65]);var r=e.geo.conicEqualArea().rotate([160,0]).center([0,20]).parallels([8,18]);var i=e.geo.conicEqualArea().rotate([60,0]).center([0,10]).parallels([8,18]);var s,o,u;a.invert=function(e){return s(e)||o(e)||u(e)||t.invert(e)};a.scale=function(e){if(!arguments.length)return t.scale();t.scale(e);n.scale(e*.6);r.scale(e);i.scale(e*1.5);return a.translate(t.translate())};a.translate=function(e){if(!arguments.length)return t.translate();var f=t.scale(),l=e[0],c=e[1];t.translate(e);n.translate([l-.4*f,c+.17*f]);r.translate([l-.19*f,c+.2*f]);i.translate([l+.58*f,c+.43*f]);s=Dr(n,[[-180,50],[-130,72]]);o=Dr(r,[[-164,18],[-154,24]]);u=Dr(i,[[-67.5,17.5],[-65,19]]);return a};return a.scale(1e3)};var Pr,Hr,Br={point:G,lineStart:G,lineEnd:G,polygonStart:function(){Hr=0;Br.lineStart=jr},polygonEnd:function(){Br.lineStart=Br.lineEnd=Br.point=G;Pr+=Math.abs(Hr/2)}};var Ir={point:qr,lineStart:Rr,lineEnd:Ur,polygonStart:function(){Ir.lineStart=zr},polygonEnd:function(){Ir.point=qr;Ir.lineStart=Rr;Ir.lineEnd=Ur}};e.geo.path=function(){function o(n){if(n)e.geo.stream(n,i(s.pointRadius(typeof t==="function"?+t.apply(this,arguments):t)));return s.result()}var t=4.5,n,r,i,s;o.area=function(t){Pr=0;e.geo.stream(t,i(Br));return Pr};o.centroid=function(t){Mn=Dn=Pn=Hn=0;e.geo.stream(t,i(Ir));return Hn?[Dn/Hn,Pn/Hn]:undefined};o.bounds=function(e){return On(i)(e)};o.projection=function(e){if(!arguments.length)return n;i=(n=e)?e.stream||Vr(e):Gt;return o};o.context=function(e){if(!arguments.length)return r;s=(r=e)==null?new Fr:new Wr(e);return o};o.pointRadius=function(e){if(!arguments.length)return t;t=typeof e==="function"?e:+e;return o};return o.projection(e.geo.albersUsa()).context(null)};e.geo.albers=function(){return e.geo.conicEqualArea().parallels([29.5,45.5]).rotate([98,0]).center([0,38]).scale(1e3)};var Jr=$r(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(e.geo.azimuthalEqualArea=function(){return pr(Jr)}).raw=Jr;var Kr=$r(function(e){var t=Math.acos(e);return t&&t/Math.sin(t)},Gt);(e.geo.azimuthalEquidistant=function(){return pr(Kr)}).raw=Kr;(e.geo.conicConformal=function(){return Mr(Qr)}).raw=Qr;(e.geo.conicEquidistant=function(){return Mr(Gr)}).raw=Gr;var Yr=$r(function(e){return 1/e},Math.atan);(e.geo.gnomonic=function(){return pr(Yr)}).raw=Yr;Zr.invert=function(e,t){return[e,2*Math.atan(Math.exp(t))-dt/2]};(e.geo.mercator=function(){return ei(Zr)}).raw=Zr;var ti=$r(function(){return 1},Math.asin);(e.geo.orthographic=function(){return pr(ti)}).raw=ti;var ni=$r(function(e){return 1/(1+e)},function(e){return 2*Math.atan(e)});(e.geo.stereographic=function(){return pr(ni)}).raw=ni;ri.invert=function(e,t){return[Math.atan2(Et(e),Math.cos(t)),wt(Math.sin(t)/St(e))]};(e.geo.transverseMercator=function(){return ei(ri)}).raw=ri;e.geom={};e.svg={};e.svg.line=function(){return ii(Gt)};var ui=e.map({linear:ai,"linear-closed":fi,"step-before":li,"step-after":ci,basis:gi,"basis-open":yi,"basis-closed":bi,bundle:wi,cardinal:di,"cardinal-open":hi,"cardinal-closed":pi,monotone:Ai});ui.forEach(function(e,t){t.key=e;t.closed=/-closed$/.test(e)});var Si=[0,2/3,1/3,0],xi=[0,1/3,2/3,0],Ti=[0,1/6,2/3,1/6];e.geom.hull=function(e){function r(e){if(e.length<3)return[];var r=Qt(t),i=Qt(n),s=e.length,o,u=s-1,a=[],f=[],l,c,h,p=0,d,v,m,g,y,b,w,E;if(r===si&&n===oi)o=e;else for(c=0,o=[];c<s;++c){o.push([+r.call(this,l=e[c],c),+i.call(this,l,c)])}for(c=1;c<s;++c){if(o[c][1]<o[p][1]){p=c}else if(o[c][1]==o[p][1]){p=o[c][0]<o[p][0]?c:p}}for(c=0;c<s;++c){if(c===p)continue;v=o[c][1]-o[p][1];d=o[c][0]-o[p][0];a.push({angle:Math.atan2(v,d),index:c})}a.sort(function(e,t){return e.angle-t.angle});w=a[0].angle;b=a[0].index;y=0;for(c=1;c<u;++c){h=a[c].index;if(w==a[c].angle){d=o[b][0]-o[p][0];v=o[b][1]-o[p][1];m=o[h][0]-o[p][0];g=o[h][1]-o[p][1];if(d*d+v*v>=m*m+g*g){a[c].index=-1}else{a[y].index=-1;w=a[c].angle;y=c;b=h}}else{w=a[c].angle;y=c;b=h}}f.push(p);for(c=0,h=0;c<2;++h){if(a[h].index!==-1){f.push(a[h].index);c++}}E=f.length;for(;h<u;++h){if(a[h].index===-1)continue;while(!Oi(f[E-2],f[E-1],a[h].index,o)){--E}f[E++]=a[h].index}var S=[];for(c=0;c<E;++c){S.push(e[f[c]])}return S}var t=si,n=oi;if(arguments.length)return r(e);r.x=function(e){return arguments.length?(t=e,r):t};r.y=function(e){return arguments.length?(n=e,r):n};return r};e.geom.polygon=function(e){e.area=function(){var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];while(++t<n){r+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1]}return r*.5};e.centroid=function(t){var n=-1,r=e.length,i=0,s=0,o,u=e[r-1],a;if(!arguments.length)t=-1/(6*e.area());while(++n<r){o=u;u=e[n];a=o[0]*u[1]-u[0]*o[1];i+=(o[0]+u[0])*a;s+=(o[1]+u[1])*a}return[i*t,s*t]};e.clip=function(t){var n,r=-1,i=e.length,s,o,u=e[i-1],a,f,l;while(++r<i){n=t.slice();t.length=0;a=e[r];f=n[(o=n.length)-1];s=-1;while(++s<o){l=n[s];if(Mi(l,u,a)){if(!Mi(f,u,a)){t.push(_i(f,l,u,a))}t.push(l)}else if(Mi(f,u,a)){t.push(_i(f,l,u,a))}f=l}u=a}return t};return e};e.geom.delaunay=function(e){var t=e.map(function(){return[]}),n=[];Pi(e,function(n){t[n.region.l.index].push(e[n.region.r.index])});t.forEach(function(t,r){var i=e[r],s=i[0],o=i[1];t.forEach(function(e){e.angle=Math.atan2(e[0]-s,e[1]-o)});t.sort(function(e,t){return e.angle-t.angle});for(var u=0,a=t.length-1;u<a;u++){n.push([i,t[u],t[u+1]])}});return n};e.geom.voronoi=function(t){function o(t){var n,o=t.map(function(){return[]}),u=Qt(r),a=Qt(i),f,l,c=t.length,h=1e6;if(u===si&&a===oi)n=t;else for(n=[],l=0;l<c;++l){n.push([+u.call(this,f=t[l],l),+a.call(this,f,l)])}Pi(n,function(e){var t,n,r,i,s,u;if(e.a===1&&e.b>=0){t=e.ep.r;n=e.ep.l}else{t=e.ep.l;n=e.ep.r}if(e.a===1){s=t?t.y:-h;r=e.c-e.b*s;u=n?n.y:h;i=e.c-e.b*u}else{r=t?t.x:-h;s=e.c-e.a*r;i=n?n.x:h;u=e.c-e.a*i}var a=[r,s],f=[i,u];o[e.region.l.index].push(a,f);o[e.region.r.index].push(a,f)});o=o.map(function(t,r){var i=n[r][0],s=n[r][1],o=t.map(function(e){return Math.atan2(e[0]-i,e[1]-s)}),u=e.range(t.length).sort(function(e,t){return o[e]-o[t]});return u.filter(function(e,t){return!t||o[e]-o[u[t-1]]>vt}).map(function(e){return t[e]})});o.forEach(function(e,t){var r=e.length;if(!r)return e.push([-h,-h],[-h,h],[h,h],[h,-h]);if(r>2)return;var i=n[t],s=e[0],o=e[1],u=i[0],a=i[1],f=s[0],l=s[1],c=o[0],p=o[1],d=Math.abs(c-f),v=p-l;if(Math.abs(v)<vt){var m=a<l?-h:h;e.push([-h,m],[h,m])}else if(d<vt){var g=u<f?-h:h;e.push([g,-h],[g,h])}else{var m=(c-f)*(l-a)<(f-u)*(p-l)?h:-h,y=Math.abs(v)-d;if(Math.abs(y)<vt){e.push([v<0?m:-m,m])}else{if(y>0)m*=-1;e.push([-h,m],[h,m])}}});if(s)for(l=0;l<c;++l)s(o[l]);for(l=0;l<c;++l)o[l].point=t[l];return o}var n=null,r=si,i=oi,s;if(arguments.length)return o(t);o.x=function(e){return arguments.length?(r=e,o):r};o.y=function(e){return arguments.length?(i=e,o):i};o.size=function(t){if(!arguments.length)return n;if(t==null){s=null}else{n=[+t[0],+t[1]];s=e.geom.polygon([[0,0],[0,n[1]],n,[n[0],0]]).clip}return o};o.links=function(e){var t,n=e.map(function(){return[]}),s=[],o=Qt(r),u=Qt(i),a,f,l=e.length;if(o===si&&u===oi)t=e;else for(f=0;f<l;++f){t.push([+o.call(this,a=e[f],f),+u.call(this,a,f)])}Pi(t,function(t){var r=t.region.l.index,i=t.region.r.index;if(n[r][i])return;n[r][i]=n[i][r]=true;s.push({source:e[r],target:e[i]})});return s};o.triangles=function(t){if(r===si&&i===oi)return e.geom.delaunay(t);var n,s,o=Qt(r),u=Qt(i),a,f,l;for(f=0,n=[],l=t.length;f<l;++f){s=[+o.call(this,a=t[f],f),+u.call(this,a,f)];s.data=a;n.push(s)}return e.geom.delaunay(n).map(function(e){return e.map(function(e){return e.data})})};return o};var Di={l:"r",r:"l"};e.geom.quadtree=function(e,t,n,r,i){function a(e){function x(e,t,n,r,i,s,o,u){if(isNaN(n)||isNaN(r))return;if(e.leaf){var a=e.x,f=e.y;if(a!=null){if(Math.abs(a-n)+Math.abs(f-r)<.01){T(e,t,n,r,i,s,o,u)}else{var l=e.point;e.x=e.y=e.point=null;T(e,l,a,f,i,s,o,u);T(e,t,n,r,i,s,o,u)}}else{e.x=n,e.y=r,e.point=t}}else{T(e,t,n,r,i,s,o,u)}}function T(e,t,n,r,i,s,o,u){var a=(i+o)*.5,f=(s+u)*.5,l=n>=a,c=r>=f,h=(c<<1)+l;e.leaf=false;e=e.nodes[h]||(e.nodes[h]=ji());if(l)i=a;else o=a;if(c)s=f;else u=f;x(e,t,n,r,i,s,o,u)}var a,f=Qt(s),l=Qt(o),c,h,p,d,v,m,g,y;if(t!=null){v=t,m=n,g=r,y=i}else{g=y=-(v=m=Infinity);c=[],h=[];d=e.length;if(u)for(p=0;p<d;++p){a=e[p];if(a.x<v)v=a.x;if(a.y<m)m=a.y;if(a.x>g)g=a.x;if(a.y>y)y=a.y;c.push(a.x);h.push(a.y)}else for(p=0;p<d;++p){var b=+f(a=e[p],p),w=+l(a,p);if(b<v)v=b;if(w<m)m=w;if(b>g)g=b;if(w>y)y=w;c.push(b);h.push(w)}}var E=g-v,S=y-m;if(E>S)y=m+E;else g=v+S;var N=ji();N.add=function(e){x(N,e,+f(e,++p),+l(e,p),v,m,g,y)};N.visit=function(e){Fi(e,N,v,m,g,y)};p=-1;if(t==null){while(++p<d){x(N,e[p],c[p],h[p],v,m,g,y)}--p}else e.forEach(N.add);c=h=e=a=null;return N}var s=si,o=oi,u;if(u=arguments.length){s=Hi;o=Bi;if(u===3){i=n;r=t;n=t=0}return a(e)}a.x=function(e){return arguments.length?(s=e,a):s};a.y=function(e){return arguments.length?(o=e,a):o};a.size=function(e){if(!arguments.length)return t==null?null:[r,i];if(e==null){t=n=r=i=null}else{t=n=0;r=+e[0],i=+e[1]}return a};return a};e.interpolateRgb=Ii;e.transform=function(n){var r=t.createElementNS(e.ns.prefix.svg,"g");return(e.transform=function(e){r.setAttribute("transform",e);var t=r.transform.baseVal.consolidate();return new qi(t?t.matrix:Wi)})(n)};qi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var Wi={a:1,b:0,c:0,d:1,e:0,f:0};e.interpolateNumber=Xi;e.interpolateTransform=Vi;e.interpolateObject=$i;e.interpolateString=Ji;var Ki=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;e.interpolate=Qi;e.interpolators=[function(e,t){var n=typeof t;return(n==="string"||n!==typeof e?Kt.has(t)||/^(#|rgb\(|hsl\()/.test(t)?Ii:Ji:t instanceof ft?Ii:n==="object"?Array.isArray(t)?Yi:$i:Xi)(e,t)}];e.interpolateArray=Yi;var Zi=function(){return Gt};var es=e.map({linear:Zi,poly:as,quad:function(){return ss},cubic:function(){return os},sin:function(){return fs},exp:function(){return ls},circle:function(){return cs},elastic:hs,back:ps,bounce:function(){return ds}});var ts=e.map({"in":Gt,out:rs,"in-out":is,"out-in":function(e){return is(rs(e))}});e.ease=function(e){var t=e.indexOf("-"),n=t>=0?e.substring(0,t):e,r=t>=0?e.substring(t+1):"in";n=es.get(n)||Zi;r=ts.get(r)||Gt;return ns(r(n.apply(null,Array.prototype.slice.call(arguments,1))))};e.interpolateHcl=vs;e.interpolateHsl=ms;e.interpolateLab=gs;e.interpolateRound=ys;e.layout={};e.layout.bundle=function(){return function(e){var t=[],n=-1,r=e.length;while(++n<r)t.push(Es(e[n]));return t}};e.layout.chord=function(){function l(){var t={},l=[],h=e.range(s),p=[],d,v,m,g,y;n=[];r=[];d=0,g=-1;while(++g<s){v=0,y=-1;while(++y<s){v+=i[g][y]}l.push(v);p.push(e.range(s));d+=v}if(u){h.sort(function(e,t){return u(l[e],l[t])})}if(a){p.forEach(function(e,t){e.sort(function(e,n){return a(i[t][e],i[t][n])})})}d=(2*dt-o*s)/d;v=0,g=-1;while(++g<s){m=v,y=-1;while(++y<s){var b=h[g],w=p[b][y],E=i[b][w],S=v,x=v+=E*d;t[b+"-"+w]={index:b,subindex:w,startAngle:S,endAngle:x,value:E}}r[b]={index:b,startAngle:m,endAngle:v,value:(v-m)/d};v+=o}g=-1;while(++g<s){y=g-1;while(++y<s){var T=t[g+"-"+y],N=t[y+"-"+g];if(T.value||N.value){n.push(T.value<N.value?{source:N,target:T}:{source:T,target:N})}}}if(f)c()}function c(){n.sort(function(e,t){return f((e.source.value+e.target.value)/2,(t.source.value+t.target.value)/2)})}var t={},n,r,i,s,o=0,u,a,f;t.matrix=function(e){if(!arguments.length)return i;s=(i=e)&&i.length;n=r=null;return t};t.padding=function(e){if(!arguments.length)return o;o=e;n=r=null;return t};t.sortGroups=function(e){if(!arguments.length)return u;u=e;n=r=null;return t};t.sortSubgroups=function(e){if(!arguments.length)return a;a=e;n=null;return t};t.sortChords=function(e){if(!arguments.length)return f;f=e;if(n)c();return t};t.chords=function(){if(!n)l();return n};t.groups=function(){if(!r)l();return r};return t};e.layout.force=function(){function g(e){return function(t,n,r,i){if(t.point!==e){var s=t.cx-e.x,o=t.cy-e.y,u=1/Math.sqrt(s*s+o*o);if((i-n)*u<c){var a=t.charge*u*u;e.px-=s*a;e.py-=o*a;return true}if(t.point&&isFinite(u)){var a=t.pointCharge*u*u;e.px-=s*a;e.py-=o*a}}return!t.charge}}function y(n){n.px=e.event.x,n.py=e.event.y;t.resume()}var t={},n=e.dispatch("start","tick","end"),r=[1,1],i,s,o=.9,u=As,a=Os,f=-30,l=.1,c=.8,h=[],p=[],d,v,m;t.tick=function(){if((s*=.99)<.005){n.end({type:"end",alpha:s=0});return true}var t=h.length,i=p.length,u,a,c,y,b,w,E,S,x;for(a=0;a<i;++a){c=p[a];y=c.source;b=c.target;S=b.x-y.x;x=b.y-y.y;if(w=S*S+x*x){w=s*v[a]*((w=Math.sqrt(w))-d[a])/w;S*=w;x*=w;b.x-=S*(E=y.weight/(b.weight+y.weight));b.y-=x*E;y.x+=S*(E=1-E);y.y+=x*E}}if(E=s*l){S=r[0]/2;x=r[1]/2;a=-1;if(E)while(++a<t){c=h[a];c.x+=(S-c.x)*E;c.y+=(x-c.y)*E}}if(f){Ls(u=e.geom.quadtree(h),s,m);a=-1;while(++a<t){if(!(c=h[a]).fixed){u.visit(g(c))}}}a=-1;while(++a<t){c=h[a];if(c.fixed){c.x=c.px;c.y=c.py}else{c.x-=(c.px-(c.px=c.x))*o;c.y-=(c.py-(c.py=c.y))*o}}n.tick({type:"tick",alpha:s})};t.nodes=function(e){if(!arguments.length)return h;h=e;return t};t.links=function(e){if(!arguments.length)return p;p=e;return t};t.size=function(e){if(!arguments.length)return r;r=e;return t};t.linkDistance=function(e){if(!arguments.length)return u;u=typeof e==="function"?e:+e;return t};t.distance=t.linkDistance;t.linkStrength=function(e){if(!arguments.length)return a;a=typeof e==="function"?e:+e;return t};t.friction=function(e){if(!arguments.length)return o;o=+e;return t};t.charge=function(e){if(!arguments.length)return f;f=typeof e==="function"?e:+e;return t};t.gravity=function(e){if(!arguments.length)return l;l=+e;return t};t.theta=function(e){if(!arguments.length)return c;c=+e;return t};t.alpha=function(r){if(!arguments.length)return s;r=+r;if(s){if(r>0)s=r;else s=0}else if(r>0){n.start({type:"start",alpha:s=r});e.timer(t.tick)}return t};t.start=function(){function y(t,n){var r=b(e),i=-1,s=r.length,o;while(++i<s)if(!isNaN(o=r[i][t]))return o;return Math.random()*n}function b(){if(!c){c=[];for(n=0;n<i;++n){c[n]=[]}for(n=0;n<s;++n){var t=p[n];c[t.source.index].push(t.target);c[t.target.index].push(t.source)}}return c[e]}var e,n,i=h.length,s=p.length,o=r[0],l=r[1],c,g;for(e=0;e<i;++e){(g=h[e]).index=e;g.weight=0}for(e=0;e<s;++e){g=p[e];if(typeof g.source=="number")g.source=h[g.source];if(typeof g.target=="number")g.target=h[g.target];++g.source.weight;++g.target.weight}for(e=0;e<i;++e){g=h[e];if(isNaN(g.x))g.x=y("x",o);if(isNaN(g.y))g.y=y("y",l);if(isNaN(g.px))g.px=g.x;if(isNaN(g.py))g.py=g.y}d=[];if(typeof u==="function")for(e=0;e<s;++e)d[e]=+u.call(this,p[e],e);else for(e=0;e<s;++e)d[e]=u;v=[];if(typeof a==="function")for(e=0;e<s;++e)v[e]=+a.call(this,p[e],e);else for(e=0;e<s;++e)v[e]=a;m=[];if(typeof f==="function")for(e=0;e<i;++e)m[e]=+f.call(this,h[e],e);else for(e=0;e<i;++e)m[e]=f;return t.resume()};t.resume=function(){return t.alpha(.1)};t.stop=function(){return t.alpha(0)};t.drag=function(){if(!i)i=e.behavior.drag().origin(Gt).on("dragstart.force",Ts).on("drag.force",y).on("dragend.force",Ns);if(!arguments.length)return i;this.on("mouseover.force",Cs).on("mouseout.force",ks).call(i)};return e.rebind(t,n,"on")};var As=20,Os=1;e.layout.hierarchy=function(){function r(i,o,u){var a=t.call(s,i,o);i.depth=o;u.push(i);if(a&&(l=a.length)){var f=-1,l,c=i.children=[],h=0,p=o+1,d;while(++f<l){d=r(a[f],p,u);d.parent=i;c.push(d);h+=d.value}if(e)c.sort(e);if(n)i.value=h}else if(n){i.value=+n.call(s,i,o)||0}return i}function i(e,t){var r=e.children,o=0;if(r&&(a=r.length)){var u=-1,a,f=t+1;while(++u<a)o+=i(r[u],f)}else if(n){o=+n.call(s,e,t)||0}if(n)e.value=o;return o}function s(e){var t=[];r(e,0,t);return t}var e=Ps,t=_s,n=Ds;s.sort=function(t){if(!arguments.length)return e;e=t;return s};s.children=function(e){if(!arguments.length)return t;t=e;return s};s.value=function(e){if(!arguments.length)return n;n=e;return s};s.revalue=function(e){i(e,0);return e};return s};e.layout.partition=function(){function r(e,t,n,i){var s=e.children;e.x=t;e.y=e.depth*i;e.dx=n;e.dy=i;if(s&&(u=s.length)){var o=-1,u,a,f;n=e.value?n/e.value:0;while(++o<u){r(a=s[o],t,f=a.value*n,i);t+=f}}}function i(e){var t=e.children,n=0;if(t&&(s=t.length)){var r=-1,s;while(++r<s)n=Math.max(n,i(t[r]))}return 1+n}function s(e,s){var o=t.call(this,e,s);r(o[0],0,n[0],n[1]/i(o[0]));return o}var t=e.layout.hierarchy(),n=[1,1];s.size=function(e){if(!arguments.length)return n;n=e;return s};return Ms(s,t)};e.layout.pie=function(){function s(o){var u=o.map(function(e,n){return+t.call(s,e,n)});var a=+(typeof r==="function"?r.apply(this,arguments):r);var f=((typeof i==="function"?i.apply(this,arguments):i)-a)/e.sum(u);var l=e.range(o.length);if(n!=null)l.sort(n===Bs?function(e,t){return u[t]-u[e]}:function(e,t){return n(o[e],o[t])});var c=[];l.forEach(function(e){var t;c[e]={data:o[e],value:t=u[e],startAngle:a,endAngle:a+=t*f}});return c}var t=Number,n=Bs,r=0,i=2*dt;s.value=function(e){if(!arguments.length)return t;t=e;return s};s.sort=function(e){if(!arguments.length)return n;n=e;return s};s.startAngle=function(e){if(!arguments.length)return r;r=e;return s};s.endAngle=function(e){if(!arguments.length)return i;i=e;return s};return s};var Bs={};e.layout.stack=function(){function u(a,f){var l=a.map(function(e,n){return t.call(u,e,n)});var c=l.map(function(e){return e.map(function(e,t){return[s.call(u,e,t),o.call(u,e,t)]})});var h=n.call(u,c,f);l=e.permute(l,h);c=e.permute(c,h);var p=r.call(u,c,f);var d=l.length,v=l[0].length,m,g,y;for(g=0;g<v;++g){i.call(u,l[0][g],y=p[g],c[0][g][1]);for(m=1;m<d;++m){i.call(u,l[m][g],y+=c[m-1][g][1],c[m][g][1])}}return a}var t=Gt,n=Us,r=zs,i=Is,s=js,o=Fs;u.values=function(e){if(!arguments.length)return t;t=e;return u};u.order=function(e){if(!arguments.length)return n;n=typeof e==="function"?e:qs.get(e)||Us;return u};u.offset=function(e){if(!arguments.length)return r;r=typeof e==="function"?e:Rs.get(e)||zs;return u};u.x=function(e){if(!arguments.length)return s;s=e;return u};u.y=function(e){if(!arguments.length)return o;o=e;return u};u.out=function(e){if(!arguments.length)return i;i=e;return u};return u};var qs=e.map({"inside-out":function(t){var n=t.length,r,i,s=t.map(Ws),o=t.map(Xs),u=e.range(n).sort(function(e,t){return s[e]-s[t]}),a=0,f=0,l=[],c=[];for(r=0;r<n;++r){i=u[r];if(a<f){a+=o[i];l.push(i)}else{f+=o[i];c.push(i)}}return c.reverse().concat(l)},reverse:function(t){return e.range(t.length).reverse()},"default":Us});var Rs=e.map({silhouette:function(e){var t=e.length,n=e[0].length,r=[],i=0,s,o,u,a=[];for(o=0;o<n;++o){for(s=0,u=0;s<t;s++)u+=e[s][o][1];if(u>i)i=u;r.push(u)}for(o=0;o<n;++o){a[o]=(i-r[o])/2}return a},wiggle:function(e){var t=e.length,n=e[0],r=n.length,i,s,o,u,a,f,l,c,h,p=[];p[0]=c=h=0;for(s=1;s<r;++s){for(i=0,u=0;i<t;++i)u+=e[i][s][1];for(i=0,a=0,l=n[s][0]-n[s-1][0];i<t;++i){for(o=0,f=(e[i][s][1]-e[i][s-1][1])/(2*l);o<i;++o){f+=(e[o][s][1]-e[o][s-1][1])/l}a+=f*e[i][s][1]}p[s]=c-=u?a/u*l:0;if(c<h)h=c}for(s=0;s<r;++s)p[s]-=h;return p},expand:function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,u=[];for(s=0;s<n;++s){for(i=0,o=0;i<t;i++)o+=e[i][s][1];if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)u[s]=0;return u},zero:zs});e.layout.histogram=function(){function s(s,o){var u=[],a=s.map(n,this),f=r.call(this,a,o),l=i.call(this,f,a,o),c,o=-1,h=a.length,p=l.length-1,d=t?1:1/h,v;while(++o<p){c=u[o]=[];c.dx=l[o+1]-(c.x=l[o]);c.y=0}if(p>0){o=-1;while(++o<h){v=a[o];if(v>=f[0]&&v<=f[1]){c=u[e.bisect(l,v,1,p)-1];c.y+=d;c.push(s[o])}}}return u}var t=true,n=Number,r=Ks,i=$s;s.value=function(e){if(!arguments.length)return n;n=e;return s};s.range=function(e){if(!arguments.length)return r;r=Qt(e);return s};s.bins=function(e){if(!arguments.length)return i;i=typeof e==="number"?function(t){return Js(t,e)}:Qt(e);return s};s.frequency=function(e){if(!arguments.length)return t;t=!!e;return s};return s};e.layout.tree=function(){function i(e,i){function u(e,t){var r=e.children,i=e._tree;if(r&&(s=r.length)){var s,o=r[0],a,l=o,c,h=-1;while(++h<s){c=r[h];u(c,a);l=f(c,a,l);a=c}io(e);var p=.5*(o._tree.prelim+c._tree.prelim);if(t){i.prelim=t._tree.prelim+n(e,t);i.mod=i.prelim-p}else{i.prelim=p}}else{if(t){i.prelim=t._tree.prelim+n(e,t)}}}function a(e,t){e.x=e._tree.prelim+t;var n=e.children;if(n&&(i=n.length)){var r=-1,i;t+=e._tree.mod;while(++r<i){a(n[r],t)}}}function f(e,t,r){if(t){var i=e,s=e,o=t,u=e.parent.children[0],a=i._tree.mod,f=s._tree.mod,l=o._tree.mod,c=u._tree.mod,h;while(o=Ys(o),i=Gs(i),o&&i){u=Gs(u);s=Ys(s);s._tree.ancestor=e;h=o._tree.prelim+l-i._tree.prelim-a+n(o,i);if(h>0){so(oo(o,e,r),e,h);a+=h;f+=h}l+=o._tree.mod;a+=i._tree.mod;c+=u._tree.mod;f+=s._tree.mod}if(o&&!Ys(s)){s._tree.thread=o;s._tree.mod+=l-f}if(i&&!Gs(u)){u._tree.thread=i;u._tree.mod+=a-c;r=e}}return r}var s=t.call(this,e,i),o=s[0];ro(o,function(e,t){e._tree={ancestor:e,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}});u(o);a(o,-o._tree.prelim);var l=Zs(o,to),c=Zs(o,eo),h=Zs(o,no),p=l.x-n(l,c)/2,d=c.x+n(c,l)/2,v=h.depth||1;ro(o,function(e){e.x=(e.x-p)/(d-p)*r[0];e.y=e.depth/v*r[1];delete e._tree});return s}var t=e.layout.hierarchy().sort(null).value(null),n=Qs,r=[1,1];i.separation=function(e){if(!arguments.length)return n;n=e;return i};i.size=function(e){if(!arguments.length)return r;r=e;return i};return Ms(i,t)};e.layout.pack=function(){function i(e,i){var s=t.call(this,e,i),o=s[0];o.x=0;o.y=0;ro(o,function(e){e.r=Math.sqrt(e.value)});ro(o,co);var u=r[0],a=r[1],f=Math.max(2*o.r/u,2*o.r/a);if(n>0){var l=n*f/2;ro(o,function(e){e.r+=l});ro(o,co);ro(o,function(e){e.r-=l});f=Math.max(2*o.r/u,2*o.r/a)}vo(o,u/2,a/2,1/f);return s}var t=e.layout.hierarchy().sort(uo),n=0,r=[1,1];i.size=function(e){if(!arguments.length)return r;r=e;return i};i.padding=function(e){if(!arguments.length)return n;n=+e;return i};return Ms(i,t)};e.layout.cluster=function(){function i(e,i){var s=t.call(this,e,i),o=s[0],u,a=0;ro(o,function(e){var t=e.children;if(t&&t.length){e.x=yo(t);e.y=go(t)}else{e.x=u?a+=n(e,u):0;e.y=0;u=e}});var f=bo(o),l=wo(o),c=f.x-n(f,l)/2,h=l.x+n(l,f)/2;ro(o,function(e){e.x=(e.x-c)/(h-c)*r[0];e.y=(1-(o.y?e.y/o.y:1))*r[1]});return s}var t=e.layout.hierarchy().sort(null).value(null),n=Qs,r=[1,1];i.separation=function(e){if(!arguments.length)return n;n=e;return i};i.size=function(e){if(!arguments.length)return r;r=e;return i};return Ms(i,t)};e.layout.treemap=function(){function l(e,t){var n=-1,r=e.length,i,s;while(++n<r){s=(i=e[n]).value*(t<0?0:t);i.area=isNaN(s)||s<=0?0:s}}function c(e){var t=e.children;if(t&&t.length){var n=s(e),r=[],i=t.slice(),o,u=Infinity,f,h=a==="slice"?n.dx:a==="dice"?n.dy:a==="slice-dice"?e.depth&1?n.dy:n.dx:Math.min(n.dx,n.dy),v;l(i,n.dx*n.dy/e.value);r.area=0;while((v=i.length)>0){r.push(o=i[v-1]);r.area+=o.area;if(a!=="squarify"||(f=p(r,h))<=u){i.pop();u=f}else{r.area-=r.pop().area;d(r,h,n,false);h=Math.min(n.dx,n.dy);r.length=r.area=0;u=Infinity}}if(r.length){d(r,h,n,true);r.length=r.area=0}t.forEach(c)}}function h(e){var t=e.children;if(t&&t.length){var n=s(e),r=t.slice(),i,o=[];l(r,n.dx*n.dy/e.value);o.area=0;while(i=r.pop()){o.push(i);o.area+=i.area;if(i.z!=null){d(o,i.z?n.dx:n.dy,n,!r.length);o.length=o.area=0}}t.forEach(h)}}function p(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++o<u){if(!(r=e[o].area))continue;if(r<s)s=r;if(r>i)i=r}n*=n;t*=t;return n?Math.max(t*i*f/n,n/(t*s*f)):Infinity}function d(e,t,r,i){var s=-1,o=e.length,u=r.x,a=r.y,f=t?n(e.area/t):0,l;if(t==r.dx){if(i||f>r.dy)f=r.dy;while(++s<o){l=e[s];l.x=u;l.y=a;l.dy=f;u+=l.dx=Math.min(r.x+r.dx-u,f?n(l.area/f):0)}l.z=true;l.dx+=r.x+r.dx-u;r.y+=f;r.dy-=f}else{if(i||f>r.dx)f=r.dx;while(++s<o){l=e[s];l.x=u;l.y=a;l.dx=f;a+=l.dy=Math.min(r.y+r.dy-a,f?n(l.area/f):0)}l.z=false;l.dy+=r.y+r.dy-a;r.x+=f;r.dx-=f}}function v(e){var n=u||t(e),i=n[0];i.x=0;i.y=0;i.dx=r[0];i.dy=r[1];if(u)t.revalue(i);l([i],i.dx*i.dy/i.value);(u?h:c)(i);if(o)u=n;return n}var t=e.layout.hierarchy(),n=Math.round,r=[1,1],i=null,s=Eo,o=false,u,a="squarify",f=.5*(1+Math.sqrt(5));v.size=function(e){if(!arguments.length)return r;r=e;return v};v.padding=function(e){function t(t){var n=e.call(v,t,t.depth);return n==null?Eo(t):So(t,typeof n==="number"?[n,n,n,n]:n)}function n(t){return So(t,e)}if(!arguments.length)return i;var r;s=(i=e)==null?Eo:(r=typeof e)==="function"?t:r==="number"?(e=[e,e,e,e],n):n;return v};v.round=function(e){if(!arguments.length)return n!=Number;n=e?Math.round:Number;return v};v.sticky=function(e){if(!arguments.length)return o;o=e;u=null;return v};v.ratio=function(e){if(!arguments.length)return f;f=e;return v};v.mode=function(e){if(!arguments.length)return a;a=e+"";return v};return Ms(v,t)};e.random={normal:function(e,t){var n=arguments.length;if(n<2)t=1;if(n<1)e=0;return function(){var n,r,i;do{n=Math.random()*2-1;r=Math.random()*2-1;i=n*n+r*r}while(!i||i>1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},irwinHall:function(e){return function(){for(var t=0,n=0;n<e;n++)t+=Math.random();return t/e}}};e.scale={};e.scale.linear=function(){return Lo([0,1],[0,1],Qi,false)};e.scale.log=function(){return Po(e.scale.linear().domain([0,Math.LN10]),10,Bo,jo)};var Ho=e.format(".0e");e.scale.pow=function(){return Ro(e.scale.linear(),1)};e.scale.sqrt=function(){return e.scale.pow().exponent(.5)};e.scale.ordinal=function(){return zo([],{t:"range",a:[[]]})};e.scale.category10=function(){return e.scale.ordinal().range(Wo)};e.scale.category20=function(){return e.scale.ordinal().range(Xo)};e.scale.category20b=function(){return e.scale.ordinal().range(Vo)};e.scale.category20c=function(){return e.scale.ordinal().range($o)};e.scale.category50=function(){return e.scale.ordinal().range(Jo)};var Wo=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var Xo=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];var Vo=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"];var $o=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];var Jo=["#1f77b4","#ff7f0e","#2ca02c","#8c864b","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf","#DC143C","#800080","#0000FF","#008000","#D2691E","#FF0000","#000000","#DB7093","#FF00FF","#7B68EE","#1f77b6","#9edae5","#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#aec7e8","#e7ba52","#ffbb78","#e7cb94","#98df8a","#843c39","#ff9896","#ad494a","#c5b0d5","#d6616b","#c49c94","#e7969c","#f7b6d2","#fd8d3c","#c7c7c7","#7b4173","#dbdb8d","#a55194"];e.scale.quantile=function(){return Ko([],[])};e.scale.quantize=function(){return Qo(0,1,[0,1])};e.scale.threshold=function(){return Go([.5],[0,1])};e.scale.identity=function(){return Yo([0,1])};e.svg.arc=function(){function i(){var i=e.apply(this,arguments),s=t.apply(this,arguments),o=n.apply(this,arguments)+Zo,u=r.apply(this,arguments)+Zo,a=(u<o&&(a=o,o=u,u=a),u-o),f=a<dt?"0":"1",l=Math.cos(o),c=Math.sin(o),h=Math.cos(u),p=Math.sin(u);return a>=eu?i?"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"M0,"+i+"A"+i+","+i+" 0 1,0 0,"+ -i+"A"+i+","+i+" 0 1,0 0,"+i+"Z":"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"Z":i?"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L"+i*h+","+i*p+"A"+i+","+i+" 0 "+f+",0 "+i*l+","+i*c+"Z":"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L0,0"+"Z"}var e=tu,t=nu,n=ru,r=iu;i.innerRadius=function(t){if(!arguments.length)return e;e=Qt(t);return i};i.outerRadius=function(e){if(!arguments.length)return t;t=Qt(e);return i};i.startAngle=function(e){if(!arguments.length)return n;n=Qt(e);return i};i.endAngle=function(e){if(!arguments.length)return r;r=Qt(e);return i};i.centroid=function(){var i=(e.apply(this,arguments)+t.apply(this,arguments))/2,s=(n.apply(this,arguments)+r.apply(this,arguments))/2+Zo;return[Math.cos(s)*i,Math.sin(s)*i]};return i};var Zo=-dt/2,eu=2*dt-1e-6;e.svg.line.radial=function(){var e=ii(su);e.radius=e.x,delete e.x;e.angle=e.y,delete e.y;return e};li.reverse=ci;ci.reverse=li;e.svg.area=function(){return ou(Gt)};e.svg.area.radial=function(){var e=ou(su);e.radius=e.x,delete e.x;e.innerRadius=e.x0,delete e.x0;e.outerRadius=e.x1,delete e.x1;e.angle=e.y,delete e.y;e.startAngle=e.y0,delete e.y0;e.endAngle=e.y1,delete e.y1;return e};e.svg.chord=function(){function s(n,r){var i=o(this,e,n,r),s=o(this,t,n,r);return"M"+i.p0+a(i.r,i.p1,i.a1-i.a0)+(u(i,s)?f(i.r,i.p1,i.r,i.p0):f(i.r,i.p1,s.r,s.p0)+a(s.r,s.p1,s.a1-s.a0)+f(s.r,s.p1,i.r,i.p0))+"Z"}function o(e,t,s,o){var u=t.call(e,s,o),a=n.call(e,u,o),f=r.call(e,u,o)+Zo,l=i.call(e,u,o)+Zo;return{r:a,a0:f,a1:l,p0:[a*Math.cos(f),a*Math.sin(f)],p1:[a*Math.cos(l),a*Math.sin(l)]}}function u(e,t){return e.a0==t.a0&&e.a1==t.a1}function a(e,t,n){return"A"+e+","+e+" 0 "+ +(n>dt)+",1 "+t}function f(e,t,n,r){return"Q 0,0 "+r}var e=Nr,t=Cr,n=uu,r=ru,i=iu;s.radius=function(e){if(!arguments.length)return n;n=Qt(e);return s};s.source=function(t){if(!arguments.length)return e;e=Qt(t);return s};s.target=function(e){if(!arguments.length)return t;t=Qt(e);return s};s.startAngle=function(e){if(!arguments.length)return r;r=Qt(e);return s};s.endAngle=function(e){if(!arguments.length)return i;i=Qt(e);return s};return s};e.svg.diagonal=function(){function r(r,i){var s=e.call(this,r,i),o=t.call(this,r,i),u=(s.y+o.y)/2,a=[s,{x:s.x,y:u},{x:o.x,y:u},o];a=a.map(n);return"M"+a[0]+"C"+a[1]+" "+a[2]+" "+a[3]}var e=Nr,t=Cr,n=au;r.source=function(t){if(!arguments.length)return e;e=Qt(t);return r};r.target=function(e){if(!arguments.length)return t;t=Qt(e);return r};r.projection=function(e){if(!arguments.length)return n;n=e;return r};return r};e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),n=au,r=t.projection;t.projection=function(e){return arguments.length?r(fu(n=e)):n};return t};e.svg.symbol=function(){function n(n,r){return(pu.get(e.call(this,n,r))||hu)(t.call(this,n,r))}var e=cu,t=lu;n.type=function(t){if(!arguments.length)return e;e=Qt(t);return n};n.size=function(e){if(!arguments.length)return t;t=Qt(e);return n};return n};var pu=e.map({circle:hu,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+ -3*t+","+ -t+"H"+ -t+"V"+ -3*t+"H"+t+"V"+ -t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+ -t+"V"+t+"H"+ -3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vu)),n=t*vu;return"M0,"+ -t+"L"+n+",0"+" 0,"+t+" "+ -n+",0"+"Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+ -t+","+ -t+"L"+t+","+ -t+" "+t+","+t+" "+ -t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/du),n=t*du/2;return"M0,"+n+"L"+t+","+ -n+" "+ -t+","+ -n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/du),n=t*du/2;return"M0,"+ -n+"L"+t+","+n+" "+ -t+","+n+"Z"}});e.svg.symbolTypes=pu.keys();var du=Math.sqrt(3),vu=Math.tan(30*mt);var gu=[],yu=0,bu,wu={ease:us,delay:0,duration:250};gu.call=B.call;gu.empty=B.empty;gu.node=B.node;e.transition=function(e){return arguments.length?bu?e.transition():e:st.transition()};e.transition.prototype=gu;gu.select=function(e){var t=this.id,n=[],r,i,s;if(typeof e!=="function")e=j(e);for(var o=-1,u=this.length;++o<u;){n.push(r=[]);for(var a=this[o],f=-1,l=a.length;++f<l;){if((s=a[f])&&(i=e.call(s,s.__data__,f))){if("__data__"in s)i.__data__=s.__data__;xu(i,f,t,s.__transition__[t]);r.push(i)}else{r.push(null)}}}return mu(n,t)};gu.selectAll=function(e){var t=this.id,n=[],r,i,s,o,u;if(typeof e!=="function")e=F(e);for(var a=-1,f=this.length;++a<f;){for(var l=this[a],c=-1,h=l.length;++c<h;){if(s=l[c]){u=s.__transition__[t];i=e.call(s,s.__data__,c);n.push(r=[]);for(var p=-1,d=i.length;++p<d;){xu(o=i[p],p,t,u);r.push(o)}}}}return mu(n,t)};gu.filter=function(e){var t=[],n,r,i;if(typeof e!=="function")e=K(e);for(var s=0,o=this.length;s<o;s++){t.push(n=[]);for(var r=this[s],u=0,a=r.length;u<a;u++){if((i=r[u])&&e.call(i,i.__data__,u)){n.push(i)}}}return mu(t,this.id,this.time).ease(this.ease())};gu.tween=function(e,t){var n=this.id;if(arguments.length<2)return this.node().__transition__[n].tween.get(e);return nt(this,t==null?function(t){t.__transition__[n].tween.remove(e)}:function(r){r.__transition__[n].tween.set(e,t)})};gu.attr=function(t,n){function s(){this.removeAttribute(i)}function o(){this.removeAttributeNS(i.space,i.local)}if(arguments.length<2){for(n in t)this.attr(n,t[n]);return this}var r=Gi(t),i=e.ns.qualify(t);return Eu(this,"attr."+t,n,function(e){function t(){var t=this.getAttribute(i),n;return t!==e&&(n=r(t,e),function(e){this.setAttribute(i,n(e))})}function n(){var t=this.getAttributeNS(i.space,i.local),n;return t!==e&&(n=r(t,e),function(e){this.setAttributeNS(i.space,i.local,n(e))})}return e==null?i.local?o:s:(e+="",i.local?n:t)})};gu.attrTween=function(t,n){function i(e,t){var i=n.call(this,e,t,this.getAttribute(r));return i&&function(e){this.setAttribute(r,i(e))}}function s(e,t){var i=n.call(this,e,t,this.getAttributeNS(r.space,r.local));return i&&function(e){this.setAttributeNS(r.space,r.local,i(e))}}var r=e.ns.qualify(t);return this.tween("attr."+t,r.local?s:i)};gu.style=function(e,t,r){function o(){this.style.removeProperty(e)}var i=arguments.length;if(i<3){if(typeof e!=="string"){if(i<2)t="";for(r in e)this.style(r,e[r],t);return this}r=""}var s=Gi(e);return Eu(this,"style."+e,t,function(t){function i(){var i=n.getComputedStyle(this,null).getPropertyValue(e),o;return i!==t&&(o=s(i,t),function(t){this.style.setProperty(e,o(t),r)})}return t==null?o:(t+="",i)})};gu.styleTween=function(e,t,r){if(arguments.length<3)r="";return this.tween("style."+e,function(i,s){var o=t.call(this,i,s,n.getComputedStyle(this,null).getPropertyValue(e));return o&&function(t){this.style.setProperty(e,o(t),r)}})};gu.text=function(e){return Eu(this,"text",e,Su)};gu.remove=function(){return this.each("end.transition",function(){var e;if(!this.__transition__&&(e=this.parentNode))e.removeChild(this)})};gu.ease=function(t){var n=this.id;if(arguments.length<1)return this.node().__transition__[n].ease;if(typeof t!=="function")t=e.ease.apply(e,arguments);return nt(this,function(e){e.__transition__[n].ease=t})};gu.delay=function(e){var t=this.id;return nt(this,typeof e==="function"?function(n,r,i){n.__transition__[t].delay=e.call(n,n.__data__,r,i)|0}:(e|=0,function(n){n.__transition__[t].delay=e}))};gu.duration=function(e){var t=this.id;return nt(this,typeof e==="function"?function(n,r,i){n.__transition__[t].duration=Math.max(1,e.call(n,n.__data__,r,i)|0)}:(e=Math.max(1,e|0),function(n){n.__transition__[t].duration=e}))};gu.each=function(e,t){var n=this.id;if(arguments.length<2){var r=wu,i=bu;bu=n;nt(this,function(t,r,i){wu=t.__transition__[n];e.call(t,t.__data__,r,i)});wu=r;bu=i}else{nt(this,function(r){r.__transition__[n].event.on(e,t)})}return this};gu.transition=function(){var e=this.id,t=++yu,n=[],r,i,s,o;for(var u=0,a=this.length;u<a;u++){n.push(r=[]);for(var i=this[u],f=0,l=i.length;f<l;f++){if(s=i[f]){o=Object.create(s.__transition__[e]);o.delay+=o.duration;xu(s,f,t,o)}r.push(s)}}return mu(n,t)};e.svg.axis=function(){function c(c){c.each(function(){var c=e.select(this);var h=a==null?t.ticks?t.ticks.apply(t,u):t.domain():a,p=f==null?t.tickFormat?t.tickFormat.apply(t,u):String:f;var d=Lu(t,h,l),v=c.selectAll(".tick.minor").data(d,String),m=v.enter().insert("line",".tick").attr("class","tick minor").style("opacity",1e-6),g=e.transition(v.exit()).style("opacity",1e-6).remove(),y=e.transition(v).style("opacity",1);var b=c.selectAll(".tick.major").data(h,String),w=b.enter().insert("g","path").attr("class","tick major").style("opacity",1e-6),E=e.transition(b.exit()).style("opacity",1e-6).remove(),S=e.transition(b).style("opacity",1),x;var T=To(t),N=c.selectAll(".domain").data([0]),C=(N.enter().append("path").attr("class","domain"),e.transition(N));var k=t.copy(),L=this.__chart__||k;this.__chart__=k;w.append("line");w.append("text");var A=w.select("line"),O=S.select("line"),M=b.select("text").text(p),_=w.select("text"),D=S.select("text");switch(n){case"bottom":{x=Cu;m.attr("y2",i);y.attr("x2",0).attr("y2",i);A.attr("y2",r);_.attr("y",Math.max(r,0)+o);O.attr("x2",0).attr("y2",r);D.attr("x",0).attr("y",Math.max(r,0)+o);M.attr("dy",".71em").style("text-anchor","middle");C.attr("d","M"+T[0]+","+s+"V0H"+T[1]+"V"+s);break};case"top":{x=Cu;m.attr("y2",-i);y.attr("x2",0).attr("y2",-i);A.attr("y2",-r);_.attr("y",-(Math.max(r,0)+o));O.attr("x2",0).attr("y2",-r);D.attr("x",0).attr("y",-(Math.max(r,0)+o));M.attr("dy","0em").style("text-anchor","middle");C.attr("d","M"+T[0]+","+ -s+"V0H"+T[1]+"V"+ -s);break};case"left":{x=ku;m.attr("x2",-i);y.attr("x2",-i).attr("y2",0);A.attr("x2",-r);_.attr("x",-(Math.max(r,0)+o));O.attr("x2",-r).attr("y2",0);D.attr("x",-(Math.max(r,0)+o)).attr("y",0);M.attr("dy",".32em").style("text-anchor","end");C.attr("d","M"+ -s+","+T[0]+"H0V"+T[1]+"H"+ -s);break};case"right":{x=ku;m.attr("x2",i);y.attr("x2",i).attr("y2",0);A.attr("x2",r);_.attr("x",Math.max(r,0)+o);O.attr("x2",r).attr("y2",0);D.attr("x",Math.max(r,0)+o).attr("y",0);M.attr("dy",".32em").style("text-anchor","start");C.attr("d","M"+s+","+T[0]+"H0V"+T[1]+"H"+s);break}}if(t.ticks){w.call(x,L);S.call(x,k);E.call(x,k);m.call(x,L);y.call(x,k);g.call(x,k)}else{var P=k.rangeBand()/2,H=function(e){return k(e)+P};w.call(x,H);S.call(x,H)}})}var t=e.scale.linear(),n=Tu,r=6,i=6,s=6,o=3,u=[10],a=null,f,l=0;c.scale=function(e){if(!arguments.length)return t;t=e;return c};c.orient=function(e){if(!arguments.length)return n;n=e in Nu?e+"":Tu;return c};c.ticks=function(){if(!arguments.length)return u;u=arguments;return c};c.tickValues=function(e){if(!arguments.length)return a;a=e;return c};c.tickFormat=function(e){if(!arguments.length)return f;f=e;return c};c.tickSize=function(e,t){if(!arguments.length)return r;var n=arguments.length-1;r=+e;i=n>1?+t:r;s=n>0?+arguments[n]:r;return c};c.tickPadding=function(e){if(!arguments.length)return o;o=+e;return c};c.tickSubdivide=function(e){if(!arguments.length)return l;l=+e;return c};return c};var Tu="bottom",Nu={top:1,right:1,bottom:1,left:1};e.svg.brush=function(){function a(t){t.each(function(){var t=e.select(this),n=t.selectAll(".background").data([0]),o=t.selectAll(".extent").data([0]),u=t.selectAll(".resize").data(s,String),p;t.style("pointer-events","all").on("mousedown.brush",h).on("touchstart.brush",h);n.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");o.enter().append("rect").attr("class","extent").style("cursor","move");u.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return Au[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");u.style("display",a.empty()?"none":null);u.exit().remove();if(r){p=To(r);n.attr("x",p[0]).attr("width",p[1]-p[0]);l(t)}if(i){p=To(i);n.attr("y",p[0]).attr("height",p[1]-p[0]);c(t)}f(t)})}function f(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+o[+/e$/.test(e)][0]+","+o[+/^s/.test(e)][1]+")"})}function l(e){e.select(".extent").attr("x",o[0][0]);e.selectAll(".extent,.n>rect,.s>rect").attr("width",o[1][0]-o[0][0])}function c(e){e.select(".extent").attr("y",o[0][1]);e.selectAll(".extent,.e>rect,.w>rect").attr("height",o[1][1]-o[0][1])}function h(){function C(){var t=e.event.changedTouches;return t?e.touches(s,t)[0]:e.mouse(s)}function k(){if(e.event.keyCode==32){if(!b){w=null;E[0]-=o[1][0];E[1]-=o[1][1];b=2}y()}}function L(){if(e.event.keyCode==32&&b==2){E[0]+=o[1][0];E[1]+=o[1][1];b=0;y()}}function A(){var t=C(),n=false;if(S){t[0]+=S[0];t[1]+=S[1]}if(!b){if(e.event.altKey){if(!w)w=[(o[0][0]+o[1][0])/2,(o[0][1]+o[1][1])/2];E[0]=o[+(t[0]<w[0])][0];E[1]=o[+(t[1]<w[1])][1]}else w=null}if(m&&O(t,r,0)){l(d);n=true}if(g&&O(t,i,1)){c(d);n=true}if(n){f(d);p({type:"brush",mode:b?"move":"resize"})}}function O(e,t,n){var r=To(t),i=r[0],s=r[1],a=E[n],f=o[1][n]-o[0][n],l,c;if(b){i-=a;s-=f+a}l=Math.max(i,Math.min(s,e[n]));if(b){c=(l+=a)+f}else{if(w)a=Math.max(i,Math.min(s,2*w[n]-l));if(a<l){c=l;l=a}else{c=a}}if(o[0][n]!==l||o[1][n]!==c){u=null;o[0][n]=l;o[1][n]=c;return true}}function M(){A();d.style("pointer-events","all").selectAll(".resize").style("display",a.empty()?"none":null);e.select("body").style("cursor",null);x.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null);p({type:"brushend"});y()}var s=this,h=e.select(e.event.target),p=t.of(s,arguments),d=e.select(s),v=h.datum(),m=!/^(n|s)$/.test(v)&&r,g=!/^(e|w)$/.test(v)&&i,b=h.classed("extent"),w,E=C(),S;var x=e.select(n).on("mousemove.brush",A).on("mouseup.brush",M).on("touchmove.brush",A).on("touchend.brush",M).on("keydown.brush",k).on("keyup.brush",L);if(b){E[0]=o[0][0]-E[0];E[1]=o[0][1]-E[1]}else if(v){var T=+/w$/.test(v),N=+/^n/.test(v);S=[o[1-T][0]-E[0],o[1-N][1]-E[1]];E[0]=o[T][0];E[1]=o[N][1]}else if(e.event.altKey)w=E.slice();d.style("pointer-events","none").selectAll(".resize").style("display",null);e.select("body").style("cursor",h.style("cursor"));p({type:"brushstart"});A();y()}var t=S(a,"brushstart","brush","brushend"),r=null,i=null,s=Ou[0],o=[[0,0],[0,0]],u;a.x=function(e){if(!arguments.length)return r;r=e;s=Ou[!r<<1|!i];return a};a.y=function(e){if(!arguments.length)return i;i=e;s=Ou[!r<<1|!i];return a};a.extent=function(e){var t,n,s,f,l;if(!arguments.length){e=u||o;if(r){t=e[0][0],n=e[1][0];if(!u){t=o[0][0],n=o[1][0];if(r.invert)t=r.invert(t),n=r.invert(n);if(n<t)l=t,t=n,n=l}}if(i){s=e[0][1],f=e[1][1];if(!u){s=o[0][1],f=o[1][1];if(i.invert)s=i.invert(s),f=i.invert(f);if(f<s)l=s,s=f,f=l}}return r&&i?[[t,s],[n,f]]:r?[t,n]:i&&[s,f]}u=[[0,0],[0,0]];if(r){t=e[0],n=e[1];if(i)t=t[0],n=n[0];u[0][0]=t,u[1][0]=n;if(r.invert)t=r(t),n=r(n);if(n<t)l=t,t=n,n=l;o[0][0]=t|0,o[1][0]=n|0}if(i){s=e[0],f=e[1];if(r)s=s[1],f=f[1];u[0][1]=s,u[1][1]=f;if(i.invert)s=i(s),f=i(f);if(f<s)l=s,s=f,f=l;o[0][1]=s|0,o[1][1]=f|0}return a};a.clear=function(){u=null;o[0][0]=o[0][1]=o[1][0]=o[1][1]=0;return a};a.empty=function(){return r&&o[0][0]===o[1][0]||i&&o[0][1]===o[1][1]};return e.rebind(a,t,"on")};var Au={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"};var Ou=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];e.time={};var Mu=Date,_u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Du.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Pu.setUTCDate.apply(this._,arguments)},setDay:function(){Pu.setUTCDay.apply(this._,arguments)},setFullYear:function(){Pu.setUTCFullYear.apply(this._,arguments)},setHours:function(){Pu.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Pu.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Pu.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Pu.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Pu.setUTCSeconds.apply(this._,arguments)},setTime:function(){Pu.setTime.apply(this._,arguments)}};var Pu=Date.prototype;var Hu="%a %b %e %X %Y",Bu="%m/%d/%Y",ju="%H:%M:%S";var Fu=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Iu=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],qu=["January","February","March","April","May","June","July","August","September","October","November","December"],Ru=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];e.time.year=Uu(function(t){t=e.time.day(t);t.setMonth(0,1);return t},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()});e.time.years=e.time.year.range;e.time.years.utc=e.time.year.utc.range;e.time.day=Uu(function(e){var t=new Mu(1970,0);t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate());return t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1});e.time.days=e.time.day.range;e.time.days.utc=e.time.day.utc.range;e.time.dayOfYear=function(t){var n=e.time.year(t);return Math.floor((t-n-(t.getTimezoneOffset()-n.getTimezoneOffset())*6e4)/864e5)};_u.forEach(function(t,n){t=t.toLowerCase();n=7-n;var r=e.time[t]=Uu(function(t){(t=e.time.day(t)).setDate(t.getDate()-(t.getDay()+n)%7);return t},function(e,t){e.setDate(e.getDate()+Math.floor(t)*7)},function(t){var r=e.time.year(t).getDay();return Math.floor((e.time.dayOfYear(t)+(r+n)%7)/7)-(r!==n)});e.time[t+"s"]=r.range;e.time[t+"s"].utc=r.utc.range;e.time[t+"OfYear"]=function(t){var r=e.time.year(t).getDay();return Math.floor((e.time.dayOfYear(t)+(r+n)%7)/7)}});e.time.week=e.time.sunday;e.time.weeks=e.time.sunday.range;e.time.weeks.utc=e.time.sunday.utc.range;e.time.weekOfYear=e.time.sundayOfYear;e.time.format=function(e){function n(n){var r=[],i=-1,s=0,o,u,a;while(++i<t){if(e.charCodeAt(i)===37){r.push(e.substring(s,i));if((u=ea[o=e.charAt(++i)])!=null)o=e.charAt(++i);if(a=ta[o])o=a(n,u==null?o==="e"?" ":"0":u);r.push(o);s=i+1}}r.push(e.substring(s,i));return r.join("")}var t=e.length;n.parse=function(t){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},r=Wu(n,e,t,0);if(r!=t.length)return null;if("p"in n)n.H=n.H%12+n.p*12;var i=new Mu;i.setFullYear(n.y,n.m,n.d);i.setHours(n.H,n.M,n.S,n.L);return i};n.toString=function(){return e};return n};var Ju=Xu(Fu),Ku=Xu(Iu),Qu=Xu(qu),Gu=Vu(qu),Yu=Xu(Ru),Zu=Vu(Ru);var ea={"-":"",_:" ",0:"0"};var ta={a:function(e){return Iu[e.getDay()]},A:function(e){return Fu[e.getDay()]},b:function(e){return Ru[e.getMonth()]},B:function(e){return qu[e.getMonth()]},c:e.time.format(Hu),d:function(e,t){return $u(e.getDate(),t,2)},e:function(e,t){return $u(e.getDate(),t,2)},H:function(e,t){return $u(e.getHours(),t,2)},I:function(e,t){return $u(e.getHours()%12||12,t,2)},j:function(t,n){return $u(1+e.time.dayOfYear(t),n,3)},L:function(e,t){return $u(e.getMilliseconds(),t,3)},m:function(e,t){return $u(e.getMonth()+1,t,2)},M:function(e,t){return $u(e.getMinutes(),t,2)},p:function(e){return e.getHours()>=12?"PM":"AM"},S:function(e,t){return $u(e.getSeconds(),t,2)},U:function(t,n){return $u(e.time.sundayOfYear(t),n,2)},w:function(e){return e.getDay()},W:function(t,n){return $u(e.time.mondayOfYear(t),n,2)},x:e.time.format(Bu),X:e.time.format(ju),y:function(e,t){return $u(e.getFullYear()%100,t,2)},Y:function(e,t){return $u(e.getFullYear()%1e4,t,4)},Z:Sa,"%":function(){return"%"}};var na={a:ra,A:ia,b:sa,B:oa,c:ua,d:da,e:da,H:va,I:va,L:ya,m:pa,M:ma,p:wa,S:ga,x:aa,X:fa,y:ca,Y:la};var ba=/^\s*\d+/;var Ea=e.map({am:0,pm:1});e.time.format.utc=function(t){function r(e){try{Mu=Du;var t=new Mu;t._=e;return n(t)}finally{Mu=Date}}var n=e.time.format(t);r.parse=function(e){try{Mu=Du;var t=n.parse(e);return t&&t._}finally{Mu=Date}};r.toString=n.toString;return r};var xa=e.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");e.time.format.iso=Date.prototype.toISOString&&+(new Date("2000-01-01T00:00:00.000Z"))?Ta:xa;Ta.parse=function(e){var t=new Date(e);return isNaN(t)?null:t};Ta.toString=xa.toString;e.time.second=Uu(function(e){return new Mu(Math.floor(e/1e3)*1e3)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*1e3)},function(e){return e.getSeconds()});e.time.seconds=e.time.second.range;e.time.seconds.utc=e.time.second.utc.range;e.time.minute=Uu(function(e){return new Mu(Math.floor(e/6e4)*6e4)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*6e4)},function(e){return e.getMinutes()});e.time.minutes=e.time.minute.range;e.time.minutes.utc=e.time.minute.utc.range;e.time.hour=Uu(function(e){var t=e.getTimezoneOffset()/60;return new Mu((Math.floor(e/36e5-t)+t)*36e5)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*36e5)},function(e){return e.getHours()});e.time.hours=e.time.hour.range;e.time.hours.utc=e.time.hour.utc.range;e.time.month=Uu(function(t){t=e.time.day(t);t.setDate(1);return t},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()});e.time.months=e.time.month.range;e.time.months.utc=e.time.month.utc.range;var Ma=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6];var _a=[[e.time.second,1],[e.time.second,5],[e.time.second,15],[e.time.second,30],[e.time.minute,1],[e.time.minute,5],[e.time.minute,15],[e.time.minute,30],[e.time.hour,1],[e.time.hour,3],[e.time.hour,6],[e.time.hour,12],[e.time.day,1],[e.time.day,2],[e.time.week,1],[e.time.month,1],[e.time.month,3],[e.time.year,1]];var Da=[[e.time.format("%Y"),$n],[e.time.format("%B"),function(e){return e.getMonth()}],[e.time.format("%b %d"),function(e){return e.getDate()!=1}],[e.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[e.time.format("%I %p"),function(e){return e.getHours()}],[e.time.format("%I:%M"),function(e){return e.getMinutes()}],[e.time.format(":%S"),function(e){return e.getSeconds()}],[e.time.format(".%L"),function(e){return e.getMilliseconds()}]];var Pa=e.scale.linear(),Ha=La(Da);_a.year=function(e,t){return Pa.domain(e.map(Oa)).ticks(t).map(Aa)};e.time.scale=function(){return Na(e.scale.linear(),_a,Ha)};var Ba=_a.map(function(e){return[e[0].utc,e[1]]});var ja=[[e.time.format.utc("%Y"),$n],[e.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[e.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[e.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[e.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[e.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[e.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[e.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]];var Fa=La(ja);Ba.year=function(e,t){return Pa.domain(e.map(qa)).ticks(t).map(Ia)};e.time.scale.utc=function(){return Na(e.scale.linear(),Ba,Fa)};e.text=function(){return e.xhr.apply(e,arguments).response(Ra)};e.json=function(t,n){return e.xhr(t,"application/json",n).response(Ua)};e.html=function(t,n){return e.xhr(t,"text/html",n).response(za)};e.xml=function(){return e.xhr.apply(e,arguments).response(Wa)};return e}() \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/fisheye.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/fisheye.js
new file mode 100644
index 00000000..e1addd7b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/fisheye.js
@@ -0,0 +1,86 @@
+(function() {
+ d3.fisheye = {
+ scale: function(scaleType) {
+ return d3_fisheye_scale(scaleType(), 3, 0);
+ },
+ circular: function() {
+ var radius = 200,
+ distortion = 2,
+ k0,
+ k1,
+ focus = [0, 0];
+
+ function fisheye(d) {
+ var dx = d.x - focus[0],
+ dy = d.y - focus[1],
+ dd = Math.sqrt(dx * dx + dy * dy);
+ if (!dd || dd >= radius) return {x: d.x, y: d.y, z: 1};
+ var k = k0 * (1 - Math.exp(-dd * k1)) / dd * .75 + .25;
+ return {x: focus[0] + dx * k, y: focus[1] + dy * k, z: Math.min(k, 10)};
+ }
+
+ function rescale() {
+ k0 = Math.exp(distortion);
+ k0 = k0 / (k0 - 1) * radius;
+ k1 = distortion / radius;
+ return fisheye;
+ }
+
+ fisheye.radius = function(_) {
+ if (!arguments.length) return radius;
+ radius = +_;
+ return rescale();
+ };
+
+ fisheye.distortion = function(_) {
+ if (!arguments.length) return distortion;
+ distortion = +_;
+ return rescale();
+ };
+
+ fisheye.focus = function(_) {
+ if (!arguments.length) return focus;
+ focus = _;
+ return fisheye;
+ };
+
+ return rescale();
+ }
+ };
+
+ function d3_fisheye_scale(scale, d, a) {
+
+ function fisheye(_) {
+ var x = scale(_),
+ left = x < a,
+ v,
+ range = d3.extent(scale.range()),
+ min = range[0],
+ max = range[1],
+ m = left ? a - min : max - a;
+ if (m == 0) m = max - min;
+ return (left ? -1 : 1) * m * (d + 1) / (d + (m / Math.abs(x - a))) + a;
+ }
+
+ fisheye.distortion = function(_) {
+ if (!arguments.length) return d;
+ d = +_;
+ return fisheye;
+ };
+
+ fisheye.focus = function(_) {
+ if (!arguments.length) return a;
+ a = +_;
+ return fisheye;
+ };
+
+ fisheye.copy = function() {
+ return d3_fisheye_scale(scale.copy(), d, a);
+ };
+
+ fisheye.nice = scale.nice;
+ fisheye.ticks = scale.ticks;
+ fisheye.tickFormat = scale.tickFormat;
+ return d3.rebind(fisheye, scale, "domain", "range");
+ }
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/hive.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/hive.js
new file mode 100644
index 00000000..06e53aed
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/hive.js
@@ -0,0 +1,80 @@
+d3.hive = {};
+
+d3.hive.link = function() {
+ var source = function(d) { return d.source; },
+ target = function(d) { return d.target; },
+ angle = function(d) { return d.angle; },
+ startRadius = function(d) { return d.radius; },
+ endRadius = startRadius,
+ arcOffset = -Math.PI / 2;
+
+ function link(d, i) {
+ var s = node(source, this, d, i),
+ t = node(target, this, d, i),
+ x;
+ if (t.a < s.a) x = t, t = s, s = x;
+ if (t.a - s.a > Math.PI) s.a += 2 * Math.PI;
+ var a1 = s.a + (t.a - s.a) / 3,
+ a2 = t.a - (t.a - s.a) / 3;
+ return s.r0 - s.r1 || t.r0 - t.r1
+ ? "M" + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0
+ + "L" + Math.cos(s.a) * s.r1 + "," + Math.sin(s.a) * s.r1
+ + "C" + Math.cos(a1) * s.r1 + "," + Math.sin(a1) * s.r1
+ + " " + Math.cos(a2) * t.r1 + "," + Math.sin(a2) * t.r1
+ + " " + Math.cos(t.a) * t.r1 + "," + Math.sin(t.a) * t.r1
+ + "L" + Math.cos(t.a) * t.r0 + "," + Math.sin(t.a) * t.r0
+ + "C" + Math.cos(a2) * t.r0 + "," + Math.sin(a2) * t.r0
+ + " " + Math.cos(a1) * s.r0 + "," + Math.sin(a1) * s.r0
+ + " " + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0
+ : "M" + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0
+ + "C" + Math.cos(a1) * s.r1 + "," + Math.sin(a1) * s.r1
+ + " " + Math.cos(a2) * t.r1 + "," + Math.sin(a2) * t.r1
+ + " " + Math.cos(t.a) * t.r1 + "," + Math.sin(t.a) * t.r1;
+ }
+
+ function node(method, thiz, d, i) {
+ var node = method.call(thiz, d, i),
+ a = +(typeof angle === "function" ? angle.call(thiz, node, i) : angle) + arcOffset,
+ r0 = +(typeof startRadius === "function" ? startRadius.call(thiz, node, i) : startRadius),
+ r1 = (startRadius === endRadius ? r0 : +(typeof endRadius === "function" ? endRadius.call(thiz, node, i) : endRadius));
+ return {r0: r0, r1: r1, a: a};
+ }
+
+ link.source = function(_) {
+ if (!arguments.length) return source;
+ source = _;
+ return link;
+ };
+
+ link.target = function(_) {
+ if (!arguments.length) return target;
+ target = _;
+ return link;
+ };
+
+ link.angle = function(_) {
+ if (!arguments.length) return angle;
+ angle = _;
+ return link;
+ };
+
+ link.radius = function(_) {
+ if (!arguments.length) return startRadius;
+ startRadius = endRadius = _;
+ return link;
+ };
+
+ link.startRadius = function(_) {
+ if (!arguments.length) return startRadius;
+ startRadius = _;
+ return link;
+ };
+
+ link.endRadius = function(_) {
+ if (!arguments.length) return endRadius;
+ endRadius = _;
+ return link;
+ };
+
+ return link;
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/horizon.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/horizon.js
new file mode 100644
index 00000000..d84c6567
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/horizon.js
@@ -0,0 +1,192 @@
+(function() {
+ d3.horizon = function() {
+ var bands = 1, // between 1 and 5, typically
+ mode = "offset", // or mirror
+ interpolate = "linear", // or basis, monotone, step-before, etc.
+ x = d3_horizonX,
+ y = d3_horizonY,
+ w = 960,
+ h = 40,
+ duration = 0;
+
+ var color = d3.scale.linear()
+ .domain([-1, 0, 1])
+ .range(["#d62728", "#fff", "#1f77b4"]);
+
+ // For each small multiple…
+ function horizon(g) {
+ g.each(function(d, i) {
+ var g = d3.select(this),
+ n = 2 * bands + 1,
+ xMin = Infinity,
+ xMax = -Infinity,
+ yMax = -Infinity,
+ x0, // old x-scale
+ y0, // old y-scale
+ id; // unique id for paths
+
+ // Compute x- and y-values along with extents.
+ var data = d.map(function(d, i) {
+ var xv = x.call(this, d, i),
+ yv = y.call(this, d, i);
+ if (xv < xMin) xMin = xv;
+ if (xv > xMax) xMax = xv;
+ if (-yv > yMax) yMax = -yv;
+ if (yv > yMax) yMax = yv;
+ return [xv, yv];
+ });
+
+ // Compute the new x- and y-scales, and transform.
+ var x1 = d3.scale.linear().domain([xMin, xMax]).range([0, w]),
+ y1 = d3.scale.linear().domain([0, yMax]).range([0, h * bands]),
+ t1 = d3_horizonTransform(bands, h, mode);
+
+ // Retrieve the old scales, if this is an update.
+ if (this.__chart__) {
+ x0 = this.__chart__.x;
+ y0 = this.__chart__.y;
+ t0 = this.__chart__.t;
+ id = this.__chart__.id;
+ } else {
+ x0 = x1.copy();
+ y0 = y1.copy();
+ t0 = t1;
+ id = ++d3_horizonId;
+ }
+
+ // We'll use a defs to store the area path and the clip path.
+ var defs = g.selectAll("defs")
+ .data([null]);
+
+ // The clip path is a simple rect.
+ defs.enter().append("defs").append("clipPath")
+ .attr("id", "d3_horizon_clip" + id)
+ .append("rect")
+ .attr("width", w)
+ .attr("height", h);
+
+ defs.select("rect").transition()
+ .duration(duration)
+ .attr("width", w)
+ .attr("height", h);
+
+ // We'll use a container to clip all horizon layers at once.
+ g.selectAll("g")
+ .data([null])
+ .enter().append("g")
+ .attr("clip-path", "url(#d3_horizon_clip" + id + ")");
+
+ // Instantiate each copy of the path with different transforms.
+ var path = g.select("g").selectAll("path")
+ .data(d3.range(-1, -bands - 1, -1).concat(d3.range(1, bands + 1)), Number);
+
+ var d0 = d3_horizonArea
+ .interpolate(interpolate)
+ .x(function(d) { return x0(d[0]); })
+ .y0(h * bands)
+ .y1(function(d) { return h * bands - y0(d[1]); })
+ (data);
+
+ var d1 = d3_horizonArea
+ .x(function(d) { return x1(d[0]); })
+ .y1(function(d) { return h * bands - y1(d[1]); })
+ (data);
+
+ path.enter().append("path")
+ .style("fill", color)
+ .attr("transform", t0)
+ .attr("d", d0);
+
+ path.transition()
+ .duration(duration)
+ .style("fill", color)
+ .attr("transform", t1)
+ .attr("d", d1);
+
+ path.exit().transition()
+ .duration(duration)
+ .attr("transform", t1)
+ .attr("d", d1)
+ .remove();
+
+ // Stash the new scales.
+ this.__chart__ = {x: x1, y: y1, t: t1, id: id};
+ });
+ d3.timer.flush();
+ }
+
+ horizon.duration = function(x) {
+ if (!arguments.length) return duration;
+ duration = +x;
+ return horizon;
+ };
+
+ horizon.bands = function(x) {
+ if (!arguments.length) return bands;
+ bands = +x;
+ color.domain([-bands, 0, bands]);
+ return horizon;
+ };
+
+ horizon.mode = function(x) {
+ if (!arguments.length) return mode;
+ mode = x + "";
+ return horizon;
+ };
+
+ horizon.colors = function(x) {
+ if (!arguments.length) return color.range();
+ color.range(x);
+ return horizon;
+ };
+
+ horizon.interpolate = function(x) {
+ if (!arguments.length) return interpolate;
+ interpolate = x + "";
+ return horizon;
+ };
+
+ horizon.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ return horizon;
+ };
+
+ horizon.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ return horizon;
+ };
+
+ horizon.width = function(x) {
+ if (!arguments.length) return w;
+ w = +x;
+ return horizon;
+ };
+
+ horizon.height = function(x) {
+ if (!arguments.length) return h;
+ h = +x;
+ return horizon;
+ };
+
+ return horizon;
+ };
+
+ var d3_horizonArea = d3.svg.area(),
+ d3_horizonId = 0;
+
+ function d3_horizonX(d) {
+ return d[0];
+ }
+
+ function d3_horizonY(d) {
+ return d[1];
+ }
+
+ function d3_horizonTransform(bands, h, mode) {
+ return mode == "offset"
+ ? function(d) { return "translate(0," + (d + (d < 0) - bands) * h + ")"; }
+ : function(d) { return (d < 0 ? "scale(1,-1)" : "") + "translate(0," + (d - bands) * h + ")"; };
+ }
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/interactiveLayer.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/interactiveLayer.js
new file mode 100644
index 00000000..4dfb68dc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/interactiveLayer.js
@@ -0,0 +1,251 @@
+/* Utility class to handle creation of an interactive layer.
+This places a rectangle on top of the chart. When you mouse move over it, it sends a dispatch
+containing the X-coordinate. It can also render a vertical line where the mouse is located.
+
+dispatch.elementMousemove is the important event to latch onto. It is fired whenever the mouse moves over
+the rectangle. The dispatch is given one object which contains the mouseX/Y location.
+It also has 'pointXValue', which is the conversion of mouseX to the x-axis scale.
+*/
+nv.interactiveGuideline = function() {
+ "use strict";
+ var tooltip = nv.models.tooltip();
+ //Public settings
+ var width = null
+ , height = null
+ //Please pass in the bounding chart's top and left margins
+ //This is important for calculating the correct mouseX/Y positions.
+ , margin = {left: 0, top: 0}
+ , xScale = d3.scale.linear()
+ , yScale = d3.scale.linear()
+ , dispatch = d3.dispatch('elementMousemove', 'elementMouseout','elementDblclick')
+ , showGuideLine = true
+ , svgContainer = null
+ //Must pass in the bounding chart's <svg> container.
+ //The mousemove event is attached to this container.
+ ;
+
+ //Private variables
+ var isMSIE = navigator.userAgent.indexOf("MSIE") !== -1 //Check user-agent for Microsoft Internet Explorer.
+ ;
+
+
+ function layer(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || 960), availableHeight = (height || 400);
+
+ var wrap = container.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([data]);
+ var wrapEnter = wrap.enter()
+ .append("g").attr("class", " nv-wrap nv-interactiveLineLayer");
+
+
+ wrapEnter.append("g").attr("class","nv-interactiveGuideLine");
+
+ if (!svgContainer) {
+ return;
+ }
+
+ function mouseHandler() {
+ var d3mouse = d3.mouse(this);
+ var mouseX = d3mouse[0];
+ var mouseY = d3mouse[1];
+ var subtractMargin = true;
+ var mouseOutAnyReason = false;
+ if (isMSIE) {
+ /*
+ D3.js (or maybe SVG.getScreenCTM) has a nasty bug in Internet Explorer 10.
+ d3.mouse() returns incorrect X,Y mouse coordinates when mouse moving
+ over a rect in IE 10.
+ However, d3.event.offsetX/Y also returns the mouse coordinates
+ relative to the triggering <rect>. So we use offsetX/Y on IE.
+ */
+ mouseX = d3.event.offsetX;
+ mouseY = d3.event.offsetY;
+
+ /*
+ On IE, if you attach a mouse event listener to the <svg> container,
+ it will actually trigger it for all the child elements (like <path>, <circle>, etc).
+ When this happens on IE, the offsetX/Y is set to where ever the child element
+ is located.
+ As a result, we do NOT need to subtract margins to figure out the mouse X/Y
+ position under this scenario. Removing the line below *will* cause
+ the interactive layer to not work right on IE.
+ */
+ if(d3.event.target.tagName !== "svg")
+ subtractMargin = false;
+
+ if (d3.event.target.className.baseVal.match("nv-legend"))
+ mouseOutAnyReason = true;
+
+ }
+
+ if(subtractMargin) {
+ mouseX -= margin.left;
+ mouseY -= margin.top;
+ }
+
+ /* If mouseX/Y is outside of the chart's bounds,
+ trigger a mouseOut event.
+ */
+ if (mouseX < 0 || mouseY < 0
+ || mouseX > availableWidth || mouseY > availableHeight
+ || (d3.event.relatedTarget && d3.event.relatedTarget.ownerSVGElement === undefined)
+ || mouseOutAnyReason
+ )
+ {
+ if (isMSIE) {
+ if (d3.event.relatedTarget
+ && d3.event.relatedTarget.ownerSVGElement === undefined
+ && d3.event.relatedTarget.className.match(tooltip.nvPointerEventsClass)) {
+ return;
+ }
+ }
+ dispatch.elementMouseout({
+ mouseX: mouseX,
+ mouseY: mouseY
+ });
+ layer.renderGuideLine(null); //hide the guideline
+ return;
+ }
+
+ var pointXValue = xScale.invert(mouseX);
+ dispatch.elementMousemove({
+ mouseX: mouseX,
+ mouseY: mouseY,
+ pointXValue: pointXValue
+ });
+
+ //If user double clicks the layer, fire a elementDblclick dispatch.
+ if (d3.event.type === "dblclick") {
+ dispatch.elementDblclick({
+ mouseX: mouseX,
+ mouseY: mouseY,
+ pointXValue: pointXValue
+ });
+ }
+ }
+
+ svgContainer
+ .on("mousemove",mouseHandler, true)
+ .on("mouseout" ,mouseHandler,true)
+ .on("dblclick" ,mouseHandler)
+ ;
+
+ //Draws a vertical guideline at the given X postion.
+ layer.renderGuideLine = function(x) {
+ if (!showGuideLine) return;
+ var line = wrap.select(".nv-interactiveGuideLine")
+ .selectAll("line")
+ .data((x != null) ? [nv.utils.NaNtoZero(x)] : [], String);
+
+ line.enter()
+ .append("line")
+ .attr("class", "nv-guideline")
+ .attr("x1", function(d) { return d;})
+ .attr("x2", function(d) { return d;})
+ .attr("y1", availableHeight)
+ .attr("y2",0)
+ ;
+ line.exit().remove();
+
+ }
+ });
+ }
+
+ layer.dispatch = dispatch;
+ layer.tooltip = tooltip;
+
+ layer.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return layer;
+ };
+
+ layer.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return layer;
+ };
+
+ layer.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return layer;
+ };
+
+ layer.xScale = function(_) {
+ if (!arguments.length) return xScale;
+ xScale = _;
+ return layer;
+ };
+
+ layer.showGuideLine = function(_) {
+ if (!arguments.length) return showGuideLine;
+ showGuideLine = _;
+ return layer;
+ };
+
+ layer.svgContainer = function(_) {
+ if (!arguments.length) return svgContainer;
+ svgContainer = _;
+ return layer;
+ };
+
+
+ return layer;
+};
+
+/* Utility class that uses d3.bisect to find the index in a given array, where a search value can be inserted.
+This is different from normal bisectLeft; this function finds the nearest index to insert the search value.
+
+For instance, lets say your array is [1,2,3,5,10,30], and you search for 28.
+Normal d3.bisectLeft will return 4, because 28 is inserted after the number 10. But interactiveBisect will return 5
+because 28 is closer to 30 than 10.
+
+Unit tests can be found in: interactiveBisectTest.html
+
+Has the following known issues:
+ * Will not work if the data points move backwards (ie, 10,9,8,7, etc) or if the data points are in random order.
+ * Won't work if there are duplicate x coordinate values.
+*/
+nv.interactiveBisect = function (values, searchVal, xAccessor) {
+ "use strict";
+ if (! values instanceof Array) return null;
+ if (typeof xAccessor !== 'function') xAccessor = function(d,i) { return d.x;}
+
+ var bisect = d3.bisector(xAccessor).left;
+ var index = d3.max([0, bisect(values,searchVal) - 1]);
+ var currentValue = xAccessor(values[index], index);
+ if (typeof currentValue === 'undefined') currentValue = index;
+
+ if (currentValue === searchVal) return index; //found exact match
+
+ var nextIndex = d3.min([index+1, values.length - 1]);
+ var nextValue = xAccessor(values[nextIndex], nextIndex);
+ if (typeof nextValue === 'undefined') nextValue = nextIndex;
+
+ if (Math.abs(nextValue - searchVal) >= Math.abs(currentValue - searchVal))
+ return index;
+ else
+ return nextIndex
+};
+
+/*
+Returns the index in the array "values" that is closest to searchVal.
+Only returns an index if searchVal is within some "threshold".
+Otherwise, returns null.
+*/
+nv.nearestValueIndex = function (values, searchVal, threshold) {
+ "use strict";
+ var yDistMax = Infinity, indexToHighlight = null;
+ values.forEach(function(d,i) {
+ var delta = Math.abs(searchVal - d);
+ if ( delta <= yDistMax && delta < threshold) {
+ yDistMax = delta;
+ indexToHighlight = i;
+ }
+ });
+ return indexToHighlight;
+}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/intro.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/intro.js
new file mode 100644
index 00000000..af50383e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/intro.js
@@ -0,0 +1 @@
+(function(){
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis-min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis-min.js
new file mode 100644
index 00000000..1101dde5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis-min.js
@@ -0,0 +1 @@
+nv.models.axis=function(){function o(d){return d.each(function(d){var o=d3.select(this),p=o.selectAll("g.nv-wrap.nv-axis").data([d]),q=p.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");q.append("g");var s=p.select("g");null!==m?a.ticks(m):("top"==a.orient()||"bottom"==a.orient())&&a.ticks(Math.abs(e.range()[1]-e.range()[0])/100),d3.transition(s).call(a),n=n||a.scale();var t=a.tickFormat();null==t&&(t=n.tickFormat());var u=s.selectAll("text.nv-axislabel").data([f||null]);switch(u.exit().remove(),a.orient()){case"top":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",0);var v=2==e.range().length?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);if(u.attr("x",v/2),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a){return"translate("+e(a)+",0)"}).select("text").attr("dy","0em").attr("y",-a.tickPadding()).attr("text-anchor","middle").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+e.range()[b]+",0)"})}break;case"bottom":var x=36,y=30,z=s.selectAll("g").select("text");if(i%360){z.each(function(){var c=this.getBBox().width;c>y&&(y=c)});var A=Math.abs(Math.sin(i*Math.PI/180)),x=(A?A*y:y)+30;z.attr("transform",function(){return"rotate("+i+" 0,0)"}).attr("text-anchor",i%360>0?"start":"end")}u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",x);var v=2==e.range().length?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);if(u.attr("x",v/2),g){var w=p.selectAll("g.nv-axisMaxMin").data([e.domain()[0],e.domain()[e.domain().length-1]]);w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",a.tickPadding()).attr("transform",function(){return"rotate("+i+" 0,0)"}).attr("text-anchor",i?i%360>0?"start":"end":"middle").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"})}k&&z.attr("transform",function(a,b){return"translate(0,"+(0==b%2?"0":"12")+")"});break;case"right":if(u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(90)":"").attr("y",j?-Math.max(b.right,c)+30:-10),u.attr("x",j?e.range()[0]/2:a.tickPadding()),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",a.tickPadding()).attr("text-anchor","start").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":if(u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(-90)":"").attr("y",j?-Math.max(b.left,c)+0:-10),u.attr("x",j?-e.range()[0]/2:-a.tickPadding()),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-a.tickPadding()).attr("text-anchor","start").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}}if(u.text(function(a){return a}),!g||"left"!==a.orient()&&"right"!==a.orient()||(s.selectAll("g").each(function(a){d3.select(this).select("text").attr("opacity",1),(e(a)<e.range()[1]+10||e(a)>e.range()[0]-10)&&((a>1e-10||-1e-10>a)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0))}),e.domain()[0]==e.domain()[1]&&0==e.domain()[0]&&p.selectAll("g.nv-axisMaxMin").style("opacity",function(a,b){return b?0:1})),g&&("top"===a.orient()||"bottom"===a.orient())){var B=[];p.selectAll("g.nv-axisMaxMin").each(function(a,b){try{b?B.push(e(a)-this.getBBox().width-4):B.push(e(a)+this.getBBox().width+4)}catch(c){b?B.push(e(a)-4):B.push(e(a)+4)}}),s.selectAll("g").each(function(a){(e(a)<B[0]||e(a)>B[1])&&(a>1e-10||-1e-10>a?d3.select(this).remove():d3.select(this).select("text").remove())})}h&&s.selectAll("line.tick").filter(function(a){return!parseFloat(Math.round(1e5*a)/1e6)}).classed("zero",!0),n=e.copy()}),o}var a=d3.svg.axis(),b={top:0,right:0,bottom:0,left:0},c=75,d=60,e=d3.scale.linear(),f=null,g=!1,h=!0,i=0,j=!0,k=!1,l=!1,m=null;a.scale(e).orient("bottom").tickFormat(function(a){return a});var n;return o.axis=a,d3.rebind(o,a,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o.margin=function(a){return arguments.length?(b.top=a.top!==void 0?a.top:b.top,b.right=a.right!==void 0?a.right:b.right,b.bottom=a.bottom!==void 0?a.bottom:b.bottom,b.left=a.left!==void 0?a.left:b.left,o):b},o.width=function(a){return arguments.length?(c=a,o):c},o.ticks=function(a){return arguments.length?(m=a,o):m},o.height=function(a){return arguments.length?(d=a,o):d},o.axisLabel=function(a){return arguments.length?(f=a,o):f},o.showMaxMin=function(a){return arguments.length?(g=a,o):g},o.highlightZero=function(a){return arguments.length?(h=a,o):h},o.scale=function(b){return arguments.length?(e=b,a.scale(e),l="function"==typeof e.rangeBands,d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o):e},o.rotateYLabel=function(a){return arguments.length?(j=a,o):j},o.rotateLabels=function(a){return arguments.length?(i=a,o):i},o.staggerLabels=function(a){return arguments.length?(k=a,o):k},o}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.js
new file mode 100644
index 00000000..9895c3f0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.js
@@ -0,0 +1,470 @@
+nv.models.axis = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var axis = d3.svg.axis()
+ ;
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 75 //only used for tickLabel currently
+ , height = 60 //only used for tickLabel currently
+ , scale = d3.scale.linear()
+ , axisLabelText = null
+ , showMaxMin = true //TODO: showMaxMin should be disabled on all ordinal scaled axes
+ , highlightZero = true
+ , rotateLabels = 0
+ , rotateYLabel = true
+ , staggerLabels = false
+ , isOrdinal = false
+ , ticks = null
+ , logScale = false
+ , axisLabelDistance = 12 //The larger this number is, the closer the axis label is to the axis.
+ ;
+
+ axis
+ .scale(scale)
+ .orient('bottom')
+ .tickFormat(function(d) { return d })
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var scale0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-axis').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-axis');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ //------------------------------------------------------------
+
+
+ if (ticks !== null)
+ axis.ticks(ticks);
+ else if (axis.orient() == 'top' || axis.orient() == 'bottom')
+ axis.ticks(Math.abs(scale.range()[1] - scale.range()[0]) / 100);
+
+
+ //TODO: consider calculating width/height based on whether or not label is added, for reference in charts using this component
+
+
+ g.transition().call(axis);
+
+ scale0 = scale0 || axis.scale();
+
+ var fmt = axis.tickFormat();
+ if (fmt == null) {
+ fmt = scale0.tickFormat();
+ }
+
+ var axisLabel = g.selectAll('text.nv-axislabel')
+ .data([axisLabelText || null]);
+ axisLabel.exit().remove();
+ switch (axis.orient()) {
+ case 'top':
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0]));
+ axisLabel
+ .attr('text-anchor', 'middle')
+ .attr('y', 0)
+ .attr('x', w/2);
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text');
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(' + scale(d) + ',0)'
+ })
+ .select('text')
+ .attr('dy', '0em')
+ .attr('y', -axis.tickPadding())
+ .attr('text-anchor', 'middle')
+ .text(function(d,i) {
+ //var v = fmt(d);
+ var v = d;
+ if(logScale) {
+ v = Math.pow(10,v);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else
+ v = fmt(v);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ axisMaxMin.transition()
+ .attr('transform', function(d,i) {
+ return 'translate(' + scale.range()[i] + ',0)'
+ });
+ }
+ break;
+ case 'bottom':
+ var xLabelMargin = 36;
+ var maxTextWidth = 30;
+ var xTicks = g.selectAll('g').select("text");
+ if (rotateLabels%360) {
+ //Calculate the longest xTick width
+ xTicks.each(function(d,i){
+ var width = this.getBBox().width;
+ if(width > maxTextWidth) maxTextWidth = width;
+ });
+ //Convert to radians before calculating sin. Add 30 to margin for healthy padding.
+ var sin = Math.abs(Math.sin(rotateLabels*Math.PI/180));
+ var xLabelMargin = (sin ? sin*maxTextWidth : maxTextWidth)+30;
+ //Rotate all xTicks
+ xTicks
+ .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' })
+ .style('text-anchor', rotateLabels%360 > 0 ? 'start' : 'end');
+ }
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0]));
+ axisLabel
+ .attr('text-anchor', 'middle')
+ .attr('y', xLabelMargin)
+ .attr('x', w/2);
+ if (showMaxMin) {
+ //if (showMaxMin && !isOrdinal) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ //.data(scale.domain())
+ .data([scale.domain()[0], scale.domain()[scale.domain().length - 1]]);
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text');
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)'
+ })
+ .select('text')
+ .attr('dy', '.71em')
+ .attr('y', axis.tickPadding())
+ .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' })
+ .style('text-anchor', rotateLabels ? (rotateLabels%360 > 0 ? 'start' : 'end') : 'middle')
+ .text(function(d,i) {
+ //var v = fmt(d);
+ var v = d;
+ if(logScale) {
+ v = Math.pow(10,v);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else
+ v = fmt(v);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ axisMaxMin.transition()
+ .attr('transform', function(d,i) {
+ //return 'translate(' + scale.range()[i] + ',0)'
+ //return 'translate(' + scale(d) + ',0)'
+ return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)'
+ });
+ }
+ if (staggerLabels)
+ xTicks
+ .attr('transform', function(d,i) { return 'translate(0,' + (i % 2 == 0 ? '0' : '12') + ')' });
+
+ break;
+ case 'right':
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ axisLabel
+ .style('text-anchor', rotateYLabel ? 'middle' : 'begin')
+ .attr('transform', rotateYLabel ? 'rotate(90)' : '')
+ .attr('y', rotateYLabel ? (-Math.max(margin.right,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart
+ .attr('x', rotateYLabel ? (scale.range()[0] / 2) : axis.tickPadding());
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text')
+ .style('opacity', 0);
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale(d) + ')'
+ })
+ .select('text')
+ .attr('dy', '.32em')
+ .attr('y', 0)
+ .attr('x', axis.tickPadding())
+ .style('text-anchor', 'start')
+ .text(function(d,i) {
+ //var v = fmt(d);
+ var v = d;
+ if(logScale) {
+ v = Math.pow(10,v);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else
+ v = fmt(v);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ axisMaxMin.transition()
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale.range()[i] + ')'
+ })
+ .select('text')
+ .style('opacity', 1);
+ }
+ break;
+ case 'left':
+ /*
+ //For dynamically placing the label. Can be used with dynamically-sized chart axis margins
+ var yTicks = g.selectAll('g').select("text");
+ yTicks.each(function(d,i){
+ var labelPadding = this.getBBox().width + axis.tickPadding() + 16;
+ if(labelPadding > width) width = labelPadding;
+ });
+ */
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ axisLabel
+ .style('text-anchor', rotateYLabel ? 'middle' : 'end')
+ .attr('transform', rotateYLabel ? 'rotate(-90)' : '')
+ .attr('y', rotateYLabel ? (-Math.max(margin.left,width) + axisLabelDistance) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart
+ .attr('x', rotateYLabel ? (-scale.range()[0] / 2) : -axis.tickPadding());
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text')
+ .style('opacity', 0);
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale0(d) + ')'
+ })
+ .select('text')
+ .attr('dy', '.32em')
+ .attr('y', 0)
+ .attr('x', -axis.tickPadding())
+ .attr('text-anchor', 'end')
+ .text(function(d,i) {
+ //var v = fmt(d);
+ var v = d;
+ if(logScale) {
+ v = Math.pow(10,v);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else
+ v = fmt(v);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ axisMaxMin.transition()
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale.range()[i] + ')'
+ })
+ .select('text')
+ .style('opacity', 1);
+ }
+ break;
+ }
+ axisLabel
+ .text(function(d) { return d });
+
+
+ if (showMaxMin && (axis.orient() === 'left' || axis.orient() === 'right')) {
+ //check if max and min overlap other values, if so, hide the values that overlap
+ g.selectAll('g') // the g's wrapping each tick
+ .each(function(d,i) {
+ d3.select(this).select('text').attr('opacity', 1);
+ var v;
+ if(logScale) {
+ v = Math.pow(10,d);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else {
+ v = fmt(d);
+ }
+
+ //d3.select(this).select('text').text(fmt(Math.pow(10,d)));
+ d3.select(this).select('text').text(v);
+ if (scale(d) < scale.range()[1] + 10 || scale(d) > scale.range()[0] - 10) { // 10 is assuming text height is 16... if d is 0, leave it!
+ if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL
+ d3.select(this).attr('opacity', 0);
+
+ d3.select(this).select('text').attr('opacity', 0); // Don't remove the ZERO line!!
+ }
+ });
+
+ //if Max and Min = 0 only show min, Issue #281
+ if (scale.domain()[0] == scale.domain()[1] && scale.domain()[0] == 0)
+ wrap.selectAll('g.nv-axisMaxMin')
+ .style('opacity', function(d,i) { return !i ? 1 : 0 });
+
+ }
+
+ if (showMaxMin && (axis.orient() === 'top' || axis.orient() === 'bottom')) {
+ var maxMinRange = [];
+ wrap.selectAll('g.nv-axisMaxMin')
+ .each(function(d,i) {
+ try {
+ if (i) // i== 1, max position
+ maxMinRange.push(scale(d) - this.getBBox().width - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
+ else // i==0, min position
+ maxMinRange.push(scale(d) + this.getBBox().width + 4)
+ }catch (err) {
+ if (i) // i== 1, max position
+ maxMinRange.push(scale(d) - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
+ else // i==0, min position
+ maxMinRange.push(scale(d) + 4)
+ }
+ });
+ g.selectAll('g') // the g's wrapping each tick
+ .each(function(d,i) {
+ var v;
+ if(logScale) {
+ v = Math.pow(10,d);
+ //v = fmt(v);
+ //fmt = d3.format(',.2f');
+ v = fmt(v);
+ } else {
+ v = fmt(d);
+ }
+ //alert(v);
+
+ //d3.select(this).select('text').text(fmt(Math.pow(10,d)));
+ d3.select(this).select('text').text(v);
+
+ if (scale(d) < maxMinRange[0] || scale(d) > maxMinRange[1]) {
+ if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL
+ d3.select(this).remove();
+ else
+ d3.select(this).select('text').remove(); // Don't remove the ZERO line!!
+ }
+ });
+ }
+
+
+ //highlight zero line ... Maybe should not be an option and should just be in CSS?
+ if (highlightZero)
+ g.selectAll('.tick')
+ .filter(function(d) { return !parseFloat(Math.round(d.__data__*100000)/1000000) && (d.__data__ !== undefined) }) //this is because sometimes the 0 tick is a very small fraction, TODO: think of cleaner technique
+ .classed('zero', true);
+
+ //store old scales for use in transitions on update
+ scale0 = scale.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.axis = axis;
+
+ d3.rebind(chart, axis, 'orient', 'tickValues', 'tickSubdivide', 'tickSize', 'tickPadding', 'tickFormat');
+ d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands'); //these are also accessible by chart.scale(), but added common ones directly for ease of use
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if(!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ }
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.ticks = function(_) {
+ if (!arguments.length) return ticks;
+ ticks = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.axisLabel = function(_) {
+ if (!arguments.length) return axisLabelText;
+ axisLabelText = _;
+ return chart;
+ }
+
+ chart.showMaxMin = function(_) {
+ if (!arguments.length) return showMaxMin;
+ showMaxMin = _;
+ return chart;
+ }
+
+ chart.logScale = function(_) {
+ if (!arguments.length) return logScale;
+ logScale = _;
+ return chart;
+ }
+
+ chart.highlightZero = function(_) {
+ if (!arguments.length) return highlightZero;
+ highlightZero = _;
+ return chart;
+ }
+
+ chart.scale = function(_) {
+ if (!arguments.length) return scale;
+ scale = _;
+ axis.scale(scale);
+ isOrdinal = typeof scale.rangeBands === 'function';
+ d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands');
+ return chart;
+ }
+
+ chart.rotateYLabel = function(_) {
+ if(!arguments.length) return rotateYLabel;
+ rotateYLabel = _;
+ return chart;
+ }
+
+ chart.rotateLabels = function(_) {
+ if(!arguments.length) return rotateLabels;
+ rotateLabels = _;
+ return chart;
+ }
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+ chart.axisLabelDistance = function(_) {
+ if (!arguments.length) return axisLabelDistance;
+ axisLabelDistance = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.min.js
new file mode 100644
index 00000000..6c8ad6ab
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.min.js
@@ -0,0 +1 @@
+nv.models.axis=function(){"use strict";function m(r){r.each(function(r){var m=d3.select(this);var g=m.selectAll("g.nv-wrap.nv-axis").data([r]);var y=g.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");var b=y.append("g");var w=g.select("g");if(h!==null)e.ticks(h);else if(e.orient()=="top"||e.orient()=="bottom")e.ticks(Math.abs(i.range()[1]-i.range()[0])/100);w.transition().call(e);v=v||e.scale();var E=e.tickFormat();if(E==null){E=v.tickFormat()}var S=w.selectAll("text.nv-axislabel").data([s||null]);S.exit().remove();switch(e.orient()){case"top":S.enter().append("text").attr("class","nv-axislabel");var x=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);S.attr("text-anchor","middle").attr("y",0).attr("x",x/2);if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+i(e)+",0)"}).select("text").attr("dy","0em").attr("y",-e.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+i.range()[t]+",0)"})}break;case"bottom":var N=36;var C=30;var k=w.selectAll("g").select("text");if(a%360){k.each(function(e,t){var n=this.getBBox().width;if(n>C)C=n});var L=Math.abs(Math.sin(a*Math.PI/180));var N=(L?L*C:C)+30;k.attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).style("text-anchor",a%360>0?"start":"end")}S.enter().append("text").attr("class","nv-axislabel");var x=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);S.attr("text-anchor","middle").attr("y",N).attr("x",x/2);if(o){var T=g.selectAll("g.nv-axisMaxMin").data([i.domain()[0],i.domain()[i.domain().length-1]]);T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",e.tickPadding()).attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).style("text-anchor",a?a%360>0?"start":"end":"middle").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"})}if(l)k.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",f?"middle":"begin").attr("transform",f?"rotate(90)":"").attr("y",f?-Math.max(t.right,n)+12:-10).attr("x",f?i.range()[0]/2:e.tickPadding());if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+i(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",e.tickPadding()).style("text-anchor","start").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",f?"middle":"end").attr("transform",f?"rotate(-90)":"").attr("y",f?-Math.max(t.left,n)+d:-10).attr("x",f?-i.range()[0]/2:-e.tickPadding());if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+v(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-e.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}break}S.text(function(e){return e});if(o&&(e.orient()==="left"||e.orient()==="right")){w.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);var n;if(p){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(i(e)<i.range()[1]+10||i(e)>i.range()[0]-10){if(e>1e-10||e<-1e-10)d3.select(this).attr("opacity",0);d3.select(this).select("text").attr("opacity",0)}});if(i.domain()[0]==i.domain()[1]&&i.domain()[0]==0)g.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return!t?1:0})}if(o&&(e.orient()==="top"||e.orient()==="bottom")){var A=[];g.selectAll("g.nv-axisMaxMin").each(function(e,t){try{if(t)A.push(i(e)-this.getBBox().width-4);else A.push(i(e)+this.getBBox().width+4)}catch(n){if(t)A.push(i(e)-4);else A.push(i(e)+4)}});w.selectAll("g").each(function(e,t){var n;if(p){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(i(e)<A[0]||i(e)>A[1]){if(e>1e-10||e<-1e-10)d3.select(this).remove();else d3.select(this).select("text").remove()}})}if(u)w.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",true);v=i.copy()});return m}var e=d3.svg.axis();var t={top:0,right:0,bottom:0,left:0},n=75,r=60,i=d3.scale.linear(),s=null,o=true,u=true,a=0,f=true,l=false,c=false,h=null,p=false,d=12;e.scale(i).orient("bottom").tickFormat(function(e){return e});var v;m.axis=e;d3.rebind(m,e,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat");d3.rebind(m,i,"domain","range","rangeBand","rangeBands");m.options=nv.utils.optionsFunc.bind(m);m.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return m};m.width=function(e){if(!arguments.length)return n;n=e;return m};m.ticks=function(e){if(!arguments.length)return h;h=e;return m};m.height=function(e){if(!arguments.length)return r;r=e;return m};m.axisLabel=function(e){if(!arguments.length)return s;s=e;return m};m.showMaxMin=function(e){if(!arguments.length)return o;o=e;return m};m.logScale=function(e){if(!arguments.length)return p;p=e;return m};m.highlightZero=function(e){if(!arguments.length)return u;u=e;return m};m.scale=function(t){if(!arguments.length)return i;i=t;e.scale(i);c=typeof i.rangeBands==="function";d3.rebind(m,i,"domain","range","rangeBand","rangeBands");return m};m.rotateYLabel=function(e){if(!arguments.length)return f;f=e;return m};m.rotateLabels=function(e){if(!arguments.length)return a;a=e;return m};m.staggerLabels=function(e){if(!arguments.length)return l;l=e;return m};m.axisLabelDistance=function(e){if(!arguments.length)return d;d=e;return m};return m} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bullet.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bullet.js
new file mode 100644
index 00000000..86ebeb0f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bullet.js
@@ -0,0 +1,250 @@
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+
+nv.models.bullet = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , orient = 'left' // TODO top & bottom
+ , reverse = false
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , forceX = [0] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.)
+ , width = 380
+ , height = 30
+ , tickFormat = null
+ , dispatch = d3.dispatch('elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this),
+ mainGroup = nv.log(this.parentNode.parentNode).getAttribute('transform'),
+ heightFromTop = nv.log(parseInt(mainGroup.replace(/.*,(\d+)\)/,"$1"))); //TODO: There should be a smarter way to get this value
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // Compute the new x-scale.
+ var MaxX = Math.max(rangez[0] ? rangez[0]:0 , markerz[0] ? markerz[0] : 0 , measurez[0] ? measurez[0] : 0)
+ var x1 = d3.scale.linear()
+ .domain([0, MaxX]).nice() // TODO: need to allow forceX and forceY, and xDomain, yDomain
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bullet').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bullet');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+
+
+ // Update the range rects.
+ var range = g.selectAll('rect.nv-range')
+ .data(rangez);
+
+ range.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-range nv-s' + i; })
+ .attr('width', w0)
+ .attr('height', availableHeight)
+ .attr('x', reverse ? x0 : 0)
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: (i <= 0) ? 'Maximum' : (i > 1) ? 'Minimum' : 'Mean', //TODO: make these labels a variable
+ pos: [x1(d), heightFromTop]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: (i <= 0) ? 'Minimum' : (i >=1) ? 'Maximum' : 'Mean' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(range)
+ .attr('x', reverse ? x1 : 0)
+ .attr('width', w1)
+ .attr('height', availableHeight);
+
+
+ // Update the measure rects.
+ var measure = g.selectAll('rect.nv-measure')
+ .data(measurez);
+
+ measure.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-measure nv-s' + i; })
+ .attr('width', w0)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x0 : 0)
+ .attr('y', availableHeight / 3)
+ .on('mouseover', function(d) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Current', //TODO: make these labels a variable
+ pos: [x1(d), heightFromTop]
+ })
+ })
+ .on('mouseout', function(d) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Current' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(measure)
+ .attr('width', w1)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x1 : 0)
+ .attr('y', availableHeight / 3);
+
+
+
+ // Update the marker lines.
+ var marker = g.selectAll('path.nv-markerTriangle')
+ .data(markerz);
+
+ var h3 = availableHeight / 6;
+ marker.enter().append('path')
+ .attr('class', 'nv-markerTriangle')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',' + (availableHeight / 2) + ')' })
+ .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Previous',
+ pos: [x1(d), heightFromTop]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Previous'
+ })
+ });
+
+ d3.transition(marker)
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',' + (availableHeight / 2) + ')' });
+
+ marker.exit().remove();
+
+ });
+
+ d3.timer.flush();
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ // left, right, top, bottom
+ chart.orient = function(_) {
+ if (!arguments.length) return orient;
+ orient = _;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(_) {
+ if (!arguments.length) return ranges;
+ ranges = _;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(_) {
+ if (!arguments.length) return markers;
+ markers = _;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(_) {
+ if (!arguments.length) return measures;
+ measures = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(_) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bulletChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bulletChart.js
new file mode 100644
index 00000000..a2a0f077
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bulletChart.js
@@ -0,0 +1,349 @@
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+nv.models.bulletChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var bullet = nv.models.bullet()
+ ;
+
+ var orient = 'left' // TODO top & bottom
+ , reverse = false
+ , margin = {top: 5, right: 40, bottom: 20, left: 120}
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , width = null
+ , height = 55
+ , tickFormat = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + e.label + '</h3>' +
+ '<p>' + e.value + '</p>'
+ }
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, parentElement) {
+ var offsetElement = parentElement.parentNode.parentNode,
+ left = e.pos[0] + offsetElement.offsetLeft + margin.left,
+ top = e.pos[1] + offsetElement.offsetTop + margin.top;
+
+ var content = '<h3>' + e.label + '</h3>' +
+ '<p>' + e.value + '</p>';
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement.parentNode);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ that = this;
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ /*
+ // Disabled until I figure out a better way to check for no data with the bullet chart
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+ */
+
+ //------------------------------------------------------------
+
+
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bulletChart').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bulletChart');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-bulletWrap');
+ gEnter.append('g').attr('class', 'nv-titles');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + ( margin.top + i*height )+ ')');
+
+ //------------------------------------------------------------
+
+
+ // Compute the new x-scale.
+ var MaxX = Math.max(rangez[0] ? rangez[0]:0 , markerz[0] ? markerz[0] : 0 , measurez[0] ? measurez[0] : 0)
+ var x1 = d3.scale.linear()
+ .domain([0, MaxX]).nice() // TODO: need to allow forceX and forceY, and xDomain, yDomain
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+ /*
+ // Derive width-scales from the x-scales.
+ var w0 = bulletWidth(x0),
+ w1 = bulletWidth(x1);
+
+ function bulletWidth(x) {
+ var x0 = x(0);
+ return function(d) {
+ return Math.abs(x(d) - x(0));
+ };
+ }
+
+ function bulletTranslate(x) {
+ return function(d) {
+ return 'translate(' + x(d) + ',0)';
+ };
+ }
+ */
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+
+
+ var title = gEnter.select('.nv-titles').append("g")
+ .attr("text-anchor", "end")
+ .attr("transform", "translate(-6," + (height - margin.top - margin.bottom) / 2 + ")");
+ title.append("text")
+ .attr("class", "nv-title")
+ .text(function(d) { return d.title; });
+
+ title.append("text")
+ .attr("class", "nv-subtitle")
+ .attr("dy", "1em")
+ .text(function(d) { return d.subtitle; });
+
+
+
+ bullet
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var bulletWrap = g.select('.nv-bulletWrap');
+
+ d3.transition(bulletWrap).call(bullet);
+
+
+
+ // Compute the tick format.
+ var format = tickFormat || x1.tickFormat(8);
+
+ // Update the tick groups.
+ var tick = g.selectAll('g.nv-tick')
+ .data(x1.ticks(8), function(d) {
+ return this.textContent || format(d);
+ });
+
+ // Initialize the ticks with the old scale, x0.
+ var tickEnter = tick.enter().append('g')
+ .attr('class', 'nv-tick')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',0)' })
+ .style('opacity', 1e-6);
+
+ tickEnter.append('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickEnter.append('text')
+ .attr('text-anchor', 'middle')
+ .attr('dy', '1em')
+ .attr('y', availableHeight * 7 / 6)
+ .text(format);
+
+ // Transition the entering ticks to the new scale, x1.
+ d3.transition(tickEnter)
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1);
+
+ // Transition the updating ticks to the new scale, x1.
+ var tickUpdate = d3.transition(tick)
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1);
+
+ tickUpdate.select('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickUpdate.select('text')
+ .attr('y', availableHeight * 7 / 6);
+
+ // Transition the exiting ticks to the new scale, x1.
+ d3.transition(tick.exit())
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1e-6)
+ .remove();
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+ });
+
+ d3.timer.flush();
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ bullet.dispatch.on('elementMouseover.tooltip', function(e) {
+ dispatch.tooltipShow(e);
+ });
+
+ bullet.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.bullet = bullet;
+
+ // left, right, top, bottom
+ chart.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(x) {
+ if (!arguments.length) return ranges;
+ ranges = x;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(x) {
+ if (!arguments.length) return markers;
+ markers = x;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(x) {
+ if (!arguments.length) return measures;
+ measures = x;
+ return chart;
+ };
+
+ chart.width = function(x) {
+ if (!arguments.length) return width;
+ width = x;
+ return chart;
+ };
+
+ chart.height = function(x) {
+ if (!arguments.length) return height;
+ height = x;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = x;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/boilerplate.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/boilerplate.js
new file mode 100644
index 00000000..3d2360a6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/boilerplate.js
@@ -0,0 +1,104 @@
+
+nv.models.chartName = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+
+ var margin = {top: 30, right: 10, bottom: 10, left: 10}
+ , width = 960
+ , height = 500
+ , color = nv.utils.getColor(d3.scale.category20c().range())
+ , dispatch = d3.dispatch('stateChange', 'changeState')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-chartName').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-chartName');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-mainWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_)
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bullet.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bullet.js
new file mode 100644
index 00000000..9b9bf4d1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bullet.js
@@ -0,0 +1,385 @@
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+
+nv.models.bullet = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , orient = 'left' // TODO top & bottom
+ , reverse = false
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , rangeLabels = function(d) { return d.rangeLabels ? d.rangeLabels : [] }
+ , markerLabels = function(d) { return d.markerLabels ? d.markerLabels : [] }
+ , measureLabels = function(d) { return d.measureLabels ? d.measureLabels : [] }
+ , forceX = [0] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.)
+ , width = 380
+ , height = 30
+ , tickFormat = null
+ , color = nv.utils.getColor(['#1f77b4'])
+ , dispatch = d3.dispatch('elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending),
+ rangeLabelz = rangeLabels.call(this, d, i).slice(),
+ markerLabelz = markerLabels.call(this, d, i).slice(),
+ measureLabelz = measureLabels.call(this, d, i).slice();
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain( d3.extent(d3.merge([forceX, rangez])) )
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+
+ var rangeMin = d3.min(rangez), //rangez[2]
+ rangeMax = d3.max(rangez), //rangez[0]
+ rangeAvg = rangez[1];
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bullet').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bullet');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeMax');
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeAvg');
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeMin');
+ gEnter.append('rect').attr('class', 'nv-measure');
+ gEnter.append('path').attr('class', 'nv-markerTriangle');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+ var xp0 = function(d) { return d < 0 ? x0(d) : x0(0) },
+ xp1 = function(d) { return d < 0 ? x1(d) : x1(0) };
+
+
+ g.select('rect.nv-rangeMax')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeMax > 0 ? rangeMax : rangeMin))
+ .attr('x', xp1(rangeMax > 0 ? rangeMax : rangeMin))
+ .datum(rangeMax > 0 ? rangeMax : rangeMin)
+ /*
+ .attr('x', rangeMin < 0 ?
+ rangeMax > 0 ?
+ x1(rangeMin)
+ : x1(rangeMax)
+ : x1(0))
+ */
+
+ g.select('rect.nv-rangeAvg')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeAvg))
+ .attr('x', xp1(rangeAvg))
+ .datum(rangeAvg)
+ /*
+ .attr('width', rangeMax <= 0 ?
+ x1(rangeMax) - x1(rangeAvg)
+ : x1(rangeAvg) - x1(rangeMin))
+ .attr('x', rangeMax <= 0 ?
+ x1(rangeAvg)
+ : x1(rangeMin))
+ */
+
+ g.select('rect.nv-rangeMin')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeMax))
+ .attr('x', xp1(rangeMax))
+ .attr('width', w1(rangeMax > 0 ? rangeMin : rangeMax))
+ .attr('x', xp1(rangeMax > 0 ? rangeMin : rangeMax))
+ .datum(rangeMax > 0 ? rangeMin : rangeMax)
+ /*
+ .attr('width', rangeMax <= 0 ?
+ x1(rangeAvg) - x1(rangeMin)
+ : x1(rangeMax) - x1(rangeAvg))
+ .attr('x', rangeMax <= 0 ?
+ x1(rangeMin)
+ : x1(rangeAvg))
+ */
+
+ g.select('rect.nv-measure')
+ .style('fill', color)
+ .attr('height', availableHeight / 3)
+ .attr('y', availableHeight / 3)
+ .attr('width', measurez < 0 ?
+ x1(0) - x1(measurez[0])
+ : x1(measurez[0]) - x1(0))
+ .attr('x', xp1(measurez))
+ .on('mouseover', function() {
+ dispatch.elementMouseover({
+ value: measurez[0],
+ label: measureLabelz[0] || 'Current',
+ pos: [x1(measurez[0]), availableHeight/2]
+ })
+ })
+ .on('mouseout', function() {
+ dispatch.elementMouseout({
+ value: measurez[0],
+ label: measureLabelz[0] || 'Current'
+ })
+ })
+
+ var h3 = availableHeight / 6;
+ if (markerz[0]) {
+ g.selectAll('path.nv-markerTriangle')
+ .attr('transform', function(d) { return 'translate(' + x1(markerz[0]) + ',' + (availableHeight / 2) + ')' })
+ .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
+ .on('mouseover', function() {
+ dispatch.elementMouseover({
+ value: markerz[0],
+ label: markerLabelz[0] || 'Previous',
+ pos: [x1(markerz[0]), availableHeight/2]
+ })
+ })
+ .on('mouseout', function() {
+ dispatch.elementMouseout({
+ value: markerz[0],
+ label: markerLabelz[0] || 'Previous'
+ })
+ });
+ } else {
+ g.selectAll('path.nv-markerTriangle').remove();
+ }
+
+
+ wrap.selectAll('.nv-range')
+ .on('mouseover', function(d,i) {
+ var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum");
+
+ dispatch.elementMouseover({
+ value: d,
+ label: label,
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum");
+
+ dispatch.elementMouseout({
+ value: d,
+ label: label
+ })
+ })
+
+/* // THIS IS THE PREVIOUS BULLET IMPLEMENTATION, WILL REMOVE SHORTLY
+ // Update the range rects.
+ var range = g.selectAll('rect.nv-range')
+ .data(rangez);
+
+ range.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-range nv-s' + i; })
+ .attr('width', w0)
+ .attr('height', availableHeight)
+ .attr('x', reverse ? x0 : 0)
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: (i <= 0) ? 'Maximum' : (i > 1) ? 'Minimum' : 'Mean', //TODO: make these labels a variable
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: (i <= 0) ? 'Minimum' : (i >=1) ? 'Maximum' : 'Mean' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(range)
+ .attr('x', reverse ? x1 : 0)
+ .attr('width', w1)
+ .attr('height', availableHeight);
+
+
+ // Update the measure rects.
+ var measure = g.selectAll('rect.nv-measure')
+ .data(measurez);
+
+ measure.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-measure nv-s' + i; })
+ .style('fill', function(d,i) { return color(d,i ) })
+ .attr('width', w0)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x0 : 0)
+ .attr('y', availableHeight / 3)
+ .on('mouseover', function(d) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Current', //TODO: make these labels a variable
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Current' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(measure)
+ .attr('width', w1)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x1 : 0)
+ .attr('y', availableHeight / 3);
+
+
+
+ // Update the marker lines.
+ var marker = g.selectAll('path.nv-markerTriangle')
+ .data(markerz);
+
+ var h3 = availableHeight / 6;
+ marker.enter().append('path')
+ .attr('class', 'nv-markerTriangle')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',' + (availableHeight / 2) + ')' })
+ .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Previous',
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Previous'
+ })
+ });
+
+ d3.transition(marker)
+ .attr('transform', function(d) { return 'translate(' + (x1(d) - x1(0)) + ',' + (availableHeight / 2) + ')' });
+
+ marker.exit().remove();
+*/
+
+ });
+
+ // d3.timer.flush(); // Not needed?
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ // left, right, top, bottom
+ chart.orient = function(_) {
+ if (!arguments.length) return orient;
+ orient = _;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(_) {
+ if (!arguments.length) return ranges;
+ ranges = _;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(_) {
+ if (!arguments.length) return markers;
+ markers = _;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(_) {
+ if (!arguments.length) return measures;
+ measures = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(_) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bulletChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bulletChart.js
new file mode 100644
index 00000000..fa5bd596
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bulletChart.js
@@ -0,0 +1,343 @@
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+nv.models.bulletChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var bullet = nv.models.bullet()
+ ;
+
+ var orient = 'left' // TODO top & bottom
+ , reverse = false
+ , margin = {top: 5, right: 40, bottom: 20, left: 120}
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , width = null
+ , height = 55
+ , tickFormat = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ) + margin.left,
+ top = e.pos[1] + ( offsetElement.offsetTop || 0) + margin.top,
+ content = tooltip(e.key, e.label, e.value, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ that = this;
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!d || !ranges.call(this, d, i)) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', 18 + margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bulletChart').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bulletChart');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-bulletWrap');
+ gEnter.append('g').attr('class', 'nv-titles');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) // TODO: need to allow forceX and forceY, and xDomain, yDomain
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+ /*
+ // Derive width-scales from the x-scales.
+ var w0 = bulletWidth(x0),
+ w1 = bulletWidth(x1);
+
+ function bulletWidth(x) {
+ var x0 = x(0);
+ return function(d) {
+ return Math.abs(x(d) - x(0));
+ };
+ }
+
+ function bulletTranslate(x) {
+ return function(d) {
+ return 'translate(' + x(d) + ',0)';
+ };
+ }
+ */
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+
+
+ var title = gEnter.select('.nv-titles').append('g')
+ .attr('text-anchor', 'end')
+ .attr('transform', 'translate(-6,' + (height - margin.top - margin.bottom) / 2 + ')');
+ title.append('text')
+ .attr('class', 'nv-title')
+ .text(function(d) { return d.title; });
+
+ title.append('text')
+ .attr('class', 'nv-subtitle')
+ .attr('dy', '1em')
+ .text(function(d) { return d.subtitle; });
+
+
+
+ bullet
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var bulletWrap = g.select('.nv-bulletWrap');
+
+ d3.transition(bulletWrap).call(bullet);
+
+
+
+ // Compute the tick format.
+ var format = tickFormat || x1.tickFormat( availableWidth / 100 );
+
+ // Update the tick groups.
+ var tick = g.selectAll('g.nv-tick')
+ .data(x1.ticks( availableWidth / 50 ), function(d) {
+ return this.textContent || format(d);
+ });
+
+ // Initialize the ticks with the old scale, x0.
+ var tickEnter = tick.enter().append('g')
+ .attr('class', 'nv-tick')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',0)' })
+ .style('opacity', 1e-6);
+
+ tickEnter.append('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickEnter.append('text')
+ .attr('text-anchor', 'middle')
+ .attr('dy', '1em')
+ .attr('y', availableHeight * 7 / 6)
+ .text(format);
+
+
+ // Transition the updating ticks to the new scale, x1.
+ var tickUpdate = d3.transition(tick)
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1);
+
+ tickUpdate.select('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickUpdate.select('text')
+ .attr('y', availableHeight * 7 / 6);
+
+ // Transition the exiting ticks to the new scale, x1.
+ d3.transition(tick.exit())
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1e-6)
+ .remove();
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('tooltipShow', function(e) {
+ e.key = d.title;
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+ });
+
+ d3.timer.flush();
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ bullet.dispatch.on('elementMouseover.tooltip', function(e) {
+ dispatch.tooltipShow(e);
+ });
+
+ bullet.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.bullet = bullet;
+
+ d3.rebind(chart, bullet, 'color');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ // left, right, top, bottom
+ chart.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(x) {
+ if (!arguments.length) return ranges;
+ ranges = x;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(x) {
+ if (!arguments.length) return markers;
+ markers = x;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(x) {
+ if (!arguments.length) return measures;
+ measures = x;
+ return chart;
+ };
+
+ chart.width = function(x) {
+ if (!arguments.length) return width;
+ width = x;
+ return chart;
+ };
+
+ chart.height = function(x) {
+ if (!arguments.length) return height;
+ height = x;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = x;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/cumulativeLineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/cumulativeLineChart.js
new file mode 100644
index 00000000..00f193cf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/cumulativeLineChart.js
@@ -0,0 +1,782 @@
+
+nv.models.cumulativeLineChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , interactiveLayer = nv.interactiveGuideline()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 50, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , tooltips = true
+ , showControls = true
+ , useInteractiveGuideline = false
+ , rescaleY = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , id = lines.id()
+ , state = { index: 0, rescaleY: rescaleY }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , average = function(d) { return d.average }
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ //============================================================
+ controls.updateState(false);
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var dx = d3.scale.linear()
+ , index = {i: 0, x: 0}
+ ;
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+/*
+ //Moved to see if we can get better behavior to fix issue #315
+ var indexDrag = d3.behavior.drag()
+ .on('dragstart', dragStart)
+ .on('drag', dragMove)
+ .on('dragend', dragEnd);
+
+ function dragStart(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'ew-resize');
+ }
+
+ function dragMove(d,i) {
+ d.x += d3.event.dx;
+ d.i = Math.round(dx.invert(d.x));
+
+ d3.select(this).attr('transform', 'translate(' + dx(d.i) + ',0)');
+ chart.update();
+ }
+
+ function dragEnd(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'auto');
+ chart.update();
+ }
+*/
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this).classed('nv-chart-' + id, true),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ var indexDrag = d3.behavior.drag()
+ .on('dragstart', dragStart)
+ .on('drag', dragMove)
+ .on('dragend', dragEnd);
+
+
+ function dragStart(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'ew-resize');
+ }
+
+ function dragMove(d,i) {
+ index.x = d3.event.x;
+ index.i = Math.round(dx.invert(index.x));
+ updateZero();
+ }
+
+ function dragEnd(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'auto');
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+
+
+ if (!rescaleY) {
+ var seriesDomains = data
+ .filter(function(series) { return !series.disabled })
+ .map(function(series,i) {
+ var initialDomain = d3.extent(series.values, lines.y());
+
+ //account for series being disabled when losing 95% or more
+ if (initialDomain[0] < -.95) initialDomain[0] = -.95;
+
+ return [
+ (initialDomain[0] - initialDomain[1]) / (1 + initialDomain[1]),
+ (initialDomain[1] - initialDomain[0]) / (1 + initialDomain[0])
+ ];
+ });
+
+ var completeDomain = [
+ d3.min(seriesDomains, function(d) { return d[0] }),
+ d3.max(seriesDomains, function(d) { return d[1] })
+ ]
+
+ lines.yDomain(completeDomain);
+ } else {
+ lines.yDomain(null);
+ }
+
+
+ dx .domain([0, data[0].values.length - 1]) //Assumes all series have same length
+ .range([0, availableWidth])
+ .clamp(true);
+
+ //------------------------------------------------------------
+
+
+ var data = indexify(index.i, data);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+ var interactivePointerEvents = (useInteractiveGuideline) ? "none" : "all";
+ var wrap = container.selectAll('g.nv-wrap.nv-cumulativeLine').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-cumulativeLine').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-interactive');
+ gEnter.append('g').attr('class', 'nv-x nv-axis').style("pointer-events","none");
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-background');
+ gEnter.append('g').attr('class', 'nv-linesWrap').style("pointer-events",interactivePointerEvents);
+ gEnter.append('g').attr('class', 'nv-avgLinesWrap').style("pointer-events","none");
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Re-scale y-axis', disabled: !rescaleY }
+ ];
+
+ controls.width(140).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ // Show error if series goes below 100%
+ var tempDisabled = data.filter(function(d) { return d.tempDisabled });
+
+ wrap.select('.tempDisabled').remove(); //clean-up and prevent duplicates
+ if (tempDisabled.length) {
+ wrap.append('text').attr('class', 'tempDisabled')
+ .attr('x', availableWidth / 2)
+ .attr('y', '-.71em')
+ .style('text-anchor', 'end')
+ .text(tempDisabled.map(function(d) { return d.key }).join(', ') + ' values cannot be calculated for this time period.');
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ //------------------------------------------------------------
+ //Set up interactive layer
+ if (useInteractiveGuideline) {
+ interactiveLayer
+ .width(availableWidth)
+ .height(availableHeight)
+ .margin({left:margin.left,top:margin.top})
+ .svgContainer(container)
+ .xScale(x);
+ wrap.select(".nv-interactive").call(interactiveLayer);
+ }
+
+ gEnter.select('.nv-background')
+ .append('rect');
+
+ g.select('.nv-background rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ lines
+ //.x(function(d) { return d.x })
+ .y(function(d) { return d.display.y })
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].tempDisabled; }));
+
+
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled && !d.tempDisabled }));
+
+ //d3.transition(linesWrap).call(lines);
+ linesWrap.call(lines);
+
+ /*Handle average lines [AN-612] ----------------------------*/
+
+ //Store a series index number in the data array.
+ data.forEach(function(d,i) {
+ d.seriesIndex = i;
+ });
+
+ var avgLineData = data.filter(function(d) {
+ return !d.disabled && !!average(d);
+ });
+
+ var avgLines = g.select(".nv-avgLinesWrap").selectAll("line")
+ .data(avgLineData, function(d) { return d.key; });
+
+ var getAvgLineY = function(d) {
+ //If average lines go off the svg element, clamp them to the svg bounds.
+ var yVal = y(average(d));
+ if (yVal < 0) return 0;
+ if (yVal > availableHeight) return availableHeight;
+ return yVal;
+ };
+
+ avgLines.enter()
+ .append('line')
+ .style('stroke-width',2)
+ .style('stroke-dasharray','10,10')
+ .style('stroke',function (d,i) {
+ return lines.color()(d,d.seriesIndex);
+ })
+ .attr('x1',0)
+ .attr('x2',availableWidth)
+ .attr('y1', getAvgLineY)
+ .attr('y2', getAvgLineY);
+
+ avgLines
+ .style('stroke-opacity',function(d){
+ //If average lines go offscreen, make them transparent
+ var yVal = y(average(d));
+ if (yVal < 0 || yVal > availableHeight) return 0;
+ return 1;
+ })
+ .attr('x1',0)
+ .attr('x2',availableWidth)
+ .attr('y1', getAvgLineY)
+ .attr('y2', getAvgLineY);
+
+ avgLines.exit().remove();
+
+ //Create index line -----------------------------------------
+
+ var indexLine = linesWrap.selectAll('.nv-indexLine')
+ .data([index]);
+ indexLine.enter().append('rect').attr('class', 'nv-indexLine')
+ .attr('width', 3)
+ .attr('x', -2)
+ .attr('fill', 'red')
+ .attr('fill-opacity', .5)
+ .style("pointer-events","all")
+ .call(indexDrag)
+
+ indexLine
+ .attr('transform', function(d) { return 'translate(' + dx(d.i) + ',0)' })
+ .attr('height', availableHeight)
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ //Suggest how many ticks based on the chart width and D3 should listen (70 is the optimal number for MM/DD/YY dates)
+ .ticks( Math.min(data[0].values.length,availableWidth/70) )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+ }
+
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+ }
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+
+ function updateZero() {
+ indexLine
+ .data([index]);
+
+ //When dragging the index line, turn off line transitions.
+ // Then turn them back on when done dragging.
+ var oldDuration = chart.transitionDuration();
+ chart.transitionDuration(0);
+ chart.update();
+ chart.transitionDuration(oldDuration);
+ }
+
+ g.select('.nv-background rect')
+ .on('click', function() {
+ index.x = d3.mouse(this)[0];
+ index.i = Math.round(dx.invert(index.x));
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+
+ updateZero();
+ });
+
+ lines.dispatch.on('elementClick', function(e) {
+ index.i = e.pointIndex;
+ index.x = dx(index.i);
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+
+ updateZero();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+ rescaleY = !d.disabled;
+
+ state.rescaleY = rescaleY;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state.disabled = newState.disabled;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ interactiveLayer.dispatch.on('elementMousemove', function(e) {
+ lines.clearHighlights();
+ var singlePoint, pointIndex, pointXLocation, allData = [];
+
+
+ data
+ .filter(function(series, i) {
+ series.seriesIndex = i;
+ return !series.disabled;
+ })
+ .forEach(function(series,i) {
+ pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x());
+ lines.highlightPoint(i, pointIndex, true);
+ var point = series.values[pointIndex];
+ if (typeof point === 'undefined') return;
+ if (typeof singlePoint === 'undefined') singlePoint = point;
+ if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex));
+ allData.push({
+ key: series.key,
+ value: chart.y()(point, pointIndex),
+ color: color(series,series.seriesIndex)
+ });
+ });
+
+ //Highlight the tooltip entry based on which point the mouse is closest to.
+ if (allData.length > 2) {
+ var yValue = chart.yScale().invert(e.mouseY);
+ var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]);
+ var threshold = 0.03 * domainExtent;
+ var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold);
+ if (indexToHighlight !== null)
+ allData[indexToHighlight].highlight = true;
+ }
+
+ var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex), pointIndex);
+ interactiveLayer.tooltip
+ .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
+ .chartContainer(that.parentNode)
+ .enabled(tooltips)
+ .valueFormatter(function(d,i) {
+ return yAxis.tickFormat()(d);
+ })
+ .data(
+ {
+ value: xValue,
+ series: allData
+ }
+ )();
+
+ interactiveLayer.renderGuideLine(pointXLocation);
+
+ });
+
+ interactiveLayer.dispatch.on("elementMouseout",function(e) {
+ dispatch.tooltipHide();
+ lines.clearHighlights();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+
+ if (typeof e.index !== 'undefined') {
+ index.i = e.index;
+ index.x = dx(index.i);
+
+ state.index = e.index;
+
+ indexLine
+ .data([index]);
+ }
+
+
+ if (typeof e.rescaleY !== 'undefined') {
+ rescaleY = e.rescaleY;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.lines = lines;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.interactiveLayer = interactiveLayer;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'xScale','yScale', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi','useVoronoi', 'id');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.rescaleY = function(_) {
+ if (!arguments.length) return rescaleY;
+ rescaleY = _;
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.useInteractiveGuideline = function(_) {
+ if(!arguments.length) return useInteractiveGuideline;
+ useInteractiveGuideline = _;
+ if (_ === true) {
+ chart.interactive(false);
+ chart.useVoronoi(false);
+ }
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.average = function(_) {
+ if(!arguments.length) return average;
+ average = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ /* Normalize the data according to an index point. */
+ function indexify(idx, data) {
+ return data.map(function(line, i) {
+ if (!line.values) {
+ return line;
+ }
+ var v = lines.y()(line.values[idx], idx);
+
+ //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue
+ if (v < -.95) {
+ //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100)
+ line.tempDisabled = true;
+ return line;
+ }
+
+ line.tempDisabled = false;
+
+ line.values = line.values.map(function(point, pointIndex) {
+ point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) };
+ return point;
+ })
+
+ return line;
+ })
+ }
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBar.js
new file mode 100644
index 00000000..a20f5829
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBar.js
@@ -0,0 +1,349 @@
+//TODO: consider deprecating by adding necessary features to multiBar model
+nv.models.discreteBar = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , color = nv.utils.defaultColor()
+ , showValues = false
+ , valueFormat = d3.format(',.2f')
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ , rectClass = 'discreteBar'
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0 }
+ })
+ });
+
+ x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands(xRange || [0, availableWidth], .1);
+
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y }).concat(forceY)));
+
+
+ // If showValues, pad the Y axis range to account for label height
+ if (showValues) y.range(yRange || [availableHeight - (y.domain()[0] < 0 ? 12 : 0), y.domain()[1] > 0 ? 12 : 0]);
+ else y.range(yRange || [availableHeight, 0]);
+
+ //store old scales if they exist
+ x0 = x0 || x;
+ y0 = y0 || y.copy().range([y(0),y(0)]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-discretebar').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discretebar');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ //TODO: by definition, the discrete bar should not have multiple groups, will modify/remove later
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit()
+ .transition()
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover });
+ groups
+ .transition()
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('g.nv-bar')
+ .data(function(d) { return d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('g')
+ .attr('transform', function(d,i,j) {
+ return 'translate(' + (x(getX(d,i)) + x.rangeBand() * .05 ) + ', ' + y(0) + ')'
+ })
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+
+ barsEnter.append('rect')
+ .attr('height', 0)
+ .attr('width', x.rangeBand() * .9 / data.length )
+
+ if (showValues) {
+ barsEnter.append('text')
+ .attr('text-anchor', 'middle')
+ ;
+
+ bars.select('text')
+ .text(function(d,i) { return valueFormat(getY(d,i)) })
+ .transition()
+ .attr('x', x.rangeBand() * .9 / 2)
+ .attr('y', function(d,i) { return getY(d,i) < 0 ? y(getY(d,i)) - y(0) + 12 : -4 })
+
+ ;
+ } else {
+ bars.selectAll('text').remove();
+ }
+
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive' })
+ .style('fill', function(d,i) { return d.color || color(d,i) })
+ .style('stroke', function(d,i) { return d.color || color(d,i) })
+ .select('rect')
+ .attr('class', rectClass)
+ .transition()
+ .attr('width', x.rangeBand() * .9 / data.length);
+ bars.transition()
+ //.delay(function(d,i) { return i * 1200 / data[0].values.length })
+ .attr('transform', function(d,i) {
+ var left = x(getX(d,i)) + x.rangeBand() * .05,
+ top = getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 : //make 1 px positive bars show up above y=0
+ y(getY(d,i));
+
+ return 'translate(' + left + ', ' + top + ')'
+ })
+ .select('rect')
+ .attr('height', function(d,i) {
+ return Math.max(Math.abs(y(getY(d,i)) - y((yDomain && yDomain[0]) || 0)) || 1)
+ });
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.showValues = function(_) {
+ if (!arguments.length) return showValues;
+ showValues = _;
+ return chart;
+ };
+
+ chart.valueFormat= function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.rectClass= function(_) {
+ if (!arguments.length) return rectClass;
+ rectClass = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBarChart.js
new file mode 100644
index 00000000..48a48164
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBarChart.js
@@ -0,0 +1,333 @@
+
+nv.models.discreteBarChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var discretebar = nv.models.discreteBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ ;
+
+ var margin = {top: 15, right: 10, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.getColor()
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , staggerLabels = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , x
+ , y
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'beforeUpdate')
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .highlightZero(false)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(discretebar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(discretebar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() {
+ dispatch.beforeUpdate();
+ container.transition().duration(transitionDuration).call(chart);
+ };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = discretebar.xScale();
+ y = discretebar.yScale().clamp(true);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-discreteBarWithAxes').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discreteBarWithAxes').append('g');
+ var defsEnter = gEnter.append('defs');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+
+ g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ discretebar
+ .width(availableWidth)
+ .height(availableHeight);
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ barsWrap.transition().call(discretebar);
+
+ //------------------------------------------------------------
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-x-label-clip-' + discretebar.id())
+ .append('rect');
+
+ g.select('#nv-x-label-clip-' + discretebar.id() + ' rect')
+ .attr('width', x.rangeBand() * (staggerLabels ? 2 : 1))
+ .attr('height', 16)
+ .attr('x', -x.rangeBand() / (staggerLabels ? 1 : 2 ));
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + (y.range()[0] + ((discretebar.showValues() && y.domain()[0] < 0) ? 16 : 0)) + ')');
+ //d3.transition(g.select('.nv-x.nv-axis'))
+ g.select('.nv-x.nv-axis').transition()
+ .call(xAxis);
+
+
+ var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
+
+ if (staggerLabels) {
+ xTicks
+ .selectAll('text')
+ .attr('transform', function(d,i,j) { return 'translate(0,' + (j % 2 == 0 ? '5' : '17') + ')' })
+ }
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis').transition()
+ .call(yAxis);
+ }
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ discretebar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ discretebar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.discretebar = discretebar;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, discretebar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'id', 'showValues', 'valueFormat');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ discretebar.color(color);
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/distribution.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/distribution.js
new file mode 100644
index 00000000..62a74655
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/distribution.js
@@ -0,0 +1,148 @@
+
+nv.models.distribution = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 400 //technically width or height depending on x or y....
+ , size = 8
+ , axis = 'x' // 'x' or 'y'... horizontal or vertical
+ , getData = function(d) { return d[axis] } // defaults d.x or d.y
+ , color = nv.utils.defaultColor()
+ , scale = d3.scale.linear()
+ , domain
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var scale0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableLength = width - (axis === 'x' ? margin.left + margin.right : margin.top + margin.bottom),
+ naxis = axis == 'x' ? 'y' : 'x',
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ scale0 = scale0 || scale;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-distribution').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-distribution');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
+
+ //------------------------------------------------------------
+
+
+ var distWrap = g.selectAll('g.nv-dist')
+ .data(function(d) { return d }, function(d) { return d.key });
+
+ distWrap.enter().append('g');
+ distWrap
+ .attr('class', function(d,i) { return 'nv-dist nv-series-' + i })
+ .style('stroke', function(d,i) { return color(d, i) });
+
+ var dist = distWrap.selectAll('line.nv-dist' + axis)
+ .data(function(d) { return d.values })
+ dist.enter().append('line')
+ .attr(axis + '1', function(d,i) { return scale0(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale0(getData(d,i)) })
+ distWrap.exit().selectAll('line.nv-dist' + axis)
+ .transition()
+ .attr(axis + '1', function(d,i) { return scale(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale(getData(d,i)) })
+ .style('stroke-opacity', 0)
+ .remove();
+ dist
+ .attr('class', function(d,i) { return 'nv-dist' + axis + ' nv-dist' + axis + '-' + i })
+ .attr(naxis + '1', 0)
+ .attr(naxis + '2', size);
+ dist
+ .transition()
+ .attr(axis + '1', function(d,i) { return scale(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale(getData(d,i)) })
+
+
+ scale0 = scale.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.axis = function(_) {
+ if (!arguments.length) return axis;
+ axis = _;
+ return chart;
+ };
+
+ chart.size = function(_) {
+ if (!arguments.length) return size;
+ size = _;
+ return chart;
+ };
+
+ chart.getData = function(_) {
+ if (!arguments.length) return getData;
+ getData = d3.functor(_);
+ return chart;
+ };
+
+ chart.scale = function(_) {
+ if (!arguments.length) return scale;
+ scale = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBar.js
new file mode 100644
index 00000000..2a6c644d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBar.js
@@ -0,0 +1,331 @@
+//TODO: consider deprecating and using multibar with single series for this
+nv.models.historicalBar = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceX = []
+ , forceY = [0]
+ , padData = false
+ , clipEdge = true
+ , color = nv.utils.defaultColor()
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ , interactive = true
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) ))
+
+ if (padData)
+ x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(data[0].values.map(getY).concat(forceY) ))
+ .range(yRange || [availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-historicalBar-' + id).data([data[0].values]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBar-' + id);
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-bars');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-chart-clip-path-' + id)
+ .append('rect');
+
+ wrap.select('#nv-chart-clip-path-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : '');
+
+
+
+ var bars = wrap.select('.nv-bars').selectAll('.nv-bar')
+ .data(function(d) { return d }, function(d,i) {return getX(d,i)});
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('rect')
+ //.attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i })
+ .attr('x', 0 )
+ .attr('y', function(d,i) { return nv.utils.NaNtoZero(y(Math.max(0, getY(d,i)))) })
+ .attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.abs(y(getY(d,i)) - y(0))) })
+ .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; })
+ .on('mouseover', function(d,i) {
+ if (!interactive) return;
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ point: d,
+ series: data[0],
+ pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+
+ })
+ .on('mouseout', function(d,i) {
+ if (!interactive) return;
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ point: d,
+ series: data[0],
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ if (!interactive) return;
+ dispatch.elementClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ if (!interactive) return;
+ dispatch.elementDblClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ bars
+ .attr('fill', function(d,i) { return color(d, i); })
+ .attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i })
+ .transition()
+ .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; })
+ //TODO: better width calculations that don't assume always uniform data spacing;w
+ .attr('width', (availableWidth / data[0].values.length) * .9 );
+
+
+ bars.transition()
+ .attr('y', function(d,i) {
+ var rval = getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 :
+ y(getY(d,i));
+ return nv.utils.NaNtoZero(rval);
+ })
+ .attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.max(Math.abs(y(getY(d,i)) - y(0)),1)) });
+
+ });
+
+ return chart;
+ }
+
+ //Create methods to allow outside functions to highlight a specific bar.
+ chart.highlightPoint = function(pointIndex, isHoverOver) {
+ d3.select(".nv-historicalBar-" + id)
+ .select(".nv-bars .nv-bar-0-" + pointIndex)
+ .classed("hover", isHoverOver)
+ ;
+ };
+
+ chart.clearHighlights = function() {
+ d3.select(".nv-historicalBar-" + id)
+ .select(".nv-bars .nv-bar.hover")
+ .classed("hover", false)
+ ;
+ };
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.interactive = function(_) {
+ if(!arguments.length) return interactive;
+ interactive = false;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBarChart.js
new file mode 100644
index 00000000..a5b4a097
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBarChart.js
@@ -0,0 +1,419 @@
+
+nv.models.historicalBarChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var bars = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ ;
+
+
+ var margin = {top: 30, right: 90, bottom: 50, left: 90}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = false
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x
+ , y
+ , state = {}
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient( (rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+
+ // New addition to calculate position if SVG is scaled with viewBox, may move TODO: consider implementing everywhere else
+ if (offsetElement) {
+ var svg = d3.select(offsetElement).select('svg');
+ var viewBox = (svg.node()) ? svg.attr('viewBox') : null;
+ if (viewBox) {
+ viewBox = viewBox.split(' ');
+ var ratio = parseInt(svg.style('width')) / viewBox[2];
+ e.pos[0] = e.pos[0] * ratio;
+ e.pos[1] = e.pos[1] * ratio;
+ }
+ }
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(bars.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(bars.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = bars.xScale();
+ y = bars.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-historicalBarChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBarChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ barsWrap.transition().call(bars);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ g.select('.nv-x.nv-axis')
+ .transition()
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .transition()
+ .call(yAxis);
+ }
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ selection.transition().call(chart);
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ selection.call(chart);
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.bars = bars;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, bars, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale',
+ 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate','highlightPoint','clearHighlights', 'interactive');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/indentedTree.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/indentedTree.js
new file mode 100644
index 00000000..18c2700f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/indentedTree.js
@@ -0,0 +1,337 @@
+nv.models.indentedTree = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor()
+ , id = Math.floor(Math.random() * 10000)
+ , header = true
+ , filterZero = false
+ , noData = "No Data Available."
+ , childIndent = 20
+ , columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this
+ , tableClass = null
+ , iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images
+ , iconClose = 'images/grey-minus.png'
+ , dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout')
+ , getUrl = function(d) { return d.url }
+ ;
+
+ //============================================================
+
+ var idx = 0;
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var depth = 1,
+ container = d3.select(this);
+
+ var tree = d3.layout.tree()
+ .children(function(d) { return d.values })
+ .size([height, childIndent]); //Not sure if this is needed now that the result is HTML
+
+ chart.update = function() { container.transition().duration(600).call(chart) };
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+ if (!data[0]) data[0] = {key: noData};
+
+ //------------------------------------------------------------
+
+
+ var nodes = tree.nodes(data[0]);
+
+ // nodes.map(function(d) {
+ // d.id = i++;
+ // })
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('div').data([[nodes]]);
+ var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree');
+ var tableEnter = wrapEnter.append('table');
+ var table = wrap.select('table').attr('width', '100%').attr('class', tableClass);
+
+ //------------------------------------------------------------
+
+
+ if (header) {
+ var thead = tableEnter.append('thead');
+
+ var theadRow1 = thead.append('tr');
+
+ columns.forEach(function(column) {
+ theadRow1
+ .append('th')
+ .attr('width', column.width ? column.width : '10%')
+ .style('text-align', column.type == 'numeric' ? 'right' : 'left')
+ .append('span')
+ .text(column.label);
+ });
+ }
+
+
+ var tbody = table.selectAll('tbody')
+ .data(function(d) { return d });
+ tbody.enter().append('tbody');
+
+
+
+ //compute max generations
+ depth = d3.max(nodes, function(node) { return node.depth });
+ tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all
+
+
+ // Update the nodes…
+ var node = tbody.selectAll('tr')
+ // .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)});
+ .data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)});
+ //.style('display', 'table-row'); //TODO: see if this does anything
+
+ node.exit().remove();
+
+ node.select('img.nv-treeicon')
+ .attr('src', icon)
+ .classed('folded', folded);
+
+ var nodeEnter = node.enter().append('tr');
+
+
+ columns.forEach(function(column, index) {
+
+ var nodeName = nodeEnter.append('td')
+ .style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here
+ .style('text-align', column.type == 'numeric' ? 'right' : 'left');
+
+
+ if (index == 0) {
+ nodeName.append('img')
+ .classed('nv-treeicon', true)
+ .classed('nv-folded', folded)
+ .attr('src', icon)
+ .style('width', '14px')
+ .style('height', '14px')
+ .style('padding', '0 1px')
+ .style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; })
+ .on('click', click);
+ }
+
+
+ nodeName.each(function(d) {
+ if (!index && getUrl(d))
+ d3.select(this)
+ .append('a')
+ .attr('href',getUrl)
+ .attr('class', d3.functor(column.classes))
+ .append('span')
+ else
+ d3.select(this)
+ .append('span')
+
+ d3.select(this).select('span')
+ .attr('class', d3.functor(column.classes) )
+ .text(function(d) { return column.format ? column.format(d) :
+ (d[column.key] || '-') });
+ });
+
+ if (column.showCount) {
+ nodeName.append('span')
+ .attr('class', 'nv-childrenCount');
+
+ node.selectAll('span.nv-childrenCount').text(function(d) {
+ return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent
+ '(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter
+ || (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values...
+ || 0) + ')' //This is the catch-all in case there are no children after a filter
+ : '' //If this is not a parent, just give an empty string
+ });
+ }
+
+ // if (column.click)
+ // nodeName.select('span').on('click', column.click);
+
+ });
+
+ node
+ .order()
+ .on('click', function(d) {
+ dispatch.elementClick({
+ row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href)
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('dblclick', function(d) {
+ dispatch.elementDblclick({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('mouseover', function(d) {
+ dispatch.elementMouseover({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('mouseout', function(d) {
+ dispatch.elementMouseout({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ });
+
+
+
+
+ // Toggle children on click.
+ function click(d, _, unshift) {
+ d3.event.stopPropagation();
+
+ if(d3.event.shiftKey && !unshift) {
+ //If you shift-click, it'll toggle fold all the children, instead of itself
+ d3.event.shiftKey = false;
+ d.values && d.values.forEach(function(node){
+ if (node.values || node._values) {
+ click(node, 0, true);
+ }
+ });
+ return true;
+ }
+ if(!hasChildren(d)) {
+ //download file
+ //window.location.href = d.url;
+ return true;
+ }
+ if (d.values) {
+ d._values = d.values;
+ d.values = null;
+ } else {
+ d.values = d._values;
+ d._values = null;
+ }
+ chart.update();
+ }
+
+
+ function icon(d) {
+ return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : '';
+ }
+
+ function folded(d) {
+ return (d._values && d._values.length);
+ }
+
+ function hasChildren(d) {
+ var values = d.values || d._values;
+
+ return (values && values.length);
+ }
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ scatter.color(color);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.header = function(_) {
+ if (!arguments.length) return header;
+ header = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.filterZero = function(_) {
+ if (!arguments.length) return filterZero;
+ filterZero = _;
+ return chart;
+ };
+
+ chart.columns = function(_) {
+ if (!arguments.length) return columns;
+ columns = _;
+ return chart;
+ };
+
+ chart.tableClass = function(_) {
+ if (!arguments.length) return tableClass;
+ tableClass = _;
+ return chart;
+ };
+
+ chart.iconOpen = function(_){
+ if (!arguments.length) return iconOpen;
+ iconOpen = _;
+ return chart;
+ }
+
+ chart.iconClose = function(_){
+ if (!arguments.length) return iconClose;
+ iconClose = _;
+ return chart;
+ }
+
+ chart.getUrl = function(_){
+ if (!arguments.length) return getUrl;
+ getUrl = _;
+ return chart;
+ }
+
+ //============================================================
+
+
+ return chart;
+}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/legend.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/legend.js
new file mode 100644
index 00000000..21f9f9a4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/legend.js
@@ -0,0 +1,270 @@
+nv.models.legend = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 5, right: 0, bottom: 5, left: 0}
+ , width = 400
+ , height = 20
+ , getKey = function(d) { return d.key }
+ , color = nv.utils.defaultColor()
+ , align = true
+ , rightAlign = true
+ , updateState = true //If true, legend will update data.disabled and trigger a 'stateChange' dispatch.
+ , radioButtonMode = false //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at a time)
+ , dispatch = d3.dispatch('legendClick', 'legendDblclick', 'legendMouseover', 'legendMouseout', 'stateChange')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-legend').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-legend').append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ var series = g.selectAll('.nv-series')
+ .data(function(d) { return d });
+ var seriesEnter = series.enter().append('g').attr('class', 'nv-series')
+ .on('mouseover', function(d,i) {
+ dispatch.legendMouseover(d,i); //TODO: Make consistent with other event objects
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.legendMouseout(d,i);
+ })
+ .on('click', function(d,i) {
+ dispatch.legendClick(d,i);
+ if (updateState) {
+ if (radioButtonMode) {
+ //Radio button mode: set every series to disabled,
+ // and enable the clicked series.
+ data.forEach(function(series) { series.disabled = true});
+ d.disabled = false;
+ }
+ else {
+ d.disabled = !d.disabled;
+ if (data.every(function(series) { return series.disabled})) {
+ //the default behavior of NVD3 legends is, if every single series
+ // is disabled, turn all series' back on.
+ data.forEach(function(series) { series.disabled = false});
+ }
+ }
+ dispatch.stateChange({
+ disabled: data.map(function(d) { return !!d.disabled })
+ });
+ }
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.legendDblclick(d,i);
+ if (updateState) {
+ //the default behavior of NVD3 legends, when double clicking one,
+ // is to set all other series' to false, and make the double clicked series enabled.
+ data.forEach(function(series) {
+ series.disabled = true;
+ });
+ d.disabled = false;
+ dispatch.stateChange({
+ disabled: data.map(function(d) { return !!d.disabled })
+ });
+ }
+ });
+ seriesEnter.append('circle')
+ .style('stroke-width', 2)
+ .attr('class','nv-legend-symbol')
+ .attr('r', 5);
+ seriesEnter.append('text')
+ .attr('text-anchor', 'start')
+ .attr('class','nv-legend-text')
+ .attr('dy', '.32em')
+ .attr('dx', '8');
+ series.classed('disabled', function(d) { return d.disabled });
+ series.exit().remove();
+ series.select('circle')
+ .style('fill', function(d,i) { return d.color || color(d,i)})
+ .style('stroke', function(d,i) { return d.color || color(d, i) });
+ series.select('text').text(getKey);
+
+
+ //TODO: implement fixed-width and max-width options (max-width is especially useful with the align option)
+
+ // NEW ALIGNING CODE, TODO: clean up
+ if (align) {
+
+ var seriesWidths = [];
+ series.each(function(d,i) {
+ var legendText = d3.select(this).select('text');
+ var nodeTextLength;
+ try {
+ nodeTextLength = legendText.node().getComputedTextLength();
+ }
+ catch(e) {
+ nodeTextLength = nv.utils.calcApproxTextWidth(legendText);
+ }
+
+ seriesWidths.push(nodeTextLength + 28); // 28 is ~ the width of the circle plus some padding
+ });
+
+ var seriesPerRow = 0;
+ var legendWidth = 0;
+ var columnWidths = [];
+
+ while ( legendWidth < availableWidth && seriesPerRow < seriesWidths.length) {
+ columnWidths[seriesPerRow] = seriesWidths[seriesPerRow];
+ legendWidth += seriesWidths[seriesPerRow++];
+ }
+ if (seriesPerRow === 0) seriesPerRow = 1; //minimum of one series per row
+
+
+ while ( legendWidth > availableWidth && seriesPerRow > 1 ) {
+ columnWidths = [];
+ seriesPerRow--;
+
+ for (var k = 0; k < seriesWidths.length; k++) {
+ if (seriesWidths[k] > (columnWidths[k % seriesPerRow] || 0) )
+ columnWidths[k % seriesPerRow] = seriesWidths[k];
+ }
+
+ legendWidth = columnWidths.reduce(function(prev, cur, index, array) {
+ return prev + cur;
+ });
+ }
+
+ var xPositions = [];
+ for (var i = 0, curX = 0; i < seriesPerRow; i++) {
+ xPositions[i] = curX;
+ curX += columnWidths[i];
+ }
+
+ series
+ .attr('transform', function(d, i) {
+ return 'translate(' + xPositions[i % seriesPerRow] + ',' + (5 + Math.floor(i / seriesPerRow) * 20) + ')';
+ });
+
+ //position legend as far right as possible within the total width
+ if (rightAlign) {
+ g.attr('transform', 'translate(' + (width - margin.right - legendWidth) + ',' + margin.top + ')');
+ }
+ else {
+ g.attr('transform', 'translate(0' + ',' + margin.top + ')');
+ }
+
+ height = margin.top + margin.bottom + (Math.ceil(seriesWidths.length / seriesPerRow) * 20);
+
+ } else {
+
+ var ypos = 5,
+ newxpos = 5,
+ maxwidth = 0,
+ xpos;
+ series
+ .attr('transform', function(d, i) {
+ var length = d3.select(this).select('text').node().getComputedTextLength() + 28;
+ xpos = newxpos;
+
+ if (width < margin.left + margin.right + xpos + length) {
+ newxpos = xpos = 5;
+ ypos += 20;
+ }
+
+ newxpos += length;
+ if (newxpos > maxwidth) maxwidth = newxpos;
+
+ return 'translate(' + xpos + ',' + ypos + ')';
+ });
+
+ //position legend as far right as possible within the total width
+ g.attr('transform', 'translate(' + (width - margin.right - maxwidth) + ',' + margin.top + ')');
+
+ height = margin.top + margin.bottom + ypos + 15;
+
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.key = function(_) {
+ if (!arguments.length) return getKey;
+ getKey = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.align = function(_) {
+ if (!arguments.length) return align;
+ align = _;
+ return chart;
+ };
+
+ chart.rightAlign = function(_) {
+ if (!arguments.length) return rightAlign;
+ rightAlign = _;
+ return chart;
+ };
+
+ chart.updateState = function(_) {
+ if (!arguments.length) return updateState;
+ updateState = _;
+ return chart;
+ };
+
+ chart.radioButtonMode = function(_) {
+ if (!arguments.length) return radioButtonMode;
+ radioButtonMode = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/line.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/line.js
new file mode 100644
index 00000000..855cc541
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/line.js
@@ -0,0 +1,284 @@
+
+nv.models.line = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ ;
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // a function that returns a color
+ , getX = function(d) { return d.x } // accessor to get the x value from a data point
+ , getY = function(d) { return d.y } // accessor to get the y value from a data point
+ , defined = function(d,i) { return !isNaN(getY(d,i)) && getY(d,i) !== null } // allows a line to be not continuous when it is not defined
+ , isArea = function(d) { return d.area } // decides if a line is an area or just a line
+ , clipEdge = false // if true, masks lines within x and y scale
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , interpolate = "linear" // controls the line interpolation
+ ;
+
+ scatter
+ .size(16) // default size
+ .sizeDomain([16,256]) //set to speed up calculation, needs to be unset if there is a custom size accessor
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-line').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-groups');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var scatterWrap = wrap.select('.nv-scatterWrap');
+ //.datum(data); // Data automatically trickles down from the wrap
+
+ scatterWrap.transition().call(scatter);
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + scatter.id())
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + scatter.id() + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : '');
+ scatterWrap
+ .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : '');
+
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit()
+ .transition()
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i)});
+ groups
+ .transition()
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .5);
+
+
+
+ var areaPaths = groups.selectAll('path.nv-area')
+ .data(function(d) { return isArea(d) ? [d] : [] }); // this is done differently than lines because I need to check if series is an area
+ areaPaths.enter().append('path')
+ .attr('class', 'nv-area')
+ .attr('d', function(d) {
+ return d3.svg.area()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) })
+ .y0(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) })
+ .y1(function(d,i) { return y0( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
+ //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
+ .apply(this, [d.values])
+ });
+ groups.exit().selectAll('path.nv-area')
+ .remove();
+
+ areaPaths
+ .transition()
+ .attr('d', function(d) {
+ return d3.svg.area()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .y0(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ .y1(function(d,i) { return y( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
+ //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
+ .apply(this, [d.values])
+ });
+
+
+
+ var linePaths = groups.selectAll('path.nv-line')
+ .data(function(d) { return [d.values] });
+ linePaths.enter().append('path')
+ .attr('class', 'nv-line')
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) })
+ .y(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) })
+ );
+ groups.exit().selectAll('path.nv-line')
+ .transition()
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .y(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ );
+ linePaths
+ .transition()
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .y(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ );
+
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = scatter.dispatch;
+ chart.scatter = scatter;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange',
+ 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'useVoronoi', 'clipRadius', 'padData','highlightPoint','clearHighlights');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ scatter.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ scatter.y(_);
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ scatter.color(color);
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ interpolate = _;
+ return chart;
+ };
+
+ chart.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return chart;
+ };
+
+ chart.isArea = function(_) {
+ if (!arguments.length) return isArea;
+ isArea = d3.functor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineChart.js
new file mode 100644
index 00000000..a4ffcf6a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineChart.js
@@ -0,0 +1,465 @@
+
+nv.models.lineChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , interactiveLayer = nv.interactiveGuideline()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , useInteractiveGuideline = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x
+ , y
+ , state = {}
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append("rect").style("opacity",0);
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-interactive');
+
+ g.select("rect").attr("width",availableWidth).attr("height",availableHeight);
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+
+ //------------------------------------------------------------
+ //Set up interactive layer
+ if (useInteractiveGuideline) {
+ interactiveLayer
+ .width(availableWidth)
+ .height(availableHeight)
+ .margin({left:margin.left, top:margin.top})
+ .svgContainer(container)
+ .xScale(x);
+ wrap.select(".nv-interactive").call(interactiveLayer);
+ }
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ linesWrap.transition().call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ g.select('.nv-x.nv-axis')
+ .transition()
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .transition()
+ .call(yAxis);
+ }
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ interactiveLayer.dispatch.on('elementMousemove', function(e) {
+ lines.clearHighlights();
+ var singlePoint, pointIndex, pointXLocation, allData = [];
+ data
+ .filter(function(series, i) {
+ series.seriesIndex = i;
+ return !series.disabled;
+ })
+ .forEach(function(series,i) {
+ pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x());
+ lines.highlightPoint(i, pointIndex, true);
+ var point = series.values[pointIndex];
+ if (typeof point === 'undefined') return;
+ if (typeof singlePoint === 'undefined') singlePoint = point;
+ if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex));
+ allData.push({
+ key: series.key,
+ value: chart.y()(point, pointIndex),
+ color: color(series,series.seriesIndex)
+ });
+ });
+ //Highlight the tooltip entry based on which point the mouse is closest to.
+ if (allData.length > 2) {
+ var yValue = chart.yScale().invert(e.mouseY);
+ var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]);
+ var threshold = 0.03 * domainExtent;
+ var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold);
+ if (indexToHighlight !== null)
+ allData[indexToHighlight].highlight = true;
+ }
+
+ var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));
+ interactiveLayer.tooltip
+ .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
+ .chartContainer(that.parentNode)
+ .enabled(tooltips)
+ .valueFormatter(function(d,i) {
+ return yAxis.tickFormat()(d);
+ })
+ .data(
+ {
+ value: xValue,
+ series: allData
+ }
+ )();
+
+ interactiveLayer.renderGuideLine(pointXLocation);
+
+ });
+
+ interactiveLayer.dispatch.on("elementMouseout",function(e) {
+ dispatch.tooltipHide();
+ lines.clearHighlights();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.lines = lines;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.interactiveLayer = interactiveLayer;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'xRange', 'yRange'
+ , 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'useVoronoi','id', 'interpolate');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.useInteractiveGuideline = function(_) {
+ if(!arguments.length) return useInteractiveGuideline;
+ useInteractiveGuideline = _;
+ if (_ === true) {
+ chart.interactive(false);
+ chart.useVoronoi(false);
+ }
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarChart.js
new file mode 100644
index 00000000..77fcbab7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarChart.js
@@ -0,0 +1,433 @@
+
+nv.models.linePlusBarChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , bars = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , y1Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 60, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.defaultColor()
+ , showLegend = true
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>';
+ }
+ , x
+ , y1
+ , y2
+ , state = {}
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ bars
+ .padData(true)
+ ;
+ lines
+ .clipEdge(false)
+ .padData(true)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ .highlightZero(false)
+ ;
+ y1Axis
+ .orient('left')
+ ;
+ y2Axis
+ .orient('right')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ }
+ ;
+
+ //------------------------------------------------------------
+
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ // chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ var dataBars = data.filter(function(d) { return !d.disabled && d.bar });
+ var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240
+
+ //x = xAxis.scale();
+ x = dataLines.filter(function(d) { return !d.disabled; }).length && dataLines.filter(function(d) { return !d.disabled; })[0].values.length ? lines.xScale() : bars.xScale();
+ //x = dataLines.filter(function(d) { return !d.disabled; }).length ? lines.xScale() : bars.xScale(); //old code before change above
+ y1 = bars.yScale();
+ y2 = lines.yScale();
+
+ //------------------------------------------------------------
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-linePlusBar').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ gEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.nv-legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }))
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }))
+
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(dataBars.length ? dataBars : [{values:[]}])
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(dataLines[0] && !dataLines[0].disabled ? dataLines : [{values:[]}] );
+ //.datum(!dataLines[0].disabled ? dataLines : [{values:dataLines[0].values.map(function(d) { return [d[0], null] }) }] );
+
+ d3.transition(barsWrap).call(bars);
+ d3.transition(linesWrap).call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y1.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+
+ y1Axis
+ .scale(y1)
+ .ticks( availableHeight / 36 )
+ .tickSize(-availableWidth, 0);
+
+ d3.transition(g.select('.nv-y1.nv-axis'))
+ .style('opacity', dataBars.length ? 1 : 0)
+ .call(y1Axis);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + availableWidth + ',0)');
+ //.attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ d3.transition(g.select('.nv-y2.nv-axis'))
+ .call(y2Axis);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.bars = bars;
+ chart.xAxis = xAxis;
+ chart.y1Axis = y1Axis;
+ chart.y2Axis = y2Axis;
+
+ d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate');
+ //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc.
+ //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines.x(_);
+ bars.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines.y(_);
+ bars.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarWithFocusChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarWithFocusChart.js
new file mode 100644
index 00000000..2ef31137
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarWithFocusChart.js
@@ -0,0 +1,658 @@
+
+nv.models.linePlusBarWithFocusChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , lines2 = nv.models.line()
+ , bars = nv.models.historicalBar()
+ , bars2 = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , x2Axis = nv.models.axis()
+ , y1Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , y3Axis = nv.models.axis()
+ , y4Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ , brush = d3.svg.brush()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 30, left: 60}
+ , margin2 = {top: 0, right: 30, bottom: 20, left: 60}
+ , width = null
+ , height = null
+ , height2 = 100
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.defaultColor()
+ , showLegend = true
+ , extent
+ , brushExtent = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>';
+ }
+ , x
+ , x2
+ , y1
+ , y2
+ , y3
+ , y4
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
+ , transitionDuration = 0
+ ;
+
+ lines
+ .clipEdge(true)
+ ;
+ lines2
+ .interactive(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y1Axis
+ .orient('left')
+ ;
+ y2Axis
+ .orient('right')
+ ;
+ x2Axis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y3Axis
+ .orient('left')
+ ;
+ y4Axis
+ .orient('right')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ if (extent) {
+ e.pointIndex += Math.ceil(extent[0]);
+ }
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //------------------------------------------------------------
+
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2,
+ availableHeight2 = height2 - margin2.top - margin2.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight1 / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ var dataBars = data.filter(function(d) { return !d.disabled && d.bar });
+ var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240
+
+ x = bars.xScale();
+ x2 = x2Axis.scale();
+ y1 = bars.yScale();
+ y2 = lines.yScale();
+ y3 = bars2.yScale();
+ y4 = lines2.yScale();
+
+ var series1 = data
+ .filter(function(d) { return !d.disabled && d.bar })
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i) }
+ })
+ });
+
+ var series2 = data
+ .filter(function(d) { return !d.disabled && !d.bar })
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i) }
+ })
+ });
+
+ x .range([0, availableWidth]);
+
+ x2 .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } ))
+ .range([0, availableWidth]);
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-linePlusBar').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ var focusEnter = gEnter.append('g').attr('class', 'nv-focus');
+ focusEnter.append('g').attr('class', 'nv-x nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ focusEnter.append('g').attr('class', 'nv-barsWrap');
+ focusEnter.append('g').attr('class', 'nv-linesWrap');
+
+ var contextEnter = gEnter.append('g').attr('class', 'nv-context');
+ contextEnter.append('g').attr('class', 'nv-x nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ contextEnter.append('g').attr('class', 'nv-barsWrap');
+ contextEnter.append('g').attr('class', 'nv-linesWrap');
+ contextEnter.append('g').attr('class', 'nv-brushBackground');
+ contextEnter.append('g').attr('class', 'nv-x nv-brush');
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.nv-legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Context Components
+
+ bars2
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }));
+
+ lines2
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }));
+
+ var bars2Wrap = g.select('.nv-context .nv-barsWrap')
+ .datum(dataBars.length ? dataBars : [{values:[]}]);
+
+ var lines2Wrap = g.select('.nv-context .nv-linesWrap')
+ .datum(!dataLines[0].disabled ? dataLines : [{values:[]}]);
+
+ g.select('.nv-context')
+ .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')')
+
+ bars2Wrap.transition().call(bars2);
+ lines2Wrap.transition().call(lines2);
+
+ //------------------------------------------------------------
+
+
+
+ //------------------------------------------------------------
+ // Setup Brush
+
+ brush
+ .x(x2)
+ .on('brush', onBrush);
+
+ if (brushExtent) brush.extent(brushExtent);
+
+ var brushBG = g.select('.nv-brushBackground').selectAll('g')
+ .data([brushExtent || brush.extent()])
+
+ var brushBGenter = brushBG.enter()
+ .append('g');
+
+ brushBGenter.append('rect')
+ .attr('class', 'left')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ brushBGenter.append('rect')
+ .attr('class', 'right')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ var gBrush = g.select('.nv-x.nv-brush')
+ .call(brush);
+ gBrush.selectAll('rect')
+ //.attr('y', -5)
+ .attr('height', availableHeight2);
+ gBrush.selectAll('.resize').append('path').attr('d', resizePath);
+
+ //------------------------------------------------------------
+
+ //------------------------------------------------------------
+ // Setup Secondary (Context) Axes
+
+ x2Axis
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight2, 0);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y3.range()[0] + ')');
+ g.select('.nv-context .nv-x.nv-axis').transition()
+ .call(x2Axis);
+
+
+ y3Axis
+ .scale(y3)
+ .ticks( availableHeight2 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-context .nv-y1.nv-axis')
+ .style('opacity', dataBars.length ? 1 : 0)
+ .attr('transform', 'translate(0,' + x2.range()[0] + ')');
+
+ g.select('.nv-context .nv-y1.nv-axis').transition()
+ .call(y3Axis);
+
+
+ y4Axis
+ .scale(y4)
+ .ticks( availableHeight2 / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-context .nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + x2.range()[1] + ',0)');
+
+ g.select('.nv-context .nv-y2.nv-axis').transition()
+ .call(y4Axis);
+
+ //------------------------------------------------------------
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ // Taken from crossfilter (http://square.github.com/crossfilter/)
+ function resizePath(d) {
+ var e = +(d == 'e'),
+ x = e ? 1 : -1,
+ y = availableHeight2 / 3;
+ return 'M' + (.5 * x) + ',' + y
+ + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6)
+ + 'V' + (2 * y - 6)
+ + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y)
+ + 'Z'
+ + 'M' + (2.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8)
+ + 'M' + (4.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8);
+ }
+
+
+ function updateBrushBG() {
+ if (!brush.empty()) brush.extent(brushExtent);
+ brushBG
+ .data([brush.empty() ? x2.domain() : brushExtent])
+ .each(function(d,i) {
+ var leftWidth = x2(d[0]) - x2.range()[0],
+ rightWidth = x2.range()[1] - x2(d[1]);
+ d3.select(this).select('.left')
+ .attr('width', leftWidth < 0 ? 0 : leftWidth);
+
+ d3.select(this).select('.right')
+ .attr('x', x2(d[1]))
+ .attr('width', rightWidth < 0 ? 0 : rightWidth);
+ });
+ }
+
+
+ function onBrush() {
+ brushExtent = brush.empty() ? null : brush.extent();
+ extent = brush.empty() ? x2.domain() : brush.extent();
+
+
+ dispatch.brush({extent: extent, brush: brush});
+
+ updateBrushBG();
+
+
+ //------------------------------------------------------------
+ // Prepare Main (Focus) Bars and Lines
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }));
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }));
+
+ var focusBarsWrap = g.select('.nv-focus .nv-barsWrap')
+ .datum(!dataBars.length ? [{values:[]}] :
+ dataBars
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return bars.x()(d,i) >= extent[0] && bars.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(dataLines[0].disabled ? [{values:[]}] :
+ dataLines
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Update Main (Focus) X Axis
+
+ if (dataBars.length) {
+ x = bars.xScale();
+ } else {
+ x = lines.xScale();
+ }
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight1, 0);
+
+ xAxis.domain([Math.ceil(extent[0]), Math.floor(extent[1])]);
+
+ g.select('.nv-x.nv-axis').transition().duration(transitionDuration)
+ .call(xAxis);
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Update Main (Focus) Bars and Lines
+
+ focusBarsWrap.transition().duration(transitionDuration).call(bars);
+ focusLinesWrap.transition().duration(transitionDuration).call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup and Update Main (Focus) Y Axes
+
+ g.select('.nv-focus .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y1.range()[0] + ')');
+
+
+ y1Axis
+ .scale(y1)
+ .ticks( availableHeight1 / 36 )
+ .tickSize(-availableWidth, 0);
+
+ g.select('.nv-focus .nv-y1.nv-axis')
+ .style('opacity', dataBars.length ? 1 : 0);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight1 / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-focus .nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ g.select('.nv-focus .nv-y1.nv-axis').transition().duration(transitionDuration)
+ .call(y1Axis);
+ g.select('.nv-focus .nv-y2.nv-axis').transition().duration(transitionDuration)
+ .call(y2Axis);
+ }
+
+ //============================================================
+
+ onBrush();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.lines2 = lines2;
+ chart.bars = bars;
+ chart.bars2 = bars2;
+ chart.xAxis = xAxis;
+ chart.x2Axis = x2Axis;
+ chart.y1Axis = y1Axis;
+ chart.y2Axis = y2Axis;
+ chart.y3Axis = y3Axis;
+ chart.y4Axis = y4Axis;
+
+ d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate');
+ //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc.
+ //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines.x(_);
+ bars.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines.y(_);
+ bars.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.brushExtent = function(_) {
+ if (!arguments.length) return brushExtent;
+ brushExtent = _;
+ return chart;
+ };
+
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheye.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheye.js
new file mode 100644
index 00000000..2b411672
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheye.js
@@ -0,0 +1,200 @@
+
+nv.models.line = function() {
+ "use strict";
+ //Default Settings
+ var margin = {top: 0, right: 0, bottom: 0, left: 0},
+ width = 960,
+ height = 500,
+ color = nv.utils.defaultColor(), // function that returns colors
+ id = Math.floor(Math.random() * 10000), //Create semi-unique ID incase user doesn't select one
+ getX = function(d) { return d.x }, // accessor to get the x value from a data point
+ getY = function(d) { return d.y }, // accessor to get the y value from a data point
+ clipEdge = false, // if true, masks lines within x and y scale
+ interpolate = "linear"; // controls the line interpolation
+
+
+ var scatter = nv.models.scatter()
+ .id(id)
+ .size(16) // default size
+ .sizeDomain([16,256]), //set to speed up calculation, needs to be unset if there is a custom size accessor
+ //x = scatter.xScale(),
+ //y = scatter.yScale(),
+ x, y,
+ x0, y0, timeoutID;
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom;
+
+ //get the scales inscase scatter scale was set manually
+ x = x || scatter.xScale();
+ y = y || scatter.yScale();
+
+ //store old scales if they exist
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-line').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ wrapEnter.append('g').attr('class', 'nv-scatterWrap');
+ var scatterWrap = wrap.select('.nv-scatterWrap').datum(data);
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+
+ d3.transition(scatterWrap).call(scatter);
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+ scatterWrap
+ .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) })
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .5)
+
+
+ var paths = groups.selectAll('path')
+ .data(function(d, i) { return [d.values] });
+ paths.enter().append('path')
+ .attr('class', 'nv-line')
+ .attr('d', d3.svg.line()
+ .interpolate(interpolate)
+ .x(function(d,i) { return x0(getX(d,i)) })
+ .y(function(d,i) { return y0(getY(d,i)) })
+ );
+ d3.transition(groups.exit().selectAll('path'))
+ .attr('d', d3.svg.line()
+ .interpolate(interpolate)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ )
+ .remove(); // redundant? line is already being removed
+ d3.transition(paths)
+ .attr('d', d3.svg.line()
+ .interpolate(interpolate)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ );
+
+
+ //store old scales for use in transitions on update, to animate from old to new positions
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ chart.dispatch = scatter.dispatch;
+
+ d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ scatter.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ scatter.y(_);
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ scatter.color(color);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ interpolate = _;
+ return chart;
+ };
+
+ chart.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return chart;
+ };
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheyeChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheyeChart.js
new file mode 100644
index 00000000..ad894190
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheyeChart.js
@@ -0,0 +1,297 @@
+
+nv.models.lineChart = function() {
+ "use strict";
+ var margin = {top: 30, right: 20, bottom: 50, left: 60},
+ color = nv.utils.defaultColor(),
+ width = null,
+ height = null,
+ showLegend = true,
+ showControls = true,
+ fisheye = 0,
+ pauseFisheye = false,
+ tooltips = true,
+ tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ },
+ noData = "No Data Available."
+ ;
+
+
+ var x = d3.fisheye.scale(d3.scale.linear).distortion(0);
+
+ var lines = nv.models.line().xScale(x),
+ //x = lines.xScale(),
+ y = lines.yScale(),
+ xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5),
+ yAxis = nv.models.axis().scale(y).orient('left'),
+ legend = nv.models.legend().height(30),
+ controls = nv.models.legend().height(30).updateState(false),
+ dispatch = d3.dispatch('tooltipShow', 'tooltipHide');
+
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+
+ var controlsData = [
+ { key: 'Magnify', disabled: true }
+ ];
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart) };
+ chart.container = this; // I need a reference to the container in order to have outside code check if the chart is visible or not
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ container.append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('x', availableWidth / 2)
+ .attr('y', availableHeight / 2)
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle')
+ .text(noData);
+ return chart;
+ } else {
+ container.select('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g');
+
+
+ gEnter.append('rect')
+ .attr('class', 'nvd3 nv-background')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+
+ var g = wrap.select('g');
+
+
+
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ if (showControls) {
+ controls.width(180).color(['#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+
+ g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(linesWrap).call(lines);
+
+
+
+ xAxis
+ //.scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+
+ yAxis
+ //.scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+
+
+ g.select('.nv-background').on('mousemove', updateFisheye);
+ g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye; });
+ //g.select('.point-paths').on('mousemove', updateFisheye);
+
+
+ function updateFisheye() {
+ if (pauseFisheye) {
+ //g.select('.background') .style('pointer-events', 'none');
+ g.select('.nv-point-paths').style('pointer-events', 'all');
+ return false;
+ }
+
+ g.select('.nv-background') .style('pointer-events', 'all');
+ g.select('.nv-point-paths').style('pointer-events', 'none' );
+
+ var mouse = d3.mouse(this);
+ linesWrap.call(lines);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ x.distortion(fisheye).focus(mouse[0]);
+ }
+
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ fisheye = d.disabled ? 0 : 5;
+ g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all');
+ g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' );
+
+ //scatter.interactive(d.disabled);
+ //tooltips = d.disabled;
+
+ if (d.disabled) {
+ x.distortion(fisheye).focus(0);
+
+ linesWrap.call(lines);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ } else {
+ pauseFisheye = false;
+ }
+
+ chart.update();
+ });
+
+
+ legend.dispatch.on('stateChange', function(newState) {
+ chart.update();
+ });
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+ if (tooltips) dispatch.on('tooltipShow', function(e) { showTooltip(e, that.parentNode) } ); // TODO: maybe merge with above?
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ if (tooltips) dispatch.on('tooltipHide', nv.tooltip.cleanup);
+
+ });
+
+ return chart;
+ }
+
+
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, lines, 'defined', 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFocusChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFocusChart.js
new file mode 100644
index 00000000..0afd28bd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFocusChart.js
@@ -0,0 +1,574 @@
+nv.models.lineWithFocusChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , lines2 = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , x2Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ , brush = d3.svg.brush()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 30, left: 60}
+ , margin2 = {top: 0, right: 30, bottom: 20, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , height2 = 100
+ , x
+ , y
+ , x2
+ , y2
+ , showLegend = true
+ , brushExtent = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
+ , transitionDuration = 250
+ ;
+
+ lines
+ .clipEdge(true)
+ ;
+ lines2
+ .interactive(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ yAxis
+ .orient('left')
+ ;
+ x2Axis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y2Axis
+ .orient('left')
+ ;
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2,
+ availableHeight2 = height2 - margin2.top - margin2.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight1 / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+ x2 = lines2.xScale();
+ y2 = lines2.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineWithFocusChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineWithFocusChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ var focusEnter = gEnter.append('g').attr('class', 'nv-focus');
+ focusEnter.append('g').attr('class', 'nv-x nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y nv-axis');
+ focusEnter.append('g').attr('class', 'nv-linesWrap');
+
+ var contextEnter = gEnter.append('g').attr('class', 'nv-context');
+ contextEnter.append('g').attr('class', 'nv-x nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y nv-axis');
+ contextEnter.append('g').attr('class', 'nv-linesWrap');
+ contextEnter.append('g').attr('class', 'nv-brushBackground');
+ contextEnter.append('g').attr('class', 'nv-x nv-brush');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(
+ data
+ .map(function(d,i) {
+ return d.color || color(d, i);
+ })
+ .filter(function(d,i) {
+ return !data[i].disabled;
+ })
+ );
+
+ lines2
+ .defined(lines.defined())
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(
+ data
+ .map(function(d,i) {
+ return d.color || color(d, i);
+ })
+ .filter(function(d,i) {
+ return !data[i].disabled;
+ })
+ );
+
+ g.select('.nv-context')
+ .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')')
+
+ var contextLinesWrap = g.select('.nv-context .nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(contextLinesWrap).call(lines2);
+
+ //------------------------------------------------------------
+
+
+ /*
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(focusLinesWrap).call(lines);
+ */
+
+
+ //------------------------------------------------------------
+ // Setup Main (Focus) Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight1, 0);
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight1 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-focus .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight1 + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Brush
+
+ brush
+ .x(x2)
+ .on('brush', function() {
+ //When brushing, turn off transitions because chart needs to change immediately.
+ var oldTransition = chart.transitionDuration();
+ chart.transitionDuration(0);
+ onBrush();
+ chart.transitionDuration(oldTransition);
+ });
+
+ if (brushExtent) brush.extent(brushExtent);
+
+ var brushBG = g.select('.nv-brushBackground').selectAll('g')
+ .data([brushExtent || brush.extent()])
+
+ var brushBGenter = brushBG.enter()
+ .append('g');
+
+ brushBGenter.append('rect')
+ .attr('class', 'left')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ brushBGenter.append('rect')
+ .attr('class', 'right')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ var gBrush = g.select('.nv-x.nv-brush')
+ .call(brush);
+ gBrush.selectAll('rect')
+ //.attr('y', -5)
+ .attr('height', availableHeight2);
+ gBrush.selectAll('.resize').append('path').attr('d', resizePath);
+
+ onBrush();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Secondary (Context) Axes
+
+ x2Axis
+ .scale(x2)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight2, 0);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y2.range()[0] + ')');
+ d3.transition(g.select('.nv-context .nv-x.nv-axis'))
+ .call(x2Axis);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight2 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-context .nv-y.nv-axis'))
+ .call(y2Axis);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y2.range()[0] + ')');
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ // Taken from crossfilter (http://square.github.com/crossfilter/)
+ function resizePath(d) {
+ var e = +(d == 'e'),
+ x = e ? 1 : -1,
+ y = availableHeight2 / 3;
+ return 'M' + (.5 * x) + ',' + y
+ + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6)
+ + 'V' + (2 * y - 6)
+ + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y)
+ + 'Z'
+ + 'M' + (2.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8)
+ + 'M' + (4.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8);
+ }
+
+
+ function updateBrushBG() {
+ if (!brush.empty()) brush.extent(brushExtent);
+ brushBG
+ .data([brush.empty() ? x2.domain() : brushExtent])
+ .each(function(d,i) {
+ var leftWidth = x2(d[0]) - x.range()[0],
+ rightWidth = x.range()[1] - x2(d[1]);
+ d3.select(this).select('.left')
+ .attr('width', leftWidth < 0 ? 0 : leftWidth);
+
+ d3.select(this).select('.right')
+ .attr('x', x2(d[1]))
+ .attr('width', rightWidth < 0 ? 0 : rightWidth);
+ });
+ }
+
+
+ function onBrush() {
+ brushExtent = brush.empty() ? null : brush.extent();
+ var extent = brush.empty() ? x2.domain() : brush.extent();
+
+ //The brush extent cannot be less than one. If it is, don't update the line chart.
+ if (Math.abs(extent[0] - extent[1]) <= 1) {
+ return;
+ }
+
+ dispatch.brush({extent: extent, brush: brush});
+
+
+ updateBrushBG();
+
+ // Update Main (Focus)
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(
+ data
+ .filter(function(d) { return !d.disabled })
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+ focusLinesWrap.transition().duration(transitionDuration).call(lines);
+
+
+ // Update Main (Focus) Axes
+ g.select('.nv-focus .nv-x.nv-axis').transition().duration(transitionDuration)
+ .call(xAxis);
+ g.select('.nv-focus .nv-y.nv-axis').transition().duration(transitionDuration)
+ .call(yAxis);
+ }
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.lines2 = lines2;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.x2Axis = x2Axis;
+ chart.y2Axis = y2Axis;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return lines.x;
+ lines.x(_);
+ lines2.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return lines.y;
+ lines.y(_);
+ lines2.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.margin2 = function(_) {
+ if (!arguments.length) return margin2;
+ margin2 = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.height2 = function(_) {
+ if (!arguments.length) return height2;
+ height2 = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color =nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return lines.interpolate();
+ lines.interpolate(_);
+ lines2.interpolate(_);
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ // Chart has multiple similar Axes, to prevent code duplication, probably need to link all axis functions manually like below
+ chart.xTickFormat = function(_) {
+ if (!arguments.length) return xAxis.tickFormat();
+ xAxis.tickFormat(_);
+ x2Axis.tickFormat(_);
+ return chart;
+ };
+
+ chart.yTickFormat = function(_) {
+ if (!arguments.length) return yAxis.tickFormat();
+ yAxis.tickFormat(_);
+ y2Axis.tickFormat(_);
+ return chart;
+ };
+
+ chart.brushExtent = function(_) {
+ if (!arguments.length) return brushExtent;
+ brushExtent = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBar.js
new file mode 100644
index 00000000..1085919b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBar.js
@@ -0,0 +1,461 @@
+
+nv.models.multiBar = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , clipEdge = true
+ , stacked = false
+ , stackOffset = 'zero' // options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function
+ , color = nv.utils.defaultColor()
+ , hideable = false
+ , barColor = null // adding the ability to set the color for each rather than the whole group
+ , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled
+ , delay = 1200
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , groupSpacing = 0.1
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ if(hideable && data.length) hideable = [{
+ values: data[0].values.map(function(d) {
+ return {
+ x: d.x,
+ y: 0,
+ series: d.series,
+ size: 0.01
+ };}
+ )}];
+
+ if (stacked)
+ data = d3.layout.stack()
+ .offset(stackOffset)
+ .values(function(d){ return d.values })
+ .y(getY)
+ (!data.length && hideable ? hideable : data);
+
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+
+ //------------------------------------------------------------
+ // HACK for negative value stacking
+ if (stacked)
+ data[0].values.map(function(d,i) {
+ var posBase = 0, negBase = 0;
+ data.map(function(d) {
+ var f = d.values[i]
+ f.size = Math.abs(f.y);
+ if (f.y<0) {
+ f.y1 = negBase;
+ negBase = negBase - f.size;
+ } else
+ {
+ f.y1 = f.size + posBase;
+ posBase = posBase + f.size;
+ }
+ });
+ });
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 }
+ })
+ });
+
+ x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands(xRange || [0, availableWidth], groupSpacing);
+
+ //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y1 : 0) }).concat(forceY)))
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 : d.y1 + d.y ) : d.y }).concat(forceY)))
+ .range(yRange || [availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d,i) { return i });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit()
+ .transition()
+ .selectAll('rect.nv-bar')
+ .delay(function(d,i) {
+ return i * delay/ data[0].values.length;
+ })
+ .attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) })
+ .attr('height', 0)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) });
+ groups
+ .transition()
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('rect.nv-bar')
+ .data(function(d) { return (hideable && !data.length) ? hideable.values : d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('rect')
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .attr('x', function(d,i,j) {
+ return stacked ? 0 : (j * x.rangeBand() / data.length )
+ })
+ .attr('y', function(d) { return y0(stacked ? d.y0 : 0) })
+ .attr('height', 0)
+ .attr('width', x.rangeBand() / (stacked ? 1 : data.length) )
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; })
+ ;
+ bars
+ .style('fill', function(d,i,j){ return color(d, j, i); })
+ .style('stroke', function(d,i,j){ return color(d, j, i); })
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .transition()
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; })
+
+ if (barColor) {
+ if (!disabled) disabled = data.map(function() { return true });
+ bars
+ .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); })
+ .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); });
+ }
+
+
+ if (stacked)
+ bars.transition()
+ .delay(function(d,i) {
+
+ return i * delay / data[0].values.length;
+ })
+ .attr('y', function(d,i) {
+
+ return y((stacked ? d.y1 : 0));
+ })
+ .attr('height', function(d,i) {
+ return Math.max(Math.abs(y(d.y + (stacked ? d.y0 : 0)) - y((stacked ? d.y0 : 0))),1);
+ })
+ .attr('x', function(d,i) {
+ return stacked ? 0 : (d.series * x.rangeBand() / data.length )
+ })
+ .attr('width', x.rangeBand() / (stacked ? 1 : data.length) );
+ else
+ bars.transition()
+ .delay(function(d,i) {
+ return i * delay/ data[0].values.length;
+ })
+ .attr('x', function(d,i) {
+ return d.series * x.rangeBand() / data.length
+ })
+ .attr('width', x.rangeBand() / data.length)
+ .attr('y', function(d,i) {
+ return getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 :
+ y(getY(d,i)) || 0;
+ })
+ .attr('height', function(d,i) {
+ return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) || 0;
+ });
+
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.stacked = function(_) {
+ if (!arguments.length) return stacked;
+ stacked = _;
+ return chart;
+ };
+
+ chart.stackOffset = function(_) {
+ if (!arguments.length) return stackOffset;
+ stackOffset = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.barColor = function(_) {
+ if (!arguments.length) return barColor;
+ barColor = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.disabled = function(_) {
+ if (!arguments.length) return disabled;
+ disabled = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.hideable = function(_) {
+ if (!arguments.length) return hideable;
+ hideable = _;
+ return chart;
+ };
+
+ chart.delay = function(_) {
+ if (!arguments.length) return delay;
+ delay = _;
+ return chart;
+ };
+
+ chart.groupSpacing = function(_) {
+ if (!arguments.length) return groupSpacing;
+ groupSpacing = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarChart.js
new file mode 100644
index 00000000..0323063f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarChart.js
@@ -0,0 +1,524 @@
+
+nv.models.multiBarChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var multibar = nv.models.multiBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , showControls = true
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , reduceXTicks = true // if false a tick will show for every data point
+ , staggerLabels = false
+ , rotateLabels = 0
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' on ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , state = { stacked: false }
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = function() { return showControls ? 180 : 0 }
+ , transitionDuration = 250
+ ;
+
+ multibar
+ .stacked(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ .highlightZero(true)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ controls.updateState(false);
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = multibar.xScale();
+ y = multibar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth - controlWidth());
+
+ if (multibar.barColor())
+ data.forEach(function(series,i) {
+ series.color = d3.rgb('#ccc').darker(i * 1.5).toString();
+ })
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Grouped', disabled: multibar.stacked() },
+ { key: 'Stacked', disabled: !multibar.stacked() }
+ ];
+
+ controls.width(controlWidth()).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ multibar
+ .disabled(data.map(function(series) { return series.disabled }))
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ barsWrap.transition().call(multibar);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ g.select('.nv-x.nv-axis').transition()
+ .call(xAxis);
+
+ var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g');
+
+ xTicks
+ .selectAll('line, text')
+ .style('opacity', 1)
+
+ if (staggerLabels) {
+ var getTranslate = function(x,y) {
+ return "translate(" + x + "," + y + ")";
+ };
+
+ var staggerUp = 5, staggerDown = 17; //pixels to stagger by
+ // Issue #140
+ xTicks
+ .selectAll("text")
+ .attr('transform', function(d,i,j) {
+ return getTranslate(0, (j % 2 == 0 ? staggerUp : staggerDown));
+ });
+
+ var totalInBetweenTicks = d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;
+ g.selectAll(".nv-x.nv-axis .nv-axisMaxMin text")
+ .attr("transform", function(d,i) {
+ return getTranslate(0, (i === 0 || totalInBetweenTicks % 2 !== 0) ? staggerDown : staggerUp);
+ });
+ }
+
+ if (reduceXTicks)
+ xTicks
+ .filter(function(d,i) {
+ return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0;
+ })
+ .selectAll('text, line')
+ .style('opacity', 0);
+
+ if(rotateLabels)
+ xTicks
+ .selectAll('.tick text')
+ .attr('transform', 'rotate(' + rotateLabels + ' 0,0)')
+ .style('text-anchor', rotateLabels > 0 ? 'start' : 'end');
+
+ g.select('.nv-x.nv-axis').selectAll('g.nv-axisMaxMin text')
+ .style('opacity', 1);
+ }
+
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis').transition()
+ .call(yAxis);
+ }
+
+
+ //------------------------------------------------------------
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Grouped':
+ multibar.stacked(false);
+ break;
+ case 'Stacked':
+ multibar.stacked(true);
+ break;
+ }
+
+ state.stacked = multibar.stacked();
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode)
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.stacked !== 'undefined') {
+ multibar.stacked(e.stacked);
+ state.stacked = e.stacked;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ multibar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ multibar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.multibar = multibar;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge',
+ 'id', 'stacked', 'stackOffset', 'delay', 'barColor','groupSpacing');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.reduceXTicks= function(_) {
+ if (!arguments.length) return reduceXTicks;
+ reduceXTicks = _;
+ return chart;
+ };
+
+ chart.rotateLabels = function(_) {
+ if (!arguments.length) return rotateLabels;
+ rotateLabels = _;
+ return chart;
+ }
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontal.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontal.js
new file mode 100644
index 00000000..d16d4605
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontal.js
@@ -0,0 +1,424 @@
+
+nv.models.multiBarHorizontal = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , color = nv.utils.defaultColor()
+ , barColor = null // adding the ability to set the color for each rather than the whole group
+ , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled
+ , stacked = false
+ , showValues = false
+ , valuePadding = 60
+ , valueFormat = d3.format(',.2f')
+ , delay = 1200
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ if (stacked)
+ data = d3.layout.stack()
+ .offset('zero')
+ .values(function(d){ return d.values })
+ .y(getY)
+ (data);
+
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+
+
+ //------------------------------------------------------------
+ // HACK for negative value stacking
+ if (stacked)
+ data[0].values.map(function(d,i) {
+ var posBase = 0, negBase = 0;
+ data.map(function(d) {
+ var f = d.values[i]
+ f.size = Math.abs(f.y);
+ if (f.y<0) {
+ f.y1 = negBase - f.size;
+ negBase = negBase - f.size;
+ } else
+ {
+ f.y1 = posBase;
+ posBase = posBase + f.size;
+ }
+ });
+ });
+
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 }
+ })
+ });
+
+ x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands(xRange || [0, availableHeight], .1);
+
+ //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY)))
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 + d.y : d.y1 ) : d.y }).concat(forceY)))
+
+ if (showValues && !stacked)
+ y.range(yRange || [(y.domain()[0] < 0 ? valuePadding : 0), availableWidth - (y.domain()[1] > 0 ? valuePadding : 0) ]);
+ else
+ y.range(yRange || [0, availableWidth]);
+
+ x0 = x0 || x;
+ y0 = y0 || d3.scale.linear().domain(y.domain()).range([y(0),y(0)]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-multibarHorizontal').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibarHorizontal');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d,i) { return i });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit().transition()
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) });
+ groups.transition()
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('g.nv-bar')
+ .data(function(d) { return d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('g')
+ .attr('transform', function(d,i,j) {
+ return 'translate(' + y0(stacked ? d.y0 : 0) + ',' + (stacked ? 0 : (j * x.rangeBand() / data.length ) + x(getX(d,i))) + ')'
+ });
+
+ barsEnter.append('rect')
+ .attr('width', 0)
+ .attr('height', x.rangeBand() / (stacked ? 1 : data.length) )
+
+ bars
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [ y(getY(d,i) + (stacked ? d.y0 : 0)), x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length) ],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+
+
+ barsEnter.append('text');
+
+ if (showValues && !stacked) {
+ bars.select('text')
+ .attr('text-anchor', function(d,i) { return getY(d,i) < 0 ? 'end' : 'start' })
+ .attr('y', x.rangeBand() / (data.length * 2))
+ .attr('dy', '.32em')
+ .text(function(d,i) { return valueFormat(getY(d,i)) })
+ bars.transition()
+ .select('text')
+ .attr('x', function(d,i) { return getY(d,i) < 0 ? -4 : y(getY(d,i)) - y(0) + 4 })
+ } else {
+ bars.selectAll('text').text('');
+ }
+
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+
+ if (barColor) {
+ if (!disabled) disabled = data.map(function() { return true });
+ bars
+ .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); })
+ .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); });
+ }
+
+ if (stacked)
+ bars.transition()
+ .attr('transform', function(d,i) {
+ return 'translate(' + y(d.y1) + ',' + x(getX(d,i)) + ')'
+ })
+ .select('rect')
+ .attr('width', function(d,i) {
+ return Math.abs(y(getY(d,i) + d.y0) - y(d.y0))
+ })
+ .attr('height', x.rangeBand() );
+ else
+ bars.transition()
+ .attr('transform', function(d,i) {
+ //TODO: stacked must be all positive or all negative, not both?
+ return 'translate(' +
+ (getY(d,i) < 0 ? y(getY(d,i)) : y(0))
+ + ',' +
+ (d.series * x.rangeBand() / data.length
+ +
+ x(getX(d,i)) )
+ + ')'
+ })
+ .select('rect')
+ .attr('height', x.rangeBand() / data.length )
+ .attr('width', function(d,i) {
+ return Math.max(Math.abs(y(getY(d,i)) - y(0)),1)
+ });
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.stacked = function(_) {
+ if (!arguments.length) return stacked;
+ stacked = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.barColor = function(_) {
+ if (!arguments.length) return barColor;
+ barColor = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.disabled = function(_) {
+ if (!arguments.length) return disabled;
+ disabled = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.delay = function(_) {
+ if (!arguments.length) return delay;
+ delay = _;
+ return chart;
+ };
+
+ chart.showValues = function(_) {
+ if (!arguments.length) return showValues;
+ showValues = _;
+ return chart;
+ };
+
+ chart.valueFormat= function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.valuePadding = function(_) {
+ if (!arguments.length) return valuePadding;
+ valuePadding = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontalChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontalChart.js
new file mode 100644
index 00000000..02aa6fa4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontalChart.js
@@ -0,0 +1,434 @@
+
+nv.models.multiBarHorizontalChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var multibar = nv.models.multiBarHorizontal()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend().height(30)
+ , controls = nv.models.legend().height(30)
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , showControls = true
+ , showLegend = true
+ , stacked = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + ' - ' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , state = { stacked: stacked }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = function() { return showControls ? 180 : 0 }
+ , transitionDuration = 250
+ ;
+
+ multibar
+ .stacked(stacked)
+ ;
+ xAxis
+ .orient('left')
+ .tickPadding(5)
+ .highlightZero(false)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient('bottom')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ controls.updateState(false);
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = multibar.xScale();
+ y = multibar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multiBarHorizontalChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarHorizontalChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth - controlWidth());
+
+ if (multibar.barColor())
+ data.forEach(function(series,i) {
+ series.color = d3.rgb('#ccc').darker(i * 1.5).toString();
+ })
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Grouped', disabled: multibar.stacked() },
+ { key: 'Stacked', disabled: !multibar.stacked() }
+ ];
+
+ controls.width(controlWidth()).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ multibar
+ .disabled(data.map(function(series) { return series.disabled }))
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ barsWrap.transition().call(multibar);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableHeight / 24 )
+ .tickSize(-availableWidth, 0);
+
+ g.select('.nv-x.nv-axis').transition()
+ .call(xAxis);
+
+ var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
+
+ xTicks
+ .selectAll('line, text')
+ .style('opacity', 1)
+
+
+ yAxis
+ .scale(y)
+ .ticks( availableWidth / 100 )
+ .tickSize( -availableHeight, 0);
+
+ g.select('.nv-y.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+ g.select('.nv-y.nv-axis').transition()
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Grouped':
+ multibar.stacked(false);
+ break;
+ case 'Stacked':
+ multibar.stacked(true);
+ break;
+ }
+
+ state.stacked = multibar.stacked();
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.stacked !== 'undefined') {
+ multibar.stacked(e.stacked);
+ state.stacked = e.stacked;
+ }
+
+ selection.call(chart);
+ });
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ multibar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ multibar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.multibar = multibar;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge', 'id', 'delay', 'showValues', 'valueFormat', 'stacked', 'barColor');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarTimeSeries.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarTimeSeries.js
new file mode 100644
index 00000000..abc062c3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarTimeSeries.js
@@ -0,0 +1,384 @@
+nv.models.multiBarTimeSeries = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , x = d3.time.scale()
+ , y = d3.scale.linear()
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , clipEdge = true
+ , stacked = false
+ , color = nv.utils.defaultColor()
+ , delay = 1200
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ if (stacked)
+ data = d3.layout.stack()
+ .offset('zero')
+ .values(function(d){ return d.values })
+ .y(getY)
+ (data);
+
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0 }
+ })
+ });
+
+ x .domain(xDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.x })))
+ .range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY)))
+ .range(yRange || [availableHeight, 0]);
+
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ //.style('stroke-opacity', 1e-6)
+ //.style('fill-opacity', 1e-6)
+ .selectAll('rect.nv-bar')
+ .delay(function(d,i) { return i * delay/ data[0].values.length })
+ .attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) })
+ .attr('height', 0)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) });
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('rect.nv-bar')
+ .data(function(d) { return d.values });
+
+ bars.exit().remove();
+
+ var maxElements = 0;
+ for(var ei=0; ei<seriesData.length; ei+=1) {
+ maxElements = Math.max(seriesData[ei].length, maxElements);
+ }
+
+ var bandWidth = (availableWidth / maxElements)-0.1;
+ var barWidth = bandWidth / data.length;
+
+ var barsEnter = bars.enter().append('rect')
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .attr('x', function(d,i,j) {
+ return stacked ? 0 : (i * bandWidth) + ( j * barWidth )
+ })
+ .attr('y', function(d) { return y0(stacked ? d.y0 : 0) })
+ .attr('height', 0)
+ .attr('width', stacked ? bandWidth : barWidth );
+ bars
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (barWidth * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (barWidth * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (barWidth * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; })
+ if (stacked)
+ d3.transition(bars)
+ .delay(function(d,i) { return i * delay / data[0].values.length })
+ .attr('y', function(d,i) {
+ return y(getY(d,i) + (stacked ? d.y0 : 0));
+ })
+ .attr('height', function(d,i) {
+ return Math.abs(y(d.y + (stacked ? d.y0 : 0)) - y((stacked ? d.y0 : 0)))
+ })
+ .each('end', function() {
+ d3.transition(d3.select(this))
+ .attr('x', function(d,i) {
+ return stacked ? 0 : (i * bandWidth) + ( j * barWidth )
+ })
+ .attr('width', stacked ? bandWidth : barWidth );
+ })
+ else
+ d3.transition(bars)
+ .delay(function(d,i) { return i * delay/ data[0].values.length })
+ .attr('x', function(d,i) {
+ return d.series * barWidth
+ })
+ .attr('width', barWidth)
+ .each('end', function() {
+ d3.transition(d3.select(this))
+ .attr('y', function(d,i) {
+ return getY(d,i) < 0 ?
+ y(0) :
+ y(getY(d,i))
+ })
+ .attr('height', function(d,i) {
+ return Math.abs(y(getY(d,i)) - y(0))
+ });
+ })
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.stacked = function(_) {
+ if (!arguments.length) return stacked;
+ stacked = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.delay = function(_) {
+ if (!arguments.length) return delay;
+ delay = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarTimeSeriesChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarTimeSeriesChart.js
new file mode 100644
index 00000000..5aebafa7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarTimeSeriesChart.js
@@ -0,0 +1,405 @@
+nv.models.multiBarTimeSeriesChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var multibar = nv.models.multiBarTimeSeries()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , showControls = true
+ , showLegend = true
+ , reduceXTicks = true // if false a tick will show for every data point
+ , rotateLabels = 0
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' on ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
+ ;
+
+ multibar
+ .stacked(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ .highlightZero(false)
+ .showMaxMin(false)
+ ;
+ yAxis
+ .orient('left')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { selection.transition().call(chart) };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = multibar.xScale();
+ y = multibar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth / 2);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Grouped', disabled: multibar.stacked() },
+ { key: 'Stacked', disabled: !multibar.stacked() }
+ ];
+
+ controls.width(180).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ multibar
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(barsWrap).call(multibar);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks(availableWidth / 100)
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+ var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g');
+
+ xTicks
+ .selectAll('line, text')
+ .style('opacity', 1)
+
+ if (reduceXTicks)
+ xTicks
+ .filter(function(d,i) {
+ return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0;
+ })
+ .selectAll('text, line')
+ .style('opacity', 0);
+
+ if(rotateLabels)
+ xTicks
+ .selectAll('text')
+ .attr('transform', function(d,i,j) { return 'rotate('+rotateLabels+' 0,0)' })
+ .attr('text-transform', rotateLabels > 0 ? 'start' : 'end');
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ selection.transition().call(chart);
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Grouped':
+ multibar.stacked(false);
+ break;
+ case 'Stacked':
+ multibar.stacked(true);
+ break;
+ }
+
+ selection.transition().call(chart);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode)
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ multibar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ multibar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.multibar = multibar;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge', 'id', 'stacked', 'delay');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.reduceXTicks= function(_) {
+ if (!arguments.length) return reduceXTicks;
+ reduceXTicks = _;
+ return chart;
+ };
+
+ chart.rotateLabels = function(_) {
+ if (!arguments.length) return rotateLabels;
+ rotateLabels = _;
+ return chart;
+ }
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiChart.js
new file mode 100644
index 00000000..e3e2c5e8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiChart.js
@@ -0,0 +1,452 @@
+nv.models.multiChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60},
+ color = d3.scale.category20().range(),
+ width = null,
+ height = null,
+ showLegend = true,
+ tooltips = true,
+ tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ },
+ x,
+ y,
+ yDomain1,
+ yDomain2
+ ; //can be accessed via chart.lines.[x/y]Scale()
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x = d3.scale.linear(),
+ yScale1 = d3.scale.linear(),
+ yScale2 = d3.scale.linear(),
+
+ lines1 = nv.models.line().yScale(yScale1),
+ lines2 = nv.models.line().yScale(yScale2),
+
+ bars1 = nv.models.multiBar().stacked(false).yScale(yScale1),
+ bars2 = nv.models.multiBar().stacked(false).yScale(yScale2),
+
+ stack1 = nv.models.stackedArea().yScale(yScale1),
+ stack2 = nv.models.stackedArea().yScale(yScale2),
+
+ xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5),
+ yAxis1 = nv.models.axis().scale(yScale1).orient('left'),
+ yAxis2 = nv.models.axis().scale(yScale2).orient('right'),
+
+ legend = nv.models.legend().height(30),
+ dispatch = d3.dispatch('tooltipShow', 'tooltipHide');
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines1.x()(e.point, e.pointIndex)),
+ y = ((e.series.yAxis == 2) ? yAxis2 : yAxis1).tickFormat()(lines1.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, undefined, undefined, offsetElement.offsetParent);
+ };
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ var dataLines1 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 1})
+ var dataLines2 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 2})
+ var dataBars1 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 1})
+ var dataBars2 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 2})
+ var dataStack1 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 1})
+ var dataStack2 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 2})
+
+ var series1 = data.filter(function(d) {return !d.disabled && d.yAxis == 1})
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: d.x, y: d.y }
+ })
+ })
+
+ var series2 = data.filter(function(d) {return !d.disabled && d.yAxis == 2})
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: d.x, y: d.y }
+ })
+ })
+
+ x .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } ))
+ .range([0, availableWidth]);
+
+ var wrap = container.selectAll('g.wrap.multiChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 multiChart').append('g');
+
+ gEnter.append('g').attr('class', 'x axis');
+ gEnter.append('g').attr('class', 'y1 axis');
+ gEnter.append('g').attr('class', 'y2 axis');
+ gEnter.append('g').attr('class', 'lines1Wrap');
+ gEnter.append('g').attr('class', 'lines2Wrap');
+ gEnter.append('g').attr('class', 'bars1Wrap');
+ gEnter.append('g').attr('class', 'bars2Wrap');
+ gEnter.append('g').attr('class', 'stack1Wrap');
+ gEnter.append('g').attr('class', 'stack2Wrap');
+ gEnter.append('g').attr('class', 'legendWrap');
+
+ var g = wrap.select('g');
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.yAxis == 1 ? '' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+
+ lines1
+ .width(availableWidth)
+ .height(availableHeight)
+ .interpolate("monotone")
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'line'}));
+
+ lines2
+ .width(availableWidth)
+ .height(availableHeight)
+ .interpolate("monotone")
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'line'}));
+
+ bars1
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'bar'}));
+
+ bars2
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'bar'}));
+
+ stack1
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'area'}));
+
+ stack2
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'area'}));
+
+ g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ var lines1Wrap = g.select('.lines1Wrap')
+ .datum(dataLines1)
+ var bars1Wrap = g.select('.bars1Wrap')
+ .datum(dataBars1)
+ var stack1Wrap = g.select('.stack1Wrap')
+ .datum(dataStack1)
+
+ var lines2Wrap = g.select('.lines2Wrap')
+ .datum(dataLines2)
+ var bars2Wrap = g.select('.bars2Wrap')
+ .datum(dataBars2)
+ var stack2Wrap = g.select('.stack2Wrap')
+ .datum(dataStack2)
+
+ var extraValue1 = dataStack1.length ? dataStack1.map(function(a){return a.values}).reduce(function(a,b){
+ return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}})
+ }).concat([{x:0, y:0}]) : []
+ var extraValue2 = dataStack2.length ? dataStack2.map(function(a){return a.values}).reduce(function(a,b){
+ return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}})
+ }).concat([{x:0, y:0}]) : []
+
+ yScale1 .domain(yDomain1 || d3.extent(d3.merge(series1).concat(extraValue1), function(d) { return d.y } ))
+ .range([0, availableHeight])
+
+ yScale2 .domain(yDomain2 || d3.extent(d3.merge(series2).concat(extraValue2), function(d) { return d.y } ))
+ .range([0, availableHeight])
+
+ lines1.yDomain(yScale1.domain())
+ bars1.yDomain(yScale1.domain())
+ stack1.yDomain(yScale1.domain())
+
+ lines2.yDomain(yScale2.domain())
+ bars2.yDomain(yScale2.domain())
+ stack2.yDomain(yScale2.domain())
+
+ if(dataStack1.length){d3.transition(stack1Wrap).call(stack1);}
+ if(dataStack2.length){d3.transition(stack2Wrap).call(stack2);}
+
+ if(dataBars1.length){d3.transition(bars1Wrap).call(bars1);}
+ if(dataBars2.length){d3.transition(bars2Wrap).call(bars2);}
+
+ if(dataLines1.length){d3.transition(lines1Wrap).call(lines1);}
+ if(dataLines2.length){d3.transition(lines2Wrap).call(lines2);}
+
+
+
+ xAxis
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.x.axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+ d3.transition(g.select('.x.axis'))
+ .call(xAxis);
+
+ yAxis1
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+
+ d3.transition(g.select('.y1.axis'))
+ .call(yAxis1);
+
+ yAxis2
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.y2.axis'))
+ .call(yAxis2);
+
+ g.select('.y2.axis')
+ .style('opacity', series2.length ? 1 : 0)
+ .attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ legend.dispatch.on('stateChange', function(newState) {
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ stack1.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ if (!Math.round(stack1.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stack1.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ stack2.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ if (!Math.round(stack2.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stack2.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+
+
+ //============================================================
+ // Global getters and setters
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.lines1 = lines1;
+ chart.lines2 = lines2;
+ chart.bars1 = bars1;
+ chart.bars2 = bars2;
+ chart.stack1 = stack1;
+ chart.stack2 = stack2;
+ chart.xAxis = xAxis;
+ chart.yAxis1 = yAxis1;
+ chart.yAxis2 = yAxis2;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines1.x(_);
+ bars1.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines1.y(_);
+ bars1.y(_);
+ return chart;
+ };
+
+ chart.yDomain1 = function(_) {
+ if (!arguments.length) return yDomain1;
+ yDomain1 = _;
+ return chart;
+ };
+
+ chart.yDomain2 = function(_) {
+ if (!arguments.length) return yDomain2;
+ yDomain2 = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = _;
+ legend.color(_);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ return chart;
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/ohlcBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/ohlcBar.js
new file mode 100644
index 00000000..46f2b60c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/ohlcBar.js
@@ -0,0 +1,380 @@
+
+nv.models.ohlcBar = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , getOpen = function(d) { return d.open }
+ , getClose = function(d) { return d.close }
+ , getHigh = function(d) { return d.high }
+ , getLow = function(d) { return d.low }
+ , forceX = []
+ , forceY = []
+ , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart
+ , clipEdge = true
+ , color = nv.utils.defaultColor()
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ //TODO: store old scales for transitions
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) ));
+
+ if (padData)
+ x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || [
+ d3.min(data[0].values.map(getLow).concat(forceY)),
+ d3.max(data[0].values.map(getHigh).concat(forceY))
+ ])
+ .range(yRange || [availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-ohlcBar').data([data[0].values]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-ohlcBar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-ticks');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-chart-clip-path-' + id)
+ .append('rect');
+
+ wrap.select('#nv-chart-clip-path-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : '');
+
+
+
+ var ticks = wrap.select('.nv-ticks').selectAll('.nv-tick')
+ .data(function(d) { return d });
+
+ ticks.exit().remove();
+
+
+ var ticksEnter = ticks.enter().append('path')
+ .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i })
+ .attr('d', function(d,i) {
+ var w = (availableWidth / data[0].values.length) * .9;
+ return 'm0,0l0,'
+ + (y(getOpen(d,i))
+ - y(getHigh(d,i)))
+ + 'l'
+ + (-w/2)
+ + ',0l'
+ + (w/2)
+ + ',0l0,'
+ + (y(getLow(d,i)) - y(getOpen(d,i)))
+ + 'l0,'
+ + (y(getClose(d,i))
+ - y(getLow(d,i)))
+ + 'l'
+ + (w/2)
+ + ',0l'
+ + (-w/2)
+ + ',0z';
+ })
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; })
+ //.attr('fill', function(d,i) { return color[0]; })
+ //.attr('stroke', function(d,i) { return color[0]; })
+ //.attr('x', 0 )
+ //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) })
+ .on('mouseover', function(d,i) {
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ point: d,
+ series: data[0],
+ pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ point: d,
+ series: data[0],
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ ticks
+ .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i })
+ d3.transition(ticks)
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; })
+ .attr('d', function(d,i) {
+ var w = (availableWidth / data[0].values.length) * .9;
+ return 'm0,0l0,'
+ + (y(getOpen(d,i))
+ - y(getHigh(d,i)))
+ + 'l'
+ + (-w/2)
+ + ',0l'
+ + (w/2)
+ + ',0l0,'
+ + (y(getLow(d,i))
+ - y(getOpen(d,i)))
+ + 'l0,'
+ + (y(getClose(d,i))
+ - y(getLow(d,i)))
+ + 'l'
+ + (w/2)
+ + ',0l'
+ + (-w/2)
+ + ',0z';
+ })
+ //.attr('width', (availableWidth / data[0].values.length) * .9 )
+
+
+ //d3.transition(ticks)
+ //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) });
+ //.order(); // not sure if this makes any sense for this model
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.open = function(_) {
+ if (!arguments.length) return getOpen;
+ getOpen = _;
+ return chart;
+ };
+
+ chart.close = function(_) {
+ if (!arguments.length) return getClose;
+ getClose = _;
+ return chart;
+ };
+
+ chart.high = function(_) {
+ if (!arguments.length) return getHigh;
+ getHigh = _;
+ return chart;
+ };
+
+ chart.low = function(_) {
+ if (!arguments.length) return getLow;
+ getLow = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/parallelCoordinates.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/parallelCoordinates.js
new file mode 100644
index 00000000..107154f7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/parallelCoordinates.js
@@ -0,0 +1,239 @@
+
+//Code adapted from Jason Davies' "Parallel Coordinates"
+// http://bl.ocks.org/jasondavies/1341281
+
+nv.models.parallelCoordinates = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+
+ var margin = {top: 30, right: 10, bottom: 10, left: 10}
+ , width = 960
+ , height = 500
+ , x = d3.scale.ordinal()
+ , y = {}
+ , dimensions = []
+ , color = nv.utils.getColor(d3.scale.category20c().range())
+ , axisLabel = function(d) { return d; }
+ , filters = []
+ , active = []
+ , dispatch = d3.dispatch('brush')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ active = data; //set all active before first brush call
+
+ chart.update = function() { }; //This is a placeholder until this chart is made resizeable
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x
+ .rangePoints([0, availableWidth], 1)
+ .domain(dimensions);
+
+ // Extract the list of dimensions and create a scale for each.
+ dimensions.forEach(function(d) {
+ y[d] = d3.scale.linear()
+ .domain(d3.extent(data, function(p) { return +p[d]; }))
+ .range([availableHeight, 0]);
+
+ y[d].brush = d3.svg.brush().y(y[d]).on('brush', brush);
+
+ return d != 'name';
+ })
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-parallelCoordinates').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-parallelCoordinates');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-parallelCoordinatesWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ var line = d3.svg.line(),
+ axis = d3.svg.axis().orient('left'),
+ background,
+ foreground;
+
+
+ // Add grey background lines for context.
+ background = gEnter.append('g')
+ .attr('class', 'background')
+ .selectAll('path')
+ .data(data)
+ .enter().append('path')
+ .attr('d', path)
+ ;
+
+ // Add blue foreground lines for focus.
+ foreground = gEnter.append('g')
+ .attr('class', 'foreground')
+ .selectAll('path')
+ .data(data)
+ .enter().append('path')
+ .attr('d', path)
+ ;
+
+ // Add a group element for each dimension.
+ var dimension = g.selectAll('.dimension')
+ .data(dimensions)
+ .enter().append('g')
+ .attr('class', 'dimension')
+ .attr('transform', function(d) { return 'translate(' + x(d) + ',0)'; });
+
+ // Add an axis and title.
+ dimension.append('g')
+ .attr('class', 'axis')
+ .each(function(d) { d3.select(this).call(axis.scale(y[d])); })
+ .append('text')
+ .attr('text-anchor', 'middle')
+ .attr('y', -9)
+ .text(String);
+
+ // Add and store a brush for each axis.
+ dimension.append('g')
+ .attr('class', 'brush')
+ .each(function(d) { d3.select(this).call(y[d].brush); })
+ .selectAll('rect')
+ .attr('x', -8)
+ .attr('width', 16);
+
+
+ // Returns the path for a given data point.
+ function path(d) {
+ return line(dimensions.map(function(p) { return [x(p), y[p](d[p])]; }));
+ }
+
+ // Handles a brush event, toggling the display of foreground lines.
+ function brush() {
+ var actives = dimensions.filter(function(p) { return !y[p].brush.empty(); }),
+ extents = actives.map(function(p) { return y[p].brush.extent(); });
+
+ filters = []; //erase current filters
+ actives.forEach(function(d,i) {
+ filters[i] = {
+ dimension: d,
+ extent: extents[i]
+ }
+ });
+
+ active = []; //erase current active list
+ foreground.style('display', function(d) {
+ var isActive = actives.every(function(p, i) {
+ return extents[i][0] <= d[p] && d[p] <= extents[i][1];
+ });
+ if (isActive) active.push(d);
+ return isActive ? null : 'none';
+ });
+
+ dispatch.brush({
+ filters: filters,
+ active: active
+ });
+
+ }
+
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+
+ chart.dispatch = dispatch;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_)
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.dimensions = function(_) {
+ if (!arguments.length) return dimensions;
+ dimensions = _;
+ return chart;
+ };
+
+ chart.filters = function() {
+ return filters;
+ };
+
+ chart.active = function() {
+ return active;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pie.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pie.js
new file mode 100644
index 00000000..2099c8f3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pie.js
@@ -0,0 +1,400 @@
+nv.models.pie = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 500
+ , height = 500
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , getDescription = function(d) { return d.description }
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , color = nv.utils.defaultColor()
+ , valueFormat = d3.format(',.2f')
+ , showLabels = true
+ , pieLabelsOutside = true
+ , donutLabelsOutside = false
+ , labelType = "key"
+ , labelThreshold = .02 //if slice percentage is under this, don't show label
+ , donut = false
+ , labelSunbeamLayout = false
+ , startAngle = false
+ , endAngle = false
+ , donutRatio = 0.5
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ radius = Math.min(availableWidth, availableHeight) / 2,
+ arcRadius = radius-(radius / 5),
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ //var wrap = container.selectAll('.nv-wrap.nv-pie').data([data]);
+ var wrap = container.selectAll('.nv-wrap.nv-pie').data(data);
+ var wrapEnter = wrap.enter().append('g').attr('class','nvd3 nv-wrap nv-pie nv-chart-' + id);
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-pie');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+ g.select('.nv-pie').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ var arc = d3.svg.arc()
+ .outerRadius(arcRadius);
+
+ if (startAngle) arc.startAngle(startAngle)
+ if (endAngle) arc.endAngle(endAngle);
+ if (donut) arc.innerRadius(radius * donutRatio);
+
+ // Setup the Pie chart and choose the data element
+ var pie = d3.layout.pie()
+ .sort(null)
+ .value(function(d) { return d.disabled ? 0 : getY(d) });
+
+ var slices = wrap.select('.nv-pie').selectAll('.nv-slice')
+ .data(pie);
+
+ slices.exit().remove();
+
+ var ae = slices.enter().append('g')
+ .attr('class', 'nv-slice')
+ .on('mouseover', function(d,i){
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ pointIndex: i,
+ pos: [d3.event.pageX, d3.event.pageY],
+ id: id
+ });
+ })
+ .on('mouseout', function(d,i){
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ id: id
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ slices
+ .attr('fill', function(d,i) { return color(d, i); })
+ .attr('stroke', function(d,i) { return color(d, i); });
+
+ var paths = ae.append('path')
+ .each(function(d) { this._current = d; });
+ //.attr('d', arc);
+
+ d3.transition(slices.select('path'))
+ .attr('d', arc);
+ //.attrTween('d', arcTween);
+
+ if (showLabels) {
+ // This does the normal label
+ var labelsArc = d3.svg.arc().innerRadius(0);
+
+ if (pieLabelsOutside){ labelsArc = arc; }
+
+ if (donutLabelsOutside) { labelsArc = d3.svg.arc().outerRadius(arc.outerRadius()); }
+
+ ae.append("g").classed("nv-label", true)
+ .each(function(d, i) {
+ var group = d3.select(this);
+
+ group
+ .attr('transform', function(d) {
+ if (labelSunbeamLayout) {
+ d.outerRadius = arcRadius + 10; // Set Outer Coordinate
+ d.innerRadius = arcRadius + 15; // Set Inner Coordinate
+ var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
+ if ((d.startAngle+d.endAngle)/2 < Math.PI) {
+ rotateAngle -= 90;
+ } else {
+ rotateAngle += 90;
+ }
+ return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
+ } else {
+ d.outerRadius = radius + 10; // Set Outer Coordinate
+ d.innerRadius = radius + 15; // Set Inner Coordinate
+ return 'translate(' + labelsArc.centroid(d) + ')'
+ }
+ });
+
+ group.append('rect')
+ .style('stroke', '#fff')
+ .style('fill', '#fff')
+ .attr("rx", 3)
+ .attr("ry", 3);
+
+ group.append('text')
+ .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
+ .style('fill', '#000')
+
+
+ });
+
+ slices.select(".nv-label").transition()
+ .attr('transform', function(d) {
+ if (labelSunbeamLayout) {
+ d.outerRadius = arcRadius + 10; // Set Outer Coordinate
+ d.innerRadius = arcRadius + 15; // Set Inner Coordinate
+ var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
+ if ((d.startAngle+d.endAngle)/2 < Math.PI) {
+ rotateAngle -= 90;
+ } else {
+ rotateAngle += 90;
+ }
+ return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
+ } else {
+ d.outerRadius = radius + 10; // Set Outer Coordinate
+ d.innerRadius = radius + 15; // Set Inner Coordinate
+ return 'translate(' + labelsArc.centroid(d) + ')'
+ }
+ });
+
+ slices.each(function(d, i) {
+ var slice = d3.select(this);
+
+ slice
+ .select(".nv-label text")
+ .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
+ .text(function(d, i) {
+ var percent = (d.endAngle - d.startAngle) / (2 * Math.PI);
+ return Math.round(percent*1001/10)+"%";
+ /*var labelTypes = {
+ "key" : getX(d.data),
+ "value": getY(d.data),
+ "percent": d3.format('%')(percent)
+ };
+ return (d.value && percent > labelThreshold) ? labelTypes[labelType] : '';
+ */
+ });
+
+ var textBox = slice.select('text').node().getBBox();
+ slice.select(".nv-label rect")
+ .attr("width", textBox.width + 10)
+ .attr("height", textBox.height + 10)
+ .attr("transform", function() {
+ return "translate(" + [textBox.x - 5, textBox.y - 5] + ")";
+ });
+ });
+ }
+
+
+ // Computes the angle of an arc, converting from radians to degrees.
+ function angle(d) {
+ var a = (d.startAngle + d.endAngle) * 90 / Math.PI - 90;
+ return a > 90 ? a - 180 : a;
+ }
+
+ function arcTween(a) {
+ a.endAngle = isNaN(a.endAngle) ? 0 : a.endAngle;
+ a.startAngle = isNaN(a.startAngle) ? 0 : a.startAngle;
+ if (!donut) a.innerRadius = 0;
+ var i = d3.interpolate(this._current, a);
+ this._current = i(0);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+
+ function tweenPie(b) {
+ b.innerRadius = 0;
+ var i = d3.interpolate({startAngle: 0, endAngle: 0}, b);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.values = function(_) {
+ nv.log("pie.values() is no longer supported.");
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.description = function(_) {
+ if (!arguments.length) return getDescription;
+ getDescription = _;
+ return chart;
+ };
+
+ chart.showLabels = function(_) {
+ if (!arguments.length) return showLabels;
+ showLabels = _;
+ return chart;
+ };
+
+ chart.labelSunbeamLayout = function(_) {
+ if (!arguments.length) return labelSunbeamLayout;
+ labelSunbeamLayout = _;
+ return chart;
+ };
+
+ chart.donutLabelsOutside = function(_) {
+ if (!arguments.length) return donutLabelsOutside;
+ donutLabelsOutside = _;
+ return chart;
+ };
+
+ chart.pieLabelsOutside = function(_) {
+ if (!arguments.length) return pieLabelsOutside;
+ pieLabelsOutside = _;
+ return chart;
+ };
+
+ chart.labelType = function(_) {
+ if (!arguments.length) return labelType;
+ labelType = _;
+ labelType = labelType || "key";
+ return chart;
+ };
+
+ chart.donut = function(_) {
+ if (!arguments.length) return donut;
+ donut = _;
+ return chart;
+ };
+
+ chart.donutRatio = function(_) {
+ if (!arguments.length) return donutRatio;
+ donutRatio = _;
+ return chart;
+ };
+
+ chart.startAngle = function(_) {
+ if (!arguments.length) return startAngle;
+ startAngle = _;
+ return chart;
+ };
+
+ chart.endAngle = function(_) {
+ if (!arguments.length) return endAngle;
+ endAngle = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.valueFormat = function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.labelThreshold = function(_) {
+ if (!arguments.length) return labelThreshold;
+ labelThreshold = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pieChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pieChart.js
new file mode 100644
index 00000000..b4303fd6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pieChart.js
@@ -0,0 +1,292 @@
+nv.models.pieChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var pie = nv.models.pie()
+ , legend = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 20, left: 20}
+ , width = null
+ , height = null
+ , showLegend = true
+ , color = nv.utils.defaultColor()
+ , tooltips = false
+ , tooltip = function(key, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , state = {}
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var tooltipLabel = pie.description()(e.point) || pie.x()(e.point)
+ var left = e.pos[0] + ( (offsetElement && offsetElement.offsetLeft) || 0 ),
+ top = e.pos[1] + ( (offsetElement && offsetElement.offsetTop) || 0),
+ y = pie.valueFormat()(pie.y()(e.point)),
+ content = tooltip(tooltipLabel, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-pieChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-pieChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-pieWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend
+ .width( availableWidth )
+ .key(pie.x());
+
+ wrap.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ pie
+ .width(availableWidth)
+ .height(availableHeight);
+
+
+ var pieWrap = g.select('.nv-pieWrap')
+ .datum([data]);
+
+ d3.transition(pieWrap).call(pie);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ /*legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });*/
+
+ pie.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ pie.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.legend = legend;
+ chart.dispatch = dispatch;
+ chart.pie = pie;
+
+ d3.rebind(chart, pie, 'valueFormat', 'values', 'x', 'y', 'description', 'id', 'showLabels', 'donutLabelsOutside', 'pieLabelsOutside', 'labelType', 'donut', 'donutRatio', 'labelThreshold');
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ pie.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatter.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatter.js
new file mode 100644
index 00000000..16cbee65
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatter.js
@@ -0,0 +1,674 @@
+
+nv.models.scatter = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // chooses color
+ , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , z = d3.scale.linear() //linear because d3.svg.shape.size is treated as area
+ , getX = function(d) { return d.x } // accessor to get the x value
+ , getY = function(d) { return d.y } // accessor to get the y value
+ , getSize = function(d) { return d.size || 1} // accessor to get the point size
+ , getShape = function(d) { return d.shape || 'circle' } // accessor to get point shape
+ , onlyCircles = true // Set to false to use shapes
+ , forceX = [] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.)
+ , forceY = [] // List of numbers to Force into the Y scale
+ , forceSize = [] // List of numbers to Force into the Size scale
+ , interactive = true // If true, plots a voronoi overlay for advanced point intersection
+ , pointKey = null
+ , pointActive = function(d) { return !d.notActive } // any points that return false will be filtered out
+ , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart
+ , padDataOuter = .1 //outerPadding to imitate ordinal scale outer padding
+ , clipEdge = false // if true, masks points within x and y scale
+ , clipVoronoi = true // if true, masks each point with a circle... can turn off to slightly increase performance
+ , clipRadius = function() { return 25 } // function to get the radius for voronoi point clips
+ , xDomain = null // Override x domain (skips the calculation from data)
+ , yDomain = null // Override y domain
+ , xRange = null // Override x range
+ , yRange = null // Override y range
+ , sizeDomain = null // Override point size domain
+ , sizeRange = null
+ , singlePoint = false
+ , dispatch = d3.dispatch('elementClick', 'elementMouseover', 'elementMouseout')
+ , useVoronoi = true
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0, z0 // used to store previous scales
+ , timeoutID
+ , needsUpdate = false // Flag for when the points are visually updating, but the interactive layer is behind, to disable tooltips
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain && sizeDomain) ? [] : // if we know xDomain and yDomain and sizeDomain, no need to calculate.... if Size is constant remember to set sizeDomain to speed up performance
+ d3.merge(
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), size: getSize(d,i) }
+ })
+ })
+ );
+
+ x .domain(xDomain || d3.extent(seriesData.map(function(d) { return d.x; }).concat(forceX)))
+
+ if (padData && data[0])
+ x.range(xRange || [(availableWidth * padDataOuter + availableWidth) / (2 *data[0].values.length), availableWidth - availableWidth * (1 + padDataOuter) / (2 * data[0].values.length) ]);
+ //x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(seriesData.map(function(d) { return d.y }).concat(forceY)))
+ .range(yRange || [availableHeight, 0]);
+
+ z .domain(sizeDomain || d3.extent(seriesData.map(function(d) { return d.size }).concat(forceSize)))
+ .range(sizeRange || [16, 256]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] - y.domain()[0] * 0.01, y.domain()[1] + y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ if ( isNaN(x.domain()[0])) {
+ x.domain([-1,1]);
+ }
+
+ if ( isNaN(y.domain()[0])) {
+ y.domain([-1,1]);
+ }
+
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+ z0 = z0 || z;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatter').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatter nv-chart-' + id + (singlePoint ? ' nv-single-point' : ''));
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+ gEnter.append('g').attr('class', 'nv-point-paths');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+ function updateInteractiveLayer() {
+
+ if (!interactive) return false;
+
+ var eventElements;
+
+ var vertices = d3.merge(data.map(function(group, groupIndex) {
+ return group.values
+ .map(function(point, pointIndex) {
+ // *Adding noise to make duplicates very unlikely
+ // *Injecting series and point index for reference
+ /* *Adding a 'jitter' to the points, because there's an issue in d3.geom.voronoi.
+ */
+ var pX = getX(point,pointIndex);
+ var pY = getY(point,pointIndex);
+
+ return [x(pX)+ Math.random() * 1e-7,
+ y(pY)+ Math.random() * 1e-7,
+ groupIndex,
+ pointIndex, point]; //temp hack to add noise untill I think of a better way so there are no duplicates
+ })
+ .filter(function(pointArray, pointIndex) {
+ return pointActive(pointArray[4], pointIndex); // Issue #237.. move filter to after map, so pointIndex is correct!
+ })
+ })
+ );
+
+
+
+ //inject series and point index for reference into voronoi
+ if (useVoronoi === true) {
+
+ if (clipVoronoi) {
+ var pointClipsEnter = wrap.select('defs').selectAll('.nv-point-clips')
+ .data([id])
+ .enter();
+
+ pointClipsEnter.append('clipPath')
+ .attr('class', 'nv-point-clips')
+ .attr('id', 'nv-points-clip-' + id);
+
+ var pointClips = wrap.select('#nv-points-clip-' + id).selectAll('circle')
+ .data(vertices);
+ pointClips.enter().append('circle')
+ .attr('r', clipRadius);
+ pointClips.exit().remove();
+ pointClips
+ .attr('cx', function(d) { return d[0] })
+ .attr('cy', function(d) { return d[1] });
+
+ wrap.select('.nv-point-paths')
+ .attr('clip-path', 'url(#nv-points-clip-' + id + ')');
+ }
+
+
+ if(vertices.length) {
+ // Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work
+ vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]);
+ vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]);
+ vertices.push([x.range()[0] - 20, y.range()[0] + 20, null, null]);
+ vertices.push([x.range()[1] + 20, y.range()[1] - 20, null, null]);
+ }
+
+ var bounds = d3.geom.polygon([
+ [-10,-10],
+ [-10,height + 10],
+ [width + 10,height + 10],
+ [width + 10,-10]
+ ]);
+
+ var voronoi = d3.geom.voronoi(vertices).map(function(d, i) {
+ return {
+ 'data': bounds.clip(d),
+ 'series': vertices[i][2],
+ 'point': vertices[i][3]
+ }
+ });
+
+
+ var pointPaths = wrap.select('.nv-point-paths').selectAll('path')
+ .data(voronoi);
+ pointPaths.enter().append('path')
+ .attr('class', function(d,i) { return 'nv-path-'+i; });
+ pointPaths.exit().remove();
+ pointPaths
+ .attr('d', function(d) {
+ if (d.data.length === 0)
+ return 'M 0 0'
+ else
+ return 'M' + d.data.join('L') + 'Z';
+ });
+
+ var mouseEventCallback = function(d,mDispatch) {
+ if (needsUpdate) return 0;
+ var series = data[d.series];
+ if (typeof series === 'undefined') return;
+
+ var point = series.values[d.point];
+
+ mDispatch({
+ point: point,
+ series: series,
+ pos: [x(getX(point, d.point)) + margin.left, y(getY(point, d.point)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: d.point
+ });
+ };
+
+ pointPaths
+ .on('click', function(d) {
+ mouseEventCallback(d, dispatch.elementClick);
+ })
+ .on('mouseover', function(d) {
+ mouseEventCallback(d, dispatch.elementMouseover);
+ })
+ .on('mouseout', function(d, i) {
+ mouseEventCallback(d, dispatch.elementMouseout);
+ });
+
+
+ } else {
+ /*
+ // bring data in form needed for click handlers
+ var dataWithPoints = vertices.map(function(d, i) {
+ return {
+ 'data': d,
+ 'series': vertices[i][2],
+ 'point': vertices[i][3]
+ }
+ });
+ */
+
+ // add event handlers to points instead voronoi paths
+ wrap.select('.nv-groups').selectAll('.nv-group')
+ .selectAll('.nv-point')
+ //.data(dataWithPoints)
+ //.style('pointer-events', 'auto') // recativate events, disabled by css
+ .on('click', function(d,i) {
+ //nv.log('test', d, i);
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementClick({
+ point: point,
+ series: series,
+ pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ })
+ .on('mouseover', function(d,i) {
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementMouseover({
+ point: point,
+ series: series,
+ pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ })
+ .on('mouseout', function(d,i) {
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementMouseout({
+ point: point,
+ series: series,
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ });
+ }
+
+ needsUpdate = false;
+ }
+
+ needsUpdate = true;
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit()
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover });
+ groups
+ .transition()
+ .style('fill', function(d,i) { return color(d, i) })
+ .style('stroke', function(d,i) { return color(d, i) })
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .5);
+
+
+ if (onlyCircles) {
+
+ var points = groups.selectAll('circle.nv-point')
+ .data(function(d) { return d.values }, pointKey);
+ points.enter().append('circle')
+ .style('fill', function (d,i) { return d.color })
+ .style('stroke', function (d,i) { return d.color })
+ .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) })
+ .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) })
+ .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) });
+ points.exit().remove();
+ groups.exit().selectAll('path.nv-point').transition()
+ .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ .remove();
+ points.each(function(d,i) {
+ d3.select(this)
+ .classed('nv-point', true)
+ .classed('nv-point-' + i, true)
+ .classed('hover',false)
+ ;
+ });
+ points.transition()
+ .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) });
+
+ } else {
+
+ var points = groups.selectAll('path.nv-point')
+ .data(function(d) { return d.values });
+ points.enter().append('path')
+ .style('fill', function (d,i) { return d.color })
+ .style('stroke', function (d,i) { return d.color })
+ .attr('transform', function(d,i) {
+ return 'translate(' + x0(getX(d,i)) + ',' + y0(getY(d,i)) + ')'
+ })
+ .attr('d',
+ d3.svg.symbol()
+ .type(getShape)
+ .size(function(d,i) { return z(getSize(d,i)) })
+ );
+ points.exit().remove();
+ groups.exit().selectAll('path.nv-point')
+ .transition()
+ .attr('transform', function(d,i) {
+ return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
+ })
+ .remove();
+ points.each(function(d,i) {
+ d3.select(this)
+ .classed('nv-point', true)
+ .classed('nv-point-' + i, true)
+ .classed('hover',false)
+ ;
+ });
+ points.transition()
+ .attr('transform', function(d,i) {
+ //nv.log(d,i,getX(d,i), x(getX(d,i)));
+ return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
+ })
+ .attr('d',
+ d3.svg.symbol()
+ .type(getShape)
+ .size(function(d,i) { return z(getSize(d,i)) })
+ );
+ }
+
+
+ // Delay updating the invisible interactive layer for smoother animation
+ clearTimeout(timeoutID); // stop repeat calls to updateInteractiveLayer
+ timeoutID = setTimeout(updateInteractiveLayer, 300);
+ //updateInteractiveLayer();
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+ z0 = z.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+ chart.clearHighlights = function() {
+ //Remove the 'hover' class from all highlighted points.
+ d3.selectAll(".nv-chart-" + id + " .nv-point.hover").classed("hover",false);
+ };
+
+ chart.highlightPoint = function(seriesIndex,pointIndex,isHoverOver) {
+ d3.select(".nv-chart-" + id + " .nv-series-" + seriesIndex + " .nv-point-" + pointIndex)
+ .classed("hover",isHoverOver);
+ };
+
+
+ dispatch.on('elementMouseover.point', function(d) {
+ if (interactive) chart.highlightPoint(d.seriesIndex,d.pointIndex,true);
+ });
+
+ dispatch.on('elementMouseout.point', function(d) {
+ if (interactive) chart.highlightPoint(d.seriesIndex,d.pointIndex,false);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.size = function(_) {
+ if (!arguments.length) return getSize;
+ getSize = d3.functor(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.zScale = function(_) {
+ if (!arguments.length) return z;
+ z = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.sizeDomain = function(_) {
+ if (!arguments.length) return sizeDomain;
+ sizeDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.sizeRange = function(_) {
+ if (!arguments.length) return sizeRange;
+ sizeRange = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.forceSize = function(_) {
+ if (!arguments.length) return forceSize;
+ forceSize = _;
+ return chart;
+ };
+
+ chart.interactive = function(_) {
+ if (!arguments.length) return interactive;
+ interactive = _;
+ return chart;
+ };
+
+ chart.pointKey = function(_) {
+ if (!arguments.length) return pointKey;
+ pointKey = _;
+ return chart;
+ };
+
+ chart.pointActive = function(_) {
+ if (!arguments.length) return pointActive;
+ pointActive = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.padDataOuter = function(_) {
+ if (!arguments.length) return padDataOuter;
+ padDataOuter = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.clipVoronoi= function(_) {
+ if (!arguments.length) return clipVoronoi;
+ clipVoronoi = _;
+ return chart;
+ };
+
+ chart.useVoronoi= function(_) {
+ if (!arguments.length) return useVoronoi;
+ useVoronoi = _;
+ if (useVoronoi === false) {
+ clipVoronoi = false;
+ }
+ return chart;
+ };
+
+ chart.clipRadius = function(_) {
+ if (!arguments.length) return clipRadius;
+ clipRadius = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.shape = function(_) {
+ if (!arguments.length) return getShape;
+ getShape = _;
+ return chart;
+ };
+
+ chart.onlyCircles = function(_) {
+ if (!arguments.length) return onlyCircles;
+ onlyCircles = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.singlePoint = function(_) {
+ if (!arguments.length) return singlePoint;
+ singlePoint = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterChart.js
new file mode 100644
index 00000000..65b6e387
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterChart.js
@@ -0,0 +1,628 @@
+nv.models.scatterChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , distX = nv.models.distribution()
+ , distY = nv.models.distribution()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 75}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale()
+ , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale()
+ , xPadding = 0
+ , yPadding = 0
+ , showDistX = false
+ , showDistY = false
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , showControls = !!d3.fisheye
+ , fisheye = 0
+ , pauseFisheye = false
+ , tooltips = true
+ , tooltipX = function(key, x, y) { return '<strong>' + x + '</strong>' }
+ , tooltipY = function(key, x, y) { return '<strong>' + y + '</strong>' }
+ , tooltip = null
+ , state = {}
+ , defaultState = null
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , noData = "No Data Available."
+ , transitionDuration = 250
+ ;
+
+ scatter
+ .xScale(x)
+ .yScale(y)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(10)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ .tickPadding(10)
+ ;
+ distX
+ .axis('x')
+ ;
+ distY
+ .axis('y')
+ ;
+
+ controls.updateState(false);
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ var showTooltip = function(e, offsetElement) {
+ //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?)
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0),
+ leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ),
+ topY = e.pos[1] + ( offsetElement.offsetTop || 0),
+ xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)),
+ yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex));
+
+ if( tooltipX != null )
+ nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip');
+ if( tooltipY != null )
+ nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip');
+ if( tooltip != null )
+ nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ var controlsData = [
+ { key: 'Magnify', disabled: true }
+ ];
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id());
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ // background for pointer events
+ gEnter.append('rect').attr('class', 'nvd3 nv-background');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+ gEnter.append('g').attr('class', 'nv-distWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ var legendWidth = (showControls) ? availableWidth / 2 : availableWidth;
+ legend.width(legendWidth);
+
+ wrap.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth - legendWidth) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ controls.width(180).color(['#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+ if (xPadding !== 0)
+ scatter.xDomain(null);
+
+ if (yPadding !== 0)
+ scatter.yDomain(null);
+
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+ //Adjust for x and y padding
+ if (xPadding !== 0) {
+ var xRange = x.domain()[1] - x.domain()[0];
+ scatter.xDomain([x.domain()[0] - (xPadding * xRange), x.domain()[1] + (xPadding * xRange)]);
+ }
+
+ if (yPadding !== 0) {
+ var yRange = y.domain()[1] - y.domain()[0];
+ scatter.yDomain([y.domain()[0] - (yPadding * yRange), y.domain()[1] + (yPadding * yRange)]);
+ }
+
+ //Only need to update the scatter again if x/yPadding changed the domain.
+ if (yPadding !== 0 || xPadding !== 0) {
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( xAxis.ticks() && xAxis.ticks().length ? xAxis.ticks() : availableWidth / 100 )
+ .tickSize( -availableHeight , 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .call(xAxis);
+
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( yAxis.ticks() && yAxis.ticks().length ? yAxis.ticks() : availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .call(yAxis);
+ }
+
+
+ if (showDistX) {
+ distX
+ .getData(scatter.x())
+ .scale(x)
+ .width(availableWidth)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionX');
+ g.select('.nv-distributionX')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ }
+
+ if (showDistY) {
+ distY
+ .getData(scatter.y())
+ .scale(y)
+ .width(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionY');
+ g.select('.nv-distributionY')
+ .attr('transform',
+ 'translate(' + (rightAlignYAxis ? availableWidth : -distY.size() ) + ',0)')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+ //------------------------------------------------------------
+
+
+
+
+ if (d3.fisheye) {
+ g.select('.nv-background')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g.select('.nv-background').on('mousemove', updateFisheye);
+ g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;});
+ scatter.dispatch.on('elementClick.freezeFisheye', function() {
+ pauseFisheye = !pauseFisheye;
+ });
+ }
+
+
+ function updateFisheye() {
+ if (pauseFisheye) {
+ g.select('.nv-point-paths').style('pointer-events', 'all');
+ return false;
+ }
+
+ g.select('.nv-point-paths').style('pointer-events', 'none' );
+
+ var mouse = d3.mouse(this);
+ x.distortion(fisheye).focus(mouse[0]);
+ y.distortion(fisheye).focus(mouse[1]);
+
+ g.select('.nv-scatterWrap')
+ .call(scatter);
+
+ if (showXAxis)
+ g.select('.nv-x.nv-axis').call(xAxis);
+
+ if (showYAxis)
+ g.select('.nv-y.nv-axis').call(yAxis);
+
+ g.select('.nv-distributionX')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ g.select('.nv-distributionY')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ fisheye = d.disabled ? 0 : 2.5;
+ g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all');
+ g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' );
+
+ if (d.disabled) {
+ x.distortion(fisheye).focus(0);
+ y.distortion(fisheye).focus(0);
+
+ g.select('.nv-scatterWrap').call(scatter);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ } else {
+ pauseFisheye = false;
+ }
+
+ chart.update();
+ });
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state.disabled = newState.disabled;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', function(d,i) { return e.pos[1] - availableHeight;});
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', e.pos[0] + distX.size());
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', 0);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', distY.size());
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.distX = distX;
+ chart.distY = distY;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ distX.color(color);
+ distY.color(color);
+ return chart;
+ };
+
+ chart.showDistX = function(_) {
+ if (!arguments.length) return showDistX;
+ showDistX = _;
+ return chart;
+ };
+
+ chart.showDistY = function(_) {
+ if (!arguments.length) return showDistY;
+ showDistY = _;
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+
+ chart.fisheye = function(_) {
+ if (!arguments.length) return fisheye;
+ fisheye = _;
+ return chart;
+ };
+
+ chart.xPadding = function(_) {
+ if (!arguments.length) return xPadding;
+ xPadding = _;
+ return chart;
+ };
+
+ chart.yPadding = function(_) {
+ if (!arguments.length) return yPadding;
+ yPadding = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltipXContent = function(_) {
+ if (!arguments.length) return tooltipX;
+ tooltipX = _;
+ return chart;
+ };
+
+ chart.tooltipYContent = function(_) {
+ if (!arguments.length) return tooltipY;
+ tooltipY = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterPlusLineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterPlusLineChart.js
new file mode 100644
index 00000000..23c87853
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterPlusLineChart.js
@@ -0,0 +1,620 @@
+
+nv.models.scatterPlusLineChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , distX = nv.models.distribution()
+ , distY = nv.models.distribution()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 75}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale()
+ , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale()
+ , showDistX = false
+ , showDistY = false
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , showControls = !!d3.fisheye
+ , fisheye = 0
+ , pauseFisheye = false
+ , tooltips = true
+ , tooltipX = function(key, x, y) { return '<strong>' + x + '</strong>' }
+ , tooltipY = function(key, x, y) { return '<strong>' + y + '</strong>' }
+ , tooltip = function(key, x, y, date) { return '<h3>' + key + '</h3>'
+ + '<p>' + date + '</p>' }
+ , state = {}
+ , defaultState = null
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , noData = "No Data Available."
+ , transitionDuration = 250
+ ;
+
+ scatter
+ .xScale(x)
+ .yScale(y)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(10)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ .tickPadding(10)
+ ;
+ distX
+ .axis('x')
+ ;
+ distY
+ .axis('y')
+ ;
+
+ controls.updateState(false);
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ var showTooltip = function(e, offsetElement) {
+ //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?)
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0),
+ leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ),
+ topY = e.pos[1] + ( offsetElement.offsetTop || 0),
+ xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)),
+ yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex));
+
+ if( tooltipX != null )
+ nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip');
+ if( tooltipY != null )
+ nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip');
+ if( tooltip != null )
+ nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e.point.tooltip, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ var controlsData = [
+ { key: 'Magnify', disabled: true }
+ ];
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id());
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ // background for pointer events
+ gEnter.append('rect').attr('class', 'nvd3 nv-background').style("pointer-events","none");
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+ gEnter.append('g').attr('class', 'nv-regressionLinesWrap');
+ gEnter.append('g').attr('class', 'nv-distWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ wrap.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ controls.width(180).color(['#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+ wrap.select('.nv-regressionLinesWrap')
+ .attr('clip-path', 'url(#nv-edge-clip-' + scatter.id() + ')');
+
+ var regWrap = wrap.select('.nv-regressionLinesWrap').selectAll('.nv-regLines')
+ .data(function(d) {return d });
+
+ regWrap.enter().append('g').attr('class', 'nv-regLines');
+
+ var regLine = regWrap.selectAll('.nv-regLine').data(function(d){return [d]});
+ var regLineEnter = regLine.enter()
+ .append('line').attr('class', 'nv-regLine')
+ .style('stroke-opacity', 0);
+
+ regLine
+ .transition()
+ .attr('x1', x.range()[0])
+ .attr('x2', x.range()[1])
+ .attr('y1', function(d,i) {return y(x.domain()[0] * d.slope + d.intercept) })
+ .attr('y2', function(d,i) { return y(x.domain()[1] * d.slope + d.intercept) })
+ .style('stroke', function(d,i,j) { return color(d,j) })
+ .style('stroke-opacity', function(d,i) {
+ return (d.disabled || typeof d.slope === 'undefined' || typeof d.intercept === 'undefined') ? 0 : 1
+ });
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( xAxis.ticks() ? xAxis.ticks() : availableWidth / 100 )
+ .tickSize( -availableHeight , 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( yAxis.ticks() ? yAxis.ticks() : availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .call(yAxis);
+ }
+
+
+ if (showDistX) {
+ distX
+ .getData(scatter.x())
+ .scale(x)
+ .width(availableWidth)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionX');
+ g.select('.nv-distributionX')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ }
+
+ if (showDistY) {
+ distY
+ .getData(scatter.y())
+ .scale(y)
+ .width(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionY');
+ g.select('.nv-distributionY')
+ .attr('transform', 'translate(' + (rightAlignYAxis ? availableWidth : -distY.size() ) + ',0)')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+ //------------------------------------------------------------
+
+
+
+
+ if (d3.fisheye) {
+ g.select('.nv-background')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight)
+ ;
+
+ g.select('.nv-background').on('mousemove', updateFisheye);
+ g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;});
+ scatter.dispatch.on('elementClick.freezeFisheye', function() {
+ pauseFisheye = !pauseFisheye;
+ });
+ }
+
+
+ function updateFisheye() {
+ if (pauseFisheye) {
+ g.select('.nv-point-paths').style('pointer-events', 'all');
+ return false;
+ }
+
+ g.select('.nv-point-paths').style('pointer-events', 'none' );
+
+ var mouse = d3.mouse(this);
+ x.distortion(fisheye).focus(mouse[0]);
+ y.distortion(fisheye).focus(mouse[1]);
+
+ g.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+ if (showXAxis)
+ g.select('.nv-x.nv-axis').call(xAxis);
+
+ if (showYAxis)
+ g.select('.nv-y.nv-axis').call(yAxis);
+
+ g.select('.nv-distributionX')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ g.select('.nv-distributionY')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ fisheye = d.disabled ? 0 : 2.5;
+ g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all');
+ g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' );
+
+ if (d.disabled) {
+ x.distortion(fisheye).focus(0);
+ y.distortion(fisheye).focus(0);
+
+ g.select('.nv-scatterWrap').call(scatter);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ } else {
+ pauseFisheye = false;
+ }
+
+ chart.update();
+ });
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', e.pos[1] - availableHeight);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', e.pos[0] + distX.size());
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', 0);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', distY.size());
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.distX = distX;
+ chart.distY = distY;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ distX.color(color);
+ distY.color(color);
+ return chart;
+ };
+
+ chart.showDistX = function(_) {
+ if (!arguments.length) return showDistX;
+ showDistX = _;
+ return chart;
+ };
+
+ chart.showDistY = function(_) {
+ if (!arguments.length) return showDistY;
+ showDistY = _;
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.fisheye = function(_) {
+ if (!arguments.length) return fisheye;
+ fisheye = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltipXContent = function(_) {
+ if (!arguments.length) return tooltipX;
+ tooltipX = _;
+ return chart;
+ };
+
+ chart.tooltipYContent = function(_) {
+ if (!arguments.length) return tooltipY;
+ tooltipY = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparkline.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparkline.js
new file mode 100644
index 00000000..e4c2e87b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparkline.js
@@ -0,0 +1,194 @@
+
+nv.models.sparkline = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 2, right: 0, bottom: 2, left: 0}
+ , width = 400
+ , height = 32
+ , animate = true
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.getColor(['#000'])
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data, getX ))
+ .range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(data, getY ))
+ .range(yRange || [availableHeight, 0]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-sparkline').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparkline');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
+
+ //------------------------------------------------------------
+
+
+ var paths = wrap.selectAll('path')
+ .data(function(d) { return [d] });
+ paths.enter().append('path');
+ paths.exit().remove();
+ paths
+ .style('stroke', function(d,i) { return d.color || color(d, i) })
+ .attr('d', d3.svg.line()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ );
+
+
+ // TODO: Add CURRENT data point (Need Min, Mac, Current / Most recent)
+ var points = wrap.selectAll('circle.nv-point')
+ .data(function(data) {
+ var yValues = data.map(function(d, i) { return getY(d,i); });
+ function pointIndex(index) {
+ if (index != -1) {
+ var result = data[index];
+ result.pointIndex = index;
+ return result;
+ } else {
+ return null;
+ }
+ }
+ var maxPoint = pointIndex(yValues.lastIndexOf(y.domain()[1])),
+ minPoint = pointIndex(yValues.indexOf(y.domain()[0])),
+ currentPoint = pointIndex(yValues.length - 1);
+ return [minPoint, maxPoint, currentPoint].filter(function (d) {return d != null;});
+ });
+ points.enter().append('circle');
+ points.exit().remove();
+ points
+ .attr('cx', function(d,i) { return x(getX(d,d.pointIndex)) })
+ .attr('cy', function(d,i) { return y(getY(d,d.pointIndex)) })
+ .attr('r', 2)
+ .attr('class', function(d,i) {
+ return getX(d, d.pointIndex) == x.domain()[1] ? 'nv-point nv-currentValue' :
+ getY(d, d.pointIndex) == y.domain()[0] ? 'nv-point nv-minValue' : 'nv-point nv-maxValue'
+ });
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.animate = function(_) {
+ if (!arguments.length) return animate;
+ animate = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparklinePlus.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparklinePlus.js
new file mode 100644
index 00000000..1535f8af
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparklinePlus.js
@@ -0,0 +1,295 @@
+
+nv.models.sparklinePlus = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var sparkline = nv.models.sparkline();
+
+ var margin = {top: 15, right: 100, bottom: 10, left: 50}
+ , width = null
+ , height = null
+ , x
+ , y
+ , index = []
+ , paused = false
+ , xTickFormat = d3.format(',r')
+ , yTickFormat = d3.format(',.2f')
+ , showValue = true
+ , alignValue = true
+ , rightAlignValue = false
+ , noData = "No Data Available."
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ var currentValue = sparkline.y()(data[data.length-1], data.length-1);
+
+ //------------------------------------------------------------
+
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = sparkline.xScale();
+ y = sparkline.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-sparklineplus').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparklineplus');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-sparklineWrap');
+ gEnter.append('g').attr('class', 'nv-valueWrap');
+ gEnter.append('g').attr('class', 'nv-hoverArea');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ var sparklineWrap = g.select('.nv-sparklineWrap');
+
+ sparkline
+ .width(availableWidth)
+ .height(availableHeight);
+
+ sparklineWrap
+ .call(sparkline);
+
+ //------------------------------------------------------------
+
+
+ var valueWrap = g.select('.nv-valueWrap');
+
+ var value = valueWrap.selectAll('.nv-currentValue')
+ .data([currentValue]);
+
+ value.enter().append('text').attr('class', 'nv-currentValue')
+ .attr('dx', rightAlignValue ? -8 : 8)
+ .attr('dy', '.9em')
+ .style('text-anchor', rightAlignValue ? 'end' : 'start');
+
+ value
+ .attr('x', availableWidth + (rightAlignValue ? margin.right : 0))
+ .attr('y', alignValue ? function(d) { return y(d) } : 0)
+ .style('fill', sparkline.color()(data[data.length-1], data.length-1))
+ .text(yTickFormat(currentValue));
+
+
+
+ gEnter.select('.nv-hoverArea').append('rect')
+ .on('mousemove', sparklineHover)
+ .on('click', function() { paused = !paused })
+ .on('mouseout', function() { index = []; updateValueLine(); });
+ //.on('mouseout', function() { index = null; updateValueLine(); });
+
+ g.select('.nv-hoverArea rect')
+ .attr('transform', function(d) { return 'translate(' + -margin.left + ',' + -margin.top + ')' })
+ .attr('width', availableWidth + margin.left + margin.right)
+ .attr('height', availableHeight + margin.top);
+
+
+
+ function updateValueLine() { //index is currently global (within the chart), may or may not keep it that way
+ if (paused) return;
+
+ var hoverValue = g.selectAll('.nv-hoverValue').data(index)
+
+ var hoverEnter = hoverValue.enter()
+ .append('g').attr('class', 'nv-hoverValue')
+ .style('stroke-opacity', 0)
+ .style('fill-opacity', 0);
+
+ hoverValue.exit()
+ .transition().duration(250)
+ .style('stroke-opacity', 0)
+ .style('fill-opacity', 0)
+ .remove();
+
+ hoverValue
+ .attr('transform', function(d) { return 'translate(' + x(sparkline.x()(data[d],d)) + ',0)' })
+ .transition().duration(250)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', 1);
+
+ if (!index.length) return;
+
+ hoverEnter.append('line')
+ .attr('x1', 0)
+ .attr('y1', -margin.top)
+ .attr('x2', 0)
+ .attr('y2', availableHeight);
+
+
+ hoverEnter.append('text').attr('class', 'nv-xValue')
+ .attr('x', -6)
+ .attr('y', -margin.top)
+ .attr('text-anchor', 'end')
+ .attr('dy', '.9em')
+
+
+ g.select('.nv-hoverValue .nv-xValue')
+ .text(xTickFormat(sparkline.x()(data[index[0]], index[0])));
+
+ hoverEnter.append('text').attr('class', 'nv-yValue')
+ .attr('x', 6)
+ .attr('y', -margin.top)
+ .attr('text-anchor', 'start')
+ .attr('dy', '.9em')
+
+ g.select('.nv-hoverValue .nv-yValue')
+ .text(yTickFormat(sparkline.y()(data[index[0]], index[0])));
+
+ }
+
+
+ function sparklineHover() {
+ if (paused) return;
+
+ var pos = d3.mouse(this)[0] - margin.left;
+
+ function getClosestIndex(data, x) {
+ var distance = Math.abs(sparkline.x()(data[0], 0) - x);
+ var closestIndex = 0;
+ for (var i = 0; i < data.length; i++){
+ if (Math.abs(sparkline.x()(data[i], i) - x) < distance) {
+ distance = Math.abs(sparkline.x()(data[i], i) - x);
+ closestIndex = i;
+ }
+ }
+ return closestIndex;
+ }
+
+ index = [getClosestIndex(data, Math.round(x.invert(pos)))];
+
+ updateValueLine();
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.sparkline = sparkline;
+
+ d3.rebind(chart, sparkline, 'x', 'y', 'xScale', 'yScale', 'color');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xTickFormat = function(_) {
+ if (!arguments.length) return xTickFormat;
+ xTickFormat = _;
+ return chart;
+ };
+
+ chart.yTickFormat = function(_) {
+ if (!arguments.length) return yTickFormat;
+ yTickFormat = _;
+ return chart;
+ };
+
+ chart.showValue = function(_) {
+ if (!arguments.length) return showValue;
+ showValue = _;
+ return chart;
+ };
+
+ chart.alignValue = function(_) {
+ if (!arguments.length) return alignValue;
+ alignValue = _;
+ return chart;
+ };
+
+ chart.rightAlignValue = function(_) {
+ if (!arguments.length) return rightAlignValue;
+ rightAlignValue = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedArea.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedArea.js
new file mode 100644
index 00000000..eefeb8fb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedArea.js
@@ -0,0 +1,368 @@
+
+nv.models.stackedArea = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // a function that computes the color
+ , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't selet one
+ , getX = function(d) { return d.x } // accessor to get the x value from a data point
+ , getY = function(d) { return d.y } // accessor to get the y value from a data point
+ , style = 'stack'
+ , offset = 'zero'
+ , order = 'default'
+ , interpolate = 'linear' // controls the line interpolation
+ , clipEdge = false // if true, masks lines within x and y scale
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , scatter = nv.models.scatter()
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'areaClick', 'areaMouseover', 'areaMouseout')
+ ;
+
+ scatter
+ .size(2.2) // default size
+ .sizeDomain([2.2,2.2]) // all the same size by default
+ ;
+
+ /************************************
+ * offset:
+ * 'wiggle' (stream)
+ * 'zero' (stacked)
+ * 'expand' (normalize to 100%)
+ * 'silhouette' (simple centered)
+ *
+ * order:
+ * 'inside-out' (stream)
+ * 'default' (input order)
+ ************************************/
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ //------------------------------------------------------------
+
+ var dataRaw = data;
+ // Injecting point index into each point because d3.layout.stack().out does not give index
+ data.forEach(function(aseries, i) {
+ aseries.seriesIndex = i;
+ aseries.values = aseries.values.map(function(d, j) {
+ d.index = j;
+ d.seriesIndex = i;
+ return d;
+ });
+ });
+
+ var dataFiltered = data.filter(function(series) {
+ return !series.disabled;
+ });
+
+ data = d3.layout.stack()
+ .order(order)
+ .offset(offset)
+ .values(function(d) { return d.values }) //TODO: make values customizeable in EVERY model in this fashion
+ .x(getX)
+ .y(getY)
+ .out(function(d, y0, y) {
+ var yHeight = (getY(d) === 0) ? 0 : y;
+ d.display = {
+ y: yHeight,
+ y0: y0
+ };
+ })
+ (dataFiltered);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-stackedarea').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedarea');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-areaWrap');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .x(getX)
+ .y(function(d) { return d.display.y + d.display.y0 })
+ .forceY([0])
+ .color(data.map(function(d,i) {
+ return d.color || color(d, d.seriesIndex);
+ }));
+
+
+ var scatterWrap = g.select('.nv-scatterWrap')
+ .datum(data);
+
+ scatterWrap.call(scatter);
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+ var area = d3.svg.area()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d) {
+ return y(d.display.y0)
+ })
+ .y1(function(d) {
+ return y(d.display.y + d.display.y0)
+ })
+ .interpolate(interpolate);
+
+ var zeroArea = d3.svg.area()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d) { return y(d.display.y0) })
+ .y1(function(d) { return y(d.display.y0) });
+
+
+ var path = g.select('.nv-areaWrap').selectAll('path.nv-area')
+ .data(function(d) { return d });
+
+ path.enter().append('path').attr('class', function(d,i) { return 'nv-area nv-area-' + i })
+ .attr('d', function(d,i){
+ return zeroArea(d.values, d.seriesIndex);
+ })
+ .on('mouseover', function(d,i) {
+ d3.select(this).classed('hover', true);
+ dispatch.areaMouseover({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.areaMouseout({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ .on('click', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.areaClick({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ path.exit().transition()
+ .attr('d', function(d,i) { return zeroArea(d.values,i) })
+ .remove();
+ path
+ .style('fill', function(d,i){
+ return d.color || color(d, d.seriesIndex)
+ })
+ .style('stroke', function(d,i){ return d.color || color(d, d.seriesIndex) });
+ path.transition()
+ .attr('d', function(d,i) {
+ return area(d.values,i)
+ });
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseover.area', function(e) {
+ g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', true);
+ });
+ scatter.dispatch.on('elementMouseout.area', function(e) {
+ g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', false);
+ });
+
+ //============================================================
+ //Special offset functions
+ chart.d3_stackedOffset_stackPercent = function(stackData) {
+ var n = stackData.length, //How many series
+ m = stackData[0].length, //how many points per series
+ k = 1 / n,
+ i,
+ j,
+ o,
+ y0 = [];
+
+ for (j = 0; j < m; ++j) { //Looping through all points
+ for (i = 0, o = 0; i < dataRaw.length; i++) //looping through series'
+ o += getY(dataRaw[i].values[j]) //total value of all points at a certian point in time.
+
+ if (o) for (i = 0; i < n; i++)
+ stackData[i][j][1] /= o;
+ else
+ for (i = 0; i < n; i++)
+ stackData[i][j][1] = k;
+ }
+ for (j = 0; j < m; ++j) y0[j] = 0;
+ return y0;
+ };
+
+ });
+
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementClick.area', function(e) {
+ dispatch.areaClick(e);
+ })
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ //============================================================
+
+ //============================================================
+ // Global getters and setters
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+
+ d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange',
+ 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'useVoronoi','clipRadius','highlightPoint','clearHighlights');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ }
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.offset = function(_) {
+ if (!arguments.length) return offset;
+ offset = _;
+ return chart;
+ };
+
+ chart.order = function(_) {
+ if (!arguments.length) return order;
+ order = _;
+ return chart;
+ };
+
+ //shortcut for offset + order
+ chart.style = function(_) {
+ if (!arguments.length) return style;
+ style = _;
+
+ switch (style) {
+ case 'stack':
+ chart.offset('zero');
+ chart.order('default');
+ break;
+ case 'stream':
+ chart.offset('wiggle');
+ chart.order('inside-out');
+ break;
+ case 'stream-center':
+ chart.offset('silhouette');
+ chart.order('inside-out');
+ break;
+ case 'expand':
+ chart.offset('expand');
+ chart.order('default');
+ break;
+ case 'stack_percent':
+ chart.offset(chart.d3_stackedOffset_stackPercent);
+ chart.order('default');
+ break;
+ }
+
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ interpolate = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedAreaChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedAreaChart.js
new file mode 100644
index 00000000..a036b8b0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedAreaChart.js
@@ -0,0 +1,629 @@
+
+nv.models.stackedAreaChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var stacked = nv.models.stackedArea()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , interactiveLayer = nv.interactiveGuideline()
+ ;
+
+ var margin = {top: 30, right: 25, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor() // a function that takes in d, i and returns color
+ , showControls = true
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , useInteractiveGuideline = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' on ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , yAxisTickFormat = d3.format(',.2f')
+ , state = { style: stacked.style() }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = 250
+ , cData = ['Stacked','Stream','Expanded']
+ , controlLabels = {}
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ controls.updateState(false);
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(stacked.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(stacked.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = stacked.xScale();
+ y = stacked.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-stackedAreaChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedAreaChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append("rect").style("opacity",0);
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-stackedWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+ gEnter.append('g').attr('class', 'nv-interactive');
+
+ g.select("rect").attr("width",availableWidth).attr("height",availableHeight);
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ var legendWidth = (showControls) ? availableWidth - controlWidth : availableWidth;
+ legend
+ .width(legendWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth-legendWidth) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ {
+ key: controlLabels.stacked || 'Stacked',
+ metaKey: 'Stacked',
+ disabled: stacked.style() != 'stack',
+ style: 'stack'
+ },
+ {
+ key: controlLabels.stream || 'Stream',
+ metaKey: 'Stream',
+ disabled: stacked.style() != 'stream',
+ style: 'stream'
+ },
+ {
+ key: controlLabels.expanded || 'Expanded',
+ metaKey: 'Expanded',
+ disabled: stacked.style() != 'expand',
+ style: 'expand'
+ },
+ {
+ key: controlLabels.stack_percent || 'Stack %',
+ metaKey: 'Stack_Percent',
+ disabled: stacked.style() != 'stack_percent',
+ style: 'stack_percent'
+ }
+ ];
+
+ controlWidth = (cData.length/3) * 260;
+
+ controlsData = controlsData.filter(function(d) {
+ return cData.indexOf(d.metaKey) !== -1;
+ })
+
+ controls
+ .width( controlWidth )
+ .color(['#444', '#444', '#444']);
+
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .call(controls);
+
+
+ if ( margin.top != Math.max(controls.height(), legend.height()) ) {
+ margin.top = Math.max(controls.height(), legend.height());
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+
+ g.select('.nv-controlsWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ //------------------------------------------------------------
+ //Set up interactive layer
+ if (useInteractiveGuideline) {
+ interactiveLayer
+ .width(availableWidth)
+ .height(availableHeight)
+ .margin({left: margin.left, top: margin.top})
+ .svgContainer(container)
+ .xScale(x);
+ wrap.select(".nv-interactive").call(interactiveLayer);
+ }
+
+ stacked
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var stackedWrap = g.select('.nv-stackedWrap')
+ .datum(data);
+
+ stackedWrap.transition().call(stacked);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize( -availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+
+ g.select('.nv-x.nv-axis')
+ .transition().duration(0)
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks(stacked.offset() == 'wiggle' ? 0 : availableHeight / 36)
+ .tickSize(-availableWidth, 0)
+ .setTickFormat( (stacked.style() == 'expand' || stacked.style() == 'stack_percent')
+ ? d3.format('%') : yAxisTickFormat);
+
+ g.select('.nv-y.nv-axis')
+ .transition().duration(0)
+ .call(yAxis);
+ }
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ stacked.dispatch.on('areaClick.toggle', function(e) {
+ if (data.filter(function(d) { return !d.disabled }).length === 1)
+ data.forEach(function(d) {
+ d.disabled = false;
+ });
+ else
+ data.forEach(function(d,i) {
+ d.disabled = (i != e.seriesIndex);
+ });
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state.disabled = newState.disabled;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ stacked.style(d.style);
+
+
+ state.style = stacked.style();
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+
+ interactiveLayer.dispatch.on('elementMousemove', function(e) {
+ stacked.clearHighlights();
+ var singlePoint, pointIndex, pointXLocation, allData = [];
+ data
+ .filter(function(series, i) {
+ series.seriesIndex = i;
+ return !series.disabled;
+ })
+ .forEach(function(series,i) {
+ pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x());
+ stacked.highlightPoint(i, pointIndex, true);
+ var point = series.values[pointIndex];
+ if (typeof point === 'undefined') return;
+ if (typeof singlePoint === 'undefined') singlePoint = point;
+ if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex));
+
+ //If we are in 'expand' mode, use the stacked percent value instead of raw value.
+ var tooltipValue = (stacked.style() == 'expand') ? point.display.y : chart.y()(point,pointIndex);
+ allData.push({
+ key: series.key,
+ value: tooltipValue,
+ color: color(series,series.seriesIndex),
+ stackedValue: point.display
+ });
+ });
+
+ allData.reverse();
+
+ //Highlight the tooltip entry based on which stack the mouse is closest to.
+ if (allData.length > 2) {
+ var yValue = chart.yScale().invert(e.mouseY);
+ var yDistMax = Infinity, indexToHighlight = null;
+ allData.forEach(function(series,i) {
+ if ( yValue >= series.stackedValue.y0 && yValue <= (series.stackedValue.y0 + series.stackedValue.y))
+ {
+ indexToHighlight = i;
+ return;
+ }
+ });
+ if (indexToHighlight != null)
+ allData[indexToHighlight].highlight = true;
+ }
+
+ var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));
+
+ //If we are in 'expand' mode, force the format to be a percentage.
+ var valueFormatter = (stacked.style() == 'expand') ?
+ function(d,i) {return d3.format(".1%")(d);} :
+ function(d,i) {return yAxis.tickFormat()(d); };
+ interactiveLayer.tooltip
+ .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
+ .chartContainer(that.parentNode)
+ .enabled(tooltips)
+ .valueFormatter(valueFormatter)
+ .data(
+ {
+ value: xValue,
+ series: allData
+ }
+ )();
+
+ interactiveLayer.renderGuideLine(pointXLocation);
+
+ });
+
+ interactiveLayer.dispatch.on("elementMouseout",function(e) {
+ dispatch.tooltipHide();
+ stacked.clearHighlights();
+ });
+
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.style !== 'undefined') {
+ stacked.style(e.style);
+ }
+
+ chart.update();
+ });
+
+ });
+
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ stacked.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ /*
+ if (!Math.round(stacked.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+ */
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stacked.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.stacked = stacked;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.interactiveLayer = interactiveLayer;
+
+ d3.rebind(chart, stacked, 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'interactive', 'useVoronoi', 'offset', 'order', 'style', 'clipEdge', 'forceX', 'forceY', 'forceSize', 'interpolate');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ stacked.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.useInteractiveGuideline = function(_) {
+ if(!arguments.length) return useInteractiveGuideline;
+ useInteractiveGuideline = _;
+ if (_ === true) {
+ chart.interactive(false);
+ chart.useVoronoi(false);
+ }
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ chart.controlsData = function(_) {
+ if (!arguments.length) return cData;
+ cData = _;
+ return chart;
+ };
+
+ chart.controlLabels = function(_) {
+ if (!arguments.length) return controlLabels;
+ if (typeof _ !== 'object') return controlLabels;
+ controlLabels = _;
+ return chart;
+ };
+
+ yAxis.setTickFormat = yAxis.tickFormat;
+
+ yAxis.tickFormat = function(_) {
+ if (!arguments.length) return yAxisTickFormat;
+ yAxisTickFormat = _;
+ return yAxis;
+ };
+
+
+ //============================================================
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.js
new file mode 100644
index 00000000..78586667
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.js
@@ -0,0 +1,13097 @@
+(function(){
+
+var nv = window.nv || {};
+
+nv.version = '0.0.1a';
+nv.dev = true //set false when in production
+
+window.nv = nv;
+
+nv.tooltip = {}; // For the tooltip system
+nv.utils = {}; // Utility subsystem
+nv.models = {}; //stores all the possible models/components
+nv.charts = {}; //stores all the ready to use charts
+nv.graphs = []; //stores all the graphs currently on the page
+nv.logs = {}; //stores some statistics and potential error messages
+
+nv.dispatch = d3.dispatch('render_start', 'render_end');
+
+// *************************************************************************
+// Development render timers - disabled if dev = false
+
+if (nv.dev) {
+ nv.dispatch.on('render_start', function(e) {
+ nv.logs.startTime = +new Date();
+ });
+
+ nv.dispatch.on('render_end', function(e) {
+ nv.logs.endTime = +new Date();
+ nv.logs.totalTime = nv.logs.endTime - nv.logs.startTime;
+ nv.log('total', nv.logs.totalTime); // used for development, to keep track of graph generation times
+ });
+}
+
+// ********************************************
+// Public Core NV functions
+
+// Logs all arguments, and returns the last so you can test things in place
+nv.log = function() {
+ if (nv.dev && console.log && console.log.apply)
+ console.log.apply(console, arguments)
+ else if (nv.dev && console.log && Function.prototype.bind) {
+ var log = Function.prototype.bind.call(console.log, console);
+ log.apply(console, arguments);
+ }
+ return arguments[arguments.length - 1];
+};
+
+
+nv.render = function render(step) {
+ step = step || 1; // number of graphs to generate in each timeout loop
+
+ nv.render.active = true;
+ nv.dispatch.render_start();
+
+ setTimeout(function() {
+ var chart, graph;
+
+ for (var i = 0; i < step && (graph = nv.render.queue[i]); i++) {
+ chart = graph.generate();
+ if (typeof graph.callback == typeof(Function)) graph.callback(chart);
+ nv.graphs.push(chart);
+ }
+
+ nv.render.queue.splice(0, i);
+
+ if (nv.render.queue.length) setTimeout(arguments.callee, 0);
+ else { nv.render.active = false; nv.dispatch.render_end(); }
+ }, 0);
+};
+
+nv.render.active = false;
+nv.render.queue = [];
+
+nv.addGraph = function(obj) {
+ if (typeof arguments[0] === typeof(Function))
+ obj = {generate: arguments[0], callback: arguments[1]};
+
+ nv.render.queue.push(obj);
+
+ if (!nv.render.active) nv.render();
+};
+
+nv.identity = function(d) { return d; };
+
+nv.strip = function(s) { return s.replace(/(\s|&)/g,''); };
+
+function daysInMonth(month,year) {
+ return (new Date(year, month+1, 0)).getDate();
+}
+
+function d3_time_range(floor, step, number) {
+ return function(t0, t1, dt) {
+ var time = floor(t0), times = [];
+ if (time < t0) step(time);
+ if (dt > 1) {
+ while (time < t1) {
+ var date = new Date(+time);
+ if ((number(date) % dt === 0)) times.push(date);
+ step(time);
+ }
+ } else {
+ while (time < t1) { times.push(new Date(+time)); step(time); }
+ }
+ return times;
+ };
+}
+
+d3.time.monthEnd = function(date) {
+ return new Date(date.getFullYear(), date.getMonth(), 0);
+};
+
+d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) {
+ date.setUTCDate(date.getUTCDate() + 1);
+ date.setDate(daysInMonth(date.getMonth() + 1, date.getFullYear()));
+ }, function(date) {
+ return date.getMonth();
+ }
+);
+
+
+/*****
+ * A no-frills tooltip implementation.
+ *****/
+
+
+(function() {
+
+ var nvtooltip = window.nv.tooltip = {};
+
+ nvtooltip.show = function(pos, content, gravity, dist, parentContainer, classes) {
+
+ var container = document.createElement('div');
+ container.className = 'nvtooltip ' + (classes ? classes : 'xy-tooltip');
+
+ gravity = gravity || 's';
+ dist = dist || 20;
+
+ var body = parentContainer;
+ if ( !parentContainer || parentContainer.tagName.match(/g|svg/i)) {
+ //If the parent element is an SVG element, place tooltip in the <body> element.
+ body = document.getElementsByTagName('body')[0];
+ }
+
+ container.innerHTML = content;
+ container.style.left = 0;
+ container.style.top = 0;
+ container.style.opacity = 0;
+
+ body.appendChild(container);
+
+ var height = parseInt(container.offsetHeight),
+ width = parseInt(container.offsetWidth),
+ windowWidth = nv.utils.windowSize().width,
+ windowHeight = nv.utils.windowSize().height,
+ scrollTop = window.scrollY,
+ scrollLeft = window.scrollX,
+ left, top;
+
+ windowHeight = window.innerWidth >= document.body.scrollWidth ? windowHeight : windowHeight - 16;
+ windowWidth = window.innerHeight >= document.body.scrollHeight ? windowWidth : windowWidth - 16;
+
+ var tooltipTop = function ( Elem ) {
+ var offsetTop = top;
+ do {
+ if( !isNaN( Elem.offsetTop ) ) {
+ offsetTop += (Elem.offsetTop);
+ }
+ } while( Elem = Elem.offsetParent );
+ return offsetTop;
+ }
+
+ var tooltipLeft = function ( Elem ) {
+ var offsetLeft = left;
+ do {
+ if( !isNaN( Elem.offsetLeft ) ) {
+ offsetLeft += (Elem.offsetLeft);
+ }
+ } while( Elem = Elem.offsetParent );
+ return offsetLeft;
+ }
+
+ switch (gravity) {
+ case 'e':
+ left = pos[0] - width - dist;
+ top = pos[1] - (height / 2);
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = pos[0] + dist > scrollLeft ? pos[0] + dist : scrollLeft - tLeft + left;
+ if (tTop < scrollTop) top = scrollTop - tTop + top;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
+ break;
+ case 'w':
+ left = pos[0] + dist;
+ top = pos[1] - (height / 2);
+ if (tLeft + width > windowWidth) left = pos[0] - width - dist;
+ if (tTop < scrollTop) top = scrollTop + 5;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop - height - 5;
+ break;
+ case 'n':
+ left = pos[0] - (width / 2) - 5;
+ top = pos[1] + dist;
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = scrollLeft + 5;
+ if (tLeft + width > windowWidth) left = left - width/2 + 5;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
+ break;
+ case 's':
+ left = pos[0] - (width / 2);
+ top = pos[1] - height - dist;
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = scrollLeft + 5;
+ if (tLeft + width > windowWidth) left = left - width/2 + 5;
+ if (scrollTop > tTop) top = scrollTop;
+ break;
+ }
+
+
+ container.style.left = left+'px';
+ container.style.top = top+'px';
+ container.style.opacity = 1;
+ container.style.position = 'absolute'; //fix scroll bar issue
+ container.style.pointerEvents = 'none'; //fix scroll bar issue
+
+ return container;
+ };
+
+ nvtooltip.cleanup = function() {
+
+ // Find the tooltips, mark them for removal by this class (so others cleanups won't find it)
+ var tooltips = document.getElementsByClassName('nvtooltip');
+ var purging = [];
+ while(tooltips.length) {
+ purging.push(tooltips[0]);
+ tooltips[0].style.transitionDelay = '0 !important';
+ tooltips[0].style.opacity = 0;
+ tooltips[0].className = 'nvtooltip-pending-removal';
+ }
+
+
+ setTimeout(function() {
+
+ while (purging.length) {
+ var removeMe = purging.pop();
+ removeMe.parentNode.removeChild(removeMe);
+ }
+ }, 500);
+ };
+
+
+})();
+
+nv.utils.windowSize = function() {
+ // Sane defaults
+ var size = {width: 640, height: 480};
+
+ // Earlier IE uses Doc.body
+ if (document.body && document.body.offsetWidth) {
+ size.width = document.body.offsetWidth;
+ size.height = document.body.offsetHeight;
+ }
+
+ // IE can use depending on mode it is in
+ if (document.compatMode=='CSS1Compat' &&
+ document.documentElement &&
+ document.documentElement.offsetWidth ) {
+ size.width = document.documentElement.offsetWidth;
+ size.height = document.documentElement.offsetHeight;
+ }
+
+ // Most recent browsers use
+ if (window.innerWidth && window.innerHeight) {
+ size.width = window.innerWidth;
+ size.height = window.innerHeight;
+ }
+ return (size);
+};
+
+
+
+// Easy way to bind multiple functions to window.onresize
+// TODO: give a way to remove a function after its bound, other than removing all of them
+nv.utils.windowResize = function(fun){
+ var oldresize = window.onresize;
+
+ window.onresize = function(e) {
+ if (typeof oldresize == 'function') oldresize(e);
+ fun(e);
+ }
+}
+
+// Backwards compatible way to implement more d3-like coloring of graphs.
+// If passed an array, wrap it in a function which implements the old default
+// behavior
+nv.utils.getColor = function(color) {
+ if (!arguments.length) return nv.utils.defaultColor(); //if you pass in nothing, get default colors back
+
+ if( Object.prototype.toString.call( color ) === '[object Array]' )
+ return function(d, i) { return d.color || color[i % color.length]; };
+ else
+ return color;
+ //can't really help it if someone passes rubbish as color
+}
+
+// Default color chooser uses the index of an object as before.
+nv.utils.defaultColor = function() {
+ var colors = d3.scale.category20().range();
+ return function(d, i) { return d.color || colors[i % colors.length] };
+}
+
+
+// Returns a color function that takes the result of 'getKey' for each series and
+// looks for a corresponding color from the dictionary,
+nv.utils.customTheme = function(dictionary, getKey, defaultColors) {
+ getKey = getKey || function(series) { return series.key }; // use default series.key if getKey is undefined
+ defaultColors = defaultColors || d3.scale.category20().range(); //default color function
+
+ var defIndex = defaultColors.length; //current default color (going in reverse)
+
+ return function(series, index) {
+ var key = getKey(series);
+
+ if (!defIndex) defIndex = defaultColors.length; //used all the default colors, start over
+
+ if (typeof dictionary[key] !== "undefined")
+ return (typeof dictionary[key] === "function") ? dictionary[key]() : dictionary[key];
+ else
+ return defaultColors[--defIndex]; // no match in dictionary, use default color
+ }
+}
+
+
+
+// From the PJAX example on d3js.org, while this is not really directly needed
+// it's a very cool method for doing pjax, I may expand upon it a little bit,
+// open to suggestions on anything that may be useful
+nv.utils.pjax = function(links, content) {
+ d3.selectAll(links).on("click", function() {
+ history.pushState(this.href, this.textContent, this.href);
+ load(this.href);
+ d3.event.preventDefault();
+ });
+
+ function load(href) {
+ d3.html(href, function(fragment) {
+ var target = d3.select(content).node();
+ target.parentNode.replaceChild(d3.select(fragment).select(content).node(), target);
+ nv.utils.pjax(links, content);
+ });
+ }
+
+ d3.select(window).on("popstate", function() {
+ if (d3.event.state) load(d3.event.state);
+ });
+}
+
+/* For situations where we want to approximate the width in pixels for an SVG:text element.
+Most common instance is when the element is in a display:none; container.
+Forumla is : text.length * font-size * constant_factor
+*/
+nv.utils.calcApproxTextWidth = function (svgTextElem) {
+ if (svgTextElem instanceof d3.selection) {
+ var fontSize = parseInt(svgTextElem.style("font-size").replace("px",""));
+ var textLength = svgTextElem.text().length;
+
+ return textLength * fontSize * 0.5;
+ }
+ return 0;
+};
+nv.models.axis = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var axis = d3.svg.axis()
+ ;
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 75 //only used for tickLabel currently
+ , height = 60 //only used for tickLabel currently
+ , scale = d3.scale.linear()
+ , axisLabelText = null
+ , showMaxMin = true //TODO: showMaxMin should be disabled on all ordinal scaled axes
+ , highlightZero = true
+ , rotateLabels = 0
+ , rotateYLabel = true
+ , staggerLabels = false
+ , isOrdinal = false
+ , ticks = null
+ , logScale=false
+ ;
+
+ axis
+ .scale(scale)
+ .orient('bottom')
+ .tickFormat(function(d) { return d })
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var scale0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-axis').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-axis');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ //------------------------------------------------------------
+
+
+ if (ticks !== null)
+ axis.ticks(ticks);
+ else if (axis.orient() == 'top' || axis.orient() == 'bottom')
+ axis.ticks(Math.abs(scale.range()[1] - scale.range()[0]) / 100);
+
+
+ //TODO: consider calculating width/height based on whether or not label is added, for reference in charts using this component
+
+
+ d3.transition(g)
+ .call(axis);
+
+ scale0 = scale0 || axis.scale();
+
+ var fmt = axis.tickFormat();
+ if (fmt == null) {
+ fmt = scale0.tickFormat();
+ }
+
+ var axisLabel = g.selectAll('text.nv-axislabel')
+ .data([axisLabelText || null]);
+ axisLabel.exit().remove();
+ switch (axis.orient()) {
+ case 'top':
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0]));
+ axisLabel
+ .attr('text-anchor', 'middle')
+ .attr('y', 0)
+ .attr('x', w/2);
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text');
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(' + scale(d) + ',0)'
+ })
+ .select('text')
+ .attr('dy', '0em')
+ .attr('y', -axis.tickPadding())
+ .attr('text-anchor', 'middle')
+ .text(function(d,i) {
+ var v = fmt(d);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ d3.transition(axisMaxMin)
+ .attr('transform', function(d,i) {
+ return 'translate(' + scale.range()[i] + ',0)'
+ });
+ }
+ break;
+ case 'bottom':
+ var xLabelMargin = 36;
+ var maxTextWidth = 30;
+ var xTicks = g.selectAll('g').select("text");
+ if (rotateLabels%360) {
+ //Calculate the longest xTick width
+ xTicks.each(function(d,i){
+ var width = this.getBBox().width;
+ if(width > maxTextWidth) maxTextWidth = width;
+ });
+ //Convert to radians before calculating sin. Add 30 to margin for healthy padding.
+ var sin = Math.abs(Math.sin(rotateLabels*Math.PI/180));
+ var xLabelMargin = (sin ? sin*maxTextWidth : maxTextWidth)+30;
+ //Rotate all xTicks
+ xTicks
+ .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' })
+ .attr('text-anchor', rotateLabels%360 > 0 ? 'start' : 'end');
+ }
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0]));
+ axisLabel
+ .attr('text-anchor', 'middle')
+ .attr('y', xLabelMargin)
+ .attr('x', w/2);
+ if (showMaxMin) {
+ //if (showMaxMin && !isOrdinal) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ //.data(scale.domain())
+ .data([scale.domain()[0], scale.domain()[scale.domain().length - 1]]);
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text');
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)'
+ })
+ .select('text')
+ .attr('dy', '.71em')
+ .attr('y', axis.tickPadding())
+ .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' })
+ .attr('text-anchor', rotateLabels ? (rotateLabels%360 > 0 ? 'start' : 'end') : 'middle')
+ .text(function(d,i) {
+ var v = fmt(d);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ d3.transition(axisMaxMin)
+ .attr('transform', function(d,i) {
+ //return 'translate(' + scale.range()[i] + ',0)'
+ //return 'translate(' + scale(d) + ',0)'
+ return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)'
+ });
+ }
+ if (staggerLabels)
+ xTicks
+ .attr('transform', function(d,i) { return 'translate(0,' + (i % 2 == 0 ? '0' : '12') + ')' });
+
+ break;
+ case 'right':
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ axisLabel
+ .attr('text-anchor', rotateYLabel ? 'middle' : 'begin')
+ .attr('transform', rotateYLabel ? 'rotate(90)' : '')
+ .attr('y', rotateYLabel ? (-Math.max(margin.right,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart
+ .attr('x', rotateYLabel ? (scale.range()[0] / 2) : axis.tickPadding());
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text')
+ .style('opacity', 0);
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale(d) + ')'
+ })
+ .select('text')
+ .attr('dy', '.32em')
+ .attr('y', 0)
+ .attr('x', axis.tickPadding())
+ .attr('text-anchor', 'start')
+ .text(function(d,i) {
+ var v = fmt(d);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ d3.transition(axisMaxMin)
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale.range()[i] + ')'
+ })
+ .select('text')
+ .style('opacity', 1);
+ }
+ break;
+ case 'left':
+ /*
+ //For dynamically placing the label. Can be used with dynamically-sized chart axis margins
+ var yTicks = g.selectAll('g').select("text");
+ yTicks.each(function(d,i){
+ var labelPadding = this.getBBox().width + axis.tickPadding() + 16;
+ if(labelPadding > width) width = labelPadding;
+ });
+ */
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ axisLabel
+ .attr('text-anchor', rotateYLabel ? 'middle' : 'end')
+ .attr('transform', rotateYLabel ? 'rotate(-90)' : '')
+ .attr('y', rotateYLabel ? (-Math.max(margin.left,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart
+ .attr('x', rotateYLabel ? (-scale.range()[0] / 2) : -axis.tickPadding());
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text')
+ .style('opacity', 0);
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale0(d) + ')'
+ })
+ .select('text')
+ .attr('dy', '.32em')
+ .attr('y', 0)
+ .attr('x', -axis.tickPadding())
+ .attr('text-anchor', 'end')
+ .text(function(d,i) {
+ var v = fmt(d);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ d3.transition(axisMaxMin)
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale.range()[i] + ')'
+ })
+ .select('text')
+ .style('opacity', 1);
+ }
+ break;
+ }
+ axisLabel
+ .text(function(d) { return d });
+
+
+ if (showMaxMin && (axis.orient() === 'left' || axis.orient() === 'right')) {
+ //check if max and min overlap other values, if so, hide the values that overlap
+ g.selectAll('g') // the g's wrapping each tick
+ .each(function(d,i) {
+ d3.select(this).select('text').attr('opacity', 1);
+ if (scale(d) < scale.range()[1] + 10 || scale(d) > scale.range()[0] - 10) { // 10 is assuming text height is 16... if d is 0, leave it!
+ if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL
+ d3.select(this).attr('opacity', 0);
+
+ d3.select(this).select('text').attr('opacity', 0); // Don't remove the ZERO line!!
+ }
+ });
+
+ //if Max and Min = 0 only show min, Issue #281
+ if (scale.domain()[0] == scale.domain()[1] && scale.domain()[0] == 0)
+ wrap.selectAll('g.nv-axisMaxMin')
+ .style('opacity', function(d,i) { return !i ? 1 : 0 });
+
+ }
+
+ if (showMaxMin && (axis.orient() === 'top' || axis.orient() === 'bottom')) {
+ var maxMinRange = [];
+ wrap.selectAll('g.nv-axisMaxMin')
+ .each(function(d,i) {
+ try {
+ if (i) // i== 1, max position
+ maxMinRange.push(scale(d) - this.getBBox().width - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
+ else // i==0, min position
+ maxMinRange.push(scale(d) + this.getBBox().width + 4)
+ }catch (err) {
+ if (i) // i== 1, max position
+ maxMinRange.push(scale(d) - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
+ else // i==0, min position
+ maxMinRange.push(scale(d) + 4)
+ }
+ });
+ g.selectAll('g') // the g's wrapping each tick
+ .each(function(d,i) {
+ if (scale(d) < maxMinRange[0] || scale(d) > maxMinRange[1]) {
+ if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL
+ d3.select(this).remove();
+ else
+ d3.select(this).select('text').remove(); // Don't remove the ZERO line!!
+ }
+ });
+ }
+
+
+ //highlight zero line ... Maybe should not be an option and should just be in CSS?
+ if (highlightZero)
+ g.selectAll('.tick')
+ .filter(function(d) { return !parseFloat(Math.round(d.__data__*100000)/1000000) && (d.__data__ !== undefined) }) //this is because sometimes the 0 tick is a very small fraction, TODO: think of cleaner technique
+ .classed('zero', true);
+
+ //store old scales for use in transitions on update
+ scale0 = scale.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.axis = axis;
+
+ d3.rebind(chart, axis, 'orient', 'tickValues', 'tickSubdivide', 'tickSize', 'tickPadding', 'tickFormat');
+ d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands'); //these are also accessible by chart.scale(), but added common ones directly for ease of use
+
+ chart.margin = function(_) {
+ if(!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ }
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.ticks = function(_) {
+ if (!arguments.length) return ticks;
+ ticks = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.axisLabel = function(_) {
+ if (!arguments.length) return axisLabelText;
+ axisLabelText = _;
+ return chart;
+ }
+
+ chart.showMaxMin = function(_) {
+ if (!arguments.length) return showMaxMin;
+ showMaxMin = _;
+ return chart;
+ }
+
+ chart.highlightZero = function(_) {
+ if (!arguments.length) return highlightZero;
+ highlightZero = _;
+ return chart;
+ }
+
+ chart.scale = function(_) {
+ if (!arguments.length) return scale;
+ scale = _;
+ axis.scale(scale);
+ isOrdinal = typeof scale.rangeBands === 'function';
+ d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands');
+ return chart;
+ }
+
+ chart.rotateYLabel = function(_) {
+ if(!arguments.length) return rotateYLabel;
+ rotateYLabel = _;
+ return chart;
+ }
+
+ chart.rotateLabels = function(_) {
+ if(!arguments.length) return rotateLabels;
+ rotateLabels = _;
+ return chart;
+ }
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+
+ //============================================================
+
+
+ return chart;
+}
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+
+nv.models.bullet = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , orient = 'left' // TODO top & bottom
+ , reverse = false
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , forceX = [0] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.)
+ , width = 380
+ , height = 30
+ , tickFormat = null
+ , color = nv.utils.getColor(['#1f77b4'])
+ , dispatch = d3.dispatch('elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain( d3.extent(d3.merge([forceX, rangez])) )
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+
+ var rangeMin = d3.min(rangez), //rangez[2]
+ rangeMax = d3.max(rangez), //rangez[0]
+ rangeAvg = rangez[1];
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bullet').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bullet');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeMax');
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeAvg');
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeMin');
+ gEnter.append('rect').attr('class', 'nv-measure');
+ gEnter.append('path').attr('class', 'nv-markerTriangle');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+ var xp0 = function(d) { return d < 0 ? x0(d) : x0(0) },
+ xp1 = function(d) { return d < 0 ? x1(d) : x1(0) };
+
+
+ g.select('rect.nv-rangeMax')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeMax > 0 ? rangeMax : rangeMin))
+ .attr('x', xp1(rangeMax > 0 ? rangeMax : rangeMin))
+ .datum(rangeMax > 0 ? rangeMax : rangeMin)
+ /*
+ .attr('x', rangeMin < 0 ?
+ rangeMax > 0 ?
+ x1(rangeMin)
+ : x1(rangeMax)
+ : x1(0))
+ */
+
+ g.select('rect.nv-rangeAvg')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeAvg))
+ .attr('x', xp1(rangeAvg))
+ .datum(rangeAvg)
+ /*
+ .attr('width', rangeMax <= 0 ?
+ x1(rangeMax) - x1(rangeAvg)
+ : x1(rangeAvg) - x1(rangeMin))
+ .attr('x', rangeMax <= 0 ?
+ x1(rangeAvg)
+ : x1(rangeMin))
+ */
+
+ g.select('rect.nv-rangeMin')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeMax))
+ .attr('x', xp1(rangeMax))
+ .attr('width', w1(rangeMax > 0 ? rangeMin : rangeMax))
+ .attr('x', xp1(rangeMax > 0 ? rangeMin : rangeMax))
+ .datum(rangeMax > 0 ? rangeMin : rangeMax)
+ /*
+ .attr('width', rangeMax <= 0 ?
+ x1(rangeAvg) - x1(rangeMin)
+ : x1(rangeMax) - x1(rangeAvg))
+ .attr('x', rangeMax <= 0 ?
+ x1(rangeMin)
+ : x1(rangeAvg))
+ */
+
+ g.select('rect.nv-measure')
+ .style('fill', color)
+ .attr('height', availableHeight / 3)
+ .attr('y', availableHeight / 3)
+ .attr('width', measurez < 0 ?
+ x1(0) - x1(measurez[0])
+ : x1(measurez[0]) - x1(0))
+ .attr('x', xp1(measurez))
+ .on('mouseover', function() {
+ dispatch.elementMouseover({
+ value: measurez[0],
+ label: 'Current',
+ pos: [x1(measurez[0]), availableHeight/2]
+ })
+ })
+ .on('mouseout', function() {
+ dispatch.elementMouseout({
+ value: measurez[0],
+ label: 'Current'
+ })
+ })
+
+ var h3 = availableHeight / 6;
+ if (markerz[0]) {
+ g.selectAll('path.nv-markerTriangle')
+ .attr('transform', function(d) { return 'translate(' + x1(markerz[0]) + ',' + (availableHeight / 2) + ')' })
+ .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
+ .on('mouseover', function() {
+ dispatch.elementMouseover({
+ value: markerz[0],
+ label: 'Previous',
+ pos: [x1(markerz[0]), availableHeight/2]
+ })
+ })
+ .on('mouseout', function() {
+ dispatch.elementMouseout({
+ value: markerz[0],
+ label: 'Previous'
+ })
+ });
+ } else {
+ g.selectAll('path.nv-markerTriangle').remove();
+ }
+
+
+ wrap.selectAll('.nv-range')
+ .on('mouseover', function(d,i) {
+ var label = !i ? "Maximum" : i == 1 ? "Mean" : "Minimum";
+
+ dispatch.elementMouseover({
+ value: d,
+ label: label,
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ var label = !i ? "Maximum" : i == 1 ? "Mean" : "Minimum";
+
+ dispatch.elementMouseout({
+ value: d,
+ label: label
+ })
+ })
+
+/* // THIS IS THE PREVIOUS BULLET IMPLEMENTATION, WILL REMOVE SHORTLY
+ // Update the range rects.
+ var range = g.selectAll('rect.nv-range')
+ .data(rangez);
+
+ range.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-range nv-s' + i; })
+ .attr('width', w0)
+ .attr('height', availableHeight)
+ .attr('x', reverse ? x0 : 0)
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: (i <= 0) ? 'Maximum' : (i > 1) ? 'Minimum' : 'Mean', //TODO: make these labels a variable
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: (i <= 0) ? 'Minimum' : (i >=1) ? 'Maximum' : 'Mean' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(range)
+ .attr('x', reverse ? x1 : 0)
+ .attr('width', w1)
+ .attr('height', availableHeight);
+
+
+ // Update the measure rects.
+ var measure = g.selectAll('rect.nv-measure')
+ .data(measurez);
+
+ measure.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-measure nv-s' + i; })
+ .style('fill', function(d,i) { return color(d,i ) })
+ .attr('width', w0)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x0 : 0)
+ .attr('y', availableHeight / 3)
+ .on('mouseover', function(d) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Current', //TODO: make these labels a variable
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Current' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(measure)
+ .attr('width', w1)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x1 : 0)
+ .attr('y', availableHeight / 3);
+
+
+
+ // Update the marker lines.
+ var marker = g.selectAll('path.nv-markerTriangle')
+ .data(markerz);
+
+ var h3 = availableHeight / 6;
+ marker.enter().append('path')
+ .attr('class', 'nv-markerTriangle')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',' + (availableHeight / 2) + ')' })
+ .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Previous',
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Previous'
+ })
+ });
+
+ d3.transition(marker)
+ .attr('transform', function(d) { return 'translate(' + (x1(d) - x1(0)) + ',' + (availableHeight / 2) + ')' });
+
+ marker.exit().remove();
+*/
+
+ });
+
+ // d3.timer.flush(); // Not needed?
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ // left, right, top, bottom
+ chart.orient = function(_) {
+ if (!arguments.length) return orient;
+ orient = _;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(_) {
+ if (!arguments.length) return ranges;
+ ranges = _;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(_) {
+ if (!arguments.length) return markers;
+ markers = _;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(_) {
+ if (!arguments.length) return measures;
+ measures = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(_) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+nv.models.bulletChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var bullet = nv.models.bullet()
+ ;
+
+ var orient = 'left' // TODO top & bottom
+ , reverse = false
+ , margin = {top: 5, right: 40, bottom: 20, left: 120}
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , width = null
+ , height = 55
+ , tickFormat = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ) + margin.left,
+ top = e.pos[1] + ( offsetElement.offsetTop || 0) + margin.top,
+ content = tooltip(e.key, e.label, e.value, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ that = this;
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!d || !ranges.call(this, d, i)) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', 18 + margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bulletChart').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bulletChart');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-bulletWrap');
+ gEnter.append('g').attr('class', 'nv-titles');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) // TODO: need to allow forceX and forceY, and xDomain, yDomain
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+ /*
+ // Derive width-scales from the x-scales.
+ var w0 = bulletWidth(x0),
+ w1 = bulletWidth(x1);
+
+ function bulletWidth(x) {
+ var x0 = x(0);
+ return function(d) {
+ return Math.abs(x(d) - x(0));
+ };
+ }
+
+ function bulletTranslate(x) {
+ return function(d) {
+ return 'translate(' + x(d) + ',0)';
+ };
+ }
+ */
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+
+
+ var title = gEnter.select('.nv-titles').append('g')
+ .attr('text-anchor', 'end')
+ .attr('transform', 'translate(-6,' + (height - margin.top - margin.bottom) / 2 + ')');
+ title.append('text')
+ .attr('class', 'nv-title')
+ .text(function(d) { return d.title; });
+
+ title.append('text')
+ .attr('class', 'nv-subtitle')
+ .attr('dy', '1em')
+ .text(function(d) { return d.subtitle; });
+
+
+
+ bullet
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var bulletWrap = g.select('.nv-bulletWrap');
+
+ d3.transition(bulletWrap).call(bullet);
+
+
+
+ // Compute the tick format.
+ var format = tickFormat || x1.tickFormat( availableWidth / 100 );
+
+ // Update the tick groups.
+ var tick = g.selectAll('g.nv-tick')
+ .data(x1.ticks( availableWidth / 50 ), function(d) {
+ return this.textContent || format(d);
+ });
+
+ // Initialize the ticks with the old scale, x0.
+ var tickEnter = tick.enter().append('g')
+ .attr('class', 'nv-tick')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',0)' })
+ .style('opacity', 1e-6);
+
+ tickEnter.append('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickEnter.append('text')
+ .attr('text-anchor', 'middle')
+ .attr('dy', '1em')
+ .attr('y', availableHeight * 7 / 6)
+ .text(format);
+
+
+ // Transition the updating ticks to the new scale, x1.
+ var tickUpdate = d3.transition(tick)
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1);
+
+ tickUpdate.select('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickUpdate.select('text')
+ .attr('y', availableHeight * 7 / 6);
+
+ // Transition the exiting ticks to the new scale, x1.
+ d3.transition(tick.exit())
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1e-6)
+ .remove();
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('tooltipShow', function(e) {
+ e.key = d.title;
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+ });
+
+ d3.timer.flush();
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ bullet.dispatch.on('elementMouseover.tooltip', function(e) {
+ dispatch.tooltipShow(e);
+ });
+
+ bullet.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.bullet = bullet;
+
+ d3.rebind(chart, bullet, 'color');
+
+ // left, right, top, bottom
+ chart.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(x) {
+ if (!arguments.length) return ranges;
+ ranges = x;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(x) {
+ if (!arguments.length) return markers;
+ markers = x;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(x) {
+ if (!arguments.length) return measures;
+ measures = x;
+ return chart;
+ };
+
+ chart.width = function(x) {
+ if (!arguments.length) return width;
+ width = x;
+ return chart;
+ };
+
+ chart.height = function(x) {
+ if (!arguments.length) return height;
+ height = x;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = x;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
+
+nv.models.cumulativeLineChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 50, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = true
+ , tooltips = true
+ , showControls = true
+ , rescaleY = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , id = lines.id()
+ , state = { index: 0, rescaleY: rescaleY }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , average = function(d) { return d.average }
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient('left')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var dx = d3.scale.linear()
+ , index = {i: 0, x: 0}
+ ;
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+/*
+ //Moved to see if we can get better behavior to fix issue #315
+ var indexDrag = d3.behavior.drag()
+ .on('dragstart', dragStart)
+ .on('drag', dragMove)
+ .on('dragend', dragEnd);
+
+ function dragStart(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'ew-resize');
+ }
+
+ function dragMove(d,i) {
+ d.x += d3.event.dx;
+ d.i = Math.round(dx.invert(d.x));
+
+ d3.select(this).attr('transform', 'translate(' + dx(d.i) + ',0)');
+ chart.update();
+ }
+
+ function dragEnd(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'auto');
+ chart.update();
+ }
+*/
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this).classed('nv-chart-' + id, true),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { container.transition().call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ var indexDrag = d3.behavior.drag()
+ .on('dragstart', dragStart)
+ .on('drag', dragMove)
+ .on('dragend', dragEnd);
+
+
+ function dragStart(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'ew-resize');
+ }
+
+ function dragMove(d,i) {
+ index.x = d3.event.x;
+ index.i = Math.round(dx.invert(index.x));
+ updateZero();
+ }
+
+ function dragEnd(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'auto');
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+ }
+
+
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+
+
+ if (!rescaleY) {
+ var seriesDomains = data
+ .filter(function(series) { return !series.disabled })
+ .map(function(series,i) {
+ var initialDomain = d3.extent(series.values, lines.y());
+
+ //account for series being disabled when losing 95% or more
+ if (initialDomain[0] < -.95) initialDomain[0] = -.95;
+
+ return [
+ (initialDomain[0] - initialDomain[1]) / (1 + initialDomain[1]),
+ (initialDomain[1] - initialDomain[0]) / (1 + initialDomain[0])
+ ];
+ });
+
+ var completeDomain = [
+ d3.min(seriesDomains, function(d) { return d[0] }),
+ d3.max(seriesDomains, function(d) { return d[1] })
+ ]
+
+ lines.yDomain(completeDomain);
+ } else {
+ lines.yDomain(null);
+ }
+
+
+ dx .domain([0, data[0].values.length - 1]) //Assumes all series have same length
+ .range([0, availableWidth])
+ .clamp(true);
+
+ //------------------------------------------------------------
+
+
+ var data = indexify(index.i, data);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-cumulativeLine').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-cumulativeLine').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-background');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-avgLinesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Re-scale y-axis', disabled: !rescaleY }
+ ];
+
+ controls.width(140).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ // Show error if series goes below 100%
+ var tempDisabled = data.filter(function(d) { return d.tempDisabled });
+
+ wrap.select('.tempDisabled').remove(); //clean-up and prevent duplicates
+ if (tempDisabled.length) {
+ wrap.append('text').attr('class', 'tempDisabled')
+ .attr('x', availableWidth / 2)
+ .attr('y', '-.71em')
+ .style('text-anchor', 'end')
+ .text(tempDisabled.map(function(d) { return d.key }).join(', ') + ' values cannot be calculated for this time period.');
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ gEnter.select('.nv-background')
+ .append('rect');
+
+ g.select('.nv-background rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ lines
+ //.x(function(d) { return d.x })
+ .y(function(d) { return d.display.y })
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].tempDisabled; }));
+
+
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled && !d.tempDisabled }));
+
+ //d3.transition(linesWrap).call(lines);
+ linesWrap.call(lines);
+
+ /*Handle average lines [AN-612] ----------------------------*/
+
+ //Store a series index number in the data array.
+ data.forEach(function(d,i) {
+ d.seriesIndex = i;
+ });
+
+ var avgLineData = data.filter(function(d) {
+ return !d.disabled && !!average(d);
+ });
+
+ var avgLines = g.select(".nv-avgLinesWrap").selectAll("line")
+ .data(avgLineData, function(d) { return d.key; });
+
+ avgLines.enter()
+ .append('line')
+ .style('stroke-width',2)
+ .style('stroke-dasharray','10,10')
+ .style('stroke',function (d,i) {
+ return lines.color()(d,d.seriesIndex);
+ })
+ .attr('x1',0)
+ .attr('x2',availableWidth)
+ .attr('y1', function(d) { return y(average(d)); })
+ .attr('y2', function(d) { return y(average(d)); });
+
+ avgLines
+ .attr('x1',0)
+ .attr('x2',availableWidth)
+ .attr('y1', function(d) { return y(average(d)); })
+ .attr('y2', function(d) { return y(average(d)); });
+
+ avgLines.exit().remove();
+
+ //Create index line -----------------------------------------
+
+ var indexLine = linesWrap.selectAll('.nv-indexLine')
+ .data([index]);
+ indexLine.enter().append('rect').attr('class', 'nv-indexLine')
+ .attr('width', 3)
+ .attr('x', -2)
+ .attr('fill', 'red')
+ .attr('fill-opacity', .5)
+ .call(indexDrag)
+
+ indexLine
+ .attr('transform', function(d) { return 'translate(' + dx(d.i) + ',0)' })
+ .attr('height', availableHeight)
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ //Suggest how many ticks based on the chart width and D3 should listen (70 is the optimal number for MM/DD/YY dates)
+ .ticks( Math.min(data[0].values.length,availableWidth/70) )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+
+ function updateZero() {
+ indexLine
+ .data([index]);
+
+ container.call(chart);
+ }
+
+ g.select('.nv-background rect')
+ .on('click', function() {
+ index.x = d3.mouse(this)[0];
+ index.i = Math.round(dx.invert(index.x));
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+
+ updateZero();
+ });
+
+ lines.dispatch.on('elementClick', function(e) {
+ index.i = e.pointIndex;
+ index.x = dx(index.i);
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+
+ updateZero();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+ rescaleY = !d.disabled;
+
+ state.rescaleY = rescaleY;
+ dispatch.stateChange(state);
+
+ //selection.transition().call(chart);
+ chart.update();
+ });
+
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ //selection.transition().call(chart);
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+/*
+ //
+ legend.dispatch.on('legendMouseover', function(d, i) {
+ d.hover = true;
+ selection.transition().call(chart)
+ });
+
+ legend.dispatch.on('legendMouseout', function(d, i) {
+ d.hover = false;
+ selection.transition().call(chart)
+ });
+*/
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+
+ if (typeof e.index !== 'undefined') {
+ index.i = e.index;
+ index.x = dx(index.i);
+
+ state.index = e.index;
+
+ indexLine
+ .data([index]);
+ }
+
+
+ if (typeof e.rescaleY !== 'undefined') {
+ rescaleY = e.rescaleY;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.lines = lines;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.rescaleY = function(_) {
+ if (!arguments.length) return rescaleY;
+ rescaleY = _
+ return rescaleY;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.average = function(_) {
+ if(!arguments.length) return average;
+ average = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ /* Normalize the data according to an index point. */
+ function indexify(idx, data) {
+ return data.map(function(line, i) {
+ if (!line.values) {
+ return line;
+ }
+ var v = lines.y()(line.values[idx], idx);
+
+ //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue
+ if (v < -.95) {
+ //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100)
+ line.tempDisabled = true;
+ return line;
+ }
+
+ line.tempDisabled = false;
+
+ line.values = line.values.map(function(point, pointIndex) {
+ point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) };
+ return point;
+ })
+
+ return line;
+ })
+ }
+
+ //============================================================
+
+
+ return chart;
+}
+//TODO: consider deprecating by adding necessary features to multiBar model
+nv.models.discreteBar = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , color = nv.utils.defaultColor()
+ , showValues = false
+ , valueFormat = d3.format(',.2f')
+ , xDomain
+ , yDomain
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ , rectClass = 'discreteBar'
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //add series index to each data point for reference
+ data = data.map(function(series, i) {
+ series.values = series.values.map(function(point) {
+ point.series = i;
+ return point;
+ });
+ return series;
+ });
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0 }
+ })
+ });
+
+ x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands([0, availableWidth], .1);
+
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y }).concat(forceY)));
+
+
+ // If showValues, pad the Y axis range to account for label height
+ if (showValues) y.range([availableHeight - (y.domain()[0] < 0 ? 12 : 0), y.domain()[1] > 0 ? 12 : 0]);
+ else y.range([availableHeight, 0]);
+
+ //store old scales if they exist
+ x0 = x0 || x;
+ y0 = y0 || y.copy().range([y(0),y(0)]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-discretebar').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discretebar');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ //TODO: by definition, the discrete bar should not have multiple groups, will modify/remove later
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover });
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('g.nv-bar')
+ .data(function(d) { return d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('g')
+ .attr('transform', function(d,i,j) {
+ return 'translate(' + (x(getX(d,i)) + x.rangeBand() * .05 ) + ', ' + y(0) + ')'
+ })
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+
+ barsEnter.append('rect')
+ .attr('height', 0)
+ .attr('width', x.rangeBand() * .9 / data.length )
+
+ if (showValues) {
+ barsEnter.append('text')
+ .attr('text-anchor', 'middle')
+ bars.select('text')
+ .attr('x', x.rangeBand() * .9 / 2)
+ .attr('y', function(d,i) { return getY(d,i) < 0 ? y(getY(d,i)) - y(0) + 12 : -4 })
+ .text(function(d,i) { return valueFormat(getY(d,i)) });
+ } else {
+ bars.selectAll('text').remove();
+ }
+
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive' })
+ .style('fill', function(d,i) { return d.color || color(d,i) })
+ .style('stroke', function(d,i) { return d.color || color(d,i) })
+ .select('rect')
+ .attr('class', rectClass)
+ .attr('width', x.rangeBand() * .9 / data.length);
+ d3.transition(bars)
+ //.delay(function(d,i) { return i * 1200 / data[0].values.length })
+ .attr('transform', function(d,i) {
+ var left = x(getX(d,i)) + x.rangeBand() * .05,
+ top = getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 : //make 1 px positive bars show up above y=0
+ y(getY(d,i));
+
+ return 'translate(' + left + ', ' + top + ')'
+ })
+ .select('rect')
+ .attr('height', function(d,i) {
+ return Math.max(Math.abs(y(getY(d,i)) - y(0)) || 1)
+ });
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.showValues = function(_) {
+ if (!arguments.length) return showValues;
+ showValues = _;
+ return chart;
+ };
+
+ chart.valueFormat= function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.rectClass= function(_) {
+ if (!arguments.length) return rectClass;
+ rectClass = _;
+ return chart;
+ }
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.discreteBarChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var discretebar = nv.models.discreteBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ ;
+
+ var margin = {top: 15, right: 10, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.getColor()
+ , staggerLabels = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , x
+ , y
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'beforeUpdate')
+ ;
+
+ xAxis
+ .orient('bottom')
+ .highlightZero(false)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient('left')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(discretebar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(discretebar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { dispatch.beforeUpdate(); container.transition().call(chart); };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = discretebar.xScale();
+ y = discretebar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-discreteBarWithAxes').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discreteBarWithAxes').append('g');
+ var defsEnter = gEnter.append('defs');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+
+ g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ discretebar
+ .width(availableWidth)
+ .height(availableHeight);
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(barsWrap).call(discretebar);
+
+ //------------------------------------------------------------
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-x-label-clip-' + discretebar.id())
+ .append('rect');
+
+ g.select('#nv-x-label-clip-' + discretebar.id() + ' rect')
+ .attr('width', x.rangeBand() * (staggerLabels ? 2 : 1))
+ .attr('height', 16)
+ .attr('x', -x.rangeBand() / (staggerLabels ? 1 : 2 ));
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + (y.range()[0] + ((discretebar.showValues() && y.domain()[0] < 0) ? 16 : 0)) + ')');
+ //d3.transition(g.select('.nv-x.nv-axis'))
+ g.select('.nv-x.nv-axis').transition().duration(0)
+ .call(xAxis);
+
+
+ var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
+
+ if (staggerLabels) {
+ xTicks
+ .selectAll('text')
+ .attr('transform', function(d,i,j) { return 'translate(0,' + (j % 2 == 0 ? '5' : '17') + ')' })
+ }
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ discretebar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ discretebar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.discretebar = discretebar;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, discretebar, 'x', 'y', 'xDomain', 'yDomain', 'forceX', 'forceY', 'id', 'showValues', 'valueFormat');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ discretebar.color(color);
+ return chart;
+ };
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.distribution = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 400 //technically width or height depending on x or y....
+ , size = 8
+ , axis = 'x' // 'x' or 'y'... horizontal or vertical
+ , getData = function(d) { return d[axis] } // defaults d.x or d.y
+ , color = nv.utils.defaultColor()
+ , scale = d3.scale.linear()
+ , domain
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var scale0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableLength = width - (axis === 'x' ? margin.left + margin.right : margin.top + margin.bottom),
+ naxis = axis == 'x' ? 'y' : 'x',
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ scale0 = scale0 || scale;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-distribution').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-distribution');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
+
+ //------------------------------------------------------------
+
+
+ var distWrap = g.selectAll('g.nv-dist')
+ .data(function(d) { return d }, function(d) { return d.key });
+
+ distWrap.enter().append('g');
+ distWrap
+ .attr('class', function(d,i) { return 'nv-dist nv-series-' + i })
+ .style('stroke', function(d,i) { return color(d, i) });
+
+ var dist = distWrap.selectAll('line.nv-dist' + axis)
+ .data(function(d) { return d.values })
+ dist.enter().append('line')
+ .attr(axis + '1', function(d,i) { return scale0(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale0(getData(d,i)) })
+ d3.transition(distWrap.exit().selectAll('line.nv-dist' + axis))
+ .attr(axis + '1', function(d,i) { return scale(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale(getData(d,i)) })
+ .style('stroke-opacity', 0)
+ .remove();
+ dist
+ .attr('class', function(d,i) { return 'nv-dist' + axis + ' nv-dist' + axis + '-' + i })
+ .attr(naxis + '1', 0)
+ .attr(naxis + '2', size);
+ d3.transition(dist)
+ .attr(axis + '1', function(d,i) { return scale(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale(getData(d,i)) })
+
+
+ scale0 = scale.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.axis = function(_) {
+ if (!arguments.length) return axis;
+ axis = _;
+ return chart;
+ };
+
+ chart.size = function(_) {
+ if (!arguments.length) return size;
+ size = _;
+ return chart;
+ };
+
+ chart.getData = function(_) {
+ if (!arguments.length) return getData;
+ getData = d3.functor(_);
+ return chart;
+ };
+
+ chart.scale = function(_) {
+ if (!arguments.length) return scale;
+ scale = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+//TODO: consider deprecating and using multibar with single series for this
+nv.models.historicalBar = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceX = []
+ , forceY = [0]
+ , padData = false
+ , clipEdge = true
+ , color = nv.utils.defaultColor()
+ , xDomain
+ , yDomain
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) ))
+
+ if (padData)
+ x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range([0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(data[0].values.map(getY).concat(forceY) ))
+ .range([availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bar').data([data[0].values]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-bars');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-chart-clip-path-' + id)
+ .append('rect');
+
+ wrap.select('#nv-chart-clip-path-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : '');
+
+
+
+ var bars = wrap.select('.nv-bars').selectAll('.nv-bar')
+ .data(function(d) { return d });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('rect')
+ //.attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i })
+ .attr('x', 0 )
+ .attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ .attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) })
+ .on('mouseover', function(d,i) {
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ point: d,
+ series: data[0],
+ pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ point: d,
+ series: data[0],
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ bars
+ .attr('fill', function(d,i) { return color(d, i); })
+ .attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i })
+ .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; }) //TODO: better width calculations that don't assume always uniform data spacing;w
+ .attr('width', (availableWidth / data[0].values.length) * .9 )
+
+
+ d3.transition(bars)
+ //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ .attr('y', function(d,i) {
+ return getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 :
+ y(getY(d,i))
+ })
+ .attr('height', function(d,i) { return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) });
+ //.order(); // not sure if this makes any sense for this model
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.historicalBarChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var bars = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 90, bottom: 50, left: 90}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = false
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x
+ , y
+ , state = {}
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient( (rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+
+ // New addition to calculate position if SVG is scaled with viewBox, may move TODO: consider implementing everywhere else
+ if (offsetElement) {
+ var svg = d3.select(offsetElement).select('svg');
+ var viewBox = (svg.node()) ? svg.attr('viewBox') : null;
+ if (viewBox) {
+ viewBox = viewBox.split(' ');
+ var ratio = parseInt(svg.style('width')) / viewBox[2];
+ e.pos[0] = e.pos[0] * ratio;
+ e.pos[1] = e.pos[1] * ratio;
+ }
+ }
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(bars.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(bars.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = bars.xScale();
+ y = bars.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(barsWrap).call(bars);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ g.select('.nv-x.nv-axis')
+ .transition()
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .transition().duration(0)
+ .call(yAxis);
+ }
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ selection.transition().call(chart);
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+/*
+ legend.dispatch.on('legendMouseover', function(d, i) {
+ d.hover = true;
+ selection.transition().call(chart)
+ });
+
+ legend.dispatch.on('legendMouseout', function(d, i) {
+ d.hover = false;
+ selection.transition().call(chart)
+ });
+*/
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ selection.call(chart);
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.bars = bars;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, bars, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+nv.models.indentedTree = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor()
+ , id = Math.floor(Math.random() * 10000)
+ , header = true
+ , filterZero = false
+ , noData = "No Data Available."
+ , childIndent = 20
+ , columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this
+ , tableClass = null
+ , iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images
+ , iconClose = 'images/grey-minus.png'
+ , dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+ var idx = 0;
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var depth = 1,
+ container = d3.select(this);
+
+ var tree = d3.layout.tree()
+ .children(function(d) { return d.values })
+ .size([height, childIndent]); //Not sure if this is needed now that the result is HTML
+
+ chart.update = function() { container.transition().duration(600).call(chart) };
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+ if (!data[0]) data[0] = {key: noData};
+
+ //------------------------------------------------------------
+
+
+ var nodes = tree.nodes(data[0]);
+
+ // nodes.map(function(d) {
+ // d.id = i++;
+ // })
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('div').data([[nodes]]);
+ var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree');
+ var tableEnter = wrapEnter.append('table');
+ var table = wrap.select('table').attr('width', '100%').attr('class', tableClass);
+
+ //------------------------------------------------------------
+
+
+ if (header) {
+ var thead = tableEnter.append('thead');
+
+ var theadRow1 = thead.append('tr');
+
+ columns.forEach(function(column) {
+ theadRow1
+ .append('th')
+ .attr('width', column.width ? column.width : '10%')
+ .style('text-align', column.type == 'numeric' ? 'right' : 'left')
+ .append('span')
+ .text(column.label);
+ });
+ }
+
+
+ var tbody = table.selectAll('tbody')
+ .data(function(d) { return d });
+ tbody.enter().append('tbody');
+
+
+
+ //compute max generations
+ depth = d3.max(nodes, function(node) { return node.depth });
+ tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all
+
+
+ // Update the nodes…
+ var node = tbody.selectAll('tr')
+ // .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)});
+ .data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)});
+ //.style('display', 'table-row'); //TODO: see if this does anything
+
+ node.exit().remove();
+
+ node.select('img.nv-treeicon')
+ .attr('src', icon)
+ .classed('folded', folded);
+
+ var nodeEnter = node.enter().append('tr');
+
+
+ columns.forEach(function(column, index) {
+
+ var nodeName = nodeEnter.append('td')
+ .style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here
+ .style('text-align', column.type == 'numeric' ? 'right' : 'left');
+
+
+ if (index == 0) {
+ nodeName.append('img')
+ .classed('nv-treeicon', true)
+ .classed('nv-folded', folded)
+ .attr('src', icon)
+ .style('width', '14px')
+ .style('height', '14px')
+ .style('padding', '0 1px')
+ .style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; })
+ .on('click', click);
+ }
+
+
+ nodeName.append('span')
+ .attr('class', d3.functor(column.classes) )
+ .text(function(d) { return column.format ? column.format(d) :
+ (d[column.key] || '-') });
+
+ if (column.showCount) {
+ nodeName.append('span')
+ .attr('class', 'nv-childrenCount');
+
+ node.selectAll('span.nv-childrenCount').text(function(d) {
+ return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent
+ '(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter
+ || (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values...
+ || 0) + ')' //This is the catch-all in case there are no children after a filter
+ : '' //If this is not a parent, just give an empty string
+ });
+ }
+
+ if (column.click)
+ nodeName.select('span').on('click', column.click);
+
+ });
+
+ node
+ .order()
+ .on('click', function(d) {
+ dispatch.elementClick({
+ row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href)
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('dblclick', function(d) {
+ dispatch.elementDblclick({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('mouseover', function(d) {
+ dispatch.elementMouseover({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('mouseout', function(d) {
+ dispatch.elementMouseout({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ });
+
+
+
+
+ // Toggle children on click.
+ function click(d, _, unshift) {
+ d3.event.stopPropagation();
+
+ if(d3.event.shiftKey && !unshift) {
+ //If you shift-click, it'll toggle fold all the children, instead of itself
+ d3.event.shiftKey = false;
+ d.values && d.values.forEach(function(node){
+ if (node.values || node._values) {
+ click(node, 0, true);
+ }
+ });
+ return true;
+ }
+ if(!hasChildren(d)) {
+ //download file
+ //window.location.href = d.url;
+ return true;
+ }
+ if (d.values) {
+ d._values = d.values;
+ d.values = null;
+ } else {
+ d.values = d._values;
+ d._values = null;
+ }
+ chart.update();
+ }
+
+
+ function icon(d) {
+ return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : '';
+ }
+
+ function folded(d) {
+ return (d._values && d._values.length);
+ }
+
+ function hasChildren(d) {
+ var values = d.values || d._values;
+
+ return (values && values.length);
+ }
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ scatter.color(color);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.header = function(_) {
+ if (!arguments.length) return header;
+ header = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.filterZero = function(_) {
+ if (!arguments.length) return filterZero;
+ filterZero = _;
+ return chart;
+ };
+
+ chart.columns = function(_) {
+ if (!arguments.length) return columns;
+ columns = _;
+ return chart;
+ };
+
+ chart.tableClass = function(_) {
+ if (!arguments.length) return tableClass;
+ tableClass = _;
+ return chart;
+ };
+
+ chart.iconOpen = function(_){
+ if (!arguments.length) return iconOpen;
+ iconOpen = _;
+ return chart;
+ }
+
+ chart.iconClose = function(_){
+ if (!arguments.length) return iconClose;
+ iconClose = _;
+ return chart;
+ }
+
+ //============================================================
+
+
+ return chart;
+};nv.models.legend = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 5, right: 0, bottom: 5, left: 0}
+ , width = 400
+ , height = 20
+ , getKey = function(d) { return d.key }
+ , color = nv.utils.defaultColor()
+ , align = true
+ , dispatch = d3.dispatch('legendClick', 'legendDblclick', 'legendMouseover', 'legendMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-legend').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-legend').append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ var series = g.selectAll('.nv-series')
+ .data(function(d) { return d });
+ var seriesEnter = series.enter().append('g').attr('class', 'nv-series')
+ .on('mouseover', function(d,i) {
+ dispatch.legendMouseover(d,i); //TODO: Make consistent with other event objects
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.legendMouseout(d,i);
+ })
+ .on('click', function(d,i) {
+ dispatch.legendClick(d,i);
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.legendDblclick(d,i);
+ });
+ seriesEnter.append('circle')
+ .style('stroke-width', 2)
+ .attr('r', 5);
+ seriesEnter.append('text')
+ .attr('text-anchor', 'start')
+ .attr('dy', '.32em')
+ .attr('dx', '8');
+ series.classed('disabled', function(d) { return d.disabled });
+ series.exit().remove();
+ series.select('circle')
+ .style('fill', function(d,i) { return d.color || color(d,i)})
+ .style('stroke', function(d,i) { return d.color || color(d, i) });
+ series.select('text').text(getKey);
+
+
+ //TODO: implement fixed-width and max-width options (max-width is especially useful with the align option)
+
+ // NEW ALIGNING CODE, TODO: clean up
+ if (align) {
+
+ var seriesWidths = [];
+ series.each(function(d,i) {
+ var legendText = d3.select(this).select('text');
+ var svgComputedTextLength = legendText.node().getComputedTextLength()
+ || nv.utils.calcApproxTextWidth(legendText);
+ seriesWidths.push(svgComputedTextLength + 28); // 28 is ~ the width of the circle plus some padding
+ });
+
+ //nv.log('Series Widths: ', JSON.stringify(seriesWidths));
+
+ var seriesPerRow = 0;
+ var legendWidth = 0;
+ var columnWidths = [];
+
+ while ( legendWidth < availableWidth && seriesPerRow < seriesWidths.length) {
+ columnWidths[seriesPerRow] = seriesWidths[seriesPerRow];
+ legendWidth += seriesWidths[seriesPerRow++];
+ }
+
+
+ while ( legendWidth > availableWidth && seriesPerRow > 1 ) {
+ columnWidths = [];
+ seriesPerRow--;
+
+ for (k = 0; k < seriesWidths.length; k++) {
+ if (seriesWidths[k] > (columnWidths[k % seriesPerRow] || 0) )
+ columnWidths[k % seriesPerRow] = seriesWidths[k];
+ }
+
+ legendWidth = columnWidths.reduce(function(prev, cur, index, array) {
+ return prev + cur;
+ });
+ }
+ //console.log(columnWidths, legendWidth, seriesPerRow);
+
+ var xPositions = [];
+ for (var i = 0, curX = 0; i < seriesPerRow; i++) {
+ xPositions[i] = curX;
+ curX += columnWidths[i];
+ }
+
+ series
+ .attr('transform', function(d, i) {
+ return 'translate(' + xPositions[i % seriesPerRow] + ',' + (5 + Math.floor(i / seriesPerRow) * 20) + ')';
+ });
+
+ //position legend as far right as possible within the total width
+ g.attr('transform', 'translate(' + (width - margin.right - legendWidth) + ',' + margin.top + ')');
+
+ height = margin.top + margin.bottom + (Math.ceil(seriesWidths.length / seriesPerRow) * 20);
+
+ } else {
+
+ var ypos = 5,
+ newxpos = 5,
+ maxwidth = 0,
+ xpos;
+ series
+ .attr('transform', function(d, i) {
+ var length = d3.select(this).select('text').node().getComputedTextLength() + 28;
+ xpos = newxpos;
+
+ if (width < margin.left + margin.right + xpos + length) {
+ newxpos = xpos = 5;
+ ypos += 20;
+ }
+
+ newxpos += length;
+ if (newxpos > maxwidth) maxwidth = newxpos;
+
+ return 'translate(' + xpos + ',' + ypos + ')';
+ });
+
+ //position legend as far right as possible within the total width
+ g.attr('transform', 'translate(' + (width - margin.right - maxwidth) + ',' + margin.top + ')');
+
+ height = margin.top + margin.bottom + ypos + 15;
+
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.key = function(_) {
+ if (!arguments.length) return getKey;
+ getKey = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.align = function(_) {
+ if (!arguments.length) return align;
+ align = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.line = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ ;
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // a function that returns a color
+ , getX = function(d) { return d.x } // accessor to get the x value from a data point
+ , getY = function(d) { return d.y } // accessor to get the y value from a data point
+ , defined = function(d,i) { return !isNaN(getY(d,i)) && getY(d,i) !== null } // allows a line to be not continuous when it is not defined
+ , isArea = function(d) { return d.area } // decides if a line is an area or just a line
+ , clipEdge = false // if true, masks lines within x and y scale
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , interpolate = "linear" // controls the line interpolation
+ ;
+
+ scatter
+ .size(16) // default size
+ .sizeDomain([16,256]) //set to speed up calculation, needs to be unset if there is a custom size accessor
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-line').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-groups');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var scatterWrap = wrap.select('.nv-scatterWrap');
+ //.datum(data); // Data automatically trickles down from the wrap
+
+ d3.transition(scatterWrap).call(scatter);
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + scatter.id())
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + scatter.id() + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : '');
+ scatterWrap
+ .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : '');
+
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i)});
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .5);
+
+
+
+ var areaPaths = groups.selectAll('path.nv-area')
+ .data(function(d) { return isArea(d) ? [d] : [] }); // this is done differently than lines because I need to check if series is an area
+ areaPaths.enter().append('path')
+ .attr('class', 'nv-area')
+ .attr('d', function(d) {
+ return d3.svg.area()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return x0(getX(d,i)) })
+ .y0(function(d,i) { return y0(getY(d,i)) })
+ .y1(function(d,i) { return y0( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
+ //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
+ .apply(this, [d.values])
+ });
+ d3.transition(groups.exit().selectAll('path.nv-area'))
+ .attr('d', function(d) {
+ return d3.svg.area()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d,i) { return y(getY(d,i)) })
+ .y1(function(d,i) { return y( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
+ //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
+ .apply(this, [d.values])
+ });
+ d3.transition(areaPaths)
+ .attr('d', function(d) {
+ return d3.svg.area()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d,i) { return y(getY(d,i)) })
+ .y1(function(d,i) { return y( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
+ //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
+ .apply(this, [d.values])
+ });
+
+
+
+ var linePaths = groups.selectAll('path.nv-line')
+ .data(function(d) { return [d.values] });
+ linePaths.enter().append('path')
+ .attr('class', 'nv-line')
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return x0(getX(d,i)) })
+ .y(function(d,i) { return y0(getY(d,i)) })
+ );
+ d3.transition(groups.exit().selectAll('path.nv-line'))
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ );
+ d3.transition(linePaths)
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ );
+
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = scatter.dispatch;
+ chart.scatter = scatter;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'padData');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ scatter.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ scatter.y(_);
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ scatter.color(color);
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ interpolate = _;
+ return chart;
+ };
+
+ chart.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return chart;
+ };
+
+ chart.isArea = function(_) {
+ if (!arguments.length) return isArea;
+ isArea = d3.functor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.lineChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ ;
+
+//set margin.right to 23 to fit dates on the x-axis within the chart
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x
+ , y
+ , state = {}
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+
+ // New addition to calculate position if SVG is scaled with viewBox, may move TODO: consider implementing everywhere else
+ if (offsetElement) {
+ var svg = d3.select(offsetElement).select('svg');
+ var viewBox = (svg.node()) ? svg.attr('viewBox') : null;
+ if (viewBox) {
+ viewBox = viewBox.split(' ');
+ var ratio = parseInt(svg.style('width')) / viewBox[2];
+ e.pos[0] = e.pos[0] * ratio;
+ e.pos[1] = e.pos[1] * ratio;
+ }
+ }
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { container.transition().call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(linesWrap).call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+ }
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ // container.transition().call(chart);
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+/*
+ legend.dispatch.on('legendMouseover', function(d, i) {
+ d.hover = true;
+ selection.transition().call(chart)
+ });
+
+ legend.dispatch.on('legendMouseout', function(d, i) {
+ d.hover = false;
+ selection.transition().call(chart)
+ });
+*/
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.lines = lines;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.linePlusBarChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , bars = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , y1Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 60, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.defaultColor()
+ , showLegend = true
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>';
+ }
+ , x
+ , y1
+ , y2
+ , state = {}
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ bars
+ .padData(true)
+ ;
+ lines
+ .clipEdge(false)
+ .padData(true)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ .highlightZero(false)
+ ;
+ y1Axis
+ .orient('left')
+ ;
+ y2Axis
+ .orient('right')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ }
+ ;
+
+ //------------------------------------------------------------
+
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ // chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ var dataBars = data.filter(function(d) { return !d.disabled && d.bar });
+ var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240
+
+ //x = xAxis.scale();
+ x = dataLines.filter(function(d) { return !d.disabled; }).length && dataLines.filter(function(d) { return !d.disabled; })[0].values.length ? lines.xScale() : bars.xScale();
+ //x = dataLines.filter(function(d) { return !d.disabled; }).length ? lines.xScale() : bars.xScale(); //old code before change above
+ y1 = bars.yScale();
+ y2 = lines.yScale();
+
+ //------------------------------------------------------------
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-linePlusBar').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ gEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.nv-legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }))
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }))
+
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(dataBars.length ? dataBars : [{values:[]}])
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(dataLines[0] && !dataLines[0].disabled ? dataLines : [{values:[]}] );
+ //.datum(!dataLines[0].disabled ? dataLines : [{values:dataLines[0].values.map(function(d) { return [d[0], null] }) }] );
+
+ d3.transition(barsWrap).call(bars);
+ d3.transition(linesWrap).call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y1.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+
+ y1Axis
+ .scale(y1)
+ .ticks( availableHeight / 36 )
+ .tickSize(-availableWidth, 0);
+
+ d3.transition(g.select('.nv-y1.nv-axis'))
+ .style('opacity', dataBars.length ? 1 : 0)
+ .call(y1Axis);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + availableWidth + ',0)');
+ //.attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ d3.transition(g.select('.nv-y2.nv-axis'))
+ .call(y2Axis);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.bars = bars;
+ chart.xAxis = xAxis;
+ chart.y1Axis = y1Axis;
+ chart.y2Axis = y2Axis;
+
+ d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate');
+ //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc.
+ //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines.x(_);
+ bars.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines.y(_);
+ bars.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.lineWithFocusChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , lines2 = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , x2Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ , brush = d3.svg.brush()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 30, left: 60}
+ , margin2 = {top: 0, right: 30, bottom: 20, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , height2 = 100
+ , x
+ , y
+ , x2
+ , y2
+ , showLegend = true
+ , brushExtent = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
+ ;
+
+ lines
+ .clipEdge(true)
+ ;
+ lines2
+ .interactive(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ yAxis
+ .orient('left')
+ ;
+ x2Axis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y2Axis
+ .orient('left')
+ ;
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2,
+ availableHeight2 = height2 - margin2.top - margin2.bottom;
+
+ chart.update = function() { container.transition().call(chart) };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight1 / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+ x2 = lines2.xScale();
+ y2 = lines2.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineWithFocusChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineWithFocusChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ var focusEnter = gEnter.append('g').attr('class', 'nv-focus');
+ focusEnter.append('g').attr('class', 'nv-x nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y nv-axis');
+ focusEnter.append('g').attr('class', 'nv-linesWrap');
+
+ var contextEnter = gEnter.append('g').attr('class', 'nv-context');
+ contextEnter.append('g').attr('class', 'nv-x nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y nv-axis');
+ contextEnter.append('g').attr('class', 'nv-linesWrap');
+ contextEnter.append('g').attr('class', 'nv-brushBackground');
+ contextEnter.append('g').attr('class', 'nv-x nv-brush');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(
+ data
+ .map(function(d,i) {
+ return d.color || color(d, i);
+ })
+ .filter(function(d,i) {
+ return !data[i].disabled;
+ })
+ );
+
+ lines2
+ .defined(lines.defined())
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(
+ data
+ .map(function(d,i) {
+ return d.color || color(d, i);
+ })
+ .filter(function(d,i) {
+ return !data[i].disabled;
+ })
+ );
+
+ g.select('.nv-context')
+ .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')')
+
+ var contextLinesWrap = g.select('.nv-context .nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(contextLinesWrap).call(lines2);
+
+ //------------------------------------------------------------
+
+
+ /*
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(focusLinesWrap).call(lines);
+ */
+
+
+ //------------------------------------------------------------
+ // Setup Main (Focus) Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight1, 0);
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight1 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-focus .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight1 + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Brush
+
+ brush
+ .x(x2)
+ .on('brush', onBrush);
+
+ if (brushExtent) brush.extent(brushExtent);
+
+ var brushBG = g.select('.nv-brushBackground').selectAll('g')
+ .data([brushExtent || brush.extent()])
+
+ var brushBGenter = brushBG.enter()
+ .append('g');
+
+ brushBGenter.append('rect')
+ .attr('class', 'left')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ brushBGenter.append('rect')
+ .attr('class', 'right')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ gBrush = g.select('.nv-x.nv-brush')
+ .call(brush);
+ gBrush.selectAll('rect')
+ //.attr('y', -5)
+ .attr('height', availableHeight2);
+ gBrush.selectAll('.resize').append('path').attr('d', resizePath);
+
+ onBrush();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Secondary (Context) Axes
+
+ x2Axis
+ .scale(x2)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight2, 0);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y2.range()[0] + ')');
+ d3.transition(g.select('.nv-context .nv-x.nv-axis'))
+ .call(x2Axis);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight2 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-context .nv-y.nv-axis'))
+ .call(y2Axis);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y2.range()[0] + ')');
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ container.transition().call(chart);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ // Taken from crossfilter (http://square.github.com/crossfilter/)
+ function resizePath(d) {
+ var e = +(d == 'e'),
+ x = e ? 1 : -1,
+ y = availableHeight2 / 3;
+ return 'M' + (.5 * x) + ',' + y
+ + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6)
+ + 'V' + (2 * y - 6)
+ + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y)
+ + 'Z'
+ + 'M' + (2.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8)
+ + 'M' + (4.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8);
+ }
+
+
+ function updateBrushBG() {
+ if (!brush.empty()) brush.extent(brushExtent);
+ brushBG
+ .data([brush.empty() ? x2.domain() : brushExtent])
+ .each(function(d,i) {
+ var leftWidth = x2(d[0]) - x.range()[0],
+ rightWidth = x.range()[1] - x2(d[1]);
+ d3.select(this).select('.left')
+ .attr('width', leftWidth < 0 ? 0 : leftWidth);
+
+ d3.select(this).select('.right')
+ .attr('x', x2(d[1]))
+ .attr('width', rightWidth < 0 ? 0 : rightWidth);
+ });
+ }
+
+
+ function onBrush() {
+ brushExtent = brush.empty() ? null : brush.extent();
+ extent = brush.empty() ? x2.domain() : brush.extent();
+
+
+ dispatch.brush({extent: extent, brush: brush});
+
+
+ updateBrushBG();
+
+ // Update Main (Focus)
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(
+ data
+ .filter(function(d) { return !d.disabled })
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+ d3.transition(focusLinesWrap).call(lines);
+
+
+ // Update Main (Focus) Axes
+ d3.transition(g.select('.nv-focus .nv-x.nv-axis'))
+ .call(xAxis);
+ d3.transition(g.select('.nv-focus .nv-y.nv-axis'))
+ .call(yAxis);
+ }
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.lines2 = lines2;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.x2Axis = x2Axis;
+ chart.y2Axis = y2Axis;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.x = function(_) {
+ if (!arguments.length) return lines.x;
+ lines.x(_);
+ lines2.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return lines.y;
+ lines.y(_);
+ lines2.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.margin2 = function(_) {
+ if (!arguments.length) return margin2;
+ margin2 = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.height2 = function(_) {
+ if (!arguments.length) return height2;
+ height2 = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color =nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return lines.interpolate();
+ lines.interpolate(_);
+ lines2.interpolate(_);
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ // Chart has multiple similar Axes, to prevent code duplication, probably need to link all axis functions manually like below
+ chart.xTickFormat = function(_) {
+ if (!arguments.length) return xAxis.tickFormat();
+ xAxis.tickFormat(_);
+ x2Axis.tickFormat(_);
+ return chart;
+ };
+
+ chart.yTickFormat = function(_) {
+ if (!arguments.length) return yAxis.tickFormat();
+ yAxis.tickFormat(_);
+ y2Axis.tickFormat(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.linePlusBarWithFocusChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , lines2 = nv.models.line()
+ , bars = nv.models.historicalBar()
+ , bars2 = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , x2Axis = nv.models.axis()
+ , y1Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , y3Axis = nv.models.axis()
+ , y4Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ , brush = d3.svg.brush()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 30, left: 60}
+ , margin2 = {top: 0, right: 30, bottom: 20, left: 60}
+ , width = null
+ , height = null
+ , height2 = 100
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.defaultColor()
+ , showLegend = true
+ , extent
+ , brushExtent = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>';
+ }
+ , x
+ , x2
+ , y1
+ , y2
+ , y3
+ , y4
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
+ ;
+
+ lines
+ .clipEdge(true)
+ ;
+ lines2
+ .interactive(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y1Axis
+ .orient('left')
+ ;
+ y2Axis
+ .orient('right')
+ ;
+ x2Axis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y3Axis
+ .orient('left')
+ ;
+ y4Axis
+ .orient('right')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ if (extent) {
+ e.pointIndex += Math.ceil(extent[0]);
+ }
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //------------------------------------------------------------
+
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2,
+ availableHeight2 = height2 - margin2.top - margin2.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight1 / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ var dataBars = data.filter(function(d) { return !d.disabled && d.bar });
+ var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240
+
+ x = bars.xScale();
+ x2 = x2Axis.scale();
+ y1 = bars.yScale();
+ y2 = lines.yScale();
+ y3 = bars2.yScale();
+ y4 = lines2.yScale();
+
+ var series1 = data
+ .filter(function(d) { return !d.disabled && d.bar })
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i) }
+ })
+ });
+
+ var series2 = data
+ .filter(function(d) { return !d.disabled && !d.bar })
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i) }
+ })
+ });
+
+ x .range([0, availableWidth]);
+
+ x2 .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } ))
+ .range([0, availableWidth]);
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-linePlusBar').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ var focusEnter = gEnter.append('g').attr('class', 'nv-focus');
+ focusEnter.append('g').attr('class', 'nv-x nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ focusEnter.append('g').attr('class', 'nv-barsWrap');
+ focusEnter.append('g').attr('class', 'nv-linesWrap');
+
+ var contextEnter = gEnter.append('g').attr('class', 'nv-context');
+ contextEnter.append('g').attr('class', 'nv-x nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ contextEnter.append('g').attr('class', 'nv-barsWrap');
+ contextEnter.append('g').attr('class', 'nv-linesWrap');
+ contextEnter.append('g').attr('class', 'nv-brushBackground');
+ contextEnter.append('g').attr('class', 'nv-x nv-brush');
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.nv-legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Context Components
+
+ bars2
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }));
+
+ lines2
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }));
+
+ var bars2Wrap = g.select('.nv-context .nv-barsWrap')
+ .datum(dataBars.length ? dataBars : [{values:[]}]);
+
+ var lines2Wrap = g.select('.nv-context .nv-linesWrap')
+ .datum(!dataLines[0].disabled ? dataLines : [{values:[]}]);
+
+ g.select('.nv-context')
+ .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')')
+
+ d3.transition(bars2Wrap).call(bars2);
+ d3.transition(lines2Wrap).call(lines2);
+
+ //------------------------------------------------------------
+
+
+
+ //------------------------------------------------------------
+ // Setup Brush
+
+ brush
+ .x(x2)
+ .on('brush', onBrush);
+
+ if (brushExtent) brush.extent(brushExtent);
+
+ var brushBG = g.select('.nv-brushBackground').selectAll('g')
+ .data([brushExtent || brush.extent()])
+
+ var brushBGenter = brushBG.enter()
+ .append('g');
+
+ brushBGenter.append('rect')
+ .attr('class', 'left')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ brushBGenter.append('rect')
+ .attr('class', 'right')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ var gBrush = g.select('.nv-x.nv-brush')
+ .call(brush);
+ gBrush.selectAll('rect')
+ //.attr('y', -5)
+ .attr('height', availableHeight2);
+ gBrush.selectAll('.resize').append('path').attr('d', resizePath);
+
+ //------------------------------------------------------------
+
+ //------------------------------------------------------------
+ // Setup Secondary (Context) Axes
+
+ x2Axis
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight2, 0);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y3.range()[0] + ')');
+ d3.transition(g.select('.nv-context .nv-x.nv-axis'))
+ .call(x2Axis);
+
+
+ y3Axis
+ .scale(y3)
+ .ticks( availableHeight2 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-context .nv-y1.nv-axis')
+ .style('opacity', dataBars.length ? 1 : 0)
+ .attr('transform', 'translate(0,' + x2.range()[0] + ')');
+
+ d3.transition(g.select('.nv-context .nv-y1.nv-axis'))
+ .call(y3Axis);
+
+
+ y4Axis
+ .scale(y4)
+ .ticks( availableHeight2 / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-context .nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + x2.range()[1] + ',0)');
+
+ d3.transition(g.select('.nv-context .nv-y2.nv-axis'))
+ .call(y4Axis);
+
+ //------------------------------------------------------------
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ // Taken from crossfilter (http://square.github.com/crossfilter/)
+ function resizePath(d) {
+ var e = +(d == 'e'),
+ x = e ? 1 : -1,
+ y = availableHeight2 / 3;
+ return 'M' + (.5 * x) + ',' + y
+ + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6)
+ + 'V' + (2 * y - 6)
+ + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y)
+ + 'Z'
+ + 'M' + (2.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8)
+ + 'M' + (4.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8);
+ }
+
+
+ function updateBrushBG() {
+ if (!brush.empty()) brush.extent(brushExtent);
+ brushBG
+ .data([brush.empty() ? x2.domain() : brushExtent])
+ .each(function(d,i) {
+ var leftWidth = x2(d[0]) - x2.range()[0],
+ rightWidth = x2.range()[1] - x2(d[1]);
+ d3.select(this).select('.left')
+ .attr('width', leftWidth < 0 ? 0 : leftWidth);
+
+ d3.select(this).select('.right')
+ .attr('x', x2(d[1]))
+ .attr('width', rightWidth < 0 ? 0 : rightWidth);
+ });
+ }
+
+
+ function onBrush() {
+ brushExtent = brush.empty() ? null : brush.extent();
+ extent = brush.empty() ? x2.domain() : brush.extent();
+
+
+ dispatch.brush({extent: extent, brush: brush});
+
+ updateBrushBG();
+
+
+ //------------------------------------------------------------
+ // Prepare Main (Focus) Bars and Lines
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }));
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }));
+
+ var focusBarsWrap = g.select('.nv-focus .nv-barsWrap')
+ .datum(!dataBars.length ? [{values:[]}] :
+ dataBars
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return bars.x()(d,i) >= extent[0] && bars.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(dataLines[0].disabled ? [{values:[]}] :
+ dataLines
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Update Main (Focus) X Axis
+
+ if (dataBars.length) {
+ x = bars.xScale();
+ } else {
+ x = lines.xScale();
+ }
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight1, 0);
+
+ xAxis.domain([Math.ceil(extent[0]), Math.floor(extent[1])]);
+
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Update Main (Focus) Bars and Lines
+
+ d3.transition(focusBarsWrap).call(bars);
+ d3.transition(focusLinesWrap).call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup and Update Main (Focus) Y Axes
+
+ g.select('.nv-focus .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y1.range()[0] + ')');
+
+
+ y1Axis
+ .scale(y1)
+ .ticks( availableHeight1 / 36 )
+ .tickSize(-availableWidth, 0);
+
+ g.select('.nv-focus .nv-y1.nv-axis')
+ .style('opacity', dataBars.length ? 1 : 0);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight1 / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-focus .nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ d3.transition(g.select('.nv-focus .nv-y1.nv-axis'))
+ .call(y1Axis);
+ d3.transition(g.select('.nv-focus .nv-y2.nv-axis'))
+ .call(y2Axis);
+ }
+
+ //============================================================
+
+ onBrush();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.lines2 = lines2;
+ chart.bars = bars;
+ chart.bars2 = bars2;
+ chart.xAxis = xAxis;
+ chart.x2Axis = x2Axis;
+ chart.y1Axis = y1Axis;
+ chart.y2Axis = y2Axis;
+ chart.y3Axis = y3Axis;
+ chart.y4Axis = y4Axis;
+
+ d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate');
+ //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc.
+ //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines.x(_);
+ bars.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines.y(_);
+ bars.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.brushExtent = function(_) {
+ if (!arguments.length) return brushExtent;
+ brushExtent = _;
+ return chart;
+ };
+
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.multiBar = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , clipEdge = true
+ , stacked = false
+ , color = nv.utils.defaultColor()
+ , hideable = false
+ , barColor = null // adding the ability to set the color for each rather than the whole group
+ , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled
+ , delay = 1200
+ , drawTime = 500
+ , xDomain
+ , yDomain
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ if(hideable && data.length) hideable = [{
+ values: data[0].values.map(function(d) {
+ return {
+ x: d.x,
+ y: 0,
+ series: d.series,
+ size: 0.01
+ };}
+ )}];
+
+ if (stacked)
+ data = d3.layout.stack()
+ .offset('zero')
+ .values(function(d){ return d.values })
+ .y(getY)
+ (!data.length && hideable ? hideable : data);
+
+
+ //add series index to each data point for reference
+ data = data.map(function(series, i) {
+ series.values = series.values.map(function(point) {
+ point.series = i;
+ return point;
+ });
+ return series;
+ });
+
+
+ //------------------------------------------------------------
+ // HACK for negative value stacking
+ if (stacked)
+ data[0].values.map(function(d,i) {
+ var posBase = 0, negBase = 0;
+ data.map(function(d) {
+ var f = d.values[i]
+ f.size = Math.abs(f.y);
+ if (f.y<0) {
+ f.y1 = negBase;
+ negBase = negBase - f.size;
+ } else
+ {
+ f.y1 = f.size + posBase;
+ posBase = posBase + f.size;
+ }
+ });
+ });
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 }
+ })
+ });
+
+ x .domain(d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands([0, availableWidth], .1);
+
+ //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y1 : 0) }).concat(forceY)))
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 : d.y1 + d.y ) : d.y }).concat(forceY)))
+ .range([availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+
+
+ groups.exit()
+ .selectAll('rect.nv-bar')
+ .transition()
+ .delay(function(d,i) { return i * delay/ data[0].values.length })
+ .attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) })
+ .attr('height', 0)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) });
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('rect.nv-bar')
+ .data(function(d) { return (hideable && !data.length) ? hideable.values : d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('rect')
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .attr('x', function(d,i,j) {
+ return stacked ? 0 : (j * x.rangeBand() / data.length )
+ })
+ .attr('y', function(d) { return y0(stacked ? d.y0 : 0) })
+ .attr('height', 0)
+ .attr('width', x.rangeBand() / (stacked ? 1 : data.length) );
+ bars
+ .style('fill', function(d,i,j){ return color(d, j, i); })
+ .style('stroke', function(d,i,j){ return color(d, j, i); })
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; })
+
+ if (barColor) {
+ if (!disabled) disabled = data.map(function() { return true });
+ bars
+ //.style('fill', barColor)
+ //.style('stroke', barColor)
+ //.style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); })
+ //.style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); })
+ .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); })
+ .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); });
+ }
+
+
+ if (stacked)
+ bars.transition()
+
+ .delay(function(d,i) { return i * delay / data[0].values.length })
+ .attr('y', function(d,i) {
+
+ return y((stacked ? d.y1 : 0));
+ })
+ .attr('height', function(d,i) {
+ if(d.y == null) return 0;
+ return Math.max(Math.abs(y(d.y + (stacked ? d.y0 : 0)) - y((stacked ? d.y0 : 0))),1);
+ })
+ .each('end', function() {
+ d3.select(this).transition().duration(drawTime)
+ .attr('x', function(d,i) {
+ return stacked ? 0 : (d.series * x.rangeBand() / data.length )
+ })
+ .attr('width', x.rangeBand() / (stacked ? 1 : data.length) );
+ })
+ else
+ d3.transition(bars).duration(drawTime)
+ .delay(function(d,i) { return i * delay/ data[0].values.length })
+ .attr('x', function(d,i) {
+ return d.series * x.rangeBand() / data.length
+ })
+ .attr('width', x.rangeBand() / data.length)
+ .each('end', function() {
+ d3.select(this).transition().duration(drawTime)
+ .attr('y', function(d,i) {
+ return getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 :
+ y(getY(d,i)) || 0;
+ })
+ .attr('height', function(d,i) {
+ if(d.y == null) return 0;
+ return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) || 0;
+ });
+ })
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.stacked = function(_) {
+ if (!arguments.length) return stacked;
+ stacked = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.barColor = function(_) {
+ if (!arguments.length) return barColor;
+ barColor = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.disabled = function(_) {
+ if (!arguments.length) return disabled;
+ disabled = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.hideable = function(_) {
+ if (!arguments.length) return hideable;
+ hideable = _;
+ return chart;
+ };
+
+ chart.delay = function(_) {
+ if (!arguments.length) return delay;
+ delay = _;
+ return chart;
+ };
+
+ chart.drawTime = function(_) {
+ if (!arguments.length) return drawTime;
+ drawTime = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.multiBarChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var multibar = nv.models.multiBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , showControls = true
+ , showLegend = true
+ , logScale = false
+ , reduceXTicks = true // if false a tick will show for every data point
+ , staggerLabels = false
+ , rotateLabels = 0
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph, logScale) {
+ //alert(y+ " " + logScale);
+ if(logScale) {
+ var fmt = d3.format(',.2f');
+ return '<h3>' + key + '</h3>' +
+ '<p>' + fmt(Math.pow(10,y)) + ' on ' + x + '</p>'
+ } else {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' on ' + x + '</p>'
+ }
+
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , state = { stacked: false }
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = function() { return showControls ? 180 : 0 }
+ ;
+ multibar
+ .stacked(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ .highlightZero(true)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient('left')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart, logScale);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = multibar.xScale();
+ y = multibar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth - controlWidth());
+
+ if (multibar.barColor())
+ data.forEach(function(series,i) {
+ series.color = d3.rgb('#ccc').darker(i * 1.5).toString();
+ })
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Grouped', disabled: multibar.stacked() },
+ { key: 'Stacked', disabled: !multibar.stacked() }
+ ];
+
+ controls.width(controlWidth()).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ multibar
+ .disabled(data.map(function(series) { return series.disabled }))
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(barsWrap).call(multibar);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+ var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g');
+
+ xTicks
+ .selectAll('line, text')
+ .style('opacity', 1)
+
+ if (staggerLabels) {
+ var getTranslate = function(x,y) {
+ return "translate(" + x + "," + y + ")";
+ };
+
+ var staggerUp = 5, staggerDown = 17; //pixels to stagger by
+ // Issue #140
+ xTicks
+ .selectAll("text")
+ .attr('transform', function(d,i,j) {
+ return getTranslate(0, (j % 2 == 0 ? staggerUp : staggerDown));
+ });
+
+ var totalInBetweenTicks = d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;
+ g.selectAll(".nv-x.nv-axis .nv-axisMaxMin text")
+ .attr("transform", function(d,i) {
+ return getTranslate(0, (i === 0 || totalInBetweenTicks % 2 !== 0) ? staggerDown : staggerUp);
+ });
+ }
+
+
+ if (reduceXTicks)
+ xTicks
+ .filter(function(d,i) {
+ return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0;
+ })
+ .selectAll('text, line')
+ .style('opacity', 0);
+
+ if(rotateLabels)
+ xTicks
+ .selectAll('text')
+ .attr('transform', 'rotate(' + rotateLabels + ' 0,0)')
+ .attr('text-anchor', rotateLabels > 0 ? 'start' : 'end');
+
+ g.select('.nv-x.nv-axis').selectAll('g.nv-axisMaxMin text')
+ .style('opacity', 1);
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Grouped':
+ multibar.stacked(false);
+ break;
+ case 'Stacked':
+ multibar.stacked(true);
+ break;
+ }
+
+ state.stacked = multibar.stacked();
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode)
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.stacked !== 'undefined') {
+ multibar.stacked(e.stacked);
+ state.stacked = e.stacked;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ multibar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ multibar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.multibar = multibar;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'forceX', 'forceY', 'clipEdge', 'id', 'stacked', 'delay', 'barColor');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.logScale = function(_) {
+ if (!arguments.length) return logScale;
+ logScale = _;
+ return chart;
+ };
+
+ chart.reduceXTicks= function(_) {
+ if (!arguments.length) return reduceXTicks;
+ reduceXTicks = _;
+ return chart;
+ };
+
+ chart.rotateLabels = function(_) {
+ if (!arguments.length) return rotateLabels;
+ rotateLabels = _;
+ return chart;
+ }
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.multiBarHorizontal = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , color = nv.utils.defaultColor()
+ , barColor = null // adding the ability to set the color for each rather than the whole group
+ , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled
+ , stacked = false
+ , showValues = false
+ , valuePadding = 60
+ , valueFormat = d3.format(',.2f')
+ , delay = 1200
+ , xDomain
+ , yDomain
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ if (stacked)
+ data = d3.layout.stack()
+ .offset('zero')
+ .values(function(d){ return d.values })
+ .y(getY)
+ (data);
+
+
+ //add series index to each data point for reference
+ data = data.map(function(series, i) {
+ series.values = series.values.map(function(point) {
+ point.series = i;
+ return point;
+ });
+ return series;
+ });
+
+
+
+ //------------------------------------------------------------
+ // HACK for negative value stacking
+ if (stacked)
+ data[0].values.map(function(d,i) {
+ var posBase = 0, negBase = 0;
+ data.map(function(d) {
+ var f = d.values[i]
+ f.size = Math.abs(f.y);
+ if (f.y<0) {
+ f.y1 = negBase - f.size;
+ negBase = negBase - f.size;
+ } else
+ {
+ f.y1 = posBase;
+ posBase = posBase + f.size;
+ }
+ });
+ });
+
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 }
+ })
+ });
+
+ x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands([0, availableHeight], .1);
+
+ //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY)))
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 + d.y : d.y1 ) : d.y }).concat(forceY)))
+
+ if (showValues && !stacked)
+ y.range([(y.domain()[0] < 0 ? valuePadding : 0), availableWidth - (y.domain()[1] > 0 ? valuePadding : 0) ]);
+ else
+ y.range([0, availableWidth]);
+
+ x0 = x0 || x;
+ y0 = y0 || d3.scale.linear().domain(y.domain()).range([y(0),y(0)]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-multibarHorizontal').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibarHorizontal');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) });
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('g.nv-bar')
+ .data(function(d) { return d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('g')
+ .attr('transform', function(d,i,j) {
+ return 'translate(' + y0(stacked ? d.y0 : 0) + ',' + (stacked ? 0 : (j * x.rangeBand() / data.length ) + x(getX(d,i))) + ')'
+ });
+
+ barsEnter.append('rect')
+ .attr('width', 0)
+ .attr('height', x.rangeBand() / (stacked ? 1 : data.length) )
+
+ bars
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [ y(getY(d,i) + (stacked ? d.y0 : 0)), x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length) ],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+
+
+ barsEnter.append('text');
+
+ if (showValues && !stacked) {
+ bars.select('text')
+ .attr('text-anchor', function(d,i) { return getY(d,i) < 0 ? 'end' : 'start' })
+ .attr('y', x.rangeBand() / (data.length * 2))
+ .attr('dy', '.32em')
+ .text(function(d,i) { return valueFormat(getY(d,i)) })
+ d3.transition(bars)
+ //.delay(function(d,i) { return i * delay / data[0].values.length })
+ .select('text')
+ .attr('x', function(d,i) { return getY(d,i) < 0 ? -4 : y(getY(d,i)) - y(0) + 4 })
+ } else {
+ //bars.selectAll('text').remove();
+ bars.selectAll('text').text('');
+ }
+
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+
+ if (barColor) {
+ if (!disabled) disabled = data.map(function() { return true });
+ bars
+ //.style('fill', barColor)
+ //.style('stroke', barColor)
+ //.style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); })
+ //.style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); })
+ .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); })
+ .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); });
+ }
+
+ if (stacked)
+ d3.transition(bars)
+ //.delay(function(d,i) { return i * delay / data[0].values.length })
+ .attr('transform', function(d,i) {
+ //return 'translate(' + y(d.y0) + ',0)'
+ //return 'translate(' + y(d.y0) + ',' + x(getX(d,i)) + ')'
+ return 'translate(' + y(d.y1) + ',' + x(getX(d,i)) + ')'
+ })
+ .select('rect')
+ .attr('width', function(d,i) {
+ return Math.abs(y(getY(d,i) + d.y0) - y(d.y0))
+ })
+ .attr('height', x.rangeBand() );
+ else
+ d3.transition(bars)
+ //.delay(function(d,i) { return i * delay / data[0].values.length })
+ .attr('transform', function(d,i) {
+ //TODO: stacked must be all positive or all negative, not both?
+ return 'translate(' +
+ (getY(d,i) < 0 ? y(getY(d,i)) : y(0))
+ + ',' +
+ (d.series * x.rangeBand() / data.length
+ +
+ x(getX(d,i)) )
+ + ')'
+ })
+ .select('rect')
+ .attr('height', x.rangeBand() / data.length )
+ .attr('width', function(d,i) {
+ return Math.max(Math.abs(y(getY(d,i)) - y(0)),1)
+ });
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.stacked = function(_) {
+ if (!arguments.length) return stacked;
+ stacked = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.barColor = function(_) {
+ if (!arguments.length) return barColor;
+ barColor = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.disabled = function(_) {
+ if (!arguments.length) return disabled;
+ disabled = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.delay = function(_) {
+ if (!arguments.length) return delay;
+ delay = _;
+ return chart;
+ };
+
+ chart.showValues = function(_) {
+ if (!arguments.length) return showValues;
+ showValues = _;
+ return chart;
+ };
+
+ chart.valueFormat= function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.valuePadding = function(_) {
+ if (!arguments.length) return valuePadding;
+ valuePadding = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.multiBarHorizontalChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var multibar = nv.models.multiBarHorizontal()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend().height(30)
+ , controls = nv.models.legend().height(30)
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , showControls = true
+ , showLegend = true
+ , logScale = false
+ , stacked = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph, logScale) {
+ //alert(y+ " " + logScale + " " + Math.pow(10,y) + " " + Math.pow(10,y).toFixed(0));
+ if(logScale) {
+ //var fmt = d3.format(',.2f');
+ return '<h3>' + key + ' - ' + x + '</h3>' +
+ '<p>' + yAxis.tickFormat()(Math.pow(10,y)) + '</p>'
+ } else {
+ return '<h3>' + key + ' - ' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , state = { stacked: stacked }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = function() { return showControls ? 180 : 0 }
+ ;
+
+ multibar
+ .stacked(stacked)
+ ;
+ xAxis
+ .orient('left')
+ .tickPadding(5)
+ .highlightZero(false)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient('bottom')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ //var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ //alert(offsetElement.offsetLeft + " " + e.pos[0]);
+ var leftPos = 0;
+ if(e.pos[0] >=200) leftPos = 200;
+ else leftPos = e.pos[0];
+ if(logScale)
+ y = multibar.y()(e.point, e.pointIndex);
+ else
+ y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex))
+ var left = leftPos + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart, logScale);
+ //alert("from tooltip " + multibar.y()(e.point, e.pointIndex));
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = multibar.xScale();
+ y = multibar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multiBarHorizontalChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarHorizontalChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth - controlWidth());
+
+ if (multibar.barColor())
+ data.forEach(function(series,i) {
+ series.color = d3.rgb('#ccc').darker(i * 1.5).toString();
+ })
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Grouped', disabled: multibar.stacked() },
+ { key: 'Stacked', disabled: !multibar.stacked() }
+ ];
+
+ controls.width(controlWidth()).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ multibar
+ .disabled(data.map(function(series) { return series.disabled }))
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(barsWrap).call(multibar);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableHeight / 24 )
+ .tickSize(-availableWidth, 0);
+
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+ var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
+
+ xTicks
+ .selectAll('line, text')
+ .style('opacity', 1)
+
+
+ yAxis
+ .scale(y)
+ .ticks( availableWidth / 100 )
+ .tickSize( -availableHeight, 0);
+
+ g.select('.nv-y.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Grouped':
+ multibar.stacked(false);
+ break;
+ case 'Stacked':
+ multibar.stacked(true);
+ break;
+ }
+
+ state.stacked = multibar.stacked();
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.stacked !== 'undefined') {
+ multibar.stacked(e.stacked);
+ state.stacked = e.stacked;
+ }
+
+ selection.call(chart);
+ });
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ multibar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ multibar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.multibar = multibar;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'forceX', 'forceY', 'clipEdge', 'id', 'delay', 'showValues', 'valueFormat', 'stacked', 'barColor');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.logScale = function(_) {
+ if (!arguments.length) return logScale;
+ logScale = _;
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+nv.models.multiChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60},
+ color = d3.scale.category20().range(),
+ width = null,
+ height = null,
+ showLegend = true,
+ tooltips = true,
+ tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ },
+ x, y; //can be accessed via chart.lines.[x/y]Scale()
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x = d3.scale.linear(),
+ yScale1 = d3.scale.linear(),
+ yScale2 = d3.scale.linear(),
+
+ lines1 = nv.models.line().yScale(yScale1),
+ lines2 = nv.models.line().yScale(yScale2),
+
+ bars1 = nv.models.multiBar().stacked(false).yScale(yScale1),
+ bars2 = nv.models.multiBar().stacked(false).yScale(yScale2),
+
+ stack1 = nv.models.stackedArea().yScale(yScale1),
+ stack2 = nv.models.stackedArea().yScale(yScale2),
+
+ xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5),
+ yAxis1 = nv.models.axis().scale(yScale1).orient('left'),
+ yAxis2 = nv.models.axis().scale(yScale2).orient('right'),
+
+ legend = nv.models.legend().height(30),
+ dispatch = d3.dispatch('tooltipShow', 'tooltipHide');
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines1.x()(e.point, e.pointIndex)),
+ y = ((e.series.yAxis == 2) ? yAxis2 : yAxis1).tickFormat()(lines1.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, undefined, undefined, offsetElement.offsetParent);
+ };
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ var dataLines1 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 1})
+ var dataLines2 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 2})
+ var dataBars1 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 1})
+ var dataBars2 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 2})
+ var dataStack1 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 1})
+ var dataStack2 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 2})
+
+ var series1 = data.filter(function(d) {return !d.disabled && d.yAxis == 1})
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: d.x, y: d.y }
+ })
+ })
+
+ var series2 = data.filter(function(d) {return !d.disabled && d.yAxis == 2})
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: d.x, y: d.y }
+ })
+ })
+
+ x .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } ))
+ .range([0, availableWidth]);
+
+ var wrap = container.selectAll('g.wrap.multiChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 multiChart').append('g');
+
+ gEnter.append('g').attr('class', 'x axis');
+ gEnter.append('g').attr('class', 'y1 axis');
+ gEnter.append('g').attr('class', 'y2 axis');
+ gEnter.append('g').attr('class', 'lines1Wrap');
+ gEnter.append('g').attr('class', 'lines2Wrap');
+ gEnter.append('g').attr('class', 'bars1Wrap');
+ gEnter.append('g').attr('class', 'bars2Wrap');
+ gEnter.append('g').attr('class', 'stack1Wrap');
+ gEnter.append('g').attr('class', 'stack2Wrap');
+ gEnter.append('g').attr('class', 'legendWrap');
+
+ var g = wrap.select('g');
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.yAxis == 1 ? '' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+
+ lines1
+ .width(availableWidth)
+ .height(availableHeight)
+ .interpolate("monotone")
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'line'}));
+
+ lines2
+ .width(availableWidth)
+ .height(availableHeight)
+ .interpolate("monotone")
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'line'}));
+
+ bars1
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'bar'}));
+
+ bars2
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'bar'}));
+
+ stack1
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'area'}));
+
+ stack2
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'area'}));
+
+ g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ var lines1Wrap = g.select('.lines1Wrap')
+ .datum(dataLines1)
+ var bars1Wrap = g.select('.bars1Wrap')
+ .datum(dataBars1)
+ var stack1Wrap = g.select('.stack1Wrap')
+ .datum(dataStack1)
+
+ var lines2Wrap = g.select('.lines2Wrap')
+ .datum(dataLines2)
+ var bars2Wrap = g.select('.bars2Wrap')
+ .datum(dataBars2)
+ var stack2Wrap = g.select('.stack2Wrap')
+ .datum(dataStack2)
+
+ var extraValue1 = dataStack1.length ? dataStack1.map(function(a){return a.values}).reduce(function(a,b){
+ return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}})
+ }).concat([{x:0, y:0}]) : []
+ var extraValue2 = dataStack2.length ? dataStack2.map(function(a){return a.values}).reduce(function(a,b){
+ return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}})
+ }).concat([{x:0, y:0}]) : []
+
+ yScale1 .domain(d3.extent(d3.merge(series1).concat(extraValue1), function(d) { return d.y } ))
+ .range([0, availableHeight])
+
+ yScale2 .domain(d3.extent(d3.merge(series2).concat(extraValue2), function(d) { return d.y } ))
+ .range([0, availableHeight])
+
+ lines1.yDomain(yScale1.domain())
+ bars1.yDomain(yScale1.domain())
+ stack1.yDomain(yScale1.domain())
+
+ lines2.yDomain(yScale2.domain())
+ bars2.yDomain(yScale2.domain())
+ stack2.yDomain(yScale2.domain())
+
+ if(dataStack1.length){d3.transition(stack1Wrap).call(stack1);}
+ if(dataStack2.length){d3.transition(stack2Wrap).call(stack2);}
+
+ if(dataBars1.length){d3.transition(bars1Wrap).call(bars1);}
+ if(dataBars2.length){d3.transition(bars2Wrap).call(bars2);}
+
+ if(dataLines1.length){d3.transition(lines1Wrap).call(lines1);}
+ if(dataLines2.length){d3.transition(lines2Wrap).call(lines2);}
+
+
+
+ xAxis
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.x.axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+ d3.transition(g.select('.x.axis'))
+ .call(xAxis);
+
+ yAxis1
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+
+ d3.transition(g.select('.y1.axis'))
+ .call(yAxis1);
+
+ yAxis2
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.y2.axis'))
+ .call(yAxis2);
+
+ g.select('.y2.axis')
+ .style('opacity', series2.length ? 1 : 0)
+ .attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+ if (series2.length <= 0) {
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.series').classed('disabled', false);
+ return d;
+ });
+ }
+ chart.update();
+ }
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ stack1.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ if (!Math.round(stack1.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stack1.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ stack2.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ if (!Math.round(stack2.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stack2.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+
+
+ //============================================================
+ // Global getters and setters
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.lines1 = lines1;
+ chart.lines2 = lines2;
+ chart.bars1 = bars1;
+ chart.bars2 = bars2;
+ chart.stack1 = stack1;
+ chart.stack2 = stack2;
+ chart.xAxis = xAxis;
+ chart.yAxis1 = yAxis1;
+ chart.yAxis2 = yAxis2;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines1.x(_);
+ bars1.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines1.y(_);
+ bars1.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = _;
+ legend.color(_);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ return chart;
+}
+
+
+nv.models.ohlcBar = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , getOpen = function(d) { return d.open }
+ , getClose = function(d) { return d.close }
+ , getHigh = function(d) { return d.high }
+ , getLow = function(d) { return d.low }
+ , forceX = []
+ , forceY = []
+ , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart
+ , clipEdge = true
+ , color = nv.utils.defaultColor()
+ , xDomain
+ , yDomain
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ //TODO: store old scales for transitions
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) ));
+
+ if (padData)
+ x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range([0, availableWidth]);
+
+ y .domain(yDomain || [
+ d3.min(data[0].values.map(getLow).concat(forceY)),
+ d3.max(data[0].values.map(getHigh).concat(forceY))
+ ])
+ .range([availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-ohlcBar').data([data[0].values]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-ohlcBar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-ticks');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-chart-clip-path-' + id)
+ .append('rect');
+
+ wrap.select('#nv-chart-clip-path-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : '');
+
+
+
+ var ticks = wrap.select('.nv-ticks').selectAll('.nv-tick')
+ .data(function(d) { return d });
+
+ ticks.exit().remove();
+
+
+ var ticksEnter = ticks.enter().append('path')
+ .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i })
+ .attr('d', function(d,i) {
+ var w = (availableWidth / data[0].values.length) * .9;
+ return 'm0,0l0,'
+ + (y(getOpen(d,i))
+ - y(getHigh(d,i)))
+ + 'l'
+ + (-w/2)
+ + ',0l'
+ + (w/2)
+ + ',0l0,'
+ + (y(getLow(d,i)) - y(getOpen(d,i)))
+ + 'l0,'
+ + (y(getClose(d,i))
+ - y(getLow(d,i)))
+ + 'l'
+ + (w/2)
+ + ',0l'
+ + (-w/2)
+ + ',0z';
+ })
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; })
+ //.attr('fill', function(d,i) { return color[0]; })
+ //.attr('stroke', function(d,i) { return color[0]; })
+ //.attr('x', 0 )
+ //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) })
+ .on('mouseover', function(d,i) {
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ point: d,
+ series: data[0],
+ pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ point: d,
+ series: data[0],
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ ticks
+ .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i })
+ d3.transition(ticks)
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; })
+ .attr('d', function(d,i) {
+ var w = (availableWidth / data[0].values.length) * .9;
+ return 'm0,0l0,'
+ + (y(getOpen(d,i))
+ - y(getHigh(d,i)))
+ + 'l'
+ + (-w/2)
+ + ',0l'
+ + (w/2)
+ + ',0l0,'
+ + (y(getLow(d,i))
+ - y(getOpen(d,i)))
+ + 'l0,'
+ + (y(getClose(d,i))
+ - y(getLow(d,i)))
+ + 'l'
+ + (w/2)
+ + ',0l'
+ + (-w/2)
+ + ',0z';
+ })
+ //.attr('width', (availableWidth / data[0].values.length) * .9 )
+
+
+ //d3.transition(ticks)
+ //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) });
+ //.order(); // not sure if this makes any sense for this model
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.open = function(_) {
+ if (!arguments.length) return getOpen;
+ getOpen = _;
+ return chart;
+ };
+
+ chart.close = function(_) {
+ if (!arguments.length) return getClose;
+ getClose = _;
+ return chart;
+ };
+
+ chart.high = function(_) {
+ if (!arguments.length) return getHigh;
+ getHigh = _;
+ return chart;
+ };
+
+ chart.low = function(_) {
+ if (!arguments.length) return getLow;
+ getLow = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+nv.models.pie = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 500
+ , height = 500
+ , getValues = function(d) { return d.values }
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , getDescription = function(d) { return d.description }
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , color = nv.utils.defaultColor()
+ , valueFormat = d3.format(',.2f')
+ , showLabels = true
+ , pieLabelsOutside = true
+ , donutLabelsOutside = false
+ , labelThreshold = .02 //if slice percentage is under this, don't show label
+ , donut = false
+ , labelSunbeamLayout = false
+ , startAngle = false
+ , endAngle = false
+ , donutRatio = 0.5
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ radius = Math.min(availableWidth, availableHeight) / 2,
+ arcRadius = radius-(radius / 5),
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ //var wrap = container.selectAll('.nv-wrap.nv-pie').data([data]);
+ var wrap = container.selectAll('.nv-wrap.nv-pie').data([getValues(data[0])]);
+ var wrapEnter = wrap.enter().append('g').attr('class','nvd3 nv-wrap nv-pie nv-chart-' + id);
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-pie');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+ g.select('.nv-pie').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ var arc = d3.svg.arc()
+ .outerRadius(arcRadius);
+
+ if (startAngle) arc.startAngle(startAngle)
+ if (endAngle) arc.endAngle(endAngle);
+ if (donut) arc.innerRadius(radius * donutRatio);
+
+ // Setup the Pie chart and choose the data element
+ var pie = d3.layout.pie()
+ .sort(null)
+ .value(function(d) { return d.disabled ? 0 : getY(d) });
+
+ var slices = wrap.select('.nv-pie').selectAll('.nv-slice')
+ .data(pie);
+
+ slices.exit().remove();
+
+ var ae = slices.enter().append('g')
+ .attr('class', 'nv-slice')
+ .on('mouseover', function(d,i){
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ pointIndex: i,
+ pos: [d3.event.pageX, d3.event.pageY],
+ id: id
+ });
+ })
+ .on('mouseout', function(d,i){
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ id: id
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ slices
+ .attr('fill', function(d,i) { return color(d, i); })
+ .attr('stroke', function(d,i) { return color(d, i); });
+
+ var paths = ae.append('path')
+ .each(function(d) { this._current = d; });
+ //.attr('d', arc);
+
+ d3.transition(slices.select('path'))
+ .attr('d', arc)
+ .attrTween('d', arcTween);
+
+ if (showLabels) {
+ // This does the normal label
+ var labelsArc = d3.svg.arc().innerRadius(0);
+
+ if (pieLabelsOutside){ labelsArc = arc; }
+
+ if (donutLabelsOutside) { labelsArc = d3.svg.arc().outerRadius(arc.outerRadius()); }
+
+ ae.append("g").classed("nv-label", true)
+ .each(function(d, i) {
+ var group = d3.select(this);
+
+ group
+ .attr('transform', function(d) {
+ if (labelSunbeamLayout) {
+ d.outerRadius = arcRadius + 10; // Set Outer Coordinate
+ d.innerRadius = arcRadius + 15; // Set Inner Coordinate
+ var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
+ if ((d.startAngle+d.endAngle)/2 < Math.PI) {
+ rotateAngle -= 90;
+ } else {
+ rotateAngle += 90;
+ }
+ return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
+ } else {
+ d.outerRadius = radius + 10; // Set Outer Coordinate
+ d.innerRadius = radius + 15; // Set Inner Coordinate
+ return 'translate(' + labelsArc.centroid(d) + ')'
+ }
+ });
+
+ group.append('rect')
+ .style('stroke', '#fff')
+ .style('fill', '#fff')
+ .attr("rx", 3)
+ .attr("ry", 3);
+
+ group.append('text')
+ .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
+ .style('fill', '#000')
+
+
+ });
+
+ slices.select(".nv-label").transition()
+ .attr('transform', function(d) {
+ if (labelSunbeamLayout) {
+ d.outerRadius = arcRadius + 10; // Set Outer Coordinate
+ d.innerRadius = arcRadius + 15; // Set Inner Coordinate
+ var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
+ if ((d.startAngle+d.endAngle)/2 < Math.PI) {
+ rotateAngle -= 90;
+ } else {
+ rotateAngle += 90;
+ }
+ return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
+ } else {
+ d.outerRadius = radius + 10; // Set Outer Coordinate
+ d.innerRadius = radius + 15; // Set Inner Coordinate
+ return 'translate(' + labelsArc.centroid(d) + ')'
+ }
+ });
+
+ slices.each(function(d, i) {
+ var slice = d3.select(this);
+
+ slice
+ .select(".nv-label text")
+ .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
+ .text(function(d, i) {
+ var percent = (d.endAngle - d.startAngle) / (2 * Math.PI);
+ return (d.value && percent > labelThreshold) ? getX(d.data) : '';
+ });
+
+ var textBox = slice.select('text').node().getBBox();
+ slice.select(".nv-label rect")
+ .attr("width", textBox.width + 10)
+ .attr("height", textBox.height + 10)
+ .attr("transform", function() {
+ return "translate(" + [textBox.x - 5, textBox.y - 5] + ")";
+ });
+ });
+ }
+
+
+ // Computes the angle of an arc, converting from radians to degrees.
+ function angle(d) {
+ var a = (d.startAngle + d.endAngle) * 90 / Math.PI - 90;
+ return a > 90 ? a - 180 : a;
+ }
+
+ function arcTween(a) {
+ a.endAngle = isNaN(a.endAngle) ? 0 : a.endAngle;
+ a.startAngle = isNaN(a.startAngle) ? 0 : a.startAngle;
+ if (!donut) a.innerRadius = 0;
+ var i = d3.interpolate(this._current, a);
+ this._current = i(0);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+
+ function tweenPie(b) {
+ b.innerRadius = 0;
+ var i = d3.interpolate({startAngle: 0, endAngle: 0}, b);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.values = function(_) {
+ if (!arguments.length) return getValues;
+ getValues = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.description = function(_) {
+ if (!arguments.length) return getDescription;
+ getDescription = _;
+ return chart;
+ };
+
+ chart.showLabels = function(_) {
+ if (!arguments.length) return showLabels;
+ showLabels = _;
+ return chart;
+ };
+
+ chart.labelSunbeamLayout = function(_) {
+ if (!arguments.length) return labelSunbeamLayout;
+ labelSunbeamLayout = _;
+ return chart;
+ };
+
+ chart.donutLabelsOutside = function(_) {
+ if (!arguments.length) return donutLabelsOutside;
+ donutLabelsOutside = _;
+ return chart;
+ };
+
+ chart.pieLabelsOutside = function(_) {
+ if (!arguments.length) return pieLabelsOutside;
+ pieLabelsOutside = _;
+ return chart;
+ };
+
+ chart.donut = function(_) {
+ if (!arguments.length) return donut;
+ donut = _;
+ return chart;
+ };
+
+ chart.donutRatio = function(_) {
+ if (!arguments.length) return donutRatio;
+ donutRatio = _;
+ return chart;
+ };
+
+ chart.startAngle = function(_) {
+ if (!arguments.length) return startAngle;
+ startAngle = _;
+ return chart;
+ };
+
+ chart.endAngle = function(_) {
+ if (!arguments.length) return endAngle;
+ endAngle = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.valueFormat = function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.labelThreshold = function(_) {
+ if (!arguments.length) return labelThreshold;
+ labelThreshold = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
+nv.models.pieChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var pie = nv.models.pie()
+ , legend = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 20, left: 20}
+ , width = null
+ , height = null
+ , showLegend = true
+ , color = nv.utils.defaultColor()
+ , tooltips = true
+ , tooltip = function(key, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , state = {}
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var tooltipLabel = pie.description()(e.point) || pie.x()(e.point)
+ var left = e.pos[0] + ( (offsetElement && offsetElement.offsetLeft) || 0 ),
+ top = e.pos[1] + ( (offsetElement && offsetElement.offsetTop) || 0),
+ y = pie.valueFormat()(pie.y()(e.point)),
+ content = tooltip(tooltipLabel, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data[0].map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data[0] || !data[0].length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-pieChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-pieChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-pieWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend
+ .width( availableWidth )
+ .key(pie.x());
+
+ wrap.select('.nv-legendWrap')
+ .datum(pie.values()(data[0]))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ pie
+ .width(availableWidth)
+ .height(availableHeight);
+
+
+ var pieWrap = g.select('.nv-pieWrap')
+ .datum(data);
+
+ d3.transition(pieWrap).call(pie);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i, that) {
+ d.disabled = !d.disabled;
+
+ if (!pie.values()(data[0]).filter(function(d) { return !d.disabled }).length) {
+ pie.values()(data[0]).map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data[0].map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ pie.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data[0].forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ pie.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.legend = legend;
+ chart.dispatch = dispatch;
+ chart.pie = pie;
+
+ d3.rebind(chart, pie, 'valueFormat', 'values', 'x', 'y', 'description', 'id', 'showLabels', 'donutLabelsOutside', 'pieLabelsOutside', 'donut', 'donutRatio', 'labelThreshold');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ pie.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.scatter = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // chooses color
+ , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , z = d3.scale.linear() //linear because d3.svg.shape.size is treated as area
+ , getX = function(d) { return d.x } // accessor to get the x value
+ , getY = function(d) { return d.y } // accessor to get the y value
+ , getSize = function(d) { return d.size || 1} // accessor to get the point size
+ , getShape = function(d) { return d.shape || 'circle' } // accessor to get point shape
+ , onlyCircles = true // Set to false to use shapes
+ , forceX = [] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.)
+ , forceY = [] // List of numbers to Force into the Y scale
+ , forceSize = [] // List of numbers to Force into the Size scale
+ , interactive = true // If true, plots a voronoi overlay for advanced point intersection
+ , pointKey = null
+ , pointActive = function(d) { return !d.notActive } // any points that return false will be filtered out
+ , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart
+ , padDataOuter = .1 //outerPadding to imitate ordinal scale outer padding
+ , clipEdge = false // if true, masks points within x and y scale
+ , clipVoronoi = true // if true, masks each point with a circle... can turn off to slightly increase performance
+ , clipRadius = function() { return 25 } // function to get the radius for voronoi point clips
+ , xDomain = null // Override x domain (skips the calculation from data)
+ , yDomain = null // Override y domain
+ , sizeDomain = null // Override point size domain
+ , sizeRange = null
+ , singlePoint = false
+ , dispatch = d3.dispatch('elementClick', 'elementMouseover', 'elementMouseout')
+ , useVoronoi = true
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0, z0 // used to store previous scales
+ , timeoutID
+ , needsUpdate = false // Flag for when the points are visually updating, but the interactive layer is behind, to disable tooltips
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //add series index to each data point for reference
+ data = data.map(function(series, i) {
+ series.values = series.values.map(function(point) {
+ point.series = i;
+ return point;
+ });
+ return series;
+ });
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain && sizeDomain) ? [] : // if we know xDomain and yDomain and sizeDomain, no need to calculate.... if Size is constant remember to set sizeDomain to speed up performance
+ d3.merge(
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), size: getSize(d,i) }
+ })
+ })
+ );
+
+ x .domain(xDomain || d3.extent(seriesData.map(function(d) { return d.x; }).concat(forceX)))
+
+ if (padData && data[0])
+ x.range([(availableWidth * padDataOuter + availableWidth) / (2 *data[0].values.length), availableWidth - availableWidth * (1 + padDataOuter) / (2 * data[0].values.length) ]);
+ //x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range([0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(seriesData.map(function(d) { return d.y }).concat(forceY)))
+ .range([availableHeight, 0]);
+
+ z .domain(sizeDomain || d3.extent(seriesData.map(function(d) { return d.size }).concat(forceSize)))
+ .range(sizeRange || [16, 256]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ if ( isNaN(x.domain()[0])) {
+ x.domain([-1,1]);
+ }
+
+ if ( isNaN(y.domain()[0])) {
+ y.domain([-1,1]);
+ }
+
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+ z0 = z0 || z;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatter').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatter nv-chart-' + id + (singlePoint ? ' nv-single-point' : ''));
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+ gEnter.append('g').attr('class', 'nv-point-paths');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+ function updateInteractiveLayer() {
+
+ if (!interactive) return false;
+
+ var eventElements;
+
+ var vertices = d3.merge(data.map(function(group, groupIndex) {
+ return group.values
+ .map(function(point, pointIndex) {
+ // *Adding noise to make duplicates very unlikely
+ // *Injecting series and point index for reference
+ /* *Adding a 'jitter' to the points, because there's an issue in d3.geom.voronoi.
+ */
+ var pX = getX(point,pointIndex) + Math.random() * 1e-7;
+ var pY = getY(point,pointIndex) + Math.random() * 1e-7;
+
+ return [x(pX),
+ y(pY),
+ groupIndex,
+ pointIndex, point]; //temp hack to add noise untill I think of a better way so there are no duplicates
+ })
+ .filter(function(pointArray, pointIndex) {
+ return pointActive(pointArray[4], pointIndex); // Issue #237.. move filter to after map, so pointIndex is correct!
+ })
+ })
+ );
+
+
+
+ //inject series and point index for reference into voronoi
+ if (useVoronoi === true) {
+
+ if (clipVoronoi) {
+ var pointClipsEnter = wrap.select('defs').selectAll('.nv-point-clips')
+ .data([id])
+ .enter();
+
+ pointClipsEnter.append('clipPath')
+ .attr('class', 'nv-point-clips')
+ .attr('id', 'nv-points-clip-' + id);
+
+ var pointClips = wrap.select('#nv-points-clip-' + id).selectAll('circle')
+ .data(vertices);
+ pointClips.enter().append('circle')
+ .attr('r', clipRadius);
+ pointClips.exit().remove();
+ pointClips
+ .attr('cx', function(d) { return d[0] })
+ .attr('cy', function(d) { return d[1] });
+
+ wrap.select('.nv-point-paths')
+ .attr('clip-path', 'url(#nv-points-clip-' + id + ')');
+ }
+
+
+ if(vertices.length) {
+ // Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work
+ vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]);
+ vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]);
+ vertices.push([x.range()[0] - 20, y.range()[0] + 20, null, null]);
+ vertices.push([x.range()[1] + 20, y.range()[1] - 20, null, null]);
+ }
+
+ var bounds = d3.geom.polygon([
+ [-10,-10],
+ [-10,height + 10],
+ [width + 10,height + 10],
+ [width + 10,-10]
+ ]);
+
+ var voronoi = d3.geom.voronoi(vertices).map(function(d, i) {
+ return {
+ 'data': bounds.clip(d),
+ 'series': vertices[i][2],
+ 'point': vertices[i][3]
+ }
+ });
+
+
+ var pointPaths = wrap.select('.nv-point-paths').selectAll('path')
+ .data(voronoi);
+ pointPaths.enter().append('path')
+ .attr('class', function(d,i) { return 'nv-path-'+i; });
+ pointPaths.exit().remove();
+ pointPaths
+ .attr('d', function(d) {
+ if (d.data.length === 0)
+ return 'M 0 0'
+ else
+ return 'M' + d.data.join('L') + 'Z';
+ });
+
+ pointPaths
+ .on('click', function(d) {
+ if (needsUpdate) return 0;
+ var series = data[d.series],
+ point = series.values[d.point];
+
+ dispatch.elementClick({
+ point: point,
+ series: series,
+ pos: [x(getX(point, d.point)) + margin.left, y(getY(point, d.point)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: d.point
+ });
+ })
+ .on('mouseover', function(d) {
+ if (needsUpdate) return 0;
+ var series = data[d.series],
+ point = series.values[d.point];
+
+ dispatch.elementMouseover({
+ point: point,
+ series: series,
+ pos: [x(getX(point, d.point)) + margin.left, y(getY(point, d.point)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: d.point
+ });
+ })
+ .on('mouseout', function(d, i) {
+ if (needsUpdate) return 0;
+ var series = data[d.series],
+ point = series.values[d.point];
+
+ dispatch.elementMouseout({
+ point: point,
+ series: series,
+ seriesIndex: d.series,
+ pointIndex: d.point
+ });
+ });
+
+
+ } else {
+ /*
+ // bring data in form needed for click handlers
+ var dataWithPoints = vertices.map(function(d, i) {
+ return {
+ 'data': d,
+ 'series': vertices[i][2],
+ 'point': vertices[i][3]
+ }
+ });
+ */
+
+ // add event handlers to points instead voronoi paths
+ wrap.select('.nv-groups').selectAll('.nv-group')
+ .selectAll('.nv-point')
+ //.data(dataWithPoints)
+ //.style('pointer-events', 'auto') // recativate events, disabled by css
+ .on('click', function(d,i) {
+ //nv.log('test', d, i);
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementClick({
+ point: point,
+ series: series,
+ pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ })
+ .on('mouseover', function(d,i) {
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementMouseover({
+ point: point,
+ series: series,
+ pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ })
+ .on('mouseout', function(d,i) {
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementMouseout({
+ point: point,
+ series: series,
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ });
+ }
+
+ needsUpdate = false;
+ }
+
+ needsUpdate = true;
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover });
+ d3.transition(groups)
+ .style('fill', function(d,i) { return color(d, i) })
+ .style('stroke', function(d,i) { return color(d, i) })
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .5);
+
+
+ if (onlyCircles) {
+
+ var points = groups.selectAll('circle.nv-point')
+ .data(function(d) { return d.values }, pointKey);
+ points.enter().append('circle')
+ .attr('cx', function(d,i) { return x0(getX(d,i)) })
+ .attr('cy', function(d,i) { return y0(getY(d,i)) })
+ .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) });
+ points.exit().remove();
+ groups.exit().selectAll('path.nv-point').transition()
+ .attr('cx', function(d,i) { return x(getX(d,i)) })
+ .attr('cy', function(d,i) { return y(getY(d,i)) })
+ .remove();
+ points.each(function(d,i) {
+ d3.select(this)
+ .classed('nv-point', true)
+ .classed('nv-point-' + i, true);
+ });
+ points.transition()
+ .attr('cx', function(d,i) { return x(getX(d,i)) })
+ .attr('cy', function(d,i) { return y(getY(d,i)) })
+ .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) });
+
+ } else {
+
+ var points = groups.selectAll('path.nv-point')
+ .data(function(d) { return d.values });
+ points.enter().append('path')
+ .attr('transform', function(d,i) {
+ return 'translate(' + x0(getX(d,i)) + ',' + y0(getY(d,i)) + ')'
+ })
+ .attr('d',
+ d3.svg.symbol()
+ .type(getShape)
+ .size(function(d,i) { return z(getSize(d,i)) })
+ );
+ points.exit().remove();
+ d3.transition(groups.exit().selectAll('path.nv-point'))
+ .attr('transform', function(d,i) {
+ return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
+ })
+ .remove();
+ points.each(function(d,i) {
+ d3.select(this)
+ .classed('nv-point', true)
+ .classed('nv-point-' + i, true);
+ });
+ points.transition()
+ .attr('transform', function(d,i) {
+ //nv.log(d,i,getX(d,i), x(getX(d,i)));
+ return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
+ })
+ .attr('d',
+ d3.svg.symbol()
+ .type(getShape)
+ .size(function(d,i) { return z(getSize(d,i)) })
+ );
+ }
+
+
+ // Delay updating the invisible interactive layer for smoother animation
+ clearTimeout(timeoutID); // stop repeat calls to updateInteractiveLayer
+ timeoutID = setTimeout(updateInteractiveLayer, 300);
+ //updateInteractiveLayer();
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+ z0 = z.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('elementMouseover.point', function(d) {
+ if (interactive)
+ d3.select('.nv-chart-' + id + ' .nv-series-' + d.seriesIndex + ' .nv-point-' + d.pointIndex)
+ .classed('hover', true);
+ });
+
+ dispatch.on('elementMouseout.point', function(d) {
+ if (interactive)
+ d3.select('.nv-chart-' + id + ' .nv-series-' + d.seriesIndex + ' .nv-point-' + d.pointIndex)
+ .classed('hover', false);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.size = function(_) {
+ if (!arguments.length) return getSize;
+ getSize = d3.functor(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.zScale = function(_) {
+ if (!arguments.length) return z;
+ z = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.sizeDomain = function(_) {
+ if (!arguments.length) return sizeDomain;
+ sizeDomain = _;
+ return chart;
+ };
+
+ chart.sizeRange = function(_) {
+ if (!arguments.length) return sizeRange;
+ sizeRange = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.forceSize = function(_) {
+ if (!arguments.length) return forceSize;
+ forceSize = _;
+ return chart;
+ };
+
+ chart.interactive = function(_) {
+ if (!arguments.length) return interactive;
+ interactive = _;
+ return chart;
+ };
+
+ chart.pointKey = function(_) {
+ if (!arguments.length) return pointKey;
+ pointKey = _;
+ return chart;
+ };
+
+ chart.pointActive = function(_) {
+ if (!arguments.length) return pointActive;
+ pointActive = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.padDataOuter = function(_) {
+ if (!arguments.length) return padDataOuter;
+ padDataOuter = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.clipVoronoi= function(_) {
+ if (!arguments.length) return clipVoronoi;
+ clipVoronoi = _;
+ return chart;
+ };
+
+ chart.useVoronoi= function(_) {
+ if (!arguments.length) return useVoronoi;
+ useVoronoi = _;
+ if (useVoronoi === false) {
+ clipVoronoi = false;
+ }
+ return chart;
+ };
+
+ chart.clipRadius = function(_) {
+ if (!arguments.length) return clipRadius;
+ clipRadius = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.shape = function(_) {
+ if (!arguments.length) return getShape;
+ getShape = _;
+ return chart;
+ };
+
+ chart.onlyCircles = function(_) {
+ if (!arguments.length) return onlyCircles;
+ onlyCircles = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.singlePoint = function(_) {
+ if (!arguments.length) return singlePoint;
+ singlePoint = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.scatterChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , distX = nv.models.distribution()
+ , distY = nv.models.distribution()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 75}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale()
+ , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale()
+ , xPadding = 0
+ , yPadding = 0
+ , showDistX = false
+ , showDistY = false
+ , showLegend = true
+ , showControls = !!d3.fisheye
+ , fisheye = 0
+ , pauseFisheye = false
+ , tooltips = true
+ , tooltipX = function(key, x, y) { return '<strong>' + x + '</strong>' }
+ , tooltipY = function(key, x, y) { return '<strong>' + y + '</strong>' }
+ //, tooltip = function(key, x, y) { return '<h3>' + key + '</h3>' }
+ , tooltip = null
+ , state = {}
+ , defaultState = null
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , noData = "No Data Available."
+ ;
+
+ scatter
+ .xScale(x)
+ .yScale(y)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(10)
+ ;
+ yAxis
+ .orient('left')
+ .tickPadding(10)
+ ;
+ distX
+ .axis('x')
+ ;
+ distY
+ .axis('y')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ var showTooltip = function(e, offsetElement) {
+ //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?)
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0),
+ leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ),
+ topY = e.pos[1] + ( offsetElement.offsetTop || 0),
+ xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)),
+ yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex));
+
+ if( tooltipX != null )
+ nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip');
+ if( tooltipY != null )
+ nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip');
+ if( tooltip != null )
+ nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ var controlsData = [
+ { key: 'Magnify', disabled: true }
+ ];
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ // chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id());
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ // background for pointer events
+ gEnter.append('rect').attr('class', 'nvd3 nv-background');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+ gEnter.append('g').attr('class', 'nv-distWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ wrap.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ controls.width(180).color(['#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+ .xDomain(null)
+ .yDomain(null)
+
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+
+ //Adjust for x and y padding
+ if (xPadding) {
+ var xRange = x.domain()[1] - x.domain()[0];
+ scatter.xDomain([x.domain()[0] - (xPadding * xRange), x.domain()[1] + (xPadding * xRange)]);
+ }
+
+ if (yPadding) {
+ var yRange = y.domain()[1] - y.domain()[0];
+ scatter.yDomain([y.domain()[0] - (yPadding * yRange), y.domain()[1] + (yPadding * yRange)]);
+ }
+
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( xAxis.ticks() && xAxis.ticks().length ? xAxis.ticks() : availableWidth / 100 )
+ .tickSize( -availableHeight , 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .call(xAxis);
+
+
+ yAxis
+ .scale(y)
+ .ticks( yAxis.ticks() && yAxis.ticks().length ? yAxis.ticks() : availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .call(yAxis);
+
+
+ if (showDistX) {
+ distX
+ .getData(scatter.x())
+ .scale(x)
+ .width(availableWidth)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionX');
+ g.select('.nv-distributionX')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ }
+
+ if (showDistY) {
+ distY
+ .getData(scatter.y())
+ .scale(y)
+ .width(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionY');
+ g.select('.nv-distributionY')
+ .attr('transform', 'translate(-' + distY.size() + ',0)')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+ //------------------------------------------------------------
+
+
+
+
+ if (d3.fisheye) {
+ g.select('.nv-background')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g.select('.nv-background').on('mousemove', updateFisheye);
+ g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;});
+ scatter.dispatch.on('elementClick.freezeFisheye', function() {
+ pauseFisheye = !pauseFisheye;
+ });
+ }
+
+
+ function updateFisheye() {
+ if (pauseFisheye) {
+ g.select('.nv-point-paths').style('pointer-events', 'all');
+ return false;
+ }
+
+ g.select('.nv-point-paths').style('pointer-events', 'none' );
+
+ var mouse = d3.mouse(this);
+ x.distortion(fisheye).focus(mouse[0]);
+ y.distortion(fisheye).focus(mouse[1]);
+
+ g.select('.nv-scatterWrap')
+ .call(scatter);
+
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ g.select('.nv-distributionX')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ g.select('.nv-distributionY')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ fisheye = d.disabled ? 0 : 2.5;
+ g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all');
+ g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' );
+
+ if (d.disabled) {
+ x.distortion(fisheye).focus(0);
+ y.distortion(fisheye).focus(0);
+
+ g.select('.nv-scatterWrap').call(scatter);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ } else {
+ pauseFisheye = false;
+ }
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendClick', function(d,i, that) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ /*
+ legend.dispatch.on('legendMouseover', function(d, i) {
+ d.hover = true;
+ chart(selection);
+ });
+
+ legend.dispatch.on('legendMouseout', function(d, i) {
+ d.hover = false;
+ chart(selection);
+ });
+ */
+
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', function(d,i) { return e.pos[1] - availableHeight;});
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', e.pos[0] + distX.size());
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', 0);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', distY.size());
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.distX = distX;
+ chart.distY = distY;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ distX.color(color);
+ distY.color(color);
+ return chart;
+ };
+
+ chart.showDistX = function(_) {
+ if (!arguments.length) return showDistX;
+ showDistX = _;
+ return chart;
+ };
+
+ chart.showDistY = function(_) {
+ if (!arguments.length) return showDistY;
+ showDistY = _;
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.fisheye = function(_) {
+ if (!arguments.length) return fisheye;
+ fisheye = _;
+ return chart;
+ };
+
+ chart.xPadding = function(_) {
+ if (!arguments.length) return xPadding;
+ xPadding = _;
+ return chart;
+ };
+
+ chart.yPadding = function(_) {
+ if (!arguments.length) return yPadding;
+ yPadding = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltipXContent = function(_) {
+ if (!arguments.length) return tooltipX;
+ tooltipX = _;
+ return chart;
+ };
+
+ chart.tooltipYContent = function(_) {
+ if (!arguments.length) return tooltipY;
+ tooltipY = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.scatterPlusLineChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , distX = nv.models.distribution()
+ , distY = nv.models.distribution()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 75}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale()
+ , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale()
+ , showDistX = false
+ , showDistY = false
+ , showLegend = true
+ , showControls = !!d3.fisheye
+ , fisheye = 0
+ , pauseFisheye = false
+ , tooltips = true
+ , tooltipX = function(key, x, y) { return '<strong>' + x + '</strong>' }
+ , tooltipY = function(key, x, y) { return '<strong>' + y + '</strong>' }
+ , tooltip = function(key, x, y, date) { return '<h3>' + key + '</h3>'
+ + '<p>' + date + '</p>' }
+ //, tooltip = null
+ , state = {}
+ , defaultState = null
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , noData = "No Data Available."
+ ;
+
+ scatter
+ .xScale(x)
+ .yScale(y)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(10)
+ ;
+ yAxis
+ .orient('left')
+ .tickPadding(10)
+ ;
+ distX
+ .axis('x')
+ ;
+ distY
+ .axis('y')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ var showTooltip = function(e, offsetElement) {
+ //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?)
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0),
+ leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ),
+ topY = e.pos[1] + ( offsetElement.offsetTop || 0),
+ xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)),
+ yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex));
+
+ if( tooltipX != null )
+ nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip');
+ if( tooltipY != null )
+ nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip');
+ if( tooltip != null )
+ nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e.point.tooltip, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ var controlsData = [
+ { key: 'Magnify', disabled: true }
+ ];
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id());
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ // background for pointer events
+ gEnter.append('rect').attr('class', 'nvd3 nv-background')
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+ gEnter.append('g').attr('class', 'nv-regressionLinesWrap');
+ gEnter.append('g').attr('class', 'nv-distWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ wrap.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ controls.width(180).color(['#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+
+ wrap.select('.nv-regressionLinesWrap')
+ .attr('clip-path', 'url(#nv-edge-clip-' + scatter.id() + ')');
+
+ var regWrap = wrap.select('.nv-regressionLinesWrap').selectAll('.nv-regLines')
+ .data(function(d) { return d });
+
+ var reglines = regWrap.enter()
+ .append('g').attr('class', 'nv-regLines')
+ .append('line').attr('class', 'nv-regLine')
+ .style('stroke-opacity', 0);
+
+ //d3.transition(regWrap.selectAll('.nv-regLines line'))
+ regWrap.selectAll('.nv-regLines line')
+ .attr('x1', x.range()[0])
+ .attr('x2', x.range()[1])
+ .attr('y1', function(d,i) { return y(x.domain()[0] * d.slope + d.intercept) })
+ .attr('y2', function(d,i) { return y(x.domain()[1] * d.slope + d.intercept) })
+ .style('stroke', function(d,i,j) { return color(d,j) })
+ .style('stroke-opacity', function(d,i) {
+ return (d.disabled || typeof d.slope === 'undefined' || typeof d.intercept === 'undefined') ? 0 : 1
+ });
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( xAxis.ticks() ? xAxis.ticks() : availableWidth / 100 )
+ .tickSize( -availableHeight , 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .call(xAxis);
+
+
+ yAxis
+ .scale(y)
+ .ticks( yAxis.ticks() ? yAxis.ticks() : availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .call(yAxis);
+
+
+ if (showDistX) {
+ distX
+ .getData(scatter.x())
+ .scale(x)
+ .width(availableWidth)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionX');
+ g.select('.nv-distributionX')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ }
+
+ if (showDistY) {
+ distY
+ .getData(scatter.y())
+ .scale(y)
+ .width(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionY');
+ g.select('.nv-distributionY')
+ .attr('transform', 'translate(-' + distY.size() + ',0)')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+ //------------------------------------------------------------
+
+
+
+
+ if (d3.fisheye) {
+ g.select('.nv-background')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g.select('.nv-background').on('mousemove', updateFisheye);
+ g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;});
+ scatter.dispatch.on('elementClick.freezeFisheye', function() {
+ pauseFisheye = !pauseFisheye;
+ });
+ }
+
+
+ function updateFisheye() {
+ if (pauseFisheye) {
+ g.select('.nv-point-paths').style('pointer-events', 'all');
+ return false;
+ }
+
+ g.select('.nv-point-paths').style('pointer-events', 'none' );
+
+ var mouse = d3.mouse(this);
+ x.distortion(fisheye).focus(mouse[0]);
+ y.distortion(fisheye).focus(mouse[1]);
+
+ g.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ g.select('.nv-distributionX')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ g.select('.nv-distributionY')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ fisheye = d.disabled ? 0 : 2.5;
+ g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all');
+ g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' );
+
+ if (d.disabled) {
+ x.distortion(fisheye).focus(0);
+ y.distortion(fisheye).focus(0);
+
+ g.select('.nv-scatterWrap').call(scatter);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ } else {
+ pauseFisheye = false;
+ }
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendClick', function(d,i, that) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ /*
+ legend.dispatch.on('legendMouseover', function(d, i) {
+ d.hover = true;
+ chart(selection);
+ });
+
+ legend.dispatch.on('legendMouseout', function(d, i) {
+ d.hover = false;
+ chart(selection);
+ });
+ */
+
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', e.pos[1] - availableHeight);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', e.pos[0] + distX.size());
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', 0);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', distY.size());
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.distX = distX;
+ chart.distY = distY;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ distX.color(color);
+ distY.color(color);
+ return chart;
+ };
+
+ chart.showDistX = function(_) {
+ if (!arguments.length) return showDistX;
+ showDistX = _;
+ return chart;
+ };
+
+ chart.showDistY = function(_) {
+ if (!arguments.length) return showDistY;
+ showDistY = _;
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.fisheye = function(_) {
+ if (!arguments.length) return fisheye;
+ fisheye = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltipXContent = function(_) {
+ if (!arguments.length) return tooltipX;
+ tooltipX = _;
+ return chart;
+ };
+
+ chart.tooltipYContent = function(_) {
+ if (!arguments.length) return tooltipY;
+ tooltipY = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.sparkline = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 2, right: 0, bottom: 2, left: 0}
+ , width = 400
+ , height = 32
+ , animate = true
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.getColor(['#000'])
+ , xDomain
+ , yDomain
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data, getX ))
+ .range([0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(data, getY ))
+ .range([availableHeight, 0]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-sparkline').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparkline');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
+
+ //------------------------------------------------------------
+
+
+ var paths = wrap.selectAll('path')
+ .data(function(d) { return [d] });
+ paths.enter().append('path');
+ paths.exit().remove();
+ paths
+ .style('stroke', function(d,i) { return d.color || color(d, i) })
+ .attr('d', d3.svg.line()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ );
+
+
+ // TODO: Add CURRENT data point (Need Min, Mac, Current / Most recent)
+ var points = wrap.selectAll('circle.nv-point')
+ .data(function(data) {
+ var yValues = data.map(function(d, i) { return getY(d,i); });
+ function pointIndex(index) {
+ if (index != -1) {
+ var result = data[index];
+ result.pointIndex = index;
+ return result;
+ } else {
+ return null;
+ }
+ }
+ var maxPoint = pointIndex(yValues.lastIndexOf(y.domain()[1])),
+ minPoint = pointIndex(yValues.indexOf(y.domain()[0])),
+ currentPoint = pointIndex(yValues.length - 1);
+ return [minPoint, maxPoint, currentPoint].filter(function (d) {return d != null;});
+ });
+ points.enter().append('circle');
+ points.exit().remove();
+ points
+ .attr('cx', function(d,i) { return x(getX(d,d.pointIndex)) })
+ .attr('cy', function(d,i) { return y(getY(d,d.pointIndex)) })
+ .attr('r', 2)
+ .attr('class', function(d,i) {
+ return getX(d, d.pointIndex) == x.domain()[1] ? 'nv-point nv-currentValue' :
+ getY(d, d.pointIndex) == y.domain()[0] ? 'nv-point nv-minValue' : 'nv-point nv-maxValue'
+ });
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.animate = function(_) {
+ if (!arguments.length) return animate;
+ animate = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.sparklinePlus = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var sparkline = nv.models.sparkline();
+
+ var margin = {top: 15, right: 100, bottom: 10, left: 50}
+ , width = null
+ , height = null
+ , x
+ , y
+ , index = []
+ , paused = false
+ , xTickFormat = d3.format(',r')
+ , yTickFormat = d3.format(',.2f')
+ , showValue = true
+ , alignValue = true
+ , rightAlignValue = false
+ , noData = "No Data Available."
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ var currentValue = sparkline.y()(data[data.length-1], data.length-1);
+
+ //------------------------------------------------------------
+
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = sparkline.xScale();
+ y = sparkline.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-sparklineplus').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparklineplus');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-sparklineWrap');
+ gEnter.append('g').attr('class', 'nv-valueWrap');
+ gEnter.append('g').attr('class', 'nv-hoverArea');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ var sparklineWrap = g.select('.nv-sparklineWrap');
+
+ sparkline
+ .width(availableWidth)
+ .height(availableHeight);
+
+ sparklineWrap
+ .call(sparkline);
+
+ //------------------------------------------------------------
+
+
+ var valueWrap = g.select('.nv-valueWrap');
+
+ var value = valueWrap.selectAll('.nv-currentValue')
+ .data([currentValue]);
+
+ value.enter().append('text').attr('class', 'nv-currentValue')
+ .attr('dx', rightAlignValue ? -8 : 8)
+ .attr('dy', '.9em')
+ .style('text-anchor', rightAlignValue ? 'end' : 'start');
+
+ value
+ .attr('x', availableWidth + (rightAlignValue ? margin.right : 0))
+ .attr('y', alignValue ? function(d) { return y(d) } : 0)
+ .style('fill', sparkline.color()(data[data.length-1], data.length-1))
+ .text(yTickFormat(currentValue));
+
+
+
+ gEnter.select('.nv-hoverArea').append('rect')
+ .on('mousemove', sparklineHover)
+ .on('click', function() { paused = !paused })
+ .on('mouseout', function() { index = []; updateValueLine(); });
+ //.on('mouseout', function() { index = null; updateValueLine(); });
+
+ g.select('.nv-hoverArea rect')
+ .attr('transform', function(d) { return 'translate(' + -margin.left + ',' + -margin.top + ')' })
+ .attr('width', availableWidth + margin.left + margin.right)
+ .attr('height', availableHeight + margin.top);
+
+
+
+ function updateValueLine() { //index is currently global (within the chart), may or may not keep it that way
+ if (paused) return;
+
+ var hoverValue = g.selectAll('.nv-hoverValue').data(index)
+
+ var hoverEnter = hoverValue.enter()
+ .append('g').attr('class', 'nv-hoverValue')
+ .style('stroke-opacity', 0)
+ .style('fill-opacity', 0);
+
+ hoverValue.exit()
+ .transition().duration(250)
+ .style('stroke-opacity', 0)
+ .style('fill-opacity', 0)
+ .remove();
+
+ hoverValue
+ .attr('transform', function(d) { return 'translate(' + x(sparkline.x()(data[d],d)) + ',0)' })
+ .transition().duration(250)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', 1);
+
+ if (!index.length) return;
+
+ hoverEnter.append('line')
+ .attr('x1', 0)
+ .attr('y1', -margin.top)
+ .attr('x2', 0)
+ .attr('y2', availableHeight);
+
+
+ hoverEnter.append('text').attr('class', 'nv-xValue')
+ .attr('x', -6)
+ .attr('y', -margin.top)
+ .attr('text-anchor', 'end')
+ .attr('dy', '.9em')
+
+
+ g.select('.nv-hoverValue .nv-xValue')
+ .text(xTickFormat(sparkline.x()(data[index[0]], index[0])));
+
+ hoverEnter.append('text').attr('class', 'nv-yValue')
+ .attr('x', 6)
+ .attr('y', -margin.top)
+ .attr('text-anchor', 'start')
+ .attr('dy', '.9em')
+
+ g.select('.nv-hoverValue .nv-yValue')
+ .text(yTickFormat(sparkline.y()(data[index[0]], index[0])));
+
+ }
+
+
+ function sparklineHover() {
+ if (paused) return;
+
+ var pos = d3.mouse(this)[0] - margin.left;
+
+ function getClosestIndex(data, x) {
+ var distance = Math.abs(sparkline.x()(data[0], 0) - x);
+ var closestIndex = 0;
+ for (var i = 0; i < data.length; i++){
+ if (Math.abs(sparkline.x()(data[i], i) - x) < distance) {
+ distance = Math.abs(sparkline.x()(data[i], i) - x);
+ closestIndex = i;
+ }
+ }
+ return closestIndex;
+ }
+
+ index = [getClosestIndex(data, Math.round(x.invert(pos)))];
+
+ updateValueLine();
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.sparkline = sparkline;
+
+ d3.rebind(chart, sparkline, 'x', 'y', 'xScale', 'yScale', 'color');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xTickFormat = function(_) {
+ if (!arguments.length) return xTickFormat;
+ xTickFormat = _;
+ return chart;
+ };
+
+ chart.yTickFormat = function(_) {
+ if (!arguments.length) return yTickFormat;
+ yTickFormat = _;
+ return chart;
+ };
+
+ chart.showValue = function(_) {
+ if (!arguments.length) return showValue;
+ showValue = _;
+ return chart;
+ };
+
+ chart.alignValue = function(_) {
+ if (!arguments.length) return alignValue;
+ alignValue = _;
+ return chart;
+ };
+
+ chart.rightAlignValue = function(_) {
+ if (!arguments.length) return rightAlignValue;
+ rightAlignValue = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.stackedArea = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // a function that computes the color
+ , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't selet one
+ , getX = function(d) { return d.x } // accessor to get the x value from a data point
+ , getY = function(d) { return d.y } // accessor to get the y value from a data point
+ , style = 'stack'
+ , offset = 'zero'
+ , order = 'default'
+ , interpolate = 'linear' // controls the line interpolation
+ , clipEdge = false // if true, masks lines within x and y scale
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , yAxisTooltipFormat = d3.format(',.3f')
+ , scatter = nv.models.scatter()
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'areaClick', 'areaMouseover', 'areaMouseout')
+ ;
+
+ scatter
+ .size(2.2) // default size
+ .sizeDomain([2.2,2.2]) // all the same size by default
+ ;
+
+ /************************************
+ * offset:
+ * 'wiggle' (stream)
+ * 'zero' (stacked)
+ * 'expand' (normalize to 100%)
+ * 'silhouette' (simple centered)
+ *
+ * order:
+ * 'inside-out' (stream)
+ * 'default' (input order)
+ ************************************/
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ //------------------------------------------------------------
+
+
+ // Injecting point index into each point because d3.layout.stack().out does not give index
+ // ***Also storing getY(d,i) as stackedY so that it can be set to 0 if series is disabled
+ data = data.map(function(aseries, i) {
+ aseries.values = aseries.values.map(function(d, j) {
+ d.index = j;
+ d.stackedY = aseries.disabled ? 0 : getY(d,j);
+ return d;
+ })
+ return aseries;
+ });
+
+
+ data = d3.layout.stack()
+ .order(order)
+ .offset(offset)
+ .values(function(d) { return d.values }) //TODO: make values customizeable in EVERY model in this fashion
+ .x(getX)
+ .y(function(d) { return d.stackedY })
+ .out(function(d, y0, y) {
+ d.display = {
+ y: y,
+ y0: y0
+ };
+ })
+ (data);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-stackedarea').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedarea');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-areaWrap');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .x(getX)
+ .y(function(d) { return d.display.y + d.display.y0 })
+ .forceY([0])
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+ var scatterWrap = g.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ //d3.transition(scatterWrap).call(scatter);
+ scatterWrap.call(scatter);
+
+
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+
+
+ var area = d3.svg.area()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d) { return y(d.display.y0) })
+ .y1(function(d) { return y(d.display.y + d.display.y0) })
+ .interpolate(interpolate);
+
+ var zeroArea = d3.svg.area()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d) { return y(d.display.y0) })
+ .y1(function(d) { return y(d.display.y0) });
+
+
+ var path = g.select('.nv-areaWrap').selectAll('path.nv-area')
+ .data(function(d) { return d });
+ //.data(function(d) { return d }, function(d) { return d.key });
+ path.enter().append('path').attr('class', function(d,i) { return 'nv-area nv-area-' + i })
+ .on('mouseover', function(d,i) {
+ d3.select(this).classed('hover', true);
+ dispatch.areaMouseover({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.areaMouseout({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ .on('click', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.areaClick({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ //d3.transition(path.exit())
+ path.exit()
+ .attr('d', function(d,i) { return zeroArea(d.values,i) })
+ .remove();
+ path
+ .style('fill', function(d,i){ return d.color || color(d, i) })
+ .style('stroke', function(d,i){ return d.color || color(d, i) });
+ //d3.transition(path)
+ path
+ .attr('d', function(d,i) { return area(d.values,i) })
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseover.area', function(e) {
+ g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', true);
+ });
+ scatter.dispatch.on('elementMouseout.area', function(e) {
+ g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', false);
+ });
+
+ //============================================================
+
+ });
+
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementClick.area', function(e) {
+ dispatch.areaClick(e);
+ })
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Global getters and setters
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+
+ d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius');
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ }
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.offset = function(_) {
+ if (!arguments.length) return offset;
+ offset = _;
+ return chart;
+ };
+
+ chart.order = function(_) {
+ if (!arguments.length) return order;
+ order = _;
+ return chart;
+ };
+
+ //shortcut for offset + order
+ chart.style = function(_) {
+ if (!arguments.length) return style;
+ style = _;
+
+ switch (style) {
+ case 'stack':
+ chart.offset('zero');
+ chart.order('default');
+ break;
+ case 'stream':
+ chart.offset('wiggle');
+ chart.order('inside-out');
+ break;
+ case 'stream-center':
+ chart.offset('silhouette');
+ chart.order('inside-out');
+ break;
+ case 'expand':
+ chart.offset('expand');
+ chart.order('default');
+ break;
+ }
+
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ interpolate = _;
+ return interpolate;
+
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
+nv.models.stackedAreaChart = function() {
+
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var stacked = nv.models.stackedArea()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 25, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor() // a function that takes in d, i and returns color
+ , showControls = true
+ , showLegend = true
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' on ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , yAxisTickFormat = d3.format(',.2f')
+ , yAxisTooltipFormat = d3.format(',.3f')
+ , state = { style: stacked.style() }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient('left')
+ ;
+ stacked.scatter
+ .pointActive(function(d) {
+ //console.log(stacked.y()(d), !!Math.round(stacked.y()(d) * 100));
+ return !!Math.round(stacked.y()(d) * 100);
+ })
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(stacked.x()(e.point, e.pointIndex)),
+ //y = yAxis.tickFormat()(stacked.y()(e.point, e.pointIndex)),
+ y = yAxisTooltipFormat(stacked.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = stacked.xScale();
+ y = stacked.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-stackedAreaChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedAreaChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-stackedWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend
+ .width( availableWidth - controlWidth );
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + controlWidth + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Stacked', disabled: stacked.offset() != 'zero' },
+ { key: 'Stream', disabled: stacked.offset() != 'wiggle' },
+ { key: 'Expanded', disabled: stacked.offset() != 'expand' }
+ ];
+
+ controls
+ .width( controlWidth )
+ .color(['#444', '#444', '#444']);
+
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .call(controls);
+
+
+ if ( margin.top != Math.max(controls.height(), legend.height()) ) {
+ margin.top = Math.max(controls.height(), legend.height());
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+
+ g.select('.nv-controlsWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ stacked
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var stackedWrap = g.select('.nv-stackedWrap')
+ .datum(data);
+ //d3.transition(stackedWrap).call(stacked);
+ stackedWrap.call(stacked);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize( -availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+ //d3.transition(g.select('.nv-x.nv-axis'))
+ g.select('.nv-x.nv-axis')
+ .transition().duration(0)
+ .call(xAxis);
+
+ yAxis
+ .scale(y)
+ .ticks(stacked.offset() == 'wiggle' ? 0 : availableHeight / 36)
+ .tickSize(-availableWidth, 0)
+ .setTickFormat(stacked.offset() == 'expand' ? d3.format('%') : yAxisTickFormat);
+
+ //d3.transition(g.select('.nv-y.nv-axis'))
+ g.select('.nv-y.nv-axis')
+ .transition().duration(0)
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ stacked.dispatch.on('areaClick.toggle', function(e) {
+ if (data.filter(function(d) { return !d.disabled }).length === 1)
+ data = data.map(function(d) {
+ d.disabled = false;
+ return d
+ });
+ else
+ data = data.map(function(d,i) {
+ d.disabled = (i != e.seriesIndex);
+ return d
+ });
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ //selection.transition().call(chart);
+ chart.update();
+ });
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ //selection.transition().call(chart);
+ chart.update();
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Stacked':
+ stacked.style('stack');
+ break;
+ case 'Stream':
+ stacked.style('stream');
+ break;
+ case 'Expanded':
+ stacked.style('expand');
+ break;
+ }
+
+ state.style = stacked.style();
+ dispatch.stateChange(state);
+
+ //selection.transition().call(chart);
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.style !== 'undefined') {
+ stacked.style(e.style);
+ }
+
+ chart.update();
+ });
+
+ });
+
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ stacked.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ /*
+ if (!Math.round(stacked.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+ */
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stacked.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.stacked = stacked;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, stacked, 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'sizeDomain', 'interactive', 'offset', 'order', 'style', 'clipEdge', 'forceX', 'forceY', 'forceSize', 'interpolate');
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return getWidth;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return getHeight;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ stacked.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.yAxisTooltipFormat = function(_) {
+ if (!arguments.length) return yAxisTooltipFormat;
+ yAxisTooltipFormat = _;
+ return chart;
+ };
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ yAxis.setTickFormat = yAxis.tickFormat;
+
+ yAxis.tickFormat = function(_) {
+ if (!arguments.length) return yAxisTickFormat;
+ yAxisTickFormat = _;
+ return yAxis;
+ };
+
+ //============================================================
+
+ return chart;
+}
+})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.min.js
new file mode 100644
index 00000000..892379c4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.min.js
@@ -0,0 +1 @@
+(function(){function t(e,t){return(new Date(t,e+1,0)).getDate()}function n(e,t,n){return function(r,i,s){var o=e(r),u=[];if(o<r)t(o);if(s>1){while(o<i){var a=new Date(+o);if(n(a)%s===0)u.push(a);t(o)}}else{while(o<i){u.push(new Date(+o));t(o)}}return u}}var e=window.nv||{};e.version="1.1.13b";e.dev=true;window.nv=e;e.tooltip={};e.utils=e.utils||{};e.models={};e.charts={};e.graphs=[];e.logs={};e.dispatch=d3.dispatch("render_start","render_end");if(e.dev){e.dispatch.on("render_start",function(t){e.logs.startTime=+(new Date)});e.dispatch.on("render_end",function(t){e.logs.endTime=+(new Date);e.logs.totalTime=e.logs.endTime-e.logs.startTime;e.log("total",e.logs.totalTime)})}e.log=function(){if(e.dev&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(e.dev&&typeof console.log=="function"&&Function.prototype.bind){var t=Function.prototype.bind.call(console.log,console);t.apply(console,arguments)}return arguments[arguments.length-1]};e.render=function(n){n=n||1;e.render.active=true;e.dispatch.render_start();setTimeout(function(){var t,r;for(var i=0;i<n&&(r=e.render.queue[i]);i++){t=r.generate();if(typeof r.callback==typeof Function)r.callback(t);e.graphs.push(t)}e.render.queue.splice(0,i);if(e.render.queue.length)setTimeout(arguments.callee,0);else{e.render.active=false;e.dispatch.render_end()}},0)};e.render.active=false;e.render.queue=[];e.addGraph=function(t){if(typeof arguments[0]===typeof Function)t={generate:arguments[0],callback:arguments[1]};e.render.queue.push(t);if(!e.render.active)e.render()};e.identity=function(e){return e};e.strip=function(e){return e.replace(/(\s|&)/g,"")};d3.time.monthEnd=function(e){return new Date(e.getFullYear(),e.getMonth(),0)};d3.time.monthEnds=n(d3.time.monthEnd,function(e){e.setUTCDate(e.getUTCDate()+1);e.setDate(t(e.getMonth()+1,e.getFullYear()))},function(e){return e.getMonth()});e.interactiveGuideline=function(){"use strict";function c(o){o.each(function(o){function g(){var e=d3.mouse(this);var n=e[0];var r=e[1];var o=true;var a=false;if(l){n=d3.event.offsetX;r=d3.event.offsetY;if(d3.event.target.tagName!=="svg")o=false;if(d3.event.target.className.baseVal.match("nv-legend"))a=true}if(o){n-=i.left;r-=i.top}if(n<0||r<0||n>p||r>d||d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined||a){if(l){if(d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined&&d3.event.relatedTarget.className.match(t.nvPointerEventsClass)){return}}u.elementMouseout({mouseX:n,mouseY:r});c.renderGuideLine(null);return}var f=s.invert(n);u.elementMousemove({mouseX:n,mouseY:r,pointXValue:f});if(d3.event.type==="dblclick"){u.elementDblclick({mouseX:n,mouseY:r,pointXValue:f})}}var h=d3.select(this);var p=n||960,d=r||400;var v=h.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([o]);var m=v.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");m.append("g").attr("class","nv-interactiveGuideLine");if(!f){return}f.on("mousemove",g,true).on("mouseout",g,true).on("dblclick",g);c.renderGuideLine=function(t){if(!a)return;var n=v.select(".nv-interactiveGuideLine").selectAll("line").data(t!=null?[e.utils.NaNtoZero(t)]:[],String);n.enter().append("line").attr("class","nv-guideline").attr("x1",function(e){return e}).attr("x2",function(e){return e}).attr("y1",d).attr("y2",0);n.exit().remove()}})}var t=e.models.tooltip();var n=null,r=null,i={left:0,top:0},s=d3.scale.linear(),o=d3.scale.linear(),u=d3.dispatch("elementMousemove","elementMouseout","elementDblclick"),a=true,f=null;var l=navigator.userAgent.indexOf("MSIE")!==-1;c.dispatch=u;c.tooltip=t;c.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.left=typeof e.left!="undefined"?e.left:i.left;return c};c.width=function(e){if(!arguments.length)return n;n=e;return c};c.height=function(e){if(!arguments.length)return r;r=e;return c};c.xScale=function(e){if(!arguments.length)return s;s=e;return c};c.showGuideLine=function(e){if(!arguments.length)return a;a=e;return c};c.svgContainer=function(e){if(!arguments.length)return f;f=e;return c};return c};e.interactiveBisect=function(e,t,n){"use strict";if(!e instanceof Array)return null;if(typeof n!=="function")n=function(e,t){return e.x};var r=d3.bisector(n).left;var i=d3.max([0,r(e,t)-1]);var s=n(e[i],i);if(typeof s==="undefined")s=i;if(s===t)return i;var o=d3.min([i+1,e.length-1]);var u=n(e[o],o);if(typeof u==="undefined")u=o;if(Math.abs(u-t)>=Math.abs(s-t))return i;else return o};e.nearestValueIndex=function(e,t,n){"use strict";var r=Infinity,i=null;e.forEach(function(e,s){var o=Math.abs(t-e);if(o<=r&&o<n){r=o;i=s}});return i};(function(){"use strict";window.nv.tooltip={};window.nv.models.tooltip=function(){function y(){if(a){var e=d3.select(a);if(e.node().tagName!=="svg"){e=e.select("svg")}var t=e.node()?e.attr("viewBox"):null;if(t){t=t.split(" ");var n=parseInt(e.style("width"))/t[2];l.left=l.left*n;l.top=l.top*n}}}function b(e){var t;if(a)t=d3.select(a);else t=d3.select("body");var n=t.select(".nvtooltip");if(n.node()===null){n=t.append("div").attr("class","nvtooltip "+(u?u:"xy-tooltip")).attr("id",h)}n.node().innerHTML=e;n.style("top",0).style("left",0).style("opacity",0);n.selectAll("div, table, td, tr").classed(p,true);n.classed(p,true);return n.node()}function w(){if(!c)return;if(!g(n))return;y();var t=l.left;var u=o!=null?o:l.top;var h=b(m(n));f=h;if(a){var p=a.getElementsByTagName("svg")[0];var d=p?p.getBoundingClientRect():a.getBoundingClientRect();var v={left:0,top:0};if(p){var E=p.getBoundingClientRect();var S=a.getBoundingClientRect();var x=E.top;if(x<0){var T=a.getBoundingClientRect();x=Math.abs(x)>T.height?0:x}v.top=Math.abs(x-S.top);v.left=Math.abs(E.left-S.left)}t+=a.offsetLeft+v.left-2*a.scrollLeft;u+=a.offsetTop+v.top-2*a.scrollTop}if(s&&s>0){u=Math.floor(u/s)*s}e.tooltip.calcTooltipPosition([t,u],r,i,h);return w}var t=null,n=null,r="w",i=50,s=25,o=null,u=null,a=null,f=null,l={left:null,top:null},c=true,h="nvtooltip-"+Math.floor(Math.random()*1e5);var p="nv-pointer-events-none";var d=function(e,t){return e};var v=function(e){return e};var m=function(e){if(t!=null)return t;if(e==null)return"";var n=d3.select(document.createElement("table"));var r=n.selectAll("thead").data([e]).enter().append("thead");r.append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",true).html(v(e.value));var i=n.selectAll("tbody").data([e]).enter().append("tbody");var s=i.selectAll("tr").data(function(e){return e.series}).enter().append("tr").classed("highlight",function(e){return e.highlight});s.append("td").classed("legend-color-guide",true).append("div").style("background-color",function(e){return e.color});s.append("td").classed("key",true).html(function(e){return e.key});s.append("td").classed("value",true).html(function(e,t){return d(e.value,t)});s.selectAll("td").each(function(e){if(e.highlight){var t=d3.scale.linear().domain([0,1]).range(["#fff",e.color]);var n=.6;d3.select(this).style("border-bottom-color",t(n)).style("border-top-color",t(n))}});var o=n.node().outerHTML;if(e.footer!==undefined)o+="<div class='footer'>"+e.footer+"</div>";return o};var g=function(e){if(e&&e.series&&e.series.length>0)return true;return false};w.nvPointerEventsClass=p;w.content=function(e){if(!arguments.length)return t;t=e;return w};w.tooltipElem=function(){return f};w.contentGenerator=function(e){if(!arguments.length)return m;if(typeof e==="function"){m=e}return w};w.data=function(e){if(!arguments.length)return n;n=e;return w};w.gravity=function(e){if(!arguments.length)return r;r=e;return w};w.distance=function(e){if(!arguments.length)return i;i=e;return w};w.snapDistance=function(e){if(!arguments.length)return s;s=e;return w};w.classes=function(e){if(!arguments.length)return u;u=e;return w};w.chartContainer=function(e){if(!arguments.length)return a;a=e;return w};w.position=function(e){if(!arguments.length)return l;l.left=typeof e.left!=="undefined"?e.left:l.left;l.top=typeof e.top!=="undefined"?e.top:l.top;return w};w.fixedTop=function(e){if(!arguments.length)return o;o=e;return w};w.enabled=function(e){if(!arguments.length)return c;c=e;return w};w.valueFormatter=function(e){if(!arguments.length)return d;if(typeof e==="function"){d=e}return w};w.headerFormatter=function(e){if(!arguments.length)return v;if(typeof e==="function"){v=e}return w};w.id=function(){return h};return w};e.tooltip.show=function(t,n,r,i,s,o){var u=document.createElement("div");u.className="nvtooltip "+(o?o:"xy-tooltip");var a=s;if(!s||s.tagName.match(/g|svg/i)){a=document.getElementsByTagName("body")[0]}u.style.left=0;u.style.top=0;u.style.opacity=0;u.innerHTML=n;a.appendChild(u);if(s){t[0]=t[0]-s.scrollLeft;t[1]=t[1]-s.scrollTop}e.tooltip.calcTooltipPosition(t,r,i,u)};e.tooltip.findFirstNonSVGParent=function(e){while(e.tagName.match(/^g|svg$/i)!==null){e=e.parentNode}return e};e.tooltip.findTotalOffsetTop=function(e,t){var n=t;do{if(!isNaN(e.offsetTop)){n+=e.offsetTop}}while(e=e.offsetParent);return n};e.tooltip.findTotalOffsetLeft=function(e,t){var n=t;do{if(!isNaN(e.offsetLeft)){n+=e.offsetLeft}}while(e=e.offsetParent);return n};e.tooltip.calcTooltipPosition=function(t,n,r,i){var s=parseInt(i.offsetHeight),o=parseInt(i.offsetWidth),u=e.utils.windowSize().width,a=e.utils.windowSize().height,f=window.pageYOffset,l=window.pageXOffset,c,h;a=window.innerWidth>=document.body.scrollWidth?a:a-16;u=window.innerHeight>=document.body.scrollHeight?u:u-16;n=n||"s";r=r||20;var p=function(t){return e.tooltip.findTotalOffsetTop(t,h)};var d=function(t){return e.tooltip.findTotalOffsetLeft(t,c)};switch(n){case"e":c=t[0]-o-r;h=t[1]-s/2;var v=d(i);var m=p(i);if(v<l)c=t[0]+r>l?t[0]+r:l-v+c;if(m<f)h=f-m+h;if(m+s>f+a)h=f+a-m+h-s;break;case"w":c=t[0]+r;h=t[1]-s/2;var v=d(i);var m=p(i);if(v+o>u)c=t[0]-o-r;if(m<f)h=f+5;if(m+s>f+a)h=f+a-m+h-s;break;case"n":c=t[0]-o/2-5;h=t[1]+r;var v=d(i);var m=p(i);if(v<l)c=l+5;if(v+o>u)c=c-o/2+5;if(m+s>f+a)h=f+a-m+h-s;break;case"s":c=t[0]-o/2;h=t[1]-s-r;var v=d(i);var m=p(i);if(v<l)c=l+5;if(v+o>u)c=c-o/2+5;if(f>m)h=f;break;case"none":c=t[0];h=t[1]-r;var v=d(i);var m=p(i);break}i.style.left=c+"px";i.style.top=h+"px";i.style.opacity=1;i.style.position="absolute";return i};e.tooltip.cleanup=function(){var e=document.getElementsByClassName("nvtooltip");var t=[];while(e.length){t.push(e[0]);e[0].style.transitionDelay="0 !important";e[0].style.opacity=0;e[0].className="nvtooltip-pending-removal"}setTimeout(function(){while(t.length){var e=t.pop();e.parentNode.removeChild(e)}},500)}})();e.utils.windowSize=function(){var e={width:640,height:480};if(document.body&&document.body.offsetWidth){e.width=document.body.offsetWidth;e.height=document.body.offsetHeight}if(document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth){e.width=document.documentElement.offsetWidth;e.height=document.documentElement.offsetHeight}if(window.innerWidth&&window.innerHeight){e.width=window.innerWidth;e.height=window.innerHeight}return e};e.utils.windowResize=function(e){if(e===undefined)return;var t=window.onresize;window.onresize=function(n){if(typeof t=="function")t(n);e(n)}};e.utils.getColor=function(t){if(!arguments.length)return e.utils.defaultColor();if(Object.prototype.toString.call(t)==="[object Array]")return function(e,n){return e.color||t[n%t.length]};else return t};e.utils.defaultColor=function(){var e=d3.scale.category20().range();return function(t,n){return t.color||e[n%e.length]}};e.utils.customTheme=function(e,t,n){t=t||function(e){return e.key};n=n||d3.scale.category20().range();var r=n.length;return function(i,s){var o=t(i);if(!r)r=n.length;if(typeof e[o]!=="undefined")return typeof e[o]==="function"?e[o]():e[o];else return n[--r]}};e.utils.pjax=function(t,n){function r(r){d3.html(r,function(r){var i=d3.select(n).node();i.parentNode.replaceChild(d3.select(r).select(n).node(),i);e.utils.pjax(t,n)})}d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href);r(this.href);d3.event.preventDefault()});d3.select(window).on("popstate",function(){if(d3.event.state)r(d3.event.state)})};e.utils.calcApproxTextWidth=function(e){if(e instanceof d3.selection){var t=parseInt(e.style("font-size").replace("px",""));var n=e.text().length;return n*t*.5}return 0};e.utils.NaNtoZero=function(e){if(typeof e!=="number"||isNaN(e)||e===null||e===Infinity)return 0;return e};e.utils.optionsFunc=function(e){if(e){d3.map(e).forEach(function(e,t){if(typeof this[e]==="function"){this[e](t)}}.bind(this))}return this};e.models.axis=function(){"use strict";function g(e){e.each(function(e){var i=d3.select(this);var g=i.selectAll("g.nv-wrap.nv-axis").data([e]);var y=g.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");var b=y.append("g");var w=g.select("g");if(p!==null)t.ticks(p);else if(t.orient()=="top"||t.orient()=="bottom")t.ticks(Math.abs(s.range()[1]-s.range()[0])/100);w.transition().call(t);m=m||t.scale();var E=t.tickFormat();if(E==null){E=m.tickFormat()}var S=w.selectAll("text.nv-axislabel").data([o||null]);S.exit().remove();switch(t.orient()){case"top":S.enter().append("text").attr("class","nv-axislabel");var x=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);S.attr("text-anchor","middle").attr("y",0).attr("x",x/2);if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+s(e)+",0)"}).select("text").attr("dy","0em").attr("y",-t.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+s.range()[t]+",0)"})}break;case"bottom":var N=36;var C=30;var k=w.selectAll("g").select("text");if(f%360){k.each(function(e,t){var n=this.getBBox().width;if(n>C)C=n});var L=Math.abs(Math.sin(f*Math.PI/180));var N=(L?L*C:C)+30;k.attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f%360>0?"start":"end")}S.enter().append("text").attr("class","nv-axislabel");var x=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);S.attr("text-anchor","middle").attr("y",N).attr("x",x/2);if(u){var T=g.selectAll("g.nv-axisMaxMin").data([s.domain()[0],s.domain()[s.domain().length-1]]);T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",t.tickPadding()).attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f?f%360>0?"start":"end":"middle").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"})}if(c)k.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",l?"middle":"begin").attr("transform",l?"rotate(90)":"").attr("y",l?-Math.max(n.right,r)+12:-10).attr("x",l?s.range()[0]/2:t.tickPadding());if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+s(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",t.tickPadding()).style("text-anchor","start").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",l?"middle":"end").attr("transform",l?"rotate(-90)":"").attr("y",l?-Math.max(n.left,r)+v:-10).attr("x",l?-s.range()[0]/2:-t.tickPadding());if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+m(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-t.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break}S.text(function(e){return e});if(u&&(t.orient()==="left"||t.orient()==="right")){w.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);var n;if(d){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(s(e)<s.range()[1]+10||s(e)>s.range()[0]-10){if(e>1e-10||e<-1e-10)d3.select(this).attr("opacity",0);d3.select(this).select("text").attr("opacity",0)}});if(s.domain()[0]==s.domain()[1]&&s.domain()[0]==0)g.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return!t?1:0})}if(u&&(t.orient()==="top"||t.orient()==="bottom")){var A=[];g.selectAll("g.nv-axisMaxMin").each(function(e,t){try{if(t)A.push(s(e)-this.getBBox().width-4);else A.push(s(e)+this.getBBox().width+4)}catch(n){if(t)A.push(s(e)-4);else A.push(s(e)+4)}});w.selectAll("g").each(function(e,t){var n;if(d){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(s(e)<A[0]||s(e)>A[1]){if(e>1e-10||e<-1e-10)d3.select(this).remove();else d3.select(this).select("text").remove()}})}if(a)w.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",true);m=s.copy()});return g}var t=d3.svg.axis();var n={top:0,right:0,bottom:0,left:0},r=75,i=60,s=d3.scale.linear(),o=null,u=true,a=true,f=0,l=true,c=false,h=false,p=null,d=false,v=12;t.scale(s).orient("bottom").tickFormat(function(e){return e});var m;g.axis=t;d3.rebind(g,t,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat");d3.rebind(g,s,"domain","range","rangeBand","rangeBands");g.options=e.utils.optionsFunc.bind(g);g.margin=function(e){if(!arguments.length)return n;n.top=typeof e.top!="undefined"?e.top:n.top;n.right=typeof e.right!="undefined"?e.right:n.right;n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom;n.left=typeof e.left!="undefined"?e.left:n.left;return g};g.width=function(e){if(!arguments.length)return r;r=e;return g};g.ticks=function(e){if(!arguments.length)return p;p=e;return g};g.height=function(e){if(!arguments.length)return i;i=e;return g};g.axisLabel=function(e){if(!arguments.length)return o;o=e;return g};g.showMaxMin=function(e){if(!arguments.length)return u;u=e;return g};g.logScale=function(e){if(!arguments.length)return d;d=e;return g};g.highlightZero=function(e){if(!arguments.length)return a;a=e;return g};g.scale=function(e){if(!arguments.length)return s;s=e;t.scale(s);h=typeof s.rangeBands==="function";d3.rebind(g,s,"domain","range","rangeBand","rangeBands");return g};g.rotateYLabel=function(e){if(!arguments.length)return l;l=e;return g};g.rotateLabels=function(e){if(!arguments.length)return f;f=e;return g};g.staggerLabels=function(e){if(!arguments.length)return c;c=e;return g};g.axisLabelDistance=function(e){if(!arguments.length)return v;v=e;return g};return g};e.models.bullet=function(){"use strict";function m(e){e.each(function(e,n){var p=c-t.left-t.right,m=h-t.top-t.bottom,g=d3.select(this);var y=i.call(this,e,n).slice().sort(d3.descending),b=s.call(this,e,n).slice().sort(d3.descending),w=o.call(this,e,n).slice().sort(d3.descending),E=u.call(this,e,n).slice(),S=a.call(this,e,n).slice(),x=f.call(this,e,n).slice();var T=d3.scale.linear().domain(d3.extent(d3.merge([l,y]))).range(r?[p,0]:[0,p]);var N=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(T.range());this.__chart__=T;var C=d3.min(y),k=d3.max(y),L=y[1];var A=g.selectAll("g.nv-wrap.nv-bullet").data([e]);var O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet");var M=O.append("g");var _=A.select("g");M.append("rect").attr("class","nv-range nv-rangeMax");M.append("rect").attr("class","nv-range nv-rangeAvg");M.append("rect").attr("class","nv-range nv-rangeMin");M.append("rect").attr("class","nv-measure");M.append("path").attr("class","nv-markerTriangle");A.attr("transform","translate("+t.left+","+t.top+")");var D=function(e){return Math.abs(N(e)-N(0))},P=function(e){return Math.abs(T(e)-T(0))};var H=function(e){return e<0?N(e):N(0)},B=function(e){return e<0?T(e):T(0)};_.select("rect.nv-rangeMax").attr("height",m).attr("width",P(k>0?k:C)).attr("x",B(k>0?k:C)).datum(k>0?k:C);_.select("rect.nv-rangeAvg").attr("height",m).attr("width",P(L)).attr("x",B(L)).datum(L);_.select("rect.nv-rangeMin").attr("height",m).attr("width",P(k)).attr("x",B(k)).attr("width",P(k>0?C:k)).attr("x",B(k>0?C:k)).datum(k>0?C:k);_.select("rect.nv-measure").style("fill",d).attr("height",m/3).attr("y",m/3).attr("width",w<0?T(0)-T(w[0]):T(w[0])-T(0)).attr("x",B(w)).on("mouseover",function(){v.elementMouseover({value:w[0],label:x[0]||"Current",pos:[T(w[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:w[0],label:x[0]||"Current"})});var j=m/6;if(b[0]){_.selectAll("path.nv-markerTriangle").attr("transform",function(e){return"translate("+T(b[0])+","+m/2+")"}).attr("d","M0,"+j+"L"+j+","+ -j+" "+ -j+","+ -j+"Z").on("mouseover",function(){v.elementMouseover({value:b[0],label:S[0]||"Previous",pos:[T(b[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:b[0],label:S[0]||"Previous"})})}else{_.selectAll("path.nv-markerTriangle").remove()}A.selectAll(".nv-range").on("mouseover",function(e,t){var n=E[t]||(!t?"Maximum":t==1?"Mean":"Minimum");v.elementMouseover({value:e,label:n,pos:[T(e),m/2]})}).on("mouseout",function(e,t){var n=E[t]||(!t?"Maximum":t==1?"Mean":"Minimum");v.elementMouseout({value:e,label:n})})});return m}var t={top:0,right:0,bottom:0,left:0},n="left",r=false,i=function(e){return e.ranges},s=function(e){return e.markers},o=function(e){return e.measures},u=function(e){return e.rangeLabels?e.rangeLabels:[]},a=function(e){return e.markerLabels?e.markerLabels:[]},f=function(e){return e.measureLabels?e.measureLabels:[]},l=[0],c=380,h=30,p=null,d=e.utils.getColor(["#1f77b4"]),v=d3.dispatch("elementMouseover","elementMouseout");m.dispatch=v;m.options=e.utils.optionsFunc.bind(m);m.orient=function(e){if(!arguments.length)return n;n=e;r=n=="right"||n=="bottom";return m};m.ranges=function(e){if(!arguments.length)return i;i=e;return m};m.markers=function(e){if(!arguments.length)return s;s=e;return m};m.measures=function(e){if(!arguments.length)return o;o=e;return m};m.forceX=function(e){if(!arguments.length)return l;l=e;return m};m.width=function(e){if(!arguments.length)return c;c=e;return m};m.height=function(e){if(!arguments.length)return h;h=e;return m};m.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return m};m.tickFormat=function(e){if(!arguments.length)return p;p=e;return m};m.color=function(t){if(!arguments.length)return d;d=e.utils.getColor(t);return m};return m};e.models.bulletChart=function(){"use strict";function m(e){e.each(function(n,h){var g=d3.select(this);var y=(a||parseInt(g.style("width"))||960)-i.left-i.right,b=f-i.top-i.bottom,w=this;m.update=function(){m(e)};m.container=this;if(!n||!s.call(this,n,h)){var E=g.selectAll(".nv-noData").data([p]);E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");E.attr("x",i.left+y/2).attr("y",18+i.top+b/2).text(function(e){return e});return m}else{g.selectAll(".nv-noData").remove()}var S=s.call(this,n,h).slice().sort(d3.descending),x=o.call(this,n,h).slice().sort(d3.descending),T=u.call(this,n,h).slice().sort(d3.descending);var N=g.selectAll("g.nv-wrap.nv-bulletChart").data([n]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart");var k=C.append("g");var L=N.select("g");k.append("g").attr("class","nv-bulletWrap");k.append("g").attr("class","nv-titles");N.attr("transform","translate("+i.left+","+i.top+")");var A=d3.scale.linear().domain([0,Math.max(S[0],x[0],T[0])]).range(r?[y,0]:[0,y]);var O=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(A.range());this.__chart__=A;var M=function(e){return Math.abs(O(e)-O(0))},_=function(e){return Math.abs(A(e)-A(0))};var D=k.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(f-i.top-i.bottom)/2+")");D.append("text").attr("class","nv-title").text(function(e){return e.title});D.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(e){return e.subtitle});t.width(y).height(b);var P=L.select(".nv-bulletWrap");d3.transition(P).call(t);var H=l||A.tickFormat(y/100);var B=L.selectAll("g.nv-tick").data(A.ticks(y/50),function(e){return this.textContent||H(e)});var j=B.enter().append("g").attr("class","nv-tick").attr("transform",function(e){return"translate("+O(e)+",0)"}).style("opacity",1e-6);j.append("line").attr("y1",b).attr("y2",b*7/6);j.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",b*7/6).text(H);var F=d3.transition(B).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1);F.select("line").attr("y1",b).attr("y2",b*7/6);F.select("text").attr("y",b*7/6);d3.transition(B.exit()).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1e-6).remove();d.on("tooltipShow",function(e){e.key=n.title;if(c)v(e,w.parentNode)})});d3.timer.flush();return m}var t=e.models.bullet();var n="left",r=false,i={top:5,right:40,bottom:20,left:120},s=function(e){return e.ranges},o=function(e){return e.markers},u=function(e){return e.measures},a=null,f=55,l=null,c=true,h=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},p="No Data Available.",d=d3.dispatch("tooltipShow","tooltipHide");var v=function(t,n){var r=t.pos[0]+(n.offsetLeft||0)+i.left,s=t.pos[1]+(n.offsetTop||0)+i.top,o=h(t.key,t.label,t.value,t,m);e.tooltip.show([r,s],o,t.value<0?"e":"w",null,n)};t.dispatch.on("elementMouseover.tooltip",function(e){d.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){d.tooltipHide(e)});d.on("tooltipHide",function(){if(c)e.tooltip.cleanup()});m.dispatch=d;m.bullet=t;d3.rebind(m,t,"color");m.options=e.utils.optionsFunc.bind(m);m.orient=function(e){if(!arguments.length)return n;n=e;r=n=="right"||n=="bottom";return m};m.ranges=function(e){if(!arguments.length)return s;s=e;return m};m.markers=function(e){if(!arguments.length)return o;o=e;return m};m.measures=function(e){if(!arguments.length)return u;u=e;return m};m.width=function(e){if(!arguments.length)return a;a=e;return m};m.height=function(e){if(!arguments.length)return f;f=e;return m};m.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.right=typeof e.right!="undefined"?e.right:i.right;i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom;i.left=typeof e.left!="undefined"?e.left:i.left;return m};m.tickFormat=function(e){if(!arguments.length)return l;l=e;return m};m.tooltips=function(e){if(!arguments.length)return c;c=e;return m};m.tooltipContent=function(e){if(!arguments.length)return h;h=e;return m};m.noData=function(e){if(!arguments.length)return p;p=e;return m};return m};e.models.cumulativeLineChart=function(){"use strict";function _(b){b.each(function(b){function q(e,t){d3.select(_.container).style("cursor","ew-resize")}function R(e,t){O.x=d3.event.x;O.i=Math.round(A.invert(O.x));rt()}function U(e,t){d3.select(_.container).style("cursor","auto");x.index=O.i;k.stateChange(x)}function rt(){nt.data([O]);var e=_.transitionDuration();_.transitionDuration(0);_.update();_.transitionDuration(e)}var P=d3.select(this).classed("nv-chart-"+S,true),H=this;var B=(f||parseInt(P.style("width"))||960)-u.left-u.right,j=(l||parseInt(P.style("height"))||400)-u.top-u.bottom;_.update=function(){P.transition().duration(L).call(_)};_.container=this;x.disabled=b.map(function(e){return!!e.disabled});if(!T){var F;T={};for(F in x){if(x[F]instanceof Array)T[F]=x[F].slice(0);else T[F]=x[F]}}var I=d3.behavior.drag().on("dragstart",q).on("drag",R).on("dragend",U);if(!b||!b.length||!b.filter(function(e){return e.values.length}).length){var z=P.selectAll(".nv-noData").data([N]);z.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");z.attr("x",u.left+B/2).attr("y",u.top+j/2).text(function(e){return e});return _}else{P.selectAll(".nv-noData").remove()}w=t.xScale();E=t.yScale();if(!y){var W=b.filter(function(e){return!e.disabled}).map(function(e,n){var r=d3.extent(e.values,t.y());if(r[0]<-.95)r[0]=-.95;return[(r[0]-r[1])/(1+r[1]),(r[1]-r[0])/(1+r[0])]});var X=[d3.min(W,function(e){return e[0]}),d3.max(W,function(e){return e[1]})];t.yDomain(X)}else{t.yDomain(null)}A.domain([0,b[0].values.length-1]).range([0,B]).clamp(true);var b=D(O.i,b);var V=g?"none":"all";var $=P.selectAll("g.nv-wrap.nv-cumulativeLine").data([b]);var J=$.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g");var K=$.select("g");J.append("g").attr("class","nv-interactive");J.append("g").attr("class","nv-x nv-axis").style("pointer-events","none");J.append("g").attr("class","nv-y nv-axis");J.append("g").attr("class","nv-background");J.append("g").attr("class","nv-linesWrap").style("pointer-events",V);J.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none");J.append("g").attr("class","nv-legendWrap");J.append("g").attr("class","nv-controlsWrap");if(c){i.width(B);K.select(".nv-legendWrap").datum(b).call(i);if(u.top!=i.height()){u.top=i.height();j=(l||parseInt(P.style("height"))||400)-u.top-u.bottom}K.select(".nv-legendWrap").attr("transform","translate(0,"+ -u.top+")")}if(m){var Q=[{key:"Re-scale y-axis",disabled:!y}];s.width(140).color(["#444","#444","#444"]);K.select(".nv-controlsWrap").datum(Q).attr("transform","translate(0,"+ -u.top+")").call(s)}$.attr("transform","translate("+u.left+","+u.top+")");if(d){K.select(".nv-y.nv-axis").attr("transform","translate("+B+",0)")}var G=b.filter(function(e){return e.tempDisabled});$.select(".tempDisabled").remove();if(G.length){$.append("text").attr("class","tempDisabled").attr("x",B/2).attr("y","-.71em").style("text-anchor","end").text(G.map(function(e){return e.key}).join(", ")+" values cannot be calculated for this time period.")}if(g){o.width(B).height(j).margin({left:u.left,top:u.top}).svgContainer(P).xScale(w);$.select(".nv-interactive").call(o)}J.select(".nv-background").append("rect");K.select(".nv-background rect").attr("width",B).attr("height",j);t.y(function(e){return e.display.y}).width(B).height(j).color(b.map(function(e,t){return e.color||a(e,t)}).filter(function(e,t){return!b[t].disabled&&!b[t].tempDisabled}));var Y=K.select(".nv-linesWrap").datum(b.filter(function(e){return!e.disabled&&!e.tempDisabled}));Y.call(t);b.forEach(function(e,t){e.seriesIndex=t});var Z=b.filter(function(e){return!e.disabled&&!!C(e)});var et=K.select(".nv-avgLinesWrap").selectAll("line").data(Z,function(e){return e.key});var tt=function(e){var t=E(C(e));if(t<0)return 0;if(t>j)return j;return t};et.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(e,n){return t.color()(e,e.seriesIndex)}).attr("x1",0).attr("x2",B).attr("y1",tt).attr("y2",tt);et.style("stroke-opacity",function(e){var t=E(C(e));if(t<0||t>j)return 0;return 1}).attr("x1",0).attr("x2",B).attr("y1",tt).attr("y2",tt);et.exit().remove();var nt=Y.selectAll(".nv-indexLine").data([O]);nt.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(I);nt.attr("transform",function(e){return"translate("+A(e.i)+",0)"}).attr("height",j);if(h){n.scale(w).ticks(Math.min(b[0].values.length,B/70)).tickSize(-j,0);K.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")");d3.transition(K.select(".nv-x.nv-axis")).call(n)}if(p){r.scale(E).ticks(j/36).tickSize(-B,0);d3.transition(K.select(".nv-y.nv-axis")).call(r)}K.select(".nv-background rect").on("click",function(){O.x=d3.mouse(this)[0];O.i=Math.round(A.invert(O.x));x.index=O.i;k.stateChange(x);rt()});t.dispatch.on("elementClick",function(e){O.i=e.pointIndex;O.x=A(O.i);x.index=O.i;k.stateChange(x);rt()});s.dispatch.on("legendClick",function(e,t){e.disabled=!e.disabled;y=!e.disabled;x.rescaleY=y;k.stateChange(x);_.update()});i.dispatch.on("stateChange",function(e){x.disabled=e.disabled;k.stateChange(x);_.update()});o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,f,l,c=[];b.filter(function(e,t){e.seriesIndex=t;return!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,_.x());t.highlightPoint(r,f,true);var o=n.values[f];if(typeof o==="undefined")return;if(typeof s==="undefined")s=o;if(typeof l==="undefined")l=_.xScale()(_.x()(o,f));c.push({key:n.key,value:_.y()(o,f),color:a(n,n.seriesIndex)})});if(c.length>2){var h=_.yScale().invert(i.mouseY);var p=Math.abs(_.yScale().domain()[0]-_.yScale().domain()[1]);var d=.03*p;var m=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);if(m!==null)c[m].highlight=true}var g=n.tickFormat()(_.x()(s,f),f);o.tooltip.position({left:l+u.left,top:i.mouseY+u.top}).chartContainer(H.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:g,series:c})();o.renderGuideLine(l)});o.dispatch.on("elementMouseout",function(e){k.tooltipHide();t.clearHighlights()});k.on("tooltipShow",function(e){if(v)M(e,H.parentNode)});k.on("changeState",function(e){if(typeof e.disabled!=="undefined"){b.forEach(function(t,n){t.disabled=e.disabled[n]});x.disabled=e.disabled}if(typeof e.index!=="undefined"){O.i=e.index;O.x=A(O.i);x.index=e.index;nt.data([O])}if(typeof e.rescaleY!=="undefined"){y=e.rescaleY}_.update()})});return _}function D(e,n){return n.map(function(n,r){if(!n.values){return n}var i=t.y()(n.values[e],e);if(i<-.95){n.tempDisabled=true;return n}n.tempDisabled=false;n.values=n.values.map(function(e,n){e.display={y:(t.y()(e,n)-i)/(1+i)};return e});return n})}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline();var u={top:30,right:30,bottom:50,left:60},a=e.utils.defaultColor(),f=null,l=null,c=true,h=true,p=true,d=false,v=true,m=true,g=false,y=true,b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},w,E,S=t.id(),x={index:0,rescaleY:y},T=null,N="No Data Available.",C=function(e){return e.average},k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=250;n.orient("bottom").tickPadding(7);r.orient(d?"right":"left");s.updateState(false);var A=d3.scale.linear(),O={i:0,x:0};var M=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=b(i.series.key,a,f,i,_);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];k.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(v)e.tooltip.cleanup()});_.dispatch=k;_.lines=t;_.legend=i;_.xAxis=n;_.yAxis=r;_.interactiveLayer=o;d3.rebind(_,t,"defined","isArea","x","y","xScale","yScale","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id");_.options=e.utils.optionsFunc.bind(_);_.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return _};_.width=function(e){if(!arguments.length)return f;f=e;return _};_.height=function(e){if(!arguments.length)return l;l=e;return _};_.color=function(t){if(!arguments.length)return a;a=e.utils.getColor(t);i.color(a);return _};_.rescaleY=function(e){if(!arguments.length)return y;y=e;return _};_.showControls=function(e){if(!arguments.length)return m;m=e;return _};_.useInteractiveGuideline=function(e){if(!arguments.length)return g;g=e;if(e===true){_.interactive(false);_.useVoronoi(false)}return _};_.showLegend=function(e){if(!arguments.length)return c;c=e;return _};_.showXAxis=function(e){if(!arguments.length)return h;h=e;return _};_.showYAxis=function(e){if(!arguments.length)return p;p=e;return _};_.rightAlignYAxis=function(e){if(!arguments.length)return d;d=e;r.orient(e?"right":"left");return _};_.tooltips=function(e){if(!arguments.length)return v;v=e;return _};_.tooltipContent=function(e){if(!arguments.length)return b;b=e;return _};_.state=function(e){if(!arguments.length)return x;x=e;return _};_.defaultState=function(e){if(!arguments.length)return T;T=e;return _};_.noData=function(e){if(!arguments.length)return N;N=e;return _};_.average=function(e){if(!arguments.length)return C;C=e;return _};_.transitionDuration=function(e){if(!arguments.length)return L;L=e;return _};return _};e.models.discreteBar=function(){"use strict";function E(e){e.each(function(e){var i=n-t.left-t.right,E=r-t.top-t.bottom,S=d3.select(this);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});var T=p&&d?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0}})});s.domain(p||d3.merge(T).map(function(e){return e.x})).rangeBands(v||[0,i],.1);o.domain(d||d3.extent(d3.merge(T).map(function(e){return e.y}).concat(f)));if(c)o.range(m||[E-(o.domain()[0]<0?12:0),o.domain()[1]>0?12:0]);else o.range(m||[E,0]);b=b||s;w=w||o.copy().range([o(0),o(0)]);var N=S.selectAll("g.nv-wrap.nv-discretebar").data([e]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar");var k=C.append("g");var L=N.select("g");k.append("g").attr("class","nv-groups");N.attr("transform","translate("+t.left+","+t.top+")");var A=N.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);A.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();A.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover});A.transition().style("stroke-opacity",1).style("fill-opacity",.75);var O=A.selectAll("g.nv-bar").data(function(e){return e.values});O.exit().remove();var M=O.enter().append("g").attr("transform",function(e,t,n){return"translate("+(s(u(e,t))+s.rangeBand()*.05)+", "+o(0)+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);g.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);g.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){g.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){g.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});M.append("rect").attr("height",0).attr("width",s.rangeBand()*.9/e.length);if(c){M.append("text").attr("text-anchor","middle");O.select("text").text(function(e,t){return h(a(e,t))}).transition().attr("x",s.rangeBand()*.9/2).attr("y",function(e,t){return a(e,t)<0?o(a(e,t))-o(0)+12:-4})}else{O.selectAll("text").remove()}O.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(e,t){return e.color||l(e,t)}).style("stroke",function(e,t){return e.color||l(e,t)}).select("rect").attr("class",y).transition().attr("width",s.rangeBand()*.9/e.length);O.transition().attr("transform",function(e,t){var n=s(u(e,t))+s.rangeBand()*.05,r=a(e,t)<0?o(0):o(0)-o(a(e,t))<1?o(0)-1:o(a(e,t));return"translate("+n+", "+r+")"}).select("rect").attr("height",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(d&&d[0]||0))||1)});b=s.copy();w=o.copy()});return E}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=false,h=d3.format(",.2f"),p,d,v,m,g=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),y="discreteBar";var b,w;E.dispatch=g;E.options=e.utils.optionsFunc.bind(E);E.x=function(e){if(!arguments.length)return u;u=e;return E};E.y=function(e){if(!arguments.length)return a;a=e;return E};E.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return E};E.width=function(e){if(!arguments.length)return n;n=e;return E};E.height=function(e){if(!arguments.length)return r;r=e;return E};E.xScale=function(e){if(!arguments.length)return s;s=e;return E};E.yScale=function(e){if(!arguments.length)return o;o=e;return E};E.xDomain=function(e){if(!arguments.length)return p;p=e;return E};E.yDomain=function(e){if(!arguments.length)return d;d=e;return E};E.xRange=function(e){if(!arguments.length)return v;v=e;return E};E.yRange=function(e){if(!arguments.length)return m;m=e;return E};E.forceY=function(e){if(!arguments.length)return f;f=e;return E};E.color=function(t){if(!arguments.length)return l;l=e.utils.getColor(t);return E};E.id=function(e){if(!arguments.length)return i;i=e;return E};E.showValues=function(e){if(!arguments.length)return c;c=e;return E};E.valueFormat=function(e){if(!arguments.length)return h;h=e;return E};E.rectClass=function(e){if(!arguments.length)return y;y=e;return E};return E};e.models.discreteBarChart=function(){"use strict";function w(e){e.each(function(e){var u=d3.select(this),p=this;var E=(s||parseInt(u.style("width"))||960)-i.left-i.right,S=(o||parseInt(u.style("height"))||400)-i.top-i.bottom;w.update=function(){g.beforeUpdate();u.transition().duration(y).call(w)};w.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var T=u.selectAll(".nv-noData").data([m]);T.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");T.attr("x",i.left+E/2).attr("y",i.top+S/2).text(function(e){return e});return w}else{u.selectAll(".nv-noData").remove()}d=t.xScale();v=t.yScale().clamp(true);var N=u.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([e]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g");var k=C.append("defs");var L=N.select("g");C.append("g").attr("class","nv-x nv-axis");C.append("g").attr("class","nv-y nv-axis");C.append("g").attr("class","nv-barsWrap");L.attr("transform","translate("+i.left+","+i.top+")");if(l){L.select(".nv-y.nv-axis").attr("transform","translate("+E+",0)")}t.width(E).height(S);var A=L.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));A.transition().call(t);k.append("clipPath").attr("id","nv-x-label-clip-"+t.id()).append("rect");L.select("#nv-x-label-clip-"+t.id()+" rect").attr("width",d.rangeBand()*(c?2:1)).attr("height",16).attr("x",-d.rangeBand()/(c?1:2));if(a){n.scale(d).ticks(E/100).tickSize(-S,0);L.select(".nv-x.nv-axis").attr("transform","translate(0,"+(v.range()[0]+(t.showValues()&&v.domain()[0]<0?16:0))+")");L.select(".nv-x.nv-axis").transition().call(n);var O=L.select(".nv-x.nv-axis").selectAll("g");if(c){O.selectAll("text").attr("transform",function(e,t,n){return"translate(0,"+(n%2==0?"5":"17")+")"})}}if(f){r.scale(v).ticks(S/36).tickSize(-E,0);L.select(".nv-y.nv-axis").transition().call(r)}g.on("tooltipShow",function(e){if(h)b(e,p.parentNode)})});return w}var t=e.models.discreteBar(),n=e.models.axis(),r=e.models.axis();var i={top:15,right:10,bottom:50,left:60},s=null,o=null,u=e.utils.getColor(),a=true,f=true,l=false,c=false,h=true,p=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},d,v,m="No Data Available.",g=d3.dispatch("tooltipShow","tooltipHide","beforeUpdate"),y=250;n.orient("bottom").highlightZero(false).showMaxMin(false).tickFormat(function(e){return e});r.orient(l?"right":"left").tickFormat(d3.format(",.1f"));var b=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=p(i.series.key,a,f,i,w);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+i.left,e.pos[1]+i.top];g.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){g.tooltipHide(e)});g.on("tooltipHide",function(){if(h)e.tooltip.cleanup()});w.dispatch=g;w.discretebar=t;w.xAxis=n;w.yAxis=r;d3.rebind(w,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","id","showValues","valueFormat");w.options=e.utils.optionsFunc.bind(w);w.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.right=typeof e.right!="undefined"?e.right:i.right;i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom;i.left=typeof e.left!="undefined"?e.left:i.left;return w};w.width=function(e){if(!arguments.length)return s;s=e;return w};w.height=function(e){if(!arguments.length)return o;o=e;return w};w.color=function(n){if(!arguments.length)return u;u=e.utils.getColor(n);t.color(u);return w};w.showXAxis=function(e){if(!arguments.length)return a;a=e;return w};w.showYAxis=function(e){if(!arguments.length)return f;f=e;return w};w.rightAlignYAxis=function(e){if(!arguments.length)return l;l=e;r.orient(e?"right":"left");return w};w.staggerLabels=function(e){if(!arguments.length)return c;c=e;return w};w.tooltips=function(e){if(!arguments.length)return h;h=e;return w};w.tooltipContent=function(e){if(!arguments.length)return p;p=e;return w};w.noData=function(e){if(!arguments.length)return m;m=e;return w};w.transitionDuration=function(e){if(!arguments.length)return y;y=e;return w};return w};e.models.distribution=function(){"use strict";function l(e){e.each(function(e){var a=n-(i==="x"?t.left+t.right:t.top+t.bottom),l=i=="x"?"y":"x",c=d3.select(this);f=f||u;var h=c.selectAll("g.nv-distribution").data([e]);var p=h.enter().append("g").attr("class","nvd3 nv-distribution");var d=p.append("g");var v=h.select("g");h.attr("transform","translate("+t.left+","+t.top+")");var m=v.selectAll("g.nv-dist").data(function(e){return e},function(e){return e.key});m.enter().append("g");m.attr("class",function(e,t){return"nv-dist nv-series-"+t}).style("stroke",function(e,t){return o(e,t)});var g=m.selectAll("line.nv-dist"+i).data(function(e){return e.values});g.enter().append("line").attr(i+"1",function(e,t){return f(s(e,t))}).attr(i+"2",function(e,t){return f(s(e,t))});m.exit().selectAll("line.nv-dist"+i).transition().attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}).style("stroke-opacity",0).remove();g.attr("class",function(e,t){return"nv-dist"+i+" nv-dist"+i+"-"+t}).attr(l+"1",0).attr(l+"2",r);g.transition().attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))});f=u.copy()});return l}var t={top:0,right:0,bottom:0,left:0},n=400,r=8,i="x",s=function(e){return e[i]},o=e.utils.defaultColor(),u=d3.scale.linear(),a;var f;l.options=e.utils.optionsFunc.bind(l);l.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return l};l.width=function(e){if(!arguments.length)return n;n=e;return l};l.axis=function(e){if(!arguments.length)return i;i=e;return l};l.size=function(e){if(!arguments.length)return r;r=e;return l};l.getData=function(e){if(!arguments.length)return s;s=d3.functor(e);return l};l.scale=function(e){if(!arguments.length)return u;u=e;return l};l.color=function(t){if(!arguments.length)return o;o=e.utils.getColor(t);return l};return l};e.models.historicalBar=function(){"use strict";function w(E){E.each(function(w){var E=n-t.left-t.right,S=r-t.top-t.bottom,T=d3.select(this);s.domain(d||d3.extent(w[0].values.map(u).concat(f)));if(c)s.range(m||[E*.5/w[0].values.length,E*(w[0].values.length-.5)/w[0].values.length]);else s.range(m||[0,E]);o.domain(v||d3.extent(w[0].values.map(a).concat(l))).range(g||[S,0]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1]);if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]);var N=T.selectAll("g.nv-wrap.nv-historicalBar-"+i).data([w[0].values]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+i);var k=C.append("defs");var L=C.append("g");var A=N.select("g");L.append("g").attr("class","nv-bars");N.attr("transform","translate("+t.left+","+t.top+")");T.on("click",function(e,t){y.chartClick({data:e,index:t,pos:d3.event,id:i})});k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect");N.select("#nv-chart-clip-path-"+i+" rect").attr("width",E).attr("height",S);A.attr("clip-path",h?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-bars").selectAll(".nv-bar").data(function(e){return e},function(e,t){return u(e,t)});O.exit().remove();var M=O.enter().append("rect").attr("x",0).attr("y",function(t,n){return e.utils.NaNtoZero(o(Math.max(0,a(t,n))))}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.abs(o(a(t,n))-o(0)))}).attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).on("mouseover",function(e,t){if(!b)return;d3.select(this).classed("hover",true);y.elementMouseover({point:e,series:w[0],pos:[s(u(e,t)),o(a(e,t))],pointIndex:t,seriesIndex:0,e:d3.event})}).on("mouseout",function(e,t){if(!b)return;d3.select(this).classed("hover",false);y.elementMouseout({point:e,series:w[0],pointIndex:t,seriesIndex:0,e:d3.event})}).on("click",function(e,t){if(!b)return;y.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()}).on("dblclick",function(e,t){if(!b)return;y.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()});O.attr("fill",function(e,t){return p(e,t)}).attr("class",function(e,t,n){return(a(e,t)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+t}).transition().attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).attr("width",E/w[0].values.length*.9);O.transition().attr("y",function(t,n){var r=a(t,n)<0?o(0):o(0)-o(a(t,n))<1?o(0)-1:o(a(t,n));return e.utils.NaNtoZero(r)}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.max(Math.abs(o(a(t,n))-o(0)),1))})});return w}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[],l=[0],c=false,h=true,p=e.utils.defaultColor(),d,v,m,g,y=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),b=true;w.highlightPoint=function(e,t){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar-0-"+e).classed("hover",t)};w.clearHighlights=function(){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar.hover").classed("hover",false)};w.dispatch=y;w.options=e.utils.optionsFunc.bind(w);w.x=function(e){if(!arguments.length)return u;u=e;return w};w.y=function(e){if(!arguments.length)return a;a=e;return w};w.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return w};w.width=function(e){if(!arguments.length)return n;n=e;return w};w.height=function(e){if(!arguments.length)return r;r=e;return w};w.xScale=function(e){if(!arguments.length)return s;s=e;return w};w.yScale=function(e){if(!arguments.length)return o;o=e;return w};w.xDomain=function(e){if(!arguments.length)return d;d=e;return w};w.yDomain=function(e){if(!arguments.length)return v;v=e;return w};w.xRange=function(e){if(!arguments.length)return m;m=e;return w};w.yRange=function(e){if(!arguments.length)return g;g=e;return w};w.forceX=function(e){if(!arguments.length)return f;f=e;return w};w.forceY=function(e){if(!arguments.length)return l;l=e;return w};w.padData=function(e){if(!arguments.length)return c;c=e;return w};w.clipEdge=function(e){if(!arguments.length)return h;h=e;return w};w.color=function(t){if(!arguments.length)return p;p=e.utils.getColor(t);return w};w.id=function(e){if(!arguments.length)return i;i=e;return w};w.interactive=function(e){if(!arguments.length)return b;b=false;return w};return w};e.models.historicalBarChart=function(){"use strict";function x(e){e.each(function(d){var T=d3.select(this),N=this;var C=(u||parseInt(T.style("width"))||960)-s.left-s.right,k=(a||parseInt(T.style("height"))||400)-s.top-s.bottom;x.update=function(){T.transition().duration(E).call(x)};x.container=this;g.disabled=d.map(function(e){return!!e.disabled});if(!y){var L;y={};for(L in g){if(g[L]instanceof Array)y[L]=g[L].slice(0);else y[L]=g[L]}}if(!d||!d.length||!d.filter(function(e){return e.values.length}).length){var A=T.selectAll(".nv-noData").data([b]);A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");A.attr("x",s.left+C/2).attr("y",s.top+k/2).text(function(e){return e});return x}else{T.selectAll(".nv-noData").remove()}v=t.xScale();m=t.yScale();var O=T.selectAll("g.nv-wrap.nv-historicalBarChart").data([d]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g");var _=O.select("g");M.append("g").attr("class","nv-x nv-axis");M.append("g").attr("class","nv-y nv-axis");M.append("g").attr("class","nv-barsWrap");M.append("g").attr("class","nv-legendWrap");if(f){i.width(C);_.select(".nv-legendWrap").datum(d).call(i);if(s.top!=i.height()){s.top=i.height();k=(a||parseInt(T.style("height"))||400)-s.top-s.bottom}O.select(".nv-legendWrap").attr("transform","translate(0,"+ -s.top+")")}O.attr("transform","translate("+s.left+","+s.top+")");if(h){_.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)")}t.width(C).height(k).color(d.map(function(e,t){return e.color||o(e,t)}).filter(function(e,t){return!d[t].disabled}));var D=_.select(".nv-barsWrap").datum(d.filter(function(e){return!e.disabled}));D.transition().call(t);if(l){n.scale(v).tickSize(-k,0);_.select(".nv-x.nv-axis").attr("transform","translate(0,"+m.range()[0]+")");_.select(".nv-x.nv-axis").transition().call(n)}if(c){r.scale(m).ticks(k/36).tickSize(-C,0);_.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled;if(!d.filter(function(e){return!e.disabled}).length){d.map(function(e){e.disabled=false;O.selectAll(".nv-series").classed("disabled",false);return e})}g.disabled=d.map(function(e){return!!e.disabled});w.stateChange(g);e.transition().call(x)});i.dispatch.on("legendDblclick",function(e){d.forEach(function(e){e.disabled=true});e.disabled=false;g.disabled=d.map(function(e){return!!e.disabled});w.stateChange(g);x.update()});w.on("tooltipShow",function(e){if(p)S(e,N.parentNode)});w.on("changeState",function(t){if(typeof t.disabled!=="undefined"){d.forEach(function(e,n){e.disabled=t.disabled[n]});g.disabled=t.disabled}e.call(x)})});return x}var t=e.models.historicalBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend();var s={top:30,right:90,bottom:50,left:90},o=e.utils.defaultColor(),u=null,a=null,f=false,l=true,c=true,h=false,p=true,d=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},v,m,g={},y=null,b="No Data Available.",w=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),E=250;n.orient("bottom").tickPadding(7);r.orient(h?"right":"left");var S=function(i,s){if(s){var o=d3.select(s).select("svg");var u=o.node()?o.attr("viewBox"):null;if(u){u=u.split(" ");var a=parseInt(o.style("width"))/u[2];i.pos[0]=i.pos[0]*a;i.pos[1]=i.pos[1]*a}}var f=i.pos[0]+(s.offsetLeft||0),l=i.pos[1]+(s.offsetTop||0),c=n.tickFormat()(t.x()(i.point,i.pointIndex)),h=r.tickFormat()(t.y()(i.point,i.pointIndex)),p=d(i.series.key,c,h,i,x);e.tooltip.show([f,l],p,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+s.left,e.pos[1]+s.top];w.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){w.tooltipHide(e)});w.on("tooltipHide",function(){if(p)e.tooltip.cleanup()});x.dispatch=w;x.bars=t;x.legend=i;x.xAxis=n;x.yAxis=r;d3.rebind(x,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate","highlightPoint","clearHighlights","interactive");x.options=e.utils.optionsFunc.bind(x);x.margin=function(e){if(!arguments.length)return s;s.top=typeof e.top!="undefined"?e.top:s.top;s.right=typeof e.right!="undefined"?e.right:s.right;s.bottom=typeof e.bottom!="undefined"?e.bottom:s.bottom;s.left=typeof e.left!="undefined"?e.left:s.left;return x};x.width=function(e){if(!arguments.length)return u;u=e;return x};x.height=function(e){if(!arguments.length)return a;a=e;return x};x.color=function(t){if(!arguments.length)return o;o=e.utils.getColor(t);i.color(o);return x};x.showLegend=function(e){if(!arguments.length)return f;f=e;return x};x.showXAxis=function(e){if(!arguments.length)return l;l=e;return x};x.showYAxis=function(e){if(!arguments.length)return c;c=e;return x};x.rightAlignYAxis=function(e){if(!arguments.length)return h;h=e;r.orient(e?"right":"left");return x};x.tooltips=function(e){if(!arguments.length)return p;p=e;return x};x.tooltipContent=function(e){if(!arguments.length)return d;d=e;return x};x.state=function(e){if(!arguments.length)return g;g=e;return x};x.defaultState=function(e){if(!arguments.length)return y;y=e;return x};x.noData=function(e){if(!arguments.length)return b;b=e;return x};x.transitionDuration=function(e){if(!arguments.length)return E;E=e;return x};return x};e.models.indentedTree=function(){"use strict";function g(e){e.each(function(e){function k(e,t,n){d3.event.stopPropagation();if(d3.event.shiftKey&&!n){d3.event.shiftKey=false;e.values&&e.values.forEach(function(e){if(e.values||e._values){k(e,0,true)}});return true}if(!O(e)){return true}if(e.values){e._values=e.values;e.values=null}else{e.values=e._values;e._values=null}g.update()}function L(e){return e._values&&e._values.length?h:e.values&&e.values.length?p:""}function A(e){return e._values&&e._values.length}function O(e){var t=e.values||e._values;return t&&t.length}var t=1,n=d3.select(this);var i=d3.layout.tree().children(function(e){return e.values}).size([r,f]);g.update=function(){n.transition().duration(600).call(g)};if(!e[0])e[0]={key:a};var s=i.nodes(e[0]);var y=d3.select(this).selectAll("div").data([[s]]);var b=y.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree");var w=b.append("table");var E=y.select("table").attr("width","100%").attr("class",c);if(o){var S=w.append("thead");var x=S.append("tr");l.forEach(function(e){x.append("th").attr("width",e.width?e.width:"10%").style("text-align",e.type=="numeric"?"right":"left").append("span").text(e.label)})}var T=E.selectAll("tbody").data(function(e){return e});T.enter().append("tbody");t=d3.max(s,function(e){return e.depth});i.size([r,t*f]);var N=T.selectAll("tr").data(function(e){return e.filter(function(e){return u&&!e.children?u(e):true})},function(e,t){return e.id||e.id||++m});N.exit().remove();N.select("img.nv-treeicon").attr("src",L).classed("folded",A);var C=N.enter().append("tr");l.forEach(function(e,t){var n=C.append("td").style("padding-left",function(e){return(t?0:e.depth*f+12+(L(e)?0:16))+"px"},"important").style("text-align",e.type=="numeric"?"right":"left");if(t==0){n.append("img").classed("nv-treeicon",true).classed("nv-folded",A).attr("src",L).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(e){return L(e)?"inline-block":"none"}).on("click",k)}n.each(function(n){if(!t&&v(n))d3.select(this).append("a").attr("href",v).attr("class",d3.functor(e.classes)).append("span");else d3.select(this).append("span");d3.select(this).select("span").attr("class",d3.functor(e.classes)).text(function(t){return e.format?e.format(t):t[e.key]||"-"})});if(e.showCount){n.append("span").attr("class","nv-childrenCount");N.selectAll("span.nv-childrenCount").text(function(e){return e.values&&e.values.length||e._values&&e._values.length?"("+(e.values&&e.values.filter(function(e){return u?u(e):true}).length||e._values&&e._values.filter(function(e){return u?u(e):true}).length||0)+")":""})}});N.order().on("click",function(e){d.elementClick({row:this,data:e,pos:[e.x,e.y]})}).on("dblclick",function(e){d.elementDblclick({row:this,data:e,pos:[e.x,e.y]})}).on("mouseover",function(e){d.elementMouseover({row:this,data:e,pos:[e.x,e.y]})}).on("mouseout",function(e){d.elementMouseout({row:this,data:e,pos:[e.x,e.y]})})});return g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e4),o=true,u=false,a="No Data Available.",f=20,l=[{key:"key",label:"Name",type:"text"}],c=null,h="images/grey-plus.png",p="images/grey-minus.png",d=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout"),v=function(e){return e.url};var m=0;g.options=e.utils.optionsFunc.bind(g);g.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return g};g.width=function(e){if(!arguments.length)return n;n=e;return g};g.height=function(e){if(!arguments.length)return r;r=e;return g};g.color=function(t){if(!arguments.length)return i;i=e.utils.getColor(t);scatter.color(i);return g};g.id=function(e){if(!arguments.length)return s;s=e;return g};g.header=function(e){if(!arguments.length)return o;o=e;return g};g.noData=function(e){if(!arguments.length)return a;a=e;return g};g.filterZero=function(e){if(!arguments.length)return u;u=e;return g};g.columns=function(e){if(!arguments.length)return l;l=e;return g};g.tableClass=function(e){if(!arguments.length)return c;c=e;return g};g.iconOpen=function(e){if(!arguments.length)return h;h=e;return g};g.iconClose=function(e){if(!arguments.length)return p;p=e;return g};g.getUrl=function(e){if(!arguments.length)return v;v=e;return g};return g};e.models.legend=function(){"use strict";function h(p){p.each(function(h){var p=n-t.left-t.right,d=d3.select(this);var v=d.selectAll("g.nv-legend").data([h]);var m=v.enter().append("g").attr("class","nvd3 nv-legend").append("g");var g=v.select("g");v.attr("transform","translate("+t.left+","+t.top+")");var y=g.selectAll(".nv-series").data(function(e){return e});var b=y.enter().append("g").attr("class","nv-series").on("mouseover",function(e,t){l.legendMouseover(e,t)}).on("mouseout",function(e,t){l.legendMouseout(e,t)}).on("click",function(e,t){if(!c){l.legendClick(e,t);if(a){if(f){h.forEach(function(e){e.disabled=true});e.disabled=false}else{e.disabled=!e.disabled;if(h.every(function(e){return e.disabled})){h.forEach(function(e){e.disabled=false})}}l.stateChange({disabled:h.map(function(e){return!!e.disabled})})}}}).on("dblclick",function(e,t){if(!c){l.legendDblclick(e,t);if(a){h.forEach(function(e){e.disabled=true});e.disabled=false;l.stateChange({disabled:h.map(function(e){return!!e.disabled})})}}});b.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5);b.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");y.classed("disabled",function(e){return e.disabled});y.exit().remove();y.select("circle").style("fill",function(e,t){return e.color||s(e,t)}).style("stroke",function(e,t){return e.color||s(e,t)});y.select("text").text(i);if(o){var w=[];y.each(function(t,n){var r=d3.select(this).select("text");var i=r.node().getComputedTextLength()||e.utils.calcApproxTextWidth(r);w.push(i+28)});var E=0;var S=0;var x=[];while(S<p&&E<w.length){x[E]=w[E];S+=w[E++]}if(E===0)E=1;while(S>p&&E>1){x=[];E--;for(var T=0;T<w.length;T++){if(w[T]>(x[T%E]||0))x[T%E]=w[T]}S=x.reduce(function(e,t,n,r){return e+t})}var N=[];for(var C=0,k=0;C<E;C++){N[C]=k;k+=x[C]}y.attr("transform",function(e,t){return"translate("+N[t%E]+","+(5+Math.floor(t/E)*20)+")"});if(u){g.attr("transform","translate("+(n-t.right-S)+","+t.top+")")}else{g.attr("transform","translate(0"+","+t.top+")")}r=t.top+t.bottom+Math.ceil(w.length/E)*20}else{var L=5,A=5,O=0,M;y.attr("transform",function(e,r){var i=d3.select(this).select("text").node().getComputedTextLength()+28;M=A;if(n<t.left+t.right+M+i){A=M=5;L+=20}A+=i;if(A>O)O=A;return"translate("+M+","+L+")"});g.attr("transform","translate("+(n-t.right-O)+","+t.top+")");r=t.top+t.bottom+L+15}});return h}var t={top:5,right:0,bottom:5,left:0},n=400,r=20,i=function(e){return e.key},s=e.utils.defaultColor(),o=true,u=true,a=true,f=false,l=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange"),c=false;h.dispatch=l;h.options=e.utils.optionsFunc.bind(h);h.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return h};h.width=function(e){if(!arguments.length)return n;n=e;return h};h.height=function(e){if(!arguments.length)return r;r=e;return h};h.key=function(e){if(!arguments.length)return i;i=e;return h};h.color=function(t){if(!arguments.length)return s;s=e.utils.getColor(t);return h};h.align=function(e){if(!arguments.length)return o;o=e;return h};h.rightAlign=function(e){if(!arguments.length)return u;u=e;return h};h.dualaxis=function(e){if(!arguments.length)return c;c=e;return h};h.updateState=function(e){if(!arguments.length)return a;a=e;return h};h.radioButtonMode=function(e){if(!arguments.length)return f;f=e;return h};return h};e.models.line=function(){"use strict";function m(g){g.each(function(m){var g=r-n.left-n.right,b=i-n.top-n.bottom,w=d3.select(this);c=t.xScale();h=t.yScale();d=d||c;v=v||h;var E=w.selectAll("g.nv-wrap.nv-line").data([m]);var S=E.enter().append("g").attr("class","nvd3 nv-wrap nv-line");var T=S.append("defs");var N=S.append("g");var C=E.select("g");N.append("g").attr("class","nv-groups");N.append("g").attr("class","nv-scatterWrap");E.attr("transform","translate("+n.left+","+n.top+")");t.width(g).height(b);var k=E.select(".nv-scatterWrap");k.transition().call(t);T.append("clipPath").attr("id","nv-edge-clip-"+t.id()).append("rect");E.select("#nv-edge-clip-"+t.id()+" rect").attr("width",g).attr("height",b);C.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");k.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");var L=E.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});L.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);L.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();L.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return s(e,t)}).style("stroke",function(e,t){return s(e,t)});L.transition().style("stroke-opacity",1).style("fill-opacity",.5);var A=L.selectAll("path.nv-area").data(function(e){return f(e)?[e]:[]});A.enter().append("path").attr("class","nv-area").attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}).y1(function(e,t){return v(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});L.exit().selectAll("path.nv-area").remove();A.transition().attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}).y1(function(e,t){return h(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});var O=L.selectAll("path.nv-line").data(function(e){return[e.values]});O.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}));L.exit().selectAll("path.nv-line").transition().attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}));O.transition().attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}));d=c.copy();v=h.copy()});return m}var t=e.models.scatter();var n={top:0,right:0,bottom:0,left:0},r=960,i=500,s=e.utils.defaultColor(),o=function(e){return e.x},u=function(e){return e.y},a=function(e,t){return!isNaN(u(e,t))&&u(e,t)!==null},f=function(e){return e.area},l=false,c,h,p="linear";t.size(16).sizeDomain([16,256]);var d,v;m.dispatch=t.dispatch;m.scatter=t;d3.rebind(m,t,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","padData","highlightPoint","clearHighlights");m.options=e.utils.optionsFunc.bind(m);m.margin=function(e){if(!arguments.length)return n;n.top=typeof e.top!="undefined"?e.top:n.top;n.right=typeof e.right!="undefined"?e.right:n.right;n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom;n.left=typeof e.left!="undefined"?e.left:n.left;return m};m.width=function(e){if(!arguments.length)return r;r=e;return m};m.height=function(e){if(!arguments.length)return i;i=e;return m};m.x=function(e){if(!arguments.length)return o;o=e;t.x(e);return m};m.y=function(e){if(!arguments.length)return u;u=e;t.y(e);return m};m.clipEdge=function(e){if(!arguments.length)return l;l=e;return m};m.color=function(n){if(!arguments.length)return s;s=e.utils.getColor(n);t.color(s);return m};m.interpolate=function(e){if(!arguments.length)return p;p=e;return m};m.defined=function(e){if(!arguments.length)return a;a=e;return m};m.isArea=function(e){if(!arguments.length)return f;f=d3.functor(e);return m};return m};e.models.lineChart=function(){"use strict";function N(m){m.each(function(m){var C=d3.select(this),k=this;var L=(a||parseInt(C.style("width"))||960)-o.left-o.right,A=(f||parseInt(C.style("height"))||400)-o.top-o.bottom;N.update=function(){C.transition().duration(x).call(N)};N.container=this;b.disabled=m.map(function(e){return!!e.disabled});if(!w){var O;w={};for(O in b){if(b[O]instanceof Array)w[O]=b[O].slice(0);else w[O]=b[O]}}if(!m||!m.length||!m.filter(function(e){return e.values.length}).length){var M=C.selectAll(".nv-noData").data([E]);M.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");M.attr("x",o.left+L/2).attr("y",o.top+A/2).text(function(e){return e});return N}else{C.selectAll(".nv-noData").remove()}g=t.xScale();y=t.yScale();var _=C.selectAll("g.nv-wrap.nv-lineChart").data([m]);var D=_.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g");var P=_.select("g");D.append("rect").style("opacity",0);D.append("g").attr("class","nv-x nv-axis");D.append("g").attr("class","nv-y nv-axis");D.append("g").attr("class","nv-linesWrap");D.append("g").attr("class","nv-legendWrap");D.append("g").attr("class","nv-interactive");P.select("rect").attr("width",L).attr("height",A);if(l){i.width(L);P.select(".nv-legendWrap").datum(m).call(i);if(o.top!=i.height()){o.top=i.height();A=(f||parseInt(C.style("height"))||400)-o.top-o.bottom}_.select(".nv-legendWrap").attr("transform","translate(0,"+ -o.top+")")}_.attr("transform","translate("+o.left+","+o.top+")");if(p){P.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)")}if(d){s.width(L).height(A).margin({left:o.left,top:o.top}).svgContainer(C).xScale(g);_.select(".nv-interactive").call(s)}t.width(L).height(A).color(m.map(function(e,t){return e.color||u(e,t)}).filter(function(e,t){return!m[t].disabled}));var H=P.select(".nv-linesWrap").datum(m.filter(function(e){return!e.disabled}));H.transition().call(t);if(c){n.scale(g).ticks(L/100).tickSize(-A,0);P.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");P.select(".nv-x.nv-axis").transition().call(n)}if(h){r.scale(y).ticks(A/36).tickSize(-L,0);P.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);N.update()});s.dispatch.on("elementMousemove",function(i){t.clearHighlights();var a,f,l,c=[];m.filter(function(e,t){e.seriesIndex=t;return!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,N.x());t.highlightPoint(r,f,true);var s=n.values[f];if(typeof s==="undefined")return;if(typeof a==="undefined")a=s;if(typeof l==="undefined")l=N.xScale()(N.x()(s,f));c.push({key:n.key,value:N.y()(s,f),color:u(n,n.seriesIndex)})});if(c.length>2){var h=N.yScale().invert(i.mouseY);var p=Math.abs(N.yScale().domain()[0]-N.yScale().domain()[1]);var d=.03*p;var g=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);if(g!==null)c[g].highlight=true}var y=n.tickFormat()(N.x()(a,f));s.tooltip.position({left:l+o.left,top:i.mouseY+o.top}).chartContainer(k.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:y,series:c})();s.renderGuideLine(l)});s.dispatch.on("elementMouseout",function(e){S.tooltipHide();t.clearHighlights()});S.on("tooltipShow",function(e){if(v)T(e,k.parentNode)});S.on("changeState",function(e){if(typeof e.disabled!=="undefined"){m.forEach(function(t,n){t.disabled=e.disabled[n]});b.disabled=e.disabled}N.update()})});return N}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.interactiveGuideline();var o={top:30,right:20,bottom:50,left:60},u=e.utils.defaultColor(),a=null,f=null,l=true,c=true,h=true,p=false,d=false,v=true,m=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=250;n.orient("bottom").tickPadding(7);r.orient(p?"right":"left");var T=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=m(i.series.key,a,f,i,N);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(v)e.tooltip.cleanup()});N.dispatch=S;N.lines=t;N.legend=i;N.xAxis=n;N.yAxis=r;N.interactiveLayer=s;d3.rebind(N,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id","interpolate");N.options=e.utils.optionsFunc.bind(N);N.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return N};N.width=function(e){if(!arguments.length)return a;a=e;return N};N.height=function(e){if(!arguments.length)return f;f=e;return N};N.color=function(t){if(!arguments.length)return u;u=e.utils.getColor(t);i.color(u);return N};N.showLegend=function(e){if(!arguments.length)return l;l=e;return N};N.showXAxis=function(e){if(!arguments.length)return c;c=e;return N};N.showYAxis=function(e){if(!arguments.length)return h;h=e;return N};N.rightAlignYAxis=function(e){if(!arguments.length)return p;p=e;r.orient(e?"right":"left");return N};N.useInteractiveGuideline=function(e){if(!arguments.length)return d;d=e;if(e===true){N.interactive(false);N.useVoronoi(false)}return N};N.tooltips=function(e){if(!arguments.length)return v;v=e;return N};N.tooltipContent=function(e){if(!arguments.length)return m;m=e;return N};N.state=function(e){if(!arguments.length)return b;b=e;return N};N.defaultState=function(e){if(!arguments.length)return w;w=e;return N};N.noData=function(e){if(!arguments.length)return E;E=e;return N};N.transitionDuration=function(e){if(!arguments.length)return x;x=e;return N};return N};e.models.linePlusBarChart=function(){"use strict";function T(e){e.each(function(e){var l=d3.select(this),c=this;var v=(a||parseInt(l.style("width"))||960)-u.left-u.right,N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom;T.update=function(){l.transition().call(T)};b.disabled=e.map(function(e){return!!e.disabled});if(!w){var C;w={};for(C in b){if(b[C]instanceof Array)w[C]=b[C].slice(0);else w[C]=b[C]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var k=l.selectAll(".nv-noData").data([E]);k.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");k.attr("x",u.left+v/2).attr("y",u.top+N/2).text(function(e){return e});return T}else{l.selectAll(".nv-noData").remove()}var L=e.filter(function(e){return!e.disabled&&e.bar});var A=e.filter(function(e){return!e.bar});m=A.filter(function(e){return!e.disabled}).length&&A.filter(function(e){return!e.disabled})[0].values.length?t.xScale():n.xScale();g=n.yScale();y=t.yScale();var O=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([e]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");var _=O.select("g");M.append("g").attr("class","nv-x nv-axis");M.append("g").attr("class","nv-y1 nv-axis");M.append("g").attr("class","nv-y2 nv-axis");M.append("g").attr("class","nv-barsWrap");M.append("g").attr("class","nv-linesWrap");M.append("g").attr("class","nv-legendWrap");if(p){o.width(v/2);_.select(".nv-legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)");return e})).call(o);if(u.top!=o.height()){u.top=o.height();N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom}_.select(".nv-legendWrap").attr("transform","translate("+v/2+","+ -u.top+")")}O.attr("transform","translate("+u.left+","+u.top+")");t.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));n.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));var D=_.select(".nv-barsWrap").datum(L.length?L:[{values:[]}]);var P=_.select(".nv-linesWrap").datum(A[0]&&!A[0].disabled?A:[{values:[]}]);d3.transition(D).call(n);d3.transition(P).call(t);r.scale(m).ticks(v/100).tickSize(-N,0);_.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")");d3.transition(_.select(".nv-x.nv-axis")).call(r);i.scale(g).ticks(N/36).tickSize(-v,0);d3.transition(_.select(".nv-y1.nv-axis")).style("opacity",L.length?1:0).call(i);s.scale(y).ticks(N/36).tickSize(L.length?0:-v,0);_.select(".nv-y2.nv-axis").style("opacity",A.length?1:0).attr("transform","translate("+v+",0)");d3.transition(_.select(".nv-y2.nv-axis")).call(s);o.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);T.update()});S.on("tooltipShow",function(e){if(d)x(e,c.parentNode)});S.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});b.disabled=t.disabled}T.update()})});return T}var t=e.models.line(),n=e.models.historicalBar(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.legend();var u={top:30,right:60,bottom:50,left:60},a=null,f=null,l=function(e){return e.x},c=function(e){return e.y},h=e.utils.defaultColor(),p=true,d=true,v=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},m,g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");n.padData(true);t.clipEdge(false).padData(true);r.orient("bottom").tickPadding(7).highlightZero(false);i.orient("left");s.orient("right");var x=function(n,o){var u=n.pos[0]+(o.offsetLeft||0),a=n.pos[1]+(o.offsetTop||0),f=r.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?i:s).tickFormat()(t.y()(n.point,n.pointIndex)),c=v(n.series.key,f,l,n,T);e.tooltip.show([u,a],c,n.value<0?"n":"s",null,o)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});n.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];S.tooltipShow(e)});n.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(d)e.tooltip.cleanup()});T.dispatch=S;T.legend=o;T.lines=t;T.bars=n;T.xAxis=r;T.y1Axis=i;T.y2Axis=s;d3.rebind(T,t,"defined","size","clipVoronoi","interpolate");T.options=e.utils.optionsFunc.bind(T);T.x=function(e){if(!arguments.length)return l;l=e;t.x(e);n.x(e);return T};T.y=function(e){if(!arguments.length)return c;c=e;t.y(e);n.y(e);return T};T.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return T};T.width=function(e){if(!arguments.length)return a;a=e;return T};T.height=function(e){if(!arguments.length)return f;f=e;return T};T.color=function(t){if(!arguments.length)return h;h=e.utils.getColor(t);o.color(h);return T};T.showLegend=function(e){if(!arguments.length)return p;p=e;return T};T.tooltips=function(e){if(!arguments.length)return d;d=e;return T};T.tooltipContent=function(e){if(!arguments.length)return v;v=e;return T};T.state=function(e){if(!arguments.length)return b;b=e;return T};T.defaultState=function(e){if(!arguments.length)return w;w=e;return T};T.noData=function(e){if(!arguments.length)return E;E=e;return T};return T};e.models.lineWithFocusChart=function(){"use strict";function k(e){e.each(function(e){function U(e){var t=+(e=="e"),n=t?1:-1,r=M/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function z(){if(!a.empty())a.extent(w);I.data([a.empty()?g.domain():w]).each(function(e,t){var n=g(e[0])-v.range()[0],r=v.range()[1]-g(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n);d3.select(this).select(".right").attr("x",g(e[1])).attr("width",r<0?0:r)})}function W(){w=a.empty()?null:a.extent();var n=a.empty()?g.domain():a.extent();if(Math.abs(n[0]-n[1])<=1){return}T.brush({extent:n,brush:a});z();var s=H.select(".nv-focus .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}).map(function(e,r){return{key:e.key,values:e.values.filter(function(e,r){return t.x()(e,r)>=n[0]&&t.x()(e,r)<=n[1]})}}));s.transition().duration(N).call(t);H.select(".nv-focus .nv-x.nv-axis").transition().duration(N).call(r);H.select(".nv-focus .nv-y.nv-axis").transition().duration(N).call(i)}var S=d3.select(this),L=this;var A=(h||parseInt(S.style("width"))||960)-f.left-f.right,O=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d,M=d-l.top-l.bottom;k.update=function(){S.transition().duration(N).call(k)};k.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var _=S.selectAll(".nv-noData").data([x]);_.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");_.attr("x",f.left+A/2).attr("y",f.top+O/2).text(function(e){return e});return k}else{S.selectAll(".nv-noData").remove()}v=t.xScale();m=t.yScale();g=n.xScale();y=n.yScale();var D=S.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([e]);var P=D.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g");var H=D.select("g");P.append("g").attr("class","nv-legendWrap");var B=P.append("g").attr("class","nv-focus");B.append("g").attr("class","nv-x nv-axis");B.append("g").attr("class","nv-y nv-axis");B.append("g").attr("class","nv-linesWrap");var j=P.append("g").attr("class","nv-context");j.append("g").attr("class","nv-x nv-axis");j.append("g").attr("class","nv-y nv-axis");j.append("g").attr("class","nv-linesWrap");j.append("g").attr("class","nv-brushBackground");j.append("g").attr("class","nv-x nv-brush");if(b){u.width(A);H.select(".nv-legendWrap").datum(e).call(u);if(f.top!=u.height()){f.top=u.height();O=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d}H.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")}D.attr("transform","translate("+f.left+","+f.top+")");t.width(A).height(O).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));n.defined(t.defined()).width(A).height(M).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));H.select(".nv-context").attr("transform","translate(0,"+(O+f.bottom+l.top)+")");var F=H.select(".nv-context .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}));d3.transition(F).call(n);r.scale(v).ticks(A/100).tickSize(-O,0);i.scale(m).ticks(O/36).tickSize(-A,0);H.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+O+")");a.x(g).on("brush",function(){var e=k.transitionDuration();k.transitionDuration(0);W();k.transitionDuration(e)});if(w)a.extent(w);var I=H.select(".nv-brushBackground").selectAll("g").data([w||a.extent()]);var q=I.enter().append("g");q.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",M);q.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",M);var R=H.select(".nv-x.nv-brush").call(a);R.selectAll("rect").attr("height",M);R.selectAll(".resize").append("path").attr("d",U);W();s.scale(g).ticks(A/100).tickSize(-M,0);H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");d3.transition(H.select(".nv-context .nv-x.nv-axis")).call(s);o.scale(y).ticks(M/36).tickSize(-A,0);d3.transition(H.select(".nv-context .nv-y.nv-axis")).call(o);H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");u.dispatch.on("stateChange",function(e){k.update()});T.on("tooltipShow",function(e){if(E)C(e,L.parentNode)})});return k}var t=e.models.line(),n=e.models.line(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.axis(),u=e.models.legend(),a=d3.svg.brush();var f={top:30,right:30,bottom:30,left:60},l={top:0,right:30,bottom:20,left:60},c=e.utils.defaultColor(),h=null,p=null,d=100,v,m,g,y,b=true,w=null,E=true,S=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},x="No Data Available.",T=d3.dispatch("tooltipShow","tooltipHide","brush"),N=250;t.clipEdge(true);n.interactive(false);r.orient("bottom").tickPadding(5);i.orient("left");s.orient("bottom").tickPadding(5);o.orient("left");var C=function(n,s){var o=n.pos[0]+(s.offsetLeft||0),u=n.pos[1]+(s.offsetTop||0),a=r.tickFormat()(t.x()(n.point,n.pointIndex)),f=i.tickFormat()(t.y()(n.point,n.pointIndex)),l=S(n.series.key,a,f,n,k);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+f.left,e.pos[1]+f.top];T.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)});T.on("tooltipHide",function(){if(E)e.tooltip.cleanup()});k.dispatch=T;k.legend=u;k.lines=t;k.lines2=n;k.xAxis=r;k.yAxis=i;k.x2Axis=s;k.y2Axis=o;d3.rebind(k,t,"defined","isArea","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id");k.options=e.utils.optionsFunc.bind(k);k.x=function(e){if(!arguments.length)return t.x;t.x(e);n.x(e);return k};k.y=function(e){if(!arguments.length)return t.y;t.y(e);n.y(e);return k};k.margin=function(e){if(!arguments.length)return f;f.top=typeof e.top!="undefined"?e.top:f.top;f.right=typeof e.right!="undefined"?e.right:f.right;f.bottom=typeof e.bottom!="undefined"?e.bottom:f.bottom;f.left=typeof e.left!="undefined"?e.left:f.left;return k};k.margin2=function(e){if(!arguments.length)return l;l=e;return k};k.width=function(e){if(!arguments.length)return h;h=e;return k};k.height=function(e){if(!arguments.length)return p;p=e;return k};k.height2=function(e){if(!arguments.length)return d;d=e;return k};k.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);u.color(c);return k};k.showLegend=function(e){if(!arguments.length)return b;b=e;return k};k.tooltips=function(e){if(!arguments.length)return E;E=e;return k};k.tooltipContent=function(e){if(!arguments.length)return S;S=e;return k};k.interpolate=function(e){if(!arguments.length)return t.interpolate();t.interpolate(e);n.interpolate(e);return k};k.noData=function(e){if(!arguments.length)return x;x=e;return k};k.xTickFormat=function(e){if(!arguments.length)return r.tickFormat();r.tickFormat(e);s.tickFormat(e);return k};k.yTickFormat=function(e){if(!arguments.length)return i.tickFormat();i.tickFormat(e);o.tickFormat(e);return k};k.brushExtent=function(e){if(!arguments.length)return w;w=e;return k};k.transitionDuration=function(e){if(!arguments.length)return N;N=e;return k};return k};e.models.linePlusBarWithFocusChart=function(){"use strict";function B(e){e.each(function(e){function nt(e){var t=+(e=="e"),n=t?1:-1,r=q/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function rt(){if(!h.empty())h.extent(x);Z.data([h.empty()?k.domain():x]).each(function(e,t){var n=k(e[0])-k.range()[0],r=k.range()[1]-k(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n);d3.select(this).select(".right").attr("x",k(e[1])).attr("width",r<0?0:r)})}function it(){x=h.empty()?null:h.extent();S=h.empty()?k.domain():h.extent();D.brush({extent:S,brush:h});rt();r.width(F).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));t.width(F).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var n=J.select(".nv-focus .nv-barsWrap").datum(!U.length?[{values:[]}]:U.map(function(e,t){return{key:e.key,values:e.values.filter(function(e,t){return r.x()(e,t)>=S[0]&&r.x()(e,t)<=S[1]})}}));var i=J.select(".nv-focus .nv-linesWrap").datum(z[0].disabled?[{values:[]}]:z.map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return t.x()(e,n)>=S[0]&&t.x()(e,n)<=S[1]})}}));if(U.length){C=r.xScale()}else{C=t.xScale()}s.scale(C).ticks(F/100).tickSize(-I,0);s.domain([Math.ceil(S[0]),Math.floor(S[1])]);J.select(".nv-x.nv-axis").transition().duration(P).call(s);n.transition().duration(P).call(r);i.transition().duration(P).call(t);J.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+L.range()[0]+")");u.scale(L).ticks(I/36).tickSize(-F,0);J.select(".nv-focus .nv-y1.nv-axis").style("opacity",U.length?1:0);a.scale(A).ticks(I/36).tickSize(U.length?0:-F,0);J.select(".nv-focus .nv-y2.nv-axis").style("opacity",z.length?1:0).attr("transform","translate("+C.range()[1]+",0)");J.select(".nv-focus .nv-y1.nv-axis").transition().duration(P).call(u);J.select(".nv-focus .nv-y2.nv-axis").transition().duration(P).call(a)}var N=d3.select(this),j=this;var F=(v||parseInt(N.style("width"))||960)-p.left-p.right,I=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g,q=g-d.top-d.bottom;B.update=function(){N.transition().duration(P).call(B)};B.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var R=N.selectAll(".nv-noData").data([_]);R.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");R.attr("x",p.left+F/2).attr("y",p.top+I/2).text(function(e){return e});return B}else{N.selectAll(".nv-noData").remove()}var U=e.filter(function(e){return!e.disabled&&e.bar});var z=e.filter(function(e){return!e.bar});C=r.xScale();k=o.scale();L=r.yScale();A=t.yScale();O=i.yScale();M=n.yScale();var W=e.filter(function(e){return!e.disabled&&e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});var X=e.filter(function(e){return!e.disabled&&!e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});C.range([0,F]);k.domain(d3.extent(d3.merge(W.concat(X)),function(e){return e.x})).range([0,F]);var V=N.selectAll("g.nv-wrap.nv-linePlusBar").data([e]);var $=V.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");var J=V.select("g");$.append("g").attr("class","nv-legendWrap");var K=$.append("g").attr("class","nv-focus");K.append("g").attr("class","nv-x nv-axis");K.append("g").attr("class","nv-y1 nv-axis");K.append("g").attr("class","nv-y2 nv-axis");K.append("g").attr("class","nv-barsWrap");K.append("g").attr("class","nv-linesWrap");var Q=$.append("g").attr("class","nv-context");Q.append("g").attr("class","nv-x nv-axis");Q.append("g").attr("class","nv-y1 nv-axis");Q.append("g").attr("class","nv-y2 nv-axis");Q.append("g").attr("class","nv-barsWrap");Q.append("g").attr("class","nv-linesWrap");Q.append("g").attr("class","nv-brushBackground");Q.append("g").attr("class","nv-x nv-brush");if(E){c.width(F/2);J.select(".nv-legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)");return e})).call(c);if(p.top!=c.height()){p.top=c.height();I=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g}J.select(".nv-legendWrap").attr("transform","translate("+F/2+","+ -p.top+")")}V.attr("transform","translate("+p.left+","+p.top+")");i.width(F).height(q).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));n.width(F).height(q).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var G=J.select(".nv-context .nv-barsWrap").datum(U.length?U:[{values:[]}]);var Y=J.select(".nv-context .nv-linesWrap").datum(!z[0].disabled?z:[{values:[]}]);J.select(".nv-context").attr("transform","translate(0,"+(I+p.bottom+d.top)+")");G.transition().call(i);Y.transition().call(n);h.x(k).on("brush",it);if(x)h.extent(x);var Z=J.select(".nv-brushBackground").selectAll("g").data([x||h.extent()]);var et=Z.enter().append("g");et.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",q);et.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",q);var tt=J.select(".nv-x.nv-brush").call(h);tt.selectAll("rect").attr("height",q);tt.selectAll(".resize").append("path").attr("d",nt);o.ticks(F/100).tickSize(-q,0);J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+O.range()[0]+")");J.select(".nv-context .nv-x.nv-axis").transition().call(o);f.scale(O).ticks(q/36).tickSize(-F,0);J.select(".nv-context .nv-y1.nv-axis").style("opacity",U.length?1:0).attr("transform","translate(0,"+k.range()[0]+")");J.select(".nv-context .nv-y1.nv-axis").transition().call(f);l.scale(M).ticks(q/36).tickSize(U.length?0:-F,0);J.select(".nv-context .nv-y2.nv-axis").style("opacity",z.length?1:0).attr("transform","translate("+k.range()[1]+",0)");J.select(".nv-context .nv-y2.nv-axis").transition().call(l);c.dispatch.on("stateChange",function(e){B.update()});D.on("tooltipShow",function(e){if(T)H(e,j.parentNode)});it()});return B}var t=e.models.line(),n=e.models.line(),r=e.models.historicalBar(),i=e.models.historicalBar(),s=e.models.axis(),o=e.models.axis(),u=e.models.axis(),a=e.models.axis(),f=e.models.axis(),l=e.models.axis(),c=e.models.legend(),h=d3.svg.brush();var p={top:30,right:30,bottom:30,left:60},d={top:0,right:30,bottom:20,left:60},v=null,m=null,g=100,y=function(e){return e.x},b=function(e){return e.y},w=e.utils.defaultColor(),E=true,S,x=null,T=true,N=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},C,k,L,A,O,M,_="No Data Available.",D=d3.dispatch("tooltipShow","tooltipHide","brush"),P=0;t.clipEdge(true);n.interactive(false);s.orient("bottom").tickPadding(5);u.orient("left");a.orient("right");o.orient("bottom").tickPadding(5);f.orient("left");l.orient("right");var H=function(n,r){if(S){n.pointIndex+=Math.ceil(S[0])}var i=n.pos[0]+(r.offsetLeft||0),o=n.pos[1]+(r.offsetTop||0),f=s.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?u:a).tickFormat()(t.y()(n.point,n.pointIndex)),c=N(n.series.key,f,l,n,B);e.tooltip.show([i,o],c,n.value<0?"n":"s",null,r)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top];D.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)});r.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top];D.tooltipShow(e)});r.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)});D.on("tooltipHide",function(){if(T)e.tooltip.cleanup()});B.dispatch=D;B.legend=c;B.lines=t;B.lines2=n;B.bars=r;B.bars2=i;B.xAxis=s;B.x2Axis=o;B.y1Axis=u;B.y2Axis=a;B.y3Axis=f;B.y4Axis=l;d3.rebind(B,t,"defined","size","clipVoronoi","interpolate");B.options=e.utils.optionsFunc.bind(B);B.x=function(e){if(!arguments.length)return y;y=e;t.x(e);r.x(e);return B};B.y=function(e){if(!arguments.length)return b;b=e;t.y(e);r.y(e);return B};B.margin=function(e){if(!arguments.length)return p;p.top=typeof e.top!="undefined"?e.top:p.top;p.right=typeof e.right!="undefined"?e.right:p.right;p.bottom=typeof e.bottom!="undefined"?e.bottom:p.bottom;p.left=typeof e.left!="undefined"?e.left:p.left;return B};B.width=function(e){if(!arguments.length)return v;v=e;return B};B.height=function(e){if(!arguments.length)return m;m=e;return B};B.color=function(t){if(!arguments.length)return w;w=e.utils.getColor(t);c.color(w);return B};B.showLegend=function(e){if(!arguments.length)return E;E=e;return B};B.tooltips=function(e){if(!arguments.length)return T;T=e;return B};B.tooltipContent=function(e){if(!arguments.length)return N;N=e;return B};B.noData=function(e){if(!arguments.length)return _;_=e;return B};B.brushExtent=function(e){if(!arguments.length)return x;x=e;return B};return B};e.models.multiBar=function(){"use strict";function C(e){e.each(function(e){var C=n-t.left-t.right,k=r-t.top-t.bottom,L=d3.select(this);if(d&&e.length)d=[{values:e[0].values.map(function(e){return{x:e.x,y:0,series:e.series,size:.01}})}];if(c)e=d3.layout.stack().offset(h).values(function(e){return e.values}).y(a)(!e.length&&d?d:e);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});if(c)e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y);if(t.y<0){t.y1=i;i=i-t.size}else{t.y1=t.size+r;r=r+t.size}})});var A=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});i.domain(y||d3.merge(A).map(function(e){return e.x})).rangeBands(w||[0,C],S);s.domain(b||d3.extent(d3.merge(A).map(function(e){return c?e.y>0?e.y1:e.y1+e.y:e.y}).concat(f))).range(E||[k,0]);if(i.domain()[0]===i.domain()[1])i.domain()[0]?i.domain([i.domain()[0]-i.domain()[0]*.01,i.domain()[1]+i.domain()[1]*.01]):i.domain([-1,1]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]+s.domain()[0]*.01,s.domain()[1]-s.domain()[1]*.01]):s.domain([-1,1]);T=T||i;N=N||s;var O=L.selectAll("g.nv-wrap.nv-multibar").data([e]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar");var _=M.append("defs");var D=M.append("g");var P=O.select("g");D.append("g").attr("class","nv-groups");O.attr("transform","translate("+t.left+","+t.top+")");_.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect");O.select("#nv-edge-clip-"+o+" rect").attr("width",C).attr("height",k);P.attr("clip-path",l?"url(#nv-edge-clip-"+o+")":"");var H=O.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});H.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);H.exit().transition().selectAll("rect.nv-bar").delay(function(t,n){return n*g/e[0].values.length}).attr("y",function(e){return c?N(e.y0):N(0)}).attr("height",0).remove();H.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return p(e,t)}).style("stroke",function(e,t){return p(e,t)});H.transition().style("stroke-opacity",1).style("fill-opacity",.75);var B=H.selectAll("rect.nv-bar").data(function(t){return d&&!e.length?d.values:t.values});B.exit().remove();var j=B.enter().append("rect").attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,n,r){return c?0:r*i.rangeBand()/e.length}).attr("y",function(e){return N(c?e.y0:0)}).attr("height",0).attr("width",i.rangeBand()/(c?1:e.length)).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});B.style("fill",function(e,t,n){return p(e,n,t)}).style("stroke",function(e,t,n){return p(e,n,t)}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);x.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);x.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){x.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){x.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});B.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).transition().attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});if(v){if(!m)m=e.map(function(){return true});B.style("fill",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()})}if(c)B.transition().delay(function(t,n){return n*g/e[0].values.length}).attr("y",function(e,t){return s(c?e.y1:0)}).attr("height",function(e,t){if(e.y==null)return 0;return Math.max(Math.abs(s(e.y+(c?e.y0:0))-s(c?e.y0:0)),1)}).attr("x",function(t,n){return c?0:t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/(c?1:e.length));else B.transition().delay(function(t,n){return n*g/e[0].values.length}).attr("x",function(t,n){return t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/e.length).attr("y",function(e,t){return a(e,t)<0?s(0):s(0)-s(a(e,t))<1?s(0)-1:s(a(e,t))||0}).attr("height",function(e,t){if(e.y==null)return 0;return Math.max(Math.abs(s(a(e,t))-s(0)),1)||0});T=i.copy();N=s.copy()});return C}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=d3.scale.ordinal(),s=d3.scale.linear(),o=Math.floor(Math.random()*1e4),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=true,c=false,h="zero",p=e.utils.defaultColor(),d=false,v=null,m,g=1200,y,b,w,E,S=.1,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var T,N;C.dispatch=x;C.options=e.utils.optionsFunc.bind(C);C.x=function(e){if(!arguments.length)return u;u=e;return C};C.y=function(e){if(!arguments.length)return a;a=e;return C};C.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return C};C.width=function(e){if(!arguments.length)return n;n=e;return C};C.height=function(e){if(!arguments.length)return r;r=e;return C};C.xScale=function(e){if(!arguments.length)return i;i=e;return C};C.yScale=function(e){if(!arguments.length)return s;s=e;return C};C.xDomain=function(e){if(!arguments.length)return y;y=e;return C};C.yDomain=function(e){if(!arguments.length)return b;b=e;return C};C.xRange=function(e){if(!arguments.length)return w;w=e;return C};C.yRange=function(e){if(!arguments.length)return E;E=e;return C};C.forceY=function(e){if(!arguments.length)return f;f=e;return C};C.stacked=function(e){if(!arguments.length)return c;c=e;return C};C.stackOffset=function(e){if(!arguments.length)return h;h=e;return C};C.clipEdge=function(e){if(!arguments.length)return l;l=e;return C};C.color=function(t){if(!arguments.length)return p;p=e.utils.getColor(t);return C};C.barColor=function(t){if(!arguments.length)return v;v=e.utils.getColor(t);return C};C.disabled=function(e){if(!arguments.length)return m;m=e;return C};C.id=function(e){if(!arguments.length)return o;o=e;return C};C.hideable=function(e){if(!arguments.length)return d;d=e;return C};C.delay=function(e){if(!arguments.length)return g;g=e;return C};C.groupSpacing=function(e){if(!arguments.length)return S;S=e;return C};return C};e.models.multiBarChart=function(){"use strict";function M(e){e.each(function(e){var h=d3.select(this),E=this;var _=(u||parseInt(h.style("width"))||960)-o.left-o.right,D=(a||parseInt(h.style("height"))||400)-o.top-o.bottom;M.update=function(){h.transition().duration(A).call(M)};M.container=this;if(w=="right")_=_-250;T.disabled=e.map(function(e){return!!e.disabled});if(!N){var P;N={};for(P in T){if(T[P]instanceof Array)N[P]=T[P].slice(0);else N[P]=T[P]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var H=h.selectAll(".nv-noData").data([C]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");H.attr("x",o.left+_/2).attr("y",o.top+D/2).text(function(e){return e});return M}else{h.selectAll(".nv-noData").remove()}S=t.xScale();x=t.yScale();var B=h.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([e]);var j=B.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g");var F=B.select("g");j.append("g").attr("class","nv-x nv-axis");j.append("g").attr("class","nv-y nv-axis");j.append("g").attr("class","nv-barsWrap");j.append("g").attr("class","nv-legendWrap");j.append("g").attr("class","nv-controlsWrap");if(c){i.width(_-L());if(t.barColor())e.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()});F.select(".nv-legendWrap").datum(e).call(i);if(o.top!=i.height()){o.top=i.height();D=(a||parseInt(h.style("height"))||400)-o.top-o.bottom}if(w=="right"){F.select(".nv-legendWrap").attr("transform","translate("+_+","+(-o.top+20+30)+")")}else{F.select(".nv-legendWrap").attr("transform","translate("+L()+","+ -o.top+")")}}if(l){var I=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(L()).color(["#444","#444","#444"]);F.select(".nv-controlsWrap").datum(I).call(s);if(w=="right"){F.select(".nv-controlsWrap").attr("transform","translate("+_+","+(-o.top+20)+")")}else{F.select(".nv-controlsWrap").attr("transform","translate("+0+","+ -o.top+")")}}B.attr("transform","translate("+o.left+","+o.top+")");if(v){F.select(".nv-y.nv-axis").attr("transform","translate("+_+",0)")}t.disabled(e.map(function(e){return e.disabled})).width(_).height(D).color(e.map(function(e,t){return e.color||f(e,t)}).filter(function(t,n){return!e[n].disabled}));var q=F.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));q.transition().call(t);if(p){n.scale(S).ticks(_/100).tickSize(-D,0);F.select(".nv-x.nv-axis").attr("transform","translate(0,"+x.range()[0]+")");F.select(".nv-x.nv-axis").transition().call(n);var R=F.select(".nv-x.nv-axis > g").selectAll("g");R.selectAll("line, text").style("opacity",1);if(g){var U=function(e,t){return"translate("+e+","+t+")"};var z=5,W=17;R.selectAll("text").attr("transform",function(e,t,n){return U(0,n%2==0?z:W)});var X=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;F.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(e,t){return U(0,t===0||X%2!==0?W:z)})}if(m)R.filter(function(t,n){return n%Math.ceil(e[0].values.length/(_/100))!==0}).selectAll("text, line").style("opacity",0);if(y)R.selectAll(".tick text").attr("transform","rotate("+y+" 0,0)").style("text-anchor",y>0?"start":"end");F.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}if(d){r.scale(x).ticks(D/36).tickSize(-_,0);F.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("stateChange",function(e){T=e;k.stateChange(T);M.update()});s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;I=I.map(function(e){e.disabled=true;return e});e.disabled=false;switch(e.key){case"Grouped":t.stacked(false);break;case"Stacked":t.stacked(true);break}T.stacked=t.stacked();k.stateChange(T);M.update()});k.on("tooltipShow",function(e){if(b)O(e,E.parentNode)});k.on("changeState",function(n){if(typeof n.disabled!=="undefined"){e.forEach(function(e,t){e.disabled=n.disabled[t]});T.disabled=n.disabled}if(typeof n.stacked!=="undefined"){t.stacked(n.stacked);T.stacked=n.stacked}M.update()})});return M}var t=e.models.multiBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend();var o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=true,c=true,h=false,p=true,d=true,v=false,m=true,g=false,y=0,b=true,w="top",E=function(e,t,n,r,i,s){if(s){var o=d3.format(",.2f");return"<h3>"+e+"</h3>"+"<p>"+o(Math.pow(10,n))+" on "+t+"</p>"}else{return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"}},S,x,T={stacked:false},N=null,C="No Data Available.",k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=function(){return l?180:0},A=250;t.stacked(false);n.orient("bottom").tickPadding(7).highlightZero(true).showMaxMin(false).tickFormat(function(e){return e});r.orient(v?"right":"left").tickFormat(d3.format(",.1f"));s.updateState(false);var O=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=E(i.series.key,a,f,i,M,h);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];k.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(b)e.tooltip.cleanup()});M.dispatch=k;M.multibar=t;M.legend=i;M.xAxis=n;M.yAxis=r;d3.rebind(M,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","stacked","stackOffset","delay","barColor","groupSpacing");M.options=e.utils.optionsFunc.bind(M);M.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return M};M.width=function(e){if(!arguments.length)return u;u=e;return M};M.height=function(e){if(!arguments.length)return a;a=e;return M};M.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);i.color(f);return M};M.showControls=function(e){if(!arguments.length)return l;l=e;return M};M.showLegend=function(e){if(!arguments.length)return c;c=e;return M};M.logScale=function(e){if(!arguments.length)return h;h=e;return M};M.showXAxis=function(e){if(!arguments.length)return p;p=e;return M};M.showYAxis=function(e){if(!arguments.length)return d;d=e;return M};M.rightAlignYAxis=function(e){if(!arguments.length)return v;v=e;r.orient(e?"right":"left");return M};M.reduceXTicks=function(e){if(!arguments.length)return m;m=e;return M};M.rotateLabels=function(e){if(!arguments.length)return y;y=e;return M};M.staggerLabels=function(e){if(!arguments.length)return g;g=e;return M};M.tooltip=function(e){if(!arguments.length)return E;E=e;return M};M.tooltips=function(e){if(!arguments.length)return b;b=e;return M};M.legendPos=function(e){if(!arguments.length)return w;w=e;return M};M.tooltipContent=function(e){if(!arguments.length)return E;E=e;return M};M.state=function(e){if(!arguments.length)return T;T=e;return M};M.defaultState=function(e){if(!arguments.length)return N;N=e;return M};M.noData=function(e){if(!arguments.length)return C;C=e;return M};M.transitionDuration=function(e){if(!arguments.length)return A;A=e;return M};return M};e.models.multiBarHorizontal=function(){"use strict";function N(e){e.each(function(e){var i=n-t.left-t.right,g=r-t.top-t.bottom,N=d3.select(this);if(p)e=d3.layout.stack().offset("zero").values(function(e){return e.values}).y(a)(e);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});if(p)e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y);if(t.y<0){t.y1=i-t.size;i=i-t.size}else{t.y1=r;r=r+t.size}})});var C=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});s.domain(y||d3.merge(C).map(function(e){return e.x})).rangeBands(w||[0,g],.1);o.domain(b||d3.extent(d3.merge(C).map(function(e){return p?e.y>0?e.y1+e.y:e.y1:e.y}).concat(f)));if(d&&!p)o.range(E||[o.domain()[0]<0?v:0,i-(o.domain()[1]>0?v:0)]);else o.range(E||[0,i]);x=x||s;T=T||d3.scale.linear().domain(o.domain()).range([o(0),o(0)]);var k=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([e]);var L=k.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal");var A=L.append("defs");var O=L.append("g");var M=k.select("g");O.append("g").attr("class","nv-groups");k.attr("transform","translate("+t.left+","+t.top+")");var _=k.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});_.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);_.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();_.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return l(e,t)}).style("stroke",function(e,t){return l(e,t)});_.transition().style("stroke-opacity",1).style("fill-opacity",.75);var D=_.selectAll("g.nv-bar").data(function(e){return e.values});D.exit().remove();var P=D.enter().append("g").attr("transform",function(t,n,r){return"translate("+T(p?t.y0:0)+","+(p?0:r*s.rangeBand()/e.length+s(u(t,n)))+")"});P.append("rect").attr("width",0).attr("height",s.rangeBand()/(p?1:e.length));D.on("mouseover",function(t,n){d3.select(this).classed("hover",true);S.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[o(a(t,n)+(p?t.y0:0)),s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);S.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){S.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){S.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});P.append("text");if(d&&!p){D.select("text").attr("text-anchor",function(e,t){return a(e,t)<0?"end":"start"}).attr("y",s.rangeBand()/(e.length*2)).attr("dy",".32em").text(function(e,t){return m(a(e,t))});D.transition().select("text").attr("x",function(e,t){return a(e,t)<0?-4:o(a(e,t))-o(0)+4})}else{D.selectAll("text").text("")}D.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"});if(c){if(!h)h=e.map(function(){return true});D.style("fill",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()})}if(p)D.transition().attr("transform",function(e,t){return"translate("+o(e.y1)+","+s(u(e,t))+")"}).select("rect").attr("width",function(e,t){return Math.abs(o(a(e,t)+e.y0)-o(e.y0))}).attr("height",s.rangeBand());else D.transition().attr("transform",function(t,n){return"translate("+(a(t,n)<0?o(a(t,n)):o(0))+","+(t.series*s.rangeBand()/e.length+s(u(t,n)))+")"}).select("rect").attr("height",s.rangeBand()/e.length).attr("width",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(0)),1)});x=s.copy();T=o.copy()});return N}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=null,h,p=false,d=false,v=60,m=d3.format(",.2f"),g=1200,y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var x,T;N.dispatch=S;N.options=e.utils.optionsFunc.bind(N);N.x=function(e){if(!arguments.length)return u;u=e;return N};N.y=function(e){if(!arguments.length)return a;a=e;return N};N.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return N};N.width=function(e){if(!arguments.length)return n;n=e;return N};N.height=function(e){if(!arguments.length)return r;r=e;return N};N.xScale=function(e){if(!arguments.length)return s;s=e;return N};N.yScale=function(e){if(!arguments.length)return o;o=e;return N};N.xDomain=function(e){if(!arguments.length)return y;y=e;return N};N.yDomain=function(e){if(!arguments.length)return b;b=e;return N};N.xRange=function(e){if(!arguments.length)return w;w=e;return N};N.yRange=function(e){if(!arguments.length)return E;E=e;return N};N.forceY=function(e){if(!arguments.length)return f;f=e;return N};N.stacked=function(e){if(!arguments.length)return p;p=e;return N};N.color=function(t){if(!arguments.length)return l;l=e.utils.getColor(t);return N};N.barColor=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);return N};N.disabled=function(e){if(!arguments.length)return h;h=e;return N};N.id=function(e){if(!arguments.length)return i;i=e;return N};N.delay=function(e){if(!arguments.length)return g;g=e;return N};N.showValues=function(e){if(!arguments.length)return d;d=e;return N};N.valueFormat=function(e){if(!arguments.length)return m;m=e;return N};N.valuePadding=function(e){if(!arguments.length)return v;v=e;return N};return N};e.models.multiBarHorizontalChart=function(){"use strict";function C(e){e.each(function(h){var p=d3.select(this),m=this;var k=(u||parseInt(p.style("width"))||960)-o.left-o.right,L=(a||parseInt(p.style("height"))||400)-o.top-o.bottom;C.update=function(){p.transition().duration(T).call(C)};C.container=this;if(v=="right")k=k-250;b.disabled=h.map(function(e){return!!e.disabled});if(!w){var A;w={};for(A in b){if(b[A]instanceof Array)w[A]=b[A].slice(0);else w[A]=b[A]}}if(!h||!h.length||!h.filter(function(e){return e.values.length}).length){var O=p.selectAll(".nv-noData").data([E]);O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");O.attr("x",o.left+k/2).attr("y",o.top+L/2).text(function(e){return e});return C}else{p.selectAll(".nv-noData").remove()}g=t.xScale();y=t.yScale();var M=p.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([h]);var _=M.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g");var D=M.select("g");_.append("g").attr("class","nv-x nv-axis");_.append("g").attr("class","nv-y nv-axis");_.append("g").attr("class","nv-barsWrap");_.append("g").attr("class","nv-legendWrap");_.append("g").attr("class","nv-controlsWrap");if(c){i.width(k-x());if(t.barColor())h.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()});D.select(".nv-legendWrap").datum(h).call(i);if(o.top!=i.height()){o.top=i.height();L=(a||parseInt(p.style("height"))||400)-o.top-o.bottom}if(v=="right"){D.select(".nv-legendWrap").attr("transform","translate("+x()+","+20+")")}else{D.select(".nv-legendWrap").attr("transform","translate("+x()+","+ -o.top+")")}}if(l){var P=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(x()).color(["#444","#444","#444"]);D.select(".nv-controlsWrap").datum(P).attr("transform","translate(0,"+ -o.top+")").call(s)}M.attr("transform","translate("+o.left+","+o.top+")");t.disabled(h.map(function(e){return e.disabled})).width(k).height(L).color(h.map(function(e,t){return e.color||f(e,t)}).filter(function(e,t){return!h[t].disabled}));var H=D.select(".nv-barsWrap").datum(h.filter(function(e){return!e.disabled}));H.transition().call(t);n.scale(g).ticks(L/24).tickSize(-k,0);D.select(".nv-x.nv-axis").transition().call(n);var B=D.select(".nv-x.nv-axis").selectAll("g");B.selectAll("line, text").style("opacity",1);r.scale(y).ticks(k/100).tickSize(-L,0);D.select(".nv-y.nv-axis").attr("transform","translate(0,"+L+")");D.select(".nv-y.nv-axis").transition().call(r);i.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);C.update()});s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;P=P.map(function(e){e.disabled=true;return e});e.disabled=false;switch(e.key){case"Grouped":t.stacked(false);break;case"Stacked":t.stacked(true);break}b.stacked=t.stacked();S.stateChange(b);C.update()});S.on("tooltipShow",function(e){if(d)N(e,m.parentNode)});S.on("changeState",function(n){if(typeof n.disabled!=="undefined"){h.forEach(function(e,t){e.disabled=n.disabled[t]});b.disabled=n.disabled}if(typeof n.stacked!=="undefined"){t.stacked(n.stacked);b.stacked=n.stacked}e.call(C)})});return C}var t=e.models.multiBarHorizontal(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend().height(30),s=e.models.legend().height(30);var o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=true,c=true,h=false,p=false,d=true,v="top",m=function(e,t,n,i,s,o){if(o){return"<h3>"+e+" - "+t+"</h3>"+"<p>"+r.tickFormat()(Math.pow(10,n))+"</p>"}else{return"<h3>"+e+" - "+t+"</h3>"+"<p>"+n+"</p>"}},g,y,b={stacked:p},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=function(){return l?180:0},T=250;t.stacked(p);n.orient("left").tickPadding(5).highlightZero(false).showMaxMin(false).tickFormat(function(e){return e});r.orient("bottom").tickFormat(d3.format(",.1f"));s.updateState(false);var N=function(i,s){var o=0;if(i.pos[0]>=200)o=200;else o=i.pos[0];if(h)l=t.y()(i.point,i.pointIndex);else l=r.tickFormat()(t.y()(i.point,i.pointIndex));var u=o+(s.offsetLeft||0),a=i.pos[1]+(s.offsetTop||0),f=n.tickFormat()(t.x()(i.point,i.pointIndex)),l=r.tickFormat()(t.y()(i.point,i.pointIndex)),c=m(i.series.key,f,l,i,C,h);e.tooltip.show([u,a],c,i.value<0?"e":"w",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(d)e.tooltip.cleanup()});C.dispatch=S;C.multibar=t;C.legend=i;C.xAxis=n;C.yAxis=r;d3.rebind(C,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked","barColor");C.options=e.utils.optionsFunc.bind(C);C.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return C};C.width=function(e){if(!arguments.length)return u;u=e;return C};C.height=function(e){if(!arguments.length)return a;a=e;return C};C.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);i.color(f);return C};C.showControls=function(e){if(!arguments.length)return l;l=e;return C};C.showLegend=function(e){if(!arguments.length)return c;c=e;return C};C.logScale=function(e){if(!arguments.length)return h;h=e;return C};C.tooltip=function(e){if(!arguments.length)return m;m=e;return C};C.tooltips=function(e){if(!arguments.length)return d;d=e;return C};C.legendPos=function(e){if(!arguments.length)return v;v=e;return C};C.tooltipContent=function(e){if(!arguments.length)return m;m=e;return C};C.state=function(e){if(!arguments.length)return b;b=e;return C};C.defaultState=function(e){if(!arguments.length)return w;w=e;return C};C.noData=function(e){if(!arguments.length)return E;E=e;return C};C.transitionDuration=function(e){if(!arguments.length)return T;T=e;return C};return C};e.models.multiChart=function(){"use strict";function L(e){e.each(function(e){var f=d3.select(this),c=this;L.update=function(){f.transition().call(L)};L.container=this;var h=(r||parseInt(f.style("width"))||960)-t.left-t.right,p=(i||parseInt(f.style("height"))||400)-t.top-t.bottom;if(a=="right")h=h-250;var A=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==1});var O=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==2});var M=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==1});var _=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==2});var D=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==1});var P=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==2});var H=e.filter(function(e){return!e.disabled&&e.yAxis==1}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});var B=e.filter(function(e){return!e.disabled&&e.yAxis==2}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});l.domain(d3.extent(d3.merge(H.concat(B)),function(e){return e.x})).range([0,h]);var j=f.selectAll("g.wrap.multiChart").data([e]);var F=j.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");F.append("g").attr("class","x axis");F.append("g").attr("class","y1 axis");F.append("g").attr("class","y2 axis");F.append("g").attr("class","lines1Wrap");F.append("g").attr("class","lines2Wrap");F.append("g").attr("class","bars1Wrap");F.append("g").attr("class","bars2Wrap");F.append("g").attr("class","stack1Wrap");F.append("g").attr("class","stack2Wrap");F.append("g").attr("class","legendWrap");var I=j.select("g");if(s){N.width(h/2);I.select(".legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.yAxis==1?"":" (right axis)");return e})).call(N);if(t.top!=N.height()){t.top=N.height();p=(i||parseInt(f.style("height"))||400)-t.top-t.bottom}if(a=="right"){I.select(".legendWrap").attr("transform","translate("+h+","+20+")")}else{I.select(".legendWrap").attr("transform","translate("+h/2+","+ -t.top+")")}}m.width(h).height(p).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="line"}));g.width(h).height(p).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="line"}));y.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="bar"}));b.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="bar"}));w.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="area"}));E.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="area"}));if(a=="right"){I.attr("transform","translate("+t.left+","+"20"+")")}else{I.attr("transform","translate("+t.left+","+t.top+")")}var q=I.select(".lines1Wrap").datum(A);var R=I.select(".bars1Wrap").datum(M);var U=I.select(".stack1Wrap").datum(D);var z=I.select(".lines2Wrap").datum(O);var W=I.select(".bars2Wrap").datum(_);var X=I.select(".stack2Wrap").datum(P);var V=D.length?D.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];var $=P.length?P.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];d.domain(d3.extent(d3.extent(d3.merge(H).concat(V),function(e){return e.y}).concat(m.forceY()))).range([0,p]);v.domain(d3.extent(d3.extent(d3.merge(B).concat($),function(e){return e.y}).concat(g.forceY()))).range([0,p]);m.yDomain(d.domain());y.yDomain(d.domain());w.yDomain(d.domain());g.yDomain(v.domain());b.yDomain(v.domain());E.yDomain(v.domain());if(D.length){d3.transition(U).call(w)}if(P.length){d3.transition(X).call(E)}if(M.length){d3.transition(R).call(y)}if(_.length){d3.transition(W).call(b)}if(A.length){d3.transition(q).call(m)}if(O.length){d3.transition(z).call(g)}S.ticks(h/100).tickSize(-p,0);I.select(".x.axis").attr("transform","translate(0,"+p+")");d3.transition(I.select(".x.axis")).call(S);x.ticks(p/36).tickSize(-h,0);d3.transition(I.select(".y1.axis")).call(x);T.ticks(p/36).tickSize(-h,0);d3.transition(I.select(".y2.axis")).call(T);I.select(".y2.axis").style("opacity",B.length?1:0).attr("transform","translate("+l.range()[1]+",0)");N.dispatch.on("stateChange",function(e){L.update()});if(u){N.dualaxis(true)}else{N.dualaxis(false)}C.on("tooltipShow",function(e){if(o)k(e,c.parentNode)})});return L}var t={top:30,right:20,bottom:50,left:60},n=d3.scale.category20().range(),r=null,i=null,s=true,o=true,u=false,a="top",f=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},l,c,h,p;var l=d3.scale.linear(),d=d3.scale.linear(),v=d3.scale.linear(),m=e.models.line().yScale(d),g=e.models.line().yScale(v),y=e.models.multiBar().stacked(false).yScale(d),b=e.models.multiBar().stacked(false).yScale(v),w=e.models.stackedArea().yScale(d),E=e.models.stackedArea().yScale(v),S=e.models.axis().scale(l).orient("bottom").tickPadding(5),x=e.models.axis().scale(d).orient("left"),T=e.models.axis().scale(v).orient("right"),N=e.models.legend().height(30),C=d3.dispatch("tooltipShow","tooltipHide");var k=function(t,n){var r=t.pos[0]+(n.offsetLeft||0),i=t.pos[1]+(n.offsetTop||0),s=S.tickFormat()(m.x()(t.point,t.pointIndex)),o=(t.series.yAxis==2?T:x).tickFormat()(m.y()(t.point,t.pointIndex)),u=f(t.series.key,s,o,t,L);e.tooltip.show([r,i],u,undefined,undefined,n.offsetParent)};m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});m.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});g.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});y.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});y.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});b.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});b.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});w.dispatch.on("tooltipShow",function(e){if(!Math.round(w.y()(e.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],C.tooltipShow(e)});w.dispatch.on("tooltipHide",function(e){C.tooltipHide(e)});E.dispatch.on("tooltipShow",function(e){if(!Math.round(E.y()(e.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],C.tooltipShow(e)});E.dispatch.on("tooltipHide",function(e){C.tooltipHide(e)});m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});m.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});g.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});C.on("tooltipHide",function(){if(o)e.tooltip.cleanup()});L.dispatch=C;L.lines1=m;L.lines2=g;L.bars1=y;L.bars2=b;L.stack1=w;L.stack2=E;L.xAxis=S;L.yAxis1=x;L.yAxis2=T;L.options=e.utils.optionsFunc.bind(L);L.x=function(e){if(!arguments.length)return getX;getX=e;m.x(e);y.x(e);return L};L.y=function(e){if(!arguments.length)return getY;getY=e;m.y(e);y.y(e);return L};L.yDomain1=function(e){if(!arguments.length)return h;h=e;return L};L.yDomain2=function(e){if(!arguments.length)return p;p=e;return L};L.margin=function(e){if(!arguments.length)return t;t=e;return L};L.width=function(e){if(!arguments.length)return r;r=e;return L};L.height=function(e){if(!arguments.length)return i;i=e;return L};L.color=function(e){if(!arguments.length)return n;n=e;N.color(e);return L};L.showLegend=function(e){if(!arguments.length)return s;s=e;return L};L.tooltips=function(e){if(!arguments.length)return o;o=e;return L};L.dualaxis=function(e){if(!arguments.length)return u;u=e;return L};L.legendPos=function(e){if(!arguments.length)return a;a=e;return L};L.tooltipContent=function(e){if(!arguments.length)return f;f=e;return L};return L};e.models.ohlcBar=function(){"use strict";function x(e){e.each(function(e){var g=n-t.left-t.right,x=r-t.top-t.bottom,T=d3.select(this);s.domain(y||d3.extent(e[0].values.map(u).concat(p)));if(v)s.range(w||[g*.5/e[0].values.length,g*(e[0].values.length-.5)/e[0].values.length]);else s.range(w||[0,g]);o.domain(b||[d3.min(e[0].values.map(h).concat(d)),d3.max(e[0].values.map(c).concat(d))]).range(E||[x,0]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1]);if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]);var N=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([e[0].values]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar");var k=C.append("defs");var L=C.append("g");var A=N.select("g");L.append("g").attr("class","nv-ticks");N.attr("transform","translate("+t.left+","+t.top+")");T.on("click",function(e,t){S.chartClick({data:e,index:t,pos:d3.event,id:i})});k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect");N.select("#nv-chart-clip-path-"+i+" rect").attr("width",g).attr("height",x);A.attr("clip-path",m?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-ticks").selectAll(".nv-tick").data(function(e){return e});O.exit().remove();var M=O.enter().append("path").attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"}).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);S.elementMouseover({point:t,series:e[0],pos:[s(u(t,n)),o(a(t,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);S.elementMouseout({point:t,series:e[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(e,t){S.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()}).on("dblclick",function(e,t){S.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()});O.attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t});d3.transition(O).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"})});return x}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=function(e){return e.open},l=function(e){return e.close},c=function(e){return e.high},h=function(e){return e.low},p=[],d=[],v=false,m=true,g=e.utils.defaultColor(),y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");x.dispatch=S;x.options=e.utils.optionsFunc.bind(x);x.x=function(e){if(!arguments.length)return u;u=e;return x};x.y=function(e){if(!arguments.length)return a;a=e;return x};x.open=function(e){if(!arguments.length)return f;f=e;return x};x.close=function(e){if(!arguments.length)return l;l=e;return x};x.high=function(e){if(!arguments.length)return c;c=e;return x};x.low=function(e){if(!arguments.length)return h;h=e;return x};x.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return x};x.width=function(e){if(!arguments.length)return n;n=e;return x};x.height=function(e){if(!arguments.length)return r;r=e;return x};x.xScale=function(e){if(!arguments.length)return s;s=e;return x};x.yScale=function(e){if(!arguments.length)return o;o=e;return x};x.xDomain=function(e){if(!arguments.length)return y;y=e;return x};x.yDomain=function(e){if(!arguments.length)return b;b=e;return x};x.xRange=function(e){if(!arguments.length)return w;w=e;return x};x.yRange=function(e){if(!arguments.length)return E;E=e;return x};x.forceX=function(e){if(!arguments.length)return p;p=e;return x};x.forceY=function(e){if(!arguments.length)return d;d=e;return x};x.padData=function(e){if(!arguments.length)return v;v=e;return x};x.clipEdge=function(e){if(!arguments.length)return m;m=e;return x};x.color=function(t){if(!arguments.length)return g;g=e.utils.getColor(t);return x};x.id=function(e){if(!arguments.length)return i;i=e;return x};return x};e.models.pie=function(){"use strict";function E(e){e.each(function(e){function P(e){var t=(e.startAngle+e.endAngle)*90/Math.PI-90;return t>90?t-180:t}function H(e){e.endAngle=isNaN(e.endAngle)?0:e.endAngle;e.startAngle=isNaN(e.startAngle)?0:e.startAngle;if(!v)e.innerRadius=0;var t=d3.interpolate(this._current,e);this._current=t(0);return function(e){return L(t(e))}}function B(e){e.innerRadius=0;var t=d3.interpolate({startAngle:0,endAngle:0},e);return function(e){return L(t(e))}}var o=n-t.left-t.right,f=r-t.top-t.bottom,E=Math.min(o,f)/2,S=E-E/5,x=d3.select(this);var T=x.selectAll(".nv-wrap.nv-pie").data(e);var N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+u);var C=N.append("g");var k=T.select("g");C.append("g").attr("class","nv-pie");T.attr("transform","translate("+t.left+","+t.top+")");k.select(".nv-pie").attr("transform","translate("+o/2+","+f/2+")");x.on("click",function(e,t){w.chartClick({data:e,index:t,pos:d3.event,id:u})});var L=d3.svg.arc().outerRadius(S);if(g)L.startAngle(g);if(y)L.endAngle(y);if(v)L.innerRadius(E*b);var A=d3.layout.pie().sort(null).value(function(e){return e.disabled?0:s(e)});var O=T.select(".nv-pie").selectAll(".nv-slice").data(A);O.exit().remove();var M=O.enter().append("g").attr("class","nv-slice").on("mouseover",function(e,t){d3.select(this).classed("hover",true);w.elementMouseover({label:i(e.data),value:s(e.data),point:e.data,pointIndex:t,pos:[d3.event.pageX,d3.event.pageY],id:u})}).on("mouseout",function(e,t){d3.select(this).classed("hover",false);w.elementMouseout({label:i(e.data),value:s(e.data),point:e.data,index:t,id:u})}).on("click",function(e,t){w.elementClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u});d3.event.stopPropagation()}).on("dblclick",function(e,t){w.elementDblClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u});d3.event.stopPropagation()});O.attr("fill",function(e,t){return a(e,t)}).attr("stroke",function(e,t){return a(e,t)});var _=M.append("path").each(function(e){this._current=e});d3.transition(O.select("path")).attr("d",L).attrTween("d",H);if(l){var D=d3.svg.arc().innerRadius(0);if(c){D=L}if(h){D=d3.svg.arc().outerRadius(L.outerRadius())}M.append("g").classed("nv-label",true).each(function(e,t){var n=d3.select(this);n.attr("transform",function(e){if(m){e.outerRadius=S+10;e.innerRadius=S+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);if((e.startAngle+e.endAngle)/2<Math.PI){t-=90}else{t+=90}return"translate("+D.centroid(e)+") rotate("+t+")"}else{e.outerRadius=E+10;e.innerRadius=E+15;return"translate("+D.centroid(e)+")"}});n.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3);n.append("text").style("text-anchor",m?(e.startAngle+e.endAngle)/2<Math.PI?"start":"end":"middle").style("fill","#000")});O.select(".nv-label").transition().attr("transform",function(e){if(m){e.outerRadius=S+10;e.innerRadius=S+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);if((e.startAngle+e.endAngle)/2<Math.PI){t-=90}else{t+=90}return"translate("+D.centroid(e)+") rotate("+t+")"}else{e.outerRadius=E+10;e.innerRadius=E+15;return"translate("+D.centroid(e)+")"}});O.each(function(e,t){var n=d3.select(this);n.select(".nv-label text").style("text-anchor",m?(e.startAngle+e.endAngle)/2<Math.PI?"start":"end":"middle").text(function(e,t){var n=(e.endAngle-e.startAngle)/(2*Math.PI);var r={key:i(e.data),value:s(e.data),percent:d3.format("%")(n)};return e.value&&n>d?r[p]:""});var r=n.select("text").node().getBBox();n.select(".nv-label rect").attr("width",r.width+10).attr("height",r.height+10).attr("transform",function(){return"translate("+[r.x-5,r.y-5]+")"})})}});return E}var t={top:0,right:0,bottom:0,left:0},n=500,r=500,i=function(e){return e.x},s=function(e){return e.y},o=function(e){return e.description},u=Math.floor(Math.random()*1e4),a=e.utils.defaultColor(),f=d3.format(",.2f"),l=true,c=true,h=false,p="key",d=.02,v=false,m=false,g=false,y=false,b=.5,w=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");E.dispatch=w;E.options=e.utils.optionsFunc.bind(E);E.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return E};E.width=function(e){if(!arguments.length)return n;n=e;return E};E.height=function(e){if(!arguments.length)return r;r=e;return E};E.values=function(t){e.log("pie.values() is no longer supported.");return E};E.x=function(e){if(!arguments.length)return i;i=e;return E};E.y=function(e){if(!arguments.length)return s;s=d3.functor(e);return E};E.description=function(e){if(!arguments.length)return o;o=e;return E};E.showLabels=function(e){if(!arguments.length)return l;l=e;return E};E.labelSunbeamLayout=function(e){if(!arguments.length)return m;m=e;return E};E.donutLabelsOutside=function(e){if(!arguments.length)return h;h=e;return E};E.pieLabelsOutside=function(e){if(!arguments.length)return c;c=e;return E};E.labelType=function(e){if(!arguments.length)return p;p=e;p=p||"key";return E};E.donut=function(e){if(!arguments.length)return v;v=e;return E};E.donutRatio=function(e){if(!arguments.length)return b;b=e;return E};E.startAngle=function(e){if(!arguments.length)return g;g=e;return E};E.endAngle=function(e){if(!arguments.length)return y;y=e;return E};E.id=function(e){if(!arguments.length)return u;u=e;return E};E.color=function(t){if(!arguments.length)return a;a=e.utils.getColor(t);return E};E.valueFormat=function(e){if(!arguments.length)return f;f=e;return E};E.labelThreshold=function(e){if(!arguments.length)return d;d=e;return E};return E};e.models.pieChart=function(){"use strict";function v(e){e.each(function(e){var u=d3.select(this),a=this;var f=(i||parseInt(u.style("width"))||960)-r.left-r.right,d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom;v.update=function(){u.transition().call(v)};v.container=this;l.disabled=e.map(function(e){return!!e.disabled});if(!c){var m;c={};for(m in l){if(l[m]instanceof Array)c[m]=l[m].slice(0);else c[m]=l[m]}}if(!e||!e.length){var g=u.selectAll(".nv-noData").data([h]);g.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");g.attr("x",r.left+f/2).attr("y",r.top+d/2).text(function(e){return e});return v}else{u.selectAll(".nv-noData").remove()}var y=u.selectAll("g.nv-wrap.nv-pieChart").data([e]);var b=y.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g");var w=y.select("g");b.append("g").attr("class","nv-pieWrap");b.append("g").attr("class","nv-legendWrap");if(o){n.width(f).key(t.x());y.select(".nv-legendWrap").datum(e).call(n);if(r.top!=n.height()){r.top=n.height();d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom}y.select(".nv-legendWrap").attr("transform","translate(0,"+ -r.top+")")}y.attr("transform","translate("+r.left+","+r.top+")");t.width(f).height(d);var E=w.select(".nv-pieWrap").datum([e]);d3.transition(E).call(t);n.dispatch.on("stateChange",function(e){l=e;p.stateChange(l);v.update()});t.dispatch.on("elementMouseout.tooltip",function(e){p.tooltipHide(e)});p.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});l.disabled=t.disabled}v.update()})});return v}var t=e.models.pie(),n=e.models.legend();var r={top:30,right:20,bottom:20,left:20},i=null,s=null,o=true,u=e.utils.defaultColor(),a=true,f=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+t+"</p>"},l={},c=null,h="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");var d=function(n,r){var i=t.description()(n.point)||t.x()(n.point);var s=n.pos[0]+(r&&r.offsetLeft||0),o=n.pos[1]+(r&&r.offsetTop||0),u=t.valueFormat()(t.y()(n.point)),a=f(i,u,n,v);e.tooltip.show([s,o],a,n.value<0?"n":"s",null,r)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+r.left,e.pos[1]+r.top];p.tooltipShow(e)});p.on("tooltipShow",function(e){if(a)d(e)});p.on("tooltipHide",function(){if(a)e.tooltip.cleanup()});v.legend=n;v.dispatch=p;v.pie=t;d3.rebind(v,t,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","labelType","donut","donutRatio","labelThreshold");v.options=e.utils.optionsFunc.bind(v);v.margin=function(e){if(!arguments.length)return r;r.top=typeof e.top!="undefined"?e.top:r.top;r.right=typeof e.right!="undefined"?e.right:r.right;r.bottom=typeof e.bottom!="undefined"?e.bottom:r.bottom;r.left=typeof e.left!="undefined"?e.left:r.left;return v};v.width=function(e){if(!arguments.length)return i;i=e;return v};v.height=function(e){if(!arguments.length)return s;s=e;return v};v.color=function(r){if(!arguments.length)return u;u=e.utils.getColor(r);n.color(u);t.color(u);return v};v.showLegend=function(e){if(!arguments.length)return o;o=e;return v};v.tooltips=function(e){if(!arguments.length)return a;a=e;return v};v.tooltipContent=function(e){if(!arguments.length)return f;f=e;return v};v.state=function(e){if(!arguments.length)return l;l=e;return v};v.defaultState=function(e){if(!arguments.length)return c;c=e;return v};v.noData=function(e){if(!arguments.length)return h;h=e;return v};return v};e.models.scatter=function(){"use strict";function I(q){q.each(function(I){function Q(){if(!g)return false;var e;var i=d3.merge(I.map(function(e,t){return e.values.map(function(e,n){var r=f(e,n);var i=l(e,n);return[o(r)+Math.random()*1e-7,u(i)+Math.random()*1e-7,t,n,e]}).filter(function(e,t){return b(e[4],t)})}));if(D===true){if(x){var a=X.select("defs").selectAll(".nv-point-clips").data([s]).enter();a.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+s);var c=X.select("#nv-points-clip-"+s).selectAll("circle").data(i);c.enter().append("circle").attr("r",T);c.exit().remove();c.attr("cx",function(e){return e[0]}).attr("cy",function(e){return e[1]});X.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+s+")")}if(i.length){i.push([o.range()[0]-20,u.range()[0]-20,null,null]);i.push([o.range()[1]+20,u.range()[1]+20,null,null]);i.push([o.range()[0]-20,u.range()[0]+20,null,null]);i.push([o.range()[1]+20,u.range()[1]-20,null,null])}var h=d3.geom.polygon([[-10,-10],[-10,r+10],[n+10,r+10],[n+10,-10]]);var p=d3.geom.voronoi(i).map(function(e,t){return{data:h.clip(e),series:i[t][2],point:i[t][3]}});var d=X.select(".nv-point-paths").selectAll("path").data(p);d.enter().append("path").attr("class",function(e,t){return"nv-path-"+t});d.exit().remove();d.attr("d",function(e){if(e.data.length===0)return"M 0 0";else return"M"+e.data.join("L")+"Z"});var v=function(e,n){if(F)return 0;var r=I[e.series];if(typeof r==="undefined")return;var i=r.values[e.point];n({point:i,series:r,pos:[o(f(i,e.point))+t.left,u(l(i,e.point))+t.top],seriesIndex:e.series,pointIndex:e.point})};d.on("click",function(e){v(e,_.elementClick)}).on("mouseover",function(e){v(e,_.elementMouseover)}).on("mouseout",function(e,t){v(e,_.elementMouseout)})}else{X.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementClick({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseover",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementMouseover({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseout",function(e,t){if(F||!I[e.series])return 0;var n=I[e.series],r=n.values[t];_.elementMouseout({point:r,series:n,seriesIndex:e.series,pointIndex:t})})}F=false}var q=n-t.left-t.right,R=r-t.top-t.bottom,U=d3.select(this);I.forEach(function(e,t){e.values.forEach(function(e){e.series=t})});var W=N&&C&&A?[]:d3.merge(I.map(function(e){return e.values.map(function(e,t){return{x:f(e,t),y:l(e,t),size:c(e,t)}})}));o.domain(N||d3.extent(W.map(function(e){return e.x}).concat(d)));if(w&&I[0])o.range(k||[(q*E+q)/(2*I[0].values.length),q-q*(1+E)/(2*I[0].values.length)]);else o.range(k||[0,q]);u.domain(C||d3.extent(W.map(function(e){return e.y}).concat(v))).range(L||[R,0]);a.domain(A||d3.extent(W.map(function(e){return e.size}).concat(m))).range(O||[16,256]);if(o.domain()[0]===o.domain()[1]||u.domain()[0]===u.domain()[1])M=true;if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]-o.domain()[0]*.01,o.domain()[1]+o.domain()[1]*.01]):o.domain([-1,1]);if(u.domain()[0]===u.domain()[1])u.domain()[0]?u.domain([u.domain()[0]-u.domain()[0]*.01,u.domain()[1]+u.domain()[1]*.01]):u.domain([-1,1]);if(isNaN(o.domain()[0])){o.domain([-1,1])}if(isNaN(u.domain()[0])){u.domain([-1,1])}P=P||o;H=H||u;B=B||a;var X=U.selectAll("g.nv-wrap.nv-scatter").data([I]);var V=X.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+s+(M?" nv-single-point":""));var $=V.append("defs");var J=V.append("g");var K=X.select("g");J.append("g").attr("class","nv-groups");J.append("g").attr("class","nv-point-paths");X.attr("transform","translate("+t.left+","+t.top+")");$.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect");X.select("#nv-edge-clip-"+s+" rect").attr("width",q).attr("height",R);K.attr("clip-path",S?"url(#nv-edge-clip-"+s+")":"");F=true;var G=X.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});G.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);G.exit().remove();G.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover});G.transition().style("fill",function(e,t){return i(e,t)}).style("stroke",function(e,t){return i(e,t)}).style("stroke-opacity",1).style("fill-opacity",.5);if(p){var Y=G.selectAll("circle.nv-point").data(function(e){return e.values},y);Y.enter().append("circle").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("cx",function(t,n){return e.utils.NaNtoZero(P(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(H(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)});Y.exit().remove();G.exit().selectAll("path.nv-point").transition().attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).remove();Y.each(function(e,t){d3.select(this).classed("nv-point",true).classed("nv-point-"+t,true).classed("hover",false)});Y.transition().attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)})}else{var Y=G.selectAll("path.nv-point").data(function(e){return e.values});Y.enter().append("path").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("transform",function(e,t){return"translate("+P(f(e,t))+","+H(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}));Y.exit().remove();G.exit().selectAll("path.nv-point").transition().attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).remove();Y.each(function(e,t){d3.select(this).classed("nv-point",true).classed("nv-point-"+t,true).classed("hover",false)});Y.transition().attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}))}clearTimeout(j);j=setTimeout(Q,300);P=o.copy();H=u.copy();B=a.copy()});return I}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=d3.scale.linear(),u=d3.scale.linear(),a=d3.scale.linear(),f=function(e){return e.x},l=function(e){return e.y},c=function(e){return e.size||1},h=function(e){return e.shape||"circle"},p=true,d=[],v=[],m=[],g=true,y=null,b=function(e){return!e.notActive},w=false,E=.1,S=false,x=true,T=function(){return 25},N=null,C=null,k=null,L=null,A=null,O=null,M=false,_=d3.dispatch("elementClick","elementMouseover","elementMouseout"),D=true;var P,H,B,j,F=false;I.clearHighlights=function(){d3.selectAll(".nv-chart-"+s+" .nv-point.hover").classed("hover",false)};I.highlightPoint=function(e,t,n){d3.select(".nv-chart-"+s+" .nv-series-"+e+" .nv-point-"+t).classed("hover",n)};_.on("elementMouseover.point",function(e){if(g)I.highlightPoint(e.seriesIndex,e.pointIndex,true)});_.on("elementMouseout.point",function(e){if(g)I.highlightPoint(e.seriesIndex,e.pointIndex,false)});I.dispatch=_;I.options=e.utils.optionsFunc.bind(I);I.x=function(e){if(!arguments.length)return f;f=d3.functor(e);return I};I.y=function(e){if(!arguments.length)return l;l=d3.functor(e);return I};I.size=function(e){if(!arguments.length)return c;c=d3.functor(e);return I};I.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return I};I.width=function(e){if(!arguments.length)return n;n=e;return I};I.height=function(e){if(!arguments.length)return r;r=e;return I};I.xScale=function(e){if(!arguments.length)return o;o=e;return I};I.yScale=function(e){if(!arguments.length)return u;u=e;return I};I.zScale=function(e){if(!arguments.length)return a;a=e;return I};I.xDomain=function(e){if(!arguments.length)return N;N=e;return I};I.yDomain=function(e){if(!arguments.length)return C;C=e;return I};I.sizeDomain=function(e){if(!arguments.length)return A;A=e;return I};I.xRange=function(e){if(!arguments.length)return k;k=e;return I};I.yRange=function(e){if(!arguments.length)return L;L=e;return I};I.sizeRange=function(e){if(!arguments.length)return O;O=e;return I};I.forceX=function(e){if(!arguments.length)return d;d=e;return I};I.forceY=function(e){if(!arguments.length)return v;v=e;return I};I.forceSize=function(e){if(!arguments.length)return m;m=e;return I};I.interactive=function(e){if(!arguments.length)return g;g=e;return I};I.pointKey=function(e){if(!arguments.length)return y;y=e;return I};I.pointActive=function(e){if(!arguments.length)return b;b=e;return I};I.padData=function(e){if(!arguments.length)return w;w=e;return I};I.padDataOuter=function(e){if(!arguments.length)return E;E=e;return I};I.clipEdge=function(e){if(!arguments.length)return S;S=e;return I};I.clipVoronoi=function(e){if(!arguments.length)return x;x=e;return I};I.useVoronoi=function(e){if(!arguments.length)return D;D=e;if(D===false){x=false}return I};I.clipRadius=function(e){if(!arguments.length)return T;T=e;return I};I.color=function(t){if(!arguments.length)return i;i=e.utils.getColor(t);return I};I.shape=function(e){if(!arguments.length)return h;h=e;return I};I.onlyCircles=function(e){if(!arguments.length)return p;p=e;return I};I.id=function(e){if(!arguments.length)return s;s=e;return I};I.singlePoint=function(e){if(!arguments.length)return M;M=e;return I};return I};e.models.scatterChart=function(){"use strict";function F(e){e.each(function(e){function K(){if(T){X.select(".nv-point-paths").style("pointer-events","all");return false}X.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(x).focus(i[0]);p.distortion(x).focus(i[1]);X.select(".nv-scatterWrap").call(t);if(b)X.select(".nv-x.nv-axis").call(n);if(w)X.select(".nv-y.nv-axis").call(r);X.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o);X.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var C=d3.select(this),k=this;var L=(f||parseInt(C.style("width"))||960)-a.left-a.right,I=(l||parseInt(C.style("height"))||400)-a.top-a.bottom;F.update=function(){C.transition().duration(D).call(F)};F.container=this;A.disabled=e.map(function(e){return!!e.disabled});if(!O){var q;O={};for(q in A){if(A[q]instanceof Array)O[q]=A[q].slice(0);else O[q]=A[q]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var R=C.selectAll(".nv-noData").data([_]);R.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");R.attr("x",a.left+L/2).attr("y",a.top+I/2).text(function(e){return e});return F}else{C.selectAll(".nv-noData").remove()}P=P||h;H=H||p;var U=C.selectAll("g.nv-wrap.nv-scatterChart").data([e]);var z=U.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id());var W=z.append("g");var X=U.select("g");W.append("rect").attr("class","nvd3 nv-background");W.append("g").attr("class","nv-x nv-axis");W.append("g").attr("class","nv-y nv-axis");W.append("g").attr("class","nv-scatterWrap");W.append("g").attr("class","nv-distWrap");W.append("g").attr("class","nv-legendWrap");W.append("g").attr("class","nv-controlsWrap");if(y){var V=S?L/2:L;i.width(V);U.select(".nv-legendWrap").datum(e).call(i);if(a.top!=i.height()){a.top=i.height();I=(l||parseInt(C.style("height"))||400)-a.top-a.bottom}U.select(".nv-legendWrap").attr("transform","translate("+(L-V)+","+ -a.top+")")}if(S){s.width(180).color(["#444"]);X.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+ -a.top+")").call(s)}U.attr("transform","translate("+a.left+","+a.top+")");if(E){X.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)")}t.width(L).height(I).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));if(d!==0)t.xDomain(null);if(v!==0)t.yDomain(null);U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(d!==0){var $=h.domain()[1]-h.domain()[0];t.xDomain([h.domain()[0]-d*$,h.domain()[1]+d*$])}if(v!==0){var J=p.domain()[1]-p.domain()[0];t.yDomain([p.domain()[0]-v*J,p.domain()[1]+v*J])}if(v!==0||d!==0){U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t)}if(b){n.scale(h).ticks(n.ticks()&&n.ticks().length?n.ticks():L/100).tickSize(-I,0);X.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)}if(w){r.scale(p).ticks(r.ticks()&&r.ticks().length?r.ticks():I/36).tickSize(-L,0);X.select(".nv-y.nv-axis").call(r)}if(m){o.getData(t.x()).scale(h).width(L).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));W.select(".nv-distWrap").append("g").attr("class","nv-distributionX");X.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)}if(g){u.getData(t.y()).scale(p).width(I).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));W.select(".nv-distWrap").append("g").attr("class","nv-distributionY");X.select(".nv-distributionY").attr("transform","translate("+(E?L:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)}if(d3.fisheye){X.select(".nv-background").attr("width",L).attr("height",I);X.select(".nv-background").on("mousemove",K);X.select(".nv-background").on("click",function(){T=!T});t.dispatch.on("elementClick.freezeFisheye",function(){T=!T})}s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled;x=e.disabled?0:2.5;X.select(".nv-background").style("pointer-events",e.disabled?"none":"all");X.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none");if(e.disabled){h.distortion(x).focus(0);p.distortion(x).focus(0);X.select(".nv-scatterWrap").call(t);X.select(".nv-x.nv-axis").call(n);X.select(".nv-y.nv-axis").call(r)}else{T=false}F.update()});i.dispatch.on("stateChange",function(e){A.disabled=e.disabled;M.stateChange(A);F.update()});t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",function(t,n){return e.pos[1]-I});d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size());e.pos=[e.pos[0]+a.left,e.pos[1]+a.top];M.tooltipShow(e)});M.on("tooltipShow",function(e){if(N)B(e,k.parentNode)});M.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});A.disabled=t.disabled}F.update()});P=h.copy();H=p.copy()});return F}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution();var a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=0,v=0,m=false,g=false,y=true,b=true,w=true,E=false,S=!!d3.fisheye,x=0,T=false,N=true,C=function(e,t,n){return"<strong>"+t+"</strong>"},k=function(e,t,n){return"<strong>"+n+"</strong>"},L=null,A={},O=null,M=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),_="No Data Available.",D=250;t.xScale(h).yScale(p);n.orient("bottom").tickPadding(10);r.orient(E?"right":"left").tickPadding(10);o.axis("x");u.axis("y");s.updateState(false);var P,H;var B=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));if(C!=null)e.tooltip.show([f,l],C(i.series.key,v,m,i,F),"n",1,s,"x-nvtooltip");if(k!=null)e.tooltip.show([c,d],k(i.series.key,v,m,i,F),"e",1,s,"y-nvtooltip");if(L!=null)e.tooltip.show([o,u],L(i.series.key,v,m,i,F),i.value<0?"n":"s",null,s)};var j=[{key:"Magnify",disabled:true}];t.dispatch.on("elementMouseout.tooltip",function(e){M.tooltipHide(e);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())});M.on("tooltipHide",function(){if(N)e.tooltip.cleanup()});F.dispatch=M;F.scatter=t;F.legend=i;F.controls=s;F.xAxis=n;F.yAxis=r;F.distX=o;F.distY=u;d3.rebind(F,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");F.options=e.utils.optionsFunc.bind(F);F.margin=function(e){if(!arguments.length)return a;a.top=typeof e.top!="undefined"?e.top:a.top;a.right=typeof e.right!="undefined"?e.right:a.right;a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom;a.left=typeof e.left!="undefined"?e.left:a.left;return F};F.width=function(e){if(!arguments.length)return f;f=e;return F};F.height=function(e){if(!arguments.length)return l;l=e;return F};F.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);i.color(c);o.color(c);u.color(c);return F};F.showDistX=function(e){if(!arguments.length)return m;m=e;return F};F.showDistY=function(e){if(!arguments.length)return g;g=e;return F};F.showControls=function(e){if(!arguments.length)return S;S=e;return F};F.showLegend=function(e){if(!arguments.length)return y;y=e;return F};F.showXAxis=function(e){if(!arguments.length)return b;b=e;return F};F.showYAxis=function(e){if(!arguments.length)return w;w=e;return F};F.rightAlignYAxis=function(e){if(!arguments.length)return E;E=e;r.orient(e?"right":"left");return F};F.fisheye=function(e){if(!arguments.length)return x;x=e;return F};F.xPadding=function(e){if(!arguments.length)return d;d=e;return F};F.yPadding=function(e){if(!arguments.length)return v;v=e;return F};F.tooltips=function(e){if(!arguments.length)return N;N=e;return F};F.tooltipContent=function(e){if(!arguments.length)return L;L=e;return F};F.tooltipXContent=function(e){if(!arguments.length)return C;C=e;return F};F.tooltipYContent=function(e){if(!arguments.length)return k;k=e;return F};F.state=function(e){if(!arguments.length)return A;A=e;return F};F.defaultState=function(e){if(!arguments.length)return O;O=e;return F};F.noData=function(e){if(!arguments.length)return _;_=e;return F};F.transitionDuration=function(e){if(!arguments.length)return D;D=e;return F};return F};e.models.scatterPlusLineChart=function(){"use strict";function B(e){e.each(function(e){function $(){if(S){z.select(".nv-point-paths").style("pointer-events","all");return false}z.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(E).focus(i[0]);p.distortion(E).focus(i[1]);z.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(g)z.select(".nv-x.nv-axis").call(n);if(y)z.select(".nv-y.nv-axis").call(r);z.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o);z.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var T=d3.select(this),N=this;var C=(f||parseInt(T.style("width"))||960)-a.left-a.right,j=(l||parseInt(T.style("height"))||400)-a.top-a.bottom;B.update=function(){T.transition().duration(M).call(B)};B.container=this;k.disabled=e.map(function(e){return!!e.disabled});if(!L){var F;L={};for(F in k){if(k[F]instanceof Array)L[F]=k[F].slice(0);else L[F]=k[F]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var I=T.selectAll(".nv-noData").data([O]);I.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");I.attr("x",a.left+C/2).attr("y",a.top+j/2).text(function(e){return e});return B}else{T.selectAll(".nv-noData").remove()}h=t.xScale();p=t.yScale();_=_||h;D=D||p;var q=T.selectAll("g.nv-wrap.nv-scatterChart").data([e]);var R=q.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id());var U=R.append("g");var z=q.select("g");U.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none");U.append("g").attr("class","nv-x nv-axis");U.append("g").attr("class","nv-y nv-axis");U.append("g").attr("class","nv-scatterWrap");U.append("g").attr("class","nv-regressionLinesWrap");U.append("g").attr("class","nv-distWrap");U.append("g").attr("class","nv-legendWrap");U.append("g").attr("class","nv-controlsWrap");q.attr("transform","translate("+a.left+","+a.top+")");if(b){z.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)")}if(m){i.width(C/2);q.select(".nv-legendWrap").datum(e).call(i);if(a.top!=i.height()){a.top=i.height();j=(l||parseInt(T.style("height"))||400)-a.top-a.bottom}q.select(".nv-legendWrap").attr("transform","translate("+C/2+","+ -a.top+")")}if(w){s.width(180).color(["#444"]);z.select(".nv-controlsWrap").datum(H).attr("transform","translate(0,"+ -a.top+")").call(s)}t.width(C).height(j).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));q.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);q.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+t.id()+")");var W=q.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(e){return e});W.enter().append("g").attr("class","nv-regLines");var X=W.selectAll(".nv-regLine").data(function(e){return[e]});var V=X.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);X.transition().attr("x1",h.range()[0]).attr("x2",h.range()[1]).attr("y1",function(e,t){return p(h.domain()[0]*e.slope+e.intercept)}).attr("y2",function(e,t){return p(h.domain()[1]*e.slope+e.intercept)}).style("stroke",function(e,t,n){return c(e,n)}).style("stroke-opacity",function(e,t){return e.disabled||typeof e.slope==="undefined"||typeof e.intercept==="undefined"?0:1});if(g){n.scale(h).ticks(n.ticks()?n.ticks():C/100).tickSize(-j,0);z.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)}if(y){r.scale(p).ticks(r.ticks()?r.ticks():j/36).tickSize(-C,0);z.select(".nv-y.nv-axis").call(r)}if(d){o.getData(t.x()).scale(h).width(C).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));U.select(".nv-distWrap").append("g").attr("class","nv-distributionX");z.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)}if(v){u.getData(t.y()).scale(p).width(j).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));U.select(".nv-distWrap").append("g").attr("class","nv-distributionY");z.select(".nv-distributionY").attr("transform","translate("+(b?C:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)}if(d3.fisheye){z.select(".nv-background").attr("width",C).attr("height",j);z.select(".nv-background").on("mousemove",$);z.select(".nv-background").on("click",function(){S=!S});t.dispatch.on("elementClick.freezeFisheye",function(){S=!S})}s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled;E=e.disabled?0:2.5;z.select(".nv-background").style("pointer-events",e.disabled?"none":"all");z.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none");if(e.disabled){h.distortion(E).focus(0);p.distortion(E).focus(0);z.select(".nv-scatterWrap").call(t);z.select(".nv-x.nv-axis").call(n);z.select(".nv-y.nv-axis").call(r)}else{S=false}B.update()});i.dispatch.on("stateChange",function(e){k=e;A.stateChange(k);B.update()});t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-j);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size());e.pos=[e.pos[0]+a.left,e.pos[1]+a.top];A.tooltipShow(e)});A.on("tooltipShow",function(e){if(x)P(e,N.parentNode)});A.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});k.disabled=t.disabled}B.update()});_=h.copy();D=p.copy()});return B}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution();var a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=false,v=false,m=true,g=true,y=true,b=false,w=!!d3.fisheye,E=0,S=false,x=true,T=function(e,t,n){return"<strong>"+t+"</strong>"},N=function(e,t,n){return"<strong>"+n+"</strong>"},C=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+r+"</p>"},k={},L=null,A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),O="No Data Available.",M=250;t.xScale(h).yScale(p);n.orient("bottom").tickPadding(10);r.orient(b?"right":"left").tickPadding(10);o.axis("x");u.axis("y");s.updateState(false);var _,D;var P=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));if(T!=null)e.tooltip.show([f,l],T(i.series.key,v,m,i,B),"n",1,s,"x-nvtooltip");if(N!=null)e.tooltip.show([c,d],N(i.series.key,v,m,i,B),"e",1,s,"y-nvtooltip");if(C!=null)e.tooltip.show([o,u],C(i.series.key,v,m,i.point.tooltip,i,B),i.value<0?"n":"s",null,s)};var H=[{key:"Magnify",disabled:true}];t.dispatch.on("elementMouseout.tooltip",function(e){A.tooltipHide(e);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())});A.on("tooltipHide",function(){if(x)e.tooltip.cleanup()});B.dispatch=A;B.scatter=t;B.legend=i;B.controls=s;B.xAxis=n;B.yAxis=r;B.distX=o;B.distY=u;d3.rebind(B,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");B.options=e.utils.optionsFunc.bind(B);B.margin=function(e){if(!arguments.length)return a;a.top=typeof e.top!="undefined"?e.top:a.top;a.right=typeof e.right!="undefined"?e.right:a.right;a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom;a.left=typeof e.left!="undefined"?e.left:a.left;return B};B.width=function(e){if(!arguments.length)return f;f=e;return B};B.height=function(e){if(!arguments.length)return l;l=e;return B};B.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);i.color(c);o.color(c);u.color(c);return B};B.showDistX=function(e){if(!arguments.length)return d;d=e;return B};B.showDistY=function(e){if(!arguments.length)return v;v=e;return B};B.showControls=function(e){if(!arguments.length)return w;w=e;return B};B.showLegend=function(e){if(!arguments.length)return m;m=e;return B};B.showXAxis=function(e){if(!arguments.length)return g;g=e;return B};B.showYAxis=function(e){if(!arguments.length)return y;y=e;return B};B.rightAlignYAxis=function(e){if(!arguments.length)return b;b=e;r.orient(e?"right":"left");return B};B.fisheye=function(e){if(!arguments.length)return E;E=e;return B};B.tooltips=function(e){if(!arguments.length)return x;x=e;return B};B.tooltipContent=function(e){if(!arguments.length)return C;C=e;return B};B.tooltipXContent=function(e){if(!arguments.length)return T;T=e;return B};B.tooltipYContent=function(e){if(!arguments.length)return N;N=e;return B};B.state=function(e){if(!arguments.length)return k;k=e;return B};B.defaultState=function(e){if(!arguments.length)return L;L=e;return B};B.noData=function(e){if(!arguments.length)return O;O=e;return B};B.transitionDuration=function(e){if(!arguments.length)return M;M=e;return B};return B};e.models.sparkline=function(){"use strict";function d(e){e.each(function(e){var i=n-t.left-t.right,d=r-t.top-t.bottom,v=d3.select(this);s.domain(l||d3.extent(e,u)).range(h||[0,i]);o.domain(c||d3.extent(e,a)).range(p||[d,0]);var m=v.selectAll("g.nv-wrap.nv-sparkline").data([e]);var g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");var b=g.append("g");var w=m.select("g");m.attr("transform","translate("+t.left+","+t.top+")");var E=m.selectAll("path").data(function(e){return[e]});E.enter().append("path");E.exit().remove();E.style("stroke",function(e,t){return e.color||f(e,t)}).attr("d",d3.svg.line().x(function(e,t){return s(u(e,t))}).y(function(e,t){return o(a(e,t))}));var S=m.selectAll("circle.nv-point").data(function(e){function n(t){if(t!=-1){var n=e[t];n.pointIndex=t;return n}else{return null}}var t=e.map(function(e,t){return a(e,t)});var r=n(t.lastIndexOf(o.domain()[1])),i=n(t.indexOf(o.domain()[0])),s=n(t.length-1);return[i,r,s].filter(function(e){return e!=null})});S.enter().append("circle");S.exit().remove();S.attr("cx",function(e,t){return s(u(e,e.pointIndex))}).attr("cy",function(e,t){return o(a(e,e.pointIndex))}).attr("r",2).attr("class",function(e,t){return u(e,e.pointIndex)==s.domain()[1]?"nv-point nv-currentValue":a(e,e.pointIndex)==o.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})});return d}var t={top:2,right:0,bottom:2,left:0},n=400,r=32,i=true,s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=e.utils.getColor(["#000"]),l,c,h,p;d.options=e.utils.optionsFunc.bind(d);d.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return d};d.width=function(e){if(!arguments.length)return n;n=e;return d};d.height=function(e){if(!arguments.length)return r;r=e;return d};d.x=function(e){if(!arguments.length)return u;u=d3.functor(e);return d};d.y=function(e){if(!arguments.length)return a;a=d3.functor(e);return d};d.xScale=function(e){if(!arguments.length)return s;s=e;return d};d.yScale=function(e){if(!arguments.length)return o;o=e;return d};d.xDomain=function(e){if(!arguments.length)return l;l=e;return d};d.yDomain=function(e){if(!arguments.length)return c;c=e;return d};d.xRange=function(e){if(!arguments.length)return h;h=e;return d};d.yRange=function(e){if(!arguments.length)return p;p=e;return d};d.animate=function(e){if(!arguments.length)return i;i=e;return d};d.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);return d};return d};e.models.sparklinePlus=function(){"use strict";function v(e){e.each(function(c){function O(){if(a)return;var e=C.selectAll(".nv-hoverValue").data(u);var r=e.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);e.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove();e.attr("transform",function(e){return"translate("+s(t.x()(c[e],e))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1);if(!u.length)return;r.append("line").attr("x1",0).attr("y1",-n.top).attr("x2",0).attr("y2",b);r.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-n.top).attr("text-anchor","end").attr("dy",".9em");C.select(".nv-hoverValue .nv-xValue").text(f(t.x()(c[u[0]],u[0])));r.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-n.top).attr("text-anchor","start").attr("dy",".9em");C.select(".nv-hoverValue .nv-yValue").text(l(t.y()(c[u[0]],u[0])))}function M(){function r(e,n){var r=Math.abs(t.x()(e[0],0)-n);var i=0;for(var s=0;s<e.length;s++){if(Math.abs(t.x()(e[s],s)-n)<r){r=Math.abs(t.x()(e[s],s)-n);i=s}}return i}if(a)return;var e=d3.mouse(this)[0]-n.left;u=[r(c,Math.round(s.invert(e)))];O()}var m=d3.select(this);var g=(r||parseInt(m.style("width"))||960)-n.left-n.right,b=(i||parseInt(m.style("height"))||400)-n.top-n.bottom;v.update=function(){v(e)};v.container=this;if(!c||!c.length){var w=m.selectAll(".nv-noData").data([d]);w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");w.attr("x",n.left+g/2).attr("y",n.top+b/2).text(function(e){return e});return v}else{m.selectAll(".nv-noData").remove()}var E=t.y()(c[c.length-1],c.length-1);s=t.xScale();o=t.yScale();var S=m.selectAll("g.nv-wrap.nv-sparklineplus").data([c]);var T=S.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus");var N=T.append("g");var C=S.select("g");N.append("g").attr("class","nv-sparklineWrap");N.append("g").attr("class","nv-valueWrap");N.append("g").attr("class","nv-hoverArea");S.attr("transform","translate("+n.left+","+n.top+")");var k=C.select(".nv-sparklineWrap");t.width(g).height(b);k.call(t);var L=C.select(".nv-valueWrap");var A=L.selectAll(".nv-currentValue").data([E]);A.enter().append("text").attr("class","nv-currentValue").attr("dx",p?-8:8).attr("dy",".9em").style("text-anchor",p?"end":"start");A.attr("x",g+(p?n.right:0)).attr("y",h?function(e){return o(e)}:0).style("fill",t.color()(c[c.length-1],c.length-1)).text(l(E));N.select(".nv-hoverArea").append("rect").on("mousemove",M).on("click",function(){a=!a}).on("mouseout",function(){u=[];O()});C.select(".nv-hoverArea rect").attr("transform",function(e){return"translate("+ -n.left+","+ -n.top+")"}).attr("width",g+n.left+n.right).attr("height",b+n.top)});return v}var t=e.models.sparkline();var n={top:15,right:100,bottom:10,left:50},r=null,i=null,s,o,u=[],a=false,f=d3.format(",r"),l=d3.format(",.2f"),c=true,h=true,p=false,d="No Data Available.";v.sparkline=t;d3.rebind(v,t,"x","y","xScale","yScale","color");v.options=e.utils.optionsFunc.bind(v);v.margin=function(e){if(!arguments.length)return n;n.top=typeof e.top!="undefined"?e.top:n.top;n.right=typeof e.right!="undefined"?e.right:n.right;n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom;n.left=typeof e.left!="undefined"?e.left:n.left;return v};v.width=function(e){if(!arguments.length)return r;r=e;return v};v.height=function(e){if(!arguments.length)return i;i=e;return v};v.xTickFormat=function(e){if(!arguments.length)return f;f=e;return v};v.yTickFormat=function(e){if(!arguments.length)return l;l=e;return v};v.showValue=function(e){if(!arguments.length)return c;c=e;return v};v.alignValue=function(e){if(!arguments.length)return h;h=e;return v};v.rightAlignValue=function(e){if(!arguments.length)return p;p=e;return v};v.noData=function(e){if(!arguments.length)return d;d=e;return v};return v};e.models.stackedArea=function(){"use strict";function y(e){e.each(function(e){var a=n-t.left-t.right,v=r-t.top-t.bottom,b=d3.select(this);p=m.xScale();d=m.yScale();var w=e;e=e.map(function(e,t){e.seriesIndex=t;e.values=e.values.map(function(e,n){e.index=n;e.seriesIndex=t;return e});return e});var E=e.filter(function(e){return!e.disabled});e=d3.layout.stack().order(l).offset(f).values(function(e){return e.values}).x(o).y(u).out(function(e,t,n){var r=u(e)===0?0:n;e.display={y:r,y0:t}})(E);var S=b.selectAll("g.nv-wrap.nv-stackedarea").data([e]);var T=S.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea");var N=T.append("defs");var C=T.append("g");var k=S.select("g");C.append("g").attr("class","nv-areaWrap");C.append("g").attr("class","nv-scatterWrap");S.attr("transform","translate("+t.left+","+t.top+")");m.width(a).height(v).x(o).y(function(e){return e.display.y+e.display.y0}).forceY([0]).color(e.map(function(e,t){return e.color||i(e,e.seriesIndex)}));var L=k.select(".nv-scatterWrap").datum(e);L.call(m);N.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect");S.select("#nv-edge-clip-"+s+" rect").attr("width",a).attr("height",v);k.attr("clip-path",h?"url(#nv-edge-clip-"+s+")":"");var A=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y+e.display.y0)}).interpolate(c);var O=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y0)});var M=k.select(".nv-areaWrap").selectAll("path.nv-area").data(function(e){return e});M.enter().append("path").attr("class",function(e,t){return"nv-area nv-area-"+t}).attr("d",function(e,t){return O(e.values,e.seriesIndex)}).on("mouseover",function(e,t){d3.select(this).classed("hover",true);g.areaMouseover({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t})}).on("mouseout",function(e,t){d3.select(this).classed("hover",false);g.areaMouseout({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t})}).on("click",function(e,t){d3.select(this).classed("hover",false);g.areaClick({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t})});M.exit().transition().attr("d",function(e,t){return O(e.values,t)}).remove();M.style("fill",function(e,t){return e.color||i(e,e.seriesIndex)}).style("stroke",function(e,t){return e.color||i(e,e.seriesIndex)});M.transition().attr("d",function(e,t){return A(e.values,t)});m.dispatch.on("elementMouseover.area",function(e){k.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",true)});m.dispatch.on("elementMouseout.area",function(e){k.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",false)});y.d3_stackedOffset_stackPercent=function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,a=[];for(s=0;s<n;++s){for(i=0,o=0;i<w.length;i++)o+=u(w[i].values[s]);if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)a[s]=0;return a}});return y}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=function(e){return e.x},u=function(e){return e.y},a="stack",f="zero",l="default",c="linear",h=false,p,d,v=d3.format(",.3f"),m=e.models.scatter(),g=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");m.size(2.2).sizeDomain([2.2,2.2]);m.dispatch.on("elementClick.area",function(e){g.areaClick(e)});m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],g.tooltipShow(e)});m.dispatch.on("elementMouseout.tooltip",function(e){g.tooltipHide(e)});y.dispatch=g;y.scatter=m;d3.rebind(y,m,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","highlightPoint","clearHighlights");y.options=e.utils.optionsFunc.bind(y);y.x=function(e){if(!arguments.length)return o;o=d3.functor(e);return y};y.y=function(e){if(!arguments.length)return u;u=d3.functor(e);return y};y.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return y};y.width=function(e){if(!arguments.length)return n;n=e;return y};y.height=function(e){if(!arguments.length)return r;r=e;return y};y.clipEdge=function(e){if(!arguments.length)return h;h=e;return y};y.color=function(t){if(!arguments.length)return i;i=e.utils.getColor(t);return y};y.offset=function(e){if(!arguments.length)return f;f=e;return y};y.order=function(e){if(!arguments.length)return l;l=e;return y};y.style=function(e){if(!arguments.length)return a;a=e;switch(a){case"stack":y.offset("zero");y.order("default");break;case"stream":y.offset("wiggle");y.order("inside-out");break;case"stream-center":y.offset("silhouette");y.order("inside-out");break;case"expand":y.offset("expand");y.order("default");break;case"stack_percent":y.offset(y.d3_stackedOffset_stackPercent);y.order("default");break}return y};y.interpolate=function(e){if(!arguments.length)return c;c=e;return y};return y};e.models.stackedAreaChart=function(){"use strict";function D(b){b.each(function(b){var x=d3.select(this),P=this;var H=(a||parseInt(x.style("width"))||960)-u.left-u.right,B=(f||parseInt(x.style("height"))||400)-u.top-u.bottom;D.update=function(){x.transition().duration(M).call(D)};D.container=this;if(y=="right")H=H-250;T.disabled=b.map(function(e){return!!e.disabled});if(!N){var j;N={};for(j in T){if(T[j]instanceof Array)N[j]=T[j].slice(0);else N[j]=T[j]}}if(!b||!b.length||!b.filter(function(e){return e.values.length}).length){var F=x.selectAll(".nv-noData").data([C]);F.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");F.attr("x",u.left+H/2).attr("y",u.top+B/2).text(function(e){return e});return D}else{x.selectAll(".nv-noData").remove()}w=t.xScale();E=t.yScale();var I=x.selectAll("g.nv-wrap.nv-stackedAreaChart").data([b]);var q=I.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g");var R=I.select("g");q.append("rect").style("opacity",0);q.append("g").attr("class","nv-x nv-axis");q.append("g").attr("class","nv-y nv-axis");q.append("g").attr("class","nv-stackedWrap");q.append("g").attr("class","nv-legendWrap");q.append("g").attr("class","nv-controlsWrap");q.append("g").attr("class","nv-interactive");R.select("rect").attr("width",H).attr("height",B);if(h){var U=c?H-L:H;i.width(U);R.select(".nv-legendWrap").datum(b).call(i);if(u.top!=i.height()){u.top=i.height();B=(f||parseInt(x.style("height"))||400)-u.top-u.bottom}if(y=="right"){R.select(".nv-legendWrap").attr("transform","translate("+H+","+20+")")}else{R.select(".nv-legendWrap").attr("transform","translate("+(H-U)+","+ -u.top+")")}}if(c){var z=[{key:O.stacked||"Stacked",metaKey:"Stacked",disabled:t.style()!="stack",style:"stack"},{key:O.stream||"Stream",metaKey:"Stream",disabled:t.style()!="stream",style:"stream"},{key:O.expanded||"Expanded",metaKey:"Expanded",disabled:t.style()!="expand",style:"expand"},{key:O.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:t.style()!="stack_percent",style:"stack_percent"}];L=A.length/3*260;z=z.filter(function(e){return A.indexOf(e.metaKey)!==-1});s.width(L).color(["#444","#444","#444"]);R.select(".nv-controlsWrap").datum(z).call(s);if(u.top!=Math.max(s.height(),i.height())){u.top=Math.max(s.height(),i.height());B=(f||parseInt(x.style("height"))||400)-u.top-u.bottom}R.select(".nv-controlsWrap").attr("transform","translate(0,"+ -u.top+")")}I.attr("transform","translate("+u.left+","+u.top+")");if(v){R.select(".nv-y.nv-axis").attr("transform","translate("+H+",0)")}if(m){o.width(H).height(B).margin({left:u.left,top:u.top}).svgContainer(x).xScale(w);I.select(".nv-interactive").call(o)}t.width(H).height(B);var W=R.select(".nv-stackedWrap").datum(b);W.transition().call(t);if(p){n.scale(w).ticks(H/100).tickSize(-B,0);R.select(".nv-x.nv-axis").attr("transform","translate(0,"+B+")");R.select(".nv-x.nv-axis").transition().duration(0).call(n)}if(d){r.scale(E).ticks(t.offset()=="wiggle"?0:B/36).tickSize(-H,0).setTickFormat(t.style()=="expand"||t.style()=="stack_percent"?d3.format("%"):S);R.select(".nv-y.nv-axis").transition().duration(0).call(r)}t.dispatch.on("areaClick.toggle",function(e){if(b.filter(function(e){return!e.disabled}).length===1)b=b.map(function(e){e.disabled=false;return e});else b=b.map(function(t,n){t.disabled=n!=e.seriesIndex;return t});T.disabled=b.map(function(e){return!!e.disabled});k.stateChange(T);D.update()});i.dispatch.on("stateChange",function(e){T.disabled=e.disabled;k.stateChange(T);D.update()});s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;z=z.map(function(e){e.disabled=true;return e});e.disabled=false;t.style(e.style);T.style=t.style();k.stateChange(T);D.update()});o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,a,f,c=[];b.filter(function(e,t){e.seriesIndex=t;return!e.disabled}).forEach(function(n,r){a=e.interactiveBisect(n.values,i.pointXValue,D.x());t.highlightPoint(r,a,true);var o=n.values[a];if(typeof o==="undefined")return;if(typeof s==="undefined")s=o;if(typeof f==="undefined")f=D.xScale()(D.x()(o,a));var u=t.style()=="expand"?o.display.y:D.y()(o,a);c.push({key:n.key,value:u,color:l(n,n.seriesIndex),stackedValue:o.display})});c.reverse();if(c.length>2){var h=D.yScale().invert(i.mouseY);var p=Infinity,d=null;c.forEach(function(e,t){if(h>=e.stackedValue.y0&&h<=e.stackedValue.y0+e.stackedValue.y){d=t;return}});if(d!=null)c[d].highlight=true}var v=n.tickFormat()(D.x()(s,a));var m=t.style()=="expand"?function(e,t){return d3.format(".1%")(e)}:function(e,t){return r.tickFormat()(e)};o.tooltip.position({left:f+u.left,top:i.mouseY+u.top}).chartContainer(P.parentNode).enabled(g).valueFormatter(m).data({value:v,series:c})();o.renderGuideLine(f)});o.dispatch.on("elementMouseout",function(e){k.tooltipHide();t.clearHighlights()});k.on("tooltipShow",function(e){if(g)_(e,P.parentNode)});k.on("changeState",function(e){if(typeof e.disabled!=="undefined"){b.forEach(function(t,n){t.disabled=e.disabled[n]});T.disabled=e.disabled}if(typeof e.style!=="undefined"){t.style(e.style)}D.update()})});return D}var t=e.models.stackedArea(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline();var u={top:30,right:25,bottom:50,left:60},a=null,f=null,l=e.utils.defaultColor(),c=true,h=true,p=true,d=true,v=false,m=false,g=true,y="top",b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"},w,E,S=d3.format(",.2f"),x=d3.format(",.3f"),T={style:t.style()},N=null,C="No Data Available.",k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=250,A=["Stacked","Stream","Expanded"],O={},M=250;n.orient("bottom").tickPadding(7);r.orient(v?"right":"left");s.updateState(false);var _=function(r,i){var s=r.pos[0]+(i.offsetLeft||0),o=r.pos[1]+(i.offsetTop||0),u=n.tickFormat()(t.x()(r.point,r.pointIndex)),a=x(t.y()(r.point,r.pointIndex)),f=b(r.series.key,u,a,r,D);e.tooltip.show([s,o],f,r.value<0?"n":"s",null,i)};t.dispatch.on("tooltipShow",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],k.tooltipShow(e)});t.dispatch.on("tooltipHide",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(g)e.tooltip.cleanup()});D.dispatch=k;D.stacked=t;D.legend=i;D.controls=s;D.xAxis=n;D.yAxis=r;D.interactiveLayer=o;d3.rebind(D,t,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate");D.options=e.utils.optionsFunc.bind(D);D.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return D};D.width=function(e){if(!arguments.length)return a;a=e;return D};D.height=function(e){if(!arguments.length)return f;f=e;return D};D.color=function(n){if(!arguments.length)return l;l=e.utils.getColor(n);i.color(l);t.color(l);return D};D.showControls=function(e){if(!arguments.length)return c;c=e;return D};D.showLegend=function(e){if(!arguments.length)return h;h=e;return D};D.showXAxis=function(e){if(!arguments.length)return p;p=e;return D};D.showYAxis=function(e){if(!arguments.length)return d;d=e;return D};D.rightAlignYAxis=function(e){if(!arguments.length)return v;v=e;r.orient(e?"right":"left");return D};D.useInteractiveGuideline=function(e){if(!arguments.length)return m;m=e;if(e===true){D.interactive(false);D.useVoronoi(false)}return D};D.tooltip=function(e){if(!arguments.length)return b;b=e;return D};D.tooltips=function(e){if(!arguments.length)return g;g=e;return D};D.legendPos=function(e){if(!arguments.length)return y;y=e;return D};D.tooltipContent=function(e){if(!arguments.length)return b;b=e;return D};D.yAxisTooltipFormat=function(e){if(!arguments.length)return x;x=e;return D};D.state=function(e){if(!arguments.length)return T;T=e;return D};D.defaultState=function(e){if(!arguments.length)return N;N=e;return D};D.noData=function(e){if(!arguments.length)return C;C=e;return D};D.transitionDuration=function(e){if(!arguments.length)return M;M=e;return D};D.controlsData=function(e){if(!arguments.length)return A;A=e;return D};D.controlLabels=function(e){if(!arguments.length)return O;if(typeof e!=="object")return O;O=e;return D};r.setTickFormat=r.tickFormat;r.tickFormat=function(e){if(!arguments.length)return S;S=e;return r};return D}})() \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/outro.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/outro.js
new file mode 100644
index 00000000..158693a0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/outro.js
@@ -0,0 +1 @@
+})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/sankey.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/sankey.js
new file mode 100644
index 00000000..c3bc59fb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/sankey.js
@@ -0,0 +1,292 @@
+d3.sankey = function() {
+ var sankey = {},
+ nodeWidth = 24,
+ nodePadding = 8,
+ size = [1, 1],
+ nodes = [],
+ links = [];
+
+ sankey.nodeWidth = function(_) {
+ if (!arguments.length) return nodeWidth;
+ nodeWidth = +_;
+ return sankey;
+ };
+
+ sankey.nodePadding = function(_) {
+ if (!arguments.length) return nodePadding;
+ nodePadding = +_;
+ return sankey;
+ };
+
+ sankey.nodes = function(_) {
+ if (!arguments.length) return nodes;
+ nodes = _;
+ return sankey;
+ };
+
+ sankey.links = function(_) {
+ if (!arguments.length) return links;
+ links = _;
+ return sankey;
+ };
+
+ sankey.size = function(_) {
+ if (!arguments.length) return size;
+ size = _;
+ return sankey;
+ };
+
+ sankey.layout = function(iterations) {
+ computeNodeLinks();
+ computeNodeValues();
+ computeNodeBreadths();
+ computeNodeDepths(iterations);
+ computeLinkDepths();
+ return sankey;
+ };
+
+ sankey.relayout = function() {
+ computeLinkDepths();
+ return sankey;
+ };
+
+ sankey.link = function() {
+ var curvature = .5;
+
+ function link(d) {
+ var x0 = d.source.x + d.source.dx,
+ x1 = d.target.x,
+ xi = d3.interpolateNumber(x0, x1),
+ x2 = xi(curvature),
+ x3 = xi(1 - curvature),
+ y0 = d.source.y + d.sy + d.dy / 2,
+ y1 = d.target.y + d.ty + d.dy / 2;
+ return "M" + x0 + "," + y0
+ + "C" + x2 + "," + y0
+ + " " + x3 + "," + y1
+ + " " + x1 + "," + y1;
+ }
+
+ link.curvature = function(_) {
+ if (!arguments.length) return curvature;
+ curvature = +_;
+ return link;
+ };
+
+ return link;
+ };
+
+ // Populate the sourceLinks and targetLinks for each node.
+ // Also, if the source and target are not objects, assume they are indices.
+ function computeNodeLinks() {
+ nodes.forEach(function(node) {
+ node.sourceLinks = [];
+ node.targetLinks = [];
+ });
+ links.forEach(function(link) {
+ var source = link.source,
+ target = link.target;
+ if (typeof source === "number") source = link.source = nodes[link.source];
+ if (typeof target === "number") target = link.target = nodes[link.target];
+ source.sourceLinks.push(link);
+ target.targetLinks.push(link);
+ });
+ }
+
+ // Compute the value (size) of each node by summing the associated links.
+ function computeNodeValues() {
+ nodes.forEach(function(node) {
+ node.value = Math.max(
+ d3.sum(node.sourceLinks, value),
+ d3.sum(node.targetLinks, value)
+ );
+ });
+ }
+
+ // Iteratively assign the breadth (x-position) for each node.
+ // Nodes are assigned the maximum breadth of incoming neighbors plus one;
+ // nodes with no incoming links are assigned breadth zero, while
+ // nodes with no outgoing links are assigned the maximum breadth.
+ function computeNodeBreadths() {
+ var remainingNodes = nodes,
+ nextNodes,
+ x = 0;
+
+ while (remainingNodes.length) {
+ nextNodes = [];
+ remainingNodes.forEach(function(node) {
+ node.x = x;
+ node.dx = nodeWidth;
+ node.sourceLinks.forEach(function(link) {
+ nextNodes.push(link.target);
+ });
+ });
+ remainingNodes = nextNodes;
+ ++x;
+ }
+
+ //
+ moveSinksRight(x);
+ scaleNodeBreadths((size[0] - nodeWidth) / (x - 1));
+ }
+
+ function moveSourcesRight() {
+ nodes.forEach(function(node) {
+ if (!node.targetLinks.length) {
+ node.x = d3.min(node.sourceLinks, function(d) { return d.target.x; }) - 1;
+ }
+ });
+ }
+
+ function moveSinksRight(x) {
+ nodes.forEach(function(node) {
+ if (!node.sourceLinks.length) {
+ node.x = x - 1;
+ }
+ });
+ }
+
+ function scaleNodeBreadths(kx) {
+ nodes.forEach(function(node) {
+ node.x *= kx;
+ });
+ }
+
+ function computeNodeDepths(iterations) {
+ var nodesByBreadth = d3.nest()
+ .key(function(d) { return d.x; })
+ .sortKeys(d3.ascending)
+ .entries(nodes)
+ .map(function(d) { return d.values; });
+
+ //
+ initializeNodeDepth();
+ resolveCollisions();
+ for (var alpha = 1; iterations > 0; --iterations) {
+ relaxRightToLeft(alpha *= .99);
+ resolveCollisions();
+ relaxLeftToRight(alpha);
+ resolveCollisions();
+ }
+
+ function initializeNodeDepth() {
+ var ky = d3.min(nodesByBreadth, function(nodes) {
+ return (size[1] - (nodes.length - 1) * nodePadding) / d3.sum(nodes, value);
+ });
+
+ nodesByBreadth.forEach(function(nodes) {
+ nodes.forEach(function(node, i) {
+ node.y = i;
+ node.dy = node.value * ky;
+ });
+ });
+
+ links.forEach(function(link) {
+ link.dy = link.value * ky;
+ });
+ }
+
+ function relaxLeftToRight(alpha) {
+ nodesByBreadth.forEach(function(nodes, breadth) {
+ nodes.forEach(function(node) {
+ if (node.targetLinks.length) {
+ var y = d3.sum(node.targetLinks, weightedSource) / d3.sum(node.targetLinks, value);
+ node.y += (y - center(node)) * alpha;
+ }
+ });
+ });
+
+ function weightedSource(link) {
+ return center(link.source) * link.value;
+ }
+ }
+
+ function relaxRightToLeft(alpha) {
+ nodesByBreadth.slice().reverse().forEach(function(nodes) {
+ nodes.forEach(function(node) {
+ if (node.sourceLinks.length) {
+ var y = d3.sum(node.sourceLinks, weightedTarget) / d3.sum(node.sourceLinks, value);
+ node.y += (y - center(node)) * alpha;
+ }
+ });
+ });
+
+ function weightedTarget(link) {
+ return center(link.target) * link.value;
+ }
+ }
+
+ function resolveCollisions() {
+ nodesByBreadth.forEach(function(nodes) {
+ var node,
+ dy,
+ y0 = 0,
+ n = nodes.length,
+ i;
+
+ // Push any overlapping nodes down.
+ nodes.sort(ascendingDepth);
+ for (i = 0; i < n; ++i) {
+ node = nodes[i];
+ dy = y0 - node.y;
+ if (dy > 0) node.y += dy;
+ y0 = node.y + node.dy + nodePadding;
+ }
+
+ // If the bottommost node goes outside the bounds, push it back up.
+ dy = y0 - nodePadding - size[1];
+ if (dy > 0) {
+ y0 = node.y -= dy;
+
+ // Push any overlapping nodes back up.
+ for (i = n - 2; i >= 0; --i) {
+ node = nodes[i];
+ dy = node.y + node.dy + nodePadding - y0;
+ if (dy > 0) node.y -= dy;
+ y0 = node.y;
+ }
+ }
+ });
+ }
+
+ function ascendingDepth(a, b) {
+ return a.y - b.y;
+ }
+ }
+
+ function computeLinkDepths() {
+ nodes.forEach(function(node) {
+ node.sourceLinks.sort(ascendingTargetDepth);
+ node.targetLinks.sort(ascendingSourceDepth);
+ });
+ nodes.forEach(function(node) {
+ var sy = 0, ty = 0;
+ node.sourceLinks.forEach(function(link) {
+ link.sy = sy;
+ sy += link.dy;
+ });
+ node.targetLinks.forEach(function(link) {
+ link.ty = ty;
+ ty += link.dy;
+ });
+ });
+
+ function ascendingSourceDepth(a, b) {
+ return a.source.y - b.source.y;
+ }
+
+ function ascendingTargetDepth(a, b) {
+ return a.target.y - b.target.y;
+ }
+ }
+
+ function center(node) {
+ return node.y + node.dy / 2;
+ }
+
+ function value(link) {
+ return link.value;
+ }
+
+ return sankey;
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/tooltip.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/tooltip.js
new file mode 100644
index 00000000..46e5a816
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/tooltip.js
@@ -0,0 +1,490 @@
+/* Tooltip rendering model for nvd3 charts.
+window.nv.models.tooltip is the updated,new way to render tooltips.
+
+window.nv.tooltip.show is the old tooltip code.
+window.nv.tooltip.* also has various helper methods.
+*/
+(function() {
+ "use strict";
+ window.nv.tooltip = {};
+
+ /* Model which can be instantiated to handle tooltip rendering.
+ Example usage:
+ var tip = nv.models.tooltip().gravity('w').distance(23)
+ .data(myDataObject);
+
+ tip(); //just invoke the returned function to render tooltip.
+ */
+ window.nv.models.tooltip = function() {
+ var content = null //HTML contents of the tooltip. If null, the content is generated via the data variable.
+ , data = null /* Tooltip data. If data is given in the proper format, a consistent tooltip is generated.
+ Format of data:
+ {
+ key: "Date",
+ value: "August 2009",
+ series: [
+ {
+ key: "Series 1",
+ value: "Value 1",
+ color: "#000"
+ },
+ {
+ key: "Series 2",
+ value: "Value 2",
+ color: "#00f"
+ }
+ ]
+
+ }
+
+ */
+ , gravity = 'w' //Can be 'n','s','e','w'. Determines how tooltip is positioned.
+ , distance = 50 //Distance to offset tooltip from the mouse location.
+ , snapDistance = 25 //Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect)
+ , fixedTop = null //If not null, this fixes the top position of the tooltip.
+ , classes = null //Attaches additional CSS classes to the tooltip DIV that is created.
+ , chartContainer = null //Parent DIV, of the SVG Container that holds the chart.
+ , tooltipElem = null //actual DOM element representing the tooltip.
+ , position = {left: null, top: null} //Relative position of the tooltip inside chartContainer.
+ , enabled = true //True -> tooltips are rendered. False -> don't render tooltips.
+ //Generates a unique id when you create a new tooltip() object
+ , id = "nvtooltip-" + Math.floor(Math.random() * 100000)
+ ;
+
+ //CSS class to specify whether element should not have mouse events.
+ var nvPointerEventsClass = "nv-pointer-events-none";
+
+ //Format function for the tooltip values column
+ var valueFormatter = function(d,i) {
+ return d;
+ };
+
+ //Format function for the tooltip header value.
+ var headerFormatter = function(d) {
+ return d;
+ };
+
+ //By default, the tooltip model renders a beautiful table inside a DIV.
+ //You can override this function if a custom tooltip is desired.
+ var contentGenerator = function(d) {
+ if (content != null) return content;
+
+ if (d == null) return '';
+
+ var table = d3.select(document.createElement("table"));
+ var theadEnter = table.selectAll("thead")
+ .data([d])
+ .enter().append("thead");
+ theadEnter.append("tr")
+ .append("td")
+ .attr("colspan",3)
+ .append("strong")
+ .classed("x-value",true)
+ .html(headerFormatter(d.value));
+
+ var tbodyEnter = table.selectAll("tbody")
+ .data([d])
+ .enter().append("tbody");
+ var trowEnter = tbodyEnter.selectAll("tr")
+ .data(function(p) { return p.series})
+ .enter()
+ .append("tr")
+ .classed("highlight", function(p) { return p.highlight})
+ ;
+
+ trowEnter.append("td")
+ .classed("legend-color-guide",true)
+ .append("div")
+ .style("background-color", function(p) { return p.color});
+ trowEnter.append("td")
+ .classed("key",true)
+ .html(function(p) {return p.key});
+ trowEnter.append("td")
+ .classed("value",true)
+ .html(function(p,i) { return valueFormatter(p.value,i) });
+
+
+ trowEnter.selectAll("td").each(function(p) {
+ if (p.highlight) {
+ var opacityScale = d3.scale.linear().domain([0,1]).range(["#fff",p.color]);
+ var opacity = 0.6;
+ d3.select(this)
+ .style("border-bottom-color", opacityScale(opacity))
+ .style("border-top-color", opacityScale(opacity))
+ ;
+ }
+ });
+
+ var html = table.node().outerHTML;
+ if (d.footer !== undefined)
+ html += "<div class='footer'>" + d.footer + "</div>";
+ return html;
+
+ };
+
+ var dataSeriesExists = function(d) {
+ if (d && d.series && d.series.length > 0) return true;
+
+ return false;
+ };
+
+ //In situations where the chart is in a 'viewBox', re-position the tooltip based on how far chart is zoomed.
+ function convertViewBoxRatio() {
+ if (chartContainer) {
+ var svg = d3.select(chartContainer);
+ if (svg.node().tagName !== "svg") {
+ svg = svg.select("svg");
+ }
+ var viewBox = (svg.node()) ? svg.attr('viewBox') : null;
+ if (viewBox) {
+ viewBox = viewBox.split(' ');
+ var ratio = parseInt(svg.style('width')) / viewBox[2];
+
+ position.left = position.left * ratio;
+ position.top = position.top * ratio;
+ }
+ }
+ }
+
+ //Creates new tooltip container, or uses existing one on DOM.
+ function getTooltipContainer(newContent) {
+ var body;
+ if (chartContainer)
+ body = d3.select(chartContainer);
+ else
+ body = d3.select("body");
+
+ var container = body.select(".nvtooltip");
+ if (container.node() === null) {
+ //Create new tooltip div if it doesn't exist on DOM.
+ container = body.append("div")
+ .attr("class", "nvtooltip " + (classes? classes: "xy-tooltip"))
+ .attr("id",id)
+ ;
+ }
+
+
+ container.node().innerHTML = newContent;
+ container.style("top",0).style("left",0).style("opacity",0);
+ container.selectAll("div, table, td, tr").classed(nvPointerEventsClass,true)
+ container.classed(nvPointerEventsClass,true);
+ return container.node();
+ }
+
+
+
+ //Draw the tooltip onto the DOM.
+ function nvtooltip() {
+ if (!enabled) return;
+ if (!dataSeriesExists(data)) return;
+
+ convertViewBoxRatio();
+
+ var left = position.left;
+ var top = (fixedTop != null) ? fixedTop : position.top;
+ var container = getTooltipContainer(contentGenerator(data));
+ tooltipElem = container;
+ if (chartContainer) {
+ var svgComp = chartContainer.getElementsByTagName("svg")[0];
+ var boundRect = (svgComp) ? svgComp.getBoundingClientRect() : chartContainer.getBoundingClientRect();
+ var svgOffset = {left:0,top:0};
+ if (svgComp) {
+ var svgBound = svgComp.getBoundingClientRect();
+ var chartBound = chartContainer.getBoundingClientRect();
+ var svgBoundTop = svgBound.top;
+
+ //Defensive code. Sometimes, svgBoundTop can be a really negative
+ // number, like -134254. That's a bug.
+ // If such a number is found, use zero instead. FireFox bug only
+ if (svgBoundTop < 0) {
+ var containerBound = chartContainer.getBoundingClientRect();
+ svgBoundTop = (Math.abs(svgBoundTop) > containerBound.height) ? 0 : svgBoundTop;
+ }
+ svgOffset.top = Math.abs(svgBoundTop - chartBound.top);
+ svgOffset.left = Math.abs(svgBound.left - chartBound.left);
+ }
+ //If the parent container is an overflow <div> with scrollbars, subtract the scroll offsets.
+ //You need to also add any offset between the <svg> element and its containing <div>
+ //Finally, add any offset of the containing <div> on the whole page.
+ left += chartContainer.offsetLeft + svgOffset.left - 2*chartContainer.scrollLeft;
+ top += chartContainer.offsetTop + svgOffset.top - 2*chartContainer.scrollTop;
+ }
+
+ if (snapDistance && snapDistance > 0) {
+ top = Math.floor(top/snapDistance) * snapDistance;
+ }
+
+ nv.tooltip.calcTooltipPosition([left,top], gravity, distance, container);
+ return nvtooltip;
+ };
+
+ nvtooltip.nvPointerEventsClass = nvPointerEventsClass;
+
+ nvtooltip.content = function(_) {
+ if (!arguments.length) return content;
+ content = _;
+ return nvtooltip;
+ };
+
+ //Returns tooltipElem...not able to set it.
+ nvtooltip.tooltipElem = function() {
+ return tooltipElem;
+ };
+
+ nvtooltip.contentGenerator = function(_) {
+ if (!arguments.length) return contentGenerator;
+ if (typeof _ === 'function') {
+ contentGenerator = _;
+ }
+ return nvtooltip;
+ };
+
+ nvtooltip.data = function(_) {
+ if (!arguments.length) return data;
+ data = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.gravity = function(_) {
+ if (!arguments.length) return gravity;
+ gravity = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.distance = function(_) {
+ if (!arguments.length) return distance;
+ distance = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.snapDistance = function(_) {
+ if (!arguments.length) return snapDistance;
+ snapDistance = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.classes = function(_) {
+ if (!arguments.length) return classes;
+ classes = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.chartContainer = function(_) {
+ if (!arguments.length) return chartContainer;
+ chartContainer = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.position = function(_) {
+ if (!arguments.length) return position;
+ position.left = (typeof _.left !== 'undefined') ? _.left : position.left;
+ position.top = (typeof _.top !== 'undefined') ? _.top : position.top;
+ return nvtooltip;
+ };
+
+ nvtooltip.fixedTop = function(_) {
+ if (!arguments.length) return fixedTop;
+ fixedTop = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.enabled = function(_) {
+ if (!arguments.length) return enabled;
+ enabled = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.valueFormatter = function(_) {
+ if (!arguments.length) return valueFormatter;
+ if (typeof _ === 'function') {
+ valueFormatter = _;
+ }
+ return nvtooltip;
+ };
+
+ nvtooltip.headerFormatter = function(_) {
+ if (!arguments.length) return headerFormatter;
+ if (typeof _ === 'function') {
+ headerFormatter = _;
+ }
+ return nvtooltip;
+ };
+
+ //id() is a read-only function. You can't use it to set the id.
+ nvtooltip.id = function() {
+ return id;
+ };
+
+
+ return nvtooltip;
+ };
+
+
+ //Original tooltip.show function. Kept for backward compatibility.
+ // pos = [left,top]
+ nv.tooltip.show = function(pos, content, gravity, dist, parentContainer, classes) {
+
+ //Create new tooltip div if it doesn't exist on DOM.
+ var container = document.createElement('div');
+ container.className = 'nvtooltip ' + (classes ? classes : 'xy-tooltip');
+
+ var body = parentContainer;
+ if ( !parentContainer || parentContainer.tagName.match(/g|svg/i)) {
+ //If the parent element is an SVG element, place tooltip in the <body> element.
+ body = document.getElementsByTagName('body')[0];
+ }
+
+ container.style.left = 0;
+ container.style.top = 0;
+ container.style.opacity = 0;
+ container.innerHTML = content;
+ body.appendChild(container);
+
+ //If the parent container is an overflow <div> with scrollbars, subtract the scroll offsets.
+ if (parentContainer) {
+ pos[0] = pos[0] - parentContainer.scrollLeft;
+ pos[1] = pos[1] - parentContainer.scrollTop;
+ }
+ nv.tooltip.calcTooltipPosition(pos, gravity, dist, container);
+ };
+
+ //Looks up the ancestry of a DOM element, and returns the first NON-svg node.
+ nv.tooltip.findFirstNonSVGParent = function(Elem) {
+ while(Elem.tagName.match(/^g|svg$/i) !== null) {
+ Elem = Elem.parentNode;
+ }
+ return Elem;
+ };
+
+ //Finds the total offsetTop of a given DOM element.
+ //Looks up the entire ancestry of an element, up to the first relatively positioned element.
+ nv.tooltip.findTotalOffsetTop = function ( Elem, initialTop ) {
+ var offsetTop = initialTop;
+
+ do {
+ if( !isNaN( Elem.offsetTop ) ) {
+ offsetTop += (Elem.offsetTop);
+ }
+ } while( Elem = Elem.offsetParent );
+ return offsetTop;
+ };
+
+ //Finds the total offsetLeft of a given DOM element.
+ //Looks up the entire ancestry of an element, up to the first relatively positioned element.
+ nv.tooltip.findTotalOffsetLeft = function ( Elem, initialLeft) {
+ var offsetLeft = initialLeft;
+
+ do {
+ if( !isNaN( Elem.offsetLeft ) ) {
+ offsetLeft += (Elem.offsetLeft);
+ }
+ } while( Elem = Elem.offsetParent );
+ return offsetLeft;
+ };
+
+ //Global utility function to render a tooltip on the DOM.
+ //pos = [left,top] coordinates of where to place the tooltip, relative to the SVG chart container.
+ //gravity = how to orient the tooltip
+ //dist = how far away from the mouse to place tooltip
+ //container = tooltip DIV
+ nv.tooltip.calcTooltipPosition = function(pos, gravity, dist, container) {
+
+ var height = parseInt(container.offsetHeight),
+ width = parseInt(container.offsetWidth),
+ windowWidth = nv.utils.windowSize().width,
+ windowHeight = nv.utils.windowSize().height,
+ scrollTop = window.pageYOffset,
+ scrollLeft = window.pageXOffset,
+ left, top;
+
+ windowHeight = window.innerWidth >= document.body.scrollWidth ? windowHeight : windowHeight - 16;
+ windowWidth = window.innerHeight >= document.body.scrollHeight ? windowWidth : windowWidth - 16;
+
+ gravity = gravity || 's';
+ dist = dist || 20;
+
+ var tooltipTop = function ( Elem ) {
+ return nv.tooltip.findTotalOffsetTop(Elem, top);
+ };
+
+ var tooltipLeft = function ( Elem ) {
+ return nv.tooltip.findTotalOffsetLeft(Elem,left);
+ };
+
+ switch (gravity) {
+ case 'e':
+ left = pos[0] - width - dist;
+ top = pos[1] - (height / 2);
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = pos[0] + dist > scrollLeft ? pos[0] + dist : scrollLeft - tLeft + left;
+ if (tTop < scrollTop) top = scrollTop - tTop + top;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
+ break;
+ case 'w':
+ left = pos[0] + dist;
+ top = pos[1] - (height / 2);
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft + width > windowWidth) left = pos[0] - width - dist;
+ if (tTop < scrollTop) top = scrollTop + 5;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
+ break;
+ case 'n':
+ left = pos[0] - (width / 2) - 5;
+ top = pos[1] + dist;
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = scrollLeft + 5;
+ if (tLeft + width > windowWidth) left = left - width/2 + 5;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
+ break;
+ case 's':
+ left = pos[0] - (width / 2);
+ top = pos[1] - height - dist;
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = scrollLeft + 5;
+ if (tLeft + width > windowWidth) left = left - width/2 + 5;
+ if (scrollTop > tTop) top = scrollTop;
+ break;
+ case 'none':
+ left = pos[0];
+ top = pos[1] - dist;
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ break;
+ }
+
+
+ container.style.left = left+'px';
+ container.style.top = top+'px';
+ container.style.opacity = 1;
+ container.style.position = 'absolute';
+
+ return container;
+ };
+
+ //Global utility function to remove tooltips from the DOM.
+ nv.tooltip.cleanup = function() {
+
+ // Find the tooltips, mark them for removal by this class (so others cleanups won't find it)
+ var tooltips = document.getElementsByClassName('nvtooltip');
+ var purging = [];
+ while(tooltips.length) {
+ purging.push(tooltips[0]);
+ tooltips[0].style.transitionDelay = '0 !important';
+ tooltips[0].style.opacity = 0;
+ tooltips[0].className = 'nvtooltip-pending-removal';
+ }
+
+ setTimeout(function() {
+
+ while (purging.length) {
+ var removeMe = purging.pop();
+ removeMe.parentNode.removeChild(removeMe);
+ }
+ }, 500);
+ };
+
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/utils.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/utils.js
new file mode 100644
index 00000000..7b99e1da
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/utils.js
@@ -0,0 +1,152 @@
+
+nv.utils.windowSize = function() {
+ // Sane defaults
+ var size = {width: 640, height: 480};
+
+ // Earlier IE uses Doc.body
+ if (document.body && document.body.offsetWidth) {
+ size.width = document.body.offsetWidth;
+ size.height = document.body.offsetHeight;
+ }
+
+ // IE can use depending on mode it is in
+ if (document.compatMode=='CSS1Compat' &&
+ document.documentElement &&
+ document.documentElement.offsetWidth ) {
+ size.width = document.documentElement.offsetWidth;
+ size.height = document.documentElement.offsetHeight;
+ }
+
+ // Most recent browsers use
+ if (window.innerWidth && window.innerHeight) {
+ size.width = window.innerWidth;
+ size.height = window.innerHeight;
+ }
+ return (size);
+};
+
+
+
+// Easy way to bind multiple functions to window.onresize
+// TODO: give a way to remove a function after its bound, other than removing all of them
+nv.utils.windowResize = function(fun){
+ if (fun === undefined) return;
+ var oldresize = window.onresize;
+
+ window.onresize = function(e) {
+ if (typeof oldresize == 'function') oldresize(e);
+ fun(e);
+ }
+}
+
+// Backwards compatible way to implement more d3-like coloring of graphs.
+// If passed an array, wrap it in a function which implements the old default
+// behavior
+nv.utils.getColor = function(color) {
+ if (!arguments.length) return nv.utils.defaultColor(); //if you pass in nothing, get default colors back
+
+ if( Object.prototype.toString.call( color ) === '[object Array]' )
+ return function(d, i) { return d.color || color[i % color.length]; };
+ else
+ return color;
+ //can't really help it if someone passes rubbish as color
+}
+
+// Default color chooser uses the index of an object as before.
+nv.utils.defaultColor = function() {
+ var colors = d3.scale.category20().range();
+ return function(d, i) { return d.color || colors[i % colors.length] };
+}
+
+
+// Returns a color function that takes the result of 'getKey' for each series and
+// looks for a corresponding color from the dictionary,
+nv.utils.customTheme = function(dictionary, getKey, defaultColors) {
+ getKey = getKey || function(series) { return series.key }; // use default series.key if getKey is undefined
+ defaultColors = defaultColors || d3.scale.category20().range(); //default color function
+
+ var defIndex = defaultColors.length; //current default color (going in reverse)
+
+ return function(series, index) {
+ var key = getKey(series);
+
+ if (!defIndex) defIndex = defaultColors.length; //used all the default colors, start over
+
+ if (typeof dictionary[key] !== "undefined")
+ return (typeof dictionary[key] === "function") ? dictionary[key]() : dictionary[key];
+ else
+ return defaultColors[--defIndex]; // no match in dictionary, use default color
+ }
+}
+
+
+
+// From the PJAX example on d3js.org, while this is not really directly needed
+// it's a very cool method for doing pjax, I may expand upon it a little bit,
+// open to suggestions on anything that may be useful
+nv.utils.pjax = function(links, content) {
+ d3.selectAll(links).on("click", function() {
+ history.pushState(this.href, this.textContent, this.href);
+ load(this.href);
+ d3.event.preventDefault();
+ });
+
+ function load(href) {
+ d3.html(href, function(fragment) {
+ var target = d3.select(content).node();
+ target.parentNode.replaceChild(d3.select(fragment).select(content).node(), target);
+ nv.utils.pjax(links, content);
+ });
+ }
+
+ d3.select(window).on("popstate", function() {
+ if (d3.event.state) load(d3.event.state);
+ });
+}
+
+/* For situations where we want to approximate the width in pixels for an SVG:text element.
+Most common instance is when the element is in a display:none; container.
+Forumla is : text.length * font-size * constant_factor
+*/
+nv.utils.calcApproxTextWidth = function (svgTextElem) {
+ if (svgTextElem instanceof d3.selection) {
+ var fontSize = parseInt(svgTextElem.style("font-size").replace("px",""));
+ var textLength = svgTextElem.text().length;
+
+ return textLength * fontSize * 0.5;
+ }
+ return 0;
+};
+
+/* Numbers that are undefined, null or NaN, convert them to zeros.
+*/
+nv.utils.NaNtoZero = function(n) {
+ if (typeof n !== 'number'
+ || isNaN(n)
+ || n === null
+ || n === Infinity) return 0;
+
+ return n;
+};
+
+/*
+Snippet of code you can insert into each nv.models.* to give you the ability to
+do things like:
+chart.options({
+ showXAxis: true,
+ tooltips: true
+});
+
+To enable in the chart:
+chart.options = nv.utils.optionsFunc.bind(chart);
+*/
+nv.utils.optionsFunc = function(args) {
+ if (args) {
+ d3.map(args).forEach((function(key,value) {
+ if (typeof this[key] === "function") {
+ this[key](value);
+ }
+ }).bind(this));
+ }
+ return this;
+}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Rlogo.jpg b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Rlogo.jpg
new file mode 100644
index 00000000..656a6b1f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Rlogo.jpg
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Thumbs.db b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Thumbs.db
new file mode 100644
index 00000000..f504b226
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Thumbs.db
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_icon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_icon.png
new file mode 100644
index 00000000..f2d1bc0b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_icon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_list_spacer.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_list_spacer.gif
new file mode 100644
index 00000000..0afdd23b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_list_spacer.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/active.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/active.png
new file mode 100644
index 00000000..45241776
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/active.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add.png
new file mode 100644
index 00000000..46d944b3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add_tool_button.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add_tool_button.png
new file mode 100644
index 00000000..1e7890dd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add_tool_button.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/addicon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/addicon.png
new file mode 100644
index 00000000..6cb5042f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/addicon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/application_window_bg.jpg b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/application_window_bg.jpg
new file mode 100644
index 00000000..c559e590
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/application_window_bg.jpg
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-next.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-next.png
new file mode 100644
index 00000000..1a4f72c6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-next.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-prev.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-prev.png
new file mode 100644
index 00000000..8211eba1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-prev.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/att_angular_gridster/grips.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/att_angular_gridster/grips.png
new file mode 100644
index 00000000..29b92cc5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/att_angular_gridster/grips.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/backButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/backButton.png
new file mode 100644
index 00000000..e27ea8cd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/backButton.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blank.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blank.gif
new file mode 100644
index 00000000..75b945d2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blank.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blueButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blueButton.png
new file mode 100644
index 00000000..0cfbee11
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blueButton.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/bubble.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/bubble.png
new file mode 100644
index 00000000..dd5abd37
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/bubble.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/cache.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/cache.png
new file mode 100644
index 00000000..67fb3550
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/cache.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/calendar.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/calendar.gif
new file mode 100644
index 00000000..a90aef06
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/calendar.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/chevron.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/chevron.png
new file mode 100644
index 00000000..7f7ae156
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/chevron.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/close_container.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/close_container.gif
new file mode 100644
index 00000000..e2f67d72
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/close_container.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/collapsed-icon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/collapsed-icon.png
new file mode 100644
index 00000000..000cbec5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/collapsed-icon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/column-bg.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/column-bg.png
new file mode 100644
index 00000000..1005ea7d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/column-bg.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon-highlighted.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon-highlighted.png
new file mode 100644
index 00000000..312c4398
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon-highlighted.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon.png
new file mode 100644
index 00000000..6c1c3c15
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.jpg b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.jpg
new file mode 100644
index 00000000..b4d795bd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.jpg
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.png
new file mode 100644
index 00000000..bfae8fc3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-add.png
new file mode 100644
index 00000000..127cdac4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-add.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-search.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-search.png
new file mode 100644
index 00000000..fb08f84e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-search.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers.png
new file mode 100644
index 00000000..f9bb5ef1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/decrypted.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/decrypted.png
new file mode 100644
index 00000000..236cbeb8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/decrypted.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.gif
new file mode 100644
index 00000000..b62241b4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.png
new file mode 100644
index 00000000..aee193de
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon.gif
new file mode 100644
index 00000000..4b07af82
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp.png
new file mode 100644
index 00000000..b355f109
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp_trans.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp_trans.png
new file mode 100644
index 00000000..4e8381c1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp_trans.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/editicon.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/editicon.gif
new file mode 100644
index 00000000..48538c18
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/editicon.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/error_type.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/error_type.gif
new file mode 100644
index 00000000..bd51e815
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/error_type.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/example-frame.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/example-frame.png
new file mode 100644
index 00000000..31f2fe1c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/example-frame.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/excelicon_multi.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/excelicon_multi.gif
new file mode 100644
index 00000000..1a4fbaab
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/excelicon_multi.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/executeicon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/executeicon.png
new file mode 100644
index 00000000..295c429b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/executeicon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/expanded-icon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/expanded-icon.png
new file mode 100644
index 00000000..490e068f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/expanded-icon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file-add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file-add.png
new file mode 100644
index 00000000..076bd898
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file-add.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_import.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_import.png
new file mode 100644
index 00000000..2374ba3f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_import.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_save-all.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_save-all.png
new file mode 100644
index 00000000..3c300ecb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_save-all.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/filter_icon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/filter_icon.png
new file mode 100644
index 00000000..c36ad2c2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/filter_icon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_add.png
new file mode 100644
index 00000000..83761c29
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_add.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_closed.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_closed.png
new file mode 100644
index 00000000..1b365fd8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_closed.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_delete.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_delete.png
new file mode 100644
index 00000000..bb56a9e6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_delete.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_edit.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_edit.png
new file mode 100644
index 00000000..fe774a62
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_edit.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_open.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_open.png
new file mode 100644
index 00000000..f1ed9abe
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_open.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_user.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_user.png
new file mode 100644
index 00000000..2cd28412
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_user.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/funnel.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/funnel.png
new file mode 100644
index 00000000..35f1d259
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/funnel.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/fusion.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/fusion.gif
new file mode 100644
index 00000000..368319e6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/fusion.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/grayButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/grayButton.png
new file mode 100644
index 00000000..83f2c45e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/grayButton.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/gray_add_tool_button.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/gray_add_tool_button.png
new file mode 100644
index 00000000..962b0a8a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/gray_add_tool_button.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/headerChatIcon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/headerChatIcon.png
new file mode 100644
index 00000000..9b0840ad
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/headerChatIcon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/icon_remove_all.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/icon_remove_all.gif
new file mode 100644
index 00000000..0912b4a3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/icon_remove_all.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/inactive.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/inactive.png
new file mode 100644
index 00000000..e9920bf4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/inactive.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/info_type.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/info_type.gif
new file mode 100644
index 00000000..8dd66f30
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/info_type.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/leftButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/leftButton.png
new file mode 100644
index 00000000..edf02c6c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/leftButton.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading.gif
new file mode 100644
index 00000000..cccb0fc9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading_bar.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading_bar.gif
new file mode 100644
index 00000000..eed8a505
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading_bar.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/login_button.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/login_button.gif
new file mode 100644
index 00000000..990b5227
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/login_button.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/m1.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/m1.gif
new file mode 100644
index 00000000..f7161fd9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/m1.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/mail.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/mail.png
new file mode 100644
index 00000000..bcf7d254
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/mail.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/map.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/map.png
new file mode 100644
index 00000000..9ecb79ab
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/map.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/minus.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/minus.gif
new file mode 100644
index 00000000..0c62d1a0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/minus.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/modify_icon.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/modify_icon.gif
new file mode 100644
index 00000000..994fe655
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/modify_icon.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/no_favorites_star.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/no_favorites_star.png
new file mode 100644
index 00000000..4db05403
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/no_favorites_star.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-add.png
new file mode 100644
index 00000000..96bbaf47
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-add.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-search.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-search.png
new file mode 100644
index 00000000..dbdab172
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-search.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note.png
new file mode 100644
index 00000000..f082b0e9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/notes.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/notes.png
new file mode 100644
index 00000000..f54a9e8d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/notes.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offline.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offline.png
new file mode 100644
index 00000000..4519ff32
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offline.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offlineMsg.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offlineMsg.gif
new file mode 100644
index 00000000..dbbe02fb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offlineMsg.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/online.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/online.png
new file mode 100644
index 00000000..7a74a9c5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/online.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/page.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/page.gif
new file mode 100644
index 00000000..10b36fa9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/page.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pagination.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pagination.png
new file mode 100644
index 00000000..4dc46107
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pagination.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-e-w-toggle.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-e-w-toggle.png
new file mode 100644
index 00000000..b3863ee7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-e-w-toggle.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-n-s-toggle.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-n-s-toggle.png
new file mode 100644
index 00000000..b5d9c3c0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-n-s-toggle.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pix.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pix.gif
new file mode 100644
index 00000000..c7bee69b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pix.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/plus.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/plus.gif
new file mode 100644
index 00000000..4a51f04d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/plus.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/printer.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/printer.gif
new file mode 100644
index 00000000..37f2d98a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/printer.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/profile.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/profile.png
new file mode 100644
index 00000000..a3998fca
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/profile.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-add.png
new file mode 100644
index 00000000..c75b6663
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-add.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-favorite.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-favorite.png
new file mode 100644
index 00000000..e75cacc3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-favorite.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-my.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-my.png
new file mode 100644
index 00000000..1b9e092d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-my.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-public.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-public.png
new file mode 100644
index 00000000..9ee052ec
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-public.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report.png
new file mode 100644
index 00000000..b0cd69fc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/reports.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/reports.png
new file mode 100644
index 00000000..40dca71e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/reports.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-active.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-active.png
new file mode 100644
index 00000000..0e54592c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-active.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-disabled.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-disabled.png
new file mode 100644
index 00000000..f5610ff5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-disabled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-active.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-active.png
new file mode 100644
index 00000000..5ee5da40
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-active.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-disabled.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-disabled.png
new file mode 100644
index 00000000..8647a553
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-disabled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-active.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-active.png
new file mode 100644
index 00000000..3c079364
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-active.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-disabled.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-disabled.png
new file mode 100644
index 00000000..12f6d6b6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-disabled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-active.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-active.png
new file mode 100644
index 00000000..2c7246af
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-active.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-disabled.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-disabled.png
new file mode 100644
index 00000000..46c82bd5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-disabled.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_last.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_last.png
new file mode 100644
index 00000000..b8c4f099
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_last.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_previous.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_previous.png
new file mode 100644
index 00000000..73b83326
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_previous.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/return_to_top.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/return_to_top.gif
new file mode 100644
index 00000000..f02defb9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/return_to_top.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/rightButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/rightButton.png
new file mode 100644
index 00000000..9d868f9b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/rightButton.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search.png
new file mode 100644
index 00000000..7ff964f8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search_profile.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search_profile.png
new file mode 100644
index 00000000..28852144
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search_profile.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_asc.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_asc.gif
new file mode 100644
index 00000000..427928f3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_asc.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_desc.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_desc.gif
new file mode 100644
index 00000000..5aa81a18
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_desc.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/spacer.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/spacer.gif
new file mode 100644
index 00000000..fc256098
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/spacer.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/success_type.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/success_type.gif
new file mode 100644
index 00000000..2f72242b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/success_type.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/swoosh.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/swoosh.gif
new file mode 100644
index 00000000..4b791772
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/swoosh.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-hm.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-hm.png
new file mode 100644
index 00000000..1e75d8d4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-hm.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-v-hm.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-v-hm.png
new file mode 100644
index 00000000..df8c6cbf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-v-hm.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab.png
new file mode 100644
index 00000000..00eb6fcb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-add.png
new file mode 100644
index 00000000..0c138576
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-add.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-delete.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-delete.png
new file mode 100644
index 00000000..917d7d28
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-delete.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-edit.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-edit.png
new file mode 100644
index 00000000..40dbc0bd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-edit.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table.png
new file mode 100644
index 00000000..ff025e70
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tabs-bg.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tabs-bg.png
new file mode 100644
index 00000000..f711bc02
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tabs-bg.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.gif
new file mode 100644
index 00000000..6d3923ef
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.png
new file mode 100644
index 00000000..afe4d7a3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolbar.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolbar.png
new file mode 100644
index 00000000..3dde94c0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolbar.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/users.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/users.png
new file mode 100644
index 00000000..13fec65e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/users.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/warning_type.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/warning_type.gif
new file mode 100644
index 00000000..fd7b9a05
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/warning_type.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/webphone.ico b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/webphone.ico
new file mode 100644
index 00000000..d58e62ab
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/webphone.ico
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/whiteButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/whiteButton.png
new file mode 100644
index 00000000..ce8c9cb4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/whiteButton.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/angular-gridster.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/angular-gridster.js
new file mode 100644
index 00000000..985fa434
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/angular-gridster.js
@@ -0,0 +1,2244 @@
+/*global define:true*/
+(function(root, factory) {
+
+ 'use strict';
+
+ if (typeof define === 'function' && define.amd) {
+ // AMD
+ define(['angular'], factory);
+ } else if (typeof exports === 'object') {
+ // CommonJS
+ module.exports = factory(require('angular'));
+ } else {
+ // Browser, nothing "exported". Only registered as a module with angular.
+ factory(root.angular);
+ }
+}(this, function(angular) {
+
+ 'use strict';
+
+ var ie8 = false;
+
+ var getInternetExplorerVersion = function ()
+ // Returns the version of Internet Explorer >4 or
+ // undefined(indicating the use of another browser).
+ {
+ var isIE10 = (eval("/*@cc_on!@*/false") && document.documentMode === 10);
+ if (isIE10) {
+ return 10;
+ }
+ var v = 3,
+ div = document.createElement('div'),
+ all = div.getElementsByTagName('i');
+ do {
+ div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->';
+ } while (all[0]);
+ return v > 4 ? v : undefined;
+ };
+
+ var browserVersion = getInternetExplorerVersion();
+
+ if (browserVersion && browserVersion < 9) {
+ ie8 = true;
+ }
+
+ // This returned angular module 'gridster' is what is exported.
+ return angular.module('attGridsterLib', [])
+
+ .constant('gridsterConfig', {
+ columns: 6, // number of columns in the grid
+ pushing: true, // whether to push other items out of the way
+ floating: true, // whether to automatically float items up so they stack
+ swapping: true, // whether or not to have items switch places instead of push down if they are the same size
+ width: 'auto', // width of the grid. "auto" will expand the grid to its parent container
+ colWidth: 'auto', // width of grid columns. "auto" will divide the width of the grid evenly among the columns
+ rowHeight: 'match', // height of grid rows. 'match' will make it the same as the column width, a numeric value will be interpreted as pixels, '/2' is half the column width, '*5' is five times the column width, etc.
+ margins: [10, 10], // margins in between grid items
+ outerMargin: false,
+ isMobile: false, // toggle mobile view
+ mobileBreakPoint: 100, // width threshold to toggle mobile mode
+ mobileModeEnabled: true, // whether or not to toggle mobile mode when screen width is less than mobileBreakPoint
+ minColumns: 1, // minimum amount of columns the grid can scale down to
+ minRows: 1, // minimum amount of rows to show if the grid is empty
+ maxRows: 100, // maximum amount of rows in the grid
+ defaultSizeX: 1, // default width of an item in columns
+ defaultSizeY: 1, // default height of an item in rows
+ minSizeX: 1, // minimum column width of an item
+ maxSizeX: null, // maximum column width of an item
+ minSizeY: 1, // minumum row height of an item
+ maxSizeY: null, // maximum row height of an item
+ saveGridItemCalculatedHeightInMobile: false, // grid item height in mobile display. true- to use the calculated height by sizeY given
+ resizable: { // options to pass to resizable handler
+ enabled: false,
+ handles: ['s', 'e', 'n', 'w', 'se', 'ne', 'sw', 'nw']
+ },
+ draggable: { // options to pass to draggable handler
+ enabled: true,
+ scrollSensitivity: 20, // Distance in pixels from the edge of the viewport after which the viewport should scroll, relative to pointer
+ scrollSpeed: 15 // Speed at which the window should scroll once the mouse pointer gets within scrollSensitivity distance
+ }
+ })
+
+ .controller('GridsterCtrl', ['gridsterConfig', '$timeout',
+ function(gridsterConfig, $timeout) {
+
+ var gridster = this;
+
+ /**
+ * Create options from gridsterConfig constant
+ */
+ angular.extend(this, gridsterConfig);
+
+ this.resizable = angular.extend({}, gridsterConfig.resizable || {});
+ this.draggable = angular.extend({}, gridsterConfig.draggable || {});
+
+ var flag = false;
+ this.layoutChanged = function() {
+ if (flag) {
+ return;
+ }
+ flag = true;
+ $timeout(function() {
+ flag = false;
+ if (gridster.loaded) {
+ gridster.floatItemsUp();
+ }
+ gridster.updateHeight(gridster.movingItem ? gridster.movingItem.sizeY : 0);
+ }, 30);
+ };
+
+ /**
+ * A positional array of the items in the grid
+ */
+ this.grid = [];
+
+ /**
+ * Clean up after yourself
+ */
+ this.destroy = function() {
+ // empty the grid to cut back on the possibility
+ // of circular references
+ if (this.grid) {
+ this.grid = [];
+ }
+ this.$element = null;
+ };
+
+ /**
+ * Overrides default options
+ *
+ * @param {Object} options The options to override
+ */
+ this.setOptions = function(options) {
+ if (!options) {
+ return;
+ }
+
+ options = angular.extend({}, options);
+
+ // all this to avoid using jQuery...
+ if (options.draggable) {
+ angular.extend(this.draggable, options.draggable);
+ delete(options.draggable);
+ }
+ if (options.resizable) {
+ angular.extend(this.resizable, options.resizable);
+ delete(options.resizable);
+ }
+
+ angular.extend(this, options);
+
+ if (!this.margins || this.margins.length !== 2) {
+ this.margins = [0, 0];
+ } else {
+ for (var x = 0, l = this.margins.length; x < l; ++x) {
+ this.margins[x] = parseInt(this.margins[x], 10);
+ if (isNaN(this.margins[x])) {
+ this.margins[x] = 0;
+ }
+ }
+ }
+ };
+
+ /**
+ * Check if item can occupy a specified position in the grid
+ *
+ * @param {Object} item The item in question
+ * @param {Number} row The row index
+ * @param {Number} column The column index
+ * @returns {Boolean} True if if item fits
+ */
+ this.canItemOccupy = function(item, row, column) {
+ return row > -1 && column > -1 && item.sizeX + column <= this.columns && item.sizeY + row <= this.maxRows;
+ };
+
+ /**
+ * Set the item in the first suitable position
+ *
+ * @param {Object} item The item to insert
+ */
+ this.autoSetItemPosition = function(item) {
+ // walk through each row and column looking for a place it will fit
+ for (var rowIndex = 0; rowIndex < this.maxRows; ++rowIndex) {
+ for (var colIndex = 0; colIndex < this.columns; ++colIndex) {
+ // only insert if position is not already taken and it can fit
+ var items = this.getItems(rowIndex, colIndex, item.sizeX, item.sizeY, item);
+ if (items.length === 0 && this.canItemOccupy(item, rowIndex, colIndex)) {
+ this.putItem(item, rowIndex, colIndex);
+ return;
+ }
+ }
+ }
+ throw new Error('Unable to place item!');
+ };
+
+ /**
+ * Gets items at a specific coordinate
+ *
+ * @param {Number} row
+ * @param {Number} column
+ * @param {Number} sizeX
+ * @param {Number} sizeY
+ * @param {Array} excludeItems An array of items to exclude from selection
+ * @returns {Array} Items that match the criteria
+ */
+ this.getItems = function(row, column, sizeX, sizeY, excludeItems) {
+ var items = [];
+ if (!sizeX || !sizeY) {
+ sizeX = sizeY = 1;
+ }
+ if (excludeItems && !(excludeItems instanceof Array)) {
+ excludeItems = [excludeItems];
+ }
+ for (var h = 0; h < sizeY; ++h) {
+ for (var w = 0; w < sizeX; ++w) {
+ var item = this.getItem(row + h, column + w, excludeItems);
+ if (item && (!excludeItems || excludeItems.indexOf(item) === -1) && items.indexOf(item) === -1) {
+ items.push(item);
+ }
+ }
+ }
+ return items;
+ };
+
+ /**
+ * @param {Array} items
+ * @returns {Object} An item that represents the bounding box of the items
+ */
+ this.getBoundingBox = function(items) {
+
+ if (items.length === 0) {
+ return null;
+ }
+ if (items.length === 1) {
+ return {
+ row: items[0].row,
+ col: items[0].col,
+ sizeY: items[0].sizeY,
+ sizeX: items[0].sizeX
+ };
+ }
+
+ var maxRow = 0;
+ var maxCol = 0;
+ var minRow = 9999;
+ var minCol = 9999;
+
+ for (var i = 0, l = items.length; i < l; ++i) {
+ var item = items[i];
+ minRow = Math.min(item.row, minRow);
+ minCol = Math.min(item.col, minCol);
+ maxRow = Math.max(item.row + item.sizeY, maxRow);
+ maxCol = Math.max(item.col + item.sizeX, maxCol);
+ }
+
+ return {
+ row: minRow,
+ col: minCol,
+ sizeY: maxRow - minRow,
+ sizeX: maxCol - minCol
+ };
+ };
+
+
+ /**
+ * Removes an item from the grid
+ *
+ * @param {Object} item
+ */
+ this.removeItem = function(item) {
+ for (var rowIndex = 0, l = this.grid.length; rowIndex < l; ++rowIndex) {
+ var columns = this.grid[rowIndex];
+ if (!columns) {
+ continue;
+ }
+ var index = columns.indexOf(item);
+ if (index !== -1) {
+ columns[index] = null;
+ break;
+ }
+ }
+ this.layoutChanged();
+ };
+
+ /**
+ * Returns the item at a specified coordinate
+ *
+ * @param {Number} row
+ * @param {Number} column
+ * @param {Array} excludeItems Items to exclude from selection
+ * @returns {Object} The matched item or null
+ */
+ this.getItem = function(row, column, excludeItems) {
+ if (excludeItems && !(excludeItems instanceof Array)) {
+ excludeItems = [excludeItems];
+ }
+ var sizeY = 1;
+ while (row > -1) {
+ var sizeX = 1,
+ col = column;
+ while (col > -1) {
+ var items = this.grid[row];
+ if (items) {
+ var item = items[col];
+ if (item && (!excludeItems || excludeItems.indexOf(item) === -1) && item.sizeX >= sizeX && item.sizeY >= sizeY) {
+ return item;
+ }
+ }
+ ++sizeX;
+ --col;
+ }
+ --row;
+ ++sizeY;
+ }
+ return null;
+ };
+
+ /**
+ * Insert an array of items into the grid
+ *
+ * @param {Array} items An array of items to insert
+ */
+ this.putItems = function(items) {
+ for (var i = 0, l = items.length; i < l; ++i) {
+ this.putItem(items[i]);
+ }
+ };
+
+ /**
+ * Insert a single item into the grid
+ *
+ * @param {Object} item The item to insert
+ * @param {Number} row (Optional) Specifies the items row index
+ * @param {Number} column (Optional) Specifies the items column index
+ * @param {Array} ignoreItems
+ */
+ this.putItem = function(item, row, column, ignoreItems) {
+ // auto place item if no row specified
+ if (typeof row === 'undefined' || row === null) {
+ row = item.row;
+ column = item.col;
+ if (typeof row === 'undefined' || row === null) {
+ this.autoSetItemPosition(item);
+ return;
+ }
+ }
+
+ // keep item within allowed bounds
+ if (!this.canItemOccupy(item, row, column)) {
+ column = Math.min(this.columns - item.sizeX, Math.max(0, column));
+ row = Math.min(this.maxRows - item.sizeY, Math.max(0, row));
+ }
+
+ // check if item is already in grid
+ if (item.oldRow !== null && typeof item.oldRow !== 'undefined') {
+ var samePosition = item.oldRow === row && item.oldColumn === column;
+ var inGrid = this.grid[row] && this.grid[row][column] === item;
+ if (samePosition && inGrid) {
+ item.row = row;
+ item.col = column;
+ return;
+ } else {
+ // remove from old position
+ var oldRow = this.grid[item.oldRow];
+ if (oldRow && oldRow[item.oldColumn] === item) {
+ delete oldRow[item.oldColumn];
+ }
+ }
+ }
+
+ item.oldRow = item.row = row;
+ item.oldColumn = item.col = column;
+
+ this.moveOverlappingItems(item, ignoreItems);
+
+ if (!this.grid[row]) {
+ this.grid[row] = [];
+ }
+ this.grid[row][column] = item;
+
+ if (this.movingItem === item) {
+ this.floatItemUp(item);
+ }
+ this.layoutChanged();
+ };
+
+ /**
+ * Trade row and column if item1 with item2
+ *
+ * @param {Object} item1
+ * @param {Object} item2
+ */
+ this.swapItems = function(item1, item2) {
+ this.grid[item1.row][item1.col] = item2;
+ this.grid[item2.row][item2.col] = item1;
+
+ var item1Row = item1.row;
+ var item1Col = item1.col;
+ item1.row = item2.row;
+ item1.col = item2.col;
+ item2.row = item1Row;
+ item2.col = item1Col;
+ };
+
+ /**
+ * Prevents items from being overlapped
+ *
+ * @param {Object} item The item that should remain
+ * @param {Array} ignoreItems
+ */
+ this.moveOverlappingItems = function(item, ignoreItems) {
+ // don't move item, so ignore it
+ if (!ignoreItems) {
+ ignoreItems = [item];
+ } else if (ignoreItems.indexOf(item) === -1) {
+ ignoreItems = ignoreItems.slice(0);
+ ignoreItems.push(item);
+ }
+
+ // get the items in the space occupied by the item's coordinates
+ var overlappingItems = this.getItems(
+ item.row,
+ item.col,
+ item.sizeX,
+ item.sizeY,
+ ignoreItems
+ );
+ this.moveItemsDown(overlappingItems, item.row + item.sizeY, ignoreItems);
+ };
+
+ /**
+ * Moves an array of items to a specified row
+ *
+ * @param {Array} items The items to move
+ * @param {Number} newRow The target row
+ * @param {Array} ignoreItems
+ */
+ this.moveItemsDown = function(items, newRow, ignoreItems) {
+ if (!items || items.length === 0) {
+ return;
+ }
+ items.sort(function(a, b) {
+ return a.row - b.row;
+ });
+
+ ignoreItems = ignoreItems ? ignoreItems.slice(0) : [];
+ var topRows = {},
+ item, i, l;
+
+ // calculate the top rows in each column
+ for (i = 0, l = items.length; i < l; ++i) {
+ item = items[i];
+ var topRow = topRows[item.col];
+ if (typeof topRow === 'undefined' || item.row < topRow) {
+ topRows[item.col] = item.row;
+ }
+ }
+
+ // move each item down from the top row in its column to the row
+ for (i = 0, l = items.length; i < l; ++i) {
+ item = items[i];
+ var rowsToMove = newRow - topRows[item.col];
+ this.moveItemDown(item, item.row + rowsToMove, ignoreItems);
+ ignoreItems.push(item);
+ }
+ };
+
+ /**
+ * Moves an item down to a specified row
+ *
+ * @param {Object} item The item to move
+ * @param {Number} newRow The target row
+ * @param {Array} ignoreItems
+ */
+ this.moveItemDown = function(item, newRow, ignoreItems) {
+ if (item.row >= newRow) {
+ return;
+ }
+ while (item.row < newRow) {
+ ++item.row;
+ this.moveOverlappingItems(item, ignoreItems);
+ }
+ this.putItem(item, item.row, item.col, ignoreItems);
+ };
+
+ /**
+ * Moves all items up as much as possible
+ */
+ this.floatItemsUp = function() {
+ if (this.floating === false) {
+ return;
+ }
+ for (var rowIndex = 0, l = this.grid.length; rowIndex < l; ++rowIndex) {
+ var columns = this.grid[rowIndex];
+ if (!columns) {
+ continue;
+ }
+ for (var colIndex = 0, len = columns.length; colIndex < len; ++colIndex) {
+ var item = columns[colIndex];
+ if (item) {
+ this.floatItemUp(item);
+ }
+ }
+ }
+ };
+
+ /**
+ * Float an item up to the most suitable row
+ *
+ * @param {Object} item The item to move
+ */
+ this.floatItemUp = function(item) {
+ if (this.floating === false) {
+ return;
+ }
+ var colIndex = item.col,
+ sizeY = item.sizeY,
+ sizeX = item.sizeX,
+ bestRow = null,
+ bestColumn = null,
+ rowIndex = item.row - 1;
+
+ while (rowIndex > -1) {
+ var items = this.getItems(rowIndex, colIndex, sizeX, sizeY, item);
+ if (items.length !== 0) {
+ break;
+ }
+ bestRow = rowIndex;
+ bestColumn = colIndex;
+ --rowIndex;
+ }
+ if (bestRow !== null) {
+ this.putItem(item, bestRow, bestColumn);
+ }
+ };
+
+ /**
+ * Update gridsters height
+ *
+ * @param {Number} plus (Optional) Additional height to add
+ */
+ this.updateHeight = function(plus) {
+ var maxHeight = this.minRows;
+ plus = plus || 0;
+ for (var rowIndex = this.grid.length; rowIndex >= 0; --rowIndex) {
+ var columns = this.grid[rowIndex];
+ if (!columns) {
+ continue;
+ }
+ for (var colIndex = 0, len = columns.length; colIndex < len; ++colIndex) {
+ if (columns[colIndex]) {
+ maxHeight = Math.max(maxHeight, rowIndex + plus + columns[colIndex].sizeY);
+ }
+ }
+ }
+ this.gridHeight = this.maxRows - maxHeight > 0 ? Math.min(this.maxRows, maxHeight) : Math.max(this.maxRows, maxHeight);
+ };
+
+ /**
+ * Returns the number of rows that will fit in given amount of pixels
+ *
+ * @param {Number} pixels
+ * @param {Boolean} ceilOrFloor (Optional) Determines rounding method
+ */
+ this.pixelsToRows = function(pixels, ceilOrFloor) {
+ if (ceilOrFloor === true) {
+ return Math.ceil(pixels / this.curRowHeight);
+ } else if (ceilOrFloor === false) {
+ return Math.floor(pixels / this.curRowHeight);
+ }
+
+ return Math.round(pixels / this.curRowHeight);
+ };
+
+ /**
+ * Returns the number of columns that will fit in a given amount of pixels
+ *
+ * @param {Number} pixels
+ * @param {Boolean} ceilOrFloor (Optional) Determines rounding method
+ * @returns {Number} The number of columns
+ */
+ this.pixelsToColumns = function(pixels, ceilOrFloor) {
+ if (ceilOrFloor === true) {
+ return Math.ceil(pixels / this.curColWidth);
+ } else if (ceilOrFloor === false) {
+ return Math.floor(pixels / this.curColWidth);
+ }
+
+ return Math.round(pixels / this.curColWidth);
+ };
+ }
+ ])
+
+ .directive('gridsterPreview', function() {
+ return {
+ replace: true,
+ scope: true,
+ require: '^gridster',
+ template: '<div ng-style="previewStyle()" class="gridster-item gridster-preview-holder"></div>',
+ link: function(scope, $el, attrs, gridster) {
+
+ /**
+ * @returns {Object} style object for preview element
+ */
+ scope.previewStyle = function() {
+
+ if (!gridster.movingItem) {
+ return {
+ display: 'none'
+ };
+ }
+
+ return {
+ display: 'block',
+ height: (gridster.movingItem.sizeY * gridster.curRowHeight - gridster.margins[0]) + 'px',
+ width: (gridster.movingItem.sizeX * gridster.curColWidth - gridster.margins[1]) + 'px',
+ top: (gridster.movingItem.row * gridster.curRowHeight + (gridster.outerMargin ? gridster.margins[0] : 0)) + 'px',
+ left: (gridster.movingItem.col * gridster.curColWidth + (gridster.outerMargin ? gridster.margins[1] : 0)) + 'px'
+ };
+ };
+ }
+ };
+ })
+
+ /**
+ * The gridster directive
+ *
+ * @param {Function} $timeout
+ * @param {Object} $window
+ * @param {Object} $rootScope
+ * @param {Function} gridsterDebounce
+ */
+ .directive('gridster', ['$timeout', '$window', '$rootScope', 'gridsterDebounce',
+ function($timeout, $window, $rootScope, gridsterDebounce) {
+ return {
+ scope: true,
+ restrict: 'EAC',
+ controller: 'GridsterCtrl',
+ controllerAs: 'gridster',
+ compile: function($tplElem) {
+
+ $tplElem.prepend('<div ng-if="gridster.movingItem" gridster-preview></div>');
+
+ return function(scope, $elem, attrs, gridster) {
+ gridster.loaded = false;
+
+ gridster.$element = $elem;
+
+ scope.gridster = gridster;
+
+ $elem.addClass('gridster');
+
+ var isVisible = function(ele) {
+ return ele.style.visibility !== 'hidden' && ele.style.display !== 'none';
+ };
+
+ function refresh(config) {
+ gridster.setOptions(config);
+
+ if (!isVisible($elem[0])) {
+ return;
+ }
+
+ // resolve "auto" & "match" values
+ if (gridster.width === 'auto') {
+ gridster.curWidth = $elem[0].offsetWidth || parseInt($elem.css('width'), 10);
+ } else {
+ gridster.curWidth = gridster.width;
+ }
+
+ if (gridster.colWidth === 'auto') {
+ gridster.curColWidth = (gridster.curWidth + (gridster.outerMargin ? -gridster.margins[1] : gridster.margins[1])) / gridster.columns;
+ } else {
+ gridster.curColWidth = gridster.colWidth;
+ }
+
+ gridster.curRowHeight = gridster.rowHeight;
+ if (typeof gridster.rowHeight === 'string') {
+ if (gridster.rowHeight === 'match') {
+ gridster.curRowHeight = Math.round(gridster.curColWidth);
+ } else if (gridster.rowHeight.indexOf('*') !== -1) {
+ gridster.curRowHeight = Math.round(gridster.curColWidth * gridster.rowHeight.replace('*', '').replace(' ', ''));
+ } else if (gridster.rowHeight.indexOf('/') !== -1) {
+ gridster.curRowHeight = Math.round(gridster.curColWidth / gridster.rowHeight.replace('/', '').replace(' ', ''));
+ }
+ }
+
+ gridster.isMobile = gridster.mobileModeEnabled && gridster.curWidth <= gridster.mobileBreakPoint;
+
+ // loop through all items and reset their CSS
+ for (var rowIndex = 0, l = gridster.grid.length; rowIndex < l; ++rowIndex) {
+ var columns = gridster.grid[rowIndex];
+ if (!columns) {
+ continue;
+ }
+
+ for (var colIndex = 0, len = columns.length; colIndex < len; ++colIndex) {
+ if (columns[colIndex]) {
+ var item = columns[colIndex];
+ item.setElementPosition();
+ item.setElementSizeY();
+ item.setElementSizeX();
+ }
+ }
+ }
+
+ updateHeight();
+ }
+
+ var optionsKey = attrs.gridster;
+ if (optionsKey) {
+ scope.$parent.$watch(optionsKey, function(newConfig) {
+ refresh(newConfig);
+ }, true);
+ } else {
+ refresh({});
+ }
+
+ scope.$watch(function() {
+ return gridster.loaded;
+ }, function() {
+ if (gridster.loaded) {
+ $elem.addClass('gridster-loaded');
+ } else {
+ $elem.removeClass('gridster-loaded');
+ }
+ });
+
+ scope.$watch(function() {
+ return gridster.isMobile;
+ }, function() {
+ if (gridster.isMobile) {
+ $elem.addClass('gridster-mobile').removeClass('gridster-desktop');
+ } else {
+ $elem.removeClass('gridster-mobile').addClass('gridster-desktop');
+ }
+ $rootScope.$broadcast('gridster-mobile-changed', gridster);
+ });
+
+ scope.$watch(function() {
+ return gridster.draggable;
+ }, function() {
+ $rootScope.$broadcast('gridster-draggable-changed', gridster);
+ }, true);
+
+ scope.$watch(function() {
+ return gridster.resizable;
+ }, function() {
+ $rootScope.$broadcast('gridster-resizable-changed', gridster);
+ }, true);
+
+ function updateHeight() {
+ if(gridster.gridHeight){ //need to put this check, otherwise fail in IE8
+ $elem.css('height', (gridster.gridHeight * gridster.curRowHeight) + (gridster.outerMargin ? gridster.margins[0] : -gridster.margins[0]) + 'px');
+ }
+ }
+
+ scope.$watch(function() {
+ return gridster.gridHeight;
+ }, updateHeight);
+
+ scope.$watch(function() {
+ return gridster.movingItem;
+ }, function() {
+ gridster.updateHeight(gridster.movingItem ? gridster.movingItem.sizeY : 0);
+ });
+
+ var prevWidth = $elem[0].offsetWidth || parseInt($elem.css('width'), 10);
+
+ var resize = function() {
+ var width = $elem[0].offsetWidth || parseInt($elem.css('width'), 10);
+
+ if (!width || width === prevWidth || gridster.movingItem) {
+ return;
+ }
+ prevWidth = width;
+
+ if (gridster.loaded) {
+ $elem.removeClass('gridster-loaded');
+ }
+
+ refresh();
+
+ if (gridster.loaded) {
+ $elem.addClass('gridster-loaded');
+ }
+
+ $rootScope.$broadcast('gridster-resized', [width, $elem[0].offsetHeight], gridster);
+ };
+
+ // track element width changes any way we can
+ var onResize = gridsterDebounce(function onResize() {
+ resize();
+ $timeout(function() {
+ scope.$apply();
+ });
+ }, 100);
+
+ scope.$watch(function() {
+ return isVisible($elem[0]);
+ }, onResize);
+
+ // see https://github.com/sdecima/javascript-detect-element-resize
+ if (typeof window.addResizeListener === 'function') {
+ window.addResizeListener($elem[0], onResize);
+ } else {
+ scope.$watch(function() {
+ return $elem[0].offsetWidth || parseInt($elem.css('width'), 10);
+ }, resize);
+ }
+ var $win = angular.element($window);
+ $win.on('resize', onResize);
+
+ // be sure to cleanup
+ scope.$on('$destroy', function() {
+ gridster.destroy();
+ $win.off('resize', onResize);
+ if (typeof window.removeResizeListener === 'function') {
+ window.removeResizeListener($elem[0], onResize);
+ }
+ });
+
+ // allow a little time to place items before floating up
+ $timeout(function() {
+ scope.$watch('gridster.floating', function() {
+ gridster.floatItemsUp();
+ });
+ gridster.loaded = true;
+ }, 100);
+ };
+ }
+ };
+ }
+ ])
+
+ .controller('GridsterItemCtrl', function() {
+ this.$element = null;
+ this.gridster = null;
+ this.row = null;
+ this.col = null;
+ this.sizeX = null;
+ this.sizeY = null;
+ this.minSizeX = 0;
+ this.minSizeY = 0;
+ this.maxSizeX = null;
+ this.maxSizeY = null;
+
+ this.init = function($element, gridster) {
+ this.$element = $element;
+ this.gridster = gridster;
+ this.sizeX = gridster.defaultSizeX;
+ this.sizeY = gridster.defaultSizeY;
+ };
+
+ this.destroy = function() {
+ // set these to null to avoid the possibility of circular references
+ this.gridster = null;
+ this.$element = null;
+ };
+
+ /**
+ * Returns the items most important attributes
+ */
+ this.toJSON = function() {
+ return {
+ row: this.row,
+ col: this.col,
+ sizeY: this.sizeY,
+ sizeX: this.sizeX
+ };
+ };
+
+ this.isMoving = function() {
+ return this.gridster.movingItem === this;
+ };
+
+ /**
+ * Set the items position
+ *
+ * @param {Number} row
+ * @param {Number} column
+ */
+ this.setPosition = function(row, column) {
+ this.gridster.putItem(this, row, column);
+
+ if (!this.isMoving()) {
+ this.setElementPosition();
+ }
+ };
+
+ /**
+ * Sets a specified size property
+ *
+ * @param {String} key Can be either "x" or "y"
+ * @param {Number} value The size amount
+ * @param {Boolean} preventMove
+ */
+ this.setSize = function(key, value, preventMove) {
+ key = key.toUpperCase();
+ var camelCase = 'size' + key,
+ titleCase = 'Size' + key;
+ if (value === '') {
+ return;
+ }
+ value = parseInt(value, 10);
+ if (isNaN(value) || value === 0) {
+ value = this.gridster['default' + titleCase];
+ }
+ var max = key === 'X' ? this.gridster.columns : this.gridster.maxRows;
+ if (this['max' + titleCase]) {
+ max = Math.min(this['max' + titleCase], max);
+ }
+ if (this.gridster['max' + titleCase]) {
+ max = Math.min(this.gridster['max' + titleCase], max);
+ }
+ if (key === 'X' && this.cols) {
+ max -= this.cols;
+ } else if (key === 'Y' && this.rows) {
+ max -= this.rows;
+ }
+
+ var min = 0;
+ if (this['min' + titleCase]) {
+ min = Math.max(this['min' + titleCase], min);
+ }
+ if (this.gridster['min' + titleCase]) {
+ min = Math.max(this.gridster['min' + titleCase], min);
+ }
+
+ value = Math.max(Math.min(value, max), min);
+
+ var changed = (this[camelCase] !== value || (this['old' + titleCase] && this['old' + titleCase] !== value));
+ this['old' + titleCase] = this[camelCase] = value;
+
+ if (!this.isMoving()) {
+ this['setElement' + titleCase]();
+ }
+ if (!preventMove && changed) {
+ this.gridster.moveOverlappingItems(this);
+ this.gridster.layoutChanged();
+ }
+
+ return changed;
+ };
+
+ /**
+ * Sets the items sizeY property
+ *
+ * @param {Number} rows
+ * @param {Boolean} preventMove
+ */
+ this.setSizeY = function(rows, preventMove) {
+ return this.setSize('Y', rows, preventMove);
+ };
+
+ /**
+ * Sets the items sizeX property
+ *
+ * @param {Number} columns
+ * @param {Boolean} preventMove
+ */
+ this.setSizeX = function(columns, preventMove) {
+ return this.setSize('X', columns, preventMove);
+ };
+
+ /**
+ * Sets an elements position on the page
+ */
+ this.setElementPosition = function() {
+ if (this.gridster.isMobile) {
+ this.$element.css({
+ marginLeft: this.gridster.margins[0] + 'px',
+ marginRight: this.gridster.margins[0] + 'px',
+ marginTop: this.gridster.margins[1] + 'px',
+ marginBottom: this.gridster.margins[1] + 'px',
+ top: '',
+ left: ''
+ });
+ } else {
+ this.$element.css({
+ margin: 0,
+ top: (this.row * this.gridster.curRowHeight + (this.gridster.outerMargin ? this.gridster.margins[0] : 0)) + 'px',
+ left: (this.col * this.gridster.curColWidth + (this.gridster.outerMargin ? this.gridster.margins[1] : 0)) + 'px'
+ });
+ }
+ };
+
+ /**
+ * Sets an elements height
+ */
+ this.setElementSizeY = function() {
+ if (this.gridster.isMobile && !this.gridster.saveGridItemCalculatedHeightInMobile) {
+ this.$element.css('height', '');
+ } else {
+ var computedHeight = (this.sizeY * this.gridster.curRowHeight - this.gridster.margins[0]) + 'px';
+ //this.$element.css('height', computedHeight);
+ this.$element.attr('style', this.$element.attr('style') + '; ' + 'height: '+computedHeight+' !important;');
+ }
+ };
+
+ /**
+ * Sets an elements width
+ */
+ this.setElementSizeX = function() {
+ if (this.gridster.isMobile) {
+ this.$element.css('width', '');
+ } else {
+ this.$element.css('width', (this.sizeX * this.gridster.curColWidth - this.gridster.margins[1]) + 'px');
+ }
+ };
+
+ /**
+ * Gets an element's width
+ */
+ this.getElementSizeX = function() {
+ return (this.sizeX * this.gridster.curColWidth - this.gridster.margins[1]);
+ };
+
+ /**
+ * Gets an element's height
+ */
+ this.getElementSizeY = function() {
+ return (this.sizeY * this.gridster.curRowHeight - this.gridster.margins[0]);
+ };
+
+ })
+
+ .factory('GridsterTouch', [function() {
+ return function GridsterTouch(target, startEvent, moveEvent, endEvent) {
+ var lastXYById = {};
+
+ // Opera doesn't have Object.keys so we use this wrapper
+ var numberOfKeys = function(theObject) {
+ if (Object.keys) {
+ return Object.keys(theObject).length;
+ }
+
+ var n = 0,
+ key;
+ for (key in theObject) {
+ ++n;
+ }
+
+ return n;
+ };
+
+ // this calculates the delta needed to convert pageX/Y to offsetX/Y because offsetX/Y don't exist in the TouchEvent object or in Firefox's MouseEvent object
+ var computeDocumentToElementDelta = function(theElement) {
+ var elementLeft = 0;
+ var elementTop = 0;
+ var oldIEUserAgent = navigator.userAgent.match(/\bMSIE\b/);
+
+ for (var offsetElement = theElement; offsetElement != null; offsetElement = offsetElement.offsetParent) {
+ // the following is a major hack for versions of IE less than 8 to avoid an apparent problem on the IEBlog with double-counting the offsets
+ // this may not be a general solution to IE7's problem with offsetLeft/offsetParent
+ if (oldIEUserAgent &&
+ (!document.documentMode || document.documentMode < 8) &&
+ offsetElement.currentStyle.position === 'relative' && offsetElement.offsetParent && offsetElement.offsetParent.currentStyle.position === 'relative' && offsetElement.offsetLeft === offsetElement.offsetParent.offsetLeft) {
+ // add only the top
+ elementTop += offsetElement.offsetTop;
+ } else {
+ elementLeft += offsetElement.offsetLeft;
+ elementTop += offsetElement.offsetTop;
+ }
+ }
+
+ return {
+ x: elementLeft,
+ y: elementTop
+ };
+ };
+
+ // cache the delta from the document to our event target (reinitialized each mousedown/MSPointerDown/touchstart)
+ var documentToTargetDelta = computeDocumentToElementDelta(target);
+
+ // common event handler for the mouse/pointer/touch models and their down/start, move, up/end, and cancel events
+ var doEvent = function(theEvtObj) {
+
+ if (theEvtObj.type === 'mousemove' && numberOfKeys(lastXYById) === 0) {
+ return;
+ }
+
+ var prevent = true;
+
+ var pointerList = theEvtObj.changedTouches ? theEvtObj.changedTouches : [theEvtObj];
+
+ for (var i = 0; i < pointerList.length; ++i) {
+ var pointerObj = pointerList[i];
+ var pointerId = (typeof pointerObj.identifier !== 'undefined') ? pointerObj.identifier : (typeof pointerObj.pointerId !== 'undefined') ? pointerObj.pointerId : 1;
+
+ // use the pageX/Y coordinates to compute target-relative coordinates when we have them (in ie < 9, we need to do a little work to put them there)
+ if (typeof pointerObj.pageX === 'undefined') {
+
+ // initialize assuming our source element is our target
+ if(!ie8){
+ pointerObj.pageX = pointerObj.offsetX + documentToTargetDelta.x;
+ pointerObj.pageY = pointerObj.offsetY + documentToTargetDelta.y;
+ }
+ else{
+ pointerObj.pageX = pointerObj.clientX;
+ pointerObj.pageY = pointerObj.clientY;
+ }
+
+ if (pointerObj.srcElement.offsetParent === target && document.documentMode && document.documentMode === 8 && pointerObj.type === 'mousedown') {
+ // source element is a child piece of VML, we're in IE8, and we've not called setCapture yet - add the origin of the source element
+ pointerObj.pageX += pointerObj.srcElement.offsetLeft;
+ pointerObj.pageY += pointerObj.srcElement.offsetTop;
+ } else if (pointerObj.srcElement !== target && !document.documentMode || document.documentMode < 8) {
+ // source element isn't the target (most likely it's a child piece of VML) and we're in a version of IE before IE8 -
+ // the offsetX/Y values are unpredictable so use the clientX/Y values and adjust by the scroll offsets of its parents
+ // to get the document-relative coordinates (the same as pageX/Y)
+ var sx = -2,
+ sy = -2; // adjust for old IE's 2-pixel border
+ for (var scrollElement = pointerObj.srcElement; scrollElement !== null; scrollElement = scrollElement.parentNode) {
+ sx += scrollElement.scrollLeft ? scrollElement.scrollLeft : 0;
+ sy += scrollElement.scrollTop ? scrollElement.scrollTop : 0;
+ }
+
+ pointerObj.pageX = pointerObj.clientX + sx;
+ pointerObj.pageY = pointerObj.clientY + sy;
+ }
+ }
+
+
+ var pageX = pointerObj.pageX;
+ var pageY = pointerObj.pageY;
+
+ if (theEvtObj.type.match(/(start|down)$/i)) {
+ // clause for processing MSPointerDown, touchstart, and mousedown
+
+ // refresh the document-to-target delta on start in case the target has moved relative to document
+ documentToTargetDelta = computeDocumentToElementDelta(target);
+
+ // protect against failing to get an up or end on this pointerId
+ if (lastXYById[pointerId]) {
+ if (endEvent) {
+ endEvent({
+ target: theEvtObj.target,
+ which: theEvtObj.which,
+ pointerId: pointerId,
+ pageX: pageX,
+ pageY: pageY
+ });
+ }
+
+ delete lastXYById[pointerId];
+ }
+
+ if (startEvent) {
+ if (prevent) {
+ prevent = startEvent({
+ target: theEvtObj.target,
+ which: theEvtObj.which,
+ pointerId: pointerId,
+ pageX: pageX,
+ pageY: pageY
+ });
+ }
+ }
+
+ // init last page positions for this pointer
+ lastXYById[pointerId] = {
+ x: pageX,
+ y: pageY
+ };
+
+ // IE pointer model
+ if (target.msSetPointerCapture) {
+ target.msSetPointerCapture(pointerId);
+ } else if (theEvtObj.type === 'mousedown' && numberOfKeys(lastXYById) === 1) {
+ if (useSetReleaseCapture) {
+ target.setCapture(true);
+ } else {
+ document.addEventListener('mousemove', doEvent, false);
+ document.addEventListener('mouseup', doEvent, false);
+ }
+ }
+ } else if (theEvtObj.type.match(/move$/i)) {
+ // clause handles mousemove, MSPointerMove, and touchmove
+
+ if (lastXYById[pointerId] && !(lastXYById[pointerId].x === pageX && lastXYById[pointerId].y === pageY)) {
+ // only extend if the pointer is down and it's not the same as the last point
+
+ if (moveEvent && prevent) {
+ prevent = moveEvent({
+ target: theEvtObj.target,
+ which: theEvtObj.which,
+ pointerId: pointerId,
+ pageX: pageX,
+ pageY: pageY
+ });
+ }
+
+ // update last page positions for this pointer
+ lastXYById[pointerId].x = pageX;
+ lastXYById[pointerId].y = pageY;
+ }
+ } else if (lastXYById[pointerId] && theEvtObj.type.match(/(up|end|cancel)$/i)) {
+ // clause handles up/end/cancel
+
+ if (endEvent && prevent) {
+ prevent = endEvent({
+ target: theEvtObj.target,
+ which: theEvtObj.which,
+ pointerId: pointerId,
+ pageX: pageX,
+ pageY: pageY
+ });
+ }
+
+ // delete last page positions for this pointer
+ delete lastXYById[pointerId];
+
+ // in the Microsoft pointer model, release the capture for this pointer
+ // in the mouse model, release the capture or remove document-level event handlers if there are no down points
+ // nothing is required for the iOS touch model because capture is implied on touchstart
+ if (target.msReleasePointerCapture) {
+ target.msReleasePointerCapture(pointerId);
+ } else if (theEvtObj.type === 'mouseup' && numberOfKeys(lastXYById) === 0) {
+ if (useSetReleaseCapture) {
+ target.releaseCapture();
+ } else {
+ document.removeEventListener('mousemove', doEvent, false);
+ document.removeEventListener('mouseup', doEvent, false);
+ }
+ }
+ }
+ }
+
+ if (prevent) {
+ if (theEvtObj.preventDefault) {
+ theEvtObj.preventDefault();
+ }
+
+ if (theEvtObj.preventManipulation) {
+ theEvtObj.preventManipulation();
+ }
+
+ if (theEvtObj.preventMouseEvent) {
+ theEvtObj.preventMouseEvent();
+ }
+ }
+ };
+
+ var useSetReleaseCapture = false;
+ // saving the settings for contentZooming and touchaction before activation
+ var contentZooming, msTouchAction;
+
+ this.enable = function() {
+
+ if (window.navigator.msPointerEnabled) {
+ // Microsoft pointer model
+ target.addEventListener('MSPointerDown', doEvent, false);
+ target.addEventListener('MSPointerMove', doEvent, false);
+ target.addEventListener('MSPointerUp', doEvent, false);
+ target.addEventListener('MSPointerCancel', doEvent, false);
+
+ // css way to prevent panning in our target area
+ if (typeof target.style.msContentZooming !== 'undefined') {
+ contentZooming = target.style.msContentZooming;
+ target.style.msContentZooming = 'none';
+ }
+
+ // new in Windows Consumer Preview: css way to prevent all built-in touch actions on our target
+ // without this, you cannot touch draw on the element because IE will intercept the touch events
+ if (typeof target.style.msTouchAction !== 'undefined') {
+ msTouchAction = target.style.msTouchAction;
+ target.style.msTouchAction = 'none';
+ }
+ } else if (target.addEventListener) {
+ // iOS touch model
+ target.addEventListener('touchstart', doEvent, false);
+ target.addEventListener('touchmove', doEvent, false);
+ target.addEventListener('touchend', doEvent, false);
+ target.addEventListener('touchcancel', doEvent, false);
+
+ // mouse model
+ target.addEventListener('mousedown', doEvent, false);
+
+ // mouse model with capture
+ // rejecting gecko because, unlike ie, firefox does not send events to target when the mouse is outside target
+ if (target.setCapture && !window.navigator.userAgent.match(/\bGecko\b/)) {
+ useSetReleaseCapture = true;
+
+ target.addEventListener('mousemove', doEvent, false);
+ target.addEventListener('mouseup', doEvent, false);
+ }
+ } else if (target.attachEvent && target.setCapture) {
+ // legacy IE mode - mouse with capture
+ useSetReleaseCapture = true;
+ target.attachEvent('onmousedown', function() {
+ doEvent(window.event);
+ window.event.returnValue = false;
+ return false;
+ });
+ target.attachEvent('onmousemove', function() {
+ doEvent(window.event);
+ window.event.returnValue = false;
+ return false;
+ });
+ target.attachEvent('onmouseup', function() {
+ doEvent(window.event);
+ window.event.returnValue = false;
+ return false;
+ });
+ }
+ };
+
+ this.disable = function() {
+ if (window.navigator.msPointerEnabled) {
+ // Microsoft pointer model
+ target.removeEventListener('MSPointerDown', doEvent, false);
+ target.removeEventListener('MSPointerMove', doEvent, false);
+ target.removeEventListener('MSPointerUp', doEvent, false);
+ target.removeEventListener('MSPointerCancel', doEvent, false);
+
+ // reset zooming to saved value
+ if (contentZooming) {
+ target.style.msContentZooming = contentZooming;
+ }
+
+ // reset touch action setting
+ if (msTouchAction) {
+ target.style.msTouchAction = msTouchAction;
+ }
+ } else if (target.removeEventListener) {
+ // iOS touch model
+ target.removeEventListener('touchstart', doEvent, false);
+ target.removeEventListener('touchmove', doEvent, false);
+ target.removeEventListener('touchend', doEvent, false);
+ target.removeEventListener('touchcancel', doEvent, false);
+
+ // mouse model
+ target.removeEventListener('mousedown', doEvent, false);
+
+ // mouse model with capture
+ // rejecting gecko because, unlike ie, firefox does not send events to target when the mouse is outside target
+ if (target.setCapture && !window.navigator.userAgent.match(/\bGecko\b/)) {
+ useSetReleaseCapture = true;
+
+ target.removeEventListener('mousemove', doEvent, false);
+ target.removeEventListener('mouseup', doEvent, false);
+ }
+ } else if (target.detachEvent && target.setCapture) {
+ // legacy IE mode - mouse with capture
+ useSetReleaseCapture = true;
+ target.detachEvent('onmousedown');
+ target.detachEvent('onmousemove');
+ target.detachEvent('onmouseup');
+ }
+ };
+
+ return this;
+ };
+ }])
+
+ .factory('GridsterDraggable', ['$document', '$timeout', '$window', 'GridsterTouch',
+ function($document, $timeout, $window, GridsterTouch) {
+ function GridsterDraggable($el, scope, gridster, item, itemOptions) {
+
+ var elmX, elmY, elmW, elmH,
+
+ mouseX = 0,
+ mouseY = 0,
+ lastMouseX = 0,
+ lastMouseY = 0,
+ mOffX = 0,
+ mOffY = 0,
+
+ minTop = 0,
+ maxTop = 9999,
+ minLeft = 0,
+ realdocument = $document[0];
+
+ var originalCol, originalRow;
+ var inputTags = ['select', 'input', 'textarea', 'button'];
+
+ var gridsterItemDragElement = $el[0].querySelector('[gridster-item-drag]');
+ //console.log(gridsterItemDragElement);
+ var isDraggableAreaDefined = gridsterItemDragElement?true:false;
+ //console.log(isDraggableAreaDefined);
+
+ function mouseDown(e) {
+
+ if(ie8){
+ e.target = window.event.srcElement;
+ e.which = window.event.button;
+ }
+
+ if(isDraggableAreaDefined && (!gridsterItemDragElement.contains(e.target))){
+ return false;
+ }
+
+ if (inputTags.indexOf(e.target.nodeName.toLowerCase()) !== -1) {
+ return false;
+ }
+
+ var $target = angular.element(e.target);
+
+ // exit, if a resize handle was hit
+ if ($target.hasClass('gridster-item-resizable-handler')) {
+ return false;
+ }
+
+ // exit, if the target has it's own click event
+ if ($target.attr('onclick') || $target.attr('ng-click')) {
+ return false;
+ }
+
+ // only works if you have jQuery
+ if ($target.closest && $target.closest('.gridster-no-drag').length) {
+ return false;
+ }
+
+ switch (e.which) {
+ case 1:
+ // left mouse button
+ break;
+ case 2:
+ case 3:
+ // right or middle mouse button
+ return;
+ }
+
+ lastMouseX = e.pageX;
+ lastMouseY = e.pageY;
+
+ elmX = parseInt($el.css('left'), 10);
+ elmY = parseInt($el.css('top'), 10);
+ elmW = $el[0].offsetWidth;
+ elmH = $el[0].offsetHeight;
+
+ originalCol = item.col;
+ originalRow = item.row;
+
+ dragStart(e);
+
+ return true;
+ }
+
+ function mouseMove(e) {
+ if (!$el.hasClass('gridster-item-moving') || $el.hasClass('gridster-item-resizing')) {
+ return false;
+ }
+
+ var maxLeft = gridster.curWidth - 1;
+
+ // Get the current mouse position.
+ mouseX = e.pageX;
+ mouseY = e.pageY;
+
+ // Get the deltas
+ var diffX = mouseX - lastMouseX + mOffX;
+ var diffY = mouseY - lastMouseY + mOffY;
+ mOffX = mOffY = 0;
+
+ // Update last processed mouse positions.
+ lastMouseX = mouseX;
+ lastMouseY = mouseY;
+
+ var dX = diffX,
+ dY = diffY;
+ if (elmX + dX < minLeft) {
+ diffX = minLeft - elmX;
+ mOffX = dX - diffX;
+ } else if (elmX + elmW + dX > maxLeft) {
+ diffX = maxLeft - elmX - elmW;
+ mOffX = dX - diffX;
+ }
+
+ if (elmY + dY < minTop) {
+ diffY = minTop - elmY;
+ mOffY = dY - diffY;
+ } else if (elmY + elmH + dY > maxTop) {
+ diffY = maxTop - elmY - elmH;
+ mOffY = dY - diffY;
+ }
+ elmX += diffX;
+ elmY += diffY;
+
+ // set new position
+ $el.css({
+ 'top': elmY + 'px',
+ 'left': elmX + 'px'
+ });
+
+ drag(e);
+
+ return true;
+ }
+
+ function mouseUp(e) {
+ if (!$el.hasClass('gridster-item-moving') || $el.hasClass('gridster-item-resizing')) {
+ return false;
+ }
+
+ mOffX = mOffY = 0;
+
+ dragStop(e);
+
+ return true;
+ }
+
+ function dragStart(event) {
+ $el.addClass('gridster-item-moving');
+ gridster.movingItem = item;
+
+ gridster.updateHeight(item.sizeY);
+ scope.$apply(function() {
+ if (gridster.draggable && gridster.draggable.start) {
+ gridster.draggable.start(event, $el, itemOptions);
+ }
+ });
+ }
+
+ function drag(event) {
+ var oldRow = item.row,
+ oldCol = item.col,
+ hasCallback = gridster.draggable && gridster.draggable.drag,
+ scrollSensitivity = gridster.draggable.scrollSensitivity,
+ scrollSpeed = gridster.draggable.scrollSpeed;
+
+ var row = gridster.pixelsToRows(elmY);
+ var col = gridster.pixelsToColumns(elmX);
+
+ var itemsInTheWay = gridster.getItems(row, col, item.sizeX, item.sizeY, item);
+ var hasItemsInTheWay = itemsInTheWay.length !== 0;
+
+ if (gridster.swapping === true && hasItemsInTheWay) {
+ var boundingBoxItem = gridster.getBoundingBox(itemsInTheWay),
+ sameSize = boundingBoxItem.sizeX === item.sizeX && boundingBoxItem.sizeY === item.sizeY,
+ sameRow = boundingBoxItem.row === oldRow,
+ sameCol = boundingBoxItem.col === oldCol,
+ samePosition = boundingBoxItem.row === row && boundingBoxItem.col === col,
+ inline = sameRow || sameCol;
+
+ if (sameSize && itemsInTheWay.length === 1) {
+ if (samePosition) {
+ gridster.swapItems(item, itemsInTheWay[0]);
+ } else if (inline) {
+ return;
+ }
+ } else if (boundingBoxItem.sizeX <= item.sizeX && boundingBoxItem.sizeY <= item.sizeY && inline) {
+ var emptyRow = item.row <= row ? item.row : row + item.sizeY,
+ emptyCol = item.col <= col ? item.col : col + item.sizeX,
+ rowOffset = emptyRow - boundingBoxItem.row,
+ colOffset = emptyCol - boundingBoxItem.col;
+
+ for (var i = 0, l = itemsInTheWay.length; i < l; ++i) {
+ var itemInTheWay = itemsInTheWay[i];
+
+ var itemsInFreeSpace = gridster.getItems(
+ itemInTheWay.row + rowOffset,
+ itemInTheWay.col + colOffset,
+ itemInTheWay.sizeX,
+ itemInTheWay.sizeY,
+ item
+ );
+
+ if (itemsInFreeSpace.length === 0) {
+ gridster.putItem(itemInTheWay, itemInTheWay.row + rowOffset, itemInTheWay.col + colOffset);
+ }
+ }
+ }
+ }
+
+ if (gridster.pushing !== false || !hasItemsInTheWay) {
+ item.row = row;
+ item.col = col;
+ }
+
+ if(($window.navigator.appName === 'Microsoft Internet Explorer' && !ie8) || $window.navigator.userAgent.indexOf("Firefox")!==-1){
+ if (event.pageY - realdocument.documentElement.scrollTop < scrollSensitivity) {
+ realdocument.documentElement.scrollTop = realdocument.documentElement.scrollTop - scrollSpeed;
+ } else if ($window.innerHeight - (event.pageY - realdocument.documentElement.scrollTop) < scrollSensitivity) {
+ realdocument.documentElement.scrollTop = realdocument.documentElement.scrollTop + scrollSpeed;
+ }
+ }
+ else{
+ if (event.pageY - realdocument.body.scrollTop < scrollSensitivity) {
+ realdocument.body.scrollTop = realdocument.body.scrollTop - scrollSpeed;
+ } else if ($window.innerHeight - (event.pageY - realdocument.body.scrollTop) < scrollSensitivity) {
+ realdocument.body.scrollTop = realdocument.body.scrollTop + scrollSpeed;
+ }
+ }
+
+
+
+ if (event.pageX - realdocument.body.scrollLeft < scrollSensitivity) {
+ realdocument.body.scrollLeft = realdocument.body.scrollLeft - scrollSpeed;
+ } else if ($window.innerWidth - (event.pageX - realdocument.body.scrollLeft) < scrollSensitivity) {
+ realdocument.body.scrollLeft = realdocument.body.scrollLeft + scrollSpeed;
+ }
+
+ if (hasCallback || oldRow !== item.row || oldCol !== item.col) {
+ scope.$apply(function() {
+ if (hasCallback) {
+ gridster.draggable.drag(event, $el, itemOptions);
+ }
+ });
+ }
+ }
+
+ function dragStop(event) {
+ $el.removeClass('gridster-item-moving');
+ var row = gridster.pixelsToRows(elmY);
+ var col = gridster.pixelsToColumns(elmX);
+ if (gridster.pushing !== false || gridster.getItems(row, col, item.sizeX, item.sizeY, item).length === 0) {
+ item.row = row;
+ item.col = col;
+ }
+ gridster.movingItem = null;
+ item.setPosition(item.row, item.col);
+
+ scope.$apply(function() {
+ if (gridster.draggable && gridster.draggable.stop) {
+ gridster.draggable.stop(event, $el, itemOptions);
+ }
+ });
+ }
+
+ var enabled = null;
+ var $dragHandles = null;
+ var unifiedInputs = [];
+
+ this.enable = function() {
+ if (enabled === true) {
+ return;
+ }
+
+ // disable and timeout required for some template rendering
+ $timeout(function() {
+ // disable any existing draghandles
+ for (var u = 0, ul = unifiedInputs.length; u < ul; ++u) {
+ unifiedInputs[u].disable();
+ }
+ unifiedInputs = [];
+
+ if (gridster.draggable && gridster.draggable.handle) {
+ $dragHandles = angular.element($el[0].querySelectorAll(gridster.draggable.handle));
+ if ($dragHandles.length === 0) {
+ // fall back to element if handle not found...
+ $dragHandles = $el;
+ }
+ } else {
+ $dragHandles = $el;
+ }
+
+ for (var h = 0, hl = $dragHandles.length; h < hl; ++h) {
+ unifiedInputs[h] = new GridsterTouch($dragHandles[h], mouseDown, mouseMove, mouseUp);
+ unifiedInputs[h].enable();
+ }
+
+ enabled = true;
+ });
+ };
+
+ this.disable = function() {
+ if (enabled === false) {
+ return;
+ }
+
+ // timeout to avoid race contition with the enable timeout
+ $timeout(function() {
+
+ for (var u = 0, ul = unifiedInputs.length; u < ul; ++u) {
+ unifiedInputs[u].disable();
+ }
+
+ unifiedInputs = [];
+ enabled = false;
+ });
+ };
+
+ this.toggle = function(enabled) {
+ if (enabled) {
+ this.enable();
+ } else {
+ this.disable();
+ }
+ };
+
+ this.destroy = function() {
+ this.disable();
+ };
+ }
+
+ return GridsterDraggable;
+ }
+ ])
+
+ .factory('GridsterResizable', ['GridsterTouch', function(GridsterTouch) {
+ function GridsterResizable($el, scope, gridster, item, itemOptions) {
+
+ function ResizeHandle(handleClass) {
+
+ var hClass = handleClass;
+
+ var elmX, elmY, elmW, elmH,
+
+ mouseX = 0,
+ mouseY = 0,
+ lastMouseX = 0,
+ lastMouseY = 0,
+ mOffX = 0,
+ mOffY = 0,
+
+ minTop = 0,
+ maxTop = 9999,
+ minLeft = 0;
+
+ var getMinHeight = function() {
+ return (item.minSizeY ? item.minSizeY : 1) * gridster.curRowHeight - gridster.margins[0];
+ };
+ var getMinWidth = function() {
+ return (item.minSizeX ? item.minSizeX : 1) * gridster.curColWidth - gridster.margins[1];
+ };
+
+ var originalWidth, originalHeight;
+ var savedDraggable;
+
+ function mouseDown(e) {
+ switch (e.which) {
+ case 1:
+ // left mouse button
+ break;
+ case 2:
+ case 3:
+ // right or middle mouse button
+ return;
+ }
+
+ // save the draggable setting to restore after resize
+ savedDraggable = gridster.draggable.enabled;
+ if (savedDraggable) {
+ gridster.draggable.enabled = false;
+ scope.$broadcast('gridster-draggable-changed', gridster);
+ }
+
+ // Get the current mouse position.
+ lastMouseX = e.pageX;
+ lastMouseY = e.pageY;
+
+ // Record current widget dimensions
+ elmX = parseInt($el.css('left'), 10);
+ elmY = parseInt($el.css('top'), 10);
+ elmW = $el[0].offsetWidth;
+ elmH = $el[0].offsetHeight;
+
+ originalWidth = item.sizeX;
+ originalHeight = item.sizeY;
+
+ resizeStart(e);
+
+ return true;
+ }
+
+ function resizeStart(e) {
+ $el.addClass('gridster-item-moving');
+ $el.addClass('gridster-item-resizing');
+
+ gridster.movingItem = item;
+
+ item.setElementSizeX();
+ item.setElementSizeY();
+ item.setElementPosition();
+ gridster.updateHeight(1);
+
+ scope.$apply(function() {
+ // callback
+ if (gridster.resizable && gridster.resizable.start) {
+ gridster.resizable.start(e, $el, itemOptions); // options is the item model
+ }
+ });
+ }
+
+ function mouseMove(e) {
+ var maxLeft = gridster.curWidth - 1;
+
+ // Get the current mouse position.
+ mouseX = e.pageX;
+ mouseY = e.pageY;
+
+ // Get the deltas
+ var diffX = mouseX - lastMouseX + mOffX;
+ var diffY = mouseY - lastMouseY + mOffY;
+ mOffX = mOffY = 0;
+
+ // Update last processed mouse positions.
+ lastMouseX = mouseX;
+ lastMouseY = mouseY;
+
+ var dY = diffY,
+ dX = diffX;
+
+ if (hClass.indexOf('n') >= 0) {
+ if (elmH - dY < getMinHeight()) {
+ diffY = elmH - getMinHeight();
+ mOffY = dY - diffY;
+ } else if (elmY + dY < minTop) {
+ diffY = minTop - elmY;
+ mOffY = dY - diffY;
+ }
+ elmY += diffY;
+ elmH -= diffY;
+ }
+ if (hClass.indexOf('s') >= 0) {
+ if (elmH + dY < getMinHeight()) {
+ diffY = getMinHeight() - elmH;
+ mOffY = dY - diffY;
+ } else if (elmY + elmH + dY > maxTop) {
+ diffY = maxTop - elmY - elmH;
+ mOffY = dY - diffY;
+ }
+ elmH += diffY;
+ }
+ if (hClass.indexOf('w') >= 0) {
+ if (elmW - dX < getMinWidth()) {
+ diffX = elmW - getMinWidth();
+ mOffX = dX - diffX;
+ } else if (elmX + dX < minLeft) {
+ diffX = minLeft - elmX;
+ mOffX = dX - diffX;
+ }
+ elmX += diffX;
+ elmW -= diffX;
+ }
+ if (hClass.indexOf('e') >= 0) {
+ if (elmW + dX < getMinWidth()) {
+ diffX = getMinWidth() - elmW;
+ mOffX = dX - diffX;
+ } else if (elmX + elmW + dX > maxLeft) {
+ diffX = maxLeft - elmX - elmW;
+ mOffX = dX - diffX;
+ }
+ elmW += diffX;
+ }
+
+ // set new position
+ $el.css({
+ 'top': elmY + 'px',
+ 'left': elmX + 'px',
+ 'width': elmW + 'px',
+ 'height': elmH + 'px'
+ });
+
+ resize(e);
+
+ return true;
+ }
+
+ function mouseUp(e) {
+ // restore draggable setting to its original state
+ if (gridster.draggable.enabled !== savedDraggable) {
+ gridster.draggable.enabled = savedDraggable;
+ scope.$broadcast('gridster-draggable-changed', gridster);
+ }
+
+ mOffX = mOffY = 0;
+
+ resizeStop(e);
+
+ return true;
+ }
+
+ function resize(e) {
+ var oldRow = item.row,
+ oldCol = item.col,
+ oldSizeX = item.sizeX,
+ oldSizeY = item.sizeY,
+ hasCallback = gridster.resizable && gridster.resizable.resize;
+
+ var col = item.col;
+ // only change column if grabbing left edge
+ if (['w', 'nw', 'sw'].indexOf(handleClass) !== -1) {
+ col = gridster.pixelsToColumns(elmX, false);
+ }
+
+ var row = item.row;
+ // only change row if grabbing top edge
+ if (['n', 'ne', 'nw'].indexOf(handleClass) !== -1) {
+ row = gridster.pixelsToRows(elmY, false);
+ }
+
+ var sizeX = item.sizeX;
+ // only change row if grabbing left or right edge
+ if (['n', 's'].indexOf(handleClass) === -1) {
+ sizeX = gridster.pixelsToColumns(elmW, true);
+ }
+
+ var sizeY = item.sizeY;
+ // only change row if grabbing top or bottom edge
+ if (['e', 'w'].indexOf(handleClass) === -1) {
+ sizeY = gridster.pixelsToRows(elmH, true);
+ }
+
+ if (gridster.pushing !== false || gridster.getItems(row, col, sizeX, sizeY, item).length === 0) {
+ item.row = row;
+ item.col = col;
+ item.sizeX = sizeX;
+ item.sizeY = sizeY;
+ }
+ var isChanged = item.row !== oldRow || item.col !== oldCol || item.sizeX !== oldSizeX || item.sizeY !== oldSizeY;
+
+ if (hasCallback || isChanged) {
+ scope.$apply(function() {
+ if (hasCallback) {
+ gridster.resizable.resize(e, $el, itemOptions); // options is the item model
+ }
+ });
+ }
+ }
+
+ function resizeStop(e) {
+ $el.removeClass('gridster-item-moving');
+ $el.removeClass('gridster-item-resizing');
+
+ gridster.movingItem = null;
+
+ item.setPosition(item.row, item.col);
+ item.setSizeY(item.sizeY);
+ item.setSizeX(item.sizeX);
+
+ scope.$apply(function() {
+ if (gridster.resizable && gridster.resizable.stop) {
+ gridster.resizable.stop(e, $el, itemOptions); // options is the item model
+ }
+ });
+ }
+
+ var $dragHandle = null;
+ var unifiedInput;
+
+ this.enable = function() {
+ if (!$dragHandle) {
+ $dragHandle = angular.element('<div class="gridster-item-resizable-handler handle-' + hClass + '"></div>');
+ $el.append($dragHandle);
+ }
+
+ unifiedInput = new GridsterTouch($dragHandle[0], mouseDown, mouseMove, mouseUp);
+ unifiedInput.enable();
+ };
+
+ this.disable = function() {
+ if ($dragHandle) {
+ $dragHandle.remove();
+ $dragHandle = null;
+ }
+
+ unifiedInput.disable();
+ unifiedInput = undefined;
+ };
+
+ this.destroy = function() {
+ this.disable();
+ };
+ }
+
+ var handles = [];
+ var handlesOpts = gridster.resizable.handles;
+ if (typeof handlesOpts === 'string') {
+ handlesOpts = gridster.resizable.handles.split(',');
+ }
+ var enabled = false;
+
+ for (var c = 0, l = handlesOpts.length; c < l; c++) {
+ handles.push(new ResizeHandle(handlesOpts[c]));
+ }
+
+ this.enable = function() {
+ if (enabled) {
+ return;
+ }
+ for (var c = 0, l = handles.length; c < l; c++) {
+ handles[c].enable();
+ }
+ enabled = true;
+ };
+
+ this.disable = function() {
+ if (!enabled) {
+ return;
+ }
+ for (var c = 0, l = handles.length; c < l; c++) {
+ handles[c].disable();
+ }
+ enabled = false;
+ };
+
+ this.toggle = function(enabled) {
+ if (enabled) {
+ this.enable();
+ } else {
+ this.disable();
+ }
+ };
+
+ this.destroy = function() {
+ for (var c = 0, l = handles.length; c < l; c++) {
+ handles[c].destroy();
+ }
+ };
+ }
+ return GridsterResizable;
+ }])
+
+ .factory('gridsterDebounce', function() {
+ return function gridsterDebounce(func, wait, immediate) {
+ var timeout;
+ return function() {
+ var context = this,
+ args = arguments;
+ var later = function() {
+ timeout = null;
+ if (!immediate) {
+ func.apply(context, args);
+ }
+ };
+ var callNow = immediate && !timeout;
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ if (callNow) {
+ func.apply(context, args);
+ }
+ };
+ };
+ })
+
+ /**
+ * GridsterItem directive
+ * @param $parse
+ * @param GridsterDraggable
+ * @param GridsterResizable
+ * @param gridsterDebounce
+ */
+ .directive('gridsterItem', ['$parse', 'GridsterDraggable', 'GridsterResizable', 'gridsterDebounce',
+ function($parse, GridsterDraggable, GridsterResizable, gridsterDebounce) {
+ return {
+ scope: true,
+ restrict: 'EA',
+ controller: 'GridsterItemCtrl',
+ controllerAs: 'gridsterItem',
+ require: ['^gridster', 'gridsterItem'],
+ link: function(scope, $el, attrs, controllers) {
+ var optionsKey = attrs.gridsterItem,
+ options;
+
+ var gridster = controllers[0],
+ item = controllers[1];
+
+ scope.gridster = gridster;
+
+
+ // bind the item's position properties
+ // options can be an object specified by gridster-item="object"
+ // or the options can be the element html attributes object
+ if (optionsKey) {
+ var $optionsGetter = $parse(optionsKey);
+ options = $optionsGetter(scope) || {};
+ if (!options && $optionsGetter.assign) {
+ options = {
+ row: item.row,
+ col: item.col,
+ sizeX: item.sizeX,
+ sizeY: item.sizeY,
+ minSizeX: 0,
+ minSizeY: 0,
+ maxSizeX: null,
+ maxSizeY: null
+ };
+ $optionsGetter.assign(scope, options);
+ }
+ } else {
+ options = attrs;
+ }
+
+ item.init($el, gridster);
+
+ $el.addClass('gridster-item');
+
+ var aspects = ['minSizeX', 'maxSizeX', 'minSizeY', 'maxSizeY', 'sizeX', 'sizeY', 'row', 'col'],
+ $getters = {};
+
+ var expressions = [];
+ var aspectFn = function(aspect) {
+ var expression;
+ if (typeof options[aspect] === 'string') {
+ // watch the expression in the scope
+ expression = options[aspect];
+ } else if (typeof options[aspect.toLowerCase()] === 'string') {
+ // watch the expression in the scope
+ expression = options[aspect.toLowerCase()];
+ } else if (optionsKey) {
+ // watch the expression on the options object in the scope
+ expression = optionsKey + '.' + aspect;
+ } else {
+ return;
+ }
+ expressions.push('"' + aspect + '":' + expression);
+ $getters[aspect] = $parse(expression);
+
+ // initial set
+ var val = $getters[aspect](scope);
+ if (typeof val === 'number') {
+ item[aspect] = val;
+ }
+ };
+
+ for (var i = 0, l = aspects.length; i < l; ++i) {
+ aspectFn(aspects[i]);
+ }
+
+ var watchExpressions = '{' + expressions.join(',') + '}';
+
+ // when the value changes externally, update the internal item object
+ scope.$watchCollection(watchExpressions, function(newVals, oldVals) {
+ for (var aspect in newVals) {
+ var newVal = newVals[aspect];
+ var oldVal = oldVals[aspect];
+ if (oldVal === newVal) {
+ continue;
+ }
+ newVal = parseInt(newVal, 10);
+ if (!isNaN(newVal)) {
+ item[aspect] = newVal;
+ }
+ }
+ });
+
+ function positionChanged() {
+ // call setPosition so the element and gridster controller are updated
+ item.setPosition(item.row, item.col);
+
+ // when internal item position changes, update externally bound values
+ if ($getters.row && $getters.row.assign) {
+ $getters.row.assign(scope, item.row);
+ }
+ if ($getters.col && $getters.col.assign) {
+ $getters.col.assign(scope, item.col);
+ }
+ }
+ scope.$watch(function() {
+ return item.row + ',' + item.col;
+ }, positionChanged);
+
+ function sizeChanged() {
+ var changedX = item.setSizeX(item.sizeX, true);
+ if (changedX && $getters.sizeX && $getters.sizeX.assign) {
+ $getters.sizeX.assign(scope, item.sizeX);
+ }
+ var changedY = item.setSizeY(item.sizeY, true);
+ if (changedY && $getters.sizeY && $getters.sizeY.assign) {
+ $getters.sizeY.assign(scope, item.sizeY);
+ }
+
+ if (changedX || changedY) {
+ item.gridster.moveOverlappingItems(item);
+ gridster.layoutChanged();
+ scope.$broadcast('gridster-item-resized', item);
+ }
+ }
+
+ scope.$watch(function() {
+ return item.sizeY + ',' + item.sizeX + ',' + item.minSizeX + ',' + item.maxSizeX + ',' + item.minSizeY + ',' + item.maxSizeY;
+ }, sizeChanged);
+
+ var draggable = new GridsterDraggable($el, scope, gridster, item, options);
+ var resizable = new GridsterResizable($el, scope, gridster, item, options);
+
+ var updateResizable = function() {
+ resizable.toggle(!gridster.isMobile && gridster.resizable && gridster.resizable.enabled);
+ };
+ updateResizable();
+
+ var updateDraggable = function() {
+ draggable.toggle(!gridster.isMobile && gridster.draggable && gridster.draggable.enabled);
+ };
+ updateDraggable();
+
+ scope.$on('gridster-draggable-changed', updateDraggable);
+ scope.$on('gridster-resizable-changed', updateResizable);
+ scope.$on('gridster-resized', updateResizable);
+ scope.$on('gridster-mobile-changed', function() {
+ updateResizable();
+ updateDraggable();
+ });
+
+ function whichTransitionEvent() {
+ var el = document.createElement('div');
+ var transitions = {
+ 'transition': 'transitionend',
+ 'OTransition': 'oTransitionEnd',
+ 'MozTransition': 'transitionend',
+ 'WebkitTransition': 'webkitTransitionEnd'
+ };
+ for (var t in transitions) {
+ if (el.style[t] !== undefined) {
+ return transitions[t];
+ }
+ }
+ }
+
+ var debouncedTransitionEndPublisher = gridsterDebounce(function() {
+ scope.$apply(function() {
+ scope.$broadcast('gridster-item-transition-end', item);
+ });
+ }, 50);
+
+ if(whichTransitionEvent()){ //check for IE8, as it evaluates to null
+ $el.on(whichTransitionEvent(), debouncedTransitionEndPublisher);
+ }
+
+ scope.$broadcast('gridster-item-initialized', item);
+
+ return scope.$on('$destroy', function() {
+ try {
+ resizable.destroy();
+ draggable.destroy();
+ } catch (e) {}
+
+ try {
+ gridster.removeItem(item);
+ } catch (e) {}
+
+ try {
+ item.destroy();
+ } catch (e) {}
+ });
+ }
+ };
+ }
+ ])
+
+ .directive('gridsterNoDrag', function() {
+ return {
+ restrict: 'A',
+ link: function(scope, $element) {
+ $element.addClass('gridster-no-drag');
+ }
+ };
+ })
+
+ ;
+
+}));
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/ui-gridster-tpls.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/ui-gridster-tpls.js
new file mode 100644
index 00000000..3ca3db7d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/ui-gridster-tpls.js
@@ -0,0 +1,168 @@
+/**
+* FileName ui-gridster
+* Version 0.0.1
+* Build number ad58c6f4f8f8fd7f04ac457f95d76f09
+* Date 08/17/2015
+*/
+
+
+(function(angular, window){
+angular.module("att.gridster", ["att.gridster.tpls", "att.gridster.utilities","att.gridster.gridster"]);
+angular.module("att.gridster.tpls", ["template/gridster/gridster.html","template/gridster/gridsterItem.html","template/gridster/gridsterItemBody.html","template/gridster/gridsterItemFooter.html","template/gridster/gridsterItemHeader.html"]);
+angular.module('att.gridster.utilities', [])
+ .factory('$extendObj', [function() {
+ var _extendDeep = function(dst) {
+ angular.forEach(arguments, function(obj) {
+ if (obj !== dst) {
+ angular.forEach(obj, function(value, key) {
+ if (dst[key] && dst[key].constructor && dst[key].constructor === Object) {
+ _extendDeep(dst[key], value);
+ } else {
+ dst[key] = value;
+ }
+ });
+ }
+ });
+ return dst;
+ };
+ return {
+ extendDeep: _extendDeep
+ };
+ }]);
+
+angular.module('att.gridster.gridster', ['attGridsterLib', 'att.gridster.utilities'])
+ .config(['$compileProvider', function($compileProvider) {
+ $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|javascript):/);
+ }])
+ .constant('attGridsterConfig',
+ {
+ columns: 3,
+ margins: [10, 10],
+ outerMargin: true,
+ pushing: true,
+ floating: true,
+ swapping: true,
+ draggable: {
+ enabled: true
+ }
+ })
+ .directive('attGridster', ['attGridsterConfig', '$extendObj', function(attGridsterConfig, $extendObj) {
+ return {
+ restrict: 'EA',
+ scope: {
+ attGridsterOptions: '=?'
+ },
+ templateUrl: 'template/gridster/gridster.html',
+ replace: false,
+ transclude: true,
+ controller: [function() {}],
+ link: function(scope) {
+ if (angular.isDefined(scope.attGridsterOptions)) {
+ attGridsterConfig = $extendObj.extendDeep(attGridsterConfig, scope.attGridsterOptions);
+ }
+ scope.attGridsterConfig = attGridsterConfig;
+ }
+ };
+ }])
+ .directive('attGridsterItem', ['$timeout', function($timeout) {
+ return {
+ restrict: 'EA',
+ require: ['^attGridster'],
+ scope: {
+ attGridsterItem: '='
+ },
+ templateUrl: 'template/gridster/gridsterItem.html',
+ replace: false,
+ transclude: true,
+ controller: [function() {}]
+ };
+ }])
+ .directive('attGridsterItemHeader', [function() {
+ return {
+ restrict: 'EA',
+ require: ['^attGridsterItem'],
+ scope: {
+ headerText: '@',
+ subHeaderText: '@?'
+ },
+ templateUrl: 'template/gridster/gridsterItemHeader.html',
+ replace: true,
+ transclude: true,
+ link: function(scope, element) {
+ if (angular.isDefined(scope.subHeaderText) && scope.subHeaderText) {
+ angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("tabindex", "0");
+ angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("aria-label", scope.subHeaderText);
+ }
+ }
+ };
+ }])
+ .directive('attGridsterItemBody', [function() {
+ return {
+ restrict: 'EA',
+ require: ['^attGridsterItem'],
+ scope: {},
+ templateUrl: 'template/gridster/gridsterItemBody.html',
+ replace: true,
+ transclude: true
+ };
+ }])
+ .directive('attGridsterItemFooter', ['$location', function($location) {
+ return {
+ restrict: 'EA',
+ require: ['^attGridsterItem'],
+ scope: {
+ attGridsterItemFooterLink: '@?'
+ },
+ templateUrl: 'template/gridster/gridsterItemFooter.html',
+ replace: true,
+ transclude: true,
+ controller: ['$scope', function($scope) {
+ $scope.clickOnFooterLink = function(evt) {
+ evt.preventDefault();
+ evt.stopPropagation();
+ if ($scope.attGridsterItemFooterLink) {
+ $location.url($scope.attGridsterItemFooterLink);
+ }
+ };
+ }],
+ link: function(scope, element) {
+ if (angular.isDefined(scope.attGridsterItemFooterLink) && scope.attGridsterItemFooterLink) {
+ element.attr("role", "link");
+ }
+ }
+ };
+ }]);
+angular.module("template/gridster/gridster.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/gridster/gridster.html",
+ "<div gridster='attGridsterConfig'><div ng-transclude></div></div>");
+}]);
+
+angular.module("template/gridster/gridsterItem.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/gridster/gridsterItem.html",
+ "<div gridster-item='attGridsterItem' class=\"gridster-item-container\" ng-transclude></div>");
+}]);
+
+angular.module("template/gridster/gridsterItemBody.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/gridster/gridsterItemBody.html",
+ "<div class=\"gridster-item-body\" ng-transclude></div>");
+}]);
+
+angular.module("template/gridster/gridsterItemFooter.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/gridster/gridsterItemFooter.html",
+ "<div class=\"gridster-item-footer\" ng-click=\"clickOnFooterLink($event)\" tabindex=\"0\" ng-keydown=\"(($event.keyCode && $event.keyCode === 13) || ($event.which && $event.which === 13)) && clickOnFooterLink($event)\" >\n" +
+ " <span class=\"gridster-item-footer-content\" ng-transclude></span>\n" +
+ "</div>");
+}]);
+
+angular.module("template/gridster/gridsterItemHeader.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("template/gridster/gridsterItemHeader.html",
+ "<div class=\"gridster-item-header\">\n" +
+ " <img gridster-item-drag src=\"static/fusion/images/att_angular_gridster/grips.png\" alt=\"||\" aria-label=\"Tap/Click to move\" class=\"gridster-item-handle\" />\n" +
+ " <span class=\"gridster-item-header-content\" tabindex=\"0\" role=\"presentation\" aria-label=\"{{headerText}}\">{{headerText}}</span>\n" +
+ " <span class=\"gridster-item-sub-header-content\" role=\"presentation\">{{subHeaderText}}</span>\n" +
+ " <div class=\"gridster-item-header-buttons-container\" ng-transclude></div>\n" +
+ "</div>");
+}]);
+
+return {}
+})(angular, window); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/jquery.resize.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/jquery.resize.js
new file mode 100644
index 00000000..1ebd6c95
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/jquery.resize.js
@@ -0,0 +1,139 @@
+/*!
+ * jquery.resize.js 0.0.1 - https://github.com/yckart/jquery.resize.js
+ * Resize-event for DOM-Nodes
+ *
+ * @see http://workingdraft.de/113/
+ * @see http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/
+ *
+ * Copyright (c) 2013 Yannick Albert (http://yckart.com)
+ * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php).
+ * 2013/04/01
+ */
+
+(function(factory) {
+ if(typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], factory);
+ } else if(typeof exports === 'object') {
+ // Node/CommonJS style for Browserify
+ module.exports = factory;
+ } else {
+ // Browser globals
+ factory(jQuery);
+ }
+}(function($) {
+
+ function addFlowListener(element, type, fn) {
+ var flow = type == 'over';
+ element.addEventListener('OverflowEvent' in window ? 'overflowchanged' : type + 'flow', function(e) {
+ if(e.type == (type + 'flow') || ((e.orient == 0 && e.horizontalOverflow == flow) || (e.orient == 1 && e.verticalOverflow == flow) || (e.orient == 2 && e.horizontalOverflow == flow && e.verticalOverflow == flow))) {
+ e.flow = type;
+ return fn.call(this, e);
+ }
+ }, false);
+ };
+
+ function fireEvent(element, type, data, options) {
+ var options = options || {},
+ event = document.createEvent('Event');
+ event.initEvent(type, 'bubbles' in options ? options.bubbles : true, 'cancelable' in options ? options.cancelable : true);
+ for(var z in data) event[z] = data[z];
+ element.dispatchEvent(event);
+ };
+
+ $.event.special.resize = {
+ setup: function() {
+ var element = this;
+ var resize = 'onresize' in element;
+ if(!resize && !element._resizeSensor) {
+ var sensor = element._resizeSensor = document.createElement('div');
+ sensor.className = 'resize-sensor';
+ sensor.innerHTML = '<div class="resize-overflow"><div></div></div><div class="resize-underflow"><div></div></div>';
+
+ var x = 0,
+ y = 0,
+ first = sensor.firstElementChild.firstChild,
+ last = sensor.lastElementChild.firstChild,
+ matchFlow = function(event) {
+ var change = false,
+ width = element.offsetWidth;
+ if(x != width) {
+ first.style.width = width - 1 + 'px';
+ last.style.width = width + 1 + 'px';
+ change = true;
+ x = width;
+ }
+ var height = element.offsetHeight;
+ if(y != height) {
+ first.style.height = height - 1 + 'px';
+ last.style.height = height + 1 + 'px';
+ change = true;
+ y = height;
+ }
+ if(change && event.currentTarget != element) fireEvent(element, 'resize');
+ };
+
+ if(getComputedStyle(element).position == 'static') {
+ element.style.position = 'relative';
+ element._resizeSensor._resetPosition = true;
+ }
+ addFlowListener(sensor, 'over', matchFlow);
+ addFlowListener(sensor, 'under', matchFlow);
+ addFlowListener(sensor.firstElementChild, 'over', matchFlow);
+ addFlowListener(sensor.lastElementChild, 'under', matchFlow);
+ element.appendChild(sensor);
+ matchFlow({});
+ }
+ var events = element._flowEvents || (element._flowEvents = []);
+ if(events.indexOf(handler) == -1) events.push(handler);
+ if(!resize) element.addEventListener('resize', handler, false);
+ element.onresize = function(e) {
+ events.forEach(function(fn) {
+ fn.call(element, e);
+ });
+ };
+ },
+
+ teardown: function() {
+ var element = this;
+ var index = element._flowEvents.indexOf(handler);
+ if(index > -1) element._flowEvents.splice(index, 1);
+ if(!element._flowEvents.length) {
+ var sensor = element._resizeSensor;
+ if(sensor) {
+ element.removeChild(sensor);
+ if(sensor._resetPosition) element.style.position = 'static';
+ delete element._resizeSensor;
+ }
+ if('onresize' in element) element.onresize = null;
+ delete element._flowEvents;
+ }
+ element.removeEventListener('resize', handler);
+ }
+ };
+
+ $.fn.extend({
+ resize: function(fn) {
+ return fn ? this.bind("resize", fn) : this.trigger("resize");
+ },
+
+ unresize: function(fn) {
+ return this.unbind("resize", fn);
+ }
+ });
+
+
+ function handler(event) {
+ var orgEvent = event || window.event,
+ args = [].slice.call(arguments, 1);
+
+ event = $.event.fix(orgEvent);
+ event.type = "resize";
+
+ // Add event to the front of the arguments
+ args.unshift(event);
+
+ return($.event.dispatch || $.event.handle).apply(this, args);
+ }
+
+})); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/debug.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/debug.js
new file mode 100644
index 00000000..eff36a25
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/debug.js
@@ -0,0 +1,329 @@
+/**
+ * debugData
+ *
+ * Pass me a data structure {} and I'll output all the key/value pairs - recursively
+ *
+ * @example var HTML = debugData( oElem.style, "Element.style", { keys: "top,left,width,height", recurse: true, sort: true, display: true, returnHTML: true });
+ *
+ * @param Object o_Data A JSON-style data structure
+ * @param String s_Title Title for dialog (optional)
+ * @param Hash options Pass additional options in a hash
+ */
+function debugData (o_Data, s_Title, options) {
+ options = options || {};
+ var
+ str=(s_Title||s_Title==='' ? s_Title : 'DATA')
+ , dType=$.type(o_Data)
+ // maintain backward compatibility with OLD 'recurseData' param
+ , recurse=($.type(options)==='boolean' ? options : options.recurse !==false)
+ , keys=(options.keys?','+options.keys+',':false)
+ , display=options.display !==false
+ , html=options.returnHTML !==false
+ , sort=!!options.sort
+ , prefix=options.indent ? ' ' : ''
+ , D=[], i=0 // Array to hold data, i=counter
+ , hasSubKeys = false
+ , k, t, skip, x, type // loop vars
+ ;
+ if (dType!=='object' && dType!=='array') {
+ if (options.display) alert( (s_Title || 'debugData') +': '+ o_Data );
+ return o_Data;
+ }
+ if (dType==='object' && $.isPlainObject(o_Data))
+ dType='hash';
+
+ if (o_Data.jquery) {
+ str=s_Title+'jQuery Collection ('+ o_Data.length +')\n context="'+ o_Data.context +'"';
+ }
+ else if (o_Data.nodeName) {
+ str=s_Title+o_Data.tagName;
+ var id = o_Data.id, cls=o_Data.className, src=o_Data.src, hrf=o_Data.href;
+ if (id) str+='\n id="'+ id+'"';
+ if (cls) str+='\n class="'+ cls+'"';
+ if (src) str+='\n src="'+ src+'"';
+ if (hrf) str+='\n href="'+ hrf+'"';
+ }
+ else {
+ parse(o_Data,prefix,dType); // recursive parsing
+ if (sort && !hasSubKeys) D.sort(); // sort by keyName - but NOT if has subKeys!
+ if (str) str += '\n***'+ '****************************'.substr(0,str.length) +'\n';
+ str += D.join('\n'); // add line-breaks
+ }
+
+ if (display) alert(str); // display data
+ if (html) str=str.replace(/\n/g, ' <br>').replace(/ /g, ' &nbsp;'); // format as HTML
+ return str;
+
+ function parse ( data, prefix, parentType ) {
+ var first = true;
+ try {
+ $.each( data, function (key, val) {
+ skip = (keys && keys.indexOf(','+key+',') === -1);
+ type = $.type(val);
+ if (type==='object' && $.isPlainObject(val))
+ type = 'hash';
+ k = prefix + (first ? ' ' : ', ');
+ first = false;
+
+ if (parentType!=='array') // no key-names for array items
+ k += key+': '; // NOT an array
+
+ if (type==="date" || type==="regexp") {
+ val = val.toString();
+ type = "string";
+ }
+ if (type==="string") { // STRING
+ if (!skip) D[i++] = k +'"'+ val +'"';
+ }
+ // NULL, UNDEFINED, NUMBER or BOOLEAN
+ else if (/^(null|undefined|number|boolean)/.test(type)) {
+ if (!skip) D[i++] = k + val;
+ }
+ else if (type==="function") { // FUNCTION
+ if (!skip) D[i++] = k +'function()';
+ }
+ else if (type==="array") { // ARRAY
+ if (!skip) {
+ D[i++] = k +'[';
+ parse( val, prefix+' ',type); // RECURSE
+ D[i++] = prefix +' ]';
+ }
+ }
+ else if (val.jquery) { // JQUERY OBJECT
+ if (!skip) D[i++] = k +'jQuery ('+ val.length +') context="'+ val.context +'"';
+ }
+ else if (val.nodeName) { // DOM ELEMENT
+ var id = val.id, cls=val.className, src=val.src, hrf=val.href;
+ if (skip) D[i++] = k +' '+
+ id ? 'id="'+ id+'"' :
+ src ? 'src="'+ src+'"' :
+ hrf ? 'href="'+ hrf+'"' :
+ cls ? 'class="'+cls+'"' :
+ '';
+ }
+ else if (type==="hash") { // JSON
+ if (!recurse || $.isEmptyObject(val)) { // show an empty hash
+ if (!skip) D[i++] = k +'{ }';
+ }
+ else { // recurse into JSON hash - indent output
+ D[i++] = k +'{';
+ parse( val, prefix+' ',type); // RECURSE
+ D[i++] = prefix +' }';
+ }
+ }
+ else { // OBJECT
+ if (!skip) D[i++] = k +'OBJECT'; // NOT a hash
+ }
+ });
+ } catch (e) {}
+ }
+};
+
+function debugStackTrace (s_Title, options) {
+ var
+ callstack = []
+ , isCallstackPopulated = false
+ ;
+ try {
+ i.dont.exist += 0; // doesn't exist- that's the point
+ } catch(e) {
+ if (e.stack) { // Firefox
+ var lines = e.stack.split('\n');
+ for (var i=0, len=lines.length; i<len; i++) {
+ if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
+ callstack.push(lines[i]);
+ }
+ }
+ //Remove call to printStackTrace()
+ callstack.shift();
+ isCallstackPopulated = true;
+ }
+ else if (window.opera && e.message) { // Opera
+ var lines = e.message.split('\n');
+ for (var i=0, len=lines.length; i<len; i++) {
+ if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
+ var entry = lines[i];
+ //Append next line also since it has the file info
+ if (lines[i+1]) {
+ entry += ' at ' + lines[i+1];
+ i++;
+ }
+ callstack.push(entry);
+ }
+ }
+ //Remove call to printStackTrace()
+ callstack.shift();
+ isCallstackPopulated = true;
+ }
+ }
+
+ if (!isCallstackPopulated) { // IE and Safari
+ var currentFunction = arguments.callee.caller;
+ while (currentFunction) {
+ var fn = currentFunction.toString();
+ var fname = fn.substring(fn.indexOf('function') + 8, fn.indexOf('')) || 'anonymous';
+ callstack.push(fname);
+ currentFunction = currentFunction.caller;
+ }
+ }
+
+ debugData( callstack, s_Title, options );
+};
+
+if (!window.console) window.console = { log: debugData };
+
+if (!window.console.trace)
+ window.console.trace = function (s_Title) {
+ window.console.log( debugStackTrace(s_Title, { display: false, returnHTML: false, sort: false }) );
+ };
+
+// add method to output 'hash data' inside an string
+window.console.data = function (data, title) {
+ var w = { array: ['[',']'], object: ['{','}'], string: ['"','"'], number: ['',''], function: ['','()'] }
+ , x = $.type( data )
+ , obj = x.match(/(object|array)/)
+ , delim = !obj ? ['',''] : x === 'object' ? ['{\n','\n}'] : ['[\n','\n]']
+ , opts = { display: false, returnHTML: false, sort: false }
+ , debug = debugData( data, '', opts)
+ ;
+ console.log(
+ (title ? title +' = ' : '')
+ + delim[0]
+ + ($.type(debug) === 'string' ? debug.replace(/ /g, '\t') : debug)
+ + delim[1]
+ );
+};
+
+
+/**
+ * timer
+ *
+ * Utility for debug timing of events
+ * Can track multiple timers and returns either a total time or interval from last event
+ * @param String timerName Name of the timer - defaults to debugTimer
+ * @param String action Keyword for action or return-value...
+ * action: 'reset' = reset; 'clear' = delete; 'total' = ms since init; 'step' or '' = ms since last event
+ */
+/**
+ * timer
+ *
+ * Utility method for timing performance
+ * Can track multiple timers and returns either a total time or interval from last event
+ *
+ * returns time-data: {
+ * start: Date Object
+ * , last: Date Object
+ * , step: 99 // time since 'last'
+ * , total: 99 // time since 'start'
+ * }
+ *
+ * USAGE SAMPLES
+ * =============
+ * timer('name'); // create/init timer
+ * timer('name', 'reset'); // re-init timer
+ * timer('name', 'clear'); // clear/remove timer
+ * var i = timer('name'); // how long since last timer request?
+ * var i = timer('name', 'total'); // how long since timer started?
+ *
+ * @param String timerName Name of the timer - defaults to debugTimer
+ * @param String action Keyword for action or return-value...
+ * @param Hash options Options to customize return data
+ * action: 'reset' = reset; 'clear' = delete; 'total' = ms since init; 'step' or '' = ms since last event
+ */
+function timer (timerName, action, options) {
+ var
+ name = timerName || 'debugTimer'
+ , Timer = window[ name ]
+ , defaults = {
+ returnString: true
+ , padNumbers: true
+ , timePrefix: ''
+ , timeSuffix: ''
+ }
+ ;
+
+ // init the timer first time called
+ if (!Timer || action == 'reset') { // init timer
+ Timer = window[ name ] = {
+ start: new Date()
+ , last: new Date()
+ , step: 0 // time since 'last'
+ , total: 0 // time since 'start'
+ , options: $.extend({}, defaults, options)
+ };
+ }
+ else if (action == 'clear') { // remove timer
+ window[ name ] = null;
+ return null;
+ }
+ else { // update existing timer
+ Timer.step = (new Date()) - Timer.last; // time since 'last'
+ Timer.total = (new Date()) - Timer.start; // time since 'start'
+ Timer.last = new Date();
+ }
+
+ var
+ time = (action == 'total') ? Timer.total : Timer.step
+ , o = Timer.options // alias
+ ;
+
+ if (o.returnString) {
+ time += ""; // convert integer to string
+ // pad time to 4 chars with underscores
+ if (o.padNumbers)
+ switch (time.length) {
+ case 1: time = "&ensp;&ensp;&ensp;"+ time; break;
+ case 2: time = "&ensp;&ensp;"+ time; break;
+ case 3: time = "&ensp;"+ time; break;
+ }
+ // add prefix and suffix
+ if (o.timePrefix || o.timeSuffix)
+ time = o.timePrefix + time + o.timeSuffix;
+ }
+
+ return time;
+};
+
+
+/**
+ * showOptions
+ *
+ * Pass a layout-options object, and the pane/key you want to display
+ */
+function showOptions (Layout, key, debugOpts) {
+ var data = Layout.options;
+ $.each(key.split("."), function() {
+ data = data[this]; // recurse through multiple key-levels
+ });
+ debugData( data, 'options.'+key, debugOpts );
+};
+
+/**
+ * showState
+ *
+ * Pass a layout-options object, and the pane/key you want to display
+ */
+function showState (Layout, key, debugOpts) {
+ var data = Layout.state;
+ $.each(key.split("."), function() {
+ data = data[this]; // recurse through multiple key-levels
+ });
+ debugData( data, 'state.'+key, debugOpts );
+};
+
+
+
+
+function debugWindow ( content, options ) {
+ var defaults = {
+ css: {
+ position: 'fixed'
+ , top: 0
+ }
+ };
+ $.extend( true, (options || {}), defaults );
+ var $W = $('<div></div>')
+ .html( content.replace(/\n/g, '<br>').replace(/ /g, ' &nbsp;') ) // format as HTML
+ .css( options.css )
+ ;
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery-latest.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery-latest.js
new file mode 100644
index 00000000..1c998bab
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery-latest.js
@@ -0,0 +1,9555 @@
+/*!
+ * jQuery JavaScript Library v1.9.0
+ * http://jquery.com/
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ *
+ * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2013-1-14
+ */
+(function( window, undefined ) {
+"use strict";
+var
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // The deferred used on DOM ready
+ readyList,
+
+ // Use the correct document accordingly with window argument (sandbox)
+ document = window.document,
+ location = window.location,
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // [[Class]] -> type pairs
+ class2type = {},
+
+ // List of deleted data cache ids, so we can reuse them
+ core_deletedIds = [],
+
+ core_version = "1.9.0",
+
+ // Save a reference to some core methods
+ core_concat = core_deletedIds.concat,
+ core_push = core_deletedIds.push,
+ core_slice = core_deletedIds.slice,
+ core_indexOf = core_deletedIds.indexOf,
+ core_toString = class2type.toString,
+ core_hasOwn = class2type.hasOwnProperty,
+ core_trim = core_version.trim,
+
+ // Define a local copy of jQuery
+ jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context, rootjQuery );
+ },
+
+ // Used for matching numbers
+ core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
+
+ // Used for splitting on whitespace
+ core_rnotwhite = /\S+/g,
+
+ // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
+
+ // A simple way to check for HTML strings
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
+ // Strict HTML recognition (#11290: must start with <)
+ rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
+
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
+
+ // Matches dashed string for camelizing
+ rmsPrefix = /^-ms-/,
+ rdashAlpha = /-([\da-z])/gi,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return letter.toUpperCase();
+ },
+
+ // The ready event handler and self cleanup method
+ DOMContentLoaded = function() {
+ if ( document.addEventListener ) {
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+ jQuery.ready();
+ } else if ( document.readyState === "complete" ) {
+ // we're here because readyState === "complete" in oldIE
+ // which is good enough for us to call the dom ready!
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
+ jQuery.ready();
+ }
+ };
+
+jQuery.fn = jQuery.prototype = {
+ // The current version of jQuery being used
+ jquery: core_version,
+
+ constructor: jQuery,
+ init: function( selector, context, rootjQuery ) {
+ var match, elem;
+
+ // HANDLE: $(""), $(null), $(undefined), $(false)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+ // Assume that strings that start and end with <> are HTML and skip the regex check
+ match = [ null, selector, null ];
+
+ } else {
+ match = rquickExpr.exec( selector );
+ }
+
+ // Match html or make sure no context is specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ context = context instanceof jQuery ? context[0] : context;
+
+ // scripts is true for back-compat
+ jQuery.merge( this, jQuery.parseHTML(
+ match[1],
+ context && context.nodeType ? context.ownerDocument || context : document,
+ true
+ ) );
+
+ // HANDLE: $(html, props)
+ if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
+ for ( match in context ) {
+ // Properties of context are called as methods if possible
+ if ( jQuery.isFunction( this[ match ] ) ) {
+ this[ match ]( context[ match ] );
+
+ // ...and otherwise set as attributes
+ } else {
+ this.attr( match, context[ match ] );
+ }
+ }
+ }
+
+ return this;
+
+ // HANDLE: $(#id)
+ } else {
+ elem = document.getElementById( match[2] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return ( context || rootjQuery ).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return this.constructor( context ).find( selector );
+ }
+
+ // HANDLE: $(DOMElement)
+ } else if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
+
+ if ( selector.selector !== undefined ) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.makeArray( selector, this );
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ toArray: function() {
+ return core_slice.call( this );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == null ?
+
+ // Return a 'clean' array
+ this.toArray() :
+
+ // Return just the object
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems ) {
+
+ // Build a new jQuery matched element set
+ var ret = jQuery.merge( this.constructor(), elems );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+ ret.context = this.context;
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ ready: function( fn ) {
+ // Add the callback
+ jQuery.ready.promise().done( fn );
+
+ return this;
+ },
+
+ slice: function() {
+ return this.pushStack( core_slice.apply( this, arguments ) );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ eq: function( i ) {
+ var len = this.length,
+ j = +i + ( i < 0 ? len : 0 );
+ return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ end: function() {
+ return this.prevObject || this.constructor(null);
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: core_push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+ var options, name, src, copy, copyIsArray, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
+
+ // extend jQuery itself if only one argument is passed
+ if ( length === i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && jQuery.isArray(src) ? src : [];
+
+ } else {
+ clone = src && jQuery.isPlainObject(src) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ if ( window.$ === jQuery ) {
+ window.$ = _$;
+ }
+
+ if ( deep && window.jQuery === jQuery ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
+ },
+
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // A counter to track how many items to wait for before
+ // the ready event fires. See #6781
+ readyWait: 1,
+
+ // Hold (or release) the ready event
+ holdReady: function( hold ) {
+ if ( hold ) {
+ jQuery.readyWait++;
+ } else {
+ jQuery.ready( true );
+ }
+ },
+
+ // Handle when the DOM is ready
+ ready: function( wait ) {
+
+ // Abort if there are pending holds or we're already ready
+ if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
+ return;
+ }
+
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready );
+ }
+
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If a normal DOM Ready event fired, decrement, and wait if need be
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
+ return;
+ }
+
+ // If there are functions bound, to execute
+ readyList.resolveWith( document, [ jQuery ] );
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger("ready").off("ready");
+ }
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return jQuery.type(obj) === "function";
+ },
+
+ isArray: Array.isArray || function( obj ) {
+ return jQuery.type(obj) === "array";
+ },
+
+ isWindow: function( obj ) {
+ return obj != null && obj == obj.window;
+ },
+
+ isNumeric: function( obj ) {
+ return !isNaN( parseFloat(obj) ) && isFinite( obj );
+ },
+
+ type: function( obj ) {
+ if ( obj == null ) {
+ return String( obj );
+ }
+ return typeof obj === "object" || typeof obj === "function" ?
+ class2type[ core_toString.call(obj) ] || "object" :
+ typeof obj;
+ },
+
+ isPlainObject: function( obj ) {
+ // Must be an Object.
+ // Because of IE, we also have to check the presence of the constructor property.
+ // Make sure that DOM nodes and window objects don't pass through, as well
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ try {
+ // Not own constructor property must be Object
+ if ( obj.constructor &&
+ !core_hasOwn.call(obj, "constructor") &&
+ !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+ } catch ( e ) {
+ // IE8,9 Will throw exceptions on certain host objects #9897
+ return false;
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+
+ var key;
+ for ( key in obj ) {}
+
+ return key === undefined || core_hasOwn.call( obj, key );
+ },
+
+ isEmptyObject: function( obj ) {
+ var name;
+ for ( name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ error: function( msg ) {
+ throw new Error( msg );
+ },
+
+ // data: string of html
+ // context (optional): If specified, the fragment will be created in this context, defaults to document
+ // keepScripts (optional): If true, will include scripts passed in the html string
+ parseHTML: function( data, context, keepScripts ) {
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ if ( typeof context === "boolean" ) {
+ keepScripts = context;
+ context = false;
+ }
+ context = context || document;
+
+ var parsed = rsingleTag.exec( data ),
+ scripts = !keepScripts && [];
+
+ // Single tag
+ if ( parsed ) {
+ return [ context.createElement( parsed[1] ) ];
+ }
+
+ parsed = jQuery.buildFragment( [ data ], context, scripts );
+ if ( scripts ) {
+ jQuery( scripts ).remove();
+ }
+ return jQuery.merge( [], parsed.childNodes );
+ },
+
+ parseJSON: function( data ) {
+ // Attempt to parse using the native JSON parser first
+ if ( window.JSON && window.JSON.parse ) {
+ return window.JSON.parse( data );
+ }
+
+ if ( data === null ) {
+ return data;
+ }
+
+ if ( typeof data === "string" ) {
+
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
+ data = jQuery.trim( data );
+
+ if ( data ) {
+ // Make sure the incoming data is actual JSON
+ // Logic borrowed from http://json.org/json2.js
+ if ( rvalidchars.test( data.replace( rvalidescape, "@" )
+ .replace( rvalidtokens, "]" )
+ .replace( rvalidbraces, "")) ) {
+
+ return ( new Function( "return " + data ) )();
+ }
+ }
+ }
+
+ jQuery.error( "Invalid JSON: " + data );
+ },
+
+ // Cross-browser xml parsing
+ parseXML: function( data ) {
+ var xml, tmp;
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ try {
+ if ( window.DOMParser ) { // Standard
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } else { // IE
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
+ xml.async = "false";
+ xml.loadXML( data );
+ }
+ } catch( e ) {
+ xml = undefined;
+ }
+ if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
+ jQuery.error( "Invalid XML: " + data );
+ }
+ return xml;
+ },
+
+ noop: function() {},
+
+ // Evaluates a script in a global context
+ // Workarounds based on findings by Jim Driscoll
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
+ globalEval: function( data ) {
+ if ( data && jQuery.trim( data ) ) {
+ // We use execScript on Internet Explorer
+ // We use an anonymous function so that context is window
+ // rather than jQuery in Firefox
+ ( window.execScript || function( data ) {
+ window[ "eval" ].call( window, data );
+ } )( data );
+ }
+ },
+
+ // Convert dashed to camelCase; used by the css and data modules
+ // Microsoft forgot to hump their vendor prefix (#9572)
+ camelCase: function( string ) {
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
+ },
+
+ // args is for internal usage only
+ each: function( obj, callback, args ) {
+ var value,
+ i = 0,
+ length = obj.length,
+ isArray = isArraylike( obj );
+
+ if ( args ) {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+ }
+
+ return obj;
+ },
+
+ // Use native String.trim function wherever possible
+ trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
+ function( text ) {
+ return text == null ?
+ "" :
+ core_trim.call( text );
+ } :
+
+ // Otherwise use our own trimming functionality
+ function( text ) {
+ return text == null ?
+ "" :
+ ( text + "" ).replace( rtrim, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( arr, results ) {
+ var ret = results || [];
+
+ if ( arr != null ) {
+ if ( isArraylike( Object(arr) ) ) {
+ jQuery.merge( ret,
+ typeof arr === "string" ?
+ [ arr ] : arr
+ );
+ } else {
+ core_push.call( ret, arr );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, arr, i ) {
+ var len;
+
+ if ( arr ) {
+ if ( core_indexOf ) {
+ return core_indexOf.call( arr, elem, i );
+ }
+
+ len = arr.length;
+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
+
+ for ( ; i < len; i++ ) {
+ // Skip accessing in sparse arrays
+ if ( i in arr && arr[ i ] === elem ) {
+ return i;
+ }
+ }
+ }
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ var l = second.length,
+ i = first.length,
+ j = 0;
+
+ if ( typeof l === "number" ) {
+ for ( ; j < l; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+ } else {
+ while ( second[j] !== undefined ) {
+ first[ i++ ] = second[ j++ ];
+ }
+ }
+
+ first.length = i;
+
+ return first;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var retVal,
+ ret = [],
+ i = 0,
+ length = elems.length;
+ inv = !!inv;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( ; i < length; i++ ) {
+ retVal = !!callback( elems[ i ], i );
+ if ( inv !== retVal ) {
+ ret.push( elems[ i ] );
+ }
+ }
+
+ return ret;
+ },
+
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var value,
+ i = 0,
+ length = elems.length,
+ isArray = isArraylike( elems ),
+ ret = [];
+
+ // Go through the array, translating each of the items to their
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+
+ // Go through every key on the object,
+ } else {
+ for ( i in elems ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+ }
+
+ // Flatten any nested arrays
+ return core_concat.apply( [], ret );
+ },
+
+ // A global GUID counter for objects
+ guid: 1,
+
+ // Bind a function to a context, optionally partially applying any
+ // arguments.
+ proxy: function( fn, context ) {
+ var tmp, args, proxy;
+
+ if ( typeof context === "string" ) {
+ tmp = fn[ context ];
+ context = fn;
+ fn = tmp;
+ }
+
+ // Quick check to determine if target is callable, in the spec
+ // this throws a TypeError, but we will just return undefined.
+ if ( !jQuery.isFunction( fn ) ) {
+ return undefined;
+ }
+
+ // Simulated bind
+ args = core_slice.call( arguments, 2 );
+ proxy = function() {
+ return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
+ };
+
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || jQuery.guid++;
+
+ return proxy;
+ },
+
+ // Multifunctional method to get and set values of a collection
+ // The value/s can optionally be executed if it's a function
+ access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
+ var i = 0,
+ length = elems.length,
+ bulk = key == null;
+
+ // Sets many values
+ if ( jQuery.type( key ) === "object" ) {
+ chainable = true;
+ for ( i in key ) {
+ jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
+ }
+
+ // Sets one value
+ } else if ( value !== undefined ) {
+ chainable = true;
+
+ if ( !jQuery.isFunction( value ) ) {
+ raw = true;
+ }
+
+ if ( bulk ) {
+ // Bulk operations run against the entire set
+ if ( raw ) {
+ fn.call( elems, value );
+ fn = null;
+
+ // ...except when executing function values
+ } else {
+ bulk = fn;
+ fn = function( elem, key, value ) {
+ return bulk.call( jQuery( elem ), value );
+ };
+ }
+ }
+
+ if ( fn ) {
+ for ( ; i < length; i++ ) {
+ fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
+ }
+ }
+ }
+
+ return chainable ?
+ elems :
+
+ // Gets
+ bulk ?
+ fn.call( elems ) :
+ length ? fn( elems[0], key ) : emptyGet;
+ },
+
+ now: function() {
+ return ( new Date() ).getTime();
+ }
+});
+
+jQuery.ready.promise = function( obj ) {
+ if ( !readyList ) {
+
+ readyList = jQuery.Deferred();
+
+ // Catch cases where $(document).ready() is called after the browser event has already occurred.
+ // we once tried to use readyState "interactive" here, but it caused issues like the one
+ // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
+ if ( document.readyState === "complete" ) {
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ setTimeout( jQuery.ready );
+
+ // Standards-based browsers support DOMContentLoaded
+ } else if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", jQuery.ready, false );
+
+ // If IE event model is used
+ } else {
+ // Ensure firing before onload, maybe late but safe also for iframes
+ document.attachEvent( "onreadystatechange", DOMContentLoaded );
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", jQuery.ready );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var top = false;
+
+ try {
+ top = window.frameElement == null && document.documentElement;
+ } catch(e) {}
+
+ if ( top && top.doScroll ) {
+ (function doScrollCheck() {
+ if ( !jQuery.isReady ) {
+
+ try {
+ // Use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ top.doScroll("left");
+ } catch(e) {
+ return setTimeout( doScrollCheck, 50 );
+ }
+
+ // and execute any waiting functions
+ jQuery.ready();
+ }
+ })();
+ }
+ }
+ }
+ return readyList.promise( obj );
+};
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+function isArraylike( obj ) {
+ var length = obj.length,
+ type = jQuery.type( obj );
+
+ if ( jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ if ( obj.nodeType === 1 && length ) {
+ return true;
+ }
+
+ return type === "array" || type !== "function" &&
+ ( length === 0 ||
+ typeof length === "number" && length > 0 && ( length - 1 ) in obj );
+}
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+// String to Object options format cache
+var optionsCache = {};
+
+// Convert String-formatted options into Object-formatted ones and store in cache
+function createOptions( options ) {
+ var object = optionsCache[ options ] = {};
+ jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
+ object[ flag ] = true;
+ });
+ return object;
+}
+
+/*
+ * Create a callback list using the following parameters:
+ *
+ * options: an optional list of space-separated options that will change how
+ * the callback list behaves or a more traditional option object
+ *
+ * By default a callback list will act like an event callback list and can be
+ * "fired" multiple times.
+ *
+ * Possible options:
+ *
+ * once: will ensure the callback list can only be fired once (like a Deferred)
+ *
+ * memory: will keep track of previous values and will call any callback added
+ * after the list has been fired right away with the latest "memorized"
+ * values (like a Deferred)
+ *
+ * unique: will ensure a callback can only be added once (no duplicate in the list)
+ *
+ * stopOnFalse: interrupt callings when a callback returns false
+ *
+ */
+jQuery.Callbacks = function( options ) {
+
+ // Convert options from String-formatted to Object-formatted if needed
+ // (we check in cache first)
+ options = typeof options === "string" ?
+ ( optionsCache[ options ] || createOptions( options ) ) :
+ jQuery.extend( {}, options );
+
+ var // Last fire value (for non-forgettable lists)
+ memory,
+ // Flag to know if list was already fired
+ fired,
+ // Flag to know if list is currently firing
+ firing,
+ // First callback to fire (used internally by add and fireWith)
+ firingStart,
+ // End of the loop when firing
+ firingLength,
+ // Index of currently firing callback (modified by remove if needed)
+ firingIndex,
+ // Actual callback list
+ list = [],
+ // Stack of fire calls for repeatable lists
+ stack = !options.once && [],
+ // Fire callbacks
+ fire = function( data ) {
+ memory = options.memory && data;
+ fired = true;
+ firingIndex = firingStart || 0;
+ firingStart = 0;
+ firingLength = list.length;
+ firing = true;
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+ if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
+ memory = false; // To prevent further calls using add
+ break;
+ }
+ }
+ firing = false;
+ if ( list ) {
+ if ( stack ) {
+ if ( stack.length ) {
+ fire( stack.shift() );
+ }
+ } else if ( memory ) {
+ list = [];
+ } else {
+ self.disable();
+ }
+ }
+ },
+ // Actual Callbacks object
+ self = {
+ // Add a callback or a collection of callbacks to the list
+ add: function() {
+ if ( list ) {
+ // First, we save the current length
+ var start = list.length;
+ (function add( args ) {
+ jQuery.each( args, function( _, arg ) {
+ var type = jQuery.type( arg );
+ if ( type === "function" ) {
+ if ( !options.unique || !self.has( arg ) ) {
+ list.push( arg );
+ }
+ } else if ( arg && arg.length && type !== "string" ) {
+ // Inspect recursively
+ add( arg );
+ }
+ });
+ })( arguments );
+ // Do we need to add the callbacks to the
+ // current firing batch?
+ if ( firing ) {
+ firingLength = list.length;
+ // With memory, if we're not firing then
+ // we should call right away
+ } else if ( memory ) {
+ firingStart = start;
+ fire( memory );
+ }
+ }
+ return this;
+ },
+ // Remove a callback from the list
+ remove: function() {
+ if ( list ) {
+ jQuery.each( arguments, function( _, arg ) {
+ var index;
+ while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
+ list.splice( index, 1 );
+ // Handle firing indexes
+ if ( firing ) {
+ if ( index <= firingLength ) {
+ firingLength--;
+ }
+ if ( index <= firingIndex ) {
+ firingIndex--;
+ }
+ }
+ }
+ });
+ }
+ return this;
+ },
+ // Control if a given callback is in the list
+ has: function( fn ) {
+ return jQuery.inArray( fn, list ) > -1;
+ },
+ // Remove all callbacks from the list
+ empty: function() {
+ list = [];
+ return this;
+ },
+ // Have the list do nothing anymore
+ disable: function() {
+ list = stack = memory = undefined;
+ return this;
+ },
+ // Is it disabled?
+ disabled: function() {
+ return !list;
+ },
+ // Lock the list in its current state
+ lock: function() {
+ stack = undefined;
+ if ( !memory ) {
+ self.disable();
+ }
+ return this;
+ },
+ // Is it locked?
+ locked: function() {
+ return !stack;
+ },
+ // Call all callbacks with the given context and arguments
+ fireWith: function( context, args ) {
+ args = args || [];
+ args = [ context, args.slice ? args.slice() : args ];
+ if ( list && ( !fired || stack ) ) {
+ if ( firing ) {
+ stack.push( args );
+ } else {
+ fire( args );
+ }
+ }
+ return this;
+ },
+ // Call all the callbacks with the given arguments
+ fire: function() {
+ self.fireWith( this, arguments );
+ return this;
+ },
+ // To know if the callbacks have already been called at least once
+ fired: function() {
+ return !!fired;
+ }
+ };
+
+ return self;
+};
+jQuery.extend({
+
+ Deferred: function( func ) {
+ var tuples = [
+ // action, add listener, listener list, final state
+ [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
+ [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
+ [ "notify", "progress", jQuery.Callbacks("memory") ]
+ ],
+ state = "pending",
+ promise = {
+ state: function() {
+ return state;
+ },
+ always: function() {
+ deferred.done( arguments ).fail( arguments );
+ return this;
+ },
+ then: function( /* fnDone, fnFail, fnProgress */ ) {
+ var fns = arguments;
+ return jQuery.Deferred(function( newDefer ) {
+ jQuery.each( tuples, function( i, tuple ) {
+ var action = tuple[ 0 ],
+ fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
+ // deferred[ done | fail | progress ] for forwarding actions to newDefer
+ deferred[ tuple[1] ](function() {
+ var returned = fn && fn.apply( this, arguments );
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
+ returned.promise()
+ .done( newDefer.resolve )
+ .fail( newDefer.reject )
+ .progress( newDefer.notify );
+ } else {
+ newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
+ }
+ });
+ });
+ fns = null;
+ }).promise();
+ },
+ // Get a promise for this deferred
+ // If obj is provided, the promise aspect is added to the object
+ promise: function( obj ) {
+ return obj != null ? jQuery.extend( obj, promise ) : promise;
+ }
+ },
+ deferred = {};
+
+ // Keep pipe for back-compat
+ promise.pipe = promise.then;
+
+ // Add list-specific methods
+ jQuery.each( tuples, function( i, tuple ) {
+ var list = tuple[ 2 ],
+ stateString = tuple[ 3 ];
+
+ // promise[ done | fail | progress ] = list.add
+ promise[ tuple[1] ] = list.add;
+
+ // Handle state
+ if ( stateString ) {
+ list.add(function() {
+ // state = [ resolved | rejected ]
+ state = stateString;
+
+ // [ reject_list | resolve_list ].disable; progress_list.lock
+ }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
+ }
+
+ // deferred[ resolve | reject | notify ]
+ deferred[ tuple[0] ] = function() {
+ deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
+ return this;
+ };
+ deferred[ tuple[0] + "With" ] = list.fireWith;
+ });
+
+ // Make the deferred a promise
+ promise.promise( deferred );
+
+ // Call given func if any
+ if ( func ) {
+ func.call( deferred, deferred );
+ }
+
+ // All done!
+ return deferred;
+ },
+
+ // Deferred helper
+ when: function( subordinate /* , ..., subordinateN */ ) {
+ var i = 0,
+ resolveValues = core_slice.call( arguments ),
+ length = resolveValues.length,
+
+ // the count of uncompleted subordinates
+ remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
+
+ // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
+ deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
+
+ // Update function for both resolve and progress values
+ updateFunc = function( i, contexts, values ) {
+ return function( value ) {
+ contexts[ i ] = this;
+ values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
+ if( values === progressValues ) {
+ deferred.notifyWith( contexts, values );
+ } else if ( !( --remaining ) ) {
+ deferred.resolveWith( contexts, values );
+ }
+ };
+ },
+
+ progressValues, progressContexts, resolveContexts;
+
+ // add listeners to Deferred subordinates; treat others as resolved
+ if ( length > 1 ) {
+ progressValues = new Array( length );
+ progressContexts = new Array( length );
+ resolveContexts = new Array( length );
+ for ( ; i < length; i++ ) {
+ if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
+ resolveValues[ i ].promise()
+ .done( updateFunc( i, resolveContexts, resolveValues ) )
+ .fail( deferred.reject )
+ .progress( updateFunc( i, progressContexts, progressValues ) );
+ } else {
+ --remaining;
+ }
+ }
+ }
+
+ // if we're not waiting on anything, resolve the master
+ if ( !remaining ) {
+ deferred.resolveWith( resolveContexts, resolveValues );
+ }
+
+ return deferred.promise();
+ }
+});
+jQuery.support = (function() {
+
+ var support, all, a, select, opt, input, fragment, eventName, isSupported, i,
+ div = document.createElement("div");
+
+ // Setup
+ div.setAttribute( "className", "t" );
+ div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+
+ // Support tests won't run in some limited or non-browser environments
+ all = div.getElementsByTagName("*");
+ a = div.getElementsByTagName("a")[ 0 ];
+ if ( !all || !a || !all.length ) {
+ return {};
+ }
+
+ // First batch of tests
+ select = document.createElement("select");
+ opt = select.appendChild( document.createElement("option") );
+ input = div.getElementsByTagName("input")[ 0 ];
+
+ a.style.cssText = "top:1px;float:left;opacity:.5";
+ support = {
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+ getSetAttribute: div.className !== "t",
+
+ // IE strips leading whitespace when .innerHTML is used
+ leadingWhitespace: div.firstChild.nodeType === 3,
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ tbody: !div.getElementsByTagName("tbody").length,
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ htmlSerialize: !!div.getElementsByTagName("link").length,
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText instead)
+ style: /top/.test( a.getAttribute("style") ),
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ hrefNormalized: a.getAttribute("href") === "/a",
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ // Use a regex to work around a WebKit issue. See #5145
+ opacity: /^0.5/.test( a.style.opacity ),
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ cssFloat: !!a.style.cssFloat,
+
+ // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
+ checkOn: !!input.value,
+
+ // Make sure that a selected-by-default option has a working selected property.
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+ optSelected: opt.selected,
+
+ // Tests for enctype support on a form (#6743)
+ enctype: !!document.createElement("form").enctype,
+
+ // Makes sure cloning an html5 element does not cause problems
+ // Where outerHTML is undefined, this still works
+ html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
+
+ // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
+ boxModel: document.compatMode === "CSS1Compat",
+
+ // Will be defined later
+ deleteExpando: true,
+ noCloneEvent: true,
+ inlineBlockNeedsLayout: false,
+ shrinkWrapBlocks: false,
+ reliableMarginRight: true,
+ boxSizingReliable: true,
+ pixelPosition: false
+ };
+
+ // Make sure checked status is properly cloned
+ input.checked = true;
+ support.noCloneChecked = input.cloneNode( true ).checked;
+
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as disabled)
+ select.disabled = true;
+ support.optDisabled = !opt.disabled;
+
+ // Support: IE<9
+ try {
+ delete div.test;
+ } catch( e ) {
+ support.deleteExpando = false;
+ }
+
+ // Check if we can trust getAttribute("value")
+ input = document.createElement("input");
+ input.setAttribute( "value", "" );
+ support.input = input.getAttribute( "value" ) === "";
+
+ // Check if an input maintains its value after becoming a radio
+ input.value = "t";
+ input.setAttribute( "type", "radio" );
+ support.radioValue = input.value === "t";
+
+ // #11217 - WebKit loses check when the name is after the checked attribute
+ input.setAttribute( "checked", "t" );
+ input.setAttribute( "name", "t" );
+
+ fragment = document.createDocumentFragment();
+ fragment.appendChild( input );
+
+ // Check if a disconnected checkbox will retain its checked
+ // value of true after appended to the DOM (IE6/7)
+ support.appendChecked = input.checked;
+
+ // WebKit doesn't clone checked state correctly in fragments
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+ // Support: IE<9
+ // Opera does not clone events (and typeof div.attachEvent === undefined).
+ // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
+ if ( div.attachEvent ) {
+ div.attachEvent( "onclick", function() {
+ support.noCloneEvent = false;
+ });
+
+ div.cloneNode( true ).click();
+ }
+
+ // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
+ // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
+ for ( i in { submit: true, change: true, focusin: true }) {
+ div.setAttribute( eventName = "on" + i, "t" );
+
+ support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
+ }
+
+ div.style.backgroundClip = "content-box";
+ div.cloneNode( true ).style.backgroundClip = "";
+ support.clearCloneStyle = div.style.backgroundClip === "content-box";
+
+ // Run tests that need a body at doc ready
+ jQuery(function() {
+ var container, marginDiv, tds,
+ divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
+ body = document.getElementsByTagName("body")[0];
+
+ if ( !body ) {
+ // Return for frameset docs that don't have a body
+ return;
+ }
+
+ container = document.createElement("div");
+ container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
+
+ body.appendChild( container ).appendChild( div );
+
+ // Support: IE8
+ // Check if table cells still have offsetWidth/Height when they are set
+ // to display:none and there are still other visible table cells in a
+ // table row; if so, offsetWidth/Height are not reliable for use when
+ // determining if an element has been hidden directly using
+ // display:none (it is still safe to use offsets if a parent element is
+ // hidden; don safety goggles and see bug #4512 for more information).
+ div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
+ tds = div.getElementsByTagName("td");
+ tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+ tds[ 0 ].style.display = "";
+ tds[ 1 ].style.display = "none";
+
+ // Support: IE8
+ // Check if empty table cells still have offsetWidth/Height
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+ // Check box-sizing and margin behavior
+ div.innerHTML = "";
+ div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
+ support.boxSizing = ( div.offsetWidth === 4 );
+ support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
+
+ // Use window.getComputedStyle because jsdom on node.js will break without it.
+ if ( window.getComputedStyle ) {
+ support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
+ support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
+
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. (#3333)
+ // Fails in WebKit before Feb 2011 nightlies
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ marginDiv = div.appendChild( document.createElement("div") );
+ marginDiv.style.cssText = div.style.cssText = divReset;
+ marginDiv.style.marginRight = marginDiv.style.width = "0";
+ div.style.width = "1px";
+
+ support.reliableMarginRight =
+ !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
+ }
+
+ if ( typeof div.style.zoom !== "undefined" ) {
+ // Support: IE<8
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ div.innerHTML = "";
+ div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
+
+ // Support: IE6
+ // Check if elements with layout shrink-wrap their children
+ div.style.display = "block";
+ div.innerHTML = "<div></div>";
+ div.firstChild.style.width = "5px";
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
+
+ // Prevent IE 6 from affecting layout for positioned elements #11048
+ // Prevent IE from shrinking the body in IE 7 mode #12869
+ body.style.zoom = 1;
+ }
+
+ body.removeChild( container );
+
+ // Null elements to avoid leaks in IE
+ container = div = tds = marginDiv = null;
+ });
+
+ // Null elements to avoid leaks in IE
+ all = select = fragment = opt = a = input = null;
+
+ return support;
+})();
+
+var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
+ rmultiDash = /([A-Z])/g;
+
+function internalData( elem, name, data, pvt /* Internal Use Only */ ){
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var thisCache, ret,
+ internalKey = jQuery.expando,
+ getByName = typeof name === "string",
+
+ // We have to handle DOM nodes and JS objects differently because IE6-7
+ // can't GC object references properly across the DOM-JS boundary
+ isNode = elem.nodeType,
+
+ // Only DOM nodes need the global jQuery cache; JS object data is
+ // attached directly to the object so GC can occur automatically
+ cache = isNode ? jQuery.cache : elem,
+
+ // Only defining an ID for JS objects if its cache already exists allows
+ // the code to shortcut on the same path as a DOM node with no cache
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
+
+ // Avoid doing any more work than we need to when trying to get data on an
+ // object that has no data at all
+ if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
+ return;
+ }
+
+ if ( !id ) {
+ // Only DOM nodes need a new unique ID for each element since their data
+ // ends up in the global cache
+ if ( isNode ) {
+ elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++;
+ } else {
+ id = internalKey;
+ }
+ }
+
+ if ( !cache[ id ] ) {
+ cache[ id ] = {};
+
+ // Avoids exposing jQuery metadata on plain JS objects when the object
+ // is serialized using JSON.stringify
+ if ( !isNode ) {
+ cache[ id ].toJSON = jQuery.noop;
+ }
+ }
+
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
+ // shallow copied over onto the existing cache
+ if ( typeof name === "object" || typeof name === "function" ) {
+ if ( pvt ) {
+ cache[ id ] = jQuery.extend( cache[ id ], name );
+ } else {
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
+ }
+ }
+
+ thisCache = cache[ id ];
+
+ // jQuery data() is stored in a separate object inside the object's internal data
+ // cache in order to avoid key collisions between internal data and user-defined
+ // data.
+ if ( !pvt ) {
+ if ( !thisCache.data ) {
+ thisCache.data = {};
+ }
+
+ thisCache = thisCache.data;
+ }
+
+ if ( data !== undefined ) {
+ thisCache[ jQuery.camelCase( name ) ] = data;
+ }
+
+ // Check for both converted-to-camel and non-converted data property names
+ // If a data property was specified
+ if ( getByName ) {
+
+ // First Try to find as-is property data
+ ret = thisCache[ name ];
+
+ // Test for null|undefined property data
+ if ( ret == null ) {
+
+ // Try to find the camelCased property
+ ret = thisCache[ jQuery.camelCase( name ) ];
+ }
+ } else {
+ ret = thisCache;
+ }
+
+ return ret;
+}
+
+function internalRemoveData( elem, name, pvt /* For internal use only */ ){
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var thisCache, i, l,
+
+ isNode = elem.nodeType,
+
+ // See jQuery.data for more information
+ cache = isNode ? jQuery.cache : elem,
+ id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
+
+ // If there is already no cache entry for this object, there is no
+ // purpose in continuing
+ if ( !cache[ id ] ) {
+ return;
+ }
+
+ if ( name ) {
+
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
+
+ if ( thisCache ) {
+
+ // Support array or space separated string names for data keys
+ if ( !jQuery.isArray( name ) ) {
+
+ // try the string as a key before any manipulation
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+
+ // split the camel cased version by spaces unless a key with the spaces exists
+ name = jQuery.camelCase( name );
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+ name = name.split(" ");
+ }
+ }
+ } else {
+ // If "name" is an array of keys...
+ // When data is initially created, via ("key", "val") signature,
+ // keys will be converted to camelCase.
+ // Since there is no way to tell _how_ a key was added, remove
+ // both plain key and camelCase key. #12786
+ // This will only penalize the array argument path.
+ name = name.concat( jQuery.map( name, jQuery.camelCase ) );
+ }
+
+ for ( i = 0, l = name.length; i < l; i++ ) {
+ delete thisCache[ name[i] ];
+ }
+
+ // If there is no data left in the cache, we want to continue
+ // and let the cache object itself get destroyed
+ if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
+ return;
+ }
+ }
+ }
+
+ // See jQuery.data for more information
+ if ( !pvt ) {
+ delete cache[ id ].data;
+
+ // Don't destroy the parent cache unless the internal data object
+ // had been the only thing left in it
+ if ( !isEmptyDataObject( cache[ id ] ) ) {
+ return;
+ }
+ }
+
+ // Destroy the cache
+ if ( isNode ) {
+ jQuery.cleanData( [ elem ], true );
+
+ // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
+ } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
+ delete cache[ id ];
+
+ // When all else fails, null
+ } else {
+ cache[ id ] = null;
+ }
+}
+
+jQuery.extend({
+ cache: {},
+
+ // Unique for each copy of jQuery on the page
+ // Non-digits removed to match rinlinejQuery
+ expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "embed": true,
+ // Ban all objects except for Flash (which handle expandos)
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
+ "applet": true
+ },
+
+ hasData: function( elem ) {
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+ return !!elem && !isEmptyDataObject( elem );
+ },
+
+ data: function( elem, name, data ) {
+ return internalData( elem, name, data, false );
+ },
+
+ removeData: function( elem, name ) {
+ return internalRemoveData( elem, name, false );
+ },
+
+ // For internal use only.
+ _data: function( elem, name, data ) {
+ return internalData( elem, name, data, true );
+ },
+
+ _removeData: function( elem, name ) {
+ return internalRemoveData( elem, name, true );
+ },
+
+ // A method for determining if a DOM node can handle the data expando
+ acceptData: function( elem ) {
+ var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+ // nodes accept data unless otherwise specified; rejection can be conditional
+ return !noData || noData !== true && elem.getAttribute("classid") === noData;
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ var attrs, name,
+ elem = this[0],
+ i = 0,
+ data = null;
+
+ // Gets all values
+ if ( key === undefined ) {
+ if ( this.length ) {
+ data = jQuery.data( elem );
+
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
+ attrs = elem.attributes;
+ for ( ; i < attrs.length; i++ ) {
+ name = attrs[i].name;
+
+ if ( !name.indexOf( "data-" ) ) {
+ name = jQuery.camelCase( name.substring(5) );
+
+ dataAttr( elem, name, data[ name ] );
+ }
+ }
+ jQuery._data( elem, "parsedAttrs", true );
+ }
+ }
+
+ return data;
+ }
+
+ // Sets multiple values
+ if ( typeof key === "object" ) {
+ return this.each(function() {
+ jQuery.data( this, key );
+ });
+ }
+
+ return jQuery.access( this, function( value ) {
+
+ if ( value === undefined ) {
+ // Try to fetch any internally stored data first
+ return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
+ }
+
+ this.each(function() {
+ jQuery.data( this, key, value );
+ });
+ }, null, value, arguments.length > 1, null, true );
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ jQuery.removeData( this, key );
+ });
+ }
+});
+
+function dataAttr( elem, key, data ) {
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
+
+ data = elem.getAttribute( name );
+
+ if ( typeof data === "string" ) {
+ try {
+ data = data === "true" ? true :
+ data === "false" ? false :
+ data === "null" ? null :
+ // Only convert to a number if it doesn't change the string
+ +data + "" === data ? +data :
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ jQuery.data( elem, key, data );
+
+ } else {
+ data = undefined;
+ }
+ }
+
+ return data;
+}
+
+// checks a cache object for emptiness
+function isEmptyDataObject( obj ) {
+ var name;
+ for ( name in obj ) {
+
+ // if the public data object is empty, the private is still empty
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
+ continue;
+ }
+ if ( name !== "toJSON" ) {
+ return false;
+ }
+ }
+
+ return true;
+}
+jQuery.extend({
+ queue: function( elem, type, data ) {
+ var queue;
+
+ if ( elem ) {
+ type = ( type || "fx" ) + "queue";
+ queue = jQuery._data( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !queue || jQuery.isArray(data) ) {
+ queue = jQuery._data( elem, type, jQuery.makeArray(data) );
+ } else {
+ queue.push( data );
+ }
+ }
+ return queue || [];
+ }
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ),
+ startLength = queue.length,
+ fn = queue.shift(),
+ hooks = jQuery._queueHooks( elem, type ),
+ next = function() {
+ jQuery.dequeue( elem, type );
+ };
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ startLength--;
+ }
+
+ hooks.cur = fn;
+ if ( fn ) {
+
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift( "inprogress" );
+ }
+
+ // clear up the last queue stop function
+ delete hooks.stop;
+ fn.call( elem, next, hooks );
+ }
+
+ if ( !startLength && hooks ) {
+ hooks.empty.fire();
+ }
+ },
+
+ // not intended for public consumption - generates a queueHooks object, or returns the current one
+ _queueHooks: function( elem, type ) {
+ var key = type + "queueHooks";
+ return jQuery._data( elem, key ) || jQuery._data( elem, key, {
+ empty: jQuery.Callbacks("once memory").add(function() {
+ jQuery._removeData( elem, type + "queue" );
+ jQuery._removeData( elem, key );
+ })
+ });
+ }
+});
+
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ var setter = 2;
+
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ setter--;
+ }
+
+ if ( arguments.length < setter ) {
+ return jQuery.queue( this[0], type );
+ }
+
+ return data === undefined ?
+ this :
+ this.each(function() {
+ var queue = jQuery.queue( this, type, data );
+
+ // ensure a hooks for this queue
+ jQuery._queueHooks( this, type );
+
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function( next, hooks ) {
+ var timeout = setTimeout( next, time );
+ hooks.stop = function() {
+ clearTimeout( timeout );
+ };
+ });
+ },
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ },
+ // Get a promise resolved when queues of a certain type
+ // are emptied (fx is the type by default)
+ promise: function( type, obj ) {
+ var tmp,
+ count = 1,
+ defer = jQuery.Deferred(),
+ elements = this,
+ i = this.length,
+ resolve = function() {
+ if ( !( --count ) ) {
+ defer.resolveWith( elements, [ elements ] );
+ }
+ };
+
+ if ( typeof type !== "string" ) {
+ obj = type;
+ type = undefined;
+ }
+ type = type || "fx";
+
+ while( i-- ) {
+ tmp = jQuery._data( elements[ i ], type + "queueHooks" );
+ if ( tmp && tmp.empty ) {
+ count++;
+ tmp.empty.add( resolve );
+ }
+ }
+ resolve();
+ return defer.promise( obj );
+ }
+});
+var nodeHook, boolHook,
+ rclass = /[\t\r\n]/g,
+ rreturn = /\r/g,
+ rfocusable = /^(?:input|select|textarea|button|object)$/i,
+ rclickable = /^(?:a|area)$/i,
+ rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,
+ ruseDefault = /^(?:checked|selected)$/i,
+ getSetAttribute = jQuery.support.getSetAttribute,
+ getSetInput = jQuery.support.input;
+
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
+ },
+
+ removeAttr: function( name ) {
+ return this.each(function() {
+ jQuery.removeAttr( this, name );
+ });
+ },
+
+ prop: function( name, value ) {
+ return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
+ },
+
+ removeProp: function( name ) {
+ name = jQuery.propFix[ name ] || name;
+ return this.each(function() {
+ // try/catch handles cases where IE balks (such as removing a property on window)
+ try {
+ this[ name ] = undefined;
+ delete this[ name ];
+ } catch( e ) {}
+ });
+ },
+
+ addClass: function( value ) {
+ var classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).addClass( value.call( this, j, this.className ) );
+ });
+ }
+
+ if ( proceed ) {
+ // The disjunction here is for better compressibility (see removeClass)
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ " "
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
+ cur += clazz + " ";
+ }
+ }
+ elem.className = jQuery.trim( cur );
+
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ var classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = arguments.length === 0 || typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).removeClass( value.call( this, j, this.className ) );
+ });
+ }
+ if ( proceed ) {
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ // This expression is here for better compressibility (see addClass)
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ ""
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ // Remove *all* instances
+ while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
+ cur = cur.replace( " " + clazz + " ", " " );
+ }
+ }
+ elem.className = value ? jQuery.trim( cur ) : "";
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value,
+ isBool = typeof stateVal === "boolean";
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( i ) {
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+ });
+ }
+
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className,
+ i = 0,
+ self = jQuery( this ),
+ state = stateVal,
+ classNames = value.match( core_rnotwhite ) || [];
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space separated list
+ state = isBool ? state : !self.hasClass( className );
+ self[ state ? "addClass" : "removeClass" ]( className );
+ }
+
+ // Toggle whole class name
+ } else if ( type === "undefined" || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery._data( this, "__className__", this.className );
+ }
+
+ // If the element has a class name or if we're passed "false",
+ // then remove the whole classname (if there was one, the above saved it).
+ // Otherwise bring back whatever was previously saved (if anything),
+ // falling back to the empty string if nothing was stored.
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
+ }
+ });
+ },
+
+ hasClass: function( selector ) {
+ var className = " " + selector + " ",
+ i = 0,
+ l = this.length;
+ for ( ; i < l; i++ ) {
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ val: function( value ) {
+ var hooks, ret, isFunction,
+ elem = this[0];
+
+ if ( !arguments.length ) {
+ if ( elem ) {
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
+
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+ return ret;
+ }
+
+ ret = elem.value;
+
+ return typeof ret === "string" ?
+ // handle most common string cases
+ ret.replace(rreturn, "") :
+ // handle cases where value is null/undef or number
+ ret == null ? "" : ret;
+ }
+
+ return;
+ }
+
+ isFunction = jQuery.isFunction( value );
+
+ return this.each(function( i ) {
+ var val,
+ self = jQuery(this);
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call( this, i, self.val() );
+ } else {
+ val = value;
+ }
+
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+ } else if ( typeof val === "number" ) {
+ val += "";
+ } else if ( jQuery.isArray( val ) ) {
+ val = jQuery.map(val, function ( value ) {
+ return value == null ? "" : value + "";
+ });
+ }
+
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
+
+ // If set returns undefined, fall back to normal setting
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+ this.value = val;
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ valHooks: {
+ option: {
+ get: function( elem ) {
+ // attributes.value is undefined in Blackberry 4.7 but
+ // uses .value. See #6932
+ var val = elem.attributes.value;
+ return !val || val.specified ? elem.value : elem.text;
+ }
+ },
+ select: {
+ get: function( elem ) {
+ var value, option,
+ options = elem.options,
+ index = elem.selectedIndex,
+ one = elem.type === "select-one" || index < 0,
+ values = one ? null : [],
+ max = one ? index + 1 : options.length,
+ i = index < 0 ?
+ max :
+ one ? index : 0;
+
+ // Loop through all the selected options
+ for ( ; i < max; i++ ) {
+ option = options[ i ];
+
+ // oldIE doesn't update selected after form reset (#2551)
+ if ( ( option.selected || i === index ) &&
+ // Don't return options that are disabled or in a disabled optgroup
+ ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
+ ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
+
+ // Get the specific value for the option
+ value = jQuery( option ).val();
+
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ return values;
+ },
+
+ set: function( elem, value ) {
+ var values = jQuery.makeArray( value );
+
+ jQuery(elem).find("option").each(function() {
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
+ });
+
+ if ( !values.length ) {
+ elem.selectedIndex = -1;
+ }
+ return values;
+ }
+ }
+ },
+
+ attr: function( elem, name, value ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set attributes on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ // Fallback to prop when attributes are not supported
+ if ( typeof elem.getAttribute === "undefined" ) {
+ return jQuery.prop( elem, name, value );
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ // All attributes are lowercase
+ // Grab necessary hook if one is defined
+ if ( notxml ) {
+ name = name.toLowerCase();
+ hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
+ }
+
+ if ( value !== undefined ) {
+
+ if ( value === null ) {
+ jQuery.removeAttr( elem, name );
+
+ } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ elem.setAttribute( name, value + "" );
+ return value;
+ }
+
+ } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+
+ // In IE9+, Flash objects don't have .getAttribute (#12945)
+ // Support: IE9+
+ if ( typeof elem.getAttribute !== "undefined" ) {
+ ret = elem.getAttribute( name );
+ }
+
+ // Non-existent attributes return null, we normalize to undefined
+ return ret == null ?
+ undefined :
+ ret;
+ }
+ },
+
+ removeAttr: function( elem, value ) {
+ var name, propName,
+ i = 0,
+ attrNames = value && value.match( core_rnotwhite );
+
+ if ( attrNames && elem.nodeType === 1 ) {
+ while ( (name = attrNames[i++]) ) {
+ propName = jQuery.propFix[ name ] || name;
+
+ // Boolean attributes get special treatment (#10870)
+ if ( rboolean.test( name ) ) {
+ // Set corresponding property to false for boolean attributes
+ // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8
+ if ( !getSetAttribute && ruseDefault.test( name ) ) {
+ elem[ jQuery.camelCase( "default-" + name ) ] =
+ elem[ propName ] = false;
+ } else {
+ elem[ propName ] = false;
+ }
+
+ // See #9699 for explanation of this approach (setting first, then removal)
+ } else {
+ jQuery.attr( elem, name, "" );
+ }
+
+ elem.removeAttribute( getSetAttribute ? name : propName );
+ }
+ }
+ },
+
+ attrHooks: {
+ type: {
+ set: function( elem, value ) {
+ if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
+ // Setting the type on a radio button after the value resets the value in IE6-9
+ // Reset value to default in case type is set after value during creation
+ var val = elem.value;
+ elem.setAttribute( "type", value );
+ if ( val ) {
+ elem.value = val;
+ }
+ return value;
+ }
+ }
+ }
+ },
+
+ propFix: {
+ tabindex: "tabIndex",
+ readonly: "readOnly",
+ "for": "htmlFor",
+ "class": "className",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ cellpadding: "cellPadding",
+ rowspan: "rowSpan",
+ colspan: "colSpan",
+ usemap: "useMap",
+ frameborder: "frameBorder",
+ contenteditable: "contentEditable"
+ },
+
+ prop: function( elem, name, value ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set properties on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
+
+ if ( value !== undefined ) {
+ if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ return ( elem[ name ] = value );
+ }
+
+ } else {
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+ return elem[ name ];
+ }
+ }
+ },
+
+ propHooks: {
+ tabIndex: {
+ get: function( elem ) {
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ var attributeNode = elem.getAttributeNode("tabindex");
+
+ return attributeNode && attributeNode.specified ?
+ parseInt( attributeNode.value, 10 ) :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ undefined;
+ }
+ }
+ }
+});
+
+// Hook for boolean attributes
+boolHook = {
+ get: function( elem, name ) {
+ var
+ // Use .prop to determine if this attribute is understood as boolean
+ prop = jQuery.prop( elem, name ),
+
+ // Fetch it accordingly
+ attr = typeof prop === "boolean" && elem.getAttribute( name ),
+ detail = typeof prop === "boolean" ?
+
+ getSetInput && getSetAttribute ?
+ attr != null :
+ // oldIE fabricates an empty string for missing boolean attributes
+ // and conflates checked/selected into attroperties
+ ruseDefault.test( name ) ?
+ elem[ jQuery.camelCase( "default-" + name ) ] :
+ !!attr :
+
+ // fetch an attribute node for properties not recognized as boolean
+ elem.getAttributeNode( name );
+
+ return detail && detail.value !== false ?
+ name.toLowerCase() :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ if ( value === false ) {
+ // Remove boolean attributes when set to false
+ jQuery.removeAttr( elem, name );
+ } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
+ // IE<8 needs the *property* name
+ elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
+
+ // Use defaultChecked and defaultSelected for oldIE
+ } else {
+ elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
+ }
+
+ return name;
+ }
+};
+
+// fix oldIE value attroperty
+if ( !getSetInput || !getSetAttribute ) {
+ jQuery.attrHooks.value = {
+ get: function( elem, name ) {
+ var ret = elem.getAttributeNode( name );
+ return jQuery.nodeName( elem, "input" ) ?
+
+ // Ignore the value *property* by using defaultValue
+ elem.defaultValue :
+
+ ret && ret.specified ? ret.value : undefined;
+ },
+ set: function( elem, value, name ) {
+ if ( jQuery.nodeName( elem, "input" ) ) {
+ // Does not return so that setAttribute is also used
+ elem.defaultValue = value;
+ } else {
+ // Use nodeHook if defined (#1954); otherwise setAttribute is fine
+ return nodeHook && nodeHook.set( elem, value, name );
+ }
+ }
+ };
+}
+
+// IE6/7 do not support getting/setting some attributes with get/setAttribute
+if ( !getSetAttribute ) {
+
+ // Use this for any attribute in IE6/7
+ // This fixes almost every IE6/7 issue
+ nodeHook = jQuery.valHooks.button = {
+ get: function( elem, name ) {
+ var ret = elem.getAttributeNode( name );
+ return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ?
+ ret.value :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ // Set the existing or create a new attribute node
+ var ret = elem.getAttributeNode( name );
+ if ( !ret ) {
+ elem.setAttributeNode(
+ (ret = elem.ownerDocument.createAttribute( name ))
+ );
+ }
+
+ ret.value = value += "";
+
+ // Break association with cloned elements by also using setAttribute (#9646)
+ return name === "value" || value === elem.getAttribute( name ) ?
+ value :
+ undefined;
+ }
+ };
+
+ // Set contenteditable to false on removals(#10429)
+ // Setting to empty string throws an error as an invalid value
+ jQuery.attrHooks.contenteditable = {
+ get: nodeHook.get,
+ set: function( elem, value, name ) {
+ nodeHook.set( elem, value === "" ? false : value, name );
+ }
+ };
+
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )
+ // This is for removals
+ jQuery.each([ "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ set: function( elem, value ) {
+ if ( value === "" ) {
+ elem.setAttribute( name, "auto" );
+ return value;
+ }
+ }
+ });
+ });
+}
+
+
+// Some attributes require a special call on IE
+// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+if ( !jQuery.support.hrefNormalized ) {
+ jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ get: function( elem ) {
+ var ret = elem.getAttribute( name, 2 );
+ return ret == null ? undefined : ret;
+ }
+ });
+ });
+
+ // href/src property should get the full normalized URL (#10299/#12915)
+ jQuery.each([ "href", "src" ], function( i, name ) {
+ jQuery.propHooks[ name ] = {
+ get: function( elem ) {
+ return elem.getAttribute( name, 4 );
+ }
+ };
+ });
+}
+
+if ( !jQuery.support.style ) {
+ jQuery.attrHooks.style = {
+ get: function( elem ) {
+ // Return undefined in the case of empty string
+ // Note: IE uppercases css property names, but if we were to .toLowerCase()
+ // .cssText, that would destroy case senstitivity in URL's, like in "background"
+ return elem.style.cssText || undefined;
+ },
+ set: function( elem, value ) {
+ return ( elem.style.cssText = value + "" );
+ }
+ };
+}
+
+// Safari mis-reports the default selected property of an option
+// Accessing the parent's selectedIndex property fixes it
+if ( !jQuery.support.optSelected ) {
+ jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
+ get: function( elem ) {
+ var parent = elem.parentNode;
+
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
+ return null;
+ }
+ });
+}
+
+// IE6/7 call enctype encoding
+if ( !jQuery.support.enctype ) {
+ jQuery.propFix.enctype = "encoding";
+}
+
+// Radios and checkboxes getter/setter
+if ( !jQuery.support.checkOn ) {
+ jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = {
+ get: function( elem ) {
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ }
+ };
+ });
+}
+jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
+ set: function( elem, value ) {
+ if ( jQuery.isArray( value ) ) {
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+ }
+ }
+ });
+});
+var rformElems = /^(?:input|select|textarea)$/i,
+ rkeyEvent = /^key/,
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+ rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
+
+function returnTrue() {
+ return true;
+}
+
+function returnFalse() {
+ return false;
+}
+
+/*
+ * Helper functions for managing events -- not part of the public interface.
+ * Props to Dean Edwards' addEvent library for many of the ideas.
+ */
+jQuery.event = {
+
+ global: {},
+
+ add: function( elem, types, handler, data, selector ) {
+
+ var handleObjIn, eventHandle, tmp,
+ events, t, handleObj,
+ special, handlers, type, namespaces, origType,
+ // Don't attach events to noData or text/comment nodes (but allow plain objects)
+ elemData = elem.nodeType !== 3 && elem.nodeType !== 8 && jQuery._data( elem );
+
+ if ( !elemData ) {
+ return;
+ }
+
+ // Caller can pass in an object of custom data in lieu of the handler
+ if ( handler.handler ) {
+ handleObjIn = handler;
+ handler = handleObjIn.handler;
+ selector = handleObjIn.selector;
+ }
+
+ // Make sure that the handler has a unique ID, used to find/remove it later
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
+
+ // Init the element's event structure and main handler, if this is the first
+ if ( !(events = elemData.events) ) {
+ events = elemData.events = {};
+ }
+ if ( !(eventHandle = elemData.handle) ) {
+ eventHandle = elemData.handle = function( e ) {
+ // Discard the second event of a jQuery.event.trigger() and
+ // when an event is called after a page has unloaded
+ return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
+ jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
+ undefined;
+ };
+ // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
+ eventHandle.elem = elem;
+ }
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // If event changes its type, use the special event handlers for the changed type
+ special = jQuery.event.special[ type ] || {};
+
+ // If selector defined, determine special event api type, otherwise given type
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+
+ // Update special based on newly reset type
+ special = jQuery.event.special[ type ] || {};
+
+ // handleObj is passed to all event handlers
+ handleObj = jQuery.extend({
+ type: type,
+ origType: origType,
+ data: data,
+ handler: handler,
+ guid: handler.guid,
+ selector: selector,
+ needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
+ namespace: namespaces.join(".")
+ }, handleObjIn );
+
+ // Init the event handler queue if we're the first
+ if ( !(handlers = events[ type ]) ) {
+ handlers = events[ type ] = [];
+ handlers.delegateCount = 0;
+
+ // Only use addEventListener/attachEvent if the special events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ // Bind the global event handler to the element
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, eventHandle );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ special.add.call( elem, handleObj );
+
+ if ( !handleObj.handler.guid ) {
+ handleObj.handler.guid = handler.guid;
+ }
+ }
+
+ // Add to the element's handler list, delegates in front
+ if ( selector ) {
+ handlers.splice( handlers.delegateCount++, 0, handleObj );
+ } else {
+ handlers.push( handleObj );
+ }
+
+ // Keep track of which events have ever been used, for event optimization
+ jQuery.event.global[ type ] = true;
+ }
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, selector, mappedTypes ) {
+
+ var j, origCount, tmp,
+ events, t, handleObj,
+ special, handlers, type, namespaces, origType,
+ elemData = jQuery.hasData( elem ) && jQuery._data( elem );
+
+ if ( !elemData || !(events = elemData.events) ) {
+ return;
+ }
+
+ // Once for each type.namespace in types; type may be omitted
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // Unbind all events (on this namespace, if provided) for the element
+ if ( !type ) {
+ for ( type in events ) {
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
+ }
+ continue;
+ }
+
+ special = jQuery.event.special[ type ] || {};
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+ handlers = events[ type ] || [];
+ tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
+
+ // Remove matching events
+ origCount = j = handlers.length;
+ while ( j-- ) {
+ handleObj = handlers[ j ];
+
+ if ( ( mappedTypes || origType === handleObj.origType ) &&
+ ( !handler || handler.guid === handleObj.guid ) &&
+ ( !tmp || tmp.test( handleObj.namespace ) ) &&
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
+ handlers.splice( j, 1 );
+
+ if ( handleObj.selector ) {
+ handlers.delegateCount--;
+ }
+ if ( special.remove ) {
+ special.remove.call( elem, handleObj );
+ }
+ }
+ }
+
+ // Remove generic event handler if we removed something and no more handlers exist
+ // (avoids potential for endless recursion during removal of special event handlers)
+ if ( origCount && !handlers.length ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
+ jQuery.removeEvent( elem, type, elemData.handle );
+ }
+
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ delete elemData.handle;
+
+ // removeData also checks for emptiness and clears the expando if empty
+ // so use it instead of delete
+ jQuery._removeData( elem, "events" );
+ }
+ },
+
+ trigger: function( event, data, elem, onlyHandlers ) {
+
+ var i, cur, tmp, bubbleType, ontype, handle, special,
+ eventPath = [ elem || document ],
+ type = event.type || event,
+ namespaces = event.namespace ? event.namespace.split(".") : [];
+
+ cur = tmp = elem = elem || document;
+
+ // Don't do events on text and comment nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
+ return;
+ }
+
+ if ( type.indexOf(".") >= 0 ) {
+ // Namespaced trigger; create a regexp to match event type in handle()
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ namespaces.sort();
+ }
+ ontype = type.indexOf(":") < 0 && "on" + type;
+
+ // Caller can pass in a jQuery.Event object, Object, or just an event type string
+ event = event[ jQuery.expando ] ?
+ event :
+ new jQuery.Event( type, typeof event === "object" && event );
+
+ event.isTrigger = true;
+ event.namespace = namespaces.join(".");
+ event.namespace_re = event.namespace ?
+ new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
+ null;
+
+ // Clean up the event in case it is being reused
+ event.result = undefined;
+ if ( !event.target ) {
+ event.target = elem;
+ }
+
+ // Clone any incoming data and prepend the event, creating the handler arg list
+ data = data == null ?
+ [ event ] :
+ jQuery.makeArray( data, [ event ] );
+
+ // Allow special events to draw outside the lines
+ special = jQuery.event.special[ type ] || {};
+ if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
+ return;
+ }
+
+ // Determine event propagation path in advance, per W3C events spec (#9951)
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+ bubbleType = special.delegateType || type;
+ if ( !rfocusMorph.test( bubbleType + type ) ) {
+ cur = cur.parentNode;
+ }
+ for ( ; cur; cur = cur.parentNode ) {
+ eventPath.push( cur );
+ tmp = cur;
+ }
+
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
+ if ( tmp === (elem.ownerDocument || document) ) {
+ eventPath.push( tmp.defaultView || tmp.parentWindow || window );
+ }
+ }
+
+ // Fire handlers on the event path
+ i = 0;
+ while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
+
+ event.type = i > 1 ?
+ bubbleType :
+ special.bindType || type;
+
+ // jQuery handler
+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
+ if ( handle ) {
+ handle.apply( cur, data );
+ }
+
+ // Native handler
+ handle = ontype && cur[ ontype ];
+ if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
+ event.preventDefault();
+ }
+ }
+ event.type = type;
+
+ // If nobody prevented the default action, do it now
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
+
+ if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
+ !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
+
+ // Call a native DOM method on the target with the same name name as the event.
+ // Can't use an .isFunction() check here because IE6/7 fails that test.
+ // Don't do default actions on window, that's where global variables be (#6170)
+ if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
+
+ // Don't re-trigger an onFOO event when we call its FOO() method
+ tmp = elem[ ontype ];
+
+ if ( tmp ) {
+ elem[ ontype ] = null;
+ }
+
+ // Prevent re-triggering of the same event, since we already bubbled it above
+ jQuery.event.triggered = type;
+ try {
+ elem[ type ]();
+ } catch ( e ) {
+ // IE<9 dies on focus/blur to hidden element (#1486,#12518)
+ // only reproducible on winXP IE8 native, not IE9 in IE8 mode
+ }
+ jQuery.event.triggered = undefined;
+
+ if ( tmp ) {
+ elem[ ontype ] = tmp;
+ }
+ }
+ }
+ }
+
+ return event.result;
+ },
+
+ dispatch: function( event ) {
+
+ // Make a writable jQuery.Event from the native event object
+ event = jQuery.event.fix( event );
+
+ var i, j, ret, matched, handleObj,
+ handlerQueue = [],
+ args = core_slice.call( arguments ),
+ handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
+ special = jQuery.event.special[ event.type ] || {};
+
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event
+ args[0] = event;
+ event.delegateTarget = this;
+
+ // Call the preDispatch hook for the mapped type, and let it bail if desired
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
+ return;
+ }
+
+ // Determine handlers
+ handlerQueue = jQuery.event.handlers.call( this, event, handlers );
+
+ // Run delegates first; they may want to stop propagation beneath us
+ i = 0;
+ while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
+ event.currentTarget = matched.elem;
+
+ j = 0;
+ while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
+
+ // Triggered event must either 1) have no namespace, or
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+ if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
+
+ event.handleObj = handleObj;
+ event.data = handleObj.data;
+
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+ .apply( matched.elem, args );
+
+ if ( ret !== undefined ) {
+ if ( (event.result = ret) === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+ }
+ }
+ }
+
+ // Call the postDispatch hook for the mapped type
+ if ( special.postDispatch ) {
+ special.postDispatch.call( this, event );
+ }
+
+ return event.result;
+ },
+
+ handlers: function( event, handlers ) {
+ var i, matches, sel, handleObj,
+ handlerQueue = [],
+ delegateCount = handlers.delegateCount,
+ cur = event.target;
+
+ // Find delegate handlers
+ // Black-hole SVG <use> instance trees (#13180)
+ // Avoid non-left-click bubbling in Firefox (#3861)
+ if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
+
+ for ( ; cur != this; cur = cur.parentNode || this ) {
+
+ // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
+ if ( cur.disabled !== true || event.type !== "click" ) {
+ matches = [];
+ for ( i = 0; i < delegateCount; i++ ) {
+ handleObj = handlers[ i ];
+
+ // Don't conflict with Object.prototype properties (#13203)
+ sel = handleObj.selector + " ";
+
+ if ( matches[ sel ] === undefined ) {
+ matches[ sel ] = handleObj.needsContext ?
+ jQuery( sel, this ).index( cur ) >= 0 :
+ jQuery.find( sel, this, null, [ cur ] ).length;
+ }
+ if ( matches[ sel ] ) {
+ matches.push( handleObj );
+ }
+ }
+ if ( matches.length ) {
+ handlerQueue.push({ elem: cur, handlers: matches });
+ }
+ }
+ }
+ }
+
+ // Add the remaining (directly-bound) handlers
+ if ( delegateCount < handlers.length ) {
+ handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
+ }
+
+ return handlerQueue;
+ },
+
+ fix: function( event ) {
+ if ( event[ jQuery.expando ] ) {
+ return event;
+ }
+
+ // Create a writable copy of the event object and normalize some properties
+ var i, prop,
+ originalEvent = event,
+ fixHook = jQuery.event.fixHooks[ event.type ] || {},
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
+
+ event = new jQuery.Event( originalEvent );
+
+ i = copy.length;
+ while ( i-- ) {
+ prop = copy[ i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Support: IE<9
+ // Fix target property (#1925)
+ if ( !event.target ) {
+ event.target = originalEvent.srcElement || document;
+ }
+
+ // Support: Chrome 23+, Safari?
+ // Target should not be a text node (#504, #13143)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
+
+ // Support: IE<9
+ // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
+ event.metaKey = !!event.metaKey;
+
+ return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
+ },
+
+ // Includes some event props shared by KeyEvent and MouseEvent
+ props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
+
+ fixHooks: {},
+
+ keyHooks: {
+ props: "char charCode key keyCode".split(" "),
+ filter: function( event, original ) {
+
+ // Add which for key events
+ if ( event.which == null ) {
+ event.which = original.charCode != null ? original.charCode : original.keyCode;
+ }
+
+ return event;
+ }
+ },
+
+ mouseHooks: {
+ props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
+ filter: function( event, original ) {
+ var eventDoc, doc, body,
+ button = original.button,
+ fromElement = original.fromElement;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && original.clientX != null ) {
+ eventDoc = event.target.ownerDocument || document;
+ doc = eventDoc.documentElement;
+ body = eventDoc.body;
+
+ event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
+ event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
+ }
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && fromElement ) {
+ event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
+ }
+
+ // Add which for click: 1 === left; 2 === middle; 3 === right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && button !== undefined ) {
+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
+ }
+
+ return event;
+ }
+ },
+
+ special: {
+ load: {
+ // Prevent triggered image.load events from bubbling to window.load
+ noBubble: true
+ },
+ click: {
+ // For checkbox, fire native event so checked state will be right
+ trigger: function() {
+ if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
+ this.click();
+ return false;
+ }
+ }
+ },
+ focus: {
+ // Fire native event if possible so blur/focus sequence is correct
+ trigger: function() {
+ if ( this !== document.activeElement && this.focus ) {
+ try {
+ this.focus();
+ return false;
+ } catch ( e ) {
+ // Support: IE<9
+ // If we error on focus to hidden element (#1486, #12518),
+ // let .trigger() run the handlers
+ }
+ }
+ },
+ delegateType: "focusin"
+ },
+ blur: {
+ trigger: function() {
+ if ( this === document.activeElement && this.blur ) {
+ this.blur();
+ return false;
+ }
+ },
+ delegateType: "focusout"
+ },
+
+ beforeunload: {
+ postDispatch: function( event ) {
+
+ // Even when returnValue equals to undefined Firefox will still show alert
+ if ( event.result !== undefined ) {
+ event.originalEvent.returnValue = event.result;
+ }
+ }
+ }
+ },
+
+ simulate: function( type, elem, event, bubble ) {
+ // Piggyback on a donor event to simulate a different one.
+ // Fake originalEvent to avoid donor's stopPropagation, but if the
+ // simulated event prevents default then we do the same on the donor.
+ var e = jQuery.extend(
+ new jQuery.Event(),
+ event,
+ { type: type,
+ isSimulated: true,
+ originalEvent: {}
+ }
+ );
+ if ( bubble ) {
+ jQuery.event.trigger( e, null, elem );
+ } else {
+ jQuery.event.dispatch.call( elem, e );
+ }
+ if ( e.isDefaultPrevented() ) {
+ event.preventDefault();
+ }
+ }
+};
+
+jQuery.removeEvent = document.removeEventListener ?
+ function( elem, type, handle ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
+ } :
+ function( elem, type, handle ) {
+ var name = "on" + type;
+
+ if ( elem.detachEvent ) {
+
+ // #8545, #7054, preventing memory leaks for custom events in IE6-8
+ // detachEvent needed property on element, by name of that event, to properly expose it to GC
+ if ( typeof elem[ name ] === "undefined" ) {
+ elem[ name ] = null;
+ }
+
+ elem.detachEvent( name, handle );
+ }
+ };
+
+jQuery.Event = function( src, props ) {
+ // Allow instantiation without the 'new' keyword
+ if ( !(this instanceof jQuery.Event) ) {
+ return new jQuery.Event( src, props );
+ }
+
+ // Event object
+ if ( src && src.type ) {
+ this.originalEvent = src;
+ this.type = src.type;
+
+ // Events bubbling up the document may have been marked as prevented
+ // by a handler lower down the tree; reflect the correct value.
+ this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
+ src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
+
+ // Event type
+ } else {
+ this.type = src;
+ }
+
+ // Put explicitly provided properties onto the event object
+ if ( props ) {
+ jQuery.extend( this, props );
+ }
+
+ // Create a timestamp if incoming event doesn't have one
+ this.timeStamp = src && src.timeStamp || jQuery.now();
+
+ // Mark it as fixed
+ this[ jQuery.expando ] = true;
+};
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse,
+
+ preventDefault: function() {
+ var e = this.originalEvent;
+
+ this.isDefaultPrevented = returnTrue;
+ if ( !e ) {
+ return;
+ }
+
+ // If preventDefault exists, run it on the original event
+ if ( e.preventDefault ) {
+ e.preventDefault();
+
+ // Support: IE
+ // Otherwise set the returnValue property of the original event to false
+ } else {
+ e.returnValue = false;
+ }
+ },
+ stopPropagation: function() {
+ var e = this.originalEvent;
+
+ this.isPropagationStopped = returnTrue;
+ if ( !e ) {
+ return;
+ }
+ // If stopPropagation exists, run it on the original event
+ if ( e.stopPropagation ) {
+ e.stopPropagation();
+ }
+
+ // Support: IE
+ // Set the cancelBubble property of the original event to true
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation: function() {
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ }
+};
+
+// Create mouseenter/leave events using mouseover/out and event-time checks
+jQuery.each({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+}, function( orig, fix ) {
+ jQuery.event.special[ orig ] = {
+ delegateType: fix,
+ bindType: fix,
+
+ handle: function( event ) {
+ var ret,
+ target = this,
+ related = event.relatedTarget,
+ handleObj = event.handleObj;
+
+ // For mousenter/leave call the handler if related is outside the target.
+ // NB: No relatedTarget if the mouse left/entered the browser window
+ if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
+ event.type = handleObj.origType;
+ ret = handleObj.handler.apply( this, arguments );
+ event.type = fix;
+ }
+ return ret;
+ }
+ };
+});
+
+// IE submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+ jQuery.event.special.submit = {
+ setup: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Lazy-add a submit handler when a descendant form may potentially be submitted
+ jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
+ // Node name check avoids a VML-related crash in IE (#9807)
+ var elem = e.target,
+ form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
+ if ( form && !jQuery._data( form, "submitBubbles" ) ) {
+ jQuery.event.add( form, "submit._submit", function( event ) {
+ event._submit_bubble = true;
+ });
+ jQuery._data( form, "submitBubbles", true );
+ }
+ });
+ // return undefined since we don't need an event listener
+ },
+
+ postDispatch: function( event ) {
+ // If form was submitted by the user, bubble the event up the tree
+ if ( event._submit_bubble ) {
+ delete event._submit_bubble;
+ if ( this.parentNode && !event.isTrigger ) {
+ jQuery.event.simulate( "submit", this.parentNode, event, true );
+ }
+ }
+ },
+
+ teardown: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
+ jQuery.event.remove( this, "._submit" );
+ }
+ };
+}
+
+// IE change delegation and checkbox/radio fix
+if ( !jQuery.support.changeBubbles ) {
+
+ jQuery.event.special.change = {
+
+ setup: function() {
+
+ if ( rformElems.test( this.nodeName ) ) {
+ // IE doesn't fire change on a check/radio until blur; trigger it on click
+ // after a propertychange. Eat the blur-change in special.change.handle.
+ // This still fires onchange a second time for check/radio after blur.
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ jQuery.event.add( this, "propertychange._change", function( event ) {
+ if ( event.originalEvent.propertyName === "checked" ) {
+ this._just_changed = true;
+ }
+ });
+ jQuery.event.add( this, "click._change", function( event ) {
+ if ( this._just_changed && !event.isTrigger ) {
+ this._just_changed = false;
+ }
+ // Allow triggered, simulated change events (#11500)
+ jQuery.event.simulate( "change", this, event, true );
+ });
+ }
+ return false;
+ }
+ // Delegated event; lazy-add a change handler on descendant inputs
+ jQuery.event.add( this, "beforeactivate._change", function( e ) {
+ var elem = e.target;
+
+ if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
+ jQuery.event.add( elem, "change._change", function( event ) {
+ if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
+ jQuery.event.simulate( "change", this.parentNode, event, true );
+ }
+ });
+ jQuery._data( elem, "changeBubbles", true );
+ }
+ });
+ },
+
+ handle: function( event ) {
+ var elem = event.target;
+
+ // Swallow native change events from checkbox/radio, we already triggered them above
+ if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
+ return event.handleObj.handler.apply( this, arguments );
+ }
+ },
+
+ teardown: function() {
+ jQuery.event.remove( this, "._change" );
+
+ return !rformElems.test( this.nodeName );
+ }
+ };
+}
+
+// Create "bubbling" focus and blur events
+if ( !jQuery.support.focusinBubbles ) {
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+
+ // Attach a single capturing handler while someone wants focusin/focusout
+ var attaches = 0,
+ handler = function( event ) {
+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
+ };
+
+ jQuery.event.special[ fix ] = {
+ setup: function() {
+ if ( attaches++ === 0 ) {
+ document.addEventListener( orig, handler, true );
+ }
+ },
+ teardown: function() {
+ if ( --attaches === 0 ) {
+ document.removeEventListener( orig, handler, true );
+ }
+ }
+ };
+ });
+}
+
+jQuery.fn.extend({
+
+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
+ var origFn, type;
+
+ // Types can be a map of types/handlers
+ if ( typeof types === "object" ) {
+ // ( types-Object, selector, data )
+ if ( typeof selector !== "string" ) {
+ // ( types-Object, data )
+ data = data || selector;
+ selector = undefined;
+ }
+ for ( type in types ) {
+ this.on( type, selector, data, types[ type ], one );
+ }
+ return this;
+ }
+
+ if ( data == null && fn == null ) {
+ // ( types, fn )
+ fn = selector;
+ data = selector = undefined;
+ } else if ( fn == null ) {
+ if ( typeof selector === "string" ) {
+ // ( types, selector, fn )
+ fn = data;
+ data = undefined;
+ } else {
+ // ( types, data, fn )
+ fn = data;
+ data = selector;
+ selector = undefined;
+ }
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ } else if ( !fn ) {
+ return this;
+ }
+
+ if ( one === 1 ) {
+ origFn = fn;
+ fn = function( event ) {
+ // Can use an empty set, since event contains the info
+ jQuery().off( event );
+ return origFn.apply( this, arguments );
+ };
+ // Use same guid so caller can remove using origFn
+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
+ }
+ return this.each( function() {
+ jQuery.event.add( this, types, fn, data, selector );
+ });
+ },
+ one: function( types, selector, data, fn ) {
+ return this.on( types, selector, data, fn, 1 );
+ },
+ off: function( types, selector, fn ) {
+ var handleObj, type;
+ if ( types && types.preventDefault && types.handleObj ) {
+ // ( event ) dispatched jQuery.Event
+ handleObj = types.handleObj;
+ jQuery( types.delegateTarget ).off(
+ handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
+ handleObj.selector,
+ handleObj.handler
+ );
+ return this;
+ }
+ if ( typeof types === "object" ) {
+ // ( types-object [, selector] )
+ for ( type in types ) {
+ this.off( type, selector, types[ type ] );
+ }
+ return this;
+ }
+ if ( selector === false || typeof selector === "function" ) {
+ // ( types [, fn] )
+ fn = selector;
+ selector = undefined;
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ }
+ return this.each(function() {
+ jQuery.event.remove( this, types, fn, selector );
+ });
+ },
+
+ bind: function( types, data, fn ) {
+ return this.on( types, null, data, fn );
+ },
+ unbind: function( types, fn ) {
+ return this.off( types, null, fn );
+ },
+
+ delegate: function( selector, types, data, fn ) {
+ return this.on( types, selector, data, fn );
+ },
+ undelegate: function( selector, types, fn ) {
+ // ( namespace ) or ( selector, types [, fn] )
+ return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+ triggerHandler: function( type, data ) {
+ var elem = this[0];
+ if ( elem ) {
+ return jQuery.event.trigger( type, data, elem, true );
+ }
+ },
+
+ hover: function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+ }
+});
+
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+ "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( data, fn ) {
+ return arguments.length > 0 ?
+ this.on( name, null, data, fn ) :
+ this.trigger( name );
+ };
+
+ if ( rkeyEvent.test( name ) ) {
+ jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
+ }
+
+ if ( rmouseEvent.test( name ) ) {
+ jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
+ }
+});
+/*!
+ * Sizzle CSS Selector Engine
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license
+ * http://sizzlejs.com/
+ */
+(function( window, undefined ) {
+
+var i,
+ cachedruns,
+ Expr,
+ getText,
+ isXML,
+ compile,
+ hasDuplicate,
+ outermostContext,
+
+ // Local document vars
+ setDocument,
+ document,
+ docElem,
+ documentIsXML,
+ rbuggyQSA,
+ rbuggyMatches,
+ matches,
+ contains,
+ sortOrder,
+
+ // Instance-specific data
+ expando = "sizzle" + -(new Date()),
+ preferredDoc = window.document,
+ support = {},
+ dirruns = 0,
+ done = 0,
+ classCache = createCache(),
+ tokenCache = createCache(),
+ compilerCache = createCache(),
+
+ // General-purpose constants
+ strundefined = typeof undefined,
+ MAX_NEGATIVE = 1 << 31,
+
+ // Array methods
+ arr = [],
+ pop = arr.pop,
+ push = arr.push,
+ slice = arr.slice,
+ // Use a stripped-down indexOf if we can't use a native one
+ indexOf = arr.indexOf || function( elem ) {
+ var i = 0,
+ len = this.length;
+ for ( ; i < len; i++ ) {
+ if ( this[i] === elem ) {
+ return i;
+ }
+ }
+ return -1;
+ },
+
+
+ // Regular expressions
+
+ // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
+ whitespace = "[\\x20\\t\\r\\n\\f]",
+ // http://www.w3.org/TR/css3-syntax/#characters
+ characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
+
+ // Loosely modeled on CSS identifier characters
+ // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
+ // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
+ identifier = characterEncoding.replace( "w", "w#" ),
+
+ // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
+ operators = "([*^$|!~]?=)",
+ attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
+ "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
+
+ // Prefer arguments quoted,
+ // then not containing pseudos/brackets,
+ // then attribute selectors/non-parenthetical expressions,
+ // then anything else
+ // These preferences are here to reduce the number of selectors
+ // needing tokenize in the PSEUDO preFilter
+ pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
+
+ // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
+
+ rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
+ rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
+ rpseudo = new RegExp( pseudos ),
+ ridentifier = new RegExp( "^" + identifier + "$" ),
+
+ matchExpr = {
+ "ID": new RegExp( "^#(" + characterEncoding + ")" ),
+ "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
+ "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
+ "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
+ "ATTR": new RegExp( "^" + attributes ),
+ "PSEUDO": new RegExp( "^" + pseudos ),
+ "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
+ "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
+ "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
+ // For use in libraries implementing .is()
+ // We use this for POS matching in `select`
+ "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
+ whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
+ },
+
+ rsibling = /[\x20\t\r\n\f]*[+~]/,
+
+ rnative = /\{\s*\[native code\]\s*\}/,
+
+ // Easily-parseable/retrievable ID or TAG or CLASS selectors
+ rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
+
+ rinputs = /^(?:input|select|textarea|button)$/i,
+ rheader = /^h\d$/i,
+
+ rescape = /'|\\/g,
+ rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
+
+ // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
+ runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
+ funescape = function( _, escaped ) {
+ var high = "0x" + escaped - 0x10000;
+ // NaN means non-codepoint
+ return high !== high ?
+ escaped :
+ // BMP codepoint
+ high < 0 ?
+ String.fromCharCode( high + 0x10000 ) :
+ // Supplemental Plane codepoint (surrogate pair)
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
+ };
+
+// Use a stripped-down slice if we can't use a native one
+try {
+ slice.call( docElem.childNodes, 0 )[0].nodeType;
+} catch ( e ) {
+ slice = function( i ) {
+ var elem,
+ results = [];
+ for ( ; (elem = this[i]); i++ ) {
+ results.push( elem );
+ }
+ return results;
+ };
+}
+
+/**
+ * For feature detection
+ * @param {Function} fn The function to test for native support
+ */
+function isNative( fn ) {
+ return rnative.test( fn + "" );
+}
+
+/**
+ * Create key-value caches of limited size
+ * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
+ * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
+ * deleting the oldest entry
+ */
+function createCache() {
+ var cache,
+ keys = [];
+
+ return (cache = function( key, value ) {
+ // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
+ if ( keys.push( key += " " ) > Expr.cacheLength ) {
+ // Only keep the most recent entries
+ delete cache[ keys.shift() ];
+ }
+ return (cache[ key ] = value);
+ });
+}
+
+/**
+ * Mark a function for special use by Sizzle
+ * @param {Function} fn The function to mark
+ */
+function markFunction( fn ) {
+ fn[ expando ] = true;
+ return fn;
+}
+
+/**
+ * Support testing using an element
+ * @param {Function} fn Passed the created div and expects a boolean result
+ */
+function assert( fn ) {
+ var div = document.createElement("div");
+
+ try {
+ return fn( div );
+ } catch (e) {
+ return false;
+ } finally {
+ // release memory in IE
+ div = null;
+ }
+}
+
+function Sizzle( selector, context, results, seed ) {
+ var match, elem, m, nodeType,
+ // QSA vars
+ i, groups, old, nid, newContext, newSelector;
+
+ if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
+ setDocument( context );
+ }
+
+ context = context || document;
+ results = results || [];
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
+ return [];
+ }
+
+ if ( !documentIsXML && !seed ) {
+
+ // Shortcuts
+ if ( (match = rquickExpr.exec( selector )) ) {
+ // Speed-up: Sizzle("#ID")
+ if ( (m = match[1]) ) {
+ if ( nodeType === 9 ) {
+ elem = context.getElementById( m );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE, Opera, and Webkit return items
+ // by name instead of ID
+ if ( elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ } else {
+ return results;
+ }
+ } else {
+ // Context is not a document
+ if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
+ contains( context, elem ) && elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ }
+
+ // Speed-up: Sizzle("TAG")
+ } else if ( match[2] ) {
+ push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
+ return results;
+
+ // Speed-up: Sizzle(".CLASS")
+ } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
+ push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
+ return results;
+ }
+ }
+
+ // QSA path
+ if ( support.qsa && !rbuggyQSA.test(selector) ) {
+ old = true;
+ nid = expando;
+ newContext = context;
+ newSelector = nodeType === 9 && selector;
+
+ // qSA works strangely on Element-rooted queries
+ // We can work around this by specifying an extra ID on the root
+ // and working up from there (Thanks to Andrew Dupont for the technique)
+ // IE 8 doesn't work on object elements
+ if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+ groups = tokenize( selector );
+
+ if ( (old = context.getAttribute("id")) ) {
+ nid = old.replace( rescape, "\\$&" );
+ } else {
+ context.setAttribute( "id", nid );
+ }
+ nid = "[id='" + nid + "'] ";
+
+ i = groups.length;
+ while ( i-- ) {
+ groups[i] = nid + toSelector( groups[i] );
+ }
+ newContext = rsibling.test( selector ) && context.parentNode || context;
+ newSelector = groups.join(",");
+ }
+
+ if ( newSelector ) {
+ try {
+ push.apply( results, slice.call( newContext.querySelectorAll(
+ newSelector
+ ), 0 ) );
+ return results;
+ } catch(qsaError) {
+ } finally {
+ if ( !old ) {
+ context.removeAttribute("id");
+ }
+ }
+ }
+ }
+ }
+
+ // All others
+ return select( selector.replace( rtrim, "$1" ), context, results, seed );
+}
+
+/**
+ * Detect xml
+ * @param {Element|Object} elem An element or a document
+ */
+isXML = Sizzle.isXML = function( elem ) {
+ // documentElement is verified for cases where it doesn't yet exist
+ // (such as loading iframes in IE - #4833)
+ var documentElement = elem && (elem.ownerDocument || elem).documentElement;
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+/**
+ * Sets document-related variables once based on the current document
+ * @param {Element|Object} [doc] An element or document object to use to set the document
+ * @returns {Object} Returns the current document
+ */
+setDocument = Sizzle.setDocument = function( node ) {
+ var doc = node ? node.ownerDocument || node : preferredDoc;
+
+ // If no document and documentElement is available, return
+ if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
+ return document;
+ }
+
+ // Set our document
+ document = doc;
+ docElem = doc.documentElement;
+
+ // Support tests
+ documentIsXML = isXML( doc );
+
+ // Check if getElementsByTagName("*") returns only elements
+ support.tagNameNoComments = assert(function( div ) {
+ div.appendChild( doc.createComment("") );
+ return !div.getElementsByTagName("*").length;
+ });
+
+ // Check if attributes should be retrieved by attribute nodes
+ support.attributes = assert(function( div ) {
+ div.innerHTML = "<select></select>";
+ var type = typeof div.lastChild.getAttribute("multiple");
+ // IE8 returns a string for some attributes even when not present
+ return type !== "boolean" && type !== "string";
+ });
+
+ // Check if getElementsByClassName can be trusted
+ support.getByClassName = assert(function( div ) {
+ // Opera can't find a second classname (in 9.6)
+ div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
+ if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
+ return false;
+ }
+
+ // Safari 3.2 caches class attributes and doesn't catch changes
+ div.lastChild.className = "e";
+ return div.getElementsByClassName("e").length === 2;
+ });
+
+ // Check if getElementById returns elements by name
+ // Check if getElementsByName privileges form controls or returns elements by ID
+ support.getByName = assert(function( div ) {
+ // Inject content
+ div.id = expando + 0;
+ div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
+ docElem.insertBefore( div, docElem.firstChild );
+
+ // Test
+ var pass = doc.getElementsByName &&
+ // buggy browsers will return fewer than the correct 2
+ doc.getElementsByName( expando ).length === 2 +
+ // buggy browsers will return more than the correct 0
+ doc.getElementsByName( expando + 0 ).length;
+ support.getIdNotName = !doc.getElementById( expando );
+
+ // Cleanup
+ docElem.removeChild( div );
+
+ return pass;
+ });
+
+ // IE6/7 return modified attributes
+ Expr.attrHandle = assert(function( div ) {
+ div.innerHTML = "<a href='#'></a>";
+ return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
+ div.firstChild.getAttribute("href") === "#";
+ }) ?
+ {} :
+ {
+ "href": function( elem ) {
+ return elem.getAttribute( "href", 2 );
+ },
+ "type": function( elem ) {
+ return elem.getAttribute("type");
+ }
+ };
+
+ // ID find and filter
+ if ( support.getIdNotName ) {
+ Expr.find["ID"] = function( id, context ) {
+ if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
+ var m = context.getElementById( id );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [m] : [];
+ }
+ };
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ return elem.getAttribute("id") === attrId;
+ };
+ };
+ } else {
+ Expr.find["ID"] = function( id, context ) {
+ if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
+ var m = context.getElementById( id );
+
+ return m ?
+ m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
+ [m] :
+ undefined :
+ [];
+ }
+ };
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
+ return node && node.value === attrId;
+ };
+ };
+ }
+
+ // Tag
+ Expr.find["TAG"] = support.tagNameNoComments ?
+ function( tag, context ) {
+ if ( typeof context.getElementsByTagName !== strundefined ) {
+ return context.getElementsByTagName( tag );
+ }
+ } :
+ function( tag, context ) {
+ var elem,
+ tmp = [],
+ i = 0,
+ results = context.getElementsByTagName( tag );
+
+ // Filter out possible comments
+ if ( tag === "*" ) {
+ for ( ; (elem = results[i]); i++ ) {
+ if ( elem.nodeType === 1 ) {
+ tmp.push( elem );
+ }
+ }
+
+ return tmp;
+ }
+ return results;
+ };
+
+ // Name
+ Expr.find["NAME"] = support.getByName && function( tag, context ) {
+ if ( typeof context.getElementsByName !== strundefined ) {
+ return context.getElementsByName( name );
+ }
+ };
+
+ // Class
+ Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
+ if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
+ return context.getElementsByClassName( className );
+ }
+ };
+
+ // QSA and matchesSelector support
+
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
+ rbuggyMatches = [];
+
+ // qSa(:focus) reports false when true (Chrome 21),
+ // no need to also add to buggyMatches since matches checks buggyQSA
+ // A support test would require too much code (would include document ready)
+ rbuggyQSA = [ ":focus" ];
+
+ if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
+ // Build QSA regex
+ // Regex strategy adopted from Diego Perini
+ assert(function( div ) {
+ // Select is set to empty string on purpose
+ // This is to test IE's treatment of not explictly
+ // setting a boolean content attribute,
+ // since its presence should be enough
+ // http://bugs.jquery.com/ticket/12359
+ div.innerHTML = "<select><option selected=''></option></select>";
+
+ // IE8 - Some boolean attributes are not treated correctly
+ if ( !div.querySelectorAll("[selected]").length ) {
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
+ }
+
+ // Webkit/Opera - :checked should return selected option elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":checked").length ) {
+ rbuggyQSA.push(":checked");
+ }
+ });
+
+ assert(function( div ) {
+
+ // Opera 10-12/IE8 - ^= $= *= and empty values
+ // Should not select anything
+ div.innerHTML = "<input type='hidden' i=''/>";
+ if ( div.querySelectorAll("[i^='']").length ) {
+ rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
+ }
+
+ // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":enabled").length ) {
+ rbuggyQSA.push( ":enabled", ":disabled" );
+ }
+
+ // Opera 10-11 does not throw on post-comma invalid pseudos
+ div.querySelectorAll("*,:x");
+ rbuggyQSA.push(",.*:");
+ });
+ }
+
+ if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
+ docElem.mozMatchesSelector ||
+ docElem.webkitMatchesSelector ||
+ docElem.oMatchesSelector ||
+ docElem.msMatchesSelector) )) ) {
+
+ assert(function( div ) {
+ // Check to see if it's possible to do matchesSelector
+ // on a disconnected node (IE 9)
+ support.disconnectedMatch = matches.call( div, "div" );
+
+ // This should fail with an exception
+ // Gecko does not error, returns false instead
+ matches.call( div, "[s!='']:x" );
+ rbuggyMatches.push( "!=", pseudos );
+ });
+ }
+
+ rbuggyQSA = new RegExp( rbuggyQSA.join("|") );
+ rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
+
+ // Element contains another
+ // Purposefully does not implement inclusive descendent
+ // As in, an element does not contain itself
+ contains = isNative(docElem.contains) || docElem.compareDocumentPosition ?
+ function( a, b ) {
+ var adown = a.nodeType === 9 ? a.documentElement : a,
+ bup = b && b.parentNode;
+ return a === bup || !!( bup && bup.nodeType === 1 && (
+ adown.contains ?
+ adown.contains( bup ) :
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
+ ));
+ } :
+ function( a, b ) {
+ if ( b ) {
+ while ( (b = b.parentNode) ) {
+ if ( b === a ) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ // Document order sorting
+ sortOrder = docElem.compareDocumentPosition ?
+ function( a, b ) {
+ var compare;
+
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
+ if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
+ if ( a === doc || contains( preferredDoc, a ) ) {
+ return -1;
+ }
+ if ( b === doc || contains( preferredDoc, b ) ) {
+ return 1;
+ }
+ return 0;
+ }
+ return compare & 4 ? -1 : 1;
+ }
+
+ return a.compareDocumentPosition ? -1 : 1;
+ } :
+ function( a, b ) {
+ var cur,
+ i = 0,
+ aup = a.parentNode,
+ bup = b.parentNode,
+ ap = [ a ],
+ bp = [ b ];
+
+ // The nodes are identical, we can exit early
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+
+ // Fallback to using sourceIndex (in IE) if it's available on both nodes
+ } else if ( a.sourceIndex && b.sourceIndex ) {
+ return ( ~b.sourceIndex || MAX_NEGATIVE ) - ( contains( preferredDoc, a ) && ~a.sourceIndex || MAX_NEGATIVE );
+
+ // Parentless nodes are either documents or disconnected
+ } else if ( !aup || !bup ) {
+ return a === doc ? -1 :
+ b === doc ? 1 :
+ aup ? -1 :
+ bup ? 1 :
+ 0;
+
+ // If the nodes are siblings, we can do a quick check
+ } else if ( aup === bup ) {
+ return siblingCheck( a, b );
+ }
+
+ // Otherwise we need full lists of their ancestors for comparison
+ cur = a;
+ while ( (cur = cur.parentNode) ) {
+ ap.unshift( cur );
+ }
+ cur = b;
+ while ( (cur = cur.parentNode) ) {
+ bp.unshift( cur );
+ }
+
+ // Walk down the tree looking for a discrepancy
+ while ( ap[i] === bp[i] ) {
+ i++;
+ }
+
+ return i ?
+ // Do a sibling check if the nodes have a common ancestor
+ siblingCheck( ap[i], bp[i] ) :
+
+ // Otherwise nodes in our document sort first
+ ap[i] === preferredDoc ? -1 :
+ bp[i] === preferredDoc ? 1 :
+ 0;
+ };
+
+ // Always assume the presence of duplicates if sort doesn't
+ // pass them to our comparison function (as in Google Chrome).
+ hasDuplicate = false;
+ [0, 0].sort( sortOrder );
+ support.detectDuplicates = hasDuplicate;
+
+ return document;
+};
+
+Sizzle.matches = function( expr, elements ) {
+ return Sizzle( expr, null, null, elements );
+};
+
+Sizzle.matchesSelector = function( elem, expr ) {
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ // Make sure that attribute selectors are quoted
+ expr = expr.replace( rattributeQuotes, "='$1']" );
+
+ // rbuggyQSA always contains :focus, so no need for an existence check
+ if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {
+ try {
+ var ret = matches.call( elem, expr );
+
+ // IE 9's matchesSelector returns false on disconnected nodes
+ if ( ret || support.disconnectedMatch ||
+ // As well, disconnected nodes are said to be in a document
+ // fragment in IE 9
+ elem.document && elem.document.nodeType !== 11 ) {
+ return ret;
+ }
+ } catch(e) {}
+ }
+
+ return Sizzle( expr, document, null, [elem] ).length > 0;
+};
+
+Sizzle.contains = function( context, elem ) {
+ // Set document vars if needed
+ if ( ( context.ownerDocument || context ) !== document ) {
+ setDocument( context );
+ }
+ return contains( context, elem );
+};
+
+Sizzle.attr = function( elem, name ) {
+ var val;
+
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ if ( !documentIsXML ) {
+ name = name.toLowerCase();
+ }
+ if ( (val = Expr.attrHandle[ name ]) ) {
+ return val( elem );
+ }
+ if ( documentIsXML || support.attributes ) {
+ return elem.getAttribute( name );
+ }
+ return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ?
+ name :
+ val && val.specified ? val.value : null;
+};
+
+Sizzle.error = function( msg ) {
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+// Document sorting and removing duplicates
+Sizzle.uniqueSort = function( results ) {
+ var elem,
+ duplicates = [],
+ i = 1,
+ j = 0;
+
+ // Unless we *know* we can detect duplicates, assume their presence
+ hasDuplicate = !support.detectDuplicates;
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ for ( ; (elem = results[i]); i++ ) {
+ if ( elem === results[ i - 1 ] ) {
+ j = duplicates.push( i );
+ }
+ }
+ while ( j-- ) {
+ results.splice( duplicates[ j ], 1 );
+ }
+ }
+
+ return results;
+};
+
+function siblingCheck( a, b ) {
+ var cur = a && b && a.nextSibling;
+
+ for ( ; cur; cur = cur.nextSibling ) {
+ if ( cur === b ) {
+ return -1;
+ }
+ }
+
+ return a ? 1 : -1;
+}
+
+// Returns a function to use in pseudos for input types
+function createInputPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === type;
+ };
+}
+
+// Returns a function to use in pseudos for buttons
+function createButtonPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && elem.type === type;
+ };
+}
+
+// Returns a function to use in pseudos for positionals
+function createPositionalPseudo( fn ) {
+ return markFunction(function( argument ) {
+ argument = +argument;
+ return markFunction(function( seed, matches ) {
+ var j,
+ matchIndexes = fn( [], seed.length, argument ),
+ i = matchIndexes.length;
+
+ // Match elements found at the specified indexes
+ while ( i-- ) {
+ if ( seed[ (j = matchIndexes[i]) ] ) {
+ seed[j] = !(matches[j] = seed[j]);
+ }
+ }
+ });
+ });
+}
+
+/**
+ * Utility function for retrieving the text value of an array of DOM nodes
+ * @param {Array|Element} elem
+ */
+getText = Sizzle.getText = function( elem ) {
+ var node,
+ ret = "",
+ i = 0,
+ nodeType = elem.nodeType;
+
+ if ( !nodeType ) {
+ // If no nodeType, this is expected to be an array
+ for ( ; (node = elem[i]); i++ ) {
+ // Do not traverse comment nodes
+ ret += getText( node );
+ }
+ } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+ // Use textContent for elements
+ // innerText usage removed for consistency of new lines (see #11153)
+ if ( typeof elem.textContent === "string" ) {
+ return elem.textContent;
+ } else {
+ // Traverse its children
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ ret += getText( elem );
+ }
+ }
+ } else if ( nodeType === 3 || nodeType === 4 ) {
+ return elem.nodeValue;
+ }
+ // Do not include comment or processing instruction nodes
+
+ return ret;
+};
+
+Expr = Sizzle.selectors = {
+
+ // Can be adjusted by the user
+ cacheLength: 50,
+
+ createPseudo: markFunction,
+
+ match: matchExpr,
+
+ find: {},
+
+ relative: {
+ ">": { dir: "parentNode", first: true },
+ " ": { dir: "parentNode" },
+ "+": { dir: "previousSibling", first: true },
+ "~": { dir: "previousSibling" }
+ },
+
+ preFilter: {
+ "ATTR": function( match ) {
+ match[1] = match[1].replace( runescape, funescape );
+
+ // Move the given value to match[3] whether quoted or unquoted
+ match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
+
+ if ( match[2] === "~=" ) {
+ match[3] = " " + match[3] + " ";
+ }
+
+ return match.slice( 0, 4 );
+ },
+
+ "CHILD": function( match ) {
+ /* matches from matchExpr["CHILD"]
+ 1 type (only|nth|...)
+ 2 what (child|of-type)
+ 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
+ 4 xn-component of xn+y argument ([+-]?\d*n|)
+ 5 sign of xn-component
+ 6 x of xn-component
+ 7 sign of y-component
+ 8 y of y-component
+ */
+ match[1] = match[1].toLowerCase();
+
+ if ( match[1].slice( 0, 3 ) === "nth" ) {
+ // nth-* requires argument
+ if ( !match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ // numeric x and y parameters for Expr.filter.CHILD
+ // remember that false/true cast respectively to 0/1
+ match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
+ match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
+
+ // other types prohibit arguments
+ } else if ( match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ return match;
+ },
+
+ "PSEUDO": function( match ) {
+ var excess,
+ unquoted = !match[5] && match[2];
+
+ if ( matchExpr["CHILD"].test( match[0] ) ) {
+ return null;
+ }
+
+ // Accept quoted arguments as-is
+ if ( match[4] ) {
+ match[2] = match[4];
+
+ // Strip excess characters from unquoted arguments
+ } else if ( unquoted && rpseudo.test( unquoted ) &&
+ // Get excess from tokenize (recursively)
+ (excess = tokenize( unquoted, true )) &&
+ // advance to the next closing parenthesis
+ (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
+
+ // excess is a negative index
+ match[0] = match[0].slice( 0, excess );
+ match[2] = unquoted.slice( 0, excess );
+ }
+
+ // Return only captures needed by the pseudo filter method (type and argument)
+ return match.slice( 0, 3 );
+ }
+ },
+
+ filter: {
+
+ "TAG": function( nodeName ) {
+ if ( nodeName === "*" ) {
+ return function() { return true; };
+ }
+
+ nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
+ return function( elem ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
+ };
+ },
+
+ "CLASS": function( className ) {
+ var pattern = classCache[ className + " " ];
+
+ return pattern ||
+ (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
+ classCache( className, function( elem ) {
+ return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
+ });
+ },
+
+ "ATTR": function( name, operator, check ) {
+ return function( elem ) {
+ var result = Sizzle.attr( elem, name );
+
+ if ( result == null ) {
+ return operator === "!=";
+ }
+ if ( !operator ) {
+ return true;
+ }
+
+ result += "";
+
+ return operator === "=" ? result === check :
+ operator === "!=" ? result !== check :
+ operator === "^=" ? check && result.indexOf( check ) === 0 :
+ operator === "*=" ? check && result.indexOf( check ) > -1 :
+ operator === "$=" ? check && result.substr( result.length - check.length ) === check :
+ operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
+ operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" :
+ false;
+ };
+ },
+
+ "CHILD": function( type, what, argument, first, last ) {
+ var simple = type.slice( 0, 3 ) !== "nth",
+ forward = type.slice( -4 ) !== "last",
+ ofType = what === "of-type";
+
+ return first === 1 && last === 0 ?
+
+ // Shortcut for :nth-*(n)
+ function( elem ) {
+ return !!elem.parentNode;
+ } :
+
+ function( elem, context, xml ) {
+ var cache, outerCache, node, diff, nodeIndex, start,
+ dir = simple !== forward ? "nextSibling" : "previousSibling",
+ parent = elem.parentNode,
+ name = ofType && elem.nodeName.toLowerCase(),
+ useCache = !xml && !ofType;
+
+ if ( parent ) {
+
+ // :(first|last|only)-(child|of-type)
+ if ( simple ) {
+ while ( dir ) {
+ node = elem;
+ while ( (node = node[ dir ]) ) {
+ if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
+ return false;
+ }
+ }
+ // Reverse direction for :only-* (if we haven't yet done so)
+ start = dir = type === "only" && !start && "nextSibling";
+ }
+ return true;
+ }
+
+ start = [ forward ? parent.firstChild : parent.lastChild ];
+
+ // non-xml :nth-child(...) stores cache data on `parent`
+ if ( forward && useCache ) {
+ // Seek `elem` from a previously-cached index
+ outerCache = parent[ expando ] || (parent[ expando ] = {});
+ cache = outerCache[ type ] || [];
+ nodeIndex = cache[0] === dirruns && cache[1];
+ diff = cache[0] === dirruns && cache[2];
+ node = nodeIndex && parent.childNodes[ nodeIndex ];
+
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+
+ // Fallback to seeking `elem` from the start
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ // When found, cache indexes on `parent` and break
+ if ( node.nodeType === 1 && ++diff && node === elem ) {
+ outerCache[ type ] = [ dirruns, nodeIndex, diff ];
+ break;
+ }
+ }
+
+ // Use previously-cached element index if available
+ } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
+ diff = cache[1];
+
+ // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
+ } else {
+ // Use the same loop as above to seek `elem` from the start
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
+ // Cache the index of each encountered element
+ if ( useCache ) {
+ (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
+ }
+
+ if ( node === elem ) {
+ break;
+ }
+ }
+ }
+ }
+
+ // Incorporate the offset, then check against cycle size
+ diff -= last;
+ return diff === first || ( diff % first === 0 && diff / first >= 0 );
+ }
+ };
+ },
+
+ "PSEUDO": function( pseudo, argument ) {
+ // pseudo-class names are case-insensitive
+ // http://www.w3.org/TR/selectors/#pseudo-classes
+ // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
+ // Remember that setFilters inherits from pseudos
+ var args,
+ fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
+ Sizzle.error( "unsupported pseudo: " + pseudo );
+
+ // The user may use createPseudo to indicate that
+ // arguments are needed to create the filter function
+ // just as Sizzle does
+ if ( fn[ expando ] ) {
+ return fn( argument );
+ }
+
+ // But maintain support for old signatures
+ if ( fn.length > 1 ) {
+ args = [ pseudo, pseudo, "", argument ];
+ return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
+ markFunction(function( seed, matches ) {
+ var idx,
+ matched = fn( seed, argument ),
+ i = matched.length;
+ while ( i-- ) {
+ idx = indexOf.call( seed, matched[i] );
+ seed[ idx ] = !( matches[ idx ] = matched[i] );
+ }
+ }) :
+ function( elem ) {
+ return fn( elem, 0, args );
+ };
+ }
+
+ return fn;
+ }
+ },
+
+ pseudos: {
+ // Potentially complex pseudos
+ "not": markFunction(function( selector ) {
+ // Trim the selector passed to compile
+ // to avoid treating leading and trailing
+ // spaces as combinators
+ var input = [],
+ results = [],
+ matcher = compile( selector.replace( rtrim, "$1" ) );
+
+ return matcher[ expando ] ?
+ markFunction(function( seed, matches, context, xml ) {
+ var elem,
+ unmatched = matcher( seed, null, xml, [] ),
+ i = seed.length;
+
+ // Match elements unmatched by `matcher`
+ while ( i-- ) {
+ if ( (elem = unmatched[i]) ) {
+ seed[i] = !(matches[i] = elem);
+ }
+ }
+ }) :
+ function( elem, context, xml ) {
+ input[0] = elem;
+ matcher( input, null, xml, results );
+ return !results.pop();
+ };
+ }),
+
+ "has": markFunction(function( selector ) {
+ return function( elem ) {
+ return Sizzle( selector, elem ).length > 0;
+ };
+ }),
+
+ "contains": markFunction(function( text ) {
+ return function( elem ) {
+ return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
+ };
+ }),
+
+ // "Whether an element is represented by a :lang() selector
+ // is based solely on the element's language value
+ // being equal to the identifier C,
+ // or beginning with the identifier C immediately followed by "-".
+ // The matching of C against the element's language value is performed case-insensitively.
+ // The identifier C does not have to be a valid language name."
+ // http://www.w3.org/TR/selectors/#lang-pseudo
+ "lang": markFunction( function( lang ) {
+ // lang value must be a valid identifider
+ if ( !ridentifier.test(lang || "") ) {
+ Sizzle.error( "unsupported lang: " + lang );
+ }
+ lang = lang.replace( runescape, funescape ).toLowerCase();
+ return function( elem ) {
+ var elemLang;
+ do {
+ if ( (elemLang = documentIsXML ?
+ elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
+ elem.lang) ) {
+
+ elemLang = elemLang.toLowerCase();
+ return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
+ }
+ } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
+ return false;
+ };
+ }),
+
+ // Miscellaneous
+ "target": function( elem ) {
+ var hash = window.location && window.location.hash;
+ return hash && hash.slice( 1 ) === elem.id;
+ },
+
+ "root": function( elem ) {
+ return elem === docElem;
+ },
+
+ "focus": function( elem ) {
+ return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
+ },
+
+ // Boolean properties
+ "enabled": function( elem ) {
+ return elem.disabled === false;
+ },
+
+ "disabled": function( elem ) {
+ return elem.disabled === true;
+ },
+
+ "checked": function( elem ) {
+ // In CSS3, :checked should return both checked and selected elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ var nodeName = elem.nodeName.toLowerCase();
+ return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
+ },
+
+ "selected": function( elem ) {
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ if ( elem.parentNode ) {
+ elem.parentNode.selectedIndex;
+ }
+
+ return elem.selected === true;
+ },
+
+ // Contents
+ "empty": function( elem ) {
+ // http://www.w3.org/TR/selectors/#empty-pseudo
+ // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
+ // not comment, processing instructions, or others
+ // Thanks to Diego Perini for the nodeName shortcut
+ // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ "parent": function( elem ) {
+ return !Expr.pseudos["empty"]( elem );
+ },
+
+ // Element/input types
+ "header": function( elem ) {
+ return rheader.test( elem.nodeName );
+ },
+
+ "input": function( elem ) {
+ return rinputs.test( elem.nodeName );
+ },
+
+ "button": function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === "button" || name === "button";
+ },
+
+ "text": function( elem ) {
+ var attr;
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
+ // use getAttribute instead to test this case
+ return elem.nodeName.toLowerCase() === "input" &&
+ elem.type === "text" &&
+ ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
+ },
+
+ // Position-in-collection
+ "first": createPositionalPseudo(function() {
+ return [ 0 ];
+ }),
+
+ "last": createPositionalPseudo(function( matchIndexes, length ) {
+ return [ length - 1 ];
+ }),
+
+ "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ return [ argument < 0 ? argument + length : argument ];
+ }),
+
+ "even": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 0;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "odd": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 1;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; --i >= 0; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; ++i < length; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ })
+ }
+};
+
+// Add button/input type pseudos
+for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
+ Expr.pseudos[ i ] = createInputPseudo( i );
+}
+for ( i in { submit: true, reset: true } ) {
+ Expr.pseudos[ i ] = createButtonPseudo( i );
+}
+
+function tokenize( selector, parseOnly ) {
+ var matched, match, tokens, type,
+ soFar, groups, preFilters,
+ cached = tokenCache[ selector + " " ];
+
+ if ( cached ) {
+ return parseOnly ? 0 : cached.slice( 0 );
+ }
+
+ soFar = selector;
+ groups = [];
+ preFilters = Expr.preFilter;
+
+ while ( soFar ) {
+
+ // Comma and first run
+ if ( !matched || (match = rcomma.exec( soFar )) ) {
+ if ( match ) {
+ // Don't consume trailing commas as valid
+ soFar = soFar.slice( match[0].length ) || soFar;
+ }
+ groups.push( tokens = [] );
+ }
+
+ matched = false;
+
+ // Combinators
+ if ( (match = rcombinators.exec( soFar )) ) {
+ matched = match.shift();
+ tokens.push( {
+ value: matched,
+ // Cast descendant combinators to space
+ type: match[0].replace( rtrim, " " )
+ } );
+ soFar = soFar.slice( matched.length );
+ }
+
+ // Filters
+ for ( type in Expr.filter ) {
+ if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
+ (match = preFilters[ type ]( match ))) ) {
+ matched = match.shift();
+ tokens.push( {
+ value: matched,
+ type: type,
+ matches: match
+ } );
+ soFar = soFar.slice( matched.length );
+ }
+ }
+
+ if ( !matched ) {
+ break;
+ }
+ }
+
+ // Return the length of the invalid excess
+ // if we're just parsing
+ // Otherwise, throw an error or return tokens
+ return parseOnly ?
+ soFar.length :
+ soFar ?
+ Sizzle.error( selector ) :
+ // Cache the tokens
+ tokenCache( selector, groups ).slice( 0 );
+}
+
+function toSelector( tokens ) {
+ var i = 0,
+ len = tokens.length,
+ selector = "";
+ for ( ; i < len; i++ ) {
+ selector += tokens[i].value;
+ }
+ return selector;
+}
+
+function addCombinator( matcher, combinator, base ) {
+ var dir = combinator.dir,
+ checkNonElements = base && combinator.dir === "parentNode",
+ doneName = done++;
+
+ return combinator.first ?
+ // Check against closest ancestor/preceding element
+ function( elem, context, xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ return matcher( elem, context, xml );
+ }
+ }
+ } :
+
+ // Check against all ancestor/preceding elements
+ function( elem, context, xml ) {
+ var data, cache, outerCache,
+ dirkey = dirruns + " " + doneName;
+
+ // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
+ if ( xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ if ( matcher( elem, context, xml ) ) {
+ return true;
+ }
+ }
+ }
+ } else {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ outerCache = elem[ expando ] || (elem[ expando ] = {});
+ if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
+ if ( (data = cache[1]) === true || data === cachedruns ) {
+ return data === true;
+ }
+ } else {
+ cache = outerCache[ dir ] = [ dirkey ];
+ cache[1] = matcher( elem, context, xml ) || cachedruns;
+ if ( cache[1] === true ) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ };
+}
+
+function elementMatcher( matchers ) {
+ return matchers.length > 1 ?
+ function( elem, context, xml ) {
+ var i = matchers.length;
+ while ( i-- ) {
+ if ( !matchers[i]( elem, context, xml ) ) {
+ return false;
+ }
+ }
+ return true;
+ } :
+ matchers[0];
+}
+
+function condense( unmatched, map, filter, context, xml ) {
+ var elem,
+ newUnmatched = [],
+ i = 0,
+ len = unmatched.length,
+ mapped = map != null;
+
+ for ( ; i < len; i++ ) {
+ if ( (elem = unmatched[i]) ) {
+ if ( !filter || filter( elem, context, xml ) ) {
+ newUnmatched.push( elem );
+ if ( mapped ) {
+ map.push( i );
+ }
+ }
+ }
+ }
+
+ return newUnmatched;
+}
+
+function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
+ if ( postFilter && !postFilter[ expando ] ) {
+ postFilter = setMatcher( postFilter );
+ }
+ if ( postFinder && !postFinder[ expando ] ) {
+ postFinder = setMatcher( postFinder, postSelector );
+ }
+ return markFunction(function( seed, results, context, xml ) {
+ var temp, i, elem,
+ preMap = [],
+ postMap = [],
+ preexisting = results.length,
+
+ // Get initial elements from seed or context
+ elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
+
+ // Prefilter to get matcher input, preserving a map for seed-results synchronization
+ matcherIn = preFilter && ( seed || !selector ) ?
+ condense( elems, preMap, preFilter, context, xml ) :
+ elems,
+
+ matcherOut = matcher ?
+ // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
+ postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
+
+ // ...intermediate processing is necessary
+ [] :
+
+ // ...otherwise use results directly
+ results :
+ matcherIn;
+
+ // Find primary matches
+ if ( matcher ) {
+ matcher( matcherIn, matcherOut, context, xml );
+ }
+
+ // Apply postFilter
+ if ( postFilter ) {
+ temp = condense( matcherOut, postMap );
+ postFilter( temp, [], context, xml );
+
+ // Un-match failing elements by moving them back to matcherIn
+ i = temp.length;
+ while ( i-- ) {
+ if ( (elem = temp[i]) ) {
+ matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
+ }
+ }
+ }
+
+ if ( seed ) {
+ if ( postFinder || preFilter ) {
+ if ( postFinder ) {
+ // Get the final matcherOut by condensing this intermediate into postFinder contexts
+ temp = [];
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) ) {
+ // Restore matcherIn since elem is not yet a final match
+ temp.push( (matcherIn[i] = elem) );
+ }
+ }
+ postFinder( null, (matcherOut = []), temp, xml );
+ }
+
+ // Move matched elements from seed to results to keep them synchronized
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) &&
+ (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
+
+ seed[temp] = !(results[temp] = elem);
+ }
+ }
+ }
+
+ // Add elements to results, through postFinder if defined
+ } else {
+ matcherOut = condense(
+ matcherOut === results ?
+ matcherOut.splice( preexisting, matcherOut.length ) :
+ matcherOut
+ );
+ if ( postFinder ) {
+ postFinder( null, results, matcherOut, xml );
+ } else {
+ push.apply( results, matcherOut );
+ }
+ }
+ });
+}
+
+function matcherFromTokens( tokens ) {
+ var checkContext, matcher, j,
+ len = tokens.length,
+ leadingRelative = Expr.relative[ tokens[0].type ],
+ implicitRelative = leadingRelative || Expr.relative[" "],
+ i = leadingRelative ? 1 : 0,
+
+ // The foundational matcher ensures that elements are reachable from top-level context(s)
+ matchContext = addCombinator( function( elem ) {
+ return elem === checkContext;
+ }, implicitRelative, true ),
+ matchAnyContext = addCombinator( function( elem ) {
+ return indexOf.call( checkContext, elem ) > -1;
+ }, implicitRelative, true ),
+ matchers = [ function( elem, context, xml ) {
+ return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
+ (checkContext = context).nodeType ?
+ matchContext( elem, context, xml ) :
+ matchAnyContext( elem, context, xml ) );
+ } ];
+
+ for ( ; i < len; i++ ) {
+ if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
+ matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
+ } else {
+ matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
+
+ // Return special upon seeing a positional matcher
+ if ( matcher[ expando ] ) {
+ // Find the next relative operator (if any) for proper handling
+ j = ++i;
+ for ( ; j < len; j++ ) {
+ if ( Expr.relative[ tokens[j].type ] ) {
+ break;
+ }
+ }
+ return setMatcher(
+ i > 1 && elementMatcher( matchers ),
+ i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),
+ matcher,
+ i < j && matcherFromTokens( tokens.slice( i, j ) ),
+ j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
+ j < len && toSelector( tokens )
+ );
+ }
+ matchers.push( matcher );
+ }
+ }
+
+ return elementMatcher( matchers );
+}
+
+function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
+ // A counter to specify which element is currently being matched
+ var matcherCachedRuns = 0,
+ bySet = setMatchers.length > 0,
+ byElement = elementMatchers.length > 0,
+ superMatcher = function( seed, context, xml, results, expandContext ) {
+ var elem, j, matcher,
+ setMatched = [],
+ matchedCount = 0,
+ i = "0",
+ unmatched = seed && [],
+ outermost = expandContext != null,
+ contextBackup = outermostContext,
+ // We must always have either seed elements or context
+ elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
+ // Nested matchers should use non-integer dirruns
+ dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);
+
+ if ( outermost ) {
+ outermostContext = context !== document && context;
+ cachedruns = matcherCachedRuns;
+ }
+
+ // Add elements passing elementMatchers directly to results
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ if ( byElement && elem ) {
+ for ( j = 0; (matcher = elementMatchers[j]); j++ ) {
+ if ( matcher( elem, context, xml ) ) {
+ results.push( elem );
+ break;
+ }
+ }
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ cachedruns = ++matcherCachedRuns;
+ }
+ }
+
+ // Track unmatched elements for set filters
+ if ( bySet ) {
+ // They will have gone through all possible matchers
+ if ( (elem = !matcher && elem) ) {
+ matchedCount--;
+ }
+
+ // Lengthen the array for every element, matched or not
+ if ( seed ) {
+ unmatched.push( elem );
+ }
+ }
+ }
+
+ // Apply set filters to unmatched elements
+ // `i` starts as a string, so matchedCount would equal "00" if there are no elements
+ matchedCount += i;
+ if ( bySet && i !== matchedCount ) {
+ for ( j = 0; (matcher = setMatchers[j]); j++ ) {
+ matcher( unmatched, setMatched, context, xml );
+ }
+
+ if ( seed ) {
+ // Reintegrate element matches to eliminate the need for sorting
+ if ( matchedCount > 0 ) {
+ while ( i-- ) {
+ if ( !(unmatched[i] || setMatched[i]) ) {
+ setMatched[i] = pop.call( results );
+ }
+ }
+ }
+
+ // Discard index placeholder values to get only actual matches
+ setMatched = condense( setMatched );
+ }
+
+ // Add matches to results
+ push.apply( results, setMatched );
+
+ // Seedless set matches succeeding multiple successful matchers stipulate sorting
+ if ( outermost && !seed && setMatched.length > 0 &&
+ ( matchedCount + setMatchers.length ) > 1 ) {
+
+ Sizzle.uniqueSort( results );
+ }
+ }
+
+ // Override manipulation of globals by nested matchers
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ outermostContext = contextBackup;
+ }
+
+ return unmatched;
+ };
+
+ return bySet ?
+ markFunction( superMatcher ) :
+ superMatcher;
+}
+
+compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
+ var i,
+ setMatchers = [],
+ elementMatchers = [],
+ cached = compilerCache[ selector + " " ];
+
+ if ( !cached ) {
+ // Generate a function of recursive functions that can be used to check each element
+ if ( !group ) {
+ group = tokenize( selector );
+ }
+ i = group.length;
+ while ( i-- ) {
+ cached = matcherFromTokens( group[i] );
+ if ( cached[ expando ] ) {
+ setMatchers.push( cached );
+ } else {
+ elementMatchers.push( cached );
+ }
+ }
+
+ // Cache the compiled function
+ cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
+ }
+ return cached;
+};
+
+function multipleContexts( selector, contexts, results ) {
+ var i = 0,
+ len = contexts.length;
+ for ( ; i < len; i++ ) {
+ Sizzle( selector, contexts[i], results );
+ }
+ return results;
+}
+
+function select( selector, context, results, seed ) {
+ var i, tokens, token, type, find,
+ match = tokenize( selector );
+
+ if ( !seed ) {
+ // Try to minimize operations if there is only one group
+ if ( match.length === 1 ) {
+
+ // Take a shortcut and set the context if the root selector is an ID
+ tokens = match[0] = match[0].slice( 0 );
+ if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
+ context.nodeType === 9 && !documentIsXML &&
+ Expr.relative[ tokens[1].type ] ) {
+
+ context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
+ if ( !context ) {
+ return results;
+ }
+
+ selector = selector.slice( tokens.shift().value.length );
+ }
+
+ // Fetch a seed set for right-to-left matching
+ for ( i = matchExpr["needsContext"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) {
+ token = tokens[i];
+
+ // Abort if we hit a combinator
+ if ( Expr.relative[ (type = token.type) ] ) {
+ break;
+ }
+ if ( (find = Expr.find[ type ]) ) {
+ // Search, expanding context for leading sibling combinators
+ if ( (seed = find(
+ token.matches[0].replace( runescape, funescape ),
+ rsibling.test( tokens[0].type ) && context.parentNode || context
+ )) ) {
+
+ // If seed is empty or no tokens remain, we can return early
+ tokens.splice( i, 1 );
+ selector = seed.length && toSelector( tokens );
+ if ( !selector ) {
+ push.apply( results, slice.call( seed, 0 ) );
+ return results;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Compile and execute a filtering function
+ // Provide `match` to avoid retokenization if we modified the selector above
+ compile( selector, match )(
+ seed,
+ context,
+ documentIsXML,
+ results,
+ rsibling.test( selector )
+ );
+ return results;
+}
+
+// Deprecated
+Expr.pseudos["nth"] = Expr.pseudos["eq"];
+
+// Easy API for creating new setFilters
+function setFilters() {}
+Expr.filters = setFilters.prototype = Expr.pseudos;
+Expr.setFilters = new setFilters();
+
+// Initialize with the default document
+setDocument();
+
+// Override sizzle attribute retrieval
+Sizzle.attr = jQuery.attr;
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.pseudos;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+
+
+})( window );
+var runtil = /Until$/,
+ rparentsprev = /^(?:parents|prev(?:Until|All))/,
+ isSimple = /^.[^:#\[\.,]*$/,
+ rneedsContext = jQuery.expr.match.needsContext,
+ // methods guaranteed to produce a unique set when starting from a unique set
+ guaranteedUnique = {
+ children: true,
+ contents: true,
+ next: true,
+ prev: true
+ };
+
+jQuery.fn.extend({
+ find: function( selector ) {
+ var i, ret, self;
+
+ if ( typeof selector !== "string" ) {
+ self = this;
+ return this.pushStack( jQuery( selector ).filter(function() {
+ for ( i = 0; i < self.length; i++ ) {
+ if ( jQuery.contains( self[ i ], this ) ) {
+ return true;
+ }
+ }
+ }) );
+ }
+
+ ret = [];
+ for ( i = 0; i < this.length; i++ ) {
+ jQuery.find( selector, this[ i ], ret );
+ }
+
+ // Needed because $( selector, context ) becomes $( context ).find( selector )
+ ret = this.pushStack( jQuery.unique( ret ) );
+ ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;
+ return ret;
+ },
+
+ has: function( target ) {
+ var i,
+ targets = jQuery( target, this ),
+ len = targets.length;
+
+ return this.filter(function() {
+ for ( i = 0; i < len; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
+
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector, false) );
+ },
+
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector, true) );
+ },
+
+ is: function( selector ) {
+ return !!selector && (
+ typeof selector === "string" ?
+ // If this is a positional/relative selector, check membership in the returned set
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
+ rneedsContext.test( selector ) ?
+ jQuery( selector, this.context ).index( this[0] ) >= 0 :
+ jQuery.filter( selector, this ).length > 0 :
+ this.filter( selector ).length > 0 );
+ },
+
+ closest: function( selectors, context ) {
+ var cur,
+ i = 0,
+ l = this.length,
+ ret = [],
+ pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
+ jQuery( selectors, context || this.context ) :
+ 0;
+
+ for ( ; i < l; i++ ) {
+ cur = this[i];
+
+ while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
+ ret.push( cur );
+ break;
+ }
+ cur = cur.parentNode;
+ }
+ }
+
+ return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+
+ // No argument, return index in parent
+ if ( !elem ) {
+ return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
+ }
+
+ // index in selector
+ if ( typeof elem === "string" ) {
+ return jQuery.inArray( this[0], jQuery( elem ) );
+ }
+
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem.jquery ? elem[0] : elem, this );
+ },
+
+ add: function( selector, context ) {
+ var set = typeof selector === "string" ?
+ jQuery( selector, context ) :
+ jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
+ all = jQuery.merge( this.get(), set );
+
+ return this.pushStack( jQuery.unique(all) );
+ },
+
+ addBack: function( selector ) {
+ return this.add( selector == null ?
+ this.prevObject : this.prevObject.filter(selector)
+ );
+ }
+});
+
+jQuery.fn.andSelf = jQuery.fn.addBack;
+
+function sibling( cur, dir ) {
+ do {
+ cur = cur[ dir ];
+ } while ( cur && cur.nodeType !== 1 );
+
+ return cur;
+}
+
+jQuery.each({
+ parent: function( elem ) {
+ var parent = elem.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function( elem ) {
+ return jQuery.dir( elem, "parentNode" );
+ },
+ parentsUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "parentNode", until );
+ },
+ next: function( elem ) {
+ return sibling( elem, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return sibling( elem, "previousSibling" );
+ },
+ nextAll: function( elem ) {
+ return jQuery.dir( elem, "nextSibling" );
+ },
+ prevAll: function( elem ) {
+ return jQuery.dir( elem, "previousSibling" );
+ },
+ nextUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "nextSibling", until );
+ },
+ prevUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "previousSibling", until );
+ },
+ siblings: function( elem ) {
+ return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
+ },
+ children: function( elem ) {
+ return jQuery.sibling( elem.firstChild );
+ },
+ contents: function( elem ) {
+ return jQuery.nodeName( elem, "iframe" ) ?
+ elem.contentDocument || elem.contentWindow.document :
+ jQuery.merge( [], elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var ret = jQuery.map( this, fn, until );
+
+ if ( !runtil.test( name ) ) {
+ selector = until;
+ }
+
+ if ( selector && typeof selector === "string" ) {
+ ret = jQuery.filter( selector, ret );
+ }
+
+ ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
+
+ if ( this.length > 1 && rparentsprev.test( name ) ) {
+ ret = ret.reverse();
+ }
+
+ return this.pushStack( ret );
+ };
+});
+
+jQuery.extend({
+ filter: function( expr, elems, not ) {
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return elems.length === 1 ?
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
+ jQuery.find.matches(expr, elems);
+ },
+
+ dir: function( elem, dir, until ) {
+ var matched = [],
+ cur = elem[ dir ];
+
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+ if ( cur.nodeType === 1 ) {
+ matched.push( cur );
+ }
+ cur = cur[dir];
+ }
+ return matched;
+ },
+
+ sibling: function( n, elem ) {
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType === 1 && n !== elem ) {
+ r.push( n );
+ }
+ }
+
+ return r;
+ }
+});
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, keep ) {
+
+ // Can't pass null or undefined to indexOf in Firefox 4
+ // Set to 0 to skip string check
+ qualifier = qualifier || 0;
+
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ var retVal = !!qualifier.call( elem, i, elem );
+ return retVal === keep;
+ });
+
+ } else if ( qualifier.nodeType ) {
+ return jQuery.grep(elements, function( elem ) {
+ return ( elem === qualifier ) === keep;
+ });
+
+ } else if ( typeof qualifier === "string" ) {
+ var filtered = jQuery.grep(elements, function( elem ) {
+ return elem.nodeType === 1;
+ });
+
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter(qualifier, filtered, !keep);
+ } else {
+ qualifier = jQuery.filter( qualifier, filtered );
+ }
+ }
+
+ return jQuery.grep(elements, function( elem ) {
+ return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
+ });
+}
+function createSafeFragment( document ) {
+ var list = nodeNames.split( "|" ),
+ safeFrag = document.createDocumentFragment();
+
+ if ( safeFrag.createElement ) {
+ while ( list.length ) {
+ safeFrag.createElement(
+ list.pop()
+ );
+ }
+ }
+ return safeFrag;
+}
+
+var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
+ "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
+ rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
+ rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
+ rleadingWhitespace = /^\s+/,
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
+ rtagName = /<([\w:]+)/,
+ rtbody = /<tbody/i,
+ rhtml = /<|&#?\w+;/,
+ rnoInnerhtml = /<(?:script|style|link)/i,
+ manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
+ // checked="checked" or checked
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+ rscriptType = /^$|\/(?:java|ecma)script/i,
+ rscriptTypeMasked = /^true\/(.*)/,
+ rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
+
+ // We have to close these tags to support XHTML (#13200)
+ wrapMap = {
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
+ area: [ 1, "<map>", "</map>" ],
+ param: [ 1, "<object>", "</object>" ],
+ thead: [ 1, "<table>", "</table>" ],
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+
+ // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
+ // unless wrapped in a div with non-breaking characters in front of it.
+ _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
+ },
+ safeFragment = createSafeFragment( document ),
+ fragmentDiv = safeFragment.appendChild( document.createElement("div") );
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+jQuery.fn.extend({
+ text: function( value ) {
+ return jQuery.access( this, function( value ) {
+ return value === undefined ?
+ jQuery.text( this ) :
+ this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
+ }, null, value, arguments.length );
+ },
+
+ wrapAll: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapAll( html.call(this, i) );
+ });
+ }
+
+ if ( this[0] ) {
+ // The elements to wrap the target around
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
+
+ if ( this[0].parentNode ) {
+ wrap.insertBefore( this[0] );
+ }
+
+ wrap.map(function() {
+ var elem = this;
+
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
+ elem = elem.firstChild;
+ }
+
+ return elem;
+ }).append( this );
+ }
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapInner( html.call(this, i) );
+ });
+ }
+
+ return this.each(function() {
+ var self = jQuery( this ),
+ contents = self.contents();
+
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
+ });
+ },
+
+ wrap: function( html ) {
+ var isFunction = jQuery.isFunction( html );
+
+ return this.each(function(i) {
+ jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
+ });
+ },
+
+ unwrap: function() {
+ return this.parent().each(function() {
+ if ( !jQuery.nodeName( this, "body" ) ) {
+ jQuery( this ).replaceWith( this.childNodes );
+ }
+ }).end();
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ this.appendChild( elem );
+ }
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ this.insertBefore( elem, this.firstChild );
+ }
+ });
+ },
+
+ before: function() {
+ return this.domManip( arguments, false, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this );
+ }
+ });
+ },
+
+ after: function() {
+ return this.domManip( arguments, false, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ }
+ });
+ },
+
+ // keepData is for internal use only--do not document
+ remove: function( selector, keepData ) {
+ var elem,
+ i = 0;
+
+ for ( ; (elem = this[i]) != null; i++ ) {
+ if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
+ if ( !keepData && elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem ) );
+ }
+
+ if ( elem.parentNode ) {
+ if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
+ setGlobalEval( getAll( elem, "script" ) );
+ }
+ elem.parentNode.removeChild( elem );
+ }
+ }
+ }
+
+ return this;
+ },
+
+ empty: function() {
+ var elem,
+ i = 0;
+
+ for ( ; (elem = this[i]) != null; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem, false ) );
+ }
+
+ // Remove any remaining nodes
+ while ( elem.firstChild ) {
+ elem.removeChild( elem.firstChild );
+ }
+
+ // If this is a select, ensure that it displays empty (#12336)
+ // Support: IE<9
+ if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
+ elem.options.length = 0;
+ }
+ }
+
+ return this;
+ },
+
+ clone: function( dataAndEvents, deepDataAndEvents ) {
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
+
+ return this.map( function () {
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
+ });
+ },
+
+ html: function( value ) {
+ return jQuery.access( this, function( value ) {
+ var elem = this[0] || {},
+ i = 0,
+ l = this.length;
+
+ if ( value === undefined ) {
+ return elem.nodeType === 1 ?
+ elem.innerHTML.replace( rinlinejQuery, "" ) :
+ undefined;
+ }
+
+ // See if we can take a shortcut and just use innerHTML
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+ ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
+ ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
+ !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
+
+ value = value.replace( rxhtmlTag, "<$1></$2>" );
+
+ try {
+ for (; i < l; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ elem = this[i] || {};
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem, false ) );
+ elem.innerHTML = value;
+ }
+ }
+
+ elem = 0;
+
+ // If using innerHTML throws an exception, use the fallback method
+ } catch(e) {}
+ }
+
+ if ( elem ) {
+ this.empty().append( value );
+ }
+ }, null, value, arguments.length );
+ },
+
+ replaceWith: function( value ) {
+ var isFunc = jQuery.isFunction( value );
+
+ // Make sure that the elements are removed from the DOM before they are inserted
+ // this can help fix replacing a parent with child elements
+ if ( !isFunc && typeof value !== "string" ) {
+ value = jQuery( value ).not( this ).detach();
+ }
+
+ return this.domManip( [ value ], true, function( elem ) {
+ var next = this.nextSibling,
+ parent = this.parentNode;
+
+ if ( parent && this.nodeType === 1 || this.nodeType === 11 ) {
+
+ jQuery( this ).remove();
+
+ if ( next ) {
+ next.parentNode.insertBefore( elem, next );
+ } else {
+ parent.appendChild( elem );
+ }
+ }
+ });
+ },
+
+ detach: function( selector ) {
+ return this.remove( selector, true );
+ },
+
+ domManip: function( args, table, callback ) {
+
+ // Flatten any nested arrays
+ args = core_concat.apply( [], args );
+
+ var fragment, first, scripts, hasScripts, node, doc,
+ i = 0,
+ l = this.length,
+ set = this,
+ iNoClone = l - 1,
+ value = args[0],
+ isFunction = jQuery.isFunction( value );
+
+ // We can't cloneNode fragments that contain checked, in WebKit
+ if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
+ return this.each(function( index ) {
+ var self = set.eq( index );
+ if ( isFunction ) {
+ args[0] = value.call( this, index, table ? self.html() : undefined );
+ }
+ self.domManip( args, table, callback );
+ });
+ }
+
+ if ( l ) {
+ fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
+ first = fragment.firstChild;
+
+ if ( fragment.childNodes.length === 1 ) {
+ fragment = first;
+ }
+
+ if ( first ) {
+ table = table && jQuery.nodeName( first, "tr" );
+ scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
+ hasScripts = scripts.length;
+
+ // Use the original fragment for the last item instead of the first because it can end up
+ // being emptied incorrectly in certain situations (#8070).
+ for ( ; i < l; i++ ) {
+ node = fragment;
+
+ if ( i !== iNoClone ) {
+ node = jQuery.clone( node, true, true );
+
+ // Keep references to cloned scripts for later restoration
+ if ( hasScripts ) {
+ jQuery.merge( scripts, getAll( node, "script" ) );
+ }
+ }
+
+ callback.call(
+ table && jQuery.nodeName( this[i], "table" ) ?
+ findOrAppend( this[i], "tbody" ) :
+ this[i],
+ node,
+ i
+ );
+ }
+
+ if ( hasScripts ) {
+ doc = scripts[ scripts.length - 1 ].ownerDocument;
+
+ // Reenable scripts
+ jQuery.map( scripts, restoreScript );
+
+ // Evaluate executable scripts on first document insertion
+ for ( i = 0; i < hasScripts; i++ ) {
+ node = scripts[ i ];
+ if ( rscriptType.test( node.type || "" ) &&
+ !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
+
+ if ( node.src ) {
+ // Hope ajax is available...
+ jQuery.ajax({
+ url: node.src,
+ type: "GET",
+ dataType: "script",
+ async: false,
+ global: false,
+ "throws": true
+ });
+ } else {
+ jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
+ }
+ }
+ }
+ }
+
+ // Fix #11809: Avoid leaking memory
+ fragment = first = null;
+ }
+ }
+
+ return this;
+ }
+});
+
+function findOrAppend( elem, tag ) {
+ return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
+}
+
+// Replace/restore the type attribute of script elements for safe DOM manipulation
+function disableScript( elem ) {
+ var attr = elem.getAttributeNode("type");
+ elem.type = ( attr && attr.specified ) + "/" + elem.type;
+ return elem;
+}
+function restoreScript( elem ) {
+ var match = rscriptTypeMasked.exec( elem.type );
+ if ( match ) {
+ elem.type = match[1];
+ } else {
+ elem.removeAttribute("type");
+ }
+ return elem;
+}
+
+// Mark scripts as having already been evaluated
+function setGlobalEval( elems, refElements ) {
+ var elem,
+ i = 0;
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
+ }
+}
+
+function cloneCopyEvent( src, dest ) {
+
+ if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
+ return;
+ }
+
+ var type, i, l,
+ oldData = jQuery._data( src ),
+ curData = jQuery._data( dest, oldData ),
+ events = oldData.events;
+
+ if ( events ) {
+ delete curData.handle;
+ curData.events = {};
+
+ for ( type in events ) {
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {
+ jQuery.event.add( dest, type, events[ type ][ i ] );
+ }
+ }
+ }
+
+ // make the cloned public data object a copy from the original
+ if ( curData.data ) {
+ curData.data = jQuery.extend( {}, curData.data );
+ }
+}
+
+function fixCloneNodeIssues( src, dest ) {
+ var nodeName, data, e;
+
+ // We do not need to do anything for non-Elements
+ if ( dest.nodeType !== 1 ) {
+ return;
+ }
+
+ nodeName = dest.nodeName.toLowerCase();
+
+ // IE6-8 copies events bound via attachEvent when using cloneNode.
+ if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
+ data = jQuery._data( dest );
+
+ for ( e in data.events ) {
+ jQuery.removeEvent( dest, e, data.handle );
+ }
+
+ // Event data gets referenced instead of copied if the expando gets copied too
+ dest.removeAttribute( jQuery.expando );
+ }
+
+ // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
+ if ( nodeName === "script" && dest.text !== src.text ) {
+ disableScript( dest ).text = src.text;
+ restoreScript( dest );
+
+ // IE6-10 improperly clones children of object elements using classid.
+ // IE10 throws NoModificationAllowedError if parent is null, #12132.
+ } else if ( nodeName === "object" ) {
+ if ( dest.parentNode ) {
+ dest.outerHTML = src.outerHTML;
+ }
+
+ // This path appears unavoidable for IE9. When cloning an object
+ // element in IE9, the outerHTML strategy above is not sufficient.
+ // If the src has innerHTML and the destination does not,
+ // copy the src.innerHTML into the dest.innerHTML. #10324
+ if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
+ dest.innerHTML = src.innerHTML;
+ }
+
+ } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
+ // IE6-8 fails to persist the checked state of a cloned checkbox
+ // or radio button. Worse, IE6-7 fail to give the cloned element
+ // a checked appearance if the defaultChecked value isn't also set
+
+ dest.defaultChecked = dest.checked = src.checked;
+
+ // IE6-7 get confused and end up setting the value of a cloned
+ // checkbox/radio button to an empty string instead of "on"
+ if ( dest.value !== src.value ) {
+ dest.value = src.value;
+ }
+
+ // IE6-8 fails to return the selected option to the default selected
+ // state when cloning options
+ } else if ( nodeName === "option" ) {
+ dest.defaultSelected = dest.selected = src.defaultSelected;
+
+ // IE6-8 fails to set the defaultValue to the correct value when
+ // cloning other types of input fields
+ } else if ( nodeName === "input" || nodeName === "textarea" ) {
+ dest.defaultValue = src.defaultValue;
+ }
+}
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function( name, original ) {
+ jQuery.fn[ name ] = function( selector ) {
+ var elems,
+ i = 0,
+ ret = [],
+ insert = jQuery( selector ),
+ last = insert.length - 1;
+
+ for ( ; i <= last; i++ ) {
+ elems = i === last ? this : this.clone(true);
+ jQuery( insert[i] )[ original ]( elems );
+
+ // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
+ core_push.apply( ret, elems.get() );
+ }
+
+ return this.pushStack( ret );
+ };
+});
+
+function getAll( context, tag ) {
+ var elems, elem,
+ i = 0,
+ found = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( tag || "*" ) :
+ typeof context.querySelectorAll !== "undefined" ? context.querySelectorAll( tag || "*" ) :
+ undefined;
+
+ if ( !found ) {
+ for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
+ if ( !tag || jQuery.nodeName( elem, tag ) ) {
+ found.push( elem );
+ } else {
+ jQuery.merge( found, getAll( elem, tag ) );
+ }
+ }
+ }
+
+ return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
+ jQuery.merge( [ context ], found ) :
+ found;
+}
+
+// Used in buildFragment, fixes the defaultChecked property
+function fixDefaultChecked( elem ) {
+ if ( manipulation_rcheckableType.test( elem.type ) ) {
+ elem.defaultChecked = elem.checked;
+ }
+}
+
+jQuery.extend({
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) {
+ var destElements, srcElements, node, i, clone,
+ inPage = jQuery.contains( elem.ownerDocument, elem );
+
+ if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
+ clone = elem.cloneNode( true );
+
+ // IE<=8 does not properly clone detached, unknown element nodes
+ } else {
+ fragmentDiv.innerHTML = elem.outerHTML;
+ fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
+ }
+
+ if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
+ (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
+
+ // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
+ destElements = getAll( clone );
+ srcElements = getAll( elem );
+
+ // Fix all IE cloning issues
+ for ( i = 0; (node = srcElements[i]) != null; ++i ) {
+ // Ensure that the destination node is not null; Fixes #9587
+ if ( destElements[i] ) {
+ fixCloneNodeIssues( node, destElements[i] );
+ }
+ }
+ }
+
+ // Copy the events from the original to the clone
+ if ( dataAndEvents ) {
+ if ( deepDataAndEvents ) {
+ srcElements = srcElements || getAll( elem );
+ destElements = destElements || getAll( clone );
+
+ for ( i = 0; (node = srcElements[i]) != null; i++ ) {
+ cloneCopyEvent( node, destElements[i] );
+ }
+ } else {
+ cloneCopyEvent( elem, clone );
+ }
+ }
+
+ // Preserve script evaluation history
+ destElements = getAll( clone, "script" );
+ if ( destElements.length > 0 ) {
+ setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
+ }
+
+ destElements = srcElements = node = null;
+
+ // Return the cloned set
+ return clone;
+ },
+
+ buildFragment: function( elems, context, scripts, selection ) {
+ var contains, elem, tag, tmp, wrap, tbody, j,
+ l = elems.length,
+
+ // Ensure a safe fragment
+ safe = createSafeFragment( context ),
+
+ nodes = [],
+ i = 0;
+
+ for ( ; i < l; i++ ) {
+ elem = elems[ i ];
+
+ if ( elem || elem === 0 ) {
+
+ // Add nodes directly
+ if ( jQuery.type( elem ) === "object" ) {
+ jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
+
+ // Convert non-html into a text node
+ } else if ( !rhtml.test( elem ) ) {
+ nodes.push( context.createTextNode( elem ) );
+
+ // Convert html into DOM nodes
+ } else {
+ tmp = tmp || safe.appendChild( context.createElement("div") );
+
+ // Deserialize a standard representation
+ tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
+ wrap = wrapMap[ tag ] || wrapMap._default;
+
+ tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
+
+ // Descend through wrappers to the right content
+ j = wrap[0];
+ while ( j-- ) {
+ tmp = tmp.lastChild;
+ }
+
+ // Manually add leading whitespace removed by IE
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+ nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
+ }
+
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( !jQuery.support.tbody ) {
+
+ // String was a <table>, *may* have spurious <tbody>
+ elem = tag === "table" && !rtbody.test( elem ) ?
+ tmp.firstChild :
+
+ // String was a bare <thead> or <tfoot>
+ wrap[1] === "<table>" && !rtbody.test( elem ) ?
+ tmp :
+ 0;
+
+ j = elem && elem.childNodes.length;
+ while ( j-- ) {
+ if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
+ elem.removeChild( tbody );
+ }
+ }
+ }
+
+ jQuery.merge( nodes, tmp.childNodes );
+
+ // Fix #12392 for WebKit and IE > 9
+ tmp.textContent = "";
+
+ // Fix #12392 for oldIE
+ while ( tmp.firstChild ) {
+ tmp.removeChild( tmp.firstChild );
+ }
+
+ // Remember the top-level container for proper cleanup
+ tmp = safe.lastChild;
+ }
+ }
+ }
+
+ // Fix #11356: Clear elements from fragment
+ if ( tmp ) {
+ safe.removeChild( tmp );
+ }
+
+ // Reset defaultChecked for any radios and checkboxes
+ // about to be appended to the DOM in IE 6/7 (#8060)
+ if ( !jQuery.support.appendChecked ) {
+ jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
+ }
+
+ i = 0;
+ while ( (elem = nodes[ i++ ]) ) {
+
+ // #4087 - If origin and destination elements are the same, and this is
+ // that element, do not do anything
+ if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
+ continue;
+ }
+
+ contains = jQuery.contains( elem.ownerDocument, elem );
+
+ // Append to fragment
+ tmp = getAll( safe.appendChild( elem ), "script" );
+
+ // Preserve script evaluation history
+ if ( contains ) {
+ setGlobalEval( tmp );
+ }
+
+ // Capture executables
+ if ( scripts ) {
+ j = 0;
+ while ( (elem = tmp[ j++ ]) ) {
+ if ( rscriptType.test( elem.type || "" ) ) {
+ scripts.push( elem );
+ }
+ }
+ }
+ }
+
+ tmp = null;
+
+ return safe;
+ },
+
+ cleanData: function( elems, /* internal */ acceptData ) {
+ var data, id, elem, type,
+ i = 0,
+ internalKey = jQuery.expando,
+ cache = jQuery.cache,
+ deleteExpando = jQuery.support.deleteExpando,
+ special = jQuery.event.special;
+
+ for ( ; (elem = elems[i]) != null; i++ ) {
+
+ if ( acceptData || jQuery.acceptData( elem ) ) {
+
+ id = elem[ internalKey ];
+ data = id && cache[ id ];
+
+ if ( data ) {
+ if ( data.events ) {
+ for ( type in data.events ) {
+ if ( special[ type ] ) {
+ jQuery.event.remove( elem, type );
+
+ // This is a shortcut to avoid jQuery.event.remove's overhead
+ } else {
+ jQuery.removeEvent( elem, type, data.handle );
+ }
+ }
+ }
+
+ // Remove cache only if it was not already removed by jQuery.event.remove
+ if ( cache[ id ] ) {
+
+ delete cache[ id ];
+
+ // IE does not allow us to delete expando properties from nodes,
+ // nor does it have a removeAttribute function on Document nodes;
+ // we must handle all of these cases
+ if ( deleteExpando ) {
+ delete elem[ internalKey ];
+
+ } else if ( typeof elem.removeAttribute !== "undefined" ) {
+ elem.removeAttribute( internalKey );
+
+ } else {
+ elem[ internalKey ] = null;
+ }
+
+ core_deletedIds.push( id );
+ }
+ }
+ }
+ }
+ }
+});
+var curCSS, getStyles, iframe,
+ ralpha = /alpha\([^)]*\)/i,
+ ropacity = /opacity\s*=\s*([^)]*)/,
+ rposition = /^(top|right|bottom|left)$/,
+ // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
+ // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
+ rdisplayswap = /^(none|table(?!-c[ea]).+)/,
+ rmargin = /^margin/,
+ rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
+ rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
+ rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
+ elemdisplay = { BODY: "block" },
+
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
+ cssNormalTransform = {
+ letterSpacing: 0,
+ fontWeight: 400
+ },
+
+ cssExpand = [ "Top", "Right", "Bottom", "Left" ],
+ cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
+
+// return a css property mapped to a potentially vendor prefixed property
+function vendorPropName( style, name ) {
+
+ // shortcut for names that are not vendor prefixed
+ if ( name in style ) {
+ return name;
+ }
+
+ // check for vendor prefixed names
+ var capName = name.charAt(0).toUpperCase() + name.slice(1),
+ origName = name,
+ i = cssPrefixes.length;
+
+ while ( i-- ) {
+ name = cssPrefixes[ i ] + capName;
+ if ( name in style ) {
+ return name;
+ }
+ }
+
+ return origName;
+}
+
+function isHidden( elem, el ) {
+ // isHidden might be called from jQuery#filter function;
+ // in that case, element will be second argument
+ elem = el || elem;
+ return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
+}
+
+function showHide( elements, show ) {
+ var elem,
+ values = [],
+ index = 0,
+ length = elements.length;
+
+ for ( ; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+ values[ index ] = jQuery._data( elem, "olddisplay" );
+ if ( show ) {
+ // Reset the inline display of this element to learn if it is
+ // being hidden by cascaded rules or not
+ if ( !values[ index ] && elem.style.display === "none" ) {
+ elem.style.display = "";
+ }
+
+ // Set elements which have been overridden with display: none
+ // in a stylesheet to whatever the default browser style is
+ // for such an element
+ if ( elem.style.display === "" && isHidden( elem ) ) {
+ values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
+ }
+ } else if ( !values[ index ] && !isHidden( elem ) ) {
+ jQuery._data( elem, "olddisplay", jQuery.css( elem, "display" ) );
+ }
+ }
+
+ // Set the display of most of the elements in a second loop
+ // to avoid the constant reflow
+ for ( index = 0; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+ if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
+ elem.style.display = show ? values[ index ] || "" : "none";
+ }
+ }
+
+ return elements;
+}
+
+jQuery.fn.extend({
+ css: function( name, value ) {
+ return jQuery.access( this, function( elem, name, value ) {
+ var styles, len,
+ map = {},
+ i = 0;
+
+ if ( jQuery.isArray( name ) ) {
+ styles = getStyles( elem );
+ len = name.length;
+
+ for ( ; i < len; i++ ) {
+ map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
+ }
+
+ return map;
+ }
+
+ return value !== undefined ?
+ jQuery.style( elem, name, value ) :
+ jQuery.css( elem, name );
+ }, name, value, arguments.length > 1 );
+ },
+ show: function() {
+ return showHide( this, true );
+ },
+ hide: function() {
+ return showHide( this );
+ },
+ toggle: function( state ) {
+ var bool = typeof state === "boolean";
+
+ return this.each(function() {
+ if ( bool ? state : isHidden( this ) ) {
+ jQuery( this ).show();
+ } else {
+ jQuery( this ).hide();
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ // Add in style property hooks for overriding the default
+ // behavior of getting and setting a style property
+ cssHooks: {
+ opacity: {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // We should always get a number back from opacity
+ var ret = curCSS( elem, "opacity" );
+ return ret === "" ? "1" : ret;
+ }
+ }
+ }
+ },
+
+ // Exclude the following css properties to add px
+ cssNumber: {
+ "columnCount": true,
+ "fillOpacity": true,
+ "fontWeight": true,
+ "lineHeight": true,
+ "opacity": true,
+ "orphans": true,
+ "widows": true,
+ "zIndex": true,
+ "zoom": true
+ },
+
+ // Add in properties whose names you wish to fix before
+ // setting or getting the value
+ cssProps: {
+ // normalize float css property
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
+ },
+
+ // Get and set the style property on a DOM Node
+ style: function( elem, name, value, extra ) {
+ // Don't set styles on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
+ return;
+ }
+
+ // Make sure that we're working with the right name
+ var ret, type, hooks,
+ origName = jQuery.camelCase( name ),
+ style = elem.style;
+
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+ // Check if we're setting a value
+ if ( value !== undefined ) {
+ type = typeof value;
+
+ // convert relative number strings (+= or -=) to relative numbers. #7345
+ if ( type === "string" && (ret = rrelNum.exec( value )) ) {
+ value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
+ // Fixes bug #9237
+ type = "number";
+ }
+
+ // Make sure that NaN and null values aren't set. See: #7116
+ if ( value == null || type === "number" && isNaN( value ) ) {
+ return;
+ }
+
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
+ if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
+ value += "px";
+ }
+
+ // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
+ // but it would mean to define eight (for every problematic property) identical functions
+ if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
+ style[ name ] = "inherit";
+ }
+
+ // If a hook was provided, use that value, otherwise just set the specified value
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
+
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
+ // Fixes bug #5509
+ try {
+ style[ name ] = value;
+ } catch(e) {}
+ }
+
+ } else {
+ // If a hook was provided get the non-computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+ return ret;
+ }
+
+ // Otherwise just get the value from the style object
+ return style[ name ];
+ }
+ },
+
+ css: function( elem, name, extra, styles ) {
+ var val, num, hooks,
+ origName = jQuery.camelCase( name );
+
+ // Make sure that we're working with the right name
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+ // If a hook was provided get the computed value from there
+ if ( hooks && "get" in hooks ) {
+ val = hooks.get( elem, true, extra );
+ }
+
+ // Otherwise, if a way to get the computed value exists, use that
+ if ( val === undefined ) {
+ val = curCSS( elem, name, styles );
+ }
+
+ //convert "normal" to computed value
+ if ( val === "normal" && name in cssNormalTransform ) {
+ val = cssNormalTransform[ name ];
+ }
+
+ // Return, converting to number if forced or a qualifier was provided and val looks numeric
+ if ( extra ) {
+ num = parseFloat( val );
+ return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
+ }
+ return val;
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback, args ) {
+ var ret, name,
+ old = {};
+
+ // Remember the old values, and insert the new ones
+ for ( name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ ret = callback.apply( elem, args || [] );
+
+ // Revert the old values
+ for ( name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
+
+ return ret;
+ }
+});
+
+// NOTE: we've included the "window" in window.getComputedStyle
+// because jsdom on node.js will break without it.
+if ( window.getComputedStyle ) {
+ getStyles = function( elem ) {
+ return window.getComputedStyle( elem, null );
+ };
+
+ curCSS = function( elem, name, _computed ) {
+ var width, minWidth, maxWidth,
+ computed = _computed || getStyles( elem ),
+
+ // getPropertyValue is only needed for .css('filter') in IE9, see #12537
+ ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
+ style = elem.style;
+
+ if ( computed ) {
+
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
+ ret = jQuery.style( elem, name );
+ }
+
+ // A tribute to the "awesome hack by Dean Edwards"
+ // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
+ // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
+ // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
+ if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
+
+ // Remember the original values
+ width = style.width;
+ minWidth = style.minWidth;
+ maxWidth = style.maxWidth;
+
+ // Put in the new values to get a computed value out
+ style.minWidth = style.maxWidth = style.width = ret;
+ ret = computed.width;
+
+ // Revert the changed values
+ style.width = width;
+ style.minWidth = minWidth;
+ style.maxWidth = maxWidth;
+ }
+ }
+
+ return ret;
+ };
+} else if ( document.documentElement.currentStyle ) {
+ getStyles = function( elem ) {
+ return elem.currentStyle;
+ };
+
+ curCSS = function( elem, name, _computed ) {
+ var left, rs, rsLeft,
+ computed = _computed || getStyles( elem ),
+ ret = computed ? computed[ name ] : undefined,
+ style = elem.style;
+
+ // Avoid setting ret to empty string here
+ // so we don't default to auto
+ if ( ret == null && style && style[ name ] ) {
+ ret = style[ name ];
+ }
+
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ // but not position css attributes, as those are proportional to the parent element instead
+ // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
+ if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
+
+ // Remember the original values
+ left = style.left;
+ rs = elem.runtimeStyle;
+ rsLeft = rs && rs.left;
+
+ // Put in the new values to get a computed value out
+ if ( rsLeft ) {
+ rs.left = elem.currentStyle.left;
+ }
+ style.left = name === "fontSize" ? "1em" : ret;
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ if ( rsLeft ) {
+ rs.left = rsLeft;
+ }
+ }
+
+ return ret === "" ? "auto" : ret;
+ };
+}
+
+function setPositiveNumber( elem, value, subtract ) {
+ var matches = rnumsplit.exec( value );
+ return matches ?
+ // Guard against undefined "subtract", e.g., when used as in cssHooks
+ Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
+ value;
+}
+
+function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
+ var i = extra === ( isBorderBox ? "border" : "content" ) ?
+ // If we already have the right measurement, avoid augmentation
+ 4 :
+ // Otherwise initialize for horizontal or vertical properties
+ name === "width" ? 1 : 0,
+
+ val = 0;
+
+ for ( ; i < 4; i += 2 ) {
+ // both box models exclude margin, so add it if we want it
+ if ( extra === "margin" ) {
+ val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
+ }
+
+ if ( isBorderBox ) {
+ // border-box includes padding, so remove it if we want content
+ if ( extra === "content" ) {
+ val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+ }
+
+ // at this point, extra isn't border nor margin, so remove border
+ if ( extra !== "margin" ) {
+ val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ } else {
+ // at this point, extra isn't content, so add padding
+ val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+
+ // at this point, extra isn't content nor padding, so add border
+ if ( extra !== "padding" ) {
+ val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ }
+ }
+
+ return val;
+}
+
+function getWidthOrHeight( elem, name, extra ) {
+
+ // Start with offset property, which is equivalent to the border-box value
+ var valueIsBorderBox = true,
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
+ styles = getStyles( elem ),
+ isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
+
+ // some non-html elements return undefined for offsetWidth, so check for null/undefined
+ // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
+ // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
+ if ( val <= 0 || val == null ) {
+ // Fall back to computed then uncomputed css if necessary
+ val = curCSS( elem, name, styles );
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ];
+ }
+
+ // Computed unit is not pixels. Stop here and return.
+ if ( rnumnonpx.test(val) ) {
+ return val;
+ }
+
+ // we need the check for style in case a browser which returns unreliable values
+ // for getComputedStyle silently falls back to the reliable elem.style
+ valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
+
+ // Normalize "", auto, and prepare for extra
+ val = parseFloat( val ) || 0;
+ }
+
+ // use the active box-sizing model to add/subtract irrelevant styles
+ return ( val +
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra || ( isBorderBox ? "border" : "content" ),
+ valueIsBorderBox,
+ styles
+ )
+ ) + "px";
+}
+
+// Try to determine the default display value of an element
+function css_defaultDisplay( nodeName ) {
+ var doc = document,
+ display = elemdisplay[ nodeName ];
+
+ if ( !display ) {
+ display = actualDisplay( nodeName, doc );
+
+ // If the simple way fails, read from inside an iframe
+ if ( display === "none" || !display ) {
+ // Use the already-created iframe if possible
+ iframe = ( iframe ||
+ jQuery("<iframe frameborder='0' width='0' height='0'/>")
+ .css( "cssText", "display:block !important" )
+ ).appendTo( doc.documentElement );
+
+ // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
+ doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
+ doc.write("<!doctype html><html><body>");
+ doc.close();
+
+ display = actualDisplay( nodeName, doc );
+ iframe.detach();
+ }
+
+ // Store the correct default display
+ elemdisplay[ nodeName ] = display;
+ }
+
+ return display;
+}
+
+// Called ONLY from within css_defaultDisplay
+function actualDisplay( name, doc ) {
+ var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
+ display = jQuery.css( elem[0], "display" );
+ elem.remove();
+ return display;
+}
+
+jQuery.each([ "height", "width" ], function( i, name ) {
+ jQuery.cssHooks[ name ] = {
+ get: function( elem, computed, extra ) {
+ if ( computed ) {
+ // certain elements can have dimension info if we invisibly show them
+ // however, it must have a current display style that would benefit from this
+ return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
+ jQuery.swap( elem, cssShow, function() {
+ return getWidthOrHeight( elem, name, extra );
+ }) :
+ getWidthOrHeight( elem, name, extra );
+ }
+ },
+
+ set: function( elem, value, extra ) {
+ var styles = extra && getStyles( elem );
+ return setPositiveNumber( elem, value, extra ?
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra,
+ jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
+ styles
+ ) : 0
+ );
+ }
+ };
+});
+
+if ( !jQuery.support.opacity ) {
+ jQuery.cssHooks.opacity = {
+ get: function( elem, computed ) {
+ // IE uses filters for opacity
+ return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
+ ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
+ computed ? "1" : "";
+ },
+
+ set: function( elem, value ) {
+ var style = elem.style,
+ currentStyle = elem.currentStyle,
+ opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
+ filter = currentStyle && currentStyle.filter || style.filter || "";
+
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ style.zoom = 1;
+
+ // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
+ // if value === "", then remove inline opacity #12685
+ if ( ( value >= 1 || value === "" ) &&
+ jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
+ style.removeAttribute ) {
+
+ // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
+ // if "filter:" is present at all, clearType is disabled, we want to avoid this
+ // style.removeAttribute is IE Only, but so apparently is this code path...
+ style.removeAttribute( "filter" );
+
+ // if there is no filter style applied in a css rule or unset inline opacity, we are done
+ if ( value === "" || currentStyle && !currentStyle.filter ) {
+ return;
+ }
+ }
+
+ // otherwise, set new filter values
+ style.filter = ralpha.test( filter ) ?
+ filter.replace( ralpha, opacity ) :
+ filter + " " + opacity;
+ }
+ };
+}
+
+// These hooks cannot be added until DOM ready because the support test
+// for it is not run until after DOM ready
+jQuery(function() {
+ if ( !jQuery.support.reliableMarginRight ) {
+ jQuery.cssHooks.marginRight = {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ // Work around by temporarily setting element display to inline-block
+ return jQuery.swap( elem, { "display": "inline-block" },
+ curCSS, [ elem, "marginRight" ] );
+ }
+ }
+ };
+ }
+
+ // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
+ // getComputedStyle returns percent when specified for top/left/bottom/right
+ // rather than make the css module depend on the offset module, we just check for it here
+ if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
+ jQuery.each( [ "top", "left" ], function( i, prop ) {
+ jQuery.cssHooks[ prop ] = {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ computed = curCSS( elem, prop );
+ // if curCSS returns percentage, fallback to offset
+ return rnumnonpx.test( computed ) ?
+ jQuery( elem ).position()[ prop ] + "px" :
+ computed;
+ }
+ }
+ };
+ });
+ }
+
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.hidden = function( elem ) {
+ return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
+ };
+
+ jQuery.expr.filters.visible = function( elem ) {
+ return !jQuery.expr.filters.hidden( elem );
+ };
+}
+
+// These hooks are used by animate to expand properties
+jQuery.each({
+ margin: "",
+ padding: "",
+ border: "Width"
+}, function( prefix, suffix ) {
+ jQuery.cssHooks[ prefix + suffix ] = {
+ expand: function( value ) {
+ var i = 0,
+ expanded = {},
+
+ // assumes a single number if not a string
+ parts = typeof value === "string" ? value.split(" ") : [ value ];
+
+ for ( ; i < 4; i++ ) {
+ expanded[ prefix + cssExpand[ i ] + suffix ] =
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
+ }
+
+ return expanded;
+ }
+ };
+
+ if ( !rmargin.test( prefix ) ) {
+ jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
+ }
+});
+var r20 = /%20/g,
+ rbracket = /\[\]$/,
+ rCRLF = /\r?\n/g,
+ rsubmitterTypes = /^(?:submit|button|image|reset)$/i,
+ rsubmittable = /^(?:input|select|textarea|keygen)/i;
+
+jQuery.fn.extend({
+ serialize: function() {
+ return jQuery.param( this.serializeArray() );
+ },
+ serializeArray: function() {
+ return this.map(function(){
+ // Can add propHook for "elements" to filter or add form elements
+ var elements = jQuery.prop( this, "elements" );
+ return elements ? jQuery.makeArray( elements ) : this;
+ })
+ .filter(function(){
+ var type = this.type;
+ // Use .is(":disabled") so that fieldset[disabled] works
+ return this.name && !jQuery( this ).is( ":disabled" ) &&
+ rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
+ ( this.checked || !manipulation_rcheckableType.test( type ) );
+ })
+ .map(function( i, elem ){
+ var val = jQuery( this ).val();
+
+ return val == null ?
+ null :
+ jQuery.isArray( val ) ?
+ jQuery.map( val, function( val ){
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }) :
+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }).get();
+ }
+});
+
+//Serialize an array of form elements or a set of
+//key/values into a query string
+jQuery.param = function( a, traditional ) {
+ var prefix,
+ s = [],
+ add = function( key, value ) {
+ // If value is a function, invoke it and return its value
+ value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
+ };
+
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
+ if ( traditional === undefined ) {
+ traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
+ }
+
+ // If an array was passed in, assume that it is an array of form elements.
+ if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
+ // Serialize the form elements
+ jQuery.each( a, function() {
+ add( this.name, this.value );
+ });
+
+ } else {
+ // If traditional, encode the "old" way (the way 1.3.2 or older
+ // did it), otherwise encode params recursively.
+ for ( prefix in a ) {
+ buildParams( prefix, a[ prefix ], traditional, add );
+ }
+ }
+
+ // Return the resulting serialization
+ return s.join( "&" ).replace( r20, "+" );
+};
+
+function buildParams( prefix, obj, traditional, add ) {
+ var name;
+
+ if ( jQuery.isArray( obj ) ) {
+ // Serialize array item.
+ jQuery.each( obj, function( i, v ) {
+ if ( traditional || rbracket.test( prefix ) ) {
+ // Treat each array item as a scalar.
+ add( prefix, v );
+
+ } else {
+ // Item is non-scalar (array or object), encode its numeric index.
+ buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
+ }
+ });
+
+ } else if ( !traditional && jQuery.type( obj ) === "object" ) {
+ // Serialize object item.
+ for ( name in obj ) {
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
+ }
+
+ } else {
+ // Serialize scalar item.
+ add( prefix, obj );
+ }
+}
+var
+ // Document location
+ ajaxLocParts,
+ ajaxLocation,
+
+ ajax_nonce = jQuery.now(),
+
+ ajax_rquery = /\?/,
+ rhash = /#.*$/,
+ rts = /([?&])_=[^&]*/,
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
+ // #7653, #8125, #8152: local protocol detection
+ rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
+ rnoContent = /^(?:GET|HEAD)$/,
+ rprotocol = /^\/\//,
+ rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
+
+ // Keep a copy of the old load method
+ _load = jQuery.fn.load,
+
+ /* Prefilters
+ * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
+ * 2) These are called:
+ * - BEFORE asking for a transport
+ * - AFTER param serialization (s.data is a string if s.processData is true)
+ * 3) key is the dataType
+ * 4) the catchall symbol "*" can be used
+ * 5) execution will start with transport dataType and THEN continue down to "*" if needed
+ */
+ prefilters = {},
+
+ /* Transports bindings
+ * 1) key is the dataType
+ * 2) the catchall symbol "*" can be used
+ * 3) selection will start with transport dataType and THEN go to "*" if needed
+ */
+ transports = {},
+
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
+ allTypes = "*/".concat("*");
+
+// #8138, IE may throw an exception when accessing
+// a field from window.location if document.domain has been set
+try {
+ ajaxLocation = location.href;
+} catch( e ) {
+ // Use the href attribute of an A element
+ // since IE will modify it given document.location
+ ajaxLocation = document.createElement( "a" );
+ ajaxLocation.href = "";
+ ajaxLocation = ajaxLocation.href;
+}
+
+// Segment location into parts
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
+
+// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
+function addToPrefiltersOrTransports( structure ) {
+
+ // dataTypeExpression is optional and defaults to "*"
+ return function( dataTypeExpression, func ) {
+
+ if ( typeof dataTypeExpression !== "string" ) {
+ func = dataTypeExpression;
+ dataTypeExpression = "*";
+ }
+
+ var dataType,
+ i = 0,
+ dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
+
+ if ( jQuery.isFunction( func ) ) {
+ // For each dataType in the dataTypeExpression
+ while ( (dataType = dataTypes[i++]) ) {
+ // Prepend if requested
+ if ( dataType[0] === "+" ) {
+ dataType = dataType.slice( 1 ) || "*";
+ (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
+
+ // Otherwise append
+ } else {
+ (structure[ dataType ] = structure[ dataType ] || []).push( func );
+ }
+ }
+ }
+ };
+}
+
+// Base inspection function for prefilters and transports
+function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
+
+ var inspected = {},
+ seekingTransport = ( structure === transports );
+
+ function inspect( dataType ) {
+ var selected;
+ inspected[ dataType ] = true;
+ jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
+ var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
+ if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
+ options.dataTypes.unshift( dataTypeOrTransport );
+ inspect( dataTypeOrTransport );
+ return false;
+ } else if ( seekingTransport ) {
+ return !( selected = dataTypeOrTransport );
+ }
+ });
+ return selected;
+ }
+
+ return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
+}
+
+// A special extend for ajax options
+// that takes "flat" options (not to be deep extended)
+// Fixes #9887
+function ajaxExtend( target, src ) {
+ var key, deep,
+ flatOptions = jQuery.ajaxSettings.flatOptions || {};
+
+ for ( key in src ) {
+ if ( src[ key ] !== undefined ) {
+ ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
+ }
+ }
+ if ( deep ) {
+ jQuery.extend( true, target, deep );
+ }
+
+ return target;
+}
+
+jQuery.fn.load = function( url, params, callback ) {
+ if ( typeof url !== "string" && _load ) {
+ return _load.apply( this, arguments );
+ }
+
+ var selector, type, response,
+ self = this,
+ off = url.indexOf(" ");
+
+ if ( off >= 0 ) {
+ selector = url.slice( off, url.length );
+ url = url.slice( 0, off );
+ }
+
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+
+ // We assume that it's the callback
+ callback = params;
+ params = undefined;
+
+ // Otherwise, build a param string
+ } else if ( params && typeof params === "object" ) {
+ type = "POST";
+ }
+
+ // If we have elements to modify, make the request
+ if ( self.length > 0 ) {
+ jQuery.ajax({
+ url: url,
+
+ // if "type" variable is undefined, then "GET" method will be used
+ type: type,
+ dataType: "html",
+ data: params
+ }).done(function( responseText ) {
+
+ // Save response for use in complete callback
+ response = arguments;
+
+ self.html( selector ?
+
+ // If a selector was specified, locate the right elements in a dummy div
+ // Exclude scripts to avoid IE 'Permission Denied' errors
+ jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
+
+ // Otherwise use the full result
+ responseText );
+
+ }).complete( callback && function( jqXHR, status ) {
+ self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
+ });
+ }
+
+ return this;
+};
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
+ jQuery.fn[ type ] = function( fn ){
+ return this.on( type, fn );
+ };
+});
+
+jQuery.each( [ "get", "post" ], function( i, method ) {
+ jQuery[ method ] = function( url, data, callback, type ) {
+ // shift arguments if data argument was omitted
+ if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
+ callback = data;
+ data = undefined;
+ }
+
+ return jQuery.ajax({
+ url: url,
+ type: method,
+ dataType: type,
+ data: data,
+ success: callback
+ });
+ };
+});
+
+jQuery.extend({
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+ etag: {},
+
+ ajaxSettings: {
+ url: ajaxLocation,
+ type: "GET",
+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
+ global: true,
+ processData: true,
+ async: true,
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",
+ /*
+ timeout: 0,
+ data: null,
+ dataType: null,
+ username: null,
+ password: null,
+ cache: null,
+ throws: false,
+ traditional: false,
+ headers: {},
+ */
+
+ accepts: {
+ "*": allTypes,
+ text: "text/plain",
+ html: "text/html",
+ xml: "application/xml, text/xml",
+ json: "application/json, text/javascript"
+ },
+
+ contents: {
+ xml: /xml/,
+ html: /html/,
+ json: /json/
+ },
+
+ responseFields: {
+ xml: "responseXML",
+ text: "responseText"
+ },
+
+ // Data converters
+ // Keys separate source (or catchall "*") and destination types with a single space
+ converters: {
+
+ // Convert anything to text
+ "* text": window.String,
+
+ // Text to html (true = no transformation)
+ "text html": true,
+
+ // Evaluate text as a json expression
+ "text json": jQuery.parseJSON,
+
+ // Parse text as xml
+ "text xml": jQuery.parseXML
+ },
+
+ // For options that shouldn't be deep extended:
+ // you can add your own custom options here if
+ // and when you create one that shouldn't be
+ // deep extended (see ajaxExtend)
+ flatOptions: {
+ url: true,
+ context: true
+ }
+ },
+
+ // Creates a full fledged settings object into target
+ // with both ajaxSettings and settings fields.
+ // If target is omitted, writes into ajaxSettings.
+ ajaxSetup: function( target, settings ) {
+ return settings ?
+
+ // Building a settings object
+ ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
+
+ // Extending ajaxSettings
+ ajaxExtend( jQuery.ajaxSettings, target );
+ },
+
+ ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
+ ajaxTransport: addToPrefiltersOrTransports( transports ),
+
+ // Main method
+ ajax: function( url, options ) {
+
+ // If url is an object, simulate pre-1.5 signature
+ if ( typeof url === "object" ) {
+ options = url;
+ url = undefined;
+ }
+
+ // Force options to be an object
+ options = options || {};
+
+ var transport,
+ // URL without anti-cache param
+ cacheURL,
+ // Response headers
+ responseHeadersString,
+ responseHeaders,
+ // timeout handle
+ timeoutTimer,
+ // Cross-domain detection vars
+ parts,
+ // To know if global events are to be dispatched
+ fireGlobals,
+ // Loop variable
+ i,
+ // Create the final options object
+ s = jQuery.ajaxSetup( {}, options ),
+ // Callbacks context
+ callbackContext = s.context || s,
+ // Context for global events is callbackContext if it is a DOM node or jQuery collection
+ globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
+ jQuery( callbackContext ) :
+ jQuery.event,
+ // Deferreds
+ deferred = jQuery.Deferred(),
+ completeDeferred = jQuery.Callbacks("once memory"),
+ // Status-dependent callbacks
+ statusCode = s.statusCode || {},
+ // Headers (they are sent all at once)
+ requestHeaders = {},
+ requestHeadersNames = {},
+ // The jqXHR state
+ state = 0,
+ // Default abort message
+ strAbort = "canceled",
+ // Fake xhr
+ jqXHR = {
+ readyState: 0,
+
+ // Builds headers hashtable if needed
+ getResponseHeader: function( key ) {
+ var match;
+ if ( state === 2 ) {
+ if ( !responseHeaders ) {
+ responseHeaders = {};
+ while ( (match = rheaders.exec( responseHeadersString )) ) {
+ responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
+ }
+ }
+ match = responseHeaders[ key.toLowerCase() ];
+ }
+ return match == null ? null : match;
+ },
+
+ // Raw string
+ getAllResponseHeaders: function() {
+ return state === 2 ? responseHeadersString : null;
+ },
+
+ // Caches the header
+ setRequestHeader: function( name, value ) {
+ var lname = name.toLowerCase();
+ if ( !state ) {
+ name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
+ requestHeaders[ name ] = value;
+ }
+ return this;
+ },
+
+ // Overrides response content-type header
+ overrideMimeType: function( type ) {
+ if ( !state ) {
+ s.mimeType = type;
+ }
+ return this;
+ },
+
+ // Status-dependent callbacks
+ statusCode: function( map ) {
+ var code;
+ if ( map ) {
+ if ( state < 2 ) {
+ for ( code in map ) {
+ // Lazy-add the new callback in a way that preserves old ones
+ statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
+ }
+ } else {
+ // Execute the appropriate callbacks
+ jqXHR.always( map[ jqXHR.status ] );
+ }
+ }
+ return this;
+ },
+
+ // Cancel the request
+ abort: function( statusText ) {
+ var finalText = statusText || strAbort;
+ if ( transport ) {
+ transport.abort( finalText );
+ }
+ done( 0, finalText );
+ return this;
+ }
+ };
+
+ // Attach deferreds
+ deferred.promise( jqXHR ).complete = completeDeferred.add;
+ jqXHR.success = jqXHR.done;
+ jqXHR.error = jqXHR.fail;
+
+ // Remove hash character (#7531: and string promotion)
+ // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
+ // Handle falsy url in the settings object (#10093: consistency with old signature)
+ // We also use the url parameter if available
+ s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
+
+ // Alias method option to type as per ticket #12004
+ s.type = options.method || options.type || s.method || s.type;
+
+ // Extract dataTypes list
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
+
+ // A cross-domain request is in order when we have a protocol:host:port mismatch
+ if ( s.crossDomain == null ) {
+ parts = rurl.exec( s.url.toLowerCase() );
+ s.crossDomain = !!( parts &&
+ ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
+ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
+ ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
+ );
+ }
+
+ // Convert data if not already a string
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
+ s.data = jQuery.param( s.data, s.traditional );
+ }
+
+ // Apply prefilters
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
+
+ // If request was aborted inside a prefilter, stop there
+ if ( state === 2 ) {
+ return jqXHR;
+ }
+
+ // We can fire global events as of now if asked to
+ fireGlobals = s.global;
+
+ // Watch for a new set of requests
+ if ( fireGlobals && jQuery.active++ === 0 ) {
+ jQuery.event.trigger("ajaxStart");
+ }
+
+ // Uppercase the type
+ s.type = s.type.toUpperCase();
+
+ // Determine if request has content
+ s.hasContent = !rnoContent.test( s.type );
+
+ // Save the URL in case we're toying with the If-Modified-Since
+ // and/or If-None-Match header later on
+ cacheURL = s.url;
+
+ // More options handling for requests with no content
+ if ( !s.hasContent ) {
+
+ // If data is available, append data to url
+ if ( s.data ) {
+ cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
+ // #9682: remove data so that it's not used in an eventual retry
+ delete s.data;
+ }
+
+ // Add anti-cache in url if needed
+ if ( s.cache === false ) {
+ s.url = rts.test( cacheURL ) ?
+
+ // If there is already a '_' parameter, set its value
+ cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
+
+ // Otherwise add one to the end
+ cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
+ }
+ }
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ if ( jQuery.lastModified[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
+ }
+ if ( jQuery.etag[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
+ }
+ }
+
+ // Set the correct header, if data is being sent
+ if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
+ jqXHR.setRequestHeader( "Content-Type", s.contentType );
+ }
+
+ // Set the Accepts header for the server, depending on the dataType
+ jqXHR.setRequestHeader(
+ "Accept",
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
+ s.accepts[ "*" ]
+ );
+
+ // Check for headers option
+ for ( i in s.headers ) {
+ jqXHR.setRequestHeader( i, s.headers[ i ] );
+ }
+
+ // Allow custom headers/mimetypes and early abort
+ if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
+ // Abort if not done already and return
+ return jqXHR.abort();
+ }
+
+ // aborting is no longer a cancellation
+ strAbort = "abort";
+
+ // Install callbacks on deferreds
+ for ( i in { success: 1, error: 1, complete: 1 } ) {
+ jqXHR[ i ]( s[ i ] );
+ }
+
+ // Get transport
+ transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
+
+ // If no transport, we auto-abort
+ if ( !transport ) {
+ done( -1, "No Transport" );
+ } else {
+ jqXHR.readyState = 1;
+
+ // Send global event
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
+ }
+ // Timeout
+ if ( s.async && s.timeout > 0 ) {
+ timeoutTimer = setTimeout(function() {
+ jqXHR.abort("timeout");
+ }, s.timeout );
+ }
+
+ try {
+ state = 1;
+ transport.send( requestHeaders, done );
+ } catch ( e ) {
+ // Propagate exception as error if not done
+ if ( state < 2 ) {
+ done( -1, e );
+ // Simply rethrow otherwise
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ // Callback for when everything is done
+ function done( status, nativeStatusText, responses, headers ) {
+ var isSuccess, success, error, response, modified,
+ statusText = nativeStatusText;
+
+ // Called once
+ if ( state === 2 ) {
+ return;
+ }
+
+ // State is "done" now
+ state = 2;
+
+ // Clear timeout if it exists
+ if ( timeoutTimer ) {
+ clearTimeout( timeoutTimer );
+ }
+
+ // Dereference transport for early garbage collection
+ // (no matter how long the jqXHR object will be used)
+ transport = undefined;
+
+ // Cache response headers
+ responseHeadersString = headers || "";
+
+ // Set readyState
+ jqXHR.readyState = status > 0 ? 4 : 0;
+
+ // Get response data
+ if ( responses ) {
+ response = ajaxHandleResponses( s, jqXHR, responses );
+ }
+
+ // If successful, handle type chaining
+ if ( status >= 200 && status < 300 || status === 304 ) {
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ modified = jqXHR.getResponseHeader("Last-Modified");
+ if ( modified ) {
+ jQuery.lastModified[ cacheURL ] = modified;
+ }
+ modified = jqXHR.getResponseHeader("etag");
+ if ( modified ) {
+ jQuery.etag[ cacheURL ] = modified;
+ }
+ }
+
+ // If not modified
+ if ( status === 304 ) {
+ isSuccess = true;
+ statusText = "notmodified";
+
+ // If we have data
+ } else {
+ isSuccess = ajaxConvert( s, response );
+ statusText = isSuccess.state;
+ success = isSuccess.data;
+ error = isSuccess.error;
+ isSuccess = !error;
+ }
+ } else {
+ // We extract error from statusText
+ // then normalize statusText and status for non-aborts
+ error = statusText;
+ if ( status || !statusText ) {
+ statusText = "error";
+ if ( status < 0 ) {
+ status = 0;
+ }
+ }
+ }
+
+ // Set data for the fake xhr object
+ jqXHR.status = status;
+ jqXHR.statusText = ( nativeStatusText || statusText ) + "";
+
+ // Success/Error
+ if ( isSuccess ) {
+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
+ } else {
+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
+ }
+
+ // Status-dependent callbacks
+ jqXHR.statusCode( statusCode );
+ statusCode = undefined;
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
+ [ jqXHR, s, isSuccess ? success : error ] );
+ }
+
+ // Complete
+ completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
+ // Handle the global AJAX counter
+ if ( !( --jQuery.active ) ) {
+ jQuery.event.trigger("ajaxStop");
+ }
+ }
+ }
+
+ return jqXHR;
+ },
+
+ getScript: function( url, callback ) {
+ return jQuery.get( url, undefined, callback, "script" );
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get( url, data, callback, "json" );
+ }
+});
+
+/* Handles responses to an ajax request:
+ * - sets all responseXXX fields accordingly
+ * - finds the right dataType (mediates between content-type and expected dataType)
+ * - returns the corresponding response
+ */
+function ajaxHandleResponses( s, jqXHR, responses ) {
+
+ var ct, type, finalDataType, firstDataType,
+ contents = s.contents,
+ dataTypes = s.dataTypes,
+ responseFields = s.responseFields;
+
+ // Fill responseXXX fields
+ for ( type in responseFields ) {
+ if ( type in responses ) {
+ jqXHR[ responseFields[type] ] = responses[ type ];
+ }
+ }
+
+ // Remove auto dataType and get content-type in the process
+ while( dataTypes[ 0 ] === "*" ) {
+ dataTypes.shift();
+ if ( ct === undefined ) {
+ ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
+ }
+ }
+
+ // Check if we're dealing with a known content-type
+ if ( ct ) {
+ for ( type in contents ) {
+ if ( contents[ type ] && contents[ type ].test( ct ) ) {
+ dataTypes.unshift( type );
+ break;
+ }
+ }
+ }
+
+ // Check to see if we have a response for the expected dataType
+ if ( dataTypes[ 0 ] in responses ) {
+ finalDataType = dataTypes[ 0 ];
+ } else {
+ // Try convertible dataTypes
+ for ( type in responses ) {
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
+ finalDataType = type;
+ break;
+ }
+ if ( !firstDataType ) {
+ firstDataType = type;
+ }
+ }
+ // Or just use first one
+ finalDataType = finalDataType || firstDataType;
+ }
+
+ // If we found a dataType
+ // We add the dataType to the list if needed
+ // and return the corresponding response
+ if ( finalDataType ) {
+ if ( finalDataType !== dataTypes[ 0 ] ) {
+ dataTypes.unshift( finalDataType );
+ }
+ return responses[ finalDataType ];
+ }
+}
+
+// Chain conversions given the request and the original response
+function ajaxConvert( s, response ) {
+
+ var conv, conv2, current, tmp,
+ converters = {},
+ i = 0,
+ // Work with a copy of dataTypes in case we need to modify it for conversion
+ dataTypes = s.dataTypes.slice(),
+ prev = dataTypes[ 0 ];
+
+ // Apply the dataFilter if provided
+ if ( s.dataFilter ) {
+ response = s.dataFilter( response, s.dataType );
+ }
+
+ // Create converters map with lowercased keys
+ if ( dataTypes[ 1 ] ) {
+ for ( conv in s.converters ) {
+ converters[ conv.toLowerCase() ] = s.converters[ conv ];
+ }
+ }
+
+ // Convert to each sequential dataType, tolerating list modification
+ for ( ; (current = dataTypes[++i]); ) {
+
+ // There's only work to do if current dataType is non-auto
+ if ( current !== "*" ) {
+
+ // Convert response if prev dataType is non-auto and differs from current
+ if ( prev !== "*" && prev !== current ) {
+
+ // Seek a direct converter
+ conv = converters[ prev + " " + current ] || converters[ "* " + current ];
+
+ // If none found, seek a pair
+ if ( !conv ) {
+ for ( conv2 in converters ) {
+
+ // If conv2 outputs current
+ tmp = conv2.split(" ");
+ if ( tmp[ 1 ] === current ) {
+
+ // If prev can be converted to accepted input
+ conv = converters[ prev + " " + tmp[ 0 ] ] ||
+ converters[ "* " + tmp[ 0 ] ];
+ if ( conv ) {
+ // Condense equivalence converters
+ if ( conv === true ) {
+ conv = converters[ conv2 ];
+
+ // Otherwise, insert the intermediate dataType
+ } else if ( converters[ conv2 ] !== true ) {
+ current = tmp[ 0 ];
+ dataTypes.splice( i--, 0, current );
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ // Apply converter (if not an equivalence)
+ if ( conv !== true ) {
+
+ // Unless errors are allowed to bubble, catch and return them
+ if ( conv && s["throws"] ) {
+ response = conv( response );
+ } else {
+ try {
+ response = conv( response );
+ } catch ( e ) {
+ return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
+ }
+ }
+ }
+ }
+
+ // Update prev for next iteration
+ prev = current;
+ }
+ }
+
+ return { state: "success", data: response };
+}
+// Install script dataType
+jQuery.ajaxSetup({
+ accepts: {
+ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
+ },
+ contents: {
+ script: /(?:java|ecma)script/
+ },
+ converters: {
+ "text script": function( text ) {
+ jQuery.globalEval( text );
+ return text;
+ }
+ }
+});
+
+// Handle cache's special case and global
+jQuery.ajaxPrefilter( "script", function( s ) {
+ if ( s.cache === undefined ) {
+ s.cache = false;
+ }
+ if ( s.crossDomain ) {
+ s.type = "GET";
+ s.global = false;
+ }
+});
+
+// Bind script tag hack transport
+jQuery.ajaxTransport( "script", function(s) {
+
+ // This transport only deals with cross domain requests
+ if ( s.crossDomain ) {
+
+ var script,
+ head = document.head || jQuery("head")[0] || document.documentElement;
+
+ return {
+
+ send: function( _, callback ) {
+
+ script = document.createElement("script");
+
+ script.async = true;
+
+ if ( s.scriptCharset ) {
+ script.charset = s.scriptCharset;
+ }
+
+ script.src = s.url;
+
+ // Attach handlers for all browsers
+ script.onload = script.onreadystatechange = function( _, isAbort ) {
+
+ if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
+
+ // Handle memory leak in IE
+ script.onload = script.onreadystatechange = null;
+
+ // Remove the script
+ if ( script.parentNode ) {
+ script.parentNode.removeChild( script );
+ }
+
+ // Dereference the script
+ script = null;
+
+ // Callback if not abort
+ if ( !isAbort ) {
+ callback( 200, "success" );
+ }
+ }
+ };
+
+ // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
+ // Use native DOM manipulation to avoid our domManip AJAX trickery
+ head.insertBefore( script, head.firstChild );
+ },
+
+ abort: function() {
+ if ( script ) {
+ script.onload( undefined, true );
+ }
+ }
+ };
+ }
+});
+var oldCallbacks = [],
+ rjsonp = /(=)\?(?=&|$)|\?\?/;
+
+// Default jsonp settings
+jQuery.ajaxSetup({
+ jsonp: "callback",
+ jsonpCallback: function() {
+ var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
+ this[ callback ] = true;
+ return callback;
+ }
+});
+
+// Detect, normalize options and install callbacks for jsonp requests
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
+
+ var callbackName, overwritten, responseContainer,
+ jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
+ "url" :
+ typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
+ );
+
+ // Handle iff the expected data type is "jsonp" or we have a parameter to set
+ if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
+
+ // Get callback name, remembering preexisting value associated with it
+ callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
+ s.jsonpCallback() :
+ s.jsonpCallback;
+
+ // Insert callback into url or form data
+ if ( jsonProp ) {
+ s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
+ } else if ( s.jsonp !== false ) {
+ s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
+ }
+
+ // Use data converter to retrieve json after script execution
+ s.converters["script json"] = function() {
+ if ( !responseContainer ) {
+ jQuery.error( callbackName + " was not called" );
+ }
+ return responseContainer[ 0 ];
+ };
+
+ // force json dataType
+ s.dataTypes[ 0 ] = "json";
+
+ // Install callback
+ overwritten = window[ callbackName ];
+ window[ callbackName ] = function() {
+ responseContainer = arguments;
+ };
+
+ // Clean-up function (fires after converters)
+ jqXHR.always(function() {
+ // Restore preexisting value
+ window[ callbackName ] = overwritten;
+
+ // Save back as free
+ if ( s[ callbackName ] ) {
+ // make sure that re-using the options doesn't screw things around
+ s.jsonpCallback = originalSettings.jsonpCallback;
+
+ // save the callback name for future use
+ oldCallbacks.push( callbackName );
+ }
+
+ // Call if it was a function and we have a response
+ if ( responseContainer && jQuery.isFunction( overwritten ) ) {
+ overwritten( responseContainer[ 0 ] );
+ }
+
+ responseContainer = overwritten = undefined;
+ });
+
+ // Delegate to script
+ return "script";
+ }
+});
+var xhrCallbacks, xhrSupported,
+ xhrId = 0,
+ // #5280: Internet Explorer will keep connections alive if we don't abort on unload
+ xhrOnUnloadAbort = window.ActiveXObject && function() {
+ // Abort all pending requests
+ var key;
+ for ( key in xhrCallbacks ) {
+ xhrCallbacks[ key ]( undefined, true );
+ }
+ };
+
+// Functions to create xhrs
+function createStandardXHR() {
+ try {
+ return new window.XMLHttpRequest();
+ } catch( e ) {}
+}
+
+function createActiveXHR() {
+ try {
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
+ } catch( e ) {}
+}
+
+// Create the request object
+// (This is still attached to ajaxSettings for backward compatibility)
+jQuery.ajaxSettings.xhr = window.ActiveXObject ?
+ /* Microsoft failed to properly
+ * implement the XMLHttpRequest in IE7 (can't request local files),
+ * so we use the ActiveXObject when it is available
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
+ * we need a fallback.
+ */
+ function() {
+ return !this.isLocal && createStandardXHR() || createActiveXHR();
+ } :
+ // For all other browsers, use the standard XMLHttpRequest object
+ createStandardXHR;
+
+// Determine support properties
+xhrSupported = jQuery.ajaxSettings.xhr();
+jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
+xhrSupported = jQuery.support.ajax = !!xhrSupported;
+
+// Create transport if the browser can provide an xhr
+if ( xhrSupported ) {
+
+ jQuery.ajaxTransport(function( s ) {
+ // Cross domain only allowed if supported through XMLHttpRequest
+ if ( !s.crossDomain || jQuery.support.cors ) {
+
+ var callback;
+
+ return {
+ send: function( headers, complete ) {
+
+ // Get a new xhr
+ var handle, i,
+ xhr = s.xhr();
+
+ // Open the socket
+ // Passing null username, generates a login popup on Opera (#2865)
+ if ( s.username ) {
+ xhr.open( s.type, s.url, s.async, s.username, s.password );
+ } else {
+ xhr.open( s.type, s.url, s.async );
+ }
+
+ // Apply custom fields if provided
+ if ( s.xhrFields ) {
+ for ( i in s.xhrFields ) {
+ xhr[ i ] = s.xhrFields[ i ];
+ }
+ }
+
+ // Override mime type if needed
+ if ( s.mimeType && xhr.overrideMimeType ) {
+ xhr.overrideMimeType( s.mimeType );
+ }
+
+ // X-Requested-With header
+ // For cross-domain requests, seeing as conditions for a preflight are
+ // akin to a jigsaw puzzle, we simply never set it to be sure.
+ // (it can always be set on a per-request basis or even using ajaxSetup)
+ // For same-domain requests, won't change header if already provided.
+ if ( !s.crossDomain && !headers["X-Requested-With"] ) {
+ headers["X-Requested-With"] = "XMLHttpRequest";
+ }
+
+ // Need an extra try/catch for cross domain requests in Firefox 3
+ try {
+ for ( i in headers ) {
+ xhr.setRequestHeader( i, headers[ i ] );
+ }
+ } catch( err ) {}
+
+ // Do send the request
+ // This may raise an exception which is actually
+ // handled in jQuery.ajax (so no try/catch here)
+ xhr.send( ( s.hasContent && s.data ) || null );
+
+ // Listener
+ callback = function( _, isAbort ) {
+
+ var status,
+ statusText,
+ responseHeaders,
+ responses,
+ xml;
+
+ // Firefox throws exceptions when accessing properties
+ // of an xhr when a network error occurred
+ // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
+ try {
+
+ // Was never called and is aborted or complete
+ if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
+
+ // Only called once
+ callback = undefined;
+
+ // Do not keep as active anymore
+ if ( handle ) {
+ xhr.onreadystatechange = jQuery.noop;
+ if ( xhrOnUnloadAbort ) {
+ delete xhrCallbacks[ handle ];
+ }
+ }
+
+ // If it's an abort
+ if ( isAbort ) {
+ // Abort it manually if needed
+ if ( xhr.readyState !== 4 ) {
+ xhr.abort();
+ }
+ } else {
+ responses = {};
+ status = xhr.status;
+ xml = xhr.responseXML;
+ responseHeaders = xhr.getAllResponseHeaders();
+
+ // Construct response list
+ if ( xml && xml.documentElement /* #4958 */ ) {
+ responses.xml = xml;
+ }
+
+ // When requesting binary data, IE6-9 will throw an exception
+ // on any attempt to access responseText (#11426)
+ if ( typeof xhr.responseText === "string" ) {
+ responses.text = xhr.responseText;
+ }
+
+ // Firefox throws an exception when accessing
+ // statusText for faulty cross-domain requests
+ try {
+ statusText = xhr.statusText;
+ } catch( e ) {
+ // We normalize with Webkit giving an empty statusText
+ statusText = "";
+ }
+
+ // Filter status for non standard behaviors
+
+ // If the request is local and we have data: assume a success
+ // (success with no data won't get notified, that's the best we
+ // can do given current implementations)
+ if ( !status && s.isLocal && !s.crossDomain ) {
+ status = responses.text ? 200 : 404;
+ // IE - #1450: sometimes returns 1223 when it should be 204
+ } else if ( status === 1223 ) {
+ status = 204;
+ }
+ }
+ }
+ } catch( firefoxAccessException ) {
+ if ( !isAbort ) {
+ complete( -1, firefoxAccessException );
+ }
+ }
+
+ // Call complete if needed
+ if ( responses ) {
+ complete( status, statusText, responses, responseHeaders );
+ }
+ };
+
+ if ( !s.async ) {
+ // if we're in sync mode we fire the callback
+ callback();
+ } else if ( xhr.readyState === 4 ) {
+ // (IE6 & IE7) if it's in cache and has been
+ // retrieved directly we need to fire the callback
+ setTimeout( callback );
+ } else {
+ handle = ++xhrId;
+ if ( xhrOnUnloadAbort ) {
+ // Create the active xhrs callbacks list if needed
+ // and attach the unload handler
+ if ( !xhrCallbacks ) {
+ xhrCallbacks = {};
+ jQuery( window ).unload( xhrOnUnloadAbort );
+ }
+ // Add to list of active xhrs callbacks
+ xhrCallbacks[ handle ] = callback;
+ }
+ xhr.onreadystatechange = callback;
+ }
+ },
+
+ abort: function() {
+ if ( callback ) {
+ callback( undefined, true );
+ }
+ }
+ };
+ }
+ });
+}
+var fxNow, timerId,
+ rfxtypes = /^(?:toggle|show|hide)$/,
+ rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
+ rrun = /queueHooks$/,
+ animationPrefilters = [ defaultPrefilter ],
+ tweeners = {
+ "*": [function( prop, value ) {
+ var end, unit,
+ tween = this.createTween( prop, value ),
+ parts = rfxnum.exec( value ),
+ target = tween.cur(),
+ start = +target || 0,
+ scale = 1,
+ maxIterations = 20;
+
+ if ( parts ) {
+ end = +parts[2];
+ unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+
+ // We need to compute starting value
+ if ( unit !== "px" && start ) {
+ // Iteratively approximate from a nonzero starting point
+ // Prefer the current property, because this process will be trivial if it uses the same units
+ // Fallback to end or a simple constant
+ start = jQuery.css( tween.elem, prop, true ) || end || 1;
+
+ do {
+ // If previous iteration zeroed out, double until we get *something*
+ // Use a string for doubling factor so we don't accidentally see scale as unchanged below
+ scale = scale || ".5";
+
+ // Adjust and apply
+ start = start / scale;
+ jQuery.style( tween.elem, prop, start + unit );
+
+ // Update scale, tolerating zero or NaN from tween.cur()
+ // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
+ } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
+ }
+
+ tween.unit = unit;
+ tween.start = start;
+ // If a +=/-= token was provided, we're doing a relative animation
+ tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
+ }
+ return tween;
+ }]
+ };
+
+// Animations created synchronously will run synchronously
+function createFxNow() {
+ setTimeout(function() {
+ fxNow = undefined;
+ });
+ return ( fxNow = jQuery.now() );
+}
+
+function createTweens( animation, props ) {
+ jQuery.each( props, function( prop, value ) {
+ var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
+ index = 0,
+ length = collection.length;
+ for ( ; index < length; index++ ) {
+ if ( collection[ index ].call( animation, prop, value ) ) {
+
+ // we're done with this property
+ return;
+ }
+ }
+ });
+}
+
+function Animation( elem, properties, options ) {
+ var result,
+ stopped,
+ index = 0,
+ length = animationPrefilters.length,
+ deferred = jQuery.Deferred().always( function() {
+ // don't match elem in the :animated selector
+ delete tick.elem;
+ }),
+ tick = function() {
+ if ( stopped ) {
+ return false;
+ }
+ var currentTime = fxNow || createFxNow(),
+ remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
+ // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
+ temp = remaining / animation.duration || 0,
+ percent = 1 - temp,
+ index = 0,
+ length = animation.tweens.length;
+
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( percent );
+ }
+
+ deferred.notifyWith( elem, [ animation, percent, remaining ]);
+
+ if ( percent < 1 && length ) {
+ return remaining;
+ } else {
+ deferred.resolveWith( elem, [ animation ] );
+ return false;
+ }
+ },
+ animation = deferred.promise({
+ elem: elem,
+ props: jQuery.extend( {}, properties ),
+ opts: jQuery.extend( true, { specialEasing: {} }, options ),
+ originalProperties: properties,
+ originalOptions: options,
+ startTime: fxNow || createFxNow(),
+ duration: options.duration,
+ tweens: [],
+ createTween: function( prop, end ) {
+ var tween = jQuery.Tween( elem, animation.opts, prop, end,
+ animation.opts.specialEasing[ prop ] || animation.opts.easing );
+ animation.tweens.push( tween );
+ return tween;
+ },
+ stop: function( gotoEnd ) {
+ var index = 0,
+ // if we are going to the end, we want to run all the tweens
+ // otherwise we skip this part
+ length = gotoEnd ? animation.tweens.length : 0;
+ if ( stopped ) {
+ return this;
+ }
+ stopped = true;
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( 1 );
+ }
+
+ // resolve when we played the last frame
+ // otherwise, reject
+ if ( gotoEnd ) {
+ deferred.resolveWith( elem, [ animation, gotoEnd ] );
+ } else {
+ deferred.rejectWith( elem, [ animation, gotoEnd ] );
+ }
+ return this;
+ }
+ }),
+ props = animation.props;
+
+ propFilter( props, animation.opts.specialEasing );
+
+ for ( ; index < length ; index++ ) {
+ result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
+ if ( result ) {
+ return result;
+ }
+ }
+
+ createTweens( animation, props );
+
+ if ( jQuery.isFunction( animation.opts.start ) ) {
+ animation.opts.start.call( elem, animation );
+ }
+
+ jQuery.fx.timer(
+ jQuery.extend( tick, {
+ elem: elem,
+ anim: animation,
+ queue: animation.opts.queue
+ })
+ );
+
+ // attach callbacks from options
+ return animation.progress( animation.opts.progress )
+ .done( animation.opts.done, animation.opts.complete )
+ .fail( animation.opts.fail )
+ .always( animation.opts.always );
+}
+
+function propFilter( props, specialEasing ) {
+ var index, name, easing, value, hooks;
+
+ // camelCase, specialEasing and expand cssHook pass
+ for ( index in props ) {
+ name = jQuery.camelCase( index );
+ easing = specialEasing[ name ];
+ value = props[ index ];
+ if ( jQuery.isArray( value ) ) {
+ easing = value[ 1 ];
+ value = props[ index ] = value[ 0 ];
+ }
+
+ if ( index !== name ) {
+ props[ name ] = value;
+ delete props[ index ];
+ }
+
+ hooks = jQuery.cssHooks[ name ];
+ if ( hooks && "expand" in hooks ) {
+ value = hooks.expand( value );
+ delete props[ name ];
+
+ // not quite $.extend, this wont overwrite keys already present.
+ // also - reusing 'index' from above because we have the correct "name"
+ for ( index in value ) {
+ if ( !( index in props ) ) {
+ props[ index ] = value[ index ];
+ specialEasing[ index ] = easing;
+ }
+ }
+ } else {
+ specialEasing[ name ] = easing;
+ }
+ }
+}
+
+jQuery.Animation = jQuery.extend( Animation, {
+
+ tweener: function( props, callback ) {
+ if ( jQuery.isFunction( props ) ) {
+ callback = props;
+ props = [ "*" ];
+ } else {
+ props = props.split(" ");
+ }
+
+ var prop,
+ index = 0,
+ length = props.length;
+
+ for ( ; index < length ; index++ ) {
+ prop = props[ index ];
+ tweeners[ prop ] = tweeners[ prop ] || [];
+ tweeners[ prop ].unshift( callback );
+ }
+ },
+
+ prefilter: function( callback, prepend ) {
+ if ( prepend ) {
+ animationPrefilters.unshift( callback );
+ } else {
+ animationPrefilters.push( callback );
+ }
+ }
+});
+
+function defaultPrefilter( elem, props, opts ) {
+ /*jshint validthis:true */
+ var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
+ anim = this,
+ style = elem.style,
+ orig = {},
+ handled = [],
+ hidden = elem.nodeType && isHidden( elem );
+
+ // handle queue: false promises
+ if ( !opts.queue ) {
+ hooks = jQuery._queueHooks( elem, "fx" );
+ if ( hooks.unqueued == null ) {
+ hooks.unqueued = 0;
+ oldfire = hooks.empty.fire;
+ hooks.empty.fire = function() {
+ if ( !hooks.unqueued ) {
+ oldfire();
+ }
+ };
+ }
+ hooks.unqueued++;
+
+ anim.always(function() {
+ // doing this makes sure that the complete handler will be called
+ // before this completes
+ anim.always(function() {
+ hooks.unqueued--;
+ if ( !jQuery.queue( elem, "fx" ).length ) {
+ hooks.empty.fire();
+ }
+ });
+ });
+ }
+
+ // height/width overflow pass
+ if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
+ // Make sure that nothing sneaks out
+ // Record all 3 overflow attributes because IE does not
+ // change the overflow attribute when overflowX and
+ // overflowY are set to the same value
+ opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
+
+ // Set display property to inline-block for height/width
+ // animations on inline elements that are having width/height animated
+ if ( jQuery.css( elem, "display" ) === "inline" &&
+ jQuery.css( elem, "float" ) === "none" ) {
+
+ // inline-level elements accept inline-block;
+ // block-level elements need to be inline with layout
+ if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
+ style.display = "inline-block";
+
+ } else {
+ style.zoom = 1;
+ }
+ }
+ }
+
+ if ( opts.overflow ) {
+ style.overflow = "hidden";
+ if ( !jQuery.support.shrinkWrapBlocks ) {
+ anim.done(function() {
+ style.overflow = opts.overflow[ 0 ];
+ style.overflowX = opts.overflow[ 1 ];
+ style.overflowY = opts.overflow[ 2 ];
+ });
+ }
+ }
+
+
+ // show/hide pass
+ for ( index in props ) {
+ value = props[ index ];
+ if ( rfxtypes.exec( value ) ) {
+ delete props[ index ];
+ toggle = toggle || value === "toggle";
+ if ( value === ( hidden ? "hide" : "show" ) ) {
+ continue;
+ }
+ handled.push( index );
+ }
+ }
+
+ length = handled.length;
+ if ( length ) {
+ dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
+ if ( "hidden" in dataShow ) {
+ hidden = dataShow.hidden;
+ }
+
+ // store state if its toggle - enables .stop().toggle() to "reverse"
+ if ( toggle ) {
+ dataShow.hidden = !hidden;
+ }
+ if ( hidden ) {
+ jQuery( elem ).show();
+ } else {
+ anim.done(function() {
+ jQuery( elem ).hide();
+ });
+ }
+ anim.done(function() {
+ var prop;
+ jQuery._removeData( elem, "fxshow" );
+ for ( prop in orig ) {
+ jQuery.style( elem, prop, orig[ prop ] );
+ }
+ });
+ for ( index = 0 ; index < length ; index++ ) {
+ prop = handled[ index ];
+ tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
+ orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
+
+ if ( !( prop in dataShow ) ) {
+ dataShow[ prop ] = tween.start;
+ if ( hidden ) {
+ tween.end = tween.start;
+ tween.start = prop === "width" || prop === "height" ? 1 : 0;
+ }
+ }
+ }
+ }
+}
+
+function Tween( elem, options, prop, end, easing ) {
+ return new Tween.prototype.init( elem, options, prop, end, easing );
+}
+jQuery.Tween = Tween;
+
+Tween.prototype = {
+ constructor: Tween,
+ init: function( elem, options, prop, end, easing, unit ) {
+ this.elem = elem;
+ this.prop = prop;
+ this.easing = easing || "swing";
+ this.options = options;
+ this.start = this.now = this.cur();
+ this.end = end;
+ this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+ },
+ cur: function() {
+ var hooks = Tween.propHooks[ this.prop ];
+
+ return hooks && hooks.get ?
+ hooks.get( this ) :
+ Tween.propHooks._default.get( this );
+ },
+ run: function( percent ) {
+ var eased,
+ hooks = Tween.propHooks[ this.prop ];
+
+ if ( this.options.duration ) {
+ this.pos = eased = jQuery.easing[ this.easing ](
+ percent, this.options.duration * percent, 0, 1, this.options.duration
+ );
+ } else {
+ this.pos = eased = percent;
+ }
+ this.now = ( this.end - this.start ) * eased + this.start;
+
+ if ( this.options.step ) {
+ this.options.step.call( this.elem, this.now, this );
+ }
+
+ if ( hooks && hooks.set ) {
+ hooks.set( this );
+ } else {
+ Tween.propHooks._default.set( this );
+ }
+ return this;
+ }
+};
+
+Tween.prototype.init.prototype = Tween.prototype;
+
+Tween.propHooks = {
+ _default: {
+ get: function( tween ) {
+ var result;
+
+ if ( tween.elem[ tween.prop ] != null &&
+ (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
+ return tween.elem[ tween.prop ];
+ }
+
+ // passing a non empty string as a 3rd parameter to .css will automatically
+ // attempt a parseFloat and fallback to a string if the parse fails
+ // so, simple values such as "10px" are parsed to Float.
+ // complex values such as "rotate(1rad)" are returned as is.
+ result = jQuery.css( tween.elem, tween.prop, "auto" );
+ // Empty strings, null, undefined and "auto" are converted to 0.
+ return !result || result === "auto" ? 0 : result;
+ },
+ set: function( tween ) {
+ // use step hook for back compat - use cssHook if its there - use .style if its
+ // available and use plain properties where available
+ if ( jQuery.fx.step[ tween.prop ] ) {
+ jQuery.fx.step[ tween.prop ]( tween );
+ } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
+ jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
+ } else {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+ }
+};
+
+// Remove in 2.0 - this supports IE8's panic based approach
+// to setting things on disconnected nodes
+
+Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
+ set: function( tween ) {
+ if ( tween.elem.nodeType && tween.elem.parentNode ) {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+};
+
+jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
+ var cssFn = jQuery.fn[ name ];
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return speed == null || typeof speed === "boolean" ?
+ cssFn.apply( this, arguments ) :
+ this.animate( genFx( name, true ), speed, easing, callback );
+ };
+});
+
+jQuery.fn.extend({
+ fadeTo: function( speed, to, easing, callback ) {
+
+ // show any hidden elements after setting opacity to 0
+ return this.filter( isHidden ).css( "opacity", 0 ).show()
+
+ // animate to the value specified
+ .end().animate({ opacity: to }, speed, easing, callback );
+ },
+ animate: function( prop, speed, easing, callback ) {
+ var empty = jQuery.isEmptyObject( prop ),
+ optall = jQuery.speed( speed, easing, callback ),
+ doAnimation = function() {
+ // Operate on a copy of prop so per-property easing won't be lost
+ var anim = Animation( this, jQuery.extend( {}, prop ), optall );
+ doAnimation.finish = function() {
+ anim.stop( true );
+ };
+ // Empty animations, or finishing resolves immediately
+ if ( empty || jQuery._data( this, "finish" ) ) {
+ anim.stop( true );
+ }
+ };
+ doAnimation.finish = doAnimation;
+
+ return empty || optall.queue === false ?
+ this.each( doAnimation ) :
+ this.queue( optall.queue, doAnimation );
+ },
+ stop: function( type, clearQueue, gotoEnd ) {
+ var stopQueue = function( hooks ) {
+ var stop = hooks.stop;
+ delete hooks.stop;
+ stop( gotoEnd );
+ };
+
+ if ( typeof type !== "string" ) {
+ gotoEnd = clearQueue;
+ clearQueue = type;
+ type = undefined;
+ }
+ if ( clearQueue && type !== false ) {
+ this.queue( type || "fx", [] );
+ }
+
+ return this.each(function() {
+ var dequeue = true,
+ index = type != null && type + "queueHooks",
+ timers = jQuery.timers,
+ data = jQuery._data( this );
+
+ if ( index ) {
+ if ( data[ index ] && data[ index ].stop ) {
+ stopQueue( data[ index ] );
+ }
+ } else {
+ for ( index in data ) {
+ if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
+ stopQueue( data[ index ] );
+ }
+ }
+ }
+
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
+ timers[ index ].anim.stop( gotoEnd );
+ dequeue = false;
+ timers.splice( index, 1 );
+ }
+ }
+
+ // start the next in the queue if the last step wasn't forced
+ // timers currently will call their complete callbacks, which will dequeue
+ // but only if they were gotoEnd
+ if ( dequeue || !gotoEnd ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ finish: function( type ) {
+ if ( type !== false ) {
+ type = type || "fx";
+ }
+ return this.each(function() {
+ var index,
+ data = jQuery._data( this ),
+ queue = data[ type + "queue" ],
+ hooks = data[ type + "queueHooks" ],
+ timers = jQuery.timers,
+ length = queue ? queue.length : 0;
+
+ // enable finishing flag on private data
+ data.finish = true;
+
+ // empty the queue first
+ jQuery.queue( this, type, [] );
+
+ if ( hooks && hooks.cur && hooks.cur.finish ) {
+ hooks.cur.finish.call( this );
+ }
+
+ // look for any active animations, and finish them
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
+ timers[ index ].anim.stop( true );
+ timers.splice( index, 1 );
+ }
+ }
+
+ // look for any animations in the old queue and finish them
+ for ( index = 0; index < length; index++ ) {
+ if ( queue[ index ] && queue[ index ].finish ) {
+ queue[ index ].finish.call( this );
+ }
+ }
+
+ // turn off finishing flag
+ delete data.finish;
+ });
+ }
+});
+
+// Generate parameters to create a standard animation
+function genFx( type, includeWidth ) {
+ var which,
+ attrs = { height: type },
+ i = 0;
+
+ // if we include width, step value is 1 to do all cssExpand values,
+ // if we don't include width, step value is 2 to skip over Left and Right
+ includeWidth = includeWidth? 1 : 0;
+ for( ; i < 4 ; i += 2 - includeWidth ) {
+ which = cssExpand[ i ];
+ attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
+ }
+
+ if ( includeWidth ) {
+ attrs.opacity = attrs.width = type;
+ }
+
+ return attrs;
+}
+
+// Generate shortcuts for custom animations
+jQuery.each({
+ slideDown: genFx("show"),
+ slideUp: genFx("hide"),
+ slideToggle: genFx("toggle"),
+ fadeIn: { opacity: "show" },
+ fadeOut: { opacity: "hide" },
+ fadeToggle: { opacity: "toggle" }
+}, function( name, props ) {
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return this.animate( props, speed, easing, callback );
+ };
+});
+
+jQuery.speed = function( speed, easing, fn ) {
+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
+ };
+
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
+
+ // normalize opt.queue - true/undefined/null -> "fx"
+ if ( opt.queue == null || opt.queue === true ) {
+ opt.queue = "fx";
+ }
+
+ // Queueing
+ opt.old = opt.complete;
+
+ opt.complete = function() {
+ if ( jQuery.isFunction( opt.old ) ) {
+ opt.old.call( this );
+ }
+
+ if ( opt.queue ) {
+ jQuery.dequeue( this, opt.queue );
+ }
+ };
+
+ return opt;
+};
+
+jQuery.easing = {
+ linear: function( p ) {
+ return p;
+ },
+ swing: function( p ) {
+ return 0.5 - Math.cos( p*Math.PI ) / 2;
+ }
+};
+
+jQuery.timers = [];
+jQuery.fx = Tween.prototype.init;
+jQuery.fx.tick = function() {
+ var timer,
+ timers = jQuery.timers,
+ i = 0;
+
+ fxNow = jQuery.now();
+
+ for ( ; i < timers.length; i++ ) {
+ timer = timers[ i ];
+ // Checks the timer has not already been removed
+ if ( !timer() && timers[ i ] === timer ) {
+ timers.splice( i--, 1 );
+ }
+ }
+
+ if ( !timers.length ) {
+ jQuery.fx.stop();
+ }
+ fxNow = undefined;
+};
+
+jQuery.fx.timer = function( timer ) {
+ if ( timer() && jQuery.timers.push( timer ) ) {
+ jQuery.fx.start();
+ }
+};
+
+jQuery.fx.interval = 13;
+
+jQuery.fx.start = function() {
+ if ( !timerId ) {
+ timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
+ }
+};
+
+jQuery.fx.stop = function() {
+ clearInterval( timerId );
+ timerId = null;
+};
+
+jQuery.fx.speeds = {
+ slow: 600,
+ fast: 200,
+ // Default speed
+ _default: 400
+};
+
+// Back Compat <1.8 extension point
+jQuery.fx.step = {};
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.animated = function( elem ) {
+ return jQuery.grep(jQuery.timers, function( fn ) {
+ return elem === fn.elem;
+ }).length;
+ };
+}
+jQuery.fn.offset = function( options ) {
+ if ( arguments.length ) {
+ return options === undefined ?
+ this :
+ this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ var docElem, win,
+ box = { top: 0, left: 0 },
+ elem = this[ 0 ],
+ doc = elem && elem.ownerDocument;
+
+ if ( !doc ) {
+ return;
+ }
+
+ docElem = doc.documentElement;
+
+ // Make sure it's not a disconnected DOM node
+ if ( !jQuery.contains( docElem, elem ) ) {
+ return box;
+ }
+
+ // If we don't have gBCR, just use 0,0 rather than error
+ // BlackBerry 5, iOS 3 (original iPhone)
+ if ( typeof elem.getBoundingClientRect !== "undefined" ) {
+ box = elem.getBoundingClientRect();
+ }
+ win = getWindow( doc );
+ return {
+ top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
+ left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
+ };
+};
+
+jQuery.offset = {
+
+ setOffset: function( elem, options, i ) {
+ var position = jQuery.css( elem, "position" );
+
+ // set position first, in-case top/left are set even on static elem
+ if ( position === "static" ) {
+ elem.style.position = "relative";
+ }
+
+ var curElem = jQuery( elem ),
+ curOffset = curElem.offset(),
+ curCSSTop = jQuery.css( elem, "top" ),
+ curCSSLeft = jQuery.css( elem, "left" ),
+ calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
+ props = {}, curPosition = {}, curTop, curLeft;
+
+ // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
+ if ( calculatePosition ) {
+ curPosition = curElem.position();
+ curTop = curPosition.top;
+ curLeft = curPosition.left;
+ } else {
+ curTop = parseFloat( curCSSTop ) || 0;
+ curLeft = parseFloat( curCSSLeft ) || 0;
+ }
+
+ if ( jQuery.isFunction( options ) ) {
+ options = options.call( elem, i, curOffset );
+ }
+
+ if ( options.top != null ) {
+ props.top = ( options.top - curOffset.top ) + curTop;
+ }
+ if ( options.left != null ) {
+ props.left = ( options.left - curOffset.left ) + curLeft;
+ }
+
+ if ( "using" in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
+ }
+};
+
+
+jQuery.fn.extend({
+
+ position: function() {
+ if ( !this[ 0 ] ) {
+ return;
+ }
+
+ var offsetParent, offset,
+ parentOffset = { top: 0, left: 0 },
+ elem = this[ 0 ];
+
+ // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
+ if ( jQuery.css( elem, "position" ) === "fixed" ) {
+ // we assume that getBoundingClientRect is available when computed position is fixed
+ offset = elem.getBoundingClientRect();
+ } else {
+ // Get *real* offsetParent
+ offsetParent = this.offsetParent();
+
+ // Get correct offsets
+ offset = this.offset();
+ if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
+ parentOffset = offsetParent.offset();
+ }
+
+ // Add offsetParent borders
+ parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
+ parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
+ }
+
+ // Subtract parent offsets and element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ return {
+ top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
+ left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
+ };
+ },
+
+ offsetParent: function() {
+ return this.map(function() {
+ var offsetParent = this.offsetParent || document.documentElement;
+ while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
+ offsetParent = offsetParent.offsetParent;
+ }
+ return offsetParent || document.documentElement;
+ });
+ }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
+ var top = /Y/.test( prop );
+
+ jQuery.fn[ method ] = function( val ) {
+ return jQuery.access( this, function( elem, method, val ) {
+ var win = getWindow( elem );
+
+ if ( val === undefined ) {
+ return win ? (prop in win) ? win[ prop ] :
+ win.document.documentElement[ method ] :
+ elem[ method ];
+ }
+
+ if ( win ) {
+ win.scrollTo(
+ !top ? val : jQuery( win ).scrollLeft(),
+ top ? val : jQuery( win ).scrollTop()
+ );
+
+ } else {
+ elem[ method ] = val;
+ }
+ }, method, val, arguments.length, null );
+ };
+});
+
+function getWindow( elem ) {
+ return jQuery.isWindow( elem ) ?
+ elem :
+ elem.nodeType === 9 ?
+ elem.defaultView || elem.parentWindow :
+ false;
+}
+// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
+jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
+ jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
+ // margin is only for outerHeight, outerWidth
+ jQuery.fn[ funcName ] = function( margin, value ) {
+ var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
+ extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
+
+ return jQuery.access( this, function( elem, type, value ) {
+ var doc;
+
+ if ( jQuery.isWindow( elem ) ) {
+ // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
+ // isn't a whole lot we can do. See pull request at this URL for discussion:
+ // https://github.com/jquery/jquery/pull/764
+ return elem.document.documentElement[ "client" + name ];
+ }
+
+ // Get document width or height
+ if ( elem.nodeType === 9 ) {
+ doc = elem.documentElement;
+
+ // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
+ // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
+ return Math.max(
+ elem.body[ "scroll" + name ], doc[ "scroll" + name ],
+ elem.body[ "offset" + name ], doc[ "offset" + name ],
+ doc[ "client" + name ]
+ );
+ }
+
+ return value === undefined ?
+ // Get width or height on the element, requesting but not forcing parseFloat
+ jQuery.css( elem, type, extra ) :
+
+ // Set width or height on the element
+ jQuery.style( elem, type, value, extra );
+ }, type, chainable ? margin : undefined, chainable, null );
+ };
+ });
+});
+// Limit scope pollution from any deprecated API
+// (function() {
+
+// })();
+// Expose jQuery to the global object
+window.jQuery = window.$ = jQuery;
+
+// Expose jQuery as an AMD module, but only for AMD loaders that
+// understand the issues with loading multiple versions of jQuery
+// in a page that all might call define(). The loader will indicate
+// they have special allowances for multiple jQuery versions by
+// specifying define.amd.jQuery = true. Register as a named module,
+// since jQuery can be concatenated with other files that may use define,
+// but not use a proper concatenation script that understands anonymous
+// AMD modules. A named AMD is safest and most robust way to register.
+// Lowercase jquery is used because AMD module names are derived from
+// file names, and jQuery is normally delivered in a lowercase file name.
+// Do this after creating the global so that if an AMD module wants to call
+// noConflict to hide this version of jQuery, it will work.
+if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
+ define( "jquery", [], function () { return jQuery; } );
+}
+
+})( window ); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery-ui-latest.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery-ui-latest.js
new file mode 100644
index 00000000..aa83af97
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery-ui-latest.js
@@ -0,0 +1,14879 @@
+/*! jQuery UI - v1.9.2 - 2012-11-23
+* http://jqueryui.com
+* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.slider.js, jquery.ui.sortable.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
+* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */
+
+(function( $, undefined ) {
+
+var uuid = 0,
+ runiqueId = /^ui-id-\d+$/;
+
+// prevent duplicate loading
+// this is only a problem because we proxy existing functions
+// and we don't want to double proxy them
+$.ui = $.ui || {};
+if ( $.ui.version ) {
+ return;
+}
+
+$.extend( $.ui, {
+ version: "1.9.2",
+
+ keyCode: {
+ BACKSPACE: 8,
+ COMMA: 188,
+ DELETE: 46,
+ DOWN: 40,
+ END: 35,
+ ENTER: 13,
+ ESCAPE: 27,
+ HOME: 36,
+ LEFT: 37,
+ NUMPAD_ADD: 107,
+ NUMPAD_DECIMAL: 110,
+ NUMPAD_DIVIDE: 111,
+ NUMPAD_ENTER: 108,
+ NUMPAD_MULTIPLY: 106,
+ NUMPAD_SUBTRACT: 109,
+ PAGE_DOWN: 34,
+ PAGE_UP: 33,
+ PERIOD: 190,
+ RIGHT: 39,
+ SPACE: 32,
+ TAB: 9,
+ UP: 38
+ }
+});
+
+// plugins
+$.fn.extend({
+ _focus: $.fn.focus,
+ focus: function( delay, fn ) {
+ return typeof delay === "number" ?
+ this.each(function() {
+ var elem = this;
+ setTimeout(function() {
+ $( elem ).focus();
+ if ( fn ) {
+ fn.call( elem );
+ }
+ }, delay );
+ }) :
+ this._focus.apply( this, arguments );
+ },
+
+ scrollParent: function() {
+ var scrollParent;
+ if (($.ui.ie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
+ scrollParent = this.parents().filter(function() {
+ return (/(relative|absolute|fixed)/).test($.css(this,'position')) && (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x'));
+ }).eq(0);
+ } else {
+ scrollParent = this.parents().filter(function() {
+ return (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x'));
+ }).eq(0);
+ }
+
+ return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
+ },
+
+ zIndex: function( zIndex ) {
+ if ( zIndex !== undefined ) {
+ return this.css( "zIndex", zIndex );
+ }
+
+ if ( this.length ) {
+ var elem = $( this[ 0 ] ), position, value;
+ while ( elem.length && elem[ 0 ] !== document ) {
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
+ // This makes behavior of this function consistent across browsers
+ // WebKit always returns auto if the element is positioned
+ position = elem.css( "position" );
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
+ // IE returns 0 when zIndex is not specified
+ // other browsers return a string
+ // we ignore the case of nested elements with an explicit value of 0
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
+ value = parseInt( elem.css( "zIndex" ), 10 );
+ if ( !isNaN( value ) && value !== 0 ) {
+ return value;
+ }
+ }
+ elem = elem.parent();
+ }
+ }
+
+ return 0;
+ },
+
+ uniqueId: function() {
+ return this.each(function() {
+ if ( !this.id ) {
+ this.id = "ui-id-" + (++uuid);
+ }
+ });
+ },
+
+ removeUniqueId: function() {
+ return this.each(function() {
+ if ( runiqueId.test( this.id ) ) {
+ $( this ).removeAttr( "id" );
+ }
+ });
+ }
+});
+
+// selectors
+function focusable( element, isTabIndexNotNaN ) {
+ var map, mapName, img,
+ nodeName = element.nodeName.toLowerCase();
+ if ( "area" === nodeName ) {
+ map = element.parentNode;
+ mapName = map.name;
+ if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
+ return false;
+ }
+ img = $( "img[usemap=#" + mapName + "]" )[0];
+ return !!img && visible( img );
+ }
+ return ( /input|select|textarea|button|object/.test( nodeName ) ?
+ !element.disabled :
+ "a" === nodeName ?
+ element.href || isTabIndexNotNaN :
+ isTabIndexNotNaN) &&
+ // the element and all of its ancestors must be visible
+ visible( element );
+}
+
+function visible( element ) {
+ return $.expr.filters.visible( element ) &&
+ !$( element ).parents().andSelf().filter(function() {
+ return $.css( this, "visibility" ) === "hidden";
+ }).length;
+}
+
+$.extend( $.expr[ ":" ], {
+ data: $.expr.createPseudo ?
+ $.expr.createPseudo(function( dataName ) {
+ return function( elem ) {
+ return !!$.data( elem, dataName );
+ };
+ }) :
+ // support: jQuery <1.8
+ function( elem, i, match ) {
+ return !!$.data( elem, match[ 3 ] );
+ },
+
+ focusable: function( element ) {
+ return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
+ },
+
+ tabbable: function( element ) {
+ var tabIndex = $.attr( element, "tabindex" ),
+ isTabIndexNaN = isNaN( tabIndex );
+ return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
+ }
+});
+
+// support
+$(function() {
+ var body = document.body,
+ div = body.appendChild( div = document.createElement( "div" ) );
+
+ // access offsetHeight before setting the style to prevent a layout bug
+ // in IE 9 which causes the element to continue to take up space even
+ // after it is removed from the DOM (#8026)
+ div.offsetHeight;
+
+ $.extend( div.style, {
+ minHeight: "100px",
+ height: "auto",
+ padding: 0,
+ borderWidth: 0
+ });
+
+ $.support.minHeight = div.offsetHeight === 100;
+ $.support.selectstart = "onselectstart" in div;
+
+ // set display to none to avoid a layout bug in IE
+ // http://dev.jquery.com/ticket/4014
+ body.removeChild( div ).style.display = "none";
+});
+
+// support: jQuery <1.8
+if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
+ $.each( [ "Width", "Height" ], function( i, name ) {
+ var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
+ type = name.toLowerCase(),
+ orig = {
+ innerWidth: $.fn.innerWidth,
+ innerHeight: $.fn.innerHeight,
+ outerWidth: $.fn.outerWidth,
+ outerHeight: $.fn.outerHeight
+ };
+
+ function reduce( elem, size, border, margin ) {
+ $.each( side, function() {
+ size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
+ if ( border ) {
+ size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
+ }
+ if ( margin ) {
+ size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
+ }
+ });
+ return size;
+ }
+
+ $.fn[ "inner" + name ] = function( size ) {
+ if ( size === undefined ) {
+ return orig[ "inner" + name ].call( this );
+ }
+
+ return this.each(function() {
+ $( this ).css( type, reduce( this, size ) + "px" );
+ });
+ };
+
+ $.fn[ "outer" + name] = function( size, margin ) {
+ if ( typeof size !== "number" ) {
+ return orig[ "outer" + name ].call( this, size );
+ }
+
+ return this.each(function() {
+ $( this).css( type, reduce( this, size, true, margin ) + "px" );
+ });
+ };
+ });
+}
+
+// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
+if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
+ $.fn.removeData = (function( removeData ) {
+ return function( key ) {
+ if ( arguments.length ) {
+ return removeData.call( this, $.camelCase( key ) );
+ } else {
+ return removeData.call( this );
+ }
+ };
+ })( $.fn.removeData );
+}
+
+
+
+
+
+// deprecated
+
+(function() {
+ var uaMatch = /msie ([\w.]+)/.exec( navigator.userAgent.toLowerCase() ) || [];
+ $.ui.ie = uaMatch.length ? true : false;
+ $.ui.ie6 = parseFloat( uaMatch[ 1 ], 10 ) === 6;
+})();
+
+$.fn.extend({
+ disableSelection: function() {
+ return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
+ ".ui-disableSelection", function( event ) {
+ event.preventDefault();
+ });
+ },
+
+ enableSelection: function() {
+ return this.unbind( ".ui-disableSelection" );
+ }
+});
+
+$.extend( $.ui, {
+ // $.ui.plugin is deprecated. Use the proxy pattern instead.
+ plugin: {
+ add: function( module, option, set ) {
+ var i,
+ proto = $.ui[ module ].prototype;
+ for ( i in set ) {
+ proto.plugins[ i ] = proto.plugins[ i ] || [];
+ proto.plugins[ i ].push( [ option, set[ i ] ] );
+ }
+ },
+ call: function( instance, name, args ) {
+ var i,
+ set = instance.plugins[ name ];
+ if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
+ return;
+ }
+
+ for ( i = 0; i < set.length; i++ ) {
+ if ( instance.options[ set[ i ][ 0 ] ] ) {
+ set[ i ][ 1 ].apply( instance.element, args );
+ }
+ }
+ }
+ },
+
+ contains: $.contains,
+
+ // only used by resizable
+ hasScroll: function( el, a ) {
+
+ //If overflow is hidden, the element might have extra content, but the user wants to hide it
+ if ( $( el ).css( "overflow" ) === "hidden") {
+ return false;
+ }
+
+ var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
+ has = false;
+
+ if ( el[ scroll ] > 0 ) {
+ return true;
+ }
+
+ // TODO: determine which cases actually cause this to happen
+ // if the element doesn't have the scroll set, see if it's possible to
+ // set the scroll
+ el[ scroll ] = 1;
+ has = ( el[ scroll ] > 0 );
+ el[ scroll ] = 0;
+ return has;
+ },
+
+ // these are odd functions, fix the API or move into individual plugins
+ isOverAxis: function( x, reference, size ) {
+ //Determines when x coordinate is over "b" element axis
+ return ( x > reference ) && ( x < ( reference + size ) );
+ },
+ isOver: function( y, x, top, left, height, width ) {
+ //Determines when x, y coordinates is over "b" element
+ return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
+ }
+});
+
+})( jQuery );
+(function( $, undefined ) {
+
+var uuid = 0,
+ slice = Array.prototype.slice,
+ _cleanData = $.cleanData;
+$.cleanData = function( elems ) {
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ try {
+ $( elem ).triggerHandler( "remove" );
+ // http://bugs.jquery.com/ticket/8235
+ } catch( e ) {}
+ }
+ _cleanData( elems );
+};
+
+$.widget = function( name, base, prototype ) {
+ var fullName, existingConstructor, constructor, basePrototype,
+ namespace = name.split( "." )[ 0 ];
+
+ name = name.split( "." )[ 1 ];
+ fullName = namespace + "-" + name;
+
+ if ( !prototype ) {
+ prototype = base;
+ base = $.Widget;
+ }
+
+ // create selector for plugin
+ $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
+ return !!$.data( elem, fullName );
+ };
+
+ $[ namespace ] = $[ namespace ] || {};
+ existingConstructor = $[ namespace ][ name ];
+ constructor = $[ namespace ][ name ] = function( options, element ) {
+ // allow instantiation without "new" keyword
+ if ( !this._createWidget ) {
+ return new constructor( options, element );
+ }
+
+ // allow instantiation without initializing for simple inheritance
+ // must use "new" keyword (the code above always passes args)
+ if ( arguments.length ) {
+ this._createWidget( options, element );
+ }
+ };
+ // extend with the existing constructor to carry over any static properties
+ $.extend( constructor, existingConstructor, {
+ version: prototype.version,
+ // copy the object used to create the prototype in case we need to
+ // redefine the widget later
+ _proto: $.extend( {}, prototype ),
+ // track widgets that inherit from this widget in case this widget is
+ // redefined after a widget inherits from it
+ _childConstructors: []
+ });
+
+ basePrototype = new base();
+ // we need to make the options hash a property directly on the new instance
+ // otherwise we'll modify the options hash on the prototype that we're
+ // inheriting from
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );
+ $.each( prototype, function( prop, value ) {
+ if ( $.isFunction( value ) ) {
+ prototype[ prop ] = (function() {
+ var _super = function() {
+ return base.prototype[ prop ].apply( this, arguments );
+ },
+ _superApply = function( args ) {
+ return base.prototype[ prop ].apply( this, args );
+ };
+ return function() {
+ var __super = this._super,
+ __superApply = this._superApply,
+ returnValue;
+
+ this._super = _super;
+ this._superApply = _superApply;
+
+ returnValue = value.apply( this, arguments );
+
+ this._super = __super;
+ this._superApply = __superApply;
+
+ return returnValue;
+ };
+ })();
+ }
+ });
+ constructor.prototype = $.widget.extend( basePrototype, {
+ // TODO: remove support for widgetEventPrefix
+ // always use the name + a colon as the prefix, e.g., draggable:start
+ // don't prefix for widgets that aren't DOM-based
+ widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
+ }, prototype, {
+ constructor: constructor,
+ namespace: namespace,
+ widgetName: name,
+ // TODO remove widgetBaseClass, see #8155
+ widgetBaseClass: fullName,
+ widgetFullName: fullName
+ });
+
+ // If this widget is being redefined then we need to find all widgets that
+ // are inheriting from it and redefine all of them so that they inherit from
+ // the new version of this widget. We're essentially trying to replace one
+ // level in the prototype chain.
+ if ( existingConstructor ) {
+ $.each( existingConstructor._childConstructors, function( i, child ) {
+ var childPrototype = child.prototype;
+
+ // redefine the child widget using the same prototype that was
+ // originally used, but inherit from the new version of the base
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
+ });
+ // remove the list of existing child constructors from the old constructor
+ // so the old child constructors can be garbage collected
+ delete existingConstructor._childConstructors;
+ } else {
+ base._childConstructors.push( constructor );
+ }
+
+ $.widget.bridge( name, constructor );
+};
+
+$.widget.extend = function( target ) {
+ var input = slice.call( arguments, 1 ),
+ inputIndex = 0,
+ inputLength = input.length,
+ key,
+ value;
+ for ( ; inputIndex < inputLength; inputIndex++ ) {
+ for ( key in input[ inputIndex ] ) {
+ value = input[ inputIndex ][ key ];
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
+ // Clone objects
+ if ( $.isPlainObject( value ) ) {
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
+ $.widget.extend( {}, target[ key ], value ) :
+ // Don't extend strings, arrays, etc. with objects
+ $.widget.extend( {}, value );
+ // Copy everything else by reference
+ } else {
+ target[ key ] = value;
+ }
+ }
+ }
+ }
+ return target;
+};
+
+$.widget.bridge = function( name, object ) {
+ var fullName = object.prototype.widgetFullName || name;
+ $.fn[ name ] = function( options ) {
+ var isMethodCall = typeof options === "string",
+ args = slice.call( arguments, 1 ),
+ returnValue = this;
+
+ // allow multiple hashes to be passed on init
+ options = !isMethodCall && args.length ?
+ $.widget.extend.apply( null, [ options ].concat(args) ) :
+ options;
+
+ if ( isMethodCall ) {
+ this.each(function() {
+ var methodValue,
+ instance = $.data( this, fullName );
+ if ( !instance ) {
+ return $.error( "cannot call methods on " + name + " prior to initialization; " +
+ "attempted to call method '" + options + "'" );
+ }
+ if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
+ return $.error( "no such method '" + options + "' for " + name + " widget instance" );
+ }
+ methodValue = instance[ options ].apply( instance, args );
+ if ( methodValue !== instance && methodValue !== undefined ) {
+ returnValue = methodValue && methodValue.jquery ?
+ returnValue.pushStack( methodValue.get() ) :
+ methodValue;
+ return false;
+ }
+ });
+ } else {
+ this.each(function() {
+ var instance = $.data( this, fullName );
+ if ( instance ) {
+ instance.option( options || {} )._init();
+ } else {
+ $.data( this, fullName, new object( options, this ) );
+ }
+ });
+ }
+
+ return returnValue;
+ };
+};
+
+$.Widget = function( /* options, element */ ) {};
+$.Widget._childConstructors = [];
+
+$.Widget.prototype = {
+ widgetName: "widget",
+ widgetEventPrefix: "",
+ defaultElement: "<div>",
+ options: {
+ disabled: false,
+
+ // callbacks
+ create: null
+ },
+ _createWidget: function( options, element ) {
+ element = $( element || this.defaultElement || this )[ 0 ];
+ this.element = $( element );
+ this.uuid = uuid++;
+ this.eventNamespace = "." + this.widgetName + this.uuid;
+ this.options = $.widget.extend( {},
+ this.options,
+ this._getCreateOptions(),
+ options );
+
+ this.bindings = $();
+ this.hoverable = $();
+ this.focusable = $();
+
+ if ( element !== this ) {
+ // 1.9 BC for #7810
+ // TODO remove dual storage
+ $.data( element, this.widgetName, this );
+ $.data( element, this.widgetFullName, this );
+ this._on( true, this.element, {
+ remove: function( event ) {
+ if ( event.target === element ) {
+ this.destroy();
+ }
+ }
+ });
+ this.document = $( element.style ?
+ // element within the document
+ element.ownerDocument :
+ // element is window or document
+ element.document || element );
+ this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
+ }
+
+ this._create();
+ this._trigger( "create", null, this._getCreateEventData() );
+ this._init();
+ },
+ _getCreateOptions: $.noop,
+ _getCreateEventData: $.noop,
+ _create: $.noop,
+ _init: $.noop,
+
+ destroy: function() {
+ this._destroy();
+ // we can probably remove the unbind calls in 2.0
+ // all event bindings should go through this._on()
+ this.element
+ .unbind( this.eventNamespace )
+ // 1.9 BC for #7810
+ // TODO remove dual storage
+ .removeData( this.widgetName )
+ .removeData( this.widgetFullName )
+ // support: jquery <1.6.3
+ // http://bugs.jquery.com/ticket/9413
+ .removeData( $.camelCase( this.widgetFullName ) );
+ this.widget()
+ .unbind( this.eventNamespace )
+ .removeAttr( "aria-disabled" )
+ .removeClass(
+ this.widgetFullName + "-disabled " +
+ "ui-state-disabled" );
+
+ // clean up events and states
+ this.bindings.unbind( this.eventNamespace );
+ this.hoverable.removeClass( "ui-state-hover" );
+ this.focusable.removeClass( "ui-state-focus" );
+ },
+ _destroy: $.noop,
+
+ widget: function() {
+ return this.element;
+ },
+
+ option: function( key, value ) {
+ var options = key,
+ parts,
+ curOption,
+ i;
+
+ if ( arguments.length === 0 ) {
+ // don't return a reference to the internal hash
+ return $.widget.extend( {}, this.options );
+ }
+
+ if ( typeof key === "string" ) {
+ // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
+ options = {};
+ parts = key.split( "." );
+ key = parts.shift();
+ if ( parts.length ) {
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
+ for ( i = 0; i < parts.length - 1; i++ ) {
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
+ curOption = curOption[ parts[ i ] ];
+ }
+ key = parts.pop();
+ if ( value === undefined ) {
+ return curOption[ key ] === undefined ? null : curOption[ key ];
+ }
+ curOption[ key ] = value;
+ } else {
+ if ( value === undefined ) {
+ return this.options[ key ] === undefined ? null : this.options[ key ];
+ }
+ options[ key ] = value;
+ }
+ }
+
+ this._setOptions( options );
+
+ return this;
+ },
+ _setOptions: function( options ) {
+ var key;
+
+ for ( key in options ) {
+ this._setOption( key, options[ key ] );
+ }
+
+ return this;
+ },
+ _setOption: function( key, value ) {
+ this.options[ key ] = value;
+
+ if ( key === "disabled" ) {
+ this.widget()
+ .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
+ .attr( "aria-disabled", value );
+ this.hoverable.removeClass( "ui-state-hover" );
+ this.focusable.removeClass( "ui-state-focus" );
+ }
+
+ return this;
+ },
+
+ enable: function() {
+ return this._setOption( "disabled", false );
+ },
+ disable: function() {
+ return this._setOption( "disabled", true );
+ },
+
+ _on: function( suppressDisabledCheck, element, handlers ) {
+ var delegateElement,
+ instance = this;
+
+ // no suppressDisabledCheck flag, shuffle arguments
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
+ handlers = element;
+ element = suppressDisabledCheck;
+ suppressDisabledCheck = false;
+ }
+
+ // no element argument, shuffle and use this.element
+ if ( !handlers ) {
+ handlers = element;
+ element = this.element;
+ delegateElement = this.widget();
+ } else {
+ // accept selectors, DOM elements
+ element = delegateElement = $( element );
+ this.bindings = this.bindings.add( element );
+ }
+
+ $.each( handlers, function( event, handler ) {
+ function handlerProxy() {
+ // allow widgets to customize the disabled handling
+ // - disabled as an array instead of boolean
+ // - disabled class as method for disabling individual parts
+ if ( !suppressDisabledCheck &&
+ ( instance.options.disabled === true ||
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
+ return;
+ }
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
+ .apply( instance, arguments );
+ }
+
+ // copy the guid so direct unbinding works
+ if ( typeof handler !== "string" ) {
+ handlerProxy.guid = handler.guid =
+ handler.guid || handlerProxy.guid || $.guid++;
+ }
+
+ var match = event.match( /^(\w+)\s*(.*)$/ ),
+ eventName = match[1] + instance.eventNamespace,
+ selector = match[2];
+ if ( selector ) {
+ delegateElement.delegate( selector, eventName, handlerProxy );
+ } else {
+ element.bind( eventName, handlerProxy );
+ }
+ });
+ },
+
+ _off: function( element, eventName ) {
+ eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
+ element.unbind( eventName ).undelegate( eventName );
+ },
+
+ _delay: function( handler, delay ) {
+ function handlerProxy() {
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
+ .apply( instance, arguments );
+ }
+ var instance = this;
+ return setTimeout( handlerProxy, delay || 0 );
+ },
+
+ _hoverable: function( element ) {
+ this.hoverable = this.hoverable.add( element );
+ this._on( element, {
+ mouseenter: function( event ) {
+ $( event.currentTarget ).addClass( "ui-state-hover" );
+ },
+ mouseleave: function( event ) {
+ $( event.currentTarget ).removeClass( "ui-state-hover" );
+ }
+ });
+ },
+
+ _focusable: function( element ) {
+ this.focusable = this.focusable.add( element );
+ this._on( element, {
+ focusin: function( event ) {
+ $( event.currentTarget ).addClass( "ui-state-focus" );
+ },
+ focusout: function( event ) {
+ $( event.currentTarget ).removeClass( "ui-state-focus" );
+ }
+ });
+ },
+
+ _trigger: function( type, event, data ) {
+ var prop, orig,
+ callback = this.options[ type ];
+
+ data = data || {};
+ event = $.Event( event );
+ event.type = ( type === this.widgetEventPrefix ?
+ type :
+ this.widgetEventPrefix + type ).toLowerCase();
+ // the original event may come from any element
+ // so we need to reset the target on the new event
+ event.target = this.element[ 0 ];
+
+ // copy original event properties over to the new event
+ orig = event.originalEvent;
+ if ( orig ) {
+ for ( prop in orig ) {
+ if ( !( prop in event ) ) {
+ event[ prop ] = orig[ prop ];
+ }
+ }
+ }
+
+ this.element.trigger( event, data );
+ return !( $.isFunction( callback ) &&
+ callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
+ event.isDefaultPrevented() );
+ }
+};
+
+$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
+ if ( typeof options === "string" ) {
+ options = { effect: options };
+ }
+ var hasOptions,
+ effectName = !options ?
+ method :
+ options === true || typeof options === "number" ?
+ defaultEffect :
+ options.effect || defaultEffect;
+ options = options || {};
+ if ( typeof options === "number" ) {
+ options = { duration: options };
+ }
+ hasOptions = !$.isEmptyObject( options );
+ options.complete = callback;
+ if ( options.delay ) {
+ element.delay( options.delay );
+ }
+ if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) {
+ element[ method ]( options );
+ } else if ( effectName !== method && element[ effectName ] ) {
+ element[ effectName ]( options.duration, options.easing, callback );
+ } else {
+ element.queue(function( next ) {
+ $( this )[ method ]();
+ if ( callback ) {
+ callback.call( element[ 0 ] );
+ }
+ next();
+ });
+ }
+ };
+});
+
+// DEPRECATED
+if ( $.uiBackCompat !== false ) {
+ $.Widget.prototype._getCreateOptions = function() {
+ return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
+ };
+}
+
+})( jQuery );
+(function( $, undefined ) {
+
+var mouseHandled = false;
+$( document ).mouseup( function( e ) {
+ mouseHandled = false;
+});
+
+$.widget("ui.mouse", {
+ version: "1.9.2",
+ options: {
+ cancel: 'input,textarea,button,select,option',
+ distance: 1,
+ delay: 0
+ },
+ _mouseInit: function() {
+ var that = this;
+
+ this.element
+ .bind('mousedown.'+this.widgetName, function(event) {
+ return that._mouseDown(event);
+ })
+ .bind('click.'+this.widgetName, function(event) {
+ if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) {
+ $.removeData(event.target, that.widgetName + '.preventClickEvent');
+ event.stopImmediatePropagation();
+ return false;
+ }
+ });
+
+ this.started = false;
+ },
+
+ // TODO: make sure destroying one instance of mouse doesn't mess with
+ // other instances of mouse
+ _mouseDestroy: function() {
+ this.element.unbind('.'+this.widgetName);
+ if ( this._mouseMoveDelegate ) {
+ $(document)
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+ }
+ },
+
+ _mouseDown: function(event) {
+ // don't let more than one widget handle mouseStart
+ if( mouseHandled ) { return; }
+
+ // we may have missed mouseup (out of window)
+ (this._mouseStarted && this._mouseUp(event));
+
+ this._mouseDownEvent = event;
+
+ var that = this,
+ btnIsLeft = (event.which === 1),
+ // event.target.nodeName works around a bug in IE 8 with
+ // disabled inputs (#7620)
+ elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
+ if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
+ return true;
+ }
+
+ this.mouseDelayMet = !this.options.delay;
+ if (!this.mouseDelayMet) {
+ this._mouseDelayTimer = setTimeout(function() {
+ that.mouseDelayMet = true;
+ }, this.options.delay);
+ }
+
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+ this._mouseStarted = (this._mouseStart(event) !== false);
+ if (!this._mouseStarted) {
+ event.preventDefault();
+ return true;
+ }
+ }
+
+ // Click event may never have fired (Gecko & Opera)
+ if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
+ $.removeData(event.target, this.widgetName + '.preventClickEvent');
+ }
+
+ // these delegates are required to keep context
+ this._mouseMoveDelegate = function(event) {
+ return that._mouseMove(event);
+ };
+ this._mouseUpDelegate = function(event) {
+ return that._mouseUp(event);
+ };
+ $(document)
+ .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+ .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+
+ event.preventDefault();
+
+ mouseHandled = true;
+ return true;
+ },
+
+ _mouseMove: function(event) {
+ // IE mouseup check - mouseup happened when mouse was out of window
+ if ($.ui.ie && !(document.documentMode >= 9) && !event.button) {
+ return this._mouseUp(event);
+ }
+
+ if (this._mouseStarted) {
+ this._mouseDrag(event);
+ return event.preventDefault();
+ }
+
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+ this._mouseStarted =
+ (this._mouseStart(this._mouseDownEvent, event) !== false);
+ (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
+ }
+
+ return !this._mouseStarted;
+ },
+
+ _mouseUp: function(event) {
+ $(document)
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+
+ if (this._mouseStarted) {
+ this._mouseStarted = false;
+
+ if (event.target === this._mouseDownEvent.target) {
+ $.data(event.target, this.widgetName + '.preventClickEvent', true);
+ }
+
+ this._mouseStop(event);
+ }
+
+ return false;
+ },
+
+ _mouseDistanceMet: function(event) {
+ return (Math.max(
+ Math.abs(this._mouseDownEvent.pageX - event.pageX),
+ Math.abs(this._mouseDownEvent.pageY - event.pageY)
+ ) >= this.options.distance
+ );
+ },
+
+ _mouseDelayMet: function(event) {
+ return this.mouseDelayMet;
+ },
+
+ // These are placeholder methods, to be overriden by extending plugin
+ _mouseStart: function(event) {},
+ _mouseDrag: function(event) {},
+ _mouseStop: function(event) {},
+ _mouseCapture: function(event) { return true; }
+});
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.ui = $.ui || {};
+
+var cachedScrollbarWidth,
+ max = Math.max,
+ abs = Math.abs,
+ round = Math.round,
+ rhorizontal = /left|center|right/,
+ rvertical = /top|center|bottom/,
+ roffset = /[\+\-]\d+%?/,
+ rposition = /^\w+/,
+ rpercent = /%$/,
+ _position = $.fn.position;
+
+function getOffsets( offsets, width, height ) {
+ return [
+ parseInt( offsets[ 0 ], 10 ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
+ parseInt( offsets[ 1 ], 10 ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
+ ];
+}
+function parseCss( element, property ) {
+ return parseInt( $.css( element, property ), 10 ) || 0;
+}
+
+$.position = {
+ scrollbarWidth: function() {
+ if ( cachedScrollbarWidth !== undefined ) {
+ return cachedScrollbarWidth;
+ }
+ var w1, w2,
+ div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
+ innerDiv = div.children()[0];
+
+ $( "body" ).append( div );
+ w1 = innerDiv.offsetWidth;
+ div.css( "overflow", "scroll" );
+
+ w2 = innerDiv.offsetWidth;
+
+ if ( w1 === w2 ) {
+ w2 = div[0].clientWidth;
+ }
+
+ div.remove();
+
+ return (cachedScrollbarWidth = w1 - w2);
+ },
+ getScrollInfo: function( within ) {
+ var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ),
+ overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ),
+ hasOverflowX = overflowX === "scroll" ||
+ ( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
+ hasOverflowY = overflowY === "scroll" ||
+ ( overflowY === "auto" && within.height < within.element[0].scrollHeight );
+ return {
+ width: hasOverflowX ? $.position.scrollbarWidth() : 0,
+ height: hasOverflowY ? $.position.scrollbarWidth() : 0
+ };
+ },
+ getWithinInfo: function( element ) {
+ var withinElement = $( element || window ),
+ isWindow = $.isWindow( withinElement[0] );
+ return {
+ element: withinElement,
+ isWindow: isWindow,
+ offset: withinElement.offset() || { left: 0, top: 0 },
+ scrollLeft: withinElement.scrollLeft(),
+ scrollTop: withinElement.scrollTop(),
+ width: isWindow ? withinElement.width() : withinElement.outerWidth(),
+ height: isWindow ? withinElement.height() : withinElement.outerHeight()
+ };
+ }
+};
+
+$.fn.position = function( options ) {
+ if ( !options || !options.of ) {
+ return _position.apply( this, arguments );
+ }
+
+ // make a copy, we don't want to modify arguments
+ options = $.extend( {}, options );
+
+ var atOffset, targetWidth, targetHeight, targetOffset, basePosition,
+ target = $( options.of ),
+ within = $.position.getWithinInfo( options.within ),
+ scrollInfo = $.position.getScrollInfo( within ),
+ targetElem = target[0],
+ collision = ( options.collision || "flip" ).split( " " ),
+ offsets = {};
+
+ if ( targetElem.nodeType === 9 ) {
+ targetWidth = target.width();
+ targetHeight = target.height();
+ targetOffset = { top: 0, left: 0 };
+ } else if ( $.isWindow( targetElem ) ) {
+ targetWidth = target.width();
+ targetHeight = target.height();
+ targetOffset = { top: target.scrollTop(), left: target.scrollLeft() };
+ } else if ( targetElem.preventDefault ) {
+ // force left top to allow flipping
+ options.at = "left top";
+ targetWidth = targetHeight = 0;
+ targetOffset = { top: targetElem.pageY, left: targetElem.pageX };
+ } else {
+ targetWidth = target.outerWidth();
+ targetHeight = target.outerHeight();
+ targetOffset = target.offset();
+ }
+ // clone to reuse original targetOffset later
+ basePosition = $.extend( {}, targetOffset );
+
+ // force my and at to have valid horizontal and vertical positions
+ // if a value is missing or invalid, it will be converted to center
+ $.each( [ "my", "at" ], function() {
+ var pos = ( options[ this ] || "" ).split( " " ),
+ horizontalOffset,
+ verticalOffset;
+
+ if ( pos.length === 1) {
+ pos = rhorizontal.test( pos[ 0 ] ) ?
+ pos.concat( [ "center" ] ) :
+ rvertical.test( pos[ 0 ] ) ?
+ [ "center" ].concat( pos ) :
+ [ "center", "center" ];
+ }
+ pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
+ pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
+
+ // calculate offsets
+ horizontalOffset = roffset.exec( pos[ 0 ] );
+ verticalOffset = roffset.exec( pos[ 1 ] );
+ offsets[ this ] = [
+ horizontalOffset ? horizontalOffset[ 0 ] : 0,
+ verticalOffset ? verticalOffset[ 0 ] : 0
+ ];
+
+ // reduce to just the positions without the offsets
+ options[ this ] = [
+ rposition.exec( pos[ 0 ] )[ 0 ],
+ rposition.exec( pos[ 1 ] )[ 0 ]
+ ];
+ });
+
+ // normalize collision option
+ if ( collision.length === 1 ) {
+ collision[ 1 ] = collision[ 0 ];
+ }
+
+ if ( options.at[ 0 ] === "right" ) {
+ basePosition.left += targetWidth;
+ } else if ( options.at[ 0 ] === "center" ) {
+ basePosition.left += targetWidth / 2;
+ }
+
+ if ( options.at[ 1 ] === "bottom" ) {
+ basePosition.top += targetHeight;
+ } else if ( options.at[ 1 ] === "center" ) {
+ basePosition.top += targetHeight / 2;
+ }
+
+ atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
+ basePosition.left += atOffset[ 0 ];
+ basePosition.top += atOffset[ 1 ];
+
+ return this.each(function() {
+ var collisionPosition, using,
+ elem = $( this ),
+ elemWidth = elem.outerWidth(),
+ elemHeight = elem.outerHeight(),
+ marginLeft = parseCss( this, "marginLeft" ),
+ marginTop = parseCss( this, "marginTop" ),
+ collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
+ collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
+ position = $.extend( {}, basePosition ),
+ myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
+
+ if ( options.my[ 0 ] === "right" ) {
+ position.left -= elemWidth;
+ } else if ( options.my[ 0 ] === "center" ) {
+ position.left -= elemWidth / 2;
+ }
+
+ if ( options.my[ 1 ] === "bottom" ) {
+ position.top -= elemHeight;
+ } else if ( options.my[ 1 ] === "center" ) {
+ position.top -= elemHeight / 2;
+ }
+
+ position.left += myOffset[ 0 ];
+ position.top += myOffset[ 1 ];
+
+ // if the browser doesn't support fractions, then round for consistent results
+ if ( !$.support.offsetFractions ) {
+ position.left = round( position.left );
+ position.top = round( position.top );
+ }
+
+ collisionPosition = {
+ marginLeft: marginLeft,
+ marginTop: marginTop
+ };
+
+ $.each( [ "left", "top" ], function( i, dir ) {
+ if ( $.ui.position[ collision[ i ] ] ) {
+ $.ui.position[ collision[ i ] ][ dir ]( position, {
+ targetWidth: targetWidth,
+ targetHeight: targetHeight,
+ elemWidth: elemWidth,
+ elemHeight: elemHeight,
+ collisionPosition: collisionPosition,
+ collisionWidth: collisionWidth,
+ collisionHeight: collisionHeight,
+ offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
+ my: options.my,
+ at: options.at,
+ within: within,
+ elem : elem
+ });
+ }
+ });
+
+ if ( $.fn.bgiframe ) {
+ elem.bgiframe();
+ }
+
+ if ( options.using ) {
+ // adds feedback as second argument to using callback, if present
+ using = function( props ) {
+ var left = targetOffset.left - position.left,
+ right = left + targetWidth - elemWidth,
+ top = targetOffset.top - position.top,
+ bottom = top + targetHeight - elemHeight,
+ feedback = {
+ target: {
+ element: target,
+ left: targetOffset.left,
+ top: targetOffset.top,
+ width: targetWidth,
+ height: targetHeight
+ },
+ element: {
+ element: elem,
+ left: position.left,
+ top: position.top,
+ width: elemWidth,
+ height: elemHeight
+ },
+ horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
+ vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
+ };
+ if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
+ feedback.horizontal = "center";
+ }
+ if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
+ feedback.vertical = "middle";
+ }
+ if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
+ feedback.important = "horizontal";
+ } else {
+ feedback.important = "vertical";
+ }
+ options.using.call( this, props, feedback );
+ };
+ }
+
+ elem.offset( $.extend( position, { using: using } ) );
+ });
+};
+
+$.ui.position = {
+ fit: {
+ left: function( position, data ) {
+ var within = data.within,
+ withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
+ outerWidth = within.width,
+ collisionPosLeft = position.left - data.collisionPosition.marginLeft,
+ overLeft = withinOffset - collisionPosLeft,
+ overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
+ newOverRight;
+
+ // element is wider than within
+ if ( data.collisionWidth > outerWidth ) {
+ // element is initially over the left side of within
+ if ( overLeft > 0 && overRight <= 0 ) {
+ newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
+ position.left += overLeft - newOverRight;
+ // element is initially over right side of within
+ } else if ( overRight > 0 && overLeft <= 0 ) {
+ position.left = withinOffset;
+ // element is initially over both left and right sides of within
+ } else {
+ if ( overLeft > overRight ) {
+ position.left = withinOffset + outerWidth - data.collisionWidth;
+ } else {
+ position.left = withinOffset;
+ }
+ }
+ // too far left -> align with left edge
+ } else if ( overLeft > 0 ) {
+ position.left += overLeft;
+ // too far right -> align with right edge
+ } else if ( overRight > 0 ) {
+ position.left -= overRight;
+ // adjust based on position and margin
+ } else {
+ position.left = max( position.left - collisionPosLeft, position.left );
+ }
+ },
+ top: function( position, data ) {
+ var within = data.within,
+ withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
+ outerHeight = data.within.height,
+ collisionPosTop = position.top - data.collisionPosition.marginTop,
+ overTop = withinOffset - collisionPosTop,
+ overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
+ newOverBottom;
+
+ // element is taller than within
+ if ( data.collisionHeight > outerHeight ) {
+ // element is initially over the top of within
+ if ( overTop > 0 && overBottom <= 0 ) {
+ newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
+ position.top += overTop - newOverBottom;
+ // element is initially over bottom of within
+ } else if ( overBottom > 0 && overTop <= 0 ) {
+ position.top = withinOffset;
+ // element is initially over both top and bottom of within
+ } else {
+ if ( overTop > overBottom ) {
+ position.top = withinOffset + outerHeight - data.collisionHeight;
+ } else {
+ position.top = withinOffset;
+ }
+ }
+ // too far up -> align with top
+ } else if ( overTop > 0 ) {
+ position.top += overTop;
+ // too far down -> align with bottom edge
+ } else if ( overBottom > 0 ) {
+ position.top -= overBottom;
+ // adjust based on position and margin
+ } else {
+ position.top = max( position.top - collisionPosTop, position.top );
+ }
+ }
+ },
+ flip: {
+ left: function( position, data ) {
+ var within = data.within,
+ withinOffset = within.offset.left + within.scrollLeft,
+ outerWidth = within.width,
+ offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
+ collisionPosLeft = position.left - data.collisionPosition.marginLeft,
+ overLeft = collisionPosLeft - offsetLeft,
+ overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
+ myOffset = data.my[ 0 ] === "left" ?
+ -data.elemWidth :
+ data.my[ 0 ] === "right" ?
+ data.elemWidth :
+ 0,
+ atOffset = data.at[ 0 ] === "left" ?
+ data.targetWidth :
+ data.at[ 0 ] === "right" ?
+ -data.targetWidth :
+ 0,
+ offset = -2 * data.offset[ 0 ],
+ newOverRight,
+ newOverLeft;
+
+ if ( overLeft < 0 ) {
+ newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
+ if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
+ position.left += myOffset + atOffset + offset;
+ }
+ }
+ else if ( overRight > 0 ) {
+ newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
+ if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
+ position.left += myOffset + atOffset + offset;
+ }
+ }
+ },
+ top: function( position, data ) {
+ var within = data.within,
+ withinOffset = within.offset.top + within.scrollTop,
+ outerHeight = within.height,
+ offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
+ collisionPosTop = position.top - data.collisionPosition.marginTop,
+ overTop = collisionPosTop - offsetTop,
+ overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
+ top = data.my[ 1 ] === "top",
+ myOffset = top ?
+ -data.elemHeight :
+ data.my[ 1 ] === "bottom" ?
+ data.elemHeight :
+ 0,
+ atOffset = data.at[ 1 ] === "top" ?
+ data.targetHeight :
+ data.at[ 1 ] === "bottom" ?
+ -data.targetHeight :
+ 0,
+ offset = -2 * data.offset[ 1 ],
+ newOverTop,
+ newOverBottom;
+ if ( overTop < 0 ) {
+ newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
+ if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
+ position.top += myOffset + atOffset + offset;
+ }
+ }
+ else if ( overBottom > 0 ) {
+ newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
+ if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
+ position.top += myOffset + atOffset + offset;
+ }
+ }
+ }
+ },
+ flipfit: {
+ left: function() {
+ $.ui.position.flip.left.apply( this, arguments );
+ $.ui.position.fit.left.apply( this, arguments );
+ },
+ top: function() {
+ $.ui.position.flip.top.apply( this, arguments );
+ $.ui.position.fit.top.apply( this, arguments );
+ }
+ }
+};
+
+// fraction support test
+(function () {
+ var testElement, testElementParent, testElementStyle, offsetLeft, i,
+ body = document.getElementsByTagName( "body" )[ 0 ],
+ div = document.createElement( "div" );
+
+ //Create a "fake body" for testing based on method used in jQuery.support
+ testElement = document.createElement( body ? "div" : "body" );
+ testElementStyle = {
+ visibility: "hidden",
+ width: 0,
+ height: 0,
+ border: 0,
+ margin: 0,
+ background: "none"
+ };
+ if ( body ) {
+ $.extend( testElementStyle, {
+ position: "absolute",
+ left: "-1000px",
+ top: "-1000px"
+ });
+ }
+ for ( i in testElementStyle ) {
+ testElement.style[ i ] = testElementStyle[ i ];
+ }
+ testElement.appendChild( div );
+ testElementParent = body || document.documentElement;
+ testElementParent.insertBefore( testElement, testElementParent.firstChild );
+
+ div.style.cssText = "position: absolute; left: 10.7432222px;";
+
+ offsetLeft = $( div ).offset().left;
+ $.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11;
+
+ testElement.innerHTML = "";
+ testElementParent.removeChild( testElement );
+})();
+
+// DEPRECATED
+if ( $.uiBackCompat !== false ) {
+ // offset option
+ (function( $ ) {
+ var _position = $.fn.position;
+ $.fn.position = function( options ) {
+ if ( !options || !options.offset ) {
+ return _position.call( this, options );
+ }
+ var offset = options.offset.split( " " ),
+ at = options.at.split( " " );
+ if ( offset.length === 1 ) {
+ offset[ 1 ] = offset[ 0 ];
+ }
+ if ( /^\d/.test( offset[ 0 ] ) ) {
+ offset[ 0 ] = "+" + offset[ 0 ];
+ }
+ if ( /^\d/.test( offset[ 1 ] ) ) {
+ offset[ 1 ] = "+" + offset[ 1 ];
+ }
+ if ( at.length === 1 ) {
+ if ( /left|center|right/.test( at[ 0 ] ) ) {
+ at[ 1 ] = "center";
+ } else {
+ at[ 1 ] = at[ 0 ];
+ at[ 0 ] = "center";
+ }
+ }
+ return _position.call( this, $.extend( options, {
+ at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ],
+ offset: undefined
+ } ) );
+ };
+ }( jQuery ) );
+}
+
+}( jQuery ) );
+(function( $, undefined ) {
+
+var uid = 0,
+ hideProps = {},
+ showProps = {};
+
+hideProps.height = hideProps.paddingTop = hideProps.paddingBottom =
+ hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide";
+showProps.height = showProps.paddingTop = showProps.paddingBottom =
+ showProps.borderTopWidth = showProps.borderBottomWidth = "show";
+
+$.widget( "ui.accordion", {
+ version: "1.9.2",
+ options: {
+ active: 0,
+ animate: {},
+ collapsible: false,
+ event: "click",
+ header: "> li > :first-child,> :not(li):even",
+ heightStyle: "auto",
+ icons: {
+ activeHeader: "ui-icon-triangle-1-s",
+ header: "ui-icon-triangle-1-e"
+ },
+
+ // callbacks
+ activate: null,
+ beforeActivate: null
+ },
+
+ _create: function() {
+ var accordionId = this.accordionId = "ui-accordion-" +
+ (this.element.attr( "id" ) || ++uid),
+ options = this.options;
+
+ this.prevShow = this.prevHide = $();
+ this.element.addClass( "ui-accordion ui-widget ui-helper-reset" );
+
+ this.headers = this.element.find( options.header )
+ .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" );
+ this._hoverable( this.headers );
+ this._focusable( this.headers );
+
+ this.headers.next()
+ .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
+ .hide();
+
+ // don't allow collapsible: false and active: false / null
+ if ( !options.collapsible && (options.active === false || options.active == null) ) {
+ options.active = 0;
+ }
+ // handle negative values
+ if ( options.active < 0 ) {
+ options.active += this.headers.length;
+ }
+ this.active = this._findActive( options.active )
+ .addClass( "ui-accordion-header-active ui-state-active" )
+ .toggleClass( "ui-corner-all ui-corner-top" );
+ this.active.next()
+ .addClass( "ui-accordion-content-active" )
+ .show();
+
+ this._createIcons();
+ this.refresh();
+
+ // ARIA
+ this.element.attr( "role", "tablist" );
+
+ this.headers
+ .attr( "role", "tab" )
+ .each(function( i ) {
+ var header = $( this ),
+ headerId = header.attr( "id" ),
+ panel = header.next(),
+ panelId = panel.attr( "id" );
+ if ( !headerId ) {
+ headerId = accordionId + "-header-" + i;
+ header.attr( "id", headerId );
+ }
+ if ( !panelId ) {
+ panelId = accordionId + "-panel-" + i;
+ panel.attr( "id", panelId );
+ }
+ header.attr( "aria-controls", panelId );
+ panel.attr( "aria-labelledby", headerId );
+ })
+ .next()
+ .attr( "role", "tabpanel" );
+
+ this.headers
+ .not( this.active )
+ .attr({
+ "aria-selected": "false",
+ tabIndex: -1
+ })
+ .next()
+ .attr({
+ "aria-expanded": "false",
+ "aria-hidden": "true"
+ })
+ .hide();
+
+ // make sure at least one header is in the tab order
+ if ( !this.active.length ) {
+ this.headers.eq( 0 ).attr( "tabIndex", 0 );
+ } else {
+ this.active.attr({
+ "aria-selected": "true",
+ tabIndex: 0
+ })
+ .next()
+ .attr({
+ "aria-expanded": "true",
+ "aria-hidden": "false"
+ });
+ }
+
+ this._on( this.headers, { keydown: "_keydown" });
+ this._on( this.headers.next(), { keydown: "_panelKeyDown" });
+ this._setupEvents( options.event );
+ },
+
+ _getCreateEventData: function() {
+ return {
+ header: this.active,
+ content: !this.active.length ? $() : this.active.next()
+ };
+ },
+
+ _createIcons: function() {
+ var icons = this.options.icons;
+ if ( icons ) {
+ $( "<span>" )
+ .addClass( "ui-accordion-header-icon ui-icon " + icons.header )
+ .prependTo( this.headers );
+ this.active.children( ".ui-accordion-header-icon" )
+ .removeClass( icons.header )
+ .addClass( icons.activeHeader );
+ this.headers.addClass( "ui-accordion-icons" );
+ }
+ },
+
+ _destroyIcons: function() {
+ this.headers
+ .removeClass( "ui-accordion-icons" )
+ .children( ".ui-accordion-header-icon" )
+ .remove();
+ },
+
+ _destroy: function() {
+ var contents;
+
+ // clean up main element
+ this.element
+ .removeClass( "ui-accordion ui-widget ui-helper-reset" )
+ .removeAttr( "role" );
+
+ // clean up headers
+ this.headers
+ .removeClass( "ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-selected" )
+ .removeAttr( "aria-controls" )
+ .removeAttr( "tabIndex" )
+ .each(function() {
+ if ( /^ui-accordion/.test( this.id ) ) {
+ this.removeAttribute( "id" );
+ }
+ });
+ this._destroyIcons();
+
+ // clean up content panels
+ contents = this.headers.next()
+ .css( "display", "" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-expanded" )
+ .removeAttr( "aria-hidden" )
+ .removeAttr( "aria-labelledby" )
+ .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" )
+ .each(function() {
+ if ( /^ui-accordion/.test( this.id ) ) {
+ this.removeAttribute( "id" );
+ }
+ });
+ if ( this.options.heightStyle !== "content" ) {
+ contents.css( "height", "" );
+ }
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "active" ) {
+ // _activate() will handle invalid values and update this.options
+ this._activate( value );
+ return;
+ }
+
+ if ( key === "event" ) {
+ if ( this.options.event ) {
+ this._off( this.headers, this.options.event );
+ }
+ this._setupEvents( value );
+ }
+
+ this._super( key, value );
+
+ // setting collapsible: false while collapsed; open first panel
+ if ( key === "collapsible" && !value && this.options.active === false ) {
+ this._activate( 0 );
+ }
+
+ if ( key === "icons" ) {
+ this._destroyIcons();
+ if ( value ) {
+ this._createIcons();
+ }
+ }
+
+ // #5332 - opacity doesn't cascade to positioned elements in IE
+ // so we need to add the disabled class to the headers and panels
+ if ( key === "disabled" ) {
+ this.headers.add( this.headers.next() )
+ .toggleClass( "ui-state-disabled", !!value );
+ }
+ },
+
+ _keydown: function( event ) {
+ if ( event.altKey || event.ctrlKey ) {
+ return;
+ }
+
+ var keyCode = $.ui.keyCode,
+ length = this.headers.length,
+ currentIndex = this.headers.index( event.target ),
+ toFocus = false;
+
+ switch ( event.keyCode ) {
+ case keyCode.RIGHT:
+ case keyCode.DOWN:
+ toFocus = this.headers[ ( currentIndex + 1 ) % length ];
+ break;
+ case keyCode.LEFT:
+ case keyCode.UP:
+ toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
+ break;
+ case keyCode.SPACE:
+ case keyCode.ENTER:
+ this._eventHandler( event );
+ break;
+ case keyCode.HOME:
+ toFocus = this.headers[ 0 ];
+ break;
+ case keyCode.END:
+ toFocus = this.headers[ length - 1 ];
+ break;
+ }
+
+ if ( toFocus ) {
+ $( event.target ).attr( "tabIndex", -1 );
+ $( toFocus ).attr( "tabIndex", 0 );
+ toFocus.focus();
+ event.preventDefault();
+ }
+ },
+
+ _panelKeyDown : function( event ) {
+ if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
+ $( event.currentTarget ).prev().focus();
+ }
+ },
+
+ refresh: function() {
+ var maxHeight, overflow,
+ heightStyle = this.options.heightStyle,
+ parent = this.element.parent();
+
+
+ if ( heightStyle === "fill" ) {
+ // IE 6 treats height like minHeight, so we need to turn off overflow
+ // in order to get a reliable height
+ // we use the minHeight support test because we assume that only
+ // browsers that don't support minHeight will treat height as minHeight
+ if ( !$.support.minHeight ) {
+ overflow = parent.css( "overflow" );
+ parent.css( "overflow", "hidden");
+ }
+ maxHeight = parent.height();
+ this.element.siblings( ":visible" ).each(function() {
+ var elem = $( this ),
+ position = elem.css( "position" );
+
+ if ( position === "absolute" || position === "fixed" ) {
+ return;
+ }
+ maxHeight -= elem.outerHeight( true );
+ });
+ if ( overflow ) {
+ parent.css( "overflow", overflow );
+ }
+
+ this.headers.each(function() {
+ maxHeight -= $( this ).outerHeight( true );
+ });
+
+ this.headers.next()
+ .each(function() {
+ $( this ).height( Math.max( 0, maxHeight -
+ $( this ).innerHeight() + $( this ).height() ) );
+ })
+ .css( "overflow", "auto" );
+ } else if ( heightStyle === "auto" ) {
+ maxHeight = 0;
+ this.headers.next()
+ .each(function() {
+ maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
+ })
+ .height( maxHeight );
+ }
+ },
+
+ _activate: function( index ) {
+ var active = this._findActive( index )[ 0 ];
+
+ // trying to activate the already active panel
+ if ( active === this.active[ 0 ] ) {
+ return;
+ }
+
+ // trying to collapse, simulate a click on the currently active header
+ active = active || this.active[ 0 ];
+
+ this._eventHandler({
+ target: active,
+ currentTarget: active,
+ preventDefault: $.noop
+ });
+ },
+
+ _findActive: function( selector ) {
+ return typeof selector === "number" ? this.headers.eq( selector ) : $();
+ },
+
+ _setupEvents: function( event ) {
+ var events = {};
+ if ( !event ) {
+ return;
+ }
+ $.each( event.split(" "), function( index, eventName ) {
+ events[ eventName ] = "_eventHandler";
+ });
+ this._on( this.headers, events );
+ },
+
+ _eventHandler: function( event ) {
+ var options = this.options,
+ active = this.active,
+ clicked = $( event.currentTarget ),
+ clickedIsActive = clicked[ 0 ] === active[ 0 ],
+ collapsing = clickedIsActive && options.collapsible,
+ toShow = collapsing ? $() : clicked.next(),
+ toHide = active.next(),
+ eventData = {
+ oldHeader: active,
+ oldPanel: toHide,
+ newHeader: collapsing ? $() : clicked,
+ newPanel: toShow
+ };
+
+ event.preventDefault();
+
+ if (
+ // click on active header, but not collapsible
+ ( clickedIsActive && !options.collapsible ) ||
+ // allow canceling activation
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
+ return;
+ }
+
+ options.active = collapsing ? false : this.headers.index( clicked );
+
+ // when the call to ._toggle() comes after the class changes
+ // it causes a very odd bug in IE 8 (see #6720)
+ this.active = clickedIsActive ? $() : clicked;
+ this._toggle( eventData );
+
+ // switch classes
+ // corner classes on the previously active header stay after the animation
+ active.removeClass( "ui-accordion-header-active ui-state-active" );
+ if ( options.icons ) {
+ active.children( ".ui-accordion-header-icon" )
+ .removeClass( options.icons.activeHeader )
+ .addClass( options.icons.header );
+ }
+
+ if ( !clickedIsActive ) {
+ clicked
+ .removeClass( "ui-corner-all" )
+ .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
+ if ( options.icons ) {
+ clicked.children( ".ui-accordion-header-icon" )
+ .removeClass( options.icons.header )
+ .addClass( options.icons.activeHeader );
+ }
+
+ clicked
+ .next()
+ .addClass( "ui-accordion-content-active" );
+ }
+ },
+
+ _toggle: function( data ) {
+ var toShow = data.newPanel,
+ toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
+
+ // handle activating a panel during the animation for another activation
+ this.prevShow.add( this.prevHide ).stop( true, true );
+ this.prevShow = toShow;
+ this.prevHide = toHide;
+
+ if ( this.options.animate ) {
+ this._animate( toShow, toHide, data );
+ } else {
+ toHide.hide();
+ toShow.show();
+ this._toggleComplete( data );
+ }
+
+ toHide.attr({
+ "aria-expanded": "false",
+ "aria-hidden": "true"
+ });
+ toHide.prev().attr( "aria-selected", "false" );
+ // if we're switching panels, remove the old header from the tab order
+ // if we're opening from collapsed state, remove the previous header from the tab order
+ // if we're collapsing, then keep the collapsing header in the tab order
+ if ( toShow.length && toHide.length ) {
+ toHide.prev().attr( "tabIndex", -1 );
+ } else if ( toShow.length ) {
+ this.headers.filter(function() {
+ return $( this ).attr( "tabIndex" ) === 0;
+ })
+ .attr( "tabIndex", -1 );
+ }
+
+ toShow
+ .attr({
+ "aria-expanded": "true",
+ "aria-hidden": "false"
+ })
+ .prev()
+ .attr({
+ "aria-selected": "true",
+ tabIndex: 0
+ });
+ },
+
+ _animate: function( toShow, toHide, data ) {
+ var total, easing, duration,
+ that = this,
+ adjust = 0,
+ down = toShow.length &&
+ ( !toHide.length || ( toShow.index() < toHide.index() ) ),
+ animate = this.options.animate || {},
+ options = down && animate.down || animate,
+ complete = function() {
+ that._toggleComplete( data );
+ };
+
+ if ( typeof options === "number" ) {
+ duration = options;
+ }
+ if ( typeof options === "string" ) {
+ easing = options;
+ }
+ // fall back from options to animation in case of partial down settings
+ easing = easing || options.easing || animate.easing;
+ duration = duration || options.duration || animate.duration;
+
+ if ( !toHide.length ) {
+ return toShow.animate( showProps, duration, easing, complete );
+ }
+ if ( !toShow.length ) {
+ return toHide.animate( hideProps, duration, easing, complete );
+ }
+
+ total = toShow.show().outerHeight();
+ toHide.animate( hideProps, {
+ duration: duration,
+ easing: easing,
+ step: function( now, fx ) {
+ fx.now = Math.round( now );
+ }
+ });
+ toShow
+ .hide()
+ .animate( showProps, {
+ duration: duration,
+ easing: easing,
+ complete: complete,
+ step: function( now, fx ) {
+ fx.now = Math.round( now );
+ if ( fx.prop !== "height" ) {
+ adjust += fx.now;
+ } else if ( that.options.heightStyle !== "content" ) {
+ fx.now = Math.round( total - toHide.outerHeight() - adjust );
+ adjust = 0;
+ }
+ }
+ });
+ },
+
+ _toggleComplete: function( data ) {
+ var toHide = data.oldPanel;
+
+ toHide
+ .removeClass( "ui-accordion-content-active" )
+ .prev()
+ .removeClass( "ui-corner-top" )
+ .addClass( "ui-corner-all" );
+
+ // Work around for rendering bug in IE (#5421)
+ if ( toHide.length ) {
+ toHide.parent()[0].className = toHide.parent()[0].className;
+ }
+
+ this._trigger( "activate", null, data );
+ }
+});
+
+
+
+// DEPRECATED
+if ( $.uiBackCompat !== false ) {
+ // navigation options
+ (function( $, prototype ) {
+ $.extend( prototype.options, {
+ navigation: false,
+ navigationFilter: function() {
+ return this.href.toLowerCase() === location.href.toLowerCase();
+ }
+ });
+
+ var _create = prototype._create;
+ prototype._create = function() {
+ if ( this.options.navigation ) {
+ var that = this,
+ headers = this.element.find( this.options.header ),
+ content = headers.next(),
+ current = headers.add( content )
+ .find( "a" )
+ .filter( this.options.navigationFilter )
+ [ 0 ];
+ if ( current ) {
+ headers.add( content ).each( function( index ) {
+ if ( $.contains( this, current ) ) {
+ that.options.active = Math.floor( index / 2 );
+ return false;
+ }
+ });
+ }
+ }
+ _create.call( this );
+ };
+ }( jQuery, jQuery.ui.accordion.prototype ) );
+
+ // height options
+ (function( $, prototype ) {
+ $.extend( prototype.options, {
+ heightStyle: null, // remove default so we fall back to old values
+ autoHeight: true, // use heightStyle: "auto"
+ clearStyle: false, // use heightStyle: "content"
+ fillSpace: false // use heightStyle: "fill"
+ });
+
+ var _create = prototype._create,
+ _setOption = prototype._setOption;
+
+ $.extend( prototype, {
+ _create: function() {
+ this.options.heightStyle = this.options.heightStyle ||
+ this._mergeHeightStyle();
+
+ _create.call( this );
+ },
+
+ _setOption: function( key ) {
+ if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) {
+ this.options.heightStyle = this._mergeHeightStyle();
+ }
+ _setOption.apply( this, arguments );
+ },
+
+ _mergeHeightStyle: function() {
+ var options = this.options;
+
+ if ( options.fillSpace ) {
+ return "fill";
+ }
+
+ if ( options.clearStyle ) {
+ return "content";
+ }
+
+ if ( options.autoHeight ) {
+ return "auto";
+ }
+ }
+ });
+ }( jQuery, jQuery.ui.accordion.prototype ) );
+
+ // icon options
+ (function( $, prototype ) {
+ $.extend( prototype.options.icons, {
+ activeHeader: null, // remove default so we fall back to old values
+ headerSelected: "ui-icon-triangle-1-s"
+ });
+
+ var _createIcons = prototype._createIcons;
+ prototype._createIcons = function() {
+ if ( this.options.icons ) {
+ this.options.icons.activeHeader = this.options.icons.activeHeader ||
+ this.options.icons.headerSelected;
+ }
+ _createIcons.call( this );
+ };
+ }( jQuery, jQuery.ui.accordion.prototype ) );
+
+ // expanded active option, activate method
+ (function( $, prototype ) {
+ prototype.activate = prototype._activate;
+
+ var _findActive = prototype._findActive;
+ prototype._findActive = function( index ) {
+ if ( index === -1 ) {
+ index = false;
+ }
+ if ( index && typeof index !== "number" ) {
+ index = this.headers.index( this.headers.filter( index ) );
+ if ( index === -1 ) {
+ index = false;
+ }
+ }
+ return _findActive.call( this, index );
+ };
+ }( jQuery, jQuery.ui.accordion.prototype ) );
+
+ // resize method
+ jQuery.ui.accordion.prototype.resize = jQuery.ui.accordion.prototype.refresh;
+
+ // change events
+ (function( $, prototype ) {
+ $.extend( prototype.options, {
+ change: null,
+ changestart: null
+ });
+
+ var _trigger = prototype._trigger;
+ prototype._trigger = function( type, event, data ) {
+ var ret = _trigger.apply( this, arguments );
+ if ( !ret ) {
+ return false;
+ }
+
+ if ( type === "beforeActivate" ) {
+ ret = _trigger.call( this, "changestart", event, {
+ oldHeader: data.oldHeader,
+ oldContent: data.oldPanel,
+ newHeader: data.newHeader,
+ newContent: data.newPanel
+ });
+ } else if ( type === "activate" ) {
+ ret = _trigger.call( this, "change", event, {
+ oldHeader: data.oldHeader,
+ oldContent: data.oldPanel,
+ newHeader: data.newHeader,
+ newContent: data.newPanel
+ });
+ }
+ return ret;
+ };
+ }( jQuery, jQuery.ui.accordion.prototype ) );
+
+ // animated option
+ // NOTE: this only provides support for "slide", "bounceslide", and easings
+ // not the full $.ui.accordion.animations API
+ (function( $, prototype ) {
+ $.extend( prototype.options, {
+ animate: null,
+ animated: "slide"
+ });
+
+ var _create = prototype._create;
+ prototype._create = function() {
+ var options = this.options;
+ if ( options.animate === null ) {
+ if ( !options.animated ) {
+ options.animate = false;
+ } else if ( options.animated === "slide" ) {
+ options.animate = 300;
+ } else if ( options.animated === "bounceslide" ) {
+ options.animate = {
+ duration: 200,
+ down: {
+ easing: "easeOutBounce",
+ duration: 1000
+ }
+ };
+ } else {
+ options.animate = options.animated;
+ }
+ }
+
+ _create.call( this );
+ };
+ }( jQuery, jQuery.ui.accordion.prototype ) );
+}
+
+})( jQuery );
+(function( $, undefined ) {
+
+// used to prevent race conditions with remote data sources
+var requestIndex = 0;
+
+$.widget( "ui.autocomplete", {
+ version: "1.9.2",
+ defaultElement: "<input>",
+ options: {
+ appendTo: "body",
+ autoFocus: false,
+ delay: 300,
+ minLength: 1,
+ position: {
+ my: "left top",
+ at: "left bottom",
+ collision: "none"
+ },
+ source: null,
+
+ // callbacks
+ change: null,
+ close: null,
+ focus: null,
+ open: null,
+ response: null,
+ search: null,
+ select: null
+ },
+
+ pending: 0,
+
+ _create: function() {
+ // Some browsers only repeat keydown events, not keypress events,
+ // so we use the suppressKeyPress flag to determine if we've already
+ // handled the keydown event. #7269
+ // Unfortunately the code for & in keypress is the same as the up arrow,
+ // so we use the suppressKeyPressRepeat flag to avoid handling keypress
+ // events when we know the keydown event was used to modify the
+ // search term. #7799
+ var suppressKeyPress, suppressKeyPressRepeat, suppressInput;
+
+ this.isMultiLine = this._isMultiLine();
+ this.valueMethod = this.element[ this.element.is( "input,textarea" ) ? "val" : "text" ];
+ this.isNewMenu = true;
+
+ this.element
+ .addClass( "ui-autocomplete-input" )
+ .attr( "autocomplete", "off" );
+
+ this._on( this.element, {
+ keydown: function( event ) {
+ if ( this.element.prop( "readOnly" ) ) {
+ suppressKeyPress = true;
+ suppressInput = true;
+ suppressKeyPressRepeat = true;
+ return;
+ }
+
+ suppressKeyPress = false;
+ suppressInput = false;
+ suppressKeyPressRepeat = false;
+ var keyCode = $.ui.keyCode;
+ switch( event.keyCode ) {
+ case keyCode.PAGE_UP:
+ suppressKeyPress = true;
+ this._move( "previousPage", event );
+ break;
+ case keyCode.PAGE_DOWN:
+ suppressKeyPress = true;
+ this._move( "nextPage", event );
+ break;
+ case keyCode.UP:
+ suppressKeyPress = true;
+ this._keyEvent( "previous", event );
+ break;
+ case keyCode.DOWN:
+ suppressKeyPress = true;
+ this._keyEvent( "next", event );
+ break;
+ case keyCode.ENTER:
+ case keyCode.NUMPAD_ENTER:
+ // when menu is open and has focus
+ if ( this.menu.active ) {
+ // #6055 - Opera still allows the keypress to occur
+ // which causes forms to submit
+ suppressKeyPress = true;
+ event.preventDefault();
+ this.menu.select( event );
+ }
+ break;
+ case keyCode.TAB:
+ if ( this.menu.active ) {
+ this.menu.select( event );
+ }
+ break;
+ case keyCode.ESCAPE:
+ if ( this.menu.element.is( ":visible" ) ) {
+ this._value( this.term );
+ this.close( event );
+ // Different browsers have different default behavior for escape
+ // Single press can mean undo or clear
+ // Double press in IE means clear the whole form
+ event.preventDefault();
+ }
+ break;
+ default:
+ suppressKeyPressRepeat = true;
+ // search timeout should be triggered before the input value is changed
+ this._searchTimeout( event );
+ break;
+ }
+ },
+ keypress: function( event ) {
+ if ( suppressKeyPress ) {
+ suppressKeyPress = false;
+ event.preventDefault();
+ return;
+ }
+ if ( suppressKeyPressRepeat ) {
+ return;
+ }
+
+ // replicate some key handlers to allow them to repeat in Firefox and Opera
+ var keyCode = $.ui.keyCode;
+ switch( event.keyCode ) {
+ case keyCode.PAGE_UP:
+ this._move( "previousPage", event );
+ break;
+ case keyCode.PAGE_DOWN:
+ this._move( "nextPage", event );
+ break;
+ case keyCode.UP:
+ this._keyEvent( "previous", event );
+ break;
+ case keyCode.DOWN:
+ this._keyEvent( "next", event );
+ break;
+ }
+ },
+ input: function( event ) {
+ if ( suppressInput ) {
+ suppressInput = false;
+ event.preventDefault();
+ return;
+ }
+ this._searchTimeout( event );
+ },
+ focus: function() {
+ this.selectedItem = null;
+ this.previous = this._value();
+ },
+ blur: function( event ) {
+ if ( this.cancelBlur ) {
+ delete this.cancelBlur;
+ return;
+ }
+
+ clearTimeout( this.searching );
+ this.close( event );
+ this._change( event );
+ }
+ });
+
+ this._initSource();
+ this.menu = $( "<ul>" )
+ .addClass( "ui-autocomplete" )
+ .appendTo( this.document.find( this.options.appendTo || "body" )[ 0 ] )
+ .menu({
+ // custom key handling for now
+ input: $(),
+ // disable ARIA support, the live region takes care of that
+ role: null
+ })
+ .zIndex( this.element.zIndex() + 1 )
+ .hide()
+ .data( "menu" );
+
+ this._on( this.menu.element, {
+ mousedown: function( event ) {
+ // prevent moving focus out of the text field
+ event.preventDefault();
+
+ // IE doesn't prevent moving focus even with event.preventDefault()
+ // so we set a flag to know when we should ignore the blur event
+ this.cancelBlur = true;
+ this._delay(function() {
+ delete this.cancelBlur;
+ });
+
+ // clicking on the scrollbar causes focus to shift to the body
+ // but we can't detect a mouseup or a click immediately afterward
+ // so we have to track the next mousedown and close the menu if
+ // the user clicks somewhere outside of the autocomplete
+ var menuElement = this.menu.element[ 0 ];
+ if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
+ this._delay(function() {
+ var that = this;
+ this.document.one( "mousedown", function( event ) {
+ if ( event.target !== that.element[ 0 ] &&
+ event.target !== menuElement &&
+ !$.contains( menuElement, event.target ) ) {
+ that.close();
+ }
+ });
+ });
+ }
+ },
+ menufocus: function( event, ui ) {
+ // #7024 - Prevent accidental activation of menu items in Firefox
+ if ( this.isNewMenu ) {
+ this.isNewMenu = false;
+ if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
+ this.menu.blur();
+
+ this.document.one( "mousemove", function() {
+ $( event.target ).trigger( event.originalEvent );
+ });
+
+ return;
+ }
+ }
+
+ // back compat for _renderItem using item.autocomplete, via #7810
+ // TODO remove the fallback, see #8156
+ var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" );
+ if ( false !== this._trigger( "focus", event, { item: item } ) ) {
+ // use value to match what will end up in the input, if it was a key event
+ if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
+ this._value( item.value );
+ }
+ } else {
+ // Normally the input is populated with the item's value as the
+ // menu is navigated, causing screen readers to notice a change and
+ // announce the item. Since the focus event was canceled, this doesn't
+ // happen, so we update the live region so that screen readers can
+ // still notice the change and announce it.
+ this.liveRegion.text( item.value );
+ }
+ },
+ menuselect: function( event, ui ) {
+ // back compat for _renderItem using item.autocomplete, via #7810
+ // TODO remove the fallback, see #8156
+ var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ),
+ previous = this.previous;
+
+ // only trigger when focus was lost (click on menu)
+ if ( this.element[0] !== this.document[0].activeElement ) {
+ this.element.focus();
+ this.previous = previous;
+ // #6109 - IE triggers two focus events and the second
+ // is asynchronous, so we need to reset the previous
+ // term synchronously and asynchronously :-(
+ this._delay(function() {
+ this.previous = previous;
+ this.selectedItem = item;
+ });
+ }
+
+ if ( false !== this._trigger( "select", event, { item: item } ) ) {
+ this._value( item.value );
+ }
+ // reset the term after the select event
+ // this allows custom select handling to work properly
+ this.term = this._value();
+
+ this.close( event );
+ this.selectedItem = item;
+ }
+ });
+
+ this.liveRegion = $( "<span>", {
+ role: "status",
+ "aria-live": "polite"
+ })
+ .addClass( "ui-helper-hidden-accessible" )
+ .insertAfter( this.element );
+
+ if ( $.fn.bgiframe ) {
+ this.menu.element.bgiframe();
+ }
+
+ // turning off autocomplete prevents the browser from remembering the
+ // value when navigating through history, so we re-enable autocomplete
+ // if the page is unloaded before the widget is destroyed. #7790
+ this._on( this.window, {
+ beforeunload: function() {
+ this.element.removeAttr( "autocomplete" );
+ }
+ });
+ },
+
+ _destroy: function() {
+ clearTimeout( this.searching );
+ this.element
+ .removeClass( "ui-autocomplete-input" )
+ .removeAttr( "autocomplete" );
+ this.menu.element.remove();
+ this.liveRegion.remove();
+ },
+
+ _setOption: function( key, value ) {
+ this._super( key, value );
+ if ( key === "source" ) {
+ this._initSource();
+ }
+ if ( key === "appendTo" ) {
+ this.menu.element.appendTo( this.document.find( value || "body" )[0] );
+ }
+ if ( key === "disabled" && value && this.xhr ) {
+ this.xhr.abort();
+ }
+ },
+
+ _isMultiLine: function() {
+ // Textareas are always multi-line
+ if ( this.element.is( "textarea" ) ) {
+ return true;
+ }
+ // Inputs are always single-line, even if inside a contentEditable element
+ // IE also treats inputs as contentEditable
+ if ( this.element.is( "input" ) ) {
+ return false;
+ }
+ // All other element types are determined by whether or not they're contentEditable
+ return this.element.prop( "isContentEditable" );
+ },
+
+ _initSource: function() {
+ var array, url,
+ that = this;
+ if ( $.isArray(this.options.source) ) {
+ array = this.options.source;
+ this.source = function( request, response ) {
+ response( $.ui.autocomplete.filter( array, request.term ) );
+ };
+ } else if ( typeof this.options.source === "string" ) {
+ url = this.options.source;
+ this.source = function( request, response ) {
+ if ( that.xhr ) {
+ that.xhr.abort();
+ }
+ that.xhr = $.ajax({
+ url: url,
+ data: request,
+ dataType: "json",
+ success: function( data ) {
+ response( data );
+ },
+ error: function() {
+ response( [] );
+ }
+ });
+ };
+ } else {
+ this.source = this.options.source;
+ }
+ },
+
+ _searchTimeout: function( event ) {
+ clearTimeout( this.searching );
+ this.searching = this._delay(function() {
+ // only search if the value has changed
+ if ( this.term !== this._value() ) {
+ this.selectedItem = null;
+ this.search( null, event );
+ }
+ }, this.options.delay );
+ },
+
+ search: function( value, event ) {
+ value = value != null ? value : this._value();
+
+ // always save the actual value, not the one passed as an argument
+ this.term = this._value();
+
+ if ( value.length < this.options.minLength ) {
+ return this.close( event );
+ }
+
+ if ( this._trigger( "search", event ) === false ) {
+ return;
+ }
+
+ return this._search( value );
+ },
+
+ _search: function( value ) {
+ this.pending++;
+ this.element.addClass( "ui-autocomplete-loading" );
+ this.cancelSearch = false;
+
+ this.source( { term: value }, this._response() );
+ },
+
+ _response: function() {
+ var that = this,
+ index = ++requestIndex;
+
+ return function( content ) {
+ if ( index === requestIndex ) {
+ that.__response( content );
+ }
+
+ that.pending--;
+ if ( !that.pending ) {
+ that.element.removeClass( "ui-autocomplete-loading" );
+ }
+ };
+ },
+
+ __response: function( content ) {
+ if ( content ) {
+ content = this._normalize( content );
+ }
+ this._trigger( "response", null, { content: content } );
+ if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
+ this._suggest( content );
+ this._trigger( "open" );
+ } else {
+ // use ._close() instead of .close() so we don't cancel future searches
+ this._close();
+ }
+ },
+
+ close: function( event ) {
+ this.cancelSearch = true;
+ this._close( event );
+ },
+
+ _close: function( event ) {
+ if ( this.menu.element.is( ":visible" ) ) {
+ this.menu.element.hide();
+ this.menu.blur();
+ this.isNewMenu = true;
+ this._trigger( "close", event );
+ }
+ },
+
+ _change: function( event ) {
+ if ( this.previous !== this._value() ) {
+ this._trigger( "change", event, { item: this.selectedItem } );
+ }
+ },
+
+ _normalize: function( items ) {
+ // assume all items have the right format when the first item is complete
+ if ( items.length && items[0].label && items[0].value ) {
+ return items;
+ }
+ return $.map( items, function( item ) {
+ if ( typeof item === "string" ) {
+ return {
+ label: item,
+ value: item
+ };
+ }
+ return $.extend({
+ label: item.label || item.value,
+ value: item.value || item.label
+ }, item );
+ });
+ },
+
+ _suggest: function( items ) {
+ var ul = this.menu.element
+ .empty()
+ .zIndex( this.element.zIndex() + 1 );
+ this._renderMenu( ul, items );
+ this.menu.refresh();
+
+ // size and position menu
+ ul.show();
+ this._resizeMenu();
+ ul.position( $.extend({
+ of: this.element
+ }, this.options.position ));
+
+ if ( this.options.autoFocus ) {
+ this.menu.next();
+ }
+ },
+
+ _resizeMenu: function() {
+ var ul = this.menu.element;
+ ul.outerWidth( Math.max(
+ // Firefox wraps long text (possibly a rounding bug)
+ // so we add 1px to avoid the wrapping (#7513)
+ ul.width( "" ).outerWidth() + 1,
+ this.element.outerWidth()
+ ) );
+ },
+
+ _renderMenu: function( ul, items ) {
+ var that = this;
+ $.each( items, function( index, item ) {
+ that._renderItemData( ul, item );
+ });
+ },
+
+ _renderItemData: function( ul, item ) {
+ return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
+ },
+
+ _renderItem: function( ul, item ) {
+ return $( "<li>" )
+ .append( $( "<a>" ).text( item.label ) )
+ .appendTo( ul );
+ },
+
+ _move: function( direction, event ) {
+ if ( !this.menu.element.is( ":visible" ) ) {
+ this.search( null, event );
+ return;
+ }
+ if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
+ this.menu.isLastItem() && /^next/.test( direction ) ) {
+ this._value( this.term );
+ this.menu.blur();
+ return;
+ }
+ this.menu[ direction ]( event );
+ },
+
+ widget: function() {
+ return this.menu.element;
+ },
+
+ _value: function() {
+ return this.valueMethod.apply( this.element, arguments );
+ },
+
+ _keyEvent: function( keyEvent, event ) {
+ if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
+ this._move( keyEvent, event );
+
+ // prevents moving cursor to beginning/end of the text field in some browsers
+ event.preventDefault();
+ }
+ }
+});
+
+$.extend( $.ui.autocomplete, {
+ escapeRegex: function( value ) {
+ return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
+ },
+ filter: function(array, term) {
+ var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
+ return $.grep( array, function(value) {
+ return matcher.test( value.label || value.value || value );
+ });
+ }
+});
+
+
+// live region extension, adding a `messages` option
+// NOTE: This is an experimental API. We are still investigating
+// a full solution for string manipulation and internationalization.
+$.widget( "ui.autocomplete", $.ui.autocomplete, {
+ options: {
+ messages: {
+ noResults: "No search results.",
+ results: function( amount ) {
+ return amount + ( amount > 1 ? " results are" : " result is" ) +
+ " available, use up and down arrow keys to navigate.";
+ }
+ }
+ },
+
+ __response: function( content ) {
+ var message;
+ this._superApply( arguments );
+ if ( this.options.disabled || this.cancelSearch ) {
+ return;
+ }
+ if ( content && content.length ) {
+ message = this.options.messages.results( content.length );
+ } else {
+ message = this.options.messages.noResults;
+ }
+ this.liveRegion.text( message );
+ }
+});
+
+
+}( jQuery ));
+(function( $, undefined ) {
+
+var lastActive, startXPos, startYPos, clickDragged,
+ baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
+ stateClasses = "ui-state-hover ui-state-active ",
+ typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
+ formResetHandler = function() {
+ var buttons = $( this ).find( ":ui-button" );
+ setTimeout(function() {
+ buttons.button( "refresh" );
+ }, 1 );
+ },
+ radioGroup = function( radio ) {
+ var name = radio.name,
+ form = radio.form,
+ radios = $( [] );
+ if ( name ) {
+ if ( form ) {
+ radios = $( form ).find( "[name='" + name + "']" );
+ } else {
+ radios = $( "[name='" + name + "']", radio.ownerDocument )
+ .filter(function() {
+ return !this.form;
+ });
+ }
+ }
+ return radios;
+ };
+
+$.widget( "ui.button", {
+ version: "1.9.2",
+ defaultElement: "<button>",
+ options: {
+ disabled: null,
+ text: true,
+ label: null,
+ icons: {
+ primary: null,
+ secondary: null
+ }
+ },
+ _create: function() {
+ this.element.closest( "form" )
+ .unbind( "reset" + this.eventNamespace )
+ .bind( "reset" + this.eventNamespace, formResetHandler );
+
+ if ( typeof this.options.disabled !== "boolean" ) {
+ this.options.disabled = !!this.element.prop( "disabled" );
+ } else {
+ this.element.prop( "disabled", this.options.disabled );
+ }
+
+ this._determineButtonType();
+ this.hasTitle = !!this.buttonElement.attr( "title" );
+
+ var that = this,
+ options = this.options,
+ toggleButton = this.type === "checkbox" || this.type === "radio",
+ activeClass = !toggleButton ? "ui-state-active" : "",
+ focusClass = "ui-state-focus";
+
+ if ( options.label === null ) {
+ options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
+ }
+
+ this._hoverable( this.buttonElement );
+
+ this.buttonElement
+ .addClass( baseClasses )
+ .attr( "role", "button" )
+ .bind( "mouseenter" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return;
+ }
+ if ( this === lastActive ) {
+ $( this ).addClass( "ui-state-active" );
+ }
+ })
+ .bind( "mouseleave" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return;
+ }
+ $( this ).removeClass( activeClass );
+ })
+ .bind( "click" + this.eventNamespace, function( event ) {
+ if ( options.disabled ) {
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ }
+ });
+
+ this.element
+ .bind( "focus" + this.eventNamespace, function() {
+ // no need to check disabled, focus won't be triggered anyway
+ that.buttonElement.addClass( focusClass );
+ })
+ .bind( "blur" + this.eventNamespace, function() {
+ that.buttonElement.removeClass( focusClass );
+ });
+
+ if ( toggleButton ) {
+ this.element.bind( "change" + this.eventNamespace, function() {
+ if ( clickDragged ) {
+ return;
+ }
+ that.refresh();
+ });
+ // if mouse moves between mousedown and mouseup (drag) set clickDragged flag
+ // prevents issue where button state changes but checkbox/radio checked state
+ // does not in Firefox (see ticket #6970)
+ this.buttonElement
+ .bind( "mousedown" + this.eventNamespace, function( event ) {
+ if ( options.disabled ) {
+ return;
+ }
+ clickDragged = false;
+ startXPos = event.pageX;
+ startYPos = event.pageY;
+ })
+ .bind( "mouseup" + this.eventNamespace, function( event ) {
+ if ( options.disabled ) {
+ return;
+ }
+ if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
+ clickDragged = true;
+ }
+ });
+ }
+
+ if ( this.type === "checkbox" ) {
+ this.buttonElement.bind( "click" + this.eventNamespace, function() {
+ if ( options.disabled || clickDragged ) {
+ return false;
+ }
+ $( this ).toggleClass( "ui-state-active" );
+ that.buttonElement.attr( "aria-pressed", that.element[0].checked );
+ });
+ } else if ( this.type === "radio" ) {
+ this.buttonElement.bind( "click" + this.eventNamespace, function() {
+ if ( options.disabled || clickDragged ) {
+ return false;
+ }
+ $( this ).addClass( "ui-state-active" );
+ that.buttonElement.attr( "aria-pressed", "true" );
+
+ var radio = that.element[ 0 ];
+ radioGroup( radio )
+ .not( radio )
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ });
+ } else {
+ this.buttonElement
+ .bind( "mousedown" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).addClass( "ui-state-active" );
+ lastActive = this;
+ that.document.one( "mouseup", function() {
+ lastActive = null;
+ });
+ })
+ .bind( "mouseup" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).removeClass( "ui-state-active" );
+ })
+ .bind( "keydown" + this.eventNamespace, function(event) {
+ if ( options.disabled ) {
+ return false;
+ }
+ if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
+ $( this ).addClass( "ui-state-active" );
+ }
+ })
+ .bind( "keyup" + this.eventNamespace, function() {
+ $( this ).removeClass( "ui-state-active" );
+ });
+
+ if ( this.buttonElement.is("a") ) {
+ this.buttonElement.keyup(function(event) {
+ if ( event.keyCode === $.ui.keyCode.SPACE ) {
+ // TODO pass through original event correctly (just as 2nd argument doesn't work)
+ $( this ).click();
+ }
+ });
+ }
+ }
+
+ // TODO: pull out $.Widget's handling for the disabled option into
+ // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
+ // be overridden by individual plugins
+ this._setOption( "disabled", options.disabled );
+ this._resetButton();
+ },
+
+ _determineButtonType: function() {
+ var ancestor, labelSelector, checked;
+
+ if ( this.element.is("[type=checkbox]") ) {
+ this.type = "checkbox";
+ } else if ( this.element.is("[type=radio]") ) {
+ this.type = "radio";
+ } else if ( this.element.is("input") ) {
+ this.type = "input";
+ } else {
+ this.type = "button";
+ }
+
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ // we don't search against the document in case the element
+ // is disconnected from the DOM
+ ancestor = this.element.parents().last();
+ labelSelector = "label[for='" + this.element.attr("id") + "']";
+ this.buttonElement = ancestor.find( labelSelector );
+ if ( !this.buttonElement.length ) {
+ ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
+ this.buttonElement = ancestor.filter( labelSelector );
+ if ( !this.buttonElement.length ) {
+ this.buttonElement = ancestor.find( labelSelector );
+ }
+ }
+ this.element.addClass( "ui-helper-hidden-accessible" );
+
+ checked = this.element.is( ":checked" );
+ if ( checked ) {
+ this.buttonElement.addClass( "ui-state-active" );
+ }
+ this.buttonElement.prop( "aria-pressed", checked );
+ } else {
+ this.buttonElement = this.element;
+ }
+ },
+
+ widget: function() {
+ return this.buttonElement;
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass( "ui-helper-hidden-accessible" );
+ this.buttonElement
+ .removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
+ .removeAttr( "role" )
+ .removeAttr( "aria-pressed" )
+ .html( this.buttonElement.find(".ui-button-text").html() );
+
+ if ( !this.hasTitle ) {
+ this.buttonElement.removeAttr( "title" );
+ }
+ },
+
+ _setOption: function( key, value ) {
+ this._super( key, value );
+ if ( key === "disabled" ) {
+ if ( value ) {
+ this.element.prop( "disabled", true );
+ } else {
+ this.element.prop( "disabled", false );
+ }
+ return;
+ }
+ this._resetButton();
+ },
+
+ refresh: function() {
+ //See #8237 & #8828
+ var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
+
+ if ( isDisabled !== this.options.disabled ) {
+ this._setOption( "disabled", isDisabled );
+ }
+ if ( this.type === "radio" ) {
+ radioGroup( this.element[0] ).each(function() {
+ if ( $( this ).is( ":checked" ) ) {
+ $( this ).button( "widget" )
+ .addClass( "ui-state-active" )
+ .attr( "aria-pressed", "true" );
+ } else {
+ $( this ).button( "widget" )
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ }
+ });
+ } else if ( this.type === "checkbox" ) {
+ if ( this.element.is( ":checked" ) ) {
+ this.buttonElement
+ .addClass( "ui-state-active" )
+ .attr( "aria-pressed", "true" );
+ } else {
+ this.buttonElement
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ }
+ }
+ },
+
+ _resetButton: function() {
+ if ( this.type === "input" ) {
+ if ( this.options.label ) {
+ this.element.val( this.options.label );
+ }
+ return;
+ }
+ var buttonElement = this.buttonElement.removeClass( typeClasses ),
+ buttonText = $( "<span></span>", this.document[0] )
+ .addClass( "ui-button-text" )
+ .html( this.options.label )
+ .appendTo( buttonElement.empty() )
+ .text(),
+ icons = this.options.icons,
+ multipleIcons = icons.primary && icons.secondary,
+ buttonClasses = [];
+
+ if ( icons.primary || icons.secondary ) {
+ if ( this.options.text ) {
+ buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
+ }
+
+ if ( icons.primary ) {
+ buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
+ }
+
+ if ( icons.secondary ) {
+ buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
+ }
+
+ if ( !this.options.text ) {
+ buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
+
+ if ( !this.hasTitle ) {
+ buttonElement.attr( "title", $.trim( buttonText ) );
+ }
+ }
+ } else {
+ buttonClasses.push( "ui-button-text-only" );
+ }
+ buttonElement.addClass( buttonClasses.join( " " ) );
+ }
+});
+
+$.widget( "ui.buttonset", {
+ version: "1.9.2",
+ options: {
+ items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)"
+ },
+
+ _create: function() {
+ this.element.addClass( "ui-buttonset" );
+ },
+
+ _init: function() {
+ this.refresh();
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "disabled" ) {
+ this.buttons.button( "option", key, value );
+ }
+
+ this._super( key, value );
+ },
+
+ refresh: function() {
+ var rtl = this.element.css( "direction" ) === "rtl";
+
+ this.buttons = this.element.find( this.options.items )
+ .filter( ":ui-button" )
+ .button( "refresh" )
+ .end()
+ .not( ":ui-button" )
+ .button()
+ .end()
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
+ .filter( ":first" )
+ .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
+ .end()
+ .filter( ":last" )
+ .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
+ .end()
+ .end();
+ },
+
+ _destroy: function() {
+ this.element.removeClass( "ui-buttonset" );
+ this.buttons
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-corner-left ui-corner-right" )
+ .end()
+ .button( "destroy" );
+ }
+});
+
+}( jQuery ) );
+(function( $, undefined ) {
+
+$.extend($.ui, { datepicker: { version: "1.9.2" } });
+
+var PROP_NAME = 'datepicker';
+var dpuuid = new Date().getTime();
+var instActive;
+
+/* Date picker manager.
+ Use the singleton instance of this class, $.datepicker, to interact with the date picker.
+ Settings for (groups of) date pickers are maintained in an instance object,
+ allowing multiple different settings on the same page. */
+
+function Datepicker() {
+ this.debug = false; // Change this to true to start debugging
+ this._curInst = null; // The current instance in use
+ this._keyEvent = false; // If the last event was a key event
+ this._disabledInputs = []; // List of date picker inputs that have been disabled
+ this._datepickerShowing = false; // True if the popup picker is showing , false if not
+ this._inDialog = false; // True if showing within a "dialog", false if not
+ this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
+ this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
+ this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
+ this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
+ this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
+ this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
+ this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
+ this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
+ this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
+ this.regional = []; // Available regional settings, indexed by language code
+ this.regional[''] = { // Default regional settings
+ closeText: 'Done', // Display text for close link
+ prevText: 'Prev', // Display text for previous month link
+ nextText: 'Next', // Display text for next month link
+ currentText: 'Today', // Display text for current month link
+ monthNames: ['January','February','March','April','May','June',
+ 'July','August','September','October','November','December'], // Names of months for drop-down and formatting
+ monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
+ dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
+ dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
+ dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
+ weekHeader: 'Wk', // Column header for week of the year
+ dateFormat: 'mm/dd/yy', // See format options on parseDate
+ firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
+ isRTL: false, // True if right-to-left language, false if left-to-right
+ showMonthAfterYear: false, // True if the year select precedes month, false for month then year
+ yearSuffix: '' // Additional text to append to the year in the month headers
+ };
+ this._defaults = { // Global defaults for all the date picker instances
+ showOn: 'focus', // 'focus' for popup on focus,
+ // 'button' for trigger button, or 'both' for either
+ showAnim: 'fadeIn', // Name of jQuery animation for popup
+ showOptions: {}, // Options for enhanced animations
+ defaultDate: null, // Used when field is blank: actual date,
+ // +/-number for offset from today, null for today
+ appendText: '', // Display text following the input box, e.g. showing the format
+ buttonText: '...', // Text for trigger button
+ buttonImage: '', // URL for trigger button image
+ buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
+ hideIfNoPrevNext: false, // True to hide next/previous month links
+ // if not applicable, false to just disable them
+ navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
+ gotoCurrent: false, // True if today link goes back to current selection instead
+ changeMonth: false, // True if month can be selected directly, false if only prev/next
+ changeYear: false, // True if year can be selected directly, false if only prev/next
+ yearRange: 'c-10:c+10', // Range of years to display in drop-down,
+ // either relative to today's year (-nn:+nn), relative to currently displayed year
+ // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
+ showOtherMonths: false, // True to show dates in other months, false to leave blank
+ selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
+ showWeek: false, // True to show week of the year, false to not show it
+ calculateWeek: this.iso8601Week, // How to calculate the week of the year,
+ // takes a Date and returns the number of the week for it
+ shortYearCutoff: '+10', // Short year values < this are in the current century,
+ // > this are in the previous century,
+ // string value starting with '+' for current year + value
+ minDate: null, // The earliest selectable date, or null for no limit
+ maxDate: null, // The latest selectable date, or null for no limit
+ duration: 'fast', // Duration of display/closure
+ beforeShowDay: null, // Function that takes a date and returns an array with
+ // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
+ // [2] = cell title (optional), e.g. $.datepicker.noWeekends
+ beforeShow: null, // Function that takes an input field and
+ // returns a set of custom settings for the date picker
+ onSelect: null, // Define a callback function when a date is selected
+ onChangeMonthYear: null, // Define a callback function when the month or year is changed
+ onClose: null, // Define a callback function when the datepicker is closed
+ numberOfMonths: 1, // Number of months to show at a time
+ showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
+ stepMonths: 1, // Number of months to step back/forward
+ stepBigMonths: 12, // Number of months to step back/forward for the big links
+ altField: '', // Selector for an alternate field to store selected dates into
+ altFormat: '', // The date format to use for the alternate field
+ constrainInput: true, // The input is constrained by the current date format
+ showButtonPanel: false, // True to show button panel, false to not show it
+ autoSize: false, // True to size the input for the date format, false to leave as is
+ disabled: false // The initial disabled state
+ };
+ $.extend(this._defaults, this.regional['']);
+ this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'));
+}
+
+$.extend(Datepicker.prototype, {
+ /* Class name added to elements to indicate already configured with a date picker. */
+ markerClassName: 'hasDatepicker',
+
+ //Keep track of the maximum number of rows displayed (see #7043)
+ maxRows: 4,
+
+ /* Debug logging (if enabled). */
+ log: function () {
+ if (this.debug)
+ console.log.apply('', arguments);
+ },
+
+ // TODO rename to "widget" when switching to widget factory
+ _widgetDatepicker: function() {
+ return this.dpDiv;
+ },
+
+ /* Override the default settings for all instances of the date picker.
+ @param settings object - the new settings to use as defaults (anonymous object)
+ @return the manager object */
+ setDefaults: function(settings) {
+ extendRemove(this._defaults, settings || {});
+ return this;
+ },
+
+ /* Attach the date picker to a jQuery selection.
+ @param target element - the target input field or division or span
+ @param settings object - the new settings to use for this date picker instance (anonymous) */
+ _attachDatepicker: function(target, settings) {
+ // check for settings on the control itself - in namespace 'date:'
+ var inlineSettings = null;
+ for (var attrName in this._defaults) {
+ var attrValue = target.getAttribute('date:' + attrName);
+ if (attrValue) {
+ inlineSettings = inlineSettings || {};
+ try {
+ inlineSettings[attrName] = eval(attrValue);
+ } catch (err) {
+ inlineSettings[attrName] = attrValue;
+ }
+ }
+ }
+ var nodeName = target.nodeName.toLowerCase();
+ var inline = (nodeName == 'div' || nodeName == 'span');
+ if (!target.id) {
+ this.uuid += 1;
+ target.id = 'dp' + this.uuid;
+ }
+ var inst = this._newInst($(target), inline);
+ inst.settings = $.extend({}, settings || {}, inlineSettings || {});
+ if (nodeName == 'input') {
+ this._connectDatepicker(target, inst);
+ } else if (inline) {
+ this._inlineDatepicker(target, inst);
+ }
+ },
+
+ /* Create a new instance object. */
+ _newInst: function(target, inline) {
+ var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
+ return {id: id, input: target, // associated target
+ selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
+ drawMonth: 0, drawYear: 0, // month being drawn
+ inline: inline, // is datepicker inline or not
+ dpDiv: (!inline ? this.dpDiv : // presentation div
+ bindHover($('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')))};
+ },
+
+ /* Attach the date picker to an input field. */
+ _connectDatepicker: function(target, inst) {
+ var input = $(target);
+ inst.append = $([]);
+ inst.trigger = $([]);
+ if (input.hasClass(this.markerClassName))
+ return;
+ this._attachments(input, inst);
+ input.addClass(this.markerClassName).keydown(this._doKeyDown).
+ keypress(this._doKeyPress).keyup(this._doKeyUp).
+ bind("setData.datepicker", function(event, key, value) {
+ inst.settings[key] = value;
+ }).bind("getData.datepicker", function(event, key) {
+ return this._get(inst, key);
+ });
+ this._autoSize(inst);
+ $.data(target, PROP_NAME, inst);
+ //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
+ if( inst.settings.disabled ) {
+ this._disableDatepicker( target );
+ }
+ },
+
+ /* Make attachments based on settings. */
+ _attachments: function(input, inst) {
+ var appendText = this._get(inst, 'appendText');
+ var isRTL = this._get(inst, 'isRTL');
+ if (inst.append)
+ inst.append.remove();
+ if (appendText) {
+ inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
+ input[isRTL ? 'before' : 'after'](inst.append);
+ }
+ input.unbind('focus', this._showDatepicker);
+ if (inst.trigger)
+ inst.trigger.remove();
+ var showOn = this._get(inst, 'showOn');
+ if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
+ input.focus(this._showDatepicker);
+ if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
+ var buttonText = this._get(inst, 'buttonText');
+ var buttonImage = this._get(inst, 'buttonImage');
+ inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
+ $('<img/>').addClass(this._triggerClass).
+ attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
+ $('<button type="button"></button>').addClass(this._triggerClass).
+ html(buttonImage == '' ? buttonText : $('<img/>').attr(
+ { src:buttonImage, alt:buttonText, title:buttonText })));
+ input[isRTL ? 'before' : 'after'](inst.trigger);
+ inst.trigger.click(function() {
+ if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
+ $.datepicker._hideDatepicker();
+ else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) {
+ $.datepicker._hideDatepicker();
+ $.datepicker._showDatepicker(input[0]);
+ } else
+ $.datepicker._showDatepicker(input[0]);
+ return false;
+ });
+ }
+ },
+
+ /* Apply the maximum length for the date format. */
+ _autoSize: function(inst) {
+ if (this._get(inst, 'autoSize') && !inst.inline) {
+ var date = new Date(2009, 12 - 1, 20); // Ensure double digits
+ var dateFormat = this._get(inst, 'dateFormat');
+ if (dateFormat.match(/[DM]/)) {
+ var findMax = function(names) {
+ var max = 0;
+ var maxI = 0;
+ for (var i = 0; i < names.length; i++) {
+ if (names[i].length > max) {
+ max = names[i].length;
+ maxI = i;
+ }
+ }
+ return maxI;
+ };
+ date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
+ 'monthNames' : 'monthNamesShort'))));
+ date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
+ 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
+ }
+ inst.input.attr('size', this._formatDate(inst, date).length);
+ }
+ },
+
+ /* Attach an inline date picker to a div. */
+ _inlineDatepicker: function(target, inst) {
+ var divSpan = $(target);
+ if (divSpan.hasClass(this.markerClassName))
+ return;
+ divSpan.addClass(this.markerClassName).append(inst.dpDiv).
+ bind("setData.datepicker", function(event, key, value){
+ inst.settings[key] = value;
+ }).bind("getData.datepicker", function(event, key){
+ return this._get(inst, key);
+ });
+ $.data(target, PROP_NAME, inst);
+ this._setDate(inst, this._getDefaultDate(inst), true);
+ this._updateDatepicker(inst);
+ this._updateAlternate(inst);
+ //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
+ if( inst.settings.disabled ) {
+ this._disableDatepicker( target );
+ }
+ // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
+ // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
+ inst.dpDiv.css( "display", "block" );
+ },
+
+ /* Pop-up the date picker in a "dialog" box.
+ @param input element - ignored
+ @param date string or Date - the initial date to display
+ @param onSelect function - the function to call when a date is selected
+ @param settings object - update the dialog date picker instance's settings (anonymous object)
+ @param pos int[2] - coordinates for the dialog's position within the screen or
+ event - with x/y coordinates or
+ leave empty for default (screen centre)
+ @return the manager object */
+ _dialogDatepicker: function(input, date, onSelect, settings, pos) {
+ var inst = this._dialogInst; // internal instance
+ if (!inst) {
+ this.uuid += 1;
+ var id = 'dp' + this.uuid;
+ this._dialogInput = $('<input type="text" id="' + id +
+ '" style="position: absolute; top: -100px; width: 0px;"/>');
+ this._dialogInput.keydown(this._doKeyDown);
+ $('body').append(this._dialogInput);
+ inst = this._dialogInst = this._newInst(this._dialogInput, false);
+ inst.settings = {};
+ $.data(this._dialogInput[0], PROP_NAME, inst);
+ }
+ extendRemove(inst.settings, settings || {});
+ date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
+ this._dialogInput.val(date);
+
+ this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
+ if (!this._pos) {
+ var browserWidth = document.documentElement.clientWidth;
+ var browserHeight = document.documentElement.clientHeight;
+ var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
+ var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+ this._pos = // should use actual width/height below
+ [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
+ }
+
+ // move input on screen for focus, but hidden behind dialog
+ this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
+ inst.settings.onSelect = onSelect;
+ this._inDialog = true;
+ this.dpDiv.addClass(this._dialogClass);
+ this._showDatepicker(this._dialogInput[0]);
+ if ($.blockUI)
+ $.blockUI(this.dpDiv);
+ $.data(this._dialogInput[0], PROP_NAME, inst);
+ return this;
+ },
+
+ /* Detach a datepicker from its control.
+ @param target element - the target input field or division or span */
+ _destroyDatepicker: function(target) {
+ var $target = $(target);
+ var inst = $.data(target, PROP_NAME);
+ if (!$target.hasClass(this.markerClassName)) {
+ return;
+ }
+ var nodeName = target.nodeName.toLowerCase();
+ $.removeData(target, PROP_NAME);
+ if (nodeName == 'input') {
+ inst.append.remove();
+ inst.trigger.remove();
+ $target.removeClass(this.markerClassName).
+ unbind('focus', this._showDatepicker).
+ unbind('keydown', this._doKeyDown).
+ unbind('keypress', this._doKeyPress).
+ unbind('keyup', this._doKeyUp);
+ } else if (nodeName == 'div' || nodeName == 'span')
+ $target.removeClass(this.markerClassName).empty();
+ },
+
+ /* Enable the date picker to a jQuery selection.
+ @param target element - the target input field or division or span */
+ _enableDatepicker: function(target) {
+ var $target = $(target);
+ var inst = $.data(target, PROP_NAME);
+ if (!$target.hasClass(this.markerClassName)) {
+ return;
+ }
+ var nodeName = target.nodeName.toLowerCase();
+ if (nodeName == 'input') {
+ target.disabled = false;
+ inst.trigger.filter('button').
+ each(function() { this.disabled = false; }).end().
+ filter('img').css({opacity: '1.0', cursor: ''});
+ }
+ else if (nodeName == 'div' || nodeName == 'span') {
+ var inline = $target.children('.' + this._inlineClass);
+ inline.children().removeClass('ui-state-disabled');
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
+ prop("disabled", false);
+ }
+ this._disabledInputs = $.map(this._disabledInputs,
+ function(value) { return (value == target ? null : value); }); // delete entry
+ },
+
+ /* Disable the date picker to a jQuery selection.
+ @param target element - the target input field or division or span */
+ _disableDatepicker: function(target) {
+ var $target = $(target);
+ var inst = $.data(target, PROP_NAME);
+ if (!$target.hasClass(this.markerClassName)) {
+ return;
+ }
+ var nodeName = target.nodeName.toLowerCase();
+ if (nodeName == 'input') {
+ target.disabled = true;
+ inst.trigger.filter('button').
+ each(function() { this.disabled = true; }).end().
+ filter('img').css({opacity: '0.5', cursor: 'default'});
+ }
+ else if (nodeName == 'div' || nodeName == 'span') {
+ var inline = $target.children('.' + this._inlineClass);
+ inline.children().addClass('ui-state-disabled');
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
+ prop("disabled", true);
+ }
+ this._disabledInputs = $.map(this._disabledInputs,
+ function(value) { return (value == target ? null : value); }); // delete entry
+ this._disabledInputs[this._disabledInputs.length] = target;
+ },
+
+ /* Is the first field in a jQuery collection disabled as a datepicker?
+ @param target element - the target input field or division or span
+ @return boolean - true if disabled, false if enabled */
+ _isDisabledDatepicker: function(target) {
+ if (!target) {
+ return false;
+ }
+ for (var i = 0; i < this._disabledInputs.length; i++) {
+ if (this._disabledInputs[i] == target)
+ return true;
+ }
+ return false;
+ },
+
+ /* Retrieve the instance data for the target control.
+ @param target element - the target input field or division or span
+ @return object - the associated instance data
+ @throws error if a jQuery problem getting data */
+ _getInst: function(target) {
+ try {
+ return $.data(target, PROP_NAME);
+ }
+ catch (err) {
+ throw 'Missing instance data for this datepicker';
+ }
+ },
+
+ /* Update or retrieve the settings for a date picker attached to an input field or division.
+ @param target element - the target input field or division or span
+ @param name object - the new settings to update or
+ string - the name of the setting to change or retrieve,
+ when retrieving also 'all' for all instance settings or
+ 'defaults' for all global defaults
+ @param value any - the new value for the setting
+ (omit if above is an object or to retrieve a value) */
+ _optionDatepicker: function(target, name, value) {
+ var inst = this._getInst(target);
+ if (arguments.length == 2 && typeof name == 'string') {
+ return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
+ (inst ? (name == 'all' ? $.extend({}, inst.settings) :
+ this._get(inst, name)) : null));
+ }
+ var settings = name || {};
+ if (typeof name == 'string') {
+ settings = {};
+ settings[name] = value;
+ }
+ if (inst) {
+ if (this._curInst == inst) {
+ this._hideDatepicker();
+ }
+ var date = this._getDateDatepicker(target, true);
+ var minDate = this._getMinMaxDate(inst, 'min');
+ var maxDate = this._getMinMaxDate(inst, 'max');
+ extendRemove(inst.settings, settings);
+ // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
+ if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)
+ inst.settings.minDate = this._formatDate(inst, minDate);
+ if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)
+ inst.settings.maxDate = this._formatDate(inst, maxDate);
+ this._attachments($(target), inst);
+ this._autoSize(inst);
+ this._setDate(inst, date);
+ this._updateAlternate(inst);
+ this._updateDatepicker(inst);
+ }
+ },
+
+ // change method deprecated
+ _changeDatepicker: function(target, name, value) {
+ this._optionDatepicker(target, name, value);
+ },
+
+ /* Redraw the date picker attached to an input field or division.
+ @param target element - the target input field or division or span */
+ _refreshDatepicker: function(target) {
+ var inst = this._getInst(target);
+ if (inst) {
+ this._updateDatepicker(inst);
+ }
+ },
+
+ /* Set the dates for a jQuery selection.
+ @param target element - the target input field or division or span
+ @param date Date - the new date */
+ _setDateDatepicker: function(target, date) {
+ var inst = this._getInst(target);
+ if (inst) {
+ this._setDate(inst, date);
+ this._updateDatepicker(inst);
+ this._updateAlternate(inst);
+ }
+ },
+
+ /* Get the date(s) for the first entry in a jQuery selection.
+ @param target element - the target input field or division or span
+ @param noDefault boolean - true if no default date is to be used
+ @return Date - the current date */
+ _getDateDatepicker: function(target, noDefault) {
+ var inst = this._getInst(target);
+ if (inst && !inst.inline)
+ this._setDateFromField(inst, noDefault);
+ return (inst ? this._getDate(inst) : null);
+ },
+
+ /* Handle keystrokes. */
+ _doKeyDown: function(event) {
+ var inst = $.datepicker._getInst(event.target);
+ var handled = true;
+ var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
+ inst._keyEvent = true;
+ if ($.datepicker._datepickerShowing)
+ switch (event.keyCode) {
+ case 9: $.datepicker._hideDatepicker();
+ handled = false;
+ break; // hide on tab out
+ case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
+ $.datepicker._currentClass + ')', inst.dpDiv);
+ if (sel[0])
+ $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
+ var onSelect = $.datepicker._get(inst, 'onSelect');
+ if (onSelect) {
+ var dateStr = $.datepicker._formatDate(inst);
+
+ // trigger custom callback
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
+ }
+ else
+ $.datepicker._hideDatepicker();
+ return false; // don't submit the form
+ break; // select the value on enter
+ case 27: $.datepicker._hideDatepicker();
+ break; // hide on escape
+ case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ -$.datepicker._get(inst, 'stepBigMonths') :
+ -$.datepicker._get(inst, 'stepMonths')), 'M');
+ break; // previous month/year on page up/+ ctrl
+ case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ +$.datepicker._get(inst, 'stepBigMonths') :
+ +$.datepicker._get(inst, 'stepMonths')), 'M');
+ break; // next month/year on page down/+ ctrl
+ case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
+ handled = event.ctrlKey || event.metaKey;
+ break; // clear on ctrl or command +end
+ case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
+ handled = event.ctrlKey || event.metaKey;
+ break; // current on ctrl or command +home
+ case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
+ handled = event.ctrlKey || event.metaKey;
+ // -1 day on ctrl or command +left
+ if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ -$.datepicker._get(inst, 'stepBigMonths') :
+ -$.datepicker._get(inst, 'stepMonths')), 'M');
+ // next month/year on alt +left on Mac
+ break;
+ case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
+ handled = event.ctrlKey || event.metaKey;
+ break; // -1 week on ctrl or command +up
+ case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
+ handled = event.ctrlKey || event.metaKey;
+ // +1 day on ctrl or command +right
+ if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ +$.datepicker._get(inst, 'stepBigMonths') :
+ +$.datepicker._get(inst, 'stepMonths')), 'M');
+ // next month/year on alt +right
+ break;
+ case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
+ handled = event.ctrlKey || event.metaKey;
+ break; // +1 week on ctrl or command +down
+ default: handled = false;
+ }
+ else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
+ $.datepicker._showDatepicker(this);
+ else {
+ handled = false;
+ }
+ if (handled) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ },
+
+ /* Filter entered characters - based on date format. */
+ _doKeyPress: function(event) {
+ var inst = $.datepicker._getInst(event.target);
+ if ($.datepicker._get(inst, 'constrainInput')) {
+ var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
+ var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
+ return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
+ }
+ },
+
+ /* Synchronise manual entry and field/alternate field. */
+ _doKeyUp: function(event) {
+ var inst = $.datepicker._getInst(event.target);
+ if (inst.input.val() != inst.lastVal) {
+ try {
+ var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
+ (inst.input ? inst.input.val() : null),
+ $.datepicker._getFormatConfig(inst));
+ if (date) { // only if valid
+ $.datepicker._setDateFromField(inst);
+ $.datepicker._updateAlternate(inst);
+ $.datepicker._updateDatepicker(inst);
+ }
+ }
+ catch (err) {
+ $.datepicker.log(err);
+ }
+ }
+ return true;
+ },
+
+ /* Pop-up the date picker for a given input field.
+ If false returned from beforeShow event handler do not show.
+ @param input element - the input field attached to the date picker or
+ event - if triggered by focus */
+ _showDatepicker: function(input) {
+ input = input.target || input;
+ if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
+ input = $('input', input.parentNode)[0];
+ if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
+ return;
+ var inst = $.datepicker._getInst(input);
+ if ($.datepicker._curInst && $.datepicker._curInst != inst) {
+ $.datepicker._curInst.dpDiv.stop(true, true);
+ if ( inst && $.datepicker._datepickerShowing ) {
+ $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
+ }
+ }
+ var beforeShow = $.datepicker._get(inst, 'beforeShow');
+ var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
+ if(beforeShowSettings === false){
+ //false
+ return;
+ }
+ extendRemove(inst.settings, beforeShowSettings);
+ inst.lastVal = null;
+ $.datepicker._lastInput = input;
+ $.datepicker._setDateFromField(inst);
+ if ($.datepicker._inDialog) // hide cursor
+ input.value = '';
+ if (!$.datepicker._pos) { // position below input
+ $.datepicker._pos = $.datepicker._findPos(input);
+ $.datepicker._pos[1] += input.offsetHeight; // add the height
+ }
+ var isFixed = false;
+ $(input).parents().each(function() {
+ isFixed |= $(this).css('position') == 'fixed';
+ return !isFixed;
+ });
+ var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
+ $.datepicker._pos = null;
+ //to avoid flashes on Firefox
+ inst.dpDiv.empty();
+ // determine sizing offscreen
+ inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
+ $.datepicker._updateDatepicker(inst);
+ // fix width for dynamic number of date pickers
+ // and adjust position before showing
+ offset = $.datepicker._checkOffset(inst, offset, isFixed);
+ inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
+ 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
+ left: offset.left + 'px', top: offset.top + 'px'});
+ if (!inst.inline) {
+ var showAnim = $.datepicker._get(inst, 'showAnim');
+ var duration = $.datepicker._get(inst, 'duration');
+ var postProcess = function() {
+ var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
+ if( !! cover.length ){
+ var borders = $.datepicker._getBorders(inst.dpDiv);
+ cover.css({left: -borders[0], top: -borders[1],
+ width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
+ }
+ };
+ inst.dpDiv.zIndex($(input).zIndex()+1);
+ $.datepicker._datepickerShowing = true;
+
+ // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
+ if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) )
+ inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
+ else
+ inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
+ if (!showAnim || !duration)
+ postProcess();
+ if (inst.input.is(':visible') && !inst.input.is(':disabled'))
+ inst.input.focus();
+ $.datepicker._curInst = inst;
+ }
+ },
+
+ /* Generate the date picker content. */
+ _updateDatepicker: function(inst) {
+ this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
+ var borders = $.datepicker._getBorders(inst.dpDiv);
+ instActive = inst; // for delegate hover events
+ inst.dpDiv.empty().append(this._generateHTML(inst));
+ this._attachHandlers(inst);
+ var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
+ if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
+ cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
+ }
+ inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover();
+ var numMonths = this._getNumberOfMonths(inst);
+ var cols = numMonths[1];
+ var width = 17;
+ inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
+ if (cols > 1)
+ inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
+ inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
+ 'Class']('ui-datepicker-multi');
+ inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
+ 'Class']('ui-datepicker-rtl');
+ if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
+ // #6694 - don't focus the input if it's already focused
+ // this breaks the change event in IE
+ inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
+ inst.input.focus();
+ // deffered render of the years select (to avoid flashes on Firefox)
+ if( inst.yearshtml ){
+ var origyearshtml = inst.yearshtml;
+ setTimeout(function(){
+ //assure that inst.yearshtml didn't change.
+ if( origyearshtml === inst.yearshtml && inst.yearshtml ){
+ inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
+ }
+ origyearshtml = inst.yearshtml = null;
+ }, 0);
+ }
+ },
+
+ /* Retrieve the size of left and top borders for an element.
+ @param elem (jQuery object) the element of interest
+ @return (number[2]) the left and top borders */
+ _getBorders: function(elem) {
+ var convert = function(value) {
+ return {thin: 1, medium: 2, thick: 3}[value] || value;
+ };
+ return [parseFloat(convert(elem.css('border-left-width'))),
+ parseFloat(convert(elem.css('border-top-width')))];
+ },
+
+ /* Check positioning to remain on screen. */
+ _checkOffset: function(inst, offset, isFixed) {
+ var dpWidth = inst.dpDiv.outerWidth();
+ var dpHeight = inst.dpDiv.outerHeight();
+ var inputWidth = inst.input ? inst.input.outerWidth() : 0;
+ var inputHeight = inst.input ? inst.input.outerHeight() : 0;
+ var viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft());
+ var viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
+
+ offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
+ offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
+ offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
+
+ // now check if datepicker is showing outside window viewport - move to a better place if so.
+ offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
+ Math.abs(offset.left + dpWidth - viewWidth) : 0);
+ offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
+ Math.abs(dpHeight + inputHeight) : 0);
+
+ return offset;
+ },
+
+ /* Find an object's position on the screen. */
+ _findPos: function(obj) {
+ var inst = this._getInst(obj);
+ var isRTL = this._get(inst, 'isRTL');
+ while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {
+ obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
+ }
+ var position = $(obj).offset();
+ return [position.left, position.top];
+ },
+
+ /* Hide the date picker from view.
+ @param input element - the input field attached to the date picker */
+ _hideDatepicker: function(input) {
+ var inst = this._curInst;
+ if (!inst || (input && inst != $.data(input, PROP_NAME)))
+ return;
+ if (this._datepickerShowing) {
+ var showAnim = this._get(inst, 'showAnim');
+ var duration = this._get(inst, 'duration');
+ var postProcess = function() {
+ $.datepicker._tidyDialog(inst);
+ };
+
+ // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
+ if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) )
+ inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
+ else
+ inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
+ (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
+ if (!showAnim)
+ postProcess();
+ this._datepickerShowing = false;
+ var onClose = this._get(inst, 'onClose');
+ if (onClose)
+ onClose.apply((inst.input ? inst.input[0] : null),
+ [(inst.input ? inst.input.val() : ''), inst]);
+ this._lastInput = null;
+ if (this._inDialog) {
+ this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
+ if ($.blockUI) {
+ $.unblockUI();
+ $('body').append(this.dpDiv);
+ }
+ }
+ this._inDialog = false;
+ }
+ },
+
+ /* Tidy up after a dialog display. */
+ _tidyDialog: function(inst) {
+ inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
+ },
+
+ /* Close date picker if clicked elsewhere. */
+ _checkExternalClick: function(event) {
+ if (!$.datepicker._curInst)
+ return;
+
+ var $target = $(event.target),
+ inst = $.datepicker._getInst($target[0]);
+
+ if ( ( ( $target[0].id != $.datepicker._mainDivId &&
+ $target.parents('#' + $.datepicker._mainDivId).length == 0 &&
+ !$target.hasClass($.datepicker.markerClassName) &&
+ !$target.closest("." + $.datepicker._triggerClass).length &&
+ $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
+ ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) )
+ $.datepicker._hideDatepicker();
+ },
+
+ /* Adjust one of the date sub-fields. */
+ _adjustDate: function(id, offset, period) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ if (this._isDisabledDatepicker(target[0])) {
+ return;
+ }
+ this._adjustInstDate(inst, offset +
+ (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
+ period);
+ this._updateDatepicker(inst);
+ },
+
+ /* Action for current link. */
+ _gotoToday: function(id) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
+ inst.selectedDay = inst.currentDay;
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth;
+ inst.drawYear = inst.selectedYear = inst.currentYear;
+ }
+ else {
+ var date = new Date();
+ inst.selectedDay = date.getDate();
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
+ inst.drawYear = inst.selectedYear = date.getFullYear();
+ }
+ this._notifyChange(inst);
+ this._adjustDate(target);
+ },
+
+ /* Action for selecting a new month/year. */
+ _selectMonthYear: function(id, select, period) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
+ inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
+ parseInt(select.options[select.selectedIndex].value,10);
+ this._notifyChange(inst);
+ this._adjustDate(target);
+ },
+
+ /* Action for selecting a day. */
+ _selectDay: function(id, month, year, td) {
+ var target = $(id);
+ if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
+ return;
+ }
+ var inst = this._getInst(target[0]);
+ inst.selectedDay = inst.currentDay = $('a', td).html();
+ inst.selectedMonth = inst.currentMonth = month;
+ inst.selectedYear = inst.currentYear = year;
+ this._selectDate(id, this._formatDate(inst,
+ inst.currentDay, inst.currentMonth, inst.currentYear));
+ },
+
+ /* Erase the input field and hide the date picker. */
+ _clearDate: function(id) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ this._selectDate(target, '');
+ },
+
+ /* Update the input field with the selected date. */
+ _selectDate: function(id, dateStr) {
+ var target = $(id);
+ var inst = this._getInst(target[0]);
+ dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
+ if (inst.input)
+ inst.input.val(dateStr);
+ this._updateAlternate(inst);
+ var onSelect = this._get(inst, 'onSelect');
+ if (onSelect)
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
+ else if (inst.input)
+ inst.input.trigger('change'); // fire the change event
+ if (inst.inline)
+ this._updateDatepicker(inst);
+ else {
+ this._hideDatepicker();
+ this._lastInput = inst.input[0];
+ if (typeof(inst.input[0]) != 'object')
+ inst.input.focus(); // restore focus
+ this._lastInput = null;
+ }
+ },
+
+ /* Update any alternate field to synchronise with the main field. */
+ _updateAlternate: function(inst) {
+ var altField = this._get(inst, 'altField');
+ if (altField) { // update alternate field too
+ var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
+ var date = this._getDate(inst);
+ var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
+ $(altField).each(function() { $(this).val(dateStr); });
+ }
+ },
+
+ /* Set as beforeShowDay function to prevent selection of weekends.
+ @param date Date - the date to customise
+ @return [boolean, string] - is this date selectable?, what is its CSS class? */
+ noWeekends: function(date) {
+ var day = date.getDay();
+ return [(day > 0 && day < 6), ''];
+ },
+
+ /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
+ @param date Date - the date to get the week for
+ @return number - the number of the week within the year that contains this date */
+ iso8601Week: function(date) {
+ var checkDate = new Date(date.getTime());
+ // Find Thursday of this week starting on Monday
+ checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
+ var time = checkDate.getTime();
+ checkDate.setMonth(0); // Compare with Jan 1
+ checkDate.setDate(1);
+ return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
+ },
+
+ /* Parse a string value into a date object.
+ See formatDate below for the possible formats.
+
+ @param format string - the expected format of the date
+ @param value string - the date in the above format
+ @param settings Object - attributes include:
+ shortYearCutoff number - the cutoff year for determining the century (optional)
+ dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
+ dayNames string[7] - names of the days from Sunday (optional)
+ monthNamesShort string[12] - abbreviated names of the months (optional)
+ monthNames string[12] - names of the months (optional)
+ @return Date - the extracted date value or null if value is blank */
+ parseDate: function (format, value, settings) {
+ if (format == null || value == null)
+ throw 'Invalid arguments';
+ value = (typeof value == 'object' ? value.toString() : value + '');
+ if (value == '')
+ return null;
+ var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
+ shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
+ var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
+ var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
+ var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
+ var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
+ var year = -1;
+ var month = -1;
+ var day = -1;
+ var doy = -1;
+ var literal = false;
+ // Check whether a format character is doubled
+ var lookAhead = function(match) {
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+ if (matches)
+ iFormat++;
+ return matches;
+ };
+ // Extract a number from the string value
+ var getNumber = function(match) {
+ var isDoubled = lookAhead(match);
+ var size = (match == '@' ? 14 : (match == '!' ? 20 :
+ (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2))));
+ var digits = new RegExp('^\\d{1,' + size + '}');
+ var num = value.substring(iValue).match(digits);
+ if (!num)
+ throw 'Missing number at position ' + iValue;
+ iValue += num[0].length;
+ return parseInt(num[0], 10);
+ };
+ // Extract a name from the string value and convert to an index
+ var getName = function(match, shortNames, longNames) {
+ var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
+ return [ [k, v] ];
+ }).sort(function (a, b) {
+ return -(a[1].length - b[1].length);
+ });
+ var index = -1;
+ $.each(names, function (i, pair) {
+ var name = pair[1];
+ if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) {
+ index = pair[0];
+ iValue += name.length;
+ return false;
+ }
+ });
+ if (index != -1)
+ return index + 1;
+ else
+ throw 'Unknown name at position ' + iValue;
+ };
+ // Confirm that a literal character matches the string value
+ var checkLiteral = function() {
+ if (value.charAt(iValue) != format.charAt(iFormat))
+ throw 'Unexpected literal at position ' + iValue;
+ iValue++;
+ };
+ var iValue = 0;
+ for (var iFormat = 0; iFormat < format.length; iFormat++) {
+ if (literal)
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+ literal = false;
+ else
+ checkLiteral();
+ else
+ switch (format.charAt(iFormat)) {
+ case 'd':
+ day = getNumber('d');
+ break;
+ case 'D':
+ getName('D', dayNamesShort, dayNames);
+ break;
+ case 'o':
+ doy = getNumber('o');
+ break;
+ case 'm':
+ month = getNumber('m');
+ break;
+ case 'M':
+ month = getName('M', monthNamesShort, monthNames);
+ break;
+ case 'y':
+ year = getNumber('y');
+ break;
+ case '@':
+ var date = new Date(getNumber('@'));
+ year = date.getFullYear();
+ month = date.getMonth() + 1;
+ day = date.getDate();
+ break;
+ case '!':
+ var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
+ year = date.getFullYear();
+ month = date.getMonth() + 1;
+ day = date.getDate();
+ break;
+ case "'":
+ if (lookAhead("'"))
+ checkLiteral();
+ else
+ literal = true;
+ break;
+ default:
+ checkLiteral();
+ }
+ }
+ if (iValue < value.length){
+ var extra = value.substr(iValue);
+ if (!/^\s+/.test(extra)) {
+ throw "Extra/unparsed characters found in date: " + extra;
+ }
+ }
+ if (year == -1)
+ year = new Date().getFullYear();
+ else if (year < 100)
+ year += new Date().getFullYear() - new Date().getFullYear() % 100 +
+ (year <= shortYearCutoff ? 0 : -100);
+ if (doy > -1) {
+ month = 1;
+ day = doy;
+ do {
+ var dim = this._getDaysInMonth(year, month - 1);
+ if (day <= dim)
+ break;
+ month++;
+ day -= dim;
+ } while (true);
+ }
+ var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
+ if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
+ throw 'Invalid date'; // E.g. 31/02/00
+ return date;
+ },
+
+ /* Standard date formats. */
+ ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
+ COOKIE: 'D, dd M yy',
+ ISO_8601: 'yy-mm-dd',
+ RFC_822: 'D, d M y',
+ RFC_850: 'DD, dd-M-y',
+ RFC_1036: 'D, d M y',
+ RFC_1123: 'D, d M yy',
+ RFC_2822: 'D, d M yy',
+ RSS: 'D, d M y', // RFC 822
+ TICKS: '!',
+ TIMESTAMP: '@',
+ W3C: 'yy-mm-dd', // ISO 8601
+
+ _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
+ Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
+
+ /* Format a date object into a string value.
+ The format can be combinations of the following:
+ d - day of month (no leading zero)
+ dd - day of month (two digit)
+ o - day of year (no leading zeros)
+ oo - day of year (three digit)
+ D - day name short
+ DD - day name long
+ m - month of year (no leading zero)
+ mm - month of year (two digit)
+ M - month name short
+ MM - month name long
+ y - year (two digit)
+ yy - year (four digit)
+ @ - Unix timestamp (ms since 01/01/1970)
+ ! - Windows ticks (100ns since 01/01/0001)
+ '...' - literal text
+ '' - single quote
+
+ @param format string - the desired format of the date
+ @param date Date - the date value to format
+ @param settings Object - attributes include:
+ dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
+ dayNames string[7] - names of the days from Sunday (optional)
+ monthNamesShort string[12] - abbreviated names of the months (optional)
+ monthNames string[12] - names of the months (optional)
+ @return string - the date in the above format */
+ formatDate: function (format, date, settings) {
+ if (!date)
+ return '';
+ var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
+ var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
+ var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
+ var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
+ // Check whether a format character is doubled
+ var lookAhead = function(match) {
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+ if (matches)
+ iFormat++;
+ return matches;
+ };
+ // Format a number, with leading zero if necessary
+ var formatNumber = function(match, value, len) {
+ var num = '' + value;
+ if (lookAhead(match))
+ while (num.length < len)
+ num = '0' + num;
+ return num;
+ };
+ // Format a name, short or long as requested
+ var formatName = function(match, value, shortNames, longNames) {
+ return (lookAhead(match) ? longNames[value] : shortNames[value]);
+ };
+ var output = '';
+ var literal = false;
+ if (date)
+ for (var iFormat = 0; iFormat < format.length; iFormat++) {
+ if (literal)
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+ literal = false;
+ else
+ output += format.charAt(iFormat);
+ else
+ switch (format.charAt(iFormat)) {
+ case 'd':
+ output += formatNumber('d', date.getDate(), 2);
+ break;
+ case 'D':
+ output += formatName('D', date.getDay(), dayNamesShort, dayNames);
+ break;
+ case 'o':
+ output += formatNumber('o',
+ Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
+ break;
+ case 'm':
+ output += formatNumber('m', date.getMonth() + 1, 2);
+ break;
+ case 'M':
+ output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
+ break;
+ case 'y':
+ output += (lookAhead('y') ? date.getFullYear() :
+ (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
+ break;
+ case '@':
+ output += date.getTime();
+ break;
+ case '!':
+ output += date.getTime() * 10000 + this._ticksTo1970;
+ break;
+ case "'":
+ if (lookAhead("'"))
+ output += "'";
+ else
+ literal = true;
+ break;
+ default:
+ output += format.charAt(iFormat);
+ }
+ }
+ return output;
+ },
+
+ /* Extract all possible characters from the date format. */
+ _possibleChars: function (format) {
+ var chars = '';
+ var literal = false;
+ // Check whether a format character is doubled
+ var lookAhead = function(match) {
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+ if (matches)
+ iFormat++;
+ return matches;
+ };
+ for (var iFormat = 0; iFormat < format.length; iFormat++)
+ if (literal)
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+ literal = false;
+ else
+ chars += format.charAt(iFormat);
+ else
+ switch (format.charAt(iFormat)) {
+ case 'd': case 'm': case 'y': case '@':
+ chars += '0123456789';
+ break;
+ case 'D': case 'M':
+ return null; // Accept anything
+ case "'":
+ if (lookAhead("'"))
+ chars += "'";
+ else
+ literal = true;
+ break;
+ default:
+ chars += format.charAt(iFormat);
+ }
+ return chars;
+ },
+
+ /* Get a setting value, defaulting if necessary. */
+ _get: function(inst, name) {
+ return inst.settings[name] !== undefined ?
+ inst.settings[name] : this._defaults[name];
+ },
+
+ /* Parse existing date and initialise date picker. */
+ _setDateFromField: function(inst, noDefault) {
+ if (inst.input.val() == inst.lastVal) {
+ return;
+ }
+ var dateFormat = this._get(inst, 'dateFormat');
+ var dates = inst.lastVal = inst.input ? inst.input.val() : null;
+ var date, defaultDate;
+ date = defaultDate = this._getDefaultDate(inst);
+ var settings = this._getFormatConfig(inst);
+ try {
+ date = this.parseDate(dateFormat, dates, settings) || defaultDate;
+ } catch (event) {
+ this.log(event);
+ dates = (noDefault ? '' : dates);
+ }
+ inst.selectedDay = date.getDate();
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
+ inst.drawYear = inst.selectedYear = date.getFullYear();
+ inst.currentDay = (dates ? date.getDate() : 0);
+ inst.currentMonth = (dates ? date.getMonth() : 0);
+ inst.currentYear = (dates ? date.getFullYear() : 0);
+ this._adjustInstDate(inst);
+ },
+
+ /* Retrieve the default date shown on opening. */
+ _getDefaultDate: function(inst) {
+ return this._restrictMinMax(inst,
+ this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
+ },
+
+ /* A date may be specified as an exact value or a relative one. */
+ _determineDate: function(inst, date, defaultDate) {
+ var offsetNumeric = function(offset) {
+ var date = new Date();
+ date.setDate(date.getDate() + offset);
+ return date;
+ };
+ var offsetString = function(offset) {
+ try {
+ return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
+ offset, $.datepicker._getFormatConfig(inst));
+ }
+ catch (e) {
+ // Ignore
+ }
+ var date = (offset.toLowerCase().match(/^c/) ?
+ $.datepicker._getDate(inst) : null) || new Date();
+ var year = date.getFullYear();
+ var month = date.getMonth();
+ var day = date.getDate();
+ var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
+ var matches = pattern.exec(offset);
+ while (matches) {
+ switch (matches[2] || 'd') {
+ case 'd' : case 'D' :
+ day += parseInt(matches[1],10); break;
+ case 'w' : case 'W' :
+ day += parseInt(matches[1],10) * 7; break;
+ case 'm' : case 'M' :
+ month += parseInt(matches[1],10);
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
+ break;
+ case 'y': case 'Y' :
+ year += parseInt(matches[1],10);
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
+ break;
+ }
+ matches = pattern.exec(offset);
+ }
+ return new Date(year, month, day);
+ };
+ var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) :
+ (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
+ newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate);
+ if (newDate) {
+ newDate.setHours(0);
+ newDate.setMinutes(0);
+ newDate.setSeconds(0);
+ newDate.setMilliseconds(0);
+ }
+ return this._daylightSavingAdjust(newDate);
+ },
+
+ /* Handle switch to/from daylight saving.
+ Hours may be non-zero on daylight saving cut-over:
+ > 12 when midnight changeover, but then cannot generate
+ midnight datetime, so jump to 1AM, otherwise reset.
+ @param date (Date) the date to check
+ @return (Date) the corrected date */
+ _daylightSavingAdjust: function(date) {
+ if (!date) return null;
+ date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
+ return date;
+ },
+
+ /* Set the date(s) directly. */
+ _setDate: function(inst, date, noChange) {
+ var clear = !date;
+ var origMonth = inst.selectedMonth;
+ var origYear = inst.selectedYear;
+ var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
+ inst.selectedDay = inst.currentDay = newDate.getDate();
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
+ inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
+ if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
+ this._notifyChange(inst);
+ this._adjustInstDate(inst);
+ if (inst.input) {
+ inst.input.val(clear ? '' : this._formatDate(inst));
+ }
+ },
+
+ /* Retrieve the date(s) directly. */
+ _getDate: function(inst) {
+ var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
+ this._daylightSavingAdjust(new Date(
+ inst.currentYear, inst.currentMonth, inst.currentDay)));
+ return startDate;
+ },
+
+ /* Attach the onxxx handlers. These are declared statically so
+ * they work with static code transformers like Caja.
+ */
+ _attachHandlers: function(inst) {
+ var stepMonths = this._get(inst, 'stepMonths');
+ var id = '#' + inst.id.replace( /\\\\/g, "\\" );
+ inst.dpDiv.find('[data-handler]').map(function () {
+ var handler = {
+ prev: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, -stepMonths, 'M');
+ },
+ next: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, +stepMonths, 'M');
+ },
+ hide: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._hideDatepicker();
+ },
+ today: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._gotoToday(id);
+ },
+ selectDay: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._selectDay(id, +this.getAttribute('data-month'), +this.getAttribute('data-year'), this);
+ return false;
+ },
+ selectMonth: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'M');
+ return false;
+ },
+ selectYear: function () {
+ window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'Y');
+ return false;
+ }
+ };
+ $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]);
+ });
+ },
+
+ /* Generate the HTML for the current state of the date picker. */
+ _generateHTML: function(inst) {
+ var today = new Date();
+ today = this._daylightSavingAdjust(
+ new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
+ var isRTL = this._get(inst, 'isRTL');
+ var showButtonPanel = this._get(inst, 'showButtonPanel');
+ var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
+ var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
+ var numMonths = this._getNumberOfMonths(inst);
+ var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
+ var stepMonths = this._get(inst, 'stepMonths');
+ var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
+ var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
+ new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
+ var minDate = this._getMinMaxDate(inst, 'min');
+ var maxDate = this._getMinMaxDate(inst, 'max');
+ var drawMonth = inst.drawMonth - showCurrentAtPos;
+ var drawYear = inst.drawYear;
+ if (drawMonth < 0) {
+ drawMonth += 12;
+ drawYear--;
+ }
+ if (maxDate) {
+ var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
+ maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
+ maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
+ while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
+ drawMonth--;
+ if (drawMonth < 0) {
+ drawMonth = 11;
+ drawYear--;
+ }
+ }
+ }
+ inst.drawMonth = drawMonth;
+ inst.drawYear = drawYear;
+ var prevText = this._get(inst, 'prevText');
+ prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
+ this._getFormatConfig(inst)));
+ var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
+ '<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click"' +
+ ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
+ (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>'));
+ var nextText = this._get(inst, 'nextText');
+ nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
+ this._getFormatConfig(inst)));
+ var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
+ '<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click"' +
+ ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
+ (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>'));
+ var currentText = this._get(inst, 'currentText');
+ var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
+ currentText = (!navigationAsDateFormat ? currentText :
+ this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
+ var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">' +
+ this._get(inst, 'closeText') + '</button>' : '');
+ var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
+ (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click"' +
+ '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
+ var firstDay = parseInt(this._get(inst, 'firstDay'),10);
+ firstDay = (isNaN(firstDay) ? 0 : firstDay);
+ var showWeek = this._get(inst, 'showWeek');
+ var dayNames = this._get(inst, 'dayNames');
+ var dayNamesShort = this._get(inst, 'dayNamesShort');
+ var dayNamesMin = this._get(inst, 'dayNamesMin');
+ var monthNames = this._get(inst, 'monthNames');
+ var monthNamesShort = this._get(inst, 'monthNamesShort');
+ var beforeShowDay = this._get(inst, 'beforeShowDay');
+ var showOtherMonths = this._get(inst, 'showOtherMonths');
+ var selectOtherMonths = this._get(inst, 'selectOtherMonths');
+ var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
+ var defaultDate = this._getDefaultDate(inst);
+ var html = '';
+ for (var row = 0; row < numMonths[0]; row++) {
+ var group = '';
+ this.maxRows = 4;
+ for (var col = 0; col < numMonths[1]; col++) {
+ var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
+ var cornerClass = ' ui-corner-all';
+ var calender = '';
+ if (isMultiMonth) {
+ calender += '<div class="ui-datepicker-group';
+ if (numMonths[1] > 1)
+ switch (col) {
+ case 0: calender += ' ui-datepicker-group-first';
+ cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
+ case numMonths[1]-1: calender += ' ui-datepicker-group-last';
+ cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
+ default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
+ }
+ calender += '">';
+ }
+ calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
+ (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
+ (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
+ this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
+ row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
+ '</div><table class="ui-datepicker-calendar"><thead>' +
+ '<tr>';
+ var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
+ for (var dow = 0; dow < 7; dow++) { // days of the week
+ var day = (dow + firstDay) % 7;
+ thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
+ '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
+ }
+ calender += thead + '</tr></thead><tbody>';
+ var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
+ if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
+ inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
+ var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
+ var curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
+ var numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
+ this.maxRows = numRows;
+ var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
+ for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
+ calender += '<tr>';
+ var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
+ this._get(inst, 'calculateWeek')(printDate) + '</td>');
+ for (var dow = 0; dow < 7; dow++) { // create date picker days
+ var daySettings = (beforeShowDay ?
+ beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
+ var otherMonth = (printDate.getMonth() != drawMonth);
+ var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
+ (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
+ tbody += '<td class="' +
+ ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
+ (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
+ ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
+ (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
+ // or defaultDate is current printedDate and defaultDate is selectedDate
+ ' ' + this._dayOverClass : '') + // highlight selected day
+ (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
+ (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
+ (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
+ (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
+ ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
+ (unselectable ? '' : ' data-handler="selectDay" data-event="click" data-month="' + printDate.getMonth() + '" data-year="' + printDate.getFullYear() + '"') + '>' + // actions
+ (otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months
+ (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
+ (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
+ (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
+ (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
+ '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
+ printDate.setDate(printDate.getDate() + 1);
+ printDate = this._daylightSavingAdjust(printDate);
+ }
+ calender += tbody + '</tr>';
+ }
+ drawMonth++;
+ if (drawMonth > 11) {
+ drawMonth = 0;
+ drawYear++;
+ }
+ calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
+ ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
+ group += calender;
+ }
+ html += group;
+ }
+ html += buttonPanel + ($.ui.ie6 && !inst.inline ?
+ '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
+ inst._keyEvent = false;
+ return html;
+ },
+
+ /* Generate the month and year header. */
+ _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
+ secondary, monthNames, monthNamesShort) {
+ var changeMonth = this._get(inst, 'changeMonth');
+ var changeYear = this._get(inst, 'changeYear');
+ var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
+ var html = '<div class="ui-datepicker-title">';
+ var monthHtml = '';
+ // month selection
+ if (secondary || !changeMonth)
+ monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
+ else {
+ var inMinYear = (minDate && minDate.getFullYear() == drawYear);
+ var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
+ monthHtml += '<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';
+ for (var month = 0; month < 12; month++) {
+ if ((!inMinYear || month >= minDate.getMonth()) &&
+ (!inMaxYear || month <= maxDate.getMonth()))
+ monthHtml += '<option value="' + month + '"' +
+ (month == drawMonth ? ' selected="selected"' : '') +
+ '>' + monthNamesShort[month] + '</option>';
+ }
+ monthHtml += '</select>';
+ }
+ if (!showMonthAfterYear)
+ html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
+ // year selection
+ if ( !inst.yearshtml ) {
+ inst.yearshtml = '';
+ if (secondary || !changeYear)
+ html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
+ else {
+ // determine range of years to display
+ var years = this._get(inst, 'yearRange').split(':');
+ var thisYear = new Date().getFullYear();
+ var determineYear = function(value) {
+ var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
+ (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
+ parseInt(value, 10)));
+ return (isNaN(year) ? thisYear : year);
+ };
+ var year = determineYear(years[0]);
+ var endYear = Math.max(year, determineYear(years[1] || ''));
+ year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
+ endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
+ inst.yearshtml += '<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';
+ for (; year <= endYear; year++) {
+ inst.yearshtml += '<option value="' + year + '"' +
+ (year == drawYear ? ' selected="selected"' : '') +
+ '>' + year + '</option>';
+ }
+ inst.yearshtml += '</select>';
+
+ html += inst.yearshtml;
+ inst.yearshtml = null;
+ }
+ }
+ html += this._get(inst, 'yearSuffix');
+ if (showMonthAfterYear)
+ html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;
+ html += '</div>'; // Close datepicker_header
+ return html;
+ },
+
+ /* Adjust one of the date sub-fields. */
+ _adjustInstDate: function(inst, offset, period) {
+ var year = inst.drawYear + (period == 'Y' ? offset : 0);
+ var month = inst.drawMonth + (period == 'M' ? offset : 0);
+ var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
+ (period == 'D' ? offset : 0);
+ var date = this._restrictMinMax(inst,
+ this._daylightSavingAdjust(new Date(year, month, day)));
+ inst.selectedDay = date.getDate();
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
+ inst.drawYear = inst.selectedYear = date.getFullYear();
+ if (period == 'M' || period == 'Y')
+ this._notifyChange(inst);
+ },
+
+ /* Ensure a date is within any min/max bounds. */
+ _restrictMinMax: function(inst, date) {
+ var minDate = this._getMinMaxDate(inst, 'min');
+ var maxDate = this._getMinMaxDate(inst, 'max');
+ var newDate = (minDate && date < minDate ? minDate : date);
+ newDate = (maxDate && newDate > maxDate ? maxDate : newDate);
+ return newDate;
+ },
+
+ /* Notify change of month/year. */
+ _notifyChange: function(inst) {
+ var onChange = this._get(inst, 'onChangeMonthYear');
+ if (onChange)
+ onChange.apply((inst.input ? inst.input[0] : null),
+ [inst.selectedYear, inst.selectedMonth + 1, inst]);
+ },
+
+ /* Determine the number of months to show. */
+ _getNumberOfMonths: function(inst) {
+ var numMonths = this._get(inst, 'numberOfMonths');
+ return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
+ },
+
+ /* Determine the current maximum date - ensure no time components are set. */
+ _getMinMaxDate: function(inst, minMax) {
+ return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
+ },
+
+ /* Find the number of days in a given month. */
+ _getDaysInMonth: function(year, month) {
+ return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
+ },
+
+ /* Find the day of the week of the first of a month. */
+ _getFirstDayOfMonth: function(year, month) {
+ return new Date(year, month, 1).getDay();
+ },
+
+ /* Determines if we should allow a "next/prev" month display change. */
+ _canAdjustMonth: function(inst, offset, curYear, curMonth) {
+ var numMonths = this._getNumberOfMonths(inst);
+ var date = this._daylightSavingAdjust(new Date(curYear,
+ curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
+ if (offset < 0)
+ date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
+ return this._isInRange(inst, date);
+ },
+
+ /* Is the given date in the accepted range? */
+ _isInRange: function(inst, date) {
+ var minDate = this._getMinMaxDate(inst, 'min');
+ var maxDate = this._getMinMaxDate(inst, 'max');
+ return ((!minDate || date.getTime() >= minDate.getTime()) &&
+ (!maxDate || date.getTime() <= maxDate.getTime()));
+ },
+
+ /* Provide the configuration settings for formatting/parsing. */
+ _getFormatConfig: function(inst) {
+ var shortYearCutoff = this._get(inst, 'shortYearCutoff');
+ shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
+ return {shortYearCutoff: shortYearCutoff,
+ dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
+ monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
+ },
+
+ /* Format the given date for display. */
+ _formatDate: function(inst, day, month, year) {
+ if (!day) {
+ inst.currentDay = inst.selectedDay;
+ inst.currentMonth = inst.selectedMonth;
+ inst.currentYear = inst.selectedYear;
+ }
+ var date = (day ? (typeof day == 'object' ? day :
+ this._daylightSavingAdjust(new Date(year, month, day))) :
+ this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
+ return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
+ }
+});
+
+/*
+ * Bind hover events for datepicker elements.
+ * Done via delegate so the binding only occurs once in the lifetime of the parent div.
+ * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
+ */
+function bindHover(dpDiv) {
+ var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';
+ return dpDiv.delegate(selector, 'mouseout', function() {
+ $(this).removeClass('ui-state-hover');
+ if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
+ if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
+ })
+ .delegate(selector, 'mouseover', function(){
+ if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {
+ $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
+ $(this).addClass('ui-state-hover');
+ if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
+ if (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
+ }
+ });
+}
+
+/* jQuery extend now ignores nulls! */
+function extendRemove(target, props) {
+ $.extend(target, props);
+ for (var name in props)
+ if (props[name] == null || props[name] == undefined)
+ target[name] = props[name];
+ return target;
+};
+
+/* Invoke the datepicker functionality.
+ @param options string - a command, optionally followed by additional parameters or
+ Object - settings for attaching new datepicker functionality
+ @return jQuery object */
+$.fn.datepicker = function(options){
+
+ /* Verify an empty collection wasn't passed - Fixes #6976 */
+ if ( !this.length ) {
+ return this;
+ }
+
+ /* Initialise the date picker. */
+ if (!$.datepicker.initialized) {
+ $(document).mousedown($.datepicker._checkExternalClick).
+ find(document.body).append($.datepicker.dpDiv);
+ $.datepicker.initialized = true;
+ }
+
+ var otherArgs = Array.prototype.slice.call(arguments, 1);
+ if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
+ return $.datepicker['_' + options + 'Datepicker'].
+ apply($.datepicker, [this[0]].concat(otherArgs));
+ if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
+ return $.datepicker['_' + options + 'Datepicker'].
+ apply($.datepicker, [this[0]].concat(otherArgs));
+ return this.each(function() {
+ typeof options == 'string' ?
+ $.datepicker['_' + options + 'Datepicker'].
+ apply($.datepicker, [this].concat(otherArgs)) :
+ $.datepicker._attachDatepicker(this, options);
+ });
+};
+
+$.datepicker = new Datepicker(); // singleton instance
+$.datepicker.initialized = false;
+$.datepicker.uuid = new Date().getTime();
+$.datepicker.version = "1.9.2";
+
+// Workaround for #4055
+// Add another global to avoid noConflict issues with inline event handlers
+window['DP_jQuery_' + dpuuid] = $;
+
+})(jQuery);
+(function( $, undefined ) {
+
+var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ",
+ sizeRelatedOptions = {
+ buttons: true,
+ height: true,
+ maxHeight: true,
+ maxWidth: true,
+ minHeight: true,
+ minWidth: true,
+ width: true
+ },
+ resizableRelatedOptions = {
+ maxHeight: true,
+ maxWidth: true,
+ minHeight: true,
+ minWidth: true
+ };
+
+$.widget("ui.dialog", {
+ version: "1.9.2",
+ options: {
+ autoOpen: true,
+ buttons: {},
+ closeOnEscape: true,
+ closeText: "close",
+ dialogClass: "",
+ draggable: true,
+ hide: null,
+ height: "auto",
+ maxHeight: false,
+ maxWidth: false,
+ minHeight: 150,
+ minWidth: 150,
+ modal: false,
+ position: {
+ my: "center",
+ at: "center",
+ of: window,
+ collision: "fit",
+ // ensure that the titlebar is never outside the document
+ using: function( pos ) {
+ var topOffset = $( this ).css( pos ).offset().top;
+ if ( topOffset < 0 ) {
+ $( this ).css( "top", pos.top - topOffset );
+ }
+ }
+ },
+ resizable: true,
+ show: null,
+ stack: true,
+ title: "",
+ width: 300,
+ zIndex: 1000
+ },
+
+ _create: function() {
+ this.originalTitle = this.element.attr( "title" );
+ // #5742 - .attr() might return a DOMElement
+ if ( typeof this.originalTitle !== "string" ) {
+ this.originalTitle = "";
+ }
+ this.oldPosition = {
+ parent: this.element.parent(),
+ index: this.element.parent().children().index( this.element )
+ };
+ this.options.title = this.options.title || this.originalTitle;
+ var that = this,
+ options = this.options,
+
+ title = options.title || "&#160;",
+ uiDialog,
+ uiDialogTitlebar,
+ uiDialogTitlebarClose,
+ uiDialogTitle,
+ uiDialogButtonPane;
+
+ uiDialog = ( this.uiDialog = $( "<div>" ) )
+ .addClass( uiDialogClasses + options.dialogClass )
+ .css({
+ display: "none",
+ outline: 0, // TODO: move to stylesheet
+ zIndex: options.zIndex
+ })
+ // setting tabIndex makes the div focusable
+ .attr( "tabIndex", -1)
+ .keydown(function( event ) {
+ if ( options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
+ event.keyCode === $.ui.keyCode.ESCAPE ) {
+ that.close( event );
+ event.preventDefault();
+ }
+ })
+ .mousedown(function( event ) {
+ that.moveToTop( false, event );
+ })
+ .appendTo( "body" );
+
+ this.element
+ .show()
+ .removeAttr( "title" )
+ .addClass( "ui-dialog-content ui-widget-content" )
+ .appendTo( uiDialog );
+
+ uiDialogTitlebar = ( this.uiDialogTitlebar = $( "<div>" ) )
+ .addClass( "ui-dialog-titlebar ui-widget-header " +
+ "ui-corner-all ui-helper-clearfix" )
+ .bind( "mousedown", function() {
+ // Dialog isn't getting focus when dragging (#8063)
+ uiDialog.focus();
+ })
+ .prependTo( uiDialog );
+
+ uiDialogTitlebarClose = $( "<a href='#'></a>" )
+ .addClass( "ui-dialog-titlebar-close ui-corner-all" )
+ .attr( "role", "button" )
+ .click(function( event ) {
+ event.preventDefault();
+ that.close( event );
+ })
+ .appendTo( uiDialogTitlebar );
+
+ ( this.uiDialogTitlebarCloseText = $( "<span>" ) )
+ .addClass( "ui-icon ui-icon-closethick" )
+ .text( options.closeText )
+ .appendTo( uiDialogTitlebarClose );
+
+ uiDialogTitle = $( "<span>" )
+ .uniqueId()
+ .addClass( "ui-dialog-title" )
+ .html( title )
+ .prependTo( uiDialogTitlebar );
+
+ uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
+ .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
+
+ ( this.uiButtonSet = $( "<div>" ) )
+ .addClass( "ui-dialog-buttonset" )
+ .appendTo( uiDialogButtonPane );
+
+ uiDialog.attr({
+ role: "dialog",
+ "aria-labelledby": uiDialogTitle.attr( "id" )
+ });
+
+ uiDialogTitlebar.find( "*" ).add( uiDialogTitlebar ).disableSelection();
+ this._hoverable( uiDialogTitlebarClose );
+ this._focusable( uiDialogTitlebarClose );
+
+ if ( options.draggable && $.fn.draggable ) {
+ this._makeDraggable();
+ }
+ if ( options.resizable && $.fn.resizable ) {
+ this._makeResizable();
+ }
+
+ this._createButtons( options.buttons );
+ this._isOpen = false;
+
+ if ( $.fn.bgiframe ) {
+ uiDialog.bgiframe();
+ }
+
+ // prevent tabbing out of modal dialogs
+ this._on( uiDialog, { keydown: function( event ) {
+ if ( !options.modal || event.keyCode !== $.ui.keyCode.TAB ) {
+ return;
+ }
+
+ var tabbables = $( ":tabbable", uiDialog ),
+ first = tabbables.filter( ":first" ),
+ last = tabbables.filter( ":last" );
+
+ if ( event.target === last[0] && !event.shiftKey ) {
+ first.focus( 1 );
+ return false;
+ } else if ( event.target === first[0] && event.shiftKey ) {
+ last.focus( 1 );
+ return false;
+ }
+ }});
+ },
+
+ _init: function() {
+ if ( this.options.autoOpen ) {
+ this.open();
+ }
+ },
+
+ _destroy: function() {
+ var next,
+ oldPosition = this.oldPosition;
+
+ if ( this.overlay ) {
+ this.overlay.destroy();
+ }
+ this.uiDialog.hide();
+ this.element
+ .removeClass( "ui-dialog-content ui-widget-content" )
+ .hide()
+ .appendTo( "body" );
+ this.uiDialog.remove();
+
+ if ( this.originalTitle ) {
+ this.element.attr( "title", this.originalTitle );
+ }
+
+ next = oldPosition.parent.children().eq( oldPosition.index );
+ // Don't try to place the dialog next to itself (#8613)
+ if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
+ next.before( this.element );
+ } else {
+ oldPosition.parent.append( this.element );
+ }
+ },
+
+ widget: function() {
+ return this.uiDialog;
+ },
+
+ close: function( event ) {
+ var that = this,
+ maxZ, thisZ;
+
+ if ( !this._isOpen ) {
+ return;
+ }
+
+ if ( false === this._trigger( "beforeClose", event ) ) {
+ return;
+ }
+
+ this._isOpen = false;
+
+ if ( this.overlay ) {
+ this.overlay.destroy();
+ }
+
+ if ( this.options.hide ) {
+ this._hide( this.uiDialog, this.options.hide, function() {
+ that._trigger( "close", event );
+ });
+ } else {
+ this.uiDialog.hide();
+ this._trigger( "close", event );
+ }
+
+ $.ui.dialog.overlay.resize();
+
+ // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
+ if ( this.options.modal ) {
+ maxZ = 0;
+ $( ".ui-dialog" ).each(function() {
+ if ( this !== that.uiDialog[0] ) {
+ thisZ = $( this ).css( "z-index" );
+ if ( !isNaN( thisZ ) ) {
+ maxZ = Math.max( maxZ, thisZ );
+ }
+ }
+ });
+ $.ui.dialog.maxZ = maxZ;
+ }
+
+ return this;
+ },
+
+ isOpen: function() {
+ return this._isOpen;
+ },
+
+ // the force parameter allows us to move modal dialogs to their correct
+ // position on open
+ moveToTop: function( force, event ) {
+ var options = this.options,
+ saveScroll;
+
+ if ( ( options.modal && !force ) ||
+ ( !options.stack && !options.modal ) ) {
+ return this._trigger( "focus", event );
+ }
+
+ if ( options.zIndex > $.ui.dialog.maxZ ) {
+ $.ui.dialog.maxZ = options.zIndex;
+ }
+ if ( this.overlay ) {
+ $.ui.dialog.maxZ += 1;
+ $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ;
+ this.overlay.$el.css( "z-index", $.ui.dialog.overlay.maxZ );
+ }
+
+ // Save and then restore scroll
+ // Opera 9.5+ resets when parent z-index is changed.
+ // http://bugs.jqueryui.com/ticket/3193
+ saveScroll = {
+ scrollTop: this.element.scrollTop(),
+ scrollLeft: this.element.scrollLeft()
+ };
+ $.ui.dialog.maxZ += 1;
+ this.uiDialog.css( "z-index", $.ui.dialog.maxZ );
+ this.element.attr( saveScroll );
+ this._trigger( "focus", event );
+
+ return this;
+ },
+
+ open: function() {
+ if ( this._isOpen ) {
+ return;
+ }
+
+ var hasFocus,
+ options = this.options,
+ uiDialog = this.uiDialog;
+
+ this._size();
+ this._position( options.position );
+ uiDialog.show( options.show );
+ this.overlay = options.modal ? new $.ui.dialog.overlay( this ) : null;
+ this.moveToTop( true );
+
+ // set focus to the first tabbable element in the content area or the first button
+ // if there are no tabbable elements, set focus on the dialog itself
+ hasFocus = this.element.find( ":tabbable" );
+ if ( !hasFocus.length ) {
+ hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
+ if ( !hasFocus.length ) {
+ hasFocus = uiDialog;
+ }
+ }
+ hasFocus.eq( 0 ).focus();
+
+ this._isOpen = true;
+ this._trigger( "open" );
+
+ return this;
+ },
+
+ _createButtons: function( buttons ) {
+ var that = this,
+ hasButtons = false;
+
+ // if we already have a button pane, remove it
+ this.uiDialogButtonPane.remove();
+ this.uiButtonSet.empty();
+
+ if ( typeof buttons === "object" && buttons !== null ) {
+ $.each( buttons, function() {
+ return !(hasButtons = true);
+ });
+ }
+ if ( hasButtons ) {
+ $.each( buttons, function( name, props ) {
+ var button, click;
+ props = $.isFunction( props ) ?
+ { click: props, text: name } :
+ props;
+ // Default to a non-submitting button
+ props = $.extend( { type: "button" }, props );
+ // Change the context for the click callback to be the main element
+ click = props.click;
+ props.click = function() {
+ click.apply( that.element[0], arguments );
+ };
+ button = $( "<button></button>", props )
+ .appendTo( that.uiButtonSet );
+ if ( $.fn.button ) {
+ button.button();
+ }
+ });
+ this.uiDialog.addClass( "ui-dialog-buttons" );
+ this.uiDialogButtonPane.appendTo( this.uiDialog );
+ } else {
+ this.uiDialog.removeClass( "ui-dialog-buttons" );
+ }
+ },
+
+ _makeDraggable: function() {
+ var that = this,
+ options = this.options;
+
+ function filteredUi( ui ) {
+ return {
+ position: ui.position,
+ offset: ui.offset
+ };
+ }
+
+ this.uiDialog.draggable({
+ cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
+ handle: ".ui-dialog-titlebar",
+ containment: "document",
+ start: function( event, ui ) {
+ $( this )
+ .addClass( "ui-dialog-dragging" );
+ that._trigger( "dragStart", event, filteredUi( ui ) );
+ },
+ drag: function( event, ui ) {
+ that._trigger( "drag", event, filteredUi( ui ) );
+ },
+ stop: function( event, ui ) {
+ options.position = [
+ ui.position.left - that.document.scrollLeft(),
+ ui.position.top - that.document.scrollTop()
+ ];
+ $( this )
+ .removeClass( "ui-dialog-dragging" );
+ that._trigger( "dragStop", event, filteredUi( ui ) );
+ $.ui.dialog.overlay.resize();
+ }
+ });
+ },
+
+ _makeResizable: function( handles ) {
+ handles = (handles === undefined ? this.options.resizable : handles);
+ var that = this,
+ options = this.options,
+ // .ui-resizable has position: relative defined in the stylesheet
+ // but dialogs have to use absolute or fixed positioning
+ position = this.uiDialog.css( "position" ),
+ resizeHandles = typeof handles === 'string' ?
+ handles :
+ "n,e,s,w,se,sw,ne,nw";
+
+ function filteredUi( ui ) {
+ return {
+ originalPosition: ui.originalPosition,
+ originalSize: ui.originalSize,
+ position: ui.position,
+ size: ui.size
+ };
+ }
+
+ this.uiDialog.resizable({
+ cancel: ".ui-dialog-content",
+ containment: "document",
+ alsoResize: this.element,
+ maxWidth: options.maxWidth,
+ maxHeight: options.maxHeight,
+ minWidth: options.minWidth,
+ minHeight: this._minHeight(),
+ handles: resizeHandles,
+ start: function( event, ui ) {
+ $( this ).addClass( "ui-dialog-resizing" );
+ that._trigger( "resizeStart", event, filteredUi( ui ) );
+ },
+ resize: function( event, ui ) {
+ that._trigger( "resize", event, filteredUi( ui ) );
+ },
+ stop: function( event, ui ) {
+ $( this ).removeClass( "ui-dialog-resizing" );
+ options.height = $( this ).height();
+ options.width = $( this ).width();
+ that._trigger( "resizeStop", event, filteredUi( ui ) );
+ $.ui.dialog.overlay.resize();
+ }
+ })
+ .css( "position", position )
+ .find( ".ui-resizable-se" )
+ .addClass( "ui-icon ui-icon-grip-diagonal-se" );
+ },
+
+ _minHeight: function() {
+ var options = this.options;
+
+ if ( options.height === "auto" ) {
+ return options.minHeight;
+ } else {
+ return Math.min( options.minHeight, options.height );
+ }
+ },
+
+ _position: function( position ) {
+ var myAt = [],
+ offset = [ 0, 0 ],
+ isVisible;
+
+ if ( position ) {
+ // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
+ // if (typeof position == 'string' || $.isArray(position)) {
+ // myAt = $.isArray(position) ? position : position.split(' ');
+
+ if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) {
+ myAt = position.split ? position.split( " " ) : [ position[ 0 ], position[ 1 ] ];
+ if ( myAt.length === 1 ) {
+ myAt[ 1 ] = myAt[ 0 ];
+ }
+
+ $.each( [ "left", "top" ], function( i, offsetPosition ) {
+ if ( +myAt[ i ] === myAt[ i ] ) {
+ offset[ i ] = myAt[ i ];
+ myAt[ i ] = offsetPosition;
+ }
+ });
+
+ position = {
+ my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " +
+ myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]),
+ at: myAt.join( " " )
+ };
+ }
+
+ position = $.extend( {}, $.ui.dialog.prototype.options.position, position );
+ } else {
+ position = $.ui.dialog.prototype.options.position;
+ }
+
+ // need to show the dialog to get the actual offset in the position plugin
+ isVisible = this.uiDialog.is( ":visible" );
+ if ( !isVisible ) {
+ this.uiDialog.show();
+ }
+ this.uiDialog.position( position );
+ if ( !isVisible ) {
+ this.uiDialog.hide();
+ }
+ },
+
+ _setOptions: function( options ) {
+ var that = this,
+ resizableOptions = {},
+ resize = false;
+
+ $.each( options, function( key, value ) {
+ that._setOption( key, value );
+
+ if ( key in sizeRelatedOptions ) {
+ resize = true;
+ }
+ if ( key in resizableRelatedOptions ) {
+ resizableOptions[ key ] = value;
+ }
+ });
+
+ if ( resize ) {
+ this._size();
+ }
+ if ( this.uiDialog.is( ":data(resizable)" ) ) {
+ this.uiDialog.resizable( "option", resizableOptions );
+ }
+ },
+
+ _setOption: function( key, value ) {
+ var isDraggable, isResizable,
+ uiDialog = this.uiDialog;
+
+ switch ( key ) {
+ case "buttons":
+ this._createButtons( value );
+ break;
+ case "closeText":
+ // ensure that we always pass a string
+ this.uiDialogTitlebarCloseText.text( "" + value );
+ break;
+ case "dialogClass":
+ uiDialog
+ .removeClass( this.options.dialogClass )
+ .addClass( uiDialogClasses + value );
+ break;
+ case "disabled":
+ if ( value ) {
+ uiDialog.addClass( "ui-dialog-disabled" );
+ } else {
+ uiDialog.removeClass( "ui-dialog-disabled" );
+ }
+ break;
+ case "draggable":
+ isDraggable = uiDialog.is( ":data(draggable)" );
+ if ( isDraggable && !value ) {
+ uiDialog.draggable( "destroy" );
+ }
+
+ if ( !isDraggable && value ) {
+ this._makeDraggable();
+ }
+ break;
+ case "position":
+ this._position( value );
+ break;
+ case "resizable":
+ // currently resizable, becoming non-resizable
+ isResizable = uiDialog.is( ":data(resizable)" );
+ if ( isResizable && !value ) {
+ uiDialog.resizable( "destroy" );
+ }
+
+ // currently resizable, changing handles
+ if ( isResizable && typeof value === "string" ) {
+ uiDialog.resizable( "option", "handles", value );
+ }
+
+ // currently non-resizable, becoming resizable
+ if ( !isResizable && value !== false ) {
+ this._makeResizable( value );
+ }
+ break;
+ case "title":
+ // convert whatever was passed in o a string, for html() to not throw up
+ $( ".ui-dialog-title", this.uiDialogTitlebar )
+ .html( "" + ( value || "&#160;" ) );
+ break;
+ }
+
+ this._super( key, value );
+ },
+
+ _size: function() {
+ /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
+ * divs will both have width and height set, so we need to reset them
+ */
+ var nonContentHeight, minContentHeight, autoHeight,
+ options = this.options,
+ isVisible = this.uiDialog.is( ":visible" );
+
+ // reset content sizing
+ this.element.show().css({
+ width: "auto",
+ minHeight: 0,
+ height: 0
+ });
+
+ if ( options.minWidth > options.width ) {
+ options.width = options.minWidth;
+ }
+
+ // reset wrapper sizing
+ // determine the height of all the non-content elements
+ nonContentHeight = this.uiDialog.css({
+ height: "auto",
+ width: options.width
+ })
+ .outerHeight();
+ minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
+
+ if ( options.height === "auto" ) {
+ // only needed for IE6 support
+ if ( $.support.minHeight ) {
+ this.element.css({
+ minHeight: minContentHeight,
+ height: "auto"
+ });
+ } else {
+ this.uiDialog.show();
+ autoHeight = this.element.css( "height", "auto" ).height();
+ if ( !isVisible ) {
+ this.uiDialog.hide();
+ }
+ this.element.height( Math.max( autoHeight, minContentHeight ) );
+ }
+ } else {
+ this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
+ }
+
+ if (this.uiDialog.is( ":data(resizable)" ) ) {
+ this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
+ }
+ }
+});
+
+$.extend($.ui.dialog, {
+ uuid: 0,
+ maxZ: 0,
+
+ getTitleId: function($el) {
+ var id = $el.attr( "id" );
+ if ( !id ) {
+ this.uuid += 1;
+ id = this.uuid;
+ }
+ return "ui-dialog-title-" + id;
+ },
+
+ overlay: function( dialog ) {
+ this.$el = $.ui.dialog.overlay.create( dialog );
+ }
+});
+
+$.extend( $.ui.dialog.overlay, {
+ instances: [],
+ // reuse old instances due to IE memory leak with alpha transparency (see #5185)
+ oldInstances: [],
+ maxZ: 0,
+ events: $.map(
+ "focus,mousedown,mouseup,keydown,keypress,click".split( "," ),
+ function( event ) {
+ return event + ".dialog-overlay";
+ }
+ ).join( " " ),
+ create: function( dialog ) {
+ if ( this.instances.length === 0 ) {
+ // prevent use of anchors and inputs
+ // we use a setTimeout in case the overlay is created from an
+ // event that we're going to be cancelling (see #2804)
+ setTimeout(function() {
+ // handle $(el).dialog().dialog('close') (see #4065)
+ if ( $.ui.dialog.overlay.instances.length ) {
+ $( document ).bind( $.ui.dialog.overlay.events, function( event ) {
+ // stop events if the z-index of the target is < the z-index of the overlay
+ // we cannot return true when we don't want to cancel the event (#3523)
+ if ( $( event.target ).zIndex() < $.ui.dialog.overlay.maxZ ) {
+ return false;
+ }
+ });
+ }
+ }, 1 );
+
+ // handle window resize
+ $( window ).bind( "resize.dialog-overlay", $.ui.dialog.overlay.resize );
+ }
+
+ var $el = ( this.oldInstances.pop() || $( "<div>" ).addClass( "ui-widget-overlay" ) );
+
+ // allow closing by pressing the escape key
+ $( document ).bind( "keydown.dialog-overlay", function( event ) {
+ var instances = $.ui.dialog.overlay.instances;
+ // only react to the event if we're the top overlay
+ if ( instances.length !== 0 && instances[ instances.length - 1 ] === $el &&
+ dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
+ event.keyCode === $.ui.keyCode.ESCAPE ) {
+
+ dialog.close( event );
+ event.preventDefault();
+ }
+ });
+
+ $el.appendTo( document.body ).css({
+ width: this.width(),
+ height: this.height()
+ });
+
+ if ( $.fn.bgiframe ) {
+ $el.bgiframe();
+ }
+
+ this.instances.push( $el );
+ return $el;
+ },
+
+ destroy: function( $el ) {
+ var indexOf = $.inArray( $el, this.instances ),
+ maxZ = 0;
+
+ if ( indexOf !== -1 ) {
+ this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] );
+ }
+
+ if ( this.instances.length === 0 ) {
+ $( [ document, window ] ).unbind( ".dialog-overlay" );
+ }
+
+ $el.height( 0 ).width( 0 ).remove();
+
+ // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
+ $.each( this.instances, function() {
+ maxZ = Math.max( maxZ, this.css( "z-index" ) );
+ });
+ this.maxZ = maxZ;
+ },
+
+ height: function() {
+ var scrollHeight,
+ offsetHeight;
+ // handle IE
+ if ( $.ui.ie ) {
+ scrollHeight = Math.max(
+ document.documentElement.scrollHeight,
+ document.body.scrollHeight
+ );
+ offsetHeight = Math.max(
+ document.documentElement.offsetHeight,
+ document.body.offsetHeight
+ );
+
+ if ( scrollHeight < offsetHeight ) {
+ return $( window ).height() + "px";
+ } else {
+ return scrollHeight + "px";
+ }
+ // handle "good" browsers
+ } else {
+ return $( document ).height() + "px";
+ }
+ },
+
+ width: function() {
+ var scrollWidth,
+ offsetWidth;
+ // handle IE
+ if ( $.ui.ie ) {
+ scrollWidth = Math.max(
+ document.documentElement.scrollWidth,
+ document.body.scrollWidth
+ );
+ offsetWidth = Math.max(
+ document.documentElement.offsetWidth,
+ document.body.offsetWidth
+ );
+
+ if ( scrollWidth < offsetWidth ) {
+ return $( window ).width() + "px";
+ } else {
+ return scrollWidth + "px";
+ }
+ // handle "good" browsers
+ } else {
+ return $( document ).width() + "px";
+ }
+ },
+
+ resize: function() {
+ /* If the dialog is draggable and the user drags it past the
+ * right edge of the window, the document becomes wider so we
+ * need to stretch the overlay. If the user then drags the
+ * dialog back to the left, the document will become narrower,
+ * so we need to shrink the overlay to the appropriate size.
+ * This is handled by shrinking the overlay before setting it
+ * to the full document size.
+ */
+ var $overlays = $( [] );
+ $.each( $.ui.dialog.overlay.instances, function() {
+ $overlays = $overlays.add( this );
+ });
+
+ $overlays.css({
+ width: 0,
+ height: 0
+ }).css({
+ width: $.ui.dialog.overlay.width(),
+ height: $.ui.dialog.overlay.height()
+ });
+ }
+});
+
+$.extend( $.ui.dialog.overlay.prototype, {
+ destroy: function() {
+ $.ui.dialog.overlay.destroy( this.$el );
+ }
+});
+
+}( jQuery ) );
+(function( $, undefined ) {
+
+$.widget("ui.draggable", $.ui.mouse, {
+ version: "1.9.2",
+ widgetEventPrefix: "drag",
+ options: {
+ addClasses: true,
+ appendTo: "parent",
+ axis: false,
+ connectToSortable: false,
+ containment: false,
+ cursor: "auto",
+ cursorAt: false,
+ grid: false,
+ handle: false,
+ helper: "original",
+ iframeFix: false,
+ opacity: false,
+ refreshPositions: false,
+ revert: false,
+ revertDuration: 500,
+ scope: "default",
+ scroll: true,
+ scrollSensitivity: 20,
+ scrollSpeed: 20,
+ snap: false,
+ snapMode: "both",
+ snapTolerance: 20,
+ stack: false,
+ zIndex: false
+ },
+ _create: function() {
+
+ if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
+ this.element[0].style.position = 'relative';
+
+ (this.options.addClasses && this.element.addClass("ui-draggable"));
+ (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
+
+ this._mouseInit();
+
+ },
+
+ _destroy: function() {
+ this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
+ this._mouseDestroy();
+ },
+
+ _mouseCapture: function(event) {
+
+ var o = this.options;
+
+ // among others, prevent a drag on a resizable-handle
+ if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
+ return false;
+
+ //Quit if we're not on a valid handle
+ this.handle = this._getHandle(event);
+ if (!this.handle)
+ return false;
+
+ $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
+ $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
+ .css({
+ width: this.offsetWidth+"px", height: this.offsetHeight+"px",
+ position: "absolute", opacity: "0.001", zIndex: 1000
+ })
+ .css($(this).offset())
+ .appendTo("body");
+ });
+
+ return true;
+
+ },
+
+ _mouseStart: function(event) {
+
+ var o = this.options;
+
+ //Create and append the visible helper
+ this.helper = this._createHelper(event);
+
+ this.helper.addClass("ui-draggable-dragging");
+
+ //Cache the helper size
+ this._cacheHelperProportions();
+
+ //If ddmanager is used for droppables, set the global draggable
+ if($.ui.ddmanager)
+ $.ui.ddmanager.current = this;
+
+ /*
+ * - Position generation -
+ * This block generates everything position related - it's the core of draggables.
+ */
+
+ //Cache the margins of the original element
+ this._cacheMargins();
+
+ //Store the helper's css position
+ this.cssPosition = this.helper.css("position");
+ this.scrollParent = this.helper.scrollParent();
+
+ //The element's absolute position on the page minus margins
+ this.offset = this.positionAbs = this.element.offset();
+ this.offset = {
+ top: this.offset.top - this.margins.top,
+ left: this.offset.left - this.margins.left
+ };
+
+ $.extend(this.offset, {
+ click: { //Where the click happened, relative to the element
+ left: event.pageX - this.offset.left,
+ top: event.pageY - this.offset.top
+ },
+ parent: this._getParentOffset(),
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
+ });
+
+ //Generate the original position
+ this.originalPosition = this.position = this._generatePosition(event);
+ this.originalPageX = event.pageX;
+ this.originalPageY = event.pageY;
+
+ //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
+
+ //Set a containment if given in the options
+ if(o.containment)
+ this._setContainment();
+
+ //Trigger event + callbacks
+ if(this._trigger("start", event) === false) {
+ this._clear();
+ return false;
+ }
+
+ //Recache the helper size
+ this._cacheHelperProportions();
+
+ //Prepare the droppable offsets
+ if ($.ui.ddmanager && !o.dropBehaviour)
+ $.ui.ddmanager.prepareOffsets(this, event);
+
+
+ this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+
+ //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
+ if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
+
+ return true;
+ },
+
+ _mouseDrag: function(event, noPropagation) {
+
+ //Compute the helpers position
+ this.position = this._generatePosition(event);
+ this.positionAbs = this._convertPositionTo("absolute");
+
+ //Call plugins and callbacks and use the resulting position if something is returned
+ if (!noPropagation) {
+ var ui = this._uiHash();
+ if(this._trigger('drag', event, ui) === false) {
+ this._mouseUp({});
+ return false;
+ }
+ this.position = ui.position;
+ }
+
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
+
+ return false;
+ },
+
+ _mouseStop: function(event) {
+
+ //If we are using droppables, inform the manager about the drop
+ var dropped = false;
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
+ dropped = $.ui.ddmanager.drop(this, event);
+
+ //if a drop comes from outside (a sortable)
+ if(this.dropped) {
+ dropped = this.dropped;
+ this.dropped = false;
+ }
+
+ //if the original element is no longer in the DOM don't bother to continue (see #8269)
+ var element = this.element[0], elementInDom = false;
+ while ( element && (element = element.parentNode) ) {
+ if (element == document ) {
+ elementInDom = true;
+ }
+ }
+ if ( !elementInDom && this.options.helper === "original" )
+ return false;
+
+ if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
+ var that = this;
+ $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
+ if(that._trigger("stop", event) !== false) {
+ that._clear();
+ }
+ });
+ } else {
+ if(this._trigger("stop", event) !== false) {
+ this._clear();
+ }
+ }
+
+ return false;
+ },
+
+ _mouseUp: function(event) {
+ //Remove frame helpers
+ $("div.ui-draggable-iframeFix").each(function() {
+ this.parentNode.removeChild(this);
+ });
+
+ //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
+ if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
+
+ return $.ui.mouse.prototype._mouseUp.call(this, event);
+ },
+
+ cancel: function() {
+
+ if(this.helper.is(".ui-draggable-dragging")) {
+ this._mouseUp({});
+ } else {
+ this._clear();
+ }
+
+ return this;
+
+ },
+
+ _getHandle: function(event) {
+
+ var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
+ $(this.options.handle, this.element)
+ .find("*")
+ .andSelf()
+ .each(function() {
+ if(this == event.target) handle = true;
+ });
+
+ return handle;
+
+ },
+
+ _createHelper: function(event) {
+
+ var o = this.options;
+ var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
+
+ if(!helper.parents('body').length)
+ helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
+
+ if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
+ helper.css("position", "absolute");
+
+ return helper;
+
+ },
+
+ _adjustOffsetFromHelper: function(obj) {
+ if (typeof obj == 'string') {
+ obj = obj.split(' ');
+ }
+ if ($.isArray(obj)) {
+ obj = {left: +obj[0], top: +obj[1] || 0};
+ }
+ if ('left' in obj) {
+ this.offset.click.left = obj.left + this.margins.left;
+ }
+ if ('right' in obj) {
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+ }
+ if ('top' in obj) {
+ this.offset.click.top = obj.top + this.margins.top;
+ }
+ if ('bottom' in obj) {
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+ }
+ },
+
+ _getParentOffset: function() {
+
+ //Get the offsetParent and cache its position
+ this.offsetParent = this.helper.offsetParent();
+ var po = this.offsetParent.offset();
+
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
+ po.left += this.scrollParent.scrollLeft();
+ po.top += this.scrollParent.scrollTop();
+ }
+
+ if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
+ po = { top: 0, left: 0 };
+
+ return {
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+ };
+
+ },
+
+ _getRelativeOffset: function() {
+
+ if(this.cssPosition == "relative") {
+ var p = this.element.position();
+ return {
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
+ };
+ } else {
+ return { top: 0, left: 0 };
+ }
+
+ },
+
+ _cacheMargins: function() {
+ this.margins = {
+ left: (parseInt(this.element.css("marginLeft"),10) || 0),
+ top: (parseInt(this.element.css("marginTop"),10) || 0),
+ right: (parseInt(this.element.css("marginRight"),10) || 0),
+ bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
+ };
+ },
+
+ _cacheHelperProportions: function() {
+ this.helperProportions = {
+ width: this.helper.outerWidth(),
+ height: this.helper.outerHeight()
+ };
+ },
+
+ _setContainment: function() {
+
+ var o = this.options;
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
+ o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
+ o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
+ (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
+ (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+ ];
+
+ if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
+ var c = $(o.containment);
+ var ce = c[0]; if(!ce) return;
+ var co = c.offset();
+ var over = ($(ce).css("overflow") != 'hidden');
+
+ this.containment = [
+ (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
+ (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
+ (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,
+ (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom
+ ];
+ this.relative_container = c;
+
+ } else if(o.containment.constructor == Array) {
+ this.containment = o.containment;
+ }
+
+ },
+
+ _convertPositionTo: function(d, pos) {
+
+ if(!pos) pos = this.position;
+ var mod = d == "absolute" ? 1 : -1;
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+ return {
+ top: (
+ pos.top // The absolute mouse position
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+ ),
+ left: (
+ pos.left // The absolute mouse position
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+ )
+ };
+
+ },
+
+ _generatePosition: function(event) {
+
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+ var pageX = event.pageX;
+ var pageY = event.pageY;
+
+ /*
+ * - Position constraining -
+ * Constrain the position to a mix of grid, containment.
+ */
+
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
+ var containment;
+ if(this.containment) {
+ if (this.relative_container){
+ var co = this.relative_container.offset();
+ containment = [ this.containment[0] + co.left,
+ this.containment[1] + co.top,
+ this.containment[2] + co.left,
+ this.containment[3] + co.top ];
+ }
+ else {
+ containment = this.containment;
+ }
+
+ if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top;
+ if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top;
+ }
+
+ if(o.grid) {
+ //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
+ var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
+ pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+
+ var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
+ pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+ }
+
+ }
+
+ return {
+ top: (
+ pageY // The absolute mouse position
+ - this.offset.click.top // Click offset (relative to the element)
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+ ),
+ left: (
+ pageX // The absolute mouse position
+ - this.offset.click.left // Click offset (relative to the element)
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+ )
+ };
+
+ },
+
+ _clear: function() {
+ this.helper.removeClass("ui-draggable-dragging");
+ if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
+ //if($.ui.ddmanager) $.ui.ddmanager.current = null;
+ this.helper = null;
+ this.cancelHelperRemoval = false;
+ },
+
+ // From now on bulk stuff - mainly helpers
+
+ _trigger: function(type, event, ui) {
+ ui = ui || this._uiHash();
+ $.ui.plugin.call(this, type, [event, ui]);
+ if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
+ return $.Widget.prototype._trigger.call(this, type, event, ui);
+ },
+
+ plugins: {},
+
+ _uiHash: function(event) {
+ return {
+ helper: this.helper,
+ position: this.position,
+ originalPosition: this.originalPosition,
+ offset: this.positionAbs
+ };
+ }
+
+});
+
+$.ui.plugin.add("draggable", "connectToSortable", {
+ start: function(event, ui) {
+
+ var inst = $(this).data("draggable"), o = inst.options,
+ uiSortable = $.extend({}, ui, { item: inst.element });
+ inst.sortables = [];
+ $(o.connectToSortable).each(function() {
+ var sortable = $.data(this, 'sortable');
+ if (sortable && !sortable.options.disabled) {
+ inst.sortables.push({
+ instance: sortable,
+ shouldRevert: sortable.options.revert
+ });
+ sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
+ sortable._trigger("activate", event, uiSortable);
+ }
+ });
+
+ },
+ stop: function(event, ui) {
+
+ //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
+ var inst = $(this).data("draggable"),
+ uiSortable = $.extend({}, ui, { item: inst.element });
+
+ $.each(inst.sortables, function() {
+ if(this.instance.isOver) {
+
+ this.instance.isOver = 0;
+
+ inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
+ this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
+
+ //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
+ if(this.shouldRevert) this.instance.options.revert = true;
+
+ //Trigger the stop of the sortable
+ this.instance._mouseStop(event);
+
+ this.instance.options.helper = this.instance.options._helper;
+
+ //If the helper has been the original item, restore properties in the sortable
+ if(inst.options.helper == 'original')
+ this.instance.currentItem.css({ top: 'auto', left: 'auto' });
+
+ } else {
+ this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
+ this.instance._trigger("deactivate", event, uiSortable);
+ }
+
+ });
+
+ },
+ drag: function(event, ui) {
+
+ var inst = $(this).data("draggable"), that = this;
+
+ var checkPos = function(o) {
+ var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
+ var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
+ var itemHeight = o.height, itemWidth = o.width;
+ var itemTop = o.top, itemLeft = o.left;
+
+ return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
+ };
+
+ $.each(inst.sortables, function(i) {
+
+ var innermostIntersecting = false;
+ var thisSortable = this;
+ //Copy over some variables to allow calling the sortable's native _intersectsWith
+ this.instance.positionAbs = inst.positionAbs;
+ this.instance.helperProportions = inst.helperProportions;
+ this.instance.offset.click = inst.offset.click;
+
+ if(this.instance._intersectsWith(this.instance.containerCache)) {
+ innermostIntersecting = true;
+ $.each(inst.sortables, function () {
+ this.instance.positionAbs = inst.positionAbs;
+ this.instance.helperProportions = inst.helperProportions;
+ this.instance.offset.click = inst.offset.click;
+ if (this != thisSortable
+ && this.instance._intersectsWith(this.instance.containerCache)
+ && $.ui.contains(thisSortable.instance.element[0], this.instance.element[0]))
+ innermostIntersecting = false;
+ return innermostIntersecting;
+ });
+ }
+
+
+ if(innermostIntersecting) {
+ //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
+ if(!this.instance.isOver) {
+
+ this.instance.isOver = 1;
+ //Now we fake the start of dragging for the sortable instance,
+ //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
+ //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
+ this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
+ this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
+ this.instance.options.helper = function() { return ui.helper[0]; };
+
+ event.target = this.instance.currentItem[0];
+ this.instance._mouseCapture(event, true);
+ this.instance._mouseStart(event, true, true);
+
+ //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
+ this.instance.offset.click.top = inst.offset.click.top;
+ this.instance.offset.click.left = inst.offset.click.left;
+ this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
+ this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
+
+ inst._trigger("toSortable", event);
+ inst.dropped = this.instance.element; //draggable revert needs that
+ //hack so receive/update callbacks work (mostly)
+ inst.currentItem = inst.element;
+ this.instance.fromOutside = inst;
+
+ }
+
+ //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
+ if(this.instance.currentItem) this.instance._mouseDrag(event);
+
+ } else {
+
+ //If it doesn't intersect with the sortable, and it intersected before,
+ //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
+ if(this.instance.isOver) {
+
+ this.instance.isOver = 0;
+ this.instance.cancelHelperRemoval = true;
+
+ //Prevent reverting on this forced stop
+ this.instance.options.revert = false;
+
+ // The out event needs to be triggered independently
+ this.instance._trigger('out', event, this.instance._uiHash(this.instance));
+
+ this.instance._mouseStop(event, true);
+ this.instance.options.helper = this.instance.options._helper;
+
+ //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
+ this.instance.currentItem.remove();
+ if(this.instance.placeholder) this.instance.placeholder.remove();
+
+ inst._trigger("fromSortable", event);
+ inst.dropped = false; //draggable revert needs that
+ }
+
+ };
+
+ });
+
+ }
+});
+
+$.ui.plugin.add("draggable", "cursor", {
+ start: function(event, ui) {
+ var t = $('body'), o = $(this).data('draggable').options;
+ if (t.css("cursor")) o._cursor = t.css("cursor");
+ t.css("cursor", o.cursor);
+ },
+ stop: function(event, ui) {
+ var o = $(this).data('draggable').options;
+ if (o._cursor) $('body').css("cursor", o._cursor);
+ }
+});
+
+$.ui.plugin.add("draggable", "opacity", {
+ start: function(event, ui) {
+ var t = $(ui.helper), o = $(this).data('draggable').options;
+ if(t.css("opacity")) o._opacity = t.css("opacity");
+ t.css('opacity', o.opacity);
+ },
+ stop: function(event, ui) {
+ var o = $(this).data('draggable').options;
+ if(o._opacity) $(ui.helper).css('opacity', o._opacity);
+ }
+});
+
+$.ui.plugin.add("draggable", "scroll", {
+ start: function(event, ui) {
+ var i = $(this).data("draggable");
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
+ },
+ drag: function(event, ui) {
+
+ var i = $(this).data("draggable"), o = i.options, scrolled = false;
+
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
+
+ if(!o.axis || o.axis != 'x') {
+ if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
+ else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
+ }
+
+ if(!o.axis || o.axis != 'y') {
+ if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
+ else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
+ }
+
+ } else {
+
+ if(!o.axis || o.axis != 'x') {
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+ else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+ }
+
+ if(!o.axis || o.axis != 'y') {
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+ else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+ }
+
+ }
+
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
+ $.ui.ddmanager.prepareOffsets(i, event);
+
+ }
+});
+
+$.ui.plugin.add("draggable", "snap", {
+ start: function(event, ui) {
+
+ var i = $(this).data("draggable"), o = i.options;
+ i.snapElements = [];
+
+ $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
+ var $t = $(this); var $o = $t.offset();
+ if(this != i.element[0]) i.snapElements.push({
+ item: this,
+ width: $t.outerWidth(), height: $t.outerHeight(),
+ top: $o.top, left: $o.left
+ });
+ });
+
+ },
+ drag: function(event, ui) {
+
+ var inst = $(this).data("draggable"), o = inst.options;
+ var d = o.snapTolerance;
+
+ var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
+ y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
+
+ for (var i = inst.snapElements.length - 1; i >= 0; i--){
+
+ var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
+ t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
+
+ //Yes, I know, this is insane ;)
+ if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
+ if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+ inst.snapElements[i].snapping = false;
+ continue;
+ }
+
+ if(o.snapMode != 'inner') {
+ var ts = Math.abs(t - y2) <= d;
+ var bs = Math.abs(b - y1) <= d;
+ var ls = Math.abs(l - x2) <= d;
+ var rs = Math.abs(r - x1) <= d;
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
+ }
+
+ var first = (ts || bs || ls || rs);
+
+ if(o.snapMode != 'outer') {
+ var ts = Math.abs(t - y1) <= d;
+ var bs = Math.abs(b - y2) <= d;
+ var ls = Math.abs(l - x1) <= d;
+ var rs = Math.abs(r - x2) <= d;
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
+ }
+
+ if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
+ (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+ inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
+
+ };
+
+ }
+});
+
+$.ui.plugin.add("draggable", "stack", {
+ start: function(event, ui) {
+
+ var o = $(this).data("draggable").options;
+
+ var group = $.makeArray($(o.stack)).sort(function(a,b) {
+ return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
+ });
+ if (!group.length) { return; }
+
+ var min = parseInt(group[0].style.zIndex) || 0;
+ $(group).each(function(i) {
+ this.style.zIndex = min + i;
+ });
+
+ this[0].style.zIndex = min + group.length;
+
+ }
+});
+
+$.ui.plugin.add("draggable", "zIndex", {
+ start: function(event, ui) {
+ var t = $(ui.helper), o = $(this).data("draggable").options;
+ if(t.css("zIndex")) o._zIndex = t.css("zIndex");
+ t.css('zIndex', o.zIndex);
+ },
+ stop: function(event, ui) {
+ var o = $(this).data("draggable").options;
+ if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
+ }
+});
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.widget("ui.droppable", {
+ version: "1.9.2",
+ widgetEventPrefix: "drop",
+ options: {
+ accept: '*',
+ activeClass: false,
+ addClasses: true,
+ greedy: false,
+ hoverClass: false,
+ scope: 'default',
+ tolerance: 'intersect'
+ },
+ _create: function() {
+
+ var o = this.options, accept = o.accept;
+ this.isover = 0; this.isout = 1;
+
+ this.accept = $.isFunction(accept) ? accept : function(d) {
+ return d.is(accept);
+ };
+
+ //Store the droppable's proportions
+ this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
+
+ // Add the reference and positions to the manager
+ $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
+ $.ui.ddmanager.droppables[o.scope].push(this);
+
+ (o.addClasses && this.element.addClass("ui-droppable"));
+
+ },
+
+ _destroy: function() {
+ var drop = $.ui.ddmanager.droppables[this.options.scope];
+ for ( var i = 0; i < drop.length; i++ )
+ if ( drop[i] == this )
+ drop.splice(i, 1);
+
+ this.element.removeClass("ui-droppable ui-droppable-disabled");
+ },
+
+ _setOption: function(key, value) {
+
+ if(key == 'accept') {
+ this.accept = $.isFunction(value) ? value : function(d) {
+ return d.is(value);
+ };
+ }
+ $.Widget.prototype._setOption.apply(this, arguments);
+ },
+
+ _activate: function(event) {
+ var draggable = $.ui.ddmanager.current;
+ if(this.options.activeClass) this.element.addClass(this.options.activeClass);
+ (draggable && this._trigger('activate', event, this.ui(draggable)));
+ },
+
+ _deactivate: function(event) {
+ var draggable = $.ui.ddmanager.current;
+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
+ (draggable && this._trigger('deactivate', event, this.ui(draggable)));
+ },
+
+ _over: function(event) {
+
+ var draggable = $.ui.ddmanager.current;
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
+
+ if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
+ this._trigger('over', event, this.ui(draggable));
+ }
+
+ },
+
+ _out: function(event) {
+
+ var draggable = $.ui.ddmanager.current;
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
+
+ if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
+ this._trigger('out', event, this.ui(draggable));
+ }
+
+ },
+
+ _drop: function(event,custom) {
+
+ var draggable = custom || $.ui.ddmanager.current;
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
+
+ var childrenIntersection = false;
+ this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
+ var inst = $.data(this, 'droppable');
+ if(
+ inst.options.greedy
+ && !inst.options.disabled
+ && inst.options.scope == draggable.options.scope
+ && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
+ && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
+ ) { childrenIntersection = true; return false; }
+ });
+ if(childrenIntersection) return false;
+
+ if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
+ this._trigger('drop', event, this.ui(draggable));
+ return this.element;
+ }
+
+ return false;
+
+ },
+
+ ui: function(c) {
+ return {
+ draggable: (c.currentItem || c.element),
+ helper: c.helper,
+ position: c.position,
+ offset: c.positionAbs
+ };
+ }
+
+});
+
+$.ui.intersect = function(draggable, droppable, toleranceMode) {
+
+ if (!droppable.offset) return false;
+
+ var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
+ y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
+ var l = droppable.offset.left, r = l + droppable.proportions.width,
+ t = droppable.offset.top, b = t + droppable.proportions.height;
+
+ switch (toleranceMode) {
+ case 'fit':
+ return (l <= x1 && x2 <= r
+ && t <= y1 && y2 <= b);
+ break;
+ case 'intersect':
+ return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
+ && x2 - (draggable.helperProportions.width / 2) < r // Left Half
+ && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
+ && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
+ break;
+ case 'pointer':
+ var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
+ draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
+ isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
+ return isOver;
+ break;
+ case 'touch':
+ return (
+ (y1 >= t && y1 <= b) || // Top edge touching
+ (y2 >= t && y2 <= b) || // Bottom edge touching
+ (y1 < t && y2 > b) // Surrounded vertically
+ ) && (
+ (x1 >= l && x1 <= r) || // Left edge touching
+ (x2 >= l && x2 <= r) || // Right edge touching
+ (x1 < l && x2 > r) // Surrounded horizontally
+ );
+ break;
+ default:
+ return false;
+ break;
+ }
+
+};
+
+/*
+ This manager tracks offsets of draggables and droppables
+*/
+$.ui.ddmanager = {
+ current: null,
+ droppables: { 'default': [] },
+ prepareOffsets: function(t, event) {
+
+ var m = $.ui.ddmanager.droppables[t.options.scope] || [];
+ var type = event ? event.type : null; // workaround for #2317
+ var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
+
+ droppablesLoop: for (var i = 0; i < m.length; i++) {
+
+ if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
+ for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
+ m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
+
+ if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
+
+ m[i].offset = m[i].element.offset();
+ m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
+
+ }
+
+ },
+ drop: function(draggable, event) {
+
+ var dropped = false;
+ $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
+
+ if(!this.options) return;
+ if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
+ dropped = this._drop.call(this, event) || dropped;
+
+ if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+ this.isout = 1; this.isover = 0;
+ this._deactivate.call(this, event);
+ }
+
+ });
+ return dropped;
+
+ },
+ dragStart: function( draggable, event ) {
+ //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
+ draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
+ if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
+ });
+ },
+ drag: function(draggable, event) {
+
+ //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
+ if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
+
+ //Run through all droppables and check their positions based on specific tolerance options
+ $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
+
+ if(this.options.disabled || this.greedyChild || !this.visible) return;
+ var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
+
+ var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
+ if(!c) return;
+
+ var parentInstance;
+ if (this.options.greedy) {
+ // find droppable parents with same scope
+ var scope = this.options.scope;
+ var parent = this.element.parents(':data(droppable)').filter(function () {
+ return $.data(this, 'droppable').options.scope === scope;
+ });
+
+ if (parent.length) {
+ parentInstance = $.data(parent[0], 'droppable');
+ parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
+ }
+ }
+
+ // we just moved into a greedy child
+ if (parentInstance && c == 'isover') {
+ parentInstance['isover'] = 0;
+ parentInstance['isout'] = 1;
+ parentInstance._out.call(parentInstance, event);
+ }
+
+ this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
+ this[c == "isover" ? "_over" : "_out"].call(this, event);
+
+ // we just moved out of a greedy child
+ if (parentInstance && c == 'isout') {
+ parentInstance['isout'] = 0;
+ parentInstance['isover'] = 1;
+ parentInstance._over.call(parentInstance, event);
+ }
+ });
+
+ },
+ dragStop: function( draggable, event ) {
+ draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
+ //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
+ if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
+ }
+};
+
+})(jQuery);
+;(jQuery.effects || (function($, undefined) {
+
+var backCompat = $.uiBackCompat !== false,
+ // prefix used for storing data on .data()
+ dataSpace = "ui-effects-";
+
+$.effects = {
+ effect: {}
+};
+
+/*!
+ * jQuery Color Animations v2.0.0
+ * http://jquery.com/
+ *
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * Date: Mon Aug 13 13:41:02 2012 -0500
+ */
+(function( jQuery, undefined ) {
+
+ var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "),
+
+ // plusequals test for += 100 -= 100
+ rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
+ // a set of RE's that can match strings and generate color tuples.
+ stringParsers = [{
+ re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
+ parse: function( execResult ) {
+ return [
+ execResult[ 1 ],
+ execResult[ 2 ],
+ execResult[ 3 ],
+ execResult[ 4 ]
+ ];
+ }
+ }, {
+ re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
+ parse: function( execResult ) {
+ return [
+ execResult[ 1 ] * 2.55,
+ execResult[ 2 ] * 2.55,
+ execResult[ 3 ] * 2.55,
+ execResult[ 4 ]
+ ];
+ }
+ }, {
+ // this regex ignores A-F because it's compared against an already lowercased string
+ re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
+ parse: function( execResult ) {
+ return [
+ parseInt( execResult[ 1 ], 16 ),
+ parseInt( execResult[ 2 ], 16 ),
+ parseInt( execResult[ 3 ], 16 )
+ ];
+ }
+ }, {
+ // this regex ignores A-F because it's compared against an already lowercased string
+ re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
+ parse: function( execResult ) {
+ return [
+ parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
+ parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
+ parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
+ ];
+ }
+ }, {
+ re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
+ space: "hsla",
+ parse: function( execResult ) {
+ return [
+ execResult[ 1 ],
+ execResult[ 2 ] / 100,
+ execResult[ 3 ] / 100,
+ execResult[ 4 ]
+ ];
+ }
+ }],
+
+ // jQuery.Color( )
+ color = jQuery.Color = function( color, green, blue, alpha ) {
+ return new jQuery.Color.fn.parse( color, green, blue, alpha );
+ },
+ spaces = {
+ rgba: {
+ props: {
+ red: {
+ idx: 0,
+ type: "byte"
+ },
+ green: {
+ idx: 1,
+ type: "byte"
+ },
+ blue: {
+ idx: 2,
+ type: "byte"
+ }
+ }
+ },
+
+ hsla: {
+ props: {
+ hue: {
+ idx: 0,
+ type: "degrees"
+ },
+ saturation: {
+ idx: 1,
+ type: "percent"
+ },
+ lightness: {
+ idx: 2,
+ type: "percent"
+ }
+ }
+ }
+ },
+ propTypes = {
+ "byte": {
+ floor: true,
+ max: 255
+ },
+ "percent": {
+ max: 1
+ },
+ "degrees": {
+ mod: 360,
+ floor: true
+ }
+ },
+ support = color.support = {},
+
+ // element for support tests
+ supportElem = jQuery( "<p>" )[ 0 ],
+
+ // colors = jQuery.Color.names
+ colors,
+
+ // local aliases of functions called often
+ each = jQuery.each;
+
+// determine rgba support immediately
+supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
+support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
+
+// define cache name and alpha properties
+// for rgba and hsla spaces
+each( spaces, function( spaceName, space ) {
+ space.cache = "_" + spaceName;
+ space.props.alpha = {
+ idx: 3,
+ type: "percent",
+ def: 1
+ };
+});
+
+function clamp( value, prop, allowEmpty ) {
+ var type = propTypes[ prop.type ] || {};
+
+ if ( value == null ) {
+ return (allowEmpty || !prop.def) ? null : prop.def;
+ }
+
+ // ~~ is an short way of doing floor for positive numbers
+ value = type.floor ? ~~value : parseFloat( value );
+
+ // IE will pass in empty strings as value for alpha,
+ // which will hit this case
+ if ( isNaN( value ) ) {
+ return prop.def;
+ }
+
+ if ( type.mod ) {
+ // we add mod before modding to make sure that negatives values
+ // get converted properly: -10 -> 350
+ return (value + type.mod) % type.mod;
+ }
+
+ // for now all property types without mod have min and max
+ return 0 > value ? 0 : type.max < value ? type.max : value;
+}
+
+function stringParse( string ) {
+ var inst = color(),
+ rgba = inst._rgba = [];
+
+ string = string.toLowerCase();
+
+ each( stringParsers, function( i, parser ) {
+ var parsed,
+ match = parser.re.exec( string ),
+ values = match && parser.parse( match ),
+ spaceName = parser.space || "rgba";
+
+ if ( values ) {
+ parsed = inst[ spaceName ]( values );
+
+ // if this was an rgba parse the assignment might happen twice
+ // oh well....
+ inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
+ rgba = inst._rgba = parsed._rgba;
+
+ // exit each( stringParsers ) here because we matched
+ return false;
+ }
+ });
+
+ // Found a stringParser that handled it
+ if ( rgba.length ) {
+
+ // if this came from a parsed string, force "transparent" when alpha is 0
+ // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
+ if ( rgba.join() === "0,0,0,0" ) {
+ jQuery.extend( rgba, colors.transparent );
+ }
+ return inst;
+ }
+
+ // named colors
+ return colors[ string ];
+}
+
+color.fn = jQuery.extend( color.prototype, {
+ parse: function( red, green, blue, alpha ) {
+ if ( red === undefined ) {
+ this._rgba = [ null, null, null, null ];
+ return this;
+ }
+ if ( red.jquery || red.nodeType ) {
+ red = jQuery( red ).css( green );
+ green = undefined;
+ }
+
+ var inst = this,
+ type = jQuery.type( red ),
+ rgba = this._rgba = [];
+
+ // more than 1 argument specified - assume ( red, green, blue, alpha )
+ if ( green !== undefined ) {
+ red = [ red, green, blue, alpha ];
+ type = "array";
+ }
+
+ if ( type === "string" ) {
+ return this.parse( stringParse( red ) || colors._default );
+ }
+
+ if ( type === "array" ) {
+ each( spaces.rgba.props, function( key, prop ) {
+ rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
+ });
+ return this;
+ }
+
+ if ( type === "object" ) {
+ if ( red instanceof color ) {
+ each( spaces, function( spaceName, space ) {
+ if ( red[ space.cache ] ) {
+ inst[ space.cache ] = red[ space.cache ].slice();
+ }
+ });
+ } else {
+ each( spaces, function( spaceName, space ) {
+ var cache = space.cache;
+ each( space.props, function( key, prop ) {
+
+ // if the cache doesn't exist, and we know how to convert
+ if ( !inst[ cache ] && space.to ) {
+
+ // if the value was null, we don't need to copy it
+ // if the key was alpha, we don't need to copy it either
+ if ( key === "alpha" || red[ key ] == null ) {
+ return;
+ }
+ inst[ cache ] = space.to( inst._rgba );
+ }
+
+ // this is the only case where we allow nulls for ALL properties.
+ // call clamp with alwaysAllowEmpty
+ inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
+ });
+
+ // everything defined but alpha?
+ if ( inst[ cache ] && $.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
+ // use the default of 1
+ inst[ cache ][ 3 ] = 1;
+ if ( space.from ) {
+ inst._rgba = space.from( inst[ cache ] );
+ }
+ }
+ });
+ }
+ return this;
+ }
+ },
+ is: function( compare ) {
+ var is = color( compare ),
+ same = true,
+ inst = this;
+
+ each( spaces, function( _, space ) {
+ var localCache,
+ isCache = is[ space.cache ];
+ if (isCache) {
+ localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
+ each( space.props, function( _, prop ) {
+ if ( isCache[ prop.idx ] != null ) {
+ same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
+ return same;
+ }
+ });
+ }
+ return same;
+ });
+ return same;
+ },
+ _space: function() {
+ var used = [],
+ inst = this;
+ each( spaces, function( spaceName, space ) {
+ if ( inst[ space.cache ] ) {
+ used.push( spaceName );
+ }
+ });
+ return used.pop();
+ },
+ transition: function( other, distance ) {
+ var end = color( other ),
+ spaceName = end._space(),
+ space = spaces[ spaceName ],
+ startColor = this.alpha() === 0 ? color( "transparent" ) : this,
+ start = startColor[ space.cache ] || space.to( startColor._rgba ),
+ result = start.slice();
+
+ end = end[ space.cache ];
+ each( space.props, function( key, prop ) {
+ var index = prop.idx,
+ startValue = start[ index ],
+ endValue = end[ index ],
+ type = propTypes[ prop.type ] || {};
+
+ // if null, don't override start value
+ if ( endValue === null ) {
+ return;
+ }
+ // if null - use end
+ if ( startValue === null ) {
+ result[ index ] = endValue;
+ } else {
+ if ( type.mod ) {
+ if ( endValue - startValue > type.mod / 2 ) {
+ startValue += type.mod;
+ } else if ( startValue - endValue > type.mod / 2 ) {
+ startValue -= type.mod;
+ }
+ }
+ result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
+ }
+ });
+ return this[ spaceName ]( result );
+ },
+ blend: function( opaque ) {
+ // if we are already opaque - return ourself
+ if ( this._rgba[ 3 ] === 1 ) {
+ return this;
+ }
+
+ var rgb = this._rgba.slice(),
+ a = rgb.pop(),
+ blend = color( opaque )._rgba;
+
+ return color( jQuery.map( rgb, function( v, i ) {
+ return ( 1 - a ) * blend[ i ] + a * v;
+ }));
+ },
+ toRgbaString: function() {
+ var prefix = "rgba(",
+ rgba = jQuery.map( this._rgba, function( v, i ) {
+ return v == null ? ( i > 2 ? 1 : 0 ) : v;
+ });
+
+ if ( rgba[ 3 ] === 1 ) {
+ rgba.pop();
+ prefix = "rgb(";
+ }
+
+ return prefix + rgba.join() + ")";
+ },
+ toHslaString: function() {
+ var prefix = "hsla(",
+ hsla = jQuery.map( this.hsla(), function( v, i ) {
+ if ( v == null ) {
+ v = i > 2 ? 1 : 0;
+ }
+
+ // catch 1 and 2
+ if ( i && i < 3 ) {
+ v = Math.round( v * 100 ) + "%";
+ }
+ return v;
+ });
+
+ if ( hsla[ 3 ] === 1 ) {
+ hsla.pop();
+ prefix = "hsl(";
+ }
+ return prefix + hsla.join() + ")";
+ },
+ toHexString: function( includeAlpha ) {
+ var rgba = this._rgba.slice(),
+ alpha = rgba.pop();
+
+ if ( includeAlpha ) {
+ rgba.push( ~~( alpha * 255 ) );
+ }
+
+ return "#" + jQuery.map( rgba, function( v ) {
+
+ // default to 0 when nulls exist
+ v = ( v || 0 ).toString( 16 );
+ return v.length === 1 ? "0" + v : v;
+ }).join("");
+ },
+ toString: function() {
+ return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
+ }
+});
+color.fn.parse.prototype = color.fn;
+
+// hsla conversions adapted from:
+// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
+
+function hue2rgb( p, q, h ) {
+ h = ( h + 1 ) % 1;
+ if ( h * 6 < 1 ) {
+ return p + (q - p) * h * 6;
+ }
+ if ( h * 2 < 1) {
+ return q;
+ }
+ if ( h * 3 < 2 ) {
+ return p + (q - p) * ((2/3) - h) * 6;
+ }
+ return p;
+}
+
+spaces.hsla.to = function ( rgba ) {
+ if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
+ return [ null, null, null, rgba[ 3 ] ];
+ }
+ var r = rgba[ 0 ] / 255,
+ g = rgba[ 1 ] / 255,
+ b = rgba[ 2 ] / 255,
+ a = rgba[ 3 ],
+ max = Math.max( r, g, b ),
+ min = Math.min( r, g, b ),
+ diff = max - min,
+ add = max + min,
+ l = add * 0.5,
+ h, s;
+
+ if ( min === max ) {
+ h = 0;
+ } else if ( r === max ) {
+ h = ( 60 * ( g - b ) / diff ) + 360;
+ } else if ( g === max ) {
+ h = ( 60 * ( b - r ) / diff ) + 120;
+ } else {
+ h = ( 60 * ( r - g ) / diff ) + 240;
+ }
+
+ if ( l === 0 || l === 1 ) {
+ s = l;
+ } else if ( l <= 0.5 ) {
+ s = diff / add;
+ } else {
+ s = diff / ( 2 - add );
+ }
+ return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
+};
+
+spaces.hsla.from = function ( hsla ) {
+ if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
+ return [ null, null, null, hsla[ 3 ] ];
+ }
+ var h = hsla[ 0 ] / 360,
+ s = hsla[ 1 ],
+ l = hsla[ 2 ],
+ a = hsla[ 3 ],
+ q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
+ p = 2 * l - q;
+
+ return [
+ Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
+ Math.round( hue2rgb( p, q, h ) * 255 ),
+ Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
+ a
+ ];
+};
+
+
+each( spaces, function( spaceName, space ) {
+ var props = space.props,
+ cache = space.cache,
+ to = space.to,
+ from = space.from;
+
+ // makes rgba() and hsla()
+ color.fn[ spaceName ] = function( value ) {
+
+ // generate a cache for this space if it doesn't exist
+ if ( to && !this[ cache ] ) {
+ this[ cache ] = to( this._rgba );
+ }
+ if ( value === undefined ) {
+ return this[ cache ].slice();
+ }
+
+ var ret,
+ type = jQuery.type( value ),
+ arr = ( type === "array" || type === "object" ) ? value : arguments,
+ local = this[ cache ].slice();
+
+ each( props, function( key, prop ) {
+ var val = arr[ type === "object" ? key : prop.idx ];
+ if ( val == null ) {
+ val = local[ prop.idx ];
+ }
+ local[ prop.idx ] = clamp( val, prop );
+ });
+
+ if ( from ) {
+ ret = color( from( local ) );
+ ret[ cache ] = local;
+ return ret;
+ } else {
+ return color( local );
+ }
+ };
+
+ // makes red() green() blue() alpha() hue() saturation() lightness()
+ each( props, function( key, prop ) {
+ // alpha is included in more than one space
+ if ( color.fn[ key ] ) {
+ return;
+ }
+ color.fn[ key ] = function( value ) {
+ var vtype = jQuery.type( value ),
+ fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
+ local = this[ fn ](),
+ cur = local[ prop.idx ],
+ match;
+
+ if ( vtype === "undefined" ) {
+ return cur;
+ }
+
+ if ( vtype === "function" ) {
+ value = value.call( this, cur );
+ vtype = jQuery.type( value );
+ }
+ if ( value == null && prop.empty ) {
+ return this;
+ }
+ if ( vtype === "string" ) {
+ match = rplusequals.exec( value );
+ if ( match ) {
+ value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
+ }
+ }
+ local[ prop.idx ] = value;
+ return this[ fn ]( local );
+ };
+ });
+});
+
+// add .fx.step functions
+each( stepHooks, function( i, hook ) {
+ jQuery.cssHooks[ hook ] = {
+ set: function( elem, value ) {
+ var parsed, curElem,
+ backgroundColor = "";
+
+ if ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) {
+ value = color( parsed || value );
+ if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
+ curElem = hook === "backgroundColor" ? elem.parentNode : elem;
+ while (
+ (backgroundColor === "" || backgroundColor === "transparent") &&
+ curElem && curElem.style
+ ) {
+ try {
+ backgroundColor = jQuery.css( curElem, "backgroundColor" );
+ curElem = curElem.parentNode;
+ } catch ( e ) {
+ }
+ }
+
+ value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
+ backgroundColor :
+ "_default" );
+ }
+
+ value = value.toRgbaString();
+ }
+ try {
+ elem.style[ hook ] = value;
+ } catch( error ) {
+ // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
+ }
+ }
+ };
+ jQuery.fx.step[ hook ] = function( fx ) {
+ if ( !fx.colorInit ) {
+ fx.start = color( fx.elem, hook );
+ fx.end = color( fx.end );
+ fx.colorInit = true;
+ }
+ jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
+ };
+});
+
+jQuery.cssHooks.borderColor = {
+ expand: function( value ) {
+ var expanded = {};
+
+ each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
+ expanded[ "border" + part + "Color" ] = value;
+ });
+ return expanded;
+ }
+};
+
+// Basic color names only.
+// Usage of any of the other color names requires adding yourself or including
+// jquery.color.svg-names.js.
+colors = jQuery.Color.names = {
+ // 4.1. Basic color keywords
+ aqua: "#00ffff",
+ black: "#000000",
+ blue: "#0000ff",
+ fuchsia: "#ff00ff",
+ gray: "#808080",
+ green: "#008000",
+ lime: "#00ff00",
+ maroon: "#800000",
+ navy: "#000080",
+ olive: "#808000",
+ purple: "#800080",
+ red: "#ff0000",
+ silver: "#c0c0c0",
+ teal: "#008080",
+ white: "#ffffff",
+ yellow: "#ffff00",
+
+ // 4.2.3. "transparent" color keyword
+ transparent: [ null, null, null, 0 ],
+
+ _default: "#ffffff"
+};
+
+})( jQuery );
+
+
+
+/******************************************************************************/
+/****************************** CLASS ANIMATIONS ******************************/
+/******************************************************************************/
+(function() {
+
+var classAnimationActions = [ "add", "remove", "toggle" ],
+ shorthandStyles = {
+ border: 1,
+ borderBottom: 1,
+ borderColor: 1,
+ borderLeft: 1,
+ borderRight: 1,
+ borderTop: 1,
+ borderWidth: 1,
+ margin: 1,
+ padding: 1
+ };
+
+$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
+ $.fx.step[ prop ] = function( fx ) {
+ if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
+ jQuery.style( fx.elem, prop, fx.end );
+ fx.setAttr = true;
+ }
+ };
+});
+
+function getElementStyles() {
+ var style = this.ownerDocument.defaultView ?
+ this.ownerDocument.defaultView.getComputedStyle( this, null ) :
+ this.currentStyle,
+ newStyle = {},
+ key,
+ len;
+
+ // webkit enumerates style porperties
+ if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
+ len = style.length;
+ while ( len-- ) {
+ key = style[ len ];
+ if ( typeof style[ key ] === "string" ) {
+ newStyle[ $.camelCase( key ) ] = style[ key ];
+ }
+ }
+ } else {
+ for ( key in style ) {
+ if ( typeof style[ key ] === "string" ) {
+ newStyle[ key ] = style[ key ];
+ }
+ }
+ }
+
+ return newStyle;
+}
+
+
+function styleDifference( oldStyle, newStyle ) {
+ var diff = {},
+ name, value;
+
+ for ( name in newStyle ) {
+ value = newStyle[ name ];
+ if ( oldStyle[ name ] !== value ) {
+ if ( !shorthandStyles[ name ] ) {
+ if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
+ diff[ name ] = value;
+ }
+ }
+ }
+ }
+
+ return diff;
+}
+
+$.effects.animateClass = function( value, duration, easing, callback ) {
+ var o = $.speed( duration, easing, callback );
+
+ return this.queue( function() {
+ var animated = $( this ),
+ baseClass = animated.attr( "class" ) || "",
+ applyClassChange,
+ allAnimations = o.children ? animated.find( "*" ).andSelf() : animated;
+
+ // map the animated objects to store the original styles.
+ allAnimations = allAnimations.map(function() {
+ var el = $( this );
+ return {
+ el: el,
+ start: getElementStyles.call( this )
+ };
+ });
+
+ // apply class change
+ applyClassChange = function() {
+ $.each( classAnimationActions, function(i, action) {
+ if ( value[ action ] ) {
+ animated[ action + "Class" ]( value[ action ] );
+ }
+ });
+ };
+ applyClassChange();
+
+ // map all animated objects again - calculate new styles and diff
+ allAnimations = allAnimations.map(function() {
+ this.end = getElementStyles.call( this.el[ 0 ] );
+ this.diff = styleDifference( this.start, this.end );
+ return this;
+ });
+
+ // apply original class
+ animated.attr( "class", baseClass );
+
+ // map all animated objects again - this time collecting a promise
+ allAnimations = allAnimations.map(function() {
+ var styleInfo = this,
+ dfd = $.Deferred(),
+ opts = jQuery.extend({}, o, {
+ queue: false,
+ complete: function() {
+ dfd.resolve( styleInfo );
+ }
+ });
+
+ this.el.animate( this.diff, opts );
+ return dfd.promise();
+ });
+
+ // once all animations have completed:
+ $.when.apply( $, allAnimations.get() ).done(function() {
+
+ // set the final class
+ applyClassChange();
+
+ // for each animated element,
+ // clear all css properties that were animated
+ $.each( arguments, function() {
+ var el = this.el;
+ $.each( this.diff, function(key) {
+ el.css( key, '' );
+ });
+ });
+
+ // this is guarnteed to be there if you use jQuery.speed()
+ // it also handles dequeuing the next anim...
+ o.complete.call( animated[ 0 ] );
+ });
+ });
+};
+
+$.fn.extend({
+ _addClass: $.fn.addClass,
+ addClass: function( classNames, speed, easing, callback ) {
+ return speed ?
+ $.effects.animateClass.call( this,
+ { add: classNames }, speed, easing, callback ) :
+ this._addClass( classNames );
+ },
+
+ _removeClass: $.fn.removeClass,
+ removeClass: function( classNames, speed, easing, callback ) {
+ return speed ?
+ $.effects.animateClass.call( this,
+ { remove: classNames }, speed, easing, callback ) :
+ this._removeClass( classNames );
+ },
+
+ _toggleClass: $.fn.toggleClass,
+ toggleClass: function( classNames, force, speed, easing, callback ) {
+ if ( typeof force === "boolean" || force === undefined ) {
+ if ( !speed ) {
+ // without speed parameter
+ return this._toggleClass( classNames, force );
+ } else {
+ return $.effects.animateClass.call( this,
+ (force ? { add: classNames } : { remove: classNames }),
+ speed, easing, callback );
+ }
+ } else {
+ // without force parameter
+ return $.effects.animateClass.call( this,
+ { toggle: classNames }, force, speed, easing );
+ }
+ },
+
+ switchClass: function( remove, add, speed, easing, callback) {
+ return $.effects.animateClass.call( this, {
+ add: add,
+ remove: remove
+ }, speed, easing, callback );
+ }
+});
+
+})();
+
+/******************************************************************************/
+/*********************************** EFFECTS **********************************/
+/******************************************************************************/
+
+(function() {
+
+$.extend( $.effects, {
+ version: "1.9.2",
+
+ // Saves a set of properties in a data storage
+ save: function( element, set ) {
+ for( var i=0; i < set.length; i++ ) {
+ if ( set[ i ] !== null ) {
+ element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
+ }
+ }
+ },
+
+ // Restores a set of previously saved properties from a data storage
+ restore: function( element, set ) {
+ var val, i;
+ for( i=0; i < set.length; i++ ) {
+ if ( set[ i ] !== null ) {
+ val = element.data( dataSpace + set[ i ] );
+ // support: jQuery 1.6.2
+ // http://bugs.jquery.com/ticket/9917
+ // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
+ // We can't differentiate between "" and 0 here, so we just assume
+ // empty string since it's likely to be a more common value...
+ if ( val === undefined ) {
+ val = "";
+ }
+ element.css( set[ i ], val );
+ }
+ }
+ },
+
+ setMode: function( el, mode ) {
+ if (mode === "toggle") {
+ mode = el.is( ":hidden" ) ? "show" : "hide";
+ }
+ return mode;
+ },
+
+ // Translates a [top,left] array into a baseline value
+ // this should be a little more flexible in the future to handle a string & hash
+ getBaseline: function( origin, original ) {
+ var y, x;
+ switch ( origin[ 0 ] ) {
+ case "top": y = 0; break;
+ case "middle": y = 0.5; break;
+ case "bottom": y = 1; break;
+ default: y = origin[ 0 ] / original.height;
+ }
+ switch ( origin[ 1 ] ) {
+ case "left": x = 0; break;
+ case "center": x = 0.5; break;
+ case "right": x = 1; break;
+ default: x = origin[ 1 ] / original.width;
+ }
+ return {
+ x: x,
+ y: y
+ };
+ },
+
+ // Wraps the element around a wrapper that copies position properties
+ createWrapper: function( element ) {
+
+ // if the element is already wrapped, return it
+ if ( element.parent().is( ".ui-effects-wrapper" )) {
+ return element.parent();
+ }
+
+ // wrap the element
+ var props = {
+ width: element.outerWidth(true),
+ height: element.outerHeight(true),
+ "float": element.css( "float" )
+ },
+ wrapper = $( "<div></div>" )
+ .addClass( "ui-effects-wrapper" )
+ .css({
+ fontSize: "100%",
+ background: "transparent",
+ border: "none",
+ margin: 0,
+ padding: 0
+ }),
+ // Store the size in case width/height are defined in % - Fixes #5245
+ size = {
+ width: element.width(),
+ height: element.height()
+ },
+ active = document.activeElement;
+
+ // support: Firefox
+ // Firefox incorrectly exposes anonymous content
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
+ try {
+ active.id;
+ } catch( e ) {
+ active = document.body;
+ }
+
+ element.wrap( wrapper );
+
+ // Fixes #7595 - Elements lose focus when wrapped.
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
+ $( active ).focus();
+ }
+
+ wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
+
+ // transfer positioning properties to the wrapper
+ if ( element.css( "position" ) === "static" ) {
+ wrapper.css({ position: "relative" });
+ element.css({ position: "relative" });
+ } else {
+ $.extend( props, {
+ position: element.css( "position" ),
+ zIndex: element.css( "z-index" )
+ });
+ $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
+ props[ pos ] = element.css( pos );
+ if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
+ props[ pos ] = "auto";
+ }
+ });
+ element.css({
+ position: "relative",
+ top: 0,
+ left: 0,
+ right: "auto",
+ bottom: "auto"
+ });
+ }
+ element.css(size);
+
+ return wrapper.css( props ).show();
+ },
+
+ removeWrapper: function( element ) {
+ var active = document.activeElement;
+
+ if ( element.parent().is( ".ui-effects-wrapper" ) ) {
+ element.parent().replaceWith( element );
+
+ // Fixes #7595 - Elements lose focus when wrapped.
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
+ $( active ).focus();
+ }
+ }
+
+
+ return element;
+ },
+
+ setTransition: function( element, list, factor, value ) {
+ value = value || {};
+ $.each( list, function( i, x ) {
+ var unit = element.cssUnit( x );
+ if ( unit[ 0 ] > 0 ) {
+ value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
+ }
+ });
+ return value;
+ }
+});
+
+// return an effect options object for the given parameters:
+function _normalizeArguments( effect, options, speed, callback ) {
+
+ // allow passing all options as the first parameter
+ if ( $.isPlainObject( effect ) ) {
+ options = effect;
+ effect = effect.effect;
+ }
+
+ // convert to an object
+ effect = { effect: effect };
+
+ // catch (effect, null, ...)
+ if ( options == null ) {
+ options = {};
+ }
+
+ // catch (effect, callback)
+ if ( $.isFunction( options ) ) {
+ callback = options;
+ speed = null;
+ options = {};
+ }
+
+ // catch (effect, speed, ?)
+ if ( typeof options === "number" || $.fx.speeds[ options ] ) {
+ callback = speed;
+ speed = options;
+ options = {};
+ }
+
+ // catch (effect, options, callback)
+ if ( $.isFunction( speed ) ) {
+ callback = speed;
+ speed = null;
+ }
+
+ // add options to effect
+ if ( options ) {
+ $.extend( effect, options );
+ }
+
+ speed = speed || options.duration;
+ effect.duration = $.fx.off ? 0 :
+ typeof speed === "number" ? speed :
+ speed in $.fx.speeds ? $.fx.speeds[ speed ] :
+ $.fx.speeds._default;
+
+ effect.complete = callback || options.complete;
+
+ return effect;
+}
+
+function standardSpeed( speed ) {
+ // valid standard speeds
+ if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
+ return true;
+ }
+
+ // invalid strings - treat as "normal" speed
+ if ( typeof speed === "string" && !$.effects.effect[ speed ] ) {
+ // TODO: remove in 2.0 (#7115)
+ if ( backCompat && $.effects[ speed ] ) {
+ return false;
+ }
+ return true;
+ }
+
+ return false;
+}
+
+$.fn.extend({
+ effect: function( /* effect, options, speed, callback */ ) {
+ var args = _normalizeArguments.apply( this, arguments ),
+ mode = args.mode,
+ queue = args.queue,
+ effectMethod = $.effects.effect[ args.effect ],
+
+ // DEPRECATED: remove in 2.0 (#7115)
+ oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ];
+
+ if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) {
+ // delegate to the original method (e.g., .show()) if possible
+ if ( mode ) {
+ return this[ mode ]( args.duration, args.complete );
+ } else {
+ return this.each( function() {
+ if ( args.complete ) {
+ args.complete.call( this );
+ }
+ });
+ }
+ }
+
+ function run( next ) {
+ var elem = $( this ),
+ complete = args.complete,
+ mode = args.mode;
+
+ function done() {
+ if ( $.isFunction( complete ) ) {
+ complete.call( elem[0] );
+ }
+ if ( $.isFunction( next ) ) {
+ next();
+ }
+ }
+
+ // if the element is hiddden and mode is hide,
+ // or element is visible and mode is show
+ if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
+ done();
+ } else {
+ effectMethod.call( elem[0], args, done );
+ }
+ }
+
+ // TODO: remove this check in 2.0, effectMethod will always be true
+ if ( effectMethod ) {
+ return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
+ } else {
+ // DEPRECATED: remove in 2.0 (#7115)
+ return oldEffectMethod.call(this, {
+ options: args,
+ duration: args.duration,
+ callback: args.complete,
+ mode: args.mode
+ });
+ }
+ },
+
+ _show: $.fn.show,
+ show: function( speed ) {
+ if ( standardSpeed( speed ) ) {
+ return this._show.apply( this, arguments );
+ } else {
+ var args = _normalizeArguments.apply( this, arguments );
+ args.mode = "show";
+ return this.effect.call( this, args );
+ }
+ },
+
+ _hide: $.fn.hide,
+ hide: function( speed ) {
+ if ( standardSpeed( speed ) ) {
+ return this._hide.apply( this, arguments );
+ } else {
+ var args = _normalizeArguments.apply( this, arguments );
+ args.mode = "hide";
+ return this.effect.call( this, args );
+ }
+ },
+
+ // jQuery core overloads toggle and creates _toggle
+ __toggle: $.fn.toggle,
+ toggle: function( speed ) {
+ if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
+ return this.__toggle.apply( this, arguments );
+ } else {
+ var args = _normalizeArguments.apply( this, arguments );
+ args.mode = "toggle";
+ return this.effect.call( this, args );
+ }
+ },
+
+ // helper functions
+ cssUnit: function(key) {
+ var style = this.css( key ),
+ val = [];
+
+ $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
+ if ( style.indexOf( unit ) > 0 ) {
+ val = [ parseFloat( style ), unit ];
+ }
+ });
+ return val;
+ }
+});
+
+})();
+
+/******************************************************************************/
+/*********************************** EASING ***********************************/
+/******************************************************************************/
+
+(function() {
+
+// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
+
+var baseEasings = {};
+
+$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
+ baseEasings[ name ] = function( p ) {
+ return Math.pow( p, i + 2 );
+ };
+});
+
+$.extend( baseEasings, {
+ Sine: function ( p ) {
+ return 1 - Math.cos( p * Math.PI / 2 );
+ },
+ Circ: function ( p ) {
+ return 1 - Math.sqrt( 1 - p * p );
+ },
+ Elastic: function( p ) {
+ return p === 0 || p === 1 ? p :
+ -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
+ },
+ Back: function( p ) {
+ return p * p * ( 3 * p - 2 );
+ },
+ Bounce: function ( p ) {
+ var pow2,
+ bounce = 4;
+
+ while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
+ return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
+ }
+});
+
+$.each( baseEasings, function( name, easeIn ) {
+ $.easing[ "easeIn" + name ] = easeIn;
+ $.easing[ "easeOut" + name ] = function( p ) {
+ return 1 - easeIn( 1 - p );
+ };
+ $.easing[ "easeInOut" + name ] = function( p ) {
+ return p < 0.5 ?
+ easeIn( p * 2 ) / 2 :
+ 1 - easeIn( p * -2 + 2 ) / 2;
+ };
+});
+
+})();
+
+})(jQuery));
+(function( $, undefined ) {
+
+var rvertical = /up|down|vertical/,
+ rpositivemotion = /up|left|vertical|horizontal/;
+
+$.effects.effect.blind = function( o, done ) {
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ direction = o.direction || "up",
+ vertical = rvertical.test( direction ),
+ ref = vertical ? "height" : "width",
+ ref2 = vertical ? "top" : "left",
+ motion = rpositivemotion.test( direction ),
+ animation = {},
+ show = mode === "show",
+ wrapper, distance, margin;
+
+ // if already wrapped, the wrapper's properties are my property. #6245
+ if ( el.parent().is( ".ui-effects-wrapper" ) ) {
+ $.effects.save( el.parent(), props );
+ } else {
+ $.effects.save( el, props );
+ }
+ el.show();
+ wrapper = $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+
+ distance = wrapper[ ref ]();
+ margin = parseFloat( wrapper.css( ref2 ) ) || 0;
+
+ animation[ ref ] = show ? distance : 0;
+ if ( !motion ) {
+ el
+ .css( vertical ? "bottom" : "right", 0 )
+ .css( vertical ? "top" : "left", "auto" )
+ .css({ position: "absolute" });
+
+ animation[ ref2 ] = show ? margin : distance + margin;
+ }
+
+ // start at 0 if we are showing
+ if ( show ) {
+ wrapper.css( ref, 0 );
+ if ( ! motion ) {
+ wrapper.css( ref2, margin + distance );
+ }
+ }
+
+ // Animate
+ wrapper.animate( animation, {
+ duration: o.duration,
+ easing: o.easing,
+ queue: false,
+ complete: function() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.bounce = function( o, done ) {
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+
+ // defaults:
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ hide = mode === "hide",
+ show = mode === "show",
+ direction = o.direction || "up",
+ distance = o.distance,
+ times = o.times || 5,
+
+ // number of internal animations
+ anims = times * 2 + ( show || hide ? 1 : 0 ),
+ speed = o.duration / anims,
+ easing = o.easing,
+
+ // utility:
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
+ motion = ( direction === "up" || direction === "left" ),
+ i,
+ upAnim,
+ downAnim,
+
+ // we will need to re-assemble the queue to stack our animations in place
+ queue = el.queue(),
+ queuelen = queue.length;
+
+ // Avoid touching opacity to prevent clearType and PNG issues in IE
+ if ( show || hide ) {
+ props.push( "opacity" );
+ }
+
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el ); // Create Wrapper
+
+ // default distance for the BIGGEST bounce is the outer Distance / 3
+ if ( !distance ) {
+ distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
+ }
+
+ if ( show ) {
+ downAnim = { opacity: 1 };
+ downAnim[ ref ] = 0;
+
+ // if we are showing, force opacity 0 and set the initial position
+ // then do the "first" animation
+ el.css( "opacity", 0 )
+ .css( ref, motion ? -distance * 2 : distance * 2 )
+ .animate( downAnim, speed, easing );
+ }
+
+ // start at the smallest distance if we are hiding
+ if ( hide ) {
+ distance = distance / Math.pow( 2, times - 1 );
+ }
+
+ downAnim = {};
+ downAnim[ ref ] = 0;
+ // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
+ for ( i = 0; i < times; i++ ) {
+ upAnim = {};
+ upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
+
+ el.animate( upAnim, speed, easing )
+ .animate( downAnim, speed, easing );
+
+ distance = hide ? distance * 2 : distance / 2;
+ }
+
+ // Last Bounce when Hiding
+ if ( hide ) {
+ upAnim = { opacity: 0 };
+ upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
+
+ el.animate( upAnim, speed, easing );
+ }
+
+ el.queue(function() {
+ if ( hide ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ });
+
+ // inject all the animations we just queued to be first in line (after "inprogress")
+ if ( queuelen > 1) {
+ queue.splice.apply( queue,
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ }
+ el.dequeue();
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.clip = function( o, done ) {
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+ direction = o.direction || "vertical",
+ vert = direction === "vertical",
+ size = vert ? "height" : "width",
+ position = vert ? "top" : "left",
+ animation = {},
+ wrapper, animate, distance;
+
+ // Save & Show
+ $.effects.save( el, props );
+ el.show();
+
+ // Create Wrapper
+ wrapper = $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+ animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
+ distance = animate[ size ]();
+
+ // Shift
+ if ( show ) {
+ animate.css( size, 0 );
+ animate.css( position, distance / 2 );
+ }
+
+ // Create Animation Object:
+ animation[ size ] = show ? distance : 0;
+ animation[ position ] = show ? 0 : distance / 2;
+
+ // Animate
+ animate.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( !show ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.drop = function( o, done ) {
+
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+ direction = o.direction || "left",
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
+ motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
+ animation = {
+ opacity: show ? 1 : 0
+ },
+ distance;
+
+ // Adjust
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el );
+
+ distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2;
+
+ if ( show ) {
+ el
+ .css( "opacity", 0 )
+ .css( ref, motion === "pos" ? -distance : distance );
+ }
+
+ // Animation
+ animation[ ref ] = ( show ?
+ ( motion === "pos" ? "+=" : "-=" ) :
+ ( motion === "pos" ? "-=" : "+=" ) ) +
+ distance;
+
+ // Animate
+ el.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.explode = function( o, done ) {
+
+ var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
+ cells = rows,
+ el = $( this ),
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+
+ // show and then visibility:hidden the element before calculating offset
+ offset = el.show().css( "visibility", "hidden" ).offset(),
+
+ // width and height of a piece
+ width = Math.ceil( el.outerWidth() / cells ),
+ height = Math.ceil( el.outerHeight() / rows ),
+ pieces = [],
+
+ // loop
+ i, j, left, top, mx, my;
+
+ // children animate complete:
+ function childComplete() {
+ pieces.push( this );
+ if ( pieces.length === rows * cells ) {
+ animComplete();
+ }
+ }
+
+ // clone the element for each row and cell.
+ for( i = 0; i < rows ; i++ ) { // ===>
+ top = offset.top + i * height;
+ my = i - ( rows - 1 ) / 2 ;
+
+ for( j = 0; j < cells ; j++ ) { // |||
+ left = offset.left + j * width;
+ mx = j - ( cells - 1 ) / 2 ;
+
+ // Create a clone of the now hidden main element that will be absolute positioned
+ // within a wrapper div off the -left and -top equal to size of our pieces
+ el
+ .clone()
+ .appendTo( "body" )
+ .wrap( "<div></div>" )
+ .css({
+ position: "absolute",
+ visibility: "visible",
+ left: -j * width,
+ top: -i * height
+ })
+
+ // select the wrapper - make it overflow: hidden and absolute positioned based on
+ // where the original was located +left and +top equal to the size of pieces
+ .parent()
+ .addClass( "ui-effects-explode" )
+ .css({
+ position: "absolute",
+ overflow: "hidden",
+ width: width,
+ height: height,
+ left: left + ( show ? mx * width : 0 ),
+ top: top + ( show ? my * height : 0 ),
+ opacity: show ? 0 : 1
+ }).animate({
+ left: left + ( show ? 0 : mx * width ),
+ top: top + ( show ? 0 : my * height ),
+ opacity: show ? 1 : 0
+ }, o.duration || 500, o.easing, childComplete );
+ }
+ }
+
+ function animComplete() {
+ el.css({
+ visibility: "visible"
+ });
+ $( pieces ).remove();
+ if ( !show ) {
+ el.hide();
+ }
+ done();
+ }
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.fade = function( o, done ) {
+ var el = $( this ),
+ mode = $.effects.setMode( el, o.mode || "toggle" );
+
+ el.animate({
+ opacity: mode
+ }, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: done
+ });
+};
+
+})( jQuery );
+(function( $, undefined ) {
+
+$.effects.effect.fold = function( o, done ) {
+
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+ hide = mode === "hide",
+ size = o.size || 15,
+ percent = /([0-9]+)%/.exec( size ),
+ horizFirst = !!o.horizFirst,
+ widthFirst = show !== horizFirst,
+ ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
+ duration = o.duration / 2,
+ wrapper, distance,
+ animation1 = {},
+ animation2 = {};
+
+ $.effects.save( el, props );
+ el.show();
+
+ // Create Wrapper
+ wrapper = $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+ distance = widthFirst ?
+ [ wrapper.width(), wrapper.height() ] :
+ [ wrapper.height(), wrapper.width() ];
+
+ if ( percent ) {
+ size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
+ }
+ if ( show ) {
+ wrapper.css( horizFirst ? {
+ height: 0,
+ width: size
+ } : {
+ height: size,
+ width: 0
+ });
+ }
+
+ // Animation
+ animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
+ animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
+
+ // Animate
+ wrapper
+ .animate( animation1, duration, o.easing )
+ .animate( animation2, duration, o.easing, function() {
+ if ( hide ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ });
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.highlight = function( o, done ) {
+ var elem = $( this ),
+ props = [ "backgroundImage", "backgroundColor", "opacity" ],
+ mode = $.effects.setMode( elem, o.mode || "show" ),
+ animation = {
+ backgroundColor: elem.css( "backgroundColor" )
+ };
+
+ if (mode === "hide") {
+ animation.opacity = 0;
+ }
+
+ $.effects.save( elem, props );
+
+ elem
+ .show()
+ .css({
+ backgroundImage: "none",
+ backgroundColor: o.color || "#ffff99"
+ })
+ .animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( mode === "hide" ) {
+ elem.hide();
+ }
+ $.effects.restore( elem, props );
+ done();
+ }
+ });
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.pulsate = function( o, done ) {
+ var elem = $( this ),
+ mode = $.effects.setMode( elem, o.mode || "show" ),
+ show = mode === "show",
+ hide = mode === "hide",
+ showhide = ( show || mode === "hide" ),
+
+ // showing or hiding leaves of the "last" animation
+ anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
+ duration = o.duration / anims,
+ animateTo = 0,
+ queue = elem.queue(),
+ queuelen = queue.length,
+ i;
+
+ if ( show || !elem.is(":visible")) {
+ elem.css( "opacity", 0 ).show();
+ animateTo = 1;
+ }
+
+ // anims - 1 opacity "toggles"
+ for ( i = 1; i < anims; i++ ) {
+ elem.animate({
+ opacity: animateTo
+ }, duration, o.easing );
+ animateTo = 1 - animateTo;
+ }
+
+ elem.animate({
+ opacity: animateTo
+ }, duration, o.easing);
+
+ elem.queue(function() {
+ if ( hide ) {
+ elem.hide();
+ }
+ done();
+ });
+
+ // We just queued up "anims" animations, we need to put them next in the queue
+ if ( queuelen > 1 ) {
+ queue.splice.apply( queue,
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ }
+ elem.dequeue();
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.puff = function( o, done ) {
+ var elem = $( this ),
+ mode = $.effects.setMode( elem, o.mode || "hide" ),
+ hide = mode === "hide",
+ percent = parseInt( o.percent, 10 ) || 150,
+ factor = percent / 100,
+ original = {
+ height: elem.height(),
+ width: elem.width(),
+ outerHeight: elem.outerHeight(),
+ outerWidth: elem.outerWidth()
+ };
+
+ $.extend( o, {
+ effect: "scale",
+ queue: false,
+ fade: true,
+ mode: mode,
+ complete: done,
+ percent: hide ? percent : 100,
+ from: hide ?
+ original :
+ {
+ height: original.height * factor,
+ width: original.width * factor,
+ outerHeight: original.outerHeight * factor,
+ outerWidth: original.outerWidth * factor
+ }
+ });
+
+ elem.effect( o );
+};
+
+$.effects.effect.scale = function( o, done ) {
+
+ // Create element
+ var el = $( this ),
+ options = $.extend( true, {}, o ),
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ percent = parseInt( o.percent, 10 ) ||
+ ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
+ direction = o.direction || "both",
+ origin = o.origin,
+ original = {
+ height: el.height(),
+ width: el.width(),
+ outerHeight: el.outerHeight(),
+ outerWidth: el.outerWidth()
+ },
+ factor = {
+ y: direction !== "horizontal" ? (percent / 100) : 1,
+ x: direction !== "vertical" ? (percent / 100) : 1
+ };
+
+ // We are going to pass this effect to the size effect:
+ options.effect = "size";
+ options.queue = false;
+ options.complete = done;
+
+ // Set default origin and restore for show/hide
+ if ( mode !== "effect" ) {
+ options.origin = origin || ["middle","center"];
+ options.restore = true;
+ }
+
+ options.from = o.from || ( mode === "show" ? {
+ height: 0,
+ width: 0,
+ outerHeight: 0,
+ outerWidth: 0
+ } : original );
+ options.to = {
+ height: original.height * factor.y,
+ width: original.width * factor.x,
+ outerHeight: original.outerHeight * factor.y,
+ outerWidth: original.outerWidth * factor.x
+ };
+
+ // Fade option to support puff
+ if ( options.fade ) {
+ if ( mode === "show" ) {
+ options.from.opacity = 0;
+ options.to.opacity = 1;
+ }
+ if ( mode === "hide" ) {
+ options.from.opacity = 1;
+ options.to.opacity = 0;
+ }
+ }
+
+ // Animate
+ el.effect( options );
+
+};
+
+$.effects.effect.size = function( o, done ) {
+
+ // Create element
+ var original, baseline, factor,
+ el = $( this ),
+ props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
+
+ // Always restore
+ props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
+
+ // Copy for children
+ props2 = [ "width", "height", "overflow" ],
+ cProps = [ "fontSize" ],
+ vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
+ hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
+
+ // Set options
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ restore = o.restore || mode !== "effect",
+ scale = o.scale || "both",
+ origin = o.origin || [ "middle", "center" ],
+ position = el.css( "position" ),
+ props = restore ? props0 : props1,
+ zero = {
+ height: 0,
+ width: 0,
+ outerHeight: 0,
+ outerWidth: 0
+ };
+
+ if ( mode === "show" ) {
+ el.show();
+ }
+ original = {
+ height: el.height(),
+ width: el.width(),
+ outerHeight: el.outerHeight(),
+ outerWidth: el.outerWidth()
+ };
+
+ if ( o.mode === "toggle" && mode === "show" ) {
+ el.from = o.to || zero;
+ el.to = o.from || original;
+ } else {
+ el.from = o.from || ( mode === "show" ? zero : original );
+ el.to = o.to || ( mode === "hide" ? zero : original );
+ }
+
+ // Set scaling factor
+ factor = {
+ from: {
+ y: el.from.height / original.height,
+ x: el.from.width / original.width
+ },
+ to: {
+ y: el.to.height / original.height,
+ x: el.to.width / original.width
+ }
+ };
+
+ // Scale the css box
+ if ( scale === "box" || scale === "both" ) {
+
+ // Vertical props scaling
+ if ( factor.from.y !== factor.to.y ) {
+ props = props.concat( vProps );
+ el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
+ el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
+ }
+
+ // Horizontal props scaling
+ if ( factor.from.x !== factor.to.x ) {
+ props = props.concat( hProps );
+ el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
+ el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
+ }
+ }
+
+ // Scale the content
+ if ( scale === "content" || scale === "both" ) {
+
+ // Vertical props scaling
+ if ( factor.from.y !== factor.to.y ) {
+ props = props.concat( cProps ).concat( props2 );
+ el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
+ el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
+ }
+ }
+
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el );
+ el.css( "overflow", "hidden" ).css( el.from );
+
+ // Adjust
+ if (origin) { // Calculate baseline shifts
+ baseline = $.effects.getBaseline( origin, original );
+ el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
+ el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
+ el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
+ el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
+ }
+ el.css( el.from ); // set top & left
+
+ // Animate
+ if ( scale === "content" || scale === "both" ) { // Scale the children
+
+ // Add margins/font-size
+ vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
+ hProps = hProps.concat([ "marginLeft", "marginRight" ]);
+ props2 = props0.concat(vProps).concat(hProps);
+
+ el.find( "*[width]" ).each( function(){
+ var child = $( this ),
+ c_original = {
+ height: child.height(),
+ width: child.width(),
+ outerHeight: child.outerHeight(),
+ outerWidth: child.outerWidth()
+ };
+ if (restore) {
+ $.effects.save(child, props2);
+ }
+
+ child.from = {
+ height: c_original.height * factor.from.y,
+ width: c_original.width * factor.from.x,
+ outerHeight: c_original.outerHeight * factor.from.y,
+ outerWidth: c_original.outerWidth * factor.from.x
+ };
+ child.to = {
+ height: c_original.height * factor.to.y,
+ width: c_original.width * factor.to.x,
+ outerHeight: c_original.height * factor.to.y,
+ outerWidth: c_original.width * factor.to.x
+ };
+
+ // Vertical props scaling
+ if ( factor.from.y !== factor.to.y ) {
+ child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
+ child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
+ }
+
+ // Horizontal props scaling
+ if ( factor.from.x !== factor.to.x ) {
+ child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
+ child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
+ }
+
+ // Animate children
+ child.css( child.from );
+ child.animate( child.to, o.duration, o.easing, function() {
+
+ // Restore children
+ if ( restore ) {
+ $.effects.restore( child, props2 );
+ }
+ });
+ });
+ }
+
+ // Animate
+ el.animate( el.to, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( el.to.opacity === 0 ) {
+ el.css( "opacity", el.from.opacity );
+ }
+ if( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ if ( !restore ) {
+
+ // we need to calculate our new positioning based on the scaling
+ if ( position === "static" ) {
+ el.css({
+ position: "relative",
+ top: el.to.top,
+ left: el.to.left
+ });
+ } else {
+ $.each([ "top", "left" ], function( idx, pos ) {
+ el.css( pos, function( _, str ) {
+ var val = parseInt( str, 10 ),
+ toRef = idx ? el.to.left : el.to.top;
+
+ // if original was "auto", recalculate the new value from wrapper
+ if ( str === "auto" ) {
+ return toRef + "px";
+ }
+
+ return val + toRef + "px";
+ });
+ });
+ }
+ }
+
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.shake = function( o, done ) {
+
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ direction = o.direction || "left",
+ distance = o.distance || 20,
+ times = o.times || 3,
+ anims = times * 2 + 1,
+ speed = Math.round(o.duration/anims),
+ ref = (direction === "up" || direction === "down") ? "top" : "left",
+ positiveMotion = (direction === "up" || direction === "left"),
+ animation = {},
+ animation1 = {},
+ animation2 = {},
+ i,
+
+ // we will need to re-assemble the queue to stack our animations in place
+ queue = el.queue(),
+ queuelen = queue.length;
+
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el );
+
+ // Animation
+ animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
+ animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
+ animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
+
+ // Animate
+ el.animate( animation, speed, o.easing );
+
+ // Shakes
+ for ( i = 1; i < times; i++ ) {
+ el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
+ }
+ el
+ .animate( animation1, speed, o.easing )
+ .animate( animation, speed / 2, o.easing )
+ .queue(function() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ });
+
+ // inject all the animations we just queued to be first in line (after "inprogress")
+ if ( queuelen > 1) {
+ queue.splice.apply( queue,
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ }
+ el.dequeue();
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.slide = function( o, done ) {
+
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
+ mode = $.effects.setMode( el, o.mode || "show" ),
+ show = mode === "show",
+ direction = o.direction || "left",
+ ref = (direction === "up" || direction === "down") ? "top" : "left",
+ positiveMotion = (direction === "up" || direction === "left"),
+ distance,
+ animation = {};
+
+ // Adjust
+ $.effects.save( el, props );
+ el.show();
+ distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
+
+ $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+
+ if ( show ) {
+ el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
+ }
+
+ // Animation
+ animation[ ref ] = ( show ?
+ ( positiveMotion ? "+=" : "-=") :
+ ( positiveMotion ? "-=" : "+=")) +
+ distance;
+
+ // Animate
+ el.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.transfer = function( o, done ) {
+ var elem = $( this ),
+ target = $( o.to ),
+ targetFixed = target.css( "position" ) === "fixed",
+ body = $("body"),
+ fixTop = targetFixed ? body.scrollTop() : 0,
+ fixLeft = targetFixed ? body.scrollLeft() : 0,
+ endPosition = target.offset(),
+ animation = {
+ top: endPosition.top - fixTop ,
+ left: endPosition.left - fixLeft ,
+ height: target.innerHeight(),
+ width: target.innerWidth()
+ },
+ startPosition = elem.offset(),
+ transfer = $( '<div class="ui-effects-transfer"></div>' )
+ .appendTo( document.body )
+ .addClass( o.className )
+ .css({
+ top: startPosition.top - fixTop ,
+ left: startPosition.left - fixLeft ,
+ height: elem.innerHeight(),
+ width: elem.innerWidth(),
+ position: targetFixed ? "fixed" : "absolute"
+ })
+ .animate( animation, o.duration, o.easing, function() {
+ transfer.remove();
+ done();
+ });
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+var mouseHandled = false;
+
+$.widget( "ui.menu", {
+ version: "1.9.2",
+ defaultElement: "<ul>",
+ delay: 300,
+ options: {
+ icons: {
+ submenu: "ui-icon-carat-1-e"
+ },
+ menus: "ul",
+ position: {
+ my: "left top",
+ at: "right top"
+ },
+ role: "menu",
+
+ // callbacks
+ blur: null,
+ focus: null,
+ select: null
+ },
+
+ _create: function() {
+ this.activeMenu = this.element;
+ this.element
+ .uniqueId()
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+ .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
+ .attr({
+ role: this.options.role,
+ tabIndex: 0
+ })
+ // need to catch all clicks on disabled menu
+ // not possible through _on
+ .bind( "click" + this.eventNamespace, $.proxy(function( event ) {
+ if ( this.options.disabled ) {
+ event.preventDefault();
+ }
+ }, this ));
+
+ if ( this.options.disabled ) {
+ this.element
+ .addClass( "ui-state-disabled" )
+ .attr( "aria-disabled", "true" );
+ }
+
+ this._on({
+ // Prevent focus from sticking to links inside menu after clicking
+ // them (focus should always stay on UL during navigation).
+ "mousedown .ui-menu-item > a": function( event ) {
+ event.preventDefault();
+ },
+ "click .ui-state-disabled > a": function( event ) {
+ event.preventDefault();
+ },
+ "click .ui-menu-item:has(a)": function( event ) {
+ var target = $( event.target ).closest( ".ui-menu-item" );
+ if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) {
+ mouseHandled = true;
+
+ this.select( event );
+ // Open submenu on click
+ if ( target.has( ".ui-menu" ).length ) {
+ this.expand( event );
+ } else if ( !this.element.is( ":focus" ) ) {
+ // Redirect focus to the menu
+ this.element.trigger( "focus", [ true ] );
+
+ // If the active item is on the top level, let it stay active.
+ // Otherwise, blur the active item since it is no longer visible.
+ if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
+ clearTimeout( this.timer );
+ }
+ }
+ }
+ },
+ "mouseenter .ui-menu-item": function( event ) {
+ var target = $( event.currentTarget );
+ // Remove ui-state-active class from siblings of the newly focused menu item
+ // to avoid a jump caused by adjacent elements both having a class with a border
+ target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
+ this.focus( event, target );
+ },
+ mouseleave: "collapseAll",
+ "mouseleave .ui-menu": "collapseAll",
+ focus: function( event, keepActiveItem ) {
+ // If there's already an active item, keep it active
+ // If not, activate the first item
+ var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 );
+
+ if ( !keepActiveItem ) {
+ this.focus( event, item );
+ }
+ },
+ blur: function( event ) {
+ this._delay(function() {
+ if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
+ this.collapseAll( event );
+ }
+ });
+ },
+ keydown: "_keydown"
+ });
+
+ this.refresh();
+
+ // Clicks outside of a menu collapse any open menus
+ this._on( this.document, {
+ click: function( event ) {
+ if ( !$( event.target ).closest( ".ui-menu" ).length ) {
+ this.collapseAll( event );
+ }
+
+ // Reset the mouseHandled flag
+ mouseHandled = false;
+ }
+ });
+ },
+
+ _destroy: function() {
+ // Destroy (sub)menus
+ this.element
+ .removeAttr( "aria-activedescendant" )
+ .find( ".ui-menu" ).andSelf()
+ .removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
+ .removeAttr( "role" )
+ .removeAttr( "tabIndex" )
+ .removeAttr( "aria-labelledby" )
+ .removeAttr( "aria-expanded" )
+ .removeAttr( "aria-hidden" )
+ .removeAttr( "aria-disabled" )
+ .removeUniqueId()
+ .show();
+
+ // Destroy menu items
+ this.element.find( ".ui-menu-item" )
+ .removeClass( "ui-menu-item" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-disabled" )
+ .children( "a" )
+ .removeUniqueId()
+ .removeClass( "ui-corner-all ui-state-hover" )
+ .removeAttr( "tabIndex" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-haspopup" )
+ .children().each( function() {
+ var elem = $( this );
+ if ( elem.data( "ui-menu-submenu-carat" ) ) {
+ elem.remove();
+ }
+ });
+
+ // Destroy menu dividers
+ this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
+ },
+
+ _keydown: function( event ) {
+ var match, prev, character, skip, regex,
+ preventDefault = true;
+
+ function escape( value ) {
+ return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
+ }
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.PAGE_UP:
+ this.previousPage( event );
+ break;
+ case $.ui.keyCode.PAGE_DOWN:
+ this.nextPage( event );
+ break;
+ case $.ui.keyCode.HOME:
+ this._move( "first", "first", event );
+ break;
+ case $.ui.keyCode.END:
+ this._move( "last", "last", event );
+ break;
+ case $.ui.keyCode.UP:
+ this.previous( event );
+ break;
+ case $.ui.keyCode.DOWN:
+ this.next( event );
+ break;
+ case $.ui.keyCode.LEFT:
+ this.collapse( event );
+ break;
+ case $.ui.keyCode.RIGHT:
+ if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
+ this.expand( event );
+ }
+ break;
+ case $.ui.keyCode.ENTER:
+ case $.ui.keyCode.SPACE:
+ this._activate( event );
+ break;
+ case $.ui.keyCode.ESCAPE:
+ this.collapse( event );
+ break;
+ default:
+ preventDefault = false;
+ prev = this.previousFilter || "";
+ character = String.fromCharCode( event.keyCode );
+ skip = false;
+
+ clearTimeout( this.filterTimer );
+
+ if ( character === prev ) {
+ skip = true;
+ } else {
+ character = prev + character;
+ }
+
+ regex = new RegExp( "^" + escape( character ), "i" );
+ match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
+ return regex.test( $( this ).children( "a" ).text() );
+ });
+ match = skip && match.index( this.active.next() ) !== -1 ?
+ this.active.nextAll( ".ui-menu-item" ) :
+ match;
+
+ // If no matches on the current filter, reset to the last character pressed
+ // to move down the menu to the first item that starts with that character
+ if ( !match.length ) {
+ character = String.fromCharCode( event.keyCode );
+ regex = new RegExp( "^" + escape( character ), "i" );
+ match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
+ return regex.test( $( this ).children( "a" ).text() );
+ });
+ }
+
+ if ( match.length ) {
+ this.focus( event, match );
+ if ( match.length > 1 ) {
+ this.previousFilter = character;
+ this.filterTimer = this._delay(function() {
+ delete this.previousFilter;
+ }, 1000 );
+ } else {
+ delete this.previousFilter;
+ }
+ } else {
+ delete this.previousFilter;
+ }
+ }
+
+ if ( preventDefault ) {
+ event.preventDefault();
+ }
+ },
+
+ _activate: function( event ) {
+ if ( !this.active.is( ".ui-state-disabled" ) ) {
+ if ( this.active.children( "a[aria-haspopup='true']" ).length ) {
+ this.expand( event );
+ } else {
+ this.select( event );
+ }
+ }
+ },
+
+ refresh: function() {
+ var menus,
+ icon = this.options.icons.submenu,
+ submenus = this.element.find( this.options.menus );
+
+ // Initialize nested menus
+ submenus.filter( ":not(.ui-menu)" )
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+ .hide()
+ .attr({
+ role: this.options.role,
+ "aria-hidden": "true",
+ "aria-expanded": "false"
+ })
+ .each(function() {
+ var menu = $( this ),
+ item = menu.prev( "a" ),
+ submenuCarat = $( "<span>" )
+ .addClass( "ui-menu-icon ui-icon " + icon )
+ .data( "ui-menu-submenu-carat", true );
+
+ item
+ .attr( "aria-haspopup", "true" )
+ .prepend( submenuCarat );
+ menu.attr( "aria-labelledby", item.attr( "id" ) );
+ });
+
+ menus = submenus.add( this.element );
+
+ // Don't refresh list items that are already adapted
+ menus.children( ":not(.ui-menu-item):has(a)" )
+ .addClass( "ui-menu-item" )
+ .attr( "role", "presentation" )
+ .children( "a" )
+ .uniqueId()
+ .addClass( "ui-corner-all" )
+ .attr({
+ tabIndex: -1,
+ role: this._itemRole()
+ });
+
+ // Initialize unlinked menu-items containing spaces and/or dashes only as dividers
+ menus.children( ":not(.ui-menu-item)" ).each(function() {
+ var item = $( this );
+ // hyphen, em dash, en dash
+ if ( !/[^\-—–\s]/.test( item.text() ) ) {
+ item.addClass( "ui-widget-content ui-menu-divider" );
+ }
+ });
+
+ // Add aria-disabled attribute to any disabled menu item
+ menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
+
+ // If the active item has been removed, blur the menu
+ if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
+ this.blur();
+ }
+ },
+
+ _itemRole: function() {
+ return {
+ menu: "menuitem",
+ listbox: "option"
+ }[ this.options.role ];
+ },
+
+ focus: function( event, item ) {
+ var nested, focused;
+ this.blur( event, event && event.type === "focus" );
+
+ this._scrollIntoView( item );
+
+ this.active = item.first();
+ focused = this.active.children( "a" ).addClass( "ui-state-focus" );
+ // Only update aria-activedescendant if there's a role
+ // otherwise we assume focus is managed elsewhere
+ if ( this.options.role ) {
+ this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
+ }
+
+ // Highlight active parent menu item, if any
+ this.active
+ .parent()
+ .closest( ".ui-menu-item" )
+ .children( "a:first" )
+ .addClass( "ui-state-active" );
+
+ if ( event && event.type === "keydown" ) {
+ this._close();
+ } else {
+ this.timer = this._delay(function() {
+ this._close();
+ }, this.delay );
+ }
+
+ nested = item.children( ".ui-menu" );
+ if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
+ this._startOpening(nested);
+ }
+ this.activeMenu = item.parent();
+
+ this._trigger( "focus", event, { item: item } );
+ },
+
+ _scrollIntoView: function( item ) {
+ var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
+ if ( this._hasScroll() ) {
+ borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
+ paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
+ offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
+ scroll = this.activeMenu.scrollTop();
+ elementHeight = this.activeMenu.height();
+ itemHeight = item.height();
+
+ if ( offset < 0 ) {
+ this.activeMenu.scrollTop( scroll + offset );
+ } else if ( offset + itemHeight > elementHeight ) {
+ this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
+ }
+ }
+ },
+
+ blur: function( event, fromFocus ) {
+ if ( !fromFocus ) {
+ clearTimeout( this.timer );
+ }
+
+ if ( !this.active ) {
+ return;
+ }
+
+ this.active.children( "a" ).removeClass( "ui-state-focus" );
+ this.active = null;
+
+ this._trigger( "blur", event, { item: this.active } );
+ },
+
+ _startOpening: function( submenu ) {
+ clearTimeout( this.timer );
+
+ // Don't open if already open fixes a Firefox bug that caused a .5 pixel
+ // shift in the submenu position when mousing over the carat icon
+ if ( submenu.attr( "aria-hidden" ) !== "true" ) {
+ return;
+ }
+
+ this.timer = this._delay(function() {
+ this._close();
+ this._open( submenu );
+ }, this.delay );
+ },
+
+ _open: function( submenu ) {
+ var position = $.extend({
+ of: this.active
+ }, this.options.position );
+
+ clearTimeout( this.timer );
+ this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
+ .hide()
+ .attr( "aria-hidden", "true" );
+
+ submenu
+ .show()
+ .removeAttr( "aria-hidden" )
+ .attr( "aria-expanded", "true" )
+ .position( position );
+ },
+
+ collapseAll: function( event, all ) {
+ clearTimeout( this.timer );
+ this.timer = this._delay(function() {
+ // If we were passed an event, look for the submenu that contains the event
+ var currentMenu = all ? this.element :
+ $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
+
+ // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
+ if ( !currentMenu.length ) {
+ currentMenu = this.element;
+ }
+
+ this._close( currentMenu );
+
+ this.blur( event );
+ this.activeMenu = currentMenu;
+ }, this.delay );
+ },
+
+ // With no arguments, closes the currently active menu - if nothing is active
+ // it closes all menus. If passed an argument, it will search for menus BELOW
+ _close: function( startMenu ) {
+ if ( !startMenu ) {
+ startMenu = this.active ? this.active.parent() : this.element;
+ }
+
+ startMenu
+ .find( ".ui-menu" )
+ .hide()
+ .attr( "aria-hidden", "true" )
+ .attr( "aria-expanded", "false" )
+ .end()
+ .find( "a.ui-state-active" )
+ .removeClass( "ui-state-active" );
+ },
+
+ collapse: function( event ) {
+ var newItem = this.active &&
+ this.active.parent().closest( ".ui-menu-item", this.element );
+ if ( newItem && newItem.length ) {
+ this._close();
+ this.focus( event, newItem );
+ }
+ },
+
+ expand: function( event ) {
+ var newItem = this.active &&
+ this.active
+ .children( ".ui-menu " )
+ .children( ".ui-menu-item" )
+ .first();
+
+ if ( newItem && newItem.length ) {
+ this._open( newItem.parent() );
+
+ // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
+ this._delay(function() {
+ this.focus( event, newItem );
+ });
+ }
+ },
+
+ next: function( event ) {
+ this._move( "next", "first", event );
+ },
+
+ previous: function( event ) {
+ this._move( "prev", "last", event );
+ },
+
+ isFirstItem: function() {
+ return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
+ },
+
+ isLastItem: function() {
+ return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
+ },
+
+ _move: function( direction, filter, event ) {
+ var next;
+ if ( this.active ) {
+ if ( direction === "first" || direction === "last" ) {
+ next = this.active
+ [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
+ .eq( -1 );
+ } else {
+ next = this.active
+ [ direction + "All" ]( ".ui-menu-item" )
+ .eq( 0 );
+ }
+ }
+ if ( !next || !next.length || !this.active ) {
+ next = this.activeMenu.children( ".ui-menu-item" )[ filter ]();
+ }
+
+ this.focus( event, next );
+ },
+
+ nextPage: function( event ) {
+ var item, base, height;
+
+ if ( !this.active ) {
+ this.next( event );
+ return;
+ }
+ if ( this.isLastItem() ) {
+ return;
+ }
+ if ( this._hasScroll() ) {
+ base = this.active.offset().top;
+ height = this.element.height();
+ this.active.nextAll( ".ui-menu-item" ).each(function() {
+ item = $( this );
+ return item.offset().top - base - height < 0;
+ });
+
+ this.focus( event, item );
+ } else {
+ this.focus( event, this.activeMenu.children( ".ui-menu-item" )
+ [ !this.active ? "first" : "last" ]() );
+ }
+ },
+
+ previousPage: function( event ) {
+ var item, base, height;
+ if ( !this.active ) {
+ this.next( event );
+ return;
+ }
+ if ( this.isFirstItem() ) {
+ return;
+ }
+ if ( this._hasScroll() ) {
+ base = this.active.offset().top;
+ height = this.element.height();
+ this.active.prevAll( ".ui-menu-item" ).each(function() {
+ item = $( this );
+ return item.offset().top - base + height > 0;
+ });
+
+ this.focus( event, item );
+ } else {
+ this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
+ }
+ },
+
+ _hasScroll: function() {
+ return this.element.outerHeight() < this.element.prop( "scrollHeight" );
+ },
+
+ select: function( event ) {
+ // TODO: It should never be possible to not have an active item at this
+ // point, but the tests don't trigger mouseenter before click.
+ this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
+ var ui = { item: this.active };
+ if ( !this.active.has( ".ui-menu" ).length ) {
+ this.collapseAll( event, true );
+ }
+ this._trigger( "select", event, ui );
+ }
+});
+
+}( jQuery ));
+(function( $, undefined ) {
+
+$.widget( "ui.progressbar", {
+ version: "1.9.2",
+ options: {
+ value: 0,
+ max: 100
+ },
+
+ min: 0,
+
+ _create: function() {
+ this.element
+ .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+ .attr({
+ role: "progressbar",
+ "aria-valuemin": this.min,
+ "aria-valuemax": this.options.max,
+ "aria-valuenow": this._value()
+ });
+
+ this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
+ .appendTo( this.element );
+
+ this.oldValue = this._value();
+ this._refreshValue();
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-valuemin" )
+ .removeAttr( "aria-valuemax" )
+ .removeAttr( "aria-valuenow" );
+
+ this.valueDiv.remove();
+ },
+
+ value: function( newValue ) {
+ if ( newValue === undefined ) {
+ return this._value();
+ }
+
+ this._setOption( "value", newValue );
+ return this;
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "value" ) {
+ this.options.value = value;
+ this._refreshValue();
+ if ( this._value() === this.options.max ) {
+ this._trigger( "complete" );
+ }
+ }
+
+ this._super( key, value );
+ },
+
+ _value: function() {
+ var val = this.options.value;
+ // normalize invalid value
+ if ( typeof val !== "number" ) {
+ val = 0;
+ }
+ return Math.min( this.options.max, Math.max( this.min, val ) );
+ },
+
+ _percentage: function() {
+ return 100 * this._value() / this.options.max;
+ },
+
+ _refreshValue: function() {
+ var value = this.value(),
+ percentage = this._percentage();
+
+ if ( this.oldValue !== value ) {
+ this.oldValue = value;
+ this._trigger( "change" );
+ }
+
+ this.valueDiv
+ .toggle( value > this.min )
+ .toggleClass( "ui-corner-right", value === this.options.max )
+ .width( percentage.toFixed(0) + "%" );
+ this.element.attr( "aria-valuenow", value );
+ }
+});
+
+})( jQuery );
+(function( $, undefined ) {
+
+$.widget("ui.resizable", $.ui.mouse, {
+ version: "1.9.2",
+ widgetEventPrefix: "resize",
+ options: {
+ alsoResize: false,
+ animate: false,
+ animateDuration: "slow",
+ animateEasing: "swing",
+ aspectRatio: false,
+ autoHide: false,
+ containment: false,
+ ghost: false,
+ grid: false,
+ handles: "e,s,se",
+ helper: false,
+ maxHeight: null,
+ maxWidth: null,
+ minHeight: 10,
+ minWidth: 10,
+ zIndex: 1000
+ },
+ _create: function() {
+
+ var that = this, o = this.options;
+ this.element.addClass("ui-resizable");
+
+ $.extend(this, {
+ _aspectRatio: !!(o.aspectRatio),
+ aspectRatio: o.aspectRatio,
+ originalElement: this.element,
+ _proportionallyResizeElements: [],
+ _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
+ });
+
+ //Wrap the element if it cannot hold child nodes
+ if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
+
+ //Create a wrapper element and set the wrapper to the new current internal element
+ this.element.wrap(
+ $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
+ position: this.element.css('position'),
+ width: this.element.outerWidth(),
+ height: this.element.outerHeight(),
+ top: this.element.css('top'),
+ left: this.element.css('left')
+ })
+ );
+
+ //Overwrite the original this.element
+ this.element = this.element.parent().data(
+ "resizable", this.element.data('resizable')
+ );
+
+ this.elementIsWrapper = true;
+
+ //Move margins to the wrapper
+ this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
+ this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
+
+ //Prevent Safari textarea resize
+ this.originalResizeStyle = this.originalElement.css('resize');
+ this.originalElement.css('resize', 'none');
+
+ //Push the actual element to our proportionallyResize internal array
+ this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
+
+ // avoid IE jump (hard set the margin)
+ this.originalElement.css({ margin: this.originalElement.css('margin') });
+
+ // fix handlers offset
+ this._proportionallyResize();
+
+ }
+
+ this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' });
+ if(this.handles.constructor == String) {
+
+ if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
+ var n = this.handles.split(","); this.handles = {};
+
+ for(var i = 0; i < n.length; i++) {
+
+ var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
+ var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
+
+ // Apply zIndex to all handles - see #7960
+ axis.css({ zIndex: o.zIndex });
+
+ //TODO : What's going on here?
+ if ('se' == handle) {
+ axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
+ };
+
+ //Insert into internal handles object and append to element
+ this.handles[handle] = '.ui-resizable-'+handle;
+ this.element.append(axis);
+ }
+
+ }
+
+ this._renderAxis = function(target) {
+
+ target = target || this.element;
+
+ for(var i in this.handles) {
+
+ if(this.handles[i].constructor == String)
+ this.handles[i] = $(this.handles[i], this.element).show();
+
+ //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
+ if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
+
+ var axis = $(this.handles[i], this.element), padWrapper = 0;
+
+ //Checking the correct pad and border
+ padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
+
+ //The padding type i have to apply...
+ var padPos = [ 'padding',
+ /ne|nw|n/.test(i) ? 'Top' :
+ /se|sw|s/.test(i) ? 'Bottom' :
+ /^e$/.test(i) ? 'Right' : 'Left' ].join("");
+
+ target.css(padPos, padWrapper);
+
+ this._proportionallyResize();
+
+ }
+
+ //TODO: What's that good for? There's not anything to be executed left
+ if(!$(this.handles[i]).length)
+ continue;
+
+ }
+ };
+
+ //TODO: make renderAxis a prototype function
+ this._renderAxis(this.element);
+
+ this._handles = $('.ui-resizable-handle', this.element)
+ .disableSelection();
+
+ //Matching axis name
+ this._handles.mouseover(function() {
+ if (!that.resizing) {
+ if (this.className)
+ var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
+ //Axis, default = se
+ that.axis = axis && axis[1] ? axis[1] : 'se';
+ }
+ });
+
+ //If we want to auto hide the elements
+ if (o.autoHide) {
+ this._handles.hide();
+ $(this.element)
+ .addClass("ui-resizable-autohide")
+ .mouseenter(function() {
+ if (o.disabled) return;
+ $(this).removeClass("ui-resizable-autohide");
+ that._handles.show();
+ })
+ .mouseleave(function(){
+ if (o.disabled) return;
+ if (!that.resizing) {
+ $(this).addClass("ui-resizable-autohide");
+ that._handles.hide();
+ }
+ });
+ }
+
+ //Initialize the mouse interaction
+ this._mouseInit();
+
+ },
+
+ _destroy: function() {
+
+ this._mouseDestroy();
+
+ var _destroy = function(exp) {
+ $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
+ .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
+ };
+
+ //TODO: Unwrap at same DOM position
+ if (this.elementIsWrapper) {
+ _destroy(this.element);
+ var wrapper = this.element;
+ this.originalElement.css({
+ position: wrapper.css('position'),
+ width: wrapper.outerWidth(),
+ height: wrapper.outerHeight(),
+ top: wrapper.css('top'),
+ left: wrapper.css('left')
+ }).insertAfter( wrapper );
+ wrapper.remove();
+ }
+
+ this.originalElement.css('resize', this.originalResizeStyle);
+ _destroy(this.originalElement);
+
+ return this;
+ },
+
+ _mouseCapture: function(event) {
+ var handle = false;
+ for (var i in this.handles) {
+ if ($(this.handles[i])[0] == event.target) {
+ handle = true;
+ }
+ }
+
+ return !this.options.disabled && handle;
+ },
+
+ _mouseStart: function(event) {
+
+ var o = this.options, iniPos = this.element.position(), el = this.element;
+
+ this.resizing = true;
+ this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
+
+ // bugfix for http://dev.jquery.com/ticket/1749
+ if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
+ el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
+ }
+
+ this._renderProxy();
+
+ var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
+
+ if (o.containment) {
+ curleft += $(o.containment).scrollLeft() || 0;
+ curtop += $(o.containment).scrollTop() || 0;
+ }
+
+ //Store needed variables
+ this.offset = this.helper.offset();
+ this.position = { left: curleft, top: curtop };
+ this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+ this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+ this.originalPosition = { left: curleft, top: curtop };
+ this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
+ this.originalMousePosition = { left: event.pageX, top: event.pageY };
+
+ //Aspect Ratio
+ this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
+
+ var cursor = $('.ui-resizable-' + this.axis).css('cursor');
+ $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
+
+ el.addClass("ui-resizable-resizing");
+ this._propagate("start", event);
+ return true;
+ },
+
+ _mouseDrag: function(event) {
+
+ //Increase performance, avoid regex
+ var el = this.helper, o = this.options, props = {},
+ that = this, smp = this.originalMousePosition, a = this.axis;
+
+ var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
+ var trigger = this._change[a];
+ if (!trigger) return false;
+
+ // Calculate the attrs that will be change
+ var data = trigger.apply(this, [event, dx, dy]);
+
+ // Put this in the mouseDrag handler since the user can start pressing shift while resizing
+ this._updateVirtualBoundaries(event.shiftKey);
+ if (this._aspectRatio || event.shiftKey)
+ data = this._updateRatio(data, event);
+
+ data = this._respectSize(data, event);
+
+ // plugins callbacks need to be called first
+ this._propagate("resize", event);
+
+ el.css({
+ top: this.position.top + "px", left: this.position.left + "px",
+ width: this.size.width + "px", height: this.size.height + "px"
+ });
+
+ if (!this._helper && this._proportionallyResizeElements.length)
+ this._proportionallyResize();
+
+ this._updateCache(data);
+
+ // calling the user callback at the end
+ this._trigger('resize', event, this.ui());
+
+ return false;
+ },
+
+ _mouseStop: function(event) {
+
+ this.resizing = false;
+ var o = this.options, that = this;
+
+ if(this._helper) {
+ var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height,
+ soffsetw = ista ? 0 : that.sizeDiff.width;
+
+ var s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) },
+ left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null,
+ top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null;
+
+ if (!o.animate)
+ this.element.css($.extend(s, { top: top, left: left }));
+
+ that.helper.height(that.size.height);
+ that.helper.width(that.size.width);
+
+ if (this._helper && !o.animate) this._proportionallyResize();
+ }
+
+ $('body').css('cursor', 'auto');
+
+ this.element.removeClass("ui-resizable-resizing");
+
+ this._propagate("stop", event);
+
+ if (this._helper) this.helper.remove();
+ return false;
+
+ },
+
+ _updateVirtualBoundaries: function(forceAspectRatio) {
+ var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b;
+
+ b = {
+ minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
+ maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
+ minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
+ maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
+ };
+
+ if(this._aspectRatio || forceAspectRatio) {
+ // We want to create an enclosing box whose aspect ration is the requested one
+ // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
+ pMinWidth = b.minHeight * this.aspectRatio;
+ pMinHeight = b.minWidth / this.aspectRatio;
+ pMaxWidth = b.maxHeight * this.aspectRatio;
+ pMaxHeight = b.maxWidth / this.aspectRatio;
+
+ if(pMinWidth > b.minWidth) b.minWidth = pMinWidth;
+ if(pMinHeight > b.minHeight) b.minHeight = pMinHeight;
+ if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth;
+ if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight;
+ }
+ this._vBoundaries = b;
+ },
+
+ _updateCache: function(data) {
+ var o = this.options;
+ this.offset = this.helper.offset();
+ if (isNumber(data.left)) this.position.left = data.left;
+ if (isNumber(data.top)) this.position.top = data.top;
+ if (isNumber(data.height)) this.size.height = data.height;
+ if (isNumber(data.width)) this.size.width = data.width;
+ },
+
+ _updateRatio: function(data, event) {
+
+ var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
+
+ if (isNumber(data.height)) data.width = (data.height * this.aspectRatio);
+ else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio);
+
+ if (a == 'sw') {
+ data.left = cpos.left + (csize.width - data.width);
+ data.top = null;
+ }
+ if (a == 'nw') {
+ data.top = cpos.top + (csize.height - data.height);
+ data.left = cpos.left + (csize.width - data.width);
+ }
+
+ return data;
+ },
+
+ _respectSize: function(data, event) {
+
+ var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
+ ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
+ isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
+
+ if (isminw) data.width = o.minWidth;
+ if (isminh) data.height = o.minHeight;
+ if (ismaxw) data.width = o.maxWidth;
+ if (ismaxh) data.height = o.maxHeight;
+
+ var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
+ var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
+
+ if (isminw && cw) data.left = dw - o.minWidth;
+ if (ismaxw && cw) data.left = dw - o.maxWidth;
+ if (isminh && ch) data.top = dh - o.minHeight;
+ if (ismaxh && ch) data.top = dh - o.maxHeight;
+
+ // fixing jump error on top/left - bug #2330
+ var isNotwh = !data.width && !data.height;
+ if (isNotwh && !data.left && data.top) data.top = null;
+ else if (isNotwh && !data.top && data.left) data.left = null;
+
+ return data;
+ },
+
+ _proportionallyResize: function() {
+
+ var o = this.options;
+ if (!this._proportionallyResizeElements.length) return;
+ var element = this.helper || this.element;
+
+ for (var i=0; i < this._proportionallyResizeElements.length; i++) {
+
+ var prel = this._proportionallyResizeElements[i];
+
+ if (!this.borderDif) {
+ var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
+ p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
+
+ this.borderDif = $.map(b, function(v, i) {
+ var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
+ return border + padding;
+ });
+ }
+
+ prel.css({
+ height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
+ width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
+ });
+
+ };
+
+ },
+
+ _renderProxy: function() {
+
+ var el = this.element, o = this.options;
+ this.elementOffset = el.offset();
+
+ if(this._helper) {
+
+ this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
+
+ // fix ie6 offset TODO: This seems broken
+ var ie6offset = ($.ui.ie6 ? 1 : 0),
+ pxyoffset = ( $.ui.ie6 ? 2 : -1 );
+
+ this.helper.addClass(this._helper).css({
+ width: this.element.outerWidth() + pxyoffset,
+ height: this.element.outerHeight() + pxyoffset,
+ position: 'absolute',
+ left: this.elementOffset.left - ie6offset +'px',
+ top: this.elementOffset.top - ie6offset +'px',
+ zIndex: ++o.zIndex //TODO: Don't modify option
+ });
+
+ this.helper
+ .appendTo("body")
+ .disableSelection();
+
+ } else {
+ this.helper = this.element;
+ }
+
+ },
+
+ _change: {
+ e: function(event, dx, dy) {
+ return { width: this.originalSize.width + dx };
+ },
+ w: function(event, dx, dy) {
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+ return { left: sp.left + dx, width: cs.width - dx };
+ },
+ n: function(event, dx, dy) {
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+ return { top: sp.top + dy, height: cs.height - dy };
+ },
+ s: function(event, dx, dy) {
+ return { height: this.originalSize.height + dy };
+ },
+ se: function(event, dx, dy) {
+ return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
+ },
+ sw: function(event, dx, dy) {
+ return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
+ },
+ ne: function(event, dx, dy) {
+ return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
+ },
+ nw: function(event, dx, dy) {
+ return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
+ }
+ },
+
+ _propagate: function(n, event) {
+ $.ui.plugin.call(this, n, [event, this.ui()]);
+ (n != "resize" && this._trigger(n, event, this.ui()));
+ },
+
+ plugins: {},
+
+ ui: function() {
+ return {
+ originalElement: this.originalElement,
+ element: this.element,
+ helper: this.helper,
+ position: this.position,
+ size: this.size,
+ originalSize: this.originalSize,
+ originalPosition: this.originalPosition
+ };
+ }
+
+});
+
+/*
+ * Resizable Extensions
+ */
+
+$.ui.plugin.add("resizable", "alsoResize", {
+
+ start: function (event, ui) {
+ var that = $(this).data("resizable"), o = that.options;
+
+ var _store = function (exp) {
+ $(exp).each(function() {
+ var el = $(this);
+ el.data("resizable-alsoresize", {
+ width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
+ left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10)
+ });
+ });
+ };
+
+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
+ if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
+ else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
+ }else{
+ _store(o.alsoResize);
+ }
+ },
+
+ resize: function (event, ui) {
+ var that = $(this).data("resizable"), o = that.options, os = that.originalSize, op = that.originalPosition;
+
+ var delta = {
+ height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
+ top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0
+ },
+
+ _alsoResize = function (exp, c) {
+ $(exp).each(function() {
+ var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
+ css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
+
+ $.each(css, function (i, prop) {
+ var sum = (start[prop]||0) + (delta[prop]||0);
+ if (sum && sum >= 0)
+ style[prop] = sum || null;
+ });
+
+ el.css(style);
+ });
+ };
+
+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
+ $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
+ }else{
+ _alsoResize(o.alsoResize);
+ }
+ },
+
+ stop: function (event, ui) {
+ $(this).removeData("resizable-alsoresize");
+ }
+});
+
+$.ui.plugin.add("resizable", "animate", {
+
+ stop: function(event, ui) {
+ var that = $(this).data("resizable"), o = that.options;
+
+ var pr = that._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height,
+ soffsetw = ista ? 0 : that.sizeDiff.width;
+
+ var style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
+ left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null,
+ top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null;
+
+ that.element.animate(
+ $.extend(style, top && left ? { top: top, left: left } : {}), {
+ duration: o.animateDuration,
+ easing: o.animateEasing,
+ step: function() {
+
+ var data = {
+ width: parseInt(that.element.css('width'), 10),
+ height: parseInt(that.element.css('height'), 10),
+ top: parseInt(that.element.css('top'), 10),
+ left: parseInt(that.element.css('left'), 10)
+ };
+
+ if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
+
+ // propagating resize, and updating values for each animation step
+ that._updateCache(data);
+ that._propagate("resize", event);
+
+ }
+ }
+ );
+ }
+
+});
+
+$.ui.plugin.add("resizable", "containment", {
+
+ start: function(event, ui) {
+ var that = $(this).data("resizable"), o = that.options, el = that.element;
+ var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
+ if (!ce) return;
+
+ that.containerElement = $(ce);
+
+ if (/document/.test(oc) || oc == document) {
+ that.containerOffset = { left: 0, top: 0 };
+ that.containerPosition = { left: 0, top: 0 };
+
+ that.parentData = {
+ element: $(document), left: 0, top: 0,
+ width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
+ };
+ }
+
+ // i'm a node, so compute top, left, right, bottom
+ else {
+ var element = $(ce), p = [];
+ $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
+
+ that.containerOffset = element.offset();
+ that.containerPosition = element.position();
+ that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
+
+ var co = that.containerOffset, ch = that.containerSize.height, cw = that.containerSize.width,
+ width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
+
+ that.parentData = {
+ element: ce, left: co.left, top: co.top, width: width, height: height
+ };
+ }
+ },
+
+ resize: function(event, ui) {
+ var that = $(this).data("resizable"), o = that.options,
+ ps = that.containerSize, co = that.containerOffset, cs = that.size, cp = that.position,
+ pRatio = that._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = that.containerElement;
+
+ if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
+
+ if (cp.left < (that._helper ? co.left : 0)) {
+ that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left));
+ if (pRatio) that.size.height = that.size.width / that.aspectRatio;
+ that.position.left = o.helper ? co.left : 0;
+ }
+
+ if (cp.top < (that._helper ? co.top : 0)) {
+ that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top);
+ if (pRatio) that.size.width = that.size.height * that.aspectRatio;
+ that.position.top = that._helper ? co.top : 0;
+ }
+
+ that.offset.left = that.parentData.left+that.position.left;
+ that.offset.top = that.parentData.top+that.position.top;
+
+ var woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width ),
+ hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height );
+
+ var isParent = that.containerElement.get(0) == that.element.parent().get(0),
+ isOffsetRelative = /relative|absolute/.test(that.containerElement.css('position'));
+
+ if(isParent && isOffsetRelative) woset -= that.parentData.left;
+
+ if (woset + that.size.width >= that.parentData.width) {
+ that.size.width = that.parentData.width - woset;
+ if (pRatio) that.size.height = that.size.width / that.aspectRatio;
+ }
+
+ if (hoset + that.size.height >= that.parentData.height) {
+ that.size.height = that.parentData.height - hoset;
+ if (pRatio) that.size.width = that.size.height * that.aspectRatio;
+ }
+ },
+
+ stop: function(event, ui){
+ var that = $(this).data("resizable"), o = that.options, cp = that.position,
+ co = that.containerOffset, cop = that.containerPosition, ce = that.containerElement;
+
+ var helper = $(that.helper), ho = helper.offset(), w = helper.outerWidth() - that.sizeDiff.width, h = helper.outerHeight() - that.sizeDiff.height;
+
+ if (that._helper && !o.animate && (/relative/).test(ce.css('position')))
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
+
+ if (that._helper && !o.animate && (/static/).test(ce.css('position')))
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
+
+ }
+});
+
+$.ui.plugin.add("resizable", "ghost", {
+
+ start: function(event, ui) {
+
+ var that = $(this).data("resizable"), o = that.options, cs = that.size;
+
+ that.ghost = that.originalElement.clone();
+ that.ghost
+ .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
+ .addClass('ui-resizable-ghost')
+ .addClass(typeof o.ghost == 'string' ? o.ghost : '');
+
+ that.ghost.appendTo(that.helper);
+
+ },
+
+ resize: function(event, ui){
+ var that = $(this).data("resizable"), o = that.options;
+ if (that.ghost) that.ghost.css({ position: 'relative', height: that.size.height, width: that.size.width });
+ },
+
+ stop: function(event, ui){
+ var that = $(this).data("resizable"), o = that.options;
+ if (that.ghost && that.helper) that.helper.get(0).removeChild(that.ghost.get(0));
+ }
+
+});
+
+$.ui.plugin.add("resizable", "grid", {
+
+ resize: function(event, ui) {
+ var that = $(this).data("resizable"), o = that.options, cs = that.size, os = that.originalSize, op = that.originalPosition, a = that.axis, ratio = o._aspectRatio || event.shiftKey;
+ o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
+ var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
+
+ if (/^(se|s|e)$/.test(a)) {
+ that.size.width = os.width + ox;
+ that.size.height = os.height + oy;
+ }
+ else if (/^(ne)$/.test(a)) {
+ that.size.width = os.width + ox;
+ that.size.height = os.height + oy;
+ that.position.top = op.top - oy;
+ }
+ else if (/^(sw)$/.test(a)) {
+ that.size.width = os.width + ox;
+ that.size.height = os.height + oy;
+ that.position.left = op.left - ox;
+ }
+ else {
+ that.size.width = os.width + ox;
+ that.size.height = os.height + oy;
+ that.position.top = op.top - oy;
+ that.position.left = op.left - ox;
+ }
+ }
+
+});
+
+var num = function(v) {
+ return parseInt(v, 10) || 0;
+};
+
+var isNumber = function(value) {
+ return !isNaN(parseInt(value, 10));
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.widget("ui.selectable", $.ui.mouse, {
+ version: "1.9.2",
+ options: {
+ appendTo: 'body',
+ autoRefresh: true,
+ distance: 0,
+ filter: '*',
+ tolerance: 'touch'
+ },
+ _create: function() {
+ var that = this;
+
+ this.element.addClass("ui-selectable");
+
+ this.dragged = false;
+
+ // cache selectee children based on filter
+ var selectees;
+ this.refresh = function() {
+ selectees = $(that.options.filter, that.element[0]);
+ selectees.addClass("ui-selectee");
+ selectees.each(function() {
+ var $this = $(this);
+ var pos = $this.offset();
+ $.data(this, "selectable-item", {
+ element: this,
+ $element: $this,
+ left: pos.left,
+ top: pos.top,
+ right: pos.left + $this.outerWidth(),
+ bottom: pos.top + $this.outerHeight(),
+ startselected: false,
+ selected: $this.hasClass('ui-selected'),
+ selecting: $this.hasClass('ui-selecting'),
+ unselecting: $this.hasClass('ui-unselecting')
+ });
+ });
+ };
+ this.refresh();
+
+ this.selectees = selectees.addClass("ui-selectee");
+
+ this._mouseInit();
+
+ this.helper = $("<div class='ui-selectable-helper'></div>");
+ },
+
+ _destroy: function() {
+ this.selectees
+ .removeClass("ui-selectee")
+ .removeData("selectable-item");
+ this.element
+ .removeClass("ui-selectable ui-selectable-disabled");
+ this._mouseDestroy();
+ },
+
+ _mouseStart: function(event) {
+ var that = this;
+
+ this.opos = [event.pageX, event.pageY];
+
+ if (this.options.disabled)
+ return;
+
+ var options = this.options;
+
+ this.selectees = $(options.filter, this.element[0]);
+
+ this._trigger("start", event);
+
+ $(options.appendTo).append(this.helper);
+ // position helper (lasso)
+ this.helper.css({
+ "left": event.clientX,
+ "top": event.clientY,
+ "width": 0,
+ "height": 0
+ });
+
+ if (options.autoRefresh) {
+ this.refresh();
+ }
+
+ this.selectees.filter('.ui-selected').each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.startselected = true;
+ if (!event.metaKey && !event.ctrlKey) {
+ selectee.$element.removeClass('ui-selected');
+ selectee.selected = false;
+ selectee.$element.addClass('ui-unselecting');
+ selectee.unselecting = true;
+ // selectable UNSELECTING callback
+ that._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ });
+
+ $(event.target).parents().andSelf().each(function() {
+ var selectee = $.data(this, "selectable-item");
+ if (selectee) {
+ var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
+ selectee.$element
+ .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
+ .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
+ selectee.unselecting = !doSelect;
+ selectee.selecting = doSelect;
+ selectee.selected = doSelect;
+ // selectable (UN)SELECTING callback
+ if (doSelect) {
+ that._trigger("selecting", event, {
+ selecting: selectee.element
+ });
+ } else {
+ that._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ return false;
+ }
+ });
+
+ },
+
+ _mouseDrag: function(event) {
+ var that = this;
+ this.dragged = true;
+
+ if (this.options.disabled)
+ return;
+
+ var options = this.options;
+
+ var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
+ if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
+ if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
+ this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
+
+ this.selectees.each(function() {
+ var selectee = $.data(this, "selectable-item");
+ //prevent helper from being selected if appendTo: selectable
+ if (!selectee || selectee.element == that.element[0])
+ return;
+ var hit = false;
+ if (options.tolerance == 'touch') {
+ hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
+ } else if (options.tolerance == 'fit') {
+ hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
+ }
+
+ if (hit) {
+ // SELECT
+ if (selectee.selected) {
+ selectee.$element.removeClass('ui-selected');
+ selectee.selected = false;
+ }
+ if (selectee.unselecting) {
+ selectee.$element.removeClass('ui-unselecting');
+ selectee.unselecting = false;
+ }
+ if (!selectee.selecting) {
+ selectee.$element.addClass('ui-selecting');
+ selectee.selecting = true;
+ // selectable SELECTING callback
+ that._trigger("selecting", event, {
+ selecting: selectee.element
+ });
+ }
+ } else {
+ // UNSELECT
+ if (selectee.selecting) {
+ if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
+ selectee.$element.removeClass('ui-selecting');
+ selectee.selecting = false;
+ selectee.$element.addClass('ui-selected');
+ selectee.selected = true;
+ } else {
+ selectee.$element.removeClass('ui-selecting');
+ selectee.selecting = false;
+ if (selectee.startselected) {
+ selectee.$element.addClass('ui-unselecting');
+ selectee.unselecting = true;
+ }
+ // selectable UNSELECTING callback
+ that._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ }
+ if (selectee.selected) {
+ if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
+ selectee.$element.removeClass('ui-selected');
+ selectee.selected = false;
+
+ selectee.$element.addClass('ui-unselecting');
+ selectee.unselecting = true;
+ // selectable UNSELECTING callback
+ that._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ }
+ }
+ });
+
+ return false;
+ },
+
+ _mouseStop: function(event) {
+ var that = this;
+
+ this.dragged = false;
+
+ var options = this.options;
+
+ $('.ui-unselecting', this.element[0]).each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.$element.removeClass('ui-unselecting');
+ selectee.unselecting = false;
+ selectee.startselected = false;
+ that._trigger("unselected", event, {
+ unselected: selectee.element
+ });
+ });
+ $('.ui-selecting', this.element[0]).each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
+ selectee.selecting = false;
+ selectee.selected = true;
+ selectee.startselected = true;
+ that._trigger("selected", event, {
+ selected: selectee.element
+ });
+ });
+ this._trigger("stop", event);
+
+ this.helper.remove();
+
+ return false;
+ }
+
+});
+
+})(jQuery);
+(function( $, undefined ) {
+
+// number of pages in a slider
+// (how many times can you page up/down to go through the whole range)
+var numPages = 5;
+
+$.widget( "ui.slider", $.ui.mouse, {
+ version: "1.9.2",
+ widgetEventPrefix: "slide",
+
+ options: {
+ animate: false,
+ distance: 0,
+ max: 100,
+ min: 0,
+ orientation: "horizontal",
+ range: false,
+ step: 1,
+ value: 0,
+ values: null
+ },
+
+ _create: function() {
+ var i, handleCount,
+ o = this.options,
+ existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
+ handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
+ handles = [];
+
+ this._keySliding = false;
+ this._mouseSliding = false;
+ this._animateOff = true;
+ this._handleIndex = null;
+ this._detectOrientation();
+ this._mouseInit();
+
+ this.element
+ .addClass( "ui-slider" +
+ " ui-slider-" + this.orientation +
+ " ui-widget" +
+ " ui-widget-content" +
+ " ui-corner-all" +
+ ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) );
+
+ this.range = $([]);
+
+ if ( o.range ) {
+ if ( o.range === true ) {
+ if ( !o.values ) {
+ o.values = [ this._valueMin(), this._valueMin() ];
+ }
+ if ( o.values.length && o.values.length !== 2 ) {
+ o.values = [ o.values[0], o.values[0] ];
+ }
+ }
+
+ this.range = $( "<div></div>" )
+ .appendTo( this.element )
+ .addClass( "ui-slider-range" +
+ // note: this isn't the most fittingly semantic framework class for this element,
+ // but worked best visually with a variety of themes
+ " ui-widget-header" +
+ ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );
+ }
+
+ handleCount = ( o.values && o.values.length ) || 1;
+
+ for ( i = existingHandles.length; i < handleCount; i++ ) {
+ handles.push( handle );
+ }
+
+ this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
+
+ this.handle = this.handles.eq( 0 );
+
+ this.handles.add( this.range ).filter( "a" )
+ .click(function( event ) {
+ event.preventDefault();
+ })
+ .mouseenter(function() {
+ if ( !o.disabled ) {
+ $( this ).addClass( "ui-state-hover" );
+ }
+ })
+ .mouseleave(function() {
+ $( this ).removeClass( "ui-state-hover" );
+ })
+ .focus(function() {
+ if ( !o.disabled ) {
+ $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
+ $( this ).addClass( "ui-state-focus" );
+ } else {
+ $( this ).blur();
+ }
+ })
+ .blur(function() {
+ $( this ).removeClass( "ui-state-focus" );
+ });
+
+ this.handles.each(function( i ) {
+ $( this ).data( "ui-slider-handle-index", i );
+ });
+
+ this._on( this.handles, {
+ keydown: function( event ) {
+ var allowed, curVal, newVal, step,
+ index = $( event.target ).data( "ui-slider-handle-index" );
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.HOME:
+ case $.ui.keyCode.END:
+ case $.ui.keyCode.PAGE_UP:
+ case $.ui.keyCode.PAGE_DOWN:
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.RIGHT:
+ case $.ui.keyCode.DOWN:
+ case $.ui.keyCode.LEFT:
+ event.preventDefault();
+ if ( !this._keySliding ) {
+ this._keySliding = true;
+ $( event.target ).addClass( "ui-state-active" );
+ allowed = this._start( event, index );
+ if ( allowed === false ) {
+ return;
+ }
+ }
+ break;
+ }
+
+ step = this.options.step;
+ if ( this.options.values && this.options.values.length ) {
+ curVal = newVal = this.values( index );
+ } else {
+ curVal = newVal = this.value();
+ }
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.HOME:
+ newVal = this._valueMin();
+ break;
+ case $.ui.keyCode.END:
+ newVal = this._valueMax();
+ break;
+ case $.ui.keyCode.PAGE_UP:
+ newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) );
+ break;
+ case $.ui.keyCode.PAGE_DOWN:
+ newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) );
+ break;
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.RIGHT:
+ if ( curVal === this._valueMax() ) {
+ return;
+ }
+ newVal = this._trimAlignValue( curVal + step );
+ break;
+ case $.ui.keyCode.DOWN:
+ case $.ui.keyCode.LEFT:
+ if ( curVal === this._valueMin() ) {
+ return;
+ }
+ newVal = this._trimAlignValue( curVal - step );
+ break;
+ }
+
+ this._slide( event, index, newVal );
+ },
+ keyup: function( event ) {
+ var index = $( event.target ).data( "ui-slider-handle-index" );
+
+ if ( this._keySliding ) {
+ this._keySliding = false;
+ this._stop( event, index );
+ this._change( event, index );
+ $( event.target ).removeClass( "ui-state-active" );
+ }
+ }
+ });
+
+ this._refreshValue();
+
+ this._animateOff = false;
+ },
+
+ _destroy: function() {
+ this.handles.remove();
+ this.range.remove();
+
+ this.element
+ .removeClass( "ui-slider" +
+ " ui-slider-horizontal" +
+ " ui-slider-vertical" +
+ " ui-slider-disabled" +
+ " ui-widget" +
+ " ui-widget-content" +
+ " ui-corner-all" );
+
+ this._mouseDestroy();
+ },
+
+ _mouseCapture: function( event ) {
+ var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
+ that = this,
+ o = this.options;
+
+ if ( o.disabled ) {
+ return false;
+ }
+
+ this.elementSize = {
+ width: this.element.outerWidth(),
+ height: this.element.outerHeight()
+ };
+ this.elementOffset = this.element.offset();
+
+ position = { x: event.pageX, y: event.pageY };
+ normValue = this._normValueFromMouse( position );
+ distance = this._valueMax() - this._valueMin() + 1;
+ this.handles.each(function( i ) {
+ var thisDistance = Math.abs( normValue - that.values(i) );
+ if ( distance > thisDistance ) {
+ distance = thisDistance;
+ closestHandle = $( this );
+ index = i;
+ }
+ });
+
+ // workaround for bug #3736 (if both handles of a range are at 0,
+ // the first is always used as the one with least distance,
+ // and moving it is obviously prevented by preventing negative ranges)
+ if( o.range === true && this.values(1) === o.min ) {
+ index += 1;
+ closestHandle = $( this.handles[index] );
+ }
+
+ allowed = this._start( event, index );
+ if ( allowed === false ) {
+ return false;
+ }
+ this._mouseSliding = true;
+
+ this._handleIndex = index;
+
+ closestHandle
+ .addClass( "ui-state-active" )
+ .focus();
+
+ offset = closestHandle.offset();
+ mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
+ this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
+ left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
+ top: event.pageY - offset.top -
+ ( closestHandle.height() / 2 ) -
+ ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
+ ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
+ ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
+ };
+
+ if ( !this.handles.hasClass( "ui-state-hover" ) ) {
+ this._slide( event, index, normValue );
+ }
+ this._animateOff = true;
+ return true;
+ },
+
+ _mouseStart: function() {
+ return true;
+ },
+
+ _mouseDrag: function( event ) {
+ var position = { x: event.pageX, y: event.pageY },
+ normValue = this._normValueFromMouse( position );
+
+ this._slide( event, this._handleIndex, normValue );
+
+ return false;
+ },
+
+ _mouseStop: function( event ) {
+ this.handles.removeClass( "ui-state-active" );
+ this._mouseSliding = false;
+
+ this._stop( event, this._handleIndex );
+ this._change( event, this._handleIndex );
+
+ this._handleIndex = null;
+ this._clickOffset = null;
+ this._animateOff = false;
+
+ return false;
+ },
+
+ _detectOrientation: function() {
+ this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
+ },
+
+ _normValueFromMouse: function( position ) {
+ var pixelTotal,
+ pixelMouse,
+ percentMouse,
+ valueTotal,
+ valueMouse;
+
+ if ( this.orientation === "horizontal" ) {
+ pixelTotal = this.elementSize.width;
+ pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
+ } else {
+ pixelTotal = this.elementSize.height;
+ pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
+ }
+
+ percentMouse = ( pixelMouse / pixelTotal );
+ if ( percentMouse > 1 ) {
+ percentMouse = 1;
+ }
+ if ( percentMouse < 0 ) {
+ percentMouse = 0;
+ }
+ if ( this.orientation === "vertical" ) {
+ percentMouse = 1 - percentMouse;
+ }
+
+ valueTotal = this._valueMax() - this._valueMin();
+ valueMouse = this._valueMin() + percentMouse * valueTotal;
+
+ return this._trimAlignValue( valueMouse );
+ },
+
+ _start: function( event, index ) {
+ var uiHash = {
+ handle: this.handles[ index ],
+ value: this.value()
+ };
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
+ uiHash.values = this.values();
+ }
+ return this._trigger( "start", event, uiHash );
+ },
+
+ _slide: function( event, index, newVal ) {
+ var otherVal,
+ newValues,
+ allowed;
+
+ if ( this.options.values && this.options.values.length ) {
+ otherVal = this.values( index ? 0 : 1 );
+
+ if ( ( this.options.values.length === 2 && this.options.range === true ) &&
+ ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
+ ) {
+ newVal = otherVal;
+ }
+
+ if ( newVal !== this.values( index ) ) {
+ newValues = this.values();
+ newValues[ index ] = newVal;
+ // A slide can be canceled by returning false from the slide callback
+ allowed = this._trigger( "slide", event, {
+ handle: this.handles[ index ],
+ value: newVal,
+ values: newValues
+ } );
+ otherVal = this.values( index ? 0 : 1 );
+ if ( allowed !== false ) {
+ this.values( index, newVal, true );
+ }
+ }
+ } else {
+ if ( newVal !== this.value() ) {
+ // A slide can be canceled by returning false from the slide callback
+ allowed = this._trigger( "slide", event, {
+ handle: this.handles[ index ],
+ value: newVal
+ } );
+ if ( allowed !== false ) {
+ this.value( newVal );
+ }
+ }
+ }
+ },
+
+ _stop: function( event, index ) {
+ var uiHash = {
+ handle: this.handles[ index ],
+ value: this.value()
+ };
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
+ uiHash.values = this.values();
+ }
+
+ this._trigger( "stop", event, uiHash );
+ },
+
+ _change: function( event, index ) {
+ if ( !this._keySliding && !this._mouseSliding ) {
+ var uiHash = {
+ handle: this.handles[ index ],
+ value: this.value()
+ };
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
+ uiHash.values = this.values();
+ }
+
+ this._trigger( "change", event, uiHash );
+ }
+ },
+
+ value: function( newValue ) {
+ if ( arguments.length ) {
+ this.options.value = this._trimAlignValue( newValue );
+ this._refreshValue();
+ this._change( null, 0 );
+ return;
+ }
+
+ return this._value();
+ },
+
+ values: function( index, newValue ) {
+ var vals,
+ newValues,
+ i;
+
+ if ( arguments.length > 1 ) {
+ this.options.values[ index ] = this._trimAlignValue( newValue );
+ this._refreshValue();
+ this._change( null, index );
+ return;
+ }
+
+ if ( arguments.length ) {
+ if ( $.isArray( arguments[ 0 ] ) ) {
+ vals = this.options.values;
+ newValues = arguments[ 0 ];
+ for ( i = 0; i < vals.length; i += 1 ) {
+ vals[ i ] = this._trimAlignValue( newValues[ i ] );
+ this._change( null, i );
+ }
+ this._refreshValue();
+ } else {
+ if ( this.options.values && this.options.values.length ) {
+ return this._values( index );
+ } else {
+ return this.value();
+ }
+ }
+ } else {
+ return this._values();
+ }
+ },
+
+ _setOption: function( key, value ) {
+ var i,
+ valsLength = 0;
+
+ if ( $.isArray( this.options.values ) ) {
+ valsLength = this.options.values.length;
+ }
+
+ $.Widget.prototype._setOption.apply( this, arguments );
+
+ switch ( key ) {
+ case "disabled":
+ if ( value ) {
+ this.handles.filter( ".ui-state-focus" ).blur();
+ this.handles.removeClass( "ui-state-hover" );
+ this.handles.prop( "disabled", true );
+ this.element.addClass( "ui-disabled" );
+ } else {
+ this.handles.prop( "disabled", false );
+ this.element.removeClass( "ui-disabled" );
+ }
+ break;
+ case "orientation":
+ this._detectOrientation();
+ this.element
+ .removeClass( "ui-slider-horizontal ui-slider-vertical" )
+ .addClass( "ui-slider-" + this.orientation );
+ this._refreshValue();
+ break;
+ case "value":
+ this._animateOff = true;
+ this._refreshValue();
+ this._change( null, 0 );
+ this._animateOff = false;
+ break;
+ case "values":
+ this._animateOff = true;
+ this._refreshValue();
+ for ( i = 0; i < valsLength; i += 1 ) {
+ this._change( null, i );
+ }
+ this._animateOff = false;
+ break;
+ case "min":
+ case "max":
+ this._animateOff = true;
+ this._refreshValue();
+ this._animateOff = false;
+ break;
+ }
+ },
+
+ //internal value getter
+ // _value() returns value trimmed by min and max, aligned by step
+ _value: function() {
+ var val = this.options.value;
+ val = this._trimAlignValue( val );
+
+ return val;
+ },
+
+ //internal values getter
+ // _values() returns array of values trimmed by min and max, aligned by step
+ // _values( index ) returns single value trimmed by min and max, aligned by step
+ _values: function( index ) {
+ var val,
+ vals,
+ i;
+
+ if ( arguments.length ) {
+ val = this.options.values[ index ];
+ val = this._trimAlignValue( val );
+
+ return val;
+ } else {
+ // .slice() creates a copy of the array
+ // this copy gets trimmed by min and max and then returned
+ vals = this.options.values.slice();
+ for ( i = 0; i < vals.length; i+= 1) {
+ vals[ i ] = this._trimAlignValue( vals[ i ] );
+ }
+
+ return vals;
+ }
+ },
+
+ // returns the step-aligned value that val is closest to, between (inclusive) min and max
+ _trimAlignValue: function( val ) {
+ if ( val <= this._valueMin() ) {
+ return this._valueMin();
+ }
+ if ( val >= this._valueMax() ) {
+ return this._valueMax();
+ }
+ var step = ( this.options.step > 0 ) ? this.options.step : 1,
+ valModStep = (val - this._valueMin()) % step,
+ alignValue = val - valModStep;
+
+ if ( Math.abs(valModStep) * 2 >= step ) {
+ alignValue += ( valModStep > 0 ) ? step : ( -step );
+ }
+
+ // Since JavaScript has problems with large floats, round
+ // the final value to 5 digits after the decimal point (see #4124)
+ return parseFloat( alignValue.toFixed(5) );
+ },
+
+ _valueMin: function() {
+ return this.options.min;
+ },
+
+ _valueMax: function() {
+ return this.options.max;
+ },
+
+ _refreshValue: function() {
+ var lastValPercent, valPercent, value, valueMin, valueMax,
+ oRange = this.options.range,
+ o = this.options,
+ that = this,
+ animate = ( !this._animateOff ) ? o.animate : false,
+ _set = {};
+
+ if ( this.options.values && this.options.values.length ) {
+ this.handles.each(function( i ) {
+ valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
+ _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+ $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+ if ( that.options.range === true ) {
+ if ( that.orientation === "horizontal" ) {
+ if ( i === 0 ) {
+ that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
+ }
+ if ( i === 1 ) {
+ that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ } else {
+ if ( i === 0 ) {
+ that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
+ }
+ if ( i === 1 ) {
+ that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ }
+ }
+ lastValPercent = valPercent;
+ });
+ } else {
+ value = this.value();
+ valueMin = this._valueMin();
+ valueMax = this._valueMax();
+ valPercent = ( valueMax !== valueMin ) ?
+ ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
+ 0;
+ _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+ this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+
+ if ( oRange === "min" && this.orientation === "horizontal" ) {
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
+ }
+ if ( oRange === "max" && this.orientation === "horizontal" ) {
+ this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ if ( oRange === "min" && this.orientation === "vertical" ) {
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
+ }
+ if ( oRange === "max" && this.orientation === "vertical" ) {
+ this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ }
+ }
+
+});
+
+}(jQuery));
+(function( $, undefined ) {
+
+$.widget("ui.sortable", $.ui.mouse, {
+ version: "1.9.2",
+ widgetEventPrefix: "sort",
+ ready: false,
+ options: {
+ appendTo: "parent",
+ axis: false,
+ connectWith: false,
+ containment: false,
+ cursor: 'auto',
+ cursorAt: false,
+ dropOnEmpty: true,
+ forcePlaceholderSize: false,
+ forceHelperSize: false,
+ grid: false,
+ handle: false,
+ helper: "original",
+ items: '> *',
+ opacity: false,
+ placeholder: false,
+ revert: false,
+ scroll: true,
+ scrollSensitivity: 20,
+ scrollSpeed: 20,
+ scope: "default",
+ tolerance: "intersect",
+ zIndex: 1000
+ },
+ _create: function() {
+
+ var o = this.options;
+ this.containerCache = {};
+ this.element.addClass("ui-sortable");
+
+ //Get the items
+ this.refresh();
+
+ //Let's determine if the items are being displayed horizontally
+ this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false;
+
+ //Let's determine the parent's offset
+ this.offset = this.element.offset();
+
+ //Initialize mouse events for interaction
+ this._mouseInit();
+
+ //We're ready to go
+ this.ready = true
+
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass("ui-sortable ui-sortable-disabled");
+ this._mouseDestroy();
+
+ for ( var i = this.items.length - 1; i >= 0; i-- )
+ this.items[i].item.removeData(this.widgetName + "-item");
+
+ return this;
+ },
+
+ _setOption: function(key, value){
+ if ( key === "disabled" ) {
+ this.options[ key ] = value;
+
+ this.widget().toggleClass( "ui-sortable-disabled", !!value );
+ } else {
+ // Don't call widget base _setOption for disable as it adds ui-state-disabled class
+ $.Widget.prototype._setOption.apply(this, arguments);
+ }
+ },
+
+ _mouseCapture: function(event, overrideHandle) {
+ var that = this;
+
+ if (this.reverting) {
+ return false;
+ }
+
+ if(this.options.disabled || this.options.type == 'static') return false;
+
+ //We have to refresh the items data once first
+ this._refreshItems(event);
+
+ //Find out if the clicked node (or one of its parents) is a actual item in this.items
+ var currentItem = null, nodes = $(event.target).parents().each(function() {
+ if($.data(this, that.widgetName + '-item') == that) {
+ currentItem = $(this);
+ return false;
+ }
+ });
+ if($.data(event.target, that.widgetName + '-item') == that) currentItem = $(event.target);
+
+ if(!currentItem) return false;
+ if(this.options.handle && !overrideHandle) {
+ var validHandle = false;
+
+ $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
+ if(!validHandle) return false;
+ }
+
+ this.currentItem = currentItem;
+ this._removeCurrentsFromItems();
+ return true;
+
+ },
+
+ _mouseStart: function(event, overrideHandle, noActivation) {
+
+ var o = this.options;
+ this.currentContainer = this;
+
+ //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
+ this.refreshPositions();
+
+ //Create and append the visible helper
+ this.helper = this._createHelper(event);
+
+ //Cache the helper size
+ this._cacheHelperProportions();
+
+ /*
+ * - Position generation -
+ * This block generates everything position related - it's the core of draggables.
+ */
+
+ //Cache the margins of the original element
+ this._cacheMargins();
+
+ //Get the next scrolling parent
+ this.scrollParent = this.helper.scrollParent();
+
+ //The element's absolute position on the page minus margins
+ this.offset = this.currentItem.offset();
+ this.offset = {
+ top: this.offset.top - this.margins.top,
+ left: this.offset.left - this.margins.left
+ };
+
+ $.extend(this.offset, {
+ click: { //Where the click happened, relative to the element
+ left: event.pageX - this.offset.left,
+ top: event.pageY - this.offset.top
+ },
+ parent: this._getParentOffset(),
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
+ });
+
+ // Only after we got the offset, we can change the helper's position to absolute
+ // TODO: Still need to figure out a way to make relative sorting possible
+ this.helper.css("position", "absolute");
+ this.cssPosition = this.helper.css("position");
+
+ //Generate the original position
+ this.originalPosition = this._generatePosition(event);
+ this.originalPageX = event.pageX;
+ this.originalPageY = event.pageY;
+
+ //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
+
+ //Cache the former DOM position
+ this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
+
+ //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
+ if(this.helper[0] != this.currentItem[0]) {
+ this.currentItem.hide();
+ }
+
+ //Create the placeholder
+ this._createPlaceholder();
+
+ //Set a containment if given in the options
+ if(o.containment)
+ this._setContainment();
+
+ if(o.cursor) { // cursor option
+ if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
+ $('body').css("cursor", o.cursor);
+ }
+
+ if(o.opacity) { // opacity option
+ if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
+ this.helper.css("opacity", o.opacity);
+ }
+
+ if(o.zIndex) { // zIndex option
+ if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
+ this.helper.css("zIndex", o.zIndex);
+ }
+
+ //Prepare scrolling
+ if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
+ this.overflowOffset = this.scrollParent.offset();
+
+ //Call callbacks
+ this._trigger("start", event, this._uiHash());
+
+ //Recache the helper size
+ if(!this._preserveHelperProportions)
+ this._cacheHelperProportions();
+
+
+ //Post 'activate' events to possible containers
+ if(!noActivation) {
+ for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); }
+ }
+
+ //Prepare possible droppables
+ if($.ui.ddmanager)
+ $.ui.ddmanager.current = this;
+
+ if ($.ui.ddmanager && !o.dropBehaviour)
+ $.ui.ddmanager.prepareOffsets(this, event);
+
+ this.dragging = true;
+
+ this.helper.addClass("ui-sortable-helper");
+ this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+ return true;
+
+ },
+
+ _mouseDrag: function(event) {
+
+ //Compute the helpers position
+ this.position = this._generatePosition(event);
+ this.positionAbs = this._convertPositionTo("absolute");
+
+ if (!this.lastPositionAbs) {
+ this.lastPositionAbs = this.positionAbs;
+ }
+
+ //Do scrolling
+ if(this.options.scroll) {
+ var o = this.options, scrolled = false;
+ if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
+
+ if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
+ else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
+
+ if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
+ else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
+
+ } else {
+
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+ else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+ else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+
+ }
+
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
+ $.ui.ddmanager.prepareOffsets(this, event);
+ }
+
+ //Regenerate the absolute position used for position checks
+ this.positionAbs = this._convertPositionTo("absolute");
+
+ //Set the helper position
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
+
+ //Rearrange
+ for (var i = this.items.length - 1; i >= 0; i--) {
+
+ //Cache variables and intersection, continue if no intersection
+ var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
+ if (!intersection) continue;
+
+ // Only put the placeholder inside the current Container, skip all
+ // items form other containers. This works because when moving
+ // an item from one container to another the
+ // currentContainer is switched before the placeholder is moved.
+ //
+ // Without this moving items in "sub-sortables" can cause the placeholder to jitter
+ // beetween the outer and inner container.
+ if (item.instance !== this.currentContainer) continue;
+
+ if (itemElement != this.currentItem[0] //cannot intersect with itself
+ && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
+ && !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
+ && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
+ //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
+ ) {
+
+ this.direction = intersection == 1 ? "down" : "up";
+
+ if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
+ this._rearrange(event, item);
+ } else {
+ break;
+ }
+
+ this._trigger("change", event, this._uiHash());
+ break;
+ }
+ }
+
+ //Post events to containers
+ this._contactContainers(event);
+
+ //Interconnect with droppables
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
+
+ //Call callbacks
+ this._trigger('sort', event, this._uiHash());
+
+ this.lastPositionAbs = this.positionAbs;
+ return false;
+
+ },
+
+ _mouseStop: function(event, noPropagation) {
+
+ if(!event) return;
+
+ //If we are using droppables, inform the manager about the drop
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
+ $.ui.ddmanager.drop(this, event);
+
+ if(this.options.revert) {
+ var that = this;
+ var cur = this.placeholder.offset();
+
+ this.reverting = true;
+
+ $(this.helper).animate({
+ left: cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
+ top: cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
+ }, parseInt(this.options.revert, 10) || 500, function() {
+ that._clear(event);
+ });
+ } else {
+ this._clear(event, noPropagation);
+ }
+
+ return false;
+
+ },
+
+ cancel: function() {
+
+ if(this.dragging) {
+
+ this._mouseUp({ target: null });
+
+ if(this.options.helper == "original")
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
+ else
+ this.currentItem.show();
+
+ //Post deactivating events to containers
+ for (var i = this.containers.length - 1; i >= 0; i--){
+ this.containers[i]._trigger("deactivate", null, this._uiHash(this));
+ if(this.containers[i].containerCache.over) {
+ this.containers[i]._trigger("out", null, this._uiHash(this));
+ this.containers[i].containerCache.over = 0;
+ }
+ }
+
+ }
+
+ if (this.placeholder) {
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+ if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+ if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
+
+ $.extend(this, {
+ helper: null,
+ dragging: false,
+ reverting: false,
+ _noFinalSort: null
+ });
+
+ if(this.domPosition.prev) {
+ $(this.domPosition.prev).after(this.currentItem);
+ } else {
+ $(this.domPosition.parent).prepend(this.currentItem);
+ }
+ }
+
+ return this;
+
+ },
+
+ serialize: function(o) {
+
+ var items = this._getItemsAsjQuery(o && o.connected);
+ var str = []; o = o || {};
+
+ $(items).each(function() {
+ var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
+ if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
+ });
+
+ if(!str.length && o.key) {
+ str.push(o.key + '=');
+ }
+
+ return str.join('&');
+
+ },
+
+ toArray: function(o) {
+
+ var items = this._getItemsAsjQuery(o && o.connected);
+ var ret = []; o = o || {};
+
+ items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
+ return ret;
+
+ },
+
+ /* Be careful with the following core functions */
+ _intersectsWith: function(item) {
+
+ var x1 = this.positionAbs.left,
+ x2 = x1 + this.helperProportions.width,
+ y1 = this.positionAbs.top,
+ y2 = y1 + this.helperProportions.height;
+
+ var l = item.left,
+ r = l + item.width,
+ t = item.top,
+ b = t + item.height;
+
+ var dyClick = this.offset.click.top,
+ dxClick = this.offset.click.left;
+
+ var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
+
+ if( this.options.tolerance == "pointer"
+ || this.options.forcePointerForContainers
+ || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
+ ) {
+ return isOverElement;
+ } else {
+
+ return (l < x1 + (this.helperProportions.width / 2) // Right Half
+ && x2 - (this.helperProportions.width / 2) < r // Left Half
+ && t < y1 + (this.helperProportions.height / 2) // Bottom Half
+ && y2 - (this.helperProportions.height / 2) < b ); // Top Half
+
+ }
+ },
+
+ _intersectsWithPointer: function(item) {
+
+ var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
+ isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
+ isOverElement = isOverElementHeight && isOverElementWidth,
+ verticalDirection = this._getDragVerticalDirection(),
+ horizontalDirection = this._getDragHorizontalDirection();
+
+ if (!isOverElement)
+ return false;
+
+ return this.floating ?
+ ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
+ : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
+
+ },
+
+ _intersectsWithSides: function(item) {
+
+ var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
+ isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
+ verticalDirection = this._getDragVerticalDirection(),
+ horizontalDirection = this._getDragHorizontalDirection();
+
+ if (this.floating && horizontalDirection) {
+ return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
+ } else {
+ return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
+ }
+
+ },
+
+ _getDragVerticalDirection: function() {
+ var delta = this.positionAbs.top - this.lastPositionAbs.top;
+ return delta != 0 && (delta > 0 ? "down" : "up");
+ },
+
+ _getDragHorizontalDirection: function() {
+ var delta = this.positionAbs.left - this.lastPositionAbs.left;
+ return delta != 0 && (delta > 0 ? "right" : "left");
+ },
+
+ refresh: function(event) {
+ this._refreshItems(event);
+ this.refreshPositions();
+ return this;
+ },
+
+ _connectWith: function() {
+ var options = this.options;
+ return options.connectWith.constructor == String
+ ? [options.connectWith]
+ : options.connectWith;
+ },
+
+ _getItemsAsjQuery: function(connected) {
+
+ var items = [];
+ var queries = [];
+ var connectWith = this._connectWith();
+
+ if(connectWith && connected) {
+ for (var i = connectWith.length - 1; i >= 0; i--){
+ var cur = $(connectWith[i]);
+ for (var j = cur.length - 1; j >= 0; j--){
+ var inst = $.data(cur[j], this.widgetName);
+ if(inst && inst != this && !inst.options.disabled) {
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
+ }
+ };
+ };
+ }
+
+ queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
+
+ for (var i = queries.length - 1; i >= 0; i--){
+ queries[i][0].each(function() {
+ items.push(this);
+ });
+ };
+
+ return $(items);
+
+ },
+
+ _removeCurrentsFromItems: function() {
+
+ var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
+
+ this.items = $.grep(this.items, function (item) {
+ for (var j=0; j < list.length; j++) {
+ if(list[j] == item.item[0])
+ return false;
+ };
+ return true;
+ });
+
+ },
+
+ _refreshItems: function(event) {
+
+ this.items = [];
+ this.containers = [this];
+ var items = this.items;
+ var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
+ var connectWith = this._connectWith();
+
+ if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
+ for (var i = connectWith.length - 1; i >= 0; i--){
+ var cur = $(connectWith[i]);
+ for (var j = cur.length - 1; j >= 0; j--){
+ var inst = $.data(cur[j], this.widgetName);
+ if(inst && inst != this && !inst.options.disabled) {
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
+ this.containers.push(inst);
+ }
+ };
+ };
+ }
+
+ for (var i = queries.length - 1; i >= 0; i--) {
+ var targetData = queries[i][1];
+ var _queries = queries[i][0];
+
+ for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
+ var item = $(_queries[j]);
+
+ item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager)
+
+ items.push({
+ item: item,
+ instance: targetData,
+ width: 0, height: 0,
+ left: 0, top: 0
+ });
+ };
+ };
+
+ },
+
+ refreshPositions: function(fast) {
+
+ //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
+ if(this.offsetParent && this.helper) {
+ this.offset.parent = this._getParentOffset();
+ }
+
+ for (var i = this.items.length - 1; i >= 0; i--){
+ var item = this.items[i];
+
+ //We ignore calculating positions of all connected containers when we're not over them
+ if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])
+ continue;
+
+ var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
+
+ if (!fast) {
+ item.width = t.outerWidth();
+ item.height = t.outerHeight();
+ }
+
+ var p = t.offset();
+ item.left = p.left;
+ item.top = p.top;
+ };
+
+ if(this.options.custom && this.options.custom.refreshContainers) {
+ this.options.custom.refreshContainers.call(this);
+ } else {
+ for (var i = this.containers.length - 1; i >= 0; i--){
+ var p = this.containers[i].element.offset();
+ this.containers[i].containerCache.left = p.left;
+ this.containers[i].containerCache.top = p.top;
+ this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
+ this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
+ };
+ }
+
+ return this;
+ },
+
+ _createPlaceholder: function(that) {
+ that = that || this;
+ var o = that.options;
+
+ if(!o.placeholder || o.placeholder.constructor == String) {
+ var className = o.placeholder;
+ o.placeholder = {
+ element: function() {
+
+ var el = $(document.createElement(that.currentItem[0].nodeName))
+ .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
+ .removeClass("ui-sortable-helper")[0];
+
+ if(!className)
+ el.style.visibility = "hidden";
+
+ return el;
+ },
+ update: function(container, p) {
+
+ // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
+ // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
+ if(className && !o.forcePlaceholderSize) return;
+
+ //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
+ if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css('paddingTop')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); };
+ if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); };
+ }
+ };
+ }
+
+ //Create the placeholder
+ that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
+
+ //Append it after the actual current item
+ that.currentItem.after(that.placeholder);
+
+ //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
+ o.placeholder.update(that, that.placeholder);
+
+ },
+
+ _contactContainers: function(event) {
+
+ // get innermost container that intersects with item
+ var innermostContainer = null, innermostIndex = null;
+
+
+ for (var i = this.containers.length - 1; i >= 0; i--){
+
+ // never consider a container that's located within the item itself
+ if($.contains(this.currentItem[0], this.containers[i].element[0]))
+ continue;
+
+ if(this._intersectsWith(this.containers[i].containerCache)) {
+
+ // if we've already found a container and it's more "inner" than this, then continue
+ if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0]))
+ continue;
+
+ innermostContainer = this.containers[i];
+ innermostIndex = i;
+
+ } else {
+ // container doesn't intersect. trigger "out" event if necessary
+ if(this.containers[i].containerCache.over) {
+ this.containers[i]._trigger("out", event, this._uiHash(this));
+ this.containers[i].containerCache.over = 0;
+ }
+ }
+
+ }
+
+ // if no intersecting containers found, return
+ if(!innermostContainer) return;
+
+ // move the item into the container if it's not there already
+ if(this.containers.length === 1) {
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+ this.containers[innermostIndex].containerCache.over = 1;
+ } else {
+
+ //When entering a new container, we will find the item with the least distance and append our item near it
+ var dist = 10000; var itemWithLeastDistance = null;
+ var posProperty = this.containers[innermostIndex].floating ? 'left' : 'top';
+ var sizeProperty = this.containers[innermostIndex].floating ? 'width' : 'height';
+ var base = this.positionAbs[posProperty] + this.offset.click[posProperty];
+ for (var j = this.items.length - 1; j >= 0; j--) {
+ if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
+ if(this.items[j].item[0] == this.currentItem[0]) continue;
+ var cur = this.items[j].item.offset()[posProperty];
+ var nearBottom = false;
+ if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){
+ nearBottom = true;
+ cur += this.items[j][sizeProperty];
+ }
+
+ if(Math.abs(cur - base) < dist) {
+ dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
+ this.direction = nearBottom ? "up": "down";
+ }
+ }
+
+ if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
+ return;
+
+ this.currentContainer = this.containers[innermostIndex];
+ itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
+ this._trigger("change", event, this._uiHash());
+ this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
+
+ //Update the placeholder
+ this.options.placeholder.update(this.currentContainer, this.placeholder);
+
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+ this.containers[innermostIndex].containerCache.over = 1;
+ }
+
+
+ },
+
+ _createHelper: function(event) {
+
+ var o = this.options;
+ var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
+
+ if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
+ $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
+
+ if(helper[0] == this.currentItem[0])
+ this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
+
+ if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
+ if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
+
+ return helper;
+
+ },
+
+ _adjustOffsetFromHelper: function(obj) {
+ if (typeof obj == 'string') {
+ obj = obj.split(' ');
+ }
+ if ($.isArray(obj)) {
+ obj = {left: +obj[0], top: +obj[1] || 0};
+ }
+ if ('left' in obj) {
+ this.offset.click.left = obj.left + this.margins.left;
+ }
+ if ('right' in obj) {
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+ }
+ if ('top' in obj) {
+ this.offset.click.top = obj.top + this.margins.top;
+ }
+ if ('bottom' in obj) {
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+ }
+ },
+
+ _getParentOffset: function() {
+
+
+ //Get the offsetParent and cache its position
+ this.offsetParent = this.helper.offsetParent();
+ var po = this.offsetParent.offset();
+
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
+ po.left += this.scrollParent.scrollLeft();
+ po.top += this.scrollParent.scrollTop();
+ }
+
+ if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
+ po = { top: 0, left: 0 };
+
+ return {
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+ };
+
+ },
+
+ _getRelativeOffset: function() {
+
+ if(this.cssPosition == "relative") {
+ var p = this.currentItem.position();
+ return {
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
+ };
+ } else {
+ return { top: 0, left: 0 };
+ }
+
+ },
+
+ _cacheMargins: function() {
+ this.margins = {
+ left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
+ top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
+ };
+ },
+
+ _cacheHelperProportions: function() {
+ this.helperProportions = {
+ width: this.helper.outerWidth(),
+ height: this.helper.outerHeight()
+ };
+ },
+
+ _setContainment: function() {
+
+ var o = this.options;
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
+ 0 - this.offset.relative.left - this.offset.parent.left,
+ 0 - this.offset.relative.top - this.offset.parent.top,
+ $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
+ ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+ ];
+
+ if(!(/^(document|window|parent)$/).test(o.containment)) {
+ var ce = $(o.containment)[0];
+ var co = $(o.containment).offset();
+ var over = ($(ce).css("overflow") != 'hidden');
+
+ this.containment = [
+ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
+ co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
+ co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
+ co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
+ ];
+ }
+
+ },
+
+ _convertPositionTo: function(d, pos) {
+
+ if(!pos) pos = this.position;
+ var mod = d == "absolute" ? 1 : -1;
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+ return {
+ top: (
+ pos.top // The absolute mouse position
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+ ),
+ left: (
+ pos.left // The absolute mouse position
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+ )
+ };
+
+ },
+
+ _generatePosition: function(event) {
+
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+ // This is another very weird special case that only happens for relative elements:
+ // 1. If the css position is relative
+ // 2. and the scroll parent is the document or similar to the offset parent
+ // we have to refresh the relative offset during the scroll so there are no jumps
+ if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
+ this.offset.relative = this._getRelativeOffset();
+ }
+
+ var pageX = event.pageX;
+ var pageY = event.pageY;
+
+ /*
+ * - Position constraining -
+ * Constrain the position to a mix of grid, containment.
+ */
+
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
+
+ if(this.containment) {
+ if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
+ if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
+ }
+
+ if(o.grid) {
+ var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
+ pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+
+ var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
+ pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+ }
+
+ }
+
+ return {
+ top: (
+ pageY // The absolute mouse position
+ - this.offset.click.top // Click offset (relative to the element)
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+ ),
+ left: (
+ pageX // The absolute mouse position
+ - this.offset.click.left // Click offset (relative to the element)
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+ )
+ };
+
+ },
+
+ _rearrange: function(event, i, a, hardRefresh) {
+
+ a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
+
+ //Various things done here to improve the performance:
+ // 1. we create a setTimeout, that calls refreshPositions
+ // 2. on the instance, we have a counter variable, that get's higher after every append
+ // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
+ // 4. this lets only the last addition to the timeout stack through
+ this.counter = this.counter ? ++this.counter : 1;
+ var counter = this.counter;
+
+ this._delay(function() {
+ if(counter == this.counter) this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
+ });
+
+ },
+
+ _clear: function(event, noPropagation) {
+
+ this.reverting = false;
+ // We delay all events that have to be triggered to after the point where the placeholder has been removed and
+ // everything else normalized again
+ var delayedTriggers = [];
+
+ // We first have to update the dom position of the actual currentItem
+ // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
+ if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem);
+ this._noFinalSort = null;
+
+ if(this.helper[0] == this.currentItem[0]) {
+ for(var i in this._storedCSS) {
+ if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
+ }
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
+ } else {
+ this.currentItem.show();
+ }
+
+ if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
+ if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
+
+ // Check if the items Container has Changed and trigger appropriate
+ // events.
+ if (this !== this.currentContainer) {
+ if(!noPropagation) {
+ delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
+ }
+ }
+
+
+ //Post events to containers
+ for (var i = this.containers.length - 1; i >= 0; i--){
+ if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
+ if(this.containers[i].containerCache.over) {
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
+ this.containers[i].containerCache.over = 0;
+ }
+ }
+
+ //Do what was originally in plugins
+ if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
+ if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
+ if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
+
+ this.dragging = false;
+ if(this.cancelHelperRemoval) {
+ if(!noPropagation) {
+ this._trigger("beforeStop", event, this._uiHash());
+ for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
+ this._trigger("stop", event, this._uiHash());
+ }
+
+ this.fromOutside = false;
+ return false;
+ }
+
+ if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
+
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+ this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+
+ if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
+
+ if(!noPropagation) {
+ for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
+ this._trigger("stop", event, this._uiHash());
+ }
+
+ this.fromOutside = false;
+ return true;
+
+ },
+
+ _trigger: function() {
+ if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
+ this.cancel();
+ }
+ },
+
+ _uiHash: function(_inst) {
+ var inst = _inst || this;
+ return {
+ helper: inst.helper,
+ placeholder: inst.placeholder || $([]),
+ position: inst.position,
+ originalPosition: inst.originalPosition,
+ offset: inst.positionAbs,
+ item: inst.currentItem,
+ sender: _inst ? _inst.element : null
+ };
+ }
+
+});
+
+})(jQuery);
+(function( $ ) {
+
+function modifier( fn ) {
+ return function() {
+ var previous = this.element.val();
+ fn.apply( this, arguments );
+ this._refresh();
+ if ( previous !== this.element.val() ) {
+ this._trigger( "change" );
+ }
+ };
+}
+
+$.widget( "ui.spinner", {
+ version: "1.9.2",
+ defaultElement: "<input>",
+ widgetEventPrefix: "spin",
+ options: {
+ culture: null,
+ icons: {
+ down: "ui-icon-triangle-1-s",
+ up: "ui-icon-triangle-1-n"
+ },
+ incremental: true,
+ max: null,
+ min: null,
+ numberFormat: null,
+ page: 10,
+ step: 1,
+
+ change: null,
+ spin: null,
+ start: null,
+ stop: null
+ },
+
+ _create: function() {
+ // handle string values that need to be parsed
+ this._setOption( "max", this.options.max );
+ this._setOption( "min", this.options.min );
+ this._setOption( "step", this.options.step );
+
+ // format the value, but don't constrain
+ this._value( this.element.val(), true );
+
+ this._draw();
+ this._on( this._events );
+ this._refresh();
+
+ // turning off autocomplete prevents the browser from remembering the
+ // value when navigating through history, so we re-enable autocomplete
+ // if the page is unloaded before the widget is destroyed. #7790
+ this._on( this.window, {
+ beforeunload: function() {
+ this.element.removeAttr( "autocomplete" );
+ }
+ });
+ },
+
+ _getCreateOptions: function() {
+ var options = {},
+ element = this.element;
+
+ $.each( [ "min", "max", "step" ], function( i, option ) {
+ var value = element.attr( option );
+ if ( value !== undefined && value.length ) {
+ options[ option ] = value;
+ }
+ });
+
+ return options;
+ },
+
+ _events: {
+ keydown: function( event ) {
+ if ( this._start( event ) && this._keydown( event ) ) {
+ event.preventDefault();
+ }
+ },
+ keyup: "_stop",
+ focus: function() {
+ this.previous = this.element.val();
+ },
+ blur: function( event ) {
+ if ( this.cancelBlur ) {
+ delete this.cancelBlur;
+ return;
+ }
+
+ this._refresh();
+ if ( this.previous !== this.element.val() ) {
+ this._trigger( "change", event );
+ }
+ },
+ mousewheel: function( event, delta ) {
+ if ( !delta ) {
+ return;
+ }
+ if ( !this.spinning && !this._start( event ) ) {
+ return false;
+ }
+
+ this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
+ clearTimeout( this.mousewheelTimer );
+ this.mousewheelTimer = this._delay(function() {
+ if ( this.spinning ) {
+ this._stop( event );
+ }
+ }, 100 );
+ event.preventDefault();
+ },
+ "mousedown .ui-spinner-button": function( event ) {
+ var previous;
+
+ // We never want the buttons to have focus; whenever the user is
+ // interacting with the spinner, the focus should be on the input.
+ // If the input is focused then this.previous is properly set from
+ // when the input first received focus. If the input is not focused
+ // then we need to set this.previous based on the value before spinning.
+ previous = this.element[0] === this.document[0].activeElement ?
+ this.previous : this.element.val();
+ function checkFocus() {
+ var isActive = this.element[0] === this.document[0].activeElement;
+ if ( !isActive ) {
+ this.element.focus();
+ this.previous = previous;
+ // support: IE
+ // IE sets focus asynchronously, so we need to check if focus
+ // moved off of the input because the user clicked on the button.
+ this._delay(function() {
+ this.previous = previous;
+ });
+ }
+ }
+
+ // ensure focus is on (or stays on) the text field
+ event.preventDefault();
+ checkFocus.call( this );
+
+ // support: IE
+ // IE doesn't prevent moving focus even with event.preventDefault()
+ // so we set a flag to know when we should ignore the blur event
+ // and check (again) if focus moved off of the input.
+ this.cancelBlur = true;
+ this._delay(function() {
+ delete this.cancelBlur;
+ checkFocus.call( this );
+ });
+
+ if ( this._start( event ) === false ) {
+ return;
+ }
+
+ this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
+ },
+ "mouseup .ui-spinner-button": "_stop",
+ "mouseenter .ui-spinner-button": function( event ) {
+ // button will add ui-state-active if mouse was down while mouseleave and kept down
+ if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
+ return;
+ }
+
+ if ( this._start( event ) === false ) {
+ return false;
+ }
+ this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
+ },
+ // TODO: do we really want to consider this a stop?
+ // shouldn't we just stop the repeater and wait until mouseup before
+ // we trigger the stop event?
+ "mouseleave .ui-spinner-button": "_stop"
+ },
+
+ _draw: function() {
+ var uiSpinner = this.uiSpinner = this.element
+ .addClass( "ui-spinner-input" )
+ .attr( "autocomplete", "off" )
+ .wrap( this._uiSpinnerHtml() )
+ .parent()
+ // add buttons
+ .append( this._buttonHtml() );
+
+ this.element.attr( "role", "spinbutton" );
+
+ // button bindings
+ this.buttons = uiSpinner.find( ".ui-spinner-button" )
+ .attr( "tabIndex", -1 )
+ .button()
+ .removeClass( "ui-corner-all" );
+
+ // IE 6 doesn't understand height: 50% for the buttons
+ // unless the wrapper has an explicit height
+ if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
+ uiSpinner.height() > 0 ) {
+ uiSpinner.height( uiSpinner.height() );
+ }
+
+ // disable spinner if element was already disabled
+ if ( this.options.disabled ) {
+ this.disable();
+ }
+ },
+
+ _keydown: function( event ) {
+ var options = this.options,
+ keyCode = $.ui.keyCode;
+
+ switch ( event.keyCode ) {
+ case keyCode.UP:
+ this._repeat( null, 1, event );
+ return true;
+ case keyCode.DOWN:
+ this._repeat( null, -1, event );
+ return true;
+ case keyCode.PAGE_UP:
+ this._repeat( null, options.page, event );
+ return true;
+ case keyCode.PAGE_DOWN:
+ this._repeat( null, -options.page, event );
+ return true;
+ }
+
+ return false;
+ },
+
+ _uiSpinnerHtml: function() {
+ return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
+ },
+
+ _buttonHtml: function() {
+ return "" +
+ "<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
+ "<span class='ui-icon " + this.options.icons.up + "'>&#9650;</span>" +
+ "</a>" +
+ "<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
+ "<span class='ui-icon " + this.options.icons.down + "'>&#9660;</span>" +
+ "</a>";
+ },
+
+ _start: function( event ) {
+ if ( !this.spinning && this._trigger( "start", event ) === false ) {
+ return false;
+ }
+
+ if ( !this.counter ) {
+ this.counter = 1;
+ }
+ this.spinning = true;
+ return true;
+ },
+
+ _repeat: function( i, steps, event ) {
+ i = i || 500;
+
+ clearTimeout( this.timer );
+ this.timer = this._delay(function() {
+ this._repeat( 40, steps, event );
+ }, i );
+
+ this._spin( steps * this.options.step, event );
+ },
+
+ _spin: function( step, event ) {
+ var value = this.value() || 0;
+
+ if ( !this.counter ) {
+ this.counter = 1;
+ }
+
+ value = this._adjustValue( value + step * this._increment( this.counter ) );
+
+ if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
+ this._value( value );
+ this.counter++;
+ }
+ },
+
+ _increment: function( i ) {
+ var incremental = this.options.incremental;
+
+ if ( incremental ) {
+ return $.isFunction( incremental ) ?
+ incremental( i ) :
+ Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 );
+ }
+
+ return 1;
+ },
+
+ _precision: function() {
+ var precision = this._precisionOf( this.options.step );
+ if ( this.options.min !== null ) {
+ precision = Math.max( precision, this._precisionOf( this.options.min ) );
+ }
+ return precision;
+ },
+
+ _precisionOf: function( num ) {
+ var str = num.toString(),
+ decimal = str.indexOf( "." );
+ return decimal === -1 ? 0 : str.length - decimal - 1;
+ },
+
+ _adjustValue: function( value ) {
+ var base, aboveMin,
+ options = this.options;
+
+ // make sure we're at a valid step
+ // - find out where we are relative to the base (min or 0)
+ base = options.min !== null ? options.min : 0;
+ aboveMin = value - base;
+ // - round to the nearest step
+ aboveMin = Math.round(aboveMin / options.step) * options.step;
+ // - rounding is based on 0, so adjust back to our base
+ value = base + aboveMin;
+
+ // fix precision from bad JS floating point math
+ value = parseFloat( value.toFixed( this._precision() ) );
+
+ // clamp the value
+ if ( options.max !== null && value > options.max) {
+ return options.max;
+ }
+ if ( options.min !== null && value < options.min ) {
+ return options.min;
+ }
+
+ return value;
+ },
+
+ _stop: function( event ) {
+ if ( !this.spinning ) {
+ return;
+ }
+
+ clearTimeout( this.timer );
+ clearTimeout( this.mousewheelTimer );
+ this.counter = 0;
+ this.spinning = false;
+ this._trigger( "stop", event );
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "culture" || key === "numberFormat" ) {
+ var prevValue = this._parse( this.element.val() );
+ this.options[ key ] = value;
+ this.element.val( this._format( prevValue ) );
+ return;
+ }
+
+ if ( key === "max" || key === "min" || key === "step" ) {
+ if ( typeof value === "string" ) {
+ value = this._parse( value );
+ }
+ }
+
+ this._super( key, value );
+
+ if ( key === "disabled" ) {
+ if ( value ) {
+ this.element.prop( "disabled", true );
+ this.buttons.button( "disable" );
+ } else {
+ this.element.prop( "disabled", false );
+ this.buttons.button( "enable" );
+ }
+ }
+ },
+
+ _setOptions: modifier(function( options ) {
+ this._super( options );
+ this._value( this.element.val() );
+ }),
+
+ _parse: function( val ) {
+ if ( typeof val === "string" && val !== "" ) {
+ val = window.Globalize && this.options.numberFormat ?
+ Globalize.parseFloat( val, 10, this.options.culture ) : +val;
+ }
+ return val === "" || isNaN( val ) ? null : val;
+ },
+
+ _format: function( value ) {
+ if ( value === "" ) {
+ return "";
+ }
+ return window.Globalize && this.options.numberFormat ?
+ Globalize.format( value, this.options.numberFormat, this.options.culture ) :
+ value;
+ },
+
+ _refresh: function() {
+ this.element.attr({
+ "aria-valuemin": this.options.min,
+ "aria-valuemax": this.options.max,
+ // TODO: what should we do with values that can't be parsed?
+ "aria-valuenow": this._parse( this.element.val() )
+ });
+ },
+
+ // update the value without triggering change
+ _value: function( value, allowAny ) {
+ var parsed;
+ if ( value !== "" ) {
+ parsed = this._parse( value );
+ if ( parsed !== null ) {
+ if ( !allowAny ) {
+ parsed = this._adjustValue( parsed );
+ }
+ value = this._format( parsed );
+ }
+ }
+ this.element.val( value );
+ this._refresh();
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass( "ui-spinner-input" )
+ .prop( "disabled", false )
+ .removeAttr( "autocomplete" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-valuemin" )
+ .removeAttr( "aria-valuemax" )
+ .removeAttr( "aria-valuenow" );
+ this.uiSpinner.replaceWith( this.element );
+ },
+
+ stepUp: modifier(function( steps ) {
+ this._stepUp( steps );
+ }),
+ _stepUp: function( steps ) {
+ this._spin( (steps || 1) * this.options.step );
+ },
+
+ stepDown: modifier(function( steps ) {
+ this._stepDown( steps );
+ }),
+ _stepDown: function( steps ) {
+ this._spin( (steps || 1) * -this.options.step );
+ },
+
+ pageUp: modifier(function( pages ) {
+ this._stepUp( (pages || 1) * this.options.page );
+ }),
+
+ pageDown: modifier(function( pages ) {
+ this._stepDown( (pages || 1) * this.options.page );
+ }),
+
+ value: function( newVal ) {
+ if ( !arguments.length ) {
+ return this._parse( this.element.val() );
+ }
+ modifier( this._value ).call( this, newVal );
+ },
+
+ widget: function() {
+ return this.uiSpinner;
+ }
+});
+
+}( jQuery ) );
+(function( $, undefined ) {
+
+var tabId = 0,
+ rhash = /#.*$/;
+
+function getNextTabId() {
+ return ++tabId;
+}
+
+function isLocal( anchor ) {
+ return anchor.hash.length > 1 &&
+ anchor.href.replace( rhash, "" ) ===
+ location.href.replace( rhash, "" )
+ // support: Safari 5.1
+ // Safari 5.1 doesn't encode spaces in window.location
+ // but it does encode spaces from anchors (#8777)
+ .replace( /\s/g, "%20" );
+}
+
+$.widget( "ui.tabs", {
+ version: "1.9.2",
+ delay: 300,
+ options: {
+ active: null,
+ collapsible: false,
+ event: "click",
+ heightStyle: "content",
+ hide: null,
+ show: null,
+
+ // callbacks
+ activate: null,
+ beforeActivate: null,
+ beforeLoad: null,
+ load: null
+ },
+
+ _create: function() {
+ var that = this,
+ options = this.options,
+ active = options.active,
+ locationHash = location.hash.substring( 1 );
+
+ this.running = false;
+
+ this.element
+ .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
+ .toggleClass( "ui-tabs-collapsible", options.collapsible )
+ // Prevent users from focusing disabled tabs via click
+ .delegate( ".ui-tabs-nav > li", "mousedown" + this.eventNamespace, function( event ) {
+ if ( $( this ).is( ".ui-state-disabled" ) ) {
+ event.preventDefault();
+ }
+ })
+ // support: IE <9
+ // Preventing the default action in mousedown doesn't prevent IE
+ // from focusing the element, so if the anchor gets focused, blur.
+ // We don't have to worry about focusing the previously focused
+ // element since clicking on a non-focusable element should focus
+ // the body anyway.
+ .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
+ if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
+ this.blur();
+ }
+ });
+
+ this._processTabs();
+
+ if ( active === null ) {
+ // check the fragment identifier in the URL
+ if ( locationHash ) {
+ this.tabs.each(function( i, tab ) {
+ if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
+ active = i;
+ return false;
+ }
+ });
+ }
+
+ // check for a tab marked active via a class
+ if ( active === null ) {
+ active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
+ }
+
+ // no active tab, set to false
+ if ( active === null || active === -1 ) {
+ active = this.tabs.length ? 0 : false;
+ }
+ }
+
+ // handle numbers: negative, out of range
+ if ( active !== false ) {
+ active = this.tabs.index( this.tabs.eq( active ) );
+ if ( active === -1 ) {
+ active = options.collapsible ? false : 0;
+ }
+ }
+ options.active = active;
+
+ // don't allow collapsible: false and active: false
+ if ( !options.collapsible && options.active === false && this.anchors.length ) {
+ options.active = 0;
+ }
+
+ // Take disabling tabs via class attribute from HTML
+ // into account and update option properly.
+ if ( $.isArray( options.disabled ) ) {
+ options.disabled = $.unique( options.disabled.concat(
+ $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
+ return that.tabs.index( li );
+ })
+ ) ).sort();
+ }
+
+ // check for length avoids error when initializing empty list
+ if ( this.options.active !== false && this.anchors.length ) {
+ this.active = this._findActive( this.options.active );
+ } else {
+ this.active = $();
+ }
+
+ this._refresh();
+
+ if ( this.active.length ) {
+ this.load( options.active );
+ }
+ },
+
+ _getCreateEventData: function() {
+ return {
+ tab: this.active,
+ panel: !this.active.length ? $() : this._getPanelForTab( this.active )
+ };
+ },
+
+ _tabKeydown: function( event ) {
+ var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
+ selectedIndex = this.tabs.index( focusedTab ),
+ goingForward = true;
+
+ if ( this._handlePageNav( event ) ) {
+ return;
+ }
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.RIGHT:
+ case $.ui.keyCode.DOWN:
+ selectedIndex++;
+ break;
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.LEFT:
+ goingForward = false;
+ selectedIndex--;
+ break;
+ case $.ui.keyCode.END:
+ selectedIndex = this.anchors.length - 1;
+ break;
+ case $.ui.keyCode.HOME:
+ selectedIndex = 0;
+ break;
+ case $.ui.keyCode.SPACE:
+ // Activate only, no collapsing
+ event.preventDefault();
+ clearTimeout( this.activating );
+ this._activate( selectedIndex );
+ return;
+ case $.ui.keyCode.ENTER:
+ // Toggle (cancel delayed activation, allow collapsing)
+ event.preventDefault();
+ clearTimeout( this.activating );
+ // Determine if we should collapse or activate
+ this._activate( selectedIndex === this.options.active ? false : selectedIndex );
+ return;
+ default:
+ return;
+ }
+
+ // Focus the appropriate tab, based on which key was pressed
+ event.preventDefault();
+ clearTimeout( this.activating );
+ selectedIndex = this._focusNextTab( selectedIndex, goingForward );
+
+ // Navigating with control key will prevent automatic activation
+ if ( !event.ctrlKey ) {
+ // Update aria-selected immediately so that AT think the tab is already selected.
+ // Otherwise AT may confuse the user by stating that they need to activate the tab,
+ // but the tab will already be activated by the time the announcement finishes.
+ focusedTab.attr( "aria-selected", "false" );
+ this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
+
+ this.activating = this._delay(function() {
+ this.option( "active", selectedIndex );
+ }, this.delay );
+ }
+ },
+
+ _panelKeydown: function( event ) {
+ if ( this._handlePageNav( event ) ) {
+ return;
+ }
+
+ // Ctrl+up moves focus to the current tab
+ if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
+ event.preventDefault();
+ this.active.focus();
+ }
+ },
+
+ // Alt+page up/down moves focus to the previous/next tab (and activates)
+ _handlePageNav: function( event ) {
+ if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
+ this._activate( this._focusNextTab( this.options.active - 1, false ) );
+ return true;
+ }
+ if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
+ this._activate( this._focusNextTab( this.options.active + 1, true ) );
+ return true;
+ }
+ },
+
+ _findNextTab: function( index, goingForward ) {
+ var lastTabIndex = this.tabs.length - 1;
+
+ function constrain() {
+ if ( index > lastTabIndex ) {
+ index = 0;
+ }
+ if ( index < 0 ) {
+ index = lastTabIndex;
+ }
+ return index;
+ }
+
+ while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
+ index = goingForward ? index + 1 : index - 1;
+ }
+
+ return index;
+ },
+
+ _focusNextTab: function( index, goingForward ) {
+ index = this._findNextTab( index, goingForward );
+ this.tabs.eq( index ).focus();
+ return index;
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "active" ) {
+ // _activate() will handle invalid values and update this.options
+ this._activate( value );
+ return;
+ }
+
+ if ( key === "disabled" ) {
+ // don't use the widget factory's disabled handling
+ this._setupDisabled( value );
+ return;
+ }
+
+ this._super( key, value);
+
+ if ( key === "collapsible" ) {
+ this.element.toggleClass( "ui-tabs-collapsible", value );
+ // Setting collapsible: false while collapsed; open first panel
+ if ( !value && this.options.active === false ) {
+ this._activate( 0 );
+ }
+ }
+
+ if ( key === "event" ) {
+ this._setupEvents( value );
+ }
+
+ if ( key === "heightStyle" ) {
+ this._setupHeightStyle( value );
+ }
+ },
+
+ _tabId: function( tab ) {
+ return tab.attr( "aria-controls" ) || "ui-tabs-" + getNextTabId();
+ },
+
+ _sanitizeSelector: function( hash ) {
+ return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
+ },
+
+ refresh: function() {
+ var options = this.options,
+ lis = this.tablist.children( ":has(a[href])" );
+
+ // get disabled tabs from class attribute from HTML
+ // this will get converted to a boolean if needed in _refresh()
+ options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
+ return lis.index( tab );
+ });
+
+ this._processTabs();
+
+ // was collapsed or no tabs
+ if ( options.active === false || !this.anchors.length ) {
+ options.active = false;
+ this.active = $();
+ // was active, but active tab is gone
+ } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
+ // all remaining tabs are disabled
+ if ( this.tabs.length === options.disabled.length ) {
+ options.active = false;
+ this.active = $();
+ // activate previous tab
+ } else {
+ this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
+ }
+ // was active, active tab still exists
+ } else {
+ // make sure active index is correct
+ options.active = this.tabs.index( this.active );
+ }
+
+ this._refresh();
+ },
+
+ _refresh: function() {
+ this._setupDisabled( this.options.disabled );
+ this._setupEvents( this.options.event );
+ this._setupHeightStyle( this.options.heightStyle );
+
+ this.tabs.not( this.active ).attr({
+ "aria-selected": "false",
+ tabIndex: -1
+ });
+ this.panels.not( this._getPanelForTab( this.active ) )
+ .hide()
+ .attr({
+ "aria-expanded": "false",
+ "aria-hidden": "true"
+ });
+
+ // Make sure one tab is in the tab order
+ if ( !this.active.length ) {
+ this.tabs.eq( 0 ).attr( "tabIndex", 0 );
+ } else {
+ this.active
+ .addClass( "ui-tabs-active ui-state-active" )
+ .attr({
+ "aria-selected": "true",
+ tabIndex: 0
+ });
+ this._getPanelForTab( this.active )
+ .show()
+ .attr({
+ "aria-expanded": "true",
+ "aria-hidden": "false"
+ });
+ }
+ },
+
+ _processTabs: function() {
+ var that = this;
+
+ this.tablist = this._getList()
+ .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
+ .attr( "role", "tablist" );
+
+ this.tabs = this.tablist.find( "> li:has(a[href])" )
+ .addClass( "ui-state-default ui-corner-top" )
+ .attr({
+ role: "tab",
+ tabIndex: -1
+ });
+
+ this.anchors = this.tabs.map(function() {
+ return $( "a", this )[ 0 ];
+ })
+ .addClass( "ui-tabs-anchor" )
+ .attr({
+ role: "presentation",
+ tabIndex: -1
+ });
+
+ this.panels = $();
+
+ this.anchors.each(function( i, anchor ) {
+ var selector, panel, panelId,
+ anchorId = $( anchor ).uniqueId().attr( "id" ),
+ tab = $( anchor ).closest( "li" ),
+ originalAriaControls = tab.attr( "aria-controls" );
+
+ // inline tab
+ if ( isLocal( anchor ) ) {
+ selector = anchor.hash;
+ panel = that.element.find( that._sanitizeSelector( selector ) );
+ // remote tab
+ } else {
+ panelId = that._tabId( tab );
+ selector = "#" + panelId;
+ panel = that.element.find( selector );
+ if ( !panel.length ) {
+ panel = that._createPanel( panelId );
+ panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
+ }
+ panel.attr( "aria-live", "polite" );
+ }
+
+ if ( panel.length) {
+ that.panels = that.panels.add( panel );
+ }
+ if ( originalAriaControls ) {
+ tab.data( "ui-tabs-aria-controls", originalAriaControls );
+ }
+ tab.attr({
+ "aria-controls": selector.substring( 1 ),
+ "aria-labelledby": anchorId
+ });
+ panel.attr( "aria-labelledby", anchorId );
+ });
+
+ this.panels
+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+ .attr( "role", "tabpanel" );
+ },
+
+ // allow overriding how to find the list for rare usage scenarios (#7715)
+ _getList: function() {
+ return this.element.find( "ol,ul" ).eq( 0 );
+ },
+
+ _createPanel: function( id ) {
+ return $( "<div>" )
+ .attr( "id", id )
+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+ .data( "ui-tabs-destroy", true );
+ },
+
+ _setupDisabled: function( disabled ) {
+ if ( $.isArray( disabled ) ) {
+ if ( !disabled.length ) {
+ disabled = false;
+ } else if ( disabled.length === this.anchors.length ) {
+ disabled = true;
+ }
+ }
+
+ // disable tabs
+ for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) {
+ if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
+ $( li )
+ .addClass( "ui-state-disabled" )
+ .attr( "aria-disabled", "true" );
+ } else {
+ $( li )
+ .removeClass( "ui-state-disabled" )
+ .removeAttr( "aria-disabled" );
+ }
+ }
+
+ this.options.disabled = disabled;
+ },
+
+ _setupEvents: function( event ) {
+ var events = {
+ click: function( event ) {
+ event.preventDefault();
+ }
+ };
+ if ( event ) {
+ $.each( event.split(" "), function( index, eventName ) {
+ events[ eventName ] = "_eventHandler";
+ });
+ }
+
+ this._off( this.anchors.add( this.tabs ).add( this.panels ) );
+ this._on( this.anchors, events );
+ this._on( this.tabs, { keydown: "_tabKeydown" } );
+ this._on( this.panels, { keydown: "_panelKeydown" } );
+
+ this._focusable( this.tabs );
+ this._hoverable( this.tabs );
+ },
+
+ _setupHeightStyle: function( heightStyle ) {
+ var maxHeight, overflow,
+ parent = this.element.parent();
+
+ if ( heightStyle === "fill" ) {
+ // IE 6 treats height like minHeight, so we need to turn off overflow
+ // in order to get a reliable height
+ // we use the minHeight support test because we assume that only
+ // browsers that don't support minHeight will treat height as minHeight
+ if ( !$.support.minHeight ) {
+ overflow = parent.css( "overflow" );
+ parent.css( "overflow", "hidden");
+ }
+ maxHeight = parent.height();
+ this.element.siblings( ":visible" ).each(function() {
+ var elem = $( this ),
+ position = elem.css( "position" );
+
+ if ( position === "absolute" || position === "fixed" ) {
+ return;
+ }
+ maxHeight -= elem.outerHeight( true );
+ });
+ if ( overflow ) {
+ parent.css( "overflow", overflow );
+ }
+
+ this.element.children().not( this.panels ).each(function() {
+ maxHeight -= $( this ).outerHeight( true );
+ });
+
+ this.panels.each(function() {
+ $( this ).height( Math.max( 0, maxHeight -
+ $( this ).innerHeight() + $( this ).height() ) );
+ })
+ .css( "overflow", "auto" );
+ } else if ( heightStyle === "auto" ) {
+ maxHeight = 0;
+ this.panels.each(function() {
+ maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
+ }).height( maxHeight );
+ }
+ },
+
+ _eventHandler: function( event ) {
+ var options = this.options,
+ active = this.active,
+ anchor = $( event.currentTarget ),
+ tab = anchor.closest( "li" ),
+ clickedIsActive = tab[ 0 ] === active[ 0 ],
+ collapsing = clickedIsActive && options.collapsible,
+ toShow = collapsing ? $() : this._getPanelForTab( tab ),
+ toHide = !active.length ? $() : this._getPanelForTab( active ),
+ eventData = {
+ oldTab: active,
+ oldPanel: toHide,
+ newTab: collapsing ? $() : tab,
+ newPanel: toShow
+ };
+
+ event.preventDefault();
+
+ if ( tab.hasClass( "ui-state-disabled" ) ||
+ // tab is already loading
+ tab.hasClass( "ui-tabs-loading" ) ||
+ // can't switch durning an animation
+ this.running ||
+ // click on active header, but not collapsible
+ ( clickedIsActive && !options.collapsible ) ||
+ // allow canceling activation
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
+ return;
+ }
+
+ options.active = collapsing ? false : this.tabs.index( tab );
+
+ this.active = clickedIsActive ? $() : tab;
+ if ( this.xhr ) {
+ this.xhr.abort();
+ }
+
+ if ( !toHide.length && !toShow.length ) {
+ $.error( "jQuery UI Tabs: Mismatching fragment identifier." );
+ }
+
+ if ( toShow.length ) {
+ this.load( this.tabs.index( tab ), event );
+ }
+ this._toggle( event, eventData );
+ },
+
+ // handles show/hide for selecting tabs
+ _toggle: function( event, eventData ) {
+ var that = this,
+ toShow = eventData.newPanel,
+ toHide = eventData.oldPanel;
+
+ this.running = true;
+
+ function complete() {
+ that.running = false;
+ that._trigger( "activate", event, eventData );
+ }
+
+ function show() {
+ eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
+
+ if ( toShow.length && that.options.show ) {
+ that._show( toShow, that.options.show, complete );
+ } else {
+ toShow.show();
+ complete();
+ }
+ }
+
+ // start out by hiding, then showing, then completing
+ if ( toHide.length && this.options.hide ) {
+ this._hide( toHide, this.options.hide, function() {
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+ show();
+ });
+ } else {
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+ toHide.hide();
+ show();
+ }
+
+ toHide.attr({
+ "aria-expanded": "false",
+ "aria-hidden": "true"
+ });
+ eventData.oldTab.attr( "aria-selected", "false" );
+ // If we're switching tabs, remove the old tab from the tab order.
+ // If we're opening from collapsed state, remove the previous tab from the tab order.
+ // If we're collapsing, then keep the collapsing tab in the tab order.
+ if ( toShow.length && toHide.length ) {
+ eventData.oldTab.attr( "tabIndex", -1 );
+ } else if ( toShow.length ) {
+ this.tabs.filter(function() {
+ return $( this ).attr( "tabIndex" ) === 0;
+ })
+ .attr( "tabIndex", -1 );
+ }
+
+ toShow.attr({
+ "aria-expanded": "true",
+ "aria-hidden": "false"
+ });
+ eventData.newTab.attr({
+ "aria-selected": "true",
+ tabIndex: 0
+ });
+ },
+
+ _activate: function( index ) {
+ var anchor,
+ active = this._findActive( index );
+
+ // trying to activate the already active panel
+ if ( active[ 0 ] === this.active[ 0 ] ) {
+ return;
+ }
+
+ // trying to collapse, simulate a click on the current active header
+ if ( !active.length ) {
+ active = this.active;
+ }
+
+ anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
+ this._eventHandler({
+ target: anchor,
+ currentTarget: anchor,
+ preventDefault: $.noop
+ });
+ },
+
+ _findActive: function( index ) {
+ return index === false ? $() : this.tabs.eq( index );
+ },
+
+ _getIndex: function( index ) {
+ // meta-function to give users option to provide a href string instead of a numerical index.
+ if ( typeof index === "string" ) {
+ index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
+ }
+
+ return index;
+ },
+
+ _destroy: function() {
+ if ( this.xhr ) {
+ this.xhr.abort();
+ }
+
+ this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );
+
+ this.tablist
+ .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
+ .removeAttr( "role" );
+
+ this.anchors
+ .removeClass( "ui-tabs-anchor" )
+ .removeAttr( "role" )
+ .removeAttr( "tabIndex" )
+ .removeData( "href.tabs" )
+ .removeData( "load.tabs" )
+ .removeUniqueId();
+
+ this.tabs.add( this.panels ).each(function() {
+ if ( $.data( this, "ui-tabs-destroy" ) ) {
+ $( this ).remove();
+ } else {
+ $( this )
+ .removeClass( "ui-state-default ui-state-active ui-state-disabled " +
+ "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" )
+ .removeAttr( "tabIndex" )
+ .removeAttr( "aria-live" )
+ .removeAttr( "aria-busy" )
+ .removeAttr( "aria-selected" )
+ .removeAttr( "aria-labelledby" )
+ .removeAttr( "aria-hidden" )
+ .removeAttr( "aria-expanded" )
+ .removeAttr( "role" );
+ }
+ });
+
+ this.tabs.each(function() {
+ var li = $( this ),
+ prev = li.data( "ui-tabs-aria-controls" );
+ if ( prev ) {
+ li.attr( "aria-controls", prev );
+ } else {
+ li.removeAttr( "aria-controls" );
+ }
+ });
+
+ this.panels.show();
+
+ if ( this.options.heightStyle !== "content" ) {
+ this.panels.css( "height", "" );
+ }
+ },
+
+ enable: function( index ) {
+ var disabled = this.options.disabled;
+ if ( disabled === false ) {
+ return;
+ }
+
+ if ( index === undefined ) {
+ disabled = false;
+ } else {
+ index = this._getIndex( index );
+ if ( $.isArray( disabled ) ) {
+ disabled = $.map( disabled, function( num ) {
+ return num !== index ? num : null;
+ });
+ } else {
+ disabled = $.map( this.tabs, function( li, num ) {
+ return num !== index ? num : null;
+ });
+ }
+ }
+ this._setupDisabled( disabled );
+ },
+
+ disable: function( index ) {
+ var disabled = this.options.disabled;
+ if ( disabled === true ) {
+ return;
+ }
+
+ if ( index === undefined ) {
+ disabled = true;
+ } else {
+ index = this._getIndex( index );
+ if ( $.inArray( index, disabled ) !== -1 ) {
+ return;
+ }
+ if ( $.isArray( disabled ) ) {
+ disabled = $.merge( [ index ], disabled ).sort();
+ } else {
+ disabled = [ index ];
+ }
+ }
+ this._setupDisabled( disabled );
+ },
+
+ load: function( index, event ) {
+ index = this._getIndex( index );
+ var that = this,
+ tab = this.tabs.eq( index ),
+ anchor = tab.find( ".ui-tabs-anchor" ),
+ panel = this._getPanelForTab( tab ),
+ eventData = {
+ tab: tab,
+ panel: panel
+ };
+
+ // not remote
+ if ( isLocal( anchor[ 0 ] ) ) {
+ return;
+ }
+
+ this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
+
+ // support: jQuery <1.8
+ // jQuery <1.8 returns false if the request is canceled in beforeSend,
+ // but as of 1.8, $.ajax() always returns a jqXHR object.
+ if ( this.xhr && this.xhr.statusText !== "canceled" ) {
+ tab.addClass( "ui-tabs-loading" );
+ panel.attr( "aria-busy", "true" );
+
+ this.xhr
+ .success(function( response ) {
+ // support: jQuery <1.8
+ // http://bugs.jquery.com/ticket/11778
+ setTimeout(function() {
+ panel.html( response );
+ that._trigger( "load", event, eventData );
+ }, 1 );
+ })
+ .complete(function( jqXHR, status ) {
+ // support: jQuery <1.8
+ // http://bugs.jquery.com/ticket/11778
+ setTimeout(function() {
+ if ( status === "abort" ) {
+ that.panels.stop( false, true );
+ }
+
+ tab.removeClass( "ui-tabs-loading" );
+ panel.removeAttr( "aria-busy" );
+
+ if ( jqXHR === that.xhr ) {
+ delete that.xhr;
+ }
+ }, 1 );
+ });
+ }
+ },
+
+ // TODO: Remove this function in 1.10 when ajaxOptions is removed
+ _ajaxSettings: function( anchor, event, eventData ) {
+ var that = this;
+ return {
+ url: anchor.attr( "href" ),
+ beforeSend: function( jqXHR, settings ) {
+ return that._trigger( "beforeLoad", event,
+ $.extend( { jqXHR : jqXHR, ajaxSettings: settings }, eventData ) );
+ }
+ };
+ },
+
+ _getPanelForTab: function( tab ) {
+ var id = $( tab ).attr( "aria-controls" );
+ return this.element.find( this._sanitizeSelector( "#" + id ) );
+ }
+});
+
+// DEPRECATED
+if ( $.uiBackCompat !== false ) {
+
+ // helper method for a lot of the back compat extensions
+ $.ui.tabs.prototype._ui = function( tab, panel ) {
+ return {
+ tab: tab,
+ panel: panel,
+ index: this.anchors.index( tab )
+ };
+ };
+
+ // url method
+ $.widget( "ui.tabs", $.ui.tabs, {
+ url: function( index, url ) {
+ this.anchors.eq( index ).attr( "href", url );
+ }
+ });
+
+ // TODO: Remove _ajaxSettings() method when removing this extension
+ // ajaxOptions and cache options
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ ajaxOptions: null,
+ cache: false
+ },
+
+ _create: function() {
+ this._super();
+
+ var that = this;
+
+ this._on({ tabsbeforeload: function( event, ui ) {
+ // tab is already cached
+ if ( $.data( ui.tab[ 0 ], "cache.tabs" ) ) {
+ event.preventDefault();
+ return;
+ }
+
+ ui.jqXHR.success(function() {
+ if ( that.options.cache ) {
+ $.data( ui.tab[ 0 ], "cache.tabs", true );
+ }
+ });
+ }});
+ },
+
+ _ajaxSettings: function( anchor, event, ui ) {
+ var ajaxOptions = this.options.ajaxOptions;
+ return $.extend( {}, ajaxOptions, {
+ error: function( xhr, status ) {
+ try {
+ // Passing index avoid a race condition when this method is
+ // called after the user has selected another tab.
+ // Pass the anchor that initiated this request allows
+ // loadError to manipulate the tab content panel via $(a.hash)
+ ajaxOptions.error(
+ xhr, status, ui.tab.closest( "li" ).index(), ui.tab[ 0 ] );
+ }
+ catch ( error ) {}
+ }
+ }, this._superApply( arguments ) );
+ },
+
+ _setOption: function( key, value ) {
+ // reset cache if switching from cached to not cached
+ if ( key === "cache" && value === false ) {
+ this.anchors.removeData( "cache.tabs" );
+ }
+ this._super( key, value );
+ },
+
+ _destroy: function() {
+ this.anchors.removeData( "cache.tabs" );
+ this._super();
+ },
+
+ url: function( index ){
+ this.anchors.eq( index ).removeData( "cache.tabs" );
+ this._superApply( arguments );
+ }
+ });
+
+ // abort method
+ $.widget( "ui.tabs", $.ui.tabs, {
+ abort: function() {
+ if ( this.xhr ) {
+ this.xhr.abort();
+ }
+ }
+ });
+
+ // spinner
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ spinner: "<em>Loading&#8230;</em>"
+ },
+ _create: function() {
+ this._super();
+ this._on({
+ tabsbeforeload: function( event, ui ) {
+ // Don't react to nested tabs or tabs that don't use a spinner
+ if ( event.target !== this.element[ 0 ] ||
+ !this.options.spinner ) {
+ return;
+ }
+
+ var span = ui.tab.find( "span" ),
+ html = span.html();
+ span.html( this.options.spinner );
+ ui.jqXHR.complete(function() {
+ span.html( html );
+ });
+ }
+ });
+ }
+ });
+
+ // enable/disable events
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ enable: null,
+ disable: null
+ },
+
+ enable: function( index ) {
+ var options = this.options,
+ trigger;
+
+ if ( index && options.disabled === true ||
+ ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) !== -1 ) ) {
+ trigger = true;
+ }
+
+ this._superApply( arguments );
+
+ if ( trigger ) {
+ this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
+ }
+ },
+
+ disable: function( index ) {
+ var options = this.options,
+ trigger;
+
+ if ( index && options.disabled === false ||
+ ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) === -1 ) ) {
+ trigger = true;
+ }
+
+ this._superApply( arguments );
+
+ if ( trigger ) {
+ this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
+ }
+ }
+ });
+
+ // add/remove methods and events
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ add: null,
+ remove: null,
+ tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
+ },
+
+ add: function( url, label, index ) {
+ if ( index === undefined ) {
+ index = this.anchors.length;
+ }
+
+ var doInsertAfter, panel,
+ options = this.options,
+ li = $( options.tabTemplate
+ .replace( /#\{href\}/g, url )
+ .replace( /#\{label\}/g, label ) ),
+ id = !url.indexOf( "#" ) ?
+ url.replace( "#", "" ) :
+ this._tabId( li );
+
+ li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true );
+ li.attr( "aria-controls", id );
+
+ doInsertAfter = index >= this.tabs.length;
+
+ // try to find an existing element before creating a new one
+ panel = this.element.find( "#" + id );
+ if ( !panel.length ) {
+ panel = this._createPanel( id );
+ if ( doInsertAfter ) {
+ if ( index > 0 ) {
+ panel.insertAfter( this.panels.eq( -1 ) );
+ } else {
+ panel.appendTo( this.element );
+ }
+ } else {
+ panel.insertBefore( this.panels[ index ] );
+ }
+ }
+ panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ).hide();
+
+ if ( doInsertAfter ) {
+ li.appendTo( this.tablist );
+ } else {
+ li.insertBefore( this.tabs[ index ] );
+ }
+
+ options.disabled = $.map( options.disabled, function( n ) {
+ return n >= index ? ++n : n;
+ });
+
+ this.refresh();
+ if ( this.tabs.length === 1 && options.active === false ) {
+ this.option( "active", 0 );
+ }
+
+ this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
+ return this;
+ },
+
+ remove: function( index ) {
+ index = this._getIndex( index );
+ var options = this.options,
+ tab = this.tabs.eq( index ).remove(),
+ panel = this._getPanelForTab( tab ).remove();
+
+ // If selected tab was removed focus tab to the right or
+ // in case the last tab was removed the tab to the left.
+ // We check for more than 2 tabs, because if there are only 2,
+ // then when we remove this tab, there will only be one tab left
+ // so we don't need to detect which tab to activate.
+ if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 2 ) {
+ this._activate( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
+ }
+
+ options.disabled = $.map(
+ $.grep( options.disabled, function( n ) {
+ return n !== index;
+ }),
+ function( n ) {
+ return n >= index ? --n : n;
+ });
+
+ this.refresh();
+
+ this._trigger( "remove", null, this._ui( tab.find( "a" )[ 0 ], panel[ 0 ] ) );
+ return this;
+ }
+ });
+
+ // length method
+ $.widget( "ui.tabs", $.ui.tabs, {
+ length: function() {
+ return this.anchors.length;
+ }
+ });
+
+ // panel ids (idPrefix option + title attribute)
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ idPrefix: "ui-tabs-"
+ },
+
+ _tabId: function( tab ) {
+ var a = tab.is( "li" ) ? tab.find( "a[href]" ) : tab;
+ a = a[0];
+ return $( a ).closest( "li" ).attr( "aria-controls" ) ||
+ a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF\-]/g, "" ) ||
+ this.options.idPrefix + getNextTabId();
+ }
+ });
+
+ // _createPanel method
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ panelTemplate: "<div></div>"
+ },
+
+ _createPanel: function( id ) {
+ return $( this.options.panelTemplate )
+ .attr( "id", id )
+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+ .data( "ui-tabs-destroy", true );
+ }
+ });
+
+ // selected option
+ $.widget( "ui.tabs", $.ui.tabs, {
+ _create: function() {
+ var options = this.options;
+ if ( options.active === null && options.selected !== undefined ) {
+ options.active = options.selected === -1 ? false : options.selected;
+ }
+ this._super();
+ options.selected = options.active;
+ if ( options.selected === false ) {
+ options.selected = -1;
+ }
+ },
+
+ _setOption: function( key, value ) {
+ if ( key !== "selected" ) {
+ return this._super( key, value );
+ }
+
+ var options = this.options;
+ this._super( "active", value === -1 ? false : value );
+ options.selected = options.active;
+ if ( options.selected === false ) {
+ options.selected = -1;
+ }
+ },
+
+ _eventHandler: function() {
+ this._superApply( arguments );
+ this.options.selected = this.options.active;
+ if ( this.options.selected === false ) {
+ this.options.selected = -1;
+ }
+ }
+ });
+
+ // show and select event
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ show: null,
+ select: null
+ },
+ _create: function() {
+ this._super();
+ if ( this.options.active !== false ) {
+ this._trigger( "show", null, this._ui(
+ this.active.find( ".ui-tabs-anchor" )[ 0 ],
+ this._getPanelForTab( this.active )[ 0 ] ) );
+ }
+ },
+ _trigger: function( type, event, data ) {
+ var tab, panel,
+ ret = this._superApply( arguments );
+
+ if ( !ret ) {
+ return false;
+ }
+
+ if ( type === "beforeActivate" ) {
+ tab = data.newTab.length ? data.newTab : data.oldTab;
+ panel = data.newPanel.length ? data.newPanel : data.oldPanel;
+ ret = this._super( "select", event, {
+ tab: tab.find( ".ui-tabs-anchor" )[ 0],
+ panel: panel[ 0 ],
+ index: tab.closest( "li" ).index()
+ });
+ } else if ( type === "activate" && data.newTab.length ) {
+ ret = this._super( "show", event, {
+ tab: data.newTab.find( ".ui-tabs-anchor" )[ 0 ],
+ panel: data.newPanel[ 0 ],
+ index: data.newTab.closest( "li" ).index()
+ });
+ }
+ return ret;
+ }
+ });
+
+ // select method
+ $.widget( "ui.tabs", $.ui.tabs, {
+ select: function( index ) {
+ index = this._getIndex( index );
+ if ( index === -1 ) {
+ if ( this.options.collapsible && this.options.selected !== -1 ) {
+ index = this.options.selected;
+ } else {
+ return;
+ }
+ }
+ this.anchors.eq( index ).trigger( this.options.event + this.eventNamespace );
+ }
+ });
+
+ // cookie option
+ (function() {
+
+ var listId = 0;
+
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ cookie: null // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
+ },
+ _create: function() {
+ var options = this.options,
+ active;
+ if ( options.active == null && options.cookie ) {
+ active = parseInt( this._cookie(), 10 );
+ if ( active === -1 ) {
+ active = false;
+ }
+ options.active = active;
+ }
+ this._super();
+ },
+ _cookie: function( active ) {
+ var cookie = [ this.cookie ||
+ ( this.cookie = this.options.cookie.name || "ui-tabs-" + (++listId) ) ];
+ if ( arguments.length ) {
+ cookie.push( active === false ? -1 : active );
+ cookie.push( this.options.cookie );
+ }
+ return $.cookie.apply( null, cookie );
+ },
+ _refresh: function() {
+ this._super();
+ if ( this.options.cookie ) {
+ this._cookie( this.options.active, this.options.cookie );
+ }
+ },
+ _eventHandler: function() {
+ this._superApply( arguments );
+ if ( this.options.cookie ) {
+ this._cookie( this.options.active, this.options.cookie );
+ }
+ },
+ _destroy: function() {
+ this._super();
+ if ( this.options.cookie ) {
+ this._cookie( null, this.options.cookie );
+ }
+ }
+ });
+
+ })();
+
+ // load event
+ $.widget( "ui.tabs", $.ui.tabs, {
+ _trigger: function( type, event, data ) {
+ var _data = $.extend( {}, data );
+ if ( type === "load" ) {
+ _data.panel = _data.panel[ 0 ];
+ _data.tab = _data.tab.find( ".ui-tabs-anchor" )[ 0 ];
+ }
+ return this._super( type, event, _data );
+ }
+ });
+
+ // fx option
+ // The new animation options (show, hide) conflict with the old show callback.
+ // The old fx option wins over show/hide anyway (always favor back-compat).
+ // If a user wants to use the new animation API, they must give up the old API.
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
+ fx: null // e.g. { height: "toggle", opacity: "toggle", duration: 200 }
+ },
+
+ _getFx: function() {
+ var hide, show,
+ fx = this.options.fx;
+
+ if ( fx ) {
+ if ( $.isArray( fx ) ) {
+ hide = fx[ 0 ];
+ show = fx[ 1 ];
+ } else {
+ hide = show = fx;
+ }
+ }
+
+ return fx ? { show: show, hide: hide } : null;
+ },
+
+ _toggle: function( event, eventData ) {
+ var that = this,
+ toShow = eventData.newPanel,
+ toHide = eventData.oldPanel,
+ fx = this._getFx();
+
+ if ( !fx ) {
+ return this._super( event, eventData );
+ }
+
+ that.running = true;
+
+ function complete() {
+ that.running = false;
+ that._trigger( "activate", event, eventData );
+ }
+
+ function show() {
+ eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
+
+ if ( toShow.length && fx.show ) {
+ toShow
+ .animate( fx.show, fx.show.duration, function() {
+ complete();
+ });
+ } else {
+ toShow.show();
+ complete();
+ }
+ }
+
+ // start out by hiding, then showing, then completing
+ if ( toHide.length && fx.hide ) {
+ toHide.animate( fx.hide, fx.hide.duration, function() {
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+ show();
+ });
+ } else {
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+ toHide.hide();
+ show();
+ }
+ }
+ });
+}
+
+})( jQuery );
+(function( $ ) {
+
+var increments = 0;
+
+function addDescribedBy( elem, id ) {
+ var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
+ describedby.push( id );
+ elem
+ .data( "ui-tooltip-id", id )
+ .attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
+}
+
+function removeDescribedBy( elem ) {
+ var id = elem.data( "ui-tooltip-id" ),
+ describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
+ index = $.inArray( id, describedby );
+ if ( index !== -1 ) {
+ describedby.splice( index, 1 );
+ }
+
+ elem.removeData( "ui-tooltip-id" );
+ describedby = $.trim( describedby.join( " " ) );
+ if ( describedby ) {
+ elem.attr( "aria-describedby", describedby );
+ } else {
+ elem.removeAttr( "aria-describedby" );
+ }
+}
+
+$.widget( "ui.tooltip", {
+ version: "1.9.2",
+ options: {
+ content: function() {
+ return $( this ).attr( "title" );
+ },
+ hide: true,
+ // Disabled elements have inconsistent behavior across browsers (#8661)
+ items: "[title]:not([disabled])",
+ position: {
+ my: "left top+15",
+ at: "left bottom",
+ collision: "flipfit flip"
+ },
+ show: true,
+ tooltipClass: null,
+ track: false,
+
+ // callbacks
+ close: null,
+ open: null
+ },
+
+ _create: function() {
+ this._on({
+ mouseover: "open",
+ focusin: "open"
+ });
+
+ // IDs of generated tooltips, needed for destroy
+ this.tooltips = {};
+ // IDs of parent tooltips where we removed the title attribute
+ this.parents = {};
+
+ if ( this.options.disabled ) {
+ this._disable();
+ }
+ },
+
+ _setOption: function( key, value ) {
+ var that = this;
+
+ if ( key === "disabled" ) {
+ this[ value ? "_disable" : "_enable" ]();
+ this.options[ key ] = value;
+ // disable element style changes
+ return;
+ }
+
+ this._super( key, value );
+
+ if ( key === "content" ) {
+ $.each( this.tooltips, function( id, element ) {
+ that._updateContent( element );
+ });
+ }
+ },
+
+ _disable: function() {
+ var that = this;
+
+ // close open tooltips
+ $.each( this.tooltips, function( id, element ) {
+ var event = $.Event( "blur" );
+ event.target = event.currentTarget = element[0];
+ that.close( event, true );
+ });
+
+ // remove title attributes to prevent native tooltips
+ this.element.find( this.options.items ).andSelf().each(function() {
+ var element = $( this );
+ if ( element.is( "[title]" ) ) {
+ element
+ .data( "ui-tooltip-title", element.attr( "title" ) )
+ .attr( "title", "" );
+ }
+ });
+ },
+
+ _enable: function() {
+ // restore title attributes
+ this.element.find( this.options.items ).andSelf().each(function() {
+ var element = $( this );
+ if ( element.data( "ui-tooltip-title" ) ) {
+ element.attr( "title", element.data( "ui-tooltip-title" ) );
+ }
+ });
+ },
+
+ open: function( event ) {
+ var that = this,
+ target = $( event ? event.target : this.element )
+ // we need closest here due to mouseover bubbling,
+ // but always pointing at the same event target
+ .closest( this.options.items );
+
+ // No element to show a tooltip for or the tooltip is already open
+ if ( !target.length || target.data( "ui-tooltip-id" ) ) {
+ return;
+ }
+
+ if ( target.attr( "title" ) ) {
+ target.data( "ui-tooltip-title", target.attr( "title" ) );
+ }
+
+ target.data( "ui-tooltip-open", true );
+
+ // kill parent tooltips, custom or native, for hover
+ if ( event && event.type === "mouseover" ) {
+ target.parents().each(function() {
+ var parent = $( this ),
+ blurEvent;
+ if ( parent.data( "ui-tooltip-open" ) ) {
+ blurEvent = $.Event( "blur" );
+ blurEvent.target = blurEvent.currentTarget = this;
+ that.close( blurEvent, true );
+ }
+ if ( parent.attr( "title" ) ) {
+ parent.uniqueId();
+ that.parents[ this.id ] = {
+ element: this,
+ title: parent.attr( "title" )
+ };
+ parent.attr( "title", "" );
+ }
+ });
+ }
+
+ this._updateContent( target, event );
+ },
+
+ _updateContent: function( target, event ) {
+ var content,
+ contentOption = this.options.content,
+ that = this,
+ eventType = event ? event.type : null;
+
+ if ( typeof contentOption === "string" ) {
+ return this._open( event, target, contentOption );
+ }
+
+ content = contentOption.call( target[0], function( response ) {
+ // ignore async response if tooltip was closed already
+ if ( !target.data( "ui-tooltip-open" ) ) {
+ return;
+ }
+ // IE may instantly serve a cached response for ajax requests
+ // delay this call to _open so the other call to _open runs first
+ that._delay(function() {
+ // jQuery creates a special event for focusin when it doesn't
+ // exist natively. To improve performance, the native event
+ // object is reused and the type is changed. Therefore, we can't
+ // rely on the type being correct after the event finished
+ // bubbling, so we set it back to the previous value. (#8740)
+ if ( event ) {
+ event.type = eventType;
+ }
+ this._open( event, target, response );
+ });
+ });
+ if ( content ) {
+ this._open( event, target, content );
+ }
+ },
+
+ _open: function( event, target, content ) {
+ var tooltip, events, delayedShow,
+ positionOption = $.extend( {}, this.options.position );
+
+ if ( !content ) {
+ return;
+ }
+
+ // Content can be updated multiple times. If the tooltip already
+ // exists, then just update the content and bail.
+ tooltip = this._find( target );
+ if ( tooltip.length ) {
+ tooltip.find( ".ui-tooltip-content" ).html( content );
+ return;
+ }
+
+ // if we have a title, clear it to prevent the native tooltip
+ // we have to check first to avoid defining a title if none exists
+ // (we don't want to cause an element to start matching [title])
+ //
+ // We use removeAttr only for key events, to allow IE to export the correct
+ // accessible attributes. For mouse events, set to empty string to avoid
+ // native tooltip showing up (happens only when removing inside mouseover).
+ if ( target.is( "[title]" ) ) {
+ if ( event && event.type === "mouseover" ) {
+ target.attr( "title", "" );
+ } else {
+ target.removeAttr( "title" );
+ }
+ }
+
+ tooltip = this._tooltip( target );
+ addDescribedBy( target, tooltip.attr( "id" ) );
+ tooltip.find( ".ui-tooltip-content" ).html( content );
+
+ function position( event ) {
+ positionOption.of = event;
+ if ( tooltip.is( ":hidden" ) ) {
+ return;
+ }
+ tooltip.position( positionOption );
+ }
+ if ( this.options.track && event && /^mouse/.test( event.type ) ) {
+ this._on( this.document, {
+ mousemove: position
+ });
+ // trigger once to override element-relative positioning
+ position( event );
+ } else {
+ tooltip.position( $.extend({
+ of: target
+ }, this.options.position ) );
+ }
+
+ tooltip.hide();
+
+ this._show( tooltip, this.options.show );
+ // Handle tracking tooltips that are shown with a delay (#8644). As soon
+ // as the tooltip is visible, position the tooltip using the most recent
+ // event.
+ if ( this.options.show && this.options.show.delay ) {
+ delayedShow = setInterval(function() {
+ if ( tooltip.is( ":visible" ) ) {
+ position( positionOption.of );
+ clearInterval( delayedShow );
+ }
+ }, $.fx.interval );
+ }
+
+ this._trigger( "open", event, { tooltip: tooltip } );
+
+ events = {
+ keyup: function( event ) {
+ if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
+ var fakeEvent = $.Event(event);
+ fakeEvent.currentTarget = target[0];
+ this.close( fakeEvent, true );
+ }
+ },
+ remove: function() {
+ this._removeTooltip( tooltip );
+ }
+ };
+ if ( !event || event.type === "mouseover" ) {
+ events.mouseleave = "close";
+ }
+ if ( !event || event.type === "focusin" ) {
+ events.focusout = "close";
+ }
+ this._on( true, target, events );
+ },
+
+ close: function( event ) {
+ var that = this,
+ target = $( event ? event.currentTarget : this.element ),
+ tooltip = this._find( target );
+
+ // disabling closes the tooltip, so we need to track when we're closing
+ // to avoid an infinite loop in case the tooltip becomes disabled on close
+ if ( this.closing ) {
+ return;
+ }
+
+ // only set title if we had one before (see comment in _open())
+ if ( target.data( "ui-tooltip-title" ) ) {
+ target.attr( "title", target.data( "ui-tooltip-title" ) );
+ }
+
+ removeDescribedBy( target );
+
+ tooltip.stop( true );
+ this._hide( tooltip, this.options.hide, function() {
+ that._removeTooltip( $( this ) );
+ });
+
+ target.removeData( "ui-tooltip-open" );
+ this._off( target, "mouseleave focusout keyup" );
+ // Remove 'remove' binding only on delegated targets
+ if ( target[0] !== this.element[0] ) {
+ this._off( target, "remove" );
+ }
+ this._off( this.document, "mousemove" );
+
+ if ( event && event.type === "mouseleave" ) {
+ $.each( this.parents, function( id, parent ) {
+ $( parent.element ).attr( "title", parent.title );
+ delete that.parents[ id ];
+ });
+ }
+
+ this.closing = true;
+ this._trigger( "close", event, { tooltip: tooltip } );
+ this.closing = false;
+ },
+
+ _tooltip: function( element ) {
+ var id = "ui-tooltip-" + increments++,
+ tooltip = $( "<div>" )
+ .attr({
+ id: id,
+ role: "tooltip"
+ })
+ .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
+ ( this.options.tooltipClass || "" ) );
+ $( "<div>" )
+ .addClass( "ui-tooltip-content" )
+ .appendTo( tooltip );
+ tooltip.appendTo( this.document[0].body );
+ if ( $.fn.bgiframe ) {
+ tooltip.bgiframe();
+ }
+ this.tooltips[ id ] = element;
+ return tooltip;
+ },
+
+ _find: function( target ) {
+ var id = target.data( "ui-tooltip-id" );
+ return id ? $( "#" + id ) : $();
+ },
+
+ _removeTooltip: function( tooltip ) {
+ tooltip.remove();
+ delete this.tooltips[ tooltip.attr( "id" ) ];
+ },
+
+ _destroy: function() {
+ var that = this;
+
+ // close open tooltips
+ $.each( this.tooltips, function( id, element ) {
+ // Delegate to close method to handle common cleanup
+ var event = $.Event( "blur" );
+ event.target = event.currentTarget = element[0];
+ that.close( event, true );
+
+ // Remove immediately; destroying an open tooltip doesn't use the
+ // hide animation
+ $( "#" + id ).remove();
+
+ // Restore the title
+ if ( element.data( "ui-tooltip-title" ) ) {
+ element.attr( "title", element.data( "ui-tooltip-title" ) );
+ element.removeData( "ui-tooltip-title" );
+ }
+ });
+ }
+});
+
+}( jQuery ) ); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery.layout-latest.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery.layout-latest.js
new file mode 100644
index 00000000..434724d9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery.layout-latest.js
@@ -0,0 +1,6086 @@
+/**
+ * @preserve
+ * jquery.layout 1.4.3
+ * $Date: 2015/03/13 22:37:04 $
+ * $Rev: 1.0403 $
+ *
+ * Copyright (c) 2014 Kevin Dalman (http://jquery-dev.com)
+ * Based on work by Fabrizio Balliano (http://www.fabrizioballiano.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * SEE: http://layout.jquery-dev.com/LICENSE.txt
+ *
+ * Changelog: http://layout.jquery-dev.com/changelog.cfm
+ *
+ * Docs: http://layout.jquery-dev.com/documentation.html
+ * Tips: http://layout.jquery-dev.com/tips.html
+ * Help: http://groups.google.com/group/jquery-ui-layout
+ */
+
+/* JavaDoc Info: http://code.google.com/closure/compiler/docs/js-for-compiler.html
+ * {!Object} non-nullable type (never NULL)
+ * {?string} nullable type (sometimes NULL) - default for {Object}
+ * {number=} optional parameter
+ * {*} ALL types
+ */
+/* TODO for jQ 2.0
+ * change .andSelf() to .addBack()
+ * check $.fn.disableSelection - this is in jQuery UI 1.9.x
+ */
+
+// NOTE: For best readability, view with a fixed-width font and tabs equal to 4-chars
+
+;(function ($) {
+
+// alias Math methods - used a lot!
+var min = Math.min
+, max = Math.max
+, round = Math.floor
+
+, isStr = function (v) { return $.type(v) === "string"; }
+
+ /**
+ * @param {!Object} Instance
+ * @param {Array.<string>} a_fn
+ */
+, runPluginCallbacks = function (Instance, a_fn) {
+ if ($.isArray(a_fn))
+ for (var i=0, c=a_fn.length; i<c; i++) {
+ var fn = a_fn[i];
+ try {
+ if (isStr(fn)) // 'name' of a function
+ fn = eval(fn);
+ if ($.isFunction(fn))
+ g(fn)( Instance );
+ } catch (ex) {}
+ }
+ function g (f) { return f; }; // compiler hack
+ }
+;
+
+/*
+ * GENERIC $.layout METHODS - used by all layouts
+ */
+$.layout = {
+
+ version: "1.4.3"
+, revision: 1.0403 // eg: 1.4.1 final = 1.0401 - major(n+).minor(nn)+patch(nn+)
+
+ // $.layout.browser REPLACES $.browser
+, browser: {} // set below
+
+ // *PREDEFINED* EFFECTS & DEFAULTS
+ // MUST list effect here - OR MUST set an fxSettings option (can be an empty hash: {})
+, effects: {
+
+ // Pane Open/Close Animations
+ slide: {
+ all: { duration: "fast" } // eg: duration: 1000, easing: "easeOutBounce"
+ , north: { direction: "up" }
+ , south: { direction: "down" }
+ , east: { direction: "right"}
+ , west: { direction: "left" }
+ }
+ , drop: {
+ all: { duration: "slow" }
+ , north: { direction: "up" }
+ , south: { direction: "down" }
+ , east: { direction: "right"}
+ , west: { direction: "left" }
+ }
+ , scale: {
+ all: { duration: "fast" }
+ }
+ // these are not recommended, but can be used
+ , blind: {}
+ , clip: {}
+ , explode: {}
+ , fade: {}
+ , fold: {}
+ , puff: {}
+
+ // Pane Resize Animations
+ , size: {
+ all: { easing: "swing" }
+ }
+ }
+
+ // INTERNAL CONFIG DATA - DO NOT CHANGE THIS!
+, config: {
+ optionRootKeys: "effects,panes,north,south,west,east,center".split(",")
+ , allPanes: "north,south,west,east,center".split(",")
+ , borderPanes: "north,south,west,east".split(",")
+ , oppositeEdge: {
+ north: "south"
+ , south: "north"
+ , east: "west"
+ , west: "east"
+ }
+ // offscreen data
+ , offscreenCSS: { left: "-99999px", right: "auto" } // used by hide/close if useOffscreenClose=true
+ , offscreenReset: "offscreenReset" // key used for data
+ // CSS used in multiple places
+ , hidden: { visibility: "hidden" }
+ , visible: { visibility: "visible" }
+ // layout element settings
+ , resizers: {
+ cssReq: {
+ position: "absolute"
+ , padding: 0
+ , margin: 0
+ , fontSize: "1px"
+ , textAlign: "left" // to counter-act "center" alignment!
+ , overflow: "hidden" // prevent toggler-button from overflowing
+ // SEE $.layout.defaults.zIndexes.resizer_normal
+ }
+ , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true
+ background: "#DDD"
+ , border: "none"
+ }
+ }
+ , togglers: {
+ cssReq: {
+ position: "absolute"
+ , display: "block"
+ , padding: 0
+ , margin: 0
+ , overflow: "hidden"
+ , textAlign: "center"
+ , fontSize: "1px"
+ , cursor: "pointer"
+ , zIndex: 1
+ }
+ , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true
+ background: "#AAA"
+ }
+ }
+ , content: {
+ cssReq: {
+ position: "relative" /* contain floated or positioned elements */
+ }
+ , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true
+ overflow: "auto"
+ , padding: "10px"
+ }
+ , cssDemoPane: { // DEMO CSS - REMOVE scrolling from 'pane' when it has a content-div
+ overflow: "hidden"
+ , padding: 0
+ }
+ }
+ , panes: { // defaults for ALL panes - overridden by 'per-pane settings' below
+ cssReq: {
+ position: "absolute"
+ , margin: 0
+ // $.layout.defaults.zIndexes.pane_normal
+ }
+ , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true
+ padding: "10px"
+ , background: "#FFF"
+ , border: "1px solid #BBB"
+ , overflow: "auto"
+ }
+ }
+ , north: {
+ side: "top"
+ , sizeType: "Height"
+ , dir: "horz"
+ , cssReq: {
+ top: 0
+ , bottom: "auto"
+ , left: 0
+ , right: 0
+ , width: "auto"
+ // height: DYNAMIC
+ }
+ }
+ , south: {
+ side: "bottom"
+ , sizeType: "Height"
+ , dir: "horz"
+ , cssReq: {
+ top: "auto"
+ , bottom: 0
+ , left: 0
+ , right: 0
+ , width: "auto"
+ // height: DYNAMIC
+ }
+ }
+ , east: {
+ side: "right"
+ , sizeType: "Width"
+ , dir: "vert"
+ , cssReq: {
+ left: "auto"
+ , right: 0
+ , top: "auto" // DYNAMIC
+ , bottom: "auto" // DYNAMIC
+ , height: "auto"
+ // width: DYNAMIC
+ }
+ }
+ , west: {
+ side: "left"
+ , sizeType: "Width"
+ , dir: "vert"
+ , cssReq: {
+ left: 0
+ , right: "auto"
+ , top: "auto" // DYNAMIC
+ , bottom: "auto" // DYNAMIC
+ , height: "auto"
+ // width: DYNAMIC
+ }
+ }
+ , center: {
+ dir: "center"
+ , cssReq: {
+ left: "auto" // DYNAMIC
+ , right: "auto" // DYNAMIC
+ , top: "auto" // DYNAMIC
+ , bottom: "auto" // DYNAMIC
+ , height: "auto"
+ , width: "auto"
+ }
+ }
+ }
+
+ // CALLBACK FUNCTION NAMESPACE - used to store reusable callback functions
+, callbacks: {}
+
+, getParentPaneElem: function (el) {
+ // must pass either a container or pane element
+ var $el = $(el)
+ , layout = $el.data("layout") || $el.data("parentLayout");
+ if (layout) {
+ var $cont = layout.container;
+ // see if this container is directly-nested inside an outer-pane
+ if ($cont.data("layoutPane")) return $cont;
+ var $pane = $cont.closest("."+ $.layout.defaults.panes.paneClass);
+ // if a pane was found, return it
+ if ($pane.data("layoutPane")) return $pane;
+ }
+ return null;
+ }
+
+, getParentPaneInstance: function (el) {
+ // must pass either a container or pane element
+ var $pane = $.layout.getParentPaneElem(el);
+ return $pane ? $pane.data("layoutPane") : null;
+ }
+
+, getParentLayoutInstance: function (el) {
+ // must pass either a container or pane element
+ var $pane = $.layout.getParentPaneElem(el);
+ return $pane ? $pane.data("parentLayout") : null;
+ }
+
+, getEventObject: function (evt) {
+ return typeof evt === "object" && evt.stopPropagation ? evt : null;
+ }
+, parsePaneName: function (evt_or_pane) {
+ var evt = $.layout.getEventObject( evt_or_pane )
+ , pane = evt_or_pane;
+ if (evt) {
+ // ALWAYS stop propagation of events triggered in Layout!
+ evt.stopPropagation();
+ pane = $(this).data("layoutEdge");
+ }
+ if (pane && !/^(west|east|north|south|center)$/.test(pane)) {
+ $.layout.msg('LAYOUT ERROR - Invalid pane-name: "'+ pane +'"');
+ pane = "error";
+ }
+ return pane;
+ }
+
+
+ // LAYOUT-PLUGIN REGISTRATION
+ // more plugins can added beyond this default list
+, plugins: {
+ draggable: !!$.fn.draggable // resizing
+ , effects: {
+ core: !!$.effects // animimations (specific effects tested by initOptions)
+ , slide: $.effects && ($.effects.slide || ($.effects.effect && $.effects.effect.slide)) // default effect
+ }
+ }
+
+// arrays of plugin or other methods to be triggered for events in *each layout* - will be passed 'Instance'
+, onCreate: [] // runs when layout is just starting to be created - right after options are set
+, onLoad: [] // runs after layout container and global events init, but before initPanes is called
+, onReady: [] // runs after initialization *completes* - ie, after initPanes completes successfully
+, onDestroy: [] // runs after layout is destroyed
+, onUnload: [] // runs after layout is destroyed OR when page unloads
+, afterOpen: [] // runs after setAsOpen() completes
+, afterClose: [] // runs after setAsClosed() completes
+
+ /*
+ * GENERIC UTILITY METHODS
+ */
+
+ // calculate and return the scrollbar width, as an integer
+, scrollbarWidth: function () { return window.scrollbarWidth || $.layout.getScrollbarSize('width'); }
+, scrollbarHeight: function () { return window.scrollbarHeight || $.layout.getScrollbarSize('height'); }
+, getScrollbarSize: function (dim) {
+ var $c = $('<div style="position: absolute; top: -10000px; left: -10000px; width: 100px; height: 100px; border: 0; overflow: scroll;"></div>').appendTo("body")
+ , d = { width: $c.outerWidth - $c[0].clientWidth, height: 100 - $c[0].clientHeight };
+ $c.remove();
+ window.scrollbarWidth = d.width;
+ window.scrollbarHeight = d.height;
+ return dim.match(/^(width|height)$/) ? d[dim] : d;
+ }
+
+
+, disableTextSelection: function () {
+ var $d = $(document)
+ , s = 'textSelectionDisabled'
+ , x = 'textSelectionInitialized'
+ ;
+ if ($.fn.disableSelection) {
+ if (!$d.data(x)) // document hasn't been initialized yet
+ $d.on('mouseup', $.layout.enableTextSelection ).data(x, true);
+ if (!$d.data(s))
+ $d.disableSelection().data(s, true);
+ }
+ }
+, enableTextSelection: function () {
+ var $d = $(document)
+ , s = 'textSelectionDisabled';
+ if ($.fn.enableSelection && $d.data(s))
+ $d.enableSelection().data(s, false);
+ }
+
+
+ /**
+ * Returns hash container 'display' and 'visibility'
+ *
+ * @see $.swap() - swaps CSS, runs callback, resets CSS
+ * @param {!Object} $E jQuery element
+ * @param {boolean=} [force=false] Run even if display != none
+ * @return {!Object} Returns current style props, if applicable
+ */
+, showInvisibly: function ($E, force) {
+ if ($E && $E.length && (force || $E.css("display") === "none")) { // only if not *already hidden*
+ var s = $E[0].style
+ // save ONLY the 'style' props because that is what we must restore
+ , CSS = { display: s.display || '', visibility: s.visibility || '' };
+ // show element 'invisibly' so can be measured
+ $E.css({ display: "block", visibility: "hidden" });
+ return CSS;
+ }
+ return {};
+ }
+
+ /**
+ * Returns data for setting size of an element (container or a pane).
+ *
+ * @see _create(), onWindowResize() for container, plus others for pane
+ * @return JSON Returns a hash of all dimensions: top, bottom, left, right, outerWidth, innerHeight, etc
+ */
+, getElementDimensions: function ($E, inset) {
+ var
+ // dimensions hash - start with current data IF passed
+ d = { css: {}, inset: {} }
+ , x = d.css // CSS hash
+ , i = { bottom: 0 } // TEMP insets (bottom = complier hack)
+ , N = $.layout.cssNum
+ , R = Math.round
+ , off = $E.offset()
+ , b, p, ei // TEMP border, padding
+ ;
+ d.offsetLeft = off.left;
+ d.offsetTop = off.top;
+
+ if (!inset) inset = {}; // simplify logic below
+
+ $.each("Left,Right,Top,Bottom".split(","), function (idx, e) { // e = edge
+ b = x["border" + e] = $.layout.borderWidth($E, e);
+ p = x["padding"+ e] = $.layout.cssNum($E, "padding"+e);
+ ei = e.toLowerCase();
+ d.inset[ei] = inset[ei] >= 0 ? inset[ei] : p; // any missing insetX value = paddingX
+ i[ei] = d.inset[ei] + b; // total offset of content from outer side
+ });
+
+ x.width = R($E.width());
+ x.height = R($E.height());
+ x.top = N($E,"top",true);
+ x.bottom = N($E,"bottom",true);
+ x.left = N($E,"left",true);
+ x.right = N($E,"right",true);
+
+ d.outerWidth = R($E.outerWidth());
+ d.outerHeight = R($E.outerHeight());
+ // calc the TRUE inner-dimensions, even in quirks-mode!
+ d.innerWidth = max(0, d.outerWidth - i.left - i.right);
+ d.innerHeight = max(0, d.outerHeight - i.top - i.bottom);
+ // layoutWidth/Height is used in calcs for manual resizing
+ // layoutW/H only differs from innerW/H when in quirks-mode - then is like outerW/H
+ d.layoutWidth = R($E.innerWidth());
+ d.layoutHeight = R($E.innerHeight());
+
+ //if ($E.prop('tagName') === 'BODY') { debugData( d, $E.prop('tagName') ); } // DEBUG
+
+ //d.visible = $E.is(":visible");// && x.width > 0 && x.height > 0;
+
+ return d;
+ }
+
+, getElementStyles: function ($E, list) {
+ var
+ CSS = {}
+ , style = $E[0].style
+ , props = list.split(",")
+ , sides = "Top,Bottom,Left,Right".split(",")
+ , attrs = "Color,Style,Width".split(",")
+ , p, s, a, i, j, k
+ ;
+ for (i=0; i < props.length; i++) {
+ p = props[i];
+ if (p.match(/(border|padding|margin)$/))
+ for (j=0; j < 4; j++) {
+ s = sides[j];
+ if (p === "border")
+ for (k=0; k < 3; k++) {
+ a = attrs[k];
+ CSS[p+s+a] = style[p+s+a];
+ }
+ else
+ CSS[p+s] = style[p+s];
+ }
+ else
+ CSS[p] = style[p];
+ };
+ return CSS
+ }
+
+ /**
+ * Return the innerWidth for the current browser/doctype
+ *
+ * @see initPanes(), sizeMidPanes(), initHandles(), sizeHandles()
+ * @param {Array.<Object>} $E Must pass a jQuery object - first element is processed
+ * @param {number=} outerWidth (optional) Can pass a width, allowing calculations BEFORE element is resized
+ * @return {number} Returns the innerWidth of the elem by subtracting padding and borders
+ */
+, cssWidth: function ($E, outerWidth) {
+ // a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed
+ if (outerWidth <= 0) return 0;
+
+ var lb = $.layout.browser
+ , bs = !lb.boxModel ? "border-box" : lb.boxSizing ? $E.css("boxSizing") : "content-box"
+ , b = $.layout.borderWidth
+ , n = $.layout.cssNum
+ , W = outerWidth
+ ;
+ // strip border and/or padding from outerWidth to get CSS Width
+ if (bs !== "border-box")
+ W -= (b($E, "Left") + b($E, "Right"));
+ if (bs === "content-box")
+ W -= (n($E, "paddingLeft") + n($E, "paddingRight"));
+ return max(0,W);
+ }
+
+ /**
+ * Return the innerHeight for the current browser/doctype
+ *
+ * @see initPanes(), sizeMidPanes(), initHandles(), sizeHandles()
+ * @param {Array.<Object>} $E Must pass a jQuery object - first element is processed
+ * @param {number=} outerHeight (optional) Can pass a width, allowing calculations BEFORE element is resized
+ * @return {number} Returns the innerHeight of the elem by subtracting padding and borders
+ */
+, cssHeight: function ($E, outerHeight) {
+ // a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed
+ if (outerHeight <= 0) return 0;
+
+ var lb = $.layout.browser
+ , bs = !lb.boxModel ? "border-box" : lb.boxSizing ? $E.css("boxSizing") : "content-box"
+ , b = $.layout.borderWidth
+ , n = $.layout.cssNum
+ , H = outerHeight
+ ;
+ // strip border and/or padding from outerHeight to get CSS Height
+ if (bs !== "border-box")
+ H -= (b($E, "Top") + b($E, "Bottom"));
+ if (bs === "content-box")
+ H -= (n($E, "paddingTop") + n($E, "paddingBottom"));
+ return max(0,H);
+ }
+
+ /**
+ * Returns the 'current CSS numeric value' for a CSS property - 0 if property does not exist
+ *
+ * @see Called by many methods
+ * @param {Array.<Object>} $E Must pass a jQuery object - first element is processed
+ * @param {string} prop The name of the CSS property, eg: top, width, etc.
+ * @param {boolean=} [allowAuto=false] true = return 'auto' if that is value; false = return 0
+ * @return {(string|number)} Usually used to get an integer value for position (top, left) or size (height, width)
+ */
+, cssNum: function ($E, prop, allowAuto) {
+ if (!$E.jquery) $E = $($E);
+ var CSS = $.layout.showInvisibly($E)
+ , p = $.css($E[0], prop, true)
+ , v = allowAuto && p=="auto" ? p : Math.round(parseFloat(p) || 0);
+ $E.css( CSS ); // RESET
+ return v;
+ }
+
+, borderWidth: function (el, side) {
+ if (el.jquery) el = el[0];
+ var b = "border"+ side.substr(0,1).toUpperCase() + side.substr(1); // left => Left
+ return $.css(el, b+"Style", true) === "none" ? 0 : Math.round(parseFloat($.css(el, b+"Width", true)) || 0);
+ }
+
+ /**
+ * Mouse-tracking utility - FUTURE REFERENCE
+ *
+ * init: if (!window.mouse) {
+ * window.mouse = { x: 0, y: 0 };
+ * $(document).mousemove( $.layout.trackMouse );
+ * }
+ *
+ * @param {Object} evt
+ *
+, trackMouse: function (evt) {
+ window.mouse = { x: evt.clientX, y: evt.clientY };
+ }
+ */
+
+ /**
+ * SUBROUTINE for preventPrematureSlideClose option
+ *
+ * @param {Object} evt
+ * @param {Object=} el
+ */
+, isMouseOverElem: function (evt, el) {
+ var
+ $E = $(el || this)
+ , d = $E.offset()
+ , T = d.top
+ , L = d.left
+ , R = L + $E.outerWidth()
+ , B = T + $E.outerHeight()
+ , x = evt.pageX // evt.clientX ?
+ , y = evt.pageY // evt.clientY ?
+ ;
+ // if X & Y are < 0, probably means is over an open SELECT
+ return ($.layout.browser.msie && x < 0 && y < 0) || ((x >= L && x <= R) && (y >= T && y <= B));
+ }
+
+ /**
+ * Message/Logging Utility
+ *
+ * @example $.layout.msg("My message"); // log text
+ * @example $.layout.msg("My message", true); // alert text
+ * @example $.layout.msg({ foo: "bar" }, "Title"); // log hash-data, with custom title
+ * @example $.layout.msg({ foo: "bar" }, true, "Title", { sort: false }); -OR-
+ * @example $.layout.msg({ foo: "bar" }, "Title", { sort: false, display: true }); // alert hash-data
+ *
+ * @param {(Object|string)} info String message OR Hash/Array
+ * @param {(Boolean|string|Object)=} [popup=false] True means alert-box - can be skipped
+ * @param {(Object|string)=} [debugTitle=""] Title for Hash data - can be skipped
+ * @param {Object=} [debugOpts] Extra options for debug output
+ */
+, msg: function (info, popup, debugTitle, debugOpts) {
+ if ($.isPlainObject(info) && window.debugData) {
+ if (typeof popup === "string") {
+ debugOpts = debugTitle;
+ debugTitle = popup;
+ }
+ else if (typeof debugTitle === "object") {
+ debugOpts = debugTitle;
+ debugTitle = null;
+ }
+ var t = debugTitle || "log( <object> )"
+ , o = $.extend({ sort: false, returnHTML: false, display: false }, debugOpts);
+ if (popup === true || o.display)
+ debugData( info, t, o );
+ else if (window.console)
+ console.log(debugData( info, t, o ));
+ }
+ else if (popup)
+ alert(info);
+ else if (window.console)
+ console.log(info);
+ else {
+ var id = "#layoutLogger"
+ , $l = $(id);
+ if (!$l.length)
+ $l = createLog();
+ $l.children("ul").append('<li style="padding: 4px 10px; margin: 0; border-top: 1px solid #CCC;">'+ info.replace(/\</g,"&lt;").replace(/\>/g,"&gt;") +'</li>');
+ }
+
+ function createLog () {
+ var pos = $.support.fixedPosition ? 'fixed' : 'absolute'
+ , $e = $('<div id="layoutLogger" style="position: '+ pos +'; top: 5px; z-index: 999999; max-width: 25%; overflow: hidden; border: 1px solid #000; border-radius: 5px; background: #FBFBFB; box-shadow: 0 2px 10px rgba(0,0,0,0.3);">'
+ + '<div style="font-size: 13px; font-weight: bold; padding: 5px 10px; background: #F6F6F6; border-radius: 5px 5px 0 0; cursor: move;">'
+ + '<span style="float: right; padding-left: 7px; cursor: pointer;" title="Remove Console" onclick="$(this).closest(\'#layoutLogger\').remove()">X</span>Layout console.log</div>'
+ + '<ul style="font-size: 13px; font-weight: none; list-style: none; margin: 0; padding: 0 0 2px;"></ul>'
+ + '</div>'
+ ).appendTo("body");
+ $e.css('left', $(window).width() - $e.outerWidth() - 5)
+ if ($.ui.draggable) $e.draggable({ handle: ':first-child' });
+ return $e;
+ };
+ }
+
+};
+
+
+/*
+ * $.layout.browser REPLACES removed $.browser, with extra data
+ * Parsing code here adapted from jQuery 1.8 $.browse
+ */
+(function(){
+ var u = navigator.userAgent.toLowerCase()
+ , m = /(chrome)[ \/]([\w.]+)/.exec( u )
+ || /(webkit)[ \/]([\w.]+)/.exec( u )
+ || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( u )
+ || /(msie) ([\w.]+)/.exec( u )
+ || u.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( u )
+ || []
+ , b = m[1] || ""
+ , v = m[2] || 0
+ , ie = b === "msie"
+ , cm = document.compatMode
+ , $s = $.support
+ , bs = $s.boxSizing !== undefined ? $s.boxSizing : $s.boxSizingReliable
+ , bm = !ie || !cm || cm === "CSS1Compat" || $s.boxModel || false
+ , lb = $.layout.browser = {
+ version: v
+ , safari: b === "webkit" // webkit (NOT chrome) = safari
+ , webkit: b === "chrome" // chrome = webkit
+ , msie: ie
+ , isIE6: ie && v == 6
+ // ONLY IE reverts to old box-model - Note that compatMode was deprecated as of IE8
+ , boxModel: bm
+ , boxSizing: !!(typeof bs === "function" ? bs() : bs)
+ };
+ ;
+ if (b) lb[b] = true; // set CURRENT browser
+ /* OLD versions of jQuery only set $.support.boxModel after page is loaded
+ * so if this is IE, use support.boxModel to test for quirks-mode (ONLY IE changes boxModel) */
+ if (!bm && !cm) $(function(){ lb.boxModel = $s.boxModel; });
+})();
+
+
+// DEFAULT OPTIONS
+$.layout.defaults = {
+/*
+ * LAYOUT & LAYOUT-CONTAINER OPTIONS
+ * - none of these options are applicable to individual panes
+ */
+ name: "" // Not required, but useful for buttons and used for the state-cookie
+, containerClass: "ui-layout-container" // layout-container element
+, inset: null // custom container-inset values (override padding)
+, scrollToBookmarkOnLoad: true // after creating a layout, scroll to bookmark in URL (.../page.htm#myBookmark)
+, resizeWithWindow: true // bind thisLayout.resizeAll() to the window.resize event
+, resizeWithWindowDelay: 200 // delay calling resizeAll because makes window resizing very jerky
+, resizeWithWindowMaxDelay: 0 // 0 = none - force resize every XX ms while window is being resized
+, maskPanesEarly: false // true = create pane-masks on resizer.mouseDown instead of waiting for resizer.dragstart
+, onresizeall_start: null // CALLBACK when resizeAll() STARTS - NOT pane-specific
+, onresizeall_end: null // CALLBACK when resizeAll() ENDS - NOT pane-specific
+, onload_start: null // CALLBACK when Layout inits - after options initialized, but before elements
+, onload_end: null // CALLBACK when Layout inits - after EVERYTHING has been initialized
+, onunload_start: null // CALLBACK when Layout is destroyed OR onWindowUnload
+, onunload_end: null // CALLBACK when Layout is destroyed OR onWindowUnload
+, initPanes: true // false = DO NOT initialize the panes onLoad - will init later
+, showErrorMessages: true // enables fatal error messages to warn developers of common errors
+, showDebugMessages: false // display console-and-alert debug msgs - IF this Layout version _has_ debugging code!
+// Changing this zIndex value will cause other zIndex values to automatically change
+, zIndex: null // the PANE zIndex - resizers and masks will be +1
+// DO NOT CHANGE the zIndex values below unless you clearly understand their relationships
+, zIndexes: { // set _default_ z-index values here...
+ pane_normal: 0 // normal z-index for panes
+ , content_mask: 1 // applied to overlays used to mask content INSIDE panes during resizing
+ , resizer_normal: 2 // normal z-index for resizer-bars
+ , pane_sliding: 100 // applied to *BOTH* the pane and its resizer when a pane is 'slid open'
+ , pane_animate: 1000 // applied to the pane when being animated - not applied to the resizer
+ , resizer_drag: 10000 // applied to the CLONED resizer-bar when being 'dragged'
+ }
+, errors: {
+ pane: "pane" // description of "layout pane element" - used only in error messages
+ , selector: "selector" // description of "jQuery-selector" - used only in error messages
+ , addButtonError: "Error Adding Button\nInvalid "
+ , containerMissing: "UI Layout Initialization Error\nThe specified layout-container does not exist."
+ , centerPaneMissing: "UI Layout Initialization Error\nThe center-pane element does not exist.\nThe center-pane is a required element."
+ , noContainerHeight: "UI Layout Initialization Warning\nThe layout-container \"CONTAINER\" has no height.\nTherefore the layout is 0-height and hence 'invisible'!"
+ , callbackError: "UI Layout Callback Error\nThe EVENT callback is not a valid function."
+ }
+/*
+ * PANE DEFAULT SETTINGS
+ * - settings under the 'panes' key become the default settings for *all panes*
+ * - ALL pane-options can also be set specifically for each panes, which will override these 'default values'
+ */
+, panes: { // default options for 'all panes' - will be overridden by 'per-pane settings'
+ applyDemoStyles: false // NOTE: renamed from applyDefaultStyles for clarity
+ , closable: true // pane can open & close
+ , resizable: true // when open, pane can be resized
+ , slidable: true // when closed, pane can 'slide open' over other panes - closes on mouse-out
+ , initClosed: false // true = init pane as 'closed'
+ , initHidden: false // true = init pane as 'hidden' - no resizer-bar/spacing
+ // SELECTORS
+ //, paneSelector: "" // MUST be pane-specific - jQuery selector for pane
+ , contentSelector: ".ui-layout-content" // INNER div/element to auto-size so only it scrolls, not the entire pane!
+ , contentIgnoreSelector: ".ui-layout-ignore" // element(s) to 'ignore' when measuring 'content'
+ , findNestedContent: false // true = $P.find(contentSelector), false = $P.children(contentSelector)
+ // GENERIC ROOT-CLASSES - for auto-generated classNames
+ , paneClass: "ui-layout-pane" // Layout Pane
+ , resizerClass: "ui-layout-resizer" // Resizer Bar
+ , togglerClass: "ui-layout-toggler" // Toggler Button
+ , buttonClass: "ui-layout-button" // CUSTOM Buttons - eg: '[ui-layout-button]-toggle/-open/-close/-pin'
+ // ELEMENT SIZE & SPACING
+ //, size: 100 // MUST be pane-specific -initial size of pane
+ , minSize: 0 // when manually resizing a pane
+ , maxSize: 0 // ditto, 0 = no limit
+ , spacing_open: 6 // space between pane and adjacent panes - when pane is 'open'
+ , spacing_closed: 6 // ditto - when pane is 'closed'
+ , togglerLength_open: 50 // Length = WIDTH of toggler button on north/south sides - HEIGHT on east/west sides
+ , togglerLength_closed: 50 // 100% OR -1 means 'full height/width of resizer bar' - 0 means 'hidden'
+ , togglerAlign_open: "center" // top/left, bottom/right, center, OR...
+ , togglerAlign_closed: "center" // 1 => nn = offset from top/left, -1 => -nn == offset from bottom/right
+ , togglerContent_open: "" // text or HTML to put INSIDE the toggler
+ , togglerContent_closed: "" // ditto
+ // RESIZING OPTIONS
+ , resizerDblClickToggle: true //
+ , autoResize: true // IF size is 'auto' or a percentage, then recalc 'pixel size' whenever the layout resizes
+ , autoReopen: true // IF a pane was auto-closed due to noRoom, reopen it when there is room? False = leave it closed
+ , resizerDragOpacity: 1 // option for ui.draggable
+ //, resizerCursor: "" // MUST be pane-specific - cursor when over resizer-bar
+ , maskContents: false // true = add DIV-mask over-or-inside this pane so can 'drag' over IFRAMES
+ , maskObjects: false // true = add IFRAME-mask over-or-inside this pane to cover objects/applets - content-mask will overlay this mask
+ , maskZindex: null // will override zIndexes.content_mask if specified - not applicable to iframe-panes
+ , resizingGrid: false // grid size that the resizers will snap-to during resizing, eg: [20,20]
+ , livePaneResizing: false // true = LIVE Resizing as resizer is dragged
+ , liveContentResizing: false // true = re-measure header/footer heights as resizer is dragged
+ , liveResizingTolerance: 1 // how many px change before pane resizes, to control performance
+ // SLIDING OPTIONS
+ , sliderCursor: "pointer" // cursor when resizer-bar will trigger 'sliding'
+ , slideTrigger_open: "click" // click, dblclick, mouseenter
+ , slideTrigger_close: "mouseleave"// click, mouseleave
+ , slideDelay_open: 300 // applies only for mouseenter event - 0 = instant open
+ , slideDelay_close: 300 // applies only for mouseleave event (300ms is the minimum!)
+ , hideTogglerOnSlide: false // when pane is slid-open, should the toggler show?
+ , preventQuickSlideClose: $.layout.browser.webkit // Chrome triggers slideClosed as it is opening
+ , preventPrematureSlideClose: false // handle incorrect mouseleave trigger, like when over a SELECT-list in IE
+ // PANE-SPECIFIC TIPS & MESSAGES
+ , tips: {
+ Open: "Open" // eg: "Open Pane"
+ , Close: "Close"
+ , Resize: "Resize"
+ , Slide: "Slide Open"
+ , Pin: "Pin"
+ , Unpin: "Un-Pin"
+ , noRoomToOpen: "Not enough room to show this panel." // alert if user tries to open a pane that cannot
+ , minSizeWarning: "Panel has reached its minimum size" // displays in browser statusbar
+ , maxSizeWarning: "Panel has reached its maximum size" // ditto
+ }
+ // HOT-KEYS & MISC
+ , showOverflowOnHover: false // will bind allowOverflow() utility to pane.onMouseOver
+ , enableCursorHotkey: true // enabled 'cursor' hotkeys
+ //, customHotkey: "" // MUST be pane-specific - EITHER a charCode OR a character
+ , customHotkeyModifier: "SHIFT" // either 'SHIFT', 'CTRL' or 'CTRL+SHIFT' - NOT 'ALT'
+ // PANE ANIMATION
+ // NOTE: fxSss_open, fxSss_close & fxSss_size options (eg: fxName_open) are auto-generated if not passed
+ , fxName: "slide" // ('none' or blank), slide, drop, scale -- only relevant to 'open' & 'close', NOT 'size'
+ , fxSpeed: null // slow, normal, fast, 200, nnn - if passed, will OVERRIDE fxSettings.duration
+ , fxSettings: {} // can be passed, eg: { easing: "easeOutBounce", duration: 1500 }
+ , fxOpacityFix: true // tries to fix opacity in IE to restore anti-aliasing after animation
+ , animatePaneSizing: false // true = animate resizing after dragging resizer-bar OR sizePane() is called
+ /* NOTE: Action-specific FX options are auto-generated from the options above if not specifically set:
+ fxName_open: "slide" // 'Open' pane animation
+ fnName_close: "slide" // 'Close' pane animation
+ fxName_size: "slide" // 'Size' pane animation - when animatePaneSizing = true
+ fxSpeed_open: null
+ fxSpeed_close: null
+ fxSpeed_size: null
+ fxSettings_open: {}
+ fxSettings_close: {}
+ fxSettings_size: {}
+ */
+ // CHILD/NESTED LAYOUTS
+ , children: null // Layout-options for nested/child layout - even {} is valid as options
+ , containerSelector: '' // if child is NOT 'directly nested', a selector to find it/them (can have more than one child layout!)
+ , initChildren: true // true = child layout will be created as soon as _this_ layout completes initialization
+ , destroyChildren: true // true = destroy child-layout if this pane is destroyed
+ , resizeChildren: true // true = trigger child-layout.resizeAll() when this pane is resized
+ // EVENT TRIGGERING
+ , triggerEventsOnLoad: false // true = trigger onopen OR onclose callbacks when layout initializes
+ , triggerEventsDuringLiveResize: true // true = trigger onresize callback REPEATEDLY if livePaneResizing==true
+ // PANE CALLBACKS
+ , onshow_start: null // CALLBACK when pane STARTS to Show - BEFORE onopen/onhide_start
+ , onshow_end: null // CALLBACK when pane ENDS being Shown - AFTER onopen/onhide_end
+ , onhide_start: null // CALLBACK when pane STARTS to Close - BEFORE onclose_start
+ , onhide_end: null // CALLBACK when pane ENDS being Closed - AFTER onclose_end
+ , onopen_start: null // CALLBACK when pane STARTS to Open
+ , onopen_end: null // CALLBACK when pane ENDS being Opened
+ , onclose_start: null // CALLBACK when pane STARTS to Close
+ , onclose_end: null // CALLBACK when pane ENDS being Closed
+ , onresize_start: null // CALLBACK when pane STARTS being Resized ***FOR ANY REASON***
+ , onresize_end: null // CALLBACK when pane ENDS being Resized ***FOR ANY REASON***
+ , onsizecontent_start: null // CALLBACK when sizing of content-element STARTS
+ , onsizecontent_end: null // CALLBACK when sizing of content-element ENDS
+ , onswap_start: null // CALLBACK when pane STARTS to Swap
+ , onswap_end: null // CALLBACK when pane ENDS being Swapped
+ , ondrag_start: null // CALLBACK when pane STARTS being ***MANUALLY*** Resized
+ , ondrag_end: null // CALLBACK when pane ENDS being ***MANUALLY*** Resized
+ }
+/*
+ * PANE-SPECIFIC SETTINGS
+ * - options listed below MUST be specified per-pane - they CANNOT be set under 'panes'
+ * - all options under the 'panes' key can also be set specifically for any pane
+ * - most options under the 'panes' key apply only to 'border-panes' - NOT the the center-pane
+ */
+, north: {
+ paneSelector: ".ui-layout-north"
+ , size: "auto" // eg: "auto", "30%", .30, 200
+ , resizerCursor: "n-resize" // custom = url(myCursor.cur)
+ , customHotkey: "" // EITHER a charCode (43) OR a character ("o")
+ }
+, south: {
+ paneSelector: ".ui-layout-south"
+ , size: "50%"//"auto"
+ , resizerCursor: "s-resize"
+ , customHotkey: ""
+ , initClosed: true
+ }
+, east: {
+ paneSelector: ".ui-layout-east"
+ , size: "5%"//200
+ , resizerCursor: "e-resize"
+ , customHotkey: ""
+ }
+, west: {
+ paneSelector: ".ui-layout-west"
+ , size: "70%" //200
+ , resizerCursor: "w-resize"
+ , customHotkey: ""
+ , initClosed: true
+ }
+, center: {
+ paneSelector: ".ui-layout-center"
+ , size: "30%"//"auto"
+ , minWidth: 0
+ , minHeight: 0
+ }
+};
+
+$.layout.optionsMap = {
+ // layout/global options - NOT pane-options
+ layout: ("name,instanceKey,stateManagement,effects,inset,zIndexes,errors,"
+ + "zIndex,scrollToBookmarkOnLoad,showErrorMessages,maskPanesEarly,"
+ + "outset,resizeWithWindow,resizeWithWindowDelay,resizeWithWindowMaxDelay,"
+ + "onresizeall,onresizeall_start,onresizeall_end,onload,onload_start,onload_end,onunload,onunload_start,onunload_end").split(",")
+// borderPanes: [ ALL options that are NOT specified as 'layout' ]
+ // default.panes options that apply to the center-pane (most options apply _only_ to border-panes)
+, center: ("paneClass,contentSelector,contentIgnoreSelector,findNestedContent,applyDemoStyles,triggerEventsOnLoad,"
+ + "showOverflowOnHover,maskContents,maskObjects,liveContentResizing,"
+ + "containerSelector,children,initChildren,resizeChildren,destroyChildren,"
+ + "onresize,onresize_start,onresize_end,onsizecontent,onsizecontent_start,onsizecontent_end").split(",")
+ // options that MUST be specifically set 'per-pane' - CANNOT set in the panes (defaults) key
+, noDefault: ("paneSelector,resizerCursor,customHotkey").split(",")
+};
+
+/**
+ * Processes options passed in converts flat-format data into subkey (JSON) format
+ * In flat-format, subkeys are _currently_ separated with 2 underscores, like north__optName
+ * Plugins may also call this method so they can transform their own data
+ *
+ * @param {!Object} hash Data/options passed by user - may be a single level or nested levels
+ * @param {boolean=} [addKeys=false] Should the primary layout.options keys be added if they do not exist?
+ * @return {Object} Returns hash of minWidth & minHeight
+ */
+$.layout.transformData = function (hash, addKeys) {
+ var json = addKeys ? { panes: {}, center: {} } : {} // init return object
+ , branch, optKey, keys, key, val, i, c;
+
+ if (typeof hash !== "object") return json; // no options passed
+
+ // convert all 'flat-keys' to 'sub-key' format
+ for (optKey in hash) {
+ branch = json;
+ val = hash[ optKey ];
+ keys = optKey.split("__"); // eg: west__size or north__fxSettings__duration
+ c = keys.length - 1;
+ // convert underscore-delimited to subkeys
+ for (i=0; i <= c; i++) {
+ key = keys[i];
+ if (i === c) { // last key = value
+ if ($.isPlainObject( val ))
+ branch[key] = $.layout.transformData( val ); // RECURSE
+ else
+ branch[key] = val;
+ }
+ else {
+ if (!branch[key])
+ branch[key] = {}; // create the subkey
+ // recurse to sub-key for next loop - if not done
+ branch = branch[key];
+ }
+ }
+ }
+ return json;
+};
+
+// INTERNAL CONFIG DATA - DO NOT CHANGE THIS!
+$.layout.backwardCompatibility = {
+ // data used by renameOldOptions()
+ map: {
+ // OLD Option Name: NEW Option Name
+ applyDefaultStyles: "applyDemoStyles"
+ // CHILD/NESTED LAYOUTS
+ , childOptions: "children"
+ , initChildLayout: "initChildren"
+ , destroyChildLayout: "destroyChildren"
+ , resizeChildLayout: "resizeChildren"
+ , resizeNestedLayout: "resizeChildren"
+ // MISC Options
+ , resizeWhileDragging: "livePaneResizing"
+ , resizeContentWhileDragging: "liveContentResizing"
+ , triggerEventsWhileDragging: "triggerEventsDuringLiveResize"
+ , maskIframesOnResize: "maskContents"
+ // STATE MANAGEMENT
+ , useStateCookie: "stateManagement.enabled"
+ , "cookie.autoLoad": "stateManagement.autoLoad"
+ , "cookie.autoSave": "stateManagement.autoSave"
+ , "cookie.keys": "stateManagement.stateKeys"
+ , "cookie.name": "stateManagement.cookie.name"
+ , "cookie.domain": "stateManagement.cookie.domain"
+ , "cookie.path": "stateManagement.cookie.path"
+ , "cookie.expires": "stateManagement.cookie.expires"
+ , "cookie.secure": "stateManagement.cookie.secure"
+ // OLD Language options
+ , noRoomToOpenTip: "tips.noRoomToOpen"
+ , togglerTip_open: "tips.Close" // open = Close
+ , togglerTip_closed: "tips.Open" // closed = Open
+ , resizerTip: "tips.Resize"
+ , sliderTip: "tips.Slide"
+ }
+
+/**
+* @param {Object} opts
+*/
+, renameOptions: function (opts) {
+ var map = $.layout.backwardCompatibility.map
+ , oldData, newData, value
+ ;
+ for (var itemPath in map) {
+ oldData = getBranch( itemPath );
+ value = oldData.branch[ oldData.key ];
+ if (value !== undefined) {
+ newData = getBranch( map[itemPath], true );
+ newData.branch[ newData.key ] = value;
+ delete oldData.branch[ oldData.key ];
+ }
+ }
+
+ /**
+ * @param {string} path
+ * @param {boolean=} [create=false] Create path if does not exist
+ */
+ function getBranch (path, create) {
+ var a = path.split(".") // split keys into array
+ , c = a.length - 1
+ , D = { branch: opts, key: a[c] } // init branch at top & set key (last item)
+ , i = 0, k, undef;
+ for (; i<c; i++) { // skip the last key (data)
+ k = a[i];
+ if (D.branch[ k ] == undefined) { // child-key does not exist
+ if (create) {
+ D.branch = D.branch[ k ] = {}; // create child-branch
+ }
+ else // can't go any farther
+ D.branch = {}; // branch is undefined
+ }
+ else
+ D.branch = D.branch[ k ]; // get child-branch
+ }
+ return D;
+ };
+ }
+
+/**
+* @param {Object} opts
+*/
+, renameAllOptions: function (opts) {
+ var ren = $.layout.backwardCompatibility.renameOptions;
+ // rename root (layout) options
+ ren( opts );
+ // rename 'defaults' to 'panes'
+ if (opts.defaults) {
+ if (typeof opts.panes !== "object")
+ opts.panes = {};
+ $.extend(true, opts.panes, opts.defaults);
+ delete opts.defaults;
+ }
+ // rename options in the the options.panes key
+ if (opts.panes) ren( opts.panes );
+ // rename options inside *each pane key*, eg: options.west
+ $.each($.layout.config.allPanes, function (i, pane) {
+ if (opts[pane]) ren( opts[pane] );
+ });
+ return opts;
+ }
+};
+
+
+
+
+/* ============================================================
+ * BEGIN WIDGET: $( selector ).layout( {options} );
+ * ============================================================
+ */
+$.fn.layout = function (opts) {
+ var
+
+ // local aliases to global data
+ browser = $.layout.browser
+, _c = $.layout.config
+
+ // local aliases to utlity methods
+, cssW = $.layout.cssWidth
+, cssH = $.layout.cssHeight
+, elDims = $.layout.getElementDimensions
+, styles = $.layout.getElementStyles
+, evtObj = $.layout.getEventObject
+, evtPane = $.layout.parsePaneName
+
+/**
+ * options - populated by initOptions()
+ */
+, options = $.extend(true, {}, $.layout.defaults)
+, effects = options.effects = $.extend(true, {}, $.layout.effects)
+
+/**
+ * layout-state object
+ */
+, state = {
+ // generate unique ID to use for event.namespace so can unbind only events added by 'this layout'
+ id: "layout"+ $.now() // code uses alias: sID
+ , initialized: false
+ , paneResizing: false
+ , panesSliding: {}
+ , container: { // list all keys referenced in code to avoid compiler error msgs
+ innerWidth: 0
+ , innerHeight: 0
+ , outerWidth: 0
+ , outerHeight: 0
+ , layoutWidth: 0
+ , layoutHeight: 0
+ }
+ , north: { childIdx: 0 }
+ , south: { childIdx: 0 }
+ , east: { childIdx: 0 }
+ , west: { childIdx: 0 }
+ , center: { childIdx: 0 }
+ }
+
+/**
+ * parent/child-layout pointers
+ */
+//, hasParentLayout = false - exists ONLY inside Instance so can be set externally
+, children = {
+ north: null
+ , south: null
+ , east: null
+ , west: null
+ , center: null
+ }
+
+/*
+ * ###########################
+ * INTERNAL HELPER FUNCTIONS
+ * ###########################
+ */
+
+ /**
+ * Manages all internal timers
+ */
+, timer = {
+ data: {}
+ , set: function (s, fn, ms) { timer.clear(s); timer.data[s] = setTimeout(fn, ms); }
+ , clear: function (s) { var t=timer.data; if (t[s]) {clearTimeout(t[s]); delete t[s];} }
+ }
+
+ /**
+ * Alert or console.log a message - IF option is enabled.
+ *
+ * @param {(string|!Object)} msg Message (or debug-data) to display
+ * @param {boolean=} [popup=false] True by default, means 'alert', false means use console.log
+ * @param {boolean=} [debug=false] True means is a widget debugging message
+ */
+, _log = function (msg, popup, debug) {
+ var o = options;
+ if ((o.showErrorMessages && !debug) || (debug && o.showDebugMessages))
+ $.layout.msg( o.name +' / '+ msg, (popup !== false) );
+ return false;
+ }
+
+ /**
+ * Executes a Callback function after a trigger event, like resize, open or close
+ *
+ * @param {string} evtName Name of the layout callback, eg "onresize_start"
+ * @param {(string|boolean)=} [pane=""] This is passed only so we can pass the 'pane object' to the callback
+ * @param {(string|boolean)=} [skipBoundEvents=false] True = do not run events bound to the elements - only the callbacks set in options
+ */
+, _runCallbacks = function (evtName, pane, skipBoundEvents) {
+ var hasPane = pane && isStr(pane)
+ , s = hasPane ? state[pane] : state
+ , o = hasPane ? options[pane] : options
+ , lName = options.name
+ // names like onopen and onopen_end separate are interchangeable in options...
+ , lng = evtName + (evtName.match(/_/) ? "" : "_end")
+ , shrt = lng.match(/_end$/) ? lng.substr(0, lng.length - 4) : ""
+ , fn = o[lng] || o[shrt]
+ , retVal = "NC" // NC = No Callback
+ , args = []
+ , $P = hasPane ? $Ps[pane] : 0
+ ;
+ if (hasPane && !$P) // a pane is specified, but does not exist!
+ return retVal;
+ if ( !hasPane && $.type(pane) === "boolean" ) {
+ skipBoundEvents = pane; // allow pane param to be skipped for Layout callback
+ pane = "";
+ }
+
+ // first trigger the callback set in the options
+ if (fn) {
+ try {
+ // convert function name (string) to function object
+ if (isStr( fn )) {
+ if (fn.match(/,/)) {
+ // function name cannot contain a comma,
+ // so must be a function name AND a parameter to pass
+ args = fn.split(",")
+ , fn = eval(args[0]);
+ }
+ else // just the name of an external function?
+ fn = eval(fn);
+ }
+ // execute the callback, if exists
+ if ($.isFunction( fn )) {
+ if (args.length)
+ retVal = g(fn)(args[1]); // pass the argument parsed from 'list'
+ else if ( hasPane )
+ // pass data: pane-name, pane-element, pane-state, pane-options, and layout-name
+ retVal = g(fn)( pane, $Ps[pane], s, o, lName );
+ else // must be a layout/container callback - pass suitable info
+ retVal = g(fn)( Instance, s, o, lName );
+ }
+ }
+ catch (ex) {
+ _log( options.errors.callbackError.replace(/EVENT/, $.trim((pane || "") +" "+ lng)), false );
+ if ($.type(ex) === "string" && string.length)
+ _log("Exception: "+ ex, false );
+ }
+ }
+
+ // trigger additional events bound directly to the pane
+ if (!skipBoundEvents && retVal !== false) {
+ if ( hasPane ) { // PANE events can be bound to each pane-elements
+ o = options[pane];
+ s = state[pane];
+ $P.triggerHandler("layoutpane"+ lng, [ pane, $P, s, o, lName ]);
+ if (shrt)
+ $P.triggerHandler("layoutpane"+ shrt, [ pane, $P, s, o, lName ]);
+ }
+ else { // LAYOUT events can be bound to the container-element
+ $N.triggerHandler("layout"+ lng, [ Instance, s, o, lName ]);
+ if (shrt)
+ $N.triggerHandler("layout"+ shrt, [ Instance, s, o, lName ]);
+ }
+ }
+
+ // ALWAYS resizeChildren after an onresize_end event - even during initialization
+ // IGNORE onsizecontent_end event because causes child-layouts to resize TWICE
+ if (hasPane && evtName === "onresize_end") // BAD: || evtName === "onsizecontent_end"
+ resizeChildren(pane+"", true); // compiler hack -force string
+
+ return retVal;
+
+ function g (f) { return f; }; // compiler hack
+ }
+
+
+ /**
+ * cure iframe display issues in IE & other browsers
+ */
+, _fixIframe = function (pane) {
+ if (browser.mozilla) return; // skip FireFox - it auto-refreshes iframes onShow
+ var $P = $Ps[pane];
+ // if the 'pane' is an iframe, do it
+ if (state[pane].tagName === "IFRAME")
+ $P.css(_c.hidden).css(_c.visible);
+ else // ditto for any iframes INSIDE the pane
+ $P.find('IFRAME').css(_c.hidden).css(_c.visible);
+ }
+
+ /**
+ * @param {string} pane Can accept ONLY a 'pane' (east, west, etc)
+ * @param {number=} outerSize (optional) Can pass a width, allowing calculations BEFORE element is resized
+ * @return {number} Returns the innerHeight/Width of el by subtracting padding and borders
+ */
+, cssSize = function (pane, outerSize) {
+ var fn = _c[pane].dir=="horz" ? cssH : cssW;
+ return fn($Ps[pane], outerSize);
+ }
+
+ /**
+ * @param {string} pane Can accept ONLY a 'pane' (east, west, etc)
+ * @return {Object} Returns hash of minWidth & minHeight
+ */
+, cssMinDims = function (pane) {
+ // minWidth/Height means CSS width/height = 1px
+ var $P = $Ps[pane]
+ , dir = _c[pane].dir
+ , d = {
+ minWidth: 1001 - cssW($P, 1000)
+ , minHeight: 1001 - cssH($P, 1000)
+ }
+ ;
+ if (dir === "horz") d.minSize = d.minHeight;
+ if (dir === "vert") d.minSize = d.minWidth;
+ return d;
+ }
+
+ // TODO: see if these methods can be made more useful...
+ // TODO: *maybe* return cssW/H from these so caller can use this info
+
+ /**
+ * @param {(string|!Object)} el
+ * @param {number=} outerWidth
+ * @param {boolean=} [autoHide=false]
+ */
+, setOuterWidth = function (el, outerWidth, autoHide) {
+ var $E = el, w;
+ if (isStr(el)) $E = $Ps[el]; // west
+ else if (!el.jquery) $E = $(el);
+ w = cssW($E, outerWidth);
+ $E.css({ width: w });
+ if (w > 0) {
+ if (autoHide && $E.data('autoHidden') && $E.innerHeight() > 0) {
+ $E.show().data('autoHidden', false);
+ if (!browser.mozilla) // FireFox refreshes iframes - IE does not
+ // make hidden, then visible to 'refresh' display after animation
+ $E.css(_c.hidden).css(_c.visible);
+ }
+ }
+ else if (autoHide && !$E.data('autoHidden'))
+ $E.hide().data('autoHidden', true);
+ }
+
+ /**
+ * @param {(string|!Object)} el
+ * @param {number=} outerHeight
+ * @param {boolean=} [autoHide=false]
+ */
+, setOuterHeight = function (el, outerHeight, autoHide) {
+ var $E = el, h;
+ if (isStr(el)) $E = $Ps[el]; // west
+ else if (!el.jquery) $E = $(el);
+ h = cssH($E, outerHeight);
+ $E.css({ height: h, visibility: "visible" }); // may have been 'hidden' by sizeContent
+ if (h > 0 && $E.innerWidth() > 0) {
+ if (autoHide && $E.data('autoHidden')) {
+ $E.show().data('autoHidden', false);
+ if (!browser.mozilla) // FireFox refreshes iframes - IE does not
+ $E.css(_c.hidden).css(_c.visible);
+ }
+ }
+ else if (autoHide && !$E.data('autoHidden'))
+ $E.hide().data('autoHidden', true);
+ }
+
+
+ /**
+ * Converts any 'size' params to a pixel/integer size, if not already
+ * If 'auto' or a decimal/percentage is passed as 'size', a pixel-size is calculated
+ *
+ /**
+ * @param {string} pane
+ * @param {(string|number)=} size
+ * @param {string=} [dir]
+ * @return {number}
+ */
+, _parseSize = function (pane, size, dir) {
+ if (!dir) dir = _c[pane].dir;
+
+ if (isStr(size) && size.match(/%/))
+ size = (size === '100%') ? -1 : parseInt(size, 10) / 100; // convert % to decimal
+
+ if (size === 0)
+ return 0;
+ else if (size >= 1)
+ return parseInt(size, 10);
+
+ var o = options, avail = 0;
+ if (dir=="horz") // north or south or center.minHeight
+ avail = sC.innerHeight - ($Ps.north ? o.north.spacing_open : 0) - ($Ps.south ? o.south.spacing_open : 0);
+ else if (dir=="vert") // east or west or center.minWidth
+ avail = sC.innerWidth - ($Ps.west ? o.west.spacing_open : 0) - ($Ps.east ? o.east.spacing_open : 0);
+
+ if (size === -1) // -1 == 100%
+ return avail;
+ else if (size > 0) // percentage, eg: .25
+ return round(avail * size);
+ else if (pane=="center")
+ return 0;
+ else { // size < 0 || size=='auto' || size==Missing || size==Invalid
+ // auto-size the pane
+ var dim = (dir === "horz" ? "height" : "width")
+ , $P = $Ps[pane]
+ , $C = dim === 'height' ? $Cs[pane] : false
+ , vis = $.layout.showInvisibly($P) // show pane invisibly if hidden
+ , szP = $P.css(dim) // SAVE current pane size
+ , szC = $C ? $C.css(dim) : 0 // SAVE current content size
+ ;
+ $P.css(dim, "auto");
+ if ($C) $C.css(dim, "auto");
+ size = (dim === "height") ? $P.outerHeight() : $P.outerWidth(); // MEASURE
+ $P.css(dim, szP).css(vis); // RESET size & visibility
+ if ($C) $C.css(dim, szC);
+ return size;
+ }
+ }
+
+ /**
+ * Calculates current 'size' (outer-width or outer-height) of a border-pane - optionally with 'pane-spacing' added
+ *
+ * @param {(string|!Object)} pane
+ * @param {boolean=} [inclSpace=false]
+ * @return {number} Returns EITHER Width for east/west panes OR Height for north/south panes
+ */
+, getPaneSize = function (pane, inclSpace) {
+ var
+ $P = $Ps[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , oSp = (inclSpace ? o.spacing_open : 0)
+ , cSp = (inclSpace ? o.spacing_closed : 0)
+ ;
+ if (!$P || s.isHidden)
+ return 0;
+ else if (s.isClosed || (s.isSliding && inclSpace))
+ return cSp;
+ else if (_c[pane].dir === "horz")
+ return $P.outerHeight() + oSp;
+ else // dir === "vert"
+ return $P.outerWidth() + oSp;
+ }
+
+ /**
+ * Calculate min/max pane dimensions and limits for resizing
+ *
+ * @param {string} pane
+ * @param {boolean=} [slide=false]
+ */
+, setSizeLimits = function (pane, slide) {
+ if (!isInitialized()) return;
+ var
+ o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , dir = c.dir
+ , type = c.sizeType.toLowerCase()
+ , isSliding = (slide != undefined ? slide : s.isSliding) // only open() passes 'slide' param
+ , $P = $Ps[pane]
+ , paneSpacing = o.spacing_open
+ // measure the pane on the *opposite side* from this pane
+ , altPane = _c.oppositeEdge[pane]
+ , altS = state[altPane]
+ , $altP = $Ps[altPane]
+ , altPaneSize = (!$altP || altS.isVisible===false || altS.isSliding ? 0 : (dir=="horz" ? $altP.outerHeight() : $altP.outerWidth()))
+ , altPaneSpacing = ((!$altP || altS.isHidden ? 0 : options[altPane][ altS.isClosed !== false ? "spacing_closed" : "spacing_open" ]) || 0)
+ // limitSize prevents this pane from 'overlapping' opposite pane
+ , containerSize = (dir=="horz" ? sC.innerHeight : sC.innerWidth)
+ , minCenterDims = cssMinDims("center")
+ , minCenterSize = dir=="horz" ? max(options.center.minHeight, minCenterDims.minHeight) : max(options.center.minWidth, minCenterDims.minWidth)
+ // if pane is 'sliding', then ignore center and alt-pane sizes - because 'overlays' them
+ , limitSize = (containerSize - paneSpacing - (isSliding ? 0 : (_parseSize("center", minCenterSize, dir) + altPaneSize + altPaneSpacing)))
+ , minSize = s.minSize = max( _parseSize(pane, o.minSize), cssMinDims(pane).minSize )
+ , maxSize = s.maxSize = min( (o.maxSize ? _parseSize(pane, o.maxSize) : 100000), limitSize )
+ , r = s.resizerPosition = {} // used to set resizing limits
+ , top = sC.inset.top
+ , left = sC.inset.left
+ , W = sC.innerWidth
+ , H = sC.innerHeight
+ , rW = o.spacing_open // subtract resizer-width to get top/left position for south/east
+ ;
+ switch (pane) {
+ case "north": r.min = top + minSize;
+ r.max = top + maxSize;
+ break;
+ case "west": r.min = left + minSize;
+ r.max = left + maxSize;
+ break;
+ case "south": r.min = top + H - maxSize - rW;
+ r.max = top + H - minSize - rW;
+ break;
+ case "east": r.min = left + W - maxSize - rW;
+ r.max = left + W - minSize - rW;
+ break;
+ };
+ }
+
+ /**
+ * Returns data for setting the size/position of center pane. Also used to set Height for east/west panes
+ *
+ * @return JSON Returns a hash of all dimensions: top, bottom, left, right, (outer) width and (outer) height
+ */
+, calcNewCenterPaneDims = function () {
+ var d = {
+ top: getPaneSize("north", true) // true = include 'spacing' value for pane
+ , bottom: getPaneSize("south", true)
+ , left: getPaneSize("west", true)
+ , right: getPaneSize("east", true)
+ , width: 0
+ , height: 0
+ };
+
+ // NOTE: sC = state.container
+ // calc center-pane outer dimensions
+ d.width = sC.innerWidth - d.left - d.right; // outerWidth
+ d.height = sC.innerHeight - d.bottom - d.top; // outerHeight
+ // add the 'container border/padding' to get final positions relative to the container
+ d.top += sC.inset.top;
+ d.bottom += sC.inset.bottom;
+ d.left += sC.inset.left;
+ d.right += sC.inset.right;
+
+ return d;
+ }
+
+
+ /**
+ * @param {!Object} el
+ * @param {boolean=} [allStates=false]
+ */
+, getHoverClasses = function (el, allStates) {
+ var
+ $El = $(el)
+ , type = $El.data("layoutRole")
+ , pane = $El.data("layoutEdge")
+ , o = options[pane]
+ , root = o[type +"Class"]
+ , _pane = "-"+ pane // eg: "-west"
+ , _open = "-open"
+ , _closed = "-closed"
+ , _slide = "-sliding"
+ , _hover = "-hover " // NOTE the trailing space
+ , _state = $El.hasClass(root+_closed) ? _closed : _open
+ , _alt = _state === _closed ? _open : _closed
+ , classes = (root+_hover) + (root+_pane+_hover) + (root+_state+_hover) + (root+_pane+_state+_hover)
+ ;
+ if (allStates) // when 'removing' classes, also remove alternate-state classes
+ classes += (root+_alt+_hover) + (root+_pane+_alt+_hover);
+
+ if (type=="resizer" && $El.hasClass(root+_slide))
+ classes += (root+_slide+_hover) + (root+_pane+_slide+_hover);
+
+ return $.trim(classes);
+ }
+, addHover = function (evt, el) {
+ var $E = $(el || this);
+ if (evt && $E.data("layoutRole") === "toggler")
+ evt.stopPropagation(); // prevent triggering 'slide' on Resizer-bar
+ $E.addClass( getHoverClasses($E) );
+ }
+, removeHover = function (evt, el) {
+ var $E = $(el || this);
+ $E.removeClass( getHoverClasses($E, true) );
+ }
+
+, onResizerEnter = function (evt) { // ALSO called by toggler.mouseenter
+ var pane = $(this).data("layoutEdge")
+ , s = state[pane]
+ , $d = $(document)
+ ;
+ // ignore closed-panes and mouse moving back & forth over resizer!
+ // also ignore if ANY pane is currently resizing
+ if ( s.isResizing || state.paneResizing ) return;
+
+ if (options.maskPanesEarly)
+ showMasks( pane, { resizing: true });
+ }
+, onResizerLeave = function (evt, el) {
+ var e = el || this // el is only passed when called by the timer
+ , pane = $(e).data("layoutEdge")
+ , name = pane +"ResizerLeave"
+ , $d = $(document)
+ ;
+ timer.clear(pane+"_openSlider"); // cancel slideOpen timer, if set
+ timer.clear(name); // cancel enableSelection timer - may re/set below
+ // this method calls itself on a timer because it needs to allow
+ // enough time for dragging to kick-in and set the isResizing flag
+ // dragging has a 100ms delay set, so this delay must be >100
+ if (!el) // 1st call - mouseleave event
+ timer.set(name, function(){ onResizerLeave(evt, e); }, 200);
+ // if user is resizing, dragStop will reset everything, so skip it here
+ else if (options.maskPanesEarly && !state.paneResizing) // 2nd call - by timer
+ hideMasks();
+ }
+
+/*
+ * ###########################
+ * INITIALIZATION METHODS
+ * ###########################
+ */
+
+ /**
+ * Initialize the layout - called automatically whenever an instance of layout is created
+ *
+ * @see none - triggered onInit
+ * @return mixed true = fully initialized | false = panes not initialized (yet) | 'cancel' = abort
+ */
+, _create = function () {
+ // initialize config/options
+ initOptions();
+ var o = options
+ , s = state;
+
+ // TEMP state so isInitialized returns true during init process
+ s.creatingLayout = true;
+
+ // init plugins for this layout, if there are any (eg: stateManagement)
+ runPluginCallbacks( Instance, $.layout.onCreate );
+
+ // options & state have been initialized, so now run beforeLoad callback
+ // onload will CANCEL layout creation if it returns false
+ if (false === _runCallbacks("onload_start"))
+ return 'cancel';
+
+ // initialize the container element
+ _initContainer();
+
+ // bind hotkey function - keyDown - if required
+ initHotkeys();
+
+ // bind window.onunload
+ $(window).bind("unload."+ sID, unload);
+
+ // init plugins for this layout, if there are any (eg: customButtons)
+ runPluginCallbacks( Instance, $.layout.onLoad );
+
+ // if layout elements are hidden, then layout WILL NOT complete initialization!
+ // initLayoutElements will set initialized=true and run the onload callback IF successful
+ if (o.initPanes) _initLayoutElements();
+
+ delete s.creatingLayout;
+
+ return state.initialized;
+ }
+
+ /**
+ * Initialize the layout IF not already
+ *
+ * @see All methods in Instance run this test
+ * @return boolean true = layoutElements have been initialized | false = panes are not initialized (yet)
+ */
+, isInitialized = function () {
+ if (state.initialized || state.creatingLayout) return true; // already initialized
+ else return _initLayoutElements(); // try to init panes NOW
+ }
+
+ /**
+ * Initialize the layout - called automatically whenever an instance of layout is created
+ *
+ * @see _create() & isInitialized
+ * @param {boolean=} [retry=false] // indicates this is a 2nd try
+ * @return An object pointer to the instance created
+ */
+, _initLayoutElements = function (retry) {
+ // initialize config/options
+ var o = options;
+ // CANNOT init panes inside a hidden container!
+ if (!$N.is(":visible")) {
+ // handle Chrome bug where popup window 'has no height'
+ // if layout is BODY element, try again in 50ms
+ // SEE: http://layout.jquery-dev.com/samples/test_popup_window.html
+ if ( !retry && browser.webkit && $N[0].tagName === "BODY" )
+ setTimeout(function(){ _initLayoutElements(true); }, 50);
+ return false;
+ }
+
+ // a center pane is required, so make sure it exists
+ if (!getPane("center").length) {
+ return _log( o.errors.centerPaneMissing );
+ }
+
+ // TEMP state so isInitialized returns true during init process
+ state.creatingLayout = true;
+
+ // update Container dims
+ $.extend(sC, elDims( $N, o.inset )); // passing inset means DO NOT include insetX values
+
+ // initialize all layout elements
+ initPanes(); // size & position panes - calls initHandles() - which calls initResizable()
+
+ if (o.scrollToBookmarkOnLoad) {
+ var l = self.location;
+ if (l.hash) l.replace( l.hash ); // scrollTo Bookmark
+ }
+
+ // check to see if this layout 'nested' inside a pane
+ if (Instance.hasParentLayout)
+ o.resizeWithWindow = false;
+ // bind resizeAll() for 'this layout instance' to window.resize event
+ else if (o.resizeWithWindow)
+ $(window).bind("resize."+ sID, windowResize);
+
+ delete state.creatingLayout;
+ state.initialized = true;
+
+ // init plugins for this layout, if there are any
+ runPluginCallbacks( Instance, $.layout.onReady );
+
+ // now run the onload callback, if exists
+ _runCallbacks("onload_end");
+
+ return true; // elements initialized successfully
+ }
+
+ /**
+ * Initialize nested layouts for a specific pane - can optionally pass layout-options
+ *
+ * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west
+ * @param {Object=} [opts] Layout-options - if passed, will OVERRRIDE options[pane].children
+ * @return An object pointer to the layout instance created - or null
+ */
+, createChildren = function (evt_or_pane, opts) {
+ var pane = evtPane.call(this, evt_or_pane)
+ , $P = $Ps[pane]
+ ;
+ if (!$P) return;
+ var $C = $Cs[pane]
+ , s = state[pane]
+ , o = options[pane]
+ , sm = options.stateManagement || {}
+ , cos = opts ? (o.children = opts) : o.children
+ ;
+ if ( $.isPlainObject( cos ) )
+ cos = [ cos ]; // convert a hash to a 1-elem array
+ else if (!cos || !$.isArray( cos ))
+ return;
+
+ $.each( cos, function (idx, co) {
+ if ( !$.isPlainObject( co ) ) return;
+
+ // determine which element is supposed to be the 'child container'
+ // if pane has a 'containerSelector' OR a 'content-div', use those instead of the pane
+ var $containers = co.containerSelector ? $P.find( co.containerSelector ) : ($C || $P);
+
+ $containers.each(function(){
+ var $cont = $(this)
+ , child = $cont.data("layout") // see if a child-layout ALREADY exists on this element
+ ;
+ // if no layout exists, but children are set, try to create the layout now
+ if (!child) {
+ // TODO: see about moving this to the stateManagement plugin, as a method
+ // set a unique child-instance key for this layout, if not already set
+ setInstanceKey({ container: $cont, options: co }, s );
+ // If THIS layout has a hash in stateManagement.autoLoad,
+ // then see if it also contains state-data for this child-layout
+ // If so, copy the stateData to child.options.stateManagement.autoLoad
+ if ( sm.includeChildren && state.stateData[pane] ) {
+ // THIS layout's state was cached when its state was loaded
+ var paneChildren = state.stateData[pane].children || {}
+ , childState = paneChildren[ co.instanceKey ]
+ , co_sm = co.stateManagement || (co.stateManagement = { autoLoad: true })
+ ;
+ // COPY the stateData into the autoLoad key
+ if ( co_sm.autoLoad === true && childState ) {
+ co_sm.autoSave = false; // disable autoSave because saving handled by parent-layout
+ co_sm.includeChildren = true; // cascade option - FOR NOW
+ co_sm.autoLoad = $.extend(true, {}, childState); // COPY the state-hash
+ }
+ }
+
+ // create the layout
+ child = $cont.layout( co );
+
+ // if successful, update data
+ if (child) {
+ // add the child and update all layout-pointers
+ // MAY have already been done by child-layout calling parent.refreshChildren()
+ refreshChildren( pane, child );
+ }
+ }
+ });
+ });
+ }
+
+, setInstanceKey = function (child, parentPaneState) {
+ // create a named key for use in state and instance branches
+ var $c = child.container
+ , o = child.options
+ , sm = o.stateManagement
+ , key = o.instanceKey || $c.data("layoutInstanceKey")
+ ;
+ if (!key) key = (sm && sm.cookie ? sm.cookie.name : '') || o.name; // look for a name/key
+ if (!key) key = "layout"+ (++parentPaneState.childIdx); // if no name/key found, generate one
+ else key = key.replace(/[^\w-]/gi, '_').replace(/_{2,}/g, '_'); // ensure is valid as a hash key
+ o.instanceKey = key;
+ $c.data("layoutInstanceKey", key); // useful if layout is destroyed and then recreated
+ return key;
+ }
+
+ /**
+ * @param {string} pane The pane being opened, ie: north, south, east, or west
+ * @param {Object=} newChild New child-layout Instance to add to this pane
+ */
+, refreshChildren = function (pane, newChild) {
+ var $P = $Ps[pane]
+ , pC = children[pane]
+ , s = state[pane]
+ , o
+ ;
+ // check for destroy()ed layouts and update the child pointers & arrays
+ if ($.isPlainObject( pC )) {
+ $.each( pC, function (key, child) {
+ if (child.destroyed) delete pC[key]
+ });
+ // if no more children, remove the children hash
+ if ($.isEmptyObject( pC ))
+ pC = children[pane] = null; // clear children hash
+ }
+
+ // see if there is a directly-nested layout inside this pane
+ // if there is, then there can be only ONE child-layout, so check that...
+ if (!newChild && !pC) {
+ newChild = $P.data("layout");
+ }
+
+ // if a newChild instance was passed, add it to children[pane]
+ if (newChild) {
+ // update child.state
+ newChild.hasParentLayout = true; // set parent-flag in child
+ // instanceKey is a key-name used in both state and children
+ o = newChild.options;
+ // set a unique child-instance key for this layout, if not already set
+ setInstanceKey( newChild, s );
+ // add pointer to pane.children hash
+ if (!pC) pC = children[pane] = {}; // create an empty children hash
+ pC[ o.instanceKey ] = newChild.container.data("layout"); // add childLayout instance
+ }
+
+ // ALWAYS refresh the pane.children alias, even if null
+ Instance[pane].children = children[pane];
+
+ // if newChild was NOT passed - see if there is a child layout NOW
+ if (!newChild) {
+ createChildren(pane); // MAY create a child and re-call this method
+ }
+ }
+
+, windowResize = function () {
+ var o = options
+ , delay = Number(o.resizeWithWindowDelay);
+ if (delay < 10) delay = 100; // MUST have a delay!
+ // resizing uses a delay-loop because the resize event fires repeatly - except in FF, but delay anyway
+ timer.clear("winResize"); // if already running
+ timer.set("winResize", function(){
+ timer.clear("winResize");
+ timer.clear("winResizeRepeater");
+ var dims = elDims( $N, o.inset );
+ // only trigger resizeAll() if container has changed size
+ if (dims.innerWidth !== sC.innerWidth || dims.innerHeight !== sC.innerHeight)
+ resizeAll();
+ }, delay);
+ // ALSO set fixed-delay timer, if not already running
+ if (!timer.data["winResizeRepeater"]) setWindowResizeRepeater();
+ }
+
+, setWindowResizeRepeater = function () {
+ var delay = Number(options.resizeWithWindowMaxDelay);
+ if (delay > 0)
+ timer.set("winResizeRepeater", function(){ setWindowResizeRepeater(); resizeAll(); }, delay);
+ }
+
+, unload = function () {
+ var o = options;
+
+ _runCallbacks("onunload_start");
+
+ // trigger plugin callabacks for this layout (eg: stateManagement)
+ runPluginCallbacks( Instance, $.layout.onUnload );
+
+ _runCallbacks("onunload_end");
+ }
+
+ /**
+ * Validate and initialize container CSS and events
+ *
+ * @see _create()
+ */
+, _initContainer = function () {
+ var
+ N = $N[0]
+ , $H = $("html")
+ , tag = sC.tagName = N.tagName
+ , id = sC.id = N.id
+ , cls = sC.className = N.className
+ , o = options
+ , name = o.name
+ , props = "position,margin,padding,border"
+ , css = "layoutCSS"
+ , CSS = {}
+ , hid = "hidden" // used A LOT!
+ // see if this container is a 'pane' inside an outer-layout
+ , parent = $N.data("parentLayout") // parent-layout Instance
+ , pane = $N.data("layoutEdge") // pane-name in parent-layout
+ , isChild = parent && pane
+ , num = $.layout.cssNum
+ , $parent, n
+ ;
+ // sC = state.container
+ sC.selector = $N.selector.split(".slice")[0];
+ sC.ref = (o.name ? o.name +' layout / ' : '') + tag + (id ? "#"+id : cls ? '.['+cls+']' : ''); // used in messages
+ sC.isBody = (tag === "BODY");
+
+ // try to find a parent-layout
+ if (!isChild && !sC.isBody) {
+ $parent = $N.closest("."+ $.layout.defaults.panes.paneClass);
+ parent = $parent.data("parentLayout");
+ pane = $parent.data("layoutEdge");
+ isChild = parent && pane;
+ }
+
+ $N .data({
+ layout: Instance
+ , layoutContainer: sID // FLAG to indicate this is a layout-container - contains unique internal ID
+ })
+ .addClass(o.containerClass)
+ ;
+ var layoutMethods = {
+ destroy: ''
+ , initPanes: ''
+ , resizeAll: 'resizeAll'
+ , resize: 'resizeAll'
+ };
+ // loop hash and bind all methods - include layoutID namespacing
+ for (name in layoutMethods) {
+ $N.bind("layout"+ name.toLowerCase() +"."+ sID, Instance[ layoutMethods[name] || name ]);
+ }
+
+ // if this container is another layout's 'pane', then set child/parent pointers
+ if (isChild) {
+ // update parent flag
+ Instance.hasParentLayout = true;
+ // set pointers to THIS child-layout (Instance) in parent-layout
+ parent.refreshChildren( pane, Instance );
+ }
+
+ // SAVE original container CSS for use in destroy()
+ if (!$N.data(css)) {
+ // handle props like overflow different for BODY & HTML - has 'system default' values
+ if (sC.isBody) {
+ // SAVE <BODY> CSS
+ $N.data(css, $.extend( styles($N, props), {
+ height: $N.css("height")
+ , overflow: $N.css("overflow")
+ , overflowX: $N.css("overflowX")
+ , overflowY: $N.css("overflowY")
+ }));
+ // ALSO SAVE <HTML> CSS
+ $H.data(css, $.extend( styles($H, 'padding'), {
+ height: "auto" // FF would return a fixed px-size!
+ , overflow: $H.css("overflow")
+ , overflowX: $H.css("overflowX")
+ , overflowY: $H.css("overflowY")
+ }));
+ }
+ else // handle props normally for non-body elements
+ $N.data(css, styles($N, props+",top,bottom,left,right,width,height,overflow,overflowX,overflowY") );
+ }
+
+ try {
+ // common container CSS
+ CSS = {
+ overflow: hid
+ , overflowX: hid
+ , overflowY: hid
+ };
+ $N.css( CSS );
+
+ if (o.inset && !$.isPlainObject(o.inset)) {
+ // can specify a single number for equal outset all-around
+ n = parseInt(o.inset, 10) || 0
+ o.inset = {
+ top: n
+ , bottom: n
+ , left: n
+ , right: n
+ };
+ }
+
+ // format html & body if this is a full page layout
+ if (sC.isBody) {
+ // if HTML has padding, use this as an outer-spacing around BODY
+ if (!o.outset) {
+ // use padding from parent-elem (HTML) as outset
+ o.outset = {
+ top: num($H, "paddingTop")
+ , bottom: num($H, "paddingBottom")
+ , left: num($H, "paddingLeft")
+ , right: num($H, "paddingRight")
+ };
+ }
+ else if (!$.isPlainObject(o.outset)) {
+ // can specify a single number for equal outset all-around
+ n = parseInt(o.outset, 10) || 0
+ o.outset = {
+ top: n
+ , bottom: n
+ , left: n
+ , right: n
+ };
+ }
+ // HTML
+ $H.css( CSS ).css({
+ height: "100%"
+ , border: "none" // no border or padding allowed when using height = 100%
+ , padding: 0 // ditto
+ , margin: 0
+ });
+ // BODY
+ if (browser.isIE6) {
+ // IE6 CANNOT use the trick of setting absolute positioning on all 4 sides - must have 'height'
+ $N.css({
+ width: "100%"
+ , height: "100%"
+ , border: "none" // no border or padding allowed when using height = 100%
+ , padding: 0 // ditto
+ , margin: 0
+ , position: "relative"
+ });
+ // convert body padding to an inset option - the border cannot be measured in IE6!
+ if (!o.inset) o.inset = elDims( $N ).inset;
+ }
+ else { // use absolute positioning for BODY to allow borders & padding without overflow
+ $N.css({
+ width: "auto"
+ , height: "auto"
+ , margin: 0
+ , position: "absolute" // allows for border and padding on BODY
+ });
+ // apply edge-positioning created above
+ $N.css( o.outset );
+ }
+ // set current layout-container dimensions
+ $.extend(sC, elDims( $N, o.inset )); // passing inset means DO NOT include insetX values
+ }
+ else {
+ // container MUST have 'position'
+ var p = $N.css("position");
+ if (!p || !p.match(/(fixed|absolute|relative)/))
+ $N.css("position","relative");
+
+ // set current layout-container dimensions
+ if ( $N.is(":visible") ) {
+ $.extend(sC, elDims( $N, o.inset )); // passing inset means DO NOT change insetX (padding) values
+ if (sC.innerHeight < 1) // container has no 'height' - warn developer
+ _log( o.errors.noContainerHeight.replace(/CONTAINER/, sC.ref) );
+ }
+ }
+
+ // if container has min-width/height, then enable scrollbar(s)
+ if ( num($N, "minWidth") ) $N.parent().css("overflowX","auto");
+ if ( num($N, "minHeight") ) $N.parent().css("overflowY","auto");
+
+ } catch (ex) {}
+ }
+
+ /**
+ * Bind layout hotkeys - if options enabled
+ *
+ * @see _create() and addPane()
+ * @param {string=} [panes=""] The edge(s) to process
+ */
+, initHotkeys = function (panes) {
+ panes = panes ? panes.split(",") : _c.borderPanes;
+ // bind keyDown to capture hotkeys, if option enabled for ANY pane
+ $.each(panes, function (i, pane) {
+ var o = options[pane];
+ if (o.enableCursorHotkey || o.customHotkey) {
+ $(document).bind("keydown."+ sID, keyDown); // only need to bind this ONCE
+ return false; // BREAK - binding was done
+ }
+ });
+ }
+
+ /**
+ * Build final OPTIONS data
+ *
+ * @see _create()
+ */
+, initOptions = function () {
+ var data, d, pane, key, val, i, c, o;
+
+ // reprocess user's layout-options to have correct options sub-key structure
+ opts = $.layout.transformData( opts, true ); // panes = default subkey
+
+ // auto-rename old options for backward compatibility
+ opts = $.layout.backwardCompatibility.renameAllOptions( opts );
+
+ // if user-options has 'panes' key (pane-defaults), clean it...
+ if (!$.isEmptyObject(opts.panes)) {
+ // REMOVE any pane-defaults that MUST be set per-pane
+ data = $.layout.optionsMap.noDefault;
+ for (i=0, c=data.length; i<c; i++) {
+ key = data[i];
+ delete opts.panes[key]; // OK if does not exist
+ }
+ // REMOVE any layout-options specified under opts.panes
+ data = $.layout.optionsMap.layout;
+ for (i=0, c=data.length; i<c; i++) {
+ key = data[i];
+ delete opts.panes[key]; // OK if does not exist
+ }
+ }
+
+ // MOVE any NON-layout-options from opts-root to opts.panes
+ data = $.layout.optionsMap.layout;
+ var rootKeys = $.layout.config.optionRootKeys;
+ for (key in opts) {
+ val = opts[key];
+ if ($.inArray(key, rootKeys) < 0 && $.inArray(key, data) < 0) {
+ if (!opts.panes[key])
+ opts.panes[key] = $.isPlainObject(val) ? $.extend(true, {}, val) : val;
+ delete opts[key]
+ }
+ }
+
+ // START by updating ALL options from opts
+ $.extend(true, options, opts);
+
+ // CREATE final options (and config) for EACH pane
+ $.each(_c.allPanes, function (i, pane) {
+
+ // apply 'pane-defaults' to CONFIG.[PANE]
+ _c[pane] = $.extend(true, {}, _c.panes, _c[pane]);
+
+ d = options.panes;
+ o = options[pane];
+
+ // center-pane uses SOME keys in defaults.panes branch
+ if (pane === 'center') {
+ // ONLY copy keys from opts.panes listed in: $.layout.optionsMap.center
+ data = $.layout.optionsMap.center; // list of 'center-pane keys'
+ for (i=0, c=data.length; i<c; i++) { // loop the list...
+ key = data[i];
+ // only need to use pane-default if pane-specific value not set
+ if (!opts.center[key] && (opts.panes[key] || !o[key]))
+ o[key] = d[key]; // pane-default
+ }
+ }
+ else {
+ // border-panes use ALL keys in defaults.panes branch
+ o = options[pane] = $.extend(true, {}, d, o); // re-apply pane-specific opts AFTER pane-defaults
+ createFxOptions( pane );
+ // ensure all border-pane-specific base-classes exist
+ if (!o.resizerClass) o.resizerClass = "ui-layout-resizer";
+ if (!o.togglerClass) o.togglerClass = "ui-layout-toggler";
+ }
+ // ensure we have base pane-class (ALL panes)
+ if (!o.paneClass) o.paneClass = "ui-layout-pane";
+ });
+
+ // update options.zIndexes if a zIndex-option specified
+ var zo = opts.zIndex
+ , z = options.zIndexes;
+ if (zo > 0) {
+ z.pane_normal = zo;
+ z.content_mask = max(zo+1, z.content_mask); // MIN = +1
+ z.resizer_normal = max(zo+2, z.resizer_normal); // MIN = +2
+ }
+
+ // DELETE 'panes' key now that we are done - values were copied to EACH pane
+ delete options.panes;
+
+
+ function createFxOptions ( pane ) {
+ var o = options[pane]
+ , d = options.panes;
+ // ensure fxSettings key to avoid errors
+ if (!o.fxSettings) o.fxSettings = {};
+ if (!d.fxSettings) d.fxSettings = {};
+
+ $.each(["_open","_close","_size"], function (i,n) {
+ var
+ sName = "fxName"+ n
+ , sSpeed = "fxSpeed"+ n
+ , sSettings = "fxSettings"+ n
+ // recalculate fxName according to specificity rules
+ , fxName = o[sName] =
+ o[sName] // options.west.fxName_open
+ || d[sName] // options.panes.fxName_open
+ || o.fxName // options.west.fxName
+ || d.fxName // options.panes.fxName
+ || "none" // MEANS $.layout.defaults.panes.fxName == "" || false || null || 0
+ , fxExists = $.effects && ($.effects[fxName] || ($.effects.effect && $.effects.effect[fxName]))
+ ;
+ // validate fxName to ensure is valid effect - MUST have effect-config data in options.effects
+ if (fxName === "none" || !options.effects[fxName] || !fxExists)
+ fxName = o[sName] = "none"; // effect not loaded OR unrecognized fxName
+
+ // set vars for effects subkeys to simplify logic
+ var fx = options.effects[fxName] || {} // effects.slide
+ , fx_all = fx.all || null // effects.slide.all
+ , fx_pane = fx[pane] || null // effects.slide.west
+ ;
+ // create fxSpeed[_open|_close|_size]
+ o[sSpeed] =
+ o[sSpeed] // options.west.fxSpeed_open
+ || d[sSpeed] // options.west.fxSpeed_open
+ || o.fxSpeed // options.west.fxSpeed
+ || d.fxSpeed // options.panes.fxSpeed
+ || null // DEFAULT - let fxSetting.duration control speed
+ ;
+ // create fxSettings[_open|_close|_size]
+ o[sSettings] = $.extend(
+ true
+ , {}
+ , fx_all // effects.slide.all
+ , fx_pane // effects.slide.west
+ , d.fxSettings // options.panes.fxSettings
+ , o.fxSettings // options.west.fxSettings
+ , d[sSettings] // options.panes.fxSettings_open
+ , o[sSettings] // options.west.fxSettings_open
+ );
+ });
+
+ // DONE creating action-specific-settings for this pane,
+ // so DELETE generic options - are no longer meaningful
+ delete o.fxName;
+ delete o.fxSpeed;
+ delete o.fxSettings;
+ }
+ }
+
+ /**
+ * Initialize module objects, styling, size and position for all panes
+ *
+ * @see _initElements()
+ * @param {string} pane The pane to process
+ */
+, getPane = function (pane) {
+ var sel = options[pane].paneSelector
+ if (sel.substr(0,1)==="#") // ID selector
+ // NOTE: elements selected 'by ID' DO NOT have to be 'children'
+ return $N.find(sel).eq(0);
+ else { // class or other selector
+ var $P = $N.children(sel).eq(0);
+ // look for the pane nested inside a 'form' element
+ return $P.length ? $P : $N.children("form:first").children(sel).eq(0);
+ }
+ }
+
+ /**
+ * @param {Object=} evt
+ */
+, initPanes = function (evt) {
+ // stopPropagation if called by trigger("layoutinitpanes") - use evtPane utility
+ evtPane(evt);
+
+ // NOTE: do north & south FIRST so we can measure their height - do center LAST
+ $.each(_c.allPanes, function (idx, pane) {
+ addPane( pane, true );
+ });
+
+ // init the pane-handles NOW in case we have to hide or close the pane below
+ initHandles();
+
+ // now that all panes have been initialized and initially-sized,
+ // make sure there is really enough space available for each pane
+ $.each(_c.borderPanes, function (i, pane) {
+ if ($Ps[pane] && state[pane].isVisible) { // pane is OPEN
+ setSizeLimits(pane);
+ makePaneFit(pane); // pane may be Closed, Hidden or Resized by makePaneFit()
+ }
+ });
+ // size center-pane AGAIN in case we 'closed' a border-pane in loop above
+ sizeMidPanes("center");
+
+ // Chrome/Webkit sometimes fires callbacks BEFORE it completes resizing!
+ // Before RC30.3, there was a 10ms delay here, but that caused layout
+ // to load asynchrously, which is BAD, so try skipping delay for now
+
+ // process pane contents and callbacks, and init/resize child-layout if exists
+ $.each(_c.allPanes, function (idx, pane) {
+ afterInitPane(pane);
+ });
+ }
+
+ /**
+ * Add a pane to the layout - subroutine of initPanes()
+ *
+ * @see initPanes()
+ * @param {string} pane The pane to process
+ * @param {boolean=} [force=false] Size content after init
+ */
+, addPane = function (pane, force) {
+ if ( !force && !isInitialized() ) return;
+ var
+ o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , dir = c.dir
+ , fx = s.fx
+ , spacing = o.spacing_open || 0
+ , isCenter = (pane === "center")
+ , CSS = {}
+ , $P = $Ps[pane]
+ , size, minSize, maxSize, child
+ ;
+ // if pane-pointer already exists, remove the old one first
+ if ($P)
+ removePane( pane, false, true, false );
+ else
+ $Cs[pane] = false; // init
+
+ $P = $Ps[pane] = getPane(pane);
+ if (!$P.length) {
+ $Ps[pane] = false; // logic
+ return;
+ }
+
+ // SAVE original Pane CSS
+ if (!$P.data("layoutCSS")) {
+ var props = "position,top,left,bottom,right,width,height,overflow,zIndex,display,backgroundColor,padding,margin,border";
+ $P.data("layoutCSS", styles($P, props));
+ }
+
+ // create alias for pane data in Instance - initHandles will add more
+ Instance[pane] = {
+ name: pane
+ , pane: $Ps[pane]
+ , content: $Cs[pane]
+ , options: options[pane]
+ , state: state[pane]
+ , children: children[pane]
+ };
+
+ // add classes, attributes & events
+ $P .data({
+ parentLayout: Instance // pointer to Layout Instance
+ , layoutPane: Instance[pane] // NEW pointer to pane-alias-object
+ , layoutEdge: pane
+ , layoutRole: "pane"
+ })
+ .css(c.cssReq).css("zIndex", options.zIndexes.pane_normal)
+ .css(o.applyDemoStyles ? c.cssDemo : {}) // demo styles
+ .addClass( o.paneClass +" "+ o.paneClass+"-"+pane ) // default = "ui-layout-pane ui-layout-pane-west" - may be a dupe of 'paneSelector'
+ .bind("mouseenter."+ sID, addHover )
+ .bind("mouseleave."+ sID, removeHover )
+ ;
+ var paneMethods = {
+ hide: ''
+ , show: ''
+ , toggle: ''
+ , close: ''
+ , open: ''
+ , slideOpen: ''
+ , slideClose: ''
+ , slideToggle: ''
+ , size: 'sizePane'
+ , sizePane: 'sizePane'
+ , sizeContent: ''
+ , sizeHandles: ''
+ , enableClosable: ''
+ , disableClosable: ''
+ , enableSlideable: ''
+ , disableSlideable: ''
+ , enableResizable: ''
+ , disableResizable: ''
+ , swapPanes: 'swapPanes'
+ , swap: 'swapPanes'
+ , move: 'swapPanes'
+ , removePane: 'removePane'
+ , remove: 'removePane'
+ , createChildren: ''
+ , resizeChildren: ''
+ , resizeAll: 'resizeAll'
+ , resizeLayout: 'resizeAll'
+ }
+ , name;
+ // loop hash and bind all methods - include layoutID namespacing
+ for (name in paneMethods) {
+ $P.bind("layoutpane"+ name.toLowerCase() +"."+ sID, Instance[ paneMethods[name] || name ]);
+ }
+
+ // see if this pane has a 'scrolling-content element'
+ initContent(pane, false); // false = do NOT sizeContent() - called later
+
+ if (!isCenter) {
+ // call _parseSize AFTER applying pane classes & styles - but before making visible (if hidden)
+ // if o.size is auto or not valid, then MEASURE the pane and use that as its 'size'
+ size = s.size = _parseSize(pane, o.size);
+ minSize = _parseSize(pane,o.minSize) || 1;
+ maxSize = _parseSize(pane,o.maxSize) || 100000;
+ if (size > 0) size = max(min(size, maxSize), minSize);
+ s.autoResize = o.autoResize; // used with percentage sizes
+
+ // state for border-panes
+ s.isClosed = false; // true = pane is closed
+ s.isSliding = false; // true = pane is currently open by 'sliding' over adjacent panes
+ s.isResizing= false; // true = pane is in process of being resized
+ s.isHidden = false; // true = pane is hidden - no spacing, resizer or toggler is visible!
+
+ // array for 'pin buttons' whose classNames are auto-updated on pane-open/-close
+ if (!s.pins) s.pins = [];
+ }
+ // states common to ALL panes
+ s.tagName = $P[0].tagName;
+ s.edge = pane; // useful if pane is (or about to be) 'swapped' - easy find out where it is (or is going)
+ s.noRoom = false; // true = pane 'automatically' hidden due to insufficient room - will unhide automatically
+ s.isVisible = true; // false = pane is invisible - closed OR hidden - simplify logic
+
+ // init pane positioning
+ setPanePosition( pane );
+
+ // if pane is not visible,
+ if (dir === "horz") // north or south pane
+ CSS.height = cssH($P, size);
+ else if (dir === "vert") // east or west pane
+ CSS.width = cssW($P, size);
+ //else if (isCenter) {}
+
+ $P.css(CSS); // apply size -- top, bottom & height will be set by sizeMidPanes
+ if (dir != "horz") sizeMidPanes(pane, true); // true = skipCallback
+
+ // if manually adding a pane AFTER layout initialization, then...
+ if (state.initialized) {
+ initHandles( pane );
+ initHotkeys( pane );
+ }
+
+ // close or hide the pane if specified in settings
+ if (o.initClosed && o.closable && !o.initHidden)
+ close(pane, true, true); // true, true = force, noAnimation
+ else if (o.initHidden || o.initClosed)
+ hide(pane); // will be completely invisible - no resizer or spacing
+ else if (!s.noRoom)
+ // make the pane visible - in case was initially hidden
+ $P.css("display","block");
+ // ELSE setAsOpen() - called later by initHandles()
+
+ // RESET visibility now - pane will appear IF display:block
+ $P.css("visibility","visible");
+
+ // check option for auto-handling of pop-ups & drop-downs
+ if (o.showOverflowOnHover)
+ $P.hover( allowOverflow, resetOverflow );
+
+ // if manually adding a pane AFTER layout initialization, then...
+ if (state.initialized) {
+ afterInitPane( pane );
+ }
+ }
+
+, afterInitPane = function (pane) {
+ var $P = $Ps[pane]
+ , s = state[pane]
+ , o = options[pane]
+ ;
+ if (!$P) return;
+
+ // see if there is a directly-nested layout inside this pane
+ if ($P.data("layout"))
+ refreshChildren( pane, $P.data("layout") );
+
+ // process pane contents and callbacks, and init/resize child-layout if exists
+ if (s.isVisible) { // pane is OPEN
+ if (state.initialized) // this pane was added AFTER layout was created
+ resizeAll(); // will also sizeContent
+ else
+ sizeContent(pane);
+
+ if (o.triggerEventsOnLoad)
+ _runCallbacks("onresize_end", pane);
+ else // automatic if onresize called, otherwise call it specifically
+ // resize child - IF inner-layout already exists (created before this layout)
+ resizeChildren(pane, true); // a previously existing childLayout
+ }
+
+ // init childLayouts - even if pane is not visible
+ if (o.initChildren && o.children)
+ createChildren(pane);
+ }
+
+ /**
+ * @param {string=} panes The pane(s) to process
+ */
+, setPanePosition = function (panes) {
+ panes = panes ? panes.split(",") : _c.borderPanes;
+
+ // create toggler DIVs for each pane, and set object pointers for them, eg: $R.north = north toggler DIV
+ $.each(panes, function (i, pane) {
+ var $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , side = _c[pane].side
+ , CSS = {}
+ ;
+ if (!$P) return; // pane does not exist - skip
+
+ // set css-position to account for container borders & padding
+ switch (pane) {
+ case "north": CSS.top = sC.inset.top;
+ CSS.left = sC.inset.left;
+ CSS.right = sC.inset.right;
+ break;
+ case "south": CSS.bottom = sC.inset.bottom;
+ CSS.left = sC.inset.left;
+ CSS.right = sC.inset.right;
+ break;
+ case "west": CSS.left = sC.inset.left; // top, bottom & height set by sizeMidPanes()
+ break;
+ case "east": CSS.right = sC.inset.right; // ditto
+ break;
+ case "center": // top, left, width & height set by sizeMidPanes()
+ }
+ // apply position
+ $P.css(CSS);
+
+ // update resizer position
+ if ($R && s.isClosed)
+ $R.css(side, sC.inset[side]);
+ else if ($R && !s.isHidden)
+ $R.css(side, sC.inset[side] + getPaneSize(pane));
+ });
+ }
+
+ /**
+ * Initialize module objects, styling, size and position for all resize bars and toggler buttons
+ *
+ * @see _create()
+ * @param {string=} [panes=""] The edge(s) to process
+ */
+, initHandles = function (panes) {
+ panes = panes ? panes.split(",") : _c.borderPanes;
+
+ // create toggler DIVs for each pane, and set object pointers for them, eg: $R.north = north toggler DIV
+ $.each(panes, function (i, pane) {
+ var $P = $Ps[pane];
+ $Rs[pane] = false; // INIT
+ $Ts[pane] = false;
+ if (!$P) return; // pane does not exist - skip
+
+ var o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , paneId = o.paneSelector.substr(0,1) === "#" ? o.paneSelector.substr(1) : ""
+ , rClass = o.resizerClass
+ , tClass = o.togglerClass
+ , spacing = (s.isVisible ? o.spacing_open : o.spacing_closed)
+ , _pane = "-"+ pane // used for classNames
+ , _state = (s.isVisible ? "-open" : "-closed") // used for classNames
+ , I = Instance[pane]
+ // INIT RESIZER BAR
+ , $R = I.resizer = $Rs[pane] = $("<div></div>")
+ // INIT TOGGLER BUTTON
+ , $T = I.toggler = (o.closable ? $Ts[pane] = $("<div></div>") : false)
+ ;
+
+ //if (s.isVisible && o.resizable) ... handled by initResizable
+ if (!s.isVisible && o.slidable)
+ $R.attr("title", o.tips.Slide).css("cursor", o.sliderCursor);
+
+ $R // if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "paneLeft-resizer"
+ .attr("id", paneId ? paneId +"-resizer" : "" )
+ .data({
+ parentLayout: Instance
+ , layoutPane: Instance[pane] // NEW pointer to pane-alias-object
+ , layoutEdge: pane
+ , layoutRole: "resizer"
+ })
+ .css(_c.resizers.cssReq).css("zIndex", options.zIndexes.resizer_normal)
+ .css(o.applyDemoStyles ? _c.resizers.cssDemo : {}) // add demo styles
+ .addClass(rClass +" "+ rClass+_pane)
+ .hover(addHover, removeHover) // ALWAYS add hover-classes, even if resizing is not enabled - handle with CSS instead
+ .hover(onResizerEnter, onResizerLeave) // ALWAYS NEED resizer.mouseleave to balance toggler.mouseenter
+ .mousedown($.layout.disableTextSelection) // prevent text-selection OUTSIDE resizer
+ .mouseup($.layout.enableTextSelection) // not really necessary, but just in case
+ .appendTo($N) // append DIV to container
+ ;
+ if ($.fn.disableSelection)
+ $R.disableSelection(); // prevent text-selection INSIDE resizer
+ if (o.resizerDblClickToggle)
+ $R.bind("dblclick."+ sID, toggle );
+
+ if ($T) {
+ $T // if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "#paneLeft-toggler"
+ .attr("id", paneId ? paneId +"-toggler" : "" )
+ .data({
+ parentLayout: Instance
+ , layoutPane: Instance[pane] // NEW pointer to pane-alias-object
+ , layoutEdge: pane
+ , layoutRole: "toggler"
+ })
+ .css(_c.togglers.cssReq) // add base/required styles
+ .css(o.applyDemoStyles ? _c.togglers.cssDemo : {}) // add demo styles
+ .addClass(tClass +" "+ tClass+_pane)
+ .hover(addHover, removeHover) // ALWAYS add hover-classes, even if toggling is not enabled - handle with CSS instead
+ .bind("mouseenter", onResizerEnter) // NEED toggler.mouseenter because mouseenter MAY NOT fire on resizer
+ .appendTo($R) // append SPAN to resizer DIV
+ ;
+ // ADD INNER-SPANS TO TOGGLER
+ if (o.togglerContent_open) // ui-layout-open
+ $("<span>"+ o.togglerContent_open +"</span>")
+ .data({
+ layoutEdge: pane
+ , layoutRole: "togglerContent"
+ })
+ .data("layoutRole", "togglerContent")
+ .data("layoutEdge", pane)
+ .addClass("content content-open")
+ .css("display","none")
+ .appendTo( $T )
+ //.hover( addHover, removeHover ) // use ui-layout-toggler-west-hover .content-open instead!
+ ;
+ if (o.togglerContent_closed) // ui-layout-closed
+ $("<span>"+ o.togglerContent_closed +"</span>")
+ .data({
+ layoutEdge: pane
+ , layoutRole: "togglerContent"
+ })
+ .addClass("content content-closed")
+ .css("display","none")
+ .appendTo( $T )
+ //.hover( addHover, removeHover ) // use ui-layout-toggler-west-hover .content-closed instead!
+ ;
+ // ADD TOGGLER.click/.hover
+ enableClosable(pane);
+ }
+
+ // add Draggable events
+ initResizable(pane);
+
+ // ADD CLASSNAMES & SLIDE-BINDINGS - eg: class="resizer resizer-west resizer-open"
+ if (s.isVisible)
+ setAsOpen(pane); // onOpen will be called, but NOT onResize
+ else {
+ setAsClosed(pane); // onClose will be called
+ bindStartSlidingEvents(pane, true); // will enable events IF option is set
+ }
+
+ });
+
+ // SET ALL HANDLE DIMENSIONS
+ sizeHandles();
+ }
+
+
+ /**
+ * Initialize scrolling ui-layout-content div - if exists
+ *
+ * @see initPane() - or externally after an Ajax injection
+ * @param {string} pane The pane to process
+ * @param {boolean=} [resize=true] Size content after init
+ */
+, initContent = function (pane, resize) {
+ if (!isInitialized()) return;
+ var
+ o = options[pane]
+ , sel = o.contentSelector
+ , I = Instance[pane]
+ , $P = $Ps[pane]
+ , $C
+ ;
+ if (sel) $C = I.content = $Cs[pane] = (o.findNestedContent)
+ ? $P.find(sel).eq(0) // match 1-element only
+ : $P.children(sel).eq(0)
+ ;
+ if ($C && $C.length) {
+ $C.data("layoutRole", "content");
+ // SAVE original Content CSS
+ if (!$C.data("layoutCSS"))
+ $C.data("layoutCSS", styles($C, "height"));
+ $C.css( _c.content.cssReq );
+ if (o.applyDemoStyles) {
+ $C.css( _c.content.cssDemo ); // add padding & overflow: auto to content-div
+ $P.css( _c.content.cssDemoPane ); // REMOVE padding/scrolling from pane
+ }
+ // ensure no vertical scrollbar on pane - will mess up measurements
+ if ($P.css("overflowX").match(/(scroll|auto)/)) {
+ $P.css("overflow", "hidden");
+ }
+ state[pane].content = {}; // init content state
+ if (resize !== false) sizeContent(pane);
+ // sizeContent() is called AFTER init of all elements
+ }
+ else
+ I.content = $Cs[pane] = false;
+ }
+
+
+ /**
+ * Add resize-bars to all panes that specify it in options
+ * -dependancy: $.fn.resizable - will skip if not found
+ *
+ * @see _create()
+ * @param {string=} [panes=""] The edge(s) to process
+ */
+, initResizable = function (panes) {
+ var draggingAvailable = $.layout.plugins.draggable
+ , side // set in start()
+ ;
+ panes = panes ? panes.split(",") : _c.borderPanes;
+
+ $.each(panes, function (idx, pane) {
+ var o = options[pane];
+ if (!draggingAvailable || !$Ps[pane] || !o.resizable) {
+ o.resizable = false;
+ return true; // skip to next
+ }
+
+ var s = state[pane]
+ , z = options.zIndexes
+ , c = _c[pane]
+ , side = c.dir=="horz" ? "top" : "left"
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , base = o.resizerClass
+ , lastPos = 0 // used when live-resizing
+ , r, live // set in start because may change
+ // 'drag' classes are applied to the ORIGINAL resizer-bar while dragging is in process
+ , resizerClass = base+"-drag" // resizer-drag
+ , resizerPaneClass = base+"-"+pane+"-drag" // resizer-north-drag
+ // 'helper' class is applied to the CLONED resizer-bar while it is being dragged
+ , helperClass = base+"-dragging" // resizer-dragging
+ , helperPaneClass = base+"-"+pane+"-dragging" // resizer-north-dragging
+ , helperLimitClass = base+"-dragging-limit" // resizer-drag
+ , helperPaneLimitClass = base+"-"+pane+"-dragging-limit" // resizer-north-drag
+ , helperClassesSet = false // logic var
+ ;
+
+ if (!s.isClosed)
+ $R.attr("title", o.tips.Resize)
+ .css("cursor", o.resizerCursor); // n-resize, s-resize, etc
+
+ $R.draggable({
+ containment: $N[0] // limit resizing to layout container
+ , axis: (c.dir=="horz" ? "y" : "x") // limit resizing to horz or vert axis
+ , delay: 0
+ , distance: 1
+ , grid: o.resizingGrid
+ // basic format for helper - style it using class: .ui-draggable-dragging
+ , helper: "clone"
+ , opacity: o.resizerDragOpacity
+ , addClasses: false // avoid ui-state-disabled class when disabled
+ //, iframeFix: o.draggableIframeFix // TODO: consider using when bug is fixed
+ , zIndex: z.resizer_drag
+
+ , start: function (e, ui) {
+ // REFRESH options & state pointers in case we used swapPanes
+ o = options[pane];
+ s = state[pane];
+ // re-read options
+ live = o.livePaneResizing;
+
+ // ondrag_start callback - will CANCEL hide if returns false
+ // TODO: dragging CANNOT be cancelled like this, so see if there is a way?
+ if (false === _runCallbacks("ondrag_start", pane)) return false;
+
+ s.isResizing = true; // prevent pane from closing while resizing
+ state.paneResizing = pane; // easy to see if ANY pane is resizing
+ timer.clear(pane+"_closeSlider"); // just in case already triggered
+
+ // SET RESIZER LIMITS - used in drag()
+ setSizeLimits(pane); // update pane/resizer state
+ r = s.resizerPosition;
+ lastPos = ui.position[ side ]
+
+ $R.addClass( resizerClass +" "+ resizerPaneClass ); // add drag classes
+ helperClassesSet = false; // reset logic var - see drag()
+
+ // MASK PANES CONTAINING IFRAMES, APPLETS OR OTHER TROUBLESOME ELEMENTS
+ showMasks( pane, { resizing: true });
+ }
+
+ , drag: function (e, ui) {
+ if (!helperClassesSet) { // can only add classes after clone has been added to the DOM
+ //$(".ui-draggable-dragging")
+ ui.helper
+ .addClass( helperClass +" "+ helperPaneClass ) // add helper classes
+ .css({ right: "auto", bottom: "auto" }) // fix dir="rtl" issue
+ .children().css("visibility","hidden") // hide toggler inside dragged resizer-bar
+ ;
+ helperClassesSet = true;
+ // draggable bug!? RE-SET zIndex to prevent E/W resize-bar showing through N/S pane!
+ if (s.isSliding) $Ps[pane].css("zIndex", z.pane_sliding);
+ }
+ // CONTAIN RESIZER-BAR TO RESIZING LIMITS
+ var limit = 0;
+ if (ui.position[side] < r.min) {
+ ui.position[side] = r.min;
+ limit = -1;
+ }
+ else if (ui.position[side] > r.max) {
+ ui.position[side] = r.max;
+ limit = 1;
+ }
+ // ADD/REMOVE dragging-limit CLASS
+ if (limit) {
+ ui.helper.addClass( helperLimitClass +" "+ helperPaneLimitClass ); // at dragging-limit
+ window.defaultStatus = (limit>0 && pane.match(/(north|west)/)) || (limit<0 && pane.match(/(south|east)/)) ? o.tips.maxSizeWarning : o.tips.minSizeWarning;
+ }
+ else {
+ ui.helper.removeClass( helperLimitClass +" "+ helperPaneLimitClass ); // not at dragging-limit
+ window.defaultStatus = "";
+ }
+ // DYNAMICALLY RESIZE PANES IF OPTION ENABLED
+ // won't trigger unless resizer has actually moved!
+ if (live && Math.abs(ui.position[side] - lastPos) >= o.liveResizingTolerance) {
+ lastPos = ui.position[side];
+ resizePanes(e, ui, pane)
+ }
+ }
+
+ , stop: function (e, ui) {
+ $('body').enableSelection(); // RE-ENABLE TEXT SELECTION
+ window.defaultStatus = ""; // clear 'resizing limit' message from statusbar
+ $R.removeClass( resizerClass +" "+ resizerPaneClass ); // remove drag classes from Resizer
+ s.isResizing = false;
+ state.paneResizing = false; // easy to see if ANY pane is resizing
+ resizePanes(e, ui, pane, true); // true = resizingDone
+ }
+
+ });
+ });
+
+ /**
+ * resizePanes
+ *
+ * Sub-routine called from stop() - and drag() if livePaneResizing
+ *
+ * @param {!Object} evt
+ * @param {!Object} ui
+ * @param {string} pane
+ * @param {boolean=} [resizingDone=false]
+ */
+ var resizePanes = function (evt, ui, pane, resizingDone) {
+ var dragPos = ui.position
+ , c = _c[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , resizerPos
+ ;
+ switch (pane) {
+ case "north": resizerPos = dragPos.top; break;
+ case "west": resizerPos = dragPos.left; break;
+ case "south": resizerPos = sC.layoutHeight - dragPos.top - o.spacing_open; break;
+ case "east": resizerPos = sC.layoutWidth - dragPos.left - o.spacing_open; break;
+ };
+ // remove container margin from resizer position to get the pane size
+ var newSize = resizerPos - sC.inset[c.side];
+
+ // Disable OR Resize Mask(s) created in drag.start
+ if (!resizingDone) {
+ // ensure we meet liveResizingTolerance criteria
+ if (Math.abs(newSize - s.size) < o.liveResizingTolerance)
+ return; // SKIP resize this time
+ // resize the pane
+ manualSizePane(pane, newSize, false, true); // true = noAnimation
+ sizeMasks(); // resize all visible masks
+ }
+ else { // resizingDone
+ // ondrag_end callback
+ if (false !== _runCallbacks("ondrag_end", pane))
+ manualSizePane(pane, newSize, false, true); // true = noAnimation
+ hideMasks(true); // true = force hiding all masks even if one is 'sliding'
+ if (s.isSliding) // RE-SHOW 'object-masks' so objects won't show through sliding pane
+ showMasks( pane, { resizing: true });
+ }
+ };
+ }
+
+ /**
+ * sizeMask
+ *
+ * Needed to overlay a DIV over an IFRAME-pane because mask CANNOT be *inside* the pane
+ * Called when mask created, and during livePaneResizing
+ */
+, sizeMask = function () {
+ var $M = $(this)
+ , pane = $M.data("layoutMask") // eg: "west"
+ , s = state[pane]
+ ;
+ // only masks over an IFRAME-pane need manual resizing
+ if (s.tagName == "IFRAME" && s.isVisible) // no need to mask closed/hidden panes
+ $M.css({
+ top: s.offsetTop
+ , left: s.offsetLeft
+ , width: s.outerWidth
+ , height: s.outerHeight
+ });
+ /* ALT Method...
+ var $P = $Ps[pane];
+ $M.css( $P.position() ).css({ width: $P[0].offsetWidth, height: $P[0].offsetHeight });
+ */
+ }
+, sizeMasks = function () {
+ $Ms.each( sizeMask ); // resize all 'visible' masks
+ }
+
+ /**
+ * @param {string} pane The pane being resized, animated or isSliding
+ * @param {Object=} [args] (optional) Options: which masks to apply, and to which panes
+ */
+, showMasks = function (pane, args) {
+ var c = _c[pane]
+ , panes = ["center"]
+ , z = options.zIndexes
+ , a = $.extend({
+ objectsOnly: false
+ , animation: false
+ , resizing: true
+ , sliding: state[pane].isSliding
+ }, args )
+ , o, s
+ ;
+ if (a.resizing)
+ panes.push( pane );
+ if (a.sliding)
+ panes.push( _c.oppositeEdge[pane] ); // ADD the oppositeEdge-pane
+
+ if (c.dir === "horz") {
+ panes.push("west");
+ panes.push("east");
+ }
+
+ $.each(panes, function(i,p){
+ s = state[p];
+ o = options[p];
+ if (s.isVisible && ( o.maskObjects || (!a.objectsOnly && o.maskContents) )) {
+ getMasks(p).each(function(){
+ sizeMask.call(this);
+ this.style.zIndex = s.isSliding ? z.pane_sliding+1 : z.pane_normal+1
+ this.style.display = "block";
+ });
+ }
+ });
+ }
+
+ /**
+ * @param {boolean=} force Hide masks even if a pane is sliding
+ */
+, hideMasks = function (force) {
+ // ensure no pane is resizing - could be a timing issue
+ if (force || !state.paneResizing) {
+ $Ms.hide(); // hide ALL masks
+ }
+ // if ANY pane is sliding, then DO NOT remove masks from panes with maskObjects enabled
+ else if (!force && !$.isEmptyObject( state.panesSliding )) {
+ var i = $Ms.length - 1
+ , p, $M;
+ for (; i >= 0; i--) {
+ $M = $Ms.eq(i);
+ p = $M.data("layoutMask");
+ if (!options[p].maskObjects) {
+ $M.hide();
+ }
+ }
+ }
+ }
+
+ /**
+ * @param {string} pane
+ */
+, getMasks = function (pane) {
+ var $Masks = $([])
+ , $M, i = 0, c = $Ms.length
+ ;
+ for (; i<c; i++) {
+ $M = $Ms.eq(i);
+ if ($M.data("layoutMask") === pane)
+ $Masks = $Masks.add( $M );
+ }
+ if ($Masks.length)
+ return $Masks;
+ else
+ return createMasks(pane);
+ }
+
+ /**
+ * createMasks
+ *
+ * Generates both DIV (ALWAYS used) and IFRAME (optional) elements as masks
+ * An IFRAME mask is created *under* the DIV when maskObjects=true, because a DIV cannot mask an applet
+ *
+ * @param {string} pane
+ */
+, createMasks = function (pane) {
+ var
+ $P = $Ps[pane]
+ , s = state[pane]
+ , o = options[pane]
+ , z = options.zIndexes
+ , isIframe, el, $M, css, i
+ ;
+ if (!o.maskContents && !o.maskObjects) return $([]);
+ // if o.maskObjects=true, then loop TWICE to create BOTH kinds of mask, else only create a DIV
+ for (i=0; i < (o.maskObjects ? 2 : 1); i++) {
+ isIframe = o.maskObjects && i==0;
+ el = document.createElement( isIframe ? "iframe" : "div" );
+ $M = $(el).data("layoutMask", pane); // add data to relate mask to pane
+ el.className = "ui-layout-mask ui-layout-mask-"+ pane; // for user styling
+ css = el.style;
+ // Both DIVs and IFRAMES
+ css.background = "#FFF";
+ css.position = "absolute";
+ css.display = "block";
+ if (isIframe) { // IFRAME-only props
+ el.src = "about:blank";
+ el.frameborder = 0;
+ css.border = 0;
+ css.opacity = 0;
+ css.filter = "Alpha(Opacity='0')";
+ //el.allowTransparency = true; - for IE, but breaks masking ability!
+ }
+ else { // DIV-only props
+ css.opacity = 0.001;
+ css.filter = "Alpha(Opacity='1')";
+ }
+ // if pane IS an IFRAME, then must mask the pane itself
+ if (s.tagName == "IFRAME") {
+ // NOTE sizing done by a subroutine so can be called during live-resizing
+ css.zIndex = z.pane_normal+1; // 1-higher than pane
+ $N.append( el ); // append to LAYOUT CONTAINER
+ }
+ // otherwise put masks *inside the pane* to mask its contents
+ else {
+ $M.addClass("ui-layout-mask-inside-pane");
+ css.zIndex = o.maskZindex || z.content_mask; // usually 1, but customizable
+ css.top = 0;
+ css.left = 0;
+ css.width = "100%";
+ css.height = "100%";
+ $P.append( el ); // append INSIDE pane element
+ }
+ // add Mask to cached array so can be resized & reused
+ $Ms = $Ms.add( el );
+ }
+ return $Ms;
+ }
+
+
+ /**
+ * Destroy this layout and reset all elements
+ *
+ * @param {boolean=} [destroyChildren=false] Destory Child-Layouts first?
+ */
+, destroy = function (evt_or_destroyChildren, destroyChildren) {
+ // UNBIND layout events and remove global object
+ $(window).unbind("."+ sID); // resize & unload
+ $(document).unbind("."+ sID); // keyDown (hotkeys)
+
+ if (typeof evt_or_destroyChildren === "object")
+ // stopPropagation if called by trigger("layoutdestroy") - use evtPane utility
+ evtPane(evt_or_destroyChildren);
+ else // no event, so transfer 1st param to destroyChildren param
+ destroyChildren = evt_or_destroyChildren;
+
+ // need to look for parent layout BEFORE we remove the container data, else skips a level
+ //var parentPane = Instance.hasParentLayout ? $.layout.getParentPaneInstance( $N ) : null;
+
+ // reset layout-container
+ $N .clearQueue()
+ .removeData("layout")
+ .removeData("layoutContainer")
+ .removeClass(options.containerClass)
+ .unbind("."+ sID) // remove ALL Layout events
+ ;
+
+ // remove all mask elements that have been created
+ $Ms.remove();
+
+ // loop all panes to remove layout classes, attributes and bindings
+ $.each(_c.allPanes, function (i, pane) {
+ removePane( pane, false, true, destroyChildren ); // true = skipResize
+ });
+
+ // do NOT reset container CSS if is a 'pane' (or 'content') in an outer-layout - ie, THIS layout is 'nested'
+ var css = "layoutCSS";
+ if ($N.data(css) && !$N.data("layoutRole")) // RESET CSS
+ $N.css( $N.data(css) ).removeData(css);
+
+ // for full-page layouts, also reset the <HTML> CSS
+ if (sC.tagName === "BODY" && ($N = $("html")).data(css)) // RESET <HTML> CSS
+ $N.css( $N.data(css) ).removeData(css);
+
+ // trigger plugins for this layout, if there are any
+ runPluginCallbacks( Instance, $.layout.onDestroy );
+
+ // trigger state-management and onunload callback
+ unload();
+
+ // clear the Instance of everything except for container & options (so could recreate)
+ // RE-CREATE: myLayout = myLayout.container.layout( myLayout.options );
+ for (var n in Instance)
+ if (!n.match(/^(container|options)$/)) delete Instance[ n ];
+ // add a 'destroyed' flag to make it easy to check
+ Instance.destroyed = true;
+
+ // if this is a child layout, CLEAR the child-pointer in the parent
+ /* for now the pointer REMAINS, but with only container, options and destroyed keys
+ if (parentPane) {
+ var layout = parentPane.pane.data("parentLayout")
+ , key = layout.options.instanceKey || 'error';
+ // THIS SYNTAX MAY BE WRONG!
+ parentPane.children[key] = layout.children[ parentPane.name ].children[key] = null;
+ }
+ */
+
+ return Instance; // for coding convenience
+ }
+
+ /**
+ * Remove a pane from the layout - subroutine of destroy()
+ *
+ * @see destroy()
+ * @param {(string|Object)} evt_or_pane The pane to process
+ * @param {boolean=} [remove=false] Remove the DOM element?
+ * @param {boolean=} [skipResize=false] Skip calling resizeAll()?
+ * @param {boolean=} [destroyChild=true] Destroy Child-layouts? If not passed, obeys options setting
+ */
+, removePane = function (evt_or_pane, remove, skipResize, destroyChild) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $P = $Ps[pane]
+ , $C = $Cs[pane]
+ , $R = $Rs[pane]
+ , $T = $Ts[pane]
+ ;
+ // NOTE: elements can still exist even after remove()
+ // so check for missing data(), which is cleared by removed()
+ if ($P && $.isEmptyObject( $P.data() )) $P = false;
+ if ($C && $.isEmptyObject( $C.data() )) $C = false;
+ if ($R && $.isEmptyObject( $R.data() )) $R = false;
+ if ($T && $.isEmptyObject( $T.data() )) $T = false;
+
+ if ($P) $P.stop(true, true);
+
+ var o = options[pane]
+ , s = state[pane]
+ , d = "layout"
+ , css = "layoutCSS"
+ , pC = children[pane]
+ , hasChildren = $.isPlainObject( pC ) && !$.isEmptyObject( pC )
+ , destroy = destroyChild !== undefined ? destroyChild : o.destroyChildren
+ ;
+ // FIRST destroy the child-layout(s)
+ if (hasChildren && destroy) {
+ $.each( pC, function (key, child) {
+ if (!child.destroyed)
+ child.destroy(true);// tell child-layout to destroy ALL its child-layouts too
+ if (child.destroyed) // destroy was successful
+ delete pC[key];
+ });
+ // if no more children, remove the children hash
+ if ($.isEmptyObject( pC )) {
+ pC = children[pane] = null; // clear children hash
+ hasChildren = false;
+ }
+ }
+
+ // Note: can't 'remove' a pane element with non-destroyed children
+ if ($P && remove && !hasChildren)
+ $P.remove(); // remove the pane-element and everything inside it
+ else if ($P && $P[0]) {
+ // create list of ALL pane-classes that need to be removed
+ var root = o.paneClass // default="ui-layout-pane"
+ , pRoot = root +"-"+ pane // eg: "ui-layout-pane-west"
+ , _open = "-open"
+ , _sliding= "-sliding"
+ , _closed = "-closed"
+ , classes = [ root, root+_open, root+_closed, root+_sliding, // generic classes
+ pRoot, pRoot+_open, pRoot+_closed, pRoot+_sliding ] // pane-specific classes
+ ;
+ $.merge(classes, getHoverClasses($P, true)); // ADD hover-classes
+ // remove all Layout classes from pane-element
+ $P .removeClass( classes.join(" ") ) // remove ALL pane-classes
+ .removeData("parentLayout")
+ .removeData("layoutPane")
+ .removeData("layoutRole")
+ .removeData("layoutEdge")
+ .removeData("autoHidden") // in case set
+ .unbind("."+ sID) // remove ALL Layout events
+ // TODO: remove these extra unbind commands when jQuery is fixed
+ //.unbind("mouseenter"+ sID)
+ //.unbind("mouseleave"+ sID)
+ ;
+ // do NOT reset CSS if this pane/content is STILL the container of a nested layout!
+ // the nested layout will reset its 'container' CSS when/if it is destroyed
+ if (hasChildren && $C) {
+ // a content-div may not have a specific width, so give it one to contain the Layout
+ $C.width( $C.width() );
+ $.each( pC, function (key, child) {
+ child.resizeAll(); // resize the Layout
+ });
+ }
+ else if ($C)
+ $C.css( $C.data(css) ).removeData(css).removeData("layoutRole");
+ // remove pane AFTER content in case there was a nested layout
+ if (!$P.data(d))
+ $P.css( $P.data(css) ).removeData(css);
+ }
+
+ // REMOVE pane resizer and toggler elements
+ if ($T) $T.remove();
+ if ($R) $R.remove();
+
+ // CLEAR all pointers and state data
+ Instance[pane] = $Ps[pane] = $Cs[pane] = $Rs[pane] = $Ts[pane] = false;
+ s = { removed: true };
+
+ if (!skipResize)
+ resizeAll();
+ }
+
+
+/*
+ * ###########################
+ * ACTION METHODS
+ * ###########################
+ */
+
+ /**
+ * @param {string} pane
+ */
+, _hidePane = function (pane) {
+ var $P = $Ps[pane]
+ , o = options[pane]
+ , s = $P[0].style
+ ;
+ if (o.useOffscreenClose) {
+ if (!$P.data(_c.offscreenReset))
+ $P.data(_c.offscreenReset, { left: s.left, right: s.right });
+ $P.css( _c.offscreenCSS );
+ }
+ else
+ $P.hide().removeData(_c.offscreenReset);
+ }
+
+ /**
+ * @param {string} pane
+ */
+, _showPane = function (pane) {
+ var $P = $Ps[pane]
+ , o = options[pane]
+ , off = _c.offscreenCSS
+ , old = $P.data(_c.offscreenReset)
+ , s = $P[0].style
+ ;
+ $P .show() // ALWAYS show, just in case
+ .removeData(_c.offscreenReset);
+ if (o.useOffscreenClose && old) {
+ if (s.left == off.left)
+ s.left = old.left;
+ if (s.right == off.right)
+ s.right = old.right;
+ }
+ }
+
+
+ /**
+ * Completely 'hides' a pane, including its spacing - as if it does not exist
+ * The pane is not actually 'removed' from the source, so can use 'show' to un-hide it
+ *
+ * @param {(string|Object)} evt_or_pane The pane being hidden, ie: north, south, east, or west
+ * @param {boolean=} [noAnimation=false]
+ */
+, hide = function (evt_or_pane, noAnimation) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , o = options[pane]
+ , s = state[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ ;
+ if (pane === "center" || !$P || s.isHidden) return; // pane does not exist OR is already hidden
+
+ // onhide_start callback - will CANCEL hide if returns false
+ if (state.initialized && false === _runCallbacks("onhide_start", pane)) return;
+
+ s.isSliding = false; // just in case
+ delete state.panesSliding[pane];
+
+ // now hide the elements
+ if ($R) $R.hide(); // hide resizer-bar
+ if (!state.initialized || s.isClosed) {
+ s.isClosed = true; // to trigger open-animation on show()
+ s.isHidden = true;
+ s.isVisible = false;
+ if (!state.initialized)
+ _hidePane(pane); // no animation when loading page
+ sizeMidPanes(_c[pane].dir === "horz" ? "" : "center");
+ if (state.initialized || o.triggerEventsOnLoad)
+ _runCallbacks("onhide_end", pane);
+ }
+ else {
+ s.isHiding = true; // used by onclose
+ close(pane, false, noAnimation); // adjust all panes to fit
+ }
+ }
+
+ /**
+ * Show a hidden pane - show as 'closed' by default unless openPane = true
+ *
+ * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west
+ * @param {boolean=} [openPane=false]
+ * @param {boolean=} [noAnimation=false]
+ * @param {boolean=} [noAlert=false]
+ */
+, show = function (evt_or_pane, openPane, noAnimation, noAlert) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , o = options[pane]
+ , s = state[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ ;
+ if (pane === "center" || !$P || !s.isHidden) return; // pane does not exist OR is not hidden
+
+ // onshow_start callback - will CANCEL show if returns false
+ if (false === _runCallbacks("onshow_start", pane)) return;
+
+ s.isShowing = true; // used by onopen/onclose
+ //s.isHidden = false; - will be set by open/close - if not cancelled
+ s.isSliding = false; // just in case
+ delete state.panesSliding[pane];
+
+ // now show the elements
+ //if ($R) $R.show(); - will be shown by open/close
+ if (openPane === false)
+ close(pane, true); // true = force
+ else
+ open(pane, false, noAnimation, noAlert); // adjust all panes to fit
+ }
+
+
+ /**
+ * Toggles a pane open/closed by calling either open or close
+ *
+ * @param {(string|Object)} evt_or_pane The pane being toggled, ie: north, south, east, or west
+ * @param {boolean=} [slide=false]
+ */
+, toggle = function (evt_or_pane, slide) {
+ if (!isInitialized()) return;
+ var evt = evtObj(evt_or_pane)
+ , pane = evtPane.call(this, evt_or_pane)
+ , s = state[pane]
+ ;
+ if (evt) // called from to $R.dblclick OR triggerPaneEvent
+ evt.stopImmediatePropagation();
+ if (s.isHidden)
+ show(pane); // will call 'open' after unhiding it
+ else if (s.isClosed)
+ open(pane, !!slide);
+ else
+ close(pane);
+ }
+
+
+ /**
+ * Utility method used during init or other auto-processes
+ *
+ * @param {string} pane The pane being closed
+ * @param {boolean=} [setHandles=false]
+ */
+, _closePane = function (pane, setHandles) {
+ var
+ $P = $Ps[pane]
+ , s = state[pane]
+ ;
+ _hidePane(pane);
+ s.isClosed = true;
+ s.isVisible = false;
+ if (setHandles) setAsClosed(pane);
+ }
+
+ /**
+ * Close the specified pane (animation optional), and resize all other panes as needed
+ *
+ * @param {(string|Object)} evt_or_pane The pane being closed, ie: north, south, east, or west
+ * @param {boolean=} [force=false]
+ * @param {boolean=} [noAnimation=false]
+ * @param {boolean=} [skipCallback=false]
+ */
+, close = function (evt_or_pane, force, noAnimation, skipCallback) {
+ var pane = evtPane.call(this, evt_or_pane);
+ if (pane === "center") return; // validate
+ // if pane has been initialized, but NOT the complete layout, close pane instantly
+ if (!state.initialized && $Ps[pane]) {
+ _closePane(pane, true); // INIT pane as closed
+ return;
+ }
+ if (!isInitialized()) return;
+
+ var
+ $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , $T = $Ts[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , doFX, isShowing, isHiding, wasSliding;
+
+ // QUEUE in case another action/animation is in progress
+ $N.queue(function( queueNext ){
+
+ if ( !$P
+ || (!o.closable && !s.isShowing && !s.isHiding) // invalid request // (!o.resizable && !o.closable) ???
+ || (!force && s.isClosed && !s.isShowing) // already closed
+ ) return queueNext();
+
+ // onclose_start callback - will CANCEL hide if returns false
+ // SKIP if just 'showing' a hidden pane as 'closed'
+ var abort = !s.isShowing && false === _runCallbacks("onclose_start", pane);
+
+ // transfer logic vars to temp vars
+ isShowing = s.isShowing;
+ isHiding = s.isHiding;
+ wasSliding = s.isSliding;
+ // now clear the logic vars (REQUIRED before aborting)
+ delete s.isShowing;
+ delete s.isHiding;
+
+ if (abort) return queueNext();
+
+ doFX = !noAnimation && !s.isClosed && (o.fxName_close != "none");
+ s.isMoving = true;
+ s.isClosed = true;
+ s.isVisible = false;
+ // update isHidden BEFORE sizing panes
+ if (isHiding) s.isHidden = true;
+ else if (isShowing) s.isHidden = false;
+
+ if (s.isSliding) // pane is being closed, so UNBIND trigger events
+ bindStopSlidingEvents(pane, false); // will set isSliding=false
+ else // resize panes adjacent to this one
+ sizeMidPanes(_c[pane].dir === "horz" ? "" : "center", false); // false = NOT skipCallback
+
+ // if this pane has a resizer bar, move it NOW - before animation
+ setAsClosed(pane);
+
+ // CLOSE THE PANE
+ if (doFX) { // animate the close
+ lockPaneForFX(pane, true); // need to set left/top so animation will work
+ $P.hide( o.fxName_close, o.fxSettings_close, o.fxSpeed_close, function () {
+ lockPaneForFX(pane, false); // undo
+ if (s.isClosed) close_2();
+ queueNext();
+ });
+ }
+ else { // hide the pane without animation
+ _hidePane(pane);
+ close_2();
+ queueNext();
+ };
+ });
+
+ // SUBROUTINE
+ function close_2 () {
+ s.isMoving = false;
+ bindStartSlidingEvents(pane, true); // will enable if o.slidable = true
+
+ // if opposite-pane was autoClosed, see if it can be autoOpened now
+ var altPane = _c.oppositeEdge[pane];
+ if (state[ altPane ].noRoom) {
+ setSizeLimits( altPane );
+ makePaneFit( altPane );
+ }
+
+ if (!skipCallback && (state.initialized || o.triggerEventsOnLoad)) {
+ // onclose callback - UNLESS just 'showing' a hidden pane as 'closed'
+ if (!isShowing) _runCallbacks("onclose_end", pane);
+ // onhide OR onshow callback
+ if (isShowing) _runCallbacks("onshow_end", pane);
+ if (isHiding) _runCallbacks("onhide_end", pane);
+ }
+ }
+ }
+
+ /**
+ * @param {string} pane The pane just closed, ie: north, south, east, or west
+ */
+, setAsClosed = function (pane) {
+ if (!$Rs[pane]) return; // handles not initialized yet!
+ var
+ $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , $T = $Ts[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , side = _c[pane].side
+ , rClass = o.resizerClass
+ , tClass = o.togglerClass
+ , _pane = "-"+ pane // used for classNames
+ , _open = "-open"
+ , _sliding= "-sliding"
+ , _closed = "-closed"
+ ;
+ $R
+ .css(side, sC.inset[side]) // move the resizer
+ .removeClass( rClass+_open +" "+ rClass+_pane+_open )
+ .removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding )
+ .addClass( rClass+_closed +" "+ rClass+_pane+_closed )
+ ;
+ // handle already-hidden panes in case called by swap() or a similar method
+ if (s.isHidden) $R.hide(); // hide resizer-bar
+
+ // DISABLE 'resizing' when closed - do this BEFORE bindStartSlidingEvents?
+ if (o.resizable && $.layout.plugins.draggable)
+ $R
+ .draggable("disable")
+ .removeClass("ui-state-disabled") // do NOT apply disabled styling - not suitable here
+ .css("cursor", "default")
+ .attr("title","")
+ ;
+
+ // if pane has a toggler button, adjust that too
+ if ($T) {
+ $T
+ .removeClass( tClass+_open +" "+ tClass+_pane+_open )
+ .addClass( tClass+_closed +" "+ tClass+_pane+_closed )
+ .attr("title", o.tips.Open) // may be blank
+ ;
+ // toggler-content - if exists
+ $T.children(".content-open").hide();
+ $T.children(".content-closed").css("display","block");
+ }
+
+ // sync any 'pin buttons'
+ syncPinBtns(pane, false);
+
+ if (state.initialized) {
+ // resize 'length' and position togglers for adjacent panes
+ sizeHandles();
+ }
+ }
+
+ /**
+ * Open the specified pane (animation optional), and resize all other panes as needed
+ *
+ * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west
+ * @param {boolean=} [slide=false]
+ * @param {boolean=} [noAnimation=false]
+ * @param {boolean=} [noAlert=false]
+ */
+, open = function (evt_or_pane, slide, noAnimation, noAlert) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , $T = $Ts[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , doFX, isShowing
+ ;
+ if (pane === "center") return; // validate
+ // QUEUE in case another action/animation is in progress
+ $N.queue(function( queueNext ){
+
+ if ( !$P
+ || (!o.resizable && !o.closable && !s.isShowing) // invalid request
+ || (s.isVisible && !s.isSliding) // already open
+ ) return queueNext();
+
+ // pane can ALSO be unhidden by just calling show(), so handle this scenario
+ if (s.isHidden && !s.isShowing) {
+ queueNext(); // call before show() because it needs the queue free
+ show(pane, true);
+ return;
+ }
+
+ if (s.autoResize && s.size != o.size) // resize pane to original size set in options
+ sizePane(pane, o.size, true, true, true); // true=skipCallback/noAnimation/forceResize
+ else
+ // make sure there is enough space available to open the pane
+ setSizeLimits(pane, slide);
+
+ // onopen_start callback - will CANCEL open if returns false
+ var cbReturn = _runCallbacks("onopen_start", pane);
+
+ if (cbReturn === "abort")
+ return queueNext();
+
+ // update pane-state again in case options were changed in onopen_start
+ if (cbReturn !== "NC") // NC = "No Callback"
+ setSizeLimits(pane, slide);
+
+ if (s.minSize > s.maxSize) { // INSUFFICIENT ROOM FOR PANE TO OPEN!
+ syncPinBtns(pane, false); // make sure pin-buttons are reset
+ if (!noAlert && o.tips.noRoomToOpen)
+ alert(o.tips.noRoomToOpen);
+ return queueNext(); // ABORT
+ }
+
+ if (slide) // START Sliding - will set isSliding=true
+ bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane
+ else if (s.isSliding) // PIN PANE (stop sliding) - open pane 'normally' instead
+ bindStopSlidingEvents(pane, false); // UNBIND trigger events - will set isSliding=false
+ else if (o.slidable)
+ bindStartSlidingEvents(pane, false); // UNBIND trigger events
+
+ s.noRoom = false; // will be reset by makePaneFit if 'noRoom'
+ makePaneFit(pane);
+
+ // transfer logic var to temp var
+ isShowing = s.isShowing;
+ // now clear the logic var
+ delete s.isShowing;
+
+ doFX = !noAnimation && s.isClosed && (o.fxName_open != "none");
+ s.isMoving = true;
+ s.isVisible = true;
+ s.isClosed = false;
+ // update isHidden BEFORE sizing panes - WHY??? Old?
+ if (isShowing) s.isHidden = false;
+
+ if (doFX) { // ANIMATE
+ // mask adjacent panes with objects
+ lockPaneForFX(pane, true); // need to set left/top so animation will work
+ $P.show( o.fxName_open, o.fxSettings_open, o.fxSpeed_open, function() {
+ lockPaneForFX(pane, false); // undo
+ if (s.isVisible) open_2(); // continue
+ queueNext();
+ });
+ }
+ else { // no animation
+ _showPane(pane);// just show pane and...
+ open_2(); // continue
+ queueNext();
+ };
+ });
+
+ // SUBROUTINE
+ function open_2 () {
+ s.isMoving = false;
+
+ // cure iframe display issues
+ _fixIframe(pane);
+
+ // NOTE: if isSliding, then other panes are NOT 'resized'
+ if (!s.isSliding) { // resize all panes adjacent to this one
+ sizeMidPanes(_c[pane].dir=="vert" ? "center" : "", false); // false = NOT skipCallback
+ }
+
+ // set classes, position handles and execute callbacks...
+ setAsOpen(pane);
+ };
+
+ }
+
+ /**
+ * @param {string} pane The pane just opened, ie: north, south, east, or west
+ * @param {boolean=} [skipCallback=false]
+ */
+, setAsOpen = function (pane, skipCallback) {
+ var
+ $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , $T = $Ts[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , side = _c[pane].side
+ , rClass = o.resizerClass
+ , tClass = o.togglerClass
+ , _pane = "-"+ pane // used for classNames
+ , _open = "-open"
+ , _closed = "-closed"
+ , _sliding= "-sliding"
+ ;
+ $R
+ .css(side, sC.inset[side] + getPaneSize(pane)) // move the resizer
+ .removeClass( rClass+_closed +" "+ rClass+_pane+_closed )
+ .addClass( rClass+_open +" "+ rClass+_pane+_open )
+ ;
+ if (s.isSliding)
+ $R.addClass( rClass+_sliding +" "+ rClass+_pane+_sliding )
+ else // in case 'was sliding'
+ $R.removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding )
+
+ removeHover( 0, $R ); // remove hover classes
+ if (o.resizable && $.layout.plugins.draggable)
+ $R .draggable("enable")
+ .css("cursor", o.resizerCursor)
+ .attr("title", o.tips.Resize);
+ else if (!s.isSliding)
+ $R.css("cursor", "default"); // n-resize, s-resize, etc
+
+ // if pane also has a toggler button, adjust that too
+ if ($T) {
+ $T .removeClass( tClass+_closed +" "+ tClass+_pane+_closed )
+ .addClass( tClass+_open +" "+ tClass+_pane+_open )
+ .attr("title", o.tips.Close); // may be blank
+ removeHover( 0, $T ); // remove hover classes
+ // toggler-content - if exists
+ $T.children(".content-closed").hide();
+ $T.children(".content-open").css("display","block");
+ }
+
+ // sync any 'pin buttons'
+ syncPinBtns(pane, !s.isSliding);
+
+ // update pane-state dimensions - BEFORE resizing content
+ $.extend(s, elDims($P));
+
+ if (state.initialized) {
+ // resize resizer & toggler sizes for all panes
+ sizeHandles();
+ // resize content every time pane opens - to be sure
+ sizeContent(pane, true); // true = remeasure headers/footers, even if 'pane.isMoving'
+ }
+
+ if (!skipCallback && (state.initialized || o.triggerEventsOnLoad) && $P.is(":visible")) {
+ // onopen callback
+ _runCallbacks("onopen_end", pane);
+ // onshow callback - TODO: should this be here?
+ if (s.isShowing) _runCallbacks("onshow_end", pane);
+
+ // ALSO call onresize because layout-size *may* have changed while pane was closed
+ if (state.initialized)
+ _runCallbacks("onresize_end", pane);
+ }
+
+ // TODO: Somehow sizePane("north") is being called after this point???
+ }
+
+
+ /**
+ * slideOpen / slideClose / slideToggle
+ *
+ * Pass-though methods for sliding
+ */
+, slideOpen = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var evt = evtObj(evt_or_pane)
+ , pane = evtPane.call(this, evt_or_pane)
+ , s = state[pane]
+ , delay = options[pane].slideDelay_open
+ ;
+ if (pane === "center") return; // validate
+ // prevent event from triggering on NEW resizer binding created below
+ if (evt) evt.stopImmediatePropagation();
+
+ if (s.isClosed && evt && evt.type === "mouseenter" && delay > 0)
+ // trigger = mouseenter - use a delay
+ timer.set(pane+"_openSlider", open_NOW, delay);
+ else
+ open_NOW(); // will unbind events if is already open
+
+ /**
+ * SUBROUTINE for timed open
+ */
+ function open_NOW () {
+ if (!s.isClosed) // skip if no longer closed!
+ bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane
+ else if (!s.isMoving)
+ open(pane, true); // true = slide - open() will handle binding
+ };
+ }
+
+, slideClose = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var evt = evtObj(evt_or_pane)
+ , pane = evtPane.call(this, evt_or_pane)
+ , o = options[pane]
+ , s = state[pane]
+ , delay = s.isMoving ? 1000 : 300 // MINIMUM delay - option may override
+ ;
+ if (pane === "center") return; // validate
+ if (s.isClosed || s.isResizing)
+ return; // skip if already closed OR in process of resizing
+ else if (o.slideTrigger_close === "click")
+ close_NOW(); // close immediately onClick
+ else if (o.preventQuickSlideClose && s.isMoving)
+ return; // handle Chrome quick-close on slide-open
+ else if (o.preventPrematureSlideClose && evt && $.layout.isMouseOverElem(evt, $Ps[pane]))
+ return; // handle incorrect mouseleave trigger, like when over a SELECT-list in IE
+ else if (evt) // trigger = mouseleave - use a delay
+ // 1 sec delay if 'opening', else .3 sec
+ timer.set(pane+"_closeSlider", close_NOW, max(o.slideDelay_close, delay));
+ else // called programically
+ close_NOW();
+
+ /**
+ * SUBROUTINE for timed close
+ */
+ function close_NOW () {
+ if (s.isClosed) // skip 'close' if already closed!
+ bindStopSlidingEvents(pane, false); // UNBIND trigger events - TODO: is this needed here?
+ else if (!s.isMoving)
+ close(pane); // close will handle unbinding
+ };
+ }
+
+ /**
+ * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west
+ */
+, slideToggle = function (evt_or_pane) {
+ var pane = evtPane.call(this, evt_or_pane);
+ toggle(pane, true);
+ }
+
+
+ /**
+ * Must set left/top on East/South panes so animation will work properly
+ *
+ * @param {string} pane The pane to lock, 'east' or 'south' - any other is ignored!
+ * @param {boolean} doLock true = set left/top, false = remove
+ */
+, lockPaneForFX = function (pane, doLock) {
+ var $P = $Ps[pane]
+ , s = state[pane]
+ , o = options[pane]
+ , z = options.zIndexes
+ ;
+ if (doLock) {
+ showMasks( pane, { animation: true, objectsOnly: true });
+ $P.css({ zIndex: z.pane_animate }); // overlay all elements during animation
+ if (pane=="south")
+ $P.css({ top: sC.inset.top + sC.innerHeight - $P.outerHeight() });
+ else if (pane=="east")
+ $P.css({ left: sC.inset.left + sC.innerWidth - $P.outerWidth() });
+ }
+ else { // animation DONE - RESET CSS
+ hideMasks();
+ $P.css({ zIndex: (s.isSliding ? z.pane_sliding : z.pane_normal) });
+ if (pane=="south")
+ $P.css({ top: "auto" });
+ // if pane is positioned 'off-screen', then DO NOT screw with it!
+ else if (pane=="east" && !$P.css("left").match(/\-99999/))
+ $P.css({ left: "auto" });
+ // fix anti-aliasing in IE - only needed for animations that change opacity
+ if (browser.msie && o.fxOpacityFix && o.fxName_open != "slide" && $P.css("filter") && $P.css("opacity") == 1)
+ $P[0].style.removeAttribute('filter');
+ }
+ }
+
+
+ /**
+ * Toggle sliding functionality of a specific pane on/off by adding removing 'slide open' trigger
+ *
+ * @see open(), close()
+ * @param {string} pane The pane to enable/disable, 'north', 'south', etc.
+ * @param {boolean} enable Enable or Disable sliding?
+ */
+, bindStartSlidingEvents = function (pane, enable) {
+ var o = options[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , evtName = o.slideTrigger_open.toLowerCase()
+ ;
+ if (!$R || (enable && !o.slidable)) return;
+
+ // make sure we have a valid event
+ if (evtName.match(/mouseover/))
+ evtName = o.slideTrigger_open = "mouseenter";
+ else if (!evtName.match(/(click|dblclick|mouseenter)/))
+ evtName = o.slideTrigger_open = "click";
+
+ // must remove double-click-toggle when using dblclick-slide
+ if (o.resizerDblClickToggle && evtName.match(/click/)) {
+ $R[enable ? "unbind" : "bind"]('dblclick.'+ sID, toggle)
+ }
+
+ $R
+ // add or remove event
+ [enable ? "bind" : "unbind"](evtName +'.'+ sID, slideOpen)
+ // set the appropriate cursor & title/tip
+ .css("cursor", enable ? o.sliderCursor : "default")
+ .attr("title", enable ? o.tips.Slide : "")
+ ;
+ }
+
+ /**
+ * Add or remove 'mouseleave' events to 'slide close' when pane is 'sliding' open or closed
+ * Also increases zIndex when pane is sliding open
+ * See bindStartSlidingEvents for code to control 'slide open'
+ *
+ * @see slideOpen(), slideClose()
+ * @param {string} pane The pane to process, 'north', 'south', etc.
+ * @param {boolean} enable Enable or Disable events?
+ */
+, bindStopSlidingEvents = function (pane, enable) {
+ var o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , z = options.zIndexes
+ , evtName = o.slideTrigger_close.toLowerCase()
+ , action = (enable ? "bind" : "unbind")
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ ;
+ timer.clear(pane+"_closeSlider"); // just in case
+
+ if (enable) {
+ s.isSliding = true;
+ state.panesSliding[pane] = true;
+ // remove 'slideOpen' event from resizer
+ // ALSO will raise the zIndex of the pane & resizer
+ bindStartSlidingEvents(pane, false);
+ }
+ else {
+ s.isSliding = false;
+ delete state.panesSliding[pane];
+ }
+
+ // RE/SET zIndex - increases when pane is sliding-open, resets to normal when not
+ $P.css("zIndex", enable ? z.pane_sliding : z.pane_normal);
+ $R.css("zIndex", enable ? z.pane_sliding+2 : z.resizer_normal); // NOTE: mask = pane_sliding+1
+
+ // make sure we have a valid event
+ if (!evtName.match(/(click|mouseleave)/))
+ evtName = o.slideTrigger_close = "mouseleave"; // also catches 'mouseout'
+
+ // add/remove slide triggers
+ $R[action](evtName, slideClose); // base event on resize
+ // need extra events for mouseleave
+ if (evtName === "mouseleave") {
+ // also close on pane.mouseleave
+ $P[action]("mouseleave."+ sID, slideClose);
+ // cancel timer when mouse moves between 'pane' and 'resizer'
+ $R[action]("mouseenter."+ sID, cancelMouseOut);
+ $P[action]("mouseenter."+ sID, cancelMouseOut);
+ }
+
+ if (!enable)
+ timer.clear(pane+"_closeSlider");
+ else if (evtName === "click" && !o.resizable) {
+ // IF pane is not resizable (which already has a cursor and tip)
+ // then set the a cursor & title/tip on resizer when sliding
+ $R.css("cursor", enable ? o.sliderCursor : "default");
+ $R.attr("title", enable ? o.tips.Close : ""); // use Toggler-tip, eg: "Close Pane"
+ }
+
+ // SUBROUTINE for mouseleave timer clearing
+ function cancelMouseOut (evt) {
+ timer.clear(pane+"_closeSlider");
+ evt.stopPropagation();
+ }
+ }
+
+
+ /**
+ * Hides/closes a pane if there is insufficient room - reverses this when there is room again
+ * MUST have already called setSizeLimits() before calling this method
+ *
+ * @param {string} pane The pane being resized
+ * @param {boolean=} [isOpening=false] Called from onOpen?
+ * @param {boolean=} [skipCallback=false] Should the onresize callback be run?
+ * @param {boolean=} [force=false]
+ */
+, makePaneFit = function (pane, isOpening, skipCallback, force) {
+ var o = options[pane]
+ , s = state[pane]
+ , c = _c[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , isSidePane = c.dir==="vert"
+ , hasRoom = false
+ ;
+ // special handling for center & east/west panes
+ if (pane === "center" || (isSidePane && s.noVerticalRoom)) {
+ // see if there is enough room to display the pane
+ // ERROR: hasRoom = s.minHeight <= s.maxHeight && (isSidePane || s.minWidth <= s.maxWidth);
+ hasRoom = (s.maxHeight >= 0);
+ if (hasRoom && s.noRoom) { // previously hidden due to noRoom, so show now
+ _showPane(pane);
+ if ($R) $R.show();
+ s.isVisible = true;
+ s.noRoom = false;
+ if (isSidePane) s.noVerticalRoom = false;
+ _fixIframe(pane);
+ }
+ else if (!hasRoom && !s.noRoom) { // not currently hidden, so hide now
+ _hidePane(pane);
+ if ($R) $R.hide();
+ s.isVisible = false;
+ s.noRoom = true;
+ }
+ }
+
+ // see if there is enough room to fit the border-pane
+ if (pane === "center") {
+ // ignore center in this block
+ }
+ else if (s.minSize <= s.maxSize) { // pane CAN fit
+ hasRoom = true;
+ if (s.size > s.maxSize) // pane is too big - shrink it
+ sizePane(pane, s.maxSize, skipCallback, true, force); // true = noAnimation
+ else if (s.size < s.minSize) // pane is too small - enlarge it
+ sizePane(pane, s.minSize, skipCallback, true, force); // true = noAnimation
+ // need s.isVisible because new pseudoClose method keeps pane visible, but off-screen
+ else if ($R && s.isVisible && $P.is(":visible")) {
+ // make sure resizer-bar is positioned correctly
+ // handles situation where nested layout was 'hidden' when initialized
+ var pos = s.size + sC.inset[c.side];
+ if ($.layout.cssNum( $R, c.side ) != pos) $R.css( c.side, pos );
+ }
+
+ // if was previously hidden due to noRoom, then RESET because NOW there is room
+ if (s.noRoom) {
+ // s.noRoom state will be set by open or show
+ if (s.wasOpen && o.closable) {
+ if (o.autoReopen)
+ open(pane, false, true, true); // true = noAnimation, true = noAlert
+ else // leave the pane closed, so just update state
+ s.noRoom = false;
+ }
+ else
+ show(pane, s.wasOpen, true, true); // true = noAnimation, true = noAlert
+ }
+ }
+ else { // !hasRoom - pane CANNOT fit
+ if (!s.noRoom) { // pane not set as noRoom yet, so hide or close it now...
+ s.noRoom = true; // update state
+ s.wasOpen = !s.isClosed && !s.isSliding;
+ if (s.isClosed){} // SKIP
+ else if (o.closable) // 'close' if possible
+ close(pane, true, true); // true = force, true = noAnimation
+ else // 'hide' pane if cannot just be closed
+ hide(pane, true); // true = noAnimation
+ }
+ }
+ }
+
+
+ /**
+ * manualSizePane is an exposed flow-through method allowing extra code when pane is 'manually resized'
+ *
+ * @param {(string|Object)} evt_or_pane The pane being resized
+ * @param {number} size The *desired* new size for this pane - will be validated
+ * @param {boolean=} [skipCallback=false] Should the onresize callback be run?
+ * @param {boolean=} [noAnimation=false]
+ * @param {boolean=} [force=false] Force resizing even if does not seem necessary
+ */
+, manualSizePane = function (evt_or_pane, size, skipCallback, noAnimation, force) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , o = options[pane]
+ , s = state[pane]
+ // if resizing callbacks have been delayed and resizing is now DONE, force resizing to complete...
+ , forceResize = force || (o.livePaneResizing && !s.isResizing)
+ ;
+ if (pane === "center") return; // validate
+ // ANY call to manualSizePane disables autoResize - ie, percentage sizing
+ s.autoResize = false;
+ // flow-through...
+ sizePane(pane, size, skipCallback, noAnimation, forceResize); // will animate resize if option enabled
+ }
+
+ /**
+ * sizePane is called only by internal methods whenever a pane needs to be resized
+ *
+ * @param {(string|Object)} evt_or_pane The pane being resized
+ * @param {number} size The *desired* new size for this pane - will be validated
+ * @param {boolean=} [skipCallback=false] Should the onresize callback be run?
+ * @param {boolean=} [noAnimation=false]
+ * @param {boolean=} [force=false] Force resizing even if does not seem necessary
+ */
+, sizePane = function (evt_or_pane, size, skipCallback, noAnimation, force) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane) // probably NEVER called from event?
+ , o = options[pane]
+ , s = state[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , side = _c[pane].side
+ , dimName = _c[pane].sizeType.toLowerCase()
+ , skipResizeWhileDragging = s.isResizing && !o.triggerEventsDuringLiveResize
+ , doFX = noAnimation !== true && o.animatePaneSizing
+ , oldSize, newSize
+ ;
+ if (pane === "center") return; // validate
+ // QUEUE in case another action/animation is in progress
+ $N.queue(function( queueNext ){
+ // calculate 'current' min/max sizes
+ setSizeLimits(pane); // update pane-state
+ oldSize = s.size;
+ size = _parseSize(pane, size); // handle percentages & auto
+ size = max(size, _parseSize(pane, o.minSize));
+ size = min(size, s.maxSize);
+ if (size < s.minSize) { // not enough room for pane!
+ queueNext(); // call before makePaneFit() because it needs the queue free
+ makePaneFit(pane, false, skipCallback); // will hide or close pane
+ return;
+ }
+
+ // IF newSize is same as oldSize, then nothing to do - abort
+ if (!force && size === oldSize)
+ return queueNext();
+
+ s.newSize = size;
+
+ // onresize_start callback CANNOT cancel resizing because this would break the layout!
+ if (!skipCallback && state.initialized && s.isVisible)
+ _runCallbacks("onresize_start", pane);
+
+ // resize the pane, and make sure its visible
+ newSize = cssSize(pane, size);
+
+ if (doFX && $P.is(":visible")) { // ANIMATE
+ var fx = $.layout.effects.size[pane] || $.layout.effects.size.all
+ , easing = o.fxSettings_size.easing || fx.easing
+ , z = options.zIndexes
+ , props = {};
+ props[ dimName ] = newSize +'px';
+ s.isMoving = true;
+ // overlay all elements during animation
+ $P.css({ zIndex: z.pane_animate })
+ .show().animate( props, o.fxSpeed_size, easing, function(){
+ // reset zIndex after animation
+ $P.css({ zIndex: (s.isSliding ? z.pane_sliding : z.pane_normal) });
+ s.isMoving = false;
+ delete s.newSize;
+ sizePane_2(); // continue
+ queueNext();
+ });
+ }
+ else { // no animation
+ $P.css( dimName, newSize ); // resize pane
+ delete s.newSize;
+ // if pane is visible, then
+ if ($P.is(":visible"))
+ sizePane_2(); // continue
+ else {
+ // pane is NOT VISIBLE, so just update state data...
+ // when pane is *next opened*, it will have the new size
+ s.size = size; // update state.size
+ //$.extend(s, elDims($P)); // update state dimensions - CANNOT do this when not visible! }
+ }
+ queueNext();
+ };
+
+ });
+
+ // SUBROUTINE
+ function sizePane_2 () {
+ /* Panes are sometimes not sized precisely in some browsers!?
+ * This code will resize the pane up to 3 times to nudge the pane to the correct size
+ */
+ var actual = dimName==='width' ? $P.outerWidth() : $P.outerHeight()
+ , tries = [{
+ pane: pane
+ , count: 1
+ , target: size
+ , actual: actual
+ , correct: (size === actual)
+ , attempt: size
+ , cssSize: newSize
+ }]
+ , lastTry = tries[0]
+ , thisTry = {}
+ , msg = 'Inaccurate size after resizing the '+ pane +'-pane.'
+ ;
+ while ( !lastTry.correct ) {
+ thisTry = { pane: pane, count: lastTry.count+1, target: size };
+
+ if (lastTry.actual > size)
+ thisTry.attempt = max(0, lastTry.attempt - (lastTry.actual - size));
+ else // lastTry.actual < size
+ thisTry.attempt = max(0, lastTry.attempt + (size - lastTry.actual));
+
+ thisTry.cssSize = cssSize(pane, thisTry.attempt);
+ $P.css( dimName, thisTry.cssSize );
+
+ thisTry.actual = dimName=='width' ? $P.outerWidth() : $P.outerHeight();
+ thisTry.correct = (size === thisTry.actual);
+
+ // log attempts and alert the user of this *non-fatal error* (if showDebugMessages)
+ if ( tries.length === 1) {
+ _log(msg, false, true);
+ _log(lastTry, false, true);
+ }
+ _log(thisTry, false, true);
+ // after 4 tries, is as close as its gonna get!
+ if (tries.length > 3) break;
+
+ tries.push( thisTry );
+ lastTry = tries[ tries.length - 1 ];
+ }
+ // END TESTING CODE
+
+ // update pane-state dimensions
+ s.size = size;
+ $.extend(s, elDims($P));
+
+ if (s.isVisible && $P.is(":visible")) {
+ // reposition the resizer-bar
+ if ($R) $R.css( side, size + sC.inset[side] );
+ // resize the content-div
+ sizeContent(pane);
+ }
+
+ if (!skipCallback && !skipResizeWhileDragging && state.initialized && s.isVisible)
+ _runCallbacks("onresize_end", pane);
+
+ // resize all the adjacent panes, and adjust their toggler buttons
+ // when skipCallback passed, it means the controlling method will handle 'other panes'
+ if (!skipCallback) {
+ // also no callback if live-resize is in progress and NOT triggerEventsDuringLiveResize
+ if (!s.isSliding) sizeMidPanes(_c[pane].dir=="horz" ? "" : "center", skipResizeWhileDragging, force);
+ sizeHandles();
+ }
+
+ // if opposite-pane was autoClosed, see if it can be autoOpened now
+ var altPane = _c.oppositeEdge[pane];
+ if (size < oldSize && state[ altPane ].noRoom) {
+ setSizeLimits( altPane );
+ makePaneFit( altPane, false, skipCallback );
+ }
+
+ // DEBUG - ALERT user/developer so they know there was a sizing problem
+ if (tries.length > 1)
+ _log(msg +'\nSee the Error Console for details.', true, true);
+ }
+ }
+
+ /**
+ * @see initPanes(), sizePane(), resizeAll(), open(), close(), hide()
+ * @param {(Array.<string>|string)} panes The pane(s) being resized, comma-delmited string
+ * @param {boolean=} [skipCallback=false] Should the onresize callback be run?
+ * @param {boolean=} [force=false]
+ */
+, sizeMidPanes = function (panes, skipCallback, force) {
+ panes = (panes ? panes : "east,west,center").split(",");
+
+ $.each(panes, function (i, pane) {
+ if (!$Ps[pane]) return; // NO PANE - skip
+ var
+ o = options[pane]
+ , s = state[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , isCenter= (pane=="center")
+ , hasRoom = true
+ , CSS = {}
+ // if pane is not visible, show it invisibly NOW rather than for *each call* in this script
+ , visCSS = $.layout.showInvisibly($P)
+
+ , newCenter = calcNewCenterPaneDims()
+ ;
+
+ // update pane-state dimensions
+ $.extend(s, elDims($P));
+
+ if (pane === "center") {
+ if (!force && s.isVisible && newCenter.width === s.outerWidth && newCenter.height === s.outerHeight) {
+ $P.css(visCSS);
+ return true; // SKIP - pane already the correct size
+ }
+ // set state for makePaneFit() logic
+ $.extend(s, cssMinDims(pane), {
+ maxWidth: newCenter.width
+ , maxHeight: newCenter.height
+ });
+ CSS = newCenter;
+ s.newWidth = CSS.width;
+ s.newHeight = CSS.height;
+ // convert OUTER width/height to CSS width/height
+ CSS.width = cssW($P, CSS.width);
+ // NEW - allow pane to extend 'below' visible area rather than hide it
+ CSS.height = cssH($P, CSS.height);
+ hasRoom = CSS.width >= 0 && CSS.height >= 0; // height >= 0 = ALWAYS TRUE NOW
+
+ // during layout init, try to shrink east/west panes to make room for center
+ if (!state.initialized && o.minWidth > newCenter.width) {
+ var
+ reqPx = o.minWidth - s.outerWidth
+ , minE = options.east.minSize || 0
+ , minW = options.west.minSize || 0
+ , sizeE = state.east.size
+ , sizeW = state.west.size
+ , newE = sizeE
+ , newW = sizeW
+ ;
+ if (reqPx > 0 && state.east.isVisible && sizeE > minE) {
+ newE = max( sizeE-minE, sizeE-reqPx );
+ reqPx -= sizeE-newE;
+ }
+ if (reqPx > 0 && state.west.isVisible && sizeW > minW) {
+ newW = max( sizeW-minW, sizeW-reqPx );
+ reqPx -= sizeW-newW;
+ }
+ // IF we found enough extra space, then resize the border panes as calculated
+ if (reqPx === 0) {
+ if (sizeE && sizeE != minE)
+ sizePane('east', newE, true, true, force); // true = skipCallback/noAnimation - initPanes will handle when done
+ if (sizeW && sizeW != minW)
+ sizePane('west', newW, true, true, force); // true = skipCallback/noAnimation
+ // now start over!
+ sizeMidPanes('center', skipCallback, force);
+ $P.css(visCSS);
+ return; // abort this loop
+ }
+ }
+ }
+ else { // for east and west, set only the height, which is same as center height
+ // set state.min/maxWidth/Height for makePaneFit() logic
+ if (s.isVisible && !s.noVerticalRoom)
+ $.extend(s, elDims($P), cssMinDims(pane))
+ if (!force && !s.noVerticalRoom && newCenter.height === s.outerHeight) {
+ $P.css(visCSS);
+ return true; // SKIP - pane already the correct size
+ }
+ // east/west have same top, bottom & height as center
+ CSS.top = newCenter.top;
+ CSS.bottom = newCenter.bottom;
+ s.newSize = newCenter.height
+ // NEW - allow pane to extend 'below' visible area rather than hide it
+ CSS.height = cssH($P, newCenter.height);
+ s.maxHeight = CSS.height;
+ hasRoom = (s.maxHeight >= 0); // ALWAYS TRUE NOW
+ if (!hasRoom) s.noVerticalRoom = true; // makePaneFit() logic
+ }
+
+ if (hasRoom) {
+ // resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized
+ if (!skipCallback && state.initialized)
+ _runCallbacks("onresize_start", pane);
+
+ $P.css(CSS); // apply the CSS to pane
+ if (pane !== "center")
+ sizeHandles(pane); // also update resizer length
+ if (s.noRoom && !s.isClosed && !s.isHidden)
+ makePaneFit(pane); // will re-open/show auto-closed/hidden pane
+ if (s.isVisible) {
+ $.extend(s, elDims($P)); // update pane dimensions
+ if (state.initialized) sizeContent(pane); // also resize the contents, if exists
+ }
+ }
+ else if (!s.noRoom && s.isVisible) // no room for pane
+ makePaneFit(pane); // will hide or close pane
+
+ // reset visibility, if necessary
+ $P.css(visCSS);
+
+ delete s.newSize;
+ delete s.newWidth;
+ delete s.newHeight;
+
+ if (!s.isVisible)
+ return true; // DONE - next pane
+
+ /*
+ * Extra CSS for IE6 or IE7 in Quirks-mode - add 'width' to NORTH/SOUTH panes
+ * Normally these panes have only 'left' & 'right' positions so pane auto-sizes
+ * ALSO required when pane is an IFRAME because will NOT default to 'full width'
+ * TODO: Can I use width:100% for a north/south iframe?
+ * TODO: Sounds like a job for $P.outerWidth( sC.innerWidth ) SETTER METHOD
+ */
+ if (pane === "center") { // finished processing midPanes
+ var fix = browser.isIE6 || !browser.boxModel;
+ if ($Ps.north && (fix || state.north.tagName=="IFRAME"))
+ $Ps.north.css("width", cssW($Ps.north, sC.innerWidth));
+ if ($Ps.south && (fix || state.south.tagName=="IFRAME"))
+ $Ps.south.css("width", cssW($Ps.south, sC.innerWidth));
+ }
+
+ // resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized
+ if (!skipCallback && state.initialized)
+ _runCallbacks("onresize_end", pane);
+ });
+ }
+
+
+ /**
+ * @see window.onresize(), callbacks or custom code
+ * @param {(Object|boolean)=} evt_or_refresh If 'true', then also reset pane-positioning
+ */
+, resizeAll = function (evt_or_refresh) {
+ var oldW = sC.innerWidth
+ , oldH = sC.innerHeight
+ ;
+ // stopPropagation if called by trigger("layoutdestroy") - use evtPane utility
+ evtPane(evt_or_refresh);
+
+ // cannot size layout when 'container' is hidden or collapsed
+ if (!$N.is(":visible")) return;
+
+ if (!state.initialized) {
+ _initLayoutElements();
+ return; // no need to resize since we just initialized!
+ }
+
+ if (evt_or_refresh === true && $.isPlainObject(options.outset)) {
+ // update container CSS in case outset option has changed
+ $N.css( options.outset );
+ }
+ // UPDATE container dimensions
+ $.extend(sC, elDims( $N, options.inset ));
+ if (!sC.outerHeight) return;
+
+ // if 'true' passed, refresh pane & handle positioning too
+ if (evt_or_refresh === true) {
+ setPanePosition();
+ }
+
+ // onresizeall_start will CANCEL resizing if returns false
+ // state.container has already been set, so user can access this info for calcuations
+ if (false === _runCallbacks("onresizeall_start")) return false;
+
+ var // see if container is now 'smaller' than before
+ shrunkH = (sC.innerHeight < oldH)
+ , shrunkW = (sC.innerWidth < oldW)
+ , $P, o, s
+ ;
+ // NOTE special order for sizing: S-N-E-W
+ $.each(["south","north","east","west"], function (i, pane) {
+ if (!$Ps[pane]) return; // no pane - SKIP
+ o = options[pane];
+ s = state[pane];
+ if (s.autoResize && s.size != o.size) // resize pane to original size set in options
+ sizePane(pane, o.size, true, true, true); // true=skipCallback/noAnimation/forceResize
+ else {
+ setSizeLimits(pane);
+ makePaneFit(pane, false, true, true); // true=skipCallback/forceResize
+ }
+ });
+
+ sizeMidPanes("", true, true); // true=skipCallback/forceResize
+ sizeHandles(); // reposition the toggler elements
+
+ // trigger all individual pane callbacks AFTER layout has finished resizing
+ $.each(_c.allPanes, function (i, pane) {
+ $P = $Ps[pane];
+ if (!$P) return; // SKIP
+ if (state[pane].isVisible) // undefined for non-existent panes
+ _runCallbacks("onresize_end", pane); // callback - if exists
+ });
+
+ _runCallbacks("onresizeall_end");
+ //_triggerLayoutEvent(pane, 'resizeall');
+ }
+
+ /**
+ * Whenever a pane resizes or opens that has a nested layout, trigger resizeAll
+ *
+ * @param {(string|Object)} evt_or_pane The pane just resized or opened
+ */
+, resizeChildren = function (evt_or_pane, skipRefresh) {
+ var pane = evtPane.call(this, evt_or_pane);
+
+ if (!options[pane].resizeChildren) return;
+
+ // ensure the pane-children are up-to-date
+ if (!skipRefresh) refreshChildren( pane );
+ var pC = children[pane];
+ if ($.isPlainObject( pC )) {
+ // resize one or more children
+ $.each( pC, function (key, child) {
+ if (!child.destroyed) child.resizeAll();
+ });
+ }
+ }
+
+ /**
+ * IF pane has a content-div, then resize all elements inside pane to fit pane-height
+ *
+ * @param {(string|Object)} evt_or_panes The pane(s) being resized
+ * @param {boolean=} [remeasure=false] Should the content (header/footer) be remeasured?
+ */
+, sizeContent = function (evt_or_panes, remeasure) {
+ if (!isInitialized()) return;
+
+ var panes = evtPane.call(this, evt_or_panes);
+ panes = panes ? panes.split(",") : _c.allPanes;
+
+ $.each(panes, function (idx, pane) {
+ var
+ $P = $Ps[pane]
+ , $C = $Cs[pane]
+ , o = options[pane]
+ , s = state[pane]
+ , m = s.content // m = measurements
+ ;
+ if (!$P || !$C || !$P.is(":visible")) return true; // NOT VISIBLE - skip
+
+ // if content-element was REMOVED, update OR remove the pointer
+ if (!$C.length) {
+ initContent(pane, false); // false = do NOT sizeContent() - already there!
+ if (!$C) return; // no replacement element found - pointer have been removed
+ }
+
+ // onsizecontent_start will CANCEL resizing if returns false
+ if (false === _runCallbacks("onsizecontent_start", pane)) return;
+
+ // skip re-measuring offsets if live-resizing
+ if ((!s.isMoving && !s.isResizing) || o.liveContentResizing || remeasure || m.top == undefined) {
+ _measure();
+ // if any footers are below pane-bottom, they may not measure correctly,
+ // so allow pane overflow and re-measure
+ if (m.hiddenFooters > 0 && $P.css("overflow") === "hidden") {
+ $P.css("overflow", "visible");
+ _measure(); // remeasure while overflowing
+ $P.css("overflow", "hidden");
+ }
+ }
+ // NOTE: spaceAbove/Below *includes* the pane paddingTop/Bottom, but not pane.borders
+ var newH = s.innerHeight - (m.spaceAbove - s.css.paddingTop) - (m.spaceBelow - s.css.paddingBottom);
+
+ if (!$C.is(":visible") || m.height != newH) {
+ // size the Content element to fit new pane-size - will autoHide if not enough room
+ setOuterHeight($C, newH, true); // true=autoHide
+ m.height = newH; // save new height
+ };
+
+ if (state.initialized)
+ _runCallbacks("onsizecontent_end", pane);
+
+ function _below ($E) {
+ return max(s.css.paddingBottom, (parseInt($E.css("marginBottom"), 10) || 0));
+ };
+
+ function _measure () {
+ var
+ ignore = options[pane].contentIgnoreSelector
+ , $Fs = $C.nextAll().not(".ui-layout-mask").not(ignore || ":lt(0)") // not :lt(0) = ALL
+ , $Fs_vis = $Fs.filter(':visible')
+ , $F = $Fs_vis.filter(':last')
+ ;
+ m = {
+ top: $C[0].offsetTop
+ , height: $C.outerHeight()
+ , numFooters: $Fs.length
+ , hiddenFooters: $Fs.length - $Fs_vis.length
+ , spaceBelow: 0 // correct if no content footer ($E)
+ }
+ m.spaceAbove = m.top; // just for state - not used in calc
+ m.bottom = m.top + m.height;
+ if ($F.length)
+ //spaceBelow = (LastFooter.top + LastFooter.height) [footerBottom] - Content.bottom + max(LastFooter.marginBottom, pane.paddingBotom)
+ m.spaceBelow = ($F[0].offsetTop + $F.outerHeight()) - m.bottom + _below($F);
+ else // no footer - check marginBottom on Content element itself
+ m.spaceBelow = _below($C);
+ };
+ });
+ }
+
+
+ /**
+ * Called every time a pane is opened, closed, or resized to slide the togglers to 'center' and adjust their length if necessary
+ *
+ * @see initHandles(), open(), close(), resizeAll()
+ * @param {(string|Object)=} evt_or_panes The pane(s) being resized
+ */
+, sizeHandles = function (evt_or_panes) {
+ var panes = evtPane.call(this, evt_or_panes)
+ panes = panes ? panes.split(",") : _c.borderPanes;
+
+ $.each(panes, function (i, pane) {
+ var
+ o = options[pane]
+ , s = state[pane]
+ , $P = $Ps[pane]
+ , $R = $Rs[pane]
+ , $T = $Ts[pane]
+ , $TC
+ ;
+ if (!$P || !$R) return;
+
+ var
+ dir = _c[pane].dir
+ , _state = (s.isClosed ? "_closed" : "_open")
+ , spacing = o["spacing"+ _state]
+ , togAlign = o["togglerAlign"+ _state]
+ , togLen = o["togglerLength"+ _state]
+ , paneLen
+ , left
+ , offset
+ , CSS = {}
+ ;
+
+ if (spacing === 0) {
+ $R.hide();
+ return;
+ }
+ else if (!s.noRoom && !s.isHidden) // skip if resizer was hidden for any reason
+ $R.show(); // in case was previously hidden
+
+ // Resizer Bar is ALWAYS same width/height of pane it is attached to
+ if (dir === "horz") { // north/south
+ //paneLen = $P.outerWidth(); // s.outerWidth ||
+ paneLen = sC.innerWidth; // handle offscreen-panes
+ s.resizerLength = paneLen;
+ left = $.layout.cssNum($P, "left")
+ $R.css({
+ width: cssW($R, paneLen) // account for borders & padding
+ , height: cssH($R, spacing) // ditto
+ , left: left > -9999 ? left : sC.inset.left // handle offscreen-panes
+ });
+ }
+ else { // east/west
+ paneLen = $P.outerHeight(); // s.outerHeight ||
+ s.resizerLength = paneLen;
+ $R.css({
+ height: cssH($R, paneLen) // account for borders & padding
+ , width: cssW($R, spacing) // ditto
+ , top: sC.inset.top + getPaneSize("north", true) // TODO: what if no North pane?
+ //, top: $.layout.cssNum($Ps["center"], "top")
+ });
+ }
+
+ // remove hover classes
+ removeHover( o, $R );
+
+ if ($T) {
+ if (togLen === 0 || (s.isSliding && o.hideTogglerOnSlide)) {
+ $T.hide(); // always HIDE the toggler when 'sliding'
+ return;
+ }
+ else
+ $T.show(); // in case was previously hidden
+
+ if (!(togLen > 0) || togLen === "100%" || togLen > paneLen) {
+ togLen = paneLen;
+ offset = 0;
+ }
+ else { // calculate 'offset' based on options.PANE.togglerAlign_open/closed
+ if (isStr(togAlign)) {
+ switch (togAlign) {
+ case "top":
+ case "left": offset = 0;
+ break;
+ case "bottom":
+ case "right": offset = paneLen - togLen;
+ break;
+ case "middle":
+ case "center":
+ default: offset = round((paneLen - togLen) / 2); // 'default' catches typos
+ }
+ }
+ else { // togAlign = number
+ var x = parseInt(togAlign, 10); //
+ if (togAlign >= 0) offset = x;
+ else offset = paneLen - togLen + x; // NOTE: x is negative!
+ }
+ }
+
+ if (dir === "horz") { // north/south
+ var width = cssW($T, togLen);
+ $T.css({
+ width: width // account for borders & padding
+ , height: cssH($T, spacing) // ditto
+ , left: offset // TODO: VERIFY that toggler positions correctly for ALL values
+ , top: 0
+ });
+ // CENTER the toggler content SPAN
+ $T.children(".content").each(function(){
+ $TC = $(this);
+ $TC.css("marginLeft", round((width-$TC.outerWidth())/2)); // could be negative
+ });
+ }
+ else { // east/west
+ var height = cssH($T, togLen);
+ $T.css({
+ height: height // account for borders & padding
+ , width: cssW($T, spacing) // ditto
+ , top: offset // POSITION the toggler
+ , left: 0
+ });
+ // CENTER the toggler content SPAN
+ $T.children(".content").each(function(){
+ $TC = $(this);
+ $TC.css("marginTop", round((height-$TC.outerHeight())/2)); // could be negative
+ });
+ }
+
+ // remove ALL hover classes
+ removeHover( 0, $T );
+ }
+
+ // DONE measuring and sizing this resizer/toggler, so can be 'hidden' now
+ if (!state.initialized && (o.initHidden || s.isHidden)) {
+ $R.hide();
+ if ($T) $T.hide();
+ }
+ });
+ }
+
+
+ /**
+ * @param {(string|Object)} evt_or_pane
+ */
+, enableClosable = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $T = $Ts[pane]
+ , o = options[pane]
+ ;
+ if (!$T) return;
+ o.closable = true;
+ $T .bind("click."+ sID, function(evt){ evt.stopPropagation(); toggle(pane); })
+ .css("visibility", "visible")
+ .css("cursor", "pointer")
+ .attr("title", state[pane].isClosed ? o.tips.Open : o.tips.Close) // may be blank
+ .show();
+ }
+ /**
+ * @param {(string|Object)} evt_or_pane
+ * @param {boolean=} [hide=false]
+ */
+, disableClosable = function (evt_or_pane, hide) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $T = $Ts[pane]
+ ;
+ if (!$T) return;
+ options[pane].closable = false;
+ // is closable is disable, then pane MUST be open!
+ if (state[pane].isClosed) open(pane, false, true);
+ $T .unbind("."+ sID)
+ .css("visibility", hide ? "hidden" : "visible") // instead of hide(), which creates logic issues
+ .css("cursor", "default")
+ .attr("title", "");
+ }
+
+
+ /**
+ * @param {(string|Object)} evt_or_pane
+ */
+, enableSlidable = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $R = $Rs[pane]
+ ;
+ if (!$R || !$R.data('draggable')) return;
+ options[pane].slidable = true;
+ if (state[pane].isClosed)
+ bindStartSlidingEvents(pane, true);
+ }
+ /**
+ * @param {(string|Object)} evt_or_pane
+ */
+, disableSlidable = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $R = $Rs[pane]
+ ;
+ if (!$R) return;
+ options[pane].slidable = false;
+ if (state[pane].isSliding)
+ close(pane, false, true);
+ else {
+ bindStartSlidingEvents(pane, false);
+ $R .css("cursor", "default")
+ .attr("title", "");
+ removeHover(null, $R[0]); // in case currently hovered
+ }
+ }
+
+
+ /**
+ * @param {(string|Object)} evt_or_pane
+ */
+, enableResizable = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $R = $Rs[pane]
+ , o = options[pane]
+ ;
+ if (!$R || !$R.data('draggable')) return;
+ o.resizable = true;
+ $R.draggable("enable");
+ if (!state[pane].isClosed)
+ $R .css("cursor", o.resizerCursor)
+ .attr("title", o.tips.Resize);
+ }
+ /**
+ * @param {(string|Object)} evt_or_pane
+ */
+, disableResizable = function (evt_or_pane) {
+ if (!isInitialized()) return;
+ var pane = evtPane.call(this, evt_or_pane)
+ , $R = $Rs[pane]
+ ;
+ if (!$R || !$R.data('draggable')) return;
+ options[pane].resizable = false;
+ $R .draggable("disable")
+ .css("cursor", "default")
+ .attr("title", "");
+ removeHover(null, $R[0]); // in case currently hovered
+ }
+
+
+ /**
+ * Move a pane from source-side (eg, west) to target-side (eg, east)
+ * If pane exists on target-side, move that to source-side, ie, 'swap' the panes
+ *
+ * @param {(string|Object)} evt_or_pane1 The pane/edge being swapped
+ * @param {string} pane2 ditto
+ */
+, swapPanes = function (evt_or_pane1, pane2) {
+ if (!isInitialized()) return;
+ var pane1 = evtPane.call(this, evt_or_pane1);
+ // change state.edge NOW so callbacks can know where pane is headed...
+ state[pane1].edge = pane2;
+ state[pane2].edge = pane1;
+ // run these even if NOT state.initialized
+ if (false === _runCallbacks("onswap_start", pane1)
+ || false === _runCallbacks("onswap_start", pane2)
+ ) {
+ state[pane1].edge = pane1; // reset
+ state[pane2].edge = pane2;
+ return;
+ }
+
+ var
+ oPane1 = copy( pane1 )
+ , oPane2 = copy( pane2 )
+ , sizes = {}
+ ;
+ sizes[pane1] = oPane1 ? oPane1.state.size : 0;
+ sizes[pane2] = oPane2 ? oPane2.state.size : 0;
+
+ // clear pointers & state
+ $Ps[pane1] = false;
+ $Ps[pane2] = false;
+ state[pane1] = {};
+ state[pane2] = {};
+
+ // ALWAYS remove the resizer & toggler elements
+ if ($Ts[pane1]) $Ts[pane1].remove();
+ if ($Ts[pane2]) $Ts[pane2].remove();
+ if ($Rs[pane1]) $Rs[pane1].remove();
+ if ($Rs[pane2]) $Rs[pane2].remove();
+ $Rs[pane1] = $Rs[pane2] = $Ts[pane1] = $Ts[pane2] = false;
+
+ // transfer element pointers and data to NEW Layout keys
+ move( oPane1, pane2 );
+ move( oPane2, pane1 );
+
+ // cleanup objects
+ oPane1 = oPane2 = sizes = null;
+
+ // make panes 'visible' again
+ if ($Ps[pane1]) $Ps[pane1].css(_c.visible);
+ if ($Ps[pane2]) $Ps[pane2].css(_c.visible);
+
+ // fix any size discrepancies caused by swap
+ resizeAll();
+
+ // run these even if NOT state.initialized
+ _runCallbacks("onswap_end", pane1);
+ _runCallbacks("onswap_end", pane2);
+
+ return;
+
+ function copy (n) { // n = pane
+ var
+ $P = $Ps[n]
+ , $C = $Cs[n]
+ ;
+ return !$P ? false : {
+ pane: n
+ , P: $P ? $P[0] : false
+ , C: $C ? $C[0] : false
+ , state: $.extend(true, {}, state[n])
+ , options: $.extend(true, {}, options[n])
+ }
+ };
+
+ function move (oPane, pane) {
+ if (!oPane) return;
+ var
+ P = oPane.P
+ , C = oPane.C
+ , oldPane = oPane.pane
+ , c = _c[pane]
+ // save pane-options that should be retained
+ , s = $.extend(true, {}, state[pane])
+ , o = options[pane]
+ // RETAIN side-specific FX Settings - more below
+ , fx = { resizerCursor: o.resizerCursor }
+ , re, size, pos
+ ;
+ $.each("fxName,fxSpeed,fxSettings".split(","), function (i, k) {
+ fx[k +"_open"] = o[k +"_open"];
+ fx[k +"_close"] = o[k +"_close"];
+ fx[k +"_size"] = o[k +"_size"];
+ });
+
+ // update object pointers and attributes
+ $Ps[pane] = $(P)
+ .data({
+ layoutPane: Instance[pane] // NEW pointer to pane-alias-object
+ , layoutEdge: pane
+ })
+ .css(_c.hidden)
+ .css(c.cssReq)
+ ;
+ $Cs[pane] = C ? $(C) : false;
+
+ // set options and state
+ options[pane] = $.extend(true, {}, oPane.options, fx);
+ state[pane] = $.extend(true, {}, oPane.state);
+
+ // change classNames on the pane, eg: ui-layout-pane-east ==> ui-layout-pane-west
+ re = new RegExp(o.paneClass +"-"+ oldPane, "g");
+ P.className = P.className.replace(re, o.paneClass +"-"+ pane);
+
+ // ALWAYS regenerate the resizer & toggler elements
+ initHandles(pane); // create the required resizer & toggler
+
+ // if moving to different orientation, then keep 'target' pane size
+ if (c.dir != _c[oldPane].dir) {
+ size = sizes[pane] || 0;
+ setSizeLimits(pane); // update pane-state
+ size = max(size, state[pane].minSize);
+ // use manualSizePane to disable autoResize - not useful after panes are swapped
+ manualSizePane(pane, size, true, true); // true/true = skipCallback/noAnimation
+ }
+ else // move the resizer here
+ $Rs[pane].css(c.side, sC.inset[c.side] + (state[pane].isVisible ? getPaneSize(pane) : 0));
+
+
+ // ADD CLASSNAMES & SLIDE-BINDINGS
+ if (oPane.state.isVisible && !s.isVisible)
+ setAsOpen(pane, true); // true = skipCallback
+ else {
+ setAsClosed(pane);
+ bindStartSlidingEvents(pane, true); // will enable events IF option is set
+ }
+
+ // DESTROY the object
+ oPane = null;
+ };
+ }
+
+
+ /**
+ * INTERNAL method to sync pin-buttons when pane is opened or closed
+ * Unpinned means the pane is 'sliding' - ie, over-top of the adjacent panes
+ *
+ * @see open(), setAsOpen(), setAsClosed()
+ * @param {string} pane These are the params returned to callbacks by layout()
+ * @param {boolean} doPin True means set the pin 'down', False means 'up'
+ */
+, syncPinBtns = function (pane, doPin) {
+ if ($.layout.plugins.buttons)
+ $.each(state[pane].pins, function (i, selector) {
+ $.layout.buttons.setPinState(Instance, $(selector), pane, doPin);
+ });
+ }
+
+; // END var DECLARATIONS
+
+ /**
+ * Capture keys when enableCursorHotkey - toggle pane if hotkey pressed
+ *
+ * @see document.keydown()
+ */
+ function keyDown (evt) {
+ if (!evt) return true;
+ var code = evt.keyCode;
+ if (code < 33) return true; // ignore special keys: ENTER, TAB, etc
+
+ var
+ PANE = {
+ 38: "north" // Up Cursor - $.ui.keyCode.UP
+ , 40: "south" // Down Cursor - $.ui.keyCode.DOWN
+ , 37: "west" // Left Cursor - $.ui.keyCode.LEFT
+ , 39: "east" // Right Cursor - $.ui.keyCode.RIGHT
+ }
+ , ALT = evt.altKey // no worky!
+ , SHIFT = evt.shiftKey
+ , CTRL = evt.ctrlKey
+ , CURSOR = (CTRL && code >= 37 && code <= 40)
+ , o, k, m, pane
+ ;
+
+ if (CURSOR && options[PANE[code]].enableCursorHotkey) // valid cursor-hotkey
+ pane = PANE[code];
+ else if (CTRL || SHIFT) // check to see if this matches a custom-hotkey
+ $.each(_c.borderPanes, function (i, p) { // loop each pane to check its hotkey
+ o = options[p];
+ k = o.customHotkey;
+ m = o.customHotkeyModifier; // if missing or invalid, treated as "CTRL+SHIFT"
+ if ((SHIFT && m=="SHIFT") || (CTRL && m=="CTRL") || (CTRL && SHIFT)) { // Modifier matches
+ if (k && code === (isNaN(k) || k <= 9 ? k.toUpperCase().charCodeAt(0) : k)) { // Key matches
+ pane = p;
+ return false; // BREAK
+ }
+ }
+ });
+
+ // validate pane
+ if (!pane || !$Ps[pane] || !options[pane].closable || state[pane].isHidden)
+ return true;
+
+ toggle(pane);
+
+ evt.stopPropagation();
+ evt.returnValue = false; // CANCEL key
+ return false;
+ };
+
+
+/*
+ * ######################################
+ * UTILITY METHODS
+ * called externally or by initButtons
+ * ######################################
+ */
+
+ /**
+ * Change/reset a pane overflow setting & zIndex to allow popups/drop-downs to work
+ *
+ * @param {Object=} [el] (optional) Can also be 'bound' to a click, mouseOver, or other event
+ */
+ function allowOverflow (el) {
+ if (!isInitialized()) return;
+ if (this && this.tagName) el = this; // BOUND to element
+ var $P;
+ if (isStr(el))
+ $P = $Ps[el];
+ else if ($(el).data("layoutRole"))
+ $P = $(el);
+ else
+ $(el).parents().each(function(){
+ if ($(this).data("layoutRole")) {
+ $P = $(this);
+ return false; // BREAK
+ }
+ });
+ if (!$P || !$P.length) return; // INVALID
+
+ var
+ pane = $P.data("layoutEdge")
+ , s = state[pane]
+ ;
+
+ // if pane is already raised, then reset it before doing it again!
+ // this would happen if allowOverflow is attached to BOTH the pane and an element
+ if (s.cssSaved)
+ resetOverflow(pane); // reset previous CSS before continuing
+
+ // if pane is raised by sliding or resizing, or its closed, then abort
+ if (s.isSliding || s.isResizing || s.isClosed) {
+ s.cssSaved = false;
+ return;
+ }
+
+ var
+ newCSS = { zIndex: (options.zIndexes.resizer_normal + 1) }
+ , curCSS = {}
+ , of = $P.css("overflow")
+ , ofX = $P.css("overflowX")
+ , ofY = $P.css("overflowY")
+ ;
+ // determine which, if any, overflow settings need to be changed
+ if (of != "visible") {
+ curCSS.overflow = of;
+ newCSS.overflow = "visible";
+ }
+ if (ofX && !ofX.match(/(visible|auto)/)) {
+ curCSS.overflowX = ofX;
+ newCSS.overflowX = "visible";
+ }
+ if (ofY && !ofY.match(/(visible|auto)/)) {
+ curCSS.overflowY = ofX;
+ newCSS.overflowY = "visible";
+ }
+
+ // save the current overflow settings - even if blank!
+ s.cssSaved = curCSS;
+
+ // apply new CSS to raise zIndex and, if necessary, make overflow 'visible'
+ $P.css( newCSS );
+
+ // make sure the zIndex of all other panes is normal
+ $.each(_c.allPanes, function(i, p) {
+ if (p != pane) resetOverflow(p);
+ });
+
+ };
+ /**
+ * @param {Object=} [el] (optional) Can also be 'bound' to a click, mouseOver, or other event
+ */
+ function resetOverflow (el) {
+ if (!isInitialized()) return;
+ if (this && this.tagName) el = this; // BOUND to element
+ var $P;
+ if (isStr(el))
+ $P = $Ps[el];
+ else if ($(el).data("layoutRole"))
+ $P = $(el);
+ else
+ $(el).parents().each(function(){
+ if ($(this).data("layoutRole")) {
+ $P = $(this);
+ return false; // BREAK
+ }
+ });
+ if (!$P || !$P.length) return; // INVALID
+
+ var
+ pane = $P.data("layoutEdge")
+ , s = state[pane]
+ , CSS = s.cssSaved || {}
+ ;
+ // reset the zIndex
+ if (!s.isSliding && !s.isResizing)
+ $P.css("zIndex", options.zIndexes.pane_normal);
+
+ // reset Overflow - if necessary
+ $P.css( CSS );
+
+ // clear var
+ s.cssSaved = false;
+ };
+
+/*
+ * #####################
+ * CREATE/RETURN LAYOUT
+ * #####################
+ */
+
+ // validate that container exists
+ var $N = $(this).eq(0); // FIRST matching Container element
+ if (!$N.length) {
+ return _log( options.errors.containerMissing );
+ };
+
+ // Users retrieve Instance of a layout with: $N.layout() OR $N.data("layout")
+ // return the Instance-pointer if layout has already been initialized
+ if ($N.data("layoutContainer") && $N.data("layout"))
+ return $N.data("layout"); // cached pointer
+
+ // init global vars
+ var
+ $Ps = {} // Panes x5 - set in initPanes()
+ , $Cs = {} // Content x5 - set in initPanes()
+ , $Rs = {} // Resizers x4 - set in initHandles()
+ , $Ts = {} // Togglers x4 - set in initHandles()
+ , $Ms = $([]) // Masks - up to 2 masks per pane (IFRAME + DIV)
+ // aliases for code brevity
+ , sC = state.container // alias for easy access to 'container dimensions'
+ , sID = state.id // alias for unique layout ID/namespace - eg: "layout435"
+ ;
+
+ // create Instance object to expose data & option Properties, and primary action Methods
+ var Instance = {
+ // layout data
+ options: options // property - options hash
+ , state: state // property - dimensions hash
+ // object pointers
+ , container: $N // property - object pointers for layout container
+ , panes: $Ps // property - object pointers for ALL Panes: panes.north, panes.center
+ , contents: $Cs // property - object pointers for ALL Content: contents.north, contents.center
+ , resizers: $Rs // property - object pointers for ALL Resizers, eg: resizers.north
+ , togglers: $Ts // property - object pointers for ALL Togglers, eg: togglers.north
+ // border-pane open/close
+ , hide: hide // method - ditto
+ , show: show // method - ditto
+ , toggle: toggle // method - pass a 'pane' ("north", "west", etc)
+ , open: open // method - ditto
+ , close: close // method - ditto
+ , slideOpen: slideOpen // method - ditto
+ , slideClose: slideClose // method - ditto
+ , slideToggle: slideToggle // method - ditto
+ // pane actions
+ , setSizeLimits: setSizeLimits // method - pass a 'pane' - update state min/max data
+ , _sizePane: sizePane // method -intended for user by plugins only!
+ , sizePane: manualSizePane // method - pass a 'pane' AND an 'outer-size' in pixels or percent, or 'auto'
+ , sizeContent: sizeContent // method - pass a 'pane'
+ , swapPanes: swapPanes // method - pass TWO 'panes' - will swap them
+ , showMasks: showMasks // method - pass a 'pane' OR list of panes - default = all panes with mask option set
+ , hideMasks: hideMasks // method - ditto'
+ // pane element methods
+ , initContent: initContent // method - ditto
+ , addPane: addPane // method - pass a 'pane'
+ , removePane: removePane // method - pass a 'pane' to remove from layout, add 'true' to delete the pane-elem
+ , createChildren: createChildren // method - pass a 'pane' and (optional) layout-options (OVERRIDES options[pane].children
+ , refreshChildren: refreshChildren // method - pass a 'pane' and a layout-instance
+ // special pane option setting
+ , enableClosable: enableClosable // method - pass a 'pane'
+ , disableClosable: disableClosable // method - ditto
+ , enableSlidable: enableSlidable // method - ditto
+ , disableSlidable: disableSlidable // method - ditto
+ , enableResizable: enableResizable // method - ditto
+ , disableResizable: disableResizable// method - ditto
+ // utility methods for panes
+ , allowOverflow: allowOverflow // utility - pass calling element (this)
+ , resetOverflow: resetOverflow // utility - ditto
+ // layout control
+ , destroy: destroy // method - no parameters
+ , initPanes: isInitialized // method - no parameters
+ , resizeAll: resizeAll // method - no parameters
+ // callback triggering
+ , runCallbacks: _runCallbacks // method - pass evtName & pane (if a pane-event), eg: trigger("onopen", "west")
+ // alias collections of options, state and children - created in addPane and extended elsewhere
+ , hasParentLayout: false // set by initContainer()
+ , children: children // pointers to child-layouts, eg: Instance.children.west.layoutName
+ , north: false // alias group: { name: pane, pane: $Ps[pane], options: options[pane], state: state[pane], children: children[pane] }
+ , south: false // ditto
+ , west: false // ditto
+ , east: false // ditto
+ , center: false // ditto
+ };
+
+ // create the border layout NOW
+ if (_create() === 'cancel') // onload_start callback returned false to CANCEL layout creation
+ return null;
+ else // true OR false -- if layout-elements did NOT init (hidden or do not exist), can auto-init later
+ return Instance; // return the Instance object
+
+}
+
+
+})( jQuery );
+
+
+
+
+/**
+ * jquery.layout.state 1.2
+ * $Date: 2015/03/13 22:37:04 $
+ *
+ * Copyright (c) 2014
+ * Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * @requires: UI Layout 1.4.0 or higher
+ * @requires: $.ui.cookie (above)
+ *
+ * @see: http://groups.google.com/group/jquery-ui-layout
+ */
+;(function ($) {
+
+if (!$.layout) return;
+
+
+/**
+ * UI COOKIE UTILITY
+ *
+ * A $.cookie OR $.ui.cookie namespace *should be standard*, but until then...
+ * This creates $.ui.cookie so Layout does not need the cookie.jquery.js plugin
+ * NOTE: This utility is REQUIRED by the layout.state plugin
+ *
+ * Cookie methods in Layout are created as part of State Management
+ */
+if (!$.ui) $.ui = {};
+$.ui.cookie = {
+
+ // cookieEnabled is not in DOM specs, but DOES works in all browsers,including IE6
+ acceptsCookies: !!navigator.cookieEnabled
+
+, read: function (name) {
+ var
+ c = document.cookie
+ , cs = c ? c.split(';') : []
+ , pair, data, i
+ ;
+ for (i=0; pair=cs[i]; i++) {
+ data = $.trim(pair).split('='); // name=value => [ name, value ]
+ if (data[0] == name) // found the layout cookie
+ return decodeURIComponent(data[1]);
+ }
+ return null;
+ }
+
+, write: function (name, val, cookieOpts) {
+ var params = ""
+ , date = ""
+ , clear = false
+ , o = cookieOpts || {}
+ , x = o.expires || null
+ , t = $.type(x)
+ ;
+ if (t === "date")
+ date = x;
+ else if (t === "string" && x > 0) {
+ x = parseInt(x,10);
+ t = "number";
+ }
+ if (t === "number") {
+ date = new Date();
+ if (x > 0)
+ date.setDate(date.getDate() + x);
+ else {
+ date.setFullYear(1970);
+ clear = true;
+ }
+ }
+ if (date) params += ";expires="+ date.toUTCString();
+ if (o.path) params += ";path="+ o.path;
+ if (o.domain) params += ";domain="+ o.domain;
+ if (o.secure) params += ";secure";
+ document.cookie = name +"="+ (clear ? "" : encodeURIComponent( val )) + params; // write or clear cookie
+ }
+
+, clear: function (name) {
+ $.ui.cookie.write(name, "", {expires: -1});
+ }
+
+};
+// if cookie.jquery.js is not loaded, create an alias to replicate it
+// this may be useful to other plugins or code dependent on that plugin
+if (!$.cookie) $.cookie = function (k, v, o) {
+ var C = $.ui.cookie;
+ if (v === null)
+ C.clear(k);
+ else if (v === undefined)
+ return C.read(k);
+ else
+ C.write(k, v, o);
+};
+
+
+
+/**
+ * State-management options stored in options.stateManagement, which includes a .cookie hash
+ * Default options saves ALL KEYS for ALL PANES, ie: pane.size, pane.isClosed, pane.isHidden
+ *
+ * // STATE/COOKIE OPTIONS
+ * @example $(el).layout({
+ stateManagement: {
+ enabled: true
+ , stateKeys: "east.size,west.size,east.isClosed,west.isClosed"
+ , cookie: { name: "appLayout", path: "/" }
+ }
+ })
+ * @example $(el).layout({ stateManagement__enabled: true }) // enable auto-state-management using cookies
+ * @example $(el).layout({ stateManagement__cookie: { name: "appLayout", path: "/" } })
+ * @example $(el).layout({ stateManagement__cookie__name: "appLayout", stateManagement__cookie__path: "/" })
+ *
+ * // STATE/COOKIE METHODS
+ * @example myLayout.saveCookie( "west.isClosed,north.size,south.isHidden", {expires: 7} );
+ * @example myLayout.loadCookie();
+ * @example myLayout.deleteCookie();
+ * @example var JSON = myLayout.readState(); // CURRENT Layout State
+ * @example var JSON = myLayout.readCookie(); // SAVED Layout State (from cookie)
+ * @example var JSON = myLayout.state.stateData; // LAST LOADED Layout State (cookie saved in layout.state hash)
+ *
+ * CUSTOM STATE-MANAGEMENT (eg, saved in a database)
+ * @example var JSON = myLayout.readState( "west.isClosed,north.size,south.isHidden" );
+ * @example myLayout.loadState( JSON );
+ */
+
+// tell Layout that the state plugin is available
+$.layout.plugins.stateManagement = true;
+
+// Add State-Management options to layout.defaults
+$.layout.defaults.stateManagement = {
+ enabled: false // true = enable state-management, even if not using cookies
+, autoSave: true // Save a state-cookie when page exits?
+, autoLoad: true // Load the state-cookie when Layout inits?
+, animateLoad: true // animate panes when loading state into an active layout
+, includeChildren: true // recurse into child layouts to include their state as well
+ // List state-data to save - must be pane-specific
+, stateKeys: "north.size,south.size,east.size,west.size,"+
+ "north.isClosed,south.isClosed,east.isClosed,west.isClosed,"+
+ "north.isHidden,south.isHidden,east.isHidden,west.isHidden"
+, cookie: {
+ name: "" // If not specified, will use Layout.name, else just "Layout"
+ , domain: "" // blank = current domain
+ , path: "" // blank = current page, "/" = entire website
+ , expires: "" // 'days' to keep cookie - leave blank for 'session cookie'
+ , secure: false
+ }
+};
+
+// Set stateManagement as a 'layout-option', NOT a 'pane-option'
+$.layout.optionsMap.layout.push("stateManagement");
+// Update config so layout does not move options into the pane-default branch (panes)
+$.layout.config.optionRootKeys.push("stateManagement");
+
+/*
+ * State Management methods
+ */
+$.layout.state = {
+
+ /**
+ * Get the current layout state and save it to a cookie
+ *
+ * myLayout.saveCookie( keys, cookieOpts )
+ *
+ * @param {Object} inst
+ * @param {(string|Array)=} keys
+ * @param {Object=} cookieOpts
+ */
+ saveCookie: function (inst, keys, cookieOpts) {
+ var o = inst.options
+ , sm = o.stateManagement
+ , oC = $.extend(true, {}, sm.cookie, cookieOpts || null)
+ , data = inst.state.stateData = inst.readState( keys || sm.stateKeys ) // read current panes-state
+ ;
+ $.ui.cookie.write( oC.name || o.name || "Layout", $.layout.state.encodeJSON(data), oC );
+ return $.extend(true, {}, data); // return COPY of state.stateData data
+ }
+
+ /**
+ * Remove the state cookie
+ *
+ * @param {Object} inst
+ */
+, deleteCookie: function (inst) {
+ var o = inst.options;
+ $.ui.cookie.clear( o.stateManagement.cookie.name || o.name || "Layout" );
+ }
+
+ /**
+ * Read & return data from the cookie - as JSON
+ *
+ * @param {Object} inst
+ */
+, readCookie: function (inst) {
+ var o = inst.options;
+ var c = $.ui.cookie.read( o.stateManagement.cookie.name || o.name || "Layout" );
+ // convert cookie string back to a hash and return it
+ return c ? $.layout.state.decodeJSON(c) : {};
+ }
+
+ /**
+ * Get data from the cookie and USE IT to loadState
+ *
+ * @param {Object} inst
+ */
+, loadCookie: function (inst) {
+ var c = $.layout.state.readCookie(inst); // READ the cookie
+ if (c && !$.isEmptyObject( c )) {
+ inst.state.stateData = $.extend(true, {}, c); // SET state.stateData
+ inst.loadState(c); // LOAD the retrieved state
+ }
+ return c;
+ }
+
+ /**
+ * Update layout options from the cookie, if one exists
+ *
+ * @param {Object} inst
+ * @param {Object=} stateData
+ * @param {boolean=} animate
+ */
+, loadState: function (inst, data, opts) {
+ if (!$.isPlainObject( data ) || $.isEmptyObject( data )) return;
+
+ // normalize data & cache in the state object
+ data = inst.state.stateData = $.layout.transformData( data ); // panes = default subkey
+
+ // add missing/default state-restore options
+ var smo = inst.options.stateManagement;
+ opts = $.extend({
+ animateLoad: false //smo.animateLoad
+ , includeChildren: smo.includeChildren
+ }, opts );
+
+ if (!inst.state.initialized) {
+ /*
+ * layout NOT initialized, so just update its options
+ */
+ // MUST remove pane.children keys before applying to options
+ // use a copy so we don't remove keys from original data
+ var o = $.extend(true, {}, data);
+ //delete o.center; // center has no state-data - only children
+ $.each($.layout.config.allPanes, function (idx, pane) {
+ if (o[pane]) delete o[pane].children;
+ });
+ // update CURRENT layout-options with saved state data
+ $.extend(true, inst.options, o);
+ }
+ else {
+ /*
+ * layout already initialized, so modify layout's configuration
+ */
+ var noAnimate = !opts.animateLoad
+ , o, c, h, state, open
+ ;
+ $.each($.layout.config.borderPanes, function (idx, pane) {
+ o = data[ pane ];
+ if (!$.isPlainObject( o )) return; // no key, skip pane
+
+ s = o.size;
+ c = o.initClosed;
+ h = o.initHidden;
+ ar = o.autoResize
+ state = inst.state[pane];
+ open = state.isVisible;
+
+ // reset autoResize
+ if (ar)
+ state.autoResize = ar;
+ // resize BEFORE opening
+ if (!open)
+ inst._sizePane(pane, s, false, false, false); // false=skipCallback/noAnimation/forceResize
+ // open/close as necessary - DO NOT CHANGE THIS ORDER!
+ if (h === true) inst.hide(pane, noAnimate);
+ else if (c === true) inst.close(pane, false, noAnimate);
+ else if (c === false) inst.open (pane, false, noAnimate);
+ else if (h === false) inst.show (pane, false, noAnimate);
+ // resize AFTER any other actions
+ if (open)
+ inst._sizePane(pane, s, false, false, noAnimate); // animate resize if option passed
+ });
+
+ /*
+ * RECURSE INTO CHILD-LAYOUTS
+ */
+ if (opts.includeChildren) {
+ var paneStateChildren, childState;
+ $.each(inst.children, function (pane, paneChildren) {
+ paneStateChildren = data[pane] ? data[pane].children : 0;
+ if (paneStateChildren && paneChildren) {
+ $.each(paneChildren, function (stateKey, child) {
+ childState = paneStateChildren[stateKey];
+ if (child && childState)
+ child.loadState( childState );
+ });
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Get the *current layout state* and return it as a hash
+ *
+ * @param {Object=} inst // Layout instance to get state for
+ * @param {object=} [opts] // State-Managements override options
+ */
+, readState: function (inst, opts) {
+ // backward compatility
+ if ($.type(opts) === 'string') opts = { keys: opts };
+ if (!opts) opts = {};
+ var sm = inst.options.stateManagement
+ , ic = opts.includeChildren
+ , recurse = ic !== undefined ? ic : sm.includeChildren
+ , keys = opts.stateKeys || sm.stateKeys
+ , alt = { isClosed: 'initClosed', isHidden: 'initHidden' }
+ , state = inst.state
+ , panes = $.layout.config.allPanes
+ , data = {}
+ , pair, pane, key, val
+ , ps, pC, child, array, count, branch
+ ;
+ if ($.isArray(keys)) keys = keys.join(",");
+ // convert keys to an array and change delimiters from '__' to '.'
+ keys = keys.replace(/__/g, ".").split(',');
+ // loop keys and create a data hash
+ for (var i=0, n=keys.length; i < n; i++) {
+ pair = keys[i].split(".");
+ pane = pair[0];
+ key = pair[1];
+ if ($.inArray(pane, panes) < 0) continue; // bad pane!
+ val = state[ pane ][ key ];
+ if (val == undefined) continue;
+ if (key=="isClosed" && state[pane]["isSliding"])
+ val = true; // if sliding, then *really* isClosed
+ ( data[pane] || (data[pane]={}) )[ alt[key] ? alt[key] : key ] = val;
+ }
+
+ // recurse into the child-layouts for each pane
+ if (recurse) {
+ $.each(panes, function (idx, pane) {
+ pC = inst.children[pane];
+ ps = state.stateData[pane];
+ if ($.isPlainObject( pC ) && !$.isEmptyObject( pC )) {
+ // ensure a key exists for this 'pane', eg: branch = data.center
+ branch = data[pane] || (data[pane] = {});
+ if (!branch.children) branch.children = {};
+ $.each( pC, function (key, child) {
+ // ONLY read state from an initialize layout
+ if ( child.state.initialized )
+ branch.children[ key ] = $.layout.state.readState( child );
+ // if we have PREVIOUS (onLoad) state for this child-layout, KEEP IT!
+ else if ( ps && ps.children && ps.children[ key ] ) {
+ branch.children[ key ] = $.extend(true, {}, ps.children[ key ] );
+ }
+ });
+ }
+ });
+ }
+
+ return data;
+ }
+
+ /**
+ * Stringify a JSON hash so can save in a cookie or db-field
+ */
+, encodeJSON: function (json) {
+ var local = window.JSON || {};
+ return (local.stringify || stringify)(json);
+
+ function stringify (h) {
+ var D=[], i=0, k, v, t // k = key, v = value
+ , a = $.isArray(h)
+ ;
+ for (k in h) {
+ v = h[k];
+ t = typeof v;
+ if (t == 'string') // STRING - add quotes
+ v = '"'+ v +'"';
+ else if (t == 'object') // SUB-KEY - recurse into it
+ v = parse(v);
+ D[i++] = (!a ? '"'+ k +'":' : '') + v;
+ }
+ return (a ? '[' : '{') + D.join(',') + (a ? ']' : '}');
+ };
+ }
+
+ /**
+ * Convert stringified JSON back to a hash object
+ * @see $.parseJSON(), adding in jQuery 1.4.1
+ */
+, decodeJSON: function (str) {
+ try { return $.parseJSON ? $.parseJSON(str) : window["eval"]("("+ str +")") || {}; }
+ catch (e) { return {}; }
+ }
+
+
+, _create: function (inst) {
+ var s = $.layout.state
+ , o = inst.options
+ , sm = o.stateManagement
+ ;
+ // ADD State-Management plugin methods to inst
+ $.extend( inst, {
+ // readCookie - update options from cookie - returns hash of cookie data
+ readCookie: function () { return s.readCookie(inst); }
+ // deleteCookie
+ , deleteCookie: function () { s.deleteCookie(inst); }
+ // saveCookie - optionally pass keys-list and cookie-options (hash)
+ , saveCookie: function (keys, cookieOpts) { return s.saveCookie(inst, keys, cookieOpts); }
+ // loadCookie - readCookie and use to loadState() - returns hash of cookie data
+ , loadCookie: function () { return s.loadCookie(inst); }
+ // loadState - pass a hash of state to use to update options
+ , loadState: function (stateData, opts) { s.loadState(inst, stateData, opts); }
+ // readState - returns hash of current layout-state
+ , readState: function (keys) { return s.readState(inst, keys); }
+ // add JSON utility methods too...
+ , encodeJSON: s.encodeJSON
+ , decodeJSON: s.decodeJSON
+ });
+
+ // init state.stateData key, even if plugin is initially disabled
+ inst.state.stateData = {};
+
+ // autoLoad MUST BE one of: data-array, data-hash, callback-function, or TRUE
+ if ( !sm.autoLoad ) return;
+
+ // When state-data exists in the autoLoad key USE IT,
+ // even if stateManagement.enabled == false
+ if ($.isPlainObject( sm.autoLoad )) {
+ if (!$.isEmptyObject( sm.autoLoad )) {
+ inst.loadState( sm.autoLoad );
+ }
+ }
+ else if ( sm.enabled ) {
+ // update the options from cookie or callback
+ // if options is a function, call it to get stateData
+ if ($.isFunction( sm.autoLoad )) {
+ var d = {};
+ try {
+ d = sm.autoLoad( inst, inst.state, inst.options, inst.options.name || '' ); // try to get data from fn
+ } catch (e) {}
+ if (d && $.isPlainObject( d ) && !$.isEmptyObject( d ))
+ inst.loadState(d);
+ }
+ else // any other truthy value will trigger loadCookie
+ inst.loadCookie();
+ }
+ }
+
+, _unload: function (inst) {
+ var sm = inst.options.stateManagement;
+ if (sm.enabled && sm.autoSave) {
+ // if options is a function, call it to save the stateData
+ if ($.isFunction( sm.autoSave )) {
+ try {
+ sm.autoSave( inst, inst.state, inst.options, inst.options.name || '' ); // try to get data from fn
+ } catch (e) {}
+ }
+ else // any truthy value will trigger saveCookie
+ inst.saveCookie();
+ }
+ }
+
+};
+
+// add state initialization method to Layout's onCreate array of functions
+$.layout.onCreate.push( $.layout.state._create );
+$.layout.onUnload.push( $.layout.state._unload );
+
+})( jQuery );
+
+
+
+/**
+ * @preserve jquery.layout.buttons 1.0
+ * $Date: 2015/03/13 22:37:04 $
+ *
+ * Copyright (c) 2011
+ * Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * @dependancies: UI Layout 1.3.0.rc30.1 or higher
+ *
+ * @support: http://groups.google.com/group/jquery-ui-layout
+ *
+ * Docs: [ to come ]
+ * Tips: [ to come ]
+ */
+;(function ($) {
+
+if (!$.layout) return;
+
+
+// tell Layout that the state plugin is available
+$.layout.plugins.buttons = true;
+
+// Add State-Management options to layout.defaults
+$.layout.defaults.autoBindCustomButtons = false;
+// Set stateManagement as a layout-option, NOT a pane-option
+$.layout.optionsMap.layout.push("autoBindCustomButtons");
+
+var lang = $.layout.language;
+
+/*
+ * Button methods
+ */
+$.layout.buttons = {
+ // set data used by multiple methods below
+ config: {
+ borderPanes: "north,south,west,east"
+ }
+
+ /**
+ * Searches for .ui-layout-button-xxx elements and auto-binds them as layout-buttons
+ *
+ * @see _create()
+ */
+, init: function (inst) {
+ var pre = "ui-layout-button-"
+ , layout = inst.options.name || ""
+ , name;
+ $.each("toggle,open,close,pin,toggle-slide,open-slide".split(","), function (i, action) {
+ $.each($.layout.buttons.config.borderPanes.split(","), function (ii, pane) {
+ $("."+pre+action+"-"+pane).each(function(){
+ // if button was previously 'bound', data.layoutName was set, but is blank if layout has no 'name'
+ name = $(this).data("layoutName") || $(this).attr("layoutName");
+ if (name == undefined || name === layout)
+ inst.bindButton(this, action, pane);
+ });
+ });
+ });
+ }
+
+ /**
+ * Helper function to validate params received by addButton utilities
+ *
+ * Two classes are added to the element, based on the buttonClass...
+ * The type of button is appended to create the 2nd className:
+ * - ui-layout-button-pin
+ * - ui-layout-pane-button-toggle
+ * - ui-layout-pane-button-open
+ * - ui-layout-pane-button-close
+ *
+ * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+ * @param {string} pane Name of the pane the button is for: 'north', 'south', etc.
+ * @return {Array.<Object>} If both params valid, the element matching 'selector' in a jQuery wrapper - otherwise returns null
+ */
+, get: function (inst, selector, pane, action) {
+ var $E = $(selector)
+ , o = inst.options
+ , err = o.showErrorMessages
+ ;
+ if (!$E.length) { // element not found
+ if (err) alert(lang.errButton + lang.selector +": "+ selector);
+ }
+ else if ($.layout.buttons.config.borderPanes.indexOf(pane) === -1) { // invalid 'pane' sepecified
+ if (err) alert(lang.errButton + lang.pane +": "+ pane);
+ $E = $(""); // NO BUTTON
+ }
+ else { // VALID
+ var btn = o[pane].buttonClass +"-"+ action;
+ $E .addClass( btn +" "+ btn +"-"+ pane )
+ .data("layoutName", o.name); // add layout identifier - even if blank!
+ }
+ return $E;
+ }
+
+
+ /**
+ * NEW syntax for binding layout-buttons - will eventually replace addToggle, addOpen, etc.
+ *
+ * @param {(string|!Object)} sel jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+ * @param {string} action
+ * @param {string} pane
+ */
+, bind: function (inst, sel, action, pane) {
+ var _ = $.layout.buttons;
+ switch (action.toLowerCase()) {
+ case "toggle": _.addToggle (inst, sel, pane); break;
+ case "open": _.addOpen (inst, sel, pane); break;
+ case "close": _.addClose (inst, sel, pane); break;
+ case "pin": _.addPin (inst, sel, pane); break;
+ case "toggle-slide": _.addToggle (inst, sel, pane, true); break;
+ case "open-slide": _.addOpen (inst, sel, pane, true); break;
+ }
+ return inst;
+ }
+
+ /**
+ * Add a custom Toggler button for a pane
+ *
+ * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+ * @param {string} pane Name of the pane the button is for: 'north', 'south', etc.
+ * @param {boolean=} slide true = slide-open, false = pin-open
+ */
+, addToggle: function (inst, selector, pane, slide) {
+ $.layout.buttons.get(inst, selector, pane, "toggle")
+ .click(function(evt){
+ inst.toggle(pane, !!slide);
+ evt.stopPropagation();
+ });
+ return inst;
+ }
+
+ /**
+ * Add a custom Open button for a pane
+ *
+ * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+ * @param {string} pane Name of the pane the button is for: 'north', 'south', etc.
+ * @param {boolean=} slide true = slide-open, false = pin-open
+ */
+, addOpen: function (inst, selector, pane, slide) {
+ $.layout.buttons.get(inst, selector, pane, "open")
+ .attr("title", lang.Open)
+ .click(function (evt) {
+ inst.open(pane, !!slide);
+ evt.stopPropagation();
+ });
+ return inst;
+ }
+
+ /**
+ * Add a custom Close button for a pane
+ *
+ * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+ * @param {string} pane Name of the pane the button is for: 'north', 'south', etc.
+ */
+, addClose: function (inst, selector, pane) {
+ $.layout.buttons.get(inst, selector, pane, "close")
+ .attr("title", lang.Close)
+ .click(function (evt) {
+ inst.close(pane);
+ evt.stopPropagation();
+ });
+ return inst;
+ }
+
+ /**
+ * Add a custom Pin button for a pane
+ *
+ * Four classes are added to the element, based on the paneClass for the associated pane...
+ * Assuming the default paneClass and the pin is 'up', these classes are added for a west-pane pin:
+ * - ui-layout-pane-pin
+ * - ui-layout-pane-west-pin
+ * - ui-layout-pane-pin-up
+ * - ui-layout-pane-west-pin-up
+ *
+ * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+ * @param {string} pane Name of the pane the pin is for: 'north', 'south', etc.
+ */
+, addPin: function (inst, selector, pane) {
+ var $E = $.layout.buttons.get(inst, selector, pane, "pin");
+ if ($E.length) {
+ var s = inst.state[pane];
+ $E.click(function (evt) {
+ $.layout.buttons.setPinState(inst, $(this), pane, (s.isSliding || s.isClosed));
+ if (s.isSliding || s.isClosed) inst.open( pane ); // change from sliding to open
+ else inst.close( pane ); // slide-closed
+ evt.stopPropagation();
+ });
+ // add up/down pin attributes and classes
+ $.layout.buttons.setPinState(inst, $E, pane, (!s.isClosed && !s.isSliding));
+ // add this pin to the pane data so we can 'sync it' automatically
+ // PANE.pins key is an array so we can store multiple pins for each pane
+ s.pins.push( selector ); // just save the selector string
+ }
+ return inst;
+ }
+
+ /**
+ * Change the class of the pin button to make it look 'up' or 'down'
+ *
+ * @see addPin(), syncPins()
+ * @param {Array.<Object>} $Pin The pin-span element in a jQuery wrapper
+ * @param {string} pane These are the params returned to callbacks by layout()
+ * @param {boolean} doPin true = set the pin 'down', false = set it 'up'
+ */
+, setPinState: function (inst, $Pin, pane, doPin) {
+ var updown = $Pin.attr("pin");
+ if (updown && doPin === (updown=="down")) return; // already in correct state
+ var
+ pin = inst.options[pane].buttonClass +"-pin"
+ , side = pin +"-"+ pane
+ , UP = pin +"-up "+ side +"-up"
+ , DN = pin +"-down "+side +"-down"
+ ;
+ $Pin
+ .attr("pin", doPin ? "down" : "up") // logic
+ .attr("title", doPin ? lang.Unpin : lang.Pin)
+ .removeClass( doPin ? UP : DN )
+ .addClass( doPin ? DN : UP )
+ ;
+ }
+
+ /**
+ * INTERNAL function to sync 'pin buttons' when pane is opened or closed
+ * Unpinned means the pane is 'sliding' - ie, over-top of the adjacent panes
+ *
+ * @see open(), close()
+ * @param {string} pane These are the params returned to callbacks by layout()
+ * @param {boolean} doPin True means set the pin 'down', False means 'up'
+ */
+, syncPinBtns: function (inst, pane, doPin) {
+ // REAL METHOD IS _INSIDE_ LAYOUT - THIS IS HERE JUST FOR REFERENCE
+ $.each(state[pane].pins, function (i, selector) {
+ $.layout.buttons.setPinState(inst, $(selector), pane, doPin);
+ });
+ }
+
+
+, _load: function (inst) {
+ // ADD Button methods to Layout Instance
+ $.extend( inst, {
+ bindButton: function (selector, action, pane) { return $.layout.buttons.bind(inst, selector, action, pane); }
+ // DEPRECATED METHODS...
+ , addToggleBtn: function (selector, pane, slide) { return $.layout.buttons.addToggle(inst, selector, pane, slide); }
+ , addOpenBtn: function (selector, pane, slide) { return $.layout.buttons.addOpen(inst, selector, pane, slide); }
+ , addCloseBtn: function (selector, pane) { return $.layout.buttons.addClose(inst, selector, pane); }
+ , addPinBtn: function (selector, pane) { return $.layout.buttons.addPin(inst, selector, pane); }
+ });
+
+ // init state array to hold pin-buttons
+ for (var i=0; i<4; i++) {
+ var pane = $.layout.buttons.config.borderPanes[i];
+ inst.state[pane].pins = [];
+ }
+
+ // auto-init buttons onLoad if option is enabled
+ if ( inst.options.autoBindCustomButtons )
+ $.layout.buttons.init(inst);
+ }
+
+, _unload: function (inst) {
+ // TODO: unbind all buttons???
+ }
+
+};
+
+// add initialization method to Layout's onLoad array of functions
+$.layout.onLoad.push( $.layout.buttons._load );
+//$.layout.onUnload.push( $.layout.buttons._unload );
+
+})( jQuery );
+
+
+
+
+/**
+ * jquery.layout.browserZoom 1.0
+ * $Date: 2015/03/13 22:37:04 $
+ *
+ * Copyright (c) 2012
+ * Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * @requires: UI Layout 1.3.0.rc30.1 or higher
+ *
+ * @see: http://groups.google.com/group/jquery-ui-layout
+ *
+ * TODO: Extend logic to handle other problematic zooming in browsers
+ * TODO: Add hotkey/mousewheel bindings to _instantly_ respond to these zoom event
+ */
+(function ($) {
+
+// tell Layout that the plugin is available
+$.layout.plugins.browserZoom = true;
+
+$.layout.defaults.browserZoomCheckInterval = 1000;
+$.layout.optionsMap.layout.push("browserZoomCheckInterval");
+
+/*
+ * browserZoom methods
+ */
+$.layout.browserZoom = {
+
+ _init: function (inst) {
+ // abort if browser does not need this check
+ if ($.layout.browserZoom.ratio() !== false)
+ $.layout.browserZoom._setTimer(inst);
+ }
+
+, _setTimer: function (inst) {
+ // abort if layout destroyed or browser does not need this check
+ if (inst.destroyed) return;
+ var o = inst.options
+ , s = inst.state
+ // don't need check if inst has parentLayout, but check occassionally in case parent destroyed!
+ // MINIMUM 100ms interval, for performance
+ , ms = inst.hasParentLayout ? 5000 : Math.max( o.browserZoomCheckInterval, 100 )
+ ;
+ // set the timer
+ setTimeout(function(){
+ if (inst.destroyed || !o.resizeWithWindow) return;
+ var d = $.layout.browserZoom.ratio();
+ if (d !== s.browserZoom) {
+ s.browserZoom = d;
+ inst.resizeAll();
+ }
+ // set a NEW timeout
+ $.layout.browserZoom._setTimer(inst);
+ }
+ , ms );
+ }
+
+, ratio: function () {
+ var w = window
+ , s = screen
+ , d = document
+ , dE = d.documentElement || d.body
+ , b = $.layout.browser
+ , v = b.version
+ , r, sW, cW
+ ;
+ // we can ignore all browsers that fire window.resize event onZoom
+ if (!b.msie || v > 8)
+ return false; // don't need to track zoom
+ if (s.deviceXDPI && s.systemXDPI) // syntax compiler hack
+ return calc(s.deviceXDPI, s.systemXDPI);
+ // everything below is just for future reference!
+ if (b.webkit && (r = d.body.getBoundingClientRect))
+ return calc((r.left - r.right), d.body.offsetWidth);
+ if (b.webkit && (sW = w.outerWidth))
+ return calc(sW, w.innerWidth);
+ if ((sW = s.width) && (cW = dE.clientWidth))
+ return calc(sW, cW);
+ return false; // no match, so cannot - or don't need to - track zoom
+
+ function calc (x,y) { return (parseInt(x,10) / parseInt(y,10) * 100).toFixed(); }
+ }
+
+};
+// add initialization method to Layout's onLoad array of functions
+$.layout.onReady.push( $.layout.browserZoom._init );
+
+
+})( jQuery );
+
+
+
+
+/**
+ * UI Layout Plugin: Slide-Offscreen Animation
+ *
+ * Prevent panes from being 'hidden' so that an iframes/objects
+ * does not reload/refresh when pane 'opens' again.
+ * This plug-in adds a new animation called "slideOffscreen".
+ * It is identical to the normal "slide" effect, but avoids hiding the element
+ *
+ * Requires Layout 1.3.0.RC30.1 or later for Close offscreen
+ * Requires Layout 1.3.0.RC30.5 or later for Hide, initClosed & initHidden offscreen
+ *
+ * Version: 1.1 - 2012-11-18
+ * Author: Kevin Dalman (kevin@jquery-dev.com)
+ * @preserve jquery.layout.slideOffscreen-1.1.js
+ */
+;(function ($) {
+
+// Add a new "slideOffscreen" effect
+if ($.effects) {
+
+ // add an option so initClosed and initHidden will work
+ $.layout.defaults.panes.useOffscreenClose = false; // user must enable when needed
+ /* set the new animation as the default for all panes
+ $.layout.defaults.panes.fxName = "slideOffscreen";
+ */
+
+ if ($.layout.plugins)
+ $.layout.plugins.effects.slideOffscreen = true;
+
+ // dupe 'slide' effect defaults as new effect defaults
+ $.layout.effects.slideOffscreen = $.extend(true, {}, $.layout.effects.slide);
+
+ // add new effect to jQuery UI
+ $.effects.slideOffscreen = function(o) {
+ return this.queue(function(){
+
+ var fx = $.effects
+ , opt = o.options
+ , $el = $(this)
+ , pane = $el.data('layoutEdge')
+ , state = $el.data('parentLayout').state
+ , dist = state[pane].size
+ , s = this.style
+ , props = ['top','bottom','left','right']
+ // Set options
+ , mode = fx.setMode($el, opt.mode || 'show') // Set Mode
+ , show = (mode == 'show')
+ , dir = opt.direction || 'left' // Default Direction
+ , ref = (dir == 'up' || dir == 'down') ? 'top' : 'left'
+ , pos = (dir == 'up' || dir == 'left')
+ , offscrn = $.layout.config.offscreenCSS || {}
+ , keyLR = $.layout.config.offscreenReset
+ , keyTB = 'offscreenResetTop' // only used internally
+ , animation = {}
+ ;
+ // Animation settings
+ animation[ref] = (show ? (pos ? '+=' : '-=') : (pos ? '-=' : '+=')) + dist;
+
+ if (show) { // show() animation, so save top/bottom but retain left/right set when 'hidden'
+ $el.data(keyTB, { top: s.top, bottom: s.bottom });
+
+ // set the top or left offset in preparation for animation
+ // Note: ALL animations work by shifting the top or left edges
+ if (pos) { // top (north) or left (west)
+ $el.css(ref, isNaN(dist) ? "-" + dist : -dist); // Shift outside the left/top edge
+ }
+ else { // bottom (south) or right (east) - shift all the way across container
+ if (dir === 'right')
+ $el.css({ left: state.container.layoutWidth, right: 'auto' });
+ else // dir === bottom
+ $el.css({ top: state.container.layoutHeight, bottom: 'auto' });
+ }
+ // restore the left/right setting if is a top/bottom animation
+ if (ref === 'top')
+ $el.css( $el.data( keyLR ) || {} );
+ }
+ else { // hide() animation, so save ALL CSS
+ $el.data(keyTB, { top: s.top, bottom: s.bottom });
+ $el.data(keyLR, { left: s.left, right: s.right });
+ }
+
+ // Animate
+ $el.show().animate(animation, { queue: false, duration: o.duration, easing: opt.easing, complete: function(){
+ // Restore top/bottom
+ if ($el.data( keyTB ))
+ $el.css($el.data( keyTB )).removeData( keyTB );
+ if (show) // Restore left/right too
+ $el.css($el.data( keyLR ) || {}).removeData( keyLR );
+ else // Move the pane off-screen (left: -99999, right: 'auto')
+ $el.css( offscrn );
+
+ if (o.callback) o.callback.apply(this, arguments); // Callback
+ $el.dequeue();
+ }});
+
+ });
+ };
+
+}
+
+})( jQuery ); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/moment.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/moment.min.js
new file mode 100644
index 00000000..62b1697b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/moment.min.js
@@ -0,0 +1,6 @@
+// moment.js
+// version : 2.1.0
+// author : Tim Wood
+// license : MIT
+// momentjs.com
+!function(t){function e(t,e){return function(n){return u(t.call(this,n),e)}}function n(t,e){return function(n){return this.lang().ordinal(t.call(this,n),e)}}function s(){}function i(t){a(this,t)}function r(t){var e=t.years||t.year||t.y||0,n=t.months||t.month||t.M||0,s=t.weeks||t.week||t.w||0,i=t.days||t.day||t.d||0,r=t.hours||t.hour||t.h||0,a=t.minutes||t.minute||t.m||0,o=t.seconds||t.second||t.s||0,u=t.milliseconds||t.millisecond||t.ms||0;this._input=t,this._milliseconds=u+1e3*o+6e4*a+36e5*r,this._days=i+7*s,this._months=n+12*e,this._data={},this._bubble()}function a(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function o(t){return 0>t?Math.ceil(t):Math.floor(t)}function u(t,e){for(var n=t+"";n.length<e;)n="0"+n;return n}function h(t,e,n,s){var i,r,a=e._milliseconds,o=e._days,u=e._months;a&&t._d.setTime(+t._d+a*n),(o||u)&&(i=t.minute(),r=t.hour()),o&&t.date(t.date()+o*n),u&&t.month(t.month()+u*n),a&&!s&&H.updateOffset(t),(o||u)&&(t.minute(i),t.hour(r))}function d(t){return"[object Array]"===Object.prototype.toString.call(t)}function c(t,e){var n,s=Math.min(t.length,e.length),i=Math.abs(t.length-e.length),r=0;for(n=0;s>n;n++)~~t[n]!==~~e[n]&&r++;return r+i}function f(t){return t?ie[t]||t.toLowerCase().replace(/(.)s$/,"$1"):t}function l(t,e){return e.abbr=t,x[t]||(x[t]=new s),x[t].set(e),x[t]}function _(t){if(!t)return H.fn._lang;if(!x[t]&&A)try{require("./lang/"+t)}catch(e){return H.fn._lang}return x[t]}function m(t){return t.match(/\[.*\]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function y(t){var e,n,s=t.match(E);for(e=0,n=s.length;n>e;e++)s[e]=ue[s[e]]?ue[s[e]]:m(s[e]);return function(i){var r="";for(e=0;n>e;e++)r+=s[e]instanceof Function?s[e].call(i,t):s[e];return r}}function M(t,e){function n(e){return t.lang().longDateFormat(e)||e}for(var s=5;s--&&N.test(e);)e=e.replace(N,n);return re[e]||(re[e]=y(e)),re[e](t)}function g(t,e){switch(t){case"DDDD":return V;case"YYYY":return X;case"YYYYY":return $;case"S":case"SS":case"SSS":case"DDD":return I;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return R;case"a":case"A":return _(e._l)._meridiemParse;case"X":return B;case"Z":case"ZZ":return j;case"T":return q;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return J;default:return new RegExp(t.replace("\\",""))}}function p(t){var e=(j.exec(t)||[])[0],n=(e+"").match(ee)||["-",0,0],s=+(60*n[1])+~~n[2];return"+"===n[0]?-s:s}function D(t,e,n){var s,i=n._a;switch(t){case"M":case"MM":i[1]=null==e?0:~~e-1;break;case"MMM":case"MMMM":s=_(n._l).monthsParse(e),null!=s?i[1]=s:n._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":null!=e&&(i[2]=~~e);break;case"YY":i[0]=~~e+(~~e>68?1900:2e3);break;case"YYYY":case"YYYYY":i[0]=~~e;break;case"a":case"A":n._isPm=_(n._l).isPM(e);break;case"H":case"HH":case"h":case"hh":i[3]=~~e;break;case"m":case"mm":i[4]=~~e;break;case"s":case"ss":i[5]=~~e;break;case"S":case"SS":case"SSS":i[6]=~~(1e3*("0."+e));break;case"X":n._d=new Date(1e3*parseFloat(e));break;case"Z":case"ZZ":n._useUTC=!0,n._tzm=p(e)}null==e&&(n._isValid=!1)}function Y(t){var e,n,s=[];if(!t._d){for(e=0;7>e;e++)t._a[e]=s[e]=null==t._a[e]?2===e?1:0:t._a[e];s[3]+=~~((t._tzm||0)/60),s[4]+=~~((t._tzm||0)%60),n=new Date(0),t._useUTC?(n.setUTCFullYear(s[0],s[1],s[2]),n.setUTCHours(s[3],s[4],s[5],s[6])):(n.setFullYear(s[0],s[1],s[2]),n.setHours(s[3],s[4],s[5],s[6])),t._d=n}}function w(t){var e,n,s=t._f.match(E),i=t._i;for(t._a=[],e=0;e<s.length;e++)n=(g(s[e],t).exec(i)||[])[0],n&&(i=i.slice(i.indexOf(n)+n.length)),ue[s[e]]&&D(s[e],n,t);i&&(t._il=i),t._isPm&&t._a[3]<12&&(t._a[3]+=12),t._isPm===!1&&12===t._a[3]&&(t._a[3]=0),Y(t)}function k(t){var e,n,s,r,o,u=99;for(r=0;r<t._f.length;r++)e=a({},t),e._f=t._f[r],w(e),n=new i(e),o=c(e._a,n.toArray()),n._il&&(o+=n._il.length),u>o&&(u=o,s=n);a(t,s)}function v(t){var e,n=t._i,s=K.exec(n);if(s){for(t._f="YYYY-MM-DD"+(s[2]||" "),e=0;4>e;e++)if(te[e][1].exec(n)){t._f+=te[e][0];break}j.exec(n)&&(t._f+=" Z"),w(t)}else t._d=new Date(n)}function T(e){var n=e._i,s=G.exec(n);n===t?e._d=new Date:s?e._d=new Date(+s[1]):"string"==typeof n?v(e):d(n)?(e._a=n.slice(0),Y(e)):e._d=n instanceof Date?new Date(+n):new Date(n)}function b(t,e,n,s,i){return i.relativeTime(e||1,!!n,t,s)}function S(t,e,n){var s=W(Math.abs(t)/1e3),i=W(s/60),r=W(i/60),a=W(r/24),o=W(a/365),u=45>s&&["s",s]||1===i&&["m"]||45>i&&["mm",i]||1===r&&["h"]||22>r&&["hh",r]||1===a&&["d"]||25>=a&&["dd",a]||45>=a&&["M"]||345>a&&["MM",W(a/30)]||1===o&&["y"]||["yy",o];return u[2]=e,u[3]=t>0,u[4]=n,b.apply({},u)}function F(t,e,n){var s,i=n-e,r=n-t.day();return r>i&&(r-=7),i-7>r&&(r+=7),s=H(t).add("d",r),{week:Math.ceil(s.dayOfYear()/7),year:s.year()}}function O(t){var e=t._i,n=t._f;return null===e||""===e?null:("string"==typeof e&&(t._i=e=_().preparse(e)),H.isMoment(e)?(t=a({},e),t._d=new Date(+e._d)):n?d(n)?k(t):w(t):T(t),new i(t))}function z(t,e){H.fn[t]=H.fn[t+"s"]=function(t){var n=this._isUTC?"UTC":"";return null!=t?(this._d["set"+n+e](t),H.updateOffset(this),this):this._d["get"+n+e]()}}function C(t){H.duration.fn[t]=function(){return this._data[t]}}function L(t,e){H.duration.fn["as"+t]=function(){return+this/e}}for(var H,P,U="2.1.0",W=Math.round,x={},A="undefined"!=typeof module&&module.exports,G=/^\/?Date\((\-?\d+)/i,Z=/(\-)?(\d*)?\.?(\d+)\:(\d+)\:(\d+)\.?(\d{3})?/,E=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,N=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,J=/\d\d?/,I=/\d{1,3}/,V=/\d{3}/,X=/\d{1,4}/,$=/[+\-]?\d{1,6}/,R=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,j=/Z|[\+\-]\d\d:?\d\d/i,q=/T/i,B=/[\+\-]?\d+(\.\d{1,3})?/,K=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,Q="YYYY-MM-DDTHH:mm:ssZ",te=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],ee=/([\+\-]|\d\d)/gi,ne="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),se={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},ie={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",w:"week",M:"month",y:"year"},re={},ae="DDD w W M D d".split(" "),oe="M D H h m s w W".split(" "),ue={M:function(){return this.month()+1},MMM:function(t){return this.lang().monthsShort(this,t)},MMMM:function(t){return this.lang().months(this,t)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(t){return this.lang().weekdaysMin(this,t)},ddd:function(t){return this.lang().weekdaysShort(this,t)},dddd:function(t){return this.lang().weekdays(this,t)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return u(this.year()%100,2)},YYYY:function(){return u(this.year(),4)},YYYYY:function(){return u(this.year(),5)},gg:function(){return u(this.weekYear()%100,2)},gggg:function(){return this.weekYear()},ggggg:function(){return u(this.weekYear(),5)},GG:function(){return u(this.isoWeekYear()%100,2)},GGGG:function(){return this.isoWeekYear()},GGGGG:function(){return u(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return u(~~(this.milliseconds()/10),2)},SSS:function(){return u(this.milliseconds(),3)},Z:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(t/60),2)+":"+u(~~t%60,2)},ZZ:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(10*t/6),4)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()}};ae.length;)P=ae.pop(),ue[P+"o"]=n(ue[P],P);for(;oe.length;)P=oe.pop(),ue[P+P]=e(ue[P],2);for(ue.DDDD=e(ue.DDD,3),s.prototype={set:function(t){var e,n;for(n in t)e=t[n],"function"==typeof e?this[n]=e:this["_"+n]=e},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(t){return this._months[t.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(t){return this._monthsShort[t.month()]},monthsParse:function(t){var e,n,s;for(this._monthsParse||(this._monthsParse=[]),e=0;12>e;e++)if(this._monthsParse[e]||(n=H([2e3,e]),s="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[e]=new RegExp(s.replace(".",""),"i")),this._monthsParse[e].test(t))return e},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(t){return this._weekdays[t.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(t){return this._weekdaysShort[t.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(t){return this._weekdaysMin[t.day()]},weekdaysParse:function(t){var e,n,s;for(this._weekdaysParse||(this._weekdaysParse=[]),e=0;7>e;e++)if(this._weekdaysParse[e]||(n=H([2e3,1]).day(e),s="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[e]=new RegExp(s.replace(".",""),"i")),this._weekdaysParse[e].test(t))return e},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(t){var e=this._longDateFormat[t];return!e&&this._longDateFormat[t.toUpperCase()]&&(e=this._longDateFormat[t.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t]=e),e},isPM:function(t){return"p"===(t+"").toLowerCase()[0]},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(t,e){var n=this._calendar[t];return"function"==typeof n?n.apply(e):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(t,e,n,s){var i=this._relativeTime[n];return"function"==typeof i?i(t,e,n,s):i.replace(/%d/i,t)},pastFuture:function(t,e){var n=this._relativeTime[t>0?"future":"past"];return"function"==typeof n?n(e):n.replace(/%s/i,e)},ordinal:function(t){return this._ordinal.replace("%d",t)},_ordinal:"%d",preparse:function(t){return t},postformat:function(t){return t},week:function(t){return F(t,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6}},H=function(t,e,n){return O({_i:t,_f:e,_l:n,_isUTC:!1})},H.utc=function(t,e,n){return O({_useUTC:!0,_isUTC:!0,_l:n,_i:t,_f:e})},H.unix=function(t){return H(1e3*t)},H.duration=function(t,e){var n,s,i=H.isDuration(t),a="number"==typeof t,o=i?t._input:a?{}:t,u=Z.exec(t);return a?e?o[e]=t:o.milliseconds=t:u&&(n="-"===u[1]?-1:1,o={y:0,d:~~u[2]*n,h:~~u[3]*n,m:~~u[4]*n,s:~~u[5]*n,ms:~~u[6]*n}),s=new r(o),i&&t.hasOwnProperty("_lang")&&(s._lang=t._lang),s},H.version=U,H.defaultFormat=Q,H.updateOffset=function(){},H.lang=function(t,e){return t?(e?l(t,e):x[t]||_(t),H.duration.fn._lang=H.fn._lang=_(t),void 0):H.fn._lang._abbr},H.langData=function(t){return t&&t._lang&&t._lang._abbr&&(t=t._lang._abbr),_(t)},H.isMoment=function(t){return t instanceof i},H.isDuration=function(t){return t instanceof r},H.fn=i.prototype={clone:function(){return H(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){return M(H(this).utc(),"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var t=this;return[t.year(),t.month(),t.date(),t.hours(),t.minutes(),t.seconds(),t.milliseconds()]},isValid:function(){return null==this._isValid&&(this._isValid=this._a?!c(this._a,(this._isUTC?H.utc(this._a):H(this._a)).toArray()):!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(t){var e=M(this,t||H.defaultFormat);return this.lang().postformat(e)},add:function(t,e){var n;return n="string"==typeof t?H.duration(+e,t):H.duration(t,e),h(this,n,1),this},subtract:function(t,e){var n;return n="string"==typeof t?H.duration(+e,t):H.duration(t,e),h(this,n,-1),this},diff:function(t,e,n){var s,i,r=this._isUTC?H(t).zone(this._offset||0):H(t).local(),a=6e4*(this.zone()-r.zone());return e=f(e),"year"===e||"month"===e?(s=432e5*(this.daysInMonth()+r.daysInMonth()),i=12*(this.year()-r.year())+(this.month()-r.month()),i+=(this-H(this).startOf("month")-(r-H(r).startOf("month")))/s,i-=6e4*(this.zone()-H(this).startOf("month").zone()-(r.zone()-H(r).startOf("month").zone()))/s,"year"===e&&(i/=12)):(s=this-r,i="second"===e?s/1e3:"minute"===e?s/6e4:"hour"===e?s/36e5:"day"===e?(s-a)/864e5:"week"===e?(s-a)/6048e5:s),n?i:o(i)},from:function(t,e){return H.duration(this.diff(t)).lang(this.lang()._abbr).humanize(!e)},fromNow:function(t){return this.from(H(),t)},calendar:function(){var t=this.diff(H().startOf("day"),"days",!0),e=-6>t?"sameElse":-1>t?"lastWeek":0>t?"lastDay":1>t?"sameDay":2>t?"nextDay":7>t?"nextWeek":"sameElse";return this.format(this.lang().calendar(e,this))},isLeapYear:function(){var t=this.year();return 0===t%4&&0!==t%100||0===t%400},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(t){var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?"string"==typeof t&&(t=this.lang().weekdaysParse(t),"number"!=typeof t)?this:this.add({d:t-e}):e},month:function(t){var e,n=this._isUTC?"UTC":"";return null!=t?"string"==typeof t&&(t=this.lang().monthsParse(t),"number"!=typeof t)?this:(e=this.date(),this.date(1),this._d["set"+n+"Month"](t),this.date(Math.min(e,this.daysInMonth())),H.updateOffset(this),this):this._d["get"+n+"Month"]()},startOf:function(t){switch(t=f(t)){case"year":this.month(0);case"month":this.date(1);case"week":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),this},endOf:function(t){return this.startOf(t).add(t,1).subtract("ms",1)},isAfter:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)>+H(t).startOf(e)},isBefore:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)<+H(t).startOf(e)},isSame:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)===+H(t).startOf(e)},min:function(t){return t=H.apply(null,arguments),this>t?this:t},max:function(t){return t=H.apply(null,arguments),t>this?this:t},zone:function(t){var e=this._offset||0;return null==t?this._isUTC?e:this._d.getTimezoneOffset():("string"==typeof t&&(t=p(t)),Math.abs(t)<16&&(t=60*t),this._offset=t,this._isUTC=!0,e!==t&&h(this,H.duration(e-t,"m"),1,!0),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},daysInMonth:function(){return H.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(t){var e=W((H(this).startOf("day")-H(this).startOf("year"))/864e5)+1;return null==t?e:this.add("d",t-e)},weekYear:function(t){var e=F(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==t?e:this.add("y",t-e)},isoWeekYear:function(t){var e=F(this,1,4).year;return null==t?e:this.add("y",t-e)},week:function(t){var e=this.lang().week(this);return null==t?e:this.add("d",7*(t-e))},isoWeek:function(t){var e=F(this,1,4).week;return null==t?e:this.add("d",7*(t-e))},weekday:function(t){var e=(this._d.getDay()+7-this.lang()._week.dow)%7;return null==t?e:this.add("d",t-e)},isoWeekday:function(t){return null==t?this.day()||7:this.day(this.day()%7?t:t-7)},lang:function(e){return e===t?this._lang:(this._lang=_(e),this)}},P=0;P<ne.length;P++)z(ne[P].toLowerCase().replace(/s$/,""),ne[P]);z("year","FullYear"),H.fn.days=H.fn.day,H.fn.months=H.fn.month,H.fn.weeks=H.fn.week,H.fn.isoWeeks=H.fn.isoWeek,H.fn.toJSON=H.fn.toISOString,H.duration.fn=r.prototype={_bubble:function(){var t,e,n,s,i=this._milliseconds,r=this._days,a=this._months,u=this._data;u.milliseconds=i%1e3,t=o(i/1e3),u.seconds=t%60,e=o(t/60),u.minutes=e%60,n=o(e/60),u.hours=n%24,r+=o(n/24),u.days=r%30,a+=o(r/30),u.months=a%12,s=o(a/12),u.years=s},weeks:function(){return o(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+2592e6*(this._months%12)+31536e6*~~(this._months/12)},humanize:function(t){var e=+this,n=S(e,!t,this.lang());return t&&(n=this.lang().pastFuture(e,n)),this.lang().postformat(n)},add:function(t,e){var n=H.duration(t,e);return this._milliseconds+=n._milliseconds,this._days+=n._days,this._months+=n._months,this._bubble(),this},subtract:function(t,e){var n=H.duration(t,e);return this._milliseconds-=n._milliseconds,this._days-=n._days,this._months-=n._months,this._bubble(),this},get:function(t){return t=f(t),this[t.toLowerCase()+"s"]()},as:function(t){return t=f(t),this["as"+t.charAt(0).toUpperCase()+t.slice(1)+"s"]()},lang:H.fn.lang};for(P in se)se.hasOwnProperty(P)&&(L(P,se[P]),C(P.toLowerCase()));L("Weeks",6048e5),H.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},H.lang("en",{ordinal:function(t){var e=t%10,n=1===~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),A&&(module.exports=H),"undefined"==typeof ender&&(this.moment=H),"function"==typeof define&&define.amd&&define("moment",[],function(){return H})}.call(this); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/Style.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/Style.css
new file mode 100644
index 00000000..1fa71bef
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/Style.css
@@ -0,0 +1,77 @@
+th.header {
+ background: #DDEEFB repeat-x 0 0 !important;
+ text-align: center;
+ color: #144BA1 !important;
+ font-weight: bold !important;
+}
+td.last, th.last {
+ border-right-width: 3px !important;
+}
+td.years , td.season, td.month {
+ text-align: center;
+ color: #043554;
+}
+td.years {
+ background: #085d8a !important;
+ color: white;
+}
+.years .z-label {
+ font-size: 16px;
+}
+td.season {
+ background: #F2DFBA !important;
+}
+td.month {
+ background: #CADBA4 !important;
+ font-style: italic;
+}
+.tooltip {
+ padding: .8em;
+ width: 200px;
+ border-width: 2px !important;
+ position: absolute;
+ background:#FFE45C url(${c:encodeURL('/images/tooltip-bg.png')}) repeat-x scroll 50% top;
+ border:1px solid #FED22F;
+ color:#363636;
+ -moz-border-radius-bottomleft:4px;
+ -moz-border-radius-bottomright:4px;
+ -moz-border-radius-topleft:4px;
+ -moz-border-radius-topright:4px;
+ -webkit-border-top-left-radius: 4px;
+ -webkit-border-top-right-radius: 4px;
+ -webkit-border-bottom-left-radius: 4px;
+ -webkit-border-bottom-right-radius: 4px;
+ top: 280px;
+ display: none;
+}
+
+.tooltip-anchor, .tooltip-anchor-inner {
+ position: absolute;
+ width:0;
+ height:0;
+ border-bottom-width: 0;
+ background: none;
+ border:1px solid #FED22F;
+ color:#363636;
+ border-bottom-width: 0;
+}
+.tooltip-anchor {
+ border-left:0 none;
+ border-right:17px dotted transparent;
+ border-top-width:14px;
+ bottom:-14px;
+ left:1em;
+ margin:0;
+ right:auto;
+}
+.tooltip-anchor-inner {
+ border-left:0 none;
+ border-right:12px dotted transparent;
+ border-top:10px solid #FFFFFF;
+ bottom:auto;
+ border-top-color:#FFE45C;
+ border-top-style:solid;
+ border-top-width:10px;
+ left:2px;
+ top:-14px;
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/bd_quantum_raptor.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/bd_quantum_raptor.css
new file mode 100644
index 00000000..8674a88c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/bd_quantum_raptor.css
@@ -0,0 +1,305 @@
+/* Make Plain Grid+smaller comps Padding + white background */
+/* "overflow:hidden ;" not working in Chrome/Safari */
+.GridLayoutNoBorder tr.z-row td.z-row-inner,tr.z-row,div.z-grid-body div.z-cell,div.z-grid,tr.z-grid-odd td.z-row-inner,tr.z-grid-odd .z-cell,tr.z-grid-odd
+ {
+ border: none;
+ zoom: 1;
+ background: white;
+ border-top: none;
+ border-left: none;
+ border-right: none;
+ border-bottom: none;
+ padding: 1px;
+}
+
+.GridLayoutNoBorder .z-row:hover>.z-cell {
+ background-color: white;
+ color: black;
+ font-weight: bold;
+}
+
+.GridReport tr.z-row td.z-row-inner,tr.z-row,div.z-grid-body div.z-cell,div.z-grid
+ {
+ background-color: white;
+ border-top: none;
+ border-left: none;
+ border-right: none;
+ border-bottom: none;
+ padding-top: 4px;
+ padding-bottom: 4px;
+ padding-left: 6px;
+ padding-right: 6px;
+ vertical-align:middle;
+ border-right-color: #ccc;
+ border-bottom-color: #ccc;
+ /*overflow:hidden;*/
+}
+.GridReportodd, .GridReportodd > td
+ {
+ color: black; background-color: rgb(255,255,204) !important;
+ }
+
+
+.z-toolbarbutton {
+ display: inline-block;
+ height: 24px;
+ border: 1px solid transparent;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ margin: 0 2px;
+ padding: 1px 0;
+ line-height: 14px;
+ position: relative;
+ cursor: pointer;
+ float: right;
+}
+
+.z-paging-input {
+ font-family:Arial,Sans-serif;
+ font-size:12px;
+ font-weight:normal;
+ font-style:normal;
+ color:#000;
+ height:24px;
+ border:1px solid #8fb9d0;
+ margin-left:6px;
+ padding:3px 0;
+ line-height:20px;
+ vertical-align:baseline;
+}
+.z-paging-text {
+ font-family:Arial,Sans-serif;
+ font-size:12px;
+ font-weight:normal;
+ font-style:normal;
+ color:#000;
+ margin-right:12px
+}
+.z-paging-info {
+ font-family:Arial,Sans-serif;
+ font-size:12px;
+ font-weight:normal;
+ font-style:normal;
+ color:#000;
+ padding:4px 0;
+ position:absolute;
+ top:4px;
+ right:10px;
+}
+.z-menu-text,.z-menuitem-text {
+ font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;
+ font-size:12px;
+ font-weight:normal;
+ display:inline-block;
+ line-height:16px;
+ text-shadow:0 0px #fff
+}
+.z-menubar {
+ border-top: 0px
+ border-bottom: 0px;
+}
+.z-column-content {
+ font-family: Arial,Sans-serif;
+ font-size: 12px;
+ color: #fff;
+ padding: 4px 5px;
+ line-height: 24px;
+ overflow: hidden;
+}
+.z-column-hover {
+ background: -webkit-linear-gradient(top, #336699 0%, #336699 100%); /* Chrome10+,Safari5.1+ */
+ background: linear-gradient(to bottom, #336699 0%, #336699 100%); /* W3C */
+}
+/*
+.z-row:hover>.z-row-inner, .z-row:hover>.z-cell {
+background: #6ba6bf;
+background-clip: padding-box;
+position: relative;*/
+
+.z-messagebox .z-label {
+ font-family: Arial,Sans-serif;
+ font-size: 12px;
+ color: #000;
+}
+
+.z-popup .z-popup-content{
+ font-family: Arial,Sans-serif;
+ font-size: 12px;
+ font-weight: normal;
+ font-style: normal;
+ color: #000;
+ height: 100%;
+ padding: 10px;
+ line-height: 14px;
+}
+
+.z-notification-pointer ~ .z-notification-content {
+ display:table-cell;
+ width:150px;
+ height:50px;
+ min-height:60px;
+ ${t:borderRadius('5px') };
+ padding:5px 18px 5px 45px;
+ vertical-align:middle;
+}
+.z-loading {
+ background-color:#808080;
+ border:1px outset #A0A0A0;
+ font-weight: bold;
+ padding:2px;
+}
+.z-loading-indicator {
+ color: gray;
+ border:0 none;
+}
+.z-toolbarbutton-content {
+ color: #fff;
+ text-shadow: 0 0px;
+}
+
+.z-groupbox>.z-groupbox-header {
+ color: #000;
+}
+
+.z-combobox-button, .z-bandbox-button, .z-datebox-button, .z-timebox-button, .z-spinner-button, .z-doublespinner-button {
+ color: #000;
+}
+
+
+/*.z-panel-header {
+font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
+font-size: 12px;
+font-weight: normal;
+font-style: normal;
+color: #fff;
+border: 0;
+padding: 3px 0 5px 0;
+line-height: 0px;
+background: #369;
+overflow: hidden;
+zoom: 1;
+display: none;
+}*/
+
+
+
+ .z-menupopup .z-menu-image, .z-menupopup .z-menuitem-image {
+min-width: 16px;
+min-height: 16px;
+margin-right: 9px;
+display: none;
+}
+
+
+ .z-menupopup-separator {
+width: 2px;
+height: 100%;
+border-width: 3px 1px 3px 0;
+border-style: solid;
+border-color: #d9f0fc;
+background: #a2c0ce;
+position: absolute;
+top: 0;
+left: 31px;
+z-index: 10;
+display: none;
+}
+
+
+ .z-menupopup-content {
+left: 0px;
+}
+
+ .z-menu-icon.z-icon-caret-right {
+font-size: 15px;
+color: red;
+}
+
+
+ .z-menu-content:hover, .z-menuitem-content:hover {
+border-color: #8fb9d0;
+background: -webkit-linear-gradient(top, #e2f3fc 0%, #336699 100%);
+background: linear-gradient(to bottom, #e2f3fc 0%, #336699 100%);
+}
+
+/*.toolBarRaptor .z-toolbar {
+ background:white;
+}
+
+.toolBarRaptor .z-menuitem-content {
+ color:#000;
+}
+
+.toolBarRaptor .z-menuitem-content {
+ color:#000;
+}*/
+
+/*.z-caption .z-label {
+ float: right;
+}
+
+.z-caption-content, .z-caption .z-label {
+ display: inline-block;
+ padding: 0;
+ line-height: 24px;
+ float: right;
+} */
+
+
+
+.ChartPanel .z-panel-head {
+ border:;
+}
+.ChartPanel .z-panel-header {
+line-height: 12px;
+color: #000;
+background:;
+}
+.ChartPanel .z-panel-icon {
+color: #000;
+display: block;
+-webkit-border-radius: ;
+border-radius: ;
+text-align: left;
+overflow: hidden;
+cursor: pointer;
+float: left;
+}
+
+.ChartPanel .z-panel-icon:hover {
+ color: ;
+ border-color: ;
+ background: 0;
+filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
+ background:;
+ float:left;
+}
+
+.ChartPanel .z-panel-expand {
+font-size: 9px;
+width: 12px;
+line-height: 12px;
+}
+
+/*[class^="z-icon-"], [class*=" z-icon-"] {*/
+.ChartPanel .z-icon {
+display: inline-block;
+font-family: FontAwesome;
+font-size: 10px;
+font-weight: normal;
+font-style: normal;
+-webkit-font-smoothing: antialiased;
+-moz-osx-font-smoothing: grayscale;
+}
+
+.ChartPanel .z-icon-caret-up:before {
+ content: "\f068";
+}
+
+.ChartPanel .z-icon-caret-down:before {
+ content: "\f067";
+}
+
+.ie8 .z-column {
+background: #369;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/calendar.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/calendar.css
new file mode 100644
index 00000000..fdd2242f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/calendar.css
@@ -0,0 +1,97 @@
+.TESTcpYearNavigation,
+.raptorcpMonthNavigation
+ {
+ background-color:#336699;
+ text-align:center;
+ vertical-align:center;
+ text-decoration:none;
+ color:#FFFFFF;
+ font-weight:bold;
+ }
+.raptorcpDayColumnHeader,
+.raptorcpYearNavigation,
+.raptorcpMonthNavigation,
+.raptorcpCurrentMonthDate,
+.raptorcpCurrentMonthDateDisabled,
+.raptorcpOtherMonthDate,
+.raptorcpOtherMonthDateDisabled,
+.raptorcpCurrentDate,
+.raptorcpCurrentDateDisabled,
+.raptorcpTodayText,
+.raptorcpTodayTextDisabled,
+.raptorcpText
+ {
+ font-family:arial;
+ font-size:8pt;
+ }
+TD.raptorcpDayColumnHeader
+ {
+ text-align:right;
+ border:solid thin #336699;
+ border-width:0 0 1 0;
+ }
+.raptorcpCurrentMonthDate,
+.raptorcpOtherMonthDate,
+.raptorcpCurrentDate
+ {
+ text-align:right;
+ text-decoration:none;
+ }
+.raptorcpCurrentMonthDateDisabled,
+.raptorcpOtherMonthDateDisabled,
+.raptorcpCurrentDateDisabled
+ {
+ color:#D0D0D0;
+ text-align:right;
+ text-decoration:line-through;
+ }
+.raptorcpCurrentMonthDate
+ {
+ color:#336699;
+ font-weight:bold;
+ }
+.raptorcpCurrentDate
+ {
+ color: #FFFFFF;
+ font-weight:bold;
+ }
+.raptorcpOtherMonthDate
+ {
+ color:#808080;
+ }
+TD.raptorcpCurrentDate
+ {
+ color:#FFFFFF;
+ background-color: red;
+ border-width:1;
+ border:solid thin #000000;
+ }
+TD.raptorcpCurrentDateDisabled
+ {
+ border-width:1;
+ border:solid thin #FFAAAA;
+ }
+TD.raptorcpTodayText,
+TD.raptorcpTodayTextDisabled
+ {
+ border:solid thin #336699;
+ border-width:1 0 0 0;
+ }
+A.raptorcpTodayText,
+SPAN.raptorcpTodayTextDisabled
+ {
+ height:20px;
+ }
+A.raptorcpTodayText
+ {
+ color:#336699;
+ font-weight:bold;
+ }
+SPAN.raptorcpTodayTextDisabled
+ {
+ color:#D0D0D0;
+ }
+.raptorcpBorder
+ {
+ border:solid thin #336699;
+ }
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/dashboard.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/dashboard.css
new file mode 100644
index 00000000..2c79da20
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/dashboard.css
@@ -0,0 +1,36 @@
+#news1{
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 4pt;
+ margin: 0px;
+ background-color:#FFFFDF;
+ overflow: auto;
+ }
+
+#news2{
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 4pt;
+ margin: 0px;
+ background-color:#E2E2E2;
+ overflow: auto;
+ }
+#news3{
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 4pt;
+ margin: 0px;
+ background-color:#E2E2E2;
+ overflow: auto;
+ }
+
+#news4{
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 4pt;
+ margin: 0px;
+ background-color:#FFFFDF;
+ overflow: auto;
+ }
+
+#superTable {
+ width: 100%;
+ height: 100%;
+ /*table-layout: fixed;*/
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/drupal.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/drupal.css
new file mode 100644
index 00000000..15850790
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/drupal.css
@@ -0,0 +1,83 @@
+
+
+#aggregator .feed-source .feed-title{margin-top:0;}#aggregator .feed-source .feed-image img{margin-bottom:0.75em;}#aggregator .feed-source .feed-icon{float:right;display:block;}#aggregator .feed-item{margin-bottom:1.5em;}#aggregator .feed-item-title{margin-bottom:0;font-size:1.3em;}#aggregator .feed-item-meta,#aggregator .feed-item-body{margin-bottom:0.5em;}#aggregator .feed-item-categories{font-size:0.9em;}#aggregator td{vertical-align:bottom;}#aggregator td.categorize-item{white-space:nowrap;}#aggregator .categorize-item .news-item .body{margin-top:0;}#aggregator .categorize-item h3{margin-bottom:1em;margin-top:0;}
+
+
+.book-navigation .menu{border-top:1px solid #888;padding:1em 0 0 3em;}.book-navigation .page-links{border-top:1px solid #888;border-bottom:1px solid #888;text-align:center;padding:0.5em;}.book-navigation .page-previous{text-align:left;width:42%;display:block;float:left;}.book-navigation .page-up{margin:0 5%;width:4%;display:block;float:left;}.book-navigation .page-next{text-align:right;width:42%;display:block;float:right;}#book-outline{min-width:56em;}.book-outline-form .form-item{margin-top:0;margin-bottom:0;}#edit-book-bid-wrapper .description{clear:both;}#book-admin-edit select{margin-right:24px;}#book-admin-edit select.progress-disabled{margin-right:0;}#book-admin-edit tr.ahah-new-content{background-color:#ffd;}#book-admin-edit .form-item{float:left;}
+
+
+.node-unpublished{background-color:#fff4f4;}.preview .node{background-color:#ffffea;}#node-admin-filter ul{list-style-type:none;padding:0;margin:0;width:100%;}#node-admin-buttons{float:left;margin-left:0.5em;clear:right;}td.revision-current{background:#ffc;}.node-form .form-text{display:block;width:95%;}.node-form .container-inline .form-text{display:inline;width:auto;}.node-form .standard{clear:both;}.node-form textarea{display:block;width:95%;}.node-form .attachments fieldset{float:none;display:block;}.terms-inline{display:inline;}
+
+
+
+fieldset{margin-bottom:1em;padding:.5em;}form{margin:0;padding:0;}hr{height:1px;border:1px solid gray;}img{border:0;}table{border-collapse:collapse;}th{text-align:left;padding-right:1em;border-bottom:3px solid #ccc;}.clear-block:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.clear-block{display:inline-block;}/*_\*/
+* html .clear-block{height:1%;}.clear-block{display:block;}/* End hide from IE-mac */
+
+
+
+
+body.drag{cursor:move;}th.active img{display:inline;}tr.even,tr.odd{background-color:#eee;border-bottom:1px solid #ccc;padding:0.1em 0.6em;}tr.drag{background-color:#fffff0;}tr.drag-previous{background-color:#ffd;}td.active{background-color:#ddd;}td.checkbox,th.checkbox{text-align:center;}tbody{border-top:1px solid #ccc;}tbody th{border-bottom:1px solid #ccc;}thead th{text-align:left;padding-right:1em;border-bottom:3px solid #ccc;}.breadcrumb{padding-bottom:.5em}div.indentation{width:20px;height:1.7em;margin:-0.4em 0.2em -0.4em -0.4em;padding:0.42em 0 0.42em 0.6em;float:left;}div.tree-child{background:url(/misc/tree.png) no-repeat 11px center;}div.tree-child-last{background:url(/misc/tree-bottom.png) no-repeat 11px center;}div.tree-child-horizontal{background:url(/misc/tree.png) no-repeat -11px center;}.error{color:#e55;}div.error{border:1px solid #d77;}div.error,tr.error{background:#fcc;color:#200;padding:2px;}.warning{color:#e09010;}div.warning{border:1px solid #f0c020;}div.warning,tr.warning{background:#ffd;color:#220;padding:2px;}.ok{color:#008000;}div.ok{border:1px solid #00aa00;}div.ok,tr.ok{background:#dfd;color:#020;padding:2px;}.item-list .icon{color:#555;float:right;padding-left:0.25em;clear:right;}.item-list .title{font-weight:bold;}.item-list ul{margin:0 0 0.75em 0;padding:0;}.item-list ul li{margin:0 0 0.25em 1.5em;padding:0;list-style:disc;}ol.task-list li.active{font-weight:bold;}.form-item{margin-top:1em;margin-bottom:1em;}tr.odd .form-item,tr.even .form-item{margin-top:0;margin-bottom:0;white-space:nowrap;}tr.merge-down,tr.merge-down td,tr.merge-down th{border-bottom-width:0 !important;}tr.merge-up,tr.merge-up td,tr.merge-up th{border-top-width:0 !important;}.form-item input.error,.form-item textarea.error,.form-item select.error{border:2px solid red;}.form-item .description{font-size:0.85em;}.form-item label{display:block;font-weight:bold;}.form-item label.option{display:inline;font-weight:normal;}.form-checkboxes,.form-radios{margin:1em 0;}.form-checkboxes .form-item,.form-radios .form-item{margin-top:0.4em;margin-bottom:0.4em;}.marker,.form-required{color:#f00;}.more-link{text-align:right;}.more-help-link{font-size:0.85em;text-align:right;}.nowrap{white-space:nowrap;}.item-list .pager{clear:both;text-align:center;}.item-list .pager li{background-image:none;display:inline;list-style-type:none;padding:0.5em;}.pager-current{font-weight:bold;}.tips{margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;font-size:0.9em;}dl.multiselect dd.b,dl.multiselect dd.b .form-item,dl.multiselect dd.b select{font-family:inherit;font-size:inherit;width:14em;}dl.multiselect dd.a,dl.multiselect dd.a .form-item{width:8em;}dl.multiselect dt,dl.multiselect dd{float:left;line-height:1.75em;padding:0;margin:0 1em 0 0;}dl.multiselect .form-item{height:1.75em;margin:0;}.container-inline div,.container-inline label{display:inline;}ul.primary{border-collapse:collapse;padding:0 0 0 1em;white-space:nowrap;list-style:none;margin:5px;height:auto;line-height:normal;border-bottom:1px solid #bbb;}ul.primary li{display:inline;}ul.primary li a{background-color:#ddd;border-color:#bbb;border-width:1px;border-style:solid solid none solid;height:auto;margin-right:0.5em;padding:0 1em;text-decoration:none;}ul.primary li.active a{background-color:#fff;border:1px solid #bbb;border-bottom:#fff 1px solid;}ul.primary li a:hover{background-color:#eee;border-color:#ccc;border-bottom-color:#eee;}ul.secondary{border-bottom:1px solid #bbb;padding:0.5em 1em;margin:5px;}ul.secondary li{display:inline;padding:0 1em;border-right:1px solid #ccc;}ul.secondary a{padding:0;text-decoration:none;}ul.secondary a.active{border-bottom:4px solid #999;}#autocomplete{position:absolute;border:1px solid;overflow:hidden;z-index:100;}#autocomplete ul{margin:0;padding:0;list-style:none;}#autocomplete li{background:#fff;color:#000;white-space:pre;cursor:default;}#autocomplete li.selected{background:#0072b9;color:#fff;}html.js input.form-autocomplete{background-image:url(/misc/throbber.gif);background-repeat:no-repeat;background-position:100% 2px;}html.js input.throbbing{background-position:100% -18px;}html.js fieldset.collapsed{border-bottom-width:0;border-left-width:0;border-right-width:0;margin-bottom:0;height:1em;}html.js fieldset.collapsed *{display:none;}html.js fieldset.collapsed legend{display:block;}html.js fieldset.collapsible legend a{padding-left:15px;background:url(/misc/menu-expanded.png) 5px 75% no-repeat;}html.js fieldset.collapsed legend a{background-image:url(/misc/menu-collapsed.png);background-position:5px 50%;}* html.js fieldset.collapsed legend,* html.js fieldset.collapsed legend *,* html.js fieldset.collapsed table *{display:inline;}html.js fieldset.collapsible{position:relative;}html.js fieldset.collapsible legend a{display:block;}html.js fieldset.collapsible .fieldset-wrapper{overflow:auto;}.resizable-textarea{width:95%;}.resizable-textarea .grippie{height:9px;overflow:hidden;background:#eee url(/misc/grippie.png) no-repeat center 2px;border:1px solid #ddd;border-top-width:0;cursor:s-resize;}html.js .resizable-textarea textarea{margin-bottom:0;width:100%;display:block;}.draggable a.tabledrag-handle{cursor:move;float:left;height:1.7em;margin:-0.4em 0 -0.4em -0.5em;padding:0.42em 1.5em 0.42em 0.5em;text-decoration:none;}a.tabledrag-handle:hover{text-decoration:none;}a.tabledrag-handle .handle{margin-top:4px;height:13px;width:13px;background:url(/misc/draggable.png) no-repeat 0 0;}a.tabledrag-handle-hover .handle{background-position:0 -20px;}.joined + .grippie{height:5px;background-position:center 1px;margin-bottom:-2px;}.teaser-checkbox{padding-top:1px;}div.teaser-button-wrapper{float:right;padding-right:5%;margin:0;}.teaser-checkbox div.form-item{float:right;margin:0 5% 0 0;padding:0;}textarea.teaser{display:none;}html.js .no-js{display:none;}.progress{font-weight:bold;}.progress .bar{background:#fff url(/misc/progress.gif);border:1px solid #00375a;height:1.5em;margin:0 0.2em;}.progress .filled{background:#0072b9;height:1em;border-bottom:0.5em solid #004a73;width:0%;}.progress .percentage{float:right;}.progress-disabled{float:left;}.ahah-progress{float:left;}.ahah-progress .throbber{width:15px;height:15px;margin:2px;background:transparent url(/misc/throbber.gif) no-repeat 0px -18px;float:left;}tr .ahah-progress .throbber{margin:0 2px;}.ahah-progress-bar{width:16em;}#first-time strong{display:block;padding:1.5em 0 .5em;}tr.selected td{background:#ffc;}table.sticky-header{margin-top:0;background:#fff;}#clean-url.install{display:none;}html.js .js-hide{display:none;}#system-modules div.incompatible{font-weight:bold;}#system-themes-form div.incompatible{font-weight:bold;}span.password-strength{visibility:hidden;}input.password-field{margin-right:10px;}div.password-description{padding:0 2px;margin:4px 0 0 0;font-size:0.85em;max-width:500px;}div.password-description ul{margin-bottom:0;}.password-parent{margin:0 0 0 0;}input.password-confirm{margin-right:10px;}.confirm-parent{margin:5px 0 0 0;}span.password-confirm{visibility:hidden;}span.password-confirm span{font-weight:normal;}
+
+
+ul.menu{list-style:none;border:none;text-align:left;}ul.menu li{margin:0 0 0 0.5em;}li.expanded{list-style-type:circle;list-style-image:url(/misc/menu-expanded.png);padding:0.2em 0.5em 0 0;margin:0;}li.collapsed{list-style-type:disc;list-style-image:url(/misc/menu-collapsed.png);padding:0.2em 0.5em 0 0;margin:0;}li.leaf{list-style-type:square;list-style-image:url(/misc/menu-leaf.png);padding:0.2em 0.5em 0 0;margin:0;}li a.active{color:#000;}td.menu-disabled{background:#ccc;}ul.links{margin:0;padding:0;}ul.links.inline{display:inline;}ul.links li{display:inline;list-style-type:none;padding:0 0.5em;}.block ul{margin:0;padding:0 0 0.25em 1em;}
+
+
+#permissions td.module{font-weight:bold;}#permissions td.permission{padding-left:1.5em;}#access-rules .access-type,#access-rules .rule-type{margin-right:1em;float:left;}#access-rules .access-type .form-item,#access-rules .rule-type .form-item{margin-top:0;}#access-rules .mask{clear:both;}#user-login-form{text-align:center;}#user-admin-filter ul{list-style-type:none;padding:0;margin:0;width:100%;}#user-admin-buttons{float:left;margin-left:0.5em;clear:right;}#user-admin-settings fieldset .description{font-size:0.85em;padding-bottom:.5em;}.profile{clear:both;margin:1em 0;}.profile .picture{float:right;margin:0 1em 1em 0;}.profile h3{border-bottom:1px solid #ccc;}.profile dl{margin:0 0 1.5em 0;}.profile dt{margin:0 0 0.2em 0;font-weight:bold;}.profile dd{margin:0 0 1em 0;}
+div.codeblock{padding:5px;border:1px solid #CCC;background-color:#EEE;}
+
+.ctools-locked{color:red;border:1px solid red;padding:1em;}.ctools-owns-lock{background:#FFFFDD none repeat scroll 0 0;border:1px solid #F0C020;padding:1em;}a.ctools-ajaxing,input.ctools-ajaxing,button.ctools-ajaxing,select.ctools-ajaxing{padding-right:18px !important;background:url(/sites/all/modules/ctools/images/status-active.gif) right center no-repeat;}div.ctools-ajaxing{float:left;width:18px;background:url(/sites/all/modules/ctools/images/status-active.gif) center center no-repeat;}
+.gam-banner{line-height:0;position:absolute;}.gam-holder{margin:0 auto;}.block-google_admanager{line-height:0;}
+#html5-user-geolocation-map{width:450px;height:250px;background:url(/sites/all/modules/html5_user_geolocation/world-map.png);position:relative;}#html5-user-geolocation-map-wrapper,#html5-user-geolocation-messages-wrapper .geolocating{display:none;}#html5-user-geolocation-map .dot{position:absolute;border:4px solid #064771;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;margin:-4px -4px -4px -4px;display:none;}
+
+
+#forum .description{font-size:0.9em;margin:0.5em;}#forum td.created,#forum td.posts,#forum td.topics,#forum td.last-reply,#forum td.replies,#forum td.pager{white-space:nowrap;}#forum td.posts,#forum td.topics,#forum td.replies,#forum td.pager{text-align:center;}#forum tr td.forum{padding-left:25px;background-position:2px 2px;background-image:url(/misc/forum-default.png);background-repeat:no-repeat;}#forum tr.new-topics td.forum{background-image:url(/misc/forum-new.png);}#forum div.indent{margin-left:20px;}.forum-topic-navigation{padding:1em 0 0 3em;border-top:1px solid #888;border-bottom:1px solid #888;text-align:center;padding:0.5em;}.forum-topic-navigation .topic-previous{text-align:right;float:left;width:46%;}.forum-topic-navigation .topic-next{text-align:left;float:right;width:46%;}
+
+
+.project table{width:auto;}.project tbody,.project tr{border:0;}.project td{vertical-align:top;padding:0.4em 0.1em;}.project .links{font-size:0.8em;}.project .author{color:#999;font-size:0.8em;}.project .downloads td{border-bottom:1px solid #ccc;padding-bottom:1em;}.project .downloads ul{margin:0px;}.project .downloads li{list-style-type:none;margin:0px;}.project-links-section div{float:left;padding-right:1.2em;width:30%;}#edit-project-goto{width:150px;}.node-form .project-taxonomy-element{float:left;padding-right:2em;}ul.project-terms{padding-left:1.5em;}.project-feed-icon{padding-left:1em;}
+
+
+.node-form .version-elements .form-item{float:left;padding-right:0.8em;margin:0.05em 0.1em;}table.releases{margin-top:.5em;}table.releases .release-title{width:15%;}table.releases .release-date{width:15%;}table.releases .release-size{width:10%;}table.releases .release-links{width:33%;}table.releases .release-status{width:25%;}table.releases .release-icon{width:2%;}.download-table h4{margin-bottom:0.67em;}.download-table-ok tr.odd,.download-table-ok tr.odd td.active,.download-table-ok tr.even,.download-table-ok tr.even td.active,table.releases tr.ok{background-color:#dfd;}.project-release tr.release-update-status-1,.download-table-warning tr.odd,.download-table-warning tr.odd td.active,.download-table-warning tr.even,.download-table-warning tr.even td.active,table.releases tr.warning{background-color:#ffd;}.project-release tr.release-update-status-2,.download-table-error tr.odd,.download-table-error tr.odd td.active,.download-table-error tr.even,.download-table-error tr.even td.active,table.releases tr.error{background-color:#fdd;}.view-project-release-download-table table{width:99%;}.view-project-release-download-table td.views-field-version{width:20%;}.view-project-release-download-table td.views-field-files{width:30%;}.view-project-release-download-table td.views-field-files span.filesize{font-size:80%;}.view-project-release-download-table td.views-field-file-timestamp{width:15%;}.view-project-release-download-table td.views-field-view-node{width:15%;}.view-project-release-download-table td.views-field-update-status{width:20%;}.project-release-files .views-field-filehash{color:#999;}
+
+
+
+#project-issue-summary-table{float:left;}#project-issue-summary-links{float:right;}#project-issue-summary-links li{background:none;list-style-type:none;margin-left:0;padding-left:0;}.project-issue .header{font-weight:bold;padding-top:0.5em;}.project-issue .summary table{border-collapse:collapse;width:auto;border:1px;border-style:solid;border-color:#eee;}.project-issue .summary table td{color:#333;background-color:transparent;font-size:90%;padding:0em 1em;border:0;}.project-issue tbody{border:0;}.project-issue .summary table tr{border:0;}.project-issue .node-form div.inline-options .form-item{float:left;padding-right:0.8em;margin:0.05em 0.1em;}.project-issue .node-form div.inline-options{overflow:hidden;}.project-issue .node-form div.inline-options:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.project-issue .node-form fieldset{display:inline-block;width:97%;}.project-issue .node-form #edit-pid,.project-issue .node-form #edit-project-info-pid{width:225px;}table.projects{width:100%;margin-bottom:3em;}table.projects .project-name{width:24%;}table.projects .project-issue-updated{width:15%;}table.projects .project-issues{width:11%;text-align:center;}table.projects .project-issue-links{width:28%;padding-left:0.4em;padding-right:0.4em;text-align:center;}table.projects .project-project-links{width:22%;text-align:center;}table.projects .project-project-links a{white-space:nowrap;}.project-issue .quick-search #edit-projects,.project-issue .quick-search #edit-states{width:150px;}.view-project-issues-project .form-item #edit-filter1,.view-project-issues-project-search .form-item #edit-filter1,#edit-filter2{width:150px;}.view-project-issues-project-search #views-filters{width:100%;overflow:auto;}.project-issue .quick-search tr td .form-item,.project-issue .quick-search tr td input{margin:0;padding:0;}.project-issue .quick-search tr td{vertical-align:bottom;}.project-issue-status-info a,.project-issue-status-info .project-issue-assigned-user{background-color:#cdcdcd;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;padding:2px 4px;}.project-issue-status-info .project-issue-assigned-user{white-space:nowrap;}.project-issue tr.state-1,.project-issue-status-1 a{background-color:#fff;}.project-issue tr.state-1 td.active{background-color:#e1e7eb;}.project-issue tr.state-2,.project-issue-status-2 a{background-color:#c0ffc0;}.project-issue tr.state-2 td.active{background-color:#cec;}.project-issue tr.state-3,.project-issue-status-3 a,.project-issue tr.state-4,.project-issue-status-4 a,.project-issue tr.state-5,.project-issue-status-5 a,.project-issue tr.state-6,.project-issue-status-6 a{background-color:#ddf;}.project-issue tr.state-3 td.active,.project-issue tr.state-4 td.active,.project-issue tr.state-5 td.active,.project-issue tr.state-6 td.active{background-color:#cce;}.project-issue tr.state-7,.project-issue-status-7 a{background-color:#ffc9c9;}.project-issue tr.state-7 td.active{background-color:#eeb9b9;}.project-issue tr.state-8,.project-issue-status-8 a{background-color:#ffd;}.project-issue tr.state-8 td.active{background-color:#eed;}.project-issue tr.state-13,.project-issue-status-13 a{background-color:#ffe7dd;}.project-issue tr.state-13 td.active{background-color:#eed7cc;}.project-issue tr.state-14,.project-issue-status-14 a{background-color:#e7ffdd;}.project-issue tr.state-14 td.active{background-color:#d7eecc;}.project-issue-numeric{text-align:center;}.project-issue-numeric-light{text-align:center;color:#999;}.project-issue-statistics-overview-table{overflow:auto;}.project-issue-status-2,.project-issue-status-3,.project-issue-status-5,.project-issue-status-6,.project-issue-status-7{text-decoration:line-through;}.wrapper-throbber{background:url(/misc/throbber.gif) no-repeat right -18px;width:20px;height:18px;margin-top:20px;float:left;}
+
+
+tr.pift-pass{background-color:#99FF99 !important;}tr.pift-fail{background-color:#FF9999 !important;}tr.pift-retest{background-color:#FFFF77 !important;}
+
+.views-exposed-form .views-exposed-widget{float:left;padding:.5em 1em 0 0;}.views-exposed-form .views-exposed-widget .form-submit{margin-top:1.6em;}.views-exposed-form .form-item,.views-exposed-form .form-submit{margin-top:0;margin-bottom:0;}.views-exposed-form label{font-weight:bold;}.views-exposed-widgets{margin-bottom:.5em;}html.js a.views-throbbing,html.js span.views-throbbing{background:url(/sites/all/modules/views/images/status-active.gif) no-repeat right center;padding-right:18px;}div.view div.views-admin-links{font-size:xx-small;margin-right:1em;margin-top:1em;}.block div.view div.views-admin-links{margin-top:0;}div.view div.views-admin-links ul{padding-left:0;}div.view div.views-admin-links li a{color:#ccc;}div.view div.views-admin-links li{padding-bottom:2px;z-index:201;}div.view div.views-admin-links-hover a,div.view div.views-admin-links:hover a{color:#000;}div.view div.views-admin-links-hover,div.view div.views-admin-links:hover{background:transparent;;}div.view div.views-admin-links a:before{content:"[";}div.view div.views-admin-links a:after{content:"]";}div.view div.views-hide{display:none;}div.view div.views-hide-hover,div.view:hover div.views-hide{display:block;position:absolute;z-index:200;}div.view:hover div.views-hide{margin-top:-1.5em;}.views-view-grid tbody{border-top:none;}
+
+
+
+html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{border:0;background:transparent;font-size:100%;margin:0;padding:0;vertical-align:baseline;}img{border:0;background:transparent;font-size:100%;padding:0;vertical-align:baseline;}body{line-height:1;}ol,ul{list-style:none;}blockquote,q{quotes:none;}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;}ins{text-decoration:none;}del{text-decoration:line-through;}table{border-collapse:collapse;border-spacing:0;}ul.primary,ul.primary li,ul.primary li.active,ul.secondary,ul.secondary li,ul.secondary li.active{display:inline;}ul.primary,ul.primary li,ul.primary li a,ul.primary li.active a,ul.secondary,ul.secondary li,ul.secondary li a,ul.secondary li.active,ul.secondary li.active a{margin:0;padding:0;border:none;background:none;}.item-list ul li{margin:0;padding:0;list-style:none;list-style-image:none;list-style-position:inherit;list-style-type:none;}.block ul{margin:0;padding:0;}
+
+
+.container-12{margin-left:auto;margin-right:auto;width:960px;}#homebox.column-count-3 .homebox-column-wrapper,.grid-1,.grid-2,.grid-3,.grid-4,.grid-5,.grid-6,.grid-7,.grid-8,.grid-9,.grid-10,.grid-11,.grid-12,.grid-footer{display:inline;float:left;margin-left:10px;margin-right:10px;position:relative;}[dir=rtl] #homebox.column-count-3 .homebox-column-wrapper,[dir=rtl] .grid-1,[dir=rtl] .grid-2,[dir=rtl] .grid-3,[dir=rtl] .grid-4,[dir=rtl] .grid-5,[dir=rtl] .grid-6,[dir=rtl] .grid-7,[dir=rtl] .grid-8,[dir=rtl] .grid-9,[dir=rtl] .grid-10,[dir=rtl] .grid-11,[dir=rtl] .grid-12,[dir=rtl] .grid-footer{float:right;}#homebox.column-count-3 .homebox-column-wrapper-1,.alpha{margin-left:0;}[dir=rtl] #homebox.column-count-3 .homebox-column-wrapper-1,[dir=rtl] .alpha{margin-left:10px;margin-right:0;}#homebox.column-count-3 .homebox-column-wrapper-3,.omega{margin-right:0;}[dir=rtl] #homebox.column-count-3 .homebox-column-wrapper-3,[dir=rtl] .omega{margin-right:10px;margin-left:0;}.grid-1{width:60px;}.grid-2{width:140px;}.grid-3{width:220px;}#homebox.column-count-3 .homebox-column-wrapper,.grid-4{width:300px;}.grid-5{width:380px;}.grid-6{width:460px;}.grid-7{width:540px;}.grid-8{width:620px;}.grid-9{width:700px;}.grid-10{width:780px;}.grid-11{width:860px;}.grid-12{width:940px;}.grid-footer{width:172px;}.clear{clear:both;}.clearleft{clear:left;}.clearright{clear:right;}img.right{clear:right;float:right;margin:0 0 0.692em 20px;}img.left{clear:left;float:left;margin:0 20px 0.692em 0;}img.no-clear{clear:none;}.clear-block:after{clear:both;content:".";display:block;font-size:0;height:0;visibility:hidden;}.clear-block{display:inline-block;}/*_\*/
+* html .clear-block{height:1%;}.clear-block{display:block;}/* End hide from IE/Mac */
+
+
+
+
+
+
+body{color:#222;background-color:#fff;font-size:0.8125em;}body,caption,th,td,input,textarea,select,option,legend,fieldset{font-family:"Lucida Grande","DejaVu Sans","Bitstream Vera Sans",Verdana,Arial,sans-serif;line-height:1.384615em;}h1,h2,h3,h4,.h1,.h2,.h3,.h4{color:#555;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:normal;line-height:1.5em;}h1,.h1{color:#000;font-size:1.846em;line-height:1.25em;margin:1.125em 0 0.375em;}#aggregator .feed-item-title,h2,.h2{font-size:1.615em;line-height:1.286em;margin:0.619em 0 0.238em;}.block h2{margin-top:0;}#profile .name,h3,.h3{font-size:1.231em;line-height:1.125em;margin:1.125em 0 0.563em;}h4,.h4,h5,.h5,h6,.h6{color:#000;font-size:1em;line-height:1.385em;font-weight:bold;}#content h4,#content .h4{margin:0.5em 0 0.166667em;}#content h5,#content .h5{margin:1em 0 0;}#content h6,#content .h6{margin:0.5em 0 0;}p{margin-bottom:0.692em;}a,a:link,a:visited,a:active{color:#0678BE;text-decoration:none;}a:hover,a:focus{color:#0678BE;text-decoration:underline;}code,tt,pre{background-color:#F6F6F2;font-family:"Bitstream Vera Sans Mono",Monaco,"Lucida Console",monospace;font-size:0.9230em;padding:1px;white-space:pre-wrap;}
+
+
+table{margin-bottom:0.5em;}thead th{border-bottom:0;padding:0.25em 0.5em;}th,td{padding:0.25em 0.5em;}th{background:#eaeae1;font-weight:bold;}th span.sort-header{float:left;}.table-sort-asc,.table-sort-desc{padding:0 14px 0 0;}.table-sort-asc{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:right -636px;}.table-sort-desc{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:right -600px;}th a,th a:link,th a:visited{color:#222;}th.active{background:#d7d7c7;}tr.even td.active{background:#e5e5d4;border-bottom:1px solid #D7D7C7;border-top:1px solid #D7D7C7;}tr.odd td.active{background:#eaeae1;}tr.even{background:#EEEEE0;border-bottom:1px solid #D8D8D2;border-top:1px solid #D8D8D2;position:relative;}tr.odd{background-color:#fff;border:0;border-bottom:1px solid #D8D8D2;position:relative;}#forum td > td{border:1px solid #f0f;}#forum ul{padding:0;}#forum .forum.first.last a{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 -415px;padding-left:15px;}#forum tr td.container{padding-left:10px;}#forum tr td.container .name{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 3px;padding:0px 0 5px 20px;min-width:20px;}#forum div.indent{margin-left:30px;}#forum tr td.forum{background:none;padding:0.25em 0.5em;}#forum tr td.forum .name{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 -155px;min-width:20px;}#forum tr td.forum .name,#forum .description{margin:0;padding:0 0 0 20px;}td.icon{margin:5px 0 0 0;}.icon16{width:16px;height:16px;display:block;}.forum-default,.forum-hot{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 -155px;}.forum-hot-new,.forum-new{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 -410px;}.forum-closed{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 -380px;}.forum-sticky{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 5px;}table.releases tr.ok td{background-color:#F9FFEC;border-bottom:1px solid #EAEAE1;}table.releases tr.release-dev td{background-color:#F6E8E8;border-bottom:1px solid #EBCCCC;}table.releases td{vertical-align:middle;}#content table.releases td ul.links{margin:0;padding:0;}table.releases td.release-icon{padding:0 5px;vertical-align:middle;}table.releases td.release-icon img{display:block;}table.project-issue td{}table tr.notrecommended td{background:#F6E8E8;border-bottom:1px solid #EBCCCC;}
+
+
+#project-solr-browse-projects-form .results-count{border-bottom:1px solid #DDDDDD;margin:0 0 1em 0;padding-bottom:0.5em;}
+
+
+
+
+
+#skip-links a,#skip-links a:link,#skip-links a:visited,#skip-links a:hover{height:1px;left:0;overflow:hidden;position:absolute;top:-500px;width:1px;}#skip-links a:active,#skip-links a:focus{position:static;height:auto;width:auto;}blockquote{background:#fff url(/sites/all/themes/bluecheese/images/blockquote-66.png) no-repeat 0 0;margin:1.384em 40px 1.384em 20px;padding-left:30px;}acronym{border-bottom:1px dotted #666;}sub{font-size:0.923em;text-align:sub;}small{font-size:0.923em;}#column-left{z-index:1;}#content-top-region,#content,#content-bottom-region,#column-right-region{margin-bottom:13px;}#header,#footer,#page{min-width:960px;}#header{background-color:#56B3E6;height:10.846153em;}#header-content{position:relative;z-index:2;height:6.69230769em;}body.drupalorg-front #header{height:22.153846em;}body.drupalorg-front #header-content{height:18em;}#drupalorg-site-status{background-color:#D32101;color:#FFF;padding:0.5em;text-align:center;position:relative;-moz-box-shadow:0 2px 2px 1px rgba(68,68,68,0.5);-webkit-box-shadow:0 2px 2px 1px rgba(68,68,68,0.5);box-shadow:0 2px 2px 1px rgba(68,68,68,0.5);z-index:1;}#drupalorg-site-status a{color:#FFF;text-decoration:underline;}h1#site-name{margin:0;}#site-name a{display:block;height:63px;overflow:hidden;text-indent:-999em;width:181px;}#site-name a:focus,#site-name a:active{outline:#FFF dotted thin;}#header-left h2{color:#FFF;font-size:1.6153em;font-weight:lighter;margin:24px 0 12px 0;}#header-left-inner a{color:#fff;}.standfirst{font-size:1em;height:6.15384em;line-height:1.538461em;margin-top:0.5em;overflow:auto;}#header-right-inner{margin-top:46px;}#page{margin-bottom:30px;}#page-subtitle{margin-top:0;}.breadcrumb{padding-bottom:0;}#page-tools{margin:0.692em 0 0;float:right;text-align:right;}#page-tools li{display:block;padding:0;}#page-tools a{color:#96BC44;}#footer{background-color:#F6F6F2;font-size:0.92307em;line-height:1.5em;padding:30px 0 20px;}#footer-region li.first a{color:#222;}#footer-region .grid-footer:hover li.first a,#footer-region li.first a:hover{color:#0678BE;}#footer-message{border-top:1px solid #E2E2DF;margin-top:50px;padding-top:10px;}#footer-message-inner{color:#666;text-align:center;}#search-theme-form{float:right;vertical-align:middle;}#edit-search-theme-form-1-wrapper{display:inline;margin-bottom:0;}#edit-search-theme-form-1{background-color:#FFF;border:3px solid #1885C8;color:#999;float:left;font-size:0.92307em;min-height:18px;line-height:1.61538em;margin:0 5px 0 0;padding:8px 10px 8px 30px;width:229px;}#edit-search-theme-form-1-wrapper input.has-value,body.front #edit-search-theme-form-1-wrapper input{color:#222;font-size:1.0769em;}#edit-search-theme-form-1:focus{outline:#E4E4E4 solid 2px;}#edit-search-theme-form-1-wrapper label{display:none;}.drupalorg-front #edit-search-theme-form-1-wrapper label{color:#FFF;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:1.61538em;font-weight:lighter;margin:0 0 .5em 0;}#search-theme-form-advanced{clear:left;display:none;float:left;margin-top:-3px;width:275px;}#search-theme-form-advanced fieldset{border:0;line-height:1.538461em;margin:0;padding:0;}.drupalorg-front #search-theme-form-advanced{display:block;margin:9px 0 0 3px;}#search-theme-form-advanced{display:none;}html.js #search-theme-form-advanced{display:block;}#search-theme-form-advanced fieldset.collapsible{background:url(/sites/all/themes/bluecheese/images/search-bottom.png) 0 100% no-repeat;border:0;margin:0;padding:0;padding-bottom:12px;}#search-theme-form-advanced fieldset.collapsed{background:transparent;}#search-theme-form-advanced fieldset.collapsible .fieldset-wrapper{background-color:#0678BE;padding:2em 10px 0;}#search-theme-form-advanced fieldset.collapsed .fieldset-wrapper{background-color:transparent;}#search-theme-form-advanced fieldset.collapsible .form-radios{border:0;color:#FFF;}html.js #search-theme-form-advanced fieldset.collapsible .fieldset-wrapper{overflow:visible;float:left;}#search-theme-form-advanced legend{margin:0;height:1.538461em;line-height:1.538461em;}#search-theme-form-advanced fieldset.collapsible legend{height:auto;position:absolute;right:0;top:4px;}#search-theme-form-advanced fieldset.collapsible legend a{color:#000;padding:0 16px 0 0;text-decoration:none;}#search-theme-form-advanced fieldset.collapsible legend a:hover{text-decoration:underline;}#search-theme-form-advanced fieldset.collapsible legend a:focus{outline:none;}#search-theme-form-advanced .form-radios,#search-theme-form-advanced .form-radios .form-item{margin:0;float:left;}#search-theme-form-advanced .form-radios{padding-top:0;width:275px;position:relative;}#search-theme-form-advanced fieldset.collapsible .form-radios{width:255px;}#search-theme-form-advanced .form-radios .form-item{min-height:1.538461em;width:135px;}#search-theme-form-advanced fieldset.collapsible .form-radios .form-item{font-size:0.923076em;width:127px;}#search-theme-form-advanced .form-radios .form-divider{float:left;width:127px;}#search-theme-form-advanced .form-radios .form-item input{margin:0;}#search-theme-form-advanced .form-radios label{color:#FFF;}#search-theme-form-submit{display:inline;margin-top:3px;}.page-search h1{background-color:#F6F6F2;color:#555555;font-size:1.38461em;padding:10px;}.page-search h1 em{font-style:normal;font-weight:bold;}.page-search #project-solr-browse-projects-form{background:none;margin-bottom:1em;padding:0;}.page-search #project-solr-browse-projects-form label{font-weight:normal;}.page-search #drupalorg-search-sort-form{margin-bottom:1em;}.page-search #drupalorg-search-sort-form .form-item{margin-top:0;}.page-search #edit-solrsort-wrapper label,.page-search #edit-solrsort-wrapper select{display:inline;font-weight:normal;margin:0 10px 0 0;}.page-search #edit-solrsort-wrapper{margin-right:0;}.search-results dd{padding-left:0;}.search-results .search-info{color:#666;font-size:0.92307em;}.search-results dt{font-size:1em;}.page-search #column-right .block{background:none;}.page-search #column-right .item-list ul{list-style-image:none;list-style-position:outside;list-style-type:none;margin-left:-10px;}.page-search #column-right .item-list ul li{list-style-type:none;margin-bottom:3px;margin-left:0;}#block-drupalorg_news-news-terms ul.links li a,.page-search #column-right .item-list ul li a{color:#0678BE;padding:0.153846em 0.384615em 0.230769em 1em;}.page-search #column-right .item-list ul li a.selected,.page-search #column-right .item-list ul li a:hover,#block-drupalorg_news-news-terms ul.links li a.active,#block-drupalorg_news-news-terms ul.links li a:hover,#block-drupalorg_news-news-terms ul.links li a:focus{background-color:#666;color:#fff;text-decoration:none;}.page-search #drupalorg-search-block-form .form-text{height:1.5em;width:150px;}.page-search #content-top-region form.drupalorgSearch-processed input[type=submit]{display:none;}#autocomplete{background-color:#FFF;}#content #autocomplete ul{padding-left:5px;}#content #autocomplete ul li{list-style-type:none;}div#page-title{margin-top:1.048em;}#nav-header{font-size:0.923076em;}#nav-header ul{background:#064771;float:right;padding:0 0.75em 0 0.75em;}#nav-header ul li{float:left;margin:0.333333em 0.833333em;}#nav-header ul li a{color:#FFF;}#nav-header ul li a:hover,#nav-header ul li a:focus{color:#A5E2FF;text-decoration:none;}#nav-masthead{display:block;float:left;position:relative;z-index:1;}#nav-masthead ul li{list-style:none;float:left;font-size:0.923076em;margin:0;padding:0 0.615384em;}#nav-masthead ul li a{color:#FFF;display:block;float:left;margin:0;padding:0.416666em .75em 0.416666em 0;text-decoration:none;}#nav-masthead ul li.active a,#nav-masthead ul li:hover a,#nav-masthead ul li:focus a{color:#000;}#userinfo{float:left;margin:5px 0 0 .75em;}#userinfo a{color:#FFF;font-size:0.92307em;margin:0 1em 0 0;text-decoration:none;}#nav-content ul{border-bottom:1px solid #DDD;float:left;margin-bottom:1.154em;width:100%;}#nav-content ul li{float:left;margin-bottom:-1px;padding:4px 12px 5px 12px;position:relative;}#nav-content ul li a:hover,#nav-content ul li a:focus,#nav-content ul li.active-parent a{color:#000;text-decoration:none;}#nav-content ul li.active,#nav-content ul li.active-parent{background-color:transparent;border:none;}#nav-content ul li.active a:hover,#nav-content ul li.active a:focus{text-decoration:none;}#nav-content li.active,#nav-content li.active-parent{padding:0 0 0 0.384615em;}#nav-content li.active a.active,#nav-content li.active-parent a{display:block;padding:0.307692em 0.692307em 0.846153em 0.230769em;}.ui-tabs-nav{width:100%;float:left;border-bottom:1px solid #BFBFBA;}.ui-tabs-nav li{float:left;padding:0 0 0 10px;position:relative;margin-bottom:-1px;}.ui-tabs-nav a{color:#27537A;display:block;float:left;height:25px;padding:6px 11px 0 0;}.ui-tabs-nav li.ui-tabs-selected a{color:#000;}.ui-tabs-nav li a:hover,.ui-tabs-nav li a:focus{text-decoration:none;}.ui-tabs-hide{display:none;}.ui-tabs-nav a:active{outline:none;}.ui-tabs-nav .icon{display:inline-block;height:13px;margin-right:3px;width:11px;}#content .ui-tabs-panel h6{margin:0;}#tabs{margin-bottom:20px;}#tabs ul.tabs{display:block;}#tabs ul.tabs li{float:left;margin-right:5px;}#tabs ul.tabs li a{color:#96BC44;display:block;float:left;}#tabs ul.tabs li a:hover,#tabs ul.tabs li a:focus{background:#96BC44;color:#FFF;text-decoration:none;}#tabs ul.tabs li.active{}#tabs ul.tabs li.active a{background:#96BC44;color:#FFF;}#tabs ul.tabs li.active a:hover,#tabs ul.tabs li.active a:focus{}#tabs ul.primary{height:23px;}#tabs ul.primary li{}#tabs ul.primary li a{padding:0.230769em 0.615384em;}#tabs ul.primary li.parent-active{}#tabs ul.primary li.parent-active a{background:#E6FCB6;height:20px;}#tabs ul.primary li.parent-active a:hover{background:#96BC44;}#tabs ul.secondary{background:#E6FCB6;font-size:0.92307em;height:22px;}#tabs ul.secondary li{}#tabs ul.secondary li a{height:20px;padding:2px 10px 0 10px;}#content ul,ol{margin-bottom:0.692em;padding-left:2em;}#content [dir=rtl] ul,[dir=rtl] ol{padding-left:0;padding-right:2em;}ol{list-style:decimal outside;}.block ol{list-style:none;padding-left:0;}#content .profile ul,#homebox ul,#homebox ol{margin-bottom:0;padding-left:0;}#content ul{list-style-type:disc;}#node-type-page #content ul{list-style-type:none;}#content .item-list ul.flat,#content .item-list ul.links,#content .item-list ul.flat li,#content .item-list ul.links li,#content ul.flat,#content ul.links,#content ul.flat li,#content ul.links li{list-style-type:none;list-style-image:none;margin-left:0;padding-left:0;}#content .node,#aggregator .feed-item{margin-bottom:1.385em;}#content .sticky{background-color:#F6F6F2;padding:10px;}#content .sticky h2.node-title{margin-top:0;}#content .comment h3.comment-title{word-spacing:0.2em;color:#888;margin-bottom:0;}#content .comment h3.comment-title a{word-spacing:normal;}#content .submitted,#content .modified,#aggregator .feed-item-meta,#content .comment .links{color:#666;font-size:0.923em;line-height:1.5em;margin-bottom:0.75em;}#content .comment .links{float:right;}#aggregator .feed-item-date{font-style:italic;}body.page-node #content .tabs{float:right;}body.page-node #content .tabs ul.tabs li{float:left;display:block;font-size:0.92307em;margin:0 5px;padding:1px 4px;text-decoration:none;}body.page-node #content .tabs ul.tabs li.active{display:none;}.feed-source,#content .node-footer,#aggregator .feed-item-categories,.user-signature,#block-drupalorg_handbook-license{color:#666;font-size:0.92307em;}#content .item-list .pager{padding:1em 0 0;text-align:left;}.item-list ul.pager li{margin:0;padding:0 5px;}.pager li.first{padding:0;}ul.pager a{color:#2E6AB1;}.pager li.pager-current{background-color:#2E6AB1;color:#FFF;}.forum-topic-navigation{margin-bottom:10px;}.book-navigation{clear:both;}.book-navigation ul.menu{border-top:1px solid #E1E1DB;display:block;padding-bottom:.5em;}.book-navigation .page-links{border-top:1px solid #E1E1DB;border-bottom:1px solid #E1E1DB;margin-bottom:20px;}#column-right .block{background:#F6F6F2;}#column-right .block-inner{padding:1em;}.profile .item-list li,#column-right .block .item-list li,#homebox .block .item-list li{line-height:1.2em;margin-bottom:0.6em;}.front .block-content h4{clear:both;font-weight:bold;}.front .block-content .front-get-started{border:1px solid #DDD;border-width:1px 0;margin:1em 0;padding:20px 0;text-align:center;}.front #content .block-content ul{list-style:none;padding-left:0;}#front-middle-inner .block-content{margin-top:1.846em;height:5.538461em;padding:1.385em 0 0 64px;}#front-drupal-stats{border-top:1px solid #EEE;color:#9D9D93;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:1.846em;font-weight:lighter;line-height:1.5em;padding-top:5px;padding-left:16px;}#front-drupal-stats em{font-style:normal;color:#55554A;}#block-project-5 p.date{color:#666;font-size:0.92307em;}#cvs ul{margin:0 0 0.5em 0;padding:0;}#cvs ul,#cvs li{list-style:none;}#cvs li div.title{color:#555;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:1em;font-weight:bold;margin:0 0 0.5em 0;}#cvs li div.files{margin:0 0 0.5em 0;}#cvs li div.description{border-bottom:1px solid #E1E1DB;margin:0 0 2em 0;padding:0 0 1em 0;}#block-cvs-cvs_project_maintainers div.cvs-commit-times{color:#666;font-size:0.92307em;margin-bottom:0.5em;}#block-cvs-cvs_project_maintainers span.cvs-commits{white-space:nowrap;}.block ul.menu{padding:0 0 0.25em 1em;}#block-user-1 .h2{overflow:hidden;}.node-type-project-issue .comment-inner{margin-left:40px;}.node-type-project-issue #content h3.comment-title{float:left;font-size:1.1538em;margin-left:-40px;}.node-type-project-issue #content .comment .submitted{padding-top:1.4em;}.node-type-project-issue #content .comment .submitted a{font-size:1.2307em;}.comment .new{background-color:#E6FCB6;padding:1px 6px 2px;}.comment .picture{float:left;margin:0 1.5em 1.5em 0;}.comment-with-picture .content{margin-left:5.5em;}.node .picture{float:right;margin:0 1.5em 1.5em 0;}.indented{margin-left:30px;}.indented .indented .indented .indented{margin-left:0;}dl{margin-bottom:0.692em;}dt{font-weight:bold;margin:0.692em 0 0;}dl.documentation{margin-bottom:0;}dl.documentation dt{font-size:1.23076em;margin-top:0.563em;}a.all{font-weight:bold;}.narrow-box{margin-bottom:18px;padding:18px;}.narrow-box ul{padding-left:0!important;}.narrow-box ul li{list-style-type:none;}.narrow-box a.link-button{margin:20px 0 15px 0;}.narrow-box a.link-button span{font-size:0.92307em;white-space:nowrap;}.narrow-box-list{margin-bottom:1.5em;}#getting-started img{float:left;}a.action-button{display:inline-block;color:#fff;background:#9fc748;padding:0.643em 1.5em;font-size:1.077em;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;}a.action-button:hover{text-decoration:none;background:#8aaf3c;}#download h2,#content .drupal-modules-facets h2{margin-top:0;}#download .core ul li.download-core{margin-bottom:1.5em;}#content li.more a,#content li.more a:link,#content li.more a:visited,#content li.more a:active,#content li.all a,#content li.all a:link,#content li.all a:visited,#content li.all a:active{font-weight:bold;}#project-solr-version-form{margin-bottom:1em;}#edit-drupal-core-wrapper,#project-solr-version-form label,#project-solr-version-form select,#project-solr-version-form .form-submit{float:left;font-weight:normal;margin:0 10px 0 0;}#edit-drupal-core-wrapper{margin-right:0;}#project-solr-version-form .form-submit{padding:0 3px;}.feed-item-categories a,.feed-item-categories a:link,.feed-item-categories a:visited,.terms a,.terms a:link,.terms a:visited{background-color:#EEE;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;color:#666;display:inline-block;margin:3px 0;padding:3px 5px;text-decoration:none;}.feed-item-categories a:hover,.feed-item-categories a:active,.feed-item-categories a:focus,.terms a:hover,.terms a:active,.terms a:focus{background-color:#999;color:#FFF;}div.codeblock{background-color:#F6F6F2;margin-bottom:.5em;}.meta{background:#fffbd9;border-color:#ffebc5;border-style:solid none;border-width:1px;color:#666;font-size:0.92307em;margin:0.5em 0 1em;padding:0.5em 1em;}#content .meta h5{margin:0;}#page ul ul li{margin-left:1em;}#content .meta ul{list-style-type:none;margin:0;padding:0;}.profile{clear:none;margin-top:0;margin-bottom:0.692em;}.profile.alpha{clear:left;}.profile h3{border-bottom:none;clear:left;}.profile dl{margin:0;}.profile dt{clear:left;margin:0 10px 0 0;}.profile dd{margin-bottom:0.692em;}.profile .picture{float:right;margin-top:6px;}a.link-button{color:#FFF;display:inline-block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:1.38461em;height:36px;overflow:hidden;padding-left:1em;text-align:center;}a.link-button:focus,a.link-button:active{outline:#000 dotted thin;}a.link-button:hover{text-decoration:none;}.link-button span{cursor:pointer;display:inline-block;line-height:36px;padding:0 1em 0 0;}input.default{color:#888;}div.help,div.messages,div.warning{border:none;min-height:1em;padding:1em 1em 1em 3.5em;}div.help a,div.messages a,div.warning a{font-weight:bold;}#content div.help ul,#content div.messages ul{margin-bottom:1em;margin-left:0;padding:0;}#content div.help ul li,#content div.messages ul li{margin-bottom:.25em;}div.help{background:rgb(205,228,242) url(/sites/all/themes/bluecheese/images/icon-help.gif) 10px 14px no-repeat;margin-bottom:20px;}div.help ul li{list-style-image:url(/sites/all/themes/bluecheese/images/bullet-dot-blue.png);}div.more-help-link{margin-bottom:.5em;}div.messages,div.warning{margin-bottom:10px;}div.messages-multiple{padding-bottom:0;padding-left:4.5em;}div.messages-status{background:rgb(212,239,204) url(/sites/all/themes/bluecheese/images/icon-success.png) 10px 14px no-repeat;}div.messages-status ul li{list-style-image:url(/sites/all/themes/bluecheese/images/bullet-dot-green.png);}div.messages-warning,div.warning{background:#E6FCB6 url(/sites/all/themes/bluecheese/images/icon-warning.gif) 10px 14px no-repeat;}div.messages-warning ul li{list-style-image:url(/sites/all/themes/bluecheese/images/bullet-dot-yellow.png);}div.messages-error{background:#EBCCCC url(/sites/all/themes/bluecheese/images/icon-error.png) 10px 14px no-repeat;}div.messages-error ul li{list-style-image:url(/sites/all/themes/bluecheese/images/bullet-dot-red.png);}div.warning{margin-top:20px;}span.warning{color:rgb(227,144,27);margin-left:.5em;}div.warning span.warning{display:none;}tr.drag-previous{background:#E6FCB6;}.image-tags span{background-color:#49A9E4;display:inline-block;font-size:.6em;line-height:18px;padding-left:4px;}.image-tags span a{color:#FFF;display:inline-block;line-height:18px;padding-right:4px;}.source-tags .source-tag-688{background-color:#9FCA44;}.source-tags .source-tag-689{background-color:#EEE;}.source-tags .source-tag-689 a{color:#666;}.image-tags span:hover{background-color:#044771;}.image-tags span:hover a{text-decoration:none;}.source-tags span.source-tag-688:hover{background-color:#688A1F;}.source-tags span.source-tag-689:hover{background-color:#999;}.source-tags .source-tag-689 a:hover{color:#FFF;}.feature-tags span{background-color:#EBE3A4;color:#000;}.feature-tags span a{color:#000;}.feature-tags span:hover{background-color:#E9B538;}.feature-tags span:hover a{color:#FFF;}h2 .image-tags span{margin-left:1em;}.aggregator-promote-link{text-align:center;width:120px;padding:2px 0;}.aggregator-promote-link a{color:#96BC44;}.aggregator-promote-link:hover{background-color:#96BC44;}.aggregator-promote-link a:hover{color:#FFF;text-decoration:none;}#block-drupalorg_news-news-terms .block-inner{padding-left:3px;}#column-right #block-block-40,#column-right #block-drupalorg-drupalorg_activity,#block-drupalorg_news-news-terms.block{background-color:#FFF;}#block-drupalorg_news-news-terms h2{margin-bottom:.5em;}#block-drupalorg_news-news-terms ul.links{margin-left:-10px;}#block-drupalorg_news-news-terms ul.links li{display:list-item;margin-bottom:4px;}#about-features h3{font:bold 1em "Lucida Grande",Helvetica,Arial,sans-serif;text-transform:uppercase;}#about-features h3 a{display:block;padding:4px 0 0 70px;min-height:50px;}.node-section{border-bottom:1px solid #D8D8D2;padding-bottom:0.692em;}.comment{margin-top:0.692em;border-top:1px solid #D8D8D2;}.node-footer-section h3{margin:1em 0 .5em;}.aboutsmall{color:#555;font-size:0.92307em;}#content .aboutsmall ul{list-style:none;margin-bottom:1.5em;padding-left:0;}.aboutsmall dd{padding-left:0;}.aboutsmall h3{border-top:1px solid #DDD;margin-top:1em;padding-top:1em;}.aboutsmall .link-button{float:left;margin:1em 0;}.aboutsmall strong,.aboutsmall dt{color:#555;}.drupalorg-front #page{margin-top:1.385em;}.homepage-map{background:url(/sites/all/themes/bluecheese/images/world-map.png);height:250px;position:relative;width:450px;white-space:nowrap;}.homepage-map .homepage-pin{position:absolute;width:10px;height:10px;display:none;margin:0 0 -5px -5px;}.homepage-map .homepage-pin .latitude,.homepage-map .homepage-pin .longitude{display:none;}.homepage-map .homepage-pin .content{background:#fff;position:absolute;border:1px solid #bfbfba;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;padding:1px 4px;bottom:11px;}.homepage-map .homepage-pin-east .content{right:-40px;}.homepage-map .homepage-pin-west .content{left:-40px;}.homepage-map .homepage-pin .content:after{content:' ';display:block;position:absolute;width:12px;height:10px;bottom:-10px;background:url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat 0 -734px;}.homepage-map .homepage-pin-east .content:after{right:39px;}.homepage-map .homepage-pin-west .content:after{left:37px;}.homepage-map .drupalcon a{font-weight:bold;color:#d32101;}div.things-we-made-wrapper{width:300px;overflow:hidden;margin:0 0 1em 0;}#project-overview .project{border-bottom:1px solid #E1E1DB;margin-bottom:20px;padding-bottom:20px;}#project-overview .image-attach-teaser{float:right;margin:0 0 20px 20px;}#project-overview .image-attach-teaser img{border:1px solid #9D9D93;display:block;}#project-overview ul.project-meta li{color:#666;font-size:0.92307em;margin-bottom:0;}#project-overview .links{font-size:1em;}#content #project-overview .project ul,#content #project-overview .project ol{overflow:auto;}#project-solr-browse-projects-form{background-color:#F6F6F2;margin:0 0 20px 0;padding:10px;}#project-solr-browse-projects-form .form-item,#project-solr-browse-projects-form #edit-submit,#project-solr-browse-projects-form #edit-submit-2{float:none;}#project-solr-browse-projects-form #edit-submit,#project-solr-browse-projects-form #edit-submit-2{margin-bottom:0;}#project-solr-browse-projects-form .form-item>*{display:inline;}.project-links-section div{margin:1em 0;}#content .project-links-section ul{margin-left:0;padding-left:0;}body .project-issue tr.odd,body .project-issue tr.even{background:none;border:none;}table{border-collapse:separate;}.project-issue tr td,.project-issue tr td.active{background-color:#F9F9F9;border-bottom:1px solid #D8D8D2;border-top:2px solid #CCC;}.project-issue tr td.active{background-color:#FFF;border-top:2px solid #939393;}.project-issue tr.state-1 td{background-color:#F9F9F9;border-top:2px solid #ccc;}.project-issue tr.state-1 td.active{background-color:#FFF;border-top:2px solid #939393;}.project-issue tr.state-2 td{background-color:#D7FFD8;border-top:2px solid #A8FF98;}.project-issue tr.state-2 td.active{background-color:#EDFFEC;border-top:2px solid #96bc44;}.project-issue tr.state-3 td,.project-issue tr.state-4 td,.project-issue tr.state-5 td,.project-issue tr.state-6 td,.project-issue tr.state-16 td{background-color:#EFF1FE;border-top:2px solid #B5C4FE;}.project-issue tr.state-3 td.active,.project-issue tr.state-4 td.active,.project-issue tr.state-5 td.active,.project-issue tr.state-6 td.active,.project-issue tr.state-16 td.active{background-color:#F2F4FE;border-top:2px solid #4988FE;}.project-issue tr.state-7 td,.project-issue tr.state-18 td{background-color:#FDDDDD;border-top:2px solid #FC8596;}.project-issue tr.state-7 td.active,.project-issue tr.state-18 td.active{background-color:#FDEBED;border-top:2px solid #FC2843;}.project-issue tr.state-8 td{background-color:#FFFFDD;border-top:2px solid #FFCF73;}.project-issue tr.state-8 td.active{background-color:#FEFFEC;border-top:2px solid #FFB404;}.project-issue tr.state-13 td{background-color:#FFECE8;border-top:2px solid #FFDCCD;}.project-issue tr.state-13 td.active{background-color:#FFF6F6;border-top:2px solid #FFBCA4;}.project-issue tr.state-14 td,.project-issue tr.state-15 td{background-color:#F1FFE8;border-top:2px solid #BCFFB3;}.project-issue tr.state-14 td.active,.project-issue tr.state-15 td.active{background-color:#F8FFF1;border-top:2px solid #93FF88;}#block-project_issue-issue_cockpit .block-inner,#block-cvs-cvs_project_maintainers .block-inner{margin:0;}#block-project_issue-issue_cockpit .block-content,#homebox-block-project_issue_issue_cockpit .portlet-content{color:#888;}form#project-issue-issue-cockpit-searchbox,.issue-cockpit-categories,.issue-cockpit-subscribe,.issue-cockpit-statistics,.issue-cockpit-oldest{color:#222;}form#project-issue-issue-cockpit-searchbox{margin-bottom:0.5em;margin-top:0.5em;}form#project-issue-issue-cockpit-searchbox .form-item{float:left;margin:0 10px 0.5em 0;}form#project-issue-issue-cockpit-searchbox a{clear:left;display:block;}#block-project_issue-issue_cockpit .category-header,#homebox-block-project_issue_issue_cockpit .category-header{color:#555;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:1.2307em;font-weight:normal;margin-top:0.5em;}.issue-cockpit-bug,.issue-cockpit-statistics{margin-bottom:0.5em;}.issue-cockpit-oldest{color:#888;}.view-project-issue-user-issues div.project-title{font-weight:bold;}#homebox #homebox-block-views_a512ec6dea837b33a2b010c2af17ed85 .portlet-content{padding:0;}#homebox .homebox-portlet .view-project-issue-user-issues .more-link{padding:0px 10px 10px 0px;}#homebox #homebox-block-views_a512ec6dea837b33a2b010c2af17ed85 th{display:none;}#homebox #homebox-block-views_a512ec6dea837b33a2b010c2af17ed85 td{padding:0.25em 10px;}.project-info .count{font-weight:bold;}#homebox .homebox-column{background:none;margin:0;padding:0;}#homebox .homebox-portlet{border:0;margin:0 0 20px;}#homebox .homebox-placeholder{margin:0 0 14px;}#homebox .homebox-portlet .homebox-portlet-inner{background-color:#F6F6F2;border:0;}#homebox .portlet-config{padding:0 10px 10px;}#homebox .portlet-content{padding:10px;}#homebox .homebox-portlet .portlet-header{background:none;font-size:1.38461em;padding:10px 10px 8px;}#homebox .homebox-portlet .portlet-minus,#homebox .homebox-portlet .portlet-maximize{display:none;}#homebox .homebox-portlet .portlet-icon{margin-top:4px;margin-left:4px;}#homebox-buttons,#homebox-add{margin-bottom:10px;}#homebox-add a.restore{display:inline;height:auto;padding:0;width:auto;}#drupalorg-set-home a,html.js #drupalorg-set-home input{display:none;}html.js #drupalorg-set-home a{display:inline;}#drupalorg-set-home .ahah-progress{float:right;}#drupalorg-search-help-form{background-color:#F6F5F1;margin-bottom:20px;padding:20px 20px 15px 20px;}#drupalorg-search-help-form label{font-size:1.61538em;font-weight:normal;margin:0 0 1em 0;}#drupalorg-search-help-form .form-text{background:#FFFFFF url(/sites/all/themes/bluecheese/images/throbber-large.gif) 231px 8px no-repeat;border:2px solid #c8c9c4;color:#858585;font-size:1.61538em;height:35px;margin:0 0 5px 0;padding:0 30px 0 5px;width:221px;}#drupalorg-search-help-form .form-text.throbbing{background:#FFFFFF url(/sites/all/themes/bluecheese/images/throbber-large.gif) 231px -92px no-repeat;}#edit-search-term-results p.help-result-text{font-weight:bold;margin-left:10px;}#edit-search-term-results ul{list-style-type:none;margin:0 0 5px 0;padding:0;}#edit-search-term-results ul a{font-weight:bold;}#edit-search-term-results li .help-result-value{border-top:1px solid #E1E1DB;line-height:2em;list-style-type:none;margin:0;padding:0 0 0 10px;}#recent-activity ul{margin-left:0;padding-left:0;}#page .block-google_admanager{background-color:#f6f6f2;line-height:inherit;}.gam-holder{margin:0 0 1em;}.gam-prefix,.gam-suffix{padding:12px;}.gam-suffix{color:#666;font-size:0.92307em;}.gam-suffix a{color:#000;}.gam-holder .text{background-color:#f6f6f2;width:274px;line-height:1.5em;padding:13px;}.gam-holder .text a{font-weight:bold;}#column-right .block-google_admanager{margin:12px 0 12px 0;}#column-right .block-google_admanager .block-inner{padding:0;}.front-current-activity{float:left;margin-bottom:1.385em;}.front-current-activity:first-child{margin-right:1.5em;}.front-current-activity td{padding:0;white-space:nowrap;}.front-current-activity td:first-child{text-align:right;padding-right:0.4em;}.front-current-activity th{background:transparent;font-weight:normal;border-bottom:none;padding:0;}body.front .gam-holder{margin:1.385em 0 0 0;}#block-google_admanager-89caa04f148acdc52719b3d001e487c4 .gam-prefix h3{margin-top:0;}#block-google_admanager-89caa04f148acdc52719b3d001e487c4 .gam-prefix p{margin-bottom:0;}#google_ads_div_Security_books img,#google_ads_div_Redesign_books img{padding:0 12px;}.view-drupalorg-community-spotlight.view-display-id-block_1 .node-footer .links{display:block;}.view-drupalorg-community-spotlight.view-display-id-block_1 .node-footer .separator{display:none;}#block-drupalorg_search-drupalorg_search_users form,#block-drupalorg_search-drupalorg_search_users .form-item{margin:0;}#block-drupalorg_search-drupalorg_search_users .form-text{width:150px;}.drupalorg-front #header-screen{background:url(/sites/all/themes/bluecheese/images/fireworks.png) 5% 0 no-repeat;}.link-button span.celebrating{display:inline-block;margin-left:-1em;padding:0 0 0 1em;background:url(/sites/all/themes/bluecheese/images/fireworks-link-button.png) 0 0 no-repeat;}
+
+
+
+div.block-region{background:none;border:2px dashed #53B0EB;color:#53B0EB;font-size:1.0769em;margin:10px 0;padding:10px;}.views-tabs .ui-tabs-nav li,.views-tabs .ui-tabs-nav a{float:none;}#content .views-tabs ul.ui-tabs-nav{padding-left:0;}
+
+
+
+#content .node-footer a.comment_comments,#content .node-footer a.comment_add,html.js #search-theme-form-advanced fieldset.collapsible legend a,div.nav-content-dashboard ul li.active span.hover a.edit span,div.nav-content-dashboard ul li.active span.hover a.delete,#page-tools a.add,#dashboard a.remove-widget,.meta .alert,.project-info .alert,.rss-feed-link,.search-results .search-info .comments,.portlet-header .portlet-settings,.portlet-plus,.portlet-minus,.portlet-close,.portlet-maximize,.portlet-maximized .portlet-minimize{background-image:url(/sites/all/themes/bluecheese/images/small-icons.png);background-repeat:no-repeat;}#content .node-footer a.comment_comments,#content .node-footer a.comment_add{background-position:0 -415px;padding-left:15px;}html.js #search-theme-form-advanced fieldset.collapsible legend a{background-position:100% -473px;}div.nav-content-dashboard ul li.active span.hover a.edit span{background-position:8px -61px;padding-left:20px;}div.nav-content-dashboard ul li.active span.hover a.delete{background-position:8px -125px;height:12px;padding-left:20px;}#dashboard a.remove-widget{background-position:0 -128px;height:12px;padding-left:12px;}#page-tools a.add{background-position:right -188px;padding-right:18px;}.meta .alert{background-position:0 -225px;padding-left:14px;}.project-info .alert{background-position:0 -223px;padding-left:16px;}.rss-feed-link{background-position:0 -30px;padding-left:20px;}.search-results .search-info .comments{background-position:0 -415px;padding-left:14px;}.portlet-header .portlet-settings{background-position:2px -64px;}.portlet-plus{background-position:2px -192px;}.portlet-close{background-position:2px -128px;}.page-search #column-right .item-list ul li,#block-drupalorg_news-news-terms ul.links li{line-height:1.5em;}.page-search #column-right .item-list ul li a.selected,.page-search #column-right .item-list ul li a:hover,#block-drupalorg_news-news-terms ul.links li a.active,#block-drupalorg_news-news-terms ul.links li a:hover,#block-drupalorg_news-news-terms ul.links li a:focus{background-image:url(/sites/all/themes/bluecheese/images/pointer.png);background-repeat:no-repeat;background-position:0 center;}#edit-search-theme-form-1,#aboutwebbased a,#aboutcontentmanagement a,#aboutmodules a,#aboutthemes a,#aboutsearching a,#aboutsocial a,#aboutcommunity a,#aboutpersonalisation a{background:#fff url(/sites/all/themes/bluecheese/images/large-icons.png) no-repeat;}#edit-search-theme-form-1{background-position:8px -856px;}#aboutwebbased a{background-position:4px 0;}#aboutcontentmanagement a{background-position:4px -96px;}#aboutmodules a{background-position:4px -192px;}#aboutthemes a{background-position:4px -288px;}#aboutsearching a{background-position:4px -384px;}#aboutsocial a{background-position:4px -480px;}#aboutcommunity a{background-position:4px -576px;}#aboutpersonalisation a{background-position:4px -1056px;}#header{background-image:url(/sites/all/themes/bluecheese/images/sprites-horizontal.png);background-repeat:repeat-x;}#header{background-position:0 -1088px;}body.drupalorg-front #header{background-position:0 0;}#site-name a,#nav-content li.active,#nav-content li.active a.active,#nav-content li.active-parent,#nav-content li.active-parent a,#nav-masthead li,#nav-masthead li a,.ui-tabs-nav li.ui-tabs-selected,.ui-tabs-nav li.ui-tabs-selected a,.ui-tabs-nav .icon,a.link-button,a.link-button span,#front-middle-inner .block-content,.homepage-pin,.image-tags span,.image-tags span a{background-image:url(/sites/all/themes/bluecheese/images/sprites.png);background-repeat:no-repeat;}#site-name a{background-position:0 -467px;}.homepage-pin-doc{background-position:-22px -753px;}.ui-tabs-docs-updates .icon{background-position:-22px -750px;}.homepage-pin-forum{background-position:-11px -753px;}.ui-tabs-forum-posts .icon{background-position:-11px -750px;}.homepage-pin-commit{background-position:0 -753px;}.ui-tabs-commits .icon{background-position:0 -750px;}#nav-content li.active,#nav-content li.active-parent,.ui-tabs-nav li.ui-tabs-selected{background-position:0 -1300px;}#nav-content li.active a.active,#nav-content li.active-parent a,.ui-tabs-nav li.ui-tabs-selected a{background-position:100% -1200px;}#nav-masthead li a{background-position:100% -800px;}#nav-masthead li{background-position:0 -900px;}#nav-masthead li.active a,#nav-masthead li:hover a{background-position:100% -1000px;}#nav-masthead li.active,#nav-masthead li:hover{background-position:0 -1100px;}a.link-button{background-position:0 -48px;}a.link-button span{background-position:100% 0;}#front-middle-inner .block-content{background-position:0 -537px;}.image-tags span{background-position:0 -224px;}.image-tags a{background-position:100% -192px;}.feature-tags span{background-position:0 -288px;}.feature-tags a{background-position:100% -256px;}.sticky .image-tags span{background-position:0 -352px;}.sticky .image-tags a{background-position:100% -320px;}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/form-field-tooltip.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/form-field-tooltip.css
new file mode 100644
index 00000000..24b40da9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/form-field-tooltip.css
@@ -0,0 +1,12 @@
+#DHTMLgoodies_formTooltipDiv{
+ color:#000000;
+ font-family:arial;
+ font-weight:bold;
+ font-size:0.8em;
+ line-height:120%;
+}
+.DHTMLgoodies_formTooltip_closeMessage{
+ color:#000000;
+ font-weight:normal;
+ font-size:0.7em;
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/mobile_raptor.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/mobile_raptor.css
new file mode 100644
index 00000000..b47fc431
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/mobile_raptor.css
@@ -0,0 +1,73 @@
+#reportContainer {text-align:center;margin-bottom:5px;}
+
+#chartContainer {-webkit-border-radius:5px;margin-bottom:5px;}
+
+#reportTitleContainer {
+ background-color: rgb(57,91,162);
+ padding:8px 5px 0px 10px;
+ font-family:Helvetica;
+ color:#fff;
+ -webkit-border-top-left-radius: 5px;
+ -webkit-border-top-right-radius: 5px;
+}
+
+#reportTitle,#eventTitle{
+ font-size:15px;
+ font-weight:bold;
+ text-align:left;
+}
+
+#reportSubTitleContainer{
+ font-family:Helvetica;
+ font-weight:bold;
+ color:rgb(255,255,102);
+ padding:2px 10px 3px 10px;
+ background-color: rgb(57,91,162);
+}
+
+#reportFooter{
+ background-color: rgb(57,91,162);
+ -webkit-border-bottom-left-radius: 5px;
+ -webkit-border-bottom-right-radius: 5px;
+}
+
+.reportHeadRow {
+ background-color: rgb(57,91,162);
+ border-top:1px solid rgb(148,175,222);
+ border-bottom:1px solid rgb(148,175,222);
+}
+
+.reportHeadCell {
+ font-family:Helvetica;
+ font-weight:bold;
+ font-size:12px;
+ height:20px;
+}
+
+.rcolheader{
+ font-family:Helvetica;
+ font-size:13px;
+ color:#fff;
+}
+
+.reportRow {
+ border-top: 1px solid solid rgb(109,132,162);
+ background-color: rgb(112,137,193);
+}
+
+.reportAltRow {
+ border-top: 1px solid solid rgb(109,132,162);
+ background-color: rgb(57,91,162);
+}
+
+.reportCell {
+ padding-left:3px;
+ padding-right:3px;
+ padding-top:10px;
+ padding-bottom:10px;
+ font-family:Helvetica;
+ font-size:13px;
+ color:#fff;
+}
+
+.reportCellLink {font-family:Helvetica;font-size:13px;color:#fff;word-break:break-all} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/novamap.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/novamap.css
new file mode 100644
index 00000000..7bbf4bf5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/novamap.css
@@ -0,0 +1,25 @@
+@CHARSET "ISO-8859-1";
+
+.buttondefault {
+ background: lightgrey;
+ border-left: 2px lightgrey solid;
+ border-top: 2px lightgrey solid;
+ border-right: 2px gray solid;
+ border-bottom: 2px gray solid;
+}
+
+.buttonover {
+ cursor: hand;
+ background: #F0F8FF;
+}
+
+.buttonout {
+ background: lightgrey;
+}
+
+.buttonclick {
+ border-left: 2px gray solid;
+ border-top: 2px gray solid;
+ border-right: 2px white solid;
+ border-bottom: 2px white solid;
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/picker.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/picker.css
new file mode 100644
index 00000000..bbc439ec
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/picker.css
@@ -0,0 +1,40 @@
+.picker_layer {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ text-decoration: none;
+ background-color: #d4d0c8;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #666666;
+ overflow: visible;
+ height: auto;
+ width: auto;
+}
+.picker_buttons {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ background-color:#d4d0c8;
+ border-style:solid;
+ border-color:#666666;
+ border-width:1px;
+ padding:1px;
+ cursor:pointer;
+ color:#000000;
+}
+.cell_color {
+ cursor:pointer;
+ width:9px;
+ height:9px;
+}
+.color_table {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ text-decoration: none;
+}
+.choosed_color_cell{
+ border-style:solid; border-color:#000000; border-width:1px;
+}
+.default_color_btn{
+ width:17px; height:17px; background-image:url(defaultcolor.jpg);
+ background-repeat:no-repeat; background-position:center;
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/ral.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/ral.css
new file mode 100644
index 00000000..4e45ddca
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/ral.css
@@ -0,0 +1,1437 @@
+/*
+Reusable Asset Library - CSS Positioning Version (v3.2)
+Release Date: 1/26/07
+Core Styles
+*/
+
+/*------------------------General-----------------------------------*/
+body{
+background:#FFF;
+font-family:Arial,Verdana,Geneva,Helvetica,sans-serif;
+font-size:.71em;
+padding:0;
+margin:0px;
+margin-right:1px;
+border:0;
+}
+.nested{
+border:0;
+padding:0;
+margin:0;
+}
+.btm{
+vertical-align:bottom !important;
+}
+.nowrap{
+white-space:nowrap;
+}
+.top, .top td{
+vertical-align:top !important;
+}
+table{ /*IE5.5 hack*/
+font-size:100%;
+}
+td,tr,th{ /*IE5.5 hack*/
+font-size:inherit;
+}
+.hide{
+display:none !important;
+}
+.mid {
+vertical-align:middle !important;
+}
+.value {
+text-align:right;
+}
+.show{
+display:block !important;
+}
+ul{
+padding:0;
+margin:0;
+border:0;
+}
+.indent{
+margin-left:10px !important;
+}
+.code{
+font-family: Courier,serif;
+}
+p{
+padding:5px 0;
+margin:0;
+border:0;
+}
+h1{
+font-size:150%;
+margin:2px 0px;
+display:block;
+position:relative;
+clear:both;
+}
+h2{
+font-size:130%;
+margin:2px 0px;
+clear:both;
+position:relative;
+display:block;
+}
+h2.blue{
+position:relative;
+top:0;
+left:0;
+font-size:100%;
+background:#369;
+color:#FFF;
+margin:0;
+margin-top:10px;
+padding:2px 5px 2px 8px;
+height:14px;
+width:auto;
+vertical-align:middle;
+}
+h3{
+font-size:120%;
+clear:both;
+margin:2px 0px;
+position:relative;
+display:block;
+}
+h4 {
+font-size:100%;
+clear:both;
+margin:2px 0px;
+position:relative;
+display:block;
+}
+
+/*----------------------Horizontal Rules----------------------------*/
+.hrule-blue {
+height:1px;
+border-top:1px #369 solid;
+margin-top:6px;
+margin-bottom:2px;
+line-height:0px;
+padding:0;
+clear:both;
+}
+hr{
+border:0;
+height:1px;
+margin:10px 0;
+background:#CCC;
+width:100%;
+clear:both;
+}
+
+/*--------------Primay Window Banner--------------------------------*/
+#tBAN{
+padding:0;
+border:0;
+margin:0;
+position:relative;
+background:no-repeat url(../images/swoosh.gif) 100% 0;
+min-width:800px;
+display:table; /*For vertical centering in standards complaint browsers*/
+height:69px;
+overflow-x:hidden; /*Remove horizonal scroll in IE*/
+}
+#banner-spacer{
+display:block;
+width:650px;
+height:1px;
+position:relative;
+top:-1px;
+}
+#tBAN #logo{
+border:0;
+padding:0;
+margin:0;
+top:10px;
+position:absolute;
+}
+#tBAN #company {
+color:#FFF;
+font-weight:bold;
+font-size:10pt;
+padding-right:10px;
+_position:absolute; /*IE Hack for vertical centering*/
+_top:48%; /*IE Hack for vertical centering*/
+display:table-cell; /*For standards complaint browsers*/
+vertical-align:middle; /*For standards complaint browsers*/
+text-align:right;
+width:99%;
+}
+#tBAN #txt{
+_position:relative; /*IE Hack for vertical centering*/
+_top:-48%; /*IE Hack for vertical centering*/
+width:205px;
+float:right;
+overflow:hidden;
+}
+#appName{
+position:absolute;
+left:112px;
+top:45px;
+color:#09C;
+font-size:11pt;
+font-weight:bold;
+white-space:nowrap;
+}
+
+/*---------------------Secondary Window Banner----------------------*/
+#tSWB{
+background:#FFF;
+height:69px;
+border-bottom:2px #369 solid;
+}
+#tSWB #appName{
+top:35px;
+}
+
+
+/*--------------------Secondary Windows (General)-------------------*/
+.pHW{
+background:#FFC;
+}
+.pSW{
+background:#FFF;
+}
+.pSW .tPH,.pHW .tPH{
+margin:0;
+}
+/*--------------------mIC: Introductory Copy------------------------*/
+p.mIC{
+padding:0;
+margin:0;
+}
+
+/*-----------------------mQH: Quick Help----------------------------*/
+.qh-link{
+float:right;
+width:12px;
+height:14px;
+background:url(../images/quickhelp_lt.gif) no-repeat 0 50%;
+cursor:pointer;
+position:relative;
+vertical-align:middle;
+}
+.qh-link-field{
+width:12px;
+height:12px;
+background:url(../images/quickhelp_lt.gif) no-repeat 0px 0px;
+cursor:pointer;
+position:relative;
+top:0px;
+}
+.qh-element{
+margin-left:5px;
+vertical-align:middle;
+}
+.icon-quick-help{
+display:inline;
+}
+.mQH {
+clear:both !important;
+display:none;
+background:#9CF !important;
+margin:0 !important;
+border:0 !important;
+height:auto !important;
+padding:4px 8px !important;
+position:relative !important;
+z-index:0;
+}
+.mQH .label{
+font-weight:bold;
+padding-right:5px;
+}
+
+/*----------------------bPF: Footer---------------------------------*/
+#bPF{
+position:relative;
+bottom:0px;
+display:block;
+/*float:none;*/
+height:60px;
+clear:both;
+padding:25px 0 20px 10px;
+line-height:100%;
+color:#333;
+white-space:nowrap;
+}
+#bPF ul{
+position:relative;
+top:0px;
+left:0px;
+margin:0 !important;
+padding:0 !important;
+margin-left:0px !important;
+}
+#bPF li{
+display:inline;
+}
+#bPF .pipe{
+padding-right:5px;
+padding-left:5px;
+}
+
+/*---------------------------LAYOUT---------------------------------*/
+#grid{
+display:block;
+clear:both !important;
+height:50%;
+width:auto;
+position:relative;
+width:95%;
+min-width:800px;
+margin-left:10px;
+z-index:10;
+}
+.grid-secondary{
+margin-top:10px;
+margin-left:10px;
+width:95%;
+position:relative;
+}
+
+/* One column-------------------------------------------------------*/
+.one-col .col1 {
+width:95%;
+}
+.one-col .col2 {
+display:none;
+}
+.one-col .col3 {
+display:none;
+}
+
+/* Two column, wide left:------------------------------------------*/
+.two-col-wl .col1 {
+width:75%;
+float:left;
+}
+.two-col-wl .col2 {
+width:15%;
+float:left;
+margin-left:10px;
+}
+.two-col-wl .col3 {
+display:none;
+}
+
+/* Two column, wide right:------------------------------------------*/
+.two-col-wr .col1 {
+width:15%;
+float:left;
+}
+.two-col-wr .col2 {
+width:75%;
+float:left;
+margin-left:10px;
+}
+.two-col-wr .col3 {
+display:none;
+}
+
+/* Three column-----------------------------------------------------*/
+.three-col .col1 {
+width:15%;
+float:left;
+min-width:140px;
+}
+.three-col .col2 {
+width:60%;
+float:left;
+margin-left:10px;
+}
+.three-col .col3 {
+width:15%;
+float:left;
+margin-left:10px;
+min-width:140px;
+}
+
+
+/*---------------------------Forms----------------------------------*/
+.first-row td{
+padding-top:5px !important;
+}
+.last-row td{
+padding-bottom:5px !important;
+}
+.checkbox{
+height:13px;
+width:13px;
+vertical-align:middle;
+padding:0;
+margin:0;
+margin-right:10px;
+text-align:center !important;
+}
+.col-ast{
+width:10px !important;
+}
+.col-ast div,.col-ast img{
+width:9px;
+height:14px;
+}
+.form-grid td {
+padding:5px 0;
+vertical-align:middle;
+}
+.form-grid label.twoline,
+label.br {
+display:block;
+}
+
+
+.inline{ /*When multiple text input fields */
+margin-right:10px !important; /*are adjacent, space them out!!*/
+}
+label{
+white-space:nowrap;
+margin-right:15px;
+vertical-align:middle;
+}
+.noborder{
+border:0 !important;
+}
+.rcb-spacer,.rcb-spacer img{
+width:20px;
+}
+p .ast{
+position:relative;
+left:0px;
+padding-right:3px;
+}
+.spacer-left {
+padding:0 !important;
+margin:0 !important;
+width:5px;
+}
+.spacer-left img{
+margin:0;
+padding:0;
+border:0;
+width:5px;
+height:1px;
+}
+label span.br{
+display:block;
+padding-left:5px;
+}
+label.text{
+vertical-align:top !important;
+}
+label.spacer{
+color:white;
+}
+form {
+margin:0;
+padding:0;
+border:0;
+}
+.form-buttons{
+margin:10px 0;
+white-space:nowrap;
+margin-left:0px;
+}
+.top-border{
+border-top:1px #666 solid;
+padding-top:10px;
+margin-top:15px;
+}
+.form-buttons td {
+vertical-align:middle;
+padding:5px 0;
+}
+fieldset{
+border:0;
+border-bottom:1px #000 solid;
+padding:5px;
+}
+fieldset td{
+padding:3px 0;
+}
+fieldset .btm-row td{
+border-top:1px #CCC solid !important;
+}
+fieldset legend{
+color:#000;
+font-weight:bold;
+padding-bottom:5px;
+margin-top:5px;
+margin-left:-6px;
+}
+input.button{
+padding:1px 4px;
+font-size:85%;
+margin:0;
+background:#ccc;
+}
+input.arrow-up{
+background:#CCC url(../images/button_arrow_up.gif) no-repeat 90% 50%;
+padding-right:20px;
+font-size:11px;
+}
+input.arrow-down{
+background:#CCC url(../images/button_arrow_down.gif) no-repeat 90% 50%;
+padding-right:20px;
+font-size:11px;
+}
+input.button-blue{
+padding:1px 4px;
+font-size:85%;
+margin:0;
+color:#FFF;
+background:#369;
+}
+input.button-sm{
+padding:1px;
+font-size:78%;
+margin:0;
+}
+textarea{
+font-size:100%;
+font-family:sans-serif;
+}
+td.spacer{
+height:1px;
+padding:0;
+}
+.disabled {
+color:#CCC !important;
+}
+.abled {
+color:#000 !important;
+}
+input.text, input.password{
+font-size:100%;
+vertical-align:middle;
+}
+input.text:focus,textarea:focus{
+background:#FFC;
+}
+.radio{
+padding:0;
+margin:0;
+border:0;
+height:12px;
+width:12px;
+vertical-align:middle;
+margin-right:8px !important;
+text-align:center !important;
+}
+.rcb {
+line-height:120%;
+}
+select {
+font-size:85%;
+}
+.tip{
+font-size:80%;
+padding-left:5px;
+display:inline;
+position:relative;
+}
+td.tier2 label{
+padding-left:22px !important;
+}
+td.tier2 .checkbox{
+margin-left:-1px;
+}
+.col-radio{
+text-align:center;
+}
+/*---------------------------Help-----------------------------------*/
+.app-help{
+margin-right:auto;
+margin-left:auto;
+}
+.nobullet li{
+list-style:none;
+}
+.plain{
+position:relative;
+top:0px;
+left:0px;
+margin:0 !important;
+padding:0 !important;
+margin-left:1px !important;
+}
+.plain .list-label{
+padding-right:10px;
+}
+.plain li{
+list-style:none;
+}
+.index{
+clear:both;
+padding:0;
+margin:0;
+border:0;
+}
+.index ul{
+padding:0px;
+margin:0px;
+border:0px;
+height:15px;
+}
+.index ul li{
+float:left;
+padding:4px;
+list-style:none;
+}
+.index a{
+text-decoration:none !important;
+}
+.index a:hover{
+text-decoration:underline !important;
+}
+
+/*--------------------------Glossary--------------------------------*/
+.glossary-index{
+height:12px;
+display:block;
+margin:0;
+padding:0;
+border:0;
+padding-top:5px;
+padding-bottom:5px;
+margin-right:auto;
+margin-left:auto;
+text-transform:uppercase;
+}
+.glossary-index li{
+list-style:none;
+display:inline;
+padding-right:2px;
+padding-left:2px;
+font-weight:bold;
+}
+.glossary-index a{
+padding-left:2px;
+padding-right:2px;
+}
+.glossary-index a:hover{
+background:#CCC;
+}
+dl{
+margin:0;
+}
+dt{
+font-weight:bold;
+}
+dd {
+margin-left:20px;
+}
+.marker {
+font-weight:bold;
+color:#369;
+width:100%;
+text-transform:uppercase;
+}
+.section{
+border-bottom:1px #999 solid;
+}
+p.link{
+width:100%;
+text-align:center;
+margin-top:0px;
+padding:0;
+padding-bottom:5px;
+}
+.blocks {
+padding:0;
+margin:0;
+border:0;
+}
+.blocks li{
+list-style:none;
+float:left;
+padding:10px;
+}
+.last{
+border-right:0 !important;
+}
+table {
+clear:both;
+}
+.noline td {
+border-bottom:0 !important;
+}
+.scroll{
+overflow:auto;
+}
+.ital{
+font-style:oblique;
+}
+.em{
+font-weight:bold !important;
+}
+.left{
+float:left;
+}
+.right{
+float:right;
+}
+
+/*--------------------mTIE: Table of Interactive Elements-----------*/
+th{
+font-weight:bold !important;
+}
+th a{
+font-weight:bold !important;
+}
+.mTIE {
+margin:10px 0;
+border:0;
+padding:0;
+border-left:1px #CCC solid;
+border-top:1px #CCC solid;
+width:100%;
+}
+.date, .date-ss, .time {
+text-align:right;
+white-space:nowrap;
+
+}
+.mTIE td{
+margin:0;
+border:0;
+border-bottom:1px #CCC solid;
+border-right:1px #CCC solid;
+padding:4px 6px;
+vertical-align:middle;
+}
+.mTIE .headerRow td {
+text-align:center;
+}
+.mTIE th {
+margin:0;
+border:0;
+border-bottom:1px #CCC solid;
+border-right:1px #CCC solid;
+padding:3px 6px;
+}
+.mTIE a {
+text-decoration:underline;
+}
+.headerRow{
+background:#369 !important;
+color:#FFF;
+font-weight:bold;
+}
+.button-mTIE{ /*Check All-Clear All button*/
+padding:1px 4px;
+background:#CCC;
+font-size:85%;
+margin:0;
+width:75px;
+}
+.decimal{
+text-align:right;
+}
+#totalRow {
+background:#FFF !important;
+}
+#totalRow .decTotal {
+text-align:right;
+}
+#totalRow .total{
+text-align:right;
+}
+
+/*------------------------mTAB--------------------------------------*/
+.mTAB {
+margin:0px 0;
+border:0;
+padding:0;
+border-left:1px #CCC solid;
+border-top:1px #CCC solid;
+/*width:100%;*/
+}
+.mTAB .date{
+text-align:right;
+white-space:nowrap;
+}
+.mTAB td{
+margin:0;
+border:0;
+border-bottom:1px #CCC solid;
+border-right:1px #CCC solid;
+padding:4px 6px;
+vertical-align:middle;
+}
+.mTAB .headerRow td {
+text-align:center;
+}
+.mTAB th {
+margin:0;
+border:0;
+border-bottom:1px #CCC solid;
+border-right:1px #CCC solid;
+padding:4px 6px;
+}
+/*.mTAB a {
+text-decoration:underline;
+}*/
+.headerRow{
+background:#369 !important;
+color:#FFF;
+font-weight:bold;
+}
+.button-mTAB{ /*Check All-Clear All button*/
+font-size:10px;
+padding:1px 4px;
+height:20px;
+line-height:12px;
+width:75px;
+}
+
+/* LISTS and mTS */
+/*----------------------mIM: Inline Messages------------------------*/
+.mIM{
+background:#9CF;
+margin:5px 0;
+padding:5px;
+background-position:9px 5px !important;
+clear:both;
+display:block;
+}
+.mIM p,.mIM ul,.mIM ol{
+position:relative;
+top:0;
+left:0;
+padding:0;
+margin:0;
+padding-left:48px;
+padding-bottom:5px;
+border:0;
+display:block;
+}
+.mIM ul{
+padding-left:65px;
+width:80%;
+}
+.mIM ol{
+padding-left:70px;
+width:80%;
+}
+* html .mIM { /*IE Hack*/
+height:35px; /*set the height in IE5.5*/
+voice-family:"\"}\"";
+voice-family:inherit;
+height:30px; /*set the height in IE6.0*/
+}
+*+.mIM{ /*high end browser hack*/
+min-height:30px;
+}
+div.error {
+background:#9CF url(../images/icon_error.gif) no-repeat;
+}
+.error .txt{
+font-size:100%;
+color:#F00;
+font-weight:bold;
+text-align:right;
+padding-right:10px;
+padding-left:44px;
+width:35px;
+}
+.error table{
+position:relative;
+}
+.error table td{
+vertical-align:top;
+}
+.error .list-errors {
+padding:0;
+display:block;
+clear:both;
+left:-1px;
+position:relative;
+}
+.error .list-errors li {
+list-style:none;
+background:url(../images/dash.gif) no-repeat 0 50%;
+padding-left:12px;
+}
+.error p,
+.error ul{
+padding-left:0;
+}
+.error p{
+padding-top:0;
+margin-top:0;
+}
+.info {
+background:#9CF url(../images/icon_info.gif) no-repeat;
+}
+.confirmation {
+background:#9CF url(../images/icon_confirmation.gif) no-repeat;
+}
+.alert {
+background:#9CF url(../images/icon_alert.gif) no-repeat;
+}
+.help {
+background:#9CF url(../images/icon_help.gif) no-repeat;
+}
+
+/*---------------------mRT: Return to Top---------------------------*/
+.mRT {
+margin:10px 0;
+clear:both;
+display:block;
+}
+.mRT a {
+background:url(../images/return_to_top.gif) no-repeat 0 2px;
+padding-left:15px;
+}
+/*---------------------mPW:Please Wait------------------------------*/
+.mPW {
+border-top:1px #666 solid;
+border-bottom:1px #666 solid;
+background:#FFF;
+padding:10px;
+text-align:center;
+height:auto;
+width:auto;
+clear:both;
+display:block;
+margin:10px 0px;
+}
+.icon-wait {
+background:url(../images/please_wait.gif) no-repeat 50% 100%;
+width:100px;
+height:20px;
+margin-left:auto;
+margin-right:auto;
+clear:both;
+display:block;
+}
+
+/*---------------------mDL: Data List-------------------------------*/
+.mDL{
+width:100%;
+margin:10px 0;
+}
+.mDL td{
+padding:4px 0px 4px 10px;
+}
+.mDL th{
+background:#369;
+color:#FFF;
+text-align:left;
+padding:2px 5px;
+}
+.mDL .label{
+text-align:right;
+}
+.mDL .total{ /*are these being duplicated?*/
+text-align:right;
+font-weight:bold;
+padding-right:10px;
+}
+.mDL .decimal{
+text-align:right;
+padding-right:10px;
+}
+
+/*------------------mDDL: Double Data List--------------------------*/
+.mDDL .plain{
+margin-bottom:10px !important;
+}
+.mDDL{
+width:100%;
+margin:10px 0;
+}
+.mDDL td{
+padding:4px 0px 4px 10px;
+}
+.mDDL th{
+background:#369;
+color:#FFF;
+text-align:left;
+padding:2px 5px;
+}
+.mDDL .label{
+text-align:right;
+}
+.mDDL .total{
+text-align:right;
+font-weight:bold;
+padding-right:10px;
+}
+.mDDL .decimal{
+text-align:right;
+padding-right:10px;
+}
+
+/*------------------------mCA: Contact-------------------------*/
+.mCA{
+position:relative;
+width:50%;
+height:auto;
+margin:10px 0;
+}
+.mCA .number {
+position:relative;
+}
+.mCA .mail{
+font-weight:bold;
+position:relative;
+background:inherit;
+}
+.mCA address{
+margin-left:150px;
+font-weight:normal;
+font-style:normal;
+}
+
+
+/*----------mDSR:Data Summary/Review Verification-------------------*/
+.mDSR {
+border-bottom:1px #000 solid;
+width:100%;
+margin:10px 0;
+}
+.mDSR th {
+text-align:left;
+padding:4px 6px;
+}
+.mDSR td {
+text-align:left;
+padding:4px 4px;
+vertical-align:top;
+}
+th a{
+font-weight:normal;
+margin-left:5px;
+}
+
+/*---------------------mLL: Link Listing----------------------------*/
+.mLL {
+margin:10px 0;
+width:100%;
+display:block;
+height:auto;
+position:relative;
+clear:both;
+float:none;
+}
+.mLL ul{
+margin:0;
+padding:10px 0px;
+width:45%;
+position:relative;
+}
+.mLL ul li{
+list-style:none;
+border:0;
+margin:0;
+padding-bottom:2px;
+}
+
+
+/*-----------------mPN: Pagination/Navigation-----------------------*/
+.mPN{
+position:relative;
+display:block;
+clear:both;
+height:45px;
+margin:10px 0;
+white-space:nowrap;
+}
+.mPN p,
+.mPN label {
+line-height:160% !important;
+padding:0;
+margin:0;
+border:0;
+vertical-align:top;
+}
+.mPN .current{
+font-weight:bold;
+}
+.mPN a{
+font-weight:bold;
+}
+.mPN .left,.mPN .right{
+float:left;
+vertical-align:top;
+height:100%;
+color:#999;
+font-weight:bold;
+}
+.mPN .left{
+padding-right:40px;
+}
+.mPN .right{
+padding-left:45px;
+}
+.mPN .middle{
+float:left;
+text-align:left;
+height:100%;
+padding-top:0px;
+}
+.mPN input.text{
+vertical-align:top;
+}
+
+/*-----------------mSN: Simple Navigation---------------------------*/
+.mSN{
+padding:5px 0 !important;
+margin:0;
+border:0;
+width:90%;
+}
+.mSN *{ /*IE Hack to fix jumping*/
+position:relative;
+top:0;
+left:0;
+}
+.mSN ul{
+clear:both;
+width:80%;
+margin:0 !important;
+left:15px;
+}
+.mSN li {
+list-style:none;
+padding-bottom:3px;
+}
+
+/*----------------------mTC: Task Confirmation----------------------*/
+.mTC{
+border:1px #9CF solid;
+border-top:0;
+margin:10px 0;
+min-width:300px;
+}
+.mTC ul{
+margin-left:65px;
+}
+.mTC p{
+margin-left:60px;
+}
+.mTC table{
+padding:0;
+margin:0;
+border:0;
+margin-left:58px;
+}
+.mTC h2{
+position:relative;
+top:0;
+left:0;
+width:auto;
+background:#9CF url(../images/banner-confirmation.gif) repeat-x 0 0;
+padding:12px 10px 12px 60px;
+font-size:100%;
+font-weight:normal;
+margin-bottom:10px;
+}
+
+/*--------------------mHL: Helpful Links (new)----------------------*/
+.mHL{
+border-top:1px #333 solid;
+border-bottom:1px #333 solid;
+padding:10px 0;
+margin-bottom:10px;
+}
+.mHL h3{
+font-size:100%;
+}
+.mHL ul{
+margin-left:65px;
+}
+
+/*--------------------mTI: Task Instructions------------------------*/
+.mTI{
+display:block;
+clear:both;
+margin:10px 0;
+}
+.mTI ul{
+position:relative;
+display:block;
+left:.1em;
+padding:0;
+border:0;
+}
+/*---------------bSWN: Secondary Window Navigation------------------*/
+.bSWN{
+padding:10px 0;
+border-top:1px #369 solid;
+}
+
+/*----------------mSD: Status Dashboard-----------------------------*/
+.mSD{
+border:1px #369 solid;
+margin:10px 0;
+width:100%;
+}
+.mSD th{
+background:#369;
+color:#FFF;
+text-align:left;
+padding:2px 5px;
+}
+
+/*----------------mSDL: Summary Data Listing-----------------------*/
+.mSDL{
+border:1px #369 solid;
+margin:10px 0;
+min-width:250px;
+width:100%;
+}
+.mSDL td{
+border:0;
+margin:0;
+padding:2px 0 2px 8px;
+vertical-align:middle;
+}
+.mSDL th{
+background:#369;
+color:#FFF;
+text-align:left;
+padding:2px 5px;
+}
+.mSDL .value{
+text-align:right;
+}
+
+/*----------------------mDEE: Data Entry/Edit ----------------------*/
+.mDEE{
+margin:10px 0;
+width:100%;
+}
+table.mDEE{
+border:1px #369 solid;
+}
+.mDEE td{
+border:0;
+margin:0;
+padding:5px 0;
+vertical-align:middle;
+}
+.mDEE th{
+background:#369;
+color:#FFF;
+text-align:left;
+padding:2px 5px;
+}
+.nopad{
+padding:0 !important;
+border:0;
+margin:0;
+width:100%;
+}
+.desc {
+text-align:right;
+}
+
+/*---------------------Supporting Text------------------------------*/
+.mST{
+margin:10px 0;
+display:block;
+clear:both;
+}
+
+/*------------------------tPH: Page header--------------------------*/
+.tPH {
+margin:10px 100px 1px 10px;
+display:block;
+clear:both;
+}
+
+/*----------------Topic index found in pHW2.html--------------------*/
+.topic-index{
+padding:0;
+margin:5px 0;
+width:100%;
+height:14px;
+display:block;
+clear:both;
+position:relative;
+top:0;
+left:0;
+}
+.topic-index li{
+list-style:none;
+float:left;
+margin-right:25px;
+padding:0;
+border:0;
+}
+.topic-index li a{
+padding-left:10px;
+background:url(../images/arrow_down_alt.gif) no-repeat 0 50%;
+}
+.alt li a{
+padding-left:10px;
+background:url(../images/arrow_down_alt2.gif) no-repeat 0 50%;
+}
+
+/*------------------Freezing header mods for NS7------------------- */
+div[class="class_float"] table {
+padding:0;
+margin:0;
+border:1px #CCC solid !important;
+background:#369;
+width:100%;
+}
+div[class="class_float"] th {
+margin:0;
+border-right:0;
+border-bottom:0;
+vertical-align:middle;
+}
+.headerRow nobr{
+border-left:2px #369 solid;
+}
+
+/*------------------mSD:Status Dashboard----------------------------*/
+.data-mSD{
+width:90%;
+margin:0 10px;
+}
+.data-mSD td{
+padding:2px 0 !important;
+margin:0 !important;
+border:0 !important;
+}
+.data-mSD .value{
+text-align:right !important;
+}
+.wrap {
+white-space:normal;
+}
+.input-error{
+color:#F00;
+font-weight:bold;
+}
+
+
+/*-------------------mCC: Convenence Choices------------------------*/
+.mCC{
+margin:10px 0;
+width:100%;
+}
+table.mCC{
+border:1px #369 solid;
+}
+.mCC td{
+border:0;
+margin:0;
+padding:5px 0;
+vertical-align:middle;
+}
+.mCC th{
+background:#369;
+color:#FFF;
+text-align:left;
+padding:2px 5px;
+}
+
+/*-----------------------Layout sample pages------------------------*/
+.layout-template .col1,
+.layout-template .col2,
+.layout-template .col3{
+background:#efefef;
+height:350px;
+border:1px #CCC dotted;
+text-align:center;
+}
+.layout-template #grid{
+padding-top:10px;
+}
+.center{
+text-align:center;
+}
+
+/*----------------------Row Exchange Module-------------------------*/
+div.mREX{
+border:1px #999 solid;
+padding:5px 10px;
+margin-bottom:20px;
+background:#efefef;
+}
+h1.mREX{
+background:#999;
+color:#FFF;
+padding:5px 10px;
+margin:0;
+font-size:100%;
+margin-top:20px;
+}
+
+/*---------------508 Complaint Skip Navigation Link-----------------*/
+#skip{
+display:inline;
+color:#FFF !important;
+text-decoration:none;
+font-size:1px;
+position:absolute;
+top:0;
+left:0;
+z-index:10;
+}
+.cal-label{
+font-size:90%;
+color:#999;
+position: relative;
+top:4px;
+}
+caption{
+font-weight:bold;
+color:#369;
+}
+#grid a:visited{
+text-decoration:none;
+border-bottom:1px dotted;
+}
+.clear{
+display:block !imporatn;
+clear:both;
+}
+
+/*---------------------mTS: Task Steps------------------------------*/
+.mTS {
+border:1px #9CF solid;
+width:140px;
+background:#FFF;
+margin:10px 0;
+}
+.mTS h2 {
+text-transform:uppercase;
+text-align:center;
+color:#369;
+padding:0px 4px;
+margin:0;
+border:0;
+font-size:100%;
+border-bottom:1px #9CF solid;
+}
+.mTS ul {
+margin:0;
+border:0;
+padding:5px 0;
+width:90%;
+}
+.mTS ul li {
+list-style:none;
+padding-bottom:8px;
+padding-left:20px;
+padding-right:5px;
+}
+.mTS li.current {
+font-weight:bold;
+background:url(../images/task_arrow_on.gif) no-repeat;
+}
+.mTS li.complete {
+background:url(../images/check.gif) no-repeat;
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/raptor.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/raptor.css
new file mode 100644
index 00000000..ea37015a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/raptor.css
@@ -0,0 +1,62 @@
+ .rowalt1 {background-color: rgb(255, 255, 255);}
+ .rowalt2 {background-color: rgb(255, 255, 204);}
+ .rowalt3 {background-color: rgb(255, 0, 0);}
+.rbg1 { background-color:#336699; } /* header background (gray) */
+ .rbg1d { background:#747474; } /* tab dark background (gray) */
+ .rbg2 { background:#FFFFFF;/*background:#D6DCE4;*/ } /* darker background */
+ .rbg3 { background:#FFFFFF;/*background:#EDEDED;*/ } /* light background */
+ .rbg4 { background:#88CAFB; } /* second header - dark */
+ .rbg6 { background:#ffbbbb; } /* light error background */
+ .rbg7 { background:#ff9999; } /* dark error background - header */
+ .rcolheader { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#FFFFFF;font-weight:700;text-decoration:none }
+ .rcolheader:hover { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#FFFFFF;font-weight:700;text-decoration:underline }
+ .rtableheader { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#FFFFFF;font-weight:700; }
+ .rtabletext { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#000000; }
+ .rtabletextwhite { font-family:Arial;font-size:11px;color:#FFFFFF; }
+ .rtext { font-family:Arial,Helvetica,sans-serif;font-size:13px;color:#000000; }
+ .rtext2 { font-family:Arial,Helvetica,sans-serif;font-size:13px;color:#ffffff; }
+ .rerrortext { font-family:Arial,Helvetica,sans-serif;font-size:16px;color:#000000; }
+ .rerrortextsm { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#000000; }
+ .rprismsbutton { margin:3px 3px 3px 0px; padding:1px 5px 1px 5px; font-family: Arial; font-weight: 700; font-size: 11px; color: #ffffff; background-color: #336699 }
+ .rsmallbutton { margin:3px 3px 3px 0px; padding:1px 5px 1px 5px; font-family: Arial; font-weight: 700; font-size: 11px; color: #336699; background-color: #EDEDED }
+ .rrequired { background-image:url(raptor/images/required.gif); background-position:top right; background-repeat:no-repeat;}
+ .rtabselected { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#FFFFFF;font-weight:700; }
+ .rtabtext { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#CCCCCC;font-weight:700; }
+ .buttonLabelField { margin:3px 3px 3px 0px; }
+
+ /* Added to better customize the UI with FUSION */
+ .rbg8 { border: 1px outset #8DA9D1; background: #EDEDED; color: #000000; } /* alternate table row background */
+ .tableBorder { border:1px outset teal }
+ .unpaddedButton { margin:3px 3px 3px 0px; font-family: Arial; font-weight: 700; font-size: 11px; color: #ffffff; background-color: #336699 }
+ .normalText { font-family: Arial; font-size: 11px; color: #000000; }
+ .popText { font-size:11px;font-family:Arial,Helvetica,sans-serif;color:#000000;padding:1px;font-weight:700;text-decoration:none; }
+ .hyperref1 { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#000000;text-decoration: none}
+ A:link {text-decoration: none}
+ A:visited {text-decoration: none}
+ A:active {text-decoration: none}
+ A:hover {text-decoration: none; color: blue;}
+ .tdborder {margin:0;border:0;border-bottom:1px #CCC solid;border-right:1px #CCC solid;padding:4px 6px;vertical-align:middle;}
+
+div.scrollableTable {
+ clear: both;
+ border: 1px solid #963;
+ height:100%;
+ overflow: auto;
+}
+div.scrollableTable table {float:left;width:100%}
+
+thead.scrollableTableHeader tr {
+ position: relative;
+ top: expression(this.offsetParent.scrollTop);
+ background:white;
+}
+
+thead.scrollableTableHeader tr th {position: relative;background: #336699;}
+/*thead.scrollableTableHeader tr td {position: relative;top: expression(this.offsetParent.scrollTop);background: #8a9bb3;}*/
+thead.scrollableTableHeader tr td {position: relative;top: expression(this.offsetParent.scrollTop);background: #336699;}
+tbody[class].scrollableTableContent {
+ display: block;
+ overflow: auto;
+}
+ .trhideunhidecolor {background: #ffffff;}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/css/nv.d3.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/css/nv.d3.css
new file mode 100644
index 00000000..28ccd053
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/css/nv.d3.css
@@ -0,0 +1,656 @@
+
+/********************
+ * HTML CSS
+ */
+
+
+.chartWrap {
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+}
+
+
+/********************
+ * TOOLTIP CSS
+ */
+
+.nvtooltip {
+ position: absolute;
+ background-color: rgba(255,255,255,1);
+ padding: 10px;
+ border: 1px solid #ddd;
+ z-index: 10000;
+
+ font-family: Arial;
+ font-size: 13px;
+
+ transition: opacity 500ms linear;
+ -moz-transition: opacity 500ms linear;
+ -webkit-transition: opacity 500ms linear;
+
+ transition-delay: 500ms;
+ -moz-transition-delay: 500ms;
+ -webkit-transition-delay: 500ms;
+
+ -moz-box-shadow: 4px 4px 8px rgba(0,0,0,.5);
+ -webkit-box-shadow: 4px 4px 8px rgba(0,0,0,.5);
+ box-shadow: 4px 4px 8px rgba(0,0,0,.5);
+
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+
+ pointer-events: none;
+
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+.nvtooltip h3 {
+ margin: 0;
+ padding: 0;
+ text-align: center;
+}
+
+.nvtooltip p {
+ margin: 0;
+ padding: 0;
+ text-align: center;
+}
+
+.nvtooltip span {
+ display: inline-block;
+ margin: 2px 0;
+}
+
+.nvtooltip-pending-removal {
+ position: absolute;
+ pointer-events: none;
+}
+
+
+/********************
+ * SVG CSS
+ */
+
+
+svg {
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ /* Trying to get SVG to act like a greedy block in all browsers */
+ display: block;
+ width:100%;
+ height:100%;
+}
+
+
+svg text {
+ font: normal 12px Arial;
+}
+
+svg .title {
+ font: bold 14px Arial;
+}
+
+.nvd3 .nv-background {
+ fill: white;
+ fill-opacity: 0;
+ /*
+ pointer-events: none;
+ */
+}
+
+.nvd3.nv-noData {
+ font-size: 18px;
+ font-weight: bolf;
+}
+
+
+/**********
+* Brush
+*/
+
+.nv-brush .extent {
+ fill-opacity: .125;
+ shape-rendering: crispEdges;
+}
+
+
+
+/**********
+* Legend
+*/
+
+.nvd3 .nv-legend .nv-series {
+ cursor: pointer;
+}
+
+.nvd3 .nv-legend .disabled circle {
+ fill-opacity: 0;
+}
+
+
+
+/**********
+* Axes
+*/
+
+.nvd3 .nv-axis path {
+ fill: none;
+ stroke: #000;
+ stroke-opacity: .75;
+ shape-rendering: crispEdges;
+}
+
+.nvd3 .nv-axis path.domain {
+ stroke-opacity: .75;
+}
+
+.nvd3 .nv-axis.nv-x path.domain {
+ stroke-opacity: 0;
+}
+
+.nvd3 .nv-axis line {
+ fill: none;
+ stroke: #000;
+ stroke-opacity: .25;
+ shape-rendering: crispEdges;
+}
+
+.nvd3 .nv-axis line.zero {
+ stroke-opacity: .75;
+}
+
+.nvd3 .nv-axis .nv-axisMaxMin text {
+ font-weight: bold;
+}
+
+.nvd3 .x .nv-axis .nv-axisMaxMin text,
+.nvd3 .x2 .nv-axis .nv-axisMaxMin text,
+.nvd3 .x3 .nv-axis .nv-axisMaxMin text {
+ text-anchor: middle
+}
+
+
+
+/**********
+* Brush
+*/
+
+.nv-brush .resize path {
+ fill: #eee;
+ stroke: #666;
+}
+
+
+
+/**********
+* Bars
+*/
+
+.nvd3 .nv-bars .negative rect {
+ zfill: brown;
+}
+
+.nvd3 .nv-bars rect {
+ zfill: steelblue;
+ fill-opacity: .75;
+
+ transition: fill-opacity 250ms linear;
+ -moz-transition: fill-opacity 250ms linear;
+ -webkit-transition: fill-opacity 250ms linear;
+}
+
+.nvd3 .nv-bars rect:hover {
+ fill-opacity: 1;
+}
+
+.nvd3 .nv-bars .hover rect {
+ fill: lightblue;
+}
+
+.nvd3 .nv-bars text {
+ fill: rgba(0,0,0,0);
+}
+
+.nvd3 .nv-bars .hover text {
+ fill: rgba(0,0,0,1);
+}
+
+
+/**********
+* Bars
+*/
+
+.nvd3 .nv-multibar .nv-groups rect,
+.nvd3 .nv-multibarHorizontal .nv-groups rect,
+.nvd3 .nv-discretebar .nv-groups rect {
+ stroke-opacity: 0;
+
+ transition: fill-opacity 250ms linear;
+ -moz-transition: fill-opacity 250ms linear;
+ -webkit-transition: fill-opacity 250ms linear;
+}
+
+.nvd3 .nv-multibar .nv-groups rect:hover,
+.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,
+.nvd3 .nv-discretebar .nv-groups rect:hover {
+ fill-opacity: 1;
+}
+
+.nvd3 .nv-discretebar .nv-groups text,
+.nvd3 .nv-multibarHorizontal .nv-groups text {
+ font-weight: bold;
+ fill: rgba(0,0,0,1);
+ stroke: rgba(0,0,0,0);
+}
+
+/***********
+* Pie Chart
+*/
+
+.nvd3.nv-pie path {
+ stroke-opacity: 0;
+
+ transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
+ -moz-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
+ -webkit-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
+
+}
+
+.nvd3.nv-pie .nv-slice text {
+ stroke: #000;
+ stroke-width: 0;
+}
+
+.nvd3.nv-pie path {
+ stroke: #fff;
+ stroke-width: 1px;
+ stroke-opacity: 1;
+}
+
+.nvd3.nv-pie .hover path {
+ fill-opacity: .7;
+/*
+ stroke-width: 6px;
+ stroke-opacity: 1;
+*/
+}
+
+.nvd3.nv-pie .nv-label rect {
+ fill-opacity: 0;
+ stroke-opacity: 0;
+}
+
+/**********
+* Lines
+*/
+
+.nvd3 .nv-groups path.nv-line {
+ fill: none;
+ stroke-width: 2.5px;
+ /*
+ stroke-linecap: round;
+ shape-rendering: geometricPrecision;
+
+ transition: stroke-width 250ms linear;
+ -moz-transition: stroke-width 250ms linear;
+ -webkit-transition: stroke-width 250ms linear;
+
+ transition-delay: 250ms
+ -moz-transition-delay: 250ms;
+ -webkit-transition-delay: 250ms;
+ */
+}
+
+.nvd3 .nv-groups path.nv-area {
+ stroke: none;
+ /*
+ stroke-linecap: round;
+ shape-rendering: geometricPrecision;
+
+ stroke-width: 2.5px;
+ transition: stroke-width 250ms linear;
+ -moz-transition: stroke-width 250ms linear;
+ -webkit-transition: stroke-width 250ms linear;
+
+ transition-delay: 250ms
+ -moz-transition-delay: 250ms;
+ -webkit-transition-delay: 250ms;
+ */
+}
+
+.nvd3 .nv-line.hover path {
+ stroke-width: 6px;
+}
+
+/*
+.nvd3.scatter .groups .point {
+ fill-opacity: 0.1;
+ stroke-opacity: 0.1;
+}
+ */
+
+.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point {
+ fill-opacity: 0;
+ stroke-opacity: 0;
+}
+
+.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point {
+ fill-opacity: .5 !important;
+ stroke-opacity: .5 !important;
+}
+
+
+.nvd3 .nv-groups .nv-point {
+ transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
+ -moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
+ -webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
+}
+
+.nvd3.nv-scatter .nv-groups .nv-point.hover,
+.nvd3 .nv-groups .nv-point.hover {
+ stroke-width: 20px;
+ fill-opacity: .5 !important;
+ stroke-opacity: .5 !important;
+}
+
+
+.nvd3 .nv-point-paths path {
+ stroke: #aaa;
+ stroke-opacity: 0;
+ fill: #eee;
+ fill-opacity: 0;
+}
+
+
+
+.nvd3 .nv-indexLine {
+ cursor: ew-resize;
+}
+
+
+/**********
+* Distribution
+*/
+
+.nvd3 .nv-distribution {
+ pointer-events: none;
+}
+
+
+
+/**********
+* Scatter
+*/
+
+/* **Attempting to remove this for useVoronoi(false), need to see if it's required anywhere
+.nvd3 .nv-groups .nv-point {
+ pointer-events: none;
+}
+*/
+
+.nvd3 .nv-groups .nv-point.hover {
+ stroke-width: 20px;
+ stroke-opacity: .5;
+}
+
+.nvd3 .nv-scatter .nv-point.hover {
+ fill-opacity: 1;
+}
+
+/*
+.nv-group.hover .nv-point {
+ fill-opacity: 1;
+}
+*/
+
+
+/**********
+* Stacked Area
+*/
+
+.nvd3.nv-stackedarea path.nv-area {
+ fill-opacity: .7;
+ /*
+ stroke-opacity: .65;
+ fill-opacity: 1;
+ */
+ stroke-opacity: 0;
+
+ transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
+ -moz-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
+ -webkit-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
+
+ /*
+ transition-delay: 500ms;
+ -moz-transition-delay: 500ms;
+ -webkit-transition-delay: 500ms;
+ */
+
+}
+
+.nvd3.nv-stackedarea path.nv-area.hover {
+ fill-opacity: .9;
+ /*
+ stroke-opacity: .85;
+ */
+}
+/*
+.d3stackedarea .groups path {
+ stroke-opacity: 0;
+}
+ */
+
+
+
+.nvd3.nv-stackedarea .nv-groups .nv-point {
+ stroke-opacity: 0;
+ fill-opacity: 0;
+}
+
+.nvd3.nv-stackedarea .nv-groups .nv-point.hover {
+ stroke-width: 20px;
+ stroke-opacity: .75;
+ fill-opacity: 1;
+}
+
+
+
+/**********
+* Line Plus Bar
+*/
+
+.nvd3.nv-linePlusBar .nv-bar rect {
+ fill-opacity: .75;
+}
+
+.nvd3.nv-linePlusBar .nv-bar rect:hover {
+ fill-opacity: 1;
+}
+
+
+/**********
+* Bullet
+*/
+
+.nvd3.nv-bullet { font: 10px sans-serif; }
+.nvd3.nv-bullet .nv-measure { fill-opacity: .8; }
+.nvd3.nv-bullet .nv-measure:hover { fill-opacity: 1; }
+.nvd3.nv-bullet .nv-marker { stroke: #000; stroke-width: 2px; }
+.nvd3.nv-bullet .nv-markerTriangle { stroke: #000; fill: #fff; stroke-width: 1.5px; }
+.nvd3.nv-bullet .nv-tick line { stroke: #666; stroke-width: .5px; }
+.nvd3.nv-bullet .nv-range.nv-s0 { fill: #eee; }
+.nvd3.nv-bullet .nv-range.nv-s1 { fill: #ddd; }
+.nvd3.nv-bullet .nv-range.nv-s2 { fill: #ccc; }
+.nvd3.nv-bullet .nv-title { font-size: 14px; font-weight: bold; }
+.nvd3.nv-bullet .nv-subtitle { fill: #999; }
+
+
+.nvd3.nv-bullet .nv-range {
+ fill: #999;
+ fill-opacity: .4;
+}
+.nvd3.nv-bullet .nv-range:hover {
+ fill-opacity: .7;
+}
+
+
+
+/**********
+* Sparkline
+*/
+
+.nvd3.nv-sparkline path {
+ fill: none;
+}
+
+.nvd3.nv-sparklineplus g.nv-hoverValue {
+ pointer-events: none;
+}
+
+.nvd3.nv-sparklineplus .nv-hoverValue line {
+ stroke: #333;
+ stroke-width: 1.5px;
+ }
+
+.nvd3.nv-sparklineplus,
+.nvd3.nv-sparklineplus g {
+ pointer-events: all;
+}
+
+.nvd3 .nv-hoverArea {
+ fill-opacity: 0;
+ stroke-opacity: 0;
+}
+
+.nvd3.nv-sparklineplus .nv-xValue,
+.nvd3.nv-sparklineplus .nv-yValue {
+ /*
+ stroke: #666;
+ */
+ stroke-width: 0;
+ font-size: .9em;
+ font-weight: normal;
+}
+
+.nvd3.nv-sparklineplus .nv-yValue {
+ stroke: #f66;
+}
+
+.nvd3.nv-sparklineplus .nv-maxValue {
+ stroke: #2ca02c;
+ fill: #2ca02c;
+}
+
+.nvd3.nv-sparklineplus .nv-minValue {
+ stroke: #d62728;
+ fill: #d62728;
+}
+
+.nvd3.nv-sparklineplus .nv-currentValue {
+ /*
+ stroke: #444;
+ fill: #000;
+ */
+ font-weight: bold;
+ font-size: 1.1em;
+}
+
+/**********
+* historical stock
+*/
+
+.nvd3.nv-ohlcBar .nv-ticks .nv-tick {
+ stroke-width: 2px;
+}
+
+.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover {
+ stroke-width: 4px;
+}
+
+.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive {
+ stroke: #2ca02c;
+}
+
+.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative {
+ stroke: #d62728;
+}
+
+.nvd3.nv-historicalStockChart .nv-axis .nv-axislabel {
+ font-weight: bold;
+}
+
+.nvd3.nv-historicalStockChart .nv-dragTarget {
+ fill-opacity: 0;
+ stroke: none;
+ cursor: move;
+}
+
+.nvd3 .nv-brush .extent {
+ /*
+ cursor: ew-resize !important;
+ */
+ fill-opacity: 0 !important;
+}
+
+.nvd3 .nv-brushBackground rect {
+ stroke: #000;
+ stroke-width: .4;
+ fill: #fff;
+ fill-opacity: .7;
+}
+
+
+
+/**********
+* Indented Tree
+*/
+
+
+/**
+ * TODO: the following 3 selectors are based on classes used in the example. I should either make them standard and leave them here, or move to a CSS file not included in the library
+ */
+.nvd3.nv-indentedtree .name {
+ margin-left: 5px;
+}
+
+.nvd3.nv-indentedtree .clickable {
+ color: #08C;
+ cursor: pointer;
+}
+
+.nvd3.nv-indentedtree span.clickable:hover {
+ color: #005580;
+ text-decoration: underline;
+}
+
+
+.nvd3.nv-indentedtree .nv-childrenCount {
+ display: inline-block;
+ margin-left: 5px;
+}
+
+.nvd3.nv-indentedtree .nv-treeicon {
+ cursor: pointer;
+ /*
+ cursor: n-resize;
+ */
+}
+
+.nvd3.nv-indentedtree .nv-treeicon.nv-folded {
+ cursor: pointer;
+ /*
+ cursor: s-resize;
+ */
+}
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/cie.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/cie.js
new file mode 100644
index 00000000..45f01329
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/cie.js
@@ -0,0 +1,155 @@
+(function(d3) {
+ var cie = d3.cie = {};
+
+ cie.lab = function(l, a, b) {
+ return arguments.length === 1
+ ? (l instanceof Lab ? lab(l.l, l.a, l.b)
+ : (l instanceof Lch ? lch_lab(l.l, l.c, l.h)
+ : rgb_lab((l = d3.rgb(l)).r, l.g, l.b)))
+ : lab(+l, +a, +b);
+ };
+
+ cie.lch = function(l, c, h) {
+ return arguments.length === 1
+ ? (l instanceof Lch ? lch(l.l, l.c, l.h)
+ : (l instanceof Lab ? lab_lch(l.l, l.a, l.b)
+ : lab_lch((l = rgb_lab((l = d3.rgb(l)).r, l.g, l.b)).l, l.a, l.b)))
+ : lch(+l, +c, +h);
+ };
+
+ cie.interpolateLab = function(a, b) {
+ a = cie.lab(a);
+ b = cie.lab(b);
+ var al = a.l,
+ aa = a.a,
+ ab = a.b,
+ bl = b.l - al,
+ ba = b.a - aa,
+ bb = b.b - ab;
+ return function(t) {
+ return lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
+ };
+ };
+
+ cie.interpolateLch = function(a, b) {
+ a = cie.lch(a);
+ b = cie.lch(b);
+ var al = a.l,
+ ac = a.c,
+ ah = a.h,
+ bl = b.l - al,
+ bc = b.c - ac,
+ bh = b.h - ah;
+ if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; // shortest path
+ return function(t) {
+ return lch_lab(al + bl * t, ac + bc * t, ah + bh * t) + "";
+ };
+ };
+
+ function lab(l, a, b) {
+ return new Lab(l, a, b);
+ }
+
+ function Lab(l, a, b) {
+ this.l = l;
+ this.a = a;
+ this.b = b;
+ }
+
+ Lab.prototype.brighter = function(k) {
+ return lab(Math.min(100, this.l + K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+
+ Lab.prototype.darker = function(k) {
+ return lab(Math.max(0, this.l - K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+
+ Lab.prototype.rgb = function() {
+ return lab_rgb(this.l, this.a, this.b);
+ };
+
+ Lab.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+
+ function lch(l, c, h) {
+ return new Lch(l, c, h);
+ }
+
+ function Lch(l, c, h) {
+ this.l = l;
+ this.c = c;
+ this.h = h;
+ }
+
+ Lch.prototype.brighter = function(k) {
+ return lch(Math.min(100, this.l + K * (arguments.length ? k : 1)), this.c, this.h);
+ };
+
+ Lch.prototype.darker = function(k) {
+ return lch(Math.max(0, this.l - K * (arguments.length ? k : 1)), this.c, this.h);
+ };
+
+ Lch.prototype.rgb = function() {
+ return lch_lab(this.l, this.c, this.h).rgb();
+ };
+
+ Lch.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+
+ // Corresponds roughly to RGB brighter/darker
+ var K = 18;
+
+ // D65 standard referent
+ var X = 0.950470, Y = 1, Z = 1.088830;
+
+ function lab_rgb(l, a, b) {
+ var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
+ x = lab_xyz(x) * X;
+ y = lab_xyz(y) * Y;
+ z = lab_xyz(z) * Z;
+ return d3.rgb(
+ xyz_rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z),
+ xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
+ xyz_rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z)
+ );
+ }
+
+ function rgb_lab(r, g, b) {
+ r = rgb_xyz(r);
+ g = rgb_xyz(g);
+ b = rgb_xyz(b);
+ var x = xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / X),
+ y = xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / Y),
+ z = xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / Z);
+ return lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
+ }
+
+ function lab_lch(l, a, b) {
+ var c = Math.sqrt(a * a + b * b),
+ h = Math.atan2(b, a) / Math.PI * 180;
+ return lch(l, c, h);
+ }
+
+ function lch_lab(l, c, h) {
+ h = h * Math.PI / 180;
+ return lab(l, Math.cos(h) * c, Math.sin(h) * c);
+ }
+
+ function lab_xyz(x) {
+ return x > 0.206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
+ }
+
+ function xyz_lab(x) {
+ return x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
+ }
+
+ function xyz_rgb(r) {
+ return Math.round(255 * (r <= 0.00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055));
+ }
+
+ function rgb_xyz(r) {
+ return (r /= 255) <= 0.04045 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4);
+ }
+})(d3);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/colorbrewer.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/colorbrewer.js
new file mode 100644
index 00000000..2295527b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/colorbrewer.js
@@ -0,0 +1,302 @@
+// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).
+var colorbrewer = {YlGn: {
+3: ["#f7fcb9","#addd8e","#31a354"],
+4: ["#ffffcc","#c2e699","#78c679","#238443"],
+5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"],
+6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],
+7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
+8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
+9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]
+},YlGnBu: {
+3: ["#edf8b1","#7fcdbb","#2c7fb8"],
+4: ["#ffffcc","#a1dab4","#41b6c4","#225ea8"],
+5: ["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],
+6: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],
+7: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],
+8: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],
+9: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]
+},GnBu: {
+3: ["#e0f3db","#a8ddb5","#43a2ca"],
+4: ["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],
+5: ["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],
+6: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],
+7: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],
+8: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],
+9: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]
+},BuGn: {
+3: ["#e5f5f9","#99d8c9","#2ca25f"],
+4: ["#edf8fb","#b2e2e2","#66c2a4","#238b45"],
+5: ["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],
+6: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],
+7: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],
+8: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],
+9: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]
+},PuBuGn: {
+3: ["#ece2f0","#a6bddb","#1c9099"],
+4: ["#f6eff7","#bdc9e1","#67a9cf","#02818a"],
+5: ["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],
+6: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],
+7: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],
+8: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],
+9: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]
+},PuBu: {
+3: ["#ece7f2","#a6bddb","#2b8cbe"],
+4: ["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],
+5: ["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],
+6: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],
+7: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],
+8: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],
+9: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]
+},BuPu: {
+3: ["#e0ecf4","#9ebcda","#8856a7"],
+4: ["#edf8fb","#b3cde3","#8c96c6","#88419d"],
+5: ["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],
+6: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],
+7: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],
+8: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],
+9: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]
+},RdPu: {
+3: ["#fde0dd","#fa9fb5","#c51b8a"],
+4: ["#feebe2","#fbb4b9","#f768a1","#ae017e"],
+5: ["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],
+6: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],
+7: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],
+8: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],
+9: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]
+},PuRd: {
+3: ["#e7e1ef","#c994c7","#dd1c77"],
+4: ["#f1eef6","#d7b5d8","#df65b0","#ce1256"],
+5: ["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],
+6: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],
+7: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],
+8: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],
+9: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]
+},OrRd: {
+3: ["#fee8c8","#fdbb84","#e34a33"],
+4: ["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],
+5: ["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],
+6: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],
+7: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],
+8: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],
+9: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]
+},YlOrRd: {
+3: ["#ffeda0","#feb24c","#f03b20"],
+4: ["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],
+5: ["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],
+6: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],
+7: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],
+8: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],
+9: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]
+},YlOrBr: {
+3: ["#fff7bc","#fec44f","#d95f0e"],
+4: ["#ffffd4","#fed98e","#fe9929","#cc4c02"],
+5: ["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],
+6: ["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],
+7: ["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],
+8: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],
+9: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]
+},Purples: {
+3: ["#efedf5","#bcbddc","#756bb1"],
+4: ["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],
+5: ["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],
+6: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],
+7: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],
+8: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],
+9: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]
+},Blues: {
+3: ["#deebf7","#9ecae1","#3182bd"],
+4: ["#eff3ff","#bdd7e7","#6baed6","#2171b5"],
+5: ["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],
+6: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],
+7: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],
+8: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],
+9: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]
+},Greens: {
+3: ["#e5f5e0","#a1d99b","#31a354"],
+4: ["#edf8e9","#bae4b3","#74c476","#238b45"],
+5: ["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],
+6: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],
+7: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],
+8: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],
+9: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]
+},Oranges: {
+3: ["#fee6ce","#fdae6b","#e6550d"],
+4: ["#feedde","#fdbe85","#fd8d3c","#d94701"],
+5: ["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],
+6: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],
+7: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],
+8: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],
+9: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]
+},Reds: {
+3: ["#fee0d2","#fc9272","#de2d26"],
+4: ["#fee5d9","#fcae91","#fb6a4a","#cb181d"],
+5: ["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],
+6: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],
+7: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],
+8: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],
+9: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]
+},Greys: {
+3: ["#f0f0f0","#bdbdbd","#636363"],
+4: ["#f7f7f7","#cccccc","#969696","#525252"],
+5: ["#f7f7f7","#cccccc","#969696","#636363","#252525"],
+6: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],
+7: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],
+8: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],
+9: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]
+},PuOr: {
+3: ["#f1a340","#f7f7f7","#998ec3"],
+4: ["#e66101","#fdb863","#b2abd2","#5e3c99"],
+5: ["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],
+6: ["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],
+7: ["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],
+8: ["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],
+9: ["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],
+10: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],
+11: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]
+},BrBG: {
+3: ["#d8b365","#f5f5f5","#5ab4ac"],
+4: ["#a6611a","#dfc27d","#80cdc1","#018571"],
+5: ["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],
+6: ["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],
+7: ["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],
+8: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],
+9: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],
+10: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],
+11: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]
+},PRGn: {
+3: ["#af8dc3","#f7f7f7","#7fbf7b"],
+4: ["#7b3294","#c2a5cf","#a6dba0","#008837"],
+5: ["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],
+6: ["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],
+7: ["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],
+8: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],
+9: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],
+10: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],
+11: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]
+},PiYG: {
+3: ["#e9a3c9","#f7f7f7","#a1d76a"],
+4: ["#d01c8b","#f1b6da","#b8e186","#4dac26"],
+5: ["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],
+6: ["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],
+7: ["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],
+8: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],
+9: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],
+10: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],
+11: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]
+},RdBu: {
+3: ["#ef8a62","#f7f7f7","#67a9cf"],
+4: ["#ca0020","#f4a582","#92c5de","#0571b0"],
+5: ["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],
+6: ["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],
+7: ["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],
+8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],
+9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],
+10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],
+11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]
+},RdGy: {
+3: ["#ef8a62","#ffffff","#999999"],
+4: ["#ca0020","#f4a582","#bababa","#404040"],
+5: ["#ca0020","#f4a582","#ffffff","#bababa","#404040"],
+6: ["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],
+7: ["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],
+8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],
+9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],
+10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],
+11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]
+},RdYlBu: {
+3: ["#fc8d59","#ffffbf","#91bfdb"],
+4: ["#d7191c","#fdae61","#abd9e9","#2c7bb6"],
+5: ["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],
+6: ["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],
+7: ["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],
+8: ["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],
+9: ["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],
+10: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],
+11: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]
+},Spectral: {
+3: ["#fc8d59","#ffffbf","#99d594"],
+4: ["#d7191c","#fdae61","#abdda4","#2b83ba"],
+5: ["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],
+6: ["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],
+7: ["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],
+8: ["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],
+9: ["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],
+10: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],
+11: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]
+},RdYlGn: {
+3: ["#fc8d59","#ffffbf","#91cf60"],
+4: ["#d7191c","#fdae61","#a6d96a","#1a9641"],
+5: ["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],
+6: ["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],
+7: ["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],
+8: ["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],
+9: ["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],
+10: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],
+11: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]
+},Accent: {
+3: ["#7fc97f","#beaed4","#fdc086"],
+4: ["#7fc97f","#beaed4","#fdc086","#ffff99"],
+5: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],
+6: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],
+7: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],
+8: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]
+},Dark2: {
+3: ["#1b9e77","#d95f02","#7570b3"],
+4: ["#1b9e77","#d95f02","#7570b3","#e7298a"],
+5: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],
+6: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],
+7: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],
+8: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]
+},Paired: {
+3: ["#a6cee3","#1f78b4","#b2df8a"],
+4: ["#a6cee3","#1f78b4","#b2df8a","#33a02c"],
+5: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],
+6: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],
+7: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],
+8: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],
+9: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],
+10: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],
+11: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],
+12: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]
+},Pastel1: {
+3: ["#fbb4ae","#b3cde3","#ccebc5"],
+4: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],
+5: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],
+6: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],
+7: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],
+8: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],
+9: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]
+},Pastel2: {
+3: ["#b3e2cd","#fdcdac","#cbd5e8"],
+4: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],
+5: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],
+6: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],
+7: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],
+8: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]
+},Set1: {
+3: ["#e41a1c","#377eb8","#4daf4a"],
+4: ["#e41a1c","#377eb8","#4daf4a","#984ea3"],
+5: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],
+6: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],
+7: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],
+8: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],
+9: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]
+},Set2: {
+3: ["#66c2a5","#fc8d62","#8da0cb"],
+4: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],
+5: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],
+6: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],
+7: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],
+8: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"]
+},Set3: {
+3: ["#8dd3c7","#ffffb3","#bebada"],
+4: ["#8dd3c7","#ffffb3","#bebada","#fb8072"],
+5: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],
+6: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],
+7: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],
+8: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],
+9: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],
+10: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],
+11: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],
+12: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]
+}};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/core.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/core.js
new file mode 100644
index 00000000..912de8d8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/core.js
@@ -0,0 +1,122 @@
+
+var nv = window.nv || {};
+
+
+nv.version = '1.1.13b';
+nv.dev = true //set false when in production
+
+window.nv = nv;
+
+nv.tooltip = {}; // For the tooltip system
+nv.utils = nv.utils || {}; // Utility subsystem
+nv.models = {}; //stores all the possible models/components
+nv.charts = {}; //stores all the ready to use charts
+nv.graphs = []; //stores all the graphs currently on the page
+nv.logs = {}; //stores some statistics and potential error messages
+
+nv.dispatch = d3.dispatch('render_start', 'render_end');
+
+// *************************************************************************
+// Development render timers - disabled if dev = false
+
+if (nv.dev) {
+ nv.dispatch.on('render_start', function(e) {
+ nv.logs.startTime = +new Date();
+ });
+
+ nv.dispatch.on('render_end', function(e) {
+ nv.logs.endTime = +new Date();
+ nv.logs.totalTime = nv.logs.endTime - nv.logs.startTime;
+ nv.log('total', nv.logs.totalTime); // used for development, to keep track of graph generation times
+ });
+}
+
+// ********************************************
+// Public Core NV functions
+
+// Logs all arguments, and returns the last so you can test things in place
+// Note: in IE8 console.log is an object not a function, and if modernizr is used
+// then calling Function.prototype.bind with with anything other than a function
+// causes a TypeError to be thrown.
+nv.log = function() {
+ if (nv.dev && console.log && console.log.apply)
+ console.log.apply(console, arguments)
+ else if (nv.dev && typeof console.log == "function" && Function.prototype.bind) {
+ var log = Function.prototype.bind.call(console.log, console);
+ log.apply(console, arguments);
+ }
+ return arguments[arguments.length - 1];
+};
+
+
+nv.render = function render(step) {
+ step = step || 1; // number of graphs to generate in each timeout loop
+
+ nv.render.active = true;
+ nv.dispatch.render_start();
+
+ setTimeout(function() {
+ var chart, graph;
+
+ for (var i = 0; i < step && (graph = nv.render.queue[i]); i++) {
+ chart = graph.generate();
+ if (typeof graph.callback == typeof(Function)) graph.callback(chart);
+ nv.graphs.push(chart);
+ }
+
+ nv.render.queue.splice(0, i);
+
+ if (nv.render.queue.length) setTimeout(arguments.callee, 0);
+ else { nv.render.active = false; nv.dispatch.render_end(); }
+ }, 0);
+};
+
+nv.render.active = false;
+nv.render.queue = [];
+
+nv.addGraph = function(obj) {
+ if (typeof arguments[0] === typeof(Function))
+ obj = {generate: arguments[0], callback: arguments[1]};
+
+ nv.render.queue.push(obj);
+
+ if (!nv.render.active) nv.render();
+};
+
+nv.identity = function(d) { return d; };
+
+nv.strip = function(s) { return s.replace(/(\s|&)/g,''); };
+
+function daysInMonth(month,year) {
+ return (new Date(year, month+1, 0)).getDate();
+}
+
+function d3_time_range(floor, step, number) {
+ return function(t0, t1, dt) {
+ var time = floor(t0), times = [];
+ if (time < t0) step(time);
+ if (dt > 1) {
+ while (time < t1) {
+ var date = new Date(+time);
+ if ((number(date) % dt === 0)) times.push(date);
+ step(time);
+ }
+ } else {
+ while (time < t1) { times.push(new Date(+time)); step(time); }
+ }
+ return times;
+ };
+}
+
+d3.time.monthEnd = function(date) {
+ return new Date(date.getFullYear(), date.getMonth(), 0);
+};
+
+d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) {
+ date.setUTCDate(date.getUTCDate() + 1);
+ date.setDate(daysInMonth(date.getMonth() + 1, date.getFullYear()));
+ }, function(date) {
+ return date.getMonth();
+ }
+);
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.js
new file mode 100644
index 00000000..1aaabca2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.js
@@ -0,0 +1,1180 @@
+(function(exports){
+crossfilter.version = "1.0.3";
+function crossfilter_identity(d) {
+ return d;
+}
+crossfilter.permute = permute;
+
+function permute(array, index) {
+ for (var i = 0, n = index.length, copy = new Array(n); i < n; ++i) {
+ copy[i] = array[index[i]];
+ }
+ return copy;
+}
+var bisect = crossfilter.bisect = bisect_by(crossfilter_identity);
+
+bisect.by = bisect_by;
+
+function bisect_by(f) {
+
+ // Locate the insertion point for x in a to maintain sorted order. The
+ // arguments lo and hi may be used to specify a subset of the array which
+ // should be considered; by default the entire array is used. If x is already
+ // present in a, the insertion point will be before (to the left of) any
+ // existing entries. The return value is suitable for use as the first
+ // argument to `array.splice` assuming that a is already sorted.
+ //
+ // The returned insertion point i partitions the array a into two halves so
+ // that all v < x for v in a[lo:i] for the left side and all v >= x for v in
+ // a[i:hi] for the right side.
+ function bisectLeft(a, x, lo, hi) {
+ while (lo < hi) {
+ var mid = lo + hi >> 1;
+ if (f(a[mid]) < x) lo = mid + 1;
+ else hi = mid;
+ }
+ return lo;
+ }
+
+ // Similar to bisectLeft, but returns an insertion point which comes after (to
+ // the right of) any existing entries of x in a.
+ //
+ // The returned insertion point i partitions the array into two halves so that
+ // all v <= x for v in a[lo:i] for the left side and all v > x for v in
+ // a[i:hi] for the right side.
+ function bisectRight(a, x, lo, hi) {
+ while (lo < hi) {
+ var mid = lo + hi >> 1;
+ if (x < f(a[mid])) hi = mid;
+ else lo = mid + 1;
+ }
+ return lo;
+ }
+
+ bisectRight.right = bisectRight;
+ bisectRight.left = bisectLeft;
+ return bisectRight;
+}
+var heap = crossfilter.heap = heap_by(crossfilter_identity);
+
+heap.by = heap_by;
+
+function heap_by(f) {
+
+ // Builds a binary heap within the specified array a[lo:hi]. The heap has the
+ // property such that the parent a[lo+i] is always less than or equal to its
+ // two children: a[lo+2*i+1] and a[lo+2*i+2].
+ function heap(a, lo, hi) {
+ var n = hi - lo,
+ i = (n >>> 1) + 1;
+ while (--i > 0) sift(a, i, n, lo);
+ return a;
+ }
+
+ // Sorts the specified array a[lo:hi] in descending order, assuming it is
+ // already a heap.
+ function sort(a, lo, hi) {
+ var n = hi - lo,
+ t;
+ while (--n > 0) t = a[lo], a[lo] = a[lo + n], a[lo + n] = t, sift(a, 1, n, lo);
+ return a;
+ }
+
+ // Sifts the element a[lo+i-1] down the heap, where the heap is the contiguous
+ // slice of array a[lo:lo+n]. This method can also be used to update the heap
+ // incrementally, without incurring the full cost of reconstructing the heap.
+ function sift(a, i, n, lo) {
+ var d = a[--lo + i],
+ x = f(d),
+ child;
+ while ((child = i << 1) <= n) {
+ if (child < n && f(a[lo + child]) > f(a[lo + child + 1])) child++;
+ if (x <= f(a[lo + child])) break;
+ a[lo + i] = a[lo + child];
+ i = child;
+ }
+ a[lo + i] = d;
+ }
+
+ heap.sort = sort;
+ return heap;
+}
+var heapselect = crossfilter.heapselect = heapselect_by(crossfilter_identity);
+
+heapselect.by = heapselect_by;
+
+function heapselect_by(f) {
+ var heap = heap_by(f);
+
+ // Returns a new array containing the top k elements in the array a[lo:hi].
+ // The returned array is not sorted, but maintains the heap property. If k is
+ // greater than hi - lo, then fewer than k elements will be returned. The
+ // order of elements in a is unchanged by this operation.
+ function heapselect(a, lo, hi, k) {
+ var queue = new Array(k = Math.min(hi - lo, k)),
+ min,
+ i,
+ x,
+ d;
+
+ for (i = 0; i < k; ++i) queue[i] = a[lo++];
+ heap(queue, 0, k);
+
+ if (lo < hi) {
+ min = f(queue[0]);
+ do {
+ if (x = f(d = a[lo]) > min) {
+ queue[0] = d;
+ min = f(heap(queue, 0, k)[0]);
+ }
+ } while (++lo < hi);
+ }
+
+ return queue;
+ }
+
+ return heapselect;
+}
+var insertionsort = crossfilter.insertionsort = insertionsort_by(crossfilter_identity);
+
+insertionsort.by = insertionsort_by;
+
+function insertionsort_by(f) {
+
+ function insertionsort(a, lo, hi) {
+ for (var i = lo + 1; i < hi; ++i) {
+ for (var j = i, t = a[i], x = f(t); j > lo && f(a[j - 1]) > x; --j) {
+ a[j] = a[j - 1];
+ }
+ a[j] = t;
+ }
+ return a;
+ }
+
+ return insertionsort;
+}
+// Algorithm designed by Vladimir Yaroslavskiy.
+// Implementation based on the Dart project; see lib/dart/LICENSE for details.
+
+var quicksort = crossfilter.quicksort = quicksort_by(crossfilter_identity);
+
+quicksort.by = quicksort_by;
+
+function quicksort_by(f) {
+ var insertionsort = insertionsort_by(f);
+
+ function sort(a, lo, hi) {
+ return (hi - lo < quicksort_sizeThreshold
+ ? insertionsort
+ : quicksort)(a, lo, hi);
+ }
+
+ function quicksort(a, lo, hi) {
+
+ // Compute the two pivots by looking at 5 elements.
+ var sixth = (hi - lo) / 6 | 0,
+ i1 = lo + sixth,
+ i5 = hi - 1 - sixth,
+ i3 = lo + hi - 1 >> 1, // The midpoint.
+ i2 = i3 - sixth,
+ i4 = i3 + sixth;
+
+ var e1 = a[i1], x1 = f(e1),
+ e2 = a[i2], x2 = f(e2),
+ e3 = a[i3], x3 = f(e3),
+ e4 = a[i4], x4 = f(e4),
+ e5 = a[i5], x5 = f(e5);
+
+ var t;
+
+ // Sort the selected 5 elements using a sorting network.
+ if (x1 > x2) t = e1, e1 = e2, e2 = t, t = x1, x1 = x2, x2 = t;
+ if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;
+ if (x1 > x3) t = e1, e1 = e3, e3 = t, t = x1, x1 = x3, x3 = t;
+ if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;
+ if (x1 > x4) t = e1, e1 = e4, e4 = t, t = x1, x1 = x4, x4 = t;
+ if (x3 > x4) t = e3, e3 = e4, e4 = t, t = x3, x3 = x4, x4 = t;
+ if (x2 > x5) t = e2, e2 = e5, e5 = t, t = x2, x2 = x5, x5 = t;
+ if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;
+ if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;
+
+ var pivot1 = e2, pivotValue1 = x2,
+ pivot2 = e4, pivotValue2 = x4;
+
+ // e2 and e4 have been saved in the pivot variables. They will be written
+ // back, once the partitioning is finished.
+ a[i1] = e1;
+ a[i2] = a[lo];
+ a[i3] = e3;
+ a[i4] = a[hi - 1];
+ a[i5] = e5;
+
+ var less = lo + 1, // First element in the middle partition.
+ great = hi - 2; // Last element in the middle partition.
+
+ // Note that for value comparison, <, <=, >= and > coerce to a primitive via
+ // Object.prototype.valueOf; == and === do not, so in order to be consistent
+ // with natural order (such as for Date objects), we must do two compares.
+ var pivotsEqual = pivotValue1 <= pivotValue2 && pivotValue1 >= pivotValue2;
+ if (pivotsEqual) {
+
+ // Degenerated case where the partitioning becomes a dutch national flag
+ // problem.
+ //
+ // [ | < pivot | == pivot | unpartitioned | > pivot | ]
+ // ^ ^ ^ ^ ^
+ // left less k great right
+ //
+ // a[left] and a[right] are undefined and are filled after the
+ // partitioning.
+ //
+ // Invariants:
+ // 1) for x in ]left, less[ : x < pivot.
+ // 2) for x in [less, k[ : x == pivot.
+ // 3) for x in ]great, right[ : x > pivot.
+ for (var k = less; k <= great; ++k) {
+ var ek = a[k], xk = f(ek);
+ if (xk < pivotValue1) {
+ if (k !== less) {
+ a[k] = a[less];
+ a[less] = ek;
+ }
+ ++less;
+ } else if (xk > pivotValue1) {
+
+ // Find the first element <= pivot in the range [k - 1, great] and
+ // put [:ek:] there. We know that such an element must exist:
+ // When k == less, then el3 (which is equal to pivot) lies in the
+ // interval. Otherwise a[k - 1] == pivot and the search stops at k-1.
+ // Note that in the latter case invariant 2 will be violated for a
+ // short amount of time. The invariant will be restored when the
+ // pivots are put into their final positions.
+ while (true) {
+ var greatValue = f(a[great]);
+ if (greatValue > pivotValue1) {
+ great--;
+ // This is the only location in the while-loop where a new
+ // iteration is started.
+ continue;
+ } else if (greatValue < pivotValue1) {
+ // Triple exchange.
+ a[k] = a[less];
+ a[less++] = a[great];
+ a[great--] = ek;
+ break;
+ } else {
+ a[k] = a[great];
+ a[great--] = ek;
+ // Note: if great < k then we will exit the outer loop and fix
+ // invariant 2 (which we just violated).
+ break;
+ }
+ }
+ }
+ }
+ } else {
+
+ // We partition the list into three parts:
+ // 1. < pivot1
+ // 2. >= pivot1 && <= pivot2
+ // 3. > pivot2
+ //
+ // During the loop we have:
+ // [ | < pivot1 | >= pivot1 && <= pivot2 | unpartitioned | > pivot2 | ]
+ // ^ ^ ^ ^ ^
+ // left less k great right
+ //
+ // a[left] and a[right] are undefined and are filled after the
+ // partitioning.
+ //
+ // Invariants:
+ // 1. for x in ]left, less[ : x < pivot1
+ // 2. for x in [less, k[ : pivot1 <= x && x <= pivot2
+ // 3. for x in ]great, right[ : x > pivot2
+ for (var k = less; k <= great; k++) {
+ var ek = a[k], xk = f(ek);
+ if (xk < pivotValue1) {
+ if (k !== less) {
+ a[k] = a[less];
+ a[less] = ek;
+ }
+ ++less;
+ } else {
+ if (xk > pivotValue2) {
+ while (true) {
+ var greatValue = f(a[great]);
+ if (greatValue > pivotValue2) {
+ great--;
+ if (great < k) break;
+ // This is the only location inside the loop where a new
+ // iteration is started.
+ continue;
+ } else {
+ // a[great] <= pivot2.
+ if (greatValue < pivotValue1) {
+ // Triple exchange.
+ a[k] = a[less];
+ a[less++] = a[great];
+ a[great--] = ek;
+ } else {
+ // a[great] >= pivot1.
+ a[k] = a[great];
+ a[great--] = ek;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Move pivots into their final positions.
+ // We shrunk the list from both sides (a[left] and a[right] have
+ // meaningless values in them) and now we move elements from the first
+ // and third partition into these locations so that we can store the
+ // pivots.
+ a[lo] = a[less - 1];
+ a[less - 1] = pivot1;
+ a[hi - 1] = a[great + 1];
+ a[great + 1] = pivot2;
+
+ // The list is now partitioned into three partitions:
+ // [ < pivot1 | >= pivot1 && <= pivot2 | > pivot2 ]
+ // ^ ^ ^ ^
+ // left less great right
+
+ // Recursive descent. (Don't include the pivot values.)
+ sort(a, lo, less - 1);
+ sort(a, great + 2, hi);
+
+ if (pivotsEqual) {
+ // All elements in the second partition are equal to the pivot. No
+ // need to sort them.
+ return a;
+ }
+
+ // In theory it should be enough to call _doSort recursively on the second
+ // partition.
+ // The Android source however removes the pivot elements from the recursive
+ // call if the second partition is too large (more than 2/3 of the list).
+ if (less < i1 && great > i5) {
+ var lessValue, greatValue;
+ while ((lessValue = f(a[less])) <= pivotValue1 && lessValue >= pivotValue1) ++less;
+ while ((greatValue = f(a[great])) <= pivotValue2 && greatValue >= pivotValue2) --great;
+
+ // Copy paste of the previous 3-way partitioning with adaptions.
+ //
+ // We partition the list into three parts:
+ // 1. == pivot1
+ // 2. > pivot1 && < pivot2
+ // 3. == pivot2
+ //
+ // During the loop we have:
+ // [ == pivot1 | > pivot1 && < pivot2 | unpartitioned | == pivot2 ]
+ // ^ ^ ^
+ // less k great
+ //
+ // Invariants:
+ // 1. for x in [ *, less[ : x == pivot1
+ // 2. for x in [less, k[ : pivot1 < x && x < pivot2
+ // 3. for x in ]great, * ] : x == pivot2
+ for (var k = less; k <= great; k++) {
+ var ek = a[k], xk = f(ek);
+ if (xk <= pivotValue1 && xk >= pivotValue1) {
+ if (k !== less) {
+ a[k] = a[less];
+ a[less] = ek;
+ }
+ less++;
+ } else {
+ if (xk <= pivotValue2 && xk >= pivotValue2) {
+ while (true) {
+ var greatValue = f(a[great]);
+ if (greatValue <= pivotValue2 && greatValue >= pivotValue2) {
+ great--;
+ if (great < k) break;
+ // This is the only location inside the loop where a new
+ // iteration is started.
+ continue;
+ } else {
+ // a[great] < pivot2.
+ if (greatValue < pivotValue1) {
+ // Triple exchange.
+ a[k] = a[less];
+ a[less++] = a[great];
+ a[great--] = ek;
+ } else {
+ // a[great] == pivot1.
+ a[k] = a[great];
+ a[great--] = ek;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // The second partition has now been cleared of pivot elements and looks
+ // as follows:
+ // [ * | > pivot1 && < pivot2 | * ]
+ // ^ ^
+ // less great
+ // Sort the second partition using recursive descent.
+
+ // The second partition looks as follows:
+ // [ * | >= pivot1 && <= pivot2 | * ]
+ // ^ ^
+ // less great
+ // Simply sort it by recursive descent.
+
+ return sort(a, less, great + 1);
+ }
+
+ return sort;
+}
+
+var quicksort_sizeThreshold = 32;
+var crossfilter_array8 = crossfilter_arrayUntyped,
+ crossfilter_array16 = crossfilter_arrayUntyped,
+ crossfilter_array32 = crossfilter_arrayUntyped,
+ crossfilter_arrayLengthen = crossfilter_identity,
+ crossfilter_arrayWiden = crossfilter_identity;
+
+if (typeof Uint8Array !== "undefined") {
+ crossfilter_array8 = function(n) { return new Uint8Array(n); };
+ crossfilter_array16 = function(n) { return new Uint16Array(n); };
+ crossfilter_array32 = function(n) { return new Uint32Array(n); };
+
+ crossfilter_arrayLengthen = function(array, length) {
+ var copy = new array.constructor(length);
+ copy.set(array);
+ return copy;
+ };
+
+ crossfilter_arrayWiden = function(array, width) {
+ var copy;
+ switch (width) {
+ case 16: copy = crossfilter_array16(array.length); break;
+ case 32: copy = crossfilter_array32(array.length); break;
+ default: throw new Error("invalid array width!");
+ }
+ copy.set(array);
+ return copy;
+ };
+}
+
+function crossfilter_arrayUntyped(n) {
+ return new Array(n);
+}
+function crossfilter_filterExact(bisect, value) {
+ return function(values) {
+ var n = values.length;
+ return [bisect.left(values, value, 0, n), bisect.right(values, value, 0, n)];
+ };
+}
+
+function crossfilter_filterRange(bisect, range) {
+ var min = range[0],
+ max = range[1];
+ return function(values) {
+ var n = values.length;
+ return [bisect.left(values, min, 0, n), bisect.left(values, max, 0, n)];
+ };
+}
+
+function crossfilter_filterAll(values) {
+ return [0, values.length];
+}
+function crossfilter_null() {
+ return null;
+}
+function crossfilter_zero() {
+ return 0;
+}
+function crossfilter_reduceIncrement(p) {
+ return p + 1;
+}
+
+function crossfilter_reduceDecrement(p) {
+ return p - 1;
+}
+
+function crossfilter_reduceAdd(f) {
+ return function(p, v) {
+ return p + +f(v);
+ };
+}
+
+function crossfilter_reduceSubtract(f) {
+ return function(p, v) {
+ return p - f(v);
+ };
+}
+exports.crossfilter = crossfilter;
+
+function crossfilter() {
+ var crossfilter = {
+ add: add,
+ dimension: dimension,
+ groupAll: groupAll,
+ size: size
+ };
+
+ var data = [], // the records
+ n = 0, // the number of records; data.length
+ m = 0, // number of dimensions in use
+ M = 8, // number of dimensions that can fit in `filters`
+ filters = crossfilter_array8(0), // M bits per record; 1 is filtered out
+ filterListeners = [], // when the filters change
+ dataListeners = []; // when data is added
+
+ // Adds the specified new records to this crossfilter.
+ function add(newData) {
+ var n0 = n,
+ n1 = newData.length;
+
+ // If there's actually new data to add…
+ // Merge the new data into the existing data.
+ // Lengthen the filter bitset to handle the new records.
+ // Notify listeners (dimensions and groups) that new data is available.
+ if (n1) {
+ data = data.concat(newData);
+ filters = crossfilter_arrayLengthen(filters, n += n1);
+ dataListeners.forEach(function(l) { l(newData, n0, n1); });
+ }
+
+ return crossfilter;
+ }
+
+ // Adds a new dimension with the specified value accessor function.
+ function dimension(value) {
+ var dimension = {
+ filter: filter,
+ filterExact: filterExact,
+ filterRange: filterRange,
+ filterAll: filterAll,
+ top: top,
+ group: group,
+ groupAll: groupAll
+ };
+
+ var one = 1 << m++, // bit mask, e.g., 00001000
+ zero = ~one, // inverted one, e.g., 11110111
+ values, // sorted, cached array
+ index, // value rank ↦ object id
+ newValues, // temporary array storing newly-added values
+ newIndex, // temporary array storing newly-added index
+ sort = quicksort_by(function(i) { return newValues[i]; }),
+ refilter = crossfilter_filterAll, // for recomputing filter
+ indexListeners = [], // when data is added
+ lo0 = 0,
+ hi0 = 0;
+
+ // Updating a dimension is a two-stage process. First, we must update the
+ // associated filters for the newly-added records. Once all dimensions have
+ // updated their filters, the groups are notified to update.
+ dataListeners.unshift(preAdd);
+ dataListeners.push(postAdd);
+
+ // Incorporate any existing data into this dimension, and make sure that the
+ // filter bitset is wide enough to handle the new dimension.
+ if (m > M) filters = crossfilter_arrayWiden(filters, M <<= 1);
+ preAdd(data, 0, n);
+ postAdd(data, 0, n);
+
+ // Incorporates the specified new records into this dimension.
+ // This function is responsible for updating filters, values, and index.
+ function preAdd(newData, n0, n1) {
+
+ // Permute new values into natural order using a sorted index.
+ newValues = newData.map(value);
+ newIndex = sort(crossfilter_range(n1), 0, n1);
+ newValues = permute(newValues, newIndex);
+
+ // Bisect newValues to determine which new records are selected.
+ var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1], i;
+ for (i = 0; i < lo1; ++i) filters[newIndex[i] + n0] |= one;
+ for (i = hi1; i < n1; ++i) filters[newIndex[i] + n0] |= one;
+
+ // If this dimension previously had no data, then we don't need to do the
+ // more expensive merge operation; use the new values and index as-is.
+ if (!n0) {
+ values = newValues;
+ index = newIndex;
+ lo0 = lo1;
+ hi0 = hi1;
+ return;
+ }
+
+ var oldValues = values,
+ oldIndex = index,
+ i0 = 0,
+ i1 = 0;
+
+ // Otherwise, create new arrays into which to merge new and old.
+ values = new Array(n);
+ index = crossfilter_index(n, n);
+
+ // Merge the old and new sorted values, and old and new index.
+ for (i = 0; i0 < n0 && i1 < n1; ++i) {
+ if (oldValues[i0] < newValues[i1]) {
+ values[i] = oldValues[i0];
+ index[i] = oldIndex[i0++];
+ } else {
+ values[i] = newValues[i1];
+ index[i] = newIndex[i1++] + n0;
+ }
+ }
+
+ // Add any remaining old values.
+ for (; i0 < n0; ++i0, ++i) {
+ values[i] = oldValues[i0];
+ index[i] = oldIndex[i0];
+ }
+
+ // Add any remaining new values.
+ for (; i1 < n1; ++i1, ++i) {
+ values[i] = newValues[i1];
+ index[i] = newIndex[i1] + n0;
+ }
+
+ // Bisect again to recompute lo0 and hi0.
+ bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1];
+ }
+
+ // When all filters have updated, notify index listeners of the new values.
+ function postAdd(newData, n0, n1) {
+ indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); });
+ newValues = newIndex = null;
+ }
+
+ // Updates the selected values based on the specified bounds [lo, hi].
+ // This implementation is used by all the public filter methods.
+ function filterIndex(bounds) {
+ var i,
+ j,
+ k,
+ lo1 = bounds[0],
+ hi1 = bounds[1],
+ added = [],
+ removed = [];
+
+ // Fast incremental update based on previous lo index.
+ if (lo1 < lo0) {
+ for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {
+ filters[k = index[i]] ^= one;
+ added.push(k);
+ }
+ } else if (lo1 > lo0) {
+ for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {
+ filters[k = index[i]] ^= one;
+ removed.push(k);
+ }
+ }
+
+ // Fast incremental update based on previous hi index.
+ if (hi1 > hi0) {
+ for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {
+ filters[k = index[i]] ^= one;
+ added.push(k);
+ }
+ } else if (hi1 < hi0) {
+ for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {
+ filters[k = index[i]] ^= one;
+ removed.push(k);
+ }
+ }
+
+ lo0 = lo1;
+ hi0 = hi1;
+ filterListeners.forEach(function(l) { l(one, added, removed); });
+ return dimension;
+ }
+
+ // Filters this dimension using the specified range, value, or null.
+ // If the range is null, this is equivalent to filterAll.
+ // If the range is an array, this is equivalent to filterRange.
+ // Otherwise, this is equivalent to filterExact.
+ function filter(range) {
+ return range == null
+ ? filterAll() : Array.isArray(range)
+ ? filterRange(range)
+ : filterExact(range);
+ }
+
+ // Filters this dimension to select the exact value.
+ function filterExact(value) {
+ return filterIndex((refilter = crossfilter_filterExact(bisect, value))(values));
+ }
+
+ // Filters this dimension to select the specified range [lo, hi].
+ // The lower bound is inclusive, and the upper bound is exclusive.
+ function filterRange(range) {
+ return filterIndex((refilter = crossfilter_filterRange(bisect, range))(values));
+ }
+
+ // Clears any filters on this dimension.
+ function filterAll() {
+ return filterIndex((refilter = crossfilter_filterAll)(values));
+ }
+
+ // Returns the top K selected records, based on this dimension's order.
+ // Note: observes this dimension's filter, unlike group and groupAll.
+ function top(k) {
+ var array = [],
+ i = hi0,
+ j;
+
+ while (--i >= lo0 && k > 0) {
+ if (!filters[j = index[i]]) {
+ array.push(data[j]);
+ --k;
+ }
+ }
+
+ return array;
+ }
+
+ // Adds a new group to this dimension, using the specified key function.
+ function group(key) {
+ var group = {
+ top: top,
+ all: all,
+ reduce: reduce,
+ reduceCount: reduceCount,
+ reduceSum: reduceSum,
+ order: order,
+ orderNatural: orderNatural,
+ size: size
+ };
+
+ var groups, // array of {key, value}
+ groupIndex, // object id ↦ group id
+ groupWidth = 8,
+ groupCapacity = crossfilter_capacity(groupWidth),
+ k = 0, // cardinality
+ select,
+ heap,
+ reduceAdd,
+ reduceRemove,
+ reduceInitial,
+ update = crossfilter_null,
+ reset = crossfilter_null,
+ resetNeeded = true;
+
+ if (arguments.length < 1) key = crossfilter_identity;
+
+ // The group listens to the crossfilter for when any dimension changes, so
+ // that it can update the associated reduce values. It must also listen to
+ // the parent dimension for when data is added, and compute new keys.
+ filterListeners.push(update);
+ indexListeners.push(add);
+
+ // Incorporate any existing data into the grouping.
+ add(values, index, 0, n);
+
+ // Incorporates the specified new values into this group.
+ // This function is responsible for updating groups and groupIndex.
+ function add(newValues, newIndex, n0, n1) {
+ var oldGroups = groups,
+ reIndex = crossfilter_index(k, groupCapacity),
+ add = reduceAdd,
+ initial = reduceInitial,
+ k0 = k, // old cardinality
+ i0 = 0, // index of old group
+ i1 = 0, // index of new record
+ j, // object id
+ g0, // old group
+ x0, // old key
+ x1, // new key
+ g, // group to add
+ x; // key of group to add
+
+ // If a reset is needed, we don't need to update the reduce values.
+ if (resetNeeded) add = initial = crossfilter_null;
+
+ // Reset the new groups (k is a lower bound).
+ // Also, make sure that groupIndex exists and is long enough.
+ groups = new Array(k), k = 0;
+ groupIndex = k0 > 1 ? crossfilter_arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity);
+
+ // Get the first old key (x0 of g0), if it exists.
+ if (k0) x0 = (g0 = oldGroups[0]).key;
+
+ // Find the first new key (x1), skipping NaN keys.
+ while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;
+
+ // While new keys remain…
+ while (i1 < n1) {
+
+ // Determine the lesser of the two current keys; new and old.
+ // If there are no old keys remaining, then always add the new key.
+ if (g0 && x0 <= x1) {
+ g = g0, x = x0;
+
+ // Record the new index of the old group.
+ reIndex[i0] = k;
+
+ // Retrieve the next old key.
+ if (g0 = oldGroups[++i0]) x0 = g0.key;
+ } else {
+ g = {key: x1, value: initial()}, x = x1;
+ }
+
+ // Add the lesser group.
+ groups[k] = g;
+
+ // Add any selected records belonging to the added group, while
+ // advancing the new key and populating the associated group index.
+ while (!(x1 > x)) {
+ groupIndex[j = newIndex[i1] + n0] = k;
+ if (!(filters[j] & zero)) g.value = add(g.value, data[j]);
+ if (++i1 >= n1) break;
+ x1 = key(newValues[i1]);
+ }
+
+ groupIncrement();
+ }
+
+ // Add any remaining old groups that were greater than all new keys.
+ // No incremental reduce is needed; these groups have no new records.
+ // Also record the new index of the old group.
+ while (i0 < k0) {
+ groups[reIndex[i0] = k] = oldGroups[i0++];
+ groupIncrement();
+ }
+
+ // If we added any new groups before any old groups,
+ // update the group index of all the old records.
+ if (k > i0) for (i0 = 0; i0 < n0; ++i0) {
+ groupIndex[i0] = reIndex[groupIndex[i0]];
+ }
+
+ // Modify the update and reset behavior based on the cardinality.
+ // If the cardinality is less than or equal to one, then the groupIndex
+ // is not needed. If the cardinality is zero, then there are no records
+ // and therefore no groups to update or reset. Note that we also must
+ // change the registered listener to point to the new method.
+ j = filterListeners.indexOf(update);
+ if (k > 1) {
+ update = updateMany;
+ reset = resetMany;
+ } else {
+ if (k === 1) {
+ update = updateOne;
+ reset = resetOne;
+ } else {
+ update = crossfilter_null;
+ reset = crossfilter_null;
+ }
+ groupIndex = null;
+ }
+ filterListeners[j] = update;
+
+ // Count the number of added groups,
+ // and widen the group index as needed.
+ function groupIncrement() {
+ if (++k === groupCapacity) {
+ reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1);
+ groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth);
+ groupCapacity = crossfilter_capacity(groupWidth);
+ }
+ }
+ }
+
+ // Reduces the specified selected or deselected records.
+ // This function is only used when the cardinality is greater than 1.
+ function updateMany(filterOne, added, removed) {
+ if (filterOne === one || resetNeeded) return;
+
+ var i,
+ k,
+ n,
+ g;
+
+ // Add the added values.
+ for (i = 0, n = added.length; i < n; ++i) {
+ if (!(filters[k = added[i]] & zero)) {
+ g = groups[groupIndex[k]];
+ g.value = reduceAdd(g.value, data[k]);
+ }
+ }
+
+ // Remove the removed values.
+ for (i = 0, n = removed.length; i < n; ++i) {
+ if ((filters[k = removed[i]] & zero) === filterOne) {
+ g = groups[groupIndex[k]];
+ g.value = reduceRemove(g.value, data[k]);
+ }
+ }
+ }
+
+ // Reduces the specified selected or deselected records.
+ // This function is only used when the cardinality is 1.
+ function updateOne(filterOne, added, removed) {
+ if (filterOne === one || resetNeeded) return;
+
+ var i,
+ k,
+ n,
+ g = groups[0];
+
+ // Add the added values.
+ for (i = 0, n = added.length; i < n; ++i) {
+ if (!(filters[k = added[i]] & zero)) {
+ g.value = reduceAdd(g.value, data[k]);
+ }
+ }
+
+ // Remove the removed values.
+ for (i = 0, n = removed.length; i < n; ++i) {
+ if ((filters[k = removed[i]] & zero) === filterOne) {
+ g.value = reduceRemove(g.value, data[k]);
+ }
+ }
+ }
+
+ // Recomputes the group reduce values from scratch.
+ // This function is only used when the cardinality is greater than 1.
+ function resetMany() {
+ var i,
+ g;
+
+ // Reset all group values.
+ for (i = 0; i < k; ++i) {
+ groups[i].value = reduceInitial();
+ }
+
+ // Add any selected records.
+ for (i = 0; i < n; ++i) {
+ if (!(filters[i] & zero)) {
+ g = groups[groupIndex[i]];
+ g.value = reduceAdd(g.value, data[i]);
+ }
+ }
+ }
+
+ // Recomputes the group reduce values from scratch.
+ // This function is only used when the cardinality is 1.
+ function resetOne() {
+ var i,
+ g = groups[0];
+
+ // Reset the singleton group values.
+ g.value = reduceInitial();
+
+ // Add any selected records.
+ for (i = 0; i < n; ++i) {
+ if (!(filters[i] & zero)) {
+ g.value = reduceAdd(g.value, data[i]);
+ }
+ }
+ }
+
+ // Returns the array of group values, in the dimension's natural order.
+ function all() {
+ if (resetNeeded) reset(), resetNeeded = false;
+ return groups;
+ }
+
+ // Returns a new array containing the top K group values, in reduce order.
+ function top(k) {
+ var top = select(all(), 0, groups.length, k);
+ return heap.sort(top, 0, top.length);
+ }
+
+ // Sets the reduce behavior for this group to use the specified functions.
+ // This method lazily recomputes the reduce values, waiting until needed.
+ function reduce(add, remove, initial) {
+ reduceAdd = add;
+ reduceRemove = remove;
+ reduceInitial = initial;
+ resetNeeded = true;
+ return group;
+ }
+
+ // A convenience method for reducing by count.
+ function reduceCount() {
+ return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);
+ }
+
+ // A convenience method for reducing by sum(value).
+ function reduceSum(value) {
+ return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);
+ }
+
+ // Sets the reduce order, using the specified accessor.
+ function order(value) {
+ select = heapselect_by(valueOf);
+ heap = heap_by(valueOf);
+ function valueOf(d) { return value(d.value); }
+ return group;
+ }
+
+ // A convenience method for natural ordering by reduce value.
+ function orderNatural() {
+ return order(crossfilter_identity);
+ }
+
+ // Returns the cardinality of this group, irrespective of any filters.
+ function size() {
+ return k;
+ }
+
+ return reduceCount().orderNatural();
+ }
+
+ // A convenience function for generating a singleton group.
+ function groupAll() {
+ var g = group(crossfilter_null), all = g.all;
+ delete g.all;
+ delete g.top;
+ delete g.order;
+ delete g.orderNatural;
+ delete g.size;
+ g.value = function() { return all()[0].value; };
+ return g;
+ }
+
+ return dimension;
+ }
+
+ // A convenience method for groupAll on a dummy dimension.
+ // This implementation can be optimized since it is always cardinality 1.
+ function groupAll() {
+ var group = {
+ reduce: reduce,
+ reduceCount: reduceCount,
+ reduceSum: reduceSum,
+ value: value
+ };
+
+ var reduceValue,
+ reduceAdd,
+ reduceRemove,
+ reduceInitial,
+ resetNeeded = true;
+
+ // The group listens to the crossfilter for when any dimension changes, so
+ // that it can update the reduce value. It must also listen to the parent
+ // dimension for when data is added.
+ filterListeners.push(update);
+ dataListeners.push(add);
+
+ // For consistency; actually a no-op since resetNeeded is true.
+ add(data, 0, n);
+
+ // Incorporates the specified new values into this group.
+ function add(newData, n0, n1) {
+ var i;
+
+ if (resetNeeded) return;
+
+ // Add the added values.
+ for (i = n0; i < n; ++i) {
+ if (!filters[i]) {
+ reduceValue = reduceAdd(reduceValue, data[i]);
+ }
+ }
+ }
+
+ // Reduces the specified selected or deselected records.
+ function update(filterOne, added, removed) {
+ var i,
+ k,
+ n;
+
+ if (resetNeeded) return;
+
+ // Add the added values.
+ for (i = 0, n = added.length; i < n; ++i) {
+ if (!filters[k = added[i]]) {
+ reduceValue = reduceAdd(reduceValue, data[k]);
+ }
+ }
+
+ // Remove the removed values.
+ for (i = 0, n = removed.length; i < n; ++i) {
+ if (filters[k = removed[i]] === filterOne) {
+ reduceValue = reduceRemove(reduceValue, data[k]);
+ }
+ }
+ }
+
+ // Recomputes the group reduce value from scratch.
+ function reset() {
+ var i;
+
+ reduceValue = reduceInitial();
+
+ for (i = 0; i < n; ++i) {
+ if (!filters[i]) {
+ reduceValue = reduceAdd(reduceValue, data[i]);
+ }
+ }
+ }
+
+ // Sets the reduce behavior for this group to use the specified functions.
+ // This method lazily recomputes the reduce value, waiting until needed.
+ function reduce(add, remove, initial) {
+ reduceAdd = add;
+ reduceRemove = remove;
+ reduceInitial = initial;
+ resetNeeded = true;
+ return group;
+ }
+
+ // A convenience method for reducing by count.
+ function reduceCount() {
+ return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);
+ }
+
+ // A convenience method for reducing by sum(value).
+ function reduceSum(value) {
+ return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);
+ }
+
+ // Returns the computed reduce value.
+ function value() {
+ if (resetNeeded) reset(), resetNeeded = false;
+ return reduceValue;
+ }
+
+ return reduceCount();
+ }
+
+ // Returns the number of records in this crossfilter, irrespective of any filters.
+ function size() {
+ return n;
+ }
+
+ return arguments.length
+ ? add(arguments[0])
+ : crossfilter;
+}
+
+// Returns an array of size n, big enough to store ids up to m.
+function crossfilter_index(n, m) {
+ return (m < 0x101
+ ? crossfilter_array8 : m < 0x10001
+ ? crossfilter_array16
+ : crossfilter_array32)(n);
+}
+
+// Constructs a new array of size n, with sequential values from 0 to n - 1.
+function crossfilter_range(n) {
+ var range = crossfilter_index(n, n);
+ for (var i = -1; ++i < n;) range[i] = i;
+ return range;
+}
+
+function crossfilter_capacity(w) {
+ return w === 8
+ ? 0x100 : w === 16
+ ? 0x10000
+ : 0x100000000;
+}
+})(this);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.min.js
new file mode 100644
index 00000000..981f0d64
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.min.js
@@ -0,0 +1 @@
+(function(a){function b(a){return a}function c(a,b){for(var c=0,d=b.length,e=new Array(d);c<d;++c)e[c]=a[b[c]];return e}function e(a){function b(b,c,d,e){while(d<e){var f=d+e>>1;a(b[f])<c?d=f+1:e=f}return d}function c(b,c,d,e){while(d<e){var f=d+e>>1;c<a(b[f])?e=f:d=f+1}return d}return c.right=c,c.left=b,c}function g(a){function b(a,b,c){var e=c-b,f=(e>>>1)+1;while(--f>0)d(a,f,e,b);return a}function c(a,b,c){var e=c-b,f;while(--e>0)f=a[b],a[b]=a[b+e],a[b+e]=f,d(a,1,e,b);return a}function d(b,c,d,e){var f=b[--e+c],g=a(f),h;while((h=c<<1)<=d){h<d&&a(b[e+h])>a(b[e+h+1])&&h++;if(g<=a(b[e+h]))break;b[e+c]=b[e+h],c=h}b[e+c]=f}return b.sort=c,b}function i(a){function c(c,d,e,f){var g=new Array(f=Math.min(e-d,f)),h,i,j,k;for(i=0;i<f;++i)g[i]=c[d++];b(g,0,f);if(d<e){h=a(g[0]);do if(j=a(k=c[d])>h)g[0]=k,h=a(b(g,0,f)[0]);while(++d<e)}return g}var b=g(a);return c}function k(a){function b(b,c,d){for(var e=c+1;e<d;++e){for(var f=e,g=b[e],h=a(g);f>c&&a(b[f-1])>h;--f)b[f]=b[f-1];b[f]=g}return b}return b}function m(a){function c(a,c,e){return(e-c<n?b:d)(a,c,e)}function d(b,d,e){var f=(e-d)/6|0,g=d+f,h=e-1-f,i=d+e-1>>1,j=i-f,k=i+f,l=b[g],m=a(l),n=b[j],o=a(n),p=b[i],q=a(p),r=b[k],s=a(r),t=b[h],u=a(t),v;m>o&&(v=l,l=n,n=v,v=m,m=o,o=v),s>u&&(v=r,r=t,t=v,v=s,s=u,u=v),m>q&&(v=l,l=p,p=v,v=m,m=q,q=v),o>q&&(v=n,n=p,p=v,v=o,o=q,q=v),m>s&&(v=l,l=r,r=v,v=m,m=s,s=v),q>s&&(v=p,p=r,r=v,v=q,q=s,s=v),o>u&&(v=n,n=t,t=v,v=o,o=u,u=v),o>q&&(v=n,n=p,p=v,v=o,o=q,q=v),s>u&&(v=r,r=t,t=v,v=s,s=u,u=v);var w=n,x=o,y=r,z=s;b[g]=l,b[j]=b[d],b[i]=p,b[k]=b[e-1],b[h]=t;var A=d+1,B=e-2,C=x<=z&&x>=z;if(C)for(var D=A;D<=B;++D){var E=b[D],F=a(E);if(F<x)D!==A&&(b[D]=b[A],b[A]=E),++A;else if(F>x)for(;;){var G=a(b[B]);if(G>x){B--;continue}if(G<x){b[D]=b[A],b[A++]=b[B],b[B--]=E;break}b[D]=b[B],b[B--]=E;break}}else for(var D=A;D<=B;D++){var E=b[D],F=a(E);if(F<x)D!==A&&(b[D]=b[A],b[A]=E),++A;else if(F>z)for(;;){var G=a(b[B]);if(G>z){B--;if(B<D)break;continue}G<x?(b[D]=b[A],b[A++]=b[B],b[B--]=E):(b[D]=b[B],b[B--]=E);break}}b[d]=b[A-1],b[A-1]=w,b[e-1]=b[B+1],b[B+1]=y,c(b,d,A-1),c(b,B+2,e);if(C)return b;if(A<g&&B>h){var H,G;while((H=a(b[A]))<=x&&H>=x)++A;while((G=a(b[B]))<=z&&G>=z)--B;for(var D=A;D<=B;D++){var E=b[D],F=a(E);if(F<=x&&F>=x)D!==A&&(b[D]=b[A],b[A]=E),A++;else if(F<=z&&F>=z)for(;;){var G=a(b[B]);if(G<=z&&G>=z){B--;if(B<D)break;continue}G<x?(b[D]=b[A],b[A++]=b[B],b[B--]=E):(b[D]=b[B],b[B--]=E);break}}}return c(b,A,B+1)}var b=k(a);return c}function t(a){return new Array(a)}function u(a,b){return function(c){var d=c.length;return[a.left(c,b,0,d),a.right(c,b,0,d)]}}function v(a,b){var c=b[0],d=b[1];return function(b){var e=b.length;return[a.left(b,c,0,e),a.left(b,d,0,e)]}}function w(a){return[0,a.length]}function x(){return null}function y(){return 0}function z(a){return a+1}function A(a){return a-1}function B(a){return function(b,c){return b+ +a(c)}}function C(a){return function(b,c){return b-a(c)}}function D(){function p(b){var c=f,d=b.length;return d&&(e=e.concat(b),k=r(k,f+=d),n.forEach(function(a){a(b,c,d)})),a}function q(a){function P(b,d,e){H=b.map(a),I=J(F(e),0,e),H=c(H,I);var g=K(H),h=g[0],i=g[1],j;for(j=0;j<h;++j)k[I[j]+d]|=p;for(j=i;j<e;++j)k[I[j]+d]|=p;if(!d){t=H,D=I,N=h,O=i;return}var l=t,m=D,n=0,o=0;t=new Array(f),D=E(f,f);for(j=0;n<d&&o<e;++j)l[n]<H[o]?(t[j]=l[n],D[j]=m[n++]):(t[j]=H[o],D[j]=I[o++]+d);for(;n<d;++n,++j)t[j]=l[n],D[j]=m[n];for(;o<e;++o,++j)t[j]=H[o],D[j]=I[o]+d;g=K(t),N=g[0],O=g[1]}function Q(a,b,c){L.forEach(function(a){a(H,I,b,c)}),H=I=null}function R(a){var b,c,d,e=a[0],f=a[1],g=[],h=[];if(e<N)for(b=e,c=Math.min(N,f);b<c;++b)k[d=D[b]]^=p,g.push(d);else if(e>N)for(b=N,c=Math.min(e,O);b<c;++b)k[d=D[b]]^=p,h.push(d);if(f>O)for(b=Math.max(e,O),c=f;b<c;++b)k[d=D[b]]^=p,g.push(d);else if(f<O)for(b=Math.max(N,f),c=O;b<c;++b)k[d=D[b]]^=p,h.push(d);return N=e,O=f,l.forEach(function(a){a(p,g,h)}),o}function S(a){return a==null?V():Array.isArray(a)?U(a):T(a)}function T(a){return R((K=u(d,a))(t))}function U(a){return R((K=v(d,a))(t))}function V(){return R((K=w)(t))}function W(a){var b=[],c=O,d;while(--c>=N&&a>0)k[d=D[c]]||(b.push(e[d]),--a);return b}function X(a){function K(b,c,g,i){function Q(){++n===m&&(p=s(p,j<<=1),h=s(h,j),m=G(j))}var o=d,p=E(n,m),t=v,u=F,w=n,y=0,z=0,A,B,C,D,K,L;J&&(t=u=x),d=new Array(n),n=0,h=w>1?r(h,f):E(f,m),w&&(C=(B=o[0]).key);while(z<i&&!((D=a(b[z]))>=D))++z;while(z<i){if(B&&C<=D){K=B,L=C,p[y]=n;if(B=o[++y])C=B.key}else K={key:D,value:u()},L=D;d[n]=K;while(!(D>L)){h[A=c[z]+g]=n,k[A]&q||(K.value=t(K.value,e[A]));if(++z>=i)break;D=a(b[z])}Q()}while(y<w)d[p[y]=n]=o[y++],Q();if(n>y)for(y=0;y<g;++y)h[y]=p[h[y]];A=l.indexOf(H),n>1?(H=M,I=O):(n===1?(H=N,I=P):(H=x,I=x),h=null),l[A]=H}function M(a,b,c){if(a===p||J)return;var f,g,i,j;for(f=0,i=b.length;f<i;++f)k[g=b[f]]&q||(j=d[h[g]],j.value=v(j.value,e[g]));for(f=0,i=c.length;f<i;++f)(k[g=c[f]]&q)===a&&(j=d[h[g]],j.value=w(j.value,e[g]))}function N(a,b,c){if(a===p||J)return;var f,g,h,i=d[0];for(f=0,h=b.length;f<h;++f)k[g=b[f]]&q||(i.value=v(i.value,e[g]));for(f=0,h=c.length;f<h;++f)(k[g=c[f]]&q)===a&&(i.value=w(i.value,e[g]))}function O(){var a,b;for(a=0;a<n;++a)d[a].value=F();for(a=0;a<f;++a)k[a]&q||(b=d[h[a]],b.value=v(b.value,e[a]))}function P(){var a,b=d[0];b.value=F();for(a=0;a<f;++a)k[a]&q||(b.value=v(b.value,e[a]))}function Q(){return J&&(I(),J=!1),d}function R(a){var b=o(Q(),0,d.length,a);return u.sort(b,0,b.length)}function S(a,b,d){return v=a,w=b,F=d,J=!0,c}function T(){return S(z,A,y)}function U(a){return S(B(a),C(a),y)}function V(a){function b(b){return a(b.value)}return o=i(b),u=g(b),c}function W(){return V(b)}function X(){return n}var c={top:R,all:Q,reduce:S,reduceCount:T,reduceSum:U,order:V,orderNatural:W,size:X},d,h,j=8,m=G(j),n=0,o,u,v,w,F,H=x,I=x,J=!0;return arguments.length<1&&(a=b),l.push(H),L.push(K),K(t,D,0,f),T().orderNatural()}function Y(){var a=X(x),b=a.all;return delete a.all,delete a.top,delete a.order,delete a.orderNatural,delete a.size,a.value=function(){return b()[0].value},a}var o={filter:S,filterExact:T,filterRange:U,filterAll:V,top:W,group:X,groupAll:Y},p=1<<h++,q=~p,t,D,H,I,J=m(function(a){return H[a]}),K=w,L=[],N=0,O=0;return n.unshift(P),n.push(Q),h>j&&(k=s(k,j<<=1)),P(e,0,f),Q(e,0,f),o}function t(){function i(a,d,g){var i;if(h)return;for(i=d;i<f;++i)k[i]||(b=c(b,e[i]))}function j(a,f,g){var i,j,l;if(h)return;for(i=0,l=f.length;i<l;++i)k[j=f[i]]||(b=c(b,e[j]));for(i=0,l=g.length;i<l;++i)k[j=g[i]]===a&&(b=d(b,e[j]))}function m(){var a;b=g();for(a=0;a<f;++a)k[a]||(b=c(b,e[a]))}function o(b,e,f){return c=b,d=e,g=f,h=!0,a}function p(){return o(z,A,y)}function q(a){return o(B(a),C(a),y)}function r(){return h&&(m(),h=!1),b}var a={reduce:o,reduceCount:p,reduceSum:q,value:r},b,c,d,g,h=!0;return l.push(j),n.push(i),i(e,0,f),p()}function D(){return f}var a={add:p,dimension:q,groupAll:t,size:D},e=[],f=0,h=0,j=8,k=o(0),l=[],n=[];return arguments.length?p(arguments[0]):a}function E(a,b){return(b<257?o:b<65537?p:q)(a)}function F(a){var b=E(a,a);for(var c=-1;++c<a;)b[c]=c;return b}function G(a){return a===8?256:a===16?65536:4294967296}D.version="1.0.3",D.permute=c;var d=D.bisect=e(b);d.by=e;var f=D.heap=g(b);f.by=g;var h=D.heapselect=i(b);h.by=i;var j=D.insertionsort=k(b);j.by=k;var l=D.quicksort=m(b);l.by=m;var n=32,o=t,p=t,q=t,r=b,s=b;typeof Uint8Array!="undefined"&&(o=function(a){return new Uint8Array(a)},p=function(a){return new Uint16Array(a)},q=function(a){return new Uint32Array(a)},r=function(a,b){var c=new a.constructor(b);return c.set(a),c},s=function(a,b){var c;switch(b){case 16:c=p(a.length);break;case 32:c=q(a.length);break;default:throw new Error("invalid array width!")}return c.set(a),c}),a.crossfilter=D})(this); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.geom.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.geom.js
new file mode 100644
index 00000000..a19bb16e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.geom.js
@@ -0,0 +1,816 @@
+(function(){d3.geom = {};
+/**
+ * Computes a contour for a given input grid function using the <a
+ * href="http://en.wikipedia.org/wiki/Marching_squares">marching
+ * squares</a> algorithm. Returns the contour polygon as an array of points.
+ *
+ * @param grid a two-input function(x, y) that returns true for values
+ * inside the contour and false for values outside the contour.
+ * @param start an optional starting point [x, y] on the grid.
+ * @returns polygon [[x1, y1], [x2, y2], …]
+ */
+d3.geom.contour = function(grid, start) {
+ var s = start || d3_geom_contourStart(grid), // starting point
+ c = [], // contour polygon
+ x = s[0], // current x position
+ y = s[1], // current y position
+ dx = 0, // next x direction
+ dy = 0, // next y direction
+ pdx = NaN, // previous x direction
+ pdy = NaN, // previous y direction
+ i = 0;
+
+ do {
+ // determine marching squares index
+ i = 0;
+ if (grid(x-1, y-1)) i += 1;
+ if (grid(x, y-1)) i += 2;
+ if (grid(x-1, y )) i += 4;
+ if (grid(x, y )) i += 8;
+
+ // determine next direction
+ if (i == 6) {
+ dx = pdy == -1 ? -1 : 1;
+ dy = 0;
+ } else if (i == 9) {
+ dx = 0;
+ dy = pdx == 1 ? -1 : 1;
+ } else {
+ dx = d3_geom_contourDx[i];
+ dy = d3_geom_contourDy[i];
+ }
+
+ // update contour polygon
+ if (dx != pdx && dy != pdy) {
+ c.push([x, y]);
+ pdx = dx;
+ pdy = dy;
+ }
+
+ x += dx;
+ y += dy;
+ } while (s[0] != x || s[1] != y);
+
+ return c;
+};
+
+// lookup tables for marching directions
+var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN],
+ d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN];
+
+function d3_geom_contourStart(grid) {
+ var x = 0,
+ y = 0;
+
+ // search for a starting point; begin at origin
+ // and proceed along outward-expanding diagonals
+ while (true) {
+ if (grid(x,y)) {
+ return [x,y];
+ }
+ if (x == 0) {
+ x = y + 1;
+ y = 0;
+ } else {
+ x = x - 1;
+ y = y + 1;
+ }
+ }
+}/**
+ * Computes the 2D convex hull of a set of points using Graham's scanning
+ * algorithm. The algorithm has been implemented as described in Cormen,
+ * Leiserson, and Rivest's Introduction to Algorithms. The running time of
+ * this algorithm is O(n log n), where n is the number of input points.
+ *
+ * @param vertices [[x1, y1], [x2, y2], …]
+ * @returns polygon [[x1, y1], [x2, y2], …]
+ */
+d3.geom.hull = function(vertices) {
+ if (vertices.length < 3) return [];
+
+ var len = vertices.length,
+ plen = len - 1,
+ points = [],
+ stack = [],
+ i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
+
+ // find the starting ref point: leftmost point with the minimum y coord
+ for (i=1; i<len; ++i) {
+ if (vertices[i][1] < vertices[h][1]) {
+ h = i;
+ } else if (vertices[i][1] == vertices[h][1]) {
+ h = (vertices[i][0] < vertices[h][0] ? i : h);
+ }
+ }
+
+ // calculate polar angles from ref point and sort
+ for (i=0; i<len; ++i) {
+ if (i == h) continue;
+ y1 = vertices[i][1] - vertices[h][1];
+ x1 = vertices[i][0] - vertices[h][0];
+ points.push({angle: Math.atan2(y1, x1), index: i});
+ }
+ points.sort(function(a, b) { return a.angle - b.angle; });
+
+ // toss out duplicate angles
+ a = points[0].angle;
+ v = points[0].index;
+ u = 0;
+ for (i=1; i<plen; ++i) {
+ j = points[i].index;
+ if (a == points[i].angle) {
+ // keep angle for point most distant from the reference
+ x1 = vertices[v][0] - vertices[h][0];
+ y1 = vertices[v][1] - vertices[h][1];
+ x2 = vertices[j][0] - vertices[h][0];
+ y2 = vertices[j][1] - vertices[h][1];
+ if ((x1*x1 + y1*y1) >= (x2*x2 + y2*y2)) {
+ points[i].index = -1;
+ } else {
+ points[u].index = -1;
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ } else {
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ }
+
+ // initialize the stack
+ stack.push(h);
+ for (i=0, j=0; i<2; ++j) {
+ if (points[j].index != -1) {
+ stack.push(points[j].index);
+ i++;
+ }
+ }
+ sp = stack.length;
+
+ // do graham's scan
+ for (; j<plen; ++j) {
+ if (points[j].index == -1) continue; // skip tossed out points
+ while (!d3_geom_hullCCW(stack[sp-2], stack[sp-1], points[j].index, vertices)) {
+ --sp;
+ }
+ stack[sp++] = points[j].index;
+ }
+
+ // construct the hull
+ var poly = [];
+ for (i=0; i<sp; ++i) {
+ poly.push(vertices[stack[i]]);
+ }
+ return poly;
+}
+
+// are three points in counter-clockwise order?
+function d3_geom_hullCCW(i1, i2, i3, v) {
+ var t, a, b, c, d, e, f;
+ t = v[i1]; a = t[0]; b = t[1];
+ t = v[i2]; c = t[0]; d = t[1];
+ t = v[i3]; e = t[0]; f = t[1];
+ return ((f-b)*(c-a) - (d-b)*(e-a)) > 0;
+}// Note: requires coordinates to be counterclockwise and convex!
+d3.geom.polygon = function(coordinates) {
+
+ coordinates.area = function() {
+ var i = 0,
+ n = coordinates.length,
+ a = coordinates[n - 1][0] * coordinates[0][1],
+ b = coordinates[n - 1][1] * coordinates[0][0];
+ while (++i < n) {
+ a += coordinates[i - 1][0] * coordinates[i][1];
+ b += coordinates[i - 1][1] * coordinates[i][0];
+ }
+ return (b - a) * .5;
+ };
+
+ coordinates.centroid = function(k) {
+ var i = -1,
+ n = coordinates.length - 1,
+ x = 0,
+ y = 0,
+ a,
+ b,
+ c;
+ if (!arguments.length) k = 1 / (6 * coordinates.area());
+ while (++i < n) {
+ a = coordinates[i];
+ b = coordinates[i + 1];
+ c = a[0] * b[1] - b[0] * a[1];
+ x += (a[0] + b[0]) * c;
+ y += (a[1] + b[1]) * c;
+ }
+ return [x * k, y * k];
+ };
+
+ // The Sutherland-Hodgman clipping algorithm.
+ coordinates.clip = function(subject) {
+ var input,
+ i = -1,
+ n = coordinates.length,
+ j,
+ m,
+ a = coordinates[n - 1],
+ b,
+ c,
+ d;
+ while (++i < n) {
+ input = subject.slice();
+ subject.length = 0;
+ b = coordinates[i];
+ c = input[(m = input.length) - 1];
+ j = -1;
+ while (++j < m) {
+ d = input[j];
+ if (d3_geom_polygonInside(d, a, b)) {
+ if (!d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ subject.push(d);
+ } else if (d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ c = d;
+ }
+ a = b;
+ }
+ return subject;
+ };
+
+ return coordinates;
+};
+
+function d3_geom_polygonInside(p, a, b) {
+ return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
+}
+
+// Intersect two infinite lines cd and ab.
+function d3_geom_polygonIntersect(c, d, a, b) {
+ var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0],
+ y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1],
+ x13 = x1 - x3,
+ x21 = x2 - x1,
+ x43 = x4 - x3,
+ y13 = y1 - y3,
+ y21 = y2 - y1,
+ y43 = y4 - y3,
+ ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21);
+ return [x1 + ua * x21, y1 + ua * y21];
+}
+// Adapted from Nicolas Garcia Belmonte's JIT implementation:
+// http://blog.thejit.org/2010/02/12/voronoi-tessellation/
+// http://blog.thejit.org/assets/voronoijs/voronoi.js
+// See lib/jit/LICENSE for details.
+
+/**
+ * @param vertices [[x1, y1], [x2, y2], …]
+ * @returns polygons [[[x1, y1], [x2, y2], …], …]
+ */
+d3.geom.voronoi = function(vertices) {
+ var polygons = vertices.map(function() { return []; });
+
+ // Note: we expect the caller to clip the polygons, if needed.
+ d3_voronoi_tessellate(vertices, function(e) {
+ var s1,
+ s2,
+ x1,
+ x2,
+ y1,
+ y2;
+ if (e.a == 1 && e.b >= 0) {
+ s1 = e.ep.r;
+ s2 = e.ep.l;
+ } else {
+ s1 = e.ep.l;
+ s2 = e.ep.r;
+ }
+ if (e.a == 1) {
+ y1 = s1 ? s1.y : -1e6;
+ x1 = e.c - e.b * y1;
+ y2 = s2 ? s2.y : 1e6;
+ x2 = e.c - e.b * y2;
+ } else {
+ x1 = s1 ? s1.x : -1e6;
+ y1 = e.c - e.a * x1;
+ x2 = s2 ? s2.x : 1e6;
+ y2 = e.c - e.a * x2;
+ }
+ var v1 = [x1, y1],
+ v2 = [x2, y2];
+ polygons[e.region.l.index].push(v1, v2);
+ polygons[e.region.r.index].push(v1, v2);
+ });
+
+ // Reconnect the polygon segments into counterclockwise loops.
+ return polygons.map(function(polygon, i) {
+ var cx = vertices[i][0],
+ cy = vertices[i][1];
+ polygon.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ return polygon.sort(function(a, b) {
+ return a.angle - b.angle;
+ }).filter(function(d, i) {
+ return !i || (d.angle - polygon[i - 1].angle > 1e-10);
+ });
+ });
+};
+
+var d3_voronoi_opposite = {"l": "r", "r": "l"};
+
+function d3_voronoi_tessellate(vertices, callback) {
+
+ var Sites = {
+ list: vertices
+ .map(function(v, i) {
+ return {
+ index: i,
+ x: v[0],
+ y: v[1]
+ };
+ })
+ .sort(function(a, b) {
+ return a.y < b.y ? -1
+ : a.y > b.y ? 1
+ : a.x < b.x ? -1
+ : a.x > b.x ? 1
+ : 0;
+ }),
+ bottomSite: null
+ };
+
+ var EdgeList = {
+ list: [],
+ leftEnd: null,
+ rightEnd: null,
+
+ init: function() {
+ EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.leftEnd.r = EdgeList.rightEnd;
+ EdgeList.rightEnd.l = EdgeList.leftEnd;
+ EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
+ },
+
+ createHalfEdge: function(edge, side) {
+ return {
+ edge: edge,
+ side: side,
+ vertex: null,
+ "l": null,
+ "r": null
+ };
+ },
+
+ insert: function(lb, he) {
+ he.l = lb;
+ he.r = lb.r;
+ lb.r.l = he;
+ lb.r = he;
+ },
+
+ leftBound: function(p) {
+ var he = EdgeList.leftEnd;
+ do {
+ he = he.r;
+ } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
+ he = he.l;
+ return he;
+ },
+
+ del: function(he) {
+ he.l.r = he.r;
+ he.r.l = he.l;
+ he.edge = null;
+ },
+
+ right: function(he) {
+ return he.r;
+ },
+
+ left: function(he) {
+ return he.l;
+ },
+
+ leftRegion: function(he) {
+ return he.edge == null
+ ? Sites.bottomSite
+ : he.edge.region[he.side];
+ },
+
+ rightRegion: function(he) {
+ return he.edge == null
+ ? Sites.bottomSite
+ : he.edge.region[d3_voronoi_opposite[he.side]];
+ }
+ };
+
+ var Geom = {
+
+ bisect: function(s1, s2) {
+ var newEdge = {
+ region: {"l": s1, "r": s2},
+ ep: {"l": null, "r": null}
+ };
+
+ var dx = s2.x - s1.x,
+ dy = s2.y - s1.y,
+ adx = dx > 0 ? dx : -dx,
+ ady = dy > 0 ? dy : -dy;
+
+ newEdge.c = s1.x * dx + s1.y * dy
+ + (dx * dx + dy * dy) * .5;
+
+ if (adx > ady) {
+ newEdge.a = 1;
+ newEdge.b = dy / dx;
+ newEdge.c /= dx;
+ } else {
+ newEdge.b = 1;
+ newEdge.a = dx / dy;
+ newEdge.c /= dy;
+ }
+
+ return newEdge;
+ },
+
+ intersect: function(el1, el2) {
+ var e1 = el1.edge,
+ e2 = el2.edge;
+ if (!e1 || !e2 || (e1.region.r == e2.region.r)) {
+ return null;
+ }
+ var d = (e1.a * e2.b) - (e1.b * e2.a);
+ if (Math.abs(d) < 1e-10) {
+ return null;
+ }
+ var xint = (e1.c * e2.b - e2.c * e1.b) / d,
+ yint = (e2.c * e1.a - e1.c * e2.a) / d,
+ e1r = e1.region.r,
+ e2r = e2.region.r,
+ el,
+ e;
+ if ((e1r.y < e2r.y) ||
+ (e1r.y == e2r.y && e1r.x < e2r.x)) {
+ el = el1;
+ e = e1;
+ } else {
+ el = el2;
+ e = e2;
+ }
+ var rightOfSite = (xint >= e.region.r.x);
+ if ((rightOfSite && (el.side == "l")) ||
+ (!rightOfSite && (el.side == "r"))) {
+ return null;
+ }
+ return {
+ x: xint,
+ y: yint
+ };
+ },
+
+ rightOf: function(he, p) {
+ var e = he.edge,
+ topsite = e.region.r,
+ rightOfSite = (p.x > topsite.x);
+
+ if (rightOfSite && (he.side == "l")) {
+ return 1;
+ }
+ if (!rightOfSite && (he.side == "r")) {
+ return 0;
+ }
+ if (e.a == 1) {
+ var dyp = p.y - topsite.y,
+ dxp = p.x - topsite.x,
+ fast = 0,
+ above = 0;
+
+ if ((!rightOfSite && (e.b < 0)) ||
+ (rightOfSite && (e.b >= 0))) {
+ above = fast = (dyp >= e.b * dxp);
+ } else {
+ above = ((p.x + p.y * e.b) > e.c);
+ if (e.b < 0) {
+ above = !above;
+ }
+ if (!above) {
+ fast = 1;
+ }
+ }
+ if (!fast) {
+ var dxs = topsite.x - e.region.l.x;
+ above = (e.b * (dxp * dxp - dyp * dyp)) <
+ (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b));
+
+ if (e.b < 0) {
+ above = !above;
+ }
+ }
+ } else /* e.b == 1 */ {
+ var yl = e.c - e.a * p.x,
+ t1 = p.y - yl,
+ t2 = p.x - topsite.x,
+ t3 = yl - topsite.y;
+
+ above = (t1 * t1) > (t2 * t2 + t3 * t3);
+ }
+ return he.side == "l" ? above : !above;
+ },
+
+ endPoint: function(edge, side, site) {
+ edge.ep[side] = site;
+ if (!edge.ep[d3_voronoi_opposite[side]]) return;
+ callback(edge);
+ },
+
+ distance: function(s, t) {
+ var dx = s.x - t.x,
+ dy = s.y - t.y;
+ return Math.sqrt(dx * dx + dy * dy);
+ }
+ };
+
+ var EventQueue = {
+ list: [],
+
+ insert: function(he, site, offset) {
+ he.vertex = site;
+ he.ystar = site.y + offset;
+ for (var i=0, list=EventQueue.list, l=list.length; i<l; i++) {
+ var next = list[i];
+ if (he.ystar > next.ystar ||
+ (he.ystar == next.ystar &&
+ site.x > next.vertex.x)) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ list.splice(i, 0, he);
+ },
+
+ del: function(he) {
+ for (var i=0, ls=EventQueue.list, l=ls.length; i<l && (ls[i] != he); ++i) {}
+ ls.splice(i, 1);
+ },
+
+ empty: function() { return EventQueue.list.length == 0; },
+
+ nextEvent: function(he) {
+ for (var i=0, ls=EventQueue.list, l=ls.length; i<l; ++i) {
+ if (ls[i] == he) return ls[i+1];
+ }
+ return null;
+ },
+
+ min: function() {
+ var elem = EventQueue.list[0];
+ return {
+ x: elem.vertex.x,
+ y: elem.ystar
+ };
+ },
+
+ extractMin: function() {
+ return EventQueue.list.shift();
+ }
+ };
+
+ EdgeList.init();
+ Sites.bottomSite = Sites.list.shift();
+
+ var newSite = Sites.list.shift(), newIntStar;
+ var lbnd, rbnd, llbnd, rrbnd, bisector;
+ var bot, top, temp, p, v;
+ var e, pm;
+
+ while (true) {
+ if (!EventQueue.empty()) {
+ newIntStar = EventQueue.min();
+ }
+ if (newSite && (EventQueue.empty()
+ || newSite.y < newIntStar.y
+ || (newSite.y == newIntStar.y
+ && newSite.x < newIntStar.x))) { //new site is smallest
+ lbnd = EdgeList.leftBound(newSite);
+ rbnd = EdgeList.right(lbnd);
+ bot = EdgeList.rightRegion(lbnd);
+ e = Geom.bisect(bot, newSite);
+ bisector = EdgeList.createHalfEdge(e, "l");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(lbnd, bisector);
+ if (p) {
+ EventQueue.del(lbnd);
+ EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
+ }
+ lbnd = bisector;
+ bisector = EdgeList.createHalfEdge(e, "r");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(bisector, rbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, newSite));
+ }
+ newSite = Sites.list.shift();
+ } else if (!EventQueue.empty()) { //intersection is smallest
+ lbnd = EventQueue.extractMin();
+ llbnd = EdgeList.left(lbnd);
+ rbnd = EdgeList.right(lbnd);
+ rrbnd = EdgeList.right(rbnd);
+ bot = EdgeList.leftRegion(lbnd);
+ top = EdgeList.rightRegion(rbnd);
+ v = lbnd.vertex;
+ Geom.endPoint(lbnd.edge, lbnd.side, v);
+ Geom.endPoint(rbnd.edge, rbnd.side, v);
+ EdgeList.del(lbnd);
+ EventQueue.del(rbnd);
+ EdgeList.del(rbnd);
+ pm = "l";
+ if (bot.y > top.y) {
+ temp = bot;
+ bot = top;
+ top = temp;
+ pm = "r";
+ }
+ e = Geom.bisect(bot, top);
+ bisector = EdgeList.createHalfEdge(e, pm);
+ EdgeList.insert(llbnd, bisector);
+ Geom.endPoint(e, d3_voronoi_opposite[pm], v);
+ p = Geom.intersect(llbnd, bisector);
+ if (p) {
+ EventQueue.del(llbnd);
+ EventQueue.insert(llbnd, p, Geom.distance(p, bot));
+ }
+ p = Geom.intersect(bisector, rrbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, bot));
+ }
+ } else {
+ break;
+ }
+ }//end while
+
+ for (lbnd = EdgeList.right(EdgeList.leftEnd);
+ lbnd != EdgeList.rightEnd;
+ lbnd = EdgeList.right(lbnd)) {
+ callback(lbnd.edge);
+ }
+}
+/**
+* @param vertices [[x1, y1], [x2, y2], …]
+* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …]
+ */
+d3.geom.delaunay = function(vertices) {
+ var edges = vertices.map(function() { return []; }),
+ triangles = [];
+
+ // Use the Voronoi tessellation to determine Delaunay edges.
+ d3_voronoi_tessellate(vertices, function(e) {
+ edges[e.region.l.index].push(vertices[e.region.r.index]);
+ });
+
+ // Reconnect the edges into counterclockwise triangles.
+ edges.forEach(function(edge, i) {
+ var v = vertices[i],
+ cx = v[0],
+ cy = v[1];
+ edge.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ edge.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ for (var j = 0, m = edge.length - 1; j < m; j++) {
+ triangles.push([v, edge[j], edge[j + 1]]);
+ }
+ });
+
+ return triangles;
+};
+/**
+ * Constructs a new quadtree for the specified array of points. A quadtree is a
+ * two-dimensional recursive spatial subdivision. This implementation uses
+ * square partitions, dividing each square into four equally-sized squares. Each
+ * point exists in a unique node; if multiple points are in the same position,
+ * some points may be stored on internal nodes rather than leaf nodes. Quadtrees
+ * can be used to accelerate various spatial operations, such as the Barnes-Hut
+ * approximation for computing n-body forces, or collision detection.
+ *
+ * @param points [[x1, y1], [x2, y2], …]
+ * @return quadtree root {left: boolean, nodes: […], point: [x, y]}
+ */
+d3.geom.quadtree = function(points) {
+ var p,
+ i = -1,
+ n = points.length;
+
+ /* Compute bounds. */
+ var x1 = Number.POSITIVE_INFINITY, y1 = x1,
+ x2 = Number.NEGATIVE_INFINITY, y2 = x2;
+ while (++i < n) {
+ p = points[i];
+ if (p[0] < x1) x1 = p[0];
+ if (p[1] < y1) y1 = p[1];
+ if (p[0] > x2) x2 = p[0];
+ if (p[1] > y2) y2 = p[1];
+ }
+
+ /* Squarify the bounds. */
+ var dx = x2 - x1,
+ dy = y2 - y1;
+ if (dx > dy) y2 = y1 + dx;
+ else x2 = x1 + dy;
+
+ /**
+ * @ignore Recursively inserts the specified point <i>p</i> at the node
+ * <i>n</i> or one of its descendants. The bounds are defined by [<i>x1</i>,
+ * <i>x2</i>] and [<i>y1</i>, <i>y2</i>].
+ */
+ function insert(n, p, x1, y1, x2, y2) {
+ if (isNaN(p[0]) || isNaN(p[1])) return; // ignore invalid points
+ if (n.leaf) {
+ var v = n.point;
+ if (v) {
+ /*
+ * If the point at this leaf node is at the same position as the new
+ * point we are adding, we leave the point associated with the
+ * internal node while adding the new point to a child node. This
+ * avoids infinite recursion.
+ */
+ if ((Math.abs(v[0] - p[0]) + Math.abs(v[1] - p[1])) < .01) {
+ insertChild(n, p, x1, y1, x2, y2);
+ } else {
+ n.point = null;
+ insertChild(n, v, x1, y1, x2, y2);
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ } else {
+ n.point = p;
+ }
+ } else {
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ }
+
+ /**
+ * @ignore Recursively inserts the specified point <i>p</i> into a
+ * descendant of node <i>n</i>. The bounds are defined by [<i>x1</i>,
+ * <i>x2</i>] and [<i>y1</i>, <i>y2</i>].
+ */
+ function insertChild(n, p, x1, y1, x2, y2) {
+ /* Compute the split point, and the quadrant in which to insert p. */
+ var sx = (x1 + x2) * .5,
+ sy = (y1 + y2) * .5,
+ right = p[0] >= sx,
+ bottom = p[1] >= sy,
+ i = (bottom << 1) + right;
+
+ /* Recursively insert into the child node. */
+ n.leaf = false;
+ n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
+
+ /* Update the bounds as we recurse. */
+ if (right) x1 = sx; else x2 = sx;
+ if (bottom) y1 = sy; else y2 = sy;
+ insert(n, p, x1, y1, x2, y2);
+ }
+
+ /* Create the root node. */
+ var root = d3_geom_quadtreeNode();
+
+ /* Insert all points. */
+ i = -1;
+ while (++i < n) insert(root, points[i], x1, y1, x2, y2);
+
+ /* Register a visitor function for the root. */
+ root.visit = function(f) {
+ d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
+ };
+
+ return root;
+};
+
+function d3_geom_quadtreeNode() {
+ return {
+ leaf: true,
+ nodes: [],
+ point: null
+ };
+}
+
+function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
+ if (!f(node, x1, y1, x2, y2)) {
+ var sx = (x1 + x2) * .5,
+ sy = (y1 + y2) * .5,
+ children = node.nodes;
+ if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
+ if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
+ if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
+ if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
+ }
+}
+})() \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.js
new file mode 100644
index 00000000..250d9767
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.js
@@ -0,0 +1,3015 @@
+(function(){d3 = {version: "1.8.5"}; // semver
+if (!Date.now) Date.now = function() {
+ return +new Date();
+};
+if (!Object.create) Object.create = function(o) {
+ /** @constructor */ function f() {}
+ f.prototype = o;
+ return new f();
+};
+var d3_array = d3_arraySlice; // conversion for NodeLists
+
+function d3_arrayCopy(psuedoarray) {
+ var i = -1, n = psuedoarray.length, array = [];
+ while (++i < n) array.push(psuedoarray[i]);
+ return array;
+}
+
+function d3_arraySlice(psuedoarray) {
+ return Array.prototype.slice.call(psuedoarray);
+}
+
+try {
+ d3_array(document.documentElement.childNodes)[0].nodeType;
+} catch(e) {
+ d3_array = d3_arrayCopy;
+}
+function d3_functor(v) {
+ return typeof v == "function" ? v : function() { return v; };
+}
+// A getter-setter method that preserves the appropriate `this` context.
+d3.rebind = function(object, method) {
+ return function() {
+ var x = method.apply(object, arguments);
+ return arguments.length ? object : x;
+ };
+};
+d3.ascending = function(a, b) {
+ return a < b ? -1 : a > b ? 1 : 0;
+};
+d3.descending = function(a, b) {
+ return b < a ? -1 : b > a ? 1 : 0;
+};
+d3.min = function(array, f) {
+ var i = 0,
+ n = array.length,
+ a = array[0],
+ b;
+ if (arguments.length == 1) {
+ while (++i < n) if (a > (b = array[i])) a = b;
+ } else {
+ a = f(array[0]);
+ while (++i < n) if (a > (b = f(array[i]))) a = b;
+ }
+ return a;
+};
+d3.max = function(array, f) {
+ var i = 0,
+ n = array.length,
+ a = array[0],
+ b;
+ if (arguments.length == 1) {
+ while (++i < n) if (a < (b = array[i])) a = b;
+ } else {
+ a = f(a);
+ while (++i < n) if (a < (b = f(array[i]))) a = b;
+ }
+ return a;
+};
+d3.nest = function() {
+ var nest = {},
+ keys = [],
+ sortKeys = [],
+ sortValues,
+ rollup;
+
+ function map(array, depth) {
+ if (depth >= keys.length) return rollup
+ ? rollup.call(nest, array) : (sortValues
+ ? array.sort(sortValues)
+ : array);
+
+ var i = -1,
+ n = array.length,
+ key = keys[depth++],
+ keyValue,
+ object,
+ o = {};
+
+ while (++i < n) {
+ if ((keyValue = key(object = array[i])) in o) {
+ o[keyValue].push(object);
+ } else {
+ o[keyValue] = [object];
+ }
+ }
+
+ for (keyValue in o) {
+ o[keyValue] = map(o[keyValue], depth);
+ }
+
+ return o;
+ }
+
+ function entries(map, depth) {
+ if (depth >= keys.length) return map;
+
+ var a = [],
+ sortKey = sortKeys[depth++],
+ key;
+
+ for (key in map) {
+ a.push({key: key, values: entries(map[key], depth)});
+ }
+
+ if (sortKey) a.sort(function(a, b) {
+ return sortKey(a.key, b.key);
+ });
+
+ return a;
+ }
+
+ nest.map = function(array) {
+ return map(array, 0);
+ };
+
+ nest.entries = function(array) {
+ return entries(map(array, 0), 0);
+ };
+
+ nest.key = function(d) {
+ keys.push(d);
+ return nest;
+ };
+
+ // Specifies the order for the most-recently specified key.
+ // Note: only applies to entries. Map keys are unordered!
+ nest.sortKeys = function(order) {
+ sortKeys[keys.length - 1] = order;
+ return nest;
+ };
+
+ // Specifies the order for leaf values.
+ // Applies to both maps and entries array.
+ nest.sortValues = function(order) {
+ sortValues = order;
+ return nest;
+ };
+
+ nest.rollup = function(f) {
+ rollup = f;
+ return nest;
+ };
+
+ return nest;
+};
+d3.keys = function(map) {
+ var keys = [];
+ for (var key in map) keys.push(key);
+ return keys;
+};
+d3.values = function(map) {
+ var values = [];
+ for (var key in map) values.push(map[key]);
+ return values;
+};
+d3.entries = function(map) {
+ var entries = [];
+ for (var key in map) entries.push({key: key, value: map[key]});
+ return entries;
+};
+d3.merge = function(arrays) {
+ return Array.prototype.concat.apply([], arrays);
+};
+d3.split = function(array, f) {
+ var arrays = [],
+ values = [],
+ value,
+ i = -1,
+ n = array.length;
+ if (arguments.length < 2) f = d3_splitter;
+ while (++i < n) {
+ if (f.call(values, value = array[i], i)) {
+ values = [];
+ } else {
+ if (!values.length) arrays.push(values);
+ values.push(value);
+ }
+ }
+ return arrays;
+};
+
+function d3_splitter(d) {
+ return d == null;
+}
+function d3_collapse(s) {
+ return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " ");
+}
+//
+// Note: assigning to the arguments array simultaneously changes the value of
+// the corresponding argument!
+//
+// TODO The `this` argument probably shouldn't be the first argument to the
+// callback, anyway, since it's redundant. However, that will require a major
+// version bump due to backwards compatibility, so I'm not changing it right
+// away.
+//
+function d3_call(callback) {
+ callback.apply(this, (arguments[0] = this, arguments));
+ return this;
+}
+/**
+ * @param {number} start
+ * @param {number=} stop
+ * @param {number=} step
+ */
+d3.range = function(start, stop, step) {
+ if (arguments.length == 1) { stop = start; start = 0; }
+ if (step == null) step = 1;
+ if ((stop - start) / step == Infinity) throw new Error("infinite range");
+ var range = [],
+ i = -1,
+ j;
+ if (step < 0) while ((j = start + step * ++i) > stop) range.push(j);
+ else while ((j = start + step * ++i) < stop) range.push(j);
+ return range;
+};
+d3.requote = function(s) {
+ return s.replace(d3_requote_re, "\\$&");
+};
+
+var d3_requote_re = /[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;
+d3.xhr = function(url, mime, callback) {
+ var req = new XMLHttpRequest();
+ if (arguments.length < 3) callback = mime;
+ else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
+ req.open("GET", url, true);
+ req.onreadystatechange = function() {
+ if (req.readyState == 4) callback(req.status < 300 ? req : null);
+ };
+ req.send(null);
+};
+d3.text = function(url, mime, callback) {
+ function ready(req) {
+ callback(req && req.responseText);
+ }
+ if (arguments.length < 3) {
+ callback = mime;
+ mime = null;
+ }
+ d3.xhr(url, mime, ready);
+};
+d3.json = function(url, callback) {
+ d3.text(url, "application/json", function(text) {
+ callback(text ? JSON.parse(text) : null);
+ });
+};
+d3.html = function(url, callback) {
+ d3.text(url, "text/html", function(text) {
+ if (text != null) { // Treat empty string as valid HTML.
+ var range = document.createRange();
+ range.selectNode(document.body);
+ text = range.createContextualFragment(text);
+ }
+ callback(text);
+ });
+};
+d3.xml = function(url, mime, callback) {
+ function ready(req) {
+ callback(req && req.responseXML);
+ }
+ if (arguments.length < 3) {
+ callback = mime;
+ mime = null;
+ }
+ d3.xhr(url, mime, ready);
+};
+d3.ns = {
+
+ prefix: {
+ svg: "http://www.w3.org/2000/svg",
+ xhtml: "http://www.w3.org/1999/xhtml",
+ xlink: "http://www.w3.org/1999/xlink",
+ xml: "http://www.w3.org/XML/1998/namespace",
+ xmlns: "http://www.w3.org/2000/xmlns/"
+ },
+
+ qualify: function(name) {
+ var i = name.indexOf(":");
+ return i < 0 ? name : {
+ space: d3.ns.prefix[name.substring(0, i)],
+ local: name.substring(i + 1)
+ };
+ }
+
+};
+/** @param {...string} types */
+d3.dispatch = function(types) {
+ var dispatch = {},
+ type;
+ for (var i = 0, n = arguments.length; i < n; i++) {
+ type = arguments[i];
+ dispatch[type] = d3_dispatch(type);
+ }
+ return dispatch;
+};
+
+function d3_dispatch(type) {
+ var dispatch = {},
+ listeners = [];
+
+ dispatch.add = function(listener) {
+ for (var i = 0; i < listeners.length; i++) {
+ if (listeners[i].listener == listener) return dispatch; // already registered
+ }
+ listeners.push({listener: listener, on: true});
+ return dispatch;
+ };
+
+ dispatch.remove = function(listener) {
+ for (var i = 0; i < listeners.length; i++) {
+ var l = listeners[i];
+ if (l.listener == listener) {
+ l.on = false;
+ listeners = listeners.slice(0, i).concat(listeners.slice(i + 1));
+ break;
+ }
+ }
+ return dispatch;
+ };
+
+ dispatch.dispatch = function() {
+ var ls = listeners; // defensive reference
+ for (var i = 0, n = ls.length; i < n; i++) {
+ var l = ls[i];
+ if (l.on) l.listener.apply(this, arguments);
+ }
+ };
+
+ return dispatch;
+};
+// TODO align, type
+d3.format = function(specifier) {
+ var match = d3_format_re.exec(specifier),
+ fill = match[1] || " ",
+ sign = match[3] || "",
+ zfill = match[5],
+ width = +match[6],
+ comma = match[7],
+ precision = match[8],
+ type = match[9];
+ if (precision) precision = precision.substring(1);
+ if (zfill) {
+ fill = "0"; // TODO align = "=";
+ if (comma) width -= Math.floor((width - 1) / 4);
+ }
+ if (type == "d") precision = "0";
+ return function(value) {
+ var number = +value,
+ negative = (number < 0) && (number = -number) ? "\u2212" : sign;
+
+ // Return the empty string for floats formatted as ints.
+ if ((type == "d") && (number % 1)) return "";
+
+ // Convert the input value to the desired precision.
+ if (precision) value = number.toFixed(precision);
+ else value = "" + number;
+
+ // If the fill character is 0, the sign and group is applied after the fill.
+ if (zfill) {
+ var length = value.length + negative.length;
+ if (length < width) value = new Array(width - length + 1).join(fill) + value;
+ if (comma) value = d3_format_group(value);
+ value = negative + value;
+ }
+
+ // Otherwise (e.g., space-filling), the sign and group is applied before.
+ else {
+ if (comma) value = d3_format_group(value);
+ value = negative + value;
+ var length = value.length;
+ if (length < width) value = new Array(width - length + 1).join(fill) + value;
+ }
+
+ return value;
+ };
+};
+
+// [[fill]align][sign][#][0][width][,][.precision][type]
+var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
+
+// Apply comma grouping for thousands.
+function d3_format_group(value) {
+ var i = value.lastIndexOf("."),
+ f = i >= 0 ? value.substring(i) : (i = value.length, ""),
+ t = [];
+ while (i > 0) t.push(value.substring(i -= 3, i + 3));
+ return t.reverse().join(",") + f;
+}
+/*
+ * TERMS OF USE - EASING EQUATIONS
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright 2001 Robert Penner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * - Neither the name of the author nor the names of contributors may be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+var d3_ease_quad = d3_ease_poly(2),
+ d3_ease_cubic = d3_ease_poly(3);
+
+var d3_ease = {
+ linear: function() { return d3_ease_linear; },
+ poly: d3_ease_poly,
+ quad: function() { return d3_ease_quad; },
+ cubic: function() { return d3_ease_cubic; },
+ sin: function() { return d3_ease_sin; },
+ exp: function() { return d3_ease_exp; },
+ circle: function() { return d3_ease_circle; },
+ elastic: d3_ease_elastic,
+ back: d3_ease_back,
+ bounce: function() { return d3_ease_bounce; }
+};
+
+var d3_ease_mode = {
+ "in": function(f) { return f; },
+ "out": d3_ease_reverse,
+ "in-out": d3_ease_reflect,
+ "out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); }
+};
+
+d3.ease = function(name) {
+ var i = name.indexOf("-"),
+ t = i >= 0 ? name.substring(0, i) : name,
+ m = i >= 0 ? name.substring(i + 1) : "in";
+ return d3_ease_mode[m](d3_ease[t].apply(null, Array.prototype.slice.call(arguments, 1)));
+};
+
+function d3_ease_reverse(f) {
+ return function(t) {
+ return 1 - f(1 - t);
+ };
+}
+
+function d3_ease_reflect(f) {
+ return function(t) {
+ return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t)));
+ };
+}
+
+function d3_ease_linear(t) {
+ return t;
+}
+
+function d3_ease_poly(e) {
+ return function(t) {
+ return Math.pow(t, e);
+ }
+}
+
+function d3_ease_sin(t) {
+ return 1 - Math.cos(t * Math.PI / 2);
+}
+
+function d3_ease_exp(t) {
+ return t ? Math.pow(2, 10 * (t - 1)) - 1e-3 : 0;
+}
+
+function d3_ease_circle(t) {
+ return 1 - Math.sqrt(1 - t * t);
+}
+
+function d3_ease_elastic(a, p) {
+ var s;
+ if (arguments.length < 2) p = 0.45;
+ if (arguments.length < 1) { a = 1; s = p / 4; }
+ else s = p / (2 * Math.PI) * Math.asin(1 / a);
+ return function(t) {
+ return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p);
+ };
+}
+
+function d3_ease_back(s) {
+ if (!s) s = 1.70158;
+ return function(t) {
+ return t * t * ((s + 1) * t - s);
+ };
+}
+
+function d3_ease_bounce(t) {
+ return t < 1 / 2.75 ? 7.5625 * t * t
+ : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75
+ : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375
+ : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
+}
+d3.event = null;
+d3.interpolate = function(a, b) {
+ if (typeof b == "number") return d3.interpolateNumber(+a, b);
+ if (typeof b == "string") {
+ return (b in d3_rgb_names) || /^(#|rgb\(|hsl\()/.test(b)
+ ? d3.interpolateRgb(String(a), b)
+ : d3.interpolateString(String(a), b);
+ }
+ if (b instanceof Array) return d3.interpolateArray(a, b);
+ return d3.interpolateObject(a, b);
+};
+
+d3.interpolateNumber = function(a, b) {
+ b -= a;
+ return function(t) { return a + b * t; };
+};
+
+d3.interpolateRound = function(a, b) {
+ b -= a;
+ return function(t) { return Math.round(a + b * t); };
+};
+
+d3.interpolateString = function(a, b) {
+ var m, // current match
+ i, // current index
+ j, // current index (for coallescing)
+ s0 = 0, // start index of current string prefix
+ s1 = 0, // end index of current string prefix
+ s = [], // string constants and placeholders
+ q = [], // number interpolators
+ n, // q.length
+ o;
+
+ // Find all numbers in b.
+ for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
+ if (m.index) s.push(b.substring(s0, s1 = m.index));
+ q.push({i: s.length, x: m[0]});
+ s.push(null);
+ s0 = d3_interpolate_number.lastIndex;
+ }
+ if (s0 < b.length) s.push(b.substring(s0));
+
+ // Find all numbers in a.
+ for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
+ o = q[i];
+ if (o.x == m[0]) { // The numbers match, so coallesce.
+ if (o.i) {
+ if (s[o.i + 1] == null) { // This match is followed by another number.
+ s[o.i - 1] += o.x;
+ s.splice(o.i, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ } else { // This match is followed by a string, so coallesce twice.
+ s[o.i - 1] += o.x + s[o.i + 1];
+ s.splice(o.i, 2);
+ for (j = i + 1; j < n; ++j) q[j].i -= 2;
+ }
+ } else {
+ if (s[o.i + 1] == null) { // This match is followed by another number.
+ s[o.i] = o.x;
+ } else { // This match is followed by a string, so coallesce twice.
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ }
+ }
+ q.splice(i, 1);
+ n--;
+ i--;
+ } else {
+ o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
+ }
+ }
+
+ // Remove any numbers in b not found in a.
+ while (i < n) {
+ o = q.pop();
+ if (s[o.i + 1] == null) { // This match is followed by another number.
+ s[o.i] = o.x;
+ } else { // This match is followed by a string, so coallesce twice.
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ }
+ n--;
+ }
+
+ // Special optimization for only a single match.
+ if (s.length == 1) {
+ return s[0] == null ? q[0].x : function() { return b; };
+ }
+
+ // Otherwise, interpolate each of the numbers and rejoin the string.
+ return function(t) {
+ for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+};
+
+d3.interpolateRgb = function(a, b) {
+ a = d3.rgb(a);
+ b = d3.rgb(b);
+ var ar = a.r,
+ ag = a.g,
+ ab = a.b,
+ br = b.r - ar,
+ bg = b.g - ag,
+ bb = b.b - ab;
+ return function(t) {
+ return "rgb(" + Math.round(ar + br * t)
+ + "," + Math.round(ag + bg * t)
+ + "," + Math.round(ab + bb * t)
+ + ")";
+ };
+};
+
+// interpolates HSL space, but outputs RGB string (for compatibility)
+d3.interpolateHsl = function(a, b) {
+ a = d3.hsl(a);
+ b = d3.hsl(b);
+ var h0 = a.h,
+ s0 = a.s,
+ l0 = a.l,
+ h1 = b.h - h0,
+ s1 = b.s - s0,
+ l1 = b.l - l0;
+ return function(t) {
+ return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t).toString();
+ };
+};
+
+d3.interpolateArray = function(a, b) {
+ var x = [],
+ c = [],
+ na = a.length,
+ nb = b.length,
+ n0 = Math.min(a.length, b.length),
+ i;
+ for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
+ for (; i < na; ++i) c[i] = a[i];
+ for (; i < nb; ++i) c[i] = b[i];
+ return function(t) {
+ for (i = 0; i < n0; ++i) c[i] = x[i](t);
+ return c;
+ };
+};
+
+d3.interpolateObject = function(a, b) {
+ var i = {},
+ c = {},
+ k;
+ for (k in a) {
+ if (k in b) {
+ i[k] = d3_interpolateByName(k)(a[k], b[k]);
+ } else {
+ c[k] = a[k];
+ }
+ }
+ for (k in b) {
+ if (!(k in a)) {
+ c[k] = b[k];
+ }
+ }
+ return function(t) {
+ for (k in i) c[k] = i[k](t);
+ return c;
+ };
+}
+
+var d3_interpolate_number = /[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,
+ d3_interpolate_digits = /[-+]?\d*\.?\d*(?:[eE][-]?\d+)?(.*)/,
+ d3_interpolate_rgb = {background: 1, fill: 1, stroke: 1};
+
+function d3_interpolateByName(n) {
+ return n in d3_interpolate_rgb || /\bcolor\b/.test(n)
+ ? d3.interpolateRgb
+ : d3.interpolate;
+}
+/**
+ * @param {number=} g
+ * @param {number=} b
+ */
+d3.rgb = function(r, g, b) {
+ return arguments.length == 1
+ ? d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb)
+ : d3_rgb(~~r, ~~g, ~~b);
+};
+
+function d3_rgb(r, g, b) {
+ return {r: r, g: g, b: b, toString: d3_rgb_format};
+}
+
+/** @this d3_rgb */
+function d3_rgb_format() {
+ return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
+}
+
+function d3_rgb_hex(v) {
+ return v < 0x10 ? "0" + v.toString(16) : v.toString(16);
+}
+
+function d3_rgb_parse(format, rgb, hsl) {
+ var r = 0, // red channel; int in [0, 255]
+ g = 0, // green channel; int in [0, 255]
+ b = 0, // blue channel; int in [0, 255]
+ m1, // CSS color specification match
+ m2, // CSS color specification type (e.g., rgb)
+ name;
+
+ /* Handle hsl, rgb. */
+ m1 = /([a-z]+)\((.*)\)/i.exec(format);
+ if (m1) {
+ m2 = m1[2].split(",");
+ switch (m1[1]) {
+ case "hsl": {
+ return hsl(
+ parseFloat(m2[0]), // degrees
+ parseFloat(m2[1]) / 100, // percentage
+ parseFloat(m2[2]) / 100 // percentage
+ );
+ }
+ case "rgb": {
+ return rgb(
+ d3_rgb_parseNumber(m2[0]),
+ d3_rgb_parseNumber(m2[1]),
+ d3_rgb_parseNumber(m2[2])
+ );
+ }
+ }
+ }
+
+ /* Named colors. */
+ if (name = d3_rgb_names[format]) return rgb(name.r, name.g, name.b);
+
+ /* Hexadecimal colors: #rgb and #rrggbb. */
+ if (format != null && format.charAt(0) == "#") {
+ if (format.length == 4) {
+ r = format.charAt(1); r += r;
+ g = format.charAt(2); g += g;
+ b = format.charAt(3); b += b;
+ } else if (format.length == 7) {
+ r = format.substring(1, 3);
+ g = format.substring(3, 5);
+ b = format.substring(5, 7);
+ }
+ r = parseInt(r, 16);
+ g = parseInt(g, 16);
+ b = parseInt(b, 16);
+ }
+
+ return rgb(r, g, b);
+}
+
+function d3_rgb_hsl(r, g, b) {
+ var min = Math.min(r /= 255, g /= 255, b /= 255),
+ max = Math.max(r, g, b),
+ d = max - min,
+ h,
+ s,
+ l = (max + min) / 2;
+ if (d) {
+ s = l < .5 ? d / (max + min) : d / (2 - max - min);
+ if (r == max) h = (g - b) / d + (g < b ? 6 : 0);
+ else if (g == max) h = (b - r) / d + 2;
+ else h = (r - g) / d + 4;
+ h *= 60;
+ } else {
+ s = h = 0;
+ }
+ return d3_hsl(h, s, l);
+}
+
+function d3_rgb_parseNumber(c) { // either integer or percentage
+ var f = parseFloat(c);
+ return c.charAt(c.length - 1) == "%" ? Math.round(f * 2.55) : f;
+}
+
+var d3_rgb_names = {
+ aliceblue: "#f0f8ff",
+ antiquewhite: "#faebd7",
+ aqua: "#00ffff",
+ aquamarine: "#7fffd4",
+ azure: "#f0ffff",
+ beige: "#f5f5dc",
+ bisque: "#ffe4c4",
+ black: "#000000",
+ blanchedalmond: "#ffebcd",
+ blue: "#0000ff",
+ blueviolet: "#8a2be2",
+ brown: "#a52a2a",
+ burlywood: "#deb887",
+ cadetblue: "#5f9ea0",
+ chartreuse: "#7fff00",
+ chocolate: "#d2691e",
+ coral: "#ff7f50",
+ cornflowerblue: "#6495ed",
+ cornsilk: "#fff8dc",
+ crimson: "#dc143c",
+ cyan: "#00ffff",
+ darkblue: "#00008b",
+ darkcyan: "#008b8b",
+ darkgoldenrod: "#b8860b",
+ darkgray: "#a9a9a9",
+ darkgreen: "#006400",
+ darkgrey: "#a9a9a9",
+ darkkhaki: "#bdb76b",
+ darkmagenta: "#8b008b",
+ darkolivegreen: "#556b2f",
+ darkorange: "#ff8c00",
+ darkorchid: "#9932cc",
+ darkred: "#8b0000",
+ darksalmon: "#e9967a",
+ darkseagreen: "#8fbc8f",
+ darkslateblue: "#483d8b",
+ darkslategray: "#2f4f4f",
+ darkslategrey: "#2f4f4f",
+ darkturquoise: "#00ced1",
+ darkviolet: "#9400d3",
+ deeppink: "#ff1493",
+ deepskyblue: "#00bfff",
+ dimgray: "#696969",
+ dimgrey: "#696969",
+ dodgerblue: "#1e90ff",
+ firebrick: "#b22222",
+ floralwhite: "#fffaf0",
+ forestgreen: "#228b22",
+ fuchsia: "#ff00ff",
+ gainsboro: "#dcdcdc",
+ ghostwhite: "#f8f8ff",
+ gold: "#ffd700",
+ goldenrod: "#daa520",
+ gray: "#808080",
+ green: "#008000",
+ greenyellow: "#adff2f",
+ grey: "#808080",
+ honeydew: "#f0fff0",
+ hotpink: "#ff69b4",
+ indianred: "#cd5c5c",
+ indigo: "#4b0082",
+ ivory: "#fffff0",
+ khaki: "#f0e68c",
+ lavender: "#e6e6fa",
+ lavenderblush: "#fff0f5",
+ lawngreen: "#7cfc00",
+ lemonchiffon: "#fffacd",
+ lightblue: "#add8e6",
+ lightcoral: "#f08080",
+ lightcyan: "#e0ffff",
+ lightgoldenrodyellow: "#fafad2",
+ lightgray: "#d3d3d3",
+ lightgreen: "#90ee90",
+ lightgrey: "#d3d3d3",
+ lightpink: "#ffb6c1",
+ lightsalmon: "#ffa07a",
+ lightseagreen: "#20b2aa",
+ lightskyblue: "#87cefa",
+ lightslategray: "#778899",
+ lightslategrey: "#778899",
+ lightsteelblue: "#b0c4de",
+ lightyellow: "#ffffe0",
+ lime: "#00ff00",
+ limegreen: "#32cd32",
+ linen: "#faf0e6",
+ magenta: "#ff00ff",
+ maroon: "#800000",
+ mediumaquamarine: "#66cdaa",
+ mediumblue: "#0000cd",
+ mediumorchid: "#ba55d3",
+ mediumpurple: "#9370db",
+ mediumseagreen: "#3cb371",
+ mediumslateblue: "#7b68ee",
+ mediumspringgreen: "#00fa9a",
+ mediumturquoise: "#48d1cc",
+ mediumvioletred: "#c71585",
+ midnightblue: "#191970",
+ mintcream: "#f5fffa",
+ mistyrose: "#ffe4e1",
+ moccasin: "#ffe4b5",
+ navajowhite: "#ffdead",
+ navy: "#000080",
+ oldlace: "#fdf5e6",
+ olive: "#808000",
+ olivedrab: "#6b8e23",
+ orange: "#ffa500",
+ orangered: "#ff4500",
+ orchid: "#da70d6",
+ palegoldenrod: "#eee8aa",
+ palegreen: "#98fb98",
+ paleturquoise: "#afeeee",
+ palevioletred: "#db7093",
+ papayawhip: "#ffefd5",
+ peachpuff: "#ffdab9",
+ peru: "#cd853f",
+ pink: "#ffc0cb",
+ plum: "#dda0dd",
+ powderblue: "#b0e0e6",
+ purple: "#800080",
+ red: "#ff0000",
+ rosybrown: "#bc8f8f",
+ royalblue: "#4169e1",
+ saddlebrown: "#8b4513",
+ salmon: "#fa8072",
+ sandybrown: "#f4a460",
+ seagreen: "#2e8b57",
+ seashell: "#fff5ee",
+ sienna: "#a0522d",
+ silver: "#c0c0c0",
+ skyblue: "#87ceeb",
+ slateblue: "#6a5acd",
+ slategray: "#708090",
+ slategrey: "#708090",
+ snow: "#fffafa",
+ springgreen: "#00ff7f",
+ steelblue: "#4682b4",
+ tan: "#d2b48c",
+ teal: "#008080",
+ thistle: "#d8bfd8",
+ tomato: "#ff6347",
+ turquoise: "#40e0d0",
+ violet: "#ee82ee",
+ wheat: "#f5deb3",
+ white: "#ffffff",
+ whitesmoke: "#f5f5f5",
+ yellow: "#ffff00",
+ yellowgreen: "#9acd32"
+};
+
+for (var d3_rgb_name in d3_rgb_names) {
+ d3_rgb_names[d3_rgb_name] = d3_rgb_parse(
+ d3_rgb_names[d3_rgb_name],
+ d3_rgb,
+ d3_hsl_rgb);
+}
+/**
+ * @param {number=} s
+ * @param {number=} l
+ */
+d3.hsl = function(h, s, l) {
+ return arguments.length == 1
+ ? d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl)
+ : d3_hsl(+h, +s, +l);
+};
+
+function d3_hsl(h, s, l) {
+ return {h: h, s: s, l: l, toString: d3_hsl_format};
+}
+
+/** @this d3_hsl */
+function d3_hsl_format() {
+ return "hsl(" + this.h + "," + this.s * 100 + "%," + this.l * 100 + "%)";
+}
+
+function d3_hsl_rgb(h, s, l) {
+ var m1,
+ m2;
+
+ /* Some simple corrections for h, s and l. */
+ h = h % 360; if (h < 0) h += 360;
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
+ l = l < 0 ? 0 : l > 1 ? 1 : l;
+
+ /* From FvD 13.37, CSS Color Module Level 3 */
+ m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
+ m1 = 2 * l - m2;
+
+ function v(h) {
+ if (h > 360) h -= 360;
+ else if (h < 0) h += 360;
+ if (h < 60) return m1 + (m2 - m1) * h / 60;
+ if (h < 180) return m2;
+ if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
+ return m1;
+ }
+
+ function vv(h) {
+ return Math.round(v(h) * 255);
+ }
+
+ return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
+}
+var d3_select = function(s, n) { return n.querySelector(s); },
+ d3_selectAll = function(s, n) { return d3_array(n.querySelectorAll(s)); };
+
+// Use Sizzle, if available.
+if (typeof Sizzle == "function") {
+ d3_select = function(s, n) { return Sizzle(s, n)[0]; };
+ d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); };
+}
+
+var d3_root = d3_selection([[document]]);
+d3_root[0].parentNode = document.documentElement;
+
+// TODO fast singleton implementation!
+d3.select = function(selector) {
+ return typeof selector == "string"
+ ? d3_root.select(selector)
+ : d3_selection([[selector]]); // assume node
+};
+
+d3.selectAll = function(selector) {
+ return typeof selector == "string"
+ ? d3_root.selectAll(selector)
+ : d3_selection([d3_array(selector)]); // assume node[]
+};
+
+function d3_selection(groups) {
+
+ function select(select) {
+ var subgroups = [],
+ subgroup,
+ subnode,
+ group,
+ node;
+ for (var j = 0, m = groups.length; j < m; j++) {
+ group = groups[j];
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = group.parentNode;
+ subgroup.parentData = group.parentData;
+ for (var i = 0, n = group.length; i < n; i++) {
+ if (node = group[i]) {
+ subgroup.push(subnode = select(node));
+ if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ }
+
+ function selectAll(selectAll) {
+ var subgroups = [],
+ subgroup,
+ group,
+ node;
+ for (var j = 0, m = groups.length; j < m; j++) {
+ group = groups[j];
+ for (var i = 0, n = group.length; i < n; i++) {
+ if (node = group[i]) {
+ subgroups.push(subgroup = selectAll(node));
+ subgroup.parentNode = node;
+ subgroup.parentData = node.__data__;
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ }
+
+ // TODO select(function)?
+ groups.select = function(selector) {
+ return select(function(node) {
+ return d3_select(selector, node);
+ });
+ };
+
+ // TODO selectAll(function)?
+ groups.selectAll = function(selector) {
+ return selectAll(function(node) {
+ return d3_selectAll(selector, node);
+ });
+ };
+
+ // TODO preserve null elements to maintain index?
+ groups.filter = function(filter) {
+ var subgroups = [],
+ subgroup,
+ group,
+ node;
+ for (var j = 0, m = groups.length; j < m; j++) {
+ group = groups[j];
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = group.parentNode;
+ subgroup.parentData = group.parentData;
+ for (var i = 0, n = group.length; i < n; i++) {
+ if ((node = group[i]) && filter.call(node, node.__data__, i)) {
+ subgroup.push(node);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+
+ groups.map = function(map) {
+ var group,
+ node;
+ for (var j = 0, m = groups.length; j < m; j++) {
+ group = groups[j];
+ for (var i = 0, n = group.length; i < n; i++) {
+ if (node = group[i]) node.__data__ = map.call(node, node.__data__, i);
+ }
+ }
+ return groups;
+ };
+
+ // TODO data(null) for clearing data?
+ groups.data = function(data, join) {
+ var enter = [],
+ update = [],
+ exit = [];
+
+ function bind(group, groupData) {
+ var i = 0,
+ n = group.length,
+ m = groupData.length,
+ n0 = Math.min(n, m),
+ n1 = Math.max(n, m),
+ updateNodes = [],
+ enterNodes = [],
+ exitNodes = [],
+ node,
+ nodeData;
+
+ function enterNode(data) {
+ return {__data__: data};
+ }
+
+ if (join) {
+ var nodeByKey = {},
+ exitData = [],
+ keys = [],
+ key,
+ j = groupData.length;
+
+ for (i = 0; i < n; i++) {
+ key = join.call(node = group[i], node.__data__, i);
+ if (key in nodeByKey) {
+ exitNodes[j++] = group[i];
+ } else {
+ nodeByKey[key] = node;
+ keys.push(key);
+ }
+ }
+
+ for (i = 0; i < m; i++) {
+ node = nodeByKey[key = join.call(groupData, nodeData = groupData[i], i)];
+ if (node) {
+ node.__data__ = nodeData;
+ updateNodes[i] = node;
+ enterNodes[i] = exitNodes[i] = null;
+ } else {
+ enterNodes[i] = enterNode(nodeData),
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ delete nodeByKey[key];
+ }
+
+ for (i = 0; i < n; i++) {
+ if (keys[i] in nodeByKey) {
+ exitNodes[i] = group[i];
+ }
+ }
+ } else {
+ for (; i < n0; i++) {
+ node = group[i];
+ nodeData = groupData[i];
+ if (node) {
+ node.__data__ = nodeData;
+ updateNodes[i] = node;
+ enterNodes[i] = exitNodes[i] = null;
+ } else {
+ enterNodes[i] = enterNode(nodeData);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ }
+ for (; i < m; i++) {
+ enterNodes[i] = enterNode(groupData[i]);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ for (; i < n1; i++) {
+ exitNodes[i] = group[i];
+ enterNodes[i] = updateNodes[i] = null;
+ }
+ }
+
+ enterNodes.parentNode
+ = updateNodes.parentNode
+ = exitNodes.parentNode
+ = group.parentNode;
+
+ enterNodes.parentData
+ = updateNodes.parentData
+ = exitNodes.parentData
+ = group.parentData;
+
+ enter.push(enterNodes);
+ update.push(updateNodes);
+ exit.push(exitNodes);
+ }
+
+ var i = -1,
+ n = groups.length,
+ group;
+ if (typeof data == "function") {
+ while (++i < n) {
+ bind(group = groups[i], data.call(group, group.parentData, i));
+ }
+ } else {
+ while (++i < n) {
+ bind(group = groups[i], data);
+ }
+ }
+
+ var selection = d3_selection(update);
+ selection.enter = function() {
+ return d3_selectionEnter(enter);
+ };
+ selection.exit = function() {
+ return d3_selection(exit);
+ };
+ return selection;
+ };
+
+ // TODO mask forEach? or rename for eachData?
+ // TODO offer the same semantics for map, reduce, etc.?
+ groups.each = function(callback) {
+ for (var j = 0, m = groups.length; j < m; j++) {
+ var group = groups[j];
+ for (var i = 0, n = group.length; i < n; i++) {
+ var node = group[i];
+ if (node) callback.call(node, node.__data__, i);
+ }
+ }
+ return groups;
+ };
+
+ function first(callback) {
+ for (var j = 0, m = groups.length; j < m; j++) {
+ var group = groups[j];
+ for (var i = 0, n = group.length; i < n; i++) {
+ var node = group[i];
+ if (node) return callback.call(node, node.__data__, i);
+ }
+ }
+ return null;
+ }
+
+ groups.empty = function() {
+ return !first(function() { return true; });
+ };
+
+ groups.node = function() {
+ return first(function() { return this; });
+ };
+
+ groups.attr = function(name, value) {
+ name = d3.ns.qualify(name);
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 2) {
+ return first(name.local
+ ? function() { return this.getAttributeNS(name.space, name.local); }
+ : function() { return this.getAttribute(name); });
+ }
+
+ /** @this {Element} */
+ function attrNull() {
+ this.removeAttribute(name);
+ }
+
+ /** @this {Element} */
+ function attrNullNS() {
+ this.removeAttributeNS(name.space, name.local);
+ }
+
+ /** @this {Element} */
+ function attrConstant() {
+ this.setAttribute(name, value);
+ }
+
+ /** @this {Element} */
+ function attrConstantNS() {
+ this.setAttributeNS(name.space, name.local, value);
+ }
+
+ /** @this {Element} */
+ function attrFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttribute(name);
+ else this.setAttribute(name, x);
+ }
+
+ /** @this {Element} */
+ function attrFunctionNS() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttributeNS(name.space, name.local);
+ else this.setAttributeNS(name.space, name.local, x);
+ }
+
+ return groups.each(value == null
+ ? (name.local ? attrNullNS : attrNull) : (typeof value == "function"
+ ? (name.local ? attrFunctionNS : attrFunction)
+ : (name.local ? attrConstantNS : attrConstant)));
+ };
+
+ groups.classed = function(name, value) {
+ var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g");
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 2) {
+ return first(function() {
+ re.lastIndex = 0;
+ return re.test(this.className);
+ });
+ }
+
+ /** @this {Element} */
+ function classedAdd() {
+ var classes = this.className;
+ re.lastIndex = 0;
+ if (!re.test(classes)) {
+ this.className = d3_collapse(classes + " " + name);
+ }
+ }
+
+ /** @this {Element} */
+ function classedRemove() {
+ var classes = d3_collapse(this.className.replace(re, " "));
+ this.className = classes.length ? classes : null;
+ }
+
+ /** @this {Element} */
+ function classedFunction() {
+ (value.apply(this, arguments)
+ ? classedAdd
+ : classedRemove).call(this);
+ }
+
+ return groups.each(typeof value == "function"
+ ? classedFunction : value
+ ? classedAdd
+ : classedRemove);
+ };
+
+ groups.style = function(name, value, priority) {
+ if (arguments.length < 3) priority = null;
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 2) {
+ return first(function() {
+ return window.getComputedStyle(this, null).getPropertyValue(name);
+ });
+ }
+
+ /** @this {Element} */
+ function styleNull() {
+ this.style.removeProperty(name);
+ }
+
+ /** @this {Element} */
+ function styleConstant() {
+ this.style.setProperty(name, value, priority);
+ }
+
+ /** @this {Element} */
+ function styleFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.style.removeProperty(name);
+ else this.style.setProperty(name, x, priority);
+ }
+
+ return groups.each(value == null
+ ? styleNull : (typeof value == "function"
+ ? styleFunction : styleConstant));
+ };
+
+ groups.property = function(name, value) {
+ name = d3.ns.qualify(name);
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 2) {
+ return first(function() {
+ return this[name];
+ });
+ }
+
+ /** @this {Element} */
+ function propertyNull() {
+ delete this[name];
+ }
+
+ /** @this {Element} */
+ function propertyConstant() {
+ this[name] = value;
+ }
+
+ /** @this {Element} */
+ function propertyFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) delete this[name];
+ else this[name] = x;
+ }
+
+ return groups.each(value == null
+ ? propertyNull : (typeof value == "function"
+ ? propertyFunction : propertyConstant));
+ };
+
+ groups.text = function(value) {
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 1) {
+ return first(function() {
+ return this.textContent;
+ });
+ }
+
+ /** @this {Element} */
+ function textNull() {
+ while (this.lastChild) this.removeChild(this.lastChild);
+ }
+
+ /** @this {Element} */
+ function textConstant() {
+ this.appendChild(document.createTextNode(value));
+ }
+
+ /** @this {Element} */
+ function textFunction() {
+ var x = value.apply(this, arguments);
+ if (x != null) this.appendChild(document.createTextNode(x));
+ }
+
+ groups.each(textNull);
+ return value == null ? groups
+ : groups.each(typeof value == "function"
+ ? textFunction : textConstant);
+ };
+
+ groups.html = function(value) {
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 1) {
+ return first(function() {
+ return this.innerHTML;
+ });
+ }
+
+ /** @this {Element} */
+ function htmlConstant() {
+ this.innerHTML = value;
+ }
+
+ /** @this {Element} */
+ function htmlFunction() {
+ this.innerHTML = value.apply(this, arguments);
+ }
+
+ return groups.each(typeof value == "function"
+ ? htmlFunction : htmlConstant);
+ };
+
+ // TODO append(node)?
+ // TODO append(function)?
+ groups.append = function(name) {
+ name = d3.ns.qualify(name);
+
+ function append(node) {
+ return node.appendChild(document.createElement(name));
+ }
+
+ function appendNS(node) {
+ return node.appendChild(document.createElementNS(name.space, name.local));
+ }
+
+ return select(name.local ? appendNS : append);
+ };
+
+ // TODO insert(node, function)?
+ // TODO insert(function, string)?
+ // TODO insert(function, function)?
+ groups.insert = function(name, before) {
+ name = d3.ns.qualify(name);
+
+ function insert(node) {
+ return node.insertBefore(
+ document.createElement(name),
+ d3_select(before, node));
+ }
+
+ function insertNS(node) {
+ return node.insertBefore(
+ document.createElementNS(name.space, name.local),
+ d3_select(before, node));
+ }
+
+ return select(name.local ? insertNS : insert);
+ };
+
+ // TODO remove(selector)?
+ // TODO remove(node)?
+ // TODO remove(function)?
+ groups.remove = function() {
+ return select(function(node) {
+ var parent = node.parentNode;
+ parent.removeChild(node);
+ return parent;
+ });
+ };
+
+ groups.sort = function(comparator) {
+ comparator = d3_selection_comparator.apply(this, arguments);
+ for (var j = 0, m = groups.length; j < m; j++) {
+ var group = groups[j];
+ group.sort(comparator);
+ for (var i = 1, n = group.length, prev = group[0]; i < n; i++) {
+ var node = group[i];
+ if (node) {
+ if (prev) prev.parentNode.insertBefore(node, prev.nextSibling);
+ prev = node;
+ }
+ }
+ }
+ return groups;
+ };
+
+ // type can be namespaced, e.g., "click.foo"
+ // listener can be null for removal
+ groups.on = function(type, listener) {
+
+ // parse the type specifier
+ var i = type.indexOf("."),
+ typo = i == -1 ? type : type.substring(0, i),
+ name = "__on" + type;
+
+ // remove the old event listener, and add the new event listener
+ return groups.each(function(d, i) {
+ if (this[name]) this.removeEventListener(typo, this[name], false);
+ if (listener) this.addEventListener(typo, this[name] = l, false);
+
+ // wrapped event listener that preserves d, i
+ function l(e) {
+ var o = d3.event; // Events can be reentrant (e.g., focus).
+ d3.event = e;
+ try {
+ listener.call(this, d, i);
+ } finally {
+ d3.event = o;
+ }
+ }
+ });
+ };
+
+ // TODO slice?
+
+ groups.transition = function() {
+ return d3_transition(groups);
+ };
+
+ groups.call = d3_call;
+
+ return groups;
+}
+
+function d3_selectionEnter(groups) {
+
+ function select(select) {
+ var subgroups = [],
+ subgroup,
+ subnode,
+ group,
+ node;
+ for (var j = 0, m = groups.length; j < m; j++) {
+ group = groups[j];
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = group.parentNode;
+ subgroup.parentData = group.parentData;
+ for (var i = 0, n = group.length; i < n; i++) {
+ if (node = group[i]) {
+ subgroup.push(subnode = select(group.parentNode));
+ subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ }
+
+ // TODO append(node)?
+ // TODO append(function)?
+ groups.append = function(name) {
+ name = d3.ns.qualify(name);
+
+ function append(node) {
+ return node.appendChild(document.createElement(name));
+ }
+
+ function appendNS(node) {
+ return node.appendChild(document.createElementNS(name.space, name.local));
+ }
+
+ return select(name.local ? appendNS : append);
+ };
+
+ // TODO insert(node, function)?
+ // TODO insert(function, string)?
+ // TODO insert(function, function)?
+ groups.insert = function(name, before) {
+ name = d3.ns.qualify(name);
+
+ function insert(node) {
+ return node.insertBefore(
+ document.createElement(name),
+ d3_select(before, node));
+ }
+
+ function insertNS(node) {
+ return node.insertBefore(
+ document.createElementNS(name.space, name.local),
+ d3_select(before, node));
+ }
+
+ return select(name.local ? insertNS : insert);
+ };
+
+ return groups;
+}
+
+function d3_selection_comparator(comparator) {
+ if (!arguments.length) comparator = d3.ascending;
+ return function(a, b) {
+ return comparator(a && a.__data__, b && b.__data__);
+ };
+}
+d3.transition = d3_root.transition;
+
+var d3_transitionId = 0,
+ d3_transitionInheritId = 0;
+
+function d3_transition(groups) {
+ var transition = {},
+ transitionId = d3_transitionInheritId || ++d3_transitionId,
+ tweens = {},
+ interpolators = [],
+ remove = false,
+ event = d3.dispatch("start", "end"),
+ stage = [],
+ delay = [],
+ duration = [],
+ durationMax,
+ ease = d3.ease("cubic-in-out");
+
+ //
+ // Be careful with concurrent transitions!
+ //
+ // Say transition A causes an exit. Before A finishes, a transition B is
+ // created, and believes it only needs to do an update, because the elements
+ // haven't been removed yet (which happens at the very end of the exit
+ // transition).
+ //
+ // Even worse, what if either transition A or B has a staggered delay? Then,
+ // some elements may be removed, while others remain. Transition B does not
+ // know to enter the elements because they were still present at the time
+ // the transition B was created (but not yet started).
+ //
+ // To prevent such confusion, we only trigger end events for transitions if
+ // the transition ending is the only one scheduled for the given element.
+ // Similarly, we only allow one transition to be active for any given
+ // element, so that concurrent transitions do not overwrite each other's
+ // properties.
+ //
+ // TODO Support transition namespaces, so that transitions can proceed
+ // concurrently on the same element if needed. Hopefully, this is rare!
+ //
+
+ groups.each(function() {
+ (this.__transition__ || (this.__transition__ = {})).owner = transitionId;
+ });
+
+ function step(elapsed) {
+ var clear = true,
+ k = -1;
+ groups.each(function() {
+ if (stage[++k] == 2) return; // ended
+ var t = (elapsed - delay[k]) / duration[k],
+ tx = this.__transition__,
+ te, // ease(t)
+ tk, // tween key
+ ik = interpolators[k];
+
+ // Check if the (un-eased) time is outside the range [0,1].
+ if (t < 1) {
+ clear = false;
+ if (t < 0) return;
+ } else {
+ t = 1;
+ }
+
+ // Determine the stage of this transition.
+ // 0 - Not yet started.
+ // 1 - In progress.
+ // 2 - Ended.
+ if (stage[k]) {
+ if (!tx || tx.active != transitionId) {
+ stage[k] = 2;
+ return;
+ }
+ } else if (!tx || tx.active > transitionId) {
+ stage[k] = 2;
+ return;
+ } else {
+ stage[k] = 1;
+ event.start.dispatch.apply(this, arguments);
+ ik = interpolators[k] = {};
+ tx.active = transitionId;
+ for (tk in tweens) ik[tk] = tweens[tk].apply(this, arguments);
+ }
+
+ // Apply the interpolators!
+ te = ease(t);
+ for (tk in tweens) ik[tk].call(this, te);
+
+ // Handle ending transitions.
+ if (t == 1) {
+ stage[k] = 2;
+ if (tx.active == transitionId) {
+ var owner = tx.owner;
+ if (owner == transitionId) {
+ delete this.__transition__;
+ if (remove) this.parentNode.removeChild(this);
+ }
+ d3_transitionInheritId = transitionId;
+ event.end.dispatch.apply(this, arguments);
+ d3_transitionInheritId = 0;
+ tx.owner = owner;
+ }
+ }
+ });
+ return clear;
+ }
+
+ transition.delay = function(value) {
+ var delayMin = Infinity,
+ k = -1;
+ if (typeof value == "function") {
+ groups.each(function(d, i) {
+ var x = delay[++k] = +value.apply(this, arguments);
+ if (x < delayMin) delayMin = x;
+ });
+ } else {
+ delayMin = +value;
+ groups.each(function(d, i) {
+ delay[++k] = delayMin;
+ });
+ }
+ d3_timer(step, delayMin);
+ return transition;
+ };
+
+ transition.duration = function(value) {
+ var k = -1;
+ if (typeof value == "function") {
+ durationMax = 0;
+ groups.each(function(d, i) {
+ var x = duration[++k] = +value.apply(this, arguments);
+ if (x > durationMax) durationMax = x;
+ });
+ } else {
+ durationMax = +value;
+ groups.each(function(d, i) {
+ duration[++k] = durationMax;
+ });
+ }
+ return transition;
+ };
+
+ transition.ease = function(value) {
+ ease = typeof value == "function" ? value : d3.ease.apply(d3, arguments);
+ return transition;
+ };
+
+ transition.attrTween = function(name, tween) {
+
+ /** @this {Element} */
+ function attrTween(d, i) {
+ var f = tween.call(this, d, i, this.getAttribute(name));
+ return function(t) {
+ this.setAttribute(name, f(t));
+ };
+ }
+
+ /** @this {Element} */
+ function attrTweenNS(d, i) {
+ var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
+ return function(t) {
+ this.setAttributeNS(name.space, name.local, f(t));
+ };
+ }
+
+ tweens["attr." + name] = name.local ? attrTweenNS : attrTween;
+ return transition;
+ };
+
+ transition.attr = function(name, value) {
+ return transition.attrTween(name, d3_transitionTween(value));
+ };
+
+ transition.styleTween = function(name, tween, priority) {
+ if (arguments.length < 3) priority = null;
+
+ /** @this {Element} */
+ function styleTween(d, i) {
+ var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name));
+ return function(t) {
+ this.style.setProperty(name, f(t), priority);
+ };
+ }
+
+ tweens["style." + name] = styleTween;
+ return transition;
+ };
+
+ transition.style = function(name, value, priority) {
+ if (arguments.length < 3) priority = null;
+ return transition.styleTween(name, d3_transitionTween(value), priority);
+ };
+
+ transition.select = function(query) {
+ var k, t = d3_transition(groups.select(query)).ease(ease);
+ k = -1; t.delay(function(d, i) { return delay[++k]; });
+ k = -1; t.duration(function(d, i) { return duration[++k]; });
+ return t;
+ };
+
+ transition.selectAll = function(query) {
+ var k, t = d3_transition(groups.selectAll(query)).ease(ease);
+ k = -1; t.delay(function(d, i) { return delay[i ? k : ++k]; })
+ k = -1; t.duration(function(d, i) { return duration[i ? k : ++k]; });
+ return t;
+ };
+
+ transition.remove = function() {
+ remove = true;
+ return transition;
+ };
+
+ transition.each = function(type, listener) {
+ event[type].add(listener);
+ return transition;
+ };
+
+ transition.call = d3_call;
+
+ return transition.delay(0).duration(250);
+}
+
+function d3_transitionTween(b) {
+ return typeof b == "function"
+ ? function(d, i, a) { return d3.interpolate(a, String(b.call(this, d, i))); }
+ : (b = String(b), function(d, i, a) { return d3.interpolate(a, b); });
+}
+var d3_timer_queue = null,
+ d3_timer_timeout = 0,
+ d3_timer_interval;
+
+// The timer will continue to fire until callback returns true.
+d3.timer = function(callback) {
+ d3_timer(callback, 0);
+};
+
+function d3_timer(callback, delay) {
+ var now = Date.now(),
+ found = false,
+ start = now + delay,
+ t0,
+ t1 = d3_timer_queue;
+
+ if (!isFinite(delay)) return;
+
+ // Scan the queue for earliest callback.
+ while (t1) {
+ if (t1.callback == callback) {
+ t1.then = now;
+ t1.delay = delay;
+ found = true;
+ } else {
+ var x = t1.then + t1.delay;
+ if (x < start) start = x;
+ }
+ t0 = t1;
+ t1 = t1.next;
+ }
+
+ // Otherwise, add the callback to the queue.
+ if (!found) d3_timer_queue = {
+ callback: callback,
+ then: now,
+ delay: delay,
+ next: d3_timer_queue
+ };
+
+ if (!d3_timer_interval) {
+ clearTimeout(d3_timer_timeout);
+ d3_timer_timeout = setTimeout(d3_timer_start, Math.max(24, start - now));
+ }
+}
+
+function d3_timer_start() {
+ d3_timer_interval = 1;
+ d3_timer_timeout = 0;
+ d3_timer_frame(d3_timer_step);
+}
+
+function d3_timer_step() {
+ var elapsed,
+ now = Date.now(),
+ t0 = null,
+ t1 = d3_timer_queue;
+ while (t1) {
+ elapsed = now - t1.then;
+ if (elapsed > t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = (t0 = t1).next;
+ }
+ d3_timer_flush();
+ if (d3_timer_interval) d3_timer_frame(d3_timer_step);
+}
+
+// Flush after callbacks, to avoid concurrent queue modification.
+function d3_timer_flush() {
+ var t0 = null,
+ t1 = d3_timer_queue;
+ while (t1) {
+ t1 = t1.flush
+ ? (t0 ? t0.next = t1.next : d3_timer_queue = t1.next)
+ : (t0 = t1).next;
+ }
+ if (!t0) d3_timer_interval = 0;
+}
+
+var d3_timer_frame = window.requestAnimationFrame
+ || window.webkitRequestAnimationFrame
+ || window.mozRequestAnimationFrame
+ || window.oRequestAnimationFrame
+ || window.msRequestAnimationFrame
+ || function(callback) { setTimeout(callback, 17); };
+d3.scale = {};
+d3.scale.linear = function() {
+ var x0 = 0,
+ x1 = 1,
+ y0 = 0,
+ y1 = 1,
+ kx = 1, // 1 / (x1 - x0)
+ ky = 1, // (x1 - x0) / (y1 - y0)
+ interpolate = d3.interpolate,
+ i = interpolate(y0, y1);
+
+ function scale(x) {
+ return i((x - x0) * kx);
+ }
+
+ // Note: requires range is coercible to number!
+ scale.invert = function(y) {
+ return (y - y0) * ky + x0;
+ };
+
+ scale.domain = function(x) {
+ if (!arguments.length) return [x0, x1];
+ x0 = +x[0];
+ x1 = +x[1];
+ kx = 1 / (x1 - x0);
+ ky = (x1 - x0) / (y1 - y0);
+ return scale;
+ };
+
+ scale.range = function(x) {
+ if (!arguments.length) return [y0, y1];
+ y0 = x[0];
+ y1 = x[1];
+ ky = (x1 - x0) / (y1 - y0);
+ i = interpolate(y0, y1);
+ return scale;
+ };
+
+ scale.rangeRound = function(x) {
+ return scale.range(x).interpolate(d3.interpolateRound);
+ };
+
+ scale.interpolate = function(x) {
+ if (!arguments.length) return interpolate;
+ i = (interpolate = x)(y0, y1);
+ return scale;
+ };
+
+ // TODO Dates? Ugh.
+ function tickRange(m) {
+ var start = Math.min(x0, x1),
+ stop = Math.max(x0, x1),
+ span = stop - start,
+ step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)),
+ err = m / (span / step);
+
+ // Filter ticks to get closer to the desired count.
+ if (err <= .15) step *= 10;
+ else if (err <= .35) step *= 5;
+ else if (err <= .75) step *= 2;
+
+ // Round start and stop values to step interval.
+ return {
+ start: Math.ceil(start / step) * step,
+ stop: Math.floor(stop / step) * step + step * .5, // inclusive
+ step: step
+ };
+ }
+
+ scale.ticks = function(m) {
+ var range = tickRange(m);
+ return d3.range(range.start, range.stop, range.step);
+ };
+
+ scale.tickFormat = function(m) {
+ var n = Math.max(0, -Math.floor(Math.log(tickRange(m).step) / Math.LN10 + .01));
+ return d3.format(",." + n + "f");
+ };
+
+ return scale;
+};
+d3.scale.log = function() {
+ var linear = d3.scale.linear(),
+ log = d3_scale_log,
+ pow = log.pow;
+
+ function scale(x) {
+ return linear(log(x));
+ }
+
+ scale.invert = function(x) {
+ return pow(linear.invert(x));
+ };
+
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(pow);
+ log = (x[0] || x[1]) < 0 ? d3_scale_logn : d3_scale_log;
+ pow = log.pow;
+ linear.domain(x.map(log));
+ return scale;
+ };
+
+ scale.range = d3.rebind(scale, linear.range);
+ scale.rangeRound = d3.rebind(scale, linear.rangeRound);
+ scale.interpolate = d3.rebind(scale, linear.interpolate);
+
+ scale.ticks = function() {
+ var d = linear.domain(),
+ ticks = [];
+ if (d.every(isFinite)) {
+ var i = Math.floor(d[0]),
+ j = Math.ceil(d[1]),
+ u = pow(d[0]),
+ v = pow(d[1]);
+ if (log === d3_scale_logn) {
+ ticks.push(pow(i));
+ for (; i++ < j;) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
+ } else {
+ for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
+ ticks.push(pow(i));
+ }
+ for (i = 0; ticks[i] < u; i++) {} // strip small values
+ for (j = ticks.length; ticks[j - 1] > v; j--) {} // strip big values
+ ticks = ticks.slice(i, j);
+ }
+ return ticks;
+ };
+
+ scale.tickFormat = function() {
+ return function(d) { return d.toPrecision(1); };
+ };
+
+ return scale;
+};
+
+function d3_scale_log(x) {
+ return Math.log(x) / Math.LN10;
+}
+
+function d3_scale_logn(x) {
+ return -Math.log(-x) / Math.LN10;
+}
+
+d3_scale_log.pow = function(x) {
+ return Math.pow(10, x);
+};
+
+d3_scale_logn.pow = function(x) {
+ return -Math.pow(10, -x);
+};
+d3.scale.pow = function() {
+ var linear = d3.scale.linear(),
+ tick = d3.scale.linear(), // TODO better tick formatting...
+ exponent = 1,
+ powp = Number,
+ powb = powp;
+
+ function scale(x) {
+ return linear(powp(x));
+ }
+
+ scale.invert = function(x) {
+ return powb(linear.invert(x));
+ };
+
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(powb);
+ var pow = (x[0] || x[1]) < 0 ? d3_scale_pown : d3_scale_pow;
+ powp = pow(exponent);
+ powb = pow(1 / exponent);
+ linear.domain(x.map(powp));
+ tick.domain(x);
+ return scale;
+ };
+
+ scale.range = d3.rebind(scale, linear.range);
+ scale.rangeRound = d3.rebind(scale, linear.rangeRound);
+ scale.interpolate = d3.rebind(scale, linear.interpolate);
+ scale.ticks = tick.ticks;
+ scale.tickFormat = tick.tickFormat;
+
+ scale.exponent = function(x) {
+ if (!arguments.length) return exponent;
+ var domain = scale.domain();
+ exponent = x;
+ return scale.domain(domain);
+ };
+
+ return scale;
+};
+
+function d3_scale_pow(e) {
+ return function(x) {
+ return Math.pow(x, e);
+ };
+}
+
+function d3_scale_pown(e) {
+ return function(x) {
+ return -Math.pow(-x, e);
+ };
+}
+d3.scale.sqrt = function() {
+ return d3.scale.pow().exponent(.5);
+};
+d3.scale.ordinal = function() {
+ var domain = [],
+ index = {},
+ range = [],
+ rangeBand = 0;
+
+ function scale(x) {
+ var i = x in index ? index[x] : (index[x] = domain.push(x) - 1);
+ return range[i % range.length];
+ }
+
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x;
+ index = {};
+ var i = -1, j = -1, n = domain.length; while (++i < n) {
+ x = domain[i];
+ if (!(x in index)) index[x] = ++j;
+ }
+ return scale;
+ };
+
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return scale;
+ };
+
+ scale.rangePoints = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var start = x[0],
+ stop = x[1],
+ step = (stop - start) / (domain.length - 1 + padding);
+ range = domain.length == 1
+ ? [(start + stop) / 2]
+ : d3.range(start + step * padding / 2, stop + step / 2, step);
+ rangeBand = 0;
+ return scale;
+ };
+
+ scale.rangeBands = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var start = x[0],
+ stop = x[1],
+ step = (stop - start) / (domain.length + padding);
+ range = d3.range(start + step * padding, stop, step);
+ rangeBand = step * (1 - padding);
+ return scale;
+ };
+
+ scale.rangeRoundBands = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var start = x[0],
+ stop = x[1],
+ diff = stop - start,
+ step = Math.floor(diff / (domain.length + padding)),
+ err = diff - (domain.length - padding) * step;
+ range = d3.range(start + Math.round(err / 2), stop, step);
+ rangeBand = Math.round(step * (1 - padding));
+ return scale;
+ };
+
+ scale.rangeBand = function() {
+ return rangeBand;
+ };
+
+ return scale;
+};
+/*
+ * This product includes color specifications and designs developed by Cynthia
+ * Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information.
+ */
+
+d3.scale.category10 = function() {
+ return d3.scale.ordinal().range(d3_category10);
+};
+
+d3.scale.category20 = function() {
+ return d3.scale.ordinal().range(d3_category20);
+};
+
+d3.scale.category20b = function() {
+ return d3.scale.ordinal().range(d3_category20b);
+};
+
+d3.scale.category20c = function() {
+ return d3.scale.ordinal().range(d3_category20c);
+};
+
+var d3_category10 = [
+ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
+ "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"
+];
+
+var d3_category20 = [
+ "#1f77b4", "#aec7e8",
+ "#ff7f0e", "#ffbb78",
+ "#2ca02c", "#98df8a",
+ "#d62728", "#ff9896",
+ "#9467bd", "#c5b0d5",
+ "#8c564b", "#c49c94",
+ "#e377c2", "#f7b6d2",
+ "#7f7f7f", "#c7c7c7",
+ "#bcbd22", "#dbdb8d",
+ "#17becf", "#9edae5"
+];
+
+var d3_category20b = [
+ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede",
+ "#637939", "#8ca252", "#b5cf6b", "#cedb9c",
+ "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94",
+ "#843c39", "#ad494a", "#d6616b", "#e7969c",
+ "#7b4173", "#a55194", "#ce6dbd", "#de9ed6"
+];
+
+var d3_category20c = [
+ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef",
+ "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2",
+ "#31a354", "#74c476", "#a1d99b", "#c7e9c0",
+ "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb",
+ "#636363", "#969696", "#bdbdbd", "#d9d9d9"
+];
+d3.scale.quantile = function() {
+ var domain = [],
+ range = [],
+ thresholds = [];
+
+ function rescale() {
+ var i = -1,
+ n = thresholds.length = range.length,
+ k = domain.length / n;
+ while (++i < n) thresholds[i] = domain[~~(i * k)];
+ }
+
+ function quantile(value) {
+ if (isNaN(value = +value)) return NaN;
+ var low = 0, high = thresholds.length - 1;
+ while (low <= high) {
+ var mid = (low + high) >> 1, midValue = thresholds[mid];
+ if (midValue < value) low = mid + 1;
+ else if (midValue > value) high = mid - 1;
+ else return mid;
+ }
+ return high < 0 ? 0 : high;
+ }
+
+ function scale(x) {
+ return range[quantile(x)];
+ }
+
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending);
+ rescale();
+ return scale;
+ };
+
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ rescale();
+ return scale;
+ };
+
+ scale.quantiles = function() {
+ return thresholds;
+ };
+
+ return scale;
+};
+d3.scale.quantize = function() {
+ var x0 = 0,
+ x1 = 1,
+ kx = 2,
+ i = 1,
+ range = [0, 1];
+
+ function scale(x) {
+ return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
+ }
+
+ scale.domain = function(x) {
+ if (!arguments.length) return [x0, x1];
+ x0 = x[0];
+ x1 = x[1];
+ kx = range.length / (x1 - x0);
+ return scale;
+ };
+
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ kx = range.length / (x1 - x0);
+ i = range.length - 1;
+ return scale;
+ };
+
+ return scale;
+};
+d3.svg = {};
+d3.svg.arc = function() {
+ var innerRadius = d3_svg_arcInnerRadius,
+ outerRadius = d3_svg_arcOuterRadius,
+ startAngle = d3_svg_arcStartAngle,
+ endAngle = d3_svg_arcEndAngle;
+
+ function arc() {
+ var r0 = innerRadius.apply(this, arguments),
+ r1 = outerRadius.apply(this, arguments),
+ a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset,
+ a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset,
+ da = a1 - a0,
+ df = da < Math.PI ? "0" : "1",
+ c0 = Math.cos(a0),
+ s0 = Math.sin(a0),
+ c1 = Math.cos(a1),
+ s1 = Math.sin(a1);
+ return da >= d3_svg_arcMax
+ ? (r0
+ ? "M0," + r1
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1)
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + r1
+ + "M0," + r0
+ + "A" + r0 + "," + r0 + " 0 1,1 0," + (-r0)
+ + "A" + r0 + "," + r0 + " 0 1,1 0," + r0
+ + "Z"
+ : "M0," + r1
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1)
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + r1
+ + "Z")
+ : (r0
+ ? "M" + r1 * c0 + "," + r1 * s0
+ + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1
+ + "L" + r0 * c1 + "," + r0 * s1
+ + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0
+ + "Z"
+ : "M" + r1 * c0 + "," + r1 * s0
+ + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1
+ + "L0,0"
+ + "Z");
+ }
+
+ arc.innerRadius = function(v) {
+ if (!arguments.length) return innerRadius;
+ innerRadius = d3_functor(v);
+ return arc;
+ };
+
+ arc.outerRadius = function(v) {
+ if (!arguments.length) return outerRadius;
+ outerRadius = d3_functor(v);
+ return arc;
+ };
+
+ arc.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return arc;
+ };
+
+ arc.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return arc;
+ };
+
+ arc.centroid = function() {
+ var r = (innerRadius.apply(this, arguments)
+ + outerRadius.apply(this, arguments)) / 2,
+ a = (startAngle.apply(this, arguments)
+ + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
+ return [Math.cos(a) * r, Math.sin(a) * r];
+ };
+
+ return arc;
+};
+
+var d3_svg_arcOffset = -Math.PI / 2,
+ d3_svg_arcMax = 2 * Math.PI - 1e-6;
+
+function d3_svg_arcInnerRadius(d) {
+ return d.innerRadius;
+}
+
+function d3_svg_arcOuterRadius(d) {
+ return d.outerRadius;
+}
+
+function d3_svg_arcStartAngle(d) {
+ return d.startAngle;
+}
+
+function d3_svg_arcEndAngle(d) {
+ return d.endAngle;
+}
+d3.svg.line = function() {
+ var x = d3_svg_lineX,
+ y = d3_svg_lineY,
+ interpolate = "linear",
+ interpolator = d3_svg_lineInterpolators[interpolate],
+ tension = .7;
+
+ function line(d) {
+ return d.length < 1 ? null
+ : "M" + interpolator(d3_svg_linePoints(this, d, x, y), tension);
+ }
+
+ line.x = function(v) {
+ if (!arguments.length) return x;
+ x = v;
+ return line;
+ };
+
+ line.y = function(v) {
+ if (!arguments.length) return y;
+ y = v;
+ return line;
+ };
+
+ line.interpolate = function(v) {
+ if (!arguments.length) return interpolate;
+ interpolator = d3_svg_lineInterpolators[interpolate = v];
+ return line;
+ };
+
+ line.tension = function(v) {
+ if (!arguments.length) return tension;
+ tension = v;
+ return line;
+ };
+
+ return line;
+};
+
+// Converts the specified array of data into an array of points
+// (x-y tuples), by evaluating the specified `x` and `y` functions on each
+// data point. The `this` context of the evaluated functions is the specified
+// "self" object; each function is passed the current datum and index.
+function d3_svg_linePoints(self, d, x, y) {
+ var points = [],
+ i = -1,
+ n = d.length,
+ fx = typeof x == "function",
+ fy = typeof y == "function",
+ value;
+ if (fx && fy) {
+ while (++i < n) points.push([
+ x.call(self, value = d[i], i),
+ y.call(self, value, i)
+ ]);
+ } else if (fx) {
+ while (++i < n) points.push([x.call(self, d[i], i), y]);
+ } else if (fy) {
+ while (++i < n) points.push([x, y.call(self, d[i], i)]);
+ } else {
+ while (++i < n) points.push([x, y]);
+ }
+ return points;
+}
+
+// The default `x` property, which references d[0].
+function d3_svg_lineX(d) {
+ return d[0];
+}
+
+// The default `y` property, which references d[1].
+function d3_svg_lineY(d) {
+ return d[1];
+}
+
+// The various interpolators supported by the `line` class.
+var d3_svg_lineInterpolators = {
+ "linear": d3_svg_lineLinear,
+ "step-before": d3_svg_lineStepBefore,
+ "step-after": d3_svg_lineStepAfter,
+ "basis": d3_svg_lineBasis,
+ "basis-closed": d3_svg_lineBasisClosed,
+ "cardinal": d3_svg_lineCardinal,
+ "cardinal-closed": d3_svg_lineCardinalClosed
+};
+
+// Linear interpolation; generates "L" commands.
+function d3_svg_lineLinear(points) {
+ var path = [],
+ i = 0,
+ n = points.length,
+ p = points[0];
+ path.push(p[0], ",", p[1]);
+ while (++i < n) path.push("L", (p = points[i])[0], ",", p[1]);
+ return path.join("");
+}
+
+// Step interpolation; generates "H" and "V" commands.
+function d3_svg_lineStepBefore(points) {
+ var path = [],
+ i = 0,
+ n = points.length,
+ p = points[0];
+ path.push(p[0], ",", p[1]);
+ while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
+ return path.join("");
+}
+
+// Step interpolation; generates "H" and "V" commands.
+function d3_svg_lineStepAfter(points) {
+ var path = [],
+ i = 0,
+ n = points.length,
+ p = points[0];
+ path.push(p[0], ",", p[1]);
+ while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
+ return path.join("");
+}
+
+// Closed cardinal spline interpolation; generates "C" commands.
+function d3_svg_lineCardinalClosed(points, tension) {
+ return points.length < 3
+ ? d3_svg_lineLinear(points)
+ : points[0] + d3_svg_lineHermite(points,
+ d3_svg_lineCardinalTangents([points[points.length - 2]]
+ .concat(points, [points[1]]), tension));
+}
+
+// Cardinal spline interpolation; generates "C" commands.
+function d3_svg_lineCardinal(points, tension, closed) {
+ return points.length < 3
+ ? d3_svg_lineLinear(points)
+ : points[0] + d3_svg_lineHermite(points,
+ d3_svg_lineCardinalTangents(points, tension));
+}
+
+// Hermite spline construction; generates "C" commands.
+function d3_svg_lineHermite(points, tangents) {
+ if (tangents.length < 1
+ || (points.length != tangents.length
+ && points.length != tangents.length + 2)) {
+ return d3_svg_lineLinear(points);
+ }
+
+ var quad = points.length != tangents.length,
+ path = "",
+ p0 = points[0],
+ p = points[1],
+ t0 = tangents[0],
+ t = t0,
+ pi = 1;
+
+ if (quad) {
+ path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3)
+ + "," + p[0] + "," + p[1];
+ p0 = points[1];
+ pi = 2;
+ }
+
+ if (tangents.length > 1) {
+ t = tangents[1];
+ p = points[pi];
+ pi++;
+ path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1])
+ + "," + (p[0] - t[0]) + "," + (p[1] - t[1])
+ + "," + p[0] + "," + p[1];
+ for (var i = 2; i < tangents.length; i++, pi++) {
+ p = points[pi];
+ t = tangents[i];
+ path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1])
+ + "," + p[0] + "," + p[1];
+ }
+ }
+
+ if (quad) {
+ var lp = points[pi];
+ path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3)
+ + "," + lp[0] + "," + lp[1];
+ }
+
+ return path;
+}
+
+// Generates tangents for a cardinal spline.
+function d3_svg_lineCardinalTangents(points, tension) {
+ var tangents = [],
+ a = (1 - tension) / 2,
+ p0 = points[0],
+ p1 = points[1],
+ p2 = points[2],
+ i = 2,
+ n = points.length;
+ while (++i < n) {
+ tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]);
+ p0 = p1;
+ p1 = p2;
+ p2 = points[i];
+ }
+ tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]);
+ return tangents;
+}
+
+// Open B-spline interpolation; generates "C" commands.
+function d3_svg_lineBasis(points) {
+ if (points.length < 3) return d3_svg_lineLinear(points);
+ var path = [],
+ i = 1,
+ n = points.length,
+ pi = points[0],
+ x0 = pi[0],
+ y0 = pi[1],
+ px = [x0, x0, x0, (pi = points[1])[0]],
+ py = [y0, y0, y0, pi[1]];
+ path.push(x0, ",", y0);
+ d3_svg_lineBasisBezier(path, px, py);
+ while (++i < n) {
+ pi = points[i];
+ px.shift(); px.push(pi[0]);
+ py.shift(); py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ i = -1;
+ while (++i < 2) {
+ px.shift(); px.push(pi[0]);
+ py.shift(); py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+}
+
+// Closed B-spline interpolation; generates "C" commands.
+function d3_svg_lineBasisClosed(points) {
+ var path,
+ i = -1,
+ n = points.length,
+ m = n + 4,
+ pi,
+ px = [],
+ py = [];
+ while (++i < 4) {
+ pi = points[i % n];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path = [
+ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",",
+ d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)
+ ];
+ --i; while (++i < m) {
+ pi = points[i % n];
+ px.shift(); px.push(pi[0]);
+ py.shift(); py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+}
+
+// Returns the dot product of the given four-element vectors.
+function d3_svg_lineDot4(a, b) {
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
+}
+
+// Matrix to transform basis (b-spline) control points to bezier
+// control points. Derived from FvD 11.2.8.
+var d3_svg_lineBasisBezier1 = [0, 2/3, 1/3, 0],
+ d3_svg_lineBasisBezier2 = [0, 1/3, 2/3, 0],
+ d3_svg_lineBasisBezier3 = [0, 1/6, 2/3, 1/6];
+
+// Pushes a "C" Bézier curve onto the specified path array, given the
+// two specified four-element arrays which define the control points.
+function d3_svg_lineBasisBezier(path, x, y) {
+ path.push(
+ "C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
+}
+d3.svg.area = function() {
+ var x = d3_svg_lineX,
+ y0 = d3_svg_areaY0,
+ y1 = d3_svg_lineY,
+ interpolate = "linear",
+ interpolator = d3_svg_lineInterpolators[interpolate],
+ tension = .7;
+
+ // TODO horizontal / vertical / radial orientation
+
+ function area(d) {
+ return d.length < 1 ? null
+ : "M" + interpolator(d3_svg_linePoints(this, d, x, y1), tension)
+ + "L" + interpolator(d3_svg_linePoints(this, d, x, y0).reverse(), tension)
+ + "Z";
+ }
+
+ area.x = function(v) {
+ if (!arguments.length) return x;
+ x = v;
+ return area;
+ };
+
+ area.y0 = function(v) {
+ if (!arguments.length) return y0;
+ y0 = v;
+ return area;
+ };
+
+ area.y1 = function(v) {
+ if (!arguments.length) return y1;
+ y1 = v;
+ return area;
+ };
+
+ area.interpolate = function(v) {
+ if (!arguments.length) return interpolate;
+ interpolator = d3_svg_lineInterpolators[interpolate = v];
+ return area;
+ };
+
+ area.tension = function(v) {
+ if (!arguments.length) return tension;
+ tension = v;
+ return area;
+ };
+
+ return area;
+};
+
+function d3_svg_areaY0() {
+ return 0;
+}
+d3.svg.chord = function() {
+ var source = d3_svg_chordSource,
+ target = d3_svg_chordTarget,
+ radius = d3_svg_chordRadius,
+ startAngle = d3_svg_arcStartAngle,
+ endAngle = d3_svg_arcEndAngle;
+
+ // TODO Allow control point to be customized.
+
+ function chord(d, i) {
+ var s = subgroup(this, source, d, i),
+ t = subgroup(this, target, d, i);
+ return "M" + s.p0
+ + arc(s.r, s.p1) + (equals(s, t)
+ ? curve(s.r, s.p1, s.r, s.p0)
+ : curve(s.r, s.p1, t.r, t.p0)
+ + arc(t.r, t.p1)
+ + curve(t.r, t.p1, s.r, s.p0))
+ + "Z";
+ }
+
+ function subgroup(self, f, d, i) {
+ var subgroup = f.call(self, d, i),
+ r = radius.call(self, subgroup, i),
+ a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset,
+ a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
+ return {
+ r: r,
+ a0: a0,
+ a1: a1,
+ p0: [r * Math.cos(a0), r * Math.sin(a0)],
+ p1: [r * Math.cos(a1), r * Math.sin(a1)]
+ };
+ }
+
+ function equals(a, b) {
+ return a.a0 == b.a0 && a.a1 == b.a1;
+ }
+
+ function arc(r, p) {
+ return "A" + r + "," + r + " 0 0,1 " + p;
+ }
+
+ function curve(r0, p0, r1, p1) {
+ return "Q 0,0 " + p1;
+ }
+
+ chord.radius = function(v) {
+ if (!arguments.length) return radius;
+ radius = d3_functor(v);
+ return chord;
+ };
+
+ chord.source = function(v) {
+ if (!arguments.length) return source;
+ source = d3_functor(v);
+ return chord;
+ };
+
+ chord.target = function(v) {
+ if (!arguments.length) return target;
+ target = d3_functor(v);
+ return chord;
+ };
+
+ chord.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return chord;
+ };
+
+ chord.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return chord;
+ };
+
+ return chord;
+};
+
+function d3_svg_chordSource(d) {
+ return d.source;
+}
+
+function d3_svg_chordTarget(d) {
+ return d.target;
+}
+
+function d3_svg_chordRadius(d) {
+ return d.radius;
+}
+
+function d3_svg_chordStartAngle(d) {
+ return d.startAngle;
+}
+
+function d3_svg_chordEndAngle(d) {
+ return d.endAngle;
+}
+d3.svg.mouse = function(container) {
+ var point = (container.ownerSVGElement || container).createSVGPoint();
+ if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) {
+ var svg = d3.select(document.body)
+ .append("svg:svg")
+ .style("position", "absolute")
+ .style("top", 0)
+ .style("left", 0);
+ var ctm = svg[0][0].getScreenCTM();
+ d3_mouse_bug44083 = !(ctm.f || ctm.e);
+ svg.remove();
+ }
+ if (d3_mouse_bug44083) {
+ point.x = d3.event.pageX;
+ point.y = d3.event.pageY;
+ } else {
+ point.x = d3.event.clientX;
+ point.y = d3.event.clientY;
+ }
+ point = point.matrixTransform(container.getScreenCTM().inverse());
+ return [point.x, point.y];
+};
+
+// https://bugs.webkit.org/show_bug.cgi?id=44083
+var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;
+d3.svg.symbol = function() {
+ var type = d3_svg_symbolType,
+ size = d3_svg_symbolSize;
+
+ function symbol(d, i) {
+ return (d3_svg_symbols[type.call(this, d, i)]
+ || d3_svg_symbols.circle)
+ (size.call(this, d, i));
+ }
+
+ symbol.type = function(x) {
+ if (!arguments.length) return type;
+ type = d3_functor(x);
+ return symbol;
+ };
+
+ // size of symbol in square pixels
+ symbol.size = function(x) {
+ if (!arguments.length) return size;
+ size = d3_functor(x);
+ return symbol;
+ };
+
+ return symbol;
+};
+
+// TODO cross-diagonal?
+d3.svg.symbolTypes = [
+ "circle",
+ "cross",
+ "diamond",
+ "square",
+ "triangle-down",
+ "triangle-up"
+];
+
+function d3_svg_symbolSize() {
+ return 64;
+}
+
+function d3_svg_symbolType() {
+ return "circle";
+}
+
+var d3_svg_symbols = {
+ "circle": function(size) {
+ var r = Math.sqrt(size / Math.PI);
+ return "M0," + r
+ + "A" + r + "," + r + " 0 1,1 0," + (-r)
+ + "A" + r + "," + r + " 0 1,1 0," + r
+ + "Z";
+ },
+ "cross": function(size) {
+ var r = Math.sqrt(size / 5) / 2;
+ return "M" + -3 * r + "," + -r
+ + "H" + -r
+ + "V" + -3 * r
+ + "H" + r
+ + "V" + -r
+ + "H" + 3 * r
+ + "V" + r
+ + "H" + r
+ + "V" + 3 * r
+ + "H" + -r
+ + "V" + r
+ + "H" + -3 * r
+ + "Z";
+ },
+ "diamond": function(size) {
+ var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)),
+ rx = ry * d3_svg_symbolTan30;
+ return "M0," + -ry
+ + "L" + rx + ",0"
+ + " 0," + ry
+ + " " + -rx + ",0"
+ + "Z";
+ },
+ "square": function(size) {
+ var r = Math.sqrt(size) / 2;
+ return "M" + -r + "," + -r
+ + "L" + r + "," + -r
+ + " " + r + "," + r
+ + " " + -r + "," + r
+ + "Z";
+ },
+ "triangle-down": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3),
+ ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + ry
+ + "L" + rx +"," + -ry
+ + " " + -rx + "," + -ry
+ + "Z";
+ },
+ "triangle-up": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3),
+ ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + -ry
+ + "L" + rx +"," + ry
+ + " " + -rx + "," + ry
+ + "Z";
+ }
+};
+
+var d3_svg_symbolSqrt3 = Math.sqrt(3),
+ d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180);
+})() \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.layout.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.layout.js
new file mode 100644
index 00000000..abc5ebef
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.layout.js
@@ -0,0 +1,908 @@
+(function(){d3.layout = {};
+d3.layout.chord = function() {
+ var chord = {},
+ chords,
+ groups,
+ matrix,
+ n,
+ padding = 0,
+ sortGroups,
+ sortSubgroups,
+ sortChords;
+
+ function relayout() {
+ var subgroups = {},
+ groupSums = [],
+ groupIndex = d3.range(n),
+ subgroupIndex = [],
+ k,
+ x,
+ x0,
+ i,
+ j;
+
+ chords = [];
+ groups = [];
+
+ // Compute the sum.
+ k = 0, i = -1; while (++i < n) {
+ x = 0, j = -1; while (++j < n) {
+ x += matrix[i][j];
+ }
+ groupSums.push(x);
+ subgroupIndex.push(d3.range(n));
+ k += x;
+ }
+
+ // Sort groups…
+ if (sortGroups) {
+ groupIndex.sort(function(a, b) {
+ return sortGroups(groupSums[a], groupSums[b]);
+ });
+ }
+
+ // Sort subgroups…
+ if (sortSubgroups) {
+ subgroupIndex.forEach(function(d, i) {
+ d.sort(function(a, b) {
+ return sortSubgroups(matrix[i][a], matrix[i][b]);
+ });
+ });
+ }
+
+ // Convert the sum to scaling factor for [0, 2pi].
+ // TODO Allow start and end angle to be specified.
+ // TODO Allow padding to be specified as percentage?
+ k = (2 * Math.PI - padding * n) / k;
+
+ // Compute the start and end angle for each group and subgroup.
+ x = 0, i = -1; while (++i < n) {
+ x0 = x, j = -1; while (++j < n) {
+ var di = groupIndex[i],
+ dj = subgroupIndex[i][j],
+ v = matrix[di][dj];
+ subgroups[di + "-" + dj] = {
+ index: di,
+ subindex: dj,
+ startAngle: x,
+ endAngle: x += v * k,
+ value: v
+ };
+ }
+ groups.push({
+ index: di,
+ startAngle: x0,
+ endAngle: x,
+ value: (x - x0) / k
+ });
+ x += padding;
+ }
+
+ // Generate chords for each (non-empty) subgroup-subgroup link.
+ i = -1; while (++i < n) {
+ j = i - 1; while (++j < n) {
+ var source = subgroups[i + "-" + j],
+ target = subgroups[j + "-" + i];
+ if (source.value || target.value) {
+ chords.push({
+ source: source,
+ target: target
+ })
+ }
+ }
+ }
+
+ if (sortChords) resort();
+ }
+
+ function resort() {
+ chords.sort(function(a, b) {
+ a = Math.min(a.source.value, a.target.value);
+ b = Math.min(b.source.value, b.target.value);
+ return sortChords(a, b);
+ });
+ }
+
+ chord.matrix = function(x) {
+ if (!arguments.length) return matrix;
+ n = (matrix = x) && matrix.length;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.padding = function(x) {
+ if (!arguments.length) return padding;
+ padding = x;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.sortGroups = function(x) {
+ if (!arguments.length) return sortGroups;
+ sortGroups = x;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.sortSubgroups = function(x) {
+ if (!arguments.length) return sortSubgroups;
+ sortSubgroups = x;
+ chords = null;
+ return chord;
+ };
+
+ chord.sortChords = function(x) {
+ if (!arguments.length) return sortChords;
+ sortChords = x;
+ if (chords) resort();
+ return chord;
+ };
+
+ chord.chords = function() {
+ if (!chords) relayout();
+ return chords;
+ };
+
+ chord.groups = function() {
+ if (!groups) relayout();
+ return groups;
+ };
+
+ return chord;
+};
+// A rudimentary force layout using Gauss-Seidel.
+d3.layout.force = function() {
+ var force = {},
+ event = d3.dispatch("tick"),
+ size = [1, 1],
+ alpha = .5,
+ distance = 30,
+ interval,
+ nodes,
+ links,
+ distances;
+
+ function tick() {
+ var n = distances.length,
+ i, // current index
+ o, // current link
+ s, // current source
+ t, // current target
+ l, // current distance
+ x, // x-distance
+ y; // y-distance
+
+ // gauss-seidel relaxation
+ for (i = 0; i < n; ++i) {
+ o = distances[i];
+ s = o.source;
+ t = o.target;
+ x = t.x - s.x;
+ y = t.y - s.y;
+ if (l = Math.sqrt(x * x + y * y)) {
+ l = alpha / (o.distance * o.distance) * (l - distance * o.distance) / l;
+ x *= l;
+ y *= l;
+ if (!t.fixed) {
+ t.x -= x;
+ t.y -= y;
+ }
+ if (!s.fixed) {
+ s.x += x;
+ s.y += y;
+ }
+ }
+ }
+
+ event.tick.dispatch({type: "tick"});
+
+ // simulated annealing, basically
+ return (alpha *= .99) < .005;
+ }
+
+ force.on = function(type, listener) {
+ event[type].add(listener);
+ return force;
+ };
+
+ force.nodes = function(x) {
+ if (!arguments.length) return nodes;
+ nodes = x;
+ return force;
+ };
+
+ force.links = function(x) {
+ if (!arguments.length) return links;
+ links = x;
+ return force;
+ };
+
+ force.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return force;
+ };
+
+ force.distance = function(d) {
+ if (!arguments.length) return distance;
+ distance = d;
+ return force;
+ };
+
+ force.start = function() {
+ var i,
+ j,
+ k,
+ n = nodes.length,
+ m = links.length,
+ w = size[0],
+ h = size[1],
+ o;
+
+ var paths = [];
+ for (i = 0; i < n; ++i) {
+ o = nodes[i];
+ o.x = o.x || Math.random() * w;
+ o.y = o.y || Math.random() * h;
+ o.fixed = 0;
+ paths[i] = [];
+ for (j = 0; j < n; ++j) {
+ paths[i][j] = Infinity;
+ }
+ paths[i][i] = 0;
+ }
+
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ paths[o.source][o.target] = 1;
+ paths[o.target][o.source] = 1;
+ o.source = nodes[o.source];
+ o.target = nodes[o.target];
+ }
+
+ // Floyd-Warshall
+ for (k = 0; k < n; ++k) {
+ for (i = 0; i < n; ++i) {
+ for (j = 0; j < n; ++j) {
+ paths[i][j] = Math.min(paths[i][j], paths[i][k] + paths[k][j]);
+ }
+ }
+ }
+
+ distances = [];
+ for (i = 0; i < n; ++i) {
+ for (j = i + 1; j < n; ++j) {
+ distances.push({
+ source: nodes[i],
+ target: nodes[j],
+ distance: paths[i][j] * paths[i][j]
+ });
+ }
+ }
+
+ distances.sort(function(a, b) {
+ return a.distance - b.distance;
+ });
+
+ d3.timer(tick);
+ return force;
+ };
+
+ force.resume = function() {
+ alpha = .1;
+ d3.timer(tick);
+ return force;
+ };
+
+ force.stop = function() {
+ alpha = 0;
+ return force;
+ };
+
+ // use `node.call(force.drag)` to make nodes draggable
+ force.drag = function() {
+ var node, element;
+
+ this
+ .on("mouseover", function(d) { d.fixed = true; })
+ .on("mouseout", function(d) { if (d != node) d.fixed = false; })
+ .on("mousedown", mousedown);
+
+ d3.select(window)
+ .on("mousemove", mousemove)
+ .on("mouseup", mouseup);
+
+ function mousedown(d) {
+ (node = d).fixed = true;
+ element = this;
+ d3.event.preventDefault();
+ }
+
+ function mousemove() {
+ if (!node) return;
+ var m = d3.svg.mouse(element);
+ node.x = m[0];
+ node.y = m[1];
+ force.resume(); // restart annealing
+ }
+
+ function mouseup() {
+ if (!node) return;
+ mousemove();
+ node.fixed = false;
+ node = element = null;
+ }
+
+ return force;
+ };
+
+ return force;
+};
+d3.layout.partition = function() {
+ var hierarchy = d3.layout.hierarchy(),
+ size = [1, 1]; // width, height
+
+ function position(node, x, dx, dy) {
+ var children = node.children;
+ node.x = x;
+ node.y = node.depth * dy;
+ node.dx = dx;
+ node.dy = dy;
+ if (children) {
+ var i = -1,
+ n = children.length,
+ c,
+ d;
+ dx /= node.value;
+ while (++i < n) {
+ position(c = children[i], x, d = c.value * dx, dy);
+ x += d;
+ }
+ }
+ }
+
+ function depth(node) {
+ var children = node.children,
+ d = 0;
+ if (children) {
+ var i = -1,
+ n = children.length;
+ while (++i < n) d = Math.max(d, depth(children[i]));
+ }
+ return 1 + d;
+ }
+
+ function partition(d, i) {
+ var nodes = hierarchy.call(this, d, i);
+ position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
+ return nodes;
+ }
+
+ partition.sort = d3.rebind(partition, hierarchy.sort);
+ partition.children = d3.rebind(partition, hierarchy.children);
+ partition.value = d3.rebind(partition, hierarchy.value);
+
+ partition.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return partition;
+ };
+
+ return partition;
+};
+d3.layout.pie = function() {
+ var value = Number,
+ sort = null,
+ startAngle = 0,
+ endAngle = 2 * Math.PI;
+
+ function pie(data, i) {
+
+ // Compute the start angle.
+ var a = +(typeof startAngle == "function"
+ ? startAngle.apply(this, arguments)
+ : startAngle);
+
+ // Compute the angular range (end - start).
+ var k = (typeof endAngle == "function"
+ ? endAngle.apply(this, arguments)
+ : endAngle) - startAngle;
+
+ // Optionally sort the data.
+ var index = d3.range(data.length);
+ if (sort != null) index.sort(function(i, j) {
+ return sort(data[i], data[j]);
+ });
+
+ // Compute the numeric values for each data element.
+ var values = data.map(value);
+
+ // Convert k into a scale factor from value to angle, using the sum.
+ k /= values.reduce(function(p, d) { return p + d; }, 0);
+
+ // Compute the arcs!
+ var arcs = index.map(function(i) {
+ return {
+ value: d = values[i],
+ startAngle: a,
+ endAngle: a += d * k
+ };
+ });
+
+ // Return the arcs in the original data's order.
+ return data.map(function(d, i) {
+ return arcs[index[i]];
+ });
+ }
+
+ /**
+ * Specifies the value function *x*, which returns a nonnegative numeric value
+ * for each datum. The default value function is `Number`. The value function
+ * is passed two arguments: the current datum and the current index.
+ */
+ pie.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return pie;
+ };
+
+ /**
+ * Specifies a sort comparison operator *x*. The comparator is passed two data
+ * elements from the data array, a and b; it returns a negative value if a is
+ * less than b, a positive value if a is greater than b, and zero if a equals
+ * b.
+ */
+ pie.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return pie;
+ };
+
+ /**
+ * Specifies the overall start angle of the pie chart. Defaults to 0. The
+ * start angle can be specified either as a constant or as a function; in the
+ * case of a function, it is evaluated once per array (as opposed to per
+ * element).
+ */
+ pie.startAngle = function(x) {
+ if (!arguments.length) return startAngle;
+ startAngle = x;
+ return pie;
+ };
+
+ /**
+ * Specifies the overall end angle of the pie chart. Defaults to 2Ï€. The
+ * end angle can be specified either as a constant or as a function; in the
+ * case of a function, it is evaluated once per array (as opposed to per
+ * element).
+ */
+ pie.endAngle = function(x) {
+ if (!arguments.length) return endAngle;
+ endAngle = x;
+ return pie;
+ };
+
+ return pie;
+};
+// data is two-dimensional array of x,y; we populate y0
+// TODO perhaps make the `x`, `y` and `y0` structure customizable
+d3.layout.stack = function() {
+ var order = "default",
+ offset = "zero";
+
+ function stack(data) {
+ var n = data.length,
+ m = data[0].length,
+ i,
+ j,
+ y0;
+
+ // compute the order of series
+ var index = d3_layout_stackOrders[order](data);
+
+ // set y0 on the baseline
+ d3_layout_stackOffsets[offset](data, index);
+
+ // propagate offset to other series
+ for (j = 0; j < m; ++j) {
+ for (i = 1, y0 = data[index[0]][j].y0; i < n; ++i) {
+ data[index[i]][j].y0 = y0 += data[index[i - 1]][j].y;
+ }
+ }
+
+ return data;
+ }
+
+ stack.order = function(x) {
+ if (!arguments.length) return order;
+ order = x;
+ return stack;
+ };
+
+ stack.offset = function(x) {
+ if (!arguments.length) return offset;
+ offset = x;
+ return stack;
+ };
+
+ return stack;
+}
+
+var d3_layout_stackOrders = {
+
+ "inside-out": function(data) {
+ var n = data.length,
+ i,
+ j,
+ max = data.map(d3_layout_stackMaxIndex),
+ sums = data.map(d3_layout_stackReduceSum),
+ index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }),
+ top = 0,
+ bottom = 0,
+ tops = [],
+ bottoms = [];
+ for (i = 0; i < n; i++) {
+ j = index[i];
+ if (top < bottom) {
+ top += sums[j];
+ tops.push(j);
+ } else {
+ bottom += sums[j];
+ bottoms.push(j);
+ }
+ }
+ return bottoms.reverse().concat(tops);
+ },
+
+ "reverse": function(data) {
+ return d3.range(data.length).reverse();
+ },
+
+ "default": function(data) {
+ return d3.range(data.length);
+ }
+
+};
+
+var d3_layout_stackOffsets = {
+
+ "silhouette": function(data, index) {
+ var n = data.length,
+ m = data[0].length,
+ sums = [],
+ max = 0,
+ i,
+ j,
+ o;
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j].y;
+ if (o > max) max = o;
+ sums.push(o);
+ }
+ for (j = 0, i = index[0]; j < m; ++j) {
+ data[i][j].y0 = (max - sums[j]) / 2;
+ }
+ },
+
+ "wiggle": function(data, index) {
+ var n = data.length,
+ x = data[0],
+ m = x.length,
+ max = 0,
+ i,
+ j,
+ k,
+ ii,
+ ik,
+ i0 = index[0],
+ s1,
+ s2,
+ s3,
+ dx,
+ o,
+ o0;
+ data[i0][0].y0 = o = o0 = 0;
+ for (j = 1; j < m; ++j) {
+ for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j].y;
+ for (i = 0, s2 = 0, dx = x[j].x - x[j - 1].x; i < n; ++i) {
+ for (k = 0, ii = index[i], s3 = (data[ii][j].y - data[ii][j - 1].y) / (2 * dx); k < i; ++k) {
+ s3 += (data[ik = index[k]][j].y - data[ik][j - 1].y) / dx;
+ }
+ s2 += s3 * data[ii][j].y;
+ }
+ data[i0][j].y0 = o -= s1 ? s2 / s1 * dx : 0;
+ if (o < o0) o0 = o;
+ }
+ for (j = 0; j < m; ++j) data[i0][j].y0 -= o0;
+ },
+
+ "zero": function(data, index) {
+ var j = 0,
+ m = data[0].length,
+ i0 = index[0];
+ for (; j < m; ++j) data[i0][j].y0 = 0;
+ }
+
+};
+
+function d3_layout_stackReduceSum(d) {
+ return d.reduce(d3_layout_stackSum, 0);
+}
+
+function d3_layout_stackMaxIndex(array) {
+ var i = 1,
+ j = 0,
+ v = array[0].y,
+ k,
+ n = array.length;
+ for (; i < n; ++i) {
+ if ((k = array[i].y) > v) {
+ j = i;
+ v = k;
+ }
+ }
+ return j;
+}
+
+function d3_layout_stackSum(p, d) {
+ return p + d.y;
+}
+d3.layout.hierarchy = function() {
+ var sort = d3_layout_hierarchySort,
+ children = d3_layout_hierarchyChildren,
+ value = d3_layout_hierarchyValue;
+
+ // Recursively compute the node depth and value.
+ // Also converts the data representation into a standard hierarchy structure.
+ function recurse(data, depth, nodes) {
+ var datas = children.call(hierarchy, data, depth),
+ node = {depth: depth, data: data};
+ nodes.push(node);
+ if (datas) {
+ var i = -1,
+ n = datas.length,
+ c = node.children = [],
+ v = 0,
+ j = depth + 1;
+ while (++i < n) {
+ d = recurse(datas[i], j, nodes);
+ if (d.value > 0) { // ignore NaN, negative, etc.
+ c.push(d);
+ v += d.value;
+ d.parent = node;
+ }
+ }
+ if (sort) c.sort(sort);
+ node.value = v;
+ } else {
+ node.value = value.call(hierarchy, data, depth);
+ }
+ return node;
+ }
+
+ // Recursively re-evaluates the node value.
+ function revalue(node, depth) {
+ var children = node.children,
+ v = 0;
+ if (children) {
+ var i = -1,
+ n = children.length,
+ j = depth + 1;
+ while (++i < n) v += revalue(children[i], j);
+ } else {
+ v = value.call(hierarchy, node.data, depth);
+ }
+ return node.value = v;
+ }
+
+ function hierarchy(d) {
+ var nodes = [];
+ recurse(d, 0, nodes);
+ return nodes;
+ }
+
+ hierarchy.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return hierarchy;
+ };
+
+ hierarchy.children = function(x) {
+ if (!arguments.length) return children;
+ children = x;
+ return hierarchy;
+ };
+
+ hierarchy.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return hierarchy;
+ };
+
+ // Re-evaluates the `value` property for the specified hierarchy.
+ hierarchy.revalue = function(root) {
+ revalue(root, 0);
+ return root;
+ };
+
+ return hierarchy;
+}
+
+function d3_layout_hierarchyChildren(d) {
+ return d.children;
+}
+
+function d3_layout_hierarchyValue(d) {
+ return d.value;
+}
+
+function d3_layout_hierarchySort(a, b) {
+ return b.value - a.value;
+}
+// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk
+d3.layout.treemap = function() {
+ var hierarchy = d3.layout.hierarchy(),
+ round = Math.round,
+ size = [1, 1], // width, height
+ sticky = false,
+ stickies;
+
+ // Recursively compute the node area based on value & scale.
+ function scale(node, k) {
+ var children = node.children;
+ node.area = node.value * k;
+ if (children) {
+ var i = -1,
+ n = children.length;
+ while (++i < n) scale(children[i], k);
+ }
+ }
+
+ // Recursively arranges the specified node's children into squarified rows.
+ function squarify(node) {
+ if (!node.children) return;
+ var rect = {x: node.x, y: node.y, dx: node.dx, dy: node.dy},
+ row = [],
+ children = node.children.slice(), // copy-on-write
+ child,
+ best = Infinity, // the best row score so far
+ score, // the current row score
+ u = Math.min(rect.dx, rect.dy), // initial orientation
+ n;
+ row.area = 0;
+ while ((n = children.length) > 0) {
+ row.push(child = children[n - 1]);
+ row.area += child.area;
+ if ((score = worst(row, u)) <= best) { // continue with this orientation
+ children.pop();
+ best = score;
+ } else { // abort, and try a different orientation
+ row.area -= row.pop().area;
+ position(row, u, rect, false);
+ u = Math.min(rect.dx, rect.dy);
+ row.length = row.area = 0;
+ best = Infinity;
+ }
+ }
+ if (row.length) {
+ position(row, u, rect, true);
+ row.length = row.area = 0;
+ }
+ node.children.forEach(squarify);
+ }
+
+ // Recursively resizes the specified node's children into existing rows.
+ // Preserves the existing layout!
+ function stickify(node) {
+ if (!node.children) return;
+ var rect = {x: node.x, y: node.y, dx: node.dx, dy: node.dy},
+ children = node.children.slice(), // copy-on-write
+ child,
+ row = [];
+ row.area = 0;
+ while (child = children.pop()) {
+ row.push(child);
+ row.area += child.area;
+ if (child.z != null) {
+ position(row, child.z ? rect.dx : rect.dy, rect, !children.length);
+ row.length = row.area = 0;
+ }
+ }
+ node.children.forEach(stickify);
+ }
+
+ // Computes the score for the specified row, as the worst aspect ratio.
+ function worst(row, u) {
+ var s = row.area,
+ r,
+ rmax = 0,
+ rmin = Infinity,
+ i = -1,
+ n = row.length;
+ while (++i < n) {
+ r = row[i].area;
+ if (r < rmin) rmin = r;
+ if (r > rmax) rmax = r;
+ }
+ s *= s;
+ u *= u;
+ return Math.max((u * rmax) / s, s / (u * rmin));
+ }
+
+ // Positions the specified row of nodes. Modifies `rect`.
+ function position(row, u, rect, flush) {
+ var i = -1,
+ n = row.length,
+ x = rect.x,
+ y = rect.y,
+ v = u ? round(row.area / u) : 0,
+ o;
+ if (u == rect.dx) { // horizontal subdivision
+ if (flush || v > rect.dy) v = rect.dy; // over+underflow
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dy = v;
+ x += o.dx = round(o.area / v);
+ }
+ o.z = true;
+ o.dx += rect.x + rect.dx - x; // rounding error
+ rect.y += v;
+ rect.dy -= v;
+ } else { // vertical subdivision
+ if (flush || v > rect.dx) v = rect.dx; // over+underflow
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dx = v;
+ y += o.dy = round(o.area / v);
+ }
+ o.z = false;
+ o.dy += rect.y + rect.dy - y; // rounding error
+ rect.x += v;
+ rect.dx -= v;
+ }
+ }
+
+ function treemap(d) {
+ var nodes = stickies || hierarchy(d),
+ root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ root.dx = size[0];
+ root.dy = size[1];
+ if (stickies) hierarchy.revalue(root);
+ scale(root, size[0] * size[1] / root.value);
+ (stickies ? stickify : squarify)(root);
+ if (sticky) stickies = nodes;
+ return nodes;
+ }
+
+ treemap.sort = d3.rebind(treemap, hierarchy.sort);
+ treemap.children = d3.rebind(treemap, hierarchy.children);
+ treemap.value = d3.rebind(treemap, hierarchy.value);
+
+ treemap.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return treemap;
+ };
+
+ treemap.round = function(x) {
+ if (!arguments.length) return round != Number;
+ round = x ? Math.round : Number;
+ return treemap;
+ };
+
+ treemap.sticky = function(x) {
+ if (!arguments.length) return sticky;
+ sticky = x;
+ stickies = null;
+ return treemap;
+ };
+
+ return treemap;
+};
+})() \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.js
new file mode 100644
index 00000000..714656b3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.js
@@ -0,0 +1,7033 @@
+(function() {
+ function d3_class(ctor, properties) {
+ try {
+ for (var key in properties) {
+ Object.defineProperty(ctor.prototype, key, {
+ value: properties[key],
+ enumerable: false
+ });
+ }
+ } catch (e) {
+ ctor.prototype = properties;
+ }
+ }
+ function d3_arrayCopy(pseudoarray) {
+ var i = -1, n = pseudoarray.length, array = [];
+ while (++i < n) array.push(pseudoarray[i]);
+ return array;
+ }
+ function d3_arraySlice(pseudoarray) {
+ return Array.prototype.slice.call(pseudoarray);
+ }
+ function d3_Map() {}
+ function d3_identity(d) {
+ return d;
+ }
+ function d3_this() {
+ return this;
+ }
+ function d3_true() {
+ return true;
+ }
+ function d3_functor(v) {
+ return typeof v === "function" ? v : function() {
+ return v;
+ };
+ }
+ function d3_rebind(target, source, method) {
+ return function() {
+ var value = method.apply(source, arguments);
+ return arguments.length ? target : value;
+ };
+ }
+ function d3_number(x) {
+ return x != null && !isNaN(x);
+ }
+ function d3_zipLength(d) {
+ return d.length;
+ }
+ function d3_splitter(d) {
+ return d == null;
+ }
+ function d3_collapse(s) {
+ return s.trim().replace(/\s+/g, " ");
+ }
+ function d3_range_integerScale(x) {
+ var k = 1;
+ while (x * k % 1) k *= 10;
+ return k;
+ }
+ function d3_dispatch() {}
+ function d3_dispatch_event(dispatch) {
+ function event() {
+ var z = listeners, i = -1, n = z.length, l;
+ while (++i < n) if (l = z[i].on) l.apply(this, arguments);
+ return dispatch;
+ }
+ var listeners = [], listenerByName = new d3_Map;
+ event.on = function(name, listener) {
+ var l = listenerByName.get(name), i;
+ if (arguments.length < 2) return l && l.on;
+ if (l) {
+ l.on = null;
+ listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
+ listenerByName.remove(name);
+ }
+ if (listener) listeners.push(listenerByName.set(name, {
+ on: listener
+ }));
+ return dispatch;
+ };
+ return event;
+ }
+ function d3_format_precision(x, p) {
+ return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1);
+ }
+ function d3_format_typeDefault(x) {
+ return x + "";
+ }
+ function d3_format_group(value) {
+ var i = value.lastIndexOf("."), f = i >= 0 ? value.substring(i) : (i = value.length, ""), t = [];
+ while (i > 0) t.push(value.substring(i -= 3, i + 3));
+ return t.reverse().join(",") + f;
+ }
+ function d3_formatPrefix(d, i) {
+ var k = Math.pow(10, Math.abs(8 - i) * 3);
+ return {
+ scale: i > 8 ? function(d) {
+ return d / k;
+ } : function(d) {
+ return d * k;
+ },
+ symbol: d
+ };
+ }
+ function d3_ease_clamp(f) {
+ return function(t) {
+ return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
+ };
+ }
+ function d3_ease_reverse(f) {
+ return function(t) {
+ return 1 - f(1 - t);
+ };
+ }
+ function d3_ease_reflect(f) {
+ return function(t) {
+ return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));
+ };
+ }
+ function d3_ease_identity(t) {
+ return t;
+ }
+ function d3_ease_poly(e) {
+ return function(t) {
+ return Math.pow(t, e);
+ };
+ }
+ function d3_ease_sin(t) {
+ return 1 - Math.cos(t * Math.PI / 2);
+ }
+ function d3_ease_exp(t) {
+ return Math.pow(2, 10 * (t - 1));
+ }
+ function d3_ease_circle(t) {
+ return 1 - Math.sqrt(1 - t * t);
+ }
+ function d3_ease_elastic(a, p) {
+ var s;
+ if (arguments.length < 2) p = .45;
+ if (arguments.length < 1) {
+ a = 1;
+ s = p / 4;
+ } else s = p / (2 * Math.PI) * Math.asin(1 / a);
+ return function(t) {
+ return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p);
+ };
+ }
+ function d3_ease_back(s) {
+ if (!s) s = 1.70158;
+ return function(t) {
+ return t * t * ((s + 1) * t - s);
+ };
+ }
+ function d3_ease_bounce(t) {
+ return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
+ }
+ function d3_eventCancel() {
+ d3.event.stopPropagation();
+ d3.event.preventDefault();
+ }
+ function d3_eventSource() {
+ var e = d3.event, s;
+ while (s = e.sourceEvent) e = s;
+ return e;
+ }
+ function d3_eventDispatch(target) {
+ var dispatch = new d3_dispatch, i = 0, n = arguments.length;
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
+ dispatch.of = function(thiz, argumentz) {
+ return function(e1) {
+ try {
+ var e0 = e1.sourceEvent = d3.event;
+ e1.target = target;
+ d3.event = e1;
+ dispatch[e1.type].apply(thiz, argumentz);
+ } finally {
+ d3.event = e0;
+ }
+ };
+ };
+ return dispatch;
+ }
+ function d3_transform(m) {
+ var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
+ if (r0[0] * r1[1] < r1[0] * r0[1]) {
+ r0[0] *= -1;
+ r0[1] *= -1;
+ kx *= -1;
+ kz *= -1;
+ }
+ this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees;
+ this.translate = [ m.e, m.f ];
+ this.scale = [ kx, ky ];
+ this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0;
+ }
+ function d3_transformDot(a, b) {
+ return a[0] * b[0] + a[1] * b[1];
+ }
+ function d3_transformNormalize(a) {
+ var k = Math.sqrt(d3_transformDot(a, a));
+ if (k) {
+ a[0] /= k;
+ a[1] /= k;
+ }
+ return k;
+ }
+ function d3_transformCombine(a, b, k) {
+ a[0] += k * b[0];
+ a[1] += k * b[1];
+ return a;
+ }
+ function d3_interpolateByName(name) {
+ return name == "transform" ? d3.interpolateTransform : d3.interpolate;
+ }
+ function d3_uninterpolateNumber(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) {
+ return (x - a) * b;
+ };
+ }
+ function d3_uninterpolateClamp(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) {
+ return Math.max(0, Math.min(1, (x - a) * b));
+ };
+ }
+ function d3_rgb(r, g, b) {
+ return new d3_Rgb(r, g, b);
+ }
+ function d3_Rgb(r, g, b) {
+ this.r = r;
+ this.g = g;
+ this.b = b;
+ }
+ function d3_rgb_hex(v) {
+ return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
+ }
+ function d3_rgb_parse(format, rgb, hsl) {
+ var r = 0, g = 0, b = 0, m1, m2, name;
+ m1 = /([a-z]+)\((.*)\)/i.exec(format);
+ if (m1) {
+ m2 = m1[2].split(",");
+ switch (m1[1]) {
+ case "hsl":
+ {
+ return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);
+ }
+ case "rgb":
+ {
+ return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));
+ }
+ }
+ }
+ if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
+ if (format != null && format.charAt(0) === "#") {
+ if (format.length === 4) {
+ r = format.charAt(1);
+ r += r;
+ g = format.charAt(2);
+ g += g;
+ b = format.charAt(3);
+ b += b;
+ } else if (format.length === 7) {
+ r = format.substring(1, 3);
+ g = format.substring(3, 5);
+ b = format.substring(5, 7);
+ }
+ r = parseInt(r, 16);
+ g = parseInt(g, 16);
+ b = parseInt(b, 16);
+ }
+ return rgb(r, g, b);
+ }
+ function d3_rgb_hsl(r, g, b) {
+ var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2;
+ if (d) {
+ s = l < .5 ? d / (max + min) : d / (2 - max - min);
+ if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4;
+ h *= 60;
+ } else {
+ s = h = 0;
+ }
+ return d3_hsl(h, s, l);
+ }
+ function d3_rgb_lab(r, g, b) {
+ r = d3_rgb_xyz(r);
+ g = d3_rgb_xyz(g);
+ b = d3_rgb_xyz(b);
+ var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z);
+ return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
+ }
+ function d3_rgb_xyz(r) {
+ return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);
+ }
+ function d3_rgb_parseNumber(c) {
+ var f = parseFloat(c);
+ return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
+ }
+ function d3_hsl(h, s, l) {
+ return new d3_Hsl(h, s, l);
+ }
+ function d3_Hsl(h, s, l) {
+ this.h = h;
+ this.s = s;
+ this.l = l;
+ }
+ function d3_hsl_rgb(h, s, l) {
+ function v(h) {
+ if (h > 360) h -= 360; else if (h < 0) h += 360;
+ if (h < 60) return m1 + (m2 - m1) * h / 60;
+ if (h < 180) return m2;
+ if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
+ return m1;
+ }
+ function vv(h) {
+ return Math.round(v(h) * 255);
+ }
+ var m1, m2;
+ h = h % 360;
+ if (h < 0) h += 360;
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
+ l = l < 0 ? 0 : l > 1 ? 1 : l;
+ m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
+ m1 = 2 * l - m2;
+ return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
+ }
+ function d3_hcl(h, c, l) {
+ return new d3_Hcl(h, c, l);
+ }
+ function d3_Hcl(h, c, l) {
+ this.h = h;
+ this.c = c;
+ this.l = l;
+ }
+ function d3_hcl_lab(h, c, l) {
+ return d3_lab(l, Math.cos(h *= Math.PI / 180) * c, Math.sin(h) * c);
+ }
+ function d3_lab(l, a, b) {
+ return new d3_Lab(l, a, b);
+ }
+ function d3_Lab(l, a, b) {
+ this.l = l;
+ this.a = a;
+ this.b = b;
+ }
+ function d3_lab_rgb(l, a, b) {
+ var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
+ x = d3_lab_xyz(x) * d3_lab_X;
+ y = d3_lab_xyz(y) * d3_lab_Y;
+ z = d3_lab_xyz(z) * d3_lab_Z;
+ return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z));
+ }
+ function d3_lab_hcl(l, a, b) {
+ return d3_hcl(Math.atan2(b, a) / Math.PI * 180, Math.sqrt(a * a + b * b), l);
+ }
+ function d3_lab_xyz(x) {
+ return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
+ }
+ function d3_xyz_lab(x) {
+ return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
+ }
+ function d3_xyz_rgb(r) {
+ return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));
+ }
+ function d3_selection(groups) {
+ d3_arraySubclass(groups, d3_selectionPrototype);
+ return groups;
+ }
+ function d3_selection_selector(selector) {
+ return function() {
+ return d3_select(selector, this);
+ };
+ }
+ function d3_selection_selectorAll(selector) {
+ return function() {
+ return d3_selectAll(selector, this);
+ };
+ }
+ function d3_selection_attr(name, value) {
+ function attrNull() {
+ this.removeAttribute(name);
+ }
+ function attrNullNS() {
+ this.removeAttributeNS(name.space, name.local);
+ }
+ function attrConstant() {
+ this.setAttribute(name, value);
+ }
+ function attrConstantNS() {
+ this.setAttributeNS(name.space, name.local, value);
+ }
+ function attrFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);
+ }
+ function attrFunctionNS() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);
+ }
+ name = d3.ns.qualify(name);
+ return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;
+ }
+ function d3_selection_classedRe(name) {
+ return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");
+ }
+ function d3_selection_classed(name, value) {
+ function classedConstant() {
+ var i = -1;
+ while (++i < n) name[i](this, value);
+ }
+ function classedFunction() {
+ var i = -1, x = value.apply(this, arguments);
+ while (++i < n) name[i](this, x);
+ }
+ name = name.trim().split(/\s+/).map(d3_selection_classedName);
+ var n = name.length;
+ return typeof value === "function" ? classedFunction : classedConstant;
+ }
+ function d3_selection_classedName(name) {
+ var re = d3_selection_classedRe(name);
+ return function(node, value) {
+ if (c = node.classList) return value ? c.add(name) : c.remove(name);
+ var c = node.className, cb = c.baseVal != null, cv = cb ? c.baseVal : c;
+ if (value) {
+ re.lastIndex = 0;
+ if (!re.test(cv)) {
+ cv = d3_collapse(cv + " " + name);
+ if (cb) c.baseVal = cv; else node.className = cv;
+ }
+ } else if (cv) {
+ cv = d3_collapse(cv.replace(re, " "));
+ if (cb) c.baseVal = cv; else node.className = cv;
+ }
+ };
+ }
+ function d3_selection_style(name, value, priority) {
+ function styleNull() {
+ this.style.removeProperty(name);
+ }
+ function styleConstant() {
+ this.style.setProperty(name, value, priority);
+ }
+ function styleFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);
+ }
+ return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;
+ }
+ function d3_selection_property(name, value) {
+ function propertyNull() {
+ delete this[name];
+ }
+ function propertyConstant() {
+ this[name] = value;
+ }
+ function propertyFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) delete this[name]; else this[name] = x;
+ }
+ return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;
+ }
+ function d3_selection_dataNode(data) {
+ return {
+ __data__: data
+ };
+ }
+ function d3_selection_filter(selector) {
+ return function() {
+ return d3_selectMatches(this, selector);
+ };
+ }
+ function d3_selection_sortComparator(comparator) {
+ if (!arguments.length) comparator = d3.ascending;
+ return function(a, b) {
+ return comparator(a && a.__data__, b && b.__data__);
+ };
+ }
+ function d3_selection_on(type, listener, capture) {
+ function onRemove() {
+ var wrapper = this[name];
+ if (wrapper) {
+ this.removeEventListener(type, wrapper, wrapper.$);
+ delete this[name];
+ }
+ }
+ function onAdd() {
+ function wrapper(e) {
+ var o = d3.event;
+ d3.event = e;
+ args[0] = node.__data__;
+ try {
+ listener.apply(node, args);
+ } finally {
+ d3.event = o;
+ }
+ }
+ var node = this, args = arguments;
+ onRemove.call(this);
+ this.addEventListener(type, this[name] = wrapper, wrapper.$ = capture);
+ wrapper._ = listener;
+ }
+ var name = "__on" + type, i = type.indexOf(".");
+ if (i > 0) type = type.substring(0, i);
+ return listener ? onAdd : onRemove;
+ }
+ function d3_selection_each(groups, callback) {
+ for (var j = 0, m = groups.length; j < m; j++) {
+ for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {
+ if (node = group[i]) callback(node, i, j);
+ }
+ }
+ return groups;
+ }
+ function d3_selection_enter(selection) {
+ d3_arraySubclass(selection, d3_selection_enterPrototype);
+ return selection;
+ }
+ function d3_transition(groups, id, time) {
+ d3_arraySubclass(groups, d3_transitionPrototype);
+ var tweens = new d3_Map, event = d3.dispatch("start", "end"), ease = d3_transitionEase;
+ groups.id = id;
+ groups.time = time;
+ groups.tween = function(name, tween) {
+ if (arguments.length < 2) return tweens.get(name);
+ if (tween == null) tweens.remove(name); else tweens.set(name, tween);
+ return groups;
+ };
+ groups.ease = function(value) {
+ if (!arguments.length) return ease;
+ ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments);
+ return groups;
+ };
+ groups.each = function(type, listener) {
+ if (arguments.length < 2) return d3_transition_each.call(groups, type);
+ event.on(type, listener);
+ return groups;
+ };
+ d3.timer(function(elapsed) {
+ return d3_selection_each(groups, function(node, i, j) {
+ function start(elapsed) {
+ if (lock.active > id) return stop();
+ lock.active = id;
+ tweens.forEach(function(key, value) {
+ if (value = value.call(node, d, i)) {
+ tweened.push(value);
+ }
+ });
+ event.start.call(node, d, i);
+ if (!tick(elapsed)) d3.timer(tick, 0, time);
+ return 1;
+ }
+ function tick(elapsed) {
+ if (lock.active !== id) return stop();
+ var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length;
+ while (n > 0) {
+ tweened[--n].call(node, e);
+ }
+ if (t >= 1) {
+ stop();
+ d3_transitionId = id;
+ event.end.call(node, d, i);
+ d3_transitionId = 0;
+ return 1;
+ }
+ }
+ function stop() {
+ if (!--lock.count) delete node.__transition__;
+ return 1;
+ }
+ var tweened = [], delay = node.delay, duration = node.duration, lock = (node = node.node).__transition__ || (node.__transition__ = {
+ active: 0,
+ count: 0
+ }), d = node.__data__;
+ ++lock.count;
+ delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time);
+ });
+ }, 0, time);
+ return groups;
+ }
+ function d3_transition_each(callback) {
+ var id = d3_transitionId, ease = d3_transitionEase, delay = d3_transitionDelay, duration = d3_transitionDuration;
+ d3_transitionId = this.id;
+ d3_transitionEase = this.ease();
+ d3_selection_each(this, function(node, i, j) {
+ d3_transitionDelay = node.delay;
+ d3_transitionDuration = node.duration;
+ callback.call(node = node.node, node.__data__, i, j);
+ });
+ d3_transitionId = id;
+ d3_transitionEase = ease;
+ d3_transitionDelay = delay;
+ d3_transitionDuration = duration;
+ return this;
+ }
+ function d3_tweenNull(d, i, a) {
+ return a != "" && d3_tweenRemove;
+ }
+ function d3_tweenByName(b, name) {
+ return d3.tween(b, d3_interpolateByName(name));
+ }
+ function d3_timer_step() {
+ var elapsed, now = Date.now(), t1 = d3_timer_queue;
+ while (t1) {
+ elapsed = now - t1.then;
+ if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+ var delay = d3_timer_flush() - now;
+ if (delay > 24) {
+ if (isFinite(delay)) {
+ clearTimeout(d3_timer_timeout);
+ d3_timer_timeout = setTimeout(d3_timer_step, delay);
+ }
+ d3_timer_interval = 0;
+ } else {
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+ }
+ function d3_timer_flush() {
+ var t0 = null, t1 = d3_timer_queue, then = Infinity;
+ while (t1) {
+ if (t1.flush) {
+ t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
+ } else {
+ then = Math.min(then, t1.then + t1.delay);
+ t1 = (t0 = t1).next;
+ }
+ }
+ return then;
+ }
+ function d3_mousePoint(container, e) {
+ var svg = container.ownerSVGElement || container;
+ if (svg.createSVGPoint) {
+ var point = svg.createSVGPoint();
+ if (d3_mouse_bug44083 < 0 && (window.scrollX || window.scrollY)) {
+ svg = d3.select(document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0);
+ var ctm = svg[0][0].getScreenCTM();
+ d3_mouse_bug44083 = !(ctm.f || ctm.e);
+ svg.remove();
+ }
+ if (d3_mouse_bug44083) {
+ point.x = e.pageX;
+ point.y = e.pageY;
+ } else {
+ point.x = e.clientX;
+ point.y = e.clientY;
+ }
+ point = point.matrixTransform(container.getScreenCTM().inverse());
+ return [ point.x, point.y ];
+ }
+ var rect = container.getBoundingClientRect();
+ return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
+ }
+ function d3_noop() {}
+ function d3_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [ start, stop ] : [ stop, start ];
+ }
+ function d3_scaleRange(scale) {
+ return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
+ }
+ function d3_scale_nice(domain, nice) {
+ var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;
+ if (x1 < x0) {
+ dx = i0, i0 = i1, i1 = dx;
+ dx = x0, x0 = x1, x1 = dx;
+ }
+ if (nice = nice(x1 - x0)) {
+ domain[i0] = nice.floor(x0);
+ domain[i1] = nice.ceil(x1);
+ }
+ return domain;
+ }
+ function d3_scale_niceDefault() {
+ return Math;
+ }
+ function d3_scale_linear(domain, range, interpolate, clamp) {
+ function rescale() {
+ var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
+ output = linear(domain, range, uninterpolate, interpolate);
+ input = linear(range, domain, uninterpolate, d3.interpolate);
+ return scale;
+ }
+ function scale(x) {
+ return output(x);
+ }
+ var output, input;
+ scale.invert = function(y) {
+ return input(y);
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.map(Number);
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.rangeRound = function(x) {
+ return scale.range(x).interpolate(d3.interpolateRound);
+ };
+ scale.clamp = function(x) {
+ if (!arguments.length) return clamp;
+ clamp = x;
+ return rescale();
+ };
+ scale.interpolate = function(x) {
+ if (!arguments.length) return interpolate;
+ interpolate = x;
+ return rescale();
+ };
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(domain, m);
+ };
+ scale.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(domain, m);
+ };
+ scale.nice = function() {
+ d3_scale_nice(domain, d3_scale_linearNice);
+ return rescale();
+ };
+ scale.copy = function() {
+ return d3_scale_linear(domain, range, interpolate, clamp);
+ };
+ return rescale();
+ }
+ function d3_scale_linearRebind(scale, linear) {
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+ }
+ function d3_scale_linearNice(dx) {
+ dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
+ return dx && {
+ floor: function(x) {
+ return Math.floor(x / dx) * dx;
+ },
+ ceil: function(x) {
+ return Math.ceil(x / dx) * dx;
+ }
+ };
+ }
+ function d3_scale_linearTickRange(domain, m) {
+ var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step;
+ if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
+ extent[0] = Math.ceil(extent[0] / step) * step;
+ extent[1] = Math.floor(extent[1] / step) * step + step * .5;
+ extent[2] = step;
+ return extent;
+ }
+ function d3_scale_linearTicks(domain, m) {
+ return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
+ }
+ function d3_scale_linearTickFormat(domain, m) {
+ return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");
+ }
+ function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
+ var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);
+ return function(x) {
+ return i(u(x));
+ };
+ }
+ function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
+ var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;
+ if (domain[k] < domain[0]) {
+ domain = domain.slice().reverse();
+ range = range.slice().reverse();
+ }
+ while (++j <= k) {
+ u.push(uninterpolate(domain[j - 1], domain[j]));
+ i.push(interpolate(range[j - 1], range[j]));
+ }
+ return function(x) {
+ var j = d3.bisect(domain, x, 1, k) - 1;
+ return i[j](u[j](x));
+ };
+ }
+ function d3_scale_log(linear, log) {
+ function scale(x) {
+ return linear(log(x));
+ }
+ var pow = log.pow;
+ scale.invert = function(x) {
+ return pow(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(pow);
+ log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;
+ pow = log.pow;
+ linear.domain(x.map(log));
+ return scale;
+ };
+ scale.nice = function() {
+ linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));
+ return scale;
+ };
+ scale.ticks = function() {
+ var extent = d3_scaleExtent(linear.domain()), ticks = [];
+ if (extent.every(isFinite)) {
+ var i = Math.floor(extent[0]), j = Math.ceil(extent[1]), u = pow(extent[0]), v = pow(extent[1]);
+ if (log === d3_scale_logn) {
+ ticks.push(pow(i));
+ for (; i++ < j; ) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
+ } else {
+ for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
+ ticks.push(pow(i));
+ }
+ for (i = 0; ticks[i] < u; i++) {}
+ for (j = ticks.length; ticks[j - 1] > v; j--) {}
+ ticks = ticks.slice(i, j);
+ }
+ return ticks;
+ };
+ scale.tickFormat = function(n, format) {
+ if (arguments.length < 2) format = d3_scale_logFormat;
+ if (arguments.length < 1) return format;
+ var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), e;
+ return function(d) {
+ return d / pow(f(log(d) + e)) <= k ? format(d) : "";
+ };
+ };
+ scale.copy = function() {
+ return d3_scale_log(linear.copy(), log);
+ };
+ return d3_scale_linearRebind(scale, linear);
+ }
+ function d3_scale_logp(x) {
+ return Math.log(x < 0 ? 0 : x) / Math.LN10;
+ }
+ function d3_scale_logn(x) {
+ return -Math.log(x > 0 ? 0 : -x) / Math.LN10;
+ }
+ function d3_scale_pow(linear, exponent) {
+ function scale(x) {
+ return linear(powp(x));
+ }
+ var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);
+ scale.invert = function(x) {
+ return powb(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(powb);
+ linear.domain(x.map(powp));
+ return scale;
+ };
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(scale.domain(), m);
+ };
+ scale.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(scale.domain(), m);
+ };
+ scale.nice = function() {
+ return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
+ };
+ scale.exponent = function(x) {
+ if (!arguments.length) return exponent;
+ var domain = scale.domain();
+ powp = d3_scale_powPow(exponent = x);
+ powb = d3_scale_powPow(1 / exponent);
+ return scale.domain(domain);
+ };
+ scale.copy = function() {
+ return d3_scale_pow(linear.copy(), exponent);
+ };
+ return d3_scale_linearRebind(scale, linear);
+ }
+ function d3_scale_powPow(e) {
+ return function(x) {
+ return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
+ };
+ }
+ function d3_scale_ordinal(domain, ranger) {
+ function scale(x) {
+ return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length];
+ }
+ function steps(start, step) {
+ return d3.range(domain.length).map(function(i) {
+ return start + step * i;
+ });
+ }
+ var index, range, rangeBand;
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = [];
+ index = new d3_Map;
+ var i = -1, n = x.length, xi;
+ while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
+ return scale[ranger.t].apply(scale, ranger.a);
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ rangeBand = 0;
+ ranger = {
+ t: "range",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangePoints = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding);
+ range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
+ rangeBand = 0;
+ ranger = {
+ t: "rangePoints",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeBands = function(x, padding, outerPadding) {
+ if (arguments.length < 2) padding = 0;
+ if (arguments.length < 3) outerPadding = padding;
+ var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);
+ range = steps(start + step * outerPadding, step);
+ if (reverse) range.reverse();
+ rangeBand = step * (1 - padding);
+ ranger = {
+ t: "rangeBands",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeRoundBands = function(x, padding, outerPadding) {
+ if (arguments.length < 2) padding = 0;
+ if (arguments.length < 3) outerPadding = padding;
+ var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step;
+ range = steps(start + Math.round(error / 2), step);
+ if (reverse) range.reverse();
+ rangeBand = Math.round(step * (1 - padding));
+ ranger = {
+ t: "rangeRoundBands",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeBand = function() {
+ return rangeBand;
+ };
+ scale.rangeExtent = function() {
+ return d3_scaleExtent(ranger.a[0]);
+ };
+ scale.copy = function() {
+ return d3_scale_ordinal(domain, ranger);
+ };
+ return scale.domain(domain);
+ }
+ function d3_scale_quantile(domain, range) {
+ function rescale() {
+ var k = 0, n = domain.length, q = range.length;
+ thresholds = [];
+ while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
+ return scale;
+ }
+ function scale(x) {
+ if (isNaN(x = +x)) return NaN;
+ return range[d3.bisect(thresholds, x)];
+ }
+ var thresholds;
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.filter(function(d) {
+ return !isNaN(d);
+ }).sort(d3.ascending);
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.quantiles = function() {
+ return thresholds;
+ };
+ scale.copy = function() {
+ return d3_scale_quantile(domain, range);
+ };
+ return rescale();
+ }
+ function d3_scale_quantize(x0, x1, range) {
+ function scale(x) {
+ return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
+ }
+ function rescale() {
+ kx = range.length / (x1 - x0);
+ i = range.length - 1;
+ return scale;
+ }
+ var kx, i;
+ scale.domain = function(x) {
+ if (!arguments.length) return [ x0, x1 ];
+ x0 = +x[0];
+ x1 = +x[x.length - 1];
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.copy = function() {
+ return d3_scale_quantize(x0, x1, range);
+ };
+ return rescale();
+ }
+ function d3_scale_threshold(domain, range) {
+ function scale(x) {
+ return range[d3.bisect(domain, x)];
+ }
+ scale.domain = function(_) {
+ if (!arguments.length) return domain;
+ domain = _;
+ return scale;
+ };
+ scale.range = function(_) {
+ if (!arguments.length) return range;
+ range = _;
+ return scale;
+ };
+ scale.copy = function() {
+ return d3_scale_threshold(domain, range);
+ };
+ return scale;
+ }
+ function d3_scale_identity(domain) {
+ function identity(x) {
+ return +x;
+ }
+ identity.invert = identity;
+ identity.domain = identity.range = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.map(identity);
+ return identity;
+ };
+ identity.ticks = function(m) {
+ return d3_scale_linearTicks(domain, m);
+ };
+ identity.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(domain, m);
+ };
+ identity.copy = function() {
+ return d3_scale_identity(domain);
+ };
+ return identity;
+ }
+ function d3_svg_arcInnerRadius(d) {
+ return d.innerRadius;
+ }
+ function d3_svg_arcOuterRadius(d) {
+ return d.outerRadius;
+ }
+ function d3_svg_arcStartAngle(d) {
+ return d.startAngle;
+ }
+ function d3_svg_arcEndAngle(d) {
+ return d.endAngle;
+ }
+ function d3_svg_line(projection) {
+ function line(data) {
+ function segment() {
+ segments.push("M", interpolate(projection(points), tension));
+ }
+ var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
+ while (++i < n) {
+ if (defined.call(this, d = data[i], i)) {
+ points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
+ } else if (points.length) {
+ segment();
+ points = [];
+ }
+ }
+ if (points.length) segment();
+ return segments.length ? segments.join("") : null;
+ }
+ var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
+ line.x = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return line;
+ };
+ line.y = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return line;
+ };
+ line.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return line;
+ };
+ line.interpolate = function(_) {
+ if (!arguments.length) return interpolateKey;
+ if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
+ return line;
+ };
+ line.tension = function(_) {
+ if (!arguments.length) return tension;
+ tension = _;
+ return line;
+ };
+ return line;
+ }
+ function d3_svg_lineX(d) {
+ return d[0];
+ }
+ function d3_svg_lineY(d) {
+ return d[1];
+ }
+ function d3_svg_lineLinear(points) {
+ return points.join("L");
+ }
+ function d3_svg_lineLinearClosed(points) {
+ return d3_svg_lineLinear(points) + "Z";
+ }
+ function d3_svg_lineStepBefore(points) {
+ var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
+ while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
+ return path.join("");
+ }
+ function d3_svg_lineStepAfter(points) {
+ var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
+ while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
+ return path.join("");
+ }
+ function d3_svg_lineCardinalOpen(points, tension) {
+ return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));
+ }
+ function d3_svg_lineCardinalClosed(points, tension) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
+ }
+ function d3_svg_lineCardinal(points, tension, closed) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
+ }
+ function d3_svg_lineHermite(points, tangents) {
+ if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
+ return d3_svg_lineLinear(points);
+ }
+ var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
+ if (quad) {
+ path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
+ p0 = points[1];
+ pi = 2;
+ }
+ if (tangents.length > 1) {
+ t = tangents[1];
+ p = points[pi];
+ pi++;
+ path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
+ for (var i = 2; i < tangents.length; i++, pi++) {
+ p = points[pi];
+ t = tangents[i];
+ path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
+ }
+ }
+ if (quad) {
+ var lp = points[pi];
+ path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
+ }
+ return path;
+ }
+ function d3_svg_lineCardinalTangents(points, tension) {
+ var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
+ while (++i < n) {
+ p0 = p1;
+ p1 = p2;
+ p2 = points[i];
+ tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
+ }
+ return tangents;
+ }
+ function d3_svg_lineBasis(points) {
+ if (points.length < 3) return d3_svg_lineLinear(points);
+ var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ];
+ d3_svg_lineBasisBezier(path, px, py);
+ while (++i < n) {
+ pi = points[i];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ i = -1;
+ while (++i < 2) {
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBasisOpen(points) {
+ if (points.length < 4) return d3_svg_lineLinear(points);
+ var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
+ while (++i < 3) {
+ pi = points[i];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
+ --i;
+ while (++i < n) {
+ pi = points[i];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBasisClosed(points) {
+ var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
+ while (++i < 4) {
+ pi = points[i % n];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
+ --i;
+ while (++i < m) {
+ pi = points[i % n];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBundle(points, tension) {
+ var n = points.length - 1;
+ if (n) {
+ var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
+ while (++i <= n) {
+ p = points[i];
+ t = i / n;
+ p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
+ p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
+ }
+ }
+ return d3_svg_lineBasis(points);
+ }
+ function d3_svg_lineDot4(a, b) {
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
+ }
+ function d3_svg_lineBasisBezier(path, x, y) {
+ path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
+ }
+ function d3_svg_lineSlope(p0, p1) {
+ return (p1[1] - p0[1]) / (p1[0] - p0[0]);
+ }
+ function d3_svg_lineFiniteDifferences(points) {
+ var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
+ while (++i < j) {
+ m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
+ }
+ m[i] = d;
+ return m;
+ }
+ function d3_svg_lineMonotoneTangents(points) {
+ var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
+ while (++i < j) {
+ d = d3_svg_lineSlope(points[i], points[i + 1]);
+ if (Math.abs(d) < 1e-6) {
+ m[i] = m[i + 1] = 0;
+ } else {
+ a = m[i] / d;
+ b = m[i + 1] / d;
+ s = a * a + b * b;
+ if (s > 9) {
+ s = d * 3 / Math.sqrt(s);
+ m[i] = s * a;
+ m[i + 1] = s * b;
+ }
+ }
+ }
+ i = -1;
+ while (++i <= j) {
+ s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
+ tangents.push([ s || 0, m[i] * s || 0 ]);
+ }
+ return tangents;
+ }
+ function d3_svg_lineMonotone(points) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
+ }
+ function d3_svg_lineRadial(points) {
+ var point, i = -1, n = points.length, r, a;
+ while (++i < n) {
+ point = points[i];
+ r = point[0];
+ a = point[1] + d3_svg_arcOffset;
+ point[0] = r * Math.cos(a);
+ point[1] = r * Math.sin(a);
+ }
+ return points;
+ }
+ function d3_svg_area(projection) {
+ function area(data) {
+ function segment() {
+ segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
+ }
+ var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
+ return x;
+ } : d3_functor(x1), fy1 = y0 === y1 ? function() {
+ return y;
+ } : d3_functor(y1), x, y;
+ while (++i < n) {
+ if (defined.call(this, d = data[i], i)) {
+ points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
+ points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
+ } else if (points0.length) {
+ segment();
+ points0 = [];
+ points1 = [];
+ }
+ }
+ if (points0.length) segment();
+ return segments.length ? segments.join("") : null;
+ }
+ var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
+ area.x = function(_) {
+ if (!arguments.length) return x1;
+ x0 = x1 = _;
+ return area;
+ };
+ area.x0 = function(_) {
+ if (!arguments.length) return x0;
+ x0 = _;
+ return area;
+ };
+ area.x1 = function(_) {
+ if (!arguments.length) return x1;
+ x1 = _;
+ return area;
+ };
+ area.y = function(_) {
+ if (!arguments.length) return y1;
+ y0 = y1 = _;
+ return area;
+ };
+ area.y0 = function(_) {
+ if (!arguments.length) return y0;
+ y0 = _;
+ return area;
+ };
+ area.y1 = function(_) {
+ if (!arguments.length) return y1;
+ y1 = _;
+ return area;
+ };
+ area.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return area;
+ };
+ area.interpolate = function(_) {
+ if (!arguments.length) return interpolateKey;
+ if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
+ interpolateReverse = interpolate.reverse || interpolate;
+ L = interpolate.closed ? "M" : "L";
+ return area;
+ };
+ area.tension = function(_) {
+ if (!arguments.length) return tension;
+ tension = _;
+ return area;
+ };
+ return area;
+ }
+ function d3_svg_chordSource(d) {
+ return d.source;
+ }
+ function d3_svg_chordTarget(d) {
+ return d.target;
+ }
+ function d3_svg_chordRadius(d) {
+ return d.radius;
+ }
+ function d3_svg_chordStartAngle(d) {
+ return d.startAngle;
+ }
+ function d3_svg_chordEndAngle(d) {
+ return d.endAngle;
+ }
+ function d3_svg_diagonalProjection(d) {
+ return [ d.x, d.y ];
+ }
+ function d3_svg_diagonalRadialProjection(projection) {
+ return function() {
+ var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset;
+ return [ r * Math.cos(a), r * Math.sin(a) ];
+ };
+ }
+ function d3_svg_symbolSize() {
+ return 64;
+ }
+ function d3_svg_symbolType() {
+ return "circle";
+ }
+ function d3_svg_symbolCircle(size) {
+ var r = Math.sqrt(size / Math.PI);
+ return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
+ }
+ function d3_svg_axisX(selection, x) {
+ selection.attr("transform", function(d) {
+ return "translate(" + x(d) + ",0)";
+ });
+ }
+ function d3_svg_axisY(selection, y) {
+ selection.attr("transform", function(d) {
+ return "translate(0," + y(d) + ")";
+ });
+ }
+ function d3_svg_axisSubdivide(scale, ticks, m) {
+ subticks = [];
+ if (m && ticks.length > 1) {
+ var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v;
+ while (++i < n) {
+ for (j = m; --j > 0; ) {
+ if ((v = +ticks[i] - j * d) >= extent[0]) {
+ subticks.push(v);
+ }
+ }
+ }
+ for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) {
+ subticks.push(v);
+ }
+ }
+ return subticks;
+ }
+ function d3_behavior_zoomDelta() {
+ if (!d3_behavior_zoomDiv) {
+ d3_behavior_zoomDiv = d3.select("body").append("div").style("visibility", "hidden").style("top", 0).style("height", 0).style("width", 0).style("overflow-y", "scroll").append("div").style("height", "2000px").node().parentNode;
+ }
+ var e = d3.event, delta;
+ try {
+ d3_behavior_zoomDiv.scrollTop = 1e3;
+ d3_behavior_zoomDiv.dispatchEvent(e);
+ delta = 1e3 - d3_behavior_zoomDiv.scrollTop;
+ } catch (error) {
+ delta = e.wheelDelta || -e.detail * 5;
+ }
+ return delta;
+ }
+ function d3_layout_bundlePath(link) {
+ var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];
+ while (start !== lca) {
+ start = start.parent;
+ points.push(start);
+ }
+ var k = points.length;
+ while (end !== lca) {
+ points.splice(k, 0, end);
+ end = end.parent;
+ }
+ return points;
+ }
+ function d3_layout_bundleAncestors(node) {
+ var ancestors = [], parent = node.parent;
+ while (parent != null) {
+ ancestors.push(node);
+ node = parent;
+ parent = parent.parent;
+ }
+ ancestors.push(node);
+ return ancestors;
+ }
+ function d3_layout_bundleLeastCommonAncestor(a, b) {
+ if (a === b) return a;
+ var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;
+ while (aNode === bNode) {
+ sharedNode = aNode;
+ aNode = aNodes.pop();
+ bNode = bNodes.pop();
+ }
+ return sharedNode;
+ }
+ function d3_layout_forceDragstart(d) {
+ d.fixed |= 2;
+ }
+ function d3_layout_forceDragend(d) {
+ d.fixed &= 1;
+ }
+ function d3_layout_forceMouseover(d) {
+ d.fixed |= 4;
+ }
+ function d3_layout_forceMouseout(d) {
+ d.fixed &= 3;
+ }
+ function d3_layout_forceAccumulate(quad, alpha, charges) {
+ var cx = 0, cy = 0;
+ quad.charge = 0;
+ if (!quad.leaf) {
+ var nodes = quad.nodes, n = nodes.length, i = -1, c;
+ while (++i < n) {
+ c = nodes[i];
+ if (c == null) continue;
+ d3_layout_forceAccumulate(c, alpha, charges);
+ quad.charge += c.charge;
+ cx += c.charge * c.cx;
+ cy += c.charge * c.cy;
+ }
+ }
+ if (quad.point) {
+ if (!quad.leaf) {
+ quad.point.x += Math.random() - .5;
+ quad.point.y += Math.random() - .5;
+ }
+ var k = alpha * charges[quad.point.index];
+ quad.charge += quad.pointCharge = k;
+ cx += k * quad.point.x;
+ cy += k * quad.point.y;
+ }
+ quad.cx = cx / quad.charge;
+ quad.cy = cy / quad.charge;
+ }
+ function d3_layout_forceLinkDistance(link) {
+ return 20;
+ }
+ function d3_layout_forceLinkStrength(link) {
+ return 1;
+ }
+ function d3_layout_stackX(d) {
+ return d.x;
+ }
+ function d3_layout_stackY(d) {
+ return d.y;
+ }
+ function d3_layout_stackOut(d, y0, y) {
+ d.y0 = y0;
+ d.y = y;
+ }
+ function d3_layout_stackOrderDefault(data) {
+ return d3.range(data.length);
+ }
+ function d3_layout_stackOffsetZero(data) {
+ var j = -1, m = data[0].length, y0 = [];
+ while (++j < m) y0[j] = 0;
+ return y0;
+ }
+ function d3_layout_stackMaxIndex(array) {
+ var i = 1, j = 0, v = array[0][1], k, n = array.length;
+ for (; i < n; ++i) {
+ if ((k = array[i][1]) > v) {
+ j = i;
+ v = k;
+ }
+ }
+ return j;
+ }
+ function d3_layout_stackReduceSum(d) {
+ return d.reduce(d3_layout_stackSum, 0);
+ }
+ function d3_layout_stackSum(p, d) {
+ return p + d[1];
+ }
+ function d3_layout_histogramBinSturges(range, values) {
+ return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
+ }
+ function d3_layout_histogramBinFixed(range, n) {
+ var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];
+ while (++x <= n) f[x] = m * x + b;
+ return f;
+ }
+ function d3_layout_histogramRange(values) {
+ return [ d3.min(values), d3.max(values) ];
+ }
+ function d3_layout_hierarchyRebind(object, hierarchy) {
+ d3.rebind(object, hierarchy, "sort", "children", "value");
+ object.links = d3_layout_hierarchyLinks;
+ object.nodes = function(d) {
+ d3_layout_hierarchyInline = true;
+ return (object.nodes = object)(d);
+ };
+ return object;
+ }
+ function d3_layout_hierarchyChildren(d) {
+ return d.children;
+ }
+ function d3_layout_hierarchyValue(d) {
+ return d.value;
+ }
+ function d3_layout_hierarchySort(a, b) {
+ return b.value - a.value;
+ }
+ function d3_layout_hierarchyLinks(nodes) {
+ return d3.merge(nodes.map(function(parent) {
+ return (parent.children || []).map(function(child) {
+ return {
+ source: parent,
+ target: child
+ };
+ });
+ }));
+ }
+ function d3_layout_packSort(a, b) {
+ return a.value - b.value;
+ }
+ function d3_layout_packInsert(a, b) {
+ var c = a._pack_next;
+ a._pack_next = b;
+ b._pack_prev = a;
+ b._pack_next = c;
+ c._pack_prev = b;
+ }
+ function d3_layout_packSplice(a, b) {
+ a._pack_next = b;
+ b._pack_prev = a;
+ }
+ function d3_layout_packIntersects(a, b) {
+ var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;
+ return dr * dr - dx * dx - dy * dy > .001;
+ }
+ function d3_layout_packSiblings(node) {
+ function bound(node) {
+ xMin = Math.min(node.x - node.r, xMin);
+ xMax = Math.max(node.x + node.r, xMax);
+ yMin = Math.min(node.y - node.r, yMin);
+ yMax = Math.max(node.y + node.r, yMax);
+ }
+ if (!(nodes = node.children) || !(n = nodes.length)) return;
+ var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;
+ nodes.forEach(d3_layout_packLink);
+ a = nodes[0];
+ a.x = -a.r;
+ a.y = 0;
+ bound(a);
+ if (n > 1) {
+ b = nodes[1];
+ b.x = b.r;
+ b.y = 0;
+ bound(b);
+ if (n > 2) {
+ c = nodes[2];
+ d3_layout_packPlace(a, b, c);
+ bound(c);
+ d3_layout_packInsert(a, c);
+ a._pack_prev = c;
+ d3_layout_packInsert(c, b);
+ b = a._pack_next;
+ for (i = 3; i < n; i++) {
+ d3_layout_packPlace(a, b, c = nodes[i]);
+ var isect = 0, s1 = 1, s2 = 1;
+ for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
+ if (d3_layout_packIntersects(j, c)) {
+ isect = 1;
+ break;
+ }
+ }
+ if (isect == 1) {
+ for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
+ if (d3_layout_packIntersects(k, c)) {
+ break;
+ }
+ }
+ }
+ if (isect) {
+ if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);
+ i--;
+ } else {
+ d3_layout_packInsert(a, c);
+ b = c;
+ bound(c);
+ }
+ }
+ }
+ }
+ var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;
+ for (i = 0; i < n; i++) {
+ c = nodes[i];
+ c.x -= cx;
+ c.y -= cy;
+ cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));
+ }
+ node.r = cr;
+ nodes.forEach(d3_layout_packUnlink);
+ }
+ function d3_layout_packLink(node) {
+ node._pack_next = node._pack_prev = node;
+ }
+ function d3_layout_packUnlink(node) {
+ delete node._pack_next;
+ delete node._pack_prev;
+ }
+ function d3_layout_packTransform(node, x, y, k) {
+ var children = node.children;
+ node.x = x += k * node.x;
+ node.y = y += k * node.y;
+ node.r *= k;
+ if (children) {
+ var i = -1, n = children.length;
+ while (++i < n) d3_layout_packTransform(children[i], x, y, k);
+ }
+ }
+ function d3_layout_packPlace(a, b, c) {
+ var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;
+ if (db && (dx || dy)) {
+ var da = b.r + c.r, dc = dx * dx + dy * dy;
+ da *= da;
+ db *= db;
+ var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
+ c.x = a.x + x * dx + y * dy;
+ c.y = a.y + x * dy - y * dx;
+ } else {
+ c.x = a.x + db;
+ c.y = a.y;
+ }
+ }
+ function d3_layout_clusterY(children) {
+ return 1 + d3.max(children, function(child) {
+ return child.y;
+ });
+ }
+ function d3_layout_clusterX(children) {
+ return children.reduce(function(x, child) {
+ return x + child.x;
+ }, 0) / children.length;
+ }
+ function d3_layout_clusterLeft(node) {
+ var children = node.children;
+ return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
+ }
+ function d3_layout_clusterRight(node) {
+ var children = node.children, n;
+ return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
+ }
+ function d3_layout_treeSeparation(a, b) {
+ return a.parent == b.parent ? 1 : 2;
+ }
+ function d3_layout_treeLeft(node) {
+ var children = node.children;
+ return children && children.length ? children[0] : node._tree.thread;
+ }
+ function d3_layout_treeRight(node) {
+ var children = node.children, n;
+ return children && (n = children.length) ? children[n - 1] : node._tree.thread;
+ }
+ function d3_layout_treeSearch(node, compare) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child, n, i = -1;
+ while (++i < n) {
+ if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
+ node = child;
+ }
+ }
+ }
+ return node;
+ }
+ function d3_layout_treeRightmost(a, b) {
+ return a.x - b.x;
+ }
+ function d3_layout_treeLeftmost(a, b) {
+ return b.x - a.x;
+ }
+ function d3_layout_treeDeepest(a, b) {
+ return a.depth - b.depth;
+ }
+ function d3_layout_treeVisitAfter(node, callback) {
+ function visit(node, previousSibling) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child, previousChild = null, i = -1, n;
+ while (++i < n) {
+ child = children[i];
+ visit(child, previousChild);
+ previousChild = child;
+ }
+ }
+ callback(node, previousSibling);
+ }
+ visit(node, null);
+ }
+ function d3_layout_treeShift(node) {
+ var shift = 0, change = 0, children = node.children, i = children.length, child;
+ while (--i >= 0) {
+ child = children[i]._tree;
+ child.prelim += shift;
+ child.mod += shift;
+ shift += child.shift + (change += child.change);
+ }
+ }
+ function d3_layout_treeMove(ancestor, node, shift) {
+ ancestor = ancestor._tree;
+ node = node._tree;
+ var change = shift / (node.number - ancestor.number);
+ ancestor.change += change;
+ node.change -= change;
+ node.shift += shift;
+ node.prelim += shift;
+ node.mod += shift;
+ }
+ function d3_layout_treeAncestor(vim, node, ancestor) {
+ return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor;
+ }
+ function d3_layout_treemapPadNull(node) {
+ return {
+ x: node.x,
+ y: node.y,
+ dx: node.dx,
+ dy: node.dy
+ };
+ }
+ function d3_layout_treemapPad(node, padding) {
+ var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2];
+ if (dx < 0) {
+ x += dx / 2;
+ dx = 0;
+ }
+ if (dy < 0) {
+ y += dy / 2;
+ dy = 0;
+ }
+ return {
+ x: x,
+ y: y,
+ dx: dx,
+ dy: dy
+ };
+ }
+ function d3_dsv(delimiter, mimeType) {
+ function dsv(url, callback) {
+ d3.text(url, mimeType, function(text) {
+ callback(text && dsv.parse(text));
+ });
+ }
+ function formatRow(row) {
+ return row.map(formatValue).join(delimiter);
+ }
+ function formatValue(text) {
+ return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text;
+ }
+ var reParse = new RegExp("\r\n|[" + delimiter + "\r\n]", "g"), reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
+ dsv.parse = function(text) {
+ var header;
+ return dsv.parseRows(text, function(row, i) {
+ if (i) {
+ var o = {}, j = -1, m = header.length;
+ while (++j < m) o[header[j]] = row[j];
+ return o;
+ } else {
+ header = row;
+ return null;
+ }
+ });
+ };
+ dsv.parseRows = function(text, f) {
+ function token() {
+ if (reParse.lastIndex >= text.length) return EOF;
+ if (eol) {
+ eol = false;
+ return EOL;
+ }
+ var j = reParse.lastIndex;
+ if (text.charCodeAt(j) === 34) {
+ var i = j;
+ while (i++ < text.length) {
+ if (text.charCodeAt(i) === 34) {
+ if (text.charCodeAt(i + 1) !== 34) break;
+ i++;
+ }
+ }
+ reParse.lastIndex = i + 2;
+ var c = text.charCodeAt(i + 1);
+ if (c === 13) {
+ eol = true;
+ if (text.charCodeAt(i + 2) === 10) reParse.lastIndex++;
+ } else if (c === 10) {
+ eol = true;
+ }
+ return text.substring(j + 1, i).replace(/""/g, '"');
+ }
+ var m = reParse.exec(text);
+ if (m) {
+ eol = m[0].charCodeAt(0) !== delimiterCode;
+ return text.substring(j, m.index);
+ }
+ reParse.lastIndex = text.length;
+ return text.substring(j);
+ }
+ var EOL = {}, EOF = {}, rows = [], n = 0, t, eol;
+ reParse.lastIndex = 0;
+ while ((t = token()) !== EOF) {
+ var a = [];
+ while (t !== EOL && t !== EOF) {
+ a.push(t);
+ t = token();
+ }
+ if (f && !(a = f(a, n++))) continue;
+ rows.push(a);
+ }
+ return rows;
+ };
+ dsv.format = function(rows) {
+ return rows.map(formatRow).join("\n");
+ };
+ return dsv;
+ }
+ function d3_geo_type(types, defaultValue) {
+ return function(object) {
+ return object && types.hasOwnProperty(object.type) ? types[object.type](object) : defaultValue;
+ };
+ }
+ function d3_path_circle(radius) {
+ return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z";
+ }
+ function d3_geo_bounds(o, f) {
+ if (d3_geo_boundsTypes.hasOwnProperty(o.type)) d3_geo_boundsTypes[o.type](o, f);
+ }
+ function d3_geo_boundsFeature(o, f) {
+ d3_geo_bounds(o.geometry, f);
+ }
+ function d3_geo_boundsFeatureCollection(o, f) {
+ for (var a = o.features, i = 0, n = a.length; i < n; i++) {
+ d3_geo_bounds(a[i].geometry, f);
+ }
+ }
+ function d3_geo_boundsGeometryCollection(o, f) {
+ for (var a = o.geometries, i = 0, n = a.length; i < n; i++) {
+ d3_geo_bounds(a[i], f);
+ }
+ }
+ function d3_geo_boundsLineString(o, f) {
+ for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
+ f.apply(null, a[i]);
+ }
+ }
+ function d3_geo_boundsMultiLineString(o, f) {
+ for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
+ for (var b = a[i], j = 0, m = b.length; j < m; j++) {
+ f.apply(null, b[j]);
+ }
+ }
+ }
+ function d3_geo_boundsMultiPolygon(o, f) {
+ for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
+ for (var b = a[i][0], j = 0, m = b.length; j < m; j++) {
+ f.apply(null, b[j]);
+ }
+ }
+ }
+ function d3_geo_boundsPoint(o, f) {
+ f.apply(null, o.coordinates);
+ }
+ function d3_geo_boundsPolygon(o, f) {
+ for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) {
+ f.apply(null, a[i]);
+ }
+ }
+ function d3_geo_greatArcSource(d) {
+ return d.source;
+ }
+ function d3_geo_greatArcTarget(d) {
+ return d.target;
+ }
+ function d3_geo_greatArcInterpolator() {
+ function interpolate(t) {
+ var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;
+ return [ Math.atan2(y, x) / d3_geo_radians, Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians ];
+ }
+ var x0, y0, cy0, sy0, kx0, ky0, x1, y1, cy1, sy1, kx1, ky1, d, k;
+ interpolate.distance = function() {
+ if (d == null) k = 1 / Math.sin(d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))));
+ return d;
+ };
+ interpolate.source = function(_) {
+ var cx0 = Math.cos(x0 = _[0] * d3_geo_radians), sx0 = Math.sin(x0);
+ cy0 = Math.cos(y0 = _[1] * d3_geo_radians);
+ sy0 = Math.sin(y0);
+ kx0 = cy0 * cx0;
+ ky0 = cy0 * sx0;
+ d = null;
+ return interpolate;
+ };
+ interpolate.target = function(_) {
+ var cx1 = Math.cos(x1 = _[0] * d3_geo_radians), sx1 = Math.sin(x1);
+ cy1 = Math.cos(y1 = _[1] * d3_geo_radians);
+ sy1 = Math.sin(y1);
+ kx1 = cy1 * cx1;
+ ky1 = cy1 * sx1;
+ d = null;
+ return interpolate;
+ };
+ return interpolate;
+ }
+ function d3_geo_greatArcInterpolate(a, b) {
+ var i = d3_geo_greatArcInterpolator().source(a).target(b);
+ i.distance();
+ return i;
+ }
+ function d3_geom_contourStart(grid) {
+ var x = 0, y = 0;
+ while (true) {
+ if (grid(x, y)) {
+ return [ x, y ];
+ }
+ if (x === 0) {
+ x = y + 1;
+ y = 0;
+ } else {
+ x = x - 1;
+ y = y + 1;
+ }
+ }
+ }
+ function d3_geom_hullCCW(i1, i2, i3, v) {
+ var t, a, b, c, d, e, f;
+ t = v[i1];
+ a = t[0];
+ b = t[1];
+ t = v[i2];
+ c = t[0];
+ d = t[1];
+ t = v[i3];
+ e = t[0];
+ f = t[1];
+ return (f - b) * (c - a) - (d - b) * (e - a) > 0;
+ }
+ function d3_geom_polygonInside(p, a, b) {
+ return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
+ }
+ function d3_geom_polygonIntersect(c, d, a, b) {
+ var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], x13 = x1 - x3, x21 = x2 - x1, x43 = x4 - x3, y13 = y1 - y3, y21 = y2 - y1, y43 = y4 - y3, ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21);
+ return [ x1 + ua * x21, y1 + ua * y21 ];
+ }
+ function d3_voronoi_tessellate(vertices, callback) {
+ var Sites = {
+ list: vertices.map(function(v, i) {
+ return {
+ index: i,
+ x: v[0],
+ y: v[1]
+ };
+ }).sort(function(a, b) {
+ return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0;
+ }),
+ bottomSite: null
+ };
+ var EdgeList = {
+ list: [],
+ leftEnd: null,
+ rightEnd: null,
+ init: function() {
+ EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.leftEnd.r = EdgeList.rightEnd;
+ EdgeList.rightEnd.l = EdgeList.leftEnd;
+ EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
+ },
+ createHalfEdge: function(edge, side) {
+ return {
+ edge: edge,
+ side: side,
+ vertex: null,
+ l: null,
+ r: null
+ };
+ },
+ insert: function(lb, he) {
+ he.l = lb;
+ he.r = lb.r;
+ lb.r.l = he;
+ lb.r = he;
+ },
+ leftBound: function(p) {
+ var he = EdgeList.leftEnd;
+ do {
+ he = he.r;
+ } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
+ he = he.l;
+ return he;
+ },
+ del: function(he) {
+ he.l.r = he.r;
+ he.r.l = he.l;
+ he.edge = null;
+ },
+ right: function(he) {
+ return he.r;
+ },
+ left: function(he) {
+ return he.l;
+ },
+ leftRegion: function(he) {
+ return he.edge == null ? Sites.bottomSite : he.edge.region[he.side];
+ },
+ rightRegion: function(he) {
+ return he.edge == null ? Sites.bottomSite : he.edge.region[d3_voronoi_opposite[he.side]];
+ }
+ };
+ var Geom = {
+ bisect: function(s1, s2) {
+ var newEdge = {
+ region: {
+ l: s1,
+ r: s2
+ },
+ ep: {
+ l: null,
+ r: null
+ }
+ };
+ var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy;
+ newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5;
+ if (adx > ady) {
+ newEdge.a = 1;
+ newEdge.b = dy / dx;
+ newEdge.c /= dx;
+ } else {
+ newEdge.b = 1;
+ newEdge.a = dx / dy;
+ newEdge.c /= dy;
+ }
+ return newEdge;
+ },
+ intersect: function(el1, el2) {
+ var e1 = el1.edge, e2 = el2.edge;
+ if (!e1 || !e2 || e1.region.r == e2.region.r) {
+ return null;
+ }
+ var d = e1.a * e2.b - e1.b * e2.a;
+ if (Math.abs(d) < 1e-10) {
+ return null;
+ }
+ var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e;
+ if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) {
+ el = el1;
+ e = e1;
+ } else {
+ el = el2;
+ e = e2;
+ }
+ var rightOfSite = xint >= e.region.r.x;
+ if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") {
+ return null;
+ }
+ return {
+ x: xint,
+ y: yint
+ };
+ },
+ rightOf: function(he, p) {
+ var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x;
+ if (rightOfSite && he.side === "l") {
+ return 1;
+ }
+ if (!rightOfSite && he.side === "r") {
+ return 0;
+ }
+ if (e.a === 1) {
+ var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0;
+ if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) {
+ above = fast = dyp >= e.b * dxp;
+ } else {
+ above = p.x + p.y * e.b > e.c;
+ if (e.b < 0) {
+ above = !above;
+ }
+ if (!above) {
+ fast = 1;
+ }
+ }
+ if (!fast) {
+ var dxs = topsite.x - e.region.l.x;
+ above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b);
+ if (e.b < 0) {
+ above = !above;
+ }
+ }
+ } else {
+ var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y;
+ above = t1 * t1 > t2 * t2 + t3 * t3;
+ }
+ return he.side === "l" ? above : !above;
+ },
+ endPoint: function(edge, side, site) {
+ edge.ep[side] = site;
+ if (!edge.ep[d3_voronoi_opposite[side]]) return;
+ callback(edge);
+ },
+ distance: function(s, t) {
+ var dx = s.x - t.x, dy = s.y - t.y;
+ return Math.sqrt(dx * dx + dy * dy);
+ }
+ };
+ var EventQueue = {
+ list: [],
+ insert: function(he, site, offset) {
+ he.vertex = site;
+ he.ystar = site.y + offset;
+ for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) {
+ var next = list[i];
+ if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ list.splice(i, 0, he);
+ },
+ del: function(he) {
+ for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {}
+ ls.splice(i, 1);
+ },
+ empty: function() {
+ return EventQueue.list.length === 0;
+ },
+ nextEvent: function(he) {
+ for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) {
+ if (ls[i] == he) return ls[i + 1];
+ }
+ return null;
+ },
+ min: function() {
+ var elem = EventQueue.list[0];
+ return {
+ x: elem.vertex.x,
+ y: elem.ystar
+ };
+ },
+ extractMin: function() {
+ return EventQueue.list.shift();
+ }
+ };
+ EdgeList.init();
+ Sites.bottomSite = Sites.list.shift();
+ var newSite = Sites.list.shift(), newIntStar;
+ var lbnd, rbnd, llbnd, rrbnd, bisector;
+ var bot, top, temp, p, v;
+ var e, pm;
+ while (true) {
+ if (!EventQueue.empty()) {
+ newIntStar = EventQueue.min();
+ }
+ if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) {
+ lbnd = EdgeList.leftBound(newSite);
+ rbnd = EdgeList.right(lbnd);
+ bot = EdgeList.rightRegion(lbnd);
+ e = Geom.bisect(bot, newSite);
+ bisector = EdgeList.createHalfEdge(e, "l");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(lbnd, bisector);
+ if (p) {
+ EventQueue.del(lbnd);
+ EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
+ }
+ lbnd = bisector;
+ bisector = EdgeList.createHalfEdge(e, "r");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(bisector, rbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, newSite));
+ }
+ newSite = Sites.list.shift();
+ } else if (!EventQueue.empty()) {
+ lbnd = EventQueue.extractMin();
+ llbnd = EdgeList.left(lbnd);
+ rbnd = EdgeList.right(lbnd);
+ rrbnd = EdgeList.right(rbnd);
+ bot = EdgeList.leftRegion(lbnd);
+ top = EdgeList.rightRegion(rbnd);
+ v = lbnd.vertex;
+ Geom.endPoint(lbnd.edge, lbnd.side, v);
+ Geom.endPoint(rbnd.edge, rbnd.side, v);
+ EdgeList.del(lbnd);
+ EventQueue.del(rbnd);
+ EdgeList.del(rbnd);
+ pm = "l";
+ if (bot.y > top.y) {
+ temp = bot;
+ bot = top;
+ top = temp;
+ pm = "r";
+ }
+ e = Geom.bisect(bot, top);
+ bisector = EdgeList.createHalfEdge(e, pm);
+ EdgeList.insert(llbnd, bisector);
+ Geom.endPoint(e, d3_voronoi_opposite[pm], v);
+ p = Geom.intersect(llbnd, bisector);
+ if (p) {
+ EventQueue.del(llbnd);
+ EventQueue.insert(llbnd, p, Geom.distance(p, bot));
+ }
+ p = Geom.intersect(bisector, rrbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, bot));
+ }
+ } else {
+ break;
+ }
+ }
+ for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) {
+ callback(lbnd.edge);
+ }
+ }
+ function d3_geom_quadtreeNode() {
+ return {
+ leaf: true,
+ nodes: [],
+ point: null
+ };
+ }
+ function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
+ if (!f(node, x1, y1, x2, y2)) {
+ var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;
+ if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
+ if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
+ if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
+ if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
+ }
+ }
+ function d3_geom_quadtreePoint(p) {
+ return {
+ x: p[0],
+ y: p[1]
+ };
+ }
+ function d3_time_utc() {
+ this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);
+ }
+ function d3_time_formatAbbreviate(name) {
+ return name.substring(0, 3);
+ }
+ function d3_time_parse(date, template, string, j) {
+ var c, p, i = 0, n = template.length, m = string.length;
+ while (i < n) {
+ if (j >= m) return -1;
+ c = template.charCodeAt(i++);
+ if (c == 37) {
+ p = d3_time_parsers[template.charAt(i++)];
+ if (!p || (j = p(date, string, j)) < 0) return -1;
+ } else if (c != string.charCodeAt(j++)) {
+ return -1;
+ }
+ }
+ return j;
+ }
+ function d3_time_formatRe(names) {
+ return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i");
+ }
+ function d3_time_formatLookup(names) {
+ var map = new d3_Map, i = -1, n = names.length;
+ while (++i < n) map.set(names[i].toLowerCase(), i);
+ return map;
+ }
+ function d3_time_parseWeekdayAbbrev(date, string, i) {
+ d3_time_dayAbbrevRe.lastIndex = 0;
+ var n = d3_time_dayAbbrevRe.exec(string.substring(i));
+ return n ? i += n[0].length : -1;
+ }
+ function d3_time_parseWeekday(date, string, i) {
+ d3_time_dayRe.lastIndex = 0;
+ var n = d3_time_dayRe.exec(string.substring(i));
+ return n ? i += n[0].length : -1;
+ }
+ function d3_time_parseMonthAbbrev(date, string, i) {
+ d3_time_monthAbbrevRe.lastIndex = 0;
+ var n = d3_time_monthAbbrevRe.exec(string.substring(i));
+ return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
+ }
+ function d3_time_parseMonth(date, string, i) {
+ d3_time_monthRe.lastIndex = 0;
+ var n = d3_time_monthRe.exec(string.substring(i));
+ return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
+ }
+ function d3_time_parseLocaleFull(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
+ }
+ function d3_time_parseLocaleDate(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
+ }
+ function d3_time_parseLocaleTime(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
+ }
+ function d3_time_parseFullYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 4));
+ return n ? (date.y = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1;
+ }
+ function d3_time_expandYear(d) {
+ return d + (d > 68 ? 1900 : 2e3);
+ }
+ function d3_time_parseMonthNumber(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.m = n[0] - 1, i += n[0].length) : -1;
+ }
+ function d3_time_parseDay(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.d = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseHour24(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.H = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseMinutes(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.M = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseSeconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.S = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseMilliseconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 3));
+ return n ? (date.L = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseAmPm(date, string, i) {
+ var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
+ return n == null ? -1 : (date.p = n, i);
+ }
+ function d3_time_zone(d) {
+ var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60;
+ return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm);
+ }
+ function d3_time_formatIsoNative(date) {
+ return date.toISOString();
+ }
+ function d3_time_interval(local, step, number) {
+ function round(date) {
+ var d0 = local(date), d1 = offset(d0, 1);
+ return date - d0 < d1 - date ? d0 : d1;
+ }
+ function ceil(date) {
+ step(date = local(new d3_time(date - 1)), 1);
+ return date;
+ }
+ function offset(date, k) {
+ step(date = new d3_time(+date), k);
+ return date;
+ }
+ function range(t0, t1, dt) {
+ var time = ceil(t0), times = [];
+ if (dt > 1) {
+ while (time < t1) {
+ if (!(number(time) % dt)) times.push(new Date(+time));
+ step(time, 1);
+ }
+ } else {
+ while (time < t1) times.push(new Date(+time)), step(time, 1);
+ }
+ return times;
+ }
+ function range_utc(t0, t1, dt) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time_utc;
+ utc._ = t0;
+ return range(utc, t1, dt);
+ } finally {
+ d3_time = Date;
+ }
+ }
+ local.floor = local;
+ local.round = round;
+ local.ceil = ceil;
+ local.offset = offset;
+ local.range = range;
+ var utc = local.utc = d3_time_interval_utc(local);
+ utc.floor = utc;
+ utc.round = d3_time_interval_utc(round);
+ utc.ceil = d3_time_interval_utc(ceil);
+ utc.offset = d3_time_interval_utc(offset);
+ utc.range = range_utc;
+ return local;
+ }
+ function d3_time_interval_utc(method) {
+ return function(date, k) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time_utc;
+ utc._ = date;
+ return method(utc, k)._;
+ } finally {
+ d3_time = Date;
+ }
+ };
+ }
+ function d3_time_scale(linear, methods, format) {
+ function scale(x) {
+ return linear(x);
+ }
+ scale.invert = function(x) {
+ return d3_time_scaleDate(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
+ linear.domain(x);
+ return scale;
+ };
+ scale.nice = function(m) {
+ return scale.domain(d3_scale_nice(scale.domain(), function() {
+ return m;
+ }));
+ };
+ scale.ticks = function(m, k) {
+ var extent = d3_time_scaleExtent(scale.domain());
+ if (typeof m !== "function") {
+ var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target);
+ if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
+ if (!i) return linear.ticks(m).map(d3_time_scaleDate);
+ if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
+ m = methods[i];
+ k = m[1];
+ m = m[0].range;
+ }
+ return m(extent[0], new Date(+extent[1] + 1), k);
+ };
+ scale.tickFormat = function() {
+ return format;
+ };
+ scale.copy = function() {
+ return d3_time_scale(linear.copy(), methods, format);
+ };
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+ }
+ function d3_time_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [ start, stop ] : [ stop, start ];
+ }
+ function d3_time_scaleDate(t) {
+ return new Date(t);
+ }
+ function d3_time_scaleFormat(formats) {
+ return function(date) {
+ var i = formats.length - 1, f = formats[i];
+ while (!f[1](date)) f = formats[--i];
+ return f[0](date);
+ };
+ }
+ function d3_time_scaleSetYear(y) {
+ var d = new Date(y, 0, 1);
+ d.setFullYear(y);
+ return d;
+ }
+ function d3_time_scaleGetYear(d) {
+ var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1);
+ return y + (d - d0) / (d1 - d0);
+ }
+ function d3_time_scaleUTCSetYear(y) {
+ var d = new Date(Date.UTC(y, 0, 1));
+ d.setUTCFullYear(y);
+ return d;
+ }
+ function d3_time_scaleUTCGetYear(d) {
+ var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1);
+ return y + (d - d0) / (d1 - d0);
+ }
+ if (!Date.now) Date.now = function() {
+ return +(new Date);
+ };
+ try {
+ document.createElement("div").style.setProperty("opacity", 0, "");
+ } catch (error) {
+ var d3_style_prototype = CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
+ d3_style_prototype.setProperty = function(name, value, priority) {
+ d3_style_setProperty.call(this, name, value + "", priority);
+ };
+ }
+ d3 = {
+ version: "2.10.2"
+ };
+ var d3_array = d3_arraySlice;
+ try {
+ d3_array(document.documentElement.childNodes)[0].nodeType;
+ } catch (e) {
+ d3_array = d3_arrayCopy;
+ }
+ var d3_arraySubclass = [].__proto__ ? function(array, prototype) {
+ array.__proto__ = prototype;
+ } : function(array, prototype) {
+ for (var property in prototype) array[property] = prototype[property];
+ };
+ d3.map = function(object) {
+ var map = new d3_Map;
+ for (var key in object) map.set(key, object[key]);
+ return map;
+ };
+ d3_class(d3_Map, {
+ has: function(key) {
+ return d3_map_prefix + key in this;
+ },
+ get: function(key) {
+ return this[d3_map_prefix + key];
+ },
+ set: function(key, value) {
+ return this[d3_map_prefix + key] = value;
+ },
+ remove: function(key) {
+ key = d3_map_prefix + key;
+ return key in this && delete this[key];
+ },
+ keys: function() {
+ var keys = [];
+ this.forEach(function(key) {
+ keys.push(key);
+ });
+ return keys;
+ },
+ values: function() {
+ var values = [];
+ this.forEach(function(key, value) {
+ values.push(value);
+ });
+ return values;
+ },
+ entries: function() {
+ var entries = [];
+ this.forEach(function(key, value) {
+ entries.push({
+ key: key,
+ value: value
+ });
+ });
+ return entries;
+ },
+ forEach: function(f) {
+ for (var key in this) {
+ if (key.charCodeAt(0) === d3_map_prefixCode) {
+ f.call(this, key.substring(1), this[key]);
+ }
+ }
+ }
+ });
+ var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
+ d3.functor = d3_functor;
+ d3.rebind = function(target, source) {
+ var i = 1, n = arguments.length, method;
+ while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
+ return target;
+ };
+ d3.ascending = function(a, b) {
+ return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
+ };
+ d3.descending = function(a, b) {
+ return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
+ };
+ d3.mean = function(array, f) {
+ var n = array.length, a, m = 0, i = -1, j = 0;
+ if (arguments.length === 1) {
+ while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
+ } else {
+ while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
+ }
+ return j ? m : undefined;
+ };
+ d3.median = function(array, f) {
+ if (arguments.length > 1) array = array.map(f);
+ array = array.filter(d3_number);
+ return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
+ };
+ d3.min = function(array, f) {
+ var i = -1, n = array.length, a, b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && a > b) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
+ }
+ return a;
+ };
+ d3.max = function(array, f) {
+ var i = -1, n = array.length, a, b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && b > a) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
+ }
+ return a;
+ };
+ d3.extent = function(array, f) {
+ var i = -1, n = array.length, a, b, c;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
+ while (++i < n) if ((b = array[i]) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ } else {
+ while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ }
+ return [ a, c ];
+ };
+ d3.random = {
+ normal: function(µ, σ) {
+ var n = arguments.length;
+ if (n < 2) σ = 1;
+ if (n < 1) µ = 0;
+ return function() {
+ var x, y, r;
+ do {
+ x = Math.random() * 2 - 1;
+ y = Math.random() * 2 - 1;
+ r = x * x + y * y;
+ } while (!r || r > 1);
+ return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
+ };
+ },
+ logNormal: function(µ, σ) {
+ var n = arguments.length;
+ if (n < 2) σ = 1;
+ if (n < 1) µ = 0;
+ var random = d3.random.normal();
+ return function() {
+ return Math.exp(µ + σ * random());
+ };
+ },
+ irwinHall: function(m) {
+ return function() {
+ for (var s = 0, j = 0; j < m; j++) s += Math.random();
+ return s / m;
+ };
+ }
+ };
+ d3.sum = function(array, f) {
+ var s = 0, n = array.length, a, i = -1;
+ if (arguments.length === 1) {
+ while (++i < n) if (!isNaN(a = +array[i])) s += a;
+ } else {
+ while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
+ }
+ return s;
+ };
+ d3.quantile = function(values, p) {
+ var H = (values.length - 1) * p + 1, h = Math.floor(H), v = values[h - 1], e = H - h;
+ return e ? v + e * (values[h] - v) : v;
+ };
+ d3.transpose = function(matrix) {
+ return d3.zip.apply(d3, matrix);
+ };
+ d3.zip = function() {
+ if (!(n = arguments.length)) return [];
+ for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) {
+ for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) {
+ zip[j] = arguments[j][i];
+ }
+ }
+ return zips;
+ };
+ d3.bisector = function(f) {
+ return {
+ left: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >>> 1;
+ if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid;
+ }
+ return lo;
+ },
+ right: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >>> 1;
+ if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1;
+ }
+ return lo;
+ }
+ };
+ };
+ var d3_bisector = d3.bisector(function(d) {
+ return d;
+ });
+ d3.bisectLeft = d3_bisector.left;
+ d3.bisect = d3.bisectRight = d3_bisector.right;
+ d3.first = function(array, f) {
+ var i = 0, n = array.length, a = array[0], b;
+ if (arguments.length === 1) f = d3.ascending;
+ while (++i < n) {
+ if (f.call(array, a, b = array[i]) > 0) {
+ a = b;
+ }
+ }
+ return a;
+ };
+ d3.last = function(array, f) {
+ var i = 0, n = array.length, a = array[0], b;
+ if (arguments.length === 1) f = d3.ascending;
+ while (++i < n) {
+ if (f.call(array, a, b = array[i]) <= 0) {
+ a = b;
+ }
+ }
+ return a;
+ };
+ d3.nest = function() {
+ function map(array, depth) {
+ if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
+ var i = -1, n = array.length, key = keys[depth++], keyValue, object, valuesByKey = new d3_Map, values, o = {};
+ while (++i < n) {
+ if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
+ values.push(object);
+ } else {
+ valuesByKey.set(keyValue, [ object ]);
+ }
+ }
+ valuesByKey.forEach(function(keyValue, values) {
+ o[keyValue] = map(values, depth);
+ });
+ return o;
+ }
+ function entries(map, depth) {
+ if (depth >= keys.length) return map;
+ var a = [], sortKey = sortKeys[depth++], key;
+ for (key in map) {
+ a.push({
+ key: key,
+ values: entries(map[key], depth)
+ });
+ }
+ if (sortKey) a.sort(function(a, b) {
+ return sortKey(a.key, b.key);
+ });
+ return a;
+ }
+ var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
+ nest.map = function(array) {
+ return map(array, 0);
+ };
+ nest.entries = function(array) {
+ return entries(map(array, 0), 0);
+ };
+ nest.key = function(d) {
+ keys.push(d);
+ return nest;
+ };
+ nest.sortKeys = function(order) {
+ sortKeys[keys.length - 1] = order;
+ return nest;
+ };
+ nest.sortValues = function(order) {
+ sortValues = order;
+ return nest;
+ };
+ nest.rollup = function(f) {
+ rollup = f;
+ return nest;
+ };
+ return nest;
+ };
+ d3.keys = function(map) {
+ var keys = [];
+ for (var key in map) keys.push(key);
+ return keys;
+ };
+ d3.values = function(map) {
+ var values = [];
+ for (var key in map) values.push(map[key]);
+ return values;
+ };
+ d3.entries = function(map) {
+ var entries = [];
+ for (var key in map) entries.push({
+ key: key,
+ value: map[key]
+ });
+ return entries;
+ };
+ d3.permute = function(array, indexes) {
+ var permutes = [], i = -1, n = indexes.length;
+ while (++i < n) permutes[i] = array[indexes[i]];
+ return permutes;
+ };
+ d3.merge = function(arrays) {
+ return Array.prototype.concat.apply([], arrays);
+ };
+ d3.split = function(array, f) {
+ var arrays = [], values = [], value, i = -1, n = array.length;
+ if (arguments.length < 2) f = d3_splitter;
+ while (++i < n) {
+ if (f.call(values, value = array[i], i)) {
+ values = [];
+ } else {
+ if (!values.length) arrays.push(values);
+ values.push(value);
+ }
+ }
+ return arrays;
+ };
+ d3.range = function(start, stop, step) {
+ if (arguments.length < 3) {
+ step = 1;
+ if (arguments.length < 2) {
+ stop = start;
+ start = 0;
+ }
+ }
+ if ((stop - start) / step === Infinity) throw new Error("infinite range");
+ var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j;
+ start *= k, stop *= k, step *= k;
+ if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);
+ return range;
+ };
+ d3.requote = function(s) {
+ return s.replace(d3_requote_re, "\\$&");
+ };
+ var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
+ d3.round = function(x, n) {
+ return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);
+ };
+ d3.xhr = function(url, mime, callback) {
+ var req = new XMLHttpRequest;
+ if (arguments.length < 3) callback = mime, mime = null; else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
+ req.open("GET", url, true);
+ if (mime) req.setRequestHeader("Accept", mime);
+ req.onreadystatechange = function() {
+ if (req.readyState === 4) {
+ var s = req.status;
+ callback(!s && req.response || s >= 200 && s < 300 || s === 304 ? req : null);
+ }
+ };
+ req.send(null);
+ };
+ d3.text = function(url, mime, callback) {
+ function ready(req) {
+ callback(req && req.responseText);
+ }
+ if (arguments.length < 3) {
+ callback = mime;
+ mime = null;
+ }
+ d3.xhr(url, mime, ready);
+ };
+ d3.json = function(url, callback) {
+ d3.text(url, "application/json", function(text) {
+ callback(text ? JSON.parse(text) : null);
+ });
+ };
+ d3.html = function(url, callback) {
+ d3.text(url, "text/html", function(text) {
+ if (text != null) {
+ var range = document.createRange();
+ range.selectNode(document.body);
+ text = range.createContextualFragment(text);
+ }
+ callback(text);
+ });
+ };
+ d3.xml = function(url, mime, callback) {
+ function ready(req) {
+ callback(req && req.responseXML);
+ }
+ if (arguments.length < 3) {
+ callback = mime;
+ mime = null;
+ }
+ d3.xhr(url, mime, ready);
+ };
+ var d3_nsPrefix = {
+ svg: "http://www.w3.org/2000/svg",
+ xhtml: "http://www.w3.org/1999/xhtml",
+ xlink: "http://www.w3.org/1999/xlink",
+ xml: "http://www.w3.org/XML/1998/namespace",
+ xmlns: "http://www.w3.org/2000/xmlns/"
+ };
+ d3.ns = {
+ prefix: d3_nsPrefix,
+ qualify: function(name) {
+ var i = name.indexOf(":"), prefix = name;
+ if (i >= 0) {
+ prefix = name.substring(0, i);
+ name = name.substring(i + 1);
+ }
+ return d3_nsPrefix.hasOwnProperty(prefix) ? {
+ space: d3_nsPrefix[prefix],
+ local: name
+ } : name;
+ }
+ };
+ d3.dispatch = function() {
+ var dispatch = new d3_dispatch, i = -1, n = arguments.length;
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
+ return dispatch;
+ };
+ d3_dispatch.prototype.on = function(type, listener) {
+ var i = type.indexOf("."), name = "";
+ if (i > 0) {
+ name = type.substring(i + 1);
+ type = type.substring(0, i);
+ }
+ return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);
+ };
+ d3.format = function(specifier) {
+ var match = d3_format_re.exec(specifier), fill = match[1] || " ", sign = match[3] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false;
+ if (precision) precision = +precision.substring(1);
+ if (zfill) {
+ fill = "0";
+ if (comma) width -= Math.floor((width - 1) / 4);
+ }
+ switch (type) {
+ case "n":
+ comma = true;
+ type = "g";
+ break;
+ case "%":
+ scale = 100;
+ suffix = "%";
+ type = "f";
+ break;
+ case "p":
+ scale = 100;
+ suffix = "%";
+ type = "r";
+ break;
+ case "d":
+ integer = true;
+ precision = 0;
+ break;
+ case "s":
+ scale = -1;
+ type = "r";
+ break;
+ }
+ if (type == "r" && !precision) type = "g";
+ type = d3_format_types.get(type) || d3_format_typeDefault;
+ return function(value) {
+ if (integer && value % 1) return "";
+ var negative = value < 0 && (value = -value) ? "-" : sign;
+ if (scale < 0) {
+ var prefix = d3.formatPrefix(value, precision);
+ value = prefix.scale(value);
+ suffix = prefix.symbol;
+ } else {
+ value *= scale;
+ }
+ value = type(value, precision);
+ if (zfill) {
+ var length = value.length + negative.length;
+ if (length < width) value = (new Array(width - length + 1)).join(fill) + value;
+ if (comma) value = d3_format_group(value);
+ value = negative + value;
+ } else {
+ if (comma) value = d3_format_group(value);
+ value = negative + value;
+ var length = value.length;
+ if (length < width) value = (new Array(width - length + 1)).join(fill) + value;
+ }
+ return value + suffix;
+ };
+ };
+ var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
+ var d3_format_types = d3.map({
+ g: function(x, p) {
+ return x.toPrecision(p);
+ },
+ e: function(x, p) {
+ return x.toExponential(p);
+ },
+ f: function(x, p) {
+ return x.toFixed(p);
+ },
+ r: function(x, p) {
+ return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p)));
+ }
+ });
+ var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "μ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
+ d3.formatPrefix = function(value, precision) {
+ var i = 0;
+ if (value) {
+ if (value < 0) value *= -1;
+ if (precision) value = d3.round(value, d3_format_precision(value, precision));
+ i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
+ i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
+ }
+ return d3_formatPrefixes[8 + i / 3];
+ };
+ var d3_ease_quad = d3_ease_poly(2), d3_ease_cubic = d3_ease_poly(3), d3_ease_default = function() {
+ return d3_ease_identity;
+ };
+ var d3_ease = d3.map({
+ linear: d3_ease_default,
+ poly: d3_ease_poly,
+ quad: function() {
+ return d3_ease_quad;
+ },
+ cubic: function() {
+ return d3_ease_cubic;
+ },
+ sin: function() {
+ return d3_ease_sin;
+ },
+ exp: function() {
+ return d3_ease_exp;
+ },
+ circle: function() {
+ return d3_ease_circle;
+ },
+ elastic: d3_ease_elastic,
+ back: d3_ease_back,
+ bounce: function() {
+ return d3_ease_bounce;
+ }
+ });
+ var d3_ease_mode = d3.map({
+ "in": d3_ease_identity,
+ out: d3_ease_reverse,
+ "in-out": d3_ease_reflect,
+ "out-in": function(f) {
+ return d3_ease_reflect(d3_ease_reverse(f));
+ }
+ });
+ d3.ease = function(name) {
+ var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in";
+ t = d3_ease.get(t) || d3_ease_default;
+ m = d3_ease_mode.get(m) || d3_ease_identity;
+ return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1))));
+ };
+ d3.event = null;
+ d3.transform = function(string) {
+ var g = document.createElementNS(d3.ns.prefix.svg, "g");
+ return (d3.transform = function(string) {
+ g.setAttribute("transform", string);
+ var t = g.transform.baseVal.consolidate();
+ return new d3_transform(t ? t.matrix : d3_transformIdentity);
+ })(string);
+ };
+ d3_transform.prototype.toString = function() {
+ return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
+ };
+ var d3_transformDegrees = 180 / Math.PI, d3_transformIdentity = {
+ a: 1,
+ b: 0,
+ c: 0,
+ d: 1,
+ e: 0,
+ f: 0
+ };
+ d3.interpolate = function(a, b) {
+ var i = d3.interpolators.length, f;
+ while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;
+ return f;
+ };
+ d3.interpolateNumber = function(a, b) {
+ b -= a;
+ return function(t) {
+ return a + b * t;
+ };
+ };
+ d3.interpolateRound = function(a, b) {
+ b -= a;
+ return function(t) {
+ return Math.round(a + b * t);
+ };
+ };
+ d3.interpolateString = function(a, b) {
+ var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;
+ d3_interpolate_number.lastIndex = 0;
+ for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
+ if (m.index) s.push(b.substring(s0, s1 = m.index));
+ q.push({
+ i: s.length,
+ x: m[0]
+ });
+ s.push(null);
+ s0 = d3_interpolate_number.lastIndex;
+ }
+ if (s0 < b.length) s.push(b.substring(s0));
+ for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
+ o = q[i];
+ if (o.x == m[0]) {
+ if (o.i) {
+ if (s[o.i + 1] == null) {
+ s[o.i - 1] += o.x;
+ s.splice(o.i, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ } else {
+ s[o.i - 1] += o.x + s[o.i + 1];
+ s.splice(o.i, 2);
+ for (j = i + 1; j < n; ++j) q[j].i -= 2;
+ }
+ } else {
+ if (s[o.i + 1] == null) {
+ s[o.i] = o.x;
+ } else {
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ }
+ }
+ q.splice(i, 1);
+ n--;
+ i--;
+ } else {
+ o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
+ }
+ }
+ while (i < n) {
+ o = q.pop();
+ if (s[o.i + 1] == null) {
+ s[o.i] = o.x;
+ } else {
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ }
+ n--;
+ }
+ if (s.length === 1) {
+ return s[0] == null ? q[0].x : function() {
+ return b;
+ };
+ }
+ return function(t) {
+ for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+ };
+ d3.interpolateTransform = function(a, b) {
+ var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale;
+ if (ta[0] != tb[0] || ta[1] != tb[1]) {
+ s.push("translate(", null, ",", null, ")");
+ q.push({
+ i: 1,
+ x: d3.interpolateNumber(ta[0], tb[0])
+ }, {
+ i: 3,
+ x: d3.interpolateNumber(ta[1], tb[1])
+ });
+ } else if (tb[0] || tb[1]) {
+ s.push("translate(" + tb + ")");
+ } else {
+ s.push("");
+ }
+ if (ra != rb) {
+ if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
+ q.push({
+ i: s.push(s.pop() + "rotate(", null, ")") - 2,
+ x: d3.interpolateNumber(ra, rb)
+ });
+ } else if (rb) {
+ s.push(s.pop() + "rotate(" + rb + ")");
+ }
+ if (wa != wb) {
+ q.push({
+ i: s.push(s.pop() + "skewX(", null, ")") - 2,
+ x: d3.interpolateNumber(wa, wb)
+ });
+ } else if (wb) {
+ s.push(s.pop() + "skewX(" + wb + ")");
+ }
+ if (ka[0] != kb[0] || ka[1] != kb[1]) {
+ n = s.push(s.pop() + "scale(", null, ",", null, ")");
+ q.push({
+ i: n - 4,
+ x: d3.interpolateNumber(ka[0], kb[0])
+ }, {
+ i: n - 2,
+ x: d3.interpolateNumber(ka[1], kb[1])
+ });
+ } else if (kb[0] != 1 || kb[1] != 1) {
+ s.push(s.pop() + "scale(" + kb + ")");
+ }
+ n = q.length;
+ return function(t) {
+ var i = -1, o;
+ while (++i < n) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+ };
+ d3.interpolateRgb = function(a, b) {
+ a = d3.rgb(a);
+ b = d3.rgb(b);
+ var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
+ return function(t) {
+ return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));
+ };
+ };
+ d3.interpolateHsl = function(a, b) {
+ a = d3.hsl(a);
+ b = d3.hsl(b);
+ var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0;
+ if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360;
+ return function(t) {
+ return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + "";
+ };
+ };
+ d3.interpolateLab = function(a, b) {
+ a = d3.lab(a);
+ b = d3.lab(b);
+ var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
+ return function(t) {
+ return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
+ };
+ };
+ d3.interpolateHcl = function(a, b) {
+ a = d3.hcl(a);
+ b = d3.hcl(b);
+ var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;
+ if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
+ return function(t) {
+ return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
+ };
+ };
+ d3.interpolateArray = function(a, b) {
+ var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;
+ for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
+ for (; i < na; ++i) c[i] = a[i];
+ for (; i < nb; ++i) c[i] = b[i];
+ return function(t) {
+ for (i = 0; i < n0; ++i) c[i] = x[i](t);
+ return c;
+ };
+ };
+ d3.interpolateObject = function(a, b) {
+ var i = {}, c = {}, k;
+ for (k in a) {
+ if (k in b) {
+ i[k] = d3_interpolateByName(k)(a[k], b[k]);
+ } else {
+ c[k] = a[k];
+ }
+ }
+ for (k in b) {
+ if (!(k in a)) {
+ c[k] = b[k];
+ }
+ }
+ return function(t) {
+ for (k in i) c[k] = i[k](t);
+ return c;
+ };
+ };
+ var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
+ d3.interpolators = [ d3.interpolateObject, function(a, b) {
+ return b instanceof Array && d3.interpolateArray(a, b);
+ }, function(a, b) {
+ return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + "");
+ }, function(a, b) {
+ return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b);
+ }, function(a, b) {
+ return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b);
+ } ];
+ d3.rgb = function(r, g, b) {
+ return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b);
+ };
+ d3_Rgb.prototype.brighter = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ var r = this.r, g = this.g, b = this.b, i = 30;
+ if (!r && !g && !b) return d3_rgb(i, i, i);
+ if (r && r < i) r = i;
+ if (g && g < i) g = i;
+ if (b && b < i) b = i;
+ return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k)));
+ };
+ d3_Rgb.prototype.darker = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b));
+ };
+ d3_Rgb.prototype.hsl = function() {
+ return d3_rgb_hsl(this.r, this.g, this.b);
+ };
+ d3_Rgb.prototype.toString = function() {
+ return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
+ };
+ var d3_rgb_names = d3.map({
+ aliceblue: "#f0f8ff",
+ antiquewhite: "#faebd7",
+ aqua: "#00ffff",
+ aquamarine: "#7fffd4",
+ azure: "#f0ffff",
+ beige: "#f5f5dc",
+ bisque: "#ffe4c4",
+ black: "#000000",
+ blanchedalmond: "#ffebcd",
+ blue: "#0000ff",
+ blueviolet: "#8a2be2",
+ brown: "#a52a2a",
+ burlywood: "#deb887",
+ cadetblue: "#5f9ea0",
+ chartreuse: "#7fff00",
+ chocolate: "#d2691e",
+ coral: "#ff7f50",
+ cornflowerblue: "#6495ed",
+ cornsilk: "#fff8dc",
+ crimson: "#dc143c",
+ cyan: "#00ffff",
+ darkblue: "#00008b",
+ darkcyan: "#008b8b",
+ darkgoldenrod: "#b8860b",
+ darkgray: "#a9a9a9",
+ darkgreen: "#006400",
+ darkgrey: "#a9a9a9",
+ darkkhaki: "#bdb76b",
+ darkmagenta: "#8b008b",
+ darkolivegreen: "#556b2f",
+ darkorange: "#ff8c00",
+ darkorchid: "#9932cc",
+ darkred: "#8b0000",
+ darksalmon: "#e9967a",
+ darkseagreen: "#8fbc8f",
+ darkslateblue: "#483d8b",
+ darkslategray: "#2f4f4f",
+ darkslategrey: "#2f4f4f",
+ darkturquoise: "#00ced1",
+ darkviolet: "#9400d3",
+ deeppink: "#ff1493",
+ deepskyblue: "#00bfff",
+ dimgray: "#696969",
+ dimgrey: "#696969",
+ dodgerblue: "#1e90ff",
+ firebrick: "#b22222",
+ floralwhite: "#fffaf0",
+ forestgreen: "#228b22",
+ fuchsia: "#ff00ff",
+ gainsboro: "#dcdcdc",
+ ghostwhite: "#f8f8ff",
+ gold: "#ffd700",
+ goldenrod: "#daa520",
+ gray: "#808080",
+ green: "#008000",
+ greenyellow: "#adff2f",
+ grey: "#808080",
+ honeydew: "#f0fff0",
+ hotpink: "#ff69b4",
+ indianred: "#cd5c5c",
+ indigo: "#4b0082",
+ ivory: "#fffff0",
+ khaki: "#f0e68c",
+ lavender: "#e6e6fa",
+ lavenderblush: "#fff0f5",
+ lawngreen: "#7cfc00",
+ lemonchiffon: "#fffacd",
+ lightblue: "#add8e6",
+ lightcoral: "#f08080",
+ lightcyan: "#e0ffff",
+ lightgoldenrodyellow: "#fafad2",
+ lightgray: "#d3d3d3",
+ lightgreen: "#90ee90",
+ lightgrey: "#d3d3d3",
+ lightpink: "#ffb6c1",
+ lightsalmon: "#ffa07a",
+ lightseagreen: "#20b2aa",
+ lightskyblue: "#87cefa",
+ lightslategray: "#778899",
+ lightslategrey: "#778899",
+ lightsteelblue: "#b0c4de",
+ lightyellow: "#ffffe0",
+ lime: "#00ff00",
+ limegreen: "#32cd32",
+ linen: "#faf0e6",
+ magenta: "#ff00ff",
+ maroon: "#800000",
+ mediumaquamarine: "#66cdaa",
+ mediumblue: "#0000cd",
+ mediumorchid: "#ba55d3",
+ mediumpurple: "#9370db",
+ mediumseagreen: "#3cb371",
+ mediumslateblue: "#7b68ee",
+ mediumspringgreen: "#00fa9a",
+ mediumturquoise: "#48d1cc",
+ mediumvioletred: "#c71585",
+ midnightblue: "#191970",
+ mintcream: "#f5fffa",
+ mistyrose: "#ffe4e1",
+ moccasin: "#ffe4b5",
+ navajowhite: "#ffdead",
+ navy: "#000080",
+ oldlace: "#fdf5e6",
+ olive: "#808000",
+ olivedrab: "#6b8e23",
+ orange: "#ffa500",
+ orangered: "#ff4500",
+ orchid: "#da70d6",
+ palegoldenrod: "#eee8aa",
+ palegreen: "#98fb98",
+ paleturquoise: "#afeeee",
+ palevioletred: "#db7093",
+ papayawhip: "#ffefd5",
+ peachpuff: "#ffdab9",
+ peru: "#cd853f",
+ pink: "#ffc0cb",
+ plum: "#dda0dd",
+ powderblue: "#b0e0e6",
+ purple: "#800080",
+ red: "#ff0000",
+ rosybrown: "#bc8f8f",
+ royalblue: "#4169e1",
+ saddlebrown: "#8b4513",
+ salmon: "#fa8072",
+ sandybrown: "#f4a460",
+ seagreen: "#2e8b57",
+ seashell: "#fff5ee",
+ sienna: "#a0522d",
+ silver: "#c0c0c0",
+ skyblue: "#87ceeb",
+ slateblue: "#6a5acd",
+ slategray: "#708090",
+ slategrey: "#708090",
+ snow: "#fffafa",
+ springgreen: "#00ff7f",
+ steelblue: "#4682b4",
+ tan: "#d2b48c",
+ teal: "#008080",
+ thistle: "#d8bfd8",
+ tomato: "#ff6347",
+ turquoise: "#40e0d0",
+ violet: "#ee82ee",
+ wheat: "#f5deb3",
+ white: "#ffffff",
+ whitesmoke: "#f5f5f5",
+ yellow: "#ffff00",
+ yellowgreen: "#9acd32"
+ });
+ d3_rgb_names.forEach(function(key, value) {
+ d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
+ });
+ d3.hsl = function(h, s, l) {
+ return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l);
+ };
+ d3_Hsl.prototype.brighter = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, this.l / k);
+ };
+ d3_Hsl.prototype.darker = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, k * this.l);
+ };
+ d3_Hsl.prototype.rgb = function() {
+ return d3_hsl_rgb(this.h, this.s, this.l);
+ };
+ d3_Hsl.prototype.toString = function() {
+ return this.rgb().toString();
+ };
+ d3.hcl = function(h, c, l) {
+ return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l);
+ };
+ d3_Hcl.prototype.brighter = function(k) {
+ return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
+ };
+ d3_Hcl.prototype.darker = function(k) {
+ return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
+ };
+ d3_Hcl.prototype.rgb = function() {
+ return d3_hcl_lab(this.h, this.c, this.l).rgb();
+ };
+ d3_Hcl.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+ d3.lab = function(l, a, b) {
+ return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b);
+ };
+ var d3_lab_K = 18;
+ var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
+ d3_Lab.prototype.brighter = function(k) {
+ return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+ d3_Lab.prototype.darker = function(k) {
+ return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+ d3_Lab.prototype.rgb = function() {
+ return d3_lab_rgb(this.l, this.a, this.b);
+ };
+ d3_Lab.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+ var d3_select = function(s, n) {
+ return n.querySelector(s);
+ }, d3_selectAll = function(s, n) {
+ return n.querySelectorAll(s);
+ }, d3_selectRoot = document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) {
+ return d3_selectMatcher.call(n, s);
+ };
+ if (typeof Sizzle === "function") {
+ d3_select = function(s, n) {
+ return Sizzle(s, n)[0] || null;
+ };
+ d3_selectAll = function(s, n) {
+ return Sizzle.uniqueSort(Sizzle(s, n));
+ };
+ d3_selectMatches = Sizzle.matchesSelector;
+ }
+ var d3_selectionPrototype = [];
+ d3.selection = function() {
+ return d3_selectionRoot;
+ };
+ d3.selection.prototype = d3_selectionPrototype;
+ d3_selectionPrototype.select = function(selector) {
+ var subgroups = [], subgroup, subnode, group, node;
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroup.push(subnode = selector.call(node, node.__data__, i));
+ if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ d3_selectionPrototype.selectAll = function(selector) {
+ var subgroups = [], subgroup, node;
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
+ subgroup.parentNode = node;
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ d3_selectionPrototype.attr = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") {
+ var node = this.node();
+ name = d3.ns.qualify(name);
+ return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);
+ }
+ for (value in name) this.each(d3_selection_attr(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_attr(name, value));
+ };
+ d3_selectionPrototype.classed = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") {
+ var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1;
+ if (value = node.classList) {
+ while (++i < n) if (!value.contains(name[i])) return false;
+ } else {
+ value = node.className;
+ if (value.baseVal != null) value = value.baseVal;
+ while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;
+ }
+ return true;
+ }
+ for (value in name) this.each(d3_selection_classed(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_classed(name, value));
+ };
+ d3_selectionPrototype.style = function(name, value, priority) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof name !== "string") {
+ if (n < 2) value = "";
+ for (priority in name) this.each(d3_selection_style(priority, name[priority], value));
+ return this;
+ }
+ if (n < 2) return window.getComputedStyle(this.node(), null).getPropertyValue(name);
+ priority = "";
+ }
+ return this.each(d3_selection_style(name, value, priority));
+ };
+ d3_selectionPrototype.property = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") return this.node()[name];
+ for (value in name) this.each(d3_selection_property(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_property(name, value));
+ };
+ d3_selectionPrototype.text = function(value) {
+ return arguments.length < 1 ? this.node().textContent : this.each(typeof value === "function" ? function() {
+ var v = value.apply(this, arguments);
+ this.textContent = v == null ? "" : v;
+ } : value == null ? function() {
+ this.textContent = "";
+ } : function() {
+ this.textContent = value;
+ });
+ };
+ d3_selectionPrototype.html = function(value) {
+ return arguments.length < 1 ? this.node().innerHTML : this.each(typeof value === "function" ? function() {
+ var v = value.apply(this, arguments);
+ this.innerHTML = v == null ? "" : v;
+ } : value == null ? function() {
+ this.innerHTML = "";
+ } : function() {
+ this.innerHTML = value;
+ });
+ };
+ d3_selectionPrototype.append = function(name) {
+ function append() {
+ return this.appendChild(document.createElementNS(this.namespaceURI, name));
+ }
+ function appendNS() {
+ return this.appendChild(document.createElementNS(name.space, name.local));
+ }
+ name = d3.ns.qualify(name);
+ return this.select(name.local ? appendNS : append);
+ };
+ d3_selectionPrototype.insert = function(name, before) {
+ function insert() {
+ return this.insertBefore(document.createElementNS(this.namespaceURI, name), d3_select(before, this));
+ }
+ function insertNS() {
+ return this.insertBefore(document.createElementNS(name.space, name.local), d3_select(before, this));
+ }
+ name = d3.ns.qualify(name);
+ return this.select(name.local ? insertNS : insert);
+ };
+ d3_selectionPrototype.remove = function() {
+ return this.each(function() {
+ var parent = this.parentNode;
+ if (parent) parent.removeChild(this);
+ });
+ };
+ d3_selectionPrototype.data = function(value, key) {
+ function bind(group, groupData) {
+ var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), n1 = Math.max(n, m), updateNodes = [], enterNodes = [], exitNodes = [], node, nodeData;
+ if (key) {
+ var nodeByKeyValue = new d3_Map, keyValues = [], keyValue, j = groupData.length;
+ for (i = -1; ++i < n; ) {
+ keyValue = key.call(node = group[i], node.__data__, i);
+ if (nodeByKeyValue.has(keyValue)) {
+ exitNodes[j++] = node;
+ } else {
+ nodeByKeyValue.set(keyValue, node);
+ }
+ keyValues.push(keyValue);
+ }
+ for (i = -1; ++i < m; ) {
+ keyValue = key.call(groupData, nodeData = groupData[i], i);
+ if (nodeByKeyValue.has(keyValue)) {
+ updateNodes[i] = node = nodeByKeyValue.get(keyValue);
+ node.__data__ = nodeData;
+ enterNodes[i] = exitNodes[i] = null;
+ } else {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ nodeByKeyValue.remove(keyValue);
+ }
+ for (i = -1; ++i < n; ) {
+ if (nodeByKeyValue.has(keyValues[i])) {
+ exitNodes[i] = group[i];
+ }
+ }
+ } else {
+ for (i = -1; ++i < n0; ) {
+ node = group[i];
+ nodeData = groupData[i];
+ if (node) {
+ node.__data__ = nodeData;
+ updateNodes[i] = node;
+ enterNodes[i] = exitNodes[i] = null;
+ } else {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ }
+ for (; i < m; ++i) {
+ enterNodes[i] = d3_selection_dataNode(groupData[i]);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ for (; i < n1; ++i) {
+ exitNodes[i] = group[i];
+ enterNodes[i] = updateNodes[i] = null;
+ }
+ }
+ enterNodes.update = updateNodes;
+ enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;
+ enter.push(enterNodes);
+ update.push(updateNodes);
+ exit.push(exitNodes);
+ }
+ var i = -1, n = this.length, group, node;
+ if (!arguments.length) {
+ value = new Array(n = (group = this[0]).length);
+ while (++i < n) {
+ if (node = group[i]) {
+ value[i] = node.__data__;
+ }
+ }
+ return value;
+ }
+ var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);
+ if (typeof value === "function") {
+ while (++i < n) {
+ bind(group = this[i], value.call(group, group.parentNode.__data__, i));
+ }
+ } else {
+ while (++i < n) {
+ bind(group = this[i], value);
+ }
+ }
+ update.enter = function() {
+ return enter;
+ };
+ update.exit = function() {
+ return exit;
+ };
+ return update;
+ };
+ d3_selectionPrototype.datum = d3_selectionPrototype.map = function(value) {
+ return arguments.length < 1 ? this.property("__data__") : this.property("__data__", value);
+ };
+ d3_selectionPrototype.filter = function(filter) {
+ var subgroups = [], subgroup, group, node;
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = 0, n = group.length; i < n; i++) {
+ if ((node = group[i]) && filter.call(node, node.__data__, i)) {
+ subgroup.push(node);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ d3_selectionPrototype.order = function() {
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
+ if (node = group[i]) {
+ if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
+ next = node;
+ }
+ }
+ }
+ return this;
+ };
+ d3_selectionPrototype.sort = function(comparator) {
+ comparator = d3_selection_sortComparator.apply(this, arguments);
+ for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);
+ return this.order();
+ };
+ d3_selectionPrototype.on = function(type, listener, capture) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof type !== "string") {
+ if (n < 2) listener = false;
+ for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
+ return this;
+ }
+ if (n < 2) return (n = this.node()["__on" + type]) && n._;
+ capture = false;
+ }
+ return this.each(d3_selection_on(type, listener, capture));
+ };
+ d3_selectionPrototype.each = function(callback) {
+ return d3_selection_each(this, function(node, i, j) {
+ callback.call(node, node.__data__, i, j);
+ });
+ };
+ d3_selectionPrototype.call = function(callback) {
+ callback.apply(this, (arguments[0] = this, arguments));
+ return this;
+ };
+ d3_selectionPrototype.empty = function() {
+ return !this.node();
+ };
+ d3_selectionPrototype.node = function(callback) {
+ for (var j = 0, m = this.length; j < m; j++) {
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ var node = group[i];
+ if (node) return node;
+ }
+ }
+ return null;
+ };
+ d3_selectionPrototype.transition = function() {
+ var subgroups = [], subgroup, node;
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ subgroup.push((node = group[i]) ? {
+ node: node,
+ delay: d3_transitionDelay,
+ duration: d3_transitionDuration
+ } : null);
+ }
+ }
+ return d3_transition(subgroups, d3_transitionId || ++d3_transitionNextId, Date.now());
+ };
+ var d3_selectionRoot = d3_selection([ [ document ] ]);
+ d3_selectionRoot[0].parentNode = d3_selectRoot;
+ d3.select = function(selector) {
+ return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]);
+ };
+ d3.selectAll = function(selector) {
+ return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]);
+ };
+ var d3_selection_enterPrototype = [];
+ d3.selection.enter = d3_selection_enter;
+ d3.selection.enter.prototype = d3_selection_enterPrototype;
+ d3_selection_enterPrototype.append = d3_selectionPrototype.append;
+ d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
+ d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
+ d3_selection_enterPrototype.node = d3_selectionPrototype.node;
+ d3_selection_enterPrototype.select = function(selector) {
+ var subgroups = [], subgroup, subnode, upgroup, group, node;
+ for (var j = -1, m = this.length; ++j < m; ) {
+ upgroup = (group = this[j]).update;
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = group.parentNode;
+ for (var i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
+ subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ var d3_transitionPrototype = [], d3_transitionNextId = 0, d3_transitionId = 0, d3_transitionDefaultDelay = 0, d3_transitionDefaultDuration = 250, d3_transitionDefaultEase = d3.ease("cubic-in-out"), d3_transitionDelay = d3_transitionDefaultDelay, d3_transitionDuration = d3_transitionDefaultDuration, d3_transitionEase = d3_transitionDefaultEase;
+ d3_transitionPrototype.call = d3_selectionPrototype.call;
+ d3.transition = function(selection) {
+ return arguments.length ? d3_transitionId ? selection.transition() : selection : d3_selectionRoot.transition();
+ };
+ d3.transition.prototype = d3_transitionPrototype;
+ d3_transitionPrototype.select = function(selector) {
+ var subgroups = [], subgroup, subnode, node;
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) {
+ if ("__data__" in node.node) subnode.__data__ = node.node.__data__;
+ subgroup.push({
+ node: subnode,
+ delay: node.delay,
+ duration: node.duration
+ });
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+ };
+ d3_transitionPrototype.selectAll = function(selector) {
+ var subgroups = [], subgroup, subnodes, node;
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subnodes = selector.call(node.node, node.node.__data__, i);
+ subgroups.push(subgroup = []);
+ for (var k = -1, o = subnodes.length; ++k < o; ) {
+ subgroup.push({
+ node: subnodes[k],
+ delay: node.delay,
+ duration: node.duration
+ });
+ }
+ }
+ }
+ }
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+ };
+ d3_transitionPrototype.filter = function(filter) {
+ var subgroups = [], subgroup, group, node;
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ if ((node = group[i]) && filter.call(node.node, node.node.__data__, i)) {
+ subgroup.push(node);
+ }
+ }
+ }
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+ };
+ d3_transitionPrototype.attr = function(name, value) {
+ if (arguments.length < 2) {
+ for (value in name) this.attrTween(value, d3_tweenByName(name[value], value));
+ return this;
+ }
+ return this.attrTween(name, d3_tweenByName(value, name));
+ };
+ d3_transitionPrototype.attrTween = function(nameNS, tween) {
+ function attrTween(d, i) {
+ var f = tween.call(this, d, i, this.getAttribute(name));
+ return f === d3_tweenRemove ? (this.removeAttribute(name), null) : f && function(t) {
+ this.setAttribute(name, f(t));
+ };
+ }
+ function attrTweenNS(d, i) {
+ var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
+ return f === d3_tweenRemove ? (this.removeAttributeNS(name.space, name.local), null) : f && function(t) {
+ this.setAttributeNS(name.space, name.local, f(t));
+ };
+ }
+ var name = d3.ns.qualify(nameNS);
+ return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
+ };
+ d3_transitionPrototype.style = function(name, value, priority) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof name !== "string") {
+ if (n < 2) value = "";
+ for (priority in name) this.styleTween(priority, d3_tweenByName(name[priority], priority), value);
+ return this;
+ }
+ priority = "";
+ }
+ return this.styleTween(name, d3_tweenByName(value, name), priority);
+ };
+ d3_transitionPrototype.styleTween = function(name, tween, priority) {
+ if (arguments.length < 3) priority = "";
+ return this.tween("style." + name, function(d, i) {
+ var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name));
+ return f === d3_tweenRemove ? (this.style.removeProperty(name), null) : f && function(t) {
+ this.style.setProperty(name, f(t), priority);
+ };
+ });
+ };
+ d3_transitionPrototype.text = function(value) {
+ return this.tween("text", function(d, i) {
+ this.textContent = typeof value === "function" ? value.call(this, d, i) : value;
+ });
+ };
+ d3_transitionPrototype.remove = function() {
+ return this.each("end.transition", function() {
+ var p;
+ if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
+ });
+ };
+ d3_transitionPrototype.delay = function(value) {
+ return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
+ node.delay = value.call(node = node.node, node.__data__, i, j) | 0;
+ } : (value = value | 0, function(node) {
+ node.delay = value;
+ }));
+ };
+ d3_transitionPrototype.duration = function(value) {
+ return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
+ node.duration = Math.max(1, value.call(node = node.node, node.__data__, i, j) | 0);
+ } : (value = Math.max(1, value | 0), function(node) {
+ node.duration = value;
+ }));
+ };
+ d3_transitionPrototype.transition = function() {
+ return this.select(d3_this);
+ };
+ d3.tween = function(b, interpolate) {
+ function tweenFunction(d, i, a) {
+ var v = b.call(this, d, i);
+ return v == null ? a != "" && d3_tweenRemove : a != v && interpolate(a, v);
+ }
+ function tweenString(d, i, a) {
+ return a != b && interpolate(a, b);
+ }
+ return typeof b === "function" ? tweenFunction : b == null ? d3_tweenNull : (b += "", tweenString);
+ };
+ var d3_tweenRemove = {};
+ var d3_timer_queue = null, d3_timer_interval, d3_timer_timeout;
+ d3.timer = function(callback, delay, then) {
+ var found = false, t0, t1 = d3_timer_queue;
+ if (arguments.length < 3) {
+ if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return;
+ then = Date.now();
+ }
+ while (t1) {
+ if (t1.callback === callback) {
+ t1.then = then;
+ t1.delay = delay;
+ found = true;
+ break;
+ }
+ t0 = t1;
+ t1 = t1.next;
+ }
+ if (!found) d3_timer_queue = {
+ callback: callback,
+ then: then,
+ delay: delay,
+ next: d3_timer_queue
+ };
+ if (!d3_timer_interval) {
+ d3_timer_timeout = clearTimeout(d3_timer_timeout);
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+ };
+ d3.timer.flush = function() {
+ var elapsed, now = Date.now(), t1 = d3_timer_queue;
+ while (t1) {
+ elapsed = now - t1.then;
+ if (!t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+ d3_timer_flush();
+ };
+ var d3_timer_frame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) {
+ setTimeout(callback, 17);
+ };
+ d3.mouse = function(container) {
+ return d3_mousePoint(container, d3_eventSource());
+ };
+ var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;
+ d3.touches = function(container, touches) {
+ if (arguments.length < 2) touches = d3_eventSource().touches;
+ return touches ? d3_array(touches).map(function(touch) {
+ var point = d3_mousePoint(container, touch);
+ point.identifier = touch.identifier;
+ return point;
+ }) : [];
+ };
+ d3.scale = {};
+ d3.scale.linear = function() {
+ return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3.interpolate, false);
+ };
+ d3.scale.log = function() {
+ return d3_scale_log(d3.scale.linear(), d3_scale_logp);
+ };
+ var d3_scale_logFormat = d3.format(".0e");
+ d3_scale_logp.pow = function(x) {
+ return Math.pow(10, x);
+ };
+ d3_scale_logn.pow = function(x) {
+ return -Math.pow(10, -x);
+ };
+ d3.scale.pow = function() {
+ return d3_scale_pow(d3.scale.linear(), 1);
+ };
+ d3.scale.sqrt = function() {
+ return d3.scale.pow().exponent(.5);
+ };
+ d3.scale.ordinal = function() {
+ return d3_scale_ordinal([], {
+ t: "range",
+ a: [ [] ]
+ });
+ };
+ d3.scale.category10 = function() {
+ return d3.scale.ordinal().range(d3_category10);
+ };
+ d3.scale.category20 = function() {
+ return d3.scale.ordinal().range(d3_category20);
+ };
+ d3.scale.category20b = function() {
+ return d3.scale.ordinal().range(d3_category20b);
+ };
+ d3.scale.category20c = function() {
+ return d3.scale.ordinal().range(d3_category20c);
+ };
+ var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ];
+ var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ];
+ var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ];
+ var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ];
+ d3.scale.quantile = function() {
+ return d3_scale_quantile([], []);
+ };
+ d3.scale.quantize = function() {
+ return d3_scale_quantize(0, 1, [ 0, 1 ]);
+ };
+ d3.scale.threshold = function() {
+ return d3_scale_threshold([ .5 ], [ 0, 1 ]);
+ };
+ d3.scale.identity = function() {
+ return d3_scale_identity([ 0, 1 ]);
+ };
+ d3.svg = {};
+ d3.svg.arc = function() {
+ function arc() {
+ var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), df = da < Math.PI ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1);
+ return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z";
+ }
+ var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
+ arc.innerRadius = function(v) {
+ if (!arguments.length) return innerRadius;
+ innerRadius = d3_functor(v);
+ return arc;
+ };
+ arc.outerRadius = function(v) {
+ if (!arguments.length) return outerRadius;
+ outerRadius = d3_functor(v);
+ return arc;
+ };
+ arc.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return arc;
+ };
+ arc.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return arc;
+ };
+ arc.centroid = function() {
+ var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
+ return [ Math.cos(a) * r, Math.sin(a) * r ];
+ };
+ return arc;
+ };
+ var d3_svg_arcOffset = -Math.PI / 2, d3_svg_arcMax = 2 * Math.PI - 1e-6;
+ d3.svg.line = function() {
+ return d3_svg_line(d3_identity);
+ };
+ var d3_svg_lineInterpolators = d3.map({
+ linear: d3_svg_lineLinear,
+ "linear-closed": d3_svg_lineLinearClosed,
+ "step-before": d3_svg_lineStepBefore,
+ "step-after": d3_svg_lineStepAfter,
+ basis: d3_svg_lineBasis,
+ "basis-open": d3_svg_lineBasisOpen,
+ "basis-closed": d3_svg_lineBasisClosed,
+ bundle: d3_svg_lineBundle,
+ cardinal: d3_svg_lineCardinal,
+ "cardinal-open": d3_svg_lineCardinalOpen,
+ "cardinal-closed": d3_svg_lineCardinalClosed,
+ monotone: d3_svg_lineMonotone
+ });
+ d3_svg_lineInterpolators.forEach(function(key, value) {
+ value.key = key;
+ value.closed = /-closed$/.test(key);
+ });
+ var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ];
+ d3.svg.line.radial = function() {
+ var line = d3_svg_line(d3_svg_lineRadial);
+ line.radius = line.x, delete line.x;
+ line.angle = line.y, delete line.y;
+ return line;
+ };
+ d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
+ d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
+ d3.svg.area = function() {
+ return d3_svg_area(d3_identity);
+ };
+ d3.svg.area.radial = function() {
+ var area = d3_svg_area(d3_svg_lineRadial);
+ area.radius = area.x, delete area.x;
+ area.innerRadius = area.x0, delete area.x0;
+ area.outerRadius = area.x1, delete area.x1;
+ area.angle = area.y, delete area.y;
+ area.startAngle = area.y0, delete area.y0;
+ area.endAngle = area.y1, delete area.y1;
+ return area;
+ };
+ d3.svg.chord = function() {
+ function chord(d, i) {
+ var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
+ return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z";
+ }
+ function subgroup(self, f, d, i) {
+ var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
+ return {
+ r: r,
+ a0: a0,
+ a1: a1,
+ p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
+ p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
+ };
+ }
+ function equals(a, b) {
+ return a.a0 == b.a0 && a.a1 == b.a1;
+ }
+ function arc(r, p, a) {
+ return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;
+ }
+ function curve(r0, p0, r1, p1) {
+ return "Q 0,0 " + p1;
+ }
+ var source = d3_svg_chordSource, target = d3_svg_chordTarget, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
+ chord.radius = function(v) {
+ if (!arguments.length) return radius;
+ radius = d3_functor(v);
+ return chord;
+ };
+ chord.source = function(v) {
+ if (!arguments.length) return source;
+ source = d3_functor(v);
+ return chord;
+ };
+ chord.target = function(v) {
+ if (!arguments.length) return target;
+ target = d3_functor(v);
+ return chord;
+ };
+ chord.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return chord;
+ };
+ chord.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return chord;
+ };
+ return chord;
+ };
+ d3.svg.diagonal = function() {
+ function diagonal(d, i) {
+ var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
+ x: p0.x,
+ y: m
+ }, {
+ x: p3.x,
+ y: m
+ }, p3 ];
+ p = p.map(projection);
+ return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
+ }
+ var source = d3_svg_chordSource, target = d3_svg_chordTarget, projection = d3_svg_diagonalProjection;
+ diagonal.source = function(x) {
+ if (!arguments.length) return source;
+ source = d3_functor(x);
+ return diagonal;
+ };
+ diagonal.target = function(x) {
+ if (!arguments.length) return target;
+ target = d3_functor(x);
+ return diagonal;
+ };
+ diagonal.projection = function(x) {
+ if (!arguments.length) return projection;
+ projection = x;
+ return diagonal;
+ };
+ return diagonal;
+ };
+ d3.svg.diagonal.radial = function() {
+ var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;
+ diagonal.projection = function(x) {
+ return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;
+ };
+ return diagonal;
+ };
+ d3.svg.mouse = d3.mouse;
+ d3.svg.touches = d3.touches;
+ d3.svg.symbol = function() {
+ function symbol(d, i) {
+ return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));
+ }
+ var type = d3_svg_symbolType, size = d3_svg_symbolSize;
+ symbol.type = function(x) {
+ if (!arguments.length) return type;
+ type = d3_functor(x);
+ return symbol;
+ };
+ symbol.size = function(x) {
+ if (!arguments.length) return size;
+ size = d3_functor(x);
+ return symbol;
+ };
+ return symbol;
+ };
+ var d3_svg_symbols = d3.map({
+ circle: d3_svg_symbolCircle,
+ cross: function(size) {
+ var r = Math.sqrt(size / 5) / 2;
+ return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z";
+ },
+ diamond: function(size) {
+ var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;
+ return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
+ },
+ square: function(size) {
+ var r = Math.sqrt(size) / 2;
+ return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
+ },
+ "triangle-down": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
+ },
+ "triangle-up": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
+ }
+ });
+ d3.svg.symbolTypes = d3_svg_symbols.keys();
+ var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180);
+ d3.svg.axis = function() {
+ function axis(g) {
+ g.each(function() {
+ var g = d3.select(this);
+ var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_;
+ var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1);
+ var tick = g.selectAll("g").data(ticks, String), tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform;
+ var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathEnter = path.enter().append("path").attr("class", "domain"), pathUpdate = d3.transition(path);
+ var scale1 = scale.copy(), scale0 = this.__chart__ || scale1;
+ this.__chart__ = scale1;
+ tickEnter.append("line").attr("class", "tick");
+ tickEnter.append("text");
+ var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
+ switch (orient) {
+ case "bottom":
+ {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
+ lineEnter.attr("y2", tickMajorSize);
+ textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding);
+ lineUpdate.attr("x2", 0).attr("y2", tickMajorSize);
+ textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding);
+ text.attr("dy", ".71em").attr("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
+ break;
+ }
+ case "top":
+ {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", -tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
+ lineEnter.attr("y2", -tickMajorSize);
+ textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
+ lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize);
+ textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
+ text.attr("dy", "0em").attr("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
+ break;
+ }
+ case "left":
+ {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", -tickMinorSize);
+ subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
+ lineEnter.attr("x2", -tickMajorSize);
+ textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
+ lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0);
+ textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0);
+ text.attr("dy", ".32em").attr("text-anchor", "end");
+ pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
+ break;
+ }
+ case "right":
+ {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", tickMinorSize);
+ subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
+ lineEnter.attr("x2", tickMajorSize);
+ textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding);
+ lineUpdate.attr("x2", tickMajorSize).attr("y2", 0);
+ textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0);
+ text.attr("dy", ".32em").attr("text-anchor", "start");
+ pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
+ break;
+ }
+ }
+ if (scale.ticks) {
+ tickEnter.call(tickTransform, scale0);
+ tickUpdate.call(tickTransform, scale1);
+ tickExit.call(tickTransform, scale1);
+ subtickEnter.call(tickTransform, scale0);
+ subtickUpdate.call(tickTransform, scale1);
+ subtickExit.call(tickTransform, scale1);
+ } else {
+ var dx = scale1.rangeBand() / 2, x = function(d) {
+ return scale1(d) + dx;
+ };
+ tickEnter.call(tickTransform, x);
+ tickUpdate.call(tickTransform, x);
+ }
+ });
+ }
+ var scale = d3.scale.linear(), orient = "bottom", tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0;
+ axis.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = x;
+ return axis;
+ };
+ axis.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ return axis;
+ };
+ axis.ticks = function() {
+ if (!arguments.length) return tickArguments_;
+ tickArguments_ = arguments;
+ return axis;
+ };
+ axis.tickValues = function(x) {
+ if (!arguments.length) return tickValues;
+ tickValues = x;
+ return axis;
+ };
+ axis.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat_;
+ tickFormat_ = x;
+ return axis;
+ };
+ axis.tickSize = function(x, y, z) {
+ if (!arguments.length) return tickMajorSize;
+ var n = arguments.length - 1;
+ tickMajorSize = +x;
+ tickMinorSize = n > 1 ? +y : tickMajorSize;
+ tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
+ return axis;
+ };
+ axis.tickPadding = function(x) {
+ if (!arguments.length) return tickPadding;
+ tickPadding = +x;
+ return axis;
+ };
+ axis.tickSubdivide = function(x) {
+ if (!arguments.length) return tickSubdivide;
+ tickSubdivide = +x;
+ return axis;
+ };
+ return axis;
+ };
+ d3.svg.brush = function() {
+ function brush(g) {
+ g.each(function() {
+ var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e;
+ g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
+ bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
+ fg.enter().append("rect").attr("class", "extent").style("cursor", "move");
+ tz.enter().append("g").attr("class", function(d) {
+ return "resize " + d;
+ }).style("cursor", function(d) {
+ return d3_svg_brushCursor[d];
+ }).append("rect").attr("x", function(d) {
+ return /[ew]$/.test(d) ? -3 : null;
+ }).attr("y", function(d) {
+ return /^[ns]/.test(d) ? -3 : null;
+ }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
+ tz.style("display", brush.empty() ? "none" : null);
+ tz.exit().remove();
+ if (x) {
+ e = d3_scaleRange(x);
+ bg.attr("x", e[0]).attr("width", e[1] - e[0]);
+ redrawX(g);
+ }
+ if (y) {
+ e = d3_scaleRange(y);
+ bg.attr("y", e[0]).attr("height", e[1] - e[0]);
+ redrawY(g);
+ }
+ redraw(g);
+ });
+ }
+ function redraw(g) {
+ g.selectAll(".resize").attr("transform", function(d) {
+ return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";
+ });
+ }
+ function redrawX(g) {
+ g.select(".extent").attr("x", extent[0][0]);
+ g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);
+ }
+ function redrawY(g) {
+ g.select(".extent").attr("y", extent[0][1]);
+ g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
+ }
+ function brushstart() {
+ function mouse() {
+ var touches = d3.event.changedTouches;
+ return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
+ }
+ function keydown() {
+ if (d3.event.keyCode == 32) {
+ if (!dragging) {
+ center = null;
+ origin[0] -= extent[1][0];
+ origin[1] -= extent[1][1];
+ dragging = 2;
+ }
+ d3_eventCancel();
+ }
+ }
+ function keyup() {
+ if (d3.event.keyCode == 32 && dragging == 2) {
+ origin[0] += extent[1][0];
+ origin[1] += extent[1][1];
+ dragging = 0;
+ d3_eventCancel();
+ }
+ }
+ function brushmove() {
+ var point = mouse(), moved = false;
+ if (offset) {
+ point[0] += offset[0];
+ point[1] += offset[1];
+ }
+ if (!dragging) {
+ if (d3.event.altKey) {
+ if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ];
+ origin[0] = extent[+(point[0] < center[0])][0];
+ origin[1] = extent[+(point[1] < center[1])][1];
+ } else center = null;
+ }
+ if (resizingX && move1(point, x, 0)) {
+ redrawX(g);
+ moved = true;
+ }
+ if (resizingY && move1(point, y, 1)) {
+ redrawY(g);
+ moved = true;
+ }
+ if (moved) {
+ redraw(g);
+ event_({
+ type: "brush",
+ mode: dragging ? "move" : "resize"
+ });
+ }
+ }
+ function move1(point, scale, i) {
+ var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max;
+ if (dragging) {
+ r0 -= position;
+ r1 -= size + position;
+ }
+ min = Math.max(r0, Math.min(r1, point[i]));
+ if (dragging) {
+ max = (min += position) + size;
+ } else {
+ if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
+ if (position < min) {
+ max = min;
+ min = position;
+ } else {
+ max = position;
+ }
+ }
+ if (extent[0][i] !== min || extent[1][i] !== max) {
+ extentDomain = null;
+ extent[0][i] = min;
+ extent[1][i] = max;
+ return true;
+ }
+ }
+ function brushend() {
+ brushmove();
+ g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
+ d3.select("body").style("cursor", null);
+ w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null);
+ event_({
+ type: "brushend"
+ });
+ d3_eventCancel();
+ }
+ var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset;
+ var w = d3.select(window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup);
+ if (dragging) {
+ origin[0] = extent[0][0] - origin[0];
+ origin[1] = extent[0][1] - origin[1];
+ } else if (resizing) {
+ var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);
+ offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ];
+ origin[0] = extent[ex][0];
+ origin[1] = extent[ey][1];
+ } else if (d3.event.altKey) center = origin.slice();
+ g.style("pointer-events", "none").selectAll(".resize").style("display", null);
+ d3.select("body").style("cursor", eventTarget.style("cursor"));
+ event_({
+ type: "brushstart"
+ });
+ brushmove();
+ d3_eventCancel();
+ }
+ var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain;
+ brush.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ resizes = d3_svg_brushResizes[!x << 1 | !y];
+ return brush;
+ };
+ brush.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ resizes = d3_svg_brushResizes[!x << 1 | !y];
+ return brush;
+ };
+ brush.extent = function(z) {
+ var x0, x1, y0, y1, t;
+ if (!arguments.length) {
+ z = extentDomain || extent;
+ if (x) {
+ x0 = z[0][0], x1 = z[1][0];
+ if (!extentDomain) {
+ x0 = extent[0][0], x1 = extent[1][0];
+ if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ }
+ }
+ if (y) {
+ y0 = z[0][1], y1 = z[1][1];
+ if (!extentDomain) {
+ y0 = extent[0][1], y1 = extent[1][1];
+ if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ }
+ }
+ return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];
+ }
+ extentDomain = [ [ 0, 0 ], [ 0, 0 ] ];
+ if (x) {
+ x0 = z[0], x1 = z[1];
+ if (y) x0 = x0[0], x1 = x1[0];
+ extentDomain[0][0] = x0, extentDomain[1][0] = x1;
+ if (x.invert) x0 = x(x0), x1 = x(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
+ }
+ if (y) {
+ y0 = z[0], y1 = z[1];
+ if (x) y0 = y0[1], y1 = y1[1];
+ extentDomain[0][1] = y0, extentDomain[1][1] = y1;
+ if (y.invert) y0 = y(y0), y1 = y(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
+ }
+ return brush;
+ };
+ brush.clear = function() {
+ extentDomain = null;
+ extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0;
+ return brush;
+ };
+ brush.empty = function() {
+ return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1];
+ };
+ return d3.rebind(brush, event, "on");
+ };
+ var d3_svg_brushCursor = {
+ n: "ns-resize",
+ e: "ew-resize",
+ s: "ns-resize",
+ w: "ew-resize",
+ nw: "nwse-resize",
+ ne: "nesw-resize",
+ se: "nwse-resize",
+ sw: "nesw-resize"
+ };
+ var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];
+ d3.behavior = {};
+ d3.behavior.drag = function() {
+ function drag() {
+ this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);
+ }
+ function mousedown() {
+ function point() {
+ var p = target.parentNode;
+ return touchId ? d3.touches(p).filter(function(p) {
+ return p.identifier === touchId;
+ })[0] : d3.mouse(p);
+ }
+ function dragmove() {
+ if (!target.parentNode) return dragend();
+ var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
+ moved |= dx | dy;
+ origin_ = p;
+ d3_eventCancel();
+ event_({
+ type: "drag",
+ x: p[0] + offset[0],
+ y: p[1] + offset[1],
+ dx: dx,
+ dy: dy
+ });
+ }
+ function dragend() {
+ event_({
+ type: "dragend"
+ });
+ if (moved) {
+ d3_eventCancel();
+ if (d3.event.target === eventTarget) w.on("click.drag", click, true);
+ }
+ w.on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", null);
+ }
+ function click() {
+ d3_eventCancel();
+ w.on("click.drag", null);
+ }
+ var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches && d3.event.changedTouches[0].identifier, offset, origin_ = point(), moved = 0;
+ var w = d3.select(window).on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true);
+ if (origin) {
+ offset = origin.apply(target, arguments);
+ offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
+ } else {
+ offset = [ 0, 0 ];
+ }
+ if (!touchId) d3_eventCancel();
+ event_({
+ type: "dragstart"
+ });
+ }
+ var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null;
+ drag.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ return drag;
+ };
+ return d3.rebind(drag, event, "on");
+ };
+ d3.behavior.zoom = function() {
+ function zoom() {
+ this.on("mousedown.zoom", mousedown).on("mousewheel.zoom", mousewheel).on("mousemove.zoom", mousemove).on("DOMMouseScroll.zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart);
+ }
+ function location(p) {
+ return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ];
+ }
+ function point(l) {
+ return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ];
+ }
+ function scaleTo(s) {
+ scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
+ }
+ function translateTo(p, l) {
+ l = point(l);
+ translate[0] += p[0] - l[0];
+ translate[1] += p[1] - l[1];
+ }
+ function dispatch(event) {
+ if (x1) x1.domain(x0.range().map(function(x) {
+ return (x - translate[0]) / scale;
+ }).map(x0.invert));
+ if (y1) y1.domain(y0.range().map(function(y) {
+ return (y - translate[1]) / scale;
+ }).map(y0.invert));
+ d3.event.preventDefault();
+ event({
+ type: "zoom",
+ scale: scale,
+ translate: translate
+ });
+ }
+ function mousedown() {
+ function mousemove() {
+ moved = 1;
+ translateTo(d3.mouse(target), l);
+ dispatch(event_);
+ }
+ function mouseup() {
+ if (moved) d3_eventCancel();
+ w.on("mousemove.zoom", null).on("mouseup.zoom", null);
+ if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true);
+ }
+ function click() {
+ d3_eventCancel();
+ w.on("click.zoom", null);
+ }
+ var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target));
+ window.focus();
+ d3_eventCancel();
+ }
+ function mousewheel() {
+ if (!translate0) translate0 = location(d3.mouse(this));
+ scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);
+ translateTo(d3.mouse(this), translate0);
+ dispatch(event.of(this, arguments));
+ }
+ function mousemove() {
+ translate0 = null;
+ }
+ function dblclick() {
+ var p = d3.mouse(this), l = location(p);
+ scaleTo(d3.event.shiftKey ? scale / 2 : scale * 2);
+ translateTo(p, l);
+ dispatch(event.of(this, arguments));
+ }
+ function touchstart() {
+ var touches = d3.touches(this), now = Date.now();
+ scale0 = scale;
+ translate0 = {};
+ touches.forEach(function(t) {
+ translate0[t.identifier] = location(t);
+ });
+ d3_eventCancel();
+ if (touches.length === 1) {
+ if (now - touchtime < 500) {
+ var p = touches[0], l = location(touches[0]);
+ scaleTo(scale * 2);
+ translateTo(p, l);
+ dispatch(event.of(this, arguments));
+ }
+ touchtime = now;
+ }
+ }
+ function touchmove() {
+ var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier];
+ if (p1 = touches[1]) {
+ var p1, l1 = translate0[p1.identifier];
+ p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];
+ l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
+ scaleTo(d3.event.scale * scale0);
+ }
+ translateTo(p0, l0);
+ touchtime = null;
+ dispatch(event.of(this, arguments));
+ }
+ var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
+ zoom.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = x.map(Number);
+ return zoom;
+ };
+ zoom.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return zoom;
+ };
+ zoom.scaleExtent = function(x) {
+ if (!arguments.length) return scaleExtent;
+ scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);
+ return zoom;
+ };
+ zoom.x = function(z) {
+ if (!arguments.length) return x1;
+ x1 = z;
+ x0 = z.copy();
+ return zoom;
+ };
+ zoom.y = function(z) {
+ if (!arguments.length) return y1;
+ y1 = z;
+ y0 = z.copy();
+ return zoom;
+ };
+ return d3.rebind(zoom, event, "on");
+ };
+ var d3_behavior_zoomDiv, d3_behavior_zoomInfinity = [ 0, Infinity ];
+ d3.layout = {};
+ d3.layout.bundle = function() {
+ return function(links) {
+ var paths = [], i = -1, n = links.length;
+ while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
+ return paths;
+ };
+ };
+ d3.layout.chord = function() {
+ function relayout() {
+ var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;
+ chords = [];
+ groups = [];
+ k = 0, i = -1;
+ while (++i < n) {
+ x = 0, j = -1;
+ while (++j < n) {
+ x += matrix[i][j];
+ }
+ groupSums.push(x);
+ subgroupIndex.push(d3.range(n));
+ k += x;
+ }
+ if (sortGroups) {
+ groupIndex.sort(function(a, b) {
+ return sortGroups(groupSums[a], groupSums[b]);
+ });
+ }
+ if (sortSubgroups) {
+ subgroupIndex.forEach(function(d, i) {
+ d.sort(function(a, b) {
+ return sortSubgroups(matrix[i][a], matrix[i][b]);
+ });
+ });
+ }
+ k = (2 * Math.PI - padding * n) / k;
+ x = 0, i = -1;
+ while (++i < n) {
+ x0 = x, j = -1;
+ while (++j < n) {
+ var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
+ subgroups[di + "-" + dj] = {
+ index: di,
+ subindex: dj,
+ startAngle: a0,
+ endAngle: a1,
+ value: v
+ };
+ }
+ groups[di] = {
+ index: di,
+ startAngle: x0,
+ endAngle: x,
+ value: (x - x0) / k
+ };
+ x += padding;
+ }
+ i = -1;
+ while (++i < n) {
+ j = i - 1;
+ while (++j < n) {
+ var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
+ if (source.value || target.value) {
+ chords.push(source.value < target.value ? {
+ source: target,
+ target: source
+ } : {
+ source: source,
+ target: target
+ });
+ }
+ }
+ }
+ if (sortChords) resort();
+ }
+ function resort() {
+ chords.sort(function(a, b) {
+ return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
+ });
+ }
+ var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
+ chord.matrix = function(x) {
+ if (!arguments.length) return matrix;
+ n = (matrix = x) && matrix.length;
+ chords = groups = null;
+ return chord;
+ };
+ chord.padding = function(x) {
+ if (!arguments.length) return padding;
+ padding = x;
+ chords = groups = null;
+ return chord;
+ };
+ chord.sortGroups = function(x) {
+ if (!arguments.length) return sortGroups;
+ sortGroups = x;
+ chords = groups = null;
+ return chord;
+ };
+ chord.sortSubgroups = function(x) {
+ if (!arguments.length) return sortSubgroups;
+ sortSubgroups = x;
+ chords = null;
+ return chord;
+ };
+ chord.sortChords = function(x) {
+ if (!arguments.length) return sortChords;
+ sortChords = x;
+ if (chords) resort();
+ return chord;
+ };
+ chord.chords = function() {
+ if (!chords) relayout();
+ return chords;
+ };
+ chord.groups = function() {
+ if (!groups) relayout();
+ return groups;
+ };
+ return chord;
+ };
+ d3.layout.force = function() {
+ function repulse(node) {
+ return function(quad, x1, y1, x2, y2) {
+ if (quad.point !== node) {
+ var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy);
+ if ((x2 - x1) * dn < theta) {
+ var k = quad.charge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ return true;
+ }
+ if (quad.point && isFinite(dn)) {
+ var k = quad.pointCharge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ }
+ }
+ return !quad.charge;
+ };
+ }
+ function dragmove(d) {
+ d.px = d3.event.x;
+ d.py = d3.event.y;
+ force.resume();
+ }
+ var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, interval, nodes = [], links = [], distances, strengths, charges;
+ force.tick = function() {
+ if ((alpha *= .99) < .005) {
+ event.end({
+ type: "end",
+ alpha: alpha = 0
+ });
+ return true;
+ }
+ var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ s = o.source;
+ t = o.target;
+ x = t.x - s.x;
+ y = t.y - s.y;
+ if (l = x * x + y * y) {
+ l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
+ x *= l;
+ y *= l;
+ t.x -= x * (k = s.weight / (t.weight + s.weight));
+ t.y -= y * k;
+ s.x += x * (k = 1 - k);
+ s.y += y * k;
+ }
+ }
+ if (k = alpha * gravity) {
+ x = size[0] / 2;
+ y = size[1] / 2;
+ i = -1;
+ if (k) while (++i < n) {
+ o = nodes[i];
+ o.x += (x - o.x) * k;
+ o.y += (y - o.y) * k;
+ }
+ }
+ if (charge) {
+ d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
+ i = -1;
+ while (++i < n) {
+ if (!(o = nodes[i]).fixed) {
+ q.visit(repulse(o));
+ }
+ }
+ }
+ i = -1;
+ while (++i < n) {
+ o = nodes[i];
+ if (o.fixed) {
+ o.x = o.px;
+ o.y = o.py;
+ } else {
+ o.x -= (o.px - (o.px = o.x)) * friction;
+ o.y -= (o.py - (o.py = o.y)) * friction;
+ }
+ }
+ event.tick({
+ type: "tick",
+ alpha: alpha
+ });
+ };
+ force.nodes = function(x) {
+ if (!arguments.length) return nodes;
+ nodes = x;
+ return force;
+ };
+ force.links = function(x) {
+ if (!arguments.length) return links;
+ links = x;
+ return force;
+ };
+ force.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return force;
+ };
+ force.linkDistance = function(x) {
+ if (!arguments.length) return linkDistance;
+ linkDistance = d3_functor(x);
+ return force;
+ };
+ force.distance = force.linkDistance;
+ force.linkStrength = function(x) {
+ if (!arguments.length) return linkStrength;
+ linkStrength = d3_functor(x);
+ return force;
+ };
+ force.friction = function(x) {
+ if (!arguments.length) return friction;
+ friction = x;
+ return force;
+ };
+ force.charge = function(x) {
+ if (!arguments.length) return charge;
+ charge = typeof x === "function" ? x : +x;
+ return force;
+ };
+ force.gravity = function(x) {
+ if (!arguments.length) return gravity;
+ gravity = x;
+ return force;
+ };
+ force.theta = function(x) {
+ if (!arguments.length) return theta;
+ theta = x;
+ return force;
+ };
+ force.alpha = function(x) {
+ if (!arguments.length) return alpha;
+ if (alpha) {
+ if (x > 0) alpha = x; else alpha = 0;
+ } else if (x > 0) {
+ event.start({
+ type: "start",
+ alpha: alpha = x
+ });
+ d3.timer(force.tick);
+ }
+ return force;
+ };
+ force.start = function() {
+ function position(dimension, size) {
+ var neighbors = neighbor(i), j = -1, m = neighbors.length, x;
+ while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
+ return Math.random() * size;
+ }
+ function neighbor() {
+ if (!neighbors) {
+ neighbors = [];
+ for (j = 0; j < n; ++j) {
+ neighbors[j] = [];
+ }
+ for (j = 0; j < m; ++j) {
+ var o = links[j];
+ neighbors[o.source.index].push(o.target);
+ neighbors[o.target.index].push(o.source);
+ }
+ }
+ return neighbors[i];
+ }
+ var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;
+ for (i = 0; i < n; ++i) {
+ (o = nodes[i]).index = i;
+ o.weight = 0;
+ }
+ distances = [];
+ strengths = [];
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ if (typeof o.source == "number") o.source = nodes[o.source];
+ if (typeof o.target == "number") o.target = nodes[o.target];
+ distances[i] = linkDistance.call(this, o, i);
+ strengths[i] = linkStrength.call(this, o, i);
+ ++o.source.weight;
+ ++o.target.weight;
+ }
+ for (i = 0; i < n; ++i) {
+ o = nodes[i];
+ if (isNaN(o.x)) o.x = position("x", w);
+ if (isNaN(o.y)) o.y = position("y", h);
+ if (isNaN(o.px)) o.px = o.x;
+ if (isNaN(o.py)) o.py = o.y;
+ }
+ charges = [];
+ if (typeof charge === "function") {
+ for (i = 0; i < n; ++i) {
+ charges[i] = +charge.call(this, nodes[i], i);
+ }
+ } else {
+ for (i = 0; i < n; ++i) {
+ charges[i] = charge;
+ }
+ }
+ return force.resume();
+ };
+ force.resume = function() {
+ return force.alpha(.1);
+ };
+ force.stop = function() {
+ return force.alpha(0);
+ };
+ force.drag = function() {
+ if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart", d3_layout_forceDragstart).on("drag", dragmove).on("dragend", d3_layout_forceDragend);
+ this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);
+ };
+ return d3.rebind(force, event, "on");
+ };
+ d3.layout.partition = function() {
+ function position(node, x, dx, dy) {
+ var children = node.children;
+ node.x = x;
+ node.y = node.depth * dy;
+ node.dx = dx;
+ node.dy = dy;
+ if (children && (n = children.length)) {
+ var i = -1, n, c, d;
+ dx = node.value ? dx / node.value : 0;
+ while (++i < n) {
+ position(c = children[i], x, d = c.value * dx, dy);
+ x += d;
+ }
+ }
+ }
+ function depth(node) {
+ var children = node.children, d = 0;
+ if (children && (n = children.length)) {
+ var i = -1, n;
+ while (++i < n) d = Math.max(d, depth(children[i]));
+ }
+ return 1 + d;
+ }
+ function partition(d, i) {
+ var nodes = hierarchy.call(this, d, i);
+ position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];
+ partition.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return partition;
+ };
+ return d3_layout_hierarchyRebind(partition, hierarchy);
+ };
+ d3.layout.pie = function() {
+ function pie(data, i) {
+ var values = data.map(function(d, i) {
+ return +value.call(pie, d, i);
+ });
+ var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle);
+ var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - startAngle) / d3.sum(values);
+ var index = d3.range(data.length);
+ if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
+ return values[j] - values[i];
+ } : function(i, j) {
+ return sort(data[i], data[j]);
+ });
+ var arcs = [];
+ index.forEach(function(i) {
+ var d;
+ arcs[i] = {
+ data: data[i],
+ value: d = values[i],
+ startAngle: a,
+ endAngle: a += d * k
+ };
+ });
+ return arcs;
+ }
+ var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * Math.PI;
+ pie.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return pie;
+ };
+ pie.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return pie;
+ };
+ pie.startAngle = function(x) {
+ if (!arguments.length) return startAngle;
+ startAngle = x;
+ return pie;
+ };
+ pie.endAngle = function(x) {
+ if (!arguments.length) return endAngle;
+ endAngle = x;
+ return pie;
+ };
+ return pie;
+ };
+ var d3_layout_pieSortByValue = {};
+ d3.layout.stack = function() {
+ function stack(data, index) {
+ var series = data.map(function(d, i) {
+ return values.call(stack, d, i);
+ });
+ var points = series.map(function(d, i) {
+ return d.map(function(v, i) {
+ return [ x.call(stack, v, i), y.call(stack, v, i) ];
+ });
+ });
+ var orders = order.call(stack, points, index);
+ series = d3.permute(series, orders);
+ points = d3.permute(points, orders);
+ var offsets = offset.call(stack, points, index);
+ var n = series.length, m = series[0].length, i, j, o;
+ for (j = 0; j < m; ++j) {
+ out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
+ for (i = 1; i < n; ++i) {
+ out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
+ }
+ }
+ return data;
+ }
+ var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
+ stack.values = function(x) {
+ if (!arguments.length) return values;
+ values = x;
+ return stack;
+ };
+ stack.order = function(x) {
+ if (!arguments.length) return order;
+ order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
+ return stack;
+ };
+ stack.offset = function(x) {
+ if (!arguments.length) return offset;
+ offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
+ return stack;
+ };
+ stack.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ return stack;
+ };
+ stack.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ return stack;
+ };
+ stack.out = function(z) {
+ if (!arguments.length) return out;
+ out = z;
+ return stack;
+ };
+ return stack;
+ };
+ var d3_layout_stackOrders = d3.map({
+ "inside-out": function(data) {
+ var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) {
+ return max[a] - max[b];
+ }), top = 0, bottom = 0, tops = [], bottoms = [];
+ for (i = 0; i < n; ++i) {
+ j = index[i];
+ if (top < bottom) {
+ top += sums[j];
+ tops.push(j);
+ } else {
+ bottom += sums[j];
+ bottoms.push(j);
+ }
+ }
+ return bottoms.reverse().concat(tops);
+ },
+ reverse: function(data) {
+ return d3.range(data.length).reverse();
+ },
+ "default": d3_layout_stackOrderDefault
+ });
+ var d3_layout_stackOffsets = d3.map({
+ silhouette: function(data) {
+ var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o > max) max = o;
+ sums.push(o);
+ }
+ for (j = 0; j < m; ++j) {
+ y0[j] = (max - sums[j]) / 2;
+ }
+ return y0;
+ },
+ wiggle: function(data) {
+ var n = data.length, x = data[0], m = x.length, max = 0, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];
+ y0[0] = o = o0 = 0;
+ for (j = 1; j < m; ++j) {
+ for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
+ for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
+ for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
+ s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
+ }
+ s2 += s3 * data[i][j][1];
+ }
+ y0[j] = o -= s1 ? s2 / s1 * dx : 0;
+ if (o < o0) o0 = o;
+ }
+ for (j = 0; j < m; ++j) y0[j] -= o0;
+ return y0;
+ },
+ expand: function(data) {
+ var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k;
+ }
+ for (j = 0; j < m; ++j) y0[j] = 0;
+ return y0;
+ },
+ zero: d3_layout_stackOffsetZero
+ });
+ d3.layout.histogram = function() {
+ function histogram(data, i) {
+ var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x;
+ while (++i < m) {
+ bin = bins[i] = [];
+ bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
+ bin.y = 0;
+ }
+ if (m > 0) {
+ i = -1;
+ while (++i < n) {
+ x = values[i];
+ if (x >= range[0] && x <= range[1]) {
+ bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
+ bin.y += k;
+ bin.push(data[i]);
+ }
+ }
+ }
+ return bins;
+ }
+ var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;
+ histogram.value = function(x) {
+ if (!arguments.length) return valuer;
+ valuer = x;
+ return histogram;
+ };
+ histogram.range = function(x) {
+ if (!arguments.length) return ranger;
+ ranger = d3_functor(x);
+ return histogram;
+ };
+ histogram.bins = function(x) {
+ if (!arguments.length) return binner;
+ binner = typeof x === "number" ? function(range) {
+ return d3_layout_histogramBinFixed(range, x);
+ } : d3_functor(x);
+ return histogram;
+ };
+ histogram.frequency = function(x) {
+ if (!arguments.length) return frequency;
+ frequency = !!x;
+ return histogram;
+ };
+ return histogram;
+ };
+ d3.layout.hierarchy = function() {
+ function recurse(data, depth, nodes) {
+ var childs = children.call(hierarchy, data, depth), node = d3_layout_hierarchyInline ? data : {
+ data: data
+ };
+ node.depth = depth;
+ nodes.push(node);
+ if (childs && (n = childs.length)) {
+ var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d;
+ while (++i < n) {
+ d = recurse(childs[i], j, nodes);
+ d.parent = node;
+ c.push(d);
+ v += d.value;
+ }
+ if (sort) c.sort(sort);
+ if (value) node.value = v;
+ } else if (value) {
+ node.value = +value.call(hierarchy, data, depth) || 0;
+ }
+ return node;
+ }
+ function revalue(node, depth) {
+ var children = node.children, v = 0;
+ if (children && (n = children.length)) {
+ var i = -1, n, j = depth + 1;
+ while (++i < n) v += revalue(children[i], j);
+ } else if (value) {
+ v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0;
+ }
+ if (value) node.value = v;
+ return v;
+ }
+ function hierarchy(d) {
+ var nodes = [];
+ recurse(d, 0, nodes);
+ return nodes;
+ }
+ var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;
+ hierarchy.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return hierarchy;
+ };
+ hierarchy.children = function(x) {
+ if (!arguments.length) return children;
+ children = x;
+ return hierarchy;
+ };
+ hierarchy.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return hierarchy;
+ };
+ hierarchy.revalue = function(root) {
+ revalue(root, 0);
+ return root;
+ };
+ return hierarchy;
+ };
+ var d3_layout_hierarchyInline = false;
+ d3.layout.pack = function() {
+ function pack(d, i) {
+ var nodes = hierarchy.call(this, d, i), root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r = Math.sqrt(d.value);
+ });
+ d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
+ var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h);
+ if (padding > 0) {
+ var dr = padding * k / 2;
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r += dr;
+ });
+ d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r -= dr;
+ });
+ k = Math.max(2 * root.r / w, 2 * root.r / h);
+ }
+ d3_layout_packTransform(root, w / 2, h / 2, 1 / k);
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ];
+ pack.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return pack;
+ };
+ pack.padding = function(_) {
+ if (!arguments.length) return padding;
+ padding = +_;
+ return pack;
+ };
+ return d3_layout_hierarchyRebind(pack, hierarchy);
+ };
+ d3.layout.cluster = function() {
+ function cluster(d, i) {
+ var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0, kx, ky;
+ d3_layout_treeVisitAfter(root, function(node) {
+ var children = node.children;
+ if (children && children.length) {
+ node.x = d3_layout_clusterX(children);
+ node.y = d3_layout_clusterY(children);
+ } else {
+ node.x = previousNode ? x += separation(node, previousNode) : 0;
+ node.y = 0;
+ previousNode = node;
+ }
+ });
+ var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
+ });
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
+ cluster.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return cluster;
+ };
+ cluster.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return cluster;
+ };
+ return d3_layout_hierarchyRebind(cluster, hierarchy);
+ };
+ d3.layout.tree = function() {
+ function tree(d, i) {
+ function firstWalk(node, previousSibling) {
+ var children = node.children, layout = node._tree;
+ if (children && (n = children.length)) {
+ var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;
+ while (++i < n) {
+ child = children[i];
+ firstWalk(child, previousChild);
+ ancestor = apportion(child, previousChild, ancestor);
+ previousChild = child;
+ }
+ d3_layout_treeShift(node);
+ var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ layout.mod = layout.prelim - midpoint;
+ } else {
+ layout.prelim = midpoint;
+ }
+ } else {
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ }
+ }
+ }
+ function secondWalk(node, x) {
+ node.x = node._tree.prelim + x;
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var i = -1, n;
+ x += node._tree.mod;
+ while (++i < n) {
+ secondWalk(children[i], x);
+ }
+ }
+ }
+ function apportion(node, previousSibling, ancestor) {
+ if (previousSibling) {
+ var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift;
+ while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
+ vom = d3_layout_treeLeft(vom);
+ vop = d3_layout_treeRight(vop);
+ vop._tree.ancestor = node;
+ shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
+ if (shift > 0) {
+ d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
+ sip += shift;
+ sop += shift;
+ }
+ sim += vim._tree.mod;
+ sip += vip._tree.mod;
+ som += vom._tree.mod;
+ sop += vop._tree.mod;
+ }
+ if (vim && !d3_layout_treeRight(vop)) {
+ vop._tree.thread = vim;
+ vop._tree.mod += sim - sop;
+ }
+ if (vip && !d3_layout_treeLeft(vom)) {
+ vom._tree.thread = vip;
+ vom._tree.mod += sip - som;
+ ancestor = node;
+ }
+ }
+ return ancestor;
+ }
+ var nodes = hierarchy.call(this, d, i), root = nodes[0];
+ d3_layout_treeVisitAfter(root, function(node, previousSibling) {
+ node._tree = {
+ ancestor: node,
+ prelim: 0,
+ mod: 0,
+ change: 0,
+ shift: 0,
+ number: previousSibling ? previousSibling._tree.number + 1 : 0
+ };
+ });
+ firstWalk(root);
+ secondWalk(root, -root._tree.prelim);
+ var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1;
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = node.depth / y1 * size[1];
+ delete node._tree;
+ });
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
+ tree.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return tree;
+ };
+ tree.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return tree;
+ };
+ return d3_layout_hierarchyRebind(tree, hierarchy);
+ };
+ d3.layout.treemap = function() {
+ function scale(children, k) {
+ var i = -1, n = children.length, child, area;
+ while (++i < n) {
+ area = (child = children[i]).value * (k < 0 ? 0 : k);
+ child.area = isNaN(area) || area <= 0 ? 0 : area;
+ }
+ }
+ function squarify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = Math.min(rect.dx, rect.dy), n;
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while ((n = remaining.length) > 0) {
+ row.push(child = remaining[n - 1]);
+ row.area += child.area;
+ if ((score = worst(row, u)) <= best) {
+ remaining.pop();
+ best = score;
+ } else {
+ row.area -= row.pop().area;
+ position(row, u, rect, false);
+ u = Math.min(rect.dx, rect.dy);
+ row.length = row.area = 0;
+ best = Infinity;
+ }
+ }
+ if (row.length) {
+ position(row, u, rect, true);
+ row.length = row.area = 0;
+ }
+ children.forEach(squarify);
+ }
+ }
+ function stickify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node), remaining = children.slice(), child, row = [];
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while (child = remaining.pop()) {
+ row.push(child);
+ row.area += child.area;
+ if (child.z != null) {
+ position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
+ row.length = row.area = 0;
+ }
+ }
+ children.forEach(stickify);
+ }
+ }
+ function worst(row, u) {
+ var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;
+ while (++i < n) {
+ if (!(r = row[i].area)) continue;
+ if (r < rmin) rmin = r;
+ if (r > rmax) rmax = r;
+ }
+ s *= s;
+ u *= u;
+ return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;
+ }
+ function position(row, u, rect, flush) {
+ var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
+ if (u == rect.dx) {
+ if (flush || v > rect.dy) v = rect.dy;
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dy = v;
+ x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
+ }
+ o.z = true;
+ o.dx += rect.x + rect.dx - x;
+ rect.y += v;
+ rect.dy -= v;
+ } else {
+ if (flush || v > rect.dx) v = rect.dx;
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dx = v;
+ y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
+ }
+ o.z = false;
+ o.dy += rect.y + rect.dy - y;
+ rect.x += v;
+ rect.dx -= v;
+ }
+ }
+ function treemap(d) {
+ var nodes = stickies || hierarchy(d), root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ root.dx = size[0];
+ root.dy = size[1];
+ if (stickies) hierarchy.revalue(root);
+ scale([ root ], root.dx * root.dy / root.value);
+ (stickies ? stickify : squarify)(root);
+ if (sticky) stickies = nodes;
+ return nodes;
+ }
+ var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, ratio = .5 * (1 + Math.sqrt(5));
+ treemap.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return treemap;
+ };
+ treemap.padding = function(x) {
+ function padFunction(node) {
+ var p = x.call(treemap, node, node.depth);
+ return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);
+ }
+ function padConstant(node) {
+ return d3_layout_treemapPad(node, x);
+ }
+ if (!arguments.length) return padding;
+ var type;
+ pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], padConstant) : padConstant;
+ return treemap;
+ };
+ treemap.round = function(x) {
+ if (!arguments.length) return round != Number;
+ round = x ? Math.round : Number;
+ return treemap;
+ };
+ treemap.sticky = function(x) {
+ if (!arguments.length) return sticky;
+ sticky = x;
+ stickies = null;
+ return treemap;
+ };
+ treemap.ratio = function(x) {
+ if (!arguments.length) return ratio;
+ ratio = x;
+ return treemap;
+ };
+ return d3_layout_hierarchyRebind(treemap, hierarchy);
+ };
+ d3.csv = d3_dsv(",", "text/csv");
+ d3.tsv = d3_dsv(" ", "text/tab-separated-values");
+ d3.geo = {};
+ var d3_geo_radians = Math.PI / 180;
+ d3.geo.azimuthal = function() {
+ function azimuthal(coordinates) {
+ var x1 = coordinates[0] * d3_geo_radians - x0, y1 = coordinates[1] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1), cy1 = Math.cos(y1), sy1 = Math.sin(y1), cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null, c, k = mode === "stereographic" ? 1 / (1 + cc) : mode === "gnomonic" ? 1 / cc : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0) : mode === "equalarea" ? Math.sqrt(2 / (1 + cc)) : 1, x = k * cy1 * sx1, y = k * (sy0 * cy1 * cx1 - cy0 * sy1);
+ return [ scale * x + translate[0], scale * y + translate[1] ];
+ }
+ var mode = "orthographic", origin, scale = 200, translate = [ 480, 250 ], x0, y0, cy0, sy0;
+ azimuthal.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p = Math.sqrt(x * x + y * y), c = mode === "stereographic" ? 2 * Math.atan(p) : mode === "gnomonic" ? Math.atan(p) : mode === "equidistant" ? p : mode === "equalarea" ? 2 * Math.asin(.5 * p) : Math.asin(p), sc = Math.sin(c), cc = Math.cos(c);
+ return [ (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians, Math.asin(cc * sy0 - (p ? y * sc * cy0 / p : 0)) / d3_geo_radians ];
+ };
+ azimuthal.mode = function(x) {
+ if (!arguments.length) return mode;
+ mode = x + "";
+ return azimuthal;
+ };
+ azimuthal.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ x0 = origin[0] * d3_geo_radians;
+ y0 = origin[1] * d3_geo_radians;
+ cy0 = Math.cos(y0);
+ sy0 = Math.sin(y0);
+ return azimuthal;
+ };
+ azimuthal.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return azimuthal;
+ };
+ azimuthal.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return azimuthal;
+ };
+ return azimuthal.origin([ 0, 0 ]);
+ };
+ d3.geo.albers = function() {
+ function albers(coordinates) {
+ var t = n * (d3_geo_radians * coordinates[0] - lng0), p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n;
+ return [ scale * p * Math.sin(t) + translate[0], scale * (p * Math.cos(t) - p0) + translate[1] ];
+ }
+ function reload() {
+ var phi1 = d3_geo_radians * parallels[0], phi2 = d3_geo_radians * parallels[1], lat0 = d3_geo_radians * origin[1], s = Math.sin(phi1), c = Math.cos(phi1);
+ lng0 = d3_geo_radians * origin[0];
+ n = .5 * (s + Math.sin(phi2));
+ C = c * c + 2 * n * s;
+ p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n;
+ return albers;
+ }
+ var origin = [ -98, 38 ], parallels = [ 29.5, 45.5 ], scale = 1e3, translate = [ 480, 250 ], lng0, n, C, p0;
+ albers.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p0y = p0 + y, t = Math.atan2(x, p0y), p = Math.sqrt(x * x + p0y * p0y);
+ return [ (lng0 + t / n) / d3_geo_radians, Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians ];
+ };
+ albers.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = [ +x[0], +x[1] ];
+ return reload();
+ };
+ albers.parallels = function(x) {
+ if (!arguments.length) return parallels;
+ parallels = [ +x[0], +x[1] ];
+ return reload();
+ };
+ albers.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return albers;
+ };
+ albers.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return albers;
+ };
+ return reload();
+ };
+ d3.geo.albersUsa = function() {
+ function albersUsa(coordinates) {
+ var lon = coordinates[0], lat = coordinates[1];
+ return (lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48)(coordinates);
+ }
+ var lower48 = d3.geo.albers();
+ var alaska = d3.geo.albers().origin([ -160, 60 ]).parallels([ 55, 65 ]);
+ var hawaii = d3.geo.albers().origin([ -160, 20 ]).parallels([ 8, 18 ]);
+ var puertoRico = d3.geo.albers().origin([ -60, 10 ]).parallels([ 8, 18 ]);
+ albersUsa.scale = function(x) {
+ if (!arguments.length) return lower48.scale();
+ lower48.scale(x);
+ alaska.scale(x * .6);
+ hawaii.scale(x);
+ puertoRico.scale(x * 1.5);
+ return albersUsa.translate(lower48.translate());
+ };
+ albersUsa.translate = function(x) {
+ if (!arguments.length) return lower48.translate();
+ var dz = lower48.scale() / 1e3, dx = x[0], dy = x[1];
+ lower48.translate(x);
+ alaska.translate([ dx - 400 * dz, dy + 170 * dz ]);
+ hawaii.translate([ dx - 190 * dz, dy + 200 * dz ]);
+ puertoRico.translate([ dx + 580 * dz, dy + 430 * dz ]);
+ return albersUsa;
+ };
+ return albersUsa.scale(lower48.scale());
+ };
+ d3.geo.bonne = function() {
+ function bonne(coordinates) {
+ var x = coordinates[0] * d3_geo_radians - x0, y = coordinates[1] * d3_geo_radians - y0;
+ if (y1) {
+ var p = c1 + y1 - y, E = x * Math.cos(y) / p;
+ x = p * Math.sin(E);
+ y = p * Math.cos(E) - c1;
+ } else {
+ x *= Math.cos(y);
+ y *= -1;
+ }
+ return [ scale * x + translate[0], scale * y + translate[1] ];
+ }
+ var scale = 200, translate = [ 480, 250 ], x0, y0, y1, c1;
+ bonne.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
+ if (y1) {
+ var c = c1 + y, p = Math.sqrt(x * x + c * c);
+ y = c1 + y1 - p;
+ x = x0 + p * Math.atan2(x, c) / Math.cos(y);
+ } else {
+ y *= -1;
+ x /= Math.cos(y);
+ }
+ return [ x / d3_geo_radians, y / d3_geo_radians ];
+ };
+ bonne.parallel = function(x) {
+ if (!arguments.length) return y1 / d3_geo_radians;
+ c1 = 1 / Math.tan(y1 = x * d3_geo_radians);
+ return bonne;
+ };
+ bonne.origin = function(x) {
+ if (!arguments.length) return [ x0 / d3_geo_radians, y0 / d3_geo_radians ];
+ x0 = x[0] * d3_geo_radians;
+ y0 = x[1] * d3_geo_radians;
+ return bonne;
+ };
+ bonne.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return bonne;
+ };
+ bonne.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return bonne;
+ };
+ return bonne.origin([ 0, 0 ]).parallel(45);
+ };
+ d3.geo.equirectangular = function() {
+ function equirectangular(coordinates) {
+ var x = coordinates[0] / 360, y = -coordinates[1] / 360;
+ return [ scale * x + translate[0], scale * y + translate[1] ];
+ }
+ var scale = 500, translate = [ 480, 250 ];
+ equirectangular.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
+ return [ 360 * x, -360 * y ];
+ };
+ equirectangular.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return equirectangular;
+ };
+ equirectangular.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return equirectangular;
+ };
+ return equirectangular;
+ };
+ d3.geo.mercator = function() {
+ function mercator(coordinates) {
+ var x = coordinates[0] / 360, y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360;
+ return [ scale * x + translate[0], scale * Math.max(-.5, Math.min(.5, y)) + translate[1] ];
+ }
+ var scale = 500, translate = [ 480, 250 ];
+ mercator.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
+ return [ 360 * x, 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90 ];
+ };
+ mercator.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return mercator;
+ };
+ mercator.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [ +x[0], +x[1] ];
+ return mercator;
+ };
+ return mercator;
+ };
+ d3.geo.path = function() {
+ function path(d, i) {
+ if (typeof pointRadius === "function") pointCircle = d3_path_circle(pointRadius.apply(this, arguments));
+ pathType(d);
+ var result = buffer.length ? buffer.join("") : null;
+ buffer = [];
+ return result;
+ }
+ function project(coordinates) {
+ return projection(coordinates).join(",");
+ }
+ function polygonArea(coordinates) {
+ var sum = area(coordinates[0]), i = 0, n = coordinates.length;
+ while (++i < n) sum -= area(coordinates[i]);
+ return sum;
+ }
+ function polygonCentroid(coordinates) {
+ var polygon = d3.geom.polygon(coordinates[0].map(projection)), area = polygon.area(), centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1), x = centroid[0], y = centroid[1], z = area, i = 0, n = coordinates.length;
+ while (++i < n) {
+ polygon = d3.geom.polygon(coordinates[i].map(projection));
+ area = polygon.area();
+ centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1);
+ x -= centroid[0];
+ y -= centroid[1];
+ z -= area;
+ }
+ return [ x, y, 6 * z ];
+ }
+ function area(coordinates) {
+ return Math.abs(d3.geom.polygon(coordinates.map(projection)).area());
+ }
+ var pointRadius = 4.5, pointCircle = d3_path_circle(pointRadius), projection = d3.geo.albersUsa(), buffer = [];
+ var pathType = d3_geo_type({
+ FeatureCollection: function(o) {
+ var features = o.features, i = -1, n = features.length;
+ while (++i < n) buffer.push(pathType(features[i].geometry));
+ },
+ Feature: function(o) {
+ pathType(o.geometry);
+ },
+ Point: function(o) {
+ buffer.push("M", project(o.coordinates), pointCircle);
+ },
+ MultiPoint: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length;
+ while (++i < n) buffer.push("M", project(coordinates[i]), pointCircle);
+ },
+ LineString: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length;
+ buffer.push("M");
+ while (++i < n) buffer.push(project(coordinates[i]), "L");
+ buffer.pop();
+ },
+ MultiLineString: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;
+ while (++i < n) {
+ subcoordinates = coordinates[i];
+ j = -1;
+ m = subcoordinates.length;
+ buffer.push("M");
+ while (++j < m) buffer.push(project(subcoordinates[j]), "L");
+ buffer.pop();
+ }
+ },
+ Polygon: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;
+ while (++i < n) {
+ subcoordinates = coordinates[i];
+ j = -1;
+ if ((m = subcoordinates.length - 1) > 0) {
+ buffer.push("M");
+ while (++j < m) buffer.push(project(subcoordinates[j]), "L");
+ buffer[buffer.length - 1] = "Z";
+ }
+ }
+ },
+ MultiPolygon: function(o) {
+ var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m, subsubcoordinates, k, p;
+ while (++i < n) {
+ subcoordinates = coordinates[i];
+ j = -1;
+ m = subcoordinates.length;
+ while (++j < m) {
+ subsubcoordinates = subcoordinates[j];
+ k = -1;
+ if ((p = subsubcoordinates.length - 1) > 0) {
+ buffer.push("M");
+ while (++k < p) buffer.push(project(subsubcoordinates[k]), "L");
+ buffer[buffer.length - 1] = "Z";
+ }
+ }
+ }
+ },
+ GeometryCollection: function(o) {
+ var geometries = o.geometries, i = -1, n = geometries.length;
+ while (++i < n) buffer.push(pathType(geometries[i]));
+ }
+ });
+ var areaType = path.area = d3_geo_type({
+ FeatureCollection: function(o) {
+ var area = 0, features = o.features, i = -1, n = features.length;
+ while (++i < n) area += areaType(features[i]);
+ return area;
+ },
+ Feature: function(o) {
+ return areaType(o.geometry);
+ },
+ Polygon: function(o) {
+ return polygonArea(o.coordinates);
+ },
+ MultiPolygon: function(o) {
+ var sum = 0, coordinates = o.coordinates, i = -1, n = coordinates.length;
+ while (++i < n) sum += polygonArea(coordinates[i]);
+ return sum;
+ },
+ GeometryCollection: function(o) {
+ var sum = 0, geometries = o.geometries, i = -1, n = geometries.length;
+ while (++i < n) sum += areaType(geometries[i]);
+ return sum;
+ }
+ }, 0);
+ var centroidType = path.centroid = d3_geo_type({
+ Feature: function(o) {
+ return centroidType(o.geometry);
+ },
+ Polygon: function(o) {
+ var centroid = polygonCentroid(o.coordinates);
+ return [ centroid[0] / centroid[2], centroid[1] / centroid[2] ];
+ },
+ MultiPolygon: function(o) {
+ var area = 0, coordinates = o.coordinates, centroid, x = 0, y = 0, z = 0, i = -1, n = coordinates.length;
+ while (++i < n) {
+ centroid = polygonCentroid(coordinates[i]);
+ x += centroid[0];
+ y += centroid[1];
+ z += centroid[2];
+ }
+ return [ x / z, y / z ];
+ }
+ });
+ path.projection = function(x) {
+ projection = x;
+ return path;
+ };
+ path.pointRadius = function(x) {
+ if (typeof x === "function") pointRadius = x; else {
+ pointRadius = +x;
+ pointCircle = d3_path_circle(pointRadius);
+ }
+ return path;
+ };
+ return path;
+ };
+ d3.geo.bounds = function(feature) {
+ var left = Infinity, bottom = Infinity, right = -Infinity, top = -Infinity;
+ d3_geo_bounds(feature, function(x, y) {
+ if (x < left) left = x;
+ if (x > right) right = x;
+ if (y < bottom) bottom = y;
+ if (y > top) top = y;
+ });
+ return [ [ left, bottom ], [ right, top ] ];
+ };
+ var d3_geo_boundsTypes = {
+ Feature: d3_geo_boundsFeature,
+ FeatureCollection: d3_geo_boundsFeatureCollection,
+ GeometryCollection: d3_geo_boundsGeometryCollection,
+ LineString: d3_geo_boundsLineString,
+ MultiLineString: d3_geo_boundsMultiLineString,
+ MultiPoint: d3_geo_boundsLineString,
+ MultiPolygon: d3_geo_boundsMultiPolygon,
+ Point: d3_geo_boundsPoint,
+ Polygon: d3_geo_boundsPolygon
+ };
+ d3.geo.circle = function() {
+ function circle() {}
+ function visible(point) {
+ return arc.distance(point) < radians;
+ }
+ function clip(coordinates) {
+ var i = -1, n = coordinates.length, clipped = [], p0, p1, p2, d0, d1;
+ while (++i < n) {
+ d1 = arc.distance(p2 = coordinates[i]);
+ if (d1 < radians) {
+ if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));
+ clipped.push(p2);
+ p0 = p1 = null;
+ } else {
+ p1 = p2;
+ if (!p0 && clipped.length) {
+ clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0)));
+ p0 = p1;
+ }
+ }
+ d0 = d1;
+ }
+ p0 = coordinates[0];
+ p1 = clipped[0];
+ if (p1 && p2[0] === p0[0] && p2[1] === p0[1] && !(p2[0] === p1[0] && p2[1] === p1[1])) {
+ clipped.push(p1);
+ }
+ return resample(clipped);
+ }
+ function resample(coordinates) {
+ var i = 0, n = coordinates.length, j, m, resampled = n ? [ coordinates[0] ] : coordinates, resamples, origin = arc.source();
+ while (++i < n) {
+ resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates;
+ for (j = 0, m = resamples.length; ++j < m; ) resampled.push(resamples[j]);
+ }
+ arc.source(origin);
+ return resampled;
+ }
+ var origin = [ 0, 0 ], degrees = 90 - .01, radians = degrees * d3_geo_radians, arc = d3.geo.greatArc().source(origin).target(d3_identity);
+ circle.clip = function(d) {
+ if (typeof origin === "function") arc.source(origin.apply(this, arguments));
+ return clipType(d) || null;
+ };
+ var clipType = d3_geo_type({
+ FeatureCollection: function(o) {
+ var features = o.features.map(clipType).filter(d3_identity);
+ return features && (o = Object.create(o), o.features = features, o);
+ },
+ Feature: function(o) {
+ var geometry = clipType(o.geometry);
+ return geometry && (o = Object.create(o), o.geometry = geometry, o);
+ },
+ Point: function(o) {
+ return visible(o.coordinates) && o;
+ },
+ MultiPoint: function(o) {
+ var coordinates = o.coordinates.filter(visible);
+ return coordinates.length && {
+ type: o.type,
+ coordinates: coordinates
+ };
+ },
+ LineString: function(o) {
+ var coordinates = clip(o.coordinates);
+ return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+ MultiLineString: function(o) {
+ var coordinates = o.coordinates.map(clip).filter(function(d) {
+ return d.length;
+ });
+ return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+ Polygon: function(o) {
+ var coordinates = o.coordinates.map(clip);
+ return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+ MultiPolygon: function(o) {
+ var coordinates = o.coordinates.map(function(d) {
+ return d.map(clip);
+ }).filter(function(d) {
+ return d[0].length;
+ });
+ return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+ GeometryCollection: function(o) {
+ var geometries = o.geometries.map(clipType).filter(d3_identity);
+ return geometries.length && (o = Object.create(o), o.geometries = geometries, o);
+ }
+ });
+ circle.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ if (typeof origin !== "function") arc.source(origin);
+ return circle;
+ };
+ circle.angle = function(x) {
+ if (!arguments.length) return degrees;
+ radians = (degrees = +x) * d3_geo_radians;
+ return circle;
+ };
+ return d3.rebind(circle, arc, "precision");
+ };
+ d3.geo.greatArc = function() {
+ function greatArc() {
+ var d = greatArc.distance.apply(this, arguments), t = 0, dt = precision / d, coordinates = [ p0 ];
+ while ((t += dt) < 1) coordinates.push(interpolate(t));
+ coordinates.push(p1);
+ return {
+ type: "LineString",
+ coordinates: coordinates
+ };
+ }
+ var source = d3_geo_greatArcSource, p0, target = d3_geo_greatArcTarget, p1, precision = 6 * d3_geo_radians, interpolate = d3_geo_greatArcInterpolator();
+ greatArc.distance = function() {
+ if (typeof source === "function") interpolate.source(p0 = source.apply(this, arguments));
+ if (typeof target === "function") interpolate.target(p1 = target.apply(this, arguments));
+ return interpolate.distance();
+ };
+ greatArc.source = function(_) {
+ if (!arguments.length) return source;
+ source = _;
+ if (typeof source !== "function") interpolate.source(p0 = source);
+ return greatArc;
+ };
+ greatArc.target = function(_) {
+ if (!arguments.length) return target;
+ target = _;
+ if (typeof target !== "function") interpolate.target(p1 = target);
+ return greatArc;
+ };
+ greatArc.precision = function(_) {
+ if (!arguments.length) return precision / d3_geo_radians;
+ precision = _ * d3_geo_radians;
+ return greatArc;
+ };
+ return greatArc;
+ };
+ d3.geo.greatCircle = d3.geo.circle;
+ d3.geom = {};
+ d3.geom.contour = function(grid, start) {
+ var s = start || d3_geom_contourStart(grid), c = [], x = s[0], y = s[1], dx = 0, dy = 0, pdx = NaN, pdy = NaN, i = 0;
+ do {
+ i = 0;
+ if (grid(x - 1, y - 1)) i += 1;
+ if (grid(x, y - 1)) i += 2;
+ if (grid(x - 1, y)) i += 4;
+ if (grid(x, y)) i += 8;
+ if (i === 6) {
+ dx = pdy === -1 ? -1 : 1;
+ dy = 0;
+ } else if (i === 9) {
+ dx = 0;
+ dy = pdx === 1 ? -1 : 1;
+ } else {
+ dx = d3_geom_contourDx[i];
+ dy = d3_geom_contourDy[i];
+ }
+ if (dx != pdx && dy != pdy) {
+ c.push([ x, y ]);
+ pdx = dx;
+ pdy = dy;
+ }
+ x += dx;
+ y += dy;
+ } while (s[0] != x || s[1] != y);
+ return c;
+ };
+ var d3_geom_contourDx = [ 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 0, 0, -1, 0, -1, NaN ], d3_geom_contourDy = [ 0, -1, 0, 0, 0, -1, 0, 0, 1, -1, 1, 1, 0, -1, 0, NaN ];
+ d3.geom.hull = function(vertices) {
+ if (vertices.length < 3) return [];
+ var len = vertices.length, plen = len - 1, points = [], stack = [], i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
+ for (i = 1; i < len; ++i) {
+ if (vertices[i][1] < vertices[h][1]) {
+ h = i;
+ } else if (vertices[i][1] == vertices[h][1]) {
+ h = vertices[i][0] < vertices[h][0] ? i : h;
+ }
+ }
+ for (i = 0; i < len; ++i) {
+ if (i === h) continue;
+ y1 = vertices[i][1] - vertices[h][1];
+ x1 = vertices[i][0] - vertices[h][0];
+ points.push({
+ angle: Math.atan2(y1, x1),
+ index: i
+ });
+ }
+ points.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ a = points[0].angle;
+ v = points[0].index;
+ u = 0;
+ for (i = 1; i < plen; ++i) {
+ j = points[i].index;
+ if (a == points[i].angle) {
+ x1 = vertices[v][0] - vertices[h][0];
+ y1 = vertices[v][1] - vertices[h][1];
+ x2 = vertices[j][0] - vertices[h][0];
+ y2 = vertices[j][1] - vertices[h][1];
+ if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) {
+ points[i].index = -1;
+ } else {
+ points[u].index = -1;
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ } else {
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ }
+ stack.push(h);
+ for (i = 0, j = 0; i < 2; ++j) {
+ if (points[j].index !== -1) {
+ stack.push(points[j].index);
+ i++;
+ }
+ }
+ sp = stack.length;
+ for (; j < plen; ++j) {
+ if (points[j].index === -1) continue;
+ while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) {
+ --sp;
+ }
+ stack[sp++] = points[j].index;
+ }
+ var poly = [];
+ for (i = 0; i < sp; ++i) {
+ poly.push(vertices[stack[i]]);
+ }
+ return poly;
+ };
+ d3.geom.polygon = function(coordinates) {
+ coordinates.area = function() {
+ var i = 0, n = coordinates.length, a = coordinates[n - 1][0] * coordinates[0][1], b = coordinates[n - 1][1] * coordinates[0][0];
+ while (++i < n) {
+ a += coordinates[i - 1][0] * coordinates[i][1];
+ b += coordinates[i - 1][1] * coordinates[i][0];
+ }
+ return (b - a) * .5;
+ };
+ coordinates.centroid = function(k) {
+ var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c;
+ if (!arguments.length) k = -1 / (6 * coordinates.area());
+ while (++i < n) {
+ a = b;
+ b = coordinates[i];
+ c = a[0] * b[1] - b[0] * a[1];
+ x += (a[0] + b[0]) * c;
+ y += (a[1] + b[1]) * c;
+ }
+ return [ x * k, y * k ];
+ };
+ coordinates.clip = function(subject) {
+ var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d;
+ while (++i < n) {
+ input = subject.slice();
+ subject.length = 0;
+ b = coordinates[i];
+ c = input[(m = input.length) - 1];
+ j = -1;
+ while (++j < m) {
+ d = input[j];
+ if (d3_geom_polygonInside(d, a, b)) {
+ if (!d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ subject.push(d);
+ } else if (d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ c = d;
+ }
+ a = b;
+ }
+ return subject;
+ };
+ return coordinates;
+ };
+ d3.geom.voronoi = function(vertices) {
+ var polygons = vertices.map(function() {
+ return [];
+ });
+ d3_voronoi_tessellate(vertices, function(e) {
+ var s1, s2, x1, x2, y1, y2;
+ if (e.a === 1 && e.b >= 0) {
+ s1 = e.ep.r;
+ s2 = e.ep.l;
+ } else {
+ s1 = e.ep.l;
+ s2 = e.ep.r;
+ }
+ if (e.a === 1) {
+ y1 = s1 ? s1.y : -1e6;
+ x1 = e.c - e.b * y1;
+ y2 = s2 ? s2.y : 1e6;
+ x2 = e.c - e.b * y2;
+ } else {
+ x1 = s1 ? s1.x : -1e6;
+ y1 = e.c - e.a * x1;
+ x2 = s2 ? s2.x : 1e6;
+ y2 = e.c - e.a * x2;
+ }
+ var v1 = [ x1, y1 ], v2 = [ x2, y2 ];
+ polygons[e.region.l.index].push(v1, v2);
+ polygons[e.region.r.index].push(v1, v2);
+ });
+ return polygons.map(function(polygon, i) {
+ var cx = vertices[i][0], cy = vertices[i][1];
+ polygon.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ return polygon.sort(function(a, b) {
+ return a.angle - b.angle;
+ }).filter(function(d, i) {
+ return !i || d.angle - polygon[i - 1].angle > 1e-10;
+ });
+ });
+ };
+ var d3_voronoi_opposite = {
+ l: "r",
+ r: "l"
+ };
+ d3.geom.delaunay = function(vertices) {
+ var edges = vertices.map(function() {
+ return [];
+ }), triangles = [];
+ d3_voronoi_tessellate(vertices, function(e) {
+ edges[e.region.l.index].push(vertices[e.region.r.index]);
+ });
+ edges.forEach(function(edge, i) {
+ var v = vertices[i], cx = v[0], cy = v[1];
+ edge.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ edge.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ for (var j = 0, m = edge.length - 1; j < m; j++) {
+ triangles.push([ v, edge[j], edge[j + 1] ]);
+ }
+ });
+ return triangles;
+ };
+ d3.geom.quadtree = function(points, x1, y1, x2, y2) {
+ function insert(n, p, x1, y1, x2, y2) {
+ if (isNaN(p.x) || isNaN(p.y)) return;
+ if (n.leaf) {
+ var v = n.point;
+ if (v) {
+ if (Math.abs(v.x - p.x) + Math.abs(v.y - p.y) < .01) {
+ insertChild(n, p, x1, y1, x2, y2);
+ } else {
+ n.point = null;
+ insertChild(n, v, x1, y1, x2, y2);
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ } else {
+ n.point = p;
+ }
+ } else {
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ }
+ function insertChild(n, p, x1, y1, x2, y2) {
+ var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = p.x >= sx, bottom = p.y >= sy, i = (bottom << 1) + right;
+ n.leaf = false;
+ n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
+ if (right) x1 = sx; else x2 = sx;
+ if (bottom) y1 = sy; else y2 = sy;
+ insert(n, p, x1, y1, x2, y2);
+ }
+ var p, i = -1, n = points.length;
+ if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint);
+ if (arguments.length < 5) {
+ if (arguments.length === 3) {
+ y2 = x2 = y1;
+ y1 = x1;
+ } else {
+ x1 = y1 = Infinity;
+ x2 = y2 = -Infinity;
+ while (++i < n) {
+ p = points[i];
+ if (p.x < x1) x1 = p.x;
+ if (p.y < y1) y1 = p.y;
+ if (p.x > x2) x2 = p.x;
+ if (p.y > y2) y2 = p.y;
+ }
+ var dx = x2 - x1, dy = y2 - y1;
+ if (dx > dy) y2 = y1 + dx; else x2 = x1 + dy;
+ }
+ }
+ var root = d3_geom_quadtreeNode();
+ root.add = function(p) {
+ insert(root, p, x1, y1, x2, y2);
+ };
+ root.visit = function(f) {
+ d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
+ };
+ points.forEach(root.add);
+ return root;
+ };
+ d3.time = {};
+ var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
+ d3_time_utc.prototype = {
+ getDate: function() {
+ return this._.getUTCDate();
+ },
+ getDay: function() {
+ return this._.getUTCDay();
+ },
+ getFullYear: function() {
+ return this._.getUTCFullYear();
+ },
+ getHours: function() {
+ return this._.getUTCHours();
+ },
+ getMilliseconds: function() {
+ return this._.getUTCMilliseconds();
+ },
+ getMinutes: function() {
+ return this._.getUTCMinutes();
+ },
+ getMonth: function() {
+ return this._.getUTCMonth();
+ },
+ getSeconds: function() {
+ return this._.getUTCSeconds();
+ },
+ getTime: function() {
+ return this._.getTime();
+ },
+ getTimezoneOffset: function() {
+ return 0;
+ },
+ valueOf: function() {
+ return this._.valueOf();
+ },
+ setDate: function() {
+ d3_time_prototype.setUTCDate.apply(this._, arguments);
+ },
+ setDay: function() {
+ d3_time_prototype.setUTCDay.apply(this._, arguments);
+ },
+ setFullYear: function() {
+ d3_time_prototype.setUTCFullYear.apply(this._, arguments);
+ },
+ setHours: function() {
+ d3_time_prototype.setUTCHours.apply(this._, arguments);
+ },
+ setMilliseconds: function() {
+ d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);
+ },
+ setMinutes: function() {
+ d3_time_prototype.setUTCMinutes.apply(this._, arguments);
+ },
+ setMonth: function() {
+ d3_time_prototype.setUTCMonth.apply(this._, arguments);
+ },
+ setSeconds: function() {
+ d3_time_prototype.setUTCSeconds.apply(this._, arguments);
+ },
+ setTime: function() {
+ d3_time_prototype.setTime.apply(this._, arguments);
+ }
+ };
+ var d3_time_prototype = Date.prototype;
+ var d3_time_formatDateTime = "%a %b %e %H:%M:%S %Y", d3_time_formatDate = "%m/%d/%y", d3_time_formatTime = "%H:%M:%S";
+ var d3_time_days = d3_time_daySymbols, d3_time_dayAbbreviations = d3_time_days.map(d3_time_formatAbbreviate), d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = d3_time_months.map(d3_time_formatAbbreviate);
+ d3.time.format = function(template) {
+ function format(date) {
+ var string = [], i = -1, j = 0, c, f;
+ while (++i < n) {
+ if (template.charCodeAt(i) == 37) {
+ string.push(template.substring(j, i), (f = d3_time_formats[c = template.charAt(++i)]) ? f(date) : c);
+ j = i + 1;
+ }
+ }
+ string.push(template.substring(j, i));
+ return string.join("");
+ }
+ var n = template.length;
+ format.parse = function(string) {
+ var d = {
+ y: 1900,
+ m: 0,
+ d: 1,
+ H: 0,
+ M: 0,
+ S: 0,
+ L: 0
+ }, i = d3_time_parse(d, template, string, 0);
+ if (i != string.length) return null;
+ if ("p" in d) d.H = d.H % 12 + d.p * 12;
+ var date = new d3_time;
+ date.setFullYear(d.y, d.m, d.d);
+ date.setHours(d.H, d.M, d.S, d.L);
+ return date;
+ };
+ format.toString = function() {
+ return template;
+ };
+ return format;
+ };
+ var d3_time_zfill2 = d3.format("02d"), d3_time_zfill3 = d3.format("03d"), d3_time_zfill4 = d3.format("04d"), d3_time_sfill2 = d3.format("2d");
+ var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations);
+ var d3_time_formats = {
+ a: function(d) {
+ return d3_time_dayAbbreviations[d.getDay()];
+ },
+ A: function(d) {
+ return d3_time_days[d.getDay()];
+ },
+ b: function(d) {
+ return d3_time_monthAbbreviations[d.getMonth()];
+ },
+ B: function(d) {
+ return d3_time_months[d.getMonth()];
+ },
+ c: d3.time.format(d3_time_formatDateTime),
+ d: function(d) {
+ return d3_time_zfill2(d.getDate());
+ },
+ e: function(d) {
+ return d3_time_sfill2(d.getDate());
+ },
+ H: function(d) {
+ return d3_time_zfill2(d.getHours());
+ },
+ I: function(d) {
+ return d3_time_zfill2(d.getHours() % 12 || 12);
+ },
+ j: function(d) {
+ return d3_time_zfill3(1 + d3.time.dayOfYear(d));
+ },
+ L: function(d) {
+ return d3_time_zfill3(d.getMilliseconds());
+ },
+ m: function(d) {
+ return d3_time_zfill2(d.getMonth() + 1);
+ },
+ M: function(d) {
+ return d3_time_zfill2(d.getMinutes());
+ },
+ p: function(d) {
+ return d.getHours() >= 12 ? "PM" : "AM";
+ },
+ S: function(d) {
+ return d3_time_zfill2(d.getSeconds());
+ },
+ U: function(d) {
+ return d3_time_zfill2(d3.time.sundayOfYear(d));
+ },
+ w: function(d) {
+ return d.getDay();
+ },
+ W: function(d) {
+ return d3_time_zfill2(d3.time.mondayOfYear(d));
+ },
+ x: d3.time.format(d3_time_formatDate),
+ X: d3.time.format(d3_time_formatTime),
+ y: function(d) {
+ return d3_time_zfill2(d.getFullYear() % 100);
+ },
+ Y: function(d) {
+ return d3_time_zfill4(d.getFullYear() % 1e4);
+ },
+ Z: d3_time_zone,
+ "%": function(d) {
+ return "%";
+ }
+ };
+ var d3_time_parsers = {
+ a: d3_time_parseWeekdayAbbrev,
+ A: d3_time_parseWeekday,
+ b: d3_time_parseMonthAbbrev,
+ B: d3_time_parseMonth,
+ c: d3_time_parseLocaleFull,
+ d: d3_time_parseDay,
+ e: d3_time_parseDay,
+ H: d3_time_parseHour24,
+ I: d3_time_parseHour24,
+ L: d3_time_parseMilliseconds,
+ m: d3_time_parseMonthNumber,
+ M: d3_time_parseMinutes,
+ p: d3_time_parseAmPm,
+ S: d3_time_parseSeconds,
+ x: d3_time_parseLocaleDate,
+ X: d3_time_parseLocaleTime,
+ y: d3_time_parseYear,
+ Y: d3_time_parseFullYear
+ };
+ var d3_time_numberRe = /^\s*\d+/;
+ var d3_time_amPmLookup = d3.map({
+ am: 0,
+ pm: 1
+ });
+ d3.time.format.utc = function(template) {
+ function format(date) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time;
+ utc._ = date;
+ return local(utc);
+ } finally {
+ d3_time = Date;
+ }
+ }
+ var local = d3.time.format(template);
+ format.parse = function(string) {
+ try {
+ d3_time = d3_time_utc;
+ var date = local.parse(string);
+ return date && date._;
+ } finally {
+ d3_time = Date;
+ }
+ };
+ format.toString = local.toString;
+ return format;
+ };
+ var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
+ d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso;
+ d3_time_formatIsoNative.parse = function(string) {
+ var date = new Date(string);
+ return isNaN(date) ? null : date;
+ };
+ d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
+ d3.time.second = d3_time_interval(function(date) {
+ return new d3_time(Math.floor(date / 1e3) * 1e3);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 1e3);
+ }, function(date) {
+ return date.getSeconds();
+ });
+ d3.time.seconds = d3.time.second.range;
+ d3.time.seconds.utc = d3.time.second.utc.range;
+ d3.time.minute = d3_time_interval(function(date) {
+ return new d3_time(Math.floor(date / 6e4) * 6e4);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 6e4);
+ }, function(date) {
+ return date.getMinutes();
+ });
+ d3.time.minutes = d3.time.minute.range;
+ d3.time.minutes.utc = d3.time.minute.utc.range;
+ d3.time.hour = d3_time_interval(function(date) {
+ var timezone = date.getTimezoneOffset() / 60;
+ return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 36e5);
+ }, function(date) {
+ return date.getHours();
+ });
+ d3.time.hours = d3.time.hour.range;
+ d3.time.hours.utc = d3.time.hour.utc.range;
+ d3.time.day = d3_time_interval(function(date) {
+ var day = new d3_time(1970, 0);
+ day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
+ return day;
+ }, function(date, offset) {
+ date.setDate(date.getDate() + offset);
+ }, function(date) {
+ return date.getDate() - 1;
+ });
+ d3.time.days = d3.time.day.range;
+ d3.time.days.utc = d3.time.day.utc.range;
+ d3.time.dayOfYear = function(date) {
+ var year = d3.time.year(date);
+ return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
+ };
+ d3_time_daySymbols.forEach(function(day, i) {
+ day = day.toLowerCase();
+ i = 7 - i;
+ var interval = d3.time[day] = d3_time_interval(function(date) {
+ (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
+ return date;
+ }, function(date, offset) {
+ date.setDate(date.getDate() + Math.floor(offset) * 7);
+ }, function(date) {
+ var day = d3.time.year(date).getDay();
+ return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
+ });
+ d3.time[day + "s"] = interval.range;
+ d3.time[day + "s"].utc = interval.utc.range;
+ d3.time[day + "OfYear"] = function(date) {
+ var day = d3.time.year(date).getDay();
+ return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7);
+ };
+ });
+ d3.time.week = d3.time.sunday;
+ d3.time.weeks = d3.time.sunday.range;
+ d3.time.weeks.utc = d3.time.sunday.utc.range;
+ d3.time.weekOfYear = d3.time.sundayOfYear;
+ d3.time.month = d3_time_interval(function(date) {
+ date = d3.time.day(date);
+ date.setDate(1);
+ return date;
+ }, function(date, offset) {
+ date.setMonth(date.getMonth() + offset);
+ }, function(date) {
+ return date.getMonth();
+ });
+ d3.time.months = d3.time.month.range;
+ d3.time.months.utc = d3.time.month.utc.range;
+ d3.time.year = d3_time_interval(function(date) {
+ date = d3.time.day(date);
+ date.setMonth(0, 1);
+ return date;
+ }, function(date, offset) {
+ date.setFullYear(date.getFullYear() + offset);
+ }, function(date) {
+ return date.getFullYear();
+ });
+ d3.time.years = d3.time.year.range;
+ d3.time.years.utc = d3.time.year.utc.range;
+ var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];
+ var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ];
+ var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), function(d) {
+ return true;
+ } ], [ d3.time.format("%B"), function(d) {
+ return d.getMonth();
+ } ], [ d3.time.format("%b %d"), function(d) {
+ return d.getDate() != 1;
+ } ], [ d3.time.format("%a %d"), function(d) {
+ return d.getDay() && d.getDate() != 1;
+ } ], [ d3.time.format("%I %p"), function(d) {
+ return d.getHours();
+ } ], [ d3.time.format("%I:%M"), function(d) {
+ return d.getMinutes();
+ } ], [ d3.time.format(":%S"), function(d) {
+ return d.getSeconds();
+ } ], [ d3.time.format(".%L"), function(d) {
+ return d.getMilliseconds();
+ } ] ];
+ var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
+ d3_time_scaleLocalMethods.year = function(extent, m) {
+ return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);
+ };
+ d3.time.scale = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
+ };
+ var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
+ return [ m[0].utc, m[1] ];
+ });
+ var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), function(d) {
+ return true;
+ } ], [ d3.time.format.utc("%B"), function(d) {
+ return d.getUTCMonth();
+ } ], [ d3.time.format.utc("%b %d"), function(d) {
+ return d.getUTCDate() != 1;
+ } ], [ d3.time.format.utc("%a %d"), function(d) {
+ return d.getUTCDay() && d.getUTCDate() != 1;
+ } ], [ d3.time.format.utc("%I %p"), function(d) {
+ return d.getUTCHours();
+ } ], [ d3.time.format.utc("%I:%M"), function(d) {
+ return d.getUTCMinutes();
+ } ], [ d3.time.format.utc(":%S"), function(d) {
+ return d.getUTCSeconds();
+ } ], [ d3.time.format.utc(".%L"), function(d) {
+ return d.getUTCMilliseconds();
+ } ] ];
+ var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
+ d3_time_scaleUTCMethods.year = function(extent, m) {
+ return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);
+ };
+ d3.time.scale.utc = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
+ };
+})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.min.js
new file mode 100644
index 00000000..cc47f1ea
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.min.js
@@ -0,0 +1,4 @@
+(function(){function e(e,t){try{for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}catch(r){e.prototype=t}}function t(e){var t=-1,n=e.length,r=[];while(++t<n)r.push(e[t]);return r}function n(e){return Array.prototype.slice.call(e)}function r(){}function i(e){return e}function s(){return this}function o(){return!0}function u(e){return typeof e=="function"?e:function(){return e}}function a(e,t,n){return function(){var r=n.apply(t,arguments);return arguments.length?e:r}}function f(e){return e!=null&&!isNaN(e)}function l(e){return e.length}function c(e){return e==null}function h(e){return e.trim().replace(/\s+/g," ")}function p(e){var t=1;while(e*t%1)t*=10;return t}function d(){}function v(e){function t(){var t=n,r=-1,i=t.length,s;while(++r<i)(s=t[r].on)&&s.apply(this,arguments);return e}var n=[],i=new r;return t.on=function(t,r){var s=i.get(t),o;return arguments.length<2?s&&s.on:(s&&(s.on=null,n=n.slice(0,o=n.indexOf(s)).concat(n.slice(o+1)),i.remove(t)),r&&n.push(i.set(t,{on:r})),e)},t}function m(e,t){return t-(e?1+Math.floor(Math.log(e+Math.pow(10,1+Math.floor(Math.log(e)/Math.LN10)-t))/Math.LN10):1)}function g(e){return e+""}function y(e){var t=e.lastIndexOf("."),n=t>=0?e.substring(t):(t=e.length,""),r=[];while(t>0)r.push(e.substring(t-=3,t+3));return r.reverse().join(",")+n}function b(e,t){var n=Math.pow(10,Math.abs(8-t)*3);return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}function w(e){return function(t){return t<=0?0:t>=1?1:e(t)}}function E(e){return function(t){return 1-e(1-t)}}function S(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function x(e){return e}function T(e){return function(t){return Math.pow(t,e)}}function N(e){return 1-Math.cos(e*Math.PI/2)}function C(e){return Math.pow(2,10*(e-1))}function k(e){return 1-Math.sqrt(1-e*e)}function L(e,t){var n;return arguments.length<2&&(t=.45),arguments.length<1?(e=1,n=t/4):n=t/(2*Math.PI)*Math.asin(1/e),function(r){return 1+e*Math.pow(2,10*-r)*Math.sin((r-n)*2*Math.PI/t)}}function A(e){return e||(e=1.70158),function(t){return t*t*((e+1)*t-e)}}function O(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function M(){d3.event.stopPropagation(),d3.event.preventDefault()}function _(){var e=d3.event,t;while(t=e.sourceEvent)e=t;return e}function D(e){var t=new d,n=0,r=arguments.length;while(++n<r)t[arguments[n]]=v(t);return t.of=function(n,r){return function(i){try{var s=i.sourceEvent=d3.event;i.target=e,d3.event=i,t[i.type].apply(n,r)}finally{d3.event=s}}},t}function P(e){var t=[e.a,e.b],n=[e.c,e.d],r=B(t),i=H(t,n),s=B(j(n,t,-i))||0;t[0]*n[1]<n[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,i*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-n[0],n[1]))*fs,this.translate=[e.e,e.f],this.scale=[r,s],this.skew=s?Math.atan2(i,s)*fs:0}function H(e,t){return e[0]*t[0]+e[1]*t[1]}function B(e){var t=Math.sqrt(H(e,e));return t&&(e[0]/=t,e[1]/=t),t}function j(e,t,n){return e[0]+=n*t[0],e[1]+=n*t[1],e}function F(e){return e=="transform"?d3.interpolateTransform:d3.interpolate}function I(e,t){return t=t-(e=+e)?1/(t-e):0,function(n){return(n-e)*t}}function q(e,t){return t=t-(e=+e)?1/(t-e):0,function(n){return Math.max(0,Math.min(1,(n-e)*t))}}function R(e,t,n){return new U(e,t,n)}function U(e,t,n){this.r=e,this.g=t,this.b=n}function z(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function W(e,t,n){var r=0,i=0,s=0,o,u,a;o=/([a-z]+)\((.*)\)/i.exec(e);if(o){u=o[2].split(",");switch(o[1]){case"hsl":return n(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(J(u[0]),J(u[1]),J(u[2]))}}return(a=hs.get(e))?t(a.r,a.g,a.b):(e!=null&&e.charAt(0)==="#"&&(e.length===4?(r=e.charAt(1),r+=r,i=e.charAt(2),i+=i,s=e.charAt(3),s+=s):e.length===7&&(r=e.substring(1,3),i=e.substring(3,5),s=e.substring(5,7)),r=parseInt(r,16),i=parseInt(i,16),s=parseInt(s,16)),t(r,i,s))}function X(e,t,n){var r=Math.min(e/=255,t/=255,n/=255),i=Math.max(e,t,n),s=i-r,o,u,a=(i+r)/2;return s?(u=a<.5?s/(i+r):s/(2-i-r),e==i?o=(t-n)/s+(t<n?6:0):t==i?o=(n-e)/s+2:o=(e-t)/s+4,o*=60):u=o=0,K(o,u,a)}function V(e,t,n){e=$(e),t=$(t),n=$(n);var r=ot((.4124564*e+.3575761*t+.1804375*n)/ds),i=ot((.2126729*e+.7151522*t+.072175*n)/vs),s=ot((.0193339*e+.119192*t+.9503041*n)/ms);return tt(116*i-16,500*(r-i),200*(i-s))}function $(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function J(e){var t=parseFloat(e);return e.charAt(e.length-1)==="%"?Math.round(t*2.55):t}function K(e,t,n){return new Q(e,t,n)}function Q(e,t,n){this.h=e,this.s=t,this.l=n}function G(e,t,n){function r(e){return e>360?e-=360:e<0&&(e+=360),e<60?s+(o-s)*e/60:e<180?o:e<240?s+(o-s)*(240-e)/60:s}function i(e){return Math.round(r(e)*255)}var s,o;return e%=360,e<0&&(e+=360),t=t<0?0:t>1?1:t,n=n<0?0:n>1?1:n,o=n<=.5?n*(1+t):n+t-n*t,s=2*n-o,R(i(e+120),i(e),i(e-120))}function Y(e,t,n){return new Z(e,t,n)}function Z(e,t,n){this.h=e,this.c=t,this.l=n}function et(e,t,n){return tt(n,Math.cos(e*=Math.PI/180)*t,Math.sin(e)*t)}function tt(e,t,n){return new nt(e,t,n)}function nt(e,t,n){this.l=e,this.a=t,this.b=n}function rt(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;return i=st(i)*ds,r=st(r)*vs,s=st(s)*ms,R(ut(3.2404542*i-1.5371385*r-.4985314*s),ut(-0.969266*i+1.8760108*r+.041556*s),ut(.0556434*i-.2040259*r+1.0572252*s))}function it(e,t,n){return Y(Math.atan2(n,t)/Math.PI*180,Math.sqrt(t*t+n*n),e)}function st(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function ot(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function ut(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function at(e){return Ki(e,Ss),e}function ft(e){return function(){return gs(e,this)}}function lt(e){return function(){return ys(e,this)}}function ct(e,t){function n(){this.removeAttribute(e)}function r(){this.removeAttributeNS(e.space,e.local)}function i(){this.setAttribute(e,t)}function s(){this.setAttributeNS(e.space,e.local,t)}function o(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}function u(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}return e=d3.ns.qualify(e),t==null?e.local?r:n:typeof t=="function"?e.local?u:o:e.local?s:i}function ht(e){return new RegExp("(?:^|\\s+)"+d3.requote(e)+"(?:\\s+|$)","g")}function pt(e,t){function n(){var n=-1;while(++n<i)e[n](this,t)}function r(){var n=-1,r=t.apply(this,arguments);while(++n<i)e[n](this,r)}e=e.trim().split(/\s+/).map(dt);var i=e.length;return typeof t=="function"?r:n}function dt(e){var t=ht(e);return function(n,r){if(i=n.classList)return r?i.add(e):i.remove(e);var i=n.className,s=i.baseVal!=null,o=s?i.baseVal:i;r?(t.lastIndex=0,t.test(o)||(o=h(o+" "+e),s?i.baseVal=o:n.className=o)):o&&(o=h(o.replace(t," ")),s?i.baseVal=o:n.className=o)}}function vt(e,t,n){function r(){this.style.removeProperty(e)}function i(){this.style.setProperty(e,t,n)}function s(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}return t==null?r:typeof t=="function"?s:i}function mt(e,t){function n(){delete this[e]}function r(){this[e]=t}function i(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}return t==null?n:typeof t=="function"?i:r}function gt(e){return{__data__:e}}function yt(e){return function(){return Es(this,e)}}function bt(e){return arguments.length||(e=d3.ascending),function(t,n){return e(t&&t.__data__,n&&n.__data__)}}function wt(e,t,n){function r(){var t=this[s];t&&(this.removeEventListener(e,t,t.$),delete this[s])}function i(){function i(e){var n=d3.event;d3.event=e,u[0]=o.__data__;try{t.apply(o,u)}finally{d3.event=n}}var o=this,u=arguments;r.call(this),this.addEventListener(e,this[s]=i,i.$=n),i._=t}var s="__on"+e,o=e.indexOf(".");return o>0&&(e=e.substring(0,o)),t?i:r}function Et(e,t){for(var n=0,r=e.length;n<r;n++)for(var i=e[n],s=0,o=i.length,u;s<o;s++)(u=i[s])&&t(u,s,n);return e}function St(e){return Ki(e,Ts),e}function xt(e,t,n){Ki(e,Ns);var i=new r,s=d3.dispatch("start","end"),o=Ds;return e.id=t,e.time=n,e.tween=function(t,n){return arguments.length<2?i.get(t):(n==null?i.remove(t):i.set(t,n),e)},e.ease=function(t){return arguments.length?(o=typeof t=="function"?t:d3.ease.apply(d3,arguments),e):o},e.each=function(t,n){return arguments.length<2?Tt.call(e,t):(s.on(t,n),e)},d3.timer(function(r){return Et(e,function(e,u,a){function f(r){return v.active>t?c():(v.active=t,i.forEach(function(t,n){(n=n.call(e,m,u))&&h.push(n)}),s.start.call(e,m,u),l(r)||d3.timer(l,0,n),1)}function l(n){if(v.active!==t)return c();var r=(n-p)/d,i=o(r),a=h.length;while(a>0)h[--a].call(e,i);if(r>=1)return c(),ks=t,s.end.call(e,m,u),ks=0,1}function c(){return--v.count||delete e.__transition__,1}var h=[],p=e.delay,d=e.duration,v=(e=e.node).__transition__||(e.__transition__={active:0,count:0}),m=e.__data__;++v.count,p<=r?f(r):d3.timer(f,p,n)})},0,n),e}function Tt(e){var t=ks,n=Ds,r=Ms,i=_s;return ks=this.id,Ds=this.ease(),Et(this,function(t,n,r){Ms=t.delay,_s=t.duration,e.call(t=t.node,t.__data__,n,r)}),ks=t,Ds=n,Ms=r,_s=i,this}function Nt(e,t,n){return n!=""&&Ps}function Ct(e,t){return d3.tween(e,F(t))}function kt(){var e,t=Date.now(),n=Hs;while(n)e=t-n.then,e>=n.delay&&(n.flush=n.callback(e)),n=n.next;var r=Lt()-t;r>24?(isFinite(r)&&(clearTimeout(js),js=setTimeout(kt,r)),Bs=0):(Bs=1,Fs(kt))}function Lt(){var e=null,t=Hs,n=Infinity;while(t)t.flush?t=e?e.next=t.next:Hs=t.next:(n=Math.min(n,t.then+t.delay),t=(e=t).next);return n}function At(e,t){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();if(Is<0&&(window.scrollX||window.scrollY)){n=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0);var i=n[0][0].getScreenCTM();Is=!i.f&&!i.e,n.remove()}return Is?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}function Ot(){}function Mt(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function _t(e){return e.rangeExtent?e.rangeExtent():Mt(e.range())}function Dt(e,t){var n=0,r=e.length-1,i=e[n],s=e[r],o;s<i&&(o=n,n=r,r=o,o=i,i=s,s=o);if(t=t(s-i))e[n]=t.floor(i),e[r]=t.ceil(s);return e}function Pt(){return Math}function Ht(e,t,n,r){function i(){var i=Math.min(e.length,t.length)>2?Ut:Rt,a=r?q:I;return o=i(e,t,a,n),u=i(t,e,a,d3.interpolate),s}function s(e){return o(e)}var o,u;return s.invert=function(e){return u(e)},s.domain=function(t){return arguments.length?(e=t.map(Number),i()):e},s.range=function(e){return arguments.length?(t=e,i()):t},s.rangeRound=function(e){return s.range(e).interpolate(d3.interpolateRound)},s.clamp=function(e){return arguments.length?(r=e,i()):r},s.interpolate=function(e){return arguments.length?(n=e,i()):n},s.ticks=function(t){return It(e,t)},s.tickFormat=function(t){return qt(e,t)},s.nice=function(){return Dt(e,jt),i()},s.copy=function(){return Ht(e,t,n,r)},i()}function Bt(e,t){return d3.rebind(e,t,"range","rangeRound","interpolate","clamp")}function jt(e){return e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1),e&&{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}}function Ft(e,t){var n=Mt(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;return s<=.15?i*=10:s<=.35?i*=5:s<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+i*.5,n[2]=i,n}function It(e,t){return d3.range.apply(d3,Ft(e,t))}function qt(e,t){return d3.format(",."+Math.max(0,-Math.floor(Math.log(Ft(e,t)[2])/Math.LN10+.01))+"f")}function Rt(e,t,n,r){var i=n(e[0],e[1]),s=r(t[0],t[1]);return function(e){return s(i(e))}}function Ut(e,t,n,r){var i=[],s=[],o=0,u=Math.min(e.length,t.length)-1;e[u]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());while(++o<=u)i.push(n(e[o-1],e[o])),s.push(r(t[o-1],t[o]));return function(t){var n=d3.bisect(e,t,1,u)-1;return s[n](i[n](t))}}function zt(e,t){function n(n){return e(t(n))}var r=t.pow;return n.invert=function(t){return r(e.invert(t))},n.domain=function(i){return arguments.length?(t=i[0]<0?Xt:Wt,r=t.pow,e.domain(i.map(t)),n):e.domain().map(r)},n.nice=function(){return e.domain(Dt(e.domain(),Pt)),n},n.ticks=function(){var n=Mt(e.domain()),i=[];if(n.every(isFinite)){var s=Math.floor(n[0]),o=Math.ceil(n[1]),u=r(n[0]),a=r(n[1]);if(t===Xt){i.push(r(s));for(;s++<o;)for(var f=9;f>0;f--)i.push(r(s)*f)}else{for(;s<o;s++)for(var f=1;f<10;f++)i.push(r(s)*f);i.push(r(s))}for(s=0;i[s]<u;s++);for(o=i.length;i[o-1]>a;o--);i=i.slice(s,o)}return i},n.tickFormat=function(e,i){arguments.length<2&&(i=qs);if(arguments.length<1)return i;var s=Math.max(.1,e/n.ticks().length),o=t===Xt?(u=-1e-12,Math.floor):(u=1e-12,Math.ceil),u;return function(e){return e/r(o(t(e)+u))<=s?i(e):""}},n.copy=function(){return zt(e.copy(),t)},Bt(n,e)}function Wt(e){return Math.log(e<0?0:e)/Math.LN10}function Xt(e){return-Math.log(e>0?0:-e)/Math.LN10}function Vt(e,t){function n(t){return e(r(t))}var r=$t(t),i=$t(1/t);return n.invert=function(t){return i(e.invert(t))},n.domain=function(t){return arguments.length?(e.domain(t.map(r)),n):e.domain().map(i)},n.ticks=function(e){return It(n.domain(),e)},n.tickFormat=function(e){return qt(n.domain(),e)},n.nice=function(){return n.domain(Dt(n.domain(),jt))},n.exponent=function(e){if(!arguments.length)return t;var s=n.domain();return r=$t(t=e),i=$t(1/t),n.domain(s)},n.copy=function(){return Vt(e.copy(),t)},Bt(n,e)}function $t(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Jt(e,t){function n(t){return o[((s.get(t)||s.set(t,e.push(t)))-1)%o.length]}function i(t,n){return d3.range(e.length).map(function(e){return t+n*e})}var s,o,u;return n.domain=function(i){if(!arguments.length)return e;e=[],s=new r;var o=-1,u=i.length,a;while(++o<u)s.has(a=i[o])||s.set(a,e.push(a));return n[t.t].apply(n,t.a)},n.range=function(e){return arguments.length?(o=e,u=0,t={t:"range",a:arguments},n):o},n.rangePoints=function(r,s){arguments.length<2&&(s=0);var a=r[0],f=r[1],l=(f-a)/(Math.max(1,e.length-1)+s);return o=i(e.length<2?(a+f)/2:a+l*s/2,l),u=0,t={t:"rangePoints",a:arguments},n},n.rangeBands=function(r,s,a){arguments.length<2&&(s=0),arguments.length<3&&(a=s);var f=r[1]<r[0],l=r[f-0],c=r[1-f],h=(c-l)/(e.length-s+2*a);return o=i(l+h*a,h),f&&o.reverse(),u=h*(1-s),t={t:"rangeBands",a:arguments},n},n.rangeRoundBands=function(r,s,a){arguments.length<2&&(s=0),arguments.length<3&&(a=s);var f=r[1]<r[0],l=r[f-0],c=r[1-f],h=Math.floor((c-l)/(e.length-s+2*a)),p=c-l-(e.length-s)*h;return o=i(l+Math.round(p/2),h),f&&o.reverse(),u=Math.round(h*(1-s)),t={t:"rangeRoundBands",a:arguments},n},n.rangeBand=function(){return u},n.rangeExtent=function(){return Mt(t.a[0])},n.copy=function(){return Jt(e,t)},n.domain(e)}function Kt(e,t){function n(){var n=0,s=e.length,o=t.length;i=[];while(++n<o)i[n-1]=d3.quantile(e,n/o);return r}function r(e){return isNaN(e=+e)?NaN:t[d3.bisect(i,e)]}var i;return r.domain=function(t){return arguments.length?(e=t.filter(function(e){return!isNaN(e)}).sort(d3.ascending),n()):e},r.range=function(e){return arguments.length?(t=e,n()):t},r.quantiles=function(){return i},r.copy=function(){return Kt(e,t)},n()}function Qt(e,t,n){function r(t){return n[Math.max(0,Math.min(o,Math.floor(s*(t-e))))]}function i(){return s=n.length/(t-e),o=n.length-1,r}var s,o;return r.domain=function(n){return arguments.length?(e=+n[0],t=+n[n.length-1],i()):[e,t]},r.range=function(e){return arguments.length?(n=e,i()):n},r.copy=function(){return Qt(e,t,n)},i()}function Gt(e,t){function n(n){return t[d3.bisect(e,n)]}return n.domain=function(t){return arguments.length?(e=t,n):e},n.range=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return Gt(e,t)},n}function Yt(e){function t(e){return+e}return t.invert=t,t.domain=t.range=function(n){return arguments.length?(e=n.map(t),t):e},t.ticks=function(t){return It(e,t)},t.tickFormat=function(t){return qt(e,t)},t.copy=function(){return Yt(e)},t}function Zt(e){return e.innerRadius}function en(e){return e.outerRadius}function tn(e){return e.startAngle}function nn(e){return e.endAngle}function rn(e){function t(t){function o(){a.push("M",s(e(l),f))}var a=[],l=[],c=-1,h=t.length,p,d=u(n),v=u(r);while(++c<h)i.call(this,p=t[c],c)?l.push([+d.call(this,p,c),+v.call(this,p,c)]):l.length&&(o(),l=[]);return l.length&&o(),a.length?a.join(""):null}var n=sn,r=on,i=o,s=un,a=s.key,f=.7;return t.x=function(e){return arguments.length?(n=e,t):n},t.y=function(e){return arguments.length?(r=e,t):r},t.defined=function(e){return arguments.length?(i=e,t):i},t.interpolate=function(e){return arguments.length?(typeof e=="function"?a=s=e:a=(s=$s.get(e)||un).key,t):a},t.tension=function(e){return arguments.length?(f=e,t):f},t}function sn(e){return e[0]}function on(e){return e[1]}function un(e){return e.join("L")}function an(e){return un(e)+"Z"}function fn(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("V",(r=e[t])[1],"H",r[0]);return i.join("")}function ln(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("H",(r=e[t])[0],"V",r[1]);return i.join("")}function cn(e,t){return e.length<4?un(e):e[1]+dn(e.slice(1,e.length-1),vn(e,t))}function hn(e,t){return e.length<3?un(e):e[0]+dn((e.push(e[0]),e),vn([e[e.length-2]].concat(e,[e[1]]),t))}function pn(e,t,n){return e.length<3?un(e):e[0]+dn(e,vn(e,t))}function dn(e,t){if(t.length<1||e.length!=t.length&&e.length!=t.length+2)return un(e);var n=e.length!=t.length,r="",i=e[0],s=e[1],o=t[0],u=o,a=1;n&&(r+="Q"+(s[0]-o[0]*2/3)+","+(s[1]-o[1]*2/3)+","+s[0]+","+s[1],i=e[1],a=2);if(t.length>1){u=t[1],s=e[a],a++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f<t.length;f++,a++)s=e[a],u=t[f],r+="S"+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1]}if(n){var l=e[a];r+="Q"+(s[0]+u[0]*2/3)+","+(s[1]+u[1]*2/3)+","+l[0]+","+l[1]}return r}function vn(e,t){var n=[],r=(1-t)/2,i,s=e[0],o=e[1],u=1,a=e.length;while(++u<a)i=s,s=o,o=e[u],n.push([r*(o[0]-i[0]),r*(o[1]-i[1])]);return n}function mn(e){if(e.length<3)return un(e);var t=1,n=e.length,r=e[0],i=r[0],s=r[1],o=[i,i,i,(r=e[1])[0]],u=[s,s,s,r[1]],a=[i,",",s];En(a,o,u);while(++t<n)r=e[t],o.shift(),o.push(r[0]),u.shift(),u.push(r[1]),En(a,o,u);t=-1;while(++t<2)o.shift(),o.push(r[0]),u.shift(),u.push(r[1]),En(a,o,u);return a.join("")}function gn(e){if(e.length<4)return un(e);var t=[],n=-1,r=e.length,i,s=[0],o=[0];while(++n<3)i=e[n],s.push(i[0]),o.push(i[1]);t.push(wn(Qs,s)+","+wn(Qs,o)),--n;while(++n<r)i=e[n],s.shift(),s.push(i[0]),o.shift(),o.push(i[1]),En(t,s,o);return t.join("")}function yn(e){var t,n=-1,r=e.length,i=r+4,s,o=[],u=[];while(++n<4)s=e[n%r],o.push(s[0]),u.push(s[1]);t=[wn(Qs,o),",",wn(Qs,u)],--n;while(++n<i)s=e[n%r],o.shift(),o.push(s[0]),u.shift(),u.push(s[1]),En(t,o,u);return t.join("")}function bn(e,t){var n=e.length-1;if(n){var r=e[0][0],i=e[0][1],s=e[n][0]-r,o=e[n][1]-i,u=-1,a,f;while(++u<=n)a=e[u],f=u/n,a[0]=t*a[0]+(1-t)*(r+f*s),a[1]=t*a[1]+(1-t)*(i+f*o)}return mn(e)}function wn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function En(e,t,n){e.push("C",wn(Js,t),",",wn(Js,n),",",wn(Ks,t),",",wn(Ks,n),",",wn(Qs,t),",",wn(Qs,n))}function Sn(e,t){return(t[1]-e[1])/(t[0]-e[0])}function xn(e){var t=0,n=e.length-1,r=[],i=e[0],s=e[1],o=r[0]=Sn(i,s);while(++t<n)r[t]=(o+(o=Sn(i=s,s=e[t+1])))/2;return r[t]=o,r}function Tn(e){var t=[],n,r,i,s,o=xn(e),u=-1,a=e.length-1;while(++u<a)n=Sn(e[u],e[u+1]),Math.abs(n)<1e-6?o[u]=o[u+1]=0:(r=o[u]/n,i=o[u+1]/n,s=r*r+i*i,s>9&&(s=n*3/Math.sqrt(s),o[u]=s*r,o[u+1]=s*i));u=-1;while(++u<=a)s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u])),t.push([s||0,o[u]*s||0]);return t}function Nn(e){return e.length<3?un(e):e[0]+dn(e,Tn(e))}function Cn(e){var t,n=-1,r=e.length,i,s;while(++n<r)t=e[n],i=t[0],s=t[1]+Xs,t[0]=i*Math.cos(s),t[1]=i*Math.sin(s);return e}function kn(e){function t(t){function o(){l.push("M",f(e(v),p),h,c(e(d.reverse()),p),"Z")}var l=[],d=[],v=[],m=-1,g=t.length,y,b=u(n),w=u(i),E=n===r?function(){return x}:u(r),S=i===s?function(){return T}:u(s),x,T;while(++m<g)a.call(this,y=t[m],m)?(d.push([x=+b.call(this,y,m),T=+w.call(this,y,m)]),v.push([+E.call(this,y,m),+S.call(this,y,m)])):d.length&&(o(),d=[],v=[]);return d.length&&o(),l.length?l.join(""):null}var n=sn,r=sn,i=0,s=on,a=o,f=un,l=f.key,c=f,h="L",p=.7;return t.x=function(e){return arguments.length?(n=r=e,t):r},t.x0=function(e){return arguments.length?(n=e,t):n},t.x1=function(e){return arguments.length?(r=e,t):r},t.y=function(e){return arguments.length?(i=s=e,t):s},t.y0=function(e){return arguments.length?(i=e,t):i},t.y1=function(e){return arguments.length?(s=e,t):s},t.defined=function(e){return arguments.length?(a=e,t):a},t.interpolate=function(e){return arguments.length?(typeof e=="function"?l=f=e:l=(f=$s.get(e)||un).key,c=f.reverse||f,h=f.closed?"M":"L",t):l},t.tension=function(e){return arguments.length?(p=e,t):p},t}function Ln(e){return e.source}function An(e){return e.target}function On(e){return e.radius}function Mn(e){return e.startAngle}function _n(e){return e.endAngle}function Dn(e){return[e.x,e.y]}function Pn(e){return function(){var t=e.apply(this,arguments),n=t[0],r=t[1]+Xs;return[n*Math.cos(r),n*Math.sin(r)]}}function Hn(){return 64}function Bn(){return"circle"}function jn(e){var t=Math.sqrt(e/Math.PI);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+ -t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function Fn(e,t){e.attr("transform",function(e){return"translate("+t(e)+",0)"})}function In(e,t){e.attr("transform",function(e){return"translate(0,"+t(e)+")"})}function qn(e,t,n){i=[];if(n&&t.length>1){var r=Mt(e.domain()),i,s=-1,o=t.length,u=(t[1]-t[0])/++n,a,f;while(++s<o)for(a=n;--a>0;)(f=+t[s]-a*u)>=r[0]&&i.push(f);for(--s,a=0;++a<n&&(f=+t[s]+a*u)<r[1];)i.push(f)}return i}function Rn(){no||(no=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var e=d3.event,t;try{no.scrollTop=1e3,no.dispatchEvent(e),t=1e3-no.scrollTop}catch(n){t=e.wheelDelta||-e.detail*5}return t}function Un(e){var t=e.source,n=e.target,r=Wn(t,n),i=[t];while(t!==r)t=t.parent,i.push(t);var s=i.length;while(n!==r)i.splice(s,0,n),n=n.parent;return i}function zn(e){var t=[],n=e.parent;while(n!=null)t.push(e),e=n,n=n.parent;return t.push(e),t}function Wn(e,t){if(e===t)return e;var n=zn(e),r=zn(t),i=n.pop(),s=r.pop(),o=null;while(i===s)o=i,i=n.pop(),s=r.pop();return o}function Xn(e){e.fixed|=2}function Vn(e){e.fixed&=1}function $n(e){e.fixed|=4}function Jn(e){e.fixed&=3}function Kn(e,t,n){var r=0,i=0;e.charge=0;if(!e.leaf){var s=e.nodes,o=s.length,u=-1,a;while(++u<o){a=s[u];if(a==null)continue;Kn(a,t,n),e.charge+=a.charge,r+=a.charge*a.cx,i+=a.charge*a.cy}}if(e.point){e.leaf||(e.point.x+=Math.random()-.5,e.point.y+=Math.random()-.5);var f=t*n[e.point.index];e.charge+=e.pointCharge=f,r+=f*e.point.x,i+=f*e.point.y}e.cx=r/e.charge,e.cy=i/e.charge}function Qn(e){return 20}function Gn(e){return 1}function Yn(e){return e.x}function Zn(e){return e.y}function er(e,t,n){e.y0=t,e.y=n}function tr(e){return d3.range(e.length)}function nr(e){var t=-1,n=e[0].length,r=[];while(++t<n)r[t]=0;return r}function rr(e){var t=1,n=0,r=e[0][1],i,s=e.length;for(;t<s;++t)(i=e[t][1])>r&&(n=t,r=i);return n}function ir(e){return e.reduce(sr,0)}function sr(e,t){return e+t[1]}function or(e,t){return ur(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function ur(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function ar(e){return[d3.min(e),d3.max(e)]}function fr(e,t){return d3.rebind(e,t,"sort","children","value"),e.links=pr,e.nodes=function(t){return uo=!0,(e.nodes=e)(t)},e}function lr(e){return e.children}function cr(e){return e.value}function hr(e,t){return t.value-e.value}function pr(e){return d3.merge(e.map(function(e){return(e.children||[]).map(function(t){return{source:e,target:t}})}))}function dr(e,t){return e.value-t.value}function vr(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function mr(e,t){e._pack_next=t,t._pack_prev=e}function gr(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return i*i-n*n-r*r>.001}function yr(e){function t(e){r=Math.min(e.x-e.r,r),i=Math.max(e.x+e.r,i),s=Math.min(e.y-e.r,s),o=Math.max(e.y+e.r,o)}if(!(n=e.children)||!(p=n.length))return;var n,r=Infinity,i=-Infinity,s=Infinity,o=-Infinity,u,a,f,l,c,h,p;n.forEach(br),u=n[0],u.x=-u.r,u.y=0,t(u);if(p>1){a=n[1],a.x=a.r,a.y=0,t(a);if(p>2){f=n[2],Sr(u,a,f),t(f),vr(u,f),u._pack_prev=f,vr(f,a),a=u._pack_next;for(l=3;l<p;l++){Sr(u,a,f=n[l]);var d=0,v=1,m=1;for(c=a._pack_next;c!==a;c=c._pack_next,v++)if(gr(c,f)){d=1;break}if(d==1)for(h=u._pack_prev;h!==c._pack_prev;h=h._pack_prev,m++)if(gr(h,f))break;d?(v<m||v==m&&a.r<u.r?mr(u,a=c):mr(u=h,a),l--):(vr(u,f),a=f,t(f))}}}var g=(r+i)/2,y=(s+o)/2,b=0;for(l=0;l<p;l++)f=n[l],f.x-=g,f.y-=y,b=Math.max(b,f.r+Math.sqrt(f.x*f.x+f.y*f.y));e.r=b,n.forEach(wr)}function br(e){e._pack_next=e._pack_prev=e}function wr(e){delete e._pack_next,delete e._pack_prev}function Er(e,t,n,r){var i=e.children;e.x=t+=r*e.x,e.y=n+=r*e.y,e.r*=r;if(i){var s=-1,o=i.length;while(++s<o)Er(i[s],t,n,r)}}function Sr(e,t,n){var r=e.r+n.r,i=t.x-e.x,s=t.y-e.y;if(r&&(i||s)){var o=t.r+n.r,u=i*i+s*s;o*=o,r*=r;var a=.5+(r-o)/(2*u),f=Math.sqrt(Math.max(0,2*o*(r+u)-(r-=u)*r-o*o))/(2*u);n.x=e.x+a*i+f*s,n.y=e.y+a*s-f*i}else n.x=e.x+r,n.y=e.y}function xr(e){return 1+d3.max(e,function(e){return e.y})}function Tr(e){return e.reduce(function(e,t){return e+t.x},0)/e.length}function Nr(e){var t=e.children;return t&&t.length?Nr(t[0]):e}function Cr(e){var t=e.children,n;return t&&(n=t.length)?Cr(t[n-1]):e}function kr(e,t){return e.parent==t.parent?1:2}function Lr(e){var t=e.children;return t&&t.length?t[0]:e._tree.thread}function Ar(e){var t=e.children,n;return t&&(n=t.length)?t[n-1]:e._tree.thread}function Or(e,t){var n=e.children;if(n&&(i=n.length)){var r,i,s=-1;while(++s<i)t(r=Or(n[s],t),e)>0&&(e=r)}return e}function Mr(e,t){return e.x-t.x}function _r(e,t){return t.x-e.x}function Dr(e,t){return e.depth-t.depth}function Pr(e,t){function n(e,r){var i=e.children;if(i&&(a=i.length)){var s,o=null,u=-1,a;while(++u<a)s=i[u],n(s,o),o=s}t(e,r)}n(e,null)}function Hr(e){var t=0,n=0,r=e.children,i=r.length,s;while(--i>=0)s=r[i]._tree,s.prelim+=t,s.mod+=t,t+=s.shift+(n+=s.change)}function Br(e,t,n){e=e._tree,t=t._tree;var r=n/(t.number-e.number);e.change+=r,t.change-=r,t.shift+=n,t.prelim+=n,t.mod+=n}function jr(e,t,n){return e._tree.ancestor.parent==t.parent?e._tree.ancestor:n}function Fr(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function Ir(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],s=e.dy-t[0]-t[2];return i<0&&(n+=i/2,i=0),s<0&&(r+=s/2,s=0),{x:n,y:r,dx:i,dy:s}}function qr(e,t){function n(e,r){d3.text(e,t,function(e){r(e&&n.parse(e))})}function r(t){return t.map(i).join(e)}function i(e){return o.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var s=new RegExp("\r\n|["+e+"\r\n]","g"),o=new RegExp('["'+e+"\n]"),u=e.charCodeAt(0);return n.parse=function(e){var t;return n.parseRows(e,function(e,n){if(n){var r={},i=-1,s=t.length;while(++i<s)r[t[i]]=e[i];return r}return t=e,null})},n.parseRows=function(e,t){function n(){if(s.lastIndex>=e.length)return i;if(l)return l=!1,r;var t=s.lastIndex;if(e.charCodeAt(t)===34){var n=t;while(n++<e.length)if(e.charCodeAt(n)===34){if(e.charCodeAt(n+1)!==34)break;n++}s.lastIndex=n+2;var o=e.charCodeAt(n+1);return o===13?(l=!0,e.charCodeAt(n+2)===10&&s.lastIndex++):o===10&&(l=!0),e.substring(t+1,n).replace(/""/g,'"')}var a=s.exec(e);return a?(l=a[0].charCodeAt(0)!==u,e.substring(t,a.index)):(s.lastIndex=e.length,e.substring(t))}var r={},i={},o=[],a=0,f,l;s.lastIndex=0;while((f=n())!==i){var c=[];while(f!==r&&f!==i)c.push(f),f=n();if(t&&!(c=t(c,a++)))continue;o.push(c)}return o},n.format=function(e){return e.map(r).join("\n")},n}function Rr(e,t){return function(n){return n&&e.hasOwnProperty(n.type)?e[n.type](n):t}}function Ur(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+ -2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}function zr(e,t){fo.hasOwnProperty(e.type)&&fo[e.type](e,t)}function Wr(e,t){zr(e.geometry,t)}function Xr(e,t){for(var n=e.features,r=0,i=n.length;r<i;r++)zr(n[r].geometry,t)}function Vr(e,t){for(var n=e.geometries,r=0,i=n.length;r<i;r++)zr(n[r],t)}function $r(e,t){for(var n=e.coordinates,r=0,i=n.length;r<i;r++)t.apply(null,n[r])}function Jr(e,t){for(var n=e.coordinates,r=0,i=n.length;r<i;r++)for(var s=n[r],o=0,u=s.length;o<u;o++)t.apply(null,s[o])}function Kr(e,t){for(var n=e.coordinates,r=0,i=n.length;r<i;r++)for(var s=n[r][0],o=0,u=s.length;o<u;o++)t.apply(null,s[o])}function Qr(e,t){t.apply(null,e.coordinates)}function Gr(e,t){for(var n=e.coordinates[0],r=0,i=n.length;r<i;r++)t.apply(null,n[r])}function Yr(e){return e.source}function Zr(e){return e.target}function ei(){function e(e){var t=Math.sin(e*=p)*d,n=Math.sin(p-e)*d,r=n*s+t*c,u=n*o+t*h,a=n*i+t*l;return[Math.atan2(u,r)/ao,Math.atan2(a,Math.sqrt(r*r+u*u))/ao]}var t,n,r,i,s,o,u,a,f,l,c,h,p,d;return e.distance=function(){return p==null&&(d=1/Math.sin(p=Math.acos(Math.max(-1,Math.min(1,i*l+r*f*Math.cos(u-t)))))),p},e.source=function(u){var a=Math.cos(t=u[0]*ao),f=Math.sin(t);return r=Math.cos(n=u[1]*ao),i=Math.sin(n),s=r*a,o=r*f,p=null,e},e.target=function(t){var n=Math.cos(u=t[0]*ao),r=Math.sin(u);return f=Math.cos(a=t[1]*ao),l=Math.sin(a),c=f*n,h=f*r,p=null,e},e}function ti(e,t){var n=ei().source(e).target(t);return n.distance(),n}function ni(e){var t=0,n=0;for(;;){if(e(t,n))return[t,n];t===0?(t=n+1,n=0):(t-=1,n+=1)}}function ri(e,t,n,r){var i,s,o,u,a,f,l;return i=r[e],s=i[0],o=i[1],i=r[t],u=i[0],a=i[1],i=r[n],f=i[0],l=i[1],(l-o)*(u-s)-(a-o)*(f-s)>0}function ii(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function si(e,t,n,r){var i=e[0],s=t[0],o=n[0],u=r[0],a=e[1],f=t[1],l=n[1],c=r[1],h=i-o,p=s-i,d=u-o,v=a-l,m=f-a,g=c-l,y=(d*v-g*h)/(g*p-d*m);return[i+y*p,a+y*m]}function oi(e,t){var n={list:e.map(function(e,t){return{index:t,x:e[0],y:e[1]}}).sort(function(e,t){return e.y<t.y?-1:e.y>t.y?1:e.x<t.x?-1:e.x>t.x?1:0}),bottomSite:null},r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l"),r.rightEnd=r.createHalfEdge(null,"l"),r.leftEnd.r=r.rightEnd,r.rightEnd.l=r.leftEnd,r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(e,t){return{edge:e,side:t,vertex:null,l:null,r:null}},insert:function(e,t){t.l=e,t.r=e.r,e.r.l=t,e.r=t},leftBound:function(e){var t=r.leftEnd;do t=t.r;while(t!=r.rightEnd&&i.rightOf(t,e));return t=t.l,t},del:function(e){e.l.r=e.r,e.r.l=e.l,e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[ho[e.side]]}},i={bisect:function(e,t){var n={region:{l:e,r:t},ep:{l:null,r:null}},r=t.x-e.x,i=t.y-e.y,s=r>0?r:-r,o=i>0?i:-i;return n.c=e.x*r+e.y*i+(r*r+i*i)*.5,s>o?(n.a=1,n.b=i/r,n.c/=r):(n.b=1,n.a=r/i,n.c/=i),n},intersect:function(e,t){var n=e.edge,r=t.edge;if(!n||!r||n.region.r==r.region.r)return null;var i=n.a*r.b-n.b*r.a;if(Math.abs(i)<1e-10)return null;var s=(n.c*r.b-r.c*n.b)/i,o=(r.c*n.a-n.c*r.a)/i,u=n.region.r,a=r.region.r,f,l;u.y<a.y||u.y==a.y&&u.x<a.x?(f=e,l=n):(f=t,l=r);var c=s>=l.region.r.x;return c&&f.side==="l"||!c&&f.side==="r"?null:{x:s,y:o}},rightOf:function(e,t){var n=e.edge,r=n.region.r,i=t.x>r.x;if(i&&e.side==="l")return 1;if(!i&&e.side==="r")return 0;if(n.a===1){var s=t.y-r.y,o=t.x-r.x,u=0,a=0;!i&&n.b<0||i&&n.b>=0?a=u=s>=n.b*o:(a=t.x+t.y*n.b>n.c,n.b<0&&(a=!a),a||(u=1));if(!u){var f=r.x-n.region.l.x;a=n.b*(o*o-s*s)<f*s*(1+2*o/f+n.b*n.b),n.b<0&&(a=!a)}}else{var l=n.c-n.a*t.x,c=t.y-l,h=t.x-r.x,p=l-r.y;a=c*c>h*h+p*p}return e.side==="l"?a:!a},endPoint:function(e,n,r){e.ep[n]=r;if(!e.ep[ho[n]])return;t(e)},distance:function(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}},s={list:[],insert:function(e,t,n){e.vertex=t,e.ystar=t.y+n;for(var r=0,i=s.list,o=i.length;r<o;r++){var u=i[r];if(e.ystar>u.ystar||e.ystar==u.ystar&&t.x>u.vertex.x)continue;break}i.splice(r,0,e)},del:function(e){for(var t=0,n=s.list,r=n.length;t<r&&n[t]!=e;++t);n.splice(t,1)},empty:function(){return s.list.length===0},nextEvent:function(e){for(var t=0,n=s.list,r=n.length;t<r;++t)if(n[t]==e)return n[t+1];return null},min:function(){var e=s.list[0];return{x:e.vertex.x,y:e.ystar}},extractMin:function(){return s.list.shift()}};r.init(),n.bottomSite=n.list.shift();var o=n.list.shift(),u,a,f,l,c,h,p,d,v,m,g,y,b;for(;;){s.empty()||(u=s.min());if(o&&(s.empty()||o.y<u.y||o.y==u.y&&o.x<u.x))a=r.leftBound(o),f=r.right(a),p=r.rightRegion(a),y=i.bisect(p,o),h=r.createHalfEdge(y,"l"),r.insert(a,h),m=i.intersect(a,h),m&&(s.del(a),s.insert(a,m,i.distance(m,o))),a=h,h=r.createHalfEdge(y,"r"
+),r.insert(a,h),m=i.intersect(h,f),m&&s.insert(h,m,i.distance(m,o)),o=n.list.shift();else{if(!!s.empty())break;a=s.extractMin(),l=r.left(a),f=r.right(a),c=r.right(f),p=r.leftRegion(a),d=r.rightRegion(f),g=a.vertex,i.endPoint(a.edge,a.side,g),i.endPoint(f.edge,f.side,g),r.del(a),s.del(f),r.del(f),b="l",p.y>d.y&&(v=p,p=d,d=v,b="r"),y=i.bisect(p,d),h=r.createHalfEdge(y,b),r.insert(l,h),i.endPoint(y,ho[b],g),m=i.intersect(l,h),m&&(s.del(l),s.insert(l,m,i.distance(m,p))),m=i.intersect(h,c),m&&s.insert(h,m,i.distance(m,p))}}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a))t(a.edge)}function ui(){return{leaf:!0,nodes:[],point:null}}function ai(e,t,n,r,i,s){if(!e(t,n,r,i,s)){var o=(n+i)*.5,u=(r+s)*.5,a=t.nodes;a[0]&&ai(e,a[0],n,r,o,u),a[1]&&ai(e,a[1],o,r,i,u),a[2]&&ai(e,a[2],n,u,o,s),a[3]&&ai(e,a[3],o,u,i,s)}}function fi(e){return{x:e[0],y:e[1]}}function li(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function ci(e){return e.substring(0,3)}function hi(e,t,n,r){var i,s,o=0,u=t.length,a=n.length;while(o<u){if(r>=a)return-1;i=t.charCodeAt(o++);if(i==37){s=Ho[t.charAt(o++)];if(!s||(r=s(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function pi(e){return new RegExp("^(?:"+e.map(d3.requote).join("|")+")","i")}function di(e){var t=new r,n=-1,i=e.length;while(++n<i)t.set(e[n].toLowerCase(),n);return t}function vi(e,t,n){Ao.lastIndex=0;var r=Ao.exec(t.substring(n));return r?n+=r[0].length:-1}function mi(e,t,n){Lo.lastIndex=0;var r=Lo.exec(t.substring(n));return r?n+=r[0].length:-1}function gi(e,t,n){_o.lastIndex=0;var r=_o.exec(t.substring(n));return r?(e.m=Do.get(r[0].toLowerCase()),n+=r[0].length):-1}function yi(e,t,n){Oo.lastIndex=0;var r=Oo.exec(t.substring(n));return r?(e.m=Mo.get(r[0].toLowerCase()),n+=r[0].length):-1}function bi(e,t,n){return hi(e,Po.c.toString(),t,n)}function wi(e,t,n){return hi(e,Po.x.toString(),t,n)}function Ei(e,t,n){return hi(e,Po.X.toString(),t,n)}function Si(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+4));return r?(e.y=+r[0],n+=r[0].length):-1}function xi(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.y=Ti(+r[0]),n+=r[0].length):-1}function Ti(e){return e+(e>68?1900:2e3)}function Ni(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.m=r[0]-1,n+=r[0].length):-1}function Ci(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.d=+r[0],n+=r[0].length):-1}function ki(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.H=+r[0],n+=r[0].length):-1}function Li(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.M=+r[0],n+=r[0].length):-1}function Ai(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.S=+r[0],n+=r[0].length):-1}function Oi(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+3));return r?(e.L=+r[0],n+=r[0].length):-1}function Mi(e,t,n){var r=jo.get(t.substring(n,n+=2).toLowerCase());return r==null?-1:(e.p=r,n)}function _i(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return n+To(r)+To(i)}function Di(e){return e.toISOString()}function Pi(e,t,n){function r(t){var n=e(t),r=s(n,1);return t-n<r-t?n:r}function i(n){return t(n=e(new po(n-1)),1),n}function s(e,n){return t(e=new po(+e),n),e}function o(e,r,s){var o=i(e),u=[];if(s>1)while(o<r)n(o)%s||u.push(new Date(+o)),t(o,1);else while(o<r)u.push(new Date(+o)),t(o,1);return u}function u(e,t,n){try{po=li;var r=new li;return r._=e,o(r,t,n)}finally{po=Date}}e.floor=e,e.round=r,e.ceil=i,e.offset=s,e.range=o;var a=e.utc=Hi(e);return a.floor=a,a.round=Hi(r),a.ceil=Hi(i),a.offset=Hi(s),a.range=u,e}function Hi(e){return function(t,n){try{po=li;var r=new li;return r._=t,e(r,n)._}finally{po=Date}}}function Bi(e,t,n){function r(t){return e(t)}return r.invert=function(t){return Fi(e.invert(t))},r.domain=function(t){return arguments.length?(e.domain(t),r):e.domain().map(Fi)},r.nice=function(e){return r.domain(Dt(r.domain(),function(){return e}))},r.ticks=function(n,i){var s=ji(r.domain());if(typeof n!="function"){var o=s[1]-s[0],u=o/n,a=d3.bisect(Io,u);if(a==Io.length)return t.year(s,n);if(!a)return e.ticks(n).map(Fi);Math.log(u/Io[a-1])<Math.log(Io[a]/u)&&--a,n=t[a],i=n[1],n=n[0].range}return n(s[0],new Date(+s[1]+1),i)},r.tickFormat=function(){return n},r.copy=function(){return Bi(e.copy(),t,n)},d3.rebind(r,e,"range","rangeRound","interpolate","clamp")}function ji(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function Fi(e){return new Date(e)}function Ii(e){return function(t){var n=e.length-1,r=e[n];while(!r[1](t))r=e[--n];return r[0](t)}}function qi(e){var t=new Date(e,0,1);return t.setFullYear(e),t}function Ri(e){var t=e.getFullYear(),n=qi(t),r=qi(t+1);return t+(e-n)/(r-n)}function Ui(e){var t=new Date(Date.UTC(e,0,1));return t.setUTCFullYear(e),t}function zi(e){var t=e.getUTCFullYear(),n=Ui(t),r=Ui(t+1);return t+(e-n)/(r-n)}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(Wi){var Xi=CSSStyleDeclaration.prototype,Vi=Xi.setProperty;Xi.setProperty=function(e,t,n){Vi.call(this,e,t+"",n)}}d3={version:"2.10.2"};var $i=n;try{$i(document.documentElement.childNodes)[0].nodeType}catch(Ji){$i=t}var Ki=[].__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]};d3.map=function(e){var t=new r;for(var n in e)t.set(n,e[n]);return t},e(r,{has:function(e){return Qi+e in this},get:function(e){return this[Qi+e]},set:function(e,t){return this[Qi+e]=t},remove:function(e){return e=Qi+e,e in this&&delete this[e]},keys:function(){var e=[];return this.forEach(function(t){e.push(t)}),e},values:function(){var e=[];return this.forEach(function(t,n){e.push(n)}),e},entries:function(){var e=[];return this.forEach(function(t,n){e.push({key:t,value:n})}),e},forEach:function(e){for(var t in this)t.charCodeAt(0)===Gi&&e.call(this,t.substring(1),this[t])}});var Qi="\0",Gi=Qi.charCodeAt(0);d3.functor=u,d3.rebind=function(e,t){var n=1,r=arguments.length,i;while(++n<r)e[i=arguments[n]]=a(e,t,t[i]);return e},d3.ascending=function(e,t){return e<t?-1:e>t?1:e>=t?0:NaN},d3.descending=function(e,t){return t<e?-1:t>e?1:t>=e?0:NaN},d3.mean=function(e,t){var n=e.length,r,i=0,s=-1,o=0;if(arguments.length===1)while(++s<n)f(r=e[s])&&(i+=(r-i)/++o);else while(++s<n)f(r=t.call(e,e[s],s))&&(i+=(r-i)/++o);return o?i:undefined},d3.median=function(e,t){return arguments.length>1&&(e=e.map(t)),e=e.filter(f),e.length?d3.quantile(e.sort(d3.ascending),.5):undefined},d3.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)(s=e[n])!=null&&i>s&&(i=s)}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)(s=t.call(e,e[n],n))!=null&&i>s&&(i=s)}return i},d3.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)(s=e[n])!=null&&s>i&&(i=s)}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)(s=t.call(e,e[n],n))!=null&&s>i&&(i=s)}return i},d3.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++n<r&&((i=o=e[n])==null||i!=i))i=o=undefined;while(++n<r)(s=e[n])!=null&&(i>s&&(i=s),o<s&&(o=s))}else{while(++n<r&&((i=o=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)(s=t.call(e,e[n],n))!=null&&(i>s&&(i=s),o<s&&(o=s))}return[i,o]},d3.random={normal:function(e,t){var n=arguments.length;return n<2&&(t=1),n<1&&(e=0),function(){var n,r,i;do n=Math.random()*2-1,r=Math.random()*2-1,i=n*n+r*r;while(!i||i>1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(e,t){var n=arguments.length;n<2&&(t=1),n<1&&(e=0);var r=d3.random.normal();return function(){return Math.exp(e+t*r())}},irwinHall:function(e){return function(){for(var t=0,n=0;n<e;n++)t+=Math.random();return t/e}}},d3.sum=function(e,t){var n=0,r=e.length,i,s=-1;if(arguments.length===1)while(++s<r)isNaN(i=+e[s])||(n+=i);else while(++s<r)isNaN(i=+t.call(e,e[s],s))||(n+=i);return n},d3.quantile=function(e,t){var n=(e.length-1)*t+1,r=Math.floor(n),i=e[r-1],s=n-r;return s?i+s*(e[r]-i):i},d3.transpose=function(e){return d3.zip.apply(d3,e)},d3.zip=function(){if(!(i=arguments.length))return[];for(var e=-1,t=d3.min(arguments,l),n=new Array(t);++e<t;)for(var r=-1,i,s=n[e]=new Array(i);++r<i;)s[r]=arguments[r][e];return n},d3.bisector=function(e){return{left:function(t,n,r,i){arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);while(r<i){var s=r+i>>>1;e.call(t,t[s],s)<n?r=s+1:i=s}return r},right:function(t,n,r,i){arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);while(r<i){var s=r+i>>>1;n<e.call(t,t[s],s)?i=s:r=s+1}return r}}};var Yi=d3.bisector(function(e){return e});d3.bisectLeft=Yi.left,d3.bisect=d3.bisectRight=Yi.right,d3.first=function(e,t){var n=0,r=e.length,i=e[0],s;arguments.length===1&&(t=d3.ascending);while(++n<r)t.call(e,i,s=e[n])>0&&(i=s);return i},d3.last=function(e,t){var n=0,r=e.length,i=e[0],s;arguments.length===1&&(t=d3.ascending);while(++n<r)t.call(e,i,s=e[n])<=0&&(i=s);return i},d3.nest=function(){function e(t,s){if(s>=i.length)return u?u.call(n,t):o?t.sort(o):t;var a=-1,f=t.length,l=i[s++],c,h,p=new r,d,v={};while(++a<f)(d=p.get(c=l(h=t[a])))?d.push(h):p.set(c,[h]);return p.forEach(function(t,n){v[t]=e(n,s)}),v}function t(e,n){if(n>=i.length)return e;var r=[],o=s[n++],u;for(u in e)r.push({key:u,values:t(e[u],n)});return o&&r.sort(function(e,t){return o(e.key,t.key)}),r}var n={},i=[],s=[],o,u;return n.map=function(t){return e(t,0)},n.entries=function(n){return t(e(n,0),0)},n.key=function(e){return i.push(e),n},n.sortKeys=function(e){return s[i.length-1]=e,n},n.sortValues=function(e){return o=e,n},n.rollup=function(e){return u=e,n},n},d3.keys=function(e){var t=[];for(var n in e)t.push(n);return t},d3.values=function(e){var t=[];for(var n in e)t.push(e[n]);return t},d3.entries=function(e){var t=[];for(var n in e)t.push({key:n,value:e[n]});return t},d3.permute=function(e,t){var n=[],r=-1,i=t.length;while(++r<i)n[r]=e[t[r]];return n},d3.merge=function(e){return Array.prototype.concat.apply([],e)},d3.split=function(e,t){var n=[],r=[],i,s=-1,o=e.length;arguments.length<2&&(t=c);while(++s<o)t.call(r,i=e[s],s)?r=[]:(r.length||n.push(r),r.push(i));return n},d3.range=function(e,t,n){arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0));if((t-e)/n===Infinity)throw new Error("infinite range");var r=[],i=p(Math.abs(n)),s=-1,o;e*=i,t*=i,n*=i;if(n<0)while((o=e+n*++s)>t)r.push(o/i);else while((o=e+n*++s)<t)r.push(o/i);return r},d3.requote=function(e){return e.replace(Zi,"\\$&")};var Zi=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)},d3.xhr=function(e,t,n){var r=new XMLHttpRequest;arguments.length<3?(n=t,t=null):t&&r.overrideMimeType&&r.overrideMimeType(t),r.open("GET",e,!0),t&&r.setRequestHeader("Accept",t),r.onreadystatechange=function(){if(r.readyState===4){var e=r.status;n(!e&&r.response||e>=200&&e<300||e===304?r:null)}},r.send(null)},d3.text=function(e,t,n){function r(e){n(e&&e.responseText)}arguments.length<3&&(n=t,t=null),d3.xhr(e,t,r)},d3.json=function(e,t){d3.text(e,"application/json",function(e){t(e?JSON.parse(e):null)})},d3.html=function(e,t){d3.text(e,"text/html",function(e){if(e!=null){var n=document.createRange();n.selectNode(document.body),e=n.createContextualFragment(e)}t(e)})},d3.xml=function(e,t,n){function r(e){n(e&&e.responseXML)}arguments.length<3&&(n=t,t=null),d3.xhr(e,t,r)};var es={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:es,qualify:function(e){var t=e.indexOf(":"),n=e;return t>=0&&(n=e.substring(0,t),e=e.substring(t+1)),es.hasOwnProperty(n)?{space:es[n],local:e}:e}},d3.dispatch=function(){var e=new d,t=-1,n=arguments.length;while(++t<n)e[arguments[t]]=v(e);return e},d.prototype.on=function(e,t){var n=e.indexOf("."),r="";return n>0&&(r=e.substring(n+1),e=e.substring(0,n)),arguments.length<2?this[e].on(r):this[e].on(r,t)},d3.format=function(e){var t=ts.exec(e),n=t[1]||" ",r=t[3]||"",i=t[5],s=+t[6],o=t[7],u=t[8],a=t[9],f=1,l="",c=!1;u&&(u=+u.substring(1)),i&&(n="0",o&&(s-=Math.floor((s-1)/4)));switch(a){case"n":o=!0,a="g";break;case"%":f=100,l="%",a="f";break;case"p":f=100,l="%",a="r";break;case"d":c=!0,u=0;break;case"s":f=-1,a="r"}return a=="r"&&!u&&(a="g"),a=ns.get(a)||g,function(e){if(c&&e%1)return"";var t=e<0&&(e=-e)?"-":r;if(f<0){var h=d3.formatPrefix(e,u);e=h.scale(e),l=h.symbol}else e*=f;e=a(e,u);if(i){var p=e.length+t.length;p<s&&(e=(new Array(s-p+1)).join(n)+e),o&&(e=y(e)),e=t+e}else{o&&(e=y(e)),e=t+e;var p=e.length;p<s&&(e=(new Array(s-p+1)).join(n)+e)}return e+l}};var ts=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,ns=d3.map({g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(e,t){return d3.round(e,t=m(e,t)).toFixed(Math.max(0,Math.min(20,t)))}}),rs=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(b);d3.formatPrefix=function(e,t){var n=0;return e&&(e<0&&(e*=-1),t&&(e=d3.round(e,m(e,t))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,Math.floor((n<=0?n+1:n-1)/3)*3))),rs[8+n/3]};var is=T(2),ss=T(3),os=function(){return x},us=d3.map({linear:os,poly:T,quad:function(){return is},cubic:function(){return ss},sin:function(){return N},exp:function(){return C},circle:function(){return k},elastic:L,back:A,bounce:function(){return O}}),as=d3.map({"in":x,out:E,"in-out":S,"out-in":function(e){return S(E(e))}});d3.ease=function(e){var t=e.indexOf("-"),n=t>=0?e.substring(0,t):e,r=t>=0?e.substring(t+1):"in";return n=us.get(n)||os,r=as.get(r)||x,w(r(n.apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.transform=function(e){var t=document.createElementNS(d3.ns.prefix.svg,"g");return(d3.transform=function(e){t.setAttribute("transform",e);var n=t.transform.baseVal.consolidate();return new P(n?n.matrix:ls)})(e)},P.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var fs=180/Math.PI,ls={a:1,b:0,c:0,d:1,e:0,f:0};d3.interpolate=function(e,t){var n=d3.interpolators.length,r;while(--n>=0&&!(r=d3.interpolators[n](e,t)));return r},d3.interpolateNumber=function(e,t){return t-=e,function(n){return e+t*n}},d3.interpolateRound=function(e,t){return t-=e,function(n){return Math.round(e+t*n)}},d3.interpolateString=function(e,t){var n,r,i,s=0,o=0,u=[],a=[],f,l;cs.lastIndex=0;for(r=0;n=cs.exec(t);++r)n.index&&u.push(t.substring(s,o=n.index)),a.push({i:u.length,x:n[0]}),u.push(null),s=cs.lastIndex;s<t.length&&u.push(t.substring(s));for(r=0,f=a.length;(n=cs.exec(e))&&r<f;++r){l=a[r];if(l.x==n[0]){if(l.i)if(u[l.i+1]==null){u[l.i-1]+=l.x,u.splice(l.i,1);for(i=r+1;i<f;++i)a[i].i--}else{u[l.i-1]+=l.x+u[l.i+1],u.splice(l.i,2);for(i=r+1;i<f;++i)a[i].i-=2}else if(u[l.i+1]==null)u[l.i]=l.x;else{u[l.i]=l.x+u[l.i+1],u.splice(l.i+1,1);for(i=r+1;i<f;++i)a[i].i--}a.splice(r,1),f--,r--}else l.x=d3.interpolateNumber(parseFloat(n[0]),parseFloat(l.x))}while(r<f)l=a.pop(),u[l.i+1]==null?u[l.i]=l.x:(u[l.i]=l.x+u[l.i+1],u.splice(l.i+1,1)),f--;return u.length===1?u[0]==null?a[0].x:function(){return t}:function(e){for(r=0;r<f;++r)u[(l=a[r]).i]=l.x(e);return u.join("")}},d3.interpolateTransform=function(e,t){var n=[],r=[],i,s=d3.transform(e),o=d3.transform(t),u=s.translate,a=o.translate,f=s.rotate,l=o.rotate,c=s.skew,h=o.skew,p=s.scale,d=o.scale;return u[0]!=a[0]||u[1]!=a[1]?(n.push("translate(",null,",",null,")"),r.push({i:1,x:d3.interpolateNumber(u[0],a[0])},{i:3,x:d3.interpolateNumber(u[1],a[1])})):a[0]||a[1]?n.push("translate("+a+")"):n.push(""),f!=l?(f-l>180?l+=360:l-f>180&&(f+=360),r.push({i:n.push(n.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(f,l)})):l&&n.push(n.pop()+"rotate("+l+")"),c!=h?r.push({i:n.push(n.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(c,h)}):h&&n.push(n.pop()+"skewX("+h+")"),p[0]!=d[0]||p[1]!=d[1]?(i=n.push(n.pop()+"scale(",null,",",null,")"),r.push({i:i-4,x:d3.interpolateNumber(p[0],d[0])},{i:i-2,x:d3.interpolateNumber(p[1],d[1])})):(d[0]!=1||d[1]!=1)&&n.push(n.pop()+"scale("+d+")"),i=r.length,function(e){var t=-1,s;while(++t<i)n[(s=r[t]).i]=s.x(e);return n.join("")}},d3.interpolateRgb=function(e,t){e=d3.rgb(e),t=d3.rgb(t);var n=e.r,r=e.g,i=e.b,s=t.r-n,o=t.g-r,u=t.b-i;return function(e){return"#"+z(Math.round(n+s*e))+z(Math.round(r+o*e))+z(Math.round(i+u*e))}},d3.interpolateHsl=function(e,t){e=d3.hsl(e),t=d3.hsl(t);var n=e.h,r=e.s,i=e.l,s=t.h-n,o=t.s-r,u=t.l-i;return s>180?s-=360:s<-180&&(s+=360),function(e){return G(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateLab=function(e,t){e=d3.lab(e),t=d3.lab(t);var n=e.l,r=e.a,i=e.b,s=t.l-n,o=t.a-r,u=t.b-i;return function(e){return rt(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateHcl=function(e,t){e=d3.hcl(e),t=d3.hcl(t);var n=e.h,r=e.c,i=e.l,s=t.h-n,o=t.c-r,u=t.l-i;return s>180?s-=360:s<-180&&(s+=360),function(e){return et(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateArray=function(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u<o;++u)n.push(d3.interpolate(e[u],t[u]));for(;u<i;++u)r[u]=e[u];for(;u<s;++u)r[u]=t[u];return function(e){for(u=0;u<o;++u)r[u]=n[u](e);return r}},d3.interpolateObject=function(e,t){var n={},r={},i;for(i in e)i in t?n[i]=F(i)(e[i],t[i]):r[i]=e[i];for(i in t)i in e||(r[i]=t[i]);return function(e){for(i in n)r[i]=n[i](e);return r}};var cs=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;d3.interpolators=[d3.interpolateObject,function(e,t){return t instanceof Array&&d3.interpolateArray(e,t)},function(e,t){return(typeof e=="string"||typeof t=="string")&&d3.interpolateString(e+"",t+"")},function(e,t){return(typeof t=="string"?hs.has(t)||/^(#|rgb\(|hsl\()/.test(t):t instanceof U||t instanceof Q)&&d3.interpolateRgb(e,t)},function(e,t){return!isNaN(e=+e)&&!isNaN(t=+t)&&d3.interpolateNumber(e,t)}],d3.rgb=function(e,t,n){return arguments.length===1?e instanceof U?R(e.r,e.g,e.b):W(""+e,R,G):R(~~e,~~t,~~n)},U.prototype.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,n=this.g,r=this.b,i=30;return!t&&!n&&!r?R(i,i,i):(t&&t<i&&(t=i),n&&n<i&&(n=i),r&&r<i&&(r=i),R(Math.min(255,Math.floor(t/e)),Math.min(255,Math.floor(n/e)),Math.min(255,Math.floor(r/e))))},U.prototype.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),R(Math.floor(e*this.r),Math.floor(e*this.g),Math.floor(e*this.b))},U.prototype.hsl=function(){return X(this.r,this.g,this.b)},U.prototype.toString=function(){return"#"+z(this.r)+z(this.g)+z(this.b)};var hs=d3.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});hs.forEach(function(e,t){hs.set(e,W(t,R,G))}),d3.hsl=function(e,t,n){return arguments.length===1?e instanceof Q?K(e.h,e.s,e.l):W(""+e,X,K):K(+e,+t,+n)},Q.prototype.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),K(this.h,this.s,this.l/e)},Q.prototype.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),K(this.h,this.s,e*this.l)},Q.prototype.rgb=function(){return G(this.h,this.s,this.l)},Q.prototype.toString=function(){return this.rgb().toString()},d3.hcl=function(e,t,n){return arguments.length===1?e instanceof Z?Y(e.h,e.c,e.l):e instanceof nt?it(e.l,e.a,e.b):it((e=V((e=d3.rgb(e)).r,e.g,e.b)).l,e.a,e.b):Y(+e,+t,+n)},Z.prototype.brighter=function(e){return Y(this.h,this.c,Math.min(100,this.l+ps*(arguments.length?e:1)))},Z.prototype.darker=function(e){return Y(this.h,this.c,Math.max(0,this.l-ps*(arguments.length?e:1)))},Z.prototype.rgb=function(){return et(this.h,this.c,this.l).rgb()},Z.prototype.toString=function(){return this.rgb()+""},d3.lab=function(e,t,n){return arguments.length===1?e instanceof nt?tt(e.l,e.a,e.b):e instanceof Z?et(e.l,e.c,e.h):V((e=d3.rgb(e)).r,e.g,e.b):tt(+e,+t,+n)};var ps=18,ds=.95047,vs=1,ms=1.08883;nt.prototype.brighter=function(e){return tt(Math.min(100,this.l+ps*(arguments.length?e:1)),this.a,this.b)},nt.prototype.darker=function(e){return tt(Math.max(0,this.l-ps*(arguments.length?e:1)),this.a,this.b)},nt.prototype.rgb=function(){return rt(this.l,this.a,this.b)},nt.prototype.toString=function(){return this.rgb()+""};var gs=function(e,t){return t.querySelector(e)},ys=function(e,t){return t.querySelectorAll(e)},bs=document.documentElement,ws=bs.matchesSelector||bs.webkitMatchesSelector||bs.mozMatchesSelector||bs.msMatchesSelector||bs.oMatchesSelector,Es=function(e,t){return ws.call(e,t)};typeof Sizzle=="function"&&(gs=function(e,t){return Sizzle(e,t)[0]||null},ys=function(e,t){return Sizzle.uniqueSort(Sizzle(e,t))},Es=Sizzle.matchesSelector);var Ss=[];d3.selection=function(){return xs},d3.selection.prototype=Ss,Ss.select=function(e){var t=[],n,r,i,s;typeof e!="function"&&(e=ft(e));for(var o=-1,u=this.length;++o<u;){t.push(n=[]),n.parentNode=(i=this[o]).parentNode;for(var a=-1,f=i.length;++a<f;)(s=i[a])?(n.push(r=e.call(s,s.__data__,a)),r&&"__data__"in s&&(r.__data__=s.__data__)):n.push(null)}return at(t)},Ss.selectAll=function(e){var t=[],n,r;typeof e!="function"&&(e=lt(e));for(var i=-1,s=this.length;++i<s;)for(var o=this[i],u=-1,a=o.length;++u<a;)if(r=o[u])t.push(n=$i(e.call(r,r.__data__,u))),n.parentNode=r;return at(t)},Ss.attr=function(e,t){if(arguments.length<2){if(typeof e=="string"){var n=this.node();return e=d3.ns.qualify(e),e.local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(t in e)this.each(ct(t,e[t]));return this}return this.each(ct(e,t))},Ss.classed=function(e,t){if(arguments.length<2){if(typeof e=="string"){var n=this.node(),r=(e=e.trim().split(/^|\s+/g)).length,i=-1;if(t=n.classList){while(++i<r)if(!t.contains(e[i]))return!1}else{t=n.className,t.baseVal!=null&&(t=t.baseVal);while(++i<r)if(!ht(e[i]).test(t))return!1}return!0}for(t in e)this.each(pt(t,e[t]));return this}return this.each(pt(e,t))},Ss.style=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t="");for(n in e)this.each(vt(n,e[n],t));return this}if(r<2)return window.getComputedStyle(this.node(),null).getPropertyValue(e);n=""}return this.each(vt(e,t,n))},Ss.property=function(e,t){if(arguments.length<2){if(typeof e=="string")return this.node()[e];for(t in e)this.each(mt(t,e[t]));return this}return this.each(mt(e,t))},Ss.text=function(e){return arguments.length<1?this.node().textContent:this.each(typeof e=="function"?function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}:e==null?function(){this.textContent=""}:function(){this.textContent=e})},Ss.html=function(e){return arguments.length<1?this.node().innerHTML:this.each(typeof e=="function"?function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}:e==null?function(){this.innerHTML=""}:function(){this.innerHTML=e})},Ss.append=function(e){function t(){return this.appendChild(document.createElementNS(this.namespaceURI,e))}function n(){return this.appendChild(document.createElementNS(e.space,e.local))}return e=d3.ns.qualify(e),this.select(e.local?n:t)},Ss.insert=function(e,t){function n(){return this.insertBefore(document.createElementNS(this.namespaceURI,e),gs(t,this))}function r(){return this.insertBefore(document.createElementNS(e.space,e.local),gs(t,this))}return e=d3.ns.qualify(e),this.select(e.local?r:n)},Ss.remove=function(){return this.each(function(){var e=this.parentNode;e&&e.removeChild(this)})},Ss.data=function(e,t){function n(e,n){var i,s=e.length,o=n.length,u=Math.min(s,o),c=Math.max(s,o),h=[],p=[],d=[],v,m;if(t){var g=new r,y=[],b,w=n.length;for(i=-1;++i<s;)b=t.call(v=e[i],v.__data__,i),g.has(b)?d[w++]=v:g.set(b,v),y.push(b);for(i=-1;++i<o;)b=t.call(n,m=n[i],i),g.has(b)?(h[i]=v=g.get(b),v.__data__=m,p[i]=d[i]=null):(p[i]=gt(m),h[i]=d[i]=null),g.remove(b);for(i=-1;++i<s;)g.has(y[i])&&(d[i]=e[i])}else{for(i=-1;++i<u;)v=e[i],m=n[i],v?(v.__data__=m,h[i]=v,p[i]=d[i]=null):(p[i]=gt(m),h[i]=d[i]=null);for(;i<o;++i)p[i]=gt(n[i]),h[i]=d[i]=null;for(;i<c;++i)d[i]=e[i],p[i]=h[i]=null}p.update=h,p.parentNode=h.parentNode=d.parentNode=e.parentNode,a.push(p),f.push(h),l.push(d)}var i=-1,s=this.length,o,u;if(!arguments.length){e=new Array(s=(o=this[0]).length);while(++i<s)if(u=o[i])e[i]=u.__data__;return e}var a=St([]),f=at([]),l=at([]);if(typeof e=="function")while(++i<s)n(o=this[i],e.call(o,o.parentNode.__data__,i));else while(++i<s)n(o=this[i],e);return f.enter=function(){return a},f.exit=function(){return l},f},Ss.datum=Ss.map=function(e){return arguments.length<1?this.property("__data__"):this.property("__data__",e)},Ss.filter=function(e){var t=[],n,r,i;typeof e!="function"&&(e=yt(e));for(var s=0,o=this.length;s<o;s++){t.push(n=[]),n.parentNode=(r=this[s]).parentNode;for(var u=0,a=r.length;u<a;u++)(i=r[u])&&e.call(i,i.__data__,u)&&n.push(i)}return at(t)},Ss.order=function(){for(var e=-1,t=this.length;++e<t;)for(var n=this[e],r=n.length-1,i=n[r],s;--r>=0;)if(s=n[r])i&&i!==s.nextSibling&&i.parentNode.insertBefore(s,i),i=s;return this},Ss.sort=function(e){e=bt.apply(this,arguments);for(var t=-1,n=this.length;++t<n;)this[t].sort(e);return this.order()},Ss.on=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t=!1);for(n in e)this.each(wt(n,e[n],t));return this}if(r<2)return(r=this.node()["__on"+e])&&r._;n=!1}return this.each(wt(e,t,n))},Ss.each=function(e){return Et(this,function(t,n,r){e.call(t,t.__data__,n,r)})},Ss.call=function(e){return e.apply(this,(arguments[0]=this,arguments)),this},Ss.empty=function(){return!this.node()},Ss.node=function(e){for(var t=0,n=this.length;t<n;t++)for(var r=this[t],i=0,s=r.length;i<s;i++){var o=r[i];if(o)return o}return null},Ss.transition=function(){var e=[],t,n;for(var r=-1,i=this.length;++r<i;){e.push(t=[]);for(var s=this[r],o=-1,u=s.length;++o<u;)t.push((n=s[o])?{node:n,delay:Ms,duration:_s}:null)}return xt(e,ks||++Cs,Date.now())};var xs=at([[document]]);xs[0].parentNode=bs,d3.select=function(e){return typeof e=="string"?xs.select(e):at([[e]])},d3.selectAll=function(e){return typeof e=="string"?xs.selectAll(e):at([$i(e)])};var Ts=[];d3.selection.enter=St,d3.selection.enter.prototype=Ts,Ts.append=Ss.append,Ts.insert=Ss.insert,Ts.empty=Ss.empty,Ts.node=Ss.node,Ts.select=function(e){var t=[],n,r,i,s,o;for(var u=-1,a=this.length;++u<a;){i=(s=this[u]).update,t.push(n=[]),n.parentNode=s.parentNode;for(var f=-1,l=s.length;++f<l;)(o=s[f])?(n.push(i[f]=r=e.call(s.parentNode,o.__data__,f)),r.__data__=o.__data__):n.push(null)}return at(t)};var Ns=[],Cs=0,ks=0,Ls=0,As=250,Os=d3.ease("cubic-in-out"),Ms=Ls,_s=As,Ds=Os;Ns.call=Ss.call,d3.transition=function(e){return arguments.length?ks?e.transition():e:xs.transition()},d3.transition.prototype=Ns,Ns.select=function(e){var t=[],n,r,i;typeof e!="function"&&(e=ft(e));for(var s=-1,o=this.length;++s<o;){t.push(n=[]);for(var u=this[s],a=-1,f=u.length;++a<f;)(i=u[a])&&(r=e.call(i.node,i.node.__data__,a))?("__data__"in i.node&&(r.__data__=i.node.__data__),n.push({node:r,delay:i.delay,duration:i.duration})):n.push(null)}return xt(t,this.id,this.time).ease(this.ease())},Ns.selectAll=function(e){var t=[],n,r,i;typeof e!="function"&&(e=lt(e));for(var s=-1,o=this.length;++s<o;)for(var u=this[s],a=-1,f=u.length;++a<f;)if(i=u[a]){r=e.call(i.node,i.node.__data__,a),t.push(n=[]);for(var l=-1,c=r.length;++l<c;)n.push({node:r[l],delay:i.delay,duration:i.duration})}return xt(t,this.id,this.time).ease(this.ease())},Ns.filter=function(e){var t=[],n,r,i;typeof e!="function"&&(e=yt(e));for(var s=0,o=this.length;s<o;s++){t.push(n=[]);for(var r=this[s],u=0,a=r.length;u<a;u++)(i=r[u])&&e.call(i.node,i.node.__data__,u)&&n.push(i)}return xt(t,this.id,this.time).ease(this.ease())},Ns.attr=function(e,t){if(arguments.length<2){for(t in e)this.attrTween(t,Ct(e[t],t));return this}return this.attrTween(e,Ct(t,e))},Ns.attrTween=function(e,t){function n(e,n){var r=t.call(this,e,n,this.getAttribute(i));return r===Ps?(this.removeAttribute(i),null):r&&function(e){this.setAttribute(i,r(e))}}function r(e,n){var r=t.call(this,e,n,this.getAttributeNS(i.space,i.local));return r===Ps?(this.removeAttributeNS(i.space,i.local),null):r&&function(e){this.setAttributeNS(i.space,i.local,r(e))}}var i=d3.ns.qualify(e);return this.tween("attr."+e,i.local?r:n)},Ns.style=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t="");for(n in e)this.styleTween(n,Ct(e[n],n),t);return this}n=""}return this.styleTween(e,Ct(t,e),n)},Ns.styleTween=function(e,t,n){return arguments.length<3&&(n=""),this.tween("style."+e,function(r,i){var s=t.call(this,r,i,window.getComputedStyle(this,null).getPropertyValue(e));return s===Ps?(this.style.removeProperty(e),null):s&&function(t){this.style.setProperty(e,s(t),n)}})},Ns.text=function(e){return this.tween("text",function(t,n){this.textContent=typeof e=="function"?e.call(this,t,n):e})},Ns.remove=function(){return this.each("end.transition",function(){var e;!this.__transition__&&(e=this.parentNode)&&e.removeChild(this)})},Ns.delay=function(e){return Et(this,typeof e=="function"?function(t,n,r){t.delay=e.call(t=t.node,t.__data__,n,r)|0}:(e|=0,function(t){t.delay=e}))},Ns.duration=function(e){return Et(this,typeof e=="function"?function(t,n,r){t.duration=Math.max(1,e.call(t=t.node,t.__data__,n,r)|0)}:(e=Math.max(1,e|0),function(t){t.duration=e}))},Ns.transition=function(){return this.select(s)},d3.tween=function(e,t){function n(n,r,i){var s=e.call(this,n,r);return s==null?i!=""&&Ps:i!=s&&t(i,s)}function r(n,r,i){return i!=e&&t(i,e)}return typeof e=="function"?n:e==null?Nt:(e+="",r)};var Ps={},Hs=null,Bs,js;d3.timer=function(e,t,n){var r=!1,i,s=Hs;if(arguments.length<3){if(arguments.length<2)t=0;else if(!isFinite(t))return;n=Date.now()}while(s){if(s.callback===e){s.then=n,s.delay=t,r=!0;break}i=s,s=s.next}r||(Hs={callback:e,then:n,delay:t,next:Hs}),Bs||(js=clearTimeout(js),Bs=1,Fs(kt))},d3.timer.flush=function(){var e,t=Date.now(),n=Hs;while(n)e=t-n.then,n.delay||(n.flush=n.callback(e)),n=n.next;Lt()};var Fs=window.requestAnimationFrame||window.webkitRequestAnimationFrame||
+window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,17)};d3.mouse=function(e){return At(e,_())};var Is=/WebKit/.test(navigator.userAgent)?-1:0;d3.touches=function(e,t){return arguments.length<2&&(t=_().touches),t?$i(t).map(function(t){var n=At(e,t);return n.identifier=t.identifier,n}):[]},d3.scale={},d3.scale.linear=function(){return Ht([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return zt(d3.scale.linear(),Wt)};var qs=d3.format(".0e");Wt.pow=function(e){return Math.pow(10,e)},Xt.pow=function(e){return-Math.pow(10,-e)},d3.scale.pow=function(){return Vt(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return Jt([],{t:"range",a:[[]]})},d3.scale.category10=function(){return d3.scale.ordinal().range(Rs)},d3.scale.category20=function(){return d3.scale.ordinal().range(Us)},d3.scale.category20b=function(){return d3.scale.ordinal().range(zs)},d3.scale.category20c=function(){return d3.scale.ordinal().range(Ws)};var Rs=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Us=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],zs=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],Ws=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return Kt([],[])},d3.scale.quantize=function(){return Qt(0,1,[0,1])},d3.scale.threshold=function(){return Gt([.5],[0,1])},d3.scale.identity=function(){return Yt([0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=t.apply(this,arguments),s=n.apply(this,arguments),o=r.apply(this,arguments)+Xs,u=i.apply(this,arguments)+Xs,a=(u<o&&(a=o,o=u,u=a),u-o),f=a<Math.PI?"0":"1",l=Math.cos(o),c=Math.sin(o),h=Math.cos(u),p=Math.sin(u);return a>=Vs?e?"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"Z":e?"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L"+e*h+","+e*p+"A"+e+","+e+" 0 "+f+",0 "+e*l+","+e*c+"Z":"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L0,0"+"Z"}var t=Zt,n=en,r=tn,i=nn;return e.innerRadius=function(n){return arguments.length?(t=u(n),e):t},e.outerRadius=function(t){return arguments.length?(n=u(t),e):n},e.startAngle=function(t){return arguments.length?(r=u(t),e):r},e.endAngle=function(t){return arguments.length?(i=u(t),e):i},e.centroid=function(){var e=(t.apply(this,arguments)+n.apply(this,arguments))/2,s=(r.apply(this,arguments)+i.apply(this,arguments))/2+Xs;return[Math.cos(s)*e,Math.sin(s)*e]},e};var Xs=-Math.PI/2,Vs=2*Math.PI-1e-6;d3.svg.line=function(){return rn(i)};var $s=d3.map({linear:un,"linear-closed":an,"step-before":fn,"step-after":ln,basis:mn,"basis-open":gn,"basis-closed":yn,bundle:bn,cardinal:pn,"cardinal-open":cn,"cardinal-closed":hn,monotone:Nn});$s.forEach(function(e,t){t.key=e,t.closed=/-closed$/.test(e)});var Js=[0,2/3,1/3,0],Ks=[0,1/3,2/3,0],Qs=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var e=rn(Cn);return e.radius=e.x,delete e.x,e.angle=e.y,delete e.y,e},fn.reverse=ln,ln.reverse=fn,d3.svg.area=function(){return kn(i)},d3.svg.area.radial=function(){var e=kn(Cn);return e.radius=e.x,delete e.x,e.innerRadius=e.x0,delete e.x0,e.outerRadius=e.x1,delete e.x1,e.angle=e.y,delete e.y,e.startAngle=e.y0,delete e.y0,e.endAngle=e.y1,delete e.y1,e},d3.svg.chord=function(){function e(e,u){var a=t(this,s,e,u),f=t(this,o,e,u);return"M"+a.p0+r(a.r,a.p1,a.a1-a.a0)+(n(a,f)?i(a.r,a.p1,a.r,a.p0):i(a.r,a.p1,f.r,f.p0)+r(f.r,f.p1,f.a1-f.a0)+i(f.r,f.p1,a.r,a.p0))+"Z"}function t(e,t,n,r){var i=t.call(e,n,r),s=a.call(e,i,r),o=f.call(e,i,r)+Xs,u=l.call(e,i,r)+Xs;return{r:s,a0:o,a1:u,p0:[s*Math.cos(o),s*Math.sin(o)],p1:[s*Math.cos(u),s*Math.sin(u)]}}function n(e,t){return e.a0==t.a0&&e.a1==t.a1}function r(e,t,n){return"A"+e+","+e+" 0 "+ +(n>Math.PI)+",1 "+t}function i(e,t,n,r){return"Q 0,0 "+r}var s=Ln,o=An,a=On,f=tn,l=nn;return e.radius=function(t){return arguments.length?(a=u(t),e):a},e.source=function(t){return arguments.length?(s=u(t),e):s},e.target=function(t){return arguments.length?(o=u(t),e):o},e.startAngle=function(t){return arguments.length?(f=u(t),e):f},e.endAngle=function(t){return arguments.length?(l=u(t),e):l},e},d3.svg.diagonal=function(){function e(e,i){var s=t.call(this,e,i),o=n.call(this,e,i),u=(s.y+o.y)/2,a=[s,{x:s.x,y:u},{x:o.x,y:u},o];return a=a.map(r),"M"+a[0]+"C"+a[1]+" "+a[2]+" "+a[3]}var t=Ln,n=An,r=Dn;return e.source=function(n){return arguments.length?(t=u(n),e):t},e.target=function(t){return arguments.length?(n=u(t),e):n},e.projection=function(t){return arguments.length?(r=t,e):r},e},d3.svg.diagonal.radial=function(){var e=d3.svg.diagonal(),t=Dn,n=e.projection;return e.projection=function(e){return arguments.length?n(Pn(t=e)):t},e},d3.svg.mouse=d3.mouse,d3.svg.touches=d3.touches,d3.svg.symbol=function(){function e(e,r){return(Gs.get(t.call(this,e,r))||jn)(n.call(this,e,r))}var t=Bn,n=Hn;return e.type=function(n){return arguments.length?(t=u(n),e):t},e.size=function(t){return arguments.length?(n=u(t),e):n},e};var Gs=d3.map({circle:jn,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+ -3*t+","+ -t+"H"+ -t+"V"+ -3*t+"H"+t+"V"+ -t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+ -t+"V"+t+"H"+ -3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*Zs)),n=t*Zs;return"M0,"+ -t+"L"+n+",0"+" 0,"+t+" "+ -n+",0"+"Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+ -t+","+ -t+"L"+t+","+ -t+" "+t+","+t+" "+ -t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/Ys),n=t*Ys/2;return"M0,"+n+"L"+t+","+ -n+" "+ -t+","+ -n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/Ys),n=t*Ys/2;return"M0,"+ -n+"L"+t+","+n+" "+ -t+","+n+"Z"}});d3.svg.symbolTypes=Gs.keys();var Ys=Math.sqrt(3),Zs=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function e(e){e.each(function(){var e=d3.select(this),c=a==null?t.ticks?t.ticks.apply(t,u):t.domain():a,h=f==null?t.tickFormat?t.tickFormat.apply(t,u):String:f,p=qn(t,c,l),d=e.selectAll(".minor").data(p,String),v=d.enter().insert("line","g").attr("class","tick minor").style("opacity",1e-6),m=d3.transition(d.exit()).style("opacity",1e-6).remove(),g=d3.transition(d).style("opacity",1),y=e.selectAll("g").data(c,String),b=y.enter().insert("g","path").style("opacity",1e-6),w=d3.transition(y.exit()).style("opacity",1e-6).remove(),E=d3.transition(y).style("opacity",1),S,x=_t(t),T=e.selectAll(".domain").data([0]),N=T.enter().append("path").attr("class","domain"),C=d3.transition(T),k=t.copy(),L=this.__chart__||k;this.__chart__=k,b.append("line").attr("class","tick"),b.append("text");var A=b.select("line"),O=E.select("line"),M=y.select("text").text(h),_=b.select("text"),D=E.select("text");switch(n){case"bottom":S=Fn,v.attr("y2",i),g.attr("x2",0).attr("y2",i),A.attr("y2",r),_.attr("y",Math.max(r,0)+o),O.attr("x2",0).attr("y2",r),D.attr("x",0).attr("y",Math.max(r,0)+o),M.attr("dy",".71em").attr("text-anchor","middle"),C.attr("d","M"+x[0]+","+s+"V0H"+x[1]+"V"+s);break;case"top":S=Fn,v.attr("y2",-i),g.attr("x2",0).attr("y2",-i),A.attr("y2",-r),_.attr("y",-(Math.max(r,0)+o)),O.attr("x2",0).attr("y2",-r),D.attr("x",0).attr("y",-(Math.max(r,0)+o)),M.attr("dy","0em").attr("text-anchor","middle"),C.attr("d","M"+x[0]+","+ -s+"V0H"+x[1]+"V"+ -s);break;case"left":S=In,v.attr("x2",-i),g.attr("x2",-i).attr("y2",0),A.attr("x2",-r),_.attr("x",-(Math.max(r,0)+o)),O.attr("x2",-r).attr("y2",0),D.attr("x",-(Math.max(r,0)+o)).attr("y",0),M.attr("dy",".32em").attr("text-anchor","end"),C.attr("d","M"+ -s+","+x[0]+"H0V"+x[1]+"H"+ -s);break;case"right":S=In,v.attr("x2",i),g.attr("x2",i).attr("y2",0),A.attr("x2",r),_.attr("x",Math.max(r,0)+o),O.attr("x2",r).attr("y2",0),D.attr("x",Math.max(r,0)+o).attr("y",0),M.attr("dy",".32em").attr("text-anchor","start"),C.attr("d","M"+s+","+x[0]+"H0V"+x[1]+"H"+s)}if(t.ticks)b.call(S,L),E.call(S,k),w.call(S,k),v.call(S,L),g.call(S,k),m.call(S,k);else{var P=k.rangeBand()/2,H=function(e){return k(e)+P};b.call(S,H),E.call(S,H)}})}var t=d3.scale.linear(),n="bottom",r=6,i=6,s=6,o=3,u=[10],a=null,f,l=0;return e.scale=function(n){return arguments.length?(t=n,e):t},e.orient=function(t){return arguments.length?(n=t,e):n},e.ticks=function(){return arguments.length?(u=arguments,e):u},e.tickValues=function(t){return arguments.length?(a=t,e):a},e.tickFormat=function(t){return arguments.length?(f=t,e):f},e.tickSize=function(t,n,o){if(!arguments.length)return r;var u=arguments.length-1;return r=+t,i=u>1?+n:r,s=u>0?+arguments[u]:r,e},e.tickPadding=function(t){return arguments.length?(o=+t,e):o},e.tickSubdivide=function(t){return arguments.length?(l=+t,e):l},e},d3.svg.brush=function(){function e(s){s.each(function(){var s=d3.select(this),f=s.selectAll(".background").data([0]),l=s.selectAll(".extent").data([0]),c=s.selectAll(".resize").data(a,String),h;s.style("pointer-events","all").on("mousedown.brush",i).on("touchstart.brush",i),f.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),l.enter().append("rect").attr("class","extent").style("cursor","move"),c.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return eo[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),c.style("display",e.empty()?"none":null),c.exit().remove(),o&&(h=_t(o),f.attr("x",h[0]).attr("width",h[1]-h[0]),n(s)),u&&(h=_t(u),f.attr("y",h[0]).attr("height",h[1]-h[0]),r(s)),t(s)})}function t(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+f[+/e$/.test(e)][0]+","+f[+/^s/.test(e)][1]+")"})}function n(e){e.select(".extent").attr("x",f[0][0]),e.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1][0]-f[0][0])}function r(e){e.select(".extent").attr("y",f[0][1]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1][1]-f[0][1])}function i(){function i(){var e=d3.event.changedTouches;return e?d3.touches(v,e)[0]:d3.mouse(v)}function a(){d3.event.keyCode==32&&(S||(x=null,T[0]-=f[1][0],T[1]-=f[1][1],S=2),M())}function c(){d3.event.keyCode==32&&S==2&&(T[0]+=f[1][0],T[1]+=f[1][1],S=0,M())}function h(){var e=i(),s=!1;N&&(e[0]+=N[0],e[1]+=N[1]),S||(d3.event.altKey?(x||(x=[(f[0][0]+f[1][0])/2,(f[0][1]+f[1][1])/2]),T[0]=f[+(e[0]<x[0])][0],T[1]=f[+(e[1]<x[1])][1]):x=null),w&&p(e,o,0)&&(n(y),s=!0),E&&p(e,u,1)&&(r(y),s=!0),s&&(t(y),g({type:"brush",mode:S?"move":"resize"}))}function p(e,t,n){var r=_t(t),i=r[0],s=r[1],o=T[n],u=f[1][n]-f[0][n],a,c;S&&(i-=o,s-=u+o),a=Math.max(i,Math.min(s,e[n])),S?c=(a+=o)+u:(x&&(o=Math.max(i,Math.min(s,2*x[n]-a))),o<a?(c=a,a=o):c=o);if(f[0][n]!==a||f[1][n]!==c)return l=null,f[0][n]=a,f[1][n]=c,!0}function d(){h(),y.style("pointer-events","all").selectAll(".resize").style("display",e.empty()?"none":null),d3.select("body").style("cursor",null),C.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),g({type:"brushend"}),M()}var v=this,m=d3.select(d3.event.target),g=s.of(v,arguments),y=d3.select(v),b=m.datum(),w=!/^(n|s)$/.test(b)&&o,E=!/^(e|w)$/.test(b)&&u,S=m.classed("extent"),x,T=i(),N,C=d3.select(window).on("mousemove.brush",h).on("mouseup.brush",d).on("touchmove.brush",h).on("touchend.brush",d).on("keydown.brush",a).on("keyup.brush",c);if(S)T[0]=f[0][0]-T[0],T[1]=f[0][1]-T[1];else if(b){var k=+/w$/.test(b),L=+/^n/.test(b);N=[f[1-k][0]-T[0],f[1-L][1]-T[1]],T[0]=f[k][0],T[1]=f[L][1]}else d3.event.altKey&&(x=T.slice());y.style("pointer-events","none").selectAll(".resize").style("display",null),d3.select("body").style("cursor",m.style("cursor")),g({type:"brushstart"}),h(),M()}var s=D(e,"brushstart","brush","brushend"),o=null,u=null,a=to[0],f=[[0,0],[0,0]],l;return e.x=function(t){return arguments.length?(o=t,a=to[!o<<1|!u],e):o},e.y=function(t){return arguments.length?(u=t,a=to[!o<<1|!u],e):u},e.extent=function(t){var n,r,i,s,a;return arguments.length?(l=[[0,0],[0,0]],o&&(n=t[0],r=t[1],u&&(n=n[0],r=r[0]),l[0][0]=n,l[1][0]=r,o.invert&&(n=o(n),r=o(r)),r<n&&(a=n,n=r,r=a),f[0][0]=n|0,f[1][0]=r|0),u&&(i=t[0],s=t[1],o&&(i=i[1],s=s[1]),l[0][1]=i,l[1][1]=s,u.invert&&(i=u(i),s=u(s)),s<i&&(a=i,i=s,s=a),f[0][1]=i|0,f[1][1]=s|0),e):(t=l||f,o&&(n=t[0][0],r=t[1][0],l||(n=f[0][0],r=f[1][0],o.invert&&(n=o.invert(n),r=o.invert(r)),r<n&&(a=n,n=r,r=a))),u&&(i=t[0][1],s=t[1][1],l||(i=f[0][1],s=f[1][1],u.invert&&(i=u.invert(i),s=u.invert(s)),s<i&&(a=i,i=s,s=a))),o&&u?[[n,i],[r,s]]:o?[n,r]:u&&[i,s])},e.clear=function(){return l=null,f[0][0]=f[0][1]=f[1][0]=f[1][1]=0,e},e.empty=function(){return o&&f[0][0]===f[1][0]||u&&f[0][1]===f[1][1]},d3.rebind(e,s,"on")};var eo={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},to=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];d3.behavior={},d3.behavior.drag=function(){function e(){this.on("mousedown.drag",t).on("touchstart.drag",t)}function t(){function e(){var e=o.parentNode;return f?d3.touches(e).filter(function(e){return e.identifier===f})[0]:d3.mouse(e)}function t(){if(!o.parentNode)return i();var t=e(),n=t[0]-c[0],r=t[1]-c[1];h|=n|r,c=t,M(),u({type:"drag",x:t[0]+l[0],y:t[1]+l[1],dx:n,dy:r})}function i(){u({type:"dragend"}),h&&(M(),d3.event.target===a&&p.on("click.drag",s,!0)),p.on(f?"touchmove.drag-"+f:"mousemove.drag",null).on(f?"touchend.drag-"+f:"mouseup.drag",null)}function s(){M(),p.on("click.drag",null)}var o=this,u=n.of(o,arguments),a=d3.event.target,f=d3.event.touches&&d3.event.changedTouches[0].identifier,l,c=e(),h=0,p=d3.select(window).on(f?"touchmove.drag-"+f:"mousemove.drag",t).on(f?"touchend.drag-"+f:"mouseup.drag",i,!0);r?(l=r.apply(o,arguments),l=[l.x-c[0],l.y-c[1]]):l=[0,0],f||M(),u({type:"dragstart"})}var n=D(e,"drag","dragstart","dragend"),r=null;return e.origin=function(t){return arguments.length?(r=t,e):r},d3.rebind(e,n,"on")},d3.behavior.zoom=function(){function e(){this.on("mousedown.zoom",o).on("mousewheel.zoom",u).on("mousemove.zoom",a).on("DOMMouseScroll.zoom",u).on("dblclick.zoom",f).on("touchstart.zoom",l).on("touchmove.zoom",c).on("touchend.zoom",l)}function t(e){return[(e[0]-h[0])/d,(e[1]-h[1])/d]}function n(e){return[e[0]*d+h[0],e[1]*d+h[1]]}function r(e){d=Math.max(m[0],Math.min(m[1],e))}function i(e,t){t=n(t),h[0]+=e[0]-t[0],h[1]+=e[1]-t[1]}function s(e){b&&b.domain(y.range().map(function(e){return(e-h[0])/d}).map(y.invert)),E&&E.domain(w.range().map(function(e){return(e-h[1])/d}).map(w.invert)),d3.event.preventDefault(),e({type:"zoom",scale:d,translate:h})}function o(){function e(){f=1,i(d3.mouse(o),c),s(u)}function n(){f&&M(),l.on("mousemove.zoom",null).on("mouseup.zoom",null),f&&d3.event.target===a&&l.on("click.zoom",r,!0)}function r(){M(),l.on("click.zoom",null)}var o=this,u=g.of(o,arguments),a=d3.event.target,f=0,l=d3.select(window).on("mousemove.zoom",e).on("mouseup.zoom",n),c=t(d3.mouse(o));window.focus(),M()}function u(){p||(p=t(d3.mouse(this))),r(Math.pow(2,Rn()*.002)*d),i(d3.mouse(this),p),s(g.of(this,arguments))}function a(){p=null}function f(){var e=d3.mouse(this),n=t(e);r(d3.event.shiftKey?d/2:d*2),i(e,n),s(g.of(this,arguments))}function l(){var e=d3.touches(this),n=Date.now();v=d,p={},e.forEach(function(e){p[e.identifier]=t(e)}),M();if(e.length===1){if(n-S<500){var o=e[0],u=t(e[0]);r(d*2),i(o,u),s(g.of(this,arguments))}S=n}}function c(){var e=d3.touches(this),t=e[0],n=p[t.identifier];if(o=e[1]){var o,u=p[o.identifier];t=[(t[0]+o[0])/2,(t[1]+o[1])/2],n=[(n[0]+u[0])/2,(n[1]+u[1])/2],r(d3.event.scale*v)}i(t,n),S=null,s(g.of(this,arguments))}var h=[0,0],p,d=1,v,m=ro,g=D(e,"zoom"),y,b,w,E,S;return e.translate=function(t){return arguments.length?(h=t.map(Number),e):h},e.scale=function(t){return arguments.length?(d=+t,e):d},e.scaleExtent=function(t){return arguments.length?(m=t==null?ro:t.map(Number),e):m},e.x=function(t){return arguments.length?(b=t,y=t.copy(),e):b},e.y=function(t){return arguments.length?(E=t,w=t.copy(),e):E},d3.rebind(e,g,"on")};var no,ro=[0,Infinity];d3.layout={},d3.layout.bundle=function(){return function(e){var t=[],n=-1,r=e.length;while(++n<r)t.push(Un(e[n]));return t}},d3.layout.chord=function(){function e(){var e={},n=[],c=d3.range(o),h=[],p,d,v,m,g;r=[],i=[],p=0,m=-1;while(++m<o){d=0,g=-1;while(++g<o)d+=s[m][g];n.push(d),h.push(d3.range(o)),p+=d}a&&c.sort(function(e,t){return a(n[e],n[t])}),f&&h.forEach(function(e,t){e.sort(function(e,n){return f(s[t][e],s[t][n])})}),p=(2*Math.PI-u*o)/p,d=0,m=-1;while(++m<o){v=d,g=-1;while(++g<o){var y=c[m],b=h[y][g],w=s[y][b],E=d,S=d+=w*p;e[y+"-"+b]={index:y,subindex:b,startAngle:E,endAngle:S,value:w}}i[y]={index:y,startAngle:v,endAngle:d,value:(d-v)/p},d+=u}m=-1;while(++m<o){g=m-1;while(++g<o){var x=e[m+"-"+g],T=e[g+"-"+m];(x.value||T.value)&&r.push(x.value<T.value?{source:T,target:x}:{source:x,target:T})}}l&&t()}function t(){r.sort(function(e,t){return l((e.source.value+e.target.value)/2,(t.source.value+t.target.value)/2)})}var n={},r,i,s,o,u=0,a,f,l;return n.matrix=function(e){return arguments.length?(o=(s=e)&&s.length,r=i=null,n):s},n.padding=function(e){return arguments.length?(u=e,r=i=null,n):u},n.sortGroups=function(e){return arguments.length?(a=e,r=i=null,n):a},n.sortSubgroups=function(e){return arguments.length?(f=e,r=null,n):f},n.sortChords=function(e){return arguments.length?(l=e,r&&t(),n):l},n.chords=function(){return r||e(),r},n.groups=function(){return i||e(),i},n},d3.layout.force=function(){function e(e){return function(t,n,r,i,s){if(t.point!==e){var o=t.cx-e.x,u=t.cy-e.y,a=1/Math.sqrt(o*o+u*u);if((i-n)*a<d){var f=t.charge*a*a;return e.px-=o*f,e.py-=u*f,!0}if(t.point&&isFinite(a)){var f=t.pointCharge*a*a;e.px-=o*f,e.py-=u*f}}return!t.charge}}function t(e){e.px=d3.event.x,e.py=d3.event.y,n.resume()}var n={},r=d3.dispatch("start","tick","end"),s=[1,1],o,a,f=.9,l=Qn,c=Gn,h=-30,p=.1,d=.8,v,m=[],g=[],y,b,w;return n.tick=function(){if((a*=.99)<.005)return r.end({type:"end",alpha:a=0}),!0;var t=m.length,n=g.length,i,o,u,l,c,d,v,E,S;for(o=0;o<n;++o){u=g[o],l=u.source,c=u.target,E=c.x-l.x,S=c.y-l.y;if(d=E*E+S*S)d=a*b[o]*((d=Math.sqrt(d))-y[o])/d,E*=d,S*=d,c.x-=E*(v=l.weight/(c.weight+l.weight)),c.y-=S*v,l.x+=E*(v=1-v),l.y+=S*v}if(v=a*p){E=s[0]/2,S=s[1]/2,o=-1;if(v)while(++o<t)u=m[o],u.x+=(E-u.x)*v,u.y+=(S-u.y)*v}if(h){Kn(i=d3.geom.quadtree(m),a,w),o=-1;while(++o<t)(u=m[o]).fixed||i.visit(e(u))}o=-1;while(++o<t)u=m[o],u.fixed?(u.x=u.px,u.y=u.py):(u.x-=(u.px-(u.px=u.x))*f,u.y-=(u.py-(u.py=u.y))*f);r.tick({type:"tick",alpha:a})},n.nodes=function(e){return arguments.length?(m=e,n):m},n.links=function(e){return arguments.length?(g=e,n):g},n.size=function(e){return arguments.length?(s=e,n):s},n.linkDistance=function(e){return arguments.length?(l=u(e),n):l},n.distance=n.linkDistance,n.linkStrength=function(e){return arguments.length?(c=u(e),n):c},n.friction=function(e){return arguments.length?(f=e,n):f},n.charge=function(e){return arguments.length?(h=typeof e=="function"?e:+e,n):h},n.gravity=function(e){return arguments.length?(p=e,n):p},n.theta=function(e){return arguments.length?(d=e,n):d},n.alpha=function(e){return arguments.length?(a?e>0?a=e:a=0:e>0&&(r.start({type:"start",alpha:a=e}),d3.timer(n.tick)),n):a},n.start=function(){function e(e,n){var i=t(r),s=-1,o=i.length,u;while(++s<o)if(!isNaN(u=i[s][e]))return u;return Math.random()*n}function t(){if(!p){p=[];for(i=0;i<o;++i)p[i]=[];for(i=0;i<u;++i){var e=g[i];p[e.source.index].push(e.target),p[e.target.index].push(e.source)}}return p[r]}var r,i,o=m.length,u=g.length,a=s[0],f=s[1],p,d;for(r=0;r<o;++r)(d=m[r]).index=r,d.weight=0;y=[],b=[];for(r=0;r<u;++r)d=g[r],typeof d.source=="number"&&(d.source=m[d.source]),typeof d.target=="number"&&(d.target=m[d.target]),y[r]=l.call(this,d,r),b[r]=c.call(this,d,r),++d.source.weight,++d.target.weight;for(r=0;r<o;++r)d=m[r],isNaN(d.x)&&(d.x=e("x",a)),isNaN(d.y)&&(d.y=e("y",f)),isNaN(d.px)&&(d.px=d.x),isNaN(d.py)&&(d.py=d.y);w=[];if(typeof h=="function")for(r=0;r<o;++r)w[r]=+h.call(this,m[r],r);else for(r=0;r<o;++r)w[r]=h;return n.resume()},n.resume=function(){return n.alpha(.1)},n.stop=function(){return n.alpha(0)},n.drag=function(){o||(o=d3.behavior.drag().origin(i).on("dragstart",Xn).on("drag",t).on("dragend",Vn)),this.on("mouseover.force",$n).on("mouseout.force",Jn).call(o)},d3.rebind(n,r,"on")},d3.layout.partition=function(){function e(t,n,r,i){var s=t.children;t.x=n,t.y=t.depth*i,t.dx=r,t.dy=i;if(s&&(u=s.length)){var o=-1,u,a,f;r=t.value?r/t.value:0;while(++o<u)e(a=s[o],n,f=a.value*r,i),n+=f}}function t(e){var n=e.children,r=0;if(n&&(s=n.length)){var i=-1,s;while(++i<s)r=Math.max(r,t(n[i]))}return 1+r}function n(n,s){var o=r.call(this,n,s);return e(o[0],0,i[0],i[1]/t(o[0])),o}var r=d3.layout.hierarchy(),i=[1,1];return n.size=function(e){return arguments.length?(i=e,n):i},fr(n,r)},d3.layout.pie=function(){function e(s,o){var u=s.map(function(n,r){return+t.call(e,n,r)}),a=+(typeof r=="function"?r.apply(this,arguments):r),f=((typeof i=="function"?i.apply(this,arguments):i)-r)/d3.sum(u),l=d3.range(s.length);n!=null&&l.sort(n===io?function(e,t){return u[t]-u[e]}:function(e,t){return n(s[e],s[t])});var c=[];return l.forEach(function(e){var t;c[e]={data:s[e],value:t=u[e],startAngle:a,endAngle:a+=t*f}}),c}var t=Number,n=io,r=0,i=2*Math.PI;return e.value=function(n){return arguments.length?(t=n,e):t},e.sort=function(t){return arguments.length?(n=t,e):n},e.startAngle=function(t){return arguments.length?(r=t,e):r},e.endAngle=function(t){return arguments.length?(i=t,e):i},e};var io={};d3.layout.stack=function(){function e(i,a){var f=i.map(function(n,r){return t.call(e,n,r)}),l=f.map(function(t,n){return t.map(function(t,n){return[o.call(e,t,n),u.call(e,t,n)]})}),c=n.call(e,l,a);f=d3.permute(f,c),l=d3.permute(l,c);var h=r.call(e,l,a),p=f.length,d=f[0].length,v,m,g;for(m=0;m<d;++m){s.call(e,f[0][m],g=h[m],l[0][m][1]);for(v=1;v<p;++v)s.call(e,f[v][m],g+=l[v-1][m][1],l[v][m][1])}return i}var t=i,n=tr,r=nr,s=er,o=Yn,u=Zn;return e.values=function(n){return arguments.length?(t=n,e):t},e.order=function(t){return arguments.length?(n=typeof t=="function"?t:so.get(t)||tr,e):n},e.offset=function(t){return arguments.length?(r=typeof t=="function"?t:oo.get(t)||nr,e):r},e.x=function(t){return arguments.length?(o=t,e):o},e.y=function(t){return arguments.length?(u=t,e):u},e.out=function(t){return arguments.length?(s=t,e):s},e};var so=d3.map({"inside-out":function(e){var t=e.length,n,r,i=e.map(rr),s=e.map(ir),o=d3.range(t).sort(function(e,t){return i[e]-i[t]}),u=0,a=0,f=[],l=[];for(n=0;n<t;++n)r=o[n],u<a?(u+=s[r],f.push(r)):(a+=s[r],l.push(r));return l.reverse().concat(f)},reverse:function(e){return d3.range(e.length).reverse()},"default":tr}),oo=d3.map({silhouette:function(e){var t=e.length,n=e[0].length,r=[],i=0,s,o,u,a=[];for(o=0;o<n;++o){for(s=0,u=0;s<t;s++)u+=e[s][o][1];u>i&&(i=u),r.push(u)}for(o=0;o<n;++o)a[o]=(i-r[o])/2;return a},wiggle:function(e){var t=e.length,n=e[0],r=n.length,i=0,s,o,u,a,f,l,c,h,p,d=[];d[0]=h=p=0;for(o=1;o<r;++o){for(s=0,a=0;s<t;++s)a+=e[s][o][1];for(s=0,f=0,c=n[o][0]-n[o-1][0];s<t;++s){for(u=0,l=(e[s][o][1]-e[s][o-1][1])/(2*c);u<s;++u)l+=(e[u][o][1]-e[u][o-1][1])/c;f+=l*e[s][o][1]}d[o]=h-=a?f/a*c:0,h<p&&(p=h)}for(o=0;o<r;++o)d[o]-=p;return d},expand:function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,u=[];for(s=0;s<n;++s){for(i=0,o=0;i<t;i++)o+=e[i][s][1];if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)u[s]=0;return u},zero:nr});d3.layout.histogram=function(){function e(e,s){var o=[],u=e.map(n,this),a=r.call(this,u,s),f=i.call(this,a,u,s),l,s=-1,c=u.length,h=f.length-1,p=t?1:1/c,d;while(++s<h)l=o[s]=[],l.dx=f[s+1]-(l.x=f[s]),l.y=0;if(h>0){s=-1;while(++s<c)d=u[s],d>=a[0]&&d<=a[1]&&(l=o[d3.bisect(f,d,1,h)-1],l.y+=p,l.push(e[s]))}return o}var t=!0,n=Number,r=ar,i=or;return e.value=function(t){return arguments.length?(n=t,e):n},e.range=function(t){return arguments.length?(r=u(t),e):r},e.bins=function(t){return arguments.length?(i=typeof t=="number"?function(e){return ur(e,t)}:u(t),e):i},e.frequency=function(n){return arguments.length?(t=!!n,e):t},e},d3.layout.hierarchy=function(){function e(t,o,u){var a=i.call(n,t,o),f=uo?t:{data:t};f.depth=o,u.push(f);if(a&&(c=a.length)){var l=-1,c,h=f.children=[],p=0,d=o+1,v;while(++l<c)v=e(a[l],d,u),v.parent=f,h.push(v),p+=v.value;r&&h.sort(r),s&&(f.value=p)}else s&&(f.value=+s.call(n,t,o)||0);return f}function t(e,r){var i=e.children,o=0;if(i&&(a=i.length)){var u=-1,a,f=r+1;while(++u<a)o+=t(i[u],f)}else s&&(o=+s.call(n,uo?e:e.data,r)||0);return s&&(e.value=o),o}function n(t){var n=[];return e(t,0,n),n}var r=hr,i=lr,s=cr;return n.sort=function(e){return arguments.length?(r=e,n):r},n.children=function(e){return arguments.length?(i=e,n):i},n.value=function(e){return arguments.length?(s=e,n):s},n.revalue=function(e){return t(e,0),e},n};var uo=!1;d3.layout.pack=function(){function e(e,i){var s=t.call(this,e,i),o=s[0];o.x=0,o.y=0,Pr(o,function(e){e.r=Math.sqrt(e.value)}),Pr(o,yr);var u=r[0],a=r[1],f=Math.max(2*o.r/u,2*o.r/a);if(n>0){var l=n*f/2;Pr(o,function(e){e.r+=l}),Pr(o,yr),Pr(o,function(e){e.r-=l}),f=Math.max(2*o.r/u,2*o.r/a)}return Er(o,u/2,a/2,1/f),s}var t=d3.layout.hierarchy().sort(dr),n=0,r=[1,1];return e.size=function(t){return arguments.length?(r=t,e):r},e.padding=function(t){return arguments.length?(n=+t,e):n},fr(e,t)},d3.layout.cluster=function(){function e(e,i){var s=t.call(this,e,i),o=s[0],u,a=0,f,l;Pr(o,function(e){var t=e.children;t&&t.length?(e.x=Tr(t),e.y=xr(t)):(e.x=u?a+=n(e,u):0,e.y=0,u=e)});var c=Nr(o),h=Cr(o),p=c.x-n(c,h)/2,d=h.x+n(h,c)/2;return Pr(o,function(e){e.x=(e.x-p)/(d-p)*r[0],e.y=(1-(o.y?e.y/o.y:1))*r[1]}),s}var t=d3.layout.hierarchy().sort(null).value(null),n=kr,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},fr(e,t)},d3.layout.tree=function(){function e(e,i){function s(e,t){var r=e.children,i=e._tree;if(r&&(o=r.length)){var o,a=r[0],f,l=a,c,h=-1;while(++h<o)c=r[h],s(c,f),l=u(c,f,l),f=c;Hr(e);var p=.5*(a._tree.prelim+c._tree.prelim);t?(i.prelim=t._tree.prelim+n(e,t),i.mod=i.prelim-p):i.prelim=p}else t&&(i.prelim=t._tree.prelim+n(e,t))}function o(e,t){e.x=e._tree.prelim+t;var n=e.children;if(n&&(i=n.length)){var r=-1,i;t+=e._tree.mod;while(++r<i)o(n[r],t)}}function u(e,t,r){if(t){var i=e,s=e,o=t,u=e.parent.children[0],a=i._tree.mod,f=s._tree.mod,l=o._tree.mod,c=u._tree.mod,h;while(o=Ar(o),i=Lr(i),o&&i)u=Lr(u),s=Ar(s),s._tree.ancestor=e,h=o._tree.prelim+l-i._tree.prelim-a+n(o,i),h>0&&(Br(jr(o,e,r),e,h),a+=h,f+=h),l+=o._tree.mod,a+=i._tree.mod,c+=u._tree.mod,f+=s._tree.mod;o&&!Ar(s)&&(s._tree.thread=o,s._tree.mod+=l-f),i&&!Lr(u)&&(u._tree.thread=i,u._tree.mod+=a-c,r=e)}return r}var a=t.call(this,e,i),f=a[0];Pr(f,function(e,t){e._tree={ancestor:e,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),s(f),o(f,-f._tree.prelim);var l=Or(f,_r),c=Or(f,Mr),h=Or(f,Dr),p=l.x-n(l,c)/2,d=c.x+n(c,l)/2,v=h.depth||1;return Pr(f,function(e){e.x=(e.x-p)/(d-p)*r[0],e.y=e.depth/v*r[1],delete e._tree}),a}var t=d3.layout.hierarchy().sort(null).value(null),n=kr,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},fr(e,t)},d3.layout.treemap=function(){function e(e,t){var n=-1,r=e.length,i,s;while(++n<r)s=(i=e[n]).value*(t<0?0:t),i.area=isNaN(s)||s<=0?0:s}function t(n){var s=n.children;if(s&&s.length){var o=l(n),u=[],a=s.slice(),f,c=Infinity,h,p=Math.min(o.dx,o.dy),d;e(a,o.dx*o.dy/n.value),u.area=0;while((d=a.length)>0)u.push(f=a[d-1]),u.area+=f.area,(h=r(u,p))<=c?(a.pop(),c=h):(u.area-=u.pop().area,i(u,p,o,!1),p=Math.min(o.dx,o.dy),u.length=u.area=0,c=Infinity);u.length&&(i(u,p,o,!0),u.length=u.area=0),s.forEach(t)}}function n(t){var r=t.children;if(r&&r.length){var s=l(t),o=r.slice(),u,a=[];e(o,s.dx*s.dy/t.value),a.area=0;while(u=o.pop())a.push(u),a.area+=u.area,u.z!=null&&(i(a,u.z?s.dx:s.dy,s,!o.length),a.length=a.area=0);r.forEach(n)}}function r(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++o<u){if(!(r=e[o].area))continue;r<s&&(s=r),r>i&&(i=r)}return n*=n,t*=t,n?Math.max(t*i*p/n,n/(t*s*p)):Infinity}function i(e,t,n,r){var i=-1,s=e.length,o=n.x,a=n.y,f=t?u(e.area/t):0,l;if(t==n.dx){if(r||f>n.dy)f=n.dy;while(++i<s)l=e[i],l.x=o,l.y=a,l.dy=f,o+=l.dx=Math.min(n.x+n.dx-o,f?u(l.area/f):0);l.z=!0,l.dx+=n.x+n.dx-o,n.y+=f,n.dy-=f}else{if(r||f>n.dx)f=n.dx;while(++i<s)l=e[i],l.x=o,l.y=a,l.dx=f,a+=l.dy=Math.min(n.y+n.dy-a,f?u(l.area/f):0);l.z=!1,l.dy+=n.y+n.dy-a,n.x+=f,n.dx-=f}}function s(r){var i=h||o(r),s=i[0];return s.x=0,s.y=0,s.dx=a[0],s.dy=a[1],h&&o.revalue(s),e([s],s.dx*s.dy/s.value),(h?n:t)(s),c&&(h=i),i}var o=d3.layout.hierarchy(),u=Math.round,a=[1,1],f=null,l=Fr,c=!1,h,p=.5*(1+Math.sqrt(5));return s.size=function(e){return arguments.length?(a=e,s):a},s.padding=function(e){function t(t){var n=e.call(s,t,t.depth);return n==null?Fr(t):Ir(t,typeof n=="number"?[n,n,n,n]:n)}function n(t){return Ir(t,e)}if(!arguments.length)return f;var r;return l=(f=e)==null?Fr:(r=typeof e)==="function"?t:r==="number"?(e=[e,e,e,e],n):n,s},s.round=function(e){return arguments.length?(u=e?Math.round:Number,s):u!=Number},s.sticky=function(e){return arguments.length?(c=e,h=null,s):c},s.ratio=function(e){return arguments.length?(p=e,s):p},fr(s,o)},d3.csv=qr(",","text/csv"),d3.tsv=qr(" ","text/tab-separated-values"),d3.geo={};var ao=Math.PI/180;d3.geo.azimuthal=function(){function e(e){var n=e[0]*ao-s,o=e[1]*ao,f=Math.cos(n),l=Math.sin(n),c=Math.cos(o),h=Math.sin(o),p=t!=="orthographic"?a*h+u*c*f:null,d,v=t==="stereographic"?1/(1+p):t==="gnomonic"?1/p:t==="equidistant"?(d=Math.acos(p),d?d/Math.sin(d):0):t==="equalarea"?Math.sqrt(2/(1+p)):1,m=v*c*l,g=v*(a*c*f-u*h);return[r*m+i[0],r*g+i[1]]}var t="orthographic",n,r=200,i=[480,250],s,o,u,a;return e.invert=function(e){var n=(e[0]-i[0])/r,o=(e[1]-i[1])/r,f=Math.sqrt(n*n+o*o),l=t==="stereographic"?2*Math.atan(f):t==="gnomonic"?Math.atan(f):t==="equidistant"?f:t==="equalarea"?2*Math.asin(.5*f):Math.asin(f),c=Math.sin(l),h=Math.cos(l);return[(s+Math.atan2(n*c,f*u*h+o*a*c))/ao,Math.asin(h*a-(f?o*c*u/f:0))/ao]},e.mode=function(n){return arguments.length?(t=n+"",e):t},e.origin=function(t){return arguments.length?(n=t,s=n[0]*ao,o=n[1]*ao,u=Math.cos(o),a=Math.sin(o),e):n},e.scale=function(t){return arguments.length?(r=+t,e):r},e.translate=function(t){return arguments.length?(i=[+t[0],+t[1]],e):i},e.origin([0,0])},d3.geo.albers=function(){function e(e){var t=u*(ao*e[0]-o),n=Math.sqrt(a-2*u*Math.sin(ao*e[1]))/u;return[i*n*Math.sin(t)+s[0],i*(n*Math.cos(t)-f)+s[1]]}function t(){var t=ao*r[0],i=ao*r[1],s=ao*n[1],l=Math.sin(t),c=Math.cos(t);return o=ao*n[0],u=.5*(l+Math.sin(i)),a=c*c+2*u*l,f=Math.sqrt(a-2*u*Math.sin(s))/u,e}var n=[-98,38],r=[29.5,45.5],i=1e3,s=[480,250],o,u,a,f;return e.invert=function(e){var t=(e[0]-s[0])/i,n=(e[1]-s[1])/i,r=f+n,l=Math.atan2(t,r),c=Math.sqrt(t*t+r*r);return[(o+l/u)/ao,Math.asin((a-c*c*u*u)/(2*u))/ao]},e.origin=function(e){return arguments.length?(n=[+e[0],+e[1]],t()):n},e.parallels=function(e){return arguments.length?(r=[+e[0],+e[1]],t()):r},e.scale=function(t){return arguments.length?(i=+t,e):i},e.translate=function(t){return arguments.length?(s=[+t[0],+t[1]],e):s},t()},d3.geo.albersUsa=function(){function e(e){var s=e[0],o=e[1];return(o>50?n:s<-140?r:o<21?i:t)(e)}var t=d3.geo.albers(),n=d3.geo.albers().origin([-160,60]).parallels([55,65]),r=d3.geo.albers().origin([-160,20]).parallels([8,18]),i=d3.geo.albers().origin([-60,10]).parallels([8,18]);return e.scale=function(s){return arguments.length?(t.scale(s),n.scale(s*.6),r.scale(s),i.scale(s*1.5),e.translate(t.translate())):t.scale()},e.translate=function(s){if(!arguments.length)return t.translate();var o=t.scale()/1e3,u=s[0],a=s[1];return t.translate(s),n.translate([u-400*o,a+170*o]),r.translate([u-190*o,a+200*o]),i.translate([u+580*o,a+430*o]),e},e.scale(t.scale())},d3.geo.bonne=function(){function e(e){var u=e[0]*ao-r,a=e[1]*ao-i;if(s){var f=o+s-a,l=u*Math.cos(a)/f;u=f*Math.sin(l),a=f*Math.cos(l)-o}else u*=Math.cos(a),a*=-1;return[t*u+n[0],t*a+n[1]]}var t=200,n=[480,250],r,i,s,o;return e.invert=function(e){var i=(e[0]-n[0])/t,u=(e[1]-n[1])/t;if(s){var a=o+u,f=Math.sqrt(i*i+a*a);u=o+s-f,i=r+f*Math.atan2(i,a)/Math.cos(u)}else u*=-1,i/=Math.cos(u);return[i/ao,u/ao]},e.parallel=function(t){return arguments.length?(o=1/Math.tan
+(s=t*ao),e):s/ao},e.origin=function(t){return arguments.length?(r=t[0]*ao,i=t[1]*ao,e):[r/ao,i/ao]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e.origin([0,0]).parallel(45)},d3.geo.equirectangular=function(){function e(e){var r=e[0]/360,i=-e[1]/360;return[t*r+n[0],t*i+n[1]]}var t=500,n=[480,250];return e.invert=function(e){var r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return[360*r,-360*i]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e},d3.geo.mercator=function(){function e(e){var r=e[0]/360,i=-(Math.log(Math.tan(Math.PI/4+e[1]*ao/2))/ao)/360;return[t*r+n[0],t*Math.max(-0.5,Math.min(.5,i))+n[1]]}var t=500,n=[480,250];return e.invert=function(e){var r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return[360*r,2*Math.atan(Math.exp(-360*i*ao))/ao-90]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e},d3.geo.path=function(){function e(e,t){typeof s=="function"&&(o=Ur(s.apply(this,arguments))),f(e);var n=a.length?a.join(""):null;return a=[],n}function t(e){return u(e).join(",")}function n(e){var t=i(e[0]),n=0,r=e.length;while(++n<r)t-=i(e[n]);return t}function r(e){var t=d3.geom.polygon(e[0].map(u)),n=t.area(),r=t.centroid(n<0?(n*=-1,1):-1),i=r[0],s=r[1],o=n,a=0,f=e.length;while(++a<f)t=d3.geom.polygon(e[a].map(u)),n=t.area(),r=t.centroid(n<0?(n*=-1,1):-1),i-=r[0],s-=r[1],o-=n;return[i,s,6*o]}function i(e){return Math.abs(d3.geom.polygon(e.map(u)).area())}var s=4.5,o=Ur(s),u=d3.geo.albersUsa(),a=[],f=Rr({FeatureCollection:function(e){var t=e.features,n=-1,r=t.length;while(++n<r)a.push(f(t[n].geometry))},Feature:function(e){f(e.geometry)},Point:function(e){a.push("M",t(e.coordinates),o)},MultiPoint:function(e){var n=e.coordinates,r=-1,i=n.length;while(++r<i)a.push("M",t(n[r]),o)},LineString:function(e){var n=e.coordinates,r=-1,i=n.length;a.push("M");while(++r<i)a.push(t(n[r]),"L");a.pop()},MultiLineString:function(e){var n=e.coordinates,r=-1,i=n.length,s,o,u;while(++r<i){s=n[r],o=-1,u=s.length,a.push("M");while(++o<u)a.push(t(s[o]),"L");a.pop()}},Polygon:function(e){var n=e.coordinates,r=-1,i=n.length,s,o,u;while(++r<i){s=n[r],o=-1;if((u=s.length-1)>0){a.push("M");while(++o<u)a.push(t(s[o]),"L");a[a.length-1]="Z"}}},MultiPolygon:function(e){var n=e.coordinates,r=-1,i=n.length,s,o,u,f,l,c;while(++r<i){s=n[r],o=-1,u=s.length;while(++o<u){f=s[o],l=-1;if((c=f.length-1)>0){a.push("M");while(++l<c)a.push(t(f[l]),"L");a[a.length-1]="Z"}}}},GeometryCollection:function(e){var t=e.geometries,n=-1,r=t.length;while(++n<r)a.push(f(t[n]))}}),l=e.area=Rr({FeatureCollection:function(e){var t=0,n=e.features,r=-1,i=n.length;while(++r<i)t+=l(n[r]);return t},Feature:function(e){return l(e.geometry)},Polygon:function(e){return n(e.coordinates)},MultiPolygon:function(e){var t=0,r=e.coordinates,i=-1,s=r.length;while(++i<s)t+=n(r[i]);return t},GeometryCollection:function(e){var t=0,n=e.geometries,r=-1,i=n.length;while(++r<i)t+=l(n[r]);return t}},0),c=e.centroid=Rr({Feature:function(e){return c(e.geometry)},Polygon:function(e){var t=r(e.coordinates);return[t[0]/t[2],t[1]/t[2]]},MultiPolygon:function(e){var t=0,n=e.coordinates,i,s=0,o=0,u=0,a=-1,f=n.length;while(++a<f)i=r(n[a]),s+=i[0],o+=i[1],u+=i[2];return[s/u,o/u]}});return e.projection=function(t){return u=t,e},e.pointRadius=function(t){return typeof t=="function"?s=t:(s=+t,o=Ur(s)),e},e},d3.geo.bounds=function(e){var t=Infinity,n=Infinity,r=-Infinity,i=-Infinity;return zr(e,function(e,s){e<t&&(t=e),e>r&&(r=e),s<n&&(n=s),s>i&&(i=s)}),[[t,n],[r,i]]};var fo={Feature:Wr,FeatureCollection:Xr,GeometryCollection:Vr,LineString:$r,MultiLineString:Jr,MultiPoint:$r,MultiPolygon:Kr,Point:Qr,Polygon:Gr};d3.geo.circle=function(){function e(){}function t(e){return a.distance(e)<u}function n(e){var t=-1,n=e.length,i=[],s,o,f,l,c;while(++t<n)c=a.distance(f=e[t]),c<u?(o&&i.push(ti(o,f)((l-u)/(l-c))),i.push(f),s=o=null):(o=f,!s&&i.length&&(i.push(ti(i[i.length-1],o)((u-l)/(c-l))),s=o)),l=c;return s=e[0],o=i[0],o&&f[0]===s[0]&&f[1]===s[1]&&(f[0]!==o[0]||f[1]!==o[1])&&i.push(o),r(i)}function r(e){var t=0,n=e.length,r,i,s=n?[e[0]]:e,o,u=a.source();while(++t<n){o=a.source(e[t-1])(e[t]).coordinates;for(r=0,i=o.length;++r<i;)s.push(o[r])}return a.source(u),s}var s=[0,0],o=89.99,u=o*ao,a=d3.geo.greatArc().source(s).target(i);e.clip=function(e){return typeof s=="function"&&a.source(s.apply(this,arguments)),f(e)||null};var f=Rr({FeatureCollection:function(e){var t=e.features.map(f).filter(i);return t&&(e=Object.create(e),e.features=t,e)},Feature:function(e){var t=f(e.geometry);return t&&(e=Object.create(e),e.geometry=t,e)},Point:function(e){return t(e.coordinates)&&e},MultiPoint:function(e){var n=e.coordinates.filter(t);return n.length&&{type:e.type,coordinates:n}},LineString:function(e){var t=n(e.coordinates);return t.length&&(e=Object.create(e),e.coordinates=t,e)},MultiLineString:function(e){var t=e.coordinates.map(n).filter(function(e){return e.length});return t.length&&(e=Object.create(e),e.coordinates=t,e)},Polygon:function(e){var t=e.coordinates.map(n);return t[0].length&&(e=Object.create(e),e.coordinates=t,e)},MultiPolygon:function(e){var t=e.coordinates.map(function(e){return e.map(n)}).filter(function(e){return e[0].length});return t.length&&(e=Object.create(e),e.coordinates=t,e)},GeometryCollection:function(e){var t=e.geometries.map(f).filter(i);return t.length&&(e=Object.create(e),e.geometries=t,e)}});return e.origin=function(t){return arguments.length?(s=t,typeof s!="function"&&a.source(s),e):s},e.angle=function(t){return arguments.length?(u=(o=+t)*ao,e):o},d3.rebind(e,a,"precision")},d3.geo.greatArc=function(){function e(){var t=e.distance.apply(this,arguments),r=0,u=s/t,a=[n];while((r+=u)<1)a.push(o(r));return a.push(i),{type:"LineString",coordinates:a}}var t=Yr,n,r=Zr,i,s=6*ao,o=ei();return e.distance=function(){return typeof t=="function"&&o.source(n=t.apply(this,arguments)),typeof r=="function"&&o.target(i=r.apply(this,arguments)),o.distance()},e.source=function(r){return arguments.length?(t=r,typeof t!="function"&&o.source(n=t),e):t},e.target=function(t){return arguments.length?(r=t,typeof r!="function"&&o.target(i=r),e):r},e.precision=function(t){return arguments.length?(s=t*ao,e):s/ao},e},d3.geo.greatCircle=d3.geo.circle,d3.geom={},d3.geom.contour=function(e,t){var n=t||ni(e),r=[],i=n[0],s=n[1],o=0,u=0,a=NaN,f=NaN,l=0;do l=0,e(i-1,s-1)&&(l+=1),e(i,s-1)&&(l+=2),e(i-1,s)&&(l+=4),e(i,s)&&(l+=8),l===6?(o=f===-1?-1:1,u=0):l===9?(o=0,u=a===1?-1:1):(o=lo[l],u=co[l]),o!=a&&u!=f&&(r.push([i,s]),a=o,f=u),i+=o,s+=u;while(n[0]!=i||n[1]!=s);return r};var lo=[1,0,1,1,-1,0,-1,1,0,0,0,0,-1,0,-1,NaN],co=[0,-1,0,0,0,-1,0,0,1,-1,1,1,0,-1,0,NaN];d3.geom.hull=function(e){if(e.length<3)return[];var t=e.length,n=t-1,r=[],i=[],s,o,u=0,a,f,l,c,h,p,d,v;for(s=1;s<t;++s)e[s][1]<e[u][1]?u=s:e[s][1]==e[u][1]&&(u=e[s][0]<e[u][0]?s:u);for(s=0;s<t;++s){if(s===u)continue;f=e[s][1]-e[u][1],a=e[s][0]-e[u][0],r.push({angle:Math.atan2(f,a),index:s})}r.sort(function(e,t){return e.angle-t.angle}),d=r[0].angle,p=r[0].index,h=0;for(s=1;s<n;++s)o=r[s].index,d==r[s].angle?(a=e[p][0]-e[u][0],f=e[p][1]-e[u][1],l=e[o][0]-e[u][0],c=e[o][1]-e[u][1],a*a+f*f>=l*l+c*c?r[s].index=-1:(r[h].index=-1,d=r[s].angle,h=s,p=o)):(d=r[s].angle,h=s,p=o);i.push(u);for(s=0,o=0;s<2;++o)r[o].index!==-1&&(i.push(r[o].index),s++);v=i.length;for(;o<n;++o){if(r[o].index===-1)continue;while(!ri(i[v-2],i[v-1],r[o].index,e))--v;i[v++]=r[o].index}var m=[];for(s=0;s<v;++s)m.push(e[i[s]]);return m},d3.geom.polygon=function(e){return e.area=function(){var t=0,n=e.length,r=e[n-1][0]*e[0][1],i=e[n-1][1]*e[0][0];while(++t<n)r+=e[t-1][0]*e[t][1],i+=e[t-1][1]*e[t][0];return(i-r)*.5},e.centroid=function(t){var n=-1,r=e.length,i=0,s=0,o,u=e[r-1],a;arguments.length||(t=-1/(6*e.area()));while(++n<r)o=u,u=e[n],a=o[0]*u[1]-u[0]*o[1],i+=(o[0]+u[0])*a,s+=(o[1]+u[1])*a;return[i*t,s*t]},e.clip=function(t){var n,r=-1,i=e.length,s,o,u=e[i-1],a,f,l;while(++r<i){n=t.slice(),t.length=0,a=e[r],f=n[(o=n.length)-1],s=-1;while(++s<o)l=n[s],ii(l,u,a)?(ii(f,u,a)||t.push(si(f,l,u,a)),t.push(l)):ii(f,u,a)&&t.push(si(f,l,u,a)),f=l;u=a}return t},e},d3.geom.voronoi=function(e){var t=e.map(function(){return[]});return oi(e,function(e){var n,r,i,s,o,u;e.a===1&&e.b>=0?(n=e.ep.r,r=e.ep.l):(n=e.ep.l,r=e.ep.r),e.a===1?(o=n?n.y:-1e6,i=e.c-e.b*o,u=r?r.y:1e6,s=e.c-e.b*u):(i=n?n.x:-1e6,o=e.c-e.a*i,s=r?r.x:1e6,u=e.c-e.a*s);var a=[i,o],f=[s,u];t[e.region.l.index].push(a,f),t[e.region.r.index].push(a,f)}),t.map(function(t,n){var r=e[n][0],i=e[n][1];return t.forEach(function(e){e.angle=Math.atan2(e[0]-r,e[1]-i)}),t.sort(function(e,t){return e.angle-t.angle}).filter(function(e,n){return!n||e.angle-t[n-1].angle>1e-10})})};var ho={l:"r",r:"l"};d3.geom.delaunay=function(e){var t=e.map(function(){return[]}),n=[];return oi(e,function(n){t[n.region.l.index].push(e[n.region.r.index])}),t.forEach(function(t,r){var i=e[r],s=i[0],o=i[1];t.forEach(function(e){e.angle=Math.atan2(e[0]-s,e[1]-o)}),t.sort(function(e,t){return e.angle-t.angle});for(var u=0,a=t.length-1;u<a;u++)n.push([i,t[u],t[u+1]])}),n},d3.geom.quadtree=function(e,t,n,r,i){function s(e,t,n,r,i,s){if(isNaN(t.x)||isNaN(t.y))return;if(e.leaf){var u=e.point;u?Math.abs(u.x-t.x)+Math.abs(u.y-t.y)<.01?o(e,t,n,r,i,s):(e.point=null,o(e,u,n,r,i,s),o(e,t,n,r,i,s)):e.point=t}else o(e,t,n,r,i,s)}function o(e,t,n,r,i,o){var u=(n+i)*.5,a=(r+o)*.5,f=t.x>=u,l=t.y>=a,c=(l<<1)+f;e.leaf=!1,e=e.nodes[c]||(e.nodes[c]=ui()),f?n=u:i=u,l?r=a:o=a,s(e,t,n,r,i,o)}var u,a=-1,f=e.length;f&&isNaN(e[0].x)&&(e=e.map(fi));if(arguments.length<5)if(arguments.length===3)i=r=n,n=t;else{t=n=Infinity,r=i=-Infinity;while(++a<f)u=e[a],u.x<t&&(t=u.x),u.y<n&&(n=u.y),u.x>r&&(r=u.x),u.y>i&&(i=u.y);var l=r-t,c=i-n;l>c?i=n+l:r=t+c}var h=ui();return h.add=function(e){s(h,e,t,n,r,i)},h.visit=function(e){ai(e,h,t,n,r,i)},e.forEach(h.add),h},d3.time={};var po=Date,vo=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];li.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){mo.setUTCDate.apply(this._,arguments)},setDay:function(){mo.setUTCDay.apply(this._,arguments)},setFullYear:function(){mo.setUTCFullYear.apply(this._,arguments)},setHours:function(){mo.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){mo.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){mo.setUTCMinutes.apply(this._,arguments)},setMonth:function(){mo.setUTCMonth.apply(this._,arguments)},setSeconds:function(){mo.setUTCSeconds.apply(this._,arguments)},setTime:function(){mo.setTime.apply(this._,arguments)}};var mo=Date.prototype,go="%a %b %e %H:%M:%S %Y",yo="%m/%d/%y",bo="%H:%M:%S",wo=vo,Eo=wo.map(ci),So=["January","February","March","April","May","June","July","August","September","October","November","December"],xo=So.map(ci);d3.time.format=function(e){function t(t){var r=[],i=-1,s=0,o,u;while(++i<n)e.charCodeAt(i)==37&&(r.push(e.substring(s,i),(u=Po[o=e.charAt(++i)])?u(t):o),s=i+1);return r.push(e.substring(s,i)),r.join("")}var n=e.length;return t.parse=function(t){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},r=hi(n,e,t,0);if(r!=t.length)return null;"p"in n&&(n.H=n.H%12+n.p*12);var i=new po;return i.setFullYear(n.y,n.m,n.d),i.setHours(n.H,n.M,n.S,n.L),i},t.toString=function(){return e},t};var To=d3.format("02d"),No=d3.format("03d"),Co=d3.format("04d"),ko=d3.format("2d"),Lo=pi(wo),Ao=pi(Eo),Oo=pi(So),Mo=di(So),_o=pi(xo),Do=di(xo),Po={a:function(e){return Eo[e.getDay()]},A:function(e){return wo[e.getDay()]},b:function(e){return xo[e.getMonth()]},B:function(e){return So[e.getMonth()]},c:d3.time.format(go),d:function(e){return To(e.getDate())},e:function(e){return ko(e.getDate())},H:function(e){return To(e.getHours())},I:function(e){return To(e.getHours()%12||12)},j:function(e){return No(1+d3.time.dayOfYear(e))},L:function(e){return No(e.getMilliseconds())},m:function(e){return To(e.getMonth()+1)},M:function(e){return To(e.getMinutes())},p:function(e){return e.getHours()>=12?"PM":"AM"},S:function(e){return To(e.getSeconds())},U:function(e){return To(d3.time.sundayOfYear(e))},w:function(e){return e.getDay()},W:function(e){return To(d3.time.mondayOfYear(e))},x:d3.time.format(yo),X:d3.time.format(bo),y:function(e){return To(e.getFullYear()%100)},Y:function(e){return Co(e.getFullYear()%1e4)},Z:_i,"%":function(e){return"%"}},Ho={a:vi,A:mi,b:gi,B:yi,c:bi,d:Ci,e:Ci,H:ki,I:ki,L:Oi,m:Ni,M:Li,p:Mi,S:Ai,x:wi,X:Ei,y:xi,Y:Si},Bo=/^\s*\d+/,jo=d3.map({am:0,pm:1});d3.time.format.utc=function(e){function t(e){try{po=li;var t=new po;return t._=e,n(t)}finally{po=Date}}var n=d3.time.format(e);return t.parse=function(e){try{po=li;var t=n.parse(e);return t&&t._}finally{po=Date}},t.toString=n.toString,t};var Fo=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?Di:Fo,Di.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Di.toString=Fo.toString,d3.time.second=Pi(function(e){return new po(Math.floor(e/1e3)*1e3)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*1e3)},function(e){return e.getSeconds()}),d3.time.seconds=d3.time.second.range,d3.time.seconds.utc=d3.time.second.utc.range,d3.time.minute=Pi(function(e){return new po(Math.floor(e/6e4)*6e4)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*6e4)},function(e){return e.getMinutes()}),d3.time.minutes=d3.time.minute.range,d3.time.minutes.utc=d3.time.minute.utc.range,d3.time.hour=Pi(function(e){var t=e.getTimezoneOffset()/60;return new po((Math.floor(e/36e5-t)+t)*36e5)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*36e5)},function(e){return e.getHours()}),d3.time.hours=d3.time.hour.range,d3.time.hours.utc=d3.time.hour.utc.range,d3.time.day=Pi(function(e){var t=new po(1970,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1}),d3.time.days=d3.time.day.range,d3.time.days.utc=d3.time.day.utc.range,d3.time.dayOfYear=function(e){var t=d3.time.year(e);return Math.floor((e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5)},vo.forEach(function(e,t){e=e.toLowerCase(),t=7-t;var n=d3.time[e]=Pi(function(e){return(e=d3.time.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e},function(e,t){e.setDate(e.getDate()+Math.floor(t)*7)},function(e){var n=d3.time.year(e).getDay();return Math.floor((d3.time.dayOfYear(e)+(n+t)%7)/7)-(n!==t)});d3.time[e+"s"]=n.range,d3.time[e+"s"].utc=n.utc.range,d3.time[e+"OfYear"]=function(e){var n=d3.time.year(e).getDay();return Math.floor((d3.time.dayOfYear(e)+(n+t)%7)/7)}}),d3.time.week=d3.time.sunday,d3.time.weeks=d3.time.sunday.range,d3.time.weeks.utc=d3.time.sunday.utc.range,d3.time.weekOfYear=d3.time.sundayOfYear,d3.time.month=Pi(function(e){return e=d3.time.day(e),e.setDate(1),e},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()}),d3.time.months=d3.time.month.range,d3.time.months.utc=d3.time.month.utc.range,d3.time.year=Pi(function(e){return e=d3.time.day(e),e.setMonth(0,1),e},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()}),d3.time.years=d3.time.year.range,d3.time.years.utc=d3.time.year.utc.range;var Io=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],qo=[[d3.time.second,1],[d3.time.second,5],[d3.time.second,15],[d3.time.second,30],[d3.time.minute,1],[d3.time.minute,5],[d3.time.minute,15],[d3.time.minute,30],[d3.time.hour,1],[d3.time.hour,3],[d3.time.hour,6],[d3.time.hour,12],[d3.time.day,1],[d3.time.day,2],[d3.time.week,1],[d3.time.month,1],[d3.time.month,3],[d3.time.year,1]],Ro=[[d3.time.format("%Y"),function(e){return!0}],[d3.time.format("%B"),function(e){return e.getMonth()}],[d3.time.format("%b %d"),function(e){return e.getDate()!=1}],[d3.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[d3.time.format("%I %p"),function(e){return e.getHours()}],[d3.time.format("%I:%M"),function(e){return e.getMinutes()}],[d3.time.format(":%S"),function(e){return e.getSeconds()}],[d3.time.format(".%L"),function(e){return e.getMilliseconds()}]],Uo=d3.scale.linear(),zo=Ii(Ro);qo.year=function(e,t){return Uo.domain(e.map(Ri)).ticks(t).map(qi)},d3.time.scale=function(){return Bi(d3.scale.linear(),qo,zo)};var Wo=qo.map(function(e){return[e[0].utc,e[1]]}),Xo=[[d3.time.format.utc("%Y"),function(e){return!0}],[d3.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[d3.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[d3.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[d3.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[d3.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[d3.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[d3.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]],Vo=Ii(Xo);Wo.year=function(e,t){return Uo.domain(e.map(zi)).ticks(t).map(Ui)},d3.time.scale.utc=function(){return Bi(d3.scale.linear(),Wo,Vo)}})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.js
new file mode 100644
index 00000000..bf4a8c10
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.js
@@ -0,0 +1,8444 @@
+d3 = function() {
+ var d3 = {
+ version: "3.1.5"
+ };
+ if (!Date.now) Date.now = function() {
+ return +new Date();
+ };
+ var d3_document = document, d3_window = window;
+ try {
+ d3_document.createElement("div").style.setProperty("opacity", 0, "");
+ } catch (error) {
+ var d3_style_prototype = d3_window.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
+ d3_style_prototype.setProperty = function(name, value, priority) {
+ d3_style_setProperty.call(this, name, value + "", priority);
+ };
+ }
+ d3.ascending = function(a, b) {
+ return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
+ };
+ d3.descending = function(a, b) {
+ return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
+ };
+ d3.min = function(array, f) {
+ var i = -1, n = array.length, a, b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && a > b) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
+ }
+ return a;
+ };
+ d3.max = function(array, f) {
+ var i = -1, n = array.length, a, b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && b > a) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
+ }
+ return a;
+ };
+ d3.extent = function(array, f) {
+ var i = -1, n = array.length, a, b, c;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
+ while (++i < n) if ((b = array[i]) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ } else {
+ while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ }
+ return [ a, c ];
+ };
+ d3.sum = function(array, f) {
+ var s = 0, n = array.length, a, i = -1;
+ if (arguments.length === 1) {
+ while (++i < n) if (!isNaN(a = +array[i])) s += a;
+ } else {
+ while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
+ }
+ return s;
+ };
+ function d3_number(x) {
+ return x != null && !isNaN(x);
+ }
+ d3.mean = function(array, f) {
+ var n = array.length, a, m = 0, i = -1, j = 0;
+ if (arguments.length === 1) {
+ while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
+ } else {
+ while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
+ }
+ return j ? m : undefined;
+ };
+ d3.quantile = function(values, p) {
+ var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h;
+ return e ? v + e * (values[h] - v) : v;
+ };
+ d3.median = function(array, f) {
+ if (arguments.length > 1) array = array.map(f);
+ array = array.filter(d3_number);
+ return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
+ };
+ d3.bisector = function(f) {
+ return {
+ left: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >>> 1;
+ if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid;
+ }
+ return lo;
+ },
+ right: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >>> 1;
+ if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1;
+ }
+ return lo;
+ }
+ };
+ };
+ var d3_bisector = d3.bisector(function(d) {
+ return d;
+ });
+ d3.bisectLeft = d3_bisector.left;
+ d3.bisect = d3.bisectRight = d3_bisector.right;
+ d3.shuffle = function(array) {
+ var m = array.length, t, i;
+ while (m) {
+ i = Math.random() * m-- | 0;
+ t = array[m], array[m] = array[i], array[i] = t;
+ }
+ return array;
+ };
+ d3.permute = function(array, indexes) {
+ var permutes = [], i = -1, n = indexes.length;
+ while (++i < n) permutes[i] = array[indexes[i]];
+ return permutes;
+ };
+ d3.zip = function() {
+ if (!(n = arguments.length)) return [];
+ for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) {
+ for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) {
+ zip[j] = arguments[j][i];
+ }
+ }
+ return zips;
+ };
+ function d3_zipLength(d) {
+ return d.length;
+ }
+ d3.transpose = function(matrix) {
+ return d3.zip.apply(d3, matrix);
+ };
+ d3.keys = function(map) {
+ var keys = [];
+ for (var key in map) keys.push(key);
+ return keys;
+ };
+ d3.values = function(map) {
+ var values = [];
+ for (var key in map) values.push(map[key]);
+ return values;
+ };
+ d3.entries = function(map) {
+ var entries = [];
+ for (var key in map) entries.push({
+ key: key,
+ value: map[key]
+ });
+ return entries;
+ };
+ d3.merge = function(arrays) {
+ return Array.prototype.concat.apply([], arrays);
+ };
+ d3.range = function(start, stop, step) {
+ if (arguments.length < 3) {
+ step = 1;
+ if (arguments.length < 2) {
+ stop = start;
+ start = 0;
+ }
+ }
+ if ((stop - start) / step === Infinity) throw new Error("infinite range");
+ var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j;
+ start *= k, stop *= k, step *= k;
+ if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);
+ return range;
+ };
+ function d3_range_integerScale(x) {
+ var k = 1;
+ while (x * k % 1) k *= 10;
+ return k;
+ }
+ function d3_class(ctor, properties) {
+ try {
+ for (var key in properties) {
+ Object.defineProperty(ctor.prototype, key, {
+ value: properties[key],
+ enumerable: false
+ });
+ }
+ } catch (e) {
+ ctor.prototype = properties;
+ }
+ }
+ d3.map = function(object) {
+ var map = new d3_Map();
+ for (var key in object) map.set(key, object[key]);
+ return map;
+ };
+ function d3_Map() {}
+ d3_class(d3_Map, {
+ has: function(key) {
+ return d3_map_prefix + key in this;
+ },
+ get: function(key) {
+ return this[d3_map_prefix + key];
+ },
+ set: function(key, value) {
+ return this[d3_map_prefix + key] = value;
+ },
+ remove: function(key) {
+ key = d3_map_prefix + key;
+ return key in this && delete this[key];
+ },
+ keys: function() {
+ var keys = [];
+ this.forEach(function(key) {
+ keys.push(key);
+ });
+ return keys;
+ },
+ values: function() {
+ var values = [];
+ this.forEach(function(key, value) {
+ values.push(value);
+ });
+ return values;
+ },
+ entries: function() {
+ var entries = [];
+ this.forEach(function(key, value) {
+ entries.push({
+ key: key,
+ value: value
+ });
+ });
+ return entries;
+ },
+ forEach: function(f) {
+ for (var key in this) {
+ if (key.charCodeAt(0) === d3_map_prefixCode) {
+ f.call(this, key.substring(1), this[key]);
+ }
+ }
+ }
+ });
+ var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
+ d3.nest = function() {
+ var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
+ function map(mapType, array, depth) {
+ if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
+ var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values;
+ while (++i < n) {
+ if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
+ values.push(object);
+ } else {
+ valuesByKey.set(keyValue, [ object ]);
+ }
+ }
+ if (mapType) {
+ object = mapType();
+ setter = function(keyValue, values) {
+ object.set(keyValue, map(mapType, values, depth));
+ };
+ } else {
+ object = {};
+ setter = function(keyValue, values) {
+ object[keyValue] = map(mapType, values, depth);
+ };
+ }
+ valuesByKey.forEach(setter);
+ return object;
+ }
+ function entries(map, depth) {
+ if (depth >= keys.length) return map;
+ var array = [], sortKey = sortKeys[depth++];
+ map.forEach(function(key, keyMap) {
+ array.push({
+ key: key,
+ values: entries(keyMap, depth)
+ });
+ });
+ return sortKey ? array.sort(function(a, b) {
+ return sortKey(a.key, b.key);
+ }) : array;
+ }
+ nest.map = function(array, mapType) {
+ return map(mapType, array, 0);
+ };
+ nest.entries = function(array) {
+ return entries(map(d3.map, array, 0), 0);
+ };
+ nest.key = function(d) {
+ keys.push(d);
+ return nest;
+ };
+ nest.sortKeys = function(order) {
+ sortKeys[keys.length - 1] = order;
+ return nest;
+ };
+ nest.sortValues = function(order) {
+ sortValues = order;
+ return nest;
+ };
+ nest.rollup = function(f) {
+ rollup = f;
+ return nest;
+ };
+ return nest;
+ };
+ d3.set = function(array) {
+ var set = new d3_Set();
+ if (array) for (var i = 0; i < array.length; i++) set.add(array[i]);
+ return set;
+ };
+ function d3_Set() {}
+ d3_class(d3_Set, {
+ has: function(value) {
+ return d3_map_prefix + value in this;
+ },
+ add: function(value) {
+ this[d3_map_prefix + value] = true;
+ return value;
+ },
+ remove: function(value) {
+ value = d3_map_prefix + value;
+ return value in this && delete this[value];
+ },
+ values: function() {
+ var values = [];
+ this.forEach(function(value) {
+ values.push(value);
+ });
+ return values;
+ },
+ forEach: function(f) {
+ for (var value in this) {
+ if (value.charCodeAt(0) === d3_map_prefixCode) {
+ f.call(this, value.substring(1));
+ }
+ }
+ }
+ });
+ d3.behavior = {};
+ d3.rebind = function(target, source) {
+ var i = 1, n = arguments.length, method;
+ while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
+ return target;
+ };
+ function d3_rebind(target, source, method) {
+ return function() {
+ var value = method.apply(source, arguments);
+ return value === source ? target : value;
+ };
+ }
+ d3.dispatch = function() {
+ var dispatch = new d3_dispatch(), i = -1, n = arguments.length;
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
+ return dispatch;
+ };
+ function d3_dispatch() {}
+ d3_dispatch.prototype.on = function(type, listener) {
+ var i = type.indexOf("."), name = "";
+ if (i >= 0) {
+ name = type.substring(i + 1);
+ type = type.substring(0, i);
+ }
+ if (type) return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);
+ if (arguments.length === 2) {
+ if (listener == null) for (type in this) {
+ if (this.hasOwnProperty(type)) this[type].on(name, null);
+ }
+ return this;
+ }
+ };
+ function d3_dispatch_event(dispatch) {
+ var listeners = [], listenerByName = new d3_Map();
+ function event() {
+ var z = listeners, i = -1, n = z.length, l;
+ while (++i < n) if (l = z[i].on) l.apply(this, arguments);
+ return dispatch;
+ }
+ event.on = function(name, listener) {
+ var l = listenerByName.get(name), i;
+ if (arguments.length < 2) return l && l.on;
+ if (l) {
+ l.on = null;
+ listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
+ listenerByName.remove(name);
+ }
+ if (listener) listeners.push(listenerByName.set(name, {
+ on: listener
+ }));
+ return dispatch;
+ };
+ return event;
+ }
+ d3.event = null;
+ function d3_eventCancel() {
+ d3.event.stopPropagation();
+ d3.event.preventDefault();
+ }
+ function d3_eventSource() {
+ var e = d3.event, s;
+ while (s = e.sourceEvent) e = s;
+ return e;
+ }
+ function d3_eventSuppress(target, type) {
+ function off() {
+ target.on(type, null);
+ }
+ target.on(type, function() {
+ d3_eventCancel();
+ off();
+ }, true);
+ setTimeout(off, 0);
+ }
+ function d3_eventDispatch(target) {
+ var dispatch = new d3_dispatch(), i = 0, n = arguments.length;
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
+ dispatch.of = function(thiz, argumentz) {
+ return function(e1) {
+ try {
+ var e0 = e1.sourceEvent = d3.event;
+ e1.target = target;
+ d3.event = e1;
+ dispatch[e1.type].apply(thiz, argumentz);
+ } finally {
+ d3.event = e0;
+ }
+ };
+ };
+ return dispatch;
+ }
+ d3.mouse = function(container) {
+ return d3_mousePoint(container, d3_eventSource());
+ };
+ var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0;
+ function d3_mousePoint(container, e) {
+ var svg = container.ownerSVGElement || container;
+ if (svg.createSVGPoint) {
+ var point = svg.createSVGPoint();
+ if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) {
+ svg = d3.select(d3_document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0);
+ var ctm = svg[0][0].getScreenCTM();
+ d3_mouse_bug44083 = !(ctm.f || ctm.e);
+ svg.remove();
+ }
+ if (d3_mouse_bug44083) {
+ point.x = e.pageX;
+ point.y = e.pageY;
+ } else {
+ point.x = e.clientX;
+ point.y = e.clientY;
+ }
+ point = point.matrixTransform(container.getScreenCTM().inverse());
+ return [ point.x, point.y ];
+ }
+ var rect = container.getBoundingClientRect();
+ return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
+ }
+ var d3_array = d3_arraySlice;
+ function d3_arrayCopy(pseudoarray) {
+ var i = -1, n = pseudoarray.length, array = [];
+ while (++i < n) array.push(pseudoarray[i]);
+ return array;
+ }
+ function d3_arraySlice(pseudoarray) {
+ return Array.prototype.slice.call(pseudoarray);
+ }
+ try {
+ d3_array(d3_document.documentElement.childNodes)[0].nodeType;
+ } catch (e) {
+ d3_array = d3_arrayCopy;
+ }
+ var d3_arraySubclass = [].__proto__ ? function(array, prototype) {
+ array.__proto__ = prototype;
+ } : function(array, prototype) {
+ for (var property in prototype) array[property] = prototype[property];
+ };
+ d3.touches = function(container, touches) {
+ if (arguments.length < 2) touches = d3_eventSource().touches;
+ return touches ? d3_array(touches).map(function(touch) {
+ var point = d3_mousePoint(container, touch);
+ point.identifier = touch.identifier;
+ return point;
+ }) : [];
+ };
+ d3.behavior.drag = function() {
+ var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null;
+ function drag() {
+ this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);
+ }
+ function mousedown() {
+ var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches ? d3.event.changedTouches[0].identifier : null, offset, origin_ = point(), moved = 0;
+ var w = d3.select(d3_window).on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true);
+ if (origin) {
+ offset = origin.apply(target, arguments);
+ offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
+ } else {
+ offset = [ 0, 0 ];
+ }
+ if (touchId == null) d3_eventCancel();
+ event_({
+ type: "dragstart"
+ });
+ function point() {
+ var p = target.parentNode;
+ return touchId != null ? d3.touches(p).filter(function(p) {
+ return p.identifier === touchId;
+ })[0] : d3.mouse(p);
+ }
+ function dragmove() {
+ if (!target.parentNode) return dragend();
+ var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
+ moved |= dx | dy;
+ origin_ = p;
+ d3_eventCancel();
+ event_({
+ type: "drag",
+ x: p[0] + offset[0],
+ y: p[1] + offset[1],
+ dx: dx,
+ dy: dy
+ });
+ }
+ function dragend() {
+ event_({
+ type: "dragend"
+ });
+ if (moved) {
+ d3_eventCancel();
+ if (d3.event.target === eventTarget) d3_eventSuppress(w, "click");
+ }
+ w.on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", null);
+ }
+ }
+ drag.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ return drag;
+ };
+ return d3.rebind(drag, event, "on");
+ };
+ function d3_selection(groups) {
+ d3_arraySubclass(groups, d3_selectionPrototype);
+ return groups;
+ }
+ var d3_select = function(s, n) {
+ return n.querySelector(s);
+ }, d3_selectAll = function(s, n) {
+ return n.querySelectorAll(s);
+ }, d3_selectRoot = d3_document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) {
+ return d3_selectMatcher.call(n, s);
+ };
+ if (typeof Sizzle === "function") {
+ d3_select = function(s, n) {
+ return Sizzle(s, n)[0] || null;
+ };
+ d3_selectAll = function(s, n) {
+ return Sizzle.uniqueSort(Sizzle(s, n));
+ };
+ d3_selectMatches = Sizzle.matchesSelector;
+ }
+ var d3_selectionPrototype = [];
+ d3.selection = function() {
+ return d3_selectionRoot;
+ };
+ d3.selection.prototype = d3_selectionPrototype;
+ d3_selectionPrototype.select = function(selector) {
+ var subgroups = [], subgroup, subnode, group, node;
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroup.push(subnode = selector.call(node, node.__data__, i));
+ if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ function d3_selection_selector(selector) {
+ return function() {
+ return d3_select(selector, this);
+ };
+ }
+ d3_selectionPrototype.selectAll = function(selector) {
+ var subgroups = [], subgroup, node;
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
+ subgroup.parentNode = node;
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ function d3_selection_selectorAll(selector) {
+ return function() {
+ return d3_selectAll(selector, this);
+ };
+ }
+ var d3_nsPrefix = {
+ svg: "http://www.w3.org/2000/svg",
+ xhtml: "http://www.w3.org/1999/xhtml",
+ xlink: "http://www.w3.org/1999/xlink",
+ xml: "http://www.w3.org/XML/1998/namespace",
+ xmlns: "http://www.w3.org/2000/xmlns/"
+ };
+ d3.ns = {
+ prefix: d3_nsPrefix,
+ qualify: function(name) {
+ var i = name.indexOf(":"), prefix = name;
+ if (i >= 0) {
+ prefix = name.substring(0, i);
+ name = name.substring(i + 1);
+ }
+ return d3_nsPrefix.hasOwnProperty(prefix) ? {
+ space: d3_nsPrefix[prefix],
+ local: name
+ } : name;
+ }
+ };
+ d3_selectionPrototype.attr = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") {
+ var node = this.node();
+ name = d3.ns.qualify(name);
+ return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);
+ }
+ for (value in name) this.each(d3_selection_attr(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_attr(name, value));
+ };
+ function d3_selection_attr(name, value) {
+ name = d3.ns.qualify(name);
+ function attrNull() {
+ this.removeAttribute(name);
+ }
+ function attrNullNS() {
+ this.removeAttributeNS(name.space, name.local);
+ }
+ function attrConstant() {
+ this.setAttribute(name, value);
+ }
+ function attrConstantNS() {
+ this.setAttributeNS(name.space, name.local, value);
+ }
+ function attrFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);
+ }
+ function attrFunctionNS() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);
+ }
+ return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;
+ }
+ function d3_collapse(s) {
+ return s.trim().replace(/\s+/g, " ");
+ }
+ d3.requote = function(s) {
+ return s.replace(d3_requote_re, "\\$&");
+ };
+ var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
+ d3_selectionPrototype.classed = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") {
+ var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1;
+ if (value = node.classList) {
+ while (++i < n) if (!value.contains(name[i])) return false;
+ } else {
+ value = node.getAttribute("class");
+ while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;
+ }
+ return true;
+ }
+ for (value in name) this.each(d3_selection_classed(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_classed(name, value));
+ };
+ function d3_selection_classedRe(name) {
+ return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");
+ }
+ function d3_selection_classed(name, value) {
+ name = name.trim().split(/\s+/).map(d3_selection_classedName);
+ var n = name.length;
+ function classedConstant() {
+ var i = -1;
+ while (++i < n) name[i](this, value);
+ }
+ function classedFunction() {
+ var i = -1, x = value.apply(this, arguments);
+ while (++i < n) name[i](this, x);
+ }
+ return typeof value === "function" ? classedFunction : classedConstant;
+ }
+ function d3_selection_classedName(name) {
+ var re = d3_selection_classedRe(name);
+ return function(node, value) {
+ if (c = node.classList) return value ? c.add(name) : c.remove(name);
+ var c = node.getAttribute("class") || "";
+ if (value) {
+ re.lastIndex = 0;
+ if (!re.test(c)) node.setAttribute("class", d3_collapse(c + " " + name));
+ } else {
+ node.setAttribute("class", d3_collapse(c.replace(re, " ")));
+ }
+ };
+ }
+ d3_selectionPrototype.style = function(name, value, priority) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof name !== "string") {
+ if (n < 2) value = "";
+ for (priority in name) this.each(d3_selection_style(priority, name[priority], value));
+ return this;
+ }
+ if (n < 2) return d3_window.getComputedStyle(this.node(), null).getPropertyValue(name);
+ priority = "";
+ }
+ return this.each(d3_selection_style(name, value, priority));
+ };
+ function d3_selection_style(name, value, priority) {
+ function styleNull() {
+ this.style.removeProperty(name);
+ }
+ function styleConstant() {
+ this.style.setProperty(name, value, priority);
+ }
+ function styleFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);
+ }
+ return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;
+ }
+ d3_selectionPrototype.property = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") return this.node()[name];
+ for (value in name) this.each(d3_selection_property(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_property(name, value));
+ };
+ function d3_selection_property(name, value) {
+ function propertyNull() {
+ delete this[name];
+ }
+ function propertyConstant() {
+ this[name] = value;
+ }
+ function propertyFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) delete this[name]; else this[name] = x;
+ }
+ return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;
+ }
+ d3_selectionPrototype.text = function(value) {
+ return arguments.length ? this.each(typeof value === "function" ? function() {
+ var v = value.apply(this, arguments);
+ this.textContent = v == null ? "" : v;
+ } : value == null ? function() {
+ this.textContent = "";
+ } : function() {
+ this.textContent = value;
+ }) : this.node().textContent;
+ };
+ d3_selectionPrototype.html = function(value) {
+ return arguments.length ? this.each(typeof value === "function" ? function() {
+ var v = value.apply(this, arguments);
+ this.innerHTML = v == null ? "" : v;
+ } : value == null ? function() {
+ this.innerHTML = "";
+ } : function() {
+ this.innerHTML = value;
+ }) : this.node().innerHTML;
+ };
+ d3_selectionPrototype.append = function(name) {
+ name = d3.ns.qualify(name);
+ function append() {
+ return this.appendChild(d3_document.createElementNS(this.namespaceURI, name));
+ }
+ function appendNS() {
+ return this.appendChild(d3_document.createElementNS(name.space, name.local));
+ }
+ return this.select(name.local ? appendNS : append);
+ };
+ d3_selectionPrototype.insert = function(name, before) {
+ name = d3.ns.qualify(name);
+ if (typeof before !== "function") before = d3_selection_selector(before);
+ function insert(d, i) {
+ return this.insertBefore(d3_document.createElementNS(this.namespaceURI, name), before.call(this, d, i));
+ }
+ function insertNS(d, i) {
+ return this.insertBefore(d3_document.createElementNS(name.space, name.local), before.call(this, d, i));
+ }
+ return this.select(name.local ? insertNS : insert);
+ };
+ d3_selectionPrototype.remove = function() {
+ return this.each(function() {
+ var parent = this.parentNode;
+ if (parent) parent.removeChild(this);
+ });
+ };
+ d3_selectionPrototype.data = function(value, key) {
+ var i = -1, n = this.length, group, node;
+ if (!arguments.length) {
+ value = new Array(n = (group = this[0]).length);
+ while (++i < n) {
+ if (node = group[i]) {
+ value[i] = node.__data__;
+ }
+ }
+ return value;
+ }
+ function bind(group, groupData) {
+ var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData;
+ if (key) {
+ var nodeByKeyValue = new d3_Map(), dataByKeyValue = new d3_Map(), keyValues = [], keyValue;
+ for (i = -1; ++i < n; ) {
+ keyValue = key.call(node = group[i], node.__data__, i);
+ if (nodeByKeyValue.has(keyValue)) {
+ exitNodes[i] = node;
+ } else {
+ nodeByKeyValue.set(keyValue, node);
+ }
+ keyValues.push(keyValue);
+ }
+ for (i = -1; ++i < m; ) {
+ keyValue = key.call(groupData, nodeData = groupData[i], i);
+ if (node = nodeByKeyValue.get(keyValue)) {
+ updateNodes[i] = node;
+ node.__data__ = nodeData;
+ } else if (!dataByKeyValue.has(keyValue)) {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ }
+ dataByKeyValue.set(keyValue, nodeData);
+ nodeByKeyValue.remove(keyValue);
+ }
+ for (i = -1; ++i < n; ) {
+ if (nodeByKeyValue.has(keyValues[i])) {
+ exitNodes[i] = group[i];
+ }
+ }
+ } else {
+ for (i = -1; ++i < n0; ) {
+ node = group[i];
+ nodeData = groupData[i];
+ if (node) {
+ node.__data__ = nodeData;
+ updateNodes[i] = node;
+ } else {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ }
+ }
+ for (;i < m; ++i) {
+ enterNodes[i] = d3_selection_dataNode(groupData[i]);
+ }
+ for (;i < n; ++i) {
+ exitNodes[i] = group[i];
+ }
+ }
+ enterNodes.update = updateNodes;
+ enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;
+ enter.push(enterNodes);
+ update.push(updateNodes);
+ exit.push(exitNodes);
+ }
+ var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);
+ if (typeof value === "function") {
+ while (++i < n) {
+ bind(group = this[i], value.call(group, group.parentNode.__data__, i));
+ }
+ } else {
+ while (++i < n) {
+ bind(group = this[i], value);
+ }
+ }
+ update.enter = function() {
+ return enter;
+ };
+ update.exit = function() {
+ return exit;
+ };
+ return update;
+ };
+ function d3_selection_dataNode(data) {
+ return {
+ __data__: data
+ };
+ }
+ d3_selectionPrototype.datum = function(value) {
+ return arguments.length ? this.property("__data__", value) : this.property("__data__");
+ };
+ d3_selectionPrototype.filter = function(filter) {
+ var subgroups = [], subgroup, group, node;
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = 0, n = group.length; i < n; i++) {
+ if ((node = group[i]) && filter.call(node, node.__data__, i)) {
+ subgroup.push(node);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ function d3_selection_filter(selector) {
+ return function() {
+ return d3_selectMatches(this, selector);
+ };
+ }
+ d3_selectionPrototype.order = function() {
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
+ if (node = group[i]) {
+ if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
+ next = node;
+ }
+ }
+ }
+ return this;
+ };
+ d3_selectionPrototype.sort = function(comparator) {
+ comparator = d3_selection_sortComparator.apply(this, arguments);
+ for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);
+ return this.order();
+ };
+ function d3_selection_sortComparator(comparator) {
+ if (!arguments.length) comparator = d3.ascending;
+ return function(a, b) {
+ return !a - !b || comparator(a.__data__, b.__data__);
+ };
+ }
+ function d3_noop() {}
+ d3_selectionPrototype.on = function(type, listener, capture) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof type !== "string") {
+ if (n < 2) listener = false;
+ for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
+ return this;
+ }
+ if (n < 2) return (n = this.node()["__on" + type]) && n._;
+ capture = false;
+ }
+ return this.each(d3_selection_on(type, listener, capture));
+ };
+ function d3_selection_on(type, listener, capture) {
+ var name = "__on" + type, i = type.indexOf("."), wrap = d3_selection_onListener;
+ if (i > 0) type = type.substring(0, i);
+ var filter = d3_selection_onFilters.get(type);
+ if (filter) type = filter, wrap = d3_selection_onFilter;
+ function onRemove() {
+ var l = this[name];
+ if (l) {
+ this.removeEventListener(type, l, l.$);
+ delete this[name];
+ }
+ }
+ function onAdd() {
+ var l = wrap(listener, d3_array(arguments));
+ onRemove.call(this);
+ this.addEventListener(type, this[name] = l, l.$ = capture);
+ l._ = listener;
+ }
+ function removeAll() {
+ var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match;
+ for (var name in this) {
+ if (match = name.match(re)) {
+ var l = this[name];
+ this.removeEventListener(match[1], l, l.$);
+ delete this[name];
+ }
+ }
+ }
+ return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll;
+ }
+ var d3_selection_onFilters = d3.map({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+ });
+ d3_selection_onFilters.forEach(function(k) {
+ if ("on" + k in d3_document) d3_selection_onFilters.remove(k);
+ });
+ function d3_selection_onListener(listener, argumentz) {
+ return function(e) {
+ var o = d3.event;
+ d3.event = e;
+ argumentz[0] = this.__data__;
+ try {
+ listener.apply(this, argumentz);
+ } finally {
+ d3.event = o;
+ }
+ };
+ }
+ function d3_selection_onFilter(listener, argumentz) {
+ var l = d3_selection_onListener(listener, argumentz);
+ return function(e) {
+ var target = this, related = e.relatedTarget;
+ if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) {
+ l.call(target, e);
+ }
+ };
+ }
+ d3_selectionPrototype.each = function(callback) {
+ return d3_selection_each(this, function(node, i, j) {
+ callback.call(node, node.__data__, i, j);
+ });
+ };
+ function d3_selection_each(groups, callback) {
+ for (var j = 0, m = groups.length; j < m; j++) {
+ for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {
+ if (node = group[i]) callback(node, i, j);
+ }
+ }
+ return groups;
+ }
+ d3_selectionPrototype.call = function(callback) {
+ var args = d3_array(arguments);
+ callback.apply(args[0] = this, args);
+ return this;
+ };
+ d3_selectionPrototype.empty = function() {
+ return !this.node();
+ };
+ d3_selectionPrototype.node = function() {
+ for (var j = 0, m = this.length; j < m; j++) {
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ var node = group[i];
+ if (node) return node;
+ }
+ }
+ return null;
+ };
+ function d3_selection_enter(selection) {
+ d3_arraySubclass(selection, d3_selection_enterPrototype);
+ return selection;
+ }
+ var d3_selection_enterPrototype = [];
+ d3.selection.enter = d3_selection_enter;
+ d3.selection.enter.prototype = d3_selection_enterPrototype;
+ d3_selection_enterPrototype.append = d3_selectionPrototype.append;
+ d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
+ d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
+ d3_selection_enterPrototype.node = d3_selectionPrototype.node;
+ d3_selection_enterPrototype.select = function(selector) {
+ var subgroups = [], subgroup, subnode, upgroup, group, node;
+ for (var j = -1, m = this.length; ++j < m; ) {
+ upgroup = (group = this[j]).update;
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = group.parentNode;
+ for (var i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
+ subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ d3_selectionPrototype.transition = function() {
+ var id = d3_transitionInheritId || ++d3_transitionId, subgroups = [], subgroup, node, transition = Object.create(d3_transitionInherit);
+ transition.time = Date.now();
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) d3_transitionNode(node, i, id, transition);
+ subgroup.push(node);
+ }
+ }
+ return d3_transition(subgroups, id);
+ };
+ var d3_selectionRoot = d3_selection([ [ d3_document ] ]);
+ d3_selectionRoot[0].parentNode = d3_selectRoot;
+ d3.select = function(selector) {
+ return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]);
+ };
+ d3.selectAll = function(selector) {
+ return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]);
+ };
+ d3.behavior.zoom = function() {
+ var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
+ function zoom() {
+ this.on("mousedown.zoom", mousedown).on("mousemove.zoom", mousemove).on(d3_behavior_zoomWheel + ".zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart);
+ }
+ zoom.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = x.map(Number);
+ rescale();
+ return zoom;
+ };
+ zoom.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ rescale();
+ return zoom;
+ };
+ zoom.scaleExtent = function(x) {
+ if (!arguments.length) return scaleExtent;
+ scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);
+ return zoom;
+ };
+ zoom.x = function(z) {
+ if (!arguments.length) return x1;
+ x1 = z;
+ x0 = z.copy();
+ translate = [ 0, 0 ];
+ scale = 1;
+ return zoom;
+ };
+ zoom.y = function(z) {
+ if (!arguments.length) return y1;
+ y1 = z;
+ y0 = z.copy();
+ translate = [ 0, 0 ];
+ scale = 1;
+ return zoom;
+ };
+ function location(p) {
+ return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ];
+ }
+ function point(l) {
+ return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ];
+ }
+ function scaleTo(s) {
+ scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
+ }
+ function translateTo(p, l) {
+ l = point(l);
+ translate[0] += p[0] - l[0];
+ translate[1] += p[1] - l[1];
+ }
+ function rescale() {
+ if (x1) x1.domain(x0.range().map(function(x) {
+ return (x - translate[0]) / scale;
+ }).map(x0.invert));
+ if (y1) y1.domain(y0.range().map(function(y) {
+ return (y - translate[1]) / scale;
+ }).map(y0.invert));
+ }
+ function dispatch(event) {
+ rescale();
+ d3.event.preventDefault();
+ event({
+ type: "zoom",
+ scale: scale,
+ translate: translate
+ });
+ }
+ function mousedown() {
+ var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(d3_window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target));
+ d3_window.focus();
+ d3_eventCancel();
+ function mousemove() {
+ moved = 1;
+ translateTo(d3.mouse(target), l);
+ dispatch(event_);
+ }
+ function mouseup() {
+ if (moved) d3_eventCancel();
+ w.on("mousemove.zoom", null).on("mouseup.zoom", null);
+ if (moved && d3.event.target === eventTarget) d3_eventSuppress(w, "click.zoom");
+ }
+ }
+ function mousewheel() {
+ if (!translate0) translate0 = location(d3.mouse(this));
+ scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);
+ translateTo(d3.mouse(this), translate0);
+ dispatch(event.of(this, arguments));
+ }
+ function mousemove() {
+ translate0 = null;
+ }
+ function dblclick() {
+ var p = d3.mouse(this), l = location(p), k = Math.log(scale) / Math.LN2;
+ scaleTo(Math.pow(2, d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1));
+ translateTo(p, l);
+ dispatch(event.of(this, arguments));
+ }
+ function touchstart() {
+ var touches = d3.touches(this), now = Date.now();
+ scale0 = scale;
+ translate0 = {};
+ touches.forEach(function(t) {
+ translate0[t.identifier] = location(t);
+ });
+ d3_eventCancel();
+ if (touches.length === 1) {
+ if (now - touchtime < 500) {
+ var p = touches[0], l = location(touches[0]);
+ scaleTo(scale * 2);
+ translateTo(p, l);
+ dispatch(event.of(this, arguments));
+ }
+ touchtime = now;
+ }
+ }
+ function touchmove() {
+ var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier];
+ if (p1 = touches[1]) {
+ var p1, l1 = translate0[p1.identifier];
+ p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];
+ l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
+ scaleTo(d3.event.scale * scale0);
+ }
+ translateTo(p0, l0);
+ touchtime = null;
+ dispatch(event.of(this, arguments));
+ }
+ return d3.rebind(zoom, event, "on");
+ };
+ var d3_behavior_zoomInfinity = [ 0, Infinity ];
+ var d3_behavior_zoomDelta, d3_behavior_zoomWheel = "onwheel" in d3_document ? (d3_behavior_zoomDelta = function() {
+ return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1);
+ }, "wheel") : "onmousewheel" in d3_document ? (d3_behavior_zoomDelta = function() {
+ return d3.event.wheelDelta;
+ }, "mousewheel") : (d3_behavior_zoomDelta = function() {
+ return -d3.event.detail;
+ }, "MozMousePixelScroll");
+ function d3_Color() {}
+ d3_Color.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+ d3.hsl = function(h, s, l) {
+ return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l);
+ };
+ function d3_hsl(h, s, l) {
+ return new d3_Hsl(h, s, l);
+ }
+ function d3_Hsl(h, s, l) {
+ this.h = h;
+ this.s = s;
+ this.l = l;
+ }
+ var d3_hslPrototype = d3_Hsl.prototype = new d3_Color();
+ d3_hslPrototype.brighter = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, this.l / k);
+ };
+ d3_hslPrototype.darker = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, k * this.l);
+ };
+ d3_hslPrototype.rgb = function() {
+ return d3_hsl_rgb(this.h, this.s, this.l);
+ };
+ function d3_hsl_rgb(h, s, l) {
+ var m1, m2;
+ h = h % 360;
+ if (h < 0) h += 360;
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
+ l = l < 0 ? 0 : l > 1 ? 1 : l;
+ m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
+ m1 = 2 * l - m2;
+ function v(h) {
+ if (h > 360) h -= 360; else if (h < 0) h += 360;
+ if (h < 60) return m1 + (m2 - m1) * h / 60;
+ if (h < 180) return m2;
+ if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
+ return m1;
+ }
+ function vv(h) {
+ return Math.round(v(h) * 255);
+ }
+ return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
+ }
+ var π = Math.PI, ε = 1e-6, d3_radians = π / 180, d3_degrees = 180 / π;
+ function d3_sgn(x) {
+ return x > 0 ? 1 : x < 0 ? -1 : 0;
+ }
+ function d3_acos(x) {
+ return Math.acos(Math.max(-1, Math.min(1, x)));
+ }
+ function d3_asin(x) {
+ return x > 1 ? π / 2 : x < -1 ? -π / 2 : Math.asin(x);
+ }
+ function d3_sinh(x) {
+ return (Math.exp(x) - Math.exp(-x)) / 2;
+ }
+ function d3_cosh(x) {
+ return (Math.exp(x) + Math.exp(-x)) / 2;
+ }
+ function d3_haversin(x) {
+ return (x = Math.sin(x / 2)) * x;
+ }
+ d3.hcl = function(h, c, l) {
+ return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l);
+ };
+ function d3_hcl(h, c, l) {
+ return new d3_Hcl(h, c, l);
+ }
+ function d3_Hcl(h, c, l) {
+ this.h = h;
+ this.c = c;
+ this.l = l;
+ }
+ var d3_hclPrototype = d3_Hcl.prototype = new d3_Color();
+ d3_hclPrototype.brighter = function(k) {
+ return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
+ };
+ d3_hclPrototype.darker = function(k) {
+ return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
+ };
+ d3_hclPrototype.rgb = function() {
+ return d3_hcl_lab(this.h, this.c, this.l).rgb();
+ };
+ function d3_hcl_lab(h, c, l) {
+ return d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c);
+ }
+ d3.lab = function(l, a, b) {
+ return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b);
+ };
+ function d3_lab(l, a, b) {
+ return new d3_Lab(l, a, b);
+ }
+ function d3_Lab(l, a, b) {
+ this.l = l;
+ this.a = a;
+ this.b = b;
+ }
+ var d3_lab_K = 18;
+ var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
+ var d3_labPrototype = d3_Lab.prototype = new d3_Color();
+ d3_labPrototype.brighter = function(k) {
+ return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+ d3_labPrototype.darker = function(k) {
+ return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+ d3_labPrototype.rgb = function() {
+ return d3_lab_rgb(this.l, this.a, this.b);
+ };
+ function d3_lab_rgb(l, a, b) {
+ var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
+ x = d3_lab_xyz(x) * d3_lab_X;
+ y = d3_lab_xyz(y) * d3_lab_Y;
+ z = d3_lab_xyz(z) * d3_lab_Z;
+ return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z));
+ }
+ function d3_lab_hcl(l, a, b) {
+ return d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l);
+ }
+ function d3_lab_xyz(x) {
+ return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
+ }
+ function d3_xyz_lab(x) {
+ return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
+ }
+ function d3_xyz_rgb(r) {
+ return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));
+ }
+ d3.rgb = function(r, g, b) {
+ return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b);
+ };
+ function d3_rgb(r, g, b) {
+ return new d3_Rgb(r, g, b);
+ }
+ function d3_Rgb(r, g, b) {
+ this.r = r;
+ this.g = g;
+ this.b = b;
+ }
+ var d3_rgbPrototype = d3_Rgb.prototype = new d3_Color();
+ d3_rgbPrototype.brighter = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ var r = this.r, g = this.g, b = this.b, i = 30;
+ if (!r && !g && !b) return d3_rgb(i, i, i);
+ if (r && r < i) r = i;
+ if (g && g < i) g = i;
+ if (b && b < i) b = i;
+ return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k)));
+ };
+ d3_rgbPrototype.darker = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b));
+ };
+ d3_rgbPrototype.hsl = function() {
+ return d3_rgb_hsl(this.r, this.g, this.b);
+ };
+ d3_rgbPrototype.toString = function() {
+ return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
+ };
+ function d3_rgb_hex(v) {
+ return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
+ }
+ function d3_rgb_parse(format, rgb, hsl) {
+ var r = 0, g = 0, b = 0, m1, m2, name;
+ m1 = /([a-z]+)\((.*)\)/i.exec(format);
+ if (m1) {
+ m2 = m1[2].split(",");
+ switch (m1[1]) {
+ case "hsl":
+ {
+ return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);
+ }
+
+ case "rgb":
+ {
+ return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));
+ }
+ }
+ }
+ if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
+ if (format != null && format.charAt(0) === "#") {
+ if (format.length === 4) {
+ r = format.charAt(1);
+ r += r;
+ g = format.charAt(2);
+ g += g;
+ b = format.charAt(3);
+ b += b;
+ } else if (format.length === 7) {
+ r = format.substring(1, 3);
+ g = format.substring(3, 5);
+ b = format.substring(5, 7);
+ }
+ r = parseInt(r, 16);
+ g = parseInt(g, 16);
+ b = parseInt(b, 16);
+ }
+ return rgb(r, g, b);
+ }
+ function d3_rgb_hsl(r, g, b) {
+ var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2;
+ if (d) {
+ s = l < .5 ? d / (max + min) : d / (2 - max - min);
+ if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4;
+ h *= 60;
+ } else {
+ s = h = 0;
+ }
+ return d3_hsl(h, s, l);
+ }
+ function d3_rgb_lab(r, g, b) {
+ r = d3_rgb_xyz(r);
+ g = d3_rgb_xyz(g);
+ b = d3_rgb_xyz(b);
+ var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z);
+ return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
+ }
+ function d3_rgb_xyz(r) {
+ return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);
+ }
+ function d3_rgb_parseNumber(c) {
+ var f = parseFloat(c);
+ return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
+ }
+ var d3_rgb_names = d3.map({
+ aliceblue: "#f0f8ff",
+ antiquewhite: "#faebd7",
+ aqua: "#00ffff",
+ aquamarine: "#7fffd4",
+ azure: "#f0ffff",
+ beige: "#f5f5dc",
+ bisque: "#ffe4c4",
+ black: "#000000",
+ blanchedalmond: "#ffebcd",
+ blue: "#0000ff",
+ blueviolet: "#8a2be2",
+ brown: "#a52a2a",
+ burlywood: "#deb887",
+ cadetblue: "#5f9ea0",
+ chartreuse: "#7fff00",
+ chocolate: "#d2691e",
+ coral: "#ff7f50",
+ cornflowerblue: "#6495ed",
+ cornsilk: "#fff8dc",
+ crimson: "#dc143c",
+ cyan: "#00ffff",
+ darkblue: "#00008b",
+ darkcyan: "#008b8b",
+ darkgoldenrod: "#b8860b",
+ darkgray: "#a9a9a9",
+ darkgreen: "#006400",
+ darkgrey: "#a9a9a9",
+ darkkhaki: "#bdb76b",
+ darkmagenta: "#8b008b",
+ darkolivegreen: "#556b2f",
+ darkorange: "#ff8c00",
+ darkorchid: "#9932cc",
+ darkred: "#8b0000",
+ darksalmon: "#e9967a",
+ darkseagreen: "#8fbc8f",
+ darkslateblue: "#483d8b",
+ darkslategray: "#2f4f4f",
+ darkslategrey: "#2f4f4f",
+ darkturquoise: "#00ced1",
+ darkviolet: "#9400d3",
+ deeppink: "#ff1493",
+ deepskyblue: "#00bfff",
+ dimgray: "#696969",
+ dimgrey: "#696969",
+ dodgerblue: "#1e90ff",
+ firebrick: "#b22222",
+ floralwhite: "#fffaf0",
+ forestgreen: "#228b22",
+ fuchsia: "#ff00ff",
+ gainsboro: "#dcdcdc",
+ ghostwhite: "#f8f8ff",
+ gold: "#ffd700",
+ goldenrod: "#daa520",
+ gray: "#808080",
+ green: "#008000",
+ greenyellow: "#adff2f",
+ grey: "#808080",
+ honeydew: "#f0fff0",
+ hotpink: "#ff69b4",
+ indianred: "#cd5c5c",
+ indigo: "#4b0082",
+ ivory: "#fffff0",
+ khaki: "#f0e68c",
+ lavender: "#e6e6fa",
+ lavenderblush: "#fff0f5",
+ lawngreen: "#7cfc00",
+ lemonchiffon: "#fffacd",
+ lightblue: "#add8e6",
+ lightcoral: "#f08080",
+ lightcyan: "#e0ffff",
+ lightgoldenrodyellow: "#fafad2",
+ lightgray: "#d3d3d3",
+ lightgreen: "#90ee90",
+ lightgrey: "#d3d3d3",
+ lightpink: "#ffb6c1",
+ lightsalmon: "#ffa07a",
+ lightseagreen: "#20b2aa",
+ lightskyblue: "#87cefa",
+ lightslategray: "#778899",
+ lightslategrey: "#778899",
+ lightsteelblue: "#b0c4de",
+ lightyellow: "#ffffe0",
+ lime: "#00ff00",
+ limegreen: "#32cd32",
+ linen: "#faf0e6",
+ magenta: "#ff00ff",
+ maroon: "#800000",
+ mediumaquamarine: "#66cdaa",
+ mediumblue: "#0000cd",
+ mediumorchid: "#ba55d3",
+ mediumpurple: "#9370db",
+ mediumseagreen: "#3cb371",
+ mediumslateblue: "#7b68ee",
+ mediumspringgreen: "#00fa9a",
+ mediumturquoise: "#48d1cc",
+ mediumvioletred: "#c71585",
+ midnightblue: "#191970",
+ mintcream: "#f5fffa",
+ mistyrose: "#ffe4e1",
+ moccasin: "#ffe4b5",
+ navajowhite: "#ffdead",
+ navy: "#000080",
+ oldlace: "#fdf5e6",
+ olive: "#808000",
+ olivedrab: "#6b8e23",
+ orange: "#ffa500",
+ orangered: "#ff4500",
+ orchid: "#da70d6",
+ palegoldenrod: "#eee8aa",
+ palegreen: "#98fb98",
+ paleturquoise: "#afeeee",
+ palevioletred: "#db7093",
+ papayawhip: "#ffefd5",
+ peachpuff: "#ffdab9",
+ peru: "#cd853f",
+ pink: "#ffc0cb",
+ plum: "#dda0dd",
+ powderblue: "#b0e0e6",
+ purple: "#800080",
+ red: "#ff0000",
+ rosybrown: "#bc8f8f",
+ royalblue: "#4169e1",
+ saddlebrown: "#8b4513",
+ salmon: "#fa8072",
+ sandybrown: "#f4a460",
+ seagreen: "#2e8b57",
+ seashell: "#fff5ee",
+ sienna: "#a0522d",
+ silver: "#c0c0c0",
+ skyblue: "#87ceeb",
+ slateblue: "#6a5acd",
+ slategray: "#708090",
+ slategrey: "#708090",
+ snow: "#fffafa",
+ springgreen: "#00ff7f",
+ steelblue: "#4682b4",
+ tan: "#d2b48c",
+ teal: "#008080",
+ thistle: "#d8bfd8",
+ tomato: "#ff6347",
+ turquoise: "#40e0d0",
+ violet: "#ee82ee",
+ wheat: "#f5deb3",
+ white: "#ffffff",
+ whitesmoke: "#f5f5f5",
+ yellow: "#ffff00",
+ yellowgreen: "#9acd32"
+ });
+ d3_rgb_names.forEach(function(key, value) {
+ d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
+ });
+ function d3_functor(v) {
+ return typeof v === "function" ? v : function() {
+ return v;
+ };
+ }
+ d3.functor = d3_functor;
+ function d3_identity(d) {
+ return d;
+ }
+ d3.xhr = function(url, mimeType, callback) {
+ var xhr = {}, dispatch = d3.dispatch("progress", "load", "error"), headers = {}, response = d3_identity, request = new (d3_window.XDomainRequest && /^(http(s)?:)?\/\//.test(url) ? XDomainRequest : XMLHttpRequest)();
+ "onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() {
+ request.readyState > 3 && respond();
+ };
+ function respond() {
+ var s = request.status;
+ !s && request.responseText || s >= 200 && s < 300 || s === 304 ? dispatch.load.call(xhr, response.call(xhr, request)) : dispatch.error.call(xhr, request);
+ }
+ request.onprogress = function(event) {
+ var o = d3.event;
+ d3.event = event;
+ try {
+ dispatch.progress.call(xhr, request);
+ } finally {
+ d3.event = o;
+ }
+ };
+ xhr.header = function(name, value) {
+ name = (name + "").toLowerCase();
+ if (arguments.length < 2) return headers[name];
+ if (value == null) delete headers[name]; else headers[name] = value + "";
+ return xhr;
+ };
+ xhr.mimeType = function(value) {
+ if (!arguments.length) return mimeType;
+ mimeType = value == null ? null : value + "";
+ return xhr;
+ };
+ xhr.response = function(value) {
+ response = value;
+ return xhr;
+ };
+ [ "get", "post" ].forEach(function(method) {
+ xhr[method] = function() {
+ return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments)));
+ };
+ });
+ xhr.send = function(method, data, callback) {
+ if (arguments.length === 2 && typeof data === "function") callback = data, data = null;
+ request.open(method, url, true);
+ if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*";
+ if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]);
+ if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType);
+ if (callback != null) xhr.on("error", callback).on("load", function(request) {
+ callback(null, request);
+ });
+ request.send(data == null ? null : data);
+ return xhr;
+ };
+ xhr.abort = function() {
+ request.abort();
+ return xhr;
+ };
+ d3.rebind(xhr, dispatch, "on");
+ if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType,
+ mimeType = null;
+ return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback));
+ };
+ function d3_xhr_fixCallback(callback) {
+ return callback.length === 1 ? function(error, request) {
+ callback(error == null ? request : null);
+ } : callback;
+ }
+ function d3_dsv(delimiter, mimeType) {
+ var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
+ function dsv(url, row, callback) {
+ if (arguments.length < 3) callback = row, row = null;
+ var xhr = d3.xhr(url, mimeType, callback);
+ xhr.row = function(_) {
+ return arguments.length ? xhr.response((row = _) == null ? response : typedResponse(_)) : row;
+ };
+ return xhr.row(row);
+ }
+ function response(request) {
+ return dsv.parse(request.responseText);
+ }
+ function typedResponse(f) {
+ return function(request) {
+ return dsv.parse(request.responseText, f);
+ };
+ }
+ dsv.parse = function(text, f) {
+ var o;
+ return dsv.parseRows(text, function(row, i) {
+ if (o) return o(row, i - 1);
+ var a = new Function("d", "return {" + row.map(function(name, i) {
+ return JSON.stringify(name) + ": d[" + i + "]";
+ }).join(",") + "}");
+ o = f ? function(row, i) {
+ return f(a(row), i);
+ } : a;
+ });
+ };
+ dsv.parseRows = function(text, f) {
+ var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol;
+ function token() {
+ if (I >= N) return EOF;
+ if (eol) return eol = false, EOL;
+ var j = I;
+ if (text.charCodeAt(j) === 34) {
+ var i = j;
+ while (i++ < N) {
+ if (text.charCodeAt(i) === 34) {
+ if (text.charCodeAt(i + 1) !== 34) break;
+ ++i;
+ }
+ }
+ I = i + 2;
+ var c = text.charCodeAt(i + 1);
+ if (c === 13) {
+ eol = true;
+ if (text.charCodeAt(i + 2) === 10) ++I;
+ } else if (c === 10) {
+ eol = true;
+ }
+ return text.substring(j + 1, i).replace(/""/g, '"');
+ }
+ while (I < N) {
+ var c = text.charCodeAt(I++), k = 1;
+ if (c === 10) eol = true; else if (c === 13) {
+ eol = true;
+ if (text.charCodeAt(I) === 10) ++I, ++k;
+ } else if (c !== delimiterCode) continue;
+ return text.substring(j, I - k);
+ }
+ return text.substring(j);
+ }
+ while ((t = token()) !== EOF) {
+ var a = [];
+ while (t !== EOL && t !== EOF) {
+ a.push(t);
+ t = token();
+ }
+ if (f && !(a = f(a, n++))) continue;
+ rows.push(a);
+ }
+ return rows;
+ };
+ dsv.format = function(rows) {
+ if (Array.isArray(rows[0])) return dsv.formatRows(rows);
+ var fieldSet = new d3_Set(), fields = [];
+ rows.forEach(function(row) {
+ for (var field in row) {
+ if (!fieldSet.has(field)) {
+ fields.push(fieldSet.add(field));
+ }
+ }
+ });
+ return [ fields.map(formatValue).join(delimiter) ].concat(rows.map(function(row) {
+ return fields.map(function(field) {
+ return formatValue(row[field]);
+ }).join(delimiter);
+ })).join("\n");
+ };
+ dsv.formatRows = function(rows) {
+ return rows.map(formatRow).join("\n");
+ };
+ function formatRow(row) {
+ return row.map(formatValue).join(delimiter);
+ }
+ function formatValue(text) {
+ return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text;
+ }
+ return dsv;
+ }
+ d3.csv = d3_dsv(",", "text/csv");
+ d3.tsv = d3_dsv(" ", "text/tab-separated-values");
+ var d3_timer_id = 0, d3_timer_byId = {}, d3_timer_queue = null, d3_timer_interval, d3_timer_timeout;
+ d3.timer = function(callback, delay, then) {
+ if (arguments.length < 3) {
+ if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return;
+ then = Date.now();
+ }
+ var timer = d3_timer_byId[callback.id];
+ if (timer && timer.callback === callback) {
+ timer.then = then;
+ timer.delay = delay;
+ } else d3_timer_byId[callback.id = ++d3_timer_id] = d3_timer_queue = {
+ callback: callback,
+ then: then,
+ delay: delay,
+ next: d3_timer_queue
+ };
+ if (!d3_timer_interval) {
+ d3_timer_timeout = clearTimeout(d3_timer_timeout);
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+ };
+ function d3_timer_step() {
+ var elapsed, now = Date.now(), t1 = d3_timer_queue;
+ while (t1) {
+ elapsed = now - t1.then;
+ if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+ var delay = d3_timer_flush() - now;
+ if (delay > 24) {
+ if (isFinite(delay)) {
+ clearTimeout(d3_timer_timeout);
+ d3_timer_timeout = setTimeout(d3_timer_step, delay);
+ }
+ d3_timer_interval = 0;
+ } else {
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+ }
+ d3.timer.flush = function() {
+ var elapsed, now = Date.now(), t1 = d3_timer_queue;
+ while (t1) {
+ elapsed = now - t1.then;
+ if (!t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+ d3_timer_flush();
+ };
+ function d3_timer_flush() {
+ var t0 = null, t1 = d3_timer_queue, then = Infinity;
+ while (t1) {
+ if (t1.flush) {
+ delete d3_timer_byId[t1.callback.id];
+ t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
+ } else {
+ then = Math.min(then, t1.then + t1.delay);
+ t1 = (t0 = t1).next;
+ }
+ }
+ return then;
+ }
+ var d3_timer_frame = d3_window.requestAnimationFrame || d3_window.webkitRequestAnimationFrame || d3_window.mozRequestAnimationFrame || d3_window.oRequestAnimationFrame || d3_window.msRequestAnimationFrame || function(callback) {
+ setTimeout(callback, 17);
+ };
+ var d3_format_decimalPoint = ".", d3_format_thousandsSeparator = ",", d3_format_grouping = [ 3, 3 ];
+ var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
+ d3.formatPrefix = function(value, precision) {
+ var i = 0;
+ if (value) {
+ if (value < 0) value *= -1;
+ if (precision) value = d3.round(value, d3_format_precision(value, precision));
+ i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
+ i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
+ }
+ return d3_formatPrefixes[8 + i / 3];
+ };
+ function d3_formatPrefix(d, i) {
+ var k = Math.pow(10, Math.abs(8 - i) * 3);
+ return {
+ scale: i > 8 ? function(d) {
+ return d / k;
+ } : function(d) {
+ return d * k;
+ },
+ symbol: d
+ };
+ }
+ d3.round = function(x, n) {
+ return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);
+ };
+ d3.format = function(specifier) {
+ var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "", basePrefix = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false;
+ if (precision) precision = +precision.substring(1);
+ if (zfill || fill === "0" && align === "=") {
+ zfill = fill = "0";
+ align = "=";
+ if (comma) width -= Math.floor((width - 1) / 4);
+ }
+ switch (type) {
+ case "n":
+ comma = true;
+ type = "g";
+ break;
+
+ case "%":
+ scale = 100;
+ suffix = "%";
+ type = "f";
+ break;
+
+ case "p":
+ scale = 100;
+ suffix = "%";
+ type = "r";
+ break;
+
+ case "b":
+ case "o":
+ case "x":
+ case "X":
+ if (basePrefix) basePrefix = "0" + type.toLowerCase();
+
+ case "c":
+ case "d":
+ integer = true;
+ precision = 0;
+ break;
+
+ case "s":
+ scale = -1;
+ type = "r";
+ break;
+ }
+ if (basePrefix === "#") basePrefix = "";
+ if (type == "r" && !precision) type = "g";
+ if (precision != null) {
+ if (type == "g") precision = Math.max(1, Math.min(21, precision)); else if (type == "e" || type == "f") precision = Math.max(0, Math.min(20, precision));
+ }
+ type = d3_format_types.get(type) || d3_format_typeDefault;
+ var zcomma = zfill && comma;
+ return function(value) {
+ if (integer && value % 1) return "";
+ var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign;
+ if (scale < 0) {
+ var prefix = d3.formatPrefix(value, precision);
+ value = prefix.scale(value);
+ suffix = prefix.symbol;
+ } else {
+ value *= scale;
+ }
+ value = type(value, precision);
+ if (!zfill && comma) value = d3_format_group(value);
+ var length = basePrefix.length + value.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : "";
+ if (zcomma) value = d3_format_group(padding + value);
+ if (d3_format_decimalPoint) value.replace(".", d3_format_decimalPoint);
+ negative += basePrefix;
+ return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + suffix;
+ };
+ };
+ var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i;
+ var d3_format_types = d3.map({
+ b: function(x) {
+ return x.toString(2);
+ },
+ c: function(x) {
+ return String.fromCharCode(x);
+ },
+ o: function(x) {
+ return x.toString(8);
+ },
+ x: function(x) {
+ return x.toString(16);
+ },
+ X: function(x) {
+ return x.toString(16).toUpperCase();
+ },
+ g: function(x, p) {
+ return x.toPrecision(p);
+ },
+ e: function(x, p) {
+ return x.toExponential(p);
+ },
+ f: function(x, p) {
+ return x.toFixed(p);
+ },
+ r: function(x, p) {
+ return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p))));
+ }
+ });
+ function d3_format_precision(x, p) {
+ return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1);
+ }
+ function d3_format_typeDefault(x) {
+ return x + "";
+ }
+ var d3_format_group = d3_identity;
+ if (d3_format_grouping) {
+ var d3_format_groupingLength = d3_format_grouping.length;
+ d3_format_group = function(value) {
+ var i = value.lastIndexOf("."), f = i >= 0 ? "." + value.substring(i + 1) : (i = value.length,
+ ""), t = [], j = 0, g = d3_format_grouping[0];
+ while (i > 0 && g > 0) {
+ t.push(value.substring(i -= g, i + g));
+ g = d3_format_grouping[j = (j + 1) % d3_format_groupingLength];
+ }
+ return t.reverse().join(d3_format_thousandsSeparator || "") + f;
+ };
+ }
+ d3.geo = {};
+ d3.geo.stream = function(object, listener) {
+ if (object && d3_geo_streamObjectType.hasOwnProperty(object.type)) {
+ d3_geo_streamObjectType[object.type](object, listener);
+ } else {
+ d3_geo_streamGeometry(object, listener);
+ }
+ };
+ function d3_geo_streamGeometry(geometry, listener) {
+ if (geometry && d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) {
+ d3_geo_streamGeometryType[geometry.type](geometry, listener);
+ }
+ }
+ var d3_geo_streamObjectType = {
+ Feature: function(feature, listener) {
+ d3_geo_streamGeometry(feature.geometry, listener);
+ },
+ FeatureCollection: function(object, listener) {
+ var features = object.features, i = -1, n = features.length;
+ while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener);
+ }
+ };
+ var d3_geo_streamGeometryType = {
+ Sphere: function(object, listener) {
+ listener.sphere();
+ },
+ Point: function(object, listener) {
+ var coordinate = object.coordinates;
+ listener.point(coordinate[0], coordinate[1]);
+ },
+ MultiPoint: function(object, listener) {
+ var coordinates = object.coordinates, i = -1, n = coordinates.length, coordinate;
+ while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1]);
+ },
+ LineString: function(object, listener) {
+ d3_geo_streamLine(object.coordinates, listener, 0);
+ },
+ MultiLineString: function(object, listener) {
+ var coordinates = object.coordinates, i = -1, n = coordinates.length;
+ while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0);
+ },
+ Polygon: function(object, listener) {
+ d3_geo_streamPolygon(object.coordinates, listener);
+ },
+ MultiPolygon: function(object, listener) {
+ var coordinates = object.coordinates, i = -1, n = coordinates.length;
+ while (++i < n) d3_geo_streamPolygon(coordinates[i], listener);
+ },
+ GeometryCollection: function(object, listener) {
+ var geometries = object.geometries, i = -1, n = geometries.length;
+ while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
+ }
+ };
+ function d3_geo_streamLine(coordinates, listener, closed) {
+ var i = -1, n = coordinates.length - closed, coordinate;
+ listener.lineStart();
+ while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1]);
+ listener.lineEnd();
+ }
+ function d3_geo_streamPolygon(coordinates, listener) {
+ var i = -1, n = coordinates.length;
+ listener.polygonStart();
+ while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1);
+ listener.polygonEnd();
+ }
+ d3.geo.area = function(object) {
+ d3_geo_areaSum = 0;
+ d3.geo.stream(object, d3_geo_area);
+ return d3_geo_areaSum;
+ };
+ var d3_geo_areaSum, d3_geo_areaRingU, d3_geo_areaRingV;
+ var d3_geo_area = {
+ sphere: function() {
+ d3_geo_areaSum += 4 * π;
+ },
+ point: d3_noop,
+ lineStart: d3_noop,
+ lineEnd: d3_noop,
+ polygonStart: function() {
+ d3_geo_areaRingU = 1, d3_geo_areaRingV = 0;
+ d3_geo_area.lineStart = d3_geo_areaRingStart;
+ },
+ polygonEnd: function() {
+ var area = 2 * Math.atan2(d3_geo_areaRingV, d3_geo_areaRingU);
+ d3_geo_areaSum += area < 0 ? 4 * π + area : area;
+ d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop;
+ }
+ };
+ function d3_geo_areaRingStart() {
+ var λ00, φ00, λ0, cosφ0, sinφ0;
+ d3_geo_area.point = function(λ, φ) {
+ d3_geo_area.point = nextPoint;
+ λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4),
+ sinφ0 = Math.sin(φ);
+ };
+ function nextPoint(λ, φ) {
+ λ *= d3_radians;
+ φ = φ * d3_radians / 2 + π / 4;
+ var dλ = λ - λ0, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u0 = d3_geo_areaRingU, v0 = d3_geo_areaRingV, u = cosφ0 * cosφ + k * Math.cos(dλ), v = k * Math.sin(dλ);
+ d3_geo_areaRingU = u0 * u - v0 * v;
+ d3_geo_areaRingV = v0 * u + u0 * v;
+ λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ;
+ }
+ d3_geo_area.lineEnd = function() {
+ nextPoint(λ00, φ00);
+ };
+ }
+ d3.geo.bounds = d3_geo_bounds(d3_identity);
+ function d3_geo_bounds(projectStream) {
+ var x0, y0, x1, y1;
+ var bound = {
+ point: boundPoint,
+ lineStart: d3_noop,
+ lineEnd: d3_noop,
+ polygonStart: function() {
+ bound.lineEnd = boundPolygonLineEnd;
+ },
+ polygonEnd: function() {
+ bound.point = boundPoint;
+ }
+ };
+ function boundPoint(x, y) {
+ if (x < x0) x0 = x;
+ if (x > x1) x1 = x;
+ if (y < y0) y0 = y;
+ if (y > y1) y1 = y;
+ }
+ function boundPolygonLineEnd() {
+ bound.point = bound.lineEnd = d3_noop;
+ }
+ return function(feature) {
+ y1 = x1 = -(x0 = y0 = Infinity);
+ d3.geo.stream(feature, projectStream(bound));
+ return [ [ x0, y0 ], [ x1, y1 ] ];
+ };
+ }
+ d3.geo.centroid = function(object) {
+ d3_geo_centroidDimension = d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ d3.geo.stream(object, d3_geo_centroid);
+ var m;
+ if (d3_geo_centroidW && Math.abs(m = Math.sqrt(d3_geo_centroidX * d3_geo_centroidX + d3_geo_centroidY * d3_geo_centroidY + d3_geo_centroidZ * d3_geo_centroidZ)) > ε) {
+ return [ Math.atan2(d3_geo_centroidY, d3_geo_centroidX) * d3_degrees, Math.asin(Math.max(-1, Math.min(1, d3_geo_centroidZ / m))) * d3_degrees ];
+ }
+ };
+ var d3_geo_centroidDimension, d3_geo_centroidW, d3_geo_centroidX, d3_geo_centroidY, d3_geo_centroidZ;
+ var d3_geo_centroid = {
+ sphere: function() {
+ if (d3_geo_centroidDimension < 2) {
+ d3_geo_centroidDimension = 2;
+ d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ }
+ },
+ point: d3_geo_centroidPoint,
+ lineStart: d3_geo_centroidLineStart,
+ lineEnd: d3_geo_centroidLineEnd,
+ polygonStart: function() {
+ if (d3_geo_centroidDimension < 2) {
+ d3_geo_centroidDimension = 2;
+ d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ }
+ d3_geo_centroid.lineStart = d3_geo_centroidRingStart;
+ },
+ polygonEnd: function() {
+ d3_geo_centroid.lineStart = d3_geo_centroidLineStart;
+ }
+ };
+ function d3_geo_centroidPoint(λ, φ) {
+ if (d3_geo_centroidDimension) return;
+ ++d3_geo_centroidW;
+ λ *= d3_radians;
+ var cosφ = Math.cos(φ *= d3_radians);
+ d3_geo_centroidX += (cosφ * Math.cos(λ) - d3_geo_centroidX) / d3_geo_centroidW;
+ d3_geo_centroidY += (cosφ * Math.sin(λ) - d3_geo_centroidY) / d3_geo_centroidW;
+ d3_geo_centroidZ += (Math.sin(φ) - d3_geo_centroidZ) / d3_geo_centroidW;
+ }
+ function d3_geo_centroidRingStart() {
+ var λ00, φ00;
+ d3_geo_centroidDimension = 1;
+ d3_geo_centroidLineStart();
+ d3_geo_centroidDimension = 2;
+ var linePoint = d3_geo_centroid.point;
+ d3_geo_centroid.point = function(λ, φ) {
+ linePoint(λ00 = λ, φ00 = φ);
+ };
+ d3_geo_centroid.lineEnd = function() {
+ d3_geo_centroid.point(λ00, φ00);
+ d3_geo_centroidLineEnd();
+ d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd;
+ };
+ }
+ function d3_geo_centroidLineStart() {
+ var x0, y0, z0;
+ if (d3_geo_centroidDimension > 1) return;
+ if (d3_geo_centroidDimension < 1) {
+ d3_geo_centroidDimension = 1;
+ d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ }
+ d3_geo_centroid.point = function(λ, φ) {
+ λ *= d3_radians;
+ var cosφ = Math.cos(φ *= d3_radians);
+ x0 = cosφ * Math.cos(λ);
+ y0 = cosφ * Math.sin(λ);
+ z0 = Math.sin(φ);
+ d3_geo_centroid.point = nextPoint;
+ };
+ function nextPoint(λ, φ) {
+ λ *= d3_radians;
+ var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);
+ d3_geo_centroidW += w;
+ d3_geo_centroidX += w * (x0 + (x0 = x));
+ d3_geo_centroidY += w * (y0 + (y0 = y));
+ d3_geo_centroidZ += w * (z0 + (z0 = z));
+ }
+ }
+ function d3_geo_centroidLineEnd() {
+ d3_geo_centroid.point = d3_geo_centroidPoint;
+ }
+ function d3_geo_cartesian(spherical) {
+ var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ);
+ return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ];
+ }
+ function d3_geo_cartesianDot(a, b) {
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
+ }
+ function d3_geo_cartesianCross(a, b) {
+ return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ];
+ }
+ function d3_geo_cartesianAdd(a, b) {
+ a[0] += b[0];
+ a[1] += b[1];
+ a[2] += b[2];
+ }
+ function d3_geo_cartesianScale(vector, k) {
+ return [ vector[0] * k, vector[1] * k, vector[2] * k ];
+ }
+ function d3_geo_cartesianNormalize(d) {
+ var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
+ d[0] /= l;
+ d[1] /= l;
+ d[2] /= l;
+ }
+ function d3_true() {
+ return true;
+ }
+ function d3_geo_spherical(cartesian) {
+ return [ Math.atan2(cartesian[1], cartesian[0]), Math.asin(Math.max(-1, Math.min(1, cartesian[2]))) ];
+ }
+ function d3_geo_sphericalEqual(a, b) {
+ return Math.abs(a[0] - b[0]) < ε && Math.abs(a[1] - b[1]) < ε;
+ }
+ function d3_geo_clipPolygon(segments, compare, inside, interpolate, listener) {
+ var subject = [], clip = [];
+ segments.forEach(function(segment) {
+ if ((n = segment.length - 1) <= 0) return;
+ var n, p0 = segment[0], p1 = segment[n];
+ if (d3_geo_sphericalEqual(p0, p1)) {
+ listener.lineStart();
+ for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]);
+ listener.lineEnd();
+ return;
+ }
+ var a = {
+ point: p0,
+ points: segment,
+ other: null,
+ visited: false,
+ entry: true,
+ subject: true
+ }, b = {
+ point: p0,
+ points: [ p0 ],
+ other: a,
+ visited: false,
+ entry: false,
+ subject: false
+ };
+ a.other = b;
+ subject.push(a);
+ clip.push(b);
+ a = {
+ point: p1,
+ points: [ p1 ],
+ other: null,
+ visited: false,
+ entry: false,
+ subject: true
+ };
+ b = {
+ point: p1,
+ points: [ p1 ],
+ other: a,
+ visited: false,
+ entry: true,
+ subject: false
+ };
+ a.other = b;
+ subject.push(a);
+ clip.push(b);
+ });
+ clip.sort(compare);
+ d3_geo_clipPolygonLinkCircular(subject);
+ d3_geo_clipPolygonLinkCircular(clip);
+ if (!subject.length) return;
+ if (inside) for (var i = 1, e = !inside(clip[0].point), n = clip.length; i < n; ++i) {
+ clip[i].entry = e = !e;
+ }
+ var start = subject[0], current, points, point;
+ while (1) {
+ current = start;
+ while (current.visited) if ((current = current.next) === start) return;
+ points = current.points;
+ listener.lineStart();
+ do {
+ current.visited = current.other.visited = true;
+ if (current.entry) {
+ if (current.subject) {
+ for (var i = 0; i < points.length; i++) listener.point((point = points[i])[0], point[1]);
+ } else {
+ interpolate(current.point, current.next.point, 1, listener);
+ }
+ current = current.next;
+ } else {
+ if (current.subject) {
+ points = current.prev.points;
+ for (var i = points.length; --i >= 0; ) listener.point((point = points[i])[0], point[1]);
+ } else {
+ interpolate(current.point, current.prev.point, -1, listener);
+ }
+ current = current.prev;
+ }
+ current = current.other;
+ points = current.points;
+ } while (!current.visited);
+ listener.lineEnd();
+ }
+ }
+ function d3_geo_clipPolygonLinkCircular(array) {
+ if (!(n = array.length)) return;
+ var n, i = 0, a = array[0], b;
+ while (++i < n) {
+ a.next = b = array[i];
+ b.prev = a;
+ a = b;
+ }
+ a.next = b = array[0];
+ b.prev = a;
+ }
+ function d3_geo_clip(pointVisible, clipLine, interpolate) {
+ return function(listener) {
+ var line = clipLine(listener);
+ var clip = {
+ point: point,
+ lineStart: lineStart,
+ lineEnd: lineEnd,
+ polygonStart: function() {
+ clip.point = pointRing;
+ clip.lineStart = ringStart;
+ clip.lineEnd = ringEnd;
+ invisible = false;
+ invisibleArea = visibleArea = 0;
+ segments = [];
+ listener.polygonStart();
+ },
+ polygonEnd: function() {
+ clip.point = point;
+ clip.lineStart = lineStart;
+ clip.lineEnd = lineEnd;
+ segments = d3.merge(segments);
+ if (segments.length) {
+ d3_geo_clipPolygon(segments, d3_geo_clipSort, null, interpolate, listener);
+ } else if (visibleArea < -ε || invisible && invisibleArea < -ε) {
+ listener.lineStart();
+ interpolate(null, null, 1, listener);
+ listener.lineEnd();
+ }
+ listener.polygonEnd();
+ segments = null;
+ },
+ sphere: function() {
+ listener.polygonStart();
+ listener.lineStart();
+ interpolate(null, null, 1, listener);
+ listener.lineEnd();
+ listener.polygonEnd();
+ }
+ };
+ function point(λ, φ) {
+ if (pointVisible(λ, φ)) listener.point(λ, φ);
+ }
+ function pointLine(λ, φ) {
+ line.point(λ, φ);
+ }
+ function lineStart() {
+ clip.point = pointLine;
+ line.lineStart();
+ }
+ function lineEnd() {
+ clip.point = point;
+ line.lineEnd();
+ }
+ var segments, visibleArea, invisibleArea, invisible;
+ var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), ring;
+ function pointRing(λ, φ) {
+ ringListener.point(λ, φ);
+ ring.push([ λ, φ ]);
+ }
+ function ringStart() {
+ ringListener.lineStart();
+ ring = [];
+ }
+ function ringEnd() {
+ pointRing(ring[0][0], ring[0][1]);
+ ringListener.lineEnd();
+ var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length;
+ if (!n) {
+ invisible = true;
+ invisibleArea += d3_geo_clipAreaRing(ring, -1);
+ ring = null;
+ return;
+ }
+ ring = null;
+ if (clean & 1) {
+ segment = ringSegments[0];
+ visibleArea += d3_geo_clipAreaRing(segment, 1);
+ var n = segment.length - 1, i = -1, point;
+ listener.lineStart();
+ while (++i < n) listener.point((point = segment[i])[0], point[1]);
+ listener.lineEnd();
+ return;
+ }
+ if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
+ segments.push(ringSegments.filter(d3_geo_clipSegmentLength1));
+ }
+ return clip;
+ };
+ }
+ function d3_geo_clipSegmentLength1(segment) {
+ return segment.length > 1;
+ }
+ function d3_geo_clipBufferListener() {
+ var lines = [], line;
+ return {
+ lineStart: function() {
+ lines.push(line = []);
+ },
+ point: function(λ, φ) {
+ line.push([ λ, φ ]);
+ },
+ lineEnd: d3_noop,
+ buffer: function() {
+ var buffer = lines;
+ lines = [];
+ line = null;
+ return buffer;
+ },
+ rejoin: function() {
+ if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
+ }
+ };
+ }
+ function d3_geo_clipAreaRing(ring, invisible) {
+ if (!(n = ring.length)) return 0;
+ var n, i = 0, area = 0, p = ring[0], λ = p[0], φ = p[1], cosφ = Math.cos(φ), x0 = Math.atan2(invisible * Math.sin(λ) * cosφ, Math.sin(φ)), y0 = 1 - invisible * Math.cos(λ) * cosφ, x1 = x0, x, y;
+ while (++i < n) {
+ p = ring[i];
+ cosφ = Math.cos(φ = p[1]);
+ x = Math.atan2(invisible * Math.sin(λ = p[0]) * cosφ, Math.sin(φ));
+ y = 1 - invisible * Math.cos(λ) * cosφ;
+ if (Math.abs(y0 - 2) < ε && Math.abs(y - 2) < ε) continue;
+ if (Math.abs(y) < ε || Math.abs(y0) < ε) {} else if (Math.abs(Math.abs(x - x0) - π) < ε) {
+ if (y + y0 > 2) area += 4 * (x - x0);
+ } else if (Math.abs(y0 - 2) < ε) area += 4 * (x - x1); else area += ((3 * π + x - x0) % (2 * π) - π) * (y0 + y);
+ x1 = x0, x0 = x, y0 = y;
+ }
+ return area;
+ }
+ function d3_geo_clipSort(a, b) {
+ return ((a = a.point)[0] < 0 ? a[1] - π / 2 - ε : π / 2 - a[1]) - ((b = b.point)[0] < 0 ? b[1] - π / 2 - ε : π / 2 - b[1]);
+ }
+ var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate);
+ function d3_geo_clipAntimeridianLine(listener) {
+ var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean;
+ return {
+ lineStart: function() {
+ listener.lineStart();
+ clean = 1;
+ },
+ point: function(λ1, φ1) {
+ var sλ1 = λ1 > 0 ? π : -π, dλ = Math.abs(λ1 - λ0);
+ if (Math.abs(dλ - π) < ε) {
+ listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? π / 2 : -π / 2);
+ listener.point(sλ0, φ0);
+ listener.lineEnd();
+ listener.lineStart();
+ listener.point(sλ1, φ0);
+ listener.point(λ1, φ0);
+ clean = 0;
+ } else if (sλ0 !== sλ1 && dλ >= π) {
+ if (Math.abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε;
+ if (Math.abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε;
+ φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1);
+ listener.point(sλ0, φ0);
+ listener.lineEnd();
+ listener.lineStart();
+ listener.point(sλ1, φ0);
+ clean = 0;
+ }
+ listener.point(λ0 = λ1, φ0 = φ1);
+ sλ0 = sλ1;
+ },
+ lineEnd: function() {
+ listener.lineEnd();
+ λ0 = φ0 = NaN;
+ },
+ clean: function() {
+ return 2 - clean;
+ }
+ };
+ }
+ function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) {
+ var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1);
+ return Math.abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2;
+ }
+ function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) {
+ var φ;
+ if (from == null) {
+ φ = direction * π / 2;
+ listener.point(-π, φ);
+ listener.point(0, φ);
+ listener.point(π, φ);
+ listener.point(Ï€, 0);
+ listener.point(π, -φ);
+ listener.point(0, -φ);
+ listener.point(-π, -φ);
+ listener.point(-Ï€, 0);
+ listener.point(-π, φ);
+ } else if (Math.abs(from[0] - to[0]) > ε) {
+ var s = (from[0] < to[0] ? 1 : -1) * π;
+ φ = direction * s / 2;
+ listener.point(-s, φ);
+ listener.point(0, φ);
+ listener.point(s, φ);
+ } else {
+ listener.point(to[0], to[1]);
+ }
+ }
+ function d3_geo_clipCircle(radius) {
+ var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = Math.abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians);
+ return d3_geo_clip(visible, clipLine, interpolate);
+ function visible(λ, φ) {
+ return Math.cos(λ) * Math.cos(φ) > cr;
+ }
+ function clipLine(listener) {
+ var point0, c0, v0, v00, clean;
+ return {
+ lineStart: function() {
+ v00 = v0 = false;
+ clean = 1;
+ },
+ point: function(λ, φ) {
+ var point1 = [ λ, φ ], point2, v = visible(λ, φ), c = smallRadius ? v ? 0 : code(λ, φ) : v ? code(λ + (λ < 0 ? π : -π), φ) : 0;
+ if (!point0 && (v00 = v0 = v)) listener.lineStart();
+ if (v !== v0) {
+ point2 = intersect(point0, point1);
+ if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) {
+ point1[0] += ε;
+ point1[1] += ε;
+ v = visible(point1[0], point1[1]);
+ }
+ }
+ if (v !== v0) {
+ clean = 0;
+ if (v) {
+ listener.lineStart();
+ point2 = intersect(point1, point0);
+ listener.point(point2[0], point2[1]);
+ } else {
+ point2 = intersect(point0, point1);
+ listener.point(point2[0], point2[1]);
+ listener.lineEnd();
+ }
+ point0 = point2;
+ } else if (notHemisphere && point0 && smallRadius ^ v) {
+ var t;
+ if (!(c & c0) && (t = intersect(point1, point0, true))) {
+ clean = 0;
+ if (smallRadius) {
+ listener.lineStart();
+ listener.point(t[0][0], t[0][1]);
+ listener.point(t[1][0], t[1][1]);
+ listener.lineEnd();
+ } else {
+ listener.point(t[1][0], t[1][1]);
+ listener.lineEnd();
+ listener.lineStart();
+ listener.point(t[0][0], t[0][1]);
+ }
+ }
+ }
+ if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) {
+ listener.point(point1[0], point1[1]);
+ }
+ point0 = point1, v0 = v, c0 = c;
+ },
+ lineEnd: function() {
+ if (v0) listener.lineEnd();
+ point0 = null;
+ },
+ clean: function() {
+ return clean | (v00 && v0) << 1;
+ }
+ };
+ }
+ function intersect(a, b, two) {
+ var pa = d3_geo_cartesian(a), pb = d3_geo_cartesian(b);
+ var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
+ if (!determinant) return !two && a;
+ var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2);
+ d3_geo_cartesianAdd(A, B);
+ var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t2 = w * w - uu * (d3_geo_cartesianDot(A, A) - 1);
+ if (t2 < 0) return;
+ var t = Math.sqrt(t2), q = d3_geo_cartesianScale(u, (-w - t) / uu);
+ d3_geo_cartesianAdd(q, A);
+ q = d3_geo_spherical(q);
+ if (!two) return q;
+ var λ0 = a[0], λ1 = b[0], φ0 = a[1], φ1 = b[1], z;
+ if (λ1 < λ0) z = λ0, λ0 = λ1, λ1 = z;
+ var δλ = λ1 - λ0, polar = Math.abs(δλ - π) < ε, meridian = polar || δλ < ε;
+ if (!polar && φ1 < φ0) z = φ0, φ0 = φ1, φ1 = z;
+ if (meridian ? polar ? φ0 + φ1 > 0 ^ q[1] < (Math.abs(q[0] - λ0) < ε ? φ0 : φ1) : φ0 <= q[1] && q[1] <= φ1 : δλ > π ^ (λ0 <= q[0] && q[0] <= λ1)) {
+ var q1 = d3_geo_cartesianScale(u, (-w + t) / uu);
+ d3_geo_cartesianAdd(q1, A);
+ return [ q, d3_geo_spherical(q1) ];
+ }
+ }
+ function code(λ, φ) {
+ var r = smallRadius ? radius : π - radius, code = 0;
+ if (λ < -r) code |= 1; else if (λ > r) code |= 2;
+ if (φ < -r) code |= 4; else if (φ > r) code |= 8;
+ return code;
+ }
+ }
+ var d3_geo_clipViewMAX = 1e9;
+ function d3_geo_clipView(x0, y0, x1, y1) {
+ return function(listener) {
+ var listener_ = listener, bufferListener = d3_geo_clipBufferListener(), segments, polygon, ring;
+ var clip = {
+ point: point,
+ lineStart: lineStart,
+ lineEnd: lineEnd,
+ polygonStart: function() {
+ listener = bufferListener;
+ segments = [];
+ polygon = [];
+ },
+ polygonEnd: function() {
+ listener = listener_;
+ if ((segments = d3.merge(segments)).length) {
+ listener.polygonStart();
+ d3_geo_clipPolygon(segments, compare, inside, interpolate, listener);
+ listener.polygonEnd();
+ } else if (insidePolygon([ x0, y0 ])) {
+ listener.polygonStart(), listener.lineStart();
+ interpolate(null, null, 1, listener);
+ listener.lineEnd(), listener.polygonEnd();
+ }
+ segments = polygon = ring = null;
+ }
+ };
+ function inside(point) {
+ var a = corner(point, -1), i = insidePolygon([ a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0 ]);
+ return i;
+ }
+ function insidePolygon(p) {
+ var wn = 0, n = polygon.length, y = p[1];
+ for (var i = 0; i < n; ++i) {
+ for (var j = 1, v = polygon[i], m = v.length, a = v[0]; j < m; ++j) {
+ b = v[j];
+ if (a[1] <= y) {
+ if (b[1] > y && isLeft(a, b, p) > 0) ++wn;
+ } else {
+ if (b[1] <= y && isLeft(a, b, p) < 0) --wn;
+ }
+ a = b;
+ }
+ }
+ return wn !== 0;
+ }
+ function isLeft(a, b, c) {
+ return (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]);
+ }
+ function interpolate(from, to, direction, listener) {
+ var a = 0, a1 = 0;
+ if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoints(from, to) < 0 ^ direction > 0) {
+ do {
+ listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);
+ } while ((a = (a + direction + 4) % 4) !== a1);
+ } else {
+ listener.point(to[0], to[1]);
+ }
+ }
+ function visible(x, y) {
+ return x0 <= x && x <= x1 && y0 <= y && y <= y1;
+ }
+ function point(x, y) {
+ if (visible(x, y)) listener.point(x, y);
+ }
+ var x__, y__, v__, x_, y_, v_, first;
+ function lineStart() {
+ clip.point = linePoint;
+ if (polygon) polygon.push(ring = []);
+ first = true;
+ v_ = false;
+ x_ = y_ = NaN;
+ }
+ function lineEnd() {
+ if (segments) {
+ linePoint(x__, y__);
+ if (v__ && v_) bufferListener.rejoin();
+ segments.push(bufferListener.buffer());
+ }
+ clip.point = point;
+ if (v_) listener.lineEnd();
+ }
+ function linePoint(x, y) {
+ x = Math.max(-d3_geo_clipViewMAX, Math.min(d3_geo_clipViewMAX, x));
+ y = Math.max(-d3_geo_clipViewMAX, Math.min(d3_geo_clipViewMAX, y));
+ var v = visible(x, y);
+ if (polygon) ring.push([ x, y ]);
+ if (first) {
+ x__ = x, y__ = y, v__ = v;
+ first = false;
+ if (v) {
+ listener.lineStart();
+ listener.point(x, y);
+ }
+ } else {
+ if (v && v_) listener.point(x, y); else {
+ var a = [ x_, y_ ], b = [ x, y ];
+ if (clipLine(a, b)) {
+ if (!v_) {
+ listener.lineStart();
+ listener.point(a[0], a[1]);
+ }
+ listener.point(b[0], b[1]);
+ if (!v) listener.lineEnd();
+ } else {
+ listener.lineStart();
+ listener.point(x, y);
+ }
+ }
+ }
+ x_ = x, y_ = y, v_ = v;
+ }
+ return clip;
+ };
+ function corner(p, direction) {
+ return Math.abs(p[0] - x0) < ε ? direction > 0 ? 0 : 3 : Math.abs(p[0] - x1) < ε ? direction > 0 ? 2 : 1 : Math.abs(p[1] - y0) < ε ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
+ }
+ function compare(a, b) {
+ return comparePoints(a.point, b.point);
+ }
+ function comparePoints(a, b) {
+ var ca = corner(a, 1), cb = corner(b, 1);
+ return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0];
+ }
+ function clipLine(a, b) {
+ var dx = b[0] - a[0], dy = b[1] - a[1], t = [ 0, 1 ];
+ if (Math.abs(dx) < ε && Math.abs(dy) < ε) return x0 <= a[0] && a[0] <= x1 && y0 <= a[1] && a[1] <= y1;
+ if (d3_geo_clipViewT(x0 - a[0], dx, t) && d3_geo_clipViewT(a[0] - x1, -dx, t) && d3_geo_clipViewT(y0 - a[1], dy, t) && d3_geo_clipViewT(a[1] - y1, -dy, t)) {
+ if (t[1] < 1) {
+ b[0] = a[0] + t[1] * dx;
+ b[1] = a[1] + t[1] * dy;
+ }
+ if (t[0] > 0) {
+ a[0] += t[0] * dx;
+ a[1] += t[0] * dy;
+ }
+ return true;
+ }
+ return false;
+ }
+ }
+ function d3_geo_clipViewT(num, denominator, t) {
+ if (Math.abs(denominator) < ε) return num <= 0;
+ var u = num / denominator;
+ if (denominator > 0) {
+ if (u > t[1]) return false;
+ if (u > t[0]) t[0] = u;
+ } else {
+ if (u < t[0]) return false;
+ if (u < t[1]) t[1] = u;
+ }
+ return true;
+ }
+ function d3_geo_compose(a, b) {
+ function compose(x, y) {
+ return x = a(x, y), b(x[0], x[1]);
+ }
+ if (a.invert && b.invert) compose.invert = function(x, y) {
+ return x = b.invert(x, y), x && a.invert(x[0], x[1]);
+ };
+ return compose;
+ }
+ function d3_geo_resample(project) {
+ var δ2 = .5, maxDepth = 16;
+ function resample(stream) {
+ var λ0, x0, y0, a0, b0, c0;
+ var resample = {
+ point: point,
+ lineStart: lineStart,
+ lineEnd: lineEnd,
+ polygonStart: function() {
+ stream.polygonStart();
+ resample.lineStart = polygonLineStart;
+ },
+ polygonEnd: function() {
+ stream.polygonEnd();
+ resample.lineStart = lineStart;
+ }
+ };
+ function point(x, y) {
+ x = project(x, y);
+ stream.point(x[0], x[1]);
+ }
+ function lineStart() {
+ x0 = NaN;
+ resample.point = linePoint;
+ stream.lineStart();
+ }
+ function linePoint(λ, φ) {
+ var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ);
+ resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
+ stream.point(x0, y0);
+ }
+ function lineEnd() {
+ resample.point = point;
+ stream.lineEnd();
+ }
+ function polygonLineStart() {
+ var λ00, φ00, x00, y00, a00, b00, c00;
+ lineStart();
+ resample.point = function(λ, φ) {
+ linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;
+ resample.point = linePoint;
+ };
+ resample.lineEnd = function() {
+ resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream);
+ resample.lineEnd = lineEnd;
+ lineEnd();
+ };
+ }
+ return resample;
+ }
+ function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) {
+ var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
+ if (d2 > 4 * δ2 && depth--) {
+ var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = Math.abs(Math.abs(c) - 1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;
+ if (dz * dz / d2 > δ2 || Math.abs((dx * dx2 + dy * dy2) / d2 - .5) > .3) {
+ resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream);
+ stream.point(x2, y2);
+ resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream);
+ }
+ }
+ }
+ resample.precision = function(_) {
+ if (!arguments.length) return Math.sqrt(δ2);
+ maxDepth = (δ2 = _ * _) > 0 && 16;
+ return resample;
+ };
+ return resample;
+ }
+ d3.geo.projection = d3_geo_projection;
+ d3.geo.projectionMutator = d3_geo_projectionMutator;
+ function d3_geo_projection(project) {
+ return d3_geo_projectionMutator(function() {
+ return project;
+ })();
+ }
+ function d3_geo_projectionMutator(projectAt) {
+ var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) {
+ x = project(x, y);
+ return [ x[0] * k + δx, δy - x[1] * k ];
+ }), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, preclip = d3_geo_clipAntimeridian, postclip = d3_identity, clipAngle = null, clipExtent = null;
+ function projection(point) {
+ point = projectRotate(point[0] * d3_radians, point[1] * d3_radians);
+ return [ point[0] * k + δx, δy - point[1] * k ];
+ }
+ function invert(point) {
+ point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k);
+ return point && [ point[0] * d3_degrees, point[1] * d3_degrees ];
+ }
+ projection.stream = function(stream) {
+ return d3_geo_projectionRadiansRotate(rotate, preclip(projectResample(postclip(stream))));
+ };
+ projection.clipAngle = function(_) {
+ if (!arguments.length) return clipAngle;
+ preclip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle((clipAngle = +_) * d3_radians);
+ return projection;
+ };
+ projection.clipExtent = function(_) {
+ if (!arguments.length) return clipExtent;
+ clipExtent = _;
+ postclip = _ == null ? d3_identity : d3_geo_clipView(_[0][0], _[0][1], _[1][0], _[1][1]);
+ return projection;
+ };
+ projection.scale = function(_) {
+ if (!arguments.length) return k;
+ k = +_;
+ return reset();
+ };
+ projection.translate = function(_) {
+ if (!arguments.length) return [ x, y ];
+ x = +_[0];
+ y = +_[1];
+ return reset();
+ };
+ projection.center = function(_) {
+ if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ];
+ λ = _[0] % 360 * d3_radians;
+ φ = _[1] % 360 * d3_radians;
+ return reset();
+ };
+ projection.rotate = function(_) {
+ if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ];
+ δλ = _[0] % 360 * d3_radians;
+ δφ = _[1] % 360 * d3_radians;
+ δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0;
+ return reset();
+ };
+ d3.rebind(projection, projectResample, "precision");
+ function reset() {
+ projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project);
+ var center = project(λ, φ);
+ δx = x - center[0] * k;
+ δy = y + center[1] * k;
+ return projection;
+ }
+ return function() {
+ project = projectAt.apply(this, arguments);
+ projection.invert = project.invert && invert;
+ return reset();
+ };
+ }
+ function d3_geo_projectionRadiansRotate(rotate, stream) {
+ return {
+ point: function(x, y) {
+ y = rotate(x * d3_radians, y * d3_radians), x = y[0];
+ stream.point(x > π ? x - 2 * π : x < -π ? x + 2 * π : x, y[1]);
+ },
+ sphere: function() {
+ stream.sphere();
+ },
+ lineStart: function() {
+ stream.lineStart();
+ },
+ lineEnd: function() {
+ stream.lineEnd();
+ },
+ polygonStart: function() {
+ stream.polygonStart();
+ },
+ polygonEnd: function() {
+ stream.polygonEnd();
+ }
+ };
+ }
+ function d3_geo_equirectangular(λ, φ) {
+ return [ λ, φ ];
+ }
+ (d3.geo.equirectangular = function() {
+ return d3_geo_projection(d3_geo_equirectangular);
+ }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular;
+ d3.geo.rotation = function(rotate) {
+ rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0);
+ function forward(coordinates) {
+ coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians);
+ return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;
+ }
+ forward.invert = function(coordinates) {
+ coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians);
+ return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;
+ };
+ return forward;
+ };
+ function d3_geo_rotation(δλ, δφ, δγ) {
+ return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_equirectangular;
+ }
+ function d3_geo_forwardRotationλ(δλ) {
+ return function(λ, φ) {
+ return λ += δλ, [ λ > π ? λ - 2 * π : λ < -π ? λ + 2 * π : λ, φ ];
+ };
+ }
+ function d3_geo_rotationλ(δλ) {
+ var rotation = d3_geo_forwardRotationλ(δλ);
+ rotation.invert = d3_geo_forwardRotationλ(-δλ);
+ return rotation;
+ }
+ function d3_geo_rotationφγ(δφ, δγ) {
+ var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ);
+ function rotation(λ, φ) {
+ var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ;
+ return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδγ + y * sinδγ))) ];
+ }
+ rotation.invert = function(λ, φ) {
+ var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ;
+ return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδφ - x * sinδφ))) ];
+ };
+ return rotation;
+ }
+ d3.geo.circle = function() {
+ var origin = [ 0, 0 ], angle, precision = 6, interpolate;
+ function circle() {
+ var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = [];
+ interpolate(null, null, 1, {
+ point: function(x, y) {
+ ring.push(x = rotate(x, y));
+ x[0] *= d3_degrees, x[1] *= d3_degrees;
+ }
+ });
+ return {
+ type: "Polygon",
+ coordinates: [ ring ]
+ };
+ }
+ circle.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ return circle;
+ };
+ circle.angle = function(x) {
+ if (!arguments.length) return angle;
+ interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians);
+ return circle;
+ };
+ circle.precision = function(_) {
+ if (!arguments.length) return precision;
+ interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians);
+ return circle;
+ };
+ return circle.angle(90);
+ };
+ function d3_geo_circleInterpolate(radius, precision) {
+ var cr = Math.cos(radius), sr = Math.sin(radius);
+ return function(from, to, direction, listener) {
+ if (from != null) {
+ from = d3_geo_circleAngle(cr, from);
+ to = d3_geo_circleAngle(cr, to);
+ if (direction > 0 ? from < to : from > to) from += direction * 2 * π;
+ } else {
+ from = radius + direction * 2 * π;
+ to = radius;
+ }
+ var point;
+ for (var step = direction * precision, t = from; direction > 0 ? t > to : t < to; t -= step) {
+ listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]);
+ }
+ };
+ }
+ function d3_geo_circleAngle(cr, point) {
+ var a = d3_geo_cartesian(point);
+ a[0] -= cr;
+ d3_geo_cartesianNormalize(a);
+ var angle = d3_acos(-a[1]);
+ return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI);
+ }
+ d3.geo.distance = function(a, b) {
+ var Δλ = (b[0] - a[0]) * d3_radians, φ0 = a[1] * d3_radians, φ1 = b[1] * d3_radians, sinΔλ = Math.sin(Δλ), cosΔλ = Math.cos(Δλ), sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), sinφ1 = Math.sin(φ1), cosφ1 = Math.cos(φ1), t;
+ return Math.atan2(Math.sqrt((t = cosφ1 * sinΔλ) * t + (t = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * t), sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ);
+ };
+ d3.geo.graticule = function() {
+ var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5;
+ function graticule() {
+ return {
+ type: "MultiLineString",
+ coordinates: lines()
+ };
+ }
+ function lines() {
+ return d3.range(Math.ceil(X0 / DX) * DX, X1, DX).map(X).concat(d3.range(Math.ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(d3.range(Math.ceil(x0 / dx) * dx, x1, dx).filter(function(x) {
+ return Math.abs(x % DX) > ε;
+ }).map(x)).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).filter(function(y) {
+ return Math.abs(y % DY) > ε;
+ }).map(y));
+ }
+ graticule.lines = function() {
+ return lines().map(function(coordinates) {
+ return {
+ type: "LineString",
+ coordinates: coordinates
+ };
+ });
+ };
+ graticule.outline = function() {
+ return {
+ type: "Polygon",
+ coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ]
+ };
+ };
+ graticule.extent = function(_) {
+ if (!arguments.length) return graticule.minorExtent();
+ return graticule.majorExtent(_).minorExtent(_);
+ };
+ graticule.majorExtent = function(_) {
+ if (!arguments.length) return [ [ X0, Y0 ], [ X1, Y1 ] ];
+ X0 = +_[0][0], X1 = +_[1][0];
+ Y0 = +_[0][1], Y1 = +_[1][1];
+ if (X0 > X1) _ = X0, X0 = X1, X1 = _;
+ if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _;
+ return graticule.precision(precision);
+ };
+ graticule.minorExtent = function(_) {
+ if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ];
+ x0 = +_[0][0], x1 = +_[1][0];
+ y0 = +_[0][1], y1 = +_[1][1];
+ if (x0 > x1) _ = x0, x0 = x1, x1 = _;
+ if (y0 > y1) _ = y0, y0 = y1, y1 = _;
+ return graticule.precision(precision);
+ };
+ graticule.step = function(_) {
+ if (!arguments.length) return graticule.minorStep();
+ return graticule.majorStep(_).minorStep(_);
+ };
+ graticule.majorStep = function(_) {
+ if (!arguments.length) return [ DX, DY ];
+ DX = +_[0], DY = +_[1];
+ return graticule;
+ };
+ graticule.minorStep = function(_) {
+ if (!arguments.length) return [ dx, dy ];
+ dx = +_[0], dy = +_[1];
+ return graticule;
+ };
+ graticule.precision = function(_) {
+ if (!arguments.length) return precision;
+ precision = +_;
+ x = d3_geo_graticuleX(y0, y1, 90);
+ y = d3_geo_graticuleY(x0, x1, precision);
+ X = d3_geo_graticuleX(Y0, Y1, 90);
+ Y = d3_geo_graticuleY(X0, X1, precision);
+ return graticule;
+ };
+ return graticule.majorExtent([ [ -180, -90 + ε ], [ 180, 90 - ε ] ]).minorExtent([ [ -180, -80 - ε ], [ 180, 80 + ε ] ]);
+ };
+ function d3_geo_graticuleX(y0, y1, dy) {
+ var y = d3.range(y0, y1 - ε, dy).concat(y1);
+ return function(x) {
+ return y.map(function(y) {
+ return [ x, y ];
+ });
+ };
+ }
+ function d3_geo_graticuleY(x0, x1, dx) {
+ var x = d3.range(x0, x1 - ε, dx).concat(x1);
+ return function(y) {
+ return x.map(function(x) {
+ return [ x, y ];
+ });
+ };
+ }
+ function d3_source(d) {
+ return d.source;
+ }
+ function d3_target(d) {
+ return d.target;
+ }
+ d3.geo.greatArc = function() {
+ var source = d3_source, source_, target = d3_target, target_;
+ function greatArc() {
+ return {
+ type: "LineString",
+ coordinates: [ source_ || source.apply(this, arguments), target_ || target.apply(this, arguments) ]
+ };
+ }
+ greatArc.distance = function() {
+ return d3.geo.distance(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments));
+ };
+ greatArc.source = function(_) {
+ if (!arguments.length) return source;
+ source = _, source_ = typeof _ === "function" ? null : _;
+ return greatArc;
+ };
+ greatArc.target = function(_) {
+ if (!arguments.length) return target;
+ target = _, target_ = typeof _ === "function" ? null : _;
+ return greatArc;
+ };
+ greatArc.precision = function() {
+ return arguments.length ? greatArc : 0;
+ };
+ return greatArc;
+ };
+ d3.geo.interpolate = function(source, target) {
+ return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians);
+ };
+ function d3_geo_interpolate(x0, y0, x1, y1) {
+ var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(d3_haversin(y1 - y0) + cy0 * cy1 * d3_haversin(x1 - x0))), k = 1 / Math.sin(d);
+ var interpolate = d ? function(t) {
+ var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;
+ return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ];
+ } : function() {
+ return [ x0 * d3_degrees, y0 * d3_degrees ];
+ };
+ interpolate.distance = d;
+ return interpolate;
+ }
+ d3.geo.length = function(object) {
+ d3_geo_lengthSum = 0;
+ d3.geo.stream(object, d3_geo_length);
+ return d3_geo_lengthSum;
+ };
+ var d3_geo_lengthSum;
+ var d3_geo_length = {
+ sphere: d3_noop,
+ point: d3_noop,
+ lineStart: d3_geo_lengthLineStart,
+ lineEnd: d3_noop,
+ polygonStart: d3_noop,
+ polygonEnd: d3_noop
+ };
+ function d3_geo_lengthLineStart() {
+ var λ0, sinφ0, cosφ0;
+ d3_geo_length.point = function(λ, φ) {
+ λ0 = λ * d3_radians, sinφ0 = Math.sin(φ *= d3_radians), cosφ0 = Math.cos(φ);
+ d3_geo_length.point = nextPoint;
+ };
+ d3_geo_length.lineEnd = function() {
+ d3_geo_length.point = d3_geo_length.lineEnd = d3_noop;
+ };
+ function nextPoint(λ, φ) {
+ var sinφ = Math.sin(φ *= d3_radians), cosφ = Math.cos(φ), t = Math.abs((λ *= d3_radians) - λ0), cosΔλ = Math.cos(t);
+ d3_geo_lengthSum += Math.atan2(Math.sqrt((t = cosφ * Math.sin(t)) * t + (t = cosφ0 * sinφ - sinφ0 * cosφ * cosΔλ) * t), sinφ0 * sinφ + cosφ0 * cosφ * cosΔλ);
+ λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ;
+ }
+ }
+ function d3_geo_conic(projectAt) {
+ var φ0 = 0, φ1 = π / 3, m = d3_geo_projectionMutator(projectAt), p = m(φ0, φ1);
+ p.parallels = function(_) {
+ if (!arguments.length) return [ φ0 / π * 180, φ1 / π * 180 ];
+ return m(φ0 = _[0] * π / 180, φ1 = _[1] * π / 180);
+ };
+ return p;
+ }
+ function d3_geo_conicEqualArea(φ0, φ1) {
+ var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), Ï0 = Math.sqrt(C) / n;
+ function forward(λ, φ) {
+ var Ï = Math.sqrt(C - 2 * n * Math.sin(φ)) / n;
+ return [ Ï * Math.sin(λ *= n), Ï0 - Ï * Math.cos(λ) ];
+ }
+ forward.invert = function(x, y) {
+ var Ï0_y = Ï0 - y;
+ return [ Math.atan2(x, Ï0_y) / n, Math.asin((C - (x * x + Ï0_y * Ï0_y) * n * n) / (2 * n)) ];
+ };
+ return forward;
+ }
+ (d3.geo.conicEqualArea = function() {
+ return d3_geo_conic(d3_geo_conicEqualArea);
+ }).raw = d3_geo_conicEqualArea;
+ d3.geo.albersUsa = function() {
+ var lower48 = d3.geo.conicEqualArea().rotate([ 98, 0 ]).center([ 0, 38 ]).parallels([ 29.5, 45.5 ]);
+ var alaska = d3.geo.conicEqualArea().rotate([ 160, 0 ]).center([ 0, 60 ]).parallels([ 55, 65 ]);
+ var hawaii = d3.geo.conicEqualArea().rotate([ 160, 0 ]).center([ 0, 20 ]).parallels([ 8, 18 ]);
+ var puertoRico = d3.geo.conicEqualArea().rotate([ 60, 0 ]).center([ 0, 10 ]).parallels([ 8, 18 ]);
+ var alaskaInvert, hawaiiInvert, puertoRicoInvert;
+ function albersUsa(coordinates) {
+ return projection(coordinates)(coordinates);
+ }
+ function projection(point) {
+ var lon = point[0], lat = point[1];
+ return lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48;
+ }
+ albersUsa.invert = function(coordinates) {
+ return alaskaInvert(coordinates) || hawaiiInvert(coordinates) || puertoRicoInvert(coordinates) || lower48.invert(coordinates);
+ };
+ albersUsa.scale = function(x) {
+ if (!arguments.length) return lower48.scale();
+ lower48.scale(x);
+ alaska.scale(x * .6);
+ hawaii.scale(x);
+ puertoRico.scale(x * 1.5);
+ return albersUsa.translate(lower48.translate());
+ };
+ albersUsa.translate = function(x) {
+ if (!arguments.length) return lower48.translate();
+ var dz = lower48.scale(), dx = x[0], dy = x[1];
+ lower48.translate(x);
+ alaska.translate([ dx - .4 * dz, dy + .17 * dz ]);
+ hawaii.translate([ dx - .19 * dz, dy + .2 * dz ]);
+ puertoRico.translate([ dx + .58 * dz, dy + .43 * dz ]);
+ alaskaInvert = d3_geo_albersUsaInvert(alaska, [ [ -180, 50 ], [ -130, 72 ] ]);
+ hawaiiInvert = d3_geo_albersUsaInvert(hawaii, [ [ -164, 18 ], [ -154, 24 ] ]);
+ puertoRicoInvert = d3_geo_albersUsaInvert(puertoRico, [ [ -67.5, 17.5 ], [ -65, 19 ] ]);
+ return albersUsa;
+ };
+ return albersUsa.scale(1e3);
+ };
+ function d3_geo_albersUsaInvert(projection, extent) {
+ var a = projection(extent[0]), b = projection([ .5 * (extent[0][0] + extent[1][0]), extent[0][1] ]), c = projection([ extent[1][0], extent[0][1] ]), d = projection(extent[1]);
+ var dya = b[1] - a[1], dxa = b[0] - a[0], dyb = c[1] - b[1], dxb = c[0] - b[0];
+ var ma = dya / dxa, mb = dyb / dxb;
+ var cx = .5 * (ma * mb * (a[1] - c[1]) + mb * (a[0] + b[0]) - ma * (b[0] + c[0])) / (mb - ma), cy = (.5 * (a[0] + b[0]) - cx) / ma + .5 * (a[1] + b[1]);
+ var dx0 = d[0] - cx, dy0 = d[1] - cy, dx1 = a[0] - cx, dy1 = a[1] - cy, r0 = dx0 * dx0 + dy0 * dy0, r1 = dx1 * dx1 + dy1 * dy1;
+ var a0 = Math.atan2(dy0, dx0), a1 = Math.atan2(dy1, dx1);
+ return function(coordinates) {
+ var dx = coordinates[0] - cx, dy = coordinates[1] - cy, r = dx * dx + dy * dy, a = Math.atan2(dy, dx);
+ if (r0 < r && r < r1 && a0 < a && a < a1) return projection.invert(coordinates);
+ };
+ }
+ var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = {
+ point: d3_noop,
+ lineStart: d3_noop,
+ lineEnd: d3_noop,
+ polygonStart: function() {
+ d3_geo_pathAreaPolygon = 0;
+ d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart;
+ },
+ polygonEnd: function() {
+ d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop;
+ d3_geo_pathAreaSum += Math.abs(d3_geo_pathAreaPolygon / 2);
+ }
+ };
+ function d3_geo_pathAreaRingStart() {
+ var x00, y00, x0, y0;
+ d3_geo_pathArea.point = function(x, y) {
+ d3_geo_pathArea.point = nextPoint;
+ x00 = x0 = x, y00 = y0 = y;
+ };
+ function nextPoint(x, y) {
+ d3_geo_pathAreaPolygon += y0 * x - x0 * y;
+ x0 = x, y0 = y;
+ }
+ d3_geo_pathArea.lineEnd = function() {
+ nextPoint(x00, y00);
+ };
+ }
+ function d3_geo_pathBuffer() {
+ var pointCircle = d3_geo_pathCircle(4.5), buffer = [];
+ var stream = {
+ point: point,
+ lineStart: function() {
+ stream.point = pointLineStart;
+ },
+ lineEnd: lineEnd,
+ polygonStart: function() {
+ stream.lineEnd = lineEndPolygon;
+ },
+ polygonEnd: function() {
+ stream.lineEnd = lineEnd;
+ stream.point = point;
+ },
+ pointRadius: function(_) {
+ pointCircle = d3_geo_pathCircle(_);
+ return stream;
+ },
+ result: function() {
+ if (buffer.length) {
+ var result = buffer.join("");
+ buffer = [];
+ return result;
+ }
+ }
+ };
+ function point(x, y) {
+ buffer.push("M", x, ",", y, pointCircle);
+ }
+ function pointLineStart(x, y) {
+ buffer.push("M", x, ",", y);
+ stream.point = pointLine;
+ }
+ function pointLine(x, y) {
+ buffer.push("L", x, ",", y);
+ }
+ function lineEnd() {
+ stream.point = point;
+ }
+ function lineEndPolygon() {
+ buffer.push("Z");
+ }
+ return stream;
+ }
+ var d3_geo_pathCentroid = {
+ point: d3_geo_pathCentroidPoint,
+ lineStart: d3_geo_pathCentroidLineStart,
+ lineEnd: d3_geo_pathCentroidLineEnd,
+ polygonStart: function() {
+ d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart;
+ },
+ polygonEnd: function() {
+ d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
+ d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart;
+ d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd;
+ }
+ };
+ function d3_geo_pathCentroidPoint(x, y) {
+ if (d3_geo_centroidDimension) return;
+ d3_geo_centroidX += x;
+ d3_geo_centroidY += y;
+ ++d3_geo_centroidZ;
+ }
+ function d3_geo_pathCentroidLineStart() {
+ var x0, y0;
+ if (d3_geo_centroidDimension !== 1) {
+ if (d3_geo_centroidDimension < 1) {
+ d3_geo_centroidDimension = 1;
+ d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ } else return;
+ }
+ d3_geo_pathCentroid.point = function(x, y) {
+ d3_geo_pathCentroid.point = nextPoint;
+ x0 = x, y0 = y;
+ };
+ function nextPoint(x, y) {
+ var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy);
+ d3_geo_centroidX += z * (x0 + x) / 2;
+ d3_geo_centroidY += z * (y0 + y) / 2;
+ d3_geo_centroidZ += z;
+ x0 = x, y0 = y;
+ }
+ }
+ function d3_geo_pathCentroidLineEnd() {
+ d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
+ }
+ function d3_geo_pathCentroidRingStart() {
+ var x00, y00, x0, y0;
+ if (d3_geo_centroidDimension < 2) {
+ d3_geo_centroidDimension = 2;
+ d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ }
+ d3_geo_pathCentroid.point = function(x, y) {
+ d3_geo_pathCentroid.point = nextPoint;
+ x00 = x0 = x, y00 = y0 = y;
+ };
+ function nextPoint(x, y) {
+ var z = y0 * x - x0 * y;
+ d3_geo_centroidX += z * (x0 + x);
+ d3_geo_centroidY += z * (y0 + y);
+ d3_geo_centroidZ += z * 3;
+ x0 = x, y0 = y;
+ }
+ d3_geo_pathCentroid.lineEnd = function() {
+ nextPoint(x00, y00);
+ };
+ }
+ function d3_geo_pathContext(context) {
+ var pointRadius = 4.5;
+ var stream = {
+ point: point,
+ lineStart: function() {
+ stream.point = pointLineStart;
+ },
+ lineEnd: lineEnd,
+ polygonStart: function() {
+ stream.lineEnd = lineEndPolygon;
+ },
+ polygonEnd: function() {
+ stream.lineEnd = lineEnd;
+ stream.point = point;
+ },
+ pointRadius: function(_) {
+ pointRadius = _;
+ return stream;
+ },
+ result: d3_noop
+ };
+ function point(x, y) {
+ context.moveTo(x, y);
+ context.arc(x, y, pointRadius, 0, 2 * π);
+ }
+ function pointLineStart(x, y) {
+ context.moveTo(x, y);
+ stream.point = pointLine;
+ }
+ function pointLine(x, y) {
+ context.lineTo(x, y);
+ }
+ function lineEnd() {
+ stream.point = point;
+ }
+ function lineEndPolygon() {
+ context.closePath();
+ }
+ return stream;
+ }
+ d3.geo.path = function() {
+ var pointRadius = 4.5, projection, context, projectStream, contextStream;
+ function path(object) {
+ if (object) d3.geo.stream(object, projectStream(contextStream.pointRadius(typeof pointRadius === "function" ? +pointRadius.apply(this, arguments) : pointRadius)));
+ return contextStream.result();
+ }
+ path.area = function(object) {
+ d3_geo_pathAreaSum = 0;
+ d3.geo.stream(object, projectStream(d3_geo_pathArea));
+ return d3_geo_pathAreaSum;
+ };
+ path.centroid = function(object) {
+ d3_geo_centroidDimension = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ d3.geo.stream(object, projectStream(d3_geo_pathCentroid));
+ return d3_geo_centroidZ ? [ d3_geo_centroidX / d3_geo_centroidZ, d3_geo_centroidY / d3_geo_centroidZ ] : undefined;
+ };
+ path.bounds = function(object) {
+ return d3_geo_bounds(projectStream)(object);
+ };
+ path.projection = function(_) {
+ if (!arguments.length) return projection;
+ projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity;
+ return path;
+ };
+ path.context = function(_) {
+ if (!arguments.length) return context;
+ contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_);
+ return path;
+ };
+ path.pointRadius = function(_) {
+ if (!arguments.length) return pointRadius;
+ pointRadius = typeof _ === "function" ? _ : +_;
+ return path;
+ };
+ return path.projection(d3.geo.albersUsa()).context(null);
+ };
+ function d3_geo_pathCircle(radius) {
+ return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z";
+ }
+ function d3_geo_pathProjectStream(project) {
+ var resample = d3_geo_resample(function(λ, φ) {
+ return project([ λ * d3_degrees, φ * d3_degrees ]);
+ });
+ return function(stream) {
+ stream = resample(stream);
+ return {
+ point: function(λ, φ) {
+ stream.point(λ * d3_radians, φ * d3_radians);
+ },
+ sphere: function() {
+ stream.sphere();
+ },
+ lineStart: function() {
+ stream.lineStart();
+ },
+ lineEnd: function() {
+ stream.lineEnd();
+ },
+ polygonStart: function() {
+ stream.polygonStart();
+ },
+ polygonEnd: function() {
+ stream.polygonEnd();
+ }
+ };
+ };
+ }
+ d3.geo.albers = function() {
+ return d3.geo.conicEqualArea().parallels([ 29.5, 45.5 ]).rotate([ 98, 0 ]).center([ 0, 38 ]).scale(1e3);
+ };
+ function d3_geo_azimuthal(scale, angle) {
+ function azimuthal(λ, φ) {
+ var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ);
+ return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ];
+ }
+ azimuthal.invert = function(x, y) {
+ var Ï = Math.sqrt(x * x + y * y), c = angle(Ï), sinc = Math.sin(c), cosc = Math.cos(c);
+ return [ Math.atan2(x * sinc, Ï * cosc), Math.asin(Ï && y * sinc / Ï) ];
+ };
+ return azimuthal;
+ }
+ var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) {
+ return Math.sqrt(2 / (1 + cosλcosφ));
+ }, function(Ï) {
+ return 2 * Math.asin(Ï / 2);
+ });
+ (d3.geo.azimuthalEqualArea = function() {
+ return d3_geo_projection(d3_geo_azimuthalEqualArea);
+ }).raw = d3_geo_azimuthalEqualArea;
+ var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) {
+ var c = Math.acos(cosλcosφ);
+ return c && c / Math.sin(c);
+ }, d3_identity);
+ (d3.geo.azimuthalEquidistant = function() {
+ return d3_geo_projection(d3_geo_azimuthalEquidistant);
+ }).raw = d3_geo_azimuthalEquidistant;
+ function d3_geo_conicConformal(φ0, φ1) {
+ var cosφ0 = Math.cos(φ0), t = function(φ) {
+ return Math.tan(π / 4 + φ / 2);
+ }, n = φ0 === φ1 ? Math.sin(φ0) : Math.log(cosφ0 / Math.cos(φ1)) / Math.log(t(φ1) / t(φ0)), F = cosφ0 * Math.pow(t(φ0), n) / n;
+ if (!n) return d3_geo_mercator;
+ function forward(λ, φ) {
+ var Ï = Math.abs(Math.abs(φ) - Ï€ / 2) < ε ? 0 : F / Math.pow(t(φ), n);
+ return [ Ï * Math.sin(n * λ), F - Ï * Math.cos(n * λ) ];
+ }
+ forward.invert = function(x, y) {
+ var Ï0_y = F - y, Ï = d3_sgn(n) * Math.sqrt(x * x + Ï0_y * Ï0_y);
+ return [ Math.atan2(x, Ï0_y) / n, 2 * Math.atan(Math.pow(F / Ï, 1 / n)) - Ï€ / 2 ];
+ };
+ return forward;
+ }
+ (d3.geo.conicConformal = function() {
+ return d3_geo_conic(d3_geo_conicConformal);
+ }).raw = d3_geo_conicConformal;
+ function d3_geo_conicEquidistant(φ0, φ1) {
+ var cosφ0 = Math.cos(φ0), n = φ0 === φ1 ? Math.sin(φ0) : (cosφ0 - Math.cos(φ1)) / (φ1 - φ0), G = cosφ0 / n + φ0;
+ if (Math.abs(n) < ε) return d3_geo_equirectangular;
+ function forward(λ, φ) {
+ var Ï = G - φ;
+ return [ Ï * Math.sin(n * λ), G - Ï * Math.cos(n * λ) ];
+ }
+ forward.invert = function(x, y) {
+ var Ï0_y = G - y;
+ return [ Math.atan2(x, Ï0_y) / n, G - d3_sgn(n) * Math.sqrt(x * x + Ï0_y * Ï0_y) ];
+ };
+ return forward;
+ }
+ (d3.geo.conicEquidistant = function() {
+ return d3_geo_conic(d3_geo_conicEquidistant);
+ }).raw = d3_geo_conicEquidistant;
+ var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) {
+ return 1 / cosλcosφ;
+ }, Math.atan);
+ (d3.geo.gnomonic = function() {
+ return d3_geo_projection(d3_geo_gnomonic);
+ }).raw = d3_geo_gnomonic;
+ function d3_geo_mercator(λ, φ) {
+ return [ λ, Math.log(Math.tan(π / 4 + φ / 2)) ];
+ }
+ d3_geo_mercator.invert = function(x, y) {
+ return [ x, 2 * Math.atan(Math.exp(y)) - π / 2 ];
+ };
+ function d3_geo_mercatorProjection(project) {
+ var m = d3_geo_projection(project), scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, clipAuto;
+ m.scale = function() {
+ var v = scale.apply(m, arguments);
+ return v === m ? clipAuto ? m.clipExtent(null) : m : v;
+ };
+ m.translate = function() {
+ var v = translate.apply(m, arguments);
+ return v === m ? clipAuto ? m.clipExtent(null) : m : v;
+ };
+ m.clipExtent = function(_) {
+ var v = clipExtent.apply(m, arguments);
+ if (v === m) {
+ if (clipAuto = _ == null) {
+ var k = π * scale(), t = translate();
+ clipExtent([ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ]);
+ }
+ } else if (clipAuto) {
+ v = null;
+ }
+ return v;
+ };
+ return m.clipExtent(null);
+ }
+ (d3.geo.mercator = function() {
+ return d3_geo_mercatorProjection(d3_geo_mercator);
+ }).raw = d3_geo_mercator;
+ var d3_geo_orthographic = d3_geo_azimuthal(function() {
+ return 1;
+ }, Math.asin);
+ (d3.geo.orthographic = function() {
+ return d3_geo_projection(d3_geo_orthographic);
+ }).raw = d3_geo_orthographic;
+ var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) {
+ return 1 / (1 + cosλcosφ);
+ }, function(Ï) {
+ return 2 * Math.atan(Ï);
+ });
+ (d3.geo.stereographic = function() {
+ return d3_geo_projection(d3_geo_stereographic);
+ }).raw = d3_geo_stereographic;
+ function d3_geo_transverseMercator(λ, φ) {
+ var B = Math.cos(φ) * Math.sin(λ);
+ return [ Math.log((1 + B) / (1 - B)) / 2, Math.atan2(Math.tan(φ), Math.cos(λ)) ];
+ }
+ d3_geo_transverseMercator.invert = function(x, y) {
+ return [ Math.atan2(d3_sinh(x), Math.cos(y)), d3_asin(Math.sin(y) / d3_cosh(x)) ];
+ };
+ (d3.geo.transverseMercator = function() {
+ return d3_geo_mercatorProjection(d3_geo_transverseMercator);
+ }).raw = d3_geo_transverseMercator;
+ d3.geom = {};
+ d3.svg = {};
+ function d3_svg_line(projection) {
+ var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
+ function line(data) {
+ var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
+ function segment() {
+ segments.push("M", interpolate(projection(points), tension));
+ }
+ while (++i < n) {
+ if (defined.call(this, d = data[i], i)) {
+ points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
+ } else if (points.length) {
+ segment();
+ points = [];
+ }
+ }
+ if (points.length) segment();
+ return segments.length ? segments.join("") : null;
+ }
+ line.x = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return line;
+ };
+ line.y = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return line;
+ };
+ line.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return line;
+ };
+ line.interpolate = function(_) {
+ if (!arguments.length) return interpolateKey;
+ if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
+ return line;
+ };
+ line.tension = function(_) {
+ if (!arguments.length) return tension;
+ tension = _;
+ return line;
+ };
+ return line;
+ }
+ d3.svg.line = function() {
+ return d3_svg_line(d3_identity);
+ };
+ function d3_svg_lineX(d) {
+ return d[0];
+ }
+ function d3_svg_lineY(d) {
+ return d[1];
+ }
+ var d3_svg_lineInterpolators = d3.map({
+ linear: d3_svg_lineLinear,
+ "linear-closed": d3_svg_lineLinearClosed,
+ "step-before": d3_svg_lineStepBefore,
+ "step-after": d3_svg_lineStepAfter,
+ basis: d3_svg_lineBasis,
+ "basis-open": d3_svg_lineBasisOpen,
+ "basis-closed": d3_svg_lineBasisClosed,
+ bundle: d3_svg_lineBundle,
+ cardinal: d3_svg_lineCardinal,
+ "cardinal-open": d3_svg_lineCardinalOpen,
+ "cardinal-closed": d3_svg_lineCardinalClosed,
+ monotone: d3_svg_lineMonotone
+ });
+ d3_svg_lineInterpolators.forEach(function(key, value) {
+ value.key = key;
+ value.closed = /-closed$/.test(key);
+ });
+ function d3_svg_lineLinear(points) {
+ return points.join("L");
+ }
+ function d3_svg_lineLinearClosed(points) {
+ return d3_svg_lineLinear(points) + "Z";
+ }
+ function d3_svg_lineStepBefore(points) {
+ var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
+ while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
+ return path.join("");
+ }
+ function d3_svg_lineStepAfter(points) {
+ var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
+ while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
+ return path.join("");
+ }
+ function d3_svg_lineCardinalOpen(points, tension) {
+ return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));
+ }
+ function d3_svg_lineCardinalClosed(points, tension) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]),
+ points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
+ }
+ function d3_svg_lineCardinal(points, tension) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
+ }
+ function d3_svg_lineHermite(points, tangents) {
+ if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
+ return d3_svg_lineLinear(points);
+ }
+ var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
+ if (quad) {
+ path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
+ p0 = points[1];
+ pi = 2;
+ }
+ if (tangents.length > 1) {
+ t = tangents[1];
+ p = points[pi];
+ pi++;
+ path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
+ for (var i = 2; i < tangents.length; i++, pi++) {
+ p = points[pi];
+ t = tangents[i];
+ path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
+ }
+ }
+ if (quad) {
+ var lp = points[pi];
+ path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
+ }
+ return path;
+ }
+ function d3_svg_lineCardinalTangents(points, tension) {
+ var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
+ while (++i < n) {
+ p0 = p1;
+ p1 = p2;
+ p2 = points[i];
+ tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
+ }
+ return tangents;
+ }
+ function d3_svg_lineBasis(points) {
+ if (points.length < 3) return d3_svg_lineLinear(points);
+ var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ];
+ d3_svg_lineBasisBezier(path, px, py);
+ while (++i < n) {
+ pi = points[i];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ i = -1;
+ while (++i < 2) {
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBasisOpen(points) {
+ if (points.length < 4) return d3_svg_lineLinear(points);
+ var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
+ while (++i < 3) {
+ pi = points[i];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
+ --i;
+ while (++i < n) {
+ pi = points[i];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBasisClosed(points) {
+ var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
+ while (++i < 4) {
+ pi = points[i % n];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
+ --i;
+ while (++i < m) {
+ pi = points[i % n];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBundle(points, tension) {
+ var n = points.length - 1;
+ if (n) {
+ var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
+ while (++i <= n) {
+ p = points[i];
+ t = i / n;
+ p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
+ p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
+ }
+ }
+ return d3_svg_lineBasis(points);
+ }
+ function d3_svg_lineDot4(a, b) {
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
+ }
+ var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ];
+ function d3_svg_lineBasisBezier(path, x, y) {
+ path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
+ }
+ function d3_svg_lineSlope(p0, p1) {
+ return (p1[1] - p0[1]) / (p1[0] - p0[0]);
+ }
+ function d3_svg_lineFiniteDifferences(points) {
+ var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
+ while (++i < j) {
+ m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
+ }
+ m[i] = d;
+ return m;
+ }
+ function d3_svg_lineMonotoneTangents(points) {
+ var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
+ while (++i < j) {
+ d = d3_svg_lineSlope(points[i], points[i + 1]);
+ if (Math.abs(d) < 1e-6) {
+ m[i] = m[i + 1] = 0;
+ } else {
+ a = m[i] / d;
+ b = m[i + 1] / d;
+ s = a * a + b * b;
+ if (s > 9) {
+ s = d * 3 / Math.sqrt(s);
+ m[i] = s * a;
+ m[i + 1] = s * b;
+ }
+ }
+ }
+ i = -1;
+ while (++i <= j) {
+ s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
+ tangents.push([ s || 0, m[i] * s || 0 ]);
+ }
+ return tangents;
+ }
+ function d3_svg_lineMonotone(points) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
+ }
+ d3.geom.hull = function(vertices) {
+ var x = d3_svg_lineX, y = d3_svg_lineY;
+ if (arguments.length) return hull(vertices);
+ function hull(data) {
+ if (data.length < 3) return [];
+ var fx = d3_functor(x), fy = d3_functor(y), n = data.length, vertices, plen = n - 1, points = [], stack = [], d, i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
+ if (fx === d3_svg_lineX && y === d3_svg_lineY) vertices = data; else for (i = 0,
+ vertices = []; i < n; ++i) {
+ vertices.push([ +fx.call(this, d = data[i], i), +fy.call(this, d, i) ]);
+ }
+ for (i = 1; i < n; ++i) {
+ if (vertices[i][1] < vertices[h][1]) {
+ h = i;
+ } else if (vertices[i][1] == vertices[h][1]) {
+ h = vertices[i][0] < vertices[h][0] ? i : h;
+ }
+ }
+ for (i = 0; i < n; ++i) {
+ if (i === h) continue;
+ y1 = vertices[i][1] - vertices[h][1];
+ x1 = vertices[i][0] - vertices[h][0];
+ points.push({
+ angle: Math.atan2(y1, x1),
+ index: i
+ });
+ }
+ points.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ a = points[0].angle;
+ v = points[0].index;
+ u = 0;
+ for (i = 1; i < plen; ++i) {
+ j = points[i].index;
+ if (a == points[i].angle) {
+ x1 = vertices[v][0] - vertices[h][0];
+ y1 = vertices[v][1] - vertices[h][1];
+ x2 = vertices[j][0] - vertices[h][0];
+ y2 = vertices[j][1] - vertices[h][1];
+ if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) {
+ points[i].index = -1;
+ } else {
+ points[u].index = -1;
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ } else {
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ }
+ stack.push(h);
+ for (i = 0, j = 0; i < 2; ++j) {
+ if (points[j].index !== -1) {
+ stack.push(points[j].index);
+ i++;
+ }
+ }
+ sp = stack.length;
+ for (;j < plen; ++j) {
+ if (points[j].index === -1) continue;
+ while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) {
+ --sp;
+ }
+ stack[sp++] = points[j].index;
+ }
+ var poly = [];
+ for (i = 0; i < sp; ++i) {
+ poly.push(data[stack[i]]);
+ }
+ return poly;
+ }
+ hull.x = function(_) {
+ return arguments.length ? (x = _, hull) : x;
+ };
+ hull.y = function(_) {
+ return arguments.length ? (y = _, hull) : y;
+ };
+ return hull;
+ };
+ function d3_geom_hullCCW(i1, i2, i3, v) {
+ var t, a, b, c, d, e, f;
+ t = v[i1];
+ a = t[0];
+ b = t[1];
+ t = v[i2];
+ c = t[0];
+ d = t[1];
+ t = v[i3];
+ e = t[0];
+ f = t[1];
+ return (f - b) * (c - a) - (d - b) * (e - a) > 0;
+ }
+ d3.geom.polygon = function(coordinates) {
+ coordinates.area = function() {
+ var i = 0, n = coordinates.length, area = coordinates[n - 1][1] * coordinates[0][0] - coordinates[n - 1][0] * coordinates[0][1];
+ while (++i < n) {
+ area += coordinates[i - 1][1] * coordinates[i][0] - coordinates[i - 1][0] * coordinates[i][1];
+ }
+ return area * .5;
+ };
+ coordinates.centroid = function(k) {
+ var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c;
+ if (!arguments.length) k = -1 / (6 * coordinates.area());
+ while (++i < n) {
+ a = b;
+ b = coordinates[i];
+ c = a[0] * b[1] - b[0] * a[1];
+ x += (a[0] + b[0]) * c;
+ y += (a[1] + b[1]) * c;
+ }
+ return [ x * k, y * k ];
+ };
+ coordinates.clip = function(subject) {
+ var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d;
+ while (++i < n) {
+ input = subject.slice();
+ subject.length = 0;
+ b = coordinates[i];
+ c = input[(m = input.length) - 1];
+ j = -1;
+ while (++j < m) {
+ d = input[j];
+ if (d3_geom_polygonInside(d, a, b)) {
+ if (!d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ subject.push(d);
+ } else if (d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ c = d;
+ }
+ a = b;
+ }
+ return subject;
+ };
+ return coordinates;
+ };
+ function d3_geom_polygonInside(p, a, b) {
+ return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
+ }
+ function d3_geom_polygonIntersect(c, d, a, b) {
+ var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21);
+ return [ x1 + ua * x21, y1 + ua * y21 ];
+ }
+ d3.geom.delaunay = function(vertices) {
+ var edges = vertices.map(function() {
+ return [];
+ }), triangles = [];
+ d3_geom_voronoiTessellate(vertices, function(e) {
+ edges[e.region.l.index].push(vertices[e.region.r.index]);
+ });
+ edges.forEach(function(edge, i) {
+ var v = vertices[i], cx = v[0], cy = v[1];
+ edge.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ edge.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ for (var j = 0, m = edge.length - 1; j < m; j++) {
+ triangles.push([ v, edge[j], edge[j + 1] ]);
+ }
+ });
+ return triangles;
+ };
+ d3.geom.voronoi = function(points) {
+ var size = null, x = d3_svg_lineX, y = d3_svg_lineY, clip;
+ if (arguments.length) return voronoi(points);
+ function voronoi(data) {
+ var points, polygons = data.map(function() {
+ return [];
+ }), fx = d3_functor(x), fy = d3_functor(y), d, i, n = data.length, Z = 1e6;
+ if (fx === d3_svg_lineX && fy === d3_svg_lineY) points = data; else for (points = [],
+ i = 0; i < n; ++i) {
+ points.push([ +fx.call(this, d = data[i], i), +fy.call(this, d, i) ]);
+ }
+ d3_geom_voronoiTessellate(points, function(e) {
+ var s1, s2, x1, x2, y1, y2;
+ if (e.a === 1 && e.b >= 0) {
+ s1 = e.ep.r;
+ s2 = e.ep.l;
+ } else {
+ s1 = e.ep.l;
+ s2 = e.ep.r;
+ }
+ if (e.a === 1) {
+ y1 = s1 ? s1.y : -Z;
+ x1 = e.c - e.b * y1;
+ y2 = s2 ? s2.y : Z;
+ x2 = e.c - e.b * y2;
+ } else {
+ x1 = s1 ? s1.x : -Z;
+ y1 = e.c - e.a * x1;
+ x2 = s2 ? s2.x : Z;
+ y2 = e.c - e.a * x2;
+ }
+ var v1 = [ x1, y1 ], v2 = [ x2, y2 ];
+ polygons[e.region.l.index].push(v1, v2);
+ polygons[e.region.r.index].push(v1, v2);
+ });
+ polygons = polygons.map(function(polygon, i) {
+ var cx = points[i][0], cy = points[i][1], angle = polygon.map(function(v) {
+ return Math.atan2(v[0] - cx, v[1] - cy);
+ }), order = d3.range(polygon.length).sort(function(a, b) {
+ return angle[a] - angle[b];
+ });
+ return order.filter(function(d, i) {
+ return !i || angle[d] - angle[order[i - 1]] > ε;
+ }).map(function(d) {
+ return polygon[d];
+ });
+ });
+ polygons.forEach(function(polygon, i) {
+ var n = polygon.length;
+ if (!n) return polygon.push([ -Z, -Z ], [ -Z, Z ], [ Z, Z ], [ Z, -Z ]);
+ if (n > 2) return;
+ var p0 = points[i], p1 = polygon[0], p2 = polygon[1], x0 = p0[0], y0 = p0[1], x1 = p1[0], y1 = p1[1], x2 = p2[0], y2 = p2[1], dx = Math.abs(x2 - x1), dy = y2 - y1;
+ if (Math.abs(dy) < ε) {
+ var y = y0 < y1 ? -Z : Z;
+ polygon.push([ -Z, y ], [ Z, y ]);
+ } else if (dx < ε) {
+ var x = x0 < x1 ? -Z : Z;
+ polygon.push([ x, -Z ], [ x, Z ]);
+ } else {
+ var y = (x2 - x1) * (y1 - y0) < (x1 - x0) * (y2 - y1) ? Z : -Z, z = Math.abs(dy) - dx;
+ if (Math.abs(z) < ε) {
+ polygon.push([ dy < 0 ? y : -y, y ]);
+ } else {
+ if (z > 0) y *= -1;
+ polygon.push([ -Z, y ], [ Z, y ]);
+ }
+ }
+ });
+ if (clip) for (i = 0; i < n; ++i) clip(polygons[i]);
+ for (i = 0; i < n; ++i) polygons[i].point = data[i];
+ return polygons;
+ }
+ voronoi.x = function(_) {
+ return arguments.length ? (x = _, voronoi) : x;
+ };
+ voronoi.y = function(_) {
+ return arguments.length ? (y = _, voronoi) : y;
+ };
+ voronoi.size = function(_) {
+ if (!arguments.length) return size;
+ if (_ == null) {
+ clip = null;
+ } else {
+ size = [ +_[0], +_[1] ];
+ clip = d3.geom.polygon([ [ 0, 0 ], [ 0, size[1] ], size, [ size[0], 0 ] ]).clip;
+ }
+ return voronoi;
+ };
+ voronoi.links = function(data) {
+ var points, graph = data.map(function() {
+ return [];
+ }), links = [], fx = d3_functor(x), fy = d3_functor(y), d, i, n = data.length;
+ if (fx === d3_svg_lineX && fy === d3_svg_lineY) points = data; else for (i = 0; i < n; ++i) {
+ points.push([ +fx.call(this, d = data[i], i), +fy.call(this, d, i) ]);
+ }
+ d3_geom_voronoiTessellate(points, function(e) {
+ var l = e.region.l.index, r = e.region.r.index;
+ if (graph[l][r]) return;
+ graph[l][r] = graph[r][l] = true;
+ links.push({
+ source: data[l],
+ target: data[r]
+ });
+ });
+ return links;
+ };
+ voronoi.triangles = function(data) {
+ if (x === d3_svg_lineX && y === d3_svg_lineY) return d3.geom.delaunay(data);
+ var points, point, fx = d3_functor(x), fy = d3_functor(y), d, i, n;
+ for (i = 0, points = [], n = data.length; i < n; ++i) {
+ point = [ +fx.call(this, d = data[i], i), +fy.call(this, d, i) ];
+ point.data = d;
+ points.push(point);
+ }
+ return d3.geom.delaunay(points).map(function(triangle) {
+ return triangle.map(function(point) {
+ return point.data;
+ });
+ });
+ };
+ return voronoi;
+ };
+ var d3_geom_voronoiOpposite = {
+ l: "r",
+ r: "l"
+ };
+ function d3_geom_voronoiTessellate(points, callback) {
+ var Sites = {
+ list: points.map(function(v, i) {
+ return {
+ index: i,
+ x: v[0],
+ y: v[1]
+ };
+ }).sort(function(a, b) {
+ return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0;
+ }),
+ bottomSite: null
+ };
+ var EdgeList = {
+ list: [],
+ leftEnd: null,
+ rightEnd: null,
+ init: function() {
+ EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.leftEnd.r = EdgeList.rightEnd;
+ EdgeList.rightEnd.l = EdgeList.leftEnd;
+ EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
+ },
+ createHalfEdge: function(edge, side) {
+ return {
+ edge: edge,
+ side: side,
+ vertex: null,
+ l: null,
+ r: null
+ };
+ },
+ insert: function(lb, he) {
+ he.l = lb;
+ he.r = lb.r;
+ lb.r.l = he;
+ lb.r = he;
+ },
+ leftBound: function(p) {
+ var he = EdgeList.leftEnd;
+ do {
+ he = he.r;
+ } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
+ he = he.l;
+ return he;
+ },
+ del: function(he) {
+ he.l.r = he.r;
+ he.r.l = he.l;
+ he.edge = null;
+ },
+ right: function(he) {
+ return he.r;
+ },
+ left: function(he) {
+ return he.l;
+ },
+ leftRegion: function(he) {
+ return he.edge == null ? Sites.bottomSite : he.edge.region[he.side];
+ },
+ rightRegion: function(he) {
+ return he.edge == null ? Sites.bottomSite : he.edge.region[d3_geom_voronoiOpposite[he.side]];
+ }
+ };
+ var Geom = {
+ bisect: function(s1, s2) {
+ var newEdge = {
+ region: {
+ l: s1,
+ r: s2
+ },
+ ep: {
+ l: null,
+ r: null
+ }
+ };
+ var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy;
+ newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5;
+ if (adx > ady) {
+ newEdge.a = 1;
+ newEdge.b = dy / dx;
+ newEdge.c /= dx;
+ } else {
+ newEdge.b = 1;
+ newEdge.a = dx / dy;
+ newEdge.c /= dy;
+ }
+ return newEdge;
+ },
+ intersect: function(el1, el2) {
+ var e1 = el1.edge, e2 = el2.edge;
+ if (!e1 || !e2 || e1.region.r == e2.region.r) {
+ return null;
+ }
+ var d = e1.a * e2.b - e1.b * e2.a;
+ if (Math.abs(d) < 1e-10) {
+ return null;
+ }
+ var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e;
+ if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) {
+ el = el1;
+ e = e1;
+ } else {
+ el = el2;
+ e = e2;
+ }
+ var rightOfSite = xint >= e.region.r.x;
+ if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") {
+ return null;
+ }
+ return {
+ x: xint,
+ y: yint
+ };
+ },
+ rightOf: function(he, p) {
+ var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x;
+ if (rightOfSite && he.side === "l") {
+ return 1;
+ }
+ if (!rightOfSite && he.side === "r") {
+ return 0;
+ }
+ if (e.a === 1) {
+ var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0;
+ if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) {
+ above = fast = dyp >= e.b * dxp;
+ } else {
+ above = p.x + p.y * e.b > e.c;
+ if (e.b < 0) {
+ above = !above;
+ }
+ if (!above) {
+ fast = 1;
+ }
+ }
+ if (!fast) {
+ var dxs = topsite.x - e.region.l.x;
+ above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b);
+ if (e.b < 0) {
+ above = !above;
+ }
+ }
+ } else {
+ var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y;
+ above = t1 * t1 > t2 * t2 + t3 * t3;
+ }
+ return he.side === "l" ? above : !above;
+ },
+ endPoint: function(edge, side, site) {
+ edge.ep[side] = site;
+ if (!edge.ep[d3_geom_voronoiOpposite[side]]) return;
+ callback(edge);
+ },
+ distance: function(s, t) {
+ var dx = s.x - t.x, dy = s.y - t.y;
+ return Math.sqrt(dx * dx + dy * dy);
+ }
+ };
+ var EventQueue = {
+ list: [],
+ insert: function(he, site, offset) {
+ he.vertex = site;
+ he.ystar = site.y + offset;
+ for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) {
+ var next = list[i];
+ if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ list.splice(i, 0, he);
+ },
+ del: function(he) {
+ for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {}
+ ls.splice(i, 1);
+ },
+ empty: function() {
+ return EventQueue.list.length === 0;
+ },
+ nextEvent: function(he) {
+ for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) {
+ if (ls[i] == he) return ls[i + 1];
+ }
+ return null;
+ },
+ min: function() {
+ var elem = EventQueue.list[0];
+ return {
+ x: elem.vertex.x,
+ y: elem.ystar
+ };
+ },
+ extractMin: function() {
+ return EventQueue.list.shift();
+ }
+ };
+ EdgeList.init();
+ Sites.bottomSite = Sites.list.shift();
+ var newSite = Sites.list.shift(), newIntStar;
+ var lbnd, rbnd, llbnd, rrbnd, bisector;
+ var bot, top, temp, p, v;
+ var e, pm;
+ while (true) {
+ if (!EventQueue.empty()) {
+ newIntStar = EventQueue.min();
+ }
+ if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) {
+ lbnd = EdgeList.leftBound(newSite);
+ rbnd = EdgeList.right(lbnd);
+ bot = EdgeList.rightRegion(lbnd);
+ e = Geom.bisect(bot, newSite);
+ bisector = EdgeList.createHalfEdge(e, "l");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(lbnd, bisector);
+ if (p) {
+ EventQueue.del(lbnd);
+ EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
+ }
+ lbnd = bisector;
+ bisector = EdgeList.createHalfEdge(e, "r");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(bisector, rbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, newSite));
+ }
+ newSite = Sites.list.shift();
+ } else if (!EventQueue.empty()) {
+ lbnd = EventQueue.extractMin();
+ llbnd = EdgeList.left(lbnd);
+ rbnd = EdgeList.right(lbnd);
+ rrbnd = EdgeList.right(rbnd);
+ bot = EdgeList.leftRegion(lbnd);
+ top = EdgeList.rightRegion(rbnd);
+ v = lbnd.vertex;
+ Geom.endPoint(lbnd.edge, lbnd.side, v);
+ Geom.endPoint(rbnd.edge, rbnd.side, v);
+ EdgeList.del(lbnd);
+ EventQueue.del(rbnd);
+ EdgeList.del(rbnd);
+ pm = "l";
+ if (bot.y > top.y) {
+ temp = bot;
+ bot = top;
+ top = temp;
+ pm = "r";
+ }
+ e = Geom.bisect(bot, top);
+ bisector = EdgeList.createHalfEdge(e, pm);
+ EdgeList.insert(llbnd, bisector);
+ Geom.endPoint(e, d3_geom_voronoiOpposite[pm], v);
+ p = Geom.intersect(llbnd, bisector);
+ if (p) {
+ EventQueue.del(llbnd);
+ EventQueue.insert(llbnd, p, Geom.distance(p, bot));
+ }
+ p = Geom.intersect(bisector, rrbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, bot));
+ }
+ } else {
+ break;
+ }
+ }
+ for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) {
+ callback(lbnd.edge);
+ }
+ }
+ d3.geom.quadtree = function(points, x1, y1, x2, y2) {
+ var x = d3_svg_lineX, y = d3_svg_lineY, compat;
+ if (compat = arguments.length) {
+ x = d3_geom_quadtreeCompatX;
+ y = d3_geom_quadtreeCompatY;
+ if (compat === 3) {
+ y2 = y1;
+ x2 = x1;
+ y1 = x1 = 0;
+ }
+ return quadtree(points);
+ }
+ function quadtree(data) {
+ var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_;
+ if (x1 != null) {
+ x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2;
+ } else {
+ x2_ = y2_ = -(x1_ = y1_ = Infinity);
+ xs = [], ys = [];
+ n = data.length;
+ if (compat) for (i = 0; i < n; ++i) {
+ d = data[i];
+ if (d.x < x1_) x1_ = d.x;
+ if (d.y < y1_) y1_ = d.y;
+ if (d.x > x2_) x2_ = d.x;
+ if (d.y > y2_) y2_ = d.y;
+ xs.push(d.x);
+ ys.push(d.y);
+ } else for (i = 0; i < n; ++i) {
+ var x_ = +fx(d = data[i], i), y_ = +fy(d, i);
+ if (x_ < x1_) x1_ = x_;
+ if (y_ < y1_) y1_ = y_;
+ if (x_ > x2_) x2_ = x_;
+ if (y_ > y2_) y2_ = y_;
+ xs.push(x_);
+ ys.push(y_);
+ }
+ }
+ var dx = x2_ - x1_, dy = y2_ - y1_;
+ if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy;
+ function insert(n, d, x, y, x1, y1, x2, y2) {
+ if (isNaN(x) || isNaN(y)) return;
+ if (n.leaf) {
+ var nx = n.x, ny = n.y;
+ if (nx != null) {
+ if (Math.abs(nx - x) + Math.abs(ny - y) < .01) {
+ insertChild(n, d, x, y, x1, y1, x2, y2);
+ } else {
+ var nPoint = n.point;
+ n.x = n.y = n.point = null;
+ insertChild(n, nPoint, nx, ny, x1, y1, x2, y2);
+ insertChild(n, d, x, y, x1, y1, x2, y2);
+ }
+ } else {
+ n.x = x, n.y = y, n.point = d;
+ }
+ } else {
+ insertChild(n, d, x, y, x1, y1, x2, y2);
+ }
+ }
+ function insertChild(n, d, x, y, x1, y1, x2, y2) {
+ var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = x >= sx, bottom = y >= sy, i = (bottom << 1) + right;
+ n.leaf = false;
+ n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
+ if (right) x1 = sx; else x2 = sx;
+ if (bottom) y1 = sy; else y2 = sy;
+ insert(n, d, x, y, x1, y1, x2, y2);
+ }
+ var root = d3_geom_quadtreeNode();
+ root.add = function(d) {
+ insert(root, d, +fx(d, ++i), +fy(d, i), x1_, y1_, x2_, y2_);
+ };
+ root.visit = function(f) {
+ d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_);
+ };
+ i = -1;
+ if (x1 == null) {
+ while (++i < n) {
+ insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_);
+ }
+ --i;
+ } else data.forEach(root.add);
+ xs = ys = data = d = null;
+ return root;
+ }
+ quadtree.x = function(_) {
+ return arguments.length ? (x = _, quadtree) : x;
+ };
+ quadtree.y = function(_) {
+ return arguments.length ? (y = _, quadtree) : y;
+ };
+ quadtree.size = function(_) {
+ if (!arguments.length) return x1 == null ? null : [ x2, y2 ];
+ if (_ == null) {
+ x1 = y1 = x2 = y2 = null;
+ } else {
+ x1 = y1 = 0;
+ x2 = +_[0], y2 = +_[1];
+ }
+ return quadtree;
+ };
+ return quadtree;
+ };
+ function d3_geom_quadtreeCompatX(d) {
+ return d.x;
+ }
+ function d3_geom_quadtreeCompatY(d) {
+ return d.y;
+ }
+ function d3_geom_quadtreeNode() {
+ return {
+ leaf: true,
+ nodes: [],
+ point: null,
+ x: null,
+ y: null
+ };
+ }
+ function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
+ if (!f(node, x1, y1, x2, y2)) {
+ var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;
+ if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
+ if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
+ if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
+ if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
+ }
+ }
+ d3.interpolateRgb = d3_interpolateRgb;
+ function d3_interpolateRgb(a, b) {
+ a = d3.rgb(a);
+ b = d3.rgb(b);
+ var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
+ return function(t) {
+ return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));
+ };
+ }
+ d3.transform = function(string) {
+ var g = d3_document.createElementNS(d3.ns.prefix.svg, "g");
+ return (d3.transform = function(string) {
+ g.setAttribute("transform", string);
+ var t = g.transform.baseVal.consolidate();
+ return new d3_transform(t ? t.matrix : d3_transformIdentity);
+ })(string);
+ };
+ function d3_transform(m) {
+ var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
+ if (r0[0] * r1[1] < r1[0] * r0[1]) {
+ r0[0] *= -1;
+ r0[1] *= -1;
+ kx *= -1;
+ kz *= -1;
+ }
+ this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees;
+ this.translate = [ m.e, m.f ];
+ this.scale = [ kx, ky ];
+ this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0;
+ }
+ d3_transform.prototype.toString = function() {
+ return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
+ };
+ function d3_transformDot(a, b) {
+ return a[0] * b[0] + a[1] * b[1];
+ }
+ function d3_transformNormalize(a) {
+ var k = Math.sqrt(d3_transformDot(a, a));
+ if (k) {
+ a[0] /= k;
+ a[1] /= k;
+ }
+ return k;
+ }
+ function d3_transformCombine(a, b, k) {
+ a[0] += k * b[0];
+ a[1] += k * b[1];
+ return a;
+ }
+ var d3_transformIdentity = {
+ a: 1,
+ b: 0,
+ c: 0,
+ d: 1,
+ e: 0,
+ f: 0
+ };
+ d3.interpolateNumber = d3_interpolateNumber;
+ function d3_interpolateNumber(a, b) {
+ b -= a = +a;
+ return function(t) {
+ return a + b * t;
+ };
+ }
+ d3.interpolateTransform = d3_interpolateTransform;
+ function d3_interpolateTransform(a, b) {
+ var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale;
+ if (ta[0] != tb[0] || ta[1] != tb[1]) {
+ s.push("translate(", null, ",", null, ")");
+ q.push({
+ i: 1,
+ x: d3_interpolateNumber(ta[0], tb[0])
+ }, {
+ i: 3,
+ x: d3_interpolateNumber(ta[1], tb[1])
+ });
+ } else if (tb[0] || tb[1]) {
+ s.push("translate(" + tb + ")");
+ } else {
+ s.push("");
+ }
+ if (ra != rb) {
+ if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
+ q.push({
+ i: s.push(s.pop() + "rotate(", null, ")") - 2,
+ x: d3_interpolateNumber(ra, rb)
+ });
+ } else if (rb) {
+ s.push(s.pop() + "rotate(" + rb + ")");
+ }
+ if (wa != wb) {
+ q.push({
+ i: s.push(s.pop() + "skewX(", null, ")") - 2,
+ x: d3_interpolateNumber(wa, wb)
+ });
+ } else if (wb) {
+ s.push(s.pop() + "skewX(" + wb + ")");
+ }
+ if (ka[0] != kb[0] || ka[1] != kb[1]) {
+ n = s.push(s.pop() + "scale(", null, ",", null, ")");
+ q.push({
+ i: n - 4,
+ x: d3_interpolateNumber(ka[0], kb[0])
+ }, {
+ i: n - 2,
+ x: d3_interpolateNumber(ka[1], kb[1])
+ });
+ } else if (kb[0] != 1 || kb[1] != 1) {
+ s.push(s.pop() + "scale(" + kb + ")");
+ }
+ n = q.length;
+ return function(t) {
+ var i = -1, o;
+ while (++i < n) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+ }
+ d3.interpolateObject = d3_interpolateObject;
+ function d3_interpolateObject(a, b) {
+ var i = {}, c = {}, k;
+ for (k in a) {
+ if (k in b) {
+ i[k] = d3_interpolateByName(k)(a[k], b[k]);
+ } else {
+ c[k] = a[k];
+ }
+ }
+ for (k in b) {
+ if (!(k in a)) {
+ c[k] = b[k];
+ }
+ }
+ return function(t) {
+ for (k in i) c[k] = i[k](t);
+ return c;
+ };
+ }
+ d3.interpolateString = d3_interpolateString;
+ function d3_interpolateString(a, b) {
+ var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;
+ a = a + "", b = b + "";
+ d3_interpolate_number.lastIndex = 0;
+ for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
+ if (m.index) s.push(b.substring(s0, s1 = m.index));
+ q.push({
+ i: s.length,
+ x: m[0]
+ });
+ s.push(null);
+ s0 = d3_interpolate_number.lastIndex;
+ }
+ if (s0 < b.length) s.push(b.substring(s0));
+ for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
+ o = q[i];
+ if (o.x == m[0]) {
+ if (o.i) {
+ if (s[o.i + 1] == null) {
+ s[o.i - 1] += o.x;
+ s.splice(o.i, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ } else {
+ s[o.i - 1] += o.x + s[o.i + 1];
+ s.splice(o.i, 2);
+ for (j = i + 1; j < n; ++j) q[j].i -= 2;
+ }
+ } else {
+ if (s[o.i + 1] == null) {
+ s[o.i] = o.x;
+ } else {
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ }
+ }
+ q.splice(i, 1);
+ n--;
+ i--;
+ } else {
+ o.x = d3_interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
+ }
+ }
+ while (i < n) {
+ o = q.pop();
+ if (s[o.i + 1] == null) {
+ s[o.i] = o.x;
+ } else {
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ }
+ n--;
+ }
+ if (s.length === 1) {
+ return s[0] == null ? q[0].x : function() {
+ return b;
+ };
+ }
+ return function(t) {
+ for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+ }
+ var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
+ d3.interpolate = d3_interpolate;
+ function d3_interpolate(a, b) {
+ var i = d3.interpolators.length, f;
+ while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;
+ return f;
+ }
+ function d3_interpolateByName(name) {
+ return name == "transform" ? d3_interpolateTransform : d3_interpolate;
+ }
+ d3.interpolators = [ function(a, b) {
+ var t = typeof b;
+ return (t === "string" || t !== typeof a ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) ? d3_interpolateRgb : d3_interpolateString : b instanceof d3_Color ? d3_interpolateRgb : t === "object" ? Array.isArray(b) ? d3_interpolateArray : d3_interpolateObject : d3_interpolateNumber)(a, b);
+ } ];
+ d3.interpolateArray = d3_interpolateArray;
+ function d3_interpolateArray(a, b) {
+ var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;
+ for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i]));
+ for (;i < na; ++i) c[i] = a[i];
+ for (;i < nb; ++i) c[i] = b[i];
+ return function(t) {
+ for (i = 0; i < n0; ++i) c[i] = x[i](t);
+ return c;
+ };
+ }
+ var d3_ease_default = function() {
+ return d3_identity;
+ };
+ var d3_ease = d3.map({
+ linear: d3_ease_default,
+ poly: d3_ease_poly,
+ quad: function() {
+ return d3_ease_quad;
+ },
+ cubic: function() {
+ return d3_ease_cubic;
+ },
+ sin: function() {
+ return d3_ease_sin;
+ },
+ exp: function() {
+ return d3_ease_exp;
+ },
+ circle: function() {
+ return d3_ease_circle;
+ },
+ elastic: d3_ease_elastic,
+ back: d3_ease_back,
+ bounce: function() {
+ return d3_ease_bounce;
+ }
+ });
+ var d3_ease_mode = d3.map({
+ "in": d3_identity,
+ out: d3_ease_reverse,
+ "in-out": d3_ease_reflect,
+ "out-in": function(f) {
+ return d3_ease_reflect(d3_ease_reverse(f));
+ }
+ });
+ d3.ease = function(name) {
+ var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in";
+ t = d3_ease.get(t) || d3_ease_default;
+ m = d3_ease_mode.get(m) || d3_identity;
+ return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1))));
+ };
+ function d3_ease_clamp(f) {
+ return function(t) {
+ return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
+ };
+ }
+ function d3_ease_reverse(f) {
+ return function(t) {
+ return 1 - f(1 - t);
+ };
+ }
+ function d3_ease_reflect(f) {
+ return function(t) {
+ return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));
+ };
+ }
+ function d3_ease_quad(t) {
+ return t * t;
+ }
+ function d3_ease_cubic(t) {
+ return t * t * t;
+ }
+ function d3_ease_cubicInOut(t) {
+ if (t <= 0) return 0;
+ if (t >= 1) return 1;
+ var t2 = t * t, t3 = t2 * t;
+ return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75);
+ }
+ function d3_ease_poly(e) {
+ return function(t) {
+ return Math.pow(t, e);
+ };
+ }
+ function d3_ease_sin(t) {
+ return 1 - Math.cos(t * π / 2);
+ }
+ function d3_ease_exp(t) {
+ return Math.pow(2, 10 * (t - 1));
+ }
+ function d3_ease_circle(t) {
+ return 1 - Math.sqrt(1 - t * t);
+ }
+ function d3_ease_elastic(a, p) {
+ var s;
+ if (arguments.length < 2) p = .45;
+ if (arguments.length) s = p / (2 * π) * Math.asin(1 / a); else a = 1, s = p / 4;
+ return function(t) {
+ return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * π / p);
+ };
+ }
+ function d3_ease_back(s) {
+ if (!s) s = 1.70158;
+ return function(t) {
+ return t * t * ((s + 1) * t - s);
+ };
+ }
+ function d3_ease_bounce(t) {
+ return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
+ }
+ d3.interpolateHcl = d3_interpolateHcl;
+ function d3_interpolateHcl(a, b) {
+ a = d3.hcl(a);
+ b = d3.hcl(b);
+ var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;
+ if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
+ return function(t) {
+ return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
+ };
+ }
+ d3.interpolateHsl = d3_interpolateHsl;
+ function d3_interpolateHsl(a, b) {
+ a = d3.hsl(a);
+ b = d3.hsl(b);
+ var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0;
+ if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360;
+ return function(t) {
+ return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + "";
+ };
+ }
+ d3.interpolateLab = d3_interpolateLab;
+ function d3_interpolateLab(a, b) {
+ a = d3.lab(a);
+ b = d3.lab(b);
+ var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
+ return function(t) {
+ return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
+ };
+ }
+ d3.interpolateRound = d3_interpolateRound;
+ function d3_interpolateRound(a, b) {
+ b -= a;
+ return function(t) {
+ return Math.round(a + b * t);
+ };
+ }
+ function d3_uninterpolateNumber(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) {
+ return (x - a) * b;
+ };
+ }
+ function d3_uninterpolateClamp(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) {
+ return Math.max(0, Math.min(1, (x - a) * b));
+ };
+ }
+ d3.layout = {};
+ d3.layout.bundle = function() {
+ return function(links) {
+ var paths = [], i = -1, n = links.length;
+ while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
+ return paths;
+ };
+ };
+ function d3_layout_bundlePath(link) {
+ var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];
+ while (start !== lca) {
+ start = start.parent;
+ points.push(start);
+ }
+ var k = points.length;
+ while (end !== lca) {
+ points.splice(k, 0, end);
+ end = end.parent;
+ }
+ return points;
+ }
+ function d3_layout_bundleAncestors(node) {
+ var ancestors = [], parent = node.parent;
+ while (parent != null) {
+ ancestors.push(node);
+ node = parent;
+ parent = parent.parent;
+ }
+ ancestors.push(node);
+ return ancestors;
+ }
+ function d3_layout_bundleLeastCommonAncestor(a, b) {
+ if (a === b) return a;
+ var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;
+ while (aNode === bNode) {
+ sharedNode = aNode;
+ aNode = aNodes.pop();
+ bNode = bNodes.pop();
+ }
+ return sharedNode;
+ }
+ d3.layout.chord = function() {
+ var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
+ function relayout() {
+ var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;
+ chords = [];
+ groups = [];
+ k = 0, i = -1;
+ while (++i < n) {
+ x = 0, j = -1;
+ while (++j < n) {
+ x += matrix[i][j];
+ }
+ groupSums.push(x);
+ subgroupIndex.push(d3.range(n));
+ k += x;
+ }
+ if (sortGroups) {
+ groupIndex.sort(function(a, b) {
+ return sortGroups(groupSums[a], groupSums[b]);
+ });
+ }
+ if (sortSubgroups) {
+ subgroupIndex.forEach(function(d, i) {
+ d.sort(function(a, b) {
+ return sortSubgroups(matrix[i][a], matrix[i][b]);
+ });
+ });
+ }
+ k = (2 * π - padding * n) / k;
+ x = 0, i = -1;
+ while (++i < n) {
+ x0 = x, j = -1;
+ while (++j < n) {
+ var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
+ subgroups[di + "-" + dj] = {
+ index: di,
+ subindex: dj,
+ startAngle: a0,
+ endAngle: a1,
+ value: v
+ };
+ }
+ groups[di] = {
+ index: di,
+ startAngle: x0,
+ endAngle: x,
+ value: (x - x0) / k
+ };
+ x += padding;
+ }
+ i = -1;
+ while (++i < n) {
+ j = i - 1;
+ while (++j < n) {
+ var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
+ if (source.value || target.value) {
+ chords.push(source.value < target.value ? {
+ source: target,
+ target: source
+ } : {
+ source: source,
+ target: target
+ });
+ }
+ }
+ }
+ if (sortChords) resort();
+ }
+ function resort() {
+ chords.sort(function(a, b) {
+ return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
+ });
+ }
+ chord.matrix = function(x) {
+ if (!arguments.length) return matrix;
+ n = (matrix = x) && matrix.length;
+ chords = groups = null;
+ return chord;
+ };
+ chord.padding = function(x) {
+ if (!arguments.length) return padding;
+ padding = x;
+ chords = groups = null;
+ return chord;
+ };
+ chord.sortGroups = function(x) {
+ if (!arguments.length) return sortGroups;
+ sortGroups = x;
+ chords = groups = null;
+ return chord;
+ };
+ chord.sortSubgroups = function(x) {
+ if (!arguments.length) return sortSubgroups;
+ sortSubgroups = x;
+ chords = null;
+ return chord;
+ };
+ chord.sortChords = function(x) {
+ if (!arguments.length) return sortChords;
+ sortChords = x;
+ if (chords) resort();
+ return chord;
+ };
+ chord.chords = function() {
+ if (!chords) relayout();
+ return chords;
+ };
+ chord.groups = function() {
+ if (!groups) relayout();
+ return groups;
+ };
+ return chord;
+ };
+ d3.layout.force = function() {
+ var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, nodes = [], links = [], distances, strengths, charges;
+ function repulse(node) {
+ return function(quad, x1, _, x2) {
+ if (quad.point !== node) {
+ var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy);
+ if ((x2 - x1) * dn < theta) {
+ var k = quad.charge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ return true;
+ }
+ if (quad.point && isFinite(dn)) {
+ var k = quad.pointCharge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ }
+ }
+ return !quad.charge;
+ };
+ }
+ force.tick = function() {
+ if ((alpha *= .99) < .005) {
+ event.end({
+ type: "end",
+ alpha: alpha = 0
+ });
+ return true;
+ }
+ var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ s = o.source;
+ t = o.target;
+ x = t.x - s.x;
+ y = t.y - s.y;
+ if (l = x * x + y * y) {
+ l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
+ x *= l;
+ y *= l;
+ t.x -= x * (k = s.weight / (t.weight + s.weight));
+ t.y -= y * k;
+ s.x += x * (k = 1 - k);
+ s.y += y * k;
+ }
+ }
+ if (k = alpha * gravity) {
+ x = size[0] / 2;
+ y = size[1] / 2;
+ i = -1;
+ if (k) while (++i < n) {
+ o = nodes[i];
+ o.x += (x - o.x) * k;
+ o.y += (y - o.y) * k;
+ }
+ }
+ if (charge) {
+ d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
+ i = -1;
+ while (++i < n) {
+ if (!(o = nodes[i]).fixed) {
+ q.visit(repulse(o));
+ }
+ }
+ }
+ i = -1;
+ while (++i < n) {
+ o = nodes[i];
+ if (o.fixed) {
+ o.x = o.px;
+ o.y = o.py;
+ } else {
+ o.x -= (o.px - (o.px = o.x)) * friction;
+ o.y -= (o.py - (o.py = o.y)) * friction;
+ }
+ }
+ event.tick({
+ type: "tick",
+ alpha: alpha
+ });
+ };
+ force.nodes = function(x) {
+ if (!arguments.length) return nodes;
+ nodes = x;
+ return force;
+ };
+ force.links = function(x) {
+ if (!arguments.length) return links;
+ links = x;
+ return force;
+ };
+ force.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return force;
+ };
+ force.linkDistance = function(x) {
+ if (!arguments.length) return linkDistance;
+ linkDistance = typeof x === "function" ? x : +x;
+ return force;
+ };
+ force.distance = force.linkDistance;
+ force.linkStrength = function(x) {
+ if (!arguments.length) return linkStrength;
+ linkStrength = typeof x === "function" ? x : +x;
+ return force;
+ };
+ force.friction = function(x) {
+ if (!arguments.length) return friction;
+ friction = +x;
+ return force;
+ };
+ force.charge = function(x) {
+ if (!arguments.length) return charge;
+ charge = typeof x === "function" ? x : +x;
+ return force;
+ };
+ force.gravity = function(x) {
+ if (!arguments.length) return gravity;
+ gravity = +x;
+ return force;
+ };
+ force.theta = function(x) {
+ if (!arguments.length) return theta;
+ theta = +x;
+ return force;
+ };
+ force.alpha = function(x) {
+ if (!arguments.length) return alpha;
+ x = +x;
+ if (alpha) {
+ if (x > 0) alpha = x; else alpha = 0;
+ } else if (x > 0) {
+ event.start({
+ type: "start",
+ alpha: alpha = x
+ });
+ d3.timer(force.tick);
+ }
+ return force;
+ };
+ force.start = function() {
+ var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;
+ for (i = 0; i < n; ++i) {
+ (o = nodes[i]).index = i;
+ o.weight = 0;
+ }
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ if (typeof o.source == "number") o.source = nodes[o.source];
+ if (typeof o.target == "number") o.target = nodes[o.target];
+ ++o.source.weight;
+ ++o.target.weight;
+ }
+ for (i = 0; i < n; ++i) {
+ o = nodes[i];
+ if (isNaN(o.x)) o.x = position("x", w);
+ if (isNaN(o.y)) o.y = position("y", h);
+ if (isNaN(o.px)) o.px = o.x;
+ if (isNaN(o.py)) o.py = o.y;
+ }
+ distances = [];
+ if (typeof linkDistance === "function") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i); else for (i = 0; i < m; ++i) distances[i] = linkDistance;
+ strengths = [];
+ if (typeof linkStrength === "function") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i); else for (i = 0; i < m; ++i) strengths[i] = linkStrength;
+ charges = [];
+ if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge;
+ function position(dimension, size) {
+ var neighbors = neighbor(i), j = -1, m = neighbors.length, x;
+ while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
+ return Math.random() * size;
+ }
+ function neighbor() {
+ if (!neighbors) {
+ neighbors = [];
+ for (j = 0; j < n; ++j) {
+ neighbors[j] = [];
+ }
+ for (j = 0; j < m; ++j) {
+ var o = links[j];
+ neighbors[o.source.index].push(o.target);
+ neighbors[o.target.index].push(o.source);
+ }
+ }
+ return neighbors[i];
+ }
+ return force.resume();
+ };
+ force.resume = function() {
+ return force.alpha(.1);
+ };
+ force.stop = function() {
+ return force.alpha(0);
+ };
+ force.drag = function() {
+ if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend);
+ if (!arguments.length) return drag;
+ this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);
+ };
+ function dragmove(d) {
+ d.px = d3.event.x, d.py = d3.event.y;
+ force.resume();
+ }
+ return d3.rebind(force, event, "on");
+ };
+ function d3_layout_forceDragstart(d) {
+ d.fixed |= 2;
+ }
+ function d3_layout_forceDragend(d) {
+ d.fixed &= ~6;
+ }
+ function d3_layout_forceMouseover(d) {
+ d.fixed |= 4;
+ d.px = d.x, d.py = d.y;
+ }
+ function d3_layout_forceMouseout(d) {
+ d.fixed &= ~4;
+ }
+ function d3_layout_forceAccumulate(quad, alpha, charges) {
+ var cx = 0, cy = 0;
+ quad.charge = 0;
+ if (!quad.leaf) {
+ var nodes = quad.nodes, n = nodes.length, i = -1, c;
+ while (++i < n) {
+ c = nodes[i];
+ if (c == null) continue;
+ d3_layout_forceAccumulate(c, alpha, charges);
+ quad.charge += c.charge;
+ cx += c.charge * c.cx;
+ cy += c.charge * c.cy;
+ }
+ }
+ if (quad.point) {
+ if (!quad.leaf) {
+ quad.point.x += Math.random() - .5;
+ quad.point.y += Math.random() - .5;
+ }
+ var k = alpha * charges[quad.point.index];
+ quad.charge += quad.pointCharge = k;
+ cx += k * quad.point.x;
+ cy += k * quad.point.y;
+ }
+ quad.cx = cx / quad.charge;
+ quad.cy = cy / quad.charge;
+ }
+ var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1;
+ d3.layout.hierarchy = function() {
+ var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;
+ function recurse(node, depth, nodes) {
+ var childs = children.call(hierarchy, node, depth);
+ node.depth = depth;
+ nodes.push(node);
+ if (childs && (n = childs.length)) {
+ var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d;
+ while (++i < n) {
+ d = recurse(childs[i], j, nodes);
+ d.parent = node;
+ c.push(d);
+ v += d.value;
+ }
+ if (sort) c.sort(sort);
+ if (value) node.value = v;
+ } else if (value) {
+ node.value = +value.call(hierarchy, node, depth) || 0;
+ }
+ return node;
+ }
+ function revalue(node, depth) {
+ var children = node.children, v = 0;
+ if (children && (n = children.length)) {
+ var i = -1, n, j = depth + 1;
+ while (++i < n) v += revalue(children[i], j);
+ } else if (value) {
+ v = +value.call(hierarchy, node, depth) || 0;
+ }
+ if (value) node.value = v;
+ return v;
+ }
+ function hierarchy(d) {
+ var nodes = [];
+ recurse(d, 0, nodes);
+ return nodes;
+ }
+ hierarchy.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return hierarchy;
+ };
+ hierarchy.children = function(x) {
+ if (!arguments.length) return children;
+ children = x;
+ return hierarchy;
+ };
+ hierarchy.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return hierarchy;
+ };
+ hierarchy.revalue = function(root) {
+ revalue(root, 0);
+ return root;
+ };
+ return hierarchy;
+ };
+ function d3_layout_hierarchyRebind(object, hierarchy) {
+ d3.rebind(object, hierarchy, "sort", "children", "value");
+ object.nodes = object;
+ object.links = d3_layout_hierarchyLinks;
+ return object;
+ }
+ function d3_layout_hierarchyChildren(d) {
+ return d.children;
+ }
+ function d3_layout_hierarchyValue(d) {
+ return d.value;
+ }
+ function d3_layout_hierarchySort(a, b) {
+ return b.value - a.value;
+ }
+ function d3_layout_hierarchyLinks(nodes) {
+ return d3.merge(nodes.map(function(parent) {
+ return (parent.children || []).map(function(child) {
+ return {
+ source: parent,
+ target: child
+ };
+ });
+ }));
+ }
+ d3.layout.partition = function() {
+ var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];
+ function position(node, x, dx, dy) {
+ var children = node.children;
+ node.x = x;
+ node.y = node.depth * dy;
+ node.dx = dx;
+ node.dy = dy;
+ if (children && (n = children.length)) {
+ var i = -1, n, c, d;
+ dx = node.value ? dx / node.value : 0;
+ while (++i < n) {
+ position(c = children[i], x, d = c.value * dx, dy);
+ x += d;
+ }
+ }
+ }
+ function depth(node) {
+ var children = node.children, d = 0;
+ if (children && (n = children.length)) {
+ var i = -1, n;
+ while (++i < n) d = Math.max(d, depth(children[i]));
+ }
+ return 1 + d;
+ }
+ function partition(d, i) {
+ var nodes = hierarchy.call(this, d, i);
+ position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
+ return nodes;
+ }
+ partition.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return partition;
+ };
+ return d3_layout_hierarchyRebind(partition, hierarchy);
+ };
+ d3.layout.pie = function() {
+ var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * π;
+ function pie(data) {
+ var values = data.map(function(d, i) {
+ return +value.call(pie, d, i);
+ });
+ var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle);
+ var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a) / d3.sum(values);
+ var index = d3.range(data.length);
+ if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
+ return values[j] - values[i];
+ } : function(i, j) {
+ return sort(data[i], data[j]);
+ });
+ var arcs = [];
+ index.forEach(function(i) {
+ var d;
+ arcs[i] = {
+ data: data[i],
+ value: d = values[i],
+ startAngle: a,
+ endAngle: a += d * k
+ };
+ });
+ return arcs;
+ }
+ pie.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return pie;
+ };
+ pie.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return pie;
+ };
+ pie.startAngle = function(x) {
+ if (!arguments.length) return startAngle;
+ startAngle = x;
+ return pie;
+ };
+ pie.endAngle = function(x) {
+ if (!arguments.length) return endAngle;
+ endAngle = x;
+ return pie;
+ };
+ return pie;
+ };
+ var d3_layout_pieSortByValue = {};
+ d3.layout.stack = function() {
+ var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
+ function stack(data, index) {
+ var series = data.map(function(d, i) {
+ return values.call(stack, d, i);
+ });
+ var points = series.map(function(d) {
+ return d.map(function(v, i) {
+ return [ x.call(stack, v, i), y.call(stack, v, i) ];
+ });
+ });
+ var orders = order.call(stack, points, index);
+ series = d3.permute(series, orders);
+ points = d3.permute(points, orders);
+ var offsets = offset.call(stack, points, index);
+ var n = series.length, m = series[0].length, i, j, o;
+ for (j = 0; j < m; ++j) {
+ out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
+ for (i = 1; i < n; ++i) {
+ out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
+ }
+ }
+ return data;
+ }
+ stack.values = function(x) {
+ if (!arguments.length) return values;
+ values = x;
+ return stack;
+ };
+ stack.order = function(x) {
+ if (!arguments.length) return order;
+ order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
+ return stack;
+ };
+ stack.offset = function(x) {
+ if (!arguments.length) return offset;
+ offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
+ return stack;
+ };
+ stack.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ return stack;
+ };
+ stack.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ return stack;
+ };
+ stack.out = function(z) {
+ if (!arguments.length) return out;
+ out = z;
+ return stack;
+ };
+ return stack;
+ };
+ function d3_layout_stackX(d) {
+ return d.x;
+ }
+ function d3_layout_stackY(d) {
+ return d.y;
+ }
+ function d3_layout_stackOut(d, y0, y) {
+ d.y0 = y0;
+ d.y = y;
+ }
+ var d3_layout_stackOrders = d3.map({
+ "inside-out": function(data) {
+ var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) {
+ return max[a] - max[b];
+ }), top = 0, bottom = 0, tops = [], bottoms = [];
+ for (i = 0; i < n; ++i) {
+ j = index[i];
+ if (top < bottom) {
+ top += sums[j];
+ tops.push(j);
+ } else {
+ bottom += sums[j];
+ bottoms.push(j);
+ }
+ }
+ return bottoms.reverse().concat(tops);
+ },
+ reverse: function(data) {
+ return d3.range(data.length).reverse();
+ },
+ "default": d3_layout_stackOrderDefault
+ });
+ var d3_layout_stackOffsets = d3.map({
+ silhouette: function(data) {
+ var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o > max) max = o;
+ sums.push(o);
+ }
+ for (j = 0; j < m; ++j) {
+ y0[j] = (max - sums[j]) / 2;
+ }
+ return y0;
+ },
+ wiggle: function(data) {
+ var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];
+ y0[0] = o = o0 = 0;
+ for (j = 1; j < m; ++j) {
+ for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
+ for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
+ for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
+ s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
+ }
+ s2 += s3 * data[i][j][1];
+ }
+ y0[j] = o -= s1 ? s2 / s1 * dx : 0;
+ if (o < o0) o0 = o;
+ }
+ for (j = 0; j < m; ++j) y0[j] -= o0;
+ return y0;
+ },
+ expand: function(data) {
+ var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k;
+ }
+ for (j = 0; j < m; ++j) y0[j] = 0;
+ return y0;
+ },
+ zero: d3_layout_stackOffsetZero
+ });
+ function d3_layout_stackOrderDefault(data) {
+ return d3.range(data.length);
+ }
+ function d3_layout_stackOffsetZero(data) {
+ var j = -1, m = data[0].length, y0 = [];
+ while (++j < m) y0[j] = 0;
+ return y0;
+ }
+ function d3_layout_stackMaxIndex(array) {
+ var i = 1, j = 0, v = array[0][1], k, n = array.length;
+ for (;i < n; ++i) {
+ if ((k = array[i][1]) > v) {
+ j = i;
+ v = k;
+ }
+ }
+ return j;
+ }
+ function d3_layout_stackReduceSum(d) {
+ return d.reduce(d3_layout_stackSum, 0);
+ }
+ function d3_layout_stackSum(p, d) {
+ return p + d[1];
+ }
+ d3.layout.histogram = function() {
+ var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;
+ function histogram(data, i) {
+ var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x;
+ while (++i < m) {
+ bin = bins[i] = [];
+ bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
+ bin.y = 0;
+ }
+ if (m > 0) {
+ i = -1;
+ while (++i < n) {
+ x = values[i];
+ if (x >= range[0] && x <= range[1]) {
+ bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
+ bin.y += k;
+ bin.push(data[i]);
+ }
+ }
+ }
+ return bins;
+ }
+ histogram.value = function(x) {
+ if (!arguments.length) return valuer;
+ valuer = x;
+ return histogram;
+ };
+ histogram.range = function(x) {
+ if (!arguments.length) return ranger;
+ ranger = d3_functor(x);
+ return histogram;
+ };
+ histogram.bins = function(x) {
+ if (!arguments.length) return binner;
+ binner = typeof x === "number" ? function(range) {
+ return d3_layout_histogramBinFixed(range, x);
+ } : d3_functor(x);
+ return histogram;
+ };
+ histogram.frequency = function(x) {
+ if (!arguments.length) return frequency;
+ frequency = !!x;
+ return histogram;
+ };
+ return histogram;
+ };
+ function d3_layout_histogramBinSturges(range, values) {
+ return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
+ }
+ function d3_layout_histogramBinFixed(range, n) {
+ var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];
+ while (++x <= n) f[x] = m * x + b;
+ return f;
+ }
+ function d3_layout_histogramRange(values) {
+ return [ d3.min(values), d3.max(values) ];
+ }
+ d3.layout.tree = function() {
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
+ function tree(d, i) {
+ var nodes = hierarchy.call(this, d, i), root = nodes[0];
+ function firstWalk(node, previousSibling) {
+ var children = node.children, layout = node._tree;
+ if (children && (n = children.length)) {
+ var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;
+ while (++i < n) {
+ child = children[i];
+ firstWalk(child, previousChild);
+ ancestor = apportion(child, previousChild, ancestor);
+ previousChild = child;
+ }
+ d3_layout_treeShift(node);
+ var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ layout.mod = layout.prelim - midpoint;
+ } else {
+ layout.prelim = midpoint;
+ }
+ } else {
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ }
+ }
+ }
+ function secondWalk(node, x) {
+ node.x = node._tree.prelim + x;
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var i = -1, n;
+ x += node._tree.mod;
+ while (++i < n) {
+ secondWalk(children[i], x);
+ }
+ }
+ }
+ function apportion(node, previousSibling, ancestor) {
+ if (previousSibling) {
+ var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift;
+ while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
+ vom = d3_layout_treeLeft(vom);
+ vop = d3_layout_treeRight(vop);
+ vop._tree.ancestor = node;
+ shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
+ if (shift > 0) {
+ d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
+ sip += shift;
+ sop += shift;
+ }
+ sim += vim._tree.mod;
+ sip += vip._tree.mod;
+ som += vom._tree.mod;
+ sop += vop._tree.mod;
+ }
+ if (vim && !d3_layout_treeRight(vop)) {
+ vop._tree.thread = vim;
+ vop._tree.mod += sim - sop;
+ }
+ if (vip && !d3_layout_treeLeft(vom)) {
+ vom._tree.thread = vip;
+ vom._tree.mod += sip - som;
+ ancestor = node;
+ }
+ }
+ return ancestor;
+ }
+ d3_layout_treeVisitAfter(root, function(node, previousSibling) {
+ node._tree = {
+ ancestor: node,
+ prelim: 0,
+ mod: 0,
+ change: 0,
+ shift: 0,
+ number: previousSibling ? previousSibling._tree.number + 1 : 0
+ };
+ });
+ firstWalk(root);
+ secondWalk(root, -root._tree.prelim);
+ var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1;
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = node.depth / y1 * size[1];
+ delete node._tree;
+ });
+ return nodes;
+ }
+ tree.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return tree;
+ };
+ tree.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return tree;
+ };
+ return d3_layout_hierarchyRebind(tree, hierarchy);
+ };
+ function d3_layout_treeSeparation(a, b) {
+ return a.parent == b.parent ? 1 : 2;
+ }
+ function d3_layout_treeLeft(node) {
+ var children = node.children;
+ return children && children.length ? children[0] : node._tree.thread;
+ }
+ function d3_layout_treeRight(node) {
+ var children = node.children, n;
+ return children && (n = children.length) ? children[n - 1] : node._tree.thread;
+ }
+ function d3_layout_treeSearch(node, compare) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child, n, i = -1;
+ while (++i < n) {
+ if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
+ node = child;
+ }
+ }
+ }
+ return node;
+ }
+ function d3_layout_treeRightmost(a, b) {
+ return a.x - b.x;
+ }
+ function d3_layout_treeLeftmost(a, b) {
+ return b.x - a.x;
+ }
+ function d3_layout_treeDeepest(a, b) {
+ return a.depth - b.depth;
+ }
+ function d3_layout_treeVisitAfter(node, callback) {
+ function visit(node, previousSibling) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child, previousChild = null, i = -1, n;
+ while (++i < n) {
+ child = children[i];
+ visit(child, previousChild);
+ previousChild = child;
+ }
+ }
+ callback(node, previousSibling);
+ }
+ visit(node, null);
+ }
+ function d3_layout_treeShift(node) {
+ var shift = 0, change = 0, children = node.children, i = children.length, child;
+ while (--i >= 0) {
+ child = children[i]._tree;
+ child.prelim += shift;
+ child.mod += shift;
+ shift += child.shift + (change += child.change);
+ }
+ }
+ function d3_layout_treeMove(ancestor, node, shift) {
+ ancestor = ancestor._tree;
+ node = node._tree;
+ var change = shift / (node.number - ancestor.number);
+ ancestor.change += change;
+ node.change -= change;
+ node.shift += shift;
+ node.prelim += shift;
+ node.mod += shift;
+ }
+ function d3_layout_treeAncestor(vim, node, ancestor) {
+ return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor;
+ }
+ d3.layout.pack = function() {
+ var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ];
+ function pack(d, i) {
+ var nodes = hierarchy.call(this, d, i), root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r = Math.sqrt(d.value);
+ });
+ d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
+ var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h);
+ if (padding > 0) {
+ var dr = padding * k / 2;
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r += dr;
+ });
+ d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r -= dr;
+ });
+ k = Math.max(2 * root.r / w, 2 * root.r / h);
+ }
+ d3_layout_packTransform(root, w / 2, h / 2, 1 / k);
+ return nodes;
+ }
+ pack.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return pack;
+ };
+ pack.padding = function(_) {
+ if (!arguments.length) return padding;
+ padding = +_;
+ return pack;
+ };
+ return d3_layout_hierarchyRebind(pack, hierarchy);
+ };
+ function d3_layout_packSort(a, b) {
+ return a.value - b.value;
+ }
+ function d3_layout_packInsert(a, b) {
+ var c = a._pack_next;
+ a._pack_next = b;
+ b._pack_prev = a;
+ b._pack_next = c;
+ c._pack_prev = b;
+ }
+ function d3_layout_packSplice(a, b) {
+ a._pack_next = b;
+ b._pack_prev = a;
+ }
+ function d3_layout_packIntersects(a, b) {
+ var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;
+ return dr * dr - dx * dx - dy * dy > .001;
+ }
+ function d3_layout_packSiblings(node) {
+ if (!(nodes = node.children) || !(n = nodes.length)) return;
+ var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;
+ function bound(node) {
+ xMin = Math.min(node.x - node.r, xMin);
+ xMax = Math.max(node.x + node.r, xMax);
+ yMin = Math.min(node.y - node.r, yMin);
+ yMax = Math.max(node.y + node.r, yMax);
+ }
+ nodes.forEach(d3_layout_packLink);
+ a = nodes[0];
+ a.x = -a.r;
+ a.y = 0;
+ bound(a);
+ if (n > 1) {
+ b = nodes[1];
+ b.x = b.r;
+ b.y = 0;
+ bound(b);
+ if (n > 2) {
+ c = nodes[2];
+ d3_layout_packPlace(a, b, c);
+ bound(c);
+ d3_layout_packInsert(a, c);
+ a._pack_prev = c;
+ d3_layout_packInsert(c, b);
+ b = a._pack_next;
+ for (i = 3; i < n; i++) {
+ d3_layout_packPlace(a, b, c = nodes[i]);
+ var isect = 0, s1 = 1, s2 = 1;
+ for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
+ if (d3_layout_packIntersects(j, c)) {
+ isect = 1;
+ break;
+ }
+ }
+ if (isect == 1) {
+ for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
+ if (d3_layout_packIntersects(k, c)) {
+ break;
+ }
+ }
+ }
+ if (isect) {
+ if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);
+ i--;
+ } else {
+ d3_layout_packInsert(a, c);
+ b = c;
+ bound(c);
+ }
+ }
+ }
+ }
+ var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;
+ for (i = 0; i < n; i++) {
+ c = nodes[i];
+ c.x -= cx;
+ c.y -= cy;
+ cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));
+ }
+ node.r = cr;
+ nodes.forEach(d3_layout_packUnlink);
+ }
+ function d3_layout_packLink(node) {
+ node._pack_next = node._pack_prev = node;
+ }
+ function d3_layout_packUnlink(node) {
+ delete node._pack_next;
+ delete node._pack_prev;
+ }
+ function d3_layout_packTransform(node, x, y, k) {
+ var children = node.children;
+ node.x = x += k * node.x;
+ node.y = y += k * node.y;
+ node.r *= k;
+ if (children) {
+ var i = -1, n = children.length;
+ while (++i < n) d3_layout_packTransform(children[i], x, y, k);
+ }
+ }
+ function d3_layout_packPlace(a, b, c) {
+ var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;
+ if (db && (dx || dy)) {
+ var da = b.r + c.r, dc = dx * dx + dy * dy;
+ da *= da;
+ db *= db;
+ var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
+ c.x = a.x + x * dx + y * dy;
+ c.y = a.y + x * dy - y * dx;
+ } else {
+ c.x = a.x + db;
+ c.y = a.y;
+ }
+ }
+ d3.layout.cluster = function() {
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
+ function cluster(d, i) {
+ var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0;
+ d3_layout_treeVisitAfter(root, function(node) {
+ var children = node.children;
+ if (children && children.length) {
+ node.x = d3_layout_clusterX(children);
+ node.y = d3_layout_clusterY(children);
+ } else {
+ node.x = previousNode ? x += separation(node, previousNode) : 0;
+ node.y = 0;
+ previousNode = node;
+ }
+ });
+ var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
+ });
+ return nodes;
+ }
+ cluster.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return cluster;
+ };
+ cluster.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return cluster;
+ };
+ return d3_layout_hierarchyRebind(cluster, hierarchy);
+ };
+ function d3_layout_clusterY(children) {
+ return 1 + d3.max(children, function(child) {
+ return child.y;
+ });
+ }
+ function d3_layout_clusterX(children) {
+ return children.reduce(function(x, child) {
+ return x + child.x;
+ }, 0) / children.length;
+ }
+ function d3_layout_clusterLeft(node) {
+ var children = node.children;
+ return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
+ }
+ function d3_layout_clusterRight(node) {
+ var children = node.children, n;
+ return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
+ }
+ d3.layout.treemap = function() {
+ var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5));
+ function scale(children, k) {
+ var i = -1, n = children.length, child, area;
+ while (++i < n) {
+ area = (child = children[i]).value * (k < 0 ? 0 : k);
+ child.area = isNaN(area) || area <= 0 ? 0 : area;
+ }
+ }
+ function squarify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n;
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while ((n = remaining.length) > 0) {
+ row.push(child = remaining[n - 1]);
+ row.area += child.area;
+ if (mode !== "squarify" || (score = worst(row, u)) <= best) {
+ remaining.pop();
+ best = score;
+ } else {
+ row.area -= row.pop().area;
+ position(row, u, rect, false);
+ u = Math.min(rect.dx, rect.dy);
+ row.length = row.area = 0;
+ best = Infinity;
+ }
+ }
+ if (row.length) {
+ position(row, u, rect, true);
+ row.length = row.area = 0;
+ }
+ children.forEach(squarify);
+ }
+ }
+ function stickify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node), remaining = children.slice(), child, row = [];
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while (child = remaining.pop()) {
+ row.push(child);
+ row.area += child.area;
+ if (child.z != null) {
+ position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
+ row.length = row.area = 0;
+ }
+ }
+ children.forEach(stickify);
+ }
+ }
+ function worst(row, u) {
+ var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;
+ while (++i < n) {
+ if (!(r = row[i].area)) continue;
+ if (r < rmin) rmin = r;
+ if (r > rmax) rmax = r;
+ }
+ s *= s;
+ u *= u;
+ return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;
+ }
+ function position(row, u, rect, flush) {
+ var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
+ if (u == rect.dx) {
+ if (flush || v > rect.dy) v = rect.dy;
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dy = v;
+ x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
+ }
+ o.z = true;
+ o.dx += rect.x + rect.dx - x;
+ rect.y += v;
+ rect.dy -= v;
+ } else {
+ if (flush || v > rect.dx) v = rect.dx;
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dx = v;
+ y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
+ }
+ o.z = false;
+ o.dy += rect.y + rect.dy - y;
+ rect.x += v;
+ rect.dx -= v;
+ }
+ }
+ function treemap(d) {
+ var nodes = stickies || hierarchy(d), root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ root.dx = size[0];
+ root.dy = size[1];
+ if (stickies) hierarchy.revalue(root);
+ scale([ root ], root.dx * root.dy / root.value);
+ (stickies ? stickify : squarify)(root);
+ if (sticky) stickies = nodes;
+ return nodes;
+ }
+ treemap.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return treemap;
+ };
+ treemap.padding = function(x) {
+ if (!arguments.length) return padding;
+ function padFunction(node) {
+ var p = x.call(treemap, node, node.depth);
+ return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);
+ }
+ function padConstant(node) {
+ return d3_layout_treemapPad(node, x);
+ }
+ var type;
+ pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ],
+ padConstant) : padConstant;
+ return treemap;
+ };
+ treemap.round = function(x) {
+ if (!arguments.length) return round != Number;
+ round = x ? Math.round : Number;
+ return treemap;
+ };
+ treemap.sticky = function(x) {
+ if (!arguments.length) return sticky;
+ sticky = x;
+ stickies = null;
+ return treemap;
+ };
+ treemap.ratio = function(x) {
+ if (!arguments.length) return ratio;
+ ratio = x;
+ return treemap;
+ };
+ treemap.mode = function(x) {
+ if (!arguments.length) return mode;
+ mode = x + "";
+ return treemap;
+ };
+ return d3_layout_hierarchyRebind(treemap, hierarchy);
+ };
+ function d3_layout_treemapPadNull(node) {
+ return {
+ x: node.x,
+ y: node.y,
+ dx: node.dx,
+ dy: node.dy
+ };
+ }
+ function d3_layout_treemapPad(node, padding) {
+ var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2];
+ if (dx < 0) {
+ x += dx / 2;
+ dx = 0;
+ }
+ if (dy < 0) {
+ y += dy / 2;
+ dy = 0;
+ }
+ return {
+ x: x,
+ y: y,
+ dx: dx,
+ dy: dy
+ };
+ }
+ d3.random = {
+ normal: function(µ, σ) {
+ var n = arguments.length;
+ if (n < 2) σ = 1;
+ if (n < 1) µ = 0;
+ return function() {
+ var x, y, r;
+ do {
+ x = Math.random() * 2 - 1;
+ y = Math.random() * 2 - 1;
+ r = x * x + y * y;
+ } while (!r || r > 1);
+ return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
+ };
+ },
+ logNormal: function() {
+ var random = d3.random.normal.apply(d3, arguments);
+ return function() {
+ return Math.exp(random());
+ };
+ },
+ irwinHall: function(m) {
+ return function() {
+ for (var s = 0, j = 0; j < m; j++) s += Math.random();
+ return s / m;
+ };
+ }
+ };
+ d3.scale = {};
+ function d3_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [ start, stop ] : [ stop, start ];
+ }
+ function d3_scaleRange(scale) {
+ return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
+ }
+ function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
+ var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);
+ return function(x) {
+ return i(u(x));
+ };
+ }
+ function d3_scale_nice(domain, nice) {
+ var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;
+ if (x1 < x0) {
+ dx = i0, i0 = i1, i1 = dx;
+ dx = x0, x0 = x1, x1 = dx;
+ }
+ if (nice = nice(x1 - x0)) {
+ domain[i0] = nice.floor(x0);
+ domain[i1] = nice.ceil(x1);
+ }
+ return domain;
+ }
+ function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
+ var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;
+ if (domain[k] < domain[0]) {
+ domain = domain.slice().reverse();
+ range = range.slice().reverse();
+ }
+ while (++j <= k) {
+ u.push(uninterpolate(domain[j - 1], domain[j]));
+ i.push(interpolate(range[j - 1], range[j]));
+ }
+ return function(x) {
+ var j = d3.bisect(domain, x, 1, k) - 1;
+ return i[j](u[j](x));
+ };
+ }
+ d3.scale.linear = function() {
+ return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3_interpolate, false);
+ };
+ function d3_scale_linear(domain, range, interpolate, clamp) {
+ var output, input;
+ function rescale() {
+ var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
+ output = linear(domain, range, uninterpolate, interpolate);
+ input = linear(range, domain, uninterpolate, d3_interpolate);
+ return scale;
+ }
+ function scale(x) {
+ return output(x);
+ }
+ scale.invert = function(y) {
+ return input(y);
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.map(Number);
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.rangeRound = function(x) {
+ return scale.range(x).interpolate(d3_interpolateRound);
+ };
+ scale.clamp = function(x) {
+ if (!arguments.length) return clamp;
+ clamp = x;
+ return rescale();
+ };
+ scale.interpolate = function(x) {
+ if (!arguments.length) return interpolate;
+ interpolate = x;
+ return rescale();
+ };
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(domain, m);
+ };
+ scale.tickFormat = function(m, format) {
+ return d3_scale_linearTickFormat(domain, m, format);
+ };
+ scale.nice = function() {
+ d3_scale_nice(domain, d3_scale_linearNice);
+ return rescale();
+ };
+ scale.copy = function() {
+ return d3_scale_linear(domain, range, interpolate, clamp);
+ };
+ return rescale();
+ }
+ function d3_scale_linearRebind(scale, linear) {
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+ }
+ function d3_scale_linearNice(dx) {
+ dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
+ return dx && {
+ floor: function(x) {
+ return Math.floor(x / dx) * dx;
+ },
+ ceil: function(x) {
+ return Math.ceil(x / dx) * dx;
+ }
+ };
+ }
+ function d3_scale_linearTickRange(domain, m) {
+ var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step;
+ if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
+ extent[0] = Math.ceil(extent[0] / step) * step;
+ extent[1] = Math.floor(extent[1] / step) * step + step * .5;
+ extent[2] = step;
+ return extent;
+ }
+ function d3_scale_linearTicks(domain, m) {
+ return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
+ }
+ function d3_scale_linearTickFormat(domain, m, format) {
+ var precision = -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01);
+ return d3.format(format ? format.replace(d3_format_re, function(a, b, c, d, e, f, g, h, i, j) {
+ return [ b, c, d, e, f, g, h, i || "." + (precision - (j === "%") * 2), j ].join("");
+ }) : ",." + precision + "f");
+ }
+ d3.scale.log = function() {
+ return d3_scale_log(d3.scale.linear().domain([ 0, Math.LN10 ]), 10, d3_scale_logp, d3_scale_powp);
+ };
+ function d3_scale_log(linear, base, log, pow) {
+ function scale(x) {
+ return linear(log(x));
+ }
+ scale.invert = function(x) {
+ return pow(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(pow);
+ if (x[0] < 0) log = d3_scale_logn, pow = d3_scale_pown; else log = d3_scale_logp,
+ pow = d3_scale_powp;
+ linear.domain(x.map(log));
+ return scale;
+ };
+ scale.base = function(_) {
+ if (!arguments.length) return base;
+ base = +_;
+ return scale;
+ };
+ scale.nice = function() {
+ linear.domain(d3_scale_nice(linear.domain(), d3_scale_logNice(base)));
+ return scale;
+ };
+ scale.ticks = function() {
+ var extent = d3_scaleExtent(linear.domain()), ticks = [];
+ if (extent.every(isFinite)) {
+ var b = Math.log(base), i = Math.floor(extent[0] / b), j = Math.ceil(extent[1] / b), u = pow(extent[0]), v = pow(extent[1]), n = base % 1 ? 2 : base;
+ if (log === d3_scale_logn) {
+ ticks.push(-Math.pow(base, -i));
+ for (;i++ < j; ) for (var k = n - 1; k > 0; k--) ticks.push(-Math.pow(base, -i) * k);
+ } else {
+ for (;i < j; i++) for (var k = 1; k < n; k++) ticks.push(Math.pow(base, i) * k);
+ ticks.push(Math.pow(base, i));
+ }
+ for (i = 0; ticks[i] < u; i++) {}
+ for (j = ticks.length; ticks[j - 1] > v; j--) {}
+ ticks = ticks.slice(i, j);
+ }
+ return ticks;
+ };
+ scale.tickFormat = function(n, format) {
+ if (arguments.length < 2) format = d3_scale_logFormat;
+ if (!arguments.length) return format;
+ var b = Math.log(base), k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12,
+ Math.floor) : (e = 1e-12, Math.ceil), e;
+ return function(d) {
+ return d / pow(b * f(log(d) / b + e)) <= k ? format(d) : "";
+ };
+ };
+ scale.copy = function() {
+ return d3_scale_log(linear.copy(), base, log, pow);
+ };
+ return d3_scale_linearRebind(scale, linear);
+ }
+ var d3_scale_logFormat = d3.format(".0e");
+ function d3_scale_logp(x) {
+ return Math.log(x < 0 ? 0 : x);
+ }
+ function d3_scale_powp(x) {
+ return Math.exp(x);
+ }
+ function d3_scale_logn(x) {
+ return -Math.log(x > 0 ? 0 : -x);
+ }
+ function d3_scale_pown(x) {
+ return -Math.exp(-x);
+ }
+ function d3_scale_logNice(base) {
+ base = Math.log(base);
+ var nice = {
+ floor: function(x) {
+ return Math.floor(x / base) * base;
+ },
+ ceil: function(x) {
+ return Math.ceil(x / base) * base;
+ }
+ };
+ return function() {
+ return nice;
+ };
+ }
+ d3.scale.pow = function() {
+ return d3_scale_pow(d3.scale.linear(), 1);
+ };
+ function d3_scale_pow(linear, exponent) {
+ var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);
+ function scale(x) {
+ return linear(powp(x));
+ }
+ scale.invert = function(x) {
+ return powb(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(powb);
+ linear.domain(x.map(powp));
+ return scale;
+ };
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(scale.domain(), m);
+ };
+ scale.tickFormat = function(m, format) {
+ return d3_scale_linearTickFormat(scale.domain(), m, format);
+ };
+ scale.nice = function() {
+ return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
+ };
+ scale.exponent = function(x) {
+ if (!arguments.length) return exponent;
+ var domain = scale.domain();
+ powp = d3_scale_powPow(exponent = x);
+ powb = d3_scale_powPow(1 / exponent);
+ return scale.domain(domain);
+ };
+ scale.copy = function() {
+ return d3_scale_pow(linear.copy(), exponent);
+ };
+ return d3_scale_linearRebind(scale, linear);
+ }
+ function d3_scale_powPow(e) {
+ return function(x) {
+ return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
+ };
+ }
+ d3.scale.sqrt = function() {
+ return d3.scale.pow().exponent(.5);
+ };
+ d3.scale.ordinal = function() {
+ return d3_scale_ordinal([], {
+ t: "range",
+ a: [ [] ]
+ });
+ };
+ function d3_scale_ordinal(domain, ranger) {
+ var index, range, rangeBand;
+ function scale(x) {
+ return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length];
+ }
+ function steps(start, step) {
+ return d3.range(domain.length).map(function(i) {
+ return start + step * i;
+ });
+ }
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = [];
+ index = new d3_Map();
+ var i = -1, n = x.length, xi;
+ while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
+ return scale[ranger.t].apply(scale, ranger.a);
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ rangeBand = 0;
+ ranger = {
+ t: "range",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangePoints = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding);
+ range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
+ rangeBand = 0;
+ ranger = {
+ t: "rangePoints",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeBands = function(x, padding, outerPadding) {
+ if (arguments.length < 2) padding = 0;
+ if (arguments.length < 3) outerPadding = padding;
+ var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);
+ range = steps(start + step * outerPadding, step);
+ if (reverse) range.reverse();
+ rangeBand = step * (1 - padding);
+ ranger = {
+ t: "rangeBands",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeRoundBands = function(x, padding, outerPadding) {
+ if (arguments.length < 2) padding = 0;
+ if (arguments.length < 3) outerPadding = padding;
+ var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step;
+ range = steps(start + Math.round(error / 2), step);
+ if (reverse) range.reverse();
+ rangeBand = Math.round(step * (1 - padding));
+ ranger = {
+ t: "rangeRoundBands",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeBand = function() {
+ //Customized
+ if(rangeBand <= 50)
+ return rangeBand;
+ else
+ return 50;
+ };
+ scale.rangeExtent = function() {
+ return d3_scaleExtent(ranger.a[0]);
+ };
+ scale.copy = function() {
+ return d3_scale_ordinal(domain, ranger);
+ };
+ return scale.domain(domain);
+ }
+ d3.scale.category10 = function() {
+ return d3.scale.ordinal().range(d3_category10);
+ };
+ d3.scale.category20 = function() {
+ return d3.scale.ordinal().range(d3_category20);
+ };
+ d3.scale.category20b = function() {
+ return d3.scale.ordinal().range(d3_category20b);
+ };
+ d3.scale.category20c = function() {
+ return d3.scale.ordinal().range(d3_category20c);
+ };
+ d3.scale.category50 = function() {
+ return d3.scale.ordinal().range(d3_category50);
+ };
+ var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ];
+ var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ];
+ var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ];
+ var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ];
+ var d3_category50 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#8c864b", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf","#DC143C","#800080","#0000FF","#008000","#D2691E","#FF0000","#000000","#DB7093","#FF00FF","#7B68EE","#1f77b6", "#9edae5", "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#aec7e8", "#e7ba52", "#ffbb78", "#e7cb94", "#98df8a", "#843c39", "#ff9896", "#ad494a", "#c5b0d5", "#d6616b", "#c49c94", "#e7969c", "#f7b6d2", "#fd8d3c", "#c7c7c7", "#7b4173", "#dbdb8d", "#a55194", ];
+ d3.scale.quantile = function() {
+ return d3_scale_quantile([], []);
+ };
+ function d3_scale_quantile(domain, range) {
+ var thresholds;
+ function rescale() {
+ var k = 0, q = range.length;
+ thresholds = [];
+ while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
+ return scale;
+ }
+ function scale(x) {
+ if (isNaN(x = +x)) return NaN;
+ return range[d3.bisect(thresholds, x)];
+ }
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.filter(function(d) {
+ return !isNaN(d);
+ }).sort(d3.ascending);
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.quantiles = function() {
+ return thresholds;
+ };
+ scale.copy = function() {
+ return d3_scale_quantile(domain, range);
+ };
+ return rescale();
+ }
+ d3.scale.quantize = function() {
+ return d3_scale_quantize(0, 1, [ 0, 1 ]);
+ };
+ function d3_scale_quantize(x0, x1, range) {
+ var kx, i;
+ function scale(x) {
+ return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
+ }
+ function rescale() {
+ kx = range.length / (x1 - x0);
+ i = range.length - 1;
+ return scale;
+ }
+ scale.domain = function(x) {
+ if (!arguments.length) return [ x0, x1 ];
+ x0 = +x[0];
+ x1 = +x[x.length - 1];
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.copy = function() {
+ return d3_scale_quantize(x0, x1, range);
+ };
+ return rescale();
+ }
+ d3.scale.threshold = function() {
+ return d3_scale_threshold([ .5 ], [ 0, 1 ]);
+ };
+ function d3_scale_threshold(domain, range) {
+ function scale(x) {
+ return range[d3.bisect(domain, x)];
+ }
+ scale.domain = function(_) {
+ if (!arguments.length) return domain;
+ domain = _;
+ return scale;
+ };
+ scale.range = function(_) {
+ if (!arguments.length) return range;
+ range = _;
+ return scale;
+ };
+ scale.copy = function() {
+ return d3_scale_threshold(domain, range);
+ };
+ return scale;
+ }
+ d3.scale.identity = function() {
+ return d3_scale_identity([ 0, 1 ]);
+ };
+ function d3_scale_identity(domain) {
+ function identity(x) {
+ return +x;
+ }
+ identity.invert = identity;
+ identity.domain = identity.range = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.map(identity);
+ return identity;
+ };
+ identity.ticks = function(m) {
+ return d3_scale_linearTicks(domain, m);
+ };
+ identity.tickFormat = function(m, format) {
+ return d3_scale_linearTickFormat(domain, m, format);
+ };
+ identity.copy = function() {
+ return d3_scale_identity(domain);
+ };
+ return identity;
+ }
+ d3.svg.arc = function() {
+ var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
+ function arc() {
+ var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0,
+ a0 = a1, a1 = da), a1 - a0), df = da < π ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1);
+ return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z";
+ }
+ arc.innerRadius = function(v) {
+ if (!arguments.length) return innerRadius;
+ innerRadius = d3_functor(v);
+ return arc;
+ };
+ arc.outerRadius = function(v) {
+ if (!arguments.length) return outerRadius;
+ outerRadius = d3_functor(v);
+ return arc;
+ };
+ arc.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return arc;
+ };
+ arc.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return arc;
+ };
+ arc.centroid = function() {
+ var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
+ return [ Math.cos(a) * r, Math.sin(a) * r ];
+ };
+ return arc;
+ };
+ var d3_svg_arcOffset = -π / 2, d3_svg_arcMax = 2 * π - 1e-6;
+ function d3_svg_arcInnerRadius(d) {
+ return d.innerRadius;
+ }
+ function d3_svg_arcOuterRadius(d) {
+ return d.outerRadius;
+ }
+ function d3_svg_arcStartAngle(d) {
+ return d.startAngle;
+ }
+ function d3_svg_arcEndAngle(d) {
+ return d.endAngle;
+ }
+ d3.svg.line.radial = function() {
+ var line = d3_svg_line(d3_svg_lineRadial);
+ line.radius = line.x, delete line.x;
+ line.angle = line.y, delete line.y;
+ return line;
+ };
+ function d3_svg_lineRadial(points) {
+ var point, i = -1, n = points.length, r, a;
+ while (++i < n) {
+ point = points[i];
+ r = point[0];
+ a = point[1] + d3_svg_arcOffset;
+ point[0] = r * Math.cos(a);
+ point[1] = r * Math.sin(a);
+ }
+ return points;
+ }
+ function d3_svg_area(projection) {
+ var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
+ function area(data) {
+ var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
+ return x;
+ } : d3_functor(x1), fy1 = y0 === y1 ? function() {
+ return y;
+ } : d3_functor(y1), x, y;
+ function segment() {
+ segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
+ }
+ while (++i < n) {
+ if (defined.call(this, d = data[i], i)) {
+ points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
+ points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
+ } else if (points0.length) {
+ segment();
+ points0 = [];
+ points1 = [];
+ }
+ }
+ if (points0.length) segment();
+ return segments.length ? segments.join("") : null;
+ }
+ area.x = function(_) {
+ if (!arguments.length) return x1;
+ x0 = x1 = _;
+ return area;
+ };
+ area.x0 = function(_) {
+ if (!arguments.length) return x0;
+ x0 = _;
+ return area;
+ };
+ area.x1 = function(_) {
+ if (!arguments.length) return x1;
+ x1 = _;
+ return area;
+ };
+ area.y = function(_) {
+ if (!arguments.length) return y1;
+ y0 = y1 = _;
+ return area;
+ };
+ area.y0 = function(_) {
+ if (!arguments.length) return y0;
+ y0 = _;
+ return area;
+ };
+ area.y1 = function(_) {
+ if (!arguments.length) return y1;
+ y1 = _;
+ return area;
+ };
+ area.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return area;
+ };
+ area.interpolate = function(_) {
+ if (!arguments.length) return interpolateKey;
+ if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
+ interpolateReverse = interpolate.reverse || interpolate;
+ L = interpolate.closed ? "M" : "L";
+ return area;
+ };
+ area.tension = function(_) {
+ if (!arguments.length) return tension;
+ tension = _;
+ return area;
+ };
+ return area;
+ }
+ d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
+ d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
+ d3.svg.area = function() {
+ return d3_svg_area(d3_identity);
+ };
+ d3.svg.area.radial = function() {
+ var area = d3_svg_area(d3_svg_lineRadial);
+ area.radius = area.x, delete area.x;
+ area.innerRadius = area.x0, delete area.x0;
+ area.outerRadius = area.x1, delete area.x1;
+ area.angle = area.y, delete area.y;
+ area.startAngle = area.y0, delete area.y0;
+ area.endAngle = area.y1, delete area.y1;
+ return area;
+ };
+ d3.svg.chord = function() {
+ var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
+ function chord(d, i) {
+ var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
+ return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z";
+ }
+ function subgroup(self, f, d, i) {
+ var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
+ return {
+ r: r,
+ a0: a0,
+ a1: a1,
+ p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
+ p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
+ };
+ }
+ function equals(a, b) {
+ return a.a0 == b.a0 && a.a1 == b.a1;
+ }
+ function arc(r, p, a) {
+ return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p;
+ }
+ function curve(r0, p0, r1, p1) {
+ return "Q 0,0 " + p1;
+ }
+ chord.radius = function(v) {
+ if (!arguments.length) return radius;
+ radius = d3_functor(v);
+ return chord;
+ };
+ chord.source = function(v) {
+ if (!arguments.length) return source;
+ source = d3_functor(v);
+ return chord;
+ };
+ chord.target = function(v) {
+ if (!arguments.length) return target;
+ target = d3_functor(v);
+ return chord;
+ };
+ chord.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return chord;
+ };
+ chord.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return chord;
+ };
+ return chord;
+ };
+ function d3_svg_chordRadius(d) {
+ return d.radius;
+ }
+ d3.svg.diagonal = function() {
+ var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection;
+ function diagonal(d, i) {
+ var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
+ x: p0.x,
+ y: m
+ }, {
+ x: p3.x,
+ y: m
+ }, p3 ];
+ p = p.map(projection);
+ return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
+ }
+ diagonal.source = function(x) {
+ if (!arguments.length) return source;
+ source = d3_functor(x);
+ return diagonal;
+ };
+ diagonal.target = function(x) {
+ if (!arguments.length) return target;
+ target = d3_functor(x);
+ return diagonal;
+ };
+ diagonal.projection = function(x) {
+ if (!arguments.length) return projection;
+ projection = x;
+ return diagonal;
+ };
+ return diagonal;
+ };
+ function d3_svg_diagonalProjection(d) {
+ return [ d.x, d.y ];
+ }
+ d3.svg.diagonal.radial = function() {
+ var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;
+ diagonal.projection = function(x) {
+ return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;
+ };
+ return diagonal;
+ };
+ function d3_svg_diagonalRadialProjection(projection) {
+ return function() {
+ var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset;
+ return [ r * Math.cos(a), r * Math.sin(a) ];
+ };
+ }
+ d3.svg.symbol = function() {
+ var type = d3_svg_symbolType, size = d3_svg_symbolSize;
+ function symbol(d, i) {
+ return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));
+ }
+ symbol.type = function(x) {
+ if (!arguments.length) return type;
+ type = d3_functor(x);
+ return symbol;
+ };
+ symbol.size = function(x) {
+ if (!arguments.length) return size;
+ size = d3_functor(x);
+ return symbol;
+ };
+ return symbol;
+ };
+ function d3_svg_symbolSize() {
+ return 64;
+ }
+ function d3_svg_symbolType() {
+ return "circle";
+ }
+ function d3_svg_symbolCircle(size) {
+ var r = Math.sqrt(size / π);
+ return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
+ }
+ var d3_svg_symbols = d3.map({
+ circle: d3_svg_symbolCircle,
+ cross: function(size) {
+ var r = Math.sqrt(size / 5) / 2;
+ return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z";
+ },
+ diamond: function(size) {
+ var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;
+ return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
+ },
+ square: function(size) {
+ var r = Math.sqrt(size) / 2;
+ return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
+ },
+ "triangle-down": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
+ },
+ "triangle-up": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
+ }
+ });
+ d3.svg.symbolTypes = d3_svg_symbols.keys();
+ var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians);
+ function d3_transition(groups, id) {
+ d3_arraySubclass(groups, d3_transitionPrototype);
+ groups.id = id;
+ return groups;
+ }
+ var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit = {
+ ease: d3_ease_cubicInOut,
+ delay: 0,
+ duration: 250
+ };
+ d3_transitionPrototype.call = d3_selectionPrototype.call;
+ d3_transitionPrototype.empty = d3_selectionPrototype.empty;
+ d3_transitionPrototype.node = d3_selectionPrototype.node;
+ d3.transition = function(selection) {
+ return arguments.length ? d3_transitionInheritId ? selection.transition() : selection : d3_selectionRoot.transition();
+ };
+ d3.transition.prototype = d3_transitionPrototype;
+ d3_transitionPrototype.select = function(selector) {
+ var id = this.id, subgroups = [], subgroup, subnode, node;
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i))) {
+ if ("__data__" in node) subnode.__data__ = node.__data__;
+ d3_transitionNode(subnode, i, id, node.__transition__[id]);
+ subgroup.push(subnode);
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_transition(subgroups, id);
+ };
+ d3_transitionPrototype.selectAll = function(selector) {
+ var id = this.id, subgroups = [], subgroup, subnodes, node, subnode, transition;
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ transition = node.__transition__[id];
+ subnodes = selector.call(node, node.__data__, i);
+ subgroups.push(subgroup = []);
+ for (var k = -1, o = subnodes.length; ++k < o; ) {
+ d3_transitionNode(subnode = subnodes[k], k, id, transition);
+ subgroup.push(subnode);
+ }
+ }
+ }
+ }
+ return d3_transition(subgroups, id);
+ };
+ d3_transitionPrototype.filter = function(filter) {
+ var subgroups = [], subgroup, group, node;
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ if ((node = group[i]) && filter.call(node, node.__data__, i)) {
+ subgroup.push(node);
+ }
+ }
+ }
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+ };
+ d3_transitionPrototype.tween = function(name, tween) {
+ var id = this.id;
+ if (arguments.length < 2) return this.node().__transition__[id].tween.get(name);
+ return d3_selection_each(this, tween == null ? function(node) {
+ node.__transition__[id].tween.remove(name);
+ } : function(node) {
+ node.__transition__[id].tween.set(name, tween);
+ });
+ };
+ function d3_transition_tween(groups, name, value, tween) {
+ var id = groups.id;
+ return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) {
+ node.__transition__[id].tween.set(name, tween(value.call(node, node.__data__, i, j)));
+ } : (value = tween(value), function(node) {
+ node.__transition__[id].tween.set(name, value);
+ }));
+ }
+ d3_transitionPrototype.attr = function(nameNS, value) {
+ if (arguments.length < 2) {
+ for (value in nameNS) this.attr(value, nameNS[value]);
+ return this;
+ }
+ var interpolate = d3_interpolateByName(nameNS), name = d3.ns.qualify(nameNS);
+ function attrNull() {
+ this.removeAttribute(name);
+ }
+ function attrNullNS() {
+ this.removeAttributeNS(name.space, name.local);
+ }
+ return d3_transition_tween(this, "attr." + nameNS, value, function(b) {
+ function attrString() {
+ var a = this.getAttribute(name), i;
+ return a !== b && (i = interpolate(a, b), function(t) {
+ this.setAttribute(name, i(t));
+ });
+ }
+ function attrStringNS() {
+ var a = this.getAttributeNS(name.space, name.local), i;
+ return a !== b && (i = interpolate(a, b), function(t) {
+ this.setAttributeNS(name.space, name.local, i(t));
+ });
+ }
+ return b == null ? name.local ? attrNullNS : attrNull : (b += "", name.local ? attrStringNS : attrString);
+ });
+ };
+ d3_transitionPrototype.attrTween = function(nameNS, tween) {
+ var name = d3.ns.qualify(nameNS);
+ function attrTween(d, i) {
+ var f = tween.call(this, d, i, this.getAttribute(name));
+ return f && function(t) {
+ this.setAttribute(name, f(t));
+ };
+ }
+ function attrTweenNS(d, i) {
+ var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
+ return f && function(t) {
+ this.setAttributeNS(name.space, name.local, f(t));
+ };
+ }
+ return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
+ };
+ d3_transitionPrototype.style = function(name, value, priority) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof name !== "string") {
+ if (n < 2) value = "";
+ for (priority in name) this.style(priority, name[priority], value);
+ return this;
+ }
+ priority = "";
+ }
+ var interpolate = d3_interpolateByName(name);
+ function styleNull() {
+ this.style.removeProperty(name);
+ }
+ return d3_transition_tween(this, "style." + name, value, function(b) {
+ function styleString() {
+ var a = d3_window.getComputedStyle(this, null).getPropertyValue(name), i;
+ return a !== b && (i = interpolate(a, b), function(t) {
+ this.style.setProperty(name, i(t), priority);
+ });
+ }
+ return b == null ? styleNull : (b += "", styleString);
+ });
+ };
+ d3_transitionPrototype.styleTween = function(name, tween, priority) {
+ if (arguments.length < 3) priority = "";
+ return this.tween("style." + name, function(d, i) {
+ var f = tween.call(this, d, i, d3_window.getComputedStyle(this, null).getPropertyValue(name));
+ return f && function(t) {
+ this.style.setProperty(name, f(t), priority);
+ };
+ });
+ };
+ d3_transitionPrototype.text = function(value) {
+ return d3_transition_tween(this, "text", value, d3_transition_text);
+ };
+ function d3_transition_text(b) {
+ if (b == null) b = "";
+ return function() {
+ this.textContent = b;
+ };
+ }
+ d3_transitionPrototype.remove = function() {
+ return this.each("end.transition", function() {
+ var p;
+ if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
+ });
+ };
+ d3_transitionPrototype.ease = function(value) {
+ var id = this.id;
+ if (arguments.length < 1) return this.node().__transition__[id].ease;
+ if (typeof value !== "function") value = d3.ease.apply(d3, arguments);
+ return d3_selection_each(this, function(node) {
+ node.__transition__[id].ease = value;
+ });
+ };
+ d3_transitionPrototype.delay = function(value) {
+ var id = this.id;
+ return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
+ node.__transition__[id].delay = value.call(node, node.__data__, i, j) | 0;
+ } : (value |= 0, function(node) {
+ node.__transition__[id].delay = value;
+ }));
+ };
+ d3_transitionPrototype.duration = function(value) {
+ var id = this.id;
+ return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
+ node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j) | 0);
+ } : (value = Math.max(1, value | 0), function(node) {
+ node.__transition__[id].duration = value;
+ }));
+ };
+ d3_transitionPrototype.each = function(type, listener) {
+ var id = this.id;
+ if (arguments.length < 2) {
+ var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId;
+ d3_transitionInheritId = id;
+ d3_selection_each(this, function(node, i, j) {
+ d3_transitionInherit = node.__transition__[id];
+ type.call(node, node.__data__, i, j);
+ });
+ d3_transitionInherit = inherit;
+ d3_transitionInheritId = inheritId;
+ } else {
+ d3_selection_each(this, function(node) {
+ node.__transition__[id].event.on(type, listener);
+ });
+ }
+ return this;
+ };
+ d3_transitionPrototype.transition = function() {
+ var id0 = this.id, id1 = ++d3_transitionId, subgroups = [], subgroup, group, node, transition;
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ if (node = group[i]) {
+ transition = Object.create(node.__transition__[id0]);
+ transition.delay += transition.duration;
+ d3_transitionNode(node, i, id1, transition);
+ }
+ subgroup.push(node);
+ }
+ }
+ return d3_transition(subgroups, id1);
+ };
+ function d3_transitionNode(node, i, id, inherit) {
+ var lock = node.__transition__ || (node.__transition__ = {
+ active: 0,
+ count: 0
+ }), transition = lock[id];
+ if (!transition) {
+ var time = inherit.time;
+ transition = lock[id] = {
+ tween: new d3_Map(),
+ event: d3.dispatch("start", "end"),
+ time: time,
+ ease: inherit.ease,
+ delay: inherit.delay,
+ duration: inherit.duration
+ };
+ ++lock.count;
+ d3.timer(function(elapsed) {
+ var d = node.__data__, ease = transition.ease, event = transition.event, delay = transition.delay, duration = transition.duration, tweened = [];
+ return delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time), 1;
+ function start(elapsed) {
+ if (lock.active > id) return stop();
+ lock.active = id;
+ event.start.call(node, d, i);
+ transition.tween.forEach(function(key, value) {
+ if (value = value.call(node, d, i)) {
+ tweened.push(value);
+ }
+ });
+ if (!tick(elapsed)) d3.timer(tick, 0, time);
+ return 1;
+ }
+ function tick(elapsed) {
+ if (lock.active !== id) return stop();
+ var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length;
+ while (n > 0) {
+ tweened[--n].call(node, e);
+ }
+ if (t >= 1) {
+ stop();
+ event.end.call(node, d, i);
+ return 1;
+ }
+ }
+ function stop() {
+ if (--lock.count) delete lock[id]; else delete node.__transition__;
+ return 1;
+ }
+ }, 0, time);
+ return transition;
+ }
+ }
+ d3.svg.axis = function() {
+ var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0;
+ function axis(g) {
+ g.each(function() {
+ var g = d3.select(this);
+ var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_;
+ var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".tick.minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", ".tick").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1);
+ var tick = g.selectAll(".tick.major").data(ticks, String), tickEnter = tick.enter().insert("g", "path").attr("class", "tick major").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform;
+ var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"),
+ d3.transition(path));
+ var scale1 = scale.copy(), scale0 = this.__chart__ || scale1;
+ this.__chart__ = scale1;
+ tickEnter.append("line");
+ tickEnter.append("text");
+ var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
+ switch (orient) {
+ case "bottom":
+ {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
+ lineEnter.attr("y2", tickMajorSize);
+ textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding);
+ lineUpdate.attr("x2", 0).attr("y2", tickMajorSize);
+ textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding);
+ text.attr("dy", ".71em").style("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
+ break;
+ }
+
+ case "top":
+ {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", -tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
+ lineEnter.attr("y2", -tickMajorSize);
+ textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
+ lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize);
+ textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
+ text.attr("dy", "0em").style("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
+ break;
+ }
+
+ case "left":
+ {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", -tickMinorSize);
+ subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
+ lineEnter.attr("x2", -tickMajorSize);
+ textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
+ lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0);
+ textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0);
+ text.attr("dy", ".32em").style("text-anchor", "end");
+ pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
+ break;
+ }
+
+ case "right":
+ {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", tickMinorSize);
+ subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
+ lineEnter.attr("x2", tickMajorSize);
+ textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding);
+ lineUpdate.attr("x2", tickMajorSize).attr("y2", 0);
+ textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0);
+ text.attr("dy", ".32em").style("text-anchor", "start");
+ pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
+ break;
+ }
+ }
+ if (scale.ticks) {
+ tickEnter.call(tickTransform, scale0);
+ tickUpdate.call(tickTransform, scale1);
+ tickExit.call(tickTransform, scale1);
+ subtickEnter.call(tickTransform, scale0);
+ subtickUpdate.call(tickTransform, scale1);
+ subtickExit.call(tickTransform, scale1);
+ } else {
+ var dx = scale1.rangeBand() / 2, x = function(d) {
+ return scale1(d) + dx;
+ };
+ tickEnter.call(tickTransform, x);
+ tickUpdate.call(tickTransform, x);
+ }
+ });
+ }
+ axis.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = x;
+ return axis;
+ };
+ axis.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient;
+ return axis;
+ };
+ axis.ticks = function() {
+ if (!arguments.length) return tickArguments_;
+ tickArguments_ = arguments;
+ return axis;
+ };
+ axis.tickValues = function(x) {
+ if (!arguments.length) return tickValues;
+ tickValues = x;
+ return axis;
+ };
+ axis.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat_;
+ tickFormat_ = x;
+ return axis;
+ };
+ axis.tickSize = function(x, y) {
+ if (!arguments.length) return tickMajorSize;
+ var n = arguments.length - 1;
+ tickMajorSize = +x;
+ tickMinorSize = n > 1 ? +y : tickMajorSize;
+ tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
+ return axis;
+ };
+ axis.tickPadding = function(x) {
+ if (!arguments.length) return tickPadding;
+ tickPadding = +x;
+ return axis;
+ };
+ axis.tickSubdivide = function(x) {
+ if (!arguments.length) return tickSubdivide;
+ tickSubdivide = +x;
+ return axis;
+ };
+ return axis;
+ };
+ var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = {
+ top: 1,
+ right: 1,
+ bottom: 1,
+ left: 1
+ };
+ function d3_svg_axisX(selection, x) {
+ selection.attr("transform", function(d) {
+ return "translate(" + x(d) + ",0)";
+ });
+ }
+ function d3_svg_axisY(selection, y) {
+ selection.attr("transform", function(d) {
+ return "translate(0," + y(d) + ")";
+ });
+ }
+ function d3_svg_axisSubdivide(scale, ticks, m) {
+ subticks = [];
+ if (m && ticks.length > 1) {
+ var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v;
+ while (++i < n) {
+ for (j = m; --j > 0; ) {
+ if ((v = +ticks[i] - j * d) >= extent[0]) {
+ subticks.push(v);
+ }
+ }
+ }
+ for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) {
+ subticks.push(v);
+ }
+ }
+ return subticks;
+ }
+ d3.svg.brush = function() {
+ var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain;
+ function brush(g) {
+ g.each(function() {
+ var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e;
+ g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
+ bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
+ fg.enter().append("rect").attr("class", "extent").style("cursor", "move");
+ tz.enter().append("g").attr("class", function(d) {
+ return "resize " + d;
+ }).style("cursor", function(d) {
+ return d3_svg_brushCursor[d];
+ }).append("rect").attr("x", function(d) {
+ return /[ew]$/.test(d) ? -3 : null;
+ }).attr("y", function(d) {
+ return /^[ns]/.test(d) ? -3 : null;
+ }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
+ tz.style("display", brush.empty() ? "none" : null);
+ tz.exit().remove();
+ if (x) {
+ e = d3_scaleRange(x);
+ bg.attr("x", e[0]).attr("width", e[1] - e[0]);
+ redrawX(g);
+ }
+ if (y) {
+ e = d3_scaleRange(y);
+ bg.attr("y", e[0]).attr("height", e[1] - e[0]);
+ redrawY(g);
+ }
+ redraw(g);
+ });
+ }
+ function redraw(g) {
+ g.selectAll(".resize").attr("transform", function(d) {
+ return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";
+ });
+ }
+ function redrawX(g) {
+ g.select(".extent").attr("x", extent[0][0]);
+ g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);
+ }
+ function redrawY(g) {
+ g.select(".extent").attr("y", extent[0][1]);
+ g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
+ }
+ function brushstart() {
+ var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset;
+ var w = d3.select(d3_window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup);
+ if (dragging) {
+ origin[0] = extent[0][0] - origin[0];
+ origin[1] = extent[0][1] - origin[1];
+ } else if (resizing) {
+ var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);
+ offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ];
+ origin[0] = extent[ex][0];
+ origin[1] = extent[ey][1];
+ } else if (d3.event.altKey) center = origin.slice();
+ g.style("pointer-events", "none").selectAll(".resize").style("display", null);
+ d3.select("body").style("cursor", eventTarget.style("cursor"));
+ event_({
+ type: "brushstart"
+ });
+ brushmove();
+ d3_eventCancel();
+ function mouse() {
+ var touches = d3.event.changedTouches;
+ return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
+ }
+ function keydown() {
+ if (d3.event.keyCode == 32) {
+ if (!dragging) {
+ center = null;
+ origin[0] -= extent[1][0];
+ origin[1] -= extent[1][1];
+ dragging = 2;
+ }
+ d3_eventCancel();
+ }
+ }
+ function keyup() {
+ if (d3.event.keyCode == 32 && dragging == 2) {
+ origin[0] += extent[1][0];
+ origin[1] += extent[1][1];
+ dragging = 0;
+ d3_eventCancel();
+ }
+ }
+ function brushmove() {
+ var point = mouse(), moved = false;
+ if (offset) {
+ point[0] += offset[0];
+ point[1] += offset[1];
+ }
+ if (!dragging) {
+ if (d3.event.altKey) {
+ if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ];
+ origin[0] = extent[+(point[0] < center[0])][0];
+ origin[1] = extent[+(point[1] < center[1])][1];
+ } else center = null;
+ }
+ if (resizingX && move1(point, x, 0)) {
+ redrawX(g);
+ moved = true;
+ }
+ if (resizingY && move1(point, y, 1)) {
+ redrawY(g);
+ moved = true;
+ }
+ if (moved) {
+ redraw(g);
+ event_({
+ type: "brush",
+ mode: dragging ? "move" : "resize"
+ });
+ }
+ }
+ function move1(point, scale, i) {
+ var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max;
+ if (dragging) {
+ r0 -= position;
+ r1 -= size + position;
+ }
+ min = Math.max(r0, Math.min(r1, point[i]));
+ if (dragging) {
+ max = (min += position) + size;
+ } else {
+ if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
+ if (position < min) {
+ max = min;
+ min = position;
+ } else {
+ max = position;
+ }
+ }
+ if (extent[0][i] !== min || extent[1][i] !== max) {
+ extentDomain = null;
+ extent[0][i] = min;
+ extent[1][i] = max;
+ return true;
+ }
+ }
+ function brushend() {
+ brushmove();
+ g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
+ d3.select("body").style("cursor", null);
+ w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null);
+ event_({
+ type: "brushend"
+ });
+ d3_eventCancel();
+ }
+ }
+ brush.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ resizes = d3_svg_brushResizes[!x << 1 | !y];
+ return brush;
+ };
+ brush.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ resizes = d3_svg_brushResizes[!x << 1 | !y];
+ return brush;
+ };
+ brush.extent = function(z) {
+ var x0, x1, y0, y1, t;
+ if (!arguments.length) {
+ z = extentDomain || extent;
+ if (x) {
+ x0 = z[0][0], x1 = z[1][0];
+ if (!extentDomain) {
+ x0 = extent[0][0], x1 = extent[1][0];
+ if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ }
+ }
+ if (y) {
+ y0 = z[0][1], y1 = z[1][1];
+ if (!extentDomain) {
+ y0 = extent[0][1], y1 = extent[1][1];
+ if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ }
+ }
+ return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];
+ }
+ extentDomain = [ [ 0, 0 ], [ 0, 0 ] ];
+ if (x) {
+ x0 = z[0], x1 = z[1];
+ if (y) x0 = x0[0], x1 = x1[0];
+ extentDomain[0][0] = x0, extentDomain[1][0] = x1;
+ if (x.invert) x0 = x(x0), x1 = x(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
+ }
+ if (y) {
+ y0 = z[0], y1 = z[1];
+ if (x) y0 = y0[1], y1 = y1[1];
+ extentDomain[0][1] = y0, extentDomain[1][1] = y1;
+ if (y.invert) y0 = y(y0), y1 = y(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
+ }
+ return brush;
+ };
+ brush.clear = function() {
+ extentDomain = null;
+ extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0;
+ return brush;
+ };
+ brush.empty = function() {
+ return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1];
+ };
+ return d3.rebind(brush, event, "on");
+ };
+ var d3_svg_brushCursor = {
+ n: "ns-resize",
+ e: "ew-resize",
+ s: "ns-resize",
+ w: "ew-resize",
+ nw: "nwse-resize",
+ ne: "nesw-resize",
+ se: "nwse-resize",
+ sw: "nesw-resize"
+ };
+ var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];
+ d3.time = {};
+ var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
+ function d3_time_utc() {
+ this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);
+ }
+ d3_time_utc.prototype = {
+ getDate: function() {
+ return this._.getUTCDate();
+ },
+ getDay: function() {
+ return this._.getUTCDay();
+ },
+ getFullYear: function() {
+ return this._.getUTCFullYear();
+ },
+ getHours: function() {
+ return this._.getUTCHours();
+ },
+ getMilliseconds: function() {
+ return this._.getUTCMilliseconds();
+ },
+ getMinutes: function() {
+ return this._.getUTCMinutes();
+ },
+ getMonth: function() {
+ return this._.getUTCMonth();
+ },
+ getSeconds: function() {
+ return this._.getUTCSeconds();
+ },
+ getTime: function() {
+ return this._.getTime();
+ },
+ getTimezoneOffset: function() {
+ return 0;
+ },
+ valueOf: function() {
+ return this._.valueOf();
+ },
+ setDate: function() {
+ d3_time_prototype.setUTCDate.apply(this._, arguments);
+ },
+ setDay: function() {
+ d3_time_prototype.setUTCDay.apply(this._, arguments);
+ },
+ setFullYear: function() {
+ d3_time_prototype.setUTCFullYear.apply(this._, arguments);
+ },
+ setHours: function() {
+ d3_time_prototype.setUTCHours.apply(this._, arguments);
+ },
+ setMilliseconds: function() {
+ d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);
+ },
+ setMinutes: function() {
+ d3_time_prototype.setUTCMinutes.apply(this._, arguments);
+ },
+ setMonth: function() {
+ d3_time_prototype.setUTCMonth.apply(this._, arguments);
+ },
+ setSeconds: function() {
+ d3_time_prototype.setUTCSeconds.apply(this._, arguments);
+ },
+ setTime: function() {
+ d3_time_prototype.setTime.apply(this._, arguments);
+ }
+ };
+ var d3_time_prototype = Date.prototype;
+ var d3_time_formatDateTime = "%a %b %e %X %Y", d3_time_formatDate = "%m/%d/%Y", d3_time_formatTime = "%H:%M:%S";
+ var d3_time_days = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], d3_time_dayAbbreviations = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
+ function d3_time_interval(local, step, number) {
+ function round(date) {
+ var d0 = local(date), d1 = offset(d0, 1);
+ return date - d0 < d1 - date ? d0 : d1;
+ }
+ function ceil(date) {
+ step(date = local(new d3_time(date - 1)), 1);
+ return date;
+ }
+ function offset(date, k) {
+ step(date = new d3_time(+date), k);
+ return date;
+ }
+ function range(t0, t1, dt) {
+ var time = ceil(t0), times = [];
+ if (dt > 1) {
+ while (time < t1) {
+ if (!(number(time) % dt)) times.push(new Date(+time));
+ step(time, 1);
+ }
+ } else {
+ while (time < t1) times.push(new Date(+time)), step(time, 1);
+ }
+ return times;
+ }
+ function range_utc(t0, t1, dt) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time_utc();
+ utc._ = t0;
+ return range(utc, t1, dt);
+ } finally {
+ d3_time = Date;
+ }
+ }
+ local.floor = local;
+ local.round = round;
+ local.ceil = ceil;
+ local.offset = offset;
+ local.range = range;
+ var utc = local.utc = d3_time_interval_utc(local);
+ utc.floor = utc;
+ utc.round = d3_time_interval_utc(round);
+ utc.ceil = d3_time_interval_utc(ceil);
+ utc.offset = d3_time_interval_utc(offset);
+ utc.range = range_utc;
+ return local;
+ }
+ function d3_time_interval_utc(method) {
+ return function(date, k) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time_utc();
+ utc._ = date;
+ return method(utc, k)._;
+ } finally {
+ d3_time = Date;
+ }
+ };
+ }
+ d3.time.year = d3_time_interval(function(date) {
+ date = d3.time.day(date);
+ date.setMonth(0, 1);
+ return date;
+ }, function(date, offset) {
+ date.setFullYear(date.getFullYear() + offset);
+ }, function(date) {
+ return date.getFullYear();
+ });
+ d3.time.years = d3.time.year.range;
+ d3.time.years.utc = d3.time.year.utc.range;
+ d3.time.day = d3_time_interval(function(date) {
+ var day = new d3_time(1970, 0);
+ day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
+ return day;
+ }, function(date, offset) {
+ date.setDate(date.getDate() + offset);
+ }, function(date) {
+ return date.getDate() - 1;
+ });
+ d3.time.days = d3.time.day.range;
+ d3.time.days.utc = d3.time.day.utc.range;
+ d3.time.dayOfYear = function(date) {
+ var year = d3.time.year(date);
+ return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
+ };
+ d3_time_daySymbols.forEach(function(day, i) {
+ day = day.toLowerCase();
+ i = 7 - i;
+ var interval = d3.time[day] = d3_time_interval(function(date) {
+ (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
+ return date;
+ }, function(date, offset) {
+ date.setDate(date.getDate() + Math.floor(offset) * 7);
+ }, function(date) {
+ var day = d3.time.year(date).getDay();
+ return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
+ });
+ d3.time[day + "s"] = interval.range;
+ d3.time[day + "s"].utc = interval.utc.range;
+ d3.time[day + "OfYear"] = function(date) {
+ var day = d3.time.year(date).getDay();
+ return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7);
+ };
+ });
+ d3.time.week = d3.time.sunday;
+ d3.time.weeks = d3.time.sunday.range;
+ d3.time.weeks.utc = d3.time.sunday.utc.range;
+ d3.time.weekOfYear = d3.time.sundayOfYear;
+ d3.time.format = function(template) {
+ var n = template.length;
+ function format(date) {
+ var string = [], i = -1, j = 0, c, p, f;
+ while (++i < n) {
+ if (template.charCodeAt(i) === 37) {
+ string.push(template.substring(j, i));
+ if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i);
+ if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p);
+ string.push(c);
+ j = i + 1;
+ }
+ }
+ string.push(template.substring(j, i));
+ return string.join("");
+ }
+ format.parse = function(string) {
+ var d = {
+ y: 1900,
+ m: 0,
+ d: 1,
+ H: 0,
+ M: 0,
+ S: 0,
+ L: 0
+ }, i = d3_time_parse(d, template, string, 0);
+ if (i != string.length) return null;
+ if ("p" in d) d.H = d.H % 12 + d.p * 12;
+ var date = new d3_time();
+ date.setFullYear(d.y, d.m, d.d);
+ date.setHours(d.H, d.M, d.S, d.L);
+ return date;
+ };
+ format.toString = function() {
+ return template;
+ };
+ return format;
+ };
+ function d3_time_parse(date, template, string, j) {
+ var c, p, i = 0, n = template.length, m = string.length;
+ while (i < n) {
+ if (j >= m) return -1;
+ c = template.charCodeAt(i++);
+ if (c === 37) {
+ p = d3_time_parsers[template.charAt(i++)];
+ if (!p || (j = p(date, string, j)) < 0) return -1;
+ } else if (c != string.charCodeAt(j++)) {
+ return -1;
+ }
+ }
+ return j;
+ }
+ function d3_time_formatRe(names) {
+ return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i");
+ }
+ function d3_time_formatLookup(names) {
+ var map = new d3_Map(), i = -1, n = names.length;
+ while (++i < n) map.set(names[i].toLowerCase(), i);
+ return map;
+ }
+ function d3_time_formatPad(value, fill, width) {
+ value += "";
+ var length = value.length;
+ return length < width ? new Array(width - length + 1).join(fill) + value : value;
+ }
+ var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations);
+ var d3_time_formatPads = {
+ "-": "",
+ _: " ",
+ "0": "0"
+ };
+ var d3_time_formats = {
+ a: function(d) {
+ return d3_time_dayAbbreviations[d.getDay()];
+ },
+ A: function(d) {
+ return d3_time_days[d.getDay()];
+ },
+ b: function(d) {
+ return d3_time_monthAbbreviations[d.getMonth()];
+ },
+ B: function(d) {
+ return d3_time_months[d.getMonth()];
+ },
+ c: d3.time.format(d3_time_formatDateTime),
+ d: function(d, p) {
+ return d3_time_formatPad(d.getDate(), p, 2);
+ },
+ e: function(d, p) {
+ return d3_time_formatPad(d.getDate(), p, 2);
+ },
+ H: function(d, p) {
+ return d3_time_formatPad(d.getHours(), p, 2);
+ },
+ I: function(d, p) {
+ return d3_time_formatPad(d.getHours() % 12 || 12, p, 2);
+ },
+ j: function(d, p) {
+ return d3_time_formatPad(1 + d3.time.dayOfYear(d), p, 3);
+ },
+ L: function(d, p) {
+ return d3_time_formatPad(d.getMilliseconds(), p, 3);
+ },
+ m: function(d, p) {
+ return d3_time_formatPad(d.getMonth() + 1, p, 2);
+ },
+ M: function(d, p) {
+ return d3_time_formatPad(d.getMinutes(), p, 2);
+ },
+ p: function(d) {
+ return d.getHours() >= 12 ? "PM" : "AM";
+ },
+ S: function(d, p) {
+ return d3_time_formatPad(d.getSeconds(), p, 2);
+ },
+ U: function(d, p) {
+ return d3_time_formatPad(d3.time.sundayOfYear(d), p, 2);
+ },
+ w: function(d) {
+ return d.getDay();
+ },
+ W: function(d, p) {
+ return d3_time_formatPad(d3.time.mondayOfYear(d), p, 2);
+ },
+ x: d3.time.format(d3_time_formatDate),
+ X: d3.time.format(d3_time_formatTime),
+ y: function(d, p) {
+ return d3_time_formatPad(d.getFullYear() % 100, p, 2);
+ },
+ Y: function(d, p) {
+ return d3_time_formatPad(d.getFullYear() % 1e4, p, 4);
+ },
+ Z: d3_time_zone,
+ "%": function() {
+ return "%";
+ }
+ };
+ var d3_time_parsers = {
+ a: d3_time_parseWeekdayAbbrev,
+ A: d3_time_parseWeekday,
+ b: d3_time_parseMonthAbbrev,
+ B: d3_time_parseMonth,
+ c: d3_time_parseLocaleFull,
+ d: d3_time_parseDay,
+ e: d3_time_parseDay,
+ H: d3_time_parseHour24,
+ I: d3_time_parseHour24,
+ L: d3_time_parseMilliseconds,
+ m: d3_time_parseMonthNumber,
+ M: d3_time_parseMinutes,
+ p: d3_time_parseAmPm,
+ S: d3_time_parseSeconds,
+ x: d3_time_parseLocaleDate,
+ X: d3_time_parseLocaleTime,
+ y: d3_time_parseYear,
+ Y: d3_time_parseFullYear
+ };
+ function d3_time_parseWeekdayAbbrev(date, string, i) {
+ d3_time_dayAbbrevRe.lastIndex = 0;
+ var n = d3_time_dayAbbrevRe.exec(string.substring(i));
+ return n ? i += n[0].length : -1;
+ }
+ function d3_time_parseWeekday(date, string, i) {
+ d3_time_dayRe.lastIndex = 0;
+ var n = d3_time_dayRe.exec(string.substring(i));
+ return n ? i += n[0].length : -1;
+ }
+ function d3_time_parseMonthAbbrev(date, string, i) {
+ d3_time_monthAbbrevRe.lastIndex = 0;
+ var n = d3_time_monthAbbrevRe.exec(string.substring(i));
+ return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
+ }
+ function d3_time_parseMonth(date, string, i) {
+ d3_time_monthRe.lastIndex = 0;
+ var n = d3_time_monthRe.exec(string.substring(i));
+ return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
+ }
+ function d3_time_parseLocaleFull(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
+ }
+ function d3_time_parseLocaleDate(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
+ }
+ function d3_time_parseLocaleTime(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
+ }
+ function d3_time_parseFullYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 4));
+ return n ? (date.y = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1;
+ }
+ function d3_time_expandYear(d) {
+ return d + (d > 68 ? 1900 : 2e3);
+ }
+ function d3_time_parseMonthNumber(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.m = n[0] - 1, i += n[0].length) : -1;
+ }
+ function d3_time_parseDay(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.d = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseHour24(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.H = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseMinutes(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.M = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseSeconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.S = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseMilliseconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 3));
+ return n ? (date.L = +n[0], i += n[0].length) : -1;
+ }
+ var d3_time_numberRe = /^\s*\d+/;
+ function d3_time_parseAmPm(date, string, i) {
+ var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
+ return n == null ? -1 : (date.p = n, i);
+ }
+ var d3_time_amPmLookup = d3.map({
+ am: 0,
+ pm: 1
+ });
+ function d3_time_zone(d) {
+ var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60;
+ return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2);
+ }
+ d3.time.format.utc = function(template) {
+ var local = d3.time.format(template);
+ function format(date) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time();
+ utc._ = date;
+ return local(utc);
+ } finally {
+ d3_time = Date;
+ }
+ }
+ format.parse = function(string) {
+ try {
+ d3_time = d3_time_utc;
+ var date = local.parse(string);
+ return date && date._;
+ } finally {
+ d3_time = Date;
+ }
+ };
+ format.toString = local.toString;
+ return format;
+ };
+ var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
+ d3.time.format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso;
+ function d3_time_formatIsoNative(date) {
+ return date.toISOString();
+ }
+ d3_time_formatIsoNative.parse = function(string) {
+ var date = new Date(string);
+ return isNaN(date) ? null : date;
+ };
+ d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
+ d3.time.second = d3_time_interval(function(date) {
+ return new d3_time(Math.floor(date / 1e3) * 1e3);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 1e3);
+ }, function(date) {
+ return date.getSeconds();
+ });
+ d3.time.seconds = d3.time.second.range;
+ d3.time.seconds.utc = d3.time.second.utc.range;
+ d3.time.minute = d3_time_interval(function(date) {
+ return new d3_time(Math.floor(date / 6e4) * 6e4);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 6e4);
+ }, function(date) {
+ return date.getMinutes();
+ });
+ d3.time.minutes = d3.time.minute.range;
+ d3.time.minutes.utc = d3.time.minute.utc.range;
+ d3.time.hour = d3_time_interval(function(date) {
+ var timezone = date.getTimezoneOffset() / 60;
+ return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 36e5);
+ }, function(date) {
+ return date.getHours();
+ });
+ d3.time.hours = d3.time.hour.range;
+ d3.time.hours.utc = d3.time.hour.utc.range;
+ d3.time.month = d3_time_interval(function(date) {
+ date = d3.time.day(date);
+ date.setDate(1);
+ return date;
+ }, function(date, offset) {
+ date.setMonth(date.getMonth() + offset);
+ }, function(date) {
+ return date.getMonth();
+ });
+ d3.time.months = d3.time.month.range;
+ d3.time.months.utc = d3.time.month.utc.range;
+ function d3_time_scale(linear, methods, format) {
+ function scale(x) {
+ return linear(x);
+ }
+ scale.invert = function(x) {
+ return d3_time_scaleDate(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
+ linear.domain(x);
+ return scale;
+ };
+ scale.nice = function(m) {
+ return scale.domain(d3_scale_nice(scale.domain(), function() {
+ return m;
+ }));
+ };
+ scale.ticks = function(m, k) {
+ var extent = d3_time_scaleExtent(scale.domain());
+ if (typeof m !== "function") {
+ var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target);
+ if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
+ if (!i) return linear.ticks(m).map(d3_time_scaleDate);
+ if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
+ m = methods[i];
+ k = m[1];
+ m = m[0].range;
+ }
+ return m(extent[0], new Date(+extent[1] + 1), k);
+ };
+ scale.tickFormat = function() {
+ return format;
+ };
+ scale.copy = function() {
+ return d3_time_scale(linear.copy(), methods, format);
+ };
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+ }
+ function d3_time_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [ start, stop ] : [ stop, start ];
+ }
+ function d3_time_scaleDate(t) {
+ return new Date(t);
+ }
+ function d3_time_scaleFormat(formats) {
+ return function(date) {
+ var i = formats.length - 1, f = formats[i];
+ while (!f[1](date)) f = formats[--i];
+ return f[0](date);
+ };
+ }
+ function d3_time_scaleSetYear(y) {
+ var d = new Date(y, 0, 1);
+ d.setFullYear(y);
+ return d;
+ }
+ function d3_time_scaleGetYear(d) {
+ var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1);
+ return y + (d - d0) / (d1 - d0);
+ }
+ var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];
+ var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ];
+ var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), d3_true ], [ d3.time.format("%B"), function(d) {
+ return d.getMonth();
+ } ], [ d3.time.format("%b %d"), function(d) {
+ return d.getDate() != 1;
+ } ], [ d3.time.format("%a %d"), function(d) {
+ return d.getDay() && d.getDate() != 1;
+ } ], [ d3.time.format("%I %p"), function(d) {
+ return d.getHours();
+ } ], [ d3.time.format("%I:%M"), function(d) {
+ return d.getMinutes();
+ } ], [ d3.time.format(":%S"), function(d) {
+ return d.getSeconds();
+ } ], [ d3.time.format(".%L"), function(d) {
+ return d.getMilliseconds();
+ } ] ];
+ var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
+ d3_time_scaleLocalMethods.year = function(extent, m) {
+ return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);
+ };
+ d3.time.scale = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
+ };
+ var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
+ return [ m[0].utc, m[1] ];
+ });
+ var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), d3_true ], [ d3.time.format.utc("%B"), function(d) {
+ return d.getUTCMonth();
+ } ], [ d3.time.format.utc("%b %d"), function(d) {
+ return d.getUTCDate() != 1;
+ } ], [ d3.time.format.utc("%a %d"), function(d) {
+ return d.getUTCDay() && d.getUTCDate() != 1;
+ } ], [ d3.time.format.utc("%I %p"), function(d) {
+ return d.getUTCHours();
+ } ], [ d3.time.format.utc("%I:%M"), function(d) {
+ return d.getUTCMinutes();
+ } ], [ d3.time.format.utc(":%S"), function(d) {
+ return d.getUTCSeconds();
+ } ], [ d3.time.format.utc(".%L"), function(d) {
+ return d.getUTCMilliseconds();
+ } ] ];
+ var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
+ function d3_time_scaleUTCSetYear(y) {
+ var d = new Date(Date.UTC(y, 0, 1));
+ d.setUTCFullYear(y);
+ return d;
+ }
+ function d3_time_scaleUTCGetYear(d) {
+ var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1);
+ return y + (d - d0) / (d1 - d0);
+ }
+ d3_time_scaleUTCMethods.year = function(extent, m) {
+ return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);
+ };
+ d3.time.scale.utc = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
+ };
+ d3.text = function() {
+ return d3.xhr.apply(d3, arguments).response(d3_text);
+ };
+ function d3_text(request) {
+ return request.responseText;
+ }
+ d3.json = function(url, callback) {
+ return d3.xhr(url, "application/json", callback).response(d3_json);
+ };
+ function d3_json(request) {
+ return JSON.parse(request.responseText);
+ }
+ d3.html = function(url, callback) {
+ return d3.xhr(url, "text/html", callback).response(d3_html);
+ };
+ function d3_html(request) {
+ var range = d3_document.createRange();
+ range.selectNode(d3_document.body);
+ return range.createContextualFragment(request.responseText);
+ }
+ d3.xml = function() {
+ return d3.xhr.apply(d3, arguments).response(d3_xml);
+ };
+ function d3_xml(request) {
+ return request.responseXML;
+ }
+ return d3;
+}(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.min.js
new file mode 100644
index 00000000..7975878f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.min.js
@@ -0,0 +1 @@
+d3=function(){function o(e){return e!=null&&!isNaN(e)}function a(e){return e.length}function f(e){var t=1;while(e*t%1)t*=10;return t}function l(e,t){try{for(var n in t){Object.defineProperty(e.prototype,n,{value:t[n],enumerable:false})}}catch(r){e.prototype=t}}function c(){}function d(){}function v(e,t,n){return function(){var r=n.apply(t,arguments);return r===t?e:r}}function m(){}function g(e){function r(){var n=t,r=-1,i=n.length,s;while(++r<i)if(s=n[r].on)s.apply(this,arguments);return e}var t=[],n=new c;r.on=function(r,i){var s=n.get(r),o;if(arguments.length<2)return s&&s.on;if(s){s.on=null;t=t.slice(0,o=t.indexOf(s)).concat(t.slice(o+1));n.remove(r)}if(i)t.push(n.set(r,{on:i}));return e};return r}function y(){e.event.stopPropagation();e.event.preventDefault()}function w(){var t=e.event,n;while(n=t.sourceEvent)t=n;return t}function E(e,t){function n(){e.on(t,null)}e.on(t,function(){y();n()},true);setTimeout(n,0)}function S(t){var n=new m,r=0,i=arguments.length;while(++r<i)n[arguments[r]]=g(n);n.of=function(r,i){return function(s){try{var o=s.sourceEvent=e.event;s.target=t;e.event=s;n[s.type].apply(r,i)}finally{e.event=o}}};return n}function T(r,i){var s=r.ownerSVGElement||r;if(s.createSVGPoint){var o=s.createSVGPoint();if(x<0&&(n.scrollX||n.scrollY)){s=e.select(t.body).append("svg").style("position","absolute").style("top",0).style("left",0);var u=s[0][0].getScreenCTM();x=!(u.f||u.e);s.remove()}if(x){o.x=i.pageX;o.y=i.pageY}else{o.x=i.clientX;o.y=i.clientY}o=o.matrixTransform(r.getScreenCTM().inverse());return[o.x,o.y]}var a=r.getBoundingClientRect();return[i.clientX-a.left-r.clientLeft,i.clientY-a.top-r.clientTop]}function C(e){var t=-1,n=e.length,r=[];while(++t<n)r.push(e[t]);return r}function k(e){return Array.prototype.slice.call(e)}function O(e){A(e,B);return e}function j(e){return function(){return M(e,this)}}function F(e){return function(){return _(e,this)}}function q(t,n){function r(){this.removeAttribute(t)}function i(){this.removeAttributeNS(t.space,t.local)}function s(){this.setAttribute(t,n)}function o(){this.setAttributeNS(t.space,t.local,n)}function u(){var e=n.apply(this,arguments);if(e==null)this.removeAttribute(t);else this.setAttribute(t,e)}function a(){var e=n.apply(this,arguments);if(e==null)this.removeAttributeNS(t.space,t.local);else this.setAttributeNS(t.space,t.local,e)}t=e.ns.qualify(t);return n==null?t.local?i:r:typeof n==="function"?t.local?a:u:t.local?o:s}function R(e){return e.trim().replace(/\s+/g," ")}function z(t){return new RegExp("(?:^|\\s+)"+e.requote(t)+"(?:\\s+|$)","g")}function W(e,t){function r(){var r=-1;while(++r<n)e[r](this,t)}function i(){var r=-1,i=t.apply(this,arguments);while(++r<n)e[r](this,i)}e=e.trim().split(/\s+/).map(X);var n=e.length;return typeof t==="function"?i:r}function X(e){var t=z(e);return function(n,r){if(i=n.classList)return r?i.add(e):i.remove(e);var i=n.getAttribute("class")||"";if(r){t.lastIndex=0;if(!t.test(i))n.setAttribute("class",R(i+" "+e))}else{n.setAttribute("class",R(i.replace(t," ")))}}}function V(e,t,n){function r(){this.style.removeProperty(e)}function i(){this.style.setProperty(e,t,n)}function s(){var r=t.apply(this,arguments);if(r==null)this.style.removeProperty(e);else this.style.setProperty(e,r,n)}return t==null?r:typeof t==="function"?s:i}function $(e,t){function n(){delete this[e]}function r(){this[e]=t}function i(){var n=t.apply(this,arguments);if(n==null)delete this[e];else this[e]=n}return t==null?n:typeof t==="function"?i:r}function J(e){return{__data__:e}}function K(e){return function(){return H(this,e)}}function Q(t){if(!arguments.length)t=e.ascending;return function(e,n){return!e-!n||t(e.__data__,n.__data__)}}function G(){}function Y(t,n,r){function a(){var e=this[i];if(e){this.removeEventListener(t,e,e.$);delete this[i]}}function f(){var e=o(n,N(arguments));a.call(this);this.addEventListener(t,this[i]=e,e.$=r);e._=n}function l(){var n=new RegExp("^__on([^.]+)"+e.requote(t)+"$"),r;for(var i in this){if(r=i.match(n)){var s=this[i];this.removeEventListener(r[1],s,s.$);delete this[i]}}}var i="__on"+t,s=t.indexOf("."),o=et;if(s>0)t=t.substring(0,s);var u=Z.get(t);if(u)t=u,o=tt;return s?n?f:a:n?G:l}function et(t,n){return function(r){var i=e.event;e.event=r;n[0]=this.__data__;try{t.apply(this,n)}finally{e.event=i}}}function tt(e,t){var n=et(e,t);return function(e){var t=this,r=e.relatedTarget;if(!r||r!==t&&!(r.compareDocumentPosition(t)&8)){n.call(t,e)}}}function nt(e,t){for(var n=0,r=e.length;n<r;n++){for(var i=e[n],s=0,o=i.length,u;s<o;s++){if(u=i[s])t(u,s,n)}}return e}function rt(e){A(e,it);return e}function ft(){}function lt(e,t,n){return new ct(e,t,n)}function ct(e,t,n){this.h=e;this.s=t;this.l=n}function pt(e,t,n){function s(e){if(e>360)e-=360;else if(e<0)e+=360;if(e<60)return r+(i-r)*e/60;if(e<180)return i;if(e<240)return r+(i-r)*(240-e)/60;return r}function o(e){return Math.round(s(e)*255)}var r,i;e=e%360;if(e<0)e+=360;t=t<0?0:t>1?1:t;n=n<0?0:n>1?1:n;i=n<=.5?n*(1+t):n+t-n*t;r=2*n-i;return qt(o(e+120),o(e),o(e-120))}function yt(e){return e>0?1:e<0?-1:0}function bt(e){return Math.acos(Math.max(-1,Math.min(1,e)))}function wt(e){return e>1?dt/2:e<-1?-dt/2:Math.asin(e)}function Et(e){return(Math.exp(e)-Math.exp(-e))/2}function St(e){return(Math.exp(e)+Math.exp(-e))/2}function xt(e){return(e=Math.sin(e/2))*e}function Tt(e,t,n){return new Nt(e,t,n)}function Nt(e,t,n){this.h=e;this.c=t;this.l=n}function kt(e,t,n){return Lt(n,Math.cos(e*=mt)*t,Math.sin(e)*t)}function Lt(e,t,n){return new At(e,t,n)}function At(e,t,n){this.l=e;this.a=t;this.b=n}function Ht(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;i=jt(i)*Mt;r=jt(r)*_t;s=jt(s)*Dt;return qt(It(3.2404542*i-1.5371385*r-.4985314*s),It(-.969266*i+1.8760108*r+.041556*s),It(.0556434*i-.2040259*r+1.0572252*s))}function Bt(e,t,n){return Tt(Math.atan2(n,t)*gt,Math.sqrt(t*t+n*n),e)}function jt(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function Ft(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function It(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function qt(e,t,n){return new Rt(e,t,n)}function Rt(e,t,n){this.r=e;this.g=t;this.b=n}function zt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function Wt(e,t,n){var r=0,i=0,s=0,o,u,a;o=/([a-z]+)\((.*)\)/i.exec(e);if(o){u=o[2].split(",");switch(o[1]){case"hsl":{return n(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100)};case"rgb":{return t(Jt(u[0]),Jt(u[1]),Jt(u[2]))}}}if(a=Kt.get(e))return t(a.r,a.g,a.b);if(e!=null&&e.charAt(0)==="#"){if(e.length===4){r=e.charAt(1);r+=r;i=e.charAt(2);i+=i;s=e.charAt(3);s+=s}else if(e.length===7){r=e.substring(1,3);i=e.substring(3,5);s=e.substring(5,7)}r=parseInt(r,16);i=parseInt(i,16);s=parseInt(s,16)}return t(r,i,s)}function Xt(e,t,n){var r=Math.min(e/=255,t/=255,n/=255),i=Math.max(e,t,n),s=i-r,o,u,a=(i+r)/2;if(s){u=a<.5?s/(i+r):s/(2-i-r);if(e==i)o=(t-n)/s+(t<n?6:0);else if(t==i)o=(n-e)/s+2;else o=(e-t)/s+4;o*=60}else{u=o=0}return lt(o,u,a)}function Vt(e,t,n){e=$t(e);t=$t(t);n=$t(n);var r=Ft((.4124564*e+.3575761*t+.1804375*n)/Mt),i=Ft((.2126729*e+.7151522*t+.072175*n)/_t),s=Ft((.0193339*e+.119192*t+.9503041*n)/Dt);return Lt(116*i-16,500*(r-i),200*(i-s))}function $t(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Jt(e){var t=parseFloat(e);return e.charAt(e.length-1)==="%"?Math.round(t*2.55):t}function Qt(e){return typeof e==="function"?e:function(){return e}}function Gt(e){return e}function Yt(e){return e.length===1?function(t,n){e(t==null?n:null)}:e}function Zt(t,n){function s(t,r,i){if(arguments.length<3)i=r,r=null;var s=e.xhr(t,n,i);s.row=function(e){return arguments.length?s.response((r=e)==null?o:u(e)):r};return s.row(r)}function o(e){return s.parse(e.responseText)}function u(e){return function(t){return s.parse(t.responseText,e)}}function a(e){return e.map(f).join(t)}function f(e){return r.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var r=new RegExp('["'+t+"\n]"),i=t.charCodeAt(0);s.parse=function(e,t){var n;return s.parseRows(e,function(e,r){if(n)return n(e,r-1);var i=new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}");n=t?function(e,n){return t(i(e),n)}:i})};s.parseRows=function(e,t){function c(){if(u>=o)return r;if(l)return l=false,n;var t=u;if(e.charCodeAt(t)===34){var s=t;while(s++<o){if(e.charCodeAt(s)===34){if(e.charCodeAt(s+1)!==34)break;++s}}u=s+2;var a=e.charCodeAt(s+1);if(a===13){l=true;if(e.charCodeAt(s+2)===10)++u}else if(a===10){l=true}return e.substring(t+1,s).replace(/""/g,'"')}while(u<o){var a=e.charCodeAt(u++),f=1;if(a===10)l=true;else if(a===13){l=true;if(e.charCodeAt(u)===10)++u,++f}else if(a!==i)continue;return e.substring(t,u-f)}return e.substring(t)}var n={},r={},s=[],o=e.length,u=0,a=0,f,l;while((f=c())!==r){var h=[];while(f!==n&&f!==r){h.push(f);f=c()}if(t&&!(h=t(h,a++)))continue;s.push(h)}return s};s.format=function(e){if(Array.isArray(e[0]))return s.formatRows(e);var n=new d,r=[];e.forEach(function(e){for(var t in e){if(!n.has(t)){r.push(n.add(t))}}});return[r.map(f).join(t)].concat(e.map(function(e){return r.map(function(t){return f(e[t])}).join(t)})).join("\n")};s.formatRows=function(e){return e.map(a).join("\n")};return s}function on(){var e,t=Date.now(),n=nn;while(n){e=t-n.then;if(e>=n.delay)n.flush=n.callback(e);n=n.next}var r=un()-t;if(r>24){if(isFinite(r)){clearTimeout(sn);sn=setTimeout(on,r)}rn=0}else{rn=1;an(on)}}function un(){var e=null,t=nn,n=Infinity;while(t){if(t.flush){delete tn[t.callback.id];t=e?e.next=t.next:nn=t.next}else{n=Math.min(n,t.then+t.delay);t=(e=t).next}}return n}function pn(e,t){var n=Math.pow(10,Math.abs(8-t)*3);return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}function mn(e,t){return t-(e?Math.ceil(Math.log(e)/Math.LN10):1)}function gn(e){return e+""}function wn(e,t){if(e&&Sn.hasOwnProperty(e.type)){Sn[e.type](e,t)}}function xn(e,t,n){var r=-1,i=e.length-n,s;t.lineStart();while(++r<i)s=e[r],t.point(s[0],s[1]);t.lineEnd()}function Tn(e,t){var n=-1,r=e.length;t.polygonStart();while(++n<r)xn(e[n],t,1);t.polygonEnd()}function An(){function s(e,t){e*=mt;t=t*mt/2+dt/4;var s=e-n,o=Math.cos(t),u=Math.sin(t),a=i*u,f=Cn,l=kn,c=r*o+a*Math.cos(s),h=a*Math.sin(s);Cn=f*c-l*h;kn=l*c+f*h;n=e,r=o,i=u}var e,t,n,r,i;Ln.point=function(o,u){Ln.point=s;n=(e=o)*mt,r=Math.cos(u=(t=u)*mt/2+dt/4),i=Math.sin(u)};Ln.lineEnd=function(){s(e,t)}}function On(t){function u(e,t){if(e<n)n=e;if(e>i)i=e;if(t<r)r=t;if(t>s)s=t}function a(){o.point=o.lineEnd=G}var n,r,i,s;var o={point:u,lineStart:G,lineEnd:G,polygonStart:function(){o.lineEnd=a},polygonEnd:function(){o.point=u}};return function(u){s=i=-(n=r=Infinity);e.geo.stream(u,t(o));return[[n,r],[i,s]]}}function jn(e,t){if(Mn)return;++_n;e*=mt;var n=Math.cos(t*=mt);Dn+=(n*Math.cos(e)-Dn)/_n;Pn+=(n*Math.sin(e)-Pn)/_n;Hn+=(Math.sin(t)-Hn)/_n}function Fn(){var e,t;Mn=1;In();Mn=2;var n=Bn.point;Bn.point=function(r,i){n(e=r,t=i)};Bn.lineEnd=function(){Bn.point(e,t);qn();Bn.lineEnd=qn}}function In(){function r(r,i){r*=mt;var s=Math.cos(i*=mt),o=s*Math.cos(r),u=s*Math.sin(r),a=Math.sin(i),f=Math.atan2(Math.sqrt((f=t*a-n*u)*f+(f=n*o-e*a)*f+(f=e*u-t*o)*f),e*o+t*u+n*a);_n+=f;Dn+=f*(e+(e=o));Pn+=f*(t+(t=u));Hn+=f*(n+(n=a))}var e,t,n;if(Mn>1)return;if(Mn<1){Mn=1;_n=Dn=Pn=Hn=0}Bn.point=function(i,s){i*=mt;var o=Math.cos(s*=mt);e=o*Math.cos(i);t=o*Math.sin(i);n=Math.sin(s);Bn.point=r}}function qn(){Bn.point=jn}function Rn(e){var t=e[0],n=e[1],r=Math.cos(n);return[r*Math.cos(t),r*Math.sin(t),Math.sin(n)]}function Un(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function zn(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Wn(e,t){e[0]+=t[0];e[1]+=t[1];e[2]+=t[2]}function Xn(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Vn(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t;e[1]/=t;e[2]/=t}function $n(){return true}function Jn(e){return[Math.atan2(e[1],e[0]),Math.asin(Math.max(-1,Math.min(1,e[2])))]}function Kn(e,t){return Math.abs(e[0]-t[0])<vt&&Math.abs(e[1]-t[1])<vt}function Qn(e,t,n,r,i){var s=[],o=[];e.forEach(function(e){if((t=e.length-1)<=0)return;var t,n=e[0],r=e[t];if(Kn(n,r)){i.lineStart();for(var u=0;u<t;++u)i.point((n=e[u])[0],n[1]);i.lineEnd();return}var a={point:n,points:e,other:null,visited:false,entry:true,subject:true},f={point:n,points:[n],other:a,visited:false,entry:false,subject:false};a.other=f;s.push(a);o.push(f);a={point:r,points:[r],other:null,visited:false,entry:false,subject:true};f={point:r,points:[r],other:a,visited:false,entry:true,subject:false};a.other=f;s.push(a);o.push(f)});o.sort(t);Gn(s);Gn(o);if(!s.length)return;if(n)for(var u=1,a=!n(o[0].point),f=o.length;u<f;++u){o[u].entry=a=!a}var l=s[0],c,h,p;while(1){c=l;while(c.visited)if((c=c.next)===l)return;h=c.points;i.lineStart();do{c.visited=c.other.visited=true;if(c.entry){if(c.subject){for(var u=0;u<h.length;u++)i.point((p=h[u])[0],p[1])}else{r(c.point,c.next.point,1,i)}c=c.next}else{if(c.subject){h=c.prev.points;for(var u=h.length;--u>=0;)i.point((p=h[u])[0],p[1])}else{r(c.point,c.prev.point,-1,i)}c=c.prev}c=c.other;h=c.points}while(!c.visited);i.lineEnd()}}function Gn(e){if(!(t=e.length))return;var t,n=0,r=e[0],i;while(++n<t){r.next=i=e[n];i.prev=r;r=i}r.next=i=e[0];i.prev=r}function Yn(t,n,r){return function(i){function u(e,n){if(t(e,n))i.point(e,n)}function a(e,t){s.point(e,t)}function f(){o.point=a;s.lineStart()}function l(){o.point=u;s.lineEnd()}function y(e,t){m.point(e,t);g.push([e,t])}function b(){m.lineStart();g=[]}function w(){y(g[0][0],g[0][1]);m.lineEnd();var e=m.clean(),t=v.buffer(),n,r=t.length;if(!r){d=true;p+=tr(g,-1);g=null;return}g=null;if(e&1){n=t[0];h+=tr(n,1);var r=n.length-1,s=-1,o;i.lineStart();while(++s<r)i.point((o=n[s])[0],o[1]);i.lineEnd();return}if(r>1&&e&2)t.push(t.pop().concat(t.shift()));c.push(t.filter(Zn))}var s=n(i);var o={point:u,lineStart:f,lineEnd:l,polygonStart:function(){o.point=y;o.lineStart=b;o.lineEnd=w;d=false;p=h=0;c=[];i.polygonStart()},polygonEnd:function(){o.point=u;o.lineStart=f;o.lineEnd=l;c=e.merge(c);if(c.length){Qn(c,nr,null,r,i)}else if(h<-vt||d&&p<-vt){i.lineStart();r(null,null,1,i);i.lineEnd()}i.polygonEnd();c=null},sphere:function(){i.polygonStart();i.lineStart();r(null,null,1,i);i.lineEnd();i.polygonEnd()}};var c,h,p,d;var v=er(),m=n(v),g;return o}}function Zn(e){return e.length>1}function er(){var e=[],t;return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:G,buffer:function(){var n=e;e=[];t=null;return n},rejoin:function(){if(e.length>1)e.push(e.pop().concat(e.shift()))}}}function tr(e,t){if(!(n=e.length))return 0;var n,r=0,i=0,s=e[0],o=s[0],u=s[1],a=Math.cos(u),f=Math.atan2(t*Math.sin(o)*a,Math.sin(u)),l=1-t*Math.cos(o)*a,c=f,h,p;while(++r<n){s=e[r];a=Math.cos(u=s[1]);h=Math.atan2(t*Math.sin(o=s[0])*a,Math.sin(u));p=1-t*Math.cos(o)*a;if(Math.abs(l-2)<vt&&Math.abs(p-2)<vt)continue;if(Math.abs(p)<vt||Math.abs(l)<vt){}else if(Math.abs(Math.abs(h-f)-dt)<vt){if(p+l>2)i+=4*(h-f)}else if(Math.abs(l-2)<vt)i+=4*(h-c);else i+=((3*dt+h-f)%(2*dt)-dt)*(l+p);c=f,f=h,l=p}return i}function nr(e,t){return((e=e.point)[0]<0?e[1]-dt/2-vt:dt/2-e[1])-((t=t.point)[0]<0?t[1]-dt/2-vt:dt/2-t[1])}function ir(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart();i=1},point:function(s,o){var u=s>0?dt:-dt,a=Math.abs(s-t);if(Math.abs(a-dt)<vt){e.point(t,n=(n+o)/2>0?dt/2:-dt/2);e.point(r,n);e.lineEnd();e.lineStart();e.point(u,n);e.point(s,n);i=0}else if(r!==u&&a>=dt){if(Math.abs(t-r)<vt)t-=r*vt;if(Math.abs(s-u)<vt)s-=u*vt;n=sr(t,n,s,o);e.point(r,n);e.lineEnd();e.lineStart();e.point(u,n);i=0}e.point(t=s,n=o);r=u},lineEnd:function(){e.lineEnd();t=n=NaN},clean:function(){return 2-i}}}function sr(e,t,n,r){var i,s,o=Math.sin(e-n);return Math.abs(o)>vt?Math.atan((Math.sin(t)*(s=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(t))*Math.sin(e))/(i*s*o)):(t+r)/2}function or(e,t,n,r){var i;if(e==null){i=n*dt/2;r.point(-dt,i);r.point(0,i);r.point(dt,i);r.point(dt,0);r.point(dt,-i);r.point(0,-i);r.point(-dt,-i);r.point(-dt,0);r.point(-dt,i)}else if(Math.abs(e[0]-t[0])>vt){var s=(e[0]<t[0]?1:-1)*dt;i=n*s/2;r.point(-s,i);r.point(0,i);r.point(s,i)}else{r.point(t[0],t[1])}}function ur(e){function s(e,n){return Math.cos(e)*Math.cos(n)>t}function o(e){var t,i,o,f,l;return{lineStart:function(){f=o=false;l=1},point:function(c,h){var p=[c,h],d,v=s(c,h),m=n?v?0:a(c,h):v?a(c+(c<0?dt:-dt),h):0;if(!t&&(f=o=v))e.lineStart();if(v!==o){d=u(t,p);if(Kn(t,d)||Kn(p,d)){p[0]+=vt;p[1]+=vt;v=s(p[0],p[1])}}if(v!==o){l=0;if(v){e.lineStart();d=u(p,t);e.point(d[0],d[1])}else{d=u(t,p);e.point(d[0],d[1]);e.lineEnd()}t=d}else if(r&&t&&n^v){var g;if(!(m&i)&&(g=u(p,t,true))){l=0;if(n){e.lineStart();e.point(g[0][0],g[0][1]);e.point(g[1][0],g[1][1]);e.lineEnd()}else{e.point(g[1][0],g[1][1]);e.lineEnd();e.lineStart();e.point(g[0][0],g[0][1])}}}if(v&&(!t||!Kn(t,p))){e.point(p[0],p[1])}t=p,o=v,i=m},lineEnd:function(){if(o)e.lineEnd();t=null},clean:function(){return l|(f&&o)<<1}}}function u(e,n,r){var i=Rn(e),s=Rn(n);var o=[1,0,0],u=zn(i,s),a=Un(u,u),f=u[0],l=a-f*f;if(!l)return!r&&e;var c=t*a/l,h=-t*f/l,p=zn(o,u),d=Xn(o,c),v=Xn(u,h);Wn(d,v);var m=p,g=Un(d,m),y=Un(m,m),b=g*g-y*(Un(d,d)-1);if(b<0)return;var w=Math.sqrt(b),E=Xn(m,(-g-w)/y);Wn(E,d);E=Jn(E);if(!r)return E;var S=e[0],x=n[0],T=e[1],N=n[1],C;if(x<S)C=S,S=x,x=C;var k=x-S,L=Math.abs(k-dt)<vt,A=L||k<vt;if(!L&&N<T)C=T,T=N,N=C;if(A?L?T+N>0^E[1]<(Math.abs(E[0]-S)<vt?T:N):T<=E[1]&&E[1]<=N:k>dt^(S<=E[0]&&E[0]<=x)){var O=Xn(m,(-g+w)/y);Wn(O,d);return[E,Jn(O)]}}function a(t,r){var i=n?e:dt-e,s=0;if(t<-i)s|=1;else if(t>i)s|=2;if(r<-i)s|=4;else if(r>i)s|=8;return s}var t=Math.cos(e),n=t>0,r=Math.abs(t)>vt,i=Er(e,6*mt);return Yn(s,o,i)}function fr(t,n,r,i){function s(e,i){return Math.abs(e[0]-t)<vt?i>0?0:3:Math.abs(e[0]-r)<vt?i>0?2:1:Math.abs(e[1]-n)<vt?i>0?1:0:i>0?3:2}function o(e,t){return u(e.point,t.point)}function u(e,t){var n=s(e,1),r=s(t,1);return n!==r?n-r:n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]}function a(e,s){var o=s[0]-e[0],u=s[1]-e[1],a=[0,1];if(Math.abs(o)<vt&&Math.abs(u)<vt)return t<=e[0]&&e[0]<=r&&n<=e[1]&&e[1]<=i;if(lr(t-e[0],o,a)&&lr(e[0]-r,-o,a)&&lr(n-e[1],u,a)&&lr(e[1]-i,-u,a)){if(a[1]<1){s[0]=e[0]+a[1]*o;s[1]=e[1]+a[1]*u}if(a[0]>0){e[0]+=a[0]*o;e[1]+=a[0]*u}return true}return false}return function(f){function m(e){var o=s(e,-1),u=g([o===0||o===3?t:r,o>1?i:n]);return u}function g(e){var t=0,n=p.length,r=e[1];for(var i=0;i<n;++i){for(var s=1,o=p[i],u=o.length,a=o[0];s<u;++s){b=o[s];if(a[1]<=r){if(b[1]>r&&y(a,b,e)>0)++t}else{if(b[1]<=r&&y(a,b,e)<0)--t}a=b}}return t!==0}function y(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1])}function w(e,o,a,f){var l=0,c=0;if(e==null||(l=s(e,a))!==(c=s(o,a))||u(e,o)<0^a>0){do{f.point(l===0||l===3?t:r,l>1?i:n)}while((l=(l+a+4)%4)!==c)}else{f.point(o[0],o[1])}}function E(e,s){return t<=e&&e<=r&&n<=s&&s<=i}function S(e,t){if(E(e,t))f.point(e,t)}function O(){v.point=_;if(p)p.push(d=[]);A=true;L=false;C=k=NaN}function M(){if(h){_(x,T);if(N&&L)c.rejoin();h.push(c.buffer())}v.point=S;if(L)f.lineEnd()}function _(e,t){e=Math.max(-ar,Math.min(ar,e));t=Math.max(-ar,Math.min(ar,t));var n=E(e,t);if(p)d.push([e,t]);if(A){x=e,T=t,N=n;A=false;if(n){f.lineStart();f.point(e,t)}}else{if(n&&L)f.point(e,t);else{var r=[C,k],i=[e,t];if(a(r,i)){if(!L){f.lineStart();f.point(r[0],r[1])}f.point(i[0],i[1]);if(!n)f.lineEnd()}else{f.lineStart();f.point(e,t)}}}C=e,k=t,L=n}var l=f,c=er(),h,p,d;var v={point:S,lineStart:O,lineEnd:M,polygonStart:function(){f=c;h=[];p=[]},polygonEnd:function(){f=l;if((h=e.merge(h)).length){f.polygonStart();Qn(h,o,m,w,f);f.polygonEnd()}else if(g([t,n])){f.polygonStart(),f.lineStart();w(null,null,1,f);f.lineEnd(),f.polygonEnd()}h=p=d=null}};var x,T,N,C,k,L,A;return v}}function lr(e,t,n){if(Math.abs(t)<vt)return e<=0;var r=e/t;if(t>0){if(r>n[1])return false;if(r>n[0])n[0]=r}else{if(r<n[0])return false;if(r<n[1])n[1]=r}return true}function cr(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}if(e.invert&&t.invert)n.invert=function(n,r){return n=t.invert(n,r),n&&e.invert(n[0],n[1])};return n}function hr(e){function r(t){function c(n,r){n=e(n,r);t.point(n[0],n[1])}function h(){s=NaN;l.point=p;t.lineStart()}function p(l,c){var h=Rn([l,c]),p=e(l,c);i(s,o,r,u,a,f,s=p[0],o=p[1],r=l,u=h[0],a=h[1],f=h[2],n,t);t.point(s,o)}function d(){l.point=c;t.lineEnd()}function v(){var e,c,v,m,g,y,b;h();l.point=function(t,n){p(e=t,c=n),v=s,m=o,g=u,y=a,b=f;l.point=p};l.lineEnd=function(){i(s,o,r,u,a,f,v,m,e,g,y,b,n,t);l.lineEnd=d;d()}}var r,s,o,u,a,f;var l={point:c,lineStart:h,lineEnd:d,polygonStart:function(){t.polygonStart();l.lineStart=v},polygonEnd:function(){t.polygonEnd();l.lineStart=h}};return l}function i(n,r,s,o,u,a,f,l,c,h,p,d,v,m){var g=f-n,y=l-r,b=g*g+y*y;if(b>4*t&&v--){var w=o+h,E=u+p,S=a+d,x=Math.sqrt(w*w+E*E+S*S),T=Math.asin(S/=x),N=Math.abs(Math.abs(S)-1)<vt?(s+c)/2:Math.atan2(E,w),C=e(N,T),k=C[0],L=C[1],A=k-n,O=L-r,M=y*A-g*O;if(M*M/b>t||Math.abs((g*A+y*O)/b-.5)>.3){i(n,r,s,o,u,a,k,L,N,w/=x,E/=x,S,v,m);m.point(k,L);i(k,L,N,w,E,S,f,l,c,h,p,d,v,m)}}}var t=.5,n=16;r.precision=function(e){if(!arguments.length)return Math.sqrt(t);n=(t=e*e)>0&&16;return r};return r}function pr(e){return dr(function(){return e})()}function dr(t){function w(e){e=i(e[0]*mt,e[1]*mt);return[e[0]*o+d,v-e[1]*o]}function E(e){e=i.invert((e[0]-d)/o,(v-e[1])/o);return e&&[e[0]*gt,e[1]*gt]}function S(){i=cr(r=gr(c,h,p),n);var e=n(f,l);d=u-e[0]*o;v=a+e[1]*o;return w}var n,r,i,s=hr(function(e,t){e=n(e,t);return[e[0]*o+d,v-e[1]*o]}),o=150,u=480,a=250,f=0,l=0,c=0,h=0,p=0,d,v,m=rr,g=Gt,y=null,b=null;w.stream=function(e){return vr(r,m(s(g(e))))};w.clipAngle=function(e){if(!arguments.length)return y;m=e==null?(y=e,rr):ur((y=+e)*mt);return w};w.clipExtent=function(e){if(!arguments.length)return b;b=e;g=e==null?Gt:fr(e[0][0],e[0][1],e[1][0],e[1][1]);return w};w.scale=function(e){if(!arguments.length)return o;o=+e;return S()};w.translate=function(e){if(!arguments.length)return[u,a];u=+e[0];a=+e[1];return S()};w.center=function(e){if(!arguments.length)return[f*gt,l*gt];f=e[0]%360*mt;l=e[1]%360*mt;return S()};w.rotate=function(e){if(!arguments.length)return[c*gt,h*gt,p*gt];c=e[0]%360*mt;h=e[1]%360*mt;p=e.length>2?e[2]%360*mt:0;return S()};e.rebind(w,s,"precision");return function(){n=t.apply(this,arguments);w.invert=n.invert&&E;return S()}}function vr(e,t){return{point:function(n,r){r=e(n*mt,r*mt),n=r[0];t.point(n>dt?n-2*dt:n<-dt?n+2*dt:n,r[1])},sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function mr(e,t){return[e,t]}function gr(e,t,n){return e?t||n?cr(br(e),wr(t,n)):br(e):t||n?wr(t,n):mr}function yr(e){return function(t,n){return t+=e,[t>dt?t-2*dt:t<-dt?t+2*dt:t,n]}}function br(e){var t=yr(e);t.invert=yr(-e);return t}function wr(e,t){function o(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*n+u*r;return[Math.atan2(a*i-l*s,u*n-f*r),Math.asin(Math.max(-1,Math.min(1,l*i+a*s)))]}var n=Math.cos(e),r=Math.sin(e),i=Math.cos(t),s=Math.sin(t);o.invert=function(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*i-a*s;return[Math.atan2(a*i+f*s,u*n+l*r),Math.asin(Math.max(-1,Math.min(1,l*n-u*r)))]};return o}function Er(e,t){var n=Math.cos(e),r=Math.sin(e);return function(i,s,o,u){if(i!=null){i=Sr(n,i);s=Sr(n,s);if(o>0?i<s:i>s)i+=o*2*dt}else{i=e+o*2*dt;s=e}var a;for(var f=o*t,l=i;o>0?l>s:l<s;l-=f){u.point((a=Jn([n,-r*Math.cos(l),-r*Math.sin(l)]))[0],a[1])}}}function Sr(e,t){var n=Rn(t);n[0]-=e;Vn(n);var r=bt(-n[1]);return((-n[2]<0?-r:r)+2*Math.PI-vt)%(2*Math.PI)}function xr(t,n,r){var i=e.range(t,n-vt,r).concat(n);return function(e){return i.map(function(t){return[e,t]})}}function Tr(t,n,r){var i=e.range(t,n-vt,r).concat(n);return function(e){return i.map(function(t){return[t,e]})}}function Nr(e){return e.source}function Cr(e){return e.target}function kr(e,t,n,r){var i=Math.cos(t),s=Math.sin(t),o=Math.cos(r),u=Math.sin(r),a=i*Math.cos(e),f=i*Math.sin(e),l=o*Math.cos(n),c=o*Math.sin(n),h=2*Math.asin(Math.sqrt(xt(r-t)+i*o*xt(n-e))),p=1/Math.sin(h);var d=h?function(e){var t=Math.sin(e*=h)*p,n=Math.sin(h-e)*p,r=n*a+t*l,i=n*f+t*c,o=n*s+t*u;return[Math.atan2(i,r)*gt,Math.atan2(o,Math.sqrt(r*r+i*i))*gt]}:function(){return[e*gt,t*gt]};d.distance=h;return d}function Or(){function r(r,i){var s=Math.sin(i*=mt),o=Math.cos(i),u=Math.abs((r*=mt)-e),a=Math.cos(u);Lr+=Math.atan2(Math.sqrt((u=o*Math.sin(u))*u+(u=n*s-t*o*a)*u),t*s+n*o*a);e=r,t=s,n=o}var e,t,n;Ar.point=function(i,s){e=i*mt,t=Math.sin(s*=mt),n=Math.cos(s);Ar.point=r};Ar.lineEnd=function(){Ar.point=Ar.lineEnd=G}}function Mr(e){var t=0,n=dt/3,r=dr(e),i=r(t,n);i.parallels=function(e){if(!arguments.length)return[t/dt*180,n/dt*180];return r(t=e[0]*dt/180,n=e[1]*dt/180)};return i}function _r(e,t){function o(e,t){var n=Math.sqrt(i-2*r*Math.sin(t))/r;return[n*Math.sin(e*=r),s-n*Math.cos(e)]}var n=Math.sin(e),r=(n+Math.sin(t))/2,i=1+n*(2*r-n),s=Math.sqrt(i)/r;o.invert=function(e,t){var n=s-t;return[Math.atan2(e,n)/r,Math.asin((i-(e*e+n*n)*r*r)/(2*r))]};return o}function Dr(e,t){var n=e(t[0]),r=e([.5*(t[0][0]+t[1][0]),t[0][1]]),i=e([t[1][0],t[0][1]]),s=e(t[1]);var o=r[1]-n[1],u=r[0]-n[0],a=i[1]-r[1],f=i[0]-r[0];var l=o/u,c=a/f;var h=.5*(l*c*(n[1]-i[1])+c*(n[0]+r[0])-l*(r[0]+i[0]))/(c-l),p=(.5*(n[0]+r[0])-h)/l+.5*(n[1]+r[1]);var d=s[0]-h,v=s[1]-p,m=n[0]-h,g=n[1]-p,y=d*d+v*v,b=m*m+g*g;var w=Math.atan2(v,d),E=Math.atan2(g,m);return function(t){var n=t[0]-h,r=t[1]-p,i=n*n+r*r,s=Math.atan2(r,n);if(y<i&&i<b&&w<s&&s<E)return e.invert(t)}}function jr(){function i(e,t){Hr+=r*e-n*t;n=e,r=t}var e,t,n,r;Br.point=function(s,o){Br.point=i;e=n=s,t=r=o};Br.lineEnd=function(){i(e,t)}}function Fr(){function r(n,r){t.push("M",n,",",r,e)}function i(e,r){t.push("M",e,",",r);n.point=s}function s(e,n){t.push("L",e,",",n)}function o(){n.point=r}function u(){t.push("Z")}var e=Xr(4.5),t=[];var n={point:r,lineStart:function(){n.point=i},lineEnd:o,polygonStart:function(){n.lineEnd=u},polygonEnd:function(){n.lineEnd=o;n.point=r},pointRadius:function(t){e=Xr(t);return n},result:function(){if(t.length){var e=t.join("");t=[];return e}}};return n}function qr(e,t){if(Mn)return;Dn+=e;Pn+=t;++Hn}function Rr(){function n(n,r){var i=n-e,s=r-t,o=Math.sqrt(i*i+s*s);Dn+=o*(e+n)/2;Pn+=o*(t+r)/2;Hn+=o;e=n,t=r}var e,t;if(Mn!==1){if(Mn<1){Mn=1;Dn=Pn=Hn=0}else return}Ir.point=function(r,i){Ir.point=n;e=r,t=i}}function Ur(){Ir.point=qr}function zr(){function i(e,t){var i=r*e-n*t;Dn+=i*(n+e);Pn+=i*(r+t);Hn+=i*3;n=e,r=t}var e,t,n,r;if(Mn<2){Mn=2;Dn=Pn=Hn=0}Ir.point=function(s,o){Ir.point=i;e=n=s,t=r=o};Ir.lineEnd=function(){i(e,t)}}function Wr(e){function r(n,r){e.moveTo(n,r);e.arc(n,r,t,0,2*dt)}function i(t,r){e.moveTo(t,r);n.point=s}function s(t,n){e.lineTo(t,n)}function o(){n.point=r}function u(){e.closePath()}var t=4.5;var n={point:r,lineStart:function(){n.point=i},lineEnd:o,polygonStart:function(){n.lineEnd=u},polygonEnd:function(){n.lineEnd=o;n.point=r},pointRadius:function(e){t=e;return n},result:G};return n}function Xr(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+ -2*e+"a"+e+","+e+" 0 1,1 0,"+ +2*e+"z"}function Vr(e){var t=hr(function(t,n){return e([t*gt,n*gt])});return function(e){e=t(e);return{point:function(t,n){e.point(t*mt,n*mt)},sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}}function $r(e,t){function n(t,n){var r=Math.cos(t),i=Math.cos(n),s=e(r*i);return[s*i*Math.sin(t),s*Math.sin(n)]}n.invert=function(e,n){var r=Math.sqrt(e*e+n*n),i=t(r),s=Math.sin(i),o=Math.cos(i);return[Math.atan2(e*s,r*o),Math.asin(r&&n*s/r)]};return n}function Qr(e,t){function o(e,t){var n=Math.abs(Math.abs(t)-dt/2)<vt?0:s/Math.pow(r(t),i);return[n*Math.sin(i*e),s-n*Math.cos(i*e)]}var n=Math.cos(e),r=function(e){return Math.tan(dt/4+e/2)},i=e===t?Math.sin(e):Math.log(n/Math.cos(t))/Math.log(r(t)/r(e)),s=n*Math.pow(r(e),i)/i;if(!i)return Zr;o.invert=function(e,t){var n=s-t,r=yt(i)*Math.sqrt(e*e+n*n);return[Math.atan2(e,n)/i,2*Math.atan(Math.pow(s/r,1/i))-dt/2]};return o}function Gr(e,t){function s(e,t){var n=i-t;return[n*Math.sin(r*e),i-n*Math.cos(r*e)]}var n=Math.cos(e),r=e===t?Math.sin(e):(n-Math.cos(t))/(t-e),i=n/r+e;if(Math.abs(r)<vt)return mr;s.invert=function(e,t){var n=i-t;return[Math.atan2(e,n)/r,i-yt(r)*Math.sqrt(e*e+n*n)]};return s}function Zr(e,t){return[e,Math.log(Math.tan(dt/4+t/2))]}function ei(e){var t=pr(e),n=t.scale,r=t.translate,i=t.clipExtent,s;t.scale=function(){var e=n.apply(t,arguments);return e===t?s?t.clipExtent(null):t:e};t.translate=function(){var e=r.apply(t,arguments);return e===t?s?t.clipExtent(null):t:e};t.clipExtent=function(e){var o=i.apply(t,arguments);if(o===t){if(s=e==null){var u=dt*n(),a=r();i([[a[0]-u,a[1]-u],[a[0]+u,a[1]+u]])}}else if(s){o=null}return o};return t.clipExtent(null)}function ri(e,t){var n=Math.cos(t)*Math.sin(e);return[Math.log((1+n)/(1-n))/2,Math.atan2(Math.tan(t),Math.cos(e))]}function ii(e){function u(s){function d(){u.push("M",i(e(a),o))}var u=[],a=[],f=-1,l=s.length,c,h=Qt(t),p=Qt(n);while(++f<l){if(r.call(this,c=s[f],f)){a.push([+h.call(this,c,f),+p.call(this,c,f)])}else if(a.length){d();a=[]}}if(a.length)d();return u.length?u.join(""):null}var t=si,n=oi,r=$n,i=ai,s=i.key,o=.7;u.x=function(e){if(!arguments.length)return t;t=e;return u};u.y=function(e){if(!arguments.length)return n;n=e;return u};u.defined=function(e){if(!arguments.length)return r;r=e;return u};u.interpolate=function(e){if(!arguments.length)return s;if(typeof e==="function")s=i=e;else s=(i=ui.get(e)||ai).key;return u};u.tension=function(e){if(!arguments.length)return o;o=e;return u};return u}function si(e){return e[0]}function oi(e){return e[1]}function ai(e){return e.join("L")}function fi(e){return ai(e)+"Z"}function li(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("V",(r=e[t])[1],"H",r[0]);return i.join("")}function ci(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("H",(r=e[t])[0],"V",r[1]);return i.join("")}function hi(e,t){return e.length<4?ai(e):e[1]+vi(e.slice(1,e.length-1),mi(e,t))}function pi(e,t){return e.length<3?ai(e):e[0]+vi((e.push(e[0]),e),mi([e[e.length-2]].concat(e,[e[1]]),t))}function di(e,t){return e.length<3?ai(e):e[0]+vi(e,mi(e,t))}function vi(e,t){if(t.length<1||e.length!=t.length&&e.length!=t.length+2){return ai(e)}var n=e.length!=t.length,r="",i=e[0],s=e[1],o=t[0],u=o,a=1;if(n){r+="Q"+(s[0]-o[0]*2/3)+","+(s[1]-o[1]*2/3)+","+s[0]+","+s[1];i=e[1];a=2}if(t.length>1){u=t[1];s=e[a];a++;r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f<t.length;f++,a++){s=e[a];u=t[f];r+="S"+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1]}}if(n){var l=e[a];r+="Q"+(s[0]+u[0]*2/3)+","+(s[1]+u[1]*2/3)+","+l[0]+","+l[1]}return r}function mi(e,t){var n=[],r=(1-t)/2,i,s=e[0],o=e[1],u=1,a=e.length;while(++u<a){i=s;s=o;o=e[u];n.push([r*(o[0]-i[0]),r*(o[1]-i[1])])}return n}function gi(e){if(e.length<3)return ai(e);var t=1,n=e.length,r=e[0],i=r[0],s=r[1],o=[i,i,i,(r=e[1])[0]],u=[s,s,s,r[1]],a=[i,",",s];Ni(a,o,u);while(++t<n){r=e[t];o.shift();o.push(r[0]);u.shift();u.push(r[1]);Ni(a,o,u)}t=-1;while(++t<2){o.shift();o.push(r[0]);u.shift();u.push(r[1]);Ni(a,o,u)}return a.join("")}function yi(e){if(e.length<4)return ai(e);var t=[],n=-1,r=e.length,i,s=[0],o=[0];while(++n<3){i=e[n];s.push(i[0]);o.push(i[1])}t.push(Ei(Ti,s)+","+Ei(Ti,o));--n;while(++n<r){i=e[n];s.shift();s.push(i[0]);o.shift();o.push(i[1]);Ni(t,s,o)}return t.join("")}function bi(e){var t,n=-1,r=e.length,i=r+4,s,o=[],u=[];while(++n<4){s=e[n%r];o.push(s[0]);u.push(s[1])}t=[Ei(Ti,o),",",Ei(Ti,u)];--n;while(++n<i){s=e[n%r];o.shift();o.push(s[0]);u.shift();u.push(s[1]);Ni(t,o,u)}return t.join("")}function wi(e,t){var n=e.length-1;if(n){var r=e[0][0],i=e[0][1],s=e[n][0]-r,o=e[n][1]-i,u=-1,a,f;while(++u<=n){a=e[u];f=u/n;a[0]=t*a[0]+(1-t)*(r+f*s);a[1]=t*a[1]+(1-t)*(i+f*o)}}return gi(e)}function Ei(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Ni(e,t,n){e.push("C",Ei(Si,t),",",Ei(Si,n),",",Ei(xi,t),",",Ei(xi,n),",",Ei(Ti,t),",",Ei(Ti,n))}function Ci(e,t){return(t[1]-e[1])/(t[0]-e[0])}function ki(e){var t=0,n=e.length-1,r=[],i=e[0],s=e[1],o=r[0]=Ci(i,s);while(++t<n){r[t]=(o+(o=Ci(i=s,s=e[t+1])))/2}r[t]=o;return r}function Li(e){var t=[],n,r,i,s,o=ki(e),u=-1,a=e.length-1;while(++u<a){n=Ci(e[u],e[u+1]);if(Math.abs(n)<1e-6){o[u]=o[u+1]=0}else{r=o[u]/n;i=o[u+1]/n;s=r*r+i*i;if(s>9){s=n*3/Math.sqrt(s);o[u]=s*r;o[u+1]=s*i}}}u=-1;while(++u<=a){s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u]));t.push([s||0,o[u]*s||0])}return t}function Ai(e){return e.length<3?ai(e):e[0]+vi(e,Li(e))}function Oi(e,t,n,r){var i,s,o,u,a,f,l;i=r[e];s=i[0];o=i[1];i=r[t];u=i[0];a=i[1];i=r[n];f=i[0];l=i[1];return(l-o)*(u-s)-(a-o)*(f-s)>0}function Mi(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function _i(e,t,n,r){var i=e[0],s=n[0],o=t[0]-i,u=r[0]-s,a=e[1],f=n[1],l=t[1]-a,c=r[1]-f,h=(u*(a-f)-c*(i-s))/(c*o-u*l);return[i+h*o,a+h*l]}function Pi(e,t){var n={list:e.map(function(e,t){return{index:t,x:e[0],y:e[1]}}).sort(function(e,t){return e.y<t.y?-1:e.y>t.y?1:e.x<t.x?-1:e.x>t.x?1:0}),bottomSite:null};var r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l");r.rightEnd=r.createHalfEdge(null,"l");r.leftEnd.r=r.rightEnd;r.rightEnd.l=r.leftEnd;r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(e,t){return{edge:e,side:t,vertex:null,l:null,r:null}},insert:function(e,t){t.l=e;t.r=e.r;e.r.l=t;e.r=t},leftBound:function(e){var t=r.leftEnd;do{t=t.r}while(t!=r.rightEnd&&i.rightOf(t,e));t=t.l;return t},del:function(e){e.l.r=e.r;e.r.l=e.l;e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[Di[e.side]]}};var i={bisect:function(e,t){var n={region:{l:e,r:t},ep:{l:null,r:null}};var r=t.x-e.x,i=t.y-e.y,s=r>0?r:-r,o=i>0?i:-i;n.c=e.x*r+e.y*i+(r*r+i*i)*.5;if(s>o){n.a=1;n.b=i/r;n.c/=r}else{n.b=1;n.a=r/i;n.c/=i}return n},intersect:function(e,t){var n=e.edge,r=t.edge;if(!n||!r||n.region.r==r.region.r){return null}var i=n.a*r.b-n.b*r.a;if(Math.abs(i)<1e-10){return null}var s=(n.c*r.b-r.c*n.b)/i,o=(r.c*n.a-n.c*r.a)/i,u=n.region.r,a=r.region.r,f,l;if(u.y<a.y||u.y==a.y&&u.x<a.x){f=e;l=n}else{f=t;l=r}var c=s>=l.region.r.x;if(c&&f.side==="l"||!c&&f.side==="r"){return null}return{x:s,y:o}},rightOf:function(e,t){var n=e.edge,r=n.region.r,i=t.x>r.x;if(i&&e.side==="l"){return 1}if(!i&&e.side==="r"){return 0}if(n.a===1){var s=t.y-r.y,o=t.x-r.x,u=0,a=0;if(!i&&n.b<0||i&&n.b>=0){a=u=s>=n.b*o}else{a=t.x+t.y*n.b>n.c;if(n.b<0){a=!a}if(!a){u=1}}if(!u){var f=r.x-n.region.l.x;a=n.b*(o*o-s*s)<f*s*(1+2*o/f+n.b*n.b);if(n.b<0){a=!a}}}else{var l=n.c-n.a*t.x,c=t.y-l,h=t.x-r.x,p=l-r.y;a=c*c>h*h+p*p}return e.side==="l"?a:!a},endPoint:function(e,n,r){e.ep[n]=r;if(!e.ep[Di[n]])return;t(e)},distance:function(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}};var s={list:[],insert:function(e,t,n){e.vertex=t;e.ystar=t.y+n;for(var r=0,i=s.list,o=i.length;r<o;r++){var u=i[r];if(e.ystar>u.ystar||e.ystar==u.ystar&&t.x>u.vertex.x){continue}else{break}}i.splice(r,0,e)},del:function(e){for(var t=0,n=s.list,r=n.length;t<r&&n[t]!=e;++t){}n.splice(t,1)},empty:function(){return s.list.length===0},nextEvent:function(e){for(var t=0,n=s.list,r=n.length;t<r;++t){if(n[t]==e)return n[t+1]}return null},min:function(){var e=s.list[0];return{x:e.vertex.x,y:e.ystar}},extractMin:function(){return s.list.shift()}};r.init();n.bottomSite=n.list.shift();var o=n.list.shift(),u;var a,f,l,c,h;var p,d,v,m,g;var y,b;while(true){if(!s.empty()){u=s.min()}if(o&&(s.empty()||o.y<u.y||o.y==u.y&&o.x<u.x)){a=r.leftBound(o);f=r.right(a);p=r.rightRegion(a);y=i.bisect(p,o);h=r.createHalfEdge(y,"l");r.insert(a,h);m=i.intersect(a,h);if(m){s.del(a);s.insert(a,m,i.distance(m,o))}a=h;h=r.createHalfEdge(y,"r");r.insert(a,h);m=i.intersect(h,f);if(m){s.insert(h,m,i.distance(m,o))}o=n.list.shift()}else if(!s.empty()){a=s.extractMin();l=r.left(a);f=r.right(a);c=r.right(f);p=r.leftRegion(a);d=r.rightRegion(f);g=a.vertex;i.endPoint(a.edge,a.side,g);i.endPoint(f.edge,f.side,g);r.del(a);s.del(f);r.del(f);b="l";if(p.y>d.y){v=p;p=d;d=v;b="r"}y=i.bisect(p,d);h=r.createHalfEdge(y,b);r.insert(l,h);i.endPoint(y,Di[b],g);m=i.intersect(l,h);if(m){s.del(l);s.insert(l,m,i.distance(m,p))}m=i.intersect(h,c);if(m){s.insert(h,m,i.distance(m,p))}}else{break}}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a)){t(a.edge)}}function Hi(e){return e.x}function Bi(e){return e.y}function ji(){return{leaf:true,nodes:[],point:null,x:null,y:null}}function Fi(e,t,n,r,i,s){if(!e(t,n,r,i,s)){var o=(n+i)*.5,u=(r+s)*.5,a=t.nodes;if(a[0])Fi(e,a[0],n,r,o,u);if(a[1])Fi(e,a[1],o,r,i,u);if(a[2])Fi(e,a[2],n,u,o,s);if(a[3])Fi(e,a[3],o,u,i,s)}}function Ii(t,n){t=e.rgb(t);n=e.rgb(n);var r=t.r,i=t.g,s=t.b,o=n.r-r,u=n.g-i,a=n.b-s;return function(e){return"#"+zt(Math.round(r+o*e))+zt(Math.round(i+u*e))+zt(Math.round(s+a*e))}}function qi(e){var t=[e.a,e.b],n=[e.c,e.d],r=Ui(t),i=Ri(t,n),s=Ui(zi(n,t,-i))||0;if(t[0]*n[1]<n[0]*t[1]){t[0]*=-1;t[1]*=-1;r*=-1;i*=-1}this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-n[0],n[1]))*gt;this.translate=[e.e,e.f];this.scale=[r,s];this.skew=s?Math.atan2(i,s)*gt:0}function Ri(e,t){return e[0]*t[0]+e[1]*t[1]}function Ui(e){var t=Math.sqrt(Ri(e,e));if(t){e[0]/=t;e[1]/=t}return t}function zi(e,t,n){e[0]+=n*t[0];e[1]+=n*t[1];return e}function Xi(e,t){t-=e=+e;return function(n){return e+t*n}}function Vi(t,n){var r=[],i=[],s,o=e.transform(t),u=e.transform(n),a=o.translate,f=u.translate,l=o.rotate,c=u.rotate,h=o.skew,p=u.skew,d=o.scale,v=u.scale;if(a[0]!=f[0]||a[1]!=f[1]){r.push("translate(",null,",",null,")");i.push({i:1,x:Xi(a[0],f[0])},{i:3,x:Xi(a[1],f[1])})}else if(f[0]||f[1]){r.push("translate("+f+")")}else{r.push("")}if(l!=c){if(l-c>180)c+=360;else if(c-l>180)l+=360;i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:Xi(l,c)})}else if(c){r.push(r.pop()+"rotate("+c+")")}if(h!=p){i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:Xi(h,p)})}else if(p){r.push(r.pop()+"skewX("+p+")")}if(d[0]!=v[0]||d[1]!=v[1]){s=r.push(r.pop()+"scale(",null,",",null,")");i.push({i:s-4,x:Xi(d[0],v[0])},{i:s-2,x:Xi(d[1],v[1])})}else if(v[0]!=1||v[1]!=1){r.push(r.pop()+"scale("+v+")")}s=i.length;return function(e){var t=-1,n;while(++t<s)r[(n=i[t]).i]=n.x(e);return r.join("")}}function $i(e,t){var n={},r={},i;for(i in e){if(i in t){n[i]=Gi(i)(e[i],t[i])}else{r[i]=e[i]}}for(i in t){if(!(i in e)){r[i]=t[i]}}return function(e){for(i in n)r[i]=n[i](e);return r}}function Ji(e,t){var n,r,i,s=0,o=0,u=[],a=[],f,l;e=e+"",t=t+"";Ki.lastIndex=0;for(r=0;n=Ki.exec(t);++r){if(n.index)u.push(t.substring(s,o=n.index));a.push({i:u.length,x:n[0]});u.push(null);s=Ki.lastIndex}if(s<t.length)u.push(t.substring(s));for(r=0,f=a.length;(n=Ki.exec(e))&&r<f;++r){l=a[r];if(l.x==n[0]){if(l.i){if(u[l.i+1]==null){u[l.i-1]+=l.x;u.splice(l.i,1);for(i=r+1;i<f;++i)a[i].i--}else{u[l.i-1]+=l.x+u[l.i+1];u.splice(l.i,2);for(i=r+1;i<f;++i)a[i].i-=2}}else{if(u[l.i+1]==null){u[l.i]=l.x}else{u[l.i]=l.x+u[l.i+1];u.splice(l.i+1,1);for(i=r+1;i<f;++i)a[i].i--}}a.splice(r,1);f--;r--}else{l.x=Xi(parseFloat(n[0]),parseFloat(l.x))}}while(r<f){l=a.pop();if(u[l.i+1]==null){u[l.i]=l.x}else{u[l.i]=l.x+u[l.i+1];u.splice(l.i+1,1)}f--}if(u.length===1){return u[0]==null?a[0].x:function(){return t}}return function(e){for(r=0;r<f;++r)u[(l=a[r]).i]=l.x(e);return u.join("")}}function Qi(t,n){var r=e.interpolators.length,i;while(--r>=0&&!(i=e.interpolators[r](t,n)));return i}function Gi(e){return e=="transform"?Vi:Qi}function Yi(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u<o;++u)n.push(Qi(e[u],t[u]));for(;u<i;++u)r[u]=e[u];for(;u<s;++u)r[u]=t[u];return function(e){for(u=0;u<o;++u)r[u]=n[u](e);return r}}function ns(e){return function(t){return t<=0?0:t>=1?1:e(t)}}function rs(e){return function(t){return 1-e(1-t)}}function is(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function ss(e){return e*e}function os(e){return e*e*e}function us(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function as(e){return function(t){return Math.pow(t,e)}}function fs(e){return 1-Math.cos(e*dt/2)}function ls(e){return Math.pow(2,10*(e-1))}function cs(e){return 1-Math.sqrt(1-e*e)}function hs(e,t){var n;if(arguments.length<2)t=.45;if(arguments.length)n=t/(2*dt)*Math.asin(1/e);else e=1,n=t/4;return function(r){return 1+e*Math.pow(2,10*-r)*Math.sin((r-n)*2*dt/t)}}function ps(e){if(!e)e=1.70158;return function(t){return t*t*((e+1)*t-e)}}function ds(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function vs(t,n){t=e.hcl(t);n=e.hcl(n);var r=t.h,i=t.c,s=t.l,o=n.h-r,u=n.c-i,a=n.l-s;if(o>180)o-=360;else if(o<-180)o+=360;return function(e){return kt(r+o*e,i+u*e,s+a*e)+""}}function ms(t,n){t=e.hsl(t);n=e.hsl(n);var r=t.h,i=t.s,s=t.l,o=n.h-r,u=n.s-i,a=n.l-s;if(o>180)o-=360;else if(o<-180)o+=360;return function(e){return pt(r+o*e,i+u*e,s+a*e)+""}}function gs(t,n){t=e.lab(t);n=e.lab(n);var r=t.l,i=t.a,s=t.b,o=n.l-r,u=n.a-i,a=n.b-s;return function(e){return Ht(r+o*e,i+u*e,s+a*e)+""}}function ys(e,t){t-=e;return function(n){return Math.round(e+t*n)}}function bs(e,t){t=t-(e=+e)?1/(t-e):0;return function(n){return(n-e)*t}}function ws(e,t){t=t-(e=+e)?1/(t-e):0;return function(n){return Math.max(0,Math.min(1,(n-e)*t))}}function Es(e){var t=e.source,n=e.target,r=xs(t,n),i=[t];while(t!==r){t=t.parent;i.push(t)}var s=i.length;while(n!==r){i.splice(s,0,n);n=n.parent}return i}function Ss(e){var t=[],n=e.parent;while(n!=null){t.push(e);e=n;n=n.parent}t.push(e);return t}function xs(e,t){if(e===t)return e;var n=Ss(e),r=Ss(t),i=n.pop(),s=r.pop(),o=null;while(i===s){o=i;i=n.pop();s=r.pop()}return o}function Ts(e){e.fixed|=2}function Ns(e){e.fixed&=~6}function Cs(e){e.fixed|=4;e.px=e.x,e.py=e.y}function ks(e){e.fixed&=~4}function Ls(e,t,n){var r=0,i=0;e.charge=0;if(!e.leaf){var s=e.nodes,o=s.length,u=-1,a;while(++u<o){a=s[u];if(a==null)continue;Ls(a,t,n);e.charge+=a.charge;r+=a.charge*a.cx;i+=a.charge*a.cy}}if(e.point){if(!e.leaf){e.point.x+=Math.random()-.5;e.point.y+=Math.random()-.5}var f=t*n[e.point.index];e.charge+=e.pointCharge=f;r+=f*e.point.x;i+=f*e.point.y}e.cx=r/e.charge;e.cy=i/e.charge}function Ms(t,n){e.rebind(t,n,"sort","children","value");t.nodes=t;t.links=Hs;return t}function _s(e){return e.children}function Ds(e){return e.value}function Ps(e,t){return t.value-e.value}function Hs(t){return e.merge(t.map(function(e){return(e.children||[]).map(function(t){return{source:e,target:t}})}))}function js(e){return e.x}function Fs(e){return e.y}function Is(e,t,n){e.y0=t;e.y=n}function Us(t){return e.range(t.length)}function zs(e){var t=-1,n=e[0].length,r=[];while(++t<n)r[t]=0;return r}function Ws(e){var t=1,n=0,r=e[0][1],i,s=e.length;for(;t<s;++t){if((i=e[t][1])>r){n=t;r=i}}return n}function Xs(e){return e.reduce(Vs,0)}function Vs(e,t){return e+t[1]}function $s(e,t){return Js(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Js(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function Ks(t){return[e.min(t),e.max(t)]}function Qs(e,t){return e.parent==t.parent?1:2}function Gs(e){var t=e.children;return t&&t.length?t[0]:e._tree.thread}function Ys(e){var t=e.children,n;return t&&(n=t.length)?t[n-1]:e._tree.thread}function Zs(e,t){var n=e.children;if(n&&(i=n.length)){var r,i,s=-1;while(++s<i){if(t(r=Zs(n[s],t),e)>0){e=r}}}return e}function eo(e,t){return e.x-t.x}function to(e,t){return t.x-e.x}function no(e,t){return e.depth-t.depth}function ro(e,t){function n(e,r){var i=e.children;if(i&&(a=i.length)){var s,o=null,u=-1,a;while(++u<a){s=i[u];n(s,o);o=s}}t(e,r)}n(e,null)}function io(e){var t=0,n=0,r=e.children,i=r.length,s;while(--i>=0){s=r[i]._tree;s.prelim+=t;s.mod+=t;t+=s.shift+(n+=s.change)}}function so(e,t,n){e=e._tree;t=t._tree;var r=n/(t.number-e.number);e.change+=r;t.change-=r;t.shift+=n;t.prelim+=n;t.mod+=n}function oo(e,t,n){return e._tree.ancestor.parent==t.parent?e._tree.ancestor:n}function uo(e,t){return e.value-t.value}function ao(e,t){var n=e._pack_next;e._pack_next=t;t._pack_prev=e;t._pack_next=n;n._pack_prev=t}function fo(e,t){e._pack_next=t;t._pack_prev=e}function lo(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return i*i-n*n-r*r>.001}function co(e){function p(e){n=Math.min(e.x-e.r,n);r=Math.max(e.x+e.r,r);i=Math.min(e.y-e.r,i);s=Math.max(e.y+e.r,s)}if(!(t=e.children)||!(h=t.length))return;var t,n=Infinity,r=-Infinity,i=Infinity,s=-Infinity,o,u,a,f,l,c,h;t.forEach(ho);o=t[0];o.x=-o.r;o.y=0;p(o);if(h>1){u=t[1];u.x=u.r;u.y=0;p(u);if(h>2){a=t[2];mo(o,u,a);p(a);ao(o,a);o._pack_prev=a;ao(a,u);u=o._pack_next;for(f=3;f<h;f++){mo(o,u,a=t[f]);var d=0,v=1,m=1;for(l=u._pack_next;l!==u;l=l._pack_next,v++){if(lo(l,a)){d=1;break}}if(d==1){for(c=o._pack_prev;c!==l._pack_prev;c=c._pack_prev,m++){if(lo(c,a)){break}}}if(d){if(v<m||v==m&&u.r<o.r)fo(o,u=l);else fo(o=c,u);f--}else{ao(o,a);u=a;p(a)}}}}var g=(n+r)/2,y=(i+s)/2,b=0;for(f=0;f<h;f++){a=t[f];a.x-=g;a.y-=y;b=Math.max(b,a.r+Math.sqrt(a.x*a.x+a.y*a.y))}e.r=b;t.forEach(po)}function ho(e){e._pack_next=e._pack_prev=e}function po(e){delete e._pack_next;delete e._pack_prev}function vo(e,t,n,r){var i=e.children;e.x=t+=r*e.x;e.y=n+=r*e.y;e.r*=r;if(i){var s=-1,o=i.length;while(++s<o)vo(i[s],t,n,r)}}function mo(e,t,n){var r=e.r+n.r,i=t.x-e.x,s=t.y-e.y;if(r&&(i||s)){var o=t.r+n.r,u=i*i+s*s;o*=o;r*=r;var a=.5+(r-o)/(2*u),f=Math.sqrt(Math.max(0,2*o*(r+u)-(r-=u)*r-o*o))/(2*u);n.x=e.x+a*i+f*s;n.y=e.y+a*s-f*i}else{n.x=e.x+r;n.y=e.y}}function go(t){return 1+e.max(t,function(e){return e.y})}function yo(e){return e.reduce(function(e,t){return e+t.x},0)/e.length}function bo(e){var t=e.children;return t&&t.length?bo(t[0]):e}function wo(e){var t=e.children,n;return t&&(n=t.length)?wo(t[n-1]):e}function Eo(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function So(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],s=e.dy-t[0]-t[2];if(i<0){n+=i/2;i=0}if(s<0){r+=s/2;s=0}return{x:n,y:r,dx:i,dy:s}}function xo(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function To(e){return e.rangeExtent?e.rangeExtent():xo(e.range())}function No(e,t,n,r){var i=n(e[0],e[1]),s=r(t[0],t[1]);return function(e){return s(i(e))}}function Co(e,t){var n=0,r=e.length-1,i=e[n],s=e[r],o;if(s<i){o=n,n=r,r=o;o=i,i=s,s=o}if(t=t(s-i)){e[n]=t.floor(i);e[r]=t.ceil(s)}return e}function ko(t,n,r,i){var s=[],o=[],u=0,a=Math.min(t.length,n.length)-1;if(t[a]<t[0]){t=t.slice().reverse();n=n.slice().reverse()}while(++u<=a){s.push(r(t[u-1],t[u]));o.push(i(n[u-1],n[u]))}return function(n){var r=e.bisect(t,n,1,a)-1;return o[r](s[r](n))}}function Lo(e,t,n,r){function o(){var o=Math.min(e.length,t.length)>2?ko:No,a=r?ws:bs;i=o(e,t,a,n);s=o(t,e,a,Qi);return u}function u(e){return i(e)}var i,s;u.invert=function(e){return s(e)};u.domain=function(t){if(!arguments.length)return e;e=t.map(Number);return o()};u.range=function(e){if(!arguments.length)return t;t=e;return o()};u.rangeRound=function(e){return u.range(e).interpolate(ys)};u.clamp=function(e){if(!arguments.length)return r;r=e;return o()};u.interpolate=function(e){if(!arguments.length)return n;n=e;return o()};u.ticks=function(t){return _o(e,t)};u.tickFormat=function(t,n){return Do(e,t,n)};u.nice=function(){Co(e,Oo);return o()};u.copy=function(){return Lo(e,t,n,r)};return o()}function Ao(t,n){return e.rebind(t,n,"range","rangeRound","interpolate","clamp")}function Oo(e){e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1);return e&&{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}}function Mo(e,t){var n=xo(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;if(s<=.15)i*=10;else if(s<=.35)i*=5;else if(s<=.75)i*=2;n[0]=Math.ceil(n[0]/i)*i;n[1]=Math.floor(n[1]/i)*i+i*.5;n[2]=i;return n}function _o(t,n){return e.range.apply(e,Mo(t,n))}function Do(t,n,r){var i=-Math.floor(Math.log(Mo(t,n)[2])/Math.LN10+.01);return e.format(r?r.replace(dn,function(e,t,n,r,s,o,u,a,f,l){return[t,n,r,s,o,u,a,f||"."+(i-(l==="%")*2),l].join("")}):",."+i+"f")}function Po(e,t,n,r){function i(t){return e(n(t))}i.invert=function(t){return r(e.invert(t))};i.domain=function(t){if(!arguments.length)return e.domain().map(r);if(t[0]<0)n=Fo,r=Io;else n=Bo,r=jo;e.domain(t.map(n));return i};i.base=function(e){if(!arguments.length)return t;t=+e;return i};i.nice=function(){e.domain(Co(e.domain(),qo(t)));return i};i.ticks=function(){var i=xo(e.domain()),s=[];if(i.every(isFinite)){var o=Math.log(t),u=Math.floor(i[0]/o),a=Math.ceil(i[1]/o),f=r(i[0]),l=r(i[1]),c=t%1?2:t;if(n===Fo){s.push(-Math.pow(t,-u));for(;u++<a;)for(var h=c-1;h>0;h--)s.push(-Math.pow(t,-u)*h)}else{for(;u<a;u++)for(var h=1;h<c;h++)s.push(Math.pow(t,u)*h);s.push(Math.pow(t,u))}for(u=0;s[u]<f;u++){}for(a=s.length;s[a-1]>l;a--){}s=s.slice(u,a)}return s};i.tickFormat=function(e,s){if(arguments.length<2)s=Ho;if(!arguments.length)return s;var o=Math.log(t),u=Math.max(.1,e/i.ticks().length),a=n===Fo?(f=-1e-12,Math.floor):(f=1e-12,Math.ceil),f;return function(e){return e/r(o*a(n(e)/o+f))<=u?s(e):""}};i.copy=function(){return Po(e.copy(),t,n,r)};return Ao(i,e)}function Bo(e){return Math.log(e<0?0:e)}function jo(e){return Math.exp(e)}function Fo(e){return-Math.log(e>0?0:-e)}function Io(e){return-Math.exp(-e)}function qo(e){e=Math.log(e);var t={floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}};return function(){return t}}function Ro(e,t){function i(t){return e(n(t))}var n=Uo(t),r=Uo(1/t);i.invert=function(t){return r(e.invert(t))};i.domain=function(t){if(!arguments.length)return e.domain().map(r);e.domain(t.map(n));return i};i.ticks=function(e){return _o(i.domain(),e)};i.tickFormat=function(e,t){return Do(i.domain(),e,t)};i.nice=function(){return i.domain(Co(i.domain(),Oo))};i.exponent=function(e){if(!arguments.length)return t;var s=i.domain();n=Uo(t=e);r=Uo(1/t);return i.domain(s)};i.copy=function(){return Ro(e.copy(),t)};return Ao(i,e)}function Uo(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function zo(t,n){function o(e){return i[((r.get(e)||r.set(e,t.push(e)))-1)%i.length]}function u(n,r){return e.range(t.length).map(function(e){return n+r*e})}var r,i,s;o.domain=function(e){if(!arguments.length)return t;t=[];r=new c;var i=-1,s=e.length,u;while(++i<s)if(!r.has(u=e[i]))r.set(u,t.push(u));return o[n.t].apply(o,n.a)};o.range=function(e){if(!arguments.length)return i;i=e;s=0;n={t:"range",a:arguments};return o};o.rangePoints=function(e,r){if(arguments.length<2)r=0;var a=e[0],f=e[1],l=(f-a)/(Math.max(1,t.length-1)+r);i=u(t.length<2?(a+f)/2:a+l*r/2,l);s=0;n={t:"rangePoints",a:arguments};return o};o.rangeBands=function(e,r,a){if(arguments.length<2)r=0;if(arguments.length<3)a=r;var f=e[1]<e[0],l=e[f-0],c=e[1-f],h=(c-l)/(t.length-r+2*a);i=u(l+h*a,h);if(f)i.reverse();s=h*(1-r);n={t:"rangeBands",a:arguments};return o};o.rangeRoundBands=function(e,r,a){if(arguments.length<2)r=0;if(arguments.length<3)a=r;var f=e[1]<e[0],l=e[f-0],c=e[1-f],h=Math.floor((c-l)/(t.length-r+2*a)),p=c-l-(t.length-r)*h;i=u(l+Math.round(p/2),h);if(f)i.reverse();s=Math.round(h*(1-r));n={t:"rangeRoundBands",a:arguments};return o};o.rangeBand=function(){if(s<=50)return s;else return 50};o.rangeExtent=function(){return xo(n.a[0])};o.copy=function(){return zo(t,n)};return o.domain(t)}function Ko(t,n){function i(){var i=0,o=n.length;r=[];while(++i<o)r[i-1]=e.quantile(t,i/o);return s}function s(t){if(isNaN(t=+t))return NaN;return n[e.bisect(r,t)]}var r;s.domain=function(n){if(!arguments.length)return t;t=n.filter(function(e){return!isNaN(e)}).sort(e.ascending);return i()};s.range=function(e){if(!arguments.length)return n;n=e;return i()};s.quantiles=function(){return r};s.copy=function(){return Ko(t,n)};return i()}function Qo(e,t,n){function s(t){return n[Math.max(0,Math.min(i,Math.floor(r*(t-e))))]}function o(){r=n.length/(t-e);i=n.length-1;return s}var r,i;s.domain=function(n){if(!arguments.length)return[e,t];e=+n[0];t=+n[n.length-1];return o()};s.range=function(e){if(!arguments.length)return n;n=e;return o()};s.copy=function(){return Qo(e,t,n)};return o()}function Go(t,n){function r(r){return n[e.bisect(t,r)]}r.domain=function(e){if(!arguments.length)return t;t=e;return r};r.range=function(e){if(!arguments.length)return n;n=e;return r};r.copy=function(){return Go(t,n)};return r}function Yo(e){function t(e){return+e}t.invert=t;t.domain=t.range=function(n){if(!arguments.length)return e;e=n.map(t);return t};t.ticks=function(t){return _o(e,t)};t.tickFormat=function(t,n){return Do(e,t,n)};t.copy=function(){return Yo(e)};return t}function tu(e){return e.innerRadius}function nu(e){return e.outerRadius}function ru(e){return e.startAngle}function iu(e){return e.endAngle}function su(e){var t,n=-1,r=e.length,i,s;while(++n<r){t=e[n];i=t[0];s=t[1]+Zo;t[0]=i*Math.cos(s);t[1]=i*Math.sin(s)}return e}function ou(e){function c(u){function x(){c.push("M",o(e(p),l),f,a(e(h.reverse()),l),"Z")}var c=[],h=[],p=[],d=-1,v=u.length,m,g=Qt(t),y=Qt(r),b=t===n?function(){return E}:Qt(n),w=r===i?function(){return S}:Qt(i),E,S;while(++d<v){if(s.call(this,m=u[d],d)){h.push([E=+g.call(this,m,d),S=+y.call(this,m,d)]);p.push([+b.call(this,m,d),+w.call(this,m,d)])}else if(h.length){x();h=[];p=[]}}if(h.length)x();return c.length?c.join(""):null}var t=si,n=si,r=0,i=oi,s=$n,o=ai,u=o.key,a=o,f="L",l=.7;c.x=function(e){if(!arguments.length)return n;t=n=e;return c};c.x0=function(e){if(!arguments.length)return t;t=e;return c};c.x1=function(e){if(!arguments.length)return n;n=e;return c};c.y=function(e){if(!arguments.length)return i;r=i=e;return c};c.y0=function(e){if(!arguments.length)return r;r=e;return c};c.y1=function(e){if(!arguments.length)return i;i=e;return c};c.defined=function(e){if(!arguments.length)return s;s=e;return c};c.interpolate=function(e){if(!arguments.length)return u;if(typeof e==="function")u=o=e;else u=(o=ui.get(e)||ai).key;a=o.reverse||o;f=o.closed?"M":"L";return c};c.tension=function(e){if(!arguments.length)return l;l=e;return c};return c}function uu(e){return e.radius}function au(e){return[e.x,e.y]}function fu(e){return function(){var t=e.apply(this,arguments),n=t[0],r=t[1]+Zo;return[n*Math.cos(r),n*Math.sin(r)]}}function lu(){return 64}function cu(){return"circle"}function hu(e){var t=Math.sqrt(e/dt);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+ -t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function mu(e,t){A(e,gu);e.id=t;return e}function Eu(e,t,n,r){var i=e.id;return nt(e,typeof n==="function"?function(e,s,o){e.__transition__[i].tween.set(t,r(n.call(e,e.__data__,s,o)))}:(n=r(n),function(e){e.__transition__[i].tween.set(t,n)}))}function Su(e){if(e==null)e="";return function(){this.textContent=e}}function xu(t,n,r,i){var s=t.__transition__||(t.__transition__={active:0,count:0}),o=s[r];if(!o){var u=i.time;o=s[r]={tween:new c,event:e.dispatch("start","end"),time:u,ease:i.ease,delay:i.delay,duration:i.duration};++s.count;e.timer(function(i){function d(i){if(s.active>r)return m();s.active=r;l.start.call(t,a,n);o.tween.forEach(function(e,r){if(r=r.call(t,a,n)){p.push(r)}});if(!v(i))e.timer(v,0,u);return 1}function v(e){if(s.active!==r)return m();var i=(e-c)/h,o=f(i),u=p.length;while(u>0){p[--u].call(t,o)}if(i>=1){m();l.end.call(t,a,n);return 1}}function m(){if(--s.count)delete s[r];else delete t.__transition__;return 1}var a=t.__data__,f=o.ease,l=o.event,c=o.delay,h=o.duration,p=[];return c<=i?d(i):e.timer(d,c,u),1},0,u);return o}}function Cu(e,t){e.attr("transform",function(e){return"translate("+t(e)+",0)"})}function ku(e,t){e.attr("transform",function(e){return"translate(0,"+t(e)+")"})}function Lu(e,t,n){i=[];if(n&&t.length>1){var r=xo(e.domain()),i,s=-1,o=t.length,u=(t[1]-t[0])/++n,a,f;while(++s<o){for(a=n;--a>0;){if((f=+t[s]-a*u)>=r[0]){i.push(f)}}}for(--s,a=0;++a<n&&(f=+t[s]+a*u)<r[1];){i.push(f)}}return i}function Du(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Uu(e,t,n){function r(t){var n=e(t),r=s(n,1);return t-n<r-t?n:r}function i(n){t(n=e(new Mu(n-1)),1);return n}function s(e,n){t(e=new Mu(+e),n);return e}function o(e,r,s){var o=i(e),u=[];if(s>1){while(o<r){if(!(n(o)%s))u.push(new Date(+o));t(o,1)}}else{while(o<r)u.push(new Date(+o)),t(o,1)}return u}function u(e,t,n){try{Mu=Du;var r=new Du;r._=e;return o(r,t,n)}finally{Mu=Date}}e.floor=e;e.round=r;e.ceil=i;e.offset=s;e.range=o;var a=e.utc=zu(e);a.floor=a;a.round=zu(r);a.ceil=zu(i);a.offset=zu(s);a.range=u;return e}function zu(e){return function(t,n){try{Mu=Du;var r=new Du;r._=t;return e(r,n)._}finally{Mu=Date}}}function Wu(e,t,n,r){var i,s,o=0,u=t.length,a=n.length;while(o<u){if(r>=a)return-1;i=t.charCodeAt(o++);if(i===37){s=na[t.charAt(o++)];if(!s||(r=s(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++)){return-1}}return r}function Xu(t){return new RegExp("^(?:"+t.map(e.requote).join("|")+")","i")}function Vu(e){var t=new c,n=-1,r=e.length;while(++n<r)t.set(e[n].toLowerCase(),n);return t}function $u(e,t,n){e+="";var r=e.length;return r<n?(new Array(n-r+1)).join(t)+e:e}function ra(e,t,n){Ku.lastIndex=0;var r=Ku.exec(t.substring(n));return r?n+=r[0].length:-1}function ia(e,t,n){Ju.lastIndex=0;var r=Ju.exec(t.substring(n));return r?n+=r[0].length:-1}function sa(e,t,n){Yu.lastIndex=0;var r=Yu.exec(t.substring(n));return r?(e.m=Zu.get(r[0].toLowerCase()),n+=r[0].length):-1}function oa(e,t,n){Qu.lastIndex=0;var r=Qu.exec(t.substring(n));return r?(e.m=Gu.get(r[0].toLowerCase()),n+=r[0].length):-1}function ua(e,t,n){return Wu(e,ta.c.toString(),t,n)}function aa(e,t,n){return Wu(e,ta.x.toString(),t,n)}function fa(e,t,n){return Wu(e,ta.X.toString(),t,n)}function la(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+4));return r?(e.y=+r[0],n+=r[0].length):-1}function ca(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.y=ha(+r[0]),n+=r[0].length):-1}function ha(e){return e+(e>68?1900:2e3)}function pa(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.m=r[0]-1,n+=r[0].length):-1}function da(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.d=+r[0],n+=r[0].length):-1}function va(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.H=+r[0],n+=r[0].length):-1}function ma(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.M=+r[0],n+=r[0].length):-1}function ga(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.S=+r[0],n+=r[0].length):-1}function ya(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+3));return r?(e.L=+r[0],n+=r[0].length):-1}function wa(e,t,n){var r=Ea.get(t.substring(n,n+=2).toLowerCase());return r==null?-1:(e.p=r,n)}function Sa(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return n+$u(r,"0",2)+$u(i,"0",2)}function Ta(e){return e.toISOString()}function Na(t,n,r){function i(e){return t(e)}i.invert=function(e){return ka(t.invert(e))};i.domain=function(e){if(!arguments.length)return t.domain().map(ka);t.domain(e);return i};i.nice=function(e){return i.domain(Co(i.domain(),function(){return e}))};i.ticks=function(r,s){var o=Ca(i.domain());if(typeof r!=="function"){var u=o[1]-o[0],a=u/r,f=e.bisect(Ma,a);if(f==Ma.length)return n.year(o,r);if(!f)return t.ticks(r).map(ka);if(Math.log(a/Ma[f-1])<Math.log(Ma[f]/a))--f;r=n[f];s=r[1];r=r[0].range}return r(o[0],new Date(+o[1]+1),s)};i.tickFormat=function(){return r};i.copy=function(){return Na(t.copy(),n,r)};return e.rebind(i,t,"range","rangeRound","interpolate","clamp")}function Ca(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function ka(e){return new Date(e)}function La(e){return function(t){var n=e.length-1,r=e[n];while(!r[1](t))r=e[--n];return r[0](t)}}function Aa(e){var t=new Date(e,0,1);t.setFullYear(e);return t}function Oa(e){var t=e.getFullYear(),n=Aa(t),r=Aa(t+1);return t+(e-n)/(r-n)}function Ia(e){var t=new Date(Date.UTC(e,0,1));t.setUTCFullYear(e);return t}function qa(e){var t=e.getUTCFullYear(),n=Ia(t),r=Ia(t+1);return t+(e-n)/(r-n)}function Ra(e){return e.responseText}function Ua(e){return JSON.parse(e.responseText)}function za(e){var n=t.createRange();n.selectNode(t.body);return n.createContextualFragment(e.responseText)}function Wa(e){return e.responseXML}var e={version:"3.1.5"};if(!Date.now)Date.now=function(){return+(new Date)};var t=document,n=window;try{t.createElement("div").style.setProperty("opacity",0,"")}catch(r){var i=n.CSSStyleDeclaration.prototype,s=i.setProperty;i.setProperty=function(e,t,n){s.call(this,e,t+"",n)}}e.ascending=function(e,t){return e<t?-1:e>t?1:e>=t?0:NaN};e.descending=function(e,t){return t<e?-1:t>e?1:t>=e?0:NaN};e.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)if((s=e[n])!=null&&i>s)i=s}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)if((s=t.call(e,e[n],n))!=null&&i>s)i=s}return i};e.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)if((s=e[n])!=null&&s>i)i=s}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)if((s=t.call(e,e[n],n))!=null&&s>i)i=s}return i};e.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++n<r&&((i=o=e[n])==null||i!=i))i=o=undefined;while(++n<r)if((s=e[n])!=null){if(i>s)i=s;if(o<s)o=s}}else{while(++n<r&&((i=o=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)if((s=t.call(e,e[n],n))!=null){if(i>s)i=s;if(o<s)o=s}}return[i,o]};e.sum=function(e,t){var n=0,r=e.length,i,s=-1;if(arguments.length===1){while(++s<r)if(!isNaN(i=+e[s]))n+=i}else{while(++s<r)if(!isNaN(i=+t.call(e,e[s],s)))n+=i}return n};e.mean=function(e,t){var n=e.length,r,i=0,s=-1,u=0;if(arguments.length===1){while(++s<n)if(o(r=e[s]))i+=(r-i)/++u}else{while(++s<n)if(o(r=t.call(e,e[s],s)))i+=(r-i)/++u}return u?i:undefined};e.quantile=function(e,t){var n=(e.length-1)*t+1,r=Math.floor(n),i=+e[r-1],s=n-r;return s?i+s*(e[r]-i):i};e.median=function(t,n){if(arguments.length>1)t=t.map(n);t=t.filter(o);return t.length?e.quantile(t.sort(e.ascending),.5):undefined};e.bisector=function(e){return{left:function(t,n,r,i){if(arguments.length<3)r=0;if(arguments.length<4)i=t.length;while(r<i){var s=r+i>>>1;if(e.call(t,t[s],s)<n)r=s+1;else i=s}return r},right:function(t,n,r,i){if(arguments.length<3)r=0;if(arguments.length<4)i=t.length;while(r<i){var s=r+i>>>1;if(n<e.call(t,t[s],s))i=s;else r=s+1}return r}}};var u=e.bisector(function(e){return e});e.bisectLeft=u.left;e.bisect=e.bisectRight=u.right;e.shuffle=function(e){var t=e.length,n,r;while(t){r=Math.random()*t--|0;n=e[t],e[t]=e[r],e[r]=n}return e};e.permute=function(e,t){var n=[],r=-1,i=t.length;while(++r<i)n[r]=e[t[r]];return n};e.zip=function(){if(!(s=arguments.length))return[];for(var t=-1,n=e.min(arguments,a),r=new Array(n);++t<n;){for(var i=-1,s,o=r[t]=new Array(s);++i<s;){o[i]=arguments[i][t]}}return r};e.transpose=function(t){return e.zip.apply(e,t)};e.keys=function(e){var t=[];for(var n in e)t.push(n);return t};e.values=function(e){var t=[];for(var n in e)t.push(e[n]);return t};e.entries=function(e){var t=[];for(var n in e)t.push({key:n,value:e[n]});return t};e.merge=function(e){return Array.prototype.concat.apply([],e)};e.range=function(e,t,n){if(arguments.length<3){n=1;if(arguments.length<2){t=e;e=0}}if((t-e)/n===Infinity)throw new Error("infinite range");var r=[],i=f(Math.abs(n)),s=-1,o;e*=i,t*=i,n*=i;if(n<0)while((o=e+n*++s)>t)r.push(o/i);else while((o=e+n*++s)<t)r.push(o/i);return r};e.map=function(e){var t=new c;for(var n in e)t.set(n,e[n]);return t};l(c,{has:function(e){return h+e in this},get:function(e){return this[h+e]},set:function(e,t){return this[h+e]=t},remove:function(e){e=h+e;return e in this&&delete this[e]},keys:function(){var e=[];this.forEach(function(t){e.push(t)});return e},values:function(){var e=[];this.forEach(function(t,n){e.push(n)});return e},entries:function(){var e=[];this.forEach(function(t,n){e.push({key:t,value:n})});return e},forEach:function(e){for(var t in this){if(t.charCodeAt(0)===p){e.call(this,t.substring(1),this[t])}}}});var h="\0",p=h.charCodeAt(0);e.nest=function(){function o(e,r,u){if(u>=n.length)return s?s.call(t,r):i?r.sort(i):r;var a=-1,f=r.length,l=n[u++],h,p,d,v=new c,m;while(++a<f){if(m=v.get(h=l(p=r[a]))){m.push(p)}else{v.set(h,[p])}}if(e){p=e();d=function(t,n){p.set(t,o(e,n,u))}}else{p={};d=function(t,n){p[t]=o(e,n,u)}}v.forEach(d);return p}function u(e,t){if(t>=n.length)return e;var i=[],s=r[t++];e.forEach(function(e,n){i.push({key:e,values:u(n,t)})});return s?i.sort(function(e,t){return s(e.key,t.key)}):i}var t={},n=[],r=[],i,s;t.map=function(e,t){return o(t,e,0)};t.entries=function(t){return u(o(e.map,t,0),0)};t.key=function(e){n.push(e);return t};t.sortKeys=function(e){r[n.length-1]=e;return t};t.sortValues=function(e){i=e;return t};t.rollup=function(e){s=e;return t};return t};e.set=function(e){var t=new d;if(e)for(var n=0;n<e.length;n++)t.add(e[n]);return t};l(d,{has:function(e){return h+e in this},add:function(e){this[h+e]=true;return e},remove:function(e){e=h+e;return e in this&&delete this[e]},values:function(){var e=[];this.forEach(function(t){e.push(t)});return e},forEach:function(e){for(var t in this){if(t.charCodeAt(0)===p){e.call(this,t.substring(1))}}}});e.behavior={};e.rebind=function(e,t){var n=1,r=arguments.length,i;while(++n<r)e[i=arguments[n]]=v(e,t,t[i]);return e};e.dispatch=function(){var e=new m,t=-1,n=arguments.length;while(++t<n)e[arguments[t]]=g(e);return e};m.prototype.on=function(e,t){var n=e.indexOf("."),r="";if(n>=0){r=e.substring(n+1);e=e.substring(0,n)}if(e)return arguments.length<2?this[e].on(r):this[e].on(r,t);if(arguments.length===2){if(t==null)for(e in this){if(this.hasOwnProperty(e))this[e].on(r,null)}return this}};e.event=null;e.mouse=function(e){return T(e,w())};var x=/WebKit/.test(n.navigator.userAgent)?-1:0;var N=k;try{N(t.documentElement.childNodes)[0].nodeType}catch(L){N=C}var A=[].__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]};e.touches=function(e,t){if(arguments.length<2)t=w().touches;return t?N(t).map(function(t){var n=T(e,t);n.identifier=t.identifier;return n}):[]};e.behavior.drag=function(){function i(){this.on("mousedown.drag",s).on("touchstart.drag",s)}function s(){function h(){var t=i.parentNode;return u!=null?e.touches(t).filter(function(e){return e.identifier===u})[0]:e.mouse(t)}function p(){if(!i.parentNode)return d();var e=h(),t=e[0]-f[0],n=e[1]-f[1];l|=t|n;f=e;y();s({type:"drag",x:e[0]+a[0],y:e[1]+a[1],dx:t,dy:n})}function d(){s({type:"dragend"});if(l){y();if(e.event.target===o)E(c,"click")}c.on(u!=null?"touchmove.drag-"+u:"mousemove.drag",null).on(u!=null?"touchend.drag-"+u:"mouseup.drag",null)}var i=this,s=t.of(i,arguments),o=e.event.target,u=e.event.touches?e.event.changedTouches[0].identifier:null,a,f=h(),l=0;var c=e.select(n).on(u!=null?"touchmove.drag-"+u:"mousemove.drag",p).on(u!=null?"touchend.drag-"+u:"mouseup.drag",d,true);if(r){a=r.apply(i,arguments);a=[a.x-f[0],a.y-f[1]]}else{a=[0,0]}if(u==null)y();s({type:"dragstart"})}var t=S(i,"drag","dragstart","dragend"),r=null;i.origin=function(e){if(!arguments.length)return r;r=e;return i};return e.rebind(i,t,"on")};var M=function(e,t){return t.querySelector(e)},_=function(e,t){return t.querySelectorAll(e)},D=t.documentElement,P=D.matchesSelector||D.webkitMatchesSelector||D.mozMatchesSelector||D.msMatchesSelector||D.oMatchesSelector,H=function(e,t){return P.call(e,t)};if(typeof Sizzle==="function"){M=function(e,t){return Sizzle(e,t)[0]||null};_=function(e,t){return Sizzle.uniqueSort(Sizzle(e,t))};H=Sizzle.matchesSelector}var B=[];e.selection=function(){return st};e.selection.prototype=B;B.select=function(e){var t=[],n,r,i,s;if(typeof e!=="function")e=j(e);for(var o=-1,u=this.length;++o<u;){t.push(n=[]);n.parentNode=(i=this[o]).parentNode;for(var a=-1,f=i.length;++a<f;){if(s=i[a]){n.push(r=e.call(s,s.__data__,a));if(r&&"__data__"in s)r.__data__=s.__data__}else{n.push(null)}}}return O(t)};B.selectAll=function(e){var t=[],n,r;if(typeof e!=="function")e=F(e);for(var i=-1,s=this.length;++i<s;){for(var o=this[i],u=-1,a=o.length;++u<a;){if(r=o[u]){t.push(n=N(e.call(r,r.__data__,u)));n.parentNode=r}}}return O(t)};var I={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};e.ns={prefix:I,qualify:function(e){var t=e.indexOf(":"),n=e;if(t>=0){n=e.substring(0,t);e=e.substring(t+1)}return I.hasOwnProperty(n)?{space:I[n],local:e}:e}};B.attr=function(t,n){if(arguments.length<2){if(typeof t==="string"){var r=this.node();t=e.ns.qualify(t);return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(n in t)this.each(q(n,t[n]));return this}return this.each(q(t,n))};e.requote=function(e){return e.replace(U,"\\$&")};var U=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;B.classed=function(e,t){if(arguments.length<2){if(typeof e==="string"){var n=this.node(),r=(e=e.trim().split(/^|\s+/g)).length,i=-1;if(t=n.classList){while(++i<r)if(!t.contains(e[i]))return false}else{t=n.getAttribute("class");while(++i<r)if(!z(e[i]).test(t))return false}return true}for(t in e)this.each(W(t,e[t]));return this}return this.each(W(e,t))};B.style=function(e,t,r){var i=arguments.length;if(i<3){if(typeof e!=="string"){if(i<2)t="";for(r in e)this.each(V(r,e[r],t));return this}if(i<2)return n.getComputedStyle(this.node(),null).getPropertyValue(e);r=""}return this.each(V(e,t,r))};B.property=function(e,t){if(arguments.length<2){if(typeof e==="string")return this.node()[e];for(t in e)this.each($(t,e[t]));return this}return this.each($(e,t))};B.text=function(e){return arguments.length?this.each(typeof e==="function"?function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}:e==null?function(){this.textContent=""}:function(){this.textContent=e}):this.node().textContent};B.html=function(e){return arguments.length?this.each(typeof e==="function"?function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}:e==null?function(){this.innerHTML=""}:function(){this.innerHTML=e}):this.node().innerHTML};B.append=function(n){function r(){return this.appendChild(t.createElementNS(this.namespaceURI,n))}function i(){return this.appendChild(t.createElementNS(n.space,n.local))}n=e.ns.qualify(n);return this.select(n.local?i:r)};B.insert=function(n,r){function i(e,i){return this.insertBefore(t.createElementNS(this.namespaceURI,n),r.call(this,e,i))}function s(e,i){return this.insertBefore(t.createElementNS(n.space,n.local),r.call(this,e,i))}n=e.ns.qualify(n);if(typeof r!=="function")r=j(r);return this.select(n.local?s:i)};B.remove=function(){return this.each(function(){var e=this.parentNode;if(e)e.removeChild(this)})};B.data=function(e,t){function o(e,n){var r,i=e.length,s=n.length,o=Math.min(i,s),l=new Array(s),h=new Array(s),p=new Array(i),d,v;if(t){var m=new c,g=new c,y=[],b;for(r=-1;++r<i;){b=t.call(d=e[r],d.__data__,r);if(m.has(b)){p[r]=d}else{m.set(b,d)}y.push(b)}for(r=-1;++r<s;){b=t.call(n,v=n[r],r);if(d=m.get(b)){l[r]=d;d.__data__=v}else if(!g.has(b)){h[r]=J(v)}g.set(b,v);m.remove(b)}for(r=-1;++r<i;){if(m.has(y[r])){p[r]=e[r]}}}else{for(r=-1;++r<o;){d=e[r];v=n[r];if(d){d.__data__=v;l[r]=d}else{h[r]=J(v)}}for(;r<s;++r){h[r]=J(n[r])}for(;r<i;++r){p[r]=e[r]}}h.update=l;h.parentNode=l.parentNode=p.parentNode=e.parentNode;u.push(h);a.push(l);f.push(p)}var n=-1,r=this.length,i,s;if(!arguments.length){e=new Array(r=(i=this[0]).length);while(++n<r){if(s=i[n]){e[n]=s.__data__}}return e}var u=rt([]),a=O([]),f=O([]);if(typeof e==="function"){while(++n<r){o(i=this[n],e.call(i,i.parentNode.__data__,n))}}else{while(++n<r){o(i=this[n],e)}}a.enter=function(){return u};a.exit=function(){return f};return a};B.datum=function(e){return arguments.length?this.property("__data__",e):this.property("__data__")};B.filter=function(e){var t=[],n,r,i;if(typeof e!=="function")e=K(e);for(var s=0,o=this.length;s<o;s++){t.push(n=[]);n.parentNode=(r=this[s]).parentNode;for(var u=0,a=r.length;u<a;u++){if((i=r[u])&&e.call(i,i.__data__,u)){n.push(i)}}}return O(t)};B.order=function(){for(var e=-1,t=this.length;++e<t;){for(var n=this[e],r=n.length-1,i=n[r],s;--r>=0;){if(s=n[r]){if(i&&i!==s.nextSibling)i.parentNode.insertBefore(s,i);i=s}}}return this};B.sort=function(e){e=Q.apply(this,arguments);for(var t=-1,n=this.length;++t<n;)this[t].sort(e);return this.order()};B.on=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!=="string"){if(r<2)t=false;for(n in e)this.each(Y(n,e[n],t));return this}if(r<2)return(r=this.node()["__on"+e])&&r._;n=false}return this.each(Y(e,t,n))};var Z=e.map({mouseenter:"mouseover",mouseleave:"mouseout"});Z.forEach(function(e){if("on"+e in t)Z.remove(e)});B.each=function(e){return nt(this,function(t,n,r){e.call(t,t.__data__,n,r)})};B.call=function(e){var t=N(arguments);e.apply(t[0]=this,t);return this};B.empty=function(){return!this.node()};B.node=function(){for(var e=0,t=this.length;e<t;e++){for(var n=this[e],r=0,i=n.length;r<i;r++){var s=n[r];if(s)return s}}return null};var it=[];e.selection.enter=rt;e.selection.enter.prototype=it;it.append=B.append;it.insert=B.insert;it.empty=B.empty;it.node=B.node;it.select=function(e){var t=[],n,r,i,s,o;for(var u=-1,a=this.length;++u<a;){i=(s=this[u]).update;t.push(n=[]);n.parentNode=s.parentNode;for(var f=-1,l=s.length;++f<l;){if(o=s[f]){n.push(i[f]=r=e.call(s.parentNode,o.__data__,f));r.__data__=o.__data__}else{n.push(null)}}}return O(t)};B.transition=function(){var e=bu||++yu,t=[],n,r,i=Object.create(wu);i.time=Date.now();for(var s=-1,o=this.length;++s<o;){t.push(n=[]);for(var u=this[s],a=-1,f=u.length;++a<f;){if(r=u[a])xu(r,a,e,i);n.push(r)}}return mu(t,e)};var st=O([[t]]);st[0].parentNode=D;e.select=function(e){return typeof e==="string"?st.select(e):O([[e]])};e.selectAll=function(e){return typeof e==="string"?st.selectAll(e):O([N(e)])};e.behavior.zoom=function(){function p(){this.on("mousedown.zoom",x).on("mousemove.zoom",N).on(at+".zoom",T).on("dblclick.zoom",C).on("touchstart.zoom",k).on("touchmove.zoom",L).on("touchend.zoom",k)}function d(e){return[(e[0]-t[0])/i,(e[1]-t[1])/i]}function v(e){return[e[0]*i+t[0],e[1]*i+t[1]]}function m(e){i=Math.max(o[0],Math.min(o[1],e))}function g(e,n){n=v(n);t[0]+=e[0]-n[0];t[1]+=e[1]-n[1]}function b(){if(f)f.domain(a.range().map(function(e){return(e-t[0])/i}).map(a.invert));if(c)c.domain(l.range().map(function(e){return(e-t[1])/i}).map(l.invert))}function w(n){b();e.event.preventDefault();n({type:"zoom",scale:i,translate:t})}function x(){function f(){s=1;g(e.mouse(t),a);w(r)}function l(){if(s)y();o.on("mousemove.zoom",null).on("mouseup.zoom",null);if(s&&e.event.target===i)E(o,"click.zoom")}var t=this,r=u.of(t,arguments),i=e.event.target,s=0,o=e.select(n).on("mousemove.zoom",f).on("mouseup.zoom",l),a=d(e.mouse(t));n.focus();y()}function T(){if(!r)r=d(e.mouse(this));m(Math.pow(2,ut()*.002)*i);g(e.mouse(this),r);w(u.of(this,arguments))}function N(){r=null}function C(){var t=e.mouse(this),n=d(t),r=Math.log(i)/Math.LN2;m(Math.pow(2,e.event.shiftKey?Math.ceil(r)-1:Math.floor(r)+1));g(t,n);w(u.of(this,arguments))}function k(){var t=e.touches(this),n=Date.now();s=i;r={};t.forEach(function(e){r[e.identifier]=d(e)});y();if(t.length===1){if(n-h<500){var o=t[0],a=d(t[0]);m(i*2);g(o,a);w(u.of(this,arguments))}h=n}}function L(){var t=e.touches(this),n=t[0],i=r[n.identifier];if(o=t[1]){var o,a=r[o.identifier];n=[(n[0]+o[0])/2,(n[1]+o[1])/2];i=[(i[0]+a[0])/2,(i[1]+a[1])/2];m(e.event.scale*s)}g(n,i);h=null;w(u.of(this,arguments))}var t=[0,0],r,i=1,s,o=ot,u=S(p,"zoom"),a,f,l,c,h;p.translate=function(e){if(!arguments.length)return t;t=e.map(Number);b();return p};p.scale=function(e){if(!arguments.length)return i;i=+e;b();return p};p.scaleExtent=function(e){if(!arguments.length)return o;o=e==null?ot:e.map(Number);return p};p.x=function(e){if(!arguments.length)return f;f=e;a=e.copy();t=[0,0];i=1;return p};p.y=function(e){if(!arguments.length)return c;c=e;l=e.copy();t=[0,0];i=1;return p};return e.rebind(p,u,"on")};var ot=[0,Infinity];var ut,at="onwheel"in t?(ut=function(){return-e.event.deltaY*(e.event.deltaMode?120:1)},"wheel"):"onmousewheel"in t?(ut=function(){return e.event.wheelDelta},"mousewheel"):(ut=function(){return-e.event.detail},"MozMousePixelScroll");ft.prototype.toString=function(){return this.rgb()+""};e.hsl=function(e,t,n){return arguments.length===1?e instanceof ct?lt(e.h,e.s,e.l):Wt(""+e,Xt,lt):lt(+e,+t,+n)};var ht=ct.prototype=new ft;ht.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);return lt(this.h,this.s,this.l/e)};ht.darker=function(e){e=Math.pow(.7,arguments.length?e:1);return lt(this.h,this.s,e*this.l)};ht.rgb=function(){return pt(this.h,this.s,this.l)};var dt=Math.PI,vt=1e-6,mt=dt/180,gt=180/dt;e.hcl=function(t,n,r){return arguments.length===1?t instanceof Nt?Tt(t.h,t.c,t.l):t instanceof At?Bt(t.l,t.a,t.b):Bt((t=Vt((t=e.rgb(t)).r,t.g,t.b)).l,t.a,t.b):Tt(+t,+n,+r)};var Ct=Nt.prototype=new ft;Ct.brighter=function(e){return Tt(this.h,this.c,Math.min(100,this.l+Ot*(arguments.length?e:1)))};Ct.darker=function(e){return Tt(this.h,this.c,Math.max(0,this.l-Ot*(arguments.length?e:1)))};Ct.rgb=function(){return kt(this.h,this.c,this.l).rgb()};e.lab=function(t,n,r){return arguments.length===1?t instanceof At?Lt(t.l,t.a,t.b):t instanceof Nt?kt(t.l,t.c,t.h):Vt((t=e.rgb(t)).r,t.g,t.b):Lt(+t,+n,+r)};var Ot=18;var Mt=.95047,_t=1,Dt=1.08883;var Pt=At.prototype=new ft;Pt.brighter=function(e){return Lt(Math.min(100,this.l+Ot*(arguments.length?e:1)),this.a,this.b)};Pt.darker=function(e){return Lt(Math.max(0,this.l-Ot*(arguments.length?e:1)),this.a,this.b)};Pt.rgb=function(){return Ht(this.l,this.a,this.b)};e.rgb=function(e,t,n){return arguments.length===1?e instanceof Rt?qt(e.r,e.g,e.b):Wt(""+e,qt,pt):qt(~~e,~~t,~~n)};var Ut=Rt.prototype=new ft;Ut.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,n=this.g,r=this.b,i=30;if(!t&&!n&&!r)return qt(i,i,i);if(t&&t<i)t=i;if(n&&n<i)n=i;if(r&&r<i)r=i;return qt(Math.min(255,Math.floor(t/e)),Math.min(255,Math.floor(n/e)),Math.min(255,Math.floor(r/e)))};Ut.darker=function(e){e=Math.pow(.7,arguments.length?e:1);return qt(Math.floor(e*this.r),Math.floor(e*this.g),Math.floor(e*this.b))};Ut.hsl=function(){return Xt(this.r,this.g,this.b)};Ut.toString=function(){return"#"+zt(this.r)+zt(this.g)+zt(this.b)};var Kt=e.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});Kt.forEach(function(e,t){Kt.set(e,Wt(t,qt,pt))});e.functor=Qt;e.xhr=function(t,r,i){function l(){var e=f.status;!e&&f.responseText||e>=200&&e<300||e===304?o.load.call(s,a.call(s,f)):o.error.call(s,f)}var s={},o=e.dispatch("progress","load","error"),u={},a=Gt,f=new(n.XDomainRequest&&/^(http(s)?:)?\/\//.test(t)?XDomainRequest:XMLHttpRequest);"onload"in f?f.onload=f.onerror=l:f.onreadystatechange=function(){f.readyState>3&&l()};f.onprogress=function(t){var n=e.event;e.event=t;try{o.progress.call(s,f)}finally{e.event=n}};s.header=function(e,t){e=(e+"").toLowerCase();if(arguments.length<2)return u[e];if(t==null)delete u[e];else u[e]=t+"";return s};s.mimeType=function(e){if(!arguments.length)return r;r=e==null?null:e+"";return s};s.response=function(e){a=e;return s};["get","post"].forEach(function(e){s[e]=function(){return s.send.apply(s,[e].concat(N(arguments)))}});s.send=function(e,n,i){if(arguments.length===2&&typeof n==="function")i=n,n=null;f.open(e,t,true);if(r!=null&&!("accept"in u))u["accept"]=r+",*/*";if(f.setRequestHeader)for(var o in u)f.setRequestHeader(o,u[o]);if(r!=null&&f.overrideMimeType)f.overrideMimeType(r);if(i!=null)s.on("error",i).on("load",function(e){i(null,e)});f.send(n==null?null:n);return s};s.abort=function(){f.abort();return s};e.rebind(s,o,"on");if(arguments.length===2&&typeof r==="function")i=r,r=null;return i==null?s:s.get(Yt(i))};e.csv=Zt(",","text/csv");e.tsv=Zt(" ","text/tab-separated-values");var en=0,tn={},nn=null,rn,sn;e.timer=function(e,t,n){if(arguments.length<3){if(arguments.length<2)t=0;else if(!isFinite(t))return;n=Date.now()}var r=tn[e.id];if(r&&r.callback===e){r.then=n;r.delay=t}else tn[e.id=++en]=nn={callback:e,then:n,delay:t,next:nn};if(!rn){sn=clearTimeout(sn);rn=1;an(on)}};e.timer.flush=function(){var e,t=Date.now(),n=nn;while(n){e=t-n.then;if(!n.delay)n.flush=n.callback(e);n=n.next}un()};var an=n.requestAnimationFrame||n.webkitRequestAnimationFrame||n.mozRequestAnimationFrame||n.oRequestAnimationFrame||n.msRequestAnimationFrame||function(e){setTimeout(e,17)};var fn=".",ln=",",cn=[3,3];var hn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(pn);e.formatPrefix=function(t,n){var r=0;if(t){if(t<0)t*=-1;if(n)t=e.round(t,mn(t,n));r=1+Math.floor(1e-12+Math.log(t)/Math.LN10);r=Math.max(-24,Math.min(24,Math.floor((r<=0?r+1:r-1)/3)*3))}return hn[8+r/3]};e.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)};e.format=function(t){var n=dn.exec(t),r=n[1]||" ",i=n[2]||">",s=n[3]||"",o=n[4]||"",u=n[5],a=+n[6],f=n[7],l=n[8],c=n[9],h=1,p="",d=false;if(l)l=+l.substring(1);if(u||r==="0"&&i==="="){u=r="0";i="=";if(f)a-=Math.floor((a-1)/4)}switch(c){case"n":f=true;c="g";break;case"%":h=100;p="%";c="f";break;case"p":h=100;p="%";c="r";break;case"b":case"o":case"x":case"X":if(o)o="0"+c.toLowerCase();case"c":case"d":d=true;l=0;break;case"s":h=-1;c="r";break}if(o==="#")o="";if(c=="r"&&!l)c="g";if(l!=null){if(c=="g")l=Math.max(1,Math.min(21,l));else if(c=="e"||c=="f")l=Math.max(0,Math.min(20,l))}c=vn.get(c)||gn;var v=u&&f;return function(t){if(d&&t%1)return"";var n=t<0||t===0&&1/t<0?(t=-t,"-"):s;if(h<0){var m=e.formatPrefix(t,l);t=m.scale(t);p=m.symbol}else{t*=h}t=c(t,l);if(!u&&f)t=yn(t);var g=o.length+t.length+(v?0:n.length),y=g<a?(new Array(g=a-g+1)).join(r):"";if(v)t=yn(y+t);if(fn)t.replace(".",fn);n+=o;return(i==="<"?n+t+y:i===">"?y+n+t:i==="^"?y.substring(0,g>>=1)+n+t+y.substring(g):n+(v?t:y+t))+p}};var dn=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i;var vn=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,n){return(t=e.round(t,mn(t,n))).toFixed(Math.max(0,Math.min(20,mn(t*(1+1e-15),n))))}});var yn=Gt;if(cn){var bn=cn.length;yn=function(e){var t=e.lastIndexOf("."),n=t>=0?"."+e.substring(t+1):(t=e.length,""),r=[],i=0,s=cn[0];while(t>0&&s>0){r.push(e.substring(t-=s,t+s));s=cn[i=(i+1)%bn]}return r.reverse().join(ln||"")+n}}e.geo={};e.geo.stream=function(e,t){if(e&&En.hasOwnProperty(e.type)){En[e.type](e,t)}else{wn(e,t)}};var En={Feature:function(e,t){wn(e.geometry,t)},FeatureCollection:function(e,t){var n=e.features,r=-1,i=n.length;while(++r<i)wn(n[r].geometry,t)}};var Sn={Sphere:function(e,t){t.sphere()},Point:function(e,t){var n=e.coordinates;t.point(n[0],n[1])},MultiPoint:function(e,t){var n=e.coordinates,r=-1,i=n.length,s;while(++r<i)s=n[r],t.point(s[0],s[1])},LineString:function(e,t){xn(e.coordinates,t,0)},MultiLineString:function(e,t){var n=e.coordinates,r=-1,i=n.length;while(++r<i)xn(n[r],t,0)},Polygon:function(e,t){Tn(e.coordinates,t)},MultiPolygon:function(e,t){var n=e.coordinates,r=-1,i=n.length;while(++r<i)Tn(n[r],t)},GeometryCollection:function(e,t){var n=e.geometries,r=-1,i=n.length;while(++r<i)wn(n[r],t)}};e.geo.area=function(t){Nn=0;e.geo.stream(t,Ln);return Nn};var Nn,Cn,kn;var Ln={sphere:function(){Nn+=4*dt},point:G,lineStart:G,lineEnd:G,polygonStart:function(){Cn=1,kn=0;Ln.lineStart=An},polygonEnd:function(){var e=2*Math.atan2(kn,Cn);Nn+=e<0?4*dt+e:e;Ln.lineStart=Ln.lineEnd=Ln.point=G}};e.geo.bounds=On(Gt);e.geo.centroid=function(t){Mn=_n=Dn=Pn=Hn=0;e.geo.stream(t,Bn);var n;if(_n&&Math.abs(n=Math.sqrt(Dn*Dn+Pn*Pn+Hn*Hn))>vt){return[Math.atan2(Pn,Dn)*gt,Math.asin(Math.max(-1,Math.min(1,Hn/n)))*gt]}};var Mn,_n,Dn,Pn,Hn;var Bn={sphere:function(){if(Mn<2){Mn=2;_n=Dn=Pn=Hn=0}},point:jn,lineStart:In,lineEnd:qn,polygonStart:function(){if(Mn<2){Mn=2;_n=Dn=Pn=Hn=0}Bn.lineStart=Fn},polygonEnd:function(){Bn.lineStart=In}};var rr=Yn($n,ir,or);var ar=1e9;e.geo.projection=pr;e.geo.projectionMutator=dr;(e.geo.equirectangular=function(){return pr(mr)}).raw=mr.invert=mr;e.geo.rotation=function(e){function t(t){t=e(t[0]*mt,t[1]*mt);return t[0]*=gt,t[1]*=gt,t}e=gr(e[0]%360*mt,e[1]*mt,e.length>2?e[2]*mt:0);t.invert=function(t){t=e.invert(t[0]*mt,t[1]*mt);return t[0]*=gt,t[1]*=gt,t};return t};e.geo.circle=function(){function i(){var t=typeof e==="function"?e.apply(this,arguments):e,n=gr(-t[0]*mt,-t[1]*mt,0).invert,i=[];r(null,null,1,{point:function(e,t){i.push(e=n(e,t));e[0]*=gt,e[1]*=gt}});return{type:"Polygon",coordinates:[i]}}var e=[0,0],t,n=6,r;i.origin=function(t){if(!arguments.length)return e;e=t;return i};i.angle=function(e){if(!arguments.length)return t;r=Er((t=+e)*mt,n*mt);return i};i.precision=function(e){if(!arguments.length)return n;r=Er(t*mt,(n=+e)*mt);return i};return i.angle(90)};e.geo.distance=function(e,t){var n=(t[0]-e[0])*mt,r=e[1]*mt,i=t[1]*mt,s=Math.sin(n),o=Math.cos(n),u=Math.sin(r),a=Math.cos(r),f=Math.sin(i),l=Math.cos(i),c;return Math.atan2(Math.sqrt((c=l*s)*c+(c=a*f-u*l*o)*c),u*f+a*l*o)};e.geo.graticule=function(){function y(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(i/c)*c,r,c).map(v).concat(e.range(Math.ceil(a/h)*h,u,h).map(m)).concat(e.range(Math.ceil(n/f)*f,t,f).filter(function(e){return Math.abs(e%c)>vt}).map(p)).concat(e.range(Math.ceil(o/l)*l,s,l).filter(function(e){return Math.abs(e%h)>vt}).map(d))}var t,n,r,i,s,o,u,a,f=10,l=f,c=90,h=360,p,d,v,m,g=2.5;y.lines=function(){return b().map(function(e){return{type:"LineString",coordinates:e}})};y.outline=function(){return{type:"Polygon",coordinates:[v(i).concat(m(u).slice(1),v(r).reverse().slice(1),m(a).reverse().slice(1))]}};y.extent=function(e){if(!arguments.length)return y.minorExtent();return y.majorExtent(e).minorExtent(e)};y.majorExtent=function(e){if(!arguments.length)return[[i,a],[r,u]];i=+e[0][0],r=+e[1][0];a=+e[0][1],u=+e[1][1];if(i>r)e=i,i=r,r=e;if(a>u)e=a,a=u,u=e;return y.precision(g)};y.minorExtent=function(e){if(!arguments.length)return[[n,o],[t,s]];n=+e[0][0],t=+e[1][0];o=+e[0][1],s=+e[1][1];if(n>t)e=n,n=t,t=e;if(o>s)e=o,o=s,s=e;return y.precision(g)};y.step=function(e){if(!arguments.length)return y.minorStep();return y.majorStep(e).minorStep(e)};y.majorStep=function(e){if(!arguments.length)return[c,h];c=+e[0],h=+e[1];return y};y.minorStep=function(e){if(!arguments.length)return[f,l];f=+e[0],l=+e[1];return y};y.precision=function(e){if(!arguments.length)return g;g=+e;p=xr(o,s,90);d=Tr(n,t,g);v=xr(a,u,90);m=Tr(i,r,g);return y};return y.majorExtent([[-180,-90+vt],[180,90-vt]]).minorExtent([[-180,-80-vt],[180,80+vt]])};e.geo.greatArc=function(){function s(){return{type:"LineString",coordinates:[n||t.apply(this,arguments),i||r.apply(this,arguments)]}}var t=Nr,n,r=Cr,i;s.distance=function(){return e.geo.distance(n||t.apply(this,arguments),i||r.apply(this,arguments))};s.source=function(e){if(!arguments.length)return t;t=e,n=typeof e==="function"?null:e;return s};s.target=function(e){if(!arguments.length)return r;r=e,i=typeof e==="function"?null:e;return s};s.precision=function(){return arguments.length?s:0};return s};e.geo.interpolate=function(e,t){return kr(e[0]*mt,e[1]*mt,t[0]*mt,t[1]*mt)};e.geo.length=function(t){Lr=0;e.geo.stream(t,Ar);return Lr};var Lr;var Ar={sphere:G,point:G,lineStart:Or,lineEnd:G,polygonStart:G,polygonEnd:G};(e.geo.conicEqualArea=function(){return Mr(_r)}).raw=_r;e.geo.albersUsa=function(){function a(e){return f(e)(e)}function f(e){var s=e[0],o=e[1];return o>50?n:s<-140?r:o<21?i:t}var t=e.geo.conicEqualArea().rotate([98,0]).center([0,38]).parallels([29.5,45.5]);var n=e.geo.conicEqualArea().rotate([160,0]).center([0,60]).parallels([55,65]);var r=e.geo.conicEqualArea().rotate([160,0]).center([0,20]).parallels([8,18]);var i=e.geo.conicEqualArea().rotate([60,0]).center([0,10]).parallels([8,18]);var s,o,u;a.invert=function(e){return s(e)||o(e)||u(e)||t.invert(e)};a.scale=function(e){if(!arguments.length)return t.scale();t.scale(e);n.scale(e*.6);r.scale(e);i.scale(e*1.5);return a.translate(t.translate())};a.translate=function(e){if(!arguments.length)return t.translate();var f=t.scale(),l=e[0],c=e[1];t.translate(e);n.translate([l-.4*f,c+.17*f]);r.translate([l-.19*f,c+.2*f]);i.translate([l+.58*f,c+.43*f]);s=Dr(n,[[-180,50],[-130,72]]);o=Dr(r,[[-164,18],[-154,24]]);u=Dr(i,[[-67.5,17.5],[-65,19]]);return a};return a.scale(1e3)};var Pr,Hr,Br={point:G,lineStart:G,lineEnd:G,polygonStart:function(){Hr=0;Br.lineStart=jr},polygonEnd:function(){Br.lineStart=Br.lineEnd=Br.point=G;Pr+=Math.abs(Hr/2)}};var Ir={point:qr,lineStart:Rr,lineEnd:Ur,polygonStart:function(){Ir.lineStart=zr},polygonEnd:function(){Ir.point=qr;Ir.lineStart=Rr;Ir.lineEnd=Ur}};e.geo.path=function(){function o(n){if(n)e.geo.stream(n,i(s.pointRadius(typeof t==="function"?+t.apply(this,arguments):t)));return s.result()}var t=4.5,n,r,i,s;o.area=function(t){Pr=0;e.geo.stream(t,i(Br));return Pr};o.centroid=function(t){Mn=Dn=Pn=Hn=0;e.geo.stream(t,i(Ir));return Hn?[Dn/Hn,Pn/Hn]:undefined};o.bounds=function(e){return On(i)(e)};o.projection=function(e){if(!arguments.length)return n;i=(n=e)?e.stream||Vr(e):Gt;return o};o.context=function(e){if(!arguments.length)return r;s=(r=e)==null?new Fr:new Wr(e);return o};o.pointRadius=function(e){if(!arguments.length)return t;t=typeof e==="function"?e:+e;return o};return o.projection(e.geo.albersUsa()).context(null)};e.geo.albers=function(){return e.geo.conicEqualArea().parallels([29.5,45.5]).rotate([98,0]).center([0,38]).scale(1e3)};var Jr=$r(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(e.geo.azimuthalEqualArea=function(){return pr(Jr)}).raw=Jr;var Kr=$r(function(e){var t=Math.acos(e);return t&&t/Math.sin(t)},Gt);(e.geo.azimuthalEquidistant=function(){return pr(Kr)}).raw=Kr;(e.geo.conicConformal=function(){return Mr(Qr)}).raw=Qr;(e.geo.conicEquidistant=function(){return Mr(Gr)}).raw=Gr;var Yr=$r(function(e){return 1/e},Math.atan);(e.geo.gnomonic=function(){return pr(Yr)}).raw=Yr;Zr.invert=function(e,t){return[e,2*Math.atan(Math.exp(t))-dt/2]};(e.geo.mercator=function(){return ei(Zr)}).raw=Zr;var ti=$r(function(){return 1},Math.asin);(e.geo.orthographic=function(){return pr(ti)}).raw=ti;var ni=$r(function(e){return 1/(1+e)},function(e){return 2*Math.atan(e)});(e.geo.stereographic=function(){return pr(ni)}).raw=ni;ri.invert=function(e,t){return[Math.atan2(Et(e),Math.cos(t)),wt(Math.sin(t)/St(e))]};(e.geo.transverseMercator=function(){return ei(ri)}).raw=ri;e.geom={};e.svg={};e.svg.line=function(){return ii(Gt)};var ui=e.map({linear:ai,"linear-closed":fi,"step-before":li,"step-after":ci,basis:gi,"basis-open":yi,"basis-closed":bi,bundle:wi,cardinal:di,"cardinal-open":hi,"cardinal-closed":pi,monotone:Ai});ui.forEach(function(e,t){t.key=e;t.closed=/-closed$/.test(e)});var Si=[0,2/3,1/3,0],xi=[0,1/3,2/3,0],Ti=[0,1/6,2/3,1/6];e.geom.hull=function(e){function r(e){if(e.length<3)return[];var r=Qt(t),i=Qt(n),s=e.length,o,u=s-1,a=[],f=[],l,c,h,p=0,d,v,m,g,y,b,w,E;if(r===si&&n===oi)o=e;else for(c=0,o=[];c<s;++c){o.push([+r.call(this,l=e[c],c),+i.call(this,l,c)])}for(c=1;c<s;++c){if(o[c][1]<o[p][1]){p=c}else if(o[c][1]==o[p][1]){p=o[c][0]<o[p][0]?c:p}}for(c=0;c<s;++c){if(c===p)continue;v=o[c][1]-o[p][1];d=o[c][0]-o[p][0];a.push({angle:Math.atan2(v,d),index:c})}a.sort(function(e,t){return e.angle-t.angle});w=a[0].angle;b=a[0].index;y=0;for(c=1;c<u;++c){h=a[c].index;if(w==a[c].angle){d=o[b][0]-o[p][0];v=o[b][1]-o[p][1];m=o[h][0]-o[p][0];g=o[h][1]-o[p][1];if(d*d+v*v>=m*m+g*g){a[c].index=-1}else{a[y].index=-1;w=a[c].angle;y=c;b=h}}else{w=a[c].angle;y=c;b=h}}f.push(p);for(c=0,h=0;c<2;++h){if(a[h].index!==-1){f.push(a[h].index);c++}}E=f.length;for(;h<u;++h){if(a[h].index===-1)continue;while(!Oi(f[E-2],f[E-1],a[h].index,o)){--E}f[E++]=a[h].index}var S=[];for(c=0;c<E;++c){S.push(e[f[c]])}return S}var t=si,n=oi;if(arguments.length)return r(e);r.x=function(e){return arguments.length?(t=e,r):t};r.y=function(e){return arguments.length?(n=e,r):n};return r};e.geom.polygon=function(e){e.area=function(){var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];while(++t<n){r+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1]}return r*.5};e.centroid=function(t){var n=-1,r=e.length,i=0,s=0,o,u=e[r-1],a;if(!arguments.length)t=-1/(6*e.area());while(++n<r){o=u;u=e[n];a=o[0]*u[1]-u[0]*o[1];i+=(o[0]+u[0])*a;s+=(o[1]+u[1])*a}return[i*t,s*t]};e.clip=function(t){var n,r=-1,i=e.length,s,o,u=e[i-1],a,f,l;while(++r<i){n=t.slice();t.length=0;a=e[r];f=n[(o=n.length)-1];s=-1;while(++s<o){l=n[s];if(Mi(l,u,a)){if(!Mi(f,u,a)){t.push(_i(f,l,u,a))}t.push(l)}else if(Mi(f,u,a)){t.push(_i(f,l,u,a))}f=l}u=a}return t};return e};e.geom.delaunay=function(e){var t=e.map(function(){return[]}),n=[];Pi(e,function(n){t[n.region.l.index].push(e[n.region.r.index])});t.forEach(function(t,r){var i=e[r],s=i[0],o=i[1];t.forEach(function(e){e.angle=Math.atan2(e[0]-s,e[1]-o)});t.sort(function(e,t){return e.angle-t.angle});for(var u=0,a=t.length-1;u<a;u++){n.push([i,t[u],t[u+1]])}});return n};e.geom.voronoi=function(t){function o(t){var n,o=t.map(function(){return[]}),u=Qt(r),a=Qt(i),f,l,c=t.length,h=1e6;if(u===si&&a===oi)n=t;else for(n=[],l=0;l<c;++l){n.push([+u.call(this,f=t[l],l),+a.call(this,f,l)])}Pi(n,function(e){var t,n,r,i,s,u;if(e.a===1&&e.b>=0){t=e.ep.r;n=e.ep.l}else{t=e.ep.l;n=e.ep.r}if(e.a===1){s=t?t.y:-h;r=e.c-e.b*s;u=n?n.y:h;i=e.c-e.b*u}else{r=t?t.x:-h;s=e.c-e.a*r;i=n?n.x:h;u=e.c-e.a*i}var a=[r,s],f=[i,u];o[e.region.l.index].push(a,f);o[e.region.r.index].push(a,f)});o=o.map(function(t,r){var i=n[r][0],s=n[r][1],o=t.map(function(e){return Math.atan2(e[0]-i,e[1]-s)}),u=e.range(t.length).sort(function(e,t){return o[e]-o[t]});return u.filter(function(e,t){return!t||o[e]-o[u[t-1]]>vt}).map(function(e){return t[e]})});o.forEach(function(e,t){var r=e.length;if(!r)return e.push([-h,-h],[-h,h],[h,h],[h,-h]);if(r>2)return;var i=n[t],s=e[0],o=e[1],u=i[0],a=i[1],f=s[0],l=s[1],c=o[0],p=o[1],d=Math.abs(c-f),v=p-l;if(Math.abs(v)<vt){var m=a<l?-h:h;e.push([-h,m],[h,m])}else if(d<vt){var g=u<f?-h:h;e.push([g,-h],[g,h])}else{var m=(c-f)*(l-a)<(f-u)*(p-l)?h:-h,y=Math.abs(v)-d;if(Math.abs(y)<vt){e.push([v<0?m:-m,m])}else{if(y>0)m*=-1;e.push([-h,m],[h,m])}}});if(s)for(l=0;l<c;++l)s(o[l]);for(l=0;l<c;++l)o[l].point=t[l];return o}var n=null,r=si,i=oi,s;if(arguments.length)return o(t);o.x=function(e){return arguments.length?(r=e,o):r};o.y=function(e){return arguments.length?(i=e,o):i};o.size=function(t){if(!arguments.length)return n;if(t==null){s=null}else{n=[+t[0],+t[1]];s=e.geom.polygon([[0,0],[0,n[1]],n,[n[0],0]]).clip}return o};o.links=function(e){var t,n=e.map(function(){return[]}),s=[],o=Qt(r),u=Qt(i),a,f,l=e.length;if(o===si&&u===oi)t=e;else for(f=0;f<l;++f){t.push([+o.call(this,a=e[f],f),+u.call(this,a,f)])}Pi(t,function(t){var r=t.region.l.index,i=t.region.r.index;if(n[r][i])return;n[r][i]=n[i][r]=true;s.push({source:e[r],target:e[i]})});return s};o.triangles=function(t){if(r===si&&i===oi)return e.geom.delaunay(t);var n,s,o=Qt(r),u=Qt(i),a,f,l;for(f=0,n=[],l=t.length;f<l;++f){s=[+o.call(this,a=t[f],f),+u.call(this,a,f)];s.data=a;n.push(s)}return e.geom.delaunay(n).map(function(e){return e.map(function(e){return e.data})})};return o};var Di={l:"r",r:"l"};e.geom.quadtree=function(e,t,n,r,i){function a(e){function x(e,t,n,r,i,s,o,u){if(isNaN(n)||isNaN(r))return;if(e.leaf){var a=e.x,f=e.y;if(a!=null){if(Math.abs(a-n)+Math.abs(f-r)<.01){T(e,t,n,r,i,s,o,u)}else{var l=e.point;e.x=e.y=e.point=null;T(e,l,a,f,i,s,o,u);T(e,t,n,r,i,s,o,u)}}else{e.x=n,e.y=r,e.point=t}}else{T(e,t,n,r,i,s,o,u)}}function T(e,t,n,r,i,s,o,u){var a=(i+o)*.5,f=(s+u)*.5,l=n>=a,c=r>=f,h=(c<<1)+l;e.leaf=false;e=e.nodes[h]||(e.nodes[h]=ji());if(l)i=a;else o=a;if(c)s=f;else u=f;x(e,t,n,r,i,s,o,u)}var a,f=Qt(s),l=Qt(o),c,h,p,d,v,m,g,y;if(t!=null){v=t,m=n,g=r,y=i}else{g=y=-(v=m=Infinity);c=[],h=[];d=e.length;if(u)for(p=0;p<d;++p){a=e[p];if(a.x<v)v=a.x;if(a.y<m)m=a.y;if(a.x>g)g=a.x;if(a.y>y)y=a.y;c.push(a.x);h.push(a.y)}else for(p=0;p<d;++p){var b=+f(a=e[p],p),w=+l(a,p);if(b<v)v=b;if(w<m)m=w;if(b>g)g=b;if(w>y)y=w;c.push(b);h.push(w)}}var E=g-v,S=y-m;if(E>S)y=m+E;else g=v+S;var N=ji();N.add=function(e){x(N,e,+f(e,++p),+l(e,p),v,m,g,y)};N.visit=function(e){Fi(e,N,v,m,g,y)};p=-1;if(t==null){while(++p<d){x(N,e[p],c[p],h[p],v,m,g,y)}--p}else e.forEach(N.add);c=h=e=a=null;return N}var s=si,o=oi,u;if(u=arguments.length){s=Hi;o=Bi;if(u===3){i=n;r=t;n=t=0}return a(e)}a.x=function(e){return arguments.length?(s=e,a):s};a.y=function(e){return arguments.length?(o=e,a):o};a.size=function(e){if(!arguments.length)return t==null?null:[r,i];if(e==null){t=n=r=i=null}else{t=n=0;r=+e[0],i=+e[1]}return a};return a};e.interpolateRgb=Ii;e.transform=function(n){var r=t.createElementNS(e.ns.prefix.svg,"g");return(e.transform=function(e){r.setAttribute("transform",e);var t=r.transform.baseVal.consolidate();return new qi(t?t.matrix:Wi)})(n)};qi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var Wi={a:1,b:0,c:0,d:1,e:0,f:0};e.interpolateNumber=Xi;e.interpolateTransform=Vi;e.interpolateObject=$i;e.interpolateString=Ji;var Ki=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;e.interpolate=Qi;e.interpolators=[function(e,t){var n=typeof t;return(n==="string"||n!==typeof e?Kt.has(t)||/^(#|rgb\(|hsl\()/.test(t)?Ii:Ji:t instanceof ft?Ii:n==="object"?Array.isArray(t)?Yi:$i:Xi)(e,t)}];e.interpolateArray=Yi;var Zi=function(){return Gt};var es=e.map({linear:Zi,poly:as,quad:function(){return ss},cubic:function(){return os},sin:function(){return fs},exp:function(){return ls},circle:function(){return cs},elastic:hs,back:ps,bounce:function(){return ds}});var ts=e.map({"in":Gt,out:rs,"in-out":is,"out-in":function(e){return is(rs(e))}});e.ease=function(e){var t=e.indexOf("-"),n=t>=0?e.substring(0,t):e,r=t>=0?e.substring(t+1):"in";n=es.get(n)||Zi;r=ts.get(r)||Gt;return ns(r(n.apply(null,Array.prototype.slice.call(arguments,1))))};e.interpolateHcl=vs;e.interpolateHsl=ms;e.interpolateLab=gs;e.interpolateRound=ys;e.layout={};e.layout.bundle=function(){return function(e){var t=[],n=-1,r=e.length;while(++n<r)t.push(Es(e[n]));return t}};e.layout.chord=function(){function l(){var t={},l=[],h=e.range(s),p=[],d,v,m,g,y;n=[];r=[];d=0,g=-1;while(++g<s){v=0,y=-1;while(++y<s){v+=i[g][y]}l.push(v);p.push(e.range(s));d+=v}if(u){h.sort(function(e,t){return u(l[e],l[t])})}if(a){p.forEach(function(e,t){e.sort(function(e,n){return a(i[t][e],i[t][n])})})}d=(2*dt-o*s)/d;v=0,g=-1;while(++g<s){m=v,y=-1;while(++y<s){var b=h[g],w=p[b][y],E=i[b][w],S=v,x=v+=E*d;t[b+"-"+w]={index:b,subindex:w,startAngle:S,endAngle:x,value:E}}r[b]={index:b,startAngle:m,endAngle:v,value:(v-m)/d};v+=o}g=-1;while(++g<s){y=g-1;while(++y<s){var T=t[g+"-"+y],N=t[y+"-"+g];if(T.value||N.value){n.push(T.value<N.value?{source:N,target:T}:{source:T,target:N})}}}if(f)c()}function c(){n.sort(function(e,t){return f((e.source.value+e.target.value)/2,(t.source.value+t.target.value)/2)})}var t={},n,r,i,s,o=0,u,a,f;t.matrix=function(e){if(!arguments.length)return i;s=(i=e)&&i.length;n=r=null;return t};t.padding=function(e){if(!arguments.length)return o;o=e;n=r=null;return t};t.sortGroups=function(e){if(!arguments.length)return u;u=e;n=r=null;return t};t.sortSubgroups=function(e){if(!arguments.length)return a;a=e;n=null;return t};t.sortChords=function(e){if(!arguments.length)return f;f=e;if(n)c();return t};t.chords=function(){if(!n)l();return n};t.groups=function(){if(!r)l();return r};return t};e.layout.force=function(){function g(e){return function(t,n,r,i){if(t.point!==e){var s=t.cx-e.x,o=t.cy-e.y,u=1/Math.sqrt(s*s+o*o);if((i-n)*u<c){var a=t.charge*u*u;e.px-=s*a;e.py-=o*a;return true}if(t.point&&isFinite(u)){var a=t.pointCharge*u*u;e.px-=s*a;e.py-=o*a}}return!t.charge}}function y(n){n.px=e.event.x,n.py=e.event.y;t.resume()}var t={},n=e.dispatch("start","tick","end"),r=[1,1],i,s,o=.9,u=As,a=Os,f=-30,l=.1,c=.8,h=[],p=[],d,v,m;t.tick=function(){if((s*=.99)<.005){n.end({type:"end",alpha:s=0});return true}var t=h.length,i=p.length,u,a,c,y,b,w,E,S,x;for(a=0;a<i;++a){c=p[a];y=c.source;b=c.target;S=b.x-y.x;x=b.y-y.y;if(w=S*S+x*x){w=s*v[a]*((w=Math.sqrt(w))-d[a])/w;S*=w;x*=w;b.x-=S*(E=y.weight/(b.weight+y.weight));b.y-=x*E;y.x+=S*(E=1-E);y.y+=x*E}}if(E=s*l){S=r[0]/2;x=r[1]/2;a=-1;if(E)while(++a<t){c=h[a];c.x+=(S-c.x)*E;c.y+=(x-c.y)*E}}if(f){Ls(u=e.geom.quadtree(h),s,m);a=-1;while(++a<t){if(!(c=h[a]).fixed){u.visit(g(c))}}}a=-1;while(++a<t){c=h[a];if(c.fixed){c.x=c.px;c.y=c.py}else{c.x-=(c.px-(c.px=c.x))*o;c.y-=(c.py-(c.py=c.y))*o}}n.tick({type:"tick",alpha:s})};t.nodes=function(e){if(!arguments.length)return h;h=e;return t};t.links=function(e){if(!arguments.length)return p;p=e;return t};t.size=function(e){if(!arguments.length)return r;r=e;return t};t.linkDistance=function(e){if(!arguments.length)return u;u=typeof e==="function"?e:+e;return t};t.distance=t.linkDistance;t.linkStrength=function(e){if(!arguments.length)return a;a=typeof e==="function"?e:+e;return t};t.friction=function(e){if(!arguments.length)return o;o=+e;return t};t.charge=function(e){if(!arguments.length)return f;f=typeof e==="function"?e:+e;return t};t.gravity=function(e){if(!arguments.length)return l;l=+e;return t};t.theta=function(e){if(!arguments.length)return c;c=+e;return t};t.alpha=function(r){if(!arguments.length)return s;r=+r;if(s){if(r>0)s=r;else s=0}else if(r>0){n.start({type:"start",alpha:s=r});e.timer(t.tick)}return t};t.start=function(){function y(t,n){var r=b(e),i=-1,s=r.length,o;while(++i<s)if(!isNaN(o=r[i][t]))return o;return Math.random()*n}function b(){if(!c){c=[];for(n=0;n<i;++n){c[n]=[]}for(n=0;n<s;++n){var t=p[n];c[t.source.index].push(t.target);c[t.target.index].push(t.source)}}return c[e]}var e,n,i=h.length,s=p.length,o=r[0],l=r[1],c,g;for(e=0;e<i;++e){(g=h[e]).index=e;g.weight=0}for(e=0;e<s;++e){g=p[e];if(typeof g.source=="number")g.source=h[g.source];if(typeof g.target=="number")g.target=h[g.target];++g.source.weight;++g.target.weight}for(e=0;e<i;++e){g=h[e];if(isNaN(g.x))g.x=y("x",o);if(isNaN(g.y))g.y=y("y",l);if(isNaN(g.px))g.px=g.x;if(isNaN(g.py))g.py=g.y}d=[];if(typeof u==="function")for(e=0;e<s;++e)d[e]=+u.call(this,p[e],e);else for(e=0;e<s;++e)d[e]=u;v=[];if(typeof a==="function")for(e=0;e<s;++e)v[e]=+a.call(this,p[e],e);else for(e=0;e<s;++e)v[e]=a;m=[];if(typeof f==="function")for(e=0;e<i;++e)m[e]=+f.call(this,h[e],e);else for(e=0;e<i;++e)m[e]=f;return t.resume()};t.resume=function(){return t.alpha(.1)};t.stop=function(){return t.alpha(0)};t.drag=function(){if(!i)i=e.behavior.drag().origin(Gt).on("dragstart.force",Ts).on("drag.force",y).on("dragend.force",Ns);if(!arguments.length)return i;this.on("mouseover.force",Cs).on("mouseout.force",ks).call(i)};return e.rebind(t,n,"on")};var As=20,Os=1;e.layout.hierarchy=function(){function r(i,o,u){var a=t.call(s,i,o);i.depth=o;u.push(i);if(a&&(l=a.length)){var f=-1,l,c=i.children=[],h=0,p=o+1,d;while(++f<l){d=r(a[f],p,u);d.parent=i;c.push(d);h+=d.value}if(e)c.sort(e);if(n)i.value=h}else if(n){i.value=+n.call(s,i,o)||0}return i}function i(e,t){var r=e.children,o=0;if(r&&(a=r.length)){var u=-1,a,f=t+1;while(++u<a)o+=i(r[u],f)}else if(n){o=+n.call(s,e,t)||0}if(n)e.value=o;return o}function s(e){var t=[];r(e,0,t);return t}var e=Ps,t=_s,n=Ds;s.sort=function(t){if(!arguments.length)return e;e=t;return s};s.children=function(e){if(!arguments.length)return t;t=e;return s};s.value=function(e){if(!arguments.length)return n;n=e;return s};s.revalue=function(e){i(e,0);return e};return s};e.layout.partition=function(){function r(e,t,n,i){var s=e.children;e.x=t;e.y=e.depth*i;e.dx=n;e.dy=i;if(s&&(u=s.length)){var o=-1,u,a,f;n=e.value?n/e.value:0;while(++o<u){r(a=s[o],t,f=a.value*n,i);t+=f}}}function i(e){var t=e.children,n=0;if(t&&(s=t.length)){var r=-1,s;while(++r<s)n=Math.max(n,i(t[r]))}return 1+n}function s(e,s){var o=t.call(this,e,s);r(o[0],0,n[0],n[1]/i(o[0]));return o}var t=e.layout.hierarchy(),n=[1,1];s.size=function(e){if(!arguments.length)return n;n=e;return s};return Ms(s,t)};e.layout.pie=function(){function s(o){var u=o.map(function(e,n){return+t.call(s,e,n)});var a=+(typeof r==="function"?r.apply(this,arguments):r);var f=((typeof i==="function"?i.apply(this,arguments):i)-a)/e.sum(u);var l=e.range(o.length);if(n!=null)l.sort(n===Bs?function(e,t){return u[t]-u[e]}:function(e,t){return n(o[e],o[t])});var c=[];l.forEach(function(e){var t;c[e]={data:o[e],value:t=u[e],startAngle:a,endAngle:a+=t*f}});return c}var t=Number,n=Bs,r=0,i=2*dt;s.value=function(e){if(!arguments.length)return t;t=e;return s};s.sort=function(e){if(!arguments.length)return n;n=e;return s};s.startAngle=function(e){if(!arguments.length)return r;r=e;return s};s.endAngle=function(e){if(!arguments.length)return i;i=e;return s};return s};var Bs={};e.layout.stack=function(){function u(a,f){var l=a.map(function(e,n){return t.call(u,e,n)});var c=l.map(function(e){return e.map(function(e,t){return[s.call(u,e,t),o.call(u,e,t)]})});var h=n.call(u,c,f);l=e.permute(l,h);c=e.permute(c,h);var p=r.call(u,c,f);var d=l.length,v=l[0].length,m,g,y;for(g=0;g<v;++g){i.call(u,l[0][g],y=p[g],c[0][g][1]);for(m=1;m<d;++m){i.call(u,l[m][g],y+=c[m-1][g][1],c[m][g][1])}}return a}var t=Gt,n=Us,r=zs,i=Is,s=js,o=Fs;u.values=function(e){if(!arguments.length)return t;t=e;return u};u.order=function(e){if(!arguments.length)return n;n=typeof e==="function"?e:qs.get(e)||Us;return u};u.offset=function(e){if(!arguments.length)return r;r=typeof e==="function"?e:Rs.get(e)||zs;return u};u.x=function(e){if(!arguments.length)return s;s=e;return u};u.y=function(e){if(!arguments.length)return o;o=e;return u};u.out=function(e){if(!arguments.length)return i;i=e;return u};return u};var qs=e.map({"inside-out":function(t){var n=t.length,r,i,s=t.map(Ws),o=t.map(Xs),u=e.range(n).sort(function(e,t){return s[e]-s[t]}),a=0,f=0,l=[],c=[];for(r=0;r<n;++r){i=u[r];if(a<f){a+=o[i];l.push(i)}else{f+=o[i];c.push(i)}}return c.reverse().concat(l)},reverse:function(t){return e.range(t.length).reverse()},"default":Us});var Rs=e.map({silhouette:function(e){var t=e.length,n=e[0].length,r=[],i=0,s,o,u,a=[];for(o=0;o<n;++o){for(s=0,u=0;s<t;s++)u+=e[s][o][1];if(u>i)i=u;r.push(u)}for(o=0;o<n;++o){a[o]=(i-r[o])/2}return a},wiggle:function(e){var t=e.length,n=e[0],r=n.length,i,s,o,u,a,f,l,c,h,p=[];p[0]=c=h=0;for(s=1;s<r;++s){for(i=0,u=0;i<t;++i)u+=e[i][s][1];for(i=0,a=0,l=n[s][0]-n[s-1][0];i<t;++i){for(o=0,f=(e[i][s][1]-e[i][s-1][1])/(2*l);o<i;++o){f+=(e[o][s][1]-e[o][s-1][1])/l}a+=f*e[i][s][1]}p[s]=c-=u?a/u*l:0;if(c<h)h=c}for(s=0;s<r;++s)p[s]-=h;return p},expand:function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,u=[];for(s=0;s<n;++s){for(i=0,o=0;i<t;i++)o+=e[i][s][1];if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)u[s]=0;return u},zero:zs});e.layout.histogram=function(){function s(s,o){var u=[],a=s.map(n,this),f=r.call(this,a,o),l=i.call(this,f,a,o),c,o=-1,h=a.length,p=l.length-1,d=t?1:1/h,v;while(++o<p){c=u[o]=[];c.dx=l[o+1]-(c.x=l[o]);c.y=0}if(p>0){o=-1;while(++o<h){v=a[o];if(v>=f[0]&&v<=f[1]){c=u[e.bisect(l,v,1,p)-1];c.y+=d;c.push(s[o])}}}return u}var t=true,n=Number,r=Ks,i=$s;s.value=function(e){if(!arguments.length)return n;n=e;return s};s.range=function(e){if(!arguments.length)return r;r=Qt(e);return s};s.bins=function(e){if(!arguments.length)return i;i=typeof e==="number"?function(t){return Js(t,e)}:Qt(e);return s};s.frequency=function(e){if(!arguments.length)return t;t=!!e;return s};return s};e.layout.tree=function(){function i(e,i){function u(e,t){var r=e.children,i=e._tree;if(r&&(s=r.length)){var s,o=r[0],a,l=o,c,h=-1;while(++h<s){c=r[h];u(c,a);l=f(c,a,l);a=c}io(e);var p=.5*(o._tree.prelim+c._tree.prelim);if(t){i.prelim=t._tree.prelim+n(e,t);i.mod=i.prelim-p}else{i.prelim=p}}else{if(t){i.prelim=t._tree.prelim+n(e,t)}}}function a(e,t){e.x=e._tree.prelim+t;var n=e.children;if(n&&(i=n.length)){var r=-1,i;t+=e._tree.mod;while(++r<i){a(n[r],t)}}}function f(e,t,r){if(t){var i=e,s=e,o=t,u=e.parent.children[0],a=i._tree.mod,f=s._tree.mod,l=o._tree.mod,c=u._tree.mod,h;while(o=Ys(o),i=Gs(i),o&&i){u=Gs(u);s=Ys(s);s._tree.ancestor=e;h=o._tree.prelim+l-i._tree.prelim-a+n(o,i);if(h>0){so(oo(o,e,r),e,h);a+=h;f+=h}l+=o._tree.mod;a+=i._tree.mod;c+=u._tree.mod;f+=s._tree.mod}if(o&&!Ys(s)){s._tree.thread=o;s._tree.mod+=l-f}if(i&&!Gs(u)){u._tree.thread=i;u._tree.mod+=a-c;r=e}}return r}var s=t.call(this,e,i),o=s[0];ro(o,function(e,t){e._tree={ancestor:e,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}});u(o);a(o,-o._tree.prelim);var l=Zs(o,to),c=Zs(o,eo),h=Zs(o,no),p=l.x-n(l,c)/2,d=c.x+n(c,l)/2,v=h.depth||1;ro(o,function(e){e.x=(e.x-p)/(d-p)*r[0];e.y=e.depth/v*r[1];delete e._tree});return s}var t=e.layout.hierarchy().sort(null).value(null),n=Qs,r=[1,1];i.separation=function(e){if(!arguments.length)return n;n=e;return i};i.size=function(e){if(!arguments.length)return r;r=e;return i};return Ms(i,t)};e.layout.pack=function(){function i(e,i){var s=t.call(this,e,i),o=s[0];o.x=0;o.y=0;ro(o,function(e){e.r=Math.sqrt(e.value)});ro(o,co);var u=r[0],a=r[1],f=Math.max(2*o.r/u,2*o.r/a);if(n>0){var l=n*f/2;ro(o,function(e){e.r+=l});ro(o,co);ro(o,function(e){e.r-=l});f=Math.max(2*o.r/u,2*o.r/a)}vo(o,u/2,a/2,1/f);return s}var t=e.layout.hierarchy().sort(uo),n=0,r=[1,1];i.size=function(e){if(!arguments.length)return r;r=e;return i};i.padding=function(e){if(!arguments.length)return n;n=+e;return i};return Ms(i,t)};e.layout.cluster=function(){function i(e,i){var s=t.call(this,e,i),o=s[0],u,a=0;ro(o,function(e){var t=e.children;if(t&&t.length){e.x=yo(t);e.y=go(t)}else{e.x=u?a+=n(e,u):0;e.y=0;u=e}});var f=bo(o),l=wo(o),c=f.x-n(f,l)/2,h=l.x+n(l,f)/2;ro(o,function(e){e.x=(e.x-c)/(h-c)*r[0];e.y=(1-(o.y?e.y/o.y:1))*r[1]});return s}var t=e.layout.hierarchy().sort(null).value(null),n=Qs,r=[1,1];i.separation=function(e){if(!arguments.length)return n;n=e;return i};i.size=function(e){if(!arguments.length)return r;r=e;return i};return Ms(i,t)};e.layout.treemap=function(){function l(e,t){var n=-1,r=e.length,i,s;while(++n<r){s=(i=e[n]).value*(t<0?0:t);i.area=isNaN(s)||s<=0?0:s}}function c(e){var t=e.children;if(t&&t.length){var n=s(e),r=[],i=t.slice(),o,u=Infinity,f,h=a==="slice"?n.dx:a==="dice"?n.dy:a==="slice-dice"?e.depth&1?n.dy:n.dx:Math.min(n.dx,n.dy),v;l(i,n.dx*n.dy/e.value);r.area=0;while((v=i.length)>0){r.push(o=i[v-1]);r.area+=o.area;if(a!=="squarify"||(f=p(r,h))<=u){i.pop();u=f}else{r.area-=r.pop().area;d(r,h,n,false);h=Math.min(n.dx,n.dy);r.length=r.area=0;u=Infinity}}if(r.length){d(r,h,n,true);r.length=r.area=0}t.forEach(c)}}function h(e){var t=e.children;if(t&&t.length){var n=s(e),r=t.slice(),i,o=[];l(r,n.dx*n.dy/e.value);o.area=0;while(i=r.pop()){o.push(i);o.area+=i.area;if(i.z!=null){d(o,i.z?n.dx:n.dy,n,!r.length);o.length=o.area=0}}t.forEach(h)}}function p(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++o<u){if(!(r=e[o].area))continue;if(r<s)s=r;if(r>i)i=r}n*=n;t*=t;return n?Math.max(t*i*f/n,n/(t*s*f)):Infinity}function d(e,t,r,i){var s=-1,o=e.length,u=r.x,a=r.y,f=t?n(e.area/t):0,l;if(t==r.dx){if(i||f>r.dy)f=r.dy;while(++s<o){l=e[s];l.x=u;l.y=a;l.dy=f;u+=l.dx=Math.min(r.x+r.dx-u,f?n(l.area/f):0)}l.z=true;l.dx+=r.x+r.dx-u;r.y+=f;r.dy-=f}else{if(i||f>r.dx)f=r.dx;while(++s<o){l=e[s];l.x=u;l.y=a;l.dx=f;a+=l.dy=Math.min(r.y+r.dy-a,f?n(l.area/f):0)}l.z=false;l.dy+=r.y+r.dy-a;r.x+=f;r.dx-=f}}function v(e){var n=u||t(e),i=n[0];i.x=0;i.y=0;i.dx=r[0];i.dy=r[1];if(u)t.revalue(i);l([i],i.dx*i.dy/i.value);(u?h:c)(i);if(o)u=n;return n}var t=e.layout.hierarchy(),n=Math.round,r=[1,1],i=null,s=Eo,o=false,u,a="squarify",f=.5*(1+Math.sqrt(5));v.size=function(e){if(!arguments.length)return r;r=e;return v};v.padding=function(e){function t(t){var n=e.call(v,t,t.depth);return n==null?Eo(t):So(t,typeof n==="number"?[n,n,n,n]:n)}function n(t){return So(t,e)}if(!arguments.length)return i;var r;s=(i=e)==null?Eo:(r=typeof e)==="function"?t:r==="number"?(e=[e,e,e,e],n):n;return v};v.round=function(e){if(!arguments.length)return n!=Number;n=e?Math.round:Number;return v};v.sticky=function(e){if(!arguments.length)return o;o=e;u=null;return v};v.ratio=function(e){if(!arguments.length)return f;f=e;return v};v.mode=function(e){if(!arguments.length)return a;a=e+"";return v};return Ms(v,t)};e.random={normal:function(e,t){var n=arguments.length;if(n<2)t=1;if(n<1)e=0;return function(){var n,r,i;do{n=Math.random()*2-1;r=Math.random()*2-1;i=n*n+r*r}while(!i||i>1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},irwinHall:function(e){return function(){for(var t=0,n=0;n<e;n++)t+=Math.random();return t/e}}};e.scale={};e.scale.linear=function(){return Lo([0,1],[0,1],Qi,false)};e.scale.log=function(){return Po(e.scale.linear().domain([0,Math.LN10]),10,Bo,jo)};var Ho=e.format(".0e");e.scale.pow=function(){return Ro(e.scale.linear(),1)};e.scale.sqrt=function(){return e.scale.pow().exponent(.5)};e.scale.ordinal=function(){return zo([],{t:"range",a:[[]]})};e.scale.category10=function(){return e.scale.ordinal().range(Wo)};e.scale.category20=function(){return e.scale.ordinal().range(Xo)};e.scale.category20b=function(){return e.scale.ordinal().range(Vo)};e.scale.category20c=function(){return e.scale.ordinal().range($o)};e.scale.category50=function(){return e.scale.ordinal().range(Jo)};var Wo=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var Xo=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];var Vo=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"];var $o=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];var Jo=["#1f77b4","#ff7f0e","#2ca02c","#8c864b","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf","#DC143C","#800080","#0000FF","#008000","#D2691E","#FF0000","#000000","#DB7093","#FF00FF","#7B68EE","#1f77b6","#9edae5","#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#aec7e8","#e7ba52","#ffbb78","#e7cb94","#98df8a","#843c39","#ff9896","#ad494a","#c5b0d5","#d6616b","#c49c94","#e7969c","#f7b6d2","#fd8d3c","#c7c7c7","#7b4173","#dbdb8d","#a55194"];e.scale.quantile=function(){return Ko([],[])};e.scale.quantize=function(){return Qo(0,1,[0,1])};e.scale.threshold=function(){return Go([.5],[0,1])};e.scale.identity=function(){return Yo([0,1])};e.svg.arc=function(){function i(){var i=e.apply(this,arguments),s=t.apply(this,arguments),o=n.apply(this,arguments)+Zo,u=r.apply(this,arguments)+Zo,a=(u<o&&(a=o,o=u,u=a),u-o),f=a<dt?"0":"1",l=Math.cos(o),c=Math.sin(o),h=Math.cos(u),p=Math.sin(u);return a>=eu?i?"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"M0,"+i+"A"+i+","+i+" 0 1,0 0,"+ -i+"A"+i+","+i+" 0 1,0 0,"+i+"Z":"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"Z":i?"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L"+i*h+","+i*p+"A"+i+","+i+" 0 "+f+",0 "+i*l+","+i*c+"Z":"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L0,0"+"Z"}var e=tu,t=nu,n=ru,r=iu;i.innerRadius=function(t){if(!arguments.length)return e;e=Qt(t);return i};i.outerRadius=function(e){if(!arguments.length)return t;t=Qt(e);return i};i.startAngle=function(e){if(!arguments.length)return n;n=Qt(e);return i};i.endAngle=function(e){if(!arguments.length)return r;r=Qt(e);return i};i.centroid=function(){var i=(e.apply(this,arguments)+t.apply(this,arguments))/2,s=(n.apply(this,arguments)+r.apply(this,arguments))/2+Zo;return[Math.cos(s)*i,Math.sin(s)*i]};return i};var Zo=-dt/2,eu=2*dt-1e-6;e.svg.line.radial=function(){var e=ii(su);e.radius=e.x,delete e.x;e.angle=e.y,delete e.y;return e};li.reverse=ci;ci.reverse=li;e.svg.area=function(){return ou(Gt)};e.svg.area.radial=function(){var e=ou(su);e.radius=e.x,delete e.x;e.innerRadius=e.x0,delete e.x0;e.outerRadius=e.x1,delete e.x1;e.angle=e.y,delete e.y;e.startAngle=e.y0,delete e.y0;e.endAngle=e.y1,delete e.y1;return e};e.svg.chord=function(){function s(n,r){var i=o(this,e,n,r),s=o(this,t,n,r);return"M"+i.p0+a(i.r,i.p1,i.a1-i.a0)+(u(i,s)?f(i.r,i.p1,i.r,i.p0):f(i.r,i.p1,s.r,s.p0)+a(s.r,s.p1,s.a1-s.a0)+f(s.r,s.p1,i.r,i.p0))+"Z"}function o(e,t,s,o){var u=t.call(e,s,o),a=n.call(e,u,o),f=r.call(e,u,o)+Zo,l=i.call(e,u,o)+Zo;return{r:a,a0:f,a1:l,p0:[a*Math.cos(f),a*Math.sin(f)],p1:[a*Math.cos(l),a*Math.sin(l)]}}function u(e,t){return e.a0==t.a0&&e.a1==t.a1}function a(e,t,n){return"A"+e+","+e+" 0 "+ +(n>dt)+",1 "+t}function f(e,t,n,r){return"Q 0,0 "+r}var e=Nr,t=Cr,n=uu,r=ru,i=iu;s.radius=function(e){if(!arguments.length)return n;n=Qt(e);return s};s.source=function(t){if(!arguments.length)return e;e=Qt(t);return s};s.target=function(e){if(!arguments.length)return t;t=Qt(e);return s};s.startAngle=function(e){if(!arguments.length)return r;r=Qt(e);return s};s.endAngle=function(e){if(!arguments.length)return i;i=Qt(e);return s};return s};e.svg.diagonal=function(){function r(r,i){var s=e.call(this,r,i),o=t.call(this,r,i),u=(s.y+o.y)/2,a=[s,{x:s.x,y:u},{x:o.x,y:u},o];a=a.map(n);return"M"+a[0]+"C"+a[1]+" "+a[2]+" "+a[3]}var e=Nr,t=Cr,n=au;r.source=function(t){if(!arguments.length)return e;e=Qt(t);return r};r.target=function(e){if(!arguments.length)return t;t=Qt(e);return r};r.projection=function(e){if(!arguments.length)return n;n=e;return r};return r};e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),n=au,r=t.projection;t.projection=function(e){return arguments.length?r(fu(n=e)):n};return t};e.svg.symbol=function(){function n(n,r){return(pu.get(e.call(this,n,r))||hu)(t.call(this,n,r))}var e=cu,t=lu;n.type=function(t){if(!arguments.length)return e;e=Qt(t);return n};n.size=function(e){if(!arguments.length)return t;t=Qt(e);return n};return n};var pu=e.map({circle:hu,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+ -3*t+","+ -t+"H"+ -t+"V"+ -3*t+"H"+t+"V"+ -t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+ -t+"V"+t+"H"+ -3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vu)),n=t*vu;return"M0,"+ -t+"L"+n+",0"+" 0,"+t+" "+ -n+",0"+"Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+ -t+","+ -t+"L"+t+","+ -t+" "+t+","+t+" "+ -t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/du),n=t*du/2;return"M0,"+n+"L"+t+","+ -n+" "+ -t+","+ -n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/du),n=t*du/2;return"M0,"+ -n+"L"+t+","+n+" "+ -t+","+n+"Z"}});e.svg.symbolTypes=pu.keys();var du=Math.sqrt(3),vu=Math.tan(30*mt);var gu=[],yu=0,bu,wu={ease:us,delay:0,duration:250};gu.call=B.call;gu.empty=B.empty;gu.node=B.node;e.transition=function(e){return arguments.length?bu?e.transition():e:st.transition()};e.transition.prototype=gu;gu.select=function(e){var t=this.id,n=[],r,i,s;if(typeof e!=="function")e=j(e);for(var o=-1,u=this.length;++o<u;){n.push(r=[]);for(var a=this[o],f=-1,l=a.length;++f<l;){if((s=a[f])&&(i=e.call(s,s.__data__,f))){if("__data__"in s)i.__data__=s.__data__;xu(i,f,t,s.__transition__[t]);r.push(i)}else{r.push(null)}}}return mu(n,t)};gu.selectAll=function(e){var t=this.id,n=[],r,i,s,o,u;if(typeof e!=="function")e=F(e);for(var a=-1,f=this.length;++a<f;){for(var l=this[a],c=-1,h=l.length;++c<h;){if(s=l[c]){u=s.__transition__[t];i=e.call(s,s.__data__,c);n.push(r=[]);for(var p=-1,d=i.length;++p<d;){xu(o=i[p],p,t,u);r.push(o)}}}}return mu(n,t)};gu.filter=function(e){var t=[],n,r,i;if(typeof e!=="function")e=K(e);for(var s=0,o=this.length;s<o;s++){t.push(n=[]);for(var r=this[s],u=0,a=r.length;u<a;u++){if((i=r[u])&&e.call(i,i.__data__,u)){n.push(i)}}}return mu(t,this.id,this.time).ease(this.ease())};gu.tween=function(e,t){var n=this.id;if(arguments.length<2)return this.node().__transition__[n].tween.get(e);return nt(this,t==null?function(t){t.__transition__[n].tween.remove(e)}:function(r){r.__transition__[n].tween.set(e,t)})};gu.attr=function(t,n){function s(){this.removeAttribute(i)}function o(){this.removeAttributeNS(i.space,i.local)}if(arguments.length<2){for(n in t)this.attr(n,t[n]);return this}var r=Gi(t),i=e.ns.qualify(t);return Eu(this,"attr."+t,n,function(e){function t(){var t=this.getAttribute(i),n;return t!==e&&(n=r(t,e),function(e){this.setAttribute(i,n(e))})}function n(){var t=this.getAttributeNS(i.space,i.local),n;return t!==e&&(n=r(t,e),function(e){this.setAttributeNS(i.space,i.local,n(e))})}return e==null?i.local?o:s:(e+="",i.local?n:t)})};gu.attrTween=function(t,n){function i(e,t){var i=n.call(this,e,t,this.getAttribute(r));return i&&function(e){this.setAttribute(r,i(e))}}function s(e,t){var i=n.call(this,e,t,this.getAttributeNS(r.space,r.local));return i&&function(e){this.setAttributeNS(r.space,r.local,i(e))}}var r=e.ns.qualify(t);return this.tween("attr."+t,r.local?s:i)};gu.style=function(e,t,r){function o(){this.style.removeProperty(e)}var i=arguments.length;if(i<3){if(typeof e!=="string"){if(i<2)t="";for(r in e)this.style(r,e[r],t);return this}r=""}var s=Gi(e);return Eu(this,"style."+e,t,function(t){function i(){var i=n.getComputedStyle(this,null).getPropertyValue(e),o;return i!==t&&(o=s(i,t),function(t){this.style.setProperty(e,o(t),r)})}return t==null?o:(t+="",i)})};gu.styleTween=function(e,t,r){if(arguments.length<3)r="";return this.tween("style."+e,function(i,s){var o=t.call(this,i,s,n.getComputedStyle(this,null).getPropertyValue(e));return o&&function(t){this.style.setProperty(e,o(t),r)}})};gu.text=function(e){return Eu(this,"text",e,Su)};gu.remove=function(){return this.each("end.transition",function(){var e;if(!this.__transition__&&(e=this.parentNode))e.removeChild(this)})};gu.ease=function(t){var n=this.id;if(arguments.length<1)return this.node().__transition__[n].ease;if(typeof t!=="function")t=e.ease.apply(e,arguments);return nt(this,function(e){e.__transition__[n].ease=t})};gu.delay=function(e){var t=this.id;return nt(this,typeof e==="function"?function(n,r,i){n.__transition__[t].delay=e.call(n,n.__data__,r,i)|0}:(e|=0,function(n){n.__transition__[t].delay=e}))};gu.duration=function(e){var t=this.id;return nt(this,typeof e==="function"?function(n,r,i){n.__transition__[t].duration=Math.max(1,e.call(n,n.__data__,r,i)|0)}:(e=Math.max(1,e|0),function(n){n.__transition__[t].duration=e}))};gu.each=function(e,t){var n=this.id;if(arguments.length<2){var r=wu,i=bu;bu=n;nt(this,function(t,r,i){wu=t.__transition__[n];e.call(t,t.__data__,r,i)});wu=r;bu=i}else{nt(this,function(r){r.__transition__[n].event.on(e,t)})}return this};gu.transition=function(){var e=this.id,t=++yu,n=[],r,i,s,o;for(var u=0,a=this.length;u<a;u++){n.push(r=[]);for(var i=this[u],f=0,l=i.length;f<l;f++){if(s=i[f]){o=Object.create(s.__transition__[e]);o.delay+=o.duration;xu(s,f,t,o)}r.push(s)}}return mu(n,t)};e.svg.axis=function(){function c(c){c.each(function(){var c=e.select(this);var h=a==null?t.ticks?t.ticks.apply(t,u):t.domain():a,p=f==null?t.tickFormat?t.tickFormat.apply(t,u):String:f;var d=Lu(t,h,l),v=c.selectAll(".tick.minor").data(d,String),m=v.enter().insert("line",".tick").attr("class","tick minor").style("opacity",1e-6),g=e.transition(v.exit()).style("opacity",1e-6).remove(),y=e.transition(v).style("opacity",1);var b=c.selectAll(".tick.major").data(h,String),w=b.enter().insert("g","path").attr("class","tick major").style("opacity",1e-6),E=e.transition(b.exit()).style("opacity",1e-6).remove(),S=e.transition(b).style("opacity",1),x;var T=To(t),N=c.selectAll(".domain").data([0]),C=(N.enter().append("path").attr("class","domain"),e.transition(N));var k=t.copy(),L=this.__chart__||k;this.__chart__=k;w.append("line");w.append("text");var A=w.select("line"),O=S.select("line"),M=b.select("text").text(p),_=w.select("text"),D=S.select("text");switch(n){case"bottom":{x=Cu;m.attr("y2",i);y.attr("x2",0).attr("y2",i);A.attr("y2",r);_.attr("y",Math.max(r,0)+o);O.attr("x2",0).attr("y2",r);D.attr("x",0).attr("y",Math.max(r,0)+o);M.attr("dy",".71em").style("text-anchor","middle");C.attr("d","M"+T[0]+","+s+"V0H"+T[1]+"V"+s);break};case"top":{x=Cu;m.attr("y2",-i);y.attr("x2",0).attr("y2",-i);A.attr("y2",-r);_.attr("y",-(Math.max(r,0)+o));O.attr("x2",0).attr("y2",-r);D.attr("x",0).attr("y",-(Math.max(r,0)+o));M.attr("dy","0em").style("text-anchor","middle");C.attr("d","M"+T[0]+","+ -s+"V0H"+T[1]+"V"+ -s);break};case"left":{x=ku;m.attr("x2",-i);y.attr("x2",-i).attr("y2",0);A.attr("x2",-r);_.attr("x",-(Math.max(r,0)+o));O.attr("x2",-r).attr("y2",0);D.attr("x",-(Math.max(r,0)+o)).attr("y",0);M.attr("dy",".32em").style("text-anchor","end");C.attr("d","M"+ -s+","+T[0]+"H0V"+T[1]+"H"+ -s);break};case"right":{x=ku;m.attr("x2",i);y.attr("x2",i).attr("y2",0);A.attr("x2",r);_.attr("x",Math.max(r,0)+o);O.attr("x2",r).attr("y2",0);D.attr("x",Math.max(r,0)+o).attr("y",0);M.attr("dy",".32em").style("text-anchor","start");C.attr("d","M"+s+","+T[0]+"H0V"+T[1]+"H"+s);break}}if(t.ticks){w.call(x,L);S.call(x,k);E.call(x,k);m.call(x,L);y.call(x,k);g.call(x,k)}else{var P=k.rangeBand()/2,H=function(e){return k(e)+P};w.call(x,H);S.call(x,H)}})}var t=e.scale.linear(),n=Tu,r=6,i=6,s=6,o=3,u=[10],a=null,f,l=0;c.scale=function(e){if(!arguments.length)return t;t=e;return c};c.orient=function(e){if(!arguments.length)return n;n=e in Nu?e+"":Tu;return c};c.ticks=function(){if(!arguments.length)return u;u=arguments;return c};c.tickValues=function(e){if(!arguments.length)return a;a=e;return c};c.tickFormat=function(e){if(!arguments.length)return f;f=e;return c};c.tickSize=function(e,t){if(!arguments.length)return r;var n=arguments.length-1;r=+e;i=n>1?+t:r;s=n>0?+arguments[n]:r;return c};c.tickPadding=function(e){if(!arguments.length)return o;o=+e;return c};c.tickSubdivide=function(e){if(!arguments.length)return l;l=+e;return c};return c};var Tu="bottom",Nu={top:1,right:1,bottom:1,left:1};e.svg.brush=function(){function a(t){t.each(function(){var t=e.select(this),n=t.selectAll(".background").data([0]),o=t.selectAll(".extent").data([0]),u=t.selectAll(".resize").data(s,String),p;t.style("pointer-events","all").on("mousedown.brush",h).on("touchstart.brush",h);n.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");o.enter().append("rect").attr("class","extent").style("cursor","move");u.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return Au[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");u.style("display",a.empty()?"none":null);u.exit().remove();if(r){p=To(r);n.attr("x",p[0]).attr("width",p[1]-p[0]);l(t)}if(i){p=To(i);n.attr("y",p[0]).attr("height",p[1]-p[0]);c(t)}f(t)})}function f(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+o[+/e$/.test(e)][0]+","+o[+/^s/.test(e)][1]+")"})}function l(e){e.select(".extent").attr("x",o[0][0]);e.selectAll(".extent,.n>rect,.s>rect").attr("width",o[1][0]-o[0][0])}function c(e){e.select(".extent").attr("y",o[0][1]);e.selectAll(".extent,.e>rect,.w>rect").attr("height",o[1][1]-o[0][1])}function h(){function C(){var t=e.event.changedTouches;return t?e.touches(s,t)[0]:e.mouse(s)}function k(){if(e.event.keyCode==32){if(!b){w=null;E[0]-=o[1][0];E[1]-=o[1][1];b=2}y()}}function L(){if(e.event.keyCode==32&&b==2){E[0]+=o[1][0];E[1]+=o[1][1];b=0;y()}}function A(){var t=C(),n=false;if(S){t[0]+=S[0];t[1]+=S[1]}if(!b){if(e.event.altKey){if(!w)w=[(o[0][0]+o[1][0])/2,(o[0][1]+o[1][1])/2];E[0]=o[+(t[0]<w[0])][0];E[1]=o[+(t[1]<w[1])][1]}else w=null}if(m&&O(t,r,0)){l(d);n=true}if(g&&O(t,i,1)){c(d);n=true}if(n){f(d);p({type:"brush",mode:b?"move":"resize"})}}function O(e,t,n){var r=To(t),i=r[0],s=r[1],a=E[n],f=o[1][n]-o[0][n],l,c;if(b){i-=a;s-=f+a}l=Math.max(i,Math.min(s,e[n]));if(b){c=(l+=a)+f}else{if(w)a=Math.max(i,Math.min(s,2*w[n]-l));if(a<l){c=l;l=a}else{c=a}}if(o[0][n]!==l||o[1][n]!==c){u=null;o[0][n]=l;o[1][n]=c;return true}}function M(){A();d.style("pointer-events","all").selectAll(".resize").style("display",a.empty()?"none":null);e.select("body").style("cursor",null);x.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null);p({type:"brushend"});y()}var s=this,h=e.select(e.event.target),p=t.of(s,arguments),d=e.select(s),v=h.datum(),m=!/^(n|s)$/.test(v)&&r,g=!/^(e|w)$/.test(v)&&i,b=h.classed("extent"),w,E=C(),S;var x=e.select(n).on("mousemove.brush",A).on("mouseup.brush",M).on("touchmove.brush",A).on("touchend.brush",M).on("keydown.brush",k).on("keyup.brush",L);if(b){E[0]=o[0][0]-E[0];E[1]=o[0][1]-E[1]}else if(v){var T=+/w$/.test(v),N=+/^n/.test(v);S=[o[1-T][0]-E[0],o[1-N][1]-E[1]];E[0]=o[T][0];E[1]=o[N][1]}else if(e.event.altKey)w=E.slice();d.style("pointer-events","none").selectAll(".resize").style("display",null);e.select("body").style("cursor",h.style("cursor"));p({type:"brushstart"});A();y()}var t=S(a,"brushstart","brush","brushend"),r=null,i=null,s=Ou[0],o=[[0,0],[0,0]],u;a.x=function(e){if(!arguments.length)return r;r=e;s=Ou[!r<<1|!i];return a};a.y=function(e){if(!arguments.length)return i;i=e;s=Ou[!r<<1|!i];return a};a.extent=function(e){var t,n,s,f,l;if(!arguments.length){e=u||o;if(r){t=e[0][0],n=e[1][0];if(!u){t=o[0][0],n=o[1][0];if(r.invert)t=r.invert(t),n=r.invert(n);if(n<t)l=t,t=n,n=l}}if(i){s=e[0][1],f=e[1][1];if(!u){s=o[0][1],f=o[1][1];if(i.invert)s=i.invert(s),f=i.invert(f);if(f<s)l=s,s=f,f=l}}return r&&i?[[t,s],[n,f]]:r?[t,n]:i&&[s,f]}u=[[0,0],[0,0]];if(r){t=e[0],n=e[1];if(i)t=t[0],n=n[0];u[0][0]=t,u[1][0]=n;if(r.invert)t=r(t),n=r(n);if(n<t)l=t,t=n,n=l;o[0][0]=t|0,o[1][0]=n|0}if(i){s=e[0],f=e[1];if(r)s=s[1],f=f[1];u[0][1]=s,u[1][1]=f;if(i.invert)s=i(s),f=i(f);if(f<s)l=s,s=f,f=l;o[0][1]=s|0,o[1][1]=f|0}return a};a.clear=function(){u=null;o[0][0]=o[0][1]=o[1][0]=o[1][1]=0;return a};a.empty=function(){return r&&o[0][0]===o[1][0]||i&&o[0][1]===o[1][1]};return e.rebind(a,t,"on")};var Au={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"};var Ou=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];e.time={};var Mu=Date,_u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Du.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Pu.setUTCDate.apply(this._,arguments)},setDay:function(){Pu.setUTCDay.apply(this._,arguments)},setFullYear:function(){Pu.setUTCFullYear.apply(this._,arguments)},setHours:function(){Pu.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Pu.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Pu.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Pu.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Pu.setUTCSeconds.apply(this._,arguments)},setTime:function(){Pu.setTime.apply(this._,arguments)}};var Pu=Date.prototype;var Hu="%a %b %e %X %Y",Bu="%m/%d/%Y",ju="%H:%M:%S";var Fu=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Iu=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],qu=["January","February","March","April","May","June","July","August","September","October","November","December"],Ru=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];e.time.year=Uu(function(t){t=e.time.day(t);t.setMonth(0,1);return t},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()});e.time.years=e.time.year.range;e.time.years.utc=e.time.year.utc.range;e.time.day=Uu(function(e){var t=new Mu(1970,0);t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate());return t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1});e.time.days=e.time.day.range;e.time.days.utc=e.time.day.utc.range;e.time.dayOfYear=function(t){var n=e.time.year(t);return Math.floor((t-n-(t.getTimezoneOffset()-n.getTimezoneOffset())*6e4)/864e5)};_u.forEach(function(t,n){t=t.toLowerCase();n=7-n;var r=e.time[t]=Uu(function(t){(t=e.time.day(t)).setDate(t.getDate()-(t.getDay()+n)%7);return t},function(e,t){e.setDate(e.getDate()+Math.floor(t)*7)},function(t){var r=e.time.year(t).getDay();return Math.floor((e.time.dayOfYear(t)+(r+n)%7)/7)-(r!==n)});e.time[t+"s"]=r.range;e.time[t+"s"].utc=r.utc.range;e.time[t+"OfYear"]=function(t){var r=e.time.year(t).getDay();return Math.floor((e.time.dayOfYear(t)+(r+n)%7)/7)}});e.time.week=e.time.sunday;e.time.weeks=e.time.sunday.range;e.time.weeks.utc=e.time.sunday.utc.range;e.time.weekOfYear=e.time.sundayOfYear;e.time.format=function(e){function n(n){var r=[],i=-1,s=0,o,u,a;while(++i<t){if(e.charCodeAt(i)===37){r.push(e.substring(s,i));if((u=ea[o=e.charAt(++i)])!=null)o=e.charAt(++i);if(a=ta[o])o=a(n,u==null?o==="e"?" ":"0":u);r.push(o);s=i+1}}r.push(e.substring(s,i));return r.join("")}var t=e.length;n.parse=function(t){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},r=Wu(n,e,t,0);if(r!=t.length)return null;if("p"in n)n.H=n.H%12+n.p*12;var i=new Mu;i.setFullYear(n.y,n.m,n.d);i.setHours(n.H,n.M,n.S,n.L);return i};n.toString=function(){return e};return n};var Ju=Xu(Fu),Ku=Xu(Iu),Qu=Xu(qu),Gu=Vu(qu),Yu=Xu(Ru),Zu=Vu(Ru);var ea={"-":"",_:" ",0:"0"};var ta={a:function(e){return Iu[e.getDay()]},A:function(e){return Fu[e.getDay()]},b:function(e){return Ru[e.getMonth()]},B:function(e){return qu[e.getMonth()]},c:e.time.format(Hu),d:function(e,t){return $u(e.getDate(),t,2)},e:function(e,t){return $u(e.getDate(),t,2)},H:function(e,t){return $u(e.getHours(),t,2)},I:function(e,t){return $u(e.getHours()%12||12,t,2)},j:function(t,n){return $u(1+e.time.dayOfYear(t),n,3)},L:function(e,t){return $u(e.getMilliseconds(),t,3)},m:function(e,t){return $u(e.getMonth()+1,t,2)},M:function(e,t){return $u(e.getMinutes(),t,2)},p:function(e){return e.getHours()>=12?"PM":"AM"},S:function(e,t){return $u(e.getSeconds(),t,2)},U:function(t,n){return $u(e.time.sundayOfYear(t),n,2)},w:function(e){return e.getDay()},W:function(t,n){return $u(e.time.mondayOfYear(t),n,2)},x:e.time.format(Bu),X:e.time.format(ju),y:function(e,t){return $u(e.getFullYear()%100,t,2)},Y:function(e,t){return $u(e.getFullYear()%1e4,t,4)},Z:Sa,"%":function(){return"%"}};var na={a:ra,A:ia,b:sa,B:oa,c:ua,d:da,e:da,H:va,I:va,L:ya,m:pa,M:ma,p:wa,S:ga,x:aa,X:fa,y:ca,Y:la};var ba=/^\s*\d+/;var Ea=e.map({am:0,pm:1});e.time.format.utc=function(t){function r(e){try{Mu=Du;var t=new Mu;t._=e;return n(t)}finally{Mu=Date}}var n=e.time.format(t);r.parse=function(e){try{Mu=Du;var t=n.parse(e);return t&&t._}finally{Mu=Date}};r.toString=n.toString;return r};var xa=e.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");e.time.format.iso=Date.prototype.toISOString&&+(new Date("2000-01-01T00:00:00.000Z"))?Ta:xa;Ta.parse=function(e){var t=new Date(e);return isNaN(t)?null:t};Ta.toString=xa.toString;e.time.second=Uu(function(e){return new Mu(Math.floor(e/1e3)*1e3)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*1e3)},function(e){return e.getSeconds()});e.time.seconds=e.time.second.range;e.time.seconds.utc=e.time.second.utc.range;e.time.minute=Uu(function(e){return new Mu(Math.floor(e/6e4)*6e4)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*6e4)},function(e){return e.getMinutes()});e.time.minutes=e.time.minute.range;e.time.minutes.utc=e.time.minute.utc.range;e.time.hour=Uu(function(e){var t=e.getTimezoneOffset()/60;return new Mu((Math.floor(e/36e5-t)+t)*36e5)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*36e5)},function(e){return e.getHours()});e.time.hours=e.time.hour.range;e.time.hours.utc=e.time.hour.utc.range;e.time.month=Uu(function(t){t=e.time.day(t);t.setDate(1);return t},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()});e.time.months=e.time.month.range;e.time.months.utc=e.time.month.utc.range;var Ma=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6];var _a=[[e.time.second,1],[e.time.second,5],[e.time.second,15],[e.time.second,30],[e.time.minute,1],[e.time.minute,5],[e.time.minute,15],[e.time.minute,30],[e.time.hour,1],[e.time.hour,3],[e.time.hour,6],[e.time.hour,12],[e.time.day,1],[e.time.day,2],[e.time.week,1],[e.time.month,1],[e.time.month,3],[e.time.year,1]];var Da=[[e.time.format("%Y"),$n],[e.time.format("%B"),function(e){return e.getMonth()}],[e.time.format("%b %d"),function(e){return e.getDate()!=1}],[e.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[e.time.format("%I %p"),function(e){return e.getHours()}],[e.time.format("%I:%M"),function(e){return e.getMinutes()}],[e.time.format(":%S"),function(e){return e.getSeconds()}],[e.time.format(".%L"),function(e){return e.getMilliseconds()}]];var Pa=e.scale.linear(),Ha=La(Da);_a.year=function(e,t){return Pa.domain(e.map(Oa)).ticks(t).map(Aa)};e.time.scale=function(){return Na(e.scale.linear(),_a,Ha)};var Ba=_a.map(function(e){return[e[0].utc,e[1]]});var ja=[[e.time.format.utc("%Y"),$n],[e.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[e.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[e.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[e.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[e.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[e.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[e.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]];var Fa=La(ja);Ba.year=function(e,t){return Pa.domain(e.map(qa)).ticks(t).map(Ia)};e.time.scale.utc=function(){return Na(e.scale.linear(),Ba,Fa)};e.text=function(){return e.xhr.apply(e,arguments).response(Ra)};e.json=function(t,n){return e.xhr(t,"application/json",n).response(Ua)};e.html=function(t,n){return e.xhr(t,"text/html",n).response(za)};e.xml=function(){return e.xhr.apply(e,arguments).response(Wa)};return e}() \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/fisheye.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/fisheye.js
new file mode 100644
index 00000000..e1addd7b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/fisheye.js
@@ -0,0 +1,86 @@
+(function() {
+ d3.fisheye = {
+ scale: function(scaleType) {
+ return d3_fisheye_scale(scaleType(), 3, 0);
+ },
+ circular: function() {
+ var radius = 200,
+ distortion = 2,
+ k0,
+ k1,
+ focus = [0, 0];
+
+ function fisheye(d) {
+ var dx = d.x - focus[0],
+ dy = d.y - focus[1],
+ dd = Math.sqrt(dx * dx + dy * dy);
+ if (!dd || dd >= radius) return {x: d.x, y: d.y, z: 1};
+ var k = k0 * (1 - Math.exp(-dd * k1)) / dd * .75 + .25;
+ return {x: focus[0] + dx * k, y: focus[1] + dy * k, z: Math.min(k, 10)};
+ }
+
+ function rescale() {
+ k0 = Math.exp(distortion);
+ k0 = k0 / (k0 - 1) * radius;
+ k1 = distortion / radius;
+ return fisheye;
+ }
+
+ fisheye.radius = function(_) {
+ if (!arguments.length) return radius;
+ radius = +_;
+ return rescale();
+ };
+
+ fisheye.distortion = function(_) {
+ if (!arguments.length) return distortion;
+ distortion = +_;
+ return rescale();
+ };
+
+ fisheye.focus = function(_) {
+ if (!arguments.length) return focus;
+ focus = _;
+ return fisheye;
+ };
+
+ return rescale();
+ }
+ };
+
+ function d3_fisheye_scale(scale, d, a) {
+
+ function fisheye(_) {
+ var x = scale(_),
+ left = x < a,
+ v,
+ range = d3.extent(scale.range()),
+ min = range[0],
+ max = range[1],
+ m = left ? a - min : max - a;
+ if (m == 0) m = max - min;
+ return (left ? -1 : 1) * m * (d + 1) / (d + (m / Math.abs(x - a))) + a;
+ }
+
+ fisheye.distortion = function(_) {
+ if (!arguments.length) return d;
+ d = +_;
+ return fisheye;
+ };
+
+ fisheye.focus = function(_) {
+ if (!arguments.length) return a;
+ a = +_;
+ return fisheye;
+ };
+
+ fisheye.copy = function() {
+ return d3_fisheye_scale(scale.copy(), d, a);
+ };
+
+ fisheye.nice = scale.nice;
+ fisheye.ticks = scale.ticks;
+ fisheye.tickFormat = scale.tickFormat;
+ return d3.rebind(fisheye, scale, "domain", "range");
+ }
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/hive.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/hive.js
new file mode 100644
index 00000000..06e53aed
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/hive.js
@@ -0,0 +1,80 @@
+d3.hive = {};
+
+d3.hive.link = function() {
+ var source = function(d) { return d.source; },
+ target = function(d) { return d.target; },
+ angle = function(d) { return d.angle; },
+ startRadius = function(d) { return d.radius; },
+ endRadius = startRadius,
+ arcOffset = -Math.PI / 2;
+
+ function link(d, i) {
+ var s = node(source, this, d, i),
+ t = node(target, this, d, i),
+ x;
+ if (t.a < s.a) x = t, t = s, s = x;
+ if (t.a - s.a > Math.PI) s.a += 2 * Math.PI;
+ var a1 = s.a + (t.a - s.a) / 3,
+ a2 = t.a - (t.a - s.a) / 3;
+ return s.r0 - s.r1 || t.r0 - t.r1
+ ? "M" + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0
+ + "L" + Math.cos(s.a) * s.r1 + "," + Math.sin(s.a) * s.r1
+ + "C" + Math.cos(a1) * s.r1 + "," + Math.sin(a1) * s.r1
+ + " " + Math.cos(a2) * t.r1 + "," + Math.sin(a2) * t.r1
+ + " " + Math.cos(t.a) * t.r1 + "," + Math.sin(t.a) * t.r1
+ + "L" + Math.cos(t.a) * t.r0 + "," + Math.sin(t.a) * t.r0
+ + "C" + Math.cos(a2) * t.r0 + "," + Math.sin(a2) * t.r0
+ + " " + Math.cos(a1) * s.r0 + "," + Math.sin(a1) * s.r0
+ + " " + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0
+ : "M" + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0
+ + "C" + Math.cos(a1) * s.r1 + "," + Math.sin(a1) * s.r1
+ + " " + Math.cos(a2) * t.r1 + "," + Math.sin(a2) * t.r1
+ + " " + Math.cos(t.a) * t.r1 + "," + Math.sin(t.a) * t.r1;
+ }
+
+ function node(method, thiz, d, i) {
+ var node = method.call(thiz, d, i),
+ a = +(typeof angle === "function" ? angle.call(thiz, node, i) : angle) + arcOffset,
+ r0 = +(typeof startRadius === "function" ? startRadius.call(thiz, node, i) : startRadius),
+ r1 = (startRadius === endRadius ? r0 : +(typeof endRadius === "function" ? endRadius.call(thiz, node, i) : endRadius));
+ return {r0: r0, r1: r1, a: a};
+ }
+
+ link.source = function(_) {
+ if (!arguments.length) return source;
+ source = _;
+ return link;
+ };
+
+ link.target = function(_) {
+ if (!arguments.length) return target;
+ target = _;
+ return link;
+ };
+
+ link.angle = function(_) {
+ if (!arguments.length) return angle;
+ angle = _;
+ return link;
+ };
+
+ link.radius = function(_) {
+ if (!arguments.length) return startRadius;
+ startRadius = endRadius = _;
+ return link;
+ };
+
+ link.startRadius = function(_) {
+ if (!arguments.length) return startRadius;
+ startRadius = _;
+ return link;
+ };
+
+ link.endRadius = function(_) {
+ if (!arguments.length) return endRadius;
+ endRadius = _;
+ return link;
+ };
+
+ return link;
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/horizon.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/horizon.js
new file mode 100644
index 00000000..d84c6567
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/horizon.js
@@ -0,0 +1,192 @@
+(function() {
+ d3.horizon = function() {
+ var bands = 1, // between 1 and 5, typically
+ mode = "offset", // or mirror
+ interpolate = "linear", // or basis, monotone, step-before, etc.
+ x = d3_horizonX,
+ y = d3_horizonY,
+ w = 960,
+ h = 40,
+ duration = 0;
+
+ var color = d3.scale.linear()
+ .domain([-1, 0, 1])
+ .range(["#d62728", "#fff", "#1f77b4"]);
+
+ // For each small multiple…
+ function horizon(g) {
+ g.each(function(d, i) {
+ var g = d3.select(this),
+ n = 2 * bands + 1,
+ xMin = Infinity,
+ xMax = -Infinity,
+ yMax = -Infinity,
+ x0, // old x-scale
+ y0, // old y-scale
+ id; // unique id for paths
+
+ // Compute x- and y-values along with extents.
+ var data = d.map(function(d, i) {
+ var xv = x.call(this, d, i),
+ yv = y.call(this, d, i);
+ if (xv < xMin) xMin = xv;
+ if (xv > xMax) xMax = xv;
+ if (-yv > yMax) yMax = -yv;
+ if (yv > yMax) yMax = yv;
+ return [xv, yv];
+ });
+
+ // Compute the new x- and y-scales, and transform.
+ var x1 = d3.scale.linear().domain([xMin, xMax]).range([0, w]),
+ y1 = d3.scale.linear().domain([0, yMax]).range([0, h * bands]),
+ t1 = d3_horizonTransform(bands, h, mode);
+
+ // Retrieve the old scales, if this is an update.
+ if (this.__chart__) {
+ x0 = this.__chart__.x;
+ y0 = this.__chart__.y;
+ t0 = this.__chart__.t;
+ id = this.__chart__.id;
+ } else {
+ x0 = x1.copy();
+ y0 = y1.copy();
+ t0 = t1;
+ id = ++d3_horizonId;
+ }
+
+ // We'll use a defs to store the area path and the clip path.
+ var defs = g.selectAll("defs")
+ .data([null]);
+
+ // The clip path is a simple rect.
+ defs.enter().append("defs").append("clipPath")
+ .attr("id", "d3_horizon_clip" + id)
+ .append("rect")
+ .attr("width", w)
+ .attr("height", h);
+
+ defs.select("rect").transition()
+ .duration(duration)
+ .attr("width", w)
+ .attr("height", h);
+
+ // We'll use a container to clip all horizon layers at once.
+ g.selectAll("g")
+ .data([null])
+ .enter().append("g")
+ .attr("clip-path", "url(#d3_horizon_clip" + id + ")");
+
+ // Instantiate each copy of the path with different transforms.
+ var path = g.select("g").selectAll("path")
+ .data(d3.range(-1, -bands - 1, -1).concat(d3.range(1, bands + 1)), Number);
+
+ var d0 = d3_horizonArea
+ .interpolate(interpolate)
+ .x(function(d) { return x0(d[0]); })
+ .y0(h * bands)
+ .y1(function(d) { return h * bands - y0(d[1]); })
+ (data);
+
+ var d1 = d3_horizonArea
+ .x(function(d) { return x1(d[0]); })
+ .y1(function(d) { return h * bands - y1(d[1]); })
+ (data);
+
+ path.enter().append("path")
+ .style("fill", color)
+ .attr("transform", t0)
+ .attr("d", d0);
+
+ path.transition()
+ .duration(duration)
+ .style("fill", color)
+ .attr("transform", t1)
+ .attr("d", d1);
+
+ path.exit().transition()
+ .duration(duration)
+ .attr("transform", t1)
+ .attr("d", d1)
+ .remove();
+
+ // Stash the new scales.
+ this.__chart__ = {x: x1, y: y1, t: t1, id: id};
+ });
+ d3.timer.flush();
+ }
+
+ horizon.duration = function(x) {
+ if (!arguments.length) return duration;
+ duration = +x;
+ return horizon;
+ };
+
+ horizon.bands = function(x) {
+ if (!arguments.length) return bands;
+ bands = +x;
+ color.domain([-bands, 0, bands]);
+ return horizon;
+ };
+
+ horizon.mode = function(x) {
+ if (!arguments.length) return mode;
+ mode = x + "";
+ return horizon;
+ };
+
+ horizon.colors = function(x) {
+ if (!arguments.length) return color.range();
+ color.range(x);
+ return horizon;
+ };
+
+ horizon.interpolate = function(x) {
+ if (!arguments.length) return interpolate;
+ interpolate = x + "";
+ return horizon;
+ };
+
+ horizon.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ return horizon;
+ };
+
+ horizon.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ return horizon;
+ };
+
+ horizon.width = function(x) {
+ if (!arguments.length) return w;
+ w = +x;
+ return horizon;
+ };
+
+ horizon.height = function(x) {
+ if (!arguments.length) return h;
+ h = +x;
+ return horizon;
+ };
+
+ return horizon;
+ };
+
+ var d3_horizonArea = d3.svg.area(),
+ d3_horizonId = 0;
+
+ function d3_horizonX(d) {
+ return d[0];
+ }
+
+ function d3_horizonY(d) {
+ return d[1];
+ }
+
+ function d3_horizonTransform(bands, h, mode) {
+ return mode == "offset"
+ ? function(d) { return "translate(0," + (d + (d < 0) - bands) * h + ")"; }
+ : function(d) { return (d < 0 ? "scale(1,-1)" : "") + "translate(0," + (d - bands) * h + ")"; };
+ }
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/interactiveLayer.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/interactiveLayer.js
new file mode 100644
index 00000000..4dfb68dc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/interactiveLayer.js
@@ -0,0 +1,251 @@
+/* Utility class to handle creation of an interactive layer.
+This places a rectangle on top of the chart. When you mouse move over it, it sends a dispatch
+containing the X-coordinate. It can also render a vertical line where the mouse is located.
+
+dispatch.elementMousemove is the important event to latch onto. It is fired whenever the mouse moves over
+the rectangle. The dispatch is given one object which contains the mouseX/Y location.
+It also has 'pointXValue', which is the conversion of mouseX to the x-axis scale.
+*/
+nv.interactiveGuideline = function() {
+ "use strict";
+ var tooltip = nv.models.tooltip();
+ //Public settings
+ var width = null
+ , height = null
+ //Please pass in the bounding chart's top and left margins
+ //This is important for calculating the correct mouseX/Y positions.
+ , margin = {left: 0, top: 0}
+ , xScale = d3.scale.linear()
+ , yScale = d3.scale.linear()
+ , dispatch = d3.dispatch('elementMousemove', 'elementMouseout','elementDblclick')
+ , showGuideLine = true
+ , svgContainer = null
+ //Must pass in the bounding chart's <svg> container.
+ //The mousemove event is attached to this container.
+ ;
+
+ //Private variables
+ var isMSIE = navigator.userAgent.indexOf("MSIE") !== -1 //Check user-agent for Microsoft Internet Explorer.
+ ;
+
+
+ function layer(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || 960), availableHeight = (height || 400);
+
+ var wrap = container.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([data]);
+ var wrapEnter = wrap.enter()
+ .append("g").attr("class", " nv-wrap nv-interactiveLineLayer");
+
+
+ wrapEnter.append("g").attr("class","nv-interactiveGuideLine");
+
+ if (!svgContainer) {
+ return;
+ }
+
+ function mouseHandler() {
+ var d3mouse = d3.mouse(this);
+ var mouseX = d3mouse[0];
+ var mouseY = d3mouse[1];
+ var subtractMargin = true;
+ var mouseOutAnyReason = false;
+ if (isMSIE) {
+ /*
+ D3.js (or maybe SVG.getScreenCTM) has a nasty bug in Internet Explorer 10.
+ d3.mouse() returns incorrect X,Y mouse coordinates when mouse moving
+ over a rect in IE 10.
+ However, d3.event.offsetX/Y also returns the mouse coordinates
+ relative to the triggering <rect>. So we use offsetX/Y on IE.
+ */
+ mouseX = d3.event.offsetX;
+ mouseY = d3.event.offsetY;
+
+ /*
+ On IE, if you attach a mouse event listener to the <svg> container,
+ it will actually trigger it for all the child elements (like <path>, <circle>, etc).
+ When this happens on IE, the offsetX/Y is set to where ever the child element
+ is located.
+ As a result, we do NOT need to subtract margins to figure out the mouse X/Y
+ position under this scenario. Removing the line below *will* cause
+ the interactive layer to not work right on IE.
+ */
+ if(d3.event.target.tagName !== "svg")
+ subtractMargin = false;
+
+ if (d3.event.target.className.baseVal.match("nv-legend"))
+ mouseOutAnyReason = true;
+
+ }
+
+ if(subtractMargin) {
+ mouseX -= margin.left;
+ mouseY -= margin.top;
+ }
+
+ /* If mouseX/Y is outside of the chart's bounds,
+ trigger a mouseOut event.
+ */
+ if (mouseX < 0 || mouseY < 0
+ || mouseX > availableWidth || mouseY > availableHeight
+ || (d3.event.relatedTarget && d3.event.relatedTarget.ownerSVGElement === undefined)
+ || mouseOutAnyReason
+ )
+ {
+ if (isMSIE) {
+ if (d3.event.relatedTarget
+ && d3.event.relatedTarget.ownerSVGElement === undefined
+ && d3.event.relatedTarget.className.match(tooltip.nvPointerEventsClass)) {
+ return;
+ }
+ }
+ dispatch.elementMouseout({
+ mouseX: mouseX,
+ mouseY: mouseY
+ });
+ layer.renderGuideLine(null); //hide the guideline
+ return;
+ }
+
+ var pointXValue = xScale.invert(mouseX);
+ dispatch.elementMousemove({
+ mouseX: mouseX,
+ mouseY: mouseY,
+ pointXValue: pointXValue
+ });
+
+ //If user double clicks the layer, fire a elementDblclick dispatch.
+ if (d3.event.type === "dblclick") {
+ dispatch.elementDblclick({
+ mouseX: mouseX,
+ mouseY: mouseY,
+ pointXValue: pointXValue
+ });
+ }
+ }
+
+ svgContainer
+ .on("mousemove",mouseHandler, true)
+ .on("mouseout" ,mouseHandler,true)
+ .on("dblclick" ,mouseHandler)
+ ;
+
+ //Draws a vertical guideline at the given X postion.
+ layer.renderGuideLine = function(x) {
+ if (!showGuideLine) return;
+ var line = wrap.select(".nv-interactiveGuideLine")
+ .selectAll("line")
+ .data((x != null) ? [nv.utils.NaNtoZero(x)] : [], String);
+
+ line.enter()
+ .append("line")
+ .attr("class", "nv-guideline")
+ .attr("x1", function(d) { return d;})
+ .attr("x2", function(d) { return d;})
+ .attr("y1", availableHeight)
+ .attr("y2",0)
+ ;
+ line.exit().remove();
+
+ }
+ });
+ }
+
+ layer.dispatch = dispatch;
+ layer.tooltip = tooltip;
+
+ layer.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return layer;
+ };
+
+ layer.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return layer;
+ };
+
+ layer.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return layer;
+ };
+
+ layer.xScale = function(_) {
+ if (!arguments.length) return xScale;
+ xScale = _;
+ return layer;
+ };
+
+ layer.showGuideLine = function(_) {
+ if (!arguments.length) return showGuideLine;
+ showGuideLine = _;
+ return layer;
+ };
+
+ layer.svgContainer = function(_) {
+ if (!arguments.length) return svgContainer;
+ svgContainer = _;
+ return layer;
+ };
+
+
+ return layer;
+};
+
+/* Utility class that uses d3.bisect to find the index in a given array, where a search value can be inserted.
+This is different from normal bisectLeft; this function finds the nearest index to insert the search value.
+
+For instance, lets say your array is [1,2,3,5,10,30], and you search for 28.
+Normal d3.bisectLeft will return 4, because 28 is inserted after the number 10. But interactiveBisect will return 5
+because 28 is closer to 30 than 10.
+
+Unit tests can be found in: interactiveBisectTest.html
+
+Has the following known issues:
+ * Will not work if the data points move backwards (ie, 10,9,8,7, etc) or if the data points are in random order.
+ * Won't work if there are duplicate x coordinate values.
+*/
+nv.interactiveBisect = function (values, searchVal, xAccessor) {
+ "use strict";
+ if (! values instanceof Array) return null;
+ if (typeof xAccessor !== 'function') xAccessor = function(d,i) { return d.x;}
+
+ var bisect = d3.bisector(xAccessor).left;
+ var index = d3.max([0, bisect(values,searchVal) - 1]);
+ var currentValue = xAccessor(values[index], index);
+ if (typeof currentValue === 'undefined') currentValue = index;
+
+ if (currentValue === searchVal) return index; //found exact match
+
+ var nextIndex = d3.min([index+1, values.length - 1]);
+ var nextValue = xAccessor(values[nextIndex], nextIndex);
+ if (typeof nextValue === 'undefined') nextValue = nextIndex;
+
+ if (Math.abs(nextValue - searchVal) >= Math.abs(currentValue - searchVal))
+ return index;
+ else
+ return nextIndex
+};
+
+/*
+Returns the index in the array "values" that is closest to searchVal.
+Only returns an index if searchVal is within some "threshold".
+Otherwise, returns null.
+*/
+nv.nearestValueIndex = function (values, searchVal, threshold) {
+ "use strict";
+ var yDistMax = Infinity, indexToHighlight = null;
+ values.forEach(function(d,i) {
+ var delta = Math.abs(searchVal - d);
+ if ( delta <= yDistMax && delta < threshold) {
+ yDistMax = delta;
+ indexToHighlight = i;
+ }
+ });
+ return indexToHighlight;
+}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/intro.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/intro.js
new file mode 100644
index 00000000..af50383e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/intro.js
@@ -0,0 +1 @@
+(function(){
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis-min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis-min.js
new file mode 100644
index 00000000..1101dde5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis-min.js
@@ -0,0 +1 @@
+nv.models.axis=function(){function o(d){return d.each(function(d){var o=d3.select(this),p=o.selectAll("g.nv-wrap.nv-axis").data([d]),q=p.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");q.append("g");var s=p.select("g");null!==m?a.ticks(m):("top"==a.orient()||"bottom"==a.orient())&&a.ticks(Math.abs(e.range()[1]-e.range()[0])/100),d3.transition(s).call(a),n=n||a.scale();var t=a.tickFormat();null==t&&(t=n.tickFormat());var u=s.selectAll("text.nv-axislabel").data([f||null]);switch(u.exit().remove(),a.orient()){case"top":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",0);var v=2==e.range().length?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);if(u.attr("x",v/2),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a){return"translate("+e(a)+",0)"}).select("text").attr("dy","0em").attr("y",-a.tickPadding()).attr("text-anchor","middle").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+e.range()[b]+",0)"})}break;case"bottom":var x=36,y=30,z=s.selectAll("g").select("text");if(i%360){z.each(function(){var c=this.getBBox().width;c>y&&(y=c)});var A=Math.abs(Math.sin(i*Math.PI/180)),x=(A?A*y:y)+30;z.attr("transform",function(){return"rotate("+i+" 0,0)"}).attr("text-anchor",i%360>0?"start":"end")}u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",x);var v=2==e.range().length?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);if(u.attr("x",v/2),g){var w=p.selectAll("g.nv-axisMaxMin").data([e.domain()[0],e.domain()[e.domain().length-1]]);w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",a.tickPadding()).attr("transform",function(){return"rotate("+i+" 0,0)"}).attr("text-anchor",i?i%360>0?"start":"end":"middle").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"})}k&&z.attr("transform",function(a,b){return"translate(0,"+(0==b%2?"0":"12")+")"});break;case"right":if(u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(90)":"").attr("y",j?-Math.max(b.right,c)+30:-10),u.attr("x",j?e.range()[0]/2:a.tickPadding()),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",a.tickPadding()).attr("text-anchor","start").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":if(u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(-90)":"").attr("y",j?-Math.max(b.left,c)+0:-10),u.attr("x",j?-e.range()[0]/2:-a.tickPadding()),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-a.tickPadding()).attr("text-anchor","start").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}}if(u.text(function(a){return a}),!g||"left"!==a.orient()&&"right"!==a.orient()||(s.selectAll("g").each(function(a){d3.select(this).select("text").attr("opacity",1),(e(a)<e.range()[1]+10||e(a)>e.range()[0]-10)&&((a>1e-10||-1e-10>a)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0))}),e.domain()[0]==e.domain()[1]&&0==e.domain()[0]&&p.selectAll("g.nv-axisMaxMin").style("opacity",function(a,b){return b?0:1})),g&&("top"===a.orient()||"bottom"===a.orient())){var B=[];p.selectAll("g.nv-axisMaxMin").each(function(a,b){try{b?B.push(e(a)-this.getBBox().width-4):B.push(e(a)+this.getBBox().width+4)}catch(c){b?B.push(e(a)-4):B.push(e(a)+4)}}),s.selectAll("g").each(function(a){(e(a)<B[0]||e(a)>B[1])&&(a>1e-10||-1e-10>a?d3.select(this).remove():d3.select(this).select("text").remove())})}h&&s.selectAll("line.tick").filter(function(a){return!parseFloat(Math.round(1e5*a)/1e6)}).classed("zero",!0),n=e.copy()}),o}var a=d3.svg.axis(),b={top:0,right:0,bottom:0,left:0},c=75,d=60,e=d3.scale.linear(),f=null,g=!1,h=!0,i=0,j=!0,k=!1,l=!1,m=null;a.scale(e).orient("bottom").tickFormat(function(a){return a});var n;return o.axis=a,d3.rebind(o,a,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o.margin=function(a){return arguments.length?(b.top=a.top!==void 0?a.top:b.top,b.right=a.right!==void 0?a.right:b.right,b.bottom=a.bottom!==void 0?a.bottom:b.bottom,b.left=a.left!==void 0?a.left:b.left,o):b},o.width=function(a){return arguments.length?(c=a,o):c},o.ticks=function(a){return arguments.length?(m=a,o):m},o.height=function(a){return arguments.length?(d=a,o):d},o.axisLabel=function(a){return arguments.length?(f=a,o):f},o.showMaxMin=function(a){return arguments.length?(g=a,o):g},o.highlightZero=function(a){return arguments.length?(h=a,o):h},o.scale=function(b){return arguments.length?(e=b,a.scale(e),l="function"==typeof e.rangeBands,d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o):e},o.rotateYLabel=function(a){return arguments.length?(j=a,o):j},o.rotateLabels=function(a){return arguments.length?(i=a,o):i},o.staggerLabels=function(a){return arguments.length?(k=a,o):k},o}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.js
new file mode 100644
index 00000000..9895c3f0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.js
@@ -0,0 +1,470 @@
+nv.models.axis = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var axis = d3.svg.axis()
+ ;
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 75 //only used for tickLabel currently
+ , height = 60 //only used for tickLabel currently
+ , scale = d3.scale.linear()
+ , axisLabelText = null
+ , showMaxMin = true //TODO: showMaxMin should be disabled on all ordinal scaled axes
+ , highlightZero = true
+ , rotateLabels = 0
+ , rotateYLabel = true
+ , staggerLabels = false
+ , isOrdinal = false
+ , ticks = null
+ , logScale = false
+ , axisLabelDistance = 12 //The larger this number is, the closer the axis label is to the axis.
+ ;
+
+ axis
+ .scale(scale)
+ .orient('bottom')
+ .tickFormat(function(d) { return d })
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var scale0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-axis').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-axis');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ //------------------------------------------------------------
+
+
+ if (ticks !== null)
+ axis.ticks(ticks);
+ else if (axis.orient() == 'top' || axis.orient() == 'bottom')
+ axis.ticks(Math.abs(scale.range()[1] - scale.range()[0]) / 100);
+
+
+ //TODO: consider calculating width/height based on whether or not label is added, for reference in charts using this component
+
+
+ g.transition().call(axis);
+
+ scale0 = scale0 || axis.scale();
+
+ var fmt = axis.tickFormat();
+ if (fmt == null) {
+ fmt = scale0.tickFormat();
+ }
+
+ var axisLabel = g.selectAll('text.nv-axislabel')
+ .data([axisLabelText || null]);
+ axisLabel.exit().remove();
+ switch (axis.orient()) {
+ case 'top':
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0]));
+ axisLabel
+ .attr('text-anchor', 'middle')
+ .attr('y', 0)
+ .attr('x', w/2);
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text');
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(' + scale(d) + ',0)'
+ })
+ .select('text')
+ .attr('dy', '0em')
+ .attr('y', -axis.tickPadding())
+ .attr('text-anchor', 'middle')
+ .text(function(d,i) {
+ //var v = fmt(d);
+ var v = d;
+ if(logScale) {
+ v = Math.pow(10,v);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else
+ v = fmt(v);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ axisMaxMin.transition()
+ .attr('transform', function(d,i) {
+ return 'translate(' + scale.range()[i] + ',0)'
+ });
+ }
+ break;
+ case 'bottom':
+ var xLabelMargin = 36;
+ var maxTextWidth = 30;
+ var xTicks = g.selectAll('g').select("text");
+ if (rotateLabels%360) {
+ //Calculate the longest xTick width
+ xTicks.each(function(d,i){
+ var width = this.getBBox().width;
+ if(width > maxTextWidth) maxTextWidth = width;
+ });
+ //Convert to radians before calculating sin. Add 30 to margin for healthy padding.
+ var sin = Math.abs(Math.sin(rotateLabels*Math.PI/180));
+ var xLabelMargin = (sin ? sin*maxTextWidth : maxTextWidth)+30;
+ //Rotate all xTicks
+ xTicks
+ .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' })
+ .style('text-anchor', rotateLabels%360 > 0 ? 'start' : 'end');
+ }
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0]));
+ axisLabel
+ .attr('text-anchor', 'middle')
+ .attr('y', xLabelMargin)
+ .attr('x', w/2);
+ if (showMaxMin) {
+ //if (showMaxMin && !isOrdinal) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ //.data(scale.domain())
+ .data([scale.domain()[0], scale.domain()[scale.domain().length - 1]]);
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text');
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)'
+ })
+ .select('text')
+ .attr('dy', '.71em')
+ .attr('y', axis.tickPadding())
+ .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' })
+ .style('text-anchor', rotateLabels ? (rotateLabels%360 > 0 ? 'start' : 'end') : 'middle')
+ .text(function(d,i) {
+ //var v = fmt(d);
+ var v = d;
+ if(logScale) {
+ v = Math.pow(10,v);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else
+ v = fmt(v);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ axisMaxMin.transition()
+ .attr('transform', function(d,i) {
+ //return 'translate(' + scale.range()[i] + ',0)'
+ //return 'translate(' + scale(d) + ',0)'
+ return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)'
+ });
+ }
+ if (staggerLabels)
+ xTicks
+ .attr('transform', function(d,i) { return 'translate(0,' + (i % 2 == 0 ? '0' : '12') + ')' });
+
+ break;
+ case 'right':
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ axisLabel
+ .style('text-anchor', rotateYLabel ? 'middle' : 'begin')
+ .attr('transform', rotateYLabel ? 'rotate(90)' : '')
+ .attr('y', rotateYLabel ? (-Math.max(margin.right,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart
+ .attr('x', rotateYLabel ? (scale.range()[0] / 2) : axis.tickPadding());
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text')
+ .style('opacity', 0);
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale(d) + ')'
+ })
+ .select('text')
+ .attr('dy', '.32em')
+ .attr('y', 0)
+ .attr('x', axis.tickPadding())
+ .style('text-anchor', 'start')
+ .text(function(d,i) {
+ //var v = fmt(d);
+ var v = d;
+ if(logScale) {
+ v = Math.pow(10,v);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else
+ v = fmt(v);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ axisMaxMin.transition()
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale.range()[i] + ')'
+ })
+ .select('text')
+ .style('opacity', 1);
+ }
+ break;
+ case 'left':
+ /*
+ //For dynamically placing the label. Can be used with dynamically-sized chart axis margins
+ var yTicks = g.selectAll('g').select("text");
+ yTicks.each(function(d,i){
+ var labelPadding = this.getBBox().width + axis.tickPadding() + 16;
+ if(labelPadding > width) width = labelPadding;
+ });
+ */
+ axisLabel.enter().append('text').attr('class', 'nv-axislabel');
+ axisLabel
+ .style('text-anchor', rotateYLabel ? 'middle' : 'end')
+ .attr('transform', rotateYLabel ? 'rotate(-90)' : '')
+ .attr('y', rotateYLabel ? (-Math.max(margin.left,width) + axisLabelDistance) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart
+ .attr('x', rotateYLabel ? (-scale.range()[0] / 2) : -axis.tickPadding());
+ if (showMaxMin) {
+ var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
+ .data(scale.domain());
+ axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text')
+ .style('opacity', 0);
+ axisMaxMin.exit().remove();
+ axisMaxMin
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale0(d) + ')'
+ })
+ .select('text')
+ .attr('dy', '.32em')
+ .attr('y', 0)
+ .attr('x', -axis.tickPadding())
+ .attr('text-anchor', 'end')
+ .text(function(d,i) {
+ //var v = fmt(d);
+ var v = d;
+ if(logScale) {
+ v = Math.pow(10,v);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else
+ v = fmt(v);
+ return ('' + v).match('NaN') ? '' : v;
+ });
+ axisMaxMin.transition()
+ .attr('transform', function(d,i) {
+ return 'translate(0,' + scale.range()[i] + ')'
+ })
+ .select('text')
+ .style('opacity', 1);
+ }
+ break;
+ }
+ axisLabel
+ .text(function(d) { return d });
+
+
+ if (showMaxMin && (axis.orient() === 'left' || axis.orient() === 'right')) {
+ //check if max and min overlap other values, if so, hide the values that overlap
+ g.selectAll('g') // the g's wrapping each tick
+ .each(function(d,i) {
+ d3.select(this).select('text').attr('opacity', 1);
+ var v;
+ if(logScale) {
+ v = Math.pow(10,d);
+ v = fmt(v);
+ //fmt = d3.format(',.2f');
+ //v = fmt(v);
+ } else {
+ v = fmt(d);
+ }
+
+ //d3.select(this).select('text').text(fmt(Math.pow(10,d)));
+ d3.select(this).select('text').text(v);
+ if (scale(d) < scale.range()[1] + 10 || scale(d) > scale.range()[0] - 10) { // 10 is assuming text height is 16... if d is 0, leave it!
+ if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL
+ d3.select(this).attr('opacity', 0);
+
+ d3.select(this).select('text').attr('opacity', 0); // Don't remove the ZERO line!!
+ }
+ });
+
+ //if Max and Min = 0 only show min, Issue #281
+ if (scale.domain()[0] == scale.domain()[1] && scale.domain()[0] == 0)
+ wrap.selectAll('g.nv-axisMaxMin')
+ .style('opacity', function(d,i) { return !i ? 1 : 0 });
+
+ }
+
+ if (showMaxMin && (axis.orient() === 'top' || axis.orient() === 'bottom')) {
+ var maxMinRange = [];
+ wrap.selectAll('g.nv-axisMaxMin')
+ .each(function(d,i) {
+ try {
+ if (i) // i== 1, max position
+ maxMinRange.push(scale(d) - this.getBBox().width - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
+ else // i==0, min position
+ maxMinRange.push(scale(d) + this.getBBox().width + 4)
+ }catch (err) {
+ if (i) // i== 1, max position
+ maxMinRange.push(scale(d) - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case)
+ else // i==0, min position
+ maxMinRange.push(scale(d) + 4)
+ }
+ });
+ g.selectAll('g') // the g's wrapping each tick
+ .each(function(d,i) {
+ var v;
+ if(logScale) {
+ v = Math.pow(10,d);
+ //v = fmt(v);
+ //fmt = d3.format(',.2f');
+ v = fmt(v);
+ } else {
+ v = fmt(d);
+ }
+ //alert(v);
+
+ //d3.select(this).select('text').text(fmt(Math.pow(10,d)));
+ d3.select(this).select('text').text(v);
+
+ if (scale(d) < maxMinRange[0] || scale(d) > maxMinRange[1]) {
+ if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL
+ d3.select(this).remove();
+ else
+ d3.select(this).select('text').remove(); // Don't remove the ZERO line!!
+ }
+ });
+ }
+
+
+ //highlight zero line ... Maybe should not be an option and should just be in CSS?
+ if (highlightZero)
+ g.selectAll('.tick')
+ .filter(function(d) { return !parseFloat(Math.round(d.__data__*100000)/1000000) && (d.__data__ !== undefined) }) //this is because sometimes the 0 tick is a very small fraction, TODO: think of cleaner technique
+ .classed('zero', true);
+
+ //store old scales for use in transitions on update
+ scale0 = scale.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.axis = axis;
+
+ d3.rebind(chart, axis, 'orient', 'tickValues', 'tickSubdivide', 'tickSize', 'tickPadding', 'tickFormat');
+ d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands'); //these are also accessible by chart.scale(), but added common ones directly for ease of use
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if(!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ }
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.ticks = function(_) {
+ if (!arguments.length) return ticks;
+ ticks = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.axisLabel = function(_) {
+ if (!arguments.length) return axisLabelText;
+ axisLabelText = _;
+ return chart;
+ }
+
+ chart.showMaxMin = function(_) {
+ if (!arguments.length) return showMaxMin;
+ showMaxMin = _;
+ return chart;
+ }
+
+ chart.logScale = function(_) {
+ if (!arguments.length) return logScale;
+ logScale = _;
+ return chart;
+ }
+
+ chart.highlightZero = function(_) {
+ if (!arguments.length) return highlightZero;
+ highlightZero = _;
+ return chart;
+ }
+
+ chart.scale = function(_) {
+ if (!arguments.length) return scale;
+ scale = _;
+ axis.scale(scale);
+ isOrdinal = typeof scale.rangeBands === 'function';
+ d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands');
+ return chart;
+ }
+
+ chart.rotateYLabel = function(_) {
+ if(!arguments.length) return rotateYLabel;
+ rotateYLabel = _;
+ return chart;
+ }
+
+ chart.rotateLabels = function(_) {
+ if(!arguments.length) return rotateLabels;
+ rotateLabels = _;
+ return chart;
+ }
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+ chart.axisLabelDistance = function(_) {
+ if (!arguments.length) return axisLabelDistance;
+ axisLabelDistance = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.min.js
new file mode 100644
index 00000000..6c8ad6ab
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.min.js
@@ -0,0 +1 @@
+nv.models.axis=function(){"use strict";function m(r){r.each(function(r){var m=d3.select(this);var g=m.selectAll("g.nv-wrap.nv-axis").data([r]);var y=g.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");var b=y.append("g");var w=g.select("g");if(h!==null)e.ticks(h);else if(e.orient()=="top"||e.orient()=="bottom")e.ticks(Math.abs(i.range()[1]-i.range()[0])/100);w.transition().call(e);v=v||e.scale();var E=e.tickFormat();if(E==null){E=v.tickFormat()}var S=w.selectAll("text.nv-axislabel").data([s||null]);S.exit().remove();switch(e.orient()){case"top":S.enter().append("text").attr("class","nv-axislabel");var x=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);S.attr("text-anchor","middle").attr("y",0).attr("x",x/2);if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+i(e)+",0)"}).select("text").attr("dy","0em").attr("y",-e.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+i.range()[t]+",0)"})}break;case"bottom":var N=36;var C=30;var k=w.selectAll("g").select("text");if(a%360){k.each(function(e,t){var n=this.getBBox().width;if(n>C)C=n});var L=Math.abs(Math.sin(a*Math.PI/180));var N=(L?L*C:C)+30;k.attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).style("text-anchor",a%360>0?"start":"end")}S.enter().append("text").attr("class","nv-axislabel");var x=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);S.attr("text-anchor","middle").attr("y",N).attr("x",x/2);if(o){var T=g.selectAll("g.nv-axisMaxMin").data([i.domain()[0],i.domain()[i.domain().length-1]]);T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",e.tickPadding()).attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).style("text-anchor",a?a%360>0?"start":"end":"middle").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"})}if(l)k.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",f?"middle":"begin").attr("transform",f?"rotate(90)":"").attr("y",f?-Math.max(t.right,n)+12:-10).attr("x",f?i.range()[0]/2:e.tickPadding());if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+i(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",e.tickPadding()).style("text-anchor","start").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",f?"middle":"end").attr("transform",f?"rotate(-90)":"").attr("y",f?-Math.max(t.left,n)+d:-10).attr("x",f?-i.range()[0]/2:-e.tickPadding());if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+v(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-e.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}break}S.text(function(e){return e});if(o&&(e.orient()==="left"||e.orient()==="right")){w.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);var n;if(p){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(i(e)<i.range()[1]+10||i(e)>i.range()[0]-10){if(e>1e-10||e<-1e-10)d3.select(this).attr("opacity",0);d3.select(this).select("text").attr("opacity",0)}});if(i.domain()[0]==i.domain()[1]&&i.domain()[0]==0)g.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return!t?1:0})}if(o&&(e.orient()==="top"||e.orient()==="bottom")){var A=[];g.selectAll("g.nv-axisMaxMin").each(function(e,t){try{if(t)A.push(i(e)-this.getBBox().width-4);else A.push(i(e)+this.getBBox().width+4)}catch(n){if(t)A.push(i(e)-4);else A.push(i(e)+4)}});w.selectAll("g").each(function(e,t){var n;if(p){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(i(e)<A[0]||i(e)>A[1]){if(e>1e-10||e<-1e-10)d3.select(this).remove();else d3.select(this).select("text").remove()}})}if(u)w.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",true);v=i.copy()});return m}var e=d3.svg.axis();var t={top:0,right:0,bottom:0,left:0},n=75,r=60,i=d3.scale.linear(),s=null,o=true,u=true,a=0,f=true,l=false,c=false,h=null,p=false,d=12;e.scale(i).orient("bottom").tickFormat(function(e){return e});var v;m.axis=e;d3.rebind(m,e,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat");d3.rebind(m,i,"domain","range","rangeBand","rangeBands");m.options=nv.utils.optionsFunc.bind(m);m.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return m};m.width=function(e){if(!arguments.length)return n;n=e;return m};m.ticks=function(e){if(!arguments.length)return h;h=e;return m};m.height=function(e){if(!arguments.length)return r;r=e;return m};m.axisLabel=function(e){if(!arguments.length)return s;s=e;return m};m.showMaxMin=function(e){if(!arguments.length)return o;o=e;return m};m.logScale=function(e){if(!arguments.length)return p;p=e;return m};m.highlightZero=function(e){if(!arguments.length)return u;u=e;return m};m.scale=function(t){if(!arguments.length)return i;i=t;e.scale(i);c=typeof i.rangeBands==="function";d3.rebind(m,i,"domain","range","rangeBand","rangeBands");return m};m.rotateYLabel=function(e){if(!arguments.length)return f;f=e;return m};m.rotateLabels=function(e){if(!arguments.length)return a;a=e;return m};m.staggerLabels=function(e){if(!arguments.length)return l;l=e;return m};m.axisLabelDistance=function(e){if(!arguments.length)return d;d=e;return m};return m} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/boilerplate.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/boilerplate.js
new file mode 100644
index 00000000..3d2360a6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/boilerplate.js
@@ -0,0 +1,104 @@
+
+nv.models.chartName = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+
+ var margin = {top: 30, right: 10, bottom: 10, left: 10}
+ , width = 960
+ , height = 500
+ , color = nv.utils.getColor(d3.scale.category20c().range())
+ , dispatch = d3.dispatch('stateChange', 'changeState')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-chartName').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-chartName');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-mainWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_)
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bullet.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bullet.js
new file mode 100644
index 00000000..9b9bf4d1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bullet.js
@@ -0,0 +1,385 @@
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+
+nv.models.bullet = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , orient = 'left' // TODO top & bottom
+ , reverse = false
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , rangeLabels = function(d) { return d.rangeLabels ? d.rangeLabels : [] }
+ , markerLabels = function(d) { return d.markerLabels ? d.markerLabels : [] }
+ , measureLabels = function(d) { return d.measureLabels ? d.measureLabels : [] }
+ , forceX = [0] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.)
+ , width = 380
+ , height = 30
+ , tickFormat = null
+ , color = nv.utils.getColor(['#1f77b4'])
+ , dispatch = d3.dispatch('elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending),
+ rangeLabelz = rangeLabels.call(this, d, i).slice(),
+ markerLabelz = markerLabels.call(this, d, i).slice(),
+ measureLabelz = measureLabels.call(this, d, i).slice();
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain( d3.extent(d3.merge([forceX, rangez])) )
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+
+ var rangeMin = d3.min(rangez), //rangez[2]
+ rangeMax = d3.max(rangez), //rangez[0]
+ rangeAvg = rangez[1];
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bullet').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bullet');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeMax');
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeAvg');
+ gEnter.append('rect').attr('class', 'nv-range nv-rangeMin');
+ gEnter.append('rect').attr('class', 'nv-measure');
+ gEnter.append('path').attr('class', 'nv-markerTriangle');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+ var xp0 = function(d) { return d < 0 ? x0(d) : x0(0) },
+ xp1 = function(d) { return d < 0 ? x1(d) : x1(0) };
+
+
+ g.select('rect.nv-rangeMax')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeMax > 0 ? rangeMax : rangeMin))
+ .attr('x', xp1(rangeMax > 0 ? rangeMax : rangeMin))
+ .datum(rangeMax > 0 ? rangeMax : rangeMin)
+ /*
+ .attr('x', rangeMin < 0 ?
+ rangeMax > 0 ?
+ x1(rangeMin)
+ : x1(rangeMax)
+ : x1(0))
+ */
+
+ g.select('rect.nv-rangeAvg')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeAvg))
+ .attr('x', xp1(rangeAvg))
+ .datum(rangeAvg)
+ /*
+ .attr('width', rangeMax <= 0 ?
+ x1(rangeMax) - x1(rangeAvg)
+ : x1(rangeAvg) - x1(rangeMin))
+ .attr('x', rangeMax <= 0 ?
+ x1(rangeAvg)
+ : x1(rangeMin))
+ */
+
+ g.select('rect.nv-rangeMin')
+ .attr('height', availableHeight)
+ .attr('width', w1(rangeMax))
+ .attr('x', xp1(rangeMax))
+ .attr('width', w1(rangeMax > 0 ? rangeMin : rangeMax))
+ .attr('x', xp1(rangeMax > 0 ? rangeMin : rangeMax))
+ .datum(rangeMax > 0 ? rangeMin : rangeMax)
+ /*
+ .attr('width', rangeMax <= 0 ?
+ x1(rangeAvg) - x1(rangeMin)
+ : x1(rangeMax) - x1(rangeAvg))
+ .attr('x', rangeMax <= 0 ?
+ x1(rangeMin)
+ : x1(rangeAvg))
+ */
+
+ g.select('rect.nv-measure')
+ .style('fill', color)
+ .attr('height', availableHeight / 3)
+ .attr('y', availableHeight / 3)
+ .attr('width', measurez < 0 ?
+ x1(0) - x1(measurez[0])
+ : x1(measurez[0]) - x1(0))
+ .attr('x', xp1(measurez))
+ .on('mouseover', function() {
+ dispatch.elementMouseover({
+ value: measurez[0],
+ label: measureLabelz[0] || 'Current',
+ pos: [x1(measurez[0]), availableHeight/2]
+ })
+ })
+ .on('mouseout', function() {
+ dispatch.elementMouseout({
+ value: measurez[0],
+ label: measureLabelz[0] || 'Current'
+ })
+ })
+
+ var h3 = availableHeight / 6;
+ if (markerz[0]) {
+ g.selectAll('path.nv-markerTriangle')
+ .attr('transform', function(d) { return 'translate(' + x1(markerz[0]) + ',' + (availableHeight / 2) + ')' })
+ .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
+ .on('mouseover', function() {
+ dispatch.elementMouseover({
+ value: markerz[0],
+ label: markerLabelz[0] || 'Previous',
+ pos: [x1(markerz[0]), availableHeight/2]
+ })
+ })
+ .on('mouseout', function() {
+ dispatch.elementMouseout({
+ value: markerz[0],
+ label: markerLabelz[0] || 'Previous'
+ })
+ });
+ } else {
+ g.selectAll('path.nv-markerTriangle').remove();
+ }
+
+
+ wrap.selectAll('.nv-range')
+ .on('mouseover', function(d,i) {
+ var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum");
+
+ dispatch.elementMouseover({
+ value: d,
+ label: label,
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum");
+
+ dispatch.elementMouseout({
+ value: d,
+ label: label
+ })
+ })
+
+/* // THIS IS THE PREVIOUS BULLET IMPLEMENTATION, WILL REMOVE SHORTLY
+ // Update the range rects.
+ var range = g.selectAll('rect.nv-range')
+ .data(rangez);
+
+ range.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-range nv-s' + i; })
+ .attr('width', w0)
+ .attr('height', availableHeight)
+ .attr('x', reverse ? x0 : 0)
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: (i <= 0) ? 'Maximum' : (i > 1) ? 'Minimum' : 'Mean', //TODO: make these labels a variable
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: (i <= 0) ? 'Minimum' : (i >=1) ? 'Maximum' : 'Mean' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(range)
+ .attr('x', reverse ? x1 : 0)
+ .attr('width', w1)
+ .attr('height', availableHeight);
+
+
+ // Update the measure rects.
+ var measure = g.selectAll('rect.nv-measure')
+ .data(measurez);
+
+ measure.enter().append('rect')
+ .attr('class', function(d, i) { return 'nv-measure nv-s' + i; })
+ .style('fill', function(d,i) { return color(d,i ) })
+ .attr('width', w0)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x0 : 0)
+ .attr('y', availableHeight / 3)
+ .on('mouseover', function(d) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Current', //TODO: make these labels a variable
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Current' //TODO: make these labels a variable
+ })
+ })
+
+ d3.transition(measure)
+ .attr('width', w1)
+ .attr('height', availableHeight / 3)
+ .attr('x', reverse ? x1 : 0)
+ .attr('y', availableHeight / 3);
+
+
+
+ // Update the marker lines.
+ var marker = g.selectAll('path.nv-markerTriangle')
+ .data(markerz);
+
+ var h3 = availableHeight / 6;
+ marker.enter().append('path')
+ .attr('class', 'nv-markerTriangle')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',' + (availableHeight / 2) + ')' })
+ .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
+ .on('mouseover', function(d,i) {
+ dispatch.elementMouseover({
+ value: d,
+ label: 'Previous',
+ pos: [x1(d), availableHeight/2]
+ })
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.elementMouseout({
+ value: d,
+ label: 'Previous'
+ })
+ });
+
+ d3.transition(marker)
+ .attr('transform', function(d) { return 'translate(' + (x1(d) - x1(0)) + ',' + (availableHeight / 2) + ')' });
+
+ marker.exit().remove();
+*/
+
+ });
+
+ // d3.timer.flush(); // Not needed?
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ // left, right, top, bottom
+ chart.orient = function(_) {
+ if (!arguments.length) return orient;
+ orient = _;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(_) {
+ if (!arguments.length) return ranges;
+ ranges = _;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(_) {
+ if (!arguments.length) return markers;
+ markers = _;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(_) {
+ if (!arguments.length) return measures;
+ measures = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(_) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bulletChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bulletChart.js
new file mode 100644
index 00000000..fa5bd596
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bulletChart.js
@@ -0,0 +1,343 @@
+
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+nv.models.bulletChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var bullet = nv.models.bullet()
+ ;
+
+ var orient = 'left' // TODO top & bottom
+ , reverse = false
+ , margin = {top: 5, right: 40, bottom: 20, left: 120}
+ , ranges = function(d) { return d.ranges }
+ , markers = function(d) { return d.markers }
+ , measures = function(d) { return d.measures }
+ , width = null
+ , height = 55
+ , tickFormat = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ) + margin.left,
+ top = e.pos[1] + ( offsetElement.offsetTop || 0) + margin.top,
+ content = tooltip(e.key, e.label, e.value, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(d, i) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ that = this;
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!d || !ranges.call(this, d, i)) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', 18 + margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-bulletChart').data([d]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bulletChart');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-bulletWrap');
+ gEnter.append('g').attr('class', 'nv-titles');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) // TODO: need to allow forceX and forceY, and xDomain, yDomain
+ .range(reverse ? [availableWidth, 0] : [0, availableWidth]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+ /*
+ // Derive width-scales from the x-scales.
+ var w0 = bulletWidth(x0),
+ w1 = bulletWidth(x1);
+
+ function bulletWidth(x) {
+ var x0 = x(0);
+ return function(d) {
+ return Math.abs(x(d) - x(0));
+ };
+ }
+
+ function bulletTranslate(x) {
+ return function(d) {
+ return 'translate(' + x(d) + ',0)';
+ };
+ }
+ */
+
+ var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0)
+ w1 = function(d) { return Math.abs(x1(d) - x1(0)) };
+
+
+ var title = gEnter.select('.nv-titles').append('g')
+ .attr('text-anchor', 'end')
+ .attr('transform', 'translate(-6,' + (height - margin.top - margin.bottom) / 2 + ')');
+ title.append('text')
+ .attr('class', 'nv-title')
+ .text(function(d) { return d.title; });
+
+ title.append('text')
+ .attr('class', 'nv-subtitle')
+ .attr('dy', '1em')
+ .text(function(d) { return d.subtitle; });
+
+
+
+ bullet
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var bulletWrap = g.select('.nv-bulletWrap');
+
+ d3.transition(bulletWrap).call(bullet);
+
+
+
+ // Compute the tick format.
+ var format = tickFormat || x1.tickFormat( availableWidth / 100 );
+
+ // Update the tick groups.
+ var tick = g.selectAll('g.nv-tick')
+ .data(x1.ticks( availableWidth / 50 ), function(d) {
+ return this.textContent || format(d);
+ });
+
+ // Initialize the ticks with the old scale, x0.
+ var tickEnter = tick.enter().append('g')
+ .attr('class', 'nv-tick')
+ .attr('transform', function(d) { return 'translate(' + x0(d) + ',0)' })
+ .style('opacity', 1e-6);
+
+ tickEnter.append('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickEnter.append('text')
+ .attr('text-anchor', 'middle')
+ .attr('dy', '1em')
+ .attr('y', availableHeight * 7 / 6)
+ .text(format);
+
+
+ // Transition the updating ticks to the new scale, x1.
+ var tickUpdate = d3.transition(tick)
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1);
+
+ tickUpdate.select('line')
+ .attr('y1', availableHeight)
+ .attr('y2', availableHeight * 7 / 6);
+
+ tickUpdate.select('text')
+ .attr('y', availableHeight * 7 / 6);
+
+ // Transition the exiting ticks to the new scale, x1.
+ d3.transition(tick.exit())
+ .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' })
+ .style('opacity', 1e-6)
+ .remove();
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('tooltipShow', function(e) {
+ e.key = d.title;
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+ });
+
+ d3.timer.flush();
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ bullet.dispatch.on('elementMouseover.tooltip', function(e) {
+ dispatch.tooltipShow(e);
+ });
+
+ bullet.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.bullet = bullet;
+
+ d3.rebind(chart, bullet, 'color');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ // left, right, top, bottom
+ chart.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ reverse = orient == 'right' || orient == 'bottom';
+ return chart;
+ };
+
+ // ranges (bad, satisfactory, good)
+ chart.ranges = function(x) {
+ if (!arguments.length) return ranges;
+ ranges = x;
+ return chart;
+ };
+
+ // markers (previous, goal)
+ chart.markers = function(x) {
+ if (!arguments.length) return markers;
+ markers = x;
+ return chart;
+ };
+
+ // measures (actual, forecast)
+ chart.measures = function(x) {
+ if (!arguments.length) return measures;
+ measures = x;
+ return chart;
+ };
+
+ chart.width = function(x) {
+ if (!arguments.length) return width;
+ width = x;
+ return chart;
+ };
+
+ chart.height = function(x) {
+ if (!arguments.length) return height;
+ height = x;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = x;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+};
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/cumulativeLineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/cumulativeLineChart.js
new file mode 100644
index 00000000..00f193cf
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/cumulativeLineChart.js
@@ -0,0 +1,782 @@
+
+nv.models.cumulativeLineChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , interactiveLayer = nv.interactiveGuideline()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 50, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , tooltips = true
+ , showControls = true
+ , useInteractiveGuideline = false
+ , rescaleY = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , id = lines.id()
+ , state = { index: 0, rescaleY: rescaleY }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , average = function(d) { return d.average }
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ //============================================================
+ controls.updateState(false);
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var dx = d3.scale.linear()
+ , index = {i: 0, x: 0}
+ ;
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+/*
+ //Moved to see if we can get better behavior to fix issue #315
+ var indexDrag = d3.behavior.drag()
+ .on('dragstart', dragStart)
+ .on('drag', dragMove)
+ .on('dragend', dragEnd);
+
+ function dragStart(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'ew-resize');
+ }
+
+ function dragMove(d,i) {
+ d.x += d3.event.dx;
+ d.i = Math.round(dx.invert(d.x));
+
+ d3.select(this).attr('transform', 'translate(' + dx(d.i) + ',0)');
+ chart.update();
+ }
+
+ function dragEnd(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'auto');
+ chart.update();
+ }
+*/
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this).classed('nv-chart-' + id, true),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ var indexDrag = d3.behavior.drag()
+ .on('dragstart', dragStart)
+ .on('drag', dragMove)
+ .on('dragend', dragEnd);
+
+
+ function dragStart(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'ew-resize');
+ }
+
+ function dragMove(d,i) {
+ index.x = d3.event.x;
+ index.i = Math.round(dx.invert(index.x));
+ updateZero();
+ }
+
+ function dragEnd(d,i) {
+ d3.select(chart.container)
+ .style('cursor', 'auto');
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+
+
+ if (!rescaleY) {
+ var seriesDomains = data
+ .filter(function(series) { return !series.disabled })
+ .map(function(series,i) {
+ var initialDomain = d3.extent(series.values, lines.y());
+
+ //account for series being disabled when losing 95% or more
+ if (initialDomain[0] < -.95) initialDomain[0] = -.95;
+
+ return [
+ (initialDomain[0] - initialDomain[1]) / (1 + initialDomain[1]),
+ (initialDomain[1] - initialDomain[0]) / (1 + initialDomain[0])
+ ];
+ });
+
+ var completeDomain = [
+ d3.min(seriesDomains, function(d) { return d[0] }),
+ d3.max(seriesDomains, function(d) { return d[1] })
+ ]
+
+ lines.yDomain(completeDomain);
+ } else {
+ lines.yDomain(null);
+ }
+
+
+ dx .domain([0, data[0].values.length - 1]) //Assumes all series have same length
+ .range([0, availableWidth])
+ .clamp(true);
+
+ //------------------------------------------------------------
+
+
+ var data = indexify(index.i, data);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+ var interactivePointerEvents = (useInteractiveGuideline) ? "none" : "all";
+ var wrap = container.selectAll('g.nv-wrap.nv-cumulativeLine').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-cumulativeLine').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-interactive');
+ gEnter.append('g').attr('class', 'nv-x nv-axis').style("pointer-events","none");
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-background');
+ gEnter.append('g').attr('class', 'nv-linesWrap').style("pointer-events",interactivePointerEvents);
+ gEnter.append('g').attr('class', 'nv-avgLinesWrap').style("pointer-events","none");
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Re-scale y-axis', disabled: !rescaleY }
+ ];
+
+ controls.width(140).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ // Show error if series goes below 100%
+ var tempDisabled = data.filter(function(d) { return d.tempDisabled });
+
+ wrap.select('.tempDisabled').remove(); //clean-up and prevent duplicates
+ if (tempDisabled.length) {
+ wrap.append('text').attr('class', 'tempDisabled')
+ .attr('x', availableWidth / 2)
+ .attr('y', '-.71em')
+ .style('text-anchor', 'end')
+ .text(tempDisabled.map(function(d) { return d.key }).join(', ') + ' values cannot be calculated for this time period.');
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ //------------------------------------------------------------
+ //Set up interactive layer
+ if (useInteractiveGuideline) {
+ interactiveLayer
+ .width(availableWidth)
+ .height(availableHeight)
+ .margin({left:margin.left,top:margin.top})
+ .svgContainer(container)
+ .xScale(x);
+ wrap.select(".nv-interactive").call(interactiveLayer);
+ }
+
+ gEnter.select('.nv-background')
+ .append('rect');
+
+ g.select('.nv-background rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ lines
+ //.x(function(d) { return d.x })
+ .y(function(d) { return d.display.y })
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].tempDisabled; }));
+
+
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled && !d.tempDisabled }));
+
+ //d3.transition(linesWrap).call(lines);
+ linesWrap.call(lines);
+
+ /*Handle average lines [AN-612] ----------------------------*/
+
+ //Store a series index number in the data array.
+ data.forEach(function(d,i) {
+ d.seriesIndex = i;
+ });
+
+ var avgLineData = data.filter(function(d) {
+ return !d.disabled && !!average(d);
+ });
+
+ var avgLines = g.select(".nv-avgLinesWrap").selectAll("line")
+ .data(avgLineData, function(d) { return d.key; });
+
+ var getAvgLineY = function(d) {
+ //If average lines go off the svg element, clamp them to the svg bounds.
+ var yVal = y(average(d));
+ if (yVal < 0) return 0;
+ if (yVal > availableHeight) return availableHeight;
+ return yVal;
+ };
+
+ avgLines.enter()
+ .append('line')
+ .style('stroke-width',2)
+ .style('stroke-dasharray','10,10')
+ .style('stroke',function (d,i) {
+ return lines.color()(d,d.seriesIndex);
+ })
+ .attr('x1',0)
+ .attr('x2',availableWidth)
+ .attr('y1', getAvgLineY)
+ .attr('y2', getAvgLineY);
+
+ avgLines
+ .style('stroke-opacity',function(d){
+ //If average lines go offscreen, make them transparent
+ var yVal = y(average(d));
+ if (yVal < 0 || yVal > availableHeight) return 0;
+ return 1;
+ })
+ .attr('x1',0)
+ .attr('x2',availableWidth)
+ .attr('y1', getAvgLineY)
+ .attr('y2', getAvgLineY);
+
+ avgLines.exit().remove();
+
+ //Create index line -----------------------------------------
+
+ var indexLine = linesWrap.selectAll('.nv-indexLine')
+ .data([index]);
+ indexLine.enter().append('rect').attr('class', 'nv-indexLine')
+ .attr('width', 3)
+ .attr('x', -2)
+ .attr('fill', 'red')
+ .attr('fill-opacity', .5)
+ .style("pointer-events","all")
+ .call(indexDrag)
+
+ indexLine
+ .attr('transform', function(d) { return 'translate(' + dx(d.i) + ',0)' })
+ .attr('height', availableHeight)
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ //Suggest how many ticks based on the chart width and D3 should listen (70 is the optimal number for MM/DD/YY dates)
+ .ticks( Math.min(data[0].values.length,availableWidth/70) )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+ }
+
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+ }
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+
+ function updateZero() {
+ indexLine
+ .data([index]);
+
+ //When dragging the index line, turn off line transitions.
+ // Then turn them back on when done dragging.
+ var oldDuration = chart.transitionDuration();
+ chart.transitionDuration(0);
+ chart.update();
+ chart.transitionDuration(oldDuration);
+ }
+
+ g.select('.nv-background rect')
+ .on('click', function() {
+ index.x = d3.mouse(this)[0];
+ index.i = Math.round(dx.invert(index.x));
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+
+ updateZero();
+ });
+
+ lines.dispatch.on('elementClick', function(e) {
+ index.i = e.pointIndex;
+ index.x = dx(index.i);
+
+ // update state and send stateChange with new index
+ state.index = index.i;
+ dispatch.stateChange(state);
+
+ updateZero();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+ rescaleY = !d.disabled;
+
+ state.rescaleY = rescaleY;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state.disabled = newState.disabled;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ interactiveLayer.dispatch.on('elementMousemove', function(e) {
+ lines.clearHighlights();
+ var singlePoint, pointIndex, pointXLocation, allData = [];
+
+
+ data
+ .filter(function(series, i) {
+ series.seriesIndex = i;
+ return !series.disabled;
+ })
+ .forEach(function(series,i) {
+ pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x());
+ lines.highlightPoint(i, pointIndex, true);
+ var point = series.values[pointIndex];
+ if (typeof point === 'undefined') return;
+ if (typeof singlePoint === 'undefined') singlePoint = point;
+ if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex));
+ allData.push({
+ key: series.key,
+ value: chart.y()(point, pointIndex),
+ color: color(series,series.seriesIndex)
+ });
+ });
+
+ //Highlight the tooltip entry based on which point the mouse is closest to.
+ if (allData.length > 2) {
+ var yValue = chart.yScale().invert(e.mouseY);
+ var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]);
+ var threshold = 0.03 * domainExtent;
+ var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold);
+ if (indexToHighlight !== null)
+ allData[indexToHighlight].highlight = true;
+ }
+
+ var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex), pointIndex);
+ interactiveLayer.tooltip
+ .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
+ .chartContainer(that.parentNode)
+ .enabled(tooltips)
+ .valueFormatter(function(d,i) {
+ return yAxis.tickFormat()(d);
+ })
+ .data(
+ {
+ value: xValue,
+ series: allData
+ }
+ )();
+
+ interactiveLayer.renderGuideLine(pointXLocation);
+
+ });
+
+ interactiveLayer.dispatch.on("elementMouseout",function(e) {
+ dispatch.tooltipHide();
+ lines.clearHighlights();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+
+ if (typeof e.index !== 'undefined') {
+ index.i = e.index;
+ index.x = dx(index.i);
+
+ state.index = e.index;
+
+ indexLine
+ .data([index]);
+ }
+
+
+ if (typeof e.rescaleY !== 'undefined') {
+ rescaleY = e.rescaleY;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.lines = lines;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.interactiveLayer = interactiveLayer;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'xScale','yScale', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi','useVoronoi', 'id');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.rescaleY = function(_) {
+ if (!arguments.length) return rescaleY;
+ rescaleY = _;
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.useInteractiveGuideline = function(_) {
+ if(!arguments.length) return useInteractiveGuideline;
+ useInteractiveGuideline = _;
+ if (_ === true) {
+ chart.interactive(false);
+ chart.useVoronoi(false);
+ }
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.average = function(_) {
+ if(!arguments.length) return average;
+ average = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ /* Normalize the data according to an index point. */
+ function indexify(idx, data) {
+ return data.map(function(line, i) {
+ if (!line.values) {
+ return line;
+ }
+ var v = lines.y()(line.values[idx], idx);
+
+ //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue
+ if (v < -.95) {
+ //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100)
+ line.tempDisabled = true;
+ return line;
+ }
+
+ line.tempDisabled = false;
+
+ line.values = line.values.map(function(point, pointIndex) {
+ point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) };
+ return point;
+ })
+
+ return line;
+ })
+ }
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBar.js
new file mode 100644
index 00000000..a20f5829
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBar.js
@@ -0,0 +1,349 @@
+//TODO: consider deprecating by adding necessary features to multiBar model
+nv.models.discreteBar = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , color = nv.utils.defaultColor()
+ , showValues = false
+ , valueFormat = d3.format(',.2f')
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ , rectClass = 'discreteBar'
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0 }
+ })
+ });
+
+ x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands(xRange || [0, availableWidth], .1);
+
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y }).concat(forceY)));
+
+
+ // If showValues, pad the Y axis range to account for label height
+ if (showValues) y.range(yRange || [availableHeight - (y.domain()[0] < 0 ? 12 : 0), y.domain()[1] > 0 ? 12 : 0]);
+ else y.range(yRange || [availableHeight, 0]);
+
+ //store old scales if they exist
+ x0 = x0 || x;
+ y0 = y0 || y.copy().range([y(0),y(0)]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-discretebar').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discretebar');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ //TODO: by definition, the discrete bar should not have multiple groups, will modify/remove later
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit()
+ .transition()
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover });
+ groups
+ .transition()
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('g.nv-bar')
+ .data(function(d) { return d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('g')
+ .attr('transform', function(d,i,j) {
+ return 'translate(' + (x(getX(d,i)) + x.rangeBand() * .05 ) + ', ' + y(0) + ')'
+ })
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+
+ barsEnter.append('rect')
+ .attr('height', 0)
+ .attr('width', x.rangeBand() * .9 / data.length )
+
+ if (showValues) {
+ barsEnter.append('text')
+ .attr('text-anchor', 'middle')
+ ;
+
+ bars.select('text')
+ .text(function(d,i) { return valueFormat(getY(d,i)) })
+ .transition()
+ .attr('x', x.rangeBand() * .9 / 2)
+ .attr('y', function(d,i) { return getY(d,i) < 0 ? y(getY(d,i)) - y(0) + 12 : -4 })
+
+ ;
+ } else {
+ bars.selectAll('text').remove();
+ }
+
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive' })
+ .style('fill', function(d,i) { return d.color || color(d,i) })
+ .style('stroke', function(d,i) { return d.color || color(d,i) })
+ .select('rect')
+ .attr('class', rectClass)
+ .transition()
+ .attr('width', x.rangeBand() * .9 / data.length);
+ bars.transition()
+ //.delay(function(d,i) { return i * 1200 / data[0].values.length })
+ .attr('transform', function(d,i) {
+ var left = x(getX(d,i)) + x.rangeBand() * .05,
+ top = getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 : //make 1 px positive bars show up above y=0
+ y(getY(d,i));
+
+ return 'translate(' + left + ', ' + top + ')'
+ })
+ .select('rect')
+ .attr('height', function(d,i) {
+ return Math.max(Math.abs(y(getY(d,i)) - y((yDomain && yDomain[0]) || 0)) || 1)
+ });
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.showValues = function(_) {
+ if (!arguments.length) return showValues;
+ showValues = _;
+ return chart;
+ };
+
+ chart.valueFormat= function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.rectClass= function(_) {
+ if (!arguments.length) return rectClass;
+ rectClass = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBarChart.js
new file mode 100644
index 00000000..48a48164
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBarChart.js
@@ -0,0 +1,333 @@
+
+nv.models.discreteBarChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var discretebar = nv.models.discreteBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ ;
+
+ var margin = {top: 15, right: 10, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.getColor()
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , staggerLabels = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , x
+ , y
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'beforeUpdate')
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .highlightZero(false)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(discretebar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(discretebar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() {
+ dispatch.beforeUpdate();
+ container.transition().duration(transitionDuration).call(chart);
+ };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = discretebar.xScale();
+ y = discretebar.yScale().clamp(true);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-discreteBarWithAxes').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discreteBarWithAxes').append('g');
+ var defsEnter = gEnter.append('defs');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+
+ g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ discretebar
+ .width(availableWidth)
+ .height(availableHeight);
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ barsWrap.transition().call(discretebar);
+
+ //------------------------------------------------------------
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-x-label-clip-' + discretebar.id())
+ .append('rect');
+
+ g.select('#nv-x-label-clip-' + discretebar.id() + ' rect')
+ .attr('width', x.rangeBand() * (staggerLabels ? 2 : 1))
+ .attr('height', 16)
+ .attr('x', -x.rangeBand() / (staggerLabels ? 1 : 2 ));
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + (y.range()[0] + ((discretebar.showValues() && y.domain()[0] < 0) ? 16 : 0)) + ')');
+ //d3.transition(g.select('.nv-x.nv-axis'))
+ g.select('.nv-x.nv-axis').transition()
+ .call(xAxis);
+
+
+ var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
+
+ if (staggerLabels) {
+ xTicks
+ .selectAll('text')
+ .attr('transform', function(d,i,j) { return 'translate(0,' + (j % 2 == 0 ? '5' : '17') + ')' })
+ }
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis').transition()
+ .call(yAxis);
+ }
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ discretebar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ discretebar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.discretebar = discretebar;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, discretebar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'id', 'showValues', 'valueFormat');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ discretebar.color(color);
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/distribution.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/distribution.js
new file mode 100644
index 00000000..62a74655
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/distribution.js
@@ -0,0 +1,148 @@
+
+nv.models.distribution = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 400 //technically width or height depending on x or y....
+ , size = 8
+ , axis = 'x' // 'x' or 'y'... horizontal or vertical
+ , getData = function(d) { return d[axis] } // defaults d.x or d.y
+ , color = nv.utils.defaultColor()
+ , scale = d3.scale.linear()
+ , domain
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var scale0;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableLength = width - (axis === 'x' ? margin.left + margin.right : margin.top + margin.bottom),
+ naxis = axis == 'x' ? 'y' : 'x',
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ scale0 = scale0 || scale;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-distribution').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-distribution');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
+
+ //------------------------------------------------------------
+
+
+ var distWrap = g.selectAll('g.nv-dist')
+ .data(function(d) { return d }, function(d) { return d.key });
+
+ distWrap.enter().append('g');
+ distWrap
+ .attr('class', function(d,i) { return 'nv-dist nv-series-' + i })
+ .style('stroke', function(d,i) { return color(d, i) });
+
+ var dist = distWrap.selectAll('line.nv-dist' + axis)
+ .data(function(d) { return d.values })
+ dist.enter().append('line')
+ .attr(axis + '1', function(d,i) { return scale0(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale0(getData(d,i)) })
+ distWrap.exit().selectAll('line.nv-dist' + axis)
+ .transition()
+ .attr(axis + '1', function(d,i) { return scale(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale(getData(d,i)) })
+ .style('stroke-opacity', 0)
+ .remove();
+ dist
+ .attr('class', function(d,i) { return 'nv-dist' + axis + ' nv-dist' + axis + '-' + i })
+ .attr(naxis + '1', 0)
+ .attr(naxis + '2', size);
+ dist
+ .transition()
+ .attr(axis + '1', function(d,i) { return scale(getData(d,i)) })
+ .attr(axis + '2', function(d,i) { return scale(getData(d,i)) })
+
+
+ scale0 = scale.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.axis = function(_) {
+ if (!arguments.length) return axis;
+ axis = _;
+ return chart;
+ };
+
+ chart.size = function(_) {
+ if (!arguments.length) return size;
+ size = _;
+ return chart;
+ };
+
+ chart.getData = function(_) {
+ if (!arguments.length) return getData;
+ getData = d3.functor(_);
+ return chart;
+ };
+
+ chart.scale = function(_) {
+ if (!arguments.length) return scale;
+ scale = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBar.js
new file mode 100644
index 00000000..2a6c644d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBar.js
@@ -0,0 +1,331 @@
+//TODO: consider deprecating and using multibar with single series for this
+nv.models.historicalBar = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceX = []
+ , forceY = [0]
+ , padData = false
+ , clipEdge = true
+ , color = nv.utils.defaultColor()
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ , interactive = true
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) ))
+
+ if (padData)
+ x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(data[0].values.map(getY).concat(forceY) ))
+ .range(yRange || [availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-historicalBar-' + id).data([data[0].values]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBar-' + id);
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-bars');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-chart-clip-path-' + id)
+ .append('rect');
+
+ wrap.select('#nv-chart-clip-path-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : '');
+
+
+
+ var bars = wrap.select('.nv-bars').selectAll('.nv-bar')
+ .data(function(d) { return d }, function(d,i) {return getX(d,i)});
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('rect')
+ //.attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i })
+ .attr('x', 0 )
+ .attr('y', function(d,i) { return nv.utils.NaNtoZero(y(Math.max(0, getY(d,i)))) })
+ .attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.abs(y(getY(d,i)) - y(0))) })
+ .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; })
+ .on('mouseover', function(d,i) {
+ if (!interactive) return;
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ point: d,
+ series: data[0],
+ pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+
+ })
+ .on('mouseout', function(d,i) {
+ if (!interactive) return;
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ point: d,
+ series: data[0],
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ if (!interactive) return;
+ dispatch.elementClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ if (!interactive) return;
+ dispatch.elementDblClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ bars
+ .attr('fill', function(d,i) { return color(d, i); })
+ .attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i })
+ .transition()
+ .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; })
+ //TODO: better width calculations that don't assume always uniform data spacing;w
+ .attr('width', (availableWidth / data[0].values.length) * .9 );
+
+
+ bars.transition()
+ .attr('y', function(d,i) {
+ var rval = getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 :
+ y(getY(d,i));
+ return nv.utils.NaNtoZero(rval);
+ })
+ .attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.max(Math.abs(y(getY(d,i)) - y(0)),1)) });
+
+ });
+
+ return chart;
+ }
+
+ //Create methods to allow outside functions to highlight a specific bar.
+ chart.highlightPoint = function(pointIndex, isHoverOver) {
+ d3.select(".nv-historicalBar-" + id)
+ .select(".nv-bars .nv-bar-0-" + pointIndex)
+ .classed("hover", isHoverOver)
+ ;
+ };
+
+ chart.clearHighlights = function() {
+ d3.select(".nv-historicalBar-" + id)
+ .select(".nv-bars .nv-bar.hover")
+ .classed("hover", false)
+ ;
+ };
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.interactive = function(_) {
+ if(!arguments.length) return interactive;
+ interactive = false;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBarChart.js
new file mode 100644
index 00000000..a5b4a097
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBarChart.js
@@ -0,0 +1,419 @@
+
+nv.models.historicalBarChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var bars = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ ;
+
+
+ var margin = {top: 30, right: 90, bottom: 50, left: 90}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = false
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x
+ , y
+ , state = {}
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient( (rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+
+ // New addition to calculate position if SVG is scaled with viewBox, may move TODO: consider implementing everywhere else
+ if (offsetElement) {
+ var svg = d3.select(offsetElement).select('svg');
+ var viewBox = (svg.node()) ? svg.attr('viewBox') : null;
+ if (viewBox) {
+ viewBox = viewBox.split(' ');
+ var ratio = parseInt(svg.style('width')) / viewBox[2];
+ e.pos[0] = e.pos[0] * ratio;
+ e.pos[1] = e.pos[1] * ratio;
+ }
+ }
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(bars.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(bars.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = bars.xScale();
+ y = bars.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-historicalBarChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBarChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ barsWrap.transition().call(bars);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ g.select('.nv-x.nv-axis')
+ .transition()
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .transition()
+ .call(yAxis);
+ }
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ selection.transition().call(chart);
+ });
+
+ legend.dispatch.on('legendDblclick', function(d) {
+ //Double clicking should always enable current series, and disabled all others.
+ data.forEach(function(d) {
+ d.disabled = true;
+ });
+ d.disabled = false;
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ selection.call(chart);
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.bars = bars;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, bars, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale',
+ 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate','highlightPoint','clearHighlights', 'interactive');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/indentedTree.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/indentedTree.js
new file mode 100644
index 00000000..18c2700f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/indentedTree.js
@@ -0,0 +1,337 @@
+nv.models.indentedTree = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor()
+ , id = Math.floor(Math.random() * 10000)
+ , header = true
+ , filterZero = false
+ , noData = "No Data Available."
+ , childIndent = 20
+ , columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this
+ , tableClass = null
+ , iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images
+ , iconClose = 'images/grey-minus.png'
+ , dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout')
+ , getUrl = function(d) { return d.url }
+ ;
+
+ //============================================================
+
+ var idx = 0;
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var depth = 1,
+ container = d3.select(this);
+
+ var tree = d3.layout.tree()
+ .children(function(d) { return d.values })
+ .size([height, childIndent]); //Not sure if this is needed now that the result is HTML
+
+ chart.update = function() { container.transition().duration(600).call(chart) };
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+ if (!data[0]) data[0] = {key: noData};
+
+ //------------------------------------------------------------
+
+
+ var nodes = tree.nodes(data[0]);
+
+ // nodes.map(function(d) {
+ // d.id = i++;
+ // })
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('div').data([[nodes]]);
+ var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree');
+ var tableEnter = wrapEnter.append('table');
+ var table = wrap.select('table').attr('width', '100%').attr('class', tableClass);
+
+ //------------------------------------------------------------
+
+
+ if (header) {
+ var thead = tableEnter.append('thead');
+
+ var theadRow1 = thead.append('tr');
+
+ columns.forEach(function(column) {
+ theadRow1
+ .append('th')
+ .attr('width', column.width ? column.width : '10%')
+ .style('text-align', column.type == 'numeric' ? 'right' : 'left')
+ .append('span')
+ .text(column.label);
+ });
+ }
+
+
+ var tbody = table.selectAll('tbody')
+ .data(function(d) { return d });
+ tbody.enter().append('tbody');
+
+
+
+ //compute max generations
+ depth = d3.max(nodes, function(node) { return node.depth });
+ tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all
+
+
+ // Update the nodes…
+ var node = tbody.selectAll('tr')
+ // .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)});
+ .data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)});
+ //.style('display', 'table-row'); //TODO: see if this does anything
+
+ node.exit().remove();
+
+ node.select('img.nv-treeicon')
+ .attr('src', icon)
+ .classed('folded', folded);
+
+ var nodeEnter = node.enter().append('tr');
+
+
+ columns.forEach(function(column, index) {
+
+ var nodeName = nodeEnter.append('td')
+ .style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here
+ .style('text-align', column.type == 'numeric' ? 'right' : 'left');
+
+
+ if (index == 0) {
+ nodeName.append('img')
+ .classed('nv-treeicon', true)
+ .classed('nv-folded', folded)
+ .attr('src', icon)
+ .style('width', '14px')
+ .style('height', '14px')
+ .style('padding', '0 1px')
+ .style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; })
+ .on('click', click);
+ }
+
+
+ nodeName.each(function(d) {
+ if (!index && getUrl(d))
+ d3.select(this)
+ .append('a')
+ .attr('href',getUrl)
+ .attr('class', d3.functor(column.classes))
+ .append('span')
+ else
+ d3.select(this)
+ .append('span')
+
+ d3.select(this).select('span')
+ .attr('class', d3.functor(column.classes) )
+ .text(function(d) { return column.format ? column.format(d) :
+ (d[column.key] || '-') });
+ });
+
+ if (column.showCount) {
+ nodeName.append('span')
+ .attr('class', 'nv-childrenCount');
+
+ node.selectAll('span.nv-childrenCount').text(function(d) {
+ return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent
+ '(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter
+ || (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values...
+ || 0) + ')' //This is the catch-all in case there are no children after a filter
+ : '' //If this is not a parent, just give an empty string
+ });
+ }
+
+ // if (column.click)
+ // nodeName.select('span').on('click', column.click);
+
+ });
+
+ node
+ .order()
+ .on('click', function(d) {
+ dispatch.elementClick({
+ row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href)
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('dblclick', function(d) {
+ dispatch.elementDblclick({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('mouseover', function(d) {
+ dispatch.elementMouseover({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ })
+ .on('mouseout', function(d) {
+ dispatch.elementMouseout({
+ row: this,
+ data: d,
+ pos: [d.x, d.y]
+ });
+ });
+
+
+
+
+ // Toggle children on click.
+ function click(d, _, unshift) {
+ d3.event.stopPropagation();
+
+ if(d3.event.shiftKey && !unshift) {
+ //If you shift-click, it'll toggle fold all the children, instead of itself
+ d3.event.shiftKey = false;
+ d.values && d.values.forEach(function(node){
+ if (node.values || node._values) {
+ click(node, 0, true);
+ }
+ });
+ return true;
+ }
+ if(!hasChildren(d)) {
+ //download file
+ //window.location.href = d.url;
+ return true;
+ }
+ if (d.values) {
+ d._values = d.values;
+ d.values = null;
+ } else {
+ d.values = d._values;
+ d._values = null;
+ }
+ chart.update();
+ }
+
+
+ function icon(d) {
+ return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : '';
+ }
+
+ function folded(d) {
+ return (d._values && d._values.length);
+ }
+
+ function hasChildren(d) {
+ var values = d.values || d._values;
+
+ return (values && values.length);
+ }
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ scatter.color(color);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.header = function(_) {
+ if (!arguments.length) return header;
+ header = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.filterZero = function(_) {
+ if (!arguments.length) return filterZero;
+ filterZero = _;
+ return chart;
+ };
+
+ chart.columns = function(_) {
+ if (!arguments.length) return columns;
+ columns = _;
+ return chart;
+ };
+
+ chart.tableClass = function(_) {
+ if (!arguments.length) return tableClass;
+ tableClass = _;
+ return chart;
+ };
+
+ chart.iconOpen = function(_){
+ if (!arguments.length) return iconOpen;
+ iconOpen = _;
+ return chart;
+ }
+
+ chart.iconClose = function(_){
+ if (!arguments.length) return iconClose;
+ iconClose = _;
+ return chart;
+ }
+
+ chart.getUrl = function(_){
+ if (!arguments.length) return getUrl;
+ getUrl = _;
+ return chart;
+ }
+
+ //============================================================
+
+
+ return chart;
+}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/legend.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/legend.js
new file mode 100644
index 00000000..21f9f9a4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/legend.js
@@ -0,0 +1,270 @@
+nv.models.legend = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 5, right: 0, bottom: 5, left: 0}
+ , width = 400
+ , height = 20
+ , getKey = function(d) { return d.key }
+ , color = nv.utils.defaultColor()
+ , align = true
+ , rightAlign = true
+ , updateState = true //If true, legend will update data.disabled and trigger a 'stateChange' dispatch.
+ , radioButtonMode = false //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at a time)
+ , dispatch = d3.dispatch('legendClick', 'legendDblclick', 'legendMouseover', 'legendMouseout', 'stateChange')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-legend').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-legend').append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ var series = g.selectAll('.nv-series')
+ .data(function(d) { return d });
+ var seriesEnter = series.enter().append('g').attr('class', 'nv-series')
+ .on('mouseover', function(d,i) {
+ dispatch.legendMouseover(d,i); //TODO: Make consistent with other event objects
+ })
+ .on('mouseout', function(d,i) {
+ dispatch.legendMouseout(d,i);
+ })
+ .on('click', function(d,i) {
+ dispatch.legendClick(d,i);
+ if (updateState) {
+ if (radioButtonMode) {
+ //Radio button mode: set every series to disabled,
+ // and enable the clicked series.
+ data.forEach(function(series) { series.disabled = true});
+ d.disabled = false;
+ }
+ else {
+ d.disabled = !d.disabled;
+ if (data.every(function(series) { return series.disabled})) {
+ //the default behavior of NVD3 legends is, if every single series
+ // is disabled, turn all series' back on.
+ data.forEach(function(series) { series.disabled = false});
+ }
+ }
+ dispatch.stateChange({
+ disabled: data.map(function(d) { return !!d.disabled })
+ });
+ }
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.legendDblclick(d,i);
+ if (updateState) {
+ //the default behavior of NVD3 legends, when double clicking one,
+ // is to set all other series' to false, and make the double clicked series enabled.
+ data.forEach(function(series) {
+ series.disabled = true;
+ });
+ d.disabled = false;
+ dispatch.stateChange({
+ disabled: data.map(function(d) { return !!d.disabled })
+ });
+ }
+ });
+ seriesEnter.append('circle')
+ .style('stroke-width', 2)
+ .attr('class','nv-legend-symbol')
+ .attr('r', 5);
+ seriesEnter.append('text')
+ .attr('text-anchor', 'start')
+ .attr('class','nv-legend-text')
+ .attr('dy', '.32em')
+ .attr('dx', '8');
+ series.classed('disabled', function(d) { return d.disabled });
+ series.exit().remove();
+ series.select('circle')
+ .style('fill', function(d,i) { return d.color || color(d,i)})
+ .style('stroke', function(d,i) { return d.color || color(d, i) });
+ series.select('text').text(getKey);
+
+
+ //TODO: implement fixed-width and max-width options (max-width is especially useful with the align option)
+
+ // NEW ALIGNING CODE, TODO: clean up
+ if (align) {
+
+ var seriesWidths = [];
+ series.each(function(d,i) {
+ var legendText = d3.select(this).select('text');
+ var nodeTextLength;
+ try {
+ nodeTextLength = legendText.node().getComputedTextLength();
+ }
+ catch(e) {
+ nodeTextLength = nv.utils.calcApproxTextWidth(legendText);
+ }
+
+ seriesWidths.push(nodeTextLength + 28); // 28 is ~ the width of the circle plus some padding
+ });
+
+ var seriesPerRow = 0;
+ var legendWidth = 0;
+ var columnWidths = [];
+
+ while ( legendWidth < availableWidth && seriesPerRow < seriesWidths.length) {
+ columnWidths[seriesPerRow] = seriesWidths[seriesPerRow];
+ legendWidth += seriesWidths[seriesPerRow++];
+ }
+ if (seriesPerRow === 0) seriesPerRow = 1; //minimum of one series per row
+
+
+ while ( legendWidth > availableWidth && seriesPerRow > 1 ) {
+ columnWidths = [];
+ seriesPerRow--;
+
+ for (var k = 0; k < seriesWidths.length; k++) {
+ if (seriesWidths[k] > (columnWidths[k % seriesPerRow] || 0) )
+ columnWidths[k % seriesPerRow] = seriesWidths[k];
+ }
+
+ legendWidth = columnWidths.reduce(function(prev, cur, index, array) {
+ return prev + cur;
+ });
+ }
+
+ var xPositions = [];
+ for (var i = 0, curX = 0; i < seriesPerRow; i++) {
+ xPositions[i] = curX;
+ curX += columnWidths[i];
+ }
+
+ series
+ .attr('transform', function(d, i) {
+ return 'translate(' + xPositions[i % seriesPerRow] + ',' + (5 + Math.floor(i / seriesPerRow) * 20) + ')';
+ });
+
+ //position legend as far right as possible within the total width
+ if (rightAlign) {
+ g.attr('transform', 'translate(' + (width - margin.right - legendWidth) + ',' + margin.top + ')');
+ }
+ else {
+ g.attr('transform', 'translate(0' + ',' + margin.top + ')');
+ }
+
+ height = margin.top + margin.bottom + (Math.ceil(seriesWidths.length / seriesPerRow) * 20);
+
+ } else {
+
+ var ypos = 5,
+ newxpos = 5,
+ maxwidth = 0,
+ xpos;
+ series
+ .attr('transform', function(d, i) {
+ var length = d3.select(this).select('text').node().getComputedTextLength() + 28;
+ xpos = newxpos;
+
+ if (width < margin.left + margin.right + xpos + length) {
+ newxpos = xpos = 5;
+ ypos += 20;
+ }
+
+ newxpos += length;
+ if (newxpos > maxwidth) maxwidth = newxpos;
+
+ return 'translate(' + xpos + ',' + ypos + ')';
+ });
+
+ //position legend as far right as possible within the total width
+ g.attr('transform', 'translate(' + (width - margin.right - maxwidth) + ',' + margin.top + ')');
+
+ height = margin.top + margin.bottom + ypos + 15;
+
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.key = function(_) {
+ if (!arguments.length) return getKey;
+ getKey = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.align = function(_) {
+ if (!arguments.length) return align;
+ align = _;
+ return chart;
+ };
+
+ chart.rightAlign = function(_) {
+ if (!arguments.length) return rightAlign;
+ rightAlign = _;
+ return chart;
+ };
+
+ chart.updateState = function(_) {
+ if (!arguments.length) return updateState;
+ updateState = _;
+ return chart;
+ };
+
+ chart.radioButtonMode = function(_) {
+ if (!arguments.length) return radioButtonMode;
+ radioButtonMode = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/line.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/line.js
new file mode 100644
index 00000000..855cc541
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/line.js
@@ -0,0 +1,284 @@
+
+nv.models.line = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ ;
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // a function that returns a color
+ , getX = function(d) { return d.x } // accessor to get the x value from a data point
+ , getY = function(d) { return d.y } // accessor to get the y value from a data point
+ , defined = function(d,i) { return !isNaN(getY(d,i)) && getY(d,i) !== null } // allows a line to be not continuous when it is not defined
+ , isArea = function(d) { return d.area } // decides if a line is an area or just a line
+ , clipEdge = false // if true, masks lines within x and y scale
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , interpolate = "linear" // controls the line interpolation
+ ;
+
+ scatter
+ .size(16) // default size
+ .sizeDomain([16,256]) //set to speed up calculation, needs to be unset if there is a custom size accessor
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-line').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-groups');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var scatterWrap = wrap.select('.nv-scatterWrap');
+ //.datum(data); // Data automatically trickles down from the wrap
+
+ scatterWrap.transition().call(scatter);
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + scatter.id())
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + scatter.id() + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : '');
+ scatterWrap
+ .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : '');
+
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit()
+ .transition()
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i)});
+ groups
+ .transition()
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .5);
+
+
+
+ var areaPaths = groups.selectAll('path.nv-area')
+ .data(function(d) { return isArea(d) ? [d] : [] }); // this is done differently than lines because I need to check if series is an area
+ areaPaths.enter().append('path')
+ .attr('class', 'nv-area')
+ .attr('d', function(d) {
+ return d3.svg.area()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) })
+ .y0(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) })
+ .y1(function(d,i) { return y0( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
+ //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
+ .apply(this, [d.values])
+ });
+ groups.exit().selectAll('path.nv-area')
+ .remove();
+
+ areaPaths
+ .transition()
+ .attr('d', function(d) {
+ return d3.svg.area()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .y0(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ .y1(function(d,i) { return y( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
+ //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
+ .apply(this, [d.values])
+ });
+
+
+
+ var linePaths = groups.selectAll('path.nv-line')
+ .data(function(d) { return [d.values] });
+ linePaths.enter().append('path')
+ .attr('class', 'nv-line')
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) })
+ .y(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) })
+ );
+ groups.exit().selectAll('path.nv-line')
+ .transition()
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .y(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ );
+ linePaths
+ .transition()
+ .attr('d',
+ d3.svg.line()
+ .interpolate(interpolate)
+ .defined(defined)
+ .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .y(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ );
+
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = scatter.dispatch;
+ chart.scatter = scatter;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange',
+ 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'useVoronoi', 'clipRadius', 'padData','highlightPoint','clearHighlights');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ scatter.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ scatter.y(_);
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ scatter.color(color);
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ interpolate = _;
+ return chart;
+ };
+
+ chart.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return chart;
+ };
+
+ chart.isArea = function(_) {
+ if (!arguments.length) return isArea;
+ isArea = d3.functor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineChart.js
new file mode 100644
index 00000000..a4ffcf6a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineChart.js
@@ -0,0 +1,465 @@
+
+nv.models.lineChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , interactiveLayer = nv.interactiveGuideline()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , useInteractiveGuideline = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , x
+ , y
+ , state = {}
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append("rect").style("opacity",0);
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-interactive');
+
+ g.select("rect").attr("width",availableWidth).attr("height",availableHeight);
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+
+ //------------------------------------------------------------
+ //Set up interactive layer
+ if (useInteractiveGuideline) {
+ interactiveLayer
+ .width(availableWidth)
+ .height(availableHeight)
+ .margin({left:margin.left, top:margin.top})
+ .svgContainer(container)
+ .xScale(x);
+ wrap.select(".nv-interactive").call(interactiveLayer);
+ }
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ linesWrap.transition().call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ g.select('.nv-x.nv-axis')
+ .transition()
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .transition()
+ .call(yAxis);
+ }
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ interactiveLayer.dispatch.on('elementMousemove', function(e) {
+ lines.clearHighlights();
+ var singlePoint, pointIndex, pointXLocation, allData = [];
+ data
+ .filter(function(series, i) {
+ series.seriesIndex = i;
+ return !series.disabled;
+ })
+ .forEach(function(series,i) {
+ pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x());
+ lines.highlightPoint(i, pointIndex, true);
+ var point = series.values[pointIndex];
+ if (typeof point === 'undefined') return;
+ if (typeof singlePoint === 'undefined') singlePoint = point;
+ if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex));
+ allData.push({
+ key: series.key,
+ value: chart.y()(point, pointIndex),
+ color: color(series,series.seriesIndex)
+ });
+ });
+ //Highlight the tooltip entry based on which point the mouse is closest to.
+ if (allData.length > 2) {
+ var yValue = chart.yScale().invert(e.mouseY);
+ var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]);
+ var threshold = 0.03 * domainExtent;
+ var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold);
+ if (indexToHighlight !== null)
+ allData[indexToHighlight].highlight = true;
+ }
+
+ var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));
+ interactiveLayer.tooltip
+ .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
+ .chartContainer(that.parentNode)
+ .enabled(tooltips)
+ .valueFormatter(function(d,i) {
+ return yAxis.tickFormat()(d);
+ })
+ .data(
+ {
+ value: xValue,
+ series: allData
+ }
+ )();
+
+ interactiveLayer.renderGuideLine(pointXLocation);
+
+ });
+
+ interactiveLayer.dispatch.on("elementMouseout",function(e) {
+ dispatch.tooltipHide();
+ lines.clearHighlights();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.lines = lines;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.interactiveLayer = interactiveLayer;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'xRange', 'yRange'
+ , 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'useVoronoi','id', 'interpolate');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.useInteractiveGuideline = function(_) {
+ if(!arguments.length) return useInteractiveGuideline;
+ useInteractiveGuideline = _;
+ if (_ === true) {
+ chart.interactive(false);
+ chart.useVoronoi(false);
+ }
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarChart.js
new file mode 100644
index 00000000..77fcbab7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarChart.js
@@ -0,0 +1,433 @@
+
+nv.models.linePlusBarChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , bars = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , y1Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 60, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.defaultColor()
+ , showLegend = true
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>';
+ }
+ , x
+ , y1
+ , y2
+ , state = {}
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ bars
+ .padData(true)
+ ;
+ lines
+ .clipEdge(false)
+ .padData(true)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ .highlightZero(false)
+ ;
+ y1Axis
+ .orient('left')
+ ;
+ y2Axis
+ .orient('right')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ }
+ ;
+
+ //------------------------------------------------------------
+
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ // chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ var dataBars = data.filter(function(d) { return !d.disabled && d.bar });
+ var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240
+
+ //x = xAxis.scale();
+ x = dataLines.filter(function(d) { return !d.disabled; }).length && dataLines.filter(function(d) { return !d.disabled; })[0].values.length ? lines.xScale() : bars.xScale();
+ //x = dataLines.filter(function(d) { return !d.disabled; }).length ? lines.xScale() : bars.xScale(); //old code before change above
+ y1 = bars.yScale();
+ y2 = lines.yScale();
+
+ //------------------------------------------------------------
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-linePlusBar').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ gEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.nv-legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }))
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }))
+
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(dataBars.length ? dataBars : [{values:[]}])
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(dataLines[0] && !dataLines[0].disabled ? dataLines : [{values:[]}] );
+ //.datum(!dataLines[0].disabled ? dataLines : [{values:dataLines[0].values.map(function(d) { return [d[0], null] }) }] );
+
+ d3.transition(barsWrap).call(bars);
+ d3.transition(linesWrap).call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y1.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+
+ y1Axis
+ .scale(y1)
+ .ticks( availableHeight / 36 )
+ .tickSize(-availableWidth, 0);
+
+ d3.transition(g.select('.nv-y1.nv-axis'))
+ .style('opacity', dataBars.length ? 1 : 0)
+ .call(y1Axis);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + availableWidth + ',0)');
+ //.attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ d3.transition(g.select('.nv-y2.nv-axis'))
+ .call(y2Axis);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.bars = bars;
+ chart.xAxis = xAxis;
+ chart.y1Axis = y1Axis;
+ chart.y2Axis = y2Axis;
+
+ d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate');
+ //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc.
+ //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines.x(_);
+ bars.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines.y(_);
+ bars.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarWithFocusChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarWithFocusChart.js
new file mode 100644
index 00000000..2ef31137
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarWithFocusChart.js
@@ -0,0 +1,658 @@
+
+nv.models.linePlusBarWithFocusChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , lines2 = nv.models.line()
+ , bars = nv.models.historicalBar()
+ , bars2 = nv.models.historicalBar()
+ , xAxis = nv.models.axis()
+ , x2Axis = nv.models.axis()
+ , y1Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , y3Axis = nv.models.axis()
+ , y4Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ , brush = d3.svg.brush()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 30, left: 60}
+ , margin2 = {top: 0, right: 30, bottom: 20, left: 60}
+ , width = null
+ , height = null
+ , height2 = 100
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.defaultColor()
+ , showLegend = true
+ , extent
+ , brushExtent = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>';
+ }
+ , x
+ , x2
+ , y1
+ , y2
+ , y3
+ , y4
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
+ , transitionDuration = 0
+ ;
+
+ lines
+ .clipEdge(true)
+ ;
+ lines2
+ .interactive(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y1Axis
+ .orient('left')
+ ;
+ y2Axis
+ .orient('right')
+ ;
+ x2Axis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y3Axis
+ .orient('left')
+ ;
+ y4Axis
+ .orient('right')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ if (extent) {
+ e.pointIndex += Math.ceil(extent[0]);
+ }
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //------------------------------------------------------------
+
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2,
+ availableHeight2 = height2 - margin2.top - margin2.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight1 / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ var dataBars = data.filter(function(d) { return !d.disabled && d.bar });
+ var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240
+
+ x = bars.xScale();
+ x2 = x2Axis.scale();
+ y1 = bars.yScale();
+ y2 = lines.yScale();
+ y3 = bars2.yScale();
+ y4 = lines2.yScale();
+
+ var series1 = data
+ .filter(function(d) { return !d.disabled && d.bar })
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i) }
+ })
+ });
+
+ var series2 = data
+ .filter(function(d) { return !d.disabled && !d.bar })
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i) }
+ })
+ });
+
+ x .range([0, availableWidth]);
+
+ x2 .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } ))
+ .range([0, availableWidth]);
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-linePlusBar').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ var focusEnter = gEnter.append('g').attr('class', 'nv-focus');
+ focusEnter.append('g').attr('class', 'nv-x nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ focusEnter.append('g').attr('class', 'nv-barsWrap');
+ focusEnter.append('g').attr('class', 'nv-linesWrap');
+
+ var contextEnter = gEnter.append('g').attr('class', 'nv-context');
+ contextEnter.append('g').attr('class', 'nv-x nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y1 nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y2 nv-axis');
+ contextEnter.append('g').attr('class', 'nv-barsWrap');
+ contextEnter.append('g').attr('class', 'nv-linesWrap');
+ contextEnter.append('g').attr('class', 'nv-brushBackground');
+ contextEnter.append('g').attr('class', 'nv-x nv-brush');
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.nv-legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Context Components
+
+ bars2
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }));
+
+ lines2
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }));
+
+ var bars2Wrap = g.select('.nv-context .nv-barsWrap')
+ .datum(dataBars.length ? dataBars : [{values:[]}]);
+
+ var lines2Wrap = g.select('.nv-context .nv-linesWrap')
+ .datum(!dataLines[0].disabled ? dataLines : [{values:[]}]);
+
+ g.select('.nv-context')
+ .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')')
+
+ bars2Wrap.transition().call(bars2);
+ lines2Wrap.transition().call(lines2);
+
+ //------------------------------------------------------------
+
+
+
+ //------------------------------------------------------------
+ // Setup Brush
+
+ brush
+ .x(x2)
+ .on('brush', onBrush);
+
+ if (brushExtent) brush.extent(brushExtent);
+
+ var brushBG = g.select('.nv-brushBackground').selectAll('g')
+ .data([brushExtent || brush.extent()])
+
+ var brushBGenter = brushBG.enter()
+ .append('g');
+
+ brushBGenter.append('rect')
+ .attr('class', 'left')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ brushBGenter.append('rect')
+ .attr('class', 'right')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ var gBrush = g.select('.nv-x.nv-brush')
+ .call(brush);
+ gBrush.selectAll('rect')
+ //.attr('y', -5)
+ .attr('height', availableHeight2);
+ gBrush.selectAll('.resize').append('path').attr('d', resizePath);
+
+ //------------------------------------------------------------
+
+ //------------------------------------------------------------
+ // Setup Secondary (Context) Axes
+
+ x2Axis
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight2, 0);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y3.range()[0] + ')');
+ g.select('.nv-context .nv-x.nv-axis').transition()
+ .call(x2Axis);
+
+
+ y3Axis
+ .scale(y3)
+ .ticks( availableHeight2 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-context .nv-y1.nv-axis')
+ .style('opacity', dataBars.length ? 1 : 0)
+ .attr('transform', 'translate(0,' + x2.range()[0] + ')');
+
+ g.select('.nv-context .nv-y1.nv-axis').transition()
+ .call(y3Axis);
+
+
+ y4Axis
+ .scale(y4)
+ .ticks( availableHeight2 / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-context .nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + x2.range()[1] + ',0)');
+
+ g.select('.nv-context .nv-y2.nv-axis').transition()
+ .call(y4Axis);
+
+ //------------------------------------------------------------
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ // Taken from crossfilter (http://square.github.com/crossfilter/)
+ function resizePath(d) {
+ var e = +(d == 'e'),
+ x = e ? 1 : -1,
+ y = availableHeight2 / 3;
+ return 'M' + (.5 * x) + ',' + y
+ + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6)
+ + 'V' + (2 * y - 6)
+ + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y)
+ + 'Z'
+ + 'M' + (2.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8)
+ + 'M' + (4.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8);
+ }
+
+
+ function updateBrushBG() {
+ if (!brush.empty()) brush.extent(brushExtent);
+ brushBG
+ .data([brush.empty() ? x2.domain() : brushExtent])
+ .each(function(d,i) {
+ var leftWidth = x2(d[0]) - x2.range()[0],
+ rightWidth = x2.range()[1] - x2(d[1]);
+ d3.select(this).select('.left')
+ .attr('width', leftWidth < 0 ? 0 : leftWidth);
+
+ d3.select(this).select('.right')
+ .attr('x', x2(d[1]))
+ .attr('width', rightWidth < 0 ? 0 : rightWidth);
+ });
+ }
+
+
+ function onBrush() {
+ brushExtent = brush.empty() ? null : brush.extent();
+ extent = brush.empty() ? x2.domain() : brush.extent();
+
+
+ dispatch.brush({extent: extent, brush: brush});
+
+ updateBrushBG();
+
+
+ //------------------------------------------------------------
+ // Prepare Main (Focus) Bars and Lines
+
+ bars
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && data[i].bar }));
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled && !data[i].bar }));
+
+ var focusBarsWrap = g.select('.nv-focus .nv-barsWrap')
+ .datum(!dataBars.length ? [{values:[]}] :
+ dataBars
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return bars.x()(d,i) >= extent[0] && bars.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(dataLines[0].disabled ? [{values:[]}] :
+ dataLines
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Update Main (Focus) X Axis
+
+ if (dataBars.length) {
+ x = bars.xScale();
+ } else {
+ x = lines.xScale();
+ }
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight1, 0);
+
+ xAxis.domain([Math.ceil(extent[0]), Math.floor(extent[1])]);
+
+ g.select('.nv-x.nv-axis').transition().duration(transitionDuration)
+ .call(xAxis);
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Update Main (Focus) Bars and Lines
+
+ focusBarsWrap.transition().duration(transitionDuration).call(bars);
+ focusLinesWrap.transition().duration(transitionDuration).call(lines);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup and Update Main (Focus) Y Axes
+
+ g.select('.nv-focus .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y1.range()[0] + ')');
+
+
+ y1Axis
+ .scale(y1)
+ .ticks( availableHeight1 / 36 )
+ .tickSize(-availableWidth, 0);
+
+ g.select('.nv-focus .nv-y1.nv-axis')
+ .style('opacity', dataBars.length ? 1 : 0);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight1 / 36 )
+ .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none
+
+ g.select('.nv-focus .nv-y2.nv-axis')
+ .style('opacity', dataLines.length ? 1 : 0)
+ .attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ g.select('.nv-focus .nv-y1.nv-axis').transition().duration(transitionDuration)
+ .call(y1Axis);
+ g.select('.nv-focus .nv-y2.nv-axis').transition().duration(transitionDuration)
+ .call(y2Axis);
+ }
+
+ //============================================================
+
+ onBrush();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.lines2 = lines2;
+ chart.bars = bars;
+ chart.bars2 = bars2;
+ chart.xAxis = xAxis;
+ chart.x2Axis = x2Axis;
+ chart.y1Axis = y1Axis;
+ chart.y2Axis = y2Axis;
+ chart.y3Axis = y3Axis;
+ chart.y4Axis = y4Axis;
+
+ d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate');
+ //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc.
+ //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines.x(_);
+ bars.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines.y(_);
+ bars.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.brushExtent = function(_) {
+ if (!arguments.length) return brushExtent;
+ brushExtent = _;
+ return chart;
+ };
+
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheye.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheye.js
new file mode 100644
index 00000000..2b411672
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheye.js
@@ -0,0 +1,200 @@
+
+nv.models.line = function() {
+ "use strict";
+ //Default Settings
+ var margin = {top: 0, right: 0, bottom: 0, left: 0},
+ width = 960,
+ height = 500,
+ color = nv.utils.defaultColor(), // function that returns colors
+ id = Math.floor(Math.random() * 10000), //Create semi-unique ID incase user doesn't select one
+ getX = function(d) { return d.x }, // accessor to get the x value from a data point
+ getY = function(d) { return d.y }, // accessor to get the y value from a data point
+ clipEdge = false, // if true, masks lines within x and y scale
+ interpolate = "linear"; // controls the line interpolation
+
+
+ var scatter = nv.models.scatter()
+ .id(id)
+ .size(16) // default size
+ .sizeDomain([16,256]), //set to speed up calculation, needs to be unset if there is a custom size accessor
+ //x = scatter.xScale(),
+ //y = scatter.yScale(),
+ x, y,
+ x0, y0, timeoutID;
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom;
+
+ //get the scales inscase scatter scale was set manually
+ x = x || scatter.xScale();
+ y = y || scatter.yScale();
+
+ //store old scales if they exist
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-line').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ wrapEnter.append('g').attr('class', 'nv-scatterWrap');
+ var scatterWrap = wrap.select('.nv-scatterWrap').datum(data);
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+
+ d3.transition(scatterWrap).call(scatter);
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+ scatterWrap
+ .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) })
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .5)
+
+
+ var paths = groups.selectAll('path')
+ .data(function(d, i) { return [d.values] });
+ paths.enter().append('path')
+ .attr('class', 'nv-line')
+ .attr('d', d3.svg.line()
+ .interpolate(interpolate)
+ .x(function(d,i) { return x0(getX(d,i)) })
+ .y(function(d,i) { return y0(getY(d,i)) })
+ );
+ d3.transition(groups.exit().selectAll('path'))
+ .attr('d', d3.svg.line()
+ .interpolate(interpolate)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ )
+ .remove(); // redundant? line is already being removed
+ d3.transition(paths)
+ .attr('d', d3.svg.line()
+ .interpolate(interpolate)
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ );
+
+
+ //store old scales for use in transitions on update, to animate from old to new positions
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ chart.dispatch = scatter.dispatch;
+
+ d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ scatter.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ scatter.y(_);
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ scatter.color(color);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ interpolate = _;
+ return chart;
+ };
+
+ chart.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return chart;
+ };
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheyeChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheyeChart.js
new file mode 100644
index 00000000..ad894190
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheyeChart.js
@@ -0,0 +1,297 @@
+
+nv.models.lineChart = function() {
+ "use strict";
+ var margin = {top: 30, right: 20, bottom: 50, left: 60},
+ color = nv.utils.defaultColor(),
+ width = null,
+ height = null,
+ showLegend = true,
+ showControls = true,
+ fisheye = 0,
+ pauseFisheye = false,
+ tooltips = true,
+ tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ },
+ noData = "No Data Available."
+ ;
+
+
+ var x = d3.fisheye.scale(d3.scale.linear).distortion(0);
+
+ var lines = nv.models.line().xScale(x),
+ //x = lines.xScale(),
+ y = lines.yScale(),
+ xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5),
+ yAxis = nv.models.axis().scale(y).orient('left'),
+ legend = nv.models.legend().height(30),
+ controls = nv.models.legend().height(30).updateState(false),
+ dispatch = d3.dispatch('tooltipShow', 'tooltipHide');
+
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+
+ var controlsData = [
+ { key: 'Magnify', disabled: true }
+ ];
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart) };
+ chart.container = this; // I need a reference to the container in order to have outside code check if the chart is visible or not
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ container.append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('x', availableWidth / 2)
+ .attr('y', availableHeight / 2)
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle')
+ .text(noData);
+ return chart;
+ } else {
+ container.select('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g');
+
+
+ gEnter.append('rect')
+ .attr('class', 'nvd3 nv-background')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-linesWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+
+ var g = wrap.select('g');
+
+
+
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ if (showControls) {
+ controls.width(180).color(['#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+
+
+ g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ var linesWrap = g.select('.nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(linesWrap).call(lines);
+
+
+
+ xAxis
+ //.scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+
+ yAxis
+ //.scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+
+
+ g.select('.nv-background').on('mousemove', updateFisheye);
+ g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye; });
+ //g.select('.point-paths').on('mousemove', updateFisheye);
+
+
+ function updateFisheye() {
+ if (pauseFisheye) {
+ //g.select('.background') .style('pointer-events', 'none');
+ g.select('.nv-point-paths').style('pointer-events', 'all');
+ return false;
+ }
+
+ g.select('.nv-background') .style('pointer-events', 'all');
+ g.select('.nv-point-paths').style('pointer-events', 'none' );
+
+ var mouse = d3.mouse(this);
+ linesWrap.call(lines);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ x.distortion(fisheye).focus(mouse[0]);
+ }
+
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ fisheye = d.disabled ? 0 : 5;
+ g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all');
+ g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' );
+
+ //scatter.interactive(d.disabled);
+ //tooltips = d.disabled;
+
+ if (d.disabled) {
+ x.distortion(fisheye).focus(0);
+
+ linesWrap.call(lines);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ } else {
+ pauseFisheye = false;
+ }
+
+ chart.update();
+ });
+
+
+ legend.dispatch.on('stateChange', function(newState) {
+ chart.update();
+ });
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+ if (tooltips) dispatch.on('tooltipShow', function(e) { showTooltip(e, that.parentNode) } ); // TODO: maybe merge with above?
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ if (tooltips) dispatch.on('tooltipHide', nv.tooltip.cleanup);
+
+ });
+
+ return chart;
+ }
+
+
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, lines, 'defined', 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFocusChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFocusChart.js
new file mode 100644
index 00000000..0afd28bd
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFocusChart.js
@@ -0,0 +1,574 @@
+nv.models.lineWithFocusChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var lines = nv.models.line()
+ , lines2 = nv.models.line()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , x2Axis = nv.models.axis()
+ , y2Axis = nv.models.axis()
+ , legend = nv.models.legend()
+ , brush = d3.svg.brush()
+ ;
+
+ var margin = {top: 30, right: 30, bottom: 30, left: 60}
+ , margin2 = {top: 0, right: 30, bottom: 20, left: 60}
+ , color = nv.utils.defaultColor()
+ , width = null
+ , height = null
+ , height2 = 100
+ , x
+ , y
+ , x2
+ , y2
+ , showLegend = true
+ , brushExtent = null
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ }
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
+ , transitionDuration = 250
+ ;
+
+ lines
+ .clipEdge(true)
+ ;
+ lines2
+ .interactive(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ yAxis
+ .orient('left')
+ ;
+ x2Axis
+ .orient('bottom')
+ .tickPadding(5)
+ ;
+ y2Axis
+ .orient('left')
+ ;
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2,
+ availableHeight2 = height2 - margin2.top - margin2.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight1 / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = lines.xScale();
+ y = lines.yScale();
+ x2 = lines2.xScale();
+ y2 = lines2.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-lineWithFocusChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineWithFocusChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ var focusEnter = gEnter.append('g').attr('class', 'nv-focus');
+ focusEnter.append('g').attr('class', 'nv-x nv-axis');
+ focusEnter.append('g').attr('class', 'nv-y nv-axis');
+ focusEnter.append('g').attr('class', 'nv-linesWrap');
+
+ var contextEnter = gEnter.append('g').attr('class', 'nv-context');
+ contextEnter.append('g').attr('class', 'nv-x nv-axis');
+ contextEnter.append('g').attr('class', 'nv-y nv-axis');
+ contextEnter.append('g').attr('class', 'nv-linesWrap');
+ contextEnter.append('g').attr('class', 'nv-brushBackground');
+ contextEnter.append('g').attr('class', 'nv-x nv-brush');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom - height2;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ lines
+ .width(availableWidth)
+ .height(availableHeight1)
+ .color(
+ data
+ .map(function(d,i) {
+ return d.color || color(d, i);
+ })
+ .filter(function(d,i) {
+ return !data[i].disabled;
+ })
+ );
+
+ lines2
+ .defined(lines.defined())
+ .width(availableWidth)
+ .height(availableHeight2)
+ .color(
+ data
+ .map(function(d,i) {
+ return d.color || color(d, i);
+ })
+ .filter(function(d,i) {
+ return !data[i].disabled;
+ })
+ );
+
+ g.select('.nv-context')
+ .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')')
+
+ var contextLinesWrap = g.select('.nv-context .nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(contextLinesWrap).call(lines2);
+
+ //------------------------------------------------------------
+
+
+ /*
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(focusLinesWrap).call(lines);
+ */
+
+
+ //------------------------------------------------------------
+ // Setup Main (Focus) Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight1, 0);
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight1 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-focus .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight1 + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Brush
+
+ brush
+ .x(x2)
+ .on('brush', function() {
+ //When brushing, turn off transitions because chart needs to change immediately.
+ var oldTransition = chart.transitionDuration();
+ chart.transitionDuration(0);
+ onBrush();
+ chart.transitionDuration(oldTransition);
+ });
+
+ if (brushExtent) brush.extent(brushExtent);
+
+ var brushBG = g.select('.nv-brushBackground').selectAll('g')
+ .data([brushExtent || brush.extent()])
+
+ var brushBGenter = brushBG.enter()
+ .append('g');
+
+ brushBGenter.append('rect')
+ .attr('class', 'left')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ brushBGenter.append('rect')
+ .attr('class', 'right')
+ .attr('x', 0)
+ .attr('y', 0)
+ .attr('height', availableHeight2);
+
+ var gBrush = g.select('.nv-x.nv-brush')
+ .call(brush);
+ gBrush.selectAll('rect')
+ //.attr('y', -5)
+ .attr('height', availableHeight2);
+ gBrush.selectAll('.resize').append('path').attr('d', resizePath);
+
+ onBrush();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Secondary (Context) Axes
+
+ x2Axis
+ .scale(x2)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight2, 0);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y2.range()[0] + ')');
+ d3.transition(g.select('.nv-context .nv-x.nv-axis'))
+ .call(x2Axis);
+
+
+ y2Axis
+ .scale(y2)
+ .ticks( availableHeight2 / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-context .nv-y.nv-axis'))
+ .call(y2Axis);
+
+ g.select('.nv-context .nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y2.range()[0] + ')');
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Functions
+ //------------------------------------------------------------
+
+ // Taken from crossfilter (http://square.github.com/crossfilter/)
+ function resizePath(d) {
+ var e = +(d == 'e'),
+ x = e ? 1 : -1,
+ y = availableHeight2 / 3;
+ return 'M' + (.5 * x) + ',' + y
+ + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6)
+ + 'V' + (2 * y - 6)
+ + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y)
+ + 'Z'
+ + 'M' + (2.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8)
+ + 'M' + (4.5 * x) + ',' + (y + 8)
+ + 'V' + (2 * y - 8);
+ }
+
+
+ function updateBrushBG() {
+ if (!brush.empty()) brush.extent(brushExtent);
+ brushBG
+ .data([brush.empty() ? x2.domain() : brushExtent])
+ .each(function(d,i) {
+ var leftWidth = x2(d[0]) - x.range()[0],
+ rightWidth = x.range()[1] - x2(d[1]);
+ d3.select(this).select('.left')
+ .attr('width', leftWidth < 0 ? 0 : leftWidth);
+
+ d3.select(this).select('.right')
+ .attr('x', x2(d[1]))
+ .attr('width', rightWidth < 0 ? 0 : rightWidth);
+ });
+ }
+
+
+ function onBrush() {
+ brushExtent = brush.empty() ? null : brush.extent();
+ var extent = brush.empty() ? x2.domain() : brush.extent();
+
+ //The brush extent cannot be less than one. If it is, don't update the line chart.
+ if (Math.abs(extent[0] - extent[1]) <= 1) {
+ return;
+ }
+
+ dispatch.brush({extent: extent, brush: brush});
+
+
+ updateBrushBG();
+
+ // Update Main (Focus)
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
+ .datum(
+ data
+ .filter(function(d) { return !d.disabled })
+ .map(function(d,i) {
+ return {
+ key: d.key,
+ values: d.values.filter(function(d,i) {
+ return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1];
+ })
+ }
+ })
+ );
+ focusLinesWrap.transition().duration(transitionDuration).call(lines);
+
+
+ // Update Main (Focus) Axes
+ g.select('.nv-focus .nv-x.nv-axis').transition().duration(transitionDuration)
+ .call(xAxis);
+ g.select('.nv-focus .nv-y.nv-axis').transition().duration(transitionDuration)
+ .call(yAxis);
+ }
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.legend = legend;
+ chart.lines = lines;
+ chart.lines2 = lines2;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.x2Axis = x2Axis;
+ chart.y2Axis = y2Axis;
+
+ d3.rebind(chart, lines, 'defined', 'isArea', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return lines.x;
+ lines.x(_);
+ lines2.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return lines.y;
+ lines.y(_);
+ lines2.y(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.margin2 = function(_) {
+ if (!arguments.length) return margin2;
+ margin2 = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.height2 = function(_) {
+ if (!arguments.length) return height2;
+ height2 = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color =nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return lines.interpolate();
+ lines.interpolate(_);
+ lines2.interpolate(_);
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ // Chart has multiple similar Axes, to prevent code duplication, probably need to link all axis functions manually like below
+ chart.xTickFormat = function(_) {
+ if (!arguments.length) return xAxis.tickFormat();
+ xAxis.tickFormat(_);
+ x2Axis.tickFormat(_);
+ return chart;
+ };
+
+ chart.yTickFormat = function(_) {
+ if (!arguments.length) return yAxis.tickFormat();
+ yAxis.tickFormat(_);
+ y2Axis.tickFormat(_);
+ return chart;
+ };
+
+ chart.brushExtent = function(_) {
+ if (!arguments.length) return brushExtent;
+ brushExtent = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBar.js
new file mode 100644
index 00000000..1085919b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBar.js
@@ -0,0 +1,461 @@
+
+nv.models.multiBar = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , clipEdge = true
+ , stacked = false
+ , stackOffset = 'zero' // options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function
+ , color = nv.utils.defaultColor()
+ , hideable = false
+ , barColor = null // adding the ability to set the color for each rather than the whole group
+ , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled
+ , delay = 1200
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , groupSpacing = 0.1
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ if(hideable && data.length) hideable = [{
+ values: data[0].values.map(function(d) {
+ return {
+ x: d.x,
+ y: 0,
+ series: d.series,
+ size: 0.01
+ };}
+ )}];
+
+ if (stacked)
+ data = d3.layout.stack()
+ .offset(stackOffset)
+ .values(function(d){ return d.values })
+ .y(getY)
+ (!data.length && hideable ? hideable : data);
+
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+
+ //------------------------------------------------------------
+ // HACK for negative value stacking
+ if (stacked)
+ data[0].values.map(function(d,i) {
+ var posBase = 0, negBase = 0;
+ data.map(function(d) {
+ var f = d.values[i]
+ f.size = Math.abs(f.y);
+ if (f.y<0) {
+ f.y1 = negBase;
+ negBase = negBase - f.size;
+ } else
+ {
+ f.y1 = f.size + posBase;
+ posBase = posBase + f.size;
+ }
+ });
+ });
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 }
+ })
+ });
+
+ x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands(xRange || [0, availableWidth], groupSpacing);
+
+ //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y1 : 0) }).concat(forceY)))
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 : d.y1 + d.y ) : d.y }).concat(forceY)))
+ .range(yRange || [availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d,i) { return i });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit()
+ .transition()
+ .selectAll('rect.nv-bar')
+ .delay(function(d,i) {
+ return i * delay/ data[0].values.length;
+ })
+ .attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) })
+ .attr('height', 0)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) });
+ groups
+ .transition()
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('rect.nv-bar')
+ .data(function(d) { return (hideable && !data.length) ? hideable.values : d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('rect')
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .attr('x', function(d,i,j) {
+ return stacked ? 0 : (j * x.rangeBand() / data.length )
+ })
+ .attr('y', function(d) { return y0(stacked ? d.y0 : 0) })
+ .attr('height', 0)
+ .attr('width', x.rangeBand() / (stacked ? 1 : data.length) )
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; })
+ ;
+ bars
+ .style('fill', function(d,i,j){ return color(d, j, i); })
+ .style('stroke', function(d,i,j){ return color(d, j, i); })
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .transition()
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; })
+
+ if (barColor) {
+ if (!disabled) disabled = data.map(function() { return true });
+ bars
+ .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); })
+ .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); });
+ }
+
+
+ if (stacked)
+ bars.transition()
+ .delay(function(d,i) {
+
+ return i * delay / data[0].values.length;
+ })
+ .attr('y', function(d,i) {
+
+ return y((stacked ? d.y1 : 0));
+ })
+ .attr('height', function(d,i) {
+ return Math.max(Math.abs(y(d.y + (stacked ? d.y0 : 0)) - y((stacked ? d.y0 : 0))),1);
+ })
+ .attr('x', function(d,i) {
+ return stacked ? 0 : (d.series * x.rangeBand() / data.length )
+ })
+ .attr('width', x.rangeBand() / (stacked ? 1 : data.length) );
+ else
+ bars.transition()
+ .delay(function(d,i) {
+ return i * delay/ data[0].values.length;
+ })
+ .attr('x', function(d,i) {
+ return d.series * x.rangeBand() / data.length
+ })
+ .attr('width', x.rangeBand() / data.length)
+ .attr('y', function(d,i) {
+ return getY(d,i) < 0 ?
+ y(0) :
+ y(0) - y(getY(d,i)) < 1 ?
+ y(0) - 1 :
+ y(getY(d,i)) || 0;
+ })
+ .attr('height', function(d,i) {
+ return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) || 0;
+ });
+
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.stacked = function(_) {
+ if (!arguments.length) return stacked;
+ stacked = _;
+ return chart;
+ };
+
+ chart.stackOffset = function(_) {
+ if (!arguments.length) return stackOffset;
+ stackOffset = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.barColor = function(_) {
+ if (!arguments.length) return barColor;
+ barColor = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.disabled = function(_) {
+ if (!arguments.length) return disabled;
+ disabled = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.hideable = function(_) {
+ if (!arguments.length) return hideable;
+ hideable = _;
+ return chart;
+ };
+
+ chart.delay = function(_) {
+ if (!arguments.length) return delay;
+ delay = _;
+ return chart;
+ };
+
+ chart.groupSpacing = function(_) {
+ if (!arguments.length) return groupSpacing;
+ groupSpacing = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarChart.js
new file mode 100644
index 00000000..0323063f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarChart.js
@@ -0,0 +1,524 @@
+
+nv.models.multiBarChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var multibar = nv.models.multiBar()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , showControls = true
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , reduceXTicks = true // if false a tick will show for every data point
+ , staggerLabels = false
+ , rotateLabels = 0
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' on ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , state = { stacked: false }
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = function() { return showControls ? 180 : 0 }
+ , transitionDuration = 250
+ ;
+
+ multibar
+ .stacked(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ .highlightZero(true)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ controls.updateState(false);
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = multibar.xScale();
+ y = multibar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth - controlWidth());
+
+ if (multibar.barColor())
+ data.forEach(function(series,i) {
+ series.color = d3.rgb('#ccc').darker(i * 1.5).toString();
+ })
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Grouped', disabled: multibar.stacked() },
+ { key: 'Stacked', disabled: !multibar.stacked() }
+ ];
+
+ controls.width(controlWidth()).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ multibar
+ .disabled(data.map(function(series) { return series.disabled }))
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ barsWrap.transition().call(multibar);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ g.select('.nv-x.nv-axis').transition()
+ .call(xAxis);
+
+ var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g');
+
+ xTicks
+ .selectAll('line, text')
+ .style('opacity', 1)
+
+ if (staggerLabels) {
+ var getTranslate = function(x,y) {
+ return "translate(" + x + "," + y + ")";
+ };
+
+ var staggerUp = 5, staggerDown = 17; //pixels to stagger by
+ // Issue #140
+ xTicks
+ .selectAll("text")
+ .attr('transform', function(d,i,j) {
+ return getTranslate(0, (j % 2 == 0 ? staggerUp : staggerDown));
+ });
+
+ var totalInBetweenTicks = d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;
+ g.selectAll(".nv-x.nv-axis .nv-axisMaxMin text")
+ .attr("transform", function(d,i) {
+ return getTranslate(0, (i === 0 || totalInBetweenTicks % 2 !== 0) ? staggerDown : staggerUp);
+ });
+ }
+
+ if (reduceXTicks)
+ xTicks
+ .filter(function(d,i) {
+ return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0;
+ })
+ .selectAll('text, line')
+ .style('opacity', 0);
+
+ if(rotateLabels)
+ xTicks
+ .selectAll('.tick text')
+ .attr('transform', 'rotate(' + rotateLabels + ' 0,0)')
+ .style('text-anchor', rotateLabels > 0 ? 'start' : 'end');
+
+ g.select('.nv-x.nv-axis').selectAll('g.nv-axisMaxMin text')
+ .style('opacity', 1);
+ }
+
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis').transition()
+ .call(yAxis);
+ }
+
+
+ //------------------------------------------------------------
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Grouped':
+ multibar.stacked(false);
+ break;
+ case 'Stacked':
+ multibar.stacked(true);
+ break;
+ }
+
+ state.stacked = multibar.stacked();
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode)
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.stacked !== 'undefined') {
+ multibar.stacked(e.stacked);
+ state.stacked = e.stacked;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ multibar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ multibar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.multibar = multibar;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge',
+ 'id', 'stacked', 'stackOffset', 'delay', 'barColor','groupSpacing');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.reduceXTicks= function(_) {
+ if (!arguments.length) return reduceXTicks;
+ reduceXTicks = _;
+ return chart;
+ };
+
+ chart.rotateLabels = function(_) {
+ if (!arguments.length) return rotateLabels;
+ rotateLabels = _;
+ return chart;
+ }
+
+ chart.staggerLabels = function(_) {
+ if (!arguments.length) return staggerLabels;
+ staggerLabels = _;
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontal.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontal.js
new file mode 100644
index 00000000..d16d4605
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontal.js
@@ -0,0 +1,424 @@
+
+nv.models.multiBarHorizontal = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.ordinal()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , color = nv.utils.defaultColor()
+ , barColor = null // adding the ability to set the color for each rather than the whole group
+ , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled
+ , stacked = false
+ , showValues = false
+ , valuePadding = 60
+ , valueFormat = d3.format(',.2f')
+ , delay = 1200
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ if (stacked)
+ data = d3.layout.stack()
+ .offset('zero')
+ .values(function(d){ return d.values })
+ .y(getY)
+ (data);
+
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+
+
+ //------------------------------------------------------------
+ // HACK for negative value stacking
+ if (stacked)
+ data[0].values.map(function(d,i) {
+ var posBase = 0, negBase = 0;
+ data.map(function(d) {
+ var f = d.values[i]
+ f.size = Math.abs(f.y);
+ if (f.y<0) {
+ f.y1 = negBase - f.size;
+ negBase = negBase - f.size;
+ } else
+ {
+ f.y1 = posBase;
+ posBase = posBase + f.size;
+ }
+ });
+ });
+
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 }
+ })
+ });
+
+ x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
+ .rangeBands(xRange || [0, availableHeight], .1);
+
+ //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY)))
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 + d.y : d.y1 ) : d.y }).concat(forceY)))
+
+ if (showValues && !stacked)
+ y.range(yRange || [(y.domain()[0] < 0 ? valuePadding : 0), availableWidth - (y.domain()[1] > 0 ? valuePadding : 0) ]);
+ else
+ y.range(yRange || [0, availableWidth]);
+
+ x0 = x0 || x;
+ y0 = y0 || d3.scale.linear().domain(y.domain()).range([y(0),y(0)]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-multibarHorizontal').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibarHorizontal');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d,i) { return i });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit().transition()
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) });
+ groups.transition()
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('g.nv-bar')
+ .data(function(d) { return d.values });
+
+ bars.exit().remove();
+
+
+ var barsEnter = bars.enter().append('g')
+ .attr('transform', function(d,i,j) {
+ return 'translate(' + y0(stacked ? d.y0 : 0) + ',' + (stacked ? 0 : (j * x.rangeBand() / data.length ) + x(getX(d,i))) + ')'
+ });
+
+ barsEnter.append('rect')
+ .attr('width', 0)
+ .attr('height', x.rangeBand() / (stacked ? 1 : data.length) )
+
+ bars
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [ y(getY(d,i) + (stacked ? d.y0 : 0)), x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length) ],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+
+
+ barsEnter.append('text');
+
+ if (showValues && !stacked) {
+ bars.select('text')
+ .attr('text-anchor', function(d,i) { return getY(d,i) < 0 ? 'end' : 'start' })
+ .attr('y', x.rangeBand() / (data.length * 2))
+ .attr('dy', '.32em')
+ .text(function(d,i) { return valueFormat(getY(d,i)) })
+ bars.transition()
+ .select('text')
+ .attr('x', function(d,i) { return getY(d,i) < 0 ? -4 : y(getY(d,i)) - y(0) + 4 })
+ } else {
+ bars.selectAll('text').text('');
+ }
+
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+
+ if (barColor) {
+ if (!disabled) disabled = data.map(function() { return true });
+ bars
+ .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); })
+ .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); });
+ }
+
+ if (stacked)
+ bars.transition()
+ .attr('transform', function(d,i) {
+ return 'translate(' + y(d.y1) + ',' + x(getX(d,i)) + ')'
+ })
+ .select('rect')
+ .attr('width', function(d,i) {
+ return Math.abs(y(getY(d,i) + d.y0) - y(d.y0))
+ })
+ .attr('height', x.rangeBand() );
+ else
+ bars.transition()
+ .attr('transform', function(d,i) {
+ //TODO: stacked must be all positive or all negative, not both?
+ return 'translate(' +
+ (getY(d,i) < 0 ? y(getY(d,i)) : y(0))
+ + ',' +
+ (d.series * x.rangeBand() / data.length
+ +
+ x(getX(d,i)) )
+ + ')'
+ })
+ .select('rect')
+ .attr('height', x.rangeBand() / data.length )
+ .attr('width', function(d,i) {
+ return Math.max(Math.abs(y(getY(d,i)) - y(0)),1)
+ });
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.stacked = function(_) {
+ if (!arguments.length) return stacked;
+ stacked = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.barColor = function(_) {
+ if (!arguments.length) return barColor;
+ barColor = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.disabled = function(_) {
+ if (!arguments.length) return disabled;
+ disabled = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.delay = function(_) {
+ if (!arguments.length) return delay;
+ delay = _;
+ return chart;
+ };
+
+ chart.showValues = function(_) {
+ if (!arguments.length) return showValues;
+ showValues = _;
+ return chart;
+ };
+
+ chart.valueFormat= function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.valuePadding = function(_) {
+ if (!arguments.length) return valuePadding;
+ valuePadding = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontalChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontalChart.js
new file mode 100644
index 00000000..02aa6fa4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontalChart.js
@@ -0,0 +1,434 @@
+
+nv.models.multiBarHorizontalChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var multibar = nv.models.multiBarHorizontal()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend().height(30)
+ , controls = nv.models.legend().height(30)
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , showControls = true
+ , showLegend = true
+ , stacked = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + ' - ' + x + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , state = { stacked: stacked }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = function() { return showControls ? 180 : 0 }
+ , transitionDuration = 250
+ ;
+
+ multibar
+ .stacked(stacked)
+ ;
+ xAxis
+ .orient('left')
+ .tickPadding(5)
+ .highlightZero(false)
+ .showMaxMin(false)
+ .tickFormat(function(d) { return d })
+ ;
+ yAxis
+ .orient('bottom')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ controls.updateState(false);
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = multibar.xScale();
+ y = multibar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multiBarHorizontalChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarHorizontalChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth - controlWidth());
+
+ if (multibar.barColor())
+ data.forEach(function(series,i) {
+ series.color = d3.rgb('#ccc').darker(i * 1.5).toString();
+ })
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Grouped', disabled: multibar.stacked() },
+ { key: 'Stacked', disabled: !multibar.stacked() }
+ ];
+
+ controls.width(controlWidth()).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ multibar
+ .disabled(data.map(function(series) { return series.disabled }))
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ barsWrap.transition().call(multibar);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks( availableHeight / 24 )
+ .tickSize(-availableWidth, 0);
+
+ g.select('.nv-x.nv-axis').transition()
+ .call(xAxis);
+
+ var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
+
+ xTicks
+ .selectAll('line, text')
+ .style('opacity', 1)
+
+
+ yAxis
+ .scale(y)
+ .ticks( availableWidth / 100 )
+ .tickSize( -availableHeight, 0);
+
+ g.select('.nv-y.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+ g.select('.nv-y.nv-axis').transition()
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Grouped':
+ multibar.stacked(false);
+ break;
+ case 'Stacked':
+ multibar.stacked(true);
+ break;
+ }
+
+ state.stacked = multibar.stacked();
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.stacked !== 'undefined') {
+ multibar.stacked(e.stacked);
+ state.stacked = e.stacked;
+ }
+
+ selection.call(chart);
+ });
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ multibar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ multibar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.multibar = multibar;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge', 'id', 'delay', 'showValues', 'valueFormat', 'stacked', 'barColor');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarTimeSeries.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarTimeSeries.js
new file mode 100644
index 00000000..abc062c3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarTimeSeries.js
@@ -0,0 +1,384 @@
+nv.models.multiBarTimeSeries = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , x = d3.time.scale()
+ , y = d3.scale.linear()
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
+ , clipEdge = true
+ , stacked = false
+ , color = nv.utils.defaultColor()
+ , delay = 1200
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0 //used to store previous scales
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ if (stacked)
+ data = d3.layout.stack()
+ .offset('zero')
+ .values(function(d){ return d.values })
+ .y(getY)
+ (data);
+
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), y0: d.y0 }
+ })
+ });
+
+ x .domain(xDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.x })))
+ .range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY)))
+ .range(yRange || [availableHeight, 0]);
+
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-groups');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ d3.transition(groups.exit())
+ //.style('stroke-opacity', 1e-6)
+ //.style('fill-opacity', 1e-6)
+ .selectAll('rect.nv-bar')
+ .delay(function(d,i) { return i * delay/ data[0].values.length })
+ .attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) })
+ .attr('height', 0)
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover })
+ .style('fill', function(d,i){ return color(d, i) })
+ .style('stroke', function(d,i){ return color(d, i) });
+ d3.transition(groups)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .75);
+
+
+ var bars = groups.selectAll('rect.nv-bar')
+ .data(function(d) { return d.values });
+
+ bars.exit().remove();
+
+ var maxElements = 0;
+ for(var ei=0; ei<seriesData.length; ei+=1) {
+ maxElements = Math.max(seriesData[ei].length, maxElements);
+ }
+
+ var bandWidth = (availableWidth / maxElements)-0.1;
+ var barWidth = bandWidth / data.length;
+
+ var barsEnter = bars.enter().append('rect')
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .attr('x', function(d,i,j) {
+ return stacked ? 0 : (i * bandWidth) + ( j * barWidth )
+ })
+ .attr('y', function(d) { return y0(stacked ? d.y0 : 0) })
+ .attr('height', 0)
+ .attr('width', stacked ? bandWidth : barWidth );
+ bars
+ .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (barWidth * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (barWidth * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ value: getY(d,i),
+ point: d,
+ series: data[d.series],
+ pos: [x(getX(d,i)) + (barWidth * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: d.series,
+ e: d3.event
+ });
+ d3.event.stopPropagation();
+ });
+ bars
+ .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; })
+ if (stacked)
+ d3.transition(bars)
+ .delay(function(d,i) { return i * delay / data[0].values.length })
+ .attr('y', function(d,i) {
+ return y(getY(d,i) + (stacked ? d.y0 : 0));
+ })
+ .attr('height', function(d,i) {
+ return Math.abs(y(d.y + (stacked ? d.y0 : 0)) - y((stacked ? d.y0 : 0)))
+ })
+ .each('end', function() {
+ d3.transition(d3.select(this))
+ .attr('x', function(d,i) {
+ return stacked ? 0 : (i * bandWidth) + ( j * barWidth )
+ })
+ .attr('width', stacked ? bandWidth : barWidth );
+ })
+ else
+ d3.transition(bars)
+ .delay(function(d,i) { return i * delay/ data[0].values.length })
+ .attr('x', function(d,i) {
+ return d.series * barWidth
+ })
+ .attr('width', barWidth)
+ .each('end', function() {
+ d3.transition(d3.select(this))
+ .attr('y', function(d,i) {
+ return getY(d,i) < 0 ?
+ y(0) :
+ y(getY(d,i))
+ })
+ .attr('height', function(d,i) {
+ return Math.abs(y(getY(d,i)) - y(0))
+ });
+ })
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.stacked = function(_) {
+ if (!arguments.length) return stacked;
+ stacked = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.delay = function(_) {
+ if (!arguments.length) return delay;
+ delay = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarTimeSeriesChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarTimeSeriesChart.js
new file mode 100644
index 00000000..5aebafa7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarTimeSeriesChart.js
@@ -0,0 +1,405 @@
+nv.models.multiBarTimeSeriesChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var multibar = nv.models.multiBarTimeSeries()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , showControls = true
+ , showLegend = true
+ , reduceXTicks = true // if false a tick will show for every data point
+ , rotateLabels = 0
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' on ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
+ ;
+
+ multibar
+ .stacked(false)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ .highlightZero(false)
+ .showMaxMin(false)
+ ;
+ yAxis
+ .orient('left')
+ .tickFormat(d3.format(',.1f'))
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { selection.transition().call(chart) };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = multibar.xScale();
+ y = multibar.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-barsWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width(availableWidth / 2);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ { key: 'Grouped', disabled: multibar.stacked() },
+ { key: 'Stacked', disabled: !multibar.stacked() }
+ ];
+
+ controls.width(180).color(['#444', '#444', '#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ multibar
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+
+ var barsWrap = g.select('.nv-barsWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+
+ d3.transition(barsWrap).call(multibar);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ xAxis
+ .scale(x)
+ .ticks(availableWidth / 100)
+ .tickSize(-availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')');
+ d3.transition(g.select('.nv-x.nv-axis'))
+ .call(xAxis);
+
+ var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g');
+
+ xTicks
+ .selectAll('line, text')
+ .style('opacity', 1)
+
+ if (reduceXTicks)
+ xTicks
+ .filter(function(d,i) {
+ return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0;
+ })
+ .selectAll('text, line')
+ .style('opacity', 0);
+
+ if(rotateLabels)
+ xTicks
+ .selectAll('text')
+ .attr('transform', function(d,i,j) { return 'rotate('+rotateLabels+' 0,0)' })
+ .attr('text-transform', rotateLabels > 0 ? 'start' : 'end');
+
+ yAxis
+ .scale(y)
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.nv-y.nv-axis'))
+ .call(yAxis);
+
+ //------------------------------------------------------------
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ legend.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ if (!data.filter(function(d) { return !d.disabled }).length) {
+ data.map(function(d) {
+ d.disabled = false;
+ wrap.selectAll('.nv-series').classed('disabled', false);
+ return d;
+ });
+ }
+
+ selection.transition().call(chart);
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ switch (d.key) {
+ case 'Grouped':
+ multibar.stacked(false);
+ break;
+ case 'Stacked':
+ multibar.stacked(true);
+ break;
+ }
+
+ selection.transition().call(chart);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode)
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ multibar.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ multibar.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.multibar = multibar;
+ chart.legend = legend;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+
+ d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge', 'id', 'stacked', 'delay');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.reduceXTicks= function(_) {
+ if (!arguments.length) return reduceXTicks;
+ reduceXTicks = _;
+ return chart;
+ };
+
+ chart.rotateLabels = function(_) {
+ if (!arguments.length) return rotateLabels;
+ rotateLabels = _;
+ return chart;
+ }
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiChart.js
new file mode 100644
index 00000000..e3e2c5e8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiChart.js
@@ -0,0 +1,452 @@
+nv.models.multiChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 60},
+ color = d3.scale.category20().range(),
+ width = null,
+ height = null,
+ showLegend = true,
+ tooltips = true,
+ tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' at ' + x + '</p>'
+ },
+ x,
+ y,
+ yDomain1,
+ yDomain2
+ ; //can be accessed via chart.lines.[x/y]Scale()
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x = d3.scale.linear(),
+ yScale1 = d3.scale.linear(),
+ yScale2 = d3.scale.linear(),
+
+ lines1 = nv.models.line().yScale(yScale1),
+ lines2 = nv.models.line().yScale(yScale2),
+
+ bars1 = nv.models.multiBar().stacked(false).yScale(yScale1),
+ bars2 = nv.models.multiBar().stacked(false).yScale(yScale2),
+
+ stack1 = nv.models.stackedArea().yScale(yScale1),
+ stack2 = nv.models.stackedArea().yScale(yScale2),
+
+ xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5),
+ yAxis1 = nv.models.axis().scale(yScale1).orient('left'),
+ yAxis2 = nv.models.axis().scale(yScale2).orient('right'),
+
+ legend = nv.models.legend().height(30),
+ dispatch = d3.dispatch('tooltipShow', 'tooltipHide');
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(lines1.x()(e.point, e.pointIndex)),
+ y = ((e.series.yAxis == 2) ? yAxis2 : yAxis1).tickFormat()(lines1.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, undefined, undefined, offsetElement.offsetParent);
+ };
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ var dataLines1 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 1})
+ var dataLines2 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 2})
+ var dataBars1 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 1})
+ var dataBars2 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 2})
+ var dataStack1 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 1})
+ var dataStack2 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 2})
+
+ var series1 = data.filter(function(d) {return !d.disabled && d.yAxis == 1})
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: d.x, y: d.y }
+ })
+ })
+
+ var series2 = data.filter(function(d) {return !d.disabled && d.yAxis == 2})
+ .map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: d.x, y: d.y }
+ })
+ })
+
+ x .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } ))
+ .range([0, availableWidth]);
+
+ var wrap = container.selectAll('g.wrap.multiChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 multiChart').append('g');
+
+ gEnter.append('g').attr('class', 'x axis');
+ gEnter.append('g').attr('class', 'y1 axis');
+ gEnter.append('g').attr('class', 'y2 axis');
+ gEnter.append('g').attr('class', 'lines1Wrap');
+ gEnter.append('g').attr('class', 'lines2Wrap');
+ gEnter.append('g').attr('class', 'bars1Wrap');
+ gEnter.append('g').attr('class', 'bars2Wrap');
+ gEnter.append('g').attr('class', 'stack1Wrap');
+ gEnter.append('g').attr('class', 'stack2Wrap');
+ gEnter.append('g').attr('class', 'legendWrap');
+
+ var g = wrap.select('g');
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ g.select('.legendWrap')
+ .datum(data.map(function(series) {
+ series.originalKey = series.originalKey === undefined ? series.key : series.originalKey;
+ series.key = series.originalKey + (series.yAxis == 1 ? '' : ' (right axis)');
+ return series;
+ }))
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.legendWrap')
+ .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')');
+ }
+
+
+ lines1
+ .width(availableWidth)
+ .height(availableHeight)
+ .interpolate("monotone")
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'line'}));
+
+ lines2
+ .width(availableWidth)
+ .height(availableHeight)
+ .interpolate("monotone")
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'line'}));
+
+ bars1
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'bar'}));
+
+ bars2
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'bar'}));
+
+ stack1
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'area'}));
+
+ stack2
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color[i % color.length];
+ }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'area'}));
+
+ g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ var lines1Wrap = g.select('.lines1Wrap')
+ .datum(dataLines1)
+ var bars1Wrap = g.select('.bars1Wrap')
+ .datum(dataBars1)
+ var stack1Wrap = g.select('.stack1Wrap')
+ .datum(dataStack1)
+
+ var lines2Wrap = g.select('.lines2Wrap')
+ .datum(dataLines2)
+ var bars2Wrap = g.select('.bars2Wrap')
+ .datum(dataBars2)
+ var stack2Wrap = g.select('.stack2Wrap')
+ .datum(dataStack2)
+
+ var extraValue1 = dataStack1.length ? dataStack1.map(function(a){return a.values}).reduce(function(a,b){
+ return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}})
+ }).concat([{x:0, y:0}]) : []
+ var extraValue2 = dataStack2.length ? dataStack2.map(function(a){return a.values}).reduce(function(a,b){
+ return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}})
+ }).concat([{x:0, y:0}]) : []
+
+ yScale1 .domain(yDomain1 || d3.extent(d3.merge(series1).concat(extraValue1), function(d) { return d.y } ))
+ .range([0, availableHeight])
+
+ yScale2 .domain(yDomain2 || d3.extent(d3.merge(series2).concat(extraValue2), function(d) { return d.y } ))
+ .range([0, availableHeight])
+
+ lines1.yDomain(yScale1.domain())
+ bars1.yDomain(yScale1.domain())
+ stack1.yDomain(yScale1.domain())
+
+ lines2.yDomain(yScale2.domain())
+ bars2.yDomain(yScale2.domain())
+ stack2.yDomain(yScale2.domain())
+
+ if(dataStack1.length){d3.transition(stack1Wrap).call(stack1);}
+ if(dataStack2.length){d3.transition(stack2Wrap).call(stack2);}
+
+ if(dataBars1.length){d3.transition(bars1Wrap).call(bars1);}
+ if(dataBars2.length){d3.transition(bars2Wrap).call(bars2);}
+
+ if(dataLines1.length){d3.transition(lines1Wrap).call(lines1);}
+ if(dataLines2.length){d3.transition(lines2Wrap).call(lines2);}
+
+
+
+ xAxis
+ .ticks( availableWidth / 100 )
+ .tickSize(-availableHeight, 0);
+
+ g.select('.x.axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+ d3.transition(g.select('.x.axis'))
+ .call(xAxis);
+
+ yAxis1
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+
+ d3.transition(g.select('.y1.axis'))
+ .call(yAxis1);
+
+ yAxis2
+ .ticks( availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ d3.transition(g.select('.y2.axis'))
+ .call(yAxis2);
+
+ g.select('.y2.axis')
+ .style('opacity', series2.length ? 1 : 0)
+ .attr('transform', 'translate(' + x.range()[1] + ',0)');
+
+ legend.dispatch.on('stateChange', function(newState) {
+ chart.update();
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ lines1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ bars2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ bars2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ stack1.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ if (!Math.round(stack1.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stack1.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ stack2.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ if (!Math.round(stack2.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stack2.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines1.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines1.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ lines2.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ lines2.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+
+
+ //============================================================
+ // Global getters and setters
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.lines1 = lines1;
+ chart.lines2 = lines2;
+ chart.bars1 = bars1;
+ chart.bars2 = bars2;
+ chart.stack1 = stack1;
+ chart.stack2 = stack2;
+ chart.xAxis = xAxis;
+ chart.yAxis1 = yAxis1;
+ chart.yAxis2 = yAxis2;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ lines1.x(_);
+ bars1.x(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ lines1.y(_);
+ bars1.y(_);
+ return chart;
+ };
+
+ chart.yDomain1 = function(_) {
+ if (!arguments.length) return yDomain1;
+ yDomain1 = _;
+ return chart;
+ };
+
+ chart.yDomain2 = function(_) {
+ if (!arguments.length) return yDomain2;
+ yDomain2 = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin = _;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = _;
+ legend.color(_);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ return chart;
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/ohlcBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/ohlcBar.js
new file mode 100644
index 00000000..46f2b60c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/ohlcBar.js
@@ -0,0 +1,380 @@
+
+nv.models.ohlcBar = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , getOpen = function(d) { return d.open }
+ , getClose = function(d) { return d.close }
+ , getHigh = function(d) { return d.high }
+ , getLow = function(d) { return d.low }
+ , forceX = []
+ , forceY = []
+ , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart
+ , clipEdge = true
+ , color = nv.utils.defaultColor()
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ //TODO: store old scales for transitions
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) ));
+
+ if (padData)
+ x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || [
+ d3.min(data[0].values.map(getLow).concat(forceY)),
+ d3.max(data[0].values.map(getHigh).concat(forceY))
+ ])
+ .range(yRange || [availableHeight, 0]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = d3.select(this).selectAll('g.nv-wrap.nv-ohlcBar').data([data[0].values]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-ohlcBar');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-ticks');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-chart-clip-path-' + id)
+ .append('rect');
+
+ wrap.select('#nv-chart-clip-path-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : '');
+
+
+
+ var ticks = wrap.select('.nv-ticks').selectAll('.nv-tick')
+ .data(function(d) { return d });
+
+ ticks.exit().remove();
+
+
+ var ticksEnter = ticks.enter().append('path')
+ .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i })
+ .attr('d', function(d,i) {
+ var w = (availableWidth / data[0].values.length) * .9;
+ return 'm0,0l0,'
+ + (y(getOpen(d,i))
+ - y(getHigh(d,i)))
+ + 'l'
+ + (-w/2)
+ + ',0l'
+ + (w/2)
+ + ',0l0,'
+ + (y(getLow(d,i)) - y(getOpen(d,i)))
+ + 'l0,'
+ + (y(getClose(d,i))
+ - y(getLow(d,i)))
+ + 'l'
+ + (w/2)
+ + ',0l'
+ + (-w/2)
+ + ',0z';
+ })
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; })
+ //.attr('fill', function(d,i) { return color[0]; })
+ //.attr('stroke', function(d,i) { return color[0]; })
+ //.attr('x', 0 )
+ //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) })
+ .on('mouseover', function(d,i) {
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ point: d,
+ series: data[0],
+ pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ point: d,
+ series: data[0],
+ pointIndex: i,
+ seriesIndex: 0,
+ e: d3.event
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ //label: d[label],
+ value: getY(d,i),
+ data: d,
+ index: i,
+ pos: [x(getX(d,i)), y(getY(d,i))],
+ e: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ ticks
+ .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i })
+ d3.transition(ticks)
+ .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; })
+ .attr('d', function(d,i) {
+ var w = (availableWidth / data[0].values.length) * .9;
+ return 'm0,0l0,'
+ + (y(getOpen(d,i))
+ - y(getHigh(d,i)))
+ + 'l'
+ + (-w/2)
+ + ',0l'
+ + (w/2)
+ + ',0l0,'
+ + (y(getLow(d,i))
+ - y(getOpen(d,i)))
+ + 'l0,'
+ + (y(getClose(d,i))
+ - y(getLow(d,i)))
+ + 'l'
+ + (w/2)
+ + ',0l'
+ + (-w/2)
+ + ',0z';
+ })
+ //.attr('width', (availableWidth / data[0].values.length) * .9 )
+
+
+ //d3.transition(ticks)
+ //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
+ //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) });
+ //.order(); // not sure if this makes any sense for this model
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = _;
+ return chart;
+ };
+
+ chart.open = function(_) {
+ if (!arguments.length) return getOpen;
+ getOpen = _;
+ return chart;
+ };
+
+ chart.close = function(_) {
+ if (!arguments.length) return getClose;
+ getClose = _;
+ return chart;
+ };
+
+ chart.high = function(_) {
+ if (!arguments.length) return getHigh;
+ getHigh = _;
+ return chart;
+ };
+
+ chart.low = function(_) {
+ if (!arguments.length) return getLow;
+ getLow = _;
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/parallelCoordinates.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/parallelCoordinates.js
new file mode 100644
index 00000000..107154f7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/parallelCoordinates.js
@@ -0,0 +1,239 @@
+
+//Code adapted from Jason Davies' "Parallel Coordinates"
+// http://bl.ocks.org/jasondavies/1341281
+
+nv.models.parallelCoordinates = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+
+ var margin = {top: 30, right: 10, bottom: 10, left: 10}
+ , width = 960
+ , height = 500
+ , x = d3.scale.ordinal()
+ , y = {}
+ , dimensions = []
+ , color = nv.utils.getColor(d3.scale.category20c().range())
+ , axisLabel = function(d) { return d; }
+ , filters = []
+ , active = []
+ , dispatch = d3.dispatch('brush')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ active = data; //set all active before first brush call
+
+ chart.update = function() { }; //This is a placeholder until this chart is made resizeable
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x
+ .rangePoints([0, availableWidth], 1)
+ .domain(dimensions);
+
+ // Extract the list of dimensions and create a scale for each.
+ dimensions.forEach(function(d) {
+ y[d] = d3.scale.linear()
+ .domain(d3.extent(data, function(p) { return +p[d]; }))
+ .range([availableHeight, 0]);
+
+ y[d].brush = d3.svg.brush().y(y[d]).on('brush', brush);
+
+ return d != 'name';
+ })
+
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-parallelCoordinates').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-parallelCoordinates');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ gEnter.append('g').attr('class', 'nv-parallelCoordinatesWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ var line = d3.svg.line(),
+ axis = d3.svg.axis().orient('left'),
+ background,
+ foreground;
+
+
+ // Add grey background lines for context.
+ background = gEnter.append('g')
+ .attr('class', 'background')
+ .selectAll('path')
+ .data(data)
+ .enter().append('path')
+ .attr('d', path)
+ ;
+
+ // Add blue foreground lines for focus.
+ foreground = gEnter.append('g')
+ .attr('class', 'foreground')
+ .selectAll('path')
+ .data(data)
+ .enter().append('path')
+ .attr('d', path)
+ ;
+
+ // Add a group element for each dimension.
+ var dimension = g.selectAll('.dimension')
+ .data(dimensions)
+ .enter().append('g')
+ .attr('class', 'dimension')
+ .attr('transform', function(d) { return 'translate(' + x(d) + ',0)'; });
+
+ // Add an axis and title.
+ dimension.append('g')
+ .attr('class', 'axis')
+ .each(function(d) { d3.select(this).call(axis.scale(y[d])); })
+ .append('text')
+ .attr('text-anchor', 'middle')
+ .attr('y', -9)
+ .text(String);
+
+ // Add and store a brush for each axis.
+ dimension.append('g')
+ .attr('class', 'brush')
+ .each(function(d) { d3.select(this).call(y[d].brush); })
+ .selectAll('rect')
+ .attr('x', -8)
+ .attr('width', 16);
+
+
+ // Returns the path for a given data point.
+ function path(d) {
+ return line(dimensions.map(function(p) { return [x(p), y[p](d[p])]; }));
+ }
+
+ // Handles a brush event, toggling the display of foreground lines.
+ function brush() {
+ var actives = dimensions.filter(function(p) { return !y[p].brush.empty(); }),
+ extents = actives.map(function(p) { return y[p].brush.extent(); });
+
+ filters = []; //erase current filters
+ actives.forEach(function(d,i) {
+ filters[i] = {
+ dimension: d,
+ extent: extents[i]
+ }
+ });
+
+ active = []; //erase current active list
+ foreground.style('display', function(d) {
+ var isActive = actives.every(function(p, i) {
+ return extents[i][0] <= d[p] && d[p] <= extents[i][1];
+ });
+ if (isActive) active.push(d);
+ return isActive ? null : 'none';
+ });
+
+ dispatch.brush({
+ filters: filters,
+ active: active
+ });
+
+ }
+
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+
+ chart.dispatch = dispatch;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_)
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.dimensions = function(_) {
+ if (!arguments.length) return dimensions;
+ dimensions = _;
+ return chart;
+ };
+
+ chart.filters = function() {
+ return filters;
+ };
+
+ chart.active = function() {
+ return active;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js
new file mode 100644
index 00000000..2099c8f3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js
@@ -0,0 +1,400 @@
+nv.models.pie = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 500
+ , height = 500
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , getDescription = function(d) { return d.description }
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , color = nv.utils.defaultColor()
+ , valueFormat = d3.format(',.2f')
+ , showLabels = true
+ , pieLabelsOutside = true
+ , donutLabelsOutside = false
+ , labelType = "key"
+ , labelThreshold = .02 //if slice percentage is under this, don't show label
+ , donut = false
+ , labelSunbeamLayout = false
+ , startAngle = false
+ , endAngle = false
+ , donutRatio = 0.5
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ radius = Math.min(availableWidth, availableHeight) / 2,
+ arcRadius = radius-(radius / 5),
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ //var wrap = container.selectAll('.nv-wrap.nv-pie').data([data]);
+ var wrap = container.selectAll('.nv-wrap.nv-pie').data(data);
+ var wrapEnter = wrap.enter().append('g').attr('class','nvd3 nv-wrap nv-pie nv-chart-' + id);
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-pie');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+ g.select('.nv-pie').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ var arc = d3.svg.arc()
+ .outerRadius(arcRadius);
+
+ if (startAngle) arc.startAngle(startAngle)
+ if (endAngle) arc.endAngle(endAngle);
+ if (donut) arc.innerRadius(radius * donutRatio);
+
+ // Setup the Pie chart and choose the data element
+ var pie = d3.layout.pie()
+ .sort(null)
+ .value(function(d) { return d.disabled ? 0 : getY(d) });
+
+ var slices = wrap.select('.nv-pie').selectAll('.nv-slice')
+ .data(pie);
+
+ slices.exit().remove();
+
+ var ae = slices.enter().append('g')
+ .attr('class', 'nv-slice')
+ .on('mouseover', function(d,i){
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ pointIndex: i,
+ pos: [d3.event.pageX, d3.event.pageY],
+ id: id
+ });
+ })
+ .on('mouseout', function(d,i){
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ id: id
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ slices
+ .attr('fill', function(d,i) { return color(d, i); })
+ .attr('stroke', function(d,i) { return color(d, i); });
+
+ var paths = ae.append('path')
+ .each(function(d) { this._current = d; });
+ //.attr('d', arc);
+
+ d3.transition(slices.select('path'))
+ .attr('d', arc);
+ //.attrTween('d', arcTween);
+
+ if (showLabels) {
+ // This does the normal label
+ var labelsArc = d3.svg.arc().innerRadius(0);
+
+ if (pieLabelsOutside){ labelsArc = arc; }
+
+ if (donutLabelsOutside) { labelsArc = d3.svg.arc().outerRadius(arc.outerRadius()); }
+
+ ae.append("g").classed("nv-label", true)
+ .each(function(d, i) {
+ var group = d3.select(this);
+
+ group
+ .attr('transform', function(d) {
+ if (labelSunbeamLayout) {
+ d.outerRadius = arcRadius + 10; // Set Outer Coordinate
+ d.innerRadius = arcRadius + 15; // Set Inner Coordinate
+ var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
+ if ((d.startAngle+d.endAngle)/2 < Math.PI) {
+ rotateAngle -= 90;
+ } else {
+ rotateAngle += 90;
+ }
+ return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
+ } else {
+ d.outerRadius = radius + 10; // Set Outer Coordinate
+ d.innerRadius = radius + 15; // Set Inner Coordinate
+ return 'translate(' + labelsArc.centroid(d) + ')'
+ }
+ });
+
+ group.append('rect')
+ .style('stroke', '#fff')
+ .style('fill', '#fff')
+ .attr("rx", 3)
+ .attr("ry", 3);
+
+ group.append('text')
+ .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
+ .style('fill', '#000')
+
+
+ });
+
+ slices.select(".nv-label").transition()
+ .attr('transform', function(d) {
+ if (labelSunbeamLayout) {
+ d.outerRadius = arcRadius + 10; // Set Outer Coordinate
+ d.innerRadius = arcRadius + 15; // Set Inner Coordinate
+ var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
+ if ((d.startAngle+d.endAngle)/2 < Math.PI) {
+ rotateAngle -= 90;
+ } else {
+ rotateAngle += 90;
+ }
+ return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
+ } else {
+ d.outerRadius = radius + 10; // Set Outer Coordinate
+ d.innerRadius = radius + 15; // Set Inner Coordinate
+ return 'translate(' + labelsArc.centroid(d) + ')'
+ }
+ });
+
+ slices.each(function(d, i) {
+ var slice = d3.select(this);
+
+ slice
+ .select(".nv-label text")
+ .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
+ .text(function(d, i) {
+ var percent = (d.endAngle - d.startAngle) / (2 * Math.PI);
+ return Math.round(percent*1001/10)+"%";
+ /*var labelTypes = {
+ "key" : getX(d.data),
+ "value": getY(d.data),
+ "percent": d3.format('%')(percent)
+ };
+ return (d.value && percent > labelThreshold) ? labelTypes[labelType] : '';
+ */
+ });
+
+ var textBox = slice.select('text').node().getBBox();
+ slice.select(".nv-label rect")
+ .attr("width", textBox.width + 10)
+ .attr("height", textBox.height + 10)
+ .attr("transform", function() {
+ return "translate(" + [textBox.x - 5, textBox.y - 5] + ")";
+ });
+ });
+ }
+
+
+ // Computes the angle of an arc, converting from radians to degrees.
+ function angle(d) {
+ var a = (d.startAngle + d.endAngle) * 90 / Math.PI - 90;
+ return a > 90 ? a - 180 : a;
+ }
+
+ function arcTween(a) {
+ a.endAngle = isNaN(a.endAngle) ? 0 : a.endAngle;
+ a.startAngle = isNaN(a.startAngle) ? 0 : a.startAngle;
+ if (!donut) a.innerRadius = 0;
+ var i = d3.interpolate(this._current, a);
+ this._current = i(0);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+
+ function tweenPie(b) {
+ b.innerRadius = 0;
+ var i = d3.interpolate({startAngle: 0, endAngle: 0}, b);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.values = function(_) {
+ nv.log("pie.values() is no longer supported.");
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.description = function(_) {
+ if (!arguments.length) return getDescription;
+ getDescription = _;
+ return chart;
+ };
+
+ chart.showLabels = function(_) {
+ if (!arguments.length) return showLabels;
+ showLabels = _;
+ return chart;
+ };
+
+ chart.labelSunbeamLayout = function(_) {
+ if (!arguments.length) return labelSunbeamLayout;
+ labelSunbeamLayout = _;
+ return chart;
+ };
+
+ chart.donutLabelsOutside = function(_) {
+ if (!arguments.length) return donutLabelsOutside;
+ donutLabelsOutside = _;
+ return chart;
+ };
+
+ chart.pieLabelsOutside = function(_) {
+ if (!arguments.length) return pieLabelsOutside;
+ pieLabelsOutside = _;
+ return chart;
+ };
+
+ chart.labelType = function(_) {
+ if (!arguments.length) return labelType;
+ labelType = _;
+ labelType = labelType || "key";
+ return chart;
+ };
+
+ chart.donut = function(_) {
+ if (!arguments.length) return donut;
+ donut = _;
+ return chart;
+ };
+
+ chart.donutRatio = function(_) {
+ if (!arguments.length) return donutRatio;
+ donutRatio = _;
+ return chart;
+ };
+
+ chart.startAngle = function(_) {
+ if (!arguments.length) return startAngle;
+ startAngle = _;
+ return chart;
+ };
+
+ chart.endAngle = function(_) {
+ if (!arguments.length) return endAngle;
+ endAngle = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.valueFormat = function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.labelThreshold = function(_) {
+ if (!arguments.length) return labelThreshold;
+ labelThreshold = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js.bak b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js.bak
new file mode 100644
index 00000000..aac835d2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js.bak
@@ -0,0 +1,400 @@
+nv.models.pie = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 500
+ , height = 500
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , getDescription = function(d) { return d.description }
+ , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
+ , color = nv.utils.defaultColor()
+ , valueFormat = d3.format(',.2f')
+ , showLabels = true
+ , pieLabelsOutside = true
+ , donutLabelsOutside = false
+ , labelType = "key"
+ , labelThreshold = .02 //if slice percentage is under this, don't show label
+ , donut = false
+ , labelSunbeamLayout = false
+ , startAngle = false
+ , endAngle = false
+ , donutRatio = 0.5
+ , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ radius = Math.min(availableWidth, availableHeight) / 2,
+ arcRadius = radius-(radius / 5),
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ //var wrap = container.selectAll('.nv-wrap.nv-pie').data([data]);
+ var wrap = container.selectAll('.nv-wrap.nv-pie').data(data);
+ var wrapEnter = wrap.enter().append('g').attr('class','nvd3 nv-wrap nv-pie nv-chart-' + id);
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-pie');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+ g.select('.nv-pie').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')');
+
+ //------------------------------------------------------------
+
+
+ container
+ .on('click', function(d,i) {
+ dispatch.chartClick({
+ data: d,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ });
+
+
+ var arc = d3.svg.arc()
+ .outerRadius(arcRadius);
+
+ if (startAngle) arc.startAngle(startAngle)
+ if (endAngle) arc.endAngle(endAngle);
+ if (donut) arc.innerRadius(radius * donutRatio);
+
+ // Setup the Pie chart and choose the data element
+ var pie = d3.layout.pie()
+ .sort(null)
+ .value(function(d) { return d.disabled ? 0 : getY(d) });
+
+ var slices = wrap.select('.nv-pie').selectAll('.nv-slice')
+ .data(pie);
+
+ slices.exit().remove();
+
+ var ae = slices.enter().append('g')
+ .attr('class', 'nv-slice')
+ .on('mouseover', function(d,i){
+ d3.select(this).classed('hover', true);
+ dispatch.elementMouseover({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ pointIndex: i,
+ pos: [d3.event.pageX, d3.event.pageY],
+ id: id
+ });
+ })
+ .on('mouseout', function(d,i){
+ d3.select(this).classed('hover', false);
+ dispatch.elementMouseout({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ id: id
+ });
+ })
+ .on('click', function(d,i) {
+ dispatch.elementClick({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ })
+ .on('dblclick', function(d,i) {
+ dispatch.elementDblClick({
+ label: getX(d.data),
+ value: getY(d.data),
+ point: d.data,
+ index: i,
+ pos: d3.event,
+ id: id
+ });
+ d3.event.stopPropagation();
+ });
+
+ slices
+ .attr('fill', function(d,i) { return color(d, i); })
+ .attr('stroke', function(d,i) { return color(d, i); });
+
+ var paths = ae.append('path')
+ .each(function(d) { this._current = d; });
+ //.attr('d', arc);
+
+ d3.transition(slices.select('path'))
+ .attr('d', arc)
+ .attrTween('d', arcTween);
+
+ if (showLabels) {
+ // This does the normal label
+ var labelsArc = d3.svg.arc().innerRadius(0);
+
+ if (pieLabelsOutside){ labelsArc = arc; }
+
+ if (donutLabelsOutside) { labelsArc = d3.svg.arc().outerRadius(arc.outerRadius()); }
+
+ ae.append("g").classed("nv-label", true)
+ .each(function(d, i) {
+ var group = d3.select(this);
+
+ group
+ .attr('transform', function(d) {
+ if (labelSunbeamLayout) {
+ d.outerRadius = arcRadius + 10; // Set Outer Coordinate
+ d.innerRadius = arcRadius + 15; // Set Inner Coordinate
+ var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
+ if ((d.startAngle+d.endAngle)/2 < Math.PI) {
+ rotateAngle -= 90;
+ } else {
+ rotateAngle += 90;
+ }
+ return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
+ } else {
+ d.outerRadius = radius + 10; // Set Outer Coordinate
+ d.innerRadius = radius + 15; // Set Inner Coordinate
+ return 'translate(' + labelsArc.centroid(d) + ')'
+ }
+ });
+
+ group.append('rect')
+ .style('stroke', '#fff')
+ .style('fill', '#fff')
+ .attr("rx", 3)
+ .attr("ry", 3);
+
+ group.append('text')
+ .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
+ .style('fill', '#000')
+
+
+ });
+
+ slices.select(".nv-label").transition()
+ .attr('transform', function(d) {
+ if (labelSunbeamLayout) {
+ d.outerRadius = arcRadius + 10; // Set Outer Coordinate
+ d.innerRadius = arcRadius + 15; // Set Inner Coordinate
+ var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
+ if ((d.startAngle+d.endAngle)/2 < Math.PI) {
+ rotateAngle -= 90;
+ } else {
+ rotateAngle += 90;
+ }
+ return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
+ } else {
+ d.outerRadius = radius + 10; // Set Outer Coordinate
+ d.innerRadius = radius + 15; // Set Inner Coordinate
+ return 'translate(' + labelsArc.centroid(d) + ')'
+ }
+ });
+
+ slices.each(function(d, i) {
+ var slice = d3.select(this);
+
+ slice
+ .select(".nv-label text")
+ .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
+ .text(function(d, i) {
+ var percent = (d.endAngle - d.startAngle) / (2 * Math.PI);
+ return Math.round(percent*1001/10)+"%";
+ /*var labelTypes = {
+ "key" : getX(d.data),
+ "value": getY(d.data),
+ "percent": d3.format('%')(percent)
+ };
+ return (d.value && percent > labelThreshold) ? labelTypes[labelType] : '';
+ */
+ });
+
+ var textBox = slice.select('text').node().getBBox();
+ slice.select(".nv-label rect")
+ .attr("width", textBox.width + 10)
+ .attr("height", textBox.height + 10)
+ .attr("transform", function() {
+ return "translate(" + [textBox.x - 5, textBox.y - 5] + ")";
+ });
+ });
+ }
+
+
+ // Computes the angle of an arc, converting from radians to degrees.
+ function angle(d) {
+ var a = (d.startAngle + d.endAngle) * 90 / Math.PI - 90;
+ return a > 90 ? a - 180 : a;
+ }
+
+ function arcTween(a) {
+ a.endAngle = isNaN(a.endAngle) ? 0 : a.endAngle;
+ a.startAngle = isNaN(a.startAngle) ? 0 : a.startAngle;
+ if (!donut) a.innerRadius = 0;
+ var i = d3.interpolate(this._current, a);
+ this._current = i(0);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+
+ function tweenPie(b) {
+ b.innerRadius = 0;
+ var i = d3.interpolate({startAngle: 0, endAngle: 0}, b);
+ return function(t) {
+ return arc(i(t));
+ };
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.values = function(_) {
+ nv.log("pie.values() is no longer supported.");
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = _;
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.description = function(_) {
+ if (!arguments.length) return getDescription;
+ getDescription = _;
+ return chart;
+ };
+
+ chart.showLabels = function(_) {
+ if (!arguments.length) return showLabels;
+ showLabels = _;
+ return chart;
+ };
+
+ chart.labelSunbeamLayout = function(_) {
+ if (!arguments.length) return labelSunbeamLayout;
+ labelSunbeamLayout = _;
+ return chart;
+ };
+
+ chart.donutLabelsOutside = function(_) {
+ if (!arguments.length) return donutLabelsOutside;
+ donutLabelsOutside = _;
+ return chart;
+ };
+
+ chart.pieLabelsOutside = function(_) {
+ if (!arguments.length) return pieLabelsOutside;
+ pieLabelsOutside = _;
+ return chart;
+ };
+
+ chart.labelType = function(_) {
+ if (!arguments.length) return labelType;
+ labelType = _;
+ labelType = labelType || "key";
+ return chart;
+ };
+
+ chart.donut = function(_) {
+ if (!arguments.length) return donut;
+ donut = _;
+ return chart;
+ };
+
+ chart.donutRatio = function(_) {
+ if (!arguments.length) return donutRatio;
+ donutRatio = _;
+ return chart;
+ };
+
+ chart.startAngle = function(_) {
+ if (!arguments.length) return startAngle;
+ startAngle = _;
+ return chart;
+ };
+
+ chart.endAngle = function(_) {
+ if (!arguments.length) return endAngle;
+ endAngle = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.valueFormat = function(_) {
+ if (!arguments.length) return valueFormat;
+ valueFormat = _;
+ return chart;
+ };
+
+ chart.labelThreshold = function(_) {
+ if (!arguments.length) return labelThreshold;
+ labelThreshold = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pieChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pieChart.js
new file mode 100644
index 00000000..b4303fd6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pieChart.js
@@ -0,0 +1,292 @@
+nv.models.pieChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var pie = nv.models.pie()
+ , legend = nv.models.legend()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 20, left: 20}
+ , width = null
+ , height = null
+ , showLegend = true
+ , color = nv.utils.defaultColor()
+ , tooltips = false
+ , tooltip = function(key, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + '</p>'
+ }
+ , state = {}
+ , defaultState = null
+ , noData = "No Data Available."
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var tooltipLabel = pie.description()(e.point) || pie.x()(e.point)
+ var left = e.pos[0] + ( (offsetElement && offsetElement.offsetLeft) || 0 ),
+ top = e.pos[1] + ( (offsetElement && offsetElement.offsetTop) || 0),
+ y = pie.valueFormat()(pie.y()(e.point)),
+ content = tooltip(tooltipLabel, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-pieChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-pieChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-pieWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend
+ .width( availableWidth )
+ .key(pie.x());
+
+ wrap.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ pie
+ .width(availableWidth)
+ .height(availableHeight);
+
+
+ var pieWrap = g.select('.nv-pieWrap')
+ .datum([data]);
+
+ d3.transition(pieWrap).call(pie);
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ /*legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });*/
+
+ pie.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ });
+
+ return chart;
+ }
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ pie.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.legend = legend;
+ chart.dispatch = dispatch;
+ chart.pie = pie;
+
+ d3.rebind(chart, pie, 'valueFormat', 'values', 'x', 'y', 'description', 'id', 'showLabels', 'donutLabelsOutside', 'pieLabelsOutside', 'labelType', 'donut', 'donutRatio', 'labelThreshold');
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ pie.color(color);
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatter.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatter.js
new file mode 100644
index 00000000..16cbee65
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatter.js
@@ -0,0 +1,674 @@
+
+nv.models.scatter = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // chooses color
+ , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't select one
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , z = d3.scale.linear() //linear because d3.svg.shape.size is treated as area
+ , getX = function(d) { return d.x } // accessor to get the x value
+ , getY = function(d) { return d.y } // accessor to get the y value
+ , getSize = function(d) { return d.size || 1} // accessor to get the point size
+ , getShape = function(d) { return d.shape || 'circle' } // accessor to get point shape
+ , onlyCircles = true // Set to false to use shapes
+ , forceX = [] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.)
+ , forceY = [] // List of numbers to Force into the Y scale
+ , forceSize = [] // List of numbers to Force into the Size scale
+ , interactive = true // If true, plots a voronoi overlay for advanced point intersection
+ , pointKey = null
+ , pointActive = function(d) { return !d.notActive } // any points that return false will be filtered out
+ , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart
+ , padDataOuter = .1 //outerPadding to imitate ordinal scale outer padding
+ , clipEdge = false // if true, masks points within x and y scale
+ , clipVoronoi = true // if true, masks each point with a circle... can turn off to slightly increase performance
+ , clipRadius = function() { return 25 } // function to get the radius for voronoi point clips
+ , xDomain = null // Override x domain (skips the calculation from data)
+ , yDomain = null // Override y domain
+ , xRange = null // Override x range
+ , yRange = null // Override y range
+ , sizeDomain = null // Override point size domain
+ , sizeRange = null
+ , singlePoint = false
+ , dispatch = d3.dispatch('elementClick', 'elementMouseover', 'elementMouseout')
+ , useVoronoi = true
+ ;
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0, z0 // used to store previous scales
+ , timeoutID
+ , needsUpdate = false // Flag for when the points are visually updating, but the interactive layer is behind, to disable tooltips
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //add series index to each data point for reference
+ data.forEach(function(series, i) {
+ series.values.forEach(function(point) {
+ point.series = i;
+ });
+ });
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ // remap and flatten the data for use in calculating the scales' domains
+ var seriesData = (xDomain && yDomain && sizeDomain) ? [] : // if we know xDomain and yDomain and sizeDomain, no need to calculate.... if Size is constant remember to set sizeDomain to speed up performance
+ d3.merge(
+ data.map(function(d) {
+ return d.values.map(function(d,i) {
+ return { x: getX(d,i), y: getY(d,i), size: getSize(d,i) }
+ })
+ })
+ );
+
+ x .domain(xDomain || d3.extent(seriesData.map(function(d) { return d.x; }).concat(forceX)))
+
+ if (padData && data[0])
+ x.range(xRange || [(availableWidth * padDataOuter + availableWidth) / (2 *data[0].values.length), availableWidth - availableWidth * (1 + padDataOuter) / (2 * data[0].values.length) ]);
+ //x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
+ else
+ x.range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(seriesData.map(function(d) { return d.y }).concat(forceY)))
+ .range(yRange || [availableHeight, 0]);
+
+ z .domain(sizeDomain || d3.extent(seriesData.map(function(d) { return d.size }).concat(forceSize)))
+ .range(sizeRange || [16, 256]);
+
+ // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
+ if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
+ if (x.domain()[0] === x.domain()[1])
+ x.domain()[0] ?
+ x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
+ : x.domain([-1,1]);
+
+ if (y.domain()[0] === y.domain()[1])
+ y.domain()[0] ?
+ y.domain([y.domain()[0] - y.domain()[0] * 0.01, y.domain()[1] + y.domain()[1] * 0.01])
+ : y.domain([-1,1]);
+
+ if ( isNaN(x.domain()[0])) {
+ x.domain([-1,1]);
+ }
+
+ if ( isNaN(y.domain()[0])) {
+ y.domain([-1,1]);
+ }
+
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+ z0 = z0 || z;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatter').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatter nv-chart-' + id + (singlePoint ? ' nv-single-point' : ''));
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-groups');
+ gEnter.append('g').attr('class', 'nv-point-paths');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+
+ function updateInteractiveLayer() {
+
+ if (!interactive) return false;
+
+ var eventElements;
+
+ var vertices = d3.merge(data.map(function(group, groupIndex) {
+ return group.values
+ .map(function(point, pointIndex) {
+ // *Adding noise to make duplicates very unlikely
+ // *Injecting series and point index for reference
+ /* *Adding a 'jitter' to the points, because there's an issue in d3.geom.voronoi.
+ */
+ var pX = getX(point,pointIndex);
+ var pY = getY(point,pointIndex);
+
+ return [x(pX)+ Math.random() * 1e-7,
+ y(pY)+ Math.random() * 1e-7,
+ groupIndex,
+ pointIndex, point]; //temp hack to add noise untill I think of a better way so there are no duplicates
+ })
+ .filter(function(pointArray, pointIndex) {
+ return pointActive(pointArray[4], pointIndex); // Issue #237.. move filter to after map, so pointIndex is correct!
+ })
+ })
+ );
+
+
+
+ //inject series and point index for reference into voronoi
+ if (useVoronoi === true) {
+
+ if (clipVoronoi) {
+ var pointClipsEnter = wrap.select('defs').selectAll('.nv-point-clips')
+ .data([id])
+ .enter();
+
+ pointClipsEnter.append('clipPath')
+ .attr('class', 'nv-point-clips')
+ .attr('id', 'nv-points-clip-' + id);
+
+ var pointClips = wrap.select('#nv-points-clip-' + id).selectAll('circle')
+ .data(vertices);
+ pointClips.enter().append('circle')
+ .attr('r', clipRadius);
+ pointClips.exit().remove();
+ pointClips
+ .attr('cx', function(d) { return d[0] })
+ .attr('cy', function(d) { return d[1] });
+
+ wrap.select('.nv-point-paths')
+ .attr('clip-path', 'url(#nv-points-clip-' + id + ')');
+ }
+
+
+ if(vertices.length) {
+ // Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work
+ vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]);
+ vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]);
+ vertices.push([x.range()[0] - 20, y.range()[0] + 20, null, null]);
+ vertices.push([x.range()[1] + 20, y.range()[1] - 20, null, null]);
+ }
+
+ var bounds = d3.geom.polygon([
+ [-10,-10],
+ [-10,height + 10],
+ [width + 10,height + 10],
+ [width + 10,-10]
+ ]);
+
+ var voronoi = d3.geom.voronoi(vertices).map(function(d, i) {
+ return {
+ 'data': bounds.clip(d),
+ 'series': vertices[i][2],
+ 'point': vertices[i][3]
+ }
+ });
+
+
+ var pointPaths = wrap.select('.nv-point-paths').selectAll('path')
+ .data(voronoi);
+ pointPaths.enter().append('path')
+ .attr('class', function(d,i) { return 'nv-path-'+i; });
+ pointPaths.exit().remove();
+ pointPaths
+ .attr('d', function(d) {
+ if (d.data.length === 0)
+ return 'M 0 0'
+ else
+ return 'M' + d.data.join('L') + 'Z';
+ });
+
+ var mouseEventCallback = function(d,mDispatch) {
+ if (needsUpdate) return 0;
+ var series = data[d.series];
+ if (typeof series === 'undefined') return;
+
+ var point = series.values[d.point];
+
+ mDispatch({
+ point: point,
+ series: series,
+ pos: [x(getX(point, d.point)) + margin.left, y(getY(point, d.point)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: d.point
+ });
+ };
+
+ pointPaths
+ .on('click', function(d) {
+ mouseEventCallback(d, dispatch.elementClick);
+ })
+ .on('mouseover', function(d) {
+ mouseEventCallback(d, dispatch.elementMouseover);
+ })
+ .on('mouseout', function(d, i) {
+ mouseEventCallback(d, dispatch.elementMouseout);
+ });
+
+
+ } else {
+ /*
+ // bring data in form needed for click handlers
+ var dataWithPoints = vertices.map(function(d, i) {
+ return {
+ 'data': d,
+ 'series': vertices[i][2],
+ 'point': vertices[i][3]
+ }
+ });
+ */
+
+ // add event handlers to points instead voronoi paths
+ wrap.select('.nv-groups').selectAll('.nv-group')
+ .selectAll('.nv-point')
+ //.data(dataWithPoints)
+ //.style('pointer-events', 'auto') // recativate events, disabled by css
+ .on('click', function(d,i) {
+ //nv.log('test', d, i);
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementClick({
+ point: point,
+ series: series,
+ pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ })
+ .on('mouseover', function(d,i) {
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementMouseover({
+ point: point,
+ series: series,
+ pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top],
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ })
+ .on('mouseout', function(d,i) {
+ if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
+ var series = data[d.series],
+ point = series.values[i];
+
+ dispatch.elementMouseout({
+ point: point,
+ series: series,
+ seriesIndex: d.series,
+ pointIndex: i
+ });
+ });
+ }
+
+ needsUpdate = false;
+ }
+
+ needsUpdate = true;
+
+ var groups = wrap.select('.nv-groups').selectAll('.nv-group')
+ .data(function(d) { return d }, function(d) { return d.key });
+ groups.enter().append('g')
+ .style('stroke-opacity', 1e-6)
+ .style('fill-opacity', 1e-6);
+ groups.exit()
+ .remove();
+ groups
+ .attr('class', function(d,i) { return 'nv-group nv-series-' + i })
+ .classed('hover', function(d) { return d.hover });
+ groups
+ .transition()
+ .style('fill', function(d,i) { return color(d, i) })
+ .style('stroke', function(d,i) { return color(d, i) })
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', .5);
+
+
+ if (onlyCircles) {
+
+ var points = groups.selectAll('circle.nv-point')
+ .data(function(d) { return d.values }, pointKey);
+ points.enter().append('circle')
+ .style('fill', function (d,i) { return d.color })
+ .style('stroke', function (d,i) { return d.color })
+ .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) })
+ .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) })
+ .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) });
+ points.exit().remove();
+ groups.exit().selectAll('path.nv-point').transition()
+ .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ .remove();
+ points.each(function(d,i) {
+ d3.select(this)
+ .classed('nv-point', true)
+ .classed('nv-point-' + i, true)
+ .classed('hover',false)
+ ;
+ });
+ points.transition()
+ .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
+ .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
+ .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) });
+
+ } else {
+
+ var points = groups.selectAll('path.nv-point')
+ .data(function(d) { return d.values });
+ points.enter().append('path')
+ .style('fill', function (d,i) { return d.color })
+ .style('stroke', function (d,i) { return d.color })
+ .attr('transform', function(d,i) {
+ return 'translate(' + x0(getX(d,i)) + ',' + y0(getY(d,i)) + ')'
+ })
+ .attr('d',
+ d3.svg.symbol()
+ .type(getShape)
+ .size(function(d,i) { return z(getSize(d,i)) })
+ );
+ points.exit().remove();
+ groups.exit().selectAll('path.nv-point')
+ .transition()
+ .attr('transform', function(d,i) {
+ return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
+ })
+ .remove();
+ points.each(function(d,i) {
+ d3.select(this)
+ .classed('nv-point', true)
+ .classed('nv-point-' + i, true)
+ .classed('hover',false)
+ ;
+ });
+ points.transition()
+ .attr('transform', function(d,i) {
+ //nv.log(d,i,getX(d,i), x(getX(d,i)));
+ return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
+ })
+ .attr('d',
+ d3.svg.symbol()
+ .type(getShape)
+ .size(function(d,i) { return z(getSize(d,i)) })
+ );
+ }
+
+
+ // Delay updating the invisible interactive layer for smoother animation
+ clearTimeout(timeoutID); // stop repeat calls to updateInteractiveLayer
+ timeoutID = setTimeout(updateInteractiveLayer, 300);
+ //updateInteractiveLayer();
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+ z0 = z.copy();
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+ chart.clearHighlights = function() {
+ //Remove the 'hover' class from all highlighted points.
+ d3.selectAll(".nv-chart-" + id + " .nv-point.hover").classed("hover",false);
+ };
+
+ chart.highlightPoint = function(seriesIndex,pointIndex,isHoverOver) {
+ d3.select(".nv-chart-" + id + " .nv-series-" + seriesIndex + " .nv-point-" + pointIndex)
+ .classed("hover",isHoverOver);
+ };
+
+
+ dispatch.on('elementMouseover.point', function(d) {
+ if (interactive) chart.highlightPoint(d.seriesIndex,d.pointIndex,true);
+ });
+
+ dispatch.on('elementMouseout.point', function(d) {
+ if (interactive) chart.highlightPoint(d.seriesIndex,d.pointIndex,false);
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.size = function(_) {
+ if (!arguments.length) return getSize;
+ getSize = d3.functor(_);
+ return chart;
+ };
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.zScale = function(_) {
+ if (!arguments.length) return z;
+ z = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.sizeDomain = function(_) {
+ if (!arguments.length) return sizeDomain;
+ sizeDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.sizeRange = function(_) {
+ if (!arguments.length) return sizeRange;
+ sizeRange = _;
+ return chart;
+ };
+
+ chart.forceX = function(_) {
+ if (!arguments.length) return forceX;
+ forceX = _;
+ return chart;
+ };
+
+ chart.forceY = function(_) {
+ if (!arguments.length) return forceY;
+ forceY = _;
+ return chart;
+ };
+
+ chart.forceSize = function(_) {
+ if (!arguments.length) return forceSize;
+ forceSize = _;
+ return chart;
+ };
+
+ chart.interactive = function(_) {
+ if (!arguments.length) return interactive;
+ interactive = _;
+ return chart;
+ };
+
+ chart.pointKey = function(_) {
+ if (!arguments.length) return pointKey;
+ pointKey = _;
+ return chart;
+ };
+
+ chart.pointActive = function(_) {
+ if (!arguments.length) return pointActive;
+ pointActive = _;
+ return chart;
+ };
+
+ chart.padData = function(_) {
+ if (!arguments.length) return padData;
+ padData = _;
+ return chart;
+ };
+
+ chart.padDataOuter = function(_) {
+ if (!arguments.length) return padDataOuter;
+ padDataOuter = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.clipVoronoi= function(_) {
+ if (!arguments.length) return clipVoronoi;
+ clipVoronoi = _;
+ return chart;
+ };
+
+ chart.useVoronoi= function(_) {
+ if (!arguments.length) return useVoronoi;
+ useVoronoi = _;
+ if (useVoronoi === false) {
+ clipVoronoi = false;
+ }
+ return chart;
+ };
+
+ chart.clipRadius = function(_) {
+ if (!arguments.length) return clipRadius;
+ clipRadius = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.shape = function(_) {
+ if (!arguments.length) return getShape;
+ getShape = _;
+ return chart;
+ };
+
+ chart.onlyCircles = function(_) {
+ if (!arguments.length) return onlyCircles;
+ onlyCircles = _;
+ return chart;
+ };
+
+ chart.id = function(_) {
+ if (!arguments.length) return id;
+ id = _;
+ return chart;
+ };
+
+ chart.singlePoint = function(_) {
+ if (!arguments.length) return singlePoint;
+ singlePoint = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterChart.js
new file mode 100644
index 00000000..65b6e387
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterChart.js
@@ -0,0 +1,628 @@
+nv.models.scatterChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , distX = nv.models.distribution()
+ , distY = nv.models.distribution()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 75}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale()
+ , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale()
+ , xPadding = 0
+ , yPadding = 0
+ , showDistX = false
+ , showDistY = false
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , showControls = !!d3.fisheye
+ , fisheye = 0
+ , pauseFisheye = false
+ , tooltips = true
+ , tooltipX = function(key, x, y) { return '<strong>' + x + '</strong>' }
+ , tooltipY = function(key, x, y) { return '<strong>' + y + '</strong>' }
+ , tooltip = null
+ , state = {}
+ , defaultState = null
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , noData = "No Data Available."
+ , transitionDuration = 250
+ ;
+
+ scatter
+ .xScale(x)
+ .yScale(y)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(10)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ .tickPadding(10)
+ ;
+ distX
+ .axis('x')
+ ;
+ distY
+ .axis('y')
+ ;
+
+ controls.updateState(false);
+
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ var showTooltip = function(e, offsetElement) {
+ //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?)
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0),
+ leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ),
+ topY = e.pos[1] + ( offsetElement.offsetTop || 0),
+ xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)),
+ yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex));
+
+ if( tooltipX != null )
+ nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip');
+ if( tooltipY != null )
+ nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip');
+ if( tooltip != null )
+ nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ var controlsData = [
+ { key: 'Magnify', disabled: true }
+ ];
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id());
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ // background for pointer events
+ gEnter.append('rect').attr('class', 'nvd3 nv-background');
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+ gEnter.append('g').attr('class', 'nv-distWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ var legendWidth = (showControls) ? availableWidth / 2 : availableWidth;
+ legend.width(legendWidth);
+
+ wrap.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth - legendWidth) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ controls.width(180).color(['#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+
+ if (xPadding !== 0)
+ scatter.xDomain(null);
+
+ if (yPadding !== 0)
+ scatter.yDomain(null);
+
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+ //Adjust for x and y padding
+ if (xPadding !== 0) {
+ var xRange = x.domain()[1] - x.domain()[0];
+ scatter.xDomain([x.domain()[0] - (xPadding * xRange), x.domain()[1] + (xPadding * xRange)]);
+ }
+
+ if (yPadding !== 0) {
+ var yRange = y.domain()[1] - y.domain()[0];
+ scatter.yDomain([y.domain()[0] - (yPadding * yRange), y.domain()[1] + (yPadding * yRange)]);
+ }
+
+ //Only need to update the scatter again if x/yPadding changed the domain.
+ if (yPadding !== 0 || xPadding !== 0) {
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( xAxis.ticks() && xAxis.ticks().length ? xAxis.ticks() : availableWidth / 100 )
+ .tickSize( -availableHeight , 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .call(xAxis);
+
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( yAxis.ticks() && yAxis.ticks().length ? yAxis.ticks() : availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .call(yAxis);
+ }
+
+
+ if (showDistX) {
+ distX
+ .getData(scatter.x())
+ .scale(x)
+ .width(availableWidth)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionX');
+ g.select('.nv-distributionX')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ }
+
+ if (showDistY) {
+ distY
+ .getData(scatter.y())
+ .scale(y)
+ .width(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionY');
+ g.select('.nv-distributionY')
+ .attr('transform',
+ 'translate(' + (rightAlignYAxis ? availableWidth : -distY.size() ) + ',0)')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+ //------------------------------------------------------------
+
+
+
+
+ if (d3.fisheye) {
+ g.select('.nv-background')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g.select('.nv-background').on('mousemove', updateFisheye);
+ g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;});
+ scatter.dispatch.on('elementClick.freezeFisheye', function() {
+ pauseFisheye = !pauseFisheye;
+ });
+ }
+
+
+ function updateFisheye() {
+ if (pauseFisheye) {
+ g.select('.nv-point-paths').style('pointer-events', 'all');
+ return false;
+ }
+
+ g.select('.nv-point-paths').style('pointer-events', 'none' );
+
+ var mouse = d3.mouse(this);
+ x.distortion(fisheye).focus(mouse[0]);
+ y.distortion(fisheye).focus(mouse[1]);
+
+ g.select('.nv-scatterWrap')
+ .call(scatter);
+
+ if (showXAxis)
+ g.select('.nv-x.nv-axis').call(xAxis);
+
+ if (showYAxis)
+ g.select('.nv-y.nv-axis').call(yAxis);
+
+ g.select('.nv-distributionX')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ g.select('.nv-distributionY')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ fisheye = d.disabled ? 0 : 2.5;
+ g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all');
+ g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' );
+
+ if (d.disabled) {
+ x.distortion(fisheye).focus(0);
+ y.distortion(fisheye).focus(0);
+
+ g.select('.nv-scatterWrap').call(scatter);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ } else {
+ pauseFisheye = false;
+ }
+
+ chart.update();
+ });
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state.disabled = newState.disabled;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', function(d,i) { return e.pos[1] - availableHeight;});
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', e.pos[0] + distX.size());
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', 0);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', distY.size());
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.distX = distX;
+ chart.distY = distY;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ distX.color(color);
+ distY.color(color);
+ return chart;
+ };
+
+ chart.showDistX = function(_) {
+ if (!arguments.length) return showDistX;
+ showDistX = _;
+ return chart;
+ };
+
+ chart.showDistY = function(_) {
+ if (!arguments.length) return showDistY;
+ showDistY = _;
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+
+ chart.fisheye = function(_) {
+ if (!arguments.length) return fisheye;
+ fisheye = _;
+ return chart;
+ };
+
+ chart.xPadding = function(_) {
+ if (!arguments.length) return xPadding;
+ xPadding = _;
+ return chart;
+ };
+
+ chart.yPadding = function(_) {
+ if (!arguments.length) return yPadding;
+ yPadding = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltipXContent = function(_) {
+ if (!arguments.length) return tooltipX;
+ tooltipX = _;
+ return chart;
+ };
+
+ chart.tooltipYContent = function(_) {
+ if (!arguments.length) return tooltipY;
+ tooltipY = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterPlusLineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterPlusLineChart.js
new file mode 100644
index 00000000..23c87853
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterPlusLineChart.js
@@ -0,0 +1,620 @@
+
+nv.models.scatterPlusLineChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var scatter = nv.models.scatter()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , distX = nv.models.distribution()
+ , distY = nv.models.distribution()
+ ;
+
+ var margin = {top: 30, right: 20, bottom: 50, left: 75}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor()
+ , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale()
+ , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale()
+ , showDistX = false
+ , showDistY = false
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , showControls = !!d3.fisheye
+ , fisheye = 0
+ , pauseFisheye = false
+ , tooltips = true
+ , tooltipX = function(key, x, y) { return '<strong>' + x + '</strong>' }
+ , tooltipY = function(key, x, y) { return '<strong>' + y + '</strong>' }
+ , tooltip = function(key, x, y, date) { return '<h3>' + key + '</h3>'
+ + '<p>' + date + '</p>' }
+ , state = {}
+ , defaultState = null
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , noData = "No Data Available."
+ , transitionDuration = 250
+ ;
+
+ scatter
+ .xScale(x)
+ .yScale(y)
+ ;
+ xAxis
+ .orient('bottom')
+ .tickPadding(10)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ .tickPadding(10)
+ ;
+ distX
+ .axis('x')
+ ;
+ distY
+ .axis('y')
+ ;
+
+ controls.updateState(false);
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var x0, y0;
+
+ var showTooltip = function(e, offsetElement) {
+ //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?)
+
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0),
+ leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ),
+ topY = e.pos[1] + ( offsetElement.offsetTop || 0),
+ xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)),
+ yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex));
+
+ if( tooltipX != null )
+ nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip');
+ if( tooltipY != null )
+ nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip');
+ if( tooltip != null )
+ nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e.point.tooltip, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ var controlsData = [
+ { key: 'Magnify', disabled: true }
+ ];
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display noData message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ x0 = x0 || x;
+ y0 = y0 || y;
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id());
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g')
+
+ // background for pointer events
+ gEnter.append('rect').attr('class', 'nvd3 nv-background').style("pointer-events","none");
+
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+ gEnter.append('g').attr('class', 'nv-regressionLinesWrap');
+ gEnter.append('g').attr('class', 'nv-distWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ legend.width( availableWidth / 2 );
+
+ wrap.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ wrap.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ controls.width(180).color(['#444']);
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
+ .call(controls);
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }))
+
+ wrap.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+ wrap.select('.nv-regressionLinesWrap')
+ .attr('clip-path', 'url(#nv-edge-clip-' + scatter.id() + ')');
+
+ var regWrap = wrap.select('.nv-regressionLinesWrap').selectAll('.nv-regLines')
+ .data(function(d) {return d });
+
+ regWrap.enter().append('g').attr('class', 'nv-regLines');
+
+ var regLine = regWrap.selectAll('.nv-regLine').data(function(d){return [d]});
+ var regLineEnter = regLine.enter()
+ .append('line').attr('class', 'nv-regLine')
+ .style('stroke-opacity', 0);
+
+ regLine
+ .transition()
+ .attr('x1', x.range()[0])
+ .attr('x2', x.range()[1])
+ .attr('y1', function(d,i) {return y(x.domain()[0] * d.slope + d.intercept) })
+ .attr('y2', function(d,i) { return y(x.domain()[1] * d.slope + d.intercept) })
+ .style('stroke', function(d,i,j) { return color(d,j) })
+ .style('stroke-opacity', function(d,i) {
+ return (d.disabled || typeof d.slope === 'undefined' || typeof d.intercept === 'undefined') ? 0 : 1
+ });
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( xAxis.ticks() ? xAxis.ticks() : availableWidth / 100 )
+ .tickSize( -availableHeight , 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks( yAxis.ticks() ? yAxis.ticks() : availableHeight / 36 )
+ .tickSize( -availableWidth, 0);
+
+ g.select('.nv-y.nv-axis')
+ .call(yAxis);
+ }
+
+
+ if (showDistX) {
+ distX
+ .getData(scatter.x())
+ .scale(x)
+ .width(availableWidth)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionX');
+ g.select('.nv-distributionX')
+ .attr('transform', 'translate(0,' + y.range()[0] + ')')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ }
+
+ if (showDistY) {
+ distY
+ .getData(scatter.y())
+ .scale(y)
+ .width(availableHeight)
+ .color(data.map(function(d,i) {
+ return d.color || color(d, i);
+ }).filter(function(d,i) { return !data[i].disabled }));
+ gEnter.select('.nv-distWrap').append('g')
+ .attr('class', 'nv-distributionY');
+ g.select('.nv-distributionY')
+ .attr('transform', 'translate(' + (rightAlignYAxis ? availableWidth : -distY.size() ) + ',0)')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+ //------------------------------------------------------------
+
+
+
+
+ if (d3.fisheye) {
+ g.select('.nv-background')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight)
+ ;
+
+ g.select('.nv-background').on('mousemove', updateFisheye);
+ g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;});
+ scatter.dispatch.on('elementClick.freezeFisheye', function() {
+ pauseFisheye = !pauseFisheye;
+ });
+ }
+
+
+ function updateFisheye() {
+ if (pauseFisheye) {
+ g.select('.nv-point-paths').style('pointer-events', 'all');
+ return false;
+ }
+
+ g.select('.nv-point-paths').style('pointer-events', 'none' );
+
+ var mouse = d3.mouse(this);
+ x.distortion(fisheye).focus(mouse[0]);
+ y.distortion(fisheye).focus(mouse[1]);
+
+ g.select('.nv-scatterWrap')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(scatter);
+
+ if (showXAxis)
+ g.select('.nv-x.nv-axis').call(xAxis);
+
+ if (showYAxis)
+ g.select('.nv-y.nv-axis').call(yAxis);
+
+ g.select('.nv-distributionX')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distX);
+ g.select('.nv-distributionY')
+ .datum(data.filter(function(d) { return !d.disabled }))
+ .call(distY);
+ }
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ d.disabled = !d.disabled;
+
+ fisheye = d.disabled ? 0 : 2.5;
+ g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all');
+ g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' );
+
+ if (d.disabled) {
+ x.distortion(fisheye).focus(0);
+ y.distortion(fisheye).focus(0);
+
+ g.select('.nv-scatterWrap').call(scatter);
+ g.select('.nv-x.nv-axis').call(xAxis);
+ g.select('.nv-y.nv-axis').call(yAxis);
+ } else {
+ pauseFisheye = false;
+ }
+
+ chart.update();
+ });
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state = newState;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', e.pos[1] - availableHeight);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', e.pos[0] + distX.size());
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
+ dispatch.tooltipShow(e);
+ });
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ chart.update();
+ });
+
+ //============================================================
+
+
+ //store old scales for use in transitions on update
+ x0 = x.copy();
+ y0 = y.copy();
+
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
+ .attr('y1', 0);
+ d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
+ .attr('x2', distY.size());
+ });
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.distX = distX;
+ chart.distY = distY;
+
+ d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ distX.color(color);
+ distY.color(color);
+ return chart;
+ };
+
+ chart.showDistX = function(_) {
+ if (!arguments.length) return showDistX;
+ showDistX = _;
+ return chart;
+ };
+
+ chart.showDistY = function(_) {
+ if (!arguments.length) return showDistY;
+ showDistY = _;
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.fisheye = function(_) {
+ if (!arguments.length) return fisheye;
+ fisheye = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltipXContent = function(_) {
+ if (!arguments.length) return tooltipX;
+ tooltipX = _;
+ return chart;
+ };
+
+ chart.tooltipYContent = function(_) {
+ if (!arguments.length) return tooltipY;
+ tooltipY = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparkline.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparkline.js
new file mode 100644
index 00000000..e4c2e87b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparkline.js
@@ -0,0 +1,194 @@
+
+nv.models.sparkline = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 2, right: 0, bottom: 2, left: 0}
+ , width = 400
+ , height = 32
+ , animate = true
+ , x = d3.scale.linear()
+ , y = d3.scale.linear()
+ , getX = function(d) { return d.x }
+ , getY = function(d) { return d.y }
+ , color = nv.utils.getColor(['#000'])
+ , xDomain
+ , yDomain
+ , xRange
+ , yRange
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x .domain(xDomain || d3.extent(data, getX ))
+ .range(xRange || [0, availableWidth]);
+
+ y .domain(yDomain || d3.extent(data, getY ))
+ .range(yRange || [availableHeight, 0]);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-sparkline').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparkline');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
+
+ //------------------------------------------------------------
+
+
+ var paths = wrap.selectAll('path')
+ .data(function(d) { return [d] });
+ paths.enter().append('path');
+ paths.exit().remove();
+ paths
+ .style('stroke', function(d,i) { return d.color || color(d, i) })
+ .attr('d', d3.svg.line()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y(function(d,i) { return y(getY(d,i)) })
+ );
+
+
+ // TODO: Add CURRENT data point (Need Min, Mac, Current / Most recent)
+ var points = wrap.selectAll('circle.nv-point')
+ .data(function(data) {
+ var yValues = data.map(function(d, i) { return getY(d,i); });
+ function pointIndex(index) {
+ if (index != -1) {
+ var result = data[index];
+ result.pointIndex = index;
+ return result;
+ } else {
+ return null;
+ }
+ }
+ var maxPoint = pointIndex(yValues.lastIndexOf(y.domain()[1])),
+ minPoint = pointIndex(yValues.indexOf(y.domain()[0])),
+ currentPoint = pointIndex(yValues.length - 1);
+ return [minPoint, maxPoint, currentPoint].filter(function (d) {return d != null;});
+ });
+ points.enter().append('circle');
+ points.exit().remove();
+ points
+ .attr('cx', function(d,i) { return x(getX(d,d.pointIndex)) })
+ .attr('cy', function(d,i) { return y(getY(d,d.pointIndex)) })
+ .attr('r', 2)
+ .attr('class', function(d,i) {
+ return getX(d, d.pointIndex) == x.domain()[1] ? 'nv-point nv-currentValue' :
+ getY(d, d.pointIndex) == y.domain()[0] ? 'nv-point nv-minValue' : 'nv-point nv-maxValue'
+ });
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ };
+
+ chart.xScale = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return chart;
+ };
+
+ chart.yScale = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return chart;
+ };
+
+ chart.xDomain = function(_) {
+ if (!arguments.length) return xDomain;
+ xDomain = _;
+ return chart;
+ };
+
+ chart.yDomain = function(_) {
+ if (!arguments.length) return yDomain;
+ yDomain = _;
+ return chart;
+ };
+
+ chart.xRange = function(_) {
+ if (!arguments.length) return xRange;
+ xRange = _;
+ return chart;
+ };
+
+ chart.yRange = function(_) {
+ if (!arguments.length) return yRange;
+ yRange = _;
+ return chart;
+ };
+
+ chart.animate = function(_) {
+ if (!arguments.length) return animate;
+ animate = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparklinePlus.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparklinePlus.js
new file mode 100644
index 00000000..1535f8af
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparklinePlus.js
@@ -0,0 +1,295 @@
+
+nv.models.sparklinePlus = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var sparkline = nv.models.sparkline();
+
+ var margin = {top: 15, right: 100, bottom: 10, left: 50}
+ , width = null
+ , height = null
+ , x
+ , y
+ , index = []
+ , paused = false
+ , xTickFormat = d3.format(',r')
+ , yTickFormat = d3.format(',.2f')
+ , showValue = true
+ , alignValue = true
+ , rightAlignValue = false
+ , noData = "No Data Available."
+ ;
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this);
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+
+
+ chart.update = function() { chart(selection) };
+ chart.container = this;
+
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ var currentValue = sparkline.y()(data[data.length-1], data.length-1);
+
+ //------------------------------------------------------------
+
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = sparkline.xScale();
+ y = sparkline.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-sparklineplus').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparklineplus');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-sparklineWrap');
+ gEnter.append('g').attr('class', 'nv-valueWrap');
+ gEnter.append('g').attr('class', 'nv-hoverArea');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ var sparklineWrap = g.select('.nv-sparklineWrap');
+
+ sparkline
+ .width(availableWidth)
+ .height(availableHeight);
+
+ sparklineWrap
+ .call(sparkline);
+
+ //------------------------------------------------------------
+
+
+ var valueWrap = g.select('.nv-valueWrap');
+
+ var value = valueWrap.selectAll('.nv-currentValue')
+ .data([currentValue]);
+
+ value.enter().append('text').attr('class', 'nv-currentValue')
+ .attr('dx', rightAlignValue ? -8 : 8)
+ .attr('dy', '.9em')
+ .style('text-anchor', rightAlignValue ? 'end' : 'start');
+
+ value
+ .attr('x', availableWidth + (rightAlignValue ? margin.right : 0))
+ .attr('y', alignValue ? function(d) { return y(d) } : 0)
+ .style('fill', sparkline.color()(data[data.length-1], data.length-1))
+ .text(yTickFormat(currentValue));
+
+
+
+ gEnter.select('.nv-hoverArea').append('rect')
+ .on('mousemove', sparklineHover)
+ .on('click', function() { paused = !paused })
+ .on('mouseout', function() { index = []; updateValueLine(); });
+ //.on('mouseout', function() { index = null; updateValueLine(); });
+
+ g.select('.nv-hoverArea rect')
+ .attr('transform', function(d) { return 'translate(' + -margin.left + ',' + -margin.top + ')' })
+ .attr('width', availableWidth + margin.left + margin.right)
+ .attr('height', availableHeight + margin.top);
+
+
+
+ function updateValueLine() { //index is currently global (within the chart), may or may not keep it that way
+ if (paused) return;
+
+ var hoverValue = g.selectAll('.nv-hoverValue').data(index)
+
+ var hoverEnter = hoverValue.enter()
+ .append('g').attr('class', 'nv-hoverValue')
+ .style('stroke-opacity', 0)
+ .style('fill-opacity', 0);
+
+ hoverValue.exit()
+ .transition().duration(250)
+ .style('stroke-opacity', 0)
+ .style('fill-opacity', 0)
+ .remove();
+
+ hoverValue
+ .attr('transform', function(d) { return 'translate(' + x(sparkline.x()(data[d],d)) + ',0)' })
+ .transition().duration(250)
+ .style('stroke-opacity', 1)
+ .style('fill-opacity', 1);
+
+ if (!index.length) return;
+
+ hoverEnter.append('line')
+ .attr('x1', 0)
+ .attr('y1', -margin.top)
+ .attr('x2', 0)
+ .attr('y2', availableHeight);
+
+
+ hoverEnter.append('text').attr('class', 'nv-xValue')
+ .attr('x', -6)
+ .attr('y', -margin.top)
+ .attr('text-anchor', 'end')
+ .attr('dy', '.9em')
+
+
+ g.select('.nv-hoverValue .nv-xValue')
+ .text(xTickFormat(sparkline.x()(data[index[0]], index[0])));
+
+ hoverEnter.append('text').attr('class', 'nv-yValue')
+ .attr('x', 6)
+ .attr('y', -margin.top)
+ .attr('text-anchor', 'start')
+ .attr('dy', '.9em')
+
+ g.select('.nv-hoverValue .nv-yValue')
+ .text(yTickFormat(sparkline.y()(data[index[0]], index[0])));
+
+ }
+
+
+ function sparklineHover() {
+ if (paused) return;
+
+ var pos = d3.mouse(this)[0] - margin.left;
+
+ function getClosestIndex(data, x) {
+ var distance = Math.abs(sparkline.x()(data[0], 0) - x);
+ var closestIndex = 0;
+ for (var i = 0; i < data.length; i++){
+ if (Math.abs(sparkline.x()(data[i], i) - x) < distance) {
+ distance = Math.abs(sparkline.x()(data[i], i) - x);
+ closestIndex = i;
+ }
+ }
+ return closestIndex;
+ }
+
+ index = [getClosestIndex(data, Math.round(x.invert(pos)))];
+
+ updateValueLine();
+ }
+
+ });
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.sparkline = sparkline;
+
+ d3.rebind(chart, sparkline, 'x', 'y', 'xScale', 'yScale', 'color');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.xTickFormat = function(_) {
+ if (!arguments.length) return xTickFormat;
+ xTickFormat = _;
+ return chart;
+ };
+
+ chart.yTickFormat = function(_) {
+ if (!arguments.length) return yTickFormat;
+ yTickFormat = _;
+ return chart;
+ };
+
+ chart.showValue = function(_) {
+ if (!arguments.length) return showValue;
+ showValue = _;
+ return chart;
+ };
+
+ chart.alignValue = function(_) {
+ if (!arguments.length) return alignValue;
+ alignValue = _;
+ return chart;
+ };
+
+ chart.rightAlignValue = function(_) {
+ if (!arguments.length) return rightAlignValue;
+ rightAlignValue = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedArea.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedArea.js
new file mode 100644
index 00000000..eefeb8fb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedArea.js
@@ -0,0 +1,368 @@
+
+nv.models.stackedArea = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var margin = {top: 0, right: 0, bottom: 0, left: 0}
+ , width = 960
+ , height = 500
+ , color = nv.utils.defaultColor() // a function that computes the color
+ , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't selet one
+ , getX = function(d) { return d.x } // accessor to get the x value from a data point
+ , getY = function(d) { return d.y } // accessor to get the y value from a data point
+ , style = 'stack'
+ , offset = 'zero'
+ , order = 'default'
+ , interpolate = 'linear' // controls the line interpolation
+ , clipEdge = false // if true, masks lines within x and y scale
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , scatter = nv.models.scatter()
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'areaClick', 'areaMouseover', 'areaMouseout')
+ ;
+
+ scatter
+ .size(2.2) // default size
+ .sizeDomain([2.2,2.2]) // all the same size by default
+ ;
+
+ /************************************
+ * offset:
+ * 'wiggle' (stream)
+ * 'zero' (stacked)
+ * 'expand' (normalize to 100%)
+ * 'silhouette' (simple centered)
+ *
+ * order:
+ * 'inside-out' (stream)
+ * 'default' (input order)
+ ************************************/
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var availableWidth = width - margin.left - margin.right,
+ availableHeight = height - margin.top - margin.bottom,
+ container = d3.select(this);
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = scatter.xScale();
+ y = scatter.yScale();
+
+ //------------------------------------------------------------
+
+ var dataRaw = data;
+ // Injecting point index into each point because d3.layout.stack().out does not give index
+ data.forEach(function(aseries, i) {
+ aseries.seriesIndex = i;
+ aseries.values = aseries.values.map(function(d, j) {
+ d.index = j;
+ d.seriesIndex = i;
+ return d;
+ });
+ });
+
+ var dataFiltered = data.filter(function(series) {
+ return !series.disabled;
+ });
+
+ data = d3.layout.stack()
+ .order(order)
+ .offset(offset)
+ .values(function(d) { return d.values }) //TODO: make values customizeable in EVERY model in this fashion
+ .x(getX)
+ .y(getY)
+ .out(function(d, y0, y) {
+ var yHeight = (getY(d) === 0) ? 0 : y;
+ d.display = {
+ y: yHeight,
+ y0: y0
+ };
+ })
+ (dataFiltered);
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-stackedarea').data([data]);
+ var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedarea');
+ var defsEnter = wrapEnter.append('defs');
+ var gEnter = wrapEnter.append('g');
+ var g = wrap.select('g');
+
+ gEnter.append('g').attr('class', 'nv-areaWrap');
+ gEnter.append('g').attr('class', 'nv-scatterWrap');
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ //------------------------------------------------------------
+
+
+ scatter
+ .width(availableWidth)
+ .height(availableHeight)
+ .x(getX)
+ .y(function(d) { return d.display.y + d.display.y0 })
+ .forceY([0])
+ .color(data.map(function(d,i) {
+ return d.color || color(d, d.seriesIndex);
+ }));
+
+
+ var scatterWrap = g.select('.nv-scatterWrap')
+ .datum(data);
+
+ scatterWrap.call(scatter);
+
+ defsEnter.append('clipPath')
+ .attr('id', 'nv-edge-clip-' + id)
+ .append('rect');
+
+ wrap.select('#nv-edge-clip-' + id + ' rect')
+ .attr('width', availableWidth)
+ .attr('height', availableHeight);
+
+ g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
+
+ var area = d3.svg.area()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d) {
+ return y(d.display.y0)
+ })
+ .y1(function(d) {
+ return y(d.display.y + d.display.y0)
+ })
+ .interpolate(interpolate);
+
+ var zeroArea = d3.svg.area()
+ .x(function(d,i) { return x(getX(d,i)) })
+ .y0(function(d) { return y(d.display.y0) })
+ .y1(function(d) { return y(d.display.y0) });
+
+
+ var path = g.select('.nv-areaWrap').selectAll('path.nv-area')
+ .data(function(d) { return d });
+
+ path.enter().append('path').attr('class', function(d,i) { return 'nv-area nv-area-' + i })
+ .attr('d', function(d,i){
+ return zeroArea(d.values, d.seriesIndex);
+ })
+ .on('mouseover', function(d,i) {
+ d3.select(this).classed('hover', true);
+ dispatch.areaMouseover({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ .on('mouseout', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.areaMouseout({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ .on('click', function(d,i) {
+ d3.select(this).classed('hover', false);
+ dispatch.areaClick({
+ point: d,
+ series: d.key,
+ pos: [d3.event.pageX, d3.event.pageY],
+ seriesIndex: i
+ });
+ })
+ path.exit().transition()
+ .attr('d', function(d,i) { return zeroArea(d.values,i) })
+ .remove();
+ path
+ .style('fill', function(d,i){
+ return d.color || color(d, d.seriesIndex)
+ })
+ .style('stroke', function(d,i){ return d.color || color(d, d.seriesIndex) });
+ path.transition()
+ .attr('d', function(d,i) {
+ return area(d.values,i)
+ });
+
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementMouseover.area', function(e) {
+ g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', true);
+ });
+ scatter.dispatch.on('elementMouseout.area', function(e) {
+ g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', false);
+ });
+
+ //============================================================
+ //Special offset functions
+ chart.d3_stackedOffset_stackPercent = function(stackData) {
+ var n = stackData.length, //How many series
+ m = stackData[0].length, //how many points per series
+ k = 1 / n,
+ i,
+ j,
+ o,
+ y0 = [];
+
+ for (j = 0; j < m; ++j) { //Looping through all points
+ for (i = 0, o = 0; i < dataRaw.length; i++) //looping through series'
+ o += getY(dataRaw[i].values[j]) //total value of all points at a certian point in time.
+
+ if (o) for (i = 0; i < n; i++)
+ stackData[i][j][1] /= o;
+ else
+ for (i = 0; i < n; i++)
+ stackData[i][j][1] = k;
+ }
+ for (j = 0; j < m; ++j) y0[j] = 0;
+ return y0;
+ };
+
+ });
+
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ scatter.dispatch.on('elementClick.area', function(e) {
+ dispatch.areaClick(e);
+ })
+ scatter.dispatch.on('elementMouseover.tooltip', function(e) {
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+ scatter.dispatch.on('elementMouseout.tooltip', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ //============================================================
+
+ //============================================================
+ // Global getters and setters
+ //------------------------------------------------------------
+
+ chart.dispatch = dispatch;
+ chart.scatter = scatter;
+
+ d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange',
+ 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'useVoronoi','clipRadius','highlightPoint','clearHighlights');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.x = function(_) {
+ if (!arguments.length) return getX;
+ getX = d3.functor(_);
+ return chart;
+ };
+
+ chart.y = function(_) {
+ if (!arguments.length) return getY;
+ getY = d3.functor(_);
+ return chart;
+ }
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.clipEdge = function(_) {
+ if (!arguments.length) return clipEdge;
+ clipEdge = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ return chart;
+ };
+
+ chart.offset = function(_) {
+ if (!arguments.length) return offset;
+ offset = _;
+ return chart;
+ };
+
+ chart.order = function(_) {
+ if (!arguments.length) return order;
+ order = _;
+ return chart;
+ };
+
+ //shortcut for offset + order
+ chart.style = function(_) {
+ if (!arguments.length) return style;
+ style = _;
+
+ switch (style) {
+ case 'stack':
+ chart.offset('zero');
+ chart.order('default');
+ break;
+ case 'stream':
+ chart.offset('wiggle');
+ chart.order('inside-out');
+ break;
+ case 'stream-center':
+ chart.offset('silhouette');
+ chart.order('inside-out');
+ break;
+ case 'expand':
+ chart.offset('expand');
+ chart.order('default');
+ break;
+ case 'stack_percent':
+ chart.offset(chart.d3_stackedOffset_stackPercent);
+ chart.order('default');
+ break;
+ }
+
+ return chart;
+ };
+
+ chart.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ interpolate = _;
+ return chart;
+ };
+ //============================================================
+
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedAreaChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedAreaChart.js
new file mode 100644
index 00000000..a036b8b0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedAreaChart.js
@@ -0,0 +1,629 @@
+
+nv.models.stackedAreaChart = function() {
+ "use strict";
+ //============================================================
+ // Public Variables with Default Settings
+ //------------------------------------------------------------
+
+ var stacked = nv.models.stackedArea()
+ , xAxis = nv.models.axis()
+ , yAxis = nv.models.axis()
+ , legend = nv.models.legend()
+ , controls = nv.models.legend()
+ , interactiveLayer = nv.interactiveGuideline()
+ ;
+
+ var margin = {top: 30, right: 25, bottom: 50, left: 60}
+ , width = null
+ , height = null
+ , color = nv.utils.defaultColor() // a function that takes in d, i and returns color
+ , showControls = true
+ , showLegend = true
+ , showXAxis = true
+ , showYAxis = true
+ , rightAlignYAxis = false
+ , useInteractiveGuideline = false
+ , tooltips = true
+ , tooltip = function(key, x, y, e, graph) {
+ return '<h3>' + key + '</h3>' +
+ '<p>' + y + ' on ' + x + '</p>'
+ }
+ , x //can be accessed via chart.xScale()
+ , y //can be accessed via chart.yScale()
+ , yAxisTickFormat = d3.format(',.2f')
+ , state = { style: stacked.style() }
+ , defaultState = null
+ , noData = 'No Data Available.'
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
+ , controlWidth = 250
+ , cData = ['Stacked','Stream','Expanded']
+ , controlLabels = {}
+ , transitionDuration = 250
+ ;
+
+ xAxis
+ .orient('bottom')
+ .tickPadding(7)
+ ;
+ yAxis
+ .orient((rightAlignYAxis) ? 'right' : 'left')
+ ;
+
+ controls.updateState(false);
+ //============================================================
+
+
+ //============================================================
+ // Private Variables
+ //------------------------------------------------------------
+
+ var showTooltip = function(e, offsetElement) {
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
+ x = xAxis.tickFormat()(stacked.x()(e.point, e.pointIndex)),
+ y = yAxis.tickFormat()(stacked.y()(e.point, e.pointIndex)),
+ content = tooltip(e.series.key, x, y, e, chart);
+
+ nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
+ };
+
+ //============================================================
+
+
+ function chart(selection) {
+ selection.each(function(data) {
+ var container = d3.select(this),
+ that = this;
+
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
+ - margin.left - margin.right,
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+
+ chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
+ chart.container = this;
+
+ //set state.disabled
+ state.disabled = data.map(function(d) { return !!d.disabled });
+
+ if (!defaultState) {
+ var key;
+ defaultState = {};
+ for (key in state) {
+ if (state[key] instanceof Array)
+ defaultState[key] = state[key].slice(0);
+ else
+ defaultState[key] = state[key];
+ }
+ }
+
+ //------------------------------------------------------------
+ // Display No Data message if there's nothing to show.
+
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
+
+ noDataText.enter().append('text')
+ .attr('class', 'nvd3 nv-noData')
+ .attr('dy', '-.7em')
+ .style('text-anchor', 'middle');
+
+ noDataText
+ .attr('x', margin.left + availableWidth / 2)
+ .attr('y', margin.top + availableHeight / 2)
+ .text(function(d) { return d });
+
+ return chart;
+ } else {
+ container.selectAll('.nv-noData').remove();
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Scales
+
+ x = stacked.xScale();
+ y = stacked.yScale();
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup containers and skeleton of chart
+
+ var wrap = container.selectAll('g.nv-wrap.nv-stackedAreaChart').data([data]);
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedAreaChart').append('g');
+ var g = wrap.select('g');
+
+ gEnter.append("rect").style("opacity",0);
+ gEnter.append('g').attr('class', 'nv-x nv-axis');
+ gEnter.append('g').attr('class', 'nv-y nv-axis');
+ gEnter.append('g').attr('class', 'nv-stackedWrap');
+ gEnter.append('g').attr('class', 'nv-legendWrap');
+ gEnter.append('g').attr('class', 'nv-controlsWrap');
+ gEnter.append('g').attr('class', 'nv-interactive');
+
+ g.select("rect").attr("width",availableWidth).attr("height",availableHeight);
+ //------------------------------------------------------------
+ // Legend
+
+ if (showLegend) {
+ var legendWidth = (showControls) ? availableWidth - controlWidth : availableWidth;
+ legend
+ .width(legendWidth);
+
+ g.select('.nv-legendWrap')
+ .datum(data)
+ .call(legend);
+
+ if ( margin.top != legend.height()) {
+ margin.top = legend.height();
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+ g.select('.nv-legendWrap')
+ .attr('transform', 'translate(' + (availableWidth-legendWidth) + ',' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Controls
+
+ if (showControls) {
+ var controlsData = [
+ {
+ key: controlLabels.stacked || 'Stacked',
+ metaKey: 'Stacked',
+ disabled: stacked.style() != 'stack',
+ style: 'stack'
+ },
+ {
+ key: controlLabels.stream || 'Stream',
+ metaKey: 'Stream',
+ disabled: stacked.style() != 'stream',
+ style: 'stream'
+ },
+ {
+ key: controlLabels.expanded || 'Expanded',
+ metaKey: 'Expanded',
+ disabled: stacked.style() != 'expand',
+ style: 'expand'
+ },
+ {
+ key: controlLabels.stack_percent || 'Stack %',
+ metaKey: 'Stack_Percent',
+ disabled: stacked.style() != 'stack_percent',
+ style: 'stack_percent'
+ }
+ ];
+
+ controlWidth = (cData.length/3) * 260;
+
+ controlsData = controlsData.filter(function(d) {
+ return cData.indexOf(d.metaKey) !== -1;
+ })
+
+ controls
+ .width( controlWidth )
+ .color(['#444', '#444', '#444']);
+
+ g.select('.nv-controlsWrap')
+ .datum(controlsData)
+ .call(controls);
+
+
+ if ( margin.top != Math.max(controls.height(), legend.height()) ) {
+ margin.top = Math.max(controls.height(), legend.height());
+ availableHeight = (height || parseInt(container.style('height')) || 400)
+ - margin.top - margin.bottom;
+ }
+
+
+ g.select('.nv-controlsWrap')
+ .attr('transform', 'translate(0,' + (-margin.top) +')');
+ }
+
+ //------------------------------------------------------------
+
+
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
+
+ if (rightAlignYAxis) {
+ g.select(".nv-y.nv-axis")
+ .attr("transform", "translate(" + availableWidth + ",0)");
+ }
+
+ //------------------------------------------------------------
+ // Main Chart Component(s)
+
+ //------------------------------------------------------------
+ //Set up interactive layer
+ if (useInteractiveGuideline) {
+ interactiveLayer
+ .width(availableWidth)
+ .height(availableHeight)
+ .margin({left: margin.left, top: margin.top})
+ .svgContainer(container)
+ .xScale(x);
+ wrap.select(".nv-interactive").call(interactiveLayer);
+ }
+
+ stacked
+ .width(availableWidth)
+ .height(availableHeight)
+
+ var stackedWrap = g.select('.nv-stackedWrap')
+ .datum(data);
+
+ stackedWrap.transition().call(stacked);
+
+ //------------------------------------------------------------
+
+
+ //------------------------------------------------------------
+ // Setup Axes
+
+ if (showXAxis) {
+ xAxis
+ .scale(x)
+ .ticks( availableWidth / 100 )
+ .tickSize( -availableHeight, 0);
+
+ g.select('.nv-x.nv-axis')
+ .attr('transform', 'translate(0,' + availableHeight + ')');
+
+ g.select('.nv-x.nv-axis')
+ .transition().duration(0)
+ .call(xAxis);
+ }
+
+ if (showYAxis) {
+ yAxis
+ .scale(y)
+ .ticks(stacked.offset() == 'wiggle' ? 0 : availableHeight / 36)
+ .tickSize(-availableWidth, 0)
+ .setTickFormat( (stacked.style() == 'expand' || stacked.style() == 'stack_percent')
+ ? d3.format('%') : yAxisTickFormat);
+
+ g.select('.nv-y.nv-axis')
+ .transition().duration(0)
+ .call(yAxis);
+ }
+
+ //------------------------------------------------------------
+
+
+ //============================================================
+ // Event Handling/Dispatching (in chart's scope)
+ //------------------------------------------------------------
+
+ stacked.dispatch.on('areaClick.toggle', function(e) {
+ if (data.filter(function(d) { return !d.disabled }).length === 1)
+ data.forEach(function(d) {
+ d.disabled = false;
+ });
+ else
+ data.forEach(function(d,i) {
+ d.disabled = (i != e.seriesIndex);
+ });
+
+ state.disabled = data.map(function(d) { return !!d.disabled });
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+ legend.dispatch.on('stateChange', function(newState) {
+ state.disabled = newState.disabled;
+ dispatch.stateChange(state);
+ chart.update();
+ });
+
+ controls.dispatch.on('legendClick', function(d,i) {
+ if (!d.disabled) return;
+
+ controlsData = controlsData.map(function(s) {
+ s.disabled = true;
+ return s;
+ });
+ d.disabled = false;
+
+ stacked.style(d.style);
+
+
+ state.style = stacked.style();
+ dispatch.stateChange(state);
+
+ chart.update();
+ });
+
+
+ interactiveLayer.dispatch.on('elementMousemove', function(e) {
+ stacked.clearHighlights();
+ var singlePoint, pointIndex, pointXLocation, allData = [];
+ data
+ .filter(function(series, i) {
+ series.seriesIndex = i;
+ return !series.disabled;
+ })
+ .forEach(function(series,i) {
+ pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x());
+ stacked.highlightPoint(i, pointIndex, true);
+ var point = series.values[pointIndex];
+ if (typeof point === 'undefined') return;
+ if (typeof singlePoint === 'undefined') singlePoint = point;
+ if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex));
+
+ //If we are in 'expand' mode, use the stacked percent value instead of raw value.
+ var tooltipValue = (stacked.style() == 'expand') ? point.display.y : chart.y()(point,pointIndex);
+ allData.push({
+ key: series.key,
+ value: tooltipValue,
+ color: color(series,series.seriesIndex),
+ stackedValue: point.display
+ });
+ });
+
+ allData.reverse();
+
+ //Highlight the tooltip entry based on which stack the mouse is closest to.
+ if (allData.length > 2) {
+ var yValue = chart.yScale().invert(e.mouseY);
+ var yDistMax = Infinity, indexToHighlight = null;
+ allData.forEach(function(series,i) {
+ if ( yValue >= series.stackedValue.y0 && yValue <= (series.stackedValue.y0 + series.stackedValue.y))
+ {
+ indexToHighlight = i;
+ return;
+ }
+ });
+ if (indexToHighlight != null)
+ allData[indexToHighlight].highlight = true;
+ }
+
+ var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));
+
+ //If we are in 'expand' mode, force the format to be a percentage.
+ var valueFormatter = (stacked.style() == 'expand') ?
+ function(d,i) {return d3.format(".1%")(d);} :
+ function(d,i) {return yAxis.tickFormat()(d); };
+ interactiveLayer.tooltip
+ .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
+ .chartContainer(that.parentNode)
+ .enabled(tooltips)
+ .valueFormatter(valueFormatter)
+ .data(
+ {
+ value: xValue,
+ series: allData
+ }
+ )();
+
+ interactiveLayer.renderGuideLine(pointXLocation);
+
+ });
+
+ interactiveLayer.dispatch.on("elementMouseout",function(e) {
+ dispatch.tooltipHide();
+ stacked.clearHighlights();
+ });
+
+
+ dispatch.on('tooltipShow', function(e) {
+ if (tooltips) showTooltip(e, that.parentNode);
+ });
+
+ // Update chart from a state object passed to event handler
+ dispatch.on('changeState', function(e) {
+
+ if (typeof e.disabled !== 'undefined') {
+ data.forEach(function(series,i) {
+ series.disabled = e.disabled[i];
+ });
+
+ state.disabled = e.disabled;
+ }
+
+ if (typeof e.style !== 'undefined') {
+ stacked.style(e.style);
+ }
+
+ chart.update();
+ });
+
+ });
+
+
+ return chart;
+ }
+
+
+ //============================================================
+ // Event Handling/Dispatching (out of chart's scope)
+ //------------------------------------------------------------
+
+ stacked.dispatch.on('tooltipShow', function(e) {
+ //disable tooltips when value ~= 0
+ //// TODO: consider removing points from voronoi that have 0 value instead of this hack
+ /*
+ if (!Math.round(stacked.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
+ setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
+ return false;
+ }
+ */
+
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
+ dispatch.tooltipShow(e);
+ });
+
+ stacked.dispatch.on('tooltipHide', function(e) {
+ dispatch.tooltipHide(e);
+ });
+
+ dispatch.on('tooltipHide', function() {
+ if (tooltips) nv.tooltip.cleanup();
+ });
+
+ //============================================================
+
+
+ //============================================================
+ // Expose Public Variables
+ //------------------------------------------------------------
+
+ // expose chart's sub-components
+ chart.dispatch = dispatch;
+ chart.stacked = stacked;
+ chart.legend = legend;
+ chart.controls = controls;
+ chart.xAxis = xAxis;
+ chart.yAxis = yAxis;
+ chart.interactiveLayer = interactiveLayer;
+
+ d3.rebind(chart, stacked, 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'interactive', 'useVoronoi', 'offset', 'order', 'style', 'clipEdge', 'forceX', 'forceY', 'forceSize', 'interpolate');
+
+ chart.options = nv.utils.optionsFunc.bind(chart);
+
+ chart.margin = function(_) {
+ if (!arguments.length) return margin;
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
+ return chart;
+ };
+
+ chart.width = function(_) {
+ if (!arguments.length) return width;
+ width = _;
+ return chart;
+ };
+
+ chart.height = function(_) {
+ if (!arguments.length) return height;
+ height = _;
+ return chart;
+ };
+
+ chart.color = function(_) {
+ if (!arguments.length) return color;
+ color = nv.utils.getColor(_);
+ legend.color(color);
+ stacked.color(color);
+ return chart;
+ };
+
+ chart.showControls = function(_) {
+ if (!arguments.length) return showControls;
+ showControls = _;
+ return chart;
+ };
+
+ chart.showLegend = function(_) {
+ if (!arguments.length) return showLegend;
+ showLegend = _;
+ return chart;
+ };
+
+ chart.showXAxis = function(_) {
+ if (!arguments.length) return showXAxis;
+ showXAxis = _;
+ return chart;
+ };
+
+ chart.showYAxis = function(_) {
+ if (!arguments.length) return showYAxis;
+ showYAxis = _;
+ return chart;
+ };
+
+ chart.rightAlignYAxis = function(_) {
+ if(!arguments.length) return rightAlignYAxis;
+ rightAlignYAxis = _;
+ yAxis.orient( (_) ? 'right' : 'left');
+ return chart;
+ };
+
+ chart.useInteractiveGuideline = function(_) {
+ if(!arguments.length) return useInteractiveGuideline;
+ useInteractiveGuideline = _;
+ if (_ === true) {
+ chart.interactive(false);
+ chart.useVoronoi(false);
+ }
+ return chart;
+ };
+
+ chart.tooltip = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.tooltips = function(_) {
+ if (!arguments.length) return tooltips;
+ tooltips = _;
+ return chart;
+ };
+
+ chart.tooltipContent = function(_) {
+ if (!arguments.length) return tooltip;
+ tooltip = _;
+ return chart;
+ };
+
+ chart.state = function(_) {
+ if (!arguments.length) return state;
+ state = _;
+ return chart;
+ };
+
+ chart.defaultState = function(_) {
+ if (!arguments.length) return defaultState;
+ defaultState = _;
+ return chart;
+ };
+
+ chart.noData = function(_) {
+ if (!arguments.length) return noData;
+ noData = _;
+ return chart;
+ };
+
+ chart.transitionDuration = function(_) {
+ if (!arguments.length) return transitionDuration;
+ transitionDuration = _;
+ return chart;
+ };
+
+ chart.controlsData = function(_) {
+ if (!arguments.length) return cData;
+ cData = _;
+ return chart;
+ };
+
+ chart.controlLabels = function(_) {
+ if (!arguments.length) return controlLabels;
+ if (typeof _ !== 'object') return controlLabels;
+ controlLabels = _;
+ return chart;
+ };
+
+ yAxis.setTickFormat = yAxis.tickFormat;
+
+ yAxis.tickFormat = function(_) {
+ if (!arguments.length) return yAxisTickFormat;
+ yAxisTickFormat = _;
+ return yAxis;
+ };
+
+
+ //============================================================
+
+ return chart;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/nv.d3.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/nv.d3.min.js
new file mode 100644
index 00000000..892379c4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/nv.d3.min.js
@@ -0,0 +1 @@
+(function(){function t(e,t){return(new Date(t,e+1,0)).getDate()}function n(e,t,n){return function(r,i,s){var o=e(r),u=[];if(o<r)t(o);if(s>1){while(o<i){var a=new Date(+o);if(n(a)%s===0)u.push(a);t(o)}}else{while(o<i){u.push(new Date(+o));t(o)}}return u}}var e=window.nv||{};e.version="1.1.13b";e.dev=true;window.nv=e;e.tooltip={};e.utils=e.utils||{};e.models={};e.charts={};e.graphs=[];e.logs={};e.dispatch=d3.dispatch("render_start","render_end");if(e.dev){e.dispatch.on("render_start",function(t){e.logs.startTime=+(new Date)});e.dispatch.on("render_end",function(t){e.logs.endTime=+(new Date);e.logs.totalTime=e.logs.endTime-e.logs.startTime;e.log("total",e.logs.totalTime)})}e.log=function(){if(e.dev&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(e.dev&&typeof console.log=="function"&&Function.prototype.bind){var t=Function.prototype.bind.call(console.log,console);t.apply(console,arguments)}return arguments[arguments.length-1]};e.render=function(n){n=n||1;e.render.active=true;e.dispatch.render_start();setTimeout(function(){var t,r;for(var i=0;i<n&&(r=e.render.queue[i]);i++){t=r.generate();if(typeof r.callback==typeof Function)r.callback(t);e.graphs.push(t)}e.render.queue.splice(0,i);if(e.render.queue.length)setTimeout(arguments.callee,0);else{e.render.active=false;e.dispatch.render_end()}},0)};e.render.active=false;e.render.queue=[];e.addGraph=function(t){if(typeof arguments[0]===typeof Function)t={generate:arguments[0],callback:arguments[1]};e.render.queue.push(t);if(!e.render.active)e.render()};e.identity=function(e){return e};e.strip=function(e){return e.replace(/(\s|&)/g,"")};d3.time.monthEnd=function(e){return new Date(e.getFullYear(),e.getMonth(),0)};d3.time.monthEnds=n(d3.time.monthEnd,function(e){e.setUTCDate(e.getUTCDate()+1);e.setDate(t(e.getMonth()+1,e.getFullYear()))},function(e){return e.getMonth()});e.interactiveGuideline=function(){"use strict";function c(o){o.each(function(o){function g(){var e=d3.mouse(this);var n=e[0];var r=e[1];var o=true;var a=false;if(l){n=d3.event.offsetX;r=d3.event.offsetY;if(d3.event.target.tagName!=="svg")o=false;if(d3.event.target.className.baseVal.match("nv-legend"))a=true}if(o){n-=i.left;r-=i.top}if(n<0||r<0||n>p||r>d||d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined||a){if(l){if(d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined&&d3.event.relatedTarget.className.match(t.nvPointerEventsClass)){return}}u.elementMouseout({mouseX:n,mouseY:r});c.renderGuideLine(null);return}var f=s.invert(n);u.elementMousemove({mouseX:n,mouseY:r,pointXValue:f});if(d3.event.type==="dblclick"){u.elementDblclick({mouseX:n,mouseY:r,pointXValue:f})}}var h=d3.select(this);var p=n||960,d=r||400;var v=h.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([o]);var m=v.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");m.append("g").attr("class","nv-interactiveGuideLine");if(!f){return}f.on("mousemove",g,true).on("mouseout",g,true).on("dblclick",g);c.renderGuideLine=function(t){if(!a)return;var n=v.select(".nv-interactiveGuideLine").selectAll("line").data(t!=null?[e.utils.NaNtoZero(t)]:[],String);n.enter().append("line").attr("class","nv-guideline").attr("x1",function(e){return e}).attr("x2",function(e){return e}).attr("y1",d).attr("y2",0);n.exit().remove()}})}var t=e.models.tooltip();var n=null,r=null,i={left:0,top:0},s=d3.scale.linear(),o=d3.scale.linear(),u=d3.dispatch("elementMousemove","elementMouseout","elementDblclick"),a=true,f=null;var l=navigator.userAgent.indexOf("MSIE")!==-1;c.dispatch=u;c.tooltip=t;c.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.left=typeof e.left!="undefined"?e.left:i.left;return c};c.width=function(e){if(!arguments.length)return n;n=e;return c};c.height=function(e){if(!arguments.length)return r;r=e;return c};c.xScale=function(e){if(!arguments.length)return s;s=e;return c};c.showGuideLine=function(e){if(!arguments.length)return a;a=e;return c};c.svgContainer=function(e){if(!arguments.length)return f;f=e;return c};return c};e.interactiveBisect=function(e,t,n){"use strict";if(!e instanceof Array)return null;if(typeof n!=="function")n=function(e,t){return e.x};var r=d3.bisector(n).left;var i=d3.max([0,r(e,t)-1]);var s=n(e[i],i);if(typeof s==="undefined")s=i;if(s===t)return i;var o=d3.min([i+1,e.length-1]);var u=n(e[o],o);if(typeof u==="undefined")u=o;if(Math.abs(u-t)>=Math.abs(s-t))return i;else return o};e.nearestValueIndex=function(e,t,n){"use strict";var r=Infinity,i=null;e.forEach(function(e,s){var o=Math.abs(t-e);if(o<=r&&o<n){r=o;i=s}});return i};(function(){"use strict";window.nv.tooltip={};window.nv.models.tooltip=function(){function y(){if(a){var e=d3.select(a);if(e.node().tagName!=="svg"){e=e.select("svg")}var t=e.node()?e.attr("viewBox"):null;if(t){t=t.split(" ");var n=parseInt(e.style("width"))/t[2];l.left=l.left*n;l.top=l.top*n}}}function b(e){var t;if(a)t=d3.select(a);else t=d3.select("body");var n=t.select(".nvtooltip");if(n.node()===null){n=t.append("div").attr("class","nvtooltip "+(u?u:"xy-tooltip")).attr("id",h)}n.node().innerHTML=e;n.style("top",0).style("left",0).style("opacity",0);n.selectAll("div, table, td, tr").classed(p,true);n.classed(p,true);return n.node()}function w(){if(!c)return;if(!g(n))return;y();var t=l.left;var u=o!=null?o:l.top;var h=b(m(n));f=h;if(a){var p=a.getElementsByTagName("svg")[0];var d=p?p.getBoundingClientRect():a.getBoundingClientRect();var v={left:0,top:0};if(p){var E=p.getBoundingClientRect();var S=a.getBoundingClientRect();var x=E.top;if(x<0){var T=a.getBoundingClientRect();x=Math.abs(x)>T.height?0:x}v.top=Math.abs(x-S.top);v.left=Math.abs(E.left-S.left)}t+=a.offsetLeft+v.left-2*a.scrollLeft;u+=a.offsetTop+v.top-2*a.scrollTop}if(s&&s>0){u=Math.floor(u/s)*s}e.tooltip.calcTooltipPosition([t,u],r,i,h);return w}var t=null,n=null,r="w",i=50,s=25,o=null,u=null,a=null,f=null,l={left:null,top:null},c=true,h="nvtooltip-"+Math.floor(Math.random()*1e5);var p="nv-pointer-events-none";var d=function(e,t){return e};var v=function(e){return e};var m=function(e){if(t!=null)return t;if(e==null)return"";var n=d3.select(document.createElement("table"));var r=n.selectAll("thead").data([e]).enter().append("thead");r.append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",true).html(v(e.value));var i=n.selectAll("tbody").data([e]).enter().append("tbody");var s=i.selectAll("tr").data(function(e){return e.series}).enter().append("tr").classed("highlight",function(e){return e.highlight});s.append("td").classed("legend-color-guide",true).append("div").style("background-color",function(e){return e.color});s.append("td").classed("key",true).html(function(e){return e.key});s.append("td").classed("value",true).html(function(e,t){return d(e.value,t)});s.selectAll("td").each(function(e){if(e.highlight){var t=d3.scale.linear().domain([0,1]).range(["#fff",e.color]);var n=.6;d3.select(this).style("border-bottom-color",t(n)).style("border-top-color",t(n))}});var o=n.node().outerHTML;if(e.footer!==undefined)o+="<div class='footer'>"+e.footer+"</div>";return o};var g=function(e){if(e&&e.series&&e.series.length>0)return true;return false};w.nvPointerEventsClass=p;w.content=function(e){if(!arguments.length)return t;t=e;return w};w.tooltipElem=function(){return f};w.contentGenerator=function(e){if(!arguments.length)return m;if(typeof e==="function"){m=e}return w};w.data=function(e){if(!arguments.length)return n;n=e;return w};w.gravity=function(e){if(!arguments.length)return r;r=e;return w};w.distance=function(e){if(!arguments.length)return i;i=e;return w};w.snapDistance=function(e){if(!arguments.length)return s;s=e;return w};w.classes=function(e){if(!arguments.length)return u;u=e;return w};w.chartContainer=function(e){if(!arguments.length)return a;a=e;return w};w.position=function(e){if(!arguments.length)return l;l.left=typeof e.left!=="undefined"?e.left:l.left;l.top=typeof e.top!=="undefined"?e.top:l.top;return w};w.fixedTop=function(e){if(!arguments.length)return o;o=e;return w};w.enabled=function(e){if(!arguments.length)return c;c=e;return w};w.valueFormatter=function(e){if(!arguments.length)return d;if(typeof e==="function"){d=e}return w};w.headerFormatter=function(e){if(!arguments.length)return v;if(typeof e==="function"){v=e}return w};w.id=function(){return h};return w};e.tooltip.show=function(t,n,r,i,s,o){var u=document.createElement("div");u.className="nvtooltip "+(o?o:"xy-tooltip");var a=s;if(!s||s.tagName.match(/g|svg/i)){a=document.getElementsByTagName("body")[0]}u.style.left=0;u.style.top=0;u.style.opacity=0;u.innerHTML=n;a.appendChild(u);if(s){t[0]=t[0]-s.scrollLeft;t[1]=t[1]-s.scrollTop}e.tooltip.calcTooltipPosition(t,r,i,u)};e.tooltip.findFirstNonSVGParent=function(e){while(e.tagName.match(/^g|svg$/i)!==null){e=e.parentNode}return e};e.tooltip.findTotalOffsetTop=function(e,t){var n=t;do{if(!isNaN(e.offsetTop)){n+=e.offsetTop}}while(e=e.offsetParent);return n};e.tooltip.findTotalOffsetLeft=function(e,t){var n=t;do{if(!isNaN(e.offsetLeft)){n+=e.offsetLeft}}while(e=e.offsetParent);return n};e.tooltip.calcTooltipPosition=function(t,n,r,i){var s=parseInt(i.offsetHeight),o=parseInt(i.offsetWidth),u=e.utils.windowSize().width,a=e.utils.windowSize().height,f=window.pageYOffset,l=window.pageXOffset,c,h;a=window.innerWidth>=document.body.scrollWidth?a:a-16;u=window.innerHeight>=document.body.scrollHeight?u:u-16;n=n||"s";r=r||20;var p=function(t){return e.tooltip.findTotalOffsetTop(t,h)};var d=function(t){return e.tooltip.findTotalOffsetLeft(t,c)};switch(n){case"e":c=t[0]-o-r;h=t[1]-s/2;var v=d(i);var m=p(i);if(v<l)c=t[0]+r>l?t[0]+r:l-v+c;if(m<f)h=f-m+h;if(m+s>f+a)h=f+a-m+h-s;break;case"w":c=t[0]+r;h=t[1]-s/2;var v=d(i);var m=p(i);if(v+o>u)c=t[0]-o-r;if(m<f)h=f+5;if(m+s>f+a)h=f+a-m+h-s;break;case"n":c=t[0]-o/2-5;h=t[1]+r;var v=d(i);var m=p(i);if(v<l)c=l+5;if(v+o>u)c=c-o/2+5;if(m+s>f+a)h=f+a-m+h-s;break;case"s":c=t[0]-o/2;h=t[1]-s-r;var v=d(i);var m=p(i);if(v<l)c=l+5;if(v+o>u)c=c-o/2+5;if(f>m)h=f;break;case"none":c=t[0];h=t[1]-r;var v=d(i);var m=p(i);break}i.style.left=c+"px";i.style.top=h+"px";i.style.opacity=1;i.style.position="absolute";return i};e.tooltip.cleanup=function(){var e=document.getElementsByClassName("nvtooltip");var t=[];while(e.length){t.push(e[0]);e[0].style.transitionDelay="0 !important";e[0].style.opacity=0;e[0].className="nvtooltip-pending-removal"}setTimeout(function(){while(t.length){var e=t.pop();e.parentNode.removeChild(e)}},500)}})();e.utils.windowSize=function(){var e={width:640,height:480};if(document.body&&document.body.offsetWidth){e.width=document.body.offsetWidth;e.height=document.body.offsetHeight}if(document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth){e.width=document.documentElement.offsetWidth;e.height=document.documentElement.offsetHeight}if(window.innerWidth&&window.innerHeight){e.width=window.innerWidth;e.height=window.innerHeight}return e};e.utils.windowResize=function(e){if(e===undefined)return;var t=window.onresize;window.onresize=function(n){if(typeof t=="function")t(n);e(n)}};e.utils.getColor=function(t){if(!arguments.length)return e.utils.defaultColor();if(Object.prototype.toString.call(t)==="[object Array]")return function(e,n){return e.color||t[n%t.length]};else return t};e.utils.defaultColor=function(){var e=d3.scale.category20().range();return function(t,n){return t.color||e[n%e.length]}};e.utils.customTheme=function(e,t,n){t=t||function(e){return e.key};n=n||d3.scale.category20().range();var r=n.length;return function(i,s){var o=t(i);if(!r)r=n.length;if(typeof e[o]!=="undefined")return typeof e[o]==="function"?e[o]():e[o];else return n[--r]}};e.utils.pjax=function(t,n){function r(r){d3.html(r,function(r){var i=d3.select(n).node();i.parentNode.replaceChild(d3.select(r).select(n).node(),i);e.utils.pjax(t,n)})}d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href);r(this.href);d3.event.preventDefault()});d3.select(window).on("popstate",function(){if(d3.event.state)r(d3.event.state)})};e.utils.calcApproxTextWidth=function(e){if(e instanceof d3.selection){var t=parseInt(e.style("font-size").replace("px",""));var n=e.text().length;return n*t*.5}return 0};e.utils.NaNtoZero=function(e){if(typeof e!=="number"||isNaN(e)||e===null||e===Infinity)return 0;return e};e.utils.optionsFunc=function(e){if(e){d3.map(e).forEach(function(e,t){if(typeof this[e]==="function"){this[e](t)}}.bind(this))}return this};e.models.axis=function(){"use strict";function g(e){e.each(function(e){var i=d3.select(this);var g=i.selectAll("g.nv-wrap.nv-axis").data([e]);var y=g.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");var b=y.append("g");var w=g.select("g");if(p!==null)t.ticks(p);else if(t.orient()=="top"||t.orient()=="bottom")t.ticks(Math.abs(s.range()[1]-s.range()[0])/100);w.transition().call(t);m=m||t.scale();var E=t.tickFormat();if(E==null){E=m.tickFormat()}var S=w.selectAll("text.nv-axislabel").data([o||null]);S.exit().remove();switch(t.orient()){case"top":S.enter().append("text").attr("class","nv-axislabel");var x=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);S.attr("text-anchor","middle").attr("y",0).attr("x",x/2);if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+s(e)+",0)"}).select("text").attr("dy","0em").attr("y",-t.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+s.range()[t]+",0)"})}break;case"bottom":var N=36;var C=30;var k=w.selectAll("g").select("text");if(f%360){k.each(function(e,t){var n=this.getBBox().width;if(n>C)C=n});var L=Math.abs(Math.sin(f*Math.PI/180));var N=(L?L*C:C)+30;k.attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f%360>0?"start":"end")}S.enter().append("text").attr("class","nv-axislabel");var x=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);S.attr("text-anchor","middle").attr("y",N).attr("x",x/2);if(u){var T=g.selectAll("g.nv-axisMaxMin").data([s.domain()[0],s.domain()[s.domain().length-1]]);T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",t.tickPadding()).attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f?f%360>0?"start":"end":"middle").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"})}if(c)k.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",l?"middle":"begin").attr("transform",l?"rotate(90)":"").attr("y",l?-Math.max(n.right,r)+12:-10).attr("x",l?s.range()[0]/2:t.tickPadding());if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+s(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",t.tickPadding()).style("text-anchor","start").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",l?"middle":"end").attr("transform",l?"rotate(-90)":"").attr("y",l?-Math.max(n.left,r)+v:-10).attr("x",l?-s.range()[0]/2:-t.tickPadding());if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+m(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-t.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break}S.text(function(e){return e});if(u&&(t.orient()==="left"||t.orient()==="right")){w.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);var n;if(d){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(s(e)<s.range()[1]+10||s(e)>s.range()[0]-10){if(e>1e-10||e<-1e-10)d3.select(this).attr("opacity",0);d3.select(this).select("text").attr("opacity",0)}});if(s.domain()[0]==s.domain()[1]&&s.domain()[0]==0)g.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return!t?1:0})}if(u&&(t.orient()==="top"||t.orient()==="bottom")){var A=[];g.selectAll("g.nv-axisMaxMin").each(function(e,t){try{if(t)A.push(s(e)-this.getBBox().width-4);else A.push(s(e)+this.getBBox().width+4)}catch(n){if(t)A.push(s(e)-4);else A.push(s(e)+4)}});w.selectAll("g").each(function(e,t){var n;if(d){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(s(e)<A[0]||s(e)>A[1]){if(e>1e-10||e<-1e-10)d3.select(this).remove();else d3.select(this).select("text").remove()}})}if(a)w.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",true);m=s.copy()});return g}var t=d3.svg.axis();var n={top:0,right:0,bottom:0,left:0},r=75,i=60,s=d3.scale.linear(),o=null,u=true,a=true,f=0,l=true,c=false,h=false,p=null,d=false,v=12;t.scale(s).orient("bottom").tickFormat(function(e){return e});var m;g.axis=t;d3.rebind(g,t,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat");d3.rebind(g,s,"domain","range","rangeBand","rangeBands");g.options=e.utils.optionsFunc.bind(g);g.margin=function(e){if(!arguments.length)return n;n.top=typeof e.top!="undefined"?e.top:n.top;n.right=typeof e.right!="undefined"?e.right:n.right;n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom;n.left=typeof e.left!="undefined"?e.left:n.left;return g};g.width=function(e){if(!arguments.length)return r;r=e;return g};g.ticks=function(e){if(!arguments.length)return p;p=e;return g};g.height=function(e){if(!arguments.length)return i;i=e;return g};g.axisLabel=function(e){if(!arguments.length)return o;o=e;return g};g.showMaxMin=function(e){if(!arguments.length)return u;u=e;return g};g.logScale=function(e){if(!arguments.length)return d;d=e;return g};g.highlightZero=function(e){if(!arguments.length)return a;a=e;return g};g.scale=function(e){if(!arguments.length)return s;s=e;t.scale(s);h=typeof s.rangeBands==="function";d3.rebind(g,s,"domain","range","rangeBand","rangeBands");return g};g.rotateYLabel=function(e){if(!arguments.length)return l;l=e;return g};g.rotateLabels=function(e){if(!arguments.length)return f;f=e;return g};g.staggerLabels=function(e){if(!arguments.length)return c;c=e;return g};g.axisLabelDistance=function(e){if(!arguments.length)return v;v=e;return g};return g};e.models.bullet=function(){"use strict";function m(e){e.each(function(e,n){var p=c-t.left-t.right,m=h-t.top-t.bottom,g=d3.select(this);var y=i.call(this,e,n).slice().sort(d3.descending),b=s.call(this,e,n).slice().sort(d3.descending),w=o.call(this,e,n).slice().sort(d3.descending),E=u.call(this,e,n).slice(),S=a.call(this,e,n).slice(),x=f.call(this,e,n).slice();var T=d3.scale.linear().domain(d3.extent(d3.merge([l,y]))).range(r?[p,0]:[0,p]);var N=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(T.range());this.__chart__=T;var C=d3.min(y),k=d3.max(y),L=y[1];var A=g.selectAll("g.nv-wrap.nv-bullet").data([e]);var O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet");var M=O.append("g");var _=A.select("g");M.append("rect").attr("class","nv-range nv-rangeMax");M.append("rect").attr("class","nv-range nv-rangeAvg");M.append("rect").attr("class","nv-range nv-rangeMin");M.append("rect").attr("class","nv-measure");M.append("path").attr("class","nv-markerTriangle");A.attr("transform","translate("+t.left+","+t.top+")");var D=function(e){return Math.abs(N(e)-N(0))},P=function(e){return Math.abs(T(e)-T(0))};var H=function(e){return e<0?N(e):N(0)},B=function(e){return e<0?T(e):T(0)};_.select("rect.nv-rangeMax").attr("height",m).attr("width",P(k>0?k:C)).attr("x",B(k>0?k:C)).datum(k>0?k:C);_.select("rect.nv-rangeAvg").attr("height",m).attr("width",P(L)).attr("x",B(L)).datum(L);_.select("rect.nv-rangeMin").attr("height",m).attr("width",P(k)).attr("x",B(k)).attr("width",P(k>0?C:k)).attr("x",B(k>0?C:k)).datum(k>0?C:k);_.select("rect.nv-measure").style("fill",d).attr("height",m/3).attr("y",m/3).attr("width",w<0?T(0)-T(w[0]):T(w[0])-T(0)).attr("x",B(w)).on("mouseover",function(){v.elementMouseover({value:w[0],label:x[0]||"Current",pos:[T(w[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:w[0],label:x[0]||"Current"})});var j=m/6;if(b[0]){_.selectAll("path.nv-markerTriangle").attr("transform",function(e){return"translate("+T(b[0])+","+m/2+")"}).attr("d","M0,"+j+"L"+j+","+ -j+" "+ -j+","+ -j+"Z").on("mouseover",function(){v.elementMouseover({value:b[0],label:S[0]||"Previous",pos:[T(b[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:b[0],label:S[0]||"Previous"})})}else{_.selectAll("path.nv-markerTriangle").remove()}A.selectAll(".nv-range").on("mouseover",function(e,t){var n=E[t]||(!t?"Maximum":t==1?"Mean":"Minimum");v.elementMouseover({value:e,label:n,pos:[T(e),m/2]})}).on("mouseout",function(e,t){var n=E[t]||(!t?"Maximum":t==1?"Mean":"Minimum");v.elementMouseout({value:e,label:n})})});return m}var t={top:0,right:0,bottom:0,left:0},n="left",r=false,i=function(e){return e.ranges},s=function(e){return e.markers},o=function(e){return e.measures},u=function(e){return e.rangeLabels?e.rangeLabels:[]},a=function(e){return e.markerLabels?e.markerLabels:[]},f=function(e){return e.measureLabels?e.measureLabels:[]},l=[0],c=380,h=30,p=null,d=e.utils.getColor(["#1f77b4"]),v=d3.dispatch("elementMouseover","elementMouseout");m.dispatch=v;m.options=e.utils.optionsFunc.bind(m);m.orient=function(e){if(!arguments.length)return n;n=e;r=n=="right"||n=="bottom";return m};m.ranges=function(e){if(!arguments.length)return i;i=e;return m};m.markers=function(e){if(!arguments.length)return s;s=e;return m};m.measures=function(e){if(!arguments.length)return o;o=e;return m};m.forceX=function(e){if(!arguments.length)return l;l=e;return m};m.width=function(e){if(!arguments.length)return c;c=e;return m};m.height=function(e){if(!arguments.length)return h;h=e;return m};m.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return m};m.tickFormat=function(e){if(!arguments.length)return p;p=e;return m};m.color=function(t){if(!arguments.length)return d;d=e.utils.getColor(t);return m};return m};e.models.bulletChart=function(){"use strict";function m(e){e.each(function(n,h){var g=d3.select(this);var y=(a||parseInt(g.style("width"))||960)-i.left-i.right,b=f-i.top-i.bottom,w=this;m.update=function(){m(e)};m.container=this;if(!n||!s.call(this,n,h)){var E=g.selectAll(".nv-noData").data([p]);E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");E.attr("x",i.left+y/2).attr("y",18+i.top+b/2).text(function(e){return e});return m}else{g.selectAll(".nv-noData").remove()}var S=s.call(this,n,h).slice().sort(d3.descending),x=o.call(this,n,h).slice().sort(d3.descending),T=u.call(this,n,h).slice().sort(d3.descending);var N=g.selectAll("g.nv-wrap.nv-bulletChart").data([n]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart");var k=C.append("g");var L=N.select("g");k.append("g").attr("class","nv-bulletWrap");k.append("g").attr("class","nv-titles");N.attr("transform","translate("+i.left+","+i.top+")");var A=d3.scale.linear().domain([0,Math.max(S[0],x[0],T[0])]).range(r?[y,0]:[0,y]);var O=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(A.range());this.__chart__=A;var M=function(e){return Math.abs(O(e)-O(0))},_=function(e){return Math.abs(A(e)-A(0))};var D=k.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(f-i.top-i.bottom)/2+")");D.append("text").attr("class","nv-title").text(function(e){return e.title});D.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(e){return e.subtitle});t.width(y).height(b);var P=L.select(".nv-bulletWrap");d3.transition(P).call(t);var H=l||A.tickFormat(y/100);var B=L.selectAll("g.nv-tick").data(A.ticks(y/50),function(e){return this.textContent||H(e)});var j=B.enter().append("g").attr("class","nv-tick").attr("transform",function(e){return"translate("+O(e)+",0)"}).style("opacity",1e-6);j.append("line").attr("y1",b).attr("y2",b*7/6);j.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",b*7/6).text(H);var F=d3.transition(B).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1);F.select("line").attr("y1",b).attr("y2",b*7/6);F.select("text").attr("y",b*7/6);d3.transition(B.exit()).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1e-6).remove();d.on("tooltipShow",function(e){e.key=n.title;if(c)v(e,w.parentNode)})});d3.timer.flush();return m}var t=e.models.bullet();var n="left",r=false,i={top:5,right:40,bottom:20,left:120},s=function(e){return e.ranges},o=function(e){return e.markers},u=function(e){return e.measures},a=null,f=55,l=null,c=true,h=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},p="No Data Available.",d=d3.dispatch("tooltipShow","tooltipHide");var v=function(t,n){var r=t.pos[0]+(n.offsetLeft||0)+i.left,s=t.pos[1]+(n.offsetTop||0)+i.top,o=h(t.key,t.label,t.value,t,m);e.tooltip.show([r,s],o,t.value<0?"e":"w",null,n)};t.dispatch.on("elementMouseover.tooltip",function(e){d.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){d.tooltipHide(e)});d.on("tooltipHide",function(){if(c)e.tooltip.cleanup()});m.dispatch=d;m.bullet=t;d3.rebind(m,t,"color");m.options=e.utils.optionsFunc.bind(m);m.orient=function(e){if(!arguments.length)return n;n=e;r=n=="right"||n=="bottom";return m};m.ranges=function(e){if(!arguments.length)return s;s=e;return m};m.markers=function(e){if(!arguments.length)return o;o=e;return m};m.measures=function(e){if(!arguments.length)return u;u=e;return m};m.width=function(e){if(!arguments.length)return a;a=e;return m};m.height=function(e){if(!arguments.length)return f;f=e;return m};m.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.right=typeof e.right!="undefined"?e.right:i.right;i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom;i.left=typeof e.left!="undefined"?e.left:i.left;return m};m.tickFormat=function(e){if(!arguments.length)return l;l=e;return m};m.tooltips=function(e){if(!arguments.length)return c;c=e;return m};m.tooltipContent=function(e){if(!arguments.length)return h;h=e;return m};m.noData=function(e){if(!arguments.length)return p;p=e;return m};return m};e.models.cumulativeLineChart=function(){"use strict";function _(b){b.each(function(b){function q(e,t){d3.select(_.container).style("cursor","ew-resize")}function R(e,t){O.x=d3.event.x;O.i=Math.round(A.invert(O.x));rt()}function U(e,t){d3.select(_.container).style("cursor","auto");x.index=O.i;k.stateChange(x)}function rt(){nt.data([O]);var e=_.transitionDuration();_.transitionDuration(0);_.update();_.transitionDuration(e)}var P=d3.select(this).classed("nv-chart-"+S,true),H=this;var B=(f||parseInt(P.style("width"))||960)-u.left-u.right,j=(l||parseInt(P.style("height"))||400)-u.top-u.bottom;_.update=function(){P.transition().duration(L).call(_)};_.container=this;x.disabled=b.map(function(e){return!!e.disabled});if(!T){var F;T={};for(F in x){if(x[F]instanceof Array)T[F]=x[F].slice(0);else T[F]=x[F]}}var I=d3.behavior.drag().on("dragstart",q).on("drag",R).on("dragend",U);if(!b||!b.length||!b.filter(function(e){return e.values.length}).length){var z=P.selectAll(".nv-noData").data([N]);z.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");z.attr("x",u.left+B/2).attr("y",u.top+j/2).text(function(e){return e});return _}else{P.selectAll(".nv-noData").remove()}w=t.xScale();E=t.yScale();if(!y){var W=b.filter(function(e){return!e.disabled}).map(function(e,n){var r=d3.extent(e.values,t.y());if(r[0]<-.95)r[0]=-.95;return[(r[0]-r[1])/(1+r[1]),(r[1]-r[0])/(1+r[0])]});var X=[d3.min(W,function(e){return e[0]}),d3.max(W,function(e){return e[1]})];t.yDomain(X)}else{t.yDomain(null)}A.domain([0,b[0].values.length-1]).range([0,B]).clamp(true);var b=D(O.i,b);var V=g?"none":"all";var $=P.selectAll("g.nv-wrap.nv-cumulativeLine").data([b]);var J=$.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g");var K=$.select("g");J.append("g").attr("class","nv-interactive");J.append("g").attr("class","nv-x nv-axis").style("pointer-events","none");J.append("g").attr("class","nv-y nv-axis");J.append("g").attr("class","nv-background");J.append("g").attr("class","nv-linesWrap").style("pointer-events",V);J.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none");J.append("g").attr("class","nv-legendWrap");J.append("g").attr("class","nv-controlsWrap");if(c){i.width(B);K.select(".nv-legendWrap").datum(b).call(i);if(u.top!=i.height()){u.top=i.height();j=(l||parseInt(P.style("height"))||400)-u.top-u.bottom}K.select(".nv-legendWrap").attr("transform","translate(0,"+ -u.top+")")}if(m){var Q=[{key:"Re-scale y-axis",disabled:!y}];s.width(140).color(["#444","#444","#444"]);K.select(".nv-controlsWrap").datum(Q).attr("transform","translate(0,"+ -u.top+")").call(s)}$.attr("transform","translate("+u.left+","+u.top+")");if(d){K.select(".nv-y.nv-axis").attr("transform","translate("+B+",0)")}var G=b.filter(function(e){return e.tempDisabled});$.select(".tempDisabled").remove();if(G.length){$.append("text").attr("class","tempDisabled").attr("x",B/2).attr("y","-.71em").style("text-anchor","end").text(G.map(function(e){return e.key}).join(", ")+" values cannot be calculated for this time period.")}if(g){o.width(B).height(j).margin({left:u.left,top:u.top}).svgContainer(P).xScale(w);$.select(".nv-interactive").call(o)}J.select(".nv-background").append("rect");K.select(".nv-background rect").attr("width",B).attr("height",j);t.y(function(e){return e.display.y}).width(B).height(j).color(b.map(function(e,t){return e.color||a(e,t)}).filter(function(e,t){return!b[t].disabled&&!b[t].tempDisabled}));var Y=K.select(".nv-linesWrap").datum(b.filter(function(e){return!e.disabled&&!e.tempDisabled}));Y.call(t);b.forEach(function(e,t){e.seriesIndex=t});var Z=b.filter(function(e){return!e.disabled&&!!C(e)});var et=K.select(".nv-avgLinesWrap").selectAll("line").data(Z,function(e){return e.key});var tt=function(e){var t=E(C(e));if(t<0)return 0;if(t>j)return j;return t};et.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(e,n){return t.color()(e,e.seriesIndex)}).attr("x1",0).attr("x2",B).attr("y1",tt).attr("y2",tt);et.style("stroke-opacity",function(e){var t=E(C(e));if(t<0||t>j)return 0;return 1}).attr("x1",0).attr("x2",B).attr("y1",tt).attr("y2",tt);et.exit().remove();var nt=Y.selectAll(".nv-indexLine").data([O]);nt.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(I);nt.attr("transform",function(e){return"translate("+A(e.i)+",0)"}).attr("height",j);if(h){n.scale(w).ticks(Math.min(b[0].values.length,B/70)).tickSize(-j,0);K.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")");d3.transition(K.select(".nv-x.nv-axis")).call(n)}if(p){r.scale(E).ticks(j/36).tickSize(-B,0);d3.transition(K.select(".nv-y.nv-axis")).call(r)}K.select(".nv-background rect").on("click",function(){O.x=d3.mouse(this)[0];O.i=Math.round(A.invert(O.x));x.index=O.i;k.stateChange(x);rt()});t.dispatch.on("elementClick",function(e){O.i=e.pointIndex;O.x=A(O.i);x.index=O.i;k.stateChange(x);rt()});s.dispatch.on("legendClick",function(e,t){e.disabled=!e.disabled;y=!e.disabled;x.rescaleY=y;k.stateChange(x);_.update()});i.dispatch.on("stateChange",function(e){x.disabled=e.disabled;k.stateChange(x);_.update()});o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,f,l,c=[];b.filter(function(e,t){e.seriesIndex=t;return!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,_.x());t.highlightPoint(r,f,true);var o=n.values[f];if(typeof o==="undefined")return;if(typeof s==="undefined")s=o;if(typeof l==="undefined")l=_.xScale()(_.x()(o,f));c.push({key:n.key,value:_.y()(o,f),color:a(n,n.seriesIndex)})});if(c.length>2){var h=_.yScale().invert(i.mouseY);var p=Math.abs(_.yScale().domain()[0]-_.yScale().domain()[1]);var d=.03*p;var m=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);if(m!==null)c[m].highlight=true}var g=n.tickFormat()(_.x()(s,f),f);o.tooltip.position({left:l+u.left,top:i.mouseY+u.top}).chartContainer(H.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:g,series:c})();o.renderGuideLine(l)});o.dispatch.on("elementMouseout",function(e){k.tooltipHide();t.clearHighlights()});k.on("tooltipShow",function(e){if(v)M(e,H.parentNode)});k.on("changeState",function(e){if(typeof e.disabled!=="undefined"){b.forEach(function(t,n){t.disabled=e.disabled[n]});x.disabled=e.disabled}if(typeof e.index!=="undefined"){O.i=e.index;O.x=A(O.i);x.index=e.index;nt.data([O])}if(typeof e.rescaleY!=="undefined"){y=e.rescaleY}_.update()})});return _}function D(e,n){return n.map(function(n,r){if(!n.values){return n}var i=t.y()(n.values[e],e);if(i<-.95){n.tempDisabled=true;return n}n.tempDisabled=false;n.values=n.values.map(function(e,n){e.display={y:(t.y()(e,n)-i)/(1+i)};return e});return n})}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline();var u={top:30,right:30,bottom:50,left:60},a=e.utils.defaultColor(),f=null,l=null,c=true,h=true,p=true,d=false,v=true,m=true,g=false,y=true,b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},w,E,S=t.id(),x={index:0,rescaleY:y},T=null,N="No Data Available.",C=function(e){return e.average},k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=250;n.orient("bottom").tickPadding(7);r.orient(d?"right":"left");s.updateState(false);var A=d3.scale.linear(),O={i:0,x:0};var M=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=b(i.series.key,a,f,i,_);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];k.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(v)e.tooltip.cleanup()});_.dispatch=k;_.lines=t;_.legend=i;_.xAxis=n;_.yAxis=r;_.interactiveLayer=o;d3.rebind(_,t,"defined","isArea","x","y","xScale","yScale","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id");_.options=e.utils.optionsFunc.bind(_);_.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return _};_.width=function(e){if(!arguments.length)return f;f=e;return _};_.height=function(e){if(!arguments.length)return l;l=e;return _};_.color=function(t){if(!arguments.length)return a;a=e.utils.getColor(t);i.color(a);return _};_.rescaleY=function(e){if(!arguments.length)return y;y=e;return _};_.showControls=function(e){if(!arguments.length)return m;m=e;return _};_.useInteractiveGuideline=function(e){if(!arguments.length)return g;g=e;if(e===true){_.interactive(false);_.useVoronoi(false)}return _};_.showLegend=function(e){if(!arguments.length)return c;c=e;return _};_.showXAxis=function(e){if(!arguments.length)return h;h=e;return _};_.showYAxis=function(e){if(!arguments.length)return p;p=e;return _};_.rightAlignYAxis=function(e){if(!arguments.length)return d;d=e;r.orient(e?"right":"left");return _};_.tooltips=function(e){if(!arguments.length)return v;v=e;return _};_.tooltipContent=function(e){if(!arguments.length)return b;b=e;return _};_.state=function(e){if(!arguments.length)return x;x=e;return _};_.defaultState=function(e){if(!arguments.length)return T;T=e;return _};_.noData=function(e){if(!arguments.length)return N;N=e;return _};_.average=function(e){if(!arguments.length)return C;C=e;return _};_.transitionDuration=function(e){if(!arguments.length)return L;L=e;return _};return _};e.models.discreteBar=function(){"use strict";function E(e){e.each(function(e){var i=n-t.left-t.right,E=r-t.top-t.bottom,S=d3.select(this);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});var T=p&&d?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0}})});s.domain(p||d3.merge(T).map(function(e){return e.x})).rangeBands(v||[0,i],.1);o.domain(d||d3.extent(d3.merge(T).map(function(e){return e.y}).concat(f)));if(c)o.range(m||[E-(o.domain()[0]<0?12:0),o.domain()[1]>0?12:0]);else o.range(m||[E,0]);b=b||s;w=w||o.copy().range([o(0),o(0)]);var N=S.selectAll("g.nv-wrap.nv-discretebar").data([e]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar");var k=C.append("g");var L=N.select("g");k.append("g").attr("class","nv-groups");N.attr("transform","translate("+t.left+","+t.top+")");var A=N.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);A.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();A.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover});A.transition().style("stroke-opacity",1).style("fill-opacity",.75);var O=A.selectAll("g.nv-bar").data(function(e){return e.values});O.exit().remove();var M=O.enter().append("g").attr("transform",function(e,t,n){return"translate("+(s(u(e,t))+s.rangeBand()*.05)+", "+o(0)+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);g.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);g.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){g.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){g.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});M.append("rect").attr("height",0).attr("width",s.rangeBand()*.9/e.length);if(c){M.append("text").attr("text-anchor","middle");O.select("text").text(function(e,t){return h(a(e,t))}).transition().attr("x",s.rangeBand()*.9/2).attr("y",function(e,t){return a(e,t)<0?o(a(e,t))-o(0)+12:-4})}else{O.selectAll("text").remove()}O.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(e,t){return e.color||l(e,t)}).style("stroke",function(e,t){return e.color||l(e,t)}).select("rect").attr("class",y).transition().attr("width",s.rangeBand()*.9/e.length);O.transition().attr("transform",function(e,t){var n=s(u(e,t))+s.rangeBand()*.05,r=a(e,t)<0?o(0):o(0)-o(a(e,t))<1?o(0)-1:o(a(e,t));return"translate("+n+", "+r+")"}).select("rect").attr("height",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(d&&d[0]||0))||1)});b=s.copy();w=o.copy()});return E}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=false,h=d3.format(",.2f"),p,d,v,m,g=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),y="discreteBar";var b,w;E.dispatch=g;E.options=e.utils.optionsFunc.bind(E);E.x=function(e){if(!arguments.length)return u;u=e;return E};E.y=function(e){if(!arguments.length)return a;a=e;return E};E.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return E};E.width=function(e){if(!arguments.length)return n;n=e;return E};E.height=function(e){if(!arguments.length)return r;r=e;return E};E.xScale=function(e){if(!arguments.length)return s;s=e;return E};E.yScale=function(e){if(!arguments.length)return o;o=e;return E};E.xDomain=function(e){if(!arguments.length)return p;p=e;return E};E.yDomain=function(e){if(!arguments.length)return d;d=e;return E};E.xRange=function(e){if(!arguments.length)return v;v=e;return E};E.yRange=function(e){if(!arguments.length)return m;m=e;return E};E.forceY=function(e){if(!arguments.length)return f;f=e;return E};E.color=function(t){if(!arguments.length)return l;l=e.utils.getColor(t);return E};E.id=function(e){if(!arguments.length)return i;i=e;return E};E.showValues=function(e){if(!arguments.length)return c;c=e;return E};E.valueFormat=function(e){if(!arguments.length)return h;h=e;return E};E.rectClass=function(e){if(!arguments.length)return y;y=e;return E};return E};e.models.discreteBarChart=function(){"use strict";function w(e){e.each(function(e){var u=d3.select(this),p=this;var E=(s||parseInt(u.style("width"))||960)-i.left-i.right,S=(o||parseInt(u.style("height"))||400)-i.top-i.bottom;w.update=function(){g.beforeUpdate();u.transition().duration(y).call(w)};w.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var T=u.selectAll(".nv-noData").data([m]);T.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");T.attr("x",i.left+E/2).attr("y",i.top+S/2).text(function(e){return e});return w}else{u.selectAll(".nv-noData").remove()}d=t.xScale();v=t.yScale().clamp(true);var N=u.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([e]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g");var k=C.append("defs");var L=N.select("g");C.append("g").attr("class","nv-x nv-axis");C.append("g").attr("class","nv-y nv-axis");C.append("g").attr("class","nv-barsWrap");L.attr("transform","translate("+i.left+","+i.top+")");if(l){L.select(".nv-y.nv-axis").attr("transform","translate("+E+",0)")}t.width(E).height(S);var A=L.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));A.transition().call(t);k.append("clipPath").attr("id","nv-x-label-clip-"+t.id()).append("rect");L.select("#nv-x-label-clip-"+t.id()+" rect").attr("width",d.rangeBand()*(c?2:1)).attr("height",16).attr("x",-d.rangeBand()/(c?1:2));if(a){n.scale(d).ticks(E/100).tickSize(-S,0);L.select(".nv-x.nv-axis").attr("transform","translate(0,"+(v.range()[0]+(t.showValues()&&v.domain()[0]<0?16:0))+")");L.select(".nv-x.nv-axis").transition().call(n);var O=L.select(".nv-x.nv-axis").selectAll("g");if(c){O.selectAll("text").attr("transform",function(e,t,n){return"translate(0,"+(n%2==0?"5":"17")+")"})}}if(f){r.scale(v).ticks(S/36).tickSize(-E,0);L.select(".nv-y.nv-axis").transition().call(r)}g.on("tooltipShow",function(e){if(h)b(e,p.parentNode)})});return w}var t=e.models.discreteBar(),n=e.models.axis(),r=e.models.axis();var i={top:15,right:10,bottom:50,left:60},s=null,o=null,u=e.utils.getColor(),a=true,f=true,l=false,c=false,h=true,p=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},d,v,m="No Data Available.",g=d3.dispatch("tooltipShow","tooltipHide","beforeUpdate"),y=250;n.orient("bottom").highlightZero(false).showMaxMin(false).tickFormat(function(e){return e});r.orient(l?"right":"left").tickFormat(d3.format(",.1f"));var b=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=p(i.series.key,a,f,i,w);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+i.left,e.pos[1]+i.top];g.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){g.tooltipHide(e)});g.on("tooltipHide",function(){if(h)e.tooltip.cleanup()});w.dispatch=g;w.discretebar=t;w.xAxis=n;w.yAxis=r;d3.rebind(w,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","id","showValues","valueFormat");w.options=e.utils.optionsFunc.bind(w);w.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.right=typeof e.right!="undefined"?e.right:i.right;i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom;i.left=typeof e.left!="undefined"?e.left:i.left;return w};w.width=function(e){if(!arguments.length)return s;s=e;return w};w.height=function(e){if(!arguments.length)return o;o=e;return w};w.color=function(n){if(!arguments.length)return u;u=e.utils.getColor(n);t.color(u);return w};w.showXAxis=function(e){if(!arguments.length)return a;a=e;return w};w.showYAxis=function(e){if(!arguments.length)return f;f=e;return w};w.rightAlignYAxis=function(e){if(!arguments.length)return l;l=e;r.orient(e?"right":"left");return w};w.staggerLabels=function(e){if(!arguments.length)return c;c=e;return w};w.tooltips=function(e){if(!arguments.length)return h;h=e;return w};w.tooltipContent=function(e){if(!arguments.length)return p;p=e;return w};w.noData=function(e){if(!arguments.length)return m;m=e;return w};w.transitionDuration=function(e){if(!arguments.length)return y;y=e;return w};return w};e.models.distribution=function(){"use strict";function l(e){e.each(function(e){var a=n-(i==="x"?t.left+t.right:t.top+t.bottom),l=i=="x"?"y":"x",c=d3.select(this);f=f||u;var h=c.selectAll("g.nv-distribution").data([e]);var p=h.enter().append("g").attr("class","nvd3 nv-distribution");var d=p.append("g");var v=h.select("g");h.attr("transform","translate("+t.left+","+t.top+")");var m=v.selectAll("g.nv-dist").data(function(e){return e},function(e){return e.key});m.enter().append("g");m.attr("class",function(e,t){return"nv-dist nv-series-"+t}).style("stroke",function(e,t){return o(e,t)});var g=m.selectAll("line.nv-dist"+i).data(function(e){return e.values});g.enter().append("line").attr(i+"1",function(e,t){return f(s(e,t))}).attr(i+"2",function(e,t){return f(s(e,t))});m.exit().selectAll("line.nv-dist"+i).transition().attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}).style("stroke-opacity",0).remove();g.attr("class",function(e,t){return"nv-dist"+i+" nv-dist"+i+"-"+t}).attr(l+"1",0).attr(l+"2",r);g.transition().attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))});f=u.copy()});return l}var t={top:0,right:0,bottom:0,left:0},n=400,r=8,i="x",s=function(e){return e[i]},o=e.utils.defaultColor(),u=d3.scale.linear(),a;var f;l.options=e.utils.optionsFunc.bind(l);l.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return l};l.width=function(e){if(!arguments.length)return n;n=e;return l};l.axis=function(e){if(!arguments.length)return i;i=e;return l};l.size=function(e){if(!arguments.length)return r;r=e;return l};l.getData=function(e){if(!arguments.length)return s;s=d3.functor(e);return l};l.scale=function(e){if(!arguments.length)return u;u=e;return l};l.color=function(t){if(!arguments.length)return o;o=e.utils.getColor(t);return l};return l};e.models.historicalBar=function(){"use strict";function w(E){E.each(function(w){var E=n-t.left-t.right,S=r-t.top-t.bottom,T=d3.select(this);s.domain(d||d3.extent(w[0].values.map(u).concat(f)));if(c)s.range(m||[E*.5/w[0].values.length,E*(w[0].values.length-.5)/w[0].values.length]);else s.range(m||[0,E]);o.domain(v||d3.extent(w[0].values.map(a).concat(l))).range(g||[S,0]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1]);if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]);var N=T.selectAll("g.nv-wrap.nv-historicalBar-"+i).data([w[0].values]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+i);var k=C.append("defs");var L=C.append("g");var A=N.select("g");L.append("g").attr("class","nv-bars");N.attr("transform","translate("+t.left+","+t.top+")");T.on("click",function(e,t){y.chartClick({data:e,index:t,pos:d3.event,id:i})});k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect");N.select("#nv-chart-clip-path-"+i+" rect").attr("width",E).attr("height",S);A.attr("clip-path",h?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-bars").selectAll(".nv-bar").data(function(e){return e},function(e,t){return u(e,t)});O.exit().remove();var M=O.enter().append("rect").attr("x",0).attr("y",function(t,n){return e.utils.NaNtoZero(o(Math.max(0,a(t,n))))}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.abs(o(a(t,n))-o(0)))}).attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).on("mouseover",function(e,t){if(!b)return;d3.select(this).classed("hover",true);y.elementMouseover({point:e,series:w[0],pos:[s(u(e,t)),o(a(e,t))],pointIndex:t,seriesIndex:0,e:d3.event})}).on("mouseout",function(e,t){if(!b)return;d3.select(this).classed("hover",false);y.elementMouseout({point:e,series:w[0],pointIndex:t,seriesIndex:0,e:d3.event})}).on("click",function(e,t){if(!b)return;y.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()}).on("dblclick",function(e,t){if(!b)return;y.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()});O.attr("fill",function(e,t){return p(e,t)}).attr("class",function(e,t,n){return(a(e,t)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+t}).transition().attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).attr("width",E/w[0].values.length*.9);O.transition().attr("y",function(t,n){var r=a(t,n)<0?o(0):o(0)-o(a(t,n))<1?o(0)-1:o(a(t,n));return e.utils.NaNtoZero(r)}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.max(Math.abs(o(a(t,n))-o(0)),1))})});return w}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[],l=[0],c=false,h=true,p=e.utils.defaultColor(),d,v,m,g,y=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),b=true;w.highlightPoint=function(e,t){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar-0-"+e).classed("hover",t)};w.clearHighlights=function(){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar.hover").classed("hover",false)};w.dispatch=y;w.options=e.utils.optionsFunc.bind(w);w.x=function(e){if(!arguments.length)return u;u=e;return w};w.y=function(e){if(!arguments.length)return a;a=e;return w};w.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return w};w.width=function(e){if(!arguments.length)return n;n=e;return w};w.height=function(e){if(!arguments.length)return r;r=e;return w};w.xScale=function(e){if(!arguments.length)return s;s=e;return w};w.yScale=function(e){if(!arguments.length)return o;o=e;return w};w.xDomain=function(e){if(!arguments.length)return d;d=e;return w};w.yDomain=function(e){if(!arguments.length)return v;v=e;return w};w.xRange=function(e){if(!arguments.length)return m;m=e;return w};w.yRange=function(e){if(!arguments.length)return g;g=e;return w};w.forceX=function(e){if(!arguments.length)return f;f=e;return w};w.forceY=function(e){if(!arguments.length)return l;l=e;return w};w.padData=function(e){if(!arguments.length)return c;c=e;return w};w.clipEdge=function(e){if(!arguments.length)return h;h=e;return w};w.color=function(t){if(!arguments.length)return p;p=e.utils.getColor(t);return w};w.id=function(e){if(!arguments.length)return i;i=e;return w};w.interactive=function(e){if(!arguments.length)return b;b=false;return w};return w};e.models.historicalBarChart=function(){"use strict";function x(e){e.each(function(d){var T=d3.select(this),N=this;var C=(u||parseInt(T.style("width"))||960)-s.left-s.right,k=(a||parseInt(T.style("height"))||400)-s.top-s.bottom;x.update=function(){T.transition().duration(E).call(x)};x.container=this;g.disabled=d.map(function(e){return!!e.disabled});if(!y){var L;y={};for(L in g){if(g[L]instanceof Array)y[L]=g[L].slice(0);else y[L]=g[L]}}if(!d||!d.length||!d.filter(function(e){return e.values.length}).length){var A=T.selectAll(".nv-noData").data([b]);A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");A.attr("x",s.left+C/2).attr("y",s.top+k/2).text(function(e){return e});return x}else{T.selectAll(".nv-noData").remove()}v=t.xScale();m=t.yScale();var O=T.selectAll("g.nv-wrap.nv-historicalBarChart").data([d]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g");var _=O.select("g");M.append("g").attr("class","nv-x nv-axis");M.append("g").attr("class","nv-y nv-axis");M.append("g").attr("class","nv-barsWrap");M.append("g").attr("class","nv-legendWrap");if(f){i.width(C);_.select(".nv-legendWrap").datum(d).call(i);if(s.top!=i.height()){s.top=i.height();k=(a||parseInt(T.style("height"))||400)-s.top-s.bottom}O.select(".nv-legendWrap").attr("transform","translate(0,"+ -s.top+")")}O.attr("transform","translate("+s.left+","+s.top+")");if(h){_.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)")}t.width(C).height(k).color(d.map(function(e,t){return e.color||o(e,t)}).filter(function(e,t){return!d[t].disabled}));var D=_.select(".nv-barsWrap").datum(d.filter(function(e){return!e.disabled}));D.transition().call(t);if(l){n.scale(v).tickSize(-k,0);_.select(".nv-x.nv-axis").attr("transform","translate(0,"+m.range()[0]+")");_.select(".nv-x.nv-axis").transition().call(n)}if(c){r.scale(m).ticks(k/36).tickSize(-C,0);_.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled;if(!d.filter(function(e){return!e.disabled}).length){d.map(function(e){e.disabled=false;O.selectAll(".nv-series").classed("disabled",false);return e})}g.disabled=d.map(function(e){return!!e.disabled});w.stateChange(g);e.transition().call(x)});i.dispatch.on("legendDblclick",function(e){d.forEach(function(e){e.disabled=true});e.disabled=false;g.disabled=d.map(function(e){return!!e.disabled});w.stateChange(g);x.update()});w.on("tooltipShow",function(e){if(p)S(e,N.parentNode)});w.on("changeState",function(t){if(typeof t.disabled!=="undefined"){d.forEach(function(e,n){e.disabled=t.disabled[n]});g.disabled=t.disabled}e.call(x)})});return x}var t=e.models.historicalBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend();var s={top:30,right:90,bottom:50,left:90},o=e.utils.defaultColor(),u=null,a=null,f=false,l=true,c=true,h=false,p=true,d=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},v,m,g={},y=null,b="No Data Available.",w=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),E=250;n.orient("bottom").tickPadding(7);r.orient(h?"right":"left");var S=function(i,s){if(s){var o=d3.select(s).select("svg");var u=o.node()?o.attr("viewBox"):null;if(u){u=u.split(" ");var a=parseInt(o.style("width"))/u[2];i.pos[0]=i.pos[0]*a;i.pos[1]=i.pos[1]*a}}var f=i.pos[0]+(s.offsetLeft||0),l=i.pos[1]+(s.offsetTop||0),c=n.tickFormat()(t.x()(i.point,i.pointIndex)),h=r.tickFormat()(t.y()(i.point,i.pointIndex)),p=d(i.series.key,c,h,i,x);e.tooltip.show([f,l],p,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+s.left,e.pos[1]+s.top];w.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){w.tooltipHide(e)});w.on("tooltipHide",function(){if(p)e.tooltip.cleanup()});x.dispatch=w;x.bars=t;x.legend=i;x.xAxis=n;x.yAxis=r;d3.rebind(x,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate","highlightPoint","clearHighlights","interactive");x.options=e.utils.optionsFunc.bind(x);x.margin=function(e){if(!arguments.length)return s;s.top=typeof e.top!="undefined"?e.top:s.top;s.right=typeof e.right!="undefined"?e.right:s.right;s.bottom=typeof e.bottom!="undefined"?e.bottom:s.bottom;s.left=typeof e.left!="undefined"?e.left:s.left;return x};x.width=function(e){if(!arguments.length)return u;u=e;return x};x.height=function(e){if(!arguments.length)return a;a=e;return x};x.color=function(t){if(!arguments.length)return o;o=e.utils.getColor(t);i.color(o);return x};x.showLegend=function(e){if(!arguments.length)return f;f=e;return x};x.showXAxis=function(e){if(!arguments.length)return l;l=e;return x};x.showYAxis=function(e){if(!arguments.length)return c;c=e;return x};x.rightAlignYAxis=function(e){if(!arguments.length)return h;h=e;r.orient(e?"right":"left");return x};x.tooltips=function(e){if(!arguments.length)return p;p=e;return x};x.tooltipContent=function(e){if(!arguments.length)return d;d=e;return x};x.state=function(e){if(!arguments.length)return g;g=e;return x};x.defaultState=function(e){if(!arguments.length)return y;y=e;return x};x.noData=function(e){if(!arguments.length)return b;b=e;return x};x.transitionDuration=function(e){if(!arguments.length)return E;E=e;return x};return x};e.models.indentedTree=function(){"use strict";function g(e){e.each(function(e){function k(e,t,n){d3.event.stopPropagation();if(d3.event.shiftKey&&!n){d3.event.shiftKey=false;e.values&&e.values.forEach(function(e){if(e.values||e._values){k(e,0,true)}});return true}if(!O(e)){return true}if(e.values){e._values=e.values;e.values=null}else{e.values=e._values;e._values=null}g.update()}function L(e){return e._values&&e._values.length?h:e.values&&e.values.length?p:""}function A(e){return e._values&&e._values.length}function O(e){var t=e.values||e._values;return t&&t.length}var t=1,n=d3.select(this);var i=d3.layout.tree().children(function(e){return e.values}).size([r,f]);g.update=function(){n.transition().duration(600).call(g)};if(!e[0])e[0]={key:a};var s=i.nodes(e[0]);var y=d3.select(this).selectAll("div").data([[s]]);var b=y.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree");var w=b.append("table");var E=y.select("table").attr("width","100%").attr("class",c);if(o){var S=w.append("thead");var x=S.append("tr");l.forEach(function(e){x.append("th").attr("width",e.width?e.width:"10%").style("text-align",e.type=="numeric"?"right":"left").append("span").text(e.label)})}var T=E.selectAll("tbody").data(function(e){return e});T.enter().append("tbody");t=d3.max(s,function(e){return e.depth});i.size([r,t*f]);var N=T.selectAll("tr").data(function(e){return e.filter(function(e){return u&&!e.children?u(e):true})},function(e,t){return e.id||e.id||++m});N.exit().remove();N.select("img.nv-treeicon").attr("src",L).classed("folded",A);var C=N.enter().append("tr");l.forEach(function(e,t){var n=C.append("td").style("padding-left",function(e){return(t?0:e.depth*f+12+(L(e)?0:16))+"px"},"important").style("text-align",e.type=="numeric"?"right":"left");if(t==0){n.append("img").classed("nv-treeicon",true).classed("nv-folded",A).attr("src",L).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(e){return L(e)?"inline-block":"none"}).on("click",k)}n.each(function(n){if(!t&&v(n))d3.select(this).append("a").attr("href",v).attr("class",d3.functor(e.classes)).append("span");else d3.select(this).append("span");d3.select(this).select("span").attr("class",d3.functor(e.classes)).text(function(t){return e.format?e.format(t):t[e.key]||"-"})});if(e.showCount){n.append("span").attr("class","nv-childrenCount");N.selectAll("span.nv-childrenCount").text(function(e){return e.values&&e.values.length||e._values&&e._values.length?"("+(e.values&&e.values.filter(function(e){return u?u(e):true}).length||e._values&&e._values.filter(function(e){return u?u(e):true}).length||0)+")":""})}});N.order().on("click",function(e){d.elementClick({row:this,data:e,pos:[e.x,e.y]})}).on("dblclick",function(e){d.elementDblclick({row:this,data:e,pos:[e.x,e.y]})}).on("mouseover",function(e){d.elementMouseover({row:this,data:e,pos:[e.x,e.y]})}).on("mouseout",function(e){d.elementMouseout({row:this,data:e,pos:[e.x,e.y]})})});return g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e4),o=true,u=false,a="No Data Available.",f=20,l=[{key:"key",label:"Name",type:"text"}],c=null,h="images/grey-plus.png",p="images/grey-minus.png",d=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout"),v=function(e){return e.url};var m=0;g.options=e.utils.optionsFunc.bind(g);g.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return g};g.width=function(e){if(!arguments.length)return n;n=e;return g};g.height=function(e){if(!arguments.length)return r;r=e;return g};g.color=function(t){if(!arguments.length)return i;i=e.utils.getColor(t);scatter.color(i);return g};g.id=function(e){if(!arguments.length)return s;s=e;return g};g.header=function(e){if(!arguments.length)return o;o=e;return g};g.noData=function(e){if(!arguments.length)return a;a=e;return g};g.filterZero=function(e){if(!arguments.length)return u;u=e;return g};g.columns=function(e){if(!arguments.length)return l;l=e;return g};g.tableClass=function(e){if(!arguments.length)return c;c=e;return g};g.iconOpen=function(e){if(!arguments.length)return h;h=e;return g};g.iconClose=function(e){if(!arguments.length)return p;p=e;return g};g.getUrl=function(e){if(!arguments.length)return v;v=e;return g};return g};e.models.legend=function(){"use strict";function h(p){p.each(function(h){var p=n-t.left-t.right,d=d3.select(this);var v=d.selectAll("g.nv-legend").data([h]);var m=v.enter().append("g").attr("class","nvd3 nv-legend").append("g");var g=v.select("g");v.attr("transform","translate("+t.left+","+t.top+")");var y=g.selectAll(".nv-series").data(function(e){return e});var b=y.enter().append("g").attr("class","nv-series").on("mouseover",function(e,t){l.legendMouseover(e,t)}).on("mouseout",function(e,t){l.legendMouseout(e,t)}).on("click",function(e,t){if(!c){l.legendClick(e,t);if(a){if(f){h.forEach(function(e){e.disabled=true});e.disabled=false}else{e.disabled=!e.disabled;if(h.every(function(e){return e.disabled})){h.forEach(function(e){e.disabled=false})}}l.stateChange({disabled:h.map(function(e){return!!e.disabled})})}}}).on("dblclick",function(e,t){if(!c){l.legendDblclick(e,t);if(a){h.forEach(function(e){e.disabled=true});e.disabled=false;l.stateChange({disabled:h.map(function(e){return!!e.disabled})})}}});b.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5);b.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");y.classed("disabled",function(e){return e.disabled});y.exit().remove();y.select("circle").style("fill",function(e,t){return e.color||s(e,t)}).style("stroke",function(e,t){return e.color||s(e,t)});y.select("text").text(i);if(o){var w=[];y.each(function(t,n){var r=d3.select(this).select("text");var i=r.node().getComputedTextLength()||e.utils.calcApproxTextWidth(r);w.push(i+28)});var E=0;var S=0;var x=[];while(S<p&&E<w.length){x[E]=w[E];S+=w[E++]}if(E===0)E=1;while(S>p&&E>1){x=[];E--;for(var T=0;T<w.length;T++){if(w[T]>(x[T%E]||0))x[T%E]=w[T]}S=x.reduce(function(e,t,n,r){return e+t})}var N=[];for(var C=0,k=0;C<E;C++){N[C]=k;k+=x[C]}y.attr("transform",function(e,t){return"translate("+N[t%E]+","+(5+Math.floor(t/E)*20)+")"});if(u){g.attr("transform","translate("+(n-t.right-S)+","+t.top+")")}else{g.attr("transform","translate(0"+","+t.top+")")}r=t.top+t.bottom+Math.ceil(w.length/E)*20}else{var L=5,A=5,O=0,M;y.attr("transform",function(e,r){var i=d3.select(this).select("text").node().getComputedTextLength()+28;M=A;if(n<t.left+t.right+M+i){A=M=5;L+=20}A+=i;if(A>O)O=A;return"translate("+M+","+L+")"});g.attr("transform","translate("+(n-t.right-O)+","+t.top+")");r=t.top+t.bottom+L+15}});return h}var t={top:5,right:0,bottom:5,left:0},n=400,r=20,i=function(e){return e.key},s=e.utils.defaultColor(),o=true,u=true,a=true,f=false,l=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange"),c=false;h.dispatch=l;h.options=e.utils.optionsFunc.bind(h);h.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return h};h.width=function(e){if(!arguments.length)return n;n=e;return h};h.height=function(e){if(!arguments.length)return r;r=e;return h};h.key=function(e){if(!arguments.length)return i;i=e;return h};h.color=function(t){if(!arguments.length)return s;s=e.utils.getColor(t);return h};h.align=function(e){if(!arguments.length)return o;o=e;return h};h.rightAlign=function(e){if(!arguments.length)return u;u=e;return h};h.dualaxis=function(e){if(!arguments.length)return c;c=e;return h};h.updateState=function(e){if(!arguments.length)return a;a=e;return h};h.radioButtonMode=function(e){if(!arguments.length)return f;f=e;return h};return h};e.models.line=function(){"use strict";function m(g){g.each(function(m){var g=r-n.left-n.right,b=i-n.top-n.bottom,w=d3.select(this);c=t.xScale();h=t.yScale();d=d||c;v=v||h;var E=w.selectAll("g.nv-wrap.nv-line").data([m]);var S=E.enter().append("g").attr("class","nvd3 nv-wrap nv-line");var T=S.append("defs");var N=S.append("g");var C=E.select("g");N.append("g").attr("class","nv-groups");N.append("g").attr("class","nv-scatterWrap");E.attr("transform","translate("+n.left+","+n.top+")");t.width(g).height(b);var k=E.select(".nv-scatterWrap");k.transition().call(t);T.append("clipPath").attr("id","nv-edge-clip-"+t.id()).append("rect");E.select("#nv-edge-clip-"+t.id()+" rect").attr("width",g).attr("height",b);C.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");k.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");var L=E.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});L.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);L.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();L.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return s(e,t)}).style("stroke",function(e,t){return s(e,t)});L.transition().style("stroke-opacity",1).style("fill-opacity",.5);var A=L.selectAll("path.nv-area").data(function(e){return f(e)?[e]:[]});A.enter().append("path").attr("class","nv-area").attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}).y1(function(e,t){return v(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});L.exit().selectAll("path.nv-area").remove();A.transition().attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}).y1(function(e,t){return h(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});var O=L.selectAll("path.nv-line").data(function(e){return[e.values]});O.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}));L.exit().selectAll("path.nv-line").transition().attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}));O.transition().attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}));d=c.copy();v=h.copy()});return m}var t=e.models.scatter();var n={top:0,right:0,bottom:0,left:0},r=960,i=500,s=e.utils.defaultColor(),o=function(e){return e.x},u=function(e){return e.y},a=function(e,t){return!isNaN(u(e,t))&&u(e,t)!==null},f=function(e){return e.area},l=false,c,h,p="linear";t.size(16).sizeDomain([16,256]);var d,v;m.dispatch=t.dispatch;m.scatter=t;d3.rebind(m,t,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","padData","highlightPoint","clearHighlights");m.options=e.utils.optionsFunc.bind(m);m.margin=function(e){if(!arguments.length)return n;n.top=typeof e.top!="undefined"?e.top:n.top;n.right=typeof e.right!="undefined"?e.right:n.right;n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom;n.left=typeof e.left!="undefined"?e.left:n.left;return m};m.width=function(e){if(!arguments.length)return r;r=e;return m};m.height=function(e){if(!arguments.length)return i;i=e;return m};m.x=function(e){if(!arguments.length)return o;o=e;t.x(e);return m};m.y=function(e){if(!arguments.length)return u;u=e;t.y(e);return m};m.clipEdge=function(e){if(!arguments.length)return l;l=e;return m};m.color=function(n){if(!arguments.length)return s;s=e.utils.getColor(n);t.color(s);return m};m.interpolate=function(e){if(!arguments.length)return p;p=e;return m};m.defined=function(e){if(!arguments.length)return a;a=e;return m};m.isArea=function(e){if(!arguments.length)return f;f=d3.functor(e);return m};return m};e.models.lineChart=function(){"use strict";function N(m){m.each(function(m){var C=d3.select(this),k=this;var L=(a||parseInt(C.style("width"))||960)-o.left-o.right,A=(f||parseInt(C.style("height"))||400)-o.top-o.bottom;N.update=function(){C.transition().duration(x).call(N)};N.container=this;b.disabled=m.map(function(e){return!!e.disabled});if(!w){var O;w={};for(O in b){if(b[O]instanceof Array)w[O]=b[O].slice(0);else w[O]=b[O]}}if(!m||!m.length||!m.filter(function(e){return e.values.length}).length){var M=C.selectAll(".nv-noData").data([E]);M.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");M.attr("x",o.left+L/2).attr("y",o.top+A/2).text(function(e){return e});return N}else{C.selectAll(".nv-noData").remove()}g=t.xScale();y=t.yScale();var _=C.selectAll("g.nv-wrap.nv-lineChart").data([m]);var D=_.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g");var P=_.select("g");D.append("rect").style("opacity",0);D.append("g").attr("class","nv-x nv-axis");D.append("g").attr("class","nv-y nv-axis");D.append("g").attr("class","nv-linesWrap");D.append("g").attr("class","nv-legendWrap");D.append("g").attr("class","nv-interactive");P.select("rect").attr("width",L).attr("height",A);if(l){i.width(L);P.select(".nv-legendWrap").datum(m).call(i);if(o.top!=i.height()){o.top=i.height();A=(f||parseInt(C.style("height"))||400)-o.top-o.bottom}_.select(".nv-legendWrap").attr("transform","translate(0,"+ -o.top+")")}_.attr("transform","translate("+o.left+","+o.top+")");if(p){P.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)")}if(d){s.width(L).height(A).margin({left:o.left,top:o.top}).svgContainer(C).xScale(g);_.select(".nv-interactive").call(s)}t.width(L).height(A).color(m.map(function(e,t){return e.color||u(e,t)}).filter(function(e,t){return!m[t].disabled}));var H=P.select(".nv-linesWrap").datum(m.filter(function(e){return!e.disabled}));H.transition().call(t);if(c){n.scale(g).ticks(L/100).tickSize(-A,0);P.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");P.select(".nv-x.nv-axis").transition().call(n)}if(h){r.scale(y).ticks(A/36).tickSize(-L,0);P.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);N.update()});s.dispatch.on("elementMousemove",function(i){t.clearHighlights();var a,f,l,c=[];m.filter(function(e,t){e.seriesIndex=t;return!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,N.x());t.highlightPoint(r,f,true);var s=n.values[f];if(typeof s==="undefined")return;if(typeof a==="undefined")a=s;if(typeof l==="undefined")l=N.xScale()(N.x()(s,f));c.push({key:n.key,value:N.y()(s,f),color:u(n,n.seriesIndex)})});if(c.length>2){var h=N.yScale().invert(i.mouseY);var p=Math.abs(N.yScale().domain()[0]-N.yScale().domain()[1]);var d=.03*p;var g=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);if(g!==null)c[g].highlight=true}var y=n.tickFormat()(N.x()(a,f));s.tooltip.position({left:l+o.left,top:i.mouseY+o.top}).chartContainer(k.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:y,series:c})();s.renderGuideLine(l)});s.dispatch.on("elementMouseout",function(e){S.tooltipHide();t.clearHighlights()});S.on("tooltipShow",function(e){if(v)T(e,k.parentNode)});S.on("changeState",function(e){if(typeof e.disabled!=="undefined"){m.forEach(function(t,n){t.disabled=e.disabled[n]});b.disabled=e.disabled}N.update()})});return N}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.interactiveGuideline();var o={top:30,right:20,bottom:50,left:60},u=e.utils.defaultColor(),a=null,f=null,l=true,c=true,h=true,p=false,d=false,v=true,m=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=250;n.orient("bottom").tickPadding(7);r.orient(p?"right":"left");var T=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=m(i.series.key,a,f,i,N);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(v)e.tooltip.cleanup()});N.dispatch=S;N.lines=t;N.legend=i;N.xAxis=n;N.yAxis=r;N.interactiveLayer=s;d3.rebind(N,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id","interpolate");N.options=e.utils.optionsFunc.bind(N);N.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return N};N.width=function(e){if(!arguments.length)return a;a=e;return N};N.height=function(e){if(!arguments.length)return f;f=e;return N};N.color=function(t){if(!arguments.length)return u;u=e.utils.getColor(t);i.color(u);return N};N.showLegend=function(e){if(!arguments.length)return l;l=e;return N};N.showXAxis=function(e){if(!arguments.length)return c;c=e;return N};N.showYAxis=function(e){if(!arguments.length)return h;h=e;return N};N.rightAlignYAxis=function(e){if(!arguments.length)return p;p=e;r.orient(e?"right":"left");return N};N.useInteractiveGuideline=function(e){if(!arguments.length)return d;d=e;if(e===true){N.interactive(false);N.useVoronoi(false)}return N};N.tooltips=function(e){if(!arguments.length)return v;v=e;return N};N.tooltipContent=function(e){if(!arguments.length)return m;m=e;return N};N.state=function(e){if(!arguments.length)return b;b=e;return N};N.defaultState=function(e){if(!arguments.length)return w;w=e;return N};N.noData=function(e){if(!arguments.length)return E;E=e;return N};N.transitionDuration=function(e){if(!arguments.length)return x;x=e;return N};return N};e.models.linePlusBarChart=function(){"use strict";function T(e){e.each(function(e){var l=d3.select(this),c=this;var v=(a||parseInt(l.style("width"))||960)-u.left-u.right,N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom;T.update=function(){l.transition().call(T)};b.disabled=e.map(function(e){return!!e.disabled});if(!w){var C;w={};for(C in b){if(b[C]instanceof Array)w[C]=b[C].slice(0);else w[C]=b[C]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var k=l.selectAll(".nv-noData").data([E]);k.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");k.attr("x",u.left+v/2).attr("y",u.top+N/2).text(function(e){return e});return T}else{l.selectAll(".nv-noData").remove()}var L=e.filter(function(e){return!e.disabled&&e.bar});var A=e.filter(function(e){return!e.bar});m=A.filter(function(e){return!e.disabled}).length&&A.filter(function(e){return!e.disabled})[0].values.length?t.xScale():n.xScale();g=n.yScale();y=t.yScale();var O=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([e]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");var _=O.select("g");M.append("g").attr("class","nv-x nv-axis");M.append("g").attr("class","nv-y1 nv-axis");M.append("g").attr("class","nv-y2 nv-axis");M.append("g").attr("class","nv-barsWrap");M.append("g").attr("class","nv-linesWrap");M.append("g").attr("class","nv-legendWrap");if(p){o.width(v/2);_.select(".nv-legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)");return e})).call(o);if(u.top!=o.height()){u.top=o.height();N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom}_.select(".nv-legendWrap").attr("transform","translate("+v/2+","+ -u.top+")")}O.attr("transform","translate("+u.left+","+u.top+")");t.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));n.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));var D=_.select(".nv-barsWrap").datum(L.length?L:[{values:[]}]);var P=_.select(".nv-linesWrap").datum(A[0]&&!A[0].disabled?A:[{values:[]}]);d3.transition(D).call(n);d3.transition(P).call(t);r.scale(m).ticks(v/100).tickSize(-N,0);_.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")");d3.transition(_.select(".nv-x.nv-axis")).call(r);i.scale(g).ticks(N/36).tickSize(-v,0);d3.transition(_.select(".nv-y1.nv-axis")).style("opacity",L.length?1:0).call(i);s.scale(y).ticks(N/36).tickSize(L.length?0:-v,0);_.select(".nv-y2.nv-axis").style("opacity",A.length?1:0).attr("transform","translate("+v+",0)");d3.transition(_.select(".nv-y2.nv-axis")).call(s);o.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);T.update()});S.on("tooltipShow",function(e){if(d)x(e,c.parentNode)});S.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});b.disabled=t.disabled}T.update()})});return T}var t=e.models.line(),n=e.models.historicalBar(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.legend();var u={top:30,right:60,bottom:50,left:60},a=null,f=null,l=function(e){return e.x},c=function(e){return e.y},h=e.utils.defaultColor(),p=true,d=true,v=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},m,g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");n.padData(true);t.clipEdge(false).padData(true);r.orient("bottom").tickPadding(7).highlightZero(false);i.orient("left");s.orient("right");var x=function(n,o){var u=n.pos[0]+(o.offsetLeft||0),a=n.pos[1]+(o.offsetTop||0),f=r.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?i:s).tickFormat()(t.y()(n.point,n.pointIndex)),c=v(n.series.key,f,l,n,T);e.tooltip.show([u,a],c,n.value<0?"n":"s",null,o)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});n.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];S.tooltipShow(e)});n.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(d)e.tooltip.cleanup()});T.dispatch=S;T.legend=o;T.lines=t;T.bars=n;T.xAxis=r;T.y1Axis=i;T.y2Axis=s;d3.rebind(T,t,"defined","size","clipVoronoi","interpolate");T.options=e.utils.optionsFunc.bind(T);T.x=function(e){if(!arguments.length)return l;l=e;t.x(e);n.x(e);return T};T.y=function(e){if(!arguments.length)return c;c=e;t.y(e);n.y(e);return T};T.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return T};T.width=function(e){if(!arguments.length)return a;a=e;return T};T.height=function(e){if(!arguments.length)return f;f=e;return T};T.color=function(t){if(!arguments.length)return h;h=e.utils.getColor(t);o.color(h);return T};T.showLegend=function(e){if(!arguments.length)return p;p=e;return T};T.tooltips=function(e){if(!arguments.length)return d;d=e;return T};T.tooltipContent=function(e){if(!arguments.length)return v;v=e;return T};T.state=function(e){if(!arguments.length)return b;b=e;return T};T.defaultState=function(e){if(!arguments.length)return w;w=e;return T};T.noData=function(e){if(!arguments.length)return E;E=e;return T};return T};e.models.lineWithFocusChart=function(){"use strict";function k(e){e.each(function(e){function U(e){var t=+(e=="e"),n=t?1:-1,r=M/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function z(){if(!a.empty())a.extent(w);I.data([a.empty()?g.domain():w]).each(function(e,t){var n=g(e[0])-v.range()[0],r=v.range()[1]-g(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n);d3.select(this).select(".right").attr("x",g(e[1])).attr("width",r<0?0:r)})}function W(){w=a.empty()?null:a.extent();var n=a.empty()?g.domain():a.extent();if(Math.abs(n[0]-n[1])<=1){return}T.brush({extent:n,brush:a});z();var s=H.select(".nv-focus .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}).map(function(e,r){return{key:e.key,values:e.values.filter(function(e,r){return t.x()(e,r)>=n[0]&&t.x()(e,r)<=n[1]})}}));s.transition().duration(N).call(t);H.select(".nv-focus .nv-x.nv-axis").transition().duration(N).call(r);H.select(".nv-focus .nv-y.nv-axis").transition().duration(N).call(i)}var S=d3.select(this),L=this;var A=(h||parseInt(S.style("width"))||960)-f.left-f.right,O=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d,M=d-l.top-l.bottom;k.update=function(){S.transition().duration(N).call(k)};k.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var _=S.selectAll(".nv-noData").data([x]);_.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");_.attr("x",f.left+A/2).attr("y",f.top+O/2).text(function(e){return e});return k}else{S.selectAll(".nv-noData").remove()}v=t.xScale();m=t.yScale();g=n.xScale();y=n.yScale();var D=S.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([e]);var P=D.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g");var H=D.select("g");P.append("g").attr("class","nv-legendWrap");var B=P.append("g").attr("class","nv-focus");B.append("g").attr("class","nv-x nv-axis");B.append("g").attr("class","nv-y nv-axis");B.append("g").attr("class","nv-linesWrap");var j=P.append("g").attr("class","nv-context");j.append("g").attr("class","nv-x nv-axis");j.append("g").attr("class","nv-y nv-axis");j.append("g").attr("class","nv-linesWrap");j.append("g").attr("class","nv-brushBackground");j.append("g").attr("class","nv-x nv-brush");if(b){u.width(A);H.select(".nv-legendWrap").datum(e).call(u);if(f.top!=u.height()){f.top=u.height();O=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d}H.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")}D.attr("transform","translate("+f.left+","+f.top+")");t.width(A).height(O).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));n.defined(t.defined()).width(A).height(M).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));H.select(".nv-context").attr("transform","translate(0,"+(O+f.bottom+l.top)+")");var F=H.select(".nv-context .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}));d3.transition(F).call(n);r.scale(v).ticks(A/100).tickSize(-O,0);i.scale(m).ticks(O/36).tickSize(-A,0);H.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+O+")");a.x(g).on("brush",function(){var e=k.transitionDuration();k.transitionDuration(0);W();k.transitionDuration(e)});if(w)a.extent(w);var I=H.select(".nv-brushBackground").selectAll("g").data([w||a.extent()]);var q=I.enter().append("g");q.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",M);q.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",M);var R=H.select(".nv-x.nv-brush").call(a);R.selectAll("rect").attr("height",M);R.selectAll(".resize").append("path").attr("d",U);W();s.scale(g).ticks(A/100).tickSize(-M,0);H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");d3.transition(H.select(".nv-context .nv-x.nv-axis")).call(s);o.scale(y).ticks(M/36).tickSize(-A,0);d3.transition(H.select(".nv-context .nv-y.nv-axis")).call(o);H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");u.dispatch.on("stateChange",function(e){k.update()});T.on("tooltipShow",function(e){if(E)C(e,L.parentNode)})});return k}var t=e.models.line(),n=e.models.line(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.axis(),u=e.models.legend(),a=d3.svg.brush();var f={top:30,right:30,bottom:30,left:60},l={top:0,right:30,bottom:20,left:60},c=e.utils.defaultColor(),h=null,p=null,d=100,v,m,g,y,b=true,w=null,E=true,S=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},x="No Data Available.",T=d3.dispatch("tooltipShow","tooltipHide","brush"),N=250;t.clipEdge(true);n.interactive(false);r.orient("bottom").tickPadding(5);i.orient("left");s.orient("bottom").tickPadding(5);o.orient("left");var C=function(n,s){var o=n.pos[0]+(s.offsetLeft||0),u=n.pos[1]+(s.offsetTop||0),a=r.tickFormat()(t.x()(n.point,n.pointIndex)),f=i.tickFormat()(t.y()(n.point,n.pointIndex)),l=S(n.series.key,a,f,n,k);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+f.left,e.pos[1]+f.top];T.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)});T.on("tooltipHide",function(){if(E)e.tooltip.cleanup()});k.dispatch=T;k.legend=u;k.lines=t;k.lines2=n;k.xAxis=r;k.yAxis=i;k.x2Axis=s;k.y2Axis=o;d3.rebind(k,t,"defined","isArea","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id");k.options=e.utils.optionsFunc.bind(k);k.x=function(e){if(!arguments.length)return t.x;t.x(e);n.x(e);return k};k.y=function(e){if(!arguments.length)return t.y;t.y(e);n.y(e);return k};k.margin=function(e){if(!arguments.length)return f;f.top=typeof e.top!="undefined"?e.top:f.top;f.right=typeof e.right!="undefined"?e.right:f.right;f.bottom=typeof e.bottom!="undefined"?e.bottom:f.bottom;f.left=typeof e.left!="undefined"?e.left:f.left;return k};k.margin2=function(e){if(!arguments.length)return l;l=e;return k};k.width=function(e){if(!arguments.length)return h;h=e;return k};k.height=function(e){if(!arguments.length)return p;p=e;return k};k.height2=function(e){if(!arguments.length)return d;d=e;return k};k.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);u.color(c);return k};k.showLegend=function(e){if(!arguments.length)return b;b=e;return k};k.tooltips=function(e){if(!arguments.length)return E;E=e;return k};k.tooltipContent=function(e){if(!arguments.length)return S;S=e;return k};k.interpolate=function(e){if(!arguments.length)return t.interpolate();t.interpolate(e);n.interpolate(e);return k};k.noData=function(e){if(!arguments.length)return x;x=e;return k};k.xTickFormat=function(e){if(!arguments.length)return r.tickFormat();r.tickFormat(e);s.tickFormat(e);return k};k.yTickFormat=function(e){if(!arguments.length)return i.tickFormat();i.tickFormat(e);o.tickFormat(e);return k};k.brushExtent=function(e){if(!arguments.length)return w;w=e;return k};k.transitionDuration=function(e){if(!arguments.length)return N;N=e;return k};return k};e.models.linePlusBarWithFocusChart=function(){"use strict";function B(e){e.each(function(e){function nt(e){var t=+(e=="e"),n=t?1:-1,r=q/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function rt(){if(!h.empty())h.extent(x);Z.data([h.empty()?k.domain():x]).each(function(e,t){var n=k(e[0])-k.range()[0],r=k.range()[1]-k(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n);d3.select(this).select(".right").attr("x",k(e[1])).attr("width",r<0?0:r)})}function it(){x=h.empty()?null:h.extent();S=h.empty()?k.domain():h.extent();D.brush({extent:S,brush:h});rt();r.width(F).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));t.width(F).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var n=J.select(".nv-focus .nv-barsWrap").datum(!U.length?[{values:[]}]:U.map(function(e,t){return{key:e.key,values:e.values.filter(function(e,t){return r.x()(e,t)>=S[0]&&r.x()(e,t)<=S[1]})}}));var i=J.select(".nv-focus .nv-linesWrap").datum(z[0].disabled?[{values:[]}]:z.map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return t.x()(e,n)>=S[0]&&t.x()(e,n)<=S[1]})}}));if(U.length){C=r.xScale()}else{C=t.xScale()}s.scale(C).ticks(F/100).tickSize(-I,0);s.domain([Math.ceil(S[0]),Math.floor(S[1])]);J.select(".nv-x.nv-axis").transition().duration(P).call(s);n.transition().duration(P).call(r);i.transition().duration(P).call(t);J.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+L.range()[0]+")");u.scale(L).ticks(I/36).tickSize(-F,0);J.select(".nv-focus .nv-y1.nv-axis").style("opacity",U.length?1:0);a.scale(A).ticks(I/36).tickSize(U.length?0:-F,0);J.select(".nv-focus .nv-y2.nv-axis").style("opacity",z.length?1:0).attr("transform","translate("+C.range()[1]+",0)");J.select(".nv-focus .nv-y1.nv-axis").transition().duration(P).call(u);J.select(".nv-focus .nv-y2.nv-axis").transition().duration(P).call(a)}var N=d3.select(this),j=this;var F=(v||parseInt(N.style("width"))||960)-p.left-p.right,I=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g,q=g-d.top-d.bottom;B.update=function(){N.transition().duration(P).call(B)};B.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var R=N.selectAll(".nv-noData").data([_]);R.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");R.attr("x",p.left+F/2).attr("y",p.top+I/2).text(function(e){return e});return B}else{N.selectAll(".nv-noData").remove()}var U=e.filter(function(e){return!e.disabled&&e.bar});var z=e.filter(function(e){return!e.bar});C=r.xScale();k=o.scale();L=r.yScale();A=t.yScale();O=i.yScale();M=n.yScale();var W=e.filter(function(e){return!e.disabled&&e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});var X=e.filter(function(e){return!e.disabled&&!e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});C.range([0,F]);k.domain(d3.extent(d3.merge(W.concat(X)),function(e){return e.x})).range([0,F]);var V=N.selectAll("g.nv-wrap.nv-linePlusBar").data([e]);var $=V.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");var J=V.select("g");$.append("g").attr("class","nv-legendWrap");var K=$.append("g").attr("class","nv-focus");K.append("g").attr("class","nv-x nv-axis");K.append("g").attr("class","nv-y1 nv-axis");K.append("g").attr("class","nv-y2 nv-axis");K.append("g").attr("class","nv-barsWrap");K.append("g").attr("class","nv-linesWrap");var Q=$.append("g").attr("class","nv-context");Q.append("g").attr("class","nv-x nv-axis");Q.append("g").attr("class","nv-y1 nv-axis");Q.append("g").attr("class","nv-y2 nv-axis");Q.append("g").attr("class","nv-barsWrap");Q.append("g").attr("class","nv-linesWrap");Q.append("g").attr("class","nv-brushBackground");Q.append("g").attr("class","nv-x nv-brush");if(E){c.width(F/2);J.select(".nv-legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)");return e})).call(c);if(p.top!=c.height()){p.top=c.height();I=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g}J.select(".nv-legendWrap").attr("transform","translate("+F/2+","+ -p.top+")")}V.attr("transform","translate("+p.left+","+p.top+")");i.width(F).height(q).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));n.width(F).height(q).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var G=J.select(".nv-context .nv-barsWrap").datum(U.length?U:[{values:[]}]);var Y=J.select(".nv-context .nv-linesWrap").datum(!z[0].disabled?z:[{values:[]}]);J.select(".nv-context").attr("transform","translate(0,"+(I+p.bottom+d.top)+")");G.transition().call(i);Y.transition().call(n);h.x(k).on("brush",it);if(x)h.extent(x);var Z=J.select(".nv-brushBackground").selectAll("g").data([x||h.extent()]);var et=Z.enter().append("g");et.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",q);et.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",q);var tt=J.select(".nv-x.nv-brush").call(h);tt.selectAll("rect").attr("height",q);tt.selectAll(".resize").append("path").attr("d",nt);o.ticks(F/100).tickSize(-q,0);J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+O.range()[0]+")");J.select(".nv-context .nv-x.nv-axis").transition().call(o);f.scale(O).ticks(q/36).tickSize(-F,0);J.select(".nv-context .nv-y1.nv-axis").style("opacity",U.length?1:0).attr("transform","translate(0,"+k.range()[0]+")");J.select(".nv-context .nv-y1.nv-axis").transition().call(f);l.scale(M).ticks(q/36).tickSize(U.length?0:-F,0);J.select(".nv-context .nv-y2.nv-axis").style("opacity",z.length?1:0).attr("transform","translate("+k.range()[1]+",0)");J.select(".nv-context .nv-y2.nv-axis").transition().call(l);c.dispatch.on("stateChange",function(e){B.update()});D.on("tooltipShow",function(e){if(T)H(e,j.parentNode)});it()});return B}var t=e.models.line(),n=e.models.line(),r=e.models.historicalBar(),i=e.models.historicalBar(),s=e.models.axis(),o=e.models.axis(),u=e.models.axis(),a=e.models.axis(),f=e.models.axis(),l=e.models.axis(),c=e.models.legend(),h=d3.svg.brush();var p={top:30,right:30,bottom:30,left:60},d={top:0,right:30,bottom:20,left:60},v=null,m=null,g=100,y=function(e){return e.x},b=function(e){return e.y},w=e.utils.defaultColor(),E=true,S,x=null,T=true,N=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},C,k,L,A,O,M,_="No Data Available.",D=d3.dispatch("tooltipShow","tooltipHide","brush"),P=0;t.clipEdge(true);n.interactive(false);s.orient("bottom").tickPadding(5);u.orient("left");a.orient("right");o.orient("bottom").tickPadding(5);f.orient("left");l.orient("right");var H=function(n,r){if(S){n.pointIndex+=Math.ceil(S[0])}var i=n.pos[0]+(r.offsetLeft||0),o=n.pos[1]+(r.offsetTop||0),f=s.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?u:a).tickFormat()(t.y()(n.point,n.pointIndex)),c=N(n.series.key,f,l,n,B);e.tooltip.show([i,o],c,n.value<0?"n":"s",null,r)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top];D.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)});r.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top];D.tooltipShow(e)});r.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)});D.on("tooltipHide",function(){if(T)e.tooltip.cleanup()});B.dispatch=D;B.legend=c;B.lines=t;B.lines2=n;B.bars=r;B.bars2=i;B.xAxis=s;B.x2Axis=o;B.y1Axis=u;B.y2Axis=a;B.y3Axis=f;B.y4Axis=l;d3.rebind(B,t,"defined","size","clipVoronoi","interpolate");B.options=e.utils.optionsFunc.bind(B);B.x=function(e){if(!arguments.length)return y;y=e;t.x(e);r.x(e);return B};B.y=function(e){if(!arguments.length)return b;b=e;t.y(e);r.y(e);return B};B.margin=function(e){if(!arguments.length)return p;p.top=typeof e.top!="undefined"?e.top:p.top;p.right=typeof e.right!="undefined"?e.right:p.right;p.bottom=typeof e.bottom!="undefined"?e.bottom:p.bottom;p.left=typeof e.left!="undefined"?e.left:p.left;return B};B.width=function(e){if(!arguments.length)return v;v=e;return B};B.height=function(e){if(!arguments.length)return m;m=e;return B};B.color=function(t){if(!arguments.length)return w;w=e.utils.getColor(t);c.color(w);return B};B.showLegend=function(e){if(!arguments.length)return E;E=e;return B};B.tooltips=function(e){if(!arguments.length)return T;T=e;return B};B.tooltipContent=function(e){if(!arguments.length)return N;N=e;return B};B.noData=function(e){if(!arguments.length)return _;_=e;return B};B.brushExtent=function(e){if(!arguments.length)return x;x=e;return B};return B};e.models.multiBar=function(){"use strict";function C(e){e.each(function(e){var C=n-t.left-t.right,k=r-t.top-t.bottom,L=d3.select(this);if(d&&e.length)d=[{values:e[0].values.map(function(e){return{x:e.x,y:0,series:e.series,size:.01}})}];if(c)e=d3.layout.stack().offset(h).values(function(e){return e.values}).y(a)(!e.length&&d?d:e);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});if(c)e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y);if(t.y<0){t.y1=i;i=i-t.size}else{t.y1=t.size+r;r=r+t.size}})});var A=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});i.domain(y||d3.merge(A).map(function(e){return e.x})).rangeBands(w||[0,C],S);s.domain(b||d3.extent(d3.merge(A).map(function(e){return c?e.y>0?e.y1:e.y1+e.y:e.y}).concat(f))).range(E||[k,0]);if(i.domain()[0]===i.domain()[1])i.domain()[0]?i.domain([i.domain()[0]-i.domain()[0]*.01,i.domain()[1]+i.domain()[1]*.01]):i.domain([-1,1]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]+s.domain()[0]*.01,s.domain()[1]-s.domain()[1]*.01]):s.domain([-1,1]);T=T||i;N=N||s;var O=L.selectAll("g.nv-wrap.nv-multibar").data([e]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar");var _=M.append("defs");var D=M.append("g");var P=O.select("g");D.append("g").attr("class","nv-groups");O.attr("transform","translate("+t.left+","+t.top+")");_.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect");O.select("#nv-edge-clip-"+o+" rect").attr("width",C).attr("height",k);P.attr("clip-path",l?"url(#nv-edge-clip-"+o+")":"");var H=O.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});H.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);H.exit().transition().selectAll("rect.nv-bar").delay(function(t,n){return n*g/e[0].values.length}).attr("y",function(e){return c?N(e.y0):N(0)}).attr("height",0).remove();H.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return p(e,t)}).style("stroke",function(e,t){return p(e,t)});H.transition().style("stroke-opacity",1).style("fill-opacity",.75);var B=H.selectAll("rect.nv-bar").data(function(t){return d&&!e.length?d.values:t.values});B.exit().remove();var j=B.enter().append("rect").attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,n,r){return c?0:r*i.rangeBand()/e.length}).attr("y",function(e){return N(c?e.y0:0)}).attr("height",0).attr("width",i.rangeBand()/(c?1:e.length)).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});B.style("fill",function(e,t,n){return p(e,n,t)}).style("stroke",function(e,t,n){return p(e,n,t)}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);x.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);x.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){x.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){x.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});B.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).transition().attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});if(v){if(!m)m=e.map(function(){return true});B.style("fill",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()})}if(c)B.transition().delay(function(t,n){return n*g/e[0].values.length}).attr("y",function(e,t){return s(c?e.y1:0)}).attr("height",function(e,t){if(e.y==null)return 0;return Math.max(Math.abs(s(e.y+(c?e.y0:0))-s(c?e.y0:0)),1)}).attr("x",function(t,n){return c?0:t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/(c?1:e.length));else B.transition().delay(function(t,n){return n*g/e[0].values.length}).attr("x",function(t,n){return t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/e.length).attr("y",function(e,t){return a(e,t)<0?s(0):s(0)-s(a(e,t))<1?s(0)-1:s(a(e,t))||0}).attr("height",function(e,t){if(e.y==null)return 0;return Math.max(Math.abs(s(a(e,t))-s(0)),1)||0});T=i.copy();N=s.copy()});return C}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=d3.scale.ordinal(),s=d3.scale.linear(),o=Math.floor(Math.random()*1e4),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=true,c=false,h="zero",p=e.utils.defaultColor(),d=false,v=null,m,g=1200,y,b,w,E,S=.1,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var T,N;C.dispatch=x;C.options=e.utils.optionsFunc.bind(C);C.x=function(e){if(!arguments.length)return u;u=e;return C};C.y=function(e){if(!arguments.length)return a;a=e;return C};C.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return C};C.width=function(e){if(!arguments.length)return n;n=e;return C};C.height=function(e){if(!arguments.length)return r;r=e;return C};C.xScale=function(e){if(!arguments.length)return i;i=e;return C};C.yScale=function(e){if(!arguments.length)return s;s=e;return C};C.xDomain=function(e){if(!arguments.length)return y;y=e;return C};C.yDomain=function(e){if(!arguments.length)return b;b=e;return C};C.xRange=function(e){if(!arguments.length)return w;w=e;return C};C.yRange=function(e){if(!arguments.length)return E;E=e;return C};C.forceY=function(e){if(!arguments.length)return f;f=e;return C};C.stacked=function(e){if(!arguments.length)return c;c=e;return C};C.stackOffset=function(e){if(!arguments.length)return h;h=e;return C};C.clipEdge=function(e){if(!arguments.length)return l;l=e;return C};C.color=function(t){if(!arguments.length)return p;p=e.utils.getColor(t);return C};C.barColor=function(t){if(!arguments.length)return v;v=e.utils.getColor(t);return C};C.disabled=function(e){if(!arguments.length)return m;m=e;return C};C.id=function(e){if(!arguments.length)return o;o=e;return C};C.hideable=function(e){if(!arguments.length)return d;d=e;return C};C.delay=function(e){if(!arguments.length)return g;g=e;return C};C.groupSpacing=function(e){if(!arguments.length)return S;S=e;return C};return C};e.models.multiBarChart=function(){"use strict";function M(e){e.each(function(e){var h=d3.select(this),E=this;var _=(u||parseInt(h.style("width"))||960)-o.left-o.right,D=(a||parseInt(h.style("height"))||400)-o.top-o.bottom;M.update=function(){h.transition().duration(A).call(M)};M.container=this;if(w=="right")_=_-250;T.disabled=e.map(function(e){return!!e.disabled});if(!N){var P;N={};for(P in T){if(T[P]instanceof Array)N[P]=T[P].slice(0);else N[P]=T[P]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var H=h.selectAll(".nv-noData").data([C]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");H.attr("x",o.left+_/2).attr("y",o.top+D/2).text(function(e){return e});return M}else{h.selectAll(".nv-noData").remove()}S=t.xScale();x=t.yScale();var B=h.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([e]);var j=B.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g");var F=B.select("g");j.append("g").attr("class","nv-x nv-axis");j.append("g").attr("class","nv-y nv-axis");j.append("g").attr("class","nv-barsWrap");j.append("g").attr("class","nv-legendWrap");j.append("g").attr("class","nv-controlsWrap");if(c){i.width(_-L());if(t.barColor())e.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()});F.select(".nv-legendWrap").datum(e).call(i);if(o.top!=i.height()){o.top=i.height();D=(a||parseInt(h.style("height"))||400)-o.top-o.bottom}if(w=="right"){F.select(".nv-legendWrap").attr("transform","translate("+_+","+(-o.top+20+30)+")")}else{F.select(".nv-legendWrap").attr("transform","translate("+L()+","+ -o.top+")")}}if(l){var I=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(L()).color(["#444","#444","#444"]);F.select(".nv-controlsWrap").datum(I).call(s);if(w=="right"){F.select(".nv-controlsWrap").attr("transform","translate("+_+","+(-o.top+20)+")")}else{F.select(".nv-controlsWrap").attr("transform","translate("+0+","+ -o.top+")")}}B.attr("transform","translate("+o.left+","+o.top+")");if(v){F.select(".nv-y.nv-axis").attr("transform","translate("+_+",0)")}t.disabled(e.map(function(e){return e.disabled})).width(_).height(D).color(e.map(function(e,t){return e.color||f(e,t)}).filter(function(t,n){return!e[n].disabled}));var q=F.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));q.transition().call(t);if(p){n.scale(S).ticks(_/100).tickSize(-D,0);F.select(".nv-x.nv-axis").attr("transform","translate(0,"+x.range()[0]+")");F.select(".nv-x.nv-axis").transition().call(n);var R=F.select(".nv-x.nv-axis > g").selectAll("g");R.selectAll("line, text").style("opacity",1);if(g){var U=function(e,t){return"translate("+e+","+t+")"};var z=5,W=17;R.selectAll("text").attr("transform",function(e,t,n){return U(0,n%2==0?z:W)});var X=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;F.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(e,t){return U(0,t===0||X%2!==0?W:z)})}if(m)R.filter(function(t,n){return n%Math.ceil(e[0].values.length/(_/100))!==0}).selectAll("text, line").style("opacity",0);if(y)R.selectAll(".tick text").attr("transform","rotate("+y+" 0,0)").style("text-anchor",y>0?"start":"end");F.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}if(d){r.scale(x).ticks(D/36).tickSize(-_,0);F.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("stateChange",function(e){T=e;k.stateChange(T);M.update()});s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;I=I.map(function(e){e.disabled=true;return e});e.disabled=false;switch(e.key){case"Grouped":t.stacked(false);break;case"Stacked":t.stacked(true);break}T.stacked=t.stacked();k.stateChange(T);M.update()});k.on("tooltipShow",function(e){if(b)O(e,E.parentNode)});k.on("changeState",function(n){if(typeof n.disabled!=="undefined"){e.forEach(function(e,t){e.disabled=n.disabled[t]});T.disabled=n.disabled}if(typeof n.stacked!=="undefined"){t.stacked(n.stacked);T.stacked=n.stacked}M.update()})});return M}var t=e.models.multiBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend();var o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=true,c=true,h=false,p=true,d=true,v=false,m=true,g=false,y=0,b=true,w="top",E=function(e,t,n,r,i,s){if(s){var o=d3.format(",.2f");return"<h3>"+e+"</h3>"+"<p>"+o(Math.pow(10,n))+" on "+t+"</p>"}else{return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"}},S,x,T={stacked:false},N=null,C="No Data Available.",k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=function(){return l?180:0},A=250;t.stacked(false);n.orient("bottom").tickPadding(7).highlightZero(true).showMaxMin(false).tickFormat(function(e){return e});r.orient(v?"right":"left").tickFormat(d3.format(",.1f"));s.updateState(false);var O=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=E(i.series.key,a,f,i,M,h);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];k.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(b)e.tooltip.cleanup()});M.dispatch=k;M.multibar=t;M.legend=i;M.xAxis=n;M.yAxis=r;d3.rebind(M,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","stacked","stackOffset","delay","barColor","groupSpacing");M.options=e.utils.optionsFunc.bind(M);M.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return M};M.width=function(e){if(!arguments.length)return u;u=e;return M};M.height=function(e){if(!arguments.length)return a;a=e;return M};M.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);i.color(f);return M};M.showControls=function(e){if(!arguments.length)return l;l=e;return M};M.showLegend=function(e){if(!arguments.length)return c;c=e;return M};M.logScale=function(e){if(!arguments.length)return h;h=e;return M};M.showXAxis=function(e){if(!arguments.length)return p;p=e;return M};M.showYAxis=function(e){if(!arguments.length)return d;d=e;return M};M.rightAlignYAxis=function(e){if(!arguments.length)return v;v=e;r.orient(e?"right":"left");return M};M.reduceXTicks=function(e){if(!arguments.length)return m;m=e;return M};M.rotateLabels=function(e){if(!arguments.length)return y;y=e;return M};M.staggerLabels=function(e){if(!arguments.length)return g;g=e;return M};M.tooltip=function(e){if(!arguments.length)return E;E=e;return M};M.tooltips=function(e){if(!arguments.length)return b;b=e;return M};M.legendPos=function(e){if(!arguments.length)return w;w=e;return M};M.tooltipContent=function(e){if(!arguments.length)return E;E=e;return M};M.state=function(e){if(!arguments.length)return T;T=e;return M};M.defaultState=function(e){if(!arguments.length)return N;N=e;return M};M.noData=function(e){if(!arguments.length)return C;C=e;return M};M.transitionDuration=function(e){if(!arguments.length)return A;A=e;return M};return M};e.models.multiBarHorizontal=function(){"use strict";function N(e){e.each(function(e){var i=n-t.left-t.right,g=r-t.top-t.bottom,N=d3.select(this);if(p)e=d3.layout.stack().offset("zero").values(function(e){return e.values}).y(a)(e);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});if(p)e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y);if(t.y<0){t.y1=i-t.size;i=i-t.size}else{t.y1=r;r=r+t.size}})});var C=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});s.domain(y||d3.merge(C).map(function(e){return e.x})).rangeBands(w||[0,g],.1);o.domain(b||d3.extent(d3.merge(C).map(function(e){return p?e.y>0?e.y1+e.y:e.y1:e.y}).concat(f)));if(d&&!p)o.range(E||[o.domain()[0]<0?v:0,i-(o.domain()[1]>0?v:0)]);else o.range(E||[0,i]);x=x||s;T=T||d3.scale.linear().domain(o.domain()).range([o(0),o(0)]);var k=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([e]);var L=k.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal");var A=L.append("defs");var O=L.append("g");var M=k.select("g");O.append("g").attr("class","nv-groups");k.attr("transform","translate("+t.left+","+t.top+")");var _=k.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});_.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);_.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();_.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return l(e,t)}).style("stroke",function(e,t){return l(e,t)});_.transition().style("stroke-opacity",1).style("fill-opacity",.75);var D=_.selectAll("g.nv-bar").data(function(e){return e.values});D.exit().remove();var P=D.enter().append("g").attr("transform",function(t,n,r){return"translate("+T(p?t.y0:0)+","+(p?0:r*s.rangeBand()/e.length+s(u(t,n)))+")"});P.append("rect").attr("width",0).attr("height",s.rangeBand()/(p?1:e.length));D.on("mouseover",function(t,n){d3.select(this).classed("hover",true);S.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[o(a(t,n)+(p?t.y0:0)),s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);S.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){S.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){S.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});P.append("text");if(d&&!p){D.select("text").attr("text-anchor",function(e,t){return a(e,t)<0?"end":"start"}).attr("y",s.rangeBand()/(e.length*2)).attr("dy",".32em").text(function(e,t){return m(a(e,t))});D.transition().select("text").attr("x",function(e,t){return a(e,t)<0?-4:o(a(e,t))-o(0)+4})}else{D.selectAll("text").text("")}D.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"});if(c){if(!h)h=e.map(function(){return true});D.style("fill",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()})}if(p)D.transition().attr("transform",function(e,t){return"translate("+o(e.y1)+","+s(u(e,t))+")"}).select("rect").attr("width",function(e,t){return Math.abs(o(a(e,t)+e.y0)-o(e.y0))}).attr("height",s.rangeBand());else D.transition().attr("transform",function(t,n){return"translate("+(a(t,n)<0?o(a(t,n)):o(0))+","+(t.series*s.rangeBand()/e.length+s(u(t,n)))+")"}).select("rect").attr("height",s.rangeBand()/e.length).attr("width",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(0)),1)});x=s.copy();T=o.copy()});return N}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=null,h,p=false,d=false,v=60,m=d3.format(",.2f"),g=1200,y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var x,T;N.dispatch=S;N.options=e.utils.optionsFunc.bind(N);N.x=function(e){if(!arguments.length)return u;u=e;return N};N.y=function(e){if(!arguments.length)return a;a=e;return N};N.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return N};N.width=function(e){if(!arguments.length)return n;n=e;return N};N.height=function(e){if(!arguments.length)return r;r=e;return N};N.xScale=function(e){if(!arguments.length)return s;s=e;return N};N.yScale=function(e){if(!arguments.length)return o;o=e;return N};N.xDomain=function(e){if(!arguments.length)return y;y=e;return N};N.yDomain=function(e){if(!arguments.length)return b;b=e;return N};N.xRange=function(e){if(!arguments.length)return w;w=e;return N};N.yRange=function(e){if(!arguments.length)return E;E=e;return N};N.forceY=function(e){if(!arguments.length)return f;f=e;return N};N.stacked=function(e){if(!arguments.length)return p;p=e;return N};N.color=function(t){if(!arguments.length)return l;l=e.utils.getColor(t);return N};N.barColor=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);return N};N.disabled=function(e){if(!arguments.length)return h;h=e;return N};N.id=function(e){if(!arguments.length)return i;i=e;return N};N.delay=function(e){if(!arguments.length)return g;g=e;return N};N.showValues=function(e){if(!arguments.length)return d;d=e;return N};N.valueFormat=function(e){if(!arguments.length)return m;m=e;return N};N.valuePadding=function(e){if(!arguments.length)return v;v=e;return N};return N};e.models.multiBarHorizontalChart=function(){"use strict";function C(e){e.each(function(h){var p=d3.select(this),m=this;var k=(u||parseInt(p.style("width"))||960)-o.left-o.right,L=(a||parseInt(p.style("height"))||400)-o.top-o.bottom;C.update=function(){p.transition().duration(T).call(C)};C.container=this;if(v=="right")k=k-250;b.disabled=h.map(function(e){return!!e.disabled});if(!w){var A;w={};for(A in b){if(b[A]instanceof Array)w[A]=b[A].slice(0);else w[A]=b[A]}}if(!h||!h.length||!h.filter(function(e){return e.values.length}).length){var O=p.selectAll(".nv-noData").data([E]);O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");O.attr("x",o.left+k/2).attr("y",o.top+L/2).text(function(e){return e});return C}else{p.selectAll(".nv-noData").remove()}g=t.xScale();y=t.yScale();var M=p.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([h]);var _=M.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g");var D=M.select("g");_.append("g").attr("class","nv-x nv-axis");_.append("g").attr("class","nv-y nv-axis");_.append("g").attr("class","nv-barsWrap");_.append("g").attr("class","nv-legendWrap");_.append("g").attr("class","nv-controlsWrap");if(c){i.width(k-x());if(t.barColor())h.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()});D.select(".nv-legendWrap").datum(h).call(i);if(o.top!=i.height()){o.top=i.height();L=(a||parseInt(p.style("height"))||400)-o.top-o.bottom}if(v=="right"){D.select(".nv-legendWrap").attr("transform","translate("+x()+","+20+")")}else{D.select(".nv-legendWrap").attr("transform","translate("+x()+","+ -o.top+")")}}if(l){var P=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(x()).color(["#444","#444","#444"]);D.select(".nv-controlsWrap").datum(P).attr("transform","translate(0,"+ -o.top+")").call(s)}M.attr("transform","translate("+o.left+","+o.top+")");t.disabled(h.map(function(e){return e.disabled})).width(k).height(L).color(h.map(function(e,t){return e.color||f(e,t)}).filter(function(e,t){return!h[t].disabled}));var H=D.select(".nv-barsWrap").datum(h.filter(function(e){return!e.disabled}));H.transition().call(t);n.scale(g).ticks(L/24).tickSize(-k,0);D.select(".nv-x.nv-axis").transition().call(n);var B=D.select(".nv-x.nv-axis").selectAll("g");B.selectAll("line, text").style("opacity",1);r.scale(y).ticks(k/100).tickSize(-L,0);D.select(".nv-y.nv-axis").attr("transform","translate(0,"+L+")");D.select(".nv-y.nv-axis").transition().call(r);i.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);C.update()});s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;P=P.map(function(e){e.disabled=true;return e});e.disabled=false;switch(e.key){case"Grouped":t.stacked(false);break;case"Stacked":t.stacked(true);break}b.stacked=t.stacked();S.stateChange(b);C.update()});S.on("tooltipShow",function(e){if(d)N(e,m.parentNode)});S.on("changeState",function(n){if(typeof n.disabled!=="undefined"){h.forEach(function(e,t){e.disabled=n.disabled[t]});b.disabled=n.disabled}if(typeof n.stacked!=="undefined"){t.stacked(n.stacked);b.stacked=n.stacked}e.call(C)})});return C}var t=e.models.multiBarHorizontal(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend().height(30),s=e.models.legend().height(30);var o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=true,c=true,h=false,p=false,d=true,v="top",m=function(e,t,n,i,s,o){if(o){return"<h3>"+e+" - "+t+"</h3>"+"<p>"+r.tickFormat()(Math.pow(10,n))+"</p>"}else{return"<h3>"+e+" - "+t+"</h3>"+"<p>"+n+"</p>"}},g,y,b={stacked:p},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=function(){return l?180:0},T=250;t.stacked(p);n.orient("left").tickPadding(5).highlightZero(false).showMaxMin(false).tickFormat(function(e){return e});r.orient("bottom").tickFormat(d3.format(",.1f"));s.updateState(false);var N=function(i,s){var o=0;if(i.pos[0]>=200)o=200;else o=i.pos[0];if(h)l=t.y()(i.point,i.pointIndex);else l=r.tickFormat()(t.y()(i.point,i.pointIndex));var u=o+(s.offsetLeft||0),a=i.pos[1]+(s.offsetTop||0),f=n.tickFormat()(t.x()(i.point,i.pointIndex)),l=r.tickFormat()(t.y()(i.point,i.pointIndex)),c=m(i.series.key,f,l,i,C,h);e.tooltip.show([u,a],c,i.value<0?"e":"w",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(d)e.tooltip.cleanup()});C.dispatch=S;C.multibar=t;C.legend=i;C.xAxis=n;C.yAxis=r;d3.rebind(C,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked","barColor");C.options=e.utils.optionsFunc.bind(C);C.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return C};C.width=function(e){if(!arguments.length)return u;u=e;return C};C.height=function(e){if(!arguments.length)return a;a=e;return C};C.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);i.color(f);return C};C.showControls=function(e){if(!arguments.length)return l;l=e;return C};C.showLegend=function(e){if(!arguments.length)return c;c=e;return C};C.logScale=function(e){if(!arguments.length)return h;h=e;return C};C.tooltip=function(e){if(!arguments.length)return m;m=e;return C};C.tooltips=function(e){if(!arguments.length)return d;d=e;return C};C.legendPos=function(e){if(!arguments.length)return v;v=e;return C};C.tooltipContent=function(e){if(!arguments.length)return m;m=e;return C};C.state=function(e){if(!arguments.length)return b;b=e;return C};C.defaultState=function(e){if(!arguments.length)return w;w=e;return C};C.noData=function(e){if(!arguments.length)return E;E=e;return C};C.transitionDuration=function(e){if(!arguments.length)return T;T=e;return C};return C};e.models.multiChart=function(){"use strict";function L(e){e.each(function(e){var f=d3.select(this),c=this;L.update=function(){f.transition().call(L)};L.container=this;var h=(r||parseInt(f.style("width"))||960)-t.left-t.right,p=(i||parseInt(f.style("height"))||400)-t.top-t.bottom;if(a=="right")h=h-250;var A=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==1});var O=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==2});var M=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==1});var _=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==2});var D=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==1});var P=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==2});var H=e.filter(function(e){return!e.disabled&&e.yAxis==1}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});var B=e.filter(function(e){return!e.disabled&&e.yAxis==2}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});l.domain(d3.extent(d3.merge(H.concat(B)),function(e){return e.x})).range([0,h]);var j=f.selectAll("g.wrap.multiChart").data([e]);var F=j.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");F.append("g").attr("class","x axis");F.append("g").attr("class","y1 axis");F.append("g").attr("class","y2 axis");F.append("g").attr("class","lines1Wrap");F.append("g").attr("class","lines2Wrap");F.append("g").attr("class","bars1Wrap");F.append("g").attr("class","bars2Wrap");F.append("g").attr("class","stack1Wrap");F.append("g").attr("class","stack2Wrap");F.append("g").attr("class","legendWrap");var I=j.select("g");if(s){N.width(h/2);I.select(".legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.yAxis==1?"":" (right axis)");return e})).call(N);if(t.top!=N.height()){t.top=N.height();p=(i||parseInt(f.style("height"))||400)-t.top-t.bottom}if(a=="right"){I.select(".legendWrap").attr("transform","translate("+h+","+20+")")}else{I.select(".legendWrap").attr("transform","translate("+h/2+","+ -t.top+")")}}m.width(h).height(p).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="line"}));g.width(h).height(p).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="line"}));y.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="bar"}));b.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="bar"}));w.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="area"}));E.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="area"}));if(a=="right"){I.attr("transform","translate("+t.left+","+"20"+")")}else{I.attr("transform","translate("+t.left+","+t.top+")")}var q=I.select(".lines1Wrap").datum(A);var R=I.select(".bars1Wrap").datum(M);var U=I.select(".stack1Wrap").datum(D);var z=I.select(".lines2Wrap").datum(O);var W=I.select(".bars2Wrap").datum(_);var X=I.select(".stack2Wrap").datum(P);var V=D.length?D.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];var $=P.length?P.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];d.domain(d3.extent(d3.extent(d3.merge(H).concat(V),function(e){return e.y}).concat(m.forceY()))).range([0,p]);v.domain(d3.extent(d3.extent(d3.merge(B).concat($),function(e){return e.y}).concat(g.forceY()))).range([0,p]);m.yDomain(d.domain());y.yDomain(d.domain());w.yDomain(d.domain());g.yDomain(v.domain());b.yDomain(v.domain());E.yDomain(v.domain());if(D.length){d3.transition(U).call(w)}if(P.length){d3.transition(X).call(E)}if(M.length){d3.transition(R).call(y)}if(_.length){d3.transition(W).call(b)}if(A.length){d3.transition(q).call(m)}if(O.length){d3.transition(z).call(g)}S.ticks(h/100).tickSize(-p,0);I.select(".x.axis").attr("transform","translate(0,"+p+")");d3.transition(I.select(".x.axis")).call(S);x.ticks(p/36).tickSize(-h,0);d3.transition(I.select(".y1.axis")).call(x);T.ticks(p/36).tickSize(-h,0);d3.transition(I.select(".y2.axis")).call(T);I.select(".y2.axis").style("opacity",B.length?1:0).attr("transform","translate("+l.range()[1]+",0)");N.dispatch.on("stateChange",function(e){L.update()});if(u){N.dualaxis(true)}else{N.dualaxis(false)}C.on("tooltipShow",function(e){if(o)k(e,c.parentNode)})});return L}var t={top:30,right:20,bottom:50,left:60},n=d3.scale.category20().range(),r=null,i=null,s=true,o=true,u=false,a="top",f=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},l,c,h,p;var l=d3.scale.linear(),d=d3.scale.linear(),v=d3.scale.linear(),m=e.models.line().yScale(d),g=e.models.line().yScale(v),y=e.models.multiBar().stacked(false).yScale(d),b=e.models.multiBar().stacked(false).yScale(v),w=e.models.stackedArea().yScale(d),E=e.models.stackedArea().yScale(v),S=e.models.axis().scale(l).orient("bottom").tickPadding(5),x=e.models.axis().scale(d).orient("left"),T=e.models.axis().scale(v).orient("right"),N=e.models.legend().height(30),C=d3.dispatch("tooltipShow","tooltipHide");var k=function(t,n){var r=t.pos[0]+(n.offsetLeft||0),i=t.pos[1]+(n.offsetTop||0),s=S.tickFormat()(m.x()(t.point,t.pointIndex)),o=(t.series.yAxis==2?T:x).tickFormat()(m.y()(t.point,t.pointIndex)),u=f(t.series.key,s,o,t,L);e.tooltip.show([r,i],u,undefined,undefined,n.offsetParent)};m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});m.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});g.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});y.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});y.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});b.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});b.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});w.dispatch.on("tooltipShow",function(e){if(!Math.round(w.y()(e.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],C.tooltipShow(e)});w.dispatch.on("tooltipHide",function(e){C.tooltipHide(e)});E.dispatch.on("tooltipShow",function(e){if(!Math.round(E.y()(e.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],C.tooltipShow(e)});E.dispatch.on("tooltipHide",function(e){C.tooltipHide(e)});m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});m.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});g.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});C.on("tooltipHide",function(){if(o)e.tooltip.cleanup()});L.dispatch=C;L.lines1=m;L.lines2=g;L.bars1=y;L.bars2=b;L.stack1=w;L.stack2=E;L.xAxis=S;L.yAxis1=x;L.yAxis2=T;L.options=e.utils.optionsFunc.bind(L);L.x=function(e){if(!arguments.length)return getX;getX=e;m.x(e);y.x(e);return L};L.y=function(e){if(!arguments.length)return getY;getY=e;m.y(e);y.y(e);return L};L.yDomain1=function(e){if(!arguments.length)return h;h=e;return L};L.yDomain2=function(e){if(!arguments.length)return p;p=e;return L};L.margin=function(e){if(!arguments.length)return t;t=e;return L};L.width=function(e){if(!arguments.length)return r;r=e;return L};L.height=function(e){if(!arguments.length)return i;i=e;return L};L.color=function(e){if(!arguments.length)return n;n=e;N.color(e);return L};L.showLegend=function(e){if(!arguments.length)return s;s=e;return L};L.tooltips=function(e){if(!arguments.length)return o;o=e;return L};L.dualaxis=function(e){if(!arguments.length)return u;u=e;return L};L.legendPos=function(e){if(!arguments.length)return a;a=e;return L};L.tooltipContent=function(e){if(!arguments.length)return f;f=e;return L};return L};e.models.ohlcBar=function(){"use strict";function x(e){e.each(function(e){var g=n-t.left-t.right,x=r-t.top-t.bottom,T=d3.select(this);s.domain(y||d3.extent(e[0].values.map(u).concat(p)));if(v)s.range(w||[g*.5/e[0].values.length,g*(e[0].values.length-.5)/e[0].values.length]);else s.range(w||[0,g]);o.domain(b||[d3.min(e[0].values.map(h).concat(d)),d3.max(e[0].values.map(c).concat(d))]).range(E||[x,0]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1]);if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]);var N=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([e[0].values]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar");var k=C.append("defs");var L=C.append("g");var A=N.select("g");L.append("g").attr("class","nv-ticks");N.attr("transform","translate("+t.left+","+t.top+")");T.on("click",function(e,t){S.chartClick({data:e,index:t,pos:d3.event,id:i})});k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect");N.select("#nv-chart-clip-path-"+i+" rect").attr("width",g).attr("height",x);A.attr("clip-path",m?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-ticks").selectAll(".nv-tick").data(function(e){return e});O.exit().remove();var M=O.enter().append("path").attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"}).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);S.elementMouseover({point:t,series:e[0],pos:[s(u(t,n)),o(a(t,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);S.elementMouseout({point:t,series:e[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(e,t){S.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()}).on("dblclick",function(e,t){S.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()});O.attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t});d3.transition(O).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"})});return x}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=function(e){return e.open},l=function(e){return e.close},c=function(e){return e.high},h=function(e){return e.low},p=[],d=[],v=false,m=true,g=e.utils.defaultColor(),y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");x.dispatch=S;x.options=e.utils.optionsFunc.bind(x);x.x=function(e){if(!arguments.length)return u;u=e;return x};x.y=function(e){if(!arguments.length)return a;a=e;return x};x.open=function(e){if(!arguments.length)return f;f=e;return x};x.close=function(e){if(!arguments.length)return l;l=e;return x};x.high=function(e){if(!arguments.length)return c;c=e;return x};x.low=function(e){if(!arguments.length)return h;h=e;return x};x.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return x};x.width=function(e){if(!arguments.length)return n;n=e;return x};x.height=function(e){if(!arguments.length)return r;r=e;return x};x.xScale=function(e){if(!arguments.length)return s;s=e;return x};x.yScale=function(e){if(!arguments.length)return o;o=e;return x};x.xDomain=function(e){if(!arguments.length)return y;y=e;return x};x.yDomain=function(e){if(!arguments.length)return b;b=e;return x};x.xRange=function(e){if(!arguments.length)return w;w=e;return x};x.yRange=function(e){if(!arguments.length)return E;E=e;return x};x.forceX=function(e){if(!arguments.length)return p;p=e;return x};x.forceY=function(e){if(!arguments.length)return d;d=e;return x};x.padData=function(e){if(!arguments.length)return v;v=e;return x};x.clipEdge=function(e){if(!arguments.length)return m;m=e;return x};x.color=function(t){if(!arguments.length)return g;g=e.utils.getColor(t);return x};x.id=function(e){if(!arguments.length)return i;i=e;return x};return x};e.models.pie=function(){"use strict";function E(e){e.each(function(e){function P(e){var t=(e.startAngle+e.endAngle)*90/Math.PI-90;return t>90?t-180:t}function H(e){e.endAngle=isNaN(e.endAngle)?0:e.endAngle;e.startAngle=isNaN(e.startAngle)?0:e.startAngle;if(!v)e.innerRadius=0;var t=d3.interpolate(this._current,e);this._current=t(0);return function(e){return L(t(e))}}function B(e){e.innerRadius=0;var t=d3.interpolate({startAngle:0,endAngle:0},e);return function(e){return L(t(e))}}var o=n-t.left-t.right,f=r-t.top-t.bottom,E=Math.min(o,f)/2,S=E-E/5,x=d3.select(this);var T=x.selectAll(".nv-wrap.nv-pie").data(e);var N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+u);var C=N.append("g");var k=T.select("g");C.append("g").attr("class","nv-pie");T.attr("transform","translate("+t.left+","+t.top+")");k.select(".nv-pie").attr("transform","translate("+o/2+","+f/2+")");x.on("click",function(e,t){w.chartClick({data:e,index:t,pos:d3.event,id:u})});var L=d3.svg.arc().outerRadius(S);if(g)L.startAngle(g);if(y)L.endAngle(y);if(v)L.innerRadius(E*b);var A=d3.layout.pie().sort(null).value(function(e){return e.disabled?0:s(e)});var O=T.select(".nv-pie").selectAll(".nv-slice").data(A);O.exit().remove();var M=O.enter().append("g").attr("class","nv-slice").on("mouseover",function(e,t){d3.select(this).classed("hover",true);w.elementMouseover({label:i(e.data),value:s(e.data),point:e.data,pointIndex:t,pos:[d3.event.pageX,d3.event.pageY],id:u})}).on("mouseout",function(e,t){d3.select(this).classed("hover",false);w.elementMouseout({label:i(e.data),value:s(e.data),point:e.data,index:t,id:u})}).on("click",function(e,t){w.elementClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u});d3.event.stopPropagation()}).on("dblclick",function(e,t){w.elementDblClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u});d3.event.stopPropagation()});O.attr("fill",function(e,t){return a(e,t)}).attr("stroke",function(e,t){return a(e,t)});var _=M.append("path").each(function(e){this._current=e});d3.transition(O.select("path")).attr("d",L).attrTween("d",H);if(l){var D=d3.svg.arc().innerRadius(0);if(c){D=L}if(h){D=d3.svg.arc().outerRadius(L.outerRadius())}M.append("g").classed("nv-label",true).each(function(e,t){var n=d3.select(this);n.attr("transform",function(e){if(m){e.outerRadius=S+10;e.innerRadius=S+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);if((e.startAngle+e.endAngle)/2<Math.PI){t-=90}else{t+=90}return"translate("+D.centroid(e)+") rotate("+t+")"}else{e.outerRadius=E+10;e.innerRadius=E+15;return"translate("+D.centroid(e)+")"}});n.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3);n.append("text").style("text-anchor",m?(e.startAngle+e.endAngle)/2<Math.PI?"start":"end":"middle").style("fill","#000")});O.select(".nv-label").transition().attr("transform",function(e){if(m){e.outerRadius=S+10;e.innerRadius=S+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);if((e.startAngle+e.endAngle)/2<Math.PI){t-=90}else{t+=90}return"translate("+D.centroid(e)+") rotate("+t+")"}else{e.outerRadius=E+10;e.innerRadius=E+15;return"translate("+D.centroid(e)+")"}});O.each(function(e,t){var n=d3.select(this);n.select(".nv-label text").style("text-anchor",m?(e.startAngle+e.endAngle)/2<Math.PI?"start":"end":"middle").text(function(e,t){var n=(e.endAngle-e.startAngle)/(2*Math.PI);var r={key:i(e.data),value:s(e.data),percent:d3.format("%")(n)};return e.value&&n>d?r[p]:""});var r=n.select("text").node().getBBox();n.select(".nv-label rect").attr("width",r.width+10).attr("height",r.height+10).attr("transform",function(){return"translate("+[r.x-5,r.y-5]+")"})})}});return E}var t={top:0,right:0,bottom:0,left:0},n=500,r=500,i=function(e){return e.x},s=function(e){return e.y},o=function(e){return e.description},u=Math.floor(Math.random()*1e4),a=e.utils.defaultColor(),f=d3.format(",.2f"),l=true,c=true,h=false,p="key",d=.02,v=false,m=false,g=false,y=false,b=.5,w=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");E.dispatch=w;E.options=e.utils.optionsFunc.bind(E);E.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return E};E.width=function(e){if(!arguments.length)return n;n=e;return E};E.height=function(e){if(!arguments.length)return r;r=e;return E};E.values=function(t){e.log("pie.values() is no longer supported.");return E};E.x=function(e){if(!arguments.length)return i;i=e;return E};E.y=function(e){if(!arguments.length)return s;s=d3.functor(e);return E};E.description=function(e){if(!arguments.length)return o;o=e;return E};E.showLabels=function(e){if(!arguments.length)return l;l=e;return E};E.labelSunbeamLayout=function(e){if(!arguments.length)return m;m=e;return E};E.donutLabelsOutside=function(e){if(!arguments.length)return h;h=e;return E};E.pieLabelsOutside=function(e){if(!arguments.length)return c;c=e;return E};E.labelType=function(e){if(!arguments.length)return p;p=e;p=p||"key";return E};E.donut=function(e){if(!arguments.length)return v;v=e;return E};E.donutRatio=function(e){if(!arguments.length)return b;b=e;return E};E.startAngle=function(e){if(!arguments.length)return g;g=e;return E};E.endAngle=function(e){if(!arguments.length)return y;y=e;return E};E.id=function(e){if(!arguments.length)return u;u=e;return E};E.color=function(t){if(!arguments.length)return a;a=e.utils.getColor(t);return E};E.valueFormat=function(e){if(!arguments.length)return f;f=e;return E};E.labelThreshold=function(e){if(!arguments.length)return d;d=e;return E};return E};e.models.pieChart=function(){"use strict";function v(e){e.each(function(e){var u=d3.select(this),a=this;var f=(i||parseInt(u.style("width"))||960)-r.left-r.right,d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom;v.update=function(){u.transition().call(v)};v.container=this;l.disabled=e.map(function(e){return!!e.disabled});if(!c){var m;c={};for(m in l){if(l[m]instanceof Array)c[m]=l[m].slice(0);else c[m]=l[m]}}if(!e||!e.length){var g=u.selectAll(".nv-noData").data([h]);g.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");g.attr("x",r.left+f/2).attr("y",r.top+d/2).text(function(e){return e});return v}else{u.selectAll(".nv-noData").remove()}var y=u.selectAll("g.nv-wrap.nv-pieChart").data([e]);var b=y.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g");var w=y.select("g");b.append("g").attr("class","nv-pieWrap");b.append("g").attr("class","nv-legendWrap");if(o){n.width(f).key(t.x());y.select(".nv-legendWrap").datum(e).call(n);if(r.top!=n.height()){r.top=n.height();d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom}y.select(".nv-legendWrap").attr("transform","translate(0,"+ -r.top+")")}y.attr("transform","translate("+r.left+","+r.top+")");t.width(f).height(d);var E=w.select(".nv-pieWrap").datum([e]);d3.transition(E).call(t);n.dispatch.on("stateChange",function(e){l=e;p.stateChange(l);v.update()});t.dispatch.on("elementMouseout.tooltip",function(e){p.tooltipHide(e)});p.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});l.disabled=t.disabled}v.update()})});return v}var t=e.models.pie(),n=e.models.legend();var r={top:30,right:20,bottom:20,left:20},i=null,s=null,o=true,u=e.utils.defaultColor(),a=true,f=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+t+"</p>"},l={},c=null,h="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");var d=function(n,r){var i=t.description()(n.point)||t.x()(n.point);var s=n.pos[0]+(r&&r.offsetLeft||0),o=n.pos[1]+(r&&r.offsetTop||0),u=t.valueFormat()(t.y()(n.point)),a=f(i,u,n,v);e.tooltip.show([s,o],a,n.value<0?"n":"s",null,r)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+r.left,e.pos[1]+r.top];p.tooltipShow(e)});p.on("tooltipShow",function(e){if(a)d(e)});p.on("tooltipHide",function(){if(a)e.tooltip.cleanup()});v.legend=n;v.dispatch=p;v.pie=t;d3.rebind(v,t,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","labelType","donut","donutRatio","labelThreshold");v.options=e.utils.optionsFunc.bind(v);v.margin=function(e){if(!arguments.length)return r;r.top=typeof e.top!="undefined"?e.top:r.top;r.right=typeof e.right!="undefined"?e.right:r.right;r.bottom=typeof e.bottom!="undefined"?e.bottom:r.bottom;r.left=typeof e.left!="undefined"?e.left:r.left;return v};v.width=function(e){if(!arguments.length)return i;i=e;return v};v.height=function(e){if(!arguments.length)return s;s=e;return v};v.color=function(r){if(!arguments.length)return u;u=e.utils.getColor(r);n.color(u);t.color(u);return v};v.showLegend=function(e){if(!arguments.length)return o;o=e;return v};v.tooltips=function(e){if(!arguments.length)return a;a=e;return v};v.tooltipContent=function(e){if(!arguments.length)return f;f=e;return v};v.state=function(e){if(!arguments.length)return l;l=e;return v};v.defaultState=function(e){if(!arguments.length)return c;c=e;return v};v.noData=function(e){if(!arguments.length)return h;h=e;return v};return v};e.models.scatter=function(){"use strict";function I(q){q.each(function(I){function Q(){if(!g)return false;var e;var i=d3.merge(I.map(function(e,t){return e.values.map(function(e,n){var r=f(e,n);var i=l(e,n);return[o(r)+Math.random()*1e-7,u(i)+Math.random()*1e-7,t,n,e]}).filter(function(e,t){return b(e[4],t)})}));if(D===true){if(x){var a=X.select("defs").selectAll(".nv-point-clips").data([s]).enter();a.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+s);var c=X.select("#nv-points-clip-"+s).selectAll("circle").data(i);c.enter().append("circle").attr("r",T);c.exit().remove();c.attr("cx",function(e){return e[0]}).attr("cy",function(e){return e[1]});X.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+s+")")}if(i.length){i.push([o.range()[0]-20,u.range()[0]-20,null,null]);i.push([o.range()[1]+20,u.range()[1]+20,null,null]);i.push([o.range()[0]-20,u.range()[0]+20,null,null]);i.push([o.range()[1]+20,u.range()[1]-20,null,null])}var h=d3.geom.polygon([[-10,-10],[-10,r+10],[n+10,r+10],[n+10,-10]]);var p=d3.geom.voronoi(i).map(function(e,t){return{data:h.clip(e),series:i[t][2],point:i[t][3]}});var d=X.select(".nv-point-paths").selectAll("path").data(p);d.enter().append("path").attr("class",function(e,t){return"nv-path-"+t});d.exit().remove();d.attr("d",function(e){if(e.data.length===0)return"M 0 0";else return"M"+e.data.join("L")+"Z"});var v=function(e,n){if(F)return 0;var r=I[e.series];if(typeof r==="undefined")return;var i=r.values[e.point];n({point:i,series:r,pos:[o(f(i,e.point))+t.left,u(l(i,e.point))+t.top],seriesIndex:e.series,pointIndex:e.point})};d.on("click",function(e){v(e,_.elementClick)}).on("mouseover",function(e){v(e,_.elementMouseover)}).on("mouseout",function(e,t){v(e,_.elementMouseout)})}else{X.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementClick({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseover",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementMouseover({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseout",function(e,t){if(F||!I[e.series])return 0;var n=I[e.series],r=n.values[t];_.elementMouseout({point:r,series:n,seriesIndex:e.series,pointIndex:t})})}F=false}var q=n-t.left-t.right,R=r-t.top-t.bottom,U=d3.select(this);I.forEach(function(e,t){e.values.forEach(function(e){e.series=t})});var W=N&&C&&A?[]:d3.merge(I.map(function(e){return e.values.map(function(e,t){return{x:f(e,t),y:l(e,t),size:c(e,t)}})}));o.domain(N||d3.extent(W.map(function(e){return e.x}).concat(d)));if(w&&I[0])o.range(k||[(q*E+q)/(2*I[0].values.length),q-q*(1+E)/(2*I[0].values.length)]);else o.range(k||[0,q]);u.domain(C||d3.extent(W.map(function(e){return e.y}).concat(v))).range(L||[R,0]);a.domain(A||d3.extent(W.map(function(e){return e.size}).concat(m))).range(O||[16,256]);if(o.domain()[0]===o.domain()[1]||u.domain()[0]===u.domain()[1])M=true;if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]-o.domain()[0]*.01,o.domain()[1]+o.domain()[1]*.01]):o.domain([-1,1]);if(u.domain()[0]===u.domain()[1])u.domain()[0]?u.domain([u.domain()[0]-u.domain()[0]*.01,u.domain()[1]+u.domain()[1]*.01]):u.domain([-1,1]);if(isNaN(o.domain()[0])){o.domain([-1,1])}if(isNaN(u.domain()[0])){u.domain([-1,1])}P=P||o;H=H||u;B=B||a;var X=U.selectAll("g.nv-wrap.nv-scatter").data([I]);var V=X.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+s+(M?" nv-single-point":""));var $=V.append("defs");var J=V.append("g");var K=X.select("g");J.append("g").attr("class","nv-groups");J.append("g").attr("class","nv-point-paths");X.attr("transform","translate("+t.left+","+t.top+")");$.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect");X.select("#nv-edge-clip-"+s+" rect").attr("width",q).attr("height",R);K.attr("clip-path",S?"url(#nv-edge-clip-"+s+")":"");F=true;var G=X.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});G.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);G.exit().remove();G.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover});G.transition().style("fill",function(e,t){return i(e,t)}).style("stroke",function(e,t){return i(e,t)}).style("stroke-opacity",1).style("fill-opacity",.5);if(p){var Y=G.selectAll("circle.nv-point").data(function(e){return e.values},y);Y.enter().append("circle").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("cx",function(t,n){return e.utils.NaNtoZero(P(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(H(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)});Y.exit().remove();G.exit().selectAll("path.nv-point").transition().attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).remove();Y.each(function(e,t){d3.select(this).classed("nv-point",true).classed("nv-point-"+t,true).classed("hover",false)});Y.transition().attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)})}else{var Y=G.selectAll("path.nv-point").data(function(e){return e.values});Y.enter().append("path").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("transform",function(e,t){return"translate("+P(f(e,t))+","+H(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}));Y.exit().remove();G.exit().selectAll("path.nv-point").transition().attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).remove();Y.each(function(e,t){d3.select(this).classed("nv-point",true).classed("nv-point-"+t,true).classed("hover",false)});Y.transition().attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}))}clearTimeout(j);j=setTimeout(Q,300);P=o.copy();H=u.copy();B=a.copy()});return I}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=d3.scale.linear(),u=d3.scale.linear(),a=d3.scale.linear(),f=function(e){return e.x},l=function(e){return e.y},c=function(e){return e.size||1},h=function(e){return e.shape||"circle"},p=true,d=[],v=[],m=[],g=true,y=null,b=function(e){return!e.notActive},w=false,E=.1,S=false,x=true,T=function(){return 25},N=null,C=null,k=null,L=null,A=null,O=null,M=false,_=d3.dispatch("elementClick","elementMouseover","elementMouseout"),D=true;var P,H,B,j,F=false;I.clearHighlights=function(){d3.selectAll(".nv-chart-"+s+" .nv-point.hover").classed("hover",false)};I.highlightPoint=function(e,t,n){d3.select(".nv-chart-"+s+" .nv-series-"+e+" .nv-point-"+t).classed("hover",n)};_.on("elementMouseover.point",function(e){if(g)I.highlightPoint(e.seriesIndex,e.pointIndex,true)});_.on("elementMouseout.point",function(e){if(g)I.highlightPoint(e.seriesIndex,e.pointIndex,false)});I.dispatch=_;I.options=e.utils.optionsFunc.bind(I);I.x=function(e){if(!arguments.length)return f;f=d3.functor(e);return I};I.y=function(e){if(!arguments.length)return l;l=d3.functor(e);return I};I.size=function(e){if(!arguments.length)return c;c=d3.functor(e);return I};I.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return I};I.width=function(e){if(!arguments.length)return n;n=e;return I};I.height=function(e){if(!arguments.length)return r;r=e;return I};I.xScale=function(e){if(!arguments.length)return o;o=e;return I};I.yScale=function(e){if(!arguments.length)return u;u=e;return I};I.zScale=function(e){if(!arguments.length)return a;a=e;return I};I.xDomain=function(e){if(!arguments.length)return N;N=e;return I};I.yDomain=function(e){if(!arguments.length)return C;C=e;return I};I.sizeDomain=function(e){if(!arguments.length)return A;A=e;return I};I.xRange=function(e){if(!arguments.length)return k;k=e;return I};I.yRange=function(e){if(!arguments.length)return L;L=e;return I};I.sizeRange=function(e){if(!arguments.length)return O;O=e;return I};I.forceX=function(e){if(!arguments.length)return d;d=e;return I};I.forceY=function(e){if(!arguments.length)return v;v=e;return I};I.forceSize=function(e){if(!arguments.length)return m;m=e;return I};I.interactive=function(e){if(!arguments.length)return g;g=e;return I};I.pointKey=function(e){if(!arguments.length)return y;y=e;return I};I.pointActive=function(e){if(!arguments.length)return b;b=e;return I};I.padData=function(e){if(!arguments.length)return w;w=e;return I};I.padDataOuter=function(e){if(!arguments.length)return E;E=e;return I};I.clipEdge=function(e){if(!arguments.length)return S;S=e;return I};I.clipVoronoi=function(e){if(!arguments.length)return x;x=e;return I};I.useVoronoi=function(e){if(!arguments.length)return D;D=e;if(D===false){x=false}return I};I.clipRadius=function(e){if(!arguments.length)return T;T=e;return I};I.color=function(t){if(!arguments.length)return i;i=e.utils.getColor(t);return I};I.shape=function(e){if(!arguments.length)return h;h=e;return I};I.onlyCircles=function(e){if(!arguments.length)return p;p=e;return I};I.id=function(e){if(!arguments.length)return s;s=e;return I};I.singlePoint=function(e){if(!arguments.length)return M;M=e;return I};return I};e.models.scatterChart=function(){"use strict";function F(e){e.each(function(e){function K(){if(T){X.select(".nv-point-paths").style("pointer-events","all");return false}X.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(x).focus(i[0]);p.distortion(x).focus(i[1]);X.select(".nv-scatterWrap").call(t);if(b)X.select(".nv-x.nv-axis").call(n);if(w)X.select(".nv-y.nv-axis").call(r);X.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o);X.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var C=d3.select(this),k=this;var L=(f||parseInt(C.style("width"))||960)-a.left-a.right,I=(l||parseInt(C.style("height"))||400)-a.top-a.bottom;F.update=function(){C.transition().duration(D).call(F)};F.container=this;A.disabled=e.map(function(e){return!!e.disabled});if(!O){var q;O={};for(q in A){if(A[q]instanceof Array)O[q]=A[q].slice(0);else O[q]=A[q]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var R=C.selectAll(".nv-noData").data([_]);R.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");R.attr("x",a.left+L/2).attr("y",a.top+I/2).text(function(e){return e});return F}else{C.selectAll(".nv-noData").remove()}P=P||h;H=H||p;var U=C.selectAll("g.nv-wrap.nv-scatterChart").data([e]);var z=U.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id());var W=z.append("g");var X=U.select("g");W.append("rect").attr("class","nvd3 nv-background");W.append("g").attr("class","nv-x nv-axis");W.append("g").attr("class","nv-y nv-axis");W.append("g").attr("class","nv-scatterWrap");W.append("g").attr("class","nv-distWrap");W.append("g").attr("class","nv-legendWrap");W.append("g").attr("class","nv-controlsWrap");if(y){var V=S?L/2:L;i.width(V);U.select(".nv-legendWrap").datum(e).call(i);if(a.top!=i.height()){a.top=i.height();I=(l||parseInt(C.style("height"))||400)-a.top-a.bottom}U.select(".nv-legendWrap").attr("transform","translate("+(L-V)+","+ -a.top+")")}if(S){s.width(180).color(["#444"]);X.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+ -a.top+")").call(s)}U.attr("transform","translate("+a.left+","+a.top+")");if(E){X.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)")}t.width(L).height(I).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));if(d!==0)t.xDomain(null);if(v!==0)t.yDomain(null);U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(d!==0){var $=h.domain()[1]-h.domain()[0];t.xDomain([h.domain()[0]-d*$,h.domain()[1]+d*$])}if(v!==0){var J=p.domain()[1]-p.domain()[0];t.yDomain([p.domain()[0]-v*J,p.domain()[1]+v*J])}if(v!==0||d!==0){U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t)}if(b){n.scale(h).ticks(n.ticks()&&n.ticks().length?n.ticks():L/100).tickSize(-I,0);X.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)}if(w){r.scale(p).ticks(r.ticks()&&r.ticks().length?r.ticks():I/36).tickSize(-L,0);X.select(".nv-y.nv-axis").call(r)}if(m){o.getData(t.x()).scale(h).width(L).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));W.select(".nv-distWrap").append("g").attr("class","nv-distributionX");X.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)}if(g){u.getData(t.y()).scale(p).width(I).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));W.select(".nv-distWrap").append("g").attr("class","nv-distributionY");X.select(".nv-distributionY").attr("transform","translate("+(E?L:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)}if(d3.fisheye){X.select(".nv-background").attr("width",L).attr("height",I);X.select(".nv-background").on("mousemove",K);X.select(".nv-background").on("click",function(){T=!T});t.dispatch.on("elementClick.freezeFisheye",function(){T=!T})}s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled;x=e.disabled?0:2.5;X.select(".nv-background").style("pointer-events",e.disabled?"none":"all");X.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none");if(e.disabled){h.distortion(x).focus(0);p.distortion(x).focus(0);X.select(".nv-scatterWrap").call(t);X.select(".nv-x.nv-axis").call(n);X.select(".nv-y.nv-axis").call(r)}else{T=false}F.update()});i.dispatch.on("stateChange",function(e){A.disabled=e.disabled;M.stateChange(A);F.update()});t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",function(t,n){return e.pos[1]-I});d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size());e.pos=[e.pos[0]+a.left,e.pos[1]+a.top];M.tooltipShow(e)});M.on("tooltipShow",function(e){if(N)B(e,k.parentNode)});M.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});A.disabled=t.disabled}F.update()});P=h.copy();H=p.copy()});return F}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution();var a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=0,v=0,m=false,g=false,y=true,b=true,w=true,E=false,S=!!d3.fisheye,x=0,T=false,N=true,C=function(e,t,n){return"<strong>"+t+"</strong>"},k=function(e,t,n){return"<strong>"+n+"</strong>"},L=null,A={},O=null,M=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),_="No Data Available.",D=250;t.xScale(h).yScale(p);n.orient("bottom").tickPadding(10);r.orient(E?"right":"left").tickPadding(10);o.axis("x");u.axis("y");s.updateState(false);var P,H;var B=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));if(C!=null)e.tooltip.show([f,l],C(i.series.key,v,m,i,F),"n",1,s,"x-nvtooltip");if(k!=null)e.tooltip.show([c,d],k(i.series.key,v,m,i,F),"e",1,s,"y-nvtooltip");if(L!=null)e.tooltip.show([o,u],L(i.series.key,v,m,i,F),i.value<0?"n":"s",null,s)};var j=[{key:"Magnify",disabled:true}];t.dispatch.on("elementMouseout.tooltip",function(e){M.tooltipHide(e);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())});M.on("tooltipHide",function(){if(N)e.tooltip.cleanup()});F.dispatch=M;F.scatter=t;F.legend=i;F.controls=s;F.xAxis=n;F.yAxis=r;F.distX=o;F.distY=u;d3.rebind(F,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");F.options=e.utils.optionsFunc.bind(F);F.margin=function(e){if(!arguments.length)return a;a.top=typeof e.top!="undefined"?e.top:a.top;a.right=typeof e.right!="undefined"?e.right:a.right;a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom;a.left=typeof e.left!="undefined"?e.left:a.left;return F};F.width=function(e){if(!arguments.length)return f;f=e;return F};F.height=function(e){if(!arguments.length)return l;l=e;return F};F.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);i.color(c);o.color(c);u.color(c);return F};F.showDistX=function(e){if(!arguments.length)return m;m=e;return F};F.showDistY=function(e){if(!arguments.length)return g;g=e;return F};F.showControls=function(e){if(!arguments.length)return S;S=e;return F};F.showLegend=function(e){if(!arguments.length)return y;y=e;return F};F.showXAxis=function(e){if(!arguments.length)return b;b=e;return F};F.showYAxis=function(e){if(!arguments.length)return w;w=e;return F};F.rightAlignYAxis=function(e){if(!arguments.length)return E;E=e;r.orient(e?"right":"left");return F};F.fisheye=function(e){if(!arguments.length)return x;x=e;return F};F.xPadding=function(e){if(!arguments.length)return d;d=e;return F};F.yPadding=function(e){if(!arguments.length)return v;v=e;return F};F.tooltips=function(e){if(!arguments.length)return N;N=e;return F};F.tooltipContent=function(e){if(!arguments.length)return L;L=e;return F};F.tooltipXContent=function(e){if(!arguments.length)return C;C=e;return F};F.tooltipYContent=function(e){if(!arguments.length)return k;k=e;return F};F.state=function(e){if(!arguments.length)return A;A=e;return F};F.defaultState=function(e){if(!arguments.length)return O;O=e;return F};F.noData=function(e){if(!arguments.length)return _;_=e;return F};F.transitionDuration=function(e){if(!arguments.length)return D;D=e;return F};return F};e.models.scatterPlusLineChart=function(){"use strict";function B(e){e.each(function(e){function $(){if(S){z.select(".nv-point-paths").style("pointer-events","all");return false}z.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(E).focus(i[0]);p.distortion(E).focus(i[1]);z.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(g)z.select(".nv-x.nv-axis").call(n);if(y)z.select(".nv-y.nv-axis").call(r);z.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o);z.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var T=d3.select(this),N=this;var C=(f||parseInt(T.style("width"))||960)-a.left-a.right,j=(l||parseInt(T.style("height"))||400)-a.top-a.bottom;B.update=function(){T.transition().duration(M).call(B)};B.container=this;k.disabled=e.map(function(e){return!!e.disabled});if(!L){var F;L={};for(F in k){if(k[F]instanceof Array)L[F]=k[F].slice(0);else L[F]=k[F]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var I=T.selectAll(".nv-noData").data([O]);I.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");I.attr("x",a.left+C/2).attr("y",a.top+j/2).text(function(e){return e});return B}else{T.selectAll(".nv-noData").remove()}h=t.xScale();p=t.yScale();_=_||h;D=D||p;var q=T.selectAll("g.nv-wrap.nv-scatterChart").data([e]);var R=q.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id());var U=R.append("g");var z=q.select("g");U.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none");U.append("g").attr("class","nv-x nv-axis");U.append("g").attr("class","nv-y nv-axis");U.append("g").attr("class","nv-scatterWrap");U.append("g").attr("class","nv-regressionLinesWrap");U.append("g").attr("class","nv-distWrap");U.append("g").attr("class","nv-legendWrap");U.append("g").attr("class","nv-controlsWrap");q.attr("transform","translate("+a.left+","+a.top+")");if(b){z.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)")}if(m){i.width(C/2);q.select(".nv-legendWrap").datum(e).call(i);if(a.top!=i.height()){a.top=i.height();j=(l||parseInt(T.style("height"))||400)-a.top-a.bottom}q.select(".nv-legendWrap").attr("transform","translate("+C/2+","+ -a.top+")")}if(w){s.width(180).color(["#444"]);z.select(".nv-controlsWrap").datum(H).attr("transform","translate(0,"+ -a.top+")").call(s)}t.width(C).height(j).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));q.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);q.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+t.id()+")");var W=q.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(e){return e});W.enter().append("g").attr("class","nv-regLines");var X=W.selectAll(".nv-regLine").data(function(e){return[e]});var V=X.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);X.transition().attr("x1",h.range()[0]).attr("x2",h.range()[1]).attr("y1",function(e,t){return p(h.domain()[0]*e.slope+e.intercept)}).attr("y2",function(e,t){return p(h.domain()[1]*e.slope+e.intercept)}).style("stroke",function(e,t,n){return c(e,n)}).style("stroke-opacity",function(e,t){return e.disabled||typeof e.slope==="undefined"||typeof e.intercept==="undefined"?0:1});if(g){n.scale(h).ticks(n.ticks()?n.ticks():C/100).tickSize(-j,0);z.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)}if(y){r.scale(p).ticks(r.ticks()?r.ticks():j/36).tickSize(-C,0);z.select(".nv-y.nv-axis").call(r)}if(d){o.getData(t.x()).scale(h).width(C).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));U.select(".nv-distWrap").append("g").attr("class","nv-distributionX");z.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)}if(v){u.getData(t.y()).scale(p).width(j).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));U.select(".nv-distWrap").append("g").attr("class","nv-distributionY");z.select(".nv-distributionY").attr("transform","translate("+(b?C:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)}if(d3.fisheye){z.select(".nv-background").attr("width",C).attr("height",j);z.select(".nv-background").on("mousemove",$);z.select(".nv-background").on("click",function(){S=!S});t.dispatch.on("elementClick.freezeFisheye",function(){S=!S})}s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled;E=e.disabled?0:2.5;z.select(".nv-background").style("pointer-events",e.disabled?"none":"all");z.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none");if(e.disabled){h.distortion(E).focus(0);p.distortion(E).focus(0);z.select(".nv-scatterWrap").call(t);z.select(".nv-x.nv-axis").call(n);z.select(".nv-y.nv-axis").call(r)}else{S=false}B.update()});i.dispatch.on("stateChange",function(e){k=e;A.stateChange(k);B.update()});t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-j);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size());e.pos=[e.pos[0]+a.left,e.pos[1]+a.top];A.tooltipShow(e)});A.on("tooltipShow",function(e){if(x)P(e,N.parentNode)});A.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});k.disabled=t.disabled}B.update()});_=h.copy();D=p.copy()});return B}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution();var a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=false,v=false,m=true,g=true,y=true,b=false,w=!!d3.fisheye,E=0,S=false,x=true,T=function(e,t,n){return"<strong>"+t+"</strong>"},N=function(e,t,n){return"<strong>"+n+"</strong>"},C=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+r+"</p>"},k={},L=null,A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),O="No Data Available.",M=250;t.xScale(h).yScale(p);n.orient("bottom").tickPadding(10);r.orient(b?"right":"left").tickPadding(10);o.axis("x");u.axis("y");s.updateState(false);var _,D;var P=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));if(T!=null)e.tooltip.show([f,l],T(i.series.key,v,m,i,B),"n",1,s,"x-nvtooltip");if(N!=null)e.tooltip.show([c,d],N(i.series.key,v,m,i,B),"e",1,s,"y-nvtooltip");if(C!=null)e.tooltip.show([o,u],C(i.series.key,v,m,i.point.tooltip,i,B),i.value<0?"n":"s",null,s)};var H=[{key:"Magnify",disabled:true}];t.dispatch.on("elementMouseout.tooltip",function(e){A.tooltipHide(e);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())});A.on("tooltipHide",function(){if(x)e.tooltip.cleanup()});B.dispatch=A;B.scatter=t;B.legend=i;B.controls=s;B.xAxis=n;B.yAxis=r;B.distX=o;B.distY=u;d3.rebind(B,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");B.options=e.utils.optionsFunc.bind(B);B.margin=function(e){if(!arguments.length)return a;a.top=typeof e.top!="undefined"?e.top:a.top;a.right=typeof e.right!="undefined"?e.right:a.right;a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom;a.left=typeof e.left!="undefined"?e.left:a.left;return B};B.width=function(e){if(!arguments.length)return f;f=e;return B};B.height=function(e){if(!arguments.length)return l;l=e;return B};B.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);i.color(c);o.color(c);u.color(c);return B};B.showDistX=function(e){if(!arguments.length)return d;d=e;return B};B.showDistY=function(e){if(!arguments.length)return v;v=e;return B};B.showControls=function(e){if(!arguments.length)return w;w=e;return B};B.showLegend=function(e){if(!arguments.length)return m;m=e;return B};B.showXAxis=function(e){if(!arguments.length)return g;g=e;return B};B.showYAxis=function(e){if(!arguments.length)return y;y=e;return B};B.rightAlignYAxis=function(e){if(!arguments.length)return b;b=e;r.orient(e?"right":"left");return B};B.fisheye=function(e){if(!arguments.length)return E;E=e;return B};B.tooltips=function(e){if(!arguments.length)return x;x=e;return B};B.tooltipContent=function(e){if(!arguments.length)return C;C=e;return B};B.tooltipXContent=function(e){if(!arguments.length)return T;T=e;return B};B.tooltipYContent=function(e){if(!arguments.length)return N;N=e;return B};B.state=function(e){if(!arguments.length)return k;k=e;return B};B.defaultState=function(e){if(!arguments.length)return L;L=e;return B};B.noData=function(e){if(!arguments.length)return O;O=e;return B};B.transitionDuration=function(e){if(!arguments.length)return M;M=e;return B};return B};e.models.sparkline=function(){"use strict";function d(e){e.each(function(e){var i=n-t.left-t.right,d=r-t.top-t.bottom,v=d3.select(this);s.domain(l||d3.extent(e,u)).range(h||[0,i]);o.domain(c||d3.extent(e,a)).range(p||[d,0]);var m=v.selectAll("g.nv-wrap.nv-sparkline").data([e]);var g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");var b=g.append("g");var w=m.select("g");m.attr("transform","translate("+t.left+","+t.top+")");var E=m.selectAll("path").data(function(e){return[e]});E.enter().append("path");E.exit().remove();E.style("stroke",function(e,t){return e.color||f(e,t)}).attr("d",d3.svg.line().x(function(e,t){return s(u(e,t))}).y(function(e,t){return o(a(e,t))}));var S=m.selectAll("circle.nv-point").data(function(e){function n(t){if(t!=-1){var n=e[t];n.pointIndex=t;return n}else{return null}}var t=e.map(function(e,t){return a(e,t)});var r=n(t.lastIndexOf(o.domain()[1])),i=n(t.indexOf(o.domain()[0])),s=n(t.length-1);return[i,r,s].filter(function(e){return e!=null})});S.enter().append("circle");S.exit().remove();S.attr("cx",function(e,t){return s(u(e,e.pointIndex))}).attr("cy",function(e,t){return o(a(e,e.pointIndex))}).attr("r",2).attr("class",function(e,t){return u(e,e.pointIndex)==s.domain()[1]?"nv-point nv-currentValue":a(e,e.pointIndex)==o.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})});return d}var t={top:2,right:0,bottom:2,left:0},n=400,r=32,i=true,s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=e.utils.getColor(["#000"]),l,c,h,p;d.options=e.utils.optionsFunc.bind(d);d.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return d};d.width=function(e){if(!arguments.length)return n;n=e;return d};d.height=function(e){if(!arguments.length)return r;r=e;return d};d.x=function(e){if(!arguments.length)return u;u=d3.functor(e);return d};d.y=function(e){if(!arguments.length)return a;a=d3.functor(e);return d};d.xScale=function(e){if(!arguments.length)return s;s=e;return d};d.yScale=function(e){if(!arguments.length)return o;o=e;return d};d.xDomain=function(e){if(!arguments.length)return l;l=e;return d};d.yDomain=function(e){if(!arguments.length)return c;c=e;return d};d.xRange=function(e){if(!arguments.length)return h;h=e;return d};d.yRange=function(e){if(!arguments.length)return p;p=e;return d};d.animate=function(e){if(!arguments.length)return i;i=e;return d};d.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);return d};return d};e.models.sparklinePlus=function(){"use strict";function v(e){e.each(function(c){function O(){if(a)return;var e=C.selectAll(".nv-hoverValue").data(u);var r=e.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);e.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove();e.attr("transform",function(e){return"translate("+s(t.x()(c[e],e))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1);if(!u.length)return;r.append("line").attr("x1",0).attr("y1",-n.top).attr("x2",0).attr("y2",b);r.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-n.top).attr("text-anchor","end").attr("dy",".9em");C.select(".nv-hoverValue .nv-xValue").text(f(t.x()(c[u[0]],u[0])));r.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-n.top).attr("text-anchor","start").attr("dy",".9em");C.select(".nv-hoverValue .nv-yValue").text(l(t.y()(c[u[0]],u[0])))}function M(){function r(e,n){var r=Math.abs(t.x()(e[0],0)-n);var i=0;for(var s=0;s<e.length;s++){if(Math.abs(t.x()(e[s],s)-n)<r){r=Math.abs(t.x()(e[s],s)-n);i=s}}return i}if(a)return;var e=d3.mouse(this)[0]-n.left;u=[r(c,Math.round(s.invert(e)))];O()}var m=d3.select(this);var g=(r||parseInt(m.style("width"))||960)-n.left-n.right,b=(i||parseInt(m.style("height"))||400)-n.top-n.bottom;v.update=function(){v(e)};v.container=this;if(!c||!c.length){var w=m.selectAll(".nv-noData").data([d]);w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");w.attr("x",n.left+g/2).attr("y",n.top+b/2).text(function(e){return e});return v}else{m.selectAll(".nv-noData").remove()}var E=t.y()(c[c.length-1],c.length-1);s=t.xScale();o=t.yScale();var S=m.selectAll("g.nv-wrap.nv-sparklineplus").data([c]);var T=S.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus");var N=T.append("g");var C=S.select("g");N.append("g").attr("class","nv-sparklineWrap");N.append("g").attr("class","nv-valueWrap");N.append("g").attr("class","nv-hoverArea");S.attr("transform","translate("+n.left+","+n.top+")");var k=C.select(".nv-sparklineWrap");t.width(g).height(b);k.call(t);var L=C.select(".nv-valueWrap");var A=L.selectAll(".nv-currentValue").data([E]);A.enter().append("text").attr("class","nv-currentValue").attr("dx",p?-8:8).attr("dy",".9em").style("text-anchor",p?"end":"start");A.attr("x",g+(p?n.right:0)).attr("y",h?function(e){return o(e)}:0).style("fill",t.color()(c[c.length-1],c.length-1)).text(l(E));N.select(".nv-hoverArea").append("rect").on("mousemove",M).on("click",function(){a=!a}).on("mouseout",function(){u=[];O()});C.select(".nv-hoverArea rect").attr("transform",function(e){return"translate("+ -n.left+","+ -n.top+")"}).attr("width",g+n.left+n.right).attr("height",b+n.top)});return v}var t=e.models.sparkline();var n={top:15,right:100,bottom:10,left:50},r=null,i=null,s,o,u=[],a=false,f=d3.format(",r"),l=d3.format(",.2f"),c=true,h=true,p=false,d="No Data Available.";v.sparkline=t;d3.rebind(v,t,"x","y","xScale","yScale","color");v.options=e.utils.optionsFunc.bind(v);v.margin=function(e){if(!arguments.length)return n;n.top=typeof e.top!="undefined"?e.top:n.top;n.right=typeof e.right!="undefined"?e.right:n.right;n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom;n.left=typeof e.left!="undefined"?e.left:n.left;return v};v.width=function(e){if(!arguments.length)return r;r=e;return v};v.height=function(e){if(!arguments.length)return i;i=e;return v};v.xTickFormat=function(e){if(!arguments.length)return f;f=e;return v};v.yTickFormat=function(e){if(!arguments.length)return l;l=e;return v};v.showValue=function(e){if(!arguments.length)return c;c=e;return v};v.alignValue=function(e){if(!arguments.length)return h;h=e;return v};v.rightAlignValue=function(e){if(!arguments.length)return p;p=e;return v};v.noData=function(e){if(!arguments.length)return d;d=e;return v};return v};e.models.stackedArea=function(){"use strict";function y(e){e.each(function(e){var a=n-t.left-t.right,v=r-t.top-t.bottom,b=d3.select(this);p=m.xScale();d=m.yScale();var w=e;e=e.map(function(e,t){e.seriesIndex=t;e.values=e.values.map(function(e,n){e.index=n;e.seriesIndex=t;return e});return e});var E=e.filter(function(e){return!e.disabled});e=d3.layout.stack().order(l).offset(f).values(function(e){return e.values}).x(o).y(u).out(function(e,t,n){var r=u(e)===0?0:n;e.display={y:r,y0:t}})(E);var S=b.selectAll("g.nv-wrap.nv-stackedarea").data([e]);var T=S.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea");var N=T.append("defs");var C=T.append("g");var k=S.select("g");C.append("g").attr("class","nv-areaWrap");C.append("g").attr("class","nv-scatterWrap");S.attr("transform","translate("+t.left+","+t.top+")");m.width(a).height(v).x(o).y(function(e){return e.display.y+e.display.y0}).forceY([0]).color(e.map(function(e,t){return e.color||i(e,e.seriesIndex)}));var L=k.select(".nv-scatterWrap").datum(e);L.call(m);N.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect");S.select("#nv-edge-clip-"+s+" rect").attr("width",a).attr("height",v);k.attr("clip-path",h?"url(#nv-edge-clip-"+s+")":"");var A=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y+e.display.y0)}).interpolate(c);var O=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y0)});var M=k.select(".nv-areaWrap").selectAll("path.nv-area").data(function(e){return e});M.enter().append("path").attr("class",function(e,t){return"nv-area nv-area-"+t}).attr("d",function(e,t){return O(e.values,e.seriesIndex)}).on("mouseover",function(e,t){d3.select(this).classed("hover",true);g.areaMouseover({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t})}).on("mouseout",function(e,t){d3.select(this).classed("hover",false);g.areaMouseout({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t})}).on("click",function(e,t){d3.select(this).classed("hover",false);g.areaClick({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t})});M.exit().transition().attr("d",function(e,t){return O(e.values,t)}).remove();M.style("fill",function(e,t){return e.color||i(e,e.seriesIndex)}).style("stroke",function(e,t){return e.color||i(e,e.seriesIndex)});M.transition().attr("d",function(e,t){return A(e.values,t)});m.dispatch.on("elementMouseover.area",function(e){k.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",true)});m.dispatch.on("elementMouseout.area",function(e){k.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",false)});y.d3_stackedOffset_stackPercent=function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,a=[];for(s=0;s<n;++s){for(i=0,o=0;i<w.length;i++)o+=u(w[i].values[s]);if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)a[s]=0;return a}});return y}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=function(e){return e.x},u=function(e){return e.y},a="stack",f="zero",l="default",c="linear",h=false,p,d,v=d3.format(",.3f"),m=e.models.scatter(),g=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");m.size(2.2).sizeDomain([2.2,2.2]);m.dispatch.on("elementClick.area",function(e){g.areaClick(e)});m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],g.tooltipShow(e)});m.dispatch.on("elementMouseout.tooltip",function(e){g.tooltipHide(e)});y.dispatch=g;y.scatter=m;d3.rebind(y,m,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","highlightPoint","clearHighlights");y.options=e.utils.optionsFunc.bind(y);y.x=function(e){if(!arguments.length)return o;o=d3.functor(e);return y};y.y=function(e){if(!arguments.length)return u;u=d3.functor(e);return y};y.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return y};y.width=function(e){if(!arguments.length)return n;n=e;return y};y.height=function(e){if(!arguments.length)return r;r=e;return y};y.clipEdge=function(e){if(!arguments.length)return h;h=e;return y};y.color=function(t){if(!arguments.length)return i;i=e.utils.getColor(t);return y};y.offset=function(e){if(!arguments.length)return f;f=e;return y};y.order=function(e){if(!arguments.length)return l;l=e;return y};y.style=function(e){if(!arguments.length)return a;a=e;switch(a){case"stack":y.offset("zero");y.order("default");break;case"stream":y.offset("wiggle");y.order("inside-out");break;case"stream-center":y.offset("silhouette");y.order("inside-out");break;case"expand":y.offset("expand");y.order("default");break;case"stack_percent":y.offset(y.d3_stackedOffset_stackPercent);y.order("default");break}return y};y.interpolate=function(e){if(!arguments.length)return c;c=e;return y};return y};e.models.stackedAreaChart=function(){"use strict";function D(b){b.each(function(b){var x=d3.select(this),P=this;var H=(a||parseInt(x.style("width"))||960)-u.left-u.right,B=(f||parseInt(x.style("height"))||400)-u.top-u.bottom;D.update=function(){x.transition().duration(M).call(D)};D.container=this;if(y=="right")H=H-250;T.disabled=b.map(function(e){return!!e.disabled});if(!N){var j;N={};for(j in T){if(T[j]instanceof Array)N[j]=T[j].slice(0);else N[j]=T[j]}}if(!b||!b.length||!b.filter(function(e){return e.values.length}).length){var F=x.selectAll(".nv-noData").data([C]);F.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");F.attr("x",u.left+H/2).attr("y",u.top+B/2).text(function(e){return e});return D}else{x.selectAll(".nv-noData").remove()}w=t.xScale();E=t.yScale();var I=x.selectAll("g.nv-wrap.nv-stackedAreaChart").data([b]);var q=I.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g");var R=I.select("g");q.append("rect").style("opacity",0);q.append("g").attr("class","nv-x nv-axis");q.append("g").attr("class","nv-y nv-axis");q.append("g").attr("class","nv-stackedWrap");q.append("g").attr("class","nv-legendWrap");q.append("g").attr("class","nv-controlsWrap");q.append("g").attr("class","nv-interactive");R.select("rect").attr("width",H).attr("height",B);if(h){var U=c?H-L:H;i.width(U);R.select(".nv-legendWrap").datum(b).call(i);if(u.top!=i.height()){u.top=i.height();B=(f||parseInt(x.style("height"))||400)-u.top-u.bottom}if(y=="right"){R.select(".nv-legendWrap").attr("transform","translate("+H+","+20+")")}else{R.select(".nv-legendWrap").attr("transform","translate("+(H-U)+","+ -u.top+")")}}if(c){var z=[{key:O.stacked||"Stacked",metaKey:"Stacked",disabled:t.style()!="stack",style:"stack"},{key:O.stream||"Stream",metaKey:"Stream",disabled:t.style()!="stream",style:"stream"},{key:O.expanded||"Expanded",metaKey:"Expanded",disabled:t.style()!="expand",style:"expand"},{key:O.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:t.style()!="stack_percent",style:"stack_percent"}];L=A.length/3*260;z=z.filter(function(e){return A.indexOf(e.metaKey)!==-1});s.width(L).color(["#444","#444","#444"]);R.select(".nv-controlsWrap").datum(z).call(s);if(u.top!=Math.max(s.height(),i.height())){u.top=Math.max(s.height(),i.height());B=(f||parseInt(x.style("height"))||400)-u.top-u.bottom}R.select(".nv-controlsWrap").attr("transform","translate(0,"+ -u.top+")")}I.attr("transform","translate("+u.left+","+u.top+")");if(v){R.select(".nv-y.nv-axis").attr("transform","translate("+H+",0)")}if(m){o.width(H).height(B).margin({left:u.left,top:u.top}).svgContainer(x).xScale(w);I.select(".nv-interactive").call(o)}t.width(H).height(B);var W=R.select(".nv-stackedWrap").datum(b);W.transition().call(t);if(p){n.scale(w).ticks(H/100).tickSize(-B,0);R.select(".nv-x.nv-axis").attr("transform","translate(0,"+B+")");R.select(".nv-x.nv-axis").transition().duration(0).call(n)}if(d){r.scale(E).ticks(t.offset()=="wiggle"?0:B/36).tickSize(-H,0).setTickFormat(t.style()=="expand"||t.style()=="stack_percent"?d3.format("%"):S);R.select(".nv-y.nv-axis").transition().duration(0).call(r)}t.dispatch.on("areaClick.toggle",function(e){if(b.filter(function(e){return!e.disabled}).length===1)b=b.map(function(e){e.disabled=false;return e});else b=b.map(function(t,n){t.disabled=n!=e.seriesIndex;return t});T.disabled=b.map(function(e){return!!e.disabled});k.stateChange(T);D.update()});i.dispatch.on("stateChange",function(e){T.disabled=e.disabled;k.stateChange(T);D.update()});s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;z=z.map(function(e){e.disabled=true;return e});e.disabled=false;t.style(e.style);T.style=t.style();k.stateChange(T);D.update()});o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,a,f,c=[];b.filter(function(e,t){e.seriesIndex=t;return!e.disabled}).forEach(function(n,r){a=e.interactiveBisect(n.values,i.pointXValue,D.x());t.highlightPoint(r,a,true);var o=n.values[a];if(typeof o==="undefined")return;if(typeof s==="undefined")s=o;if(typeof f==="undefined")f=D.xScale()(D.x()(o,a));var u=t.style()=="expand"?o.display.y:D.y()(o,a);c.push({key:n.key,value:u,color:l(n,n.seriesIndex),stackedValue:o.display})});c.reverse();if(c.length>2){var h=D.yScale().invert(i.mouseY);var p=Infinity,d=null;c.forEach(function(e,t){if(h>=e.stackedValue.y0&&h<=e.stackedValue.y0+e.stackedValue.y){d=t;return}});if(d!=null)c[d].highlight=true}var v=n.tickFormat()(D.x()(s,a));var m=t.style()=="expand"?function(e,t){return d3.format(".1%")(e)}:function(e,t){return r.tickFormat()(e)};o.tooltip.position({left:f+u.left,top:i.mouseY+u.top}).chartContainer(P.parentNode).enabled(g).valueFormatter(m).data({value:v,series:c})();o.renderGuideLine(f)});o.dispatch.on("elementMouseout",function(e){k.tooltipHide();t.clearHighlights()});k.on("tooltipShow",function(e){if(g)_(e,P.parentNode)});k.on("changeState",function(e){if(typeof e.disabled!=="undefined"){b.forEach(function(t,n){t.disabled=e.disabled[n]});T.disabled=e.disabled}if(typeof e.style!=="undefined"){t.style(e.style)}D.update()})});return D}var t=e.models.stackedArea(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline();var u={top:30,right:25,bottom:50,left:60},a=null,f=null,l=e.utils.defaultColor(),c=true,h=true,p=true,d=true,v=false,m=false,g=true,y="top",b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"},w,E,S=d3.format(",.2f"),x=d3.format(",.3f"),T={style:t.style()},N=null,C="No Data Available.",k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=250,A=["Stacked","Stream","Expanded"],O={},M=250;n.orient("bottom").tickPadding(7);r.orient(v?"right":"left");s.updateState(false);var _=function(r,i){var s=r.pos[0]+(i.offsetLeft||0),o=r.pos[1]+(i.offsetTop||0),u=n.tickFormat()(t.x()(r.point,r.pointIndex)),a=x(t.y()(r.point,r.pointIndex)),f=b(r.series.key,u,a,r,D);e.tooltip.show([s,o],f,r.value<0?"n":"s",null,i)};t.dispatch.on("tooltipShow",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],k.tooltipShow(e)});t.dispatch.on("tooltipHide",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(g)e.tooltip.cleanup()});D.dispatch=k;D.stacked=t;D.legend=i;D.controls=s;D.xAxis=n;D.yAxis=r;D.interactiveLayer=o;d3.rebind(D,t,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate");D.options=e.utils.optionsFunc.bind(D);D.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return D};D.width=function(e){if(!arguments.length)return a;a=e;return D};D.height=function(e){if(!arguments.length)return f;f=e;return D};D.color=function(n){if(!arguments.length)return l;l=e.utils.getColor(n);i.color(l);t.color(l);return D};D.showControls=function(e){if(!arguments.length)return c;c=e;return D};D.showLegend=function(e){if(!arguments.length)return h;h=e;return D};D.showXAxis=function(e){if(!arguments.length)return p;p=e;return D};D.showYAxis=function(e){if(!arguments.length)return d;d=e;return D};D.rightAlignYAxis=function(e){if(!arguments.length)return v;v=e;r.orient(e?"right":"left");return D};D.useInteractiveGuideline=function(e){if(!arguments.length)return m;m=e;if(e===true){D.interactive(false);D.useVoronoi(false)}return D};D.tooltip=function(e){if(!arguments.length)return b;b=e;return D};D.tooltips=function(e){if(!arguments.length)return g;g=e;return D};D.legendPos=function(e){if(!arguments.length)return y;y=e;return D};D.tooltipContent=function(e){if(!arguments.length)return b;b=e;return D};D.yAxisTooltipFormat=function(e){if(!arguments.length)return x;x=e;return D};D.state=function(e){if(!arguments.length)return T;T=e;return D};D.defaultState=function(e){if(!arguments.length)return N;N=e;return D};D.noData=function(e){if(!arguments.length)return C;C=e;return D};D.transitionDuration=function(e){if(!arguments.length)return M;M=e;return D};D.controlsData=function(e){if(!arguments.length)return A;A=e;return D};D.controlLabels=function(e){if(!arguments.length)return O;if(typeof e!=="object")return O;O=e;return D};r.setTickFormat=r.tickFormat;r.tickFormat=function(e){if(!arguments.length)return S;S=e;return r};return D}})() \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/outro.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/outro.js
new file mode 100644
index 00000000..158693a0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/outro.js
@@ -0,0 +1 @@
+})(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/sankey.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/sankey.js
new file mode 100644
index 00000000..c3bc59fb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/sankey.js
@@ -0,0 +1,292 @@
+d3.sankey = function() {
+ var sankey = {},
+ nodeWidth = 24,
+ nodePadding = 8,
+ size = [1, 1],
+ nodes = [],
+ links = [];
+
+ sankey.nodeWidth = function(_) {
+ if (!arguments.length) return nodeWidth;
+ nodeWidth = +_;
+ return sankey;
+ };
+
+ sankey.nodePadding = function(_) {
+ if (!arguments.length) return nodePadding;
+ nodePadding = +_;
+ return sankey;
+ };
+
+ sankey.nodes = function(_) {
+ if (!arguments.length) return nodes;
+ nodes = _;
+ return sankey;
+ };
+
+ sankey.links = function(_) {
+ if (!arguments.length) return links;
+ links = _;
+ return sankey;
+ };
+
+ sankey.size = function(_) {
+ if (!arguments.length) return size;
+ size = _;
+ return sankey;
+ };
+
+ sankey.layout = function(iterations) {
+ computeNodeLinks();
+ computeNodeValues();
+ computeNodeBreadths();
+ computeNodeDepths(iterations);
+ computeLinkDepths();
+ return sankey;
+ };
+
+ sankey.relayout = function() {
+ computeLinkDepths();
+ return sankey;
+ };
+
+ sankey.link = function() {
+ var curvature = .5;
+
+ function link(d) {
+ var x0 = d.source.x + d.source.dx,
+ x1 = d.target.x,
+ xi = d3.interpolateNumber(x0, x1),
+ x2 = xi(curvature),
+ x3 = xi(1 - curvature),
+ y0 = d.source.y + d.sy + d.dy / 2,
+ y1 = d.target.y + d.ty + d.dy / 2;
+ return "M" + x0 + "," + y0
+ + "C" + x2 + "," + y0
+ + " " + x3 + "," + y1
+ + " " + x1 + "," + y1;
+ }
+
+ link.curvature = function(_) {
+ if (!arguments.length) return curvature;
+ curvature = +_;
+ return link;
+ };
+
+ return link;
+ };
+
+ // Populate the sourceLinks and targetLinks for each node.
+ // Also, if the source and target are not objects, assume they are indices.
+ function computeNodeLinks() {
+ nodes.forEach(function(node) {
+ node.sourceLinks = [];
+ node.targetLinks = [];
+ });
+ links.forEach(function(link) {
+ var source = link.source,
+ target = link.target;
+ if (typeof source === "number") source = link.source = nodes[link.source];
+ if (typeof target === "number") target = link.target = nodes[link.target];
+ source.sourceLinks.push(link);
+ target.targetLinks.push(link);
+ });
+ }
+
+ // Compute the value (size) of each node by summing the associated links.
+ function computeNodeValues() {
+ nodes.forEach(function(node) {
+ node.value = Math.max(
+ d3.sum(node.sourceLinks, value),
+ d3.sum(node.targetLinks, value)
+ );
+ });
+ }
+
+ // Iteratively assign the breadth (x-position) for each node.
+ // Nodes are assigned the maximum breadth of incoming neighbors plus one;
+ // nodes with no incoming links are assigned breadth zero, while
+ // nodes with no outgoing links are assigned the maximum breadth.
+ function computeNodeBreadths() {
+ var remainingNodes = nodes,
+ nextNodes,
+ x = 0;
+
+ while (remainingNodes.length) {
+ nextNodes = [];
+ remainingNodes.forEach(function(node) {
+ node.x = x;
+ node.dx = nodeWidth;
+ node.sourceLinks.forEach(function(link) {
+ nextNodes.push(link.target);
+ });
+ });
+ remainingNodes = nextNodes;
+ ++x;
+ }
+
+ //
+ moveSinksRight(x);
+ scaleNodeBreadths((size[0] - nodeWidth) / (x - 1));
+ }
+
+ function moveSourcesRight() {
+ nodes.forEach(function(node) {
+ if (!node.targetLinks.length) {
+ node.x = d3.min(node.sourceLinks, function(d) { return d.target.x; }) - 1;
+ }
+ });
+ }
+
+ function moveSinksRight(x) {
+ nodes.forEach(function(node) {
+ if (!node.sourceLinks.length) {
+ node.x = x - 1;
+ }
+ });
+ }
+
+ function scaleNodeBreadths(kx) {
+ nodes.forEach(function(node) {
+ node.x *= kx;
+ });
+ }
+
+ function computeNodeDepths(iterations) {
+ var nodesByBreadth = d3.nest()
+ .key(function(d) { return d.x; })
+ .sortKeys(d3.ascending)
+ .entries(nodes)
+ .map(function(d) { return d.values; });
+
+ //
+ initializeNodeDepth();
+ resolveCollisions();
+ for (var alpha = 1; iterations > 0; --iterations) {
+ relaxRightToLeft(alpha *= .99);
+ resolveCollisions();
+ relaxLeftToRight(alpha);
+ resolveCollisions();
+ }
+
+ function initializeNodeDepth() {
+ var ky = d3.min(nodesByBreadth, function(nodes) {
+ return (size[1] - (nodes.length - 1) * nodePadding) / d3.sum(nodes, value);
+ });
+
+ nodesByBreadth.forEach(function(nodes) {
+ nodes.forEach(function(node, i) {
+ node.y = i;
+ node.dy = node.value * ky;
+ });
+ });
+
+ links.forEach(function(link) {
+ link.dy = link.value * ky;
+ });
+ }
+
+ function relaxLeftToRight(alpha) {
+ nodesByBreadth.forEach(function(nodes, breadth) {
+ nodes.forEach(function(node) {
+ if (node.targetLinks.length) {
+ var y = d3.sum(node.targetLinks, weightedSource) / d3.sum(node.targetLinks, value);
+ node.y += (y - center(node)) * alpha;
+ }
+ });
+ });
+
+ function weightedSource(link) {
+ return center(link.source) * link.value;
+ }
+ }
+
+ function relaxRightToLeft(alpha) {
+ nodesByBreadth.slice().reverse().forEach(function(nodes) {
+ nodes.forEach(function(node) {
+ if (node.sourceLinks.length) {
+ var y = d3.sum(node.sourceLinks, weightedTarget) / d3.sum(node.sourceLinks, value);
+ node.y += (y - center(node)) * alpha;
+ }
+ });
+ });
+
+ function weightedTarget(link) {
+ return center(link.target) * link.value;
+ }
+ }
+
+ function resolveCollisions() {
+ nodesByBreadth.forEach(function(nodes) {
+ var node,
+ dy,
+ y0 = 0,
+ n = nodes.length,
+ i;
+
+ // Push any overlapping nodes down.
+ nodes.sort(ascendingDepth);
+ for (i = 0; i < n; ++i) {
+ node = nodes[i];
+ dy = y0 - node.y;
+ if (dy > 0) node.y += dy;
+ y0 = node.y + node.dy + nodePadding;
+ }
+
+ // If the bottommost node goes outside the bounds, push it back up.
+ dy = y0 - nodePadding - size[1];
+ if (dy > 0) {
+ y0 = node.y -= dy;
+
+ // Push any overlapping nodes back up.
+ for (i = n - 2; i >= 0; --i) {
+ node = nodes[i];
+ dy = node.y + node.dy + nodePadding - y0;
+ if (dy > 0) node.y -= dy;
+ y0 = node.y;
+ }
+ }
+ });
+ }
+
+ function ascendingDepth(a, b) {
+ return a.y - b.y;
+ }
+ }
+
+ function computeLinkDepths() {
+ nodes.forEach(function(node) {
+ node.sourceLinks.sort(ascendingTargetDepth);
+ node.targetLinks.sort(ascendingSourceDepth);
+ });
+ nodes.forEach(function(node) {
+ var sy = 0, ty = 0;
+ node.sourceLinks.forEach(function(link) {
+ link.sy = sy;
+ sy += link.dy;
+ });
+ node.targetLinks.forEach(function(link) {
+ link.ty = ty;
+ ty += link.dy;
+ });
+ });
+
+ function ascendingSourceDepth(a, b) {
+ return a.source.y - b.source.y;
+ }
+
+ function ascendingTargetDepth(a, b) {
+ return a.target.y - b.target.y;
+ }
+ }
+
+ function center(node) {
+ return node.y + node.dy / 2;
+ }
+
+ function value(link) {
+ return link.value;
+ }
+
+ return sankey;
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/tooltip.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/tooltip.js
new file mode 100644
index 00000000..46e5a816
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/tooltip.js
@@ -0,0 +1,490 @@
+/* Tooltip rendering model for nvd3 charts.
+window.nv.models.tooltip is the updated,new way to render tooltips.
+
+window.nv.tooltip.show is the old tooltip code.
+window.nv.tooltip.* also has various helper methods.
+*/
+(function() {
+ "use strict";
+ window.nv.tooltip = {};
+
+ /* Model which can be instantiated to handle tooltip rendering.
+ Example usage:
+ var tip = nv.models.tooltip().gravity('w').distance(23)
+ .data(myDataObject);
+
+ tip(); //just invoke the returned function to render tooltip.
+ */
+ window.nv.models.tooltip = function() {
+ var content = null //HTML contents of the tooltip. If null, the content is generated via the data variable.
+ , data = null /* Tooltip data. If data is given in the proper format, a consistent tooltip is generated.
+ Format of data:
+ {
+ key: "Date",
+ value: "August 2009",
+ series: [
+ {
+ key: "Series 1",
+ value: "Value 1",
+ color: "#000"
+ },
+ {
+ key: "Series 2",
+ value: "Value 2",
+ color: "#00f"
+ }
+ ]
+
+ }
+
+ */
+ , gravity = 'w' //Can be 'n','s','e','w'. Determines how tooltip is positioned.
+ , distance = 50 //Distance to offset tooltip from the mouse location.
+ , snapDistance = 25 //Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect)
+ , fixedTop = null //If not null, this fixes the top position of the tooltip.
+ , classes = null //Attaches additional CSS classes to the tooltip DIV that is created.
+ , chartContainer = null //Parent DIV, of the SVG Container that holds the chart.
+ , tooltipElem = null //actual DOM element representing the tooltip.
+ , position = {left: null, top: null} //Relative position of the tooltip inside chartContainer.
+ , enabled = true //True -> tooltips are rendered. False -> don't render tooltips.
+ //Generates a unique id when you create a new tooltip() object
+ , id = "nvtooltip-" + Math.floor(Math.random() * 100000)
+ ;
+
+ //CSS class to specify whether element should not have mouse events.
+ var nvPointerEventsClass = "nv-pointer-events-none";
+
+ //Format function for the tooltip values column
+ var valueFormatter = function(d,i) {
+ return d;
+ };
+
+ //Format function for the tooltip header value.
+ var headerFormatter = function(d) {
+ return d;
+ };
+
+ //By default, the tooltip model renders a beautiful table inside a DIV.
+ //You can override this function if a custom tooltip is desired.
+ var contentGenerator = function(d) {
+ if (content != null) return content;
+
+ if (d == null) return '';
+
+ var table = d3.select(document.createElement("table"));
+ var theadEnter = table.selectAll("thead")
+ .data([d])
+ .enter().append("thead");
+ theadEnter.append("tr")
+ .append("td")
+ .attr("colspan",3)
+ .append("strong")
+ .classed("x-value",true)
+ .html(headerFormatter(d.value));
+
+ var tbodyEnter = table.selectAll("tbody")
+ .data([d])
+ .enter().append("tbody");
+ var trowEnter = tbodyEnter.selectAll("tr")
+ .data(function(p) { return p.series})
+ .enter()
+ .append("tr")
+ .classed("highlight", function(p) { return p.highlight})
+ ;
+
+ trowEnter.append("td")
+ .classed("legend-color-guide",true)
+ .append("div")
+ .style("background-color", function(p) { return p.color});
+ trowEnter.append("td")
+ .classed("key",true)
+ .html(function(p) {return p.key});
+ trowEnter.append("td")
+ .classed("value",true)
+ .html(function(p,i) { return valueFormatter(p.value,i) });
+
+
+ trowEnter.selectAll("td").each(function(p) {
+ if (p.highlight) {
+ var opacityScale = d3.scale.linear().domain([0,1]).range(["#fff",p.color]);
+ var opacity = 0.6;
+ d3.select(this)
+ .style("border-bottom-color", opacityScale(opacity))
+ .style("border-top-color", opacityScale(opacity))
+ ;
+ }
+ });
+
+ var html = table.node().outerHTML;
+ if (d.footer !== undefined)
+ html += "<div class='footer'>" + d.footer + "</div>";
+ return html;
+
+ };
+
+ var dataSeriesExists = function(d) {
+ if (d && d.series && d.series.length > 0) return true;
+
+ return false;
+ };
+
+ //In situations where the chart is in a 'viewBox', re-position the tooltip based on how far chart is zoomed.
+ function convertViewBoxRatio() {
+ if (chartContainer) {
+ var svg = d3.select(chartContainer);
+ if (svg.node().tagName !== "svg") {
+ svg = svg.select("svg");
+ }
+ var viewBox = (svg.node()) ? svg.attr('viewBox') : null;
+ if (viewBox) {
+ viewBox = viewBox.split(' ');
+ var ratio = parseInt(svg.style('width')) / viewBox[2];
+
+ position.left = position.left * ratio;
+ position.top = position.top * ratio;
+ }
+ }
+ }
+
+ //Creates new tooltip container, or uses existing one on DOM.
+ function getTooltipContainer(newContent) {
+ var body;
+ if (chartContainer)
+ body = d3.select(chartContainer);
+ else
+ body = d3.select("body");
+
+ var container = body.select(".nvtooltip");
+ if (container.node() === null) {
+ //Create new tooltip div if it doesn't exist on DOM.
+ container = body.append("div")
+ .attr("class", "nvtooltip " + (classes? classes: "xy-tooltip"))
+ .attr("id",id)
+ ;
+ }
+
+
+ container.node().innerHTML = newContent;
+ container.style("top",0).style("left",0).style("opacity",0);
+ container.selectAll("div, table, td, tr").classed(nvPointerEventsClass,true)
+ container.classed(nvPointerEventsClass,true);
+ return container.node();
+ }
+
+
+
+ //Draw the tooltip onto the DOM.
+ function nvtooltip() {
+ if (!enabled) return;
+ if (!dataSeriesExists(data)) return;
+
+ convertViewBoxRatio();
+
+ var left = position.left;
+ var top = (fixedTop != null) ? fixedTop : position.top;
+ var container = getTooltipContainer(contentGenerator(data));
+ tooltipElem = container;
+ if (chartContainer) {
+ var svgComp = chartContainer.getElementsByTagName("svg")[0];
+ var boundRect = (svgComp) ? svgComp.getBoundingClientRect() : chartContainer.getBoundingClientRect();
+ var svgOffset = {left:0,top:0};
+ if (svgComp) {
+ var svgBound = svgComp.getBoundingClientRect();
+ var chartBound = chartContainer.getBoundingClientRect();
+ var svgBoundTop = svgBound.top;
+
+ //Defensive code. Sometimes, svgBoundTop can be a really negative
+ // number, like -134254. That's a bug.
+ // If such a number is found, use zero instead. FireFox bug only
+ if (svgBoundTop < 0) {
+ var containerBound = chartContainer.getBoundingClientRect();
+ svgBoundTop = (Math.abs(svgBoundTop) > containerBound.height) ? 0 : svgBoundTop;
+ }
+ svgOffset.top = Math.abs(svgBoundTop - chartBound.top);
+ svgOffset.left = Math.abs(svgBound.left - chartBound.left);
+ }
+ //If the parent container is an overflow <div> with scrollbars, subtract the scroll offsets.
+ //You need to also add any offset between the <svg> element and its containing <div>
+ //Finally, add any offset of the containing <div> on the whole page.
+ left += chartContainer.offsetLeft + svgOffset.left - 2*chartContainer.scrollLeft;
+ top += chartContainer.offsetTop + svgOffset.top - 2*chartContainer.scrollTop;
+ }
+
+ if (snapDistance && snapDistance > 0) {
+ top = Math.floor(top/snapDistance) * snapDistance;
+ }
+
+ nv.tooltip.calcTooltipPosition([left,top], gravity, distance, container);
+ return nvtooltip;
+ };
+
+ nvtooltip.nvPointerEventsClass = nvPointerEventsClass;
+
+ nvtooltip.content = function(_) {
+ if (!arguments.length) return content;
+ content = _;
+ return nvtooltip;
+ };
+
+ //Returns tooltipElem...not able to set it.
+ nvtooltip.tooltipElem = function() {
+ return tooltipElem;
+ };
+
+ nvtooltip.contentGenerator = function(_) {
+ if (!arguments.length) return contentGenerator;
+ if (typeof _ === 'function') {
+ contentGenerator = _;
+ }
+ return nvtooltip;
+ };
+
+ nvtooltip.data = function(_) {
+ if (!arguments.length) return data;
+ data = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.gravity = function(_) {
+ if (!arguments.length) return gravity;
+ gravity = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.distance = function(_) {
+ if (!arguments.length) return distance;
+ distance = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.snapDistance = function(_) {
+ if (!arguments.length) return snapDistance;
+ snapDistance = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.classes = function(_) {
+ if (!arguments.length) return classes;
+ classes = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.chartContainer = function(_) {
+ if (!arguments.length) return chartContainer;
+ chartContainer = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.position = function(_) {
+ if (!arguments.length) return position;
+ position.left = (typeof _.left !== 'undefined') ? _.left : position.left;
+ position.top = (typeof _.top !== 'undefined') ? _.top : position.top;
+ return nvtooltip;
+ };
+
+ nvtooltip.fixedTop = function(_) {
+ if (!arguments.length) return fixedTop;
+ fixedTop = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.enabled = function(_) {
+ if (!arguments.length) return enabled;
+ enabled = _;
+ return nvtooltip;
+ };
+
+ nvtooltip.valueFormatter = function(_) {
+ if (!arguments.length) return valueFormatter;
+ if (typeof _ === 'function') {
+ valueFormatter = _;
+ }
+ return nvtooltip;
+ };
+
+ nvtooltip.headerFormatter = function(_) {
+ if (!arguments.length) return headerFormatter;
+ if (typeof _ === 'function') {
+ headerFormatter = _;
+ }
+ return nvtooltip;
+ };
+
+ //id() is a read-only function. You can't use it to set the id.
+ nvtooltip.id = function() {
+ return id;
+ };
+
+
+ return nvtooltip;
+ };
+
+
+ //Original tooltip.show function. Kept for backward compatibility.
+ // pos = [left,top]
+ nv.tooltip.show = function(pos, content, gravity, dist, parentContainer, classes) {
+
+ //Create new tooltip div if it doesn't exist on DOM.
+ var container = document.createElement('div');
+ container.className = 'nvtooltip ' + (classes ? classes : 'xy-tooltip');
+
+ var body = parentContainer;
+ if ( !parentContainer || parentContainer.tagName.match(/g|svg/i)) {
+ //If the parent element is an SVG element, place tooltip in the <body> element.
+ body = document.getElementsByTagName('body')[0];
+ }
+
+ container.style.left = 0;
+ container.style.top = 0;
+ container.style.opacity = 0;
+ container.innerHTML = content;
+ body.appendChild(container);
+
+ //If the parent container is an overflow <div> with scrollbars, subtract the scroll offsets.
+ if (parentContainer) {
+ pos[0] = pos[0] - parentContainer.scrollLeft;
+ pos[1] = pos[1] - parentContainer.scrollTop;
+ }
+ nv.tooltip.calcTooltipPosition(pos, gravity, dist, container);
+ };
+
+ //Looks up the ancestry of a DOM element, and returns the first NON-svg node.
+ nv.tooltip.findFirstNonSVGParent = function(Elem) {
+ while(Elem.tagName.match(/^g|svg$/i) !== null) {
+ Elem = Elem.parentNode;
+ }
+ return Elem;
+ };
+
+ //Finds the total offsetTop of a given DOM element.
+ //Looks up the entire ancestry of an element, up to the first relatively positioned element.
+ nv.tooltip.findTotalOffsetTop = function ( Elem, initialTop ) {
+ var offsetTop = initialTop;
+
+ do {
+ if( !isNaN( Elem.offsetTop ) ) {
+ offsetTop += (Elem.offsetTop);
+ }
+ } while( Elem = Elem.offsetParent );
+ return offsetTop;
+ };
+
+ //Finds the total offsetLeft of a given DOM element.
+ //Looks up the entire ancestry of an element, up to the first relatively positioned element.
+ nv.tooltip.findTotalOffsetLeft = function ( Elem, initialLeft) {
+ var offsetLeft = initialLeft;
+
+ do {
+ if( !isNaN( Elem.offsetLeft ) ) {
+ offsetLeft += (Elem.offsetLeft);
+ }
+ } while( Elem = Elem.offsetParent );
+ return offsetLeft;
+ };
+
+ //Global utility function to render a tooltip on the DOM.
+ //pos = [left,top] coordinates of where to place the tooltip, relative to the SVG chart container.
+ //gravity = how to orient the tooltip
+ //dist = how far away from the mouse to place tooltip
+ //container = tooltip DIV
+ nv.tooltip.calcTooltipPosition = function(pos, gravity, dist, container) {
+
+ var height = parseInt(container.offsetHeight),
+ width = parseInt(container.offsetWidth),
+ windowWidth = nv.utils.windowSize().width,
+ windowHeight = nv.utils.windowSize().height,
+ scrollTop = window.pageYOffset,
+ scrollLeft = window.pageXOffset,
+ left, top;
+
+ windowHeight = window.innerWidth >= document.body.scrollWidth ? windowHeight : windowHeight - 16;
+ windowWidth = window.innerHeight >= document.body.scrollHeight ? windowWidth : windowWidth - 16;
+
+ gravity = gravity || 's';
+ dist = dist || 20;
+
+ var tooltipTop = function ( Elem ) {
+ return nv.tooltip.findTotalOffsetTop(Elem, top);
+ };
+
+ var tooltipLeft = function ( Elem ) {
+ return nv.tooltip.findTotalOffsetLeft(Elem,left);
+ };
+
+ switch (gravity) {
+ case 'e':
+ left = pos[0] - width - dist;
+ top = pos[1] - (height / 2);
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = pos[0] + dist > scrollLeft ? pos[0] + dist : scrollLeft - tLeft + left;
+ if (tTop < scrollTop) top = scrollTop - tTop + top;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
+ break;
+ case 'w':
+ left = pos[0] + dist;
+ top = pos[1] - (height / 2);
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft + width > windowWidth) left = pos[0] - width - dist;
+ if (tTop < scrollTop) top = scrollTop + 5;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
+ break;
+ case 'n':
+ left = pos[0] - (width / 2) - 5;
+ top = pos[1] + dist;
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = scrollLeft + 5;
+ if (tLeft + width > windowWidth) left = left - width/2 + 5;
+ if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
+ break;
+ case 's':
+ left = pos[0] - (width / 2);
+ top = pos[1] - height - dist;
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ if (tLeft < scrollLeft) left = scrollLeft + 5;
+ if (tLeft + width > windowWidth) left = left - width/2 + 5;
+ if (scrollTop > tTop) top = scrollTop;
+ break;
+ case 'none':
+ left = pos[0];
+ top = pos[1] - dist;
+ var tLeft = tooltipLeft(container);
+ var tTop = tooltipTop(container);
+ break;
+ }
+
+
+ container.style.left = left+'px';
+ container.style.top = top+'px';
+ container.style.opacity = 1;
+ container.style.position = 'absolute';
+
+ return container;
+ };
+
+ //Global utility function to remove tooltips from the DOM.
+ nv.tooltip.cleanup = function() {
+
+ // Find the tooltips, mark them for removal by this class (so others cleanups won't find it)
+ var tooltips = document.getElementsByClassName('nvtooltip');
+ var purging = [];
+ while(tooltips.length) {
+ purging.push(tooltips[0]);
+ tooltips[0].style.transitionDelay = '0 !important';
+ tooltips[0].style.opacity = 0;
+ tooltips[0].className = 'nvtooltip-pending-removal';
+ }
+
+ setTimeout(function() {
+
+ while (purging.length) {
+ var removeMe = purging.pop();
+ removeMe.parentNode.removeChild(removeMe);
+ }
+ }, 500);
+ };
+
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/utils.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/utils.js
new file mode 100644
index 00000000..7b99e1da
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/utils.js
@@ -0,0 +1,152 @@
+
+nv.utils.windowSize = function() {
+ // Sane defaults
+ var size = {width: 640, height: 480};
+
+ // Earlier IE uses Doc.body
+ if (document.body && document.body.offsetWidth) {
+ size.width = document.body.offsetWidth;
+ size.height = document.body.offsetHeight;
+ }
+
+ // IE can use depending on mode it is in
+ if (document.compatMode=='CSS1Compat' &&
+ document.documentElement &&
+ document.documentElement.offsetWidth ) {
+ size.width = document.documentElement.offsetWidth;
+ size.height = document.documentElement.offsetHeight;
+ }
+
+ // Most recent browsers use
+ if (window.innerWidth && window.innerHeight) {
+ size.width = window.innerWidth;
+ size.height = window.innerHeight;
+ }
+ return (size);
+};
+
+
+
+// Easy way to bind multiple functions to window.onresize
+// TODO: give a way to remove a function after its bound, other than removing all of them
+nv.utils.windowResize = function(fun){
+ if (fun === undefined) return;
+ var oldresize = window.onresize;
+
+ window.onresize = function(e) {
+ if (typeof oldresize == 'function') oldresize(e);
+ fun(e);
+ }
+}
+
+// Backwards compatible way to implement more d3-like coloring of graphs.
+// If passed an array, wrap it in a function which implements the old default
+// behavior
+nv.utils.getColor = function(color) {
+ if (!arguments.length) return nv.utils.defaultColor(); //if you pass in nothing, get default colors back
+
+ if( Object.prototype.toString.call( color ) === '[object Array]' )
+ return function(d, i) { return d.color || color[i % color.length]; };
+ else
+ return color;
+ //can't really help it if someone passes rubbish as color
+}
+
+// Default color chooser uses the index of an object as before.
+nv.utils.defaultColor = function() {
+ var colors = d3.scale.category20().range();
+ return function(d, i) { return d.color || colors[i % colors.length] };
+}
+
+
+// Returns a color function that takes the result of 'getKey' for each series and
+// looks for a corresponding color from the dictionary,
+nv.utils.customTheme = function(dictionary, getKey, defaultColors) {
+ getKey = getKey || function(series) { return series.key }; // use default series.key if getKey is undefined
+ defaultColors = defaultColors || d3.scale.category20().range(); //default color function
+
+ var defIndex = defaultColors.length; //current default color (going in reverse)
+
+ return function(series, index) {
+ var key = getKey(series);
+
+ if (!defIndex) defIndex = defaultColors.length; //used all the default colors, start over
+
+ if (typeof dictionary[key] !== "undefined")
+ return (typeof dictionary[key] === "function") ? dictionary[key]() : dictionary[key];
+ else
+ return defaultColors[--defIndex]; // no match in dictionary, use default color
+ }
+}
+
+
+
+// From the PJAX example on d3js.org, while this is not really directly needed
+// it's a very cool method for doing pjax, I may expand upon it a little bit,
+// open to suggestions on anything that may be useful
+nv.utils.pjax = function(links, content) {
+ d3.selectAll(links).on("click", function() {
+ history.pushState(this.href, this.textContent, this.href);
+ load(this.href);
+ d3.event.preventDefault();
+ });
+
+ function load(href) {
+ d3.html(href, function(fragment) {
+ var target = d3.select(content).node();
+ target.parentNode.replaceChild(d3.select(fragment).select(content).node(), target);
+ nv.utils.pjax(links, content);
+ });
+ }
+
+ d3.select(window).on("popstate", function() {
+ if (d3.event.state) load(d3.event.state);
+ });
+}
+
+/* For situations where we want to approximate the width in pixels for an SVG:text element.
+Most common instance is when the element is in a display:none; container.
+Forumla is : text.length * font-size * constant_factor
+*/
+nv.utils.calcApproxTextWidth = function (svgTextElem) {
+ if (svgTextElem instanceof d3.selection) {
+ var fontSize = parseInt(svgTextElem.style("font-size").replace("px",""));
+ var textLength = svgTextElem.text().length;
+
+ return textLength * fontSize * 0.5;
+ }
+ return 0;
+};
+
+/* Numbers that are undefined, null or NaN, convert them to zeros.
+*/
+nv.utils.NaNtoZero = function(n) {
+ if (typeof n !== 'number'
+ || isNaN(n)
+ || n === null
+ || n === Infinity) return 0;
+
+ return n;
+};
+
+/*
+Snippet of code you can insert into each nv.models.* to give you the ability to
+do things like:
+chart.options({
+ showXAxis: true,
+ tooltips: true
+});
+
+To enable in the chart:
+chart.options = nv.utils.optionsFunc.bind(chart);
+*/
+nv.utils.optionsFunc = function(args) {
+ if (args) {
+ d3.map(args).forEach((function(key,value) {
+ if (typeof this[key] === "function") {
+ this[key](value);
+ }
+ }).bind(this));
+ }
+ return this;
+}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dashed-canvas.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dashed-canvas.js
new file mode 100644
index 00000000..cec77298
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dashed-canvas.js
@@ -0,0 +1,176 @@
+/**
+ * @license
+ * Copyright 2012 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+
+/**
+ * @fileoverview Adds support for dashed lines to the HTML5 canvas.
+ *
+ * Usage:
+ * var ctx = canvas.getContext("2d");
+ * ctx.installPattern([10, 5]) // draw 10 pixels, skip 5 pixels, repeat.
+ * ctx.beginPath();
+ * ctx.moveTo(100, 100); // start the first line segment.
+ * ctx.lineTo(150, 200);
+ * ctx.lineTo(200, 100);
+ * ctx.moveTo(300, 150); // start a second, unconnected line
+ * ctx.lineTo(400, 250);
+ * ...
+ * ctx.stroke(); // draw the dashed line.
+ * ctx.uninstallPattern();
+ *
+ * This is designed to leave the canvas untouched when it's not used.
+ * If you never install a pattern, or call uninstallPattern(), then the canvas
+ * will be exactly as it would have if you'd never used this library. The only
+ * difference from the standard canvas will be the "installPattern" method of
+ * the drawing context.
+ */
+
+/**
+ * Change the stroking style of the canvas drawing context from a solid line to
+ * a pattern (e.g. dashes, dash-dot-dash, etc.)
+ *
+ * Once you've installed the pattern, you can draw with it by using the
+ * beginPath(), moveTo(), lineTo() and stroke() method calls. Note that some
+ * more advanced methods (e.g. quadraticCurveTo() and bezierCurveTo()) are not
+ * supported. See file overview for a working example.
+ *
+ * Side effects of calling this method include adding an "isPatternInstalled"
+ * property and "uninstallPattern" method to this particular canvas context.
+ * You must call uninstallPattern() before calling installPattern() again.
+ *
+ * @param {Array.<number>} pattern A description of the stroke pattern. Even
+ * indices indicate a draw and odd indices indicate a gap (in pixels). The
+ * array should have a even length as any odd lengthed array could be expressed
+ * as a smaller even length array.
+ */
+CanvasRenderingContext2D.prototype.installPattern = function(pattern) {
+ "use strict";
+
+ if (typeof(this.isPatternInstalled) !== 'undefined') {
+ throw "Must un-install old line pattern before installing a new one.";
+ }
+ this.isPatternInstalled = true;
+
+ var dashedLineToHistory = [0, 0];
+
+ // list of connected line segements:
+ // [ [x1, y1], ..., [xn, yn] ], [ [x1, y1], ..., [xn, yn] ]
+ var segments = [];
+
+ // Stash away copies of the unmodified line-drawing functions.
+ var realBeginPath = this.beginPath;
+ var realLineTo = this.lineTo;
+ var realMoveTo = this.moveTo;
+ var realStroke = this.stroke;
+
+ /** @type {function()|undefined} */
+ this.uninstallPattern = function() {
+ this.beginPath = realBeginPath;
+ this.lineTo = realLineTo;
+ this.moveTo = realMoveTo;
+ this.stroke = realStroke;
+ this.uninstallPattern = undefined;
+ this.isPatternInstalled = undefined;
+ };
+
+ // Keep our own copies of the line segments as they're drawn.
+ this.beginPath = function() {
+ segments = [];
+ realBeginPath.call(this);
+ };
+ this.moveTo = function(x, y) {
+ segments.push([[x, y]]);
+ realMoveTo.call(this, x, y);
+ };
+ this.lineTo = function(x, y) {
+ var last = segments[segments.length - 1];
+ last.push([x, y]);
+ };
+
+ this.stroke = function() {
+ if (segments.length === 0) {
+ // Maybe the user is drawing something other than a line.
+ // TODO(danvk): test this case.
+ realStroke.call(this);
+ return;
+ }
+
+ for (var i = 0; i < segments.length; i++) {
+ var seg = segments[i];
+ var x1 = seg[0][0], y1 = seg[0][1];
+ for (var j = 1; j < seg.length; j++) {
+ // Draw a dashed line from (x1, y1) - (x2, y2)
+ var x2 = seg[j][0], y2 = seg[j][1];
+ this.save();
+
+ // Calculate transformation parameters
+ var dx = (x2-x1);
+ var dy = (y2-y1);
+ var len = Math.sqrt(dx*dx + dy*dy);
+ var rot = Math.atan2(dy, dx);
+
+ // Set transformation
+ this.translate(x1, y1);
+ realMoveTo.call(this, 0, 0);
+ this.rotate(rot);
+
+ // Set last pattern index we used for this pattern.
+ var patternIndex = dashedLineToHistory[0];
+ var x = 0;
+ while (len > x) {
+ // Get the length of the pattern segment we are dealing with.
+ var segment = pattern[patternIndex];
+ // If our last draw didn't complete the pattern segment all the way
+ // we will try to finish it. Otherwise we will try to do the whole
+ // segment.
+ if (dashedLineToHistory[1]) {
+ x += dashedLineToHistory[1];
+ } else {
+ x += segment;
+ }
+
+ if (x > len) {
+ // We were unable to complete this pattern index all the way, keep
+ // where we are the history so our next draw continues where we
+ // left off in the pattern.
+ dashedLineToHistory = [patternIndex, x-len];
+ x = len;
+ } else {
+ // We completed this patternIndex, we put in the history that we
+ // are on the beginning of the next segment.
+ dashedLineToHistory = [(patternIndex+1)%pattern.length, 0];
+ }
+
+ // We do a line on a even pattern index and just move on a odd
+ // pattern index. The move is the empty space in the dash.
+ if (patternIndex % 2 === 0) {
+ realLineTo.call(this, x, 0);
+ } else {
+ realMoveTo.call(this, x, 0);
+ }
+
+ // If we are not done, next loop process the next pattern segment, or
+ // the first segment again if we are at the end of the pattern.
+ patternIndex = (patternIndex+1) % pattern.length;
+ }
+
+ this.restore();
+ x1 = x2, y1 = y2;
+ }
+ }
+ realStroke.call(this);
+ segments = [];
+ };
+};
+
+/**
+ * Removes the previously-installed pattern.
+ * You must call installPattern() before calling this. You can install at most
+ * one pattern at a time--there is no pattern stack.
+ */
+CanvasRenderingContext2D.prototype.uninstallPattern = function() {
+ // This will be replaced by a non-error version when a pattern is installed.
+ throw "Must install a line pattern before uninstalling it.";
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/data.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/data.js
new file mode 100644
index 00000000..d92a6339
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/data.js
@@ -0,0 +1,63 @@
+function StubbedData() {
+return "" +
+"Date,A,B\n" +
+"20061001,3.01953818828,0.7212041046,2.18487394958,0.599318549691\n" +
+"20061002,3.63321799308,0.778297234566,1.69491525424,0.531417655826\n" +
+"20061003,2.44328097731,0.644967734352,2.51256281407,0.640539070386\n" +
+"20061004,3.52733686067,0.774700921683,2.68456375839,0.66207105053\n" +
+"20061005,3.28719723183,0.741636245748,2.35294117647,0.621407707226\n" +
+"20061006,1.58450704225,0.523967868159,3.78657487091,0.791868460623\n" +
+"20061007,5.32859680284,0.946589405904,4.0404040404,0.807910739509\n" +
+"20061008,2.64084507042,0.672799548916,2.37288135593,0.626609885481\n" +
+"20061009,2.26480836237,0.620990945917,3.5413153457,0.75897176848\n" +
+"20061010,3.29289428076,0.74289969528,2.02702702703,0.579191340004\n" +
+"20061011,2.7633851468,0.681234043829,1.1744966443,0.4413034044\n" +
+"20061012,3.28719723183,0.741636245748,3.37268128162,0.741327769578\n" +
+"20061013,1.77304964539,0.55569466381,1.85810810811,0.555011329732\n" +
+"20061014,3.39892665474,0.7664008338,1.67224080268,0.524368852929\n" +
+"20061015,2.65017667845,0.675144574777,3.35570469799,0.737661045752\n" +
+"20061016,3.63951473137,0.779620631266,2.34899328859,0.620377617453\n" +
+"20061017,2.25694444444,0.618859623032,1.68067226891,0.526990133716\n" +
+"20061018,4.47504302926,0.857766274964,2.51677852349,0.641599927369\n" +
+"20061019,2.44755244755,0.646081155692,1.68067226891,0.526990133716\n" +
+"20061020,3.67775831874,0.787656442774,3.066439523,0.711598843969\n" +
+"20061021,3.94265232975,0.823839169829,3.85906040268,0.788990618726\n" +
+"20061022,2.59067357513,0.660187558973,3.71621621622,0.777438794254\n" +
+"20061023,4.33275563258,0.847570482324,3.85906040268,0.788990618726\n" +
+"20061024,3.10344827586,0.720049610821,2.84280936455,0.679611549697\n" +
+"20061025,1.40350877193,0.492720767725,2.7027027027,0.666482380968\n" +
+"20061026,1.95035460993,0.582291234145,2.36486486486,0.624518599275\n" +
+"20061027,2.30905861456,0.632980642182,2.03045685279,0.580161203819\n" +
+"20061028,4.09252669039,0.835706590809,2.87648054146,0.68754192469\n" +
+"20061029,2.66903914591,0.679883997626,2.02360876897,0.578224712918\n" +
+"20061030,4.74516695958,0.89127787497,4.36241610738,0.836670992529\n" +
+"20061031,2.78260869565,0.685905251933,3.20945945946,0.724388507178\n" +
+"20061101,1.5873015873,0.524884521441,1.51260504202,0.500373860545\n" +
+"20061102,2.78745644599,0.687083077461,2.0202020202,0.57726130639\n" +
+"20061103,5.11463844797,0.925157232782,2.68907563025,0.663168401088\n" +
+"20061104,4.9001814882,0.919644816432,3.07692307692,0.713993047527\n" +
+"20061105,5.13274336283,0.928343545136,3.55329949239,0.761492892041\n" +
+"20061106,1.92644483363,0.575222935029,2.35294117647,0.621407707226\n" +
+"20061107,2.46478873239,0.650573541306,1.52027027027,0.502889967904\n" +
+"20061108,2.13523131673,0.609772022763,2.6981450253,0.665374048085\n" +
+"20061109,3.88007054674,0.811026422222,2.72572402044,0.672079879106\n" +
+"20061110,2.63620386643,0.671633132526,3.71621621622,0.777438794254\n" +
+"20061111,3.69718309859,0.791736755355,3.0303030303,0.703344064467\n" +
+"20061112,3.83944153578,0.802703592906,4.05405405405,0.81058250986\n" +
+"20061113,2.47787610619,0.653984033555,2.20338983051,0.604340313133\n" +
+"20061114,1.77304964539,0.55569466381,2.22222222222,0.60944692682\n" +
+"20061115,2.30088495575,0.630766388737,0.843170320405,0.375484163785\n" +
+"20061116,1.57894736842,0.522144132232,2.19594594595,0.602321544724\n" +
+"20061118,2.45183887916,0.647198426991,1.69491525424,0.531417655826\n" +
+"20061119,3.52733686067,0.774700921683,1.85185185185,0.55316023504\n" +
+"20061120,2.97723292469,0.711254751484,2.6981450253,0.665374048085\n" +
+"20061121,2.29681978799,0.629665059963,2.01680672269,0.576301104352\n" +
+"20061122,3.01418439716,0.719945245328,2.5466893039,0.649125445325\n" +
+"20061123,3.78378378378,0.809917534069,2.6936026936,0.664269394219\n" +
+"20061124,3.18584070796,0.738851643987,2.01005025126,0.57439025002\n" +
+"20061125,2.83185840708,0.697868332879,3.066439523,0.711598843969\n" +
+"20061126,3.01953818828,0.7212041046,2.53378378378,0.645878720149\n" +
+"20061127,2.81195079086,0.693033387099,1.51006711409,0.499540743312\n" +
+"20061128,2.97723292469,0.711254751484,2.54237288136,0.648039583782\n" +
+"20061129,1.41093474427,0.495309102312,3.02013422819,0.701020603129";
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-canvas.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-canvas.js
new file mode 100644
index 00000000..cba4f449
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-canvas.js
@@ -0,0 +1,816 @@
+/**
+ * @license
+ * Copyright 2006 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+
+/**
+ * @fileoverview Based on PlotKit.CanvasRenderer, but modified to meet the
+ * needs of dygraphs.
+ *
+ * In particular, support for:
+ * - grid overlays
+ * - error bars
+ * - dygraphs attribute system
+ */
+
+/**
+ * The DygraphCanvasRenderer class does the actual rendering of the chart onto
+ * a canvas. It's based on PlotKit.CanvasRenderer.
+ * @param {Object} element The canvas to attach to
+ * @param {Object} elementContext The 2d context of the canvas (injected so it
+ * can be mocked for testing.)
+ * @param {Layout} layout The DygraphLayout object for this graph.
+ * @constructor
+ */
+
+/*jshint globalstrict: true */
+/*global Dygraph:false,RGBColorParser:false */
+"use strict";
+
+
+/**
+ * @constructor
+ *
+ * This gets called when there are "new points" to chart. This is generally the
+ * case when the underlying data being charted has changed. It is _not_ called
+ * in the common case that the user has zoomed or is panning the view.
+ *
+ * The chart canvas has already been created by the Dygraph object. The
+ * renderer simply gets a drawing context.
+ *
+ * @param {Dygraph} dygraph The chart to which this renderer belongs.
+ * @param {HTMLCanvasElement} element The &lt;canvas&gt; DOM element on which to draw.
+ * @param {CanvasRenderingContext2D} elementContext The drawing context.
+ * @param {DygraphLayout} layout The chart's DygraphLayout object.
+ *
+ * TODO(danvk): remove the elementContext property.
+ */
+var DygraphCanvasRenderer = function(dygraph, element, elementContext, layout) {
+ this.dygraph_ = dygraph;
+
+ this.layout = layout;
+ this.element = element;
+ this.elementContext = elementContext;
+ this.container = this.element.parentNode;
+
+ this.height = this.element.height;
+ this.width = this.element.width;
+
+ // --- check whether everything is ok before we return
+ // NOTE(konigsberg): isIE is never defined in this object. Bug of some sort.
+ if (!this.isIE && !(DygraphCanvasRenderer.isSupported(this.element)))
+ throw "Canvas is not supported.";
+
+ // internal state
+ this.area = layout.getPlotArea();
+ this.container.style.position = "relative";
+ this.container.style.width = this.width + "px";
+
+ // Set up a clipping area for the canvas (and the interaction canvas).
+ // This ensures that we don't overdraw.
+ if (this.dygraph_.isUsingExcanvas_) {
+ this._createIEClipArea();
+ } else {
+ // on Android 3 and 4, setting a clipping area on a canvas prevents it from
+ // displaying anything.
+ if (!Dygraph.isAndroid()) {
+ var ctx = this.dygraph_.canvas_ctx_;
+ ctx.beginPath();
+ ctx.rect(this.area.x, this.area.y, this.area.w, this.area.h);
+ ctx.clip();
+
+ ctx = this.dygraph_.hidden_ctx_;
+ ctx.beginPath();
+ ctx.rect(this.area.x, this.area.y, this.area.w, this.area.h);
+ ctx.clip();
+ }
+ }
+};
+
+/**
+ * This just forwards to dygraph.attr_.
+ * TODO(danvk): remove this?
+ * @private
+ */
+DygraphCanvasRenderer.prototype.attr_ = function(name, opt_seriesName) {
+ return this.dygraph_.attr_(name, opt_seriesName);
+};
+
+/**
+ * Clears out all chart content and DOM elements.
+ * This is called immediately before render() on every frame, including
+ * during zooms and pans.
+ * @private
+ */
+DygraphCanvasRenderer.prototype.clear = function() {
+ var context;
+ if (this.isIE) {
+ // VML takes a while to start up, so we just poll every this.IEDelay
+ try {
+ if (this.clearDelay) {
+ this.clearDelay.cancel();
+ this.clearDelay = null;
+ }
+ context = this.elementContext;
+ }
+ catch (e) {
+ // TODO(danvk): this is broken, since MochiKit.Async is gone.
+ // this.clearDelay = MochiKit.Async.wait(this.IEDelay);
+ // this.clearDelay.addCallback(bind(this.clear, this));
+ return;
+ }
+ }
+
+ context = this.elementContext;
+ context.clearRect(0, 0, this.width, this.height);
+};
+
+/**
+ * Checks whether the browser supports the &lt;canvas&gt; tag.
+ * @private
+ */
+DygraphCanvasRenderer.isSupported = function(canvasName) {
+ var canvas = null;
+ try {
+ if (typeof(canvasName) == 'undefined' || canvasName === null) {
+ canvas = document.createElement("canvas");
+ } else {
+ canvas = canvasName;
+ }
+ canvas.getContext("2d");
+ }
+ catch (e) {
+ var ie = navigator.appVersion.match(/MSIE (\d\.\d)/);
+ var opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
+ if ((!ie) || (ie[1] < 6) || (opera))
+ return false;
+ return true;
+ }
+ return true;
+};
+
+/**
+ * This method is responsible for drawing everything on the chart, including
+ * lines, error bars, fills and axes.
+ * It is called immediately after clear() on every frame, including during pans
+ * and zooms.
+ * @private
+ */
+DygraphCanvasRenderer.prototype.render = function() {
+ // attaches point.canvas{x,y}
+ this._updatePoints();
+
+ // actually draws the chart.
+ this._renderLineChart();
+};
+
+DygraphCanvasRenderer.prototype._createIEClipArea = function() {
+ var className = 'dygraph-clip-div';
+ var graphDiv = this.dygraph_.graphDiv;
+
+ // Remove old clip divs.
+ for (var i = graphDiv.childNodes.length-1; i >= 0; i--) {
+ if (graphDiv.childNodes[i].className == className) {
+ graphDiv.removeChild(graphDiv.childNodes[i]);
+ }
+ }
+
+ // Determine background color to give clip divs.
+ var backgroundColor = document.bgColor;
+ var element = this.dygraph_.graphDiv;
+ while (element != document) {
+ var bgcolor = element.currentStyle.backgroundColor;
+ if (bgcolor && bgcolor != 'transparent') {
+ backgroundColor = bgcolor;
+ break;
+ }
+ element = element.parentNode;
+ }
+
+ function createClipDiv(area) {
+ if (area.w === 0 || area.h === 0) {
+ return;
+ }
+ var elem = document.createElement('div');
+ elem.className = className;
+ elem.style.backgroundColor = backgroundColor;
+ elem.style.position = 'absolute';
+ elem.style.left = area.x + 'px';
+ elem.style.top = area.y + 'px';
+ elem.style.width = area.w + 'px';
+ elem.style.height = area.h + 'px';
+ graphDiv.appendChild(elem);
+ }
+
+ var plotArea = this.area;
+ // Left side
+ createClipDiv({
+ x:0, y:0,
+ w:plotArea.x,
+ h:this.height
+ });
+
+ // Top
+ createClipDiv({
+ x: plotArea.x, y: 0,
+ w: this.width - plotArea.x,
+ h: plotArea.y
+ });
+
+ // Right side
+ createClipDiv({
+ x: plotArea.x + plotArea.w, y: 0,
+ w: this.width-plotArea.x - plotArea.w,
+ h: this.height
+ });
+
+ // Bottom
+ createClipDiv({
+ x: plotArea.x,
+ y: plotArea.y + plotArea.h,
+ w: this.width - plotArea.x,
+ h: this.height - plotArea.h - plotArea.y
+ });
+};
+
+
+/**
+ * Returns a predicate to be used with an iterator, which will
+ * iterate over points appropriately, depending on whether
+ * connectSeparatedPoints is true. When it's false, the predicate will
+ * skip over points with missing yVals.
+ */
+DygraphCanvasRenderer._getIteratorPredicate = function(connectSeparatedPoints) {
+ return connectSeparatedPoints ?
+ DygraphCanvasRenderer._predicateThatSkipsEmptyPoints :
+ null;
+};
+
+DygraphCanvasRenderer._predicateThatSkipsEmptyPoints =
+ function(array, idx) {
+ return array[idx].yval !== null;
+};
+
+/**
+ * Draws a line with the styles passed in and calls all the drawPointCallbacks.
+ * @param {Object} e The dictionary passed to the plotter function.
+ * @private
+ */
+DygraphCanvasRenderer._drawStyledLine = function(e,
+ color, strokeWidth, strokePattern, drawPoints,
+ drawPointCallback, pointSize) {
+ var g = e.dygraph;
+ // TODO(konigsberg): Compute attributes outside this method call.
+ var stepPlot = g.getOption("stepPlot", e.setName);
+
+ if (!Dygraph.isArrayLike(strokePattern)) {
+ strokePattern = null;
+ }
+
+ var drawGapPoints = g.getOption('drawGapEdgePoints', e.setName);
+
+ var points = e.points;
+ var iter = Dygraph.createIterator(points, 0, points.length,
+ DygraphCanvasRenderer._getIteratorPredicate(
+ g.getOption("connectSeparatedPoints"))); // TODO(danvk): per-series?
+
+ var stroking = strokePattern && (strokePattern.length >= 2);
+
+ var ctx = e.drawingContext;
+ ctx.save();
+ if (stroking) {
+ ctx.installPattern(strokePattern);
+ }
+
+ var pointsOnLine = DygraphCanvasRenderer._drawSeries(
+ e, iter, strokeWidth, pointSize, drawPoints, drawGapPoints, stepPlot, color);
+ DygraphCanvasRenderer._drawPointsOnLine(
+ e, pointsOnLine, drawPointCallback, color, pointSize);
+
+ if (stroking) {
+ ctx.uninstallPattern();
+ }
+
+ ctx.restore();
+};
+
+/**
+ * This does the actual drawing of lines on the canvas, for just one series.
+ * Returns a list of [canvasx, canvasy] pairs for points for which a
+ * drawPointCallback should be fired. These include isolated points, or all
+ * points if drawPoints=true.
+ * @param {Object} e The dictionary passed to the plotter function.
+ * @private
+ */
+DygraphCanvasRenderer._drawSeries = function(e,
+ iter, strokeWidth, pointSize, drawPoints, drawGapPoints, stepPlot, color) {
+
+ var prevCanvasX = null;
+ var prevCanvasY = null;
+ var nextCanvasY = null;
+ var isIsolated; // true if this point is isolated (no line segments)
+ var point; // the point being processed in the while loop
+ var pointsOnLine = []; // Array of [canvasx, canvasy] pairs.
+ var first = true; // the first cycle through the while loop
+
+ var ctx = e.drawingContext;
+ ctx.beginPath();
+ ctx.strokeStyle = color;
+ ctx.lineWidth = strokeWidth;
+
+ // NOTE: we break the iterator's encapsulation here for about a 25% speedup.
+ var arr = iter.array_;
+ var limit = iter.end_;
+ var predicate = iter.predicate_;
+
+ for (var i = iter.start_; i < limit; i++) {
+ point = arr[i];
+ if (predicate) {
+ while (i < limit && !predicate(arr, i)) {
+ i++;
+ }
+ if (i == limit) break;
+ point = arr[i];
+ }
+
+ if (point.canvasy === null || point.canvasy != point.canvasy) {
+ if (stepPlot && prevCanvasX !== null) {
+ // Draw a horizontal line to the start of the missing data
+ ctx.moveTo(prevCanvasX, prevCanvasY);
+ ctx.lineTo(point.canvasx, prevCanvasY);
+ }
+ prevCanvasX = prevCanvasY = null;
+ } else {
+ isIsolated = false;
+ if (drawGapPoints || !prevCanvasX) {
+ iter.nextIdx_ = i;
+ iter.next();
+ nextCanvasY = iter.hasNext ? iter.peek.canvasy : null;
+
+ var isNextCanvasYNullOrNaN = nextCanvasY === null ||
+ nextCanvasY != nextCanvasY;
+ isIsolated = (!prevCanvasX && isNextCanvasYNullOrNaN);
+ if (drawGapPoints) {
+ // Also consider a point to be "isolated" if it's adjacent to a
+ // null point, excluding the graph edges.
+ if ((!first && !prevCanvasX) ||
+ (iter.hasNext && isNextCanvasYNullOrNaN)) {
+ isIsolated = true;
+ }
+ }
+ }
+
+ if (prevCanvasX !== null) {
+ if (strokeWidth) {
+ if (stepPlot) {
+ ctx.moveTo(prevCanvasX, prevCanvasY);
+ ctx.lineTo(point.canvasx, prevCanvasY);
+ }
+
+ ctx.lineTo(point.canvasx, point.canvasy);
+ }
+ } else {
+ ctx.moveTo(point.canvasx, point.canvasy);
+ }
+ if (drawPoints || isIsolated) {
+ pointsOnLine.push([point.canvasx, point.canvasy, point.idx]);
+ }
+ prevCanvasX = point.canvasx;
+ prevCanvasY = point.canvasy;
+ }
+ first = false;
+ }
+ ctx.stroke();
+ return pointsOnLine;
+};
+
+/**
+ * This fires the drawPointCallback functions, which draw dots on the points by
+ * default. This gets used when the "drawPoints" option is set, or when there
+ * are isolated points.
+ * @param {Object} e The dictionary passed to the plotter function.
+ * @private
+ */
+DygraphCanvasRenderer._drawPointsOnLine = function(
+ e, pointsOnLine, drawPointCallback, color, pointSize) {
+ var ctx = e.drawingContext;
+ for (var idx = 0; idx < pointsOnLine.length; idx++) {
+ var cb = pointsOnLine[idx];
+ ctx.save();
+ drawPointCallback(
+ e.dygraph, e.setName, ctx, cb[0], cb[1], color, pointSize, cb[2]);
+ ctx.restore();
+ }
+};
+
+/**
+ * Attaches canvas coordinates to the points array.
+ * @private
+ */
+DygraphCanvasRenderer.prototype._updatePoints = function() {
+ // Update Points
+ // TODO(danvk): here
+ //
+ // TODO(bhs): this loop is a hot-spot for high-point-count charts. These
+ // transformations can be pushed into the canvas via linear transformation
+ // matrices.
+ // NOTE(danvk): this is trickier than it sounds at first. The transformation
+ // needs to be done before the .moveTo() and .lineTo() calls, but must be
+ // undone before the .stroke() call to ensure that the stroke width is
+ // unaffected. An alternative is to reduce the stroke width in the
+ // transformed coordinate space, but you can't specify different values for
+ // each dimension (as you can with .scale()). The speedup here is ~12%.
+ var sets = this.layout.points;
+ for (var i = sets.length; i--;) {
+ var points = sets[i];
+ for (var j = points.length; j--;) {
+ var point = points[j];
+ point.canvasx = this.area.w * point.x + this.area.x;
+ point.canvasy = this.area.h * point.y + this.area.y;
+ }
+ }
+};
+
+/**
+ * Add canvas Actually draw the lines chart, including error bars.
+ *
+ * This function can only be called if DygraphLayout's points array has been
+ * updated with canvas{x,y} attributes, i.e. by
+ * DygraphCanvasRenderer._updatePoints.
+ *
+ * @param {string=} opt_seriesName when specified, only that series will
+ * be drawn. (This is used for expedited redrawing with highlightSeriesOpts)
+ * @param {CanvasRenderingContext2D} opt_ctx when specified, the drawing
+ * context. However, lines are typically drawn on the object's
+ * elementContext.
+ * @private
+ */
+DygraphCanvasRenderer.prototype._renderLineChart = function(opt_seriesName, opt_ctx) {
+ var ctx = opt_ctx || this.elementContext;
+ var i;
+
+ var sets = this.layout.points;
+ var setNames = this.layout.setNames;
+ var setName;
+
+ this.colors = this.dygraph_.colorsMap_;
+
+ // Determine which series have specialized plotters.
+ var plotter_attr = this.attr_("plotter");
+ var plotters = plotter_attr;
+ if (!Dygraph.isArrayLike(plotters)) {
+ plotters = [plotters];
+ }
+
+ var setPlotters = {}; // series name -> plotter fn.
+ for (i = 0; i < setNames.length; i++) {
+ setName = setNames[i];
+ var setPlotter = this.attr_("plotter", setName);
+ if (setPlotter == plotter_attr) continue; // not specialized.
+
+ setPlotters[setName] = setPlotter;
+ }
+
+ for (i = 0; i < plotters.length; i++) {
+ var plotter = plotters[i];
+ var is_last = (i == plotters.length - 1);
+
+ for (var j = 0; j < sets.length; j++) {
+ setName = setNames[j];
+ if (opt_seriesName && setName != opt_seriesName) continue;
+
+ var points = sets[j];
+
+ // Only throw in the specialized plotters on the last iteration.
+ var p = plotter;
+ if (setName in setPlotters) {
+ if (is_last) {
+ p = setPlotters[setName];
+ } else {
+ // Don't use the standard plotters in this case.
+ continue;
+ }
+ }
+
+ var color = this.colors[setName];
+ var strokeWidth = this.dygraph_.getOption("strokeWidth", setName);
+
+ ctx.save();
+ ctx.strokeStyle = color;
+ ctx.lineWidth = strokeWidth;
+ p({
+ points: points,
+ setName: setName,
+ drawingContext: ctx,
+ color: color,
+ strokeWidth: strokeWidth,
+ dygraph: this.dygraph_,
+ axis: this.dygraph_.axisPropertiesForSeries(setName),
+ plotArea: this.area,
+ seriesIndex: j,
+ seriesCount: sets.length,
+ singleSeriesName: opt_seriesName,
+ allSeriesPoints: sets
+ });
+ ctx.restore();
+ }
+ }
+};
+
+/**
+ * Standard plotters. These may be used by clients via Dygraph.Plotters.
+ * See comments there for more details.
+ */
+DygraphCanvasRenderer._Plotters = {
+ linePlotter: function(e) {
+ DygraphCanvasRenderer._linePlotter(e);
+ },
+
+ fillPlotter: function(e) {
+ DygraphCanvasRenderer._fillPlotter(e);
+ },
+
+ errorPlotter: function(e) {
+ DygraphCanvasRenderer._errorPlotter(e);
+ }
+};
+
+/**
+ * Plotter which draws the central lines for a series.
+ * @private
+ */
+DygraphCanvasRenderer._linePlotter = function(e) {
+ var g = e.dygraph;
+ var setName = e.setName;
+ var strokeWidth = e.strokeWidth;
+
+ // TODO(danvk): Check if there's any performance impact of just calling
+ // getOption() inside of _drawStyledLine. Passing in so many parameters makes
+ // this code a bit nasty.
+ var borderWidth = g.getOption("strokeBorderWidth", setName);
+ var drawPointCallback = g.getOption("drawPointCallback", setName) ||
+ Dygraph.Circles.DEFAULT;
+ var strokePattern = g.getOption("strokePattern", setName);
+ var drawPoints = g.getOption("drawPoints", setName);
+ var pointSize = g.getOption("pointSize", setName);
+
+ if (borderWidth && strokeWidth) {
+ DygraphCanvasRenderer._drawStyledLine(e,
+ g.getOption("strokeBorderColor", setName),
+ strokeWidth + 2 * borderWidth,
+ strokePattern,
+ drawPoints,
+ drawPointCallback,
+ pointSize
+ );
+ }
+
+ DygraphCanvasRenderer._drawStyledLine(e,
+ e.color,
+ strokeWidth,
+ strokePattern,
+ drawPoints,
+ drawPointCallback,
+ pointSize
+ );
+};
+
+/**
+ * Draws the shaded error bars/confidence intervals for each series.
+ * This happens before the center lines are drawn, since the center lines
+ * need to be drawn on top of the error bars for all series.
+ * @private
+ */
+DygraphCanvasRenderer._errorPlotter = function(e) {
+ var g = e.dygraph;
+ var setName = e.setName;
+ var errorBars = g.getOption("errorBars") || g.getOption("customBars");
+ if (!errorBars) return;
+
+ var fillGraph = g.getOption("fillGraph", setName);
+ if (fillGraph) {
+ g.warn("Can't use fillGraph option with error bars");
+ }
+
+ var ctx = e.drawingContext;
+ var color = e.color;
+ var fillAlpha = g.getOption('fillAlpha', setName);
+ var stepPlot = g.getOption("stepPlot", setName);
+ var points = e.points;
+
+ var iter = Dygraph.createIterator(points, 0, points.length,
+ DygraphCanvasRenderer._getIteratorPredicate(
+ g.getOption("connectSeparatedPoints")));
+
+ var newYs;
+
+ // setup graphics context
+ var prevX = NaN;
+ var prevY = NaN;
+ var prevYs = [-1, -1];
+ // should be same color as the lines but only 15% opaque.
+ var rgb = new RGBColorParser(color);
+ var err_color =
+ 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + fillAlpha + ')';
+ ctx.fillStyle = err_color;
+ ctx.beginPath();
+
+ var isNullUndefinedOrNaN = function(x) {
+ return (x === null ||
+ x === undefined ||
+ isNaN(x));
+ };
+
+ while (iter.hasNext) {
+ var point = iter.next();
+ if ((!stepPlot && isNullUndefinedOrNaN(point.y)) ||
+ (stepPlot && !isNaN(prevY) && isNullUndefinedOrNaN(prevY))) {
+ prevX = NaN;
+ continue;
+ }
+
+ if (stepPlot) {
+ newYs = [ point.y_bottom, point.y_top ];
+ prevY = point.y;
+ } else {
+ newYs = [ point.y_bottom, point.y_top ];
+ }
+ newYs[0] = e.plotArea.h * newYs[0] + e.plotArea.y;
+ newYs[1] = e.plotArea.h * newYs[1] + e.plotArea.y;
+ if (!isNaN(prevX)) {
+ if (stepPlot) {
+ ctx.moveTo(prevX, prevYs[0]);
+ ctx.lineTo(point.canvasx, prevYs[0]);
+ ctx.lineTo(point.canvasx, prevYs[1]);
+ } else {
+ ctx.moveTo(prevX, prevYs[0]);
+ ctx.lineTo(point.canvasx, newYs[0]);
+ ctx.lineTo(point.canvasx, newYs[1]);
+ }
+ ctx.lineTo(prevX, prevYs[1]);
+ ctx.closePath();
+ }
+ prevYs = newYs;
+ prevX = point.canvasx;
+ }
+ ctx.fill();
+};
+
+/**
+ * Draws the shaded regions when "fillGraph" is set. Not to be confused with
+ * error bars.
+ *
+ * For stacked charts, it's more convenient to handle all the series
+ * simultaneously. So this plotter plots all the points on the first series
+ * it's asked to draw, then ignores all the other series.
+ *
+ * @private
+ */
+DygraphCanvasRenderer._fillPlotter = function(e) {
+ // Skip if we're drawing a single series for interactive highlight overlay.
+ if (e.singleSeriesName) return;
+
+ // We'll handle all the series at once, not one-by-one.
+ if (e.seriesIndex !== 0) return;
+
+ var g = e.dygraph;
+ var setNames = g.getLabels().slice(1); // remove x-axis
+
+ // getLabels() includes names for invisible series, which are not included in
+ // allSeriesPoints. We remove those to make the two match.
+ // TODO(danvk): provide a simpler way to get this information.
+ for (var i = setNames.length; i >= 0; i--) {
+ if (!g.visibility()[i]) setNames.splice(i, 1);
+ }
+
+ var anySeriesFilled = (function() {
+ for (var i = 0; i < setNames.length; i++) {
+ if (g.getOption("fillGraph", setNames[i])) return true;
+ }
+ return false;
+ })();
+
+ if (!anySeriesFilled) return;
+
+ var ctx = e.drawingContext;
+ var area = e.plotArea;
+ var sets = e.allSeriesPoints;
+ var setCount = sets.length;
+
+ var fillAlpha = g.getOption('fillAlpha');
+ var stackedGraph = g.getOption("stackedGraph");
+ var colors = g.getColors();
+
+ // For stacked graphs, track the baseline for filling.
+ //
+ // The filled areas below graph lines are trapezoids with two
+ // vertical edges. The top edge is the line segment being drawn, and
+ // the baseline is the bottom edge. Each baseline corresponds to the
+ // top line segment from the previous stacked line. In the case of
+ // step plots, the trapezoids are rectangles.
+ var baseline = {};
+ var currBaseline;
+ var prevStepPlot; // for different line drawing modes (line/step) per series
+
+ // process sets in reverse order (needed for stacked graphs)
+ for (var setIdx = setCount - 1; setIdx >= 0; setIdx--) {
+ var setName = setNames[setIdx];
+ if (!g.getOption('fillGraph', setName)) continue;
+
+ var stepPlot = g.getOption('stepPlot', setName);
+ var color = colors[setIdx];
+ var axis = g.axisPropertiesForSeries(setName);
+ var axisY = 1.0 + axis.minyval * axis.yscale;
+ if (axisY < 0.0) axisY = 0.0;
+ else if (axisY > 1.0) axisY = 1.0;
+ axisY = area.h * axisY + area.y;
+
+ var points = sets[setIdx];
+ var iter = Dygraph.createIterator(points, 0, points.length,
+ DygraphCanvasRenderer._getIteratorPredicate(
+ g.getOption("connectSeparatedPoints")));
+
+ // setup graphics context
+ var prevX = NaN;
+ var prevYs = [-1, -1];
+ var newYs;
+ // should be same color as the lines but only 15% opaque.
+ var rgb = new RGBColorParser(color);
+ var err_color =
+ 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + fillAlpha + ')';
+ ctx.fillStyle = err_color;
+ ctx.beginPath();
+ var last_x, is_first = true;
+ while (iter.hasNext) {
+ var point = iter.next();
+ if (!Dygraph.isOK(point.y)) {
+ prevX = NaN;
+ if (point.y_stacked !== null && !isNaN(point.y_stacked)) {
+ baseline[point.canvasx] = area.h * point.y_stacked + area.y;
+ }
+ continue;
+ }
+ if (stackedGraph) {
+ if (!is_first && last_x == point.xval) {
+ continue;
+ } else {
+ is_first = false;
+ last_x = point.xval;
+ }
+
+ currBaseline = baseline[point.canvasx];
+ var lastY;
+ if (currBaseline === undefined) {
+ lastY = axisY;
+ } else {
+ if(prevStepPlot) {
+ lastY = currBaseline[0];
+ } else {
+ lastY = currBaseline;
+ }
+ }
+ newYs = [ point.canvasy, lastY ];
+
+ if(stepPlot) {
+ // Step plots must keep track of the top and bottom of
+ // the baseline at each point.
+ if(prevYs[0] === -1) {
+ baseline[point.canvasx] = [ point.canvasy, axisY ];
+ } else {
+ baseline[point.canvasx] = [ point.canvasy, prevYs[0] ];
+ }
+ } else {
+ baseline[point.canvasx] = point.canvasy;
+ }
+
+ } else {
+ newYs = [ point.canvasy, axisY ];
+ }
+ if (!isNaN(prevX)) {
+ ctx.moveTo(prevX, prevYs[0]);
+
+ // Move to top fill point
+ if (stepPlot) {
+ ctx.lineTo(point.canvasx, prevYs[0]);
+ } else {
+ ctx.lineTo(point.canvasx, newYs[0]);
+ }
+ // Move to bottom fill point
+ if (prevStepPlot && currBaseline) {
+ // Draw to the bottom of the baseline
+ ctx.lineTo(point.canvasx, currBaseline[1]);
+ } else {
+ ctx.lineTo(point.canvasx, newYs[1]);
+ }
+
+ ctx.lineTo(prevX, prevYs[1]);
+ ctx.closePath();
+ }
+ prevYs = newYs;
+ prevX = point.canvasx;
+ }
+ prevStepPlot = stepPlot;
+ ctx.fill();
+ }
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-combined.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-combined.js
new file mode 100644
index 00000000..4f864538
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-combined.js
@@ -0,0 +1,2 @@
+/*! @license Copyright 2011 Dan Vanderkam (danvdk@gmail.com) MIT-licensed (http://opensource.org/licenses/MIT) */
+Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(a,c,b){if(typeof(b)=="undefined"){b=10}for(;parseInt(a,10)<b&&b>1;b/=10){a=c.toString()+a}return a.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};Date.ext.locales["en-US"]=Date.ext.locales.en;Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(a){return Date.ext.locales[a.locale].a[a.getDay()]},A:function(a){return Date.ext.locales[a.locale].A[a.getDay()]},b:function(a){return Date.ext.locales[a.locale].b[a.getMonth()]},B:function(a){return Date.ext.locales[a.locale].B[a.getMonth()]},c:"toLocaleString",C:function(a){return Date.ext.util.xPad(parseInt(a.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(a){return Date.ext.util.xPad(parseInt(Date.ext.util.G(a)/100,10),0)},G:function(c){var e=c.getFullYear();var b=parseInt(Date.ext.formats.V(c),10);var a=parseInt(Date.ext.formats.W(c),10);if(a>b){e++}else{if(a===0&&b>=52){e--}}return e},H:["getHours","0"],I:function(b){var a=b.getHours()%12;return Date.ext.util.xPad(a===0?12:a,0)},j:function(c){var a=c-new Date(""+c.getFullYear()+"/1/1 GMT");a+=c.getTimezoneOffset()*60000;var b=parseInt(a/60000/60/24,10)+1;return Date.ext.util.xPad(b,0,100)},m:function(a){return Date.ext.util.xPad(a.getMonth()+1,0)},M:["getMinutes","0"],p:function(a){return Date.ext.locales[a.locale].p[a.getHours()>=12?1:0]},P:function(a){return Date.ext.locales[a.locale].P[a.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(a){var b=a.getDay();return b===0?7:b},U:function(e){var a=parseInt(Date.ext.formats.j(e),10);var c=6-e.getDay();var b=parseInt((a+c)/7,10);return Date.ext.util.xPad(b,0)},V:function(e){var c=parseInt(Date.ext.formats.W(e),10);var a=(new Date(""+e.getFullYear()+"/1/1")).getDay();var b=c+(a>4||a<=1?0:1);if(b==53&&(new Date(""+e.getFullYear()+"/12/31")).getDay()<4){b=1}else{if(b===0){b=Date.ext.formats.V(new Date(""+(e.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(b,0)},w:"getDay",W:function(e){var a=parseInt(Date.ext.formats.j(e),10);var c=7-Date.ext.formats.u(e);var b=parseInt((a+c)/7,10);return Date.ext.util.xPad(b,0,10)},y:function(a){return Date.ext.util.xPad(a.getFullYear()%100,0)},Y:"getFullYear",z:function(c){var b=c.getTimezoneOffset();var a=Date.ext.util.xPad(parseInt(Math.abs(b/60),10),0);var e=Date.ext.util.xPad(b%60,0);return(b>0?"-":"+")+a+e},Z:function(a){return a.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(a){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(a){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var c=this;while(a.match(/%[cDhnrRtTxXzZ]/)){a=a.replace(/%([cDhnrRtTxXzZ])/g,function(e,d){var g=Date.ext.aggregates[d];return(g=="locale"?Date.ext.locales[c.locale][d]:g)})}var b=a.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(e,d){var g=Date.ext.formats[d];if(typeof(g)=="string"){return c[g]()}else{if(typeof(g)=="function"){return g.call(c,c)}else{if(typeof(g)=="object"&&typeof(g[0])=="string"){return Date.ext.util.xPad(c[g[0]](),g[1])}else{return d}}}});c=null;return b};"use strict";function RGBColorParser(f){this.ok=false;if(f.charAt(0)=="#"){f=f.substr(1,6)}f=f.replace(/ /g,"");f=f.toLowerCase();var b={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};for(var g in b){if(f==g){f=b[g]}}var e=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(i){return[parseInt(i[1]),parseInt(i[2]),parseInt(i[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(i){return[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(i){return[parseInt(i[1]+i[1],16),parseInt(i[2]+i[2],16),parseInt(i[3]+i[3],16)]}}];for(var c=0;c<e.length;c++){var j=e[c].re;var a=e[c].process;var h=j.exec(f);if(h){var d=a(h);this.r=d[0];this.g=d[1];this.b=d[2];this.ok=true}}this.r=(this.r<0||isNaN(this.r))?0:((this.r>255)?255:this.r);this.g=(this.g<0||isNaN(this.g))?0:((this.g>255)?255:this.g);this.b=(this.b<0||isNaN(this.b))?0:((this.b>255)?255:this.b);this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"};this.toHex=function(){var l=this.r.toString(16);var k=this.g.toString(16);var i=this.b.toString(16);if(l.length==1){l="0"+l}if(k.length==1){k="0"+k}if(i.length==1){i="0"+i}return"#"+l+k+i}}function printStackTrace(b){b=b||{guess:true};var c=b.e||null,e=!!b.guess;var d=new printStackTrace.implementation(),a=d.run(c);return(e)?d.guessAnonymousFunctions(a):a}printStackTrace.implementation=function(){};printStackTrace.implementation.prototype={run:function(a,b){a=a||this.createException();b=b||this.mode(a);if(b==="other"){return this.other(arguments.callee)}else{return this[b](a)}},createException:function(){try{this.undef()}catch(a){return a}},mode:function(a){if(a["arguments"]&&a.stack){return"chrome"}else{if(typeof a.message==="string"&&typeof window!=="undefined"&&window.opera){if(!a.stacktrace){return"opera9"}if(a.message.indexOf("\n")>-1&&a.message.split("\n").length>a.stacktrace.split("\n").length){return"opera9"}if(!a.stack){return"opera10a"}if(a.stacktrace.indexOf("called from line")<0){return"opera10b"}return"opera11"}else{if(a.stack){return"firefox"}}}return"other"},instrumentFunction:function(b,d,e){b=b||window;var a=b[d];b[d]=function c(){e.call(this,printStackTrace().slice(4));return b[d]._instrumented.apply(this,arguments)};b[d]._instrumented=a},deinstrumentFunction:function(a,b){if(a[b].constructor===Function&&a[b]._instrumented&&a[b]._instrumented.constructor===Function){a[b]=a[b]._instrumented}},chrome:function(b){var a=(b.stack+"\n").replace(/^\S[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^([^\(]+?)([\n$])/gm,"{anonymous}()@$1$2").replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm,"{anonymous}()@$1").split("\n");a.pop();return a},firefox:function(a){return a.stack.replace(/(?:\n@:0)?\s+$/m,"").replace(/^\(/gm,"{anonymous}(").split("\n")},opera11:function(g){var a="{anonymous}",h=/^.*line (\d+), column (\d+)(?: in (.+))? in (\S+):$/;var k=g.stacktrace.split("\n"),l=[];for(var c=0,f=k.length;c<f;c+=2){var d=h.exec(k[c]);if(d){var j=d[4]+":"+d[1]+":"+d[2];var b=d[3]||"global code";b=b.replace(/<anonymous function: (\S+)>/,"$1").replace(/<anonymous function>/,a);l.push(b+"@"+j+" -- "+k[c+1].replace(/^\s+/,""))}}return l},opera10b:function(g){var a="{anonymous}",h=/^(.*)@(.+):(\d+)$/;var j=g.stacktrace.split("\n"),k=[];for(var c=0,f=j.length;c<f;c++){var d=h.exec(j[c]);if(d){var b=d[1]?(d[1]+"()"):"global code";k.push(b+"@"+d[2]+":"+d[3])}}return k},opera10a:function(g){var a="{anonymous}",h=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;var j=g.stacktrace.split("\n"),k=[];for(var c=0,f=j.length;c<f;c+=2){var d=h.exec(j[c]);if(d){var b=d[3]||a;k.push(b+"()@"+d[2]+":"+d[1]+" -- "+j[c+1].replace(/^\s+/,""))}}return k},opera9:function(j){var d="{anonymous}",h=/Line (\d+).*script (?:in )?(\S+)/i;var c=j.message.split("\n"),b=[];for(var g=2,a=c.length;g<a;g+=2){var f=h.exec(c[g]);if(f){b.push(d+"()@"+f[2]+":"+f[1]+" -- "+c[g+1].replace(/^\s+/,""))}}return b},other:function(g){var b="{anonymous}",f=/function\s*([\w\-$]+)?\s*\(/i,a=[],d,c,e=10;while(g&&a.length<e){d=f.test(g.toString())?RegExp.$1||b:b;c=Array.prototype.slice.call(g["arguments"]||[]);a[a.length]=d+"("+this.stringifyArguments(c)+")";g=g.caller}return a},stringifyArguments:function(c){var b=[];var e=Array.prototype.slice;for(var d=0;d<c.length;++d){var a=c[d];if(a===undefined){b[d]="undefined"}else{if(a===null){b[d]="null"}else{if(a.constructor){if(a.constructor===Array){if(a.length<3){b[d]="["+this.stringifyArguments(a)+"]"}else{b[d]="["+this.stringifyArguments(e.call(a,0,1))+"..."+this.stringifyArguments(e.call(a,-1))+"]"}}else{if(a.constructor===Object){b[d]="#object"}else{if(a.constructor===Function){b[d]="#function"}else{if(a.constructor===String){b[d]='"'+a+'"'}else{if(a.constructor===Number){b[d]=a}}}}}}}}}return b.join(",")},sourceCache:{},ajax:function(a){var b=this.createXMLHTTPObject();if(b){try{b.open("GET",a,false);b.send(null);return b.responseText}catch(c){}}return""},createXMLHTTPObject:function(){var c,a=[function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];for(var b=0;b<a.length;b++){try{c=a[b]();this.createXMLHTTPObject=a[b];return c}catch(d){}}},isSameDomain:function(a){return a.indexOf(location.hostname)!==-1},getSource:function(a){if(!(a in this.sourceCache)){this.sourceCache[a]=this.ajax(a).split("\n")}return this.sourceCache[a]},guessAnonymousFunctions:function(k){for(var g=0;g<k.length;++g){var f=/\{anonymous\}\(.*\)@(.*)/,l=/^(.*?)(?::(\d+))(?::(\d+))?(?: -- .+)?$/,b=k[g],c=f.exec(b);if(c){var e=l.exec(c[1]),d=e[1],a=e[2],j=e[3]||0;if(d&&this.isSameDomain(d)&&a){var h=this.guessAnonymousFunction(d,a,j);k[g]=b.replace("{anonymous}",h)}}}return k},guessAnonymousFunction:function(c,f,a){var b;try{b=this.findFunctionName(this.getSource(c),f)}catch(d){b="getSource failed with url: "+c+", exception: "+d.toString()}return b},findFunctionName:function(a,e){var g=/function\s+([^(]*?)\s*\(([^)]*)\)/;var k=/['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*function\b/;var h=/['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*(?:eval|new Function)\b/;var b="",l,j=Math.min(e,20),d,c;for(var f=0;f<j;++f){l=a[e-f-1];c=l.indexOf("//");if(c>=0){l=l.substr(0,c)}if(l){b=l+b;d=k.exec(b);if(d&&d[1]){return d[1]}d=g.exec(b);if(d&&d[1]){return d[1]}d=h.exec(b);if(d&&d[1]){return d[1]}}}return"(?)"}};CanvasRenderingContext2D.prototype.installPattern=function(e){if(typeof(this.isPatternInstalled)!=="undefined"){throw"Must un-install old line pattern before installing a new one."}this.isPatternInstalled=true;var g=[0,0];var b=[];var f=this.beginPath;var d=this.lineTo;var c=this.moveTo;var a=this.stroke;this.uninstallPattern=function(){this.beginPath=f;this.lineTo=d;this.moveTo=c;this.stroke=a;this.uninstallPattern=undefined;this.isPatternInstalled=undefined};this.beginPath=function(){b=[];f.call(this)};this.moveTo=function(h,i){b.push([[h,i]]);c.call(this,h,i)};this.lineTo=function(h,j){var i=b[b.length-1];i.push([h,j])};this.stroke=function(){if(b.length===0){a.call(this);return}for(var p=0;p<b.length;p++){var o=b[p];var l=o[0][0],u=o[0][1];for(var n=1;n<o.length;n++){var h=o[n][0],s=o[n][1];this.save();var w=(h-l);var v=(s-u);var r=Math.sqrt(w*w+v*v);var k=Math.atan2(v,w);this.translate(l,u);c.call(this,0,0);this.rotate(k);var m=g[0];var t=0;while(r>t){var q=e[m];if(g[1]){t+=g[1]}else{t+=q}if(t>r){g=[m,t-r];t=r}else{g=[(m+1)%e.length,0]}if(m%2===0){d.call(this,t,0)}else{c.call(this,t,0)}m=(m+1)%e.length}this.restore();l=h,u=s}}a.call(this);b=[]}};CanvasRenderingContext2D.prototype.uninstallPattern=function(){throw"Must install a line pattern before uninstalling it."};var DygraphOptions=(function(){var a=function(b){this.dygraph_=b;this.yAxes_=[];this.xAxis_={};this.series_={};this.global_=this.dygraph_.attrs_;this.user_=this.dygraph_.user_attrs_||{};this.labels_=[];this.highlightSeries_=this.get("highlightSeriesOpts")||{};this.reparseSeries()};a.AXIS_STRING_MAPPINGS_={y:0,Y:0,y1:0,Y1:0,y2:1,Y2:1};a.axisToIndex_=function(b){if(typeof(b)=="string"){if(a.AXIS_STRING_MAPPINGS_.hasOwnProperty(b)){return a.AXIS_STRING_MAPPINGS_[b]}throw"Unknown axis : "+b}if(typeof(b)=="number"){if(b===0||b===1){return b}throw"Dygraphs only supports two y-axes, indexed from 0-1."}if(b){throw"Unknown axis : "+b}return 0};a.prototype.reparseSeries=function(){var g=this.get("labels");if(!g){return}this.labels_=g.slice(1);this.yAxes_=[{series:[],options:{}}];this.xAxis_={options:{}};this.series_={};var h=!this.user_.series;if(h){var c=0;for(var j=0;j<this.labels_.length;j++){var i=this.labels_[j];var e=this.user_[i]||{};var b=0;var d=e.axis;if(typeof(d)=="object"){b=++c;this.yAxes_[b]={series:[i],options:d}}if(!d){this.yAxes_[0].series.push(i)}this.series_[i]={idx:j,yAxis:b,options:e}}for(var j=0;j<this.labels_.length;j++){var i=this.labels_[j];var e=this.series_[i]["options"];var d=e.axis;if(typeof(d)=="string"){if(!this.series_.hasOwnProperty(d)){Dygraph.error("Series "+i+" wants to share a y-axis with series "+d+", which does not define its own axis.");return}var b=this.series_[d].yAxis;this.series_[i].yAxis=b;this.yAxes_[b].series.push(i)}}}else{for(var j=0;j<this.labels_.length;j++){var i=this.labels_[j];var e=this.user_.series[i]||{};var b=a.axisToIndex_(e.axis);this.series_[i]={idx:j,yAxis:b,options:e};if(!this.yAxes_[b]){this.yAxes_[b]={series:[i],options:{}}}else{this.yAxes_[b].series.push(i)}}}var f=this.user_.axes||{};Dygraph.update(this.yAxes_[0].options,f.y||{});if(this.yAxes_.length>1){Dygraph.update(this.yAxes_[1].options,f.y2||{})}Dygraph.update(this.xAxis_.options,f.x||{})};a.prototype.get=function(c){var b=this.getGlobalUser_(c);if(b!==null){return b}return this.getGlobalDefault_(c)};a.prototype.getGlobalUser_=function(b){if(this.user_.hasOwnProperty(b)){return this.user_[b]}return null};a.prototype.getGlobalDefault_=function(b){if(this.global_.hasOwnProperty(b)){return this.global_[b]}if(Dygraph.DEFAULT_ATTRS.hasOwnProperty(b)){return Dygraph.DEFAULT_ATTRS[b]}return null};a.prototype.getForAxis=function(d,e){var f;var i;if(typeof(e)=="number"){f=e;i=f===0?"y":"y2"}else{if(e=="y1"){e="y"}if(e=="y"){f=0}else{if(e=="y2"){f=1}else{if(e=="x"){f=-1}else{throw"Unknown axis "+e}}}i=e}var g=(f==-1)?this.xAxis_:this.yAxes_[f];if(g){var h=g.options;if(h.hasOwnProperty(d)){return h[d]}}var c=this.getGlobalUser_(d);if(c!==null){return c}var b=Dygraph.DEFAULT_ATTRS.axes[i];if(b.hasOwnProperty(d)){return b[d]}return this.getGlobalDefault_(d)};a.prototype.getForSeries=function(c,e){if(e===this.dygraph_.getHighlightSeries()){if(this.highlightSeries_.hasOwnProperty(c)){return this.highlightSeries_[c]}}if(!this.series_.hasOwnProperty(e)){throw"Unknown series: "+e}var d=this.series_[e];var b=d.options;if(b.hasOwnProperty(c)){return b[c]}return this.getForAxis(c,d.yAxis)};a.prototype.numAxes=function(){return this.yAxes_.length};a.prototype.axisForSeries=function(b){return this.series_[b].yAxis};a.prototype.axisOptions=function(b){return this.yAxes_[b].options};a.prototype.seriesForAxis=function(b){return this.yAxes_[b].series};a.prototype.seriesNames=function(){return this.labels_};return a})();"use strict";var DygraphLayout=function(a){this.dygraph_=a;this.points=[];this.setNames=[];this.annotations=[];this.yAxes_=null;this.xTicks_=null;this.yTicks_=null};DygraphLayout.prototype.attr_=function(a){return this.dygraph_.attr_(a)};DygraphLayout.prototype.addDataset=function(a,b){this.points.push(b);this.setNames.push(a)};DygraphLayout.prototype.getPlotArea=function(){return this.area_};DygraphLayout.prototype.computePlotArea=function(){var a={x:0,y:0};a.w=this.dygraph_.width_-a.x-this.attr_("rightGap");a.h=this.dygraph_.height_;var b={chart_div:this.dygraph_.graphDiv,reserveSpaceLeft:function(c){var d={x:a.x,y:a.y,w:c,h:a.h};a.x+=c;a.w-=c;return d},reserveSpaceRight:function(c){var d={x:a.x+a.w-c,y:a.y,w:c,h:a.h};a.w-=c;return d},reserveSpaceTop:function(c){var d={x:a.x,y:a.y,w:a.w,h:c};a.y+=c;a.h-=c;return d},reserveSpaceBottom:function(c){var d={x:a.x,y:a.y+a.h-c,w:a.w,h:c};a.h-=c;return d},chartRect:function(){return{x:a.x,y:a.y,w:a.w,h:a.h}}};this.dygraph_.cascadeEvents_("layout",b);this.area_=a};DygraphLayout.prototype.setAnnotations=function(d){this.annotations=[];var e=this.attr_("xValueParser")||function(a){return a};for(var c=0;c<d.length;c++){var b={};if(!d[c].xval&&d[c].x===undefined){this.dygraph_.error("Annotations must have an 'x' property");return}if(d[c].icon&&!(d[c].hasOwnProperty("width")&&d[c].hasOwnProperty("height"))){this.dygraph_.error("Must set width and height when setting annotation.icon property");return}Dygraph.update(b,d[c]);if(!b.xval){b.xval=e(b.x)}this.annotations.push(b)}};DygraphLayout.prototype.setXTicks=function(a){this.xTicks_=a};DygraphLayout.prototype.setYAxes=function(a){this.yAxes_=a};DygraphLayout.prototype.evaluate=function(){this._evaluateLimits();this._evaluateLineCharts();this._evaluateLineTicks();this._evaluateAnnotations()};DygraphLayout.prototype._evaluateLimits=function(){var a=this.dygraph_.xAxisRange();this.minxval=a[0];this.maxxval=a[1];var d=a[1]-a[0];this.xscale=(d!==0?1/d:1);for(var b=0;b<this.yAxes_.length;b++){var c=this.yAxes_[b];c.minyval=c.computedValueRange[0];c.maxyval=c.computedValueRange[1];c.yrange=c.maxyval-c.minyval;c.yscale=(c.yrange!==0?1/c.yrange:1);if(c.g.attr_("logscale")){c.ylogrange=Dygraph.log10(c.maxyval)-Dygraph.log10(c.minyval);c.ylogscale=(c.ylogrange!==0?1/c.ylogrange:1);if(!isFinite(c.ylogrange)||isNaN(c.ylogrange)){c.g.error("axis "+b+" of graph at "+c.g+" can't be displayed in log scale for range ["+c.minyval+" - "+c.maxyval+"]")}}}};DygraphLayout._calcYNormal=function(b,c,a){if(a){return 1-((Dygraph.log10(c)-Dygraph.log10(b.minyval))*b.ylogscale)}else{return 1-((c-b.minyval)*b.yscale)}};DygraphLayout.prototype._evaluateLineCharts=function(){var c=this.attr_("connectSeparatedPoints");var k=this.attr_("stackedGraph");var e=this.attr_("errorBars")||this.attr_("customBars");for(var a=0;a<this.points.length;a++){var l=this.points[a];var f=this.setNames[a];var b=this.dygraph_.axisPropertiesForSeries(f);var g=this.dygraph_.attributes_.getForSeries("logscale",f);for(var d=0;d<l.length;d++){var i=l[d];i.x=(i.xval-this.minxval)*this.xscale;var h=i.yval;if(k){i.y_stacked=DygraphLayout._calcYNormal(b,i.yval_stacked,g);if(h!==null&&!isNaN(h)){h=i.yval_stacked}}if(h===null){h=NaN;if(!c){i.yval=NaN}}i.y=DygraphLayout._calcYNormal(b,h,g);if(e){i.y_top=DygraphLayout._calcYNormal(b,h-i.yval_minus,g);i.y_bottom=DygraphLayout._calcYNormal(b,h+i.yval_plus,g)}}}};DygraphLayout.parseFloat_=function(a){if(a===null){return NaN}return a};DygraphLayout.prototype._evaluateLineTicks=function(){var d,c,b,f;this.xticks=[];for(d=0;d<this.xTicks_.length;d++){c=this.xTicks_[d];b=c.label;f=this.xscale*(c.v-this.minxval);if((f>=0)&&(f<=1)){this.xticks.push([f,b])}}this.yticks=[];for(d=0;d<this.yAxes_.length;d++){var e=this.yAxes_[d];for(var a=0;a<e.ticks.length;a++){c=e.ticks[a];b=c.label;f=this.dygraph_.toPercentYCoord(c.v,d);if((f>=0)&&(f<=1)){this.yticks.push([d,f,b])}}}};DygraphLayout.prototype._evaluateAnnotations=function(){var d;var g={};for(d=0;d<this.annotations.length;d++){var b=this.annotations[d];g[b.xval+","+b.series]=b}this.annotated_points=[];if(!this.annotations||!this.annotations.length){return}for(var h=0;h<this.points.length;h++){var e=this.points[h];for(d=0;d<e.length;d++){var f=e[d];var c=f.xval+","+f.name;if(c in g){f.annotation=g[c];this.annotated_points.push(f)}}}};DygraphLayout.prototype.removeAllDatasets=function(){delete this.points;delete this.setNames;delete this.setPointsLengths;delete this.setPointsOffsets;this.points=[];this.setNames=[];this.setPointsLengths=[];this.setPointsOffsets=[]};"use strict";var DygraphCanvasRenderer=function(d,c,b,e){this.dygraph_=d;this.layout=e;this.element=c;this.elementContext=b;this.container=this.element.parentNode;this.height=this.element.height;this.width=this.element.width;if(!this.isIE&&!(DygraphCanvasRenderer.isSupported(this.element))){throw"Canvas is not supported."}this.area=e.getPlotArea();this.container.style.position="relative";this.container.style.width=this.width+"px";if(this.dygraph_.isUsingExcanvas_){this._createIEClipArea()}else{if(!Dygraph.isAndroid()){var a=this.dygraph_.canvas_ctx_;a.beginPath();a.rect(this.area.x,this.area.y,this.area.w,this.area.h);a.clip();a=this.dygraph_.hidden_ctx_;a.beginPath();a.rect(this.area.x,this.area.y,this.area.w,this.area.h);a.clip()}}};DygraphCanvasRenderer.prototype.attr_=function(a,b){return this.dygraph_.attr_(a,b)};DygraphCanvasRenderer.prototype.clear=function(){var a;if(this.isIE){try{if(this.clearDelay){this.clearDelay.cancel();this.clearDelay=null}a=this.elementContext}catch(b){return}}a=this.elementContext;a.clearRect(0,0,this.width,this.height)};DygraphCanvasRenderer.isSupported=function(f){var b=null;try{if(typeof(f)=="undefined"||f===null){b=document.createElement("canvas")}else{b=f}b.getContext("2d")}catch(c){var d=navigator.appVersion.match(/MSIE (\d\.\d)/);var a=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);if((!d)||(d[1]<6)||(a)){return false}return true}return true};DygraphCanvasRenderer.prototype.render=function(){this._updatePoints();this._renderLineChart()};DygraphCanvasRenderer.prototype._createIEClipArea=function(){var g="dygraph-clip-div";var f=this.dygraph_.graphDiv;for(var e=f.childNodes.length-1;e>=0;e--){if(f.childNodes[e].className==g){f.removeChild(f.childNodes[e])}}var c=document.bgColor;var d=this.dygraph_.graphDiv;while(d!=document){var a=d.currentStyle.backgroundColor;if(a&&a!="transparent"){c=a;break}d=d.parentNode}function b(j){if(j.w===0||j.h===0){return}var i=document.createElement("div");i.className=g;i.style.backgroundColor=c;i.style.position="absolute";i.style.left=j.x+"px";i.style.top=j.y+"px";i.style.width=j.w+"px";i.style.height=j.h+"px";f.appendChild(i)}var h=this.area;b({x:0,y:0,w:h.x,h:this.height});b({x:h.x,y:0,w:this.width-h.x,h:h.y});b({x:h.x+h.w,y:0,w:this.width-h.x-h.w,h:this.height});b({x:h.x,y:h.y+h.h,w:this.width-h.x,h:this.height-h.h-h.y})};DygraphCanvasRenderer._getIteratorPredicate=function(a){return a?DygraphCanvasRenderer._predicateThatSkipsEmptyPoints:null};DygraphCanvasRenderer._predicateThatSkipsEmptyPoints=function(b,a){return b[a].yval!==null};DygraphCanvasRenderer._drawStyledLine=function(i,a,m,q,f,n,d){var h=i.dygraph;var c=h.getOption("stepPlot",i.setName);if(!Dygraph.isArrayLike(q)){q=null}var l=h.getOption("drawGapEdgePoints",i.setName);var o=i.points;var k=Dygraph.createIterator(o,0,o.length,DygraphCanvasRenderer._getIteratorPredicate(h.getOption("connectSeparatedPoints")));var j=q&&(q.length>=2);var p=i.drawingContext;p.save();if(j){p.installPattern(q)}var b=DygraphCanvasRenderer._drawSeries(i,k,m,d,f,l,c,a);DygraphCanvasRenderer._drawPointsOnLine(i,b,n,a,d);if(j){p.uninstallPattern()}p.restore()};DygraphCanvasRenderer._drawSeries=function(v,t,m,h,p,s,g,q){var b=null;var w=null;var k=null;var j;var o;var l=[];var f=true;var n=v.drawingContext;n.beginPath();n.strokeStyle=q;n.lineWidth=m;var c=t.array_;var u=t.end_;var a=t.predicate_;for(var r=t.start_;r<u;r++){o=c[r];if(a){while(r<u&&!a(c,r)){r++}if(r==u){break}o=c[r]}if(o.canvasy===null||o.canvasy!=o.canvasy){if(g&&b!==null){n.moveTo(b,w);n.lineTo(o.canvasx,w)}b=w=null}else{j=false;if(s||!b){t.nextIdx_=r;t.next();k=t.hasNext?t.peek.canvasy:null;var d=k===null||k!=k;j=(!b&&d);if(s){if((!f&&!b)||(t.hasNext&&d)){j=true}}}if(b!==null){if(m){if(g){n.moveTo(b,w);n.lineTo(o.canvasx,w)}n.lineTo(o.canvasx,o.canvasy)}}else{n.moveTo(o.canvasx,o.canvasy)}if(p||j){l.push([o.canvasx,o.canvasy,o.idx])}b=o.canvasx;w=o.canvasy}f=false}n.stroke();return l};DygraphCanvasRenderer._drawPointsOnLine=function(h,i,f,d,g){var c=h.drawingContext;for(var b=0;b<i.length;b++){var a=i[b];c.save();f(h.dygraph,h.setName,c,a[0],a[1],d,g,a[2]);c.restore()}};DygraphCanvasRenderer.prototype._updatePoints=function(){var e=this.layout.points;for(var c=e.length;c--;){var d=e[c];for(var b=d.length;b--;){var a=d[b];a.canvasx=this.area.w*a.x+this.area.x;a.canvasy=this.area.h*a.y+this.area.y}}};DygraphCanvasRenderer.prototype._renderLineChart=function(g,u){var h=u||this.elementContext;var n;var a=this.layout.points;var s=this.layout.setNames;var b;this.colors=this.dygraph_.colorsMap_;var o=this.attr_("plotter");var f=o;if(!Dygraph.isArrayLike(f)){f=[f]}var c={};for(n=0;n<s.length;n++){b=s[n];var t=this.attr_("plotter",b);if(t==o){continue}c[b]=t}for(n=0;n<f.length;n++){var r=f[n];var q=(n==f.length-1);for(var l=0;l<a.length;l++){b=s[l];if(g&&b!=g){continue}var m=a[l];var e=r;if(b in c){if(q){e=c[b]}else{continue}}var k=this.colors[b];var d=this.dygraph_.getOption("strokeWidth",b);h.save();h.strokeStyle=k;h.lineWidth=d;e({points:m,setName:b,drawingContext:h,color:k,strokeWidth:d,dygraph:this.dygraph_,axis:this.dygraph_.axisPropertiesForSeries(b),plotArea:this.area,seriesIndex:l,seriesCount:a.length,singleSeriesName:g,allSeriesPoints:a});h.restore()}}};DygraphCanvasRenderer._Plotters={linePlotter:function(a){DygraphCanvasRenderer._linePlotter(a)},fillPlotter:function(a){DygraphCanvasRenderer._fillPlotter(a)},errorPlotter:function(a){DygraphCanvasRenderer._errorPlotter(a)}};DygraphCanvasRenderer._linePlotter=function(f){var d=f.dygraph;var h=f.setName;var i=f.strokeWidth;var a=d.getOption("strokeBorderWidth",h);var j=d.getOption("drawPointCallback",h)||Dygraph.Circles.DEFAULT;var k=d.getOption("strokePattern",h);var c=d.getOption("drawPoints",h);var b=d.getOption("pointSize",h);if(a&&i){DygraphCanvasRenderer._drawStyledLine(f,d.getOption("strokeBorderColor",h),i+2*a,k,c,j,b)}DygraphCanvasRenderer._drawStyledLine(f,f.color,i,k,c,j,b)};DygraphCanvasRenderer._errorPlotter=function(s){var r=s.dygraph;var f=s.setName;var t=r.getOption("errorBars")||r.getOption("customBars");if(!t){return}var k=r.getOption("fillGraph",f);if(k){r.warn("Can't use fillGraph option with error bars")}var m=s.drawingContext;var n=s.color;var o=r.getOption("fillAlpha",f);var i=r.getOption("stepPlot",f);var p=s.points;var q=Dygraph.createIterator(p,0,p.length,DygraphCanvasRenderer._getIteratorPredicate(r.getOption("connectSeparatedPoints")));var j;var h=NaN;var c=NaN;var d=[-1,-1];var a=new RGBColorParser(n);var u="rgba("+a.r+","+a.g+","+a.b+","+o+")";m.fillStyle=u;m.beginPath();var b=function(e){return(e===null||e===undefined||isNaN(e))};while(q.hasNext){var l=q.next();if((!i&&b(l.y))||(i&&!isNaN(c)&&b(c))){h=NaN;continue}if(i){j=[l.y_bottom,l.y_top];c=l.y}else{j=[l.y_bottom,l.y_top]}j[0]=s.plotArea.h*j[0]+s.plotArea.y;j[1]=s.plotArea.h*j[1]+s.plotArea.y;if(!isNaN(h)){if(i){m.moveTo(h,d[0]);m.lineTo(l.canvasx,d[0]);m.lineTo(l.canvasx,d[1])}else{m.moveTo(h,d[0]);m.lineTo(l.canvasx,j[0]);m.lineTo(l.canvasx,j[1])}m.lineTo(h,d[1]);m.closePath()}d=j;h=l.canvasx}m.fill()};DygraphCanvasRenderer._fillPlotter=function(F){if(F.singleSeriesName){return}if(F.seriesIndex!==0){return}var D=F.dygraph;var I=D.getLabels().slice(1);for(var C=I.length;C>=0;C--){if(!D.visibility()[C]){I.splice(C,1)}}var h=(function(){for(var e=0;e<I.length;e++){if(D.getOption("fillGraph",I[e])){return true}}return false})();if(!h){return}var w=F.drawingContext;var E=F.plotArea;var c=F.allSeriesPoints;var z=c.length;var y=D.getOption("fillAlpha");var k=D.getOption("stackedGraph");var q=D.getColors();var s={};var a;var r;for(var u=z-1;u>=0;u--){var n=I[u];if(!D.getOption("fillGraph",n)){continue}var p=D.getOption("stepPlot",n);var x=q[u];var f=D.axisPropertiesForSeries(n);var d=1+f.minyval*f.yscale;if(d<0){d=0}else{if(d>1){d=1}}d=E.h*d+E.y;var B=c[u];var A=Dygraph.createIterator(B,0,B.length,DygraphCanvasRenderer._getIteratorPredicate(D.getOption("connectSeparatedPoints")));var m=NaN;var l=[-1,-1];var t;var b=new RGBColorParser(x);var H="rgba("+b.r+","+b.g+","+b.b+","+y+")";w.fillStyle=H;w.beginPath();var j,G=true;while(A.hasNext){var v=A.next();if(!Dygraph.isOK(v.y)){m=NaN;if(v.y_stacked!==null&&!isNaN(v.y_stacked)){s[v.canvasx]=E.h*v.y_stacked+E.y}continue}if(k){if(!G&&j==v.xval){continue}else{G=false;j=v.xval}a=s[v.canvasx];var o;if(a===undefined){o=d}else{if(r){o=a[0]}else{o=a}}t=[v.canvasy,o];if(p){if(l[0]===-1){s[v.canvasx]=[v.canvasy,d]}else{s[v.canvasx]=[v.canvasy,l[0]]}}else{s[v.canvasx]=v.canvasy}}else{t=[v.canvasy,d]}if(!isNaN(m)){w.moveTo(m,l[0]);if(p){w.lineTo(v.canvasx,l[0])}else{w.lineTo(v.canvasx,t[0])}if(r&&a){w.lineTo(v.canvasx,a[1])}else{w.lineTo(v.canvasx,t[1])}w.lineTo(m,l[1]);w.closePath()}l=t;m=v.canvasx}r=p;w.fill()}};"use strict";var Dygraph=function(d,c,b,a){this.is_initial_draw_=true;this.readyFns_=[];if(a!==undefined){this.warn("Using deprecated four-argument dygraph constructor");this.__old_init__(d,c,b,a)}else{this.__init__(d,c,b)}};Dygraph.NAME="Dygraph";Dygraph.VERSION="1.0.0";Dygraph.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};Dygraph.toString=function(){return this.__repr__()};Dygraph.DEFAULT_ROLL_PERIOD=1;Dygraph.DEFAULT_WIDTH=480;Dygraph.DEFAULT_HEIGHT=320;Dygraph.ANIMATION_STEPS=12;Dygraph.ANIMATION_DURATION=200;Dygraph.KMB_LABELS=["K","M","B","T","Q"];Dygraph.KMG2_BIG_LABELS=["k","M","G","T","P","E","Z","Y"];Dygraph.KMG2_SMALL_LABELS=["m","u","n","p","f","a","z","y"];Dygraph.numberValueFormatter=function(s,a,u,l){var e=a("sigFigs");if(e!==null){return Dygraph.floatFormat(s,e)}var c=a("digitsAfterDecimal");var o=a("maxNumberWidth");var b=a("labelsKMB");var r=a("labelsKMG2");var q;if(s!==0&&(Math.abs(s)>=Math.pow(10,o)||Math.abs(s)<Math.pow(10,-c))){q=s.toExponential(c)}else{q=""+Dygraph.round_(s,c)}if(b||r){var f;var t=[];var m=[];if(b){f=1000;t=Dygraph.KMB_LABELS}if(r){if(b){Dygraph.warn("Setting both labelsKMB and labelsKMG2. Pick one!")}f=1024;t=Dygraph.KMG2_BIG_LABELS;m=Dygraph.KMG2_SMALL_LABELS}var p=Math.abs(s);var d=Dygraph.pow(f,t.length);for(var h=t.length-1;h>=0;h--,d/=f){if(p>=d){q=Dygraph.round_(s/d,c)+t[h];break}}if(r){var i=String(s.toExponential()).split("e-");if(i.length===2&&i[1]>=3&&i[1]<=24){if(i[1]%3>0){q=Dygraph.round_(i[0]/Dygraph.pow(10,(i[1]%3)),c)}else{q=Number(i[0]).toFixed(2)}q+=m[Math.floor(i[1]/3)-1]}}}return q};Dygraph.numberAxisLabelFormatter=function(a,d,c,b){return Dygraph.numberValueFormatter(a,c,b)};Dygraph.dateString_=function(e){var i=Dygraph.zeropad;var h=new Date(e);var f=""+h.getFullYear();var g=i(h.getMonth()+1);var a=i(h.getDate());var c="";var b=h.getHours()*3600+h.getMinutes()*60+h.getSeconds();if(b){c=" "+Dygraph.hmsString_(e)}return f+"/"+g+"/"+a+c};Dygraph.dateAxisFormatter=function(b,c){if(c>=Dygraph.DECADAL){return b.strftime("%Y")}else{if(c>=Dygraph.MONTHLY){return b.strftime("%b %y")}else{var a=b.getHours()*3600+b.getMinutes()*60+b.getSeconds()+b.getMilliseconds();if(a===0||c>=Dygraph.DAILY){return new Date(b.getTime()+3600*1000).strftime("%d%b")}else{return Dygraph.hmsString_(b.getTime())}}}};Dygraph.Plotters=DygraphCanvasRenderer._Plotters;Dygraph.DEFAULT_ATTRS={highlightCircleSize:3,highlightSeriesOpts:null,highlightSeriesBackgroundAlpha:0.5,labelsDivWidth:250,labelsDivStyles:{},labelsSeparateLines:false,labelsShowZeroValues:true,labelsKMB:false,labelsKMG2:false,showLabelsOnHighlight:true,digitsAfterDecimal:2,maxNumberWidth:6,sigFigs:null,strokeWidth:1,strokeBorderWidth:0,strokeBorderColor:"white",axisTickSize:3,axisLabelFontSize:14,xAxisLabelWidth:50,yAxisLabelWidth:50,rightGap:5,showRoller:false,xValueParser:Dygraph.dateParser,delimiter:",",sigma:2,errorBars:false,fractions:false,wilsonInterval:true,customBars:false,fillGraph:false,fillAlpha:0.15,connectSeparatedPoints:false,stackedGraph:false,stackedGraphNaNFill:"all",hideOverlayOnMouseOut:true,legend:"onmouseover",stepPlot:false,avoidMinZero:false,xRangePad:0,yRangePad:null,drawAxesAtZero:false,titleHeight:28,xLabelHeight:18,yLabelWidth:18,drawXAxis:true,drawYAxis:true,axisLineColor:"black",axisLineWidth:0.3,gridLineWidth:0.3,axisLabelColor:"black",axisLabelFont:"Arial",axisLabelWidth:50,drawYGrid:true,drawXGrid:true,gridLineColor:"rgb(128,128,128)",interactionModel:null,animatedZooms:false,showRangeSelector:false,rangeSelectorHeight:40,rangeSelectorPlotStrokeColor:"#808FAB",rangeSelectorPlotFillColor:"#A7B1C4",plotter:[Dygraph.Plotters.fillPlotter,Dygraph.Plotters.errorPlotter,Dygraph.Plotters.linePlotter],plugins:[],axes:{x:{pixelsPerLabel:60,axisLabelFormatter:Dygraph.dateAxisFormatter,valueFormatter:Dygraph.dateString_,drawGrid:true,independentTicks:true,ticker:null},y:{pixelsPerLabel:30,valueFormatter:Dygraph.numberValueFormatter,axisLabelFormatter:Dygraph.numberAxisLabelFormatter,drawGrid:true,independentTicks:true,ticker:null},y2:{pixelsPerLabel:30,valueFormatter:Dygraph.numberValueFormatter,axisLabelFormatter:Dygraph.numberAxisLabelFormatter,drawGrid:false,independentTicks:false,ticker:null}}};Dygraph.HORIZONTAL=1;Dygraph.VERTICAL=2;Dygraph.PLUGINS=[];Dygraph.addedAnnotationCSS=false;Dygraph.prototype.__old_init__=function(f,d,e,b){if(e!==null){var a=["Date"];for(var c=0;c<e.length;c++){a.push(e[c])}Dygraph.update(b,{labels:a})}this.__init__(f,d,b)};Dygraph.prototype.__init__=function(a,c,l){if(/MSIE/.test(navigator.userAgent)&&!window.opera&&typeof(G_vmlCanvasManager)!="undefined"&&document.readyState!="complete"){var o=this;setTimeout(function(){o.__init__(a,c,l)},100);return}if(l===null||l===undefined){l={}}l=Dygraph.mapLegacyOptions_(l);if(typeof(a)=="string"){a=document.getElementById(a)}if(!a){Dygraph.error("Constructing dygraph with a non-existent div!");return}this.isUsingExcanvas_=typeof(G_vmlCanvasManager)!="undefined";this.maindiv_=a;this.file_=c;this.rollPeriod_=l.rollPeriod||Dygraph.DEFAULT_ROLL_PERIOD;this.previousVerticalX_=-1;this.fractions_=l.fractions||false;this.dateWindow_=l.dateWindow||null;this.annotations_=[];this.zoomed_x_=false;this.zoomed_y_=false;a.innerHTML="";if(a.style.width===""&&l.width){a.style.width=l.width+"px"}if(a.style.height===""&&l.height){a.style.height=l.height+"px"}if(a.style.height===""&&a.clientHeight===0){a.style.height=Dygraph.DEFAULT_HEIGHT+"px";if(a.style.width===""){a.style.width=Dygraph.DEFAULT_WIDTH+"px"}}this.width_=a.clientWidth||l.width||0;this.height_=a.clientHeight||l.height||0;if(l.stackedGraph){l.fillGraph=true}this.user_attrs_={};Dygraph.update(this.user_attrs_,l);this.attrs_={};Dygraph.updateDeep(this.attrs_,Dygraph.DEFAULT_ATTRS);this.boundaryIds_=[];this.setIndexByName_={};this.datasetIndex_=[];this.registeredEvents_=[];this.eventListeners_={};this.attributes_=new DygraphOptions(this);this.createInterface_();this.plugins_=[];var d=Dygraph.PLUGINS.concat(this.getOption("plugins"));for(var g=0;g<d.length;g++){var k=d[g];var f=new k();var j={plugin:f,events:{},options:{},pluginOptions:{}};var b=f.activate(this);for(var h in b){j.events[h]=b[h]}this.plugins_.push(j)}for(var g=0;g<this.plugins_.length;g++){var n=this.plugins_[g];for(var h in n.events){if(!n.events.hasOwnProperty(h)){continue}var m=n.events[h];var e=[n.plugin,m];if(!(h in this.eventListeners_)){this.eventListeners_[h]=[e]}else{this.eventListeners_[h].push(e)}}}this.createDragInterface_();this.start_()};Dygraph.prototype.cascadeEvents_=function(c,b){if(!(c in this.eventListeners_)){return true}var g={dygraph:this,cancelable:false,defaultPrevented:false,preventDefault:function(){if(!g.cancelable){throw"Cannot call preventDefault on non-cancelable event."}g.defaultPrevented=true},propagationStopped:false,stopPropagation:function(){g.propagationStopped=true}};Dygraph.update(g,b);var a=this.eventListeners_[c];if(a){for(var d=a.length-1;d>=0;d--){var f=a[d][0];var h=a[d][1];h.call(f,g);if(g.propagationStopped){break}}}return g.defaultPrevented};Dygraph.prototype.isZoomed=function(a){if(a===null||a===undefined){return this.zoomed_x_||this.zoomed_y_}if(a==="x"){return this.zoomed_x_}if(a==="y"){return this.zoomed_y_}throw"axis parameter is ["+a+"] must be null, 'x' or 'y'."};Dygraph.prototype.toString=function(){var a=this.maindiv_;var b=(a&&a.id)?a.id:a;return"[Dygraph "+b+"]"};Dygraph.prototype.attr_=function(b,a){return a?this.attributes_.getForSeries(b,a):this.attributes_.get(b)};Dygraph.prototype.getOption=function(a,b){return this.attr_(a,b)};Dygraph.prototype.getOptionForAxis=function(a,b){return this.attributes_.getForAxis(a,b)};Dygraph.prototype.optionsViewForAxis_=function(b){var a=this;return function(c){var d=a.user_attrs_.axes;if(d&&d[b]&&d[b].hasOwnProperty(c)){return d[b][c]}if(typeof(a.user_attrs_[c])!="undefined"){return a.user_attrs_[c]}d=a.attrs_.axes;if(d&&d[b]&&d[b].hasOwnProperty(c)){return d[b][c]}if(b=="y"&&a.axes_[0].hasOwnProperty(c)){return a.axes_[0][c]}else{if(b=="y2"&&a.axes_[1].hasOwnProperty(c)){return a.axes_[1][c]}}return a.attr_(c)}};Dygraph.prototype.rollPeriod=function(){return this.rollPeriod_};Dygraph.prototype.xAxisRange=function(){return this.dateWindow_?this.dateWindow_:this.xAxisExtremes()};Dygraph.prototype.xAxisExtremes=function(){var d=this.attr_("xRangePad")/this.plotter_.area.w;if(this.numRows()===0){return[0-d,1+d]}var c=this.rawData_[0][0];var b=this.rawData_[this.rawData_.length-1][0];if(d){var a=b-c;c-=a*d;b+=a*d}return[c,b]};Dygraph.prototype.yAxisRange=function(a){if(typeof(a)=="undefined"){a=0}if(a<0||a>=this.axes_.length){return null}var b=this.axes_[a];return[b.computedValueRange[0],b.computedValueRange[1]]};Dygraph.prototype.yAxisRanges=function(){var a=[];for(var b=0;b<this.axes_.length;b++){a.push(this.yAxisRange(b))}return a};Dygraph.prototype.toDomCoords=function(a,c,b){return[this.toDomXCoord(a),this.toDomYCoord(c,b)]};Dygraph.prototype.toDomXCoord=function(b){if(b===null){return null}var c=this.plotter_.area;var a=this.xAxisRange();return c.x+(b-a[0])/(a[1]-a[0])*c.w};Dygraph.prototype.toDomYCoord=function(d,a){var c=this.toPercentYCoord(d,a);if(c===null){return null}var b=this.plotter_.area;return b.y+c*b.h};Dygraph.prototype.toDataCoords=function(a,c,b){return[this.toDataXCoord(a),this.toDataYCoord(c,b)]};Dygraph.prototype.toDataXCoord=function(b){if(b===null){return null}var c=this.plotter_.area;var a=this.xAxisRange();return a[0]+(b-c.x)/c.w*(a[1]-a[0])};Dygraph.prototype.toDataYCoord=function(h,b){if(h===null){return null}var c=this.plotter_.area;var g=this.yAxisRange(b);if(typeof(b)=="undefined"){b=0}if(!this.axes_[b].logscale){return g[0]+(c.y+c.h-h)/c.h*(g[1]-g[0])}else{var f=(h-c.y)/c.h;var a=Dygraph.log10(g[1]);var e=a-(f*(a-Dygraph.log10(g[0])));var d=Math.pow(Dygraph.LOG_SCALE,e);return d}};Dygraph.prototype.toPercentYCoord=function(f,c){if(f===null){return null}if(typeof(c)=="undefined"){c=0}var e=this.yAxisRange(c);var d;var b=this.attributes_.getForAxis("logscale",c);if(!b){d=(e[1]-f)/(e[1]-e[0])}else{var a=Dygraph.log10(e[1]);d=(a-Dygraph.log10(f))/(a-Dygraph.log10(e[0]))}return d};Dygraph.prototype.toPercentXCoord=function(b){if(b===null){return null}var a=this.xAxisRange();return(b-a[0])/(a[1]-a[0])};Dygraph.prototype.numColumns=function(){if(!this.rawData_){return 0}return this.rawData_[0]?this.rawData_[0].length:this.attr_("labels").length};Dygraph.prototype.numRows=function(){if(!this.rawData_){return 0}return this.rawData_.length};Dygraph.prototype.getValue=function(b,a){if(b<0||b>this.rawData_.length){return null}if(a<0||a>this.rawData_[b].length){return null}return this.rawData_[b][a]};Dygraph.prototype.createInterface_=function(){var a=this.maindiv_;this.graphDiv=document.createElement("div");this.graphDiv.style.textAlign="left";a.appendChild(this.graphDiv);this.canvas_=Dygraph.createCanvas();this.canvas_.style.position="absolute";this.hidden_=this.createPlotKitCanvas_(this.canvas_);this.resizeElements_();this.canvas_ctx_=Dygraph.getContext(this.canvas_);this.hidden_ctx_=Dygraph.getContext(this.hidden_);this.graphDiv.appendChild(this.hidden_);this.graphDiv.appendChild(this.canvas_);this.mouseEventElement_=this.createMouseEventElement_();this.layout_=new DygraphLayout(this);var b=this;this.mouseMoveHandler_=function(c){b.mouseMove_(c)};this.mouseOutHandler_=function(f){var d=f.target||f.fromElement;var c=f.relatedTarget||f.toElement;if(Dygraph.isNodeContainedBy(d,b.graphDiv)&&!Dygraph.isNodeContainedBy(c,b.graphDiv)){b.mouseOut_(f)}};this.addAndTrackEvent(window,"mouseout",this.mouseOutHandler_);this.addAndTrackEvent(this.mouseEventElement_,"mousemove",this.mouseMoveHandler_);if(!this.resizeHandler_){this.resizeHandler_=function(c){b.resize()};this.addAndTrackEvent(window,"resize",this.resizeHandler_)}};Dygraph.prototype.resizeElements_=function(){this.graphDiv.style.width=this.width_+"px";this.graphDiv.style.height=this.height_+"px";this.canvas_.width=this.width_;this.canvas_.height=this.height_;this.canvas_.style.width=this.width_+"px";this.canvas_.style.height=this.height_+"px";this.hidden_.width=this.width_;this.hidden_.height=this.height_;this.hidden_.style.width=this.width_+"px";this.hidden_.style.height=this.height_+"px"};Dygraph.prototype.destroy=function(){this.canvas_ctx_.restore();this.hidden_ctx_.restore();var a=function(c){while(c.hasChildNodes()){a(c.firstChild);c.removeChild(c.firstChild)}};this.removeTrackedEvents_();Dygraph.removeEvent(window,"mouseout",this.mouseOutHandler_);Dygraph.removeEvent(this.mouseEventElement_,"mousemove",this.mouseMoveHandler_);Dygraph.removeEvent(window,"resize",this.resizeHandler_);this.resizeHandler_=null;a(this.maindiv_);var b=function(c){for(var d in c){if(typeof(c[d])==="object"){c[d]=null}}};b(this.layout_);b(this.plotter_);b(this)};Dygraph.prototype.createPlotKitCanvas_=function(a){var b=Dygraph.createCanvas();b.style.position="absolute";b.style.top=a.style.top;b.style.left=a.style.left;b.width=this.width_;b.height=this.height_;b.style.width=this.width_+"px";b.style.height=this.height_+"px";return b};Dygraph.prototype.createMouseEventElement_=function(){if(this.isUsingExcanvas_){var a=document.createElement("div");a.style.position="absolute";a.style.backgroundColor="white";a.style.filter="alpha(opacity=0)";a.style.width=this.width_+"px";a.style.height=this.height_+"px";this.graphDiv.appendChild(a);return a}else{return this.canvas_}};Dygraph.prototype.setColors_=function(){var g=this.getLabels();var e=g.length-1;this.colors_=[];this.colorsMap_={};var a=this.attr_("colors");var d;if(!a){var c=this.attr_("colorSaturation")||1;var b=this.attr_("colorValue")||0.5;var k=Math.ceil(e/2);for(d=1;d<=e;d++){if(!this.visibility()[d-1]){continue}var h=d%2?Math.ceil(d/2):(k+d/2);var f=(1*h/(1+e));var j=Dygraph.hsvToRGB(f,c,b);this.colors_.push(j);this.colorsMap_[g[d]]=j}}else{for(d=0;d<e;d++){if(!this.visibility()[d]){continue}var j=a[d%a.length];this.colors_.push(j);this.colorsMap_[g[1+d]]=j}}};Dygraph.prototype.getColors=function(){return this.colors_};Dygraph.prototype.getPropertiesForSeries=function(c){var a=-1;var d=this.getLabels();for(var b=1;b<d.length;b++){if(d[b]==c){a=b;break}}if(a==-1){return null}return{name:c,column:a,visible:this.visibility()[a-1],color:this.colorsMap_[c],axis:1+this.attributes_.axisForSeries(c)}};Dygraph.prototype.createRollInterface_=function(){if(!this.roller_){this.roller_=document.createElement("input");this.roller_.type="text";this.roller_.style.display="none";this.graphDiv.appendChild(this.roller_)}var e=this.attr_("showRoller")?"block":"none";var d=this.plotter_.area;var b={position:"absolute",zIndex:10,top:(d.y+d.h-25)+"px",left:(d.x+1)+"px",display:e};this.roller_.size="2";this.roller_.value=this.rollPeriod_;for(var a in b){if(b.hasOwnProperty(a)){this.roller_.style[a]=b[a]}}var c=this;this.roller_.onchange=function(){c.adjustRoll(c.roller_.value)}};Dygraph.prototype.dragGetX_=function(b,a){return Dygraph.pageX(b)-a.px};Dygraph.prototype.dragGetY_=function(b,a){return Dygraph.pageY(b)-a.py};Dygraph.prototype.createDragInterface_=function(){var c={isZooming:false,isPanning:false,is2DPan:false,dragStartX:null,dragStartY:null,dragEndX:null,dragEndY:null,dragDirection:null,prevEndX:null,prevEndY:null,prevDragDirection:null,cancelNextDblclick:false,initialLeftmostDate:null,xUnitsPerPixel:null,dateRange:null,px:0,py:0,boundedDates:null,boundedValues:null,tarp:new Dygraph.IFrameTarp(),initializeMouseDown:function(j,i,h){if(j.preventDefault){j.preventDefault()}else{j.returnValue=false;j.cancelBubble=true}h.px=Dygraph.findPosX(i.canvas_);h.py=Dygraph.findPosY(i.canvas_);h.dragStartX=i.dragGetX_(j,h);h.dragStartY=i.dragGetY_(j,h);h.cancelNextDblclick=false;h.tarp.cover()}};var f=this.attr_("interactionModel");var b=this;var e=function(g){return function(h){g(h,b,c)}};for(var a in f){if(!f.hasOwnProperty(a)){continue}this.addAndTrackEvent(this.mouseEventElement_,a,e(f[a]))}var d=function(h){if(c.isZooming||c.isPanning){c.isZooming=false;c.dragStartX=null;c.dragStartY=null}if(c.isPanning){c.isPanning=false;c.draggingDate=null;c.dateRange=null;for(var g=0;g<b.axes_.length;g++){delete b.axes_[g].draggingValue;delete b.axes_[g].dragValueRange}}c.tarp.uncover()};this.addAndTrackEvent(document,"mouseup",d)};Dygraph.prototype.drawZoomRect_=function(e,c,i,b,g,a,f,d){var h=this.canvas_ctx_;if(a==Dygraph.HORIZONTAL){h.clearRect(Math.min(c,f),this.layout_.getPlotArea().y,Math.abs(c-f),this.layout_.getPlotArea().h)}else{if(a==Dygraph.VERTICAL){h.clearRect(this.layout_.getPlotArea().x,Math.min(b,d),this.layout_.getPlotArea().w,Math.abs(b-d))}}if(e==Dygraph.HORIZONTAL){if(i&&c){h.fillStyle="rgba(128,128,128,0.33)";h.fillRect(Math.min(c,i),this.layout_.getPlotArea().y,Math.abs(i-c),this.layout_.getPlotArea().h)}}else{if(e==Dygraph.VERTICAL){if(g&&b){h.fillStyle="rgba(128,128,128,0.33)";h.fillRect(this.layout_.getPlotArea().x,Math.min(b,g),this.layout_.getPlotArea().w,Math.abs(g-b))}}}if(this.isUsingExcanvas_){this.currentZoomRectArgs_=[e,c,i,b,g,0,0,0]}};Dygraph.prototype.clearZoomRect_=function(){this.currentZoomRectArgs_=null;this.canvas_ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height)};Dygraph.prototype.doZoomX_=function(c,a){this.currentZoomRectArgs_=null;var b=this.toDataXCoord(c);var d=this.toDataXCoord(a);this.doZoomXDates_(b,d)};Dygraph.zoomAnimationFunction=function(c,b){var a=1.5;return(1-Math.pow(a,-c))/(1-Math.pow(a,-b))};Dygraph.prototype.doZoomXDates_=function(c,e){var a=this.xAxisRange();var d=[c,e];this.zoomed_x_=true;var b=this;this.doAnimatedZoom(a,d,null,null,function(){if(b.attr_("zoomCallback")){b.attr_("zoomCallback")(c,e,b.yAxisRanges())}})};Dygraph.prototype.doZoomY_=function(h,f){this.currentZoomRectArgs_=null;var c=this.yAxisRanges();var b=[];for(var e=0;e<this.axes_.length;e++){var d=this.toDataYCoord(h,e);var a=this.toDataYCoord(f,e);b.push([a,d])}this.zoomed_y_=true;var g=this;this.doAnimatedZoom(null,null,c,b,function(){if(g.attr_("zoomCallback")){var i=g.xAxisRange();g.attr_("zoomCallback")(i[0],i[1],g.yAxisRanges())}})};Dygraph.prototype.resetZoom=function(){var c=false,d=false,a=false;if(this.dateWindow_!==null){c=true;d=true}for(var g=0;g<this.axes_.length;g++){if(typeof(this.axes_[g].valueWindow)!=="undefined"&&this.axes_[g].valueWindow!==null){c=true;a=true}}this.clearSelection();if(c){this.zoomed_x_=false;this.zoomed_y_=false;var f=this.rawData_[0][0];var b=this.rawData_[this.rawData_.length-1][0];if(!this.attr_("animatedZooms")){this.dateWindow_=null;for(g=0;g<this.axes_.length;g++){if(this.axes_[g].valueWindow!==null){delete this.axes_[g].valueWindow}}this.drawGraph_();if(this.attr_("zoomCallback")){this.attr_("zoomCallback")(f,b,this.yAxisRanges())}return}var l=null,m=null,k=null,h=null;if(d){l=this.xAxisRange();m=[f,b]}if(a){k=this.yAxisRanges();var n=this.gatherDatasets_(this.rolledSeries_,null);var o=n.extremes;this.computeYAxisRanges_(o);h=[];for(g=0;g<this.axes_.length;g++){var e=this.axes_[g];h.push((e.valueRange!==null&&e.valueRange!==undefined)?e.valueRange:e.extremeRange)}}var j=this;this.doAnimatedZoom(l,m,k,h,function(){j.dateWindow_=null;for(var p=0;p<j.axes_.length;p++){if(j.axes_[p].valueWindow!==null){delete j.axes_[p].valueWindow}}if(j.attr_("zoomCallback")){j.attr_("zoomCallback")(f,b,j.yAxisRanges())}})}};Dygraph.prototype.doAnimatedZoom=function(a,e,b,c,m){var i=this.attr_("animatedZooms")?Dygraph.ANIMATION_STEPS:1;var l=[];var k=[];var f,d;if(a!==null&&e!==null){for(f=1;f<=i;f++){d=Dygraph.zoomAnimationFunction(f,i);l[f-1]=[a[0]*(1-d)+d*e[0],a[1]*(1-d)+d*e[1]]}}if(b!==null&&c!==null){for(f=1;f<=i;f++){d=Dygraph.zoomAnimationFunction(f,i);var n=[];for(var g=0;g<this.axes_.length;g++){n.push([b[g][0]*(1-d)+d*c[g][0],b[g][1]*(1-d)+d*c[g][1]])}k[f-1]=n}}var h=this;Dygraph.repeatAndCleanup(function(p){if(k.length){for(var o=0;o<h.axes_.length;o++){var j=k[p][o];h.axes_[o].valueWindow=[j[0],j[1]]}}if(l.length){h.dateWindow_=l[p]}h.drawGraph_()},i,Dygraph.ANIMATION_DURATION/i,m)};Dygraph.prototype.getArea=function(){return this.plotter_.area};Dygraph.prototype.eventToDomCoords=function(c){if(c.offsetX&&c.offsetY){return[c.offsetX,c.offsetY]}else{var b=Dygraph.pageX(c)-Dygraph.findPosX(this.mouseEventElement_);var a=Dygraph.pageY(c)-Dygraph.findPosY(this.mouseEventElement_);return[b,a]}};Dygraph.prototype.findClosestRow=function(a){var g=Infinity;var h=-1;var e=this.layout_.points;for(var c=0;c<e.length;c++){var l=e[c];var d=l.length;for(var b=0;b<d;b++){var k=l[b];if(!Dygraph.isValidPoint(k,true)){continue}var f=Math.abs(k.canvasx-a);if(f<g){g=f;h=k.idx}}}return h};Dygraph.prototype.findClosestPoint=function(f,e){var k=Infinity;var h,o,n,l,d,c,j;for(var b=this.layout_.points.length-1;b>=0;--b){var m=this.layout_.points[b];for(var g=0;g<m.length;++g){l=m[g];if(!Dygraph.isValidPoint(l)){continue}o=l.canvasx-f;n=l.canvasy-e;h=o*o+n*n;if(h<k){k=h;d=l;c=b;j=l.idx}}}var a=this.layout_.setNames[c];return{row:j,seriesName:a,point:d}};Dygraph.prototype.findStackedPoint=function(i,h){var p=this.findClosestRow(i);var f,c;for(var d=0;d<this.layout_.points.length;++d){var g=this.getLeftBoundary_(d);var e=p-g;var l=this.layout_.points[d];if(e>=l.length){continue}var m=l[e];if(!Dygraph.isValidPoint(m)){continue}var j=m.canvasy;if(i>m.canvasx&&e+1<l.length){var k=l[e+1];if(Dygraph.isValidPoint(k)){var o=k.canvasx-m.canvasx;if(o>0){var a=(i-m.canvasx)/o;j+=a*(k.canvasy-m.canvasy)}}}else{if(i<m.canvasx&&e>0){var n=l[e-1];if(Dygraph.isValidPoint(n)){var o=m.canvasx-n.canvasx;if(o>0){var a=(m.canvasx-i)/o;j+=a*(n.canvasy-m.canvasy)}}}}if(d===0||j<h){f=m;c=d}}var b=this.layout_.setNames[c];return{row:p,seriesName:b,point:f}};Dygraph.prototype.mouseMove_=function(b){var h=this.layout_.points;if(h===undefined||h===null){return}var e=this.eventToDomCoords(b);var a=e[0];var j=e[1];var f=this.attr_("highlightSeriesOpts");var d=false;if(f&&!this.isSeriesLocked()){var c;if(this.attr_("stackedGraph")){c=this.findStackedPoint(a,j)}else{c=this.findClosestPoint(a,j)}d=this.setSelection(c.row,c.seriesName)}else{var g=this.findClosestRow(a);d=this.setSelection(g)}var i=this.attr_("highlightCallback");if(i&&d){i(b,this.lastx_,this.selPoints_,this.lastRow_,this.highlightSet_)}};Dygraph.prototype.getLeftBoundary_=function(b){if(this.boundaryIds_[b]){return this.boundaryIds_[b][0]}else{for(var a=0;a<this.boundaryIds_.length;a++){if(this.boundaryIds_[a]!==undefined){return this.boundaryIds_[a][0]}}return 0}};Dygraph.prototype.animateSelection_=function(f){var e=10;var c=30;if(this.fadeLevel===undefined){this.fadeLevel=0}if(this.animateId===undefined){this.animateId=0}var g=this.fadeLevel;var b=f<0?g:e-g;if(b<=0){if(this.fadeLevel){this.updateSelection_(1)}return}var a=++this.animateId;var d=this;Dygraph.repeatAndCleanup(function(h){if(d.animateId!=a){return}d.fadeLevel+=f;if(d.fadeLevel===0){d.clearSelection()}else{d.updateSelection_(d.fadeLevel/e)}},b,c,function(){})};Dygraph.prototype.updateSelection_=function(d){this.cascadeEvents_("select",{selectedX:this.lastx_,selectedPoints:this.selPoints_});var h;var n=this.canvas_ctx_;if(this.attr_("highlightSeriesOpts")){n.clearRect(0,0,this.width_,this.height_);var f=1-this.attr_("highlightSeriesBackgroundAlpha");if(f){var g=true;if(g){if(d===undefined){this.animateSelection_(1);return}f*=d}n.fillStyle="rgba(255,255,255,"+f+")";n.fillRect(0,0,this.width_,this.height_)}this.plotter_._renderLineChart(this.highlightSet_,n)}else{if(this.previousVerticalX_>=0){var j=0;var k=this.attr_("labels");for(h=1;h<k.length;h++){var c=this.attr_("highlightCircleSize",k[h]);if(c>j){j=c}}var l=this.previousVerticalX_;n.clearRect(l-j-1,0,2*j+2,this.height_)}}if(this.isUsingExcanvas_&&this.currentZoomRectArgs_){Dygraph.prototype.drawZoomRect_.apply(this,this.currentZoomRectArgs_)}if(this.selPoints_.length>0){var b=this.selPoints_[0].canvasx;n.save();for(h=0;h<this.selPoints_.length;h++){var o=this.selPoints_[h];if(!Dygraph.isOK(o.canvasy)){continue}var a=this.attr_("highlightCircleSize",o.name);var m=this.attr_("drawHighlightPointCallback",o.name);var e=this.plotter_.colors[o.name];if(!m){m=Dygraph.Circles.DEFAULT}n.lineWidth=this.attr_("strokeWidth",o.name);n.strokeStyle=e;n.fillStyle=e;m(this.g,o.name,n,b,o.canvasy,e,a,o.idx)}n.restore();this.previousVerticalX_=b}};Dygraph.prototype.setSelection=function(f,h,g){this.selPoints_=[];var e=false;if(f!==false&&f>=0){if(f!=this.lastRow_){e=true}this.lastRow_=f;for(var d=0;d<this.layout_.points.length;++d){var b=this.layout_.points[d];var c=f-this.getLeftBoundary_(d);if(c<b.length){var a=b[c];if(a.yval!==null){this.selPoints_.push(a)}}}}else{if(this.lastRow_>=0){e=true}this.lastRow_=-1}if(this.selPoints_.length){this.lastx_=this.selPoints_[0].xval}else{this.lastx_=-1}if(h!==undefined){if(this.highlightSet_!==h){e=true}this.highlightSet_=h}if(g!==undefined){this.lockedSet_=g}if(e){this.updateSelection_(undefined)}return e};Dygraph.prototype.mouseOut_=function(a){if(this.attr_("unhighlightCallback")){this.attr_("unhighlightCallback")(a)}if(this.attr_("hideOverlayOnMouseOut")&&!this.lockedSet_){this.clearSelection()}};Dygraph.prototype.clearSelection=function(){this.cascadeEvents_("deselect",{});this.lockedSet_=false;if(this.fadeLevel){this.animateSelection_(-1);return}this.canvas_ctx_.clearRect(0,0,this.width_,this.height_);this.fadeLevel=0;this.selPoints_=[];this.lastx_=-1;this.lastRow_=-1;this.highlightSet_=null};Dygraph.prototype.getSelection=function(){if(!this.selPoints_||this.selPoints_.length<1){return -1}for(var c=0;c<this.layout_.points.length;c++){var a=this.layout_.points[c];for(var b=0;b<a.length;b++){if(a[b].x==this.selPoints_[0].x){return a[b].idx}}}return -1};Dygraph.prototype.getHighlightSeries=function(){return this.highlightSet_};Dygraph.prototype.isSeriesLocked=function(){return this.lockedSet_};Dygraph.prototype.loadedEvent_=function(a){this.rawData_=this.parseCSV_(a);this.predraw_()};Dygraph.prototype.addXTicks_=function(){var a;if(this.dateWindow_){a=[this.dateWindow_[0],this.dateWindow_[1]]}else{a=this.xAxisExtremes()}var c=this.optionsViewForAxis_("x");var b=c("ticker")(a[0],a[1],this.width_,c,this);this.layout_.setXTicks(b)};Dygraph.prototype.extremeValues_=function(d){var h=null,f=null,c,g;var b=this.attr_("errorBars")||this.attr_("customBars");if(b){for(c=0;c<d.length;c++){g=d[c][1][0];if(g===null||isNaN(g)){continue}var a=g-d[c][1][1];var e=g+d[c][1][2];if(a>g){a=g}if(e<g){e=g}if(f===null||e>f){f=e}if(h===null||a<h){h=a}}}else{for(c=0;c<d.length;c++){g=d[c][1];if(g===null||isNaN(g)){continue}if(f===null||g>f){f=g}if(h===null||g<h){h=g}}}return[h,f]};Dygraph.prototype.predraw_=function(){var e=new Date();this.layout_.computePlotArea();this.computeYAxes_();if(this.plotter_){this.cascadeEvents_("clearChart");this.plotter_.clear()}if(!this.is_initial_draw_){this.canvas_ctx_.restore();this.hidden_ctx_.restore()}this.canvas_ctx_.save();this.hidden_ctx_.save();this.plotter_=new DygraphCanvasRenderer(this,this.hidden_,this.hidden_ctx_,this.layout_);this.createRollInterface_();this.cascadeEvents_("predraw");this.rolledSeries_=[null];for(var c=1;c<this.numColumns();c++){var d=this.attr_("logscale");var b=this.extractSeries_(this.rawData_,c,d);b=this.rollingAverage(b,this.rollPeriod_);this.rolledSeries_.push(b)}this.drawGraph_();var a=new Date();this.drawingTimeMs_=(a-e)};Dygraph.PointType=undefined;Dygraph.seriesToPoints_=function(b,j,d,f){var h=[];for(var c=0;c<b.length;++c){var k=b[c];var a=j?k[1][0]:k[1];var e=a===null?null:DygraphLayout.parseFloat_(a);var g={x:NaN,y:NaN,xval:DygraphLayout.parseFloat_(k[0]),yval:e,name:d,idx:c+f};if(j){g.y_top=NaN;g.y_bottom=NaN;g.yval_minus=DygraphLayout.parseFloat_(k[1][1]);g.yval_plus=DygraphLayout.parseFloat_(k[1][2])}h.push(g)}return h};Dygraph.stackPoints_=function(m,l,o,f){var h=null;var d=null;var g=null;var c=-1;var k=function(i){if(c>=i){return}for(var p=i;p<m.length;++p){g=null;if(!isNaN(m[p].yval)&&m[p].yval!==null){c=p;g=m[p];break}}};for(var b=0;b<m.length;++b){var j=m[b];var n=j.xval;if(l[n]===undefined){l[n]=0}var e=j.yval;if(isNaN(e)||e===null){k(b);if(d&&g&&f!="none"){e=d.yval+(g.yval-d.yval)*((n-d.xval)/(g.xval-d.xval))}else{if(d&&f=="all"){e=d.yval}else{if(g&&f=="all"){e=g.yval}else{e=0}}}}else{d=j}var a=l[n];if(h!=n){a+=e;l[n]=a}h=n;j.yval_stacked=a;if(a>o[1]){o[1]=a}if(a<o[0]){o[0]=a}}};Dygraph.prototype.gatherDatasets_=function(w,f){var s=[];var t=[];var q=[];var a={};var u,r;var x=this.attr_("errorBars");var h=this.attr_("customBars");var p=x||h;var b=function(i){if(!p){return i[1]===null}else{return h?i[1][1]===null:x?i[1][0]===null:false}};var n=w.length-1;var l;for(u=n;u>=1;u--){if(!this.visibility()[u-1]){continue}if(f){l=w[u];var z=f[0];var j=f[1];var g=null,y=null;for(r=0;r<l.length;r++){if(l[r][0]>=z&&g===null){g=r}if(l[r][0]<=j){y=r}}if(g===null){g=0}var e=g;var d=true;while(d&&e>0){e--;d=b(l[e])}if(y===null){y=l.length-1}var c=y;d=true;while(d&&c<l.length-1){c++;d=b(l[c])}if(e!==g){g=e}if(c!==y){y=c}s[u-1]=[g,y];l=l.slice(g,y+1)}else{l=w[u];s[u-1]=[0,l.length-1]}var v=this.attr_("labels")[u];var o=this.extremeValues_(l);var m=Dygraph.seriesToPoints_(l,p,v,s[u-1][0]);if(this.attr_("stackedGraph")){Dygraph.stackPoints_(m,q,o,this.attr_("stackedGraphNaNFill"))}a[v]=o;t[u]=m}return{points:t,extremes:a,boundaryIds:s}};Dygraph.prototype.drawGraph_=function(){var a=new Date();var d=this.is_initial_draw_;this.is_initial_draw_=false;this.layout_.removeAllDatasets();this.setColors_();this.attrs_.pointSize=0.5*this.attr_("highlightCircleSize");var j=this.gatherDatasets_(this.rolledSeries_,this.dateWindow_);var h=j.points;var k=j.extremes;this.boundaryIds_=j.boundaryIds;this.setIndexByName_={};var g=this.attr_("labels");if(g.length>0){this.setIndexByName_[g[0]]=0}var e=0;for(var f=1;f<h.length;f++){this.setIndexByName_[g[f]]=f;if(!this.visibility()[f-1]){continue}this.layout_.addDataset(g[f],h[f]);this.datasetIndex_[f]=e++}this.computeYAxisRanges_(k);this.layout_.setYAxes(this.axes_);this.addXTicks_();var b=this.zoomed_x_;this.zoomed_x_=b;this.layout_.evaluate();this.renderGraph_(d);if(this.attr_("timingName")){var c=new Date();Dygraph.info(this.attr_("timingName")+" - drawGraph: "+(c-a)+"ms")}};Dygraph.prototype.renderGraph_=function(b){this.cascadeEvents_("clearChart");this.plotter_.clear();if(this.attr_("underlayCallback")){this.attr_("underlayCallback")(this.hidden_ctx_,this.layout_.getPlotArea(),this,this)}var c={canvas:this.hidden_,drawingContext:this.hidden_ctx_};this.cascadeEvents_("willDrawChart",c);this.plotter_.render();this.cascadeEvents_("didDrawChart",c);this.lastRow_=-1;this.canvas_.getContext("2d").clearRect(0,0,this.canvas_.width,this.canvas_.height);if(this.attr_("drawCallback")!==null){this.attr_("drawCallback")(this,b)}if(b){this.readyFired_=true;while(this.readyFns_.length>0){var a=this.readyFns_.pop();a(this)}}};Dygraph.prototype.computeYAxes_=function(){var b,d,c,f,a;if(this.axes_!==undefined&&this.user_attrs_.hasOwnProperty("valueRange")===false){b=[];for(c=0;c<this.axes_.length;c++){b.push(this.axes_[c].valueWindow)}}this.axes_=[];for(d=0;d<this.attributes_.numAxes();d++){f={g:this};Dygraph.update(f,this.attributes_.axisOptions(d));this.axes_[d]=f}a=this.attr_("valueRange");if(a){this.axes_[0].valueRange=a}if(b!==undefined){var e=Math.min(b.length,this.axes_.length);for(c=0;c<e;c++){this.axes_[c].valueWindow=b[c]}}for(d=0;d<this.axes_.length;d++){if(d===0){f=this.optionsViewForAxis_("y"+(d?"2":""));a=f("valueRange");if(a){this.axes_[d].valueRange=a}}else{var g=this.user_attrs_.axes;if(g&&g.y2){a=g.y2.valueRange;if(a){this.axes_[d].valueRange=a}}}}};Dygraph.prototype.numAxes=function(){return this.attributes_.numAxes()};Dygraph.prototype.axisPropertiesForSeries=function(a){return this.axes_[this.attributes_.axisForSeries(a)]};Dygraph.prototype.computeYAxisRanges_=function(a){var g=function(i){return isNaN(parseFloat(i))};var q=this.attributes_.numAxes();var b,x,o,B;var p;for(var y=0;y<q;y++){var c=this.axes_[y];var C=this.attributes_.getForAxis("logscale",y);var G=this.attributes_.getForAxis("includeZero",y);var l=this.attributes_.getForAxis("independentTicks",y);o=this.attributes_.seriesForAxis(y);b=true;B=0.1;if(this.attr_("yRangePad")!==null){b=false;B=this.attr_("yRangePad")/this.plotter_.area.h}if(o.length===0){c.extremeRange=[0,1]}else{var D=Infinity;var A=-Infinity;var t,s;for(var w=0;w<o.length;w++){if(!a.hasOwnProperty(o[w])){continue}t=a[o[w]][0];if(t!==null){D=Math.min(t,D)}s=a[o[w]][1];if(s!==null){A=Math.max(s,A)}}if(G&&!C){if(D>0){D=0}if(A<0){A=0}}if(D==Infinity){D=0}if(A==-Infinity){A=1}x=A-D;if(x===0){if(A!==0){x=Math.abs(A)}else{A=1;x=1}}var h,H;if(C){if(b){h=A+B*x;H=D}else{var E=Math.exp(Math.log(x)*B);h=A*E;H=D/E}}else{h=A+B*x;H=D-B*x;if(b&&!this.attr_("avoidMinZero")){if(H<0&&D>=0){H=0}if(h>0&&A<=0){h=0}}}c.extremeRange=[H,h]}if(c.valueWindow){c.computedValueRange=[c.valueWindow[0],c.valueWindow[1]]}else{if(c.valueRange){var e=g(c.valueRange[0])?c.extremeRange[0]:c.valueRange[0];var d=g(c.valueRange[1])?c.extremeRange[1]:c.valueRange[1];if(!b){if(c.logscale){var E=Math.exp(Math.log(x)*B);e*=E;d/=E}else{x=d-e;e-=x*B;d+=x*B}}c.computedValueRange=[e,d]}else{c.computedValueRange=c.extremeRange}}if(l){c.independentTicks=l;var r=this.optionsViewForAxis_("y"+(y?"2":""));var F=r("ticker");c.ticks=F(c.computedValueRange[0],c.computedValueRange[1],this.height_,r,this);if(!p){p=c}}}if(p===undefined){throw ('Configuration Error: At least one axis has to have the "independentTicks" option activated.')}for(var y=0;y<q;y++){var c=this.axes_[y];if(!c.independentTicks){var r=this.optionsViewForAxis_("y"+(y?"2":""));var F=r("ticker");var m=p.ticks;var n=p.computedValueRange[1]-p.computedValueRange[0];var I=c.computedValueRange[1]-c.computedValueRange[0];var f=[];for(var v=0;v<m.length;v++){var u=(m[v].v-p.computedValueRange[0])/n;var z=c.computedValueRange[0]+u*I;f.push(z)}c.ticks=F(c.computedValueRange[0],c.computedValueRange[1],this.height_,r,this,f)}}};Dygraph.prototype.extractSeries_=function(a,f,c){var g=[];var h=this.attr_("errorBars");var e=this.attr_("customBars");for(var d=0;d<a.length;d++){var l=a[d][0];var m=a[d][f];if(c){if(h||e){for(var b=0;b<m.length;b++){if(m[b]<=0){m=null;break}}}else{if(m<=0){m=null}}}if(m!==null){g.push([l,m])}else{g.push([l,h?[null,null]:e?[null,null,null]:m])}}return g};Dygraph.prototype.rollingAverage=function(l,d){d=Math.min(d,l.length);var b=[];var t=this.attr_("sigma");var G,o,z,x,m,c,F,A;if(this.fractions_){var k=0;var h=0;var e=100;for(z=0;z<l.length;z++){k+=l[z][1][0];h+=l[z][1][1];if(z-d>=0){k-=l[z-d][1][0];h-=l[z-d][1][1]}var C=l[z][0];var w=h?k/h:0;if(this.attr_("errorBars")){if(this.attr_("wilsonInterval")){if(h){var s=w<0?0:w,u=h;var B=t*Math.sqrt(s*(1-s)/u+t*t/(4*u*u));var a=1+t*t/h;G=(s+t*t/(2*h)-B)/a;o=(s+t*t/(2*h)+B)/a;b[z]=[C,[s*e,(s-G)*e,(o-s)*e]]}else{b[z]=[C,[0,0,0]]}}else{A=h?t*Math.sqrt(w*(1-w)/h):1;b[z]=[C,[e*w,e*A,e*A]]}}else{b[z]=[C,e*w]}}}else{if(this.attr_("customBars")){G=0;var D=0;o=0;var g=0;for(z=0;z<l.length;z++){var E=l[z][1];m=E[1];b[z]=[l[z][0],[m,m-E[0],E[2]-m]];if(m!==null&&!isNaN(m)){G+=E[0];D+=m;o+=E[2];g+=1}if(z-d>=0){var r=l[z-d];if(r[1][1]!==null&&!isNaN(r[1][1])){G-=r[1][0];D-=r[1][1];o-=r[1][2];g-=1}}if(g){b[z]=[l[z][0],[1*D/g,1*(D-G)/g,1*(o-D)/g]]}else{b[z]=[l[z][0],[null,null,null]]}}}else{if(!this.attr_("errorBars")){if(d==1){return l}for(z=0;z<l.length;z++){c=0;F=0;for(x=Math.max(0,z-d+1);x<z+1;x++){m=l[x][1];if(m===null||isNaN(m)){continue}F++;c+=l[x][1]}if(F){b[z]=[l[z][0],c/F]}else{b[z]=[l[z][0],null]}}}else{for(z=0;z<l.length;z++){c=0;var f=0;F=0;for(x=Math.max(0,z-d+1);x<z+1;x++){m=l[x][1][0];if(m===null||isNaN(m)){continue}F++;c+=l[x][1][0];f+=Math.pow(l[x][1][1],2)}if(F){A=Math.sqrt(f)/F;b[z]=[l[z][0],[c/F,t*A,t*A]]}else{var q=(d==1)?l[z][1][0]:null;b[z]=[l[z][0],[q,q,q]]}}}}}return b};Dygraph.prototype.detectTypeFromString_=function(b){var a=false;var c=b.indexOf("-");if((c>0&&(b[c-1]!="e"&&b[c-1]!="E"))||b.indexOf("/")>=0||isNaN(parseFloat(b))){a=true}else{if(b.length==8&&b>"19700101"&&b<"20371231"){a=true}}this.setXAxisOptions_(a)};Dygraph.prototype.setXAxisOptions_=function(a){if(a){this.attrs_.xValueParser=Dygraph.dateParser;this.attrs_.axes.x.valueFormatter=Dygraph.dateString_;this.attrs_.axes.x.ticker=Dygraph.dateTicker;this.attrs_.axes.x.axisLabelFormatter=Dygraph.dateAxisFormatter}else{this.attrs_.xValueParser=function(b){return parseFloat(b)};this.attrs_.axes.x.valueFormatter=function(b){return b};this.attrs_.axes.x.ticker=Dygraph.numericLinearTicks;this.attrs_.axes.x.axisLabelFormatter=this.attrs_.axes.x.valueFormatter}};Dygraph.prototype.parseFloat_=function(a,c,b){var e=parseFloat(a);if(!isNaN(e)){return e}if(/^ *$/.test(a)){return null}if(/^ *nan *$/i.test(a)){return NaN}var d="Unable to parse '"+a+"' as a number";if(b!==null&&c!==null){d+=" on line "+(1+c)+" ('"+b+"') of CSV."}this.error(d);return null};Dygraph.prototype.parseCSV_=function(t){var r=[];var s=Dygraph.detectLineDelimiter(t);var a=t.split(s||"\n");var g,k;var p=this.attr_("delimiter");if(a[0].indexOf(p)==-1&&a[0].indexOf("\t")>=0){p="\t"}var b=0;if(!("labels" in this.user_attrs_)){b=1;this.attrs_.labels=a[0].split(p);this.attributes_.reparseSeries()}var o=0;var m;var q=false;var c=this.attr_("labels").length;var f=false;for(var l=b;l<a.length;l++){var e=a[l];o=l;if(e.length===0){continue}if(e[0]=="#"){continue}var d=e.split(p);if(d.length<2){continue}var h=[];if(!q){this.detectTypeFromString_(d[0]);m=this.attr_("xValueParser");q=true}h[0]=m(d[0],this);if(this.fractions_){for(k=1;k<d.length;k++){g=d[k].split("/");if(g.length!=2){this.error('Expected fractional "num/den" values in CSV data but found a value \''+d[k]+"' on line "+(1+l)+" ('"+e+"') which is not of this form.");h[k]=[0,0]}else{h[k]=[this.parseFloat_(g[0],l,e),this.parseFloat_(g[1],l,e)]}}}else{if(this.attr_("errorBars")){if(d.length%2!=1){this.error("Expected alternating (value, stdev.) pairs in CSV data but line "+(1+l)+" has an odd number of values ("+(d.length-1)+"): '"+e+"'")}for(k=1;k<d.length;k+=2){h[(k+1)/2]=[this.parseFloat_(d[k],l,e),this.parseFloat_(d[k+1],l,e)]}}else{if(this.attr_("customBars")){for(k=1;k<d.length;k++){var u=d[k];if(/^ *$/.test(u)){h[k]=[null,null,null]}else{g=u.split(";");if(g.length==3){h[k]=[this.parseFloat_(g[0],l,e),this.parseFloat_(g[1],l,e),this.parseFloat_(g[2],l,e)]}else{this.warn('When using customBars, values must be either blank or "low;center;high" tuples (got "'+u+'" on line '+(1+l))}}}}else{for(k=1;k<d.length;k++){h[k]=this.parseFloat_(d[k],l,e)}}}}if(r.length>0&&h[0]<r[r.length-1][0]){f=true}if(h.length!=c){this.error("Number of columns in line "+l+" ("+h.length+") does not agree with number of labels ("+c+") "+e)}if(l===0&&this.attr_("labels")){var n=true;for(k=0;n&&k<h.length;k++){if(h[k]){n=false}}if(n){this.warn("The dygraphs 'labels' option is set, but the first row of CSV data ('"+e+"') appears to also contain labels. Will drop the CSV labels and use the option labels.");continue}}r.push(h)}if(f){this.warn("CSV is out of order; order it correctly to speed loading.");r.sort(function(j,i){return j[0]-i[0]})}return r};Dygraph.prototype.parseArray_=function(c){if(c.length===0){this.error("Can't plot empty data set");return null}if(c[0].length===0){this.error("Data set cannot contain an empty row");return null}var a;if(this.attr_("labels")===null){this.warn("Using default labels. Set labels explicitly via 'labels' in the options parameter");this.attrs_.labels=["X"];for(a=1;a<c[0].length;a++){this.attrs_.labels.push("Y"+a)}this.attributes_.reparseSeries()}else{var b=this.attr_("labels");if(b.length!=c[0].length){this.error("Mismatch between number of labels ("+b+") and number of columns in array ("+c[0].length+")");return null}}if(Dygraph.isDateLike(c[0][0])){this.attrs_.axes.x.valueFormatter=Dygraph.dateString_;this.attrs_.axes.x.ticker=Dygraph.dateTicker;this.attrs_.axes.x.axisLabelFormatter=Dygraph.dateAxisFormatter;var d=Dygraph.clone(c);for(a=0;a<c.length;a++){if(d[a].length===0){this.error("Row "+(1+a)+" of data is empty");return null}if(d[a][0]===null||typeof(d[a][0].getTime)!="function"||isNaN(d[a][0].getTime())){this.error("x value in row "+(1+a)+" is not a Date");return null}d[a][0]=d[a][0].getTime()}return d}else{this.attrs_.axes.x.valueFormatter=function(e){return e};this.attrs_.axes.x.ticker=Dygraph.numericLinearTicks;this.attrs_.axes.x.axisLabelFormatter=Dygraph.numberAxisLabelFormatter;return c}};Dygraph.prototype.parseDataTable_=function(w){var d=function(i){var j=String.fromCharCode(65+i%26);i=Math.floor(i/26);while(i>0){j=String.fromCharCode(65+(i-1)%26)+j.toLowerCase();i=Math.floor((i-1)/26)}return j};var h=w.getNumberOfColumns();var g=w.getNumberOfRows();var f=w.getColumnType(0);if(f=="date"||f=="datetime"){this.attrs_.xValueParser=Dygraph.dateParser;this.attrs_.axes.x.valueFormatter=Dygraph.dateString_;this.attrs_.axes.x.ticker=Dygraph.dateTicker;this.attrs_.axes.x.axisLabelFormatter=Dygraph.dateAxisFormatter}else{if(f=="number"){this.attrs_.xValueParser=function(i){return parseFloat(i)};this.attrs_.axes.x.valueFormatter=function(i){return i};this.attrs_.axes.x.ticker=Dygraph.numericLinearTicks;this.attrs_.axes.x.axisLabelFormatter=this.attrs_.axes.x.valueFormatter}else{this.error("only 'date', 'datetime' and 'number' types are supported for column 1 of DataTable input (Got '"+f+"')");return null}}var m=[];var t={};var s=false;var q,o;for(q=1;q<h;q++){var b=w.getColumnType(q);if(b=="number"){m.push(q)}else{if(b=="string"&&this.attr_("displayAnnotations")){var r=m[m.length-1];if(!t.hasOwnProperty(r)){t[r]=[q]}else{t[r].push(q)}s=true}else{this.error("Only 'number' is supported as a dependent type with Gviz. 'string' is only supported if displayAnnotations is true")}}}var u=[w.getColumnLabel(0)];for(q=0;q<m.length;q++){u.push(w.getColumnLabel(m[q]));if(this.attr_("errorBars")){q+=1}}this.attrs_.labels=u;h=u.length;var v=[];var l=false;var a=[];for(q=0;q<g;q++){var e=[];if(typeof(w.getValue(q,0))==="undefined"||w.getValue(q,0)===null){this.warn("Ignoring row "+q+" of DataTable because of undefined or null first column.");continue}if(f=="date"||f=="datetime"){e.push(w.getValue(q,0).getTime())}else{e.push(w.getValue(q,0))}if(!this.attr_("errorBars")){for(o=0;o<m.length;o++){var c=m[o];e.push(w.getValue(q,c));if(s&&t.hasOwnProperty(c)&&w.getValue(q,t[c][0])!==null){var p={};p.series=w.getColumnLabel(c);p.xval=e[0];p.shortText=d(a.length);p.text="";for(var n=0;n<t[c].length;n++){if(n){p.text+="\n"}p.text+=w.getValue(q,t[c][n])}a.push(p)}}for(o=0;o<e.length;o++){if(!isFinite(e[o])){e[o]=null}}}else{for(o=0;o<h-1;o++){e.push([w.getValue(q,1+2*o),w.getValue(q,2+2*o)])}}if(v.length>0&&e[0]<v[v.length-1][0]){l=true}v.push(e)}if(l){this.warn("DataTable is out of order; order it correctly to speed loading.");v.sort(function(j,i){return j[0]-i[0]})}this.rawData_=v;if(a.length>0){this.setAnnotations(a,true)}this.attributes_.reparseSeries()};Dygraph.prototype.start_=function(){var d=this.file_;if(typeof d=="function"){d=d()}if(Dygraph.isArrayLike(d)){this.rawData_=this.parseArray_(d);this.predraw_()}else{if(typeof d=="object"&&typeof d.getColumnRange=="function"){this.parseDataTable_(d);this.predraw_()}else{if(typeof d=="string"){var c=Dygraph.detectLineDelimiter(d);if(c){this.loadedEvent_(d)}else{var b;if(window.XMLHttpRequest){b=new XMLHttpRequest()}else{b=new ActiveXObject("Microsoft.XMLHTTP")}var a=this;b.onreadystatechange=function(){if(b.readyState==4){if(b.status===200||b.status===0){a.loadedEvent_(b.responseText)}}};b.open("GET",d,true);b.send(null)}}else{this.error("Unknown data format: "+(typeof d))}}}};Dygraph.prototype.updateOptions=function(e,b){if(typeof(b)=="undefined"){b=false}var d=e.file;var c=Dygraph.mapLegacyOptions_(e);if("rollPeriod" in c){this.rollPeriod_=c.rollPeriod}if("dateWindow" in c){this.dateWindow_=c.dateWindow;if(!("isZoomedIgnoreProgrammaticZoom" in c)){this.zoomed_x_=(c.dateWindow!==null)}}if("valueRange" in c&&!("isZoomedIgnoreProgrammaticZoom" in c)){this.zoomed_y_=(c.valueRange!==null)}var a=Dygraph.isPixelChangingOptionList(this.attr_("labels"),c);Dygraph.updateDeep(this.user_attrs_,c);this.attributes_.reparseSeries();if(d){this.file_=d;if(!b){this.start_()}}else{if(!b){if(a){this.predraw_()}else{this.renderGraph_(false)}}}};Dygraph.mapLegacyOptions_=function(c){var a={};for(var b in c){if(b=="file"){continue}if(c.hasOwnProperty(b)){a[b]=c[b]}}var e=function(g,f,h){if(!a.axes){a.axes={}}if(!a.axes[g]){a.axes[g]={}}a.axes[g][f]=h};var d=function(f,g,h){if(typeof(c[f])!="undefined"){Dygraph.warn("Option "+f+" is deprecated. Use the "+h+" option for the "+g+" axis instead. (e.g. { axes : { "+g+" : { "+h+" : ... } } } (see http://dygraphs.com/per-axis.html for more information.");e(g,h,c[f]);delete a[f]}};d("xValueFormatter","x","valueFormatter");d("pixelsPerXLabel","x","pixelsPerLabel");d("xAxisLabelFormatter","x","axisLabelFormatter");d("xTicker","x","ticker");d("yValueFormatter","y","valueFormatter");d("pixelsPerYLabel","y","pixelsPerLabel");d("yAxisLabelFormatter","y","axisLabelFormatter");d("yTicker","y","ticker");return a};Dygraph.prototype.resize=function(d,b){if(this.resize_lock){return}this.resize_lock=true;if((d===null)!=(b===null)){this.warn("Dygraph.resize() should be called with zero parameters or two non-NULL parameters. Pretending it was zero.");d=b=null}var a=this.width_;var c=this.height_;if(d){this.maindiv_.style.width=d+"px";this.maindiv_.style.height=b+"px";this.width_=d;this.height_=b}else{this.width_=this.maindiv_.clientWidth;this.height_=this.maindiv_.clientHeight}if(a!=this.width_||c!=this.height_){this.resizeElements_();this.predraw_()}this.resize_lock=false};Dygraph.prototype.adjustRoll=function(a){this.rollPeriod_=a;this.predraw_()};Dygraph.prototype.visibility=function(){if(!this.attr_("visibility")){this.attrs_.visibility=[]}while(this.attr_("visibility").length<this.numColumns()-1){this.attrs_.visibility.push(true)}return this.attr_("visibility")};Dygraph.prototype.setVisibility=function(b,c){var a=this.visibility();if(b<0||b>=a.length){this.warn("invalid series number in setVisibility: "+b)}else{a[b]=c;this.predraw_()}};Dygraph.prototype.size=function(){return{width:this.width_,height:this.height_}};Dygraph.prototype.setAnnotations=function(b,a){Dygraph.addAnnotationRule();this.annotations_=b;if(!this.layout_){this.warn("Tried to setAnnotations before dygraph was ready. Try setting them in a ready() block. See dygraphs.com/tests/annotation.html");return}this.layout_.setAnnotations(this.annotations_);if(!a){this.predraw_()}};Dygraph.prototype.annotations=function(){return this.annotations_};Dygraph.prototype.getLabels=function(){var a=this.attr_("labels");return a?a.slice():null};Dygraph.prototype.indexFromSetName=function(a){return this.setIndexByName_[a]};Dygraph.prototype.ready=function(a){if(this.is_initial_draw_){this.readyFns_.push(a)}else{a(this)}};Dygraph.addAnnotationRule=function(){if(Dygraph.addedAnnotationCSS){return}var f="border: 1px solid black; background-color: white; text-align: center;";var e=document.createElement("style");e.type="text/css";document.getElementsByTagName("head")[0].appendChild(e);for(var b=0;b<document.styleSheets.length;b++){if(document.styleSheets[b].disabled){continue}var d=document.styleSheets[b];try{if(d.insertRule){var a=d.cssRules?d.cssRules.length:0;d.insertRule(".dygraphDefaultAnnotation { "+f+" }",a)}else{if(d.addRule){d.addRule(".dygraphDefaultAnnotation",f)}}Dygraph.addedAnnotationCSS=true;return}catch(c){}}this.warn("Unable to add default annotation CSS rule; display may be off.")};var DateGraph=Dygraph;"use strict";Dygraph.LOG_SCALE=10;Dygraph.LN_TEN=Math.log(Dygraph.LOG_SCALE);Dygraph.log10=function(a){return Math.log(a)/Dygraph.LN_TEN};Dygraph.DEBUG=1;Dygraph.INFO=2;Dygraph.WARNING=3;Dygraph.ERROR=3;Dygraph.LOG_STACK_TRACES=false;Dygraph.DOTTED_LINE=[2,2];Dygraph.DASHED_LINE=[7,3];Dygraph.DOT_DASH_LINE=[7,2,2,2];Dygraph.log=function(c,g){var b;if(typeof(printStackTrace)!="undefined"){try{b=printStackTrace({guess:false});while(b[0].indexOf("stacktrace")!=-1){b.splice(0,1)}b.splice(0,2);for(var d=0;d<b.length;d++){b[d]=b[d].replace(/\([^)]*\/(.*)\)/,"@$1").replace(/\@.*\/([^\/]*)/,"@$1").replace("[object Object].","")}var j=b.splice(0,1)[0];g+=" ("+j.replace(/^.*@ ?/,"")+")"}catch(h){}}if(typeof(window.console)!="undefined"){var a=window.console;var f=function(e,k,i){if(k&&typeof(k)=="function"){k.call(e,i)}else{e.log(i)}};switch(c){case Dygraph.DEBUG:f(a,a.debug,"dygraphs: "+g);break;case Dygraph.INFO:f(a,a.info,"dygraphs: "+g);break;case Dygraph.WARNING:f(a,a.warn,"dygraphs: "+g);break;case Dygraph.ERROR:f(a,a.error,"dygraphs: "+g);break}}if(Dygraph.LOG_STACK_TRACES){window.console.log(b.join("\n"))}};Dygraph.info=function(a){Dygraph.log(Dygraph.INFO,a)};Dygraph.prototype.info=Dygraph.info;Dygraph.warn=function(a){Dygraph.log(Dygraph.WARNING,a)};Dygraph.prototype.warn=Dygraph.warn;Dygraph.error=function(a){Dygraph.log(Dygraph.ERROR,a)};Dygraph.prototype.error=Dygraph.error;Dygraph.getContext=function(a){return(a.getContext("2d"))};Dygraph.addEvent=function addEvent(c,b,a){if(c.addEventListener){c.addEventListener(b,a,false)}else{c[b+a]=function(){a(window.event)};c.attachEvent("on"+b,c[b+a])}};Dygraph.prototype.addAndTrackEvent=function(c,b,a){Dygraph.addEvent(c,b,a);this.registeredEvents_.push({elem:c,type:b,fn:a})};Dygraph.removeEvent=function(c,b,a){if(c.removeEventListener){c.removeEventListener(b,a,false)}else{try{c.detachEvent("on"+b,c[b+a])}catch(d){}c[b+a]=null}};Dygraph.prototype.removeTrackedEvents_=function(){if(this.registeredEvents_){for(var a=0;a<this.registeredEvents_.length;a++){var b=this.registeredEvents_[a];Dygraph.removeEvent(b.elem,b.type,b.fn)}}this.registeredEvents_=[]};Dygraph.cancelEvent=function(a){a=a?a:window.event;if(a.stopPropagation){a.stopPropagation()}if(a.preventDefault){a.preventDefault()}a.cancelBubble=true;a.cancel=true;a.returnValue=false;return false};Dygraph.hsvToRGB=function(h,g,k){var c;var d;var l;if(g===0){c=k;d=k;l=k}else{var e=Math.floor(h*6);var j=(h*6)-e;var b=k*(1-g);var a=k*(1-(g*j));var m=k*(1-(g*(1-j)));switch(e){case 1:c=a;d=k;l=b;break;case 2:c=b;d=k;l=m;break;case 3:c=b;d=a;l=k;break;case 4:c=m;d=b;l=k;break;case 5:c=k;d=b;l=a;break;case 6:case 0:c=k;d=m;l=b;break}}c=Math.floor(255*c+0.5);d=Math.floor(255*d+0.5);l=Math.floor(255*l+0.5);return"rgb("+c+","+d+","+l+")"};Dygraph.findPosX=function(c){var d=0;if(c.offsetParent){var a=c;while(1){var b="0";if(window.getComputedStyle){b=window.getComputedStyle(a,null).borderLeft||"0"}d+=parseInt(b,10);d+=a.offsetLeft;if(!a.offsetParent){break}a=a.offsetParent}}else{if(c.x){d+=c.x}}while(c&&c!=document.body){d-=c.scrollLeft;c=c.parentNode}return d};Dygraph.findPosY=function(c){var b=0;if(c.offsetParent){var a=c;while(1){var d="0";if(window.getComputedStyle){d=window.getComputedStyle(a,null).borderTop||"0"}b+=parseInt(d,10);b+=a.offsetTop;if(!a.offsetParent){break}a=a.offsetParent}}else{if(c.y){b+=c.y}}while(c&&c!=document.body){b-=c.scrollTop;c=c.parentNode}return b};Dygraph.pageX=function(c){if(c.pageX){return(!c.pageX||c.pageX<0)?0:c.pageX}else{var d=document.documentElement;var a=document.body;return c.clientX+(d.scrollLeft||a.scrollLeft)-(d.clientLeft||0)}};Dygraph.pageY=function(c){if(c.pageY){return(!c.pageY||c.pageY<0)?0:c.pageY}else{var d=document.documentElement;var a=document.body;return c.clientY+(d.scrollTop||a.scrollTop)-(d.clientTop||0)}};Dygraph.isOK=function(a){return !!a&&!isNaN(a)};Dygraph.isValidPoint=function(b,a){if(!b){return false}if(b.yval===null){return false}if(b.x===null||b.x===undefined){return false}if(b.y===null||b.y===undefined){return false}if(isNaN(b.x)||(!a&&isNaN(b.y))){return false}return true};Dygraph.floatFormat=function(a,b){var c=Math.min(Math.max(1,b||2),21);return(Math.abs(a)<0.001&&a!==0)?a.toExponential(c-1):a.toPrecision(c)};Dygraph.zeropad=function(a){if(a<10){return"0"+a}else{return""+a}};Dygraph.hmsString_=function(a){var c=Dygraph.zeropad;var b=new Date(a);if(b.getSeconds()){return c(b.getHours())+":"+c(b.getMinutes())+":"+c(b.getSeconds())}else{return c(b.getHours())+":"+c(b.getMinutes())}};Dygraph.round_=function(c,b){var a=Math.pow(10,b);return Math.round(c*a)/a};Dygraph.binarySearch=function(a,d,i,e,b){if(e===null||e===undefined||b===null||b===undefined){e=0;b=d.length-1}if(e>b){return -1}if(i===null||i===undefined){i=0}var h=function(j){return j>=0&&j<d.length};var g=parseInt((e+b)/2,10);var c=d[g];var f;if(c==a){return g}else{if(c>a){if(i>0){f=g-1;if(h(f)&&d[f]<a){return g}}return Dygraph.binarySearch(a,d,i,e,g-1)}else{if(c<a){if(i<0){f=g+1;if(h(f)&&d[f]>a){return g}}return Dygraph.binarySearch(a,d,i,g+1,b)}}}return -1};Dygraph.dateParser=function(a){var b;var c;if(a.search("-")==-1||a.search("T")!=-1||a.search("Z")!=-1){c=Dygraph.dateStrToMillis(a);if(c&&!isNaN(c)){return c}}if(a.search("-")!=-1){b=a.replace("-","/","g");while(b.search("-")!=-1){b=b.replace("-","/")}c=Dygraph.dateStrToMillis(b)}else{if(a.length==8){b=a.substr(0,4)+"/"+a.substr(4,2)+"/"+a.substr(6,2);c=Dygraph.dateStrToMillis(b)}else{c=Dygraph.dateStrToMillis(a)}}if(!c||isNaN(c)){Dygraph.error("Couldn't parse "+a+" as a date")}return c};Dygraph.dateStrToMillis=function(a){return new Date(a).getTime()};Dygraph.update=function(b,c){if(typeof(c)!="undefined"&&c!==null){for(var a in c){if(c.hasOwnProperty(a)){b[a]=c[a]}}}return b};Dygraph.updateDeep=function(b,d){function c(e){return(typeof Node==="object"?e instanceof Node:typeof e==="object"&&typeof e.nodeType==="number"&&typeof e.nodeName==="string")}if(typeof(d)!="undefined"&&d!==null){for(var a in d){if(d.hasOwnProperty(a)){if(d[a]===null){b[a]=null}else{if(Dygraph.isArrayLike(d[a])){b[a]=d[a].slice()}else{if(c(d[a])){b[a]=d[a]}else{if(typeof(d[a])=="object"){if(typeof(b[a])!="object"||b[a]===null){b[a]={}}Dygraph.updateDeep(b[a],d[a])}else{b[a]=d[a]}}}}}}}return b};Dygraph.isArrayLike=function(b){var a=typeof(b);if((a!="object"&&!(a=="function"&&typeof(b.item)=="function"))||b===null||typeof(b.length)!="number"||b.nodeType===3){return false}return true};Dygraph.isDateLike=function(a){if(typeof(a)!="object"||a===null||typeof(a.getTime)!="function"){return false}return true};Dygraph.clone=function(c){var b=[];for(var a=0;a<c.length;a++){if(Dygraph.isArrayLike(c[a])){b.push(Dygraph.clone(c[a]))}else{b.push(c[a])}}return b};Dygraph.createCanvas=function(){var a=document.createElement("canvas");var b=(/MSIE/.test(navigator.userAgent)&&!window.opera);if(b&&(typeof(G_vmlCanvasManager)!="undefined")){a=G_vmlCanvasManager.initElement((a))}return a};Dygraph.isAndroid=function(){return(/Android/).test(navigator.userAgent)};Dygraph.Iterator=function(d,c,b,a){c=c||0;b=b||d.length;this.hasNext=true;this.peek=null;this.start_=c;this.array_=d;this.predicate_=a;this.end_=Math.min(d.length,c+b);this.nextIdx_=c-1;this.next()};Dygraph.Iterator.prototype.next=function(){if(!this.hasNext){return null}var c=this.peek;var b=this.nextIdx_+1;var a=false;while(b<this.end_){if(!this.predicate_||this.predicate_(this.array_,b)){this.peek=this.array_[b];a=true;break}b++}this.nextIdx_=b;if(!a){this.hasNext=false;this.peek=null}return c};Dygraph.createIterator=function(d,c,b,a){return new Dygraph.Iterator(d,c,b,a)};Dygraph.requestAnimFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1000/60)}})();Dygraph.repeatAndCleanup=function(h,g,f,a){var i=0;var d;var b=new Date().getTime();h(i);if(g==1){a();return}var e=g-1;(function c(){if(i>=g){return}Dygraph.requestAnimFrame.call(window,function(){var l=new Date().getTime();var j=l-b;d=i;i=Math.floor(j/f);var k=i-d;var m=(i+k)>e;if(m||(i>=e)){h(e);a()}else{if(k!==0){h(i)}c()}})})()};Dygraph.isPixelChangingOptionList=function(h,e){var d={annotationClickHandler:true,annotationDblClickHandler:true,annotationMouseOutHandler:true,annotationMouseOverHandler:true,axisLabelColor:true,axisLineColor:true,axisLineWidth:true,clickCallback:true,digitsAfterDecimal:true,drawCallback:true,drawHighlightPointCallback:true,drawPoints:true,drawPointCallback:true,drawXGrid:true,drawYGrid:true,fillAlpha:true,gridLineColor:true,gridLineWidth:true,hideOverlayOnMouseOut:true,highlightCallback:true,highlightCircleSize:true,interactionModel:true,isZoomedIgnoreProgrammaticZoom:true,labelsDiv:true,labelsDivStyles:true,labelsDivWidth:true,labelsKMB:true,labelsKMG2:true,labelsSeparateLines:true,labelsShowZeroValues:true,legend:true,maxNumberWidth:true,panEdgeFraction:true,pixelsPerYLabel:true,pointClickCallback:true,pointSize:true,rangeSelectorPlotFillColor:true,rangeSelectorPlotStrokeColor:true,showLabelsOnHighlight:true,showRoller:true,sigFigs:true,strokeWidth:true,underlayCallback:true,unhighlightCallback:true,xAxisLabelFormatter:true,xTicker:true,xValueFormatter:true,yAxisLabelFormatter:true,yValueFormatter:true,zoomCallback:true};var a=false;var b={};if(h){for(var f=1;f<h.length;f++){b[h[f]]=true}}for(var g in e){if(a){break}if(e.hasOwnProperty(g)){if(b[g]){for(var c in e[g]){if(a){break}if(e[g].hasOwnProperty(c)&&!d[c]){a=true}}}else{if(!d[g]){a=true}}}}return a};Dygraph.compareArrays=function(c,b){if(!Dygraph.isArrayLike(c)||!Dygraph.isArrayLike(b)){return false}if(c.length!==b.length){return false}for(var a=0;a<c.length;a++){if(c[a]!==b[a]){return false}}return true};Dygraph.regularShape_=function(o,c,i,f,e,a,n){a=a||0;n=n||Math.PI*2/c;o.beginPath();var g=a;var d=g;var h=function(){var p=f+(Math.sin(d)*i);var q=e+(-Math.cos(d)*i);return[p,q]};var b=h();var l=b[0];var j=b[1];o.moveTo(l,j);for(var m=0;m<c;m++){d=(m==c-1)?g:(d+n);var k=h();o.lineTo(k[0],k[1])}o.fill();o.stroke()};Dygraph.shapeFunction_=function(b,a,c){return function(j,i,f,e,k,h,d){f.strokeStyle=h;f.fillStyle="white";Dygraph.regularShape_(f,b,d,e,k,a,c)}};Dygraph.Circles={DEFAULT:function(h,f,b,e,d,c,a){b.beginPath();b.fillStyle=c;b.arc(e,d,a,0,2*Math.PI,false);b.fill()},TRIANGLE:Dygraph.shapeFunction_(3),SQUARE:Dygraph.shapeFunction_(4,Math.PI/4),DIAMOND:Dygraph.shapeFunction_(4),PENTAGON:Dygraph.shapeFunction_(5),HEXAGON:Dygraph.shapeFunction_(6),CIRCLE:function(f,e,c,b,h,d,a){c.beginPath();c.strokeStyle=d;c.fillStyle="white";c.arc(b,h,a,0,2*Math.PI,false);c.fill();c.stroke()},STAR:Dygraph.shapeFunction_(5,0,4*Math.PI/5),PLUS:function(f,e,c,b,h,d,a){c.strokeStyle=d;c.beginPath();c.moveTo(b+a,h);c.lineTo(b-a,h);c.closePath();c.stroke();c.beginPath();c.moveTo(b,h+a);c.lineTo(b,h-a);c.closePath();c.stroke()},EX:function(f,e,c,b,h,d,a){c.strokeStyle=d;c.beginPath();c.moveTo(b+a,h+a);c.lineTo(b-a,h-a);c.closePath();c.stroke();c.beginPath();c.moveTo(b+a,h-a);c.lineTo(b-a,h+a);c.closePath();c.stroke()}};Dygraph.IFrameTarp=function(){this.tarps=[]};Dygraph.IFrameTarp.prototype.cover=function(){var f=document.getElementsByTagName("iframe");for(var c=0;c<f.length;c++){var e=f[c];var b=Dygraph.findPosX(e),h=Dygraph.findPosY(e),d=e.offsetWidth,a=e.offsetHeight;var g=document.createElement("div");g.style.position="absolute";g.style.left=b+"px";g.style.top=h+"px";g.style.width=d+"px";g.style.height=a+"px";g.style.zIndex=999;document.body.appendChild(g);this.tarps.push(g)}};Dygraph.IFrameTarp.prototype.uncover=function(){for(var a=0;a<this.tarps.length;a++){this.tarps[a].parentNode.removeChild(this.tarps[a])}this.tarps=[]};Dygraph.detectLineDelimiter=function(c){for(var a=0;a<c.length;a++){var b=c.charAt(a);if(b==="\r"){if(((a+1)<c.length)&&(c.charAt(a+1)==="\n")){return"\r\n"}return b}if(b==="\n"){if(((a+1)<c.length)&&(c.charAt(a+1)==="\r")){return"\n\r"}return b}}return null};Dygraph.isNodeContainedBy=function(b,a){if(a===null||b===null){return false}var c=(b);while(c&&c!==a){c=c.parentNode}return(c===a)};Dygraph.pow=function(a,b){if(b<0){return 1/Math.pow(a,-b)}return Math.pow(a,b)};Dygraph.dateSetters={ms:Date.prototype.setMilliseconds,s:Date.prototype.setSeconds,m:Date.prototype.setMinutes,h:Date.prototype.setHours};Dygraph.setDateSameTZ=function(c,b){var f=c.getTimezoneOffset();for(var a in b){if(!b.hasOwnProperty(a)){continue}var e=Dygraph.dateSetters[a];if(!e){throw"Invalid setter: "+a}e.call(c,b[a]);if(c.getTimezoneOffset()!=f){c.setTime(c.getTime()+(f-c.getTimezoneOffset())*60*1000)}}};"use strict";Dygraph.GVizChart=function(a){this.container=a};Dygraph.GVizChart.prototype.draw=function(b,a){this.container.innerHTML="";if(typeof(this.date_graph)!="undefined"){this.date_graph.destroy()}this.date_graph=new Dygraph(this.container,b,a)};Dygraph.GVizChart.prototype.setSelection=function(b){var a=false;if(b.length){a=b[0].row}this.date_graph.setSelection(a)};Dygraph.GVizChart.prototype.getSelection=function(){var b=[];var d=this.date_graph.getSelection();if(d<0){return b}var a=this.date_graph.layout_.points;for(var c=0;c<a.length;++c){b.push({row:d,column:c+1})}return b};"use strict";Dygraph.Interaction={};Dygraph.Interaction.startPan=function(o,t,c){var r,b;c.isPanning=true;var k=t.xAxisRange();c.dateRange=k[1]-k[0];c.initialLeftmostDate=k[0];c.xUnitsPerPixel=c.dateRange/(t.plotter_.area.w-1);if(t.attr_("panEdgeFraction")){var x=t.width_*t.attr_("panEdgeFraction");var d=t.xAxisExtremes();var j=t.toDomXCoord(d[0])-x;var l=t.toDomXCoord(d[1])+x;var u=t.toDataXCoord(j);var w=t.toDataXCoord(l);c.boundedDates=[u,w];var f=[];var a=t.height_*t.attr_("panEdgeFraction");for(r=0;r<t.axes_.length;r++){b=t.axes_[r];var p=b.extremeRange;var q=t.toDomYCoord(p[0],r)+a;var s=t.toDomYCoord(p[1],r)-a;var n=t.toDataYCoord(q,r);var e=t.toDataYCoord(s,r);f[r]=[n,e]}c.boundedValues=f}c.is2DPan=false;c.axes=[];for(r=0;r<t.axes_.length;r++){b=t.axes_[r];var h={};var m=t.yAxisRange(r);var v=t.attributes_.getForAxis("logscale",r);if(v){h.initialTopValue=Dygraph.log10(m[1]);h.dragValueRange=Dygraph.log10(m[1])-Dygraph.log10(m[0])}else{h.initialTopValue=m[1];h.dragValueRange=m[1]-m[0]}h.unitsPerPixel=h.dragValueRange/(t.plotter_.area.h-1);c.axes.push(h);if(b.valueWindow||b.valueRange){c.is2DPan=true}}};Dygraph.Interaction.movePan=function(b,k,c){c.dragEndX=k.dragGetX_(b,c);c.dragEndY=k.dragGetY_(b,c);var h=c.initialLeftmostDate-(c.dragEndX-c.dragStartX)*c.xUnitsPerPixel;if(c.boundedDates){h=Math.max(h,c.boundedDates[0])}var a=h+c.dateRange;if(c.boundedDates){if(a>c.boundedDates[1]){h=h-(a-c.boundedDates[1]);a=h+c.dateRange}}k.dateWindow_=[h,a];if(c.is2DPan){var d=c.dragEndY-c.dragStartY;for(var j=0;j<k.axes_.length;j++){var e=k.axes_[j];var o=c.axes[j];var p=d*o.unitsPerPixel;var f=c.boundedValues?c.boundedValues[j]:null;var l=o.initialTopValue+p;if(f){l=Math.min(l,f[1])}var n=l-o.dragValueRange;if(f){if(n<f[0]){l=l-(n-f[0]);n=l-o.dragValueRange}}var m=k.attributes_.getForAxis("logscale",j);if(m){e.valueWindow=[Math.pow(Dygraph.LOG_SCALE,n),Math.pow(Dygraph.LOG_SCALE,l)]}else{e.valueWindow=[n,l]}}}k.drawGraph_(false)};Dygraph.Interaction.endPan=function(c,b,a){a.dragEndX=b.dragGetX_(c,a);a.dragEndY=b.dragGetY_(c,a);var e=Math.abs(a.dragEndX-a.dragStartX);var d=Math.abs(a.dragEndY-a.dragStartY);if(e<2&&d<2&&b.lastx_!==undefined&&b.lastx_!=-1){Dygraph.Interaction.treatMouseOpAsClick(b,c,a)}a.isPanning=false;a.is2DPan=false;a.initialLeftmostDate=null;a.dateRange=null;a.valueRange=null;a.boundedDates=null;a.boundedValues=null;a.axes=null};Dygraph.Interaction.startZoom=function(c,b,a){a.isZooming=true;a.zoomMoved=false};Dygraph.Interaction.moveZoom=function(c,b,a){a.zoomMoved=true;a.dragEndX=b.dragGetX_(c,a);a.dragEndY=b.dragGetY_(c,a);var e=Math.abs(a.dragStartX-a.dragEndX);var d=Math.abs(a.dragStartY-a.dragEndY);a.dragDirection=(e<d/2)?Dygraph.VERTICAL:Dygraph.HORIZONTAL;b.drawZoomRect_(a.dragDirection,a.dragStartX,a.dragEndX,a.dragStartY,a.dragEndY,a.prevDragDirection,a.prevEndX,a.prevEndY);a.prevEndX=a.dragEndX;a.prevEndY=a.dragEndY;a.prevDragDirection=a.dragDirection};Dygraph.Interaction.treatMouseOpAsClick=function(f,b,d){var k=f.attr_("clickCallback");var n=f.attr_("pointClickCallback");var j=null;if(n){var l=-1;var m=Number.MAX_VALUE;for(var e=0;e<f.selPoints_.length;e++){var c=f.selPoints_[e];var a=Math.pow(c.canvasx-d.dragEndX,2)+Math.pow(c.canvasy-d.dragEndY,2);if(!isNaN(a)&&(l==-1||a<m)){m=a;l=e}}var h=f.attr_("highlightCircleSize")+2;if(m<=h*h){j=f.selPoints_[l]}}if(j){n(b,j)}if(k){k(b,f.lastx_,f.selPoints_)}};Dygraph.Interaction.endZoom=function(c,i,e){e.isZooming=false;e.dragEndX=i.dragGetX_(c,e);e.dragEndY=i.dragGetY_(c,e);var h=Math.abs(e.dragEndX-e.dragStartX);var d=Math.abs(e.dragEndY-e.dragStartY);if(h<2&&d<2&&i.lastx_!==undefined&&i.lastx_!=-1){Dygraph.Interaction.treatMouseOpAsClick(i,c,e)}var b=i.getArea();if(h>=10&&e.dragDirection==Dygraph.HORIZONTAL){var f=Math.min(e.dragStartX,e.dragEndX),k=Math.max(e.dragStartX,e.dragEndX);f=Math.max(f,b.x);k=Math.min(k,b.x+b.w);if(f<k){i.doZoomX_(f,k)}e.cancelNextDblclick=true}else{if(d>=10&&e.dragDirection==Dygraph.VERTICAL){var j=Math.min(e.dragStartY,e.dragEndY),a=Math.max(e.dragStartY,e.dragEndY);j=Math.max(j,b.y);a=Math.min(a,b.y+b.h);if(j<a){i.doZoomY_(j,a)}e.cancelNextDblclick=true}else{if(e.zoomMoved){i.clearZoomRect_()}}}e.dragStartX=null;e.dragStartY=null};Dygraph.Interaction.startTouch=function(f,e,d){f.preventDefault();if(f.touches.length>1){d.startTimeForDoubleTapMs=null}var h=[];for(var c=0;c<f.touches.length;c++){var b=f.touches[c];h.push({pageX:b.pageX,pageY:b.pageY,dataX:e.toDataXCoord(b.pageX),dataY:e.toDataYCoord(b.pageY)})}d.initialTouches=h;if(h.length==1){d.initialPinchCenter=h[0];d.touchDirections={x:true,y:true}}else{if(h.length>=2){d.initialPinchCenter={pageX:0.5*(h[0].pageX+h[1].pageX),pageY:0.5*(h[0].pageY+h[1].pageY),dataX:0.5*(h[0].dataX+h[1].dataX),dataY:0.5*(h[0].dataY+h[1].dataY)};var a=180/Math.PI*Math.atan2(d.initialPinchCenter.pageY-h[0].pageY,h[0].pageX-d.initialPinchCenter.pageX);a=Math.abs(a);if(a>90){a=90-a}d.touchDirections={x:(a<(90-45/2)),y:(a>45/2)}}}d.initialRange={x:e.xAxisRange(),y:e.yAxisRange()}};Dygraph.Interaction.moveTouch=function(n,q,d){d.startTimeForDoubleTapMs=null;var p,l=[];for(p=0;p<n.touches.length;p++){var k=n.touches[p];l.push({pageX:k.pageX,pageY:k.pageY})}var a=d.initialTouches;var h;var j=d.initialPinchCenter;if(l.length==1){h=l[0]}else{h={pageX:0.5*(l[0].pageX+l[1].pageX),pageY:0.5*(l[0].pageY+l[1].pageY)}}var m={pageX:h.pageX-j.pageX,pageY:h.pageY-j.pageY};var f=d.initialRange.x[1]-d.initialRange.x[0];var o=d.initialRange.y[0]-d.initialRange.y[1];m.dataX=(m.pageX/q.plotter_.area.w)*f;m.dataY=(m.pageY/q.plotter_.area.h)*o;var w,c;if(l.length==1){w=1;c=1}else{if(l.length>=2){var e=(a[1].pageX-j.pageX);w=(l[1].pageX-h.pageX)/e;var v=(a[1].pageY-j.pageY);c=(l[1].pageY-h.pageY)/v}}w=Math.min(8,Math.max(0.125,w));c=Math.min(8,Math.max(0.125,c));var u=false;if(d.touchDirections.x){q.dateWindow_=[j.dataX-m.dataX+(d.initialRange.x[0]-j.dataX)/w,j.dataX-m.dataX+(d.initialRange.x[1]-j.dataX)/w];u=true}if(d.touchDirections.y){for(p=0;p<1;p++){var b=q.axes_[p];var s=q.attributes_.getForAxis("logscale",p);if(s){}else{b.valueWindow=[j.dataY-m.dataY+(d.initialRange.y[0]-j.dataY)/c,j.dataY-m.dataY+(d.initialRange.y[1]-j.dataY)/c];u=true}}}q.drawGraph_(false);if(u&&l.length>1&&q.attr_("zoomCallback")){var r=q.xAxisRange();q.attr_("zoomCallback")(r[0],r[1],q.yAxisRanges())}};Dygraph.Interaction.endTouch=function(e,d,c){if(e.touches.length!==0){Dygraph.Interaction.startTouch(e,d,c)}else{if(e.changedTouches.length==1){var a=new Date().getTime();var b=e.changedTouches[0];if(c.startTimeForDoubleTapMs&&a-c.startTimeForDoubleTapMs<500&&c.doubleTapX&&Math.abs(c.doubleTapX-b.screenX)<50&&c.doubleTapY&&Math.abs(c.doubleTapY-b.screenY)<50){d.resetZoom()}else{c.startTimeForDoubleTapMs=a;c.doubleTapX=b.screenX;c.doubleTapY=b.screenY}}}};Dygraph.Interaction.defaultModel={mousedown:function(c,b,a){if(c.button&&c.button==2){return}a.initializeMouseDown(c,b,a);if(c.altKey||c.shiftKey){Dygraph.startPan(c,b,a)}else{Dygraph.startZoom(c,b,a)}},mousemove:function(c,b,a){if(a.isZooming){Dygraph.moveZoom(c,b,a)}else{if(a.isPanning){Dygraph.movePan(c,b,a)}}},mouseup:function(c,b,a){if(a.isZooming){Dygraph.endZoom(c,b,a)}else{if(a.isPanning){Dygraph.endPan(c,b,a)}}},touchstart:function(c,b,a){Dygraph.Interaction.startTouch(c,b,a)},touchmove:function(c,b,a){Dygraph.Interaction.moveTouch(c,b,a)},touchend:function(c,b,a){Dygraph.Interaction.endTouch(c,b,a)},mouseout:function(c,b,a){if(a.isZooming){a.dragEndX=null;a.dragEndY=null;b.clearZoomRect_()}},dblclick:function(c,b,a){if(a.cancelNextDblclick){a.cancelNextDblclick=false;return}if(c.altKey||c.shiftKey){return}b.resetZoom()}};Dygraph.DEFAULT_ATTRS.interactionModel=Dygraph.Interaction.defaultModel;Dygraph.defaultInteractionModel=Dygraph.Interaction.defaultModel;Dygraph.endZoom=Dygraph.Interaction.endZoom;Dygraph.moveZoom=Dygraph.Interaction.moveZoom;Dygraph.startZoom=Dygraph.Interaction.startZoom;Dygraph.endPan=Dygraph.Interaction.endPan;Dygraph.movePan=Dygraph.Interaction.movePan;Dygraph.startPan=Dygraph.Interaction.startPan;Dygraph.Interaction.nonInteractiveModel_={mousedown:function(c,b,a){a.initializeMouseDown(c,b,a)},mouseup:function(c,b,a){a.dragEndX=b.dragGetX_(c,a);a.dragEndY=b.dragGetY_(c,a);var e=Math.abs(a.dragEndX-a.dragStartX);var d=Math.abs(a.dragEndY-a.dragStartY);if(e<2&&d<2&&b.lastx_!==undefined&&b.lastx_!=-1){Dygraph.Interaction.treatMouseOpAsClick(b,c,a)}}};Dygraph.Interaction.dragIsPanInteractionModel={mousedown:function(c,b,a){a.initializeMouseDown(c,b,a);Dygraph.startPan(c,b,a)},mousemove:function(c,b,a){if(a.isPanning){Dygraph.movePan(c,b,a)}},mouseup:function(c,b,a){if(a.isPanning){Dygraph.endPan(c,b,a)}}};"use strict";Dygraph.TickList=undefined;Dygraph.Ticker=undefined;Dygraph.numericLinearTicks=function(d,c,i,g,f,h){var e=function(a){if(a==="logscale"){return false}return g(a)};return Dygraph.numericTicks(d,c,i,e,f,h)};Dygraph.numericTicks=function(F,E,u,p,d,q){var z=(p("pixelsPerLabel"));var G=[];var C,A,t,y;if(q){for(C=0;C<q.length;C++){G.push({v:q[C]})}}else{if(p("logscale")){y=Math.floor(u/z);var l=Dygraph.binarySearch(F,Dygraph.PREFERRED_LOG_TICK_VALUES,1);var H=Dygraph.binarySearch(E,Dygraph.PREFERRED_LOG_TICK_VALUES,-1);if(l==-1){l=0}if(H==-1){H=Dygraph.PREFERRED_LOG_TICK_VALUES.length-1}var s=null;if(H-l>=y/4){for(var r=H;r>=l;r--){var m=Dygraph.PREFERRED_LOG_TICK_VALUES[r];var k=Math.log(m/F)/Math.log(E/F)*u;var D={v:m};if(s===null){s={tickValue:m,pixel_coord:k}}else{if(Math.abs(k-s.pixel_coord)>=z){s={tickValue:m,pixel_coord:k}}else{D.label=""}}G.push(D)}G.reverse()}}if(G.length===0){var g=p("labelsKMG2");var n,h;if(g){n=[1,2,4,8,16,32,64,128,256];h=16}else{n=[1,2,5,10,20,50,100];h=10}var w=Math.ceil(u/z);var o=Math.abs(E-F)/w;var v=Math.floor(Math.log(o)/Math.log(h));var f=Math.pow(h,v);var I,x,c,e;for(A=0;A<n.length;A++){I=f*n[A];x=Math.floor(F/I)*I;c=Math.ceil(E/I)*I;y=Math.abs(c-x)/I;e=u/y;if(e>z){break}}if(x>c){I*=-1}for(C=0;C<y;C++){t=x+C*I;G.push({v:t})}}}var B=(p("axisLabelFormatter"));for(C=0;C<G.length;C++){if(G[C].label!==undefined){continue}G[C].label=B(G[C].v,0,p,d)}return G};Dygraph.dateTicker=function(e,c,i,g,f,h){var d=Dygraph.pickDateTickGranularity(e,c,i,g);if(d>=0){return Dygraph.getDateAxis(e,c,d,g,f)}else{return[]}};Dygraph.SECONDLY=0;Dygraph.TWO_SECONDLY=1;Dygraph.FIVE_SECONDLY=2;Dygraph.TEN_SECONDLY=3;Dygraph.THIRTY_SECONDLY=4;Dygraph.MINUTELY=5;Dygraph.TWO_MINUTELY=6;Dygraph.FIVE_MINUTELY=7;Dygraph.TEN_MINUTELY=8;Dygraph.THIRTY_MINUTELY=9;Dygraph.HOURLY=10;Dygraph.TWO_HOURLY=11;Dygraph.SIX_HOURLY=12;Dygraph.DAILY=13;Dygraph.WEEKLY=14;Dygraph.MONTHLY=15;Dygraph.QUARTERLY=16;Dygraph.BIANNUAL=17;Dygraph.ANNUAL=18;Dygraph.DECADAL=19;Dygraph.CENTENNIAL=20;Dygraph.NUM_GRANULARITIES=21;Dygraph.SHORT_SPACINGS=[];Dygraph.SHORT_SPACINGS[Dygraph.SECONDLY]=1000*1;Dygraph.SHORT_SPACINGS[Dygraph.TWO_SECONDLY]=1000*2;Dygraph.SHORT_SPACINGS[Dygraph.FIVE_SECONDLY]=1000*5;Dygraph.SHORT_SPACINGS[Dygraph.TEN_SECONDLY]=1000*10;Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_SECONDLY]=1000*30;Dygraph.SHORT_SPACINGS[Dygraph.MINUTELY]=1000*60;Dygraph.SHORT_SPACINGS[Dygraph.TWO_MINUTELY]=1000*60*2;Dygraph.SHORT_SPACINGS[Dygraph.FIVE_MINUTELY]=1000*60*5;Dygraph.SHORT_SPACINGS[Dygraph.TEN_MINUTELY]=1000*60*10;Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_MINUTELY]=1000*60*30;Dygraph.SHORT_SPACINGS[Dygraph.HOURLY]=1000*3600;Dygraph.SHORT_SPACINGS[Dygraph.TWO_HOURLY]=1000*3600*2;Dygraph.SHORT_SPACINGS[Dygraph.SIX_HOURLY]=1000*3600*6;Dygraph.SHORT_SPACINGS[Dygraph.DAILY]=1000*86400;Dygraph.SHORT_SPACINGS[Dygraph.WEEKLY]=1000*604800;Dygraph.LONG_TICK_PLACEMENTS=[];Dygraph.LONG_TICK_PLACEMENTS[Dygraph.MONTHLY]={months:[0,1,2,3,4,5,6,7,8,9,10,11],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.QUARTERLY]={months:[0,3,6,9],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.BIANNUAL]={months:[0,6],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.ANNUAL]={months:[0],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.DECADAL]={months:[0],year_mod:10};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.CENTENNIAL]={months:[0],year_mod:100};Dygraph.PREFERRED_LOG_TICK_VALUES=function(){var c=[];for(var b=-39;b<=39;b++){var a=Math.pow(10,b);for(var d=1;d<=9;d++){var e=a*d;c.push(e)}}return c}();Dygraph.pickDateTickGranularity=function(d,c,j,h){var g=(h("pixelsPerLabel"));for(var f=0;f<Dygraph.NUM_GRANULARITIES;f++){var e=Dygraph.numDateTicks(d,c,f);if(j/e>=g){return f}}return -1};Dygraph.numDateTicks=function(e,b,f){if(f<Dygraph.MONTHLY){var g=Dygraph.SHORT_SPACINGS[f];return Math.floor(0.5+1*(b-e)/g)}else{var d=Dygraph.LONG_TICK_PLACEMENTS[f];var c=365.2524*24*3600*1000;var a=1*(b-e)/c;return Math.floor(0.5+1*a*d.months.length/d.year_mod)}};Dygraph.getDateAxis=function(p,l,a,n,z){var w=(n("axisLabelFormatter"));var C=[];var m;if(a<Dygraph.MONTHLY){var c=Dygraph.SHORT_SPACINGS[a];var y=c/1000;var A=new Date(p);Dygraph.setDateSameTZ(A,{ms:0});var h;if(y<=60){h=A.getSeconds();Dygraph.setDateSameTZ(A,{s:h-h%y})}else{Dygraph.setDateSameTZ(A,{s:0});y/=60;if(y<=60){h=A.getMinutes();Dygraph.setDateSameTZ(A,{m:h-h%y})}else{Dygraph.setDateSameTZ(A,{m:0});y/=60;if(y<=24){h=A.getHours();A.setHours(h-h%y)}else{A.setHours(0);y/=24;if(y==7){A.setDate(A.getDate()-A.getDay())}}}}p=A.getTime();var B=new Date(p).getTimezoneOffset();var e=(c>=Dygraph.SHORT_SPACINGS[Dygraph.TWO_HOURLY]);for(m=p;m<=l;m+=c){A=new Date(m);if(e&&A.getTimezoneOffset()!=B){var k=A.getTimezoneOffset()-B;m+=k*60*1000;A=new Date(m);B=A.getTimezoneOffset();if(new Date(m+c).getTimezoneOffset()!=B){m+=c;A=new Date(m);B=A.getTimezoneOffset()}}C.push({v:m,label:w(A,a,n,z)})}}else{var f;var r=1;if(a<Dygraph.NUM_GRANULARITIES){f=Dygraph.LONG_TICK_PLACEMENTS[a].months;r=Dygraph.LONG_TICK_PLACEMENTS[a].year_mod}else{Dygraph.warn("Span of dates is too long")}var v=new Date(p).getFullYear();var q=new Date(l).getFullYear();var b=Dygraph.zeropad;for(var u=v;u<=q;u++){if(u%r!==0){continue}for(var s=0;s<f.length;s++){var o=u+"/"+b(1+f[s])+"/01";m=Dygraph.dateStrToMillis(o);if(m<p||m>l){continue}C.push({v:m,label:w(new Date(m),a,n,z)})}}}return C};if(Dygraph&&Dygraph.DEFAULT_ATTRS&&Dygraph.DEFAULT_ATTRS.axes&&Dygraph.DEFAULT_ATTRS.axes["x"]&&Dygraph.DEFAULT_ATTRS.axes["y"]&&Dygraph.DEFAULT_ATTRS.axes["y2"]){Dygraph.DEFAULT_ATTRS.axes["x"]["ticker"]=Dygraph.dateTicker;Dygraph.DEFAULT_ATTRS.axes["y"]["ticker"]=Dygraph.numericTicks;Dygraph.DEFAULT_ATTRS.axes["y2"]["ticker"]=Dygraph.numericTicks}Dygraph.Plugins={};Dygraph.Plugins.Annotations=(function(){var a=function(){this.annotations_=[]};a.prototype.toString=function(){return"Annotations Plugin"};a.prototype.activate=function(b){return{clearChart:this.clearChart,didDrawChart:this.didDrawChart}};a.prototype.detachLabels=function(){for(var c=0;c<this.annotations_.length;c++){var b=this.annotations_[c];if(b.parentNode){b.parentNode.removeChild(b)}this.annotations_[c]=null}this.annotations_=[]};a.prototype.clearChart=function(b){this.detachLabels()};a.prototype.didDrawChart=function(v){var t=v.dygraph;var r=t.layout_.annotated_points;if(!r||r.length===0){return}var h=v.canvas.parentNode;var x={position:"absolute",fontSize:t.getOption("axisLabelFontSize")+"px",zIndex:10,overflow:"hidden"};var b=function(e,g,i){return function(y){var p=i.annotation;if(p.hasOwnProperty(e)){p[e](p,i,t,y)}else{if(t.getOption(g)){t.getOption(g)(p,i,t,y)}}}};var u=v.dygraph.plotter_.area;var q={};for(var s=0;s<r.length;s++){var l=r[s];if(l.canvasx<u.x||l.canvasx>u.x+u.w||l.canvasy<u.y||l.canvasy>u.y+u.h){continue}var w=l.annotation;var n=6;if(w.hasOwnProperty("tickHeight")){n=w.tickHeight}var j=document.createElement("div");for(var A in x){if(x.hasOwnProperty(A)){j.style[A]=x[A]}}if(!w.hasOwnProperty("icon")){j.className="dygraphDefaultAnnotation"}if(w.hasOwnProperty("cssClass")){j.className+=" "+w.cssClass}var m=w.hasOwnProperty("width")?w.width:16;var k=w.hasOwnProperty("height")?w.height:16;if(w.hasOwnProperty("icon")){var z=document.createElement("img");z.src=w.icon;z.width=m;z.height=k;j.appendChild(z)}else{if(l.annotation.hasOwnProperty("shortText")){j.appendChild(document.createTextNode(l.annotation.shortText))}}var c=l.canvasx-m/2;j.style.left=c+"px";var f=0;if(w.attachAtBottom){var d=(u.y+u.h-k-n);if(q[c]){d-=q[c]}else{q[c]=0}q[c]+=(n+k);f=d}else{f=l.canvasy-k-n}j.style.top=f+"px";j.style.width=m+"px";j.style.height=k+"px";j.title=l.annotation.text;j.style.color=t.colorsMap_[l.name];j.style.borderColor=t.colorsMap_[l.name];w.div=j;t.addAndTrackEvent(j,"click",b("clickHandler","annotationClickHandler",l,this));t.addAndTrackEvent(j,"mouseover",b("mouseOverHandler","annotationMouseOverHandler",l,this));t.addAndTrackEvent(j,"mouseout",b("mouseOutHandler","annotationMouseOutHandler",l,this));t.addAndTrackEvent(j,"dblclick",b("dblClickHandler","annotationDblClickHandler",l,this));h.appendChild(j);this.annotations_.push(j);var o=v.drawingContext;o.save();o.strokeStyle=t.colorsMap_[l.name];o.beginPath();if(!w.attachAtBottom){o.moveTo(l.canvasx,l.canvasy);o.lineTo(l.canvasx,l.canvasy-2-n)}else{var d=f+k;o.moveTo(l.canvasx,d);o.lineTo(l.canvasx,d+n)}o.closePath();o.stroke();o.restore()}};a.prototype.destroy=function(){this.detachLabels()};return a})();Dygraph.Plugins.Axes=(function(){var a=function(){this.xlabels_=[];this.ylabels_=[]};a.prototype.toString=function(){return"Axes Plugin"};a.prototype.activate=function(b){return{layout:this.layout,clearChart:this.clearChart,willDrawChart:this.willDrawChart}};a.prototype.layout=function(f){var d=f.dygraph;if(d.getOption("drawYAxis")){var b=d.getOption("yAxisLabelWidth")+2*d.getOption("axisTickSize");f.reserveSpaceLeft(b)}if(d.getOption("drawXAxis")){var c;if(d.getOption("xAxisHeight")){c=d.getOption("xAxisHeight")}else{c=d.getOptionForAxis("axisLabelFontSize","x")+2*d.getOption("axisTickSize")}f.reserveSpaceBottom(c)}if(d.numAxes()==2){if(d.getOption("drawYAxis")){var b=d.getOption("yAxisLabelWidth")+2*d.getOption("axisTickSize");f.reserveSpaceRight(b)}}else{if(d.numAxes()>2){d.error("Only two y-axes are supported at this time. (Trying to use "+d.numAxes()+")")}}};a.prototype.detachLabels=function(){function b(d){for(var c=0;c<d.length;c++){var e=d[c];if(e.parentNode){e.parentNode.removeChild(e)}}}b(this.xlabels_);b(this.ylabels_);this.xlabels_=[];this.ylabels_=[]};a.prototype.clearChart=function(b){this.detachLabels()};a.prototype.willDrawChart=function(H){var F=H.dygraph;if(!F.getOption("drawXAxis")&&!F.getOption("drawYAxis")){return}function B(e){return Math.round(e)+0.5}function A(e){return Math.round(e)-0.5}var j=H.drawingContext;var v=H.canvas.parentNode;var J=H.canvas.width;var d=H.canvas.height;var s,u,t,E,D;var C=function(e){return{position:"absolute",fontSize:F.getOptionForAxis("axisLabelFontSize",e)+"px",zIndex:10,color:F.getOptionForAxis("axisLabelColor",e),width:F.getOption("axisLabelWidth")+"px",lineHeight:"normal",overflow:"hidden"}};var p={x:C("x"),y:C("y"),y2:C("y2")};var m=function(g,x,y){var K=document.createElement("div");var e=p[y=="y2"?"y2":x];for(var r in e){if(e.hasOwnProperty(r)){K.style[r]=e[r]}}var i=document.createElement("div");i.className="dygraph-axis-label dygraph-axis-label-"+x+(y?" dygraph-axis-label-"+y:"");i.innerHTML=g;K.appendChild(i);return K};j.save();var I=F.layout_;var G=H.dygraph.plotter_.area;if(F.getOption("drawYAxis")){if(I.yticks&&I.yticks.length>0){var h=F.numAxes();for(D=0;D<I.yticks.length;D++){E=I.yticks[D];if(typeof(E)=="function"){return}u=G.x;var o=1;var f="y1";if(E[0]==1){u=G.x+G.w;o=-1;f="y2"}var k=F.getOptionForAxis("axisLabelFontSize",f);t=G.y+E[1]*G.h;s=m(E[2],"y",h==2?f:null);var z=(t-k/2);if(z<0){z=0}if(z+k+3>d){s.style.bottom="0px"}else{s.style.top=z+"px"}if(E[0]===0){s.style.left=(G.x-F.getOption("yAxisLabelWidth")-F.getOption("axisTickSize"))+"px";s.style.textAlign="right"}else{if(E[0]==1){s.style.left=(G.x+G.w+F.getOption("axisTickSize"))+"px";s.style.textAlign="left"}}s.style.width=F.getOption("yAxisLabelWidth")+"px";v.appendChild(s);this.ylabels_.push(s)}var n=this.ylabels_[0];var k=F.getOptionForAxis("axisLabelFontSize","y");var q=parseInt(n.style.top,10)+k;if(q>d-k){n.style.top=(parseInt(n.style.top,10)-k/2)+"px"}}var c;if(F.getOption("drawAxesAtZero")){var w=F.toPercentXCoord(0);if(w>1||w<0||isNaN(w)){w=0}c=B(G.x+w*G.w)}else{c=B(G.x)}j.strokeStyle=F.getOptionForAxis("axisLineColor","y");j.lineWidth=F.getOptionForAxis("axisLineWidth","y");j.beginPath();j.moveTo(c,A(G.y));j.lineTo(c,A(G.y+G.h));j.closePath();j.stroke();if(F.numAxes()==2){j.strokeStyle=F.getOptionForAxis("axisLineColor","y2");j.lineWidth=F.getOptionForAxis("axisLineWidth","y2");j.beginPath();j.moveTo(A(G.x+G.w),A(G.y));j.lineTo(A(G.x+G.w),A(G.y+G.h));j.closePath();j.stroke()}}if(F.getOption("drawXAxis")){if(I.xticks){for(D=0;D<I.xticks.length;D++){E=I.xticks[D];u=G.x+E[0]*G.w;t=G.y+G.h;s=m(E[1],"x");s.style.textAlign="center";s.style.top=(t+F.getOption("axisTickSize"))+"px";var l=(u-F.getOption("axisLabelWidth")/2);if(l+F.getOption("axisLabelWidth")>J){l=J-F.getOption("xAxisLabelWidth");s.style.textAlign="right"}if(l<0){l=0;s.style.textAlign="left"}s.style.left=l+"px";s.style.width=F.getOption("xAxisLabelWidth")+"px";v.appendChild(s);this.xlabels_.push(s)}}j.strokeStyle=F.getOptionForAxis("axisLineColor","x");j.lineWidth=F.getOptionForAxis("axisLineWidth","x");j.beginPath();var b;if(F.getOption("drawAxesAtZero")){var w=F.toPercentYCoord(0,0);if(w>1||w<0){w=1}b=A(G.y+w*G.h)}else{b=A(G.y+G.h)}j.moveTo(B(G.x),b);j.lineTo(B(G.x+G.w),b);j.closePath();j.stroke()}j.restore()};return a})();Dygraph.Plugins.ChartLabels=(function(){var c=function(){this.title_div_=null;this.xlabel_div_=null;this.ylabel_div_=null;this.y2label_div_=null};c.prototype.toString=function(){return"ChartLabels Plugin"};c.prototype.activate=function(d){return{layout:this.layout,didDrawChart:this.didDrawChart}};var b=function(d){var e=document.createElement("div");e.style.position="absolute";e.style.left=d.x+"px";e.style.top=d.y+"px";e.style.width=d.w+"px";e.style.height=d.h+"px";return e};c.prototype.detachLabels_=function(){var e=[this.title_div_,this.xlabel_div_,this.ylabel_div_,this.y2label_div_];for(var d=0;d<e.length;d++){var f=e[d];if(!f){continue}if(f.parentNode){f.parentNode.removeChild(f)}}this.title_div_=null;this.xlabel_div_=null;this.ylabel_div_=null;this.y2label_div_=null};var a=function(l,i,f,h,j){var d=document.createElement("div");d.style.position="absolute";if(f==1){d.style.left="0px"}else{d.style.left=i.x+"px"}d.style.top=i.y+"px";d.style.width=i.w+"px";d.style.height=i.h+"px";d.style.fontSize=(l.getOption("yLabelWidth")-2)+"px";var m=document.createElement("div");m.style.position="absolute";m.style.width=i.h+"px";m.style.height=i.w+"px";m.style.top=(i.h/2-i.w/2)+"px";m.style.left=(i.w/2-i.h/2)+"px";m.style.textAlign="center";var e="rotate("+(f==1?"-":"")+"90deg)";m.style.transform=e;m.style.WebkitTransform=e;m.style.MozTransform=e;m.style.OTransform=e;m.style.msTransform=e;if(typeof(document.documentMode)!=="undefined"&&document.documentMode<9){m.style.filter="progid:DXImageTransform.Microsoft.BasicImage(rotation="+(f==1?"3":"1")+")";m.style.left="0px";m.style.top="0px"}var k=document.createElement("div");k.className=h;k.innerHTML=j;m.appendChild(k);d.appendChild(m);return d};c.prototype.layout=function(k){this.detachLabels_();var i=k.dygraph;var m=k.chart_div;if(i.getOption("title")){var d=k.reserveSpaceTop(i.getOption("titleHeight"));this.title_div_=b(d);this.title_div_.style.textAlign="center";this.title_div_.style.fontSize=(i.getOption("titleHeight")-8)+"px";this.title_div_.style.fontWeight="bold";this.title_div_.style.zIndex=10;var f=document.createElement("div");f.className="dygraph-label dygraph-title";f.innerHTML=i.getOption("title");this.title_div_.appendChild(f);m.appendChild(this.title_div_)}if(i.getOption("xlabel")){var j=k.reserveSpaceBottom(i.getOption("xLabelHeight"));this.xlabel_div_=b(j);this.xlabel_div_.style.textAlign="center";this.xlabel_div_.style.fontSize=(i.getOption("xLabelHeight")-2)+"px";var f=document.createElement("div");f.className="dygraph-label dygraph-xlabel";f.innerHTML=i.getOption("xlabel");this.xlabel_div_.appendChild(f);m.appendChild(this.xlabel_div_)}if(i.getOption("ylabel")){var h=k.reserveSpaceLeft(0);this.ylabel_div_=a(i,h,1,"dygraph-label dygraph-ylabel",i.getOption("ylabel"));m.appendChild(this.ylabel_div_)}if(i.getOption("y2label")&&i.numAxes()==2){var l=k.reserveSpaceRight(0);this.y2label_div_=a(i,l,2,"dygraph-label dygraph-y2label",i.getOption("y2label"));m.appendChild(this.y2label_div_)}};c.prototype.didDrawChart=function(f){var d=f.dygraph;if(this.title_div_){this.title_div_.children[0].innerHTML=d.getOption("title")}if(this.xlabel_div_){this.xlabel_div_.children[0].innerHTML=d.getOption("xlabel")}if(this.ylabel_div_){this.ylabel_div_.children[0].children[0].innerHTML=d.getOption("ylabel")}if(this.y2label_div_){this.y2label_div_.children[0].children[0].innerHTML=d.getOption("y2label")}};c.prototype.clearChart=function(){};c.prototype.destroy=function(){this.detachLabels_()};return c})();Dygraph.Plugins.Grid=(function(){var a=function(){};a.prototype.toString=function(){return"Gridline Plugin"};a.prototype.activate=function(b){return{willDrawChart:this.willDrawChart}};a.prototype.willDrawChart=function(s){var q=s.dygraph;var l=s.drawingContext;var t=q.layout_;var r=s.dygraph.plotter_.area;function k(e){return Math.round(e)+0.5}function j(e){return Math.round(e)-0.5}var h,f,p,u;if(q.getOption("drawYGrid")){var o=["y","y2"];var m=[],v=[],b=[],n=[],d=[];for(var p=0;p<o.length;p++){b[p]=q.getOptionForAxis("drawGrid",o[p]);if(b[p]){m[p]=q.getOptionForAxis("gridLineColor",o[p]);v[p]=q.getOptionForAxis("gridLineWidth",o[p]);d[p]=q.getOptionForAxis("gridLinePattern",o[p]);n[p]=d[p]&&(d[p].length>=2)}}u=t.yticks;l.save();for(p=0;p<u.length;p++){var c=u[p][0];if(b[c]){if(n[c]){l.installPattern(d[c])}l.strokeStyle=m[c];l.lineWidth=v[c];h=k(r.x);f=j(r.y+u[p][1]*r.h);l.beginPath();l.moveTo(h,f);l.lineTo(h+r.w,f);l.closePath();l.stroke();if(n[c]){l.uninstallPattern()}}}l.restore()}if(q.getOption("drawXGrid")&&q.getOptionForAxis("drawGrid","x")){u=t.xticks;l.save();var d=q.getOptionForAxis("gridLinePattern","x");var n=d&&(d.length>=2);if(n){l.installPattern(d)}l.strokeStyle=q.getOptionForAxis("gridLineColor","x");l.lineWidth=q.getOptionForAxis("gridLineWidth","x");for(p=0;p<u.length;p++){h=k(r.x+u[p][0]*r.w);f=j(r.y+r.h);l.beginPath();l.moveTo(h,f);l.lineTo(h,r.y);l.closePath();l.stroke()}if(n){l.uninstallPattern()}l.restore()}};a.prototype.destroy=function(){};return a})();Dygraph.Plugins.Legend=(function(){var c=function(){this.legend_div_=null;this.is_generated_div_=false};c.prototype.toString=function(){return"Legend Plugin"};var a,d;c.prototype.activate=function(j){var m;var f=j.getOption("labelsDivWidth");var l=j.getOption("labelsDiv");if(l&&null!==l){if(typeof(l)=="string"||l instanceof String){m=document.getElementById(l)}else{m=l}}else{var i={position:"absolute",fontSize:"14px",zIndex:10,width:f+"px",top:"0px",left:(j.size().width-f-2)+"px",background:"white",lineHeight:"normal",textAlign:"left",overflow:"hidden"};Dygraph.update(i,j.getOption("labelsDivStyles"));m=document.createElement("div");m.className="dygraph-legend";for(var h in i){if(!i.hasOwnProperty(h)){continue}try{m.style[h]=i[h]}catch(k){this.warn("You are using unsupported css properties for your browser in labelsDivStyles")}}j.graphDiv.appendChild(m);this.is_generated_div_=true}this.legend_div_=m;this.one_em_width_=10;return{select:this.select,deselect:this.deselect,predraw:this.predraw,didDrawChart:this.didDrawChart}};var b=function(g){var f=document.createElement("span");f.setAttribute("style","margin: 0; padding: 0 0 0 1em; border: 0;");g.appendChild(f);var e=f.offsetWidth;g.removeChild(f);return e};c.prototype.select=function(i){var h=i.selectedX;var g=i.selectedPoints;var f=a(i.dygraph,h,g,this.one_em_width_);this.legend_div_.innerHTML=f};c.prototype.deselect=function(h){var f=b(this.legend_div_);this.one_em_width_=f;var g=a(h.dygraph,undefined,undefined,f);this.legend_div_.innerHTML=g};c.prototype.didDrawChart=function(f){this.deselect(f)};c.prototype.predraw=function(h){if(!this.is_generated_div_){return}h.dygraph.graphDiv.appendChild(this.legend_div_);var g=h.dygraph.plotter_.area;var f=h.dygraph.getOption("labelsDivWidth");this.legend_div_.style.left=g.x+g.w-f-1+"px";this.legend_div_.style.top=g.y+"px";this.legend_div_.style.width=f+"px"};c.prototype.destroy=function(){this.legend_div_=null};a=function(w,p,l,f){if(w.getOption("showLabelsOnHighlight")!==true){return""}var r,C,u,s,m;var z=w.getLabels();if(typeof(p)==="undefined"){if(w.getOption("legend")!="always"){return""}C=w.getOption("labelsSeparateLines");r="";for(u=1;u<z.length;u++){var q=w.getPropertiesForSeries(z[u]);if(!q.visible){continue}if(r!==""){r+=(C?"<br/>":" ")}m=w.getOption("strokePattern",z[u]);s=d(m,q.color,f);r+="<span style='font-weight: bold; color: "+q.color+";'>"+s+" "+z[u]+"</span>"}return r}var A=w.optionsViewForAxis_("x");var o=A("valueFormatter");r=o(p,A,z[0],w);if(r!==""){r+=":"}var v=[];var j=w.numAxes();for(u=0;u<j;u++){v[u]=w.optionsViewForAxis_("y"+(u?1+u:""))}var k=w.getOption("labelsShowZeroValues");C=w.getOption("labelsSeparateLines");var B=w.getHighlightSeries();for(u=0;u<l.length;u++){var t=l[u];if(t.yval===0&&!k){continue}if(!Dygraph.isOK(t.canvasy)){continue}if(C){r+="<br/>"}var q=w.getPropertiesForSeries(t.name);var n=v[q.axis-1];var y=n("valueFormatter");var e=y(t.yval,n,t.name,w);var h=(t.name==B)?" class='highlight'":"";r+="<span"+h+"> <b><span style='color: "+q.color+";'>"+t.name+"</span></b>:&nbsp;"+e+"</span>"}return r};d=function(s,h,r){var e=(/MSIE/.test(navigator.userAgent)&&!window.opera);if(e){return"&mdash;"}if(!s||s.length<=1){return'<div style="display: inline-block; position: relative; bottom: .5ex; padding-left: 1em; height: 1px; border-bottom: 2px solid '+h+';"></div>'}var l,k,f,o;var g=0,q=0;var p=[];var n;for(l=0;l<=s.length;l++){g+=s[l%s.length]}n=Math.floor(r/(g-s[0]));if(n>1){for(l=0;l<s.length;l++){p[l]=s[l]/r}q=p.length}else{n=1;for(l=0;l<s.length;l++){p[l]=s[l]/g}q=p.length+1}var m="";for(k=0;k<n;k++){for(l=0;l<q;l+=2){f=p[l%p.length];if(l<s.length){o=p[(l+1)%p.length]}else{o=0}m+='<div style="display: inline-block; position: relative; bottom: .5ex; margin-right: '+o+"em; padding-left: "+f+"em; height: 1px; border-bottom: 2px solid "+h+';"></div>'}}return m};return c})();Dygraph.Plugins.RangeSelector=(function(){var a=function(){this.isIE_=/MSIE/.test(navigator.userAgent)&&!window.opera;this.hasTouchInterface_=typeof(TouchEvent)!="undefined";this.isMobileDevice_=/mobile|android/gi.test(navigator.appVersion);this.interfaceCreated_=false};a.prototype.toString=function(){return"RangeSelector Plugin"};a.prototype.activate=function(b){this.dygraph_=b;this.isUsingExcanvas_=b.isUsingExcanvas_;if(this.getOption_("showRangeSelector")){this.createInterface_()}return{layout:this.reserveSpace_,predraw:this.renderStaticLayer_,didDrawChart:this.renderInteractiveLayer_}};a.prototype.destroy=function(){this.bgcanvas_=null;this.fgcanvas_=null;this.leftZoomHandle_=null;this.rightZoomHandle_=null;this.iePanOverlay_=null};a.prototype.getOption_=function(b){return this.dygraph_.getOption(b)};a.prototype.setDefaultOption_=function(b,c){return this.dygraph_.attrs_[b]=c};a.prototype.createInterface_=function(){this.createCanvases_();if(this.isUsingExcanvas_){this.createIEPanOverlay_()}this.createZoomHandles_();this.initInteraction_();if(this.getOption_("animatedZooms")){this.dygraph_.warn("Animated zooms and range selector are not compatible; disabling animatedZooms.");this.dygraph_.updateOptions({animatedZooms:false},true)}this.interfaceCreated_=true;this.addToGraph_()};a.prototype.addToGraph_=function(){var b=this.graphDiv_=this.dygraph_.graphDiv;b.appendChild(this.bgcanvas_);b.appendChild(this.fgcanvas_);b.appendChild(this.leftZoomHandle_);b.appendChild(this.rightZoomHandle_)};a.prototype.removeFromGraph_=function(){var b=this.graphDiv_;b.removeChild(this.bgcanvas_);b.removeChild(this.fgcanvas_);b.removeChild(this.leftZoomHandle_);b.removeChild(this.rightZoomHandle_);this.graphDiv_=null};a.prototype.reserveSpace_=function(b){if(this.getOption_("showRangeSelector")){b.reserveSpaceBottom(this.getOption_("rangeSelectorHeight")+4)}};a.prototype.renderStaticLayer_=function(){if(!this.updateVisibility_()){return}this.resize_();this.drawStaticLayer_()};a.prototype.renderInteractiveLayer_=function(){if(!this.updateVisibility_()||this.isChangingRange_){return}this.placeZoomHandles_();this.drawInteractiveLayer_()};a.prototype.updateVisibility_=function(){var b=this.getOption_("showRangeSelector");if(b){if(!this.interfaceCreated_){this.createInterface_()}else{if(!this.graphDiv_||!this.graphDiv_.parentNode){this.addToGraph_()}}}else{if(this.graphDiv_){this.removeFromGraph_();var c=this.dygraph_;setTimeout(function(){c.width_=0;c.resize()},1)}}return b};a.prototype.resize_=function(){function d(e,f){e.style.top=f.y+"px";e.style.left=f.x+"px";e.width=f.w;e.height=f.h;e.style.width=e.width+"px";e.style.height=e.height+"px"}var c=this.dygraph_.layout_.getPlotArea();var b=0;if(this.getOption_("drawXAxis")){b=this.getOption_("xAxisHeight")||(this.getOption_("axisLabelFontSize")+2*this.getOption_("axisTickSize"))}this.canvasRect_={x:c.x,y:c.y+c.h+b+4,w:c.w,h:this.getOption_("rangeSelectorHeight")};d(this.bgcanvas_,this.canvasRect_);d(this.fgcanvas_,this.canvasRect_)};a.prototype.createCanvases_=function(){this.bgcanvas_=Dygraph.createCanvas();this.bgcanvas_.className="dygraph-rangesel-bgcanvas";this.bgcanvas_.style.position="absolute";this.bgcanvas_.style.zIndex=9;this.bgcanvas_ctx_=Dygraph.getContext(this.bgcanvas_);this.fgcanvas_=Dygraph.createCanvas();this.fgcanvas_.className="dygraph-rangesel-fgcanvas";this.fgcanvas_.style.position="absolute";this.fgcanvas_.style.zIndex=9;this.fgcanvas_.style.cursor="default";this.fgcanvas_ctx_=Dygraph.getContext(this.fgcanvas_)};a.prototype.createIEPanOverlay_=function(){this.iePanOverlay_=document.createElement("div");this.iePanOverlay_.style.position="absolute";this.iePanOverlay_.style.backgroundColor="white";this.iePanOverlay_.style.filter="alpha(opacity=0)";this.iePanOverlay_.style.display="none";this.iePanOverlay_.style.cursor="move";this.fgcanvas_.appendChild(this.iePanOverlay_)};a.prototype.createZoomHandles_=function(){var b=new Image();b.className="dygraph-rangesel-zoomhandle";b.style.position="absolute";b.style.zIndex=10;b.style.visibility="hidden";b.style.cursor="col-resize";if(/MSIE 7/.test(navigator.userAgent)){b.width=7;b.height=14;b.style.backgroundColor="white";b.style.border="1px solid #333333"}else{b.width=9;b.height=16;b.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAQCAYAAADESFVDAAAAAXNSR0IArs4c6QAAAAZiS0dEANAAzwDP4Z7KegAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB9sHGw0cMqdt1UwAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAaElEQVQoz+3SsRFAQBCF4Z9WJM8KCDVwownl6YXsTmCUsyKGkZzcl7zkz3YLkypgAnreFmDEpHkIwVOMfpdi9CEEN2nGpFdwD03yEqDtOgCaun7sqSTDH32I1pQA2Pb9sZecAxc5r3IAb21d6878xsAAAAAASUVORK5CYII="}if(this.isMobileDevice_){b.width*=2;b.height*=2}this.leftZoomHandle_=b;this.rightZoomHandle_=b.cloneNode(false)};a.prototype.initInteraction_=function(){var o=this;var i=this.isIE_?document:window;var u=0;var v=null;var s=false;var d=false;var g=!this.isMobileDevice_&&!this.isUsingExcanvas_;var k=new Dygraph.IFrameTarp();var p,f,r,j,w,h,x,t,q,c,l;var e,n,m;p=function(C){var B=o.dygraph_.xAxisExtremes();var z=(B[1]-B[0])/o.canvasRect_.w;var A=B[0]+(C.leftHandlePos-o.canvasRect_.x)*z;var y=B[0]+(C.rightHandlePos-o.canvasRect_.x)*z;return[A,y]};f=function(y){Dygraph.cancelEvent(y);s=true;u=y.clientX;v=y.target?y.target:y.srcElement;if(y.type==="mousedown"||y.type==="dragstart"){Dygraph.addEvent(i,"mousemove",r);Dygraph.addEvent(i,"mouseup",j)}o.fgcanvas_.style.cursor="col-resize";k.cover();return true};r=function(C){if(!s){return false}Dygraph.cancelEvent(C);var z=C.clientX-u;if(Math.abs(z)<4){return true}u=C.clientX;var B=o.getZoomHandleStatus_();var y;if(v==o.leftZoomHandle_){y=B.leftHandlePos+z;y=Math.min(y,B.rightHandlePos-v.width-3);y=Math.max(y,o.canvasRect_.x)}else{y=B.rightHandlePos+z;y=Math.min(y,o.canvasRect_.x+o.canvasRect_.w);y=Math.max(y,B.leftHandlePos+v.width+3)}var A=v.width/2;v.style.left=(y-A)+"px";o.drawInteractiveLayer_();if(g){w()}return true};j=function(y){if(!s){return false}s=false;k.uncover();Dygraph.removeEvent(i,"mousemove",r);Dygraph.removeEvent(i,"mouseup",j);o.fgcanvas_.style.cursor="default";if(!g){w()}return true};w=function(){try{var z=o.getZoomHandleStatus_();o.isChangingRange_=true;if(!z.isZoomed){o.dygraph_.resetZoom()}else{var y=p(z);o.dygraph_.doZoomXDates_(y[0],y[1])}}finally{o.isChangingRange_=false}};h=function(A){if(o.isUsingExcanvas_){return A.srcElement==o.iePanOverlay_}else{var z=o.leftZoomHandle_.getBoundingClientRect();var y=z.left+z.width/2;z=o.rightZoomHandle_.getBoundingClientRect();var B=z.left+z.width/2;return(A.clientX>y&&A.clientX<B)}};x=function(y){if(!d&&h(y)&&o.getZoomHandleStatus_().isZoomed){Dygraph.cancelEvent(y);d=true;u=y.clientX;if(y.type==="mousedown"){Dygraph.addEvent(i,"mousemove",t);Dygraph.addEvent(i,"mouseup",q)}return true}return false};t=function(C){if(!d){return false}Dygraph.cancelEvent(C);var z=C.clientX-u;if(Math.abs(z)<4){return true}u=C.clientX;var B=o.getZoomHandleStatus_();var E=B.leftHandlePos;var y=B.rightHandlePos;var D=y-E;if(E+z<=o.canvasRect_.x){E=o.canvasRect_.x;y=E+D}else{if(y+z>=o.canvasRect_.x+o.canvasRect_.w){y=o.canvasRect_.x+o.canvasRect_.w;E=y-D}else{E+=z;y+=z}}var A=o.leftZoomHandle_.width/2;o.leftZoomHandle_.style.left=(E-A)+"px";o.rightZoomHandle_.style.left=(y-A)+"px";o.drawInteractiveLayer_();if(g){c()}return true};q=function(y){if(!d){return false}d=false;Dygraph.removeEvent(i,"mousemove",t);Dygraph.removeEvent(i,"mouseup",q);if(!g){c()}return true};c=function(){try{o.isChangingRange_=true;o.dygraph_.dateWindow_=p(o.getZoomHandleStatus_());o.dygraph_.drawGraph_(false)}finally{o.isChangingRange_=false}};l=function(y){if(s||d){return}var z=h(y)?"move":"default";if(z!=o.fgcanvas_.style.cursor){o.fgcanvas_.style.cursor=z}};e=function(y){if(y.type=="touchstart"&&y.targetTouches.length==1){if(f(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{if(y.type=="touchmove"&&y.targetTouches.length==1){if(r(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{j(y)}}};n=function(y){if(y.type=="touchstart"&&y.targetTouches.length==1){if(x(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{if(y.type=="touchmove"&&y.targetTouches.length==1){if(t(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{q(y)}}};m=function(B,A){var z=["touchstart","touchend","touchmove","touchcancel"];for(var y=0;y<z.length;y++){o.dygraph_.addAndTrackEvent(B,z[y],A)}};this.setDefaultOption_("interactionModel",Dygraph.Interaction.dragIsPanInteractionModel);this.setDefaultOption_("panEdgeFraction",0.0001);var b=window.opera?"mousedown":"dragstart";this.dygraph_.addAndTrackEvent(this.leftZoomHandle_,b,f);this.dygraph_.addAndTrackEvent(this.rightZoomHandle_,b,f);if(this.isUsingExcanvas_){this.dygraph_.addAndTrackEvent(this.iePanOverlay_,"mousedown",x)}else{this.dygraph_.addAndTrackEvent(this.fgcanvas_,"mousedown",x);this.dygraph_.addAndTrackEvent(this.fgcanvas_,"mousemove",l)}if(this.hasTouchInterface_){m(this.leftZoomHandle_,e);m(this.rightZoomHandle_,e);m(this.fgcanvas_,n)}};a.prototype.drawStaticLayer_=function(){var b=this.bgcanvas_ctx_;b.clearRect(0,0,this.canvasRect_.w,this.canvasRect_.h);try{this.drawMiniPlot_()}catch(c){Dygraph.warn(c)}var d=0.5;this.bgcanvas_ctx_.lineWidth=1;b.strokeStyle="gray";b.beginPath();b.moveTo(d,d);b.lineTo(d,this.canvasRect_.h-d);b.lineTo(this.canvasRect_.w-d,this.canvasRect_.h-d);b.lineTo(this.canvasRect_.w-d,d);b.stroke()};a.prototype.drawMiniPlot_=function(){var f=this.getOption_("rangeSelectorPlotFillColor");var r=this.getOption_("rangeSelectorPlotStrokeColor");if(!f&&!r){return}var j=this.getOption_("stepPlot");var v=this.computeCombinedSeriesAndLimits_();var q=v.yMax-v.yMin;var p=this.bgcanvas_ctx_;var n=0.5;var e=this.dygraph_.xAxisExtremes();var o=Math.max(e[1]-e[0],1e-30);var g=(this.canvasRect_.w-n)/o;var u=(this.canvasRect_.h-n)/q;var t=this.canvasRect_.w-n;var b=this.canvasRect_.h-n;var d=null,c=null;p.beginPath();p.moveTo(n,b);for(var s=0;s<v.data.length;s++){var h=v.data[s];var l=((h[0]!==null)?((h[0]-e[0])*g):NaN);var k=((h[1]!==null)?(b-(h[1]-v.yMin)*u):NaN);if(isFinite(l)&&isFinite(k)){if(d===null){p.lineTo(l,b)}else{if(j){p.lineTo(l,c)}}p.lineTo(l,k);d=l;c=k}else{if(d!==null){if(j){p.lineTo(l,c);p.lineTo(l,b)}else{p.lineTo(d,b)}}d=c=null}}p.lineTo(t,b);p.closePath();if(f){var m=this.bgcanvas_ctx_.createLinearGradient(0,0,0,b);m.addColorStop(0,"white");m.addColorStop(1,f);this.bgcanvas_ctx_.fillStyle=m;p.fill()}if(r){this.bgcanvas_ctx_.strokeStyle=r;this.bgcanvas_ctx_.lineWidth=1.5;p.stroke()}};a.prototype.computeCombinedSeriesAndLimits_=function(){var v=this.dygraph_.rawData_;var u=this.getOption_("logscale");var q=[];var d;var h;var m;var t,s,r;var e,g;for(t=0;t<v.length;t++){if(v[t].length>1&&v[t][1]!==null){m=typeof v[t][1]!="number";if(m){d=[];h=[];for(r=0;r<v[t][1].length;r++){d.push(0);h.push(0)}}break}}for(t=0;t<v.length;t++){var l=v[t];e=l[0];if(m){for(r=0;r<d.length;r++){d[r]=h[r]=0}}else{d=h=0}for(s=1;s<l.length;s++){if(this.dygraph_.visibility()[s-1]){var n;if(m){for(r=0;r<d.length;r++){n=l[s][r];if(n===null||isNaN(n)){continue}d[r]+=n;h[r]++}}else{n=l[s];if(n===null||isNaN(n)){continue}d+=n;h++}}}if(m){for(r=0;r<d.length;r++){d[r]/=h[r]}g=d.slice(0)}else{g=d/h}q.push([e,g])}q=this.dygraph_.rollingAverage(q,this.dygraph_.rollPeriod_);if(typeof q[0][1]!="number"){for(t=0;t<q.length;t++){g=q[t][1];q[t][1]=g[0]}}var b=Number.MAX_VALUE;var c=-Number.MAX_VALUE;for(t=0;t<q.length;t++){g=q[t][1];if(g!==null&&isFinite(g)&&(!u||g>0)){b=Math.min(b,g);c=Math.max(c,g)}}var o=0.25;if(u){c=Dygraph.log10(c);c+=c*o;b=Dygraph.log10(b);for(t=0;t<q.length;t++){q[t][1]=Dygraph.log10(q[t][1])}}else{var f;var p=c-b;if(p<=Number.MIN_VALUE){f=c*o}else{f=p*o}c+=f;b-=f}return{data:q,yMin:b,yMax:c}};a.prototype.placeZoomHandles_=function(){var h=this.dygraph_.xAxisExtremes();var b=this.dygraph_.xAxisRange();var c=h[1]-h[0];var j=Math.max(0,(b[0]-h[0])/c);var f=Math.max(0,(h[1]-b[1])/c);var i=this.canvasRect_.x+this.canvasRect_.w*j;var e=this.canvasRect_.x+this.canvasRect_.w*(1-f);var d=Math.max(this.canvasRect_.y,this.canvasRect_.y+(this.canvasRect_.h-this.leftZoomHandle_.height)/2);var g=this.leftZoomHandle_.width/2;this.leftZoomHandle_.style.left=(i-g)+"px";this.leftZoomHandle_.style.top=d+"px";this.rightZoomHandle_.style.left=(e-g)+"px";this.rightZoomHandle_.style.top=this.leftZoomHandle_.style.top;this.leftZoomHandle_.style.visibility="visible";this.rightZoomHandle_.style.visibility="visible"};a.prototype.drawInteractiveLayer_=function(){var c=this.fgcanvas_ctx_;c.clearRect(0,0,this.canvasRect_.w,this.canvasRect_.h);var f=1;var e=this.canvasRect_.w-f;var b=this.canvasRect_.h-f;var h=this.getZoomHandleStatus_();c.strokeStyle="black";if(!h.isZoomed){c.beginPath();c.moveTo(f,f);c.lineTo(f,b);c.lineTo(e,b);c.lineTo(e,f);c.stroke();if(this.iePanOverlay_){this.iePanOverlay_.style.display="none"}}else{var g=Math.max(f,h.leftHandlePos-this.canvasRect_.x);var d=Math.min(e,h.rightHandlePos-this.canvasRect_.x);c.fillStyle="rgba(240, 240, 240, 0.6)";c.fillRect(0,0,g,this.canvasRect_.h);c.fillRect(d,0,this.canvasRect_.w-d,this.canvasRect_.h);c.beginPath();c.moveTo(f,f);c.lineTo(g,f);c.lineTo(g,b);c.lineTo(d,b);c.lineTo(d,f);c.lineTo(e,f);c.stroke();if(this.isUsingExcanvas_){this.iePanOverlay_.style.width=(d-g)+"px";this.iePanOverlay_.style.left=g+"px";this.iePanOverlay_.style.height=b+"px";this.iePanOverlay_.style.display="inline"}}};a.prototype.getZoomHandleStatus_=function(){var c=this.leftZoomHandle_.width/2;var d=parseFloat(this.leftZoomHandle_.style.left)+c;var b=parseFloat(this.rightZoomHandle_.style.left)+c;return{leftHandlePos:d,rightHandlePos:b,isZoomed:(d-1>this.canvasRect_.x||b+1<this.canvasRect_.x+this.canvasRect_.w)}};return a})();Dygraph.PLUGINS.push(Dygraph.Plugins.Legend,Dygraph.Plugins.Axes,Dygraph.Plugins.RangeSelector,Dygraph.Plugins.ChartLabels,Dygraph.Plugins.Annotations,Dygraph.Plugins.Grid); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-combined_bak_color.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-combined_bak_color.js
new file mode 100644
index 00000000..2f7b14b8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-combined_bak_color.js
@@ -0,0 +1,2 @@
+/*! @license Copyright 2011 Dan Vanderkam (danvdk@gmail.com) MIT-licensed (http://opensource.org/licenses/MIT) */
+Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(a,c,b){if(typeof(b)=="undefined"){b=10}for(;parseInt(a,10)<b&&b>1;b/=10){a=c.toString()+a}return a.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};Date.ext.locales["en-US"]=Date.ext.locales.en;Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(a){return Date.ext.locales[a.locale].a[a.getDay()]},A:function(a){return Date.ext.locales[a.locale].A[a.getDay()]},b:function(a){return Date.ext.locales[a.locale].b[a.getMonth()]},B:function(a){return Date.ext.locales[a.locale].B[a.getMonth()]},c:"toLocaleString",C:function(a){return Date.ext.util.xPad(parseInt(a.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(a){return Date.ext.util.xPad(parseInt(Date.ext.util.G(a)/100,10),0)},G:function(c){var e=c.getFullYear();var b=parseInt(Date.ext.formats.V(c),10);var a=parseInt(Date.ext.formats.W(c),10);if(a>b){e++}else{if(a===0&&b>=52){e--}}return e},H:["getHours","0"],I:function(b){var a=b.getHours()%12;return Date.ext.util.xPad(a===0?12:a,0)},j:function(c){var a=c-new Date(""+c.getFullYear()+"/1/1 GMT");a+=c.getTimezoneOffset()*60000;var b=parseInt(a/60000/60/24,10)+1;return Date.ext.util.xPad(b,0,100)},m:function(a){return Date.ext.util.xPad(a.getMonth()+1,0)},M:["getMinutes","0"],p:function(a){return Date.ext.locales[a.locale].p[a.getHours()>=12?1:0]},P:function(a){return Date.ext.locales[a.locale].P[a.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(a){var b=a.getDay();return b===0?7:b},U:function(e){var a=parseInt(Date.ext.formats.j(e),10);var c=6-e.getDay();var b=parseInt((a+c)/7,10);return Date.ext.util.xPad(b,0)},V:function(e){var c=parseInt(Date.ext.formats.W(e),10);var a=(new Date(""+e.getFullYear()+"/1/1")).getDay();var b=c+(a>4||a<=1?0:1);if(b==53&&(new Date(""+e.getFullYear()+"/12/31")).getDay()<4){b=1}else{if(b===0){b=Date.ext.formats.V(new Date(""+(e.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(b,0)},w:"getDay",W:function(e){var a=parseInt(Date.ext.formats.j(e),10);var c=7-Date.ext.formats.u(e);var b=parseInt((a+c)/7,10);return Date.ext.util.xPad(b,0,10)},y:function(a){return Date.ext.util.xPad(a.getFullYear()%100,0)},Y:"getFullYear",z:function(c){var b=c.getTimezoneOffset();var a=Date.ext.util.xPad(parseInt(Math.abs(b/60),10),0);var e=Date.ext.util.xPad(b%60,0);return(b>0?"-":"+")+a+e},Z:function(a){return a.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(a){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(a){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var c=this;while(a.match(/%[cDhnrRtTxXzZ]/)){a=a.replace(/%([cDhnrRtTxXzZ])/g,function(e,d){var g=Date.ext.aggregates[d];return(g=="locale"?Date.ext.locales[c.locale][d]:g)})}var b=a.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(e,d){var g=Date.ext.formats[d];if(typeof(g)=="string"){return c[g]()}else{if(typeof(g)=="function"){return g.call(c,c)}else{if(typeof(g)=="object"&&typeof(g[0])=="string"){return Date.ext.util.xPad(c[g[0]](),g[1])}else{return d}}}});c=null;return b};"use strict";function RGBColorParser(f){this.ok=false;if(f.charAt(0)=="#"){f=f.substr(1,6)}f=f.replace(/ /g,"");f=f.toLowerCase();var b={dodgerBlue:"#1f77b4",vividOrange:"#ff7f0e",forestGreen:"#2ca02c",greenishRed:"#8c864b",desaturatedViolet:"#9467bd",darkModerateRed:"#8c564b",softPink:"#e377c2",darkGray:"#7f7f7f",strongYellow:"#bcbd22",strongCyan:"#17becf",vividRed:"#dc143c",darkMagenta:"#800080",blue:"#0000FF",darkLimeGreen:"#008000",reddishOrange:"#D2691E",red:"#FF0000",black:"#000000",pink:"#DB7093",pureMagenta:"#FF00FF",softBlue:"#7B68EE",strongBlue:"#1f77b6",verySoftCyan:"#9edae5",darkBlue:"#393b79",darkModerateBlue:"#5254a3",slightlyDesaturatedBlue:"#6b6ecf",verySoftBlue:"#9c9ede",darkGreen:"#637939",darkModerateGreen:"#8ca252",slightlyDesaturatedGreen:"#b5cf6b",desaturatedGreen:"#cedb9c",aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};for(var g in b){if(f==g){f=b[g]}}var e=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(i){return[parseInt(i[1]),parseInt(i[2]),parseInt(i[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(i){return[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(i){return[parseInt(i[1]+i[1],16),parseInt(i[2]+i[2],16),parseInt(i[3]+i[3],16)]}}];for(var c=0;c<e.length;c++){var j=e[c].re;var a=e[c].process;var h=j.exec(f);if(h){var d=a(h);this.r=d[0];this.g=d[1];this.b=d[2];this.ok=true}}this.r=(this.r<0||isNaN(this.r))?0:((this.r>255)?255:this.r);this.g=(this.g<0||isNaN(this.g))?0:((this.g>255)?255:this.g);this.b=(this.b<0||isNaN(this.b))?0:((this.b>255)?255:this.b);this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"};this.toHex=function(){var l=this.r.toString(16);var k=this.g.toString(16);var i=this.b.toString(16);if(l.length==1){l="0"+l}if(k.length==1){k="0"+k}if(i.length==1){i="0"+i}return"#"+l+k+i}}function printStackTrace(b){b=b||{guess:true};var c=b.e||null,e=!!b.guess;var d=new printStackTrace.implementation(),a=d.run(c);return(e)?d.guessAnonymousFunctions(a):a}printStackTrace.implementation=function(){};printStackTrace.implementation.prototype={run:function(a,b){a=a||this.createException();b=b||this.mode(a);if(b==="other"){return this.other(arguments.callee)}else{return this[b](a)}},createException:function(){try{this.undef()}catch(a){return a}},mode:function(a){if(a["arguments"]&&a.stack){return"chrome"}else{if(typeof a.message==="string"&&typeof window!=="undefined"&&window.opera){if(!a.stacktrace){return"opera9"}if(a.message.indexOf("\n")>-1&&a.message.split("\n").length>a.stacktrace.split("\n").length){return"opera9"}if(!a.stack){return"opera10a"}if(a.stacktrace.indexOf("called from line")<0){return"opera10b"}return"opera11"}else{if(a.stack){return"firefox"}}}return"other"},instrumentFunction:function(b,d,e){b=b||window;var a=b[d];b[d]=function c(){e.call(this,printStackTrace().slice(4));return b[d]._instrumented.apply(this,arguments)};b[d]._instrumented=a},deinstrumentFunction:function(a,b){if(a[b].constructor===Function&&a[b]._instrumented&&a[b]._instrumented.constructor===Function){a[b]=a[b]._instrumented}},chrome:function(b){var a=(b.stack+"\n").replace(/^\S[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^([^\(]+?)([\n$])/gm,"{anonymous}()@$1$2").replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm,"{anonymous}()@$1").split("\n");a.pop();return a},firefox:function(a){return a.stack.replace(/(?:\n@:0)?\s+$/m,"").replace(/^\(/gm,"{anonymous}(").split("\n")},opera11:function(g){var a="{anonymous}",h=/^.*line (\d+), column (\d+)(?: in (.+))? in (\S+):$/;var k=g.stacktrace.split("\n"),l=[];for(var c=0,f=k.length;c<f;c+=2){var d=h.exec(k[c]);if(d){var j=d[4]+":"+d[1]+":"+d[2];var b=d[3]||"global code";b=b.replace(/<anonymous function: (\S+)>/,"$1").replace(/<anonymous function>/,a);l.push(b+"@"+j+" -- "+k[c+1].replace(/^\s+/,""))}}return l},opera10b:function(g){var a="{anonymous}",h=/^(.*)@(.+):(\d+)$/;var j=g.stacktrace.split("\n"),k=[];for(var c=0,f=j.length;c<f;c++){var d=h.exec(j[c]);if(d){var b=d[1]?(d[1]+"()"):"global code";k.push(b+"@"+d[2]+":"+d[3])}}return k},opera10a:function(g){var a="{anonymous}",h=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;var j=g.stacktrace.split("\n"),k=[];for(var c=0,f=j.length;c<f;c+=2){var d=h.exec(j[c]);if(d){var b=d[3]||a;k.push(b+"()@"+d[2]+":"+d[1]+" -- "+j[c+1].replace(/^\s+/,""))}}return k},opera9:function(j){var d="{anonymous}",h=/Line (\d+).*script (?:in )?(\S+)/i;var c=j.message.split("\n"),b=[];for(var g=2,a=c.length;g<a;g+=2){var f=h.exec(c[g]);if(f){b.push(d+"()@"+f[2]+":"+f[1]+" -- "+c[g+1].replace(/^\s+/,""))}}return b},other:function(g){var b="{anonymous}",f=/function\s*([\w\-$]+)?\s*\(/i,a=[],d,c,e=10;while(g&&a.length<e){d=f.test(g.toString())?RegExp.$1||b:b;c=Array.prototype.slice.call(g["arguments"]||[]);a[a.length]=d+"("+this.stringifyArguments(c)+")";g=g.caller}return a},stringifyArguments:function(c){var b=[];var e=Array.prototype.slice;for(var d=0;d<c.length;++d){var a=c[d];if(a===undefined){b[d]="undefined"}else{if(a===null){b[d]="null"}else{if(a.constructor){if(a.constructor===Array){if(a.length<3){b[d]="["+this.stringifyArguments(a)+"]"}else{b[d]="["+this.stringifyArguments(e.call(a,0,1))+"..."+this.stringifyArguments(e.call(a,-1))+"]"}}else{if(a.constructor===Object){b[d]="#object"}else{if(a.constructor===Function){b[d]="#function"}else{if(a.constructor===String){b[d]='"'+a+'"'}else{if(a.constructor===Number){b[d]=a}}}}}}}}}return b.join(",")},sourceCache:{},ajax:function(a){var b=this.createXMLHTTPObject();if(b){try{b.open("GET",a,false);b.send(null);return b.responseText}catch(c){}}return""},createXMLHTTPObject:function(){var c,a=[function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];for(var b=0;b<a.length;b++){try{c=a[b]();this.createXMLHTTPObject=a[b];return c}catch(d){}}},isSameDomain:function(a){return a.indexOf(location.hostname)!==-1},getSource:function(a){if(!(a in this.sourceCache)){this.sourceCache[a]=this.ajax(a).split("\n")}return this.sourceCache[a]},guessAnonymousFunctions:function(k){for(var g=0;g<k.length;++g){var f=/\{anonymous\}\(.*\)@(.*)/,l=/^(.*?)(?::(\d+))(?::(\d+))?(?: -- .+)?$/,b=k[g],c=f.exec(b);if(c){var e=l.exec(c[1]),d=e[1],a=e[2],j=e[3]||0;if(d&&this.isSameDomain(d)&&a){var h=this.guessAnonymousFunction(d,a,j);k[g]=b.replace("{anonymous}",h)}}}return k},guessAnonymousFunction:function(c,f,a){var b;try{b=this.findFunctionName(this.getSource(c),f)}catch(d){b="getSource failed with url: "+c+", exception: "+d.toString()}return b},findFunctionName:function(a,e){var g=/function\s+([^(]*?)\s*\(([^)]*)\)/;var k=/['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*function\b/;var h=/['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*(?:eval|new Function)\b/;var b="",l,j=Math.min(e,20),d,c;for(var f=0;f<j;++f){l=a[e-f-1];c=l.indexOf("//");if(c>=0){l=l.substr(0,c)}if(l){b=l+b;d=k.exec(b);if(d&&d[1]){return d[1]}d=g.exec(b);if(d&&d[1]){return d[1]}d=h.exec(b);if(d&&d[1]){return d[1]}}}return"(?)"}};CanvasRenderingContext2D.prototype.installPattern=function(e){if(typeof(this.isPatternInstalled)!=="undefined"){throw"Must un-install old line pattern before installing a new one."}this.isPatternInstalled=true;var g=[0,0];var b=[];var f=this.beginPath;var d=this.lineTo;var c=this.moveTo;var a=this.stroke;this.uninstallPattern=function(){this.beginPath=f;this.lineTo=d;this.moveTo=c;this.stroke=a;this.uninstallPattern=undefined;this.isPatternInstalled=undefined};this.beginPath=function(){b=[];f.call(this)};this.moveTo=function(h,i){b.push([[h,i]]);c.call(this,h,i)};this.lineTo=function(h,j){var i=b[b.length-1];i.push([h,j])};this.stroke=function(){if(b.length===0){a.call(this);return}for(var p=0;p<b.length;p++){var o=b[p];var l=o[0][0],u=o[0][1];for(var n=1;n<o.length;n++){var h=o[n][0],s=o[n][1];this.save();var w=(h-l);var v=(s-u);var r=Math.sqrt(w*w+v*v);var k=Math.atan2(v,w);this.translate(l,u);c.call(this,0,0);this.rotate(k);var m=g[0];var t=0;while(r>t){var q=e[m];if(g[1]){t+=g[1]}else{t+=q}if(t>r){g=[m,t-r];t=r}else{g=[(m+1)%e.length,0]}if(m%2===0){d.call(this,t,0)}else{c.call(this,t,0)}m=(m+1)%e.length}this.restore();l=h,u=s}}a.call(this);b=[]}};CanvasRenderingContext2D.prototype.uninstallPattern=function(){throw"Must install a line pattern before uninstalling it."};var DygraphOptions=(function(){var a=function(b){this.dygraph_=b;this.yAxes_=[];this.xAxis_={};this.series_={};this.global_=this.dygraph_.attrs_;this.user_=this.dygraph_.user_attrs_||{};this.labels_=[];this.highlightSeries_=this.get("highlightSeriesOpts")||{};this.reparseSeries()};a.AXIS_STRING_MAPPINGS_={y:0,Y:0,y1:0,Y1:0,y2:1,Y2:1};a.axisToIndex_=function(b){if(typeof(b)=="string"){if(a.AXIS_STRING_MAPPINGS_.hasOwnProperty(b)){return a.AXIS_STRING_MAPPINGS_[b]}throw"Unknown axis : "+b}if(typeof(b)=="number"){if(b===0||b===1){return b}throw"Dygraphs only supports two y-axes, indexed from 0-1."}if(b){throw"Unknown axis : "+b}return 0};a.prototype.reparseSeries=function(){var g=this.get("labels");if(!g){return}this.labels_=g.slice(1);this.yAxes_=[{series:[],options:{}}];this.xAxis_={options:{}};this.series_={};var h=!this.user_.series;if(h){var c=0;for(var j=0;j<this.labels_.length;j++){var i=this.labels_[j];var e=this.user_[i]||{};var b=0;var d=e.axis;if(typeof(d)=="object"){b=++c;this.yAxes_[b]={series:[i],options:d}}if(!d){this.yAxes_[0].series.push(i)}this.series_[i]={idx:j,yAxis:b,options:e}}for(var j=0;j<this.labels_.length;j++){var i=this.labels_[j];var e=this.series_[i]["options"];var d=e.axis;if(typeof(d)=="string"){if(!this.series_.hasOwnProperty(d)){Dygraph.error("Series "+i+" wants to share a y-axis with series "+d+", which does not define its own axis.");return}var b=this.series_[d].yAxis;this.series_[i].yAxis=b;this.yAxes_[b].series.push(i)}}}else{for(var j=0;j<this.labels_.length;j++){var i=this.labels_[j];var e=this.user_.series[i]||{};var b=a.axisToIndex_(e.axis);this.series_[i]={idx:j,yAxis:b,options:e};if(!this.yAxes_[b]){this.yAxes_[b]={series:[i],options:{}}}else{this.yAxes_[b].series.push(i)}}}var f=this.user_.axes||{};Dygraph.update(this.yAxes_[0].options,f.y||{});if(this.yAxes_.length>1){Dygraph.update(this.yAxes_[1].options,f.y2||{})}Dygraph.update(this.xAxis_.options,f.x||{})};a.prototype.get=function(c){var b=this.getGlobalUser_(c);if(b!==null){return b}return this.getGlobalDefault_(c)};a.prototype.getGlobalUser_=function(b){if(this.user_.hasOwnProperty(b)){return this.user_[b]}return null};a.prototype.getGlobalDefault_=function(b){if(this.global_.hasOwnProperty(b)){return this.global_[b]}if(Dygraph.DEFAULT_ATTRS.hasOwnProperty(b)){return Dygraph.DEFAULT_ATTRS[b]}return null};a.prototype.getForAxis=function(d,e){var f;var i;if(typeof(e)=="number"){f=e;i=f===0?"y":"y2"}else{if(e=="y1"){e="y"}if(e=="y"){f=0}else{if(e=="y2"){f=1}else{if(e=="x"){f=-1}else{throw"Unknown axis "+e}}}i=e}var g=(f==-1)?this.xAxis_:this.yAxes_[f];if(g){var h=g.options;if(h.hasOwnProperty(d)){return h[d]}}var c=this.getGlobalUser_(d);if(c!==null){return c}var b=Dygraph.DEFAULT_ATTRS.axes[i];if(b.hasOwnProperty(d)){return b[d]}return this.getGlobalDefault_(d)};a.prototype.getForSeries=function(c,e){if(e===this.dygraph_.getHighlightSeries()){if(this.highlightSeries_.hasOwnProperty(c)){return this.highlightSeries_[c]}}if(!this.series_.hasOwnProperty(e)){throw"Unknown series: "+e}var d=this.series_[e];var b=d.options;if(b.hasOwnProperty(c)){return b[c]}return this.getForAxis(c,d.yAxis)};a.prototype.numAxes=function(){return this.yAxes_.length};a.prototype.axisForSeries=function(b){return this.series_[b].yAxis};a.prototype.axisOptions=function(b){return this.yAxes_[b].options};a.prototype.seriesForAxis=function(b){return this.yAxes_[b].series};a.prototype.seriesNames=function(){return this.labels_};return a})();"use strict";var DygraphLayout=function(a){this.dygraph_=a;this.points=[];this.setNames=[];this.annotations=[];this.yAxes_=null;this.xTicks_=null;this.yTicks_=null};DygraphLayout.prototype.attr_=function(a){return this.dygraph_.attr_(a)};DygraphLayout.prototype.addDataset=function(a,b){this.points.push(b);this.setNames.push(a)};DygraphLayout.prototype.getPlotArea=function(){return this.area_};DygraphLayout.prototype.computePlotArea=function(){var a={x:0,y:0};a.w=this.dygraph_.width_-a.x-this.attr_("rightGap");a.h=this.dygraph_.height_;var b={chart_div:this.dygraph_.graphDiv,reserveSpaceLeft:function(c){var d={x:a.x,y:a.y,w:c,h:a.h};a.x+=c;a.w-=c;return d},reserveSpaceRight:function(c){var d={x:a.x+a.w-c,y:a.y,w:c,h:a.h};a.w-=c;return d},reserveSpaceTop:function(c){var d={x:a.x,y:a.y,w:a.w,h:c};a.y+=c;a.h-=c;return d},reserveSpaceBottom:function(c){var d={x:a.x,y:a.y+a.h-c,w:a.w,h:c};a.h-=c;return d},chartRect:function(){return{x:a.x,y:a.y,w:a.w,h:a.h}}};this.dygraph_.cascadeEvents_("layout",b);this.area_=a};DygraphLayout.prototype.setAnnotations=function(d){this.annotations=[];var e=this.attr_("xValueParser")||function(a){return a};for(var c=0;c<d.length;c++){var b={};if(!d[c].xval&&d[c].x===undefined){this.dygraph_.error("Annotations must have an 'x' property");return}if(d[c].icon&&!(d[c].hasOwnProperty("width")&&d[c].hasOwnProperty("height"))){this.dygraph_.error("Must set width and height when setting annotation.icon property");return}Dygraph.update(b,d[c]);if(!b.xval){b.xval=e(b.x)}this.annotations.push(b)}};DygraphLayout.prototype.setXTicks=function(a){this.xTicks_=a};DygraphLayout.prototype.setYAxes=function(a){this.yAxes_=a};DygraphLayout.prototype.evaluate=function(){this._evaluateLimits();this._evaluateLineCharts();this._evaluateLineTicks();this._evaluateAnnotations()};DygraphLayout.prototype._evaluateLimits=function(){var a=this.dygraph_.xAxisRange();this.minxval=a[0];this.maxxval=a[1];var d=a[1]-a[0];this.xscale=(d!==0?1/d:1);for(var b=0;b<this.yAxes_.length;b++){var c=this.yAxes_[b];c.minyval=c.computedValueRange[0];c.maxyval=c.computedValueRange[1];c.yrange=c.maxyval-c.minyval;c.yscale=(c.yrange!==0?1/c.yrange:1);if(c.g.attr_("logscale")){c.ylogrange=Dygraph.log10(c.maxyval)-Dygraph.log10(c.minyval);c.ylogscale=(c.ylogrange!==0?1/c.ylogrange:1);if(!isFinite(c.ylogrange)||isNaN(c.ylogrange)){c.g.error("axis "+b+" of graph at "+c.g+" can't be displayed in log scale for range ["+c.minyval+" - "+c.maxyval+"]")}}}};DygraphLayout._calcYNormal=function(b,c,a){if(a){return 1-((Dygraph.log10(c)-Dygraph.log10(b.minyval))*b.ylogscale)}else{return 1-((c-b.minyval)*b.yscale)}};DygraphLayout.prototype._evaluateLineCharts=function(){var c=this.attr_("connectSeparatedPoints");var k=this.attr_("stackedGraph");var e=this.attr_("errorBars")||this.attr_("customBars");for(var a=0;a<this.points.length;a++){var l=this.points[a];var f=this.setNames[a];var b=this.dygraph_.axisPropertiesForSeries(f);var g=this.dygraph_.attributes_.getForSeries("logscale",f);for(var d=0;d<l.length;d++){var i=l[d];i.x=(i.xval-this.minxval)*this.xscale;var h=i.yval;if(k){i.y_stacked=DygraphLayout._calcYNormal(b,i.yval_stacked,g);if(h!==null&&!isNaN(h)){h=i.yval_stacked}}if(h===null){h=NaN;if(!c){i.yval=NaN}}i.y=DygraphLayout._calcYNormal(b,h,g);if(e){i.y_top=DygraphLayout._calcYNormal(b,h-i.yval_minus,g);i.y_bottom=DygraphLayout._calcYNormal(b,h+i.yval_plus,g)}}}};DygraphLayout.parseFloat_=function(a){if(a===null){return NaN}return a};DygraphLayout.prototype._evaluateLineTicks=function(){var d,c,b,f;this.xticks=[];for(d=0;d<this.xTicks_.length;d++){c=this.xTicks_[d];b=c.label;f=this.xscale*(c.v-this.minxval);if((f>=0)&&(f<=1)){this.xticks.push([f,b])}}this.yticks=[];for(d=0;d<this.yAxes_.length;d++){var e=this.yAxes_[d];for(var a=0;a<e.ticks.length;a++){c=e.ticks[a];b=c.label;f=this.dygraph_.toPercentYCoord(c.v,d);if((f>=0)&&(f<=1)){this.yticks.push([d,f,b])}}}};DygraphLayout.prototype._evaluateAnnotations=function(){var d;var g={};for(d=0;d<this.annotations.length;d++){var b=this.annotations[d];g[b.xval+","+b.series]=b}this.annotated_points=[];if(!this.annotations||!this.annotations.length){return}for(var h=0;h<this.points.length;h++){var e=this.points[h];for(d=0;d<e.length;d++){var f=e[d];var c=f.xval+","+f.name;if(c in g){f.annotation=g[c];this.annotated_points.push(f)}}}};DygraphLayout.prototype.removeAllDatasets=function(){delete this.points;delete this.setNames;delete this.setPointsLengths;delete this.setPointsOffsets;this.points=[];this.setNames=[];this.setPointsLengths=[];this.setPointsOffsets=[]};"use strict";var DygraphCanvasRenderer=function(d,c,b,e){this.dygraph_=d;this.layout=e;this.element=c;this.elementContext=b;this.container=this.element.parentNode;this.height=this.element.height;this.width=this.element.width;if(!this.isIE&&!(DygraphCanvasRenderer.isSupported(this.element))){throw"Canvas is not supported."}this.area=e.getPlotArea();this.container.style.position="relative";this.container.style.width=this.width+"px";if(this.dygraph_.isUsingExcanvas_){this._createIEClipArea()}else{if(!Dygraph.isAndroid()){var a=this.dygraph_.canvas_ctx_;a.beginPath();a.rect(this.area.x,this.area.y,this.area.w,this.area.h);a.clip();a=this.dygraph_.hidden_ctx_;a.beginPath();a.rect(this.area.x,this.area.y,this.area.w,this.area.h);a.clip()}}};DygraphCanvasRenderer.prototype.attr_=function(a,b){return this.dygraph_.attr_(a,b)};DygraphCanvasRenderer.prototype.clear=function(){var a;if(this.isIE){try{if(this.clearDelay){this.clearDelay.cancel();this.clearDelay=null}a=this.elementContext}catch(b){return}}a=this.elementContext;a.clearRect(0,0,this.width,this.height)};DygraphCanvasRenderer.isSupported=function(f){var b=null;try{if(typeof(f)=="undefined"||f===null){b=document.createElement("canvas")}else{b=f}b.getContext("2d")}catch(c){var d=navigator.appVersion.match(/MSIE (\d\.\d)/);var a=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);if((!d)||(d[1]<6)||(a)){return false}return true}return true};DygraphCanvasRenderer.prototype.render=function(){this._updatePoints();this._renderLineChart()};DygraphCanvasRenderer.prototype._createIEClipArea=function(){var g="dygraph-clip-div";var f=this.dygraph_.graphDiv;for(var e=f.childNodes.length-1;e>=0;e--){if(f.childNodes[e].className==g){f.removeChild(f.childNodes[e])}}var c=document.bgColor;var d=this.dygraph_.graphDiv;while(d!=document){var a=d.currentStyle.backgroundColor;if(a&&a!="transparent"){c=a;break}d=d.parentNode}function b(j){if(j.w===0||j.h===0){return}var i=document.createElement("div");i.className=g;i.style.backgroundColor=c;i.style.position="absolute";i.style.left=j.x+"px";i.style.top=j.y+"px";i.style.width=j.w+"px";i.style.height=j.h+"px";f.appendChild(i)}var h=this.area;b({x:0,y:0,w:h.x,h:this.height});b({x:h.x,y:0,w:this.width-h.x,h:h.y});b({x:h.x+h.w,y:0,w:this.width-h.x-h.w,h:this.height});b({x:h.x,y:h.y+h.h,w:this.width-h.x,h:this.height-h.h-h.y})};DygraphCanvasRenderer._getIteratorPredicate=function(a){return a?DygraphCanvasRenderer._predicateThatSkipsEmptyPoints:null};DygraphCanvasRenderer._predicateThatSkipsEmptyPoints=function(b,a){return b[a].yval!==null};DygraphCanvasRenderer._drawStyledLine=function(i,a,m,q,f,n,d){var h=i.dygraph;var c=h.getOption("stepPlot",i.setName);if(!Dygraph.isArrayLike(q)){q=null}var l=h.getOption("drawGapEdgePoints",i.setName);var o=i.points;var k=Dygraph.createIterator(o,0,o.length,DygraphCanvasRenderer._getIteratorPredicate(h.getOption("connectSeparatedPoints")));var j=q&&(q.length>=2);var p=i.drawingContext;p.save();if(j){p.installPattern(q)}var b=DygraphCanvasRenderer._drawSeries(i,k,m,d,f,l,c,a);DygraphCanvasRenderer._drawPointsOnLine(i,b,n,a,d);if(j){p.uninstallPattern()}p.restore()};DygraphCanvasRenderer._drawSeries=function(v,t,m,h,p,s,g,q){var b=null;var w=null;var k=null;var j;var o;var l=[];var f=true;var n=v.drawingContext;n.beginPath();n.strokeStyle=q;n.lineWidth=m;var c=t.array_;var u=t.end_;var a=t.predicate_;for(var r=t.start_;r<u;r++){o=c[r];if(a){while(r<u&&!a(c,r)){r++}if(r==u){break}o=c[r]}if(o.canvasy===null||o.canvasy!=o.canvasy){if(g&&b!==null){n.moveTo(b,w);n.lineTo(o.canvasx,w)}b=w=null}else{j=false;if(s||!b){t.nextIdx_=r;t.next();k=t.hasNext?t.peek.canvasy:null;var d=k===null||k!=k;j=(!b&&d);if(s){if((!f&&!b)||(t.hasNext&&d)){j=true}}}if(b!==null){if(m){if(g){n.moveTo(b,w);n.lineTo(o.canvasx,w)}n.lineTo(o.canvasx,o.canvasy)}}else{n.moveTo(o.canvasx,o.canvasy)}if(p||j){l.push([o.canvasx,o.canvasy,o.idx])}b=o.canvasx;w=o.canvasy}f=false}n.stroke();return l};DygraphCanvasRenderer._drawPointsOnLine=function(h,i,f,d,g){var c=h.drawingContext;for(var b=0;b<i.length;b++){var a=i[b];c.save();f(h.dygraph,h.setName,c,a[0],a[1],d,g,a[2]);c.restore()}};DygraphCanvasRenderer.prototype._updatePoints=function(){var e=this.layout.points;for(var c=e.length;c--;){var d=e[c];for(var b=d.length;b--;){var a=d[b];a.canvasx=this.area.w*a.x+this.area.x;a.canvasy=this.area.h*a.y+this.area.y}}};DygraphCanvasRenderer.prototype._renderLineChart=function(g,u){var h=u||this.elementContext;var n;var a=this.layout.points;var s=this.layout.setNames;var b;this.colors=this.dygraph_.colorsMap_;var o=this.attr_("plotter");var f=o;if(!Dygraph.isArrayLike(f)){f=[f]}var c={};for(n=0;n<s.length;n++){b=s[n];var t=this.attr_("plotter",b);if(t==o){continue}c[b]=t}for(n=0;n<f.length;n++){var r=f[n];var q=(n==f.length-1);for(var l=0;l<a.length;l++){b=s[l];if(g&&b!=g){continue}var m=a[l];var e=r;if(b in c){if(q){e=c[b]}else{continue}}var k=this.colors[b];var d=this.dygraph_.getOption("strokeWidth",b);h.save();h.strokeStyle=k;h.lineWidth=d;e({points:m,setName:b,drawingContext:h,color:k,strokeWidth:d,dygraph:this.dygraph_,axis:this.dygraph_.axisPropertiesForSeries(b),plotArea:this.area,seriesIndex:l,seriesCount:a.length,singleSeriesName:g,allSeriesPoints:a});h.restore()}}};DygraphCanvasRenderer._Plotters={linePlotter:function(a){DygraphCanvasRenderer._linePlotter(a)},fillPlotter:function(a){DygraphCanvasRenderer._fillPlotter(a)},errorPlotter:function(a){DygraphCanvasRenderer._errorPlotter(a)}};DygraphCanvasRenderer._linePlotter=function(f){var d=f.dygraph;var h=f.setName;var i=f.strokeWidth;var a=d.getOption("strokeBorderWidth",h);var j=d.getOption("drawPointCallback",h)||Dygraph.Circles.DEFAULT;var k=d.getOption("strokePattern",h);var c=d.getOption("drawPoints",h);var b=d.getOption("pointSize",h);if(a&&i){DygraphCanvasRenderer._drawStyledLine(f,d.getOption("strokeBorderColor",h),i+2*a,k,c,j,b)}DygraphCanvasRenderer._drawStyledLine(f,f.color,i,k,c,j,b)};DygraphCanvasRenderer._errorPlotter=function(s){var r=s.dygraph;var f=s.setName;var t=r.getOption("errorBars")||r.getOption("customBars");if(!t){return}var k=r.getOption("fillGraph",f);if(k){r.warn("Can't use fillGraph option with error bars")}var m=s.drawingContext;var n=s.color;var o=r.getOption("fillAlpha",f);var i=r.getOption("stepPlot",f);var p=s.points;var q=Dygraph.createIterator(p,0,p.length,DygraphCanvasRenderer._getIteratorPredicate(r.getOption("connectSeparatedPoints")));var j;var h=NaN;var c=NaN;var d=[-1,-1];var a=new RGBColorParser(n);var u="rgba("+a.r+","+a.g+","+a.b+","+o+")";m.fillStyle=u;m.beginPath();var b=function(e){return(e===null||e===undefined||isNaN(e))};while(q.hasNext){var l=q.next();if((!i&&b(l.y))||(i&&!isNaN(c)&&b(c))){h=NaN;continue}if(i){j=[l.y_bottom,l.y_top];c=l.y}else{j=[l.y_bottom,l.y_top]}j[0]=s.plotArea.h*j[0]+s.plotArea.y;j[1]=s.plotArea.h*j[1]+s.plotArea.y;if(!isNaN(h)){if(i){m.moveTo(h,d[0]);m.lineTo(l.canvasx,d[0]);m.lineTo(l.canvasx,d[1])}else{m.moveTo(h,d[0]);m.lineTo(l.canvasx,j[0]);m.lineTo(l.canvasx,j[1])}m.lineTo(h,d[1]);m.closePath()}d=j;h=l.canvasx}m.fill()};DygraphCanvasRenderer._fillPlotter=function(F){if(F.singleSeriesName){return}if(F.seriesIndex!==0){return}var D=F.dygraph;var I=D.getLabels().slice(1);for(var C=I.length;C>=0;C--){if(!D.visibility()[C]){I.splice(C,1)}}var h=(function(){for(var e=0;e<I.length;e++){if(D.getOption("fillGraph",I[e])){return true}}return false})();if(!h){return}var w=F.drawingContext;var E=F.plotArea;var c=F.allSeriesPoints;var z=c.length;var y=D.getOption("fillAlpha");var k=D.getOption("stackedGraph");var q=D.getColors();var s={};var a;var r;for(var u=z-1;u>=0;u--){var n=I[u];if(!D.getOption("fillGraph",n)){continue}var p=D.getOption("stepPlot",n);var x=q[u];var f=D.axisPropertiesForSeries(n);var d=1+f.minyval*f.yscale;if(d<0){d=0}else{if(d>1){d=1}}d=E.h*d+E.y;var B=c[u];var A=Dygraph.createIterator(B,0,B.length,DygraphCanvasRenderer._getIteratorPredicate(D.getOption("connectSeparatedPoints")));var m=NaN;var l=[-1,-1];var t;var b=new RGBColorParser(x);var H="rgba("+b.r+","+b.g+","+b.b+","+y+")";w.fillStyle=H;w.beginPath();var j,G=true;while(A.hasNext){var v=A.next();if(!Dygraph.isOK(v.y)){m=NaN;if(v.y_stacked!==null&&!isNaN(v.y_stacked)){s[v.canvasx]=E.h*v.y_stacked+E.y}continue}if(k){if(!G&&j==v.xval){continue}else{G=false;j=v.xval}a=s[v.canvasx];var o;if(a===undefined){o=d}else{if(r){o=a[0]}else{o=a}}t=[v.canvasy,o];if(p){if(l[0]===-1){s[v.canvasx]=[v.canvasy,d]}else{s[v.canvasx]=[v.canvasy,l[0]]}}else{s[v.canvasx]=v.canvasy}}else{t=[v.canvasy,d]}if(!isNaN(m)){w.moveTo(m,l[0]);if(p){w.lineTo(v.canvasx,l[0])}else{w.lineTo(v.canvasx,t[0])}if(r&&a){w.lineTo(v.canvasx,a[1])}else{w.lineTo(v.canvasx,t[1])}w.lineTo(m,l[1]);w.closePath()}l=t;m=v.canvasx}r=p;w.fill()}};"use strict";var Dygraph=function(d,c,b,a){this.is_initial_draw_=true;this.readyFns_=[];if(a!==undefined){this.warn("Using deprecated four-argument dygraph constructor");this.__old_init__(d,c,b,a)}else{this.__init__(d,c,b)}};Dygraph.NAME="Dygraph";Dygraph.VERSION="1.0.0";Dygraph.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};Dygraph.toString=function(){return this.__repr__()};Dygraph.DEFAULT_ROLL_PERIOD=1;Dygraph.DEFAULT_WIDTH=480;Dygraph.DEFAULT_HEIGHT=320;Dygraph.ANIMATION_STEPS=12;Dygraph.ANIMATION_DURATION=200;Dygraph.KMB_LABELS=["K","M","B","T","Q"];Dygraph.KMG2_BIG_LABELS=["k","M","G","T","P","E","Z","Y"];Dygraph.KMG2_SMALL_LABELS=["m","u","n","p","f","a","z","y"];Dygraph.numberValueFormatter=function(s,a,u,l){var e=a("sigFigs");if(e!==null){return Dygraph.floatFormat(s,e)}var c=a("digitsAfterDecimal");var o=a("maxNumberWidth");var b=a("labelsKMB");var r=a("labelsKMG2");var q;if(s!==0&&(Math.abs(s)>=Math.pow(10,o)||Math.abs(s)<Math.pow(10,-c))){q=s.toExponential(c)}else{q=""+Dygraph.round_(s,c)}if(b||r){var f;var t=[];var m=[];if(b){f=1000;t=Dygraph.KMB_LABELS}if(r){if(b){Dygraph.warn("Setting both labelsKMB and labelsKMG2. Pick one!")}f=1024;t=Dygraph.KMG2_BIG_LABELS;m=Dygraph.KMG2_SMALL_LABELS}var p=Math.abs(s);var d=Dygraph.pow(f,t.length);for(var h=t.length-1;h>=0;h--,d/=f){if(p>=d){q=Dygraph.round_(s/d,c)+t[h];break}}if(r){var i=String(s.toExponential()).split("e-");if(i.length===2&&i[1]>=3&&i[1]<=24){if(i[1]%3>0){q=Dygraph.round_(i[0]/Dygraph.pow(10,(i[1]%3)),c)}else{q=Number(i[0]).toFixed(2)}q+=m[Math.floor(i[1]/3)-1]}}}return q};Dygraph.numberAxisLabelFormatter=function(a,d,c,b){return Dygraph.numberValueFormatter(a,c,b)};Dygraph.dateString_=function(e){var i=Dygraph.zeropad;var h=new Date(e);var f=""+h.getFullYear();var g=i(h.getMonth()+1);var a=i(h.getDate());var c="";var b=h.getHours()*3600+h.getMinutes()*60+h.getSeconds();if(b){c=" "+Dygraph.hmsString_(e)}return f+"/"+g+"/"+a+c};Dygraph.dateAxisFormatter=function(b,c){if(c>=Dygraph.DECADAL){return b.strftime("%Y")}else{if(c>=Dygraph.MONTHLY){return b.strftime("%b %y")}else{var a=b.getHours()*3600+b.getMinutes()*60+b.getSeconds()+b.getMilliseconds();if(a===0||c>=Dygraph.DAILY){return new Date(b.getTime()+3600*1000).strftime("%d%b")}else{return Dygraph.hmsString_(b.getTime())}}}};Dygraph.Plotters=DygraphCanvasRenderer._Plotters;Dygraph.DEFAULT_ATTRS={highlightCircleSize:3,highlightSeriesOpts:null,highlightSeriesBackgroundAlpha:0.5,labelsDivWidth:250,labelsDivStyles:{},labelsSeparateLines:false,labelsShowZeroValues:true,labelsKMB:false,labelsKMG2:false,showLabelsOnHighlight:true,digitsAfterDecimal:2,maxNumberWidth:6,sigFigs:null,strokeWidth:1,strokeBorderWidth:0,strokeBorderColor:"white",axisTickSize:3,axisLabelFontSize:14,xAxisLabelWidth:50,yAxisLabelWidth:50,rightGap:5,showRoller:false,xValueParser:Dygraph.dateParser,delimiter:",",sigma:2,errorBars:false,fractions:false,wilsonInterval:true,customBars:false,fillGraph:false,fillAlpha:0.15,connectSeparatedPoints:false,stackedGraph:false,stackedGraphNaNFill:"all",hideOverlayOnMouseOut:true,legend:"onmouseover",stepPlot:false,avoidMinZero:false,xRangePad:0,yRangePad:null,drawAxesAtZero:false,titleHeight:28,xLabelHeight:18,yLabelWidth:18,drawXAxis:true,drawYAxis:true,axisLineColor:"black",axisLineWidth:0.3,gridLineWidth:0.3,axisLabelColor:"black",axisLabelFont:"Arial",axisLabelWidth:50,drawYGrid:true,drawXGrid:true,gridLineColor:"rgb(128,128,128)",interactionModel:null,animatedZooms:false,showRangeSelector:false,rangeSelectorHeight:40,rangeSelectorPlotStrokeColor:"#808FAB",rangeSelectorPlotFillColor:"#A7B1C4",plotter:[Dygraph.Plotters.fillPlotter,Dygraph.Plotters.errorPlotter,Dygraph.Plotters.linePlotter],plugins:[],axes:{x:{pixelsPerLabel:60,axisLabelFormatter:Dygraph.dateAxisFormatter,valueFormatter:Dygraph.dateString_,drawGrid:true,independentTicks:true,ticker:null},y:{pixelsPerLabel:30,valueFormatter:Dygraph.numberValueFormatter,axisLabelFormatter:Dygraph.numberAxisLabelFormatter,drawGrid:true,independentTicks:true,ticker:null},y2:{pixelsPerLabel:30,valueFormatter:Dygraph.numberValueFormatter,axisLabelFormatter:Dygraph.numberAxisLabelFormatter,drawGrid:false,independentTicks:false,ticker:null}}};Dygraph.HORIZONTAL=1;Dygraph.VERTICAL=2;Dygraph.PLUGINS=[];Dygraph.addedAnnotationCSS=false;Dygraph.prototype.__old_init__=function(f,d,e,b){if(e!==null){var a=["Date"];for(var c=0;c<e.length;c++){a.push(e[c])}Dygraph.update(b,{labels:a})}this.__init__(f,d,b)};Dygraph.prototype.__init__=function(a,c,l){if(/MSIE/.test(navigator.userAgent)&&!window.opera&&typeof(G_vmlCanvasManager)!="undefined"&&document.readyState!="complete"){var o=this;setTimeout(function(){o.__init__(a,c,l)},100);return}if(l===null||l===undefined){l={}}l=Dygraph.mapLegacyOptions_(l);if(typeof(a)=="string"){a=document.getElementById(a)}if(!a){Dygraph.error("Constructing dygraph with a non-existent div!");return}this.isUsingExcanvas_=typeof(G_vmlCanvasManager)!="undefined";this.maindiv_=a;this.file_=c;this.rollPeriod_=l.rollPeriod||Dygraph.DEFAULT_ROLL_PERIOD;this.previousVerticalX_=-1;this.fractions_=l.fractions||false;this.dateWindow_=l.dateWindow||null;this.annotations_=[];this.zoomed_x_=false;this.zoomed_y_=false;a.innerHTML="";if(a.style.width===""&&l.width){a.style.width=l.width+"px"}if(a.style.height===""&&l.height){a.style.height=l.height+"px"}if(a.style.height===""&&a.clientHeight===0){a.style.height=Dygraph.DEFAULT_HEIGHT+"px";if(a.style.width===""){a.style.width=Dygraph.DEFAULT_WIDTH+"px"}}this.width_=a.clientWidth||l.width||0;this.height_=a.clientHeight||l.height||0;if(l.stackedGraph){l.fillGraph=true}this.user_attrs_={};Dygraph.update(this.user_attrs_,l);this.attrs_={};Dygraph.updateDeep(this.attrs_,Dygraph.DEFAULT_ATTRS);this.boundaryIds_=[];this.setIndexByName_={};this.datasetIndex_=[];this.registeredEvents_=[];this.eventListeners_={};this.attributes_=new DygraphOptions(this);this.createInterface_();this.plugins_=[];var d=Dygraph.PLUGINS.concat(this.getOption("plugins"));for(var g=0;g<d.length;g++){var k=d[g];var f=new k();var j={plugin:f,events:{},options:{},pluginOptions:{}};var b=f.activate(this);for(var h in b){j.events[h]=b[h]}this.plugins_.push(j)}for(var g=0;g<this.plugins_.length;g++){var n=this.plugins_[g];for(var h in n.events){if(!n.events.hasOwnProperty(h)){continue}var m=n.events[h];var e=[n.plugin,m];if(!(h in this.eventListeners_)){this.eventListeners_[h]=[e]}else{this.eventListeners_[h].push(e)}}}this.createDragInterface_();this.start_()};Dygraph.prototype.cascadeEvents_=function(c,b){if(!(c in this.eventListeners_)){return true}var g={dygraph:this,cancelable:false,defaultPrevented:false,preventDefault:function(){if(!g.cancelable){throw"Cannot call preventDefault on non-cancelable event."}g.defaultPrevented=true},propagationStopped:false,stopPropagation:function(){g.propagationStopped=true}};Dygraph.update(g,b);var a=this.eventListeners_[c];if(a){for(var d=a.length-1;d>=0;d--){var f=a[d][0];var h=a[d][1];h.call(f,g);if(g.propagationStopped){break}}}return g.defaultPrevented};Dygraph.prototype.isZoomed=function(a){if(a===null||a===undefined){return this.zoomed_x_||this.zoomed_y_}if(a==="x"){return this.zoomed_x_}if(a==="y"){return this.zoomed_y_}throw"axis parameter is ["+a+"] must be null, 'x' or 'y'."};Dygraph.prototype.toString=function(){var a=this.maindiv_;var b=(a&&a.id)?a.id:a;return"[Dygraph "+b+"]"};Dygraph.prototype.attr_=function(b,a){return a?this.attributes_.getForSeries(b,a):this.attributes_.get(b)};Dygraph.prototype.getOption=function(a,b){return this.attr_(a,b)};Dygraph.prototype.getOptionForAxis=function(a,b){return this.attributes_.getForAxis(a,b)};Dygraph.prototype.optionsViewForAxis_=function(b){var a=this;return function(c){var d=a.user_attrs_.axes;if(d&&d[b]&&d[b].hasOwnProperty(c)){return d[b][c]}if(typeof(a.user_attrs_[c])!="undefined"){return a.user_attrs_[c]}d=a.attrs_.axes;if(d&&d[b]&&d[b].hasOwnProperty(c)){return d[b][c]}if(b=="y"&&a.axes_[0].hasOwnProperty(c)){return a.axes_[0][c]}else{if(b=="y2"&&a.axes_[1].hasOwnProperty(c)){return a.axes_[1][c]}}return a.attr_(c)}};Dygraph.prototype.rollPeriod=function(){return this.rollPeriod_};Dygraph.prototype.xAxisRange=function(){return this.dateWindow_?this.dateWindow_:this.xAxisExtremes()};Dygraph.prototype.xAxisExtremes=function(){var d=this.attr_("xRangePad")/this.plotter_.area.w;if(this.numRows()===0){return[0-d,1+d]}var c=this.rawData_[0][0];var b=this.rawData_[this.rawData_.length-1][0];if(d){var a=b-c;c-=a*d;b+=a*d}return[c,b]};Dygraph.prototype.yAxisRange=function(a){if(typeof(a)=="undefined"){a=0}if(a<0||a>=this.axes_.length){return null}var b=this.axes_[a];return[b.computedValueRange[0],b.computedValueRange[1]]};Dygraph.prototype.yAxisRanges=function(){var a=[];for(var b=0;b<this.axes_.length;b++){a.push(this.yAxisRange(b))}return a};Dygraph.prototype.toDomCoords=function(a,c,b){return[this.toDomXCoord(a),this.toDomYCoord(c,b)]};Dygraph.prototype.toDomXCoord=function(b){if(b===null){return null}var c=this.plotter_.area;var a=this.xAxisRange();return c.x+(b-a[0])/(a[1]-a[0])*c.w};Dygraph.prototype.toDomYCoord=function(d,a){var c=this.toPercentYCoord(d,a);if(c===null){return null}var b=this.plotter_.area;return b.y+c*b.h};Dygraph.prototype.toDataCoords=function(a,c,b){return[this.toDataXCoord(a),this.toDataYCoord(c,b)]};Dygraph.prototype.toDataXCoord=function(b){if(b===null){return null}var c=this.plotter_.area;var a=this.xAxisRange();return a[0]+(b-c.x)/c.w*(a[1]-a[0])};Dygraph.prototype.toDataYCoord=function(h,b){if(h===null){return null}var c=this.plotter_.area;var g=this.yAxisRange(b);if(typeof(b)=="undefined"){b=0}if(!this.axes_[b].logscale){return g[0]+(c.y+c.h-h)/c.h*(g[1]-g[0])}else{var f=(h-c.y)/c.h;var a=Dygraph.log10(g[1]);var e=a-(f*(a-Dygraph.log10(g[0])));var d=Math.pow(Dygraph.LOG_SCALE,e);return d}};Dygraph.prototype.toPercentYCoord=function(f,c){if(f===null){return null}if(typeof(c)=="undefined"){c=0}var e=this.yAxisRange(c);var d;var b=this.attributes_.getForAxis("logscale",c);if(!b){d=(e[1]-f)/(e[1]-e[0])}else{var a=Dygraph.log10(e[1]);d=(a-Dygraph.log10(f))/(a-Dygraph.log10(e[0]))}return d};Dygraph.prototype.toPercentXCoord=function(b){if(b===null){return null}var a=this.xAxisRange();return(b-a[0])/(a[1]-a[0])};Dygraph.prototype.numColumns=function(){if(!this.rawData_){return 0}return this.rawData_[0]?this.rawData_[0].length:this.attr_("labels").length};Dygraph.prototype.numRows=function(){if(!this.rawData_){return 0}return this.rawData_.length};Dygraph.prototype.getValue=function(b,a){if(b<0||b>this.rawData_.length){return null}if(a<0||a>this.rawData_[b].length){return null}return this.rawData_[b][a]};Dygraph.prototype.createInterface_=function(){var a=this.maindiv_;this.graphDiv=document.createElement("div");this.graphDiv.style.textAlign="left";a.appendChild(this.graphDiv);this.canvas_=Dygraph.createCanvas();this.canvas_.style.position="absolute";this.hidden_=this.createPlotKitCanvas_(this.canvas_);this.resizeElements_();this.canvas_ctx_=Dygraph.getContext(this.canvas_);this.hidden_ctx_=Dygraph.getContext(this.hidden_);this.graphDiv.appendChild(this.hidden_);this.graphDiv.appendChild(this.canvas_);this.mouseEventElement_=this.createMouseEventElement_();this.layout_=new DygraphLayout(this);var b=this;this.mouseMoveHandler_=function(c){b.mouseMove_(c)};this.mouseOutHandler_=function(f){var d=f.target||f.fromElement;var c=f.relatedTarget||f.toElement;if(Dygraph.isNodeContainedBy(d,b.graphDiv)&&!Dygraph.isNodeContainedBy(c,b.graphDiv)){b.mouseOut_(f)}};this.addAndTrackEvent(window,"mouseout",this.mouseOutHandler_);this.addAndTrackEvent(this.mouseEventElement_,"mousemove",this.mouseMoveHandler_);if(!this.resizeHandler_){this.resizeHandler_=function(c){b.resize()};this.addAndTrackEvent(window,"resize",this.resizeHandler_)}};Dygraph.prototype.resizeElements_=function(){this.graphDiv.style.width=this.width_+"px";this.graphDiv.style.height=this.height_+"px";this.canvas_.width=this.width_;this.canvas_.height=this.height_;this.canvas_.style.width=this.width_+"px";this.canvas_.style.height=this.height_+"px";this.hidden_.width=this.width_;this.hidden_.height=this.height_;this.hidden_.style.width=this.width_+"px";this.hidden_.style.height=this.height_+"px"};Dygraph.prototype.destroy=function(){this.canvas_ctx_.restore();this.hidden_ctx_.restore();var a=function(c){while(c.hasChildNodes()){a(c.firstChild);c.removeChild(c.firstChild)}};this.removeTrackedEvents_();Dygraph.removeEvent(window,"mouseout",this.mouseOutHandler_);Dygraph.removeEvent(this.mouseEventElement_,"mousemove",this.mouseMoveHandler_);Dygraph.removeEvent(window,"resize",this.resizeHandler_);this.resizeHandler_=null;a(this.maindiv_);var b=function(c){for(var d in c){if(typeof(c[d])==="object"){c[d]=null}}};b(this.layout_);b(this.plotter_);b(this)};Dygraph.prototype.createPlotKitCanvas_=function(a){var b=Dygraph.createCanvas();b.style.position="absolute";b.style.top=a.style.top;b.style.left=a.style.left;b.width=this.width_;b.height=this.height_;b.style.width=this.width_+"px";b.style.height=this.height_+"px";return b};Dygraph.prototype.createMouseEventElement_=function(){if(this.isUsingExcanvas_){var a=document.createElement("div");a.style.position="absolute";a.style.backgroundColor="white";a.style.filter="alpha(opacity=0)";a.style.width=this.width_+"px";a.style.height=this.height_+"px";this.graphDiv.appendChild(a);return a}else{return this.canvas_}};Dygraph.prototype.setColors_=function(){var g=this.getLabels();var e=g.length-1;this.colors_=[];this.colorsMap_={};var a=this.attr_("colors");var d;if(!a){var c=this.attr_("colorSaturation")||1;var b=this.attr_("colorValue")||0.5;var k=Math.ceil(e/2);for(d=1;d<=e;d++){if(!this.visibility()[d-1]){continue}var h=d%2?Math.ceil(d/2):(k+d/2);var f=(1*h/(1+e));var j=Dygraph.hsvToRGB(f,c,b);this.colors_.push(j);this.colorsMap_[g[d]]=j}}else{for(d=0;d<e;d++){if(!this.visibility()[d]){continue}var j=a[d%a.length];this.colors_.push(j);this.colorsMap_[g[1+d]]=j}}};Dygraph.prototype.getColors=function(){return this.colors_};Dygraph.prototype.getPropertiesForSeries=function(c){var a=-1;var d=this.getLabels();for(var b=1;b<d.length;b++){if(d[b]==c){a=b;break}}if(a==-1){return null}return{name:c,column:a,visible:this.visibility()[a-1],color:this.colorsMap_[c],axis:1+this.attributes_.axisForSeries(c)}};Dygraph.prototype.createRollInterface_=function(){if(!this.roller_){this.roller_=document.createElement("input");this.roller_.type="text";this.roller_.style.display="none";this.graphDiv.appendChild(this.roller_)}var e=this.attr_("showRoller")?"block":"none";var d=this.plotter_.area;var b={position:"absolute",zIndex:10,top:(d.y+d.h-25)+"px",left:(d.x+1)+"px",display:e};this.roller_.size="2";this.roller_.value=this.rollPeriod_;for(var a in b){if(b.hasOwnProperty(a)){this.roller_.style[a]=b[a]}}var c=this;this.roller_.onchange=function(){c.adjustRoll(c.roller_.value)}};Dygraph.prototype.dragGetX_=function(b,a){return Dygraph.pageX(b)-a.px};Dygraph.prototype.dragGetY_=function(b,a){return Dygraph.pageY(b)-a.py};Dygraph.prototype.createDragInterface_=function(){var c={isZooming:false,isPanning:false,is2DPan:false,dragStartX:null,dragStartY:null,dragEndX:null,dragEndY:null,dragDirection:null,prevEndX:null,prevEndY:null,prevDragDirection:null,cancelNextDblclick:false,initialLeftmostDate:null,xUnitsPerPixel:null,dateRange:null,px:0,py:0,boundedDates:null,boundedValues:null,tarp:new Dygraph.IFrameTarp(),initializeMouseDown:function(j,i,h){if(j.preventDefault){j.preventDefault()}else{j.returnValue=false;j.cancelBubble=true}h.px=Dygraph.findPosX(i.canvas_);h.py=Dygraph.findPosY(i.canvas_);h.dragStartX=i.dragGetX_(j,h);h.dragStartY=i.dragGetY_(j,h);h.cancelNextDblclick=false;h.tarp.cover()}};var f=this.attr_("interactionModel");var b=this;var e=function(g){return function(h){g(h,b,c)}};for(var a in f){if(!f.hasOwnProperty(a)){continue}this.addAndTrackEvent(this.mouseEventElement_,a,e(f[a]))}var d=function(h){if(c.isZooming||c.isPanning){c.isZooming=false;c.dragStartX=null;c.dragStartY=null}if(c.isPanning){c.isPanning=false;c.draggingDate=null;c.dateRange=null;for(var g=0;g<b.axes_.length;g++){delete b.axes_[g].draggingValue;delete b.axes_[g].dragValueRange}}c.tarp.uncover()};this.addAndTrackEvent(document,"mouseup",d)};Dygraph.prototype.drawZoomRect_=function(e,c,i,b,g,a,f,d){var h=this.canvas_ctx_;if(a==Dygraph.HORIZONTAL){h.clearRect(Math.min(c,f),this.layout_.getPlotArea().y,Math.abs(c-f),this.layout_.getPlotArea().h)}else{if(a==Dygraph.VERTICAL){h.clearRect(this.layout_.getPlotArea().x,Math.min(b,d),this.layout_.getPlotArea().w,Math.abs(b-d))}}if(e==Dygraph.HORIZONTAL){if(i&&c){h.fillStyle="rgba(128,128,128,0.33)";h.fillRect(Math.min(c,i),this.layout_.getPlotArea().y,Math.abs(i-c),this.layout_.getPlotArea().h)}}else{if(e==Dygraph.VERTICAL){if(g&&b){h.fillStyle="rgba(128,128,128,0.33)";h.fillRect(this.layout_.getPlotArea().x,Math.min(b,g),this.layout_.getPlotArea().w,Math.abs(g-b))}}}if(this.isUsingExcanvas_){this.currentZoomRectArgs_=[e,c,i,b,g,0,0,0]}};Dygraph.prototype.clearZoomRect_=function(){this.currentZoomRectArgs_=null;this.canvas_ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height)};Dygraph.prototype.doZoomX_=function(c,a){this.currentZoomRectArgs_=null;var b=this.toDataXCoord(c);var d=this.toDataXCoord(a);this.doZoomXDates_(b,d)};Dygraph.zoomAnimationFunction=function(c,b){var a=1.5;return(1-Math.pow(a,-c))/(1-Math.pow(a,-b))};Dygraph.prototype.doZoomXDates_=function(c,e){var a=this.xAxisRange();var d=[c,e];this.zoomed_x_=true;var b=this;this.doAnimatedZoom(a,d,null,null,function(){if(b.attr_("zoomCallback")){b.attr_("zoomCallback")(c,e,b.yAxisRanges())}})};Dygraph.prototype.doZoomY_=function(h,f){this.currentZoomRectArgs_=null;var c=this.yAxisRanges();var b=[];for(var e=0;e<this.axes_.length;e++){var d=this.toDataYCoord(h,e);var a=this.toDataYCoord(f,e);b.push([a,d])}this.zoomed_y_=true;var g=this;this.doAnimatedZoom(null,null,c,b,function(){if(g.attr_("zoomCallback")){var i=g.xAxisRange();g.attr_("zoomCallback")(i[0],i[1],g.yAxisRanges())}})};Dygraph.prototype.resetZoom=function(){var c=false,d=false,a=false;if(this.dateWindow_!==null){c=true;d=true}for(var g=0;g<this.axes_.length;g++){if(typeof(this.axes_[g].valueWindow)!=="undefined"&&this.axes_[g].valueWindow!==null){c=true;a=true}}this.clearSelection();if(c){this.zoomed_x_=false;this.zoomed_y_=false;var f=this.rawData_[0][0];var b=this.rawData_[this.rawData_.length-1][0];if(!this.attr_("animatedZooms")){this.dateWindow_=null;for(g=0;g<this.axes_.length;g++){if(this.axes_[g].valueWindow!==null){delete this.axes_[g].valueWindow}}this.drawGraph_();if(this.attr_("zoomCallback")){this.attr_("zoomCallback")(f,b,this.yAxisRanges())}return}var l=null,m=null,k=null,h=null;if(d){l=this.xAxisRange();m=[f,b]}if(a){k=this.yAxisRanges();var n=this.gatherDatasets_(this.rolledSeries_,null);var o=n.extremes;this.computeYAxisRanges_(o);h=[];for(g=0;g<this.axes_.length;g++){var e=this.axes_[g];h.push((e.valueRange!==null&&e.valueRange!==undefined)?e.valueRange:e.extremeRange)}}var j=this;this.doAnimatedZoom(l,m,k,h,function(){j.dateWindow_=null;for(var p=0;p<j.axes_.length;p++){if(j.axes_[p].valueWindow!==null){delete j.axes_[p].valueWindow}}if(j.attr_("zoomCallback")){j.attr_("zoomCallback")(f,b,j.yAxisRanges())}})}};Dygraph.prototype.doAnimatedZoom=function(a,e,b,c,m){var i=this.attr_("animatedZooms")?Dygraph.ANIMATION_STEPS:1;var l=[];var k=[];var f,d;if(a!==null&&e!==null){for(f=1;f<=i;f++){d=Dygraph.zoomAnimationFunction(f,i);l[f-1]=[a[0]*(1-d)+d*e[0],a[1]*(1-d)+d*e[1]]}}if(b!==null&&c!==null){for(f=1;f<=i;f++){d=Dygraph.zoomAnimationFunction(f,i);var n=[];for(var g=0;g<this.axes_.length;g++){n.push([b[g][0]*(1-d)+d*c[g][0],b[g][1]*(1-d)+d*c[g][1]])}k[f-1]=n}}var h=this;Dygraph.repeatAndCleanup(function(p){if(k.length){for(var o=0;o<h.axes_.length;o++){var j=k[p][o];h.axes_[o].valueWindow=[j[0],j[1]]}}if(l.length){h.dateWindow_=l[p]}h.drawGraph_()},i,Dygraph.ANIMATION_DURATION/i,m)};Dygraph.prototype.getArea=function(){return this.plotter_.area};Dygraph.prototype.eventToDomCoords=function(c){if(c.offsetX&&c.offsetY){return[c.offsetX,c.offsetY]}else{var b=Dygraph.pageX(c)-Dygraph.findPosX(this.mouseEventElement_);var a=Dygraph.pageY(c)-Dygraph.findPosY(this.mouseEventElement_);return[b,a]}};Dygraph.prototype.findClosestRow=function(a){var g=Infinity;var h=-1;var e=this.layout_.points;for(var c=0;c<e.length;c++){var l=e[c];var d=l.length;for(var b=0;b<d;b++){var k=l[b];if(!Dygraph.isValidPoint(k,true)){continue}var f=Math.abs(k.canvasx-a);if(f<g){g=f;h=k.idx}}}return h};Dygraph.prototype.findClosestPoint=function(f,e){var k=Infinity;var h,o,n,l,d,c,j;for(var b=this.layout_.points.length-1;b>=0;--b){var m=this.layout_.points[b];for(var g=0;g<m.length;++g){l=m[g];if(!Dygraph.isValidPoint(l)){continue}o=l.canvasx-f;n=l.canvasy-e;h=o*o+n*n;if(h<k){k=h;d=l;c=b;j=l.idx}}}var a=this.layout_.setNames[c];return{row:j,seriesName:a,point:d}};Dygraph.prototype.findStackedPoint=function(i,h){var p=this.findClosestRow(i);var f,c;for(var d=0;d<this.layout_.points.length;++d){var g=this.getLeftBoundary_(d);var e=p-g;var l=this.layout_.points[d];if(e>=l.length){continue}var m=l[e];if(!Dygraph.isValidPoint(m)){continue}var j=m.canvasy;if(i>m.canvasx&&e+1<l.length){var k=l[e+1];if(Dygraph.isValidPoint(k)){var o=k.canvasx-m.canvasx;if(o>0){var a=(i-m.canvasx)/o;j+=a*(k.canvasy-m.canvasy)}}}else{if(i<m.canvasx&&e>0){var n=l[e-1];if(Dygraph.isValidPoint(n)){var o=m.canvasx-n.canvasx;if(o>0){var a=(m.canvasx-i)/o;j+=a*(n.canvasy-m.canvasy)}}}}if(d===0||j<h){f=m;c=d}}var b=this.layout_.setNames[c];return{row:p,seriesName:b,point:f}};Dygraph.prototype.mouseMove_=function(b){var h=this.layout_.points;if(h===undefined||h===null){return}var e=this.eventToDomCoords(b);var a=e[0];var j=e[1];var f=this.attr_("highlightSeriesOpts");var d=false;if(f&&!this.isSeriesLocked()){var c;if(this.attr_("stackedGraph")){c=this.findStackedPoint(a,j)}else{c=this.findClosestPoint(a,j)}d=this.setSelection(c.row,c.seriesName)}else{var g=this.findClosestRow(a);d=this.setSelection(g)}var i=this.attr_("highlightCallback");if(i&&d){i(b,this.lastx_,this.selPoints_,this.lastRow_,this.highlightSet_)}};Dygraph.prototype.getLeftBoundary_=function(b){if(this.boundaryIds_[b]){return this.boundaryIds_[b][0]}else{for(var a=0;a<this.boundaryIds_.length;a++){if(this.boundaryIds_[a]!==undefined){return this.boundaryIds_[a][0]}}return 0}};Dygraph.prototype.animateSelection_=function(f){var e=10;var c=30;if(this.fadeLevel===undefined){this.fadeLevel=0}if(this.animateId===undefined){this.animateId=0}var g=this.fadeLevel;var b=f<0?g:e-g;if(b<=0){if(this.fadeLevel){this.updateSelection_(1)}return}var a=++this.animateId;var d=this;Dygraph.repeatAndCleanup(function(h){if(d.animateId!=a){return}d.fadeLevel+=f;if(d.fadeLevel===0){d.clearSelection()}else{d.updateSelection_(d.fadeLevel/e)}},b,c,function(){})};Dygraph.prototype.updateSelection_=function(d){this.cascadeEvents_("select",{selectedX:this.lastx_,selectedPoints:this.selPoints_});var h;var n=this.canvas_ctx_;if(this.attr_("highlightSeriesOpts")){n.clearRect(0,0,this.width_,this.height_);var f=1-this.attr_("highlightSeriesBackgroundAlpha");if(f){var g=true;if(g){if(d===undefined){this.animateSelection_(1);return}f*=d}n.fillStyle="rgba(255,255,255,"+f+")";n.fillRect(0,0,this.width_,this.height_)}this.plotter_._renderLineChart(this.highlightSet_,n)}else{if(this.previousVerticalX_>=0){var j=0;var k=this.attr_("labels");for(h=1;h<k.length;h++){var c=this.attr_("highlightCircleSize",k[h]);if(c>j){j=c}}var l=this.previousVerticalX_;n.clearRect(l-j-1,0,2*j+2,this.height_)}}if(this.isUsingExcanvas_&&this.currentZoomRectArgs_){Dygraph.prototype.drawZoomRect_.apply(this,this.currentZoomRectArgs_)}if(this.selPoints_.length>0){var b=this.selPoints_[0].canvasx;n.save();for(h=0;h<this.selPoints_.length;h++){var o=this.selPoints_[h];if(!Dygraph.isOK(o.canvasy)){continue}var a=this.attr_("highlightCircleSize",o.name);var m=this.attr_("drawHighlightPointCallback",o.name);var e=this.plotter_.colors[o.name];if(!m){m=Dygraph.Circles.DEFAULT}n.lineWidth=this.attr_("strokeWidth",o.name);n.strokeStyle=e;n.fillStyle=e;m(this.g,o.name,n,b,o.canvasy,e,a,o.idx)}n.restore();this.previousVerticalX_=b}};Dygraph.prototype.setSelection=function(f,h,g){this.selPoints_=[];var e=false;if(f!==false&&f>=0){if(f!=this.lastRow_){e=true}this.lastRow_=f;for(var d=0;d<this.layout_.points.length;++d){var b=this.layout_.points[d];var c=f-this.getLeftBoundary_(d);if(c<b.length){var a=b[c];if(a.yval!==null){this.selPoints_.push(a)}}}}else{if(this.lastRow_>=0){e=true}this.lastRow_=-1}if(this.selPoints_.length){this.lastx_=this.selPoints_[0].xval}else{this.lastx_=-1}if(h!==undefined){if(this.highlightSet_!==h){e=true}this.highlightSet_=h}if(g!==undefined){this.lockedSet_=g}if(e){this.updateSelection_(undefined)}return e};Dygraph.prototype.mouseOut_=function(a){if(this.attr_("unhighlightCallback")){this.attr_("unhighlightCallback")(a)}if(this.attr_("hideOverlayOnMouseOut")&&!this.lockedSet_){this.clearSelection()}};Dygraph.prototype.clearSelection=function(){this.cascadeEvents_("deselect",{});this.lockedSet_=false;if(this.fadeLevel){this.animateSelection_(-1);return}this.canvas_ctx_.clearRect(0,0,this.width_,this.height_);this.fadeLevel=0;this.selPoints_=[];this.lastx_=-1;this.lastRow_=-1;this.highlightSet_=null};Dygraph.prototype.getSelection=function(){if(!this.selPoints_||this.selPoints_.length<1){return -1}for(var c=0;c<this.layout_.points.length;c++){var a=this.layout_.points[c];for(var b=0;b<a.length;b++){if(a[b].x==this.selPoints_[0].x){return a[b].idx}}}return -1};Dygraph.prototype.getHighlightSeries=function(){return this.highlightSet_};Dygraph.prototype.isSeriesLocked=function(){return this.lockedSet_};Dygraph.prototype.loadedEvent_=function(a){this.rawData_=this.parseCSV_(a);this.predraw_()};Dygraph.prototype.addXTicks_=function(){var a;if(this.dateWindow_){a=[this.dateWindow_[0],this.dateWindow_[1]]}else{a=this.xAxisExtremes()}var c=this.optionsViewForAxis_("x");var b=c("ticker")(a[0],a[1],this.width_,c,this);this.layout_.setXTicks(b)};Dygraph.prototype.extremeValues_=function(d){var h=null,f=null,c,g;var b=this.attr_("errorBars")||this.attr_("customBars");if(b){for(c=0;c<d.length;c++){g=d[c][1][0];if(g===null||isNaN(g)){continue}var a=g-d[c][1][1];var e=g+d[c][1][2];if(a>g){a=g}if(e<g){e=g}if(f===null||e>f){f=e}if(h===null||a<h){h=a}}}else{for(c=0;c<d.length;c++){g=d[c][1];if(g===null||isNaN(g)){continue}if(f===null||g>f){f=g}if(h===null||g<h){h=g}}}return[h,f]};Dygraph.prototype.predraw_=function(){var e=new Date();this.layout_.computePlotArea();this.computeYAxes_();if(this.plotter_){this.cascadeEvents_("clearChart");this.plotter_.clear()}if(!this.is_initial_draw_){this.canvas_ctx_.restore();this.hidden_ctx_.restore()}this.canvas_ctx_.save();this.hidden_ctx_.save();this.plotter_=new DygraphCanvasRenderer(this,this.hidden_,this.hidden_ctx_,this.layout_);this.createRollInterface_();this.cascadeEvents_("predraw");this.rolledSeries_=[null];for(var c=1;c<this.numColumns();c++){var d=this.attr_("logscale");var b=this.extractSeries_(this.rawData_,c,d);b=this.rollingAverage(b,this.rollPeriod_);this.rolledSeries_.push(b)}this.drawGraph_();var a=new Date();this.drawingTimeMs_=(a-e)};Dygraph.PointType=undefined;Dygraph.seriesToPoints_=function(b,j,d,f){var h=[];for(var c=0;c<b.length;++c){var k=b[c];var a=j?k[1][0]:k[1];var e=a===null?null:DygraphLayout.parseFloat_(a);var g={x:NaN,y:NaN,xval:DygraphLayout.parseFloat_(k[0]),yval:e,name:d,idx:c+f};if(j){g.y_top=NaN;g.y_bottom=NaN;g.yval_minus=DygraphLayout.parseFloat_(k[1][1]);g.yval_plus=DygraphLayout.parseFloat_(k[1][2])}h.push(g)}return h};Dygraph.stackPoints_=function(m,l,o,f){var h=null;var d=null;var g=null;var c=-1;var k=function(i){if(c>=i){return}for(var p=i;p<m.length;++p){g=null;if(!isNaN(m[p].yval)&&m[p].yval!==null){c=p;g=m[p];break}}};for(var b=0;b<m.length;++b){var j=m[b];var n=j.xval;if(l[n]===undefined){l[n]=0}var e=j.yval;if(isNaN(e)||e===null){k(b);if(d&&g&&f!="none"){e=d.yval+(g.yval-d.yval)*((n-d.xval)/(g.xval-d.xval))}else{if(d&&f=="all"){e=d.yval}else{if(g&&f=="all"){e=g.yval}else{e=0}}}}else{d=j}var a=l[n];if(h!=n){a+=e;l[n]=a}h=n;j.yval_stacked=a;if(a>o[1]){o[1]=a}if(a<o[0]){o[0]=a}}};Dygraph.prototype.gatherDatasets_=function(w,f){var s=[];var t=[];var q=[];var a={};var u,r;var x=this.attr_("errorBars");var h=this.attr_("customBars");var p=x||h;var b=function(i){if(!p){return i[1]===null}else{return h?i[1][1]===null:x?i[1][0]===null:false}};var n=w.length-1;var l;for(u=n;u>=1;u--){if(!this.visibility()[u-1]){continue}if(f){l=w[u];var z=f[0];var j=f[1];var g=null,y=null;for(r=0;r<l.length;r++){if(l[r][0]>=z&&g===null){g=r}if(l[r][0]<=j){y=r}}if(g===null){g=0}var e=g;var d=true;while(d&&e>0){e--;d=b(l[e])}if(y===null){y=l.length-1}var c=y;d=true;while(d&&c<l.length-1){c++;d=b(l[c])}if(e!==g){g=e}if(c!==y){y=c}s[u-1]=[g,y];l=l.slice(g,y+1)}else{l=w[u];s[u-1]=[0,l.length-1]}var v=this.attr_("labels")[u];var o=this.extremeValues_(l);var m=Dygraph.seriesToPoints_(l,p,v,s[u-1][0]);if(this.attr_("stackedGraph")){Dygraph.stackPoints_(m,q,o,this.attr_("stackedGraphNaNFill"))}a[v]=o;t[u]=m}return{points:t,extremes:a,boundaryIds:s}};Dygraph.prototype.drawGraph_=function(){var a=new Date();var d=this.is_initial_draw_;this.is_initial_draw_=false;this.layout_.removeAllDatasets();this.setColors_();this.attrs_.pointSize=0.5*this.attr_("highlightCircleSize");var j=this.gatherDatasets_(this.rolledSeries_,this.dateWindow_);var h=j.points;var k=j.extremes;this.boundaryIds_=j.boundaryIds;this.setIndexByName_={};var g=this.attr_("labels");if(g.length>0){this.setIndexByName_[g[0]]=0}var e=0;for(var f=1;f<h.length;f++){this.setIndexByName_[g[f]]=f;if(!this.visibility()[f-1]){continue}this.layout_.addDataset(g[f],h[f]);this.datasetIndex_[f]=e++}this.computeYAxisRanges_(k);this.layout_.setYAxes(this.axes_);this.addXTicks_();var b=this.zoomed_x_;this.zoomed_x_=b;this.layout_.evaluate();this.renderGraph_(d);if(this.attr_("timingName")){var c=new Date();Dygraph.info(this.attr_("timingName")+" - drawGraph: "+(c-a)+"ms")}};Dygraph.prototype.renderGraph_=function(b){this.cascadeEvents_("clearChart");this.plotter_.clear();if(this.attr_("underlayCallback")){this.attr_("underlayCallback")(this.hidden_ctx_,this.layout_.getPlotArea(),this,this)}var c={canvas:this.hidden_,drawingContext:this.hidden_ctx_};this.cascadeEvents_("willDrawChart",c);this.plotter_.render();this.cascadeEvents_("didDrawChart",c);this.lastRow_=-1;this.canvas_.getContext("2d").clearRect(0,0,this.canvas_.width,this.canvas_.height);if(this.attr_("drawCallback")!==null){this.attr_("drawCallback")(this,b)}if(b){this.readyFired_=true;while(this.readyFns_.length>0){var a=this.readyFns_.pop();a(this)}}};Dygraph.prototype.computeYAxes_=function(){var b,d,c,f,a;if(this.axes_!==undefined&&this.user_attrs_.hasOwnProperty("valueRange")===false){b=[];for(c=0;c<this.axes_.length;c++){b.push(this.axes_[c].valueWindow)}}this.axes_=[];for(d=0;d<this.attributes_.numAxes();d++){f={g:this};Dygraph.update(f,this.attributes_.axisOptions(d));this.axes_[d]=f}a=this.attr_("valueRange");if(a){this.axes_[0].valueRange=a}if(b!==undefined){var e=Math.min(b.length,this.axes_.length);for(c=0;c<e;c++){this.axes_[c].valueWindow=b[c]}}for(d=0;d<this.axes_.length;d++){if(d===0){f=this.optionsViewForAxis_("y"+(d?"2":""));a=f("valueRange");if(a){this.axes_[d].valueRange=a}}else{var g=this.user_attrs_.axes;if(g&&g.y2){a=g.y2.valueRange;if(a){this.axes_[d].valueRange=a}}}}};Dygraph.prototype.numAxes=function(){return this.attributes_.numAxes()};Dygraph.prototype.axisPropertiesForSeries=function(a){return this.axes_[this.attributes_.axisForSeries(a)]};Dygraph.prototype.computeYAxisRanges_=function(a){var g=function(i){return isNaN(parseFloat(i))};var q=this.attributes_.numAxes();var b,x,o,B;var p;for(var y=0;y<q;y++){var c=this.axes_[y];var C=this.attributes_.getForAxis("logscale",y);var G=this.attributes_.getForAxis("includeZero",y);var l=this.attributes_.getForAxis("independentTicks",y);o=this.attributes_.seriesForAxis(y);b=true;B=0.1;if(this.attr_("yRangePad")!==null){b=false;B=this.attr_("yRangePad")/this.plotter_.area.h}if(o.length===0){c.extremeRange=[0,1]}else{var D=Infinity;var A=-Infinity;var t,s;for(var w=0;w<o.length;w++){if(!a.hasOwnProperty(o[w])){continue}t=a[o[w]][0];if(t!==null){D=Math.min(t,D)}s=a[o[w]][1];if(s!==null){A=Math.max(s,A)}}if(G&&!C){if(D>0){D=0}if(A<0){A=0}}if(D==Infinity){D=0}if(A==-Infinity){A=1}x=A-D;if(x===0){if(A!==0){x=Math.abs(A)}else{A=1;x=1}}var h,H;if(C){if(b){h=A+B*x;H=D}else{var E=Math.exp(Math.log(x)*B);h=A*E;H=D/E}}else{h=A+B*x;H=D-B*x;if(b&&!this.attr_("avoidMinZero")){if(H<0&&D>=0){H=0}if(h>0&&A<=0){h=0}}}c.extremeRange=[H,h]}if(c.valueWindow){c.computedValueRange=[c.valueWindow[0],c.valueWindow[1]]}else{if(c.valueRange){var e=g(c.valueRange[0])?c.extremeRange[0]:c.valueRange[0];var d=g(c.valueRange[1])?c.extremeRange[1]:c.valueRange[1];if(!b){if(c.logscale){var E=Math.exp(Math.log(x)*B);e*=E;d/=E}else{x=d-e;e-=x*B;d+=x*B}}c.computedValueRange=[e,d]}else{c.computedValueRange=c.extremeRange}}if(l){c.independentTicks=l;var r=this.optionsViewForAxis_("y"+(y?"2":""));var F=r("ticker");c.ticks=F(c.computedValueRange[0],c.computedValueRange[1],this.height_,r,this);if(!p){p=c}}}if(p===undefined){throw ('Configuration Error: At least one axis has to have the "independentTicks" option activated.')}for(var y=0;y<q;y++){var c=this.axes_[y];if(!c.independentTicks){var r=this.optionsViewForAxis_("y"+(y?"2":""));var F=r("ticker");var m=p.ticks;var n=p.computedValueRange[1]-p.computedValueRange[0];var I=c.computedValueRange[1]-c.computedValueRange[0];var f=[];for(var v=0;v<m.length;v++){var u=(m[v].v-p.computedValueRange[0])/n;var z=c.computedValueRange[0]+u*I;f.push(z)}c.ticks=F(c.computedValueRange[0],c.computedValueRange[1],this.height_,r,this,f)}}};Dygraph.prototype.extractSeries_=function(a,f,c){var g=[];var h=this.attr_("errorBars");var e=this.attr_("customBars");for(var d=0;d<a.length;d++){var l=a[d][0];var m=a[d][f];if(c){if(h||e){for(var b=0;b<m.length;b++){if(m[b]<=0){m=null;break}}}else{if(m<=0){m=null}}}if(m!==null){g.push([l,m])}else{g.push([l,h?[null,null]:e?[null,null,null]:m])}}return g};Dygraph.prototype.rollingAverage=function(l,d){d=Math.min(d,l.length);var b=[];var t=this.attr_("sigma");var G,o,z,x,m,c,F,A;if(this.fractions_){var k=0;var h=0;var e=100;for(z=0;z<l.length;z++){k+=l[z][1][0];h+=l[z][1][1];if(z-d>=0){k-=l[z-d][1][0];h-=l[z-d][1][1]}var C=l[z][0];var w=h?k/h:0;if(this.attr_("errorBars")){if(this.attr_("wilsonInterval")){if(h){var s=w<0?0:w,u=h;var B=t*Math.sqrt(s*(1-s)/u+t*t/(4*u*u));var a=1+t*t/h;G=(s+t*t/(2*h)-B)/a;o=(s+t*t/(2*h)+B)/a;b[z]=[C,[s*e,(s-G)*e,(o-s)*e]]}else{b[z]=[C,[0,0,0]]}}else{A=h?t*Math.sqrt(w*(1-w)/h):1;b[z]=[C,[e*w,e*A,e*A]]}}else{b[z]=[C,e*w]}}}else{if(this.attr_("customBars")){G=0;var D=0;o=0;var g=0;for(z=0;z<l.length;z++){var E=l[z][1];m=E[1];b[z]=[l[z][0],[m,m-E[0],E[2]-m]];if(m!==null&&!isNaN(m)){G+=E[0];D+=m;o+=E[2];g+=1}if(z-d>=0){var r=l[z-d];if(r[1][1]!==null&&!isNaN(r[1][1])){G-=r[1][0];D-=r[1][1];o-=r[1][2];g-=1}}if(g){b[z]=[l[z][0],[1*D/g,1*(D-G)/g,1*(o-D)/g]]}else{b[z]=[l[z][0],[null,null,null]]}}}else{if(!this.attr_("errorBars")){if(d==1){return l}for(z=0;z<l.length;z++){c=0;F=0;for(x=Math.max(0,z-d+1);x<z+1;x++){m=l[x][1];if(m===null||isNaN(m)){continue}F++;c+=l[x][1]}if(F){b[z]=[l[z][0],c/F]}else{b[z]=[l[z][0],null]}}}else{for(z=0;z<l.length;z++){c=0;var f=0;F=0;for(x=Math.max(0,z-d+1);x<z+1;x++){m=l[x][1][0];if(m===null||isNaN(m)){continue}F++;c+=l[x][1][0];f+=Math.pow(l[x][1][1],2)}if(F){A=Math.sqrt(f)/F;b[z]=[l[z][0],[c/F,t*A,t*A]]}else{var q=(d==1)?l[z][1][0]:null;b[z]=[l[z][0],[q,q,q]]}}}}}return b};Dygraph.prototype.detectTypeFromString_=function(b){var a=false;var c=b.indexOf("-");if((c>0&&(b[c-1]!="e"&&b[c-1]!="E"))||b.indexOf("/")>=0||isNaN(parseFloat(b))){a=true}else{if(b.length==8&&b>"19700101"&&b<"20371231"){a=true}}this.setXAxisOptions_(a)};Dygraph.prototype.setXAxisOptions_=function(a){if(a){this.attrs_.xValueParser=Dygraph.dateParser;this.attrs_.axes.x.valueFormatter=Dygraph.dateString_;this.attrs_.axes.x.ticker=Dygraph.dateTicker;this.attrs_.axes.x.axisLabelFormatter=Dygraph.dateAxisFormatter}else{this.attrs_.xValueParser=function(b){return parseFloat(b)};this.attrs_.axes.x.valueFormatter=function(b){return b};this.attrs_.axes.x.ticker=Dygraph.numericLinearTicks;this.attrs_.axes.x.axisLabelFormatter=this.attrs_.axes.x.valueFormatter}};Dygraph.prototype.parseFloat_=function(a,c,b){var e=parseFloat(a);if(!isNaN(e)){return e}if(/^ *$/.test(a)){return null}if(/^ *nan *$/i.test(a)){return NaN}var d="Unable to parse '"+a+"' as a number";if(b!==null&&c!==null){d+=" on line "+(1+c)+" ('"+b+"') of CSV."}this.error(d);return null};Dygraph.prototype.parseCSV_=function(t){var r=[];var s=Dygraph.detectLineDelimiter(t);var a=t.split(s||"\n");var g,k;var p=this.attr_("delimiter");if(a[0].indexOf(p)==-1&&a[0].indexOf("\t")>=0){p="\t"}var b=0;if(!("labels" in this.user_attrs_)){b=1;this.attrs_.labels=a[0].split(p);this.attributes_.reparseSeries()}var o=0;var m;var q=false;var c=this.attr_("labels").length;var f=false;for(var l=b;l<a.length;l++){var e=a[l];o=l;if(e.length===0){continue}if(e[0]=="#"){continue}var d=e.split(p);if(d.length<2){continue}var h=[];if(!q){this.detectTypeFromString_(d[0]);m=this.attr_("xValueParser");q=true}h[0]=m(d[0],this);if(this.fractions_){for(k=1;k<d.length;k++){g=d[k].split("/");if(g.length!=2){this.error('Expected fractional "num/den" values in CSV data but found a value \''+d[k]+"' on line "+(1+l)+" ('"+e+"') which is not of this form.");h[k]=[0,0]}else{h[k]=[this.parseFloat_(g[0],l,e),this.parseFloat_(g[1],l,e)]}}}else{if(this.attr_("errorBars")){if(d.length%2!=1){this.error("Expected alternating (value, stdev.) pairs in CSV data but line "+(1+l)+" has an odd number of values ("+(d.length-1)+"): '"+e+"'")}for(k=1;k<d.length;k+=2){h[(k+1)/2]=[this.parseFloat_(d[k],l,e),this.parseFloat_(d[k+1],l,e)]}}else{if(this.attr_("customBars")){for(k=1;k<d.length;k++){var u=d[k];if(/^ *$/.test(u)){h[k]=[null,null,null]}else{g=u.split(";");if(g.length==3){h[k]=[this.parseFloat_(g[0],l,e),this.parseFloat_(g[1],l,e),this.parseFloat_(g[2],l,e)]}else{this.warn('When using customBars, values must be either blank or "low;center;high" tuples (got "'+u+'" on line '+(1+l))}}}}else{for(k=1;k<d.length;k++){h[k]=this.parseFloat_(d[k],l,e)}}}}if(r.length>0&&h[0]<r[r.length-1][0]){f=true}if(h.length!=c){this.error("Number of columns in line "+l+" ("+h.length+") does not agree with number of labels ("+c+") "+e)}if(l===0&&this.attr_("labels")){var n=true;for(k=0;n&&k<h.length;k++){if(h[k]){n=false}}if(n){this.warn("The dygraphs 'labels' option is set, but the first row of CSV data ('"+e+"') appears to also contain labels. Will drop the CSV labels and use the option labels.");continue}}r.push(h)}if(f){this.warn("CSV is out of order; order it correctly to speed loading.");r.sort(function(j,i){return j[0]-i[0]})}return r};Dygraph.prototype.parseArray_=function(c){if(c.length===0){this.error("Can't plot empty data set");return null}if(c[0].length===0){this.error("Data set cannot contain an empty row");return null}var a;if(this.attr_("labels")===null){this.warn("Using default labels. Set labels explicitly via 'labels' in the options parameter");this.attrs_.labels=["X"];for(a=1;a<c[0].length;a++){this.attrs_.labels.push("Y"+a)}this.attributes_.reparseSeries()}else{var b=this.attr_("labels");if(b.length!=c[0].length){this.error("Mismatch between number of labels ("+b+") and number of columns in array ("+c[0].length+")");return null}}if(Dygraph.isDateLike(c[0][0])){this.attrs_.axes.x.valueFormatter=Dygraph.dateString_;this.attrs_.axes.x.ticker=Dygraph.dateTicker;this.attrs_.axes.x.axisLabelFormatter=Dygraph.dateAxisFormatter;var d=Dygraph.clone(c);for(a=0;a<c.length;a++){if(d[a].length===0){this.error("Row "+(1+a)+" of data is empty");return null}if(d[a][0]===null||typeof(d[a][0].getTime)!="function"||isNaN(d[a][0].getTime())){this.error("x value in row "+(1+a)+" is not a Date");return null}d[a][0]=d[a][0].getTime()}return d}else{this.attrs_.axes.x.valueFormatter=function(e){return e};this.attrs_.axes.x.ticker=Dygraph.numericLinearTicks;this.attrs_.axes.x.axisLabelFormatter=Dygraph.numberAxisLabelFormatter;return c}};Dygraph.prototype.parseDataTable_=function(w){var d=function(i){var j=String.fromCharCode(65+i%26);i=Math.floor(i/26);while(i>0){j=String.fromCharCode(65+(i-1)%26)+j.toLowerCase();i=Math.floor((i-1)/26)}return j};var h=w.getNumberOfColumns();var g=w.getNumberOfRows();var f=w.getColumnType(0);if(f=="date"||f=="datetime"){this.attrs_.xValueParser=Dygraph.dateParser;this.attrs_.axes.x.valueFormatter=Dygraph.dateString_;this.attrs_.axes.x.ticker=Dygraph.dateTicker;this.attrs_.axes.x.axisLabelFormatter=Dygraph.dateAxisFormatter}else{if(f=="number"){this.attrs_.xValueParser=function(i){return parseFloat(i)};this.attrs_.axes.x.valueFormatter=function(i){return i};this.attrs_.axes.x.ticker=Dygraph.numericLinearTicks;this.attrs_.axes.x.axisLabelFormatter=this.attrs_.axes.x.valueFormatter}else{this.error("only 'date', 'datetime' and 'number' types are supported for column 1 of DataTable input (Got '"+f+"')");return null}}var m=[];var t={};var s=false;var q,o;for(q=1;q<h;q++){var b=w.getColumnType(q);if(b=="number"){m.push(q)}else{if(b=="string"&&this.attr_("displayAnnotations")){var r=m[m.length-1];if(!t.hasOwnProperty(r)){t[r]=[q]}else{t[r].push(q)}s=true}else{this.error("Only 'number' is supported as a dependent type with Gviz. 'string' is only supported if displayAnnotations is true")}}}var u=[w.getColumnLabel(0)];for(q=0;q<m.length;q++){u.push(w.getColumnLabel(m[q]));if(this.attr_("errorBars")){q+=1}}this.attrs_.labels=u;h=u.length;var v=[];var l=false;var a=[];for(q=0;q<g;q++){var e=[];if(typeof(w.getValue(q,0))==="undefined"||w.getValue(q,0)===null){this.warn("Ignoring row "+q+" of DataTable because of undefined or null first column.");continue}if(f=="date"||f=="datetime"){e.push(w.getValue(q,0).getTime())}else{e.push(w.getValue(q,0))}if(!this.attr_("errorBars")){for(o=0;o<m.length;o++){var c=m[o];e.push(w.getValue(q,c));if(s&&t.hasOwnProperty(c)&&w.getValue(q,t[c][0])!==null){var p={};p.series=w.getColumnLabel(c);p.xval=e[0];p.shortText=d(a.length);p.text="";for(var n=0;n<t[c].length;n++){if(n){p.text+="\n"}p.text+=w.getValue(q,t[c][n])}a.push(p)}}for(o=0;o<e.length;o++){if(!isFinite(e[o])){e[o]=null}}}else{for(o=0;o<h-1;o++){e.push([w.getValue(q,1+2*o),w.getValue(q,2+2*o)])}}if(v.length>0&&e[0]<v[v.length-1][0]){l=true}v.push(e)}if(l){this.warn("DataTable is out of order; order it correctly to speed loading.");v.sort(function(j,i){return j[0]-i[0]})}this.rawData_=v;if(a.length>0){this.setAnnotations(a,true)}this.attributes_.reparseSeries()};Dygraph.prototype.start_=function(){var d=this.file_;if(typeof d=="function"){d=d()}if(Dygraph.isArrayLike(d)){this.rawData_=this.parseArray_(d);this.predraw_()}else{if(typeof d=="object"&&typeof d.getColumnRange=="function"){this.parseDataTable_(d);this.predraw_()}else{if(typeof d=="string"){var c=Dygraph.detectLineDelimiter(d);if(c){this.loadedEvent_(d)}else{var b;if(window.XMLHttpRequest){b=new XMLHttpRequest()}else{b=new ActiveXObject("Microsoft.XMLHTTP")}var a=this;b.onreadystatechange=function(){if(b.readyState==4){if(b.status===200||b.status===0){a.loadedEvent_(b.responseText)}}};b.open("GET",d,true);b.send(null)}}else{this.error("Unknown data format: "+(typeof d))}}}};Dygraph.prototype.updateOptions=function(e,b){if(typeof(b)=="undefined"){b=false}var d=e.file;var c=Dygraph.mapLegacyOptions_(e);if("rollPeriod" in c){this.rollPeriod_=c.rollPeriod}if("dateWindow" in c){this.dateWindow_=c.dateWindow;if(!("isZoomedIgnoreProgrammaticZoom" in c)){this.zoomed_x_=(c.dateWindow!==null)}}if("valueRange" in c&&!("isZoomedIgnoreProgrammaticZoom" in c)){this.zoomed_y_=(c.valueRange!==null)}var a=Dygraph.isPixelChangingOptionList(this.attr_("labels"),c);Dygraph.updateDeep(this.user_attrs_,c);this.attributes_.reparseSeries();if(d){this.file_=d;if(!b){this.start_()}}else{if(!b){if(a){this.predraw_()}else{this.renderGraph_(false)}}}};Dygraph.mapLegacyOptions_=function(c){var a={};for(var b in c){if(b=="file"){continue}if(c.hasOwnProperty(b)){a[b]=c[b]}}var e=function(g,f,h){if(!a.axes){a.axes={}}if(!a.axes[g]){a.axes[g]={}}a.axes[g][f]=h};var d=function(f,g,h){if(typeof(c[f])!="undefined"){Dygraph.warn("Option "+f+" is deprecated. Use the "+h+" option for the "+g+" axis instead. (e.g. { axes : { "+g+" : { "+h+" : ... } } } (see http://dygraphs.com/per-axis.html for more information.");e(g,h,c[f]);delete a[f]}};d("xValueFormatter","x","valueFormatter");d("pixelsPerXLabel","x","pixelsPerLabel");d("xAxisLabelFormatter","x","axisLabelFormatter");d("xTicker","x","ticker");d("yValueFormatter","y","valueFormatter");d("pixelsPerYLabel","y","pixelsPerLabel");d("yAxisLabelFormatter","y","axisLabelFormatter");d("yTicker","y","ticker");return a};Dygraph.prototype.resize=function(d,b){if(this.resize_lock){return}this.resize_lock=true;if((d===null)!=(b===null)){this.warn("Dygraph.resize() should be called with zero parameters or two non-NULL parameters. Pretending it was zero.");d=b=null}var a=this.width_;var c=this.height_;if(d){this.maindiv_.style.width=d+"px";this.maindiv_.style.height=b+"px";this.width_=d;this.height_=b}else{this.width_=this.maindiv_.clientWidth;this.height_=this.maindiv_.clientHeight}if(a!=this.width_||c!=this.height_){this.resizeElements_();this.predraw_()}this.resize_lock=false};Dygraph.prototype.adjustRoll=function(a){this.rollPeriod_=a;this.predraw_()};Dygraph.prototype.visibility=function(){if(!this.attr_("visibility")){this.attrs_.visibility=[]}while(this.attr_("visibility").length<this.numColumns()-1){this.attrs_.visibility.push(true)}return this.attr_("visibility")};Dygraph.prototype.setVisibility=function(b,c){var a=this.visibility();if(b<0||b>=a.length){this.warn("invalid series number in setVisibility: "+b)}else{a[b]=c;this.predraw_()}};Dygraph.prototype.size=function(){return{width:this.width_,height:this.height_}};Dygraph.prototype.setAnnotations=function(b,a){Dygraph.addAnnotationRule();this.annotations_=b;if(!this.layout_){this.warn("Tried to setAnnotations before dygraph was ready. Try setting them in a ready() block. See dygraphs.com/tests/annotation.html");return}this.layout_.setAnnotations(this.annotations_);if(!a){this.predraw_()}};Dygraph.prototype.annotations=function(){return this.annotations_};Dygraph.prototype.getLabels=function(){var a=this.attr_("labels");return a?a.slice():null};Dygraph.prototype.indexFromSetName=function(a){return this.setIndexByName_[a]};Dygraph.prototype.ready=function(a){if(this.is_initial_draw_){this.readyFns_.push(a)}else{a(this)}};Dygraph.addAnnotationRule=function(){if(Dygraph.addedAnnotationCSS){return}var f="border: 1px solid black; background-color: white; text-align: center;";var e=document.createElement("style");e.type="text/css";document.getElementsByTagName("head")[0].appendChild(e);for(var b=0;b<document.styleSheets.length;b++){if(document.styleSheets[b].disabled){continue}var d=document.styleSheets[b];try{if(d.insertRule){var a=d.cssRules?d.cssRules.length:0;d.insertRule(".dygraphDefaultAnnotation { "+f+" }",a)}else{if(d.addRule){d.addRule(".dygraphDefaultAnnotation",f)}}Dygraph.addedAnnotationCSS=true;return}catch(c){}}this.warn("Unable to add default annotation CSS rule; display may be off.")};var DateGraph=Dygraph;"use strict";Dygraph.LOG_SCALE=10;Dygraph.LN_TEN=Math.log(Dygraph.LOG_SCALE);Dygraph.log10=function(a){return Math.log(a)/Dygraph.LN_TEN};Dygraph.DEBUG=1;Dygraph.INFO=2;Dygraph.WARNING=3;Dygraph.ERROR=3;Dygraph.LOG_STACK_TRACES=false;Dygraph.DOTTED_LINE=[2,2];Dygraph.DASHED_LINE=[7,3];Dygraph.DOT_DASH_LINE=[7,2,2,2];Dygraph.log=function(c,g){var b;if(typeof(printStackTrace)!="undefined"){try{b=printStackTrace({guess:false});while(b[0].indexOf("stacktrace")!=-1){b.splice(0,1)}b.splice(0,2);for(var d=0;d<b.length;d++){b[d]=b[d].replace(/\([^)]*\/(.*)\)/,"@$1").replace(/\@.*\/([^\/]*)/,"@$1").replace("[object Object].","")}var j=b.splice(0,1)[0];g+=" ("+j.replace(/^.*@ ?/,"")+")"}catch(h){}}if(typeof(window.console)!="undefined"){var a=window.console;var f=function(e,k,i){if(k&&typeof(k)=="function"){k.call(e,i)}else{e.log(i)}};switch(c){case Dygraph.DEBUG:f(a,a.debug,"dygraphs: "+g);break;case Dygraph.INFO:f(a,a.info,"dygraphs: "+g);break;case Dygraph.WARNING:f(a,a.warn,"dygraphs: "+g);break;case Dygraph.ERROR:f(a,a.error,"dygraphs: "+g);break}}if(Dygraph.LOG_STACK_TRACES){window.console.log(b.join("\n"))}};Dygraph.info=function(a){Dygraph.log(Dygraph.INFO,a)};Dygraph.prototype.info=Dygraph.info;Dygraph.warn=function(a){Dygraph.log(Dygraph.WARNING,a)};Dygraph.prototype.warn=Dygraph.warn;Dygraph.error=function(a){Dygraph.log(Dygraph.ERROR,a)};Dygraph.prototype.error=Dygraph.error;Dygraph.getContext=function(a){return(a.getContext("2d"))};Dygraph.addEvent=function addEvent(c,b,a){if(c.addEventListener){c.addEventListener(b,a,false)}else{c[b+a]=function(){a(window.event)};c.attachEvent("on"+b,c[b+a])}};Dygraph.prototype.addAndTrackEvent=function(c,b,a){Dygraph.addEvent(c,b,a);this.registeredEvents_.push({elem:c,type:b,fn:a})};Dygraph.removeEvent=function(c,b,a){if(c.removeEventListener){c.removeEventListener(b,a,false)}else{try{c.detachEvent("on"+b,c[b+a])}catch(d){}c[b+a]=null}};Dygraph.prototype.removeTrackedEvents_=function(){if(this.registeredEvents_){for(var a=0;a<this.registeredEvents_.length;a++){var b=this.registeredEvents_[a];Dygraph.removeEvent(b.elem,b.type,b.fn)}}this.registeredEvents_=[]};Dygraph.cancelEvent=function(a){a=a?a:window.event;if(a.stopPropagation){a.stopPropagation()}if(a.preventDefault){a.preventDefault()}a.cancelBubble=true;a.cancel=true;a.returnValue=false;return false};Dygraph.hsvToRGB=function(h,g,k){var c;var d;var l;if(g===0){c=k;d=k;l=k}else{var e=Math.floor(h*6);var j=(h*6)-e;var b=k*(1-g);var a=k*(1-(g*j));var m=k*(1-(g*(1-j)));switch(e){case 1:c=a;d=k;l=b;break;case 2:c=b;d=k;l=m;break;case 3:c=b;d=a;l=k;break;case 4:c=m;d=b;l=k;break;case 5:c=k;d=b;l=a;break;case 6:case 0:c=k;d=m;l=b;break}}c=Math.floor(255*c+0.5);d=Math.floor(255*d+0.5);l=Math.floor(255*l+0.5);return"rgb("+c+","+d+","+l+")"};Dygraph.findPosX=function(c){var d=0;if(c.offsetParent){var a=c;while(1){var b="0";if(window.getComputedStyle){b=window.getComputedStyle(a,null).borderLeft||"0"}d+=parseInt(b,10);d+=a.offsetLeft;if(!a.offsetParent){break}a=a.offsetParent}}else{if(c.x){d+=c.x}}while(c&&c!=document.body){d-=c.scrollLeft;c=c.parentNode}return d};Dygraph.findPosY=function(c){var b=0;if(c.offsetParent){var a=c;while(1){var d="0";if(window.getComputedStyle){d=window.getComputedStyle(a,null).borderTop||"0"}b+=parseInt(d,10);b+=a.offsetTop;if(!a.offsetParent){break}a=a.offsetParent}}else{if(c.y){b+=c.y}}while(c&&c!=document.body){b-=c.scrollTop;c=c.parentNode}return b};Dygraph.pageX=function(c){if(c.pageX){return(!c.pageX||c.pageX<0)?0:c.pageX}else{var d=document.documentElement;var a=document.body;return c.clientX+(d.scrollLeft||a.scrollLeft)-(d.clientLeft||0)}};Dygraph.pageY=function(c){if(c.pageY){return(!c.pageY||c.pageY<0)?0:c.pageY}else{var d=document.documentElement;var a=document.body;return c.clientY+(d.scrollTop||a.scrollTop)-(d.clientTop||0)}};Dygraph.isOK=function(a){return !!a&&!isNaN(a)};Dygraph.isValidPoint=function(b,a){if(!b){return false}if(b.yval===null){return false}if(b.x===null||b.x===undefined){return false}if(b.y===null||b.y===undefined){return false}if(isNaN(b.x)||(!a&&isNaN(b.y))){return false}return true};Dygraph.floatFormat=function(a,b){var c=Math.min(Math.max(1,b||2),21);return(Math.abs(a)<0.001&&a!==0)?a.toExponential(c-1):a.toPrecision(c)};Dygraph.zeropad=function(a){if(a<10){return"0"+a}else{return""+a}};Dygraph.hmsString_=function(a){var c=Dygraph.zeropad;var b=new Date(a);if(b.getSeconds()){return c(b.getHours())+":"+c(b.getMinutes())+":"+c(b.getSeconds())}else{return c(b.getHours())+":"+c(b.getMinutes())}};Dygraph.round_=function(c,b){var a=Math.pow(10,b);return Math.round(c*a)/a};Dygraph.binarySearch=function(a,d,i,e,b){if(e===null||e===undefined||b===null||b===undefined){e=0;b=d.length-1}if(e>b){return -1}if(i===null||i===undefined){i=0}var h=function(j){return j>=0&&j<d.length};var g=parseInt((e+b)/2,10);var c=d[g];var f;if(c==a){return g}else{if(c>a){if(i>0){f=g-1;if(h(f)&&d[f]<a){return g}}return Dygraph.binarySearch(a,d,i,e,g-1)}else{if(c<a){if(i<0){f=g+1;if(h(f)&&d[f]>a){return g}}return Dygraph.binarySearch(a,d,i,g+1,b)}}}return -1};Dygraph.dateParser=function(a){var b;var c;if(a.search("-")==-1||a.search("T")!=-1||a.search("Z")!=-1){c=Dygraph.dateStrToMillis(a);if(c&&!isNaN(c)){return c}}if(a.search("-")!=-1){b=a.replace("-","/","g");while(b.search("-")!=-1){b=b.replace("-","/")}c=Dygraph.dateStrToMillis(b)}else{if(a.length==8){b=a.substr(0,4)+"/"+a.substr(4,2)+"/"+a.substr(6,2);c=Dygraph.dateStrToMillis(b)}else{c=Dygraph.dateStrToMillis(a)}}if(!c||isNaN(c)){Dygraph.error("Couldn't parse "+a+" as a date")}return c};Dygraph.dateStrToMillis=function(a){return new Date(a).getTime()};Dygraph.update=function(b,c){if(typeof(c)!="undefined"&&c!==null){for(var a in c){if(c.hasOwnProperty(a)){b[a]=c[a]}}}return b};Dygraph.updateDeep=function(b,d){function c(e){return(typeof Node==="object"?e instanceof Node:typeof e==="object"&&typeof e.nodeType==="number"&&typeof e.nodeName==="string")}if(typeof(d)!="undefined"&&d!==null){for(var a in d){if(d.hasOwnProperty(a)){if(d[a]===null){b[a]=null}else{if(Dygraph.isArrayLike(d[a])){b[a]=d[a].slice()}else{if(c(d[a])){b[a]=d[a]}else{if(typeof(d[a])=="object"){if(typeof(b[a])!="object"||b[a]===null){b[a]={}}Dygraph.updateDeep(b[a],d[a])}else{b[a]=d[a]}}}}}}}return b};Dygraph.isArrayLike=function(b){var a=typeof(b);if((a!="object"&&!(a=="function"&&typeof(b.item)=="function"))||b===null||typeof(b.length)!="number"||b.nodeType===3){return false}return true};Dygraph.isDateLike=function(a){if(typeof(a)!="object"||a===null||typeof(a.getTime)!="function"){return false}return true};Dygraph.clone=function(c){var b=[];for(var a=0;a<c.length;a++){if(Dygraph.isArrayLike(c[a])){b.push(Dygraph.clone(c[a]))}else{b.push(c[a])}}return b};Dygraph.createCanvas=function(){var a=document.createElement("canvas");var b=(/MSIE/.test(navigator.userAgent)&&!window.opera);if(b&&(typeof(G_vmlCanvasManager)!="undefined")){a=G_vmlCanvasManager.initElement((a))}return a};Dygraph.isAndroid=function(){return(/Android/).test(navigator.userAgent)};Dygraph.Iterator=function(d,c,b,a){c=c||0;b=b||d.length;this.hasNext=true;this.peek=null;this.start_=c;this.array_=d;this.predicate_=a;this.end_=Math.min(d.length,c+b);this.nextIdx_=c-1;this.next()};Dygraph.Iterator.prototype.next=function(){if(!this.hasNext){return null}var c=this.peek;var b=this.nextIdx_+1;var a=false;while(b<this.end_){if(!this.predicate_||this.predicate_(this.array_,b)){this.peek=this.array_[b];a=true;break}b++}this.nextIdx_=b;if(!a){this.hasNext=false;this.peek=null}return c};Dygraph.createIterator=function(d,c,b,a){return new Dygraph.Iterator(d,c,b,a)};Dygraph.requestAnimFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1000/60)}})();Dygraph.repeatAndCleanup=function(h,g,f,a){var i=0;var d;var b=new Date().getTime();h(i);if(g==1){a();return}var e=g-1;(function c(){if(i>=g){return}Dygraph.requestAnimFrame.call(window,function(){var l=new Date().getTime();var j=l-b;d=i;i=Math.floor(j/f);var k=i-d;var m=(i+k)>e;if(m||(i>=e)){h(e);a()}else{if(k!==0){h(i)}c()}})})()};Dygraph.isPixelChangingOptionList=function(h,e){var d={annotationClickHandler:true,annotationDblClickHandler:true,annotationMouseOutHandler:true,annotationMouseOverHandler:true,axisLabelColor:true,axisLineColor:true,axisLineWidth:true,clickCallback:true,digitsAfterDecimal:true,drawCallback:true,drawHighlightPointCallback:true,drawPoints:true,drawPointCallback:true,drawXGrid:true,drawYGrid:true,fillAlpha:true,gridLineColor:true,gridLineWidth:true,hideOverlayOnMouseOut:true,highlightCallback:true,highlightCircleSize:true,interactionModel:true,isZoomedIgnoreProgrammaticZoom:true,labelsDiv:true,labelsDivStyles:true,labelsDivWidth:true,labelsKMB:true,labelsKMG2:true,labelsSeparateLines:true,labelsShowZeroValues:true,legend:true,maxNumberWidth:true,panEdgeFraction:true,pixelsPerYLabel:true,pointClickCallback:true,pointSize:true,rangeSelectorPlotFillColor:true,rangeSelectorPlotStrokeColor:true,showLabelsOnHighlight:true,showRoller:true,sigFigs:true,strokeWidth:true,underlayCallback:true,unhighlightCallback:true,xAxisLabelFormatter:true,xTicker:true,xValueFormatter:true,yAxisLabelFormatter:true,yValueFormatter:true,zoomCallback:true};var a=false;var b={};if(h){for(var f=1;f<h.length;f++){b[h[f]]=true}}for(var g in e){if(a){break}if(e.hasOwnProperty(g)){if(b[g]){for(var c in e[g]){if(a){break}if(e[g].hasOwnProperty(c)&&!d[c]){a=true}}}else{if(!d[g]){a=true}}}}return a};Dygraph.compareArrays=function(c,b){if(!Dygraph.isArrayLike(c)||!Dygraph.isArrayLike(b)){return false}if(c.length!==b.length){return false}for(var a=0;a<c.length;a++){if(c[a]!==b[a]){return false}}return true};Dygraph.regularShape_=function(o,c,i,f,e,a,n){a=a||0;n=n||Math.PI*2/c;o.beginPath();var g=a;var d=g;var h=function(){var p=f+(Math.sin(d)*i);var q=e+(-Math.cos(d)*i);return[p,q]};var b=h();var l=b[0];var j=b[1];o.moveTo(l,j);for(var m=0;m<c;m++){d=(m==c-1)?g:(d+n);var k=h();o.lineTo(k[0],k[1])}o.fill();o.stroke()};Dygraph.shapeFunction_=function(b,a,c){return function(j,i,f,e,k,h,d){f.strokeStyle=h;f.fillStyle="white";Dygraph.regularShape_(f,b,d,e,k,a,c)}};Dygraph.Circles={DEFAULT:function(h,f,b,e,d,c,a){b.beginPath();b.fillStyle=c;b.arc(e,d,a,0,2*Math.PI,false);b.fill()},TRIANGLE:Dygraph.shapeFunction_(3),SQUARE:Dygraph.shapeFunction_(4,Math.PI/4),DIAMOND:Dygraph.shapeFunction_(4),PENTAGON:Dygraph.shapeFunction_(5),HEXAGON:Dygraph.shapeFunction_(6),CIRCLE:function(f,e,c,b,h,d,a){c.beginPath();c.strokeStyle=d;c.fillStyle="white";c.arc(b,h,a,0,2*Math.PI,false);c.fill();c.stroke()},STAR:Dygraph.shapeFunction_(5,0,4*Math.PI/5),PLUS:function(f,e,c,b,h,d,a){c.strokeStyle=d;c.beginPath();c.moveTo(b+a,h);c.lineTo(b-a,h);c.closePath();c.stroke();c.beginPath();c.moveTo(b,h+a);c.lineTo(b,h-a);c.closePath();c.stroke()},EX:function(f,e,c,b,h,d,a){c.strokeStyle=d;c.beginPath();c.moveTo(b+a,h+a);c.lineTo(b-a,h-a);c.closePath();c.stroke();c.beginPath();c.moveTo(b+a,h-a);c.lineTo(b-a,h+a);c.closePath();c.stroke()}};Dygraph.IFrameTarp=function(){this.tarps=[]};Dygraph.IFrameTarp.prototype.cover=function(){var f=document.getElementsByTagName("iframe");for(var c=0;c<f.length;c++){var e=f[c];var b=Dygraph.findPosX(e),h=Dygraph.findPosY(e),d=e.offsetWidth,a=e.offsetHeight;var g=document.createElement("div");g.style.position="absolute";g.style.left=b+"px";g.style.top=h+"px";g.style.width=d+"px";g.style.height=a+"px";g.style.zIndex=999;document.body.appendChild(g);this.tarps.push(g)}};Dygraph.IFrameTarp.prototype.uncover=function(){for(var a=0;a<this.tarps.length;a++){this.tarps[a].parentNode.removeChild(this.tarps[a])}this.tarps=[]};Dygraph.detectLineDelimiter=function(c){for(var a=0;a<c.length;a++){var b=c.charAt(a);if(b==="\r"){if(((a+1)<c.length)&&(c.charAt(a+1)==="\n")){return"\r\n"}return b}if(b==="\n"){if(((a+1)<c.length)&&(c.charAt(a+1)==="\r")){return"\n\r"}return b}}return null};Dygraph.isNodeContainedBy=function(b,a){if(a===null||b===null){return false}var c=(b);while(c&&c!==a){c=c.parentNode}return(c===a)};Dygraph.pow=function(a,b){if(b<0){return 1/Math.pow(a,-b)}return Math.pow(a,b)};Dygraph.dateSetters={ms:Date.prototype.setMilliseconds,s:Date.prototype.setSeconds,m:Date.prototype.setMinutes,h:Date.prototype.setHours};Dygraph.setDateSameTZ=function(c,b){var f=c.getTimezoneOffset();for(var a in b){if(!b.hasOwnProperty(a)){continue}var e=Dygraph.dateSetters[a];if(!e){throw"Invalid setter: "+a}e.call(c,b[a]);if(c.getTimezoneOffset()!=f){c.setTime(c.getTime()+(f-c.getTimezoneOffset())*60*1000)}}};"use strict";Dygraph.GVizChart=function(a){this.container=a};Dygraph.GVizChart.prototype.draw=function(b,a){this.container.innerHTML="";if(typeof(this.date_graph)!="undefined"){this.date_graph.destroy()}this.date_graph=new Dygraph(this.container,b,a)};Dygraph.GVizChart.prototype.setSelection=function(b){var a=false;if(b.length){a=b[0].row}this.date_graph.setSelection(a)};Dygraph.GVizChart.prototype.getSelection=function(){var b=[];var d=this.date_graph.getSelection();if(d<0){return b}var a=this.date_graph.layout_.points;for(var c=0;c<a.length;++c){b.push({row:d,column:c+1})}return b};"use strict";Dygraph.Interaction={};Dygraph.Interaction.startPan=function(o,t,c){var r,b;c.isPanning=true;var k=t.xAxisRange();c.dateRange=k[1]-k[0];c.initialLeftmostDate=k[0];c.xUnitsPerPixel=c.dateRange/(t.plotter_.area.w-1);if(t.attr_("panEdgeFraction")){var x=t.width_*t.attr_("panEdgeFraction");var d=t.xAxisExtremes();var j=t.toDomXCoord(d[0])-x;var l=t.toDomXCoord(d[1])+x;var u=t.toDataXCoord(j);var w=t.toDataXCoord(l);c.boundedDates=[u,w];var f=[];var a=t.height_*t.attr_("panEdgeFraction");for(r=0;r<t.axes_.length;r++){b=t.axes_[r];var p=b.extremeRange;var q=t.toDomYCoord(p[0],r)+a;var s=t.toDomYCoord(p[1],r)-a;var n=t.toDataYCoord(q,r);var e=t.toDataYCoord(s,r);f[r]=[n,e]}c.boundedValues=f}c.is2DPan=false;c.axes=[];for(r=0;r<t.axes_.length;r++){b=t.axes_[r];var h={};var m=t.yAxisRange(r);var v=t.attributes_.getForAxis("logscale",r);if(v){h.initialTopValue=Dygraph.log10(m[1]);h.dragValueRange=Dygraph.log10(m[1])-Dygraph.log10(m[0])}else{h.initialTopValue=m[1];h.dragValueRange=m[1]-m[0]}h.unitsPerPixel=h.dragValueRange/(t.plotter_.area.h-1);c.axes.push(h);if(b.valueWindow||b.valueRange){c.is2DPan=true}}};Dygraph.Interaction.movePan=function(b,k,c){c.dragEndX=k.dragGetX_(b,c);c.dragEndY=k.dragGetY_(b,c);var h=c.initialLeftmostDate-(c.dragEndX-c.dragStartX)*c.xUnitsPerPixel;if(c.boundedDates){h=Math.max(h,c.boundedDates[0])}var a=h+c.dateRange;if(c.boundedDates){if(a>c.boundedDates[1]){h=h-(a-c.boundedDates[1]);a=h+c.dateRange}}k.dateWindow_=[h,a];if(c.is2DPan){var d=c.dragEndY-c.dragStartY;for(var j=0;j<k.axes_.length;j++){var e=k.axes_[j];var o=c.axes[j];var p=d*o.unitsPerPixel;var f=c.boundedValues?c.boundedValues[j]:null;var l=o.initialTopValue+p;if(f){l=Math.min(l,f[1])}var n=l-o.dragValueRange;if(f){if(n<f[0]){l=l-(n-f[0]);n=l-o.dragValueRange}}var m=k.attributes_.getForAxis("logscale",j);if(m){e.valueWindow=[Math.pow(Dygraph.LOG_SCALE,n),Math.pow(Dygraph.LOG_SCALE,l)]}else{e.valueWindow=[n,l]}}}k.drawGraph_(false)};Dygraph.Interaction.endPan=function(c,b,a){a.dragEndX=b.dragGetX_(c,a);a.dragEndY=b.dragGetY_(c,a);var e=Math.abs(a.dragEndX-a.dragStartX);var d=Math.abs(a.dragEndY-a.dragStartY);if(e<2&&d<2&&b.lastx_!==undefined&&b.lastx_!=-1){Dygraph.Interaction.treatMouseOpAsClick(b,c,a)}a.isPanning=false;a.is2DPan=false;a.initialLeftmostDate=null;a.dateRange=null;a.valueRange=null;a.boundedDates=null;a.boundedValues=null;a.axes=null};Dygraph.Interaction.startZoom=function(c,b,a){a.isZooming=true;a.zoomMoved=false};Dygraph.Interaction.moveZoom=function(c,b,a){a.zoomMoved=true;a.dragEndX=b.dragGetX_(c,a);a.dragEndY=b.dragGetY_(c,a);var e=Math.abs(a.dragStartX-a.dragEndX);var d=Math.abs(a.dragStartY-a.dragEndY);a.dragDirection=(e<d/2)?Dygraph.VERTICAL:Dygraph.HORIZONTAL;b.drawZoomRect_(a.dragDirection,a.dragStartX,a.dragEndX,a.dragStartY,a.dragEndY,a.prevDragDirection,a.prevEndX,a.prevEndY);a.prevEndX=a.dragEndX;a.prevEndY=a.dragEndY;a.prevDragDirection=a.dragDirection};Dygraph.Interaction.treatMouseOpAsClick=function(f,b,d){var k=f.attr_("clickCallback");var n=f.attr_("pointClickCallback");var j=null;if(n){var l=-1;var m=Number.MAX_VALUE;for(var e=0;e<f.selPoints_.length;e++){var c=f.selPoints_[e];var a=Math.pow(c.canvasx-d.dragEndX,2)+Math.pow(c.canvasy-d.dragEndY,2);if(!isNaN(a)&&(l==-1||a<m)){m=a;l=e}}var h=f.attr_("highlightCircleSize")+2;if(m<=h*h){j=f.selPoints_[l]}}if(j){n(b,j)}if(k){k(b,f.lastx_,f.selPoints_)}};Dygraph.Interaction.endZoom=function(c,i,e){e.isZooming=false;e.dragEndX=i.dragGetX_(c,e);e.dragEndY=i.dragGetY_(c,e);var h=Math.abs(e.dragEndX-e.dragStartX);var d=Math.abs(e.dragEndY-e.dragStartY);if(h<2&&d<2&&i.lastx_!==undefined&&i.lastx_!=-1){Dygraph.Interaction.treatMouseOpAsClick(i,c,e)}var b=i.getArea();if(h>=10&&e.dragDirection==Dygraph.HORIZONTAL){var f=Math.min(e.dragStartX,e.dragEndX),k=Math.max(e.dragStartX,e.dragEndX);f=Math.max(f,b.x);k=Math.min(k,b.x+b.w);if(f<k){i.doZoomX_(f,k)}e.cancelNextDblclick=true}else{if(d>=10&&e.dragDirection==Dygraph.VERTICAL){var j=Math.min(e.dragStartY,e.dragEndY),a=Math.max(e.dragStartY,e.dragEndY);j=Math.max(j,b.y);a=Math.min(a,b.y+b.h);if(j<a){i.doZoomY_(j,a)}e.cancelNextDblclick=true}else{if(e.zoomMoved){i.clearZoomRect_()}}}e.dragStartX=null;e.dragStartY=null};Dygraph.Interaction.startTouch=function(f,e,d){f.preventDefault();if(f.touches.length>1){d.startTimeForDoubleTapMs=null}var h=[];for(var c=0;c<f.touches.length;c++){var b=f.touches[c];h.push({pageX:b.pageX,pageY:b.pageY,dataX:e.toDataXCoord(b.pageX),dataY:e.toDataYCoord(b.pageY)})}d.initialTouches=h;if(h.length==1){d.initialPinchCenter=h[0];d.touchDirections={x:true,y:true}}else{if(h.length>=2){d.initialPinchCenter={pageX:0.5*(h[0].pageX+h[1].pageX),pageY:0.5*(h[0].pageY+h[1].pageY),dataX:0.5*(h[0].dataX+h[1].dataX),dataY:0.5*(h[0].dataY+h[1].dataY)};var a=180/Math.PI*Math.atan2(d.initialPinchCenter.pageY-h[0].pageY,h[0].pageX-d.initialPinchCenter.pageX);a=Math.abs(a);if(a>90){a=90-a}d.touchDirections={x:(a<(90-45/2)),y:(a>45/2)}}}d.initialRange={x:e.xAxisRange(),y:e.yAxisRange()}};Dygraph.Interaction.moveTouch=function(n,q,d){d.startTimeForDoubleTapMs=null;var p,l=[];for(p=0;p<n.touches.length;p++){var k=n.touches[p];l.push({pageX:k.pageX,pageY:k.pageY})}var a=d.initialTouches;var h;var j=d.initialPinchCenter;if(l.length==1){h=l[0]}else{h={pageX:0.5*(l[0].pageX+l[1].pageX),pageY:0.5*(l[0].pageY+l[1].pageY)}}var m={pageX:h.pageX-j.pageX,pageY:h.pageY-j.pageY};var f=d.initialRange.x[1]-d.initialRange.x[0];var o=d.initialRange.y[0]-d.initialRange.y[1];m.dataX=(m.pageX/q.plotter_.area.w)*f;m.dataY=(m.pageY/q.plotter_.area.h)*o;var w,c;if(l.length==1){w=1;c=1}else{if(l.length>=2){var e=(a[1].pageX-j.pageX);w=(l[1].pageX-h.pageX)/e;var v=(a[1].pageY-j.pageY);c=(l[1].pageY-h.pageY)/v}}w=Math.min(8,Math.max(0.125,w));c=Math.min(8,Math.max(0.125,c));var u=false;if(d.touchDirections.x){q.dateWindow_=[j.dataX-m.dataX+(d.initialRange.x[0]-j.dataX)/w,j.dataX-m.dataX+(d.initialRange.x[1]-j.dataX)/w];u=true}if(d.touchDirections.y){for(p=0;p<1;p++){var b=q.axes_[p];var s=q.attributes_.getForAxis("logscale",p);if(s){}else{b.valueWindow=[j.dataY-m.dataY+(d.initialRange.y[0]-j.dataY)/c,j.dataY-m.dataY+(d.initialRange.y[1]-j.dataY)/c];u=true}}}q.drawGraph_(false);if(u&&l.length>1&&q.attr_("zoomCallback")){var r=q.xAxisRange();q.attr_("zoomCallback")(r[0],r[1],q.yAxisRanges())}};Dygraph.Interaction.endTouch=function(e,d,c){if(e.touches.length!==0){Dygraph.Interaction.startTouch(e,d,c)}else{if(e.changedTouches.length==1){var a=new Date().getTime();var b=e.changedTouches[0];if(c.startTimeForDoubleTapMs&&a-c.startTimeForDoubleTapMs<500&&c.doubleTapX&&Math.abs(c.doubleTapX-b.screenX)<50&&c.doubleTapY&&Math.abs(c.doubleTapY-b.screenY)<50){d.resetZoom()}else{c.startTimeForDoubleTapMs=a;c.doubleTapX=b.screenX;c.doubleTapY=b.screenY}}}};Dygraph.Interaction.defaultModel={mousedown:function(c,b,a){if(c.button&&c.button==2){return}a.initializeMouseDown(c,b,a);if(c.altKey||c.shiftKey){Dygraph.startPan(c,b,a)}else{Dygraph.startZoom(c,b,a)}},mousemove:function(c,b,a){if(a.isZooming){Dygraph.moveZoom(c,b,a)}else{if(a.isPanning){Dygraph.movePan(c,b,a)}}},mouseup:function(c,b,a){if(a.isZooming){Dygraph.endZoom(c,b,a)}else{if(a.isPanning){Dygraph.endPan(c,b,a)}}},touchstart:function(c,b,a){Dygraph.Interaction.startTouch(c,b,a)},touchmove:function(c,b,a){Dygraph.Interaction.moveTouch(c,b,a)},touchend:function(c,b,a){Dygraph.Interaction.endTouch(c,b,a)},mouseout:function(c,b,a){if(a.isZooming){a.dragEndX=null;a.dragEndY=null;b.clearZoomRect_()}},dblclick:function(c,b,a){if(a.cancelNextDblclick){a.cancelNextDblclick=false;return}if(c.altKey||c.shiftKey){return}b.resetZoom()}};Dygraph.DEFAULT_ATTRS.interactionModel=Dygraph.Interaction.defaultModel;Dygraph.defaultInteractionModel=Dygraph.Interaction.defaultModel;Dygraph.endZoom=Dygraph.Interaction.endZoom;Dygraph.moveZoom=Dygraph.Interaction.moveZoom;Dygraph.startZoom=Dygraph.Interaction.startZoom;Dygraph.endPan=Dygraph.Interaction.endPan;Dygraph.movePan=Dygraph.Interaction.movePan;Dygraph.startPan=Dygraph.Interaction.startPan;Dygraph.Interaction.nonInteractiveModel_={mousedown:function(c,b,a){a.initializeMouseDown(c,b,a)},mouseup:function(c,b,a){a.dragEndX=b.dragGetX_(c,a);a.dragEndY=b.dragGetY_(c,a);var e=Math.abs(a.dragEndX-a.dragStartX);var d=Math.abs(a.dragEndY-a.dragStartY);if(e<2&&d<2&&b.lastx_!==undefined&&b.lastx_!=-1){Dygraph.Interaction.treatMouseOpAsClick(b,c,a)}}};Dygraph.Interaction.dragIsPanInteractionModel={mousedown:function(c,b,a){a.initializeMouseDown(c,b,a);Dygraph.startPan(c,b,a)},mousemove:function(c,b,a){if(a.isPanning){Dygraph.movePan(c,b,a)}},mouseup:function(c,b,a){if(a.isPanning){Dygraph.endPan(c,b,a)}}};"use strict";Dygraph.TickList=undefined;Dygraph.Ticker=undefined;Dygraph.numericLinearTicks=function(d,c,i,g,f,h){var e=function(a){if(a==="logscale"){return false}return g(a)};return Dygraph.numericTicks(d,c,i,e,f,h)};Dygraph.numericTicks=function(F,E,u,p,d,q){var z=(p("pixelsPerLabel"));var G=[];var C,A,t,y;if(q){for(C=0;C<q.length;C++){G.push({v:q[C]})}}else{if(p("logscale")){y=Math.floor(u/z);var l=Dygraph.binarySearch(F,Dygraph.PREFERRED_LOG_TICK_VALUES,1);var H=Dygraph.binarySearch(E,Dygraph.PREFERRED_LOG_TICK_VALUES,-1);if(l==-1){l=0}if(H==-1){H=Dygraph.PREFERRED_LOG_TICK_VALUES.length-1}var s=null;if(H-l>=y/4){for(var r=H;r>=l;r--){var m=Dygraph.PREFERRED_LOG_TICK_VALUES[r];var k=Math.log(m/F)/Math.log(E/F)*u;var D={v:m};if(s===null){s={tickValue:m,pixel_coord:k}}else{if(Math.abs(k-s.pixel_coord)>=z){s={tickValue:m,pixel_coord:k}}else{D.label=""}}G.push(D)}G.reverse()}}if(G.length===0){var g=p("labelsKMG2");var n,h;if(g){n=[1,2,4,8,16,32,64,128,256];h=16}else{n=[1,2,5,10,20,50,100];h=10}var w=Math.ceil(u/z);var o=Math.abs(E-F)/w;var v=Math.floor(Math.log(o)/Math.log(h));var f=Math.pow(h,v);var I,x,c,e;for(A=0;A<n.length;A++){I=f*n[A];x=Math.floor(F/I)*I;c=Math.ceil(E/I)*I;y=Math.abs(c-x)/I;e=u/y;if(e>z){break}}if(x>c){I*=-1}for(C=0;C<y;C++){t=x+C*I;G.push({v:t})}}}var B=(p("axisLabelFormatter"));for(C=0;C<G.length;C++){if(G[C].label!==undefined){continue}G[C].label=B(G[C].v,0,p,d)}return G};Dygraph.dateTicker=function(e,c,i,g,f,h){var d=Dygraph.pickDateTickGranularity(e,c,i,g);if(d>=0){return Dygraph.getDateAxis(e,c,d,g,f)}else{return[]}};Dygraph.SECONDLY=0;Dygraph.TWO_SECONDLY=1;Dygraph.FIVE_SECONDLY=2;Dygraph.TEN_SECONDLY=3;Dygraph.THIRTY_SECONDLY=4;Dygraph.MINUTELY=5;Dygraph.TWO_MINUTELY=6;Dygraph.FIVE_MINUTELY=7;Dygraph.TEN_MINUTELY=8;Dygraph.THIRTY_MINUTELY=9;Dygraph.HOURLY=10;Dygraph.TWO_HOURLY=11;Dygraph.SIX_HOURLY=12;Dygraph.DAILY=13;Dygraph.WEEKLY=14;Dygraph.MONTHLY=15;Dygraph.QUARTERLY=16;Dygraph.BIANNUAL=17;Dygraph.ANNUAL=18;Dygraph.DECADAL=19;Dygraph.CENTENNIAL=20;Dygraph.NUM_GRANULARITIES=21;Dygraph.SHORT_SPACINGS=[];Dygraph.SHORT_SPACINGS[Dygraph.SECONDLY]=1000*1;Dygraph.SHORT_SPACINGS[Dygraph.TWO_SECONDLY]=1000*2;Dygraph.SHORT_SPACINGS[Dygraph.FIVE_SECONDLY]=1000*5;Dygraph.SHORT_SPACINGS[Dygraph.TEN_SECONDLY]=1000*10;Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_SECONDLY]=1000*30;Dygraph.SHORT_SPACINGS[Dygraph.MINUTELY]=1000*60;Dygraph.SHORT_SPACINGS[Dygraph.TWO_MINUTELY]=1000*60*2;Dygraph.SHORT_SPACINGS[Dygraph.FIVE_MINUTELY]=1000*60*5;Dygraph.SHORT_SPACINGS[Dygraph.TEN_MINUTELY]=1000*60*10;Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_MINUTELY]=1000*60*30;Dygraph.SHORT_SPACINGS[Dygraph.HOURLY]=1000*3600;Dygraph.SHORT_SPACINGS[Dygraph.TWO_HOURLY]=1000*3600*2;Dygraph.SHORT_SPACINGS[Dygraph.SIX_HOURLY]=1000*3600*6;Dygraph.SHORT_SPACINGS[Dygraph.DAILY]=1000*86400;Dygraph.SHORT_SPACINGS[Dygraph.WEEKLY]=1000*604800;Dygraph.LONG_TICK_PLACEMENTS=[];Dygraph.LONG_TICK_PLACEMENTS[Dygraph.MONTHLY]={months:[0,1,2,3,4,5,6,7,8,9,10,11],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.QUARTERLY]={months:[0,3,6,9],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.BIANNUAL]={months:[0,6],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.ANNUAL]={months:[0],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.DECADAL]={months:[0],year_mod:10};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.CENTENNIAL]={months:[0],year_mod:100};Dygraph.PREFERRED_LOG_TICK_VALUES=function(){var c=[];for(var b=-39;b<=39;b++){var a=Math.pow(10,b);for(var d=1;d<=9;d++){var e=a*d;c.push(e)}}return c}();Dygraph.pickDateTickGranularity=function(d,c,j,h){var g=(h("pixelsPerLabel"));for(var f=0;f<Dygraph.NUM_GRANULARITIES;f++){var e=Dygraph.numDateTicks(d,c,f);if(j/e>=g){return f}}return -1};Dygraph.numDateTicks=function(e,b,f){if(f<Dygraph.MONTHLY){var g=Dygraph.SHORT_SPACINGS[f];return Math.floor(0.5+1*(b-e)/g)}else{var d=Dygraph.LONG_TICK_PLACEMENTS[f];var c=365.2524*24*3600*1000;var a=1*(b-e)/c;return Math.floor(0.5+1*a*d.months.length/d.year_mod)}};Dygraph.getDateAxis=function(p,l,a,n,z){var w=(n("axisLabelFormatter"));var C=[];var m;if(a<Dygraph.MONTHLY){var c=Dygraph.SHORT_SPACINGS[a];var y=c/1000;var A=new Date(p);Dygraph.setDateSameTZ(A,{ms:0});var h;if(y<=60){h=A.getSeconds();Dygraph.setDateSameTZ(A,{s:h-h%y})}else{Dygraph.setDateSameTZ(A,{s:0});y/=60;if(y<=60){h=A.getMinutes();Dygraph.setDateSameTZ(A,{m:h-h%y})}else{Dygraph.setDateSameTZ(A,{m:0});y/=60;if(y<=24){h=A.getHours();A.setHours(h-h%y)}else{A.setHours(0);y/=24;if(y==7){A.setDate(A.getDate()-A.getDay())}}}}p=A.getTime();var B=new Date(p).getTimezoneOffset();var e=(c>=Dygraph.SHORT_SPACINGS[Dygraph.TWO_HOURLY]);for(m=p;m<=l;m+=c){A=new Date(m);if(e&&A.getTimezoneOffset()!=B){var k=A.getTimezoneOffset()-B;m+=k*60*1000;A=new Date(m);B=A.getTimezoneOffset();if(new Date(m+c).getTimezoneOffset()!=B){m+=c;A=new Date(m);B=A.getTimezoneOffset()}}C.push({v:m,label:w(A,a,n,z)})}}else{var f;var r=1;if(a<Dygraph.NUM_GRANULARITIES){f=Dygraph.LONG_TICK_PLACEMENTS[a].months;r=Dygraph.LONG_TICK_PLACEMENTS[a].year_mod}else{Dygraph.warn("Span of dates is too long")}var v=new Date(p).getFullYear();var q=new Date(l).getFullYear();var b=Dygraph.zeropad;for(var u=v;u<=q;u++){if(u%r!==0){continue}for(var s=0;s<f.length;s++){var o=u+"/"+b(1+f[s])+"/01";m=Dygraph.dateStrToMillis(o);if(m<p||m>l){continue}C.push({v:m,label:w(new Date(m),a,n,z)})}}}return C};if(Dygraph&&Dygraph.DEFAULT_ATTRS&&Dygraph.DEFAULT_ATTRS.axes&&Dygraph.DEFAULT_ATTRS.axes["x"]&&Dygraph.DEFAULT_ATTRS.axes["y"]&&Dygraph.DEFAULT_ATTRS.axes["y2"]){Dygraph.DEFAULT_ATTRS.axes["x"]["ticker"]=Dygraph.dateTicker;Dygraph.DEFAULT_ATTRS.axes["y"]["ticker"]=Dygraph.numericTicks;Dygraph.DEFAULT_ATTRS.axes["y2"]["ticker"]=Dygraph.numericTicks}Dygraph.Plugins={};Dygraph.Plugins.Annotations=(function(){var a=function(){this.annotations_=[]};a.prototype.toString=function(){return"Annotations Plugin"};a.prototype.activate=function(b){return{clearChart:this.clearChart,didDrawChart:this.didDrawChart}};a.prototype.detachLabels=function(){for(var c=0;c<this.annotations_.length;c++){var b=this.annotations_[c];if(b.parentNode){b.parentNode.removeChild(b)}this.annotations_[c]=null}this.annotations_=[]};a.prototype.clearChart=function(b){this.detachLabels()};a.prototype.didDrawChart=function(v){var t=v.dygraph;var r=t.layout_.annotated_points;if(!r||r.length===0){return}var h=v.canvas.parentNode;var x={position:"absolute",fontSize:t.getOption("axisLabelFontSize")+"px",zIndex:10,overflow:"hidden"};var b=function(e,g,i){return function(y){var p=i.annotation;if(p.hasOwnProperty(e)){p[e](p,i,t,y)}else{if(t.getOption(g)){t.getOption(g)(p,i,t,y)}}}};var u=v.dygraph.plotter_.area;var q={};for(var s=0;s<r.length;s++){var l=r[s];if(l.canvasx<u.x||l.canvasx>u.x+u.w||l.canvasy<u.y||l.canvasy>u.y+u.h){continue}var w=l.annotation;var n=6;if(w.hasOwnProperty("tickHeight")){n=w.tickHeight}var j=document.createElement("div");for(var A in x){if(x.hasOwnProperty(A)){j.style[A]=x[A]}}if(!w.hasOwnProperty("icon")){j.className="dygraphDefaultAnnotation"}if(w.hasOwnProperty("cssClass")){j.className+=" "+w.cssClass}var m=w.hasOwnProperty("width")?w.width:16;var k=w.hasOwnProperty("height")?w.height:16;if(w.hasOwnProperty("icon")){var z=document.createElement("img");z.src=w.icon;z.width=m;z.height=k;j.appendChild(z)}else{if(l.annotation.hasOwnProperty("shortText")){j.appendChild(document.createTextNode(l.annotation.shortText))}}var c=l.canvasx-m/2;j.style.left=c+"px";var f=0;if(w.attachAtBottom){var d=(u.y+u.h-k-n);if(q[c]){d-=q[c]}else{q[c]=0}q[c]+=(n+k);f=d}else{f=l.canvasy-k-n}j.style.top=f+"px";j.style.width=m+"px";j.style.height=k+"px";j.title=l.annotation.text;j.style.color=t.colorsMap_[l.name];j.style.borderColor=t.colorsMap_[l.name];w.div=j;t.addAndTrackEvent(j,"click",b("clickHandler","annotationClickHandler",l,this));t.addAndTrackEvent(j,"mouseover",b("mouseOverHandler","annotationMouseOverHandler",l,this));t.addAndTrackEvent(j,"mouseout",b("mouseOutHandler","annotationMouseOutHandler",l,this));t.addAndTrackEvent(j,"dblclick",b("dblClickHandler","annotationDblClickHandler",l,this));h.appendChild(j);this.annotations_.push(j);var o=v.drawingContext;o.save();o.strokeStyle=t.colorsMap_[l.name];o.beginPath();if(!w.attachAtBottom){o.moveTo(l.canvasx,l.canvasy);o.lineTo(l.canvasx,l.canvasy-2-n)}else{var d=f+k;o.moveTo(l.canvasx,d);o.lineTo(l.canvasx,d+n)}o.closePath();o.stroke();o.restore()}};a.prototype.destroy=function(){this.detachLabels()};return a})();Dygraph.Plugins.Axes=(function(){var a=function(){this.xlabels_=[];this.ylabels_=[]};a.prototype.toString=function(){return"Axes Plugin"};a.prototype.activate=function(b){return{layout:this.layout,clearChart:this.clearChart,willDrawChart:this.willDrawChart}};a.prototype.layout=function(f){var d=f.dygraph;if(d.getOption("drawYAxis")){var b=d.getOption("yAxisLabelWidth")+2*d.getOption("axisTickSize");f.reserveSpaceLeft(b)}if(d.getOption("drawXAxis")){var c;if(d.getOption("xAxisHeight")){c=d.getOption("xAxisHeight")}else{c=d.getOptionForAxis("axisLabelFontSize","x")+2*d.getOption("axisTickSize")}f.reserveSpaceBottom(c)}if(d.numAxes()==2){if(d.getOption("drawYAxis")){var b=d.getOption("yAxisLabelWidth")+2*d.getOption("axisTickSize");f.reserveSpaceRight(b)}}else{if(d.numAxes()>2){d.error("Only two y-axes are supported at this time. (Trying to use "+d.numAxes()+")")}}};a.prototype.detachLabels=function(){function b(d){for(var c=0;c<d.length;c++){var e=d[c];if(e.parentNode){e.parentNode.removeChild(e)}}}b(this.xlabels_);b(this.ylabels_);this.xlabels_=[];this.ylabels_=[]};a.prototype.clearChart=function(b){this.detachLabels()};a.prototype.willDrawChart=function(H){var F=H.dygraph;if(!F.getOption("drawXAxis")&&!F.getOption("drawYAxis")){return}function B(e){return Math.round(e)+0.5}function A(e){return Math.round(e)-0.5}var j=H.drawingContext;var v=H.canvas.parentNode;var J=H.canvas.width;var d=H.canvas.height;var s,u,t,E,D;var C=function(e){return{position:"absolute",fontSize:F.getOptionForAxis("axisLabelFontSize",e)+"px",zIndex:10,color:F.getOptionForAxis("axisLabelColor",e),width:F.getOption("axisLabelWidth")+"px",lineHeight:"normal",overflow:"hidden"}};var p={x:C("x"),y:C("y"),y2:C("y2")};var m=function(g,x,y){var K=document.createElement("div");var e=p[y=="y2"?"y2":x];for(var r in e){if(e.hasOwnProperty(r)){K.style[r]=e[r]}}var i=document.createElement("div");i.className="dygraph-axis-label dygraph-axis-label-"+x+(y?" dygraph-axis-label-"+y:"");i.innerHTML=g;K.appendChild(i);return K};j.save();var I=F.layout_;var G=H.dygraph.plotter_.area;if(F.getOption("drawYAxis")){if(I.yticks&&I.yticks.length>0){var h=F.numAxes();for(D=0;D<I.yticks.length;D++){E=I.yticks[D];if(typeof(E)=="function"){return}u=G.x;var o=1;var f="y1";if(E[0]==1){u=G.x+G.w;o=-1;f="y2"}var k=F.getOptionForAxis("axisLabelFontSize",f);t=G.y+E[1]*G.h;s=m(E[2],"y",h==2?f:null);var z=(t-k/2);if(z<0){z=0}if(z+k+3>d){s.style.bottom="0px"}else{s.style.top=z+"px"}if(E[0]===0){s.style.left=(G.x-F.getOption("yAxisLabelWidth")-F.getOption("axisTickSize"))+"px";s.style.textAlign="right"}else{if(E[0]==1){s.style.left=(G.x+G.w+F.getOption("axisTickSize"))+"px";s.style.textAlign="left"}}s.style.width=F.getOption("yAxisLabelWidth")+"px";v.appendChild(s);this.ylabels_.push(s)}var n=this.ylabels_[0];var k=F.getOptionForAxis("axisLabelFontSize","y");var q=parseInt(n.style.top,10)+k;if(q>d-k){n.style.top=(parseInt(n.style.top,10)-k/2)+"px"}}var c;if(F.getOption("drawAxesAtZero")){var w=F.toPercentXCoord(0);if(w>1||w<0||isNaN(w)){w=0}c=B(G.x+w*G.w)}else{c=B(G.x)}j.strokeStyle=F.getOptionForAxis("axisLineColor","y");j.lineWidth=F.getOptionForAxis("axisLineWidth","y");j.beginPath();j.moveTo(c,A(G.y));j.lineTo(c,A(G.y+G.h));j.closePath();j.stroke();if(F.numAxes()==2){j.strokeStyle=F.getOptionForAxis("axisLineColor","y2");j.lineWidth=F.getOptionForAxis("axisLineWidth","y2");j.beginPath();j.moveTo(A(G.x+G.w),A(G.y));j.lineTo(A(G.x+G.w),A(G.y+G.h));j.closePath();j.stroke()}}if(F.getOption("drawXAxis")){if(I.xticks){for(D=0;D<I.xticks.length;D++){E=I.xticks[D];u=G.x+E[0]*G.w;t=G.y+G.h;s=m(E[1],"x");s.style.textAlign="center";s.style.top=(t+F.getOption("axisTickSize"))+"px";var l=(u-F.getOption("axisLabelWidth")/2);if(l+F.getOption("axisLabelWidth")>J){l=J-F.getOption("xAxisLabelWidth");s.style.textAlign="right"}if(l<0){l=0;s.style.textAlign="left"}s.style.left=l+"px";s.style.width=F.getOption("xAxisLabelWidth")+"px";v.appendChild(s);this.xlabels_.push(s)}}j.strokeStyle=F.getOptionForAxis("axisLineColor","x");j.lineWidth=F.getOptionForAxis("axisLineWidth","x");j.beginPath();var b;if(F.getOption("drawAxesAtZero")){var w=F.toPercentYCoord(0,0);if(w>1||w<0){w=1}b=A(G.y+w*G.h)}else{b=A(G.y+G.h)}j.moveTo(B(G.x),b);j.lineTo(B(G.x+G.w),b);j.closePath();j.stroke()}j.restore()};return a})();Dygraph.Plugins.ChartLabels=(function(){var c=function(){this.title_div_=null;this.xlabel_div_=null;this.ylabel_div_=null;this.y2label_div_=null};c.prototype.toString=function(){return"ChartLabels Plugin"};c.prototype.activate=function(d){return{layout:this.layout,didDrawChart:this.didDrawChart}};var b=function(d){var e=document.createElement("div");e.style.position="absolute";e.style.left=d.x+"px";e.style.top=d.y+"px";e.style.width=d.w+"px";e.style.height=d.h+"px";return e};c.prototype.detachLabels_=function(){var e=[this.title_div_,this.xlabel_div_,this.ylabel_div_,this.y2label_div_];for(var d=0;d<e.length;d++){var f=e[d];if(!f){continue}if(f.parentNode){f.parentNode.removeChild(f)}}this.title_div_=null;this.xlabel_div_=null;this.ylabel_div_=null;this.y2label_div_=null};var a=function(l,i,f,h,j){var d=document.createElement("div");d.style.position="absolute";if(f==1){d.style.left="0px"}else{d.style.left=i.x+"px"}d.style.top=i.y+"px";d.style.width=i.w+"px";d.style.height=i.h+"px";d.style.fontSize=(l.getOption("yLabelWidth")-2)+"px";var m=document.createElement("div");m.style.position="absolute";m.style.width=i.h+"px";m.style.height=i.w+"px";m.style.top=(i.h/2-i.w/2)+"px";m.style.left=(i.w/2-i.h/2)+"px";m.style.textAlign="center";var e="rotate("+(f==1?"-":"")+"90deg)";m.style.transform=e;m.style.WebkitTransform=e;m.style.MozTransform=e;m.style.OTransform=e;m.style.msTransform=e;if(typeof(document.documentMode)!=="undefined"&&document.documentMode<9){m.style.filter="progid:DXImageTransform.Microsoft.BasicImage(rotation="+(f==1?"3":"1")+")";m.style.left="0px";m.style.top="0px"}var k=document.createElement("div");k.className=h;k.innerHTML=j;m.appendChild(k);d.appendChild(m);return d};c.prototype.layout=function(k){this.detachLabels_();var i=k.dygraph;var m=k.chart_div;if(i.getOption("title")){var d=k.reserveSpaceTop(i.getOption("titleHeight"));this.title_div_=b(d);this.title_div_.style.textAlign="center";this.title_div_.style.fontSize=(i.getOption("titleHeight")-8)+"px";this.title_div_.style.fontWeight="bold";this.title_div_.style.zIndex=10;var f=document.createElement("div");f.className="dygraph-label dygraph-title";f.innerHTML=i.getOption("title");this.title_div_.appendChild(f);m.appendChild(this.title_div_)}if(i.getOption("xlabel")){var j=k.reserveSpaceBottom(i.getOption("xLabelHeight"));this.xlabel_div_=b(j);this.xlabel_div_.style.textAlign="center";this.xlabel_div_.style.fontSize=(i.getOption("xLabelHeight")-2)+"px";var f=document.createElement("div");f.className="dygraph-label dygraph-xlabel";f.innerHTML=i.getOption("xlabel");this.xlabel_div_.appendChild(f);m.appendChild(this.xlabel_div_)}if(i.getOption("ylabel")){var h=k.reserveSpaceLeft(0);this.ylabel_div_=a(i,h,1,"dygraph-label dygraph-ylabel",i.getOption("ylabel"));m.appendChild(this.ylabel_div_)}if(i.getOption("y2label")&&i.numAxes()==2){var l=k.reserveSpaceRight(0);this.y2label_div_=a(i,l,2,"dygraph-label dygraph-y2label",i.getOption("y2label"));m.appendChild(this.y2label_div_)}};c.prototype.didDrawChart=function(f){var d=f.dygraph;if(this.title_div_){this.title_div_.children[0].innerHTML=d.getOption("title")}if(this.xlabel_div_){this.xlabel_div_.children[0].innerHTML=d.getOption("xlabel")}if(this.ylabel_div_){this.ylabel_div_.children[0].children[0].innerHTML=d.getOption("ylabel")}if(this.y2label_div_){this.y2label_div_.children[0].children[0].innerHTML=d.getOption("y2label")}};c.prototype.clearChart=function(){};c.prototype.destroy=function(){this.detachLabels_()};return c})();Dygraph.Plugins.Grid=(function(){var a=function(){};a.prototype.toString=function(){return"Gridline Plugin"};a.prototype.activate=function(b){return{willDrawChart:this.willDrawChart}};a.prototype.willDrawChart=function(s){var q=s.dygraph;var l=s.drawingContext;var t=q.layout_;var r=s.dygraph.plotter_.area;function k(e){return Math.round(e)+0.5}function j(e){return Math.round(e)-0.5}var h,f,p,u;if(q.getOption("drawYGrid")){var o=["y","y2"];var m=[],v=[],b=[],n=[],d=[];for(var p=0;p<o.length;p++){b[p]=q.getOptionForAxis("drawGrid",o[p]);if(b[p]){m[p]=q.getOptionForAxis("gridLineColor",o[p]);v[p]=q.getOptionForAxis("gridLineWidth",o[p]);d[p]=q.getOptionForAxis("gridLinePattern",o[p]);n[p]=d[p]&&(d[p].length>=2)}}u=t.yticks;l.save();for(p=0;p<u.length;p++){var c=u[p][0];if(b[c]){if(n[c]){l.installPattern(d[c])}l.strokeStyle=m[c];l.lineWidth=v[c];h=k(r.x);f=j(r.y+u[p][1]*r.h);l.beginPath();l.moveTo(h,f);l.lineTo(h+r.w,f);l.closePath();l.stroke();if(n[c]){l.uninstallPattern()}}}l.restore()}if(q.getOption("drawXGrid")&&q.getOptionForAxis("drawGrid","x")){u=t.xticks;l.save();var d=q.getOptionForAxis("gridLinePattern","x");var n=d&&(d.length>=2);if(n){l.installPattern(d)}l.strokeStyle=q.getOptionForAxis("gridLineColor","x");l.lineWidth=q.getOptionForAxis("gridLineWidth","x");for(p=0;p<u.length;p++){h=k(r.x+u[p][0]*r.w);f=j(r.y+r.h);l.beginPath();l.moveTo(h,f);l.lineTo(h,r.y);l.closePath();l.stroke()}if(n){l.uninstallPattern()}l.restore()}};a.prototype.destroy=function(){};return a})();Dygraph.Plugins.Legend=(function(){var c=function(){this.legend_div_=null;this.is_generated_div_=false};c.prototype.toString=function(){return"Legend Plugin"};var a,d;c.prototype.activate=function(j){var m;var f=j.getOption("labelsDivWidth");var l=j.getOption("labelsDiv");if(l&&null!==l){if(typeof(l)=="string"||l instanceof String){m=document.getElementById(l)}else{m=l}}else{var i={position:"absolute",fontSize:"14px",zIndex:10,width:f+"px",top:"0px",left:(j.size().width-f-2)+"px",background:"white",lineHeight:"normal",textAlign:"left",overflow:"hidden"};Dygraph.update(i,j.getOption("labelsDivStyles"));m=document.createElement("div");m.className="dygraph-legend";for(var h in i){if(!i.hasOwnProperty(h)){continue}try{m.style[h]=i[h]}catch(k){this.warn("You are using unsupported css properties for your browser in labelsDivStyles")}}j.graphDiv.appendChild(m);this.is_generated_div_=true}this.legend_div_=m;this.one_em_width_=10;return{select:this.select,deselect:this.deselect,predraw:this.predraw,didDrawChart:this.didDrawChart}};var b=function(g){var f=document.createElement("span");f.setAttribute("style","margin: 0; padding: 0 0 0 1em; border: 0;");g.appendChild(f);var e=f.offsetWidth;g.removeChild(f);return e};c.prototype.select=function(i){var h=i.selectedX;var g=i.selectedPoints;var f=a(i.dygraph,h,g,this.one_em_width_);this.legend_div_.innerHTML=f};c.prototype.deselect=function(h){var f=b(this.legend_div_);this.one_em_width_=f;var g=a(h.dygraph,undefined,undefined,f);this.legend_div_.innerHTML=g};c.prototype.didDrawChart=function(f){this.deselect(f)};c.prototype.predraw=function(h){if(!this.is_generated_div_){return}h.dygraph.graphDiv.appendChild(this.legend_div_);var g=h.dygraph.plotter_.area;var f=h.dygraph.getOption("labelsDivWidth");this.legend_div_.style.left=g.x+g.w-f-1+"px";this.legend_div_.style.top=g.y+"px";this.legend_div_.style.width=f+"px"};c.prototype.destroy=function(){this.legend_div_=null};a=function(w,p,l,f){if(w.getOption("showLabelsOnHighlight")!==true){return""}var r,C,u,s,m;var z=w.getLabels();if(typeof(p)==="undefined"){if(w.getOption("legend")!="always"){return""}C=w.getOption("labelsSeparateLines");r="";for(u=1;u<z.length;u++){var q=w.getPropertiesForSeries(z[u]);if(!q.visible){continue}if(r!==""){r+=(C?"<br/>":" ")}m=w.getOption("strokePattern",z[u]);s=d(m,q.color,f);r+="<span style='font-weight: bold; color: "+q.color+";'>"+s+" "+z[u]+"</span>"}return r}var A=w.optionsViewForAxis_("x");var o=A("valueFormatter");r=o(p,A,z[0],w);if(r!==""){r+=":"}var v=[];var j=w.numAxes();for(u=0;u<j;u++){v[u]=w.optionsViewForAxis_("y"+(u?1+u:""))}var k=w.getOption("labelsShowZeroValues");C=w.getOption("labelsSeparateLines");var B=w.getHighlightSeries();for(u=0;u<l.length;u++){var t=l[u];if(t.yval===0&&!k){continue}if(!Dygraph.isOK(t.canvasy)){continue}if(C){r+="<br/>"}var q=w.getPropertiesForSeries(t.name);var n=v[q.axis-1];var y=n("valueFormatter");var e=y(t.yval,n,t.name,w);var h=(t.name==B)?" class='highlight'":"";r+="<span"+h+"> <b><span style='color: "+q.color+";'>"+t.name+"</span></b>:&nbsp;"+e+"</span>"}return r};d=function(s,h,r){var e=(/MSIE/.test(navigator.userAgent)&&!window.opera);if(e){return"&mdash;"}if(!s||s.length<=1){return'<div style="display: inline-block; position: relative; bottom: .5ex; padding-left: 1em; height: 1px; border-bottom: 2px solid '+h+';"></div>'}var l,k,f,o;var g=0,q=0;var p=[];var n;for(l=0;l<=s.length;l++){g+=s[l%s.length]}n=Math.floor(r/(g-s[0]));if(n>1){for(l=0;l<s.length;l++){p[l]=s[l]/r}q=p.length}else{n=1;for(l=0;l<s.length;l++){p[l]=s[l]/g}q=p.length+1}var m="";for(k=0;k<n;k++){for(l=0;l<q;l+=2){f=p[l%p.length];if(l<s.length){o=p[(l+1)%p.length]}else{o=0}m+='<div style="display: inline-block; position: relative; bottom: .5ex; margin-right: '+o+"em; padding-left: "+f+"em; height: 1px; border-bottom: 2px solid "+h+';"></div>'}}return m};return c})();Dygraph.Plugins.RangeSelector=(function(){var a=function(){this.isIE_=/MSIE/.test(navigator.userAgent)&&!window.opera;this.hasTouchInterface_=typeof(TouchEvent)!="undefined";this.isMobileDevice_=/mobile|android/gi.test(navigator.appVersion);this.interfaceCreated_=false};a.prototype.toString=function(){return"RangeSelector Plugin"};a.prototype.activate=function(b){this.dygraph_=b;this.isUsingExcanvas_=b.isUsingExcanvas_;if(this.getOption_("showRangeSelector")){this.createInterface_()}return{layout:this.reserveSpace_,predraw:this.renderStaticLayer_,didDrawChart:this.renderInteractiveLayer_}};a.prototype.destroy=function(){this.bgcanvas_=null;this.fgcanvas_=null;this.leftZoomHandle_=null;this.rightZoomHandle_=null;this.iePanOverlay_=null};a.prototype.getOption_=function(b){return this.dygraph_.getOption(b)};a.prototype.setDefaultOption_=function(b,c){return this.dygraph_.attrs_[b]=c};a.prototype.createInterface_=function(){this.createCanvases_();if(this.isUsingExcanvas_){this.createIEPanOverlay_()}this.createZoomHandles_();this.initInteraction_();if(this.getOption_("animatedZooms")){this.dygraph_.warn("Animated zooms and range selector are not compatible; disabling animatedZooms.");this.dygraph_.updateOptions({animatedZooms:false},true)}this.interfaceCreated_=true;this.addToGraph_()};a.prototype.addToGraph_=function(){var b=this.graphDiv_=this.dygraph_.graphDiv;b.appendChild(this.bgcanvas_);b.appendChild(this.fgcanvas_);b.appendChild(this.leftZoomHandle_);b.appendChild(this.rightZoomHandle_)};a.prototype.removeFromGraph_=function(){var b=this.graphDiv_;b.removeChild(this.bgcanvas_);b.removeChild(this.fgcanvas_);b.removeChild(this.leftZoomHandle_);b.removeChild(this.rightZoomHandle_);this.graphDiv_=null};a.prototype.reserveSpace_=function(b){if(this.getOption_("showRangeSelector")){b.reserveSpaceBottom(this.getOption_("rangeSelectorHeight")+4)}};a.prototype.renderStaticLayer_=function(){if(!this.updateVisibility_()){return}this.resize_();this.drawStaticLayer_()};a.prototype.renderInteractiveLayer_=function(){if(!this.updateVisibility_()||this.isChangingRange_){return}this.placeZoomHandles_();this.drawInteractiveLayer_()};a.prototype.updateVisibility_=function(){var b=this.getOption_("showRangeSelector");if(b){if(!this.interfaceCreated_){this.createInterface_()}else{if(!this.graphDiv_||!this.graphDiv_.parentNode){this.addToGraph_()}}}else{if(this.graphDiv_){this.removeFromGraph_();var c=this.dygraph_;setTimeout(function(){c.width_=0;c.resize()},1)}}return b};a.prototype.resize_=function(){function d(e,f){e.style.top=f.y+"px";e.style.left=f.x+"px";e.width=f.w;e.height=f.h;e.style.width=e.width+"px";e.style.height=e.height+"px"}var c=this.dygraph_.layout_.getPlotArea();var b=0;if(this.getOption_("drawXAxis")){b=this.getOption_("xAxisHeight")||(this.getOption_("axisLabelFontSize")+2*this.getOption_("axisTickSize"))}this.canvasRect_={x:c.x,y:c.y+c.h+b+4,w:c.w,h:this.getOption_("rangeSelectorHeight")};d(this.bgcanvas_,this.canvasRect_);d(this.fgcanvas_,this.canvasRect_)};a.prototype.createCanvases_=function(){this.bgcanvas_=Dygraph.createCanvas();this.bgcanvas_.className="dygraph-rangesel-bgcanvas";this.bgcanvas_.style.position="absolute";this.bgcanvas_.style.zIndex=9;this.bgcanvas_ctx_=Dygraph.getContext(this.bgcanvas_);this.fgcanvas_=Dygraph.createCanvas();this.fgcanvas_.className="dygraph-rangesel-fgcanvas";this.fgcanvas_.style.position="absolute";this.fgcanvas_.style.zIndex=9;this.fgcanvas_.style.cursor="default";this.fgcanvas_ctx_=Dygraph.getContext(this.fgcanvas_)};a.prototype.createIEPanOverlay_=function(){this.iePanOverlay_=document.createElement("div");this.iePanOverlay_.style.position="absolute";this.iePanOverlay_.style.backgroundColor="white";this.iePanOverlay_.style.filter="alpha(opacity=0)";this.iePanOverlay_.style.display="none";this.iePanOverlay_.style.cursor="move";this.fgcanvas_.appendChild(this.iePanOverlay_)};a.prototype.createZoomHandles_=function(){var b=new Image();b.className="dygraph-rangesel-zoomhandle";b.style.position="absolute";b.style.zIndex=10;b.style.visibility="hidden";b.style.cursor="col-resize";if(/MSIE 7/.test(navigator.userAgent)){b.width=7;b.height=14;b.style.backgroundColor="white";b.style.border="1px solid #333333"}else{b.width=9;b.height=16;b.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAQCAYAAADESFVDAAAAAXNSR0IArs4c6QAAAAZiS0dEANAAzwDP4Z7KegAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB9sHGw0cMqdt1UwAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAaElEQVQoz+3SsRFAQBCF4Z9WJM8KCDVwownl6YXsTmCUsyKGkZzcl7zkz3YLkypgAnreFmDEpHkIwVOMfpdi9CEEN2nGpFdwD03yEqDtOgCaun7sqSTDH32I1pQA2Pb9sZecAxc5r3IAb21d6878xsAAAAAASUVORK5CYII="}if(this.isMobileDevice_){b.width*=2;b.height*=2}this.leftZoomHandle_=b;this.rightZoomHandle_=b.cloneNode(false)};a.prototype.initInteraction_=function(){var o=this;var i=this.isIE_?document:window;var u=0;var v=null;var s=false;var d=false;var g=!this.isMobileDevice_&&!this.isUsingExcanvas_;var k=new Dygraph.IFrameTarp();var p,f,r,j,w,h,x,t,q,c,l;var e,n,m;p=function(C){var B=o.dygraph_.xAxisExtremes();var z=(B[1]-B[0])/o.canvasRect_.w;var A=B[0]+(C.leftHandlePos-o.canvasRect_.x)*z;var y=B[0]+(C.rightHandlePos-o.canvasRect_.x)*z;return[A,y]};f=function(y){Dygraph.cancelEvent(y);s=true;u=y.clientX;v=y.target?y.target:y.srcElement;if(y.type==="mousedown"||y.type==="dragstart"){Dygraph.addEvent(i,"mousemove",r);Dygraph.addEvent(i,"mouseup",j)}o.fgcanvas_.style.cursor="col-resize";k.cover();return true};r=function(C){if(!s){return false}Dygraph.cancelEvent(C);var z=C.clientX-u;if(Math.abs(z)<4){return true}u=C.clientX;var B=o.getZoomHandleStatus_();var y;if(v==o.leftZoomHandle_){y=B.leftHandlePos+z;y=Math.min(y,B.rightHandlePos-v.width-3);y=Math.max(y,o.canvasRect_.x)}else{y=B.rightHandlePos+z;y=Math.min(y,o.canvasRect_.x+o.canvasRect_.w);y=Math.max(y,B.leftHandlePos+v.width+3)}var A=v.width/2;v.style.left=(y-A)+"px";o.drawInteractiveLayer_();if(g){w()}return true};j=function(y){if(!s){return false}s=false;k.uncover();Dygraph.removeEvent(i,"mousemove",r);Dygraph.removeEvent(i,"mouseup",j);o.fgcanvas_.style.cursor="default";if(!g){w()}return true};w=function(){try{var z=o.getZoomHandleStatus_();o.isChangingRange_=true;if(!z.isZoomed){o.dygraph_.resetZoom()}else{var y=p(z);o.dygraph_.doZoomXDates_(y[0],y[1])}}finally{o.isChangingRange_=false}};h=function(A){if(o.isUsingExcanvas_){return A.srcElement==o.iePanOverlay_}else{var z=o.leftZoomHandle_.getBoundingClientRect();var y=z.left+z.width/2;z=o.rightZoomHandle_.getBoundingClientRect();var B=z.left+z.width/2;return(A.clientX>y&&A.clientX<B)}};x=function(y){if(!d&&h(y)&&o.getZoomHandleStatus_().isZoomed){Dygraph.cancelEvent(y);d=true;u=y.clientX;if(y.type==="mousedown"){Dygraph.addEvent(i,"mousemove",t);Dygraph.addEvent(i,"mouseup",q)}return true}return false};t=function(C){if(!d){return false}Dygraph.cancelEvent(C);var z=C.clientX-u;if(Math.abs(z)<4){return true}u=C.clientX;var B=o.getZoomHandleStatus_();var E=B.leftHandlePos;var y=B.rightHandlePos;var D=y-E;if(E+z<=o.canvasRect_.x){E=o.canvasRect_.x;y=E+D}else{if(y+z>=o.canvasRect_.x+o.canvasRect_.w){y=o.canvasRect_.x+o.canvasRect_.w;E=y-D}else{E+=z;y+=z}}var A=o.leftZoomHandle_.width/2;o.leftZoomHandle_.style.left=(E-A)+"px";o.rightZoomHandle_.style.left=(y-A)+"px";o.drawInteractiveLayer_();if(g){c()}return true};q=function(y){if(!d){return false}d=false;Dygraph.removeEvent(i,"mousemove",t);Dygraph.removeEvent(i,"mouseup",q);if(!g){c()}return true};c=function(){try{o.isChangingRange_=true;o.dygraph_.dateWindow_=p(o.getZoomHandleStatus_());o.dygraph_.drawGraph_(false)}finally{o.isChangingRange_=false}};l=function(y){if(s||d){return}var z=h(y)?"move":"default";if(z!=o.fgcanvas_.style.cursor){o.fgcanvas_.style.cursor=z}};e=function(y){if(y.type=="touchstart"&&y.targetTouches.length==1){if(f(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{if(y.type=="touchmove"&&y.targetTouches.length==1){if(r(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{j(y)}}};n=function(y){if(y.type=="touchstart"&&y.targetTouches.length==1){if(x(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{if(y.type=="touchmove"&&y.targetTouches.length==1){if(t(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{q(y)}}};m=function(B,A){var z=["touchstart","touchend","touchmove","touchcancel"];for(var y=0;y<z.length;y++){o.dygraph_.addAndTrackEvent(B,z[y],A)}};this.setDefaultOption_("interactionModel",Dygraph.Interaction.dragIsPanInteractionModel);this.setDefaultOption_("panEdgeFraction",0.0001);var b=window.opera?"mousedown":"dragstart";this.dygraph_.addAndTrackEvent(this.leftZoomHandle_,b,f);this.dygraph_.addAndTrackEvent(this.rightZoomHandle_,b,f);if(this.isUsingExcanvas_){this.dygraph_.addAndTrackEvent(this.iePanOverlay_,"mousedown",x)}else{this.dygraph_.addAndTrackEvent(this.fgcanvas_,"mousedown",x);this.dygraph_.addAndTrackEvent(this.fgcanvas_,"mousemove",l)}if(this.hasTouchInterface_){m(this.leftZoomHandle_,e);m(this.rightZoomHandle_,e);m(this.fgcanvas_,n)}};a.prototype.drawStaticLayer_=function(){var b=this.bgcanvas_ctx_;b.clearRect(0,0,this.canvasRect_.w,this.canvasRect_.h);try{this.drawMiniPlot_()}catch(c){Dygraph.warn(c)}var d=0.5;this.bgcanvas_ctx_.lineWidth=1;b.strokeStyle="gray";b.beginPath();b.moveTo(d,d);b.lineTo(d,this.canvasRect_.h-d);b.lineTo(this.canvasRect_.w-d,this.canvasRect_.h-d);b.lineTo(this.canvasRect_.w-d,d);b.stroke()};a.prototype.drawMiniPlot_=function(){var f=this.getOption_("rangeSelectorPlotFillColor");var r=this.getOption_("rangeSelectorPlotStrokeColor");if(!f&&!r){return}var j=this.getOption_("stepPlot");var v=this.computeCombinedSeriesAndLimits_();var q=v.yMax-v.yMin;var p=this.bgcanvas_ctx_;var n=0.5;var e=this.dygraph_.xAxisExtremes();var o=Math.max(e[1]-e[0],1e-30);var g=(this.canvasRect_.w-n)/o;var u=(this.canvasRect_.h-n)/q;var t=this.canvasRect_.w-n;var b=this.canvasRect_.h-n;var d=null,c=null;p.beginPath();p.moveTo(n,b);for(var s=0;s<v.data.length;s++){var h=v.data[s];var l=((h[0]!==null)?((h[0]-e[0])*g):NaN);var k=((h[1]!==null)?(b-(h[1]-v.yMin)*u):NaN);if(isFinite(l)&&isFinite(k)){if(d===null){p.lineTo(l,b)}else{if(j){p.lineTo(l,c)}}p.lineTo(l,k);d=l;c=k}else{if(d!==null){if(j){p.lineTo(l,c);p.lineTo(l,b)}else{p.lineTo(d,b)}}d=c=null}}p.lineTo(t,b);p.closePath();if(f){var m=this.bgcanvas_ctx_.createLinearGradient(0,0,0,b);m.addColorStop(0,"white");m.addColorStop(1,f);this.bgcanvas_ctx_.fillStyle=m;p.fill()}if(r){this.bgcanvas_ctx_.strokeStyle=r;this.bgcanvas_ctx_.lineWidth=1.5;p.stroke()}};a.prototype.computeCombinedSeriesAndLimits_=function(){var v=this.dygraph_.rawData_;var u=this.getOption_("logscale");var q=[];var d;var h;var m;var t,s,r;var e,g;for(t=0;t<v.length;t++){if(v[t].length>1&&v[t][1]!==null){m=typeof v[t][1]!="number";if(m){d=[];h=[];for(r=0;r<v[t][1].length;r++){d.push(0);h.push(0)}}break}}for(t=0;t<v.length;t++){var l=v[t];e=l[0];if(m){for(r=0;r<d.length;r++){d[r]=h[r]=0}}else{d=h=0}for(s=1;s<l.length;s++){if(this.dygraph_.visibility()[s-1]){var n;if(m){for(r=0;r<d.length;r++){n=l[s][r];if(n===null||isNaN(n)){continue}d[r]+=n;h[r]++}}else{n=l[s];if(n===null||isNaN(n)){continue}d+=n;h++}}}if(m){for(r=0;r<d.length;r++){d[r]/=h[r]}g=d.slice(0)}else{g=d/h}q.push([e,g])}q=this.dygraph_.rollingAverage(q,this.dygraph_.rollPeriod_);if(typeof q[0][1]!="number"){for(t=0;t<q.length;t++){g=q[t][1];q[t][1]=g[0]}}var b=Number.MAX_VALUE;var c=-Number.MAX_VALUE;for(t=0;t<q.length;t++){g=q[t][1];if(g!==null&&isFinite(g)&&(!u||g>0)){b=Math.min(b,g);c=Math.max(c,g)}}var o=0.25;if(u){c=Dygraph.log10(c);c+=c*o;b=Dygraph.log10(b);for(t=0;t<q.length;t++){q[t][1]=Dygraph.log10(q[t][1])}}else{var f;var p=c-b;if(p<=Number.MIN_VALUE){f=c*o}else{f=p*o}c+=f;b-=f}return{data:q,yMin:b,yMax:c}};a.prototype.placeZoomHandles_=function(){var h=this.dygraph_.xAxisExtremes();var b=this.dygraph_.xAxisRange();var c=h[1]-h[0];var j=Math.max(0,(b[0]-h[0])/c);var f=Math.max(0,(h[1]-b[1])/c);var i=this.canvasRect_.x+this.canvasRect_.w*j;var e=this.canvasRect_.x+this.canvasRect_.w*(1-f);var d=Math.max(this.canvasRect_.y,this.canvasRect_.y+(this.canvasRect_.h-this.leftZoomHandle_.height)/2);var g=this.leftZoomHandle_.width/2;this.leftZoomHandle_.style.left=(i-g)+"px";this.leftZoomHandle_.style.top=d+"px";this.rightZoomHandle_.style.left=(e-g)+"px";this.rightZoomHandle_.style.top=this.leftZoomHandle_.style.top;this.leftZoomHandle_.style.visibility="visible";this.rightZoomHandle_.style.visibility="visible"};a.prototype.drawInteractiveLayer_=function(){var c=this.fgcanvas_ctx_;c.clearRect(0,0,this.canvasRect_.w,this.canvasRect_.h);var f=1;var e=this.canvasRect_.w-f;var b=this.canvasRect_.h-f;var h=this.getZoomHandleStatus_();c.strokeStyle="black";if(!h.isZoomed){c.beginPath();c.moveTo(f,f);c.lineTo(f,b);c.lineTo(e,b);c.lineTo(e,f);c.stroke();if(this.iePanOverlay_){this.iePanOverlay_.style.display="none"}}else{var g=Math.max(f,h.leftHandlePos-this.canvasRect_.x);var d=Math.min(e,h.rightHandlePos-this.canvasRect_.x);c.fillStyle="rgba(240, 240, 240, 0.6)";c.fillRect(0,0,g,this.canvasRect_.h);c.fillRect(d,0,this.canvasRect_.w-d,this.canvasRect_.h);c.beginPath();c.moveTo(f,f);c.lineTo(g,f);c.lineTo(g,b);c.lineTo(d,b);c.lineTo(d,f);c.lineTo(e,f);c.stroke();if(this.isUsingExcanvas_){this.iePanOverlay_.style.width=(d-g)+"px";this.iePanOverlay_.style.left=g+"px";this.iePanOverlay_.style.height=b+"px";this.iePanOverlay_.style.display="inline"}}};a.prototype.getZoomHandleStatus_=function(){var c=this.leftZoomHandle_.width/2;var d=parseFloat(this.leftZoomHandle_.style.left)+c;var b=parseFloat(this.rightZoomHandle_.style.left)+c;return{leftHandlePos:d,rightHandlePos:b,isZoomed:(d-1>this.canvasRect_.x||b+1<this.canvasRect_.x+this.canvasRect_.w)}};return a})();Dygraph.PLUGINS.push(Dygraph.Plugins.Legend,Dygraph.Plugins.Axes,Dygraph.Plugins.RangeSelector,Dygraph.Plugins.ChartLabels,Dygraph.Plugins.Annotations,Dygraph.Plugins.Grid); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-dev.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-dev.js
new file mode 100644
index 00000000..c06d23d5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-dev.js
@@ -0,0 +1,45 @@
+/**
+ * @license
+ * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+
+// A dygraph "auto-loader".
+
+// Check where this script was sourced from. If it was sourced from
+// '../dygraph-dev.js', then we should source all the other scripts with the
+// same relative path ('../dygraph.js', '../dygraph-canvas.js', ...)
+(function() {
+ var src=document.getElementsByTagName('script');
+ var script = src[src.length-1].getAttribute("src");
+
+ // This list needs to be kept in sync w/ the one in generate-combined.sh
+ // and the one in jsTestDriver.conf.
+ var source_files = [
+ "strftime/strftime-min.js",
+ "rgbcolor/rgbcolor.js",
+ "stacktrace.js",
+ "dashed-canvas.js",
+ "dygraph-options.js",
+ "dygraph-layout.js",
+ "dygraph-canvas.js",
+ "dygraph.js",
+ "dygraph-utils.js",
+ "dygraph-gviz.js",
+ "dygraph-interaction-model.js",
+ "dygraph-tickers.js",
+ "dygraph-plugin-base.js",
+ "plugins/annotations.js",
+ "plugins/axes.js",
+ "plugins/chart-labels.js",
+ "plugins/grid.js",
+ "plugins/legend.js",
+ "plugins/range-selector.js",
+ "dygraph-plugin-install.js",
+ "dygraph-options-reference.js" // Shouldn't be included in generate-combined.sh
+ ];
+
+ for (var i = 0; i < source_files.length; i++) {
+ document.write('<script type="text/javascript" src="' + script.replace('dygraph-dev.js', source_files[i]) + '"></script>\n');
+ }
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-externs.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-externs.js
new file mode 100644
index 00000000..ed5de4c1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-externs.js
@@ -0,0 +1,93 @@
+/**
+ * @param {Object} dict
+ * @return {!Array.<string>}
+ */
+function printStackTrace(dict) {}
+
+
+/**
+ * @constructor
+ */
+function G_vmlCanvasManager() {}
+
+/**
+ * @param {!HTMLCanvasElement} canvas
+ */
+G_vmlCanvasManager.initElement = function(canvas) {};
+
+// For IE
+/**
+ * @param {string} type
+ * @param {Object} fn
+ */
+Element.prototype.detachEvent = function(type, fn) {};
+
+
+/**
+ * @typedef {function(
+ * (number|Date),
+ * number,
+ * function(string):*,
+ * (Dygraph|undefined)
+ * ):string}
+ */
+var AxisLabelFormatter;
+
+
+/**
+ * @typedef {function(number,function(string),Dygraph):string}
+ */
+var ValueFormatter;
+
+
+/**
+ * @typedef {Array.<Array.<string|number|Array.<number>>>}
+ */
+var DygraphDataArray;
+
+/**
+ * @constructor
+ */
+function GVizDataTable() {}
+
+// TODO(danvk): move the Dygraph definitions out of here once I closure-ify dygraphs.js
+/**
+ * @param {!HTMLDivElement|string} div
+ * @param {DygraphDataArray|
+ * GVizDataTable|
+ * string|
+ * function():(DygraphDataArray|GVizDataTable|string)} file
+ * @param {Object} attrs
+ * @constructor
+ */
+function Dygraph(div, file, attrs) {}
+
+/**
+ * @constructor
+ */
+function DygraphLayout() {}
+
+/**
+ * @type {Array}
+ */
+DygraphLayout.prototype.datasets;
+
+// TODO: DygraphOptions should not reach inside Dygraph private data like this.
+/** @type {Object} */
+Dygraph.prototype.attrs_;
+/** @type {Object} */
+Dygraph.prototype.user_attrs_;
+
+/**
+ * @type {DygraphLayout}
+ */
+Dygraph.prototype.layout_;
+
+/** @type {function(): string} */
+Dygraph.prototype.getHighlightSeries;
+
+/** @type {Array.<{elem:Element,type:string,fn:function(!Event):(boolean|undefined|null)}>} */
+Dygraph.prototype.registeredEvents_;
+
+/** @type {{axes: Object}} */
+Dygraph.DEFAULT_ATTRS;
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-gviz.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-gviz.js
new file mode 100644
index 00000000..988e0ace
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-gviz.js
@@ -0,0 +1,82 @@
+/**
+ * @license
+ * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+
+/**
+ * @fileoverview A wrapper around the Dygraph class which implements the
+ * interface for a GViz (aka Google Visualization API) visualization.
+ * It is designed to be a drop-in replacement for Google's AnnotatedTimeline,
+ * so the documentation at
+ * http://code.google.com/apis/chart/interactive/docs/gallery/annotatedtimeline.html
+ * translates over directly.
+ *
+ * For a full demo, see:
+ * - http://dygraphs.com/tests/gviz.html
+ * - http://dygraphs.com/tests/annotation-gviz.html
+ */
+
+/*jshint globalstrict: true */
+/*global Dygraph:false */
+"use strict";
+
+/**
+ * A wrapper around Dygraph that implements the gviz API.
+ * @param {!HTMLDivElement} container The DOM object the visualization should
+ * live in.
+ * @constructor
+ */
+Dygraph.GVizChart = function(container) {
+ this.container = container;
+};
+
+/**
+ * @param {GVizDataTable} data
+ * @param {Object.<*>} options
+ */
+Dygraph.GVizChart.prototype.draw = function(data, options) {
+ // Clear out any existing dygraph.
+ // TODO(danvk): would it make more sense to simply redraw using the current
+ // date_graph object?
+ this.container.innerHTML = '';
+ if (typeof(this.date_graph) != 'undefined') {
+ this.date_graph.destroy();
+ }
+
+ this.date_graph = new Dygraph(this.container, data, options);
+};
+
+/**
+ * Google charts compatible setSelection
+ * Only row selection is supported, all points in the row will be highlighted
+ * @param {Array.<{row:number}>} selection_array array of the selected cells
+ * @public
+ */
+Dygraph.GVizChart.prototype.setSelection = function(selection_array) {
+ var row = false;
+ if (selection_array.length) {
+ row = selection_array[0].row;
+ }
+ this.date_graph.setSelection(row);
+};
+
+/**
+ * Google charts compatible getSelection implementation
+ * @return {Array.<{row:number,column:number}>} array of the selected cells
+ * @public
+ */
+Dygraph.GVizChart.prototype.getSelection = function() {
+ var selection = [];
+
+ var row = this.date_graph.getSelection();
+
+ if (row < 0) return selection;
+
+ var points = this.date_graph.layout_.points;
+ for (var setIdx = 0; setIdx < points.length; ++setIdx) {
+ selection.push({row: row, column: setIdx + 1});
+ }
+
+ return selection;
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-interaction-model.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-interaction-model.js
new file mode 100644
index 00000000..2af345c7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-interaction-model.js
@@ -0,0 +1,676 @@
+/**
+ * @license
+ * Copyright 2011 Robert Konigsberg (konigsberg@google.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+
+/**
+ * @fileoverview The default interaction model for Dygraphs. This is kept out
+ * of dygraph.js for better navigability.
+ * @author Robert Konigsberg (konigsberg@google.com)
+ */
+
+/*jshint globalstrict: true */
+/*global Dygraph:false */
+"use strict";
+
+/**
+ * A collection of functions to facilitate build custom interaction models.
+ * @class
+ */
+Dygraph.Interaction = {};
+
+/**
+ * Called in response to an interaction model operation that
+ * should start the default panning behavior.
+ *
+ * It's used in the default callback for "mousedown" operations.
+ * Custom interaction model builders can use it to provide the default
+ * panning behavior.
+ *
+ * @param {Event} event the event object which led to the startPan call.
+ * @param {Dygraph} g The dygraph on which to act.
+ * @param {Object} context The dragging context object (with
+ * dragStartX/dragStartY/etc. properties). This function modifies the
+ * context.
+ */
+Dygraph.Interaction.startPan = function(event, g, context) {
+ var i, axis;
+ context.isPanning = true;
+ var xRange = g.xAxisRange();
+ context.dateRange = xRange[1] - xRange[0];
+ context.initialLeftmostDate = xRange[0];
+ context.xUnitsPerPixel = context.dateRange / (g.plotter_.area.w - 1);
+
+ if (g.attr_("panEdgeFraction")) {
+ var maxXPixelsToDraw = g.width_ * g.attr_("panEdgeFraction");
+ var xExtremes = g.xAxisExtremes(); // I REALLY WANT TO CALL THIS xTremes!
+
+ var boundedLeftX = g.toDomXCoord(xExtremes[0]) - maxXPixelsToDraw;
+ var boundedRightX = g.toDomXCoord(xExtremes[1]) + maxXPixelsToDraw;
+
+ var boundedLeftDate = g.toDataXCoord(boundedLeftX);
+ var boundedRightDate = g.toDataXCoord(boundedRightX);
+ context.boundedDates = [boundedLeftDate, boundedRightDate];
+
+ var boundedValues = [];
+ var maxYPixelsToDraw = g.height_ * g.attr_("panEdgeFraction");
+
+ for (i = 0; i < g.axes_.length; i++) {
+ axis = g.axes_[i];
+ var yExtremes = axis.extremeRange;
+
+ var boundedTopY = g.toDomYCoord(yExtremes[0], i) + maxYPixelsToDraw;
+ var boundedBottomY = g.toDomYCoord(yExtremes[1], i) - maxYPixelsToDraw;
+
+ var boundedTopValue = g.toDataYCoord(boundedTopY, i);
+ var boundedBottomValue = g.toDataYCoord(boundedBottomY, i);
+
+ boundedValues[i] = [boundedTopValue, boundedBottomValue];
+ }
+ context.boundedValues = boundedValues;
+ }
+
+ // Record the range of each y-axis at the start of the drag.
+ // If any axis has a valueRange or valueWindow, then we want a 2D pan.
+ // We can't store data directly in g.axes_, because it does not belong to us
+ // and could change out from under us during a pan (say if there's a data
+ // update).
+ context.is2DPan = false;
+ context.axes = [];
+ for (i = 0; i < g.axes_.length; i++) {
+ axis = g.axes_[i];
+ var axis_data = {};
+ var yRange = g.yAxisRange(i);
+ // TODO(konigsberg): These values should be in |context|.
+ // In log scale, initialTopValue, dragValueRange and unitsPerPixel are log scale.
+ var logscale = g.attributes_.getForAxis("logscale", i);
+ if (logscale) {
+ axis_data.initialTopValue = Dygraph.log10(yRange[1]);
+ axis_data.dragValueRange = Dygraph.log10(yRange[1]) - Dygraph.log10(yRange[0]);
+ } else {
+ axis_data.initialTopValue = yRange[1];
+ axis_data.dragValueRange = yRange[1] - yRange[0];
+ }
+ axis_data.unitsPerPixel = axis_data.dragValueRange / (g.plotter_.area.h - 1);
+ context.axes.push(axis_data);
+
+ // While calculating axes, set 2dpan.
+ if (axis.valueWindow || axis.valueRange) context.is2DPan = true;
+ }
+};
+
+/**
+ * Called in response to an interaction model operation that
+ * responds to an event that pans the view.
+ *
+ * It's used in the default callback for "mousemove" operations.
+ * Custom interaction model builders can use it to provide the default
+ * panning behavior.
+ *
+ * @param {Event} event the event object which led to the movePan call.
+ * @param {Dygraph} g The dygraph on which to act.
+ * @param {Object} context The dragging context object (with
+ * dragStartX/dragStartY/etc. properties). This function modifies the
+ * context.
+ */
+Dygraph.Interaction.movePan = function(event, g, context) {
+ context.dragEndX = g.dragGetX_(event, context);
+ context.dragEndY = g.dragGetY_(event, context);
+
+ var minDate = context.initialLeftmostDate -
+ (context.dragEndX - context.dragStartX) * context.xUnitsPerPixel;
+ if (context.boundedDates) {
+ minDate = Math.max(minDate, context.boundedDates[0]);
+ }
+ var maxDate = minDate + context.dateRange;
+ if (context.boundedDates) {
+ if (maxDate > context.boundedDates[1]) {
+ // Adjust minDate, and recompute maxDate.
+ minDate = minDate - (maxDate - context.boundedDates[1]);
+ maxDate = minDate + context.dateRange;
+ }
+ }
+
+ g.dateWindow_ = [minDate, maxDate];
+
+ // y-axis scaling is automatic unless this is a full 2D pan.
+ if (context.is2DPan) {
+
+ var pixelsDragged = context.dragEndY - context.dragStartY;
+
+ // Adjust each axis appropriately.
+ for (var i = 0; i < g.axes_.length; i++) {
+ var axis = g.axes_[i];
+ var axis_data = context.axes[i];
+ var unitsDragged = pixelsDragged * axis_data.unitsPerPixel;
+
+ var boundedValue = context.boundedValues ? context.boundedValues[i] : null;
+
+ // In log scale, maxValue and minValue are the logs of those values.
+ var maxValue = axis_data.initialTopValue + unitsDragged;
+ if (boundedValue) {
+ maxValue = Math.min(maxValue, boundedValue[1]);
+ }
+ var minValue = maxValue - axis_data.dragValueRange;
+ if (boundedValue) {
+ if (minValue < boundedValue[0]) {
+ // Adjust maxValue, and recompute minValue.
+ maxValue = maxValue - (minValue - boundedValue[0]);
+ minValue = maxValue - axis_data.dragValueRange;
+ }
+ }
+ var logscale = g.attributes_.getForAxis("logscale", i);
+ if (logscale) {
+ axis.valueWindow = [ Math.pow(Dygraph.LOG_SCALE, minValue),
+ Math.pow(Dygraph.LOG_SCALE, maxValue) ];
+ } else {
+ axis.valueWindow = [ minValue, maxValue ];
+ }
+ }
+ }
+
+ g.drawGraph_(false);
+};
+
+/**
+ * Called in response to an interaction model operation that
+ * responds to an event that ends panning.
+ *
+ * It's used in the default callback for "mouseup" operations.
+ * Custom interaction model builders can use it to provide the default
+ * panning behavior.
+ *
+ * @param {Event} event the event object which led to the endPan call.
+ * @param {Dygraph} g The dygraph on which to act.
+ * @param {Object} context The dragging context object (with
+ * dragStartX/dragStartY/etc. properties). This function modifies the
+ * context.
+ */
+Dygraph.Interaction.endPan = function(event, g, context) {
+ context.dragEndX = g.dragGetX_(event, context);
+ context.dragEndY = g.dragGetY_(event, context);
+
+ var regionWidth = Math.abs(context.dragEndX - context.dragStartX);
+ var regionHeight = Math.abs(context.dragEndY - context.dragStartY);
+
+ if (regionWidth < 2 && regionHeight < 2 &&
+ g.lastx_ !== undefined && g.lastx_ != -1) {
+ Dygraph.Interaction.treatMouseOpAsClick(g, event, context);
+ }
+
+ // TODO(konigsberg): mouseup should just delete the
+ // context object, and mousedown should create a new one.
+ context.isPanning = false;
+ context.is2DPan = false;
+ context.initialLeftmostDate = null;
+ context.dateRange = null;
+ context.valueRange = null;
+ context.boundedDates = null;
+ context.boundedValues = null;
+ context.axes = null;
+};
+
+/**
+ * Called in response to an interaction model operation that
+ * responds to an event that starts zooming.
+ *
+ * It's used in the default callback for "mousedown" operations.
+ * Custom interaction model builders can use it to provide the default
+ * zooming behavior.
+ *
+ * @param {Event} event the event object which led to the startZoom call.
+ * @param {Dygraph} g The dygraph on which to act.
+ * @param {Object} context The dragging context object (with
+ * dragStartX/dragStartY/etc. properties). This function modifies the
+ * context.
+ */
+Dygraph.Interaction.startZoom = function(event, g, context) {
+ context.isZooming = true;
+ context.zoomMoved = false;
+};
+
+/**
+ * Called in response to an interaction model operation that
+ * responds to an event that defines zoom boundaries.
+ *
+ * It's used in the default callback for "mousemove" operations.
+ * Custom interaction model builders can use it to provide the default
+ * zooming behavior.
+ *
+ * @param {Event} event the event object which led to the moveZoom call.
+ * @param {Dygraph} g The dygraph on which to act.
+ * @param {Object} context The dragging context object (with
+ * dragStartX/dragStartY/etc. properties). This function modifies the
+ * context.
+ */
+Dygraph.Interaction.moveZoom = function(event, g, context) {
+ context.zoomMoved = true;
+ context.dragEndX = g.dragGetX_(event, context);
+ context.dragEndY = g.dragGetY_(event, context);
+
+ var xDelta = Math.abs(context.dragStartX - context.dragEndX);
+ var yDelta = Math.abs(context.dragStartY - context.dragEndY);
+
+ // drag direction threshold for y axis is twice as large as x axis
+ context.dragDirection = (xDelta < yDelta / 2) ? Dygraph.VERTICAL : Dygraph.HORIZONTAL;
+
+ g.drawZoomRect_(
+ context.dragDirection,
+ context.dragStartX,
+ context.dragEndX,
+ context.dragStartY,
+ context.dragEndY,
+ context.prevDragDirection,
+ context.prevEndX,
+ context.prevEndY);
+
+ context.prevEndX = context.dragEndX;
+ context.prevEndY = context.dragEndY;
+ context.prevDragDirection = context.dragDirection;
+};
+
+/**
+ * @param {Dygraph} g
+ * @param {Event} event
+ * @param {Object} context
+ */
+Dygraph.Interaction.treatMouseOpAsClick = function(g, event, context) {
+ var clickCallback = g.attr_('clickCallback');
+ var pointClickCallback = g.attr_('pointClickCallback');
+
+ var selectedPoint = null;
+
+ // Find out if the click occurs on a point. This only matters if there's a
+ // pointClickCallback.
+ if (pointClickCallback) {
+ var closestIdx = -1;
+ var closestDistance = Number.MAX_VALUE;
+
+ // check if the click was on a particular point.
+ for (var i = 0; i < g.selPoints_.length; i++) {
+ var p = g.selPoints_[i];
+ var distance = Math.pow(p.canvasx - context.dragEndX, 2) +
+ Math.pow(p.canvasy - context.dragEndY, 2);
+ if (!isNaN(distance) &&
+ (closestIdx == -1 || distance < closestDistance)) {
+ closestDistance = distance;
+ closestIdx = i;
+ }
+ }
+
+ // Allow any click within two pixels of the dot.
+ var radius = g.attr_('highlightCircleSize') + 2;
+ if (closestDistance <= radius * radius) {
+ selectedPoint = g.selPoints_[closestIdx];
+ }
+ }
+
+ if (selectedPoint) {
+ pointClickCallback(event, selectedPoint);
+ }
+
+ // TODO(danvk): pass along more info about the points, e.g. 'x'
+ if (clickCallback) {
+ clickCallback(event, g.lastx_, g.selPoints_);
+ }
+};
+
+/**
+ * Called in response to an interaction model operation that
+ * responds to an event that performs a zoom based on previously defined
+ * bounds..
+ *
+ * It's used in the default callback for "mouseup" operations.
+ * Custom interaction model builders can use it to provide the default
+ * zooming behavior.
+ *
+ * @param {Event} event the event object which led to the endZoom call.
+ * @param {Dygraph} g The dygraph on which to end the zoom.
+ * @param {Object} context The dragging context object (with
+ * dragStartX/dragStartY/etc. properties). This function modifies the
+ * context.
+ */
+Dygraph.Interaction.endZoom = function(event, g, context) {
+ context.isZooming = false;
+ context.dragEndX = g.dragGetX_(event, context);
+ context.dragEndY = g.dragGetY_(event, context);
+ var regionWidth = Math.abs(context.dragEndX - context.dragStartX);
+ var regionHeight = Math.abs(context.dragEndY - context.dragStartY);
+
+ if (regionWidth < 2 && regionHeight < 2 &&
+ g.lastx_ !== undefined && g.lastx_ != -1) {
+ Dygraph.Interaction.treatMouseOpAsClick(g, event, context);
+ }
+
+ // The zoom rectangle is visibly clipped to the plot area, so its behavior
+ // should be as well.
+ // See http://code.google.com/p/dygraphs/issues/detail?id=280
+ var plotArea = g.getArea();
+ if (regionWidth >= 10 && context.dragDirection == Dygraph.HORIZONTAL) {
+ var left = Math.min(context.dragStartX, context.dragEndX),
+ right = Math.max(context.dragStartX, context.dragEndX);
+ left = Math.max(left, plotArea.x);
+ right = Math.min(right, plotArea.x + plotArea.w);
+ if (left < right) {
+ g.doZoomX_(left, right);
+ }
+ context.cancelNextDblclick = true;
+ } else if (regionHeight >= 10 && context.dragDirection == Dygraph.VERTICAL) {
+ var top = Math.min(context.dragStartY, context.dragEndY),
+ bottom = Math.max(context.dragStartY, context.dragEndY);
+ top = Math.max(top, plotArea.y);
+ bottom = Math.min(bottom, plotArea.y + plotArea.h);
+ if (top < bottom) {
+ g.doZoomY_(top, bottom);
+ }
+ context.cancelNextDblclick = true;
+ } else {
+ if (context.zoomMoved) g.clearZoomRect_();
+ }
+ context.dragStartX = null;
+ context.dragStartY = null;
+};
+
+/**
+ * @private
+ */
+Dygraph.Interaction.startTouch = function(event, g, context) {
+ event.preventDefault(); // touch browsers are all nice.
+ if (event.touches.length > 1) {
+ // If the user ever puts two fingers down, it's not a double tap.
+ context.startTimeForDoubleTapMs = null;
+ }
+
+ var touches = [];
+ for (var i = 0; i < event.touches.length; i++) {
+ var t = event.touches[i];
+ // we dispense with 'dragGetX_' because all touchBrowsers support pageX
+ touches.push({
+ pageX: t.pageX,
+ pageY: t.pageY,
+ dataX: g.toDataXCoord(t.pageX),
+ dataY: g.toDataYCoord(t.pageY)
+ // identifier: t.identifier
+ });
+ }
+ context.initialTouches = touches;
+
+ if (touches.length == 1) {
+ // This is just a swipe.
+ context.initialPinchCenter = touches[0];
+ context.touchDirections = { x: true, y: true };
+ } else if (touches.length >= 2) {
+ // It's become a pinch!
+ // In case there are 3+ touches, we ignore all but the "first" two.
+
+ // only screen coordinates can be averaged (data coords could be log scale).
+ context.initialPinchCenter = {
+ pageX: 0.5 * (touches[0].pageX + touches[1].pageX),
+ pageY: 0.5 * (touches[0].pageY + touches[1].pageY),
+
+ // TODO(danvk): remove
+ dataX: 0.5 * (touches[0].dataX + touches[1].dataX),
+ dataY: 0.5 * (touches[0].dataY + touches[1].dataY)
+ };
+
+ // Make pinches in a 45-degree swath around either axis 1-dimensional zooms.
+ var initialAngle = 180 / Math.PI * Math.atan2(
+ context.initialPinchCenter.pageY - touches[0].pageY,
+ touches[0].pageX - context.initialPinchCenter.pageX);
+
+ // use symmetry to get it into the first quadrant.
+ initialAngle = Math.abs(initialAngle);
+ if (initialAngle > 90) initialAngle = 90 - initialAngle;
+
+ context.touchDirections = {
+ x: (initialAngle < (90 - 45/2)),
+ y: (initialAngle > 45/2)
+ };
+ }
+
+ // save the full x & y ranges.
+ context.initialRange = {
+ x: g.xAxisRange(),
+ y: g.yAxisRange()
+ };
+};
+
+/**
+ * @private
+ */
+Dygraph.Interaction.moveTouch = function(event, g, context) {
+ // If the tap moves, then it's definitely not part of a double-tap.
+ context.startTimeForDoubleTapMs = null;
+
+ var i, touches = [];
+ for (i = 0; i < event.touches.length; i++) {
+ var t = event.touches[i];
+ touches.push({
+ pageX: t.pageX,
+ pageY: t.pageY
+ });
+ }
+ var initialTouches = context.initialTouches;
+
+ var c_now;
+
+ // old and new centers.
+ var c_init = context.initialPinchCenter;
+ if (touches.length == 1) {
+ c_now = touches[0];
+ } else {
+ c_now = {
+ pageX: 0.5 * (touches[0].pageX + touches[1].pageX),
+ pageY: 0.5 * (touches[0].pageY + touches[1].pageY)
+ };
+ }
+
+ // this is the "swipe" component
+ // we toss it out for now, but could use it in the future.
+ var swipe = {
+ pageX: c_now.pageX - c_init.pageX,
+ pageY: c_now.pageY - c_init.pageY
+ };
+ var dataWidth = context.initialRange.x[1] - context.initialRange.x[0];
+ var dataHeight = context.initialRange.y[0] - context.initialRange.y[1];
+ swipe.dataX = (swipe.pageX / g.plotter_.area.w) * dataWidth;
+ swipe.dataY = (swipe.pageY / g.plotter_.area.h) * dataHeight;
+ var xScale, yScale;
+
+ // The residual bits are usually split into scale & rotate bits, but we split
+ // them into x-scale and y-scale bits.
+ if (touches.length == 1) {
+ xScale = 1.0;
+ yScale = 1.0;
+ } else if (touches.length >= 2) {
+ var initHalfWidth = (initialTouches[1].pageX - c_init.pageX);
+ xScale = (touches[1].pageX - c_now.pageX) / initHalfWidth;
+
+ var initHalfHeight = (initialTouches[1].pageY - c_init.pageY);
+ yScale = (touches[1].pageY - c_now.pageY) / initHalfHeight;
+ }
+
+ // Clip scaling to [1/8, 8] to prevent too much blowup.
+ xScale = Math.min(8, Math.max(0.125, xScale));
+ yScale = Math.min(8, Math.max(0.125, yScale));
+
+ var didZoom = false;
+ if (context.touchDirections.x) {
+ g.dateWindow_ = [
+ c_init.dataX - swipe.dataX + (context.initialRange.x[0] - c_init.dataX) / xScale,
+ c_init.dataX - swipe.dataX + (context.initialRange.x[1] - c_init.dataX) / xScale
+ ];
+ didZoom = true;
+ }
+
+ if (context.touchDirections.y) {
+ for (i = 0; i < 1 /*g.axes_.length*/; i++) {
+ var axis = g.axes_[i];
+ var logscale = g.attributes_.getForAxis("logscale", i);
+ if (logscale) {
+ // TODO(danvk): implement
+ } else {
+ axis.valueWindow = [
+ c_init.dataY - swipe.dataY + (context.initialRange.y[0] - c_init.dataY) / yScale,
+ c_init.dataY - swipe.dataY + (context.initialRange.y[1] - c_init.dataY) / yScale
+ ];
+ didZoom = true;
+ }
+ }
+ }
+
+ g.drawGraph_(false);
+
+ // We only call zoomCallback on zooms, not pans, to mirror desktop behavior.
+ if (didZoom && touches.length > 1 && g.attr_('zoomCallback')) {
+ var viewWindow = g.xAxisRange();
+ g.attr_("zoomCallback")(viewWindow[0], viewWindow[1], g.yAxisRanges());
+ }
+};
+
+/**
+ * @private
+ */
+Dygraph.Interaction.endTouch = function(event, g, context) {
+ if (event.touches.length !== 0) {
+ // this is effectively a "reset"
+ Dygraph.Interaction.startTouch(event, g, context);
+ } else if (event.changedTouches.length == 1) {
+ // Could be part of a "double tap"
+ // The heuristic here is that it's a double-tap if the two touchend events
+ // occur within 500ms and within a 50x50 pixel box.
+ var now = new Date().getTime();
+ var t = event.changedTouches[0];
+ if (context.startTimeForDoubleTapMs &&
+ now - context.startTimeForDoubleTapMs < 500 &&
+ context.doubleTapX && Math.abs(context.doubleTapX - t.screenX) < 50 &&
+ context.doubleTapY && Math.abs(context.doubleTapY - t.screenY) < 50) {
+ g.resetZoom();
+ } else {
+ context.startTimeForDoubleTapMs = now;
+ context.doubleTapX = t.screenX;
+ context.doubleTapY = t.screenY;
+ }
+ }
+};
+
+/**
+ * Default interation model for dygraphs. You can refer to specific elements of
+ * this when constructing your own interaction model, e.g.:
+ * g.updateOptions( {
+ * interactionModel: {
+ * mousedown: Dygraph.defaultInteractionModel.mousedown
+ * }
+ * } );
+ */
+Dygraph.Interaction.defaultModel = {
+ // Track the beginning of drag events
+ mousedown: function(event, g, context) {
+ // Right-click should not initiate a zoom.
+ if (event.button && event.button == 2) return;
+
+ context.initializeMouseDown(event, g, context);
+
+ if (event.altKey || event.shiftKey) {
+ Dygraph.startPan(event, g, context);
+ } else {
+ Dygraph.startZoom(event, g, context);
+ }
+ },
+
+ // Draw zoom rectangles when the mouse is down and the user moves around
+ mousemove: function(event, g, context) {
+ if (context.isZooming) {
+ Dygraph.moveZoom(event, g, context);
+ } else if (context.isPanning) {
+ Dygraph.movePan(event, g, context);
+ }
+ },
+
+ mouseup: function(event, g, context) {
+ if (context.isZooming) {
+ Dygraph.endZoom(event, g, context);
+ } else if (context.isPanning) {
+ Dygraph.endPan(event, g, context);
+ }
+ },
+
+ touchstart: function(event, g, context) {
+ Dygraph.Interaction.startTouch(event, g, context);
+ },
+ touchmove: function(event, g, context) {
+ Dygraph.Interaction.moveTouch(event, g, context);
+ },
+ touchend: function(event, g, context) {
+ Dygraph.Interaction.endTouch(event, g, context);
+ },
+
+ // Temporarily cancel the dragging event when the mouse leaves the graph
+ mouseout: function(event, g, context) {
+ if (context.isZooming) {
+ context.dragEndX = null;
+ context.dragEndY = null;
+ g.clearZoomRect_();
+ }
+ },
+
+ // Disable zooming out if panning.
+ dblclick: function(event, g, context) {
+ if (context.cancelNextDblclick) {
+ context.cancelNextDblclick = false;
+ return;
+ }
+ if (event.altKey || event.shiftKey) {
+ return;
+ }
+ g.resetZoom();
+ }
+};
+
+Dygraph.DEFAULT_ATTRS.interactionModel = Dygraph.Interaction.defaultModel;
+
+// old ways of accessing these methods/properties
+Dygraph.defaultInteractionModel = Dygraph.Interaction.defaultModel;
+Dygraph.endZoom = Dygraph.Interaction.endZoom;
+Dygraph.moveZoom = Dygraph.Interaction.moveZoom;
+Dygraph.startZoom = Dygraph.Interaction.startZoom;
+Dygraph.endPan = Dygraph.Interaction.endPan;
+Dygraph.movePan = Dygraph.Interaction.movePan;
+Dygraph.startPan = Dygraph.Interaction.startPan;
+
+Dygraph.Interaction.nonInteractiveModel_ = {
+ mousedown: function(event, g, context) {
+ context.initializeMouseDown(event, g, context);
+ },
+ mouseup: function(event, g, context) {
+ // TODO(danvk): this logic is repeated in Dygraph.Interaction.endZoom
+ context.dragEndX = g.dragGetX_(event, context);
+ context.dragEndY = g.dragGetY_(event, context);
+ var regionWidth = Math.abs(context.dragEndX - context.dragStartX);
+ var regionHeight = Math.abs(context.dragEndY - context.dragStartY);
+
+ if (regionWidth < 2 && regionHeight < 2 &&
+ g.lastx_ !== undefined && g.lastx_ != -1) {
+ Dygraph.Interaction.treatMouseOpAsClick(g, event, context);
+ }
+ }
+};
+
+// Default interaction model when using the range selector.
+Dygraph.Interaction.dragIsPanInteractionModel = {
+ mousedown: function(event, g, context) {
+ context.initializeMouseDown(event, g, context);
+ Dygraph.startPan(event, g, context);
+ },
+ mousemove: function(event, g, context) {
+ if (context.isPanning) {
+ Dygraph.movePan(event, g, context);
+ }
+ },
+ mouseup: function(event, g, context) {
+ if (context.isPanning) {
+ Dygraph.endPan(event, g, context);
+ }
+ }
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-layout.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-layout.js
new file mode 100644
index 00000000..e766e8f5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-layout.js
@@ -0,0 +1,349 @@
+/**
+ * @license
+ * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+
+/**
+ * @fileoverview Based on PlotKitLayout, but modified to meet the needs of
+ * dygraphs.
+ */
+
+/*jshint globalstrict: true */
+/*global Dygraph:false */
+"use strict";
+
+/**
+ * Creates a new DygraphLayout object.
+ *
+ * This class contains all the data to be charted.
+ * It uses data coordinates, but also records the chart range (in data
+ * coordinates) and hence is able to calculate percentage positions ('In this
+ * view, Point A lies 25% down the x-axis.')
+ *
+ * Two things that it does not do are:
+ * 1. Record pixel coordinates for anything.
+ * 2. (oddly) determine anything about the layout of chart elements.
+ *
+ * The naming is a vestige of Dygraph's original PlotKit roots.
+ *
+ * @constructor
+ */
+var DygraphLayout = function(dygraph) {
+ this.dygraph_ = dygraph;
+ /**
+ * Array of points for each series.
+ *
+ * [series index][row index in series] = |Point| structure,
+ * where series index refers to visible series only, and the
+ * point index is for the reduced set of points for the current
+ * zoom region (including one point just outside the window).
+ * All points in the same row index share the same X value.
+ *
+ * @type {Array.<Array.<Dygraph.PointType>>}
+ */
+ this.points = [];
+ this.setNames = [];
+ this.annotations = [];
+ this.yAxes_ = null;
+
+ // TODO(danvk): it's odd that xTicks_ and yTicks_ are inputs, but xticks and
+ // yticks are outputs. Clean this up.
+ this.xTicks_ = null;
+ this.yTicks_ = null;
+};
+
+DygraphLayout.prototype.attr_ = function(name) {
+ return this.dygraph_.attr_(name);
+};
+
+/**
+ * Add points for a single series.
+ *
+ * @param {string} setname Name of the series.
+ * @param {Array.<Dygraph.PointType>} set_xy Points for the series.
+ */
+DygraphLayout.prototype.addDataset = function(setname, set_xy) {
+ this.points.push(set_xy);
+ this.setNames.push(setname);
+};
+
+/**
+ * Returns the box which the chart should be drawn in. This is the canvas's
+ * box, less space needed for the axis and chart labels.
+ *
+ * @return {{x: number, y: number, w: number, h: number}}
+ */
+DygraphLayout.prototype.getPlotArea = function() {
+ return this.area_;
+};
+
+// Compute the box which the chart should be drawn in. This is the canvas's
+// box, less space needed for axis, chart labels, and other plug-ins.
+// NOTE: This should only be called by Dygraph.predraw_().
+DygraphLayout.prototype.computePlotArea = function() {
+ var area = {
+ // TODO(danvk): per-axis setting.
+ x: 0,
+ y: 0
+ };
+
+ area.w = this.dygraph_.width_ - area.x - this.attr_('rightGap');
+ area.h = this.dygraph_.height_;
+
+ // Let plugins reserve space.
+ var e = {
+ chart_div: this.dygraph_.graphDiv,
+ reserveSpaceLeft: function(px) {
+ var r = {
+ x: area.x,
+ y: area.y,
+ w: px,
+ h: area.h
+ };
+ area.x += px;
+ area.w -= px;
+ return r;
+ },
+ reserveSpaceRight: function(px) {
+ var r = {
+ x: area.x + area.w - px,
+ y: area.y,
+ w: px,
+ h: area.h
+ };
+ area.w -= px;
+ return r;
+ },
+ reserveSpaceTop: function(px) {
+ var r = {
+ x: area.x,
+ y: area.y,
+ w: area.w,
+ h: px
+ };
+ area.y += px;
+ area.h -= px;
+ return r;
+ },
+ reserveSpaceBottom: function(px) {
+ var r = {
+ x: area.x,
+ y: area.y + area.h - px,
+ w: area.w,
+ h: px
+ };
+ area.h -= px;
+ return r;
+ },
+ chartRect: function() {
+ return {x:area.x, y:area.y, w:area.w, h:area.h};
+ }
+ };
+ this.dygraph_.cascadeEvents_('layout', e);
+
+ this.area_ = area;
+};
+
+DygraphLayout.prototype.setAnnotations = function(ann) {
+ // The Dygraph object's annotations aren't parsed. We parse them here and
+ // save a copy. If there is no parser, then the user must be using raw format.
+ this.annotations = [];
+ var parse = this.attr_('xValueParser') || function(x) { return x; };
+ for (var i = 0; i < ann.length; i++) {
+ var a = {};
+ if (!ann[i].xval && ann[i].x === undefined) {
+ this.dygraph_.error("Annotations must have an 'x' property");
+ return;
+ }
+ if (ann[i].icon &&
+ !(ann[i].hasOwnProperty('width') &&
+ ann[i].hasOwnProperty('height'))) {
+ this.dygraph_.error("Must set width and height when setting " +
+ "annotation.icon property");
+ return;
+ }
+ Dygraph.update(a, ann[i]);
+ if (!a.xval) a.xval = parse(a.x);
+ this.annotations.push(a);
+ }
+};
+
+DygraphLayout.prototype.setXTicks = function(xTicks) {
+ this.xTicks_ = xTicks;
+};
+
+// TODO(danvk): add this to the Dygraph object's API or move it into Layout.
+DygraphLayout.prototype.setYAxes = function (yAxes) {
+ this.yAxes_ = yAxes;
+};
+
+DygraphLayout.prototype.evaluate = function() {
+ this._evaluateLimits();
+ this._evaluateLineCharts();
+ this._evaluateLineTicks();
+ this._evaluateAnnotations();
+};
+
+DygraphLayout.prototype._evaluateLimits = function() {
+ var xlimits = this.dygraph_.xAxisRange();
+ this.minxval = xlimits[0];
+ this.maxxval = xlimits[1];
+ var xrange = xlimits[1] - xlimits[0];
+ this.xscale = (xrange !== 0 ? 1 / xrange : 1.0);
+
+ for (var i = 0; i < this.yAxes_.length; i++) {
+ var axis = this.yAxes_[i];
+ axis.minyval = axis.computedValueRange[0];
+ axis.maxyval = axis.computedValueRange[1];
+ axis.yrange = axis.maxyval - axis.minyval;
+ axis.yscale = (axis.yrange !== 0 ? 1.0 / axis.yrange : 1.0);
+
+ if (axis.g.attr_("logscale")) {
+ axis.ylogrange = Dygraph.log10(axis.maxyval) - Dygraph.log10(axis.minyval);
+ axis.ylogscale = (axis.ylogrange !== 0 ? 1.0 / axis.ylogrange : 1.0);
+ if (!isFinite(axis.ylogrange) || isNaN(axis.ylogrange)) {
+ axis.g.error('axis ' + i + ' of graph at ' + axis.g +
+ ' can\'t be displayed in log scale for range [' +
+ axis.minyval + ' - ' + axis.maxyval + ']');
+ }
+ }
+ }
+};
+
+DygraphLayout._calcYNormal = function(axis, value, logscale) {
+ if (logscale) {
+ return 1.0 - ((Dygraph.log10(value) - Dygraph.log10(axis.minyval)) * axis.ylogscale);
+ } else {
+ return 1.0 - ((value - axis.minyval) * axis.yscale);
+ }
+};
+
+DygraphLayout.prototype._evaluateLineCharts = function() {
+ var connectSeparated = this.attr_('connectSeparatedPoints');
+ var isStacked = this.attr_("stackedGraph");
+ var hasBars = this.attr_('errorBars') || this.attr_('customBars');
+
+ for (var setIdx = 0; setIdx < this.points.length; setIdx++) {
+ var points = this.points[setIdx];
+ var setName = this.setNames[setIdx];
+ var axis = this.dygraph_.axisPropertiesForSeries(setName);
+ // TODO (konigsberg): use optionsForAxis instead.
+ var logscale = this.dygraph_.attributes_.getForSeries("logscale", setName);
+
+ for (var j = 0; j < points.length; j++) {
+ var point = points[j];
+
+ // Range from 0-1 where 0 represents left and 1 represents right.
+ point.x = (point.xval - this.minxval) * this.xscale;
+ // Range from 0-1 where 0 represents top and 1 represents bottom
+ var yval = point.yval;
+ if (isStacked) {
+ point.y_stacked = DygraphLayout._calcYNormal(
+ axis, point.yval_stacked, logscale);
+ if (yval !== null && !isNaN(yval)) {
+ yval = point.yval_stacked;
+ }
+ }
+ if (yval === null) {
+ yval = NaN;
+ if (!connectSeparated) {
+ point.yval = NaN;
+ }
+ }
+ point.y = DygraphLayout._calcYNormal(axis, yval, logscale);
+
+ if (hasBars) {
+ point.y_top = DygraphLayout._calcYNormal(
+ axis, yval - point.yval_minus, logscale);
+ point.y_bottom = DygraphLayout._calcYNormal(
+ axis, yval + point.yval_plus, logscale);
+ }
+ }
+ }
+};
+
+/**
+ * Optimized replacement for parseFloat, which was way too slow when almost
+ * all values were type number, with few edge cases, none of which were strings.
+ */
+DygraphLayout.parseFloat_ = function(val) {
+ // parseFloat(null) is NaN
+ if (val === null) {
+ return NaN;
+ }
+
+ // Assume it's a number or NaN. If it's something else, I'll be shocked.
+ return val;
+};
+
+DygraphLayout.prototype._evaluateLineTicks = function() {
+ var i, tick, label, pos;
+ this.xticks = [];
+ for (i = 0; i < this.xTicks_.length; i++) {
+ tick = this.xTicks_[i];
+ label = tick.label;
+ pos = this.xscale * (tick.v - this.minxval);
+ if ((pos >= 0.0) && (pos <= 1.0)) {
+ this.xticks.push([pos, label]);
+ }
+ }
+
+ this.yticks = [];
+ for (i = 0; i < this.yAxes_.length; i++ ) {
+ var axis = this.yAxes_[i];
+ for (var j = 0; j < axis.ticks.length; j++) {
+ tick = axis.ticks[j];
+ label = tick.label;
+ pos = this.dygraph_.toPercentYCoord(tick.v, i);
+ if ((pos >= 0.0) && (pos <= 1.0)) {
+ this.yticks.push([i, pos, label]);
+ }
+ }
+ }
+};
+
+DygraphLayout.prototype._evaluateAnnotations = function() {
+ // Add the annotations to the point to which they belong.
+ // Make a map from (setName, xval) to annotation for quick lookups.
+ var i;
+ var annotations = {};
+ for (i = 0; i < this.annotations.length; i++) {
+ var a = this.annotations[i];
+ annotations[a.xval + "," + a.series] = a;
+ }
+
+ this.annotated_points = [];
+
+ // Exit the function early if there are no annotations.
+ if (!this.annotations || !this.annotations.length) {
+ return;
+ }
+
+ // TODO(antrob): loop through annotations not points.
+ for (var setIdx = 0; setIdx < this.points.length; setIdx++) {
+ var points = this.points[setIdx];
+ for (i = 0; i < points.length; i++) {
+ var p = points[i];
+ var k = p.xval + "," + p.name;
+ if (k in annotations) {
+ p.annotation = annotations[k];
+ this.annotated_points.push(p);
+ }
+ }
+ }
+};
+
+/**
+ * Convenience function to remove all the data sets from a graph
+ */
+DygraphLayout.prototype.removeAllDatasets = function() {
+ delete this.points;
+ delete this.setNames;
+ delete this.setPointsLengths;
+ delete this.setPointsOffsets;
+ this.points = [];
+ this.setNames = [];
+ this.setPointsLengths = [];
+ this.setPointsOffsets = [];
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options-reference.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options-reference.js
new file mode 100644
index 00000000..64e738d4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options-reference.js
@@ -0,0 +1,867 @@
+/**
+ * @license
+ * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+
+/*jshint globalstrict: true */
+/*global Dygraph:false */
+
+// NOTE: in addition to parsing as JS, this snippet is expected to be valid
+// JSON. This assumption cannot be checked in JS, but it will be checked when
+// documentation is generated by the generate-documentation.py script. For the
+// most part, this just means that you should always use double quotes.
+Dygraph.OPTIONS_REFERENCE = // <JSON>
+{
+ "xValueParser": {
+ "default": "parseFloat() or Date.parse()*",
+ "labels": ["CSV parsing"],
+ "type": "function(str) -> number",
+ "description": "A function which parses x-values (i.e. the dependent series). Must return a number, even when the values are dates. In this case, millis since epoch are used. This is used primarily for parsing CSV data. *=Dygraphs is slightly more accepting in the dates which it will parse. See code for details."
+ },
+ "stackedGraph": {
+ "default": "false",
+ "labels": ["Data Line display"],
+ "type": "boolean",
+ "description": "If set, stack series on top of one another rather than drawing them independently. The first series specified in the input data will wind up on top of the chart and the last will be on bottom. NaN values are drawn as white areas without a line on top, see stackedGraphNaNFill for details."
+ },
+ "stackedGraphNaNFill": {
+ "default": "all",
+ "labels": ["Data Line display"],
+ "type": "string",
+ "description": "Controls handling of NaN values inside a stacked graph. NaN values are interpolated/extended for stacking purposes, but the actual point value remains NaN in the legend display. Valid option values are \"all\" (interpolate internally, repeat leftmost and rightmost value as needed), \"inside\" (interpolate internally only, use zero outside leftmost and rightmost value), and \"none\" (treat NaN as zero everywhere)."
+ },
+ "pointSize": {
+ "default": "1",
+ "labels": ["Data Line display"],
+ "type": "integer",
+ "description": "The size of the dot to draw on each point in pixels (see drawPoints). A dot is always drawn when a point is \"isolated\", i.e. there is a missing point on either side of it. This also controls the size of those dots."
+ },
+ "labelsDivStyles": {
+ "default": "null",
+ "labels": ["Legend"],
+ "type": "{}",
+ "description": "Additional styles to apply to the currently-highlighted points div. For example, { 'fontWeight': 'bold' } will make the labels bold. In general, it is better to use CSS to style the .dygraph-legend class than to use this property."
+ },
+ "drawPoints": {
+ "default": "false",
+ "labels": ["Data Line display"],
+ "type": "boolean",
+ "description": "Draw a small dot at each point, in addition to a line going through the point. This makes the individual data points easier to see, but can increase visual clutter in the chart. The small dot can be replaced with a custom rendering by supplying a <a href='#drawPointCallback'>drawPointCallback</a>."
+ },
+ "drawGapEdgePoints": {
+ "default": "false",
+ "labels": ["Data Line display"],
+ "type": "boolean",
+ "description": "Draw points at the edges of gaps in the data. This improves visibility of small data segments or other data irregularities."
+ },
+ "drawPointCallback": {
+ "default": "null",
+ "labels": ["Data Line display"],
+ "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)",
+ "parameters": [
+ [ "g" , "the reference graph" ],
+ [ "seriesName" , "the name of the series" ],
+ [ "canvasContext" , "the canvas to draw on" ],
+ [ "cx" , "center x coordinate" ],
+ [ "cy" , "center y coordinate" ],
+ [ "color" , "series color" ],
+ [ "pointSize" , "the radius of the image." ],
+ [ "idx" , "the row-index of the point in the data."]
+ ],
+ "description": "Draw a custom item when drawPoints is enabled. Default is a small dot matching the series color. This method should constrain drawing to within pointSize pixels from (cx, cy). Also see <a href='#drawHighlightPointCallback'>drawHighlightPointCallback</a>"
+ },
+ "height": {
+ "default": "320",
+ "labels": ["Overall display"],
+ "type": "integer",
+ "description": "Height, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored."
+ },
+ "zoomCallback": {
+ "default": "null",
+ "labels": ["Callbacks"],
+ "type": "function(minDate, maxDate, yRanges)",
+ "parameters": [
+ [ "minDate" , "milliseconds since epoch" ],
+ [ "maxDate" , "milliseconds since epoch." ],
+ [ "yRanges" , "is an array of [bottom, top] pairs, one for each y-axis." ]
+ ],
+ "description": "A function to call when the zoom window is changed (either by zooming in or out)."
+ },
+ "pointClickCallback": {
+ "snippet": "function(e, point){<br>&nbsp;&nbsp;alert(point);<br>}",
+ "default": "null",
+ "labels": ["Callbacks", "Interactive Elements"],
+ "type": "function(e, point)",
+ "parameters": [
+ [ "e" , "the event object for the click" ],
+ [ "point" , "the point that was clicked See <a href='#point_properties'>Point properties</a> for details" ]
+ ],
+ "description": "A function to call when a data point is clicked. and the point that was clicked."
+ },
+ "colors": {
+ "default": "(see description)",
+ "labels": ["Data Series Colors"],
+ "type": "array<string>",
+ "example": "['red', '#00FF00']",
+ "description": "List of colors for the data series. These can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\", etc. If not specified, equally-spaced points around a color wheel are used."
+ },
+ "connectSeparatedPoints": {
+ "default": "false",
+ "labels": ["Data Line display"],
+ "type": "boolean",
+ "description": "Usually, when Dygraphs encounters a missing value in a data series, it interprets this as a gap and draws it as such. If, instead, the missing values represents an x-value for which only a different series has data, then you'll want to connect the dots by setting this to true. To explicitly include a gap with this option set, use a value of NaN."
+ },
+ "highlightCallback": {
+ "default": "null",
+ "labels": ["Callbacks"],
+ "type": "function(event, x, points, row, seriesName)",
+ "description": "When set, this callback gets called every time a new point is highlighted.",
+ "parameters": [
+ ["event", "the JavaScript mousemove event"],
+ ["x", "the x-coordinate of the highlighted points"],
+ ["points", "an array of highlighted points: <code>[ {name: 'series', yval: y-value}, &hellip; ]</code>"],
+ ["row", "integer index of the highlighted row in the data table, starting from 0"],
+ ["seriesName", "name of the highlighted series, only present if highlightSeriesOpts is set."]
+ ]
+ },
+ "drawHighlightPointCallback": {
+ "default": "null",
+ "labels": ["Data Line display"],
+ "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)",
+ "parameters": [
+ [ "g" , "the reference graph" ],
+ [ "seriesName" , "the name of the series" ],
+ [ "canvasContext" , "the canvas to draw on" ],
+ [ "cx" , "center x coordinate" ],
+ [ "cy" , "center y coordinate" ],
+ [ "color" , "series color" ],
+ [ "pointSize" , "the radius of the image." ],
+ [ "idx" , "the row-index of the point in the data."]
+ ],
+ "description": "Draw a custom item when a point is highlighted. Default is a small dot matching the series color. This method should constrain drawing to within pointSize pixels from (cx, cy) Also see <a href='#drawPointCallback'>drawPointCallback</a>"
+ },
+ "highlightSeriesOpts": {
+ "default": "null",
+ "labels": ["Interactive Elements"],
+ "type": "Object",
+ "description": "When set, the options from this object are applied to the timeseries closest to the mouse pointer for interactive highlighting. See also 'highlightCallback'. Example: highlightSeriesOpts: { strokeWidth: 3 }."
+ },
+ "highlightSeriesBackgroundAlpha": {
+ "default": "0.5",
+ "labels": ["Interactive Elements"],
+ "type": "float",
+ "description": "Fade the background while highlighting series. 1=fully visible background (disable fading), 0=hiddden background (show highlighted series only)."
+ },
+ "includeZero": {
+ "default": "false",
+ "labels": ["Axis display"],
+ "type": "boolean",
+ "description": "Usually, dygraphs will use the range of the data plus some padding to set the range of the y-axis. If this option is set, the y-axis will always include zero, typically as the lowest value. This can be used to avoid exaggerating the variance in the data"
+ },
+ "rollPeriod": {
+ "default": "1",
+ "labels": ["Error Bars", "Rolling Averages"],
+ "type": "integer &gt;= 1",
+ "description": "Number of days over which to average data. Discussed extensively above."
+ },
+ "unhighlightCallback": {
+ "default": "null",
+ "labels": ["Callbacks"],
+ "type": "function(event)",
+ "parameters": [
+ [ "event" , "the mouse event" ]
+ ],
+ "description": "When set, this callback gets called every time the user stops highlighting any point by mousing out of the graph."
+ },
+ "axisTickSize": {
+ "default": "3.0",
+ "labels": ["Axis display"],
+ "type": "number",
+ "description": "The size of the line to display next to each tick mark on x- or y-axes."
+ },
+ "labelsSeparateLines": {
+ "default": "false",
+ "labels": ["Legend"],
+ "type": "boolean",
+ "description": "Put <code>&lt;br/&gt;</code> between lines in the label string. Often used in conjunction with <strong>labelsDiv</strong>."
+ },
+ "xValueFormatter": {
+ "default": "",
+ "labels": ["Deprecated"],
+ "type": "",
+ "description": "Prefer axes: { x: { valueFormatter } }"
+ },
+ "valueFormatter": {
+ "default": "Depends on the type of your data.",
+ "labels": ["Legend", "Value display/formatting"],
+ "type": "function(num or millis, opts, dygraph)",
+ "description": "Function to provide a custom display format for the values displayed on mouseover. This does not affect the values that appear on tick marks next to the axes. To format those, see axisLabelFormatter. This is usually set on a <a href='per-axis.html'>per-axis</a> basis. For date axes, you can call new Date(millis) to get a Date object. opts is a function you can call to access various options (e.g. opts('labelsKMB'))."
+ },
+ "pixelsPerYLabel": {
+ "default": "",
+ "labels": ["Deprecated"],
+ "type": "integer",
+ "description": "Prefer axes: { y: { pixelsPerLabel } }"
+ },
+ "annotationMouseOverHandler": {
+ "default": "null",
+ "labels": ["Annotations"],
+ "type": "function(annotation, point, dygraph, event)",
+ "description": "If provided, this function is called whenever the user mouses over an annotation."
+ },
+ "annotationMouseOutHandler": {
+ "default": "null",
+ "labels": ["Annotations"],
+ "type": "function(annotation, point, dygraph, event)",
+ "parameters": [
+ [ "annotation" , "the annotation left" ],
+ [ "point" , "the point associated with the annotation" ],
+ [ "dygraph" , "the reference graph" ],
+ [ "event" , "the mouse event" ]
+ ],
+ "description": "If provided, this function is called whenever the user mouses out of an annotation."
+ },
+ "annotationClickHandler": {
+ "default": "null",
+ "labels": ["Annotations"],
+ "type": "function(annotation, point, dygraph, event)",
+ "parameters": [
+ [ "annotation" , "the annotation left" ],
+ [ "point" , "the point associated with the annotation" ],
+ [ "dygraph" , "the reference graph" ],
+ [ "event" , "the mouse event" ]
+ ],
+ "description": "If provided, this function is called whenever the user clicks on an annotation."
+ },
+ "annotationDblClickHandler": {
+ "default": "null",
+ "labels": ["Annotations"],
+ "type": "function(annotation, point, dygraph, event)",
+ "parameters": [
+ [ "annotation" , "the annotation left" ],
+ [ "point" , "the point associated with the annotation" ],
+ [ "dygraph" , "the reference graph" ],
+ [ "event" , "the mouse event" ]
+ ],
+ "description": "If provided, this function is called whenever the user double-clicks on an annotation."
+ },
+ "drawCallback": {
+ "default": "null",
+ "labels": ["Callbacks"],
+ "type": "function(dygraph, is_initial)",
+ "parameters": [
+ [ "dygraph" , "The graph being drawn" ],
+ [ "is_initial" , "True if this is the initial draw, false for subsequent draws." ]
+ ],
+ "description": "When set, this callback gets called every time the dygraph is drawn. This includes the initial draw, after zooming and repeatedly while panning."
+ },
+ "labelsKMG2": {
+ "default": "false",
+ "labels": ["Value display/formatting"],
+ "type": "boolean",
+ "description": "Show k/M/G for kilo/Mega/Giga on y-axis. This is different than <code>labelsKMB</code> in that it uses base 2, not 10."
+ },
+ "delimiter": {
+ "default": ",",
+ "labels": ["CSV parsing"],
+ "type": "string",
+ "description": "The delimiter to look for when separating fields of a CSV file. Setting this to a tab is not usually necessary, since tab-delimited data is auto-detected."
+ },
+ "axisLabelFontSize": {
+ "default": "14",
+ "labels": ["Axis display"],
+ "type": "integer",
+ "description": "Size of the font (in pixels) to use in the axis labels, both x- and y-axis."
+ },
+ "underlayCallback": {
+ "default": "null",
+ "labels": ["Callbacks"],
+ "type": "function(context, area, dygraph)",
+ "parameters": [
+ [ "context" , "the canvas drawing context on which to draw" ],
+ [ "area" , "An object with {x,y,w,h} properties describing the drawing area." ],
+ [ "dygraph" , "the reference graph" ]
+ ],
+ "description": "When set, this callback gets called before the chart is drawn. It details on how to use this."
+ },
+ "width": {
+ "default": "480",
+ "labels": ["Overall display"],
+ "type": "integer",
+ "description": "Width, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored."
+ },
+ "interactionModel": {
+ "default": "...",
+ "labels": ["Interactive Elements"],
+ "type": "Object",
+ "description": "TODO(konigsberg): document this"
+ },
+ "ticker": {
+ "default": "Dygraph.dateTicker or Dygraph.numericTicks",
+ "labels": ["Axis display"],
+ "type": "function(min, max, pixels, opts, dygraph, vals) -> [{v: ..., label: ...}, ...]",
+ "parameters": [
+ [ "min" , "" ],
+ [ "max" , "" ],
+ [ "pixels" , "" ],
+ [ "opts" , "" ],
+ [ "dygraph" , "the reference graph" ],
+ [ "vals" , "" ]
+ ],
+ "description": "This lets you specify an arbitrary function to generate tick marks on an axis. The tick marks are an array of (value, label) pairs. The built-in functions go to great lengths to choose good tick marks so, if you set this option, you'll most likely want to call one of them and modify the result. See dygraph-tickers.js for an extensive discussion. This is set on a <a href='per-axis.html'>per-axis</a> basis."
+ },
+ "xAxisLabelWidth": {
+ "default": "50",
+ "labels": ["Axis display"],
+ "type": "integer",
+ "description": "Width, in pixels, of the x-axis labels."
+ },
+ "xAxisHeight": {
+ "default": "(null)",
+ "labels": ["Axis display"],
+ "type": "integer",
+ "description": "Height, in pixels, of the x-axis. If not set explicitly, this is computed based on axisLabelFontSize and axisTickSize."
+ },
+ "showLabelsOnHighlight": {
+ "default": "true",
+ "labels": ["Interactive Elements", "Legend"],
+ "type": "boolean",
+ "description": "Whether to show the legend upon mouseover."
+ },
+ "axis": {
+ "default": "(none)",
+ "labels": ["Axis display"],
+ "type": "string or object",
+ "description": "Set to either an object ({}) filled with options for this axis or to the name of an existing data series with its own axis to re-use that axis. See tests for usage."
+ },
+ "pixelsPerXLabel": {
+ "default": "",
+ "labels": ["Deprecated"],
+ "type": "integer",
+ "description": "Prefer axes { x: { pixelsPerLabel } }"
+ },
+ "pixelsPerLabel": {
+ "default": "60 (x-axis) or 30 (y-axes)",
+ "labels": ["Axis display", "Grid"],
+ "type": "integer",
+ "description": "Number of pixels to require between each x- and y-label. Larger values will yield a sparser axis with fewer ticks. This is set on a <a href='per-axis.html'>per-axis</a> basis."
+ },
+ "labelsDiv": {
+ "default": "null",
+ "labels": ["Legend"],
+ "type": "DOM element or string",
+ "example": "<code style='font-size: small'>document.getElementById('foo')</code>or<code>'foo'",
+ "description": "Show data labels in an external div, rather than on the graph. This value can either be a div element or a div id."
+ },
+ "fractions": {
+ "default": "false",
+ "labels": ["CSV parsing", "Error Bars"],
+ "type": "boolean",
+ "description": "When set, attempt to parse each cell in the CSV file as \"a/b\", where a and b are integers. The ratio will be plotted. This allows computation of Wilson confidence intervals (see below)."
+ },
+ "logscale": {
+ "default": "false",
+ "labels": ["Axis display"],
+ "type": "boolean",
+ "description": "When set for a y-axis, the graph shows that axis in log scale. Any values less than or equal to zero are not displayed.\n\nNot compatible with showZero, and ignores connectSeparatedPoints. Also, showing log scale with valueRanges that are less than zero will result in an unviewable graph."
+ },
+ "strokeWidth": {
+ "default": "1.0",
+ "labels": ["Data Line display"],
+ "type": "float",
+ "example": "0.5, 2.0",
+ "description": "The width of the lines connecting data points. This can be used to increase the contrast or some graphs."
+ },
+ "strokePattern": {
+ "default": "null",
+ "labels": ["Data Line display"],
+ "type": "array<integer>",
+ "example": "[10, 2, 5, 2]",
+ "description": "A custom pattern array where the even index is a draw and odd is a space in pixels. If null then it draws a solid line. The array should have a even length as any odd lengthed array could be expressed as a smaller even length array. This is used to create dashed lines."
+ },
+ "strokeBorderWidth": {
+ "default": "null",
+ "labels": ["Data Line display"],
+ "type": "float",
+ "example": "1.0",
+ "description": "Draw a border around graph lines to make crossing lines more easily distinguishable. Useful for graphs with many lines."
+ },
+ "strokeBorderColor": {
+ "default": "white",
+ "labels": ["Data Line display"],
+ "type": "string",
+ "example": "red, #ccffdd",
+ "description": "Color for the line border used if strokeBorderWidth is set."
+ },
+ "wilsonInterval": {
+ "default": "true",
+ "labels": ["Error Bars"],
+ "type": "boolean",
+ "description": "Use in conjunction with the \"fractions\" option. Instead of plotting +/- N standard deviations, dygraphs will compute a Wilson confidence interval and plot that. This has more reasonable behavior for ratios close to 0 or 1."
+ },
+ "fillGraph": {
+ "default": "false",
+ "labels": ["Data Line display"],
+ "type": "boolean",
+ "description": "Should the area underneath the graph be filled? This option is not compatible with error bars. This may be set on a <a href='per-axis.html'>per-series</a> basis."
+ },
+ "highlightCircleSize": {
+ "default": "3",
+ "labels": ["Interactive Elements"],
+ "type": "integer",
+ "description": "The size in pixels of the dot drawn over highlighted points."
+ },
+ "gridLineColor": {
+ "default": "rgb(128,128,128)",
+ "labels": ["Grid"],
+ "type": "red, blue",
+ "description": "The color of the gridlines. This may be set on a per-axis basis to define each axis' grid separately."
+ },
+ "visibility": {
+ "default": "[true, true, ...]",
+ "labels": ["Data Line display"],
+ "type": "Array of booleans",
+ "description": "Which series should initially be visible? Once the Dygraph has been constructed, you can access and modify the visibility of each series using the <code>visibility</code> and <code>setVisibility</code> methods."
+ },
+ "valueRange": {
+ "default": "Full range of the input is shown",
+ "labels": ["Axis display"],
+ "type": "Array of two numbers",
+ "example": "[10, 110]",
+ "description": "Explicitly set the vertical range of the graph to [low, high]. This may be set on a per-axis basis to define each y-axis separately. If either limit is unspecified, it will be calculated automatically (e.g. [null, 30] to automatically calculate just the lower bound)"
+ },
+ "labelsDivWidth": {
+ "default": "250",
+ "labels": ["Legend"],
+ "type": "integer",
+ "description": "Width (in pixels) of the div which shows information on the currently-highlighted points."
+ },
+ "colorSaturation": {
+ "default": "1.0",
+ "labels": ["Data Series Colors"],
+ "type": "float (0.0 - 1.0)",
+ "description": "If <strong>colors</strong> is not specified, saturation of the automatically-generated data series colors."
+ },
+ "yAxisLabelWidth": {
+ "default": "50",
+ "labels": ["Axis display"],
+ "type": "integer",
+ "description": "Width, in pixels, of the y-axis labels. This also affects the amount of space available for a y-axis chart label."
+ },
+ "hideOverlayOnMouseOut": {
+ "default": "true",
+ "labels": ["Interactive Elements", "Legend"],
+ "type": "boolean",
+ "description": "Whether to hide the legend when the mouse leaves the chart area."
+ },
+ "yValueFormatter": {
+ "default": "",
+ "labels": ["Deprecated"],
+ "type": "",
+ "description": "Prefer axes: { y: { valueFormatter } }"
+ },
+ "legend": {
+ "default": "onmouseover",
+ "labels": ["Legend"],
+ "type": "string",
+ "description": "When to display the legend. By default, it only appears when a user mouses over the chart. Set it to \"always\" to always display a legend of some sort."
+ },
+ "labelsShowZeroValues": {
+ "default": "true",
+ "labels": ["Legend"],
+ "type": "boolean",
+ "description": "Show zero value labels in the labelsDiv."
+ },
+ "stepPlot": {
+ "default": "false",
+ "labels": ["Data Line display"],
+ "type": "boolean",
+ "description": "When set, display the graph as a step plot instead of a line plot. This option may either be set for the whole graph or for single series."
+ },
+ "labelsKMB": {
+ "default": "false",
+ "labels": ["Value display/formatting"],
+ "type": "boolean",
+ "description": "Show K/M/B for thousands/millions/billions on y-axis."
+ },
+ "rightGap": {
+ "default": "5",
+ "labels": ["Overall display"],
+ "type": "integer",
+ "description": "Number of pixels to leave blank at the right edge of the Dygraph. This makes it easier to highlight the right-most data point."
+ },
+ "avoidMinZero": {
+ "default": "false",
+ "labels": ["Deprecated"],
+ "type": "boolean",
+ "description": "Deprecated, please use yRangePad instead. When set, the heuristic that fixes the Y axis at zero for a data set with the minimum Y value of zero is disabled. \nThis is particularly useful for data sets that contain many zero values, especially for step plots which may otherwise have lines not visible running along the bottom axis."
+ },
+ "drawAxesAtZero": {
+ "default": "false",
+ "labels": ["Axis display"],
+ "type": "boolean",
+ "description": "When set, draw the X axis at the Y=0 position and the Y axis at the X=0 position if those positions are inside the graph's visible area. Otherwise, draw the axes at the bottom or left graph edge as usual."
+ },
+ "xRangePad": {
+ "default": "0",
+ "labels": ["Axis display"],
+ "type": "float",
+ "description": "Add the specified amount of extra space (in pixels) around the X-axis value range to ensure points at the edges remain visible."
+ },
+ "yRangePad": {
+ "default": "null",
+ "labels": ["Axis display"],
+ "type": "float",
+ "description": "If set, add the specified amount of extra space (in pixels) around the Y-axis value range to ensure points at the edges remain visible. If unset, use the traditional Y padding algorithm."
+ },
+ "xAxisLabelFormatter": {
+ "default": "",
+ "labels": ["Deprecated"],
+ "type": "",
+ "description": "Prefer axes { x: { axisLabelFormatter } }"
+ },
+ "axisLabelFormatter": {
+ "default": "Depends on the data type",
+ "labels": ["Axis display"],
+ "type": "function(number or Date, granularity, opts, dygraph)",
+ "parameters": [
+ [ "number or date" , "Either a number (for a numeric axis) or a Date object (for a date axis)" ],
+ [ "granularity" , "specifies how fine-grained the axis is. For date axes, this is a reference to the time granularity enumeration, defined in dygraph-tickers.js, e.g. Dygraph.WEEKLY." ],
+ [ "opts" , "a function which provides access to various options on the dygraph, e.g. opts('labelsKMB')." ],
+ [ "dygraph" , "the referenced graph" ]
+ ],
+ "description": "Function to call to format the tick values that appear along an axis. This is usually set on a <a href='per-axis.html'>per-axis</a> basis."
+ },
+ "clickCallback": {
+ "snippet": "function(e, date_millis){<br>&nbsp;&nbsp;alert(new Date(date_millis));<br>}",
+ "default": "null",
+ "labels": ["Callbacks"],
+ "type": "function(e, x, points)",
+ "parameters": [
+ [ "e" , "The event object for the click" ],
+ [ "x" , "The x value that was clicked (for dates, this is milliseconds since epoch)" ],
+ [ "points" , "The closest points along that date. See <a href='#point_properties'>Point properties</a> for details." ]
+ ],
+ "description": "A function to call when the canvas is clicked."
+ },
+ "yAxisLabelFormatter": {
+ "default": "",
+ "labels": ["Deprecated"],
+ "type": "",
+ "description": "Prefer axes: { y: { axisLabelFormatter } }"
+ },
+ "labels": {
+ "default": "[\"X\", \"Y1\", \"Y2\", ...]*",
+ "labels": ["Legend"],
+ "type": "array<string>",
+ "description": "A name for each data series, including the independent (X) series. For CSV files and DataTable objections, this is determined by context. For raw data, this must be specified. If it is not, default values are supplied and a warning is logged."
+ },
+ "dateWindow": {
+ "default": "Full range of the input is shown",
+ "labels": ["Axis display"],
+ "type": "Array of two Dates or numbers",
+ "example": "[<br>&nbsp;&nbsp;Date.parse('2006-01-01'),<br>&nbsp;&nbsp;(new Date()).valueOf()<br>]",
+ "description": "Initially zoom in on a section of the graph. Is of the form [earliest, latest], where earliest/latest are milliseconds since epoch. If the data for the x-axis is numeric, the values in dateWindow must also be numbers."
+ },
+ "showRoller": {
+ "default": "false",
+ "labels": ["Interactive Elements", "Rolling Averages"],
+ "type": "boolean",
+ "description": "If the rolling average period text box should be shown."
+ },
+ "sigma": {
+ "default": "2.0",
+ "labels": ["Error Bars"],
+ "type": "float",
+ "description": "When errorBars is set, shade this many standard deviations above/below each point."
+ },
+ "customBars": {
+ "default": "false",
+ "labels": ["CSV parsing", "Error Bars"],
+ "type": "boolean",
+ "description": "When set, parse each CSV cell as \"low;middle;high\". Error bars will be drawn for each point between low and high, with the series itself going through middle."
+ },
+ "colorValue": {
+ "default": "1.0",
+ "labels": ["Data Series Colors"],
+ "type": "float (0.0 - 1.0)",
+ "description": "If colors is not specified, value of the data series colors, as in hue/saturation/value. (0.0-1.0, default 0.5)"
+ },
+ "errorBars": {
+ "default": "false",
+ "labels": ["CSV parsing", "Error Bars"],
+ "type": "boolean",
+ "description": "Does the data contain standard deviations? Setting this to true alters the input format (see above)."
+ },
+ "displayAnnotations": {
+ "default": "false",
+ "labels": ["Annotations"],
+ "type": "boolean",
+ "description": "Only applies when Dygraphs is used as a GViz chart. Causes string columns following a data series to be interpreted as annotations on points in that series. This is the same format used by Google's AnnotatedTimeLine chart."
+ },
+ "panEdgeFraction": {
+ "default": "null",
+ "labels": ["Axis display", "Interactive Elements"],
+ "type": "float",
+ "description": "A value representing the farthest a graph may be panned, in percent of the display. For example, a value of 0.1 means that the graph can only be panned 10% pased the edges of the displayed values. null means no bounds."
+ },
+ "title": {
+ "labels": ["Chart labels"],
+ "type": "string",
+ "default": "null",
+ "description": "Text to display above the chart. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-title' classes."
+ },
+ "titleHeight": {
+ "default": "18",
+ "labels": ["Chart labels"],
+ "type": "integer",
+ "description": "Height of the chart title, in pixels. This also controls the default font size of the title. If you style the title on your own, this controls how much space is set aside above the chart for the title's div."
+ },
+ "xlabel": {
+ "labels": ["Chart labels"],
+ "type": "string",
+ "default": "null",
+ "description": "Text to display below the chart's x-axis. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-xlabel' classes."
+ },
+ "xLabelHeight": {
+ "labels": ["Chart labels"],
+ "type": "integer",
+ "default": "18",
+ "description": "Height of the x-axis label, in pixels. This also controls the default font size of the x-axis label. If you style the label on your own, this controls how much space is set aside below the chart for the x-axis label's div."
+ },
+ "ylabel": {
+ "labels": ["Chart labels"],
+ "type": "string",
+ "default": "null",
+ "description": "Text to display to the left of the chart's y-axis. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-ylabel' classes. The text will be rotated 90 degrees by default, so CSS rules may behave in unintuitive ways. No additional space is set aside for a y-axis label. If you need more space, increase the width of the y-axis tick labels using the yAxisLabelWidth option. If you need a wider div for the y-axis label, either style it that way with CSS (but remember that it's rotated, so width is controlled by the 'height' property) or set the yLabelWidth option."
+ },
+ "y2label": {
+ "labels": ["Chart labels"],
+ "type": "string",
+ "default": "null",
+ "description": "Text to display to the right of the chart's secondary y-axis. This label is only displayed if a secondary y-axis is present. See <a href='http://dygraphs.com/tests/two-axes.html'>this test</a> for an example of how to do this. The comments for the 'ylabel' option generally apply here as well. This label gets a 'dygraph-y2label' instead of a 'dygraph-ylabel' class."
+ },
+ "yLabelWidth": {
+ "labels": ["Chart labels"],
+ "type": "integer",
+ "default": "18",
+ "description": "Width of the div which contains the y-axis label. Since the y-axis label appears rotated 90 degrees, this actually affects the height of its div."
+ },
+ "isZoomedIgnoreProgrammaticZoom" : {
+ "default": "false",
+ "labels": ["Zooming"],
+ "type": "boolean",
+ "description" : "When this option is passed to updateOptions() along with either the <code>dateWindow</code> or <code>valueRange</code> options, the zoom flags are not changed to reflect a zoomed state. This is primarily useful for when the display area of a chart is changed programmatically and also where manual zooming is allowed and use is made of the <code>isZoomed</code> method to determine this."
+ },
+ "drawXGrid": {
+ "default": "true",
+ "labels": ["Grid","Deprecated"],
+ "type": "boolean",
+ "description" : "Use the per-axis option drawGrid instead. Whether to display vertical gridlines under the chart."
+ },
+ "drawYGrid": {
+ "default": "true",
+ "labels": ["Grid","Deprecated"],
+ "type": "boolean",
+ "description" : "Use the per-axis option drawGrid instead. Whether to display horizontal gridlines under the chart."
+ },
+ "drawGrid": {
+ "default": "true for x and y, false for y2",
+ "labels": ["Grid"],
+ "type": "boolean",
+ "description" : "Whether to display gridlines in the chart. This may be set on a per-axis basis to define the visibility of each axis' grid separately."
+ },
+ "independentTicks": {
+ "default": "true for y, false for y2",
+ "labels": ["Axis display", "Grid"],
+ "type": "boolean",
+ "description" : "Only valid for y and y2, has no effect on x: This option defines whether the y axes should align their ticks or if they should be independent. Possible combinations: 1.) y=true, y2=false (default): y is the primary axis and the y2 ticks are aligned to the the ones of y. (only 1 grid) 2.) y=false, y2=true: y2 is the primary axis and the y ticks are aligned to the the ones of y2. (only 1 grid) 3.) y=true, y2=true: Both axis are independent and have their own ticks. (2 grids) 4.) y=false, y2=false: Invalid configuration causes an error."
+ },
+ "drawXAxis": {
+ "default": "true",
+ "labels": ["Axis display"],
+ "type": "boolean",
+ "description" : "Whether to draw the x-axis. Setting this to false also prevents x-axis ticks from being drawn and reclaims the space for the chart grid/lines."
+ },
+ "drawYAxis": {
+ "default": "true",
+ "labels": ["Axis display"],
+ "type": "boolean",
+ "description" : "Whether to draw the y-axis. Setting this to false also prevents y-axis ticks from being drawn and reclaims the space for the chart grid/lines."
+ },
+ "gridLineWidth": {
+ "default": "0.3",
+ "labels": ["Grid"],
+ "type": "float",
+ "description" : "Thickness (in pixels) of the gridlines drawn under the chart. The vertical/horizontal gridlines can be turned off entirely by using the drawXGrid and drawYGrid options. This may be set on a per-axis basis to define each axis' grid separately."
+ },
+ "axisLineWidth": {
+ "default": "0.3",
+ "labels": ["Axis display"],
+ "type": "float",
+ "description" : "Thickness (in pixels) of the x- and y-axis lines."
+ },
+ "axisLineColor": {
+ "default": "black",
+ "labels": ["Axis display"],
+ "type": "string",
+ "description" : "Color of the x- and y-axis lines. Accepts any value which the HTML canvas strokeStyle attribute understands, e.g. 'black' or 'rgb(0, 100, 255)'."
+ },
+ "fillAlpha": {
+ "default": "0.15",
+ "labels": ["Error Bars", "Data Series Colors"],
+ "type": "float (0.0 - 1.0)",
+ "description" : "Error bars (or custom bars) for each series are drawn in the same color as the series, but with partial transparency. This sets the transparency. A value of 0.0 means that the error bars will not be drawn, whereas a value of 1.0 means that the error bars will be as dark as the line for the series itself. This can be used to produce chart lines whose thickness varies at each point."
+ },
+ "axisLabelColor": {
+ "default": "black",
+ "labels": ["Axis display"],
+ "type": "string",
+ "description" : "Color for x- and y-axis labels. This is a CSS color string."
+ },
+ "axisLabelWidth": {
+ "default": "50",
+ "labels": ["Axis display", "Chart labels"],
+ "type": "integer",
+ "description" : "Width (in pixels) of the containing divs for x- and y-axis labels. For the y-axis, this also controls "
+ },
+ "sigFigs" : {
+ "default": "null",
+ "labels": ["Value display/formatting"],
+ "type": "integer",
+ "description": "By default, dygraphs displays numbers with a fixed number of digits after the decimal point. If you'd prefer to have a fixed number of significant figures, set this option to that number of sig figs. A value of 2, for instance, would cause 1 to be display as 1.0 and 1234 to be displayed as 1.23e+3."
+ },
+ "digitsAfterDecimal" : {
+ "default": "2",
+ "labels": ["Value display/formatting"],
+ "type": "integer",
+ "description": "Unless it's run in scientific mode (see the <code>sigFigs</code> option), dygraphs displays numbers with <code>digitsAfterDecimal</code> digits after the decimal point. Trailing zeros are not displayed, so with a value of 2 you'll get '0', '0.1', '0.12', '123.45' but not '123.456' (it will be rounded to '123.46'). Numbers with absolute value less than 0.1^digitsAfterDecimal (i.e. those which would show up as '0.00') will be displayed in scientific notation."
+ },
+ "maxNumberWidth" : {
+ "default": "6",
+ "labels": ["Value display/formatting"],
+ "type": "integer",
+ "description": "When displaying numbers in normal (not scientific) mode, large numbers will be displayed with many trailing zeros (e.g. 100000000 instead of 1e9). This can lead to unwieldy y-axis labels. If there are more than <code>maxNumberWidth</code> digits to the left of the decimal in a number, dygraphs will switch to scientific notation, even when not operating in scientific mode. If you'd like to see all those digits, set this to something large, like 20 or 30."
+ },
+ "file": {
+ "default": "(set when constructed)",
+ "labels": ["Data"],
+ "type": "string (URL of CSV or CSV), GViz DataTable or 2D Array",
+ "description": "Sets the data being displayed in the chart. This can only be set when calling updateOptions; it cannot be set from the constructor. For a full description of valid data formats, see the <a href='http://dygraphs.com/data.html'>Data Formats</a> page."
+ },
+ "timingName": {
+ "default": "null",
+ "labels": [ "Debugging" ],
+ "type": "string",
+ "description": "Set this option to log timing information. The value of the option will be logged along with the timimg, so that you can distinguish multiple dygraphs on the same page."
+ },
+ "showRangeSelector": {
+ "default": "false",
+ "labels": ["Interactive Elements"],
+ "type": "boolean",
+ "description": "Show or hide the range selector widget."
+ },
+ "rangeSelectorHeight": {
+ "default": "40",
+ "labels": ["Interactive Elements"],
+ "type": "integer",
+ "description": "Height, in pixels, of the range selector widget. This option can only be specified at Dygraph creation time."
+ },
+ "rangeSelectorPlotStrokeColor": {
+ "default": "#808FAB",
+ "labels": ["Interactive Elements"],
+ "type": "string",
+ "description": "The range selector mini plot stroke color. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\". You can also specify null or \"\" to turn off stroke."
+ },
+ "rangeSelectorPlotFillColor": {
+ "default": "#A7B1C4",
+ "labels": ["Interactive Elements"],
+ "type": "string",
+ "description": "The range selector mini plot fill color. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\". You can also specify null or \"\" to turn off fill."
+ },
+ "animatedZooms": {
+ "default": "false",
+ "labels": ["Interactive Elements"],
+ "type": "boolean",
+ "description": "Set this option to animate the transition between zoom windows. Applies to programmatic and interactive zooms. Note that if you also set a drawCallback, it will be called several times on each zoom. If you set a zoomCallback, it will only be called after the animation is complete."
+ },
+ "plotter": {
+ "default": "[DygraphCanvasRenderer.Plotters.fillPlotter, DygraphCanvasRenderer.Plotters.errorPlotter, DygraphCanvasRenderer.Plotters.linePlotter]",
+ "labels": ["Data Line display"],
+ "type": "array or function",
+ "description": "A function (or array of functions) which plot each data series on the chart. TODO(danvk): more details! May be set per-series."
+ },
+ "series": {
+ "default": "null",
+ "labels": ["Series"],
+ "type": "Object",
+ "description": "Defines per-series options. Its keys match the y-axis label names, and the values are dictionaries themselves that contain options specific to that series. When this option is missing, it falls back on the old-style of per-series options comingled with global options."
+ },
+ "plugins": {
+ "default": "[]",
+ "labels": ["Configuration"],
+ "type": "Array<plugin>",
+ "description": "Defines per-graph plug-ins. Useful for per-graph customization"
+ }
+}
+; // </JSON>
+// NOTE: in addition to parsing as JS, this snippet is expected to be valid
+// JSON. This assumption cannot be checked in JS, but it will be checked when
+// documentation is generated by the generate-documentation.py script. For the
+// most part, this just means that you should always use double quotes.
+
+// Do a quick sanity check on the options reference.
+(function() {
+ "use strict";
+ var warn = function(msg) { if (window.console) window.console.warn(msg); };
+ var flds = ['type', 'default', 'description'];
+ var valid_cats = [
+ 'Annotations',
+ 'Axis display',
+ 'Chart labels',
+ 'CSV parsing',
+ 'Callbacks',
+ 'Data',
+ 'Data Line display',
+ 'Data Series Colors',
+ 'Error Bars',
+ 'Grid',
+ 'Interactive Elements',
+ 'Legend',
+ 'Overall display',
+ 'Rolling Averages',
+ 'Series',
+ 'Value display/formatting',
+ 'Zooming',
+ 'Debugging',
+ 'Configuration',
+ 'Deprecated'
+ ];
+ var i;
+ var cats = {};
+ for (i = 0; i < valid_cats.length; i++) cats[valid_cats[i]] = true;
+
+ for (var k in Dygraph.OPTIONS_REFERENCE) {
+ if (!Dygraph.OPTIONS_REFERENCE.hasOwnProperty(k)) continue;
+ var op = Dygraph.OPTIONS_REFERENCE[k];
+ for (i = 0; i < flds.length; i++) {
+ if (!op.hasOwnProperty(flds[i])) {
+ warn('Option ' + k + ' missing "' + flds[i] + '" property');
+ } else if (typeof(op[flds[i]]) != 'string') {
+ warn(k + '.' + flds[i] + ' must be of type string');
+ }
+ }
+ var labels = op.labels;
+ if (typeof(labels) !== 'object') {
+ warn('Option "' + k + '" is missing a "labels": [...] option');
+ } else {
+ for (i = 0; i < labels.length; i++) {
+ if (!cats.hasOwnProperty(labels[i])) {
+ warn('Option "' + k + '" has label "' + labels[i] +
+ '", which is invalid.');
+ }
+ }
+ }
+ }
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options.js
new file mode 100644
index 00000000..0f90086c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options.js
@@ -0,0 +1,384 @@
+/**
+ * @license
+ * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+
+/**
+ * @fileoverview DygraphOptions is responsible for parsing and returning information about options.
+ *
+ * Still tightly coupled to Dygraphs, we could remove some of that, you know.
+ */
+
+var DygraphOptions = (function() {
+
+/*jshint sub:true */
+/*global Dygraph:false */
+"use strict";
+
+/*
+ * Interesting member variables: (REMOVING THIS LIST AS I CLOSURIZE)
+ * global_ - global attributes (common among all graphs, AIUI)
+ * user - attributes set by the user
+ * series_ - { seriesName -> { idx, yAxis, options }}
+ */
+
+/**
+ * This parses attributes into an object that can be easily queried.
+ *
+ * It doesn't necessarily mean that all options are available, specifically
+ * if labels are not yet available, since those drive details of the per-series
+ * and per-axis options.
+ *
+ * @param {Dygraph} dygraph The chart to which these options belong.
+ * @constructor
+ */
+var DygraphOptions = function(dygraph) {
+ /**
+ * The dygraph.
+ * @type {!Dygraph}
+ */
+ this.dygraph_ = dygraph;
+
+ /**
+ * Array of axis index to { series : [ series names ] , options : { axis-specific options. }
+ * @type {Array.<{series : Array.<string>, options : Object}>} @private
+ */
+ this.yAxes_ = [];
+
+ /**
+ * Contains x-axis specific options, which are stored in the options key.
+ * This matches the yAxes_ object structure (by being a dictionary with an
+ * options element) allowing for shared code.
+ * @type {options: Object} @private
+ */
+ this.xAxis_ = {};
+ this.series_ = {};
+
+ // Once these two objects are initialized, you can call get();
+ this.global_ = this.dygraph_.attrs_;
+ this.user_ = this.dygraph_.user_attrs_ || {};
+
+ /**
+ * A list of series in columnar order.
+ * @type {Array.<string>}
+ */
+ this.labels_ = [];
+
+ this.highlightSeries_ = this.get("highlightSeriesOpts") || {};
+ this.reparseSeries();
+};
+
+/**
+ * Not optimal, but does the trick when you're only using two axes.
+ * If we move to more axes, this can just become a function.
+ *
+ * @type {Object.<number>}
+ * @private
+ */
+DygraphOptions.AXIS_STRING_MAPPINGS_ = {
+ 'y' : 0,
+ 'Y' : 0,
+ 'y1' : 0,
+ 'Y1' : 0,
+ 'y2' : 1,
+ 'Y2' : 1
+};
+
+/**
+ * @param {string|number} axis
+ * @private
+ */
+DygraphOptions.axisToIndex_ = function(axis) {
+ if (typeof(axis) == "string") {
+ if (DygraphOptions.AXIS_STRING_MAPPINGS_.hasOwnProperty(axis)) {
+ return DygraphOptions.AXIS_STRING_MAPPINGS_[axis];
+ }
+ throw "Unknown axis : " + axis;
+ }
+ if (typeof(axis) == "number") {
+ if (axis === 0 || axis === 1) {
+ return axis;
+ }
+ throw "Dygraphs only supports two y-axes, indexed from 0-1.";
+ }
+ if (axis) {
+ throw "Unknown axis : " + axis;
+ }
+ // No axis specification means axis 0.
+ return 0;
+};
+
+/**
+ * Reparses options that are all related to series. This typically occurs when
+ * options are either updated, or source data has been made available.
+ *
+ * TODO(konigsberg): The method name is kind of weak; fix.
+ */
+DygraphOptions.prototype.reparseSeries = function() {
+ var labels = this.get("labels");
+ if (!labels) {
+ return; // -- can't do more for now, will parse after getting the labels.
+ }
+
+ this.labels_ = labels.slice(1);
+
+ this.yAxes_ = [ { series : [], options : {}} ]; // Always one axis at least.
+ this.xAxis_ = { options : {} };
+ this.series_ = {};
+
+ // Traditionally, per-series options were specified right up there with the options. For instance
+ // {
+ // labels: [ "X", "foo", "bar" ],
+ // pointSize: 3,
+ // foo : {}, // options for foo
+ // bar : {} // options for bar
+ // }
+ //
+ // Moving forward, series really should be specified in the series element, separating them.
+ // like so:
+ //
+ // {
+ // labels: [ "X", "foo", "bar" ],
+ // pointSize: 3,
+ // series : {
+ // foo : {}, // options for foo
+ // bar : {} // options for bar
+ // }
+ // }
+ //
+ // So, if series is found, it's expected to contain per-series data, otherwise we fall
+ // back.
+ var oldStyleSeries = !this.user_["series"];
+
+ if (oldStyleSeries) {
+ var axisId = 0; // 0-offset; there's always one.
+ // Go through once, add all the series, and for those with {} axis options, add a new axis.
+ for (var idx = 0; idx < this.labels_.length; idx++) {
+ var seriesName = this.labels_[idx];
+
+ var optionsForSeries = this.user_[seriesName] || {};
+
+ var yAxis = 0;
+ var axis = optionsForSeries["axis"];
+ if (typeof(axis) == 'object') {
+ yAxis = ++axisId;
+ this.yAxes_[yAxis] = { series : [ seriesName ], options : axis };
+ }
+
+ // Associate series without axis options with axis 0.
+ if (!axis) { // undefined
+ this.yAxes_[0].series.push(seriesName);
+ }
+
+ this.series_[seriesName] = { idx: idx, yAxis: yAxis, options : optionsForSeries };
+ }
+
+ // Go through one more time and assign series to an axis defined by another
+ // series, e.g. { 'Y1: { axis: {} }, 'Y2': { axis: 'Y1' } }
+ for (var idx = 0; idx < this.labels_.length; idx++) {
+ var seriesName = this.labels_[idx];
+ var optionsForSeries = this.series_[seriesName]["options"];
+ var axis = optionsForSeries["axis"];
+
+ if (typeof(axis) == 'string') {
+ if (!this.series_.hasOwnProperty(axis)) {
+ Dygraph.error("Series " + seriesName + " wants to share a y-axis with " +
+ "series " + axis + ", which does not define its own axis.");
+ return;
+ }
+ var yAxis = this.series_[axis].yAxis;
+ this.series_[seriesName].yAxis = yAxis;
+ this.yAxes_[yAxis].series.push(seriesName);
+ }
+ }
+ } else {
+ for (var idx = 0; idx < this.labels_.length; idx++) {
+ var seriesName = this.labels_[idx];
+ var optionsForSeries = this.user_.series[seriesName] || {};
+ var yAxis = DygraphOptions.axisToIndex_(optionsForSeries["axis"]);
+
+ this.series_[seriesName] = {
+ idx: idx,
+ yAxis: yAxis,
+ options : optionsForSeries };
+
+ if (!this.yAxes_[yAxis]) {
+ this.yAxes_[yAxis] = { series : [ seriesName ], options : {} };
+ } else {
+ this.yAxes_[yAxis].series.push(seriesName);
+ }
+ }
+ }
+
+ var axis_opts = this.user_["axes"] || {};
+ Dygraph.update(this.yAxes_[0].options, axis_opts["y"] || {});
+ if (this.yAxes_.length > 1) {
+ Dygraph.update(this.yAxes_[1].options, axis_opts["y2"] || {});
+ }
+ Dygraph.update(this.xAxis_.options, axis_opts["x"] || {});
+};
+
+/**
+ * Get a global value.
+ *
+ * @param {string} name the name of the option.
+ */
+DygraphOptions.prototype.get = function(name) {
+ var result = this.getGlobalUser_(name);
+ if (result !== null) {
+ return result;
+ }
+ return this.getGlobalDefault_(name);
+};
+
+DygraphOptions.prototype.getGlobalUser_ = function(name) {
+ if (this.user_.hasOwnProperty(name)) {
+ return this.user_[name];
+ }
+ return null;
+};
+
+DygraphOptions.prototype.getGlobalDefault_ = function(name) {
+ if (this.global_.hasOwnProperty(name)) {
+ return this.global_[name];
+ }
+ if (Dygraph.DEFAULT_ATTRS.hasOwnProperty(name)) {
+ return Dygraph.DEFAULT_ATTRS[name];
+ }
+ return null;
+};
+
+/**
+ * Get a value for a specific axis. If there is no specific value for the axis,
+ * the global value is returned.
+ *
+ * @param {string} name the name of the option.
+ * @param {string|number} axis the axis to search. Can be the string representation
+ * ("y", "y2") or the axis number (0, 1).
+ */
+DygraphOptions.prototype.getForAxis = function(name, axis) {
+ var axisIdx;
+ var axisString;
+
+ // Since axis can be a number or a string, straighten everything out here.
+ if (typeof(axis) == 'number') {
+ axisIdx = axis;
+ axisString = axisIdx === 0 ? "y" : "y2";
+ } else {
+ if (axis == "y1") { axis = "y"; } // Standardize on 'y'. Is this bad? I think so.
+ if (axis == "y") {
+ axisIdx = 0;
+ } else if (axis == "y2") {
+ axisIdx = 1;
+ } else if (axis == "x") {
+ axisIdx = -1; // simply a placeholder for below.
+ } else {
+ throw "Unknown axis " + axis;
+ }
+ axisString = axis;
+ }
+
+ var userAxis = (axisIdx == -1) ? this.xAxis_ : this.yAxes_[axisIdx];
+
+ // Search the user-specified axis option first.
+ if (userAxis) { // This condition could be removed if we always set up this.yAxes_ for y2.
+ var axisOptions = userAxis.options;
+ if (axisOptions.hasOwnProperty(name)) {
+ return axisOptions[name];
+ }
+ }
+
+ // User-specified global options second.
+ var result = this.getGlobalUser_(name);
+ if (result !== null) {
+ return result;
+ }
+
+ // Default axis options third.
+ var defaultAxisOptions = Dygraph.DEFAULT_ATTRS.axes[axisString];
+ if (defaultAxisOptions.hasOwnProperty(name)) {
+ return defaultAxisOptions[name];
+ }
+
+ // Default global options last.
+ return this.getGlobalDefault_(name);
+};
+
+/**
+ * Get a value for a specific series. If there is no specific value for the series,
+ * the value for the axis is returned (and afterwards, the global value.)
+ *
+ * @param {string} name the name of the option.
+ * @param {string} series the series to search.
+ */
+DygraphOptions.prototype.getForSeries = function(name, series) {
+ // Honors indexes as series.
+ if (series === this.dygraph_.getHighlightSeries()) {
+ if (this.highlightSeries_.hasOwnProperty(name)) {
+ return this.highlightSeries_[name];
+ }
+ }
+
+ if (!this.series_.hasOwnProperty(series)) {
+ throw "Unknown series: " + series;
+ }
+
+ var seriesObj = this.series_[series];
+ var seriesOptions = seriesObj["options"];
+ if (seriesOptions.hasOwnProperty(name)) {
+ return seriesOptions[name];
+ }
+
+ return this.getForAxis(name, seriesObj["yAxis"]);
+};
+
+/**
+ * Returns the number of y-axes on the chart.
+ * @return {number} the number of axes.
+ */
+DygraphOptions.prototype.numAxes = function() {
+ return this.yAxes_.length;
+};
+
+/**
+ * Return the y-axis for a given series, specified by name.
+ */
+DygraphOptions.prototype.axisForSeries = function(series) {
+ return this.series_[series].yAxis;
+};
+
+/**
+ * Returns the options for the specified axis.
+ */
+// TODO(konigsberg): this is y-axis specific. Support the x axis.
+DygraphOptions.prototype.axisOptions = function(yAxis) {
+ return this.yAxes_[yAxis].options;
+};
+
+/**
+ * Return the series associated with an axis.
+ */
+DygraphOptions.prototype.seriesForAxis = function(yAxis) {
+ return this.yAxes_[yAxis].series;
+};
+
+/**
+ * Return the list of all series, in their columnar order.
+ */
+DygraphOptions.prototype.seriesNames = function() {
+ return this.labels_;
+};
+
+/* Are we using this? */
+/**
+ * Return the index of the specified series.
+ * @param {string} series the series name.
+ */
+DygraphOptions.prototype.indexOfSeries = function(series) {
+ return this.series_[series].idx;
+};
+
+return DygraphOptions;
+
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-base.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-base.js
new file mode 100644
index 00000000..7f758a9a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-base.js
@@ -0,0 +1,4 @@
+/*global Dygraph:false */
+
+// Namespace for plugins. Load this before plugins/*.js files.
+Dygraph.Plugins = {};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-install.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-install.js
new file mode 100644
index 00000000..806a9274
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-install.js
@@ -0,0 +1,19 @@
+/*global Dygraph:false */
+
+// This file defines the ordering of the plugins.
+//
+// The ordering is from most-general to most-specific.
+// This means that, in an event cascade, plugins which have registered for that
+// event will be called in reverse order.
+//
+// This is most relevant for plugins which register a layout event, e.g.
+// Axes, Legend and ChartLabels.
+
+Dygraph.PLUGINS.push(
+ Dygraph.Plugins.Legend,
+ Dygraph.Plugins.Axes,
+ Dygraph.Plugins.RangeSelector, // Has to be before ChartLabels so that its callbacks are called after ChartLabels' callbacks.
+ Dygraph.Plugins.ChartLabels,
+ Dygraph.Plugins.Annotations,
+ Dygraph.Plugins.Grid
+);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-tickers.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-tickers.js
new file mode 100644
index 00000000..f4778b12
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-tickers.js
@@ -0,0 +1,487 @@
+/**
+ * @license
+ * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+
+/**
+ * @fileoverview Description of this file.
+ * @author danvk@google.com (Dan Vanderkam)
+ *
+ * A ticker is a function with the following interface:
+ *
+ * function(a, b, pixels, options_view, dygraph, forced_values);
+ * -> [ { v: tick1_v, label: tick1_label[, label_v: label_v1] },
+ * { v: tick2_v, label: tick2_label[, label_v: label_v2] },
+ * ...
+ * ]
+ *
+ * The returned value is called a "tick list".
+ *
+ * Arguments
+ * ---------
+ *
+ * [a, b] is the range of the axis for which ticks are being generated. For a
+ * numeric axis, these will simply be numbers. For a date axis, these will be
+ * millis since epoch (convertable to Date objects using "new Date(a)" and "new
+ * Date(b)").
+ *
+ * opts provides access to chart- and axis-specific options. It can be used to
+ * access number/date formatting code/options, check for a log scale, etc.
+ *
+ * pixels is the length of the axis in pixels. opts('pixelsPerLabel') is the
+ * minimum amount of space to be allotted to each label. For instance, if
+ * pixels=400 and opts('pixelsPerLabel')=40 then the ticker should return
+ * between zero and ten (400/40) ticks.
+ *
+ * dygraph is the Dygraph object for which an axis is being constructed.
+ *
+ * forced_values is used for secondary y-axes. The tick positions are typically
+ * set by the primary y-axis, so the secondary y-axis has no choice in where to
+ * put these. It simply has to generate labels for these data values.
+ *
+ * Tick lists
+ * ----------
+ * Typically a tick will have both a grid/tick line and a label at one end of
+ * that line (at the bottom for an x-axis, at left or right for the y-axis).
+ *
+ * A tick may be missing one of these two components:
+ * - If "label_v" is specified instead of "v", then there will be no tick or
+ * gridline, just a label.
+ * - Similarly, if "label" is not specified, then there will be a gridline
+ * without a label.
+ *
+ * This flexibility is useful in a few situations:
+ * - For log scales, some of the tick lines may be too close to all have labels.
+ * - For date scales where years are being displayed, it is desirable to display
+ * tick marks at the beginnings of years but labels (e.g. "2006") in the
+ * middle of the years.
+ */
+
+/*jshint globalstrict:true, sub:true */
+/*global Dygraph:false */
+"use strict";
+
+/** @typedef {Array.<{v:number, label:string, label_v:(string|undefined)}>} */
+Dygraph.TickList = undefined; // the ' = undefined' keeps jshint happy.
+
+/** @typedef {function(
+ * number,
+ * number,
+ * number,
+ * function(string):*,
+ * Dygraph=,
+ * Array.<number>=
+ * ): Dygraph.TickList}
+ */
+Dygraph.Ticker = undefined; // the ' = undefined' keeps jshint happy.
+
+/** @type {Dygraph.Ticker} */
+Dygraph.numericLinearTicks = function(a, b, pixels, opts, dygraph, vals) {
+ var nonLogscaleOpts = function(opt) {
+ if (opt === 'logscale') return false;
+ return opts(opt);
+ };
+ return Dygraph.numericTicks(a, b, pixels, nonLogscaleOpts, dygraph, vals);
+};
+
+/** @type {Dygraph.Ticker} */
+Dygraph.numericTicks = function(a, b, pixels, opts, dygraph, vals) {
+ var pixels_per_tick = /** @type{number} */(opts('pixelsPerLabel'));
+ var ticks = [];
+ var i, j, tickV, nTicks;
+ if (vals) {
+ for (i = 0; i < vals.length; i++) {
+ ticks.push({v: vals[i]});
+ }
+ } else {
+ // TODO(danvk): factor this log-scale block out into a separate function.
+ if (opts("logscale")) {
+ nTicks = Math.floor(pixels / pixels_per_tick);
+ var minIdx = Dygraph.binarySearch(a, Dygraph.PREFERRED_LOG_TICK_VALUES, 1);
+ var maxIdx = Dygraph.binarySearch(b, Dygraph.PREFERRED_LOG_TICK_VALUES, -1);
+ if (minIdx == -1) {
+ minIdx = 0;
+ }
+ if (maxIdx == -1) {
+ maxIdx = Dygraph.PREFERRED_LOG_TICK_VALUES.length - 1;
+ }
+ // Count the number of tick values would appear, if we can get at least
+ // nTicks / 4 accept them.
+ var lastDisplayed = null;
+ if (maxIdx - minIdx >= nTicks / 4) {
+ for (var idx = maxIdx; idx >= minIdx; idx--) {
+ var tickValue = Dygraph.PREFERRED_LOG_TICK_VALUES[idx];
+ var pixel_coord = Math.log(tickValue / a) / Math.log(b / a) * pixels;
+ var tick = { v: tickValue };
+ if (lastDisplayed === null) {
+ lastDisplayed = {
+ tickValue : tickValue,
+ pixel_coord : pixel_coord
+ };
+ } else {
+ if (Math.abs(pixel_coord - lastDisplayed.pixel_coord) >= pixels_per_tick) {
+ lastDisplayed = {
+ tickValue : tickValue,
+ pixel_coord : pixel_coord
+ };
+ } else {
+ tick.label = "";
+ }
+ }
+ ticks.push(tick);
+ }
+ // Since we went in backwards order.
+ ticks.reverse();
+ }
+ }
+
+ // ticks.length won't be 0 if the log scale function finds values to insert.
+ if (ticks.length === 0) {
+ // Basic idea:
+ // Try labels every 1, 2, 5, 10, 20, 50, 100, etc.
+ // Calculate the resulting tick spacing (i.e. this.height_ / nTicks).
+ // The first spacing greater than pixelsPerYLabel is what we use.
+ // TODO(danvk): version that works on a log scale.
+ var kmg2 = opts("labelsKMG2");
+ var mults, base;
+ if (kmg2) {
+ mults = [1, 2, 4, 8, 16, 32, 64, 128, 256];
+ base = 16;
+ } else {
+ mults = [1, 2, 5, 10, 20, 50, 100];
+ base = 10;
+ }
+
+ // Get the maximum number of permitted ticks based on the
+ // graph's pixel size and pixels_per_tick setting.
+ var max_ticks = Math.ceil(pixels / pixels_per_tick);
+
+ // Now calculate the data unit equivalent of this tick spacing.
+ // Use abs() since graphs may have a reversed Y axis.
+ var units_per_tick = Math.abs(b - a) / max_ticks;
+
+ // Based on this, get a starting scale which is the largest
+ // integer power of the chosen base (10 or 16) that still remains
+ // below the requested pixels_per_tick spacing.
+ var base_power = Math.floor(Math.log(units_per_tick) / Math.log(base));
+ var base_scale = Math.pow(base, base_power);
+
+ // Now try multiples of the starting scale until we find one
+ // that results in tick marks spaced sufficiently far apart.
+ // The "mults" array should cover the range 1 .. base^2 to
+ // adjust for rounding and edge effects.
+ var scale, low_val, high_val, spacing;
+ for (j = 0; j < mults.length; j++) {
+ scale = base_scale * mults[j];
+ low_val = Math.floor(a / scale) * scale;
+ high_val = Math.ceil(b / scale) * scale;
+ nTicks = Math.abs(high_val - low_val) / scale;
+ spacing = pixels / nTicks;
+ if (spacing > pixels_per_tick) break;
+ }
+
+ // Construct the set of ticks.
+ // Allow reverse y-axis if it's explicitly requested.
+ if (low_val > high_val) scale *= -1;
+ for (i = 0; i < nTicks; i++) {
+ tickV = low_val + i * scale;
+ ticks.push( {v: tickV} );
+ }
+ }
+ }
+
+ var formatter = /**@type{AxisLabelFormatter}*/(opts('axisLabelFormatter'));
+
+ // Add labels to the ticks.
+ for (i = 0; i < ticks.length; i++) {
+ if (ticks[i].label !== undefined) continue; // Use current label.
+ // TODO(danvk): set granularity to something appropriate here.
+ ticks[i].label = formatter(ticks[i].v, 0, opts, dygraph);
+ }
+
+ return ticks;
+};
+
+
+/** @type {Dygraph.Ticker} */
+Dygraph.dateTicker = function(a, b, pixels, opts, dygraph, vals) {
+ var chosen = Dygraph.pickDateTickGranularity(a, b, pixels, opts);
+
+ if (chosen >= 0) {
+ return Dygraph.getDateAxis(a, b, chosen, opts, dygraph);
+ } else {
+ // this can happen if self.width_ is zero.
+ return [];
+ }
+};
+
+// Time granularity enumeration
+// TODO(danvk): make this an @enum
+Dygraph.SECONDLY = 0;
+Dygraph.TWO_SECONDLY = 1;
+Dygraph.FIVE_SECONDLY = 2;
+Dygraph.TEN_SECONDLY = 3;
+Dygraph.THIRTY_SECONDLY = 4;
+Dygraph.MINUTELY = 5;
+Dygraph.TWO_MINUTELY = 6;
+Dygraph.FIVE_MINUTELY = 7;
+Dygraph.TEN_MINUTELY = 8;
+Dygraph.THIRTY_MINUTELY = 9;
+Dygraph.HOURLY = 10;
+Dygraph.TWO_HOURLY = 11;
+Dygraph.SIX_HOURLY = 12;
+Dygraph.DAILY = 13;
+Dygraph.WEEKLY = 14;
+Dygraph.MONTHLY = 15;
+Dygraph.QUARTERLY = 16;
+Dygraph.BIANNUAL = 17;
+Dygraph.ANNUAL = 18;
+Dygraph.DECADAL = 19;
+Dygraph.CENTENNIAL = 20;
+Dygraph.NUM_GRANULARITIES = 21;
+
+/** @type {Array.<number>} */
+Dygraph.SHORT_SPACINGS = [];
+Dygraph.SHORT_SPACINGS[Dygraph.SECONDLY] = 1000 * 1;
+Dygraph.SHORT_SPACINGS[Dygraph.TWO_SECONDLY] = 1000 * 2;
+Dygraph.SHORT_SPACINGS[Dygraph.FIVE_SECONDLY] = 1000 * 5;
+Dygraph.SHORT_SPACINGS[Dygraph.TEN_SECONDLY] = 1000 * 10;
+Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_SECONDLY] = 1000 * 30;
+Dygraph.SHORT_SPACINGS[Dygraph.MINUTELY] = 1000 * 60;
+Dygraph.SHORT_SPACINGS[Dygraph.TWO_MINUTELY] = 1000 * 60 * 2;
+Dygraph.SHORT_SPACINGS[Dygraph.FIVE_MINUTELY] = 1000 * 60 * 5;
+Dygraph.SHORT_SPACINGS[Dygraph.TEN_MINUTELY] = 1000 * 60 * 10;
+Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_MINUTELY] = 1000 * 60 * 30;
+Dygraph.SHORT_SPACINGS[Dygraph.HOURLY] = 1000 * 3600;
+Dygraph.SHORT_SPACINGS[Dygraph.TWO_HOURLY] = 1000 * 3600 * 2;
+Dygraph.SHORT_SPACINGS[Dygraph.SIX_HOURLY] = 1000 * 3600 * 6;
+Dygraph.SHORT_SPACINGS[Dygraph.DAILY] = 1000 * 86400;
+Dygraph.SHORT_SPACINGS[Dygraph.WEEKLY] = 1000 * 604800;
+
+/**
+ * A collection of objects specifying where it is acceptable to place tick
+ * marks for granularities larger than WEEKLY.
+ * 'months' is an array of month indexes on which to place tick marks.
+ * 'year_mod' ticks are placed when year % year_mod = 0.
+ * @type {Array.<Object>}
+ */
+Dygraph.LONG_TICK_PLACEMENTS = [];
+Dygraph.LONG_TICK_PLACEMENTS[Dygraph.MONTHLY] = {
+ months : [0,1,2,3,4,5,6,7,8,9,10,11],
+ year_mod : 1
+};
+Dygraph.LONG_TICK_PLACEMENTS[Dygraph.QUARTERLY] = {
+ months: [0,3,6,9],
+ year_mod: 1
+};
+Dygraph.LONG_TICK_PLACEMENTS[Dygraph.BIANNUAL] = {
+ months: [0,6],
+ year_mod: 1
+};
+Dygraph.LONG_TICK_PLACEMENTS[Dygraph.ANNUAL] = {
+ months: [0],
+ year_mod: 1
+};
+Dygraph.LONG_TICK_PLACEMENTS[Dygraph.DECADAL] = {
+ months: [0],
+ year_mod: 10
+};
+Dygraph.LONG_TICK_PLACEMENTS[Dygraph.CENTENNIAL] = {
+ months: [0],
+ year_mod: 100
+};
+
+/**
+ * This is a list of human-friendly values at which to show tick marks on a log
+ * scale. It is k * 10^n, where k=1..9 and n=-39..+39, so:
+ * ..., 1, 2, 3, 4, 5, ..., 9, 10, 20, 30, ..., 90, 100, 200, 300, ...
+ * NOTE: this assumes that Dygraph.LOG_SCALE = 10.
+ * @type {Array.<number>}
+ */
+Dygraph.PREFERRED_LOG_TICK_VALUES = function() {
+ var vals = [];
+ for (var power = -39; power <= 39; power++) {
+ var range = Math.pow(10, power);
+ for (var mult = 1; mult <= 9; mult++) {
+ var val = range * mult;
+ vals.push(val);
+ }
+ }
+ return vals;
+}();
+
+/**
+ * Determine the correct granularity of ticks on a date axis.
+ *
+ * @param {number} a Left edge of the chart (ms)
+ * @param {number} b Right edge of the chart (ms)
+ * @param {number} pixels Size of the chart in the relevant dimension (width).
+ * @param {function(string):*} opts Function mapping from option name ->
+ * value.
+ * @return {number} The appropriate axis granularity for this chart. See the
+ * enumeration of possible values in dygraph-tickers.js.
+ */
+Dygraph.pickDateTickGranularity = function(a, b, pixels, opts) {
+ var pixels_per_tick = /** @type{number} */(opts('pixelsPerLabel'));
+ for (var i = 0; i < Dygraph.NUM_GRANULARITIES; i++) {
+ var num_ticks = Dygraph.numDateTicks(a, b, i);
+ if (pixels / num_ticks >= pixels_per_tick) {
+ return i;
+ }
+ }
+ return -1;
+};
+
+/**
+ * @param {number} start_time
+ * @param {number} end_time
+ * @param {number} granularity (one of the granularities enumerated above)
+ * @return {number} Number of ticks that would result.
+ */
+Dygraph.numDateTicks = function(start_time, end_time, granularity) {
+ if (granularity < Dygraph.MONTHLY) {
+ // Generate one tick mark for every fixed interval of time.
+ var spacing = Dygraph.SHORT_SPACINGS[granularity];
+ return Math.floor(0.5 + 1.0 * (end_time - start_time) / spacing);
+ } else {
+ var tickPlacement = Dygraph.LONG_TICK_PLACEMENTS[granularity];
+
+ var msInYear = 365.2524 * 24 * 3600 * 1000;
+ var num_years = 1.0 * (end_time - start_time) / msInYear;
+ return Math.floor(0.5 + 1.0 * num_years * tickPlacement.months.length / tickPlacement.year_mod);
+ }
+};
+
+/**
+ * @param {number} start_time
+ * @param {number} end_time
+ * @param {number} granularity (one of the granularities enumerated above)
+ * @param {function(string):*} opts Function mapping from option name -&gt; value.
+ * @param {Dygraph=} dg
+ * @return {!Dygraph.TickList}
+ */
+Dygraph.getDateAxis = function(start_time, end_time, granularity, opts, dg) {
+ var formatter = /** @type{AxisLabelFormatter} */(
+ opts("axisLabelFormatter"));
+ var ticks = [];
+ var t;
+
+ if (granularity < Dygraph.MONTHLY) {
+ // Generate one tick mark for every fixed interval of time.
+ var spacing = Dygraph.SHORT_SPACINGS[granularity];
+
+ // Find a time less than start_time which occurs on a "nice" time boundary
+ // for this granularity.
+ var g = spacing / 1000;
+ var d = new Date(start_time);
+ Dygraph.setDateSameTZ(d, {ms: 0});
+
+ var x;
+ if (g <= 60) { // seconds
+ x = d.getSeconds();
+ Dygraph.setDateSameTZ(d, {s: x - x % g});
+ } else {
+ Dygraph.setDateSameTZ(d, {s: 0});
+ g /= 60;
+ if (g <= 60) { // minutes
+ x = d.getMinutes();
+ Dygraph.setDateSameTZ(d, {m: x - x % g});
+ } else {
+ Dygraph.setDateSameTZ(d, {m: 0});
+ g /= 60;
+
+ if (g <= 24) { // days
+ x = d.getHours();
+ d.setHours(x - x % g);
+ } else {
+ d.setHours(0);
+ g /= 24;
+
+ if (g == 7) { // one week
+ d.setDate(d.getDate() - d.getDay());
+ }
+ }
+ }
+ }
+ start_time = d.getTime();
+
+ // For spacings coarser than two-hourly, we want to ignore daylight
+ // savings transitions to get consistent ticks. For finer-grained ticks,
+ // it's essential to show the DST transition in all its messiness.
+ var start_offset_min = new Date(start_time).getTimezoneOffset();
+ var check_dst = (spacing >= Dygraph.SHORT_SPACINGS[Dygraph.TWO_HOURLY]);
+
+ for (t = start_time; t <= end_time; t += spacing) {
+ d = new Date(t);
+
+ // This ensures that we stay on the same hourly "rhythm" across
+ // daylight savings transitions. Without this, the ticks could get off
+ // by an hour. See tests/daylight-savings.html or issue 147.
+ if (check_dst && d.getTimezoneOffset() != start_offset_min) {
+ var delta_min = d.getTimezoneOffset() - start_offset_min;
+ t += delta_min * 60 * 1000;
+ d = new Date(t);
+ start_offset_min = d.getTimezoneOffset();
+
+ // Check whether we've backed into the previous timezone again.
+ // This can happen during a "spring forward" transition. In this case,
+ // it's best to skip this tick altogether (we may be shooting for a
+ // non-existent time like the 2AM that's skipped) and go to the next
+ // one.
+ if (new Date(t + spacing).getTimezoneOffset() != start_offset_min) {
+ t += spacing;
+ d = new Date(t);
+ start_offset_min = d.getTimezoneOffset();
+ }
+ }
+
+ ticks.push({ v:t,
+ label: formatter(d, granularity, opts, dg)
+ });
+ }
+ } else {
+ // Display a tick mark on the first of a set of months of each year.
+ // Years get a tick mark iff y % year_mod == 0. This is useful for
+ // displaying a tick mark once every 10 years, say, on long time scales.
+ var months;
+ var year_mod = 1; // e.g. to only print one point every 10 years.
+
+ if (granularity < Dygraph.NUM_GRANULARITIES) {
+ months = Dygraph.LONG_TICK_PLACEMENTS[granularity].months;
+ year_mod = Dygraph.LONG_TICK_PLACEMENTS[granularity].year_mod;
+ } else {
+ Dygraph.warn("Span of dates is too long");
+ }
+
+ var start_year = new Date(start_time).getFullYear();
+ var end_year = new Date(end_time).getFullYear();
+ var zeropad = Dygraph.zeropad;
+ for (var i = start_year; i <= end_year; i++) {
+ if (i % year_mod !== 0) continue;
+ for (var j = 0; j < months.length; j++) {
+ var date_str = i + "/" + zeropad(1 + months[j]) + "/01";
+ t = Dygraph.dateStrToMillis(date_str);
+ if (t < start_time || t > end_time) continue;
+ ticks.push({ v:t,
+ label: formatter(new Date(t), granularity, opts, dg)
+ });
+ }
+ }
+ }
+
+ return ticks;
+};
+
+// These are set here so that this file can be included after dygraph.js
+// or independently.
+if (Dygraph &&
+ Dygraph.DEFAULT_ATTRS &&
+ Dygraph.DEFAULT_ATTRS['axes'] &&
+ Dygraph.DEFAULT_ATTRS['axes']['x'] &&
+ Dygraph.DEFAULT_ATTRS['axes']['y'] &&
+ Dygraph.DEFAULT_ATTRS['axes']['y2']) {
+ Dygraph.DEFAULT_ATTRS['axes']['x']['ticker'] = Dygraph.dateTicker;
+ Dygraph.DEFAULT_ATTRS['axes']['y']['ticker'] = Dygraph.numericTicks;
+ Dygraph.DEFAULT_ATTRS['axes']['y2']['ticker'] = Dygraph.numericTicks;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-utils.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-utils.js
new file mode 100644
index 00000000..1ec1795d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-utils.js
@@ -0,0 +1,1305 @@
+/**
+ * @license
+ * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+
+/**
+ * @fileoverview This file contains utility functions used by dygraphs. These
+ * are typically static (i.e. not related to any particular dygraph). Examples
+ * include date/time formatting functions, basic algorithms (e.g. binary
+ * search) and generic DOM-manipulation functions.
+ */
+
+/*jshint globalstrict: true */
+/*global Dygraph:false, G_vmlCanvasManager:false, Node:false, printStackTrace: false */
+"use strict";
+
+Dygraph.LOG_SCALE = 10;
+Dygraph.LN_TEN = Math.log(Dygraph.LOG_SCALE);
+
+/**
+ * @private
+ * @param {number} x
+ * @return {number}
+ */
+Dygraph.log10 = function(x) {
+ return Math.log(x) / Dygraph.LN_TEN;
+};
+
+// Various logging levels.
+Dygraph.DEBUG = 1;
+Dygraph.INFO = 2;
+Dygraph.WARNING = 3;
+Dygraph.ERROR = 3;
+
+// Set this to log stack traces on warnings, etc.
+// This requires stacktrace.js, which is up to you to provide.
+// A copy can be found in the dygraphs repo, or at
+// https://github.com/eriwen/javascript-stacktrace
+Dygraph.LOG_STACK_TRACES = false;
+
+/** A dotted line stroke pattern. */
+Dygraph.DOTTED_LINE = [2, 2];
+/** A dashed line stroke pattern. */
+Dygraph.DASHED_LINE = [7, 3];
+/** A dot dash stroke pattern. */
+Dygraph.DOT_DASH_LINE = [7, 2, 2, 2];
+
+/**
+ * Log an error on the JS console at the given severity.
+ * @param {number} severity One of Dygraph.{DEBUG,INFO,WARNING,ERROR}
+ * @param {string} message The message to log.
+ * @private
+ */
+Dygraph.log = function(severity, message) {
+ var st;
+ if (typeof(printStackTrace) != 'undefined') {
+ try {
+ // Remove uninteresting bits: logging functions and paths.
+ st = printStackTrace({guess:false});
+ while (st[0].indexOf("stacktrace") != -1) {
+ st.splice(0, 1);
+ }
+
+ st.splice(0, 2);
+ for (var i = 0; i < st.length; i++) {
+ st[i] = st[i].replace(/\([^)]*\/(.*)\)/, '@$1')
+ .replace(/\@.*\/([^\/]*)/, '@$1')
+ .replace('[object Object].', '');
+ }
+ var top_msg = st.splice(0, 1)[0];
+ message += ' (' + top_msg.replace(/^.*@ ?/, '') + ')';
+ } catch(e) {
+ // Oh well, it was worth a shot!
+ }
+ }
+
+ if (typeof(window.console) != 'undefined') {
+ // In older versions of Firefox, only console.log is defined.
+ var console = window.console;
+ var log = function(console, method, msg) {
+ if (method && typeof(method) == 'function') {
+ method.call(console, msg);
+ } else {
+ console.log(msg);
+ }
+ };
+
+ switch (severity) {
+ case Dygraph.DEBUG:
+ log(console, console.debug, 'dygraphs: ' + message);
+ break;
+ case Dygraph.INFO:
+ log(console, console.info, 'dygraphs: ' + message);
+ break;
+ case Dygraph.WARNING:
+ log(console, console.warn, 'dygraphs: ' + message);
+ break;
+ case Dygraph.ERROR:
+ log(console, console.error, 'dygraphs: ' + message);
+ break;
+ }
+ }
+
+ if (Dygraph.LOG_STACK_TRACES) {
+ window.console.log(st.join('\n'));
+ }
+};
+
+/**
+ * @param {string} message
+ * @private
+ */
+Dygraph.info = function(message) {
+ Dygraph.log(Dygraph.INFO, message);
+};
+/**
+ * @param {string} message
+ * @private
+ */
+Dygraph.prototype.info = Dygraph.info;
+
+/**
+ * @param {string} message
+ * @private
+ */
+Dygraph.warn = function(message) {
+ Dygraph.log(Dygraph.WARNING, message);
+};
+/**
+ * @param {string} message
+ * @private
+ */
+Dygraph.prototype.warn = Dygraph.warn;
+
+/**
+ * @param {string} message
+ */
+Dygraph.error = function(message) {
+ Dygraph.log(Dygraph.ERROR, message);
+};
+/**
+ * @param {string} message
+ * @private
+ */
+Dygraph.prototype.error = Dygraph.error;
+
+/**
+ * Return the 2d context for a dygraph canvas.
+ *
+ * This method is only exposed for the sake of replacing the function in
+ * automated tests, e.g.
+ *
+ * var oldFunc = Dygraph.getContext();
+ * Dygraph.getContext = function(canvas) {
+ * var realContext = oldFunc(canvas);
+ * return new Proxy(realContext);
+ * };
+ * @param {!HTMLCanvasElement} canvas
+ * @return {!CanvasRenderingContext2D}
+ * @private
+ */
+Dygraph.getContext = function(canvas) {
+ return /** @type{!CanvasRenderingContext2D}*/(canvas.getContext("2d"));
+};
+
+/**
+ * Add an event handler. This smooths a difference between IE and the rest of
+ * the world.
+ * @param { !Element } elem The element to add the event to.
+ * @param { string } type The type of the event, e.g. 'click' or 'mousemove'.
+ * @param { function(Event):(boolean|undefined) } fn The function to call
+ * on the event. The function takes one parameter: the event object.
+ * @private
+ */
+Dygraph.addEvent = function addEvent(elem, type, fn) {
+ if (elem.addEventListener) {
+ elem.addEventListener(type, fn, false);
+ } else {
+ elem[type+fn] = function(){fn(window.event);};
+ elem.attachEvent('on'+type, elem[type+fn]);
+ }
+};
+
+/**
+ * Add an event handler. This event handler is kept until the graph is
+ * destroyed with a call to graph.destroy().
+ *
+ * @param { !Element } elem The element to add the event to.
+ * @param { string } type The type of the event, e.g. 'click' or 'mousemove'.
+ * @param { function(Event):(boolean|undefined) } fn The function to call
+ * on the event. The function takes one parameter: the event object.
+ * @private
+ */
+Dygraph.prototype.addAndTrackEvent = function(elem, type, fn) {
+ Dygraph.addEvent(elem, type, fn);
+ this.registeredEvents_.push({ elem : elem, type : type, fn : fn });
+};
+
+/**
+ * Remove an event handler. This smooths a difference between IE and the rest
+ * of the world.
+ * @param {!Element} elem The element to add the event to.
+ * @param {string} type The type of the event, e.g. 'click' or 'mousemove'.
+ * @param {function(Event):(boolean|undefined)} fn The function to call
+ * on the event. The function takes one parameter: the event object.
+ * @private
+ */
+Dygraph.removeEvent = function(elem, type, fn) {
+ if (elem.removeEventListener) {
+ elem.removeEventListener(type, fn, false);
+ } else {
+ try {
+ elem.detachEvent('on'+type, elem[type+fn]);
+ } catch(e) {
+ // We only detach event listeners on a "best effort" basis in IE. See:
+ // http://stackoverflow.com/questions/2553632/detachevent-not-working-with-named-inline-functions
+ }
+ elem[type+fn] = null;
+ }
+};
+
+Dygraph.prototype.removeTrackedEvents_ = function() {
+ if (this.registeredEvents_) {
+ for (var idx = 0; idx < this.registeredEvents_.length; idx++) {
+ var reg = this.registeredEvents_[idx];
+ Dygraph.removeEvent(reg.elem, reg.type, reg.fn);
+ }
+ }
+
+ this.registeredEvents_ = [];
+};
+
+/**
+ * Cancels further processing of an event. This is useful to prevent default
+ * browser actions, e.g. highlighting text on a double-click.
+ * Based on the article at
+ * http://www.switchonthecode.com/tutorials/javascript-tutorial-the-scroll-wheel
+ * @param { !Event } e The event whose normal behavior should be canceled.
+ * @private
+ */
+Dygraph.cancelEvent = function(e) {
+ e = e ? e : window.event;
+ if (e.stopPropagation) {
+ e.stopPropagation();
+ }
+ if (e.preventDefault) {
+ e.preventDefault();
+ }
+ e.cancelBubble = true;
+ e.cancel = true;
+ e.returnValue = false;
+ return false;
+};
+
+/**
+ * Convert hsv values to an rgb(r,g,b) string. Taken from MochiKit.Color. This
+ * is used to generate default series colors which are evenly spaced on the
+ * color wheel.
+ * @param { number } hue Range is 0.0-1.0.
+ * @param { number } saturation Range is 0.0-1.0.
+ * @param { number } value Range is 0.0-1.0.
+ * @return { string } "rgb(r,g,b)" where r, g and b range from 0-255.
+ * @private
+ */
+Dygraph.hsvToRGB = function (hue, saturation, value) {
+ var red;
+ var green;
+ var blue;
+ if (saturation === 0) {
+ red = value;
+ green = value;
+ blue = value;
+ } else {
+ var i = Math.floor(hue * 6);
+ var f = (hue * 6) - i;
+ var p = value * (1 - saturation);
+ var q = value * (1 - (saturation * f));
+ var t = value * (1 - (saturation * (1 - f)));
+ switch (i) {
+ case 1: red = q; green = value; blue = p; break;
+ case 2: red = p; green = value; blue = t; break;
+ case 3: red = p; green = q; blue = value; break;
+ case 4: red = t; green = p; blue = value; break;
+ case 5: red = value; green = p; blue = q; break;
+ case 6: // fall through
+ case 0: red = value; green = t; blue = p; break;
+ }
+ }
+ red = Math.floor(255 * red + 0.5);
+ green = Math.floor(255 * green + 0.5);
+ blue = Math.floor(255 * blue + 0.5);
+ return 'rgb(' + red + ',' + green + ',' + blue + ')';
+};
+
+// The following functions are from quirksmode.org with a modification for Safari from
+// http://blog.firetree.net/2005/07/04/javascript-find-position/
+// http://www.quirksmode.org/js/findpos.html
+// ... and modifications to support scrolling divs.
+
+/**
+ * Find the x-coordinate of the supplied object relative to the left side
+ * of the page.
+ * TODO(danvk): change obj type from Node -&gt; !Node
+ * @param {Node} obj
+ * @return {number}
+ * @private
+ */
+Dygraph.findPosX = function(obj) {
+ var curleft = 0;
+ if(obj.offsetParent) {
+ var copyObj = obj;
+ while(1) {
+ // NOTE: the if statement here is for IE8.
+ var borderLeft = "0";
+ if (window.getComputedStyle) {
+ borderLeft = window.getComputedStyle(copyObj, null).borderLeft || "0";
+ }
+ curleft += parseInt(borderLeft, 10) ;
+ curleft += copyObj.offsetLeft;
+ if(!copyObj.offsetParent) {
+ break;
+ }
+ copyObj = copyObj.offsetParent;
+ }
+ } else if(obj.x) {
+ curleft += obj.x;
+ }
+ // This handles the case where the object is inside a scrolled div.
+ while(obj && obj != document.body) {
+ curleft -= obj.scrollLeft;
+ obj = obj.parentNode;
+ }
+ return curleft;
+};
+
+/**
+ * Find the y-coordinate of the supplied object relative to the top of the
+ * page.
+ * TODO(danvk): change obj type from Node -&gt; !Node
+ * TODO(danvk): consolidate with findPosX and return an {x, y} object.
+ * @param {Node} obj
+ * @return {number}
+ * @private
+ */
+Dygraph.findPosY = function(obj) {
+ var curtop = 0;
+ if(obj.offsetParent) {
+ var copyObj = obj;
+ while(1) {
+ // NOTE: the if statement here is for IE8.
+ var borderTop = "0";
+ if (window.getComputedStyle) {
+ borderTop = window.getComputedStyle(copyObj, null).borderTop || "0";
+ }
+ curtop += parseInt(borderTop, 10) ;
+ curtop += copyObj.offsetTop;
+ if(!copyObj.offsetParent) {
+ break;
+ }
+ copyObj = copyObj.offsetParent;
+ }
+ } else if(obj.y) {
+ curtop += obj.y;
+ }
+ // This handles the case where the object is inside a scrolled div.
+ while(obj && obj != document.body) {
+ curtop -= obj.scrollTop;
+ obj = obj.parentNode;
+ }
+ return curtop;
+};
+
+/**
+ * Returns the x-coordinate of the event in a coordinate system where the
+ * top-left corner of the page (not the window) is (0,0).
+ * Taken from MochiKit.Signal
+ * @param {!Event} e
+ * @return {number}
+ * @private
+ */
+Dygraph.pageX = function(e) {
+ if (e.pageX) {
+ return (!e.pageX || e.pageX < 0) ? 0 : e.pageX;
+ } else {
+ var de = document.documentElement;
+ var b = document.body;
+ return e.clientX +
+ (de.scrollLeft || b.scrollLeft) -
+ (de.clientLeft || 0);
+ }
+};
+
+/**
+ * Returns the y-coordinate of the event in a coordinate system where the
+ * top-left corner of the page (not the window) is (0,0).
+ * Taken from MochiKit.Signal
+ * @param {!Event} e
+ * @return {number}
+ * @private
+ */
+Dygraph.pageY = function(e) {
+ if (e.pageY) {
+ return (!e.pageY || e.pageY < 0) ? 0 : e.pageY;
+ } else {
+ var de = document.documentElement;
+ var b = document.body;
+ return e.clientY +
+ (de.scrollTop || b.scrollTop) -
+ (de.clientTop || 0);
+ }
+};
+
+/**
+ * This returns true unless the parameter is 0, null, undefined or NaN.
+ * TODO(danvk): rename this function to something like 'isNonZeroNan'.
+ *
+ * @param {number} x The number to consider.
+ * @return {boolean} Whether the number is zero or NaN.
+ * @private
+ */
+Dygraph.isOK = function(x) {
+ return !!x && !isNaN(x);
+};
+
+/**
+ * @param { {x:?number,y:?number,yval:?number} } p The point to consider, valid
+ * points are {x, y} objects
+ * @param { boolean } allowNaNY Treat point with y=NaN as valid
+ * @return { boolean } Whether the point has numeric x and y.
+ * @private
+ */
+Dygraph.isValidPoint = function(p, allowNaNY) {
+ if (!p) return false; // null or undefined object
+ if (p.yval === null) return false; // missing point
+ if (p.x === null || p.x === undefined) return false;
+ if (p.y === null || p.y === undefined) return false;
+ if (isNaN(p.x) || (!allowNaNY && isNaN(p.y))) return false;
+ return true;
+};
+
+/**
+ * Number formatting function which mimicks the behavior of %g in printf, i.e.
+ * either exponential or fixed format (without trailing 0s) is used depending on
+ * the length of the generated string. The advantage of this format is that
+ * there is a predictable upper bound on the resulting string length,
+ * significant figures are not dropped, and normal numbers are not displayed in
+ * exponential notation.
+ *
+ * NOTE: JavaScript's native toPrecision() is NOT a drop-in replacement for %g.
+ * It creates strings which are too long for absolute values between 10^-4 and
+ * 10^-6, e.g. '0.00001' instead of '1e-5'. See tests/number-format.html for
+ * output examples.
+ *
+ * @param {number} x The number to format
+ * @param {number=} opt_precision The precision to use, default 2.
+ * @return {string} A string formatted like %g in printf. The max generated
+ * string length should be precision + 6 (e.g 1.123e+300).
+ */
+Dygraph.floatFormat = function(x, opt_precision) {
+ // Avoid invalid precision values; [1, 21] is the valid range.
+ var p = Math.min(Math.max(1, opt_precision || 2), 21);
+
+ // This is deceptively simple. The actual algorithm comes from:
+ //
+ // Max allowed length = p + 4
+ // where 4 comes from 'e+n' and '.'.
+ //
+ // Length of fixed format = 2 + y + p
+ // where 2 comes from '0.' and y = # of leading zeroes.
+ //
+ // Equating the two and solving for y yields y = 2, or 0.00xxxx which is
+ // 1.0e-3.
+ //
+ // Since the behavior of toPrecision() is identical for larger numbers, we
+ // don't have to worry about the other bound.
+ //
+ // Finally, the argument for toExponential() is the number of trailing digits,
+ // so we take off 1 for the value before the '.'.
+ return (Math.abs(x) < 1.0e-3 && x !== 0.0) ?
+ x.toExponential(p - 1) : x.toPrecision(p);
+};
+
+/**
+ * Converts '9' to '09' (useful for dates)
+ * @param {number} x
+ * @return {string}
+ * @private
+ */
+Dygraph.zeropad = function(x) {
+ if (x < 10) return "0" + x; else return "" + x;
+};
+
+/**
+ * Return a string version of the hours, minutes and seconds portion of a date.
+ *
+ * @param {number} date The JavaScript date (ms since epoch)
+ * @return {string} A time of the form "HH:MM:SS"
+ * @private
+ */
+Dygraph.hmsString_ = function(date) {
+ var zeropad = Dygraph.zeropad;
+ var d = new Date(date);
+ if (d.getSeconds()) {
+ return zeropad(d.getHours()) + ":" +
+ zeropad(d.getMinutes()) + ":" +
+ zeropad(d.getSeconds());
+ } else {
+ return zeropad(d.getHours()) + ":" + zeropad(d.getMinutes());
+ }
+};
+
+/**
+ * Round a number to the specified number of digits past the decimal point.
+ * @param {number} num The number to round
+ * @param {number} places The number of decimals to which to round
+ * @return {number} The rounded number
+ * @private
+ */
+Dygraph.round_ = function(num, places) {
+ var shift = Math.pow(10, places);
+ return Math.round(num * shift)/shift;
+};
+
+/**
+ * Implementation of binary search over an array.
+ * Currently does not work when val is outside the range of arry's values.
+ * @param {number} val the value to search for
+ * @param {Array.<number>} arry is the value over which to search
+ * @param {number} abs If abs > 0, find the lowest entry greater than val
+ * If abs < 0, find the highest entry less than val.
+ * If abs == 0, find the entry that equals val.
+ * @param {number=} low The first index in arry to consider (optional)
+ * @param {number=} high The last index in arry to consider (optional)
+ * @return {number} Index of the element, or -1 if it isn't found.
+ * @private
+ */
+Dygraph.binarySearch = function(val, arry, abs, low, high) {
+ if (low === null || low === undefined ||
+ high === null || high === undefined) {
+ low = 0;
+ high = arry.length - 1;
+ }
+ if (low > high) {
+ return -1;
+ }
+ if (abs === null || abs === undefined) {
+ abs = 0;
+ }
+ var validIndex = function(idx) {
+ return idx >= 0 && idx < arry.length;
+ };
+ var mid = parseInt((low + high) / 2, 10);
+ var element = arry[mid];
+ var idx;
+ if (element == val) {
+ return mid;
+ } else if (element > val) {
+ if (abs > 0) {
+ // Accept if element > val, but also if prior element < val.
+ idx = mid - 1;
+ if (validIndex(idx) && arry[idx] < val) {
+ return mid;
+ }
+ }
+ return Dygraph.binarySearch(val, arry, abs, low, mid - 1);
+ } else if (element < val) {
+ if (abs < 0) {
+ // Accept if element < val, but also if prior element > val.
+ idx = mid + 1;
+ if (validIndex(idx) && arry[idx] > val) {
+ return mid;
+ }
+ }
+ return Dygraph.binarySearch(val, arry, abs, mid + 1, high);
+ }
+ return -1; // can't actually happen, but makes closure compiler happy
+};
+
+/**
+ * Parses a date, returning the number of milliseconds since epoch. This can be
+ * passed in as an xValueParser in the Dygraph constructor.
+ * TODO(danvk): enumerate formats that this understands.
+ *
+ * @param {string} dateStr A date in a variety of possible string formats.
+ * @return {number} Milliseconds since epoch.
+ * @private
+ */
+Dygraph.dateParser = function(dateStr) {
+ var dateStrSlashed;
+ var d;
+
+ // Let the system try the format first, with one caveat:
+ // YYYY-MM-DD[ HH:MM:SS] is interpreted as UTC by a variety of browsers.
+ // dygraphs displays dates in local time, so this will result in surprising
+ // inconsistencies. But if you specify "T" or "Z" (i.e. YYYY-MM-DDTHH:MM:SS),
+ // then you probably know what you're doing, so we'll let you go ahead.
+ // Issue: http://code.google.com/p/dygraphs/issues/detail?id=255
+ if (dateStr.search("-") == -1 ||
+ dateStr.search("T") != -1 || dateStr.search("Z") != -1) {
+ d = Dygraph.dateStrToMillis(dateStr);
+ if (d && !isNaN(d)) return d;
+ }
+
+ if (dateStr.search("-") != -1) { // e.g. '2009-7-12' or '2009-07-12'
+ dateStrSlashed = dateStr.replace("-", "/", "g");
+ while (dateStrSlashed.search("-") != -1) {
+ dateStrSlashed = dateStrSlashed.replace("-", "/");
+ }
+ d = Dygraph.dateStrToMillis(dateStrSlashed);
+ } else if (dateStr.length == 8) { // e.g. '20090712'
+ // TODO(danvk): remove support for this format. It's confusing.
+ dateStrSlashed = dateStr.substr(0,4) + "/" + dateStr.substr(4,2) + "/" +
+ dateStr.substr(6,2);
+ d = Dygraph.dateStrToMillis(dateStrSlashed);
+ } else {
+ // Any format that Date.parse will accept, e.g. "2009/07/12" or
+ // "2009/07/12 12:34:56"
+ d = Dygraph.dateStrToMillis(dateStr);
+ }
+
+ if (!d || isNaN(d)) {
+ Dygraph.error("Couldn't parse " + dateStr + " as a date");
+ }
+ return d;
+};
+
+/**
+ * This is identical to JavaScript's built-in Date.parse() method, except that
+ * it doesn't get replaced with an incompatible method by aggressive JS
+ * libraries like MooTools or Joomla.
+ * @param {string} str The date string, e.g. "2011/05/06"
+ * @return {number} millis since epoch
+ * @private
+ */
+Dygraph.dateStrToMillis = function(str) {
+ return new Date(str).getTime();
+};
+
+// These functions are all based on MochiKit.
+/**
+ * Copies all the properties from o to self.
+ *
+ * @param {!Object} self
+ * @param {!Object} o
+ * @return {!Object}
+ */
+Dygraph.update = function(self, o) {
+ if (typeof(o) != 'undefined' && o !== null) {
+ for (var k in o) {
+ if (o.hasOwnProperty(k)) {
+ self[k] = o[k];
+ }
+ }
+ }
+ return self;
+};
+
+/**
+ * Copies all the properties from o to self.
+ *
+ * @param {!Object} self
+ * @param {!Object} o
+ * @return {!Object}
+ * @private
+ */
+Dygraph.updateDeep = function (self, o) {
+ // Taken from http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
+ function isNode(o) {
+ return (
+ typeof Node === "object" ? o instanceof Node :
+ typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName==="string"
+ );
+ }
+
+ if (typeof(o) != 'undefined' && o !== null) {
+ for (var k in o) {
+ if (o.hasOwnProperty(k)) {
+ if (o[k] === null) {
+ self[k] = null;
+ } else if (Dygraph.isArrayLike(o[k])) {
+ self[k] = o[k].slice();
+ } else if (isNode(o[k])) {
+ // DOM objects are shallowly-copied.
+ self[k] = o[k];
+ } else if (typeof(o[k]) == 'object') {
+ if (typeof(self[k]) != 'object' || self[k] === null) {
+ self[k] = {};
+ }
+ Dygraph.updateDeep(self[k], o[k]);
+ } else {
+ self[k] = o[k];
+ }
+ }
+ }
+ }
+ return self;
+};
+
+/**
+ * @param {Object} o
+ * @return {boolean}
+ * @private
+ */
+Dygraph.isArrayLike = function(o) {
+ var typ = typeof(o);
+ if (
+ (typ != 'object' && !(typ == 'function' &&
+ typeof(o.item) == 'function')) ||
+ o === null ||
+ typeof(o.length) != 'number' ||
+ o.nodeType === 3
+ ) {
+ return false;
+ }
+ return true;
+};
+
+/**
+ * @param {Object} o
+ * @return {boolean}
+ * @private
+ */
+Dygraph.isDateLike = function (o) {
+ if (typeof(o) != "object" || o === null ||
+ typeof(o.getTime) != 'function') {
+ return false;
+ }
+ return true;
+};
+
+/**
+ * Note: this only seems to work for arrays.
+ * @param {!Array} o
+ * @return {!Array}
+ * @private
+ */
+Dygraph.clone = function(o) {
+ // TODO(danvk): figure out how MochiKit's version works
+ var r = [];
+ for (var i = 0; i < o.length; i++) {
+ if (Dygraph.isArrayLike(o[i])) {
+ r.push(Dygraph.clone(o[i]));
+ } else {
+ r.push(o[i]);
+ }
+ }
+ return r;
+};
+
+/**
+ * Create a new canvas element. This is more complex than a simple
+ * document.createElement("canvas") because of IE and excanvas.
+ *
+ * @return {!HTMLCanvasElement}
+ * @private
+ */
+Dygraph.createCanvas = function() {
+ var canvas = document.createElement("canvas");
+
+ var isIE = (/MSIE/.test(navigator.userAgent) && !window.opera);
+ if (isIE && (typeof(G_vmlCanvasManager) != 'undefined')) {
+ canvas = G_vmlCanvasManager.initElement(
+ /**@type{!HTMLCanvasElement}*/(canvas));
+ }
+
+ return canvas;
+};
+
+/**
+ * Checks whether the user is on an Android browser.
+ * Android does not fully support the <canvas> tag, e.g. w/r/t/ clipping.
+ * @return {boolean}
+ * @private
+ */
+Dygraph.isAndroid = function() {
+ return (/Android/).test(navigator.userAgent);
+};
+
+
+/**
+ * TODO(danvk): use @template here when it's better supported for classes.
+ * @param {!Array} array
+ * @param {number} start
+ * @param {number} length
+ * @param {function(!Array,?):boolean=} predicate
+ * @constructor
+ */
+Dygraph.Iterator = function(array, start, length, predicate) {
+ start = start || 0;
+ length = length || array.length;
+ this.hasNext = true; // Use to identify if there's another element.
+ this.peek = null; // Use for look-ahead
+ this.start_ = start;
+ this.array_ = array;
+ this.predicate_ = predicate;
+ this.end_ = Math.min(array.length, start + length);
+ this.nextIdx_ = start - 1; // use -1 so initial advance works.
+ this.next(); // ignoring result.
+};
+
+/**
+ * @return {Object}
+ */
+Dygraph.Iterator.prototype.next = function() {
+ if (!this.hasNext) {
+ return null;
+ }
+ var obj = this.peek;
+
+ var nextIdx = this.nextIdx_ + 1;
+ var found = false;
+ while (nextIdx < this.end_) {
+ if (!this.predicate_ || this.predicate_(this.array_, nextIdx)) {
+ this.peek = this.array_[nextIdx];
+ found = true;
+ break;
+ }
+ nextIdx++;
+ }
+ this.nextIdx_ = nextIdx;
+ if (!found) {
+ this.hasNext = false;
+ this.peek = null;
+ }
+ return obj;
+};
+
+/**
+ * Returns a new iterator over array, between indexes start and
+ * start + length, and only returns entries that pass the accept function
+ *
+ * @param {!Array} array the array to iterate over.
+ * @param {number} start the first index to iterate over, 0 if absent.
+ * @param {number} length the number of elements in the array to iterate over.
+ * This, along with start, defines a slice of the array, and so length
+ * doesn't imply the number of elements in the iterator when accept doesn't
+ * always accept all values. array.length when absent.
+ * @param {function(?):boolean=} opt_predicate a function that takes
+ * parameters array and idx, which returns true when the element should be
+ * returned. If omitted, all elements are accepted.
+ * @private
+ */
+Dygraph.createIterator = function(array, start, length, opt_predicate) {
+ return new Dygraph.Iterator(array, start, length, opt_predicate);
+};
+
+// Shim layer with setTimeout fallback.
+// From: http://paulirish.com/2011/requestanimationframe-for-smart-animating/
+// Should be called with the window context:
+// Dygraph.requestAnimFrame.call(window, function() {})
+Dygraph.requestAnimFrame = (function() {
+ return window.requestAnimationFrame ||
+ window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame ||
+ window.oRequestAnimationFrame ||
+ window.msRequestAnimationFrame ||
+ function (callback) {
+ window.setTimeout(callback, 1000 / 60);
+ };
+})();
+
+/**
+ * Call a function at most maxFrames times at an attempted interval of
+ * framePeriodInMillis, then call a cleanup function once. repeatFn is called
+ * once immediately, then at most (maxFrames - 1) times asynchronously. If
+ * maxFrames==1, then cleanup_fn() is also called synchronously. This function
+ * is used to sequence animation.
+ * @param {function(number)} repeatFn Called repeatedly -- takes the frame
+ * number (from 0 to maxFrames-1) as an argument.
+ * @param {number} maxFrames The max number of times to call repeatFn
+ * @param {number} framePeriodInMillis Max requested time between frames.
+ * @param {function()} cleanupFn A function to call after all repeatFn calls.
+ * @private
+ */
+Dygraph.repeatAndCleanup = function(repeatFn, maxFrames, framePeriodInMillis,
+ cleanupFn) {
+ var frameNumber = 0;
+ var previousFrameNumber;
+ var startTime = new Date().getTime();
+ repeatFn(frameNumber);
+ if (maxFrames == 1) {
+ cleanupFn();
+ return;
+ }
+ var maxFrameArg = maxFrames - 1;
+
+ (function loop() {
+ if (frameNumber >= maxFrames) return;
+ Dygraph.requestAnimFrame.call(window, function() {
+ // Determine which frame to draw based on the delay so far. Will skip
+ // frames if necessary.
+ var currentTime = new Date().getTime();
+ var delayInMillis = currentTime - startTime;
+ previousFrameNumber = frameNumber;
+ frameNumber = Math.floor(delayInMillis / framePeriodInMillis);
+ var frameDelta = frameNumber - previousFrameNumber;
+ // If we predict that the subsequent repeatFn call will overshoot our
+ // total frame target, so our last call will cause a stutter, then jump to
+ // the last call immediately. If we're going to cause a stutter, better
+ // to do it faster than slower.
+ var predictOvershootStutter = (frameNumber + frameDelta) > maxFrameArg;
+ if (predictOvershootStutter || (frameNumber >= maxFrameArg)) {
+ repeatFn(maxFrameArg); // Ensure final call with maxFrameArg.
+ cleanupFn();
+ } else {
+ if (frameDelta !== 0) { // Don't call repeatFn with duplicate frames.
+ repeatFn(frameNumber);
+ }
+ loop();
+ }
+ });
+ })();
+};
+
+/**
+ * This function will scan the option list and determine if they
+ * require us to recalculate the pixel positions of each point.
+ * @param {!Array.<string>} labels a list of options to check.
+ * @param {!Object} attrs
+ * @return {boolean} true if the graph needs new points else false.
+ * @private
+ */
+Dygraph.isPixelChangingOptionList = function(labels, attrs) {
+ // A whitelist of options that do not change pixel positions.
+ var pixelSafeOptions = {
+ 'annotationClickHandler': true,
+ 'annotationDblClickHandler': true,
+ 'annotationMouseOutHandler': true,
+ 'annotationMouseOverHandler': true,
+ 'axisLabelColor': true,
+ 'axisLineColor': true,
+ 'axisLineWidth': true,
+ 'clickCallback': true,
+ 'digitsAfterDecimal': true,
+ 'drawCallback': true,
+ 'drawHighlightPointCallback': true,
+ 'drawPoints': true,
+ 'drawPointCallback': true,
+ 'drawXGrid': true,
+ 'drawYGrid': true,
+ 'fillAlpha': true,
+ 'gridLineColor': true,
+ 'gridLineWidth': true,
+ 'hideOverlayOnMouseOut': true,
+ 'highlightCallback': true,
+ 'highlightCircleSize': true,
+ 'interactionModel': true,
+ 'isZoomedIgnoreProgrammaticZoom': true,
+ 'labelsDiv': true,
+ 'labelsDivStyles': true,
+ 'labelsDivWidth': true,
+ 'labelsKMB': true,
+ 'labelsKMG2': true,
+ 'labelsSeparateLines': true,
+ 'labelsShowZeroValues': true,
+ 'legend': true,
+ 'maxNumberWidth': true,
+ 'panEdgeFraction': true,
+ 'pixelsPerYLabel': true,
+ 'pointClickCallback': true,
+ 'pointSize': true,
+ 'rangeSelectorPlotFillColor': true,
+ 'rangeSelectorPlotStrokeColor': true,
+ 'showLabelsOnHighlight': true,
+ 'showRoller': true,
+ 'sigFigs': true,
+ 'strokeWidth': true,
+ 'underlayCallback': true,
+ 'unhighlightCallback': true,
+ 'xAxisLabelFormatter': true,
+ 'xTicker': true,
+ 'xValueFormatter': true,
+ 'yAxisLabelFormatter': true,
+ 'yValueFormatter': true,
+ 'zoomCallback': true
+ };
+
+ // Assume that we do not require new points.
+ // This will change to true if we actually do need new points.
+ var requiresNewPoints = false;
+
+ // Create a dictionary of series names for faster lookup.
+ // If there are no labels, then the dictionary stays empty.
+ var seriesNamesDictionary = { };
+ if (labels) {
+ for (var i = 1; i < labels.length; i++) {
+ seriesNamesDictionary[labels[i]] = true;
+ }
+ }
+
+ // Iterate through the list of updated options.
+ for (var property in attrs) {
+ // Break early if we already know we need new points from a previous option.
+ if (requiresNewPoints) {
+ break;
+ }
+ if (attrs.hasOwnProperty(property)) {
+ // Find out of this field is actually a series specific options list.
+ if (seriesNamesDictionary[property]) {
+ // This property value is a list of options for this series.
+ // If any of these sub properties are not pixel safe, set the flag.
+ for (var subProperty in attrs[property]) {
+ // Break early if we already know we need new points from a previous option.
+ if (requiresNewPoints) {
+ break;
+ }
+ if (attrs[property].hasOwnProperty(subProperty) && !pixelSafeOptions[subProperty]) {
+ requiresNewPoints = true;
+ }
+ }
+ // If this was not a series specific option list, check if its a pixel changing property.
+ } else if (!pixelSafeOptions[property]) {
+ requiresNewPoints = true;
+ }
+ }
+ }
+
+ return requiresNewPoints;
+};
+
+/**
+ * Compares two arrays to see if they are equal. If either parameter is not an
+ * array it will return false. Does a shallow compare
+ * Dygraph.compareArrays([[1,2], [3, 4]], [[1,2], [3,4]]) === false.
+ * @param {!Array.<T>} array1 first array
+ * @param {!Array.<T>} array2 second array
+ * @return {boolean} True if both parameters are arrays, and contents are equal.
+ * @template T
+ */
+Dygraph.compareArrays = function(array1, array2) {
+ if (!Dygraph.isArrayLike(array1) || !Dygraph.isArrayLike(array2)) {
+ return false;
+ }
+ if (array1.length !== array2.length) {
+ return false;
+ }
+ for (var i = 0; i < array1.length; i++) {
+ if (array1[i] !== array2[i]) {
+ return false;
+ }
+ }
+ return true;
+};
+
+/**
+ * @param {!CanvasRenderingContext2D} ctx the canvas context
+ * @param {number} sides the number of sides in the shape.
+ * @param {number} radius the radius of the image.
+ * @param {number} cx center x coordate
+ * @param {number} cy center y coordinate
+ * @param {number=} rotationRadians the shift of the initial angle, in radians.
+ * @param {number=} delta the angle shift for each line. If missing, creates a
+ * regular polygon.
+ * @private
+ */
+Dygraph.regularShape_ = function(
+ ctx, sides, radius, cx, cy, rotationRadians, delta) {
+ rotationRadians = rotationRadians || 0;
+ delta = delta || Math.PI * 2 / sides;
+
+ ctx.beginPath();
+ var initialAngle = rotationRadians;
+ var angle = initialAngle;
+
+ var computeCoordinates = function() {
+ var x = cx + (Math.sin(angle) * radius);
+ var y = cy + (-Math.cos(angle) * radius);
+ return [x, y];
+ };
+
+ var initialCoordinates = computeCoordinates();
+ var x = initialCoordinates[0];
+ var y = initialCoordinates[1];
+ ctx.moveTo(x, y);
+
+ for (var idx = 0; idx < sides; idx++) {
+ angle = (idx == sides - 1) ? initialAngle : (angle + delta);
+ var coords = computeCoordinates();
+ ctx.lineTo(coords[0], coords[1]);
+ }
+ ctx.fill();
+ ctx.stroke();
+};
+
+/**
+ * TODO(danvk): be more specific on the return type.
+ * @param {number} sides
+ * @param {number=} rotationRadians
+ * @param {number=} delta
+ * @return {Function}
+ * @private
+ */
+Dygraph.shapeFunction_ = function(sides, rotationRadians, delta) {
+ return function(g, name, ctx, cx, cy, color, radius) {
+ ctx.strokeStyle = color;
+ ctx.fillStyle = "white";
+ Dygraph.regularShape_(ctx, sides, radius, cx, cy, rotationRadians, delta);
+ };
+};
+
+Dygraph.Circles = {
+ DEFAULT : function(g, name, ctx, canvasx, canvasy, color, radius) {
+ ctx.beginPath();
+ ctx.fillStyle = color;
+ ctx.arc(canvasx, canvasy, radius, 0, 2 * Math.PI, false);
+ ctx.fill();
+ },
+ TRIANGLE : Dygraph.shapeFunction_(3),
+ SQUARE : Dygraph.shapeFunction_(4, Math.PI / 4),
+ DIAMOND : Dygraph.shapeFunction_(4),
+ PENTAGON : Dygraph.shapeFunction_(5),
+ HEXAGON : Dygraph.shapeFunction_(6),
+ CIRCLE : function(g, name, ctx, cx, cy, color, radius) {
+ ctx.beginPath();
+ ctx.strokeStyle = color;
+ ctx.fillStyle = "white";
+ ctx.arc(cx, cy, radius, 0, 2 * Math.PI, false);
+ ctx.fill();
+ ctx.stroke();
+ },
+ STAR : Dygraph.shapeFunction_(5, 0, 4 * Math.PI / 5),
+ PLUS : function(g, name, ctx, cx, cy, color, radius) {
+ ctx.strokeStyle = color;
+
+ ctx.beginPath();
+ ctx.moveTo(cx + radius, cy);
+ ctx.lineTo(cx - radius, cy);
+ ctx.closePath();
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.moveTo(cx, cy + radius);
+ ctx.lineTo(cx, cy - radius);
+ ctx.closePath();
+ ctx.stroke();
+ },
+ EX : function(g, name, ctx, cx, cy, color, radius) {
+ ctx.strokeStyle = color;
+
+ ctx.beginPath();
+ ctx.moveTo(cx + radius, cy + radius);
+ ctx.lineTo(cx - radius, cy - radius);
+ ctx.closePath();
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.moveTo(cx + radius, cy - radius);
+ ctx.lineTo(cx - radius, cy + radius);
+ ctx.closePath();
+ ctx.stroke();
+ }
+};
+
+/**
+ * To create a "drag" interaction, you typically register a mousedown event
+ * handler on the element where the drag begins. In that handler, you register a
+ * mouseup handler on the window to determine when the mouse is released,
+ * wherever that release happens. This works well, except when the user releases
+ * the mouse over an off-domain iframe. In that case, the mouseup event is
+ * handled by the iframe and never bubbles up to the window handler.
+ *
+ * To deal with this issue, we cover iframes with high z-index divs to make sure
+ * they don't capture mouseup.
+ *
+ * Usage:
+ * element.addEventListener('mousedown', function() {
+ * var tarper = new Dygraph.IFrameTarp();
+ * tarper.cover();
+ * var mouseUpHandler = function() {
+ * ...
+ * window.removeEventListener(mouseUpHandler);
+ * tarper.uncover();
+ * };
+ * window.addEventListener('mouseup', mouseUpHandler);
+ * };
+ *
+ * @constructor
+ */
+Dygraph.IFrameTarp = function() {
+ /** @type {Array.<!HTMLDivElement>} */
+ this.tarps = [];
+};
+
+/**
+ * Find all the iframes in the document and cover them with high z-index
+ * transparent divs.
+ */
+Dygraph.IFrameTarp.prototype.cover = function() {
+ var iframes = document.getElementsByTagName("iframe");
+ for (var i = 0; i < iframes.length; i++) {
+ var iframe = iframes[i];
+ var x = Dygraph.findPosX(iframe),
+ y = Dygraph.findPosY(iframe),
+ width = iframe.offsetWidth,
+ height = iframe.offsetHeight;
+
+ var div = document.createElement("div");
+ div.style.position = "absolute";
+ div.style.left = x + 'px';
+ div.style.top = y + 'px';
+ div.style.width = width + 'px';
+ div.style.height = height + 'px';
+ div.style.zIndex = 999;
+ document.body.appendChild(div);
+ this.tarps.push(div);
+ }
+};
+
+/**
+ * Remove all the iframe covers. You should call this in a mouseup handler.
+ */
+Dygraph.IFrameTarp.prototype.uncover = function() {
+ for (var i = 0; i < this.tarps.length; i++) {
+ this.tarps[i].parentNode.removeChild(this.tarps[i]);
+ }
+ this.tarps = [];
+};
+
+/**
+ * Determine whether |data| is delimited by CR, CRLF, LF, LFCR.
+ * @param {string} data
+ * @return {?string} the delimiter that was detected (or null on failure).
+ */
+Dygraph.detectLineDelimiter = function(data) {
+ for (var i = 0; i < data.length; i++) {
+ var code = data.charAt(i);
+ if (code === '\r') {
+ // Might actually be "\r\n".
+ if (((i + 1) < data.length) && (data.charAt(i + 1) === '\n')) {
+ return '\r\n';
+ }
+ return code;
+ }
+ if (code === '\n') {
+ // Might actually be "\n\r".
+ if (((i + 1) < data.length) && (data.charAt(i + 1) === '\r')) {
+ return '\n\r';
+ }
+ return code;
+ }
+ }
+
+ return null;
+};
+
+/**
+ * Is one node contained by another?
+ * @param {Node} containee The contained node.
+ * @param {Node} container The container node.
+ * @return {boolean} Whether containee is inside (or equal to) container.
+ * @private
+ */
+Dygraph.isNodeContainedBy = function(containee, container) {
+ if (container === null || containee === null) {
+ return false;
+ }
+ var containeeNode = /** @type {Node} */ (containee);
+ while (containeeNode && containeeNode !== container) {
+ containeeNode = containeeNode.parentNode;
+ }
+ return (containeeNode === container);
+};
+
+
+// This masks some numeric issues in older versions of Firefox,
+// where 1.0/Math.pow(10,2) != Math.pow(10,-2).
+/** @type {function(number,number):number} */
+Dygraph.pow = function(base, exp) {
+ if (exp < 0) {
+ return 1.0 / Math.pow(base, -exp);
+ }
+ return Math.pow(base, exp);
+};
+
+// For Dygraph.setDateSameTZ, below.
+Dygraph.dateSetters = {
+ ms: Date.prototype.setMilliseconds,
+ s: Date.prototype.setSeconds,
+ m: Date.prototype.setMinutes,
+ h: Date.prototype.setHours
+};
+
+/**
+ * This is like calling d.setSeconds(), d.setMinutes(), etc, except that it
+ * adjusts for time zone changes to keep the date/time parts consistent.
+ *
+ * For example, d.getSeconds(), d.getMinutes() and d.getHours() will all be
+ * the same before/after you call setDateSameTZ(d, {ms: 0}). The same is not
+ * true if you call d.setMilliseconds(0).
+ *
+ * @type {function(!Date, Object.<number>)}
+ */
+Dygraph.setDateSameTZ = function(d, parts) {
+ var tz = d.getTimezoneOffset();
+ for (var k in parts) {
+ if (!parts.hasOwnProperty(k)) continue;
+ var setter = Dygraph.dateSetters[k];
+ if (!setter) throw "Invalid setter: " + k;
+ setter.call(d, parts[k]);
+ if (d.getTimezoneOffset() != tz) {
+ d.setTime(d.getTime() + (tz - d.getTimezoneOffset()) * 60 * 1000);
+ }
+ }
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph.js
new file mode 100644
index 00000000..1ee711ca
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph.js
@@ -0,0 +1,3857 @@
+/**
+ * @license
+ * Copyright 2006 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+
+/**
+ * @fileoverview Creates an interactive, zoomable graph based on a CSV file or
+ * string. Dygraph can handle multiple series with or without error bars. The
+ * date/value ranges will be automatically set. Dygraph uses the
+ * &lt;canvas&gt; tag, so it only works in FF1.5+.
+ * @author danvdk@gmail.com (Dan Vanderkam)
+
+ Usage:
+ <div id="graphdiv" style="width:800px; height:500px;"></div>
+ <script type="text/javascript">
+ new Dygraph(document.getElementById("graphdiv"),
+ "datafile.csv", // CSV file with headers
+ { }); // options
+ </script>
+
+ The CSV file is of the form
+
+ Date,SeriesA,SeriesB,SeriesC
+ YYYYMMDD,A1,B1,C1
+ YYYYMMDD,A2,B2,C2
+
+ If the 'errorBars' option is set in the constructor, the input should be of
+ the form
+ Date,SeriesA,SeriesB,...
+ YYYYMMDD,A1,sigmaA1,B1,sigmaB1,...
+ YYYYMMDD,A2,sigmaA2,B2,sigmaB2,...
+
+ If the 'fractions' option is set, the input should be of the form:
+
+ Date,SeriesA,SeriesB,...
+ YYYYMMDD,A1/B1,A2/B2,...
+ YYYYMMDD,A1/B1,A2/B2,...
+
+ And error bars will be calculated automatically using a binomial distribution.
+
+ For further documentation and examples, see http://dygraphs.com/
+
+ */
+
+/*jshint globalstrict: true */
+/*global DygraphLayout:false, DygraphCanvasRenderer:false, DygraphOptions:false, G_vmlCanvasManager:false */
+"use strict";
+
+/**
+ * Creates an interactive, zoomable chart.
+ *
+ * @constructor
+ * @param {div | String} div A div or the id of a div into which to construct
+ * the chart.
+ * @param {String | Function} file A file containing CSV data or a function
+ * that returns this data. The most basic expected format for each line is
+ * "YYYY/MM/DD,val1,val2,...". For more information, see
+ * http://dygraphs.com/data.html.
+ * @param {Object} attrs Various other attributes, e.g. errorBars determines
+ * whether the input data contains error ranges. For a complete list of
+ * options, see http://dygraphs.com/options.html.
+ */
+var Dygraph = function(div, data, opts, opt_fourth_param) {
+ if (opt_fourth_param !== undefined) {
+ // Old versions of dygraphs took in the series labels as a constructor
+ // parameter. This doesn't make sense anymore, but it's easy to continue
+ // to support this usage.
+ this.warn("Using deprecated four-argument dygraph constructor");
+ this.__old_init__(div, data, opts, opt_fourth_param);
+ } else {
+ this.__init__(div, data, opts);
+ }
+};
+
+Dygraph.NAME = "Dygraph";
+Dygraph.VERSION = "1.2";
+Dygraph.__repr__ = function() {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+};
+
+/**
+ * Returns information about the Dygraph class.
+ */
+Dygraph.toString = function() {
+ return this.__repr__();
+};
+
+// Various default values
+Dygraph.DEFAULT_ROLL_PERIOD = 1;
+Dygraph.DEFAULT_WIDTH = 480;
+Dygraph.DEFAULT_HEIGHT = 320;
+
+// For max 60 Hz. animation:
+Dygraph.ANIMATION_STEPS = 12;
+Dygraph.ANIMATION_DURATION = 200;
+
+// Label constants for the labelsKMB and labelsKMG2 options.
+// (i.e. '100000' -> '100K')
+Dygraph.KMB_LABELS = [ 'K', 'M', 'B', 'T', 'Q' ];
+Dygraph.KMG2_BIG_LABELS = [ 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y' ];
+Dygraph.KMG2_SMALL_LABELS = [ 'm', 'u', 'n', 'p', 'f', 'a', 'z', 'y' ];
+
+// These are defined before DEFAULT_ATTRS so that it can refer to them.
+/**
+ * @private
+ * Return a string version of a number. This respects the digitsAfterDecimal
+ * and maxNumberWidth options.
+ * @param {Number} x The number to be formatted
+ * @param {Dygraph} opts An options view
+ * @param {String} name The name of the point's data series
+ * @param {Dygraph} g The dygraph object
+ */
+Dygraph.numberValueFormatter = function(x, opts, pt, g) {
+ var sigFigs = opts('sigFigs');
+
+ if (sigFigs !== null) {
+ // User has opted for a fixed number of significant figures.
+ return Dygraph.floatFormat(x, sigFigs);
+ }
+
+ var digits = opts('digitsAfterDecimal');
+ var maxNumberWidth = opts('maxNumberWidth');
+
+ var kmb = opts('labelsKMB');
+ var kmg2 = opts('labelsKMG2');
+
+ var label;
+
+ // switch to scientific notation if we underflow or overflow fixed display.
+ if (x !== 0.0 &&
+ (Math.abs(x) >= Math.pow(10, maxNumberWidth) ||
+ Math.abs(x) < Math.pow(10, -digits))) {
+ label = x.toExponential(digits);
+ } else {
+ label = '' + Dygraph.round_(x, digits);
+ }
+
+ if (kmb || kmg2) {
+ var k;
+ var k_labels = [];
+ var m_labels = [];
+ if (kmb) {
+ k = 1000;
+ k_labels = Dygraph.KMB_LABELS;
+ }
+ if (kmg2) {
+ if (kmb) Dygraph.warn("Setting both labelsKMB and labelsKMG2. Pick one!");
+ k = 1024;
+ k_labels = Dygraph.KMG2_BIG_LABELS;
+ m_labels = Dygraph.KMG2_SMALL_LABELS;
+ }
+
+ var absx = Math.abs(x);
+ var n = Dygraph.pow(k, k_labels.length);
+ for (var j = k_labels.length - 1; j >= 0; j--, n /= k) {
+ if (absx >= n) {
+ label = Dygraph.round_(x / n, digits) + k_labels[j];
+ break;
+ }
+ }
+ if (kmg2) {
+ // TODO(danvk): clean up this logic. Why so different than kmb?
+ var x_parts = String(x.toExponential()).split('e-');
+ if (x_parts.length === 2 && x_parts[1] >= 3 && x_parts[1] <= 24) {
+ if (x_parts[1] % 3 > 0) {
+ label = Dygraph.round_(x_parts[0] /
+ Dygraph.pow(10, (x_parts[1] % 3)),
+ digits);
+ } else {
+ label = Number(x_parts[0]).toFixed(2);
+ }
+ label += m_labels[Math.floor(x_parts[1] / 3) - 1];
+ }
+ }
+ }
+
+ return label;
+};
+
+/**
+ * variant for use as an axisLabelFormatter.
+ * @private
+ */
+Dygraph.numberAxisLabelFormatter = function(x, granularity, opts, g) {
+ return Dygraph.numberValueFormatter(x, opts, g);
+};
+
+/**
+ * Convert a JS date (millis since epoch) to YYYY/MM/DD
+ * @param {Number} date The JavaScript date (ms since epoch)
+ * @return {String} A date of the form "YYYY/MM/DD"
+ * @private
+ */
+Dygraph.dateString_ = function(date) {
+ var zeropad = Dygraph.zeropad;
+ var d = new Date(date);
+
+ // Get the year:
+ var year = "" + d.getFullYear();
+ // Get a 0 padded month string
+ var month = zeropad(d.getMonth() + 1); //months are 0-offset, sigh
+ // Get a 0 padded day string
+ var day = zeropad(d.getDate());
+
+ var ret = "";
+ var frac = d.getHours() * 3600 + d.getMinutes() * 60 + d.getSeconds();
+ if (frac) ret = " " + Dygraph.hmsString_(date);
+
+ return year + "/" + month + "/" + day + ret;
+};
+
+/**
+ * Convert a JS date to a string appropriate to display on an axis that
+ * is displaying values at the stated granularity.
+ * @param {Date} date The date to format
+ * @param {Number} granularity One of the Dygraph granularity constants
+ * @return {String} The formatted date
+ * @private
+ */
+Dygraph.dateAxisFormatter = function(date, granularity) {
+ if (granularity >= Dygraph.DECADAL) {
+ return date.strftime('%Y');
+ } else if (granularity >= Dygraph.MONTHLY) {
+ return date.strftime('%b %y');
+ } else {
+ var frac = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds() + date.getMilliseconds();
+ if (frac === 0 || granularity >= Dygraph.DAILY) {
+ return new Date(date.getTime() + 3600*1000).strftime('%d%b');
+ } else {
+ return Dygraph.hmsString_(date.getTime());
+ }
+ }
+};
+
+/**
+ * Standard plotters. These may be used by clients.
+ * Available plotters are:
+ * - Dygraph.Plotters.linePlotter: draws central lines (most common)
+ * - Dygraph.Plotters.errorPlotter: draws error bars
+ * - Dygraph.Plotters.fillPlotter: draws fills under lines (used with fillGraph)
+ *
+ * By default, the plotter is [fillPlotter, errorPlotter, linePlotter].
+ * This causes all the lines to be drawn over all the fills/error bars.
+ */
+Dygraph.Plotters = DygraphCanvasRenderer._Plotters;
+
+
+// Default attribute values.
+Dygraph.DEFAULT_ATTRS = {
+ highlightCircleSize: 3,
+ highlightSeriesOpts: null,
+ highlightSeriesBackgroundAlpha: 0.5,
+
+ labelsDivWidth: 250,
+ labelsDivStyles: {
+ // TODO(danvk): move defaults from createStatusMessage_ here.
+ },
+ labelsSeparateLines: false,
+ labelsShowZeroValues: true,
+ labelsKMB: false,
+ labelsKMG2: false,
+ showLabelsOnHighlight: true,
+
+ digitsAfterDecimal: 2,
+ maxNumberWidth: 6,
+ sigFigs: null,
+
+ strokeWidth: 1.0,
+ strokeBorderWidth: 0,
+ strokeBorderColor: "white",
+
+ axisTickSize: 3,
+ axisLabelFontSize: 14,
+ xAxisLabelWidth: 50,
+ yAxisLabelWidth: 50,
+ rightGap: 5,
+
+ showRoller: false,
+ xValueParser: Dygraph.dateParser,
+
+ delimiter: ',',
+
+ sigma: 2.0,
+ errorBars: false,
+ fractions: false,
+ wilsonInterval: true, // only relevant if fractions is true
+ customBars: false,
+ fillGraph: false,
+ fillAlpha: 0.15,
+ connectSeparatedPoints: false,
+
+ stackedGraph: false,
+ stackedGraphNaNFill: 'all',
+ hideOverlayOnMouseOut: true,
+
+ // TODO(danvk): support 'onmouseover' and 'never', and remove synonyms.
+ legend: 'onmouseover', // the only relevant value at the moment is 'always'.
+
+ stepPlot: false,
+ avoidMinZero: false,
+ xRangePad: 0,
+ yRangePad: null,
+ drawAxesAtZero: false,
+
+ // Sizes of the various chart labels.
+ titleHeight: 28,
+ xLabelHeight: 18,
+ yLabelWidth: 18,
+
+ drawXAxis: true,
+ drawYAxis: true,
+ axisLineColor: "black",
+ axisLineWidth: 0.3,
+ gridLineWidth: 0.3,
+ axisLabelColor: "black",
+ axisLabelFont: "Arial", // TODO(danvk): is this implemented?
+ axisLabelWidth: 50,
+ drawYGrid: true,
+ drawXGrid: true,
+ gridLineColor: "rgb(128,128,128)",
+
+ interactionModel: null, // will be set to Dygraph.Interaction.defaultModel
+ animatedZooms: false, // (for now)
+
+ // Range selector options
+ showRangeSelector: false,
+ rangeSelectorHeight: 40,
+ rangeSelectorPlotStrokeColor: "#808FAB",
+ rangeSelectorPlotFillColor: "#A7B1C4",
+
+ // The ordering here ensures that central lines always appear above any
+ // fill bars/error bars.
+ plotter: [
+ Dygraph.Plotters.fillPlotter,
+ Dygraph.Plotters.errorPlotter,
+ Dygraph.Plotters.linePlotter
+ ],
+
+ plugins: [ ],
+
+ // per-axis options
+ axes: {
+ x: {
+ pixelsPerLabel: 60,
+ axisLabelFormatter: Dygraph.dateAxisFormatter,
+ valueFormatter: Dygraph.dateString_,
+ drawGrid: true,
+ independentTicks: true,
+ ticker: null // will be set in dygraph-tickers.js
+ },
+ y: {
+ pixelsPerLabel: 30,
+ valueFormatter: Dygraph.numberValueFormatter,
+ axisLabelFormatter: Dygraph.numberAxisLabelFormatter,
+ drawGrid: true,
+ independentTicks: true,
+ ticker: null // will be set in dygraph-tickers.js
+ },
+ y2: {
+ pixelsPerLabel: 30,
+ valueFormatter: Dygraph.numberValueFormatter,
+ axisLabelFormatter: Dygraph.numberAxisLabelFormatter,
+ drawGrid: false,
+ independentTicks: false,
+ ticker: null // will be set in dygraph-tickers.js
+ }
+ }
+};
+
+// Directions for panning and zooming. Use bit operations when combined
+// values are possible.
+Dygraph.HORIZONTAL = 1;
+Dygraph.VERTICAL = 2;
+
+// Installed plugins, in order of precedence (most-general to most-specific).
+// Plugins are installed after they are defined, in plugins/install.js.
+Dygraph.PLUGINS = [
+];
+
+// Used for initializing annotation CSS rules only once.
+Dygraph.addedAnnotationCSS = false;
+
+Dygraph.prototype.__old_init__ = function(div, file, labels, attrs) {
+ // Labels is no longer a constructor parameter, since it's typically set
+ // directly from the data source. It also conains a name for the x-axis,
+ // which the previous constructor form did not.
+ if (labels !== null) {
+ var new_labels = ["Date"];
+ for (var i = 0; i < labels.length; i++) new_labels.push(labels[i]);
+ Dygraph.update(attrs, { 'labels': new_labels });
+ }
+ this.__init__(div, file, attrs);
+};
+
+/**
+ * Initializes the Dygraph. This creates a new DIV and constructs the PlotKit
+ * and context &lt;canvas&gt; inside of it. See the constructor for details.
+ * on the parameters.
+ * @param {Element} div the Element to render the graph into.
+ * @param {String | Function} file Source data
+ * @param {Object} attrs Miscellaneous other options
+ * @private
+ */
+Dygraph.prototype.__init__ = function(div, file, attrs) {
+ // Hack for IE: if we're using excanvas and the document hasn't finished
+ // loading yet (and hence may not have initialized whatever it needs to
+ // initialize), then keep calling this routine periodically until it has.
+ if (/MSIE/.test(navigator.userAgent) && !window.opera &&
+ typeof(G_vmlCanvasManager) != 'undefined' &&
+ document.readyState != 'complete') {
+ var self = this;
+ setTimeout(function() { self.__init__(div, file, attrs); }, 100);
+ return;
+ }
+
+ // Support two-argument constructor
+ if (attrs === null || attrs === undefined) { attrs = {}; }
+
+ attrs = Dygraph.mapLegacyOptions_(attrs);
+
+ if (typeof(div) == 'string') {
+ div = document.getElementById(div);
+ }
+
+ if (!div) {
+ Dygraph.error("Constructing dygraph with a non-existent div!");
+ return;
+ }
+
+ this.isUsingExcanvas_ = typeof(G_vmlCanvasManager) != 'undefined';
+
+ // Copy the important bits into the object
+ // TODO(danvk): most of these should just stay in the attrs_ dictionary.
+ this.maindiv_ = div;
+ this.file_ = file;
+ this.rollPeriod_ = attrs.rollPeriod || Dygraph.DEFAULT_ROLL_PERIOD;
+ this.previousVerticalX_ = -1;
+ this.fractions_ = attrs.fractions || false;
+ this.dateWindow_ = attrs.dateWindow || null;
+
+ this.is_initial_draw_ = true;
+ this.annotations_ = [];
+
+ // Zoomed indicators - These indicate when the graph has been zoomed and on what axis.
+ this.zoomed_x_ = false;
+ this.zoomed_y_ = false;
+
+ // Clear the div. This ensure that, if multiple dygraphs are passed the same
+ // div, then only one will be drawn.
+ div.innerHTML = "";
+
+ // For historical reasons, the 'width' and 'height' options trump all CSS
+ // rules _except_ for an explicit 'width' or 'height' on the div.
+ // As an added convenience, if the div has zero height (like <div></div> does
+ // without any styles), then we use a default height/width.
+ if (div.style.width === '' && attrs.width) {
+ div.style.width = attrs.width + "px";
+ }
+ if (div.style.height === '' && attrs.height) {
+ div.style.height = attrs.height + "px";
+ }
+ if (div.style.height === '' && div.clientHeight === 0) {
+ div.style.height = Dygraph.DEFAULT_HEIGHT + "px";
+ if (div.style.width === '') {
+ div.style.width = Dygraph.DEFAULT_WIDTH + "px";
+ }
+ }
+ // These will be zero if the dygraph's div is hidden. In that case,
+ // use the user-specified attributes if present. If not, use zero
+ // and assume the user will call resize to fix things later.
+ this.width_ = div.clientWidth || attrs.width || 0;
+ this.height_ = div.clientHeight || attrs.height || 0;
+
+ // TODO(danvk): set fillGraph to be part of attrs_ here, not user_attrs_.
+ if (attrs.stackedGraph) {
+ attrs.fillGraph = true;
+ // TODO(nikhilk): Add any other stackedGraph checks here.
+ }
+
+ // DEPRECATION WARNING: All option processing should be moved from
+ // attrs_ and user_attrs_ to options_, which holds all this information.
+ //
+ // Dygraphs has many options, some of which interact with one another.
+ // To keep track of everything, we maintain two sets of options:
+ //
+ // this.user_attrs_ only options explicitly set by the user.
+ // this.attrs_ defaults, options derived from user_attrs_, data.
+ //
+ // Options are then accessed this.attr_('attr'), which first looks at
+ // user_attrs_ and then computed attrs_. This way Dygraphs can set intelligent
+ // defaults without overriding behavior that the user specifically asks for.
+ this.user_attrs_ = {};
+ Dygraph.update(this.user_attrs_, attrs);
+
+ // This sequence ensures that Dygraph.DEFAULT_ATTRS is never modified.
+ this.attrs_ = {};
+ Dygraph.updateDeep(this.attrs_, Dygraph.DEFAULT_ATTRS);
+
+ this.boundaryIds_ = [];
+ this.setIndexByName_ = {};
+ this.datasetIndex_ = [];
+
+ this.registeredEvents_ = [];
+ this.eventListeners_ = {};
+
+ this.attributes_ = new DygraphOptions(this);
+
+ // Create the containing DIV and other interactive elements
+ this.createInterface_();
+
+ // Activate plugins.
+ this.plugins_ = [];
+ var plugins = Dygraph.PLUGINS.concat(this.getOption('plugins'));
+ for (var i = 0; i < plugins.length; i++) {
+ var Plugin = plugins[i];
+ var pluginInstance = new Plugin();
+ var pluginDict = {
+ plugin: pluginInstance,
+ events: {},
+ options: {},
+ pluginOptions: {}
+ };
+
+ var handlers = pluginInstance.activate(this);
+ for (var eventName in handlers) {
+ // TODO(danvk): validate eventName.
+ pluginDict.events[eventName] = handlers[eventName];
+ }
+
+ this.plugins_.push(pluginDict);
+ }
+
+ // At this point, plugins can no longer register event handlers.
+ // Construct a map from event -> ordered list of [callback, plugin].
+ for (var i = 0; i < this.plugins_.length; i++) {
+ var plugin_dict = this.plugins_[i];
+ for (var eventName in plugin_dict.events) {
+ if (!plugin_dict.events.hasOwnProperty(eventName)) continue;
+ var callback = plugin_dict.events[eventName];
+
+ var pair = [plugin_dict.plugin, callback];
+ if (!(eventName in this.eventListeners_)) {
+ this.eventListeners_[eventName] = [pair];
+ } else {
+ this.eventListeners_[eventName].push(pair);
+ }
+ }
+ }
+
+ this.createDragInterface_();
+
+ this.start_();
+};
+
+/**
+ * Triggers a cascade of events to the various plugins which are interested in them.
+ * Returns true if the "default behavior" should be performed, i.e. if none of
+ * the event listeners called event.preventDefault().
+ * @private
+ */
+Dygraph.prototype.cascadeEvents_ = function(name, extra_props) {
+ if (!(name in this.eventListeners_)) return true;
+
+ // QUESTION: can we use objects & prototypes to speed this up?
+ var e = {
+ dygraph: this,
+ cancelable: false,
+ defaultPrevented: false,
+ preventDefault: function() {
+ if (!e.cancelable) throw "Cannot call preventDefault on non-cancelable event.";
+ e.defaultPrevented = true;
+ },
+ propagationStopped: false,
+ stopPropagation: function() {
+ e.propagationStopped = true;
+ }
+ };
+ Dygraph.update(e, extra_props);
+
+ var callback_plugin_pairs = this.eventListeners_[name];
+ if (callback_plugin_pairs) {
+ for (var i = callback_plugin_pairs.length - 1; i >= 0; i--) {
+ var plugin = callback_plugin_pairs[i][0];
+ var callback = callback_plugin_pairs[i][1];
+ callback.call(plugin, e);
+ if (e.propagationStopped) break;
+ }
+ }
+ return e.defaultPrevented;
+};
+
+/**
+ * Returns the zoomed status of the chart for one or both axes.
+ *
+ * Axis is an optional parameter. Can be set to 'x' or 'y'.
+ *
+ * The zoomed status for an axis is set whenever a user zooms using the mouse
+ * or when the dateWindow or valueRange are updated (unless the
+ * isZoomedIgnoreProgrammaticZoom option is also specified).
+ */
+Dygraph.prototype.isZoomed = function(axis) {
+ if (axis === null || axis === undefined) {
+ return this.zoomed_x_ || this.zoomed_y_;
+ }
+ if (axis === 'x') return this.zoomed_x_;
+ if (axis === 'y') return this.zoomed_y_;
+ throw "axis parameter is [" + axis + "] must be null, 'x' or 'y'.";
+};
+
+/**
+ * Returns information about the Dygraph object, including its containing ID.
+ */
+Dygraph.prototype.toString = function() {
+ var maindiv = this.maindiv_;
+ var id = (maindiv && maindiv.id) ? maindiv.id : maindiv;
+ return "[Dygraph " + id + "]";
+};
+
+/**
+ * @private
+ * Returns the value of an option. This may be set by the user (either in the
+ * constructor or by calling updateOptions) or by dygraphs, and may be set to a
+ * per-series value.
+ * @param { String } name The name of the option, e.g. 'rollPeriod'.
+ * @param { String } [seriesName] The name of the series to which the option
+ * will be applied. If no per-series value of this option is available, then
+ * the global value is returned. This is optional.
+ * @return { ... } The value of the option.
+ */
+Dygraph.prototype.attr_ = function(name, seriesName) {
+// <REMOVE_FOR_COMBINED>
+ if (typeof(Dygraph.OPTIONS_REFERENCE) === 'undefined') {
+ this.error('Must include options reference JS for testing');
+ } else if (!Dygraph.OPTIONS_REFERENCE.hasOwnProperty(name)) {
+ this.error('Dygraphs is using property ' + name + ', which has no entry ' +
+ 'in the Dygraphs.OPTIONS_REFERENCE listing.');
+ // Only log this error once.
+ Dygraph.OPTIONS_REFERENCE[name] = true;
+ }
+// </REMOVE_FOR_COMBINED>
+ return seriesName ? this.attributes_.getForSeries(name, seriesName) : this.attributes_.get(name);
+};
+
+/**
+ * Returns the current value for an option, as set in the constructor or via
+ * updateOptions. You may pass in an (optional) series name to get per-series
+ * values for the option.
+ *
+ * All values returned by this method should be considered immutable. If you
+ * modify them, there is no guarantee that the changes will be honored or that
+ * dygraphs will remain in a consistent state. If you want to modify an option,
+ * use updateOptions() instead.
+ *
+ * @param { String } name The name of the option (e.g. 'strokeWidth')
+ * @param { String } [opt_seriesName] Series name to get per-series values.
+ * @return { ... } The value of the option.
+ */
+Dygraph.prototype.getOption = function(name, opt_seriesName) {
+ return this.attr_(name, opt_seriesName);
+};
+
+Dygraph.prototype.getOptionForAxis = function(name, axis) {
+ return this.attributes_.getForAxis(name, axis);
+};
+
+/**
+ * @private
+ * @param String} axis The name of the axis (i.e. 'x', 'y' or 'y2')
+ * @return { ... } A function mapping string -> option value
+ */
+Dygraph.prototype.optionsViewForAxis_ = function(axis) {
+ var self = this;
+ return function(opt) {
+ var axis_opts = self.user_attrs_.axes;
+ if (axis_opts && axis_opts[axis] && axis_opts[axis].hasOwnProperty(opt)) {
+ return axis_opts[axis][opt];
+ }
+ // user-specified attributes always trump defaults, even if they're less
+ // specific.
+ if (typeof(self.user_attrs_[opt]) != 'undefined') {
+ return self.user_attrs_[opt];
+ }
+
+ axis_opts = self.attrs_.axes;
+ if (axis_opts && axis_opts[axis] && axis_opts[axis].hasOwnProperty(opt)) {
+ return axis_opts[axis][opt];
+ }
+ // check old-style axis options
+ // TODO(danvk): add a deprecation warning if either of these match.
+ if (axis == 'y' && self.axes_[0].hasOwnProperty(opt)) {
+ return self.axes_[0][opt];
+ } else if (axis == 'y2' && self.axes_[1].hasOwnProperty(opt)) {
+ return self.axes_[1][opt];
+ }
+ return self.attr_(opt);
+ };
+};
+
+/**
+ * Returns the current rolling period, as set by the user or an option.
+ * @return {Number} The number of points in the rolling window
+ */
+Dygraph.prototype.rollPeriod = function() {
+ return this.rollPeriod_;
+};
+
+/**
+ * Returns the currently-visible x-range. This can be affected by zooming,
+ * panning or a call to updateOptions.
+ * Returns a two-element array: [left, right].
+ * If the Dygraph has dates on the x-axis, these will be millis since epoch.
+ */
+Dygraph.prototype.xAxisRange = function() {
+ return this.dateWindow_ ? this.dateWindow_ : this.xAxisExtremes();
+};
+
+/**
+ * Returns the lower- and upper-bound x-axis values of the
+ * data set.
+ */
+Dygraph.prototype.xAxisExtremes = function() {
+ var pad = this.attr_('xRangePad') / this.plotter_.area.w;
+ if (this.numRows() === 0) {
+ return [0 - pad, 1 + pad];
+ }
+ var left = this.rawData_[0][0];
+ var right = this.rawData_[this.rawData_.length - 1][0];
+ if (pad) {
+ // Must keep this in sync with dygraph-layout _evaluateLimits()
+ var range = right - left;
+ left -= range * pad;
+ right += range * pad;
+ }
+ return [left, right];
+};
+
+/**
+ * Returns the currently-visible y-range for an axis. This can be affected by
+ * zooming, panning or a call to updateOptions. Axis indices are zero-based. If
+ * called with no arguments, returns the range of the first axis.
+ * Returns a two-element array: [bottom, top].
+ */
+Dygraph.prototype.yAxisRange = function(idx) {
+ if (typeof(idx) == "undefined") idx = 0;
+ if (idx < 0 || idx >= this.axes_.length) {
+ return null;
+ }
+ var axis = this.axes_[idx];
+ return [ axis.computedValueRange[0], axis.computedValueRange[1] ];
+};
+
+/**
+ * Returns the currently-visible y-ranges for each axis. This can be affected by
+ * zooming, panning, calls to updateOptions, etc.
+ * Returns an array of [bottom, top] pairs, one for each y-axis.
+ */
+Dygraph.prototype.yAxisRanges = function() {
+ var ret = [];
+ for (var i = 0; i < this.axes_.length; i++) {
+ ret.push(this.yAxisRange(i));
+ }
+ return ret;
+};
+
+// TODO(danvk): use these functions throughout dygraphs.
+/**
+ * Convert from data coordinates to canvas/div X/Y coordinates.
+ * If specified, do this conversion for the coordinate system of a particular
+ * axis. Uses the first axis by default.
+ * Returns a two-element array: [X, Y]
+ *
+ * Note: use toDomXCoord instead of toDomCoords(x, null) and use toDomYCoord
+ * instead of toDomCoords(null, y, axis).
+ */
+Dygraph.prototype.toDomCoords = function(x, y, axis) {
+ return [ this.toDomXCoord(x), this.toDomYCoord(y, axis) ];
+};
+
+/**
+ * Convert from data x coordinates to canvas/div X coordinate.
+ * If specified, do this conversion for the coordinate system of a particular
+ * axis.
+ * Returns a single value or null if x is null.
+ */
+Dygraph.prototype.toDomXCoord = function(x) {
+ if (x === null) {
+ return null;
+ }
+
+ var area = this.plotter_.area;
+ var xRange = this.xAxisRange();
+ return area.x + (x - xRange[0]) / (xRange[1] - xRange[0]) * area.w;
+};
+
+/**
+ * Convert from data x coordinates to canvas/div Y coordinate and optional
+ * axis. Uses the first axis by default.
+ *
+ * returns a single value or null if y is null.
+ */
+Dygraph.prototype.toDomYCoord = function(y, axis) {
+ var pct = this.toPercentYCoord(y, axis);
+
+ if (pct === null) {
+ return null;
+ }
+ var area = this.plotter_.area;
+ return area.y + pct * area.h;
+};
+
+/**
+ * Convert from canvas/div coords to data coordinates.
+ * If specified, do this conversion for the coordinate system of a particular
+ * axis. Uses the first axis by default.
+ * Returns a two-element array: [X, Y].
+ *
+ * Note: use toDataXCoord instead of toDataCoords(x, null) and use toDataYCoord
+ * instead of toDataCoords(null, y, axis).
+ */
+Dygraph.prototype.toDataCoords = function(x, y, axis) {
+ return [ this.toDataXCoord(x), this.toDataYCoord(y, axis) ];
+};
+
+/**
+ * Convert from canvas/div x coordinate to data coordinate.
+ *
+ * If x is null, this returns null.
+ */
+Dygraph.prototype.toDataXCoord = function(x) {
+ if (x === null) {
+ return null;
+ }
+
+ var area = this.plotter_.area;
+ var xRange = this.xAxisRange();
+ return xRange[0] + (x - area.x) / area.w * (xRange[1] - xRange[0]);
+};
+
+/**
+ * Convert from canvas/div y coord to value.
+ *
+ * If y is null, this returns null.
+ * if axis is null, this uses the first axis.
+ */
+Dygraph.prototype.toDataYCoord = function(y, axis) {
+ if (y === null) {
+ return null;
+ }
+
+ var area = this.plotter_.area;
+ var yRange = this.yAxisRange(axis);
+
+ if (typeof(axis) == "undefined") axis = 0;
+ if (!this.axes_[axis].logscale) {
+ return yRange[0] + (area.y + area.h - y) / area.h * (yRange[1] - yRange[0]);
+ } else {
+ // Computing the inverse of toDomCoord.
+ var pct = (y - area.y) / area.h;
+
+ // Computing the inverse of toPercentYCoord. The function was arrived at with
+ // the following steps:
+ //
+ // Original calcuation:
+ // pct = (logr1 - Dygraph.log10(y)) / (logr1 - Dygraph.log10(yRange[0]));
+ //
+ // Move denominator to both sides:
+ // pct * (logr1 - Dygraph.log10(yRange[0])) = logr1 - Dygraph.log10(y);
+ //
+ // subtract logr1, and take the negative value.
+ // logr1 - (pct * (logr1 - Dygraph.log10(yRange[0]))) = Dygraph.log10(y);
+ //
+ // Swap both sides of the equation, and we can compute the log of the
+ // return value. Which means we just need to use that as the exponent in
+ // e^exponent.
+ // Dygraph.log10(y) = logr1 - (pct * (logr1 - Dygraph.log10(yRange[0])));
+
+ var logr1 = Dygraph.log10(yRange[1]);
+ var exponent = logr1 - (pct * (logr1 - Dygraph.log10(yRange[0])));
+ var value = Math.pow(Dygraph.LOG_SCALE, exponent);
+ return value;
+ }
+};
+
+/**
+ * Converts a y for an axis to a percentage from the top to the
+ * bottom of the drawing area.
+ *
+ * If the coordinate represents a value visible on the canvas, then
+ * the value will be between 0 and 1, where 0 is the top of the canvas.
+ * However, this method will return values outside the range, as
+ * values can fall outside the canvas.
+ *
+ * If y is null, this returns null.
+ * if axis is null, this uses the first axis.
+ *
+ * @param { Number } y The data y-coordinate.
+ * @param { Number } [axis] The axis number on which the data coordinate lives.
+ * @return { Number } A fraction in [0, 1] where 0 = the top edge.
+ */
+Dygraph.prototype.toPercentYCoord = function(y, axis) {
+ if (y === null) {
+ return null;
+ }
+ if (typeof(axis) == "undefined") axis = 0;
+
+ var yRange = this.yAxisRange(axis);
+
+ var pct;
+ var logscale = this.attributes_.getForAxis("logscale", axis);
+ if (!logscale) {
+ // yRange[1] - y is unit distance from the bottom.
+ // yRange[1] - yRange[0] is the scale of the range.
+ // (yRange[1] - y) / (yRange[1] - yRange[0]) is the % from the bottom.
+ pct = (yRange[1] - y) / (yRange[1] - yRange[0]);
+ } else {
+ var logr1 = Dygraph.log10(yRange[1]);
+ pct = (logr1 - Dygraph.log10(y)) / (logr1 - Dygraph.log10(yRange[0]));
+ }
+ return pct;
+};
+
+/**
+ * Converts an x value to a percentage from the left to the right of
+ * the drawing area.
+ *
+ * If the coordinate represents a value visible on the canvas, then
+ * the value will be between 0 and 1, where 0 is the left of the canvas.
+ * However, this method will return values outside the range, as
+ * values can fall outside the canvas.
+ *
+ * If x is null, this returns null.
+ * @param { Number } x The data x-coordinate.
+ * @return { Number } A fraction in [0, 1] where 0 = the left edge.
+ */
+Dygraph.prototype.toPercentXCoord = function(x) {
+ if (x === null) {
+ return null;
+ }
+
+ var xRange = this.xAxisRange();
+ return (x - xRange[0]) / (xRange[1] - xRange[0]);
+};
+
+/**
+ * Returns the number of columns (including the independent variable).
+ * @return { Integer } The number of columns.
+ */
+Dygraph.prototype.numColumns = function() {
+ if (!this.rawData_) return 0;
+ return this.rawData_[0] ? this.rawData_[0].length : this.attr_("labels").length;
+};
+
+/**
+ * Returns the number of rows (excluding any header/label row).
+ * @return { Integer } The number of rows, less any header.
+ */
+Dygraph.prototype.numRows = function() {
+ if (!this.rawData_) return 0;
+ return this.rawData_.length;
+};
+
+/**
+ * Returns the value in the given row and column. If the row and column exceed
+ * the bounds on the data, returns null. Also returns null if the value is
+ * missing.
+ * @param { Number} row The row number of the data (0-based). Row 0 is the
+ * first row of data, not a header row.
+ * @param { Number} col The column number of the data (0-based)
+ * @return { Number } The value in the specified cell or null if the row/col
+ * were out of range.
+ */
+Dygraph.prototype.getValue = function(row, col) {
+ if (row < 0 || row > this.rawData_.length) return null;
+ if (col < 0 || col > this.rawData_[row].length) return null;
+
+ return this.rawData_[row][col];
+};
+
+/**
+ * Generates interface elements for the Dygraph: a containing div, a div to
+ * display the current point, and a textbox to adjust the rolling average
+ * period. Also creates the Renderer/Layout elements.
+ * @private
+ */
+Dygraph.prototype.createInterface_ = function() {
+ // Create the all-enclosing graph div
+ var enclosing = this.maindiv_;
+
+ this.graphDiv = document.createElement("div");
+
+ // TODO(danvk): any other styles that are useful to set here?
+ this.graphDiv.style.textAlign = 'left'; // This is a CSS "reset"
+ enclosing.appendChild(this.graphDiv);
+
+ // Create the canvas for interactive parts of the chart.
+ this.canvas_ = Dygraph.createCanvas();
+ this.canvas_.style.position = "absolute";
+
+ // ... and for static parts of the chart.
+ this.hidden_ = this.createPlotKitCanvas_(this.canvas_);
+
+ this.resizeElements_();
+
+ this.canvas_ctx_ = Dygraph.getContext(this.canvas_);
+ this.hidden_ctx_ = Dygraph.getContext(this.hidden_);
+
+ // The interactive parts of the graph are drawn on top of the chart.
+ this.graphDiv.appendChild(this.hidden_);
+ this.graphDiv.appendChild(this.canvas_);
+ this.mouseEventElement_ = this.createMouseEventElement_();
+
+ // Create the grapher
+ this.layout_ = new DygraphLayout(this);
+
+ var dygraph = this;
+
+ this.mouseMoveHandler_ = function(e) {
+ dygraph.mouseMove_(e);
+ };
+
+ this.mouseOutHandler_ = function(e) {
+ // The mouse has left the chart if:
+ // 1. e.target is inside the chart
+ // 2. e.relatedTarget is outside the chart
+ var target = e.target || e.fromElement;
+ var relatedTarget = e.relatedTarget || e.toElement;
+ if (Dygraph.isNodeContainedBy(target, dygraph.graphDiv) &&
+ !Dygraph.isNodeContainedBy(relatedTarget, dygraph.graphDiv)) {
+ dygraph.mouseOut_(e);
+ }
+ };
+
+ this.addAndTrackEvent(window, 'mouseout', this.mouseOutHandler_);
+ this.addAndTrackEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler_);
+
+ // Don't recreate and register the resize handler on subsequent calls.
+ // This happens when the graph is resized.
+ if (!this.resizeHandler_) {
+ this.resizeHandler_ = function(e) {
+ dygraph.resize();
+ };
+
+ // Update when the window is resized.
+ // TODO(danvk): drop frames depending on complexity of the chart.
+ this.addAndTrackEvent(window, 'resize', this.resizeHandler_);
+ }
+};
+
+Dygraph.prototype.resizeElements_ = function() {
+ this.graphDiv.style.width = this.width_ + "px";
+ this.graphDiv.style.height = this.height_ + "px";
+ this.canvas_.width = this.width_;
+ this.canvas_.height = this.height_;
+ this.canvas_.style.width = this.width_ + "px"; // for IE
+ this.canvas_.style.height = this.height_ + "px"; // for IE
+ this.hidden_.width = this.width_;
+ this.hidden_.height = this.height_;
+ this.hidden_.style.width = this.width_ + "px"; // for IE
+ this.hidden_.style.height = this.height_ + "px"; // for IE
+};
+
+/**
+ * Detach DOM elements in the dygraph and null out all data references.
+ * Calling this when you're done with a dygraph can dramatically reduce memory
+ * usage. See, e.g., the tests/perf.html example.
+ */
+Dygraph.prototype.destroy = function() {
+ this.canvas_ctx_.restore();
+ this.hidden_ctx_.restore();
+
+ var removeRecursive = function(node) {
+ while (node.hasChildNodes()) {
+ removeRecursive(node.firstChild);
+ node.removeChild(node.firstChild);
+ }
+ };
+
+ this.removeTrackedEvents_();
+
+ // remove mouse event handlers (This may not be necessary anymore)
+ Dygraph.removeEvent(window, 'mouseout', this.mouseOutHandler_);
+ Dygraph.removeEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler_);
+
+ // remove window handlers
+ Dygraph.removeEvent(window,'resize',this.resizeHandler_);
+ this.resizeHandler_ = null;
+
+ removeRecursive(this.maindiv_);
+
+ var nullOut = function(obj) {
+ for (var n in obj) {
+ if (typeof(obj[n]) === 'object') {
+ obj[n] = null;
+ }
+ }
+ };
+ // These may not all be necessary, but it can't hurt...
+ nullOut(this.layout_);
+ nullOut(this.plotter_);
+ nullOut(this);
+};
+
+/**
+ * Creates the canvas on which the chart will be drawn. Only the Renderer ever
+ * draws on this particular canvas. All Dygraph work (i.e. drawing hover dots
+ * or the zoom rectangles) is done on this.canvas_.
+ * @param {Object} canvas The Dygraph canvas over which to overlay the plot
+ * @return {Object} The newly-created canvas
+ * @private
+ */
+Dygraph.prototype.createPlotKitCanvas_ = function(canvas) {
+ var h = Dygraph.createCanvas();
+ h.style.position = "absolute";
+ // TODO(danvk): h should be offset from canvas. canvas needs to include
+ // some extra area to make it easier to zoom in on the far left and far
+ // right. h needs to be precisely the plot area, so that clipping occurs.
+ h.style.top = canvas.style.top;
+ h.style.left = canvas.style.left;
+ h.width = this.width_;
+ h.height = this.height_;
+ h.style.width = this.width_ + "px"; // for IE
+ h.style.height = this.height_ + "px"; // for IE
+ return h;
+};
+
+/**
+ * Creates an overlay element used to handle mouse events.
+ * @return {Object} The mouse event element.
+ * @private
+ */
+Dygraph.prototype.createMouseEventElement_ = function() {
+ if (this.isUsingExcanvas_) {
+ var elem = document.createElement("div");
+ elem.style.position = 'absolute';
+ elem.style.backgroundColor = 'white';
+ elem.style.filter = 'alpha(opacity=0)';
+ elem.style.width = this.width_ + "px";
+ elem.style.height = this.height_ + "px";
+ this.graphDiv.appendChild(elem);
+ return elem;
+ } else {
+ return this.canvas_;
+ }
+};
+
+/**
+ * Generate a set of distinct colors for the data series. This is done with a
+ * color wheel. Saturation/Value are customizable, and the hue is
+ * equally-spaced around the color wheel. If a custom set of colors is
+ * specified, that is used instead.
+ * @private
+ */
+Dygraph.prototype.setColors_ = function() {
+ var labels = this.getLabels();
+ var num = labels.length - 1;
+ this.colors_ = [];
+ this.colorsMap_ = {};
+ var colors = this.attr_('colors');
+ var i;
+ if (!colors) {
+ var sat = this.attr_('colorSaturation') || 1.0;
+ var val = this.attr_('colorValue') || 0.5;
+ var half = Math.ceil(num / 2);
+ for (i = 1; i <= num; i++) {
+ if (!this.visibility()[i-1]) continue;
+ // alternate colors for high contrast.
+ var idx = i % 2 ? Math.ceil(i / 2) : (half + i / 2);
+ var hue = (1.0 * idx/ (1 + num));
+ var colorStr = Dygraph.hsvToRGB(hue, sat, val);
+ this.colors_.push(colorStr);
+ this.colorsMap_[labels[i]] = colorStr;
+ }
+ } else {
+ for (i = 0; i < num; i++) {
+ if (!this.visibility()[i]) continue;
+ var colorStr = colors[i % colors.length];
+ this.colors_.push(colorStr);
+ this.colorsMap_[labels[1 + i]] = colorStr;
+ }
+ }
+};
+
+/**
+ * Return the list of colors. This is either the list of colors passed in the
+ * attributes or the autogenerated list of rgb(r,g,b) strings.
+ * This does not return colors for invisible series.
+ * @return {Array<string>} The list of colors.
+ */
+Dygraph.prototype.getColors = function() {
+ return this.colors_;
+};
+
+/**
+ * Returns a few attributes of a series, i.e. its color, its visibility, which
+ * axis it's assigned to, and its column in the original data.
+ * Returns null if the series does not exist.
+ * Otherwise, returns an object with column, visibility, color and axis properties.
+ * The "axis" property will be set to 1 for y1 and 2 for y2.
+ * The "column" property can be fed back into getValue(row, column) to get
+ * values for this series.
+ */
+Dygraph.prototype.getPropertiesForSeries = function(series_name) {
+ var idx = -1;
+ var labels = this.getLabels();
+ for (var i = 1; i < labels.length; i++) {
+ if (labels[i] == series_name) {
+ idx = i;
+ break;
+ }
+ }
+ if (idx == -1) return null;
+
+ return {
+ name: series_name,
+ column: idx,
+ visible: this.visibility()[idx - 1],
+ color: this.colorsMap_[series_name],
+ axis: 1 + this.attributes_.axisForSeries(series_name)
+ };
+};
+
+/**
+ * Create the text box to adjust the averaging period
+ * @private
+ */
+Dygraph.prototype.createRollInterface_ = function() {
+ // Create a roller if one doesn't exist already.
+ if (!this.roller_) {
+ this.roller_ = document.createElement("input");
+ this.roller_.type = "text";
+ this.roller_.style.display = "none";
+ this.graphDiv.appendChild(this.roller_);
+ }
+
+ var display = this.attr_('showRoller') ? 'block' : 'none';
+
+ var area = this.plotter_.area;
+ var textAttr = { "position": "absolute",
+ "zIndex": 10,
+ "top": (area.y + area.h - 25) + "px",
+ "left": (area.x + 1) + "px",
+ "display": display
+ };
+ this.roller_.size = "2";
+ this.roller_.value = this.rollPeriod_;
+ for (var name in textAttr) {
+ if (textAttr.hasOwnProperty(name)) {
+ this.roller_.style[name] = textAttr[name];
+ }
+ }
+
+ var dygraph = this;
+ this.roller_.onchange = function() { dygraph.adjustRoll(dygraph.roller_.value); };
+};
+
+/**
+ * @private
+ * Converts page the x-coordinate of the event to pixel x-coordinates on the
+ * canvas (i.e. DOM Coords).
+ */
+Dygraph.prototype.dragGetX_ = function(e, context) {
+ return Dygraph.pageX(e) - context.px;
+};
+
+/**
+ * @private
+ * Converts page the y-coordinate of the event to pixel y-coordinates on the
+ * canvas (i.e. DOM Coords).
+ */
+Dygraph.prototype.dragGetY_ = function(e, context) {
+ return Dygraph.pageY(e) - context.py;
+};
+
+/**
+ * Set up all the mouse handlers needed to capture dragging behavior for zoom
+ * events.
+ * @private
+ */
+Dygraph.prototype.createDragInterface_ = function() {
+ var context = {
+ // Tracks whether the mouse is down right now
+ isZooming: false,
+ isPanning: false, // is this drag part of a pan?
+ is2DPan: false, // if so, is that pan 1- or 2-dimensional?
+ dragStartX: null, // pixel coordinates
+ dragStartY: null, // pixel coordinates
+ dragEndX: null, // pixel coordinates
+ dragEndY: null, // pixel coordinates
+ dragDirection: null,
+ prevEndX: null, // pixel coordinates
+ prevEndY: null, // pixel coordinates
+ prevDragDirection: null,
+ cancelNextDblclick: false, // see comment in dygraph-interaction-model.js
+
+ // The value on the left side of the graph when a pan operation starts.
+ initialLeftmostDate: null,
+
+ // The number of units each pixel spans. (This won't be valid for log
+ // scales)
+ xUnitsPerPixel: null,
+
+ // TODO(danvk): update this comment
+ // The range in second/value units that the viewport encompasses during a
+ // panning operation.
+ dateRange: null,
+
+ // Top-left corner of the canvas, in DOM coords
+ // TODO(konigsberg): Rename topLeftCanvasX, topLeftCanvasY.
+ px: 0,
+ py: 0,
+
+ // Values for use with panEdgeFraction, which limit how far outside the
+ // graph's data boundaries it can be panned.
+ boundedDates: null, // [minDate, maxDate]
+ boundedValues: null, // [[minValue, maxValue] ...]
+
+ // We cover iframes during mouse interactions. See comments in
+ // dygraph-utils.js for more info on why this is a good idea.
+ tarp: new Dygraph.IFrameTarp(),
+
+ // contextB is the same thing as this context object but renamed.
+ initializeMouseDown: function(event, g, contextB) {
+ // prevents mouse drags from selecting page text.
+ if (event.preventDefault) {
+ event.preventDefault(); // Firefox, Chrome, etc.
+ } else {
+ event.returnValue = false; // IE
+ event.cancelBubble = true;
+ }
+
+ contextB.px = Dygraph.findPosX(g.canvas_);
+ contextB.py = Dygraph.findPosY(g.canvas_);
+ contextB.dragStartX = g.dragGetX_(event, contextB);
+ contextB.dragStartY = g.dragGetY_(event, contextB);
+ contextB.cancelNextDblclick = false;
+ contextB.tarp.cover();
+ }
+ };
+
+ var interactionModel = this.attr_("interactionModel");
+
+ // Self is the graph.
+ var self = this;
+
+ // Function that binds the graph and context to the handler.
+ var bindHandler = function(handler) {
+ return function(event) {
+ handler(event, self, context);
+ };
+ };
+
+ for (var eventName in interactionModel) {
+ if (!interactionModel.hasOwnProperty(eventName)) continue;
+ this.addAndTrackEvent(this.mouseEventElement_, eventName,
+ bindHandler(interactionModel[eventName]));
+ }
+
+ // If the user releases the mouse button during a drag, but not over the
+ // canvas, then it doesn't count as a zooming action.
+ var mouseUpHandler = function(event) {
+ if (context.isZooming || context.isPanning) {
+ context.isZooming = false;
+ context.dragStartX = null;
+ context.dragStartY = null;
+ }
+
+ if (context.isPanning) {
+ context.isPanning = false;
+ context.draggingDate = null;
+ context.dateRange = null;
+ for (var i = 0; i < self.axes_.length; i++) {
+ delete self.axes_[i].draggingValue;
+ delete self.axes_[i].dragValueRange;
+ }
+ }
+
+ context.tarp.uncover();
+ };
+
+ this.addAndTrackEvent(document, 'mouseup', mouseUpHandler);
+};
+
+/**
+ * Draw a gray zoom rectangle over the desired area of the canvas. Also clears
+ * up any previous zoom rectangles that were drawn. This could be optimized to
+ * avoid extra redrawing, but it's tricky to avoid interactions with the status
+ * dots.
+ *
+ * @param {Number} direction the direction of the zoom rectangle. Acceptable
+ * values are Dygraph.HORIZONTAL and Dygraph.VERTICAL.
+ * @param {Number} startX The X position where the drag started, in canvas
+ * coordinates.
+ * @param {Number} endX The current X position of the drag, in canvas coords.
+ * @param {Number} startY The Y position where the drag started, in canvas
+ * coordinates.
+ * @param {Number} endY The current Y position of the drag, in canvas coords.
+ * @param {Number} prevDirection the value of direction on the previous call to
+ * this function. Used to avoid excess redrawing
+ * @param {Number} prevEndX The value of endX on the previous call to this
+ * function. Used to avoid excess redrawing
+ * @param {Number} prevEndY The value of endY on the previous call to this
+ * function. Used to avoid excess redrawing
+ * @private
+ */
+Dygraph.prototype.drawZoomRect_ = function(direction, startX, endX, startY,
+ endY, prevDirection, prevEndX,
+ prevEndY) {
+ var ctx = this.canvas_ctx_;
+
+ // Clean up from the previous rect if necessary
+ if (prevDirection == Dygraph.HORIZONTAL) {
+ ctx.clearRect(Math.min(startX, prevEndX), this.layout_.getPlotArea().y,
+ Math.abs(startX - prevEndX), this.layout_.getPlotArea().h);
+ } else if (prevDirection == Dygraph.VERTICAL) {
+ ctx.clearRect(this.layout_.getPlotArea().x, Math.min(startY, prevEndY),
+ this.layout_.getPlotArea().w, Math.abs(startY - prevEndY));
+ }
+
+ // Draw a light-grey rectangle to show the new viewing area
+ if (direction == Dygraph.HORIZONTAL) {
+ if (endX && startX) {
+ ctx.fillStyle = "rgba(128,128,128,0.33)";
+ ctx.fillRect(Math.min(startX, endX), this.layout_.getPlotArea().y,
+ Math.abs(endX - startX), this.layout_.getPlotArea().h);
+ }
+ } else if (direction == Dygraph.VERTICAL) {
+ if (endY && startY) {
+ ctx.fillStyle = "rgba(128,128,128,0.33)";
+ ctx.fillRect(this.layout_.getPlotArea().x, Math.min(startY, endY),
+ this.layout_.getPlotArea().w, Math.abs(endY - startY));
+ }
+ }
+
+ if (this.isUsingExcanvas_) {
+ this.currentZoomRectArgs_ = [direction, startX, endX, startY, endY, 0, 0, 0];
+ }
+};
+
+/**
+ * Clear the zoom rectangle (and perform no zoom).
+ * @private
+ */
+Dygraph.prototype.clearZoomRect_ = function() {
+ this.currentZoomRectArgs_ = null;
+ this.canvas_ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height);
+};
+
+/**
+ * Zoom to something containing [lowX, highX]. These are pixel coordinates in
+ * the canvas. The exact zoom window may be slightly larger if there are no data
+ * points near lowX or highX. Don't confuse this function with doZoomXDates,
+ * which accepts dates that match the raw data. This function redraws the graph.
+ *
+ * @param {Number} lowX The leftmost pixel value that should be visible.
+ * @param {Number} highX The rightmost pixel value that should be visible.
+ * @private
+ */
+Dygraph.prototype.doZoomX_ = function(lowX, highX) {
+ this.currentZoomRectArgs_ = null;
+ // Find the earliest and latest dates contained in this canvasx range.
+ // Convert the call to date ranges of the raw data.
+ var minDate = this.toDataXCoord(lowX);
+ var maxDate = this.toDataXCoord(highX);
+ this.doZoomXDates_(minDate, maxDate);
+};
+
+/**
+ * Transition function to use in animations. Returns values between 0.0
+ * (totally old values) and 1.0 (totally new values) for each frame.
+ * @private
+ */
+Dygraph.zoomAnimationFunction = function(frame, numFrames) {
+ var k = 1.5;
+ return (1.0 - Math.pow(k, -frame)) / (1.0 - Math.pow(k, -numFrames));
+};
+
+/**
+ * Zoom to something containing [minDate, maxDate] values. Don't confuse this
+ * method with doZoomX which accepts pixel coordinates. This function redraws
+ * the graph.
+ *
+ * @param {Number} minDate The minimum date that should be visible.
+ * @param {Number} maxDate The maximum date that should be visible.
+ * @private
+ */
+Dygraph.prototype.doZoomXDates_ = function(minDate, maxDate) {
+ // TODO(danvk): when yAxisRange is null (i.e. "fit to data", the animation
+ // can produce strange effects. Rather than the y-axis transitioning slowly
+ // between values, it can jerk around.)
+ var old_window = this.xAxisRange();
+ var new_window = [minDate, maxDate];
+ this.zoomed_x_ = true;
+ var that = this;
+ this.doAnimatedZoom(old_window, new_window, null, null, function() {
+ if (that.attr_("zoomCallback")) {
+ that.attr_("zoomCallback")(minDate, maxDate, that.yAxisRanges());
+ }
+ });
+};
+
+/**
+ * Zoom to something containing [lowY, highY]. These are pixel coordinates in
+ * the canvas. This function redraws the graph.
+ *
+ * @param {Number} lowY The topmost pixel value that should be visible.
+ * @param {Number} highY The lowest pixel value that should be visible.
+ * @private
+ */
+Dygraph.prototype.doZoomY_ = function(lowY, highY) {
+ this.currentZoomRectArgs_ = null;
+ // Find the highest and lowest values in pixel range for each axis.
+ // Note that lowY (in pixels) corresponds to the max Value (in data coords).
+ // This is because pixels increase as you go down on the screen, whereas data
+ // coordinates increase as you go up the screen.
+ var oldValueRanges = this.yAxisRanges();
+ var newValueRanges = [];
+ for (var i = 0; i < this.axes_.length; i++) {
+ var hi = this.toDataYCoord(lowY, i);
+ var low = this.toDataYCoord(highY, i);
+ newValueRanges.push([low, hi]);
+ }
+
+ this.zoomed_y_ = true;
+ var that = this;
+ this.doAnimatedZoom(null, null, oldValueRanges, newValueRanges, function() {
+ if (that.attr_("zoomCallback")) {
+ var xRange = that.xAxisRange();
+ that.attr_("zoomCallback")(xRange[0], xRange[1], that.yAxisRanges());
+ }
+ });
+};
+
+/**
+ * Reset the zoom to the original view coordinates. This is the same as
+ * double-clicking on the graph.
+ */
+Dygraph.prototype.resetZoom = function() {
+ var dirty = false, dirtyX = false, dirtyY = false;
+ if (this.dateWindow_ !== null) {
+ dirty = true;
+ dirtyX = true;
+ }
+
+ for (var i = 0; i < this.axes_.length; i++) {
+ if (typeof(this.axes_[i].valueWindow) !== 'undefined' && this.axes_[i].valueWindow !== null) {
+ dirty = true;
+ dirtyY = true;
+ }
+ }
+
+ // Clear any selection, since it's likely to be drawn in the wrong place.
+ this.clearSelection();
+
+ if (dirty) {
+ this.zoomed_x_ = false;
+ this.zoomed_y_ = false;
+
+ var minDate = this.rawData_[0][0];
+ var maxDate = this.rawData_[this.rawData_.length - 1][0];
+
+ // With only one frame, don't bother calculating extreme ranges.
+ // TODO(danvk): merge this block w/ the code below.
+ if (!this.attr_("animatedZooms")) {
+ this.dateWindow_ = null;
+ for (i = 0; i < this.axes_.length; i++) {
+ if (this.axes_[i].valueWindow !== null) {
+ delete this.axes_[i].valueWindow;
+ }
+ }
+ this.drawGraph_();
+ if (this.attr_("zoomCallback")) {
+ this.attr_("zoomCallback")(minDate, maxDate, this.yAxisRanges());
+ }
+ return;
+ }
+
+ var oldWindow=null, newWindow=null, oldValueRanges=null, newValueRanges=null;
+ if (dirtyX) {
+ oldWindow = this.xAxisRange();
+ newWindow = [minDate, maxDate];
+ }
+
+ if (dirtyY) {
+ oldValueRanges = this.yAxisRanges();
+ // TODO(danvk): this is pretty inefficient
+ var packed = this.gatherDatasets_(this.rolledSeries_, null);
+ var extremes = packed.extremes;
+
+ // this has the side-effect of modifying this.axes_.
+ // this doesn't make much sense in this context, but it's convenient (we
+ // need this.axes_[*].extremeValues) and not harmful since we'll be
+ // calling drawGraph_ shortly, which clobbers these values.
+ this.computeYAxisRanges_(extremes);
+
+ newValueRanges = [];
+ for (i = 0; i < this.axes_.length; i++) {
+ var axis = this.axes_[i];
+ newValueRanges.push((axis.valueRange !== null &&
+ axis.valueRange !== undefined) ?
+ axis.valueRange : axis.extremeRange);
+ }
+ }
+
+ var that = this;
+ this.doAnimatedZoom(oldWindow, newWindow, oldValueRanges, newValueRanges,
+ function() {
+ that.dateWindow_ = null;
+ for (var i = 0; i < that.axes_.length; i++) {
+ if (that.axes_[i].valueWindow !== null) {
+ delete that.axes_[i].valueWindow;
+ }
+ }
+ if (that.attr_("zoomCallback")) {
+ that.attr_("zoomCallback")(minDate, maxDate, that.yAxisRanges());
+ }
+ });
+ }
+};
+
+/**
+ * Combined animation logic for all zoom functions.
+ * either the x parameters or y parameters may be null.
+ * @private
+ */
+Dygraph.prototype.doAnimatedZoom = function(oldXRange, newXRange, oldYRanges, newYRanges, callback) {
+ var steps = this.attr_("animatedZooms") ? Dygraph.ANIMATION_STEPS : 1;
+
+ var windows = [];
+ var valueRanges = [];
+ var step, frac;
+
+ if (oldXRange !== null && newXRange !== null) {
+ for (step = 1; step <= steps; step++) {
+ frac = Dygraph.zoomAnimationFunction(step, steps);
+ windows[step-1] = [oldXRange[0]*(1-frac) + frac*newXRange[0],
+ oldXRange[1]*(1-frac) + frac*newXRange[1]];
+ }
+ }
+
+ if (oldYRanges !== null && newYRanges !== null) {
+ for (step = 1; step <= steps; step++) {
+ frac = Dygraph.zoomAnimationFunction(step, steps);
+ var thisRange = [];
+ for (var j = 0; j < this.axes_.length; j++) {
+ thisRange.push([oldYRanges[j][0]*(1-frac) + frac*newYRanges[j][0],
+ oldYRanges[j][1]*(1-frac) + frac*newYRanges[j][1]]);
+ }
+ valueRanges[step-1] = thisRange;
+ }
+ }
+
+ var that = this;
+ Dygraph.repeatAndCleanup(function(step) {
+ if (valueRanges.length) {
+ for (var i = 0; i < that.axes_.length; i++) {
+ var w = valueRanges[step][i];
+ that.axes_[i].valueWindow = [w[0], w[1]];
+ }
+ }
+ if (windows.length) {
+ that.dateWindow_ = windows[step];
+ }
+ that.drawGraph_();
+ }, steps, Dygraph.ANIMATION_DURATION / steps, callback);
+};
+
+/**
+ * Get the current graph's area object.
+ *
+ * Returns: {x, y, w, h}
+ */
+Dygraph.prototype.getArea = function() {
+ return this.plotter_.area;
+};
+
+/**
+ * Convert a mouse event to DOM coordinates relative to the graph origin.
+ *
+ * Returns a two-element array: [X, Y].
+ */
+Dygraph.prototype.eventToDomCoords = function(event) {
+ if (event.offsetX && event.offsetY) {
+ return [ event.offsetX, event.offsetY ];
+ } else {
+ var canvasx = Dygraph.pageX(event) - Dygraph.findPosX(this.mouseEventElement_);
+ var canvasy = Dygraph.pageY(event) - Dygraph.findPosY(this.mouseEventElement_);
+ return [canvasx, canvasy];
+ }
+};
+
+/**
+ * Given a canvas X coordinate, find the closest row.
+ * @param {Number} domX graph-relative DOM X coordinate
+ * Returns: row number, integer
+ * @private
+ */
+Dygraph.prototype.findClosestRow = function(domX) {
+ var minDistX = Infinity;
+ var closestRow = -1;
+ var sets = this.layout_.points;
+ for (var i = 0; i < sets.length; i++) {
+ var points = sets[i];
+ var len = points.length;
+ for (var j = 0; j < len; j++) {
+ var point = points[j];
+ if (!Dygraph.isValidPoint(point, true)) continue;
+ var dist = Math.abs(point.canvasx - domX);
+ if (dist < minDistX) {
+ minDistX = dist;
+ closestRow = point.idx;
+ }
+ }
+ }
+
+ return closestRow;
+};
+
+/**
+ * Given canvas X,Y coordinates, find the closest point.
+ *
+ * This finds the individual data point across all visible series
+ * that's closest to the supplied DOM coordinates using the standard
+ * Euclidean X,Y distance.
+ *
+ * @param {Number} domX graph-relative DOM X coordinate
+ * @param {Number} domY graph-relative DOM Y coordinate
+ * Returns: {row, seriesName, point}
+ * @private
+ */
+Dygraph.prototype.findClosestPoint = function(domX, domY) {
+ var minDist = Infinity;
+ var dist, dx, dy, point, closestPoint, closestSeries, closestRow;
+ for ( var setIdx = this.layout_.points.length - 1 ; setIdx >= 0 ; --setIdx ) {
+ var points = this.layout_.points[setIdx];
+ for (var i = 0; i < points.length; ++i) {
+ point = points[i];
+ if (!Dygraph.isValidPoint(point)) continue;
+ dx = point.canvasx - domX;
+ dy = point.canvasy - domY;
+ dist = dx * dx + dy * dy;
+ if (dist < minDist) {
+ minDist = dist;
+ closestPoint = point;
+ closestSeries = setIdx;
+ closestRow = point.idx;
+ }
+ }
+ }
+ var name = this.layout_.setNames[closestSeries];
+ return {
+ row: closestRow,
+ seriesName: name,
+ point: closestPoint
+ };
+};
+
+/**
+ * Given canvas X,Y coordinates, find the touched area in a stacked graph.
+ *
+ * This first finds the X data point closest to the supplied DOM X coordinate,
+ * then finds the series which puts the Y coordinate on top of its filled area,
+ * using linear interpolation between adjacent point pairs.
+ *
+ * @param {Number} domX graph-relative DOM X coordinate
+ * @param {Number} domY graph-relative DOM Y coordinate
+ * Returns: {row, seriesName, point}
+ * @private
+ */
+Dygraph.prototype.findStackedPoint = function(domX, domY) {
+ var row = this.findClosestRow(domX);
+ var closestPoint, closestSeries;
+ for (var setIdx = 0; setIdx < this.layout_.points.length; ++setIdx) {
+ var boundary = this.getLeftBoundary_(setIdx);
+ var rowIdx = row - boundary;
+ var points = this.layout_.points[setIdx];
+ if (rowIdx >= points.length) continue;
+ var p1 = points[rowIdx];
+ if (!Dygraph.isValidPoint(p1)) continue;
+ var py = p1.canvasy;
+ if (domX > p1.canvasx && rowIdx + 1 < points.length) {
+ // interpolate series Y value using next point
+ var p2 = points[rowIdx + 1];
+ if (Dygraph.isValidPoint(p2)) {
+ var dx = p2.canvasx - p1.canvasx;
+ if (dx > 0) {
+ var r = (domX - p1.canvasx) / dx;
+ py += r * (p2.canvasy - p1.canvasy);
+ }
+ }
+ } else if (domX < p1.canvasx && rowIdx > 0) {
+ // interpolate series Y value using previous point
+ var p0 = points[rowIdx - 1];
+ if (Dygraph.isValidPoint(p0)) {
+ var dx = p1.canvasx - p0.canvasx;
+ if (dx > 0) {
+ var r = (p1.canvasx - domX) / dx;
+ py += r * (p0.canvasy - p1.canvasy);
+ }
+ }
+ }
+ // Stop if the point (domX, py) is above this series' upper edge
+ if (setIdx === 0 || py < domY) {
+ closestPoint = p1;
+ closestSeries = setIdx;
+ }
+ }
+ var name = this.layout_.setNames[closestSeries];
+ return {
+ row: row,
+ seriesName: name,
+ point: closestPoint
+ };
+};
+
+/**
+ * When the mouse moves in the canvas, display information about a nearby data
+ * point and draw dots over those points in the data series. This function
+ * takes care of cleanup of previously-drawn dots.
+ * @param {Object} event The mousemove event from the browser.
+ * @private
+ */
+Dygraph.prototype.mouseMove_ = function(event) {
+ // This prevents JS errors when mousing over the canvas before data loads.
+ var points = this.layout_.points;
+ if (points === undefined || points === null) return;
+
+ var canvasCoords = this.eventToDomCoords(event);
+ var canvasx = canvasCoords[0];
+ var canvasy = canvasCoords[1];
+
+ var highlightSeriesOpts = this.attr_("highlightSeriesOpts");
+ var selectionChanged = false;
+ if (highlightSeriesOpts && !this.isSeriesLocked()) {
+ var closest;
+ if (this.attr_("stackedGraph")) {
+ closest = this.findStackedPoint(canvasx, canvasy);
+ } else {
+ closest = this.findClosestPoint(canvasx, canvasy);
+ }
+ selectionChanged = this.setSelection(closest.row, closest.seriesName);
+ } else {
+ var idx = this.findClosestRow(canvasx);
+ selectionChanged = this.setSelection(idx);
+ }
+
+ var callback = this.attr_("highlightCallback");
+ if (callback && selectionChanged) {
+ callback(event,
+ this.lastx_,
+ this.selPoints_,
+ this.lastRow_,
+ this.highlightSet_);
+ }
+};
+
+/**
+ * Fetch left offset from the specified set index or if not passed, the
+ * first defined boundaryIds record (see bug #236).
+ * @private
+ */
+Dygraph.prototype.getLeftBoundary_ = function(setIdx) {
+ if (this.boundaryIds_[setIdx]) {
+ return this.boundaryIds_[setIdx][0];
+ } else {
+ for (var i = 0; i < this.boundaryIds_.length; i++) {
+ if (this.boundaryIds_[i] !== undefined) {
+ return this.boundaryIds_[i][0];
+ }
+ }
+ return 0;
+ }
+};
+
+Dygraph.prototype.animateSelection_ = function(direction) {
+ var totalSteps = 10;
+ var millis = 30;
+ if (this.fadeLevel === undefined) this.fadeLevel = 0;
+ if (this.animateId === undefined) this.animateId = 0;
+ var start = this.fadeLevel;
+ var steps = direction < 0 ? start : totalSteps - start;
+ if (steps <= 0) {
+ if (this.fadeLevel) {
+ this.updateSelection_(1.0);
+ }
+ return;
+ }
+
+ var thisId = ++this.animateId;
+ var that = this;
+ Dygraph.repeatAndCleanup(
+ function(n) {
+ // ignore simultaneous animations
+ if (that.animateId != thisId) return;
+
+ that.fadeLevel += direction;
+ if (that.fadeLevel === 0) {
+ that.clearSelection();
+ } else {
+ that.updateSelection_(that.fadeLevel / totalSteps);
+ }
+ },
+ steps, millis, function() {});
+};
+
+/**
+ * Draw dots over the selectied points in the data series. This function
+ * takes care of cleanup of previously-drawn dots.
+ * @private
+ */
+Dygraph.prototype.updateSelection_ = function(opt_animFraction) {
+ /*var defaultPrevented = */
+ this.cascadeEvents_('select', {
+ selectedX: this.lastx_,
+ selectedPoints: this.selPoints_
+ });
+ // TODO(danvk): use defaultPrevented here?
+
+ // Clear the previously drawn vertical, if there is one
+ var i;
+ var ctx = this.canvas_ctx_;
+ if (this.attr_('highlightSeriesOpts')) {
+ ctx.clearRect(0, 0, this.width_, this.height_);
+ var alpha = 1.0 - this.attr_('highlightSeriesBackgroundAlpha');
+ if (alpha) {
+ // Activating background fade includes an animation effect for a gradual
+ // fade. TODO(klausw): make this independently configurable if it causes
+ // issues? Use a shared preference to control animations?
+ var animateBackgroundFade = true;
+ if (animateBackgroundFade) {
+ if (opt_animFraction === undefined) {
+ // start a new animation
+ this.animateSelection_(1);
+ return;
+ }
+ alpha *= opt_animFraction;
+ }
+ ctx.fillStyle = 'rgba(255,255,255,' + alpha + ')';
+ ctx.fillRect(0, 0, this.width_, this.height_);
+ }
+
+ // Redraw only the highlighted series in the interactive canvas (not the
+ // static plot canvas, which is where series are usually drawn).
+ this.plotter_._renderLineChart(this.highlightSet_, ctx);
+ } else if (this.previousVerticalX_ >= 0) {
+ // Determine the maximum highlight circle size.
+ var maxCircleSize = 0;
+ var labels = this.attr_('labels');
+ for (i = 1; i < labels.length; i++) {
+ var r = this.attr_('highlightCircleSize', labels[i]);
+ if (r > maxCircleSize) maxCircleSize = r;
+ }
+ var px = this.previousVerticalX_;
+ ctx.clearRect(px - maxCircleSize - 1, 0,
+ 2 * maxCircleSize + 2, this.height_);
+ }
+
+ if (this.isUsingExcanvas_ && this.currentZoomRectArgs_) {
+ Dygraph.prototype.drawZoomRect_.apply(this, this.currentZoomRectArgs_);
+ }
+
+ if (this.selPoints_.length > 0) {
+ // Draw colored circles over the center of each selected point
+ var canvasx = this.selPoints_[0].canvasx;
+ ctx.save();
+ for (i = 0; i < this.selPoints_.length; i++) {
+ var pt = this.selPoints_[i];
+ if (!Dygraph.isOK(pt.canvasy)) continue;
+
+ var circleSize = this.attr_('highlightCircleSize', pt.name);
+ var callback = this.attr_("drawHighlightPointCallback", pt.name);
+ var color = this.plotter_.colors[pt.name];
+ if (!callback) {
+ callback = Dygraph.Circles.DEFAULT;
+ }
+ ctx.lineWidth = this.attr_('strokeWidth', pt.name);
+ ctx.strokeStyle = color;
+ ctx.fillStyle = color;
+ callback(this.g, pt.name, ctx, canvasx, pt.canvasy,
+ color, circleSize, pt.idx);
+ }
+ ctx.restore();
+
+ this.previousVerticalX_ = canvasx;
+ }
+};
+
+/**
+ * Manually set the selected points and display information about them in the
+ * legend. The selection can be cleared using clearSelection() and queried
+ * using getSelection().
+ * @param { Integer } row number that should be highlighted (i.e. appear with
+ * hover dots on the chart). Set to false to clear any selection.
+ * @param { seriesName } optional series name to highlight that series with the
+ * the highlightSeriesOpts setting.
+ * @param { locked } optional If true, keep seriesName selected when mousing
+ * over the graph, disabling closest-series highlighting. Call clearSelection()
+ * to unlock it.
+ */
+Dygraph.prototype.setSelection = function(row, opt_seriesName, opt_locked) {
+ // Extract the points we've selected
+ this.selPoints_ = [];
+
+ var changed = false;
+ if (row !== false && row >= 0) {
+ if (row != this.lastRow_) changed = true;
+ this.lastRow_ = row;
+ for (var setIdx = 0; setIdx < this.layout_.points.length; ++setIdx) {
+ var points = this.layout_.points[setIdx];
+ var setRow = row - this.getLeftBoundary_(setIdx);
+ if (setRow < points.length) {
+ var point = points[setRow];
+ if (point.yval !== null) this.selPoints_.push(point);
+ }
+ }
+ } else {
+ if (this.lastRow_ >= 0) changed = true;
+ this.lastRow_ = -1;
+ }
+
+ if (this.selPoints_.length) {
+ this.lastx_ = this.selPoints_[0].xval;
+ } else {
+ this.lastx_ = -1;
+ }
+
+ if (opt_seriesName !== undefined) {
+ if (this.highlightSet_ !== opt_seriesName) changed = true;
+ this.highlightSet_ = opt_seriesName;
+ }
+
+ if (opt_locked !== undefined) {
+ this.lockedSet_ = opt_locked;
+ }
+
+ if (changed) {
+ this.updateSelection_(undefined);
+ }
+ return changed;
+};
+
+/**
+ * The mouse has left the canvas. Clear out whatever artifacts remain
+ * @param {Object} event the mouseout event from the browser.
+ * @private
+ */
+Dygraph.prototype.mouseOut_ = function(event) {
+ if (this.attr_("unhighlightCallback")) {
+ this.attr_("unhighlightCallback")(event);
+ }
+
+ if (this.attr_("hideOverlayOnMouseOut") && !this.lockedSet_) {
+ this.clearSelection();
+ }
+};
+
+/**
+ * Clears the current selection (i.e. points that were highlighted by moving
+ * the mouse over the chart).
+ */
+Dygraph.prototype.clearSelection = function() {
+ this.cascadeEvents_('deselect', {});
+
+ this.lockedSet_ = false;
+ // Get rid of the overlay data
+ if (this.fadeLevel) {
+ this.animateSelection_(-1);
+ return;
+ }
+ this.canvas_ctx_.clearRect(0, 0, this.width_, this.height_);
+ this.fadeLevel = 0;
+ this.selPoints_ = [];
+ this.lastx_ = -1;
+ this.lastRow_ = -1;
+ this.highlightSet_ = null;
+};
+
+/**
+ * Returns the number of the currently selected row. To get data for this row,
+ * you can use the getValue method.
+ * @return { Integer } row number, or -1 if nothing is selected
+ */
+Dygraph.prototype.getSelection = function() {
+ if (!this.selPoints_ || this.selPoints_.length < 1) {
+ return -1;
+ }
+
+ for (var setIdx = 0; setIdx < this.layout_.points.length; setIdx++) {
+ var points = this.layout_.points[setIdx];
+ for (var row = 0; row < points.length; row++) {
+ if (points[row].x == this.selPoints_[0].x) {
+ return points[row].idx;
+ }
+ }
+ }
+ return -1;
+};
+
+/**
+ * Returns the name of the currently-highlighted series.
+ * Only available when the highlightSeriesOpts option is in use.
+ */
+Dygraph.prototype.getHighlightSeries = function() {
+ return this.highlightSet_;
+};
+
+/**
+ * Returns true if the currently-highlighted series was locked
+ * via setSelection(..., seriesName, true).
+ */
+Dygraph.prototype.isSeriesLocked = function() {
+ return this.lockedSet_;
+};
+
+/**
+ * Fires when there's data available to be graphed.
+ * @param {String} data Raw CSV data to be plotted
+ * @private
+ */
+Dygraph.prototype.loadedEvent_ = function(data) {
+ this.rawData_ = this.parseCSV_(data);
+ this.predraw_();
+};
+
+/**
+ * Add ticks on the x-axis representing years, months, quarters, weeks, or days
+ * @private
+ */
+Dygraph.prototype.addXTicks_ = function() {
+ // Determine the correct ticks scale on the x-axis: quarterly, monthly, ...
+ var range;
+ if (this.dateWindow_) {
+ range = [this.dateWindow_[0], this.dateWindow_[1]];
+ } else {
+ range = this.xAxisExtremes();
+ }
+
+ var xAxisOptionsView = this.optionsViewForAxis_('x');
+ var xTicks = xAxisOptionsView('ticker')(
+ range[0],
+ range[1],
+ this.width_, // TODO(danvk): should be area.width
+ xAxisOptionsView,
+ this);
+ // var msg = 'ticker(' + range[0] + ', ' + range[1] + ', ' + this.width_ + ', ' + this.attr_('pixelsPerXLabel') + ') -> ' + JSON.stringify(xTicks);
+ // console.log(msg);
+ this.layout_.setXTicks(xTicks);
+};
+
+/**
+ * @private
+ * Computes the range of the data series (including confidence intervals).
+ * @param { [Array] } series either [ [x1, y1], [x2, y2], ... ] or
+ * [ [x1, [y1, dev_low, dev_high]], [x2, [y2, dev_low, dev_high]], ...
+ * @return [low, high]
+ */
+Dygraph.prototype.extremeValues_ = function(series) {
+ var minY = null, maxY = null, j, y;
+
+ var bars = this.attr_("errorBars") || this.attr_("customBars");
+ if (bars) {
+ // With custom bars, maxY is the max of the high values.
+ for (j = 0; j < series.length; j++) {
+ y = series[j][1][0];
+ if (y === null || isNaN(y)) continue;
+ var low = y - series[j][1][1];
+ var high = y + series[j][1][2];
+ if (low > y) low = y; // this can happen with custom bars,
+ if (high < y) high = y; // e.g. in tests/custom-bars.html
+ if (maxY === null || high > maxY) {
+ maxY = high;
+ }
+ if (minY === null || low < minY) {
+ minY = low;
+ }
+ }
+ } else {
+ for (j = 0; j < series.length; j++) {
+ y = series[j][1];
+ if (y === null || isNaN(y)) continue;
+ if (maxY === null || y > maxY) {
+ maxY = y;
+ }
+ if (minY === null || y < minY) {
+ minY = y;
+ }
+ }
+ }
+
+ return [minY, maxY];
+};
+
+/**
+ * @private
+ * This function is called once when the chart's data is changed or the options
+ * dictionary is updated. It is _not_ called when the user pans or zooms. The
+ * idea is that values derived from the chart's data can be computed here,
+ * rather than every time the chart is drawn. This includes things like the
+ * number of axes, rolling averages, etc.
+ */
+Dygraph.prototype.predraw_ = function() {
+ var start = new Date();
+
+ this.layout_.computePlotArea();
+
+ // TODO(danvk): move more computations out of drawGraph_ and into here.
+ this.computeYAxes_();
+
+ // Create a new plotter.
+ if (this.plotter_) {
+ this.cascadeEvents_('clearChart');
+ this.plotter_.clear();
+ }
+
+ if (!this.is_initial_draw_) {
+ this.canvas_ctx_.restore();
+ this.hidden_ctx_.restore();
+ }
+
+ this.canvas_ctx_.save();
+ this.hidden_ctx_.save();
+
+ this.plotter_ = new DygraphCanvasRenderer(this,
+ this.hidden_,
+ this.hidden_ctx_,
+ this.layout_);
+
+ // The roller sits in the bottom left corner of the chart. We don't know where
+ // this will be until the options are available, so it's positioned here.
+ this.createRollInterface_();
+
+ this.cascadeEvents_('predraw');
+
+ // Convert the raw data (a 2D array) into the internal format and compute
+ // rolling averages.
+ this.rolledSeries_ = [null]; // x-axis is the first series and it's special
+ for (var i = 1; i < this.numColumns(); i++) {
+ // var logScale = this.attr_('logscale', i); // TODO(klausw): this looks wrong // konigsberg thinks so too.
+ var logScale = this.attr_('logscale');
+ var series = this.extractSeries_(this.rawData_, i, logScale);
+ series = this.rollingAverage(series, this.rollPeriod_);
+ this.rolledSeries_.push(series);
+ }
+
+ // If the data or options have changed, then we'd better redraw.
+ this.drawGraph_();
+
+ // This is used to determine whether to do various animations.
+ var end = new Date();
+ this.drawingTimeMs_ = (end - start);
+};
+
+/**
+ * Point structure.
+ *
+ * xval_* and yval_* are the original unscaled data values,
+ * while x_* and y_* are scaled to the range (0.0-1.0) for plotting.
+ * yval_stacked is the cumulative Y value used for stacking graphs,
+ * and bottom/top/minus/plus are used for error bar graphs.
+ *
+ * @typedef {{
+ * idx: number,
+ * name: string,
+ * x: ?number,
+ * xval: ?number,
+ * y_bottom: ?number,
+ * y: ?number,
+ * y_stacked: ?number,
+ * y_top: ?number,
+ * yval_minus: ?number,
+ * yval: ?number,
+ * yval_plus: ?number,
+ * yval_stacked
+ * }}
+ */
+Dygraph.PointType = undefined;
+
+// TODO(bhs): these loops are a hot-spot for high-point-count charts. In fact,
+// on chrome+linux, they are 6 times more expensive than iterating through the
+// points and drawing the lines. The brunt of the cost comes from allocating
+// the |point| structures.
+/**
+ * Converts a series to a Point array.
+ *
+ * @param {Array.<Array.<(?number|Array<?number>)>} series Array where
+ * series[row] = [x,y] or [x, [y, err]] or [x, [y, yplus, yminus]].
+ * @param {boolean} bars True if error bars or custom bars are being drawn.
+ * @param {string} setName Name of the series.
+ * @param {number} boundaryIdStart Index offset of the first point, equal to
+ * the number of skipped points left of the date window minimum (if any).
+ * @return {Array.<Dygraph.PointType>} List of points for this series.
+ */
+Dygraph.seriesToPoints_ = function(series, bars, setName, boundaryIdStart) {
+ var points = [];
+ for (var i = 0; i < series.length; ++i) {
+ var item = series[i];
+ var yraw = bars ? item[1][0] : item[1];
+ var yval = yraw === null ? null : DygraphLayout.parseFloat_(yraw);
+ var point = {
+ x: NaN,
+ y: NaN,
+ xval: DygraphLayout.parseFloat_(item[0]),
+ yval: yval,
+ name: setName, // TODO(danvk): is this really necessary?
+ idx: i + boundaryIdStart
+ };
+
+ if (bars) {
+ point.y_top = NaN;
+ point.y_bottom = NaN;
+ point.yval_minus = DygraphLayout.parseFloat_(item[1][1]);
+ point.yval_plus = DygraphLayout.parseFloat_(item[1][2]);
+ }
+ points.push(point);
+ }
+ return points;
+};
+
+
+/**
+ * Calculates point stacking for stackedGraph=true.
+ *
+ * For stacking purposes, interpolate or extend neighboring data across
+ * NaN values based on stackedGraphNaNFill settings. This is for display
+ * only, the underlying data value as shown in the legend remains NaN.
+ *
+ * @param {Array.<Dygraph.PointType>} points Point array for a single series.
+ * Updates each Point's yval_stacked property.
+ * @param {Array.<number>} cumulativeYval Accumulated top-of-graph stacked Y
+ * values for the series seen so far. Index is the row number. Updated
+ * based on the current series's values.
+ * @param {Array.<number>} seriesExtremes Min and max values, updated
+ * to reflect the stacked values.
+ * @param {string} fillMethod Interpolation method, one of 'all', 'inside', or
+ * 'none'.
+ */
+Dygraph.stackPoints_ = function(
+ points, cumulativeYval, seriesExtremes, fillMethod) {
+ var lastXval = null;
+ var prevPoint = null;
+ var nextPoint = null;
+ var nextPointIdx = -1;
+
+ // Find the next stackable point starting from the given index.
+ var updateNextPoint = function(idx) {
+ // If we've previously found a non-NaN point and haven't gone past it yet,
+ // just use that.
+ if (nextPointIdx >= idx) return;
+
+ // We haven't found a non-NaN point yet or have moved past it,
+ // look towards the right to find a non-NaN point.
+ for (var j = idx; j < points.length; ++j) {
+ // Clear out a previously-found point (if any) since it's no longer
+ // valid, we shouldn't use it for interpolation anymore.
+ nextPoint = null;
+ if (!isNaN(points[j].yval) && points[j].yval !== null) {
+ nextPointIdx = j;
+ nextPoint = points[j];
+ break;
+ }
+ }
+ };
+
+ for (var i = 0; i < points.length; ++i) {
+ var point = points[i];
+ var xval = point.xval;
+ if (cumulativeYval[xval] === undefined) {
+ cumulativeYval[xval] = 0;
+ }
+
+ var actualYval = point.yval;
+ if (isNaN(actualYval) || actualYval === null) {
+ // Interpolate/extend for stacking purposes if possible.
+ updateNextPoint(i);
+ if (prevPoint && nextPoint && fillMethod != 'none') {
+ // Use linear interpolation between prevPoint and nextPoint.
+ actualYval = prevPoint.yval + (nextPoint.yval - prevPoint.yval) *
+ ((xval - prevPoint.xval) / (nextPoint.xval - prevPoint.xval));
+ } else if (prevPoint && fillMethod == 'all') {
+ actualYval = prevPoint.yval;
+ } else if (nextPoint && fillMethod == 'all') {
+ actualYval = nextPoint.yval;
+ } else {
+ actualYval = 0;
+ }
+ } else {
+ prevPoint = point;
+ }
+
+ var stackedYval = cumulativeYval[xval];
+ if (lastXval != xval) {
+ // If an x-value is repeated, we ignore the duplicates.
+ stackedYval += actualYval;
+ cumulativeYval[xval] = stackedYval;
+ }
+ lastXval = xval;
+
+ point.yval_stacked = stackedYval;
+
+ if (stackedYval > seriesExtremes[1]) {
+ seriesExtremes[1] = stackedYval;
+ }
+ if (stackedYval < seriesExtremes[0]) {
+ seriesExtremes[0] = stackedYval;
+ }
+ }
+};
+
+
+/**
+ * Loop over all fields and create datasets, calculating extreme y-values for
+ * each series and extreme x-indices as we go.
+ *
+ * dateWindow is passed in as an explicit parameter so that we can compute
+ * extreme values "speculatively", i.e. without actually setting state on the
+ * dygraph.
+ *
+ * @param {Array.<Array.<Array.<(number|Array<number>)>>} rolledSeries, where
+ * rolledSeries[seriesIndex][row] = raw point, where
+ * seriesIndex is the column number starting with 1, and
+ * rawPoint is [x,y] or [x, [y, err]] or [x, [y, yminus, yplus]].
+ * @param {?Array.<number>} dateWindow [xmin, xmax] pair, or null.
+ * @return {{
+ * points: Array.<Array.<Dygraph.PointType>>,
+ * seriesExtremes: Array.<Array.<number>>,
+ * boundaryIds: Array.<number>}}
+ * @private
+ */
+Dygraph.prototype.gatherDatasets_ = function(rolledSeries, dateWindow) {
+ var boundaryIds = [];
+ var points = [];
+ var cumulativeYval = []; // For stacked series.
+ var extremes = {}; // series name -> [low, high]
+ var i, k;
+ var errorBars = this.attr_("errorBars");
+ var customBars = this.attr_("customBars");
+ var bars = errorBars || customBars;
+ var isValueNull = function(sample) {
+ if (!bars) {
+ return sample[1] === null;
+ } else {
+ return customBars ? sample[1][1] === null :
+ errorBars ? sample[1][0] === null : false;
+ }
+ };
+
+ // Loop over the fields (series). Go from the last to the first,
+ // because if they're stacked that's how we accumulate the values.
+ var num_series = rolledSeries.length - 1;
+ var series;
+ for (i = num_series; i >= 1; i--) {
+ if (!this.visibility()[i - 1]) continue;
+
+ // Prune down to the desired range, if necessary (for zooming)
+ // Because there can be lines going to points outside of the visible area,
+ // we actually prune to visible points, plus one on either side.
+ if (dateWindow) {
+ series = rolledSeries[i];
+ var low = dateWindow[0];
+ var high = dateWindow[1];
+
+ // TODO(danvk): do binary search instead of linear search.
+ // TODO(danvk): pass firstIdx and lastIdx directly to the renderer.
+ var firstIdx = null, lastIdx = null;
+ for (k = 0; k < series.length; k++) {
+ if (series[k][0] >= low && firstIdx === null) {
+ firstIdx = k;
+ }
+ if (series[k][0] <= high) {
+ lastIdx = k;
+ }
+ }
+
+ if (firstIdx === null) firstIdx = 0;
+ var correctedFirstIdx = firstIdx;
+ var isInvalidValue = true;
+ while (isInvalidValue && correctedFirstIdx > 0) {
+ correctedFirstIdx--;
+ isInvalidValue = isValueNull(series[correctedFirstIdx]);
+ }
+
+ if (lastIdx === null) lastIdx = series.length - 1;
+ var correctedLastIdx = lastIdx;
+ isInvalidValue = true;
+ while (isInvalidValue && correctedLastIdx < series.length - 1) {
+ correctedLastIdx++;
+ isInvalidValue = isValueNull(series[correctedLastIdx]);
+ }
+
+
+ if (correctedFirstIdx!==firstIdx) {
+ firstIdx = correctedFirstIdx;
+ }
+ if (correctedLastIdx !== lastIdx) {
+ lastIdx = correctedLastIdx;
+ }
+
+ boundaryIds[i-1] = [firstIdx, lastIdx];
+
+ // .slice's end is exclusive, we want to include lastIdx.
+ series = series.slice(firstIdx, lastIdx + 1);
+ } else {
+ series = rolledSeries[i];
+ boundaryIds[i-1] = [0, series.length-1];
+ }
+
+ var seriesName = this.attr_("labels")[i];
+ var seriesExtremes = this.extremeValues_(series);
+
+ var seriesPoints = Dygraph.seriesToPoints_(
+ series, bars, seriesName, boundaryIds[i-1][0]);
+
+ if (this.attr_("stackedGraph")) {
+ Dygraph.stackPoints_(seriesPoints, cumulativeYval, seriesExtremes,
+ this.attr_("stackedGraphNaNFill"));
+ }
+
+ extremes[seriesName] = seriesExtremes;
+ points[i] = seriesPoints;
+ }
+
+ return { points: points, extremes: extremes, boundaryIds: boundaryIds };
+};
+
+/**
+ * Update the graph with new data. This method is called when the viewing area
+ * has changed. If the underlying data or options have changed, predraw_ will
+ * be called before drawGraph_ is called.
+ *
+ * @private
+ */
+Dygraph.prototype.drawGraph_ = function() {
+ var start = new Date();
+
+ // This is used to set the second parameter to drawCallback, below.
+ var is_initial_draw = this.is_initial_draw_;
+ this.is_initial_draw_ = false;
+
+ this.layout_.removeAllDatasets();
+ this.setColors_();
+ this.attrs_.pointSize = 0.5 * this.attr_('highlightCircleSize');
+
+ var packed = this.gatherDatasets_(this.rolledSeries_, this.dateWindow_);
+ var points = packed.points;
+ var extremes = packed.extremes;
+ this.boundaryIds_ = packed.boundaryIds;
+
+ this.setIndexByName_ = {};
+ var labels = this.attr_("labels");
+ if (labels.length > 0) {
+ this.setIndexByName_[labels[0]] = 0;
+ }
+ var dataIdx = 0;
+ for (var i = 1; i < points.length; i++) {
+ this.setIndexByName_[labels[i]] = i;
+ if (!this.visibility()[i - 1]) continue;
+ this.layout_.addDataset(labels[i], points[i]);
+ this.datasetIndex_[i] = dataIdx++;
+ }
+
+ this.computeYAxisRanges_(extremes);
+ this.layout_.setYAxes(this.axes_);
+
+ this.addXTicks_();
+
+ // Save the X axis zoomed status as the updateOptions call will tend to set it erroneously
+ var tmp_zoomed_x = this.zoomed_x_;
+ // Tell PlotKit to use this new data and render itself
+ this.zoomed_x_ = tmp_zoomed_x;
+ this.layout_.evaluate();
+ this.renderGraph_(is_initial_draw);
+
+ if (this.attr_("timingName")) {
+ var end = new Date();
+ Dygraph.info(this.attr_("timingName") + " - drawGraph: " + (end - start) + "ms");
+ }
+};
+
+/**
+ * This does the work of drawing the chart. It assumes that the layout and axis
+ * scales have already been set (e.g. by predraw_).
+ *
+ * @private
+ */
+Dygraph.prototype.renderGraph_ = function(is_initial_draw) {
+ this.cascadeEvents_('clearChart');
+ this.plotter_.clear();
+
+ if (this.attr_('underlayCallback')) {
+ // NOTE: we pass the dygraph object to this callback twice to avoid breaking
+ // users who expect a deprecated form of this callback.
+ this.attr_('underlayCallback')(
+ this.hidden_ctx_, this.layout_.getPlotArea(), this, this);
+ }
+
+ var e = {
+ canvas: this.hidden_,
+ drawingContext: this.hidden_ctx_
+ };
+ this.cascadeEvents_('willDrawChart', e);
+ this.plotter_.render();
+ this.cascadeEvents_('didDrawChart', e);
+ this.lastRow_ = -1; // because plugins/legend.js clears the legend
+
+ // TODO(danvk): is this a performance bottleneck when panning?
+ // The interaction canvas should already be empty in that situation.
+ this.canvas_.getContext('2d').clearRect(0, 0, this.canvas_.width,
+ this.canvas_.height);
+
+ if (this.attr_("drawCallback") !== null) {
+ this.attr_("drawCallback")(this, is_initial_draw);
+ }
+};
+
+/**
+ * @private
+ * Determine properties of the y-axes which are independent of the data
+ * currently being displayed. This includes things like the number of axes and
+ * the style of the axes. It does not include the range of each axis and its
+ * tick marks.
+ * This fills in this.axes_.
+ * axes_ = [ { options } ]
+ * indices are into the axes_ array.
+ */
+Dygraph.prototype.computeYAxes_ = function() {
+ // Preserve valueWindow settings if they exist, and if the user hasn't
+ // specified a new valueRange.
+ var valueWindows, axis, index, opts, v;
+ if (this.axes_ !== undefined && this.user_attrs_.hasOwnProperty("valueRange") === false) {
+ valueWindows = [];
+ for (index = 0; index < this.axes_.length; index++) {
+ valueWindows.push(this.axes_[index].valueWindow);
+ }
+ }
+
+ // this.axes_ doesn't match this.attributes_.axes_.options. It's used for
+ // data computation as well as options storage.
+ // Go through once and add all the axes.
+ this.axes_ = [];
+
+ for (axis = 0; axis < this.attributes_.numAxes(); axis++) {
+ // Add a new axis, making a copy of its per-axis options.
+ opts = { g : this };
+ Dygraph.update(opts, this.attributes_.axisOptions(axis));
+ this.axes_[axis] = opts;
+ }
+
+
+ // Copy global valueRange option over to the first axis.
+ // NOTE(konigsberg): Are these two statements necessary?
+ // I tried removing it. The automated tests pass, and manually
+ // messing with tests/zoom.html showed no trouble.
+ v = this.attr_('valueRange');
+ if (v) this.axes_[0].valueRange = v;
+
+ if (valueWindows !== undefined) {
+ // Restore valueWindow settings.
+
+ // When going from two axes back to one, we only restore
+ // one axis.
+ var idxCount = Math.min(valueWindows.length, this.axes_.length);
+
+ for (index = 0; index < idxCount; index++) {
+ this.axes_[index].valueWindow = valueWindows[index];
+ }
+ }
+
+ for (axis = 0; axis < this.axes_.length; axis++) {
+ if (axis === 0) {
+ opts = this.optionsViewForAxis_('y' + (axis ? '2' : ''));
+ v = opts("valueRange");
+ if (v) this.axes_[axis].valueRange = v;
+ } else { // To keep old behavior
+ var axes = this.user_attrs_.axes;
+ if (axes && axes.y2) {
+ v = axes.y2.valueRange;
+ if (v) this.axes_[axis].valueRange = v;
+ }
+ }
+ }
+};
+
+/**
+ * Returns the number of y-axes on the chart.
+ * @return {Number} the number of axes.
+ */
+Dygraph.prototype.numAxes = function() {
+ return this.attributes_.numAxes();
+};
+
+/**
+ * @private
+ * Returns axis properties for the given series.
+ * @param { String } setName The name of the series for which to get axis
+ * properties, e.g. 'Y1'.
+ * @return { Object } The axis properties.
+ */
+Dygraph.prototype.axisPropertiesForSeries = function(series) {
+ // TODO(danvk): handle errors.
+ return this.axes_[this.attributes_.axisForSeries(series)];
+};
+
+/**
+ * @private
+ * Determine the value range and tick marks for each axis.
+ * @param {Object} extremes A mapping from seriesName -> [low, high]
+ * This fills in the valueRange and ticks fields in each entry of this.axes_.
+ */
+Dygraph.prototype.computeYAxisRanges_ = function(extremes) {
+ var isNullUndefinedOrNaN = function(num) {
+ return isNaN(parseFloat(num));
+ };
+ var numAxes = this.attributes_.numAxes();
+ var ypadCompat, span, series, ypad;
+
+ var p_axis;
+
+ // Compute extreme values, a span and tick marks for each axis.
+ for (var i = 0; i < numAxes; i++) {
+ var axis = this.axes_[i];
+ var logscale = this.attributes_.getForAxis("logscale", i);
+ var includeZero = this.attributes_.getForAxis("includeZero", i);
+ var independentTicks = this.attributes_.getForAxis("independentTicks", i);
+ series = this.attributes_.seriesForAxis(i);
+
+ // Add some padding. This supports two Y padding operation modes:
+ //
+ // - backwards compatible (yRangePad not set):
+ // 10% padding for automatic Y ranges, but not for user-supplied
+ // ranges, and move a close-to-zero edge to zero except if
+ // avoidMinZero is set, since drawing at the edge results in
+ // invisible lines. Unfortunately lines drawn at the edge of a
+ // user-supplied range will still be invisible. If logscale is
+ // set, add a variable amount of padding at the top but
+ // none at the bottom.
+ //
+ // - new-style (yRangePad set by the user):
+ // always add the specified Y padding.
+ //
+ ypadCompat = true;
+ ypad = 0.1; // add 10%
+ if (this.attr_('yRangePad') !== null) {
+ ypadCompat = false;
+ // Convert pixel padding to ratio
+ ypad = this.attr_('yRangePad') / this.plotter_.area.h;
+ }
+
+ if (series.length === 0) {
+ // If no series are defined or visible then use a reasonable default
+ axis.extremeRange = [0, 1];
+ } else {
+ // Calculate the extremes of extremes.
+ var minY = Infinity; // extremes[series[0]][0];
+ var maxY = -Infinity; // extremes[series[0]][1];
+ var extremeMinY, extremeMaxY;
+
+ for (var j = 0; j < series.length; j++) {
+ // this skips invisible series
+ if (!extremes.hasOwnProperty(series[j])) continue;
+
+ // Only use valid extremes to stop null data series' from corrupting the scale.
+ extremeMinY = extremes[series[j]][0];
+ if (extremeMinY !== null) {
+ minY = Math.min(extremeMinY, minY);
+ }
+ extremeMaxY = extremes[series[j]][1];
+ if (extremeMaxY !== null) {
+ maxY = Math.max(extremeMaxY, maxY);
+ }
+ }
+
+ // Include zero if requested by the user.
+ if (includeZero && !logscale) {
+ if (minY > 0) minY = 0;
+ if (maxY < 0) maxY = 0;
+ }
+
+ // Ensure we have a valid scale, otherwise default to [0, 1] for safety.
+ if (minY == Infinity) minY = 0;
+ if (maxY == -Infinity) maxY = 1;
+
+ span = maxY - minY;
+ // special case: if we have no sense of scale, center on the sole value.
+ if (span === 0) {
+ if (maxY !== 0) {
+ span = Math.abs(maxY);
+ } else {
+ // ... and if the sole value is zero, use range 0-1.
+ maxY = 1;
+ span = 1;
+ }
+ }
+
+ var maxAxisY, minAxisY;
+ if (logscale) {
+ if (ypadCompat) {
+ maxAxisY = maxY + ypad * span;
+ minAxisY = minY;
+ } else {
+ var logpad = Math.exp(Math.log(span) * ypad);
+ maxAxisY = maxY * logpad;
+ minAxisY = minY / logpad;
+ }
+ } else {
+ maxAxisY = maxY + ypad * span;
+ minAxisY = minY - ypad * span;
+
+ // Backwards-compatible behavior: Move the span to start or end at zero if it's
+ // close to zero, but not if avoidMinZero is set.
+ if (ypadCompat && !this.attr_("avoidMinZero")) {
+ if (minAxisY < 0 && minY >= 0) minAxisY = 0;
+ if (maxAxisY > 0 && maxY <= 0) maxAxisY = 0;
+ }
+ }
+ axis.extremeRange = [minAxisY, maxAxisY];
+ }
+ if (axis.valueWindow) {
+ // This is only set if the user has zoomed on the y-axis. It is never set
+ // by a user. It takes precedence over axis.valueRange because, if you set
+ // valueRange, you'd still expect to be able to pan.
+ axis.computedValueRange = [axis.valueWindow[0], axis.valueWindow[1]];
+ } else if (axis.valueRange) {
+ // This is a user-set value range for this axis.
+ var y0 = isNullUndefinedOrNaN(axis.valueRange[0]) ? axis.extremeRange[0] : axis.valueRange[0];
+ var y1 = isNullUndefinedOrNaN(axis.valueRange[1]) ? axis.extremeRange[1] : axis.valueRange[1];
+ if (!ypadCompat) {
+ if (axis.logscale) {
+ var logpad = Math.exp(Math.log(span) * ypad);
+ y0 *= logpad;
+ y1 /= logpad;
+ } else {
+ span = y1 - y0;
+ y0 -= span * ypad;
+ y1 += span * ypad;
+ }
+ }
+ axis.computedValueRange = [y0, y1];
+ } else {
+ axis.computedValueRange = axis.extremeRange;
+ }
+
+
+ if (independentTicks) {
+ axis.independentTicks = independentTicks;
+ var opts = this.optionsViewForAxis_('y' + (i ? '2' : ''));
+ var ticker = opts('ticker');
+ axis.ticks = ticker(axis.computedValueRange[0],
+ axis.computedValueRange[1],
+ this.height_, // TODO(danvk): should be area.height
+ opts,
+ this);
+ // Define the first independent axis as primary axis.
+ if (!p_axis) p_axis = axis;
+ }
+ }
+ if (p_axis === undefined) {
+ throw ("Configuration Error: At least one axis has to have the \"independentTicks\" option activated.");
+ }
+ // Add ticks. By default, all axes inherit the tick positions of the
+ // primary axis. However, if an axis is specifically marked as having
+ // independent ticks, then that is permissible as well.
+ for (var i = 0; i < numAxes; i++) {
+ var axis = this.axes_[i];
+
+ if (!axis.independentTicks) {
+ var opts = this.optionsViewForAxis_('y' + (i ? '2' : ''));
+ var ticker = opts('ticker');
+ var p_ticks = p_axis.ticks;
+ var p_scale = p_axis.computedValueRange[1] - p_axis.computedValueRange[0];
+ var scale = axis.computedValueRange[1] - axis.computedValueRange[0];
+ var tick_values = [];
+ for (var k = 0; k < p_ticks.length; k++) {
+ var y_frac = (p_ticks[k].v - p_axis.computedValueRange[0]) / p_scale;
+ var y_val = axis.computedValueRange[0] + y_frac * scale;
+ tick_values.push(y_val);
+ }
+
+ axis.ticks = ticker(axis.computedValueRange[0],
+ axis.computedValueRange[1],
+ this.height_, // TODO(danvk): should be area.height
+ opts,
+ this,
+ tick_values);
+ }
+ }
+};
+
+/**
+ * Extracts one series from the raw data (a 2D array) into an array of (date,
+ * value) tuples.
+ *
+ * This is where undesirable points (i.e. negative values on log scales and
+ * missing values through which we wish to connect lines) are dropped.
+ * TODO(danvk): the "missing values" bit above doesn't seem right.
+ *
+ * @private
+ * @param {Array.<Array.<(number|Array<Number>)>>} rawData Input data. Rectangular
+ * grid of points, where rawData[row][0] is the X value for the row,
+ * and rawData[row][i] is the Y data for series #i.
+ * @param {number} i Series index, starting from 1.
+ * @param {boolean} logScale True if using logarithmic Y scale.
+ * @return {Array.<Array.<(?number|Array<?number>)>} Series array, where
+ * series[row] = [x,y] or [x, [y, err]] or [x, [y, yplus, yminus]].
+ */
+Dygraph.prototype.extractSeries_ = function(rawData, i, logScale) {
+ // TODO(danvk): pre-allocate series here.
+ var series = [];
+ var errorBars = this.attr_("errorBars");
+ var customBars = this.attr_("customBars");
+ for (var j = 0; j < rawData.length; j++) {
+ var x = rawData[j][0];
+ var point = rawData[j][i];
+ if (logScale) {
+ // On the log scale, points less than zero do not exist.
+ // This will create a gap in the chart.
+ if (errorBars || customBars) {
+ // point.length is either 2 (errorBars) or 3 (customBars)
+ for (var k = 0; k < point.length; k++) {
+ if (point[k] <= 0) {
+ point = null;
+ break;
+ }
+ }
+ } else if (point <= 0) {
+ point = null;
+ }
+ }
+ // Fix null points to fit the display type standard.
+ if (point !== null) {
+ series.push([x, point]);
+ } else {
+ series.push([x, errorBars ? [null, null] : customBars ? [null, null, null] : point]);
+ }
+ }
+ return series;
+};
+
+/**
+ * @private
+ * Calculates the rolling average of a data set.
+ * If originalData is [label, val], rolls the average of those.
+ * If originalData is [label, [, it's interpreted as [value, stddev]
+ * and the roll is returned in the same form, with appropriately reduced
+ * stddev for each value.
+ * Note that this is where fractional input (i.e. '5/10') is converted into
+ * decimal values.
+ * @param {Array} originalData The data in the appropriate format (see above)
+ * @param {Number} rollPeriod The number of points over which to average the
+ * data
+ */
+Dygraph.prototype.rollingAverage = function(originalData, rollPeriod) {
+ rollPeriod = Math.min(rollPeriod, originalData.length);
+ var rollingData = [];
+ var sigma = this.attr_("sigma");
+
+ var low, high, i, j, y, sum, num_ok, stddev;
+ if (this.fractions_) {
+ var num = 0;
+ var den = 0; // numerator/denominator
+ var mult = 100.0;
+ for (i = 0; i < originalData.length; i++) {
+ num += originalData[i][1][0];
+ den += originalData[i][1][1];
+ if (i - rollPeriod >= 0) {
+ num -= originalData[i - rollPeriod][1][0];
+ den -= originalData[i - rollPeriod][1][1];
+ }
+
+ var date = originalData[i][0];
+ var value = den ? num / den : 0.0;
+ if (this.attr_("errorBars")) {
+ if (this.attr_("wilsonInterval")) {
+ // For more details on this confidence interval, see:
+ // http://en.wikipedia.org/wiki/Binomial_confidence_interval
+ if (den) {
+ var p = value < 0 ? 0 : value, n = den;
+ var pm = sigma * Math.sqrt(p*(1-p)/n + sigma*sigma/(4*n*n));
+ var denom = 1 + sigma * sigma / den;
+ low = (p + sigma * sigma / (2 * den) - pm) / denom;
+ high = (p + sigma * sigma / (2 * den) + pm) / denom;
+ rollingData[i] = [date,
+ [p * mult, (p - low) * mult, (high - p) * mult]];
+ } else {
+ rollingData[i] = [date, [0, 0, 0]];
+ }
+ } else {
+ stddev = den ? sigma * Math.sqrt(value * (1 - value) / den) : 1.0;
+ rollingData[i] = [date, [mult * value, mult * stddev, mult * stddev]];
+ }
+ } else {
+ rollingData[i] = [date, mult * value];
+ }
+ }
+ } else if (this.attr_("customBars")) {
+ low = 0;
+ var mid = 0;
+ high = 0;
+ var count = 0;
+ for (i = 0; i < originalData.length; i++) {
+ var data = originalData[i][1];
+ y = data[1];
+ rollingData[i] = [originalData[i][0], [y, y - data[0], data[2] - y]];
+
+ if (y !== null && !isNaN(y)) {
+ low += data[0];
+ mid += y;
+ high += data[2];
+ count += 1;
+ }
+ if (i - rollPeriod >= 0) {
+ var prev = originalData[i - rollPeriod];
+ if (prev[1][1] !== null && !isNaN(prev[1][1])) {
+ low -= prev[1][0];
+ mid -= prev[1][1];
+ high -= prev[1][2];
+ count -= 1;
+ }
+ }
+ if (count) {
+ rollingData[i] = [originalData[i][0], [ 1.0 * mid / count,
+ 1.0 * (mid - low) / count,
+ 1.0 * (high - mid) / count ]];
+ } else {
+ rollingData[i] = [originalData[i][0], [null, null, null]];
+ }
+ }
+ } else {
+ // Calculate the rolling average for the first rollPeriod - 1 points where
+ // there is not enough data to roll over the full number of points
+ if (!this.attr_("errorBars")) {
+ if (rollPeriod == 1) {
+ return originalData;
+ }
+
+ for (i = 0; i < originalData.length; i++) {
+ sum = 0;
+ num_ok = 0;
+ for (j = Math.max(0, i - rollPeriod + 1); j < i + 1; j++) {
+ y = originalData[j][1];
+ if (y === null || isNaN(y)) continue;
+ num_ok++;
+ sum += originalData[j][1];
+ }
+ if (num_ok) {
+ rollingData[i] = [originalData[i][0], sum / num_ok];
+ } else {
+ rollingData[i] = [originalData[i][0], null];
+ }
+ }
+
+ } else {
+ for (i = 0; i < originalData.length; i++) {
+ sum = 0;
+ var variance = 0;
+ num_ok = 0;
+ for (j = Math.max(0, i - rollPeriod + 1); j < i + 1; j++) {
+ y = originalData[j][1][0];
+ if (y === null || isNaN(y)) continue;
+ num_ok++;
+ sum += originalData[j][1][0];
+ variance += Math.pow(originalData[j][1][1], 2);
+ }
+ if (num_ok) {
+ stddev = Math.sqrt(variance) / num_ok;
+ rollingData[i] = [originalData[i][0],
+ [sum / num_ok, sigma * stddev, sigma * stddev]];
+ } else {
+ // This explicitly preserves NaNs to aid with "independent series".
+ // See testRollingAveragePreservesNaNs.
+ var v = (rollPeriod == 1) ? originalData[i][1][0] : null;
+ rollingData[i] = [originalData[i][0], [v, v, v]];
+ }
+ }
+ }
+ }
+
+ return rollingData;
+};
+
+/**
+ * Detects the type of the str (date or numeric) and sets the various
+ * formatting attributes in this.attrs_ based on this type.
+ * @param {String} str An x value.
+ * @private
+ */
+Dygraph.prototype.detectTypeFromString_ = function(str) {
+ var isDate = false;
+ var dashPos = str.indexOf('-'); // could be 2006-01-01 _or_ 1.0e-2
+ if ((dashPos > 0 && (str[dashPos-1] != 'e' && str[dashPos-1] != 'E')) ||
+ str.indexOf('/') >= 0 ||
+ isNaN(parseFloat(str))) {
+ isDate = true;
+ } else if (str.length == 8 && str > '19700101' && str < '20371231') {
+ // TODO(danvk): remove support for this format.
+ isDate = true;
+ }
+
+ this.setXAxisOptions_(isDate);
+};
+
+Dygraph.prototype.setXAxisOptions_ = function(isDate) {
+ if (isDate) {
+ this.attrs_.xValueParser = Dygraph.dateParser;
+ this.attrs_.axes.x.valueFormatter = Dygraph.dateString_;
+ this.attrs_.axes.x.ticker = Dygraph.dateTicker;
+ this.attrs_.axes.x.axisLabelFormatter = Dygraph.dateAxisFormatter;
+ } else {
+ /** @private (shut up, jsdoc!) */
+ this.attrs_.xValueParser = function(x) { return parseFloat(x); };
+ // TODO(danvk): use Dygraph.numberValueFormatter here?
+ /** @private (shut up, jsdoc!) */
+ this.attrs_.axes.x.valueFormatter = function(x) { return x; };
+ this.attrs_.axes.x.ticker = Dygraph.numericLinearTicks;
+ this.attrs_.axes.x.axisLabelFormatter = this.attrs_.axes.x.valueFormatter;
+ }
+};
+
+/**
+ * Parses the value as a floating point number. This is like the parseFloat()
+ * built-in, but with a few differences:
+ * - the empty string is parsed as null, rather than NaN.
+ * - if the string cannot be parsed at all, an error is logged.
+ * If the string can't be parsed, this method returns null.
+ * @param {String} x The string to be parsed
+ * @param {Number} opt_line_no The line number from which the string comes.
+ * @param {String} opt_line The text of the line from which the string comes.
+ * @private
+ */
+
+// Parse the x as a float or return null if it's not a number.
+Dygraph.prototype.parseFloat_ = function(x, opt_line_no, opt_line) {
+ var val = parseFloat(x);
+ if (!isNaN(val)) return val;
+
+ // Try to figure out what happeend.
+ // If the value is the empty string, parse it as null.
+ if (/^ *$/.test(x)) return null;
+
+ // If it was actually "NaN", return it as NaN.
+ if (/^ *nan *$/i.test(x)) return NaN;
+
+ // Looks like a parsing error.
+ var msg = "Unable to parse '" + x + "' as a number";
+ if (opt_line !== null && opt_line_no !== null) {
+ msg += " on line " + (1+opt_line_no) + " ('" + opt_line + "') of CSV.";
+ }
+ this.error(msg);
+
+ return null;
+};
+
+/**
+ * @private
+ * Parses a string in a special csv format. We expect a csv file where each
+ * line is a date point, and the first field in each line is the date string.
+ * We also expect that all remaining fields represent series.
+ * if the errorBars attribute is set, then interpret the fields as:
+ * date, series1, stddev1, series2, stddev2, ...
+ * @param {[Object]} data See above.
+ *
+ * @return [Object] An array with one entry for each row. These entries
+ * are an array of cells in that row. The first entry is the parsed x-value for
+ * the row. The second, third, etc. are the y-values. These can take on one of
+ * three forms, depending on the CSV and constructor parameters:
+ * 1. numeric value
+ * 2. [ value, stddev ]
+ * 3. [ low value, center value, high value ]
+ */
+Dygraph.prototype.parseCSV_ = function(data) {
+ var ret = [];
+ var line_delimiter = Dygraph.detectLineDelimiter(data);
+ var lines = data.split(line_delimiter || "\n");
+ var vals, j;
+
+ // Use the default delimiter or fall back to a tab if that makes sense.
+ var delim = this.attr_('delimiter');
+ if (lines[0].indexOf(delim) == -1 && lines[0].indexOf('\t') >= 0) {
+ delim = '\t';
+ }
+
+ var start = 0;
+ if (!('labels' in this.user_attrs_)) {
+ // User hasn't explicitly set labels, so they're (presumably) in the CSV.
+ start = 1;
+ this.attrs_.labels = lines[0].split(delim); // NOTE: _not_ user_attrs_.
+ this.attributes_.reparseSeries();
+ }
+ var line_no = 0;
+
+ var xParser;
+ var defaultParserSet = false; // attempt to auto-detect x value type
+ var expectedCols = this.attr_("labels").length;
+ var outOfOrder = false;
+ for (var i = start; i < lines.length; i++) {
+ var line = lines[i];
+ line_no = i;
+ if (line.length === 0) continue; // skip blank lines
+ if (line[0] == '#') continue; // skip comment lines
+ var inFields = line.split(delim);
+ if (inFields.length < 2) continue;
+
+ var fields = [];
+ if (!defaultParserSet) {
+ this.detectTypeFromString_(inFields[0]);
+ xParser = this.attr_("xValueParser");
+ defaultParserSet = true;
+ }
+ fields[0] = xParser(inFields[0], this);
+
+ // If fractions are expected, parse the numbers as "A/B"
+ if (this.fractions_) {
+ for (j = 1; j < inFields.length; j++) {
+ // TODO(danvk): figure out an appropriate way to flag parse errors.
+ vals = inFields[j].split("/");
+ if (vals.length != 2) {
+ this.error('Expected fractional "num/den" values in CSV data ' +
+ "but found a value '" + inFields[j] + "' on line " +
+ (1 + i) + " ('" + line + "') which is not of this form.");
+ fields[j] = [0, 0];
+ } else {
+ fields[j] = [this.parseFloat_(vals[0], i, line),
+ this.parseFloat_(vals[1], i, line)];
+ }
+ }
+ } else if (this.attr_("errorBars")) {
+ // If there are error bars, values are (value, stddev) pairs
+ if (inFields.length % 2 != 1) {
+ this.error('Expected alternating (value, stdev.) pairs in CSV data ' +
+ 'but line ' + (1 + i) + ' has an odd number of values (' +
+ (inFields.length - 1) + "): '" + line + "'");
+ }
+ for (j = 1; j < inFields.length; j += 2) {
+ fields[(j + 1) / 2] = [this.parseFloat_(inFields[j], i, line),
+ this.parseFloat_(inFields[j + 1], i, line)];
+ }
+ } else if (this.attr_("customBars")) {
+ // Bars are a low;center;high tuple
+ for (j = 1; j < inFields.length; j++) {
+ var val = inFields[j];
+ if (/^ *$/.test(val)) {
+ fields[j] = [null, null, null];
+ } else {
+ vals = val.split(";");
+ if (vals.length == 3) {
+ fields[j] = [ this.parseFloat_(vals[0], i, line),
+ this.parseFloat_(vals[1], i, line),
+ this.parseFloat_(vals[2], i, line) ];
+ } else {
+ this.warn('When using customBars, values must be either blank ' +
+ 'or "low;center;high" tuples (got "' + val +
+ '" on line ' + (1+i));
+ }
+ }
+ }
+ } else {
+ // Values are just numbers
+ for (j = 1; j < inFields.length; j++) {
+ fields[j] = this.parseFloat_(inFields[j], i, line);
+ }
+ }
+ if (ret.length > 0 && fields[0] < ret[ret.length - 1][0]) {
+ outOfOrder = true;
+ }
+
+ if (fields.length != expectedCols) {
+ this.error("Number of columns in line " + i + " (" + fields.length +
+ ") does not agree with number of labels (" + expectedCols +
+ ") " + line);
+ }
+
+ // If the user specified the 'labels' option and none of the cells of the
+ // first row parsed correctly, then they probably double-specified the
+ // labels. We go with the values set in the option, discard this row and
+ // log a warning to the JS console.
+ if (i === 0 && this.attr_('labels')) {
+ var all_null = true;
+ for (j = 0; all_null && j < fields.length; j++) {
+ if (fields[j]) all_null = false;
+ }
+ if (all_null) {
+ this.warn("The dygraphs 'labels' option is set, but the first row of " +
+ "CSV data ('" + line + "') appears to also contain labels. " +
+ "Will drop the CSV labels and use the option labels.");
+ continue;
+ }
+ }
+ ret.push(fields);
+ }
+
+ if (outOfOrder) {
+ this.warn("CSV is out of order; order it correctly to speed loading.");
+ ret.sort(function(a,b) { return a[0] - b[0]; });
+ }
+
+ return ret;
+};
+
+/**
+ * @private
+ * The user has provided their data as a pre-packaged JS array. If the x values
+ * are numeric, this is the same as dygraphs' internal format. If the x values
+ * are dates, we need to convert them from Date objects to ms since epoch.
+ * @param {[Object]} data
+ * @return {[Object]} data with numeric x values.
+ */
+Dygraph.prototype.parseArray_ = function(data) {
+ // Peek at the first x value to see if it's numeric.
+ if (data.length === 0) {
+ this.error("Can't plot empty data set");
+ return null;
+ }
+ if (data[0].length === 0) {
+ this.error("Data set cannot contain an empty row");
+ return null;
+ }
+
+ var i;
+ if (this.attr_("labels") === null) {
+ this.warn("Using default labels. Set labels explicitly via 'labels' " +
+ "in the options parameter");
+ this.attrs_.labels = [ "X" ];
+ for (i = 1; i < data[0].length; i++) {
+ this.attrs_.labels.push("Y" + i); // Not user_attrs_.
+ }
+ this.attributes_.reparseSeries();
+ } else {
+ var num_labels = this.attr_("labels");
+ if (num_labels.length != data[0].length) {
+ this.error("Mismatch between number of labels (" + num_labels +
+ ") and number of columns in array (" + data[0].length + ")");
+ return null;
+ }
+ }
+
+ if (Dygraph.isDateLike(data[0][0])) {
+ // Some intelligent defaults for a date x-axis.
+ this.attrs_.axes.x.valueFormatter = Dygraph.dateString_;
+ this.attrs_.axes.x.ticker = Dygraph.dateTicker;
+ this.attrs_.axes.x.axisLabelFormatter = Dygraph.dateAxisFormatter;
+
+ // Assume they're all dates.
+ var parsedData = Dygraph.clone(data);
+ for (i = 0; i < data.length; i++) {
+ if (parsedData[i].length === 0) {
+ this.error("Row " + (1 + i) + " of data is empty");
+ return null;
+ }
+ if (parsedData[i][0] === null ||
+ typeof(parsedData[i][0].getTime) != 'function' ||
+ isNaN(parsedData[i][0].getTime())) {
+ this.error("x value in row " + (1 + i) + " is not a Date");
+ return null;
+ }
+ parsedData[i][0] = parsedData[i][0].getTime();
+ }
+ return parsedData;
+ } else {
+ // Some intelligent defaults for a numeric x-axis.
+ /** @private (shut up, jsdoc!) */
+ this.attrs_.axes.x.valueFormatter = function(x) { return x; };
+ this.attrs_.axes.x.ticker = Dygraph.numericLinearTicks;
+ this.attrs_.axes.x.axisLabelFormatter = Dygraph.numberAxisLabelFormatter;
+ return data;
+ }
+};
+
+/**
+ * Parses a DataTable object from gviz.
+ * The data is expected to have a first column that is either a date or a
+ * number. All subsequent columns must be numbers. If there is a clear mismatch
+ * between this.xValueParser_ and the type of the first column, it will be
+ * fixed. Fills out rawData_.
+ * @param {[Object]} data See above.
+ * @private
+ */
+Dygraph.prototype.parseDataTable_ = function(data) {
+ var shortTextForAnnotationNum = function(num) {
+ // converts [0-9]+ [A-Z][a-z]*
+ // example: 0=A, 1=B, 25=Z, 26=Aa, 27=Ab
+ // and continues like.. Ba Bb .. Za .. Zz..Aaa...Zzz Aaaa Zzzz
+ var shortText = String.fromCharCode(65 /* A */ + num % 26);
+ num = Math.floor(num / 26);
+ while ( num > 0 ) {
+ shortText = String.fromCharCode(65 /* A */ + (num - 1) % 26 ) + shortText.toLowerCase();
+ num = Math.floor((num - 1) / 26);
+ }
+ return shortText;
+ };
+
+ var cols = data.getNumberOfColumns();
+ var rows = data.getNumberOfRows();
+
+ var indepType = data.getColumnType(0);
+ if (indepType == 'date' || indepType == 'datetime') {
+ this.attrs_.xValueParser = Dygraph.dateParser;
+ this.attrs_.axes.x.valueFormatter = Dygraph.dateString_;
+ this.attrs_.axes.x.ticker = Dygraph.dateTicker;
+ this.attrs_.axes.x.axisLabelFormatter = Dygraph.dateAxisFormatter;
+ } else if (indepType == 'number') {
+ this.attrs_.xValueParser = function(x) { return parseFloat(x); };
+ this.attrs_.axes.x.valueFormatter = function(x) { return x; };
+ this.attrs_.axes.x.ticker = Dygraph.numericLinearTicks;
+ this.attrs_.axes.x.axisLabelFormatter = this.attrs_.axes.x.valueFormatter;
+ } else {
+ this.error("only 'date', 'datetime' and 'number' types are supported for " +
+ "column 1 of DataTable input (Got '" + indepType + "')");
+ return null;
+ }
+
+ // Array of the column indices which contain data (and not annotations).
+ var colIdx = [];
+ var annotationCols = {}; // data index -> [annotation cols]
+ var hasAnnotations = false;
+ var i, j;
+ for (i = 1; i < cols; i++) {
+ var type = data.getColumnType(i);
+ if (type == 'number') {
+ colIdx.push(i);
+ } else if (type == 'string' && this.attr_('displayAnnotations')) {
+ // This is OK -- it's an annotation column.
+ var dataIdx = colIdx[colIdx.length - 1];
+ if (!annotationCols.hasOwnProperty(dataIdx)) {
+ annotationCols[dataIdx] = [i];
+ } else {
+ annotationCols[dataIdx].push(i);
+ }
+ hasAnnotations = true;
+ } else {
+ this.error("Only 'number' is supported as a dependent type with Gviz." +
+ " 'string' is only supported if displayAnnotations is true");
+ }
+ }
+
+ // Read column labels
+ // TODO(danvk): add support back for errorBars
+ var labels = [data.getColumnLabel(0)];
+ for (i = 0; i < colIdx.length; i++) {
+ labels.push(data.getColumnLabel(colIdx[i]));
+ if (this.attr_("errorBars")) i += 1;
+ }
+ this.attrs_.labels = labels;
+ cols = labels.length;
+
+ var ret = [];
+ var outOfOrder = false;
+ var annotations = [];
+ for (i = 0; i < rows; i++) {
+ var row = [];
+ if (typeof(data.getValue(i, 0)) === 'undefined' ||
+ data.getValue(i, 0) === null) {
+ this.warn("Ignoring row " + i +
+ " of DataTable because of undefined or null first column.");
+ continue;
+ }
+
+ if (indepType == 'date' || indepType == 'datetime') {
+ row.push(data.getValue(i, 0).getTime());
+ } else {
+ row.push(data.getValue(i, 0));
+ }
+ if (!this.attr_("errorBars")) {
+ for (j = 0; j < colIdx.length; j++) {
+ var col = colIdx[j];
+ row.push(data.getValue(i, col));
+ if (hasAnnotations &&
+ annotationCols.hasOwnProperty(col) &&
+ data.getValue(i, annotationCols[col][0]) !== null) {
+ var ann = {};
+ ann.series = data.getColumnLabel(col);
+ ann.xval = row[0];
+ ann.shortText = shortTextForAnnotationNum(annotations.length);
+ ann.text = '';
+ for (var k = 0; k < annotationCols[col].length; k++) {
+ if (k) ann.text += "\n";
+ ann.text += data.getValue(i, annotationCols[col][k]);
+ }
+ annotations.push(ann);
+ }
+ }
+
+ // Strip out infinities, which give dygraphs problems later on.
+ for (j = 0; j < row.length; j++) {
+ if (!isFinite(row[j])) row[j] = null;
+ }
+ } else {
+ for (j = 0; j < cols - 1; j++) {
+ row.push([ data.getValue(i, 1 + 2 * j), data.getValue(i, 2 + 2 * j) ]);
+ }
+ }
+ if (ret.length > 0 && row[0] < ret[ret.length - 1][0]) {
+ outOfOrder = true;
+ }
+ ret.push(row);
+ }
+
+ if (outOfOrder) {
+ this.warn("DataTable is out of order; order it correctly to speed loading.");
+ ret.sort(function(a,b) { return a[0] - b[0]; });
+ }
+ this.rawData_ = ret;
+
+ if (annotations.length > 0) {
+ this.setAnnotations(annotations, true);
+ }
+ this.attributes_.reparseSeries();
+};
+
+/**
+ * Get the CSV data. If it's in a function, call that function. If it's in a
+ * file, do an XMLHttpRequest to get it.
+ * @private
+ */
+Dygraph.prototype.start_ = function() {
+ var data = this.file_;
+
+ // Functions can return references of all other types.
+ if (typeof data == 'function') {
+ data = data();
+ }
+
+ if (Dygraph.isArrayLike(data)) {
+ this.rawData_ = this.parseArray_(data);
+ this.predraw_();
+ } else if (typeof data == 'object' &&
+ typeof data.getColumnRange == 'function') {
+ // must be a DataTable from gviz.
+ this.parseDataTable_(data);
+ this.predraw_();
+ } else if (typeof data == 'string') {
+ // Heuristic: a newline means it's CSV data. Otherwise it's an URL.
+ var line_delimiter = Dygraph.detectLineDelimiter(data);
+ if (line_delimiter) {
+ this.loadedEvent_(data);
+ } else {
+ var req = new XMLHttpRequest();
+ var caller = this;
+ req.onreadystatechange = function () {
+ if (req.readyState == 4) {
+ if (req.status === 200 || // Normal http
+ req.status === 0) { // Chrome w/ --allow-file-access-from-files
+ caller.loadedEvent_(req.responseText);
+ }
+ }
+ };
+
+ req.open("GET", data, true);
+ req.send(null);
+ }
+ } else {
+ this.error("Unknown data format: " + (typeof data));
+ }
+};
+
+/**
+ * Changes various properties of the graph. These can include:
+ * <ul>
+ * <li>file: changes the source data for the graph</li>
+ * <li>errorBars: changes whether the data contains stddev</li>
+ * </ul>
+ *
+ * There's a huge variety of options that can be passed to this method. For a
+ * full list, see http://dygraphs.com/options.html.
+ *
+ * @param {Object} attrs The new properties and values
+ * @param {Boolean} [block_redraw] Usually the chart is redrawn after every
+ * call to updateOptions(). If you know better, you can pass true to explicitly
+ * block the redraw. This can be useful for chaining updateOptions() calls,
+ * avoiding the occasional infinite loop and preventing redraws when it's not
+ * necessary (e.g. when updating a callback).
+ */
+Dygraph.prototype.updateOptions = function(input_attrs, block_redraw) {
+ if (typeof(block_redraw) == 'undefined') block_redraw = false;
+
+ // mapLegacyOptions_ drops the "file" parameter as a convenience to us.
+ var file = input_attrs.file;
+ var attrs = Dygraph.mapLegacyOptions_(input_attrs);
+
+ // TODO(danvk): this is a mess. Move these options into attr_.
+ if ('rollPeriod' in attrs) {
+ this.rollPeriod_ = attrs.rollPeriod;
+ }
+ if ('dateWindow' in attrs) {
+ this.dateWindow_ = attrs.dateWindow;
+ if (!('isZoomedIgnoreProgrammaticZoom' in attrs)) {
+ this.zoomed_x_ = (attrs.dateWindow !== null);
+ }
+ }
+ if ('valueRange' in attrs && !('isZoomedIgnoreProgrammaticZoom' in attrs)) {
+ this.zoomed_y_ = (attrs.valueRange !== null);
+ }
+
+ // TODO(danvk): validate per-series options.
+ // Supported:
+ // strokeWidth
+ // pointSize
+ // drawPoints
+ // highlightCircleSize
+
+ // Check if this set options will require new points.
+ var requiresNewPoints = Dygraph.isPixelChangingOptionList(this.attr_("labels"), attrs);
+
+ Dygraph.updateDeep(this.user_attrs_, attrs);
+
+ this.attributes_.reparseSeries();
+
+ if (file) {
+ this.file_ = file;
+ if (!block_redraw) this.start_();
+ } else {
+ if (!block_redraw) {
+ if (requiresNewPoints) {
+ this.predraw_();
+ } else {
+ this.renderGraph_(false);
+ }
+ }
+ }
+};
+
+/**
+ * Returns a copy of the options with deprecated names converted into current
+ * names. Also drops the (potentially-large) 'file' attribute. If the caller is
+ * interested in that, they should save a copy before calling this.
+ * @private
+ */
+Dygraph.mapLegacyOptions_ = function(attrs) {
+ var my_attrs = {};
+ for (var k in attrs) {
+ if (k == 'file') continue;
+ if (attrs.hasOwnProperty(k)) my_attrs[k] = attrs[k];
+ }
+
+ var set = function(axis, opt, value) {
+ if (!my_attrs.axes) my_attrs.axes = {};
+ if (!my_attrs.axes[axis]) my_attrs.axes[axis] = {};
+ my_attrs.axes[axis][opt] = value;
+ };
+ var map = function(opt, axis, new_opt) {
+ if (typeof(attrs[opt]) != 'undefined') {
+ Dygraph.warn("Option " + opt + " is deprecated. Use the " +
+ new_opt + " option for the " + axis + " axis instead. " +
+ "(e.g. { axes : { " + axis + " : { " + new_opt + " : ... } } } " +
+ "(see http://dygraphs.com/per-axis.html for more information.");
+ set(axis, new_opt, attrs[opt]);
+ delete my_attrs[opt];
+ }
+ };
+
+ // This maps, e.g., xValueFormater -> axes: { x: { valueFormatter: ... } }
+ map('xValueFormatter', 'x', 'valueFormatter');
+ map('pixelsPerXLabel', 'x', 'pixelsPerLabel');
+ map('xAxisLabelFormatter', 'x', 'axisLabelFormatter');
+ map('xTicker', 'x', 'ticker');
+ map('yValueFormatter', 'y', 'valueFormatter');
+ map('pixelsPerYLabel', 'y', 'pixelsPerLabel');
+ map('yAxisLabelFormatter', 'y', 'axisLabelFormatter');
+ map('yTicker', 'y', 'ticker');
+ return my_attrs;
+};
+
+/**
+ * Resizes the dygraph. If no parameters are specified, resizes to fill the
+ * containing div (which has presumably changed size since the dygraph was
+ * instantiated. If the width/height are specified, the div will be resized.
+ *
+ * This is far more efficient than destroying and re-instantiating a
+ * Dygraph, since it doesn't have to reparse the underlying data.
+ *
+ * @param {Number} [width] Width (in pixels)
+ * @param {Number} [height] Height (in pixels)
+ */
+Dygraph.prototype.resize = function(width, height) {
+ if (this.resize_lock) {
+ return;
+ }
+ this.resize_lock = true;
+
+ if ((width === null) != (height === null)) {
+ this.warn("Dygraph.resize() should be called with zero parameters or " +
+ "two non-NULL parameters. Pretending it was zero.");
+ width = height = null;
+ }
+
+ var old_width = this.width_;
+ var old_height = this.height_;
+
+ if (width) {
+ this.maindiv_.style.width = width + "px";
+ this.maindiv_.style.height = height + "px";
+ this.width_ = width;
+ this.height_ = height;
+ } else {
+ this.width_ = this.maindiv_.clientWidth;
+ this.height_ = this.maindiv_.clientHeight;
+ }
+
+ if (old_width != this.width_ || old_height != this.height_) {
+ // Resizing a canvas erases it, even when the size doesn't change, so
+ // any resize needs to be followed by a redraw.
+ this.resizeElements_();
+ this.predraw_();
+ }
+
+ this.resize_lock = false;
+};
+
+/**
+ * Adjusts the number of points in the rolling average. Updates the graph to
+ * reflect the new averaging period.
+ * @param {Number} length Number of points over which to average the data.
+ */
+Dygraph.prototype.adjustRoll = function(length) {
+ this.rollPeriod_ = length;
+ this.predraw_();
+};
+
+/**
+ * Returns a boolean array of visibility statuses.
+ */
+Dygraph.prototype.visibility = function() {
+ // Do lazy-initialization, so that this happens after we know the number of
+ // data series.
+ if (!this.attr_("visibility")) {
+ this.attrs_.visibility = [];
+ }
+ // TODO(danvk): it looks like this could go into an infinite loop w/ user_attrs.
+ while (this.attr_("visibility").length < this.numColumns() - 1) {
+ this.attrs_.visibility.push(true);
+ }
+ return this.attr_("visibility");
+};
+
+/**
+ * Changes the visiblity of a series.
+ */
+Dygraph.prototype.setVisibility = function(num, value) {
+ var x = this.visibility();
+ if (num < 0 || num >= x.length) {
+ this.warn("invalid series number in setVisibility: " + num);
+ } else {
+ x[num] = value;
+ this.predraw_();
+ }
+};
+
+/**
+ * How large of an area will the dygraph render itself in?
+ * This is used for testing.
+ * @return A {width: w, height: h} object.
+ * @private
+ */
+Dygraph.prototype.size = function() {
+ return { width: this.width_, height: this.height_ };
+};
+
+/**
+ * Update the list of annotations and redraw the chart.
+ * See dygraphs.com/annotations.html for more info on how to use annotations.
+ * @param ann {Array} An array of annotation objects.
+ * @param suppressDraw {Boolean} Set to "true" to block chart redraw (optional).
+ */
+Dygraph.prototype.setAnnotations = function(ann, suppressDraw) {
+ // Only add the annotation CSS rule once we know it will be used.
+ Dygraph.addAnnotationRule();
+ this.annotations_ = ann;
+ if (!this.layout_) {
+ this.warn("Tried to setAnnotations before dygraph was ready. " +
+ "Try setting them in a drawCallback. See " +
+ "dygraphs.com/tests/annotation.html");
+ return;
+ }
+
+ this.layout_.setAnnotations(this.annotations_);
+ if (!suppressDraw) {
+ this.predraw_();
+ }
+};
+
+/**
+ * Return the list of annotations.
+ */
+Dygraph.prototype.annotations = function() {
+ return this.annotations_;
+};
+
+/**
+ * Get the list of label names for this graph. The first column is the
+ * x-axis, so the data series names start at index 1.
+ *
+ * Returns null when labels have not yet been defined.
+ */
+Dygraph.prototype.getLabels = function() {
+ var labels = this.attr_("labels");
+ return labels ? labels.slice() : null;
+};
+
+/**
+ * Get the index of a series (column) given its name. The first column is the
+ * x-axis, so the data series start with index 1.
+ */
+Dygraph.prototype.indexFromSetName = function(name) {
+ return this.setIndexByName_[name];
+};
+
+/**
+ * Get the internal dataset index given its name. These are numbered starting from 0,
+ * and only count visible sets.
+ * @private
+ */
+Dygraph.prototype.datasetIndexFromSetName_ = function(name) {
+ return this.datasetIndex_[this.indexFromSetName(name)];
+};
+
+/**
+ * @private
+ * Adds a default style for the annotation CSS classes to the document. This is
+ * only executed when annotations are actually used. It is designed to only be
+ * called once -- all calls after the first will return immediately.
+ */
+Dygraph.addAnnotationRule = function() {
+ // TODO(danvk): move this function into plugins/annotations.js?
+ if (Dygraph.addedAnnotationCSS) return;
+
+ var rule = "border: 1px solid black; " +
+ "background-color: white; " +
+ "text-align: center;";
+
+ var styleSheetElement = document.createElement("style");
+ styleSheetElement.type = "text/css";
+ document.getElementsByTagName("head")[0].appendChild(styleSheetElement);
+
+ // Find the first style sheet that we can access.
+ // We may not add a rule to a style sheet from another domain for security
+ // reasons. This sometimes comes up when using gviz, since the Google gviz JS
+ // adds its own style sheets from google.com.
+ for (var i = 0; i < document.styleSheets.length; i++) {
+ if (document.styleSheets[i].disabled) continue;
+ var mysheet = document.styleSheets[i];
+ try {
+ if (mysheet.insertRule) { // Firefox
+ var idx = mysheet.cssRules ? mysheet.cssRules.length : 0;
+ mysheet.insertRule(".dygraphDefaultAnnotation { " + rule + " }", idx);
+ } else if (mysheet.addRule) { // IE
+ mysheet.addRule(".dygraphDefaultAnnotation", rule);
+ }
+ Dygraph.addedAnnotationCSS = true;
+ return;
+ } catch(err) {
+ // Was likely a security exception.
+ }
+ }
+
+ this.warn("Unable to add default annotation CSS rule; display may be off.");
+};
+
+// Older pages may still use this name.
+var DateGraph = Dygraph;
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/excanvas.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/excanvas.js
new file mode 100644
index 00000000..367764b4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/excanvas.js
@@ -0,0 +1,924 @@
+// Copyright 2006 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
+// Known Issues:
+//
+// * Patterns are not implemented.
+// * Radial gradient are not implemented. The VML version of these look very
+// different from the canvas one.
+// * Clipping paths are not implemented.
+// * Coordsize. The width and height attribute have higher priority than the
+// width and height style values which isn't correct.
+// * Painting mode isn't implemented.
+// * Canvas width/height should is using content-box by default. IE in
+// Quirks mode will draw the canvas using border-box. Either change your
+// doctype to HTML5
+// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype)
+// or use Box Sizing Behavior from WebFX
+// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html)
+// * Non uniform scaling does not correctly scale strokes.
+// * Optimize. There is always room for speed improvements.
+
+// Only add this code if we do not already have a canvas implementation
+if (!document.createElement('canvas').getContext) {
+
+(function() {
+
+ // alias some functions to make (compiled) code shorter
+ var m = Math;
+ var mr = m.round;
+ var ms = m.sin;
+ var mc = m.cos;
+ var abs = m.abs;
+ var sqrt = m.sqrt;
+
+ // this is used for sub pixel precision
+ var Z = 10;
+ var Z2 = Z / 2;
+
+ /**
+ * This funtion is assigned to the <canvas> elements as element.getContext().
+ * @this {HTMLElement}
+ * @return {CanvasRenderingContext2D_}
+ */
+ function getContext() {
+ return this.context_ ||
+ (this.context_ = new CanvasRenderingContext2D_(this));
+ }
+
+ var slice = Array.prototype.slice;
+
+ /**
+ * Binds a function to an object. The returned function will always use the
+ * passed in {@code obj} as {@code this}.
+ *
+ * Example:
+ *
+ * g = bind(f, obj, a, b)
+ * g(c, d) // will do f.call(obj, a, b, c, d)
+ *
+ * @param {Function} f The function to bind the object to
+ * @param {Object} obj The object that should act as this when the function
+ * is called
+ * @param {*} var_args Rest arguments that will be used as the initial
+ * arguments when the function is called
+ * @return {Function} A new function that has bound this
+ */
+ function bind(f, obj, var_args) {
+ var a = slice.call(arguments, 2);
+ return function() {
+ return f.apply(obj, a.concat(slice.call(arguments)));
+ };
+ }
+
+ var G_vmlCanvasManager_ = {
+ init: function(opt_doc) {
+ if (/MSIE/.test(navigator.userAgent) && !window.opera) {
+ var doc = opt_doc || document;
+ // Create a dummy element so that IE will allow canvas elements to be
+ // recognized.
+ doc.createElement('canvas');
+ doc.attachEvent('onreadystatechange', bind(this.init_, this, doc));
+ }
+ },
+
+ init_: function(doc) {
+ // create xmlns
+ if (!doc.namespaces['g_vml_']) {
+ doc.namespaces.add('g_vml_', 'urn:schemas-microsoft-com:vml',
+ '#default#VML');
+
+ }
+ if (!doc.namespaces['g_o_']) {
+ doc.namespaces.add('g_o_', 'urn:schemas-microsoft-com:office:office',
+ '#default#VML');
+ }
+
+ // Setup default CSS. Only add one style sheet per document
+ if (!doc.styleSheets['ex_canvas_']) {
+ var ss = doc.createStyleSheet();
+ ss.owningElement.id = 'ex_canvas_';
+ ss.cssText = 'canvas{display:inline-block;overflow:hidden;' +
+ // default size is 300x150 in Gecko and Opera
+ 'text-align:left;width:300px;height:150px}' +
+ 'g_vml_\\:*{behavior:url(#default#VML)}' +
+ 'g_o_\\:*{behavior:url(#default#VML)}';
+
+ }
+
+ // find all canvas elements
+ var els = doc.getElementsByTagName('canvas');
+ for (var i = 0; i < els.length; i++) {
+ this.initElement(els[i]);
+ }
+ },
+
+ /**
+ * Public initializes a canvas element so that it can be used as canvas
+ * element from now on. This is called automatically before the page is
+ * loaded but if you are creating elements using createElement you need to
+ * make sure this is called on the element.
+ * @param {HTMLElement} el The canvas element to initialize.
+ * @return {HTMLElement} the element that was created.
+ */
+ initElement: function(el) {
+ if (!el.getContext) {
+
+ el.getContext = getContext;
+
+ // Remove fallback content. There is no way to hide text nodes so we
+ // just remove all childNodes. We could hide all elements and remove
+ // text nodes but who really cares about the fallback content.
+ el.innerHTML = '';
+
+ // do not use inline function because that will leak memory
+ el.attachEvent('onpropertychange', onPropertyChange);
+ el.attachEvent('onresize', onResize);
+
+ var attrs = el.attributes;
+ if (attrs.width && attrs.width.specified) {
+ // TODO: use runtimeStyle and coordsize
+ // el.getContext().setWidth_(attrs.width.nodeValue);
+ el.style.width = attrs.width.nodeValue + 'px';
+ } else {
+ el.width = el.clientWidth;
+ }
+ if (attrs.height && attrs.height.specified) {
+ // TODO: use runtimeStyle and coordsize
+ // el.getContext().setHeight_(attrs.height.nodeValue);
+ el.style.height = attrs.height.nodeValue + 'px';
+ } else {
+ el.height = el.clientHeight;
+ }
+ //el.getContext().setCoordsize_()
+ }
+ return el;
+ }
+ };
+
+ function onPropertyChange(e) {
+ var el = e.srcElement;
+
+ switch (e.propertyName) {
+ case 'width':
+ el.style.width = el.attributes.width.nodeValue + 'px';
+ el.getContext().clearRect();
+ break;
+ case 'height':
+ el.style.height = el.attributes.height.nodeValue + 'px';
+ el.getContext().clearRect();
+ break;
+ }
+ }
+
+ function onResize(e) {
+ var el = e.srcElement;
+ if (el.firstChild) {
+ el.firstChild.style.width = el.clientWidth + 'px';
+ el.firstChild.style.height = el.clientHeight + 'px';
+ }
+ }
+
+ G_vmlCanvasManager_.init();
+
+ // precompute "00" to "FF"
+ var dec2hex = [];
+ for (var i = 0; i < 16; i++) {
+ for (var j = 0; j < 16; j++) {
+ dec2hex[i * 16 + j] = i.toString(16) + j.toString(16);
+ }
+ }
+
+ function createMatrixIdentity() {
+ return [
+ [1, 0, 0],
+ [0, 1, 0],
+ [0, 0, 1]
+ ];
+ }
+
+ function matrixMultiply(m1, m2) {
+ var result = createMatrixIdentity();
+
+ for (var x = 0; x < 3; x++) {
+ for (var y = 0; y < 3; y++) {
+ var sum = 0;
+
+ for (var z = 0; z < 3; z++) {
+ sum += m1[x][z] * m2[z][y];
+ }
+
+ result[x][y] = sum;
+ }
+ }
+ return result;
+ }
+
+ function copyState(o1, o2) {
+ o2.fillStyle = o1.fillStyle;
+ o2.lineCap = o1.lineCap;
+ o2.lineJoin = o1.lineJoin;
+ o2.lineWidth = o1.lineWidth;
+ o2.miterLimit = o1.miterLimit;
+ o2.shadowBlur = o1.shadowBlur;
+ o2.shadowColor = o1.shadowColor;
+ o2.shadowOffsetX = o1.shadowOffsetX;
+ o2.shadowOffsetY = o1.shadowOffsetY;
+ o2.strokeStyle = o1.strokeStyle;
+ o2.globalAlpha = o1.globalAlpha;
+ o2.arcScaleX_ = o1.arcScaleX_;
+ o2.arcScaleY_ = o1.arcScaleY_;
+ o2.lineScale_ = o1.lineScale_;
+ }
+
+ function processStyle(styleString) {
+ var str, alpha = 1;
+
+ styleString = String(styleString);
+ if (styleString.substring(0, 3) == 'rgb') {
+ var start = styleString.indexOf('(', 3);
+ var end = styleString.indexOf(')', start + 1);
+ var guts = styleString.substring(start + 1, end).split(',');
+
+ str = '#';
+ for (var i = 0; i < 3; i++) {
+ str += dec2hex[Number(guts[i])];
+ }
+
+ if (guts.length == 4 && styleString.substr(3, 1) == 'a') {
+ alpha = guts[3];
+ }
+ } else {
+ str = styleString;
+ }
+
+ return {color: str, alpha: alpha};
+ }
+
+ function processLineCap(lineCap) {
+ switch (lineCap) {
+ case 'butt':
+ return 'flat';
+ case 'round':
+ return 'round';
+ case 'square':
+ default:
+ return 'square';
+ }
+ }
+
+ /**
+ * This class implements CanvasRenderingContext2D interface as described by
+ * the WHATWG.
+ * @param {HTMLElement} surfaceElement The element that the 2D context should
+ * be associated with
+ */
+ function CanvasRenderingContext2D_(surfaceElement) {
+ this.m_ = createMatrixIdentity();
+
+ this.mStack_ = [];
+ this.aStack_ = [];
+ this.currentPath_ = [];
+
+ // Canvas context properties
+ this.strokeStyle = '#000';
+ this.fillStyle = '#000';
+
+ this.lineWidth = 1;
+ this.lineJoin = 'miter';
+ this.lineCap = 'butt';
+ this.miterLimit = Z * 1;
+ this.globalAlpha = 1;
+ this.canvas = surfaceElement;
+
+ var el = surfaceElement.ownerDocument.createElement('div');
+ el.style.width = surfaceElement.clientWidth + 'px';
+ el.style.height = surfaceElement.clientHeight + 'px';
+ el.style.overflow = 'hidden';
+ el.style.position = 'absolute';
+ surfaceElement.appendChild(el);
+
+ this.element_ = el;
+ this.arcScaleX_ = 1;
+ this.arcScaleY_ = 1;
+ this.lineScale_ = 1;
+ }
+
+ var contextPrototype = CanvasRenderingContext2D_.prototype;
+ contextPrototype.clearRect = function() {
+ this.element_.innerHTML = '';
+ };
+
+ contextPrototype.beginPath = function() {
+ // TODO: Branch current matrix so that save/restore has no effect
+ // as per safari docs.
+ this.currentPath_ = [];
+ };
+
+ contextPrototype.moveTo = function(aX, aY) {
+ var p = this.getCoords_(aX, aY);
+ this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y});
+ this.currentX_ = p.x;
+ this.currentY_ = p.y;
+ };
+
+ contextPrototype.lineTo = function(aX, aY) {
+ var p = this.getCoords_(aX, aY);
+ this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y});
+
+ this.currentX_ = p.x;
+ this.currentY_ = p.y;
+ };
+
+ contextPrototype.bezierCurveTo = function(aCP1x, aCP1y,
+ aCP2x, aCP2y,
+ aX, aY) {
+ var p = this.getCoords_(aX, aY);
+ var cp1 = this.getCoords_(aCP1x, aCP1y);
+ var cp2 = this.getCoords_(aCP2x, aCP2y);
+ bezierCurveTo(this, cp1, cp2, p);
+ };
+
+ // Helper function that takes the already fixed cordinates.
+ function bezierCurveTo(self, cp1, cp2, p) {
+ self.currentPath_.push({
+ type: 'bezierCurveTo',
+ cp1x: cp1.x,
+ cp1y: cp1.y,
+ cp2x: cp2.x,
+ cp2y: cp2.y,
+ x: p.x,
+ y: p.y
+ });
+ self.currentX_ = p.x;
+ self.currentY_ = p.y;
+ }
+
+ contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) {
+ // the following is lifted almost directly from
+ // http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes
+
+ var cp = this.getCoords_(aCPx, aCPy);
+ var p = this.getCoords_(aX, aY);
+
+ var cp1 = {
+ x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_),
+ y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_)
+ };
+ var cp2 = {
+ x: cp1.x + (p.x - this.currentX_) / 3.0,
+ y: cp1.y + (p.y - this.currentY_) / 3.0
+ };
+
+ bezierCurveTo(this, cp1, cp2, p);
+ };
+
+ contextPrototype.arc = function(aX, aY, aRadius,
+ aStartAngle, aEndAngle, aClockwise) {
+ aRadius *= Z;
+ var arcType = aClockwise ? 'at' : 'wa';
+
+ var xStart = aX + mc(aStartAngle) * aRadius - Z2;
+ var yStart = aY + ms(aStartAngle) * aRadius - Z2;
+
+ var xEnd = aX + mc(aEndAngle) * aRadius - Z2;
+ var yEnd = aY + ms(aEndAngle) * aRadius - Z2;
+
+ // IE won't render arches drawn counter clockwise if xStart == xEnd.
+ if (xStart == xEnd && !aClockwise) {
+ xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something
+ // that can be represented in binary
+ }
+
+ var p = this.getCoords_(aX, aY);
+ var pStart = this.getCoords_(xStart, yStart);
+ var pEnd = this.getCoords_(xEnd, yEnd);
+
+ this.currentPath_.push({type: arcType,
+ x: p.x,
+ y: p.y,
+ radius: aRadius,
+ xStart: pStart.x,
+ yStart: pStart.y,
+ xEnd: pEnd.x,
+ yEnd: pEnd.y});
+
+ };
+
+ contextPrototype.rect = function(aX, aY, aWidth, aHeight) {
+ this.moveTo(aX, aY);
+ this.lineTo(aX + aWidth, aY);
+ this.lineTo(aX + aWidth, aY + aHeight);
+ this.lineTo(aX, aY + aHeight);
+ this.closePath();
+ };
+
+ contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) {
+ var oldPath = this.currentPath_;
+ this.beginPath();
+
+ this.moveTo(aX, aY);
+ this.lineTo(aX + aWidth, aY);
+ this.lineTo(aX + aWidth, aY + aHeight);
+ this.lineTo(aX, aY + aHeight);
+ this.closePath();
+ this.stroke();
+
+ this.currentPath_ = oldPath;
+ };
+
+ contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) {
+ var oldPath = this.currentPath_;
+ this.beginPath();
+
+ this.moveTo(aX, aY);
+ this.lineTo(aX + aWidth, aY);
+ this.lineTo(aX + aWidth, aY + aHeight);
+ this.lineTo(aX, aY + aHeight);
+ this.closePath();
+ this.fill();
+
+ this.currentPath_ = oldPath;
+ };
+
+ contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) {
+ var gradient = new CanvasGradient_('gradient');
+ gradient.x0_ = aX0;
+ gradient.y0_ = aY0;
+ gradient.x1_ = aX1;
+ gradient.y1_ = aY1;
+ return gradient;
+ };
+
+ contextPrototype.createRadialGradient = function(aX0, aY0, aR0,
+ aX1, aY1, aR1) {
+ var gradient = new CanvasGradient_('gradientradial');
+ gradient.x0_ = aX0;
+ gradient.y0_ = aY0;
+ gradient.r0_ = aR0;
+ gradient.x1_ = aX1;
+ gradient.y1_ = aY1;
+ gradient.r1_ = aR1;
+ return gradient;
+ };
+
+ contextPrototype.drawImage = function(image, var_args) {
+ var dx, dy, dw, dh, sx, sy, sw, sh;
+
+ // to find the original width we overide the width and height
+ var oldRuntimeWidth = image.runtimeStyle.width;
+ var oldRuntimeHeight = image.runtimeStyle.height;
+ image.runtimeStyle.width = 'auto';
+ image.runtimeStyle.height = 'auto';
+
+ // get the original size
+ var w = image.width;
+ var h = image.height;
+
+ // and remove overides
+ image.runtimeStyle.width = oldRuntimeWidth;
+ image.runtimeStyle.height = oldRuntimeHeight;
+
+ if (arguments.length == 3) {
+ dx = arguments[1];
+ dy = arguments[2];
+ sx = sy = 0;
+ sw = dw = w;
+ sh = dh = h;
+ } else if (arguments.length == 5) {
+ dx = arguments[1];
+ dy = arguments[2];
+ dw = arguments[3];
+ dh = arguments[4];
+ sx = sy = 0;
+ sw = w;
+ sh = h;
+ } else if (arguments.length == 9) {
+ sx = arguments[1];
+ sy = arguments[2];
+ sw = arguments[3];
+ sh = arguments[4];
+ dx = arguments[5];
+ dy = arguments[6];
+ dw = arguments[7];
+ dh = arguments[8];
+ } else {
+ throw Error('Invalid number of arguments');
+ }
+
+ var d = this.getCoords_(dx, dy);
+
+ var w2 = sw / 2;
+ var h2 = sh / 2;
+
+ var vmlStr = [];
+
+ var W = 10;
+ var H = 10;
+
+ // For some reason that I've now forgotten, using divs didn't work
+ vmlStr.push(' <g_vml_:group',
+ ' coordsize="', Z * W, ',', Z * H, '"',
+ ' coordorigin="0,0"' ,
+ ' style="width:', W, 'px;height:', H, 'px;position:absolute;');
+
+ // If filters are necessary (rotation exists), create them
+ // filters are bog-slow, so only create them if abbsolutely necessary
+ // The following check doesn't account for skews (which don't exist
+ // in the canvas spec (yet) anyway.
+
+ if (this.m_[0][0] != 1 || this.m_[0][1]) {
+ var filter = [];
+
+ // Note the 12/21 reversal
+ filter.push('M11=', this.m_[0][0], ',',
+ 'M12=', this.m_[1][0], ',',
+ 'M21=', this.m_[0][1], ',',
+ 'M22=', this.m_[1][1], ',',
+ 'Dx=', mr(d.x / Z), ',',
+ 'Dy=', mr(d.y / Z), '');
+
+ // Bounding box calculation (need to minimize displayed area so that
+ // filters don't waste time on unused pixels.
+ var max = d;
+ var c2 = this.getCoords_(dx + dw, dy);
+ var c3 = this.getCoords_(dx, dy + dh);
+ var c4 = this.getCoords_(dx + dw, dy + dh);
+
+ max.x = m.max(max.x, c2.x, c3.x, c4.x);
+ max.y = m.max(max.y, c2.y, c3.y, c4.y);
+
+ vmlStr.push('padding:0 ', mr(max.x / Z), 'px ', mr(max.y / Z),
+ 'px 0;filter:progid:DXImageTransform.Microsoft.Matrix(',
+ filter.join(''), ", sizingmethod='clip');")
+ } else {
+ vmlStr.push('top:', mr(d.y / Z), 'px;left:', mr(d.x / Z), 'px;');
+ }
+
+ vmlStr.push(' ">' ,
+ '<g_vml_:image src="', image.src, '"',
+ ' style="width:', Z * dw, 'px;',
+ ' height:', Z * dh, 'px;"',
+ ' cropleft="', sx / w, '"',
+ ' croptop="', sy / h, '"',
+ ' cropright="', (w - sx - sw) / w, '"',
+ ' cropbottom="', (h - sy - sh) / h, '"',
+ ' />',
+ '</g_vml_:group>');
+
+ this.element_.insertAdjacentHTML('BeforeEnd',
+ vmlStr.join(''));
+ };
+
+ contextPrototype.stroke = function(aFill) {
+ var lineStr = [];
+ var lineOpen = false;
+ var a = processStyle(aFill ? this.fillStyle : this.strokeStyle);
+ var color = a.color;
+ var opacity = a.alpha * this.globalAlpha;
+
+ var W = 10;
+ var H = 10;
+
+ lineStr.push('<g_vml_:shape',
+ ' filled="', !!aFill, '"',
+ ' style="position:absolute;width:', W, 'px;height:', H, 'px;"',
+ ' coordorigin="0 0" coordsize="', Z * W, ' ', Z * H, '"',
+ ' stroked="', !aFill, '"',
+ ' path="');
+
+ var newSeq = false;
+ var min = {x: null, y: null};
+ var max = {x: null, y: null};
+
+ for (var i = 0; i < this.currentPath_.length; i++) {
+ var p = this.currentPath_[i];
+ var c;
+
+ switch (p.type) {
+ case 'moveTo':
+ c = p;
+ lineStr.push(' m ', mr(p.x), ',', mr(p.y));
+ break;
+ case 'lineTo':
+ lineStr.push(' l ', mr(p.x), ',', mr(p.y));
+ break;
+ case 'close':
+ lineStr.push(' x ');
+ p = null;
+ break;
+ case 'bezierCurveTo':
+ lineStr.push(' c ',
+ mr(p.cp1x), ',', mr(p.cp1y), ',',
+ mr(p.cp2x), ',', mr(p.cp2y), ',',
+ mr(p.x), ',', mr(p.y));
+ break;
+ case 'at':
+ case 'wa':
+ lineStr.push(' ', p.type, ' ',
+ mr(p.x - this.arcScaleX_ * p.radius), ',',
+ mr(p.y - this.arcScaleY_ * p.radius), ' ',
+ mr(p.x + this.arcScaleX_ * p.radius), ',',
+ mr(p.y + this.arcScaleY_ * p.radius), ' ',
+ mr(p.xStart), ',', mr(p.yStart), ' ',
+ mr(p.xEnd), ',', mr(p.yEnd));
+ break;
+ }
+
+
+ // TODO: Following is broken for curves due to
+ // move to proper paths.
+
+ // Figure out dimensions so we can do gradient fills
+ // properly
+ if (p) {
+ if (min.x == null || p.x < min.x) {
+ min.x = p.x;
+ }
+ if (max.x == null || p.x > max.x) {
+ max.x = p.x;
+ }
+ if (min.y == null || p.y < min.y) {
+ min.y = p.y;
+ }
+ if (max.y == null || p.y > max.y) {
+ max.y = p.y;
+ }
+ }
+ }
+ lineStr.push(' ">');
+
+ if (!aFill) {
+ var lineWidth = this.lineScale_ * this.lineWidth;
+
+ // VML cannot correctly render a line if the width is less than 1px.
+ // In that case, we dilute the color to make the line look thinner.
+ if (lineWidth < 1) {
+ opacity *= lineWidth;
+ }
+
+ lineStr.push(
+ '<g_vml_:stroke',
+ ' opacity="', opacity, '"',
+ ' joinstyle="', this.lineJoin, '"',
+ ' miterlimit="', this.miterLimit, '"',
+ ' endcap="', processLineCap(this.lineCap), '"',
+ ' weight="', lineWidth, 'px"',
+ ' color="', color, '" />'
+ );
+ } else if (typeof this.fillStyle == 'object') {
+ var fillStyle = this.fillStyle;
+ var angle = 0;
+ var focus = {x: 0, y: 0};
+
+ // additional offset
+ var shift = 0;
+ // scale factor for offset
+ var expansion = 1;
+
+ if (fillStyle.type_ == 'gradient') {
+ var x0 = fillStyle.x0_ / this.arcScaleX_;
+ var y0 = fillStyle.y0_ / this.arcScaleY_;
+ var x1 = fillStyle.x1_ / this.arcScaleX_;
+ var y1 = fillStyle.y1_ / this.arcScaleY_;
+ var p0 = this.getCoords_(x0, y0);
+ var p1 = this.getCoords_(x1, y1);
+ var dx = p1.x - p0.x;
+ var dy = p1.y - p0.y;
+ angle = Math.atan2(dx, dy) * 180 / Math.PI;
+
+ // The angle should be a non-negative number.
+ if (angle < 0) {
+ angle += 360;
+ }
+
+ // Very small angles produce an unexpected result because they are
+ // converted to a scientific notation string.
+ if (angle < 1e-6) {
+ angle = 0;
+ }
+ } else {
+ var p0 = this.getCoords_(fillStyle.x0_, fillStyle.y0_);
+ var width = max.x - min.x;
+ var height = max.y - min.y;
+ focus = {
+ x: (p0.x - min.x) / width,
+ y: (p0.y - min.y) / height
+ };
+
+ width /= this.arcScaleX_ * Z;
+ height /= this.arcScaleY_ * Z;
+ var dimension = m.max(width, height);
+ shift = 2 * fillStyle.r0_ / dimension;
+ expansion = 2 * fillStyle.r1_ / dimension - shift;
+ }
+
+ // We need to sort the color stops in ascending order by offset,
+ // otherwise IE won't interpret it correctly.
+ var stops = fillStyle.colors_;
+ stops.sort(function(cs1, cs2) {
+ return cs1.offset - cs2.offset;
+ });
+
+ var length = stops.length;
+ var color1 = stops[0].color;
+ var color2 = stops[length - 1].color;
+ var opacity1 = stops[0].alpha * this.globalAlpha;
+ var opacity2 = stops[length - 1].alpha * this.globalAlpha;
+
+ var colors = [];
+ for (var i = 0; i < length; i++) {
+ var stop = stops[i];
+ colors.push(stop.offset * expansion + shift + ' ' + stop.color);
+ }
+
+ // When colors attribute is used, the meanings of opacity and o:opacity2
+ // are reversed.
+ lineStr.push('<g_vml_:fill type="', fillStyle.type_, '"',
+ ' method="none" focus="100%"',
+ ' color="', color1, '"',
+ ' color2="', color2, '"',
+ ' colors="', colors.join(','), '"',
+ ' opacity="', opacity2, '"',
+ ' g_o_:opacity2="', opacity1, '"',
+ ' angle="', angle, '"',
+ ' focusposition="', focus.x, ',', focus.y, '" />');
+ } else {
+ lineStr.push('<g_vml_:fill color="', color, '" opacity="', opacity,
+ '" />');
+ }
+
+ lineStr.push('</g_vml_:shape>');
+
+ this.element_.insertAdjacentHTML('beforeEnd', lineStr.join(''));
+ };
+
+ contextPrototype.fill = function() {
+ this.stroke(true);
+ }
+
+ contextPrototype.closePath = function() {
+ this.currentPath_.push({type: 'close'});
+ };
+
+ /**
+ * @private
+ */
+ contextPrototype.getCoords_ = function(aX, aY) {
+ var m = this.m_;
+ return {
+ x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2,
+ y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2
+ }
+ };
+
+ contextPrototype.save = function() {
+ var o = {};
+ copyState(this, o);
+ this.aStack_.push(o);
+ this.mStack_.push(this.m_);
+ this.m_ = matrixMultiply(createMatrixIdentity(), this.m_);
+ };
+
+ contextPrototype.restore = function() {
+ copyState(this.aStack_.pop(), this);
+ this.m_ = this.mStack_.pop();
+ };
+
+ function matrixIsFinite(m) {
+ for (var j = 0; j < 3; j++) {
+ for (var k = 0; k < 2; k++) {
+ if (!isFinite(m[j][k]) || isNaN(m[j][k])) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ function setM(ctx, m, updateLineScale) {
+ if (!matrixIsFinite(m)) {
+ return;
+ }
+ ctx.m_ = m;
+
+ if (updateLineScale) {
+ // Get the line scale.
+ // Determinant of this.m_ means how much the area is enlarged by the
+ // transformation. So its square root can be used as a scale factor
+ // for width.
+ var det = m[0][0] * m[1][1] - m[0][1] * m[1][0];
+ ctx.lineScale_ = sqrt(abs(det));
+ }
+ }
+
+ contextPrototype.translate = function(aX, aY) {
+ var m1 = [
+ [1, 0, 0],
+ [0, 1, 0],
+ [aX, aY, 1]
+ ];
+
+ setM(this, matrixMultiply(m1, this.m_), false);
+ };
+
+ contextPrototype.rotate = function(aRot) {
+ var c = mc(aRot);
+ var s = ms(aRot);
+
+ var m1 = [
+ [c, s, 0],
+ [-s, c, 0],
+ [0, 0, 1]
+ ];
+
+ setM(this, matrixMultiply(m1, this.m_), false);
+ };
+
+ contextPrototype.scale = function(aX, aY) {
+ this.arcScaleX_ *= aX;
+ this.arcScaleY_ *= aY;
+ var m1 = [
+ [aX, 0, 0],
+ [0, aY, 0],
+ [0, 0, 1]
+ ];
+
+ setM(this, matrixMultiply(m1, this.m_), true);
+ };
+
+ contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) {
+ var m1 = [
+ [m11, m12, 0],
+ [m21, m22, 0],
+ [dx, dy, 1]
+ ];
+
+ setM(this, matrixMultiply(m1, this.m_), true);
+ };
+
+ contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) {
+ var m = [
+ [m11, m12, 0],
+ [m21, m22, 0],
+ [dx, dy, 1]
+ ];
+
+ setM(this, m, true);
+ };
+
+ /******** STUBS ********/
+ contextPrototype.clip = function() {
+ // TODO: Implement
+ };
+
+ contextPrototype.arcTo = function() {
+ // TODO: Implement
+ };
+
+ contextPrototype.createPattern = function() {
+ return new CanvasPattern_;
+ };
+
+ // Gradient / Pattern Stubs
+ function CanvasGradient_(aType) {
+ this.type_ = aType;
+ this.x0_ = 0;
+ this.y0_ = 0;
+ this.r0_ = 0;
+ this.x1_ = 0;
+ this.y1_ = 0;
+ this.r1_ = 0;
+ this.colors_ = [];
+ }
+
+ CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) {
+ aColor = processStyle(aColor);
+ this.colors_.push({offset: aOffset,
+ color: aColor.color,
+ alpha: aColor.alpha});
+ };
+
+ function CanvasPattern_() {}
+
+ // set up externs
+ G_vmlCanvasManager = G_vmlCanvasManager_;
+ CanvasRenderingContext2D = CanvasRenderingContext2D_;
+ CanvasGradient = CanvasGradient_;
+ CanvasPattern = CanvasPattern_;
+
+})();
+
+} // if
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.js
new file mode 100644
index 00000000..23847845
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.js
@@ -0,0 +1,333 @@
+ function moveV3(event, g, context) {
+ if (context.isPanning) {
+ Dygraph.movePan(event, g, context);
+ } else if (context.isZooming) {
+ Dygraph.moveZoom(event, g, context);
+ }
+ }
+
+ function upV3(event, g, context) {
+ if (context.isPanning) {
+ Dygraph.endPan(event, g, context);
+ } else if (context.isZooming) {
+ Dygraph.endZoom(event, g, context);
+ }
+ }
+
+// Take the offset of a mouse event on the dygraph canvas and
+// convert it to a pair of percentages from the bottom left.
+// (Not top left, bottom is where the lower value is.)
+function offsetToPercentage(g, offsetX, offsetY) {
+ // This is calculating the pixel offset of the leftmost date.
+ var xOffset = g.toDomCoords(g.xAxisRange()[0], null)[0];
+ var yar0 = g.yAxisRange(0);
+
+ // This is calculating the pixel of the higest value. (Top pixel)
+ var yOffset = g.toDomCoords(null, yar0[1])[1];
+
+ // x y w and h are relative to the corner of the drawing area,
+ // so that the upper corner of the drawing area is (0, 0).
+ var x = offsetX - xOffset;
+ var y = offsetY - yOffset;
+
+ // This is computing the rightmost pixel, effectively defining the
+ // width.
+ var w = g.toDomCoords(g.xAxisRange()[1], null)[0] - xOffset;
+
+ // This is computing the lowest pixel, effectively defining the height.
+ var h = g.toDomCoords(null, yar0[0])[1] - yOffset;
+
+ // Percentage from the left.
+ var xPct = w == 0 ? 0 : (x / w);
+ // Percentage from the top.
+ var yPct = h == 0 ? 0 : (y / h);
+
+ // The (1-) part below changes it from "% distance down from the top"
+ // to "% distance up from the bottom".
+ return [xPct, (1-yPct)];
+}
+
+function dblClickV3(event, g, context) {
+ // Reducing by 20% makes it 80% the original size, which means
+ // to restore to original size it must grow by 25%
+ /*
+ if (!(event.offsetX && event.offsetY)){
+ event.offsetX = event.layerX - event.target.offsetLeft;
+ event.offsetY = event.layerY - event.target.offsetTop;
+ }
+
+ var percentages = offsetToPercentage(g, event.offsetX, event.offsetY);
+ var xPct = percentages[0];
+ var yPct = percentages[1];
+
+ if (event.ctrlKey) {
+ zoom(g, -.25, xPct, yPct);
+ } else {
+ zoom(g, +.2, xPct, yPct);
+ }
+ */
+ restorePositioning(g);
+}
+
+var lastClickedGraph = null;
+
+function clickV3(event, g, context) {
+ lastClickedGraph = g;
+ Dygraph.cancelEvent(event);
+}
+
+function scrollV3(event, g, context) {
+ if (lastClickedGraph != g) {
+ return;
+ }
+ var normal = event.detail ? event.detail * -1 : event.wheelDelta / 40;
+ // For me the normalized value shows 0.075 for one click. If I took
+ // that verbatim, it would be a 7.5%.
+ var percentage = normal / 50;
+
+ if (!(event.offsetX && event.offsetY)){
+ event.offsetX = event.layerX - event.target.offsetLeft;
+ event.offsetY = event.layerY - event.target.offsetTop;
+ }
+
+ var percentages = offsetToPercentage(g, event.offsetX, event.offsetY);
+ var xPct = percentages[0];
+ var yPct = percentages[1];
+
+ zoom(g, percentage, xPct, yPct);
+ Dygraph.cancelEvent(event);
+}
+
+// Adjusts [x, y] toward each other by zoomInPercentage%
+// Split it so the left/bottom axis gets xBias/yBias of that change and
+// tight/top gets (1-xBias)/(1-yBias) of that change.
+//
+// If a bias is missing it splits it down the middle.
+function zoom(g, zoomInPercentage, xBias, yBias) {
+ xBias = xBias || 0.5;
+ yBias = yBias || 0.5;
+ function adjustAxis(axis, zoomInPercentage, bias) {
+ var delta = axis[1] - axis[0];
+ var increment = delta * zoomInPercentage;
+ var foo = [increment * bias, increment * (1-bias)];
+ return [ axis[0] + foo[0], axis[1] - foo[1] ];
+ }
+ var yAxes = g.yAxisRanges();
+ var newYAxes = [];
+ for (var i = 0; i < yAxes.length; i++) {
+ newYAxes[i] = adjustAxis(yAxes[i], zoomInPercentage, yBias);
+ }
+
+ g.updateOptions({
+ dateWindow: adjustAxis(g.xAxisRange(), zoomInPercentage, xBias),
+ valueRange: newYAxes[0]
+ });
+}
+
+function restorePositioning(g) {
+ g.updateOptions({
+ dateWindow: null,
+ valueRange: null
+ });
+}
+
+function zoom_custom(res) {
+ var w = g.xAxisRange();
+ desired_range = [w[0] - res * 1000, w[0] ];
+ animate();
+}
+
+function reset() {
+ desired_range = orig_range;
+ animate();
+}
+
+var click = 0;
+var desired_range = null;
+function approach_range() {
+ if (!desired_range) return;
+ // go halfway there
+ var range = g.xAxisRange();
+ if (Math.abs(desired_range[0] - range[0]) < 60 &&
+ Math.abs(desired_range[1] - range[1]) < 60) {
+ if(desired_range[0]>=orig_range[0])
+ g.updateOptions({dateWindow: desired_range});
+ else {
+ g.updateOptions({dateWindow: orig_range});
+ click = 8;
+ }
+ // (do not set another timeout.)
+ } else {
+ var new_range;
+ new_range = [0.5 * (desired_range[0] + range[0]),
+ 0.5 * (desired_range[1] + range[1])];
+ g.updateOptions({dateWindow: new_range});
+ animate();
+ }
+}
+
+function animate() {
+ setTimeout(approach_range, 50);
+}
+
+
+var v4Active = false;
+var v4Canvas = null;
+
+function downV4(event, g, context) {
+ context.initializeMouseDown(event, g, context);
+
+ Dygraph.Interaction.startTouch(event, g, context);
+
+ Dygraph.Interaction.moveTouch(event, g, context);
+
+ Dygraph.Interaction.endTouch(event, g, context);
+
+ v4Active = true;
+ moveV4(event, g, context); // in case the mouse went down on a data point.
+}
+
+var processed = [];
+
+function moveV4(event, g, context) {
+ var RANGE = 7;
+
+ if (v4Active) {
+ var graphPos = Dygraph.findPos(g.graphDiv);
+ var canvasx = Dygraph.pageX(event) - graphPos.x;
+ var canvasy = Dygraph.pageY(event) - graphPos.y;
+
+ var rows = g.numRows();
+ // Row layout:
+ // [date, [val1, stdev1], [val2, stdev2]]
+ for (var row = 0; row < rows; row++) {
+ var date = g.getValue(row, 0);
+ var x = g.toDomCoords(date, null)[0];
+ var diff = Math.abs(canvasx - x);
+ if (diff < RANGE) {
+ for (var col = 1; col < 3; col++) {
+ // TODO(konigsberg): these will throw exceptions as data is removed.
+ var vals = g.getValue(row, col);
+ if (vals == null) { continue; }
+ var val = vals[0];
+ var y = g.toDomCoords(null, val)[1];
+ var diff2 = Math.abs(canvasy - y);
+ if (diff2 < RANGE) {
+ var found = false;
+ for (var i in processed) {
+ var stored = processed[i];
+ if(stored[0] == row && stored[1] == col) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ //processed.push([row, col]);
+ //drawV4(x, y);
+ }
+ return;
+ }
+ }
+ }
+ }
+ }
+}
+
+function upV4(event, g, context) {
+ if (v4Active) {
+ v4Active = false;
+ }
+}
+
+function dblClickV4(event, g, context) {
+ restorePositioning(g);
+}
+
+function drawV4(x, y) {
+ var ctx = v4Canvas;
+
+ ctx.strokeStyle = "#000000";
+ //ctx.fillStyle = "#FFFF00";
+ ctx.fillStyle = "#FF0000";
+ ctx.beginPath();
+ ctx.arc(x,y,5,0,Math.PI*2,true);
+ ctx.closePath();
+ ctx.stroke();
+ ctx.fill();
+}
+
+function captureCanvas(canvas, area, g) {
+ v4Canvas = canvas;
+}
+
+function newDygraphTouchstart(event, g, context) {
+// This right here is what prevents IOS from doing its own zoom/touch behavior
+// It stops the node from being selected too
+event.preventDefault(); // touch browsers are all nice.
+
+if (event.touches.length > 1) {
+// If the user ever puts two fingers down, it's not a double tap.
+context.startTimeForDoubleTapMs = null;
+}
+
+var touches = [];
+for (var i = 0; i < event.touches.length; i++) {
+var t = event.touches[i];
+// we dispense with 'dragGetX_' because all touchBrowsers support pageX
+touches.push({
+pageX: t.pageX,
+pageY: t.pageY,
+dataX: g.toDataXCoord(t.pageX),
+dataY: g.toDataYCoord(t.pageY)
+// identifier: t.identifier
+});
+}
+context.initialTouches = touches;
+
+if (touches.length == 1) {
+// This is just a swipe.
+context.initialPinchCenter = touches[0];
+context.touchDirections = { x: true, y: true };
+
+// ADDITION - this needs to select the points
+//var closestTouchP = g.findClosestPoint(touches[0].pageX,touches[0].pageY);
+//if(closestTouchP) {
+//var selectionChanged = g.setSelection(closestTouchP.row, closestTouchP.seriesName);
+//}
+g.mouseMove_(event);
+
+} else if (touches.length >= 2) {
+// It's become a pinch!
+// In case there are 3+ touches, we ignore all but the "first" two.
+
+// only screen coordinates can be averaged (data coords could be log scale).
+context.initialPinchCenter = {
+pageX: 0.5 * (touches[0].pageX + touches[1].pageX),
+pageY: 0.5 * (touches[0].pageY + touches[1].pageY),
+
+// TODO(danvk): remove
+dataX: 0.5 * (touches[0].dataX + touches[1].dataX),
+dataY: 0.5 * (touches[0].dataY + touches[1].dataY)
+};
+
+// Make pinches in a 45-degree swath around either axis 1-dimensional zooms.
+var initialAngle = 180 / Math.PI * Math.atan2(
+context.initialPinchCenter.pageY - touches[0].pageY,
+touches[0].pageX - context.initialPinchCenter.pageX);
+
+// use symmetry to get it into the first quadrant.
+initialAngle = Math.abs(initialAngle);
+if (initialAngle > 90) initialAngle = 90 - initialAngle;
+
+context.touchDirections = {
+x: (initialAngle < (90 - 45/2)),
+y: (initialAngle > 45/2)
+};
+}
+
+// save the full x & y ranges.
+context.initialRange = {
+x: g.xAxisRange(),
+y: g.yAxisRange()
+};
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.min.js
new file mode 100644
index 00000000..e3f736a8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.min.js
@@ -0,0 +1 @@
+function moveV3(e,t,n){if(n.isPanning){Dygraph.movePan(e,t,n)}else if(n.isZooming){Dygraph.moveZoom(e,t,n)}}function upV3(e,t,n){if(n.isPanning){Dygraph.endPan(e,t,n)}else if(n.isZooming){Dygraph.endZoom(e,t,n)}}function offsetToPercentage(e,t,n){var r=e.toDomCoords(e.xAxisRange()[0],null)[0];var i=e.yAxisRange(0);var s=e.toDomCoords(null,i[1])[1];var o=t-r;var u=n-s;var a=e.toDomCoords(e.xAxisRange()[1],null)[0]-r;var f=e.toDomCoords(null,i[0])[1]-s;var l=a==0?0:o/a;var c=f==0?0:u/f;return[l,1-c]}function dblClickV3(e,t,n){restorePositioning(t)}function clickV3(e,t,n){lastClickedGraph=t;Dygraph.cancelEvent(e)}function scrollV3(e,t,n){if(lastClickedGraph!=t){return}var r=e.detail?e.detail*-1:e.wheelDelta/40;var i=r/50;if(!(e.offsetX&&e.offsetY)){e.offsetX=e.layerX-e.target.offsetLeft;e.offsetY=e.layerY-e.target.offsetTop}var s=offsetToPercentage(t,e.offsetX,e.offsetY);var o=s[0];var u=s[1];zoom(t,i,o,u);Dygraph.cancelEvent(e)}function zoom(e,t,n,r){function i(e,t,n){var r=e[1]-e[0];var i=r*t;var s=[i*n,i*(1-n)];return[e[0]+s[0],e[1]-s[1]]}n=n||.5;r=r||.5;var s=e.yAxisRanges();var o=[];for(var u=0;u<s.length;u++){o[u]=i(s[u],t,r)}e.updateOptions({dateWindow:i(e.xAxisRange(),t,n),valueRange:o[0]})}function restorePositioning(e){e.updateOptions({dateWindow:null,valueRange:null})}function zoom_custom(e){var t=g.xAxisRange();desired_range=[t[0]-e*1e3,t[0]];animate()}function reset(){desired_range=orig_range;animate()}function approach_range(){if(!desired_range)return;var e=g.xAxisRange();if(Math.abs(desired_range[0]-e[0])<60&&Math.abs(desired_range[1]-e[1])<60){if(desired_range[0]>=orig_range[0])g.updateOptions({dateWindow:desired_range});else{g.updateOptions({dateWindow:orig_range});click=8}}else{var t;t=[.5*(desired_range[0]+e[0]),.5*(desired_range[1]+e[1])];g.updateOptions({dateWindow:t});animate()}}function animate(){setTimeout(approach_range,50)}function downV4(e,t,n){n.initializeMouseDown(e,t,n);Dygraph.Interaction.startTouch(e,t,n);Dygraph.Interaction.moveTouch(e,t,n);Dygraph.Interaction.endTouch(e,t,n);v4Active=true;moveV4(e,t,n)}function moveV4(e,t,n){var r=7;if(v4Active){var i=Dygraph.findPos(t.graphDiv);var s=Dygraph.pageX(e)-i.x;var o=Dygraph.pageY(e)-i.y;var u=t.numRows();for(var a=0;a<u;a++){var f=t.getValue(a,0);var l=t.toDomCoords(f,null)[0];var c=Math.abs(s-l);if(c<r){for(var h=1;h<3;h++){var p=t.getValue(a,h);if(p==null){continue}var d=p[0];var v=t.toDomCoords(null,d)[1];var m=Math.abs(o-v);if(m<r){var g=false;for(var y in processed){var b=processed[y];if(b[0]==a&&b[1]==h){g=true;break}}if(!g){}return}}}}}}function upV4(e,t,n){if(v4Active){v4Active=false}}function dblClickV4(e,t,n){restorePositioning(t)}function drawV4(e,t){var n=v4Canvas;n.strokeStyle="#000000";n.fillStyle="#FF0000";n.beginPath();n.arc(e,t,5,0,Math.PI*2,true);n.closePath();n.stroke();n.fill()}function captureCanvas(e,t,n){v4Canvas=e}function newDygraphTouchstart(e,t,n){e.preventDefault();if(e.touches.length>1){n.startTimeForDoubleTapMs=null}var r=[];for(var i=0;i<e.touches.length;i++){var s=e.touches[i];r.push({pageX:s.pageX,pageY:s.pageY,dataX:t.toDataXCoord(s.pageX),dataY:t.toDataYCoord(s.pageY)})}n.initialTouches=r;if(r.length==1){n.initialPinchCenter=r[0];n.touchDirections={x:true,y:true};t.mouseMove_(e)}else if(r.length>=2){n.initialPinchCenter={pageX:.5*(r[0].pageX+r[1].pageX),pageY:.5*(r[0].pageY+r[1].pageY),dataX:.5*(r[0].dataX+r[1].dataX),dataY:.5*(r[0].dataY+r[1].dataY)};var o=180/Math.PI*Math.atan2(n.initialPinchCenter.pageY-r[0].pageY,r[0].pageX-n.initialPinchCenter.pageX);o=Math.abs(o);if(o>90)o=90-o;n.touchDirections={x:o<90-45/2,y:o>45/2}}n.initialRange={x:t.xAxisRange(),y:t.yAxisRange()}}var lastClickedGraph=null;var click=0;var desired_range=null;var v4Active=false;var v4Canvas=null;var processed=[]; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction_sun.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction_sun.js
new file mode 100644
index 00000000..92a0dbd7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction_sun.js
@@ -0,0 +1,303 @@
+// Code for a variety of interaction models. Used in interaction.html, but split out from
+// that file so they can be tested in isolation.
+//
+function downV3(event, g, context) {
+ context.initializeMouseDown(event, g, context);
+ if (event.altKey || event.shiftKey) {
+ Dygraph.startZoom(event, g, context);
+ } else {
+ Dygraph.startPan(event, g, context);
+ }
+}
+
+function moveV3(event, g, context) {
+ if (context.isPanning) {
+ Dygraph.movePan(event, g, context);
+ } else if (context.isZooming) {
+ Dygraph.moveZoom(event, g, context);
+ }
+}
+
+function upV3(event, g, context) {
+ if (context.isPanning) {
+ Dygraph.endPan(event, g, context);
+ } else if (context.isZooming) {
+ Dygraph.endZoom(event, g, context);
+ }
+}
+
+// Take the offset of a mouse event on the dygraph canvas and
+// convert it to a pair of percentages from the bottom left.
+// (Not top left, bottom is where the lower value is.)
+function offsetToPercentage(g, offsetX, offsetY) {
+ // This is calculating the pixel offset of the leftmost date.
+ var xOffset = g.toDomCoords(g.xAxisRange()[0], null)[0];
+ var yar0 = g.yAxisRange(0);
+
+ // This is calculating the pixel of the higest value. (Top pixel)
+ var yOffset = g.toDomCoords(null, yar0[1])[1];
+
+ // x y w and h are relative to the corner of the drawing area,
+ // so that the upper corner of the drawing area is (0, 0).
+ var x = offsetX - xOffset;
+ var y = offsetY - yOffset;
+
+ // This is computing the rightmost pixel, effectively defining the
+ // width.
+ var w = g.toDomCoords(g.xAxisRange()[1], null)[0] - xOffset;
+
+ // This is computing the lowest pixel, effectively defining the height.
+ var h = g.toDomCoords(null, yar0[0])[1] - yOffset;
+
+ // Percentage from the left.
+ var xPct = w == 0 ? 0 : (x / w);
+ // Percentage from the top.
+ var yPct = h == 0 ? 0 : (y / h);
+
+ // The (1-) part below changes it from "% distance down from the top"
+ // to "% distance up from the bottom".
+ return [xPct, (1-yPct)];
+}
+
+function dblClickV3(event, g, context) {
+ // Reducing by 20% makes it 80% the original size, which means
+ // to restore to original size it must grow by 25%
+
+ if (!(event.offsetX && event.offsetY)){
+ event.offsetX = event.layerX - event.target.offsetLeft;
+ event.offsetY = event.layerY - event.target.offsetTop;
+ }
+
+ var percentages = offsetToPercentage(g, event.offsetX, event.offsetY);
+ var xPct = percentages[0];
+ var yPct = percentages[1];
+
+ if (event.ctrlKey) {
+ zoom(g, -.25, xPct, yPct);
+ } else {
+ zoom(g, +.2, xPct, yPct);
+ }
+}
+
+var lastClickedGraph = null;
+
+function clickV3(event, g, context) {
+ lastClickedGraph = g;
+ Dygraph.cancelEvent(event);
+}
+
+function scrollV3(event, g, context) {
+ if (lastClickedGraph != g) {
+ return;
+ }
+ var normal = event.detail ? event.detail * -1 : event.wheelDelta / 40;
+ // For me the normalized value shows 0.075 for one click. If I took
+ // that verbatim, it would be a 7.5%.
+ var percentage = normal / 50;
+
+ if (!(event.offsetX && event.offsetY)){
+ event.offsetX = event.layerX - event.target.offsetLeft;
+ event.offsetY = event.layerY - event.target.offsetTop;
+ }
+
+ var percentages = offsetToPercentage(g, event.offsetX, event.offsetY);
+ var xPct = percentages[0];
+ var yPct = percentages[1];
+
+ zoom(g, percentage, xPct, yPct);
+ Dygraph.cancelEvent(event);
+}
+
+// Adjusts [x, y] toward each other by zoomInPercentage%
+// Split it so the left/bottom axis gets xBias/yBias of that change and
+// tight/top gets (1-xBias)/(1-yBias) of that change.
+//
+// If a bias is missing it splits it down the middle.
+function zoom(g, zoomInPercentage, xBias, yBias) {
+ xBias = xBias || 0.5;
+ yBias = yBias || 0.5;
+ function adjustAxis(axis, zoomInPercentage, bias) {
+ var delta = axis[1] - axis[0];
+ var increment = delta * zoomInPercentage;
+ var foo = [increment * bias, increment * (1-bias)];
+ return [ axis[0] + foo[0], axis[1] - foo[1] ];
+ }
+ var yAxes = g.yAxisRanges();
+ var newYAxes = [];
+ for (var i = 0; i < yAxes.length; i++) {
+ newYAxes[i] = adjustAxis(yAxes[i], zoomInPercentage, yBias);
+ }
+
+ g.updateOptions({
+ dateWindow: adjustAxis(g.xAxisRange(), zoomInPercentage, xBias),
+ valueRange: newYAxes[0]
+ });
+}
+
+var v4Active = false;
+var v4Canvas = null;
+
+function downV4(event, g, context) {
+ context.initializeMouseDown(event, g, context);
+
+ Dygraph.Interaction.startTouch(event, g, context);
+
+ Dygraph.Interaction.moveTouch(event, g, context);
+
+ Dygraph.Interaction.endTouch(event, g, context);
+
+ v4Active = true;
+ moveV4(event, g, context); // in case the mouse went down on a data point.
+}
+
+var processed = [];
+
+function moveV4(event, g, context) {
+ var RANGE = 7;
+
+ if (v4Active) {
+ var graphPos = Dygraph.findPos(g.graphDiv);
+ var canvasx = Dygraph.pageX(event) - graphPos.x;
+ var canvasy = Dygraph.pageY(event) - graphPos.y;
+
+ var rows = g.numRows();
+ // Row layout:
+ // [date, [val1, stdev1], [val2, stdev2]]
+ for (var row = 0; row < rows; row++) {
+ var date = g.getValue(row, 0);
+ var x = g.toDomCoords(date, null)[0];
+ var diff = Math.abs(canvasx - x);
+ if (diff < RANGE) {
+ for (var col = 1; col < 3; col++) {
+ // TODO(konigsberg): these will throw exceptions as data is removed.
+ var vals = g.getValue(row, col);
+ if (vals == null) { continue; }
+ var val = vals[0];
+ var y = g.toDomCoords(null, val)[1];
+ var diff2 = Math.abs(canvasy - y);
+ if (diff2 < RANGE) {
+ var found = false;
+ for (var i in processed) {
+ var stored = processed[i];
+ if(stored[0] == row && stored[1] == col) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ //processed.push([row, col]);
+ //drawV4(x, y);
+ }
+ return;
+ }
+ }
+ }
+ }
+ }
+}
+
+function upV4(event, g, context) {
+ if (v4Active) {
+ v4Active = false;
+ }
+}
+
+function dblClickV4(event, g, context) {
+ restorePositioning(g);
+}
+
+function drawV4(x, y) {
+ var ctx = v4Canvas;
+
+ ctx.strokeStyle = "#000000";
+ //ctx.fillStyle = "#FFFF00";
+ ctx.fillStyle = "#FF0000";
+ ctx.beginPath();
+ ctx.arc(x,y,5,0,Math.PI*2,true);
+ ctx.closePath();
+ ctx.stroke();
+ ctx.fill();
+}
+
+function captureCanvas(canvas, area, g) {
+ v4Canvas = canvas;
+}
+
+function restorePositioning(g) {
+ g.updateOptions({
+ dateWindow: null,
+ valueRange: null
+ });
+}
+
+function newDygraphTouchstart(event, g, context) {
+// This right here is what prevents IOS from doing its own zoom/touch behavior
+// It stops the node from being selected too
+event.preventDefault(); // touch browsers are all nice.
+
+if (event.touches.length > 1) {
+// If the user ever puts two fingers down, it's not a double tap.
+context.startTimeForDoubleTapMs = null;
+}
+
+var touches = [];
+for (var i = 0; i < event.touches.length; i++) {
+var t = event.touches[i];
+// we dispense with 'dragGetX_' because all touchBrowsers support pageX
+touches.push({
+pageX: t.pageX,
+pageY: t.pageY,
+dataX: g.toDataXCoord(t.pageX),
+dataY: g.toDataYCoord(t.pageY)
+// identifier: t.identifier
+});
+}
+context.initialTouches = touches;
+
+if (touches.length == 1) {
+// This is just a swipe.
+context.initialPinchCenter = touches[0];
+context.touchDirections = { x: true, y: true };
+
+// ADDITION - this needs to select the points
+//var closestTouchP = g.findClosestPoint(touches[0].pageX,touches[0].pageY);
+//if(closestTouchP) {
+//var selectionChanged = g.setSelection(closestTouchP.row, closestTouchP.seriesName);
+//}
+g.mouseMove_(event);
+
+} else if (touches.length >= 2) {
+// It's become a pinch!
+// In case there are 3+ touches, we ignore all but the "first" two.
+
+// only screen coordinates can be averaged (data coords could be log scale).
+context.initialPinchCenter = {
+pageX: 0.5 * (touches[0].pageX + touches[1].pageX),
+pageY: 0.5 * (touches[0].pageY + touches[1].pageY),
+
+// TODO(danvk): remove
+dataX: 0.5 * (touches[0].dataX + touches[1].dataX),
+dataY: 0.5 * (touches[0].dataY + touches[1].dataY)
+};
+
+// Make pinches in a 45-degree swath around either axis 1-dimensional zooms.
+var initialAngle = 180 / Math.PI * Math.atan2(
+context.initialPinchCenter.pageY - touches[0].pageY,
+touches[0].pageX - context.initialPinchCenter.pageX);
+
+// use symmetry to get it into the first quadrant.
+initialAngle = Math.abs(initialAngle);
+if (initialAngle > 90) initialAngle = 90 - initialAngle;
+
+context.touchDirections = {
+x: (initialAngle < (90 - 45/2)),
+y: (initialAngle > 45/2)
+};
+}
+
+// save the full x & y ranges.
+context.initialRange = {
+x: g.xAxisRange(),
+y: g.yAxisRange()
+};
+}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/moment.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/moment.min.js
new file mode 100644
index 00000000..62b1697b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/moment.min.js
@@ -0,0 +1,6 @@
+// moment.js
+// version : 2.1.0
+// author : Tim Wood
+// license : MIT
+// momentjs.com
+!function(t){function e(t,e){return function(n){return u(t.call(this,n),e)}}function n(t,e){return function(n){return this.lang().ordinal(t.call(this,n),e)}}function s(){}function i(t){a(this,t)}function r(t){var e=t.years||t.year||t.y||0,n=t.months||t.month||t.M||0,s=t.weeks||t.week||t.w||0,i=t.days||t.day||t.d||0,r=t.hours||t.hour||t.h||0,a=t.minutes||t.minute||t.m||0,o=t.seconds||t.second||t.s||0,u=t.milliseconds||t.millisecond||t.ms||0;this._input=t,this._milliseconds=u+1e3*o+6e4*a+36e5*r,this._days=i+7*s,this._months=n+12*e,this._data={},this._bubble()}function a(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function o(t){return 0>t?Math.ceil(t):Math.floor(t)}function u(t,e){for(var n=t+"";n.length<e;)n="0"+n;return n}function h(t,e,n,s){var i,r,a=e._milliseconds,o=e._days,u=e._months;a&&t._d.setTime(+t._d+a*n),(o||u)&&(i=t.minute(),r=t.hour()),o&&t.date(t.date()+o*n),u&&t.month(t.month()+u*n),a&&!s&&H.updateOffset(t),(o||u)&&(t.minute(i),t.hour(r))}function d(t){return"[object Array]"===Object.prototype.toString.call(t)}function c(t,e){var n,s=Math.min(t.length,e.length),i=Math.abs(t.length-e.length),r=0;for(n=0;s>n;n++)~~t[n]!==~~e[n]&&r++;return r+i}function f(t){return t?ie[t]||t.toLowerCase().replace(/(.)s$/,"$1"):t}function l(t,e){return e.abbr=t,x[t]||(x[t]=new s),x[t].set(e),x[t]}function _(t){if(!t)return H.fn._lang;if(!x[t]&&A)try{require("./lang/"+t)}catch(e){return H.fn._lang}return x[t]}function m(t){return t.match(/\[.*\]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function y(t){var e,n,s=t.match(E);for(e=0,n=s.length;n>e;e++)s[e]=ue[s[e]]?ue[s[e]]:m(s[e]);return function(i){var r="";for(e=0;n>e;e++)r+=s[e]instanceof Function?s[e].call(i,t):s[e];return r}}function M(t,e){function n(e){return t.lang().longDateFormat(e)||e}for(var s=5;s--&&N.test(e);)e=e.replace(N,n);return re[e]||(re[e]=y(e)),re[e](t)}function g(t,e){switch(t){case"DDDD":return V;case"YYYY":return X;case"YYYYY":return $;case"S":case"SS":case"SSS":case"DDD":return I;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return R;case"a":case"A":return _(e._l)._meridiemParse;case"X":return B;case"Z":case"ZZ":return j;case"T":return q;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return J;default:return new RegExp(t.replace("\\",""))}}function p(t){var e=(j.exec(t)||[])[0],n=(e+"").match(ee)||["-",0,0],s=+(60*n[1])+~~n[2];return"+"===n[0]?-s:s}function D(t,e,n){var s,i=n._a;switch(t){case"M":case"MM":i[1]=null==e?0:~~e-1;break;case"MMM":case"MMMM":s=_(n._l).monthsParse(e),null!=s?i[1]=s:n._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":null!=e&&(i[2]=~~e);break;case"YY":i[0]=~~e+(~~e>68?1900:2e3);break;case"YYYY":case"YYYYY":i[0]=~~e;break;case"a":case"A":n._isPm=_(n._l).isPM(e);break;case"H":case"HH":case"h":case"hh":i[3]=~~e;break;case"m":case"mm":i[4]=~~e;break;case"s":case"ss":i[5]=~~e;break;case"S":case"SS":case"SSS":i[6]=~~(1e3*("0."+e));break;case"X":n._d=new Date(1e3*parseFloat(e));break;case"Z":case"ZZ":n._useUTC=!0,n._tzm=p(e)}null==e&&(n._isValid=!1)}function Y(t){var e,n,s=[];if(!t._d){for(e=0;7>e;e++)t._a[e]=s[e]=null==t._a[e]?2===e?1:0:t._a[e];s[3]+=~~((t._tzm||0)/60),s[4]+=~~((t._tzm||0)%60),n=new Date(0),t._useUTC?(n.setUTCFullYear(s[0],s[1],s[2]),n.setUTCHours(s[3],s[4],s[5],s[6])):(n.setFullYear(s[0],s[1],s[2]),n.setHours(s[3],s[4],s[5],s[6])),t._d=n}}function w(t){var e,n,s=t._f.match(E),i=t._i;for(t._a=[],e=0;e<s.length;e++)n=(g(s[e],t).exec(i)||[])[0],n&&(i=i.slice(i.indexOf(n)+n.length)),ue[s[e]]&&D(s[e],n,t);i&&(t._il=i),t._isPm&&t._a[3]<12&&(t._a[3]+=12),t._isPm===!1&&12===t._a[3]&&(t._a[3]=0),Y(t)}function k(t){var e,n,s,r,o,u=99;for(r=0;r<t._f.length;r++)e=a({},t),e._f=t._f[r],w(e),n=new i(e),o=c(e._a,n.toArray()),n._il&&(o+=n._il.length),u>o&&(u=o,s=n);a(t,s)}function v(t){var e,n=t._i,s=K.exec(n);if(s){for(t._f="YYYY-MM-DD"+(s[2]||" "),e=0;4>e;e++)if(te[e][1].exec(n)){t._f+=te[e][0];break}j.exec(n)&&(t._f+=" Z"),w(t)}else t._d=new Date(n)}function T(e){var n=e._i,s=G.exec(n);n===t?e._d=new Date:s?e._d=new Date(+s[1]):"string"==typeof n?v(e):d(n)?(e._a=n.slice(0),Y(e)):e._d=n instanceof Date?new Date(+n):new Date(n)}function b(t,e,n,s,i){return i.relativeTime(e||1,!!n,t,s)}function S(t,e,n){var s=W(Math.abs(t)/1e3),i=W(s/60),r=W(i/60),a=W(r/24),o=W(a/365),u=45>s&&["s",s]||1===i&&["m"]||45>i&&["mm",i]||1===r&&["h"]||22>r&&["hh",r]||1===a&&["d"]||25>=a&&["dd",a]||45>=a&&["M"]||345>a&&["MM",W(a/30)]||1===o&&["y"]||["yy",o];return u[2]=e,u[3]=t>0,u[4]=n,b.apply({},u)}function F(t,e,n){var s,i=n-e,r=n-t.day();return r>i&&(r-=7),i-7>r&&(r+=7),s=H(t).add("d",r),{week:Math.ceil(s.dayOfYear()/7),year:s.year()}}function O(t){var e=t._i,n=t._f;return null===e||""===e?null:("string"==typeof e&&(t._i=e=_().preparse(e)),H.isMoment(e)?(t=a({},e),t._d=new Date(+e._d)):n?d(n)?k(t):w(t):T(t),new i(t))}function z(t,e){H.fn[t]=H.fn[t+"s"]=function(t){var n=this._isUTC?"UTC":"";return null!=t?(this._d["set"+n+e](t),H.updateOffset(this),this):this._d["get"+n+e]()}}function C(t){H.duration.fn[t]=function(){return this._data[t]}}function L(t,e){H.duration.fn["as"+t]=function(){return+this/e}}for(var H,P,U="2.1.0",W=Math.round,x={},A="undefined"!=typeof module&&module.exports,G=/^\/?Date\((\-?\d+)/i,Z=/(\-)?(\d*)?\.?(\d+)\:(\d+)\:(\d+)\.?(\d{3})?/,E=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,N=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,J=/\d\d?/,I=/\d{1,3}/,V=/\d{3}/,X=/\d{1,4}/,$=/[+\-]?\d{1,6}/,R=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,j=/Z|[\+\-]\d\d:?\d\d/i,q=/T/i,B=/[\+\-]?\d+(\.\d{1,3})?/,K=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,Q="YYYY-MM-DDTHH:mm:ssZ",te=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],ee=/([\+\-]|\d\d)/gi,ne="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),se={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},ie={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",w:"week",M:"month",y:"year"},re={},ae="DDD w W M D d".split(" "),oe="M D H h m s w W".split(" "),ue={M:function(){return this.month()+1},MMM:function(t){return this.lang().monthsShort(this,t)},MMMM:function(t){return this.lang().months(this,t)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(t){return this.lang().weekdaysMin(this,t)},ddd:function(t){return this.lang().weekdaysShort(this,t)},dddd:function(t){return this.lang().weekdays(this,t)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return u(this.year()%100,2)},YYYY:function(){return u(this.year(),4)},YYYYY:function(){return u(this.year(),5)},gg:function(){return u(this.weekYear()%100,2)},gggg:function(){return this.weekYear()},ggggg:function(){return u(this.weekYear(),5)},GG:function(){return u(this.isoWeekYear()%100,2)},GGGG:function(){return this.isoWeekYear()},GGGGG:function(){return u(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return u(~~(this.milliseconds()/10),2)},SSS:function(){return u(this.milliseconds(),3)},Z:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(t/60),2)+":"+u(~~t%60,2)},ZZ:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(10*t/6),4)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()}};ae.length;)P=ae.pop(),ue[P+"o"]=n(ue[P],P);for(;oe.length;)P=oe.pop(),ue[P+P]=e(ue[P],2);for(ue.DDDD=e(ue.DDD,3),s.prototype={set:function(t){var e,n;for(n in t)e=t[n],"function"==typeof e?this[n]=e:this["_"+n]=e},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(t){return this._months[t.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(t){return this._monthsShort[t.month()]},monthsParse:function(t){var e,n,s;for(this._monthsParse||(this._monthsParse=[]),e=0;12>e;e++)if(this._monthsParse[e]||(n=H([2e3,e]),s="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[e]=new RegExp(s.replace(".",""),"i")),this._monthsParse[e].test(t))return e},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(t){return this._weekdays[t.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(t){return this._weekdaysShort[t.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(t){return this._weekdaysMin[t.day()]},weekdaysParse:function(t){var e,n,s;for(this._weekdaysParse||(this._weekdaysParse=[]),e=0;7>e;e++)if(this._weekdaysParse[e]||(n=H([2e3,1]).day(e),s="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[e]=new RegExp(s.replace(".",""),"i")),this._weekdaysParse[e].test(t))return e},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(t){var e=this._longDateFormat[t];return!e&&this._longDateFormat[t.toUpperCase()]&&(e=this._longDateFormat[t.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t]=e),e},isPM:function(t){return"p"===(t+"").toLowerCase()[0]},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(t,e){var n=this._calendar[t];return"function"==typeof n?n.apply(e):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(t,e,n,s){var i=this._relativeTime[n];return"function"==typeof i?i(t,e,n,s):i.replace(/%d/i,t)},pastFuture:function(t,e){var n=this._relativeTime[t>0?"future":"past"];return"function"==typeof n?n(e):n.replace(/%s/i,e)},ordinal:function(t){return this._ordinal.replace("%d",t)},_ordinal:"%d",preparse:function(t){return t},postformat:function(t){return t},week:function(t){return F(t,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6}},H=function(t,e,n){return O({_i:t,_f:e,_l:n,_isUTC:!1})},H.utc=function(t,e,n){return O({_useUTC:!0,_isUTC:!0,_l:n,_i:t,_f:e})},H.unix=function(t){return H(1e3*t)},H.duration=function(t,e){var n,s,i=H.isDuration(t),a="number"==typeof t,o=i?t._input:a?{}:t,u=Z.exec(t);return a?e?o[e]=t:o.milliseconds=t:u&&(n="-"===u[1]?-1:1,o={y:0,d:~~u[2]*n,h:~~u[3]*n,m:~~u[4]*n,s:~~u[5]*n,ms:~~u[6]*n}),s=new r(o),i&&t.hasOwnProperty("_lang")&&(s._lang=t._lang),s},H.version=U,H.defaultFormat=Q,H.updateOffset=function(){},H.lang=function(t,e){return t?(e?l(t,e):x[t]||_(t),H.duration.fn._lang=H.fn._lang=_(t),void 0):H.fn._lang._abbr},H.langData=function(t){return t&&t._lang&&t._lang._abbr&&(t=t._lang._abbr),_(t)},H.isMoment=function(t){return t instanceof i},H.isDuration=function(t){return t instanceof r},H.fn=i.prototype={clone:function(){return H(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){return M(H(this).utc(),"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var t=this;return[t.year(),t.month(),t.date(),t.hours(),t.minutes(),t.seconds(),t.milliseconds()]},isValid:function(){return null==this._isValid&&(this._isValid=this._a?!c(this._a,(this._isUTC?H.utc(this._a):H(this._a)).toArray()):!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(t){var e=M(this,t||H.defaultFormat);return this.lang().postformat(e)},add:function(t,e){var n;return n="string"==typeof t?H.duration(+e,t):H.duration(t,e),h(this,n,1),this},subtract:function(t,e){var n;return n="string"==typeof t?H.duration(+e,t):H.duration(t,e),h(this,n,-1),this},diff:function(t,e,n){var s,i,r=this._isUTC?H(t).zone(this._offset||0):H(t).local(),a=6e4*(this.zone()-r.zone());return e=f(e),"year"===e||"month"===e?(s=432e5*(this.daysInMonth()+r.daysInMonth()),i=12*(this.year()-r.year())+(this.month()-r.month()),i+=(this-H(this).startOf("month")-(r-H(r).startOf("month")))/s,i-=6e4*(this.zone()-H(this).startOf("month").zone()-(r.zone()-H(r).startOf("month").zone()))/s,"year"===e&&(i/=12)):(s=this-r,i="second"===e?s/1e3:"minute"===e?s/6e4:"hour"===e?s/36e5:"day"===e?(s-a)/864e5:"week"===e?(s-a)/6048e5:s),n?i:o(i)},from:function(t,e){return H.duration(this.diff(t)).lang(this.lang()._abbr).humanize(!e)},fromNow:function(t){return this.from(H(),t)},calendar:function(){var t=this.diff(H().startOf("day"),"days",!0),e=-6>t?"sameElse":-1>t?"lastWeek":0>t?"lastDay":1>t?"sameDay":2>t?"nextDay":7>t?"nextWeek":"sameElse";return this.format(this.lang().calendar(e,this))},isLeapYear:function(){var t=this.year();return 0===t%4&&0!==t%100||0===t%400},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(t){var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?"string"==typeof t&&(t=this.lang().weekdaysParse(t),"number"!=typeof t)?this:this.add({d:t-e}):e},month:function(t){var e,n=this._isUTC?"UTC":"";return null!=t?"string"==typeof t&&(t=this.lang().monthsParse(t),"number"!=typeof t)?this:(e=this.date(),this.date(1),this._d["set"+n+"Month"](t),this.date(Math.min(e,this.daysInMonth())),H.updateOffset(this),this):this._d["get"+n+"Month"]()},startOf:function(t){switch(t=f(t)){case"year":this.month(0);case"month":this.date(1);case"week":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),this},endOf:function(t){return this.startOf(t).add(t,1).subtract("ms",1)},isAfter:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)>+H(t).startOf(e)},isBefore:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)<+H(t).startOf(e)},isSame:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)===+H(t).startOf(e)},min:function(t){return t=H.apply(null,arguments),this>t?this:t},max:function(t){return t=H.apply(null,arguments),t>this?this:t},zone:function(t){var e=this._offset||0;return null==t?this._isUTC?e:this._d.getTimezoneOffset():("string"==typeof t&&(t=p(t)),Math.abs(t)<16&&(t=60*t),this._offset=t,this._isUTC=!0,e!==t&&h(this,H.duration(e-t,"m"),1,!0),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},daysInMonth:function(){return H.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(t){var e=W((H(this).startOf("day")-H(this).startOf("year"))/864e5)+1;return null==t?e:this.add("d",t-e)},weekYear:function(t){var e=F(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==t?e:this.add("y",t-e)},isoWeekYear:function(t){var e=F(this,1,4).year;return null==t?e:this.add("y",t-e)},week:function(t){var e=this.lang().week(this);return null==t?e:this.add("d",7*(t-e))},isoWeek:function(t){var e=F(this,1,4).week;return null==t?e:this.add("d",7*(t-e))},weekday:function(t){var e=(this._d.getDay()+7-this.lang()._week.dow)%7;return null==t?e:this.add("d",t-e)},isoWeekday:function(t){return null==t?this.day()||7:this.day(this.day()%7?t:t-7)},lang:function(e){return e===t?this._lang:(this._lang=_(e),this)}},P=0;P<ne.length;P++)z(ne[P].toLowerCase().replace(/s$/,""),ne[P]);z("year","FullYear"),H.fn.days=H.fn.day,H.fn.months=H.fn.month,H.fn.weeks=H.fn.week,H.fn.isoWeeks=H.fn.isoWeek,H.fn.toJSON=H.fn.toISOString,H.duration.fn=r.prototype={_bubble:function(){var t,e,n,s,i=this._milliseconds,r=this._days,a=this._months,u=this._data;u.milliseconds=i%1e3,t=o(i/1e3),u.seconds=t%60,e=o(t/60),u.minutes=e%60,n=o(e/60),u.hours=n%24,r+=o(n/24),u.days=r%30,a+=o(r/30),u.months=a%12,s=o(a/12),u.years=s},weeks:function(){return o(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+2592e6*(this._months%12)+31536e6*~~(this._months/12)},humanize:function(t){var e=+this,n=S(e,!t,this.lang());return t&&(n=this.lang().pastFuture(e,n)),this.lang().postformat(n)},add:function(t,e){var n=H.duration(t,e);return this._milliseconds+=n._milliseconds,this._days+=n._days,this._months+=n._months,this._bubble(),this},subtract:function(t,e){var n=H.duration(t,e);return this._milliseconds-=n._milliseconds,this._days-=n._days,this._months-=n._months,this._bubble(),this},get:function(t){return t=f(t),this[t.toLowerCase()+"s"]()},as:function(t){return t=f(t),this["as"+t.charAt(0).toUpperCase()+t.slice(1)+"s"]()},lang:H.fn.lang};for(P in se)se.hasOwnProperty(P)&&(L(P,se[P]),C(P.toLowerCase()));L("Weeks",6048e5),H.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},H.lang("en",{ordinal:function(t){var e=t%10,n=1===~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),A&&(module.exports=H),"undefined"==typeof ender&&(this.moment=H),"function"==typeof define&&define.amd&&define("moment",[],function(){return H})}.call(this); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/phantom-driver.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/phantom-driver.js
new file mode 100644
index 00000000..22f46870
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/phantom-driver.js
@@ -0,0 +1,206 @@
+// Invoke via: ./test.sh
+//
+// or phantomjs phantom-driver.js [testCase.test]
+//
+// For more on phantomjs, visit www.phantomjs.org.
+
+var RunAllAutoTests = function(done_callback) {
+
+var page = require('webpage').create();
+
+// NOTE: Cannot include '#' or '?' in this URL.
+var url = 'auto_tests/misc/local.html';
+
+// NOTE: changing the line below to this:
+// page.open(url, function(status)) {
+// makes phantomjs hang.
+page.open(url, function(status) {
+ if (status !== 'success') {
+ console.warn('Page status: ' + status);
+ console.log(page);
+ phantom.exit();
+ }
+
+ var testCase, test;
+ var verbose = false;
+ var optIdx = 0;
+ if (phantom.args.length > 0 && phantom.args[0] === "--verbose") {
+ verbose = true;
+ optIdx = 1;
+ }
+ if (phantom.args.length == optIdx + 1) {
+ var parts = phantom.args[optIdx].split('.');
+ if (2 != parts.length) {
+ console.warn('Usage: phantomjs phantom-driver.js [--verbose] [testCase.test]');
+ phantom.exit();
+ }
+ testCase = parts[0];
+ test = parts[1];
+ }
+
+ var loggingOn = false;
+
+ page.onConsoleMessage = function (msg) {
+ if (msg == 'Running ' + test) {
+ loggingOn = true;
+ } else if (msg.substr(0, 'Running'.length) == 'Running') {
+ loggingOn = false;
+ }
+ if (verbose || loggingOn) console.log(msg);
+ };
+
+ page.onError = function (msg, trace) {
+ console.log(msg);
+ trace.forEach(function(item) {
+ console.log(' ', item.file, ':', item.line);
+ })
+ };
+
+ var results;
+
+ // Run all tests.
+ var start = new Date().getTime();
+ results = page.evaluate(function() {
+ var num_passing = 0, num_failing = 0;
+ var failures = [];
+ // Phantom doesn't like stacktrace.js using the "arguments" object
+ // in stacktrace.js, which it interprets in strict mode.
+ printStackTrace = undefined;
+
+ jstestdriver.attachListener({
+ finish : function(tc, name, result, e) {
+ console.log("Result:", tc.name, name, result, e);
+ if (result) {
+ // console.log(testCase + '.' + test + ' passed');
+ num_passing++;
+ } else {
+ num_failing++;
+ failures.push(tc.name + '.' + name);
+ }
+ }
+ });
+ var testCases = getAllTestCases();
+ for (var idx in testCases) {
+ var entry = testCases[idx];
+
+ var prototype = entry.testCase;
+ var tc = new entry.testCase();
+ var result = tc.runAllTests();
+ }
+ return {
+ num_passing : num_passing,
+ num_failing : num_failing,
+ failures : failures
+ };
+ });
+ var end = new Date().getTime();
+ var elapsed = (end - start) / 1000;
+
+ console.log('Ran ' + (results.num_passing + results.num_failing) + ' tests in ' + elapsed + 's.');
+ console.log(results.num_passing + ' test(s) passed');
+ console.log(results.num_failing + ' test(s) failed:');
+ for (var i = 0; i < results.failures.length; i++) {
+ // TODO(danvk): print an auto_test/misc/local URL that runs this test.
+ console.log(' ' + results.failures[i] + ' failed.');
+ }
+
+ done_callback(results.num_failing, results.num_passing);
+});
+
+};
+
+// Load all "tests/" pages.
+var LoadAllManualTests = function(totally_done_callback) {
+
+var fs = require('fs');
+var tests = fs.list('tests');
+var pages = [];
+
+function make_barrier_closure(n, fn) {
+ var calls = 0;
+ return function() {
+ calls++;
+ if (calls == n) {
+ fn();
+ } else {
+ // console.log('' + calls + ' done, ' + (n - calls) + ' remain');
+ }
+ };
+}
+
+var tasks = [];
+for (var i = 0; i < tests.length; i++) {
+ if (tests[i].substr(-5) != '.html') continue;
+ tasks.push(tests[i]);
+}
+tasks = [ 'independent-series.html' ];
+
+var loaded_page = make_barrier_closure(tasks.length, function() {
+ // Wait 2 secs to allow JS errors to happen after page load.
+ setTimeout(function() {
+ var success = 0, failures = 0;
+ for (var i = 0; i < pages.length; i++) {
+ if (pages[i].success && !pages[i].hasErrors) {
+ success++;
+ } else {
+ failures++;
+ }
+ }
+ console.log('Successfully loaded ' + success + ' / ' +
+ (success + failures) + ' test pages.');
+ totally_done_callback(failures, success);
+ }, 2000);
+});
+
+
+for (var i = 0; i < tasks.length; i++) {
+ var url = 'file://' + fs.absolute('tests/' + tasks[i]);
+ pages.push(function(path, url) {
+ var page = require('webpage').create();
+ page.success = false;
+ page.hasErrors = false;
+ page.onError = function (msg, trace) {
+ console.log(path + ': ' + msg);
+ page.hasErrors = true;
+ trace.forEach(function(item) {
+ console.log(' ', item.file, ':', item.line);
+ });
+ };
+ page.onLoadFinished = function(status) {
+ if (status == 'success') {
+ page.success = true;
+ }
+ if (!page.done) loaded_page();
+ page.done = true;
+ };
+ page.open(url);
+ return page;
+ }(tasks[i], url));
+}
+
+};
+
+
+// First run all auto_tests.
+// If they all pass, load the manual tests.
+RunAllAutoTests(function(num_failing, num_passing) {
+ if (num_failing !== 0) {
+ console.log('FAIL');
+ phantom.exit();
+ } else {
+ console.log('PASS');
+ }
+ phantom.exit();
+
+ // This is not yet reliable enough to be useful:
+ /*
+ LoadAllManualTests(function(failing, passing) {
+ if (failing !== 0) {
+ console.log('FAIL');
+ } else {
+ console.log('PASS');
+ }
+ phantom.exit();
+ });
+ */
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/phantom-perf.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/phantom-perf.js
new file mode 100644
index 00000000..b98c3f03
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/phantom-perf.js
@@ -0,0 +1,94 @@
+// dygraphs command-line performance benchmark.
+//
+// Invoke as:
+//
+// phantomjs phantom-perf.js 1000 100 5
+//
+// If the test succeeds, it will print out something like:
+//
+// 1000/100/5: 1309.4+/-43.4 ms (1284, 1245, 1336, 1346, 1336)
+//
+// This is mean +/- standard deviation, followed by a list of the individual
+// times for each repetition, in milliseconds.
+
+var system = require('system'),
+ fs = require('fs');
+
+var tmpfile = "tmp-dygraph-test-params.js";
+var url = 'tests/dygraph-many-points-benchmark.html';
+
+function fail(msg){
+ console.warn(msg);
+ phantom.exit(1);
+}
+
+function assert(condition, msg){
+ if (condition) return;
+ fail(msg);
+}
+
+var config_file_template =
+ "document.getElementById('points').value = (points);\n" +
+ "document.getElementById('series').value = (series);\n" +
+ "document.getElementById('repetitions').value = (repetitions);\n";
+
+var RunBenchmark = function(points, series, repetitions, done_callback) {
+ var page = require('webpage').create();
+
+ // page.evalute() is seriously locked down.
+ // This was the only way I could find to pass the parameters to the page.
+ fs.write(tmpfile,
+ config_file_template
+ .replace("(points)", points)
+ .replace("(series)", series)
+ .replace("(repetitions)", repetitions),
+ "w");
+
+ page.open(url, function(status) {
+ if (status !== 'success') {
+ console.warn('Page status: ' + status);
+ console.log(page);
+ phantom.exit();
+ }
+
+ assert(page.injectJs(tmpfile), "Unable to inject JS.");
+ fs.remove(tmpfile);
+
+ var start = new Date().getTime();
+ var rep_times = page.evaluate(function() {
+ var rep_times = updatePlot();
+ return rep_times;
+ });
+ var end = new Date().getTime();
+ var elapsed = (end - start) / 1000;
+ done_callback(rep_times);
+ });
+};
+
+
+var points, series, repetitions;
+if (4 != system.args.length) {
+ console.warn('Usage: phantomjs phantom-driver.js (points) (series) (repititions)');
+ phantom.exit();
+}
+
+points = parseInt(system.args[1]);
+series = parseInt(system.args[2]);
+repetitions = parseInt(system.args[3]);
+assert(points != null, "Couldn't parse " + system.args[1]);
+assert(series != null, "Couldn't parse " + system.args[2]);
+assert(repetitions != null, "Couldn't parse " + system.args[3]);
+
+
+RunBenchmark(points, series, repetitions, function(rep_times) {
+ var mean = 0.0, std = 0.0;
+ rep_times.forEach(function(x) { mean += x; } );
+ mean /= rep_times.length;
+ rep_times.forEach(function(x) { std += Math.pow(x - mean, 2); });
+ std = Math.sqrt(std / (rep_times.length - 1));
+
+ console.log(points + '/' + series + '/' + repetitions + ': ' +
+ mean.toFixed(1) + '+/-' + std.toFixed(1) + ' ms (' +
+ rep_times.join(', ') + ')');
+ phantom.exit();
+});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/README b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/README
new file mode 100644
index 00000000..f216545b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/README
@@ -0,0 +1,113 @@
+dygraphs plugins
+----------------
+
+A single dygraph is actually a collection of dygraphs plugins, each responsible
+for some portion of the chart: the plot area, the axes, the legend, the labels,
+etc.
+
+This forces the dygraphs code to be more modular and encourages better APIs.
+
+The "legend" plugin (plugins/legend.js) can be used as a template for new
+plugins.
+
+Here is a simplified version of it, with comments to explain the plugin
+lifecycle and APIs:
+
+----------------
+
+// (standard JavaScript library wrapper; prevents polluting global namespace)
+Dygraph.Plugins.Legend = (function() {
+
+// Plugin constructor. This is invoked once for every chart which uses the
+// plugin. You can't actually access the Dygraph object at this point, so the
+// initialization you do here shouldn't be chart-specific. (For that, use
+// the activate() method).
+var legend = function() {
+ this.div_ = null;
+};
+
+// Plugins are expected to implement this method for debugging purposes.
+legend.toString = function() {
+ return "Legend";
+};
+
+// This is called once the dygraph is ready. The chart data may not be
+// available yet, but the options specified in the constructor are.
+//
+// Proper tasks to do here include:
+// - Reading your own options
+// - DOM manipulation
+// - Registering event listeners
+//
+// "dygraph" is the Dygraph object for which this instance is being activated.
+// "registerer" allows you to register event listeners.
+legend.prototype.activate = function(dygraph, registerer) {
+ // Create the legend div and attach it to the chart DOM.
+ this.div_ = document.createElement("div");
+ dygraph.graphDiv.appendChild(this.div_);
+
+ // Add event listeners. These will be called whenever points are selected
+ // (i.e. you hover over them) or deselected (i.e. you mouse away from the
+ // chart). This is your only chance to register event listeners! Once this
+ // method returns, the gig is up.
+ registerer.addEventListener('select', legend.select);
+ registerer.addEventListener('deselect', legend.deselect);
+};
+
+// The functions called by event listeners all take a single parameter, an
+// event object. This contains properties relevant to the particular event, but
+// you can always assume that it has:
+//
+// 1. A "dygraph" parameter which is a reference to the chart on which the
+// event took place.
+// 2. A "stopPropagation" method, which you can call to prevent the event from
+// being seen by any other plugins after you. This effectively cancels the
+// event.
+// 3. A "preventDefault" method, which prevents dygraphs from performing the
+// default action associated with this event.
+//
+legend.select = function(e) {
+ // These are two of the properties specific to the "select" event object:
+ var xValue = e.selectedX;
+ var points = e.selectedPoints;
+
+ var html = xValue + ':';
+ for (var i = 0; i < points.length; i++) {
+ var point = points[i];
+ html += ' ' + point.name + ':' + point.yval;
+ }
+
+ // In an event listener, "this" refers to your plugin object.
+ this.div_.innerHTML = html;
+};
+
+// This clears out the legend when the user mouses away from the chart.
+legend.deselect = function(e) {
+ this.div_.innerHTML = '';
+};
+
+return legend;
+})();
+
+----------------
+
+Plugin Events Reference:
+
+- predraw
+- clearChart
+- drawChart
+- select
+- deselect
+
+TODO(danvk): document all event properties for each event.
+
+
+Special methods:
+- (constructor)
+- activate
+- destroy
+
+
+----------------
+
+Notes on plugin registration and event cascade ordering/behavior.
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/annotations.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/annotations.js
new file mode 100644
index 00000000..85761040
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/annotations.js
@@ -0,0 +1,182 @@
+/**
+ * @license
+ * Copyright 2012 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+
+/*global Dygraph:false */
+
+Dygraph.Plugins.Annotations = (function() {
+
+"use strict";
+
+/**
+Current bits of jankiness:
+- Uses dygraph.layout_ to get the parsed annotations.
+- Uses dygraph.plotter_.area
+
+It would be nice if the plugin didn't require so much special support inside
+the core dygraphs classes, but annotations involve quite a bit of parsing and
+layout.
+
+TODO(danvk): cache DOM elements.
+
+*/
+
+var annotations = function() {
+ this.annotations_ = [];
+};
+
+annotations.prototype.toString = function() {
+ return "Annotations Plugin";
+};
+
+annotations.prototype.activate = function(g) {
+ return {
+ clearChart: this.clearChart,
+ didDrawChart: this.didDrawChart
+ };
+};
+
+annotations.prototype.detachLabels = function() {
+ for (var i = 0; i < this.annotations_.length; i++) {
+ var a = this.annotations_[i];
+ if (a.parentNode) a.parentNode.removeChild(a);
+ this.annotations_[i] = null;
+ }
+ this.annotations_ = [];
+};
+
+annotations.prototype.clearChart = function(e) {
+ this.detachLabels();
+};
+
+annotations.prototype.didDrawChart = function(e) {
+ var g = e.dygraph;
+
+ // Early out in the (common) case of zero annotations.
+ var points = g.layout_.annotated_points;
+ if (!points || points.length === 0) return;
+
+ var containerDiv = e.canvas.parentNode;
+ var annotationStyle = {
+ "position": "absolute",
+ "fontSize": g.getOption('axisLabelFontSize') + "px",
+ "zIndex": 10,
+ "overflow": "hidden"
+ };
+
+ var bindEvt = function(eventName, classEventName, pt) {
+ return function(annotation_event) {
+ var a = pt.annotation;
+ if (a.hasOwnProperty(eventName)) {
+ a[eventName](a, pt, g, annotation_event);
+ } else if (g.getOption(classEventName)) {
+ g.getOption(classEventName)(a, pt, g, annotation_event );
+ }
+ };
+ };
+
+ // Add the annotations one-by-one.
+ var area = e.dygraph.plotter_.area;
+
+ // x-coord to sum of previous annotation's heights (used for stacking).
+ var xToUsedHeight = {};
+
+ for (var i = 0; i < points.length; i++) {
+ var p = points[i];
+ if (p.canvasx < area.x || p.canvasx > area.x + area.w ||
+ p.canvasy < area.y || p.canvasy > area.y + area.h) {
+ continue;
+ }
+
+ var a = p.annotation;
+ var tick_height = 6;
+ if (a.hasOwnProperty("tickHeight")) {
+ tick_height = a.tickHeight;
+ }
+
+ var div = document.createElement("div");
+ for (var name in annotationStyle) {
+ if (annotationStyle.hasOwnProperty(name)) {
+ div.style[name] = annotationStyle[name];
+ }
+ }
+ if (!a.hasOwnProperty('icon')) {
+ div.className = "dygraphDefaultAnnotation";
+ }
+ if (a.hasOwnProperty('cssClass')) {
+ div.className += " " + a.cssClass;
+ }
+
+ var width = a.hasOwnProperty('width') ? a.width : 16;
+ var height = a.hasOwnProperty('height') ? a.height : 16;
+ if (a.hasOwnProperty('icon')) {
+ var img = document.createElement("img");
+ img.src = a.icon;
+ img.width = width;
+ img.height = height;
+ div.appendChild(img);
+ } else if (p.annotation.hasOwnProperty('shortText')) {
+ div.appendChild(document.createTextNode(p.annotation.shortText));
+ }
+ var left = p.canvasx - width / 2;
+ div.style.left = left + "px";
+ var divTop = 0;
+ if (a.attachAtBottom) {
+ var y = (area.y + area.h - height - tick_height);
+ if (xToUsedHeight[left]) {
+ y -= xToUsedHeight[left];
+ } else {
+ xToUsedHeight[left] = 0;
+ }
+ xToUsedHeight[left] += (tick_height + height);
+ divTop = y;
+ } else {
+ divTop = p.canvasy - height - tick_height;
+ }
+ div.style.top = divTop + "px";
+ div.style.width = width + "px";
+ div.style.height = height + "px";
+ div.title = p.annotation.text;
+ div.style.color = g.colorsMap_[p.name];
+ div.style.borderColor = g.colorsMap_[p.name];
+ a.div = div;
+
+ g.addAndTrackEvent(div, 'click',
+ bindEvt('clickHandler', 'annotationClickHandler', p, this));
+ g.addAndTrackEvent(div, 'mouseover',
+ bindEvt('mouseOverHandler', 'annotationMouseOverHandler', p, this));
+ g.addAndTrackEvent(div, 'mouseout',
+ bindEvt('mouseOutHandler', 'annotationMouseOutHandler', p, this));
+ g.addAndTrackEvent(div, 'dblclick',
+ bindEvt('dblClickHandler', 'annotationDblClickHandler', p, this));
+
+ containerDiv.appendChild(div);
+ this.annotations_.push(div);
+
+ var ctx = e.drawingContext;
+ ctx.save();
+ ctx.strokeStyle = g.colorsMap_[p.name];
+ ctx.beginPath();
+ if (!a.attachAtBottom) {
+ ctx.moveTo(p.canvasx, p.canvasy);
+ ctx.lineTo(p.canvasx, p.canvasy - 2 - tick_height);
+ } else {
+ var y = divTop + height;
+ ctx.moveTo(p.canvasx, y);
+ ctx.lineTo(p.canvasx, y + tick_height);
+ }
+ ctx.closePath();
+ ctx.stroke();
+ ctx.restore();
+ }
+};
+
+annotations.prototype.destroy = function() {
+ this.detachLabels();
+};
+
+return annotations;
+
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/axes.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/axes.js
new file mode 100644
index 00000000..cacda86e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/axes.js
@@ -0,0 +1,315 @@
+/**
+ * @license
+ * Copyright 2012 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+
+/*global Dygraph:false */
+
+Dygraph.Plugins.Axes = (function() {
+
+"use strict";
+
+/*
+Bits of jankiness:
+- Direct layout access
+- Direct area access
+- Should include calculation of ticks, not just the drawing.
+
+Options left to make axis-friendly.
+ ('axisTickSize')
+ ('drawAxesAtZero')
+ ('xAxisHeight')
+
+These too. What is the difference between axisLablelWidth and {x,y}AxisLabelWidth?
+ ('axisLabelWidth')
+ ('xAxisLabelWidth')
+ ('yAxisLabelWidth')
+*/
+
+/**
+ * Draws the axes. This includes the labels on the x- and y-axes, as well
+ * as the tick marks on the axes.
+ * It does _not_ draw the grid lines which span the entire chart.
+ */
+var axes = function() {
+ this.xlabels_ = [];
+ this.ylabels_ = [];
+};
+
+axes.prototype.toString = function() {
+ return "Axes Plugin";
+};
+
+axes.prototype.activate = function(g) {
+ return {
+ layout: this.layout,
+ clearChart: this.clearChart,
+ willDrawChart: this.willDrawChart
+ };
+};
+
+axes.prototype.layout = function(e) {
+ var g = e.dygraph;
+
+ if (g.getOption('drawYAxis')) {
+ var w = g.getOption('yAxisLabelWidth') + 2 * g.getOption('axisTickSize');
+ e.reserveSpaceLeft(w);
+ }
+
+ if (g.getOption('drawXAxis')) {
+ var h;
+ // NOTE: I think this is probably broken now, since g.getOption() now
+ // hits the dictionary. (That is, g.getOption('xAxisHeight') now always
+ // has a value.)
+ if (g.getOption('xAxisHeight')) {
+ h = g.getOption('xAxisHeight');
+ } else {
+ h = g.getOptionForAxis('axisLabelFontSize', 'x') + 2 * g.getOption('axisTickSize');
+ }
+ e.reserveSpaceBottom(h);
+ }
+
+ if (g.numAxes() == 2) {
+ // TODO(danvk): introduce a 'drawAxis' per-axis property.
+ if (g.getOption('drawYAxis')) {
+ // TODO(danvk): per-axis setting.
+ var w = g.getOption('yAxisLabelWidth') + 2 * g.getOption('axisTickSize');
+ e.reserveSpaceRight(w);
+ }
+ } else if (g.numAxes() > 2) {
+ g.error("Only two y-axes are supported at this time. (Trying " +
+ "to use " + g.numAxes() + ")");
+ }
+};
+
+axes.prototype.detachLabels = function() {
+ function removeArray(ary) {
+ for (var i = 0; i < ary.length; i++) {
+ var el = ary[i];
+ if (el.parentNode) el.parentNode.removeChild(el);
+ }
+ }
+
+ removeArray(this.xlabels_);
+ removeArray(this.ylabels_);
+ this.xlabels_ = [];
+ this.ylabels_ = [];
+};
+
+axes.prototype.clearChart = function(e) {
+ this.detachLabels();
+};
+
+axes.prototype.willDrawChart = function(e) {
+ var g = e.dygraph;
+ if (!g.getOption('drawXAxis') && !g.getOption('drawYAxis')) return;
+
+ // Round pixels to half-integer boundaries for crisper drawing.
+ function halfUp(x) { return Math.round(x) + 0.5; }
+ function halfDown(y){ return Math.round(y) - 0.5; }
+
+ var context = e.drawingContext;
+ var containerDiv = e.canvas.parentNode;
+ var canvasWidth = e.canvas.width;
+ var canvasHeight = e.canvas.height;
+
+ var label, x, y, tick, i;
+
+ var makeLabelStyle = function(axis) {
+ return {
+ position: "absolute",
+ fontSize: g.getOptionForAxis('axisLabelFontSize', axis) + "px",
+ zIndex: 10,
+ color: g.getOptionForAxis('axisLabelColor', axis),
+ width: g.getOption('axisLabelWidth') + "px",
+ // height: g.getOptionForAxis('axisLabelFontSize', 'x') + 2 + "px",
+ lineHeight: "normal", // Something other than "normal" line-height screws up label positioning.
+ overflow: "hidden"
+ };
+ };
+
+ var labelStyles = {
+ x : makeLabelStyle('x'),
+ y : makeLabelStyle('y'),
+ y2 : makeLabelStyle('y2')
+ };
+
+ var makeDiv = function(txt, axis, prec_axis) {
+ /*
+ * This seems to be called with the following three sets of axis/prec_axis:
+ * x: undefined
+ * y: y1
+ * y: y2
+ */
+ var div = document.createElement("div");
+ var labelStyle = labelStyles[prec_axis == 'y2' ? 'y2' : axis];
+ for (var name in labelStyle) {
+ if (labelStyle.hasOwnProperty(name)) {
+ div.style[name] = labelStyle[name];
+ }
+ }
+ var inner_div = document.createElement("div");
+ inner_div.className = 'dygraph-axis-label' +
+ ' dygraph-axis-label-' + axis +
+ (prec_axis ? ' dygraph-axis-label-' + prec_axis : '');
+ inner_div.innerHTML = txt;
+ div.appendChild(inner_div);
+ return div;
+ };
+
+ // axis lines
+ context.save();
+
+ var layout = g.layout_;
+ var area = e.dygraph.plotter_.area;
+
+ if (g.getOption('drawYAxis')) {
+ if (layout.yticks && layout.yticks.length > 0) {
+ var num_axes = g.numAxes();
+ for (i = 0; i < layout.yticks.length; i++) {
+ tick = layout.yticks[i];
+ if (typeof(tick) == "function") return;
+ x = area.x;
+ var sgn = 1;
+ var prec_axis = 'y1';
+ if (tick[0] == 1) { // right-side y-axis
+ x = area.x + area.w;
+ sgn = -1;
+ prec_axis = 'y2';
+ }
+ var fontSize = g.getOptionForAxis('axisLabelFontSize', prec_axis);
+ y = area.y + tick[1] * area.h;
+
+ /* Tick marks are currently clipped, so don't bother drawing them.
+ context.beginPath();
+ context.moveTo(halfUp(x), halfDown(y));
+ context.lineTo(halfUp(x - sgn * this.attr_('axisTickSize')), halfDown(y));
+ context.closePath();
+ context.stroke();
+ */
+
+ label = makeDiv(tick[2], 'y', num_axes == 2 ? prec_axis : null);
+ var top = (y - fontSize / 2);
+ if (top < 0) top = 0;
+
+ if (top + fontSize + 3 > canvasHeight) {
+ label.style.bottom = "0px";
+ } else {
+ label.style.top = top + "px";
+ }
+ if (tick[0] === 0) {
+ label.style.left = (area.x - g.getOption('yAxisLabelWidth') - g.getOption('axisTickSize')) + "px";
+ label.style.textAlign = "right";
+ } else if (tick[0] == 1) {
+ label.style.left = (area.x + area.w +
+ g.getOption('axisTickSize')) + "px";
+ label.style.textAlign = "left";
+ }
+ label.style.width = g.getOption('yAxisLabelWidth') + "px";
+ containerDiv.appendChild(label);
+ this.ylabels_.push(label);
+ }
+
+ // The lowest tick on the y-axis often overlaps with the leftmost
+ // tick on the x-axis. Shift the bottom tick up a little bit to
+ // compensate if necessary.
+ var bottomTick = this.ylabels_[0];
+ // Interested in the y2 axis also?
+ var fontSize = g.getOptionForAxis('axisLabelFontSize', "y");
+ var bottom = parseInt(bottomTick.style.top, 10) + fontSize;
+ if (bottom > canvasHeight - fontSize) {
+ bottomTick.style.top = (parseInt(bottomTick.style.top, 10) -
+ fontSize / 2) + "px";
+ }
+ }
+
+ // draw a vertical line on the left to separate the chart from the labels.
+ var axisX;
+ if (g.getOption('drawAxesAtZero')) {
+ var r = g.toPercentXCoord(0);
+ if (r > 1 || r < 0 || isNaN(r)) r = 0;
+ axisX = halfUp(area.x + r * area.w);
+ } else {
+ axisX = halfUp(area.x);
+ }
+
+ context.strokeStyle = g.getOptionForAxis('axisLineColor', 'y');
+ context.lineWidth = g.getOptionForAxis('axisLineWidth', 'y');
+
+ context.beginPath();
+ context.moveTo(axisX, halfDown(area.y));
+ context.lineTo(axisX, halfDown(area.y + area.h));
+ context.closePath();
+ context.stroke();
+
+ // if there's a secondary y-axis, draw a vertical line for that, too.
+ if (g.numAxes() == 2) {
+ context.strokeStyle = g.getOptionForAxis('axisLineColor', 'y2');
+ context.lineWidth = g.getOptionForAxis('axisLineWidth', 'y2');
+ context.beginPath();
+ context.moveTo(halfDown(area.x + area.w), halfDown(area.y));
+ context.lineTo(halfDown(area.x + area.w), halfDown(area.y + area.h));
+ context.closePath();
+ context.stroke();
+ }
+ }
+
+ if (g.getOption('drawXAxis')) {
+ if (layout.xticks) {
+ for (i = 0; i < layout.xticks.length; i++) {
+ tick = layout.xticks[i];
+ x = area.x + tick[0] * area.w;
+ y = area.y + area.h;
+
+ /* Tick marks are currently clipped, so don't bother drawing them.
+ context.beginPath();
+ context.moveTo(halfUp(x), halfDown(y));
+ context.lineTo(halfUp(x), halfDown(y + this.attr_('axisTickSize')));
+ context.closePath();
+ context.stroke();
+ */
+
+ label = makeDiv(tick[1], 'x');
+ label.style.textAlign = "center";
+ label.style.top = (y + g.getOption('axisTickSize')) + 'px';
+
+ var left = (x - g.getOption('axisLabelWidth')/2);
+ if (left + g.getOption('axisLabelWidth') > canvasWidth) {
+ left = canvasWidth - g.getOption('xAxisLabelWidth');
+ label.style.textAlign = "right";
+ }
+ if (left < 0) {
+ left = 0;
+ label.style.textAlign = "left";
+ }
+
+ label.style.left = left + "px";
+ label.style.width = g.getOption('xAxisLabelWidth') + "px";
+ containerDiv.appendChild(label);
+ this.xlabels_.push(label);
+ }
+ }
+
+ context.strokeStyle = g.getOptionForAxis('axisLineColor', 'x');
+ context.lineWidth = g.getOptionForAxis('axisLineWidth', 'x');
+ context.beginPath();
+ var axisY;
+ if (g.getOption('drawAxesAtZero')) {
+ var r = g.toPercentYCoord(0, 0);
+ if (r > 1 || r < 0) r = 1;
+ axisY = halfDown(area.y + r * area.h);
+ } else {
+ axisY = halfDown(area.y + area.h);
+ }
+ context.moveTo(halfUp(area.x), axisY);
+ context.lineTo(halfUp(area.x + area.w), axisY);
+ context.closePath();
+ context.stroke();
+ }
+
+ context.restore();
+};
+
+return axes;
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/chart-labels.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/chart-labels.js
new file mode 100644
index 00000000..da231d80
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/chart-labels.js
@@ -0,0 +1,202 @@
+/**
+ * @license
+ * Copyright 2012 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+/*global Dygraph:false */
+
+Dygraph.Plugins.ChartLabels = (function() {
+
+"use strict";
+
+// TODO(danvk): move chart label options out of dygraphs and into the plugin.
+// TODO(danvk): only tear down & rebuild the DIVs when it's necessary.
+
+var chart_labels = function() {
+ this.title_div_ = null;
+ this.xlabel_div_ = null;
+ this.ylabel_div_ = null;
+ this.y2label_div_ = null;
+};
+
+chart_labels.prototype.toString = function() {
+ return "ChartLabels Plugin";
+};
+
+chart_labels.prototype.activate = function(g) {
+ return {
+ layout: this.layout,
+ // clearChart: this.clearChart,
+ didDrawChart: this.didDrawChart
+ };
+};
+
+// QUESTION: should there be a plugin-utils.js?
+var createDivInRect = function(r) {
+ var div = document.createElement('div');
+ div.style.position = 'absolute';
+ div.style.left = r.x + 'px';
+ div.style.top = r.y + 'px';
+ div.style.width = r.w + 'px';
+ div.style.height = r.h + 'px';
+ return div;
+};
+
+// Detach and null out any existing nodes.
+chart_labels.prototype.detachLabels_ = function() {
+ var els = [ this.title_div_,
+ this.xlabel_div_,
+ this.ylabel_div_,
+ this.y2label_div_ ];
+ for (var i = 0; i < els.length; i++) {
+ var el = els[i];
+ if (!el) continue;
+ if (el.parentNode) el.parentNode.removeChild(el);
+ }
+
+ this.title_div_ = null;
+ this.xlabel_div_ = null;
+ this.ylabel_div_ = null;
+ this.y2label_div_ = null;
+};
+
+var createRotatedDiv = function(g, box, axis, classes, html) {
+ // TODO(danvk): is this outer div actually necessary?
+ var div = document.createElement("div");
+ div.style.position = 'absolute';
+ if (axis == 1) {
+ // NOTE: this is cheating. Should be positioned relative to the box.
+ div.style.left = '0px';
+ } else {
+ div.style.left = box.x + 'px';
+ }
+ div.style.top = box.y + 'px';
+ div.style.width = box.w + 'px';
+ div.style.height = box.h + 'px';
+ div.style.fontSize = (g.getOption('yLabelWidth') - 2) + 'px';
+
+ var inner_div = document.createElement("div");
+ inner_div.style.position = 'absolute';
+ inner_div.style.width = box.h + 'px';
+ inner_div.style.height = box.w + 'px';
+ inner_div.style.top = (box.h / 2 - box.w / 2) + 'px';
+ inner_div.style.left = (box.w / 2 - box.h / 2) + 'px';
+ inner_div.style.textAlign = 'center';
+
+ // CSS rotation is an HTML5 feature which is not standardized. Hence every
+ // browser has its own name for the CSS style.
+ var val = 'rotate(' + (axis == 1 ? '-' : '') + '90deg)';
+ inner_div.style.transform = val; // HTML5
+ inner_div.style.WebkitTransform = val; // Safari/Chrome
+ inner_div.style.MozTransform = val; // Firefox
+ inner_div.style.OTransform = val; // Opera
+ inner_div.style.msTransform = val; // IE9
+
+ if (typeof(document.documentMode) !== 'undefined' &&
+ document.documentMode < 9) {
+ // We're dealing w/ an old version of IE, so we have to rotate the text
+ // using a BasicImage transform. This uses a different origin of rotation
+ // than HTML5 rotation (top left of div vs. its center).
+ inner_div.style.filter =
+ 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' +
+ (axis == 1 ? '3' : '1') + ')';
+ inner_div.style.left = '0px';
+ inner_div.style.top = '0px';
+ }
+
+ var class_div = document.createElement("div");
+ class_div.className = classes;
+ class_div.innerHTML = html;
+
+ inner_div.appendChild(class_div);
+ div.appendChild(inner_div);
+ return div;
+};
+
+chart_labels.prototype.layout = function(e) {
+ this.detachLabels_();
+
+ var g = e.dygraph;
+ var div = e.chart_div;
+ if (g.getOption('title')) {
+ // QUESTION: should this return an absolutely-positioned div instead?
+ var title_rect = e.reserveSpaceTop(g.getOption('titleHeight'));
+ this.title_div_ = createDivInRect(title_rect);
+ this.title_div_.style.textAlign = 'center';
+ this.title_div_.style.fontSize = (g.getOption('titleHeight') - 8) + 'px';
+ this.title_div_.style.fontWeight = 'bold';
+ this.title_div_.style.zIndex = 10;
+
+ var class_div = document.createElement("div");
+ class_div.className = 'dygraph-label dygraph-title';
+ class_div.innerHTML = g.getOption('title');
+ this.title_div_.appendChild(class_div);
+ div.appendChild(this.title_div_);
+ }
+
+ if (g.getOption('xlabel')) {
+ var x_rect = e.reserveSpaceBottom(g.getOption('xLabelHeight'));
+ this.xlabel_div_ = createDivInRect(x_rect);
+ this.xlabel_div_.style.textAlign = 'center';
+ this.xlabel_div_.style.fontSize = (g.getOption('xLabelHeight') - 2) + 'px';
+
+ var class_div = document.createElement("div");
+ class_div.className = 'dygraph-label dygraph-xlabel';
+ class_div.innerHTML = g.getOption('xlabel');
+ this.xlabel_div_.appendChild(class_div);
+ div.appendChild(this.xlabel_div_);
+ }
+
+ if (g.getOption('ylabel')) {
+ // It would make sense to shift the chart here to make room for the y-axis
+ // label, but the default yAxisLabelWidth is large enough that this results
+ // in overly-padded charts. The y-axis label should fit fine. If it
+ // doesn't, the yAxisLabelWidth option can be increased.
+ var y_rect = e.reserveSpaceLeft(0);
+
+ this.ylabel_div_ = createRotatedDiv(
+ g, y_rect,
+ 1, // primary (left) y-axis
+ 'dygraph-label dygraph-ylabel',
+ g.getOption('ylabel'));
+ div.appendChild(this.ylabel_div_);
+ }
+
+ if (g.getOption('y2label') && g.numAxes() == 2) {
+ // same logic applies here as for ylabel.
+ var y2_rect = e.reserveSpaceRight(0);
+ this.y2label_div_ = createRotatedDiv(
+ g, y2_rect,
+ 2, // secondary (right) y-axis
+ 'dygraph-label dygraph-y2label',
+ g.getOption('y2label'));
+ div.appendChild(this.y2label_div_);
+ }
+};
+
+chart_labels.prototype.didDrawChart = function(e) {
+ var g = e.dygraph;
+ if (this.title_div_) {
+ this.title_div_.children[0].innerHTML = g.getOption('title');
+ }
+ if (this.xlabel_div_) {
+ this.xlabel_div_.children[0].innerHTML = g.getOption('xlabel');
+ }
+ if (this.ylabel_div_) {
+ this.ylabel_div_.children[0].children[0].innerHTML = g.getOption('ylabel');
+ }
+ if (this.y2label_div_) {
+ this.y2label_div_.children[0].children[0].innerHTML = g.getOption('y2label');
+ }
+};
+
+chart_labels.prototype.clearChart = function() {
+};
+
+chart_labels.prototype.destroy = function() {
+ this.detachLabels_();
+};
+
+
+return chart_labels;
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/grid.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/grid.js
new file mode 100644
index 00000000..425d93f6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/grid.js
@@ -0,0 +1,124 @@
+/**
+ * @license
+ * Copyright 2012 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+/*global Dygraph:false */
+
+Dygraph.Plugins.Grid = (function() {
+
+/*
+
+Current bits of jankiness:
+- Direct layout access
+- Direct area access
+
+*/
+
+"use strict";
+
+
+/**
+ * Draws the gridlines, i.e. the gray horizontal & vertical lines running the
+ * length of the chart.
+ *
+ * @constructor
+ */
+var grid = function() {
+};
+
+grid.prototype.toString = function() {
+ return "Gridline Plugin";
+};
+
+grid.prototype.activate = function(g) {
+ return {
+ willDrawChart: this.willDrawChart
+ };
+};
+
+grid.prototype.willDrawChart = function(e) {
+ // Draw the new X/Y grid. Lines appear crisper when pixels are rounded to
+ // half-integers. This prevents them from drawing in two rows/cols.
+ var g = e.dygraph;
+ var ctx = e.drawingContext;
+ var layout = g.layout_;
+ var area = e.dygraph.plotter_.area;
+
+ function halfUp(x) { return Math.round(x) + 0.5; }
+ function halfDown(y){ return Math.round(y) - 0.5; }
+
+ var x, y, i, ticks;
+ if (g.getOption('drawYGrid')) {
+ var axes = ["y", "y2"];
+ var strokeStyles = [], lineWidths = [], drawGrid = [], stroking = [], strokePattern = [];
+ for (var i = 0; i < axes.length; i++) {
+ drawGrid[i] = g.getOptionForAxis("drawGrid", axes[i]);
+ if (drawGrid[i]) {
+ strokeStyles[i] = g.getOptionForAxis('gridLineColor', axes[i]);
+ lineWidths[i] = g.getOptionForAxis('gridLineWidth', axes[i]);
+ strokePattern[i] = g.getOptionForAxis('gridLinePattern', axes[i]);
+ stroking[i] = strokePattern[i] && (strokePattern[i].length >= 2);
+ }
+ }
+ ticks = layout.yticks;
+ ctx.save();
+ // draw grids for the different y axes
+ for (i = 0; i < ticks.length; i++) {
+ var axis = ticks[i][0];
+ if(drawGrid[axis]) {
+ if (stroking[axis]) {
+ ctx.installPattern(strokePattern[axis]);
+ }
+ ctx.strokeStyle = strokeStyles[axis];
+ ctx.lineWidth = lineWidths[axis];
+
+ x = halfUp(area.x);
+ y = halfDown(area.y + ticks[i][1] * area.h);
+ ctx.beginPath();
+ ctx.moveTo(x, y);
+ ctx.lineTo(x + area.w, y);
+ ctx.closePath();
+ ctx.stroke();
+
+ if (stroking[axis]) {
+ ctx.uninstallPattern();
+ }
+ }
+ }
+ ctx.restore();
+ }
+
+ // draw grid for x axis
+ if (g.getOption('drawXGrid') && g.getOptionForAxis("drawGrid", 'x')) {
+ ticks = layout.xticks;
+ ctx.save();
+ var strokePattern = g.getOptionForAxis('gridLinePattern', 'x');
+ var stroking = strokePattern && (strokePattern.length >= 2);
+ if (stroking) {
+ ctx.installPattern(strokePattern);
+ }
+ ctx.strokeStyle = g.getOptionForAxis('gridLineColor', 'x');
+ ctx.lineWidth = g.getOptionForAxis('gridLineWidth', 'x');
+ for (i = 0; i < ticks.length; i++) {
+ x = halfUp(area.x + ticks[i][0] * area.w);
+ y = halfDown(area.y + area.h);
+ ctx.beginPath();
+ ctx.moveTo(x, y);
+ ctx.lineTo(x, area.y);
+ ctx.closePath();
+ ctx.stroke();
+ }
+ if (stroking) {
+ ctx.uninstallPattern();
+ }
+ ctx.restore();
+ }
+};
+
+grid.prototype.destroy = function() {
+};
+
+return grid;
+
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/legend.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/legend.js
new file mode 100644
index 00000000..7406f82a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/legend.js
@@ -0,0 +1,332 @@
+/**
+ * @license
+ * Copyright 2012 Dan Vanderkam (danvdk@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+/*global Dygraph:false */
+
+Dygraph.Plugins.Legend = (function() {
+/*
+
+Current bits of jankiness:
+- Uses two private APIs:
+ 1. Dygraph.optionsViewForAxis_
+ 2. dygraph.plotter_.area
+- Registers for a "predraw" event, which should be renamed.
+- I call calculateEmWidthInDiv more often than needed.
+
+*/
+
+/*jshint globalstrict: true */
+/*global Dygraph:false */
+"use strict";
+
+
+/**
+ * Creates the legend, which appears when the user hovers over the chart.
+ * The legend can be either a user-specified or generated div.
+ *
+ * @constructor
+ */
+var legend = function() {
+ this.legend_div_ = null;
+ this.is_generated_div_ = false; // do we own this div, or was it user-specified?
+};
+
+legend.prototype.toString = function() {
+ return "Legend Plugin";
+};
+
+// (defined below)
+var generateLegendHTML, generateLegendDashHTML;
+
+/**
+ * This is called during the dygraph constructor, after options have been set
+ * but before the data is available.
+ *
+ * Proper tasks to do here include:
+ * - Reading your own options
+ * - DOM manipulation
+ * - Registering event listeners
+ *
+ * @param {Dygraph} g Graph instance.
+ * @return {object.<string, function(ev)>} Mapping of event names to callbacks.
+ */
+legend.prototype.activate = function(g) {
+ var div;
+ var divWidth = g.getOption('labelsDivWidth');
+
+ var userLabelsDiv = g.getOption('labelsDiv');
+ if (userLabelsDiv && null !== userLabelsDiv) {
+ if (typeof(userLabelsDiv) == "string" || userLabelsDiv instanceof String) {
+ div = document.getElementById(userLabelsDiv);
+ } else {
+ div = userLabelsDiv;
+ }
+ } else {
+ // Default legend styles. These can be overridden in CSS by adding
+ // "!important" after your rule, e.g. "left: 30px !important;"
+ var messagestyle = {
+ "position": "absolute",
+ "fontSize": "14px",
+ "zIndex": 10,
+ "width": divWidth + "px",
+ "top": "0px",
+ "left": (g.size().width - divWidth - 2) + "px",
+ "background": "white",
+ "lineHeight": "normal",
+ "textAlign": "left",
+ "overflow": "hidden"};
+
+ // TODO(danvk): get rid of labelsDivStyles? CSS is better.
+ Dygraph.update(messagestyle, g.getOption('labelsDivStyles'));
+ div = document.createElement("div");
+ div.className = "dygraph-legend";
+ for (var name in messagestyle) {
+ if (!messagestyle.hasOwnProperty(name)) continue;
+
+ try {
+ div.style[name] = messagestyle[name];
+ } catch (e) {
+ this.warn("You are using unsupported css properties for your " +
+ "browser in labelsDivStyles");
+ }
+ }
+
+ // TODO(danvk): come up with a cleaner way to expose this.
+ g.graphDiv.appendChild(div);
+ this.is_generated_div_ = true;
+ }
+
+ this.legend_div_ = div;
+ this.one_em_width_ = 10; // just a guess, will be updated.
+
+ return {
+ select: this.select,
+ deselect: this.deselect,
+ // TODO(danvk): rethink the name "predraw" before we commit to it in any API.
+ predraw: this.predraw,
+ didDrawChart: this.didDrawChart
+ };
+};
+
+// Needed for dashed lines.
+var calculateEmWidthInDiv = function(div) {
+ var sizeSpan = document.createElement('span');
+ sizeSpan.setAttribute('style', 'margin: 0; padding: 0 0 0 1em; border: 0;');
+ div.appendChild(sizeSpan);
+ var oneEmWidth=sizeSpan.offsetWidth;
+ div.removeChild(sizeSpan);
+ return oneEmWidth;
+};
+
+legend.prototype.select = function(e) {
+ var xValue = e.selectedX;
+ var points = e.selectedPoints;
+
+ var html = generateLegendHTML(e.dygraph, xValue, points, this.one_em_width_);
+ this.legend_div_.innerHTML = html;
+};
+
+legend.prototype.deselect = function(e) {
+ // Have to do this every time, since styles might have changed.
+ var oneEmWidth = calculateEmWidthInDiv(this.legend_div_);
+ this.one_em_width_ = oneEmWidth;
+
+ var html = generateLegendHTML(e.dygraph, undefined, undefined, oneEmWidth);
+ this.legend_div_.innerHTML = html;
+};
+
+legend.prototype.didDrawChart = function(e) {
+ this.deselect(e);
+};
+
+// Right edge should be flush with the right edge of the charting area (which
+// may not be the same as the right edge of the div, if we have two y-axes.
+// TODO(danvk): is any of this really necessary? Could just set "right" in "activate".
+/**
+ * Position the labels div so that:
+ * - its right edge is flush with the right edge of the charting area
+ * - its top edge is flush with the top edge of the charting area
+ * @private
+ */
+legend.prototype.predraw = function(e) {
+ // Don't touch a user-specified labelsDiv.
+ if (!this.is_generated_div_) return;
+
+ // TODO(danvk): only use real APIs for this.
+ e.dygraph.graphDiv.appendChild(this.legend_div_);
+ var area = e.dygraph.plotter_.area;
+ var labelsDivWidth = e.dygraph.getOption("labelsDivWidth");
+ this.legend_div_.style.left = area.x + area.w - labelsDivWidth - 1 + "px";
+ this.legend_div_.style.top = area.y + "px";
+ this.legend_div_.style.width = labelsDivWidth + "px";
+};
+
+/**
+ * Called when dygraph.destroy() is called.
+ * You should null out any references and detach any DOM elements.
+ */
+legend.prototype.destroy = function() {
+ this.legend_div_ = null;
+};
+
+/**
+ * @private
+ * Generates HTML for the legend which is displayed when hovering over the
+ * chart. If no selected points are specified, a default legend is returned
+ * (this may just be the empty string).
+ * @param { Number } [x] The x-value of the selected points.
+ * @param { [Object] } [sel_points] List of selected points for the given
+ * x-value. Should have properties like 'name', 'yval' and 'canvasy'.
+ * @param { Number } [oneEmWidth] The pixel width for 1em in the legend. Only
+ * relevant when displaying a legend with no selection (i.e. {legend:
+ * 'always'}) and with dashed lines.
+ */
+generateLegendHTML = function(g, x, sel_points, oneEmWidth) {
+ // TODO(danvk): deprecate this option in place of {legend: 'never'}
+ if (g.getOption('showLabelsOnHighlight') !== true) return '';
+
+ // If no points are selected, we display a default legend. Traditionally,
+ // this has been blank. But a better default would be a conventional legend,
+ // which provides essential information for a non-interactive chart.
+ var html, sepLines, i, dash, strokePattern;
+ var labels = g.getLabels();
+
+ if (typeof(x) === 'undefined') {
+ if (g.getOption('legend') != 'always') {
+ return '';
+ }
+
+ sepLines = g.getOption('labelsSeparateLines');
+ html = '';
+ for (i = 1; i < labels.length; i++) {
+ var series = g.getPropertiesForSeries(labels[i]);
+ if (!series.visible) continue;
+
+ if (html !== '') html += (sepLines ? '<br/>' : ' ');
+ strokePattern = g.getOption("strokePattern", labels[i]);
+ dash = generateLegendDashHTML(strokePattern, series.color, oneEmWidth);
+ html += "<span style='font-weight: bold; color: " + series.color + ";'>" +
+ dash + " " + labels[i] + "</span>";
+ }
+ return html;
+ }
+
+ // TODO(danvk): remove this use of a private API
+ var xOptView = g.optionsViewForAxis_('x');
+ var xvf = xOptView('valueFormatter');
+ html = xvf(x, xOptView, labels[0], g);
+ if (html !== '') {
+ html += ':';
+ }
+
+ var yOptViews = [];
+ var num_axes = g.numAxes();
+ for (i = 0; i < num_axes; i++) {
+ // TODO(danvk): remove this use of a private API
+ yOptViews[i] = g.optionsViewForAxis_('y' + (i ? 1 + i : ''));
+ }
+ var showZeros = g.getOption("labelsShowZeroValues");
+ sepLines = g.getOption("labelsSeparateLines");
+ var highlightSeries = g.getHighlightSeries();
+ for (i = 0; i < sel_points.length; i++) {
+ var pt = sel_points[i];
+ if (pt.yval === 0 && !showZeros) continue;
+ if (!Dygraph.isOK(pt.canvasy)) continue;
+ if (sepLines) html += "<br/>";
+
+ var series = g.getPropertiesForSeries(pt.name);
+ var yOptView = yOptViews[series.axis - 1];
+ var fmtFunc = yOptView('valueFormatter');
+ var yval = fmtFunc(pt.yval, yOptView, pt.name, g);
+
+ var cls = (pt.name == highlightSeries) ? " class='highlight'" : "";
+
+ // TODO(danvk): use a template string here and make it an attribute.
+ html += "<span" + cls + ">" + " <b><span style='color: " + series.color + ";'>" +
+ pt.name + "</span></b>:&nbsp;" + yval + "</span>";
+ }
+ return html;
+};
+
+
+/**
+ * Generates html for the "dash" displayed on the legend when using "legend: always".
+ * In particular, this works for dashed lines with any stroke pattern. It will
+ * try to scale the pattern to fit in 1em width. Or if small enough repeat the
+ * pattern for 1em width.
+ *
+ * @param strokePattern The pattern
+ * @param color The color of the series.
+ * @param oneEmWidth The width in pixels of 1em in the legend.
+ * @private
+ */
+generateLegendDashHTML = function(strokePattern, color, oneEmWidth) {
+ // IE 7,8 fail at these divs, so they get boring legend, have not tested 9.
+ var isIE = (/MSIE/.test(navigator.userAgent) && !window.opera);
+ if (isIE) return "&mdash;";
+
+ // Easy, common case: a solid line
+ if (!strokePattern || strokePattern.length <= 1) {
+ return "<div style=\"display: inline-block; position: relative; " +
+ "bottom: .5ex; padding-left: 1em; height: 1px; " +
+ "border-bottom: 2px solid " + color + ";\"></div>";
+ }
+
+ var i, j, paddingLeft, marginRight;
+ var strokePixelLength = 0, segmentLoop = 0;
+ var normalizedPattern = [];
+ var loop;
+
+ // Compute the length of the pixels including the first segment twice,
+ // since we repeat it.
+ for (i = 0; i <= strokePattern.length; i++) {
+ strokePixelLength += strokePattern[i%strokePattern.length];
+ }
+
+ // See if we can loop the pattern by itself at least twice.
+ loop = Math.floor(oneEmWidth/(strokePixelLength-strokePattern[0]));
+ if (loop > 1) {
+ // This pattern fits at least two times, no scaling just convert to em;
+ for (i = 0; i < strokePattern.length; i++) {
+ normalizedPattern[i] = strokePattern[i]/oneEmWidth;
+ }
+ // Since we are repeating the pattern, we don't worry about repeating the
+ // first segment in one draw.
+ segmentLoop = normalizedPattern.length;
+ } else {
+ // If the pattern doesn't fit in the legend we scale it to fit.
+ loop = 1;
+ for (i = 0; i < strokePattern.length; i++) {
+ normalizedPattern[i] = strokePattern[i]/strokePixelLength;
+ }
+ // For the scaled patterns we do redraw the first segment.
+ segmentLoop = normalizedPattern.length+1;
+ }
+
+ // Now make the pattern.
+ var dash = "";
+ for (j = 0; j < loop; j++) {
+ for (i = 0; i < segmentLoop; i+=2) {
+ // The padding is the drawn segment.
+ paddingLeft = normalizedPattern[i%normalizedPattern.length];
+ if (i < strokePattern.length) {
+ // The margin is the space segment.
+ marginRight = normalizedPattern[(i+1)%normalizedPattern.length];
+ } else {
+ // The repeated first segment has no right margin.
+ marginRight = 0;
+ }
+ dash += "<div style=\"display: inline-block; position: relative; " +
+ "bottom: .5ex; margin-right: " + marginRight + "em; padding-left: " +
+ paddingLeft + "em; height: 1px; border-bottom: 2px solid " + color +
+ ";\"></div>";
+ }
+ }
+ return dash;
+};
+
+
+return legend;
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/range-selector.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/range-selector.js
new file mode 100644
index 00000000..089e64aa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/range-selector.js
@@ -0,0 +1,852 @@
+/**
+ * @license
+ * Copyright 2011 Paul Felix (paul.eric.felix@gmail.com)
+ * MIT-licensed (http://opensource.org/licenses/MIT)
+ */
+/*global Dygraph:false,TouchEvent:false */
+
+/**
+ * @fileoverview This file contains the RangeSelector plugin used to provide
+ * a timeline range selector widget for dygraphs.
+ */
+
+Dygraph.Plugins.RangeSelector = (function() {
+
+/*jshint globalstrict: true */
+/*global Dygraph:false */
+"use strict";
+
+var rangeSelector = function() {
+ this.isIE_ = /MSIE/.test(navigator.userAgent) && !window.opera;
+ this.hasTouchInterface_ = typeof(TouchEvent) != 'undefined';
+ this.isMobileDevice_ = /mobile|android/gi.test(navigator.appVersion);
+ this.interfaceCreated_ = false;
+};
+
+rangeSelector.prototype.toString = function() {
+ return "RangeSelector Plugin";
+};
+
+rangeSelector.prototype.activate = function(dygraph) {
+ this.dygraph_ = dygraph;
+ this.isUsingExcanvas_ = dygraph.isUsingExcanvas_;
+ if (this.getOption_('showRangeSelector')) {
+ this.createInterface_();
+ }
+ return {
+ layout: this.reserveSpace_,
+ predraw: this.renderStaticLayer_,
+ didDrawChart: this.renderInteractiveLayer_
+ };
+};
+
+rangeSelector.prototype.destroy = function() {
+ this.bgcanvas_ = null;
+ this.fgcanvas_ = null;
+ this.leftZoomHandle_ = null;
+ this.rightZoomHandle_ = null;
+ this.iePanOverlay_ = null;
+};
+
+//------------------------------------------------------------------
+// Private methods
+//------------------------------------------------------------------
+
+rangeSelector.prototype.getOption_ = function(name) {
+ return this.dygraph_.getOption(name);
+};
+
+rangeSelector.prototype.setDefaultOption_ = function(name, value) {
+ return this.dygraph_.attrs_[name] = value;
+};
+
+/**
+ * @private
+ * Creates the range selector elements and adds them to the graph.
+ */
+rangeSelector.prototype.createInterface_ = function() {
+ this.createCanvases_();
+ if (this.isUsingExcanvas_) {
+ this.createIEPanOverlay_();
+ }
+ this.createZoomHandles_();
+ this.initInteraction_();
+
+ // Range selector and animatedZooms have a bad interaction. See issue 359.
+ if (this.getOption_('animatedZooms')) {
+ this.dygraph_.warn('Animated zooms and range selector are not compatible; disabling animatedZooms.');
+ this.dygraph_.updateOptions({animatedZooms: false}, true);
+ }
+
+ this.interfaceCreated_ = true;
+ this.addToGraph_();
+};
+
+/**
+ * @private
+ * Adds the range selector to the graph.
+ */
+rangeSelector.prototype.addToGraph_ = function() {
+ var graphDiv = this.graphDiv_ = this.dygraph_.graphDiv;
+ graphDiv.appendChild(this.bgcanvas_);
+ graphDiv.appendChild(this.fgcanvas_);
+ graphDiv.appendChild(this.leftZoomHandle_);
+ graphDiv.appendChild(this.rightZoomHandle_);
+};
+
+/**
+ * @private
+ * Removes the range selector from the graph.
+ */
+rangeSelector.prototype.removeFromGraph_ = function() {
+ var graphDiv = this.graphDiv_;
+ graphDiv.removeChild(this.bgcanvas_);
+ graphDiv.removeChild(this.fgcanvas_);
+ graphDiv.removeChild(this.leftZoomHandle_);
+ graphDiv.removeChild(this.rightZoomHandle_);
+ this.graphDiv_ = null;
+};
+
+/**
+ * @private
+ * Called by Layout to allow range selector to reserve its space.
+ */
+rangeSelector.prototype.reserveSpace_ = function(e) {
+ if (this.getOption_('showRangeSelector')) {
+ e.reserveSpaceBottom(this.getOption_('rangeSelectorHeight') + 4);
+ }
+};
+
+/**
+ * @private
+ * Renders the static portion of the range selector at the predraw stage.
+ */
+rangeSelector.prototype.renderStaticLayer_ = function() {
+ if (!this.updateVisibility_()) {
+ return;
+ }
+ this.resize_();
+ this.drawStaticLayer_();
+};
+
+/**
+ * @private
+ * Renders the interactive portion of the range selector after the chart has been drawn.
+ */
+rangeSelector.prototype.renderInteractiveLayer_ = function() {
+ if (!this.updateVisibility_() || this.isChangingRange_) {
+ return;
+ }
+ this.placeZoomHandles_();
+ this.drawInteractiveLayer_();
+};
+
+/**
+ * @private
+ * Check to see if the range selector is enabled/disabled and update visibility accordingly.
+ */
+rangeSelector.prototype.updateVisibility_ = function() {
+ var enabled = this.getOption_('showRangeSelector');
+ if (enabled) {
+ if (!this.interfaceCreated_) {
+ this.createInterface_();
+ } else if (!this.graphDiv_ || !this.graphDiv_.parentNode) {
+ this.addToGraph_();
+ }
+ } else if (this.graphDiv_) {
+ this.removeFromGraph_();
+ var dygraph = this.dygraph_;
+ setTimeout(function() { dygraph.width_ = 0; dygraph.resize(); }, 1);
+ }
+ return enabled;
+};
+
+/**
+ * @private
+ * Resizes the range selector.
+ */
+rangeSelector.prototype.resize_ = function() {
+ function setElementRect(canvas, rect) {
+ canvas.style.top = rect.y + 'px';
+ canvas.style.left = rect.x + 'px';
+ canvas.width = rect.w;
+ canvas.height = rect.h;
+ canvas.style.width = canvas.width + 'px'; // for IE
+ canvas.style.height = canvas.height + 'px'; // for IE
+ }
+
+ var plotArea = this.dygraph_.layout_.getPlotArea();
+
+ var xAxisLabelHeight = 0;
+ if(this.getOption_('drawXAxis')){
+ xAxisLabelHeight = this.getOption_('xAxisHeight') || (this.getOption_('axisLabelFontSize') + 2 * this.getOption_('axisTickSize'));
+ }
+ this.canvasRect_ = {
+ x: plotArea.x,
+ y: plotArea.y + plotArea.h + xAxisLabelHeight + 4,
+ w: plotArea.w,
+ h: this.getOption_('rangeSelectorHeight')
+ };
+
+ setElementRect(this.bgcanvas_, this.canvasRect_);
+ setElementRect(this.fgcanvas_, this.canvasRect_);
+};
+
+/**
+ * @private
+ * Creates the background and foreground canvases.
+ */
+rangeSelector.prototype.createCanvases_ = function() {
+ this.bgcanvas_ = Dygraph.createCanvas();
+ this.bgcanvas_.className = 'dygraph-rangesel-bgcanvas';
+ this.bgcanvas_.style.position = 'absolute';
+ this.bgcanvas_.style.zIndex = 9;
+ this.bgcanvas_ctx_ = Dygraph.getContext(this.bgcanvas_);
+
+ this.fgcanvas_ = Dygraph.createCanvas();
+ this.fgcanvas_.className = 'dygraph-rangesel-fgcanvas';
+ this.fgcanvas_.style.position = 'absolute';
+ this.fgcanvas_.style.zIndex = 9;
+ this.fgcanvas_.style.cursor = 'default';
+ this.fgcanvas_ctx_ = Dygraph.getContext(this.fgcanvas_);
+};
+
+/**
+ * @private
+ * Creates overlay divs for IE/Excanvas so that mouse events are handled properly.
+ */
+rangeSelector.prototype.createIEPanOverlay_ = function() {
+ this.iePanOverlay_ = document.createElement("div");
+ this.iePanOverlay_.style.position = 'absolute';
+ this.iePanOverlay_.style.backgroundColor = 'white';
+ this.iePanOverlay_.style.filter = 'alpha(opacity=0)';
+ this.iePanOverlay_.style.display = 'none';
+ this.iePanOverlay_.style.cursor = 'move';
+ this.fgcanvas_.appendChild(this.iePanOverlay_);
+};
+
+/**
+ * @private
+ * Creates the zoom handle elements.
+ */
+rangeSelector.prototype.createZoomHandles_ = function() {
+ var img = new Image();
+ img.className = 'dygraph-rangesel-zoomhandle';
+ img.style.position = 'absolute';
+ img.style.zIndex = 10;
+ img.style.visibility = 'hidden'; // Initially hidden so they don't show up in the wrong place.
+ img.style.cursor = 'col-resize';
+
+ if (/MSIE 7/.test(navigator.userAgent)) { // IE7 doesn't support embedded src data.
+ img.width = 7;
+ img.height = 14;
+ img.style.backgroundColor = 'white';
+ img.style.border = '1px solid #333333'; // Just show box in IE7.
+ } else {
+ img.width = 9;
+ img.height = 16;
+ img.src = 'data:image/png;base64,' +
+'iVBORw0KGgoAAAANSUhEUgAAAAkAAAAQCAYAAADESFVDAAAAAXNSR0IArs4c6QAAAAZiS0dEANAA' +
+'zwDP4Z7KegAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB9sHGw0cMqdt1UwAAAAZdEVYdENv' +
+'bW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAaElEQVQoz+3SsRFAQBCF4Z9WJM8KCDVwownl' +
+'6YXsTmCUsyKGkZzcl7zkz3YLkypgAnreFmDEpHkIwVOMfpdi9CEEN2nGpFdwD03yEqDtOgCaun7s' +
+'qSTDH32I1pQA2Pb9sZecAxc5r3IAb21d6878xsAAAAAASUVORK5CYII=';
+ }
+
+ if (this.isMobileDevice_) {
+ img.width *= 2;
+ img.height *= 2;
+ }
+
+ this.leftZoomHandle_ = img;
+ this.rightZoomHandle_ = img.cloneNode(false);
+};
+
+/**
+ * @private
+ * Sets up the interaction for the range selector.
+ */
+rangeSelector.prototype.initInteraction_ = function() {
+ var self = this;
+ var topElem = this.isIE_ ? document : window;
+ var clientXLast = 0;
+ var handle = null;
+ var isZooming = false;
+ var isPanning = false;
+ var dynamic = !this.isMobileDevice_ && !this.isUsingExcanvas_;
+
+ // We cover iframes during mouse interactions. See comments in
+ // dygraph-utils.js for more info on why this is a good idea.
+ var tarp = new Dygraph.IFrameTarp();
+
+ // functions, defined below. Defining them this way (rather than with
+ // "function foo() {...}" makes JSHint happy.
+ var toXDataWindow, onZoomStart, onZoom, onZoomEnd, doZoom, isMouseInPanZone,
+ onPanStart, onPan, onPanEnd, doPan, onCanvasHover;
+
+ // Touch event functions
+ var onZoomHandleTouchEvent, onCanvasTouchEvent, addTouchEvents;
+
+ toXDataWindow = function(zoomHandleStatus) {
+ var xDataLimits = self.dygraph_.xAxisExtremes();
+ var fact = (xDataLimits[1] - xDataLimits[0])/self.canvasRect_.w;
+ var xDataMin = xDataLimits[0] + (zoomHandleStatus.leftHandlePos - self.canvasRect_.x)*fact;
+ var xDataMax = xDataLimits[0] + (zoomHandleStatus.rightHandlePos - self.canvasRect_.x)*fact;
+ return [xDataMin, xDataMax];
+ };
+
+ onZoomStart = function(e) {
+ Dygraph.cancelEvent(e);
+ isZooming = true;
+ clientXLast = e.clientX;
+ handle = e.target ? e.target : e.srcElement;
+ if (e.type === 'mousedown' || e.type === 'dragstart') {
+ // These events are removed manually.
+ Dygraph.addEvent(topElem, 'mousemove', onZoom);
+ Dygraph.addEvent(topElem, 'mouseup', onZoomEnd);
+ }
+ self.fgcanvas_.style.cursor = 'col-resize';
+ tarp.cover();
+ return true;
+ };
+
+ onZoom = function(e) {
+ if (!isZooming) {
+ return false;
+ }
+ Dygraph.cancelEvent(e);
+
+ var delX = e.clientX - clientXLast;
+ if (Math.abs(delX) < 4) {
+ return true;
+ }
+ clientXLast = e.clientX;
+
+ // Move handle.
+ var zoomHandleStatus = self.getZoomHandleStatus_();
+ var newPos;
+ if (handle == self.leftZoomHandle_) {
+ newPos = zoomHandleStatus.leftHandlePos + delX;
+ newPos = Math.min(newPos, zoomHandleStatus.rightHandlePos - handle.width - 3);
+ newPos = Math.max(newPos, self.canvasRect_.x);
+ } else {
+ newPos = zoomHandleStatus.rightHandlePos + delX;
+ newPos = Math.min(newPos, self.canvasRect_.x + self.canvasRect_.w);
+ newPos = Math.max(newPos, zoomHandleStatus.leftHandlePos + handle.width + 3);
+ }
+ var halfHandleWidth = handle.width/2;
+ handle.style.left = (newPos - halfHandleWidth) + 'px';
+ self.drawInteractiveLayer_();
+
+ // Zoom on the fly (if not using excanvas).
+ if (dynamic) {
+ doZoom();
+ }
+ return true;
+ };
+
+ onZoomEnd = function(e) {
+ if (!isZooming) {
+ return false;
+ }
+ isZooming = false;
+ tarp.uncover();
+ Dygraph.removeEvent(topElem, 'mousemove', onZoom);
+ Dygraph.removeEvent(topElem, 'mouseup', onZoomEnd);
+ self.fgcanvas_.style.cursor = 'default';
+
+ // If using excanvas, Zoom now.
+ if (!dynamic) {
+ doZoom();
+ }
+ return true;
+ };
+
+ doZoom = function() {
+ try {
+ var zoomHandleStatus = self.getZoomHandleStatus_();
+ self.isChangingRange_ = true;
+ if (!zoomHandleStatus.isZoomed) {
+ self.dygraph_.resetZoom();
+ } else {
+ var xDataWindow = toXDataWindow(zoomHandleStatus);
+ self.dygraph_.doZoomXDates_(xDataWindow[0], xDataWindow[1]);
+ }
+ } finally {
+ self.isChangingRange_ = false;
+ }
+ };
+
+ isMouseInPanZone = function(e) {
+ if (self.isUsingExcanvas_) {
+ return e.srcElement == self.iePanOverlay_;
+ } else {
+ var rect = self.leftZoomHandle_.getBoundingClientRect();
+ var leftHandleClientX = rect.left + rect.width/2;
+ rect = self.rightZoomHandle_.getBoundingClientRect();
+ var rightHandleClientX = rect.left + rect.width/2;
+ return (e.clientX > leftHandleClientX && e.clientX < rightHandleClientX);
+ }
+ };
+
+ onPanStart = function(e) {
+ if (!isPanning && isMouseInPanZone(e) && self.getZoomHandleStatus_().isZoomed) {
+ Dygraph.cancelEvent(e);
+ isPanning = true;
+ clientXLast = e.clientX;
+ if (e.type === 'mousedown') {
+ // These events are removed manually.
+ Dygraph.addEvent(topElem, 'mousemove', onPan);
+ Dygraph.addEvent(topElem, 'mouseup', onPanEnd);
+ }
+ return true;
+ }
+ return false;
+ };
+
+ onPan = function(e) {
+ if (!isPanning) {
+ return false;
+ }
+ Dygraph.cancelEvent(e);
+
+ var delX = e.clientX - clientXLast;
+ if (Math.abs(delX) < 4) {
+ return true;
+ }
+ clientXLast = e.clientX;
+
+ // Move range view
+ var zoomHandleStatus = self.getZoomHandleStatus_();
+ var leftHandlePos = zoomHandleStatus.leftHandlePos;
+ var rightHandlePos = zoomHandleStatus.rightHandlePos;
+ var rangeSize = rightHandlePos - leftHandlePos;
+ if (leftHandlePos + delX <= self.canvasRect_.x) {
+ leftHandlePos = self.canvasRect_.x;
+ rightHandlePos = leftHandlePos + rangeSize;
+ } else if (rightHandlePos + delX >= self.canvasRect_.x + self.canvasRect_.w) {
+ rightHandlePos = self.canvasRect_.x + self.canvasRect_.w;
+ leftHandlePos = rightHandlePos - rangeSize;
+ } else {
+ leftHandlePos += delX;
+ rightHandlePos += delX;
+ }
+ var halfHandleWidth = self.leftZoomHandle_.width/2;
+ self.leftZoomHandle_.style.left = (leftHandlePos - halfHandleWidth) + 'px';
+ self.rightZoomHandle_.style.left = (rightHandlePos - halfHandleWidth) + 'px';
+ self.drawInteractiveLayer_();
+
+ // Do pan on the fly (if not using excanvas).
+ if (dynamic) {
+ doPan();
+ }
+ return true;
+ };
+
+ onPanEnd = function(e) {
+ if (!isPanning) {
+ return false;
+ }
+ isPanning = false;
+ Dygraph.removeEvent(topElem, 'mousemove', onPan);
+ Dygraph.removeEvent(topElem, 'mouseup', onPanEnd);
+ // If using excanvas, do pan now.
+ if (!dynamic) {
+ doPan();
+ }
+ return true;
+ };
+
+ doPan = function() {
+ try {
+ self.isChangingRange_ = true;
+ self.dygraph_.dateWindow_ = toXDataWindow(self.getZoomHandleStatus_());
+ self.dygraph_.drawGraph_(false);
+ } finally {
+ self.isChangingRange_ = false;
+ }
+ };
+
+ onCanvasHover = function(e) {
+ if (isZooming || isPanning) {
+ return;
+ }
+ var cursor = isMouseInPanZone(e) ? 'move' : 'default';
+ if (cursor != self.fgcanvas_.style.cursor) {
+ self.fgcanvas_.style.cursor = cursor;
+ }
+ };
+
+ onZoomHandleTouchEvent = function(e) {
+ if (e.type == 'touchstart' && e.targetTouches.length == 1) {
+ if (onZoomStart(e.targetTouches[0])) {
+ Dygraph.cancelEvent(e);
+ }
+ } else if (e.type == 'touchmove' && e.targetTouches.length == 1) {
+ if (onZoom(e.targetTouches[0])) {
+ Dygraph.cancelEvent(e);
+ }
+ } else {
+ onZoomEnd(e);
+ }
+ };
+
+ onCanvasTouchEvent = function(e) {
+ if (e.type == 'touchstart' && e.targetTouches.length == 1) {
+ if (onPanStart(e.targetTouches[0])) {
+ Dygraph.cancelEvent(e);
+ }
+ } else if (e.type == 'touchmove' && e.targetTouches.length == 1) {
+ if (onPan(e.targetTouches[0])) {
+ Dygraph.cancelEvent(e);
+ }
+ } else {
+ onPanEnd(e);
+ }
+ };
+
+ addTouchEvents = function(elem, fn) {
+ var types = ['touchstart', 'touchend', 'touchmove', 'touchcancel'];
+ for (var i = 0; i < types.length; i++) {
+ self.dygraph_.addAndTrackEvent(elem, types[i], fn);
+ }
+ };
+
+ this.setDefaultOption_('interactionModel', Dygraph.Interaction.dragIsPanInteractionModel);
+ this.setDefaultOption_('panEdgeFraction', 0.0001);
+
+ var dragStartEvent = window.opera ? 'mousedown' : 'dragstart';
+ this.dygraph_.addAndTrackEvent(this.leftZoomHandle_, dragStartEvent, onZoomStart);
+ this.dygraph_.addAndTrackEvent(this.rightZoomHandle_, dragStartEvent, onZoomStart);
+
+ if (this.isUsingExcanvas_) {
+ this.dygraph_.addAndTrackEvent(this.iePanOverlay_, 'mousedown', onPanStart);
+ } else {
+ this.dygraph_.addAndTrackEvent(this.fgcanvas_, 'mousedown', onPanStart);
+ this.dygraph_.addAndTrackEvent(this.fgcanvas_, 'mousemove', onCanvasHover);
+ }
+
+ // Touch events
+ if (this.hasTouchInterface_) {
+ addTouchEvents(this.leftZoomHandle_, onZoomHandleTouchEvent);
+ addTouchEvents(this.rightZoomHandle_, onZoomHandleTouchEvent);
+ addTouchEvents(this.fgcanvas_, onCanvasTouchEvent);
+ }
+};
+
+/**
+ * @private
+ * Draws the static layer in the background canvas.
+ */
+rangeSelector.prototype.drawStaticLayer_ = function() {
+ var ctx = this.bgcanvas_ctx_;
+ ctx.clearRect(0, 0, this.canvasRect_.w, this.canvasRect_.h);
+ try {
+ this.drawMiniPlot_();
+ } catch(ex) {
+ Dygraph.warn(ex);
+ }
+
+ var margin = 0.5;
+ this.bgcanvas_ctx_.lineWidth = 1;
+ ctx.strokeStyle = 'gray';
+ ctx.beginPath();
+ ctx.moveTo(margin, margin);
+ ctx.lineTo(margin, this.canvasRect_.h-margin);
+ ctx.lineTo(this.canvasRect_.w-margin, this.canvasRect_.h-margin);
+ ctx.lineTo(this.canvasRect_.w-margin, margin);
+ ctx.stroke();
+};
+
+
+/**
+ * @private
+ * Draws the mini plot in the background canvas.
+ */
+rangeSelector.prototype.drawMiniPlot_ = function() {
+ var fillStyle = this.getOption_('rangeSelectorPlotFillColor');
+ var strokeStyle = this.getOption_('rangeSelectorPlotStrokeColor');
+ if (!fillStyle && !strokeStyle) {
+ return;
+ }
+
+ var stepPlot = this.getOption_('stepPlot');
+
+ var combinedSeriesData = this.computeCombinedSeriesAndLimits_();
+ var yRange = combinedSeriesData.yMax - combinedSeriesData.yMin;
+
+ // Draw the mini plot.
+ var ctx = this.bgcanvas_ctx_;
+ var margin = 0.5;
+
+ var xExtremes = this.dygraph_.xAxisExtremes();
+ var xRange = Math.max(xExtremes[1] - xExtremes[0], 1.e-30);
+ var xFact = (this.canvasRect_.w - margin)/xRange;
+ var yFact = (this.canvasRect_.h - margin)/yRange;
+ var canvasWidth = this.canvasRect_.w - margin;
+ var canvasHeight = this.canvasRect_.h - margin;
+
+ var prevX = null, prevY = null;
+
+ ctx.beginPath();
+ ctx.moveTo(margin, canvasHeight);
+ for (var i = 0; i < combinedSeriesData.data.length; i++) {
+ var dataPoint = combinedSeriesData.data[i];
+ var x = ((dataPoint[0] !== null) ? ((dataPoint[0] - xExtremes[0])*xFact) : NaN);
+ var y = ((dataPoint[1] !== null) ? (canvasHeight - (dataPoint[1] - combinedSeriesData.yMin)*yFact) : NaN);
+ if (isFinite(x) && isFinite(y)) {
+ if(prevX === null) {
+ ctx.lineTo(x, canvasHeight);
+ }
+ else if (stepPlot) {
+ ctx.lineTo(x, prevY);
+ }
+ ctx.lineTo(x, y);
+ prevX = x;
+ prevY = y;
+ }
+ else {
+ if(prevX !== null) {
+ if (stepPlot) {
+ ctx.lineTo(x, prevY);
+ ctx.lineTo(x, canvasHeight);
+ }
+ else {
+ ctx.lineTo(prevX, canvasHeight);
+ }
+ }
+ prevX = prevY = null;
+ }
+ }
+ ctx.lineTo(canvasWidth, canvasHeight);
+ ctx.closePath();
+
+ if (fillStyle) {
+ var lingrad = this.bgcanvas_ctx_.createLinearGradient(0, 0, 0, canvasHeight);
+ lingrad.addColorStop(0, 'white');
+ lingrad.addColorStop(1, fillStyle);
+ this.bgcanvas_ctx_.fillStyle = lingrad;
+ ctx.fill();
+ }
+
+ if (strokeStyle) {
+ this.bgcanvas_ctx_.strokeStyle = strokeStyle;
+ this.bgcanvas_ctx_.lineWidth = 1.5;
+ ctx.stroke();
+ }
+};
+
+/**
+ * @private
+ * Computes and returns the combinded series data along with min/max for the mini plot.
+ * @return {Object} An object containing combinded series array, ymin, ymax.
+ */
+rangeSelector.prototype.computeCombinedSeriesAndLimits_ = function() {
+ var data = this.dygraph_.rawData_;
+ var logscale = this.getOption_('logscale');
+
+ // Create a combined series (average of all series values).
+ var combinedSeries = [];
+ var sum;
+ var count;
+ var mutipleValues;
+ var i, j, k;
+ var xVal, yVal;
+
+ // Find out if data has multiple values per datapoint.
+ // Go to first data point that actually has values (see http://code.google.com/p/dygraphs/issues/detail?id=246)
+ for (i = 0; i < data.length; i++) {
+ if (data[i].length > 1 && data[i][1] !== null) {
+ mutipleValues = typeof data[i][1] != 'number';
+ if (mutipleValues) {
+ sum = [];
+ count = [];
+ for (k = 0; k < data[i][1].length; k++) {
+ sum.push(0);
+ count.push(0);
+ }
+ }
+ break;
+ }
+ }
+
+ for (i = 0; i < data.length; i++) {
+ var dataPoint = data[i];
+ xVal = dataPoint[0];
+
+ if (mutipleValues) {
+ for (k = 0; k < sum.length; k++) {
+ sum[k] = count[k] = 0;
+ }
+ } else {
+ sum = count = 0;
+ }
+
+ for (j = 1; j < dataPoint.length; j++) {
+ if (this.dygraph_.visibility()[j-1]) {
+ var y;
+ if (mutipleValues) {
+ for (k = 0; k < sum.length; k++) {
+ y = dataPoint[j][k];
+ if (y === null || isNaN(y)) continue;
+ sum[k] += y;
+ count[k]++;
+ }
+ } else {
+ y = dataPoint[j];
+ if (y === null || isNaN(y)) continue;
+ sum += y;
+ count++;
+ }
+ }
+ }
+
+ if (mutipleValues) {
+ for (k = 0; k < sum.length; k++) {
+ sum[k] /= count[k];
+ }
+ yVal = sum.slice(0);
+ } else {
+ yVal = sum/count;
+ }
+
+ combinedSeries.push([xVal, yVal]);
+ }
+
+ // Account for roll period, fractions.
+ combinedSeries = this.dygraph_.rollingAverage(combinedSeries, this.dygraph_.rollPeriod_);
+
+ if (typeof combinedSeries[0][1] != 'number') {
+ for (i = 0; i < combinedSeries.length; i++) {
+ yVal = combinedSeries[i][1];
+ combinedSeries[i][1] = yVal[0];
+ }
+ }
+
+ // Compute the y range.
+ var yMin = Number.MAX_VALUE;
+ var yMax = -Number.MAX_VALUE;
+ for (i = 0; i < combinedSeries.length; i++) {
+ yVal = combinedSeries[i][1];
+ if (yVal !== null && isFinite(yVal) && (!logscale || yVal > 0)) {
+ yMin = Math.min(yMin, yVal);
+ yMax = Math.max(yMax, yVal);
+ }
+ }
+
+ // Convert Y data to log scale if needed.
+ // Also, expand the Y range to compress the mini plot a little.
+ var extraPercent = 0.25;
+ if (logscale) {
+ yMax = Dygraph.log10(yMax);
+ yMax += yMax*extraPercent;
+ yMin = Dygraph.log10(yMin);
+ for (i = 0; i < combinedSeries.length; i++) {
+ combinedSeries[i][1] = Dygraph.log10(combinedSeries[i][1]);
+ }
+ } else {
+ var yExtra;
+ var yRange = yMax - yMin;
+ if (yRange <= Number.MIN_VALUE) {
+ yExtra = yMax*extraPercent;
+ } else {
+ yExtra = yRange*extraPercent;
+ }
+ yMax += yExtra;
+ yMin -= yExtra;
+ }
+
+ return {data: combinedSeries, yMin: yMin, yMax: yMax};
+};
+
+/**
+ * @private
+ * Places the zoom handles in the proper position based on the current X data window.
+ */
+rangeSelector.prototype.placeZoomHandles_ = function() {
+ var xExtremes = this.dygraph_.xAxisExtremes();
+ var xWindowLimits = this.dygraph_.xAxisRange();
+ var xRange = xExtremes[1] - xExtremes[0];
+ var leftPercent = Math.max(0, (xWindowLimits[0] - xExtremes[0])/xRange);
+ var rightPercent = Math.max(0, (xExtremes[1] - xWindowLimits[1])/xRange);
+ var leftCoord = this.canvasRect_.x + this.canvasRect_.w*leftPercent;
+ var rightCoord = this.canvasRect_.x + this.canvasRect_.w*(1 - rightPercent);
+ var handleTop = Math.max(this.canvasRect_.y, this.canvasRect_.y + (this.canvasRect_.h - this.leftZoomHandle_.height)/2);
+ var halfHandleWidth = this.leftZoomHandle_.width/2;
+ this.leftZoomHandle_.style.left = (leftCoord - halfHandleWidth) + 'px';
+ this.leftZoomHandle_.style.top = handleTop + 'px';
+ this.rightZoomHandle_.style.left = (rightCoord - halfHandleWidth) + 'px';
+ this.rightZoomHandle_.style.top = this.leftZoomHandle_.style.top;
+
+ this.leftZoomHandle_.style.visibility = 'visible';
+ this.rightZoomHandle_.style.visibility = 'visible';
+};
+
+/**
+ * @private
+ * Draws the interactive layer in the foreground canvas.
+ */
+rangeSelector.prototype.drawInteractiveLayer_ = function() {
+ var ctx = this.fgcanvas_ctx_;
+ ctx.clearRect(0, 0, this.canvasRect_.w, this.canvasRect_.h);
+ var margin = 1;
+ var width = this.canvasRect_.w - margin;
+ var height = this.canvasRect_.h - margin;
+ var zoomHandleStatus = this.getZoomHandleStatus_();
+
+ ctx.strokeStyle = 'black';
+ if (!zoomHandleStatus.isZoomed) {
+ ctx.beginPath();
+ ctx.moveTo(margin, margin);
+ ctx.lineTo(margin, height);
+ ctx.lineTo(width, height);
+ ctx.lineTo(width, margin);
+ ctx.stroke();
+ if (this.iePanOverlay_) {
+ this.iePanOverlay_.style.display = 'none';
+ }
+ } else {
+ var leftHandleCanvasPos = Math.max(margin, zoomHandleStatus.leftHandlePos - this.canvasRect_.x);
+ var rightHandleCanvasPos = Math.min(width, zoomHandleStatus.rightHandlePos - this.canvasRect_.x);
+
+ ctx.fillStyle = 'rgba(240, 240, 240, 0.6)';
+ ctx.fillRect(0, 0, leftHandleCanvasPos, this.canvasRect_.h);
+ ctx.fillRect(rightHandleCanvasPos, 0, this.canvasRect_.w - rightHandleCanvasPos, this.canvasRect_.h);
+
+ ctx.beginPath();
+ ctx.moveTo(margin, margin);
+ ctx.lineTo(leftHandleCanvasPos, margin);
+ ctx.lineTo(leftHandleCanvasPos, height);
+ ctx.lineTo(rightHandleCanvasPos, height);
+ ctx.lineTo(rightHandleCanvasPos, margin);
+ ctx.lineTo(width, margin);
+ ctx.stroke();
+
+ if (this.isUsingExcanvas_) {
+ this.iePanOverlay_.style.width = (rightHandleCanvasPos - leftHandleCanvasPos) + 'px';
+ this.iePanOverlay_.style.left = leftHandleCanvasPos + 'px';
+ this.iePanOverlay_.style.height = height + 'px';
+ this.iePanOverlay_.style.display = 'inline';
+ }
+ }
+};
+
+/**
+ * @private
+ * Returns the current zoom handle position information.
+ * @return {Object} The zoom handle status.
+ */
+rangeSelector.prototype.getZoomHandleStatus_ = function() {
+ var halfHandleWidth = this.leftZoomHandle_.width/2;
+ var leftHandlePos = parseFloat(this.leftZoomHandle_.style.left) + halfHandleWidth;
+ var rightHandlePos = parseFloat(this.rightZoomHandle_.style.left) + halfHandleWidth;
+ return {
+ leftHandlePos: leftHandlePos,
+ rightHandlePos: rightHandlePos,
+ isZoomed: (leftHandlePos - 1 > this.canvasRect_.x || rightHandlePos + 1 < this.canvasRect_.x+this.canvasRect_.w)
+ };
+};
+
+return rangeSelector;
+
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/rgbcolor/rgbcolor.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/rgbcolor/rgbcolor.js
new file mode 100644
index 00000000..5a882446
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/rgbcolor/rgbcolor.js
@@ -0,0 +1,257 @@
+/**
+ * A class to parse color values
+ *
+ * NOTE: modified by danvk. I removed the "getHelpXML" function to reduce the
+ * file size, added "use strict" and a few "var" declarations where needed.
+ *
+ * Modifications by adilh:
+ * Original "RGBColor" function name collides with:
+ * http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-RGBColor
+ * so renamed to "RGBColorParser"
+ *
+ * @author Stoyan Stefanov <sstoo@gmail.com>
+ * @link http://www.phpied.com/rgb-color-parser-in-javascript/
+ * @license Use it if you like it
+ */
+"use strict";
+
+function RGBColorParser(color_string)
+{
+ this.ok = false;
+
+ // strip any leading #
+ if (color_string.charAt(0) == '#') { // remove # if any
+ color_string = color_string.substr(1,6);
+ }
+
+ color_string = color_string.replace(/ /g,'');
+ color_string = color_string.toLowerCase();
+
+ // before getting into regexps, try simple matches
+ // and overwrite the input
+ var simple_colors = {
+ aliceblue: 'f0f8ff',
+ antiquewhite: 'faebd7',
+ aqua: '00ffff',
+ aquamarine: '7fffd4',
+ azure: 'f0ffff',
+ beige: 'f5f5dc',
+ bisque: 'ffe4c4',
+ black: '000000',
+ blanchedalmond: 'ffebcd',
+ blue: '0000ff',
+ blueviolet: '8a2be2',
+ brown: 'a52a2a',
+ burlywood: 'deb887',
+ cadetblue: '5f9ea0',
+ chartreuse: '7fff00',
+ chocolate: 'd2691e',
+ coral: 'ff7f50',
+ cornflowerblue: '6495ed',
+ cornsilk: 'fff8dc',
+ crimson: 'dc143c',
+ cyan: '00ffff',
+ darkblue: '00008b',
+ darkcyan: '008b8b',
+ darkgoldenrod: 'b8860b',
+ darkgray: 'a9a9a9',
+ darkgreen: '006400',
+ darkkhaki: 'bdb76b',
+ darkmagenta: '8b008b',
+ darkolivegreen: '556b2f',
+ darkorange: 'ff8c00',
+ darkorchid: '9932cc',
+ darkred: '8b0000',
+ darksalmon: 'e9967a',
+ darkseagreen: '8fbc8f',
+ darkslateblue: '483d8b',
+ darkslategray: '2f4f4f',
+ darkturquoise: '00ced1',
+ darkviolet: '9400d3',
+ deeppink: 'ff1493',
+ deepskyblue: '00bfff',
+ dimgray: '696969',
+ dodgerblue: '1e90ff',
+ feldspar: 'd19275',
+ firebrick: 'b22222',
+ floralwhite: 'fffaf0',
+ forestgreen: '228b22',
+ fuchsia: 'ff00ff',
+ gainsboro: 'dcdcdc',
+ ghostwhite: 'f8f8ff',
+ gold: 'ffd700',
+ goldenrod: 'daa520',
+ gray: '808080',
+ green: '008000',
+ greenyellow: 'adff2f',
+ honeydew: 'f0fff0',
+ hotpink: 'ff69b4',
+ indianred : 'cd5c5c',
+ indigo : '4b0082',
+ ivory: 'fffff0',
+ khaki: 'f0e68c',
+ lavender: 'e6e6fa',
+ lavenderblush: 'fff0f5',
+ lawngreen: '7cfc00',
+ lemonchiffon: 'fffacd',
+ lightblue: 'add8e6',
+ lightcoral: 'f08080',
+ lightcyan: 'e0ffff',
+ lightgoldenrodyellow: 'fafad2',
+ lightgrey: 'd3d3d3',
+ lightgreen: '90ee90',
+ lightpink: 'ffb6c1',
+ lightsalmon: 'ffa07a',
+ lightseagreen: '20b2aa',
+ lightskyblue: '87cefa',
+ lightslateblue: '8470ff',
+ lightslategray: '778899',
+ lightsteelblue: 'b0c4de',
+ lightyellow: 'ffffe0',
+ lime: '00ff00',
+ limegreen: '32cd32',
+ linen: 'faf0e6',
+ magenta: 'ff00ff',
+ maroon: '800000',
+ mediumaquamarine: '66cdaa',
+ mediumblue: '0000cd',
+ mediumorchid: 'ba55d3',
+ mediumpurple: '9370d8',
+ mediumseagreen: '3cb371',
+ mediumslateblue: '7b68ee',
+ mediumspringgreen: '00fa9a',
+ mediumturquoise: '48d1cc',
+ mediumvioletred: 'c71585',
+ midnightblue: '191970',
+ mintcream: 'f5fffa',
+ mistyrose: 'ffe4e1',
+ moccasin: 'ffe4b5',
+ navajowhite: 'ffdead',
+ navy: '000080',
+ oldlace: 'fdf5e6',
+ olive: '808000',
+ olivedrab: '6b8e23',
+ orange: 'ffa500',
+ orangered: 'ff4500',
+ orchid: 'da70d6',
+ palegoldenrod: 'eee8aa',
+ palegreen: '98fb98',
+ paleturquoise: 'afeeee',
+ palevioletred: 'd87093',
+ papayawhip: 'ffefd5',
+ peachpuff: 'ffdab9',
+ peru: 'cd853f',
+ pink: 'ffc0cb',
+ plum: 'dda0dd',
+ powderblue: 'b0e0e6',
+ purple: '800080',
+ red: 'ff0000',
+ rosybrown: 'bc8f8f',
+ royalblue: '4169e1',
+ saddlebrown: '8b4513',
+ salmon: 'fa8072',
+ sandybrown: 'f4a460',
+ seagreen: '2e8b57',
+ seashell: 'fff5ee',
+ sienna: 'a0522d',
+ silver: 'c0c0c0',
+ skyblue: '87ceeb',
+ slateblue: '6a5acd',
+ slategray: '708090',
+ snow: 'fffafa',
+ springgreen: '00ff7f',
+ steelblue: '4682b4',
+ tan: 'd2b48c',
+ teal: '008080',
+ thistle: 'd8bfd8',
+ tomato: 'ff6347',
+ turquoise: '40e0d0',
+ violet: 'ee82ee',
+ violetred: 'd02090',
+ wheat: 'f5deb3',
+ white: 'ffffff',
+ whitesmoke: 'f5f5f5',
+ yellow: 'ffff00',
+ yellowgreen: '9acd32'
+ };
+ for (var key in simple_colors) {
+ if (color_string == key) {
+ color_string = simple_colors[key];
+ }
+ }
+ // emd of simple type-in colors
+
+ // array of color definition objects
+ var color_defs = [
+ {
+ re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
+ example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
+ process: function (bits){
+ return [
+ parseInt(bits[1]),
+ parseInt(bits[2]),
+ parseInt(bits[3])
+ ];
+ }
+ },
+ {
+ re: /^(\w{2})(\w{2})(\w{2})$/,
+ example: ['#00ff00', '336699'],
+ process: function (bits){
+ return [
+ parseInt(bits[1], 16),
+ parseInt(bits[2], 16),
+ parseInt(bits[3], 16)
+ ];
+ }
+ },
+ {
+ re: /^(\w{1})(\w{1})(\w{1})$/,
+ example: ['#fb0', 'f0f'],
+ process: function (bits){
+ return [
+ parseInt(bits[1] + bits[1], 16),
+ parseInt(bits[2] + bits[2], 16),
+ parseInt(bits[3] + bits[3], 16)
+ ];
+ }
+ }
+ ];
+
+ // search through the definitions to find a match
+ for (var i = 0; i < color_defs.length; i++) {
+ var re = color_defs[i].re;
+ var processor = color_defs[i].process;
+ var bits = re.exec(color_string);
+ if (bits) {
+ var channels = processor(bits);
+ this.r = channels[0];
+ this.g = channels[1];
+ this.b = channels[2];
+ this.ok = true;
+ }
+
+ }
+
+ // validate/cleanup values
+ this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);
+ this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);
+ this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);
+
+ // some getters
+ this.toRGB = function () {
+ return 'rgb(' + this.r + ', ' + this.g + ', ' + this.b + ')';
+ }
+ this.toHex = function () {
+ var r = this.r.toString(16);
+ var g = this.g.toString(16);
+ var b = this.b.toString(16);
+ if (r.length == 1) r = '0' + r;
+ if (g.length == 1) g = '0' + g;
+ if (b.length == 1) b = '0' + b;
+ return '#' + r + g + b;
+ }
+
+
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/stacktrace.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/stacktrace.js
new file mode 100644
index 00000000..4d0384d1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/stacktrace.js
@@ -0,0 +1,411 @@
+// Domain Public by Eric Wendelin http://eriwen.com/ (2008)
+// Luke Smith http://lucassmith.name/ (2008)
+// Loic Dachary <loic@dachary.org> (2008)
+// Johan Euphrosine <proppy@aminche.com> (2008)
+// Oyvind Sean Kinsey http://kinsey.no/blog (2010)
+// Victor Homyakov <victor-homyakov@users.sourceforge.net> (2010)
+
+/**
+ * Main function giving a function stack trace with a forced or passed in Error
+ *
+ * @cfg {Error} e The error to create a stacktrace from (optional)
+ * @cfg {Boolean} guess If we should try to resolve the names of anonymous functions
+ * @return {Array} of Strings with functions, lines, files, and arguments where possible
+ */
+function printStackTrace(options) {
+ options = options || {guess: true};
+ var ex = options.e || null, guess = !!options.guess;
+ var p = new printStackTrace.implementation(), result = p.run(ex);
+ return (guess) ? p.guessAnonymousFunctions(result) : result;
+}
+
+printStackTrace.implementation = function() {
+};
+
+printStackTrace.implementation.prototype = {
+ /**
+ * @param {Error} ex The error to create a stacktrace from (optional)
+ * @param {String} mode Forced mode (optional, mostly for unit tests)
+ */
+ run: function(ex, mode) {
+ ex = ex || this.createException();
+ // examine exception properties w/o debugger
+ //for (var prop in ex) {alert("Ex['" + prop + "']=" + ex[prop]);}
+ mode = mode || this.mode(ex);
+ if (mode === 'other') {
+ return this.other(arguments.callee);
+ } else {
+ return this[mode](ex);
+ }
+ },
+
+ createException: function() {
+ try {
+ this.undef();
+ } catch (e) {
+ return e;
+ }
+ },
+
+ /**
+ * Mode could differ for different exception, e.g.
+ * exceptions in Chrome may or may not have arguments or stack.
+ *
+ * @return {String} mode of operation for the exception
+ */
+ mode: function(e) {
+ if (e['arguments'] && e.stack) {
+ return 'chrome';
+ } else if (typeof e.message === 'string' && typeof window !== 'undefined' && window.opera) {
+ // e.message.indexOf("Backtrace:") > -1 -> opera
+ // !e.stacktrace -> opera
+ if (!e.stacktrace) {
+ return 'opera9'; // use e.message
+ }
+ // 'opera#sourceloc' in e -> opera9, opera10a
+ if (e.message.indexOf('\n') > -1 && e.message.split('\n').length > e.stacktrace.split('\n').length) {
+ return 'opera9'; // use e.message
+ }
+ // e.stacktrace && !e.stack -> opera10a
+ if (!e.stack) {
+ return 'opera10a'; // use e.stacktrace
+ }
+ // e.stacktrace && e.stack -> opera10b
+ if (e.stacktrace.indexOf("called from line") < 0) {
+ return 'opera10b'; // use e.stacktrace, format differs from 'opera10a'
+ }
+ // e.stacktrace && e.stack -> opera11
+ return 'opera11'; // use e.stacktrace, format differs from 'opera10a', 'opera10b'
+ } else if (e.stack) {
+ return 'firefox';
+ }
+ return 'other';
+ },
+
+ /**
+ * Given a context, function name, and callback function, overwrite it so that it calls
+ * printStackTrace() first with a callback and then runs the rest of the body.
+ *
+ * @param {Object} context of execution (e.g. window)
+ * @param {String} functionName to instrument
+ * @param {Function} function to call with a stack trace on invocation
+ */
+ instrumentFunction: function(context, functionName, callback) {
+ context = context || window;
+ var original = context[functionName];
+ context[functionName] = function instrumented() {
+ callback.call(this, printStackTrace().slice(4));
+ return context[functionName]._instrumented.apply(this, arguments);
+ };
+ context[functionName]._instrumented = original;
+ },
+
+ /**
+ * Given a context and function name of a function that has been
+ * instrumented, revert the function to it's original (non-instrumented)
+ * state.
+ *
+ * @param {Object} context of execution (e.g. window)
+ * @param {String} functionName to de-instrument
+ */
+ deinstrumentFunction: function(context, functionName) {
+ if (context[functionName].constructor === Function &&
+ context[functionName]._instrumented &&
+ context[functionName]._instrumented.constructor === Function) {
+ context[functionName] = context[functionName]._instrumented;
+ }
+ },
+
+ /**
+ * Given an Error object, return a formatted Array based on Chrome's stack string.
+ *
+ * @param e - Error object to inspect
+ * @return Array<String> of function calls, files and line numbers
+ */
+ chrome: function(e) {
+ var stack = (e.stack + '\n').replace(/^\S[^\(]+?[\n$]/gm, '').
+ replace(/^\s+at\s+/gm, '').
+ replace(/^([^\(]+?)([\n$])/gm, '{anonymous}()@$1$2').
+ replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm, '{anonymous}()@$1').split('\n');
+ stack.pop();
+ return stack;
+ },
+
+ /**
+ * Given an Error object, return a formatted Array based on Firefox's stack string.
+ *
+ * @param e - Error object to inspect
+ * @return Array<String> of function calls, files and line numbers
+ */
+ firefox: function(e) {
+ return e.stack.replace(/(?:\n@:0)?\s+$/m, '').replace(/^\(/gm, '{anonymous}(').split('\n');
+ },
+
+ opera11: function(e) {
+ // "Error thrown at line 42, column 12 in <anonymous function>() in file://localhost/G:/js/stacktrace.js:\n"
+ // "Error thrown at line 42, column 12 in <anonymous function: createException>() in file://localhost/G:/js/stacktrace.js:\n"
+ // "called from line 7, column 4 in bar(n) in file://localhost/G:/js/test/functional/testcase1.html:\n"
+ // "called from line 15, column 3 in file://localhost/G:/js/test/functional/testcase1.html:\n"
+ var ANON = '{anonymous}', lineRE = /^.*line (\d+), column (\d+)(?: in (.+))? in (\S+):$/;
+ var lines = e.stacktrace.split('\n'), result = [];
+
+ for (var i = 0, len = lines.length; i < len; i += 2) {
+ var match = lineRE.exec(lines[i]);
+ if (match) {
+ var location = match[4] + ':' + match[1] + ':' + match[2];
+ var fnName = match[3] || "global code";
+ fnName = fnName.replace(/<anonymous function: (\S+)>/, "$1").replace(/<anonymous function>/, ANON);
+ result.push(fnName + '@' + location + ' -- ' + lines[i + 1].replace(/^\s+/, ''));
+ }
+ }
+
+ return result;
+ },
+
+ opera10b: function(e) {
+ // "<anonymous function: run>([arguments not available])@file://localhost/G:/js/stacktrace.js:27\n" +
+ // "printStackTrace([arguments not available])@file://localhost/G:/js/stacktrace.js:18\n" +
+ // "@file://localhost/G:/js/test/functional/testcase1.html:15"
+ var ANON = '{anonymous}', lineRE = /^(.*)@(.+):(\d+)$/;
+ var lines = e.stacktrace.split('\n'), result = [];
+
+ for (var i = 0, len = lines.length; i < len; i++) {
+ var match = lineRE.exec(lines[i]);
+ if (match) {
+ var fnName = match[1]? (match[1] + '()') : "global code";
+ result.push(fnName + '@' + match[2] + ':' + match[3]);
+ }
+ }
+
+ return result;
+ },
+
+ /**
+ * Given an Error object, return a formatted Array based on Opera 10's stacktrace string.
+ *
+ * @param e - Error object to inspect
+ * @return Array<String> of function calls, files and line numbers
+ */
+ opera10a: function(e) {
+ // " Line 27 of linked script file://localhost/G:/js/stacktrace.js\n"
+ // " Line 11 of inline#1 script in file://localhost/G:/js/test/functional/testcase1.html: In function foo\n"
+ var ANON = '{anonymous}', lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
+ var lines = e.stacktrace.split('\n'), result = [];
+
+ for (var i = 0, len = lines.length; i < len; i += 2) {
+ var match = lineRE.exec(lines[i]);
+ if (match) {
+ var fnName = match[3] || ANON;
+ result.push(fnName + '()@' + match[2] + ':' + match[1] + ' -- ' + lines[i + 1].replace(/^\s+/, ''));
+ }
+ }
+
+ return result;
+ },
+
+ // Opera 7.x-9.2x only!
+ opera9: function(e) {
+ // " Line 43 of linked script file://localhost/G:/js/stacktrace.js\n"
+ // " Line 7 of inline#1 script in file://localhost/G:/js/test/functional/testcase1.html\n"
+ var ANON = '{anonymous}', lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
+ var lines = e.message.split('\n'), result = [];
+
+ for (var i = 2, len = lines.length; i < len; i += 2) {
+ var match = lineRE.exec(lines[i]);
+ if (match) {
+ result.push(ANON + '()@' + match[2] + ':' + match[1] + ' -- ' + lines[i + 1].replace(/^\s+/, ''));
+ }
+ }
+
+ return result;
+ },
+
+ // Safari, IE, and others
+ other: function(curr) {
+ var ANON = '{anonymous}', fnRE = /function\s*([\w\-$]+)?\s*\(/i, stack = [], fn, args, maxStackSize = 10;
+ while (curr && stack.length < maxStackSize) {
+ fn = fnRE.test(curr.toString()) ? RegExp.$1 || ANON : ANON;
+ args = Array.prototype.slice.call(curr['arguments'] || []);
+ stack[stack.length] = fn + '(' + this.stringifyArguments(args) + ')';
+ curr = curr.caller;
+ }
+ return stack;
+ },
+
+ /**
+ * Given arguments array as a String, subsituting type names for non-string types.
+ *
+ * @param {Arguments} object
+ * @return {Array} of Strings with stringified arguments
+ */
+ stringifyArguments: function(args) {
+ var result = [];
+ var slice = Array.prototype.slice;
+ for (var i = 0; i < args.length; ++i) {
+ var arg = args[i];
+ if (arg === undefined) {
+ result[i] = 'undefined';
+ } else if (arg === null) {
+ result[i] = 'null';
+ } else if (arg.constructor) {
+ if (arg.constructor === Array) {
+ if (arg.length < 3) {
+ result[i] = '[' + this.stringifyArguments(arg) + ']';
+ } else {
+ result[i] = '[' + this.stringifyArguments(slice.call(arg, 0, 1)) + '...' + this.stringifyArguments(slice.call(arg, -1)) + ']';
+ }
+ } else if (arg.constructor === Object) {
+ result[i] = '#object';
+ } else if (arg.constructor === Function) {
+ result[i] = '#function';
+ } else if (arg.constructor === String) {
+ result[i] = '"' + arg + '"';
+ } else if (arg.constructor === Number) {
+ result[i] = arg;
+ }
+ }
+ }
+ return result.join(',');
+ },
+
+ sourceCache: {},
+
+ /**
+ * @return the text from a given URL
+ */
+ ajax: function(url) {
+ var req = this.createXMLHTTPObject();
+ if (req) {
+ try {
+ req.open('GET', url, false);
+ req.send(null);
+ return req.responseText;
+ } catch (e) {
+ }
+ }
+ return '';
+ },
+
+ /**
+ * Try XHR methods in order and store XHR factory.
+ *
+ * @return <Function> XHR function or equivalent
+ */
+ createXMLHTTPObject: function() {
+ var xmlhttp, XMLHttpFactories = [
+ function() {
+ return new XMLHttpRequest();
+ }, function() {
+ return new ActiveXObject('Msxml2.XMLHTTP');
+ }, function() {
+ return new ActiveXObject('Msxml3.XMLHTTP');
+ }, function() {
+ return new ActiveXObject('Microsoft.XMLHTTP');
+ }
+ ];
+ for (var i = 0; i < XMLHttpFactories.length; i++) {
+ try {
+ xmlhttp = XMLHttpFactories[i]();
+ // Use memoization to cache the factory
+ this.createXMLHTTPObject = XMLHttpFactories[i];
+ return xmlhttp;
+ } catch (e) {
+ }
+ }
+ },
+
+ /**
+ * Given a URL, check if it is in the same domain (so we can get the source
+ * via Ajax).
+ *
+ * @param url <String> source url
+ * @return False if we need a cross-domain request
+ */
+ isSameDomain: function(url) {
+ return url.indexOf(location.hostname) !== -1;
+ },
+
+ /**
+ * Get source code from given URL if in the same domain.
+ *
+ * @param url <String> JS source URL
+ * @return <Array> Array of source code lines
+ */
+ getSource: function(url) {
+ // TODO reuse source from script tags?
+ if (!(url in this.sourceCache)) {
+ this.sourceCache[url] = this.ajax(url).split('\n');
+ }
+ return this.sourceCache[url];
+ },
+
+ guessAnonymousFunctions: function(stack) {
+ for (var i = 0; i < stack.length; ++i) {
+ var reStack = /\{anonymous\}\(.*\)@(.*)/,
+ reRef = /^(.*?)(?::(\d+))(?::(\d+))?(?: -- .+)?$/,
+ frame = stack[i], ref = reStack.exec(frame);
+
+ if (ref) {
+ var m = reRef.exec(ref[1]), file = m[1],
+ lineno = m[2], charno = m[3] || 0;
+ if (file && this.isSameDomain(file) && lineno) {
+ var functionName = this.guessAnonymousFunction(file, lineno, charno);
+ stack[i] = frame.replace('{anonymous}', functionName);
+ }
+ }
+ }
+ return stack;
+ },
+
+ guessAnonymousFunction: function(url, lineNo, charNo) {
+ var ret;
+ try {
+ ret = this.findFunctionName(this.getSource(url), lineNo);
+ } catch (e) {
+ ret = 'getSource failed with url: ' + url + ', exception: ' + e.toString();
+ }
+ return ret;
+ },
+
+ findFunctionName: function(source, lineNo) {
+ // FIXME findFunctionName fails for compressed source
+ // (more than one function on the same line)
+ // TODO use captured args
+ // function {name}({args}) m[1]=name m[2]=args
+ var reFunctionDeclaration = /function\s+([^(]*?)\s*\(([^)]*)\)/;
+ // {name} = function ({args}) TODO args capture
+ // /['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*function(?:[^(]*)/
+ var reFunctionExpression = /['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*function\b/;
+ // {name} = eval()
+ var reFunctionEvaluation = /['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*(?:eval|new Function)\b/;
+ // Walk backwards in the source lines until we find
+ // the line which matches one of the patterns above
+ var code = "", line, maxLines = Math.min(lineNo, 20), m, commentPos;
+ for (var i = 0; i < maxLines; ++i) {
+ // lineNo is 1-based, source[] is 0-based
+ line = source[lineNo - i - 1];
+ commentPos = line.indexOf('//');
+ if (commentPos >= 0) {
+ line = line.substr(0, commentPos);
+ }
+ // TODO check other types of comments? Commented code may lead to false positive
+ if (line) {
+ code = line + code;
+ m = reFunctionExpression.exec(code);
+ if (m && m[1]) {
+ return m[1];
+ }
+ m = reFunctionDeclaration.exec(code);
+ if (m && m[1]) {
+ //return m[1] + "(" + (m[2] || "") + ")";
+ return m[1];
+ }
+ m = reFunctionEvaluation.exec(code);
+ if (m && m[1]) {
+ return m[1];
+ }
+ }
+ }
+ return '(?)';
+ }
+};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/Doxyfile b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/Doxyfile
new file mode 100644
index 00000000..26ac5a53
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/Doxyfile
@@ -0,0 +1,243 @@
+# Doxyfile 1.5.3
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = strftime
+PROJECT_NUMBER = 1.3
+OUTPUT_DIRECTORY = /home/philip/public_html/hacks/strftime/docs/
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class " \
+ "The $name widget " \
+ "The $name file " \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH = /home/philip/public_html/hacks/strftime/
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+QT_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 8
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+BUILTIN_STL_SUPPORT = NO
+CPP_CLI_SUPPORT = NO
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+EXTRACT_ANON_NSPACES = NO
+HIDE_UNDOC_MEMBERS = YES
+HIDE_UNDOC_CLASSES = YES
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = NO
+SHOW_DIRECTORIES = NO
+FILE_VERSION_FILTER =
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT = "$file:$line: $text "
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = /home/philip/public_html/hacks/strftime
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS = *.js
+RECURSIVE = NO
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH = .
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = YES
+INLINE_SOURCES = YES
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+REFERENCES_LINK_SOURCE = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX = Date \
+ Date.ext \
+ Date.prototype
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+HTML_DYNAMIC_SECTIONS = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = YES
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = YES
+USE_PDFLATEX = YES
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = NO
+MSCGEN_PATH =
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = YES
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = YES
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 1000
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = YES
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime-min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime-min.js
new file mode 100644
index 00000000..8207714e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime-min.js
@@ -0,0 +1 @@
+Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(x,pad,r){if(typeof (r)=="undefined"){r=10}for(;parseInt(x,10)<r&&r>1;r/=10){x=pad.toString()+x}return x.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};Date.ext.locales["en-US"]=Date.ext.locales.en;Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(d){return Date.ext.locales[d.locale].a[d.getDay()]},A:function(d){return Date.ext.locales[d.locale].A[d.getDay()]},b:function(d){return Date.ext.locales[d.locale].b[d.getMonth()]},B:function(d){return Date.ext.locales[d.locale].B[d.getMonth()]},c:"toLocaleString",C:function(d){return Date.ext.util.xPad(parseInt(d.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(d){return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100,10),0)},G:function(d){var y=d.getFullYear();var V=parseInt(Date.ext.formats.V(d),10);var W=parseInt(Date.ext.formats.W(d),10);if(W>V){y++}else{if(W===0&&V>=52){y--}}return y},H:["getHours","0"],I:function(d){var I=d.getHours()%12;return Date.ext.util.xPad(I===0?12:I,0)},j:function(d){var ms=d-new Date(""+d.getFullYear()+"/1/1 GMT");ms+=d.getTimezoneOffset()*60000;var doy=parseInt(ms/60000/60/24,10)+1;return Date.ext.util.xPad(doy,0,100)},m:function(d){return Date.ext.util.xPad(d.getMonth()+1,0)},M:["getMinutes","0"],p:function(d){return Date.ext.locales[d.locale].p[d.getHours()>=12?1:0]},P:function(d){return Date.ext.locales[d.locale].P[d.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(d){var dow=d.getDay();return dow===0?7:dow},U:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=6-d.getDay();var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0)},V:function(d){var woy=parseInt(Date.ext.formats.W(d),10);var dow1_1=(new Date(""+d.getFullYear()+"/1/1")).getDay();var idow=woy+(dow1_1>4||dow1_1<=1?0:1);if(idow==53&&(new Date(""+d.getFullYear()+"/12/31")).getDay()<4){idow=1}else{if(idow===0){idow=Date.ext.formats.V(new Date(""+(d.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(idow,0)},w:"getDay",W:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=7-Date.ext.formats.u(d);var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0,10)},y:function(d){return Date.ext.util.xPad(d.getFullYear()%100,0)},Y:"getFullYear",z:function(d){var o=d.getTimezoneOffset();var H=Date.ext.util.xPad(parseInt(Math.abs(o/60),10),0);var M=Date.ext.util.xPad(o%60,0);return(o>0?"-":"+")+H+M},Z:function(d){return d.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(d){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(fmt){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var d=this;while(fmt.match(/%[cDhnrRtTxXzZ]/)){fmt=fmt.replace(/%([cDhnrRtTxXzZ])/g,function(m0,m1){var f=Date.ext.aggregates[m1];return(f=="locale"?Date.ext.locales[d.locale][m1]:f)})}var str=fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(m0,m1){var f=Date.ext.formats[m1];if(typeof (f)=="string"){return d[f]()}else{if(typeof (f)=="function"){return f.call(d,d)}else{if(typeof (f)=="object"&&typeof (f[0])=="string"){return Date.ext.util.xPad(d[f[0]](),f[1])}else{return m1}}}});d=null;return str};
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime.js
new file mode 100644
index 00000000..d622df9e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime.js
@@ -0,0 +1,731 @@
+/*
+ strftime for Javascript
+ Copyright (c) 2008, Philip S Tellis <philip@bluesmoon.info>
+ All rights reserved.
+
+ This code is distributed under the terms of the BSD licence
+
+ Redistribution and use of this software in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of
+ conditions and the following disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * The names of the contributors to this file may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file strftime.js
+ * \author Philip S Tellis \<philip@bluesmoon.info\>
+ * \version 1.3
+ * \date 2008/06
+ * \brief Javascript implementation of strftime
+ *
+ * Implements strftime for the Date object in javascript based on the PHP implementation described at
+ * http://www.php.net/strftime This is in turn based on the Open Group specification defined
+ * at http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html This implementation does not
+ * include modified conversion specifiers (i.e., Ex and Ox)
+ *
+ * The following format specifiers are supported:
+ *
+ * \copydoc formats
+ *
+ * \%a, \%A, \%b and \%B should be localised for non-English locales.
+ *
+ * \par Usage:
+ * This library may be used as follows:
+ * \code
+ * var d = new Date();
+ *
+ * var ymd = d.strftime('%Y/%m/%d');
+ * var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
+ *
+ * \endcode
+ *
+ * \sa \link Date.prototype.strftime Date.strftime \endlink for a description of each of the supported format specifiers
+ * \sa Date.ext.locales for localisation information
+ * \sa http://www.php.net/strftime for the PHP implementation which is the basis for this
+ * \sa http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html for feedback
+ */
+
+//! Date extension object - all supporting objects go in here.
+Date.ext = {};
+
+//! Utility methods
+Date.ext.util = {};
+
+/**
+\brief Left pad a number with something
+\details Takes a number and pads it to the left with the passed in pad character
+\param x The number to pad
+\param pad The string to pad with
+\param r [optional] Upper limit for pad. A value of 10 pads to 2 digits, a value of 100 pads to 3 digits.
+ Default is 10.
+
+\return The number left padded with the pad character. This function returns a string and not a number.
+*/
+Date.ext.util.xPad=function(x, pad, r)
+{
+ if(typeof(r) == 'undefined')
+ {
+ r=10;
+ }
+ for( ; parseInt(x, 10)<r && r>1; r/=10)
+ x = pad.toString() + x;
+ return x.toString();
+};
+
+/**
+\brief Currently selected locale.
+\details
+The locale for a specific date object may be changed using \code Date.locale = "new-locale"; \endcode
+The default will be based on the lang attribute of the HTML tag of your document
+*/
+Date.prototype.locale = 'en-GB';
+//! \cond FALSE
+if(document.getElementsByTagName('html') && document.getElementsByTagName('html')[0].lang)
+{
+ Date.prototype.locale = document.getElementsByTagName('html')[0].lang;
+}
+//! \endcond
+
+/**
+\brief Localised strings for days of the week and months of the year.
+\details
+To create your own local strings, add a locale object to the locales object.
+The key of your object should be the same as your locale name. For example:
+ en-US,
+ fr,
+ fr-CH,
+ de-DE
+Names are case sensitive and are described at http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
+Your locale object must contain the following keys:
+\param a Short names of days of week starting with Sunday
+\param A Long names days of week starting with Sunday
+\param b Short names of months of the year starting with January
+\param B Long names of months of the year starting with February
+\param c The preferred date and time representation in your locale
+\param p AM or PM in your locale
+\param P am or pm in your locale
+\param x The preferred date representation for the current locale without the time.
+\param X The preferred time representation for the current locale without the date.
+
+\sa Date.ext.locales.en for a sample implementation
+\sa \ref localisation for detailed documentation on localising strftime for your own locale
+*/
+Date.ext.locales = { };
+
+/**
+ * \brief Localised strings for English (British).
+ * \details
+ * This will be used for any of the English dialects unless overridden by a country specific one.
+ * This is the default locale if none specified
+ */
+Date.ext.locales.en = {
+ a: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+ A: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
+ b: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+ B: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ c: '%a %d %b %Y %T %Z',
+ p: ['AM', 'PM'],
+ P: ['am', 'pm'],
+ x: '%d/%m/%y',
+ X: '%T'
+};
+
+//! \cond FALSE
+// Localised strings for US English
+Date.ext.locales['en-US'] = Date.ext.locales.en;
+Date.ext.locales['en-US'].c = '%a %d %b %Y %r %Z';
+Date.ext.locales['en-US'].x = '%D';
+Date.ext.locales['en-US'].X = '%r';
+
+// Localised strings for British English
+Date.ext.locales['en-GB'] = Date.ext.locales.en;
+
+// Localised strings for Australian English
+Date.ext.locales['en-AU'] = Date.ext.locales['en-GB'];
+//! \endcond
+
+//! \brief List of supported format specifiers.
+/**
+ * \details
+ * \arg \%a - abbreviated weekday name according to the current locale
+ * \arg \%A - full weekday name according to the current locale
+ * \arg \%b - abbreviated month name according to the current locale
+ * \arg \%B - full month name according to the current locale
+ * \arg \%c - preferred date and time representation for the current locale
+ * \arg \%C - century number (the year divided by 100 and truncated to an integer, range 00 to 99)
+ * \arg \%d - day of the month as a decimal number (range 01 to 31)
+ * \arg \%D - same as %m/%d/%y
+ * \arg \%e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31')
+ * \arg \%g - like %G, but without the century
+ * \arg \%G - The 4-digit year corresponding to the ISO week number
+ * \arg \%h - same as %b
+ * \arg \%H - hour as a decimal number using a 24-hour clock (range 00 to 23)
+ * \arg \%I - hour as a decimal number using a 12-hour clock (range 01 to 12)
+ * \arg \%j - day of the year as a decimal number (range 001 to 366)
+ * \arg \%m - month as a decimal number (range 01 to 12)
+ * \arg \%M - minute as a decimal number
+ * \arg \%n - newline character
+ * \arg \%p - either `AM' or `PM' according to the given time value, or the corresponding strings for the current locale
+ * \arg \%P - like %p, but lower case
+ * \arg \%r - time in a.m. and p.m. notation equal to %I:%M:%S %p
+ * \arg \%R - time in 24 hour notation equal to %H:%M
+ * \arg \%S - second as a decimal number
+ * \arg \%t - tab character
+ * \arg \%T - current time, equal to %H:%M:%S
+ * \arg \%u - weekday as a decimal number [1,7], with 1 representing Monday
+ * \arg \%U - week number of the current year as a decimal number, starting with
+ * the first Sunday as the first day of the first week
+ * \arg \%V - The ISO 8601:1988 week number of the current year as a decimal number,
+ * range 01 to 53, where week 1 is the first week that has at least 4 days
+ * in the current year, and with Monday as the first day of the week.
+ * \arg \%w - day of the week as a decimal, Sunday being 0
+ * \arg \%W - week number of the current year as a decimal number, starting with the
+ * first Monday as the first day of the first week
+ * \arg \%x - preferred date representation for the current locale without the time
+ * \arg \%X - preferred time representation for the current locale without the date
+ * \arg \%y - year as a decimal number without a century (range 00 to 99)
+ * \arg \%Y - year as a decimal number including the century
+ * \arg \%z - numerical time zone representation
+ * \arg \%Z - time zone name or abbreviation
+ * \arg \%% - a literal `\%' character
+ */
+Date.ext.formats = {
+ a: function(d) { return Date.ext.locales[d.locale].a[d.getDay()]; },
+ A: function(d) { return Date.ext.locales[d.locale].A[d.getDay()]; },
+ b: function(d) { return Date.ext.locales[d.locale].b[d.getMonth()]; },
+ B: function(d) { return Date.ext.locales[d.locale].B[d.getMonth()]; },
+ c: 'toLocaleString',
+ C: function(d) { return Date.ext.util.xPad(parseInt(d.getFullYear()/100, 10), 0); },
+ d: ['getDate', '0'],
+ e: ['getDate', ' '],
+ g: function(d) { return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100, 10), 0); },
+ G: function(d) {
+ var y = d.getFullYear();
+ var V = parseInt(Date.ext.formats.V(d), 10);
+ var W = parseInt(Date.ext.formats.W(d), 10);
+
+ if(W > V) {
+ y++;
+ } else if(W===0 && V>=52) {
+ y--;
+ }
+
+ return y;
+ },
+ H: ['getHours', '0'],
+ I: function(d) { var I=d.getHours()%12; return Date.ext.util.xPad(I===0?12:I, 0); },
+ j: function(d) {
+ var ms = d - new Date('' + d.getFullYear() + '/1/1 GMT');
+ ms += d.getTimezoneOffset()*60000;
+ var doy = parseInt(ms/60000/60/24, 10)+1;
+ return Date.ext.util.xPad(doy, 0, 100);
+ },
+ m: function(d) { return Date.ext.util.xPad(d.getMonth()+1, 0); },
+ M: ['getMinutes', '0'],
+ p: function(d) { return Date.ext.locales[d.locale].p[d.getHours() >= 12 ? 1 : 0 ]; },
+ P: function(d) { return Date.ext.locales[d.locale].P[d.getHours() >= 12 ? 1 : 0 ]; },
+ S: ['getSeconds', '0'],
+ u: function(d) { var dow = d.getDay(); return dow===0?7:dow; },
+ U: function(d) {
+ var doy = parseInt(Date.ext.formats.j(d), 10);
+ var rdow = 6-d.getDay();
+ var woy = parseInt((doy+rdow)/7, 10);
+ return Date.ext.util.xPad(woy, 0);
+ },
+ V: function(d) {
+ var woy = parseInt(Date.ext.formats.W(d), 10);
+ var dow1_1 = (new Date('' + d.getFullYear() + '/1/1')).getDay();
+ // First week is 01 and not 00 as in the case of %U and %W,
+ // so we add 1 to the final result except if day 1 of the year
+ // is a Monday (then %W returns 01).
+ // We also need to subtract 1 if the day 1 of the year is
+ // Friday-Sunday, so the resulting equation becomes:
+ var idow = woy + (dow1_1 > 4 || dow1_1 <= 1 ? 0 : 1);
+ if(idow == 53 && (new Date('' + d.getFullYear() + '/12/31')).getDay() < 4)
+ {
+ idow = 1;
+ }
+ else if(idow === 0)
+ {
+ idow = Date.ext.formats.V(new Date('' + (d.getFullYear()-1) + '/12/31'));
+ }
+
+ return Date.ext.util.xPad(idow, 0);
+ },
+ w: 'getDay',
+ W: function(d) {
+ var doy = parseInt(Date.ext.formats.j(d), 10);
+ var rdow = 7-Date.ext.formats.u(d);
+ var woy = parseInt((doy+rdow)/7, 10);
+ return Date.ext.util.xPad(woy, 0, 10);
+ },
+ y: function(d) { return Date.ext.util.xPad(d.getFullYear()%100, 0); },
+ Y: 'getFullYear',
+ z: function(d) {
+ var o = d.getTimezoneOffset();
+ var H = Date.ext.util.xPad(parseInt(Math.abs(o/60), 10), 0);
+ var M = Date.ext.util.xPad(o%60, 0);
+ return (o>0?'-':'+') + H + M;
+ },
+ Z: function(d) { return d.toString().replace(/^.*\(([^)]+)\)$/, '$1'); },
+ '%': function(d) { return '%'; }
+};
+
+/**
+\brief List of aggregate format specifiers.
+\details
+Aggregate format specifiers map to a combination of basic format specifiers.
+These are implemented in terms of Date.ext.formats.
+
+A format specifier that maps to 'locale' is read from Date.ext.locales[current-locale].
+
+\sa Date.ext.formats
+*/
+Date.ext.aggregates = {
+ c: 'locale',
+ D: '%m/%d/%y',
+ h: '%b',
+ n: '\n',
+ r: '%I:%M:%S %p',
+ R: '%H:%M',
+ t: '\t',
+ T: '%H:%M:%S',
+ x: 'locale',
+ X: 'locale'
+};
+
+//! \cond FALSE
+// Cache timezone values because they will never change for a given JS instance
+Date.ext.aggregates.z = Date.ext.formats.z(new Date());
+Date.ext.aggregates.Z = Date.ext.formats.Z(new Date());
+//! \endcond
+
+//! List of unsupported format specifiers.
+/**
+ * \details
+ * All format specifiers supported by the PHP implementation are supported by
+ * this javascript implementation.
+ */
+Date.ext.unsupported = { };
+
+
+/**
+ * \brief Formats the date according to the specified format.
+ * \param fmt The format to format the date in. This may be a combination of the following:
+ * \copydoc formats
+ *
+ * \return A string representation of the date formatted based on the passed in parameter
+ * \sa http://www.php.net/strftime for documentation on format specifiers
+*/
+Date.prototype.strftime=function(fmt)
+{
+ // Fix locale if declared locale hasn't been defined
+ // After the first call this condition should never be entered unless someone changes the locale
+ if(!(this.locale in Date.ext.locales))
+ {
+ if(this.locale.replace(/-[a-zA-Z]+$/, '') in Date.ext.locales)
+ {
+ this.locale = this.locale.replace(/-[a-zA-Z]+$/, '');
+ }
+ else
+ {
+ this.locale = 'en-GB';
+ }
+ }
+
+ var d = this;
+ // First replace aggregates
+ while(fmt.match(/%[cDhnrRtTxXzZ]/))
+ {
+ fmt = fmt.replace(/%([cDhnrRtTxXzZ])/g, function(m0, m1)
+ {
+ var f = Date.ext.aggregates[m1];
+ return (f == 'locale' ? Date.ext.locales[d.locale][m1] : f);
+ });
+ }
+
+
+ // Now replace formats - we need a closure so that the date object gets passed through
+ var str = fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g, function(m0, m1)
+ {
+ var f = Date.ext.formats[m1];
+ if(typeof(f) == 'string') {
+ return d[f]();
+ } else if(typeof(f) == 'function') {
+ return f.call(d, d);
+ } else if(typeof(f) == 'object' && typeof(f[0]) == 'string') {
+ return Date.ext.util.xPad(d[f[0]](), f[1]);
+ } else {
+ return m1;
+ }
+ });
+ d=null;
+ return str;
+};
+
+/**
+ * \mainpage strftime for Javascript
+ *
+ * \section toc Table of Contents
+ * - \ref intro_sec
+ * - <a class="el" href="strftime.js">Download full source</a> / <a class="el" href="strftime-min.js">minified</a>
+ * - \subpage usage
+ * - \subpage format_specifiers
+ * - \subpage localisation
+ * - \link strftime.js API Documentation \endlink
+ * - \subpage demo
+ * - \subpage changelog
+ * - \subpage faq
+ * - <a class="el" href="http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html">Feedback</a>
+ * - \subpage copyright_licence
+ *
+ * \section intro_sec Introduction
+ *
+ * C and PHP developers have had access to a built in strftime function for a long time.
+ * This function is an easy way to format dates and times for various display needs.
+ *
+ * This library brings the flexibility of strftime to the javascript Date object
+ *
+ * Use this library if you frequently need to format dates in javascript in a variety of ways. For example,
+ * if you have PHP code that writes out formatted dates, and want to mimic the functionality using
+ * progressively enhanced javascript, then this library can do exactly what you want.
+ *
+ *
+ *
+ *
+ * \page usage Example usage
+ *
+ * \section usage_sec Usage
+ * This library may be used as follows:
+ * \code
+ * var d = new Date();
+ *
+ * var ymd = d.strftime('%Y/%m/%d');
+ * var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
+ *
+ * \endcode
+ *
+ * \subsection examples Examples
+ *
+ * To get the current time in hours and minutes:
+ * \code
+ * var d = new Date();
+ * d.strftime("%H:%M");
+ * \endcode
+ *
+ * To get the current time with seconds in AM/PM notation:
+ * \code
+ * var d = new Date();
+ * d.strftime("%r");
+ * \endcode
+ *
+ * To get the year and day of the year for August 23, 2009:
+ * \code
+ * var d = new Date('2009/8/23');
+ * d.strftime("%Y-%j");
+ * \endcode
+ *
+ * \section demo_sec Demo
+ *
+ * Try your own examples on the \subpage demo page. You can use any of the supported
+ * \subpage format_specifiers.
+ *
+ *
+ *
+ *
+ * \page localisation Localisation
+ * You can localise strftime by implementing the short and long forms for days of the
+ * week and months of the year, and the localised aggregates for the preferred date
+ * and time representation for your locale. You need to add your locale to the
+ * Date.ext.locales object.
+ *
+ * \section localising_fr Localising for french
+ *
+ * For example, this is how we'd add French language strings to the locales object:
+ * \dontinclude index.html
+ * \skip Generic french
+ * \until };
+ * The % format specifiers are all defined in \ref formats. You can use any of those.
+ *
+ * This locale definition may be included in your own source file, or in the HTML file
+ * including \c strftime.js, however it must be defined \em after including \c strftime.js
+ *
+ * The above definition includes generic french strings and formats that are used in France.
+ * Other french speaking countries may have other representations for dates and times, so we
+ * need to override this for them. For example, Canadian french uses a Y-m-d date format,
+ * while French french uses d.m.Y. We fix this by defining Canadian french to be the same
+ * as generic french, and then override the format specifiers for \c x for the \c fr-CA locale:
+ * \until End french
+ *
+ * You can now use any of the French locales at any time by setting \link Date.prototype.locale Date.locale \endlink
+ * to \c "fr", \c "fr-FR", \c "fr-CA", or any other french dialect:
+ * \code
+ * var d = new Date("2008/04/22");
+ * d.locale = "fr";
+ *
+ * d.strftime("%A, %d %B == %x");
+ * \endcode
+ * will return:
+ * \code
+ * mardi, 22 avril == 22.04.2008
+ * \endcode
+ * While changing the locale to "fr-CA":
+ * \code
+ * d.locale = "fr-CA";
+ *
+ * d.strftime("%A, %d %B == %x");
+ * \endcode
+ * will return:
+ * \code
+ * mardi, 22 avril == 2008-04-22
+ * \endcode
+ *
+ * You can use any of the format specifiers defined at \ref formats
+ *
+ * The locale for all dates defaults to the value of the \c lang attribute of your HTML document if
+ * it is set, or to \c "en" otherwise.
+ * \note
+ * Your locale definitions \b MUST be added to the locale object before calling
+ * \link Date.prototype.strftime Date.strftime \endlink.
+ *
+ * \sa \ref formats for a list of format specifiers that can be used in your definitions
+ * for c, x and X.
+ *
+ * \section locale_names Locale names
+ *
+ * Locale names are defined in RFC 1766. Typically, a locale would be a two letter ISO639
+ * defined language code and an optional ISO3166 defined country code separated by a -
+ *
+ * eg: fr-FR, de-DE, hi-IN
+ *
+ * \sa http://www.ietf.org/rfc/rfc1766.txt
+ * \sa http://www.loc.gov/standards/iso639-2/php/code_list.php
+ * \sa http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
+ *
+ * \section locale_fallback Locale fallbacks
+ *
+ * If a locale object corresponding to the fully specified locale isn't found, an attempt will be made
+ * to fall back to the two letter language code. If a locale object corresponding to that isn't found
+ * either, then the locale will fall back to \c "en". No warning will be issued.
+ *
+ * For example, if we define a locale for de:
+ * \until };
+ * Then set the locale to \c "de-DE":
+ * \code
+ * d.locale = "de-DE";
+ *
+ * d.strftime("%a, %d %b");
+ * \endcode
+ * In this case, the \c "de" locale will be used since \c "de-DE" has not been defined:
+ * \code
+ * Di, 22 Apr
+ * \endcode
+ *
+ * Swiss german will return the same since it will also fall back to \c "de":
+ * \code
+ * d.locale = "de-CH";
+ *
+ * d.strftime("%a, %d %b");
+ * \endcode
+ * \code
+ * Di, 22 Apr
+ * \endcode
+ *
+ * We need to override the \c a specifier for Swiss german, since it's different from German german:
+ * \until End german
+ * We now get the correct results:
+ * \code
+ * d.locale = "de-CH";
+ *
+ * d.strftime("%a, %d %b");
+ * \endcode
+ * \code
+ * Die, 22 Apr
+ * \endcode
+ *
+ * \section builtin_locales Built in locales
+ *
+ * This library comes with pre-defined locales for en, en-GB, en-US and en-AU.
+ *
+ *
+ *
+ *
+ * \page format_specifiers Format specifiers
+ *
+ * \section specifiers Format specifiers
+ * strftime has several format specifiers defined by the Open group at
+ * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
+ *
+ * PHP added a few of its own, defined at http://www.php.net/strftime
+ *
+ * This javascript implementation supports all the PHP specifiers
+ *
+ * \subsection supp Supported format specifiers:
+ * \copydoc formats
+ *
+ * \subsection unsupportedformats Unsupported format specifiers:
+ * \copydoc unsupported
+ *
+ *
+ *
+ *
+ * \page demo strftime demo
+ * <div style="float:right;width:45%;">
+ * \copydoc formats
+ * </div>
+ * \htmlinclude index.html
+ *
+ *
+ *
+ *
+ * \page faq FAQ
+ *
+ * \section how_tos Usage
+ *
+ * \subsection howtouse Is there a manual on how to use this library?
+ *
+ * Yes, see \ref usage
+ *
+ * \subsection wheretoget Where can I get a minified version of this library?
+ *
+ * The minified version is available <a href="strftime-min.js" title="Minified strftime.js">here</a>.
+ *
+ * \subsection which_specifiers Which format specifiers are supported?
+ *
+ * See \ref format_specifiers
+ *
+ * \section whys Why?
+ *
+ * \subsection why_lib Why this library?
+ *
+ * I've used the strftime function in C, PHP and the Unix shell, and found it very useful
+ * to do date formatting. When I needed to do date formatting in javascript, I decided
+ * that it made the most sense to just reuse what I'm already familiar with.
+ *
+ * \subsection why_another Why another strftime implementation for Javascript?
+ *
+ * Yes, there are other strftime implementations for Javascript, but I saw problems with
+ * all of them that meant I couldn't use them directly. Some implementations had bad
+ * designs. For example, iterating through all possible specifiers and scanning the string
+ * for them. Others were tied to specific libraries like prototype.
+ *
+ * Trying to extend any of the existing implementations would have required only slightly
+ * less effort than writing this from scratch. In the end it took me just about 3 hours
+ * to write the code and about 6 hours battling with doxygen to write these docs.
+ *
+ * I also had an idea of how I wanted to implement this, so decided to try it.
+ *
+ * \subsection why_extend_date Why extend the Date class rather than subclass it?
+ *
+ * I tried subclassing Date and failed. I didn't want to waste time on figuring
+ * out if there was a problem in my code or if it just wasn't possible. Adding to the
+ * Date.prototype worked well, so I stuck with it.
+ *
+ * I did have some worries because of the way for..in loops got messed up after json.js added
+ * to the Object.prototype, but that isn't an issue here since {} is not a subclass of Date.
+ *
+ * My last doubt was about the Date.ext namespace that I created. I still don't like this,
+ * but I felt that \c ext at least makes clear that this is external or an extension.
+ *
+ * It's quite possible that some future version of javascript will add an \c ext or a \c locale
+ * or a \c strftime property/method to the Date class, but this library should probably
+ * check for capabilities before doing what it does.
+ *
+ * \section curiosity Curiosity
+ *
+ * \subsection how_big How big is the code?
+ *
+ * \arg 26K bytes with documentation
+ * \arg 4242 bytes minified using <a href="http://developer.yahoo.com/yui/compressor/">YUI Compressor</a>
+ * \arg 1477 bytes minified and gzipped
+ *
+ * \subsection how_long How long did it take to write this?
+ *
+ * 15 minutes for the idea while I was composing this blog post:
+ * http://tech.bluesmoon.info/2008/04/javascript-date-functions.html
+ *
+ * 3 hours in one evening to write v1.0 of the code and 6 hours the same
+ * night to write the docs and this manual. As you can tell, I'm fairly
+ * sleepy.
+ *
+ * Versions 1.1 and 1.2 were done in a couple of hours each, and version 1.3
+ * in under one hour.
+ *
+ * \section contributing Contributing
+ *
+ * \subsection how_to_rfe How can I request features or make suggestions?
+ *
+ * You can leave a comment on my blog post about this library here:
+ * http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html
+ *
+ * \subsection how_to_contribute Can I/How can I contribute code to this library?
+ *
+ * Yes, that would be very nice, thank you. You can do various things. You can make changes
+ * to the library, and make a diff against the current file and mail me that diff at
+ * philip@bluesmoon.info, or you could just host the new file on your own servers and add
+ * your name to the copyright list at the top stating which parts you've added.
+ *
+ * If you do mail me a diff, let me know how you'd like to be listed in the copyright section.
+ *
+ * \subsection copyright_signover Who owns the copyright on contributed code?
+ *
+ * The contributor retains copyright on contributed code.
+ *
+ * In some cases I may use contributed code as a template and write the code myself. In this
+ * case I'll give the contributor credit for the idea, but will not add their name to the
+ * copyright holders list.
+ *
+ *
+ *
+ *
+ * \page copyright_licence Copyright & Licence
+ *
+ * \section copyright Copyright
+ * \dontinclude strftime.js
+ * \skip Copyright
+ * \until rights
+ *
+ * \section licence Licence
+ * \skip This code
+ * \until SUCH DAMAGE.
+ *
+ *
+ *
+ * \page changelog ChangeLog
+ *
+ * \par 1.3 - 2008/06/17:
+ * - Fixed padding issue with negative timezone offsets in %r
+ * reported and fixed by Mikko <mikko.heimola@iki.fi>
+ * - Added support for %P
+ * - Internationalised %r, %p and %P
+ *
+ * \par 1.2 - 2008/04/27:
+ * - Fixed support for c (previously it just returned toLocaleString())
+ * - Add support for c, x and X
+ * - Add locales for en-GB, en-US and en-AU
+ * - Make en-GB the default locale (previous was en)
+ * - Added more localisation docs
+ *
+ * \par 1.1 - 2008/04/27:
+ * - Fix bug in xPad which wasn't padding more than a single digit
+ * - Fix bug in j which had an off by one error for days after March 10th because of daylight savings
+ * - Add support for g, G, U, V and W
+ *
+ * \par 1.0 - 2008/04/22:
+ * - Initial release with support for a, A, b, B, c, C, d, D, e, H, I, j, m, M, p, r, R, S, t, T, u, w, y, Y, z, Z, and %
+ */
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.css
new file mode 100644
index 00000000..a44c3560
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.css
@@ -0,0 +1,557 @@
+/**
+ * @license angular-circular-timepicker version: 0.1.0
+ * Copyright 2016 sidaudhi.com, Inc. http://www.sidaudhi.com
+ * License: MIT
+ *
+ * @author Siddharth Audhinarayanan
+ * @since 2016-Jan-31
+ */
+
+.datetimepicker {
+ font-family: Arial;
+}
+
+.datetimepicker div,
+.datetimepicker span,
+.datetimepicker object,
+.datetimepicker iframe,
+.datetimepicker h1,
+.datetimepicker h2,
+.datetimepicker h3,
+.datetimepicker h4,
+.datetimepicker h5,
+.datetimepicker h6,
+.datetimepicker p,
+.datetimepicker pre,
+.datetimepicker a,
+.datetimepicker abbr,
+.datetimepicker acronym,
+.datetimepicker address,
+.datetimepicker code,
+.datetimepicker del,
+.datetimepicker dfn,
+.datetimepicker em,
+.datetimepicker img,
+.datetimepicker dl,
+.datetimepicker dt,
+.datetimepicker dd,
+.datetimepicker ol,
+.datetimepicker ul,
+.datetimepicker li,
+.datetimepicker fieldset,
+.datetimepicker form,
+.datetimepicker label,
+.datetimepicker legend,
+.datetimepicker caption,
+.datetimepicker tbody,
+.datetimepicker tfoot,
+.datetimepicker thead,
+.datetimepicker tr {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ outline: 0;
+ font-weight: inherit;
+ font-style: inherit;
+ font-family: inherit;
+ font-size: 100%;
+ vertical-align: baseline;
+}
+
+.datetimepicker table {
+ border-collapse: separate;
+ border-spacing: 0;
+ vertical-align: middle;
+}
+
+.datetimepicker caption,
+.datetimepicker th,
+.datetimepicker td {
+ text-align: left;
+ font-weight: normal;
+ vertical-align: middle;
+}
+
+.datetimepicker a img {
+ border: none;
+}
+
+.datetimepicker .left {
+ float: left;
+}
+
+.datetimepicker .right {
+ float: right;
+}
+
+.datetimepicker .datetimepicker-display {
+ padding: 6px 12px;
+ border: 1px solid rgba(0,0,0,0.15);
+ font-size: 15px;
+ min-height: 34px;
+}
+
+.datetimepicker .datetimepicker-toggle {
+ float: right;
+ padding: 7px;
+ border: 0px;
+ cursor: pointer;
+}
+
+.datetimepicker .datetimepicker-modal {
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ background-color: rgba(0,0,0,0.5);
+ position: fixed;
+ z-index: 990;
+}
+
+.datetimepicker .datetimepicker-close {
+ position: fixed;
+ right: 10px;
+ top: 5px;
+ color: #fff;
+ font-size: 24px;
+ cursor: pointer;
+ z-index: 999;
+}
+
+.datetimepicker .datetimepicker-preview {
+ padding: 5px;
+ text-align: center;
+ cursor: pointer;
+ font-size: 18px;
+ background-color: #0574AC;
+ color: #fff;
+}
+
+.datetimepicker .datetimepicker-content {
+ min-height: 300px;
+ background-color: #fff;
+ border: 1px solid rgba(0,0,0,0.15);
+ border-top: 0px;
+ position: relative;
+ width: 290px;
+ z-index: 998;
+}
+
+.datetimepicker .datetimepicker-content.datetimepicker-absolute {
+ position: fixed;
+ top: calc(30% - 100px);
+ left: calc(50% - 145px);
+ border: 0px;
+ -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);
+ box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);
+}
+
+.datetimepicker .datetimepicker-content .datetimepicker-tabs {
+ background-color: #0574AC;
+}
+
+.datetimepicker .datetimepicker-content .datetimepicker-tabs .datetimepicker-tab {
+ width: 50%;
+ display: inline-block;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ padding: 5px;
+ text-align: center;
+ font-size: 13px;
+ text-transform: uppercase;
+ color: #fff;
+ cursor: pointer;
+ background-color: #f3f3f4;
+ color: #0574AC;
+}
+
+.datetimepicker .datetimepicker-content .datetimepicker-tabs .datetimepicker-tab.active {
+ background-color: #0574AC;
+ color: #f3f3f4;
+ font-weight: bold;
+}
+
+.datetimepicker .datetimepicker-content .datetimepicker-month {
+ border-bottom: 1px solid rgba(0,0,0,0.2);
+ background-color: #fff;
+}
+
+.datetimepicker .datetimepicker-content .datetimepicker-month .datetimepicker-current-month {
+ text-align: center;
+ padding: 10px 10px;
+}
+
+.datetimepicker .datetimepicker-calendar {
+ text-align: center;
+ padding: 10px 0px;
+}
+
+.datetimepicker .datetimepicker-calendar .datetimepicker-day {
+ width: 38px;
+ display: inline-block;
+ text-align: center;
+ padding: 10px;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ font-weight: bold;
+ color: #0574AC;
+ font-size: 15px;
+}
+
+.datetimepicker .datetimepicker-calendar .datetimepicker-day.datetimepicker-leading-day,
+.datetimepicker .datetimepicker-calendar .datetimepicker-day.datetimepicker-trailing-day {
+ font-weight: normal;
+ color: rgba(0,0,0,0.25);
+}
+
+.datetimepicker .datetimepicker-calendar .datetimepicker-day.datetimepicker-active-day {
+ font-weight: normal;
+ color: rgba(0,0,0,0.75);
+ font-size: 14px;
+}
+
+.datetimepicker .datetimepicker-calendar .datetimepicker-day.datetimepicker-active-day.selected,
+.datetimepicker .datetimepicker-calendar .datetimepicker-day.datetimepicker-active-day:hover {
+ color: #fff;
+ background-color: #0574AC;
+ cursor: pointer;
+}
+
+.datetimepicker .time-circle-outer {
+ width: 240px;
+ height: 240px;
+ border: 3px dashed rgba(0,0,0,0.1);
+ -webkit-border-radius: 50%;
+ border-radius: 50%;
+ margin: 30px auto;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ position: relative;
+}
+
+.datetimepicker .time-circle-outer .time-circle-center {
+ position: absolute;
+ top: calc(50% - 10px);
+ left: calc(50% - 10px);
+ width: 20px;
+ height: 20px;
+ background-color: #0574AC;
+ -webkit-border-radius: 50%;
+ border-radius: 50%;
+}
+
+.datetimepicker .time-circle-outer .time-meridian {
+ position: absolute;
+ top: -70px;
+ width: 30px;
+ height: 30px;
+ padding: 7px 5px;
+ -webkit-border-radius: 50%;
+ border-radius: 50%;
+ font-size: 13px;
+ font-weight: bold;
+ cursor: pointer;
+ color: #0574AC;
+ text-align: center;
+}
+
+.datetimepicker .time-circle-outer .time-meridian.time-left {
+ left: -15px;
+}
+
+.datetimepicker .time-circle-outer .time-meridian.time-right {
+ right: -15px;
+}
+
+.datetimepicker .time-circle-outer .time-meridian.selected {
+ background-color: #0574AC;
+ color: #fff;
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand {
+ width: 6px;
+ height: 82px;
+ position: absolute;
+ left: calc(50% - 3px);
+ top: calc(50% - 82px);
+ -webkit-transform-origin: 50% 100%;
+ -moz-transform-origin: 50% 100%;
+ -o-transform-origin: 50% 100%;
+ -ms-transform-origin: 50% 100%;
+ transform-origin: 50% 100%;
+ background-color: #0574AC;
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand.deg-1 {
+ -webkit-transform: rotate(30deg);
+ -moz-transform: rotate(30deg);
+ -o-transform: rotate(30deg);
+ -ms-transform: rotate(30deg);
+ transform: rotate(30deg);
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand.deg-2 {
+ -webkit-transform: rotate(60deg);
+ -moz-transform: rotate(60deg);
+ -o-transform: rotate(60deg);
+ -ms-transform: rotate(60deg);
+ transform: rotate(60deg);
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand.deg-3 {
+ -webkit-transform: rotate(90deg);
+ -moz-transform: rotate(90deg);
+ -o-transform: rotate(90deg);
+ -ms-transform: rotate(90deg);
+ transform: rotate(90deg);
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand.deg-4 {
+ -webkit-transform: rotate(120deg);
+ -moz-transform: rotate(120deg);
+ -o-transform: rotate(120deg);
+ -ms-transform: rotate(120deg);
+ transform: rotate(120deg);
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand.deg-5 {
+ -webkit-transform: rotate(150deg);
+ -moz-transform: rotate(150deg);
+ -o-transform: rotate(150deg);
+ -ms-transform: rotate(150deg);
+ transform: rotate(150deg);
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand.deg-6 {
+ -webkit-transform: rotate(180deg);
+ -moz-transform: rotate(180deg);
+ -o-transform: rotate(180deg);
+ -ms-transform: rotate(180deg);
+ transform: rotate(180deg);
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand.deg-7 {
+ -webkit-transform: rotate(210deg);
+ -moz-transform: rotate(210deg);
+ -o-transform: rotate(210deg);
+ -ms-transform: rotate(210deg);
+ transform: rotate(210deg);
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand.deg-8 {
+ -webkit-transform: rotate(240deg);
+ -moz-transform: rotate(240deg);
+ -o-transform: rotate(240deg);
+ -ms-transform: rotate(240deg);
+ transform: rotate(240deg);
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand.deg-9 {
+ -webkit-transform: rotate(270deg);
+ -moz-transform: rotate(270deg);
+ -o-transform: rotate(270deg);
+ -ms-transform: rotate(270deg);
+ transform: rotate(270deg);
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand.deg-10 {
+ -webkit-transform: rotate(300deg);
+ -moz-transform: rotate(300deg);
+ -o-transform: rotate(300deg);
+ -ms-transform: rotate(300deg);
+ transform: rotate(300deg);
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand.deg-11 {
+ -webkit-transform: rotate(330deg);
+ -moz-transform: rotate(330deg);
+ -o-transform: rotate(330deg);
+ -ms-transform: rotate(330deg);
+ transform: rotate(330deg);
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand.deg-12 {
+ -webkit-transform: rotate(360deg);
+ -moz-transform: rotate(360deg);
+ -o-transform: rotate(360deg);
+ -ms-transform: rotate(360deg);
+ transform: rotate(360deg);
+}
+
+.datetimepicker .time-circle-outer .time-circle-hand-large {
+ height: 120px;
+ top: calc(50% - 120px);
+}
+
+.datetimepicker .time-circle-outer .time {
+ position: absolute;
+ margin-top: -15px;
+ margin-left: -15px;
+ background-color: #b4b4b4;
+ -webkit-border-radius: 50%;
+ border-radius: 50%;
+ padding: 5px;
+ height: 28px;
+ width: 28px;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ text-align: center;
+ font-size: 13px;
+ cursor: pointer;
+ color: rgba(0,0,0,0.75);
+}
+
+.datetimepicker .time-circle-outer .time:hover,
+.datetimepicker .time-circle-outer .time.selected {
+ background-color: #0574AC;
+ color: #fff;
+}
+
+.datetimepicker .time-circle-outer .time-1 {
+ left: calc(50% + 60px);
+ top: 16.076951545867374px;
+}
+
+.datetimepicker .time-circle-outer .time-2 {
+ left: calc(50% + 103.92304845413263px);
+ top: 60px;
+}
+
+.datetimepicker .time-circle-outer .time-3 {
+ left: calc(50% + 120px);
+ top: 120px;
+}
+
+.datetimepicker .time-circle-outer .time-4 {
+ left: calc(50% + 103.92304845413263px);
+ top: 180px;
+}
+
+.datetimepicker .time-circle-outer .time-5 {
+ left: calc(50% + 60px);
+ top: 223.92304845413264px;
+}
+
+.datetimepicker .time-circle-outer .time-6 {
+ left: 50%;
+ top: 240px;
+}
+
+.datetimepicker .time-circle-outer .time-11 {
+ left: calc(50% - 60px);
+ top: 16.076951545867374px;
+}
+
+.datetimepicker .time-circle-outer .time-10 {
+ left: calc(50% - 103.92304845413263px);
+ top: 60px;
+}
+
+.datetimepicker .time-circle-outer .time-9 {
+ left: calc(50% - 120px);
+ top: 120px;
+}
+
+.datetimepicker .time-circle-outer .time-8 {
+ left: calc(50% - 103.92304845413263px);
+ top: 180px;
+}
+
+.datetimepicker .time-circle-outer .time-7 {
+ left: calc(50% - 60px);
+ top: 223.92304845413264px;
+}
+
+.datetimepicker .time-circle-outer .time-12 {
+ left: 50%;
+ top: 0px;
+}
+
+.datetimepicker .time-circle-outer .time-circle-inner {
+ width: 164px;
+ height: 164px;
+ border: 3px dashed rgba(0,0,0,0.1);
+ -webkit-border-radius: 50%;
+ border-radius: 50%;
+ margin: 35px auto;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ position: relative;
+}
+
+.datetimepicker .time-circle-outer .time-circle-inner .time-1 {
+ left: calc(50% + 41px);
+ top: 10.985916889676034px;
+}
+
+.datetimepicker .time-circle-outer .time-circle-inner .time-2 {
+ left: calc(50% + 71.01408311032397px);
+ top: 41px;
+}
+
+.datetimepicker .time-circle-outer .time-circle-inner .time-3 {
+ left: calc(50% + 82px);
+ top: 82px;
+}
+
+.datetimepicker .time-circle-outer .time-circle-inner .time-4 {
+ left: calc(50% + 71.01408311032397px);
+ top: 123px;
+}
+
+.datetimepicker .time-circle-outer .time-circle-inner .time-5 {
+ left: calc(50% + 41px);
+ top: 153.01408311032395px;
+}
+
+.datetimepicker .time-circle-outer .time-circle-inner .time-6 {
+ left: 50%;
+ top: 164px;
+}
+
+.datetimepicker .time-circle-outer .time-circle-inner .time-11 {
+ left: calc(50% - 41px);
+ top: 10.985916889676034px;
+}
+
+.datetimepicker .time-circle-outer .time-circle-inner .time-10 {
+ left: calc(50% - 71.01408311032397px);
+ top: 41px;
+}
+
+.datetimepicker .time-circle-outer .time-circle-inner .time-9 {
+ left: calc(50% - 82px);
+ top: 82px;
+}
+
+.datetimepicker .time-circle-outer .time-circle-inner .time-8 {
+ left: calc(50% - 71.01408311032397px);
+ top: 123px;
+}
+
+.datetimepicker .time-circle-outer .time-circle-inner .time-7 {
+ left: calc(50% - 41px);
+ top: 153.01408311032395px;
+}
+
+.datetimepicker .time-circle-outer .time-circle-inner .time-12 {
+ left: 50%;
+ top: 0px;
+}
+
+.datetimepicker .datetimepicker-action {
+ cursor: pointer;
+ font-weight: bold;
+ line-height: 18px;
+ padding: 10px 10px;
+}
+
+.datetimepicker .datetimepicker-action:hover {
+ background-color: rgba(5, 116, 172, 1);
+ cursor: pointer;
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.js
new file mode 100644
index 00000000..ae69a913
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.js
@@ -0,0 +1,277 @@
+ String.prototype.paddingLeft = function (paddingValue) {
+ return String(paddingValue + this).slice(-paddingValue.length);
+ };
+
+angular.module("app/scripts/ng_js_att_tpls/datepicker/dateTimePickerPopup.html", []).run(["$templateCache", function($templateCache) {
+ $templateCache.put("app/scripts/ng_js_att_tpls/datepicker/dateTimePickerPopup.html",
+ "<div class=\"calendar\">\n" +
+ " <div class=\"box\" ng-class=\"{'active': isOpen}\">\n" +
+ " <span ng-transclude></span>\n" +
+
+ " <i class=\"calendar-icon\" tabindex=\"0\" att-accessibility-click=\"13,32\" ng-click=\"toggle()\" alt=\"Calendar Icon\" ></i>\n" +
+ " </div>\n" +
+
+ '<div class="datetimepicker datepicker-wrapper datepicker-wrapper-display-none" style="z-index:10000;width:292px" ng-style="{display: (isOpen && \'block\') || \'none\'}" aria-hidden=\"false\" role=\"dialog\" tabindex=\"-1\">'
+ + '<div class="datetimepicker-content">'
+
+ + '<ul class="tabsbid--small">'
+ + '<li class="tabsbid__item" ng-class="{\'tabsbid__item--active\':tab==\'date\'}" ng-click="setTab(\'date\')">'
+ + '<a class="tabsbid__item-link" href="" tabindex="0" att-accessibility-click="32,13">Date</a>'
+ + '</li>'
+ + '<li class="tabsbid__item " ng-class="{\'tabsbid__item--active\':tab==\'time\'}" ng-click="setTab(\'time\')">'
+ + '<a class="tabsbid__item-link" href="" tabindex="0" att-accessibility-click="32,13">Time</a>'
+ + '</li>'
+ + '</ul>'
+
+ + '<div class="datetimepicker-section datetimepicker-date-section" ng-if="tab==\'date\'">'
+ + '<div class="datetimepicker-month">'
+ +'<div class="icons-list left" style="margin:5px;cursor: pointer;" data-size="medium" ng-click="addMonth(-1)"><i class="icon-arrow-left-circle" ng-class="{\'disabled\': disablePrev}" alt="Left Arrow"></i></div>'
+ +'<div class="icons-list right" style="margin:5px;cursor: pointer;" data-size="medium" ng-click="addMonth(1)"><i class="icon-arrow-right-circle" ng-class="{\'disabled\': disableNext}" alt="Right Arrow"></i></div>'
+ + '<div class="datetimepicker-current-month">{{displayMonth}} {{year}}</div>'
+ + '</div>'
+ + '<div class="datetimepicker-calendar">'
+ + '<div class="datetimepicker-day" ng-repeat="day in dayNames">{{day | limitTo: 1}}</div>'
+ + '<div class="datetimepicker-day datetimepicker-leading-day" ng-repeat="d in days.leadingDays">{{d}}</div>'
+ + '<div class="datetimepicker-day datetimepicker-active-day" ng-class="{\'selected\':day==d}" ng-click="setDay(d)" ng-repeat="d in days.days">{{d}}</div>'
+ + '<div class="datetimepicker-day datetimepicker-trailing-day" ng-repeat="d in days.trailingDays">{{d}}</div>'
+ + '</div>'
+ + '</div>'
+
+ + '<div class="datetimepicker-section datetimepicker-date-time" ng-if="tab==\'time\'">'
+ + '<div class="datetimepicker-month">'
+ + '<div class="datetimepicker-current-month">{{hour}}:{{minute}}</div>'
+ + '</div>'
+ + '<div class="time-circle-outer">'
+ + '<div class="time-meridian time-left" ng-click="setMeridian(\'AM\')" ng-class="{\'selected\':meridian==\'AM\'}">AM</div>'
+ + '<div class="time-meridian time-right" ng-click="setMeridian(\'PM\')" ng-class="{\'selected\':meridian==\'PM\'}">PM</div>'
+ + '<div class="time-circle-center"></div>'
+ + '<div class="time-circle-hand time-circle-hand-large deg-{{minute/5}}" ></div>'
+ + '<div class="time time-{{$index+1}}" ng-class="{\'selected\':minute==time}" ng-click="setMinutes(time)" ng-repeat="time in [5,10,15,20,25,30,35,40,45,50,55,0]">{{time}}</div>'
+ + '<div class="time-circle-inner">'
+ + '<div class="time-circle-hand deg-{{hour}}" ></div>'
+ + '<div class="time time-{{$index+1}}" ng-class="{\'selected\':hour==time}" ng-click="setHour(time)" ng-repeat="time in [1,2,3,4,5,6,7,8,9,10,11,12]">{{time}}</div>'
+ + '</div>'
+ + '</div>'
+ + '</div>'
+
+ + '</div>'
+ + '</div>' +
+
+ "</div>\n" +
+ "");
+}]);
+
+angular.module('quantum').requires.push("app/scripts/ng_js_att_tpls/datepicker/dateTimePickerPopup.html");
+
+angular.module('quantum')
+.directive('dateTimePickerPopup', ['$document', 'datepickerService', '$isElement', '$documentBind', function($document, datepickerService, $isElement, $documentBind) {
+ var link = function (scope, elem, attr) {
+ datepickerService.bindScope(attr, scope);
+
+ scope.isOpen = false;
+
+ var toggle = scope.toggle = function (show) {
+ if(show === true || show === false) {
+ scope.isOpen = show;
+ } else {
+ scope.isOpen = !scope.isOpen;
+ }
+ };
+
+// scope.$watch('current', function () {
+// toggle(false);
+// });
+
+ var outsideClick = function (e) {
+ var isElement = $isElement(angular.element(e.target), elem, $document);
+ if(!isElement) {
+ toggle(false);
+ scope.$apply();
+ }
+ };
+
+ $documentBind.click('isOpen', outsideClick, scope);
+
+ scope.tabs = [{
+ title: 'DATE',
+ url: '#option1'
+ }, {
+ title: 'TIME',
+ url: '#option2',
+ selected: true
+ }
+ ];
+
+ //--------------------------------------
+
+ scope.state = false;
+ scope.tab = 'time';
+ scope.setTab = function(tab){
+ scope.tab = tab;
+ };
+ scope.config = {
+ modal: true,
+ color:'rgba(5, 116, 172, 1)',
+ backgroundColor: 'rgba(0,0,0,0.75)'
+ };
+ scope.months = ["January","February","March","April","May","June","July","Augusta","September","October","November","December"];
+ scope.dayNames = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
+ scope.$watch('current',function(value){
+ var m;
+ if(value)
+ m = moment(value);
+ else
+ m = moment();
+ m = m.minute(5*Math.ceil(m.minute()/5));
+ scope.display = m.format('YYYY-MM-DD hh:mm A');
+ scope.days = scope.getDaysInMonth(m.year(),m.month());
+ scope.minute = m.minute();
+ scope.meridian = m.format('A');
+ scope.hour = scope.meridian == 'PM' ? m.hour() - 12: m.hour();
+ if(scope.hour==0) scope.hour = 12;
+ scope.datePreview = m.format('YYYY-MM-DD');
+ scope.timePreview = m.format('hh:mm A');
+ scope.displayMonth = scope.months[m.month()];
+ scope.day = m.date();
+ scope.year = m.year();
+
+ });
+
+ scope.setDay = function(date){
+ scope.current = moment(scope.current).date(date).toDate();
+ };
+
+ scope.setState = function(state){
+ scope.state = false;
+ };
+
+ scope.setHour = function(hour){
+ if(scope.meridian == 'PM' && hour < 12)
+ hour = hour + 12;
+ if(scope.meridian == 'AM' && hour == 12)
+ hour = hour - 12;
+ scope.current = moment(scope.current).hour(hour).toDate();
+ };
+
+ scope.setMeridian = function(meridian){
+ var m = moment(scope.current);
+
+ if(meridian == 'AM'){
+ if(m.hours()>=12){
+ m = m.add(-12,'hours');
+ scope.current = m.toDate();
+ }
+ }else{
+ if(m.hours()<12){
+ m = m.add(12,'hours');
+ scope.current = m.toDate();
+ }
+ }
+ };
+
+ scope.setMinutes = function(minutes){
+ scope.current = moment(scope.current).minute(minutes).toDate();
+ };
+
+ var days = [];
+ for(var i=1;i<=31;i++){
+ days.push(i);
+ }
+ scope.getDaysInMonth = function(year,month){
+ var firstDayOfWeek = 0;
+ var firstDayOfMonth = new Date(year, month, 1),
+ lastDayOfMonth = new Date(year, month + 1, 0),
+ lastDayOfPreviousMonth = new Date(year, month, 0),
+ daysInMonth = lastDayOfMonth.getDate(),
+ daysInLastMonth = lastDayOfPreviousMonth.getDate(),
+ dayOfWeek = firstDayOfMonth.getDay(),
+ leadingDays = (dayOfWeek - firstDayOfWeek + 7) % 7 || 7,
+ trailingDays = days.slice(0, 6 * 7 - (leadingDays + daysInMonth));
+ if (trailingDays.length > 7) {
+ trailingDays = trailingDays.slice(0, trailingDays.length-7);
+ }
+
+ return {
+ year: year,
+ month: month,
+ days: days.slice(0, daysInMonth),
+ leadingDays: days.slice(- leadingDays - (31 - daysInLastMonth), daysInLastMonth),
+ trailingDays: trailingDays
+ };
+ };
+
+ scope.addMonth = function(increment){
+ scope.current = moment(scope.current).add(increment,'months').toDate();
+ };
+
+ };
+
+ return {
+ restrict: 'EA',
+ replace: true,
+ transclude: true,
+ templateUrl: 'app/scripts/ng_js_att_tpls/datepicker/dateTimePickerPopup.html',
+ scope: {
+ current: "=current"
+ },
+ compile: function (elem, attr) {
+ var wrapperElement = elem.find('span').eq(1);
+ wrapperElement.attr('current', 'current');
+ datepickerService.setAttributes(attr, wrapperElement);
+
+ return link;
+ }
+ };
+}])
+.directive('attDateTimePicker', ['$log', function($log) {
+ return {
+ restrict: 'A',
+ require: 'ngModel',
+ scope: {},
+ controller: ['$scope', '$element', '$attrs', '$compile', 'datepickerConfig', 'datepickerService', function($scope, $element, $attrs, $compile, datepickerConfig, datepickerService) {
+ var dateFormatString = angular.isDefined($attrs.dateFormat) ? $scope.$parent.$eval($attrs.dateFormat) : datepickerConfig.dateFormat;
+ var selectedDateMessage = '<div class="sr-focus hidden-spoken" tabindex="-1">the date you selected is {{$parent.current | date : \'' + dateFormatString + '\'}}</div>';
+
+ $element.removeAttr('att-date-time-picker');
+ $element.removeAttr('ng-model');
+ $element.attr('ng-model', '$parent.current');
+ $element.attr('aria-describedby', 'datepicker');
+ $element.attr('format-date', dateFormatString);
+ $element.attr('att-input-deny', '[^0-9ampAMP \/:-]');
+ $element.attr('maxlength', 20);
+
+ var wrapperElement = angular.element('<div></div>');
+ wrapperElement.attr('date-time-picker-popup', '');
+ wrapperElement.attr('current', 'current');
+
+ datepickerService.setAttributes($attrs, wrapperElement);
+ datepickerService.bindScope($attrs, $scope);
+
+ wrapperElement.html('');
+ wrapperElement.append($element.prop('outerHTML'));
+ if (navigator.userAgent.match(/MSIE 8/) === null) {
+ wrapperElement.append(selectedDateMessage);
+ }
+ var elm = wrapperElement.prop('outerHTML');
+
+ elm = $compile(elm)($scope);
+ $element.replaceWith(elm);
+ }],
+ link: function(scope, elem, attr, ctrl) {
+ if (!ctrl) {
+ // do nothing if no ng-model
+ $log.error("ng-model is required.");
+ return;
+ }
+
+ scope.$watch('current', function(value) {
+ ctrl.$setViewValue(value);
+ });
+ ctrl.$render = function() {
+ scope.current = ctrl.$viewValue;
+ };
+ }
+ };
+}]);
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/dynamicform.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/dynamicform.js
new file mode 100644
index 00000000..e711f414
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/dynamicform.js
@@ -0,0 +1,112 @@
+angular.module('quantum')
+ .directive('formBuilder', ['$q', '$parse', '$http', '$templateCache', '$compile', '$document', '$timeout', function ($q, $parse, $http, $templateCache, $compile, $document, $timeout) {
+ return {
+ restrict: 'E', // supports using directive as element only
+ scope:{
+ ngModel: '=',
+ ngFormFields: '=',
+ ngNumFormCols: '=',
+ ngTriggerMethod: '=',
+ ngShowFieldId: '='
+ },
+ link: function ($scope, element, attrs) {
+ $scope.element=element;
+ $scope.datetimeformat = "MM/dd/yyyy hh:mm a";
+
+ $scope.buildField = function (field, parentElement) {
+ var x = '';
+ if(field.visible) {
+ if (field.fieldType === 'LIST_MULTI_SELECT') {
+ x = angular.element('<label><i>'+field.fieldDisplayName+'<span ng-show="ngShowFieldId"> [ '+field.fieldId+' ] </span>:</i></label><br>'+
+ '<div class="select2-container ebz-listbox form-field" style="height:100px;" tabindex="0" >'+
+ '<label ng-repeat="item in ngModel.'+field.fieldId+'" style="display:block;">'+
+ '<input type="checkbox" style="margin-top: 10px;" ng-model="item.defaultValue" ng-change="triggerFormFields('+field.triggerOtherFormFields+')" att-checkbox title="{{item.title}}"/> {{item.title}}<br/>'+
+ '</label>'+
+ '</div>');
+ } else if (field.fieldType === 'LIST_BOX') {
+ x = angular.element('<label><i>'+field.fieldDisplayName+'<span ng-show="ngShowFieldId"> [ '+field.fieldId+' ] </span>:</i></label><br> <div class="form-field" att-select="formFieldLuValues.'+field.fieldId+'" ng-model="ngModel.'+field.fieldId+'" ng-change="triggerFormFields('+field.triggerOtherFormFields+')"></div>');
+ } else if((field.fieldType === 'text' || field.fieldType === 'TEXT') && field.validationType === 'DATE'){
+ x = angular.element('<label><i>'+field.fieldDisplayName+'<span ng-show="ngShowFieldId"> [ '+field.fieldId+' ] </span>:</i></label><br> <input id="'+field.fieldId+'" type="text" ng-model="ngModel.'+field.fieldId+'" tabindex="0" ng-change="triggerFormFields('+field.triggerOtherFormFields+')" att-datepicker>');
+ } else if((field.fieldType === 'text' || field.fieldType === 'TEXT') && field.validationType === 'TIMESTAMP_MIN'){
+ x = angular.element('<label><i>'+field.fieldDisplayName+'<span ng-show="ngShowFieldId"> [ '+field.fieldId+' ] </span>:</i></label><br> <input id="'+field.fieldId+'" type="text" date-format="datetimeformat" ng-model="ngModel.'+field.fieldId+'" tabindex="0" ng-change="triggerFormFields('+field.triggerOtherFormFields+')" att-date-time-picker>');
+ } else if(field.fieldType === 'text' || field.fieldType === 'TEXT'){
+ x = angular.element('<label><i>'+field.fieldDisplayName+'<span ng-show="ngShowFieldId"> [ '+field.fieldId+' ] </span>:</i></label><br> <input type="text" class="form-field" ng-model="ngModel.'+field.fieldId+'" maxlength="'+field.length+'" ng-blur="triggerFormFields('+field.triggerOtherFormFields+')" />');
+ } else if(field.fieldType === 'CHECK_BOX'){
+ x = angular.element('<label><i>'+field.fieldDisplayName+'<span ng-show="ngShowFieldId"> [ '+field.fieldId+' ] </span>:</i></label><br> <input type="checkbox" ng-model="ngModel.'+field.fieldId+'" tabindex="0" ng-change="triggerFormFields('+field.triggerOtherFormFields+')" att-checkbox>');
+ }
+ }
+ parentElement.append(x);
+ $compile(x)($scope);
+ };
+ $scope.buildForm = function() {
+ // create elements <table> and a <tbody>
+ var tbl = angular.element("<table></table>");
+ var tblBody = angular.element("<tbody></tbody>");
+ var row = angular.element("<tr></tr>");
+
+ var ngFormFieldsLength = $scope.ngFormFields.length;
+
+ for (var j = 0; j < ngFormFieldsLength; j++) {
+ var cell = angular.element("<td style='padding: 5px;'></td>");
+ $scope.buildField($scope.ngFormFields[j],cell);
+ row.append(cell);
+
+ if((j!=0 && (j+1)%$scope.ngNumFormCols==0) || j==(ngFormFieldsLength-1)){
+ tblBody.append(row);
+ row = angular.element("<tr></tr>");
+ }
+ }
+ tbl.append(tblBody);
+ angular.element($scope.element).html('');
+ $scope.element.append(tbl);
+ };
+
+
+ $scope.formFieldLuValues = {};
+ $scope.getEBZFormat = function() {
+ if($scope.ngFormFields && $scope.ngFormFields.length>0){
+ $scope.ngFormFields.forEach(function(formField) {
+ if(formField.fieldType === 'LIST_MULTI_SELECT') {
+ $scope.ngModel[formField.fieldId]= [];
+ if(formField.formFieldValues && formField.formFieldValues.length>0){
+ formField.formFieldValues.forEach(function(entry,i) {
+ $scope.ngModel[formField.fieldId].push({ index: i, value: entry.id, title: entry.name, defaultValue: entry.defaultValue});
+ });
+ }
+ } else if(formField.fieldType==='LIST_BOX') {
+ $scope.formFieldLuValues[formField.fieldId]= [];
+ if(formField.formFieldValues && formField.formFieldValues.length>0){
+ formField.formFieldValues.forEach(function(entry,i) {
+ $scope.formFieldLuValues[formField.fieldId].push({ index: i, value: entry.id, title: entry.name});
+ if(entry.defaultValue){
+ $scope.ngModel[formField.fieldId]={ index: i, value: entry.id, title: entry.name};
+ }
+ });
+ }
+ } else if(formField.fieldType === 'text' || formField.fieldType === 'TEXT' ||
+ formField.validationType === 'DATE' || formField.validationType === 'TIMESTAMP_MIN') {
+ if(formField.formFieldValues && formField.formFieldValues.length>0){
+ $scope.ngModel[formField.fieldId]=formField.formFieldValues[0].id;
+ }
+ }
+ });
+ }
+ };
+
+ $scope.$watch("ngFormFields",function(newValue,oldValue) {
+ if($scope.ngFormFields){
+ $scope.getEBZFormat();
+ $scope.buildForm();
+ }
+ });
+
+ $scope.triggerFormFields = function(triggerFlag) {
+ if(triggerFlag){
+ $scope.element.html('Loading...');
+ $scope.ngTriggerMethod();
+ }
+ };
+
+ }
+ };
+ }]);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/moment.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/moment.js
new file mode 100644
index 00000000..b5f0b364
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/moment.js
@@ -0,0 +1,3688 @@
+//! moment.js
+//! version : 2.12.0
+//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
+//! license : MIT
+//! momentjs.com
+
+;(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ global.moment = factory()
+}(this, function () { 'use strict';
+
+ var hookCallback;
+
+ function utils_hooks__hooks () {
+ return hookCallback.apply(null, arguments);
+ }
+
+ // This is done to register the method called with moment()
+ // without creating circular dependencies.
+ function setHookCallback (callback) {
+ hookCallback = callback;
+ }
+
+ function isArray(input) {
+ return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
+ }
+
+ function isDate(input) {
+ return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
+ }
+
+ function map(arr, fn) {
+ var res = [], i;
+ for (i = 0; i < arr.length; ++i) {
+ res.push(fn(arr[i], i));
+ }
+ return res;
+ }
+
+ function hasOwnProp(a, b) {
+ return Object.prototype.hasOwnProperty.call(a, b);
+ }
+
+ function extend(a, b) {
+ for (var i in b) {
+ if (hasOwnProp(b, i)) {
+ a[i] = b[i];
+ }
+ }
+
+ if (hasOwnProp(b, 'toString')) {
+ a.toString = b.toString;
+ }
+
+ if (hasOwnProp(b, 'valueOf')) {
+ a.valueOf = b.valueOf;
+ }
+
+ return a;
+ }
+
+ function create_utc__createUTC (input, format, locale, strict) {
+ return createLocalOrUTC(input, format, locale, strict, true).utc();
+ }
+
+ function defaultParsingFlags() {
+ // We need to deep clone this object.
+ return {
+ empty : false,
+ unusedTokens : [],
+ unusedInput : [],
+ overflow : -2,
+ charsLeftOver : 0,
+ nullInput : false,
+ invalidMonth : null,
+ invalidFormat : false,
+ userInvalidated : false,
+ iso : false
+ };
+ }
+
+ function getParsingFlags(m) {
+ if (m._pf == null) {
+ m._pf = defaultParsingFlags();
+ }
+ return m._pf;
+ }
+
+ function valid__isValid(m) {
+ if (m._isValid == null) {
+ var flags = getParsingFlags(m);
+ m._isValid = !isNaN(m._d.getTime()) &&
+ flags.overflow < 0 &&
+ !flags.empty &&
+ !flags.invalidMonth &&
+ !flags.invalidWeekday &&
+ !flags.nullInput &&
+ !flags.invalidFormat &&
+ !flags.userInvalidated;
+
+ if (m._strict) {
+ m._isValid = m._isValid &&
+ flags.charsLeftOver === 0 &&
+ flags.unusedTokens.length === 0 &&
+ flags.bigHour === undefined;
+ }
+ }
+ return m._isValid;
+ }
+
+ function valid__createInvalid (flags) {
+ var m = create_utc__createUTC(NaN);
+ if (flags != null) {
+ extend(getParsingFlags(m), flags);
+ }
+ else {
+ getParsingFlags(m).userInvalidated = true;
+ }
+
+ return m;
+ }
+
+ function isUndefined(input) {
+ return input === void 0;
+ }
+
+ // Plugins that add properties should also add the key here (null value),
+ // so we can properly clone ourselves.
+ var momentProperties = utils_hooks__hooks.momentProperties = [];
+
+ function copyConfig(to, from) {
+ var i, prop, val;
+
+ if (!isUndefined(from._isAMomentObject)) {
+ to._isAMomentObject = from._isAMomentObject;
+ }
+ if (!isUndefined(from._i)) {
+ to._i = from._i;
+ }
+ if (!isUndefined(from._f)) {
+ to._f = from._f;
+ }
+ if (!isUndefined(from._l)) {
+ to._l = from._l;
+ }
+ if (!isUndefined(from._strict)) {
+ to._strict = from._strict;
+ }
+ if (!isUndefined(from._tzm)) {
+ to._tzm = from._tzm;
+ }
+ if (!isUndefined(from._isUTC)) {
+ to._isUTC = from._isUTC;
+ }
+ if (!isUndefined(from._offset)) {
+ to._offset = from._offset;
+ }
+ if (!isUndefined(from._pf)) {
+ to._pf = getParsingFlags(from);
+ }
+ if (!isUndefined(from._locale)) {
+ to._locale = from._locale;
+ }
+
+ if (momentProperties.length > 0) {
+ for (i in momentProperties) {
+ prop = momentProperties[i];
+ val = from[prop];
+ if (!isUndefined(val)) {
+ to[prop] = val;
+ }
+ }
+ }
+
+ return to;
+ }
+
+ var updateInProgress = false;
+
+ // Moment prototype object
+ function Moment(config) {
+ copyConfig(this, config);
+ this._d = new Date(config._d != null ? config._d.getTime() : NaN);
+ // Prevent infinite loop in case updateOffset creates new moment
+ // objects.
+ if (updateInProgress === false) {
+ updateInProgress = true;
+ utils_hooks__hooks.updateOffset(this);
+ updateInProgress = false;
+ }
+ }
+
+ function isMoment (obj) {
+ return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
+ }
+
+ function absFloor (number) {
+ if (number < 0) {
+ return Math.ceil(number);
+ } else {
+ return Math.floor(number);
+ }
+ }
+
+ function toInt(argumentForCoercion) {
+ var coercedNumber = +argumentForCoercion,
+ value = 0;
+
+ if (coercedNumber !== 0 && isFinite(coercedNumber)) {
+ value = absFloor(coercedNumber);
+ }
+
+ return value;
+ }
+
+ // compare two arrays, return the number of differences
+ function compareArrays(array1, array2, dontConvert) {
+ var len = Math.min(array1.length, array2.length),
+ lengthDiff = Math.abs(array1.length - array2.length),
+ diffs = 0,
+ i;
+ for (i = 0; i < len; i++) {
+ if ((dontConvert && array1[i] !== array2[i]) ||
+ (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
+ diffs++;
+ }
+ }
+ return diffs + lengthDiff;
+ }
+
+ function warn(msg) {
+ if (utils_hooks__hooks.suppressDeprecationWarnings === false &&
+ (typeof console !== 'undefined') && console.warn) {
+ console.warn('Deprecation warning: ' + msg);
+ }
+ }
+
+ function deprecate(msg, fn) {
+ var firstTime = true;
+
+ return extend(function () {
+ if (firstTime) {
+ warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack);
+ firstTime = false;
+ }
+ return fn.apply(this, arguments);
+ }, fn);
+ }
+
+ var deprecations = {};
+
+ function deprecateSimple(name, msg) {
+ if (!deprecations[name]) {
+ warn(msg);
+ deprecations[name] = true;
+ }
+ }
+
+ utils_hooks__hooks.suppressDeprecationWarnings = false;
+
+ function isFunction(input) {
+ return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
+ }
+
+ function isObject(input) {
+ return Object.prototype.toString.call(input) === '[object Object]';
+ }
+
+ function locale_set__set (config) {
+ var prop, i;
+ for (i in config) {
+ prop = config[i];
+ if (isFunction(prop)) {
+ this[i] = prop;
+ } else {
+ this['_' + i] = prop;
+ }
+ }
+ this._config = config;
+ // Lenient ordinal parsing accepts just a number in addition to
+ // number + (possibly) stuff coming from _ordinalParseLenient.
+ this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
+ }
+
+ function mergeConfigs(parentConfig, childConfig) {
+ var res = extend({}, parentConfig), prop;
+ for (prop in childConfig) {
+ if (hasOwnProp(childConfig, prop)) {
+ if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
+ res[prop] = {};
+ extend(res[prop], parentConfig[prop]);
+ extend(res[prop], childConfig[prop]);
+ } else if (childConfig[prop] != null) {
+ res[prop] = childConfig[prop];
+ } else {
+ delete res[prop];
+ }
+ }
+ }
+ return res;
+ }
+
+ function Locale(config) {
+ if (config != null) {
+ this.set(config);
+ }
+ }
+
+ // internal storage for locale config files
+ var locales = {};
+ var globalLocale;
+
+ function normalizeLocale(key) {
+ return key ? key.toLowerCase().replace('_', '-') : key;
+ }
+
+ // pick the locale from the array
+ // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
+ // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
+ function chooseLocale(names) {
+ var i = 0, j, next, locale, split;
+
+ while (i < names.length) {
+ split = normalizeLocale(names[i]).split('-');
+ j = split.length;
+ next = normalizeLocale(names[i + 1]);
+ next = next ? next.split('-') : null;
+ while (j > 0) {
+ locale = loadLocale(split.slice(0, j).join('-'));
+ if (locale) {
+ return locale;
+ }
+ if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
+ //the next array item is better than a shallower substring of this one
+ break;
+ }
+ j--;
+ }
+ i++;
+ }
+ return null;
+ }
+
+ function loadLocale(name) {
+ var oldLocale = null;
+ // TODO: Find a better way to register and load all the locales in Node
+ if (!locales[name] && (typeof module !== 'undefined') &&
+ module && module.exports) {
+ try {
+ oldLocale = globalLocale._abbr;
+ require('./locale/' + name);
+ // because defineLocale currently also sets the global locale, we
+ // want to undo that for lazy loaded locales
+ locale_locales__getSetGlobalLocale(oldLocale);
+ } catch (e) { }
+ }
+ return locales[name];
+ }
+
+ // This function will load locale and then set the global locale. If
+ // no arguments are passed in, it will simply return the current global
+ // locale key.
+ function locale_locales__getSetGlobalLocale (key, values) {
+ var data;
+ if (key) {
+ if (isUndefined(values)) {
+ data = locale_locales__getLocale(key);
+ }
+ else {
+ data = defineLocale(key, values);
+ }
+
+ if (data) {
+ // moment.duration._locale = moment._locale = data;
+ globalLocale = data;
+ }
+ }
+
+ return globalLocale._abbr;
+ }
+
+ function defineLocale (name, config) {
+ if (config !== null) {
+ config.abbr = name;
+ if (locales[name] != null) {
+ deprecateSimple('defineLocaleOverride',
+ 'use moment.updateLocale(localeName, config) to change ' +
+ 'an existing locale. moment.defineLocale(localeName, ' +
+ 'config) should only be used for creating a new locale');
+ config = mergeConfigs(locales[name]._config, config);
+ } else if (config.parentLocale != null) {
+ if (locales[config.parentLocale] != null) {
+ config = mergeConfigs(locales[config.parentLocale]._config, config);
+ } else {
+ // treat as if there is no base config
+ deprecateSimple('parentLocaleUndefined',
+ 'specified parentLocale is not defined yet');
+ }
+ }
+ locales[name] = new Locale(config);
+
+ // backwards compat for now: also set the locale
+ locale_locales__getSetGlobalLocale(name);
+
+ return locales[name];
+ } else {
+ // useful for testing
+ delete locales[name];
+ return null;
+ }
+ }
+
+ function updateLocale(name, config) {
+ if (config != null) {
+ var locale;
+ if (locales[name] != null) {
+ config = mergeConfigs(locales[name]._config, config);
+ }
+ locale = new Locale(config);
+ locale.parentLocale = locales[name];
+ locales[name] = locale;
+
+ // backwards compat for now: also set the locale
+ locale_locales__getSetGlobalLocale(name);
+ } else {
+ // pass null for config to unupdate, useful for tests
+ if (locales[name] != null) {
+ if (locales[name].parentLocale != null) {
+ locales[name] = locales[name].parentLocale;
+ } else if (locales[name] != null) {
+ delete locales[name];
+ }
+ }
+ }
+ return locales[name];
+ }
+
+ // returns locale data
+ function locale_locales__getLocale (key) {
+ var locale;
+
+ if (key && key._locale && key._locale._abbr) {
+ key = key._locale._abbr;
+ }
+
+ if (!key) {
+ return globalLocale;
+ }
+
+ if (!isArray(key)) {
+ //short-circuit everything else
+ locale = loadLocale(key);
+ if (locale) {
+ return locale;
+ }
+ key = [key];
+ }
+
+ return chooseLocale(key);
+ }
+
+ function locale_locales__listLocales() {
+ return Object.keys(locales);
+ }
+
+ var aliases = {};
+
+ function addUnitAlias (unit, shorthand) {
+ var lowerCase = unit.toLowerCase();
+ aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
+ }
+
+ function normalizeUnits(units) {
+ return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
+ }
+
+ function normalizeObjectUnits(inputObject) {
+ var normalizedInput = {},
+ normalizedProp,
+ prop;
+
+ for (prop in inputObject) {
+ if (hasOwnProp(inputObject, prop)) {
+ normalizedProp = normalizeUnits(prop);
+ if (normalizedProp) {
+ normalizedInput[normalizedProp] = inputObject[prop];
+ }
+ }
+ }
+
+ return normalizedInput;
+ }
+
+ function makeGetSet (unit, keepTime) {
+ return function (value) {
+ if (value != null) {
+ get_set__set(this, unit, value);
+ utils_hooks__hooks.updateOffset(this, keepTime);
+ return this;
+ } else {
+ return get_set__get(this, unit);
+ }
+ };
+ }
+
+ function get_set__get (mom, unit) {
+ return mom.isValid() ?
+ mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
+ }
+
+ function get_set__set (mom, unit, value) {
+ if (mom.isValid()) {
+ mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
+ }
+ }
+
+ // MOMENTS
+
+ function getSet (units, value) {
+ var unit;
+ if (typeof units === 'object') {
+ for (unit in units) {
+ this.set(unit, units[unit]);
+ }
+ } else {
+ units = normalizeUnits(units);
+ if (isFunction(this[units])) {
+ return this[units](value);
+ }
+ }
+ return this;
+ }
+
+ function zeroFill(number, targetLength, forceSign) {
+ var absNumber = '' + Math.abs(number),
+ zerosToFill = targetLength - absNumber.length,
+ sign = number >= 0;
+ return (sign ? (forceSign ? '+' : '') : '-') +
+ Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
+ }
+
+ var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
+
+ var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
+
+ var formatFunctions = {};
+
+ var formatTokenFunctions = {};
+
+ // token: 'M'
+ // padded: ['MM', 2]
+ // ordinal: 'Mo'
+ // callback: function () { this.month() + 1 }
+ function addFormatToken (token, padded, ordinal, callback) {
+ var func = callback;
+ if (typeof callback === 'string') {
+ func = function () {
+ return this[callback]();
+ };
+ }
+ if (token) {
+ formatTokenFunctions[token] = func;
+ }
+ if (padded) {
+ formatTokenFunctions[padded[0]] = function () {
+ return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
+ };
+ }
+ if (ordinal) {
+ formatTokenFunctions[ordinal] = function () {
+ return this.localeData().ordinal(func.apply(this, arguments), token);
+ };
+ }
+ }
+
+ function removeFormattingTokens(input) {
+ if (input.match(/\[[\s\S]/)) {
+ return input.replace(/^\[|\]$/g, '');
+ }
+ return input.replace(/\\/g, '');
+ }
+
+ function makeFormatFunction(format) {
+ var array = format.match(formattingTokens), i, length;
+
+ for (i = 0, length = array.length; i < length; i++) {
+ if (formatTokenFunctions[array[i]]) {
+ array[i] = formatTokenFunctions[array[i]];
+ } else {
+ array[i] = removeFormattingTokens(array[i]);
+ }
+ }
+
+ return function (mom) {
+ var output = '';
+ for (i = 0; i < length; i++) {
+ output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
+ }
+ return output;
+ };
+ }
+
+ // format date using native date object
+ function formatMoment(m, format) {
+ if (!m.isValid()) {
+ return m.localeData().invalidDate();
+ }
+
+ format = expandFormat(format, m.localeData());
+ formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
+
+ return formatFunctions[format](m);
+ }
+
+ function expandFormat(format, locale) {
+ var i = 5;
+
+ function replaceLongDateFormatTokens(input) {
+ return locale.longDateFormat(input) || input;
+ }
+
+ localFormattingTokens.lastIndex = 0;
+ while (i >= 0 && localFormattingTokens.test(format)) {
+ format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
+ localFormattingTokens.lastIndex = 0;
+ i -= 1;
+ }
+
+ return format;
+ }
+
+ var match1 = /\d/; // 0 - 9
+ var match2 = /\d\d/; // 00 - 99
+ var match3 = /\d{3}/; // 000 - 999
+ var match4 = /\d{4}/; // 0000 - 9999
+ var match6 = /[+-]?\d{6}/; // -999999 - 999999
+ var match1to2 = /\d\d?/; // 0 - 99
+ var match3to4 = /\d\d\d\d?/; // 999 - 9999
+ var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
+ var match1to3 = /\d{1,3}/; // 0 - 999
+ var match1to4 = /\d{1,4}/; // 0 - 9999
+ var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
+
+ var matchUnsigned = /\d+/; // 0 - inf
+ var matchSigned = /[+-]?\d+/; // -inf - inf
+
+ var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
+ var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
+
+ var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
+
+ // any word (or two) characters or numbers including two/three word month in arabic.
+ // includes scottish gaelic two word and hyphenated months
+ var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
+
+
+ var regexes = {};
+
+ function addRegexToken (token, regex, strictRegex) {
+ regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
+ return (isStrict && strictRegex) ? strictRegex : regex;
+ };
+ }
+
+ function getParseRegexForToken (token, config) {
+ if (!hasOwnProp(regexes, token)) {
+ return new RegExp(unescapeFormat(token));
+ }
+
+ return regexes[token](config._strict, config._locale);
+ }
+
+ // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
+ function unescapeFormat(s) {
+ return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
+ return p1 || p2 || p3 || p4;
+ }));
+ }
+
+ function regexEscape(s) {
+ return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+ }
+
+ var tokens = {};
+
+ function addParseToken (token, callback) {
+ var i, func = callback;
+ if (typeof token === 'string') {
+ token = [token];
+ }
+ if (typeof callback === 'number') {
+ func = function (input, array) {
+ array[callback] = toInt(input);
+ };
+ }
+ for (i = 0; i < token.length; i++) {
+ tokens[token[i]] = func;
+ }
+ }
+
+ function addWeekParseToken (token, callback) {
+ addParseToken(token, function (input, array, config, token) {
+ config._w = config._w || {};
+ callback(input, config._w, config, token);
+ });
+ }
+
+ function addTimeToArrayFromToken(token, input, config) {
+ if (input != null && hasOwnProp(tokens, token)) {
+ tokens[token](input, config._a, config, token);
+ }
+ }
+
+ var YEAR = 0;
+ var MONTH = 1;
+ var DATE = 2;
+ var HOUR = 3;
+ var MINUTE = 4;
+ var SECOND = 5;
+ var MILLISECOND = 6;
+ var WEEK = 7;
+ var WEEKDAY = 8;
+
+ function daysInMonth(year, month) {
+ return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
+ }
+
+ // FORMATTING
+
+ addFormatToken('M', ['MM', 2], 'Mo', function () {
+ return this.month() + 1;
+ });
+
+ addFormatToken('MMM', 0, 0, function (format) {
+ return this.localeData().monthsShort(this, format);
+ });
+
+ addFormatToken('MMMM', 0, 0, function (format) {
+ return this.localeData().months(this, format);
+ });
+
+ // ALIASES
+
+ addUnitAlias('month', 'M');
+
+ // PARSING
+
+ addRegexToken('M', match1to2);
+ addRegexToken('MM', match1to2, match2);
+ addRegexToken('MMM', function (isStrict, locale) {
+ return locale.monthsShortRegex(isStrict);
+ });
+ addRegexToken('MMMM', function (isStrict, locale) {
+ return locale.monthsRegex(isStrict);
+ });
+
+ addParseToken(['M', 'MM'], function (input, array) {
+ array[MONTH] = toInt(input) - 1;
+ });
+
+ addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
+ var month = config._locale.monthsParse(input, token, config._strict);
+ // if we didn't find a month name, mark the date as invalid.
+ if (month != null) {
+ array[MONTH] = month;
+ } else {
+ getParsingFlags(config).invalidMonth = input;
+ }
+ });
+
+ // LOCALES
+
+ var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/;
+ var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
+ function localeMonths (m, format) {
+ return isArray(this._months) ? this._months[m.month()] :
+ this._months[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
+ }
+
+ var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
+ function localeMonthsShort (m, format) {
+ return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
+ this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
+ }
+
+ function localeMonthsParse (monthName, format, strict) {
+ var i, mom, regex;
+
+ if (!this._monthsParse) {
+ this._monthsParse = [];
+ this._longMonthsParse = [];
+ this._shortMonthsParse = [];
+ }
+
+ for (i = 0; i < 12; i++) {
+ // make the regex if we don't have it already
+ mom = create_utc__createUTC([2000, i]);
+ if (strict && !this._longMonthsParse[i]) {
+ this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
+ this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
+ }
+ if (!strict && !this._monthsParse[i]) {
+ regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
+ this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
+ }
+ // test the regex
+ if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
+ return i;
+ } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
+ return i;
+ } else if (!strict && this._monthsParse[i].test(monthName)) {
+ return i;
+ }
+ }
+ }
+
+ // MOMENTS
+
+ function setMonth (mom, value) {
+ var dayOfMonth;
+
+ if (!mom.isValid()) {
+ // No op
+ return mom;
+ }
+
+ if (typeof value === 'string') {
+ if (/^\d+$/.test(value)) {
+ value = toInt(value);
+ } else {
+ value = mom.localeData().monthsParse(value);
+ // TODO: Another silent failure?
+ if (typeof value !== 'number') {
+ return mom;
+ }
+ }
+ }
+
+ dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
+ mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
+ return mom;
+ }
+
+ function getSetMonth (value) {
+ if (value != null) {
+ setMonth(this, value);
+ utils_hooks__hooks.updateOffset(this, true);
+ return this;
+ } else {
+ return get_set__get(this, 'Month');
+ }
+ }
+
+ function getDaysInMonth () {
+ return daysInMonth(this.year(), this.month());
+ }
+
+ var defaultMonthsShortRegex = matchWord;
+ function monthsShortRegex (isStrict) {
+ if (this._monthsParseExact) {
+ if (!hasOwnProp(this, '_monthsRegex')) {
+ computeMonthsParse.call(this);
+ }
+ if (isStrict) {
+ return this._monthsShortStrictRegex;
+ } else {
+ return this._monthsShortRegex;
+ }
+ } else {
+ return this._monthsShortStrictRegex && isStrict ?
+ this._monthsShortStrictRegex : this._monthsShortRegex;
+ }
+ }
+
+ var defaultMonthsRegex = matchWord;
+ function monthsRegex (isStrict) {
+ if (this._monthsParseExact) {
+ if (!hasOwnProp(this, '_monthsRegex')) {
+ computeMonthsParse.call(this);
+ }
+ if (isStrict) {
+ return this._monthsStrictRegex;
+ } else {
+ return this._monthsRegex;
+ }
+ } else {
+ return this._monthsStrictRegex && isStrict ?
+ this._monthsStrictRegex : this._monthsRegex;
+ }
+ }
+
+ function computeMonthsParse () {
+ function cmpLenRev(a, b) {
+ return b.length - a.length;
+ }
+
+ var shortPieces = [], longPieces = [], mixedPieces = [],
+ i, mom;
+ for (i = 0; i < 12; i++) {
+ // make the regex if we don't have it already
+ mom = create_utc__createUTC([2000, i]);
+ shortPieces.push(this.monthsShort(mom, ''));
+ longPieces.push(this.months(mom, ''));
+ mixedPieces.push(this.months(mom, ''));
+ mixedPieces.push(this.monthsShort(mom, ''));
+ }
+ // Sorting makes sure if one month (or abbr) is a prefix of another it
+ // will match the longer piece.
+ shortPieces.sort(cmpLenRev);
+ longPieces.sort(cmpLenRev);
+ mixedPieces.sort(cmpLenRev);
+ for (i = 0; i < 12; i++) {
+ shortPieces[i] = regexEscape(shortPieces[i]);
+ longPieces[i] = regexEscape(longPieces[i]);
+ mixedPieces[i] = regexEscape(mixedPieces[i]);
+ }
+
+ this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
+ this._monthsShortRegex = this._monthsRegex;
+ this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')$', 'i');
+ this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')$', 'i');
+ }
+
+ function checkOverflow (m) {
+ var overflow;
+ var a = m._a;
+
+ if (a && getParsingFlags(m).overflow === -2) {
+ overflow =
+ a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
+ a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
+ a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
+ a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
+ a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
+ a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
+ -1;
+
+ if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
+ overflow = DATE;
+ }
+ if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
+ overflow = WEEK;
+ }
+ if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
+ overflow = WEEKDAY;
+ }
+
+ getParsingFlags(m).overflow = overflow;
+ }
+
+ return m;
+ }
+
+ // iso 8601 regex
+ // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
+ var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;
+ var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;
+
+ var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
+
+ var isoDates = [
+ ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
+ ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
+ ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
+ ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
+ ['YYYY-DDD', /\d{4}-\d{3}/],
+ ['YYYY-MM', /\d{4}-\d\d/, false],
+ ['YYYYYYMMDD', /[+-]\d{10}/],
+ ['YYYYMMDD', /\d{8}/],
+ // YYYYMM is NOT allowed by the standard
+ ['GGGG[W]WWE', /\d{4}W\d{3}/],
+ ['GGGG[W]WW', /\d{4}W\d{2}/, false],
+ ['YYYYDDD', /\d{7}/]
+ ];
+
+ // iso time formats and regexes
+ var isoTimes = [
+ ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
+ ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
+ ['HH:mm:ss', /\d\d:\d\d:\d\d/],
+ ['HH:mm', /\d\d:\d\d/],
+ ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
+ ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
+ ['HHmmss', /\d\d\d\d\d\d/],
+ ['HHmm', /\d\d\d\d/],
+ ['HH', /\d\d/]
+ ];
+
+ var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
+
+ // date from iso format
+ function configFromISO(config) {
+ var i, l,
+ string = config._i,
+ match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
+ allowTime, dateFormat, timeFormat, tzFormat;
+
+ if (match) {
+ getParsingFlags(config).iso = true;
+
+ for (i = 0, l = isoDates.length; i < l; i++) {
+ if (isoDates[i][1].exec(match[1])) {
+ dateFormat = isoDates[i][0];
+ allowTime = isoDates[i][2] !== false;
+ break;
+ }
+ }
+ if (dateFormat == null) {
+ config._isValid = false;
+ return;
+ }
+ if (match[3]) {
+ for (i = 0, l = isoTimes.length; i < l; i++) {
+ if (isoTimes[i][1].exec(match[3])) {
+ // match[2] should be 'T' or space
+ timeFormat = (match[2] || ' ') + isoTimes[i][0];
+ break;
+ }
+ }
+ if (timeFormat == null) {
+ config._isValid = false;
+ return;
+ }
+ }
+ if (!allowTime && timeFormat != null) {
+ config._isValid = false;
+ return;
+ }
+ if (match[4]) {
+ if (tzRegex.exec(match[4])) {
+ tzFormat = 'Z';
+ } else {
+ config._isValid = false;
+ return;
+ }
+ }
+ config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
+ configFromStringAndFormat(config);
+ } else {
+ config._isValid = false;
+ }
+ }
+
+ // date from iso format or fallback
+ function configFromString(config) {
+ var matched = aspNetJsonRegex.exec(config._i);
+
+ if (matched !== null) {
+ config._d = new Date(+matched[1]);
+ return;
+ }
+
+ configFromISO(config);
+ if (config._isValid === false) {
+ delete config._isValid;
+ utils_hooks__hooks.createFromInputFallback(config);
+ }
+ }
+
+ utils_hooks__hooks.createFromInputFallback = deprecate(
+ 'moment construction falls back to js Date. This is ' +
+ 'discouraged and will be removed in upcoming major ' +
+ 'release. Please refer to ' +
+ 'https://github.com/moment/moment/issues/1407 for more info.',
+ function (config) {
+ config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
+ }
+ );
+
+ function createDate (y, m, d, h, M, s, ms) {
+ //can't just apply() to create a date:
+ //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
+ var date = new Date(y, m, d, h, M, s, ms);
+
+ //the date constructor remaps years 0-99 to 1900-1999
+ if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
+ date.setFullYear(y);
+ }
+ return date;
+ }
+
+ function createUTCDate (y) {
+ var date = new Date(Date.UTC.apply(null, arguments));
+
+ //the Date.UTC function remaps years 0-99 to 1900-1999
+ if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
+ date.setUTCFullYear(y);
+ }
+ return date;
+ }
+
+ // FORMATTING
+
+ addFormatToken('Y', 0, 0, function () {
+ var y = this.year();
+ return y <= 9999 ? '' + y : '+' + y;
+ });
+
+ addFormatToken(0, ['YY', 2], 0, function () {
+ return this.year() % 100;
+ });
+
+ addFormatToken(0, ['YYYY', 4], 0, 'year');
+ addFormatToken(0, ['YYYYY', 5], 0, 'year');
+ addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
+
+ // ALIASES
+
+ addUnitAlias('year', 'y');
+
+ // PARSING
+
+ addRegexToken('Y', matchSigned);
+ addRegexToken('YY', match1to2, match2);
+ addRegexToken('YYYY', match1to4, match4);
+ addRegexToken('YYYYY', match1to6, match6);
+ addRegexToken('YYYYYY', match1to6, match6);
+
+ addParseToken(['YYYYY', 'YYYYYY'], YEAR);
+ addParseToken('YYYY', function (input, array) {
+ array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input);
+ });
+ addParseToken('YY', function (input, array) {
+ array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input);
+ });
+ addParseToken('Y', function (input, array) {
+ array[YEAR] = parseInt(input, 10);
+ });
+
+ // HELPERS
+
+ function daysInYear(year) {
+ return isLeapYear(year) ? 366 : 365;
+ }
+
+ function isLeapYear(year) {
+ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
+ }
+
+ // HOOKS
+
+ utils_hooks__hooks.parseTwoDigitYear = function (input) {
+ return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
+ };
+
+ // MOMENTS
+
+ var getSetYear = makeGetSet('FullYear', false);
+
+ function getIsLeapYear () {
+ return isLeapYear(this.year());
+ }
+
+ // start-of-first-week - start-of-year
+ function firstWeekOffset(year, dow, doy) {
+ var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
+ fwd = 7 + dow - doy,
+ // first-week day local weekday -- which local weekday is fwd
+ fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
+
+ return -fwdlw + fwd - 1;
+ }
+
+ //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
+ function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
+ var localWeekday = (7 + weekday - dow) % 7,
+ weekOffset = firstWeekOffset(year, dow, doy),
+ dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
+ resYear, resDayOfYear;
+
+ if (dayOfYear <= 0) {
+ resYear = year - 1;
+ resDayOfYear = daysInYear(resYear) + dayOfYear;
+ } else if (dayOfYear > daysInYear(year)) {
+ resYear = year + 1;
+ resDayOfYear = dayOfYear - daysInYear(year);
+ } else {
+ resYear = year;
+ resDayOfYear = dayOfYear;
+ }
+
+ return {
+ year: resYear,
+ dayOfYear: resDayOfYear
+ };
+ }
+
+ function weekOfYear(mom, dow, doy) {
+ var weekOffset = firstWeekOffset(mom.year(), dow, doy),
+ week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
+ resWeek, resYear;
+
+ if (week < 1) {
+ resYear = mom.year() - 1;
+ resWeek = week + weeksInYear(resYear, dow, doy);
+ } else if (week > weeksInYear(mom.year(), dow, doy)) {
+ resWeek = week - weeksInYear(mom.year(), dow, doy);
+ resYear = mom.year() + 1;
+ } else {
+ resYear = mom.year();
+ resWeek = week;
+ }
+
+ return {
+ week: resWeek,
+ year: resYear
+ };
+ }
+
+ function weeksInYear(year, dow, doy) {
+ var weekOffset = firstWeekOffset(year, dow, doy),
+ weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
+ return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
+ }
+
+ // Pick the first defined of two or three arguments.
+ function defaults(a, b, c) {
+ if (a != null) {
+ return a;
+ }
+ if (b != null) {
+ return b;
+ }
+ return c;
+ }
+
+ function currentDateArray(config) {
+ // hooks is actually the exported moment object
+ var nowValue = new Date(utils_hooks__hooks.now());
+ if (config._useUTC) {
+ return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
+ }
+ return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
+ }
+
+ // convert an array to a date.
+ // the array should mirror the parameters below
+ // note: all values past the year are optional and will default to the lowest possible value.
+ // [year, month, day , hour, minute, second, millisecond]
+ function configFromArray (config) {
+ var i, date, input = [], currentDate, yearToUse;
+
+ if (config._d) {
+ return;
+ }
+
+ currentDate = currentDateArray(config);
+
+ //compute day of the year from weeks and weekdays
+ if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
+ dayOfYearFromWeekInfo(config);
+ }
+
+ //if the day of the year is set, figure out what it is
+ if (config._dayOfYear) {
+ yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
+
+ if (config._dayOfYear > daysInYear(yearToUse)) {
+ getParsingFlags(config)._overflowDayOfYear = true;
+ }
+
+ date = createUTCDate(yearToUse, 0, config._dayOfYear);
+ config._a[MONTH] = date.getUTCMonth();
+ config._a[DATE] = date.getUTCDate();
+ }
+
+ // Default to current date.
+ // * if no year, month, day of month are given, default to today
+ // * if day of month is given, default month and year
+ // * if month is given, default only year
+ // * if year is given, don't default anything
+ for (i = 0; i < 3 && config._a[i] == null; ++i) {
+ config._a[i] = input[i] = currentDate[i];
+ }
+
+ // Zero out whatever was not defaulted, including time
+ for (; i < 7; i++) {
+ config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
+ }
+
+ // Check for 24:00:00.000
+ if (config._a[HOUR] === 24 &&
+ config._a[MINUTE] === 0 &&
+ config._a[SECOND] === 0 &&
+ config._a[MILLISECOND] === 0) {
+ config._nextDay = true;
+ config._a[HOUR] = 0;
+ }
+
+ config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
+ // Apply timezone offset from input. The actual utcOffset can be changed
+ // with parseZone.
+ if (config._tzm != null) {
+ config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
+ }
+
+ if (config._nextDay) {
+ config._a[HOUR] = 24;
+ }
+ }
+
+ function dayOfYearFromWeekInfo(config) {
+ var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
+
+ w = config._w;
+ if (w.GG != null || w.W != null || w.E != null) {
+ dow = 1;
+ doy = 4;
+
+ // TODO: We need to take the current isoWeekYear, but that depends on
+ // how we interpret now (local, utc, fixed offset). So create
+ // a now version of current config (take local/utc/offset flags, and
+ // create now).
+ weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year);
+ week = defaults(w.W, 1);
+ weekday = defaults(w.E, 1);
+ if (weekday < 1 || weekday > 7) {
+ weekdayOverflow = true;
+ }
+ } else {
+ dow = config._locale._week.dow;
+ doy = config._locale._week.doy;
+
+ weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year);
+ week = defaults(w.w, 1);
+
+ if (w.d != null) {
+ // weekday -- low day numbers are considered next week
+ weekday = w.d;
+ if (weekday < 0 || weekday > 6) {
+ weekdayOverflow = true;
+ }
+ } else if (w.e != null) {
+ // local weekday -- counting starts from begining of week
+ weekday = w.e + dow;
+ if (w.e < 0 || w.e > 6) {
+ weekdayOverflow = true;
+ }
+ } else {
+ // default to begining of week
+ weekday = dow;
+ }
+ }
+ if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
+ getParsingFlags(config)._overflowWeeks = true;
+ } else if (weekdayOverflow != null) {
+ getParsingFlags(config)._overflowWeekday = true;
+ } else {
+ temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
+ config._a[YEAR] = temp.year;
+ config._dayOfYear = temp.dayOfYear;
+ }
+ }
+
+ // constant that refers to the ISO standard
+ utils_hooks__hooks.ISO_8601 = function () {};
+
+ // date from string and format string
+ function configFromStringAndFormat(config) {
+ // TODO: Move this to another part of the creation flow to prevent circular deps
+ if (config._f === utils_hooks__hooks.ISO_8601) {
+ configFromISO(config);
+ return;
+ }
+
+ config._a = [];
+ getParsingFlags(config).empty = true;
+
+ // This array is used to make a Date, either with `new Date` or `Date.UTC`
+ var string = '' + config._i,
+ i, parsedInput, tokens, token, skipped,
+ stringLength = string.length,
+ totalParsedInputLength = 0;
+
+ tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
+
+ for (i = 0; i < tokens.length; i++) {
+ token = tokens[i];
+ parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
+ // console.log('token', token, 'parsedInput', parsedInput,
+ // 'regex', getParseRegexForToken(token, config));
+ if (parsedInput) {
+ skipped = string.substr(0, string.indexOf(parsedInput));
+ if (skipped.length > 0) {
+ getParsingFlags(config).unusedInput.push(skipped);
+ }
+ string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
+ totalParsedInputLength += parsedInput.length;
+ }
+ // don't parse if it's not a known token
+ if (formatTokenFunctions[token]) {
+ if (parsedInput) {
+ getParsingFlags(config).empty = false;
+ }
+ else {
+ getParsingFlags(config).unusedTokens.push(token);
+ }
+ addTimeToArrayFromToken(token, parsedInput, config);
+ }
+ else if (config._strict && !parsedInput) {
+ getParsingFlags(config).unusedTokens.push(token);
+ }
+ }
+
+ // add remaining unparsed input length to the string
+ getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
+ if (string.length > 0) {
+ getParsingFlags(config).unusedInput.push(string);
+ }
+
+ // clear _12h flag if hour is <= 12
+ if (getParsingFlags(config).bigHour === true &&
+ config._a[HOUR] <= 12 &&
+ config._a[HOUR] > 0) {
+ getParsingFlags(config).bigHour = undefined;
+ }
+ // handle meridiem
+ config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
+
+ configFromArray(config);
+ checkOverflow(config);
+ }
+
+
+ function meridiemFixWrap (locale, hour, meridiem) {
+ var isPm;
+
+ if (meridiem == null) {
+ // nothing to do
+ return hour;
+ }
+ if (locale.meridiemHour != null) {
+ return locale.meridiemHour(hour, meridiem);
+ } else if (locale.isPM != null) {
+ // Fallback
+ isPm = locale.isPM(meridiem);
+ if (isPm && hour < 12) {
+ hour += 12;
+ }
+ if (!isPm && hour === 12) {
+ hour = 0;
+ }
+ return hour;
+ } else {
+ // this is not supposed to happen
+ return hour;
+ }
+ }
+
+ // date from string and array of format strings
+ function configFromStringAndArray(config) {
+ var tempConfig,
+ bestMoment,
+
+ scoreToBeat,
+ i,
+ currentScore;
+
+ if (config._f.length === 0) {
+ getParsingFlags(config).invalidFormat = true;
+ config._d = new Date(NaN);
+ return;
+ }
+
+ for (i = 0; i < config._f.length; i++) {
+ currentScore = 0;
+ tempConfig = copyConfig({}, config);
+ if (config._useUTC != null) {
+ tempConfig._useUTC = config._useUTC;
+ }
+ tempConfig._f = config._f[i];
+ configFromStringAndFormat(tempConfig);
+
+ if (!valid__isValid(tempConfig)) {
+ continue;
+ }
+
+ // if there is any input that was not parsed add a penalty for that format
+ currentScore += getParsingFlags(tempConfig).charsLeftOver;
+
+ //or tokens
+ currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
+
+ getParsingFlags(tempConfig).score = currentScore;
+
+ if (scoreToBeat == null || currentScore < scoreToBeat) {
+ scoreToBeat = currentScore;
+ bestMoment = tempConfig;
+ }
+ }
+
+ extend(config, bestMoment || tempConfig);
+ }
+
+ function configFromObject(config) {
+ if (config._d) {
+ return;
+ }
+
+ var i = normalizeObjectUnits(config._i);
+ config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
+ return obj && parseInt(obj, 10);
+ });
+
+ configFromArray(config);
+ }
+
+ function createFromConfig (config) {
+ var res = new Moment(checkOverflow(prepareConfig(config)));
+ if (res._nextDay) {
+ // Adding is smart enough around DST
+ res.add(1, 'd');
+ res._nextDay = undefined;
+ }
+
+ return res;
+ }
+
+ function prepareConfig (config) {
+ var input = config._i,
+ format = config._f;
+
+ config._locale = config._locale || locale_locales__getLocale(config._l);
+
+ if (input === null || (format === undefined && input === '')) {
+ return valid__createInvalid({nullInput: true});
+ }
+
+ if (typeof input === 'string') {
+ config._i = input = config._locale.preparse(input);
+ }
+
+ if (isMoment(input)) {
+ return new Moment(checkOverflow(input));
+ } else if (isArray(format)) {
+ configFromStringAndArray(config);
+ } else if (format) {
+ configFromStringAndFormat(config);
+ } else if (isDate(input)) {
+ config._d = input;
+ } else {
+ configFromInput(config);
+ }
+
+ if (!valid__isValid(config)) {
+ config._d = null;
+ }
+
+ return config;
+ }
+
+ function configFromInput(config) {
+ var input = config._i;
+ if (input === undefined) {
+ config._d = new Date(utils_hooks__hooks.now());
+ } else if (isDate(input)) {
+ config._d = new Date(+input);
+ } else if (typeof input === 'string') {
+ configFromString(config);
+ } else if (isArray(input)) {
+ config._a = map(input.slice(0), function (obj) {
+ return parseInt(obj, 10);
+ });
+ configFromArray(config);
+ } else if (typeof(input) === 'object') {
+ configFromObject(config);
+ } else if (typeof(input) === 'number') {
+ // from milliseconds
+ config._d = new Date(input);
+ } else {
+ utils_hooks__hooks.createFromInputFallback(config);
+ }
+ }
+
+ function createLocalOrUTC (input, format, locale, strict, isUTC) {
+ var c = {};
+
+ if (typeof(locale) === 'boolean') {
+ strict = locale;
+ locale = undefined;
+ }
+ // object construction must be done this way.
+ // https://github.com/moment/moment/issues/1423
+ c._isAMomentObject = true;
+ c._useUTC = c._isUTC = isUTC;
+ c._l = locale;
+ c._i = input;
+ c._f = format;
+ c._strict = strict;
+
+ return createFromConfig(c);
+ }
+
+ function local__createLocal (input, format, locale, strict) {
+ return createLocalOrUTC(input, format, locale, strict, false);
+ }
+
+ var prototypeMin = deprecate(
+ 'moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548',
+ function () {
+ var other = local__createLocal.apply(null, arguments);
+ if (this.isValid() && other.isValid()) {
+ return other < this ? this : other;
+ } else {
+ return valid__createInvalid();
+ }
+ }
+ );
+
+ var prototypeMax = deprecate(
+ 'moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548',
+ function () {
+ var other = local__createLocal.apply(null, arguments);
+ if (this.isValid() && other.isValid()) {
+ return other > this ? this : other;
+ } else {
+ return valid__createInvalid();
+ }
+ }
+ );
+
+ // Pick a moment m from moments so that m[fn](other) is true for all
+ // other. This relies on the function fn to be transitive.
+ //
+ // moments should either be an array of moment objects or an array, whose
+ // first element is an array of moment objects.
+ function pickBy(fn, moments) {
+ var res, i;
+ if (moments.length === 1 && isArray(moments[0])) {
+ moments = moments[0];
+ }
+ if (!moments.length) {
+ return local__createLocal();
+ }
+ res = moments[0];
+ for (i = 1; i < moments.length; ++i) {
+ if (!moments[i].isValid() || moments[i][fn](res)) {
+ res = moments[i];
+ }
+ }
+ return res;
+ }
+
+ // TODO: Use [].sort instead?
+ function min () {
+ var args = [].slice.call(arguments, 0);
+
+ return pickBy('isBefore', args);
+ }
+
+ function max () {
+ var args = [].slice.call(arguments, 0);
+
+ return pickBy('isAfter', args);
+ }
+
+ var now = function () {
+ return Date.now ? Date.now() : +(new Date());
+ };
+
+ function Duration (duration) {
+ var normalizedInput = normalizeObjectUnits(duration),
+ years = normalizedInput.year || 0,
+ quarters = normalizedInput.quarter || 0,
+ months = normalizedInput.month || 0,
+ weeks = normalizedInput.week || 0,
+ days = normalizedInput.day || 0,
+ hours = normalizedInput.hour || 0,
+ minutes = normalizedInput.minute || 0,
+ seconds = normalizedInput.second || 0,
+ milliseconds = normalizedInput.millisecond || 0;
+
+ // representation for dateAddRemove
+ this._milliseconds = +milliseconds +
+ seconds * 1e3 + // 1000
+ minutes * 6e4 + // 1000 * 60
+ hours * 36e5; // 1000 * 60 * 60
+ // Because of dateAddRemove treats 24 hours as different from a
+ // day when working around DST, we need to store them separately
+ this._days = +days +
+ weeks * 7;
+ // It is impossible translate months into days without knowing
+ // which months you are are talking about, so we have to store
+ // it separately.
+ this._months = +months +
+ quarters * 3 +
+ years * 12;
+
+ this._data = {};
+
+ this._locale = locale_locales__getLocale();
+
+ this._bubble();
+ }
+
+ function isDuration (obj) {
+ return obj instanceof Duration;
+ }
+
+ // FORMATTING
+
+ function offset (token, separator) {
+ addFormatToken(token, 0, 0, function () {
+ var offset = this.utcOffset();
+ var sign = '+';
+ if (offset < 0) {
+ offset = -offset;
+ sign = '-';
+ }
+ return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
+ });
+ }
+
+ offset('Z', ':');
+ offset('ZZ', '');
+
+ // PARSING
+
+ addRegexToken('Z', matchShortOffset);
+ addRegexToken('ZZ', matchShortOffset);
+ addParseToken(['Z', 'ZZ'], function (input, array, config) {
+ config._useUTC = true;
+ config._tzm = offsetFromString(matchShortOffset, input);
+ });
+
+ // HELPERS
+
+ // timezone chunker
+ // '+10:00' > ['10', '00']
+ // '-1530' > ['-15', '30']
+ var chunkOffset = /([\+\-]|\d\d)/gi;
+
+ function offsetFromString(matcher, string) {
+ var matches = ((string || '').match(matcher) || []);
+ var chunk = matches[matches.length - 1] || [];
+ var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
+ var minutes = +(parts[1] * 60) + toInt(parts[2]);
+
+ return parts[0] === '+' ? minutes : -minutes;
+ }
+
+ // Return a moment from input, that is local/utc/zone equivalent to model.
+ function cloneWithOffset(input, model) {
+ var res, diff;
+ if (model._isUTC) {
+ res = model.clone();
+ diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);
+ // Use low-level api, because this fn is low-level api.
+ res._d.setTime(+res._d + diff);
+ utils_hooks__hooks.updateOffset(res, false);
+ return res;
+ } else {
+ return local__createLocal(input).local();
+ }
+ }
+
+ function getDateOffset (m) {
+ // On Firefox.24 Date#getTimezoneOffset returns a floating point.
+ // https://github.com/moment/moment/pull/1871
+ return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
+ }
+
+ // HOOKS
+
+ // This function will be called whenever a moment is mutated.
+ // It is intended to keep the offset in sync with the timezone.
+ utils_hooks__hooks.updateOffset = function () {};
+
+ // MOMENTS
+
+ // keepLocalTime = true means only change the timezone, without
+ // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
+ // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
+ // +0200, so we adjust the time as needed, to be valid.
+ //
+ // Keeping the time actually adds/subtracts (one hour)
+ // from the actual represented time. That is why we call updateOffset
+ // a second time. In case it wants us to change the offset again
+ // _changeInProgress == true case, then we have to adjust, because
+ // there is no such time in the given timezone.
+ function getSetOffset (input, keepLocalTime) {
+ var offset = this._offset || 0,
+ localAdjust;
+ if (!this.isValid()) {
+ return input != null ? this : NaN;
+ }
+ if (input != null) {
+ if (typeof input === 'string') {
+ input = offsetFromString(matchShortOffset, input);
+ } else if (Math.abs(input) < 16) {
+ input = input * 60;
+ }
+ if (!this._isUTC && keepLocalTime) {
+ localAdjust = getDateOffset(this);
+ }
+ this._offset = input;
+ this._isUTC = true;
+ if (localAdjust != null) {
+ this.add(localAdjust, 'm');
+ }
+ if (offset !== input) {
+ if (!keepLocalTime || this._changeInProgress) {
+ add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false);
+ } else if (!this._changeInProgress) {
+ this._changeInProgress = true;
+ utils_hooks__hooks.updateOffset(this, true);
+ this._changeInProgress = null;
+ }
+ }
+ return this;
+ } else {
+ return this._isUTC ? offset : getDateOffset(this);
+ }
+ }
+
+ function getSetZone (input, keepLocalTime) {
+ if (input != null) {
+ if (typeof input !== 'string') {
+ input = -input;
+ }
+
+ this.utcOffset(input, keepLocalTime);
+
+ return this;
+ } else {
+ return -this.utcOffset();
+ }
+ }
+
+ function setOffsetToUTC (keepLocalTime) {
+ return this.utcOffset(0, keepLocalTime);
+ }
+
+ function setOffsetToLocal (keepLocalTime) {
+ if (this._isUTC) {
+ this.utcOffset(0, keepLocalTime);
+ this._isUTC = false;
+
+ if (keepLocalTime) {
+ this.subtract(getDateOffset(this), 'm');
+ }
+ }
+ return this;
+ }
+
+ function setOffsetToParsedOffset () {
+ if (this._tzm) {
+ this.utcOffset(this._tzm);
+ } else if (typeof this._i === 'string') {
+ this.utcOffset(offsetFromString(matchOffset, this._i));
+ }
+ return this;
+ }
+
+ function hasAlignedHourOffset (input) {
+ if (!this.isValid()) {
+ return false;
+ }
+ input = input ? local__createLocal(input).utcOffset() : 0;
+
+ return (this.utcOffset() - input) % 60 === 0;
+ }
+
+ function isDaylightSavingTime () {
+ return (
+ this.utcOffset() > this.clone().month(0).utcOffset() ||
+ this.utcOffset() > this.clone().month(5).utcOffset()
+ );
+ }
+
+ function isDaylightSavingTimeShifted () {
+ if (!isUndefined(this._isDSTShifted)) {
+ return this._isDSTShifted;
+ }
+
+ var c = {};
+
+ copyConfig(c, this);
+ c = prepareConfig(c);
+
+ if (c._a) {
+ var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a);
+ this._isDSTShifted = this.isValid() &&
+ compareArrays(c._a, other.toArray()) > 0;
+ } else {
+ this._isDSTShifted = false;
+ }
+
+ return this._isDSTShifted;
+ }
+
+ function isLocal () {
+ return this.isValid() ? !this._isUTC : false;
+ }
+
+ function isUtcOffset () {
+ return this.isValid() ? this._isUTC : false;
+ }
+
+ function isUtc () {
+ return this.isValid() ? this._isUTC && this._offset === 0 : false;
+ }
+
+ // ASP.NET json date format regex
+ var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/;
+
+ // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
+ // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
+ // and further modified to allow for strings containing both week and day
+ var isoRegex = /^(-)?P(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)W)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?$/;
+
+ function create__createDuration (input, key) {
+ var duration = input,
+ // matching against regexp is expensive, do it on demand
+ match = null,
+ sign,
+ ret,
+ diffRes;
+
+ if (isDuration(input)) {
+ duration = {
+ ms : input._milliseconds,
+ d : input._days,
+ M : input._months
+ };
+ } else if (typeof input === 'number') {
+ duration = {};
+ if (key) {
+ duration[key] = input;
+ } else {
+ duration.milliseconds = input;
+ }
+ } else if (!!(match = aspNetRegex.exec(input))) {
+ sign = (match[1] === '-') ? -1 : 1;
+ duration = {
+ y : 0,
+ d : toInt(match[DATE]) * sign,
+ h : toInt(match[HOUR]) * sign,
+ m : toInt(match[MINUTE]) * sign,
+ s : toInt(match[SECOND]) * sign,
+ ms : toInt(match[MILLISECOND]) * sign
+ };
+ } else if (!!(match = isoRegex.exec(input))) {
+ sign = (match[1] === '-') ? -1 : 1;
+ duration = {
+ y : parseIso(match[2], sign),
+ M : parseIso(match[3], sign),
+ w : parseIso(match[4], sign),
+ d : parseIso(match[5], sign),
+ h : parseIso(match[6], sign),
+ m : parseIso(match[7], sign),
+ s : parseIso(match[8], sign)
+ };
+ } else if (duration == null) {// checks for null or undefined
+ duration = {};
+ } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
+ diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to));
+
+ duration = {};
+ duration.ms = diffRes.milliseconds;
+ duration.M = diffRes.months;
+ }
+
+ ret = new Duration(duration);
+
+ if (isDuration(input) && hasOwnProp(input, '_locale')) {
+ ret._locale = input._locale;
+ }
+
+ return ret;
+ }
+
+ create__createDuration.fn = Duration.prototype;
+
+ function parseIso (inp, sign) {
+ // We'd normally use ~~inp for this, but unfortunately it also
+ // converts floats to ints.
+ // inp may be undefined, so careful calling replace on it.
+ var res = inp && parseFloat(inp.replace(',', '.'));
+ // apply sign while we're at it
+ return (isNaN(res) ? 0 : res) * sign;
+ }
+
+ function positiveMomentsDifference(base, other) {
+ var res = {milliseconds: 0, months: 0};
+
+ res.months = other.month() - base.month() +
+ (other.year() - base.year()) * 12;
+ if (base.clone().add(res.months, 'M').isAfter(other)) {
+ --res.months;
+ }
+
+ res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
+
+ return res;
+ }
+
+ function momentsDifference(base, other) {
+ var res;
+ if (!(base.isValid() && other.isValid())) {
+ return {milliseconds: 0, months: 0};
+ }
+
+ other = cloneWithOffset(other, base);
+ if (base.isBefore(other)) {
+ res = positiveMomentsDifference(base, other);
+ } else {
+ res = positiveMomentsDifference(other, base);
+ res.milliseconds = -res.milliseconds;
+ res.months = -res.months;
+ }
+
+ return res;
+ }
+
+ function absRound (number) {
+ if (number < 0) {
+ return Math.round(-1 * number) * -1;
+ } else {
+ return Math.round(number);
+ }
+ }
+
+ // TODO: remove 'name' arg after deprecation is removed
+ function createAdder(direction, name) {
+ return function (val, period) {
+ var dur, tmp;
+ //invert the arguments, but complain about it
+ if (period !== null && !isNaN(+period)) {
+ deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).');
+ tmp = val; val = period; period = tmp;
+ }
+
+ val = typeof val === 'string' ? +val : val;
+ dur = create__createDuration(val, period);
+ add_subtract__addSubtract(this, dur, direction);
+ return this;
+ };
+ }
+
+ function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) {
+ var milliseconds = duration._milliseconds,
+ days = absRound(duration._days),
+ months = absRound(duration._months);
+
+ if (!mom.isValid()) {
+ // No op
+ return;
+ }
+
+ updateOffset = updateOffset == null ? true : updateOffset;
+
+ if (milliseconds) {
+ mom._d.setTime(+mom._d + milliseconds * isAdding);
+ }
+ if (days) {
+ get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding);
+ }
+ if (months) {
+ setMonth(mom, get_set__get(mom, 'Month') + months * isAdding);
+ }
+ if (updateOffset) {
+ utils_hooks__hooks.updateOffset(mom, days || months);
+ }
+ }
+
+ var add_subtract__add = createAdder(1, 'add');
+ var add_subtract__subtract = createAdder(-1, 'subtract');
+
+ function moment_calendar__calendar (time, formats) {
+ // We want to compare the start of today, vs this.
+ // Getting start-of-today depends on whether we're local/utc/offset or not.
+ var now = time || local__createLocal(),
+ sod = cloneWithOffset(now, this).startOf('day'),
+ diff = this.diff(sod, 'days', true),
+ format = diff < -6 ? 'sameElse' :
+ diff < -1 ? 'lastWeek' :
+ diff < 0 ? 'lastDay' :
+ diff < 1 ? 'sameDay' :
+ diff < 2 ? 'nextDay' :
+ diff < 7 ? 'nextWeek' : 'sameElse';
+
+ var output = formats && (isFunction(formats[format]) ? formats[format]() : formats[format]);
+
+ return this.format(output || this.localeData().calendar(format, this, local__createLocal(now)));
+ }
+
+ function clone () {
+ return new Moment(this);
+ }
+
+ function isAfter (input, units) {
+ var localInput = isMoment(input) ? input : local__createLocal(input);
+ if (!(this.isValid() && localInput.isValid())) {
+ return false;
+ }
+ units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
+ if (units === 'millisecond') {
+ return +this > +localInput;
+ } else {
+ return +localInput < +this.clone().startOf(units);
+ }
+ }
+
+ function isBefore (input, units) {
+ var localInput = isMoment(input) ? input : local__createLocal(input);
+ if (!(this.isValid() && localInput.isValid())) {
+ return false;
+ }
+ units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
+ if (units === 'millisecond') {
+ return +this < +localInput;
+ } else {
+ return +this.clone().endOf(units) < +localInput;
+ }
+ }
+
+ function isBetween (from, to, units) {
+ return this.isAfter(from, units) && this.isBefore(to, units);
+ }
+
+ function isSame (input, units) {
+ var localInput = isMoment(input) ? input : local__createLocal(input),
+ inputMs;
+ if (!(this.isValid() && localInput.isValid())) {
+ return false;
+ }
+ units = normalizeUnits(units || 'millisecond');
+ if (units === 'millisecond') {
+ return +this === +localInput;
+ } else {
+ inputMs = +localInput;
+ return +(this.clone().startOf(units)) <= inputMs && inputMs <= +(this.clone().endOf(units));
+ }
+ }
+
+ function isSameOrAfter (input, units) {
+ return this.isSame(input, units) || this.isAfter(input,units);
+ }
+
+ function isSameOrBefore (input, units) {
+ return this.isSame(input, units) || this.isBefore(input,units);
+ }
+
+ function diff (input, units, asFloat) {
+ var that,
+ zoneDelta,
+ delta, output;
+
+ if (!this.isValid()) {
+ return NaN;
+ }
+
+ that = cloneWithOffset(input, this);
+
+ if (!that.isValid()) {
+ return NaN;
+ }
+
+ zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
+
+ units = normalizeUnits(units);
+
+ if (units === 'year' || units === 'month' || units === 'quarter') {
+ output = monthDiff(this, that);
+ if (units === 'quarter') {
+ output = output / 3;
+ } else if (units === 'year') {
+ output = output / 12;
+ }
+ } else {
+ delta = this - that;
+ output = units === 'second' ? delta / 1e3 : // 1000
+ units === 'minute' ? delta / 6e4 : // 1000 * 60
+ units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
+ units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
+ units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
+ delta;
+ }
+ return asFloat ? output : absFloor(output);
+ }
+
+ function monthDiff (a, b) {
+ // difference in months
+ var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
+ // b is in (anchor - 1 month, anchor + 1 month)
+ anchor = a.clone().add(wholeMonthDiff, 'months'),
+ anchor2, adjust;
+
+ if (b - anchor < 0) {
+ anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
+ // linear across the month
+ adjust = (b - anchor) / (anchor - anchor2);
+ } else {
+ anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
+ // linear across the month
+ adjust = (b - anchor) / (anchor2 - anchor);
+ }
+
+ return -(wholeMonthDiff + adjust);
+ }
+
+ utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
+
+ function toString () {
+ return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
+ }
+
+ function moment_format__toISOString () {
+ var m = this.clone().utc();
+ if (0 < m.year() && m.year() <= 9999) {
+ if (isFunction(Date.prototype.toISOString)) {
+ // native implementation is ~50x faster, use it when we can
+ return this.toDate().toISOString();
+ } else {
+ return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
+ }
+ } else {
+ return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
+ }
+ }
+
+ function format (inputString) {
+ var output = formatMoment(this, inputString || utils_hooks__hooks.defaultFormat);
+ return this.localeData().postformat(output);
+ }
+
+ function from (time, withoutSuffix) {
+ if (this.isValid() &&
+ ((isMoment(time) && time.isValid()) ||
+ local__createLocal(time).isValid())) {
+ return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
+ } else {
+ return this.localeData().invalidDate();
+ }
+ }
+
+ function fromNow (withoutSuffix) {
+ return this.from(local__createLocal(), withoutSuffix);
+ }
+
+ function to (time, withoutSuffix) {
+ if (this.isValid() &&
+ ((isMoment(time) && time.isValid()) ||
+ local__createLocal(time).isValid())) {
+ return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
+ } else {
+ return this.localeData().invalidDate();
+ }
+ }
+
+ function toNow (withoutSuffix) {
+ return this.to(local__createLocal(), withoutSuffix);
+ }
+
+ // If passed a locale key, it will set the locale for this
+ // instance. Otherwise, it will return the locale configuration
+ // variables for this instance.
+ function locale (key) {
+ var newLocaleData;
+
+ if (key === undefined) {
+ return this._locale._abbr;
+ } else {
+ newLocaleData = locale_locales__getLocale(key);
+ if (newLocaleData != null) {
+ this._locale = newLocaleData;
+ }
+ return this;
+ }
+ }
+
+ var lang = deprecate(
+ 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
+ function (key) {
+ if (key === undefined) {
+ return this.localeData();
+ } else {
+ return this.locale(key);
+ }
+ }
+ );
+
+ function localeData () {
+ return this._locale;
+ }
+
+ function startOf (units) {
+ units = normalizeUnits(units);
+ // the following switch intentionally omits break keywords
+ // to utilize falling through the cases.
+ switch (units) {
+ case 'year':
+ this.month(0);
+ /* falls through */
+ case 'quarter':
+ case 'month':
+ this.date(1);
+ /* falls through */
+ case 'week':
+ case 'isoWeek':
+ case 'day':
+ this.hours(0);
+ /* falls through */
+ case 'hour':
+ this.minutes(0);
+ /* falls through */
+ case 'minute':
+ this.seconds(0);
+ /* falls through */
+ case 'second':
+ this.milliseconds(0);
+ }
+
+ // weeks are a special case
+ if (units === 'week') {
+ this.weekday(0);
+ }
+ if (units === 'isoWeek') {
+ this.isoWeekday(1);
+ }
+
+ // quarters are also special
+ if (units === 'quarter') {
+ this.month(Math.floor(this.month() / 3) * 3);
+ }
+
+ return this;
+ }
+
+ function endOf (units) {
+ units = normalizeUnits(units);
+ if (units === undefined || units === 'millisecond') {
+ return this;
+ }
+ return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
+ }
+
+ function to_type__valueOf () {
+ return +this._d - ((this._offset || 0) * 60000);
+ }
+
+ function unix () {
+ return Math.floor(+this / 1000);
+ }
+
+ function toDate () {
+ return this._offset ? new Date(+this) : this._d;
+ }
+
+ function toArray () {
+ var m = this;
+ return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
+ }
+
+ function toObject () {
+ var m = this;
+ return {
+ years: m.year(),
+ months: m.month(),
+ date: m.date(),
+ hours: m.hours(),
+ minutes: m.minutes(),
+ seconds: m.seconds(),
+ milliseconds: m.milliseconds()
+ };
+ }
+
+ function toJSON () {
+ // new Date(NaN).toJSON() === null
+ return this.isValid() ? this.toISOString() : null;
+ }
+
+ function moment_valid__isValid () {
+ return valid__isValid(this);
+ }
+
+ function parsingFlags () {
+ return extend({}, getParsingFlags(this));
+ }
+
+ function invalidAt () {
+ return getParsingFlags(this).overflow;
+ }
+
+ function creationData() {
+ return {
+ input: this._i,
+ format: this._f,
+ locale: this._locale,
+ isUTC: this._isUTC,
+ strict: this._strict
+ };
+ }
+
+ // FORMATTING
+
+ addFormatToken(0, ['gg', 2], 0, function () {
+ return this.weekYear() % 100;
+ });
+
+ addFormatToken(0, ['GG', 2], 0, function () {
+ return this.isoWeekYear() % 100;
+ });
+
+ function addWeekYearFormatToken (token, getter) {
+ addFormatToken(0, [token, token.length], 0, getter);
+ }
+
+ addWeekYearFormatToken('gggg', 'weekYear');
+ addWeekYearFormatToken('ggggg', 'weekYear');
+ addWeekYearFormatToken('GGGG', 'isoWeekYear');
+ addWeekYearFormatToken('GGGGG', 'isoWeekYear');
+
+ // ALIASES
+
+ addUnitAlias('weekYear', 'gg');
+ addUnitAlias('isoWeekYear', 'GG');
+
+ // PARSING
+
+ addRegexToken('G', matchSigned);
+ addRegexToken('g', matchSigned);
+ addRegexToken('GG', match1to2, match2);
+ addRegexToken('gg', match1to2, match2);
+ addRegexToken('GGGG', match1to4, match4);
+ addRegexToken('gggg', match1to4, match4);
+ addRegexToken('GGGGG', match1to6, match6);
+ addRegexToken('ggggg', match1to6, match6);
+
+ addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
+ week[token.substr(0, 2)] = toInt(input);
+ });
+
+ addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
+ week[token] = utils_hooks__hooks.parseTwoDigitYear(input);
+ });
+
+ // MOMENTS
+
+ function getSetWeekYear (input) {
+ return getSetWeekYearHelper.call(this,
+ input,
+ this.week(),
+ this.weekday(),
+ this.localeData()._week.dow,
+ this.localeData()._week.doy);
+ }
+
+ function getSetISOWeekYear (input) {
+ return getSetWeekYearHelper.call(this,
+ input, this.isoWeek(), this.isoWeekday(), 1, 4);
+ }
+
+ function getISOWeeksInYear () {
+ return weeksInYear(this.year(), 1, 4);
+ }
+
+ function getWeeksInYear () {
+ var weekInfo = this.localeData()._week;
+ return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
+ }
+
+ function getSetWeekYearHelper(input, week, weekday, dow, doy) {
+ var weeksTarget;
+ if (input == null) {
+ return weekOfYear(this, dow, doy).year;
+ } else {
+ weeksTarget = weeksInYear(input, dow, doy);
+ if (week > weeksTarget) {
+ week = weeksTarget;
+ }
+ return setWeekAll.call(this, input, week, weekday, dow, doy);
+ }
+ }
+
+ function setWeekAll(weekYear, week, weekday, dow, doy) {
+ var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
+ date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
+
+ this.year(date.getUTCFullYear());
+ this.month(date.getUTCMonth());
+ this.date(date.getUTCDate());
+ return this;
+ }
+
+ // FORMATTING
+
+ addFormatToken('Q', 0, 'Qo', 'quarter');
+
+ // ALIASES
+
+ addUnitAlias('quarter', 'Q');
+
+ // PARSING
+
+ addRegexToken('Q', match1);
+ addParseToken('Q', function (input, array) {
+ array[MONTH] = (toInt(input) - 1) * 3;
+ });
+
+ // MOMENTS
+
+ function getSetQuarter (input) {
+ return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
+ }
+
+ // FORMATTING
+
+ addFormatToken('w', ['ww', 2], 'wo', 'week');
+ addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
+
+ // ALIASES
+
+ addUnitAlias('week', 'w');
+ addUnitAlias('isoWeek', 'W');
+
+ // PARSING
+
+ addRegexToken('w', match1to2);
+ addRegexToken('ww', match1to2, match2);
+ addRegexToken('W', match1to2);
+ addRegexToken('WW', match1to2, match2);
+
+ addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
+ week[token.substr(0, 1)] = toInt(input);
+ });
+
+ // HELPERS
+
+ // LOCALES
+
+ function localeWeek (mom) {
+ return weekOfYear(mom, this._week.dow, this._week.doy).week;
+ }
+
+ var defaultLocaleWeek = {
+ dow : 0, // Sunday is the first day of the week.
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
+ };
+
+ function localeFirstDayOfWeek () {
+ return this._week.dow;
+ }
+
+ function localeFirstDayOfYear () {
+ return this._week.doy;
+ }
+
+ // MOMENTS
+
+ function getSetWeek (input) {
+ var week = this.localeData().week(this);
+ return input == null ? week : this.add((input - week) * 7, 'd');
+ }
+
+ function getSetISOWeek (input) {
+ var week = weekOfYear(this, 1, 4).week;
+ return input == null ? week : this.add((input - week) * 7, 'd');
+ }
+
+ // FORMATTING
+
+ addFormatToken('D', ['DD', 2], 'Do', 'date');
+
+ // ALIASES
+
+ addUnitAlias('date', 'D');
+
+ // PARSING
+
+ addRegexToken('D', match1to2);
+ addRegexToken('DD', match1to2, match2);
+ addRegexToken('Do', function (isStrict, locale) {
+ return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
+ });
+
+ addParseToken(['D', 'DD'], DATE);
+ addParseToken('Do', function (input, array) {
+ array[DATE] = toInt(input.match(match1to2)[0], 10);
+ });
+
+ // MOMENTS
+
+ var getSetDayOfMonth = makeGetSet('Date', true);
+
+ // FORMATTING
+
+ addFormatToken('d', 0, 'do', 'day');
+
+ addFormatToken('dd', 0, 0, function (format) {
+ return this.localeData().weekdaysMin(this, format);
+ });
+
+ addFormatToken('ddd', 0, 0, function (format) {
+ return this.localeData().weekdaysShort(this, format);
+ });
+
+ addFormatToken('dddd', 0, 0, function (format) {
+ return this.localeData().weekdays(this, format);
+ });
+
+ addFormatToken('e', 0, 0, 'weekday');
+ addFormatToken('E', 0, 0, 'isoWeekday');
+
+ // ALIASES
+
+ addUnitAlias('day', 'd');
+ addUnitAlias('weekday', 'e');
+ addUnitAlias('isoWeekday', 'E');
+
+ // PARSING
+
+ addRegexToken('d', match1to2);
+ addRegexToken('e', match1to2);
+ addRegexToken('E', match1to2);
+ addRegexToken('dd', matchWord);
+ addRegexToken('ddd', matchWord);
+ addRegexToken('dddd', matchWord);
+
+ addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
+ var weekday = config._locale.weekdaysParse(input, token, config._strict);
+ // if we didn't get a weekday name, mark the date as invalid
+ if (weekday != null) {
+ week.d = weekday;
+ } else {
+ getParsingFlags(config).invalidWeekday = input;
+ }
+ });
+
+ addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
+ week[token] = toInt(input);
+ });
+
+ // HELPERS
+
+ function parseWeekday(input, locale) {
+ if (typeof input !== 'string') {
+ return input;
+ }
+
+ if (!isNaN(input)) {
+ return parseInt(input, 10);
+ }
+
+ input = locale.weekdaysParse(input);
+ if (typeof input === 'number') {
+ return input;
+ }
+
+ return null;
+ }
+
+ // LOCALES
+
+ var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
+ function localeWeekdays (m, format) {
+ return isArray(this._weekdays) ? this._weekdays[m.day()] :
+ this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
+ }
+
+ var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
+ function localeWeekdaysShort (m) {
+ return this._weekdaysShort[m.day()];
+ }
+
+ var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
+ function localeWeekdaysMin (m) {
+ return this._weekdaysMin[m.day()];
+ }
+
+ function localeWeekdaysParse (weekdayName, format, strict) {
+ var i, mom, regex;
+
+ if (!this._weekdaysParse) {
+ this._weekdaysParse = [];
+ this._minWeekdaysParse = [];
+ this._shortWeekdaysParse = [];
+ this._fullWeekdaysParse = [];
+ }
+
+ for (i = 0; i < 7; i++) {
+ // make the regex if we don't have it already
+
+ mom = local__createLocal([2000, 1]).day(i);
+ if (strict && !this._fullWeekdaysParse[i]) {
+ this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
+ this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
+ this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
+ }
+ if (!this._weekdaysParse[i]) {
+ regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
+ this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
+ }
+ // test the regex
+ if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
+ return i;
+ } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
+ return i;
+ } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
+ return i;
+ } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
+ return i;
+ }
+ }
+ }
+
+ // MOMENTS
+
+ function getSetDayOfWeek (input) {
+ if (!this.isValid()) {
+ return input != null ? this : NaN;
+ }
+ var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
+ if (input != null) {
+ input = parseWeekday(input, this.localeData());
+ return this.add(input - day, 'd');
+ } else {
+ return day;
+ }
+ }
+
+ function getSetLocaleDayOfWeek (input) {
+ if (!this.isValid()) {
+ return input != null ? this : NaN;
+ }
+ var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
+ return input == null ? weekday : this.add(input - weekday, 'd');
+ }
+
+ function getSetISODayOfWeek (input) {
+ if (!this.isValid()) {
+ return input != null ? this : NaN;
+ }
+ // behaves the same as moment#day except
+ // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
+ // as a setter, sunday should belong to the previous week.
+ return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
+ }
+
+ // FORMATTING
+
+ addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
+
+ // ALIASES
+
+ addUnitAlias('dayOfYear', 'DDD');
+
+ // PARSING
+
+ addRegexToken('DDD', match1to3);
+ addRegexToken('DDDD', match3);
+ addParseToken(['DDD', 'DDDD'], function (input, array, config) {
+ config._dayOfYear = toInt(input);
+ });
+
+ // HELPERS
+
+ // MOMENTS
+
+ function getSetDayOfYear (input) {
+ var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
+ return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
+ }
+
+ // FORMATTING
+
+ function hFormat() {
+ return this.hours() % 12 || 12;
+ }
+
+ addFormatToken('H', ['HH', 2], 0, 'hour');
+ addFormatToken('h', ['hh', 2], 0, hFormat);
+
+ addFormatToken('hmm', 0, 0, function () {
+ return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
+ });
+
+ addFormatToken('hmmss', 0, 0, function () {
+ return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
+ zeroFill(this.seconds(), 2);
+ });
+
+ addFormatToken('Hmm', 0, 0, function () {
+ return '' + this.hours() + zeroFill(this.minutes(), 2);
+ });
+
+ addFormatToken('Hmmss', 0, 0, function () {
+ return '' + this.hours() + zeroFill(this.minutes(), 2) +
+ zeroFill(this.seconds(), 2);
+ });
+
+ function meridiem (token, lowercase) {
+ addFormatToken(token, 0, 0, function () {
+ return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
+ });
+ }
+
+ meridiem('a', true);
+ meridiem('A', false);
+
+ // ALIASES
+
+ addUnitAlias('hour', 'h');
+
+ // PARSING
+
+ function matchMeridiem (isStrict, locale) {
+ return locale._meridiemParse;
+ }
+
+ addRegexToken('a', matchMeridiem);
+ addRegexToken('A', matchMeridiem);
+ addRegexToken('H', match1to2);
+ addRegexToken('h', match1to2);
+ addRegexToken('HH', match1to2, match2);
+ addRegexToken('hh', match1to2, match2);
+
+ addRegexToken('hmm', match3to4);
+ addRegexToken('hmmss', match5to6);
+ addRegexToken('Hmm', match3to4);
+ addRegexToken('Hmmss', match5to6);
+
+ addParseToken(['H', 'HH'], HOUR);
+ addParseToken(['a', 'A'], function (input, array, config) {
+ config._isPm = config._locale.isPM(input);
+ config._meridiem = input;
+ });
+ addParseToken(['h', 'hh'], function (input, array, config) {
+ array[HOUR] = toInt(input);
+ getParsingFlags(config).bigHour = true;
+ });
+ addParseToken('hmm', function (input, array, config) {
+ var pos = input.length - 2;
+ array[HOUR] = toInt(input.substr(0, pos));
+ array[MINUTE] = toInt(input.substr(pos));
+ getParsingFlags(config).bigHour = true;
+ });
+ addParseToken('hmmss', function (input, array, config) {
+ var pos1 = input.length - 4;
+ var pos2 = input.length - 2;
+ array[HOUR] = toInt(input.substr(0, pos1));
+ array[MINUTE] = toInt(input.substr(pos1, 2));
+ array[SECOND] = toInt(input.substr(pos2));
+ getParsingFlags(config).bigHour = true;
+ });
+ addParseToken('Hmm', function (input, array, config) {
+ var pos = input.length - 2;
+ array[HOUR] = toInt(input.substr(0, pos));
+ array[MINUTE] = toInt(input.substr(pos));
+ });
+ addParseToken('Hmmss', function (input, array, config) {
+ var pos1 = input.length - 4;
+ var pos2 = input.length - 2;
+ array[HOUR] = toInt(input.substr(0, pos1));
+ array[MINUTE] = toInt(input.substr(pos1, 2));
+ array[SECOND] = toInt(input.substr(pos2));
+ });
+
+ // LOCALES
+
+ function localeIsPM (input) {
+ // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
+ // Using charAt should be more compatible.
+ return ((input + '').toLowerCase().charAt(0) === 'p');
+ }
+
+ var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
+ function localeMeridiem (hours, minutes, isLower) {
+ if (hours > 11) {
+ return isLower ? 'pm' : 'PM';
+ } else {
+ return isLower ? 'am' : 'AM';
+ }
+ }
+
+
+ // MOMENTS
+
+ // Setting the hour should keep the time, because the user explicitly
+ // specified which hour he wants. So trying to maintain the same hour (in
+ // a new timezone) makes sense. Adding/subtracting hours does not follow
+ // this rule.
+ var getSetHour = makeGetSet('Hours', true);
+
+ // FORMATTING
+
+ addFormatToken('m', ['mm', 2], 0, 'minute');
+
+ // ALIASES
+
+ addUnitAlias('minute', 'm');
+
+ // PARSING
+
+ addRegexToken('m', match1to2);
+ addRegexToken('mm', match1to2, match2);
+ addParseToken(['m', 'mm'], MINUTE);
+
+ // MOMENTS
+
+ var getSetMinute = makeGetSet('Minutes', false);
+
+ // FORMATTING
+
+ addFormatToken('s', ['ss', 2], 0, 'second');
+
+ // ALIASES
+
+ addUnitAlias('second', 's');
+
+ // PARSING
+
+ addRegexToken('s', match1to2);
+ addRegexToken('ss', match1to2, match2);
+ addParseToken(['s', 'ss'], SECOND);
+
+ // MOMENTS
+
+ var getSetSecond = makeGetSet('Seconds', false);
+
+ // FORMATTING
+
+ addFormatToken('S', 0, 0, function () {
+ return ~~(this.millisecond() / 100);
+ });
+
+ addFormatToken(0, ['SS', 2], 0, function () {
+ return ~~(this.millisecond() / 10);
+ });
+
+ addFormatToken(0, ['SSS', 3], 0, 'millisecond');
+ addFormatToken(0, ['SSSS', 4], 0, function () {
+ return this.millisecond() * 10;
+ });
+ addFormatToken(0, ['SSSSS', 5], 0, function () {
+ return this.millisecond() * 100;
+ });
+ addFormatToken(0, ['SSSSSS', 6], 0, function () {
+ return this.millisecond() * 1000;
+ });
+ addFormatToken(0, ['SSSSSSS', 7], 0, function () {
+ return this.millisecond() * 10000;
+ });
+ addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
+ return this.millisecond() * 100000;
+ });
+ addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
+ return this.millisecond() * 1000000;
+ });
+
+
+ // ALIASES
+
+ addUnitAlias('millisecond', 'ms');
+
+ // PARSING
+
+ addRegexToken('S', match1to3, match1);
+ addRegexToken('SS', match1to3, match2);
+ addRegexToken('SSS', match1to3, match3);
+
+ var token;
+ for (token = 'SSSS'; token.length <= 9; token += 'S') {
+ addRegexToken(token, matchUnsigned);
+ }
+
+ function parseMs(input, array) {
+ array[MILLISECOND] = toInt(('0.' + input) * 1000);
+ }
+
+ for (token = 'S'; token.length <= 9; token += 'S') {
+ addParseToken(token, parseMs);
+ }
+ // MOMENTS
+
+ var getSetMillisecond = makeGetSet('Milliseconds', false);
+
+ // FORMATTING
+
+ addFormatToken('z', 0, 0, 'zoneAbbr');
+ addFormatToken('zz', 0, 0, 'zoneName');
+
+ // MOMENTS
+
+ function getZoneAbbr () {
+ return this._isUTC ? 'UTC' : '';
+ }
+
+ function getZoneName () {
+ return this._isUTC ? 'Coordinated Universal Time' : '';
+ }
+
+ var momentPrototype__proto = Moment.prototype;
+
+ momentPrototype__proto.add = add_subtract__add;
+ momentPrototype__proto.calendar = moment_calendar__calendar;
+ momentPrototype__proto.clone = clone;
+ momentPrototype__proto.diff = diff;
+ momentPrototype__proto.endOf = endOf;
+ momentPrototype__proto.format = format;
+ momentPrototype__proto.from = from;
+ momentPrototype__proto.fromNow = fromNow;
+ momentPrototype__proto.to = to;
+ momentPrototype__proto.toNow = toNow;
+ momentPrototype__proto.get = getSet;
+ momentPrototype__proto.invalidAt = invalidAt;
+ momentPrototype__proto.isAfter = isAfter;
+ momentPrototype__proto.isBefore = isBefore;
+ momentPrototype__proto.isBetween = isBetween;
+ momentPrototype__proto.isSame = isSame;
+ momentPrototype__proto.isSameOrAfter = isSameOrAfter;
+ momentPrototype__proto.isSameOrBefore = isSameOrBefore;
+ momentPrototype__proto.isValid = moment_valid__isValid;
+ momentPrototype__proto.lang = lang;
+ momentPrototype__proto.locale = locale;
+ momentPrototype__proto.localeData = localeData;
+ momentPrototype__proto.max = prototypeMax;
+ momentPrototype__proto.min = prototypeMin;
+ momentPrototype__proto.parsingFlags = parsingFlags;
+ momentPrototype__proto.set = getSet;
+ momentPrototype__proto.startOf = startOf;
+ momentPrototype__proto.subtract = add_subtract__subtract;
+ momentPrototype__proto.toArray = toArray;
+ momentPrototype__proto.toObject = toObject;
+ momentPrototype__proto.toDate = toDate;
+ momentPrototype__proto.toISOString = moment_format__toISOString;
+ momentPrototype__proto.toJSON = toJSON;
+ momentPrototype__proto.toString = toString;
+ momentPrototype__proto.unix = unix;
+ momentPrototype__proto.valueOf = to_type__valueOf;
+ momentPrototype__proto.creationData = creationData;
+
+ // Year
+ momentPrototype__proto.year = getSetYear;
+ momentPrototype__proto.isLeapYear = getIsLeapYear;
+
+ // Week Year
+ momentPrototype__proto.weekYear = getSetWeekYear;
+ momentPrototype__proto.isoWeekYear = getSetISOWeekYear;
+
+ // Quarter
+ momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter;
+
+ // Month
+ momentPrototype__proto.month = getSetMonth;
+ momentPrototype__proto.daysInMonth = getDaysInMonth;
+
+ // Week
+ momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek;
+ momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek;
+ momentPrototype__proto.weeksInYear = getWeeksInYear;
+ momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear;
+
+ // Day
+ momentPrototype__proto.date = getSetDayOfMonth;
+ momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek;
+ momentPrototype__proto.weekday = getSetLocaleDayOfWeek;
+ momentPrototype__proto.isoWeekday = getSetISODayOfWeek;
+ momentPrototype__proto.dayOfYear = getSetDayOfYear;
+
+ // Hour
+ momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour;
+
+ // Minute
+ momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute;
+
+ // Second
+ momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond;
+
+ // Millisecond
+ momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond;
+
+ // Offset
+ momentPrototype__proto.utcOffset = getSetOffset;
+ momentPrototype__proto.utc = setOffsetToUTC;
+ momentPrototype__proto.local = setOffsetToLocal;
+ momentPrototype__proto.parseZone = setOffsetToParsedOffset;
+ momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset;
+ momentPrototype__proto.isDST = isDaylightSavingTime;
+ momentPrototype__proto.isDSTShifted = isDaylightSavingTimeShifted;
+ momentPrototype__proto.isLocal = isLocal;
+ momentPrototype__proto.isUtcOffset = isUtcOffset;
+ momentPrototype__proto.isUtc = isUtc;
+ momentPrototype__proto.isUTC = isUtc;
+
+ // Timezone
+ momentPrototype__proto.zoneAbbr = getZoneAbbr;
+ momentPrototype__proto.zoneName = getZoneName;
+
+ // Deprecations
+ momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
+ momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
+ momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
+ momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone);
+
+ var momentPrototype = momentPrototype__proto;
+
+ function moment__createUnix (input) {
+ return local__createLocal(input * 1000);
+ }
+
+ function moment__createInZone () {
+ return local__createLocal.apply(null, arguments).parseZone();
+ }
+
+ var defaultCalendar = {
+ sameDay : '[Today at] LT',
+ nextDay : '[Tomorrow at] LT',
+ nextWeek : 'dddd [at] LT',
+ lastDay : '[Yesterday at] LT',
+ lastWeek : '[Last] dddd [at] LT',
+ sameElse : 'L'
+ };
+
+ function locale_calendar__calendar (key, mom, now) {
+ var output = this._calendar[key];
+ return isFunction(output) ? output.call(mom, now) : output;
+ }
+
+ var defaultLongDateFormat = {
+ LTS : 'h:mm:ss A',
+ LT : 'h:mm A',
+ L : 'MM/DD/YYYY',
+ LL : 'MMMM D, YYYY',
+ LLL : 'MMMM D, YYYY h:mm A',
+ LLLL : 'dddd, MMMM D, YYYY h:mm A'
+ };
+
+ function longDateFormat (key) {
+ var format = this._longDateFormat[key],
+ formatUpper = this._longDateFormat[key.toUpperCase()];
+
+ if (format || !formatUpper) {
+ return format;
+ }
+
+ this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
+ return val.slice(1);
+ });
+
+ return this._longDateFormat[key];
+ }
+
+ var defaultInvalidDate = 'Invalid date';
+
+ function invalidDate () {
+ return this._invalidDate;
+ }
+
+ var defaultOrdinal = '%d';
+ var defaultOrdinalParse = /\d{1,2}/;
+
+ function ordinal (number) {
+ return this._ordinal.replace('%d', number);
+ }
+
+ function preParsePostFormat (string) {
+ return string;
+ }
+
+ var defaultRelativeTime = {
+ future : 'in %s',
+ past : '%s ago',
+ s : 'a few seconds',
+ m : 'a minute',
+ mm : '%d minutes',
+ h : 'an hour',
+ hh : '%d hours',
+ d : 'a day',
+ dd : '%d days',
+ M : 'a month',
+ MM : '%d months',
+ y : 'a year',
+ yy : '%d years'
+ };
+
+ function relative__relativeTime (number, withoutSuffix, string, isFuture) {
+ var output = this._relativeTime[string];
+ return (isFunction(output)) ?
+ output(number, withoutSuffix, string, isFuture) :
+ output.replace(/%d/i, number);
+ }
+
+ function pastFuture (diff, output) {
+ var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
+ return isFunction(format) ? format(output) : format.replace(/%s/i, output);
+ }
+
+ var prototype__proto = Locale.prototype;
+
+ prototype__proto._calendar = defaultCalendar;
+ prototype__proto.calendar = locale_calendar__calendar;
+ prototype__proto._longDateFormat = defaultLongDateFormat;
+ prototype__proto.longDateFormat = longDateFormat;
+ prototype__proto._invalidDate = defaultInvalidDate;
+ prototype__proto.invalidDate = invalidDate;
+ prototype__proto._ordinal = defaultOrdinal;
+ prototype__proto.ordinal = ordinal;
+ prototype__proto._ordinalParse = defaultOrdinalParse;
+ prototype__proto.preparse = preParsePostFormat;
+ prototype__proto.postformat = preParsePostFormat;
+ prototype__proto._relativeTime = defaultRelativeTime;
+ prototype__proto.relativeTime = relative__relativeTime;
+ prototype__proto.pastFuture = pastFuture;
+ prototype__proto.set = locale_set__set;
+
+ // Month
+ prototype__proto.months = localeMonths;
+ prototype__proto._months = defaultLocaleMonths;
+ prototype__proto.monthsShort = localeMonthsShort;
+ prototype__proto._monthsShort = defaultLocaleMonthsShort;
+ prototype__proto.monthsParse = localeMonthsParse;
+ prototype__proto._monthsRegex = defaultMonthsRegex;
+ prototype__proto.monthsRegex = monthsRegex;
+ prototype__proto._monthsShortRegex = defaultMonthsShortRegex;
+ prototype__proto.monthsShortRegex = monthsShortRegex;
+
+ // Week
+ prototype__proto.week = localeWeek;
+ prototype__proto._week = defaultLocaleWeek;
+ prototype__proto.firstDayOfYear = localeFirstDayOfYear;
+ prototype__proto.firstDayOfWeek = localeFirstDayOfWeek;
+
+ // Day of Week
+ prototype__proto.weekdays = localeWeekdays;
+ prototype__proto._weekdays = defaultLocaleWeekdays;
+ prototype__proto.weekdaysMin = localeWeekdaysMin;
+ prototype__proto._weekdaysMin = defaultLocaleWeekdaysMin;
+ prototype__proto.weekdaysShort = localeWeekdaysShort;
+ prototype__proto._weekdaysShort = defaultLocaleWeekdaysShort;
+ prototype__proto.weekdaysParse = localeWeekdaysParse;
+
+ // Hours
+ prototype__proto.isPM = localeIsPM;
+ prototype__proto._meridiemParse = defaultLocaleMeridiemParse;
+ prototype__proto.meridiem = localeMeridiem;
+
+ function lists__get (format, index, field, setter) {
+ var locale = locale_locales__getLocale();
+ var utc = create_utc__createUTC().set(setter, index);
+ return locale[field](utc, format);
+ }
+
+ function list (format, index, field, count, setter) {
+ if (typeof format === 'number') {
+ index = format;
+ format = undefined;
+ }
+
+ format = format || '';
+
+ if (index != null) {
+ return lists__get(format, index, field, setter);
+ }
+
+ var i;
+ var out = [];
+ for (i = 0; i < count; i++) {
+ out[i] = lists__get(format, i, field, setter);
+ }
+ return out;
+ }
+
+ function lists__listMonths (format, index) {
+ return list(format, index, 'months', 12, 'month');
+ }
+
+ function lists__listMonthsShort (format, index) {
+ return list(format, index, 'monthsShort', 12, 'month');
+ }
+
+ function lists__listWeekdays (format, index) {
+ return list(format, index, 'weekdays', 7, 'day');
+ }
+
+ function lists__listWeekdaysShort (format, index) {
+ return list(format, index, 'weekdaysShort', 7, 'day');
+ }
+
+ function lists__listWeekdaysMin (format, index) {
+ return list(format, index, 'weekdaysMin', 7, 'day');
+ }
+
+ locale_locales__getSetGlobalLocale('en', {
+ ordinalParse: /\d{1,2}(th|st|nd|rd)/,
+ ordinal : function (number) {
+ var b = number % 10,
+ output = (toInt(number % 100 / 10) === 1) ? 'th' :
+ (b === 1) ? 'st' :
+ (b === 2) ? 'nd' :
+ (b === 3) ? 'rd' : 'th';
+ return number + output;
+ }
+ });
+
+ // Side effect imports
+ utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale);
+ utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale);
+
+ var mathAbs = Math.abs;
+
+ function duration_abs__abs () {
+ var data = this._data;
+
+ this._milliseconds = mathAbs(this._milliseconds);
+ this._days = mathAbs(this._days);
+ this._months = mathAbs(this._months);
+
+ data.milliseconds = mathAbs(data.milliseconds);
+ data.seconds = mathAbs(data.seconds);
+ data.minutes = mathAbs(data.minutes);
+ data.hours = mathAbs(data.hours);
+ data.months = mathAbs(data.months);
+ data.years = mathAbs(data.years);
+
+ return this;
+ }
+
+ function duration_add_subtract__addSubtract (duration, input, value, direction) {
+ var other = create__createDuration(input, value);
+
+ duration._milliseconds += direction * other._milliseconds;
+ duration._days += direction * other._days;
+ duration._months += direction * other._months;
+
+ return duration._bubble();
+ }
+
+ // supports only 2.0-style add(1, 's') or add(duration)
+ function duration_add_subtract__add (input, value) {
+ return duration_add_subtract__addSubtract(this, input, value, 1);
+ }
+
+ // supports only 2.0-style subtract(1, 's') or subtract(duration)
+ function duration_add_subtract__subtract (input, value) {
+ return duration_add_subtract__addSubtract(this, input, value, -1);
+ }
+
+ function absCeil (number) {
+ if (number < 0) {
+ return Math.floor(number);
+ } else {
+ return Math.ceil(number);
+ }
+ }
+
+ function bubble () {
+ var milliseconds = this._milliseconds;
+ var days = this._days;
+ var months = this._months;
+ var data = this._data;
+ var seconds, minutes, hours, years, monthsFromDays;
+
+ // if we have a mix of positive and negative values, bubble down first
+ // check: https://github.com/moment/moment/issues/2166
+ if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
+ (milliseconds <= 0 && days <= 0 && months <= 0))) {
+ milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
+ days = 0;
+ months = 0;
+ }
+
+ // The following code bubbles up values, see the tests for
+ // examples of what that means.
+ data.milliseconds = milliseconds % 1000;
+
+ seconds = absFloor(milliseconds / 1000);
+ data.seconds = seconds % 60;
+
+ minutes = absFloor(seconds / 60);
+ data.minutes = minutes % 60;
+
+ hours = absFloor(minutes / 60);
+ data.hours = hours % 24;
+
+ days += absFloor(hours / 24);
+
+ // convert days to months
+ monthsFromDays = absFloor(daysToMonths(days));
+ months += monthsFromDays;
+ days -= absCeil(monthsToDays(monthsFromDays));
+
+ // 12 months -> 1 year
+ years = absFloor(months / 12);
+ months %= 12;
+
+ data.days = days;
+ data.months = months;
+ data.years = years;
+
+ return this;
+ }
+
+ function daysToMonths (days) {
+ // 400 years have 146097 days (taking into account leap year rules)
+ // 400 years have 12 months === 4800
+ return days * 4800 / 146097;
+ }
+
+ function monthsToDays (months) {
+ // the reverse of daysToMonths
+ return months * 146097 / 4800;
+ }
+
+ function as (units) {
+ var days;
+ var months;
+ var milliseconds = this._milliseconds;
+
+ units = normalizeUnits(units);
+
+ if (units === 'month' || units === 'year') {
+ days = this._days + milliseconds / 864e5;
+ months = this._months + daysToMonths(days);
+ return units === 'month' ? months : months / 12;
+ } else {
+ // handle milliseconds separately because of floating point math errors (issue #1867)
+ days = this._days + Math.round(monthsToDays(this._months));
+ switch (units) {
+ case 'week' : return days / 7 + milliseconds / 6048e5;
+ case 'day' : return days + milliseconds / 864e5;
+ case 'hour' : return days * 24 + milliseconds / 36e5;
+ case 'minute' : return days * 1440 + milliseconds / 6e4;
+ case 'second' : return days * 86400 + milliseconds / 1000;
+ // Math.floor prevents floating point math errors here
+ case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
+ default: throw new Error('Unknown unit ' + units);
+ }
+ }
+ }
+
+ // TODO: Use this.as('ms')?
+ function duration_as__valueOf () {
+ return (
+ this._milliseconds +
+ this._days * 864e5 +
+ (this._months % 12) * 2592e6 +
+ toInt(this._months / 12) * 31536e6
+ );
+ }
+
+ function makeAs (alias) {
+ return function () {
+ return this.as(alias);
+ };
+ }
+
+ var asMilliseconds = makeAs('ms');
+ var asSeconds = makeAs('s');
+ var asMinutes = makeAs('m');
+ var asHours = makeAs('h');
+ var asDays = makeAs('d');
+ var asWeeks = makeAs('w');
+ var asMonths = makeAs('M');
+ var asYears = makeAs('y');
+
+ function duration_get__get (units) {
+ units = normalizeUnits(units);
+ return this[units + 's']();
+ }
+
+ function makeGetter(name) {
+ return function () {
+ return this._data[name];
+ };
+ }
+
+ var milliseconds = makeGetter('milliseconds');
+ var seconds = makeGetter('seconds');
+ var minutes = makeGetter('minutes');
+ var hours = makeGetter('hours');
+ var days = makeGetter('days');
+ var months = makeGetter('months');
+ var years = makeGetter('years');
+
+ function weeks () {
+ return absFloor(this.days() / 7);
+ }
+
+ var round = Math.round;
+ var thresholds = {
+ s: 45, // seconds to minute
+ m: 45, // minutes to hour
+ h: 22, // hours to day
+ d: 26, // days to month
+ M: 11 // months to year
+ };
+
+ // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
+ function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
+ return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
+ }
+
+ function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) {
+ var duration = create__createDuration(posNegDuration).abs();
+ var seconds = round(duration.as('s'));
+ var minutes = round(duration.as('m'));
+ var hours = round(duration.as('h'));
+ var days = round(duration.as('d'));
+ var months = round(duration.as('M'));
+ var years = round(duration.as('y'));
+
+ var a = seconds < thresholds.s && ['s', seconds] ||
+ minutes <= 1 && ['m'] ||
+ minutes < thresholds.m && ['mm', minutes] ||
+ hours <= 1 && ['h'] ||
+ hours < thresholds.h && ['hh', hours] ||
+ days <= 1 && ['d'] ||
+ days < thresholds.d && ['dd', days] ||
+ months <= 1 && ['M'] ||
+ months < thresholds.M && ['MM', months] ||
+ years <= 1 && ['y'] || ['yy', years];
+
+ a[2] = withoutSuffix;
+ a[3] = +posNegDuration > 0;
+ a[4] = locale;
+ return substituteTimeAgo.apply(null, a);
+ }
+
+ // This function allows you to set a threshold for relative time strings
+ function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) {
+ if (thresholds[threshold] === undefined) {
+ return false;
+ }
+ if (limit === undefined) {
+ return thresholds[threshold];
+ }
+ thresholds[threshold] = limit;
+ return true;
+ }
+
+ function humanize (withSuffix) {
+ var locale = this.localeData();
+ var output = duration_humanize__relativeTime(this, !withSuffix, locale);
+
+ if (withSuffix) {
+ output = locale.pastFuture(+this, output);
+ }
+
+ return locale.postformat(output);
+ }
+
+ var iso_string__abs = Math.abs;
+
+ function iso_string__toISOString() {
+ // for ISO strings we do not use the normal bubbling rules:
+ // * milliseconds bubble up until they become hours
+ // * days do not bubble at all
+ // * months bubble up until they become years
+ // This is because there is no context-free conversion between hours and days
+ // (think of clock changes)
+ // and also not between days and months (28-31 days per month)
+ var seconds = iso_string__abs(this._milliseconds) / 1000;
+ var days = iso_string__abs(this._days);
+ var months = iso_string__abs(this._months);
+ var minutes, hours, years;
+
+ // 3600 seconds -> 60 minutes -> 1 hour
+ minutes = absFloor(seconds / 60);
+ hours = absFloor(minutes / 60);
+ seconds %= 60;
+ minutes %= 60;
+
+ // 12 months -> 1 year
+ years = absFloor(months / 12);
+ months %= 12;
+
+
+ // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
+ var Y = years;
+ var M = months;
+ var D = days;
+ var h = hours;
+ var m = minutes;
+ var s = seconds;
+ var total = this.asSeconds();
+
+ if (!total) {
+ // this is the same as C#'s (Noda) and python (isodate)...
+ // but not other JS (goog.date)
+ return 'P0D';
+ }
+
+ return (total < 0 ? '-' : '') +
+ 'P' +
+ (Y ? Y + 'Y' : '') +
+ (M ? M + 'M' : '') +
+ (D ? D + 'D' : '') +
+ ((h || m || s) ? 'T' : '') +
+ (h ? h + 'H' : '') +
+ (m ? m + 'M' : '') +
+ (s ? s + 'S' : '');
+ }
+
+ var duration_prototype__proto = Duration.prototype;
+
+ duration_prototype__proto.abs = duration_abs__abs;
+ duration_prototype__proto.add = duration_add_subtract__add;
+ duration_prototype__proto.subtract = duration_add_subtract__subtract;
+ duration_prototype__proto.as = as;
+ duration_prototype__proto.asMilliseconds = asMilliseconds;
+ duration_prototype__proto.asSeconds = asSeconds;
+ duration_prototype__proto.asMinutes = asMinutes;
+ duration_prototype__proto.asHours = asHours;
+ duration_prototype__proto.asDays = asDays;
+ duration_prototype__proto.asWeeks = asWeeks;
+ duration_prototype__proto.asMonths = asMonths;
+ duration_prototype__proto.asYears = asYears;
+ duration_prototype__proto.valueOf = duration_as__valueOf;
+ duration_prototype__proto._bubble = bubble;
+ duration_prototype__proto.get = duration_get__get;
+ duration_prototype__proto.milliseconds = milliseconds;
+ duration_prototype__proto.seconds = seconds;
+ duration_prototype__proto.minutes = minutes;
+ duration_prototype__proto.hours = hours;
+ duration_prototype__proto.days = days;
+ duration_prototype__proto.weeks = weeks;
+ duration_prototype__proto.months = months;
+ duration_prototype__proto.years = years;
+ duration_prototype__proto.humanize = humanize;
+ duration_prototype__proto.toISOString = iso_string__toISOString;
+ duration_prototype__proto.toString = iso_string__toISOString;
+ duration_prototype__proto.toJSON = iso_string__toISOString;
+ duration_prototype__proto.locale = locale;
+ duration_prototype__proto.localeData = localeData;
+
+ // Deprecations
+ duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString);
+ duration_prototype__proto.lang = lang;
+
+ // Side effect imports
+
+ // FORMATTING
+
+ addFormatToken('X', 0, 0, 'unix');
+ addFormatToken('x', 0, 0, 'valueOf');
+
+ // PARSING
+
+ addRegexToken('x', matchSigned);
+ addRegexToken('X', matchTimestamp);
+ addParseToken('X', function (input, array, config) {
+ config._d = new Date(parseFloat(input, 10) * 1000);
+ });
+ addParseToken('x', function (input, array, config) {
+ config._d = new Date(toInt(input));
+ });
+
+ // Side effect imports
+
+
+ utils_hooks__hooks.version = '2.12.0';
+
+ setHookCallback(local__createLocal);
+
+ utils_hooks__hooks.fn = momentPrototype;
+ utils_hooks__hooks.min = min;
+ utils_hooks__hooks.max = max;
+ utils_hooks__hooks.now = now;
+ utils_hooks__hooks.utc = create_utc__createUTC;
+ utils_hooks__hooks.unix = moment__createUnix;
+ utils_hooks__hooks.months = lists__listMonths;
+ utils_hooks__hooks.isDate = isDate;
+ utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale;
+ utils_hooks__hooks.invalid = valid__createInvalid;
+ utils_hooks__hooks.duration = create__createDuration;
+ utils_hooks__hooks.isMoment = isMoment;
+ utils_hooks__hooks.weekdays = lists__listWeekdays;
+ utils_hooks__hooks.parseZone = moment__createInZone;
+ utils_hooks__hooks.localeData = locale_locales__getLocale;
+ utils_hooks__hooks.isDuration = isDuration;
+ utils_hooks__hooks.monthsShort = lists__listMonthsShort;
+ utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin;
+ utils_hooks__hooks.defineLocale = defineLocale;
+ utils_hooks__hooks.updateLocale = updateLocale;
+ utils_hooks__hooks.locales = locale_locales__listLocales;
+ utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort;
+ utils_hooks__hooks.normalizeUnits = normalizeUnits;
+ utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold;
+ utils_hooks__hooks.prototype = momentPrototype;
+
+ var _moment = utils_hooks__hooks;
+
+ return _moment;
+
+})); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/multiselect.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/multiselect.js
new file mode 100644
index 00000000..eda8da08
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/multiselect.js
@@ -0,0 +1,62 @@
+'use strict';
+
+angular.module('quantum').directive('dropdownMultiselect', ['$document', function($document){
+ return {
+ restrict: 'E',
+ scope:{
+ model: '=ngModel',
+ options: '='
+ },
+ template: "<div class='btn-group ng-isolate-scope buttons-dropdown--small' data-ng-class='{open: open}'>"+
+ "<a class='button btn buttons-dropdown__split button--secondary' data-ng-click='open=!open;' style='border-right:none;'>Multi-Select</a>"+
+ "<a class='button buttons-dropdown__drop dropdown-toggle button--secondary' data-ng-click='open=!open;' style='border-left:none;color:#067ab4'></a>"+
+ "<ul class='dropdown-menu' aria-labelledby='dropdownMenu'>" +
+ "<li><a data-ng-click='selectAll()'><i class='icon-included-checkmark'></i> Check All</a></li>" +
+ "<li><a data-ng-click='deselectAll();'><i class='icon-erase'></i> Uncheck All</a></li>" +
+ "<li class='divider'></li>" +
+ "<li data-ng-repeat='option in options'> <a data-ng-click='setSelectedItem()'>{{option.title}}<span data-ng-class='isChecked(option.value)'></span></a></li>" +
+ "</ul>" +
+ "</div>" ,
+ link: function($scope,element,attr){
+
+ $scope.$watch("options",function(newValue,oldValue) {
+ $scope.model = [];
+ });
+
+ $scope.selectAll = function () {
+ $scope.model = _.pluck($scope.options, 'value');
+ };
+ $scope.deselectAll = function() {
+ $scope.model=[];
+ };
+ $scope.setSelectedItem = function(){
+ var value = this.option.value;
+ if (_.contains($scope.model, value)) {
+ $scope.model = _.without($scope.model, value);
+ } else {
+ $scope.model.push(value);
+ }
+ return false;
+ };
+ $scope.isChecked = function (value) {
+ if (_.contains($scope.model, value)) {
+ return 'icon-included-checkmark pull-right';
+ }
+ return false;
+ };
+
+ $document.bind('click', function(event){
+ var isClickedElementChildOfPopup = element
+ .find(event.target)
+ .length > 0;
+
+ if (isClickedElementChildOfPopup)
+ return;
+
+ $scope.open = false;
+ $scope.$apply();
+ });
+
+ }
+ };
+}]); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/quick_links.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/quick_links.js
new file mode 100644
index 00000000..81e8276e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/quick_links.js
@@ -0,0 +1,33 @@
+'use strict';
+angular.module('quantum').directive('quickLinks', ['$http','$window', function($http,$window){
+ return {
+ restrict: 'E',
+ scope:{
+ ngModel: '='
+ },
+ template: "<div att-links-list class='att-accordion'>" +
+ "<a ng-repeat='quickLink in quickLinks' class='att-accordion__group' att-links-list-item href='' ng-click='openLink(quickLink.reportURL)'>{{quickLink.reportName}}<span ng-show='quickLink.showDescr'> - {{quickLink.reportDescr}}</span></a>" +
+ "<a ng-repeat='quickLink in ngModel' class='att-accordion__group' att-links-list-item href='' ng-click='openLink(quickLink.reportURL)'>{{quickLink.reportName}}<span ng-show='quickLink.showDescr'> - {{quickLink.reportDescr}}</span></a>" +
+ "</div>",
+ link: function($scope,element,attr){
+ $scope.ngDisplayType=attr.ngDisplayType;
+ $scope.popUpWindowSize = "top=" + ((screen.height*.2)/2) + ",left=" + ((screen.width*.05)/2) + ",width="+(screen.width-(screen.width*.06))+",height="+(screen.height-(screen.height*.25));
+
+ $scope.openLink = function(url){
+ if($scope.ngDisplayType){
+ if($scope.ngDisplayType=='1'){
+ $window.open(url,'_self');
+ }else if($scope.ngDisplayType=='2'){
+ $window.open(url, '_blank');
+ }else if($scope.ngDisplayType=='3'){
+ $window.open(url, '', $scope.popUpWindowSize);
+ }
+ }
+ };
+
+ $http.get('raptor.htm?action=quicklinks.json&quick_links_menu_id='+attr.ngMenuId).then(function(result){
+ $scope.quickLinks=result.data;
+ });
+ }
+ };
+}]); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.html
new file mode 100644
index 00000000..35fad2b4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.html
@@ -0,0 +1,313 @@
+<div style="color:#2ca02c" ng-show="successSubmit">Your configurations have been successfully submitted</div>
+
+<div style="min-height:500px" data-ng-init="init()">
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Chart Type</label><BR>
+ <div class="form-field" att-select="chartTypes" ng-model="reportRunJson.chartTypeJSON" placeholder="Select an Option" show-input-filter="true" ng-change="actionClicked()"></div>
+ </div>
+
+
+ <div class="fn-ebz-container" style="position:relative; top: -8px;">
+ <label class="fn-ebz-text-label">Animate</label><BR>
+ <div><input type="checkbox" ng-model="reportRunJson.animation" att-checkbox data-ng-value="true"></div>
+ </div>
+ <BR>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Width (Px)</label><BR>
+ <input type="text" name="chartWidth" maxlength=4 only-digits ng-model="reportRunJson.width" style="width:80px"/>
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Height (Px)</label><BR>
+ <input type="text" name="chartHeight" maxlength=4 only-digits ng-model="reportRunJson.height" style="width:80px"/>
+ </div>
+ <BR>
+
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Title</label><BR>
+ <span><input name="tle" type="radio" ng-model="reportRunJson.showTitle" data-ng-value="true"/>Show</span>
+ <span><input name="tle" type="radio" ng-model="reportRunJson.showTitle" data-ng-value="false"/>Hide</span>
+ </div>
+ <BR>
+
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Domain Axis</label><BR>
+ <div class="form-field" att-select="reportRunJson.chartColumnJSONList" ng-model="reportRunJson.domainAxisJSON" placeholder="Select an Option" show-input-filter="true"></div>
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Category</label><BR>
+ <div class="form-field" att-select="reportRunJson.chartColumnJSONList" ng-model="reportRunJson.categoryAxisJSON" placeholder="Select an Option" show-input-filter="true"></div>
+ </div>
+ <BR>
+
+<div style="border:2px;border-style:solid;border-color:#808080;margin-bottom:9px">
+<div ng-repeat="rangeReport in reportRunJson.rangeAxisList">
+ <div style="margin-left:5px">
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Range Axis</label><BR>
+ <div class="form-field" att-select="reportRunJson.chartColumnJSONList"
+ ng-model="rangeReport.rangeAxisLabelJSON" placeholder="Select an Option" show-input-filter="true"></div>
+ </div>
+
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Y Axis</label><BR>
+ <input id="yaxs" type="text" name="yAxis" maxlength=50 ng-model=rangeReport.rangeYAxis style="width:100px"/>
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Chart Title</label><BR>
+ <input type="text" name="chartTitle" maxlength=50 ng-model="rangeReport.rangeChartGroup" style="width:200px"/>
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Color</label><BR>
+ <div class="form-field" att-select="rangeColors" ng-model="rangeReport.rangeColorJSON" placeholder="Select an Option" show-input-filter="true"></div>
+ </div>
+
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Line Type</label><BR>
+ <div class="form-field" att-select="lineTypes" ng-model="rangeReport.rangeLineTypeJSON" placeholder="Select an Option" show-input-filter="true"></div>
+ </div>
+
+ <div class="fn-ebz-container" ng-show="reportRunJson.chartTypeJSON.value=='FlexTimeChart' ||
+ reportRunJson.chartTypeJSON.value=='AnnotationChart'" style="position:relative; top: -8px;">
+ <label class="fn-ebz-text-label">Area</label><BR>
+ <input type="checkbox" ng-model="rangeReport.showAsArea" att-checkbox data-ng-value="true">
+ </div>
+
+ <div class="fn-ebz-container" style="position:relative; top: 25px;">
+ <a href="javascript:void(0)" ng-show="{{$index==0}}" style="float: right;" att-button btn-type="secondary" size="small" att-accessibility-click="13,32"
+ ng-click="addRangeAxisRow(rangeReport);" >Add</a>
+ <a href="javascript:void(0)" ng-show="{{$index>0}}" style="float: right;" att-button btn-type="secondary" size="small" att-accessibility-click="13,32" ng-click="removeRangeAxisRow($index);" >
+ Remove</a>
+ </div>
+ </div>
+ </div>
+ </div>
+ <BR>
+
+<accordion close-others="true" css="att-accordion--no-box">
+ <accordion-group id="additionalOptions" heading="Additional Options" child-length="10">
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Primary Axis Label</label><BR>
+ <input type="text" name="prAxis" maxlength=50 ng-model="reportRunJson.primaryAxisLabel" style="width:210px"/>
+ </div>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Secondary Axis Label</label><BR>
+ <input type="text" name="secAxis" maxlength=75 ng-model="reportRunJson.secondaryAxisLabel" style="width:210px"/>
+ </div>
+ <BR>
+ <div class="fn-ebz-container" >
+ <label class="fn-ebz-text-label">Range Axis Minimum Range</label><BR>
+ <input type="text" name="rAxisMinRange" only-digits ng-model="reportRunJson.minRange" style="width:210px"/>
+ </div>
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Maximum Range</label><BR>
+ <input type="text" name="rAxisMaxRange" only-digits ng-model="reportRunJson.maxRange" ng-maxLength="35" style="width:210px"/>
+ </div><BR>
+ </accordion-group>
+</accordion>
+
+
+
+
+<div ng-show="reportRunJson.chartTypeJSON.value=='BarChart3D'">
+
+ <accordion close-others="true" css="att-accordion--no-box">
+ <accordion-group id="accBar" heading="Bar Chart Options" child-length="10">
+
+
+ <div style="border:2px;border-style:solid;border-color:#808080;margin-bottom:9px">
+ <div class="fn-ebz-container" style="position:relative;margin:10px;" >
+ <label class="fn-ebz-text-label">Orientation</label><BR>
+ <span><input name="orient" type="radio" ng-model="reportRunJson.barChartOptions.verticalOrientation" data-ng-value="true"/>Vertical</span>
+ <span><input name="orient" type="radio" ng-model="reportRunJson.barChartOptions.verticalOrientation" data-ng-value="false"/>Horizontal</span>
+ </div>
+
+ <div class="fn-ebz-container" style="position:relative;margin:10px;">
+ <label class="fn-ebz-text-label">Stacked</label><BR>
+ <span><input name="stack" type="radio" ng-model="reportRunJson.barChartOptions.stackedChart" data-ng-value="true"/>Yes</span>
+ <span><input name="stack" type="radio" ng-model="reportRunJson.barChartOptions.stackedChart" data-ng-value="false"/>No</span>
+ </div>
+
+ <div class="fn-ebz-container" style="position:relative;margin:10px;">
+ <label class="fn-ebz-text-label">Show Controls</label><BR>
+ <span><input name="shwcontrol" type="radio" ng-model="reportRunJson.barChartOptions.displayBarControls" data-ng-value="true"/>Yes</span>
+ <span><input name="shwcontrol" type="radio" ng-model="reportRunJson.barChartOptions.displayBarControls" data-ng-value="false"/>No</span>
+ </div>
+
+ <div class="fn-ebz-container" style="position:relative;margin:10px;">
+ <label class="fn-ebz-text-label">XAxis Date Type</label><BR>
+ <span><input name="xAxisDtype" type="radio" ng-model="reportRunJson.barChartOptions.xAxisDateType" data-ng-value="true"/>Yes</span>
+ <span><input name="xAxisDtype" type="radio" ng-model="reportRunJson.barChartOptions.xAxisDateType" data-ng-value="false"/>No</span>
+ </div>
+
+ <div class="fn-ebz-container" style="position:relative;margin:10px;">
+ <label class="fn-ebz-text-label">Display less XAxis tickers</label><BR>
+ <span><input name="xTicker" type="radio" ng-model="reportRunJson.barChartOptions.minimizeXAxisTickers" data-ng-value="true"/>Yes</span>
+ <span><input name="xTicker" type="radio" ng-model="reportRunJson.barChartOptions.minimizeXAxisTickers" data-ng-value="false"/>No</span>
+ </div><BR>
+
+ <div class="fn-ebz-container" style="position:relative;margin:10px;">
+ <label class="fn-ebz-text-label">Is Time Axis?</label><BR>
+ <span><input name="timeAxis" type="radio" ng-model="reportRunJson.barChartOptions.timeAxis" data-ng-value="true"/>Yes</span>
+ <span><input name="timeAxis" type="radio" ng-model="reportRunJson.barChartOptions.timeAxis" data-ng-value="false"/>No</span>
+ </div>
+
+ <div class="fn-ebz-container" style="position:relative;margin:10px;">
+ <label class="fn-ebz-text-label">Log Scale (Y Axis)</label><BR>
+ <span><input type="checkbox" ng-model="reportRunJson.barChartOptions.yAxisLogScale" att-checkbox data-ng-value="true"></span>
+
+ </div>
+ </div>
+
+ </accordion-group>
+</accordion>
+</div>
+
+ <div ng-show="reportRunJson.chartTypeJSON.value=='TimeSeriesChart'">
+ <!-- <div class="fn-ebz-text-label"><b>Time Series Chart Options</b></div><BR> -->
+ <accordion close-others="true" css="att-accordion--no-box">
+ <accordion-group id="accTimeChart" heading="Time Series Chart Options" child-length="10">
+
+ <div style="border:2px;border-style:solid;border-color:#808080;margin-bottom:9px">
+ <div style="margin-left:5px">
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Render as</label><BR>
+ <span><input name="renderAs" type="radio" ng-model="reportRunJson.timeSeriesChartOptions.lineChartRenderer" value="line"/>Line</span>
+ <span><input name="orient" type="radio" ng-model="reportRunJson.timeSeriesChartOptions.lineChartRenderer" value="area"/>Area</span>
+ </div>
+
+ <div class="fn-ebz-container" style="position:relative;margin:10px;">
+ <label class="fn-ebz-text-label">X Axis Label</label><BR>
+ <span><input type="checkbox" ng-model="reportRunJson.timeSeriesChartOptions.showXAxisLabel" att-checkbox data-ng-value="true"></span>
+ </div><BR>
+
+ <div class="fn-ebz-container" style="position:relative;bottom:10px;">
+ <label class="fn-ebz-text-label">X Axis <br>Tickers</label><BR>
+ <span style="position:relative;top:10px;"><input type="checkbox" ng-model="reportRunJson.timeSeriesChartOptions.addXAxisTicker" att-checkbox data-ng-value="true"></span>
+ </div>
+
+ <div class="fn-ebz-container" style="position:relative;margin:20px;">
+ <label class="fn-ebz-text-label">Is Time Axis?</label><BR>
+ <span><input name="timeAxisChart" type="radio" ng-model="reportRunJson.timeSeriesChartOptions.nonTimeAxis" data-ng-value="true"/>Yes</span>
+ <span><input name="timeAxisChart" type="radio" ng-model="reportRunJson.timeSeriesChartOptions.nonTimeAxis" data-ng-value="false"/>No</span>
+ </div>
+
+ <div class="fn-ebz-container" style="position:relative;margin:10px;">
+ <label class="fn-ebz-text-label">Multi Series?</label><BR>
+ <span><input name="mSeries" type="radio" ng-model="reportRunJson.timeSeriesChartOptions.multiSeries" data-ng-value="true"/>Yes</span>
+ <span><input name="mSeries" type="radio" ng-model="reportRunJson.timeSeriesChartOptions.multiSeries" data-ng-value="false"/>No</span>
+ </div>
+ </div>
+ </div>
+
+ </accordion-group>
+ </accordion>
+
+ </div>
+
+ <div ng-show="reportRunJson.chartTypeJSON.value=='FlexTimeChart'">
+
+
+ <accordion close-others="true" css="att-accordion--no-box">
+ <accordion-group id="accFlexTimeChart" heading="Flex Time Series Chart Options" child-length="10">
+
+ <!-- <div class="fn-ebz-text-label"><b>Flex Time Series Chart Options</b></div><BR> -->
+ <div style="border:2px;border-style:solid;border-color:#808080;margin-bottom:9px">
+ <div style="margin-left:5px">
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Zoom-In Window</label><BR>
+ <span><input type="text" name="zWindow" only-digits maxlength=3 ng-model="reportRunJson.flexTimeSeriesChartOptions.zoomIn"></span>
+ </div>
+
+ <div class="fn-ebz-container" style="position:relative;margin:10px;">
+ <label class="fn-ebz-text-label">Time Axis Type</label><BR>
+ <span><input name="timeAxisType" type="radio" ng-model="reportRunJson.flexTimeSeriesChartOptions.timeAxisType" value="weekly"/>Weekly</span>
+ <span><input name="timeAxisType" type="radio" ng-model="reportRunJson.flexTimeSeriesChartOptions.timeAxisType" value="daily"/>Daily</span>
+ <span><input name="timeAxisType" type="radio" ng-model="reportRunJson.flexTimeSeriesChartOptions.timeAxisType" value="hourly"/>Hourly</span>
+ <span><input name="timeAxisType" type="radio" ng-model="reportRunJson.flexTimeSeriesChartOptions.timeAxisType" value="30min"/>30 Min</span>
+ </div>
+ </div>
+ </div>
+ </accordion-group>
+ </accordion>
+
+ </div>
+
+
+
+
+
+
+
+ <!-- <div class="fn-ebz-text-label"><b>Common Options</b></div><BR> -->
+
+ <accordion close-others="true" css="att-accordion--no-box">
+ <accordion-group id="accCommonOptions" heading="Common Options" child-length="10">
+
+ <div style="border:2px;border-style:solid;border-color:#808080;margin-bottom:9px">
+ <div style="margin-left:5px">
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Legend Angle</label><BR>
+ <span><input name="langle" type="radio" ng-model="reportRunJson.commonChartOptions.legendLabelAngle" value="up45"/>up 45&deg;</span>
+ <span><input name="langle" type="radio" ng-model="reportRunJson.commonChartOptions.legendLabelAngle" value="up90"/>up 90&deg;</span>
+ <span><input name="langle" type="radio" ng-model="reportRunJson.commonChartOptions.legendLabelAngle" value="down45"/>down 45&deg;</span>
+ <span><input name="langle" type="radio" ng-model="reportRunJson.commonChartOptions.legendLabelAngle" value="down90"/>down 90&deg;</span>
+ <span><input name="langle" type="radio" ng-model="reportRunJson.commonChartOptions.legendLabelAngle" value="standard"/>Standard</span>
+ </div>
+
+ <div class="fn-ebz-container" style="position:relative;margin:15px;">
+ <label class="fn-ebz-text-label">Legend Position</label><BR>
+ <span><input name="lgPosition" type="radio" ng-model="reportRunJson.commonChartOptions.legendPosition" value="top"/>Top</span>
+ <span><input name="lgPosition" type="radio" ng-model="reportRunJson.commonChartOptions.legendPosition" value="bottom"/>Bottom</span>
+ </div><BR>
+
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Legend</label><BR>
+ <span><input name="lgd" type="radio" ng-model="reportRunJson.commonChartOptions.hideLegend" data-ng-value="false"/>Yes</span>
+ <span><input name="lgd" type="radio" ng-model="reportRunJson.commonChartOptions.hideLegend" data-ng-value="true"/>No</span>
+ </div>
+
+ <div class="fn-ebz-container" style="position:relative;margin:10px;">
+ <label class="fn-ebz-text-label">Animation</label><BR>
+ <span><input name="anmtate" type="radio" ng-model="reportRunJson.commonChartOptions.animateAnimatedChart" data-ng-value="true" />Yes</span>
+ <span><input name="anmtate" type="radio" ng-model="reportRunJson.commonChartOptions.animateAnimatedChart" data-ng-value="false"/>No</span>
+ </div><BR>
+
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Top Margin</label><BR>
+ <input type="text" name="reportRunJson.commonChartOptions.topMargin" only-digits maxlength=3 ng-model="reportRunJson.commonChartOptions.topMargin" style="width:210px"/>
+ </div>
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Bottom Margin</label><BR>
+ <input type="text" name="reportRunJson.commonChartOptions.bottomMargin" only-digits maxlength=3 ng-model="reportRunJson.commonChartOptions.bottomMargin" style="width:210px"/>
+ </div>
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Left Margin</label><BR>
+ <input type="text" name="reportRunJson.commonChartOptions.leftMargin" only-digits maxlength=3 ng-model="reportRunJson.commonChartOptions.leftMargin" style="width:210px"/>
+ </div>
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Right Margin</label><BR>
+ <input type="text" name="reportRunJson.commonChartOptions.rightMargin" only-digits maxlength=3 ng-model="reportRunJson.commonChartOptions.rightMargin" style="width:210px">
+ </div><BR>
+ </div>
+ </div>
+ </accordion-group>
+</accordion>
+ <br/><br/>
+ <a href="javascript:void(0)" att-button btn-type="primary" att-accessibility-click="13,32" ng-click="saveChartData();">Save</a>
+ <a href="report#/report_run/c_master={{reportRunJson.reportID}}&refresh=Y" att-button btn-type="primary" att-accessibility-click="13,32">Run</a>
+
+
+
+
+
+</div>
+
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.js
new file mode 100644
index 00000000..7fc167c1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.js
@@ -0,0 +1,671 @@
+app.controller('ChartController', function ($scope, $rootScope, $timeout, $window, $http, $routeParams,modalService) {
+ //$scope.test="1223";
+ //alert($scope.chartType.value);
+
+ $scope.populateChrtWzdFields = function() {
+
+ $scope.reportRunJson = {};
+ // console.log($routeParams.reportId);
+ $http.get("raptor.htm?action=chart.json&c_master="+$routeParams.reportId).then(function (response) {
+ //$scope.myData = JSON.stringify(response.data);
+ // response.data.rangeAxisList[0].rangeColorJSON = {};
+ $scope.reportRunJson = response.data;
+ // $scope.chrtheight = $scope.reportRunJson.height;
+ // console.log(JSON.stringify($scope.reportRunJson));
+ /* if ($scope.reportRunJson.showTitle==false)
+ $scope.reportRunJson.showTitle="false";
+ else
+ $scope.reportRunJson.showTitle="true"; */
+
+ console.log($scope.reportRunJson);
+
+
+
+
+
+ //Set chart type
+ if ($scope.reportRunJson.chartTypeJSON) {
+ var chrtTypeValue = $scope.reportRunJson.chartTypeJSON.value;
+ for(var i = 0; i < $scope.chartTypes.length; i++) {
+ var obj = $scope.chartTypes[i];
+ //console.log(obj.id);
+ if ($scope.chartTypes[i].value==chrtTypeValue) {
+ $scope.reportRunJson.chartTypeJSON.index=$scope.chartTypes[i].index;
+ $scope.reportRunJson.chartTypeJSON.title=$scope.chartTypes[i].title;
+ }
+
+ }
+ }
+
+ //Set Domain Axis
+ if ($scope.reportRunJson.domainAxisJSON) {
+ var domaninAxisValue = $scope.reportRunJson.domainAxisJSON.value;
+ for(var i = 0; i < $scope.reportRunJson.chartColumnJSONList.length; i++) {
+ if ($scope.reportRunJson.chartColumnJSONList[i].value==domaninAxisValue) {
+ $scope.reportRunJson.domainAxisJSON.index=$scope.reportRunJson.chartColumnJSONList[i].index;
+ $scope.reportRunJson.domainAxisJSON.title=$scope.reportRunJson.chartColumnJSONList[i].title;
+ }
+
+ }
+ }
+
+ //Set Category
+ if ($scope.reportRunJson.categoryAxisJSON) {
+ var categoryAxisValue = $scope.reportRunJson.categoryAxisJSON.value;
+ for(var i = 0; i < $scope.reportRunJson.chartColumnJSONList.length; i++) {
+ if ($scope.reportRunJson.chartColumnJSONList[i].value==categoryAxisValue) {
+ $scope.reportRunJson.categoryAxisJSON.index=$scope.reportRunJson.chartColumnJSONList[i].index;
+ $scope.reportRunJson.categoryAxisJSON.title=$scope.reportRunJson.chartColumnJSONList[i].title;
+ }
+
+ }
+ }
+
+ //Set range axis label
+ if ($scope.reportRunJson.rangeAxisList) {
+ for(var j = 0; j < $scope.reportRunJson.rangeAxisList.length; j++) {
+
+ if ($scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON) {
+ var rangeAxisLabelValue = $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON.value;
+ for(var i = 0; i < $scope.reportRunJson.chartColumnJSONList.length; i++) {
+ if ($scope.reportRunJson.chartColumnJSONList[i].value==rangeAxisLabelValue) {
+ $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON.index=$scope.reportRunJson.chartColumnJSONList[i].index;
+ $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON.title=$scope.reportRunJson.chartColumnJSONList[i].title;
+ }
+
+ }
+ }
+ }
+ }
+
+
+ //set range linetype
+ if ($scope.reportRunJson.rangeAxisList) {
+ for(var j = 0; j < $scope.reportRunJson.rangeAxisList.length; j++) {
+ if ($scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON != null && $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.value != ""
+ && $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.value != null) {
+ var lineTypeValue = $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.value;
+ for(var i = 0; i < $scope.lineTypes.length; i++) {
+ if ($scope.lineTypes[i].value==lineTypeValue) {
+ $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.index=$scope.lineTypes[i].index;
+ $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.title=$scope.lineTypes[i].title;
+ }
+
+ }
+ } else {
+ $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON = null;
+ }
+ }
+
+ }
+ //set range color
+ if ($scope.reportRunJson.rangeAxisList) {
+ for(var j = 0; j < $scope.reportRunJson.rangeAxisList.length; j++) {
+ if ($scope.reportRunJson.rangeAxisList[j].rangeColorJSON != null && $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.value != ""
+ && $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.value != null) {
+ var colorValue = $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.value;
+
+ for(var i = 0; i < $scope.rangeColors.length; i++) {
+
+ if ($scope.rangeColors[i].value==colorValue) {
+ $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.index=$scope.rangeColors[i].index;
+ $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.title=$scope.rangeColors[i].title;
+ }
+ }
+ }else {
+ $scope.reportRunJson.rangeAxisList[j].rangeColorJSON = null;
+ }
+ }
+ }
+
+
+
+
+ /* var data = $.param({
+ json: JSON.stringify($scope.reportRunJson)
+ });
+ console.log(data);
+ $http.post("/ecomp-sdk-app/testraptorchart", JSON.stringify($scope.reportRunJson)).success(function(data, status) {
+ console.log(data);
+ console.log(status);
+
+ })*/
+
+ });
+
+
+ /* $scope.chrtwidth = $scope.reportRunJson.width;
+
+ $scope.chrtheight = $scope.reportRunJson.height;
+ $scope.title="false";
+ $scope.domainAxes = $scope.reportRunJson.chartColumnJSONList;
+ $scope.categories = $scope.reportRunJson.chartColumnJSONList;
+ $scope.rangeAxes = $scope.reportRunJson.chartColumnJSONList; */
+
+ // $scope.Color = $scope.rangeColors;
+ // $scope.lineType = $scope.lineTypes;
+ // $scope.praxis = $scope.reportRunJson.primaryAxisLabel;
+ // $scope.secaxis = $scope.reportRunJson.secondaryAxisLabel;
+ // $scope.raxisminrange = $scope.reportRunJson.minRange;
+ // $scope.raxismaxrange = $scope.reportRunJson.maxRange;
+ // $scope.reportRunJson.legendangle = "up_45";
+ $scope.legend = "true";
+ // $scope.animate = "true";
+ // $scope.topmargin = $scope.reportRunJson.topMargin;
+ // $scope.bottommargin = $scope.reportRunJson.bottomMargin;
+ // $scope.leftmargin = $scope.reportRunJson.leftMargin;
+ // $scope.rightmargin = $scope.reportRunJson.rightMargin;
+ // $scope.tt1=false;
+
+
+
+ }
+
+ $scope.saveChartData = function() {
+ //console.log(JSON.stringify($scope.reportRunJson));
+
+ //Converting string variables to numbers
+ $scope.reportRunJson.commonChartOptions.rightMargin = Number($scope.reportRunJson.commonChartOptions.rightMargin);
+ $scope.reportRunJson.commonChartOptions.topMargin = Number($scope.reportRunJson.commonChartOptions.topMargin);
+ $scope.reportRunJson.commonChartOptions.bottomMargin = Number($scope.reportRunJson.commonChartOptions.bottomMargin);
+ $scope.reportRunJson.commonChartOptions.leftMargin = Number($scope.reportRunJson.commonChartOptions.leftMargin);
+
+ //Concatenate range Y axis with range label with pipe delimiter
+ /* if ($scope.reportRunJson.rangeAxisList) {
+
+ for(var j = 0; j < $scope.reportRunJson.rangeAxisList.length; j++) {
+
+ if ($scope.reportRunJson.rangeAxisList[j].rangeYAxis) {
+ if ($scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON != "" && $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON != null) {
+ $scope.reportRunJson.rangeAxisList[j].rangeYAxis =
+ $scope.reportRunJson.rangeAxisList[j].rangeYAxis + "|"+ $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON.value;
+
+ //document.getElementById('yaxs').value = $scope.reportRunJson.rangeAxisList[j].rangeYAxis.substring(0,$scope.reportRunJson.rangeAxisList[j].rangeYAxis.indexOf('|'));
+ }
+ } else {
+ if ($scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON != "" && $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON != null)
+ $scope.reportRunJson.rangeAxisList[j].rangeYAxis = "|"+ $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON.value;
+
+ }
+ }
+
+
+ }*/
+
+ if ($scope.reportRunJson.categoryAxisJSON == "") {
+ console.log('Inside categoryAxisJSON value');
+ $scope.reportRunJson.categoryAxisJSON = {};
+ $scope.reportRunJson.categoryAxisJSON.value = -1;
+ console.log('$scope.reportRunJson.categoryAxisJSON',$scope.reportRunJson.categoryAxisJSON);
+ }
+
+
+ $http.post("save_chart", JSON.stringify($scope.reportRunJson)).success(function(data, status) {
+ // console.log(data);
+ // console.log(status);
+ $scope.successSubmit=true;
+ // modalService.showSuccess("Success","Chart Wizard details have been successfully submitted.");
+ // saveProfile();
+
+ })
+
+
+ /* $http.post("/ecomp-sdk-app/testraptorchart", $scope.reportRunJson).then(function(response) {
+ console.log(response.data);
+ console.log(response.status);
+
+ });*/
+ }
+
+ //$scope.samplearray = ["abc","test"];
+
+
+ $scope.addRangeAxisRow = function (rangeaxisitem) {
+
+
+
+
+ $scope.reportRunJson.rangeAxisList.push({
+
+ /* "rangeColor":{
+ "index":0,
+ "value":rangeaxisitem.rangeColor.value,
+ "title":rangeaxisitem.rangeColor.title
+
+ },
+ "rangeLineType":{
+ "index":0,
+ "value":rangeaxisitem.rangeLineType.value,
+ "title":rangeaxisitem.rangeLineType.title
+
+ },
+ "rangeaxisLabel":{
+ "index":0,
+ "value":rangeaxisitem.rangeaxisLabel.value,
+ "title":rangeaxisitem.rangeaxisLabel.value
+
+ },
+ "YAxis":"",
+ "chartTitle":""*/
+ });
+ // alert($scope.reportRunJson.rangeAxisList.length);
+ console.log($scope.reportRunJson.rangeAxisList);
+
+ };
+
+ $scope.removeRangeAxisRow = function (index) {
+ $scope.reportRunJson.rangeAxisList.splice(index, 1);
+ //console.log($scope.hardCodeReport.rangeAxisList)
+ };
+
+
+
+ /*$scope.saveProfile = function() {
+ var uuu = "profile/saveProfile?profile_id=" + $scope.profileId;;
+ var postData={profile: $scope.profile,
+ selectedCountry:$scope.selectedCountry!=null?$scope.selectedCountry.value:"",
+ selectedState:$scope.stateList.selected!=null?$scope.stateList.selected.value:"",
+ selectedTimeZone:$scope.selectedTimeZone!=null?$scope.selectedTimeZone.value:""
+ };
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ modalService.showSuccess("Success","Update Successful.");
+ },
+ error : function(data){
+ modalService.showFailure("Fail","Error while saving.");
+ }
+ });
+ };*/
+
+
+ /* $scope.actionClicked = function(){
+
+ if ($scope.chartType=="Bar Chart") {
+ $scope.tt1=true;
+ } else if ($scope.chartType=="Time Series/Area Chart") {
+ $scope.tt2=true;
+ }else
+ // $scope.tt3=true;
+ };*/
+
+ $scope.init = function () {
+ // console.time("In init");
+ if ($scope) {
+ $scope.populateChrtWzdFields();
+ // $scope.saveChartData();
+ }
+
+ };
+
+
+ /*$scope.accgroups = [
+ {
+ title: "Accordion Item #1",
+ content:"Unit test me bro! Proin eu quam malesuada, accumsan velit eu, tristique orci. Donec neque nisl, dignissim ut hendrerit sit amet, tempor id erat. Donec fermentum commodo semper. Sed lectus odio, egestas non volutpat eu, venenatis eu turpis. Donec eget fringilla lorem. Fusce sit amet semper velit. ",
+ open: false
+ },
+ {
+ title: "Accordion Item #2",
+ content: "Lint me too! Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi eleifend aliquam eros quis fringilla. Integer eu justo turpis. Nam mauris augue, posuere interdum dignissim sed, tempor sit amet neque. In nec tortor id nibh sollicitudin aliquam sit amet ac augue",
+ open: false
+ },
+ {
+ title: "Accordion Item #3",
+ content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi eleifend aliquam eros quis fringilla. Integer eu justo turpis. Nam mauris augue, posuere interdum dignissim sed, tempor sit amet neque. In nec tortor id nibh sollicitudin aliquam sit amet ac augue",
+ open: false
+ }
+ ];*/
+
+ $scope.domainItems = [{title:"Domain Axis1", content:"Test1", open: false},{title:"Domain Axis2", content:"Test2", open: false}];
+
+ $scope.chartTypes = [
+ {index: 0, value: 'BarChart3D', title: 'Bar Chart'},
+ {index: 1, value: 'TimeSeriesChart', title: 'Time Series/Area Chart'},
+ {index: 2, value: 'PieChart', title: 'Pie Chart'},
+ {index: 3, value: 'AnnotationChart', title: 'Annotation Chart'},
+ {index: 4, value: 'FlexTimeChart', title: 'Flexible Time Chart'}
+ ];
+
+ /* $scope.domainAxes = [
+ {index: 0, value: 'scenario_name', title: 'scenario_name'},
+ {index: 1, value: 'total_traffic_in_PB', title: 'Total Traffic in PB'},
+ {index: 2, value: 'Avg Utilization Day', title: 'Avg Utilization Day'}
+
+ ];*/
+
+ $scope.categories = [
+ {index: 0, value: 'scenario_name', title: 'scenario_name'},
+ {index: 1, value: 'total_traffic_in_PB', title: 'Total Traffic in PB'},
+ {index: 2, value: 'Avg Utilization Day', title: 'Avg Utilization Day'}
+
+ ];
+
+ $scope.rangeColors = [
+
+ {index: 0, value: "#1f77b4",title: "Dodger Blue"},
+ {index: 1, value: "#ff7f0e",title: "Vivid orange"},
+ {index: 2, value: "#2ca02c",title: "Forest Green"},
+ {index: 3, value: "#8c864b",title: "Greenish Red"},
+ {index: 4, value: "#9467bd",title: "Desaturated violet"},
+ {index: 5, value: "#8c564b",title: "Dark moderate red"},
+ {index: 6, value: "#e377c2",title: "Soft pink"},
+ {index: 7, value: "#7f7f7f",title: "Dark gray"},
+ {index: 8, value: "#bcbd22",title: "Strong yellow"},
+ {index: 9, value: "#17becf",title: "Strong cyan"},
+ {index: 10, value: "#dc143c",title: "Vivid red"},
+ {index: 11, value: "#800080",title: "Dark magenta"},
+ {index: 12, value: "#0000FF",title: "Blue"},
+ {index: 13, value: "#008000",title: "Dark lime green"},
+ {index: 14, value: "#D2691E",title: "Reddish Orange"},
+ {index: 15, value: "#FF0000",title: "Red"},
+ {index: 16, value: "#000000",title: "Black"},
+ {index: 17, value: "#DB7093",title: "Pink"},
+ {index: 18, value: "#FF00FF",title: "Pure Magenta"},
+ {index: 19, value: "#7B68EE",title: "Soft blue"},
+ {index: 20, value: "#1f77b6",title: "Strong blue"},
+ {index: 21, value: "#9edae5",title: "Very soft cyan"},
+ {index: 22, value: "#393b79",title: "Dark Blue"},
+ {index: 23, value: "#5254a3",title: "Dark moderate Blue"},
+ {index: 24, value: "#6b6ecf",title: "Slightly desaturated blue"},
+ {index: 25, value: "#9c9ede",title: "Very soft blue"},
+ {index: 26, value: "#637939",title: "Dark Green"},
+ {index: 27, value: "#8ca252",title: "Dark moderate green"},
+ {index: 28, value: "#b5cf6b",title: "Slightly desaturated green"},
+ {index: 29, value: "#cedb9c",title: "Desaturated Green"},
+
+ /* Old Colors */
+ {index: 30, value: "#00FFFF",title: "Aqua"},
+ {index: 31, value: "#000000",title: "Black"},
+ {index: 32, value: "#0000FF",title: "Blue"},
+ {index: 33, value: "#FF00FF",title: "Fuchsia"},
+ {index: 34, value: "#808080",title: "Gray"},
+ {index: 35, value: "#008000",title: "Green"},
+ {index: 36, value: "#00FF00",title: "Lime"},
+ {index: 37, value: "#800000",title: "Maroon"},
+ {index: 38, value: "#000080",title: "Navy"},
+ {index: 39, value: "#808000",title: "Olive"},
+ {index: 40, value: "#FF9900",title: "Orange"},
+ {index: 41, value: "#800080",title: "Purple"},
+ {index: 42, value: "#FF0000",title: "Red"},
+ {index: 43, value: "#C0C0C0",title: "Silver"},
+ {index: 44, value: "#008080",title: "Teal"},
+ {index: 45, value: "#FFFFFF",title: "White"},
+ {index: 46, value: "#FFFF00",title: "Yellow"}
+ ];
+
+
+ $scope.lineTypes = [
+ {index: 0, value: 'default', title: 'Default'},
+ {index: 1, value: 'dotted_lines', title: 'Dotted Lines'},
+ {index: 2, value: 'dashed_lines', title: 'Dashed Lines'}
+
+ ];
+
+
+ $scope.hardCodeReport= {
+ "reportID":"3356",
+ "reportName":"Test: Line Chart",
+ "reportDescr":"",
+ "reportTitle":"",
+ "reportSubTitle":"",
+ "formFieldList":[
+
+ ],
+ "chartColumnJSONList":[
+ {
+ "index":0,
+ "value":"tr0",
+ "title":"traffic_date",
+ "$$hashKey":"056"
+ },
+ {
+ "index":1,
+ "value":"ut1",
+ "title":"util_perc",
+ "$$hashKey":"057"
+ }
+ ],
+ "formfield_comments":null,
+ "totalRows":0,
+ "chartSqlWhole":"SELECT traffic_date tr0, traffic_date tr0_1,util_perc ut1, 1 FROM portal.demo_util_chart ORDER BY 1",
+ "chartAvailable":true,
+ "chartType":{"index": "", "value": "Bar Chart", "title": ""},
+ "width":"700",
+ "height":"420",
+ "animation":false,
+ "rotateLabels":"90",
+ "staggerLabels":false,
+ "showTitle":"false",
+ "domainAxis":{
+ "index":0,
+ "value":"tr0",
+ "title":"traffic_date",
+ "$$hashKey":"11H"
+ },
+
+ "categoryAxis":{
+ "index":1,
+ "value":"ut1",
+ "title":"util_perc",
+ "$$hashKey":"11I"
+ },
+
+ "hasCategoryAxis":false,
+ "rangeAxisList":[
+ {
+
+ "rangeColor":{
+ "index":"",
+ "value":"#bcbd22",
+ "title":""
+
+ },
+
+ "rangeLineType":{
+ "index":"",
+ "value":"dotted_lines",
+ "title":""
+
+
+ },
+
+ "rangeAxisLabel":{
+ "index":0,
+ "value":"tr0",
+ "title":"traffic_date",
+ "$$hashKey":"056"
+ },
+ "YAxis":"10",
+ "chartTitle":"test"
+ },
+ {
+
+ "rangeColor":{
+ "index":"",
+ "value":"#2ca02c",
+ "title":""
+
+ },
+
+ "rangeLineType":{
+ "index":"",
+ "value":"dashed_lines",
+ "title":""
+
+
+ },
+
+ "rangeAxisLabel":{
+ "index":0,
+ "value":"tr0",
+ "title":"traffic_date",
+ "$$hashKey":"056"
+ },
+ "YAxis":"10",
+ "chartTitle":"test"
+ }
+
+
+ ],
+
+ "primaryAxisLabel":"testlabel",
+ "secondaryAxisLabel":"testseclabel",
+ "minRange":"10",
+ "maxRange":"20",
+ "topMargin":"6",
+ "bottomMargin":"5",
+ "leftMargin":"4",
+ "rightMargin":"3"
+ };
+
+ var colorValue = $scope.hardCodeReport.rangeAxisList[0].rangeColor.value;
+
+ //console.log($scope.hardCodeReport.chartType);
+
+ // prefill range color
+ /* for(var i = 0; i < $scope.rangeColors.length; i++) {
+ var obj = $scope.rangeColors[i];
+ //console.log(obj.id);
+ if ($scope.rangeColors[i].value==colorValue) {
+ $scope.hardCodeReport.rangeAxisList[0].rangeColor.index=$scope.rangeColors[i].index;
+ $scope.hardCodeReport.rangeAxisList[0].rangeColor.title=$scope.rangeColors[i].title;
+ }
+
+ }*/
+
+ //prefill chart type
+
+// console.log($scope.hardCodeReport.chartType);
+
+// console.log($scope.hardCodeReport.chartType);
+
+ // console.log($scope.hardCodeReport.rangeAxisList);
+ //prefill rangle line type
+ /* for(var j = 0; j < $scope.hardCodeReport.rangeAxisList.length; j++) {
+
+ var lineTypeValue = $scope.hardCodeReport.rangeAxisList[j].rangeLineType.value;
+ for(var i = 0; i < $scope.lineTypes.length; i++) {
+ var obj = $scope.lineTypes[i];
+ //console.log(obj.id);
+ if ($scope.lineTypes[i].value==lineTypeValue) {
+ $scope.hardCodeReport.rangeAxisList[j].rangeLineType.index=$scope.lineTypes[i].index;
+ $scope.hardCodeReport.rangeAxisList[j].rangeLineType.title=$scope.lineTypes[i].title;
+ }
+
+ }
+ }*/
+// console.log($scope.hardCodeReport.rangeAxisList);
+
+
+
+
+ // console.log($scope.hardCodeReport.rangeAxisList[0].rangeColor);
+ /* $scope.hardCodeReport.rangeAxisList[0].rangeColor.index=4;
+ $scope.hardCodeReport.rangeAxisList[0].rangeColor.title="Desaturated violet";*/
+
+
+ //console.log($scope.hardCodeReport);
+
+
+
+
+
+ /*$scope.reportRunJson =
+ {
+ "reportID":"3356",
+ "reportName":"Test: Line Chart",
+ "reportDescr":"",
+ "reportTitle":"",
+ "reportSubTitle":"",
+ "formFieldList":[
+
+ ],
+ "chartColumnJSONList":[
+ {
+ "index":0,
+ "value":"tr0",
+ "title":"traffic_date"
+ },
+ {
+ "index":1,
+ "value":"ut1",
+ "title":"util_perc"
+ }
+ ],
+ "formfield_comments":null,
+ "totalRows":0,
+ "chartSqlWhole":"SELECT traffic_date tr0, traffic_date tr0_1,util_perc ut1, 1 FROM portal.demo_util_chart ORDER BY 1",
+ "chartAvailable":true,
+ "chartType":"TimeSeriesChart",
+ "width":"700",
+ "height":"420",
+ "animation":false,
+ "rotateLabels":"90",
+ "staggerLabels":false,
+ "showTitle":false,
+ "domainAxis":"tr0",
+ "categoryAxis":null,
+ "hasCategoryAxis":false,
+ "rangeAxisList":[
+ {
+ "YAxis":"",
+ "chartTitle":""
+ }
+ ],
+ "primaryAxisLabel":"",
+ "secondaryAxisLabel":"",
+ "minRange":"",
+ "maxRange":"",
+ "topMargin":"",
+ "bottomMargin":"",
+ "leftMargin":"",
+ "rightMargin":"3"
+ }; */
+ $timeout(function() {
+ $rootScope.isViewRendering = false;
+ });
+
+
+});
+
+app.directive('onlyDigits', function () {
+
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function (scope, element, attrs, ngModel) {
+ if (!ngModel) return;
+ ngModel.$parsers.unshift(function (inputValue) {
+ var digits = inputValue.split('').filter(function (s) { return (!isNaN(s) && s != ' '); }).join('');
+ ngModel.$viewValue = digits;
+ ngModel.$render();
+ return digits;
+ });
+ }
+ };
+});
+
+app.directive('onlyCharacters', function () {
+
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function (scope, element, attrs, ngModel) {
+ if (!ngModel) return;
+ ngModel.$parsers.unshift(function (inputValue) {
+ var digits = inputValue.split('').filter(function (s) { return (isNaN(s) && s != ' '); }).join('');
+ ngModel.$viewValue = digits;
+ ngModel.$render();
+ return digits;
+ });
+ }
+ };
+});
+
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.html
new file mode 100644
index 00000000..afdb692e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.html
@@ -0,0 +1,67 @@
+<style>
+.grid {
+ width: 100%;
+ height: 400;
+}
+.no-rows {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+}
+
+.no-rows .msg {
+ opacity: 1;
+ position: absolute;
+ top: 20%;
+ left: 20%;
+ width: 60%;
+ height: 50%;
+ line-height: 200%;
+ background-color: #eee;
+ border-radius: 4px;
+ border: 1px solid #555;
+ text-align: center;
+ font-size: 24px;
+ display: table;
+}
+
+.no-rows .msg span {
+ display: table-cell;
+ vertical-align: middle;
+}
+.grid .ui-grid-header-cell {
+ text-align:center;
+}
+</style>
+<!-- Icons -->
+<link rel="stylesheet" type="text/css" href="app/fusion/external/ionicons-2.0.1/css/ionicons.css" />
+<div>
+ <h1 class="heading2">{{reportData.reportName}} <a ng-href="{{reportEditURL}}" ng-show="reportData.allowEdit" class="ion-edit" style="font-size:20px;"></a>
+
+ &nbsp;&nbsp;&nbsp;<a ng-href="{{reportChartURL}}" ng-show="reportData.allowEdit && reportData.chartWizardAvailable" class="ion-stats-bars" style="font-size:20px;"></a>
+ &nbsp;&nbsp;&nbsp;<span ng-show="reportData.allowEdit && showFormFields" ><input type="checkbox" ng-model="showFormFieldIds" ng-true-value="Hide_IDs" ng-false-value="Show_IDs" att-toggle-main></span>
+
+ <!-- &nbsp;&nbsp;&nbsp;<a ng-href="{{reportChartURLNew}}" ng-show="reportData.allowEdit" class="icon-bar-chart-horizontal" style="font-size:20px;"></a> -->
+ </h1>
+ <div ng-show="isInProgress" style="font-size:50px;color:#2ca02c">Loading...</div>
+
+ <form ng-show="showFormFields" class="row section-row" style="margin: 10px">
+ <form-builder ng-form-fields="reportData.formFieldList" ng-show-field-id="showFormFieldIds" ng-num-form-cols="reportData.numFormCols" ng-model="formFieldSelectedValues" ng-trigger-method="triggerOtherFormFields"></form-builder>
+ <br><br>
+ <button type="submit" ng-click="runReport()" att-button btn-type="primary" size="small" title='run'>Run</button>
+ </form>
+ <a type="submit" ng-show="showBackButton" style="margin: 10px" ng-href="report.htm#/report_run/{{parentReportUrlParams}}" att-button btn-type="primary" size="small" title='Back'>Back</a>
+ <iframe id="chartiframe" ng-show="showChart" width="100%" height="450px" style="border: none" scrolling="no"></iframe>
+ <div id="errorDiv"></div>
+ <div ng-if="showGrid">
+ <div id="grid1" ui-grid="gridOptions" ui-grid-pagination ui-grid-pinning ui-grid-resize-columns class="grid" style="height: {{gridHeight}}">
+ <div class="no-rows" ng-show="!gridOptions.data.length">
+ <div class="msg">
+ <span>{{reportData.message}}</span>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.js
new file mode 100644
index 00000000..0df56796
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.js
@@ -0,0 +1,293 @@
+app.controller("reportRunController", ['$scope','$rootScope','$routeParams','$http','dateFilter', '$window', '$timeout', 'rowSorter',
+ function ($scope,$rootScope,$routeParams,$http,dateFilter,$window,$timeout,rowSorter) {
+ $scope.dateformat = "MM/dd/yyyy";
+ $scope.datetimeformat = "MM/dd/yyyy hh:mm a";
+ $scope.showFormFields = false;
+ $scope.showGrid = false;
+ $scope.showChart = false;
+ $scope.showBackButton = false;
+ $scope.reportData = {};
+ $scope.reportData.allowEdit = false;
+ $scope.formFieldSelectedValues = {};
+ $scope.showFormFieldIds = false;
+
+ $scope.isInProgress = true;
+
+ if($routeParams.reportUrlParams.indexOf("parent___params===")>-1) {
+ $scope.showBackButton = true;
+ $scope.parentReportUrlParams = $routeParams.reportUrlParams.substring($routeParams.reportUrlParams.indexOf("parent___params===")+18);
+ $scope.currentReportUrlParams = $routeParams.reportUrlParams.substring(0,$routeParams.reportUrlParams.indexOf("parent___params==="));
+ } else {
+ $scope.currentReportUrlParams = $routeParams.reportUrlParams;
+ }
+ console.log($routeParams.reportUrlParams);
+ var parseQueryString = function( queryString ) {
+ var params = {}, queries, temp, i, l;
+ // Split into key/value pairs
+ queries = queryString.split("&");
+ // Convert the array of strings into an object
+ for ( i = 0, l = queries.length; i < l; i++ ) {
+ temp = queries[i].split('=');
+ //console.log(temp[0]);
+ //console.log(temp[0] != "refresh");
+ if(temp[0] && temp[0] != "refresh")
+ params[temp[0]] = temp[1];
+ }
+ return params;
+ };
+
+ var convertQueryString = function(queryString) {
+ var keys = ""; var str = "";
+ keys = Object.keys(queryString);
+ //console.log(keys);
+ for ( i = 0, l = keys.length; i < l; i++ ) {
+ str += keys[i]+"="+queryString[keys[i]] + "&";
+
+ }
+ return str;
+ //queryString =
+ }
+
+
+
+
+ $scope.urlParams = parseQueryString($scope.currentReportUrlParams);
+
+ $scope.reportChartURL = 'report#/report_chart_wizard/'+$scope.urlParams.c_master;
+
+ $scope.reportEditURL = 'report_wizard.htm?action=report.edit&c_master='+$scope.urlParams.c_master;
+
+
+ $http.get('raptor.htm?action=report.run.container&'+$scope.currentReportUrlParams).then(
+ function(response){
+ console.log(response);
+ $scope.isInProgress = false;
+ $scope.reportData = response.data;
+ if(!$scope.urlParams.hideChart && $scope.reportData.chartAvailable && $scope.reportData.totalRows>1){
+ console.log('raptor.htm?action=chart.run&'+convertQueryString($scope.urlParams));
+ $http.get('raptor.htm?action=chart.run&'+convertQueryString($scope.urlParams)).then(
+ function(response){
+ $scope.showChart = true;
+ document.getElementById('chartiframe').contentWindow.document.write(response.data);
+ document.getElementById('chartiframe').contentWindow.document.close();
+ });
+ }
+
+ if($scope.reportData.displayForm && $scope.reportData.formFieldList && $scope.reportData.formFieldList.length>0 && !$scope.urlParams.hideFormFields){
+ $scope.showFormFields = true;
+ }
+ });
+ $scope.getFormFieldSelectedValuesAsURL = function(){
+ var formFieldsUrl = '';
+ $scope.reportData.formFieldList.forEach(function(formField) {
+ if(formField.fieldType==='LIST_BOX') {
+ if($scope.formFieldSelectedValues && $scope.formFieldSelectedValues[formField.fieldId] && $scope.formFieldSelectedValues[formField.fieldId].value != '') {
+ formFieldsUrl = formFieldsUrl+formField.fieldId+'='+$scope.formFieldSelectedValues[formField.fieldId].value+'&';
+ }
+ } else if(formField.fieldType==='LIST_MULTI_SELECT') {
+ if($scope.formFieldSelectedValues[formField.fieldId].length >0) {
+ for (var i = 0; i < $scope.formFieldSelectedValues[formField.fieldId].length; i++) {
+ if($scope.formFieldSelectedValues[formField.fieldId][i].defaultValue){
+ formFieldsUrl = formFieldsUrl+formField.fieldId+'='+$scope.formFieldSelectedValues[formField.fieldId][i].value+'&';
+ }
+ }
+ }
+ } else if((formField.fieldType === 'text' || formField.fieldType === 'TEXT') && formField.validationType === 'DATE'){
+ formFieldsUrl = formFieldsUrl+formField.fieldId+'='+dateFilter($scope.formFieldSelectedValues[formField.fieldId],$scope.dateformat)+'&';
+ } else if((formField.fieldType === 'text' || formField.fieldType === 'TEXT') && formField.validationType === 'TIMESTAMP_MIN'){
+ formFieldsUrl = formFieldsUrl+formField.fieldId+'='+dateFilter($scope.formFieldSelectedValues[formField.fieldId],$scope.datetimeformat)+'&';
+ } else if((formField.fieldType === 'text' || formField.fieldType === 'TEXT') && $scope.formFieldSelectedValues[formField.fieldId] && $scope.formFieldSelectedValues[formField.fieldId] != ''){
+ formFieldsUrl = formFieldsUrl+formField.fieldId+'='+$scope.formFieldSelectedValues[formField.fieldId]+'&';
+ }
+ });
+ return formFieldsUrl;
+
+ }
+
+ $scope.runReport = function(pagination){
+
+ var formFieldsUrl = $scope.getFormFieldSelectedValuesAsURL();
+ console.log("pagination");
+ if(!pagination) {
+ console.log("refreshed ...");
+ $scope.gridOptions.pageNumber = 1;
+ $scope.gridOptions.paginationPageSizes= [$scope.reportData.pageSize];
+ $scope.gridOptions.paginationPageSize= $scope.reportData.pageSize;
+ if($scope.reportData.totalRows<14){
+ $scope.gridHeight = ($scope.reportData.totalRows+7)*30+'px';
+ } else{
+ $scope.gridHeight = '400px';
+ }
+ $scope.gridOptions.totalItems = $scope.reportData.totalRows;
+ $scope.gridOptions.data= $scope.reportData.reportDataRows;
+ $scope.gridOptions.exporterPdfHeader.text= $scope.reportData.reportName;
+
+ }
+ $scope.currentReportUrlParams = 'c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'&display_content=Y&r_page='+(paginationOptions.pageNumber-1);
+ console.log('raptor.htm?action=report.run.container&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'refresh=Y&display_content=Y&r_page='+(paginationOptions.pageNumber-1));
+ $http.get('raptor.htm?action=report.run.container&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'refresh=Y&display_content=Y&r_page='+(paginationOptions.pageNumber-1)).then(
+ function(response){
+ $scope.reportData = response.data;
+ if($scope.reportData.errormessage) {
+ document.getElementById('errorDiv').innerHTML = $scope.reportData.errormessage;
+ console.log(document.getElementById('errorDiv').innerHtml);
+ console.log($scope.reportData.errormessage);
+ }
+ if(!pagination) {
+ if(!$scope.urlParams.hideChart && $scope.reportData.chartAvailable && $scope.reportData.totalRows>1){
+ console.log('raptor.htm?action=chart.run&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'display_content=Y&r_page='+(paginationOptions.pageNumber-1));
+ $http.get('raptor.htm?action=chart.run&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'display_content=Y&r_page='+(paginationOptions.pageNumber-1)).then(
+ function(response) {
+ console.log(response.data);
+ $scope.showChart = true;
+ document.getElementById('chartiframe').contentWindow.document.write(response.data);
+ document.getElementById('chartiframe').contentWindow.document.close();
+ });
+ } else {
+ $scope.showChart = false;
+ }
+ }
+ if($scope.reportData.displayForm && $scope.reportData.formFieldList && $scope.reportData.formFieldList.length>0 && !$scope.urlParams.hideFormFields){
+ $scope.showFormFields = true;
+ } else {
+ $scope.showFormFields = false;
+ }
+ });
+ };
+
+ var paginationOptions = {
+ pageNumber: 1,
+ pageSize: 5,
+ sort: null
+ };
+
+ $scope.gridOptions = {
+ pageNumber: 1,
+ sort : null,
+ paginationPageSizes: [5],
+ paginationPageSize: 5,
+ useExternalPagination: true,
+ columnDefs: [],
+ data: [],
+ enableGridMenu: true,
+ enableSelectAll: true,
+ gridMenuCustomItems : [
+ { title : 'All Reports',
+ action : function($event) {
+ $window.open('report.htm','_self');
+ }, order : 210 },
+ { title : 'Edit Report',
+ action : function($event) {
+ $window.open($scope.reportEditURL,'_self');
+ }, order : 211 },
+ { title : 'Export All data as Excel 2007',
+ action : function($event) {
+ $window.open('raptor.htm?c_master='+$scope.reportData.reportID+'&r_action=report.download.excel2007.session','_self');
+ }, order : 212 },
+ { title : 'Export All data as Excel',
+ action : function($event) {
+ $window.open('raptor.htm?c_master='+$scope.reportData.reportID+'&r_action=report.download.excel.session','_self');
+ }, order : 213 },
+ { title : 'Export All data as CSV',
+ action : function($event) {
+ $window.open('raptor.htm?c_master='+$scope.reportData.reportID+'&r_action=report.download.csv.session','_self');
+ }, order : 214 },
+ { title : 'Export All data as PDF',
+ action : function($event) {
+ $window.open('raptor.htm?c_master='+$scope.reportData.reportID+'&r_action=report.download.pdf.session','_self');
+ }, order : 215 } ],
+ exporterMenuPdf: false,
+ exporterMenuCsv: false,
+ exporterCsvFilename: 'myFile.csv',
+ exporterPdfDefaultStyle: {fontSize: 9},
+ exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
+ exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
+ exporterPdfHeader: { text: "My Header", style: 'headerStyle' },
+ exporterPdfFooter: function ( currentPage, pageCount ) {
+ return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
+ },
+ exporterPdfCustomFormatter: function ( docDefinition ) {
+ docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
+ docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
+ return docDefinition;
+ },
+ exporterPdfOrientation: 'portrait',
+ exporterPdfPageSize: 'LETTER',
+ exporterPdfMaxGridWidth: 500,
+ exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
+ onRegisterApi: function(gridApi) {
+ $scope.gridApi = gridApi;
+ gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
+ paginationOptions.pageNumber = newPage;
+ paginationOptions.pageSize = pageSize;
+ $scope.runReport(true);
+ });
+ }
+ };
+
+ $scope.uiGridRefresh = function(){
+ var columnDefsArray = [];
+ var columnFreezeEndColumn = $scope.reportData.colIdxTobeFreezed;
+ var doColumnNeedToFreeze = false;
+ if(columnFreezeEndColumn && columnFreezeEndColumn.length>0) {
+ doColumnNeedToFreeze = true;
+ }
+ $scope.reportData.reportDataColumns.forEach(function(entry) {
+ var tempColumnDef = { displayName: entry.columnTitle, field: entry.colId, enableSorting: entry.sortable,
+ sortingAlgorithm: function(a, b) {
+ return rowSorter.sortAlpha(a.displayValue, b.displayValue);
+ },
+ cellTemplate: '<div class="ui-grid-cell-contents" style="text-align:{{COL_FIELD.alignment}};" title="TOOLTIP"> '+
+ ' <div ng-if="!COL_FIELD.drillDownURL || COL_FIELD.drillDownURL==\'\'">{{COL_FIELD.displayValue}}</div>' +
+ ' <a ng-if="COL_FIELD.drillDownURL && COL_FIELD.drillDownURL!=\'\'" ng-href="{{COL_FIELD.drillDownURL}}&parent___params==={{grid.appScope.currentReportUrlParams}}" >{{COL_FIELD.displayValue}}</a>' +
+ '</div>'};
+ if(entry.columnWidth && entry.columnWidth!='null' && entry.columnWidth!='pxpx' && entry.columnWidth!='nullpx' && entry.columnWidth!='nullpxpx'){
+ tempColumnDef['minWidth'] = entry.columnWidth.substring(0, entry.columnWidth.length - 2);
+ } else {
+ tempColumnDef['minWidth'] = '100';
+ }
+ if(doColumnNeedToFreeze) {
+ tempColumnDef['pinnedLeft']= true;
+ if(columnFreezeEndColumn === entry.colId){
+ doColumnNeedToFreeze = false;
+ }
+ }
+ columnDefsArray.push(tempColumnDef);
+ });
+
+ $scope.gridOptions.paginationPageSizes= [$scope.reportData.pageSize];
+ $scope.gridOptions.paginationPageSize= $scope.reportData.pageSize;
+ if($scope.reportData.totalRows<14){
+ $scope.gridHeight = ($scope.reportData.totalRows+5)*30+'px';
+ }else{
+ $scope.gridHeight = '400px';
+ }
+ $scope.gridOptions.totalItems = $scope.reportData.totalRows;
+ $scope.gridOptions.columnDefs= columnDefsArray;
+ $scope.gridOptions.data= $scope.reportData.reportDataRows;
+ $scope.gridOptions.exporterPdfHeader.text= $scope.reportData.reportName;
+ };
+
+ $scope.$watch("reportData",function(newValue,oldValue) {
+ if(!$scope.urlParams.hideGrid){
+ if($scope.reportData){
+ if($scope.reportData.displayData && $scope.reportData.reportDataColumns){
+ $scope.showGrid = true;
+ $scope.uiGridRefresh();
+ }
+ }
+ }
+ });
+
+ $scope.triggerOtherFormFields = function(){
+ console.log("report_run");
+ var formFieldsUrl = $scope.getFormFieldSelectedValuesAsURL();
+ $http.get('raptor.htm?action=report.formfields.run.container&c_master='+$scope.reportData.reportID+'&'+formFieldsUrl).then(
+ function(response){
+ $scope.reportData = response.data;
+ });
+ };
+ $timeout(function() {
+ $rootScope.isViewRendering = false;
+ });
+}]);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.html
new file mode 100644
index 00000000..db00037c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.html
@@ -0,0 +1,34 @@
+<style>
+.grid {
+ width: 100%;
+ height: 400px;
+}
+.grid .ui-grid-header-cell {
+ text-align:center;
+}
+.icon-add-widget:before {
+ content: "\e717";
+}
+</style>
+<h1 class="heading1">Report search</span></h1>
+<br>
+<div >
+<label class="pull-left" style="margin-top: 10px;margin-right: 5px;">Report Id:</label>
+<div class="form-field form-field__glued pull-left size-onefifth" style="width: 13% !important;">
+ <div att-search="operatorsRepId" ng-model="operatorRepId" placeholder="Select"></div>
+</div>
+<div class="form-field form-field__glued pull-left size-onefifth" style="width:13% !important;">
+ <input ng-model="reportId" type="text" placeholder="Search value?" style="border-radius:0px 5px 5px 0px">
+</div>
+
+<label class="pull-left" style="margin-top: 10px;margin-left: 40px;margin-right: 5px;">Report Name:</label>
+<div class="form-field form-field__glued pull-left size-onefifth" style="width: 13% !important;">
+ <div att-search="operatorsRepName" ng-model="operatorRepName" placeholder="Select"></div>
+</div>
+<div class="form-field form-field__glued pull-left size-onefifth" style="width:13% !important;">
+ <input ng-model="reportName" type="text" placeholder="Search value?" style="border-radius:0px 5px 5px 0px">
+</div>
+<button type="submit" ng-click="runReport()" att-button btn-type="primary" style="margin-top: 10px;margin-left: 40px;" size="small" title='Submit'>Submit</button>
+</div>
+<br>
+<div id="grid1" ui-grid="gridOptions" ui-grid-pagination ui-grid-resize-columns class="grid"></div>
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.js
new file mode 100644
index 00000000..d2194224
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.js
@@ -0,0 +1,136 @@
+app.controller("reportSearchController", ['$scope','$rootScope','$http','$timeout',function ($scope,$rootScope,$http,$timeout) {
+
+ $http.get('raptor.htm?action=report.search.execute&r_page=0').then(
+ function(result){$scope.searchdData = result.data;
+ });
+
+ $scope.runReport = function(){
+ var searchParams = '';
+ if($scope.reportId && $scope.reportId!=''){
+ searchParams = '&rep_id='+$scope.reportId+'&rep_id_options='+$scope.operatorRepId.index;
+ }
+ if($scope.reportName && $scope.reportName!=''){
+ searchParams = searchParams+'&rep_name='+$scope.reportName+'&rep_name_options='+$scope.operatorRepName.index;
+ }
+
+ console.log('raptor.htm?action=report.search.execute&r_page='+(paginationOptions.pageNumber-1)+searchParams);
+ $http.get('raptor.htm?action=report.search.execute&r_page='+(paginationOptions.pageNumber-1)+searchParams).then(
+ function(result){$scope.searchdData = result.data;
+ });
+ //quantum/raptor.htm?action=report.search.execute&rep_id=1000&rep_id_options=2&rep_name=cross&rep_name_options=2
+ };
+
+
+ var paginationOptions = {
+ pageNumber: 1,
+ pageSize: 5,
+ sort: null
+ };
+
+ $scope.gridOptions = {
+ paginationPageSizes: [5],
+ paginationPageSize: 5,
+ useExternalPagination: true,
+ columnDefs: [],
+ data: [],
+ enableGridMenu: true,
+ enableSelectAll: true,
+ exporterMenuPdf: false,
+ exporterMenuCsv: false,
+ exporterCsvFilename: 'myFile.csv',
+ exporterPdfDefaultStyle: {fontSize: 9},
+ exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
+ exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
+ exporterPdfHeader: { text: "My Header", style: 'headerStyle' },
+ exporterPdfFooter: function ( currentPage, pageCount ) {
+ return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
+ },
+ exporterPdfCustomFormatter: function ( docDefinition ) {
+ docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
+ docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
+ return docDefinition;
+ },
+ exporterPdfOrientation: 'portrait',
+ exporterPdfPageSize: 'LETTER',
+ exporterPdfMaxGridWidth: 500,
+ exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
+ onRegisterApi: function(gridApi) {
+ $scope.gridApi = gridApi;
+ gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
+ paginationOptions.pageNumber = newPage;
+ paginationOptions.pageSize = pageSize;
+ $scope.runReport();
+ });
+ }
+ };
+
+
+ var getPage = function() {
+ $scope.gridOptions.columnDefs = [];
+ $scope.searchdData.columns[0].forEach(function(entry) {
+ if(entry.columnTitle=='Run'){
+ $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId+'==drillDownLink', enableSorting: false,
+ cellTemplate: '<div class="ui-grid-cell-contents"><a ng-href="#/report_run/{{COL_FIELD.substr(39)}}" class="ion-arrow-right-b" style="font-size:20px;"></a></div>'
+ });
+ } else if(entry.columnTitle=='Edit'){
+ $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId+'==drillDownLink', enableSorting: false,
+ cellTemplate: '<div class="ui-grid-cell-contents"><a ng-href="{{COL_FIELD}}" class="ion-edit" style="font-size:20px;"></a></div>'
+ });
+ } else if(entry.columnTitle=='Delete'){
+ $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId+'==drillDownLink', enableSorting: false,
+ cellTemplate: '<div class="ui-grid-cell-contents"><a href="" ng-click="grid.appScope.deleteReport(COL_FIELD,row)" class="ion-trash-b" style="font-size:20px;"></a></div>'
+ });
+ } else if(entry.columnTitle=='Copy'){
+ $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId+'==drillDownLink', enableSorting: false,
+ cellTemplate: '<div class="ui-grid-cell-contents"><a ng-href="{{COL_FIELD}}" class="ion-document-text" style="font-size:20px;"></a></div>'
+ });
+ } else if(entry.columnTitle=='Schedule'){
+ //$scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId+'==drillDownLink',
+ // cellTemplate: '<div class="ui-grid-cell-contents"><a ng-href="{{COL_FIELD}}" class="full-linear-icon-calendar" style="font-size:20px;font-weight: bold;"></a></div>'
+ //});
+ } else if(entry.columnTitle=='No'){
+ } else {
+ $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId+'==displayValue'});
+ }
+ });
+ $scope.gridOptions.data = $scope.searchdData.rows[0];
+ $scope.gridOptions.paginationPageSizes= [$scope.searchdData.metaReport.pageSize];
+ $scope.gridOptions.paginationPageSize= $scope.searchdData.metaReport.pageSize;
+ $scope.gridOptions.totalItems = $scope.searchdData.metaReport.totalSize;
+ };
+
+ $scope.$watch("searchdData",function(newValue,oldValue) {
+ if($scope.searchdData){
+ getPage();
+ }
+ });
+
+ $scope.operatorsRepId = [{index: 0, value: 'Equal To', title: 'Equal To', alias:'Equal To'},
+ {index: 1, value: 'Less Than', title: 'Less Than', alias:'Less Than'},
+ {index: 2, value: 'Greater Than', title: 'Greater Than', alias:'Greater Than'}];
+ $scope.operatorsRepName = [{index: 0, value: 'Starts With', title: 'Starts With', alias:'Starts With'},
+ {index:1, value: 'Ends With', title: 'Ends With', alias:'Ends With'},
+ {index: 2, value: 'Contains', title: 'Contains', alias:'Contains'}];
+
+ $scope.deleteReport = function(reportDeleteUrl,row) {
+ if (confirm("Please confirm: Are you sure you want to delete report #" + reportDeleteUrl.substr(41) + "?")) {
+ $http.get(reportDeleteUrl).then(
+ function(result){
+ if(result.data=='deleted:true'){
+ var index = $scope.gridOptions.data.indexOf(row.entity);
+ $scope.gridOptions.data.splice(index, 1);
+ alert("Report deleted.");
+ } else {
+ alert("Report not deleted.");
+ }
+ }
+ );
+ }
+ };
+
+ $timeout(function() {
+ $rootScope.isViewRendering = false;
+ });
+
+
+}]);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/CalendarPopup.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/CalendarPopup.js
new file mode 100644
index 00000000..07cd7ee8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/CalendarPopup.js
@@ -0,0 +1,1486 @@
+// ===================================================================
+// Author: Matt Kruse <matt@mattkruse.com>
+// WWW: http://www.mattkruse.com/
+//
+// NOTICE: You may use this code for any purpose, commercial or
+// private, without any further permission from the author. You may
+// remove this notice from your final code if you wish, however it is
+// appreciated by the author if at least my web site address is kept.
+//
+// You may *NOT* re-distribute this code in any way except through its
+// use. That means, you can include it in your product, or your web
+// site, or any other form where the code is actually being used. You
+// may not put the plain javascript up on your site for download or
+// include it in your javascript libraries for download.
+// If you wish to share this code with others, please just point them
+// to the URL instead.
+// Please DO NOT link directly to my .js files from your site. Copy
+// the files to your server and use them there. Thank you.
+// ===================================================================
+
+
+/* SOURCE FILE: date.js */
+
+// HISTORY
+// ------------------------------------------------------------------
+// May 17, 2003: Fixed bug in parseDate() for dates <1970
+// March 11, 2003: Added parseDate() function
+// March 11, 2003: Added "NNN" formatting option. Doesn't match up
+// perfectly with SimpleDateFormat formats, but
+// backwards-compatability was required.
+
+// ------------------------------------------------------------------
+// These functions use the same 'format' strings as the
+// java.text.SimpleDateFormat class, with minor exceptions.
+// The format string consists of the following abbreviations:
+//
+// Field | Full Form | Short Form
+// -------------+--------------------+-----------------------
+// Year | yyyy (4 digits) | yy (2 digits), y (2 or 4 digits)
+// Month | MMM (name or abbr.)| MM (2 digits), M (1 or 2 digits)
+// | NNN (abbr.) |
+// Day of Month | dd (2 digits) | d (1 or 2 digits)
+// Day of Week | EE (name) | E (abbr)
+// Hour (1-12) | hh (2 digits) | h (1 or 2 digits)
+// Hour (0-23) | HH (2 digits) | H (1 or 2 digits)
+// Hour (0-11) | KK (2 digits) | K (1 or 2 digits)
+// Hour (1-24) | kk (2 digits) | k (1 or 2 digits)
+// Minute | mm (2 digits) | m (1 or 2 digits)
+// Second | ss (2 digits) | s (1 or 2 digits)
+// AM/PM | a |
+//
+// NOTE THE DIFFERENCE BETWEEN MM and mm! Month=MM, not mm!
+// Examples:
+// "MMM d, y" matches: January 01, 2000
+// Dec 1, 1900
+// Nov 20, 00
+// "M/d/yy" matches: 01/20/00
+// 9/2/00
+// "MMM dd, yyyy hh:mm:ssa" matches: "January 01, 2000 12:30:45AM"
+// ------------------------------------------------------------------
+
+var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
+var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
+function LZ(x) {return(x<0||x>9?"":"0")+x}
+
+// ------------------------------------------------------------------
+// isDate ( date_string, format_string )
+// Returns true if date string matches format of format string and
+// is a valid date. Else returns false.
+// It is recommended that you trim whitespace around the value before
+// passing it to this function, as whitespace is NOT ignored!
+// ------------------------------------------------------------------
+function isDate(val,format) {
+ var date=getDateFromFormat(val,format);
+ if (date==0) { return false; }
+ return true;
+ }
+
+// -------------------------------------------------------------------
+// compareDates(date1,date1format,date2,date2format)
+// Compare two date strings to see which is greater.
+// Returns:
+// 1 if date1 is greater than date2
+// 0 if date2 is greater than date1 of if they are the same
+// -1 if either of the dates is in an invalid format
+// -------------------------------------------------------------------
+function compareDates(date1,dateformat1,date2,dateformat2) {
+ var d1=getDateFromFormat(date1,dateformat1);
+ var d2=getDateFromFormat(date2,dateformat2);
+ if (d1==0 || d2==0) {
+ return -1;
+ }
+ else if (d1 > d2) {
+ return 1;
+ }
+ return 0;
+ }
+
+// ------------------------------------------------------------------
+// formatDate (date_object, format)
+// Returns a date in the output format specified.
+// The format string uses the same abbreviations as in getDateFromFormat()
+// ------------------------------------------------------------------
+function formatDate(date,format) {
+ format=format+"";
+ var result="";
+ var i_format=0;
+ var c="";
+ var token="";
+ var y=date.getYear()+"";
+ var M=date.getMonth()+1;
+ var d=date.getDate();
+ var E=date.getDay();
+ var H=date.getHours();
+ var m=date.getMinutes();
+ var s=date.getSeconds();
+ var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
+ // Convert real date parts into formatted versions
+ var value=new Object();
+ if (y.length < 4) {y=""+(y-0+1900);}
+ value["y"]=""+y;
+ value["yyyy"]=y;
+ value["yy"]=y.substring(2,4);
+ value["M"]=M;
+ value["MM"]=LZ(M);
+ value["MMM"]=MONTH_NAMES[M-1];
+ value["NNN"]=MONTH_NAMES[M+11];
+ value["d"]=d;
+ value["dd"]=LZ(d);
+ value["E"]=DAY_NAMES[E+7];
+ value["EE"]=DAY_NAMES[E];
+ value["H"]=H;
+ value["HH"]=LZ(H);
+ if (H==0){value["h"]=12;}
+ else if (H>12){value["h"]=H-12;}
+ else {value["h"]=H;}
+ value["hh"]=LZ(value["h"]);
+ if (H>11){value["K"]=H-12;} else {value["K"]=H;}
+ value["k"]=H+1;
+ value["KK"]=LZ(value["K"]);
+ value["kk"]=LZ(value["k"]);
+ if (H > 11) { value["a"]="PM"; }
+ else { value["a"]="AM"; }
+ value["m"]=m;
+ value["mm"]=LZ(m);
+ value["s"]=s;
+ value["ss"]=LZ(s);
+ while (i_format < format.length) {
+ c=format.charAt(i_format);
+ token="";
+ while ((format.charAt(i_format)==c) && (i_format < format.length)) {
+ token += format.charAt(i_format++);
+ }
+ if (value[token] != null) { result=result + value[token]; }
+ else { result=result + token; }
+ }
+ return result;
+ }
+
+// ------------------------------------------------------------------
+// Utility functions for parsing in getDateFromFormat()
+// ------------------------------------------------------------------
+function _isInteger(val) {
+ var digits="1234567890";
+ for (var i=0; i < val.length; i++) {
+ if (digits.indexOf(val.charAt(i))==-1) { return false; }
+ }
+ return true;
+ }
+function _getInt(str,i,minlength,maxlength) {
+ for (var x=maxlength; x>=minlength; x--) {
+ var token=str.substring(i,i+x);
+ if (token.length < minlength) { return null; }
+ if (_isInteger(token)) { return token; }
+ }
+ return null;
+ }
+
+// ------------------------------------------------------------------
+// getDateFromFormat( date_string , format_string )
+//
+// This function takes a date string and a format string. It matches
+// If the date string matches the format string, it returns the
+// getTime() of the date. If it does not match, it returns 0.
+// ------------------------------------------------------------------
+function getDateFromFormat(val,format) {
+ val=val+"";
+ format=format+"";
+ var i_val=0;
+ var i_format=0;
+ var c="";
+ var token="";
+ var token2="";
+ var x,y;
+ var now=new Date();
+
+ var year=now.getYear();
+ var month=now.getMonth()+1;
+ var date=1;
+ var hh=now.getHours();
+ var mm=now.getMinutes();
+ var ss=now.getSeconds();
+ var ampm="";
+
+ while (i_format < format.length) {
+ // Get next token from format string
+ c=format.charAt(i_format);
+ token="";
+ while ((format.charAt(i_format)==c) && (i_format < format.length)) {
+ token += format.charAt(i_format++);
+ }
+ // Extract contents of value based on format token
+ if (token=="yyyy" || token=="yy" || token=="y") {
+ if (token=="yyyy") { x=4;y=4; }
+ if (token=="yy") { x=2;y=2; }
+ if (token=="y") { x=2;y=4; }
+ year=_getInt(val,i_val,x,y);
+ if (year==null) { return 0; }
+ i_val += year.length;
+ if (year.length==2) {
+ if (year > 70) { year=1900+(year-0); }
+ else { year=2000+(year-0); }
+ }
+ }
+ else if (token=="MMM"||token=="NNN"){
+ month=0;
+ for (var i=0; i<MONTH_NAMES.length; i++) {
+ var month_name=MONTH_NAMES[i];
+ if (val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()) {
+ if (token=="MMM"||(token=="NNN"&&i>11)) {
+ month=i+1;
+ if (month>12) { month -= 12; }
+ i_val += month_name.length;
+ break;
+ }
+ }
+ }
+ if ((month < 1)||(month>12)){return 0;}
+ }
+ else if (token=="EE"||token=="E"){
+ for (var i=0; i<DAY_NAMES.length; i++) {
+ var day_name=DAY_NAMES[i];
+ if (val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()) {
+ i_val += day_name.length;
+ break;
+ }
+ }
+ }
+ else if (token=="MM"||token=="M") {
+ month=_getInt(val,i_val,token.length,2);
+ if(month==null||(month<1)||(month>12)){return 0;}
+ i_val+=month.length;}
+ else if (token=="dd"||token=="d") {
+ date=_getInt(val,i_val,token.length,2);
+ if(date==null||(date<1)||(date>31)){return 0;}
+ i_val+=date.length;}
+ else if (token=="hh"||token=="h") {
+ hh=_getInt(val,i_val,token.length,2);
+ if(hh==null||(hh<1)||(hh>12)){return 0;}
+ i_val+=hh.length;}
+ else if (token=="HH"||token=="H") {
+ hh=_getInt(val,i_val,token.length,2);
+ if(hh==null||(hh<0)||(hh>23)){return 0;}
+ i_val+=hh.length;}
+ else if (token=="KK"||token=="K") {
+ hh=_getInt(val,i_val,token.length,2);
+ if(hh==null||(hh<0)||(hh>11)){return 0;}
+ i_val+=hh.length;}
+ else if (token=="kk"||token=="k") {
+ hh=_getInt(val,i_val,token.length,2);
+ if(hh==null||(hh<1)||(hh>24)){return 0;}
+ i_val+=hh.length;hh--;}
+ else if (token=="mm"||token=="m") {
+ mm=_getInt(val,i_val,token.length,2);
+ if(mm==null||(mm<0)||(mm>59)){return 0;}
+ i_val+=mm.length;}
+ else if (token=="ss"||token=="s") {
+ ss=_getInt(val,i_val,token.length,2);
+ if(ss==null||(ss<0)||(ss>59)){return 0;}
+ i_val+=ss.length;}
+ else if (token=="a") {
+ if (val.substring(i_val,i_val+2).toLowerCase()=="am") {ampm="AM";}
+ else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") {ampm="PM";}
+ else {return 0;}
+ i_val+=2;}
+ else {
+ if (val.substring(i_val,i_val+token.length)!=token) {return 0;}
+ else {i_val+=token.length;}
+ }
+ }
+ // If there are any trailing characters left in the value, it doesn't match
+ if (i_val != val.length) { return 0; }
+ // Is date valid for month?
+ if (month==2) {
+ // Check for leap year
+ if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year
+ if (date > 29){ return 0; }
+ }
+ else { if (date > 28) { return 0; } }
+ }
+ if ((month==4)||(month==6)||(month==9)||(month==11)) {
+ if (date > 30) { return 0; }
+ }
+ // Correct hours value
+ if (hh<12 && ampm=="PM") { hh=hh-0+12; }
+ else if (hh>11 && ampm=="AM") { hh-=12; }
+ var newdate=new Date(year,month-1,date,hh,mm,ss);
+ return newdate.getTime();
+ }
+
+// ------------------------------------------------------------------
+// parseDate( date_string [, prefer_euro_format] )
+//
+// This function takes a date string and tries to match it to a
+// number of possible date formats to get the value. It will try to
+// match against the following international formats, in this order:
+// y-M-d MMM d, y MMM d,y y-MMM-d d-MMM-y MMM d
+// M/d/y M-d-y M.d.y MMM-d M/d M-d
+// d/M/y d-M-y d.M.y d-MMM d/M d-M
+// A second argument may be passed to instruct the method to search
+// for formats like d/M/y (european format) before M/d/y (American).
+// Returns a Date object or null if no patterns match.
+// ------------------------------------------------------------------
+function parseDate(val) {
+ var preferEuro=(arguments.length==2)?arguments[1]:false;
+ generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d');
+ monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d');
+ dateFirst =new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M');
+ var checkList=new Array('generalFormats',preferEuro?'dateFirst':'monthFirst',preferEuro?'monthFirst':'dateFirst');
+ var d=null;
+ for (var i=0; i<checkList.length; i++) {
+ var l=window[checkList[i]];
+ for (var j=0; j<l.length; j++) {
+ d=getDateFromFormat(val,l[j]);
+ if (d!=0) { return new Date(d); }
+ }
+ }
+ return null;
+ }
+
+/* SOURCE FILE: PopupWindow.js */
+
+/*
+PopupWindow.js
+Author: Matt Kruse
+Last modified: 02/16/04
+
+DESCRIPTION: This object allows you to easily and quickly popup a window
+in a certain place. The window can either be a DIV or a separate browser
+window.
+
+COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small
+positioning errors - usually with Window positioning - occur on the
+Macintosh platform. Due to bugs in Netscape 4.x, populating the popup
+window with <STYLE> tags may cause errors.
+
+USAGE:
+// Create an object for a WINDOW popup
+var win = new PopupWindow();
+
+// Create an object for a DIV window using the DIV named 'mydiv'
+var win = new PopupWindow('mydiv');
+
+// Set the window to automatically hide itself when the user clicks
+// anywhere else on the page except the popup
+win.autoHide();
+
+// Show the window relative to the anchor name passed in
+win.showPopup(anchorname);
+
+// Hide the popup
+win.hidePopup();
+
+// Set the size of the popup window (only applies to WINDOW popups
+win.setSize(width,height);
+
+// Populate the contents of the popup window that will be shown. If you
+// change the contents while it is displayed, you will need to refresh()
+win.populate(string);
+
+// set the URL of the window, rather than populating its contents
+// manually
+win.setUrl("http://www.site.com/");
+
+// Refresh the contents of the popup
+win.refresh();
+
+// Specify how many pixels to the right of the anchor the popup will appear
+win.offsetX = 50;
+
+// Specify how many pixels below the anchor the popup will appear
+win.offsetY = 100;
+
+NOTES:
+1) Requires the functions in AnchorPosition.js
+
+2) Your anchor tag MUST contain both NAME and ID attributes which are the
+ same. For example:
+ <A NAME="test" ID="test"> </A>
+
+3) There must be at least a space between <A> </A> for IE5.5 to see the
+ anchor tag correctly. Do not do <A></A> with no space.
+
+4) When a PopupWindow object is created, a handler for 'onmouseup' is
+ attached to any event handler you may have already defined. Do NOT define
+ an event handler for 'onmouseup' after you define a PopupWindow object or
+ the autoHide() will not work correctly.
+*/
+function getPos(e)
+{
+ var posx = 0;
+ var posy = 0;
+ var coordinates = new Object();
+ if (!e) var e = window.event;
+ if (e.pageX || e.pageY)
+ {
+ posx = e.pageX;
+ posy = e.pageY;
+ }
+ else if (e.clientX || e.clientY)
+ {
+
+ posx = e.clientX + document.body.scrollLeft
+ + document.documentElement.scrollLeft;
+ posy = e.clientY + document.body.scrollTop
+ + document.documentElement.scrollTop;
+ }
+
+ //alert("posx: " + posx + " posy: " + posy);
+ coordinates.x = posx;
+ coordinates.y = posy;
+ return coordinates;
+}
+// Set the position of the popup window based on the anchor
+function PopupWindow_getXYPosition(anchorname) {
+ var coordintes
+ if (this.type == "WINDOW") {
+ coordinates = getAnchorWindowPosition(anchorname);
+ coordinates = getPos(anchorname); // Replaced using getPost(event)
+ }
+ else {
+ //alert("envent: " + anchorname);
+ //coordinates = getAnchorPosition(anchorname);
+ coordinates = getPos(anchorname); // Replaced using getPost(event)
+ }
+
+ this.x = coordinates.x;
+ this.y = coordinates.y;
+ //alert("PopupWindow_getXYPosition x: " + this.x + " y: " + this.y);
+ }
+// Set width/height of DIV/popup window
+function PopupWindow_setSize(width,height) {
+ this.width = width;
+ this.height = height;
+ }
+// Fill the window with contents
+function PopupWindow_populate(contents) {
+ this.contents = contents;
+ this.populated = false;
+ }
+// Set the URL to go to
+function PopupWindow_setUrl(url) {
+ this.url = url;
+ }
+// Set the window popup properties
+function PopupWindow_setWindowProperties(props) {
+ this.windowProperties = props;
+ }
+// Refresh the displayed contents of the popup
+function PopupWindow_refresh() {
+ if (this.divName != null) {
+ // refresh the DIV object
+ if (this.use_gebi) {
+ document.getElementById(this.divName).innerHTML = this.contents;
+ }
+ else if (this.use_css) {
+ document.all[this.divName].innerHTML = this.contents;
+ }
+ else if (this.use_layers) {
+ var d = document.layers[this.divName];
+ d.document.open();
+ d.document.writeln(this.contents);
+ d.document.close();
+ }
+ }
+ else {
+ if (this.popupWindow != null && !this.popupWindow.closed) {
+ if (this.url!="") {
+ this.popupWindow.location.href=this.url;
+ }
+ else {
+ this.popupWindow.document.open();
+ this.popupWindow.document.writeln(this.contents);
+ this.popupWindow.document.close();
+ }
+ this.popupWindow.focus();
+ }
+ }
+ }
+
+var offsetLeft = 0;
+var offsetTop = 0;
+function parenName(ref)
+ {
+ ok=0; // it's just to start the loop, we don't use it to get out.
+ while (!ok)
+ {
+ ref = ref.parentNode;
+ if (ref.nodeType==1) //check that the node is a tag, not text (type=3)
+ {
+ if (String(ref.nodeName)=="DIV")
+ {
+ offsetLeft = ref.offsetLeft;
+ offsetTop = ref.offsetTop;
+
+ return ;
+ }
+ if (String(ref.nodeName)=="BODY")
+ {
+ return ;
+ }
+ }
+ }
+ }
+
+// Position and show the popup, relative to an anchor object
+function PopupWindow_showPopup(anchorname) {
+ this.getXYPosition(anchorname);
+ this.x += this.offsetX - 125;
+ this.y += this.offsetY;
+ if (!this.populated && (this.contents != "")) {
+ this.populated = true;
+ this.refresh();
+ }
+ if (this.divName != null) {
+ // Show the DIV object
+ var oDiv = document.getElementById(this.divName);
+ parenName(oDiv);
+ if (this.use_gebi) {
+ document.getElementById(this.divName).style.left = this.x - offsetLeft + "px";
+ document.getElementById(this.divName).style.top = this.y - offsetTop + "px";
+ document.getElementById(this.divName).style.visibility = "visible";
+ }
+ else if (this.use_css) {
+ document.all[this.divName].style.left = this.x;
+ document.all[this.divName].style.top = this.y;
+ document.all[this.divName].style.visibility = "visible";
+ }
+ else if (this.use_layers) {
+ document.layers[this.divName].left = this.x;
+ document.layers[this.divName].top = this.y;
+ document.layers[this.divName].visibility = "visible";
+ }
+ }
+ else {
+ if (this.popupWindow == null || this.popupWindow.closed) {
+ // If the popup window will go off-screen, move it so it doesn't
+ if (this.x<0) { this.x=0; }
+ if (this.y<0) { this.y=0; }
+ if (screen && screen.availHeight) {
+ if ((this.y + this.height) > screen.availHeight) {
+ this.y = screen.availHeight - this.height;
+ }
+ }
+ if (screen && screen.availWidth) {
+ if ((this.x + this.width) > screen.availWidth) {
+ this.x = screen.availWidth - this.width;
+ }
+ }
+ var avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled );
+ this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");
+ }
+ this.refresh();
+ }
+
+ //added for IE6 issue
+ ///////////////////////
+ showFrame(this.divName, this.frameName);
+ /*var oIfr = document.getElementById(this.frameName);
+ var oCal = document.getElementById(this.divName);
+ oIfr.style.display='block';
+ oIfr.style.top=oCal.style.top;
+ oIfr.style.left=oCal.style.left;*/
+
+
+ }
+// Hide the popup
+function PopupWindow_hidePopup() {
+ if (this.divName != null) {
+ if (this.use_gebi) {
+
+ document.getElementById(this.divName).style.visibility = "hidden";
+ }
+ else if (this.use_css) {
+ document.all[this.divName].style.visibility = "hidden";
+ }
+ else if (this.use_layers) {
+ document.layers[this.divName].visibility = "hidden";
+ }
+ }
+ else {
+ if (this.popupWindow && !this.popupWindow.closed) {
+ this.popupWindow.close();
+ this.popupWindow = null;
+ }
+ }
+
+
+ //added for IE6 issue
+ //////////////
+ hideFrame(this.divName, this.frameName);
+ /*var oIfr = document.getElementById(this.frameName);
+ oIfr.style.display='none'; */
+ }
+// Pass an event and return whether or not it was the popup DIV that was clicked
+function PopupWindow_isClicked(e) {
+ if (this.divName != null) {
+ if (this.use_layers) {
+ var clickX = e.pageX;
+ var clickY = e.pageY;
+ var t = document.layers[this.divName];
+ if ((clickX > t.left) && (clickX < t.left+t.clip.width) && (clickY > t.top) && (clickY < t.top+t.clip.height)) {
+ window.calendarAction='Y';
+ return true;
+ }
+ else { return false; }
+ }
+ else if (document.all) { // Need to hard-code this to trap IE for error-handling
+ var t = window.event.srcElement;
+ while (t.parentElement != null) {
+ if (t.id==this.divName) {
+ window.calendarAction='Y';
+ return true;
+ }
+ t = t.parentElement;
+ }
+ return false;
+ }
+ else if (this.use_gebi && e) {
+ var t = e.originalTarget;
+ //console.log(t);
+ while (t && t.parentNode != null) {
+ if (t.id==this.divName) {
+ window.calendarAction='Y';
+ return true;
+ }
+ t = t.parentNode;
+ }
+ return false;
+ }
+ return false;
+ }
+ return false;
+ }
+
+// Check an onMouseDown event to see if we should hide
+function PopupWindow_hideIfNotClicked(e) {
+ if (this.autoHideEnabled && !this.isClicked(e)) {
+
+ this.hidePopup();
+ }
+ }
+// Call this to make the DIV disable automatically when mouse is clicked outside it
+function PopupWindow_autoHide() {
+ this.autoHideEnabled = true;
+ }
+// This global function checks all PopupWindow objects onmouseup to see if they should be hidden
+function PopupWindow_hidePopupWindows(e) {
+ for (var i=0; i<popupWindowObjects.length; i++) {
+ if (popupWindowObjects[i] != null) {
+ var p = popupWindowObjects[i];
+ p.hideIfNotClicked(e);
+ }
+ }
+ }
+// Run this immediately to attach the event listener
+function PopupWindow_attachListener() {
+ if (document.layers) {
+ document.captureEvents(Event.MOUSEUP);
+ }
+ window.popupWindowOldEventListener = document.onmouseup;
+ if (window.popupWindowOldEventListener != null) {
+ document.onmouseup = new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();");
+ }
+ else {
+ document.onmouseup = PopupWindow_hidePopupWindows;
+ }
+ }
+
+// Reset the calendar DIV realted to another DIV
+function PopupWindow_resetPosition(relatedDiv) {
+ //var calendarDiv = document.getElementById("calendarDiv");
+ var calendarDiv = document.getElementById(this.divName);
+ var popupDiv = document.getElementById(relatedDiv);
+ var left = calendarDiv.offsetLeft - popupDiv.offsetLeft;
+ var top = calendarDiv.offsetTop - popupDiv.offsetTop;
+ //alert("left: " + left + " top: " + top);
+
+ calendarDiv.style.left = left + "px";
+ calendarDiv.style.top = top + "px";
+
+ var calendarDivFrame = document.getElementById(this.divName + "frame");
+ var popupDivFrame = document.getElementById(relatedDiv + "frame");
+ var leftFrame = calendarDivFrame.offsetLeft - popupDivFrame.offsetLeft;
+ var topFrame = calendarDivFrame.offsetTop - popupDivFrame.offsetTop;
+ //alert("left: " + left + " top: " + top);
+
+ calendarDivFrame.style.left = leftFrame + "px";
+ calendarDivFrame.style.top = leftFrame + "px";
+}
+
+// CONSTRUCTOR for the PopupWindow object
+// Pass it a DIV name to use a DHTML popup, otherwise will default to window popup
+function PopupWindow() {
+ if (!window.popupWindowIndex) { window.popupWindowIndex = 0; }
+ if (!window.popupWindowObjects) { window.popupWindowObjects = new Array(); }
+ if (!window.listenerAttached) {
+ window.listenerAttached = true;
+ PopupWindow_attachListener();
+ }
+
+ this.index = popupWindowIndex++;
+ popupWindowObjects[this.index] = this;
+ this.divName = null;
+ //added for IE6 issue
+ this.frameName = null
+ this.popupWindow = null;
+ this.width=0;
+ this.height=0;
+ this.populated = false;
+ this.visible = false;
+ this.autoHideEnabled = false;
+
+ this.contents = "";
+ this.url="";
+ this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";
+ if (arguments.length>0) {
+ this.type="DIV";
+ this.divName = arguments[0];
+ //added for IE6 issue
+
+ if (arguments.length>1)
+ this.frameName = arguments[1];
+ }
+ else {
+ this.type="WINDOW";
+ }
+ this.use_gebi = false;
+ this.use_css = false;
+ this.use_layers = false;
+ if (document.getElementById) { this.use_gebi = true; }
+ else if (document.all) { this.use_css = true; }
+ else if (document.layers) { this.use_layers = true; }
+ else { this.type = "WINDOW"; }
+ this.offsetX = 0;
+ this.offsetY = 0;
+ // Method mappings
+ this.getXYPosition = PopupWindow_getXYPosition;
+ this.populate = PopupWindow_populate;
+ this.setUrl = PopupWindow_setUrl;
+ this.setWindowProperties = PopupWindow_setWindowProperties;
+ this.refresh = PopupWindow_refresh;
+ this.showPopup = PopupWindow_showPopup;
+ this.hidePopup = PopupWindow_hidePopup;
+ this.setSize = PopupWindow_setSize;
+ this.isClicked = PopupWindow_isClicked;
+ this.autoHide = PopupWindow_autoHide;
+ this.hideIfNotClicked = PopupWindow_hideIfNotClicked;
+
+ // Added to reset the Calendar DIV when it related with another DIV
+ this.resetPosition = PopupWindow_resetPosition;
+ }
+
+/* SOURCE FILE: CalendarPopup.js */
+
+// HISTORY
+// ------------------------------------------------------------------
+// Feb 7, 2005: Fixed a CSS styles to use px unit
+// March 29, 2004: Added check in select() method for the form field
+// being disabled. If it is, just return and don't do anything.
+// March 24, 2004: Fixed bug - when month name and abbreviations were
+// changed, date format still used original values.
+// January 26, 2004: Added support for drop-down month and year
+// navigation (Thanks to Chris Reid for the idea)
+// September 22, 2003: Fixed a minor problem in YEAR calendar with
+// CSS prefix.
+// August 19, 2003: Renamed the function to get styles, and made it
+// work correctly without an object reference
+// August 18, 2003: Changed showYearNavigation and
+// showYearNavigationInput to optionally take an argument of
+// true or false
+// July 31, 2003: Added text input option for year navigation.
+// Added a per-calendar CSS prefix option to optionally use
+// different styles for different calendars.
+// July 29, 2003: Fixed bug causing the Today link to be clickable
+// even though today falls in a disabled date range.
+// Changed formatting to use pure CSS, allowing greater control
+// over look-and-feel options.
+// June 11, 2003: Fixed bug causing the Today link to be unselectable
+// under certain cases when some days of week are disabled
+// March 14, 2003: Added ability to disable individual dates or date
+// ranges, display as light gray and strike-through
+// March 14, 2003: Removed dependency on graypixel.gif and instead
+/// use table border coloring
+// March 12, 2003: Modified showCalendar() function to allow optional
+// start-date parameter
+// March 11, 2003: Modified select() function to allow optional
+// start-date parameter
+/*
+DESCRIPTION: This object implements a popup calendar to allow the user to
+select a date, month, quarter, or year.
+
+COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small
+positioning errors - usually with Window positioning - occur on the
+Macintosh platform.
+The calendar can be modified to work for any location in the world by
+changing which weekday is displayed as the first column, changing the month
+names, and changing the column headers for each day.
+
+USAGE:
+// Create a new CalendarPopup object of type WINDOW
+var cal = new CalendarPopup();
+
+// Create a new CalendarPopup object of type DIV using the DIV named 'mydiv'
+var cal = new CalendarPopup('mydiv');
+
+// Easy method to link the popup calendar with an input box.
+cal.select(inputObject, anchorname, dateFormat);
+// Same method, but passing a default date other than the field's current value
+cal.select(inputObject, anchorname, dateFormat, '01/02/2000');
+// This is an example call to the popup calendar from a link to populate an
+// input box. Note that to use this, date.js must also be included!!
+<A HREF="#" onClick="cal.select(document.forms[0].date,'anchorname','MM/dd/yyyy'); return false;">Select</A>
+
+// Set the type of date select to be used. By default it is 'date'.
+cal.setDisplayType(type);
+
+// When a date, month, quarter, or year is clicked, a function is called and
+// passed the details. You must write this function, and tell the calendar
+// popup what the function name is.
+// Function to be called for 'date' select receives y, m, d
+cal.setReturnFunction(functionname);
+// Function to be called for 'month' select receives y, m
+cal.setReturnMonthFunction(functionname);
+// Function to be called for 'quarter' select receives y, q
+cal.setReturnQuarterFunction(functionname);
+// Function to be called for 'year' select receives y
+cal.setReturnYearFunction(functionname);
+
+// Show the calendar relative to a given anchor
+cal.showCalendar(anchorname);
+
+// Hide the calendar. The calendar is set to autoHide automatically
+cal.hideCalendar();
+
+// Set the month names to be used. Default are English month names
+cal.setMonthNames("January","February","March",...);
+
+// Set the month abbreviations to be used. Default are English month abbreviations
+cal.setMonthAbbreviations("Jan","Feb","Mar",...);
+
+// Show navigation for changing by the year, not just one month at a time
+cal.showYearNavigation();
+
+// Show month and year dropdowns, for quicker selection of month of dates
+cal.showNavigationDropdowns();
+
+// Set the text to be used above each day column. The days start with
+// sunday regardless of the value of WeekStartDay
+cal.setDayHeaders("S","M","T",...);
+
+// Set the day for the first column in the calendar grid. By default this
+// is Sunday (0) but it may be changed to fit the conventions of other
+// countries.
+cal.setWeekStartDay(1); // week is Monday - Sunday
+
+// Set the weekdays which should be disabled in the 'date' select popup. You can
+// then allow someone to only select week end dates, or Tuedays, for example
+cal.setDisabledWeekDays(0,1); // To disable selecting the 1st or 2nd days of the week
+
+// Selectively disable individual days or date ranges. Disabled days will not
+// be clickable, and show as strike-through text on current browsers.
+// Date format is any format recognized by parseDate() in date.js
+// Pass a single date to disable:
+cal.addDisabledDates("2003-01-01");
+// Pass null as the first parameter to mean "anything up to and including" the
+// passed date:
+cal.addDisabledDates(null, "01/02/03");
+// Pass null as the second parameter to mean "including the passed date and
+// anything after it:
+cal.addDisabledDates("Jan 01, 2003", null);
+// Pass two dates to disable all dates inbetween and including the two
+cal.addDisabledDates("January 01, 2003", "Dec 31, 2003");
+
+// When the 'year' select is displayed, set the number of years back from the
+// current year to start listing years. Default is 2.
+// This is also used for year drop-down, to decide how many years +/- to display
+cal.setYearSelectStartOffset(2);
+
+// Text for the word "Today" appearing on the calendar
+cal.setTodayText("Today");
+
+// The calendar uses CSS classes for formatting. If you want your calendar to
+// have unique styles, you can set the prefix that will be added to all the
+// classes in the output.
+// For example, normal output may have this:
+// <SPAN CLASS="cpTodayTextDisabled">Today<SPAN>
+// But if you set the prefix like this:
+cal.setCssPrefix("Test");
+// The output will then look like:
+// <SPAN CLASS="TestcpTodayTextDisabled">Today<SPAN>
+// And you can define that style somewhere in your page.
+
+// When using Year navigation, you can make the year be an input box, so
+// the user can manually change it and jump to any year
+cal.showYearNavigationInput();
+
+// Set the calendar offset to be different than the default. By default it
+// will appear just below and to the right of the anchorname. So if you have
+// a text box where the date will go and and anchor immediately after the
+// text box, the calendar will display immediately under the text box.
+cal.offsetX = 20;
+cal.offsetY = 20;
+
+NOTES:
+1) Requires the functions in AnchorPosition.js and PopupWindow.js
+
+2) Your anchor tag MUST contain both NAME and ID attributes which are the
+ same. For example:
+ <A NAME="test" ID="test"> </A>
+
+3) There must be at least a space between <A> </A> for IE5.5 to see the
+ anchor tag correctly. Do not do <A></A> with no space.
+
+4) When a CalendarPopup object is created, a handler for 'onmouseup' is
+ attached to any event handler you may have already defined. Do NOT define
+ an event handler for 'onmouseup' after you define a CalendarPopup object
+ or the autoHide() will not work correctly.
+
+5) The calendar popup display uses style sheets to make it look nice.
+
+*/
+
+// CONSTRUCTOR for the CalendarPopup Object
+function CalendarPopup() {
+ var c;
+ //added for IE6 issue
+ if (arguments.length>1) {
+ c = new PopupWindow(arguments[0], arguments[1]);
+ }
+ else if (arguments.length>0) {
+ c = new PopupWindow(arguments[0]);
+ }
+ else {
+ c = new PopupWindow();
+ c.setSize(150,175);
+ }
+ c.offsetX = 20;
+ c.offsetY = 0;
+ c.autoHide();
+ // Calendar-specific properties
+ c.monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
+ c.monthAbbreviations = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
+ c.dayHeaders = new Array("S","M","T","W","T","F","S");
+ c.returnFunction = "CP_tmpReturnFunction";
+ c.returnMonthFunction = "CP_tmpReturnMonthFunction";
+ c.returnQuarterFunction = "CP_tmpReturnQuarterFunction";
+ c.returnYearFunction = "CP_tmpReturnYearFunction";
+ c.weekStartDay = 0;
+ c.isShowYearNavigation = false;
+ c.displayType = "date";
+ c.disabledWeekDays = new Object();
+ c.disabledDatesExpression = "";
+ c.yearSelectStartOffset = 2;
+ c.currentDate = null;
+ c.todayText="Today";
+ c.cssPrefix="";
+ c.isShowNavigationDropdowns=false;
+ c.isShowYearNavigationInput=false;
+ window.CP_calendarObject = null;
+ window.CP_targetInput = null;
+ window.CP_dateFormat = "MM/dd/yyyy";
+ // Method mappings
+ c.copyMonthNamesToWindow = CP_copyMonthNamesToWindow;
+ c.setReturnFunction = CP_setReturnFunction;
+ c.setReturnMonthFunction = CP_setReturnMonthFunction;
+ c.setReturnQuarterFunction = CP_setReturnQuarterFunction;
+ c.setReturnYearFunction = CP_setReturnYearFunction;
+ c.setMonthNames = CP_setMonthNames;
+ c.setMonthAbbreviations = CP_setMonthAbbreviations;
+ c.setDayHeaders = CP_setDayHeaders;
+ c.setWeekStartDay = CP_setWeekStartDay;
+ c.setDisplayType = CP_setDisplayType;
+ c.setDisabledWeekDays = CP_setDisabledWeekDays;
+ c.addDisabledDates = CP_addDisabledDates;
+ c.setYearSelectStartOffset = CP_setYearSelectStartOffset;
+ c.setTodayText = CP_setTodayText;
+ c.showYearNavigation = CP_showYearNavigation;
+ c.showCalendar = CP_showCalendar;
+ c.hideCalendar = CP_hideCalendar;
+ c.getStyles = getCalendarStyles;
+ c.refreshCalendar = CP_refreshCalendar;
+ c.getCalendar = CP_getCalendar;
+ c.select = CP_select;
+ c.setCssPrefix = CP_setCssPrefix;
+ c.showNavigationDropdowns = CP_showNavigationDropdowns;
+ c.showYearNavigationInput = CP_showYearNavigationInput;
+ c.copyMonthNamesToWindow();
+ // Return the object
+ return c;
+ }
+function CP_copyMonthNamesToWindow() {
+ // Copy these values over to the date.js
+ if (typeof(window.MONTH_NAMES)!="undefined" && window.MONTH_NAMES!=null) {
+ window.MONTH_NAMES = new Array();
+ for (var i=0; i<this.monthNames.length; i++) {
+ window.MONTH_NAMES[window.MONTH_NAMES.length] = this.monthNames[i];
+ }
+ for (var i=0; i<this.monthAbbreviations.length; i++) {
+ window.MONTH_NAMES[window.MONTH_NAMES.length] = this.monthAbbreviations[i];
+ }
+ }
+}
+// Temporary default functions to be called when items clicked, so no error is thrown
+function CP_tmpReturnFunction(y,m,d) {
+ if (window.CP_targetInput!=null) {
+ var dt = new Date(y,m-1,d,0,0,0);
+ if (window.CP_calendarObject!=null) { window.CP_calendarObject.copyMonthNamesToWindow(); }
+ window.CP_targetInput.value = formatDate(dt,window.CP_dateFormat);
+ /////////
+ if (window.CP_targetInput.onchange){
+ window.CP_targetInput.onchange();
+ }
+ }
+ else {
+ alert('Use setReturnFunction() to define which function will get the clicked results!');
+ }
+ }
+function CP_tmpReturnMonthFunction(y,m) {
+ alert('Use setReturnMonthFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , month='+m);
+ }
+function CP_tmpReturnQuarterFunction(y,q) {
+ alert('Use setReturnQuarterFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , quarter='+q);
+ }
+function CP_tmpReturnYearFunction(y) {
+ alert('Use setReturnYearFunction() to define which function will get the clicked results!\nYou clicked: year='+y);
+ }
+
+// Set the name of the functions to call to get the clicked item
+function CP_setReturnFunction(name) { this.returnFunction = name; }
+function CP_setReturnMonthFunction(name) { this.returnMonthFunction = name; }
+function CP_setReturnQuarterFunction(name) { this.returnQuarterFunction = name; }
+function CP_setReturnYearFunction(name) { this.returnYearFunction = name; }
+
+// Over-ride the built-in month names
+function CP_setMonthNames() {
+ for (var i=0; i<arguments.length; i++) { this.monthNames[i] = arguments[i]; }
+ this.copyMonthNamesToWindow();
+ }
+
+// Over-ride the built-in month abbreviations
+function CP_setMonthAbbreviations() {
+ for (var i=0; i<arguments.length; i++) { this.monthAbbreviations[i] = arguments[i]; }
+ this.copyMonthNamesToWindow();
+ }
+
+// Over-ride the built-in column headers for each day
+function CP_setDayHeaders() {
+ for (var i=0; i<arguments.length; i++) { this.dayHeaders[i] = arguments[i]; }
+ }
+
+// Set the day of the week (0-7) that the calendar display starts on
+// This is for countries other than the US whose calendar displays start on Monday(1), for example
+function CP_setWeekStartDay(day) { this.weekStartDay = day; }
+
+// Show next/last year navigation links
+function CP_showYearNavigation() { this.isShowYearNavigation = (arguments.length>0)?arguments[0]:true; }
+
+// Which type of calendar to display
+function CP_setDisplayType(type) {
+ if (type!="date"&&type!="week-end"&&type!="month"&&type!="quarter"&&type!="year") { alert("Invalid display type! Must be one of: date,week-end,month,quarter,year"); return false; }
+ this.displayType=type;
+ }
+
+// How many years back to start by default for year display
+function CP_setYearSelectStartOffset(num) { this.yearSelectStartOffset=num; }
+
+// Set which weekdays should not be clickable
+function CP_setDisabledWeekDays() {
+ this.disabledWeekDays = new Object();
+ for (var i=0; i<arguments.length; i++) { this.disabledWeekDays[arguments[i]] = true; }
+ }
+
+// Disable individual dates or ranges
+// Builds an internal logical test which is run via eval() for efficiency
+function CP_addDisabledDates(start, end) {
+ if (arguments.length==1) { end=start; }
+ if (start==null && end==null) { return; }
+ if (this.disabledDatesExpression!="") { this.disabledDatesExpression+= "||"; }
+ if (start!=null) { start = parseDate(start); start=""+start.getFullYear()+LZ(start.getMonth()+1)+LZ(start.getDate());}
+ if (end!=null) { end=parseDate(end); end=""+end.getFullYear()+LZ(end.getMonth()+1)+LZ(end.getDate());}
+ if (start==null) { this.disabledDatesExpression+="(ds<="+end+")"; }
+ else if (end ==null) { this.disabledDatesExpression+="(ds>="+start+")"; }
+ else { this.disabledDatesExpression+="(ds>="+start+"&&ds<="+end+")"; }
+ }
+
+// Set the text to use for the "Today" link
+function CP_setTodayText(text) {
+ this.todayText = text;
+ }
+
+// Set the prefix to be added to all CSS classes when writing output
+function CP_setCssPrefix(val) {
+ this.cssPrefix = val;
+ }
+
+// Show the navigation as an dropdowns that can be manually changed
+function CP_showNavigationDropdowns() { this.isShowNavigationDropdowns = (arguments.length>0)?arguments[0]:true; }
+
+// Show the year navigation as an input box that can be manually changed
+function CP_showYearNavigationInput() { this.isShowYearNavigationInput = (arguments.length>0)?arguments[0]:true; }
+
+// Hide a calendar object
+function CP_hideCalendar() {
+ if (arguments.length > 0) { window.popupWindowObjects[arguments[0]].hidePopup(); }
+ else { this.hidePopup(); }
+ }
+
+
+// Refresh the contents of the calendar display
+function CP_refreshCalendar(index) {
+ var calObject = window.popupWindowObjects[index];
+ if (arguments.length>1) {
+ calObject.populate(calObject.getCalendar(arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]));
+ }
+ else {
+ calObject.populate(calObject.getCalendar());
+ }
+ calObject.refresh();
+ }
+
+// Populate the calendar and display it
+function CP_showCalendar(anchorname) {
+
+ if (arguments.length>1) {
+ if (arguments[1]==null||arguments[1]=="") {
+ //var dd = parseDate();
+ this.currentDate=new Date();
+ //this.currentDate = dd;
+
+ }
+ else {
+ this.currentDate=new Date(parseDate(arguments[1]));
+ }
+ }
+ this.populate(this.getCalendar());
+ this.showPopup(anchorname);
+ }
+
+// Simple method to interface popup calendar with a text-entry box
+function CP_select(inputobj, linkname, format) {
+ var selectedDate=(arguments.length>3)?arguments[3]:null;
+ if (!window.getDateFromFormat) {
+ alert("calendar.select: To use this method you must also include 'date.js' for date formatting");
+ return;
+ }
+ if (this.displayType!="date"&&this.displayType!="week-end") {
+ alert("calendar.select: This function can only be used with displayType 'date' or 'week-end'");
+ return;
+ }
+ if (inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea") {
+ alert("calendar.select: Input object passed is not a valid form input object");
+ window.CP_targetInput=null;
+ return;
+ }
+ if (inputobj.disabled) { return; } // Can't use calendar input on disabled form input!
+ window.CP_targetInput = inputobj;
+ window.CP_calendarObject = this;
+ this.currentDate=null;
+ var time=0;
+ if (selectedDate!=null) {
+ time = getDateFromFormat(selectedDate,format)
+ }
+ else if (inputobj.value!="") {
+ time = getDateFromFormat(inputobj.value,format);
+ }
+ if (selectedDate!=null || inputobj.value!="") {
+ if (time==0) { this.currentDate=null; }
+ else { this.currentDate=new Date(time); }
+ }
+ window.CP_dateFormat = format;
+ this.showCalendar(linkname);
+ }
+
+// Get style block needed to display the calendar correctly
+function getCalendarStyles() {
+ var result = "";
+ var p = "";
+ if (this!=null && typeof(this.cssPrefix)!="undefined" && this.cssPrefix!=null && this.cssPrefix!="") { p=this.cssPrefix; }
+ result += "<STYLE>\n";
+ result += "."+p+"cpYearNavigation,."+p+"cpMonthNavigation { background-color:#C0C0C0; text-align:center; vertical-align:center; text-decoration:none; color:#000000; font-weight:bold; }\n";
+ result += "."+p+"cpDayColumnHeader, ."+p+"cpYearNavigation,."+p+"cpMonthNavigation,."+p+"cpCurrentMonthDate,."+p+"cpCurrentMonthDateDisabled,."+p+"cpOtherMonthDate,."+p+"cpOtherMonthDateDisabled,."+p+"cpCurrentDate,."+p+"cpCurrentDateDisabled,."+p+"cpTodayText,."+p+"cpTodayTextDisabled,."+p+"cpText { font-family:arial; font-size:8pt; }\n";
+ result += "TD."+p+"cpDayColumnHeader { text-align:right; border:solid thin #C0C0C0;border-width:0px 0px 1px 0px; }\n";
+ result += "."+p+"cpCurrentMonthDate, ."+p+"cpOtherMonthDate, ."+p+"cpCurrentDate { text-align:right; text-decoration:none; }\n";
+ result += "."+p+"cpCurrentMonthDateDisabled, ."+p+"cpOtherMonthDateDisabled, ."+p+"cpCurrentDateDisabled { color:#D0D0D0; text-align:right; text-decoration:line-through; }\n";
+ result += "."+p+"cpCurrentMonthDate, .cpCurrentDate { color:#000000; }\n";
+ result += "."+p+"cpOtherMonthDate { color:#808080; }\n";
+ result += "TD."+p+"cpCurrentDate { color:white; background-color: #C0C0C0; border-width:1px; border:solid thin #800000; }\n";
+ result += "TD."+p+"cpCurrentDateDisabled { border-width:1px; border:solid thin #FFAAAA; }\n";
+ result += "TD."+p+"cpTodayText, TD."+p+"cpTodayTextDisabled { border:solid thin #C0C0C0; border-width:1px 0px 0px 0px;}\n";
+ result += "A."+p+"cpTodayText, SPAN."+p+"cpTodayTextDisabled { height:20px; }\n";
+ result += "A."+p+"cpTodayText { color:black; }\n";
+ result += "."+p+"cpTodayTextDisabled { color:#D0D0D0; }\n";
+ result += "."+p+"cpBorder { border:solid thin #808080; }\n";
+ result += "</STYLE>\n";
+ return result;
+ }
+
+// Return a string containing all the calendar code to be displayed
+function CP_getCalendar() {
+ var now = new Date();
+ if (typeof oracleDateString == 'function'){
+ now = parseDate(oracleDateString());
+ }else if (typeof parent.oracleDateString == 'function'){
+ now = parseDate(parent.oracleDateString());
+ }
+ // Reference to window
+ if (this.type == "WINDOW") { var windowref = "window.opener."; }
+ else { var windowref = ""; }
+ var result = "";
+ // If POPUP, write entire HTML document
+ if (this.type == "WINDOW") {
+ result += "<HTML><HEAD><TITLE>Calendar</TITLE>"+this.getStyles()+"</HEAD><BODY MARGINWIDTH=0 MARGINHEIGHT=0 TOPMARGIN=0 RIGHTMARGIN=0 LEFTMARGIN=0>\n";
+ result += '<CENTER><TABLE WIDTH=100% BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>\n';
+ }
+ else {
+ result += '<TABLE CLASS="'+this.cssPrefix+'cpBorder" WIDTH=144 BORDER=1 BORDERWIDTH=1 CELLSPACING=0 CELLPADDING=1>\n';
+ result += '<TR><TD ALIGN=CENTER>\n';
+ result += '<CENTER>\n';
+ }
+ // Code for DATE display (default)
+ // -------------------------------
+ if (this.displayType=="date" || this.displayType=="week-end") {
+ if (this.currentDate==null) { this.currentDate = now; }
+ if (arguments.length > 0) { var month = arguments[0]; }
+ else { var month = this.currentDate.getMonth()+1; }
+ if (arguments.length > 1 && arguments[1]>0 && arguments[1]-0==arguments[1]) { var year = arguments[1]; }
+ else { var year = this.currentDate.getFullYear(); }
+ var daysinmonth= new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);
+ if ( ( (year%4 == 0)&&(year%100 != 0) ) || (year%400 == 0) ) {
+ daysinmonth[2] = 29;
+ }
+ var current_month = new Date(year,month-1,1);
+ var display_year = year;
+ var display_month = month;
+ var display_date = 1;
+ var weekday= current_month.getDay();
+ var offset = 0;
+
+ offset = (weekday >= this.weekStartDay) ? weekday-this.weekStartDay : 7-this.weekStartDay+weekday ;
+ if (offset > 0) {
+ display_month--;
+ if (display_month < 1) { display_month = 12; display_year--; }
+ display_date = daysinmonth[display_month]-offset+1;
+ }
+ var next_month = month+1;
+ var next_month_year = year;
+ if (next_month > 12) { next_month=1; next_month_year++; }
+ var last_month = month-1;
+ var last_month_year = year;
+ if (last_month < 1) { last_month=12; last_month_year--; }
+ var date_class;
+ if (this.type!="WINDOW") {
+ result += "<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";
+ }
+ result += '<TR>\n';
+ var refresh = windowref+'CP_refreshCalendar';
+ var refreshLink = 'javascript:' + refresh;
+ if (this.isShowNavigationDropdowns) {
+ result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="78" COLSPAN="3"><select CLASS="'+this.cssPrefix+'cpMonthNavigation" name="cpMonth" onChange="'+refresh+'('+this.index+',this.options[this.selectedIndex].value-0,'+(year-0)+');">';
+ for( var monthCounter=1; monthCounter<=12; monthCounter++ ) {
+ var selected = (monthCounter==month) ? 'SELECTED' : '';
+ result += '<option value="'+monthCounter+'" '+selected+'>'+this.monthNames[monthCounter-1]+'</option>';
+ }
+ result += '</select></TD>';
+ result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10">&nbsp;</TD>';
+
+ result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="56" COLSPAN="3"><select CLASS="'+this.cssPrefix+'cpYearNavigation" name="cpYear" onChange="'+refresh+'('+this.index+','+month+',this.options[this.selectedIndex].value-0);">';
+ for( var yearCounter=year-this.yearSelectStartOffset; yearCounter<=year+this.yearSelectStartOffset; yearCounter++ ) {
+ var selected = (yearCounter==year) ? 'SELECTED' : '';
+ result += '<option value="'+yearCounter+'" '+selected+'>'+yearCounter+'</option>';
+ }
+ result += '</select></TD>';
+ }
+ else {
+ if (this.isShowYearNavigation) {
+ result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+last_month+','+last_month_year+');">&lt;</A></TD>';
+ result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="58"><SPAN CLASS="'+this.cssPrefix+'cpMonthNavigation">'+this.monthNames[month-1]+'</SPAN></TD>';
+ result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+next_month+','+next_month_year+');">&gt;</A></TD>';
+ result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10">&nbsp;</TD>';
+
+ result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="'+refreshLink+'('+this.index+','+month+','+(year-1)+');">&lt;</A></TD>';
+ if (this.isShowYearNavigationInput) {
+ result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="36"><INPUT NAME="cpYear" CLASS="'+this.cssPrefix+'cpYearNavigation" SIZE="4" MAXLENGTH="4" VALUE="'+year+'" onBlur="'+refresh+'('+this.index+','+month+',this.value-0);"></TD>';
+ }
+ else {
+ result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="36"><SPAN CLASS="'+this.cssPrefix+'cpYearNavigation">'+year+'</SPAN></TD>';
+ }
+ result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="'+refreshLink+'('+this.index+','+month+','+(year+1)+');">&gt;</A></TD>';
+ }
+ else {
+ result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+last_month+','+last_month_year+');">&lt;&lt;</A></TD>\n';
+ result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="100"><SPAN CLASS="'+this.cssPrefix+'cpMonthNavigation">'+this.monthNames[month-1]+' '+year+'</SPAN></TD>\n';
+ result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+next_month+','+next_month_year+');">&gt;&gt;</A></TD>\n';
+ }
+ }
+ result += '</TR></TABLE>\n';
+ result += '<TABLE WIDTH=120 BORDER=0 CELLSPACING=0 CELLPADDING=1 ALIGN=CENTER>\n';
+ result += '<TR>\n';
+ for (var j=0; j<7; j++) {
+
+ result += '<TD CLASS="'+this.cssPrefix+'cpDayColumnHeader" WIDTH="14%"><SPAN CLASS="'+this.cssPrefix+'cpDayColumnHeader">'+this.dayHeaders[(this.weekStartDay+j)%7]+'</TD>\n';
+ }
+ result += '</TR>\n';
+ for (var row=1; row<=6; row++) {
+ result += '<TR>\n';
+ for (var col=1; col<=7; col++) {
+ var disabled=false;
+ if (this.disabledDatesExpression!="") {
+ var ds=""+display_year+LZ(display_month)+LZ(display_date);
+ eval("disabled=("+this.disabledDatesExpression+")");
+ }
+ var dateClass = "";
+ if ((display_month == this.currentDate.getMonth()+1) && (display_date==this.currentDate.getDate()) && (display_year==this.currentDate.getFullYear())) {
+ dateClass = "cpCurrentDate";
+ }
+ else if (display_month == month) {
+ dateClass = "cpCurrentMonthDate";
+ }
+ else {
+ dateClass = "cpOtherMonthDate";
+ }
+ if (disabled || this.disabledWeekDays[col-1]) {
+ result += ' <TD CLASS="'+this.cssPrefix+dateClass+'"><SPAN CLASS="'+this.cssPrefix+dateClass+'Disabled">'+display_date+'</SPAN></TD>\n';
+ }
+ else {
+ var selected_date = display_date;
+ var selected_month = display_month;
+ var selected_year = display_year;
+ if (this.displayType=="week-end") {
+ var d = new Date(selected_year,selected_month-1,selected_date,0,0,0,0);
+ d.setDate(d.getDate() + (7-col));
+ selected_year = d.getYear();
+ if (selected_year < 1000) { selected_year += 1900; }
+ selected_month = d.getMonth()+1;
+ selected_date = d.getDate();
+ }
+ result += ' <TD CLASS="'+this.cssPrefix+dateClass+'"><A HREF="javascript:'+windowref+this.returnFunction+'('+selected_year+','+selected_month+','+selected_date+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+this.cssPrefix+dateClass+'">'+display_date+'</A></TD>\n';
+ }
+ display_date++;
+ if (display_date > daysinmonth[display_month]) {
+ display_date=1;
+ display_month++;
+ }
+ if (display_month > 12) {
+ display_month=1;
+ display_year++;
+ }
+ }
+ result += '</TR>';
+ }
+ var current_weekday = now.getDay() - this.weekStartDay;
+ if (current_weekday < 0) {
+ current_weekday += 7;
+ }
+ result += '<TR>\n';
+ result += ' <TD COLSPAN=7 ALIGN=CENTER CLASS="'+this.cssPrefix+'cpTodayText">\n';
+ if (this.disabledDatesExpression!="") {
+ var ds=""+now.getFullYear()+LZ(now.getMonth()+1)+LZ(now.getDate());
+ eval("disabled=("+this.disabledDatesExpression+")");
+ }
+ if (disabled || this.disabledWeekDays[current_weekday+1]) {
+ result += ' <SPAN CLASS="'+this.cssPrefix+'cpTodayTextDisabled">'+this.todayText+'</SPAN>\n';
+ }
+ else {
+ result += ' <A CLASS="'+this.cssPrefix+'cpTodayText" HREF="javascript:'+windowref+this.returnFunction+'(\''+now.getFullYear()+'\',\''+(now.getMonth()+1)+'\',\''+now.getDate()+'\');'+windowref+'CP_hideCalendar(\''+this.index+'\');">'+this.todayText+'</A>\n';
+ }
+ result += ' <BR>\n';
+ result += ' </TD></TR></TABLE></CENTER></TD></TR></TABLE>\n';
+ }
+
+ // Code common for MONTH, QUARTER, YEAR
+ // ------------------------------------
+ if (this.displayType=="month" || this.displayType=="quarter" || this.displayType=="year") {
+ if (arguments.length > 0) { var year = arguments[0]; }
+ else {
+ if (this.displayType=="year") { var year = now.getFullYear()-this.yearSelectStartOffset; }
+ else { var year = now.getFullYear(); }
+ }
+ if (this.displayType!="year" && this.isShowYearNavigation) {
+ result += "<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";
+ result += '<TR>\n';
+ result += ' <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year-1)+');">&lt;&lt;</A></TD>\n';
+ result += ' <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="100">'+year+'</TD>\n';
+ result += ' <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year+1)+');">&gt;&gt;</A></TD>\n';
+ result += '</TR></TABLE>\n';
+ }
+ }
+
+ // Code for MONTH display
+ // ----------------------
+ if (this.displayType=="month") {
+ // If POPUP, write entire HTML document
+ result += '<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n';
+ for (var i=0; i<4; i++) {
+ result += '<TR>';
+ for (var j=0; j<3; j++) {
+ var monthindex = ((i*3)+j);
+ result += '<TD WIDTH=33% ALIGN=CENTER><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnMonthFunction+'('+year+','+(monthindex+1)+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+date_class+'">'+this.monthAbbreviations[monthindex]+'</A></TD>';
+ }
+ result += '</TR>';
+ }
+ result += '</TABLE></CENTER></TD></TR></TABLE>\n';
+ }
+
+ // Code for QUARTER display
+ // ------------------------
+ if (this.displayType=="quarter") {
+ result += '<BR><TABLE WIDTH=120 BORDER=1 CELLSPACING=0 CELLPADDING=0 ALIGN=CENTER>\n';
+ for (var i=0; i<2; i++) {
+ result += '<TR>';
+ for (var j=0; j<2; j++) {
+ var quarter = ((i*2)+j+1);
+ result += '<TD WIDTH=50% ALIGN=CENTER><BR><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnQuarterFunction+'('+year+','+quarter+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+date_class+'">Q'+quarter+'</A><BR><BR></TD>';
+ }
+ result += '</TR>';
+ }
+ result += '</TABLE></CENTER></TD></TR></TABLE>\n';
+ }
+
+ // Code for YEAR display
+ // ---------------------
+ if (this.displayType=="year") {
+ var yearColumnSize = 4;
+ result += "<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";
+ result += '<TR>\n';
+ result += ' <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="50%"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year-(yearColumnSize*2))+');">&lt;&lt;</A></TD>\n';
+ result += ' <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="50%"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year+(yearColumnSize*2))+');">&gt;&gt;</A></TD>\n';
+ result += '</TR></TABLE>\n';
+ result += '<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n';
+ for (var i=0; i<yearColumnSize; i++) {
+ for (var j=0; j<2; j++) {
+ var currentyear = year+(j*yearColumnSize)+i;
+ result += '<TD WIDTH=50% ALIGN=CENTER><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnYearFunction+'('+currentyear+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+date_class+'">'+currentyear+'</A></TD>';
+ }
+ result += '</TR>';
+ }
+ result += '</TABLE></CENTER></TD></TR></TABLE>\n';
+ }
+ // Common
+ if (this.type == "WINDOW") {
+ result += "</BODY></HTML>\n";
+ }
+ return result;
+ }
+
+//added for IE6 issue
+
+function showFrame(divName, frameName){
+
+ // added to show Iframe behind calender
+ var oIfr = document.getElementById(frameName);
+ var oCal = document.getElementById(divName);
+ if (oIfr != null){
+ oIfr.style.display='block';
+ oIfr.style.top=oCal.style.top;
+ oIfr.style.left=oCal.style.left;
+ }
+
+}
+function hideFrame(divName, frameName){
+ var oIfr = document.getElementById(frameName);
+ if (oIfr != null){
+ oIfr.style.display='none';
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax.js
new file mode 100644
index 00000000..c24c2688
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax.js
@@ -0,0 +1,214 @@
+/* Simple AJAX Code-Kit (SACK) v1.6.1 */
+/* ©2005 Gregory Wild-Smith */
+/* www.twilightuniverse.com */
+/* Software licenced under a modified X11 licence,
+ see documentation or authors website for more details */
+
+function sack(file) {
+ this.xmlhttp = null;
+
+ this.resetData = function() {
+ this.method = "POST";
+ this.queryStringSeparator = "?";
+ this.argumentSeparator = "&";
+ this.URLString = "";
+ this.encodeURIString = true;
+ this.execute = false;
+ this.element = null;
+ this.elementObj = null;
+ this.requestFile = file;
+ this.vars = new Object();
+ this.responseStatus = new Array(2);
+ };
+
+ this.resetFunctions = function() {
+ this.onLoading = function() { };
+ this.onLoaded = function() { };
+ this.onInteractive = function() { };
+ this.onCompletion = function() { };
+ this.onError = function() { };
+ this.onFail = function() { };
+ };
+
+ this.reset = function() {
+ this.resetFunctions();
+ this.resetData();
+ };
+
+ this.createAJAX = function() {
+ try {
+ this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+ } catch (e1) {
+ try {
+ this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+ } catch (e2) {
+ this.xmlhttp = null;
+ }
+ }
+
+ if (! this.xmlhttp) {
+ if (typeof XMLHttpRequest != "undefined") {
+ this.xmlhttp = new XMLHttpRequest();
+ } else {
+ this.failed = true;
+ }
+ }
+ };
+
+ /*Modified by Sundar: to accept POST request*/
+ this.setVar = function(name, value, index){
+ if(index)
+ this.vars[name+'~'+index] = Array(value, false);
+ else
+ this.vars[name+'~'+0] = Array(value, false);
+ };
+
+ this.encVar = function(name, value, returnvars) {
+ if (true == returnvars) {
+ return Array(encodeURIComponent(name), encodeURIComponent(value));
+ } else {
+ this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
+ }
+ }
+
+ this.processURLString = function(string, encode) {
+ encoded = encodeURIComponent(this.argumentSeparator);
+ regexp = new RegExp(this.argumentSeparator + "|" + encoded);
+ varArray = string.split(regexp);
+ for (i = 0; i < varArray.length; i++){
+ urlVars = varArray[i].split("=");
+ if (true == encode){
+ this.encVar(urlVars[0], urlVars[1]);
+ } else {
+ this.setVar(urlVars[0], urlVars[1]);
+ }
+ }
+ }
+
+ this.createURLString = function(urlstring) {
+ if (this.encodeURIString && this.URLString.length) {
+ this.processURLString(this.URLString, true);
+ }
+
+ if (urlstring) {
+ if (this.URLString.length) {
+ this.URLString += this.argumentSeparator + urlstring;
+ } else {
+ this.URLString = urlstring;
+ }
+ }
+
+ // prevents caching of URLString
+ this.setVar("rndval", new Date().getTime());
+
+ urlstringtemp = new Array();
+ /*Modified by Sundar: to accept POST request*/
+ var key1 = "";
+ for (key in this.vars) {
+ if (false == this.vars[key][1] && true == this.encodeURIString) {
+ encoded = this.encVar(key, this.vars[key][0], true);
+ delete this.vars[key];
+ this.vars[encoded[0]] = Array(encoded[1], true);
+ key = encoded[0];
+ }
+ key1 = key.substr(0,key.indexOf('~'));
+ //alert("Key " + key1);
+ urlstringtemp[urlstringtemp.length] = key1 + "=" + this.vars[key][0];
+ }
+ if (urlstring){
+ this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
+ } else {
+ this.URLString += urlstringtemp.join(this.argumentSeparator);
+ }
+ //alert("URLString " + this.URLString);
+
+ }
+
+ this.runResponse = function() {
+ eval(this.response);
+ }
+
+
+ this.runAJAX = function(urlstring,noWaitForResponse,timeOut) {
+
+ if(noWaitForResponse == null){
+ noWaitForResponse = true;
+ }
+
+ if (this.failed) {
+ this.onFail();
+ } else {
+ this.createURLString(urlstring);
+ if (this.element) {
+ this.elementObj = document.getElementById(this.element);
+ }
+ if (this.xmlhttp) {
+ var self = this;
+ //SUNDAR: Added timeout for synchronous AJAX
+ if(!noWaitForResponse && timeOut != null && !isNaN(timeOut)){
+ window.setTimeout("dummyFunction()",timeOut);
+ }
+ if (this.method == "GET") {
+ totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
+ this.xmlhttp.open(this.method, totalurlstring, noWaitForResponse);
+ } else {
+
+ this.xmlhttp.open(this.method, this.requestFile, noWaitForResponse);
+ try {
+ this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
+ } catch (e) { }
+ }
+
+ this.xmlhttp.onreadystatechange = function() {
+ //alert("AJAX READY " + self.xmlhttp.readyState);
+ switch (self.xmlhttp.readyState) {
+ case 1:
+ self.onLoading();
+ break;
+ case 2:
+ self.onLoaded();
+ break;
+ case 3:
+ self.onInteractive();
+ break;
+ case 4:
+ self.response = self.xmlhttp.responseText;
+ self.responseXML = self.xmlhttp.responseXML;
+ self.responseStatus[0] = self.xmlhttp.status;
+ self.responseStatus[1] = self.xmlhttp.statusText;
+
+ if (self.execute) {
+ self.runResponse();
+ }
+
+ if (self.elementObj) {
+ elemNodeName = self.elementObj.nodeName;
+ elemNodeName.toLowerCase();
+ if (elemNodeName == "input"
+ || elemNodeName == "select"
+ || elemNodeName == "option"
+ || elemNodeName == "textarea") {
+ self.elementObj.value = self.response;
+ } else {
+ self.elementObj.innerHTML = self.response;
+ }
+ }
+ if (self.responseStatus[0] == "200") {
+ self.onCompletion();
+ } else {
+ self.onError();
+ }
+
+ self.URLString = "";
+ break;
+ }
+ };
+
+ this.xmlhttp.send(this.URLString);
+ }
+ }
+ };
+
+ this.reset();
+ this.createAJAX();
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax_dynamic_content.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax_dynamic_content.js
new file mode 100644
index 00000000..077932e1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax_dynamic_content.js
@@ -0,0 +1,97 @@
+
+/***********************************************
+* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
+* This notice MUST stay intact for legal use
+* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
+***********************************************/
+
+var loadedobjects=""
+var rootdomain="http://"+window.location.hostname
+
+function ajaxpage(url, containerid){
+
+var page_request = false;
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
+ } catch (e) {
+ //alert("Permission UniversalBrowserRead denied.");
+ }
+if (window.XMLHttpRequest) // if Mozilla, Safari etc
+page_request = new XMLHttpRequest()
+else if (window.ActiveXObject){ // if IE
+try {
+page_request = new ActiveXObject("Msxml2.XMLHTTP")
+}
+catch (e1){
+try{
+page_request = new ActiveXObject("Microsoft.XMLHTTP")
+}
+catch (e1){ page_request = null; alert('permission denied');
+}
+}
+}
+else
+return false
+page_request.onreadystatechange=function(){
+loadpage(page_request, containerid)
+}
+// This is a fix made since IE doesn't refresh the page
+var ajaxRightNow = new Date();
+var noCacheAjaxurl = url + ((/\?/.test(url)) ? "&" : "?") + "ajaxRandomTimestamp=" + ajaxRightNow.getTime();
+page_request.open('GET', noCacheAjaxurl, true)
+page_request.send(null)
+}
+
+function loadpage(page_request, containerid){
+var div = document.getElementById(containerid);
+if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
+ div.innerHTML=page_request.responseText;
+ var x = div.getElementsByTagName("script");
+ for(var i=0;i<x.length;i++)
+ {
+ if(x[i].text.indexOf("resizeDivScrollbar")>=0)
+ eval(x[i].text);
+ }
+}
+
+function resizeDivScrollbar(){
+ var frame = document.getElementById("scrollableTableResult");
+ var parentBody = window.parent.document.body;
+ var parentMenu = window.parent.document.getElementById("application");
+ if(frame!=null) {
+ //alert(frame.clientHeight + " " + window.parent.document.body.clientHeight);
+ if (frame.clientHeight > window.parent.document.body.clientHeight) {
+ frame.style.height = window.parent.document.body.clientHeight-350;
+ } else
+ frame.style.height = window.parent.document.body.clientHeight;
+ parentMenu.style.width = frame.clientWidth+200;
+ }
+}
+
+
+function loadobjs(){
+if (!document.getElementById)
+return
+for (i=0; i<arguments.length; i++){
+var file=arguments[i]
+var fileref=""
+if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
+if (file.indexOf(".js")!=-1){ //If object is a js file
+fileref=document.createElement('script')
+fileref.setAttribute("type","text/javascript");
+fileref.setAttribute("src", file);
+}
+else if (file.indexOf(".css")!=-1){ //If object is a css file
+fileref=document.createElement("link")
+fileref.setAttribute("rel", "stylesheet");
+fileref.setAttribute("type", "text/css");
+fileref.setAttribute("href", file);
+}
+}
+if (fileref!=""){
+document.getElementsByTagName("head").item(0).appendChild(fileref)
+loadedobjects+=file+" " //Remember this object as being already added to page
+}
+}
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/cingular_button.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/cingular_button.js
new file mode 100644
index 00000000..9a053183
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/cingular_button.js
@@ -0,0 +1,217 @@
+function CingularButton() {
+}
+
+CingularButton.prototype = new GControl();
+
+CingularButton.globals = {
+ listOptionContainer: null,
+ listOptionVisible: false
+};
+
+CingularButton.prototype.initialize = function(map) {
+ var globals = CingularButton.globals;
+ var cbContainer;
+ var listOptionContainer;
+ var button;
+ var buttonText;
+
+ cbContainer = document.createElement("div");
+ cbContainer.style.zIndex = "150";
+
+ listOptionContainer = document.createElement("div");
+ this.setMenuContainerStyle(listOptionContainer);
+ this.initializeMonthListMenu(listOptionContainer);
+
+ //create button
+ var gmwButtonContainer = document.createElement("div");
+
+ button = document.createElement("div");
+ button.appendChild(document.createTextNode("Previous"));
+ gmwButtonContainer.appendChild(button);
+ NovaButton.prototype.setButtonStyle(button, true);
+ GEvent.addDomListener(button, "click", previousMonthClickEvent);
+
+ button = document.createElement("div");
+ button.appendChild(document.createTextNode("2008/01"));
+ button.id = "currentMonthDiv";
+ gmwButtonContainer.appendChild(button);
+ NovaButton.prototype.setButtonStyle(button, true);
+ GEvent.addDomListener(button, "click", currentMonthClickEvent);
+
+ button = document.createElement("div");
+ button.appendChild(document.createTextNode("Next"));
+ gmwButtonContainer.appendChild(button);
+ NovaButton.prototype.setButtonStyle(button, true);
+ GEvent.addDomListener(button, "click", nextMonthClickEvent);
+
+ cbContainer.appendChild(gmwButtonContainer);
+ cbContainer.appendChild(listOptionContainer);
+
+ map.getContainer().appendChild(cbContainer);
+
+ //set global variables
+ globals.listOptionContainer = listOptionContainer;
+ return cbContainer;
+}
+
+CingularButton.prototype.getDefaultPosition = function() {
+ return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(5, 30));
+}
+
+CingularButton.prototype.initializeMonthListMenu = function(container) {
+ var menuUL = container.appendChild(document.createElement("ul"));
+ this.setMenuStyle(menuUL);
+
+ var minMonth = 1;
+ var minYear = 2008;
+
+ var maxMonth = 12;
+ var maxYear = 2010;
+
+ for (currentYear = minYear; currentYear <= maxYear; currentYear++) {
+ for (currentMonth = minMonth; currentMonth <= maxMonth; currentMonth++) {
+ var menuItem = document.createElement("li");
+ this.setMenuItemStyle(menuItem);
+
+ if (currentMonth < 10) {
+ menuItem.appendChild(document.createTextNode(currentYear + "/0" + currentMonth));
+ menuItem.id = currentYear + "/0" + currentMonth;
+ }
+ else {
+ menuItem.appendChild(document.createTextNode(currentYear + "/" + currentMonth));
+ menuItem.id = currentYear + "/" + currentMonth;
+ }
+
+ GEvent.addDomListener(menuItem, "click", menuItemOnClick);
+ GEvent.addDomListener(menuItem, "mouseover", menuItemOnMouseOver);
+ GEvent.addDomListener(menuItem, "mouseout", menuItemOnMouseOut);
+ menuUL.appendChild(menuItem);
+ }
+ }
+}
+
+CingularButton.prototype.showListOption = function(posX, posY) {
+ var global = CingularButton.globals;
+
+ //position the menu at the given location
+ if(typeof posX == "number") {
+ global.listOptionContainer.style.left = posX + "px";
+ }
+
+ if(typeof posY == "number") {
+ global.listOptionContainer.style.top = posY + "px";
+ }
+
+ //display the menu
+ global.listOptionContainer.style.display = "block";
+}
+
+CingularButton.prototype.setButtonStyle = function(button) {
+ button.style.color = "black";
+ button.style.backgroundColor = "white";
+ button.style.fontFamily = "Verdana";
+ button.style.fontSize = "12px";
+ button.style.fontWeight= "normal";
+ button.style.border = "1px solid gray";
+ button.style.padding = "0px";
+ button.style.marginBottom = "0px";
+ button.style.textAlign = "center";
+ button.style.width = "7em";
+ button.style.height = "15px";
+ button.style.cursor = "pointer";
+
+ if(button.addEventListener) {
+ button.style.cssFloat = "left";
+ }
+ else {
+ button.style.styleFloat = "left";
+ }
+}
+
+CingularButton.prototype.setMenuContainerStyle = function(menuContainer) {
+ menuContainer.style.position = "absolute";
+ menuContainer.style.overflow = "auto";
+ menuContainer.style.height = "200px";
+ menuContainer.style.display = "none";
+ menuContainer.style.background = "#FFFFF0";
+}
+
+CingularButton.prototype.setMenuStyle = function(menu) {
+ menu.style.margin = "2";
+ menu.style.width = "100px";
+ menu.style.padding = "0px 30px 0px 0px";
+ menu.style.listStyleType= "none";
+ menu.style.background = "#FFFFF0";
+}
+
+CingularButton.prototype.setMenuItemStyle = function(menuItem) {
+ menuItem.style.padding = "4px 3px 4px 33px";
+ menuItem.style.fontFamily = "Vardana, Arial, Helvetica, sans-serif";
+ menuItem.style.fontSize = "10pt";
+ menuItem.style.color = "#333";
+ menuItem.style.cursor = "default";
+ menuItem.style.background = "no-repeat left center";
+}
+
+var previousMonthClickEvent = function() {
+ updateImage(-1);
+ NovaButton.prototype.initializeLayerDiv(NovaButton.globals.layerOptionContainer);
+}
+
+var nextMonthClickEvent = function() {
+ updateImage(1);
+ NovaButton.prototype.initializeLayerDiv(NovaButton.globals.layerOptionContainer);
+}
+
+function currentMonthClickEvent(e) {
+ if (CingularButton.globals.listOptionVisible) {
+ CingularButton.globals.listOptionVisible = false;
+ CingularButton.globals.listOptionContainer.style.display = "none";
+ return;
+ }
+
+ if (NovaButton.globals.layerOptionContainer.style.display != "none"){
+ NovaButton.prototype.showLayerClickEvent();
+ }
+ if (NovaButton.globals.searchOptionContainer.style.display != "none"){
+ NovaButton.prototype.searchClickEvent();
+ }
+
+ if (!e) {
+ e = window.event;
+ }
+
+ e.cancelBubble = true;
+
+ if (e.stopPropagation) {
+ e.stopPropagation();
+ }
+
+ var posX = this.offsetLeft;
+ var posY = this.offsetTop;
+
+ CingularButton.prototype.showListOption(posX, posY + this.offsetHeight);
+ CingularButton.globals.listOptionVisible = true;
+}
+
+function menuItemOnClick() {
+ updateImage(this.id);
+ CingularButton.globals.listOptionVisible = false;
+ CingularButton.globals.listOptionContainer.style.display = "none";
+ NovaButton.prototype.initializeLayerDiv(NovaButton.globals.layerOptionContainer);
+}
+
+
+function menuItemOnMouseOver() {
+ this.style.padding = "3px 2px 3px 32px";
+ this.style.color = "#000";
+ this.style.border = "1px solid #06C";
+ this.style.backgroundColor = "#fec";
+}
+
+function menuItemOnMouseOut() {
+ this.style.padding = "4px 3px 4px 33px";
+ this.style.color = "#333";
+ this.style.border = "none";
+ this.style.backgroundColor = "";
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/drupal.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/drupal.js
new file mode 100644
index 00000000..cb605f9b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/drupal.js
@@ -0,0 +1,1018 @@
+// $Id: jquery.js,v 1.12.2.3 2008/06/25 09:38:39 goba Exp $
+
+/*
+ * jQuery 1.2.6 - New Wave Javascript
+ *
+ * Copyright (c) 2008 John Resig (jquery.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008)
+ * Rev: 5685
+ */
+eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(H(){J w=1b.4M,3m$=1b.$;J D=1b.4M=1b.$=H(a,b){I 2B D.17.5j(a,b)};J u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/,62=/^.[^:#\\[\\.]*$/,12;D.17=D.44={5j:H(d,b){d=d||S;G(d.16){7[0]=d;7.K=1;I 7}G(1j d=="23"){J c=u.2D(d);G(c&&(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.61(c[3]);G(a){G(a.2v!=c[3])I D().2q(d);I D(a)}d=[]}}N I D(b).2q(d)}N G(D.1D(d))I D(S)[D.17.27?"27":"43"](d);I 7.6Y(D.2d(d))},5w:"1.2.6",8G:H(){I 7.K},K:0,3p:H(a){I a==12?D.2d(7):7[a]},2I:H(b){J a=D(b);a.5n=7;I a},6Y:H(a){7.K=0;2p.44.1p.1w(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5i:H(b){J a=-1;I D.2L(b&&b.5w?b[0]:b,7)},1K:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&&D[b||"1K"](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1n d)D.1K(b?7.V:7,c,D.1i(7,d[c],b,i,c))})},1g:H(b,a){G((b==\'2h\'||b==\'1Z\')&&3d(a)<0)a=12;I 7.1K(b,a,"2a")},1r:H(b){G(1j b!="49"&&b!=U)I 7.4E().3v((7[0]&&7[0].2z||S).5F(b));J a="";D.P(b||7,H(){D.P(7.3t,H(){G(7.16!=8)a+=7.16!=1?7.76:D.17.1r([7])})});I a},5z:H(b){G(7[0])D(b,7[0].2z).5y().39(7[0]).2l(H(){J a=7;1B(a.1x)a=a.1x;I a}).3v(7);I 7},8Y:H(a){I 7.P(H(){D(7).6Q().5z(a)})},8R:H(a){I 7.P(H(){D(7).5z(a)})},3v:H(){I 7.3W(19,M,Q,H(a){G(7.16==1)7.3U(a)})},6F:H(){I 7.3W(19,M,M,H(a){G(7.16==1)7.39(a,7.1x)})},6E:H(){I 7.3W(19,Q,Q,H(a){7.1d.39(a,7)})},5q:H(){I 7.3W(19,Q,M,H(a){7.1d.39(a,7.2H)})},3l:H(){I 7.5n||D([])},2q:H(b){J c=D.2l(7,H(a){I D.2q(b,a)});I 7.2I(/[^+>] [^+>]/.11(b)||b.1h("..")>-1?D.4r(c):c)},5y:H(e){J f=7.2l(H(){G(D.14.1f&&!D.4n(7)){J a=7.6o(M),5h=S.3h("1v");5h.3U(a);I D.4h([5h.4H])[0]}N I 7.6o(M)});J d=f.2q("*").5c().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2q("*").5c().P(H(i){G(7.16==3)I;J c=D.L(7,"3w");R(J a 1n c)R(J b 1n c[a])D.W.1e(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2I(D.1D(b)&&D.3C(7,H(a,i){I b.1k(a,i)})||D.3g(b,7))},4Y:H(b){G(b.1q==56)G(62.11(b))I 7.2I(D.3g(b,7,M));N b=D.3g(b,7);J a=b.K&&b[b.K-1]!==12&&!b.16;I 7.1E(H(){I a?D.2L(7,b)<0:7!=b})},1e:H(a){I 7.2I(D.4r(D.2R(7.3p(),1j a==\'23\'?D(a):D.2d(a))))},3F:H(a){I!!a&&D.3g(a,7).K>0},7T:H(a){I 7.3F("."+a)},6e:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,"2A")){J e=c.64,63=[],15=c.15,2V=c.O=="2A-2V";G(e<0)I U;R(J i=2V?e:0,2f=2V?e+1:15.K;i<2f;i++){J d=15[i];G(d.2W){b=D.14.1f&&!d.at.2x.an?d.1r:d.2x;G(2V)I b;63.1p(b)}}I 63}N I(7[0].2x||"").1o(/\\r/g,"")}I 12}G(b.1q==4L)b+=\'\';I 7.P(H(){G(7.16!=1)I;G(b.1q==2p&&/5O|5L/.11(7.O))7.4J=(D.2L(7.2x,b)>=0||D.2L(7.34,b)>=0);N G(D.Y(7,"2A")){J a=D.2d(b);D("9R",7).P(H(){7.2W=(D.2L(7.2x,a)>=0||D.2L(7.1r,a)>=0)});G(!a.K)7.64=-1}N 7.2x=b})},2K:H(a){I a==12?(7[0]?7[0].4H:U):7.4E().3v(a)},7b:H(a){I 7.5q(a).21()},79:H(i){I 7.3s(i,i+1)},3s:H(){I 7.2I(2p.44.3s.1w(7,19))},2l:H(b){I 7.2I(D.2l(7,H(a,i){I b.1k(a,i,a)}))},5c:H(){I 7.1e(7.5n)},L:H(d,b){J a=d.1R(".");a[1]=a[1]?"."+a[1]:"";G(b===12){J c=7.5C("9z"+a[1]+"!",[a[0]]);G(c===12&&7.K)c=D.L(7[0],d);I c===12&&a[1]?7.L(a[0]):c}N I 7.1P("9u"+a[1]+"!",[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3W:H(g,f,h,d){J e=7.K>1,3x;I 7.P(H(){G(!3x){3x=D.4h(g,7.2z);G(h)3x.9o()}J b=7;G(f&&D.Y(7,"1T")&&D.Y(3x[0],"4F"))b=7.3H("22")[0]||7.3U(7.2z.3h("22"));J c=D([]);D.P(3x,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,"1m"))c=c.1e(a);N{G(a.16==1)c=c.1e(D("1m",a).21());d.1k(b,a)}});c.P(6T)})}};D.17.5j.44=D.17;H 6T(i,a){G(a.4d)D.3Y({1a:a.4d,31:Q,1O:"1m"});N D.5u(a.1r||a.6O||a.4H||"");G(a.1d)a.1d.37(a)}H 1z(){I+2B 8J}D.1l=D.17.1l=H(){J b=19[0]||{},i=1,K=19.K,4x=Q,15;G(b.1q==8I){4x=b;b=19[1]||{};i=2}G(1j b!="49"&&1j b!="H")b={};G(K==i){b=7;--i}R(;i<K;i++)G((15=19[i])!=U)R(J c 1n 15){J a=b[c],2w=15[c];G(b===2w)6M;G(4x&&2w&&1j 2w=="49"&&!2w.16)b[c]=D.1l(4x,a||(2w.K!=U?[]:{}),2w);N G(2w!==12)b[c]=2w}I b};J E="4M"+1z(),6K=0,5r={},6G=/z-?5i|8B-?8A|1y|6B|8v-?1Z/i,3P=S.3P||{};D.1l({8u:H(a){1b.$=3m$;G(a)1b.4M=w;I D},1D:H(a){I!!a&&1j a!="23"&&!a.Y&&a.1q!=2p&&/^[\\s[]?H/.11(a+"")},4n:H(a){I a.1C&&!a.1c||a.2j&&a.2z&&!a.2z.1c},5u:H(a){a=D.3k(a);G(a){J b=S.3H("6w")[0]||S.1C,1m=S.3h("1m");1m.O="1r/4t";G(D.14.1f)1m.1r=a;N 1m.3U(S.5F(a));b.39(1m,b.1x);b.37(1m)}},Y:H(b,a){I b.Y&&b.Y.2r()==a.2r()},1Y:{},L:H(c,d,b){c=c==1b?5r:c;J a=c[E];G(!a)a=c[E]=++6K;G(d&&!D.1Y[a])D.1Y[a]={};G(b!==12)D.1Y[a][d]=b;I d?D.1Y[a][d]:a},3b:H(c,b){c=c==1b?5r:c;J a=c[E];G(b){G(D.1Y[a]){2U D.1Y[a][b];b="";R(b 1n D.1Y[a])1X;G(!b)D.3b(c)}}N{1U{2U c[E]}1V(e){G(c.5l)c.5l(E)}2U D.1Y[a]}},P:H(d,a,c){J e,i=0,K=d.K;G(c){G(K==12){R(e 1n d)G(a.1w(d[e],c)===Q)1X}N R(;i<K;)G(a.1w(d[i++],c)===Q)1X}N{G(K==12){R(e 1n d)G(a.1k(d[e],e,d[e])===Q)1X}N R(J b=d[0];i<K&&a.1k(b,i,b)!==Q;b=d[++i]){}}I d},1i:H(b,a,c,i,d){G(D.1D(a))a=a.1k(b,i);I a&&a.1q==4L&&c=="2a"&&!6G.11(d)?a+"2X":a},1F:{1e:H(c,b){D.P((b||"").1R(/\\s+/),H(i,a){G(c.16==1&&!D.1F.3T(c.1F,a))c.1F+=(c.1F?" ":"")+a})},21:H(c,b){G(c.16==1)c.1F=b!=12?D.3C(c.1F.1R(/\\s+/),H(a){I!D.1F.3T(b,a)}).6s(" "):""},3T:H(b,a){I D.2L(a,(b.1F||b).6r().1R(/\\s+/))>-1}},6q:H(b,c,a){J e={};R(J d 1n c){e[d]=b.V[d];b.V[d]=c[d]}a.1k(b);R(J d 1n c)b.V[d]=e[d]},1g:H(d,e,c){G(e=="2h"||e=="1Z"){J b,3X={30:"5x",5g:"1G",18:"3I"},35=e=="2h"?["5e","6k"]:["5G","6i"];H 5b(){b=e=="2h"?d.8f:d.8c;J a=0,2C=0;D.P(35,H(){a+=3d(D.2a(d,"57"+7,M))||0;2C+=3d(D.2a(d,"2C"+7+"4b",M))||0});b-=29.83(a+2C)}G(D(d).3F(":4j"))5b();N D.6q(d,3X,5b);I 29.2f(0,b)}I D.2a(d,e,c)},2a:H(f,l,k){J e,V=f.V;H 3E(b){G(!D.14.2k)I Q;J a=3P.54(b,U);I!a||a.52("3E")==""}G(l=="1y"&&D.14.1f){e=D.1K(V,"1y");I e==""?"1":e}G(D.14.2G&&l=="18"){J d=V.50;V.50="0 7Y 7W";V.50=d}G(l.1I(/4i/i))l=y;G(!k&&V&&V[l])e=V[l];N G(3P.54){G(l.1I(/4i/i))l="4i";l=l.1o(/([A-Z])/g,"-$1").3y();J c=3P.54(f,U);G(c&&!3E(f))e=c.52(l);N{J g=[],2E=[],a=f,i=0;R(;a&&3E(a);a=a.1d)2E.6h(a);R(;i<2E.K;i++)G(3E(2E[i])){g[i]=2E[i].V.18;2E[i].V.18="3I"}e=l=="18"&&g[2E.K-1]!=U?"2F":(c&&c.52(l))||"";R(i=0;i<g.K;i++)G(g[i]!=U)2E[i].V.18=g[i]}G(l=="1y"&&e=="")e="1"}N G(f.4g){J h=l.1o(/\\-(\\w)/g,H(a,b){I b.2r()});e=f.4g[l]||f.4g[h];G(!/^\\d+(2X)?$/i.11(e)&&/^\\d/.11(e)){J j=V.1A,66=f.65.1A;f.65.1A=f.4g.1A;V.1A=e||0;e=V.aM+"2X";V.1A=j;f.65.1A=66}}I e},4h:H(l,h){J k=[];h=h||S;G(1j h.3h==\'12\')h=h.2z||h[0]&&h[0].2z||S;D.P(l,H(i,d){G(!d)I;G(d.1q==4L)d+=\'\';G(1j d=="23"){d=d.1o(/(<(\\w+)[^>]*?)\\/>/g,H(b,a,c){I c.1I(/^(aK|4f|7E|aG|4T|7A|aB|3n|az|ay|av)$/i)?b:a+"></"+c+">"});J f=D.3k(d).3y(),1v=h.3h("1v");J e=!f.1h("<au")&&[1,"<2A 7w=\'7w\'>","</2A>"]||!f.1h("<ar")&&[1,"<7v>","</7v>"]||f.1I(/^<(aq|22|am|ak|ai)/)&&[1,"<1T>","</1T>"]||!f.1h("<4F")&&[2,"<1T><22>","</22></1T>"]||(!f.1h("<af")||!f.1h("<ad"))&&[3,"<1T><22><4F>","</4F></22></1T>"]||!f.1h("<7E")&&[2,"<1T><22></22><7q>","</7q></1T>"]||D.14.1f&&[1,"1v<1v>","</1v>"]||[0,"",""];1v.4H=e[1]+d+e[2];1B(e[0]--)1v=1v.5T;G(D.14.1f){J g=!f.1h("<1T")&&f.1h("<22")<0?1v.1x&&1v.1x.3t:e[1]=="<1T>"&&f.1h("<22")<0?1v.3t:[];R(J j=g.K-1;j>=0;--j)G(D.Y(g[j],"22")&&!g[j].3t.K)g[j].1d.37(g[j]);G(/^\\s/.11(d))1v.39(h.5F(d.1I(/^\\s*/)[0]),1v.1x)}d=D.2d(1v.3t)}G(d.K===0&&(!D.Y(d,"3V")&&!D.Y(d,"2A")))I;G(d[0]==12||D.Y(d,"3V")||d.15)k.1p(d);N k=D.2R(k,d)});I k},1K:H(d,f,c){G(!d||d.16==3||d.16==8)I 12;J e=!D.4n(d),40=c!==12,1f=D.14.1f;f=e&&D.3X[f]||f;G(d.2j){J g=/5Q|4d|V/.11(f);G(f=="2W"&&D.14.2k)d.1d.64;G(f 1n d&&e&&!g){G(40){G(f=="O"&&D.Y(d,"4T")&&d.1d)7p"O a3 a1\'t 9V 9U";d[f]=c}G(D.Y(d,"3V")&&d.7i(f))I d.7i(f).76;I d[f]}G(1f&&e&&f=="V")I D.1K(d.V,"9T",c);G(40)d.9Q(f,""+c);J h=1f&&e&&g?d.4G(f,2):d.4G(f);I h===U?12:h}G(1f&&f=="1y"){G(40){d.6B=1;d.1E=(d.1E||"").1o(/7f\\([^)]*\\)/,"")+(3r(c)+\'\'=="9L"?"":"7f(1y="+c*7a+")")}I d.1E&&d.1E.1h("1y=")>=0?(3d(d.1E.1I(/1y=([^)]*)/)[1])/7a)+\'\':""}f=f.1o(/-([a-z])/9H,H(a,b){I b.2r()});G(40)d[f]=c;I d[f]},3k:H(a){I(a||"").1o(/^\\s+|\\s+$/g,"")},2d:H(b){J a=[];G(b!=U){J i=b.K;G(i==U||b.1R||b.4I||b.1k)a[0]=b;N 1B(i)a[--i]=b[i]}I a},2L:H(b,a){R(J i=0,K=a.K;i<K;i++)G(a[i]===b)I i;I-1},2R:H(a,b){J i=0,T,2S=a.K;G(D.14.1f){1B(T=b[i++])G(T.16!=8)a[2S++]=T}N 1B(T=b[i++])a[2S++]=T;I a},4r:H(a){J c=[],2o={};1U{R(J i=0,K=a.K;i<K;i++){J b=D.L(a[i]);G(!2o[b]){2o[b]=M;c.1p(a[i])}}}1V(e){c=a}I c},3C:H(c,a,d){J b=[];R(J i=0,K=c.K;i<K;i++)G(!d!=!a(c[i],i))b.1p(c[i]);I b},2l:H(d,a){J c=[];R(J i=0,K=d.K;i<K;i++){J b=a(d[i],i);G(b!=U)c[c.K]=b}I c.7d.1w([],c)}});J v=9B.9A.3y();D.14={5B:(v.1I(/.+(?:9y|9x|9w|9v)[\\/: ]([\\d.]+)/)||[])[1],2k:/75/.11(v),2G:/2G/.11(v),1f:/1f/.11(v)&&!/2G/.11(v),42:/42/.11(v)&&!/(9s|75)/.11(v)};J y=D.14.1f?"7o":"72";D.1l({71:!D.14.1f||S.70=="6Z",3X:{"R":"9n","9k":"1F","4i":y,72:y,7o:y,9h:"9f",9e:"9d",9b:"99"}});D.P({6W:H(a){I a.1d},97:H(a){I D.4S(a,"1d")},95:H(a){I D.3a(a,2,"2H")},91:H(a){I D.3a(a,2,"4l")},8Z:H(a){I D.4S(a,"2H")},8X:H(a){I D.4S(a,"4l")},8W:H(a){I D.5v(a.1d.1x,a)},8V:H(a){I D.5v(a.1x)},6Q:H(a){I D.Y(a,"8U")?a.8T||a.8S.S:D.2d(a.3t)}},H(c,d){D.17[c]=H(b){J a=D.2l(7,d);G(b&&1j b=="23")a=D.3g(b,a);I 7.2I(D.4r(a))}});D.P({6P:"3v",8Q:"6F",39:"6E",8P:"5q",8O:"7b"},H(c,b){D.17[c]=H(){J a=19;I 7.P(H(){R(J i=0,K=a.K;i<K;i++)D(a[i])[b](7)})}});D.P({8N:H(a){D.1K(7,a,"");G(7.16==1)7.5l(a)},8M:H(a){D.1F.1e(7,a)},8L:H(a){D.1F.21(7,a)},8K:H(a){D.1F[D.1F.3T(7,a)?"21":"1e"](7,a)},21:H(a){G(!a||D.1E(a,[7]).r.K){D("*",7).1e(7).P(H(){D.W.21(7);D.3b(7)});G(7.1d)7.1d.37(7)}},4E:H(){D(">*",7).21();1B(7.1x)7.37(7.1x)}},H(a,b){D.17[a]=H(){I 7.P(b,19)}});D.P(["6N","4b"],H(i,c){J b=c.3y();D.17[b]=H(a){I 7[0]==1b?D.14.2G&&S.1c["5t"+c]||D.14.2k&&1b["5s"+c]||S.70=="6Z"&&S.1C["5t"+c]||S.1c["5t"+c]:7[0]==S?29.2f(29.2f(S.1c["4y"+c],S.1C["4y"+c]),29.2f(S.1c["2i"+c],S.1C["2i"+c])):a==12?(7.K?D.1g(7[0],b):U):7.1g(b,a.1q==56?a:a+"2X")}});H 25(a,b){I a[0]&&3r(D.2a(a[0],b,M),10)||0}J C=D.14.2k&&3r(D.14.5B)<8H?"(?:[\\\\w*3m-]|\\\\\\\\.)":"(?:[\\\\w\\8F-\\8E*3m-]|\\\\\\\\.)",6L=2B 4v("^>\\\\s*("+C+"+)"),6J=2B 4v("^("+C+"+)(#)("+C+"+)"),6I=2B 4v("^([#.]?)("+C+"*)");D.1l({6H:{"":H(a,i,m){I m[2]=="*"||D.Y(a,m[2])},"#":H(a,i,m){I a.4G("2v")==m[2]},":":{8D:H(a,i,m){I i<m[3]-0},8C:H(a,i,m){I i>m[3]-0},3a:H(a,i,m){I m[3]-0==i},79:H(a,i,m){I m[3]-0==i},3o:H(a,i){I i==0},3S:H(a,i,m,r){I i==r.K-1},6D:H(a,i){I i%2==0},6C:H(a,i){I i%2},"3o-4u":H(a){I a.1d.3H("*")[0]==a},"3S-4u":H(a){I D.3a(a.1d.5T,1,"4l")==a},"8z-4u":H(a){I!D.3a(a.1d.5T,2,"4l")},6W:H(a){I a.1x},4E:H(a){I!a.1x},8y:H(a,i,m){I(a.6O||a.8x||D(a).1r()||"").1h(m[3])>=0},4j:H(a){I"1G"!=a.O&&D.1g(a,"18")!="2F"&&D.1g(a,"5g")!="1G"},1G:H(a){I"1G"==a.O||D.1g(a,"18")=="2F"||D.1g(a,"5g")=="1G"},8w:H(a){I!a.3R},3R:H(a){I a.3R},4J:H(a){I a.4J},2W:H(a){I a.2W||D.1K(a,"2W")},1r:H(a){I"1r"==a.O},5O:H(a){I"5O"==a.O},5L:H(a){I"5L"==a.O},5p:H(a){I"5p"==a.O},3Q:H(a){I"3Q"==a.O},5o:H(a){I"5o"==a.O},6A:H(a){I"6A"==a.O},6z:H(a){I"6z"==a.O},2s:H(a){I"2s"==a.O||D.Y(a,"2s")},4T:H(a){I/4T|2A|6y|2s/i.11(a.Y)},3T:H(a,i,m){I D.2q(m[3],a).K},8t:H(a){I/h\\d/i.11(a.Y)},8s:H(a){I D.3C(D.3O,H(b){I a==b.T}).K}}},6x:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,2B 4v("^([:.#]*)("+C+"+)")],3g:H(a,c,b){J d,1t=[];1B(a&&a!=d){d=a;J f=D.1E(a,c,b);a=f.t.1o(/^\\s*,\\s*/,"");1t=b?c=f.r:D.2R(1t,f.r)}I 1t},2q:H(t,o){G(1j t!="23")I[t];G(o&&o.16!=1&&o.16!=9)I[];o=o||S;J d=[o],2o=[],3S,Y;1B(t&&3S!=t){J r=[];3S=t;t=D.3k(t);J l=Q,3j=6L,m=3j.2D(t);G(m){Y=m[1].2r();R(J i=0;d[i];i++)R(J c=d[i].1x;c;c=c.2H)G(c.16==1&&(Y=="*"||c.Y.2r()==Y))r.1p(c);d=r;t=t.1o(3j,"");G(t.1h(" ")==0)6M;l=M}N{3j=/^([>+~])\\s*(\\w*)/i;G((m=3j.2D(t))!=U){r=[];J k={};Y=m[2].2r();m=m[1];R(J j=0,3i=d.K;j<3i;j++){J n=m=="~"||m=="+"?d[j].2H:d[j].1x;R(;n;n=n.2H)G(n.16==1){J g=D.L(n);G(m=="~"&&k[g])1X;G(!Y||n.Y.2r()==Y){G(m=="~")k[g]=M;r.1p(n)}G(m=="+")1X}}d=r;t=D.3k(t.1o(3j,""));l=M}}G(t&&!l){G(!t.1h(",")){G(o==d[0])d.4s();2o=D.2R(2o,d);r=d=[o];t=" "+t.6v(1,t.K)}N{J h=6J;J m=h.2D(t);G(m){m=[0,m[2],m[3],m[1]]}N{h=6I;m=h.2D(t)}m[2]=m[2].1o(/\\\\/g,"");J f=d[d.K-1];G(m[1]=="#"&&f&&f.61&&!D.4n(f)){J p=f.61(m[2]);G((D.14.1f||D.14.2G)&&p&&1j p.2v=="23"&&p.2v!=m[2])p=D(\'[@2v="\'+m[2]+\'"]\',f)[0];d=r=p&&(!m[3]||D.Y(p,m[3]))?[p]:[]}N{R(J i=0;d[i];i++){J a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];G(a=="*"&&d[i].Y.3y()=="49")a="3n";r=D.2R(r,d[i].3H(a))}G(m[1]==".")r=D.5m(r,m[2]);G(m[1]=="#"){J e=[];R(J i=0;r[i];i++)G(r[i].4G("2v")==m[2]){e=[r[i]];1X}r=e}d=r}t=t.1o(h,"")}}G(t){J b=D.1E(t,r);d=r=b.r;t=D.3k(b.t)}}G(t)d=[];G(d&&o==d[0])d.4s();2o=D.2R(2o,d);I 2o},5m:H(r,m,a){m=" "+m+" ";J c=[];R(J i=0;r[i];i++){J b=(" "+r[i].1F+" ").1h(m)>=0;G(!a&&b||a&&!b)c.1p(r[i])}I c},1E:H(t,r,h){J d;1B(t&&t!=d){d=t;J p=D.6x,m;R(J i=0;p[i];i++){m=p[i].2D(t);G(m){t=t.8r(m[0].K);m[2]=m[2].1o(/\\\\/g,"");1X}}G(!m)1X;G(m[1]==":"&&m[2]=="4Y")r=62.11(m[3])?D.1E(m[3],r,M).r:D(r).4Y(m[3]);N G(m[1]==".")r=D.5m(r,m[2],h);N G(m[1]=="["){J g=[],O=m[3];R(J i=0,3i=r.K;i<3i;i++){J a=r[i],z=a[D.3X[m[2]]||m[2]];G(z==U||/5Q|4d|2W/.11(m[2]))z=D.1K(a,m[2])||\'\';G((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1h(m[5])||O=="$="&&z.6v(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1h(m[5])>=0)^h)g.1p(a)}r=g}N G(m[1]==":"&&m[2]=="3a-4u"){J e={},g=[],11=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2D(m[3]=="6D"&&"2n"||m[3]=="6C"&&"2n+1"||!/\\D/.11(m[3])&&"8q+"+m[3]||m[3]),3o=(11[1]+(11[2]||1))-0,d=11[3]-0;R(J i=0,3i=r.K;i<3i;i++){J j=r[i],1d=j.1d,2v=D.L(1d);G(!e[2v]){J c=1;R(J n=1d.1x;n;n=n.2H)G(n.16==1)n.4q=c++;e[2v]=M}J b=Q;G(3o==0){G(j.4q==d)b=M}N G((j.4q-d)%3o==0&&(j.4q-d)/3o>=0)b=M;G(b^h)g.1p(j)}r=g}N{J f=D.6H[m[1]];G(1j f=="49")f=f[m[2]];G(1j f=="23")f=6u("Q||H(a,i){I "+f+";}");r=D.3C(r,H(a,i){I f(a,i,m,r)},h)}}I{r:r,t:t}},4S:H(b,c){J a=[],1t=b[c];1B(1t&&1t!=S){G(1t.16==1)a.1p(1t);1t=1t[c]}I a},3a:H(a,e,c,b){e=e||1;J d=0;R(;a;a=a[c])G(a.16==1&&++d==e)1X;I a},5v:H(n,a){J r=[];R(;n;n=n.2H){G(n.16==1&&n!=a)r.1p(n)}I r}});D.W={1e:H(f,i,g,e){G(f.16==3||f.16==8)I;G(D.14.1f&&f.4I)f=1b;G(!g.24)g.24=7.24++;G(e!=12){J h=g;g=7.3M(h,H(){I h.1w(7,19)});g.L=e}J j=D.L(f,"3w")||D.L(f,"3w",{}),1H=D.L(f,"1H")||D.L(f,"1H",H(){G(1j D!="12"&&!D.W.5k)I D.W.1H.1w(19.3L.T,19)});1H.T=f;D.P(i.1R(/\\s+/),H(c,b){J a=b.1R(".");b=a[0];g.O=a[1];J d=j[b];G(!d){d=j[b]={};G(!D.W.2t[b]||D.W.2t[b].4p.1k(f)===Q){G(f.3K)f.3K(b,1H,Q);N G(f.6t)f.6t("4o"+b,1H)}}d[g.24]=g;D.W.26[b]=M});f=U},24:1,26:{},21:H(e,h,f){G(e.16==3||e.16==8)I;J i=D.L(e,"3w"),1L,5i;G(i){G(h==12||(1j h=="23"&&h.8p(0)=="."))R(J g 1n i)7.21(e,g+(h||""));N{G(h.O){f=h.2y;h=h.O}D.P(h.1R(/\\s+/),H(b,a){J c=a.1R(".");a=c[0];G(i[a]){G(f)2U i[a][f.24];N R(f 1n i[a])G(!c[1]||i[a][f].O==c[1])2U i[a][f];R(1L 1n i[a])1X;G(!1L){G(!D.W.2t[a]||D.W.2t[a].4A.1k(e)===Q){G(e.6p)e.6p(a,D.L(e,"1H"),Q);N G(e.6n)e.6n("4o"+a,D.L(e,"1H"))}1L=U;2U i[a]}}})}R(1L 1n i)1X;G(!1L){J d=D.L(e,"1H");G(d)d.T=U;D.3b(e,"3w");D.3b(e,"1H")}}},1P:H(h,c,f,g,i){c=D.2d(c);G(h.1h("!")>=0){h=h.3s(0,-1);J a=M}G(!f){G(7.26[h])D("*").1e([1b,S]).1P(h,c)}N{G(f.16==3||f.16==8)I 12;J b,1L,17=D.1D(f[h]||U),W=!c[0]||!c[0].32;G(W){c.6h({O:h,2J:f,32:H(){},3J:H(){},4C:1z()});c[0][E]=M}c[0].O=h;G(a)c[0].6m=M;J d=D.L(f,"1H");G(d)b=d.1w(f,c);G((!17||(D.Y(f,\'a\')&&h=="4V"))&&f["4o"+h]&&f["4o"+h].1w(f,c)===Q)b=Q;G(W)c.4s();G(i&&D.1D(i)){1L=i.1w(f,b==U?c:c.7d(b));G(1L!==12)b=1L}G(17&&g!==Q&&b!==Q&&!(D.Y(f,\'a\')&&h=="4V")){7.5k=M;1U{f[h]()}1V(e){}}7.5k=Q}I b},1H:H(b){J a,1L,38,5f,4m;b=19[0]=D.W.6l(b||1b.W);38=b.O.1R(".");b.O=38[0];38=38[1];5f=!38&&!b.6m;4m=(D.L(7,"3w")||{})[b.O];R(J j 1n 4m){J c=4m[j];G(5f||c.O==38){b.2y=c;b.L=c.L;1L=c.1w(7,19);G(a!==Q)a=1L;G(1L===Q){b.32();b.3J()}}}I a},6l:H(b){G(b[E]==M)I b;J d=b;b={8o:d};J c="8n 8m 8l 8k 2s 8j 47 5d 6j 5E 8i L 8h 8g 4K 2y 5a 59 8e 8b 58 6f 8a 88 4k 87 86 84 6d 2J 4C 6c O 82 81 35".1R(" ");R(J i=c.K;i;i--)b[c[i]]=d[c[i]];b[E]=M;b.32=H(){G(d.32)d.32();d.80=Q};b.3J=H(){G(d.3J)d.3J();d.7Z=M};b.4C=b.4C||1z();G(!b.2J)b.2J=b.6d||S;G(b.2J.16==3)b.2J=b.2J.1d;G(!b.4k&&b.4K)b.4k=b.4K==b.2J?b.6c:b.4K;G(b.58==U&&b.5d!=U){J a=S.1C,1c=S.1c;b.58=b.5d+(a&&a.2e||1c&&1c.2e||0)-(a.6b||0);b.6f=b.6j+(a&&a.2c||1c&&1c.2c||0)-(a.6a||0)}G(!b.35&&((b.47||b.47===0)?b.47:b.5a))b.35=b.47||b.5a;G(!b.59&&b.5E)b.59=b.5E;G(!b.35&&b.2s)b.35=(b.2s&1?1:(b.2s&2?3:(b.2s&4?2:0)));I b},3M:H(a,b){b.24=a.24=a.24||b.24||7.24++;I b},2t:{27:{4p:H(){55();I},4A:H(){I}},3D:{4p:H(){G(D.14.1f)I Q;D(7).2O("53",D.W.2t.3D.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("53",D.W.2t.3D.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3D";I D.W.1H.1w(7,19)}},3N:{4p:H(){G(D.14.1f)I Q;D(7).2O("51",D.W.2t.3N.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("51",D.W.2t.3N.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3N";I D.W.1H.1w(7,19)}}}};D.17.1l({2O:H(c,a,b){I c=="4X"?7.2V(c,a,b):7.P(H(){D.W.1e(7,c,b||a,b&&a)})},2V:H(d,b,c){J e=D.W.3M(c||b,H(a){D(7).4e(a,e);I(c||b).1w(7,19)});I 7.P(H(){D.W.1e(7,d,e,c&&b)})},4e:H(a,b){I 7.P(H(){D.W.21(7,a,b)})},1P:H(c,a,b){I 7.P(H(){D.W.1P(c,a,7,M,b)})},5C:H(c,a,b){I 7[0]&&D.W.1P(c,a,7[0],Q,b)},2m:H(b){J c=19,i=1;1B(i<c.K)D.W.3M(b,c[i++]);I 7.4V(D.W.3M(b,H(a){7.4Z=(7.4Z||0)%i;a.32();I c[7.4Z++].1w(7,19)||Q}))},7X:H(a,b){I 7.2O(\'3D\',a).2O(\'3N\',b)},27:H(a){55();G(D.2Q)a.1k(S,D);N D.3A.1p(H(){I a.1k(7,D)});I 7}});D.1l({2Q:Q,3A:[],27:H(){G(!D.2Q){D.2Q=M;G(D.3A){D.P(D.3A,H(){7.1k(S)});D.3A=U}D(S).5C("27")}}});J x=Q;H 55(){G(x)I;x=M;G(S.3K&&!D.14.2G)S.3K("69",D.27,Q);G(D.14.1f&&1b==1S)(H(){G(D.2Q)I;1U{S.1C.7V("1A")}1V(3e){3B(19.3L,0);I}D.27()})();G(D.14.2G)S.3K("69",H(){G(D.2Q)I;R(J i=0;i<S.4W.K;i++)G(S.4W[i].3R){3B(19.3L,0);I}D.27()},Q);G(D.14.2k){J a;(H(){G(D.2Q)I;G(S.3f!="68"&&S.3f!="1J"){3B(19.3L,0);I}G(a===12)a=D("V, 7A[7U=7S]").K;G(S.4W.K!=a){3B(19.3L,0);I}D.27()})()}D.W.1e(1b,"43",D.27)}D.P(("7R,7Q,43,85,4y,4X,4V,7P,"+"7O,7N,89,53,51,7M,2A,"+"5o,7L,7K,8d,3e").1R(","),H(i,b){D.17[b]=H(a){I a?7.2O(b,a):7.1P(b)}});J F=H(a,c){J b=a.4k;1B(b&&b!=c)1U{b=b.1d}1V(3e){b=c}I b==c};D(1b).2O("4X",H(){D("*").1e(S).4e()});D.17.1l({67:D.17.43,43:H(g,d,c){G(1j g!=\'23\')I 7.67(g);J e=g.1h(" ");G(e>=0){J i=g.3s(e,g.K);g=g.3s(0,e)}c=c||H(){};J f="2P";G(d)G(D.1D(d)){c=d;d=U}N{d=D.3n(d);f="6g"}J h=7;D.3Y({1a:g,O:f,1O:"2K",L:d,1J:H(a,b){G(b=="1W"||b=="7J")h.2K(i?D("<1v/>").3v(a.4U.1o(/<1m(.|\\s)*?\\/1m>/g,"")).2q(i):a.4U);h.P(c,[a.4U,b,a])}});I 7},aL:H(){I D.3n(7.7I())},7I:H(){I 7.2l(H(){I D.Y(7,"3V")?D.2d(7.aH):7}).1E(H(){I 7.34&&!7.3R&&(7.4J||/2A|6y/i.11(7.Y)||/1r|1G|3Q/i.11(7.O))}).2l(H(i,c){J b=D(7).6e();I b==U?U:b.1q==2p?D.2l(b,H(a,i){I{34:c.34,2x:a}}):{34:c.34,2x:b}}).3p()}});D.P("7H,7G,7F,7D,7C,7B".1R(","),H(i,o){D.17[o]=H(f){I 7.2O(o,f)}});J B=1z();D.1l({3p:H(d,b,a,c){G(D.1D(b)){a=b;b=U}I D.3Y({O:"2P",1a:d,L:b,1W:a,1O:c})},aE:H(b,a){I D.3p(b,U,a,"1m")},aD:H(c,b,a){I D.3p(c,b,a,"3z")},aC:H(d,b,a,c){G(D.1D(b)){a=b;b={}}I D.3Y({O:"6g",1a:d,L:b,1W:a,1O:c})},aA:H(a){D.1l(D.60,a)},60:{1a:5Z.5Q,26:M,O:"2P",2T:0,7z:"4R/x-ax-3V-aw",7x:M,31:M,L:U,5Y:U,3Q:U,4Q:{2N:"4R/2N, 1r/2N",2K:"1r/2K",1m:"1r/4t, 4R/4t",3z:"4R/3z, 1r/4t",1r:"1r/as",4w:"*/*"}},4z:{},3Y:H(s){s=D.1l(M,s,D.1l(M,{},D.60,s));J g,2Z=/=\\?(&|$)/g,1u,L,O=s.O.2r();G(s.L&&s.7x&&1j s.L!="23")s.L=D.3n(s.L);G(s.1O=="4P"){G(O=="2P"){G(!s.1a.1I(2Z))s.1a+=(s.1a.1I(/\\?/)?"&":"?")+(s.4P||"7u")+"=?"}N G(!s.L||!s.L.1I(2Z))s.L=(s.L?s.L+"&":"")+(s.4P||"7u")+"=?";s.1O="3z"}G(s.1O=="3z"&&(s.L&&s.L.1I(2Z)||s.1a.1I(2Z))){g="4P"+B++;G(s.L)s.L=(s.L+"").1o(2Z,"="+g+"$1");s.1a=s.1a.1o(2Z,"="+g+"$1");s.1O="1m";1b[g]=H(a){L=a;1W();1J();1b[g]=12;1U{2U 1b[g]}1V(e){}G(i)i.37(h)}}G(s.1O=="1m"&&s.1Y==U)s.1Y=Q;G(s.1Y===Q&&O=="2P"){J j=1z();J k=s.1a.1o(/(\\?|&)3m=.*?(&|$)/,"$ap="+j+"$2");s.1a=k+((k==s.1a)?(s.1a.1I(/\\?/)?"&":"?")+"3m="+j:"")}G(s.L&&O=="2P"){s.1a+=(s.1a.1I(/\\?/)?"&":"?")+s.L;s.L=U}G(s.26&&!D.4O++)D.W.1P("7H");J n=/^(?:\\w+:)?\\/\\/([^\\/?#]+)/;G(s.1O=="1m"&&O=="2P"&&n.11(s.1a)&&n.2D(s.1a)[1]!=5Z.al){J i=S.3H("6w")[0];J h=S.3h("1m");h.4d=s.1a;G(s.7t)h.aj=s.7t;G(!g){J l=Q;h.ah=h.ag=H(){G(!l&&(!7.3f||7.3f=="68"||7.3f=="1J")){l=M;1W();1J();i.37(h)}}}i.3U(h);I 12}J m=Q;J c=1b.7s?2B 7s("ae.ac"):2B 7r();G(s.5Y)c.6R(O,s.1a,s.31,s.5Y,s.3Q);N c.6R(O,s.1a,s.31);1U{G(s.L)c.4B("ab-aa",s.7z);G(s.5S)c.4B("a9-5R-a8",D.4z[s.1a]||"a7, a6 a5 a4 5N:5N:5N a2");c.4B("X-9Z-9Y","7r");c.4B("9W",s.1O&&s.4Q[s.1O]?s.4Q[s.1O]+", */*":s.4Q.4w)}1V(e){}G(s.7m&&s.7m(c,s)===Q){s.26&&D.4O--;c.7l();I Q}G(s.26)D.W.1P("7B",[c,s]);J d=H(a){G(!m&&c&&(c.3f==4||a=="2T")){m=M;G(f){7k(f);f=U}1u=a=="2T"&&"2T"||!D.7j(c)&&"3e"||s.5S&&D.7h(c,s.1a)&&"7J"||"1W";G(1u=="1W"){1U{L=D.6X(c,s.1O,s.9S)}1V(e){1u="5J"}}G(1u=="1W"){J b;1U{b=c.5I("7g-5R")}1V(e){}G(s.5S&&b)D.4z[s.1a]=b;G(!g)1W()}N D.5H(s,c,1u);1J();G(s.31)c=U}};G(s.31){J f=4I(d,13);G(s.2T>0)3B(H(){G(c){c.7l();G(!m)d("2T")}},s.2T)}1U{c.9P(s.L)}1V(e){D.5H(s,c,U,e)}G(!s.31)d();H 1W(){G(s.1W)s.1W(L,1u);G(s.26)D.W.1P("7C",[c,s])}H 1J(){G(s.1J)s.1J(c,1u);G(s.26)D.W.1P("7F",[c,s]);G(s.26&&!--D.4O)D.W.1P("7G")}I c},5H:H(s,a,b,e){G(s.3e)s.3e(a,b,e);G(s.26)D.W.1P("7D",[a,s,e])},4O:0,7j:H(a){1U{I!a.1u&&5Z.9O=="5p:"||(a.1u>=7e&&a.1u<9N)||a.1u==7c||a.1u==9K||D.14.2k&&a.1u==12}1V(e){}I Q},7h:H(a,c){1U{J b=a.5I("7g-5R");I a.1u==7c||b==D.4z[c]||D.14.2k&&a.1u==12}1V(e){}I Q},6X:H(a,c,b){J d=a.5I("9J-O"),2N=c=="2N"||!c&&d&&d.1h("2N")>=0,L=2N?a.9I:a.4U;G(2N&&L.1C.2j=="5J")7p"5J";G(b)L=b(L,c);G(c=="1m")D.5u(L);G(c=="3z")L=6u("("+L+")");I L},3n:H(a){J s=[];G(a.1q==2p||a.5w)D.P(a,H(){s.1p(3u(7.34)+"="+3u(7.2x))});N R(J j 1n a)G(a[j]&&a[j].1q==2p)D.P(a[j],H(){s.1p(3u(j)+"="+3u(7))});N s.1p(3u(j)+"="+3u(D.1D(a[j])?a[j]():a[j]));I s.6s("&").1o(/%20/g,"+")}});D.17.1l({1N:H(c,b){I c?7.2g({1Z:"1N",2h:"1N",1y:"1N"},c,b):7.1E(":1G").P(H(){7.V.18=7.5D||"";G(D.1g(7,"18")=="2F"){J a=D("<"+7.2j+" />").6P("1c");7.V.18=a.1g("18");G(7.V.18=="2F")7.V.18="3I";a.21()}}).3l()},1M:H(b,a){I b?7.2g({1Z:"1M",2h:"1M",1y:"1M"},b,a):7.1E(":4j").P(H(){7.5D=7.5D||D.1g(7,"18");7.V.18="2F"}).3l()},78:D.17.2m,2m:H(a,b){I D.1D(a)&&D.1D(b)?7.78.1w(7,19):a?7.2g({1Z:"2m",2h:"2m",1y:"2m"},a,b):7.P(H(){D(7)[D(7).3F(":1G")?"1N":"1M"]()})},9G:H(b,a){I 7.2g({1Z:"1N"},b,a)},9F:H(b,a){I 7.2g({1Z:"1M"},b,a)},9E:H(b,a){I 7.2g({1Z:"2m"},b,a)},9D:H(b,a){I 7.2g({1y:"1N"},b,a)},9M:H(b,a){I 7.2g({1y:"1M"},b,a)},9C:H(c,a,b){I 7.2g({1y:a},c,b)},2g:H(k,j,i,g){J h=D.77(j,i,g);I 7[h.36===Q?"P":"36"](H(){G(7.16!=1)I Q;J f=D.1l({},h),p,1G=D(7).3F(":1G"),46=7;R(p 1n k){G(k[p]=="1M"&&1G||k[p]=="1N"&&!1G)I f.1J.1k(7);G(p=="1Z"||p=="2h"){f.18=D.1g(7,"18");f.33=7.V.33}}G(f.33!=U)7.V.33="1G";f.45=D.1l({},k);D.P(k,H(c,a){J e=2B D.28(46,f,c);G(/2m|1N|1M/.11(a))e[a=="2m"?1G?"1N":"1M":a](k);N{J b=a.6r().1I(/^([+-]=)?([\\d+-.]+)(.*)$/),2b=e.1t(M)||0;G(b){J d=3d(b[2]),2M=b[3]||"2X";G(2M!="2X"){46.V[c]=(d||1)+2M;2b=((d||1)/e.1t(M))*2b;46.V[c]=2b+2M}G(b[1])d=((b[1]=="-="?-1:1)*d)+2b;e.3G(2b,d,2M)}N e.3G(2b,a,"")}});I M})},36:H(a,b){G(D.1D(a)||(a&&a.1q==2p)){b=a;a="28"}G(!a||(1j a=="23"&&!b))I A(7[0],a);I 7.P(H(){G(b.1q==2p)A(7,a,b);N{A(7,a).1p(b);G(A(7,a).K==1)b.1k(7)}})},9X:H(b,c){J a=D.3O;G(b)7.36([]);7.P(H(){R(J i=a.K-1;i>=0;i--)G(a[i].T==7){G(c)a[i](M);a.7n(i,1)}});G(!c)7.5A();I 7}});J A=H(b,c,a){G(b){c=c||"28";J q=D.L(b,c+"36");G(!q||a)q=D.L(b,c+"36",D.2d(a))}I q};D.17.5A=H(a){a=a||"28";I 7.P(H(){J q=A(7,a);q.4s();G(q.K)q[0].1k(7)})};D.1l({77:H(b,a,c){J d=b&&b.1q==a0?b:{1J:c||!c&&a||D.1D(b)&&b,2u:b,41:c&&a||a&&a.1q!=9t&&a};d.2u=(d.2u&&d.2u.1q==4L?d.2u:D.28.5K[d.2u])||D.28.5K.74;d.5M=d.1J;d.1J=H(){G(d.36!==Q)D(7).5A();G(D.1D(d.5M))d.5M.1k(7)};I d},41:{73:H(p,n,b,a){I b+a*p},5P:H(p,n,b,a){I((-29.9r(p*29.9q)/2)+0.5)*a+b}},3O:[],48:U,28:H(b,c,a){7.15=c;7.T=b;7.1i=a;G(!c.3Z)c.3Z={}}});D.28.44={4D:H(){G(7.15.2Y)7.15.2Y.1k(7.T,7.1z,7);(D.28.2Y[7.1i]||D.28.2Y.4w)(7);G(7.1i=="1Z"||7.1i=="2h")7.T.V.18="3I"},1t:H(a){G(7.T[7.1i]!=U&&7.T.V[7.1i]==U)I 7.T[7.1i];J r=3d(D.1g(7.T,7.1i,a));I r&&r>-9p?r:3d(D.2a(7.T,7.1i))||0},3G:H(c,b,d){7.5V=1z();7.2b=c;7.3l=b;7.2M=d||7.2M||"2X";7.1z=7.2b;7.2S=7.4N=0;7.4D();J e=7;H t(a){I e.2Y(a)}t.T=7.T;D.3O.1p(t);G(D.48==U){D.48=4I(H(){J a=D.3O;R(J i=0;i<a.K;i++)G(!a[i]())a.7n(i--,1);G(!a.K){7k(D.48);D.48=U}},13)}},1N:H(){7.15.3Z[7.1i]=D.1K(7.T.V,7.1i);7.15.1N=M;7.3G(0,7.1t());G(7.1i=="2h"||7.1i=="1Z")7.T.V[7.1i]="9m";D(7.T).1N()},1M:H(){7.15.3Z[7.1i]=D.1K(7.T.V,7.1i);7.15.1M=M;7.3G(7.1t(),0)},2Y:H(a){J t=1z();G(a||t>7.15.2u+7.5V){7.1z=7.3l;7.2S=7.4N=1;7.4D();7.15.45[7.1i]=M;J b=M;R(J i 1n 7.15.45)G(7.15.45[i]!==M)b=Q;G(b){G(7.15.18!=U){7.T.V.33=7.15.33;7.T.V.18=7.15.18;G(D.1g(7.T,"18")=="2F")7.T.V.18="3I"}G(7.15.1M)7.T.V.18="2F";G(7.15.1M||7.15.1N)R(J p 1n 7.15.45)D.1K(7.T.V,p,7.15.3Z[p])}G(b)7.15.1J.1k(7.T);I Q}N{J n=t-7.5V;7.4N=n/7.15.2u;7.2S=D.41[7.15.41||(D.41.5P?"5P":"73")](7.4N,n,0,1,7.15.2u);7.1z=7.2b+((7.3l-7.2b)*7.2S);7.4D()}I M}};D.1l(D.28,{5K:{9l:9j,9i:7e,74:9g},2Y:{2e:H(a){a.T.2e=a.1z},2c:H(a){a.T.2c=a.1z},1y:H(a){D.1K(a.T.V,"1y",a.1z)},4w:H(a){a.T.V[a.1i]=a.1z+a.2M}}});D.17.2i=H(){J b=0,1S=0,T=7[0],3q;G(T)ao(D.14){J d=T.1d,4a=T,1s=T.1s,1Q=T.2z,5U=2k&&3r(5B)<9c&&!/9a/i.11(v),1g=D.2a,3c=1g(T,"30")=="3c";G(T.7y){J c=T.7y();1e(c.1A+29.2f(1Q.1C.2e,1Q.1c.2e),c.1S+29.2f(1Q.1C.2c,1Q.1c.2c));1e(-1Q.1C.6b,-1Q.1C.6a)}N{1e(T.5X,T.5W);1B(1s){1e(1s.5X,1s.5W);G(42&&!/^t(98|d|h)$/i.11(1s.2j)||2k&&!5U)2C(1s);G(!3c&&1g(1s,"30")=="3c")3c=M;4a=/^1c$/i.11(1s.2j)?4a:1s;1s=1s.1s}1B(d&&d.2j&&!/^1c|2K$/i.11(d.2j)){G(!/^96|1T.*$/i.11(1g(d,"18")))1e(-d.2e,-d.2c);G(42&&1g(d,"33")!="4j")2C(d);d=d.1d}G((5U&&(3c||1g(4a,"30")=="5x"))||(42&&1g(4a,"30")!="5x"))1e(-1Q.1c.5X,-1Q.1c.5W);G(3c)1e(29.2f(1Q.1C.2e,1Q.1c.2e),29.2f(1Q.1C.2c,1Q.1c.2c))}3q={1S:1S,1A:b}}H 2C(a){1e(D.2a(a,"6V",M),D.2a(a,"6U",M))}H 1e(l,t){b+=3r(l,10)||0;1S+=3r(t,10)||0}I 3q};D.17.1l({30:H(){J a=0,1S=0,3q;G(7[0]){J b=7.1s(),2i=7.2i(),4c=/^1c|2K$/i.11(b[0].2j)?{1S:0,1A:0}:b.2i();2i.1S-=25(7,\'94\');2i.1A-=25(7,\'aF\');4c.1S+=25(b,\'6U\');4c.1A+=25(b,\'6V\');3q={1S:2i.1S-4c.1S,1A:2i.1A-4c.1A}}I 3q},1s:H(){J a=7[0].1s;1B(a&&(!/^1c|2K$/i.11(a.2j)&&D.1g(a,\'30\')==\'93\'))a=a.1s;I D(a)}});D.P([\'5e\',\'5G\'],H(i,b){J c=\'4y\'+b;D.17[c]=H(a){G(!7[0])I;I a!=12?7.P(H(){7==1b||7==S?1b.92(!i?a:D(1b).2e(),i?a:D(1b).2c()):7[c]=a}):7[0]==1b||7[0]==S?46[i?\'aI\':\'aJ\']||D.71&&S.1C[c]||S.1c[c]:7[0][c]}});D.P(["6N","4b"],H(i,b){J c=i?"5e":"5G",4f=i?"6k":"6i";D.17["5s"+b]=H(){I 7[b.3y()]()+25(7,"57"+c)+25(7,"57"+4f)};D.17["90"+b]=H(a){I 7["5s"+b]()+25(7,"2C"+c+"4b")+25(7,"2C"+4f+"4b")+(a?25(7,"6S"+c)+25(7,"6S"+4f):0)}})})();',62,669,'|||||||this|||||||||||||||||||||||||||||||||||if|function|return|var|length|data|true|else|type|each|false|for|document|elem|null|style|event||nodeName|||test|undefined||browser|options|nodeType|fn|display|arguments|url|window|body|parentNode|add|msie|css|indexOf|prop|typeof|call|extend|script|in|replace|push|constructor|text|offsetParent|cur|status|div|apply|firstChild|opacity|now|left|while|documentElement|isFunction|filter|className|hidden|handle|match|complete|attr|ret|hide|show|dataType|trigger|doc|split|top|table|try|catch|success|break|cache|height||remove|tbody|string|guid|num|global|ready|fx|Math|curCSS|start|scrollTop|makeArray|scrollLeft|max|animate|width|offset|tagName|safari|map|toggle||done|Array|find|toUpperCase|button|special|duration|id|copy|value|handler|ownerDocument|select|new|border|exec|stack|none|opera|nextSibling|pushStack|target|html|inArray|unit|xml|bind|GET|isReady|merge|pos|timeout|delete|one|selected|px|step|jsre|position|async|preventDefault|overflow|name|which|queue|removeChild|namespace|insertBefore|nth|removeData|fixed|parseFloat|error|readyState|multiFilter|createElement|rl|re|trim|end|_|param|first|get|results|parseInt|slice|childNodes|encodeURIComponent|append|events|elems|toLowerCase|json|readyList|setTimeout|grep|mouseenter|color|is|custom|getElementsByTagName|block|stopPropagation|addEventListener|callee|proxy|mouseleave|timers|defaultView|password|disabled|last|has|appendChild|form|domManip|props|ajax|orig|set|easing|mozilla|load|prototype|curAnim|self|charCode|timerId|object|offsetChild|Width|parentOffset|src|unbind|br|currentStyle|clean|float|visible|relatedTarget|previousSibling|handlers|isXMLDoc|on|setup|nodeIndex|unique|shift|javascript|child|RegExp|_default|deep|scroll|lastModified|teardown|setRequestHeader|timeStamp|update|empty|tr|getAttribute|innerHTML|setInterval|checked|fromElement|Number|jQuery|state|active|jsonp|accepts|application|dir|input|responseText|click|styleSheets|unload|not|lastToggle|outline|mouseout|getPropertyValue|mouseover|getComputedStyle|bindReady|String|padding|pageX|metaKey|keyCode|getWH|andSelf|clientX|Left|all|visibility|container|index|init|triggered|removeAttribute|classFilter|prevObject|submit|file|after|windowData|inner|client|globalEval|sibling|jquery|absolute|clone|wrapAll|dequeue|version|triggerHandler|oldblock|ctrlKey|createTextNode|Top|handleError|getResponseHeader|parsererror|speeds|checkbox|old|00|radio|swing|href|Modified|ifModified|lastChild|safari2|startTime|offsetTop|offsetLeft|username|location|ajaxSettings|getElementById|isSimple|values|selectedIndex|runtimeStyle|rsLeft|_load|loaded|DOMContentLoaded|clientTop|clientLeft|toElement|srcElement|val|pageY|POST|unshift|Bottom|clientY|Right|fix|exclusive|detachEvent|cloneNode|removeEventListener|swap|toString|join|attachEvent|eval|substr|head|parse|textarea|reset|image|zoom|odd|even|before|prepend|exclude|expr|quickClass|quickID|uuid|quickChild|continue|Height|textContent|appendTo|contents|open|margin|evalScript|borderTopWidth|borderLeftWidth|parent|httpData|setArray|CSS1Compat|compatMode|boxModel|cssFloat|linear|def|webkit|nodeValue|speed|_toggle|eq|100|replaceWith|304|concat|200|alpha|Last|httpNotModified|getAttributeNode|httpSuccess|clearInterval|abort|beforeSend|splice|styleFloat|throw|colgroup|XMLHttpRequest|ActiveXObject|scriptCharset|callback|fieldset|multiple|processData|getBoundingClientRect|contentType|link|ajaxSend|ajaxSuccess|ajaxError|col|ajaxComplete|ajaxStop|ajaxStart|serializeArray|notmodified|keypress|keydown|change|mouseup|mousedown|dblclick|focus|blur|stylesheet|hasClass|rel|doScroll|black|hover|solid|cancelBubble|returnValue|wheelDelta|view|round|shiftKey|resize|screenY|screenX|relatedNode|mousemove|prevValue|originalTarget|offsetHeight|keyup|newValue|offsetWidth|eventPhase|detail|currentTarget|cancelable|bubbles|attrName|attrChange|altKey|originalEvent|charAt|0n|substring|animated|header|noConflict|line|enabled|innerText|contains|only|weight|font|gt|lt|uFFFF|u0128|size|417|Boolean|Date|toggleClass|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|wrap|contentWindow|contentDocument|iframe|children|siblings|prevAll|wrapInner|nextAll|outer|prev|scrollTo|static|marginTop|next|inline|parents|able|cellSpacing|adobeair|cellspacing|522|maxLength|maxlength|readOnly|400|readonly|fast|600|class|slow|1px|htmlFor|reverse|10000|PI|cos|compatible|Function|setData|ie|ra|it|rv|getData|userAgent|navigator|fadeTo|fadeIn|slideToggle|slideUp|slideDown|ig|responseXML|content|1223|NaN|fadeOut|300|protocol|send|setAttribute|option|dataFilter|cssText|changed|be|Accept|stop|With|Requested|Object|can|GMT|property|1970|Jan|01|Thu|Since|If|Type|Content|XMLHTTP|th|Microsoft|td|onreadystatechange|onload|cap|charset|colg|host|tfoot|specified|with|1_|thead|leg|plain|attributes|opt|embed|urlencoded|www|area|hr|ajaxSetup|meta|post|getJSON|getScript|marginLeft|img|elements|pageYOffset|pageXOffset|abbr|serialize|pixelLeft'.split('|'),0,{}));
+// $Id: drupal.js,v 1.41.2.4 2009/07/21 08:59:10 goba Exp $
+
+var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {} };
+
+/**
+ * Set the variable that indicates if JavaScript behaviors should be applied
+ */
+Drupal.jsEnabled = document.getElementsByTagName && document.createElement && document.createTextNode && document.documentElement && document.getElementById;
+
+/**
+ * Attach all registered behaviors to a page element.
+ *
+ * Behaviors are event-triggered actions that attach to page elements, enhancing
+ * default non-Javascript UIs. Behaviors are registered in the Drupal.behaviors
+ * object as follows:
+ * @code
+ * Drupal.behaviors.behaviorName = function () {
+ * ...
+ * };
+ * @endcode
+ *
+ * Drupal.attachBehaviors is added below to the jQuery ready event and so
+ * runs on initial page load. Developers implementing AHAH/AJAX in their
+ * solutions should also call this function after new page content has been
+ * loaded, feeding in an element to be processed, in order to attach all
+ * behaviors to the new content.
+ *
+ * Behaviors should use a class in the form behaviorName-processed to ensure
+ * the behavior is attached only once to a given element. (Doing so enables
+ * the reprocessing of given elements, which may be needed on occasion despite
+ * the ability to limit behavior attachment to a particular element.)
+ *
+ * @param context
+ * An element to attach behaviors to. If none is given, the document element
+ * is used.
+ */
+Drupal.attachBehaviors = function(context) {
+ context = context || document;
+ if (Drupal.jsEnabled) {
+ // Execute all of them.
+ jQuery.each(Drupal.behaviors, function() {
+ this(context);
+ });
+ }
+};
+
+/**
+ * Encode special characters in a plain-text string for display as HTML.
+ */
+Drupal.checkPlain = function(str) {
+ str = String(str);
+ var replace = { '&': '&amp;', '"': '&quot;', '<': '&lt;', '>': '&gt;' };
+ for (var character in replace) {
+ var regex = new RegExp(character, 'g');
+ str = str.replace(regex, replace[character]);
+ }
+ return str;
+};
+
+/**
+ * Translate strings to the page language or a given language.
+ *
+ * See the documentation of the server-side t() function for further details.
+ *
+ * @param str
+ * A string containing the English string to translate.
+ * @param args
+ * An object of replacements pairs to make after translation. Incidences
+ * of any key in this array are replaced with the corresponding value.
+ * Based on the first character of the key, the value is escaped and/or themed:
+ * - !variable: inserted as is
+ * - @variable: escape plain text to HTML (Drupal.checkPlain)
+ * - %variable: escape text and theme as a placeholder for user-submitted
+ * content (checkPlain + Drupal.theme('placeholder'))
+ * @return
+ * The translated string.
+ */
+Drupal.t = function(str, args) {
+ // Fetch the localized version of the string.
+ if (Drupal.locale.strings && Drupal.locale.strings[str]) {
+ str = Drupal.locale.strings[str];
+ }
+
+ if (args) {
+ // Transform arguments before inserting them
+ for (var key in args) {
+ switch (key.charAt(0)) {
+ // Escaped only
+ case '@':
+ args[key] = Drupal.checkPlain(args[key]);
+ break;
+ // Pass-through
+ case '!':
+ break;
+ // Escaped and placeholder
+ case '%':
+ default:
+ args[key] = Drupal.theme('placeholder', args[key]);
+ break;
+ }
+ str = str.replace(key, args[key]);
+ }
+ }
+ return str;
+};
+
+/**
+ * Format a string containing a count of items.
+ *
+ * This function ensures that the string is pluralized correctly. Since Drupal.t() is
+ * called by this function, make sure not to pass already-localized strings to it.
+ *
+ * See the documentation of the server-side format_plural() function for further details.
+ *
+ * @param count
+ * The item count to display.
+ * @param singular
+ * The string for the singular case. Please make sure it is clear this is
+ * singular, to ease translation (e.g. use "1 new comment" instead of "1 new").
+ * Do not use @count in the singular string.
+ * @param plural
+ * The string for the plural case. Please make sure it is clear this is plural,
+ * to ease translation. Use @count in place of the item count, as in "@count
+ * new comments".
+ * @param args
+ * An object of replacements pairs to make after translation. Incidences
+ * of any key in this array are replaced with the corresponding value.
+ * Based on the first character of the key, the value is escaped and/or themed:
+ * - !variable: inserted as is
+ * - @variable: escape plain text to HTML (Drupal.checkPlain)
+ * - %variable: escape text and theme as a placeholder for user-submitted
+ * content (checkPlain + Drupal.theme('placeholder'))
+ * Note that you do not need to include @count in this array.
+ * This replacement is done automatically for the plural case.
+ * @return
+ * A translated string.
+ */
+Drupal.formatPlural = function(count, singular, plural, args) {
+ var args = args || {};
+ args['@count'] = count;
+ // Determine the index of the plural form.
+ var index = Drupal.locale.pluralFormula ? Drupal.locale.pluralFormula(args['@count']) : ((args['@count'] == 1) ? 0 : 1);
+
+ if (index == 0) {
+ return Drupal.t(singular, args);
+ }
+ else if (index == 1) {
+ return Drupal.t(plural, args);
+ }
+ else {
+ args['@count['+ index +']'] = args['@count'];
+ delete args['@count'];
+ return Drupal.t(plural.replace('@count', '@count['+ index +']'));
+ }
+};
+
+/**
+ * Generate the themed representation of a Drupal object.
+ *
+ * All requests for themed output must go through this function. It examines
+ * the request and routes it to the appropriate theme function. If the current
+ * theme does not provide an override function, the generic theme function is
+ * called.
+ *
+ * For example, to retrieve the HTML that is output by theme_placeholder(text),
+ * call Drupal.theme('placeholder', text).
+ *
+ * @param func
+ * The name of the theme function to call.
+ * @param ...
+ * Additional arguments to pass along to the theme function.
+ * @return
+ * Any data the theme function returns. This could be a plain HTML string,
+ * but also a complex object.
+ */
+Drupal.theme = function(func) {
+ for (var i = 1, args = []; i < arguments.length; i++) {
+ args.push(arguments[i]);
+ }
+
+ return (Drupal.theme[func] || Drupal.theme.prototype[func]).apply(this, args);
+};
+
+/**
+ * Parse a JSON response.
+ *
+ * The result is either the JSON object, or an object with 'status' 0 and 'data' an error message.
+ */
+Drupal.parseJson = function (data) {
+ if ((data.substring(0, 1) != '{') && (data.substring(0, 1) != '[')) {
+ return { status: 0, data: data.length ? data : Drupal.t('Unspecified error') };
+ }
+ return eval('(' + data + ');');
+};
+
+/**
+ * Freeze the current body height (as minimum height). Used to prevent
+ * unnecessary upwards scrolling when doing DOM manipulations.
+ */
+Drupal.freezeHeight = function () {
+ Drupal.unfreezeHeight();
+ var div = document.createElement('div');
+ $(div).css({
+ position: 'absolute',
+ top: '0px',
+ left: '0px',
+ width: '1px',
+ height: $('body').css('height')
+ }).attr('id', 'freeze-height');
+ $('body').append(div);
+};
+
+/**
+ * Unfreeze the body height
+ */
+Drupal.unfreezeHeight = function () {
+ $('#freeze-height').remove();
+};
+
+/**
+ * Wrapper around encodeURIComponent() which avoids Apache quirks (equivalent of
+ * drupal_urlencode() in PHP). This function should only be used on paths, not
+ * on query string arguments.
+ */
+Drupal.encodeURIComponent = function (item, uri) {
+ uri = uri || location.href;
+ item = encodeURIComponent(item).replace(/%2F/g, '/');
+ return (uri.indexOf('?q=') != -1) ? item : item.replace(/%26/g, '%2526').replace(/%23/g, '%2523').replace(/\/\//g, '/%252F');
+};
+
+/**
+ * Get the text selection in a textarea.
+ */
+Drupal.getSelection = function (element) {
+ if (typeof(element.selectionStart) != 'number' && document.selection) {
+ // The current selection
+ var range1 = document.selection.createRange();
+ var range2 = range1.duplicate();
+ // Select all text.
+ range2.moveToElementText(element);
+ // Now move 'dummy' end point to end point of original range.
+ range2.setEndPoint('EndToEnd', range1);
+ // Now we can calculate start and end points.
+ var start = range2.text.length - range1.text.length;
+ var end = start + range1.text.length;
+ return { 'start': start, 'end': end };
+ }
+ return { 'start': element.selectionStart, 'end': element.selectionEnd };
+};
+
+/**
+ * Build an error message from ahah response.
+ */
+Drupal.ahahError = function(xmlhttp, uri) {
+ if (xmlhttp.status == 200) {
+ if (jQuery.trim($(xmlhttp.responseText).text())) {
+ var message = Drupal.t("An error occurred. \n@uri\n@text", {'@uri': uri, '@text': xmlhttp.responseText });
+ }
+ else {
+ var message = Drupal.t("An error occurred. \n@uri\n(no information available).", {'@uri': uri, '@text': xmlhttp.responseText });
+ }
+ }
+ else {
+ var message = Drupal.t("An HTTP error @status occurred. \n@uri", {'@uri': uri, '@status': xmlhttp.status });
+ }
+ return message;
+}
+
+// Global Killswitch on the <html> element
+if (Drupal.jsEnabled) {
+ // Global Killswitch on the <html> element
+ $(document.documentElement).addClass('js');
+ // 'js enabled' cookie
+ document.cookie = 'has_js=1; path=/';
+ // Attach all behaviors.
+ $(document).ready(function() {
+ Drupal.attachBehaviors(this);
+ });
+}
+
+/**
+ * The default themes.
+ */
+Drupal.theme.prototype = {
+
+ /**
+ * Formats text for emphasized display in a placeholder inside a sentence.
+ *
+ * @param str
+ * The text to format (plain-text).
+ * @return
+ * The formatted text (html).
+ */
+ placeholder: function(str) {
+ return '<em>' + Drupal.checkPlain(str) + '</em>';
+ }
+};
+;
+// $Id: googleanalytics.js,v 1.9.2.4 2010/09/19 11:39:20 hass Exp $
+
+$(document).ready(function() {
+
+ // Attach onclick event to document only and catch clicks on all elements.
+ $(document.body).click(function(event) {
+ // Catch only the first parent link of a clicked element.
+ $(event.target).parents("a:first,area:first").andSelf().filter("a,area").each(function() {
+
+ var ga = Drupal.settings.googleanalytics;
+ // Expression to check for absolute internal links.
+ var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
+ // Expression to check for special links like gotwo.module /go/* links.
+ var isInternalSpecial = new RegExp("(\/go\/.*)$", "i");
+ // Expression to check for download links.
+ var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")$", "i");
+
+ // Is the clicked URL internal?
+ if (isInternal.test(this.href)) {
+ // Is download tracking activated and the file extension configured for download tracking?
+ if (ga.trackDownload && isDownload.test(this.href)) {
+ // Download link clicked.
+ var extension = isDownload.exec(this.href);
+ _gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '')]);
+ }
+ else if (isInternalSpecial.test(this.href)) {
+ // Keep the internal URL for Google Analytics website overlay intact.
+ _gaq.push(["_trackPageview", this.href.replace(isInternal, '')]);
+ }
+ }
+ else {
+ if (ga.trackMailto && $(this).is("a[href^=mailto:],area[href^=mailto:]")) {
+ // Mailto link clicked.
+ _gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]);
+ }
+ else if (ga.trackOutgoing && this.href) {
+ // External link clicked.
+ _gaq.push(["_trackEvent", "Outgoing links", "Click", this.href]);
+ }
+ }
+
+ });
+ });
+});
+;
+(function () {
+ function latitudeToMercator(latitude) {
+ return Math.log(Math.tan(latitude * Math.PI / 180) + 1 / Math.cos(latitude * Math.PI / 180));
+ }
+
+ Drupal.html5UserGeolocationLongitudeToPx = function (longitude, leftLongitude, width) {
+ return (longitude - leftLongitude + 360) / 360 % 1 * width;
+ }
+
+ Drupal.html5UserGeolocationLatitudeToPx = function (latitude, topLatitude, bottomLatitude, height) {
+ return (latitudeToMercator(latitude) - latitudeToMercator(bottomLatitude))
+ / (latitudeToMercator(topLatitude) - latitudeToMercator(bottomLatitude))
+ * height;
+ }
+
+ function plot() {
+ var $map = $('#html5-user-geolocation-map'),
+ latitude = $('#edit-html5-user-geolocation-latitude').attr('value'),
+ longitude = $('#edit-html5-user-geolocation-longitude').attr('value');
+
+ if (latitude == 0 && longitude == 0) {
+ return;
+ }
+
+ // Plot coords
+ $('#html5-user-geolocation-map .dot').css({
+ left: '' + Drupal.html5UserGeolocationLongitudeToPx(longitude, -168, $map.width()) + 'px',
+ bottom: '' + Drupal.html5UserGeolocationLatitudeToPx(latitude, 78, -58, $map.height()) + 'px'
+ }).show();
+
+ // Show precision
+ $map.siblings('.description').find('span').html(
+ (Math.acos(
+ Math.sin(latitude * Math.PI / 180)
+ * Math.sin((latitude) * Math.PI / 180)
+ + Math.cos(latitude * Math.PI / 180)
+ * Math.cos((latitude) * Math.PI / 180)
+ * Math.cos(Math.pow(10, -1 * Drupal.settings.html5UserGeolocationPrecision) * Math.PI / 180)
+ ) * 6371).toPrecision(3)
+ );
+ }
+
+ function getLocation() {
+ if ($('#edit-html5-user-geolocation-save').attr('checked')) {
+ var $busy = $('#html5-user-geolocation-messages-wrapper .geolocating');
+ $('#html5-user-geolocation-map-wrapper').slideDown('fast');
+
+ // Get position
+ $busy.show();
+ navigator.geolocation.getCurrentPosition(function (position) {
+ // Save coords
+ $('#edit-html5-user-geolocation-latitude').attr('value', position.coords.latitude);
+ $('#edit-html5-user-geolocation-longitude').attr('value', position.coords.longitude);
+
+ plot();
+ $busy.hide();
+ }, function () { // getCurrentPosition error callback
+ $('#edit-html5-user-geolocation-save').attr('checked', false).change();
+ },
+ {
+ maximumAge: Infinity
+ });
+ }
+ else { // Location not checked
+ $('#html5-user-geolocation-map-wrapper').slideUp('fast');
+ }
+ }
+
+ Drupal.behaviors.html5UserGeolocation = function (context) {
+ if (navigator.geolocation) {
+ $('#user-profile-form #edit-html5-user-geolocation-save:not(.html5-user-geolocation-processed)', context)
+ .addClass('html5-user-geolocation-processed')
+ .change(function () {
+ getLocation();
+ })
+ .each(function () {
+ $('#html5-user-geolocation-messages-wrapper .not-supported').hide();
+ if ($('#edit-html5-user-geolocation-save').attr('checked')) {
+ $('#html5-user-geolocation-map-wrapper').slideDown('fast');
+ plot();
+ }
+ getLocation();
+ });
+ }
+ else { // HTML5 Geolocation not supported
+ $('#edit-html5-user-geolocation-save').attr('disabled', true);
+ }
+ };
+}());
+;
+Drupal.behaviors.drupalorgSetHome = function () {
+ $('#drupalorg-set-home:not(.drupalorg-set-home-processed)')
+ .addClass('drupalorg-set-home-processed')
+ .each(function () {
+ var $this = $(this);
+ // Click triggers form submit
+ $('a', $this).click(function () {
+ $('input[type=submit]', $this).click();
+ return false;
+ });
+ });
+};
+
+Drupal.behaviors.drupalorgSearch = function () {
+ $('body.page-search #content-top-region form:not(.drupalorgSearch-processed)').addClass('drupalorgSearch-processed').each(function () {
+ var $this = $(this);
+ $this.find('select').change(function () {
+ $this.submit();
+ });
+ });
+};
+;
+// $Id: base.js,v 1.11.2.1 2010/03/10 20:08:58 merlinofchaos Exp $
+/**
+ * @file base.js
+ *
+ * Some basic behaviors and utility functions for Views.
+ */
+
+Drupal.Views = {};
+
+/**
+ * jQuery UI tabs, Views integration component
+ */
+Drupal.behaviors.viewsTabs = function (context) {
+ $('#views-tabset:not(.views-processed)').addClass('views-processed').each(function() {
+ new Drupal.Views.Tabs($(this), {selectedClass: 'active'});
+ });
+
+ $('a.views-remove-link')
+ .addClass('views-processed')
+ .click(function() {
+ var id = $(this).attr('id').replace('views-remove-link-', '');
+ $('#views-row-' + id).hide();
+ $('#views-removed-' + id).attr('checked', true);
+ return false;
+ });
+}
+
+/**
+ * For IE, attach some javascript so that our hovers do what they're supposed
+ * to do.
+ */
+Drupal.behaviors.viewsHoverlinks = function() {
+ if ($.browser.msie) {
+ // If IE, attach a hover event so we can see our admin links.
+ $("div.view:not(.views-hover-processed)").addClass('views-hover-processed').hover(
+ function() {
+ $('div.views-hide', this).addClass("views-hide-hover"); return true;
+ },
+ function(){
+ $('div.views-hide', this).removeClass("views-hide-hover"); return true;
+ }
+ );
+ $("div.views-admin-links:not(.views-hover-processed)")
+ .addClass('views-hover-processed')
+ .hover(
+ function() {
+ $(this).addClass("views-admin-links-hover"); return true;
+ },
+ function(){
+ $(this).removeClass("views-admin-links-hover"); return true;
+ }
+ );
+ }
+}
+
+/**
+ * Helper function to parse a querystring.
+ */
+Drupal.Views.parseQueryString = function (query) {
+ var args = {};
+ var pos = query.indexOf('?');
+ if (pos != -1) {
+ query = query.substring(pos + 1);
+ }
+ var pairs = query.split('&');
+ for(var i in pairs) {
+ var pair = pairs[i].split('=');
+ // Ignore the 'q' path argument, if present.
+ if (pair[0] != 'q' && pair[1]) {
+ args[pair[0]] = decodeURIComponent(pair[1].replace(/\+/g, ' '));
+ }
+ }
+ return args;
+};
+
+/**
+ * Helper function to return a view's arguments based on a path.
+ */
+Drupal.Views.parseViewArgs = function (href, viewPath) {
+ var returnObj = {};
+ var path = Drupal.Views.getPath(href);
+ // Ensure we have a correct path.
+ if (viewPath && path.substring(0, viewPath.length + 1) == viewPath + '/') {
+ var args = decodeURIComponent(path.substring(viewPath.length + 1, path.length));
+ returnObj.view_args = args;
+ returnObj.view_path = path;
+ }
+ return returnObj;
+};
+
+/**
+ * Strip off the protocol plus domain from an href.
+ */
+Drupal.Views.pathPortion = function (href) {
+ // Remove e.g. http://example.com if present.
+ var protocol = window.location.protocol;
+ if (href.substring(0, protocol.length) == protocol) {
+ // 2 is the length of the '//' that normally follows the protocol
+ href = href.substring(href.indexOf('/', protocol.length + 2));
+ }
+ return href;
+};
+
+/**
+ * Return the Drupal path portion of an href.
+ */
+Drupal.Views.getPath = function (href) {
+ href = Drupal.Views.pathPortion(href);
+ href = href.substring(Drupal.settings.basePath.length, href.length);
+ // 3 is the length of the '?q=' added to the url without clean urls.
+ if (href.substring(0, 3) == '?q=') {
+ href = href.substring(3, href.length);
+ }
+ var chars = ['#', '?', '&'];
+ for (i in chars) {
+ if (href.indexOf(chars[i]) > -1) {
+ href = href.substr(0, href.indexOf(chars[i]));
+ }
+ }
+ return href;
+};
+;
+// $Id: dependent.js,v 1.9.2.1 2009/11/18 02:43:47 merlinofchaos Exp $
+/**
+ * @file dependent.js
+ *
+ * Written by dmitrig01 (Dmitri Gaskin) for Views; this provides dependent
+ * visibility for form items in Views' ajax forms.
+ *
+ * To your $form item definition add:
+ * - '#process' => array('views_process_dependency'),
+ * - Add '#dependency' => array('id-of-form-item' => array(list, of, values, that,
+ make, this, item, show),
+ *
+ * Special considerations:
+ * - radios are harder. Because Drupal doesn't give radio groups individual ids,
+ * use 'radio:name-of-radio'
+ *
+ * - Checkboxes don't have their own id, so you need to add one in a div
+ * around the checkboxes via #prefix and #suffix. You actually need to add TWO
+ * divs because it's the parent that gets hidden. Also be sure to retain the
+ * 'expand_checkboxes' in the #process array, because the views process will
+ * override it.
+ */
+
+Drupal.Views = Drupal.Views || {};
+
+Drupal.Views.dependent = { bindings: {}, activeBindings: {}, activeTriggers: [] };
+
+Drupal.Views.dependent.inArray = function(array, search_term) {
+ var i = array.length;
+ if (i > 0) {
+ do {
+ if (array[i] == search_term) {
+ return true;
+ }
+ } while (i--);
+ }
+ return false;
+}
+
+
+Drupal.Views.dependent.autoAttach = function() {
+ // Clear active bindings and triggers.
+ for (i in Drupal.Views.dependent.activeTriggers) {
+ jQuery(Drupal.Views.dependent.activeTriggers[i]).unbind('change');
+ }
+ Drupal.Views.dependent.activeTriggers = [];
+ Drupal.Views.dependent.activeBindings = {};
+ Drupal.Views.dependent.bindings = {};
+
+ if (!Drupal.settings.viewsAjax) {
+ return;
+ }
+
+ // Iterate through all relationships
+ for (id in Drupal.settings.viewsAjax.formRelationships) {
+
+ // Drupal.Views.dependent.activeBindings[id] is a boolean,
+ // whether the binding is active or not. Defaults to no.
+ Drupal.Views.dependent.activeBindings[id] = 0;
+ // Iterate through all possible values
+ for(bind_id in Drupal.settings.viewsAjax.formRelationships[id].values) {
+ // This creates a backward relationship. The bind_id is the ID
+ // of the element which needs to change in order for the id to hide or become shown.
+ // The id is the ID of the item which will be conditionally hidden or shown.
+ // Here we're setting the bindings for the bind
+ // id to be an empty array if it doesn't already have bindings to it
+ if (!Drupal.Views.dependent.bindings[bind_id]) {
+ Drupal.Views.dependent.bindings[bind_id] = [];
+ }
+ // Add this ID
+ Drupal.Views.dependent.bindings[bind_id].push(id);
+ // Big long if statement.
+ // Drupal.settings.viewsAjax.formRelationships[id].values[bind_id] holds the possible values
+
+ if (bind_id.substring(0, 6) == 'radio:') {
+ var trigger_id = "input[name='" + bind_id.substring(6) + "']";
+ }
+ else {
+ var trigger_id = '#' + bind_id;
+ }
+
+ Drupal.Views.dependent.activeTriggers.push(trigger_id);
+
+ if (jQuery(trigger_id).attr('type') == 'checkbox') {
+ $(trigger_id).parent().addClass('hidden-options');
+ }
+
+ var getValue = function(item, trigger) {
+ if (item.substring(0, 6) == 'radio:') {
+ var val = jQuery(trigger + ':checked').val();
+ }
+ else {
+ switch (jQuery(trigger).attr('type')) {
+ case 'checkbox':
+ var val = jQuery(trigger).attr('checked') || 0;
+
+ if (val) {
+ $(trigger).parent().removeClass('hidden-options').addClass('expanded-options');
+ }
+ else {
+ $(trigger).parent().removeClass('expanded-options').addClass('hidden-options');
+ }
+
+ break;
+ default:
+ var val = jQuery(trigger).val();
+ }
+ }
+ return val;
+ }
+
+ var setChangeTrigger = function(trigger_id, bind_id) {
+ // Triggered when change() is clicked.
+ var changeTrigger = function() {
+ var val = getValue(bind_id, trigger_id);
+
+ for (i in Drupal.Views.dependent.bindings[bind_id]) {
+ var id = Drupal.Views.dependent.bindings[bind_id][i];
+
+ // Fix numerous errors
+ if (typeof id != 'string') {
+ continue;
+ }
+
+ // This bit had to be rewritten a bit because two properties on the
+ // same set caused the counter to go up and up and up.
+ if (!Drupal.Views.dependent.activeBindings[id]) {
+ Drupal.Views.dependent.activeBindings[id] = {};
+ }
+
+ if (Drupal.Views.dependent.inArray(Drupal.settings.viewsAjax.formRelationships[id].values[bind_id], val)) {
+ Drupal.Views.dependent.activeBindings[id][bind_id] = 'bind';
+ }
+ else {
+ delete Drupal.Views.dependent.activeBindings[id][bind_id];
+ }
+
+ var len = 0;
+ for (i in Drupal.Views.dependent.activeBindings[id]) {
+ len++;
+ }
+
+ var object = jQuery('#' + id + '-wrapper');
+ if (!object.size()) {
+ object = jQuery('#' + id).parent();
+ }
+
+ var rel_num = Drupal.settings.viewsAjax.formRelationships[id].num;
+ if (typeof rel_num === 'object') {
+ rel_num = Drupal.settings.viewsAjax.formRelationships[id].num[0];
+ }
+
+ if (rel_num <= len) {
+ // Show if the element if criteria is matched
+ object.show(0);
+ object.addClass('dependent-options');
+ }
+ else {
+ // Otherwise hide
+ object.hide(0);
+ }
+ }
+ }
+
+ jQuery(trigger_id).change(function() {
+ // Trigger the internal change function
+ // the attr('id') is used because closures are more confusing
+ changeTrigger(trigger_id, bind_id);
+ });
+ // Trigger initial reaction
+ changeTrigger(trigger_id, bind_id);
+ }
+ setChangeTrigger(trigger_id, bind_id);
+ }
+ }
+}
+
+Drupal.behaviors.viewsDependent = function (context) {
+ Drupal.Views.dependent.autoAttach();
+
+ // Really large sets of fields are too slow with the above method, so this
+ // is a sort of hacked one that's faster but much less flexible.
+ $("select.views-master-dependent:not(.views-processed)")
+ .addClass('views-processed')
+ .change(function() {
+ var val = $(this).val();
+ if (val == 'all') {
+ $('.views-dependent-all').show(0);
+ }
+ else {
+ $('.views-dependent-all').hide(0);
+ $('.views-dependent-' + val).show(0);
+ }
+ })
+ .trigger('change');
+}
+;
+// $Id: tableheader.js,v 1.16.2.2 2009/03/30 12:48:09 goba Exp $
+
+Drupal.tableHeaderDoScroll = function() {
+ if (typeof(Drupal.tableHeaderOnScroll)=='function') {
+ Drupal.tableHeaderOnScroll();
+ }
+};
+
+Drupal.behaviors.tableHeader = function (context) {
+ // This breaks in anything less than IE 7. Prevent it from running.
+ if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7) {
+ return;
+ }
+
+ // Keep track of all cloned table headers.
+ var headers = [];
+
+ $('table.sticky-enabled thead:not(.tableHeader-processed)', context).each(function () {
+ // Clone thead so it inherits original jQuery properties.
+ var headerClone = $(this).clone(true).insertBefore(this.parentNode).wrap('<table class="sticky-header"></table>').parent().css({
+ position: 'fixed',
+ top: '0px'
+ });
+
+ headerClone = $(headerClone)[0];
+ headers.push(headerClone);
+
+ // Store parent table.
+ var table = $(this).parent('table')[0];
+ headerClone.table = table;
+ // Finish initialzing header positioning.
+ tracker(headerClone);
+
+ $(table).addClass('sticky-table');
+ $(this).addClass('tableHeader-processed');
+ });
+
+ // Define the anchor holding var.
+ var prevAnchor = '';
+
+ // Track positioning and visibility.
+ function tracker(e) {
+ // Save positioning data.
+ var viewHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
+ if (e.viewHeight != viewHeight) {
+ e.viewHeight = viewHeight;
+ e.vPosition = $(e.table).offset().top - 4;
+ e.hPosition = $(e.table).offset().left;
+ e.vLength = e.table.clientHeight - 100;
+ // Resize header and its cell widths.
+ var parentCell = $('th', e.table);
+ $('th', e).each(function(index) {
+ var cellWidth = parentCell.eq(index).css('width');
+ // Exception for IE7.
+ if (cellWidth == 'auto') {
+ cellWidth = parentCell.get(index).clientWidth +'px';
+ }
+ $(this).css('width', cellWidth);
+ });
+ $(e).css('width', $(e.table).css('width'));
+ }
+
+ // Track horizontal positioning relative to the viewport and set visibility.
+ var hScroll = document.documentElement.scrollLeft || document.body.scrollLeft;
+ var vOffset = (document.documentElement.scrollTop || document.body.scrollTop) - e.vPosition;
+ var visState = (vOffset > 0 && vOffset < e.vLength) ? 'visible' : 'hidden';
+ $(e).css({left: -hScroll + e.hPosition +'px', visibility: visState});
+
+ // Check the previous anchor to see if we need to scroll to make room for the header.
+ // Get the height of the header table and scroll up that amount.
+ if (prevAnchor != location.hash) {
+ if (location.hash != '') {
+ var offset = $('td' + location.hash).offset();
+ if (offset) {
+ var top = offset.top;
+ var scrollLocation = top - $(e).height();
+ $('body, html').scrollTop(scrollLocation);
+ }
+ }
+ prevAnchor = location.hash;
+ }
+ }
+
+ // Only attach to scrollbars once, even if Drupal.attachBehaviors is called
+ // multiple times.
+ if (!$('body').hasClass('tableHeader-processed')) {
+ $('body').addClass('tableHeader-processed');
+ $(window).scroll(Drupal.tableHeaderDoScroll);
+ $(document.documentElement).scroll(Drupal.tableHeaderDoScroll);
+ }
+
+ // Track scrolling.
+ Drupal.tableHeaderOnScroll = function() {
+ $(headers).each(function () {
+ tracker(this);
+ });
+ };
+
+ // Track resizing.
+ var time = null;
+ var resize = function () {
+ // Ensure minimum time between adjustments.
+ if (time) {
+ return;
+ }
+ time = setTimeout(function () {
+ $('table.sticky-header').each(function () {
+ // Force cell width calculation.
+ this.viewHeight = 0;
+ tracker(this);
+ });
+ // Reset timer
+ time = null;
+ }, 250);
+ };
+ $(window).resize(resize);
+};
+;
+// $Id: collapse.js,v 1.17 2008/01/29 10:58:25 goba Exp $
+
+/**
+ * Toggle the visibility of a fieldset using smooth animations
+ */
+Drupal.toggleFieldset = function(fieldset) {
+ if ($(fieldset).is('.collapsed')) {
+ // Action div containers are processed separately because of a IE bug
+ // that alters the default submit button behavior.
+ var content = $('> div:not(.action)', fieldset);
+ $(fieldset).removeClass('collapsed');
+ content.hide();
+ content.slideDown( {
+ duration: 'fast',
+ easing: 'linear',
+ complete: function() {
+ Drupal.collapseScrollIntoView(this.parentNode);
+ this.parentNode.animating = false;
+ $('div.action', fieldset).show();
+ },
+ step: function() {
+ // Scroll the fieldset into view
+ Drupal.collapseScrollIntoView(this.parentNode);
+ }
+ });
+ }
+ else {
+ $('div.action', fieldset).hide();
+ var content = $('> div:not(.action)', fieldset).slideUp('fast', function() {
+ $(this.parentNode).addClass('collapsed');
+ this.parentNode.animating = false;
+ });
+ }
+};
+
+/**
+ * Scroll a given fieldset into view as much as possible.
+ */
+Drupal.collapseScrollIntoView = function (node) {
+ var h = self.innerHeight || document.documentElement.clientHeight || $('body')[0].clientHeight || 0;
+ var offset = self.pageYOffset || document.documentElement.scrollTop || $('body')[0].scrollTop || 0;
+ var posY = $(node).offset().top;
+ var fudge = 55;
+ if (posY + node.offsetHeight + fudge > h + offset) {
+ if (node.offsetHeight > h) {
+ window.scrollTo(0, posY);
+ } else {
+ window.scrollTo(0, posY + node.offsetHeight - h + fudge);
+ }
+ }
+};
+
+Drupal.behaviors.collapse = function (context) {
+ $('fieldset.collapsible > legend:not(.collapse-processed)', context).each(function() {
+ var fieldset = $(this.parentNode);
+ // Expand if there are errors inside
+ if ($('input.error, textarea.error, select.error', fieldset).size() > 0) {
+ fieldset.removeClass('collapsed');
+ }
+
+ // Turn the legend into a clickable link and wrap the contents of the fieldset
+ // in a div for easier animation
+ var text = this.innerHTML;
+ $(this).empty().append($('<a href="#">'+ text +'</a>').click(function() {
+ var fieldset = $(this).parents('fieldset:first')[0];
+ // Don't animate multiple times
+ if (!fieldset.animating) {
+ fieldset.animating = true;
+ Drupal.toggleFieldset(fieldset);
+ }
+ return false;
+ }))
+ .after($('<div class="fieldset-wrapper"></div>')
+ .append(fieldset.children(':not(legend):not(.action)')))
+ .addClass('collapse-processed');
+ });
+};
+;
+Drupal.behaviors.Drupalorg = function () {
+ var $element = $('body:not(.drupalorg-front) #edit-search-theme-form-1'),
+ value = Drupal.t('Search Drupal.org');
+
+ // Add focus/blur label behavior to search box.
+ $element.bind('focus', function () {
+ if ($element.val() === value) {
+ $element.val('').addClass('has-value');
+ }
+ });
+ $element.bind('blur', function () {
+ if ($element.val() === '' || $element.val() === value) {
+ $element.val(value).removeClass('has-value');
+ }
+ else {
+ $element.addClass('has-value');
+ }
+ });
+ $element.trigger('blur');
+
+ // Move right column out of the way of wide tables used on API.drupal.org and
+ // forums.
+ if ($('#column-left.grid-8').length === 1) {
+ var delta = 0;
+ $('#column-left table').each(function() {
+ delta = Math.max(delta, $(this).width());
+ });
+ delta -= $('#column-left').width();
+ if (delta > 0) {
+ $('#page-inner').width($('#page-inner').width() + delta);
+ $('#column-left').width($('#column-left').width() + delta);
+ }
+ }
+};
+;
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/editabledropdown.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/editabledropdown.js
new file mode 100644
index 00000000..6511d8a0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/editabledropdown.js
@@ -0,0 +1,363 @@
+//Common functions for all dropdowns
+ /*----------------------------------------------
+ The Common function used for all dropdowns are:
+ -----------------------------------------------
+ -- function fnKeyDownHandler(getdropdown, e)
+ -- function fnLeftToRight(getdropdown)
+ -- function fnRightToLeft(getdropdown)
+ -- function fnDelete(getdropdown)
+ -- function FindKeyCode(e)
+ -- function FindKeyChar(e)
+ -- function fnSanityCheck(getdropdown)
+
+ --------------------------- */
+
+ function fnKeyDownHandler(getdropdown, e) {
+
+ fnSanityCheck(getdropdown);
+
+ // Press [ <- ] and [ -> ] arrow keys on the keyboard to change alignment/flow.
+ // ...go to Start : Press [ <- ] Arrow Key
+ // ...go to End : Press [ -> ] Arrow Key
+ // (this is useful when the edited-text content exceeds the ListBox-fixed-width)
+ // This works best on Internet Explorer, and not on Netscape
+
+ var vEventKeyCode = FindKeyCode(e);
+ // Press left/right arrow keys
+ if(vEventKeyCode == 37) {
+ fnLeftToRight(getdropdown);
+ }
+ if(vEventKeyCode == 39) {
+ fnRightToLeft(getdropdown);
+ }
+
+ // Delete key pressed
+ if(vEventKeyCode == 46) {
+ fnDelete(getdropdown);
+ }
+
+ // backspace key pressed
+ if(vEventKeyCode == 8 || vEventKeyCode==127) {
+ if(e.which) { //Netscape
+ //e.which = ''; //this property has only a getter.
+ } else { //Internet Explorer
+ //To prevent backspace from activating the -Back- button of the browser
+ e.keyCode = '';
+ if(window.event.keyCode) {
+ window.event.keyCode = '';
+ }
+ }
+ return true;
+ }
+ // Tab key pressed, use code below to reorient to Left-To-Right flow, if needed
+ //if(vEventKeyCode == 9)
+ //{
+ // fnLeftToRight(getdropdown);
+ //}
+ } // function fnKeyDownHandler
+
+ function fnLeftToRight(getdropdown) {
+ getdropdown.style.direction = "ltr";
+ } //function fnLeftToRight
+
+ function fnRightToLeft(getdropdown) {
+ getdropdown.style.direction = "rtl";
+ } //function fnRightToLeft
+
+ function fnDelete(getdropdown) {
+ if(getdropdown.options.length != 0) { // if dropdown is not empty
+ if (getdropdown.options.selectedIndex == vEditableOptionIndex_A) { // if option the Editable field
+ getdropdown.options[getdropdown.options.selectedIndex].text = '';
+ //getdropdown.options[getdropdown.options.selectedIndex].value = ''; //Use this line only if want to change the internal value too; else this line is not required.
+ }
+ }
+ } // function fnDelete
+
+
+ /*
+ Since Internet Explorer and Netscape have different
+ ways of returning the key code, displaying keys
+ browser-independently is a bit harder.
+ However, you can create a script that displays keys
+ for either browser.
+ The following function will display each key
+ in the status line:
+
+ The "FindKey.." function receives the "event" object
+ from the event handler and stores it in the variable "e".
+ It checks whether the "e.which" property exists (for Netscape),
+ and stores it in the "keycode" variable if present.
+ Otherwise, it assumes the browser is Internet Explorer
+ and assigns to keycode the "e.keyCode" property.
+ */
+
+ function FindKeyCode(e) {
+ if(e.which) {
+ keycode=e.which; //Netscape
+ } else {
+ keycode=e.keyCode; //Internet Explorer
+ }
+ //alert("FindKeyCode"+ keycode);
+ return keycode;
+ } // function FindKeyCode
+
+ function FindKeyChar(e) {
+ keycode = FindKeyCode(e);
+ if((keycode==8)||(keycode==127)) {
+ character="backspace"
+ }
+ else if((keycode==46)) {
+ character="delete"
+ }
+ else {
+ character=String.fromCharCode(keycode);
+ }
+ //alert("FindKey"+ character);
+ return character;
+ } // function FindKeyChar
+
+ function fnSanityCheck(getdropdown) {
+ if(vEditableOptionIndex_A>(getdropdown.options.length-1)) {
+ alert("PROGRAMMING ERROR: The value of variable vEditableOptionIndex_... cannot be greater than (length of dropdown - 1)");
+ return false;
+ }
+ }
+
+ //Dropdown specific functions, which manipulate dropdown specific global variables
+
+ /*----------------------------------------------
+ Dropdown specific global variables are:
+ -----------------------------------------------
+ 1) vEditableOptionIndex_A --> this needs to be set by Programmer!! See explanation.
+ 2) vEditableOptionText_A --> this needs to be set by Programmer!! See explanation.
+ 3) vPreviousSelectIndex_A
+ 4) vSelectIndex_A
+ 5) vSelectChange_A
+
+ --------------------------- */
+
+ /*----------------------------------------------
+ The dropdown specific functions
+ (which manipulate dropdown specific global variables)
+ used by all dropdowns are:
+ -----------------------------------------------
+ 1) function fnChangeHandler_A(getdropdown)
+ 2) function fnKeyPressHandler_A(getdropdown, e)
+ 3) function fnKeyUpHandler_A(getdropdown, e)
+
+ --------------------------- */
+
+ /*------------------------------------------------
+ IMPORTANT: Global Variable required to be SET by programmer
+ -------------------------- */
+
+ var vEditableOptionIndex_A = 0;
+
+ // Give Index of Editable option in the dropdown.
+ // For eg.
+ // if first option is editable then vEditableOptionIndex_A = 0;
+ // if second option is editable then vEditableOptionIndex_A = 1;
+ // if third option is editable then vEditableOptionIndex_A = 2;
+ // if last option is editable then vEditableOptionIndex_A = (length of dropdown - 1).
+ // Note: the value of vEditableOptionIndex_A cannot be greater than (length of dropdown - 1)
+
+ var vEditableOptionText_A = "Custom";
+
+ // Give the default text of the Editable option in the dropdown.
+ // For eg.
+ // if the editable option is <option ...>--?--</option>,
+ // then set vEditableOptionText_A = "--?--";
+
+ /*------------------------------------------------
+ Global Variables required for
+ fnChangeHandler_A(), fnKeyPressHandler_A() and fnKeyUpHandler_A()
+ for Editable Dropdowns
+ -------------------------- */
+
+ var vPreviousSelectIndex_A = 0;
+ // Contains the Previously Selected Index, set to 0 by default
+
+ var vSelectIndex_A = 0;
+ // Contains the Currently Selected Index, set to 0 by default
+
+ var vSelectChange_A = 'MANUAL_CLICK';
+ // Indicates whether Change in dropdown selected option
+ // was due to a Manual Click
+ // or due to System properties of dropdown.
+
+ // vSelectChange_A = 'MANUAL_CLICK' indicates that
+ // the jump to a non-editable option in the dropdown was due
+ // to a Manual click (i.e.,changed on purpose by user).
+
+ // vSelectChange_A = 'AUTO_SYSTEM' indicates that
+ // the jump to a non-editable option was due to System properties of dropdown
+ // (i.e.,user did not change the option in the dropdown;
+ // instead an automatic jump happened due to inbuilt
+ // dropdown properties of browser on typing of a character )
+
+ /*------------------------------------------------
+ Functions required for Editable Dropdowns
+ -------------------------- */
+
+ function fnChangeHandler_A(getdropdown, e) {
+ fnSanityCheck(getdropdown);
+
+ vPreviousSelectIndex_A = vSelectIndex_A;
+ // Contains the Previously Selected Index
+
+ vSelectIndex_A = getdropdown.options.selectedIndex;
+ // Contains the Currently Selected Index
+
+ if ((vPreviousSelectIndex_A == (vEditableOptionIndex_A)) && (vSelectIndex_A != (vEditableOptionIndex_A))&&(vSelectChange_A != 'MANUAL_CLICK')) { // To Set value of Index variables -
+ getdropdown[(vEditableOptionIndex_A)].selected=true;
+ vPreviousSelectIndex_A = vSelectIndex_A;
+ vSelectIndex_A = getdropdown.options.selectedIndex;
+ vSelectChange_A = 'MANUAL_CLICK';
+ // Indicates that the Change in dropdown selected
+ // option was due to a Manual Click
+ }
+ } // function fnChangeHandler_A
+
+ function fnKeyPressHandler_A(getdropdown, e) {
+ fnSanityCheck(getdropdown);
+
+ keycode = FindKeyCode(e);
+ keychar = FindKeyChar(e);
+
+ // Check for allowable Characters
+ // The various characters allowable for entry into Editable option..
+ // may be customized by minor modifications in the code (if condition below)
+ // (you need to know the keycode/ASCII value of the character to be allowed/disallowed.
+ // -
+
+ if ((keycode>47 && keycode<59)||(keycode>62 && keycode<127) ||(keycode==32)) {
+ var vAllowableCharacter = "yes";
+ }
+ else {
+ var vAllowableCharacter = "no";
+ }
+
+ //alert(window); alert(window.event);
+
+ if(getdropdown.options.length != 0) {
+ // if dropdown is not empty
+ if (getdropdown.options.selectedIndex == (vEditableOptionIndex_A)) {
+ // if selected option the Editable option of the dropdown
+
+ var vEditString = getdropdown[vEditableOptionIndex_A].text;
+
+ // make Editable option Null if it is being edited for the first time
+ if((vAllowableCharacter == "yes")||(keychar=="backspace")) {
+ if (vEditString == vEditableOptionText_A)
+ vEditString = "";
+ }
+ if (keychar=="backspace") {
+ // To handle backspace -
+ vEditString = vEditString.substring(0,vEditString.length-1);
+ // Decrease length of string by one from right
+
+ vSelectChange_A = 'MANUAL_CLICK';
+ // Indicates that the Change in dropdown selected
+ // option was due to a Manual Click
+
+ }
+ //alert("EditString2:"+vEditString);
+
+ if (vAllowableCharacter == "yes") {
+ // To handle addition of a character -
+ vEditString+=String.fromCharCode(keycode);
+ // Concatenate Enter character to Editable string
+
+ // The following portion handles the "automatic Jump" bug
+ // The "automatic Jump" bug (Description):
+ // If a alphabet is entered (while editing)
+ // ...which is contained as a first character in one of the read-only options
+ // ..the focus automatically "jumps" to the read-only option
+ // (-- this is a common property of normal dropdowns
+ // ..but..is undesirable while editing).
+
+ var i=0;
+ var vEnteredChar = String.fromCharCode(keycode);
+ var vUpperCaseEnteredChar = vEnteredChar;
+ var vLowerCaseEnteredChar = vEnteredChar;
+
+
+ if(((keycode)>=97)&&((keycode)<=122))
+ // if vEnteredChar lowercase
+ vUpperCaseEnteredChar = String.fromCharCode(keycode - 32);
+ // This is UpperCase
+
+
+ if(((keycode)>=65)&&((keycode)<=90))
+ // if vEnteredChar is UpperCase
+ vLowerCaseEnteredChar = String.fromCharCode(keycode + 32);
+ // This is lowercase
+
+ if(e.which) { //For Netscape
+ // Compare the typed character (into the editable option)
+ // with the first character of all the other
+ // options (non-editable).
+
+ // To note if the jump to the non-editable option was due
+ // to a Manual click (i.e.,changed on purpose by user)
+ // or due to System properties of dropdown
+ // (i.e.,user did not change the option in the dropdown;
+ // instead an automatic jump happened due to inbuilt
+ // dropdown properties of browser on typing of a character )
+
+ for (i=0;i<=(getdropdown.options.length-1);i++)
+ {
+ if(i!=vEditableOptionIndex_A)
+ {
+ var vReadOnlyString = getdropdown[i].text;
+ var vFirstChar = vReadOnlyString.substring(0,1);
+ if((vFirstChar == vUpperCaseEnteredChar)||(vFirstChar == vLowerCaseEnteredChar))
+ {
+ vSelectChange_A = 'AUTO_SYSTEM';
+ // Indicates that the Change in dropdown selected
+ // option was due to System properties of dropdown
+ break;
+ }
+ else
+ {
+ vSelectChange_A = 'MANUAL_CLICK';
+ // Indicates that the Change in dropdown selected
+ // option was due to a Manual Click
+ }
+ }
+ }
+ }
+ }
+
+ // Set the new edited string into the Editable option
+ getdropdown.options[vEditableOptionIndex_A].text = vEditString;
+ //getdropdown.options[vEditableOptionIndex_A].value = vEditString; //Use this line only if want to change the internal value too; else this line is not required.
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ function fnKeyUpHandler_A(getdropdown, e) {
+ fnSanityCheck(getdropdown);
+
+ if(e.which) { // Netscape
+ if(vSelectChange_A == 'AUTO_SYSTEM') {
+ // if editable dropdown option jumped while editing
+ // (due to typing of a character which is the first character of some other option)
+ // then go back to the editable option.
+ getdropdown[(vEditableOptionIndex_A)].selected=true;
+ }
+
+ var vEventKeyCode = FindKeyCode(e);
+ // if [ <- ] or [ -> ] arrow keys are pressed, select the editable option
+ if((vEventKeyCode == 37)||(vEventKeyCode == 39)) {
+ getdropdown[vEditableOptionIndex_A].selected=true;
+ }
+ }
+ }
+
+/*-------------------------------------------------------------------------------------------- */
+
+<!--end of script for dropdown lstDropDown_A --> \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/form-field-tooltip.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/form-field-tooltip.js
new file mode 100644
index 00000000..b499ca08
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/form-field-tooltip.js
@@ -0,0 +1,715 @@
+/************************************************************************************************************
+
+ Form field tooltip
+ (C) www.dhtmlgoodies.com, September 2006
+
+ This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.
+
+ Terms of use:
+ Look at the terms of use at http://www.dhtmlgoodies.com/index.html?page=termsOfUse
+
+ Thank you!
+
+ www.dhtmlgoodies.com
+ Alf Magne Kalleland
+
+************************************************************************************************************/
+
+var DHTMLgoodies_globalTooltipObj;
+
+
+/**
+Constructor
+**/
+function DHTMLgoodies_formTooltip()
+{
+ var tooltipDiv;
+ var tooltipText;
+ var tooltipContentDiv; // Reference to inner div with tooltip content
+ var imagePath; // Relative path to images
+ var arrowImageFile; // Name of arrow image
+ var arrowImageFileRight; // Name of arrow image
+ var arrowRightWidth;
+ var arrowTopHeight;
+ var tooltipWidth; // Width of tooltip
+ var roundedCornerObj; // Reference to object of class DHTMLgoodies_roundedCorners
+ var tooltipBgColor;
+ var closeMessage; // Close message
+ var activeInput; // Reference to currently active input
+ var tooltipPosition; // Tooltip position, possible values: "below" or "right"
+ var tooltipCornerSize; // Size of rounded corners
+ var displayArrow; // Display arrow above or at the left of the tooltip?
+ var cookieName; // Name of cookie
+ var disableTooltipPossibility; // Possibility of disabling tooltip
+ var disableTooltipByCookie; // If tooltip has been disabled, save the settings in cookie, i.e. for other pages with the same cookie name.
+ var disableTooltipMessage;
+ var tooltipDisabled;
+ var isMSIE;
+ var tooltipIframeObj;
+ var pageBgColor; // Color of background - used in ie when applying iframe which covers select boxes
+ var currentTooltipObj; // Reference to form field which tooltip is currently showing for
+
+ this.currentTooltipObj = false,
+ this.tooltipDiv = false,
+ this.tooltipText = false;
+ this.imagePath = 'static/fusion/raptor/images/';
+ this.arrowImageFile = 'green-arrow.gif';
+ this.arrowImageFileRight = 'green-arrow-right.gif';
+ this.tooltipWidth = 200;
+ this.tooltipBgColor = '#317082';
+ this.closeMessage = 'Close';
+ this.disableTooltipMessage = 'Don\'t show this message again';
+ this.activeInput = false;
+ this.tooltipPosition = 'right';
+ this.arrowRightWidth = 16; // Default width of arrow when the tooltip is on the right side of the inputs.
+ this.arrowTopHeight = 13; // Default height of arrow at the top of tooltip
+ this.tooltipCornerSize = 10;
+ this.displayArrow = true;
+ this.cookieName = 'DHTMLgoodies_tooltipVisibility';
+ this.disableTooltipByCookie = false;
+ this.tooltipDisabled = false;
+ this.disableTooltipPossibility = true;
+ this.tooltipIframeObj = false;
+ this.pageBgColor = '#FFFFFF';
+
+ DHTMLgoodies_globalTooltipObj = this;
+
+ if(navigator.userAgent.indexOf('MSIE')>=0)this.isMSIE = true; else this.isMSIE = false;
+}
+
+
+DHTMLgoodies_formTooltip.prototype = {
+ // {{{ initFormFieldTooltip()
+ /**
+ *
+ *
+ * Initializes the tooltip script. Most set methods needs to be executed before you call this method.
+ *
+ * @public
+ */
+ initFormFieldTooltip : function()
+ {
+ var formElements = new Array();
+ var inputs = document.getElementsByTagName('IMG');
+ for(var no=0;no<inputs.length;no++){
+ var attr = inputs[no].getAttribute('tooltipText');
+ if(!attr)attr = inputs[no].tooltipText;
+ if(attr)formElements[formElements.length] = inputs[no];
+ }
+
+ var inputs = document.getElementsByTagName('INPUT');
+ for(var no=0;no<inputs.length;no++){
+ var attr = inputs[no].getAttribute('tooltipText');
+ if(!attr)attr = inputs[no].tooltipText;
+ if(attr)formElements[formElements.length] = inputs[no];
+ }
+
+ var inputs = document.getElementsByTagName('TEXTAREA');
+ for(var no=0;no<inputs.length;no++){
+ var attr = inputs[no].getAttribute('tooltipText');
+ if(!attr)attr = inputs[no].tooltipText;
+ if(attr)formElements[formElements.length] = inputs[no];
+ }
+ var inputs = document.getElementsByTagName('SELECT');
+ for(var no=0;no<inputs.length;no++){
+ var attr = inputs[no].getAttribute('tooltipText');
+ if(!attr)attr = inputs[no].tooltipText;
+ if(attr)formElements[formElements.length] = inputs[no];
+ }
+
+ window.refToFormTooltip = this;
+
+ for(var no=0;no<formElements.length;no++){
+ formElements[no].onfocus = this.__displayTooltip;
+ }
+ this.addEvent(window,'resize',function(){ window.refToFormTooltip.__positionCurrentToolTipObj(); });
+
+ this.addEvent(document.documentElement,'click',function(e){ window.refToFormTooltip.__autoHideTooltip(e); });
+ }
+
+ // }}}
+ ,
+ // {{{ setTooltipPosition()
+ /**
+ *
+ *
+ * Specify position of tooltip(below or right)
+ * @param String newPosition (Possible values: "below" or "right")
+ *
+ * @public
+ */
+ setTooltipPosition : function(newPosition)
+ {
+ this.tooltipPosition = newPosition;
+ }
+ // }}}
+ ,
+ // {{{ setCloseMessage()
+ /**
+ *
+ *
+ * Specify "Close" message
+ * @param String closeMessage
+ *
+ * @public
+ */
+ setCloseMessage : function(closeMessage)
+ {
+ this.closeMessage = closeMessage;
+ }
+ // }}}
+ ,
+ // {{{ setDisableTooltipMessage()
+ /**
+ *
+ *
+ * Specify disable tooltip message at the bottom of the tooltip
+ * @param String disableTooltipMessage
+ *
+ * @public
+ */
+ setDisableTooltipMessage : function(disableTooltipMessage)
+ {
+ this.disableTooltipMessage = disableTooltipMessage;
+ }
+ // }}}
+ ,
+ // {{{ setTooltipDisablePossibility()
+ /**
+ *
+ *
+ * Specify whether you want the disable link to appear or not.
+ * @param Boolean disableTooltipPossibility
+ *
+ * @public
+ */
+ setTooltipDisablePossibility : function(disableTooltipPossibility)
+ {
+ this.disableTooltipPossibility = disableTooltipPossibility;
+ }
+ // }}}
+ ,
+ // {{{ setCookieName()
+ /**
+ *
+ *
+ * Specify name of cookie. Useful if you're using this script on several pages.
+ * @param String newCookieName
+ *
+ * @public
+ */
+ setCookieName : function(newCookieName)
+ {
+ this.cookieName = newCookieName;
+ }
+ // }}}
+ ,
+ // {{{ setTooltipWidth()
+ /**
+ *
+ *
+ * Specify width of tooltip
+ * @param Int newWidth
+ *
+ * @public
+ */
+ setTooltipWidth : function(newWidth)
+ {
+ this.tooltipWidth = newWidth;
+ }
+
+ // }}}
+ ,
+ // {{{ setArrowVisibility()
+ /**
+ *
+ *
+ * Display arrow at the top or at the left of the tooltip?
+ * @param Boolean displayArrow
+ *
+ * @public
+ */
+
+ setArrowVisibility : function(displayArrow)
+ {
+ this.displayArrow = displayArrow;
+ }
+
+ // }}}
+ ,
+ // {{{ setTooltipBgColor()
+ /**
+ *
+ *
+ * Send true to this method if you want to be able to save tooltip visibility in cookie. If it's set to true,
+ * It means that when someone returns to the page, the tooltips won't show.
+ *
+ * @param Boolean disableTooltipByCookie
+ *
+ * @public
+ */
+ setDisableTooltipByCookie : function(disableTooltipByCookie)
+ {
+ this.disableTooltipByCookie = disableTooltipByCookie;
+ }
+ // }}}
+ ,
+ // {{{ setTooltipBgColor()
+ /**
+ *
+ *
+ * This method specifies background color of tooltip
+ * @param String newBgColor
+ *
+ * @public
+ */
+ setTooltipBgColor : function(newBgColor)
+ {
+ this.tooltipBgColor = newBgColor;
+ }
+
+ // }}}
+ ,
+ // {{{ setTooltipCornerSize()
+ /**
+ *
+ *
+ * Size of rounded corners around tooltip
+ * @param Int newSize (0 = no rounded corners)
+ *
+ * @public
+ */
+ setTooltipCornerSize : function(tooltipCornerSize)
+ {
+ this.tooltipCornerSize = tooltipCornerSize;
+ }
+
+ // }}}
+ ,
+ // {{{ setTopArrowHeight()
+ /**
+ *
+ *
+ * Size height of arrow at the top of tooltip
+ * @param Int arrowTopHeight
+ *
+ * @public
+ */
+ setTopArrowHeight : function(arrowTopHeight)
+ {
+ this.arrowTopHeight = arrowTopHeight;
+ }
+
+ // }}}
+ ,
+ // {{{ setRightArrowWidth()
+ /**
+ *
+ *
+ * Size width of arrow when the tooltip is on the right side of inputs
+ * @param Int arrowTopHeight
+ *
+ * @public
+ */
+ setRightArrowWidth : function(arrowRightWidth)
+ {
+ this.arrowRightWidth = arrowRightWidth;
+ }
+
+ // }}}
+ ,
+ // {{{ setPageBgColor()
+ /**
+ *
+ *
+ * Specify background color of page.
+ * @param String pageBgColor
+ *
+ * @public
+ */
+ setPageBgColor : function(pageBgColor)
+ {
+ this.pageBgColor = pageBgColor;
+ }
+
+ // }}}
+ ,
+ // {{{ __hideTooltip()
+ /**
+ *
+ *
+ * This method displays the tooltip
+ *
+ *
+ * @private
+ */
+ __displayTooltip : function()
+ {
+ if(DHTMLgoodies_globalTooltipObj.disableTooltipByCookie){
+ var cookieValue = DHTMLgoodies_globalTooltipObj.getCookie(DHTMLgoodies_globalTooltipObj.cookieName) + '';
+ if(cookieValue=='1')DHTMLgoodies_globalTooltipObj.tooltipDisabled = true;
+ }
+
+ if(DHTMLgoodies_globalTooltipObj.tooltipDisabled)return; // Tooltip disabled
+ var tooltipText = this.getAttribute('tooltipText');
+ DHTMLgoodies_globalTooltipObj.activeInput = this;
+
+ if(!tooltipText)tooltipText = this.tooltipText;
+ DHTMLgoodies_globalTooltipObj.tooltipText = tooltipText;
+
+
+ if(!DHTMLgoodies_globalTooltipObj.tooltipDiv)DHTMLgoodies_globalTooltipObj.__createTooltip();
+
+ DHTMLgoodies_globalTooltipObj.__positionTooltip(this);
+
+
+
+
+ DHTMLgoodies_globalTooltipObj.tooltipContentDiv.innerHTML = tooltipText;
+ DHTMLgoodies_globalTooltipObj.tooltipDiv.style.display='block';
+
+ if(DHTMLgoodies_globalTooltipObj.isMSIE){
+ if(DHTMLgoodies_globalTooltipObj.tooltipPosition == 'below'){
+ DHTMLgoodies_globalTooltipObj.tooltipIframeObj.style.height = (DHTMLgoodies_globalTooltipObj.tooltipDiv.clientHeight - DHTMLgoodies_globalTooltipObj.arrowTopHeight);
+ }else{
+ DHTMLgoodies_globalTooltipObj.tooltipIframeObj.style.height = (DHTMLgoodies_globalTooltipObj.tooltipDiv.clientHeight);
+ }
+ }
+
+ }
+ // }}}
+ ,
+ // {{{ __hideTooltip()
+ /**
+ *
+ *
+ * This function hides the tooltip
+ *
+ *
+ * @private
+ */
+ __hideTooltip : function()
+ {
+ try{
+ DHTMLgoodies_globalTooltipObj.tooltipDiv.style.display='none';
+ }catch(e){
+ }
+
+ }
+ // }}}
+ ,
+ // {{{ getSrcElement()
+ /**
+ *
+ *
+ * Return the source of an event.
+ *
+ *
+ * @private
+ */
+ getSrcElement : function(e)
+ {
+ var el;
+ if (e.target) el = e.target;
+ else if (e.srcElement) el = e.srcElement;
+ if (el.nodeType == 3) // defeat Safari bug
+ el = el.parentNode;
+ return el;
+ }
+ // }}}
+ ,
+ __autoHideTooltip : function(e)
+ {
+ if(document.all)e = event;
+ var src = this.getSrcElement(e);
+ if(src.tagName.toLowerCase()!='input' && src.tagName.toLowerCase().toLowerCase()!='textarea' && src.tagName.toLowerCase().toLowerCase()!='select')this.__hideTooltip();
+
+ var attr = src.getAttribute('tooltipText');
+ if(!attr)attr = src.tooltipText;
+ if(!attr){
+ this.__hideTooltip();
+ }
+
+ }
+ // }}}
+ ,
+ // {{{ __hideTooltipFromLink()
+ /**
+ *
+ *
+ * This function hides the tooltip
+ *
+ *
+ * @private
+ */
+ __hideTooltipFromLink : function()
+ {
+
+ this.activeInput.focus();
+ window.refToThis = this;
+ setTimeout('window.refToThis.__hideTooltip()',10);
+ }
+ // }}}
+ ,
+ // {{{ disableTooltip()
+ /**
+ *
+ *
+ * Hide tooltip and disable it
+ *
+ *
+ * @public
+ */
+ disableTooltip : function()
+ {
+ this.__hideTooltipFromLink();
+ if(this.disableTooltipByCookie)this.setCookie(this.cookieName,'1',500);
+ this.tooltipDisabled = true;
+ }
+ // }}}
+ ,
+ // {{{ __positionTooltip()
+ /**
+ *
+ *
+ * This function creates the tooltip elements
+ *
+ *
+ * @private
+ */
+ __createTooltip : function()
+ {
+ this.tooltipDiv = document.createElement('DIV');
+ this.tooltipDiv.style.position = 'absolute';
+
+ if(this.displayArrow){
+ var topDiv = document.createElement('DIV');
+
+ if(this.tooltipPosition=='below'){
+
+ topDiv.style.marginLeft = '20px';
+ var arrowDiv = document.createElement('IMG');
+ arrowDiv.src = this.imagePath + this.arrowImageFile + '?rand='+ Math.random();
+ arrowDiv.style.display='block';
+ topDiv.appendChild(arrowDiv);
+
+ }else{
+ topDiv.style.marginTop = '5px';
+ var arrowDiv = document.createElement('IMG');
+ arrowDiv.src = this.imagePath + this.arrowImageFileRight + '?rand='+ Math.random();
+ arrowDiv.style.display='block';
+ topDiv.appendChild(arrowDiv);
+ topDiv.style.position = 'absolute';
+ }
+
+ this.tooltipDiv.appendChild(topDiv);
+ }
+
+ var outerDiv = document.createElement('DIV');
+ outerDiv.style.position = 'relative';
+ outerDiv.style.zIndex = 1000;
+ if(this.tooltipPosition!='below' && this.displayArrow){
+ outerDiv.style.left = this.arrowRightWidth + 'px';
+ }
+
+ outerDiv.id = 'DHTMLgoodies_formTooltipDiv';
+ outerDiv.className = 'DHTMLgoodies_formTooltipDiv';
+ outerDiv.style.backgroundColor = this.tooltipBgColor;
+ this.tooltipDiv.appendChild(outerDiv);
+
+ if(this.isMSIE){
+ this.tooltipIframeObj = document.createElement('<IFRAME name="tooltipIframeObj" width="' + this.tooltipWidth + '" frameborder="no" src="about:blank"></IFRAME>');
+ this.tooltipIframeObj.style.position = 'absolute';
+ this.tooltipIframeObj.style.top = '0px';
+ this.tooltipIframeObj.style.left = '0px';
+ this.tooltipIframeObj.style.width = (this.tooltipWidth) + 'px';
+ this.tooltipIframeObj.style.zIndex = 100;
+ this.tooltipIframeObj.background = this.pageBgColor;
+ this.tooltipIframeObj.style.backgroundColor= this.pageBgColor;
+ this.tooltipDiv.appendChild(this.tooltipIframeObj);
+ if(this.tooltipPosition!='below' && this.displayArrow){
+ this.tooltipIframeObj.style.left = (this.arrowRightWidth) + 'px';
+ }else{
+ this.tooltipIframeObj.style.top = this.arrowTopHeight + 'px';
+ }
+
+ setTimeout("self.frames['tooltipIframeObj'].document.documentElement.style.backgroundColor='" + this.pageBgColor + "'",500);
+
+ }
+
+ this.tooltipContentDiv = document.createElement('DIV');
+ this.tooltipContentDiv.style.position = 'relative';
+ this.tooltipContentDiv.id = 'DHTMLgoodies_formTooltipContent';
+ outerDiv.appendChild(this.tooltipContentDiv);
+
+ var closeDiv = document.createElement('DIV');
+ closeDiv.style.textAlign = 'center';
+
+ closeDiv.innerHTML = '<A class="DHTMLgoodies_formTooltip_closeMessage" href="#" onclick="DHTMLgoodies_globalTooltipObj.__hideTooltipFromLink();return false">' + this.closeMessage + '</A>';
+
+ if(this.disableTooltipPossibility){
+ var tmpHTML = closeDiv.innerHTML;
+ tmpHTML = tmpHTML + ' | <A class="DHTMLgoodies_formTooltip_closeMessage" href="#" onclick="DHTMLgoodies_globalTooltipObj.disableTooltip();return false">' + this.disableTooltipMessage + '</A>';
+ closeDiv.innerHTML = tmpHTML;
+ }
+
+ outerDiv.appendChild(closeDiv);
+
+ document.body.appendChild(this.tooltipDiv);
+
+
+
+ if(this.tooltipCornerSize>0){
+ this.roundedCornerObj = new DHTMLgoodies_roundedCorners();
+ // (divId,xRadius,yRadius,color,backgroundColor,padding,heightOfContent,whichCorners)
+ this.roundedCornerObj.addTarget('DHTMLgoodies_formTooltipDiv',this.tooltipCornerSize,this.tooltipCornerSize,this.tooltipBgColor,this.pageBgColor,5);
+ this.roundedCornerObj.init();
+ }
+
+
+ this.tooltipContentDiv = document.getElementById('DHTMLgoodies_formTooltipContent');
+ }
+ // }}}
+ ,
+ addEvent : function(whichObject,eventType,functionName)
+ {
+ if(whichObject.attachEvent){
+ whichObject['e'+eventType+functionName] = functionName;
+ whichObject[eventType+functionName] = function(){whichObject['e'+eventType+functionName]( window.event );}
+ whichObject.attachEvent( 'on'+eventType, whichObject[eventType+functionName] );
+ } else
+ whichObject.addEventListener(eventType,functionName,false);
+ }
+ // }}}
+ ,
+ __positionCurrentToolTipObj : function()
+ {
+ if(DHTMLgoodies_globalTooltipObj.activeInput)this.__positionTooltip(DHTMLgoodies_globalTooltipObj.activeInput);
+
+ }
+ // }}}
+ ,
+ // {{{ __positionTooltip()
+ /**
+ *
+ *
+ * This function positions the tooltip
+ *
+ * @param Obj inputObj = Reference to text input
+ *
+ * @private
+ */
+ __positionTooltip : function(inputObj)
+ {
+ var offset = 0;
+ if(!this.displayArrow)offset = 3;
+ if(this.tooltipPosition=='below'){
+ this.tooltipDiv.style.left = this.getLeftPos(inputObj)+ 'px';
+ this.tooltipDiv.style.top = (this.getTopPos(inputObj) + inputObj.offsetHeight + offset) + 'px';
+ }else{
+
+ this.tooltipDiv.style.left = (this.getLeftPos(inputObj) + inputObj.offsetWidth + offset)+ 'px';
+ this.tooltipDiv.style.top = this.getTopPos(inputObj) + 'px';
+ }
+ this.tooltipDiv.style.width=this.tooltipWidth + 'px';
+
+ }
+ ,
+ // {{{ getTopPos()
+ /**
+ * This method will return the top coordinate(pixel) of an object
+ *
+ * @param Object inputObj = Reference to HTML element
+ * @public
+ */
+ getTopPos : function(inputObj)
+ {
+ var returnValue = inputObj.offsetTop;
+ while((inputObj = inputObj.offsetParent) != null){
+ if(inputObj.tagName!='HTML'){
+ returnValue += inputObj.offsetTop;
+ if(document.all)returnValue+=inputObj.clientTop;
+ }
+ }
+ return returnValue;
+ }
+ // }}}
+
+ ,
+ // {{{ getLeftPos()
+ /**
+ * This method will return the left coordinate(pixel) of an object
+ *
+ * @param Object inputObj = Reference to HTML element
+ * @public
+ */
+ getLeftPos : function(inputObj)
+ {
+ var returnValue = inputObj.offsetLeft;
+ while((inputObj = inputObj.offsetParent) != null){
+ if(inputObj.tagName!='HTML'){
+ returnValue += inputObj.offsetLeft;
+ if(document.all)returnValue+=inputObj.clientLeft;
+ }
+ }
+ return returnValue;
+ }
+
+ ,
+
+ // {{{ getCookie()
+ /**
+ *
+ * These cookie functions are downloaded from
+ * http://www.mach5.com/support/analyzer/manual/html/General/CookiesJavaScript.htm
+ *
+ * This function returns the value of a cookie
+ *
+ * @param String name = Name of cookie
+ * @param Object inputObj = Reference to HTML element
+ * @public
+ */
+ getCookie : function(name) {
+ var start = document.cookie.indexOf(name+"=");
+ var len = start+name.length+1;
+ if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
+ if (start == -1) return null;
+ var end = document.cookie.indexOf(";",len);
+ if (end == -1) end = document.cookie.length;
+ return unescape(document.cookie.substring(len,end));
+ }
+ // }}}
+ ,
+
+ // {{{ setCookie()
+ /**
+ *
+ * These cookie functions are downloaded from
+ * http://www.mach5.com/support/analyzer/manual/html/General/CookiesJavaScript.htm
+ *
+ * This function creates a cookie. (This method has been slighhtly modified)
+ *
+ * @param String name = Name of cookie
+ * @param String value = Value of cookie
+ * @param Int expires = Timestamp - days
+ * @param String path = Path for cookie (Usually left empty)
+ * @param String domain = Cookie domain
+ * @param Boolean secure = Secure cookie(SSL)
+ *
+ * @public
+ */
+ setCookie : function(name,value,expires,path,domain,secure) {
+ expires = expires * 60*60*24*1000;
+ var today = new Date();
+ var expires_date = new Date( today.getTime() + (expires) );
+ var cookieString = name + "=" +escape(value) +
+ ( (expires) ? ";expires=" + expires_date.toGMTString() : "") +
+ ( (path) ? ";path=" + path : "") +
+ ( (domain) ? ";domain=" + domain : "") +
+ ( (secure) ? ";secure" : "");
+ document.cookie = cookieString;
+ }
+ // }}}
+
+
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/gmap.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/gmap.js
new file mode 100644
index 00000000..ba214f61
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/gmap.js
@@ -0,0 +1,634 @@
+var map;
+var popupTable;
+var networkOverlay;
+var selectedNetworkOverlay;
+var flashTimeout;
+//var infoDiv;
+var mainInfoDiv;
+var locationInfoDiv;
+var loadingAnimationDiv;
+var geocoder;
+var addressMarker;
+var popupDiv;
+//var novaButton;
+
+function novaMapInit() {
+ if (GBrowserIsCompatible()) {
+ var dmap = document.getElementById("map");
+ map = new GMap2(dmap);
+ var defaultCenterLongitude = document.getElementById("defaultCenterLongitude").value;
+ var defaultCenterLatitude = document.getElementById("defaultCenterLatitude").value;
+ var defaultZoomLevel = document.getElementById("defaultZoomLevel").value * 1;
+
+ map.setCenter(new GLatLng(defaultCenterLatitude, defaultCenterLongitude), defaultZoomLevel);
+
+ map.enableScrollWheelZoom();
+ map.enableContinuousZoom();
+ map.addControl(new GLargeMapControl());
+ map.addControl(new GMapTypeControl());
+
+ geocoder = new GClientGeocoder();
+
+ GEvent.addListener(map, "dragend", mapDragEnd);
+ GEvent.addListener(map, "zoomend", mapZoomChanged);
+ GEvent.addListener(map, "click", mapClicked);
+ GEvent.addListener(map, "moveend", mapMoveEnd)
+ GEvent.addListener(map, "singlerightclick", mapRightClicked);
+ GEvent.addListener(map, "mousemove", function(latlng) {
+ locationInfoDiv.innerHTML = latlng.lng().toFixed(3) + ", " + latlng.lat().toFixed(3);
+ });
+
+ var n = document.getElementById("popupmenudiv2");
+ popupDiv = n.cloneNode(true);
+ map.getContainer().appendChild(popupDiv);
+
+ popupTable = document.getElementById("popupmenudivtb");
+
+ // detail info div
+ /*infoDiv = document.createElement("div");
+ infoDiv.style.display = "none";
+ infoDiv.style.position = "absolute";
+ infoDiv.style.overflow = "auto";
+ infoDiv.style.top = "0px";
+ infoDiv.style.left = "0px";
+ infoDiv.style.zIndex = "1001";
+ infoDiv.style.border = "1px outset #000";
+ infoDiv.style.background = "#C6DEFF";
+ infoDiv.style.height = "150px";
+ infoDiv.style.width = "300px";
+ infoDiv.align = "center";*/
+
+ mainInfoDiv = document.createElement("div");
+ mainInfoDiv.style.display = "none";
+ mainInfoDiv.style.position = "absolute";
+ mainInfoDiv.style.overflow = "auto";
+ mainInfoDiv.style.top = "0px";
+ mainInfoDiv.style.left = "0px";
+ mainInfoDiv.style.zIndex = "1001";
+ mainInfoDiv.style.border = "1px outset #000";
+ mainInfoDiv.style.background = "#C6DEFF";
+ mainInfoDiv.style.height = "150px";
+ mainInfoDiv.style.width = "300px";
+ mainInfoDiv.align = "center";
+
+ //mainInfoDiv = infoDiv.appendChild(document.createElement("div"));
+ mainInfoDiv.style.overflow = "auto";
+ mainInfoDiv.style.height = "150px";
+ mainInfoDiv.style.width = "300px";
+ //mainInfoDiv.align = "center";
+
+ /*var closeInfoDiv = infoDiv.appendChild(document.createElement("div"));
+ closeInfoDiv.appendChild(document.createTextNode("Close"));
+
+ closeInfoDiv.style.background = "#FFFFF0";
+ closeInfoDiv.style.color = "black";
+ closeInfoDiv.style.fontFamily = "Verdana";
+ closeInfoDiv.style.fontSize = "12px";
+ closeInfoDiv.style.fontWeight= "bold";
+ closeInfoDiv.style.border = "2px solid black";
+ closeInfoDiv.style.padding = "0px";
+ closeInfoDiv.style.marginBottom = "0px";
+ closeInfoDiv.style.textAlign = "center";
+ closeInfoDiv.style.width = "80px";
+ closeInfoDiv.style.height = "15px";
+ closeInfoDiv.style.cursor = "pointer";
+
+ GEvent.addDomListener(closeInfoDiv, "click", function() {
+ infoDiv.style.display = "none";
+ }); */
+
+ // longitude latitude div
+ var locationInfoWidth = 200;
+ var locationInfoHeight = 15;
+ locationInfoDiv = document.createElement("div");
+ locationInfoDiv.style.display = "inline";
+ locationInfoDiv.style.position = "absolute";
+ locationInfoDiv.style.zIndex = "1";
+ locationInfoDiv.style.height = locationInfoHeight + "px";
+ locationInfoDiv.style.width = locationInfoWidth + "px";
+ locationInfoDiv.align = "center";
+ locationInfoDiv.style.color = "#4CC417";
+ locationInfoDiv.style.fontWeight = "bold";
+ locationInfoDiv.appendChild(document.createTextNode("Longitude Latitude"));
+
+ var mapWidth = map.getSize().width;
+ var mapHeight = map.getSize().height;
+
+ locationInfoDiv.style.top = (mapHeight - locationInfoHeight - 5) + "px";
+ locationInfoDiv.style.left = (mapWidth / 2 - locationInfoWidth / 2) + "px";
+
+ // loading image animation
+ loadingAnimationDiv = document.createElement("div");
+ loadingAnimationDiv.style.position = "absolute";
+ loadingAnimationDiv.style.zIndex = "100000";
+ loadingAnimationDiv.style.display = "none";
+ loadingAnimationDiv.style.width = "50px";
+ loadingAnimationDiv.style.height = "50px";
+ loadingAnimationDiv.style.top = (mapHeight / 2 - 50 / 2) + "px";
+ loadingAnimationDiv.style.left = (mapWidth / 2 - 50 / 2) + "px";
+ var imgDiv = loadingAnimationDiv.appendChild(document.createElement("img"));
+ imgDiv.src = document.getElementById("imgFolder").value + "loading.gif";
+
+
+ //map.getContainer().appendChild(infoDiv);
+ map.getContainer().appendChild(mainInfoDiv);
+ map.getContainer().appendChild(locationInfoDiv);
+ map.getContainer().appendChild(loadingAnimationDiv);
+ updateImage(0);
+ }
+}
+
+function mapRightClicked(point, src) {
+ var latlng = map.fromContainerPixelToLatLng(new GPoint(point.x , point.y));
+ alert(latlng.lng() + ", " + latlng.lat());
+}
+/*
+function searchObject(searchInput, searchType, exactMatch, clickX, clickY) {
+ loadingAnimationDiv.style.display = "inline";
+ var baseURL = document.getElementById("baseURL").value;
+ //var url = baseURL + "/gmap_controller.htm?action=searchObject";
+ //var url = baseURL + "report.gmap.search_object";
+ var url = baseURL + "/gmapservlet?action=searchObject&nextpage=report.gmap.search_object";
+ url += "&search_input=" + searchInput;
+ url += "&search_type=" + searchType;
+ url += "&exact_match=" + exactMatch;
+ url += "&object_type=CELLSITE";
+
+ if (clickX == null || clickY == null) {
+ var mapWidth = map.getSize().width;
+ var mapHeight = map.getSize().height;
+ clickX = mapWidth / 2;
+ clickY = mapHeight / 2;
+ }
+
+ url += "&client_x=" + clickX;
+ url += "&client_y=" + clickY;
+
+ new Ajax.Request(url, {
+ method: 'get',
+ onSuccess: function(transport) {
+ loadingAnimationDiv.style.display = "none";
+ var jsonData = transport.responseText.evalJSON();
+ var list = jsonData.list;
+
+ if (list == null) {
+ alert("Not found");
+ }
+ else {
+ if (list.length == 1) {
+ var longitude = list[0].longitude;
+ var latitude = list[0].latitude;
+ map.setCenter(new GLatLng(latitude, longitude));
+ updateImage(0);
+ }
+ else {
+ for (var i = popupTable.childNodes.length - 1; i >= 0; i--) {
+ popupTable.removeChild(popupTable.lastChild);
+ }
+
+ for (var i = 0; i < list.length; i++) {
+ var tr = popupTable.appendChild(document.createElement("tr"));
+ var td = tr.appendChild(document.createElement("td"));
+ td.appendChild(document.createTextNode(list[i].type + "(" + list[i].numberOfT1 +
+ "): " + list[i].id));
+ td.style.border = "solid";
+ td.style.borderWidth = "thin";
+ td.style.borderRight = "none";
+ td.style.borderLeft = "none";
+
+ if (i == 0) {
+ td.style.borderTop = "none";
+ }
+
+ if (i == list.length - 1) {
+ td.style.borderBottom = "none";
+ }
+
+ td.style.color = "#0000FF";
+ td.style.background = "#FFFFF0";
+ td.style.fontSize = "12px";
+ td.font = "Arial,Helvetica,sans-serif";
+ td.id = list[i].latitude + ">>" + list[i].longitude;
+
+ td.onmouseover = function(e) {
+ this.style.background = "#0000FF";
+ this.style.color = "#FFFFF0";
+ }
+
+ td.onmouseout = function(e) {
+ this.style.background = "#FFFFF0";
+ this.style.color = "#0000FF";
+ }
+
+ td.onclick = function(e) {
+ //var popupDiv = document.getElementById("popupmenudiv");
+ popupDiv.style.display = "none";
+ var latitudeLongitude = this.id.split(">>");
+ var latlng = new GLatLng(latitudeLongitude[0], latitudeLongitude[1]);
+ map.setCenter(latlng);
+ updateImage(0);
+ }
+ }
+
+ //var popupDiv = document.getElementById("popupmenudiv");
+ popupDiv.style.display = "";
+
+ var textWidth = popupDiv.offsetWidth;
+ var textHeight = popupDiv.offsetHeight;
+
+ if (textHeight >= 200) {
+ popupDiv.style.overflow = "auto";
+ popupDiv.style.height = "200px";
+ textHeight = 200;
+ }
+
+ if (textWidth >= 250) {
+ popupDiv.style.width = "250px";
+ //textWidth = 250;
+ }
+
+ var clientX = jsonData.clientX;
+ var clientY = jsonData.clientY;
+
+ if ((clientX * 1 + textWidth + 20) >= screen.availWidth) {
+ clientX = clientX - textWidth - 20;
+ }
+
+ if ((clientY * 1 + textHeight) >= document.getElementById("map").offsetHeight) {
+ clientY = document.getElementById("map").offsetHeight - textHeight;
+
+ }
+
+ popupDiv.style.top = clientY + "px";
+ popupDiv.style.left = clientX + "px";
+ }
+ }
+ }
+ });
+}
+*/
+function getInfo(info, x, y) {
+ var baseURL = document.getElementById("baseURL").value;
+ //var url = baseURL + "/gmap_controller.htm?action=getInfo";
+ //var url = baseURL + "report.gmap.get_info";
+ var url = baseURL + "/gmapservlet?action=getInfo&nextpage=report.gmap.get_info";
+ url += "&info=" + info;
+ url += "&client_x=" + x;
+ url += "&client_y=" + y;
+
+ new Ajax.Request(url, {
+ method: 'get',
+ onSuccess: function(transport) {
+ var jsonData = transport.responseText.evalJSON();
+ var clientX = jsonData.clientX;
+ var clientY = jsonData.clientY;
+ var attributes = jsonData.attributes;
+
+ for (var i = mainInfoDiv.childNodes.length - 1; i >= 0; i--) {
+ mainInfoDiv.removeChild(mainInfoDiv.lastChild);
+ }
+
+ mainInfoDiv.align="left";
+ var menuUL = mainInfoDiv.appendChild(document.createElement("ul"));
+ var menuItem = document.createElement("li");
+ menuItem.appendChild(document.createTextNode("Row : " + jsonData.id));
+ menuUL.appendChild(menuItem);
+
+ menuItem = document.createElement("li");
+ menuItem.appendChild(document.createTextNode("Longitude: " + jsonData.longitude));
+ menuUL.appendChild(menuItem);
+
+ menuItem = document.createElement("li");
+ menuItem.appendChild(document.createTextNode("Latitude: " + jsonData.latitude));
+ menuUL.appendChild(menuItem);
+
+ var table = mainInfoDiv.appendChild(document.createElement("table"));
+ table.width="100%";
+ table.align="left";
+ var tbody = table.appendChild(document.createElement("tbody"));
+ //tbody.style.borderCollapse = "collapse";
+ //var tr = tbody.appendChild(document.createElement("tr"));
+ var td;
+ for (var i = 0; i < attributes.length ; i++) {
+ tr = tbody.appendChild(document.createElement("tr"));
+ td = tr.appendChild(document.createElement("td"));
+ td.align="left";
+ td.width="25%"
+ td.style.padding = "2px";
+ td.appendChild(document.createTextNode(attributes[i].key));
+ td = tr.appendChild(document.createElement("td"));
+ td.style.padding = "2px";
+ td.appendChild(document.createTextNode(attributes[i].value));
+ }
+
+ var textWidth = 300;
+ var textHeight = 150 + 15;
+
+ if ((clientX * 1 + textWidth + 20) >= screen.availWidth) {
+ clientX = clientX - textWidth - 20;
+ }
+
+ if ((clientY * 1 + textHeight) >= document.getElementById("map").offsetHeight) {
+ clientY = document.getElementById("map").offsetHeight - textHeight;
+ }
+
+ mainInfoDiv.style.top = clientY + "px";
+ mainInfoDiv.style.left = clientX + "px";
+ mainInfoDiv.style.display = "inline";
+ }
+ });
+}
+
+function mapClicked(overlay, latlng, overlaylatlng) {
+ var baseURL = document.getElementById("baseURL").value;
+ //var url = baseURL + "/gmap_controller.htm?action=singleLeftClick";
+ //var url = baseURL + "report.gmap.single_left_click";
+ var url = baseURL + "/gmapservlet?action=singleLeftClick&nextpage=report.gmap.single_left_click";
+ var mapSize = map.getSize();
+ var mapBounds = map.getBounds();
+ var pointSW = mapBounds.getSouthWest();
+ var pointNE = mapBounds.getNorthEast();
+ url += "&click_longitude=" + latlng.lng();
+ url += "&click_latitude=" + latlng.lat();
+ url += "&zoom_level=" + map.getZoom();
+ url += "&map_size=" + mapSize.width + "," + mapSize.height;
+ url += "&map_bounds=" + pointSW.lng() + "," + pointSW.lat() + "," + pointNE.lng() + "," + pointNE.lat();
+ var point = map.fromLatLngToContainerPixel(latlng);
+ var clickX = point.x;
+ var clickY = point.y;
+ url += "&client_x=" + clickX;
+ url += "&client_y=" + clickY;
+
+ //document.getElementById("popupmenudiv").style.display = "none";
+ popupDiv.style.display="none";
+ mainInfoDiv.style.display="none";
+ new Ajax.Request(url, {
+ method: 'get',
+ onSuccess: function(transport) {
+ var jsonData = transport.responseText.evalJSON();
+ var list = jsonData.list;
+ var selectedImageURL = jsonData.selectedImageURL;
+ var legendImageURL = jsonData.legendImageURL;
+ //alert(legendImageURL);
+ if (legendImageURL != null) {
+ repaintLegend(legendImageURL);
+ }
+
+ if (list != null) {
+ for (var i = popupTable.childNodes.length - 1; i >= 0; i--) {
+ popupTable.removeChild(popupTable.lastChild);
+ }
+
+ for (var i = 0; i < list.length; i++) {
+ var tr = popupTable.appendChild(document.createElement("tr"));
+ var td = tr.appendChild(document.createElement("td"));
+ td.appendChild(document.createTextNode("Row : " + list[i].id));
+ td.style.border = "solid";
+ td.style.borderWidth = "thin";
+ td.style.borderRight = "none";
+ td.style.borderLeft = "none";
+
+ if (i == 0) {
+ td.style.borderTop = "none";
+ }
+
+ if (i == list.length - 1) {
+ td.style.borderBottom = "none";
+ }
+
+ td.style.color = "#0000FF";
+ td.style.background = "#FFFFF0";
+ td.style.fontSize = "12px";
+ td.font = "Arial,Helvetica,sans-serif";
+ td.id = jsonData.type + ">>" + list[i].id + ">>" + list[i].type;
+
+ td.onmouseover = function(e) {
+ this.style.background = "#0000FF";
+ this.style.color = "#FFFFF0";
+ }
+
+ td.onmouseout = function(e) {
+ this.style.background = "#FFFFF0";
+ this.style.color = "#0000FF";
+ }
+
+ td.onclick = function(e) {
+ //var popupDiv = document.getElementById("popupmenudiv");
+ getInfo(this.id, clickX, clickY);
+
+ popupDiv.style.display = "none";
+ }
+ }
+
+ //var popupDiv = document.getElementById("popupmenudiv");
+ popupDiv.style.display = "";
+
+ var textWidth = popupDiv.offsetWidth;
+ var textHeight = popupDiv.offsetHeight;
+
+ if (textHeight >= 200) {
+ popupDiv.style.overflow = "auto";
+ popupDiv.style.height = "200px";
+ textHeight = 200;
+ }
+
+ if (textWidth >= 250) {
+ popupDiv.style.width = "250px";
+ //textWidth = 250;
+ }
+
+ var clientX = jsonData.clientX;
+ var clientY = jsonData.clientY;
+
+ if ((clientX * 1 + textWidth + 20) >= screen.availWidth) {
+ clientX = clientX - textWidth - 20;
+ }
+
+ if ((clientY * 1 + textHeight) >= document.getElementById("map").offsetHeight) {
+ clientY = document.getElementById("map").offsetHeight - textHeight;
+
+ }
+
+ popupDiv.style.top = clientY + "px";
+ popupDiv.style.left = clientX + "px";
+ }
+ else if (selectedImageURL != null) {
+ repaintSelected(selectedImageURL);
+ }
+ }
+ });
+}
+
+//new changes
+
+function mapMoveEnd() {
+ if (networkOverlay != null) {
+ map.removeOverlay(networkOverlay);
+ networkOverlay = null;
+ }
+
+
+ updateImage(0);
+}
+
+function mapDragEnd() {
+}
+
+function mapZoomChanged(oldZoomLevel, newZoomLevel) {
+}
+/*
+function updateSelectedImage() {
+ var baseURL = document.getElementById("baseURL").value;
+ var url = baseURL + "/gmap_controller.htm?action=nova.gmap.fetch.selected.image";
+ var mapSize = map.getSize();
+ var mapBounds = map.getBounds();
+ var pointSW = mapBounds.getSouthWest();
+ var pointNE = mapBounds.getNorthEast();
+ url += "&zoomLevel=" + map.getZoom();
+ url += "&mapSize=" + mapSize.width + "," + mapSize.height;
+ url += "&mapBounds=" + pointSW.lng() + "," + pointSW.lat() + "," + pointNE.lng() + "," + pointNE.lat();
+
+ new Ajax.Request(url, {
+ method: 'get',
+ asynchronous: false,
+ onSuccess: function(transport) {
+ var url = transport.responseXML.getElementsByTagName("image-url")[0].childNodes[0].nodeValue;
+
+ if (url != null) {
+ repaintSelected(url);
+ }
+ }
+ });
+}
+*/
+
+function updateImage(incDecValue) {
+ //alert();
+ loadingAnimationDiv.style.display = "inline";
+ var baseURL = document.getElementById("baseURL").value;
+ //var url = baseURL + "/gmap_controller.htm?action=getImage";
+ //var url = baseURL + "report.gmap.get_image";
+ var url = baseURL + "/gmapservlet?action=getImage&nextpage=report.gmap.get_image";
+ var mapSize = map.getSize();
+ var mapBounds = map.getBounds();
+ var pointSW = mapBounds.getSouthWest();
+ var pointNE = mapBounds.getNorthEast();
+ url += "&zoom_level=" + map.getZoom();
+ url += "&map_size=" + mapSize.width + "," + mapSize.height;
+ url += "&map_bounds=" + pointSW.lng() + "," + pointSW.lat() + "," + pointNE.lng() + "," + pointNE.lat();
+ url += "&increment_decrement_value=" + incDecValue;
+ url += "&selected_layer_list=" + document.getElementById("selectedLayerList").value;
+ url += "&color_list=" + document.getElementById("colorList").value;
+ var randomNumber = Math.floor(Math.random() * 5000000)
+ url += "&dummy=" + randomNumber;
+
+ //disableUserInput();
+ new Ajax.Request(url, {
+ method: 'get',
+ onSuccess: function(transport) {
+
+ loadingAnimationDiv.style.display = "none";
+ var jsonData = transport.responseText.evalJSON();
+ var imageURL = jsonData.imageURL;
+ var legendImageURL = jsonData.legendImageURL;
+ var selectedImageURL = jsonData.selectedImageURL;
+ var currentMonth = jsonData.currentMonth;
+ var colorList = jsonData.colorList;
+ var selectedLayerList = jsonData.selectedLayerList;
+
+ if (legendImageURL != null) {
+ repaintLegend(legendImageURL);
+ }
+ if (imageURL != null) {
+ repaint(imageURL);
+ }
+
+ if (selectedImageURL != null) {
+ repaintSelected(selectedImageURL);
+ }
+
+ if (currentMonth != null) {
+ document.getElementById("currentMonthDiv").innerHTML = currentMonth;
+ }
+
+ if (colorList != null) {
+ document.getElementById("colorList").value = colorList;
+ document.getElementById("selectedLayerList").value = selectedLayerList;
+ NovaButton.prototype.initializeLayerDiv(NovaButton.globals.layerOptionContainer);
+ }
+
+
+ }
+ });
+}
+
+ function repaintLegend(url) {
+ var mapLegend = document.getElementById("mapLegend");
+ var legendImg = document.getElementById("legendImg");
+
+ mapLegend.removeChild(legendImg);
+ var newpic=document.createElement('img');
+ newpic.src=url;
+ newpic.id="legendImg";
+ //alert(url);
+ mapLegend.appendChild(newpic);
+
+ }
+
+
+function repaint(url) {
+ if (networkOverlay != null) {
+ map.removeOverlay(networkOverlay);
+ }
+
+ networkOverlay = new ProjectedOverlay(url, map.getBounds()) ;
+ map.addOverlay(networkOverlay);
+}
+
+function repaintSelected(url) {
+ var mapBounds = map.getBounds();
+ var pointSW = mapBounds.getSouthWest();
+ var pointNE = mapBounds.getNorthEast();
+
+ if (selectedNetworkOverlay != null) {
+ map.removeOverlay(selectedNetworkOverlay);
+ }
+
+ selectedNetworkOverlay = new GGroundOverlay(url, new GLatLngBounds(pointSW, pointNE)) ;
+ map.addOverlay(selectedNetworkOverlay);
+
+ if (flashTimeout != null) {
+ clearTimeout(flashTimeout);
+ }
+
+ flashImage();
+}
+
+function flashImage() {
+ if (selectedNetworkOverlay.isHidden()) {
+ selectedNetworkOverlay.show();
+ }
+ else {
+ selectedNetworkOverlay.hide();
+ }
+
+ flashTimeout = setTimeout(flashImage, 500);
+}
+
+function disableUserInput() {
+ map.disableDragging();
+ map.disableDoubleClickZoom();
+ map.disableScrollWheelZoom();
+ map.disableContinuousZoom();
+}
+
+function enableUserInput() {
+ map.enableDragging();
+ map.enableDoubleClickZoom();
+ map.enableScrollWheelZoom();
+ map.enableContinuousZoom();
+}
+
+String.prototype.trim = function() {
+ return this.replace(/^\s+|\s+$/g, "");
+} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/jquery.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/jquery.js
new file mode 100644
index 00000000..462cde56
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/jquery.js
@@ -0,0 +1,4376 @@
+/*!
+ * jQuery JavaScript Library v1.3.2
+ * http://jquery.com/
+ *
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
+ *
+ * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
+ * Revision: 6246
+ */
+(function(){
+
+var
+ // Will speed up references to window, and allows munging its name.
+ window = this,
+ // Will speed up references to undefined, and allows munging its name.
+ undefined,
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ jQuery = window.jQuery = window.$ = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context );
+ },
+
+ // A simple way to check for HTML strings or ID strings
+ // (both of which we optimize for)
+ quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
+ // Is it a simple selector
+ isSimple = /^.[^:#\[\.,]*$/;
+
+jQuery.fn = jQuery.prototype = {
+ init: function( selector, context ) {
+ // Make sure that a selection was provided
+ selector = selector || document;
+
+ // Handle $(DOMElement)
+ if ( selector.nodeType ) {
+ this[0] = selector;
+ this.length = 1;
+ this.context = selector;
+ return this;
+ }
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ // Are we dealing with HTML string or an ID?
+ var match = quickExpr.exec( selector );
+
+ // Verify a match, and that no context was specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] )
+ selector = jQuery.clean( [ match[1] ], context );
+
+ // HANDLE: $("#id")
+ else {
+ var elem = document.getElementById( match[3] );
+
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem && elem.id != match[3] )
+ return jQuery().find( selector );
+
+ // Otherwise, we inject the element directly into the jQuery object
+ var ret = jQuery( elem || [] );
+ ret.context = document;
+ ret.selector = selector;
+ return ret;
+ }
+
+ // HANDLE: $(expr, [context])
+ // (which is just equivalent to: $(content).find(expr)
+ } else
+ return jQuery( context ).find( selector );
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) )
+ return jQuery( document ).ready( selector );
+
+ // Make sure that old selector state is passed along
+ if ( selector.selector && selector.context ) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return this.setArray(jQuery.isArray( selector ) ?
+ selector :
+ jQuery.makeArray(selector));
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The current version of jQuery being used
+ jquery: "1.3.2",
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num === undefined ?
+
+ // Return a 'clean' array
+ Array.prototype.slice.call( this ) :
+
+ // Return just the object
+ this[ num ];
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems, name, selector ) {
+ // Build a new jQuery matched element set
+ var ret = jQuery( elems );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+
+ ret.context = this.context;
+
+ if ( name === "find" )
+ ret.selector = this.selector + (this.selector ? " " : "") + selector;
+ else if ( name )
+ ret.selector = this.selector + "." + name + "(" + selector + ")";
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Force the current matched set of elements to become
+ // the specified array of elements (destroying the stack in the process)
+ // You should use pushStack() in order to do this, but maintain the stack
+ setArray: function( elems ) {
+ // Resetting the length to 0, then using the native Array push
+ // is a super-fast way to populate an object with array-like properties
+ this.length = 0;
+ Array.prototype.push.apply( this, elems );
+
+ return this;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem && elem.jquery ? elem[0] : elem
+ , this );
+ },
+
+ attr: function( name, value, type ) {
+ var options = name;
+
+ // Look for the case where we're accessing a style value
+ if ( typeof name === "string" )
+ if ( value === undefined )
+ return this[0] && jQuery[ type || "attr" ]( this[0], name );
+
+ else {
+ options = {};
+ options[ name ] = value;
+ }
+
+ // Check to see if we're setting style values
+ return this.each(function(i){
+ // Set all the styles
+ for ( name in options )
+ jQuery.attr(
+ type ?
+ this.style :
+ this,
+ name, jQuery.prop( this, options[ name ], type, i, name )
+ );
+ });
+ },
+
+ css: function( key, value ) {
+ // ignore negative width and height values
+ if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
+ value = undefined;
+ return this.attr( key, value, "curCSS" );
+ },
+
+ text: function( text ) {
+ if ( typeof text !== "object" && text != null )
+ return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
+
+ var ret = "";
+
+ jQuery.each( text || this, function(){
+ jQuery.each( this.childNodes, function(){
+ if ( this.nodeType != 8 )
+ ret += this.nodeType != 1 ?
+ this.nodeValue :
+ jQuery.fn.text( [ this ] );
+ });
+ });
+
+ return ret;
+ },
+
+ wrapAll: function( html ) {
+ if ( this[0] ) {
+ // The elements to wrap the target around
+ var wrap = jQuery( html, this[0].ownerDocument ).clone();
+
+ if ( this[0].parentNode )
+ wrap.insertBefore( this[0] );
+
+ wrap.map(function(){
+ var elem = this;
+
+ while ( elem.firstChild )
+ elem = elem.firstChild;
+
+ return elem;
+ }).append(this);
+ }
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ return this.each(function(){
+ jQuery( this ).contents().wrapAll( html );
+ });
+ },
+
+ wrap: function( html ) {
+ return this.each(function(){
+ jQuery( this ).wrapAll( html );
+ });
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, function(elem){
+ if (this.nodeType == 1)
+ this.appendChild( elem );
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, function(elem){
+ if (this.nodeType == 1)
+ this.insertBefore( elem, this.firstChild );
+ });
+ },
+
+ before: function() {
+ return this.domManip(arguments, false, function(elem){
+ this.parentNode.insertBefore( elem, this );
+ });
+ },
+
+ after: function() {
+ return this.domManip(arguments, false, function(elem){
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ });
+ },
+
+ end: function() {
+ return this.prevObject || jQuery( [] );
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: [].push,
+ sort: [].sort,
+ splice: [].splice,
+
+ find: function( selector ) {
+ if ( this.length === 1 ) {
+ var ret = this.pushStack( [], "find", selector );
+ ret.length = 0;
+ jQuery.find( selector, this[0], ret );
+ return ret;
+ } else {
+ return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){
+ return jQuery.find( selector, elem );
+ })), "find", selector );
+ }
+ },
+
+ clone: function( events ) {
+ // Do the clone
+ var ret = this.map(function(){
+ if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
+ // IE copies events bound via attachEvent when
+ // using cloneNode. Calling detachEvent on the
+ // clone will also remove the events from the orignal
+ // In order to get around this, we use innerHTML.
+ // Unfortunately, this means some modifications to
+ // attributes in IE that are actually only stored
+ // as properties will not be copied (such as the
+ // the name attribute on an input).
+ var html = this.outerHTML;
+ if ( !html ) {
+ var div = this.ownerDocument.createElement("div");
+ div.appendChild( this.cloneNode(true) );
+ html = div.innerHTML;
+ }
+
+ return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
+ } else
+ return this.cloneNode(true);
+ });
+
+ // Copy the events from the original to the clone
+ if ( events === true ) {
+ var orig = this.find("*").andSelf(), i = 0;
+
+ ret.find("*").andSelf().each(function(){
+ if ( this.nodeName !== orig[i].nodeName )
+ return;
+
+ var events = jQuery.data( orig[i], "events" );
+
+ for ( var type in events ) {
+ for ( var handler in events[ type ] ) {
+ jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
+ }
+ }
+
+ i++;
+ });
+ }
+
+ // Return the cloned set
+ return ret;
+ },
+
+ filter: function( selector ) {
+ return this.pushStack(
+ jQuery.isFunction( selector ) &&
+ jQuery.grep(this, function(elem, i){
+ return selector.call( elem, i );
+ }) ||
+
+ jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
+ return elem.nodeType === 1;
+ }) ), "filter", selector );
+ },
+
+ closest: function( selector ) {
+ var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
+ closer = 0;
+
+ return this.map(function(){
+ var cur = this;
+ while ( cur && cur.ownerDocument ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
+ jQuery.data(cur, "closest", closer);
+ return cur;
+ }
+ cur = cur.parentNode;
+ closer++;
+ }
+ });
+ },
+
+ not: function( selector ) {
+ if ( typeof selector === "string" )
+ // test special case where just one selector is passed in
+ if ( isSimple.test( selector ) )
+ return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
+ else
+ selector = jQuery.multiFilter( selector, this );
+
+ var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
+ return this.filter(function() {
+ return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
+ });
+ },
+
+ add: function( selector ) {
+ return this.pushStack( jQuery.unique( jQuery.merge(
+ this.get(),
+ typeof selector === "string" ?
+ jQuery( selector ) :
+ jQuery.makeArray( selector )
+ )));
+ },
+
+ is: function( selector ) {
+ return !!selector && jQuery.multiFilter( selector, this ).length > 0;
+ },
+
+ hasClass: function( selector ) {
+ return !!selector && this.is( "." + selector );
+ },
+
+ val: function( value ) {
+ if ( value === undefined ) {
+ var elem = this[0];
+
+ if ( elem ) {
+ if( jQuery.nodeName( elem, 'option' ) )
+ return (elem.attributes.value || {}).specified ? elem.value : elem.text;
+
+ // We need to handle select boxes special
+ if ( jQuery.nodeName( elem, "select" ) ) {
+ var index = elem.selectedIndex,
+ values = [],
+ options = elem.options,
+ one = elem.type == "select-one";
+
+ // Nothing was selected
+ if ( index < 0 )
+ return null;
+
+ // Loop through all the selected options
+ for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
+ var option = options[ i ];
+
+ if ( option.selected ) {
+ // Get the specifc value for the option
+ value = jQuery(option).val();
+
+ // We don't need an array for one selects
+ if ( one )
+ return value;
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ return values;
+ }
+
+ // Everything else, we just grab the value
+ return (elem.value || "").replace(/\r/g, "");
+
+ }
+
+ return undefined;
+ }
+
+ if ( typeof value === "number" )
+ value += '';
+
+ return this.each(function(){
+ if ( this.nodeType != 1 )
+ return;
+
+ if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
+ this.checked = (jQuery.inArray(this.value, value) >= 0 ||
+ jQuery.inArray(this.name, value) >= 0);
+
+ else if ( jQuery.nodeName( this, "select" ) ) {
+ var values = jQuery.makeArray(value);
+
+ jQuery( "option", this ).each(function(){
+ this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
+ jQuery.inArray( this.text, values ) >= 0);
+ });
+
+ if ( !values.length )
+ this.selectedIndex = -1;
+
+ } else
+ this.value = value;
+ });
+ },
+
+ html: function( value ) {
+ return value === undefined ?
+ (this[0] ?
+ this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
+ null) :
+ this.empty().append( value );
+ },
+
+ replaceWith: function( value ) {
+ return this.after( value ).remove();
+ },
+
+ eq: function( i ) {
+ return this.slice( i, +i + 1 );
+ },
+
+ slice: function() {
+ return this.pushStack( Array.prototype.slice.apply( this, arguments ),
+ "slice", Array.prototype.slice.call(arguments).join(",") );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function(elem, i){
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ andSelf: function() {
+ return this.add( this.prevObject );
+ },
+
+ domManip: function( args, table, callback ) {
+ if ( this[0] ) {
+ var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
+ scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
+ first = fragment.firstChild;
+
+ if ( first )
+ for ( var i = 0, l = this.length; i < l; i++ )
+ callback.call( root(this[i], first), this.length > 1 || i > 0 ?
+ fragment.cloneNode(true) : fragment );
+
+ if ( scripts )
+ jQuery.each( scripts, evalScript );
+ }
+
+ return this;
+
+ function root( elem, cur ) {
+ return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
+ (elem.getElementsByTagName("tbody")[0] ||
+ elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
+ elem;
+ }
+ }
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+function evalScript( i, elem ) {
+ if ( elem.src )
+ jQuery.ajax({
+ url: elem.src,
+ async: false,
+ dataType: "script"
+ });
+
+ else
+ jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
+
+ if ( elem.parentNode )
+ elem.parentNode.removeChild( elem );
+}
+
+function now(){
+ return +new Date;
+}
+
+jQuery.extend = jQuery.fn.extend = function() {
+ // copy reference to target object
+ var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) )
+ target = {};
+
+ // extend jQuery itself if only one argument is passed
+ if ( length == i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ )
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null )
+ // Extend the base object
+ for ( var name in options ) {
+ var src = target[ name ], copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy )
+ continue;
+
+ // Recurse if we're merging object values
+ if ( deep && copy && typeof copy === "object" && !copy.nodeType )
+ target[ name ] = jQuery.extend( deep,
+ // Never move original objects, clone them
+ src || ( copy.length != null ? [ ] : { } )
+ , copy );
+
+ // Don't bring in undefined values
+ else if ( copy !== undefined )
+ target[ name ] = copy;
+
+ }
+
+ // Return the modified object
+ return target;
+};
+
+// exclude the following css properties to add px
+var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
+ // cache defaultView
+ defaultView = document.defaultView || {},
+ toString = Object.prototype.toString;
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ window.$ = _$;
+
+ if ( deep )
+ window.jQuery = _jQuery;
+
+ return jQuery;
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return toString.call(obj) === "[object Function]";
+ },
+
+ isArray: function( obj ) {
+ return toString.call(obj) === "[object Array]";
+ },
+
+ // check if an element is in a (or is an) XML document
+ isXMLDoc: function( elem ) {
+ return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
+ !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
+ },
+
+ // Evalulates a script in a global context
+ globalEval: function( data ) {
+ if ( data && /\S/.test(data) ) {
+ // Inspired by code by Andrea Giammarchi
+ // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
+ var head = document.getElementsByTagName("head")[0] || document.documentElement,
+ script = document.createElement("script");
+
+ script.type = "text/javascript";
+ if ( jQuery.support.scriptEval )
+ script.appendChild( document.createTextNode( data ) );
+ else
+ script.text = data;
+
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
+ // This arises when a base node is used (#2709).
+ head.insertBefore( script, head.firstChild );
+ head.removeChild( script );
+ }
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
+ },
+
+ // args is for internal usage only
+ each: function( object, callback, args ) {
+ var name, i = 0, length = object.length;
+
+ if ( args ) {
+ if ( length === undefined ) {
+ for ( name in object )
+ if ( callback.apply( object[ name ], args ) === false )
+ break;
+ } else
+ for ( ; i < length; )
+ if ( callback.apply( object[ i++ ], args ) === false )
+ break;
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( length === undefined ) {
+ for ( name in object )
+ if ( callback.call( object[ name ], name, object[ name ] ) === false )
+ break;
+ } else
+ for ( var value = object[0];
+ i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
+ }
+
+ return object;
+ },
+
+ prop: function( elem, value, type, i, name ) {
+ // Handle executable functions
+ if ( jQuery.isFunction( value ) )
+ value = value.call( elem, i );
+
+ // Handle passing in a number to a CSS property
+ return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
+ value + "px" :
+ value;
+ },
+
+ className: {
+ // internal only, use addClass("class")
+ add: function( elem, classNames ) {
+ jQuery.each((classNames || "").split(/\s+/), function(i, className){
+ if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
+ elem.className += (elem.className ? " " : "") + className;
+ });
+ },
+
+ // internal only, use removeClass("class")
+ remove: function( elem, classNames ) {
+ if (elem.nodeType == 1)
+ elem.className = classNames !== undefined ?
+ jQuery.grep(elem.className.split(/\s+/), function(className){
+ return !jQuery.className.has( classNames, className );
+ }).join(" ") :
+ "";
+ },
+
+ // internal only, use hasClass("class")
+ has: function( elem, className ) {
+ return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
+ }
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback ) {
+ var old = {};
+ // Remember the old values, and insert the new ones
+ for ( var name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ callback.call( elem );
+
+ // Revert the old values
+ for ( var name in options )
+ elem.style[ name ] = old[ name ];
+ },
+
+ css: function( elem, name, force, extra ) {
+ if ( name == "width" || name == "height" ) {
+ var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
+
+ function getWH() {
+ val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
+
+ if ( extra === "border" )
+ return;
+
+ jQuery.each( which, function() {
+ if ( !extra )
+ val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
+ if ( extra === "margin" )
+ val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
+ else
+ val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
+ });
+ }
+
+ if ( elem.offsetWidth !== 0 )
+ getWH();
+ else
+ jQuery.swap( elem, props, getWH );
+
+ return Math.max(0, Math.round(val));
+ }
+
+ return jQuery.curCSS( elem, name, force );
+ },
+
+ curCSS: function( elem, name, force ) {
+ var ret, style = elem.style;
+
+ // We need to handle opacity special in IE
+ if ( name == "opacity" && !jQuery.support.opacity ) {
+ ret = jQuery.attr( style, "opacity" );
+
+ return ret == "" ?
+ "1" :
+ ret;
+ }
+
+ // Make sure we're using the right name for getting the float value
+ if ( name.match( /float/i ) )
+ name = styleFloat;
+
+ if ( !force && style && style[ name ] )
+ ret = style[ name ];
+
+ else if ( defaultView.getComputedStyle ) {
+
+ // Only "float" is needed here
+ if ( name.match( /float/i ) )
+ name = "float";
+
+ name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
+
+ var computedStyle = defaultView.getComputedStyle( elem, null );
+
+ if ( computedStyle )
+ ret = computedStyle.getPropertyValue( name );
+
+ // We should always get a number back from opacity
+ if ( name == "opacity" && ret == "" )
+ ret = "1";
+
+ } else if ( elem.currentStyle ) {
+ var camelCase = name.replace(/\-(\w)/g, function(all, letter){
+ return letter.toUpperCase();
+ });
+
+ ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
+
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
+ // Remember the original values
+ var left = style.left, rsLeft = elem.runtimeStyle.left;
+
+ // Put in the new values to get a computed value out
+ elem.runtimeStyle.left = elem.currentStyle.left;
+ style.left = ret || 0;
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ elem.runtimeStyle.left = rsLeft;
+ }
+ }
+
+ return ret;
+ },
+
+ clean: function( elems, context, fragment ) {
+ context = context || document;
+
+ // !context.createElement fails in IE with an error but returns typeof 'object'
+ if ( typeof context.createElement === "undefined" )
+ context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
+
+ // If a single string is passed in and it's a single tag
+ // just do a createElement and skip the rest
+ if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
+ var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
+ if ( match )
+ return [ context.createElement( match[1] ) ];
+ }
+
+ var ret = [], scripts = [], div = context.createElement("div");
+
+ jQuery.each(elems, function(i, elem){
+ if ( typeof elem === "number" )
+ elem += '';
+
+ if ( !elem )
+ return;
+
+ // Convert html string into DOM nodes
+ if ( typeof elem === "string" ) {
+ // Fix "XHTML"-style tags in all browsers
+ elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
+ return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
+ all :
+ front + "></" + tag + ">";
+ });
+
+ // Trim whitespace, otherwise indexOf won't work as expected
+ var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();
+
+ var wrap =
+ // option or optgroup
+ !tags.indexOf("<opt") &&
+ [ 1, "<select multiple='multiple'>", "</select>" ] ||
+
+ !tags.indexOf("<leg") &&
+ [ 1, "<fieldset>", "</fieldset>" ] ||
+
+ tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
+ [ 1, "<table>", "</table>" ] ||
+
+ !tags.indexOf("<tr") &&
+ [ 2, "<table><tbody>", "</tbody></table>" ] ||
+
+ // <thead> matched above
+ (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
+ [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
+
+ !tags.indexOf("<col") &&
+ [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
+
+ // IE can't serialize <link> and <script> tags normally
+ !jQuery.support.htmlSerialize &&
+ [ 1, "div<div>", "</div>" ] ||
+
+ [ 0, "", "" ];
+
+ // Go to html and back, then peel off extra wrappers
+ div.innerHTML = wrap[1] + elem + wrap[2];
+
+ // Move to the right depth
+ while ( wrap[0]-- )
+ div = div.lastChild;
+
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( !jQuery.support.tbody ) {
+
+ // String was a <table>, *may* have spurious <tbody>
+ var hasBody = /<tbody/i.test(elem),
+ tbody = !tags.indexOf("<table") && !hasBody ?
+ div.firstChild && div.firstChild.childNodes :
+
+ // String was a bare <thead> or <tfoot>
+ wrap[1] == "<table>" && !hasBody ?
+ div.childNodes :
+ [];
+
+ for ( var j = tbody.length - 1; j >= 0 ; --j )
+ if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );
+
+ }
+
+ // IE completely kills leading whitespace when innerHTML is used
+ if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
+ div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
+
+ elem = jQuery.makeArray( div.childNodes );
+ }
+
+ if ( elem.nodeType )
+ ret.push( elem );
+ else
+ ret = jQuery.merge( ret, elem );
+
+ });
+
+ if ( fragment ) {
+ for ( var i = 0; ret[i]; i++ ) {
+ if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
+ scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
+ } else {
+ if ( ret[i].nodeType === 1 )
+ ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
+ fragment.appendChild( ret[i] );
+ }
+ }
+
+ return scripts;
+ }
+
+ return ret;
+ },
+
+ attr: function( elem, name, value ) {
+ // don't set attributes on text and comment nodes
+ if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
+ return undefined;
+
+ var notxml = !jQuery.isXMLDoc( elem ),
+ // Whether we are setting (or getting)
+ set = value !== undefined;
+
+ // Try to normalize/fix the name
+ name = notxml && jQuery.props[ name ] || name;
+
+ // Only do all the following if this is a node (faster for style)
+ // IE elem.getAttribute passes even for style
+ if ( elem.tagName ) {
+
+ // These attributes require special treatment
+ var special = /href|src|style/.test( name );
+
+ // Safari mis-reports the default selected property of a hidden option
+ // Accessing the parent's selectedIndex property fixes it
+ if ( name == "selected" && elem.parentNode )
+ elem.parentNode.selectedIndex;
+
+ // If applicable, access the attribute via the DOM 0 way
+ if ( name in elem && notxml && !special ) {
+ if ( set ){
+ // We can't allow the type property to be changed (since it causes problems in IE)
+ if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
+ throw "type property can't be changed";
+
+ elem[ name ] = value;
+ }
+
+ // browsers index elements by id/name on forms, give priority to attributes.
+ if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
+ return elem.getAttributeNode( name ).nodeValue;
+
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ if ( name == "tabIndex" ) {
+ var attributeNode = elem.getAttributeNode( "tabIndex" );
+ return attributeNode && attributeNode.specified
+ ? attributeNode.value
+ : elem.nodeName.match(/(button|input|object|select|textarea)/i)
+ ? 0
+ : elem.nodeName.match(/^(a|area)$/i) && elem.href
+ ? 0
+ : undefined;
+ }
+
+ return elem[ name ];
+ }
+
+ if ( !jQuery.support.style && notxml && name == "style" )
+ return jQuery.attr( elem.style, "cssText", value );
+
+ if ( set )
+ // convert the value to a string (all browsers do this but IE) see #1070
+ elem.setAttribute( name, "" + value );
+
+ var attr = !jQuery.support.hrefNormalized && notxml && special
+ // Some attributes require a special call on IE
+ ? elem.getAttribute( name, 2 )
+ : elem.getAttribute( name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return attr === null ? undefined : attr;
+ }
+
+ // elem is actually elem.style ... set the style
+
+ // IE uses filters for opacity
+ if ( !jQuery.support.opacity && name == "opacity" ) {
+ if ( set ) {
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ elem.zoom = 1;
+
+ // Set the alpha filter to set the opacity
+ elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
+ (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
+ }
+
+ return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
+ (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
+ "";
+ }
+
+ name = name.replace(/-([a-z])/ig, function(all, letter){
+ return letter.toUpperCase();
+ });
+
+ if ( set )
+ elem[ name ] = value;
+
+ return elem[ name ];
+ },
+
+ trim: function( text ) {
+ return (text || "").replace( /^\s+|\s+$/g, "" );
+ },
+
+ makeArray: function( array ) {
+ var ret = [];
+
+ if( array != null ){
+ var i = array.length;
+ // The window, strings (and functions) also have 'length'
+ if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
+ ret[0] = array;
+ else
+ while( i )
+ ret[--i] = array[i];
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, array ) {
+ for ( var i = 0, length = array.length; i < length; i++ )
+ // Use === because on IE, window == document
+ if ( array[ i ] === elem )
+ return i;
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ // We have to loop this way because IE & Opera overwrite the length
+ // expando of getElementsByTagName
+ var i = 0, elem, pos = first.length;
+ // Also, we need to make sure that the correct elements are being returned
+ // (IE returns comment nodes in a '*' query)
+ if ( !jQuery.support.getAll ) {
+ while ( (elem = second[ i++ ]) != null )
+ if ( elem.nodeType != 8 )
+ first[ pos++ ] = elem;
+
+ } else
+ while ( (elem = second[ i++ ]) != null )
+ first[ pos++ ] = elem;
+
+ return first;
+ },
+
+ unique: function( array ) {
+ var ret = [], done = {};
+
+ try {
+
+ for ( var i = 0, length = array.length; i < length; i++ ) {
+ var id = jQuery.data( array[ i ] );
+
+ if ( !done[ id ] ) {
+ done[ id ] = true;
+ ret.push( array[ i ] );
+ }
+ }
+
+ } catch( e ) {
+ ret = array;
+ }
+
+ return ret;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var ret = [];
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( var i = 0, length = elems.length; i < length; i++ )
+ if ( !inv != !callback( elems[ i ], i ) )
+ ret.push( elems[ i ] );
+
+ return ret;
+ },
+
+ map: function( elems, callback ) {
+ var ret = [];
+
+ // Go through the array, translating each of the items to their
+ // new value (or values).
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
+ var value = callback( elems[ i ], i );
+
+ if ( value != null )
+ ret[ ret.length ] = value;
+ }
+
+ return ret.concat.apply( [], ret );
+ }
+});
+
+// Use of jQuery.browser is deprecated.
+// It's included for backwards compatibility and plugins,
+// although they should work to migrate away.
+
+var userAgent = navigator.userAgent.toLowerCase();
+
+// Figure out what browser is being used
+jQuery.browser = {
+ version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
+ safari: /webkit/.test( userAgent ),
+ opera: /opera/.test( userAgent ),
+ msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
+ mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
+};
+
+jQuery.each({
+ parent: function(elem){return elem.parentNode;},
+ parents: function(elem){return jQuery.dir(elem,"parentNode");},
+ next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
+ prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
+ nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
+ prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
+ siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
+ children: function(elem){return jQuery.sibling(elem.firstChild);},
+ contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
+}, function(name, fn){
+ jQuery.fn[ name ] = function( selector ) {
+ var ret = jQuery.map( this, fn );
+
+ if ( selector && typeof selector == "string" )
+ ret = jQuery.multiFilter( selector, ret );
+
+ return this.pushStack( jQuery.unique( ret ), name, selector );
+ };
+});
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function(name, original){
+ jQuery.fn[ name ] = function( selector ) {
+ var ret = [], insert = jQuery( selector );
+
+ for ( var i = 0, l = insert.length; i < l; i++ ) {
+ var elems = (i > 0 ? this.clone(true) : this).get();
+ jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
+ ret = ret.concat( elems );
+ }
+
+ return this.pushStack( ret, name, selector );
+ };
+});
+
+jQuery.each({
+ removeAttr: function( name ) {
+ jQuery.attr( this, name, "" );
+ if (this.nodeType == 1)
+ this.removeAttribute( name );
+ },
+
+ addClass: function( classNames ) {
+ jQuery.className.add( this, classNames );
+ },
+
+ removeClass: function( classNames ) {
+ jQuery.className.remove( this, classNames );
+ },
+
+ toggleClass: function( classNames, state ) {
+ if( typeof state !== "boolean" )
+ state = !jQuery.className.has( this, classNames );
+ jQuery.className[ state ? "add" : "remove" ]( this, classNames );
+ },
+
+ remove: function( selector ) {
+ if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
+ // Prevent memory leaks
+ jQuery( "*", this ).add([this]).each(function(){
+ jQuery.event.remove(this);
+ jQuery.removeData(this);
+ });
+ if (this.parentNode)
+ this.parentNode.removeChild( this );
+ }
+ },
+
+ empty: function() {
+ // Remove element nodes and prevent memory leaks
+ jQuery(this).children().remove();
+
+ // Remove any remaining nodes
+ while ( this.firstChild )
+ this.removeChild( this.firstChild );
+ }
+}, function(name, fn){
+ jQuery.fn[ name ] = function(){
+ return this.each( fn, arguments );
+ };
+});
+
+// Helper function used by the dimensions and offset modules
+function num(elem, prop) {
+ return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
+}
+var expando = "jQuery" + now(), uuid = 0, windowData = {};
+
+jQuery.extend({
+ cache: {},
+
+ data: function( elem, name, data ) {
+ elem = elem == window ?
+ windowData :
+ elem;
+
+ var id = elem[ expando ];
+
+ // Compute a unique ID for the element
+ if ( !id )
+ id = elem[ expando ] = ++uuid;
+
+ // Only generate the data cache if we're
+ // trying to access or manipulate it
+ if ( name && !jQuery.cache[ id ] )
+ jQuery.cache[ id ] = {};
+
+ // Prevent overriding the named cache with undefined values
+ if ( data !== undefined )
+ jQuery.cache[ id ][ name ] = data;
+
+ // Return the named cache data, or the ID for the element
+ return name ?
+ jQuery.cache[ id ][ name ] :
+ id;
+ },
+
+ removeData: function( elem, name ) {
+ elem = elem == window ?
+ windowData :
+ elem;
+
+ var id = elem[ expando ];
+
+ // If we want to remove a specific section of the element's data
+ if ( name ) {
+ if ( jQuery.cache[ id ] ) {
+ // Remove the section of cache data
+ delete jQuery.cache[ id ][ name ];
+
+ // If we've removed all the data, remove the element's cache
+ name = "";
+
+ for ( name in jQuery.cache[ id ] )
+ break;
+
+ if ( !name )
+ jQuery.removeData( elem );
+ }
+
+ // Otherwise, we want to remove all of the element's data
+ } else {
+ // Clean up the element expando
+ try {
+ delete elem[ expando ];
+ } catch(e){
+ // IE has trouble directly removing the expando
+ // but it's ok with using removeAttribute
+ if ( elem.removeAttribute )
+ elem.removeAttribute( expando );
+ }
+
+ // Completely remove the data cache
+ delete jQuery.cache[ id ];
+ }
+ },
+ queue: function( elem, type, data ) {
+ if ( elem ){
+
+ type = (type || "fx") + "queue";
+
+ var q = jQuery.data( elem, type );
+
+ if ( !q || jQuery.isArray(data) )
+ q = jQuery.data( elem, type, jQuery.makeArray(data) );
+ else if( data )
+ q.push( data );
+
+ }
+ return q;
+ },
+
+ dequeue: function( elem, type ){
+ var queue = jQuery.queue( elem, type ),
+ fn = queue.shift();
+
+ if( !type || type === "fx" )
+ fn = queue[0];
+
+ if( fn !== undefined )
+ fn.call(elem);
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ){
+ var parts = key.split(".");
+ parts[1] = parts[1] ? "." + parts[1] : "";
+
+ if ( value === undefined ) {
+ var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+
+ if ( data === undefined && this.length )
+ data = jQuery.data( this[0], key );
+
+ return data === undefined && parts[1] ?
+ this.data( parts[0] ) :
+ data;
+ } else
+ return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
+ jQuery.data( this, key, value );
+ });
+ },
+
+ removeData: function( key ){
+ return this.each(function(){
+ jQuery.removeData( this, key );
+ });
+ },
+ queue: function(type, data){
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ }
+
+ if ( data === undefined )
+ return jQuery.queue( this[0], type );
+
+ return this.each(function(){
+ var queue = jQuery.queue( this, type, data );
+
+ if( type == "fx" && queue.length == 1 )
+ queue[0].call(this);
+ });
+ },
+ dequeue: function(type){
+ return this.each(function(){
+ jQuery.dequeue( this, type );
+ });
+ }
+});/*!
+ * Sizzle CSS Selector Engine - v0.9.3
+ * Copyright 2009, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){
+
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
+ done = 0,
+ toString = Object.prototype.toString;
+
+var Sizzle = function(selector, context, results, seed) {
+ results = results || [];
+ context = context || document;
+
+ if ( context.nodeType !== 1 && context.nodeType !== 9 )
+ return [];
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ var parts = [], m, set, checkSet, check, mode, extra, prune = true;
+
+ // Reset the position of the chunker regexp (start from head)
+ chunker.lastIndex = 0;
+
+ while ( (m = chunker.exec(selector)) !== null ) {
+ parts.push( m[1] );
+
+ if ( m[2] ) {
+ extra = RegExp.rightContext;
+ break;
+ }
+ }
+
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
+ set = posProcess( parts[0] + parts[1], context );
+ } else {
+ set = Expr.relative[ parts[0] ] ?
+ [ context ] :
+ Sizzle( parts.shift(), context );
+
+ while ( parts.length ) {
+ selector = parts.shift();
+
+ if ( Expr.relative[ selector ] )
+ selector += parts.shift();
+
+ set = posProcess( selector, set );
+ }
+ }
+ } else {
+ var ret = seed ?
+ { expr: parts.pop(), set: makeArray(seed) } :
+ Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
+ set = Sizzle.filter( ret.expr, ret.set );
+
+ if ( parts.length > 0 ) {
+ checkSet = makeArray(set);
+ } else {
+ prune = false;
+ }
+
+ while ( parts.length ) {
+ var cur = parts.pop(), pop = cur;
+
+ if ( !Expr.relative[ cur ] ) {
+ cur = "";
+ } else {
+ pop = parts.pop();
+ }
+
+ if ( pop == null ) {
+ pop = context;
+ }
+
+ Expr.relative[ cur ]( checkSet, pop, isXML(context) );
+ }
+ }
+
+ if ( !checkSet ) {
+ checkSet = set;
+ }
+
+ if ( !checkSet ) {
+ throw "Syntax error, unrecognized expression: " + (cur || selector);
+ }
+
+ if ( toString.call(checkSet) === "[object Array]" ) {
+ if ( !prune ) {
+ results.push.apply( results, checkSet );
+ } else if ( context.nodeType === 1 ) {
+ for ( var i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
+ results.push( set[i] );
+ }
+ }
+ } else {
+ for ( var i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+ results.push( set[i] );
+ }
+ }
+ }
+ } else {
+ makeArray( checkSet, results );
+ }
+
+ if ( extra ) {
+ Sizzle( extra, context, results, seed );
+
+ if ( sortOrder ) {
+ hasDuplicate = false;
+ results.sort(sortOrder);
+
+ if ( hasDuplicate ) {
+ for ( var i = 1; i < results.length; i++ ) {
+ if ( results[i] === results[i-1] ) {
+ results.splice(i--, 1);
+ }
+ }
+ }
+ }
+ }
+
+ return results;
+};
+
+Sizzle.matches = function(expr, set){
+ return Sizzle(expr, null, null, set);
+};
+
+Sizzle.find = function(expr, context, isXML){
+ var set, match;
+
+ if ( !expr ) {
+ return [];
+ }
+
+ for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
+ var type = Expr.order[i], match;
+
+ if ( (match = Expr.match[ type ].exec( expr )) ) {
+ var left = RegExp.leftContext;
+
+ if ( left.substr( left.length - 1 ) !== "\\" ) {
+ match[1] = (match[1] || "").replace(/\\/g, "");
+ set = Expr.find[ type ]( match, context, isXML );
+ if ( set != null ) {
+ expr = expr.replace( Expr.match[ type ], "" );
+ break;
+ }
+ }
+ }
+ }
+
+ if ( !set ) {
+ set = context.getElementsByTagName("*");
+ }
+
+ return {set: set, expr: expr};
+};
+
+Sizzle.filter = function(expr, set, inplace, not){
+ var old = expr, result = [], curLoop = set, match, anyFound,
+ isXMLFilter = set && set[0] && isXML(set[0]);
+
+ while ( expr && set.length ) {
+ for ( var type in Expr.filter ) {
+ if ( (match = Expr.match[ type ].exec( expr )) != null ) {
+ var filter = Expr.filter[ type ], found, item;
+ anyFound = false;
+
+ if ( curLoop == result ) {
+ result = [];
+ }
+
+ if ( Expr.preFilter[ type ] ) {
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
+
+ if ( !match ) {
+ anyFound = found = true;
+ } else if ( match === true ) {
+ continue;
+ }
+ }
+
+ if ( match ) {
+ for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
+ if ( item ) {
+ found = filter( item, match, i, curLoop );
+ var pass = not ^ !!found;
+
+ if ( inplace && found != null ) {
+ if ( pass ) {
+ anyFound = true;
+ } else {
+ curLoop[i] = false;
+ }
+ } else if ( pass ) {
+ result.push( item );
+ anyFound = true;
+ }
+ }
+ }
+ }
+
+ if ( found !== undefined ) {
+ if ( !inplace ) {
+ curLoop = result;
+ }
+
+ expr = expr.replace( Expr.match[ type ], "" );
+
+ if ( !anyFound ) {
+ return [];
+ }
+
+ break;
+ }
+ }
+ }
+
+ // Improper expression
+ if ( expr == old ) {
+ if ( anyFound == null ) {
+ throw "Syntax error, unrecognized expression: " + expr;
+ } else {
+ break;
+ }
+ }
+
+ old = expr;
+ }
+
+ return curLoop;
+};
+
+var Expr = Sizzle.selectors = {
+ order: [ "ID", "NAME", "TAG" ],
+ match: {
+ ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
+ CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
+ TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
+ CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
+ },
+ attrMap: {
+ "class": "className",
+ "for": "htmlFor"
+ },
+ attrHandle: {
+ href: function(elem){
+ return elem.getAttribute("href");
+ }
+ },
+ relative: {
+ "+": function(checkSet, part, isXML){
+ var isPartStr = typeof part === "string",
+ isTag = isPartStr && !/\W/.test(part),
+ isPartStrNotTag = isPartStr && !isTag;
+
+ if ( isTag && !isXML ) {
+ part = part.toUpperCase();
+ }
+
+ for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
+ if ( (elem = checkSet[i]) ) {
+ while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
+
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
+ elem || false :
+ elem === part;
+ }
+ }
+
+ if ( isPartStrNotTag ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ },
+ ">": function(checkSet, part, isXML){
+ var isPartStr = typeof part === "string";
+
+ if ( isPartStr && !/\W/.test(part) ) {
+ part = isXML ? part : part.toUpperCase();
+
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+ if ( elem ) {
+ var parent = elem.parentNode;
+ checkSet[i] = parent.nodeName === part ? parent : false;
+ }
+ }
+ } else {
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+ if ( elem ) {
+ checkSet[i] = isPartStr ?
+ elem.parentNode :
+ elem.parentNode === part;
+ }
+ }
+
+ if ( isPartStr ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ }
+ },
+ "": function(checkSet, part, isXML){
+ var doneName = done++, checkFn = dirCheck;
+
+ if ( !part.match(/\W/) ) {
+ var nodeCheck = part = isXML ? part : part.toUpperCase();
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
+ },
+ "~": function(checkSet, part, isXML){
+ var doneName = done++, checkFn = dirCheck;
+
+ if ( typeof part === "string" && !part.match(/\W/) ) {
+ var nodeCheck = part = isXML ? part : part.toUpperCase();
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
+ }
+ },
+ find: {
+ ID: function(match, context, isXML){
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+ return m ? [m] : [];
+ }
+ },
+ NAME: function(match, context, isXML){
+ if ( typeof context.getElementsByName !== "undefined" ) {
+ var ret = [], results = context.getElementsByName(match[1]);
+
+ for ( var i = 0, l = results.length; i < l; i++ ) {
+ if ( results[i].getAttribute("name") === match[1] ) {
+ ret.push( results[i] );
+ }
+ }
+
+ return ret.length === 0 ? null : ret;
+ }
+ },
+ TAG: function(match, context){
+ return context.getElementsByTagName(match[1]);
+ }
+ },
+ preFilter: {
+ CLASS: function(match, curLoop, inplace, result, not, isXML){
+ match = " " + match[1].replace(/\\/g, "") + " ";
+
+ if ( isXML ) {
+ return match;
+ }
+
+ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
+ if ( elem ) {
+ if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {
+ if ( !inplace )
+ result.push( elem );
+ } else if ( inplace ) {
+ curLoop[i] = false;
+ }
+ }
+ }
+
+ return false;
+ },
+ ID: function(match){
+ return match[1].replace(/\\/g, "");
+ },
+ TAG: function(match, curLoop){
+ for ( var i = 0; curLoop[i] === false; i++ ){}
+ return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
+ },
+ CHILD: function(match){
+ if ( match[1] == "nth" ) {
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+ var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
+ match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
+
+ // calculate the numbers (first)n+(last) including if they are negative
+ match[2] = (test[1] + (test[2] || 1)) - 0;
+ match[3] = test[3] - 0;
+ }
+
+ // TODO: Move to normal caching system
+ match[0] = done++;
+
+ return match;
+ },
+ ATTR: function(match, curLoop, inplace, result, not, isXML){
+ var name = match[1].replace(/\\/g, "");
+
+ if ( !isXML && Expr.attrMap[name] ) {
+ match[1] = Expr.attrMap[name];
+ }
+
+ if ( match[2] === "~=" ) {
+ match[4] = " " + match[4] + " ";
+ }
+
+ return match;
+ },
+ PSEUDO: function(match, curLoop, inplace, result, not){
+ if ( match[1] === "not" ) {
+ // If we're dealing with a complex expression, or a simple one
+ if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) {
+ match[3] = Sizzle(match[3], null, null, curLoop);
+ } else {
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+ if ( !inplace ) {
+ result.push.apply( result, ret );
+ }
+ return false;
+ }
+ } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
+ return true;
+ }
+
+ return match;
+ },
+ POS: function(match){
+ match.unshift( true );
+ return match;
+ }
+ },
+ filters: {
+ enabled: function(elem){
+ return elem.disabled === false && elem.type !== "hidden";
+ },
+ disabled: function(elem){
+ return elem.disabled === true;
+ },
+ checked: function(elem){
+ return elem.checked === true;
+ },
+ selected: function(elem){
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ elem.parentNode.selectedIndex;
+ return elem.selected === true;
+ },
+ parent: function(elem){
+ return !!elem.firstChild;
+ },
+ empty: function(elem){
+ return !elem.firstChild;
+ },
+ has: function(elem, i, match){
+ return !!Sizzle( match[3], elem ).length;
+ },
+ header: function(elem){
+ return /h\d/i.test( elem.nodeName );
+ },
+ text: function(elem){
+ return "text" === elem.type;
+ },
+ radio: function(elem){
+ return "radio" === elem.type;
+ },
+ checkbox: function(elem){
+ return "checkbox" === elem.type;
+ },
+ file: function(elem){
+ return "file" === elem.type;
+ },
+ password: function(elem){
+ return "password" === elem.type;
+ },
+ submit: function(elem){
+ return "submit" === elem.type;
+ },
+ image: function(elem){
+ return "image" === elem.type;
+ },
+ reset: function(elem){
+ return "reset" === elem.type;
+ },
+ button: function(elem){
+ return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
+ },
+ input: function(elem){
+ return /input|select|textarea|button/i.test(elem.nodeName);
+ }
+ },
+ setFilters: {
+ first: function(elem, i){
+ return i === 0;
+ },
+ last: function(elem, i, match, array){
+ return i === array.length - 1;
+ },
+ even: function(elem, i){
+ return i % 2 === 0;
+ },
+ odd: function(elem, i){
+ return i % 2 === 1;
+ },
+ lt: function(elem, i, match){
+ return i < match[3] - 0;
+ },
+ gt: function(elem, i, match){
+ return i > match[3] - 0;
+ },
+ nth: function(elem, i, match){
+ return match[3] - 0 == i;
+ },
+ eq: function(elem, i, match){
+ return match[3] - 0 == i;
+ }
+ },
+ filter: {
+ PSEUDO: function(elem, match, i, array){
+ var name = match[1], filter = Expr.filters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+ } else if ( name === "contains" ) {
+ return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
+ } else if ( name === "not" ) {
+ var not = match[3];
+
+ for ( var i = 0, l = not.length; i < l; i++ ) {
+ if ( not[i] === elem ) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ },
+ CHILD: function(elem, match){
+ var type = match[1], node = elem;
+ switch (type) {
+ case 'only':
+ case 'first':
+ while (node = node.previousSibling) {
+ if ( node.nodeType === 1 ) return false;
+ }
+ if ( type == 'first') return true;
+ node = elem;
+ case 'last':
+ while (node = node.nextSibling) {
+ if ( node.nodeType === 1 ) return false;
+ }
+ return true;
+ case 'nth':
+ var first = match[2], last = match[3];
+
+ if ( first == 1 && last == 0 ) {
+ return true;
+ }
+
+ var doneName = match[0],
+ parent = elem.parentNode;
+
+ if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
+ var count = 0;
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
+ if ( node.nodeType === 1 ) {
+ node.nodeIndex = ++count;
+ }
+ }
+ parent.sizcache = doneName;
+ }
+
+ var diff = elem.nodeIndex - last;
+ if ( first == 0 ) {
+ return diff == 0;
+ } else {
+ return ( diff % first == 0 && diff / first >= 0 );
+ }
+ }
+ },
+ ID: function(elem, match){
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;
+ },
+ TAG: function(elem, match){
+ return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
+ },
+ CLASS: function(elem, match){
+ return (" " + (elem.className || elem.getAttribute("class")) + " ")
+ .indexOf( match ) > -1;
+ },
+ ATTR: function(elem, match){
+ var name = match[1],
+ result = Expr.attrHandle[ name ] ?
+ Expr.attrHandle[ name ]( elem ) :
+ elem[ name ] != null ?
+ elem[ name ] :
+ elem.getAttribute( name ),
+ value = result + "",
+ type = match[2],
+ check = match[4];
+
+ return result == null ?
+ type === "!=" :
+ type === "=" ?
+ value === check :
+ type === "*=" ?
+ value.indexOf(check) >= 0 :
+ type === "~=" ?
+ (" " + value + " ").indexOf(check) >= 0 :
+ !check ?
+ value && result !== false :
+ type === "!=" ?
+ value != check :
+ type === "^=" ?
+ value.indexOf(check) === 0 :
+ type === "$=" ?
+ value.substr(value.length - check.length) === check :
+ type === "|=" ?
+ value === check || value.substr(0, check.length + 1) === check + "-" :
+ false;
+ },
+ POS: function(elem, match, i, array){
+ var name = match[2], filter = Expr.setFilters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+ }
+ }
+ }
+};
+
+var origPOS = Expr.match.POS;
+
+for ( var type in Expr.match ) {
+ Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
+}
+
+var makeArray = function(array, results) {
+ array = Array.prototype.slice.call( array );
+
+ if ( results ) {
+ results.push.apply( results, array );
+ return results;
+ }
+
+ return array;
+};
+
+// Perform a simple check to determine if the browser is capable of
+// converting a NodeList to an array using builtin methods.
+try {
+ Array.prototype.slice.call( document.documentElement.childNodes );
+
+// Provide a fallback method if it does not work
+} catch(e){
+ makeArray = function(array, results) {
+ var ret = results || [];
+
+ if ( toString.call(array) === "[object Array]" ) {
+ Array.prototype.push.apply( ret, array );
+ } else {
+ if ( typeof array.length === "number" ) {
+ for ( var i = 0, l = array.length; i < l; i++ ) {
+ ret.push( array[i] );
+ }
+ } else {
+ for ( var i = 0; array[i]; i++ ) {
+ ret.push( array[i] );
+ }
+ }
+ }
+
+ return ret;
+ };
+}
+
+var sortOrder;
+
+if ( document.documentElement.compareDocumentPosition ) {
+ sortOrder = function( a, b ) {
+ var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
+ if ( ret === 0 ) {
+ hasDuplicate = true;
+ }
+ return ret;
+ };
+} else if ( "sourceIndex" in document.documentElement ) {
+ sortOrder = function( a, b ) {
+ var ret = a.sourceIndex - b.sourceIndex;
+ if ( ret === 0 ) {
+ hasDuplicate = true;
+ }
+ return ret;
+ };
+} else if ( document.createRange ) {
+ sortOrder = function( a, b ) {
+ var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
+ aRange.selectNode(a);
+ aRange.collapse(true);
+ bRange.selectNode(b);
+ bRange.collapse(true);
+ var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
+ if ( ret === 0 ) {
+ hasDuplicate = true;
+ }
+ return ret;
+ };
+}
+
+// Check to see if the browser returns elements by name when
+// querying by getElementById (and provide a workaround)
+(function(){
+ // We're going to inject a fake input element with a specified name
+ var form = document.createElement("form"),
+ id = "script" + (new Date).getTime();
+ form.innerHTML = "<input name='" + id + "'/>";
+
+ // Inject it into the root element, check its status, and remove it quickly
+ var root = document.documentElement;
+ root.insertBefore( form, root.firstChild );
+
+ // The workaround has to do additional checks after a getElementById
+ // Which slows things down for other browsers (hence the branching)
+ if ( !!document.getElementById( id ) ) {
+ Expr.find.ID = function(match, context, isXML){
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+ return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
+ }
+ };
+
+ Expr.filter.ID = function(elem, match){
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+ return elem.nodeType === 1 && node && node.nodeValue === match;
+ };
+ }
+
+ root.removeChild( form );
+})();
+
+(function(){
+ // Check to see if the browser returns only elements
+ // when doing getElementsByTagName("*")
+
+ // Create a fake element
+ var div = document.createElement("div");
+ div.appendChild( document.createComment("") );
+
+ // Make sure no comments are found
+ if ( div.getElementsByTagName("*").length > 0 ) {
+ Expr.find.TAG = function(match, context){
+ var results = context.getElementsByTagName(match[1]);
+
+ // Filter out possible comments
+ if ( match[1] === "*" ) {
+ var tmp = [];
+
+ for ( var i = 0; results[i]; i++ ) {
+ if ( results[i].nodeType === 1 ) {
+ tmp.push( results[i] );
+ }
+ }
+
+ results = tmp;
+ }
+
+ return results;
+ };
+ }
+
+ // Check to see if an attribute returns normalized href attributes
+ div.innerHTML = "<a href='#'></a>";
+ if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
+ div.firstChild.getAttribute("href") !== "#" ) {
+ Expr.attrHandle.href = function(elem){
+ return elem.getAttribute("href", 2);
+ };
+ }
+})();
+
+if ( document.querySelectorAll ) (function(){
+ var oldSizzle = Sizzle, div = document.createElement("div");
+ div.innerHTML = "<p class='TEST'></p>";
+
+ // Safari can't handle uppercase or unicode characters when
+ // in quirks mode.
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
+ return;
+ }
+
+ Sizzle = function(query, context, extra, seed){
+ context = context || document;
+
+ // Only use querySelectorAll on non-XML documents
+ // (ID selectors don't work in non-HTML documents)
+ if ( !seed && context.nodeType === 9 && !isXML(context) ) {
+ try {
+ return makeArray( context.querySelectorAll(query), extra );
+ } catch(e){}
+ }
+
+ return oldSizzle(query, context, extra, seed);
+ };
+
+ Sizzle.find = oldSizzle.find;
+ Sizzle.filter = oldSizzle.filter;
+ Sizzle.selectors = oldSizzle.selectors;
+ Sizzle.matches = oldSizzle.matches;
+})();
+
+if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
+ var div = document.createElement("div");
+ div.innerHTML = "<div class='test e'></div><div class='test'></div>";
+
+ // Opera can't find a second classname (in 9.6)
+ if ( div.getElementsByClassName("e").length === 0 )
+ return;
+
+ // Safari caches class attributes, doesn't catch changes (in 3.2)
+ div.lastChild.className = "e";
+
+ if ( div.getElementsByClassName("e").length === 1 )
+ return;
+
+ Expr.order.splice(1, 0, "CLASS");
+ Expr.find.CLASS = function(match, context, isXML) {
+ if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
+ return context.getElementsByClassName(match[1]);
+ }
+ };
+})();
+
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ var sibDir = dir == "previousSibling" && !isXML;
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+ if ( elem ) {
+ if ( sibDir && elem.nodeType === 1 ){
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+ elem = elem[dir];
+ var match = false;
+
+ while ( elem ) {
+ if ( elem.sizcache === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 && !isXML ){
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+
+ if ( elem.nodeName === cur ) {
+ match = elem;
+ break;
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ var sibDir = dir == "previousSibling" && !isXML;
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+ if ( elem ) {
+ if ( sibDir && elem.nodeType === 1 ) {
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+ elem = elem[dir];
+ var match = false;
+
+ while ( elem ) {
+ if ( elem.sizcache === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 ) {
+ if ( !isXML ) {
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+ if ( typeof cur !== "string" ) {
+ if ( elem === cur ) {
+ match = true;
+ break;
+ }
+
+ } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
+ match = elem;
+ break;
+ }
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+var contains = document.compareDocumentPosition ? function(a, b){
+ return a.compareDocumentPosition(b) & 16;
+} : function(a, b){
+ return a !== b && (a.contains ? a.contains(b) : true);
+};
+
+var isXML = function(elem){
+ return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
+ !!elem.ownerDocument && isXML( elem.ownerDocument );
+};
+
+var posProcess = function(selector, context){
+ var tmpSet = [], later = "", match,
+ root = context.nodeType ? [context] : context;
+
+ // Position selectors must be done after the filter
+ // And so must :not(positional) so we move all PSEUDOs to the end
+ while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
+ later += match[0];
+ selector = selector.replace( Expr.match.PSEUDO, "" );
+ }
+
+ selector = Expr.relative[selector] ? selector + "*" : selector;
+
+ for ( var i = 0, l = root.length; i < l; i++ ) {
+ Sizzle( selector, root[i], tmpSet );
+ }
+
+ return Sizzle.filter( later, tmpSet );
+};
+
+// EXPOSE
+jQuery.find = Sizzle;
+jQuery.filter = Sizzle.filter;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.filters;
+
+Sizzle.selectors.filters.hidden = function(elem){
+ return elem.offsetWidth === 0 || elem.offsetHeight === 0;
+};
+
+Sizzle.selectors.filters.visible = function(elem){
+ return elem.offsetWidth > 0 || elem.offsetHeight > 0;
+};
+
+Sizzle.selectors.filters.animated = function(elem){
+ return jQuery.grep(jQuery.timers, function(fn){
+ return elem === fn.elem;
+ }).length;
+};
+
+jQuery.multiFilter = function( expr, elems, not ) {
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return Sizzle.matches(expr, elems);
+};
+
+jQuery.dir = function( elem, dir ){
+ var matched = [], cur = elem[dir];
+ while ( cur && cur != document ) {
+ if ( cur.nodeType == 1 )
+ matched.push( cur );
+ cur = cur[dir];
+ }
+ return matched;
+};
+
+jQuery.nth = function(cur, result, dir, elem){
+ result = result || 1;
+ var num = 0;
+
+ for ( ; cur; cur = cur[dir] )
+ if ( cur.nodeType == 1 && ++num == result )
+ break;
+
+ return cur;
+};
+
+jQuery.sibling = function(n, elem){
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType == 1 && n != elem )
+ r.push( n );
+ }
+
+ return r;
+};
+
+return;
+
+window.Sizzle = Sizzle;
+
+})();
+/*
+ * A number of helper functions used for managing events.
+ * Many of the ideas behind this code originated from
+ * Dean Edwards' addEvent library.
+ */
+jQuery.event = {
+
+ // Bind an event to an element
+ // Original by Dean Edwards
+ add: function(elem, types, handler, data) {
+ if ( elem.nodeType == 3 || elem.nodeType == 8 )
+ return;
+
+ // For whatever reason, IE has trouble passing the window object
+ // around, causing it to be cloned in the process
+ if ( elem.setInterval && elem != window )
+ elem = window;
+
+ // Make sure that the function being executed has a unique ID
+ if ( !handler.guid )
+ handler.guid = this.guid++;
+
+ // if data is passed, bind to handler
+ if ( data !== undefined ) {
+ // Create temporary function pointer to original handler
+ var fn = handler;
+
+ // Create unique handler function, wrapped around original handler
+ handler = this.proxy( fn );
+
+ // Store data in unique handler
+ handler.data = data;
+ }
+
+ // Init the element's event structure
+ var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
+ handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
+ // Handle the second event of a trigger and when
+ // an event is called after a page has unloaded
+ return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
+ jQuery.event.handle.apply(arguments.callee.elem, arguments) :
+ undefined;
+ });
+ // Add elem as a property of the handle function
+ // This is to prevent a memory leak with non-native
+ // event in IE.
+ handle.elem = elem;
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ jQuery.each(types.split(/\s+/), function(index, type) {
+ // Namespaced event handlers
+ var namespaces = type.split(".");
+ type = namespaces.shift();
+ handler.type = namespaces.slice().sort().join(".");
+
+ // Get the current list of functions bound to this event
+ var handlers = events[type];
+
+ if ( jQuery.event.specialAll[type] )
+ jQuery.event.specialAll[type].setup.call(elem, data, namespaces);
+
+ // Init the event handler queue
+ if (!handlers) {
+ handlers = events[type] = {};
+
+ // Check for a special event handler
+ // Only use addEventListener/attachEvent if the special
+ // events handler returns false
+ if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) {
+ // Bind the global event handler to the element
+ if (elem.addEventListener)
+ elem.addEventListener(type, handle, false);
+ else if (elem.attachEvent)
+ elem.attachEvent("on" + type, handle);
+ }
+ }
+
+ // Add the function to the element's handler list
+ handlers[handler.guid] = handler;
+
+ // Keep track of which events have been used, for global triggering
+ jQuery.event.global[type] = true;
+ });
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ guid: 1,
+ global: {},
+
+ // Detach an event or set of events from an element
+ remove: function(elem, types, handler) {
+ // don't do events on text and comment nodes
+ if ( elem.nodeType == 3 || elem.nodeType == 8 )
+ return;
+
+ var events = jQuery.data(elem, "events"), ret, index;
+
+ if ( events ) {
+ // Unbind all events for the element
+ if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") )
+ for ( var type in events )
+ this.remove( elem, type + (types || "") );
+ else {
+ // types is actually an event object here
+ if ( types.type ) {
+ handler = types.handler;
+ types = types.type;
+ }
+
+ // Handle multiple events seperated by a space
+ // jQuery(...).unbind("mouseover mouseout", fn);
+ jQuery.each(types.split(/\s+/), function(index, type){
+ // Namespaced event handlers
+ var namespaces = type.split(".");
+ type = namespaces.shift();
+ var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
+
+ if ( events[type] ) {
+ // remove the given handler for the given type
+ if ( handler )
+ delete events[type][handler.guid];
+
+ // remove all handlers for the given type
+ else
+ for ( var handle in events[type] )
+ // Handle the removal of namespaced events
+ if ( namespace.test(events[type][handle].type) )
+ delete events[type][handle];
+
+ if ( jQuery.event.specialAll[type] )
+ jQuery.event.specialAll[type].teardown.call(elem, namespaces);
+
+ // remove generic event handler if no more handlers exist
+ for ( ret in events[type] ) break;
+ if ( !ret ) {
+ if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {
+ if (elem.removeEventListener)
+ elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
+ else if (elem.detachEvent)
+ elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
+ }
+ ret = null;
+ delete events[type];
+ }
+ }
+ });
+ }
+
+ // Remove the expando if it's no longer used
+ for ( ret in events ) break;
+ if ( !ret ) {
+ var handle = jQuery.data( elem, "handle" );
+ if ( handle ) handle.elem = null;
+ jQuery.removeData( elem, "events" );
+ jQuery.removeData( elem, "handle" );
+ }
+ }
+ },
+
+ // bubbling is internal
+ trigger: function( event, data, elem, bubbling ) {
+ // Event object or event type
+ var type = event.type || event;
+
+ if( !bubbling ){
+ event = typeof event === "object" ?
+ // jQuery.Event object
+ event[expando] ? event :
+ // Object literal
+ jQuery.extend( jQuery.Event(type), event ) :
+ // Just the event type (string)
+ jQuery.Event(type);
+
+ if ( type.indexOf("!") >= 0 ) {
+ event.type = type = type.slice(0, -1);
+ event.exclusive = true;
+ }
+
+ // Handle a global trigger
+ if ( !elem ) {
+ // Don't bubble custom events when global (to avoid too much overhead)
+ event.stopPropagation();
+ // Only trigger if we've ever bound an event for it
+ if ( this.global[type] )
+ jQuery.each( jQuery.cache, function(){
+ if ( this.events && this.events[type] )
+ jQuery.event.trigger( event, data, this.handle.elem );
+ });
+ }
+
+ // Handle triggering a single element
+
+ // don't do events on text and comment nodes
+ if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 )
+ return undefined;
+
+ // Clean up in case it is reused
+ event.result = undefined;
+ event.target = elem;
+
+ // Clone the incoming data, if any
+ data = jQuery.makeArray(data);
+ data.unshift( event );
+ }
+
+ event.currentTarget = elem;
+
+ // Trigger the event, it is assumed that "handle" is a function
+ var handle = jQuery.data(elem, "handle");
+ if ( handle )
+ handle.apply( elem, data );
+
+ // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
+ if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
+ event.result = false;
+
+ // Trigger the native events (except for clicks on links)
+ if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
+ this.triggered = true;
+ try {
+ elem[ type ]();
+ // prevent IE from throwing an error for some hidden elements
+ } catch (e) {}
+ }
+
+ this.triggered = false;
+
+ if ( !event.isPropagationStopped() ) {
+ var parent = elem.parentNode || elem.ownerDocument;
+ if ( parent )
+ jQuery.event.trigger(event, data, parent, true);
+ }
+ },
+
+ handle: function(event) {
+ // returned undefined or false
+ var all, handlers;
+
+ event = arguments[0] = jQuery.event.fix( event || window.event );
+ event.currentTarget = this;
+
+ // Namespaced event handlers
+ var namespaces = event.type.split(".");
+ event.type = namespaces.shift();
+
+ // Cache this now, all = true means, any handler
+ all = !namespaces.length && !event.exclusive;
+
+ var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
+
+ handlers = ( jQuery.data(this, "events") || {} )[event.type];
+
+ for ( var j in handlers ) {
+ var handler = handlers[j];
+
+ // Filter the functions by class
+ if ( all || namespace.test(handler.type) ) {
+ // Pass in a reference to the handler function itself
+ // So that we can later remove it
+ event.handler = handler;
+ event.data = handler.data;
+
+ var ret = handler.apply(this, arguments);
+
+ if( ret !== undefined ){
+ event.result = ret;
+ if ( ret === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+
+ if( event.isImmediatePropagationStopped() )
+ break;
+
+ }
+ }
+ },
+
+ props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+
+ fix: function(event) {
+ if ( event[expando] )
+ return event;
+
+ // store a copy of the original event object
+ // and "clone" to set read-only properties
+ var originalEvent = event;
+ event = jQuery.Event( originalEvent );
+
+ for ( var i = this.props.length, prop; i; ){
+ prop = this.props[ --i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Fix target property, if necessary
+ if ( !event.target )
+ event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
+
+ // check if target is a textnode (safari)
+ if ( event.target.nodeType == 3 )
+ event.target = event.target.parentNode;
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && event.fromElement )
+ event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && event.clientX != null ) {
+ var doc = document.documentElement, body = document.body;
+ event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
+ event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
+ }
+
+ // Add which for key events
+ if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
+ event.which = event.charCode || event.keyCode;
+
+ // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
+ if ( !event.metaKey && event.ctrlKey )
+ event.metaKey = event.ctrlKey;
+
+ // Add which for click: 1 == left; 2 == middle; 3 == right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && event.button )
+ event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
+
+ return event;
+ },
+
+ proxy: function( fn, proxy ){
+ proxy = proxy || function(){ return fn.apply(this, arguments); };
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
+ // So proxy can be declared as an argument
+ return proxy;
+ },
+
+ special: {
+ ready: {
+ // Make sure the ready event is setup
+ setup: bindReady,
+ teardown: function() {}
+ }
+ },
+
+ specialAll: {
+ live: {
+ setup: function( selector, namespaces ){
+ jQuery.event.add( this, namespaces[0], liveHandler );
+ },
+ teardown: function( namespaces ){
+ if ( namespaces.length ) {
+ var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
+
+ jQuery.each( (jQuery.data(this, "events").live || {}), function(){
+ if ( name.test(this.type) )
+ remove++;
+ });
+
+ if ( remove < 1 )
+ jQuery.event.remove( this, namespaces[0], liveHandler );
+ }
+ }
+ }
+ }
+};
+
+jQuery.Event = function( src ){
+ // Allow instantiation without the 'new' keyword
+ if( !this.preventDefault )
+ return new jQuery.Event(src);
+
+ // Event object
+ if( src && src.type ){
+ this.originalEvent = src;
+ this.type = src.type;
+ // Event type
+ }else
+ this.type = src;
+
+ // timeStamp is buggy for some events on Firefox(#3843)
+ // So we won't rely on the native value
+ this.timeStamp = now();
+
+ // Mark it as fixed
+ this[expando] = true;
+};
+
+function returnFalse(){
+ return false;
+}
+function returnTrue(){
+ return true;
+}
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ preventDefault: function() {
+ this.isDefaultPrevented = returnTrue;
+
+ var e = this.originalEvent;
+ if( !e )
+ return;
+ // if preventDefault exists run it on the original event
+ if (e.preventDefault)
+ e.preventDefault();
+ // otherwise set the returnValue property of the original event to false (IE)
+ e.returnValue = false;
+ },
+ stopPropagation: function() {
+ this.isPropagationStopped = returnTrue;
+
+ var e = this.originalEvent;
+ if( !e )
+ return;
+ // if stopPropagation exists run it on the original event
+ if (e.stopPropagation)
+ e.stopPropagation();
+ // otherwise set the cancelBubble property of the original event to true (IE)
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation:function(){
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ },
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse
+};
+// Checks if an event happened on an element within another element
+// Used in jQuery.event.special.mouseenter and mouseleave handlers
+var withinElement = function(event) {
+ // Check if mouse(over|out) are still within the same parent element
+ var parent = event.relatedTarget;
+ // Traverse up the tree
+ while ( parent && parent != this )
+ try { parent = parent.parentNode; }
+ catch(e) { parent = this; }
+
+ if( parent != this ){
+ // set the correct event type
+ event.type = event.data;
+ // handle event if we actually just moused on to a non sub-element
+ jQuery.event.handle.apply( this, arguments );
+ }
+};
+
+jQuery.each({
+ mouseover: 'mouseenter',
+ mouseout: 'mouseleave'
+}, function( orig, fix ){
+ jQuery.event.special[ fix ] = {
+ setup: function(){
+ jQuery.event.add( this, orig, withinElement, fix );
+ },
+ teardown: function(){
+ jQuery.event.remove( this, orig, withinElement );
+ }
+ };
+});
+
+jQuery.fn.extend({
+ bind: function( type, data, fn ) {
+ return type == "unload" ? this.one(type, data, fn) : this.each(function(){
+ jQuery.event.add( this, type, fn || data, fn && data );
+ });
+ },
+
+ one: function( type, data, fn ) {
+ var one = jQuery.event.proxy( fn || data, function(event) {
+ jQuery(this).unbind(event, one);
+ return (fn || data).apply( this, arguments );
+ });
+ return this.each(function(){
+ jQuery.event.add( this, type, one, fn && data);
+ });
+ },
+
+ unbind: function( type, fn ) {
+ return this.each(function(){
+ jQuery.event.remove( this, type, fn );
+ });
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function(){
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+
+ triggerHandler: function( type, data ) {
+ if( this[0] ){
+ var event = jQuery.Event(type);
+ event.preventDefault();
+ event.stopPropagation();
+ jQuery.event.trigger( event, data, this[0] );
+ return event.result;
+ }
+ },
+
+ toggle: function( fn ) {
+ // Save reference to arguments for access in closure
+ var args = arguments, i = 1;
+
+ // link all the functions, so any of them can unbind this click handler
+ while( i < args.length )
+ jQuery.event.proxy( fn, args[i++] );
+
+ return this.click( jQuery.event.proxy( fn, function(event) {
+ // Figure out which function to execute
+ this.lastToggle = ( this.lastToggle || 0 ) % i;
+
+ // Make sure that clicks stop
+ event.preventDefault();
+
+ // and execute the function
+ return args[ this.lastToggle++ ].apply( this, arguments ) || false;
+ }));
+ },
+
+ hover: function(fnOver, fnOut) {
+ return this.mouseenter(fnOver).mouseleave(fnOut);
+ },
+
+ ready: function(fn) {
+ // Attach the listeners
+ bindReady();
+
+ // If the DOM is already ready
+ if ( jQuery.isReady )
+ // Execute the function immediately
+ fn.call( document, jQuery );
+
+ // Otherwise, remember the function for later
+ else
+ // Add the function to the wait list
+ jQuery.readyList.push( fn );
+
+ return this;
+ },
+
+ live: function( type, fn ){
+ var proxy = jQuery.event.proxy( fn );
+ proxy.guid += this.selector + type;
+
+ jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );
+
+ return this;
+ },
+
+ die: function( type, fn ){
+ jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
+ return this;
+ }
+});
+
+function liveHandler( event ){
+ var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
+ stop = true,
+ elems = [];
+
+ jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){
+ if ( check.test(fn.type) ) {
+ var elem = jQuery(event.target).closest(fn.data)[0];
+ if ( elem )
+ elems.push({ elem: elem, fn: fn });
+ }
+ });
+
+ elems.sort(function(a,b) {
+ return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest");
+ });
+
+ jQuery.each(elems, function(){
+ if ( this.fn.call(this.elem, event, this.fn.data) === false )
+ return (stop = false);
+ });
+
+ return stop;
+}
+
+function liveConvert(type, selector){
+ return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join(".");
+}
+
+jQuery.extend({
+ isReady: false,
+ readyList: [],
+ // Handle when the DOM is ready
+ ready: function() {
+ // Make sure that the DOM is not already loaded
+ if ( !jQuery.isReady ) {
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If there are functions bound, to execute
+ if ( jQuery.readyList ) {
+ // Execute all of them
+ jQuery.each( jQuery.readyList, function(){
+ this.call( document, jQuery );
+ });
+
+ // Reset the list of functions
+ jQuery.readyList = null;
+ }
+
+ // Trigger any bound ready events
+ jQuery(document).triggerHandler("ready");
+ }
+ }
+});
+
+var readyBound = false;
+
+function bindReady(){
+ if ( readyBound ) return;
+ readyBound = true;
+
+ // Mozilla, Opera and webkit nightlies currently support this event
+ if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", function(){
+ document.removeEventListener( "DOMContentLoaded", arguments.callee, false );
+ jQuery.ready();
+ }, false );
+
+ // If IE event model is used
+ } else if ( document.attachEvent ) {
+ // ensure firing before onload,
+ // maybe late but safe also for iframes
+ document.attachEvent("onreadystatechange", function(){
+ if ( document.readyState === "complete" ) {
+ document.detachEvent( "onreadystatechange", arguments.callee );
+ jQuery.ready();
+ }
+ });
+
+ // If IE and not an iframe
+ // continually check to see if the document is ready
+ if ( document.documentElement.doScroll && window == window.top ) (function(){
+ if ( jQuery.isReady ) return;
+
+ try {
+ // If IE is used, use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ document.documentElement.doScroll("left");
+ } catch( error ) {
+ setTimeout( arguments.callee, 0 );
+ return;
+ }
+
+ // and execute any waiting functions
+ jQuery.ready();
+ })();
+ }
+
+ // A fallback to window.onload, that will always work
+ jQuery.event.add( window, "load", jQuery.ready );
+}
+
+jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
+ "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +
+ "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){
+
+ // Handle event binding
+ jQuery.fn[name] = function(fn){
+ return fn ? this.bind(name, fn) : this.trigger(name);
+ };
+});
+
+// Prevent memory leaks in IE
+// And prevent errors on refresh with events like mouseover in other browsers
+// Window isn't included so as not to unbind existing unload events
+jQuery( window ).bind( 'unload', function(){
+ for ( var id in jQuery.cache )
+ // Skip the window
+ if ( id != 1 && jQuery.cache[ id ].handle )
+ jQuery.event.remove( jQuery.cache[ id ].handle.elem );
+});
+(function(){
+
+ jQuery.support = {};
+
+ var root = document.documentElement,
+ script = document.createElement("script"),
+ div = document.createElement("div"),
+ id = "script" + (new Date).getTime();
+
+ div.style.display = "none";
+ div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
+
+ var all = div.getElementsByTagName("*"),
+ a = div.getElementsByTagName("a")[0];
+
+ // Can't get basic test support
+ if ( !all || !all.length || !a ) {
+ return;
+ }
+
+ jQuery.support = {
+ // IE strips leading whitespace when .innerHTML is used
+ leadingWhitespace: div.firstChild.nodeType == 3,
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ tbody: !div.getElementsByTagName("tbody").length,
+
+ // Make sure that you can get all elements in an <object> element
+ // IE 7 always returns no results
+ objectAll: !!div.getElementsByTagName("object")[0]
+ .getElementsByTagName("*").length,
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ htmlSerialize: !!div.getElementsByTagName("link").length,
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText insted)
+ style: /red/.test( a.getAttribute("style") ),
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ hrefNormalized: a.getAttribute("href") === "/a",
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ opacity: a.style.opacity === "0.5",
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ cssFloat: !!a.style.cssFloat,
+
+ // Will be defined later
+ scriptEval: false,
+ noCloneEvent: true,
+ boxModel: null
+ };
+
+ script.type = "text/javascript";
+ try {
+ script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
+ } catch(e){}
+
+ root.insertBefore( script, root.firstChild );
+
+ // Make sure that the execution of code works by injecting a script
+ // tag with appendChild/createTextNode
+ // (IE doesn't support this, fails, and uses .text instead)
+ if ( window[ id ] ) {
+ jQuery.support.scriptEval = true;
+ delete window[ id ];
+ }
+
+ root.removeChild( script );
+
+ if ( div.attachEvent && div.fireEvent ) {
+ div.attachEvent("onclick", function(){
+ // Cloning a node shouldn't copy over any
+ // bound event handlers (IE does this)
+ jQuery.support.noCloneEvent = false;
+ div.detachEvent("onclick", arguments.callee);
+ });
+ div.cloneNode(true).fireEvent("onclick");
+ }
+
+ // Figure out if the W3C box model works as expected
+ // document.body must exist before we can do this
+ jQuery(function(){
+ var div = document.createElement("div");
+ div.style.width = div.style.paddingLeft = "1px";
+
+ document.body.appendChild( div );
+ jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
+ document.body.removeChild( div ).style.display = 'none';
+ });
+})();
+
+var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
+
+jQuery.props = {
+ "for": "htmlFor",
+ "class": "className",
+ "float": styleFloat,
+ cssFloat: styleFloat,
+ styleFloat: styleFloat,
+ readonly: "readOnly",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ rowspan: "rowSpan",
+ tabindex: "tabIndex"
+};
+jQuery.fn.extend({
+ // Keep a copy of the old load
+ _load: jQuery.fn.load,
+
+ load: function( url, params, callback ) {
+ if ( typeof url !== "string" )
+ return this._load( url );
+
+ var off = url.indexOf(" ");
+ if ( off >= 0 ) {
+ var selector = url.slice(off, url.length);
+ url = url.slice(0, off);
+ }
+
+ // Default to a GET request
+ var type = "GET";
+
+ // If the second parameter was provided
+ if ( params )
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+ // We assume that it's the callback
+ callback = params;
+ params = null;
+
+ // Otherwise, build a param string
+ } else if( typeof params === "object" ) {
+ params = jQuery.param( params );
+ type = "POST";
+ }
+
+ var self = this;
+
+ // Request the remote document
+ jQuery.ajax({
+ url: url,
+ type: type,
+ dataType: "html",
+ data: params,
+ complete: function(res, status){
+ // If successful, inject the HTML into all the matched elements
+ if ( status == "success" || status == "notmodified" )
+ // See if a selector was specified
+ self.html( selector ?
+ // Create a dummy div to hold the results
+ jQuery("<div/>")
+ // inject the contents of the document in, removing the scripts
+ // to avoid any 'Permission Denied' errors in IE
+ .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
+
+ // Locate the specified elements
+ .find(selector) :
+
+ // If not, just inject the full result
+ res.responseText );
+
+ if( callback )
+ self.each( callback, [res.responseText, status, res] );
+ }
+ });
+ return this;
+ },
+
+ serialize: function() {
+ return jQuery.param(this.serializeArray());
+ },
+ serializeArray: function() {
+ return this.map(function(){
+ return this.elements ? jQuery.makeArray(this.elements) : this;
+ })
+ .filter(function(){
+ return this.name && !this.disabled &&
+ (this.checked || /select|textarea/i.test(this.nodeName) ||
+ /text|hidden|password|search/i.test(this.type));
+ })
+ .map(function(i, elem){
+ var val = jQuery(this).val();
+ return val == null ? null :
+ jQuery.isArray(val) ?
+ jQuery.map( val, function(val, i){
+ return {name: elem.name, value: val};
+ }) :
+ {name: elem.name, value: val};
+ }).get();
+ }
+});
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
+ jQuery.fn[o] = function(f){
+ return this.bind(o, f);
+ };
+});
+
+var jsc = now();
+
+jQuery.extend({
+
+ get: function( url, data, callback, type ) {
+ // shift arguments if data argument was ommited
+ if ( jQuery.isFunction( data ) ) {
+ callback = data;
+ data = null;
+ }
+
+ return jQuery.ajax({
+ type: "GET",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ },
+
+ getScript: function( url, callback ) {
+ return jQuery.get(url, null, callback, "script");
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get(url, data, callback, "json");
+ },
+
+ post: function( url, data, callback, type ) {
+ if ( jQuery.isFunction( data ) ) {
+ callback = data;
+ data = {};
+ }
+
+ return jQuery.ajax({
+ type: "POST",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ },
+
+ ajaxSetup: function( settings ) {
+ jQuery.extend( jQuery.ajaxSettings, settings );
+ },
+
+ ajaxSettings: {
+ url: location.href,
+ global: true,
+ type: "GET",
+ contentType: "application/x-www-form-urlencoded",
+ processData: true,
+ async: true,
+ /*
+ timeout: 0,
+ data: null,
+ username: null,
+ password: null,
+ */
+ // Create the request object; Microsoft failed to properly
+ // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
+ // This function can be overriden by calling jQuery.ajaxSetup
+ xhr:function(){
+ return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
+ },
+ accepts: {
+ xml: "application/xml, text/xml",
+ html: "text/html",
+ script: "text/javascript, application/javascript",
+ json: "application/json, text/javascript",
+ text: "text/plain",
+ _default: "*/*"
+ }
+ },
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+
+ ajax: function( s ) {
+ // Extend the settings, but re-extend 's' so that it can be
+ // checked again later (in the test suite, specifically)
+ s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
+
+ var jsonp, jsre = /=\?(&|$)/g, status, data,
+ type = s.type.toUpperCase();
+
+ // convert data if not already a string
+ if ( s.data && s.processData && typeof s.data !== "string" )
+ s.data = jQuery.param(s.data);
+
+ // Handle JSONP Parameter Callbacks
+ if ( s.dataType == "jsonp" ) {
+ if ( type == "GET" ) {
+ if ( !s.url.match(jsre) )
+ s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
+ } else if ( !s.data || !s.data.match(jsre) )
+ s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
+ s.dataType = "json";
+ }
+
+ // Build temporary JSONP function
+ if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
+ jsonp = "jsonp" + jsc++;
+
+ // Replace the =? sequence both in the query string and the data
+ if ( s.data )
+ s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
+ s.url = s.url.replace(jsre, "=" + jsonp + "$1");
+
+ // We need to make sure
+ // that a JSONP style response is executed properly
+ s.dataType = "script";
+
+ // Handle JSONP-style loading
+ window[ jsonp ] = function(tmp){
+ data = tmp;
+ success();
+ complete();
+ // Garbage collect
+ window[ jsonp ] = undefined;
+ try{ delete window[ jsonp ]; } catch(e){}
+ if ( head )
+ head.removeChild( script );
+ };
+ }
+
+ if ( s.dataType == "script" && s.cache == null )
+ s.cache = false;
+
+ if ( s.cache === false && type == "GET" ) {
+ var ts = now();
+ // try replacing _= if it is there
+ var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
+ // if nothing was replaced, add timestamp to the end
+ s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
+ }
+
+ // If data is available, append data to url for get requests
+ if ( s.data && type == "GET" ) {
+ s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
+
+ // IE likes to send both get and post data, prevent this
+ s.data = null;
+ }
+
+ // Watch for a new set of requests
+ if ( s.global && ! jQuery.active++ )
+ jQuery.event.trigger( "ajaxStart" );
+
+ // Matches an absolute URL, and saves the domain
+ var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url );
+
+ // If we're requesting a remote document
+ // and trying to load JSON or Script with a GET
+ if ( s.dataType == "script" && type == "GET" && parts
+ && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){
+
+ var head = document.getElementsByTagName("head")[0];
+ var script = document.createElement("script");
+ script.src = s.url;
+ if (s.scriptCharset)
+ script.charset = s.scriptCharset;
+
+ // Handle Script loading
+ if ( !jsonp ) {
+ var done = false;
+
+ // Attach handlers for all browsers
+ script.onload = script.onreadystatechange = function(){
+ if ( !done && (!this.readyState ||
+ this.readyState == "loaded" || this.readyState == "complete") ) {
+ done = true;
+ success();
+ complete();
+
+ // Handle memory leak in IE
+ script.onload = script.onreadystatechange = null;
+ head.removeChild( script );
+ }
+ };
+ }
+
+ head.appendChild(script);
+
+ // We handle everything using the script element injection
+ return undefined;
+ }
+
+ var requestDone = false;
+
+ // Create the request object
+ var xhr = s.xhr();
+
+ // Open the socket
+ // Passing null username, generates a login popup on Opera (#2865)
+ if( s.username )
+ xhr.open(type, s.url, s.async, s.username, s.password);
+ else
+ xhr.open(type, s.url, s.async);
+
+ // Need an extra try/catch for cross domain requests in Firefox 3
+ try {
+ // Set the correct header, if data is being sent
+ if ( s.data )
+ xhr.setRequestHeader("Content-Type", s.contentType);
+
+ // Set the If-Modified-Since header, if ifModified mode.
+ if ( s.ifModified )
+ xhr.setRequestHeader("If-Modified-Since",
+ jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
+
+ // Set header so the called script knows that it's an XMLHttpRequest
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+
+ // Set the Accepts header for the server, depending on the dataType
+ xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
+ s.accepts[ s.dataType ] + ", */*" :
+ s.accepts._default );
+ } catch(e){}
+
+ // Allow custom headers/mimetypes and early abort
+ if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
+ // Handle the global AJAX counter
+ if ( s.global && ! --jQuery.active )
+ jQuery.event.trigger( "ajaxStop" );
+ // close opended socket
+ xhr.abort();
+ return false;
+ }
+
+ if ( s.global )
+ jQuery.event.trigger("ajaxSend", [xhr, s]);
+
+ // Wait for a response to come back
+ var onreadystatechange = function(isTimeout){
+ // The request was aborted, clear the interval and decrement jQuery.active
+ if (xhr.readyState == 0) {
+ if (ival) {
+ // clear poll interval
+ clearInterval(ival);
+ ival = null;
+ // Handle the global AJAX counter
+ if ( s.global && ! --jQuery.active )
+ jQuery.event.trigger( "ajaxStop" );
+ }
+ // The transfer is complete and the data is available, or the request timed out
+ } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
+ requestDone = true;
+
+ // clear poll interval
+ if (ival) {
+ clearInterval(ival);
+ ival = null;
+ }
+
+ status = isTimeout == "timeout" ? "timeout" :
+ !jQuery.httpSuccess( xhr ) ? "error" :
+ s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" :
+ "success";
+
+ if ( status == "success" ) {
+ // Watch for, and catch, XML document parse errors
+ try {
+ // process the data (runs the xml through httpData regardless of callback)
+ data = jQuery.httpData( xhr, s.dataType, s );
+ } catch(e) {
+ status = "parsererror";
+ }
+ }
+
+ // Make sure that the request was successful or notmodified
+ if ( status == "success" ) {
+ // Cache Last-Modified header, if ifModified mode.
+ var modRes;
+ try {
+ modRes = xhr.getResponseHeader("Last-Modified");
+ } catch(e) {} // swallow exception thrown by FF if header is not available
+
+ if ( s.ifModified && modRes )
+ jQuery.lastModified[s.url] = modRes;
+
+ // JSONP handles its own success callback
+ if ( !jsonp )
+ success();
+ } else
+ jQuery.handleError(s, xhr, status);
+
+ // Fire the complete handlers
+ complete();
+
+ if ( isTimeout )
+ xhr.abort();
+
+ // Stop memory leaks
+ if ( s.async )
+ xhr = null;
+ }
+ };
+
+ if ( s.async ) {
+ // don't attach the handler to the request, just poll it instead
+ var ival = setInterval(onreadystatechange, 13);
+
+ // Timeout checker
+ if ( s.timeout > 0 )
+ setTimeout(function(){
+ // Check to see if the request is still happening
+ if ( xhr && !requestDone )
+ onreadystatechange( "timeout" );
+ }, s.timeout);
+ }
+
+ // Send the data
+ try {
+ xhr.send(s.data);
+ } catch(e) {
+ jQuery.handleError(s, xhr, null, e);
+ }
+
+ // firefox 1.5 doesn't fire statechange for sync requests
+ if ( !s.async )
+ onreadystatechange();
+
+ function success(){
+ // If a local callback was specified, fire it and pass it the data
+ if ( s.success )
+ s.success( data, status );
+
+ // Fire the global callback
+ if ( s.global )
+ jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
+ }
+
+ function complete(){
+ // Process result
+ if ( s.complete )
+ s.complete(xhr, status);
+
+ // The request was completed
+ if ( s.global )
+ jQuery.event.trigger( "ajaxComplete", [xhr, s] );
+
+ // Handle the global AJAX counter
+ if ( s.global && ! --jQuery.active )
+ jQuery.event.trigger( "ajaxStop" );
+ }
+
+ // return XMLHttpRequest to allow aborting the request etc.
+ return xhr;
+ },
+
+ handleError: function( s, xhr, status, e ) {
+ // If a local callback was specified, fire it
+ if ( s.error ) s.error( xhr, status, e );
+
+ // Fire the global callback
+ if ( s.global )
+ jQuery.event.trigger( "ajaxError", [xhr, s, e] );
+ },
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Determines if an XMLHttpRequest was successful or not
+ httpSuccess: function( xhr ) {
+ try {
+ // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
+ return !xhr.status && location.protocol == "file:" ||
+ ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223;
+ } catch(e){}
+ return false;
+ },
+
+ // Determines if an XMLHttpRequest returns NotModified
+ httpNotModified: function( xhr, url ) {
+ try {
+ var xhrRes = xhr.getResponseHeader("Last-Modified");
+
+ // Firefox always returns 200. check Last-Modified date
+ return xhr.status == 304 || xhrRes == jQuery.lastModified[url];
+ } catch(e){}
+ return false;
+ },
+
+ httpData: function( xhr, type, s ) {
+ var ct = xhr.getResponseHeader("content-type"),
+ xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
+ data = xml ? xhr.responseXML : xhr.responseText;
+
+ if ( xml && data.documentElement.tagName == "parsererror" )
+ throw "parsererror";
+
+ // Allow a pre-filtering function to sanitize the response
+ // s != null is checked to keep backwards compatibility
+ if( s && s.dataFilter )
+ data = s.dataFilter( data, type );
+
+ // The filter can actually parse the response
+ if( typeof data === "string" ){
+
+ // If the type is "script", eval it in global context
+ if ( type == "script" )
+ jQuery.globalEval( data );
+
+ // Get the JavaScript object, if JSON is used.
+ if ( type == "json" )
+ data = window["eval"]("(" + data + ")");
+ }
+
+ return data;
+ },
+
+ // Serialize an array of form elements or a set of
+ // key/values into a query string
+ param: function( a ) {
+ var s = [ ];
+
+ function add( key, value ){
+ s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
+ };
+
+ // If an array was passed in, assume that it is an array
+ // of form elements
+ if ( jQuery.isArray(a) || a.jquery )
+ // Serialize the form elements
+ jQuery.each( a, function(){
+ add( this.name, this.value );
+ });
+
+ // Otherwise, assume that it's an object of key/value pairs
+ else
+ // Serialize the key/values
+ for ( var j in a )
+ // If the value is an array then the key names need to be repeated
+ if ( jQuery.isArray(a[j]) )
+ jQuery.each( a[j], function(){
+ add( j, this );
+ });
+ else
+ add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] );
+
+ // Return the resulting serialization
+ return s.join("&").replace(/%20/g, "+");
+ }
+
+});
+var elemdisplay = {},
+ timerId,
+ fxAttrs = [
+ // height animations
+ [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
+ // width animations
+ [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
+ // opacity animations
+ [ "opacity" ]
+ ];
+
+function genFx( type, num ){
+ var obj = {};
+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){
+ obj[ this ] = type;
+ });
+ return obj;
+}
+
+jQuery.fn.extend({
+ show: function(speed,callback){
+ if ( speed ) {
+ return this.animate( genFx("show", 3), speed, callback);
+ } else {
+ for ( var i = 0, l = this.length; i < l; i++ ){
+ var old = jQuery.data(this[i], "olddisplay");
+
+ this[i].style.display = old || "";
+
+ if ( jQuery.css(this[i], "display") === "none" ) {
+ var tagName = this[i].tagName, display;
+
+ if ( elemdisplay[ tagName ] ) {
+ display = elemdisplay[ tagName ];
+ } else {
+ var elem = jQuery("<" + tagName + " />").appendTo("body");
+
+ display = elem.css("display");
+ if ( display === "none" )
+ display = "block";
+
+ elem.remove();
+
+ elemdisplay[ tagName ] = display;
+ }
+
+ jQuery.data(this[i], "olddisplay", display);
+ }
+ }
+
+ // Set the display of the elements in a second loop
+ // to avoid the constant reflow
+ for ( var i = 0, l = this.length; i < l; i++ ){
+ this[i].style.display = jQuery.data(this[i], "olddisplay") || "";
+ }
+
+ return this;
+ }
+ },
+
+ hide: function(speed,callback){
+ if ( speed ) {
+ return this.animate( genFx("hide", 3), speed, callback);
+ } else {
+ for ( var i = 0, l = this.length; i < l; i++ ){
+ var old = jQuery.data(this[i], "olddisplay");
+ if ( !old && old !== "none" )
+ jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
+ }
+
+ // Set the display of the elements in a second loop
+ // to avoid the constant reflow
+ for ( var i = 0, l = this.length; i < l; i++ ){
+ this[i].style.display = "none";
+ }
+
+ return this;
+ }
+ },
+
+ // Save the old toggle function
+ _toggle: jQuery.fn.toggle,
+
+ toggle: function( fn, fn2 ){
+ var bool = typeof fn === "boolean";
+
+ return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
+ this._toggle.apply( this, arguments ) :
+ fn == null || bool ?
+ this.each(function(){
+ var state = bool ? fn : jQuery(this).is(":hidden");
+ jQuery(this)[ state ? "show" : "hide" ]();
+ }) :
+ this.animate(genFx("toggle", 3), fn, fn2);
+ },
+
+ fadeTo: function(speed,to,callback){
+ return this.animate({opacity: to}, speed, callback);
+ },
+
+ animate: function( prop, speed, easing, callback ) {
+ var optall = jQuery.speed(speed, easing, callback);
+
+ return this[ optall.queue === false ? "each" : "queue" ](function(){
+
+ var opt = jQuery.extend({}, optall), p,
+ hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
+ self = this;
+
+ for ( p in prop ) {
+ if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
+ return opt.complete.call(this);
+
+ if ( ( p == "height" || p == "width" ) && this.style ) {
+ // Store display property
+ opt.display = jQuery.css(this, "display");
+
+ // Make sure that nothing sneaks out
+ opt.overflow = this.style.overflow;
+ }
+ }
+
+ if ( opt.overflow != null )
+ this.style.overflow = "hidden";
+
+ opt.curAnim = jQuery.extend({}, prop);
+
+ jQuery.each( prop, function(name, val){
+ var e = new jQuery.fx( self, opt, name );
+
+ if ( /toggle|show|hide/.test(val) )
+ e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
+ else {
+ var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
+ start = e.cur(true) || 0;
+
+ if ( parts ) {
+ var end = parseFloat(parts[2]),
+ unit = parts[3] || "px";
+
+ // We need to compute starting value
+ if ( unit != "px" ) {
+ self.style[ name ] = (end || 1) + unit;
+ start = ((end || 1) / e.cur(true)) * start;
+ self.style[ name ] = start + unit;
+ }
+
+ // If a +=/-= token was provided, we're doing a relative animation
+ if ( parts[1] )
+ end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
+
+ e.custom( start, end, unit );
+ } else
+ e.custom( start, val, "" );
+ }
+ });
+
+ // For JS strict compliance
+ return true;
+ });
+ },
+
+ stop: function(clearQueue, gotoEnd){
+ var timers = jQuery.timers;
+
+ if (clearQueue)
+ this.queue([]);
+
+ this.each(function(){
+ // go in reverse order so anything added to the queue during the loop is ignored
+ for ( var i = timers.length - 1; i >= 0; i-- )
+ if ( timers[i].elem == this ) {
+ if (gotoEnd)
+ // force the next step to be the last
+ timers[i](true);
+ timers.splice(i, 1);
+ }
+ });
+
+ // start the next in the queue if the last step wasn't forced
+ if (!gotoEnd)
+ this.dequeue();
+
+ return this;
+ }
+
+});
+
+// Generate shortcuts for custom animations
+jQuery.each({
+ slideDown: genFx("show", 1),
+ slideUp: genFx("hide", 1),
+ slideToggle: genFx("toggle", 1),
+ fadeIn: { opacity: "show" },
+ fadeOut: { opacity: "hide" }
+}, function( name, props ){
+ jQuery.fn[ name ] = function( speed, callback ){
+ return this.animate( props, speed, callback );
+ };
+});
+
+jQuery.extend({
+
+ speed: function(speed, easing, fn) {
+ var opt = typeof speed === "object" ? speed : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
+ };
+
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+ jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
+
+ // Queueing
+ opt.old = opt.complete;
+ opt.complete = function(){
+ if ( opt.queue !== false )
+ jQuery(this).dequeue();
+ if ( jQuery.isFunction( opt.old ) )
+ opt.old.call( this );
+ };
+
+ return opt;
+ },
+
+ easing: {
+ linear: function( p, n, firstNum, diff ) {
+ return firstNum + diff * p;
+ },
+ swing: function( p, n, firstNum, diff ) {
+ return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
+ }
+ },
+
+ timers: [],
+
+ fx: function( elem, options, prop ){
+ this.options = options;
+ this.elem = elem;
+ this.prop = prop;
+
+ if ( !options.orig )
+ options.orig = {};
+ }
+
+});
+
+jQuery.fx.prototype = {
+
+ // Simple function for setting a style value
+ update: function(){
+ if ( this.options.step )
+ this.options.step.call( this.elem, this.now, this );
+
+ (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
+
+ // Set display property to block for height/width animations
+ if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style )
+ this.elem.style.display = "block";
+ },
+
+ // Get the current size
+ cur: function(force){
+ if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) )
+ return this.elem[ this.prop ];
+
+ var r = parseFloat(jQuery.css(this.elem, this.prop, force));
+ return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
+ },
+
+ // Start an animation from one number to another
+ custom: function(from, to, unit){
+ this.startTime = now();
+ this.start = from;
+ this.end = to;
+ this.unit = unit || this.unit || "px";
+ this.now = this.start;
+ this.pos = this.state = 0;
+
+ var self = this;
+ function t(gotoEnd){
+ return self.step(gotoEnd);
+ }
+
+ t.elem = this.elem;
+
+ if ( t() && jQuery.timers.push(t) && !timerId ) {
+ timerId = setInterval(function(){
+ var timers = jQuery.timers;
+
+ for ( var i = 0; i < timers.length; i++ )
+ if ( !timers[i]() )
+ timers.splice(i--, 1);
+
+ if ( !timers.length ) {
+ clearInterval( timerId );
+ timerId = undefined;
+ }
+ }, 13);
+ }
+ },
+
+ // Simple 'show' function
+ show: function(){
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+ this.options.show = true;
+
+ // Begin the animation
+ // Make sure that we start at a small width/height to avoid any
+ // flash of content
+ this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());
+
+ // Start by showing the element
+ jQuery(this.elem).show();
+ },
+
+ // Simple 'hide' function
+ hide: function(){
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+ this.options.hide = true;
+
+ // Begin the animation
+ this.custom(this.cur(), 0);
+ },
+
+ // Each step of an animation
+ step: function(gotoEnd){
+ var t = now();
+
+ if ( gotoEnd || t >= this.options.duration + this.startTime ) {
+ this.now = this.end;
+ this.pos = this.state = 1;
+ this.update();
+
+ this.options.curAnim[ this.prop ] = true;
+
+ var done = true;
+ for ( var i in this.options.curAnim )
+ if ( this.options.curAnim[i] !== true )
+ done = false;
+
+ if ( done ) {
+ if ( this.options.display != null ) {
+ // Reset the overflow
+ this.elem.style.overflow = this.options.overflow;
+
+ // Reset the display
+ this.elem.style.display = this.options.display;
+ if ( jQuery.css(this.elem, "display") == "none" )
+ this.elem.style.display = "block";
+ }
+
+ // Hide the element if the "hide" operation was done
+ if ( this.options.hide )
+ jQuery(this.elem).hide();
+
+ // Reset the properties, if the item has been hidden or shown
+ if ( this.options.hide || this.options.show )
+ for ( var p in this.options.curAnim )
+ jQuery.attr(this.elem.style, p, this.options.orig[p]);
+
+ // Execute the complete function
+ this.options.complete.call( this.elem );
+ }
+
+ return false;
+ } else {
+ var n = t - this.startTime;
+ this.state = n / this.options.duration;
+
+ // Perform the easing function, defaults to swing
+ this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
+ this.now = this.start + ((this.end - this.start) * this.pos);
+
+ // Perform the next step of the animation
+ this.update();
+ }
+
+ return true;
+ }
+
+};
+
+jQuery.extend( jQuery.fx, {
+ speeds:{
+ slow: 600,
+ fast: 200,
+ // Default speed
+ _default: 400
+ },
+ step: {
+
+ opacity: function(fx){
+ jQuery.attr(fx.elem.style, "opacity", fx.now);
+ },
+
+ _default: function(fx){
+ if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
+ fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+ else
+ fx.elem[ fx.prop ] = fx.now;
+ }
+ }
+});
+if ( document.documentElement["getBoundingClientRect"] )
+ jQuery.fn.offset = function() {
+ if ( !this[0] ) return { top: 0, left: 0 };
+ if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
+ var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
+ clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
+ top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
+ left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
+ return { top: top, left: left };
+ };
+else
+ jQuery.fn.offset = function() {
+ if ( !this[0] ) return { top: 0, left: 0 };
+ if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
+ jQuery.offset.initialized || jQuery.offset.initialize();
+
+ var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,
+ doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
+ body = doc.body, defaultView = doc.defaultView,
+ prevComputedStyle = defaultView.getComputedStyle(elem, null),
+ top = elem.offsetTop, left = elem.offsetLeft;
+
+ while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
+ computedStyle = defaultView.getComputedStyle(elem, null);
+ top -= elem.scrollTop, left -= elem.scrollLeft;
+ if ( elem === offsetParent ) {
+ top += elem.offsetTop, left += elem.offsetLeft;
+ if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) )
+ top += parseInt( computedStyle.borderTopWidth, 10) || 0,
+ left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
+ prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
+ }
+ if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" )
+ top += parseInt( computedStyle.borderTopWidth, 10) || 0,
+ left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
+ prevComputedStyle = computedStyle;
+ }
+
+ if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" )
+ top += body.offsetTop,
+ left += body.offsetLeft;
+
+ if ( prevComputedStyle.position === "fixed" )
+ top += Math.max(docElem.scrollTop, body.scrollTop),
+ left += Math.max(docElem.scrollLeft, body.scrollLeft);
+
+ return { top: top, left: left };
+ };
+
+jQuery.offset = {
+ initialize: function() {
+ if ( this.initialized ) return;
+ var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
+ html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
+
+ rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };
+ for ( prop in rules ) container.style[prop] = rules[prop];
+
+ container.innerHTML = html;
+ body.insertBefore(container, body.firstChild);
+ innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild;
+
+ this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
+ this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
+
+ innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
+ this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
+
+ body.style.marginTop = '1px';
+ this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
+ body.style.marginTop = bodyMarginTop;
+
+ body.removeChild(container);
+ this.initialized = true;
+ },
+
+ bodyOffset: function(body) {
+ jQuery.offset.initialized || jQuery.offset.initialize();
+ var top = body.offsetTop, left = body.offsetLeft;
+ if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )
+ top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0,
+ left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;
+ return { top: top, left: left };
+ }
+};
+
+
+jQuery.fn.extend({
+ position: function() {
+ var left = 0, top = 0, results;
+
+ if ( this[0] ) {
+ // Get *real* offsetParent
+ var offsetParent = this.offsetParent(),
+
+ // Get correct offsets
+ offset = this.offset(),
+ parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
+
+ // Subtract element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ offset.top -= num( this, 'marginTop' );
+ offset.left -= num( this, 'marginLeft' );
+
+ // Add offsetParent borders
+ parentOffset.top += num( offsetParent, 'borderTopWidth' );
+ parentOffset.left += num( offsetParent, 'borderLeftWidth' );
+
+ // Subtract the two offsets
+ results = {
+ top: offset.top - parentOffset.top,
+ left: offset.left - parentOffset.left
+ };
+ }
+
+ return results;
+ },
+
+ offsetParent: function() {
+ var offsetParent = this[0].offsetParent || document.body;
+ while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
+ offsetParent = offsetParent.offsetParent;
+ return jQuery(offsetParent);
+ }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( ['Left', 'Top'], function(i, name) {
+ var method = 'scroll' + name;
+
+ jQuery.fn[ method ] = function(val) {
+ if (!this[0]) return null;
+
+ return val !== undefined ?
+
+ // Set the scroll offset
+ this.each(function() {
+ this == window || this == document ?
+ window.scrollTo(
+ !i ? val : jQuery(window).scrollLeft(),
+ i ? val : jQuery(window).scrollTop()
+ ) :
+ this[ method ] = val;
+ }) :
+
+ // Return the scroll offset
+ this[0] == window || this[0] == document ?
+ self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
+ jQuery.boxModel && document.documentElement[ method ] ||
+ document.body[ method ] :
+ this[0][ method ];
+ };
+});
+// Create innerHeight, innerWidth, outerHeight and outerWidth methods
+jQuery.each([ "Height", "Width" ], function(i, name){
+
+ var tl = i ? "Left" : "Top", // top or left
+ br = i ? "Right" : "Bottom", // bottom or right
+ lower = name.toLowerCase();
+
+ // innerHeight and innerWidth
+ jQuery.fn["inner" + name] = function(){
+ return this[0] ?
+ jQuery.css( this[0], lower, false, "padding" ) :
+ null;
+ };
+
+ // outerHeight and outerWidth
+ jQuery.fn["outer" + name] = function(margin) {
+ return this[0] ?
+ jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) :
+ null;
+ };
+
+ var type = name.toLowerCase();
+
+ jQuery.fn[ type ] = function( size ) {
+ // Get window width or height
+ return this[0] == window ?
+ // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
+ document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] ||
+ document.body[ "client" + name ] :
+
+ // Get document width or height
+ this[0] == document ?
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+ Math.max(
+ document.documentElement["client" + name],
+ document.body["scroll" + name], document.documentElement["scroll" + name],
+ document.body["offset" + name], document.documentElement["offset" + name]
+ ) :
+
+ // Get or set width or height on the element
+ size === undefined ?
+ // Get width or height on the element
+ (this.length ? jQuery.css( this[0], type ) : null) :
+
+ // Set the width or height on the element (default to pixels if value is unitless)
+ this.css( type, typeof size === "string" ? size : size + "px" );
+ };
+
+});
+})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/jquery.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/jquery.min.js
new file mode 100644
index 00000000..7c243080
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/jquery.min.js
@@ -0,0 +1,154 @@
+/*!
+ * jQuery JavaScript Library v1.4.2
+ * http://jquery.com/
+ *
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2010, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Sat Feb 13 22:33:48 2010 -0500
+ */
+(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
+e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
+j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
+"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
+true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
+Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
+(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
+a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
+"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
+function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
+c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
+L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
+"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
+d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
+a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
+!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
+true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
+parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
+false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
+s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
+applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
+else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
+a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
+w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
+cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
+i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
+" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
+this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
+e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
+c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
+a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
+function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
+k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
+C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
+null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
+e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
+f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
+if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
+d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
+"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
+a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
+isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
+{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
+if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
+e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
+"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
+d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
+!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
+toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
+u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
+function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
+if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
+t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
+g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
+for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
+1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
+CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
+relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
+l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
+h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
+CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
+g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
+text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
+setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
+h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
+m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
+"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
+h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
+!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
+h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
+q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
+if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
+(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
+function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
+gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
+c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
+{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
+"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
+d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
+a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
+1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
+a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
+c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
+wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
+prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
+this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
+return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
+""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
+this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
+u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
+1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
+return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
+""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
+c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
+c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
+function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
+Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
+"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
+a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
+a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
+"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
+serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
+function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
+global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
+e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
+"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
+false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
+false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
+c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
+d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
+g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
+1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
+"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
+if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
+this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
+"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
+animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
+j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
+this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
+"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
+c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
+this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
+this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
+e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
+c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
+function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
+this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
+k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
+f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
+a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
+c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
+d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
+f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
+"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
+e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/label_quantum.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/label_quantum.js
new file mode 100644
index 00000000..6e07cbc1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/label_quantum.js
@@ -0,0 +1,5 @@
+zk.afterLoad("zul.wgt", function () {
+ zul.wgt.Label.prototype.getEncodedText = function() {
+ return zUtl.encodeXML(this._value, {multiline:this._multiline,pre:this._pre, maxlength: this._maxlength}).replace(/_nl_/g, "<br />");
+ }
+}); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/nova_button.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/nova_button.js
new file mode 100644
index 00000000..75dc28a1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/nova_button.js
@@ -0,0 +1,1184 @@
+function NovaButton() {
+
+}
+
+NovaButton.prototype = new GControl();
+
+NovaButton.globals = {
+ currentButton: null,
+ layerOptionContainer: null,
+ layerOptionVisible: false,
+ searchOptionContainer: null,
+ searchOptionVisible: false,
+ //new changes
+ searchResultContainer: null,
+ //new changes
+ searchTabSelected: null,
+ map: null,
+ originalLayerState: null
+};
+
+NovaButton.globals.dragzoom = {
+ cornerTopDiv: null,
+ cornerRightDiv: null,
+ cornerBottomDiv: null,
+ cornerLeftDiv: null,
+ mapPosition: null,
+ outlineDiv: null,
+ mapWidth: 0,
+ mapHeight: 0,
+ mapRatio: 0,
+ startX: 0,
+ startY: 0,
+ zoomArea: null,
+ moving: false
+};
+
+// Creates a one DIV for each of the buttons and places them in a container
+// DIV which is returned as our control element.
+NovaButton.prototype.initialize = function(map) {
+ var container = document.createElement("div");
+ container.style.zIndex = "150";
+ var that = this;
+
+ // "Cursor" button
+ var cursorDiv = document.createElement("div");
+ cursorDiv.id = "cursorDiv";
+ NovaButton.globals.currentButton = "cursorDiv";
+ this.setButtonStyle(cursorDiv, true);
+ cursorDiv.style.fontWeight = "bold";
+ cursorDiv.appendChild(document.createTextNode("Cursor"));
+ GEvent.addDomListener(cursorDiv, "click", function() {
+ var globals = NovaButton.globals;
+ if (globals.currentButton == "cursorDiv") {
+ return;
+ }
+
+ this.style.fontWeight = "bold";
+ globals.currentButton = "cursorDiv";
+ if (!map.draggingEnabled()) {
+ map.enableDragging();
+ }
+ document.getElementById("detailDiv").style.fontWeight = "normal";
+ document.getElementById("zoomRectangleDiv").style.fontWeight = "normal";
+
+ that.resetDragZoom();
+ });
+
+ // "detail" button
+ var detailDiv = document.createElement("div");
+ detailDiv.id = "detailDiv";
+ this.setButtonStyle(detailDiv, true);
+ detailDiv.appendChild(document.createTextNode("Detail"));
+ GEvent.addDomListener(detailDiv, "click", function() {
+ var globals = NovaButton.globals;
+ if (globals.currentButton == "detailDiv") {
+ return;
+ }
+
+ this.style.fontWeight = "bold";
+ globals.currentButton = "detailDiv";
+ if (map.draggingEnabled()) {
+ map.disableDragging();
+ }
+ document.getElementById("cursorDiv").style.fontWeight = "normal";
+ document.getElementById("zoomRectangleDiv").style.fontWeight = "normal";
+
+ that.resetDragZoom();
+ });
+
+ // zoom rectangle button
+ var zoomRectangleDiv = document.createElement("div");
+ zoomRectangleDiv.id = "zoomRectangleDiv";
+ this.setButtonStyle(zoomRectangleDiv, true);
+ zoomRectangleDiv.appendChild(document.createTextNode("Zoom Rect."));
+ GEvent.addDomListener(zoomRectangleDiv, "click", function() {
+ var globals = NovaButton.globals;
+ if (globals.currentButton == "zoomRectangleDiv") {
+ return;
+ }
+
+ this.style.fontWeight = "bold";
+ globals.currentButton = "zoomRectangleDiv";
+
+ if (map.draggingEnabled()) {
+ map.disableDragging();
+ }
+ document.getElementById("cursorDiv").style.fontWeight = "normal";
+ document.getElementById("detailDiv").style.fontWeight = "normal";
+
+ that.initCover();
+ });
+
+ // "Zoom In" button
+ var zoomInDiv = document.createElement("div");
+ this.setButtonStyle(zoomInDiv, true);
+ zoomInDiv.appendChild(document.createTextNode("Zoom In"));
+ // The "true" argument in the zoomIn() method allows continuous zooming
+ GEvent.addDomListener(zoomInDiv, "click", function() {
+ //map.zoomIn(null,null,true);
+ map.zoomIn();
+ });
+
+ // "Zoom Out" button
+ var zoomOutDiv = document.createElement("div");
+ this.setButtonStyle(zoomOutDiv, true);
+ zoomOutDiv.style.borderTop = 0+'px';
+ zoomOutDiv.appendChild(document.createTextNode("Zoom Out"));
+ // The "true" argument in the zoomOut() method allows continuous zooming
+ GEvent.addDomListener(zoomOutDiv, "click", function() {
+ //map.zoomOut(null,true);
+ map.zoomOut();
+ });
+
+ // "Default View" button
+ var defaultViewDiv = document.createElement("div");
+ this.setButtonStyle(defaultViewDiv, true);
+ defaultViewDiv.appendChild(document.createTextNode("Default View"));
+ GEvent.addDomListener(defaultViewDiv, "click", function(e) {
+ that.defaultViewClickEvent();
+ });
+
+ // "layer" button
+ var showLayerDiv = document.createElement("div");
+ this.setButtonStyle(showLayerDiv, true);
+ showLayerDiv.appendChild(document.createTextNode("Layers"));
+ GEvent.addDomListener(showLayerDiv, "click", function(e) {
+ that.showLayerClickEvent(e);
+ });
+
+ // initialize layer option
+ var layerOptionContainer = document.createElement("div");
+ this.setMenuContainerStyle(layerOptionContainer);
+ this.initializeLayerDiv(layerOptionContainer);
+
+ // "search" button
+ var searchDiv = document.createElement("div");
+ this.setButtonStyle(searchDiv, true);
+ searchDiv.appendChild(document.createTextNode("Search"));
+ GEvent.addDomListener(searchDiv, "click", function(e) {
+ that.searchClickEvent(e);
+ });
+
+ var searchOptionContainer = document.createElement("div");
+ searchOptionContainer.style.position = "absolute";
+ searchOptionContainer.style.left = "100px";
+ searchOptionContainer.style.top = "100px";
+ searchOptionContainer.style.display = "none";
+ this.initializeSearchDiv(searchOptionContainer);
+
+ var buttonContainer = document.createElement("div");
+ buttonContainer.appendChild(cursorDiv);
+ buttonContainer.appendChild(detailDiv);
+ //buttonContainer.appendChild(zoomRectangleDiv);
+ //buttonContainer.appendChild(zoomInDiv);
+ //buttonContainer.appendChild(zoomOutDiv);
+ //buttonContainer.appendChild(defaultViewDiv);
+ //buttonContainer.appendChild(showLayerDiv);
+ //buttonContainer.appendChild(searchDiv);
+
+ // zoom area div
+ var zoomAreaDiv = document.createElement("div");
+ this.setZoomAreaStyle(zoomAreaDiv);
+ var DIVS_TO_CREATE = ['outlineDiv', 'cornerTopDiv', 'cornerLeftDiv', 'cornerRightDiv', 'cornerBottomDiv'];
+ for (var i=0; i<DIVS_TO_CREATE.length; i++) {
+ var id = DIVS_TO_CREATE[i];
+ var div = document.createElement("div");
+ div.style.position = "absolute";
+ div.style.display = "none";
+ zoomAreaDiv.appendChild(div);
+ NovaButton.globals.dragzoom[id] = div;
+ }
+
+ GEvent.addDomListener(zoomAreaDiv, 'mousedown', function(e) {
+ that.mouseDown(e);
+ });
+ GEvent.addDomListener(document, 'mousemove', function(e) {
+ that.mouseMove(e);
+ });
+ GEvent.addDomListener(document, 'mouseup', function(e) {
+ that.mouseUp(e);
+ });
+
+ // assign global variable
+ NovaButton.globals.layerOptionContainer = layerOptionContainer;
+ NovaButton.globals.map = map;
+ NovaButton.globals.dragzoom.zoomArea = zoomAreaDiv;
+ NovaButton.globals.dragzoom.mapPosition = NovaButtonUtils.getElementPosition(map.getContainer());
+ NovaButton.globals.searchOptionContainer = searchOptionContainer;
+ this.setDimensions();
+
+ zoomAreaDiv.onselectstart = function() {return false;};
+
+ //styles
+ this.initZoomAreaStyles();
+
+ container.appendChild(buttonContainer);
+ map.getContainer().appendChild(container);
+ //map.getContainer().appendChild(layerOptionContainer);
+ //map.getContainer().appendChild(searchOptionContainer);
+ document.body.appendChild(layerOptionContainer);
+ document.body.appendChild(searchOptionContainer);
+ map.getContainer().appendChild(zoomAreaDiv);
+
+ return container;
+}
+
+// The control will appear in the top left corner of the map with 5 pixels of padding.
+NovaButton.prototype.getDefaultPosition = function() {
+ return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(70, 5));
+}
+
+NovaButton.prototype.setSearchResultStyle = function(container) {
+ container.style.width = "300px";
+ container.style.height = "150px";
+ container.style.background = "#FFFFF0";
+ container.style.fontFamily = "Verdana";
+ container.style.fontSize = "12px";
+ container.style.position = "absolute";
+ container.style.border = "1px solid black";
+ container.style.top = "201px";
+ container.style.left = "0px";
+ container.style.display = "none";
+ container.style.overflow = "auto";
+ container.align = "left";
+}
+
+// Sets the proper CSS for the given button element.
+NovaButton.prototype.setButtonStyle = function(button, horizontalAlign) {
+ button.style.color = "black";
+ button.style.backgroundColor = "white";
+ button.style.fontFamily = "Verdana";
+ button.style.fontSize = "12px";
+ button.style.fontWeight= "normal";
+ button.style.border = "1px solid gray";
+ button.style.padding = "0px";
+ button.style.marginBottom = "0px";
+ button.style.textAlign = "center";
+ button.style.width = "80px";
+ button.style.height = "15px";
+ button.style.cursor = "pointer";
+ //button.style.zIndex = "200";
+
+ if (horizontalAlign) {
+ if(button.addEventListener) {
+ button.style.cssFloat = "left" ;
+ }
+ else {
+ button.style.styleFloat = "left" ;
+ }
+ }
+}
+
+NovaButton.prototype.setTabHeaderStyle = function(header) {
+ //header.style.position = "absolute";
+ //header.style.zIndex = "2";
+ header.align = "left";
+}
+
+NovaButton.prototype.setTabButtonStyle = function(tab) {
+ tab.style.padding = "3px 5px 3px 5px";
+ tab.style.fontFamily = "Verdana";
+ tab.style.fontSize = "12px";
+ tab.style.textAlign = "center";
+ tab.style.width = "7em";
+ tab.style.height = "15px";
+ tab.style.cursor = "pointer";
+ tab.style.background = "#C6DEFF";
+
+ if(tab.addEventListener) {
+ tab.style.cssFloat = "left" ;
+ }
+ else {
+ tab.style.styleFloat = "left" ;
+ }
+}
+
+NovaButton.prototype.setTabBodyStyle = function(body) {
+ body.style.width = "400px";
+ body.style.height = "150px";
+ body.style.background = "#FFFFF0";
+ body.style.fontFamily = "Verdana";
+ body.style.fontSize = "12px";
+ //body.style.zIndex = "1";
+ body.style.padding = "3px 5px 3px 5px";
+ body.style.top = "20px";
+ body.style.left = "0px";
+ body.style.position = "absolute";
+ body.style.display = "none";
+ body.align = "left";
+}
+
+NovaButton.prototype.setTabFooterStyle = function(footer) {
+ footer.style.width = "400px";
+ footer.style.height = "20px";
+ footer.align = "center";
+ footer.style.padding = "3px 5px 3px 5px";
+ footer.style.background = "#FFFFF0";
+ footer.style.position = "absolute";
+ footer.style.top = "175px";
+ footer.style.left = "0";
+}
+
+NovaButton.prototype.tabMouseOver = function(e) {
+ var tab = Event.element(e);
+ tab.style.background = "#ADDFFF";
+}
+
+NovaButton.prototype.tabMouseOut = function(e) {
+ var tab = Event.element(e);
+ tab.style.background = "#C6DEFF";
+}
+
+NovaButton.prototype.tabClickEvent = function(e) {
+ var tab = Event.element(e);
+
+ if (tab.id == NovaButton.globals.searchTabSelected) {
+ return false;
+ }
+
+ NovaButton.globals.searchTabSelected = tab.id;
+ tab.style.fontWeight = "bold";
+
+ if (tab.id == "nodeTab") {
+ document.getElementById("nodeBody").style.display = "inline";
+ document.getElementById("addressBody").style.display = "none";
+ document.getElementById("addressTab").style.fontWeight = "normal";
+ }
+ else {
+ document.getElementById("addressBody").style.display = "inline";
+ document.getElementById("nodeBody").style.display = "none";
+ document.getElementById("nodeTab").style.fontWeight = "normal";
+ }
+}
+
+NovaButton.prototype.initializeSearchDiv = function(searchOptionContainer) {
+ var header = document.createElement("div");
+ this.setTabHeaderStyle(header);
+ var that = this;
+
+ var nodeTab = header.appendChild(document.createElement("div"));
+ nodeTab.id = "nodeTab";
+ this.setTabButtonStyle(nodeTab);
+ nodeTab.appendChild(document.createTextNode("Node"));
+ GEvent.addDomListener(nodeTab, "mouseover", function(e) {
+ that.tabMouseOver(e);
+ });
+ GEvent.addDomListener(nodeTab, "mouseout", function(e) {
+ that.tabMouseOut(e);
+ });
+ GEvent.addDomListener(nodeTab, "click", function(e) {
+ that.tabClickEvent(e);
+ });
+
+ var addressTab = header.appendChild(document.createElement("div"));
+ addressTab.id = "addressTab";
+ this.setTabButtonStyle(addressTab);
+ addressTab.appendChild(document.createTextNode("Address"));
+ GEvent.addDomListener(addressTab, "mouseover", function(e) {
+ that.tabMouseOver(e);
+ });
+ GEvent.addDomListener(addressTab, "mouseout", function(e) {
+ that.tabMouseOut(e);
+ });
+ GEvent.addDomListener(addressTab, "click", function(e) {
+ that.tabClickEvent(e);
+ });
+
+ var body = document.createElement("div");
+ var nodeBody = body.appendChild(document.createElement("div"));
+ nodeBody.id = "nodeBody";
+ this.setTabBodyStyle(nodeBody);
+ this.initializeNodeBody(nodeBody);
+
+ var addressBody = body.appendChild(document.createElement("div"));
+ addressBody.id = "addressBody";
+ this.setTabBodyStyle(addressBody);
+ this.initializeAddressBody(addressBody);
+
+ //new changes
+ var searchResultContainer = body.appendChild(document.createElement("div"));
+ searchResultContainer.style.opacity = "0.8";
+ searchResultContainer.style.filter = 'alpha(opacity=' + (0.6 * 100) + ')';
+ this.setSearchResultStyle(searchResultContainer);
+ //new changes
+
+ var footer = document.createElement("div");
+ this.setTabFooterStyle(footer);
+ var buttonDiv = footer.appendChild(document.createElement("div"));
+ this.setButtonStyle(buttonDiv, false);
+ buttonDiv.appendChild(document.createTextNode("Submit"));
+ GEvent.addDomListener(buttonDiv, "click", function(e) {
+ that.submitSearchClickEvent(e);
+ });
+
+ searchOptionContainer.appendChild(header);
+ searchOptionContainer.appendChild(body);
+ searchOptionContainer.appendChild(footer);
+ //searchOptionContainer.appendChild(nodeBody);
+ //searchOptionContainer.appendChild(addressBody);
+
+ // default tab
+ nodeTab.style.fontWeight = "bold";
+ nodeBody.style.display = "inline";
+ NovaButton.globals.searchTabSelected = "nodeTab";
+ //new changes
+ NovaButton.globals.searchResultContainer = searchResultContainer;
+ //new chjanges
+}
+
+NovaButton.prototype.initializeNodeBody = function(nodeBody) {
+ var searchByNodeId = document.createElement("input");
+ searchByNodeId.type = "radio";
+ searchByNodeId.defaultChecked = true;
+ searchByNodeId.name = "nodeGroup";
+ searchByNodeId.id = "searchByNodeId";
+ searchByNodeId.value = "searchByNodeId";
+ searchByNodeId.onclick = function () {
+ searchByLocation.checked = false;
+ searchByNodeId.checked = true;
+ };
+ nodeBody.appendChild(searchByNodeId);
+ nodeBody.appendChild(document.createTextNode("Node ID"));
+ nodeBody.appendChild(document.createElement("br"));
+
+ var searchByLocation = document.createElement("input");
+ searchByLocation.type = "radio";
+ searchByLocation.defaultChecked = false;
+ searchByLocation.name = "nodeGroup";
+ searchByLocation.id = "searchByLocation";
+ searchByLocation.value = "searchByLocation";
+ // ie bug
+ searchByLocation.onclick = function () {
+ searchByLocation.checked = true;
+ searchByNodeId.checked = false;
+ };
+ nodeBody.appendChild(searchByLocation);
+ nodeBody.appendChild(document.createTextNode("Node Location"));
+ nodeBody.appendChild(document.createElement("br"));
+ nodeBody.appendChild(document.createElement("br"));
+
+ var exactMatchSearch = document.createElement("input");
+ exactMatchSearch.type = "checkbox";
+ exactMatchSearch.id = "exactMatch";
+ nodeBody.appendChild(exactMatchSearch);
+ nodeBody.appendChild(document.createTextNode("Exact Match"));
+ nodeBody.appendChild(document.createElement("br"));
+
+ var searchInput = document.createElement("input");
+ searchInput.id = "nodeSearchInput";
+ searchInput.setAttribute("type", "text");
+ searchInput.setAttribute("size", "60");
+
+ nodeBody.appendChild(searchInput);
+}
+
+NovaButton.prototype.initializeAddressBody = function(addressBody) {
+ var addressLabel = addressBody.appendChild(document.createElement("div"));
+ addressLabel.appendChild(document.createTextNode("Enter address (e.g. 180 park ave, florham park, nj 07932)"));
+
+ var searchInput = document.createElement("input");
+ searchInput.id = "addressSearchInput";
+ searchInput.setAttribute("type", "text");
+ searchInput.setAttribute("size", "60");
+
+ addressBody.appendChild(searchInput);
+}
+
+//new changes start
+NovaButton.prototype.setSearchResult = function(jsonData) {
+ var resultContainer = NovaButton.globals.searchResultContainer;
+ for (var i = resultContainer.childNodes.length - 1; i >= 0; i--) {
+ resultContainer.removeChild(resultContainer.lastChild);
+ }
+
+ var table = resultContainer.appendChild(document.createElement("table"));
+ var tbody = table.appendChild(document.createElement("tbody"));
+ var list = jsonData.list;
+
+ if (list == null) {
+ var tr = tbody.appendChild(document.createElement("tr"));
+ var td = tr.appendChild(document.createElement("td"));
+ td.appendChild(document.createTextNode("Not Found"));
+ td.style.fontSize = "12px";
+ td.style.textDecoration = "none";
+ td.font = "Arial,Helvetica,sans-serif";
+ td.style.fontWeight = "normal";
+ }
+ else {
+ for (var i = 0; i < list.length; i++) {
+ var tr = tbody.appendChild(document.createElement("tr"));
+ var td = tr.appendChild(document.createElement("td"));
+
+ td.appendChild(document.createTextNode(list[i].type + "(" + list[i].numberOfT1 +
+ "): " + list[i].id));
+ td.style.fontSize = "12px";
+ td.style.textDecoration = "underline";
+ td.style.color = "blue";
+ td.style.fontWeight = "normal";
+ td.style.cursor = "pointer";
+ td.font = "Arial,Helvetica,sans-serif";
+ td.id = list[i].latitude + ">>" + list[i].longitude;
+
+ td.onmouseover = function() {
+ this.style.fontWeight = "bold";
+ }
+
+ td.onmouseout = function() {
+ this.style.fontWeight = "normal";
+ }
+
+ td.onclick = function() {
+ this.style.color = "red";
+ var latitudeLongitude = this.id.split(">>");
+ var latlng = new GLatLng(latitudeLongitude[0], latitudeLongitude[1]);
+ map.setCenter(latlng, 17);
+ updateImage(0);
+ }
+ }
+ }
+
+ resultContainer.style.display = "";
+}
+//new changes end
+NovaButton.prototype.initializeLayerDiv = function(layerDiv) {
+ for (var i = layerDiv.childNodes.length - 1; i >= 0; i--) {
+ layerDiv.removeChild(layerDiv.lastChild);
+ }
+
+ var colorList = document.getElementById("colorList").value;
+ var selectedLayerList = document.getElementById("selectedLayerList").value;
+ var colorArray = colorList.split("~!");
+ var selectedColorArray = selectedLayerList.split("~!");
+ //layerDiv.style.background = "white";
+ var table = layerDiv.appendChild(document.createElement("table"));
+ table.width="100%";
+ table.height="100%";
+ //this.setMenuStyle(table);
+ /****Creating the data table****/
+ var tbody = table.appendChild(document.createElement("tbody"));
+ var tr;
+ var td;
+ var originalLayerState = new Array();
+ for (i = 0; i < colorArray.length; i++) {
+ tr = tbody.appendChild(document.createElement("tr"));
+ tr.style.height="20px";
+ var colorItem = colorArray[i].split(",");
+
+ td = tr.appendChild(document.createElement("td"));
+ var chkbox = document.createElement("input");
+ chkbox.type="checkbox";
+ chkbox.name = "" + colorItem[0] + "chk";
+ chkbox.value = colorItem[0];
+ chkbox.id = colorItem[0] + "chk";
+ if (this.checkIfColorSelected(selectedColorArray, colorItem[0]) == true){
+ chkbox.defaultChecked=true;
+ originalLayerState[i] = "true," + colorArray[i];
+ }
+ else {
+ originalLayerState[i] = "false," + colorArray[i];
+ }
+ td.appendChild(chkbox);
+
+ td = tr.appendChild(document.createElement("td"));
+ td.width="75%";
+ td.appendChild(document.createTextNode(colorItem[0]));
+ td.style.fontFamily = "Verdana";
+ td.style.fontSize = "12px";
+
+ td = tr.appendChild(document.createElement("td"));
+ td.width="10%";
+ //td.style.background = colorItem[1];
+ td.innerHTML="<input type='text' id='" + colorItem[0] + "colorbx' value='" + colorItem[1] + "' size='6' style='background-color:#" + colorItem[1] + "' background-color='#" + colorItem[1] + "' onclick='openPicker(\"" + colorItem[0] + "colorbx\")'/>"
+ tbody.appendChild(tr);
+ }
+
+ NovaButton.globals.originalLayerState = originalLayerState;
+
+ /**to get rid of extra space**/
+ /*var layerHeight = layerDiv.style.height.substring(0, layerDiv.style.height.length -2);
+ if (colorArray.length * 30 < layerHeight){
+ tr = tbody.appendChild(document.createElement("tr"));
+ tr.height= (layerHeight - (colorArray.length * 40 ) ) + "px";
+ td = tr.appendChild(document.createElement("td"));
+ }*/
+
+
+ tr = tbody.appendChild(document.createElement("tr"));
+ tr.vAlign="bottom";
+ tr.style.height="20px";
+ td = tr.appendChild(document.createElement("td"));
+ td.colSpan="3";
+ var buttonTable = td.appendChild(document.createElement("table"));
+ buttonTable.height="100%";
+ buttonTable.width="100%";
+
+ var buttonBody = buttonTable.appendChild(document.createElement("tbody"));
+ tr = buttonBody.appendChild(document.createElement("tr"));
+ td = tr.appendChild(document.createElement("td"));
+ td.width="20%";
+ td = tr.appendChild(document.createElement("td"));
+ td.appendChild(document.createTextNode("OK"));
+ td.onclick = function ()
+ {
+ var selectedLayers = "";
+ var colorList = "";
+ var changed = false;
+ var originalLayerState = NovaButton.globals.originalLayerState;
+ //saving the user selected choices
+ for (i = 0; i < colorArray.length; i++) {
+ var colorItem = colorArray[i].split(",");
+ //saving the selected layers
+ var temp; // variable to hold changes value
+ if (document.getElementById("" + colorItem[0] + "chk").checked == true){
+ selectedLayers = selectedLayers + "~!" + colorItem[0];
+ temp = "true," + colorItem[0];
+ }
+ else {
+ temp = "false," + colorItem[0];
+ }
+ //saving the colours of all the layers
+ var userSelectedColor = document.getElementById("" + colorItem[0] + "colorbx").value;
+ if (userSelectedColor.charAt(0) == '#') {
+ userSelectedColor = userSelectedColor.substring(1);
+ }
+ colorList = colorList + "~!" + colorItem[0] + "," + userSelectedColor;
+ temp = temp + "," + userSelectedColor;
+
+ //check to see if there is anything change and update
+ // originalLayerState to reflect the changes
+ if (changed) {
+ originalLayerState[i] = temp;
+ }
+ else if (originalLayerState[i] != temp) {
+ changed = true;
+ originalLayerState[i] = temp;
+ }
+ }
+ selectedLayers = selectedLayers.substring(2, selectedLayers.length);
+ colorList = colorList.substring(2, colorList.length);
+ document.getElementById("selectedLayerList").value = selectedLayers;
+ document.getElementById("colorList").value = colorList;
+
+ // update if there is anything change
+ if (changed) {
+ updateImage(0);
+ }
+
+ //to remove the layer
+ NovaButton.prototype.showLayerClickEvent();
+ };
+ td.width="25%";
+ this.setButtonStyle(td, true);
+ td.style.cursor = "hand";
+
+ td = tr.appendChild(document.createElement("td"));
+ td.appendChild(document.createTextNode("Cancel"));
+ td.width="25%";
+ this.setButtonStyle(td, true);
+ td.style.cursor = "hand";
+ td.onclick = function ()
+ {
+ //remove all the contents
+ layerDiv.innerHTML="";
+ //re-initiate the layers to original values
+ NovaButton.prototype.initializeLayerDiv(layerDiv);
+ NovaButton.prototype.showLayerClickEvent();
+ };
+ td = tr.appendChild(document.createElement("td"));
+ td.width="10%";
+
+}
+
+NovaButton.prototype.checkIfColorSelected= function(selectedColorArray, colorItem) {
+ for (j = 0; j < selectedColorArray.length; j++) {
+ if (selectedColorArray[j] == colorItem){
+ return true;
+ }
+ }
+ return false;
+}
+
+NovaButton.prototype.setMenuContainerStyle = function(menuContainer) {
+ menuContainer.style.position = "absolute";
+ menuContainer.style.background = "#FFFFF0"
+ menuContainer.style.overflow = "auto";
+ menuContainer.style.scrolling="yes";
+ menuContainer.style.display = "none";
+ menuContainer.style.width = "300px";
+ menuContainer.style.height = "300px";
+}
+
+NovaButton.prototype.setMenuStyle = function(menu) {
+ menu.style.width = "300px";
+ menu.style.height = "300px";
+ menu.style.background = "#FFF";
+}
+
+NovaButton.prototype.setMenuItemStyle = function(menuItem) {
+ menuItem.style.padding = "4px 3px 4px 33px";
+ menuItem.style.fontFamily = "Vardana, Arial, Helvetica, sans-serif" ;
+ menuItem.style.fontSize = "10pt";
+ menuItem.style.color = "#333" ;
+ menuItem.style.cursor = "default" ;
+ menuItem.style.background = "no-repeat left center" ;
+}
+
+NovaButton.prototype.showLayerOption = function(posX, posY) {
+ var globals = NovaButton.globals;
+
+ //position the menu at the given location
+ if(typeof posX == "number") {
+ globals.layerOptionContainer.style.left = posX + "px";
+ }
+
+ if(typeof posY == "number") {
+ globals.layerOptionContainer.style.top = posY + "px";
+ }
+ //new chanes start
+ var resultContainer = globals.searchResultContainer;
+ resultContainer.style.display = "none";
+ //nw changes end
+ //display the menu
+ globals.layerOptionContainer.style.display = "block";
+}
+
+NovaButton.prototype.showSearchOption = function(posX, posY) {
+ var globals = NovaButton.globals;
+
+ //position the menu at the given location
+ if(typeof posX == "number") {
+ globals.searchOptionContainer.style.left = posX + "px";
+ }
+
+ if(typeof posY == "number") {
+ globals.searchOptionContainer.style.top = posY + "px";
+ }
+
+ //display the menu
+ globals.searchOptionContainer.style.display = "inline";
+}
+
+NovaButton.prototype.defaultViewClickEvent = function() {
+ var defaultZoomLevel = document.getElementById("defaultZoomLevel").value * 1;
+ map.setCenter(new GLatLng(document.getElementById("defaultCenterLatitude").value,
+ document.getElementById("defaultCenterLongitude").value),
+ defaultZoomLevel);
+ updateImage(0);
+}
+
+NovaButton.prototype.showLayerClickEvent = function(e) {
+ if (NovaButton.globals.layerOptionVisible) {
+ //to remove the color picker
+ cancel();
+ NovaButton.globals.layerOptionVisible = false;
+ NovaButton.globals.layerOptionContainer.style.display = "none";
+ return;
+ }
+
+ if (NovaButton.globals.searchOptionContainer.style.display != "none"){
+ NovaButton.prototype.searchClickEvent();
+ }
+ if (CingularButton.globals.listOptionContainer.style.display != "none"){
+ currentMonthClickEvent();
+ }
+
+ if (!e) {
+ e = window.event;
+ }
+
+ e.cancelBubble = true;
+
+ if (e.stopPropagation) {
+ e.stopPropagation();
+ }
+
+ var button = Event.element(e);
+ var posX = button.offsetLeft;
+ var posY = button.offsetTop;
+ this.showLayerOption(posX, posY + button.offsetHeight);
+ NovaButton.globals.layerOptionVisible = true;
+}
+
+NovaButton.prototype.searchClickEvent = function(e) {
+ if (NovaButton.globals.searchOptionVisible) {
+ NovaButton.globals.searchOptionVisible = false;
+ NovaButton.globals.searchOptionContainer.style.display = "none";
+ return;
+ }
+
+ if (NovaButton.globals.layerOptionContainer.style.display != "none"){
+ NovaButton.prototype.showLayerClickEvent();
+ }
+ if (CingularButton.globals.listOptionContainer.style.display != "none"){
+ currentMonthClickEvent();
+ }
+
+ if (!e) {
+ e = window.event;
+ }
+
+ e.cancelBubble = true;
+
+ if (e.stopPropagation) {
+ e.stopPropagation();
+ }
+
+ var button = Event.element(e);
+ var posX = button.offsetLeft;
+ var posY = button.offsetTop;
+ this.showSearchOption(posX, posY + button.offsetHeight + 3);
+ NovaButton.globals.searchOptionVisible = true;
+}
+
+NovaButton.prototype.submitSearchClickEvent = function(e) {
+ if (NovaButton.globals.searchTabSelected == "nodeTab") {
+ var input = document.getElementById("nodeSearchInput").value.trim();
+
+ if (input.length == 0) {
+ alert("Input field required");
+ return;
+ }
+
+ var searchType;
+ // ie bug
+ var searchByNodeId = document.getElementById("searchByNodeId");
+
+ if (searchByNodeId.checked) {
+ searchType = searchByNodeId.value;
+ }
+ else {
+ searchType = document.getElementById("searchByLocation").value;
+ }
+
+ var checkbox = document.getElementById("exactMatch");
+
+ searchObject(input, searchType, checkbox.checked, e.clientX, e.clientY);
+ }
+ else {
+ var address = document.getElementById("addressSearchInput").value.trim();
+
+ if (address.length == 0) {
+ alert("Address field required");
+ return;
+ }
+
+ geocoder.getLatLng(
+ address,
+ function(ll) {
+ if (ll != null) {
+ if (addressMarker == null) {
+ addressMarker = new GMarker(ll);
+ map.addOverlay(addressMarker);
+ GEvent.addListener(addressMarker, "click", marker_onclick);
+ }
+ else {
+ addressMarker.setLatLng(ll);
+ }
+
+ map.setCenter(ll);
+ updateImage(0);
+ }
+ }
+ );
+ }
+
+ this.searchClickEvent(e);
+}
+
+function marker_onclick() {
+ map.removeOverlay(addressMarker);
+ addressMarker = null;
+}
+
+// start drag zoom function
+NovaButton.prototype.initCover = function() {
+ var dragZoomGlobals = NovaButton.globals.dragzoom;
+ dragZoomGlobals.mapPosition = NovaButtonUtils.getElementPosition(NovaButton.globals.map.getContainer());
+ this.setDimensions();
+
+ dragZoomGlobals.zoomArea.style.display = "block";
+ dragZoomGlobals.zoomArea.style.background = "#000";
+
+ dragZoomGlobals.outlineDiv.style.width = "0px";
+ dragZoomGlobals.outlineDiv.style.height = "0px";
+};
+
+NovaButton.prototype.initZoomAreaStyles = function(){
+ var dragZoomGlobals = NovaButton.globals.dragzoom;
+ dragZoomGlobals.zoomArea.style.background = "#000";
+ dragZoomGlobals.zoomArea.style.opacity = "0.2";
+ dragZoomGlobals.zoomArea.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')';
+
+ dragZoomGlobals.cornerTopDiv.style.background = "#000";
+ dragZoomGlobals.cornerTopDiv.style.opacity = "0.2";
+ dragZoomGlobals.cornerTopDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')';
+
+ dragZoomGlobals.cornerRightDiv.style.background = "#000";
+ dragZoomGlobals.cornerRightDiv.style.opacity = "0.2";
+ dragZoomGlobals.cornerRightDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')';
+
+ dragZoomGlobals.cornerBottomDiv.style.background = "#000";
+ dragZoomGlobals.cornerBottomDiv.style.opacity = "0.2";
+ dragZoomGlobals.cornerBottomDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')';
+
+ dragZoomGlobals.cornerLeftDiv.style.background = "#000";
+ dragZoomGlobals.cornerLeftDiv.style.opacity = "0.2";
+ dragZoomGlobals.cornerLeftDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')';
+
+ dragZoomGlobals.outlineDiv.style.border = "2px solid blue";
+};
+
+NovaButton.prototype.resetDragZoom = function() {
+ var dragZoomGlobals = NovaButton.globals.dragzoom;
+ dragZoomGlobals.zoomArea.style.display = "none";
+ dragZoomGlobals.zoomArea.style.opacity = "0.2";
+ dragZoomGlobals.zoomArea.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')';
+
+ dragZoomGlobals.cornerTopDiv.style.display = "none";
+ dragZoomGlobals.cornerTopDiv.style.opacity = "0.2";
+ dragZoomGlobals.cornerTopDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')';
+
+ dragZoomGlobals.cornerRightDiv.style.display = "none";
+ dragZoomGlobals.cornerRightDiv.style.opacity = "0.2";
+ dragZoomGlobals.cornerRightDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')';
+
+ dragZoomGlobals.cornerBottomDiv.style.display = "none";
+ dragZoomGlobals.cornerBottomDiv.style.opacity = "0.2";
+ dragZoomGlobals.cornerBottomDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')';
+
+ dragZoomGlobals.cornerLeftDiv.style.display = "none";
+ dragZoomGlobals.cornerLeftDiv.style.opacity = "0.2";
+ dragZoomGlobals.cornerLeftDiv.style.filter = 'alpha(opacity=' + (0.2 * 100) + ')';
+
+ dragZoomGlobals.outlineDiv.style.display = 'none';
+};
+
+NovaButton.prototype.setZoomAreaStyle = function(zoomArea) {
+ zoomArea.style.position = "absolute";
+ zoomArea.style.display = "none";
+ zoomArea.style.overflow = "hidden";
+ zoomArea.style.cursor = "crosshair";
+ zoomArea.style.zIndex = "101";
+}
+
+NovaButton.prototype.getRectangle = function(startX, startY, pos){
+ var left = false;
+ var top = false;
+ var dX = pos.left - startX;
+ var dY = pos.top - startY;
+ if (dX < 0) {
+ dX = dX * -1;
+ left = true;
+ }
+ if (dY < 0) {
+ dY = dY * -1;
+ top = true;
+ }
+ delta = dX > dY ? dX : dY;
+
+ return {
+ startX: startX,
+ startY: startY,
+ endX: startX + dX,
+ endY: startY + dY,
+ width: dX,
+ height: dY,
+ left:left,
+ top:top
+ }
+};
+
+NovaButton.prototype.mouseDown = function(e) {
+ if (NovaButton.globals.currentButton != "zoomRectangleDiv") {
+ return;
+ }
+
+ var dragZoomGlobals = NovaButton.globals.dragzoom;
+ var pos = this.getRelPos(e);
+ dragZoomGlobals.startX = pos.left;
+ dragZoomGlobals.startY = pos.top;
+
+ dragZoomGlobals.zoomArea.style.background = "transparent";
+ dragZoomGlobals.zoomArea.style.opacity = "1";
+ dragZoomGlobals.zoomArea.style.filter = 'alpha(opacity=100)';
+
+ dragZoomGlobals.outlineDiv.style.left = dragZoomGlobals.startX + "px";
+ dragZoomGlobals.outlineDiv.style.top = dragZoomGlobals.startY + "px";
+ dragZoomGlobals.outlineDiv.style.display = "block";
+ dragZoomGlobals.outlineDiv.style.width = "1px";
+ dragZoomGlobals.outlineDiv.style.height = "1px";
+
+ dragZoomGlobals.cornerTopDiv.style.top = (dragZoomGlobals.startY - dragZoomGlobals.mapHeight) + 'px';
+ dragZoomGlobals.cornerTopDiv.style.display ='block';
+ dragZoomGlobals.cornerLeftDiv.style.left = (dragZoomGlobals.startX - dragZoomGlobals.mapWidth) +'px';
+ dragZoomGlobals.cornerLeftDiv.style.top = dragZoomGlobals.startY + 'px';
+ dragZoomGlobals.cornerLeftDiv.style.display = 'block';
+
+ dragZoomGlobals.cornerRightDiv.style.left = dragZoomGlobals.startX + 'px';
+ dragZoomGlobals.cornerRightDiv.style.top = dragZoomGlobals.startY + 'px';
+ dragZoomGlobals.cornerRightDiv.style.display = 'block';
+ dragZoomGlobals.cornerBottomDiv.style.left = dragZoomGlobals.startX + 'px';
+ dragZoomGlobals.cornerBottomDiv.style.top = dragZoomGlobals.startY + 'px';
+ dragZoomGlobals.cornerBottomDiv.style.width = '0px';
+ dragZoomGlobals.cornerBottomDiv.style.display = 'block';
+
+ dragZoomGlobals.moving = true;
+
+ return false;
+}
+
+NovaButton.prototype.mouseMove = function(e) {
+ var dragZoomGlobals = NovaButton.globals.dragzoom;
+
+ if(dragZoomGlobals.moving) {
+ var pos = this.getRelPos(e);
+ var rect = this.getRectangle(dragZoomGlobals.startX, dragZoomGlobals.startY, pos);
+
+ if (rect.left) {
+ addX = -rect.width;
+ } else {
+ addX = 0;
+ }
+
+ if (rect.top) {
+ addY = -rect.height;
+ } else {
+ addY = 0;
+ }
+
+ dragZoomGlobals.outlineDiv.style.left = dragZoomGlobals.startX + addX + "px";
+ dragZoomGlobals.outlineDiv.style.top = dragZoomGlobals.startY + addY + "px";
+ dragZoomGlobals.outlineDiv.style.display = "block";
+ dragZoomGlobals.outlineDiv.style.width = rect.width + "px";
+ dragZoomGlobals.outlineDiv.style.height = rect.height + "px";
+
+ dragZoomGlobals.cornerTopDiv.style.height = ((dragZoomGlobals.startY + addY) - (dragZoomGlobals.startY - dragZoomGlobals.mapHeight)) + 'px';
+ dragZoomGlobals.cornerLeftDiv.style.top = (dragZoomGlobals.startY + addY) + 'px';
+ dragZoomGlobals.cornerLeftDiv.style.width = ((dragZoomGlobals.startX + addX) - (dragZoomGlobals.startX - dragZoomGlobals.mapWidth)) + 'px';
+ dragZoomGlobals.cornerRightDiv.style.top = dragZoomGlobals.cornerLeftDiv.style.top;
+ dragZoomGlobals.cornerRightDiv.style.left = (dragZoomGlobals.startX + addX + rect.width + 4) + 'px';
+ dragZoomGlobals.cornerBottomDiv.style.top = (dragZoomGlobals.startY + addY + rect.height + 4) + 'px';
+ dragZoomGlobals.cornerBottomDiv.style.left = (dragZoomGlobals.startX - dragZoomGlobals.mapWidth + ((dragZoomGlobals.startX + addX) - (dragZoomGlobals.startX - dragZoomGlobals.mapWidth))) + 'px';
+ dragZoomGlobals.cornerBottomDiv.style.width = (rect.width + 4) + 'px';
+
+ return false;
+ }
+}
+
+NovaButton.prototype.mouseUp = function(e) {
+ var dragZoomGlobals = NovaButton.globals.dragzoom;
+ var map = NovaButton.globals.map;
+
+ if (dragZoomGlobals.moving) {
+ var pos = this.getRelPos(e);
+ dragZoomGlobals.moving = false;
+
+ var rect = this.getRectangle(dragZoomGlobals.startX, dragZoomGlobals.startY, pos);
+
+ if (rect.left) {
+ rect.endX = rect.startX - rect.width;
+ }
+
+ if (rect.top) {
+ rect.endY = rect.startY - rect.height;
+ }
+
+ this.resetDragZoom();
+
+ if (rect.width >= 0 && rect.height >= 0) {
+ var nwpx = new GPoint(rect.startX, rect.startY);
+ var nepx = new GPoint(rect.endX, rect.startY);
+ var sepx = new GPoint(rect.endX, rect.endY);
+ var swpx = new GPoint(rect.startX, rect.endY);
+ var nw = NovaButton.globals.map.fromContainerPixelToLatLng(nwpx);
+ var ne = NovaButton.globals.map.fromContainerPixelToLatLng(nepx);
+ var se = NovaButton.globals.map.fromContainerPixelToLatLng(sepx);
+ var sw = NovaButton.globals.map.fromContainerPixelToLatLng(swpx);
+
+ var zoomAreaPoly = new GPolyline([nw, ne, se, sw, nw], "blue", 3, .4);
+ var polyBounds = zoomAreaPoly.getBounds();
+ var ne = polyBounds.getNorthEast();
+ var sw = polyBounds.getSouthWest();
+ var se = new GLatLng(sw.lat(), ne.lng());
+ var nw = new GLatLng(ne.lat(), sw.lng());
+ var zoomLevel = map.getBoundsZoomLevel(polyBounds);
+ var center = polyBounds.getCenter();
+ map.setCenter(center, zoomLevel);
+ }
+
+ this.initCover();
+ }
+}
+
+NovaButton.prototype.setDimensions = function() {
+ var dragZoomGlobals = NovaButton.globals.dragzoom;
+ var mapSize = NovaButton.globals.map.getSize();
+ dragZoomGlobals.mapWidth = mapSize.width;
+ dragZoomGlobals.mapHeight = mapSize.height;
+ dragZoomGlobals.mapRatio = dragZoomGlobals.mapHeight / dragZoomGlobals.mapWidth;
+ // set left:0px in next <div>s in case we inherit text-align:center from map <div> in IE.
+ dragZoomGlobals.zoomArea.style.top = "0px";
+ dragZoomGlobals.zoomArea.style.left = "0px";
+ dragZoomGlobals.zoomArea.style.width = dragZoomGlobals.mapWidth + "px";
+ dragZoomGlobals.zoomArea.style.height = dragZoomGlobals.mapHeight + "px";
+
+ dragZoomGlobals.cornerTopDiv.style.top = "0px";
+ dragZoomGlobals.cornerTopDiv.style.left = "0px";
+ dragZoomGlobals.cornerTopDiv.style.width = dragZoomGlobals.mapWidth + "px";
+ dragZoomGlobals.cornerTopDiv.style.height = dragZoomGlobals.mapHeight + "px";
+
+ dragZoomGlobals.cornerRightDiv.style.top = "0px";
+ dragZoomGlobals.cornerRightDiv.style.left = "0px";
+ dragZoomGlobals.cornerRightDiv.style.width = dragZoomGlobals.mapWidth + "px";
+ dragZoomGlobals.cornerRightDiv.style.height = dragZoomGlobals.mapHeight + "px";
+
+ dragZoomGlobals.cornerBottomDiv.style.top = "0px";
+ dragZoomGlobals.cornerBottomDiv.style.left = "0px";
+ dragZoomGlobals.cornerBottomDiv.style.width = dragZoomGlobals.mapWidth + "px";
+ dragZoomGlobals.cornerBottomDiv.style.height = dragZoomGlobals.mapHeight + "px";
+
+ dragZoomGlobals.cornerLeftDiv.style.top = "0px";
+ dragZoomGlobals.cornerLeftDiv.style.left = "0px";
+ dragZoomGlobals.cornerLeftDiv.style.width = dragZoomGlobals.mapWidth + "px";
+ dragZoomGlobals.cornerLeftDiv.style.height = dragZoomGlobals.mapHeight + "px";
+};
+
+NovaButton.prototype.getRelPos = function(e) {
+ var pos = NovaButtonUtils.getMousePosition(e);
+ var dragZoomGlobals = NovaButton.globals.dragzoom;
+ return {top: (pos.top - dragZoomGlobals.mapPosition.top),
+ left: (pos.left - dragZoomGlobals.mapPosition.left)};
+};
+// end drag zoom function
+
+var NovaButtonUtils = {
+};
+
+NovaButtonUtils.getElementPosition = function(element) {
+ var leftPos = element.offsetLeft; // initialize var to store calculations
+ var topPos = element.offsetTop; // initialize var to store calculations
+ var parElement = element.offsetParent; // identify first offset parent element
+ while (parElement != null ) { // move up through element hierarchy
+ leftPos += parElement.offsetLeft; // appending left offset of each parent
+ topPos += parElement.offsetTop;
+ parElement = parElement.offsetParent; // until no more offset parents exist
+ }
+ return {left: leftPos, top: topPos};
+};
+
+NovaButtonUtils.getMousePosition = function(e) {
+ var posX = 0;
+ var posY = 0;
+ if (!e) var e = window.event;
+ if (e.pageX || e.pageY) {
+ posX = e.pageX;
+ posY = e.pageY;
+ } else if (e.clientX || e.clientY){
+ posX = e.clientX +
+ (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
+ posY = e.clientY +
+ (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
+ }
+ return {left: posX, top: posY};
+}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/other_scripts.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/other_scripts.js
new file mode 100644
index 00000000..3784600b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/other_scripts.js
@@ -0,0 +1,331 @@
+//Reusable Asset Library - CSS Positioning Version (v3.3)
+//Release Date: 1/26/07
+
+
+//begin: quick help =======================================
+var uitmpl_qhId;
+var uitmpl_cookieVal;
+var qhRule;
+var qhCookie;
+
+//sets cookie value and qhId
+qhCookie=document.cookie;
+var pos=qhCookie.indexOf("qhId=");
+
+if(pos==-1){
+document.cookie="qhId=0";
+uitmpl_qhId="0";
+qhCookie=document.cookie;
+pos=qhCookie.indexOf("qhId=");
+}
+//reads cookie if value is present and sets qhId accordingly
+var start=pos+5;
+var end=qhCookie.indexOf(";", start);
+if (end==-1) end=qhCookie.length;
+uitmpl_cookieVal=qhCookie.substring(start,end);
+if(uitmpl_cookieVal!=0){
+ uitmpl_qhId=1;
+}else{
+uitmpl_qhId=0;
+}
+
+
+//loops through all qh divs and toggles display based on qhId
+function uitmpl_qhPageInit(){
+var getTag = document.getElementsByTagName("div");
+ for (i=0;i<getTag.length;i++){
+ if (getTag[i].className=="mQH"){
+ getTag[i].style.display=(uitmpl_qhId!="0")?"block":"none";
+ //getTag[i].onmouseover="alert('foo')";
+ }
+ }
+ //changes instruction in help menu if menu exists
+ if (uitmpl_qhId==1&&document.getElementById("shHd")){
+ document.getElementById("shHd").innerHTML = "Hide";
+ }
+}
+
+function uitmpl_qhPageToggle(){
+//change instruction in help menu
+var getCurrent = document.getElementById("shHd").innerHTML;
+var setCurrent = (getCurrent=="Show")?"Hide":"Show";
+document.getElementById("shHd").innerHTML = setCurrent;
+//change cookie value
+document.cookie = (setCurrent=="Show")?"qhId=0":"qhId=1";
+//change qhId value
+uitmpl_qhId = (setCurrent=="Show")?"0":"1";
+//rerun page init
+uitmpl_qhPageInit();
+}
+
+//individual quick help toggle
+function uitmpl_qh(obj){
+ var state = document.getElementById(obj).style.display;
+ document.getElementById(obj).style.display=(state!="block")?"block":"none";
+
+}
+//end: quick help =======================================
+
+//begin: error validation =======================================
+//string validation
+function uitmpl_errStrVal(obj, errId){
+ var x=obj.value;
+ var regExp = {
+ number:/(^\d+$)|(^\d+\.\d+$)/,
+ email:/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
+ //phone:/(^\d+$)|(^\d+\.\d+$)/,
+ //time:/(^\d+$)|(^\d+\.\d+$)/
+ };
+
+ var alrtStr = {
+ number:"Please input a valid number!",
+ email:"Please input a valid email address!",
+ date:"That date is invalid. Please try again."
+ //phone:"Please input a valid phone number!",
+ //time:"Please input a valid time!"
+ };
+
+ var getReg = eval("regExp."+errId);
+ var getAlrt = eval("alrtStr."+errId);
+
+ //Number----------------------------------------------------------
+ if (errId=="number"&&!x.match(getReg)){
+ alert(getAlrt);
+ obj.focus();
+ obj.select();
+ }
+ //Email-----------------------------------------------------------
+ else if (errId=="email"&&!x.match(getReg)){
+ alert(getAlrt);
+ obj.focus();
+ obj.select();
+ }
+ //Date------------------------------------------------------------
+ if (errId=="date"&&!uitmpl_chkdate(obj)){
+ alert(getAlrt);
+ obj.focus();
+ obj.select();
+ }
+}
+
+//supplemental date check function
+function uitmpl_chkdate(objName) {
+var strDatestyle = "US"; //United States date style
+//var strDatestyle = "EU"; //European date style
+var strDate;
+var strDateArray;
+var strDay;
+var strMonth;
+var strYear;
+var intday;
+var intMonth;
+var intYear;
+var booFound = false;
+
+var datefield = objName;
+var strSeparatorArray = new Array("-"," ","/",".");
+var intElementNr;
+var err = 0;
+var strMonthArray = new Array(12);
+strMonthArray[0] = "Jan";
+strMonthArray[1] = "Feb";
+strMonthArray[2] = "Mar";
+strMonthArray[3] = "Apr";
+strMonthArray[4] = "May";
+strMonthArray[5] = "Jun";
+strMonthArray[6] = "Jul";
+strMonthArray[7] = "Aug";
+strMonthArray[8] = "Sep";
+strMonthArray[9] = "Oct";
+strMonthArray[10] = "Nov";
+strMonthArray[11] = "Dec";
+strDate = datefield.value;
+if (strDate.length < 1) {
+return true;
+}
+for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
+if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
+strDateArray = strDate.split(strSeparatorArray[intElementNr]);
+if (strDateArray.length != 3) {
+err = 1;
+return false;
+}
+else {
+strDay = strDateArray[0];
+strMonth = strDateArray[1];
+strYear = strDateArray[2];
+}
+booFound = true;
+ }
+}
+if (booFound == false) {
+if (strDate.length>5) {
+strDay = strDate.substr(0, 2);
+strMonth = strDate.substr(2, 2);
+strYear = strDate.substr(4);
+ }
+}
+if (strYear.length == 2) {
+strYear = '20' + strYear;
+}
+// US style
+if (strDatestyle == "US") {
+strTemp = strDay;
+strDay = strMonth;
+strMonth = strTemp;
+}
+intday = parseInt(strDay, 10);
+if (isNaN(intday)) {
+err = 2;
+return false;
+}
+intMonth = parseInt(strMonth, 10);
+if (isNaN(intMonth)) {
+for (i = 0;i<12;i++) {
+if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
+intMonth = i+1;
+strMonth = strMonthArray[i];
+i = 12;
+ }
+}
+if (isNaN(intMonth)) {
+err = 3;
+return false;
+ }
+}
+intYear = parseInt(strYear, 10);
+if (isNaN(intYear)) {
+err = 4;
+return false;
+}
+if (intMonth>12 || intMonth<1) {
+err = 5;
+return false;
+}
+if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
+err = 6;
+return false;
+}
+if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
+err = 7;
+return false;
+}
+if (intMonth == 2) {
+if (intday < 1) {
+err = 8;
+return false;
+}
+if (LeapYear(intYear) == true) {
+if (intday > 29) {
+err = 9;
+return false;
+}
+}
+else {
+if (intday > 28) {
+err = 10;
+return false;
+}
+}
+}
+//if (strDatestyle == "US") {
+//datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
+//}
+//else {
+//datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
+//}
+return true;
+}
+function LeapYear(intYear) {
+if (intYear % 100 == 0) {
+if (intYear % 400 == 0) { return true; }
+}
+else {
+if ((intYear % 4) == 0) { return true; }
+}
+return false;
+}
+
+//range validation
+function uitmpl_errRangeVal(obj, minNum, maxNum){
+if (obj.value>=minNum&&obj.value<=maxNum||obj.value==""){
+return true;
+}else{
+alert("Please input a number within the range of "+minNum+" and "+maxNum+"!");
+obj.focus();
+obj.select();
+}
+}
+
+//end: error validation =======================================
+//begin: popup windows =======================================
+function uitmpl_popUpReg(url) {
+ window.open(url);
+}
+function uitmpl_popUpConfig(url, name, w, h, sc, rsz) {
+ var features = "width="+w+",height="+h+",scrollbars="+sc+",resizable="+rsz+"menubar=0,status=1";
+ var newWin = window.open(url, name, features);
+ newWin.focus();
+//popups from nav links:
+}
+
+
+function uitmpl_contact(){
+uitmpl_popUpReg("");
+}
+function uitmpl_bizDirect(){
+uitmpl_popUpReg("");
+}
+
+//function uitmpl_closeApp(){
+//if(window.confirm("You did NOT save your data. Do you want to close 'application name' without saving your data?")) {
+//window.close();
+
+function uitmpl_closeApp(name){
+if (name != "") {
+var cAppName=name;
+}
+else {
+var cAppName="the current application";
+}
+if(window.confirm("You did NOT save your data. Do you want to close\n" + cAppName + " without saving your data?")) {
+window.close();
+}
+}
+//end: popup windows =======================================
+
+
+
+
+
+//Select all checkboxes on a form=====================================
+function uitmpl_chkBoxSelect(formName,btnOn,btnOff) {
+
+ document.getElementById(btnOff).style.display = "block";
+ document.getElementById(btnOn).style.display = "none";
+
+ var f = formName;
+ for (i=0; i < f.elements.length; i++) {
+ if (f.elements[i].type=="checkbox") {
+ var e = f.elements[i];
+ e.checked = true;
+ }
+ }
+}
+
+
+//Clear all checkboxes on a form======================================
+function uitmpl_chkBoxClear(formName,btnOn, btnOff) {
+
+ document.getElementById(btnOff).style.display = "none";
+ document.getElementById(btnOn).style.display = "block";
+
+ var f = formName;
+ for (i=0; i < f.elements.length; i++) {
+ if (f.elements[i].type=="checkbox") {
+ var e = f.elements[i];
+ e.checked = false;
+ }
+ }
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/persist_table_header.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/persist_table_header.js
new file mode 100644
index 00000000..2c90306f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/persist_table_header.js
@@ -0,0 +1,47 @@
+ function UpdateTableHeaders() {
+ $("div.divTableWithFloatingHeader").each(function() {
+ var originalHeaderRow = $(".tableFloatingHeaderOriginal", this);
+ var floatingHeaderRow = $(".tableFloatingHeader", this);
+ var offset = $(this).offset();
+ var scrollTop = $(window).scrollTop();
+ if ((scrollTop > offset.top) && (scrollTop < offset.top + $(this).height())) {
+ floatingHeaderRow.css("visibility", "visible");
+ floatingHeaderRow.css("top", Math.min(scrollTop - offset.top, $(this).height() - floatingHeaderRow.height()) + "px");
+ floatingHeaderRow.css("z-index", "20");
+
+ // Copy cell widths from original header
+ $("th", floatingHeaderRow).each(function(index) {
+ var cellWidth = $("th", originalHeaderRow).eq(index).css('width');
+ $(this).css('width', cellWidth);
+ });
+
+ // Copy row width from whole table
+ floatingHeaderRow.css("width", $(this).css("width"));
+ }
+ else {
+ floatingHeaderRow.css("visibility", "hidden");
+ floatingHeaderRow.css("top", "0px");
+ }
+ });
+ }
+
+ $(document).ready(function() {
+ $("table.tableWithFloatingHeader").each(function() {
+ $(this).wrap("<div class=\"divTableWithFloatingHeader\" style=\"position:relative\"></div>");
+
+ var originalHeaderRow = $("tr:first", this)
+ originalHeaderRow.before(originalHeaderRow.clone());
+ var clonedHeaderRow = $("tr:first", this)
+
+ clonedHeaderRow.addClass("tableFloatingHeader");
+ clonedHeaderRow.css("position", "absolute");
+ clonedHeaderRow.css("top", "0px");
+ clonedHeaderRow.css("left", $(this).css("margin-left"));
+ clonedHeaderRow.css("visibility", "hidden");
+
+ originalHeaderRow.addClass("tableFloatingHeaderOriginal");
+ });
+ UpdateTableHeaders();
+ $(window.parent).scroll(UpdateTableHeaders);
+ $(window.parent).resize(UpdateTableHeaders);
+ }); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/prototype-1.6.0.3.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/prototype-1.6.0.3.js
new file mode 100644
index 00000000..dfe8ab4e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/prototype-1.6.0.3.js
@@ -0,0 +1,4320 @@
+/* Prototype JavaScript framework, version 1.6.0.3
+ * (c) 2005-2008 Sam Stephenson
+ *
+ * Prototype is freely distributable under the terms of an MIT-style license.
+ * For details, see the Prototype web site: http://www.prototypejs.org/
+ *
+ *--------------------------------------------------------------------------*/
+
+var Prototype = {
+ Version: '1.6.0.3',
+
+ Browser: {
+ IE: !!(window.attachEvent &&
+ navigator.userAgent.indexOf('Opera') === -1),
+ Opera: navigator.userAgent.indexOf('Opera') > -1,
+ WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
+ Gecko: navigator.userAgent.indexOf('Gecko') > -1 &&
+ navigator.userAgent.indexOf('KHTML') === -1,
+ MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
+ },
+
+ BrowserFeatures: {
+ XPath: !!document.evaluate,
+ SelectorsAPI: !!document.querySelector,
+ ElementExtensions: !!window.HTMLElement,
+ SpecificElementExtensions:
+ document.createElement('div')['__proto__'] &&
+ document.createElement('div')['__proto__'] !==
+ document.createElement('form')['__proto__']
+ },
+
+ ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
+ JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
+
+ emptyFunction: function() { },
+ K: function(x) { return x }
+};
+
+if (Prototype.Browser.MobileSafari)
+ Prototype.BrowserFeatures.SpecificElementExtensions = false;
+
+
+/* Based on Alex Arnell's inheritance implementation. */
+var Class = {
+ create: function() {
+ var parent = null, properties = $A(arguments);
+ if (Object.isFunction(properties[0]))
+ parent = properties.shift();
+
+ function klass() {
+ this.initialize.apply(this, arguments);
+ }
+
+ Object.extend(klass, Class.Methods);
+ klass.superclass = parent;
+ klass.subclasses = [];
+
+ if (parent) {
+ var subclass = function() { };
+ subclass.prototype = parent.prototype;
+ klass.prototype = new subclass;
+ parent.subclasses.push(klass);
+ }
+
+ for (var i = 0; i < properties.length; i++)
+ klass.addMethods(properties[i]);
+
+ if (!klass.prototype.initialize)
+ klass.prototype.initialize = Prototype.emptyFunction;
+
+ klass.prototype.constructor = klass;
+
+ return klass;
+ }
+};
+
+Class.Methods = {
+ addMethods: function(source) {
+ var ancestor = this.superclass && this.superclass.prototype;
+ var properties = Object.keys(source);
+
+ if (!Object.keys({ toString: true }).length)
+ properties.push("toString", "valueOf");
+
+ for (var i = 0, length = properties.length; i < length; i++) {
+ var property = properties[i], value = source[property];
+ if (ancestor && Object.isFunction(value) &&
+ value.argumentNames().first() == "$super") {
+ var method = value;
+ value = (function(m) {
+ return function() { return ancestor[m].apply(this, arguments) };
+ })(property).wrap(method);
+
+ value.valueOf = method.valueOf.bind(method);
+ value.toString = method.toString.bind(method);
+ }
+ this.prototype[property] = value;
+ }
+
+ return this;
+ }
+};
+
+var Abstract = { };
+
+Object.extend = function(destination, source) {
+ for (var property in source)
+ destination[property] = source[property];
+ return destination;
+};
+
+Object.extend(Object, {
+ inspect: function(object) {
+ try {
+ if (Object.isUndefined(object)) return 'undefined';
+ if (object === null) return 'null';
+ return object.inspect ? object.inspect() : String(object);
+ } catch (e) {
+ if (e instanceof RangeError) return '...';
+ throw e;
+ }
+ },
+
+ toJSON: function(object) {
+ var type = typeof object;
+ switch (type) {
+ case 'undefined':
+ case 'function':
+ case 'unknown': return;
+ case 'boolean': return object.toString();
+ }
+
+ if (object === null) return 'null';
+ if (object.toJSON) return object.toJSON();
+ if (Object.isElement(object)) return;
+
+ var results = [];
+ for (var property in object) {
+ var value = Object.toJSON(object[property]);
+ if (!Object.isUndefined(value))
+ results.push(property.toJSON() + ': ' + value);
+ }
+
+ return '{' + results.join(', ') + '}';
+ },
+
+ toQueryString: function(object) {
+ return $H(object).toQueryString();
+ },
+
+ toHTML: function(object) {
+ return object && object.toHTML ? object.toHTML() : String.interpret(object);
+ },
+
+ keys: function(object) {
+ var keys = [];
+ for (var property in object)
+ keys.push(property);
+ return keys;
+ },
+
+ values: function(object) {
+ var values = [];
+ for (var property in object)
+ values.push(object[property]);
+ return values;
+ },
+
+ clone: function(object) {
+ return Object.extend({ }, object);
+ },
+
+ isElement: function(object) {
+ return !!(object && object.nodeType == 1);
+ },
+
+ isArray: function(object) {
+ return object != null && typeof object == "object" &&
+ 'splice' in object && 'join' in object;
+ },
+
+ isHash: function(object) {
+ return object instanceof Hash;
+ },
+
+ isFunction: function(object) {
+ return typeof object == "function";
+ },
+
+ isString: function(object) {
+ return typeof object == "string";
+ },
+
+ isNumber: function(object) {
+ return typeof object == "number";
+ },
+
+ isUndefined: function(object) {
+ return typeof object == "undefined";
+ }
+});
+
+Object.extend(Function.prototype, {
+ argumentNames: function() {
+ var names = this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1]
+ .replace(/\s+/g, '').split(',');
+ return names.length == 1 && !names[0] ? [] : names;
+ },
+
+ bind: function() {
+ if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
+ var __method = this, args = $A(arguments), object = args.shift();
+ return function() {
+ return __method.apply(object, args.concat($A(arguments)));
+ }
+ },
+
+ bindAsEventListener: function() {
+ var __method = this, args = $A(arguments), object = args.shift();
+ return function(event) {
+ return __method.apply(object, [event || window.event].concat(args));
+ }
+ },
+
+ curry: function() {
+ if (!arguments.length) return this;
+ var __method = this, args = $A(arguments);
+ return function() {
+ return __method.apply(this, args.concat($A(arguments)));
+ }
+ },
+
+ delay: function() {
+ var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
+ return window.setTimeout(function() {
+ return __method.apply(__method, args);
+ }, timeout);
+ },
+
+ defer: function() {
+ var args = [0.01].concat($A(arguments));
+ return this.delay.apply(this, args);
+ },
+
+ wrap: function(wrapper) {
+ var __method = this;
+ return function() {
+ return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
+ }
+ },
+
+ methodize: function() {
+ if (this._methodized) return this._methodized;
+ var __method = this;
+ return this._methodized = function() {
+ return __method.apply(null, [this].concat($A(arguments)));
+ };
+ }
+});
+
+Date.prototype.toJSON = function() {
+ return '"' + this.getUTCFullYear() + '-' +
+ (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
+ this.getUTCDate().toPaddedString(2) + 'T' +
+ this.getUTCHours().toPaddedString(2) + ':' +
+ this.getUTCMinutes().toPaddedString(2) + ':' +
+ this.getUTCSeconds().toPaddedString(2) + 'Z"';
+};
+
+var Try = {
+ these: function() {
+ var returnValue;
+
+ for (var i = 0, length = arguments.length; i < length; i++) {
+ var lambda = arguments[i];
+ try {
+ returnValue = lambda();
+ break;
+ } catch (e) { }
+ }
+
+ return returnValue;
+ }
+};
+
+RegExp.prototype.match = RegExp.prototype.test;
+
+RegExp.escape = function(str) {
+ return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
+};
+
+/*--------------------------------------------------------------------------*/
+
+var PeriodicalExecuter = Class.create({
+ initialize: function(callback, frequency) {
+ this.callback = callback;
+ this.frequency = frequency;
+ this.currentlyExecuting = false;
+
+ this.registerCallback();
+ },
+
+ registerCallback: function() {
+ this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+ },
+
+ execute: function() {
+ this.callback(this);
+ },
+
+ stop: function() {
+ if (!this.timer) return;
+ clearInterval(this.timer);
+ this.timer = null;
+ },
+
+ onTimerEvent: function() {
+ if (!this.currentlyExecuting) {
+ try {
+ this.currentlyExecuting = true;
+ this.execute();
+ } finally {
+ this.currentlyExecuting = false;
+ }
+ }
+ }
+});
+Object.extend(String, {
+ interpret: function(value) {
+ return value == null ? '' : String(value);
+ },
+ specialChar: {
+ '\b': '\\b',
+ '\t': '\\t',
+ '\n': '\\n',
+ '\f': '\\f',
+ '\r': '\\r',
+ '\\': '\\\\'
+ }
+});
+
+Object.extend(String.prototype, {
+ gsub: function(pattern, replacement) {
+ var result = '', source = this, match;
+ replacement = arguments.callee.prepareReplacement(replacement);
+
+ while (source.length > 0) {
+ if (match = source.match(pattern)) {
+ result += source.slice(0, match.index);
+ result += String.interpret(replacement(match));
+ source = source.slice(match.index + match[0].length);
+ } else {
+ result += source, source = '';
+ }
+ }
+ return result;
+ },
+
+ sub: function(pattern, replacement, count) {
+ replacement = this.gsub.prepareReplacement(replacement);
+ count = Object.isUndefined(count) ? 1 : count;
+
+ return this.gsub(pattern, function(match) {
+ if (--count < 0) return match[0];
+ return replacement(match);
+ });
+ },
+
+ scan: function(pattern, iterator) {
+ this.gsub(pattern, iterator);
+ return String(this);
+ },
+
+ truncate: function(length, truncation) {
+ length = length || 30;
+ truncation = Object.isUndefined(truncation) ? '...' : truncation;
+ return this.length > length ?
+ this.slice(0, length - truncation.length) + truncation : String(this);
+ },
+
+ strip: function() {
+ return this.replace(/^\s+/, '').replace(/\s+$/, '');
+ },
+
+ stripTags: function() {
+ return this.replace(/<\/?[^>]+>/gi, '');
+ },
+
+ stripScripts: function() {
+ return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
+ },
+
+ extractScripts: function() {
+ var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
+ var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
+ return (this.match(matchAll) || []).map(function(scriptTag) {
+ return (scriptTag.match(matchOne) || ['', ''])[1];
+ });
+ },
+
+ evalScripts: function() {
+ return this.extractScripts().map(function(script) { return eval(script) });
+ },
+
+ escapeHTML: function() {
+ var self = arguments.callee;
+ self.text.data = this;
+ return self.div.innerHTML;
+ },
+
+ unescapeHTML: function() {
+ var div = new Element('div');
+ div.innerHTML = this.stripTags();
+ return div.childNodes[0] ? (div.childNodes.length > 1 ?
+ $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
+ div.childNodes[0].nodeValue) : '';
+ },
+
+ toQueryParams: function(separator) {
+ var match = this.strip().match(/([^?#]*)(#.*)?$/);
+ if (!match) return { };
+
+ return match[1].split(separator || '&').inject({ }, function(hash, pair) {
+ if ((pair = pair.split('='))[0]) {
+ var key = decodeURIComponent(pair.shift());
+ var value = pair.length > 1 ? pair.join('=') : pair[0];
+ if (value != undefined) value = decodeURIComponent(value);
+
+ if (key in hash) {
+ if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
+ hash[key].push(value);
+ }
+ else hash[key] = value;
+ }
+ return hash;
+ });
+ },
+
+ toArray: function() {
+ return this.split('');
+ },
+
+ succ: function() {
+ return this.slice(0, this.length - 1) +
+ String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
+ },
+
+ times: function(count) {
+ return count < 1 ? '' : new Array(count + 1).join(this);
+ },
+
+ camelize: function() {
+ var parts = this.split('-'), len = parts.length;
+ if (len == 1) return parts[0];
+
+ var camelized = this.charAt(0) == '-'
+ ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
+ : parts[0];
+
+ for (var i = 1; i < len; i++)
+ camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
+
+ return camelized;
+ },
+
+ capitalize: function() {
+ return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
+ },
+
+ underscore: function() {
+ return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
+ },
+
+ dasherize: function() {
+ return this.gsub(/_/,'-');
+ },
+
+ inspect: function(useDoubleQuotes) {
+ var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
+ var character = String.specialChar[match[0]];
+ return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
+ });
+ if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
+ return "'" + escapedString.replace(/'/g, '\\\'') + "'";
+ },
+
+ toJSON: function() {
+ return this.inspect(true);
+ },
+
+ unfilterJSON: function(filter) {
+ return this.sub(filter || Prototype.JSONFilter, '#{1}');
+ },
+
+ isJSON: function() {
+ var str = this;
+ if (str.blank()) return false;
+ str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
+ return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
+ },
+
+ evalJSON: function(sanitize) {
+ var json = this.unfilterJSON();
+ try {
+ if (!sanitize || json.isJSON()) return eval('(' + json + ')');
+ } catch (e) { }
+ throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
+ },
+
+ include: function(pattern) {
+ return this.indexOf(pattern) > -1;
+ },
+
+ startsWith: function(pattern) {
+ return this.indexOf(pattern) === 0;
+ },
+
+ endsWith: function(pattern) {
+ var d = this.length - pattern.length;
+ return d >= 0 && this.lastIndexOf(pattern) === d;
+ },
+
+ empty: function() {
+ return this == '';
+ },
+
+ blank: function() {
+ return /^\s*$/.test(this);
+ },
+
+ interpolate: function(object, pattern) {
+ return new Template(this, pattern).evaluate(object);
+ }
+});
+
+if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
+ escapeHTML: function() {
+ return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
+ },
+ unescapeHTML: function() {
+ return this.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
+ }
+});
+
+String.prototype.gsub.prepareReplacement = function(replacement) {
+ if (Object.isFunction(replacement)) return replacement;
+ var template = new Template(replacement);
+ return function(match) { return template.evaluate(match) };
+};
+
+String.prototype.parseQuery = String.prototype.toQueryParams;
+
+Object.extend(String.prototype.escapeHTML, {
+ div: document.createElement('div'),
+ text: document.createTextNode('')
+});
+
+String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);
+
+var Template = Class.create({
+ initialize: function(template, pattern) {
+ this.template = template.toString();
+ this.pattern = pattern || Template.Pattern;
+ },
+
+ evaluate: function(object) {
+ if (Object.isFunction(object.toTemplateReplacements))
+ object = object.toTemplateReplacements();
+
+ return this.template.gsub(this.pattern, function(match) {
+ if (object == null) return '';
+
+ var before = match[1] || '';
+ if (before == '\\') return match[2];
+
+ var ctx = object, expr = match[3];
+ var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
+ match = pattern.exec(expr);
+ if (match == null) return before;
+
+ while (match != null) {
+ var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
+ ctx = ctx[comp];
+ if (null == ctx || '' == match[3]) break;
+ expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
+ match = pattern.exec(expr);
+ }
+
+ return before + String.interpret(ctx);
+ });
+ }
+});
+Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
+
+var $break = { };
+
+var Enumerable = {
+ each: function(iterator, context) {
+ var index = 0;
+ try {
+ this._each(function(value) {
+ iterator.call(context, value, index++);
+ });
+ } catch (e) {
+ if (e != $break) throw e;
+ }
+ return this;
+ },
+
+ eachSlice: function(number, iterator, context) {
+ var index = -number, slices = [], array = this.toArray();
+ if (number < 1) return array;
+ while ((index += number) < array.length)
+ slices.push(array.slice(index, index+number));
+ return slices.collect(iterator, context);
+ },
+
+ all: function(iterator, context) {
+ iterator = iterator || Prototype.K;
+ var result = true;
+ this.each(function(value, index) {
+ result = result && !!iterator.call(context, value, index);
+ if (!result) throw $break;
+ });
+ return result;
+ },
+
+ any: function(iterator, context) {
+ iterator = iterator || Prototype.K;
+ var result = false;
+ this.each(function(value, index) {
+ if (result = !!iterator.call(context, value, index))
+ throw $break;
+ });
+ return result;
+ },
+
+ collect: function(iterator, context) {
+ iterator = iterator || Prototype.K;
+ var results = [];
+ this.each(function(value, index) {
+ results.push(iterator.call(context, value, index));
+ });
+ return results;
+ },
+
+ detect: function(iterator, context) {
+ var result;
+ this.each(function(value, index) {
+ if (iterator.call(context, value, index)) {
+ result = value;
+ throw $break;
+ }
+ });
+ return result;
+ },
+
+ findAll: function(iterator, context) {
+ var results = [];
+ this.each(function(value, index) {
+ if (iterator.call(context, value, index))
+ results.push(value);
+ });
+ return results;
+ },
+
+ grep: function(filter, iterator, context) {
+ iterator = iterator || Prototype.K;
+ var results = [];
+
+ if (Object.isString(filter))
+ filter = new RegExp(filter);
+
+ this.each(function(value, index) {
+ if (filter.match(value))
+ results.push(iterator.call(context, value, index));
+ });
+ return results;
+ },
+
+ include: function(object) {
+ if (Object.isFunction(this.indexOf))
+ if (this.indexOf(object) != -1) return true;
+
+ var found = false;
+ this.each(function(value) {
+ if (value == object) {
+ found = true;
+ throw $break;
+ }
+ });
+ return found;
+ },
+
+ inGroupsOf: function(number, fillWith) {
+ fillWith = Object.isUndefined(fillWith) ? null : fillWith;
+ return this.eachSlice(number, function(slice) {
+ while(slice.length < number) slice.push(fillWith);
+ return slice;
+ });
+ },
+
+ inject: function(memo, iterator, context) {
+ this.each(function(value, index) {
+ memo = iterator.call(context, memo, value, index);
+ });
+ return memo;
+ },
+
+ invoke: function(method) {
+ var args = $A(arguments).slice(1);
+ return this.map(function(value) {
+ return value[method].apply(value, args);
+ });
+ },
+
+ max: function(iterator, context) {
+ iterator = iterator || Prototype.K;
+ var result;
+ this.each(function(value, index) {
+ value = iterator.call(context, value, index);
+ if (result == null || value >= result)
+ result = value;
+ });
+ return result;
+ },
+
+ min: function(iterator, context) {
+ iterator = iterator || Prototype.K;
+ var result;
+ this.each(function(value, index) {
+ value = iterator.call(context, value, index);
+ if (result == null || value < result)
+ result = value;
+ });
+ return result;
+ },
+
+ partition: function(iterator, context) {
+ iterator = iterator || Prototype.K;
+ var trues = [], falses = [];
+ this.each(function(value, index) {
+ (iterator.call(context, value, index) ?
+ trues : falses).push(value);
+ });
+ return [trues, falses];
+ },
+
+ pluck: function(property) {
+ var results = [];
+ this.each(function(value) {
+ results.push(value[property]);
+ });
+ return results;
+ },
+
+ reject: function(iterator, context) {
+ var results = [];
+ this.each(function(value, index) {
+ if (!iterator.call(context, value, index))
+ results.push(value);
+ });
+ return results;
+ },
+
+ sortBy: function(iterator, context) {
+ return this.map(function(value, index) {
+ return {
+ value: value,
+ criteria: iterator.call(context, value, index)
+ };
+ }).sort(function(left, right) {
+ var a = left.criteria, b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
+ }).pluck('value');
+ },
+
+ toArray: function() {
+ return this.map();
+ },
+
+ zip: function() {
+ var iterator = Prototype.K, args = $A(arguments);
+ if (Object.isFunction(args.last()))
+ iterator = args.pop();
+
+ var collections = [this].concat(args).map($A);
+ return this.map(function(value, index) {
+ return iterator(collections.pluck(index));
+ });
+ },
+
+ size: function() {
+ return this.toArray().length;
+ },
+
+ inspect: function() {
+ return '#<Enumerable:' + this.toArray().inspect() + '>';
+ }
+};
+
+Object.extend(Enumerable, {
+ map: Enumerable.collect,
+ find: Enumerable.detect,
+ select: Enumerable.findAll,
+ filter: Enumerable.findAll,
+ member: Enumerable.include,
+ entries: Enumerable.toArray,
+ every: Enumerable.all,
+ some: Enumerable.any
+});
+function $A(iterable) {
+ if (!iterable) return [];
+ if (iterable.toArray) return iterable.toArray();
+ var length = iterable.length || 0, results = new Array(length);
+ while (length--) results[length] = iterable[length];
+ return results;
+}
+
+if (Prototype.Browser.WebKit) {
+ $A = function(iterable) {
+ if (!iterable) return [];
+ // In Safari, only use the `toArray` method if it's not a NodeList.
+ // A NodeList is a function, has an function `item` property, and a numeric
+ // `length` property. Adapted from Google Doctype.
+ if (!(typeof iterable === 'function' && typeof iterable.length ===
+ 'number' && typeof iterable.item === 'function') && iterable.toArray)
+ return iterable.toArray();
+ var length = iterable.length || 0, results = new Array(length);
+ while (length--) results[length] = iterable[length];
+ return results;
+ };
+}
+
+Array.from = $A;
+
+Object.extend(Array.prototype, Enumerable);
+
+if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
+
+Object.extend(Array.prototype, {
+ _each: function(iterator) {
+ for (var i = 0, length = this.length; i < length; i++)
+ iterator(this[i]);
+ },
+
+ clear: function() {
+ this.length = 0;
+ return this;
+ },
+
+ first: function() {
+ return this[0];
+ },
+
+ last: function() {
+ return this[this.length - 1];
+ },
+
+ compact: function() {
+ return this.select(function(value) {
+ return value != null;
+ });
+ },
+
+ flatten: function() {
+ return this.inject([], function(array, value) {
+ return array.concat(Object.isArray(value) ?
+ value.flatten() : [value]);
+ });
+ },
+
+ without: function() {
+ var values = $A(arguments);
+ return this.select(function(value) {
+ return !values.include(value);
+ });
+ },
+
+ reverse: function(inline) {
+ return (inline !== false ? this : this.toArray())._reverse();
+ },
+
+ reduce: function() {
+ return this.length > 1 ? this : this[0];
+ },
+
+ uniq: function(sorted) {
+ return this.inject([], function(array, value, index) {
+ if (0 == index || (sorted ? array.last() != value : !array.include(value)))
+ array.push(value);
+ return array;
+ });
+ },
+
+ intersect: function(array) {
+ return this.uniq().findAll(function(item) {
+ return array.detect(function(value) { return item === value });
+ });
+ },
+
+ clone: function() {
+ return [].concat(this);
+ },
+
+ size: function() {
+ return this.length;
+ },
+
+ inspect: function() {
+ return '[' + this.map(Object.inspect).join(', ') + ']';
+ },
+
+ toJSON: function() {
+ var results = [];
+ this.each(function(object) {
+ var value = Object.toJSON(object);
+ if (!Object.isUndefined(value)) results.push(value);
+ });
+ return '[' + results.join(', ') + ']';
+ }
+});
+
+// use native browser JS 1.6 implementation if available
+if (Object.isFunction(Array.prototype.forEach))
+ Array.prototype._each = Array.prototype.forEach;
+
+if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
+ i || (i = 0);
+ var length = this.length;
+ if (i < 0) i = length + i;
+ for (; i < length; i++)
+ if (this[i] === item) return i;
+ return -1;
+};
+
+if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
+ i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
+ var n = this.slice(0, i).reverse().indexOf(item);
+ return (n < 0) ? n : i - n - 1;
+};
+
+Array.prototype.toArray = Array.prototype.clone;
+
+function $w(string) {
+ if (!Object.isString(string)) return [];
+ string = string.strip();
+ return string ? string.split(/\s+/) : [];
+}
+
+if (Prototype.Browser.Opera){
+ Array.prototype.concat = function() {
+ var array = [];
+ for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
+ for (var i = 0, length = arguments.length; i < length; i++) {
+ if (Object.isArray(arguments[i])) {
+ for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
+ array.push(arguments[i][j]);
+ } else {
+ array.push(arguments[i]);
+ }
+ }
+ return array;
+ };
+}
+Object.extend(Number.prototype, {
+ toColorPart: function() {
+ return this.toPaddedString(2, 16);
+ },
+
+ succ: function() {
+ return this + 1;
+ },
+
+ times: function(iterator, context) {
+ $R(0, this, true).each(iterator, context);
+ return this;
+ },
+
+ toPaddedString: function(length, radix) {
+ var string = this.toString(radix || 10);
+ return '0'.times(length - string.length) + string;
+ },
+
+ toJSON: function() {
+ return isFinite(this) ? this.toString() : 'null';
+ }
+});
+
+$w('abs round ceil floor').each(function(method){
+ Number.prototype[method] = Math[method].methodize();
+});
+function $H(object) {
+ return new Hash(object);
+};
+
+var Hash = Class.create(Enumerable, (function() {
+
+ function toQueryPair(key, value) {
+ if (Object.isUndefined(value)) return key;
+ return key + '=' + encodeURIComponent(String.interpret(value));
+ }
+
+ return {
+ initialize: function(object) {
+ this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
+ },
+
+ _each: function(iterator) {
+ for (var key in this._object) {
+ var value = this._object[key], pair = [key, value];
+ pair.key = key;
+ pair.value = value;
+ iterator(pair);
+ }
+ },
+
+ set: function(key, value) {
+ return this._object[key] = value;
+ },
+
+ get: function(key) {
+ // simulating poorly supported hasOwnProperty
+ if (this._object[key] !== Object.prototype[key])
+ return this._object[key];
+ },
+
+ unset: function(key) {
+ var value = this._object[key];
+ delete this._object[key];
+ return value;
+ },
+
+ toObject: function() {
+ return Object.clone(this._object);
+ },
+
+ keys: function() {
+ return this.pluck('key');
+ },
+
+ values: function() {
+ return this.pluck('value');
+ },
+
+ index: function(value) {
+ var match = this.detect(function(pair) {
+ return pair.value === value;
+ });
+ return match && match.key;
+ },
+
+ merge: function(object) {
+ return this.clone().update(object);
+ },
+
+ update: function(object) {
+ return new Hash(object).inject(this, function(result, pair) {
+ result.set(pair.key, pair.value);
+ return result;
+ });
+ },
+
+ toQueryString: function() {
+ return this.inject([], function(results, pair) {
+ var key = encodeURIComponent(pair.key), values = pair.value;
+
+ if (values && typeof values == 'object') {
+ if (Object.isArray(values))
+ return results.concat(values.map(toQueryPair.curry(key)));
+ } else results.push(toQueryPair(key, values));
+ return results;
+ }).join('&');
+ },
+
+ inspect: function() {
+ return '#<Hash:{' + this.map(function(pair) {
+ return pair.map(Object.inspect).join(': ');
+ }).join(', ') + '}>';
+ },
+
+ toJSON: function() {
+ return Object.toJSON(this.toObject());
+ },
+
+ clone: function() {
+ return new Hash(this);
+ }
+ }
+})());
+
+Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
+Hash.from = $H;
+var ObjectRange = Class.create(Enumerable, {
+ initialize: function(start, end, exclusive) {
+ this.start = start;
+ this.end = end;
+ this.exclusive = exclusive;
+ },
+
+ _each: function(iterator) {
+ var value = this.start;
+ while (this.include(value)) {
+ iterator(value);
+ value = value.succ();
+ }
+ },
+
+ include: function(value) {
+ if (value < this.start)
+ return false;
+ if (this.exclusive)
+ return value < this.end;
+ return value <= this.end;
+ }
+});
+
+var $R = function(start, end, exclusive) {
+ return new ObjectRange(start, end, exclusive);
+};
+
+var Ajax = {
+ getTransport: function() {
+ return Try.these(
+ function() {return new XMLHttpRequest()},
+ function() {return new ActiveXObject('Msxml2.XMLHTTP')},
+ function() {return new ActiveXObject('Microsoft.XMLHTTP')}
+ ) || false;
+ },
+
+ activeRequestCount: 0
+};
+
+Ajax.Responders = {
+ responders: [],
+
+ _each: function(iterator) {
+ this.responders._each(iterator);
+ },
+
+ register: function(responder) {
+ if (!this.include(responder))
+ this.responders.push(responder);
+ },
+
+ unregister: function(responder) {
+ this.responders = this.responders.without(responder);
+ },
+
+ dispatch: function(callback, request, transport, json) {
+ this.each(function(responder) {
+ if (Object.isFunction(responder[callback])) {
+ try {
+ responder[callback].apply(responder, [request, transport, json]);
+ } catch (e) { }
+ }
+ });
+ }
+};
+
+Object.extend(Ajax.Responders, Enumerable);
+
+Ajax.Responders.register({
+ onCreate: function() { Ajax.activeRequestCount++ },
+ onComplete: function() { Ajax.activeRequestCount-- }
+});
+
+Ajax.Base = Class.create({
+ initialize: function(options) {
+ this.options = {
+ method: 'post',
+ asynchronous: true,
+ contentType: 'application/x-www-form-urlencoded',
+ encoding: 'UTF-8',
+ parameters: '',
+ evalJSON: true,
+ evalJS: true
+ };
+ Object.extend(this.options, options || { });
+
+ this.options.method = this.options.method.toLowerCase();
+
+ if (Object.isString(this.options.parameters))
+ this.options.parameters = this.options.parameters.toQueryParams();
+ else if (Object.isHash(this.options.parameters))
+ this.options.parameters = this.options.parameters.toObject();
+ }
+});
+
+Ajax.Request = Class.create(Ajax.Base, {
+ _complete: false,
+
+ initialize: function($super, url, options) {
+ $super(options);
+ this.transport = Ajax.getTransport();
+ this.request(url);
+ },
+
+ request: function(url) {
+ this.url = url;
+ this.method = this.options.method;
+ var params = Object.clone(this.options.parameters);
+
+ if (!['get', 'post'].include(this.method)) {
+ // simulate other verbs over post
+ params['_method'] = this.method;
+ this.method = 'post';
+ }
+
+ this.parameters = params;
+
+ if (params = Object.toQueryString(params)) {
+ // when GET, append parameters to URL
+ if (this.method == 'get')
+ this.url += (this.url.include('?') ? '&' : '?') + params;
+ else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
+ params += '&_=';
+ }
+
+ try {
+ var response = new Ajax.Response(this);
+ if (this.options.onCreate) this.options.onCreate(response);
+ Ajax.Responders.dispatch('onCreate', this, response);
+
+ this.transport.open(this.method.toUpperCase(), this.url,
+ this.options.asynchronous);
+
+ if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
+
+ this.transport.onreadystatechange = this.onStateChange.bind(this);
+ this.setRequestHeaders();
+
+ this.body = this.method == 'post' ? (this.options.postBody || params) : null;
+ this.transport.send(this.body);
+
+ /* Force Firefox to handle ready state 4 for synchronous requests */
+ if (!this.options.asynchronous && this.transport.overrideMimeType)
+ this.onStateChange();
+
+ }
+ catch (e) {
+ this.dispatchException(e);
+ }
+ },
+
+ onStateChange: function() {
+ var readyState = this.transport.readyState;
+ if (readyState > 1 && !((readyState == 4) && this._complete))
+ this.respondToReadyState(this.transport.readyState);
+ },
+
+ setRequestHeaders: function() {
+ var headers = {
+ 'X-Requested-With': 'XMLHttpRequest',
+ 'X-Prototype-Version': Prototype.Version,
+ 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
+ };
+
+ if (this.method == 'post') {
+ headers['Content-type'] = this.options.contentType +
+ (this.options.encoding ? '; charset=' + this.options.encoding : '');
+
+ /* Force "Connection: close" for older Mozilla browsers to work
+ * around a bug where XMLHttpRequest sends an incorrect
+ * Content-length header. See Mozilla Bugzilla #246651.
+ */
+ if (this.transport.overrideMimeType &&
+ (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
+ headers['Connection'] = 'close';
+ }
+
+ // user-defined headers
+ if (typeof this.options.requestHeaders == 'object') {
+ var extras = this.options.requestHeaders;
+
+ if (Object.isFunction(extras.push))
+ for (var i = 0, length = extras.length; i < length; i += 2)
+ headers[extras[i]] = extras[i+1];
+ else
+ $H(extras).each(function(pair) { headers[pair.key] = pair.value });
+ }
+
+ for (var name in headers)
+ this.transport.setRequestHeader(name, headers[name]);
+ },
+
+ success: function() {
+ var status = this.getStatus();
+ return !status || (status >= 200 && status < 300);
+ },
+
+ getStatus: function() {
+ try {
+ return this.transport.status || 0;
+ } catch (e) { return 0 }
+ },
+
+ respondToReadyState: function(readyState) {
+ var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
+
+ if (state == 'Complete') {
+ try {
+ this._complete = true;
+ (this.options['on' + response.status]
+ || this.options['on' + (this.success() ? 'Success' : 'Failure')]
+ || Prototype.emptyFunction)(response, response.headerJSON);
+ } catch (e) {
+ this.dispatchException(e);
+ }
+
+ var contentType = response.getHeader('Content-type');
+ if (this.options.evalJS == 'force'
+ || (this.options.evalJS && this.isSameOrigin() && contentType
+ && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
+ this.evalResponse();
+ }
+
+ try {
+ (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
+ Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
+ } catch (e) {
+ this.dispatchException(e);
+ }
+
+ if (state == 'Complete') {
+ // avoid memory leak in MSIE: clean up
+ this.transport.onreadystatechange = Prototype.emptyFunction;
+ }
+ },
+
+ isSameOrigin: function() {
+ var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
+ return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
+ protocol: location.protocol,
+ domain: document.domain,
+ port: location.port ? ':' + location.port : ''
+ }));
+ },
+
+ getHeader: function(name) {
+ try {
+ return this.transport.getResponseHeader(name) || null;
+ } catch (e) { return null }
+ },
+
+ evalResponse: function() {
+ try {
+ return eval((this.transport.responseText || '').unfilterJSON());
+ } catch (e) {
+ this.dispatchException(e);
+ }
+ },
+
+ dispatchException: function(exception) {
+ (this.options.onException || Prototype.emptyFunction)(this, exception);
+ Ajax.Responders.dispatch('onException', this, exception);
+ }
+});
+
+Ajax.Request.Events =
+ ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
+
+Ajax.Response = Class.create({
+ initialize: function(request){
+ this.request = request;
+ var transport = this.transport = request.transport,
+ readyState = this.readyState = transport.readyState;
+
+ if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
+ this.status = this.getStatus();
+ this.statusText = this.getStatusText();
+ this.responseText = String.interpret(transport.responseText);
+ this.headerJSON = this._getHeaderJSON();
+ }
+
+ if(readyState == 4) {
+ var xml = transport.responseXML;
+ this.responseXML = Object.isUndefined(xml) ? null : xml;
+ this.responseJSON = this._getResponseJSON();
+ }
+ },
+
+ status: 0,
+ statusText: '',
+
+ getStatus: Ajax.Request.prototype.getStatus,
+
+ getStatusText: function() {
+ try {
+ return this.transport.statusText || '';
+ } catch (e) { return '' }
+ },
+
+ getHeader: Ajax.Request.prototype.getHeader,
+
+ getAllHeaders: function() {
+ try {
+ return this.getAllResponseHeaders();
+ } catch (e) { return null }
+ },
+
+ getResponseHeader: function(name) {
+ return this.transport.getResponseHeader(name);
+ },
+
+ getAllResponseHeaders: function() {
+ return this.transport.getAllResponseHeaders();
+ },
+
+ _getHeaderJSON: function() {
+ var json = this.getHeader('X-JSON');
+ if (!json) return null;
+ json = decodeURIComponent(escape(json));
+ try {
+ return json.evalJSON(this.request.options.sanitizeJSON ||
+ !this.request.isSameOrigin());
+ } catch (e) {
+ this.request.dispatchException(e);
+ }
+ },
+
+ _getResponseJSON: function() {
+ var options = this.request.options;
+ if (!options.evalJSON || (options.evalJSON != 'force' &&
+ !(this.getHeader('Content-type') || '').include('application/json')) ||
+ this.responseText.blank())
+ return null;
+ try {
+ return this.responseText.evalJSON(options.sanitizeJSON ||
+ !this.request.isSameOrigin());
+ } catch (e) {
+ this.request.dispatchException(e);
+ }
+ }
+});
+
+Ajax.Updater = Class.create(Ajax.Request, {
+ initialize: function($super, container, url, options) {
+ this.container = {
+ success: (container.success || container),
+ failure: (container.failure || (container.success ? null : container))
+ };
+
+ options = Object.clone(options);
+ var onComplete = options.onComplete;
+ options.onComplete = (function(response, json) {
+ this.updateContent(response.responseText);
+ if (Object.isFunction(onComplete)) onComplete(response, json);
+ }).bind(this);
+
+ $super(url, options);
+ },
+
+ updateContent: function(responseText) {
+ var receiver = this.container[this.success() ? 'success' : 'failure'],
+ options = this.options;
+
+ if (!options.evalScripts) responseText = responseText.stripScripts();
+
+ if (receiver = $(receiver)) {
+ if (options.insertion) {
+ if (Object.isString(options.insertion)) {
+ var insertion = { }; insertion[options.insertion] = responseText;
+ receiver.insert(insertion);
+ }
+ else options.insertion(receiver, responseText);
+ }
+ else receiver.update(responseText);
+ }
+ }
+});
+
+Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
+ initialize: function($super, container, url, options) {
+ $super(options);
+ this.onComplete = this.options.onComplete;
+
+ this.frequency = (this.options.frequency || 2);
+ this.decay = (this.options.decay || 1);
+
+ this.updater = { };
+ this.container = container;
+ this.url = url;
+
+ this.start();
+ },
+
+ start: function() {
+ this.options.onComplete = this.updateComplete.bind(this);
+ this.onTimerEvent();
+ },
+
+ stop: function() {
+ this.updater.options.onComplete = undefined;
+ clearTimeout(this.timer);
+ (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
+ },
+
+ updateComplete: function(response) {
+ if (this.options.decay) {
+ this.decay = (response.responseText == this.lastText ?
+ this.decay * this.options.decay : 1);
+
+ this.lastText = response.responseText;
+ }
+ this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
+ },
+
+ onTimerEvent: function() {
+ this.updater = new Ajax.Updater(this.container, this.url, this.options);
+ }
+});
+function $(element) {
+ if (arguments.length > 1) {
+ for (var i = 0, elements = [], length = arguments.length; i < length; i++)
+ elements.push($(arguments[i]));
+ return elements;
+ }
+ if (Object.isString(element))
+ element = document.getElementById(element);
+ return Element.extend(element);
+}
+
+if (Prototype.BrowserFeatures.XPath) {
+ document._getElementsByXPath = function(expression, parentElement) {
+ var results = [];
+ var query = document.evaluate(expression, $(parentElement) || document,
+ null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+ for (var i = 0, length = query.snapshotLength; i < length; i++)
+ results.push(Element.extend(query.snapshotItem(i)));
+ return results;
+ };
+}
+
+/*--------------------------------------------------------------------------*/
+
+if (!window.Node) var Node = { };
+
+if (!Node.ELEMENT_NODE) {
+ // DOM level 2 ECMAScript Language Binding
+ Object.extend(Node, {
+ ELEMENT_NODE: 1,
+ ATTRIBUTE_NODE: 2,
+ TEXT_NODE: 3,
+ CDATA_SECTION_NODE: 4,
+ ENTITY_REFERENCE_NODE: 5,
+ ENTITY_NODE: 6,
+ PROCESSING_INSTRUCTION_NODE: 7,
+ COMMENT_NODE: 8,
+ DOCUMENT_NODE: 9,
+ DOCUMENT_TYPE_NODE: 10,
+ DOCUMENT_FRAGMENT_NODE: 11,
+ NOTATION_NODE: 12
+ });
+}
+
+(function() {
+ var element = this.Element;
+ this.Element = function(tagName, attributes) {
+ attributes = attributes || { };
+ tagName = tagName.toLowerCase();
+ var cache = Element.cache;
+ if (Prototype.Browser.IE && attributes.name) {
+ tagName = '<' + tagName + ' name="' + attributes.name + '">';
+ delete attributes.name;
+ return Element.writeAttribute(document.createElement(tagName), attributes);
+ }
+ if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
+ return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
+ };
+ Object.extend(this.Element, element || { });
+ if (element) this.Element.prototype = element.prototype;
+}).call(window);
+
+Element.cache = { };
+
+Element.Methods = {
+ visible: function(element) {
+ return $(element).style.display != 'none';
+ },
+
+ toggle: function(element) {
+ element = $(element);
+ Element[Element.visible(element) ? 'hide' : 'show'](element);
+ return element;
+ },
+
+ hide: function(element) {
+ element = $(element);
+ element.style.display = 'none';
+ return element;
+ },
+
+ show: function(element) {
+ element = $(element);
+ element.style.display = '';
+ return element;
+ },
+
+ remove: function(element) {
+ element = $(element);
+ element.parentNode.removeChild(element);
+ return element;
+ },
+
+ update: function(element, content) {
+ element = $(element);
+ if (content && content.toElement) content = content.toElement();
+ if (Object.isElement(content)) return element.update().insert(content);
+ content = Object.toHTML(content);
+ element.innerHTML = content.stripScripts();
+ content.evalScripts.bind(content).defer();
+ return element;
+ },
+
+ replace: function(element, content) {
+ element = $(element);
+ if (content && content.toElement) content = content.toElement();
+ else if (!Object.isElement(content)) {
+ content = Object.toHTML(content);
+ var range = element.ownerDocument.createRange();
+ range.selectNode(element);
+ content.evalScripts.bind(content).defer();
+ content = range.createContextualFragment(content.stripScripts());
+ }
+ element.parentNode.replaceChild(content, element);
+ return element;
+ },
+
+ insert: function(element, insertions) {
+ element = $(element);
+
+ if (Object.isString(insertions) || Object.isNumber(insertions) ||
+ Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
+ insertions = {bottom:insertions};
+
+ var content, insert, tagName, childNodes;
+
+ for (var position in insertions) {
+ content = insertions[position];
+ position = position.toLowerCase();
+ insert = Element._insertionTranslations[position];
+
+ if (content && content.toElement) content = content.toElement();
+ if (Object.isElement(content)) {
+ insert(element, content);
+ continue;
+ }
+
+ content = Object.toHTML(content);
+
+ tagName = ((position == 'before' || position == 'after')
+ ? element.parentNode : element).tagName.toUpperCase();
+
+ childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
+
+ if (position == 'top' || position == 'after') childNodes.reverse();
+ childNodes.each(insert.curry(element));
+
+ content.evalScripts.bind(content).defer();
+ }
+
+ return element;
+ },
+
+ wrap: function(element, wrapper, attributes) {
+ element = $(element);
+ if (Object.isElement(wrapper))
+ $(wrapper).writeAttribute(attributes || { });
+ else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
+ else wrapper = new Element('div', wrapper);
+ if (element.parentNode)
+ element.parentNode.replaceChild(wrapper, element);
+ wrapper.appendChild(element);
+ return wrapper;
+ },
+
+ inspect: function(element) {
+ element = $(element);
+ var result = '<' + element.tagName.toLowerCase();
+ $H({'id': 'id', 'className': 'class'}).each(function(pair) {
+ var property = pair.first(), attribute = pair.last();
+ var value = (element[property] || '').toString();
+ if (value) result += ' ' + attribute + '=' + value.inspect(true);
+ });
+ return result + '>';
+ },
+
+ recursivelyCollect: function(element, property) {
+ element = $(element);
+ var elements = [];
+ while (element = element[property])
+ if (element.nodeType == 1)
+ elements.push(Element.extend(element));
+ return elements;
+ },
+
+ ancestors: function(element) {
+ return $(element).recursivelyCollect('parentNode');
+ },
+
+ descendants: function(element) {
+ return $(element).select("*");
+ },
+
+ firstDescendant: function(element) {
+ element = $(element).firstChild;
+ while (element && element.nodeType != 1) element = element.nextSibling;
+ return $(element);
+ },
+
+ immediateDescendants: function(element) {
+ if (!(element = $(element).firstChild)) return [];
+ while (element && element.nodeType != 1) element = element.nextSibling;
+ if (element) return [element].concat($(element).nextSiblings());
+ return [];
+ },
+
+ previousSiblings: function(element) {
+ return $(element).recursivelyCollect('previousSibling');
+ },
+
+ nextSiblings: function(element) {
+ return $(element).recursivelyCollect('nextSibling');
+ },
+
+ siblings: function(element) {
+ element = $(element);
+ return element.previousSiblings().reverse().concat(element.nextSiblings());
+ },
+
+ match: function(element, selector) {
+ if (Object.isString(selector))
+ selector = new Selector(selector);
+ return selector.match($(element));
+ },
+
+ up: function(element, expression, index) {
+ element = $(element);
+ if (arguments.length == 1) return $(element.parentNode);
+ var ancestors = element.ancestors();
+ return Object.isNumber(expression) ? ancestors[expression] :
+ Selector.findElement(ancestors, expression, index);
+ },
+
+ down: function(element, expression, index) {
+ element = $(element);
+ if (arguments.length == 1) return element.firstDescendant();
+ return Object.isNumber(expression) ? element.descendants()[expression] :
+ Element.select(element, expression)[index || 0];
+ },
+
+ previous: function(element, expression, index) {
+ element = $(element);
+ if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
+ var previousSiblings = element.previousSiblings();
+ return Object.isNumber(expression) ? previousSiblings[expression] :
+ Selector.findElement(previousSiblings, expression, index);
+ },
+
+ next: function(element, expression, index) {
+ element = $(element);
+ if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
+ var nextSiblings = element.nextSiblings();
+ return Object.isNumber(expression) ? nextSiblings[expression] :
+ Selector.findElement(nextSiblings, expression, index);
+ },
+
+ select: function() {
+ var args = $A(arguments), element = $(args.shift());
+ return Selector.findChildElements(element, args);
+ },
+
+ adjacent: function() {
+ var args = $A(arguments), element = $(args.shift());
+ return Selector.findChildElements(element.parentNode, args).without(element);
+ },
+
+ identify: function(element) {
+ element = $(element);
+ var id = element.readAttribute('id'), self = arguments.callee;
+ if (id) return id;
+ do { id = 'anonymous_element_' + self.counter++ } while ($(id));
+ element.writeAttribute('id', id);
+ return id;
+ },
+
+ readAttribute: function(element, name) {
+ element = $(element);
+ if (Prototype.Browser.IE) {
+ var t = Element._attributeTranslations.read;
+ if (t.values[name]) return t.values[name](element, name);
+ if (t.names[name]) name = t.names[name];
+ if (name.include(':')) {
+ return (!element.attributes || !element.attributes[name]) ? null :
+ element.attributes[name].value;
+ }
+ }
+ return element.getAttribute(name);
+ },
+
+ writeAttribute: function(element, name, value) {
+ element = $(element);
+ var attributes = { }, t = Element._attributeTranslations.write;
+
+ if (typeof name == 'object') attributes = name;
+ else attributes[name] = Object.isUndefined(value) ? true : value;
+
+ for (var attr in attributes) {
+ name = t.names[attr] || attr;
+ value = attributes[attr];
+ if (t.values[attr]) name = t.values[attr](element, value);
+ if (value === false || value === null)
+ element.removeAttribute(name);
+ else if (value === true)
+ element.setAttribute(name, name);
+ else element.setAttribute(name, value);
+ }
+ return element;
+ },
+
+ getHeight: function(element) {
+ return $(element).getDimensions().height;
+ },
+
+ getWidth: function(element) {
+ return $(element).getDimensions().width;
+ },
+
+ classNames: function(element) {
+ return new Element.ClassNames(element);
+ },
+
+ hasClassName: function(element, className) {
+ if (!(element = $(element))) return;
+ var elementClassName = element.className;
+ return (elementClassName.length > 0 && (elementClassName == className ||
+ new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
+ },
+
+ addClassName: function(element, className) {
+ if (!(element = $(element))) return;
+ if (!element.hasClassName(className))
+ element.className += (element.className ? ' ' : '') + className;
+ return element;
+ },
+
+ removeClassName: function(element, className) {
+ if (!(element = $(element))) return;
+ element.className = element.className.replace(
+ new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
+ return element;
+ },
+
+ toggleClassName: function(element, className) {
+ if (!(element = $(element))) return;
+ return element[element.hasClassName(className) ?
+ 'removeClassName' : 'addClassName'](className);
+ },
+
+ // removes whitespace-only text node children
+ cleanWhitespace: function(element) {
+ element = $(element);
+ var node = element.firstChild;
+ while (node) {
+ var nextNode = node.nextSibling;
+ if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
+ element.removeChild(node);
+ node = nextNode;
+ }
+ return element;
+ },
+
+ empty: function(element) {
+ return $(element).innerHTML.blank();
+ },
+
+ descendantOf: function(element, ancestor) {
+ element = $(element), ancestor = $(ancestor);
+
+ if (element.compareDocumentPosition)
+ return (element.compareDocumentPosition(ancestor) & 8) === 8;
+
+ if (ancestor.contains)
+ return ancestor.contains(element) && ancestor !== element;
+
+ while (element = element.parentNode)
+ if (element == ancestor) return true;
+
+ return false;
+ },
+
+ scrollTo: function(element) {
+ element = $(element);
+ var pos = element.cumulativeOffset();
+ window.scrollTo(pos[0], pos[1]);
+ return element;
+ },
+
+ getStyle: function(element, style) {
+ element = $(element);
+ style = style == 'float' ? 'cssFloat' : style.camelize();
+ var value = element.style[style];
+ if (!value || value == 'auto') {
+ var css = document.defaultView.getComputedStyle(element, null);
+ value = css ? css[style] : null;
+ }
+ if (style == 'opacity') return value ? parseFloat(value) : 1.0;
+ return value == 'auto' ? null : value;
+ },
+
+ getOpacity: function(element) {
+ return $(element).getStyle('opacity');
+ },
+
+ setStyle: function(element, styles) {
+ element = $(element);
+ var elementStyle = element.style, match;
+ if (Object.isString(styles)) {
+ element.style.cssText += ';' + styles;
+ return styles.include('opacity') ?
+ element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
+ }
+ for (var property in styles)
+ if (property == 'opacity') element.setOpacity(styles[property]);
+ else
+ elementStyle[(property == 'float' || property == 'cssFloat') ?
+ (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
+ property] = styles[property];
+
+ return element;
+ },
+
+ setOpacity: function(element, value) {
+ element = $(element);
+ element.style.opacity = (value == 1 || value === '') ? '' :
+ (value < 0.00001) ? 0 : value;
+ return element;
+ },
+
+ getDimensions: function(element) {
+ element = $(element);
+ var display = element.getStyle('display');
+ if (display != 'none' && display != null) // Safari bug
+ return {width: element.offsetWidth, height: element.offsetHeight};
+
+ // All *Width and *Height properties give 0 on elements with display none,
+ // so enable the element temporarily
+ var els = element.style;
+ var originalVisibility = els.visibility;
+ var originalPosition = els.position;
+ var originalDisplay = els.display;
+ els.visibility = 'hidden';
+ els.position = 'absolute';
+ els.display = 'block';
+ var originalWidth = element.clientWidth;
+ var originalHeight = element.clientHeight;
+ els.display = originalDisplay;
+ els.position = originalPosition;
+ els.visibility = originalVisibility;
+ return {width: originalWidth, height: originalHeight};
+ },
+
+ makePositioned: function(element) {
+ element = $(element);
+ var pos = Element.getStyle(element, 'position');
+ if (pos == 'static' || !pos) {
+ element._madePositioned = true;
+ element.style.position = 'relative';
+ // Opera returns the offset relative to the positioning context, when an
+ // element is position relative but top and left have not been defined
+ if (Prototype.Browser.Opera) {
+ element.style.top = 0;
+ element.style.left = 0;
+ }
+ }
+ return element;
+ },
+
+ undoPositioned: function(element) {
+ element = $(element);
+ if (element._madePositioned) {
+ element._madePositioned = undefined;
+ element.style.position =
+ element.style.top =
+ element.style.left =
+ element.style.bottom =
+ element.style.right = '';
+ }
+ return element;
+ },
+
+ makeClipping: function(element) {
+ element = $(element);
+ if (element._overflow) return element;
+ element._overflow = Element.getStyle(element, 'overflow') || 'auto';
+ if (element._overflow !== 'hidden')
+ element.style.overflow = 'hidden';
+ return element;
+ },
+
+ undoClipping: function(element) {
+ element = $(element);
+ if (!element._overflow) return element;
+ element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
+ element._overflow = null;
+ return element;
+ },
+
+ cumulativeOffset: function(element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ element = element.offsetParent;
+ } while (element);
+ return Element._returnOffset(valueL, valueT);
+ },
+
+ positionedOffset: function(element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ element = element.offsetParent;
+ if (element) {
+ if (element.tagName.toUpperCase() == 'BODY') break;
+ var p = Element.getStyle(element, 'position');
+ if (p !== 'static') break;
+ }
+ } while (element);
+ return Element._returnOffset(valueL, valueT);
+ },
+
+ absolutize: function(element) {
+ element = $(element);
+ if (element.getStyle('position') == 'absolute') return element;
+ // Position.prepare(); // To be done manually by Scripty when it needs it.
+
+ var offsets = element.positionedOffset();
+ var top = offsets[1];
+ var left = offsets[0];
+ var width = element.clientWidth;
+ var height = element.clientHeight;
+
+ element._originalLeft = left - parseFloat(element.style.left || 0);
+ element._originalTop = top - parseFloat(element.style.top || 0);
+ element._originalWidth = element.style.width;
+ element._originalHeight = element.style.height;
+
+ element.style.position = 'absolute';
+ element.style.top = top + 'px';
+ element.style.left = left + 'px';
+ element.style.width = width + 'px';
+ element.style.height = height + 'px';
+ return element;
+ },
+
+ relativize: function(element) {
+ element = $(element);
+ if (element.getStyle('position') == 'relative') return element;
+ // Position.prepare(); // To be done manually by Scripty when it needs it.
+
+ element.style.position = 'relative';
+ var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
+ var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
+
+ element.style.top = top + 'px';
+ element.style.left = left + 'px';
+ element.style.height = element._originalHeight;
+ element.style.width = element._originalWidth;
+ return element;
+ },
+
+ cumulativeScrollOffset: function(element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.scrollTop || 0;
+ valueL += element.scrollLeft || 0;
+ element = element.parentNode;
+ } while (element);
+ return Element._returnOffset(valueL, valueT);
+ },
+
+ getOffsetParent: function(element) {
+ if (element.offsetParent) return $(element.offsetParent);
+ if (element == document.body) return $(element);
+
+ while ((element = element.parentNode) && element != document.body)
+ if (Element.getStyle(element, 'position') != 'static')
+ return $(element);
+
+ return $(document.body);
+ },
+
+ viewportOffset: function(forElement) {
+ var valueT = 0, valueL = 0;
+
+ var element = forElement;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+
+ // Safari fix
+ if (element.offsetParent == document.body &&
+ Element.getStyle(element, 'position') == 'absolute') break;
+
+ } while (element = element.offsetParent);
+
+ element = forElement;
+ do {
+ if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) {
+ valueT -= element.scrollTop || 0;
+ valueL -= element.scrollLeft || 0;
+ }
+ } while (element = element.parentNode);
+
+ return Element._returnOffset(valueL, valueT);
+ },
+
+ clonePosition: function(element, source) {
+ var options = Object.extend({
+ setLeft: true,
+ setTop: true,
+ setWidth: true,
+ setHeight: true,
+ offsetTop: 0,
+ offsetLeft: 0
+ }, arguments[2] || { });
+
+ // find page position of source
+ source = $(source);
+ var p = source.viewportOffset();
+
+ // find coordinate system to use
+ element = $(element);
+ var delta = [0, 0];
+ var parent = null;
+ // delta [0,0] will do fine with position: fixed elements,
+ // position:absolute needs offsetParent deltas
+ if (Element.getStyle(element, 'position') == 'absolute') {
+ parent = element.getOffsetParent();
+ delta = parent.viewportOffset();
+ }
+
+ // correct by body offsets (fixes Safari)
+ if (parent == document.body) {
+ delta[0] -= document.body.offsetLeft;
+ delta[1] -= document.body.offsetTop;
+ }
+
+ // set position
+ if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
+ if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
+ if (options.setWidth) element.style.width = source.offsetWidth + 'px';
+ if (options.setHeight) element.style.height = source.offsetHeight + 'px';
+ return element;
+ }
+};
+
+Element.Methods.identify.counter = 1;
+
+Object.extend(Element.Methods, {
+ getElementsBySelector: Element.Methods.select,
+ childElements: Element.Methods.immediateDescendants
+});
+
+Element._attributeTranslations = {
+ write: {
+ names: {
+ className: 'class',
+ htmlFor: 'for'
+ },
+ values: { }
+ }
+};
+
+if (Prototype.Browser.Opera) {
+ Element.Methods.getStyle = Element.Methods.getStyle.wrap(
+ function(proceed, element, style) {
+ switch (style) {
+ case 'left': case 'top': case 'right': case 'bottom':
+ if (proceed(element, 'position') === 'static') return null;
+ case 'height': case 'width':
+ // returns '0px' for hidden elements; we want it to return null
+ if (!Element.visible(element)) return null;
+
+ // returns the border-box dimensions rather than the content-box
+ // dimensions, so we subtract padding and borders from the value
+ var dim = parseInt(proceed(element, style), 10);
+
+ if (dim !== element['offset' + style.capitalize()])
+ return dim + 'px';
+
+ var properties;
+ if (style === 'height') {
+ properties = ['border-top-width', 'padding-top',
+ 'padding-bottom', 'border-bottom-width'];
+ }
+ else {
+ properties = ['border-left-width', 'padding-left',
+ 'padding-right', 'border-right-width'];
+ }
+ return properties.inject(dim, function(memo, property) {
+ var val = proceed(element, property);
+ return val === null ? memo : memo - parseInt(val, 10);
+ }) + 'px';
+ default: return proceed(element, style);
+ }
+ }
+ );
+
+ Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
+ function(proceed, element, attribute) {
+ if (attribute === 'title') return element.title;
+ return proceed(element, attribute);
+ }
+ );
+}
+
+else if (Prototype.Browser.IE) {
+ // IE doesn't report offsets correctly for static elements, so we change them
+ // to "relative" to get the values, then change them back.
+ Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
+ function(proceed, element) {
+ element = $(element);
+ // IE throws an error if element is not in document
+ try { element.offsetParent }
+ catch(e) { return $(document.body) }
+ var position = element.getStyle('position');
+ if (position !== 'static') return proceed(element);
+ element.setStyle({ position: 'relative' });
+ var value = proceed(element);
+ element.setStyle({ position: position });
+ return value;
+ }
+ );
+
+ $w('positionedOffset viewportOffset').each(function(method) {
+ Element.Methods[method] = Element.Methods[method].wrap(
+ function(proceed, element) {
+ element = $(element);
+ try { element.offsetParent }
+ catch(e) { return Element._returnOffset(0,0) }
+ var position = element.getStyle('position');
+ if (position !== 'static') return proceed(element);
+ // Trigger hasLayout on the offset parent so that IE6 reports
+ // accurate offsetTop and offsetLeft values for position: fixed.
+ var offsetParent = element.getOffsetParent();
+ if (offsetParent && offsetParent.getStyle('position') === 'fixed')
+ offsetParent.setStyle({ zoom: 1 });
+ element.setStyle({ position: 'relative' });
+ var value = proceed(element);
+ element.setStyle({ position: position });
+ return value;
+ }
+ );
+ });
+
+ Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap(
+ function(proceed, element) {
+ try { element.offsetParent }
+ catch(e) { return Element._returnOffset(0,0) }
+ return proceed(element);
+ }
+ );
+
+ Element.Methods.getStyle = function(element, style) {
+ element = $(element);
+ style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
+ var value = element.style[style];
+ if (!value && element.currentStyle) value = element.currentStyle[style];
+
+ if (style == 'opacity') {
+ if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
+ if (value[1]) return parseFloat(value[1]) / 100;
+ return 1.0;
+ }
+
+ if (value == 'auto') {
+ if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
+ return element['offset' + style.capitalize()] + 'px';
+ return null;
+ }
+ return value;
+ };
+
+ Element.Methods.setOpacity = function(element, value) {
+ function stripAlpha(filter){
+ return filter.replace(/alpha\([^\)]*\)/gi,'');
+ }
+ element = $(element);
+ var currentStyle = element.currentStyle;
+ if ((currentStyle && !currentStyle.hasLayout) ||
+ (!currentStyle && element.style.zoom == 'normal'))
+ element.style.zoom = 1;
+
+ var filter = element.getStyle('filter'), style = element.style;
+ if (value == 1 || value === '') {
+ (filter = stripAlpha(filter)) ?
+ style.filter = filter : style.removeAttribute('filter');
+ return element;
+ } else if (value < 0.00001) value = 0;
+ style.filter = stripAlpha(filter) +
+ 'alpha(opacity=' + (value * 100) + ')';
+ return element;
+ };
+
+ Element._attributeTranslations = {
+ read: {
+ names: {
+ 'class': 'className',
+ 'for': 'htmlFor'
+ },
+ values: {
+ _getAttr: function(element, attribute) {
+ return element.getAttribute(attribute, 2);
+ },
+ _getAttrNode: function(element, attribute) {
+ var node = element.getAttributeNode(attribute);
+ return node ? node.value : "";
+ },
+ _getEv: function(element, attribute) {
+ attribute = element.getAttribute(attribute);
+ return attribute ? attribute.toString().slice(23, -2) : null;
+ },
+ _flag: function(element, attribute) {
+ return $(element).hasAttribute(attribute) ? attribute : null;
+ },
+ style: function(element) {
+ return element.style.cssText.toLowerCase();
+ },
+ title: function(element) {
+ return element.title;
+ }
+ }
+ }
+ };
+
+ Element._attributeTranslations.write = {
+ names: Object.extend({
+ cellpadding: 'cellPadding',
+ cellspacing: 'cellSpacing'
+ }, Element._attributeTranslations.read.names),
+ values: {
+ checked: function(element, value) {
+ element.checked = !!value;
+ },
+
+ style: function(element, value) {
+ element.style.cssText = value ? value : '';
+ }
+ }
+ };
+
+ Element._attributeTranslations.has = {};
+
+ $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
+ 'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
+ Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
+ Element._attributeTranslations.has[attr.toLowerCase()] = attr;
+ });
+
+ (function(v) {
+ Object.extend(v, {
+ href: v._getAttr,
+ src: v._getAttr,
+ type: v._getAttr,
+ action: v._getAttrNode,
+ disabled: v._flag,
+ checked: v._flag,
+ readonly: v._flag,
+ multiple: v._flag,
+ onload: v._getEv,
+ onunload: v._getEv,
+ onclick: v._getEv,
+ ondblclick: v._getEv,
+ onmousedown: v._getEv,
+ onmouseup: v._getEv,
+ onmouseover: v._getEv,
+ onmousemove: v._getEv,
+ onmouseout: v._getEv,
+ onfocus: v._getEv,
+ onblur: v._getEv,
+ onkeypress: v._getEv,
+ onkeydown: v._getEv,
+ onkeyup: v._getEv,
+ onsubmit: v._getEv,
+ onreset: v._getEv,
+ onselect: v._getEv,
+ onchange: v._getEv
+ });
+ })(Element._attributeTranslations.read.values);
+}
+
+else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
+ Element.Methods.setOpacity = function(element, value) {
+ element = $(element);
+ element.style.opacity = (value == 1) ? 0.999999 :
+ (value === '') ? '' : (value < 0.00001) ? 0 : value;
+ return element;
+ };
+}
+
+else if (Prototype.Browser.WebKit) {
+ Element.Methods.setOpacity = function(element, value) {
+ element = $(element);
+ element.style.opacity = (value == 1 || value === '') ? '' :
+ (value < 0.00001) ? 0 : value;
+
+ if (value == 1)
+ if(element.tagName.toUpperCase() == 'IMG' && element.width) {
+ element.width++; element.width--;
+ } else try {
+ var n = document.createTextNode(' ');
+ element.appendChild(n);
+ element.removeChild(n);
+ } catch (e) { }
+
+ return element;
+ };
+
+ // Safari returns margins on body which is incorrect if the child is absolutely
+ // positioned. For performance reasons, redefine Element#cumulativeOffset for
+ // KHTML/WebKit only.
+ Element.Methods.cumulativeOffset = function(element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ if (element.offsetParent == document.body)
+ if (Element.getStyle(element, 'position') == 'absolute') break;
+
+ element = element.offsetParent;
+ } while (element);
+
+ return Element._returnOffset(valueL, valueT);
+ };
+}
+
+if (Prototype.Browser.IE || Prototype.Browser.Opera) {
+ // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
+ Element.Methods.update = function(element, content) {
+ element = $(element);
+
+ if (content && content.toElement) content = content.toElement();
+ if (Object.isElement(content)) return element.update().insert(content);
+
+ content = Object.toHTML(content);
+ var tagName = element.tagName.toUpperCase();
+
+ if (tagName in Element._insertionTranslations.tags) {
+ $A(element.childNodes).each(function(node) { element.removeChild(node) });
+ Element._getContentFromAnonymousElement(tagName, content.stripScripts())
+ .each(function(node) { element.appendChild(node) });
+ }
+ else element.innerHTML = content.stripScripts();
+
+ content.evalScripts.bind(content).defer();
+ return element;
+ };
+}
+
+if ('outerHTML' in document.createElement('div')) {
+ Element.Methods.replace = function(element, content) {
+ element = $(element);
+
+ if (content && content.toElement) content = content.toElement();
+ if (Object.isElement(content)) {
+ element.parentNode.replaceChild(content, element);
+ return element;
+ }
+
+ content = Object.toHTML(content);
+ var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
+
+ if (Element._insertionTranslations.tags[tagName]) {
+ var nextSibling = element.next();
+ var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
+ parent.removeChild(element);
+ if (nextSibling)
+ fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
+ else
+ fragments.each(function(node) { parent.appendChild(node) });
+ }
+ else element.outerHTML = content.stripScripts();
+
+ content.evalScripts.bind(content).defer();
+ return element;
+ };
+}
+
+Element._returnOffset = function(l, t) {
+ var result = [l, t];
+ result.left = l;
+ result.top = t;
+ return result;
+};
+
+Element._getContentFromAnonymousElement = function(tagName, html) {
+ var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
+ if (t) {
+ div.innerHTML = t[0] + html + t[1];
+ t[2].times(function() { div = div.firstChild });
+ } else div.innerHTML = html;
+ return $A(div.childNodes);
+};
+
+Element._insertionTranslations = {
+ before: function(element, node) {
+ element.parentNode.insertBefore(node, element);
+ },
+ top: function(element, node) {
+ element.insertBefore(node, element.firstChild);
+ },
+ bottom: function(element, node) {
+ element.appendChild(node);
+ },
+ after: function(element, node) {
+ element.parentNode.insertBefore(node, element.nextSibling);
+ },
+ tags: {
+ TABLE: ['<table>', '</table>', 1],
+ TBODY: ['<table><tbody>', '</tbody></table>', 2],
+ TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3],
+ TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
+ SELECT: ['<select>', '</select>', 1]
+ }
+};
+
+(function() {
+ Object.extend(this.tags, {
+ THEAD: this.tags.TBODY,
+ TFOOT: this.tags.TBODY,
+ TH: this.tags.TD
+ });
+}).call(Element._insertionTranslations);
+
+Element.Methods.Simulated = {
+ hasAttribute: function(element, attribute) {
+ attribute = Element._attributeTranslations.has[attribute] || attribute;
+ var node = $(element).getAttributeNode(attribute);
+ return !!(node && node.specified);
+ }
+};
+
+Element.Methods.ByTag = { };
+
+Object.extend(Element, Element.Methods);
+
+if (!Prototype.BrowserFeatures.ElementExtensions &&
+ document.createElement('div')['__proto__']) {
+ window.HTMLElement = { };
+ window.HTMLElement.prototype = document.createElement('div')['__proto__'];
+ Prototype.BrowserFeatures.ElementExtensions = true;
+}
+
+Element.extend = (function() {
+ if (Prototype.BrowserFeatures.SpecificElementExtensions)
+ return Prototype.K;
+
+ var Methods = { }, ByTag = Element.Methods.ByTag;
+
+ var extend = Object.extend(function(element) {
+ if (!element || element._extendedByPrototype ||
+ element.nodeType != 1 || element == window) return element;
+
+ var methods = Object.clone(Methods),
+ tagName = element.tagName.toUpperCase(), property, value;
+
+ // extend methods for specific tags
+ if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
+
+ for (property in methods) {
+ value = methods[property];
+ if (Object.isFunction(value) && !(property in element))
+ element[property] = value.methodize();
+ }
+
+ element._extendedByPrototype = Prototype.emptyFunction;
+ return element;
+
+ }, {
+ refresh: function() {
+ // extend methods for all tags (Safari doesn't need this)
+ if (!Prototype.BrowserFeatures.ElementExtensions) {
+ Object.extend(Methods, Element.Methods);
+ Object.extend(Methods, Element.Methods.Simulated);
+ }
+ }
+ });
+
+ extend.refresh();
+ return extend;
+})();
+
+Element.hasAttribute = function(element, attribute) {
+ if (element.hasAttribute) return element.hasAttribute(attribute);
+ return Element.Methods.Simulated.hasAttribute(element, attribute);
+};
+
+Element.addMethods = function(methods) {
+ var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
+
+ if (!methods) {
+ Object.extend(Form, Form.Methods);
+ Object.extend(Form.Element, Form.Element.Methods);
+ Object.extend(Element.Methods.ByTag, {
+ "FORM": Object.clone(Form.Methods),
+ "INPUT": Object.clone(Form.Element.Methods),
+ "SELECT": Object.clone(Form.Element.Methods),
+ "TEXTAREA": Object.clone(Form.Element.Methods)
+ });
+ }
+
+ if (arguments.length == 2) {
+ var tagName = methods;
+ methods = arguments[1];
+ }
+
+ if (!tagName) Object.extend(Element.Methods, methods || { });
+ else {
+ if (Object.isArray(tagName)) tagName.each(extend);
+ else extend(tagName);
+ }
+
+ function extend(tagName) {
+ tagName = tagName.toUpperCase();
+ if (!Element.Methods.ByTag[tagName])
+ Element.Methods.ByTag[tagName] = { };
+ Object.extend(Element.Methods.ByTag[tagName], methods);
+ }
+
+ function copy(methods, destination, onlyIfAbsent) {
+ onlyIfAbsent = onlyIfAbsent || false;
+ for (var property in methods) {
+ var value = methods[property];
+ if (!Object.isFunction(value)) continue;
+ if (!onlyIfAbsent || !(property in destination))
+ destination[property] = value.methodize();
+ }
+ }
+
+ function findDOMClass(tagName) {
+ var klass;
+ var trans = {
+ "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
+ "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
+ "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
+ "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
+ "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
+ "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
+ "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
+ "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
+ "FrameSet", "IFRAME": "IFrame"
+ };
+ if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
+ if (window[klass]) return window[klass];
+ klass = 'HTML' + tagName + 'Element';
+ if (window[klass]) return window[klass];
+ klass = 'HTML' + tagName.capitalize() + 'Element';
+ if (window[klass]) return window[klass];
+
+ window[klass] = { };
+ window[klass].prototype = document.createElement(tagName)['__proto__'];
+ return window[klass];
+ }
+
+ if (F.ElementExtensions) {
+ copy(Element.Methods, HTMLElement.prototype);
+ copy(Element.Methods.Simulated, HTMLElement.prototype, true);
+ }
+
+ if (F.SpecificElementExtensions) {
+ for (var tag in Element.Methods.ByTag) {
+ var klass = findDOMClass(tag);
+ if (Object.isUndefined(klass)) continue;
+ copy(T[tag], klass.prototype);
+ }
+ }
+
+ Object.extend(Element, Element.Methods);
+ delete Element.ByTag;
+
+ if (Element.extend.refresh) Element.extend.refresh();
+ Element.cache = { };
+};
+
+document.viewport = {
+ getDimensions: function() {
+ var dimensions = { }, B = Prototype.Browser;
+ $w('width height').each(function(d) {
+ var D = d.capitalize();
+ if (B.WebKit && !document.evaluate) {
+ // Safari <3.0 needs self.innerWidth/Height
+ dimensions[d] = self['inner' + D];
+ } else if (B.Opera && parseFloat(window.opera.version()) < 9.5) {
+ // Opera <9.5 needs document.body.clientWidth/Height
+ dimensions[d] = document.body['client' + D]
+ } else {
+ dimensions[d] = document.documentElement['client' + D];
+ }
+ });
+ return dimensions;
+ },
+
+ getWidth: function() {
+ return this.getDimensions().width;
+ },
+
+ getHeight: function() {
+ return this.getDimensions().height;
+ },
+
+ getScrollOffsets: function() {
+ return Element._returnOffset(
+ window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
+ window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
+ }
+};
+/* Portions of the Selector class are derived from Jack Slocum's DomQuery,
+ * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
+ * license. Please see http://www.yui-ext.com/ for more information. */
+
+var Selector = Class.create({
+ initialize: function(expression) {
+ this.expression = expression.strip();
+
+ if (this.shouldUseSelectorsAPI()) {
+ this.mode = 'selectorsAPI';
+ } else if (this.shouldUseXPath()) {
+ this.mode = 'xpath';
+ this.compileXPathMatcher();
+ } else {
+ this.mode = "normal";
+ this.compileMatcher();
+ }
+
+ },
+
+ shouldUseXPath: function() {
+ if (!Prototype.BrowserFeatures.XPath) return false;
+
+ var e = this.expression;
+
+ // Safari 3 chokes on :*-of-type and :empty
+ if (Prototype.Browser.WebKit &&
+ (e.include("-of-type") || e.include(":empty")))
+ return false;
+
+ // XPath can't do namespaced attributes, nor can it read
+ // the "checked" property from DOM nodes
+ if ((/(\[[\w-]*?:|:checked)/).test(e))
+ return false;
+
+ return true;
+ },
+
+ shouldUseSelectorsAPI: function() {
+ if (!Prototype.BrowserFeatures.SelectorsAPI) return false;
+
+ if (!Selector._div) Selector._div = new Element('div');
+
+ // Make sure the browser treats the selector as valid. Test on an
+ // isolated element to minimize cost of this check.
+ try {
+ Selector._div.querySelector(this.expression);
+ } catch(e) {
+ return false;
+ }
+
+ return true;
+ },
+
+ compileMatcher: function() {
+ var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
+ c = Selector.criteria, le, p, m;
+
+ if (Selector._cache[e]) {
+ this.matcher = Selector._cache[e];
+ return;
+ }
+
+ this.matcher = ["this.matcher = function(root) {",
+ "var r = root, h = Selector.handlers, c = false, n;"];
+
+ while (e && le != e && (/\S/).test(e)) {
+ le = e;
+ for (var i in ps) {
+ p = ps[i];
+ if (m = e.match(p)) {
+ this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
+ new Template(c[i]).evaluate(m));
+ e = e.replace(m[0], '');
+ break;
+ }
+ }
+ }
+
+ this.matcher.push("return h.unique(n);\n}");
+ eval(this.matcher.join('\n'));
+ Selector._cache[this.expression] = this.matcher;
+ },
+
+ compileXPathMatcher: function() {
+ var e = this.expression, ps = Selector.patterns,
+ x = Selector.xpath, le, m;
+
+ if (Selector._cache[e]) {
+ this.xpath = Selector._cache[e]; return;
+ }
+
+ this.matcher = ['.//*'];
+ while (e && le != e && (/\S/).test(e)) {
+ le = e;
+ for (var i in ps) {
+ if (m = e.match(ps[i])) {
+ this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
+ new Template(x[i]).evaluate(m));
+ e = e.replace(m[0], '');
+ break;
+ }
+ }
+ }
+
+ this.xpath = this.matcher.join('');
+ Selector._cache[this.expression] = this.xpath;
+ },
+
+ findElements: function(root) {
+ root = root || document;
+ var e = this.expression, results;
+
+ switch (this.mode) {
+ case 'selectorsAPI':
+ // querySelectorAll queries document-wide, then filters to descendants
+ // of the context element. That's not what we want.
+ // Add an explicit context to the selector if necessary.
+ if (root !== document) {
+ var oldId = root.id, id = $(root).identify();
+ e = "#" + id + " " + e;
+ }
+
+ results = $A(root.querySelectorAll(e)).map(Element.extend);
+ root.id = oldId;
+
+ return results;
+ case 'xpath':
+ return document._getElementsByXPath(this.xpath, root);
+ default:
+ return this.matcher(root);
+ }
+ },
+
+ match: function(element) {
+ this.tokens = [];
+
+ var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
+ var le, p, m;
+
+ while (e && le !== e && (/\S/).test(e)) {
+ le = e;
+ for (var i in ps) {
+ p = ps[i];
+ if (m = e.match(p)) {
+ // use the Selector.assertions methods unless the selector
+ // is too complex.
+ if (as[i]) {
+ this.tokens.push([i, Object.clone(m)]);
+ e = e.replace(m[0], '');
+ } else {
+ // reluctantly do a document-wide search
+ // and look for a match in the array
+ return this.findElements(document).include(element);
+ }
+ }
+ }
+ }
+
+ var match = true, name, matches;
+ for (var i = 0, token; token = this.tokens[i]; i++) {
+ name = token[0], matches = token[1];
+ if (!Selector.assertions[name](element, matches)) {
+ match = false; break;
+ }
+ }
+
+ return match;
+ },
+
+ toString: function() {
+ return this.expression;
+ },
+
+ inspect: function() {
+ return "#<Selector:" + this.expression.inspect() + ">";
+ }
+});
+
+Object.extend(Selector, {
+ _cache: { },
+
+ xpath: {
+ descendant: "//*",
+ child: "/*",
+ adjacent: "/following-sibling::*[1]",
+ laterSibling: '/following-sibling::*',
+ tagName: function(m) {
+ if (m[1] == '*') return '';
+ return "[local-name()='" + m[1].toLowerCase() +
+ "' or local-name()='" + m[1].toUpperCase() + "']";
+ },
+ className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
+ id: "[@id='#{1}']",
+ attrPresence: function(m) {
+ m[1] = m[1].toLowerCase();
+ return new Template("[@#{1}]").evaluate(m);
+ },
+ attr: function(m) {
+ m[1] = m[1].toLowerCase();
+ m[3] = m[5] || m[6];
+ return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
+ },
+ pseudo: function(m) {
+ var h = Selector.xpath.pseudos[m[1]];
+ if (!h) return '';
+ if (Object.isFunction(h)) return h(m);
+ return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
+ },
+ operators: {
+ '=': "[@#{1}='#{3}']",
+ '!=': "[@#{1}!='#{3}']",
+ '^=': "[starts-with(@#{1}, '#{3}')]",
+ '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
+ '*=': "[contains(@#{1}, '#{3}')]",
+ '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
+ '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
+ },
+ pseudos: {
+ 'first-child': '[not(preceding-sibling::*)]',
+ 'last-child': '[not(following-sibling::*)]',
+ 'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
+ 'empty': "[count(*) = 0 and (count(text()) = 0)]",
+ 'checked': "[@checked]",
+ 'disabled': "[(@disabled) and (@type!='hidden')]",
+ 'enabled': "[not(@disabled) and (@type!='hidden')]",
+ 'not': function(m) {
+ var e = m[6], p = Selector.patterns,
+ x = Selector.xpath, le, v;
+
+ var exclusion = [];
+ while (e && le != e && (/\S/).test(e)) {
+ le = e;
+ for (var i in p) {
+ if (m = e.match(p[i])) {
+ v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
+ exclusion.push("(" + v.substring(1, v.length - 1) + ")");
+ e = e.replace(m[0], '');
+ break;
+ }
+ }
+ }
+ return "[not(" + exclusion.join(" and ") + ")]";
+ },
+ 'nth-child': function(m) {
+ return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
+ },
+ 'nth-last-child': function(m) {
+ return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
+ },
+ 'nth-of-type': function(m) {
+ return Selector.xpath.pseudos.nth("position() ", m);
+ },
+ 'nth-last-of-type': function(m) {
+ return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
+ },
+ 'first-of-type': function(m) {
+ m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
+ },
+ 'last-of-type': function(m) {
+ m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
+ },
+ 'only-of-type': function(m) {
+ var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
+ },
+ nth: function(fragment, m) {
+ var mm, formula = m[6], predicate;
+ if (formula == 'even') formula = '2n+0';
+ if (formula == 'odd') formula = '2n+1';
+ if (mm = formula.match(/^(\d+)$/)) // digit only
+ return '[' + fragment + "= " + mm[1] + ']';
+ if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
+ if (mm[1] == "-") mm[1] = -1;
+ var a = mm[1] ? Number(mm[1]) : 1;
+ var b = mm[2] ? Number(mm[2]) : 0;
+ predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
+ "((#{fragment} - #{b}) div #{a} >= 0)]";
+ return new Template(predicate).evaluate({
+ fragment: fragment, a: a, b: b });
+ }
+ }
+ }
+ },
+
+ criteria: {
+ tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
+ className: 'n = h.className(n, r, "#{1}", c); c = false;',
+ id: 'n = h.id(n, r, "#{1}", c); c = false;',
+ attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
+ attr: function(m) {
+ m[3] = (m[5] || m[6]);
+ return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
+ },
+ pseudo: function(m) {
+ if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
+ return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
+ },
+ descendant: 'c = "descendant";',
+ child: 'c = "child";',
+ adjacent: 'c = "adjacent";',
+ laterSibling: 'c = "laterSibling";'
+ },
+
+ patterns: {
+ // combinators must be listed first
+ // (and descendant needs to be last combinator)
+ laterSibling: /^\s*~\s*/,
+ child: /^\s*>\s*/,
+ adjacent: /^\s*\+\s*/,
+ descendant: /^\s/,
+
+ // selectors follow
+ tagName: /^\s*(\*|[\w\-]+)(\b|$)?/,
+ id: /^#([\w\-\*]+)(\b|$)/,
+ className: /^\.([\w\-\*]+)(\b|$)/,
+ pseudo:
+/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
+ attrPresence: /^\[((?:[\w]+:)?[\w]+)\]/,
+ attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
+ },
+
+ // for Selector.match and Element#match
+ assertions: {
+ tagName: function(element, matches) {
+ return matches[1].toUpperCase() == element.tagName.toUpperCase();
+ },
+
+ className: function(element, matches) {
+ return Element.hasClassName(element, matches[1]);
+ },
+
+ id: function(element, matches) {
+ return element.id === matches[1];
+ },
+
+ attrPresence: function(element, matches) {
+ return Element.hasAttribute(element, matches[1]);
+ },
+
+ attr: function(element, matches) {
+ var nodeValue = Element.readAttribute(element, matches[1]);
+ return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
+ }
+ },
+
+ handlers: {
+ // UTILITY FUNCTIONS
+ // joins two collections
+ concat: function(a, b) {
+ for (var i = 0, node; node = b[i]; i++)
+ a.push(node);
+ return a;
+ },
+
+ // marks an array of nodes for counting
+ mark: function(nodes) {
+ var _true = Prototype.emptyFunction;
+ for (var i = 0, node; node = nodes[i]; i++)
+ node._countedByPrototype = _true;
+ return nodes;
+ },
+
+ unmark: function(nodes) {
+ for (var i = 0, node; node = nodes[i]; i++)
+ node._countedByPrototype = undefined;
+ return nodes;
+ },
+
+ // mark each child node with its position (for nth calls)
+ // "ofType" flag indicates whether we're indexing for nth-of-type
+ // rather than nth-child
+ index: function(parentNode, reverse, ofType) {
+ parentNode._countedByPrototype = Prototype.emptyFunction;
+ if (reverse) {
+ for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
+ var node = nodes[i];
+ if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
+ }
+ } else {
+ for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
+ if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
+ }
+ },
+
+ // filters out duplicates and extends all nodes
+ unique: function(nodes) {
+ if (nodes.length == 0) return nodes;
+ var results = [], n;
+ for (var i = 0, l = nodes.length; i < l; i++)
+ if (!(n = nodes[i])._countedByPrototype) {
+ n._countedByPrototype = Prototype.emptyFunction;
+ results.push(Element.extend(n));
+ }
+ return Selector.handlers.unmark(results);
+ },
+
+ // COMBINATOR FUNCTIONS
+ descendant: function(nodes) {
+ var h = Selector.handlers;
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ h.concat(results, node.getElementsByTagName('*'));
+ return results;
+ },
+
+ child: function(nodes) {
+ var h = Selector.handlers;
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ for (var j = 0, child; child = node.childNodes[j]; j++)
+ if (child.nodeType == 1 && child.tagName != '!') results.push(child);
+ }
+ return results;
+ },
+
+ adjacent: function(nodes) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ var next = this.nextElementSibling(node);
+ if (next) results.push(next);
+ }
+ return results;
+ },
+
+ laterSibling: function(nodes) {
+ var h = Selector.handlers;
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ h.concat(results, Element.nextSiblings(node));
+ return results;
+ },
+
+ nextElementSibling: function(node) {
+ while (node = node.nextSibling)
+ if (node.nodeType == 1) return node;
+ return null;
+ },
+
+ previousElementSibling: function(node) {
+ while (node = node.previousSibling)
+ if (node.nodeType == 1) return node;
+ return null;
+ },
+
+ // TOKEN FUNCTIONS
+ tagName: function(nodes, root, tagName, combinator) {
+ var uTagName = tagName.toUpperCase();
+ var results = [], h = Selector.handlers;
+ if (nodes) {
+ if (combinator) {
+ // fastlane for ordinary descendant combinators
+ if (combinator == "descendant") {
+ for (var i = 0, node; node = nodes[i]; i++)
+ h.concat(results, node.getElementsByTagName(tagName));
+ return results;
+ } else nodes = this[combinator](nodes);
+ if (tagName == "*") return nodes;
+ }
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (node.tagName.toUpperCase() === uTagName) results.push(node);
+ return results;
+ } else return root.getElementsByTagName(tagName);
+ },
+
+ id: function(nodes, root, id, combinator) {
+ var targetNode = $(id), h = Selector.handlers;
+ if (!targetNode) return [];
+ if (!nodes && root == document) return [targetNode];
+ if (nodes) {
+ if (combinator) {
+ if (combinator == 'child') {
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (targetNode.parentNode == node) return [targetNode];
+ } else if (combinator == 'descendant') {
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (Element.descendantOf(targetNode, node)) return [targetNode];
+ } else if (combinator == 'adjacent') {
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (Selector.handlers.previousElementSibling(targetNode) == node)
+ return [targetNode];
+ } else nodes = h[combinator](nodes);
+ }
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (node == targetNode) return [targetNode];
+ return [];
+ }
+ return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
+ },
+
+ className: function(nodes, root, className, combinator) {
+ if (nodes && combinator) nodes = this[combinator](nodes);
+ return Selector.handlers.byClassName(nodes, root, className);
+ },
+
+ byClassName: function(nodes, root, className) {
+ if (!nodes) nodes = Selector.handlers.descendant([root]);
+ var needle = ' ' + className + ' ';
+ for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
+ nodeClassName = node.className;
+ if (nodeClassName.length == 0) continue;
+ if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
+ results.push(node);
+ }
+ return results;
+ },
+
+ attrPresence: function(nodes, root, attr, combinator) {
+ if (!nodes) nodes = root.getElementsByTagName("*");
+ if (nodes && combinator) nodes = this[combinator](nodes);
+ var results = [];
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (Element.hasAttribute(node, attr)) results.push(node);
+ return results;
+ },
+
+ attr: function(nodes, root, attr, value, operator, combinator) {
+ if (!nodes) nodes = root.getElementsByTagName("*");
+ if (nodes && combinator) nodes = this[combinator](nodes);
+ var handler = Selector.operators[operator], results = [];
+ for (var i = 0, node; node = nodes[i]; i++) {
+ var nodeValue = Element.readAttribute(node, attr);
+ if (nodeValue === null) continue;
+ if (handler(nodeValue, value)) results.push(node);
+ }
+ return results;
+ },
+
+ pseudo: function(nodes, name, value, root, combinator) {
+ if (nodes && combinator) nodes = this[combinator](nodes);
+ if (!nodes) nodes = root.getElementsByTagName("*");
+ return Selector.pseudos[name](nodes, value, root);
+ }
+ },
+
+ pseudos: {
+ 'first-child': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ if (Selector.handlers.previousElementSibling(node)) continue;
+ results.push(node);
+ }
+ return results;
+ },
+ 'last-child': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ if (Selector.handlers.nextElementSibling(node)) continue;
+ results.push(node);
+ }
+ return results;
+ },
+ 'only-child': function(nodes, value, root) {
+ var h = Selector.handlers;
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
+ results.push(node);
+ return results;
+ },
+ 'nth-child': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, formula, root);
+ },
+ 'nth-last-child': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, formula, root, true);
+ },
+ 'nth-of-type': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, formula, root, false, true);
+ },
+ 'nth-last-of-type': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, formula, root, true, true);
+ },
+ 'first-of-type': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, "1", root, false, true);
+ },
+ 'last-of-type': function(nodes, formula, root) {
+ return Selector.pseudos.nth(nodes, "1", root, true, true);
+ },
+ 'only-of-type': function(nodes, formula, root) {
+ var p = Selector.pseudos;
+ return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
+ },
+
+ // handles the an+b logic
+ getIndices: function(a, b, total) {
+ if (a == 0) return b > 0 ? [b] : [];
+ return $R(1, total).inject([], function(memo, i) {
+ if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
+ return memo;
+ });
+ },
+
+ // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
+ nth: function(nodes, formula, root, reverse, ofType) {
+ if (nodes.length == 0) return [];
+ if (formula == 'even') formula = '2n+0';
+ if (formula == 'odd') formula = '2n+1';
+ var h = Selector.handlers, results = [], indexed = [], m;
+ h.mark(nodes);
+ for (var i = 0, node; node = nodes[i]; i++) {
+ if (!node.parentNode._countedByPrototype) {
+ h.index(node.parentNode, reverse, ofType);
+ indexed.push(node.parentNode);
+ }
+ }
+ if (formula.match(/^\d+$/)) { // just a number
+ formula = Number(formula);
+ for (var i = 0, node; node = nodes[i]; i++)
+ if (node.nodeIndex == formula) results.push(node);
+ } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
+ if (m[1] == "-") m[1] = -1;
+ var a = m[1] ? Number(m[1]) : 1;
+ var b = m[2] ? Number(m[2]) : 0;
+ var indices = Selector.pseudos.getIndices(a, b, nodes.length);
+ for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
+ for (var j = 0; j < l; j++)
+ if (node.nodeIndex == indices[j]) results.push(node);
+ }
+ }
+ h.unmark(nodes);
+ h.unmark(indexed);
+ return results;
+ },
+
+ 'empty': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++) {
+ // IE treats comments as element nodes
+ if (node.tagName == '!' || node.firstChild) continue;
+ results.push(node);
+ }
+ return results;
+ },
+
+ 'not': function(nodes, selector, root) {
+ var h = Selector.handlers, selectorType, m;
+ var exclusions = new Selector(selector).findElements(root);
+ h.mark(exclusions);
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (!node._countedByPrototype) results.push(node);
+ h.unmark(exclusions);
+ return results;
+ },
+
+ 'enabled': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (!node.disabled && (!node.type || node.type !== 'hidden'))
+ results.push(node);
+ return results;
+ },
+
+ 'disabled': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (node.disabled) results.push(node);
+ return results;
+ },
+
+ 'checked': function(nodes, value, root) {
+ for (var i = 0, results = [], node; node = nodes[i]; i++)
+ if (node.checked) results.push(node);
+ return results;
+ }
+ },
+
+ operators: {
+ '=': function(nv, v) { return nv == v; },
+ '!=': function(nv, v) { return nv != v; },
+ '^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); },
+ '$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); },
+ '*=': function(nv, v) { return nv == v || nv && nv.include(v); },
+ '$=': function(nv, v) { return nv.endsWith(v); },
+ '*=': function(nv, v) { return nv.include(v); },
+ '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
+ '|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() +
+ '-').include('-' + (v || "").toUpperCase() + '-'); }
+ },
+
+ split: function(expression) {
+ var expressions = [];
+ expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
+ expressions.push(m[1].strip());
+ });
+ return expressions;
+ },
+
+ matchElements: function(elements, expression) {
+ var matches = $$(expression), h = Selector.handlers;
+ h.mark(matches);
+ for (var i = 0, results = [], element; element = elements[i]; i++)
+ if (element._countedByPrototype) results.push(element);
+ h.unmark(matches);
+ return results;
+ },
+
+ findElement: function(elements, expression, index) {
+ if (Object.isNumber(expression)) {
+ index = expression; expression = false;
+ }
+ return Selector.matchElements(elements, expression || '*')[index || 0];
+ },
+
+ findChildElements: function(element, expressions) {
+ expressions = Selector.split(expressions.join(','));
+ var results = [], h = Selector.handlers;
+ for (var i = 0, l = expressions.length, selector; i < l; i++) {
+ selector = new Selector(expressions[i].strip());
+ h.concat(results, selector.findElements(element));
+ }
+ return (l > 1) ? h.unique(results) : results;
+ }
+});
+
+if (Prototype.Browser.IE) {
+ Object.extend(Selector.handlers, {
+ // IE returns comment nodes on getElementsByTagName("*").
+ // Filter them out.
+ concat: function(a, b) {
+ for (var i = 0, node; node = b[i]; i++)
+ if (node.tagName !== "!") a.push(node);
+ return a;
+ },
+
+ // IE improperly serializes _countedByPrototype in (inner|outer)HTML.
+ unmark: function(nodes) {
+ for (var i = 0, node; node = nodes[i]; i++)
+ node.removeAttribute('_countedByPrototype');
+ return nodes;
+ }
+ });
+}
+
+function $$() {
+ return Selector.findChildElements(document, $A(arguments));
+}
+var Form = {
+ reset: function(form) {
+ $(form).reset();
+ return form;
+ },
+
+ serializeElements: function(elements, options) {
+ if (typeof options != 'object') options = { hash: !!options };
+ else if (Object.isUndefined(options.hash)) options.hash = true;
+ var key, value, submitted = false, submit = options.submit;
+
+ var data = elements.inject({ }, function(result, element) {
+ if (!element.disabled && element.name) {
+ key = element.name; value = $(element).getValue();
+ if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
+ submit !== false && (!submit || key == submit) && (submitted = true)))) {
+ if (key in result) {
+ // a key is already present; construct an array of values
+ if (!Object.isArray(result[key])) result[key] = [result[key]];
+ result[key].push(value);
+ }
+ else result[key] = value;
+ }
+ }
+ return result;
+ });
+
+ return options.hash ? data : Object.toQueryString(data);
+ }
+};
+
+Form.Methods = {
+ serialize: function(form, options) {
+ return Form.serializeElements(Form.getElements(form), options);
+ },
+
+ getElements: function(form) {
+ return $A($(form).getElementsByTagName('*')).inject([],
+ function(elements, child) {
+ if (Form.Element.Serializers[child.tagName.toLowerCase()])
+ elements.push(Element.extend(child));
+ return elements;
+ }
+ );
+ },
+
+ getInputs: function(form, typeName, name) {
+ form = $(form);
+ var inputs = form.getElementsByTagName('input');
+
+ if (!typeName && !name) return $A(inputs).map(Element.extend);
+
+ for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
+ var input = inputs[i];
+ if ((typeName && input.type != typeName) || (name && input.name != name))
+ continue;
+ matchingInputs.push(Element.extend(input));
+ }
+
+ return matchingInputs;
+ },
+
+ disable: function(form) {
+ form = $(form);
+ Form.getElements(form).invoke('disable');
+ return form;
+ },
+
+ enable: function(form) {
+ form = $(form);
+ Form.getElements(form).invoke('enable');
+ return form;
+ },
+
+ findFirstElement: function(form) {
+ var elements = $(form).getElements().findAll(function(element) {
+ return 'hidden' != element.type && !element.disabled;
+ });
+ var firstByIndex = elements.findAll(function(element) {
+ return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
+ }).sortBy(function(element) { return element.tabIndex }).first();
+
+ return firstByIndex ? firstByIndex : elements.find(function(element) {
+ return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
+ });
+ },
+
+ focusFirstElement: function(form) {
+ form = $(form);
+ form.findFirstElement().activate();
+ return form;
+ },
+
+ request: function(form, options) {
+ form = $(form), options = Object.clone(options || { });
+
+ var params = options.parameters, action = form.readAttribute('action') || '';
+ if (action.blank()) action = window.location.href;
+ options.parameters = form.serialize(true);
+
+ if (params) {
+ if (Object.isString(params)) params = params.toQueryParams();
+ Object.extend(options.parameters, params);
+ }
+
+ if (form.hasAttribute('method') && !options.method)
+ options.method = form.method;
+
+ return new Ajax.Request(action, options);
+ }
+};
+
+/*--------------------------------------------------------------------------*/
+
+Form.Element = {
+ focus: function(element) {
+ $(element).focus();
+ return element;
+ },
+
+ select: function(element) {
+ $(element).select();
+ return element;
+ }
+};
+
+Form.Element.Methods = {
+ serialize: function(element) {
+ element = $(element);
+ if (!element.disabled && element.name) {
+ var value = element.getValue();
+ if (value != undefined) {
+ var pair = { };
+ pair[element.name] = value;
+ return Object.toQueryString(pair);
+ }
+ }
+ return '';
+ },
+
+ getValue: function(element) {
+ element = $(element);
+ var method = element.tagName.toLowerCase();
+ return Form.Element.Serializers[method](element);
+ },
+
+ setValue: function(element, value) {
+ element = $(element);
+ var method = element.tagName.toLowerCase();
+ Form.Element.Serializers[method](element, value);
+ return element;
+ },
+
+ clear: function(element) {
+ $(element).value = '';
+ return element;
+ },
+
+ present: function(element) {
+ return $(element).value != '';
+ },
+
+ activate: function(element) {
+ element = $(element);
+ try {
+ element.focus();
+ if (element.select && (element.tagName.toLowerCase() != 'input' ||
+ !['button', 'reset', 'submit'].include(element.type)))
+ element.select();
+ } catch (e) { }
+ return element;
+ },
+
+ disable: function(element) {
+ element = $(element);
+ element.disabled = true;
+ return element;
+ },
+
+ enable: function(element) {
+ element = $(element);
+ element.disabled = false;
+ return element;
+ }
+};
+
+/*--------------------------------------------------------------------------*/
+
+var Field = Form.Element;
+var $F = Form.Element.Methods.getValue;
+
+/*--------------------------------------------------------------------------*/
+
+Form.Element.Serializers = {
+ input: function(element, value) {
+ switch (element.type.toLowerCase()) {
+ case 'checkbox':
+ case 'radio':
+ return Form.Element.Serializers.inputSelector(element, value);
+ default:
+ return Form.Element.Serializers.textarea(element, value);
+ }
+ },
+
+ inputSelector: function(element, value) {
+ if (Object.isUndefined(value)) return element.checked ? element.value : null;
+ else element.checked = !!value;
+ },
+
+ textarea: function(element, value) {
+ if (Object.isUndefined(value)) return element.value;
+ else element.value = value;
+ },
+
+ select: function(element, value) {
+ if (Object.isUndefined(value))
+ return this[element.type == 'select-one' ?
+ 'selectOne' : 'selectMany'](element);
+ else {
+ var opt, currentValue, single = !Object.isArray(value);
+ for (var i = 0, length = element.length; i < length; i++) {
+ opt = element.options[i];
+ currentValue = this.optionValue(opt);
+ if (single) {
+ if (currentValue == value) {
+ opt.selected = true;
+ return;
+ }
+ }
+ else opt.selected = value.include(currentValue);
+ }
+ }
+ },
+
+ selectOne: function(element) {
+ var index = element.selectedIndex;
+ return index >= 0 ? this.optionValue(element.options[index]) : null;
+ },
+
+ selectMany: function(element) {
+ var values, length = element.length;
+ if (!length) return null;
+
+ for (var i = 0, values = []; i < length; i++) {
+ var opt = element.options[i];
+ if (opt.selected) values.push(this.optionValue(opt));
+ }
+ return values;
+ },
+
+ optionValue: function(opt) {
+ // extend element because hasAttribute may not be native
+ return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
+ }
+};
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
+ initialize: function($super, element, frequency, callback) {
+ $super(callback, frequency);
+ this.element = $(element);
+ this.lastValue = this.getValue();
+ },
+
+ execute: function() {
+ var value = this.getValue();
+ if (Object.isString(this.lastValue) && Object.isString(value) ?
+ this.lastValue != value : String(this.lastValue) != String(value)) {
+ this.callback(this.element, value);
+ this.lastValue = value;
+ }
+ }
+});
+
+Form.Element.Observer = Class.create(Abstract.TimedObserver, {
+ getValue: function() {
+ return Form.Element.getValue(this.element);
+ }
+});
+
+Form.Observer = Class.create(Abstract.TimedObserver, {
+ getValue: function() {
+ return Form.serialize(this.element);
+ }
+});
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.EventObserver = Class.create({
+ initialize: function(element, callback) {
+ this.element = $(element);
+ this.callback = callback;
+
+ this.lastValue = this.getValue();
+ if (this.element.tagName.toLowerCase() == 'form')
+ this.registerFormCallbacks();
+ else
+ this.registerCallback(this.element);
+ },
+
+ onElementEvent: function() {
+ var value = this.getValue();
+ if (this.lastValue != value) {
+ this.callback(this.element, value);
+ this.lastValue = value;
+ }
+ },
+
+ registerFormCallbacks: function() {
+ Form.getElements(this.element).each(this.registerCallback, this);
+ },
+
+ registerCallback: function(element) {
+ if (element.type) {
+ switch (element.type.toLowerCase()) {
+ case 'checkbox':
+ case 'radio':
+ Event.observe(element, 'click', this.onElementEvent.bind(this));
+ break;
+ default:
+ Event.observe(element, 'change', this.onElementEvent.bind(this));
+ break;
+ }
+ }
+ }
+});
+
+Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
+ getValue: function() {
+ return Form.Element.getValue(this.element);
+ }
+});
+
+Form.EventObserver = Class.create(Abstract.EventObserver, {
+ getValue: function() {
+ return Form.serialize(this.element);
+ }
+});
+if (!window.Event) var Event = { };
+
+Object.extend(Event, {
+ KEY_BACKSPACE: 8,
+ KEY_TAB: 9,
+ KEY_RETURN: 13,
+ KEY_ESC: 27,
+ KEY_LEFT: 37,
+ KEY_UP: 38,
+ KEY_RIGHT: 39,
+ KEY_DOWN: 40,
+ KEY_DELETE: 46,
+ KEY_HOME: 36,
+ KEY_END: 35,
+ KEY_PAGEUP: 33,
+ KEY_PAGEDOWN: 34,
+ KEY_INSERT: 45,
+
+ cache: { },
+
+ relatedTarget: function(event) {
+ var element;
+ switch(event.type) {
+ case 'mouseover': element = event.fromElement; break;
+ case 'mouseout': element = event.toElement; break;
+ default: return null;
+ }
+ return Element.extend(element);
+ }
+});
+
+Event.Methods = (function() {
+ var isButton;
+
+ if (Prototype.Browser.IE) {
+ var buttonMap = { 0: 1, 1: 4, 2: 2 };
+ isButton = function(event, code) {
+ return event.button == buttonMap[code];
+ };
+
+ } else if (Prototype.Browser.WebKit) {
+ isButton = function(event, code) {
+ switch (code) {
+ case 0: return event.which == 1 && !event.metaKey;
+ case 1: return event.which == 1 && event.metaKey;
+ default: return false;
+ }
+ };
+
+ } else {
+ isButton = function(event, code) {
+ return event.which ? (event.which === code + 1) : (event.button === code);
+ };
+ }
+
+ return {
+ isLeftClick: function(event) { return isButton(event, 0) },
+ isMiddleClick: function(event) { return isButton(event, 1) },
+ isRightClick: function(event) { return isButton(event, 2) },
+
+ element: function(event) {
+ event = Event.extend(event);
+
+ var node = event.target,
+ type = event.type,
+ currentTarget = event.currentTarget;
+
+ if (currentTarget && currentTarget.tagName) {
+ // Firefox screws up the "click" event when moving between radio buttons
+ // via arrow keys. It also screws up the "load" and "error" events on images,
+ // reporting the document as the target instead of the original image.
+ if (type === 'load' || type === 'error' ||
+ (type === 'click' && currentTarget.tagName.toLowerCase() === 'input'
+ && currentTarget.type === 'radio'))
+ node = currentTarget;
+ }
+ if (node.nodeType == Node.TEXT_NODE) node = node.parentNode;
+ return Element.extend(node);
+ },
+
+ findElement: function(event, expression) {
+ var element = Event.element(event);
+ if (!expression) return element;
+ var elements = [element].concat(element.ancestors());
+ return Selector.findElement(elements, expression, 0);
+ },
+
+ pointer: function(event) {
+ var docElement = document.documentElement,
+ body = document.body || { scrollLeft: 0, scrollTop: 0 };
+ return {
+ x: event.pageX || (event.clientX +
+ (docElement.scrollLeft || body.scrollLeft) -
+ (docElement.clientLeft || 0)),
+ y: event.pageY || (event.clientY +
+ (docElement.scrollTop || body.scrollTop) -
+ (docElement.clientTop || 0))
+ };
+ },
+
+ pointerX: function(event) { return Event.pointer(event).x },
+ pointerY: function(event) { return Event.pointer(event).y },
+
+ stop: function(event) {
+ Event.extend(event);
+ event.preventDefault();
+ event.stopPropagation();
+ event.stopped = true;
+ }
+ };
+})();
+
+Event.extend = (function() {
+ var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
+ m[name] = Event.Methods[name].methodize();
+ return m;
+ });
+
+ if (Prototype.Browser.IE) {
+ Object.extend(methods, {
+ stopPropagation: function() { this.cancelBubble = true },
+ preventDefault: function() { this.returnValue = false },
+ inspect: function() { return "[object Event]" }
+ });
+
+ return function(event) {
+ if (!event) return false;
+ if (event._extendedByPrototype) return event;
+
+ event._extendedByPrototype = Prototype.emptyFunction;
+ var pointer = Event.pointer(event);
+ Object.extend(event, {
+ target: event.srcElement,
+ relatedTarget: Event.relatedTarget(event),
+ pageX: pointer.x,
+ pageY: pointer.y
+ });
+ return Object.extend(event, methods);
+ };
+
+ } else {
+ Event.prototype = Event.prototype || document.createEvent("HTMLEvents")['__proto__'];
+ Object.extend(Event.prototype, methods);
+ return Prototype.K;
+ }
+})();
+
+Object.extend(Event, (function() {
+ var cache = Event.cache;
+
+ function getEventID(element) {
+ if (element._prototypeEventID) return element._prototypeEventID[0];
+ arguments.callee.id = arguments.callee.id || 1;
+ return element._prototypeEventID = [++arguments.callee.id];
+ }
+
+ function getDOMEventName(eventName) {
+ if (eventName && eventName.include(':')) return "dataavailable";
+ return eventName;
+ }
+
+ function getCacheForID(id) {
+ return cache[id] = cache[id] || { };
+ }
+
+ function getWrappersForEventName(id, eventName) {
+ var c = getCacheForID(id);
+ return c[eventName] = c[eventName] || [];
+ }
+
+ function createWrapper(element, eventName, handler) {
+ var id = getEventID(element);
+ var c = getWrappersForEventName(id, eventName);
+ if (c.pluck("handler").include(handler)) return false;
+
+ var wrapper = function(event) {
+ if (!Event || !Event.extend ||
+ (event.eventName && event.eventName != eventName))
+ return false;
+
+ Event.extend(event);
+ handler.call(element, event);
+ };
+
+ wrapper.handler = handler;
+ c.push(wrapper);
+ return wrapper;
+ }
+
+ function findWrapper(id, eventName, handler) {
+ var c = getWrappersForEventName(id, eventName);
+ return c.find(function(wrapper) { return wrapper.handler == handler });
+ }
+
+ function destroyWrapper(id, eventName, handler) {
+ var c = getCacheForID(id);
+ if (!c[eventName]) return false;
+ c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
+ }
+
+ function destroyCache() {
+ for (var id in cache)
+ for (var eventName in cache[id])
+ cache[id][eventName] = null;
+ }
+
+
+ // Internet Explorer needs to remove event handlers on page unload
+ // in order to avoid memory leaks.
+ if (window.attachEvent) {
+ window.attachEvent("onunload", destroyCache);
+ }
+
+ // Safari has a dummy event handler on page unload so that it won't
+ // use its bfcache. Safari <= 3.1 has an issue with restoring the "document"
+ // object when page is returned to via the back button using its bfcache.
+ if (Prototype.Browser.WebKit) {
+ window.addEventListener('unload', Prototype.emptyFunction, false);
+ }
+
+ return {
+ observe: function(element, eventName, handler) {
+ element = $(element);
+ var name = getDOMEventName(eventName);
+
+ var wrapper = createWrapper(element, eventName, handler);
+ if (!wrapper) return element;
+
+ if (element.addEventListener) {
+ element.addEventListener(name, wrapper, false);
+ } else {
+ element.attachEvent("on" + name, wrapper);
+ }
+
+ return element;
+ },
+
+ stopObserving: function(element, eventName, handler) {
+ element = $(element);
+ var id = getEventID(element), name = getDOMEventName(eventName);
+
+ if (!handler && eventName) {
+ getWrappersForEventName(id, eventName).each(function(wrapper) {
+ element.stopObserving(eventName, wrapper.handler);
+ });
+ return element;
+
+ } else if (!eventName) {
+ Object.keys(getCacheForID(id)).each(function(eventName) {
+ element.stopObserving(eventName);
+ });
+ return element;
+ }
+
+ var wrapper = findWrapper(id, eventName, handler);
+ if (!wrapper) return element;
+
+ if (element.removeEventListener) {
+ element.removeEventListener(name, wrapper, false);
+ } else {
+ element.detachEvent("on" + name, wrapper);
+ }
+
+ destroyWrapper(id, eventName, handler);
+
+ return element;
+ },
+
+ fire: function(element, eventName, memo) {
+ element = $(element);
+ if (element == document && document.createEvent && !element.dispatchEvent)
+ element = document.documentElement;
+
+ var event;
+ if (document.createEvent) {
+ event = document.createEvent("HTMLEvents");
+ event.initEvent("dataavailable", true, true);
+ } else {
+ event = document.createEventObject();
+ event.eventType = "ondataavailable";
+ }
+
+ event.eventName = eventName;
+ event.memo = memo || { };
+
+ if (document.createEvent) {
+ element.dispatchEvent(event);
+ } else {
+ element.fireEvent(event.eventType, event);
+ }
+
+ return Event.extend(event);
+ }
+ };
+})());
+
+Object.extend(Event, Event.Methods);
+
+Element.addMethods({
+ fire: Event.fire,
+ observe: Event.observe,
+ stopObserving: Event.stopObserving
+});
+
+Object.extend(document, {
+ fire: Element.Methods.fire.methodize(),
+ observe: Element.Methods.observe.methodize(),
+ stopObserving: Element.Methods.stopObserving.methodize(),
+ loaded: false
+});
+
+(function() {
+ /* Support for the DOMContentLoaded event is based on work by Dan Webb,
+ Matthias Miller, Dean Edwards and John Resig. */
+
+ var timer;
+
+ function fireContentLoadedEvent() {
+ if (document.loaded) return;
+ if (timer) window.clearInterval(timer);
+ document.fire("dom:loaded");
+ document.loaded = true;
+ }
+
+ if (document.addEventListener) {
+ if (Prototype.Browser.WebKit) {
+ timer = window.setInterval(function() {
+ if (/loaded|complete/.test(document.readyState))
+ fireContentLoadedEvent();
+ }, 0);
+
+ Event.observe(window, "load", fireContentLoadedEvent);
+
+ } else {
+ document.addEventListener("DOMContentLoaded",
+ fireContentLoadedEvent, false);
+ }
+
+ } else {
+ document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
+ $("__onDOMContentLoaded").onreadystatechange = function() {
+ if (this.readyState == "complete") {
+ this.onreadystatechange = null;
+ fireContentLoadedEvent();
+ }
+ };
+ }
+})();
+/*------------------------------- DEPRECATED -------------------------------*/
+
+Hash.toQueryString = Object.toQueryString;
+
+var Toggle = { display: Element.toggle };
+
+Element.Methods.childOf = Element.Methods.descendantOf;
+
+var Insertion = {
+ Before: function(element, content) {
+ return Element.insert(element, {before:content});
+ },
+
+ Top: function(element, content) {
+ return Element.insert(element, {top:content});
+ },
+
+ Bottom: function(element, content) {
+ return Element.insert(element, {bottom:content});
+ },
+
+ After: function(element, content) {
+ return Element.insert(element, {after:content});
+ }
+};
+
+var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
+
+// This should be moved to script.aculo.us; notice the deprecated methods
+// further below, that map to the newer Element methods.
+var Position = {
+ // set to true if needed, warning: firefox performance problems
+ // NOT neeeded for page scrolling, only if draggable contained in
+ // scrollable elements
+ includeScrollOffsets: false,
+
+ // must be called before calling withinIncludingScrolloffset, every time the
+ // page is scrolled
+ prepare: function() {
+ this.deltaX = window.pageXOffset
+ || document.documentElement.scrollLeft
+ || document.body.scrollLeft
+ || 0;
+ this.deltaY = window.pageYOffset
+ || document.documentElement.scrollTop
+ || document.body.scrollTop
+ || 0;
+ },
+
+ // caches x/y coordinate pair to use with overlap
+ within: function(element, x, y) {
+ if (this.includeScrollOffsets)
+ return this.withinIncludingScrolloffsets(element, x, y);
+ this.xcomp = x;
+ this.ycomp = y;
+ this.offset = Element.cumulativeOffset(element);
+
+ return (y >= this.offset[1] &&
+ y < this.offset[1] + element.offsetHeight &&
+ x >= this.offset[0] &&
+ x < this.offset[0] + element.offsetWidth);
+ },
+
+ withinIncludingScrolloffsets: function(element, x, y) {
+ var offsetcache = Element.cumulativeScrollOffset(element);
+
+ this.xcomp = x + offsetcache[0] - this.deltaX;
+ this.ycomp = y + offsetcache[1] - this.deltaY;
+ this.offset = Element.cumulativeOffset(element);
+
+ return (this.ycomp >= this.offset[1] &&
+ this.ycomp < this.offset[1] + element.offsetHeight &&
+ this.xcomp >= this.offset[0] &&
+ this.xcomp < this.offset[0] + element.offsetWidth);
+ },
+
+ // within must be called directly before
+ overlap: function(mode, element) {
+ if (!mode) return 0;
+ if (mode == 'vertical')
+ return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
+ element.offsetHeight;
+ if (mode == 'horizontal')
+ return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
+ element.offsetWidth;
+ },
+
+ // Deprecation layer -- use newer Element methods now (1.5.2).
+
+ cumulativeOffset: Element.Methods.cumulativeOffset,
+
+ positionedOffset: Element.Methods.positionedOffset,
+
+ absolutize: function(element) {
+ Position.prepare();
+ return Element.absolutize(element);
+ },
+
+ relativize: function(element) {
+ Position.prepare();
+ return Element.relativize(element);
+ },
+
+ realOffset: Element.Methods.cumulativeScrollOffset,
+
+ offsetParent: Element.Methods.getOffsetParent,
+
+ page: Element.Methods.viewportOffset,
+
+ clone: function(source, target, options) {
+ options = options || { };
+ return Element.clonePosition(target, source, options);
+ }
+};
+
+/*--------------------------------------------------------------------------*/
+
+if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
+ function iter(name) {
+ return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
+ }
+
+ instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
+ function(element, className) {
+ className = className.toString().strip();
+ var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
+ return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
+ } : function(element, className) {
+ className = className.toString().strip();
+ var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
+ if (!classNames && !className) return elements;
+
+ var nodes = $(element).getElementsByTagName('*');
+ className = ' ' + className + ' ';
+
+ for (var i = 0, child, cn; child = nodes[i]; i++) {
+ if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
+ (classNames && classNames.all(function(name) {
+ return !name.toString().blank() && cn.include(' ' + name + ' ');
+ }))))
+ elements.push(Element.extend(child));
+ }
+ return elements;
+ };
+
+ return function(className, parentElement) {
+ return $(parentElement || document.body).getElementsByClassName(className);
+ };
+}(Element.Methods);
+
+/*--------------------------------------------------------------------------*/
+
+Element.ClassNames = Class.create();
+Element.ClassNames.prototype = {
+ initialize: function(element) {
+ this.element = $(element);
+ },
+
+ _each: function(iterator) {
+ this.element.className.split(/\s+/).select(function(name) {
+ return name.length > 0;
+ })._each(iterator);
+ },
+
+ set: function(className) {
+ this.element.className = className;
+ },
+
+ add: function(classNameToAdd) {
+ if (this.include(classNameToAdd)) return;
+ this.set($A(this).concat(classNameToAdd).join(' '));
+ },
+
+ remove: function(classNameToRemove) {
+ if (!this.include(classNameToRemove)) return;
+ this.set($A(this).without(classNameToRemove).join(' '));
+ },
+
+ toString: function() {
+ return $A(this).join(' ');
+ }
+};
+
+Object.extend(Element.ClassNames.prototype, Enumerable);
+
+/*--------------------------------------------------------------------------*/
+
+Element.addMethods(); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/raptor.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/raptor.js
new file mode 100644
index 00000000..a13e77c8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/raptor.js
@@ -0,0 +1,314 @@
+function grayOut(vis, options) {
+ // Pass true to gray out screen, false to ungray
+ // options are optional. This is a JSON object with the following (optional) properties
+ // opacity:0-100 // Lower number = less grayout higher = more of a blackout
+ // zindex: # // HTML elements with a higher zindex appear on top of the gray out
+ // bgcolor: (#xxxxxx) // Standard RGB Hex color code
+ // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
+ // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
+ // in any order. Pass only the properties you need to set.
+ var options = options || {};
+ var zindex = options.zindex || 50;
+ var opacity = options.opacity || 20;
+ var opaque = (opacity / 100);
+ var bgcolor = options.bgcolor || '#000000';
+ var dark=document.getElementById('darkenScreenObject');
+ //var tbody = document.getElementsByTagName("body")[0];
+ var tbody = document.body;
+ var myAjax = document.getElementById('AjaxLoading');
+
+ if (!dark) {
+ // The dark layer doesn't exist, it's never been created. So we'll
+ // create it here and apply some basic styles.
+ // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
+ var tnode = document.createElement('div'); // Create the layer.
+ tnode.style.position='absolute'; // Position absolutely
+ tnode.style.top='0px'; // In the top
+ tnode.style.left='0px'; // Left corner of the page
+ tnode.style.overflow='hidden'; // Try to avoid making scroll bars
+ tnode.style.display='none'; // Start out Hidden
+ tnode.id='darkenScreenObject'; // Name it so we can find it later
+ tbody.appendChild(tnode); // Add it to the web page
+ dark=document.getElementById('darkenScreenObject'); // Get the object.
+ }
+ if (vis) {
+ // Calculate the page width and height
+ if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
+ var pageWidth = document.body.scrollWidth+'px';
+ var pageHeight = document.body.scrollHeight+'px';
+ } else if( document.body.offsetWidth ) {
+ var pageWidth = document.body.offsetWidth+'px';
+ var pageHeight = document.body.offsetHeight+'px';
+ } else {
+ var pageWidth='100%';
+ var pageHeight='100%';
+ }
+ //set the shader to cover the entire page and make it visible.
+ dark.style.opacity=opaque;
+ dark.style.MozOpacity=opaque;
+ dark.style.filter='alpha(opacity='+opacity+')';
+ dark.style.zIndex=zindex;
+ dark.style.backgroundColor=bgcolor;
+ dark.style.width= pageWidth;
+ dark.style.height= pageHeight;
+ dark.style.display='block';
+ //MyAjax
+
+ /* Display the "Loading" box */
+ var tnode = document.createElement('div'); // Create the layer.
+ tnode.style.position='absolute'; // Position absolutely
+ tnode.style.top='0px'; // In the top
+ tnode.style.left='0px'; // Left corner of the page
+ tnode.style.overflow='hidden'; // Try to avoid making scroll bars
+ tnode.style.display='none'; // Start out Hidden
+ tnode.id='AjaxLoading'; // Name it so we can find it later
+ tbody.appendChild(tnode); // Add it to the web page
+ myAjax=document.getElementById('AjaxLoading'); // Get the object.
+
+ // Content
+ // Reset the opacity options. Want this on top
+ var loadingOptions = loadingOptions || {};
+ var zindex = loadingOptions.zindex || 100;
+ var opacity = loadingOptions.opacity || 100;
+ var opaque = (opacity / 100);
+ var bgcolor = loadingOptions.bgcolor || '#FFFFFF';
+
+ myAjax.style.opacity=opaque;
+ myAjax.style.MozOpacity=opaque;
+ myAjax.style.filter='alpha(opacity='+opacity+')';
+ myAjax.style.zIndex=zindex;
+
+ myAjax.style.height= '40px';
+ myAjax.style.padding = '3px';
+ myAjax.style.fontSize = '14px';
+ myAjax.style.width = '100px';
+ myAjax.style.textAlign = 'center';
+ myAjax.style.left = '45%';
+ myAjax.style.top = '5%';
+ myAjax.style.position = 'absolute';
+ myAjax.style.border = '2px solid #666';
+ myAjax.style.backgroundColor = bgcolor;
+
+ myAjax.innerHTML='Loading <img src="static/fusion/raptor/images/progress.gif" id="wait" />';
+ myAjax.style.display='block';
+
+ } else {
+ if(dark) dark.style.display='none';
+ if(myAjax) myAjax.style.display='none';
+ }
+}
+function checkDate(dateStr, isOptional) {
+ if(dateStr.charAt(0) == '[' && dateStr.charAt(dateStr.length-1) == ']')
+ return true;
+ if(dateStr=="")
+ return isOptional;
+
+ if((dateStr.length<6)||(dateStr.length>10))
+ return false;
+
+ if(dateStr.charAt(1)=='/') {
+ dmonth = parseInt(dateStr.substr(0,1));
+ dateStr = dateStr.substr(2,dateStr.length-2);
+ } else {
+ //For some strange reason "08" is parsed as 0, so I remove leading 0-s
+ if(dateStr.charAt(0)=='0')
+ dmonth = parseInt(dateStr.substr(1,1));
+ else
+ dmonth = parseInt(dateStr.substr(0,2));
+ dateStr = dateStr.substr(3,dateStr.length-3);
+ }
+
+ if(dateStr.charAt(1)=='/') {
+ dday = parseInt(dateStr.substr(0,1));
+ dateStr = dateStr.substr(2,dateStr.length-2);
+ } else {
+ //For some strange reason "08" is parsed as 0, so I remove leading 0-s
+ if(dateStr.charAt(0)=='0')
+ dday = parseInt(dateStr.substr(1,1));
+ else
+ dday = parseInt(dateStr.substr(0,2));
+ dateStr = dateStr.substr(3,dateStr.length-3);
+ }
+
+ if(dateStr.length==2) {
+ if (parseInt(dateStr)>50)
+ dateStr="19"+dateStr;
+ else
+ dateStr="20"+dateStr;
+ }
+ dyear = parseInt(dateStr);
+ //alert("day: "+dday+", month: "+dmonth+", year: "+dyear);
+ if((dyear<1990)||(dyear>2090)||(dmonth<1)||(dmonth>12)||(dday<1)||
+ (dday>((dmonth==2)?(((dyear % 4 == 0) && ((!(dyear % 100 == 0))||(dyear % 400 == 0)))?29:28):(((dmonth==1)||(dmonth==3)||(dmonth==5)||(dmonth==7)||(dmonth==8)||(dmonth==10)||(dmonth==12))?31:30))))
+ return false;
+
+ return true;
+} // checkDate
+
+function validateNumber(numValue, mustBeInteger, mustBePositive) {
+ var decimalPointFound = false;
+ for(var i=0; i<numValue.length; i++) {
+ var ch = numValue.charAt(i);
+
+ if(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||ch=='6'||ch=='7'||ch=='8'||ch=='9') {
+ // Valid character - do nothing
+ } else if(ch=='-') {
+ if(mustBePositive||i>0)
+ return false;
+ } else if(ch=='.') {
+ if(mustBeInteger||decimalPointFound)
+ return false;
+ else
+ decimalPointFound = true;
+ } else
+ // Invalid character
+ return false;
+ } // for
+
+ return true;
+} // validateNumber
+
+function checkInteger(numValue) {
+ return validateNumber(numValue, true, false);
+} // checkInteger
+
+function checkNonNegativeInteger(numValue) {
+ return validateNumber(numValue, true, true);
+} // checkNonNegativeInteger
+
+function checkPositiveInteger(numValue) {
+ if(! checkNonNegativeInteger(numValue))
+ return false;
+
+ if(parseInt(numValue)==0)
+ return false;
+
+ return true;
+} // checkPositiveInteger
+
+function checkFloat(numValue) {
+ return validateNumber(numValue, false, false);
+} // checkFloat
+
+function checkNonNegativeFloat(numValue) {
+ return validateNumber(numValue, false, true);
+} // checkNonNegativeFloat
+
+function checkPositiveFloat(numValue) {
+ if(! checkNonNegativeFloat(numValue))
+ return false;
+
+ if(parseFloat(numValue)<0.001&&parseFloat(numValue)>-0.001)
+ return false;
+
+ return true;
+} // checkPositiveFloat
+
+function getDocHeight(doc) {
+var docHt = 0, sh, oh;
+if (doc.height) docHt = doc.height;
+else if (doc.body) {
+if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
+if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
+if (sh && oh) docHt = Math.max(sh, oh);
+}
+return docHt;
+}
+
+function getDocWidth(doc)
+{
+ var docWd = 0, sh, oh;
+ if (doc.width)
+ docWd = doc.width;
+ else if (doc.body)
+ {
+ if (doc.body.scrollWidth)
+ docWd = sh = doc.body.scrollWidth;
+ if (doc.body.offsetWidth)
+ docWd = oh = doc.body.offsetWidth;
+ if (sh && oh)
+ docWd = Math.max(sh, oh);
+ }
+ return docWd;
+}
+
+
+function setIframeHeight(iframeName)
+{
+ var oldY = document.body.scrollTop;
+ var iframeWin = window.frames[iframeName];
+ var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
+ if ( iframeEl && iframeWin ) {
+ iframeEl.style.height = "auto";
+ // helps resize (for some) if new doc shorter than previous
+ var docHt = getDocHeight(iframeWin.document);
+ var docWd = getDocWidth(iframeWin.document);
+ // need to add to height to be sure it will all show
+ if (docHt)
+ iframeEl.style.height = docHt + 1 + "px";
+ if (docWd)
+ iframeEl.style.width = docWd + 1 + "px";
+ }
+ if (oldY != null && oldY != 'undefined')
+ document.body.scrollTop = oldY;
+}
+
+function resizeFrames(){
+ var isFolderAllowed = arguments[0];
+ if (isFolderAllowed == null || isFolderAllowed == 'true'){
+ if (document.getElementById('scrollableTable') && document.body.offsetHeight > 195)
+ document.getElementById('scrollableTable').style.height=document.body.offsetHeight - 185;
+ if (document.getElementById('contentDiv') && document.body.offsetHeight > 145)
+ document.getElementById('contentDiv').style.height=document.body.offsetHeight - 135;
+ if (document.getElementById('content_Iframe') && document.body.offsetHeight > 145)
+ document.getElementById('content_Iframe').height=document.body.offsetHeight - 135;
+
+ }else{
+ setIframeHeight('content_Iframe');
+ }
+}
+
+function resizeWindow() {
+ var isFolderAllowed = arguments[0];
+ if (isFolderAllowed != null)
+ resizeFrames(isFolderAllowed);
+ else
+ resizeFrames(false);
+}
+
+/**
+* Usage : var myObje = $('theIdOfTheElementYouWantToGet');
+* Simple gives you the element. Avoids using document.getElementById();
+*/
+ var $;
+ if (!$ && document.getElementById) {
+ $ = function() {
+ var elements = new Array();
+ for (var i = 0; i < arguments.length; i++) {
+ var element = arguments[i];
+ if (typeof element == 'string') {
+ element = document.getElementById(element);
+ }
+ if (arguments.length == 1) {
+ return element;
+ }
+ elements.push(element);
+ }
+ return elements;
+ }
+ } else if (!$ && document.all) {
+ $ = function() {
+ var elements = new Array();
+ for (var i = 0; i < arguments.length; i++) {
+ var element = arguments[i];
+ if (typeof element == 'string') {
+ element = document.all[element];
+ }
+ if (arguments.length == 1) {
+ return element;
+ }
+ elements.push(element);
+ }
+ return elements;
+ }
+ }
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/rounded-corners.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/rounded-corners.js
new file mode 100644
index 00000000..f5df01ce
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/rounded-corners.js
@@ -0,0 +1,353 @@
+/************************************************************************************************************<br>
+<br>
+ @fileoverview
+ Rounded corners class<br>
+ (C) www.dhtmlgoodies.com, September 2006<br>
+ <br>
+ This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website. <br>
+ <br>
+ Terms of use:<br>
+ Look at the terms of use at http://www.dhtmlgoodies.com/index.html?page=termsOfUse<br>
+ <br>
+ Thank you!<br>
+ <br>
+ www.dhtmlgoodies.com<br>
+ Alf Magne Kalleland<br>
+<br>
+************************************************************************************************************/
+
+// {{{ Constructor
+function DHTMLgoodies_roundedCorners()
+{
+ var roundedCornerTargets;
+
+ this.roundedCornerTargets = new Array();
+
+}
+ var string = '';
+// }}}
+DHTMLgoodies_roundedCorners.prototype = {
+
+ // {{{ addTarget()
+ /**
+ *
+ *
+ * Add rounded corners to an element
+ *
+ * @param String divId = Id of element on page. Example "leftColumn" for &lt;div id="leftColumn">
+ * @param Int xRadius = Y radius of rounded corners, example 10
+ * @param Int yRadius = Y radius of rounded corners, example 10
+ * @param String color = Background color of element, example #FFF or #AABBCC
+ * @param String color = backgroundColor color of element "behind", example #FFF or #AABBCC
+ * @param Int padding = Padding of content - This will be added as left and right padding(not top and bottom)
+ * @param String heightOfContent = Optional argument. You can specify a fixed height of your content. example "15" which means pixels, or "50%".
+ * @param String whichCorners = Optional argument. Commaseparated list of corners, example "top_left,top_right,bottom_left"
+ *
+ * @public
+ */
+ addTarget : function(divId,xRadius,yRadius,color,backgroundColor,padding,heightOfContent,whichCorners)
+ {
+ var index = this.roundedCornerTargets.length;
+ this.roundedCornerTargets[index] = new Array();
+ this.roundedCornerTargets[index]['divId'] = divId;
+ this.roundedCornerTargets[index]['xRadius'] = xRadius;
+ this.roundedCornerTargets[index]['yRadius'] = yRadius;
+ this.roundedCornerTargets[index]['color'] = color;
+ this.roundedCornerTargets[index]['backgroundColor'] = backgroundColor;
+ this.roundedCornerTargets[index]['padding'] = padding;
+ this.roundedCornerTargets[index]['heightOfContent'] = heightOfContent;
+ this.roundedCornerTargets[index]['whichCorners'] = whichCorners;
+
+ }
+ // }}}
+ ,
+ // {{{ init()
+ /**
+ *
+ *
+ * Initializes the script
+ *
+ *
+ * @public
+ */
+ init : function()
+ {
+
+ for(var targetCounter=0;targetCounter < this.roundedCornerTargets.length;targetCounter++){
+
+ // Creating local variables of each option
+ whichCorners = this.roundedCornerTargets[targetCounter]['whichCorners'];
+ divId = this.roundedCornerTargets[targetCounter]['divId'];
+ xRadius = this.roundedCornerTargets[targetCounter]['xRadius'];
+ yRadius = this.roundedCornerTargets[targetCounter]['yRadius'];
+ color = this.roundedCornerTargets[targetCounter]['color'];
+ backgroundColor = this.roundedCornerTargets[targetCounter]['backgroundColor'];
+ padding = this.roundedCornerTargets[targetCounter]['padding'];
+ heightOfContent = this.roundedCornerTargets[targetCounter]['heightOfContent'];
+ whichCorners = this.roundedCornerTargets[targetCounter]['whichCorners'];
+
+ // Which corners should we add rounded corners to?
+ var cornerArray = new Array();
+ if(!whichCorners || whichCorners=='all'){
+ cornerArray['top_left'] = true;
+ cornerArray['top_right'] = true;
+ cornerArray['bottom_left'] = true;
+ cornerArray['bottom_right'] = true;
+ }else{
+ cornerArray = whichCorners.split(/,/gi);
+ for(var prop in cornerArray)cornerArray[cornerArray[prop]] = true;
+ }
+
+
+ var factorX = xRadius/yRadius; // How big is x radius compared to y radius
+
+ var obj = document.getElementById(divId); // Creating reference to element
+ obj.style.backgroundColor=null; // Setting background color blank
+ obj.style.backgroundColor='transparent';
+ var content = obj.innerHTML; // Saving HTML content of this element
+ obj.innerHTML = ''; // Setting HTML content of element blank-
+
+
+
+
+ // Adding top corner div.
+
+ if(cornerArray['top_left'] || cornerArray['top_right']){
+ var topBar_container = document.createElement('DIV');
+ topBar_container.style.height = yRadius + 'px';
+ topBar_container.style.overflow = 'hidden';
+
+ obj.appendChild(topBar_container);
+ var currentAntialiasSize = 0;
+ var savedRestValue = 0;
+
+ for(no=1;no<=yRadius;no++){
+ var marginSize = (xRadius - (this.getY((yRadius - no),yRadius,factorX)));
+ var marginSize_decimals = (xRadius - (this.getY_withDecimals((yRadius - no),yRadius,factorX)));
+ var restValue = xRadius - marginSize_decimals;
+ var antialiasSize = xRadius - marginSize - Math.floor(savedRestValue)
+ var foregroundSize = xRadius - (marginSize + antialiasSize);
+
+ var el = document.createElement('DIV');
+ el.style.overflow='hidden';
+ el.style.height = '1px';
+ if(cornerArray['top_left'])el.style.marginLeft = marginSize + 'px';
+ if(cornerArray['top_right'])el.style.marginRight = marginSize + 'px';
+ topBar_container.appendChild(el);
+ var y = topBar_container;
+
+ for(var no2=1;no2<=antialiasSize;no2++){
+ switch(no2){
+ case 1:
+ if (no2 == antialiasSize)
+ blendMode = ((restValue + savedRestValue) /2) - foregroundSize;
+ else {
+ var tmpValue = this.getY_withDecimals((xRadius - marginSize - no2),xRadius,1/factorX);
+ blendMode = (restValue - foregroundSize - antialiasSize + 1) * (tmpValue - (yRadius - no)) /2;
+ }
+ break;
+ case antialiasSize:
+ var tmpValue = this.getY_withDecimals((xRadius - marginSize - no2 + 1),xRadius,1/factorX);
+ blendMode = 1 - (1 - (tmpValue - (yRadius - no))) * (1 - (savedRestValue - foregroundSize)) /2;
+ break;
+ default:
+ var tmpValue2 = this.getY_withDecimals((xRadius - marginSize - no2),xRadius,1/factorX);
+ var tmpValue = this.getY_withDecimals((xRadius - marginSize - no2 + 1),xRadius,1/factorX);
+ blendMode = ((tmpValue + tmpValue2) / 2) - (yRadius - no);
+ }
+
+ el.style.backgroundColor = this.__blendColors(backgroundColor,color,blendMode);
+ y.appendChild(el);
+ y = el;
+ var el = document.createElement('DIV');
+ el.style.height = '1px';
+ el.style.overflow='hidden';
+ if(cornerArray['top_left'])el.style.marginLeft = '1px';
+ if(cornerArray['top_right'])el.style.marginRight = '1px';
+ el.style.backgroundColor=color;
+ }
+
+ y.appendChild(el);
+ savedRestValue = restValue;
+ }
+ }
+
+ // Add content
+ var contentDiv = document.createElement('DIV');
+ contentDiv.className = obj.className;
+ contentDiv.style.border='1px solid ' + color;
+ contentDiv.innerHTML = content;
+ contentDiv.style.backgroundColor=color;
+ contentDiv.style.paddingLeft = padding + 'px';
+ contentDiv.style.paddingRight = padding + 'px';
+
+ if(!heightOfContent)heightOfContent = '';
+ heightOfContent = heightOfContent + '';
+ if(heightOfContent.length>0 && heightOfContent.indexOf('%')==-1)heightOfContent = heightOfContent + 'px';
+ if(heightOfContent.length>0)contentDiv.style.height = heightOfContent;
+
+ obj.appendChild(contentDiv);
+
+
+ if(cornerArray['bottom_left'] || cornerArray['bottom_right']){
+ var bottomBar_container = document.createElement('DIV');
+ bottomBar_container.style.height = yRadius + 'px';
+ bottomBar_container.style.overflow = 'hidden';
+
+ obj.appendChild(bottomBar_container);
+ var currentAntialiasSize = 0;
+ var savedRestValue = 0;
+
+ var errorOccured = false;
+ var arrayOfDivs = new Array();
+ for(no=1;no<=yRadius;no++){
+
+ var marginSize = (xRadius - (this.getY((yRadius - no),yRadius,factorX)));
+ var marginSize_decimals = (xRadius - (this.getY_withDecimals((yRadius - no),yRadius,factorX)));
+
+ var restValue = (xRadius - marginSize_decimals);
+ var antialiasSize = xRadius - marginSize - Math.floor(savedRestValue)
+ var foregroundSize = xRadius - (marginSize + antialiasSize);
+
+ var el = document.createElement('DIV');
+ el.style.overflow='hidden';
+ el.style.height = '1px';
+ if(cornerArray['bottom_left'])el.style.marginLeft = marginSize + 'px';
+ if(cornerArray['bottom_right'])el.style.marginRight = marginSize + 'px';
+ bottomBar_container.insertBefore(el,bottomBar_container.firstChild);
+
+ var y = bottomBar_container;
+
+ for(var no2=1;no2<=antialiasSize;no2++){
+ switch(no2){
+ case 1:
+ if (no2 == antialiasSize)
+ blendMode = ((restValue + savedRestValue) /2) - foregroundSize;
+ else {
+ var tmpValue = this.getY_withDecimals((xRadius - marginSize - no2),xRadius,1/factorX);
+ blendMode = (restValue - foregroundSize - antialiasSize + 1) * (tmpValue - (yRadius - no)) /2;
+ }
+ break;
+ case antialiasSize:
+ var tmpValue = this.getY_withDecimals((xRadius - marginSize - no2 + 1),xRadius,1/factorX);
+ blendMode = 1 - (1 - (tmpValue - (yRadius - no))) * (1 - (savedRestValue - foregroundSize)) /2;
+ break;
+ default:
+ var tmpValue2 = this.getY_withDecimals((xRadius - marginSize - no2),xRadius,1/factorX);
+ var tmpValue = this.getY_withDecimals((xRadius - marginSize - no2 + 1),xRadius,1/factorX);
+ blendMode = ((tmpValue + tmpValue2) / 2) - (yRadius - no);
+ }
+
+ el.style.backgroundColor = this.__blendColors(backgroundColor,color,blendMode);
+
+ if(y==bottomBar_container)arrayOfDivs[arrayOfDivs.length] = el;
+
+ try{ // Need to look closer at this problem which occures in Opera.
+ var firstChild = y.getElementsByTagName('DIV')[0];
+ y.insertBefore(el,y.firstChild);
+ }catch(e){
+ y.appendChild(el);
+ errorOccured = true;
+ }
+ y = el;
+
+ var el = document.createElement('DIV');
+ el.style.height = '1px';
+ el.style.overflow='hidden';
+ if(cornerArray['bottom_left'])el.style.marginLeft = '1px';
+ if(cornerArray['bottom_right'])el.style.marginRight = '1px';
+
+ }
+
+ if(errorOccured){ // Opera fix
+ for(var divCounter=arrayOfDivs.length-1;divCounter>=0;divCounter--){
+ bottomBar_container.appendChild(arrayOfDivs[divCounter]);
+ }
+ }
+
+ el.style.backgroundColor=color;
+ y.appendChild(el);
+ savedRestValue = restValue;
+ }
+
+ }
+ }
+ }
+ // }}}
+ ,
+ // {{{ getY()
+ /**
+ *
+ *
+ * Add rounded corners to an element
+ *
+ * @param Int x = x Coordinate
+ * @param Int maxX = Size of rounded corners
+ *
+ *
+ * @private
+ */
+ getY : function(x,maxX,factorX){
+ // y = sqrt(100 - x^2)
+ // Y = 0.5 * ((100 - x^2)^0.5);
+ return Math.max(0,Math.ceil(factorX * Math.sqrt( (maxX * maxX) - (x*x)) ));
+
+ }
+ // }}}
+ ,
+ // {{{ getY_withDecimals()
+ /**
+ *
+ *
+ * Add rounded corners to an element
+ *
+ * @param Int x = x Coordinate
+ * @param Int maxX = Size of rounded corners
+ *
+ *
+ * @private
+ */
+ getY_withDecimals : function(x,maxX,factorX){
+ // y = sqrt(100 - x^2)
+ // Y = 0.5 * ((100 - x^2)^0.5);
+ return Math.max(0,factorX * Math.sqrt( (maxX * maxX) - (x*x)) );
+
+ }
+
+
+ ,
+
+ // {{{ __blendColors()
+ /**
+ *
+ *
+ * Simply blending two colors by extracting red, green and blue and subtracting difference between colors from them.
+ * Finally, we multiply it with the blendMode value
+ *
+ * @param String colorA = RGB color
+ * @param String colorB = RGB color
+ * @param Float blendMode
+ *
+ *
+ * @private
+ */
+ __blendColors : function (colorA, colorB, blendMode) {
+ if(colorA.length=='4'){ // In case we are dealing with colors like #FFF
+ colorA = '#' + colorA.substring(1,1) + colorA.substring(1,1) + colorA.substring(2,1) + colorA.substring(2,1) + colorA.substring(3,1) + colorA.substring(3,1);
+ }
+ if(colorB.length=='4'){ // In case we are dealing with colors like #FFF
+ colorB = '#' + colorB.substring(1,1) + colorB.substring(1,1) + colorB.substring(2,1) + colorB.substring(2,1) + colorB.substring(3,1) + colorB.substring(3,1);
+ }
+ var colorArrayA = [parseInt('0x' + colorA.substring(1,3)), parseInt('0x' + colorA.substring(3, 5)), parseInt('0x' + colorA.substring(5, 7))]; // Create array of Red, Green and Blue ( 0-255)
+ var colorArrayB = [parseInt('0x' + colorB.substring(1,3)), parseInt('0x' + colorB.substring(3, 5)), parseInt('0x' + colorB.substring(5, 7))]; // Create array of Red, Green and Blue ( 0-255)
+ var red = Math.round(colorArrayA[0] + (colorArrayB[0] - colorArrayA[0])*blendMode).toString(16); // Create new Red color ( Hex )
+ var green = Math.round(colorArrayA[1] + (colorArrayB[1] - colorArrayA[1])*blendMode).toString(16); // Create new Green color ( Hex )
+ var blue = Math.round(colorArrayA[2] + (colorArrayB[2] - colorArrayA[2])*blendMode).toString(16); // Create new Blue color ( Hex )
+
+ if(red.length==1)red = '0' + red;
+ if(green.length==1)green = '0' + green;
+ if(blue.length==1)blue = '0' + blue;
+
+ return '#' + red + green+ blue; // Return new RGB color
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/script.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/script.js
new file mode 100644
index 00000000..ea153016
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/script.js
@@ -0,0 +1,482 @@
+// A few configuration settings
+var CROSSHAIRS_LOCATION = 'static/fusion/raptor/images/crosshairs.png';
+var HUE_SLIDER_LOCATION = 'static/fusion/raptor/images/h.png';
+var HUE_SLIDER_ARROWS_LOCATION = 'static/fusion/raptor/images/position.png';
+var SAT_VAL_SQUARE_LOCATION = 'static/fusion/raptor/images/sv.png';
+
+// Here are some boring utility functions. The real code comes later.
+
+function hexToRgb(hex_string, default_)
+{
+ if (default_ == undefined)
+ {
+ default_ = null;
+ }
+
+ if (hex_string.substr(0, 1) == '#')
+ {
+ hex_string = hex_string.substr(1);
+ }
+
+ var r;
+ var g;
+ var b;
+ if (hex_string.length == 3)
+ {
+ r = hex_string.substr(0, 1);
+ r += r;
+ g = hex_string.substr(1, 1);
+ g += g;
+ b = hex_string.substr(2, 1);
+ b += b;
+ }
+ else if (hex_string.length == 6)
+ {
+ r = hex_string.substr(0, 2);
+ g = hex_string.substr(2, 2);
+ b = hex_string.substr(4, 2);
+ }
+ else
+ {
+ return default_;
+ }
+
+ r = parseInt(r, 16);
+ g = parseInt(g, 16);
+ b = parseInt(b, 16);
+ if (isNaN(r) || isNaN(g) || isNaN(b))
+ {
+ return default_;
+ }
+ else
+ {
+ return {r: r / 255, g: g / 255, b: b / 255};
+ }
+}
+
+function rgbToHex(r, g, b, includeHash)
+{
+ r = Math.round(r * 255);
+ g = Math.round(g * 255);
+ b = Math.round(b * 255);
+ if (includeHash == undefined)
+ {
+ includeHash = true;
+ }
+
+ r = r.toString(16);
+ if (r.length == 1)
+ {
+ r = '0' + r;
+ }
+ g = g.toString(16);
+ if (g.length == 1)
+ {
+ g = '0' + g;
+ }
+ b = b.toString(16);
+ if (b.length == 1)
+ {
+ b = '0' + b;
+ }
+ return ((includeHash ? '#' : '') + r + g + b).toUpperCase();
+}
+
+var arVersion = navigator.appVersion.split("MSIE");
+var version = parseFloat(arVersion[1]);
+
+function fixPNG(myImage)
+{
+ if ((version >= 5.5) && (version < 7) && (document.body.filters))
+ {
+ var node = document.createElement('span');
+ node.id = myImage.id;
+ node.className = myImage.className;
+ node.title = myImage.title;
+ node.style.cssText = myImage.style.cssText;
+ node.style.setAttribute('filter', "progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ + "(src=\'" + myImage.src + "\', sizingMethod='scale')");
+ node.style.fontSize = '0';
+ node.style.width = myImage.width.toString() + 'px';
+ node.style.height = myImage.height.toString() + 'px';
+ node.style.display = 'inline-block';
+ return node;
+ }
+ else
+ {
+ return myImage.cloneNode(false);
+ }
+}
+
+function trackDrag(node, handler)
+{
+ function fixCoords(x, y)
+ {
+ var nodePageCoords = pageCoords(node);
+ x = (x - nodePageCoords.x) + document.documentElement.scrollLeft;
+ y = (y - nodePageCoords.y) + document.documentElement.scrollTop;
+ if (x < 0) x = 0;
+ if (y < 0) y = 0;
+ if (x > node.offsetWidth - 1) x = node.offsetWidth - 1;
+ if (y > node.offsetHeight - 1) y = node.offsetHeight - 1;
+ return {x: x, y: y};
+ }
+ function mouseDown(ev)
+ {
+ var coords = fixCoords(ev.clientX, ev.clientY);
+ var lastX = coords.x;
+ var lastY = coords.y;
+ handler(coords.x, coords.y);
+
+ function moveHandler(ev)
+ {
+ var coords = fixCoords(ev.clientX, ev.clientY);
+ if (coords.x != lastX || coords.y != lastY)
+ {
+ lastX = coords.x;
+ lastY = coords.y;
+ handler(coords.x, coords.y);
+ }
+ }
+ function upHandler(ev)
+ {
+ myRemoveEventListener(document, 'mouseup', upHandler);
+ myRemoveEventListener(document, 'mousemove', moveHandler);
+ myAddEventListener(node, 'mousedown', mouseDown);
+ }
+ myAddEventListener(document, 'mouseup', upHandler);
+ myAddEventListener(document, 'mousemove', moveHandler);
+ myRemoveEventListener(node, 'mousedown', mouseDown);
+ if (ev.preventDefault) ev.preventDefault();
+ }
+ myAddEventListener(node, 'mousedown', mouseDown);
+ node.onmousedown = function(e) { return false; };
+ node.onselectstart = function(e) { return false; };
+ node.ondragstart = function(e) { return false; };
+}
+
+var eventListeners = [];
+
+function findEventListener(node, event, handler)
+{
+ var i;
+ for (i in eventListeners)
+ {
+ if (eventListeners[i].node == node && eventListeners[i].event == event
+ && eventListeners[i].handler == handler)
+ {
+ return i;
+ }
+ }
+ return null;
+}
+function myAddEventListener(node, event, handler)
+{
+ if (findEventListener(node, event, handler) != null)
+ {
+ return;
+ }
+
+ if (!node.addEventListener)
+ {
+ node.attachEvent('on' + event, handler);
+ }
+ else
+ {
+ node.addEventListener(event, handler, false);
+ }
+
+ eventListeners.push({node: node, event: event, handler: handler});
+}
+
+function removeEventListenerIndex(index)
+{
+ var eventListener = eventListeners[index];
+ delete eventListeners[index];
+
+ if (!eventListener.node.removeEventListener)
+ {
+ eventListener.node.detachEvent('on' + eventListener.event,
+ eventListener.handler);
+ }
+ else
+ {
+ eventListener.node.removeEventListener(eventListener.event,
+ eventListener.handler, false);
+ }
+}
+
+function myRemoveEventListener(node, event, handler)
+{
+ removeEventListenerIndex(findEventListener(node, event, handler));
+}
+
+function cleanupEventListeners()
+{
+ var i;
+ for (i = eventListeners.length; i > 0; i--)
+ {
+ if (eventListeners[i] != undefined)
+ {
+ removeEventListenerIndex(i);
+ }
+ }
+}
+myAddEventListener(window, 'unload', cleanupEventListeners);
+
+// This copyright statement applies to the following two functions,
+// which are taken from MochiKit.
+//
+// Copyright 2005 Bob Ippolito <bob@redivi.com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject
+// to the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+function hsvToRgb(hue, saturation, value)
+{
+ var red;
+ var green;
+ var blue;
+ if (value == 0.0)
+ {
+ red = 0;
+ green = 0;
+ blue = 0;
+ }
+ else
+ {
+ var i = Math.floor(hue * 6);
+ var f = (hue * 6) - i;
+ var p = value * (1 - saturation);
+ var q = value * (1 - (saturation * f));
+ var t = value * (1 - (saturation * (1 - f)));
+ switch (i)
+ {
+ case 1: red = q; green = value; blue = p; break;
+ case 2: red = p; green = value; blue = t; break;
+ case 3: red = p; green = q; blue = value; break;
+ case 4: red = t; green = p; blue = value; break;
+ case 5: red = value; green = p; blue = q; break;
+ case 6: // fall through
+ case 0: red = value; green = t; blue = p; break;
+ }
+ }
+ return {r: red, g: green, b: blue};
+}
+
+function rgbToHsv(red, green, blue)
+{
+ var max = Math.max(Math.max(red, green), blue);
+ var min = Math.min(Math.min(red, green), blue);
+ var hue;
+ var saturation;
+ var value = max;
+ if (min == max)
+ {
+ hue = 0;
+ saturation = 0;
+ }
+ else
+ {
+ var delta = (max - min);
+ saturation = delta / max;
+ if (red == max)
+ {
+ hue = (green - blue) / delta;
+ }
+ else if (green == max)
+ {
+ hue = 2 + ((blue - red) / delta);
+ }
+ else
+ {
+ hue = 4 + ((red - green) / delta);
+ }
+ hue /= 6;
+ if (hue < 0)
+ {
+ hue += 1;
+ }
+ if (hue > 1)
+ {
+ hue -= 1;
+ }
+ }
+ return {
+ h: hue,
+ s: saturation,
+ v: value
+ };
+}
+
+function pageCoords(node)
+{
+ var x = node.offsetLeft;
+ var y = node.offsetTop;
+ var parent = node.offsetParent;
+ while (parent != null)
+ {
+ x += parent.offsetLeft;
+ y += parent.offsetTop;
+ parent = parent.offsetParent;
+ }
+ return {x: x, y: y};
+}
+
+// The real code begins here.
+var huePositionImg = document.createElement('img');
+huePositionImg.galleryImg = false;
+huePositionImg.width = 35;
+huePositionImg.height = 11;
+huePositionImg.src = HUE_SLIDER_ARROWS_LOCATION;
+huePositionImg.style.position = 'absolute';
+
+var hueSelectorImg = document.createElement('img');
+hueSelectorImg.galleryImg = false;
+hueSelectorImg.width = 35;
+hueSelectorImg.height = 200;
+hueSelectorImg.src = HUE_SLIDER_LOCATION;
+hueSelectorImg.style.display = 'block';
+
+var satValImg = document.createElement('img');
+satValImg.galleryImg = false;
+satValImg.width = 200;
+satValImg.height = 200;
+satValImg.src = SAT_VAL_SQUARE_LOCATION;
+satValImg.style.display = 'block';
+
+var crossHairsImg = document.createElement('img');
+crossHairsImg.galleryImg = false;
+crossHairsImg.width = 21;
+crossHairsImg.height = 21;
+crossHairsImg.src = CROSSHAIRS_LOCATION;
+crossHairsImg.style.position = 'absolute';
+
+function makeColorSelector(inputBox)
+{
+ var rgb, hsv
+
+ function colorChanged()
+ {
+ var hex = rgbToHex(rgb.r, rgb.g, rgb.b);
+ var hueRgb = hsvToRgb(hsv.h, 1, 1);
+ var hueHex = rgbToHex(hueRgb.r, hueRgb.g, hueRgb.b);
+ previewDiv.style.background = hex;
+ inputBox.value = hex;
+ satValDiv.style.background = hueHex;
+ crossHairs.style.left = ((hsv.v*199)-10).toString() + 'px';
+ crossHairs.style.top = (((1-hsv.s)*199)-10).toString() + 'px';
+ huePos.style.top = ((hsv.h*199)-5).toString() + 'px';
+ }
+ function rgbChanged()
+ {
+ hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);
+ colorChanged();
+ }
+ function hsvChanged()
+ {
+ rgb = hsvToRgb(hsv.h, hsv.s, hsv.v);
+ colorChanged();
+ }
+
+ var colorSelectorDiv = document.createElement('div');
+ colorSelectorDiv.style.padding = '15px';
+ colorSelectorDiv.style.position = 'relative';
+ colorSelectorDiv.style.height = '275px';
+ colorSelectorDiv.style.width = '250px';
+
+ var satValDiv = document.createElement('div');
+ satValDiv.style.position = 'relative';
+ satValDiv.style.width = '200px';
+ satValDiv.style.height = '200px';
+ var newSatValImg = fixPNG(satValImg);
+ satValDiv.appendChild(newSatValImg);
+ var crossHairs = crossHairsImg.cloneNode(false);
+ satValDiv.appendChild(crossHairs);
+ function satValDragged(x, y)
+ {
+ hsv.s = 1-(y/199);
+ hsv.v = (x/199);
+ hsvChanged();
+ }
+ trackDrag(satValDiv, satValDragged)
+ colorSelectorDiv.appendChild(satValDiv);
+
+ var hueDiv = document.createElement('div');
+ hueDiv.style.position = 'absolute';
+ hueDiv.style.left = '230px';
+ hueDiv.style.top = '15px';
+ hueDiv.style.width = '35px';
+ hueDiv.style.height = '200px';
+ var huePos = fixPNG(huePositionImg);
+ hueDiv.appendChild(hueSelectorImg.cloneNode(false));
+ hueDiv.appendChild(huePos);
+ function hueDragged(x, y)
+ {
+ hsv.h = y/199;
+ hsvChanged();
+ }
+ trackDrag(hueDiv, hueDragged);
+ colorSelectorDiv.appendChild(hueDiv);
+
+ var previewDiv = document.createElement('div');
+ previewDiv.style.height = '50px'
+ previewDiv.style.width = '50px';
+ previewDiv.style.position = 'absolute';
+ previewDiv.style.top = '225px';
+ previewDiv.style.left = '15px';
+ previewDiv.style.border = '1px solid black';
+ colorSelectorDiv.appendChild(previewDiv);
+
+ function inputBoxChanged()
+ {
+ rgb = hexToRgb(inputBox.value, {r: 0, g: 0, b: 0});
+ rgbChanged();
+ }
+ myAddEventListener(inputBox, 'change', inputBoxChanged);
+ inputBox.size = 8;
+ inputBox.style.position = 'absolute';
+ inputBox.style.right = '15px';
+ inputBox.style.top = (225 + (25 - (inputBox.offsetHeight/2))).toString() + 'px';
+ colorSelectorDiv.appendChild(inputBox);
+
+ inputBoxChanged();
+
+ return colorSelectorDiv;
+}
+
+function makeColorSelectors(ev)
+{
+ var inputNodes = document.getElementsByTagName('input');
+ var i;
+ for (i = 0; i < inputNodes.length; i++)
+ {
+ var node = inputNodes[i];
+ if (node.className != 'color')
+ {
+ continue;
+ }
+ var parent = node.parentNode;
+ var prevNode = node.previousSibling;
+ var selector = makeColorSelector(node);
+ parent.insertBefore(selector, (prevNode ? prevNode.nextSibling : null));
+ }
+}
+
+myAddEventListener(window, 'load', makeColorSelectors);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.css
new file mode 100644
index 00000000..7f542422
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.css
@@ -0,0 +1,1971 @@
+/*!
+ * ui-grid - v3.0.7 - 2015-10-06
+ * Copyright (c) 2015 ; License: MIT
+ */
+#ui-grid-twbs #ui-grid-twbs .form-horizontal .form-group:before,
+#ui-grid-twbs #ui-grid-twbs .form-horizontal .form-group:after,
+#ui-grid-twbs #ui-grid-twbs .btn-toolbar:before,
+#ui-grid-twbs #ui-grid-twbs .btn-toolbar:after,
+#ui-grid-twbs #ui-grid-twbs .btn-group-vertical > .btn-group:before,
+#ui-grid-twbs #ui-grid-twbs .btn-group-vertical > .btn-group:after {
+ content: " ";
+ display: table;
+}
+#ui-grid-twbs #ui-grid-twbs .form-horizontal .form-group:after,
+#ui-grid-twbs #ui-grid-twbs .btn-toolbar:after,
+#ui-grid-twbs #ui-grid-twbs .btn-group-vertical > .btn-group:after {
+ clear: both;
+}
+.ui-grid {
+ border: 0px solid #d4d4d4;
+ box-sizing: content-box;
+ -webkit-border-radius: 0px;
+ -moz-border-radius: 0px;
+ border-radius: 0px;
+ -webkit-transform: translateZ(0);
+ -moz-transform: translateZ(0);
+ -o-transform: translateZ(0);
+ -ms-transform: translateZ(0);
+ transform: translateZ(0);
+}
+.ui-grid-vertical-bar {
+ position: absolute;
+ right: 0;
+ width: 0;
+}
+.ui-grid-header-cell:not(:last-child) .ui-grid-vertical-bar,
+.ui-grid-cell:not(:last-child) .ui-grid-vertical-bar {
+ width: 1px;
+}
+.ui-grid-scrollbar-placeholder {
+ background-color: transparent;
+}
+.ui-grid-header-cell:not(:last-child) .ui-grid-vertical-bar {
+ background-color: #d4d4d4;
+}
+.ui-grid-cell:not(:last-child) .ui-grid-vertical-bar {
+ background-color: #d4d4d4;
+}
+.ui-grid-header-cell:last-child .ui-grid-vertical-bar {
+ right: -1px;
+ width: 1px;
+ background-color: #d4d4d4;
+}
+.ui-grid-clearfix:before,
+.ui-grid-clearfix:after {
+ content: "";
+ display: table;
+}
+.ui-grid-clearfix:after {
+ clear: both;
+}
+.ui-grid-invisible {
+ visibility: hidden;
+}
+.ui-grid-contents-wrapper {
+ position: relative;
+ height: 100%;
+ width: 100%;
+}
+.ui-grid-sr-only {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ margin: -1px;
+ padding: 0;
+ overflow: hidden;
+ clip: rect(0, 0, 0, 0);
+ border: 0;
+}
+.ui-grid-top-panel-background {
+ background: #f2f2f2;
+ background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(1, #ffffff));
+ background: -ms-linear-gradient(bottom, #eeeeee, #ffffff);
+ background: -moz-linear-gradient(center bottom, #eeeeee 0%, #ffffff 100%);
+ background: -o-linear-gradient(#ffffff, #eeeeee);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);
+}
+.ui-grid-header {
+ border-bottom: 0px solid #d4d4d4;
+ box-sizing: border-box;
+}
+.ui-grid-top-panel {
+ position: relative;
+ overflow: hidden;
+ font-weight: bold;
+ background: #f2f2f2;
+ background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(1, #ffffff));
+ background: -ms-linear-gradient(bottom, #eeeeee, #ffffff);
+ background: -moz-linear-gradient(center bottom, #eeeeee 0%, #ffffff 100%);
+ background: -o-linear-gradient(#ffffff, #eeeeee);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);
+ -webkit-border-top-right-radius: -1px;
+ -webkit-border-bottom-right-radius: 0;
+ -webkit-border-bottom-left-radius: 0;
+ -webkit-border-top-left-radius: -1px;
+ -moz-border-radius-topright: -1px;
+ -moz-border-radius-bottomright: 0;
+ -moz-border-radius-bottomleft: 0;
+ -moz-border-radius-topleft: -1px;
+ border-top-right-radius: -1px;
+ border-bottom-right-radius: 0;
+ border-bottom-left-radius: 0;
+ border-top-left-radius: -1px;
+ -moz-background-clip: padding-box;
+ -webkit-background-clip: padding-box;
+ background-clip: padding-box;
+}
+.ui-grid-header-viewport {
+ overflow: hidden;
+}
+.ui-grid-header-canvas:before,
+.ui-grid-header-canvas:after {
+ content: "";
+ display: table;
+ line-height: 0;
+}
+.ui-grid-header-canvas:after {
+ clear: both;
+}
+.ui-grid-header-cell-wrapper {
+ position: relative;
+ display: table;
+ box-sizing: border-box;
+ height: 100%;
+}
+.ui-grid-header-cell-row {
+ display: table-row;
+ position: relative;
+}
+.ui-grid-header-cell {
+ position: relative;
+ box-sizing: border-box;
+ background-color: #666;
+ color: #fff;
+ border-right: 1px solid;
+ border-color: #aaa;
+ display: table-cell;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ width: 0;
+}
+.ui-grid-header-cell:last-child {
+ border-right: 0;
+}
+.ui-grid-header-cell .sortable {
+ cursor: pointer;
+}
+.ui-grid-header-cell .ui-grid-sort-priority-number {
+ margin-left: -8px;
+}
+.ui-grid-header .ui-grid-vertical-bar {
+ top: 0;
+ bottom: 0;
+}
+.ui-grid-column-menu-button {
+ position: absolute;
+ right: 1px;
+ top: 0;
+}
+.ui-grid-column-menu-button .ui-grid-icon-angle-down {
+ vertical-align: sub;
+}
+.ui-grid-column-menu-button-last-col {
+ margin-right: 25px;
+}
+.ui-grid-column-menu {
+ position: absolute;
+}
+/* Slide up/down animations */
+.ui-grid-column-menu .ui-grid-menu .ui-grid-menu-mid.ng-hide-add,
+.ui-grid-column-menu .ui-grid-menu .ui-grid-menu-mid.ng-hide-remove {
+ -webkit-transition: all 0.05s linear;
+ -moz-transition: all 0.05s linear;
+ -o-transition: all 0.05s linear;
+ transition: all 0.05s linear;
+ display: block !important;
+}
+.ui-grid-column-menu .ui-grid-menu .ui-grid-menu-mid.ng-hide-add.ng-hide-add-active,
+.ui-grid-column-menu .ui-grid-menu .ui-grid-menu-mid.ng-hide-remove {
+ -webkit-transform: translateY(-100%);
+ -moz-transform: translateY(-100%);
+ -o-transform: translateY(-100%);
+ -ms-transform: translateY(-100%);
+ transform: translateY(-100%);
+}
+.ui-grid-column-menu .ui-grid-menu .ui-grid-menu-mid.ng-hide-add,
+.ui-grid-column-menu .ui-grid-menu .ui-grid-menu-mid.ng-hide-remove.ng-hide-remove-active {
+ -webkit-transform: translateY(0);
+ -moz-transform: translateY(0);
+ -o-transform: translateY(0);
+ -ms-transform: translateY(0);
+ transform: translateY(0);
+}
+/* Slide up/down animations */
+.ui-grid-menu-button .ui-grid-menu .ui-grid-menu-mid.ng-hide-add,
+.ui-grid-menu-button .ui-grid-menu .ui-grid-menu-mid.ng-hide-remove {
+ -webkit-transition: all 0.05s linear;
+ -moz-transition: all 0.05s linear;
+ -o-transition: all 0.05s linear;
+ transition: all 0.05s linear;
+ display: block !important;
+}
+.ui-grid-menu-button .ui-grid-menu .ui-grid-menu-mid.ng-hide-add.ng-hide-add-active,
+.ui-grid-menu-button .ui-grid-menu .ui-grid-menu-mid.ng-hide-remove {
+ -webkit-transform: translateY(-100%);
+ -moz-transform: translateY(-100%);
+ -o-transform: translateY(-100%);
+ -ms-transform: translateY(-100%);
+ transform: translateY(-100%);
+}
+.ui-grid-menu-button .ui-grid-menu .ui-grid-menu-mid.ng-hide-add,
+.ui-grid-menu-button .ui-grid-menu .ui-grid-menu-mid.ng-hide-remove.ng-hide-remove-active {
+ -webkit-transform: translateY(0);
+ -moz-transform: translateY(0);
+ -o-transform: translateY(0);
+ -ms-transform: translateY(0);
+ transform: translateY(0);
+}
+.ui-grid-filter-container {
+ padding: 4px 10px;
+ position: relative;
+}
+.ui-grid-filter-container .ui-grid-filter-button {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ right: 0;
+}
+.ui-grid-filter-container .ui-grid-filter-button [class^="ui-grid-icon"] {
+ position: absolute;
+ top: 50%;
+ line-height: 32px;
+ margin-top: -16px;
+ right: 10px;
+ opacity: 0.66;
+}
+.ui-grid-filter-container .ui-grid-filter-button [class^="ui-grid-icon"]:hover {
+ opacity: 1;
+}
+.ui-grid-filter-container .ui-grid-filter-button-select {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ right: 0;
+}
+.ui-grid-filter-container .ui-grid-filter-button-select [class^="ui-grid-icon"] {
+ position: absolute;
+ top: 50%;
+ line-height: 32px;
+ margin-top: -16px;
+ right: 0px;
+ opacity: 0.66;
+}
+.ui-grid-filter-container .ui-grid-filter-button-select [class^="ui-grid-icon"]:hover {
+ opacity: 1;
+}
+input[type="text"].ui-grid-filter-input {
+ padding: 0;
+ margin: 0;
+ border: 0;
+ width: 100%;
+ border: 1px solid #d4d4d4;
+ -webkit-border-top-right-radius: 0px;
+ -webkit-border-bottom-right-radius: 0;
+ -webkit-border-bottom-left-radius: 0;
+ -webkit-border-top-left-radius: 0;
+ -moz-border-radius-topright: 0px;
+ -moz-border-radius-bottomright: 0;
+ -moz-border-radius-bottomleft: 0;
+ -moz-border-radius-topleft: 0;
+ border-top-right-radius: 0px;
+ border-bottom-right-radius: 0;
+ border-bottom-left-radius: 0;
+ border-top-left-radius: 0;
+ -moz-background-clip: padding-box;
+ -webkit-background-clip: padding-box;
+ background-clip: padding-box;
+}
+input[type="text"].ui-grid-filter-input:hover {
+ border: 1px solid #d4d4d4;
+}
+select.ui-grid-filter-select {
+ padding: 0;
+ margin: 0;
+ border: 0;
+ width: 90%;
+ border: 1px solid #d4d4d4;
+ -webkit-border-top-right-radius: 0px;
+ -webkit-border-bottom-right-radius: 0;
+ -webkit-border-bottom-left-radius: 0;
+ -webkit-border-top-left-radius: 0;
+ -moz-border-radius-topright: 0px;
+ -moz-border-radius-bottomright: 0;
+ -moz-border-radius-bottomleft: 0;
+ -moz-border-radius-topleft: 0;
+ border-top-right-radius: 0px;
+ border-bottom-right-radius: 0;
+ border-bottom-left-radius: 0;
+ border-top-left-radius: 0;
+ -moz-background-clip: padding-box;
+ -webkit-background-clip: padding-box;
+ background-clip: padding-box;
+}
+select.ui-grid-filter-select:hover {
+ border: 1px solid #d4d4d4;
+}
+.ui-grid-filter-cancel-button-hidden select.ui-grid-filter-select {
+ width: 100%;
+}
+.ui-grid-render-container {
+ position: inherit;
+ -webkit-border-top-right-radius: 0;
+ -webkit-border-bottom-right-radius: 0px;
+ -webkit-border-bottom-left-radius: 0px;
+ -webkit-border-top-left-radius: 0;
+ -moz-border-radius-topright: 0;
+ -moz-border-radius-bottomright: 0px;
+ -moz-border-radius-bottomleft: 0px;
+ -moz-border-radius-topleft: 0;
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0px;
+ border-bottom-left-radius: 0px;
+ border-top-left-radius: 0;
+ -moz-background-clip: padding-box;
+ -webkit-background-clip: padding-box;
+ background-clip: padding-box;
+}
+.ui-grid-render-container:focus {
+ outline: none;
+}
+.ui-grid-viewport {
+ min-height: 20px;
+ position: relative;
+ overflow-y: scroll;
+ -webkit-overflow-scrolling: touch;
+}
+.ui-grid-viewport:focus {
+ outline: none !important;
+}
+.ui-grid-canvas {
+ position: relative;
+ padding-top: 0px;
+}
+.ui-grid-row:nth-child(odd) .ui-grid-cell {
+ background-color: #f2f2f2;
+}
+.ui-grid-row:nth-child(even) .ui-grid-cell {
+ background-color: #fff;
+}
+.ui-grid-row:last-child .ui-grid-cell {
+ border-bottom-color: #aaa;
+ border-bottom-style: solid;
+}
+.ui-grid-no-row-overlay {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ margin: 10%;
+ background: #f2f2f2;
+ background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(1, #ffffff));
+ background: -ms-linear-gradient(bottom, #eeeeee, #ffffff);
+ background: -moz-linear-gradient(center bottom, #eeeeee 0%, #ffffff 100%);
+ background: -o-linear-gradient(#ffffff, #eeeeee);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);
+ -webkit-border-top-right-radius: 0px;
+ -webkit-border-bottom-right-radius: 0;
+ -webkit-border-bottom-left-radius: 0;
+ -webkit-border-top-left-radius: 0;
+ -moz-border-radius-topright: 0px;
+ -moz-border-radius-bottomright: 0;
+ -moz-border-radius-bottomleft: 0;
+ -moz-border-radius-topleft: 0;
+ border-top-right-radius: 0px;
+ border-bottom-right-radius: 0;
+ border-bottom-left-radius: 0;
+ border-top-left-radius: 0;
+ -moz-background-clip: padding-box;
+ -webkit-background-clip: padding-box;
+ background-clip: padding-box;
+ border: 1px solid #d4d4d4;
+ font-size: 2em;
+ text-align: center;
+}
+.ui-grid-no-row-overlay > * {
+ position: absolute;
+ display: table;
+ margin: auto 0;
+ width: 100%;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ opacity: 0.66;
+}
+.ui-grid-cell {
+ overflow: hidden;
+ float: left;
+ background-color: inherit;
+ border-right: 1px solid;
+ border-bottom: 1px solid;
+ border-color: #aaa;
+ box-sizing: border-box;
+}
+.ui-grid-cell:last-child {
+ border-right: 0;
+}
+.ui-grid-cell-contents {
+ padding: 5px;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ white-space: nowrap;
+ -ms-text-overflow: ellipsis;
+ -o-text-overflow: ellipsis;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ height: 100%;
+}
+.ui-grid-cell-contents-hidden {
+ visibility: hidden;
+ width: 0;
+ height: 0;
+ display: none;
+}
+.ui-grid-row .ui-grid-cell.ui-grid-row-header-cell {
+ background-color: #f0f0ee;
+ border-bottom: solid 1px #aaa;
+}
+.ui-grid-footer-panel-background {
+ background: #f2f2f2;
+ background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(1, #ffffff));
+ background: -ms-linear-gradient(bottom, #eeeeee, #ffffff);
+ background: -moz-linear-gradient(center bottom, #eeeeee 0%, #ffffff 100%);
+ background: -o-linear-gradient(#ffffff, #eeeeee);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);
+}
+.ui-grid-footer-panel {
+ position: relative;
+ border-bottom: 1px solid #aaa;
+ border-top: 1px solid #aaa;
+ overflow: hidden;
+ font-weight: bold;
+ background: #f2f2f2;
+ background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(1, #ffffff));
+ background: -ms-linear-gradient(bottom, #eeeeee, #ffffff);
+ background: -moz-linear-gradient(center bottom, #eeeeee 0%, #ffffff 100%);
+ background: -o-linear-gradient(#ffffff, #eeeeee);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);
+ -webkit-border-top-right-radius: -1px;
+ -webkit-border-bottom-right-radius: 0;
+ -webkit-border-bottom-left-radius: 0;
+ -webkit-border-top-left-radius: -1px;
+ -moz-border-radius-topright: -1px;
+ -moz-border-radius-bottomright: 0;
+ -moz-border-radius-bottomleft: 0;
+ -moz-border-radius-topleft: -1px;
+ border-top-right-radius: -1px;
+ border-bottom-right-radius: 0;
+ border-bottom-left-radius: 0;
+ border-top-left-radius: -1px;
+ -moz-background-clip: padding-box;
+ -webkit-background-clip: padding-box;
+ background-clip: padding-box;
+}
+.ui-grid-grid-footer {
+ float: left;
+ width: 100%;
+}
+.ui-grid-footer-viewport {
+ overflow: hidden;
+}
+.ui-grid-footer-canvas {
+ position: relative;
+}
+.ui-grid-footer-canvas:before,
+.ui-grid-footer-canvas:after {
+ content: "";
+ display: table;
+ line-height: 0;
+}
+.ui-grid-footer-canvas:after {
+ clear: both;
+}
+.ui-grid-footer-cell-wrapper {
+ position: relative;
+ display: table;
+ box-sizing: border-box;
+ height: 100%;
+}
+.ui-grid-footer-cell-row {
+ display: table-row;
+}
+.ui-grid-footer-cell {
+ overflow: hidden;
+ background-color: inherit;
+ border-bottom: 1px solid;
+ border-right: 1px solid;
+ border-color: #aaa;
+ box-sizing: border-box;
+ display: table-cell;
+}
+.ui-grid-footer-cell:last-child {
+ border-right: 0;
+}
+input[type="text"].ui-grid-filter-input {
+ padding: 0;
+ margin: 0;
+ border: 0;
+ width: 100%;
+ border: 1px solid #d4d4d4;
+ -webkit-border-top-right-radius: 0px;
+ -webkit-border-bottom-right-radius: 0;
+ -webkit-border-bottom-left-radius: 0;
+ -webkit-border-top-left-radius: 0;
+ -moz-border-radius-topright: 0px;
+ -moz-border-radius-bottomright: 0;
+ -moz-border-radius-bottomleft: 0;
+ -moz-border-radius-topleft: 0;
+ border-top-right-radius: 0px;
+ border-bottom-right-radius: 0;
+ border-bottom-left-radius: 0;
+ border-top-left-radius: 0;
+ -moz-background-clip: padding-box;
+ -webkit-background-clip: padding-box;
+ background-clip: padding-box;
+}
+input[type="text"].ui-grid-filter-input:hover {
+ border: 1px solid #d4d4d4;
+}
+.ui-grid-menu-button {
+ z-index: 2;
+ position: absolute;
+ right: 0;
+ top: 0;
+ background: #666;
+ border-left: 1px solid #aaa;
+ cursor: pointer;
+ height: 30px;
+ font-weight: normal;
+}
+.ui-grid-menu-button .ui-grid-icon-container {
+ margin-top: 3px;
+}
+.ui-grid-menu-button .ui-grid-menu {
+ right: 0;
+}
+.ui-grid-menu-button .ui-grid-menu .ui-grid-menu-mid {
+ overflow: scroll;
+ max-height: 300px;
+ border: 1px solid #d4d4d4;
+}
+.ui-grid-menu {
+ z-index: 2;
+ position: absolute;
+ padding: 0 10px 20px 10px;
+ cursor: pointer;
+ box-sizing: border-box;
+}
+.ui-grid-menu .ui-grid-menu-inner {
+ background: #f2f2f2;
+ border: 1px solid #d4d4d4;
+ position: relative;
+ white-space: nowrap;
+ -webkit-border-radius: 0px;
+ -moz-border-radius: 0px;
+ border-radius: 0px;
+ -webkit-box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2), inset 0 12px 12px -14px rgba(0, 0, 0, 0.2);
+ -moz-box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2), inset 0 12px 12px -14px rgba(0, 0, 0, 0.2);
+ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2), inset 0 12px 12px -14px rgba(0, 0, 0, 0.2);
+}
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button {
+ position: absolute;
+ right: 0px;
+ top: 0px;
+ display: inline-block;
+ margin-bottom: 0;
+ font-weight: normal;
+ text-align: center;
+ vertical-align: middle;
+ touch-action: manipulation;
+ cursor: pointer;
+ background-image: none;
+ border: 1px solid transparent;
+ white-space: nowrap;
+ padding: 6px 12px;
+ font-size: 14px;
+ line-height: 1.42857143;
+ border-radius: 4px;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ padding: 1px 1px;
+ font-size: 10px;
+ line-height: 1;
+ border-radius: 2px;
+ color: transparent;
+ background-color: transparent;
+ border-color: transparent;
+}
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:active:focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.active:focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:active.focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.active.focus {
+ outline: thin dotted;
+ outline: 5px auto -webkit-focus-ring-color;
+ outline-offset: -2px;
+}
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:hover,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.focus {
+ color: #333333;
+ text-decoration: none;
+}
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:active,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.active {
+ outline: 0;
+ background-image: none;
+ -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
+ box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
+}
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.disabled,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button[disabled],
+fieldset[disabled] .ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button {
+ cursor: not-allowed;
+ opacity: 0.65;
+ filter: alpha(opacity=65);
+ -webkit-box-shadow: none;
+ box-shadow: none;
+}
+a.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.disabled,
+fieldset[disabled] a.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button {
+ pointer-events: none;
+}
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.focus {
+ color: transparent;
+ background-color: rgba(0, 0, 0, 0);
+ border-color: rgba(0, 0, 0, 0);
+}
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:hover {
+ color: transparent;
+ background-color: rgba(0, 0, 0, 0);
+ border-color: rgba(0, 0, 0, 0);
+}
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:active,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.active,
+.open > .dropdown-toggle.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button {
+ color: transparent;
+ background-color: rgba(0, 0, 0, 0);
+ border-color: rgba(0, 0, 0, 0);
+}
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:active:hover,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.active:hover,
+.open > .dropdown-toggle.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:hover,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:active:focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.active:focus,
+.open > .dropdown-toggle.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:active.focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.active.focus,
+.open > .dropdown-toggle.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.focus {
+ color: transparent;
+ background-color: rgba(0, 0, 0, 0);
+ border-color: rgba(0, 0, 0, 0);
+}
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:active,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.active,
+.open > .dropdown-toggle.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button {
+ background-image: none;
+}
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.disabled,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button[disabled],
+fieldset[disabled] .ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.disabled:hover,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button[disabled]:hover,
+fieldset[disabled] .ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:hover,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.disabled:focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button[disabled]:focus,
+fieldset[disabled] .ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.disabled.focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button[disabled].focus,
+fieldset[disabled] .ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.focus,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.disabled:active,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button[disabled]:active,
+fieldset[disabled] .ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button:active,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.disabled.active,
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button[disabled].active,
+fieldset[disabled] .ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.active {
+ background-color: transparent;
+ border-color: transparent;
+}
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button .badge {
+ color: transparent;
+ background-color: transparent;
+}
+.ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button > i {
+ opacity: 0.75;
+ color: black;
+}
+.ui-grid-menu .ui-grid-menu-inner ul {
+ margin: 0;
+ padding: 0;
+ list-style-type: none;
+}
+.ui-grid-menu .ui-grid-menu-inner ul li {
+ padding: 0px;
+}
+.ui-grid-menu .ui-grid-menu-inner ul li button {
+ min-width: 100%;
+ padding: 8px;
+ text-align: left;
+ background: transparent;
+ border: none;
+}
+.ui-grid-menu .ui-grid-menu-inner ul li button:hover,
+.ui-grid-menu .ui-grid-menu-inner ul li button:focus {
+ -webkit-box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.2);
+ -moz-box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.2);
+ box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.2);
+}
+.ui-grid-menu .ui-grid-menu-inner ul li button.ui-grid-menu-item-active {
+ -webkit-box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.2);
+ -moz-box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.2);
+ box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.2);
+ background-color: #cecece;
+}
+.ui-grid-menu .ui-grid-menu-inner ul li:not(:last-child) > button {
+ border-bottom: 1px solid #aaa;
+}
+.ui-grid-sortarrow {
+ right: 5px;
+ position: absolute;
+ width: 20px;
+ top: 0;
+ bottom: 0;
+ background-position: center;
+}
+.ui-grid-sortarrow.down {
+ -webkit-transform: rotate(180deg);
+ -moz-transform: rotate(180deg);
+ -o-transform: rotate(180deg);
+ -ms-transform: rotate(180deg);
+ transform: rotate(180deg);
+}
+@font-face {
+ font-family: 'ui-grid';
+ src: url('ui-grid.eot');
+ src: url('ui-grid.eot#iefix') format('embedded-opentype'), url('ui-grid.woff') format('woff'), url('ui-grid.ttf') format('truetype'), url('ui-grid.svg?#ui-grid') format('svg');
+ font-weight: normal;
+ font-style: normal;
+}
+/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
+/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
+/*
+@media screen and (-webkit-min-device-pixel-ratio:0) {
+ @font-face {
+ font-family: 'ui-grid';
+ src: url('../font/ui-grid.svg?12312827#ui-grid') format('svg');
+ }
+}
+*/
+[class^="ui-grid-icon"]:before,
+[class*=" ui-grid-icon"]:before {
+ font-family: "ui-grid";
+ font-style: normal;
+ font-weight: normal;
+ speak: none;
+ display: inline-block;
+ text-decoration: inherit;
+ width: 1em;
+ margin-right: .2em;
+ text-align: center;
+ /* opacity: .8; */
+ /* For safety - reset parent styles, that can break glyph codes*/
+ font-variant: normal;
+ text-transform: none;
+ /* fix buttons height, for twitter bootstrap */
+ line-height: 1em;
+ /* Animation center compensation - margins should be symmetric */
+ /* remove if not needed */
+ margin-left: .2em;
+ /* you can be more comfortable with increased icons size */
+ /* font-size: 120%; */
+ /* Uncomment for 3D effect */
+ /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
+}
+.ui-grid-icon-blank::before {
+ width: 1em;
+ content: ' ';
+}
+/*
+* RTL Styles
+*/
+.ui-grid[dir=rtl] .ui-grid-header-cell,
+.ui-grid[dir=rtl] .ui-grid-footer-cell,
+.ui-grid[dir=rtl] .ui-grid-cell {
+ float: right !important;
+}
+.ui-grid[dir=rtl] .ui-grid-column-menu-button {
+ position: absolute;
+ left: 1px;
+ top: 0;
+ right: inherit;
+}
+.ui-grid[dir=rtl] .ui-grid-cell:first-child,
+.ui-grid[dir=rtl] .ui-grid-header-cell:first-child,
+.ui-grid[dir=rtl] .ui-grid-footer-cell:first-child {
+ border-right: 0;
+}
+.ui-grid[dir=rtl] .ui-grid-cell:last-child,
+.ui-grid[dir=rtl] .ui-grid-header-cell:last-child {
+ border-bottom: 1px solid #aaa;
+ border-right: 1px solid #aaa;
+ border-left: 0;
+}
+.ui-grid[dir=rtl] .ui-grid-header-cell:first-child .ui-grid-vertical-bar,
+.ui-grid[dir=rtl] .ui-grid-footer-cell:first-child .ui-grid-vertical-bar,
+.ui-grid[dir=rtl] .ui-grid-cell:first-child .ui-grid-vertical-bar {
+ width: 0;
+}
+.ui-grid[dir=rtl] .ui-grid-menu-button {
+ z-index: 2;
+ position: absolute;
+ left: 0;
+ right: auto;
+ background: #f2f2f2;
+ border: 1px solid #d4d4d4;
+ cursor: pointer;
+ min-height: 27px;
+ font-weight: normal;
+}
+.ui-grid[dir=rtl] .ui-grid-menu-button .ui-grid-menu {
+ left: 0;
+ right: auto;
+}
+.ui-grid[dir=rtl] .ui-grid-filter-container .ui-grid-filter-button {
+ right: initial;
+ left: 0;
+}
+.ui-grid[dir=rtl] .ui-grid-filter-container .ui-grid-filter-button [class^="ui-grid-icon"] {
+ right: initial;
+ left: 10px;
+}
+/*
+ Animation example, for spinners
+*/
+.ui-grid-animate-spin {
+ -moz-animation: ui-grid-spin 2s infinite linear;
+ -o-animation: ui-grid-spin 2s infinite linear;
+ -webkit-animation: ui-grid-spin 2s infinite linear;
+ animation: ui-grid-spin 2s infinite linear;
+ display: inline-block;
+}
+@-moz-keyframes ui-grid-spin {
+ 0% {
+ -moz-transform: rotate(0deg);
+ -o-transform: rotate(0deg);
+ -webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
+ }
+ 100% {
+ -moz-transform: rotate(359deg);
+ -o-transform: rotate(359deg);
+ -webkit-transform: rotate(359deg);
+ transform: rotate(359deg);
+ }
+}
+@-webkit-keyframes ui-grid-spin {
+ 0% {
+ -moz-transform: rotate(0deg);
+ -o-transform: rotate(0deg);
+ -webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
+ }
+ 100% {
+ -moz-transform: rotate(359deg);
+ -o-transform: rotate(359deg);
+ -webkit-transform: rotate(359deg);
+ transform: rotate(359deg);
+ }
+}
+@-o-keyframes ui-grid-spin {
+ 0% {
+ -moz-transform: rotate(0deg);
+ -o-transform: rotate(0deg);
+ -webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
+ }
+ 100% {
+ -moz-transform: rotate(359deg);
+ -o-transform: rotate(359deg);
+ -webkit-transform: rotate(359deg);
+ transform: rotate(359deg);
+ }
+}
+@-ms-keyframes ui-grid-spin {
+ 0% {
+ -moz-transform: rotate(0deg);
+ -o-transform: rotate(0deg);
+ -webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
+ }
+ 100% {
+ -moz-transform: rotate(359deg);
+ -o-transform: rotate(359deg);
+ -webkit-transform: rotate(359deg);
+ transform: rotate(359deg);
+ }
+}
+@keyframes ui-grid-spin {
+ 0% {
+ -moz-transform: rotate(0deg);
+ -o-transform: rotate(0deg);
+ -webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
+ }
+ 100% {
+ -moz-transform: rotate(359deg);
+ -o-transform: rotate(359deg);
+ -webkit-transform: rotate(359deg);
+ transform: rotate(359deg);
+ }
+}
+/*---------------------------------------------------
+ LESS Elements 0.9
+ ---------------------------------------------------
+ A set of useful LESS mixins
+ More info at: http://lesselements.com
+ ---------------------------------------------------*/
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+#ui-grid-twbs #ui-grid-twbs .form-horizontal .form-group:before,
+#ui-grid-twbs #ui-grid-twbs .form-horizontal .form-group:after,
+#ui-grid-twbs #ui-grid-twbs .btn-toolbar:before,
+#ui-grid-twbs #ui-grid-twbs .btn-toolbar:after,
+#ui-grid-twbs #ui-grid-twbs .btn-group-vertical > .btn-group:before,
+#ui-grid-twbs #ui-grid-twbs .btn-group-vertical > .btn-group:after {
+ content: " ";
+ display: table;
+}
+#ui-grid-twbs #ui-grid-twbs .form-horizontal .form-group:after,
+#ui-grid-twbs #ui-grid-twbs .btn-toolbar:after,
+#ui-grid-twbs #ui-grid-twbs .btn-group-vertical > .btn-group:after {
+ clear: both;
+}
+.ui-grid-cell-focus {
+ outline: 0;
+ background-color: #b3c4c7;
+}
+.ui-grid-focuser {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ z-index: -1;
+ width: 100%;
+ height: 100%;
+}
+.ui-grid-focuser:focus {
+ border-color: #66afe9;
+ outline: 0;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
+ box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
+}
+.ui-grid-offscreen {
+ display: block;
+ position: absolute;
+ left: -10000px;
+ top: -10000px;
+ clip: rect(0px, 0px, 0px, 0px);
+}
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+div.ui-grid-cell input {
+ border-radius: inherit;
+ padding: 0;
+ width: 100%;
+ color: inherit;
+ height: auto;
+ font: inherit;
+ outline: none;
+}
+div.ui-grid-cell input:focus {
+ color: inherit;
+ outline: none;
+}
+div.ui-grid-cell input[type="checkbox"] {
+ margin: 9px 0 0 6px;
+ width: auto;
+}
+div.ui-grid-cell input.ng-invalid {
+ border: 1px solid #fc8f8f;
+}
+div.ui-grid-cell input.ng-valid {
+ border: 1px solid #d4d4d4;
+}
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+.expandableRow .ui-grid-row:nth-child(odd) .ui-grid-cell {
+ background-color: #f2f2f2;
+}
+.expandableRow .ui-grid-row:nth-child(even) .ui-grid-cell {
+ background-color: #fff;
+}
+.ui-grid-cell.ui-grid-disable-selection.ui-grid-row-header-cell {
+ pointer-events: none;
+}
+.ui-grid-expandable-buttons-cell i {
+ pointer-events: all;
+}
+.scrollFiller {
+ float: left;
+ border: 1px solid #d4d4d4;
+}
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+.ui-grid-tree-header-row {
+ font-weight: bold !important;
+}
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+.movingColumn {
+ position: absolute;
+ top: 0;
+ border: 1px solid #d4d4d4;
+ box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.2);
+}
+.movingColumn .ui-grid-icon-angle-down {
+ display: none;
+}
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/*---------------------------------------------------
+ LESS Elements 0.9
+ ---------------------------------------------------
+ A set of useful LESS mixins
+ More info at: http://lesselements.com
+ ---------------------------------------------------*/
+#ui-grid-twbs #ui-grid-twbs .form-horizontal .form-group:before,
+#ui-grid-twbs #ui-grid-twbs .form-horizontal .form-group:after,
+#ui-grid-twbs #ui-grid-twbs .btn-toolbar:before,
+#ui-grid-twbs #ui-grid-twbs .btn-toolbar:after,
+#ui-grid-twbs #ui-grid-twbs .btn-group-vertical > .btn-group:before,
+#ui-grid-twbs #ui-grid-twbs .btn-group-vertical > .btn-group:after {
+ content: " ";
+ display: table;
+}
+#ui-grid-twbs #ui-grid-twbs .form-horizontal .form-group:after,
+#ui-grid-twbs #ui-grid-twbs .btn-toolbar:after,
+#ui-grid-twbs #ui-grid-twbs .btn-group-vertical > .btn-group:after {
+ clear: both;
+}
+.ui-grid-pager-panel {
+ position: absolute;
+ left: 0;
+ bottom: 0;
+ width: 100%;
+ padding-top: 3px;
+ padding-bottom: 3px;
+}
+.ui-grid-pager-container {
+ float: left;
+}
+.ui-grid-pager-control {
+ margin-right: 10px;
+ margin-left: 10px;
+ min-width: 135px;
+ float: left;
+}
+.ui-grid-pager-control button {
+ height: 25px;
+ min-width: 26px;
+ display: inline-block;
+ margin-bottom: 0;
+ font-weight: normal;
+ text-align: center;
+ vertical-align: middle;
+ touch-action: manipulation;
+ cursor: pointer;
+ background-image: none;
+ border: 1px solid transparent;
+ white-space: nowrap;
+ padding: 6px 12px;
+ font-size: 14px;
+ line-height: 1.42857143;
+ border-radius: 4px;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ color: #eeeeee;
+ background-color: #f2f2f2;
+ border-color: #cccccc;
+}
+.ui-grid-pager-control button:focus,
+.ui-grid-pager-control button:active:focus,
+.ui-grid-pager-control button.active:focus,
+.ui-grid-pager-control button.focus,
+.ui-grid-pager-control button:active.focus,
+.ui-grid-pager-control button.active.focus {
+ outline: thin dotted;
+ outline: 5px auto -webkit-focus-ring-color;
+ outline-offset: -2px;
+}
+.ui-grid-pager-control button:hover,
+.ui-grid-pager-control button:focus,
+.ui-grid-pager-control button.focus {
+ color: #333333;
+ text-decoration: none;
+}
+.ui-grid-pager-control button:active,
+.ui-grid-pager-control button.active {
+ outline: 0;
+ background-image: none;
+ -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
+ box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
+}
+.ui-grid-pager-control button.disabled,
+.ui-grid-pager-control button[disabled],
+fieldset[disabled] .ui-grid-pager-control button {
+ cursor: not-allowed;
+ opacity: 0.65;
+ filter: alpha(opacity=65);
+ -webkit-box-shadow: none;
+ box-shadow: none;
+}
+a.ui-grid-pager-control button.disabled,
+fieldset[disabled] a.ui-grid-pager-control button {
+ pointer-events: none;
+}
+.ui-grid-pager-control button:focus,
+.ui-grid-pager-control button.focus {
+ color: #eeeeee;
+ background-color: #dadada;
+ border-color: #8c8c8c;
+}
+.ui-grid-pager-control button:hover {
+ color: #eeeeee;
+ background-color: #dadada;
+ border-color: #adadad;
+}
+.ui-grid-pager-control button:active,
+.ui-grid-pager-control button.active,
+.open > .dropdown-toggle.ui-grid-pager-control button {
+ color: #eeeeee;
+ background-color: #dadada;
+ border-color: #adadad;
+}
+.ui-grid-pager-control button:active:hover,
+.ui-grid-pager-control button.active:hover,
+.open > .dropdown-toggle.ui-grid-pager-control button:hover,
+.ui-grid-pager-control button:active:focus,
+.ui-grid-pager-control button.active:focus,
+.open > .dropdown-toggle.ui-grid-pager-control button:focus,
+.ui-grid-pager-control button:active.focus,
+.ui-grid-pager-control button.active.focus,
+.open > .dropdown-toggle.ui-grid-pager-control button.focus {
+ color: #eeeeee;
+ background-color: #c8c8c8;
+ border-color: #8c8c8c;
+}
+.ui-grid-pager-control button:active,
+.ui-grid-pager-control button.active,
+.open > .dropdown-toggle.ui-grid-pager-control button {
+ background-image: none;
+}
+.ui-grid-pager-control button.disabled,
+.ui-grid-pager-control button[disabled],
+fieldset[disabled] .ui-grid-pager-control button,
+.ui-grid-pager-control button.disabled:hover,
+.ui-grid-pager-control button[disabled]:hover,
+fieldset[disabled] .ui-grid-pager-control button:hover,
+.ui-grid-pager-control button.disabled:focus,
+.ui-grid-pager-control button[disabled]:focus,
+fieldset[disabled] .ui-grid-pager-control button:focus,
+.ui-grid-pager-control button.disabled.focus,
+.ui-grid-pager-control button[disabled].focus,
+fieldset[disabled] .ui-grid-pager-control button.focus,
+.ui-grid-pager-control button.disabled:active,
+.ui-grid-pager-control button[disabled]:active,
+fieldset[disabled] .ui-grid-pager-control button:active,
+.ui-grid-pager-control button.disabled.active,
+.ui-grid-pager-control button[disabled].active,
+fieldset[disabled] .ui-grid-pager-control button.active {
+ background-color: #f2f2f2;
+ border-color: #cccccc;
+}
+.ui-grid-pager-control button .badge {
+ color: #f2f2f2;
+ background-color: #eeeeee;
+}
+.ui-grid-pager-control input {
+ display: block;
+ width: 100%;
+ height: 34px;
+ padding: 6px 12px;
+ font-size: 14px;
+ line-height: 1.42857143;
+ color: #555555;
+ background-color: #ffffff;
+ background-image: none;
+ border: 1px solid #cccccc;
+ border-radius: 4px;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
+ -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
+ transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
+ height: 30px;
+ padding: 5px 10px;
+ font-size: 12px;
+ line-height: 1.5;
+ border-radius: 3px;
+ display: inline;
+ height: 26px;
+ width: 50px;
+ vertical-align: top;
+}
+.ui-grid-pager-control input:focus {
+ border-color: #66afe9;
+ outline: 0;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
+ box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
+}
+.ui-grid-pager-control input::-moz-placeholder {
+ color: #999999;
+ opacity: 1;
+}
+.ui-grid-pager-control input:-ms-input-placeholder {
+ color: #999999;
+}
+.ui-grid-pager-control input::-webkit-input-placeholder {
+ color: #999999;
+}
+.ui-grid-pager-control input[disabled],
+.ui-grid-pager-control input[readonly],
+fieldset[disabled] .ui-grid-pager-control input {
+ background-color: #eeeeee;
+ opacity: 1;
+}
+.ui-grid-pager-control input[disabled],
+fieldset[disabled] .ui-grid-pager-control input {
+ cursor: not-allowed;
+}
+textarea.ui-grid-pager-control input {
+ height: auto;
+}
+select.ui-grid-pager-control input {
+ height: 30px;
+ line-height: 30px;
+}
+textarea.ui-grid-pager-control input,
+select[multiple].ui-grid-pager-control input {
+ height: auto;
+}
+.ui-grid-pager-control .ui-grid-pager-max-pages-number {
+ vertical-align: bottom;
+}
+.ui-grid-pager-control .ui-grid-pager-max-pages-number > * {
+ vertical-align: middle;
+}
+.ui-grid-pager-control .first-bar {
+ width: 10px;
+ border-left: 2px solid #4d4d4d;
+ margin-top: -6px;
+ height: 12px;
+ margin-left: -3px;
+}
+.ui-grid-pager-control .first-triangle {
+ width: 0;
+ height: 0;
+ border-style: solid;
+ border-width: 5px 8.7px 5px 0;
+ border-color: transparent #4d4d4d transparent transparent;
+ margin-left: 2px;
+}
+.ui-grid-pager-control .next-triangle {
+ margin-left: 1px;
+}
+.ui-grid-pager-control .prev-triangle {
+ margin-left: 0;
+}
+.ui-grid-pager-control .last-triangle {
+ width: 0;
+ height: 0;
+ border-style: solid;
+ border-width: 5px 0 5px 8.7px;
+ border-color: transparent transparent transparent #4d4d4d;
+ margin-left: -1px;
+}
+.ui-grid-pager-control .last-bar {
+ width: 10px;
+ border-left: 2px solid #4d4d4d;
+ margin-top: -6px;
+ height: 12px;
+ margin-left: 1px;
+}
+.ui-grid-pager-row-count-picker {
+ float: left;
+}
+.ui-grid-pager-row-count-picker select {
+ display: block;
+ width: 100%;
+ height: 34px;
+ padding: 6px 12px;
+ font-size: 14px;
+ line-height: 1.42857143;
+ color: #555555;
+ background-color: #ffffff;
+ background-image: none;
+ border: 1px solid #cccccc;
+ border-radius: 4px;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
+ -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
+ transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
+ height: 30px;
+ padding: 5px 10px;
+ font-size: 12px;
+ line-height: 1.5;
+ border-radius: 3px;
+ height: 26px;
+ width: 67px;
+ display: inline;
+}
+.ui-grid-pager-row-count-picker select:focus {
+ border-color: #66afe9;
+ outline: 0;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
+ box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
+}
+.ui-grid-pager-row-count-picker select::-moz-placeholder {
+ color: #999999;
+ opacity: 1;
+}
+.ui-grid-pager-row-count-picker select:-ms-input-placeholder {
+ color: #999999;
+}
+.ui-grid-pager-row-count-picker select::-webkit-input-placeholder {
+ color: #999999;
+}
+.ui-grid-pager-row-count-picker select[disabled],
+.ui-grid-pager-row-count-picker select[readonly],
+fieldset[disabled] .ui-grid-pager-row-count-picker select {
+ background-color: #eeeeee;
+ opacity: 1;
+}
+.ui-grid-pager-row-count-picker select[disabled],
+fieldset[disabled] .ui-grid-pager-row-count-picker select {
+ cursor: not-allowed;
+}
+textarea.ui-grid-pager-row-count-picker select {
+ height: auto;
+}
+select.ui-grid-pager-row-count-picker select {
+ height: 30px;
+ line-height: 30px;
+}
+textarea.ui-grid-pager-row-count-picker select,
+select[multiple].ui-grid-pager-row-count-picker select {
+ height: auto;
+}
+.ui-grid-pager-row-count-picker .ui-grid-pager-row-count-label {
+ margin-top: 3px;
+}
+.ui-grid-pager-count-container {
+ float: right;
+ margin-top: 4px;
+ min-width: 50px;
+}
+.ui-grid-pager-count-container .ui-grid-pager-count {
+ margin-right: 10px;
+ margin-left: 10px;
+ float: right;
+}
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+.ui-grid-pinned-container {
+ position: absolute;
+ display: inline;
+ top: 0;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-left {
+ float: left;
+ left: 0;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-right {
+ float: right;
+ right: 0;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-left .ui-grid-header-cell:last-child {
+ box-sizing: border-box;
+ border-width: 1px;
+ border-bottom-color: #aaa;
+ border-right-color: #aaa;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-left .ui-grid-cell:last-child {
+ box-sizing: border-box;
+ border-bottom: 1px solid;
+ border-right: 1px solid;
+ border-width: 1px;
+ border-bottom-color: #aaa;
+ border-right-color: #aaa;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-left .ui-grid-header-cell:not(:last-child) .ui-grid-vertical-bar,
+.ui-grid-pinned-container .ui-grid-cell:not(:last-child) .ui-grid-vertical-bar {
+ width: 1px;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-left .ui-grid-header-cell:not(:last-child) .ui-grid-vertical-bar {
+ background-color: #d4d4d4;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-left .ui-grid-cell:not(:last-child) .ui-grid-vertical-bar {
+ background-color: #aeaeae;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-left .ui-grid-header-cell:last-child .ui-grid-vertical-bar {
+ right: -1px;
+ width: 1px;
+ background-color: #aeaeae;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-right .ui-grid-header-cell:first-child {
+ box-sizing: border-box;
+ border-left: 1px solid;
+ border-width: 1px;
+ border-left-color: #aeaeae;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-right .ui-grid-cell:first-child {
+ box-sizing: border-box;
+ border-left: 1px solid;
+ border-width: 1px;
+ border-left-color: #aeaeae;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-right .ui-grid-header-cell:not(:first-child) .ui-grid-vertical-bar,
+.ui-grid-pinned-container .ui-grid-cell:not(:first-child) .ui-grid-vertical-bar {
+ width: 1px;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-right .ui-grid-header-cell:not(:first-child) .ui-grid-vertical-bar {
+ background-color: #d4d4d4;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-right .ui-grid-cell:not(:last-child) .ui-grid-vertical-bar {
+ background-color: #aeaeae;
+}
+.ui-grid-pinned-container.ui-grid-pinned-container-first .ui-grid-header-cell:first-child .ui-grid-vertical-bar {
+ left: -1px;
+ width: 1px;
+ background-color: #aeaeae;
+}
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+.ui-grid-column-resizer {
+ top: 0;
+ bottom: 0;
+ width: 5px;
+ position: absolute;
+ cursor: col-resize;
+}
+.ui-grid-column-resizer.left {
+ left: 0;
+}
+.ui-grid-column-resizer.right {
+ right: 0;
+}
+.ui-grid-header-cell:last-child .ui-grid-column-resizer.right {
+ border-right: 1px solid #aaa;
+}
+.ui-grid[dir=rtl] .ui-grid-header-cell:last-child .ui-grid-column-resizer.right {
+ border-right: 0;
+}
+.ui-grid[dir=rtl] .ui-grid-header-cell:last-child .ui-grid-column-resizer.left {
+ border-left: 1px solid #d4d4d4;
+}
+.ui-grid.column-resizing {
+ cursor: col-resize;
+}
+.ui-grid.column-resizing .ui-grid-resize-overlay {
+ position: absolute;
+ top: 0;
+ height: 100%;
+ width: 1px;
+ background-color: #aeaeae;
+}
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+.ui-grid-row-saving .ui-grid-cell {
+ color: #848484 !important;
+}
+.ui-grid-row-dirty .ui-grid-cell {
+ color: #610b38;
+}
+.ui-grid-row-error .ui-grid-cell {
+ color: #ff0000 !important;
+}
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+.ui-grid-row.ui-grid-row-selected > [ui-grid-row] > .ui-grid-cell {
+ background-color: #c9dde1;
+}
+.ui-grid-disable-selection {
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ cursor: default;
+}
+.ui-grid-selection-row-header-buttons {
+ cursor: pointer;
+ opacity: 0.1;
+}
+.ui-grid-selection-row-header-buttons.ui-grid-row-selected {
+ opacity: 1;
+}
+.ui-grid-selection-row-header-buttons.ui-grid-all-selected {
+ opacity: 1;
+}
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+.ui-grid-tree-row-header-buttons.ui-grid-tree-header {
+ cursor: pointer;
+ opacity: 1;
+}
+
+/* This file contains variable declarations (do not remove this line) */
+/*-- VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+/**
+* @section Grid styles
+*/
+/**
+* @section Header styles
+*/
+/** @description Colors for header gradient */
+/**
+* @section Grid body styles
+*/
+/** @description Colors used for row alternation */
+/**
+* @section Sort arrow colors
+*/
+/**
+* @section Scrollbar styles
+*/
+/**
+* @section font library path
+*/
+/*-- END VARIABLES (DO NOT REMOVE THESE COMMENTS) --*/
+.ui-grid-tree-header-row {
+ font-weight: bold !important;
+}
+
+.ui-grid-icon-plus-squared:before {
+ content: '\c350';
+}
+/* 'ì' */
+.ui-grid-icon-minus-squared:before {
+ content: '\c351';
+}
+/* 'ì‘' */
+.ui-grid-icon-search:before {
+ content: '\c352';
+}
+/* 'ì’' */
+.ui-grid-icon-cancel:before {
+ content: '\c353';
+}
+/* 'ì“' */
+.ui-grid-icon-info-circled:before {
+ content: '\c354';
+}
+/* 'ì”' */
+.ui-grid-icon-lock:before {
+ content: '\c355';
+}
+/* 'ì•' */
+.ui-grid-icon-lock-open:before {
+ content: '\c356';
+}
+/* 'ì–' */
+.ui-grid-icon-pencil:before {
+ content: '\c357';
+}
+/* 'ì—' */
+.ui-grid-icon-down-dir:before {
+ content: '\c358';
+}
+/* 'ì˜' */
+.ui-grid-icon-up-dir:before {
+ content: '\c359';
+}
+/* 'ì™' */
+.ui-grid-icon-left-dir:before {
+ content: '\c35a';
+}
+/* 'ìš' */
+.ui-grid-icon-right-dir:before {
+ content: '\c35b';
+}
+/* 'ì›' */
+.ui-grid-icon-left-open:before {
+ content: '\c35c';
+}
+/* 'ìœ' */
+.ui-grid-icon-right-open:before {
+ content: '\c35d';
+}
+/* 'ì' */
+.ui-grid-icon-angle-down:before {
+ content: '\c35e';
+}
+/* 'ìž' */
+.ui-grid-icon-filter:before {
+ content: '\c35f';
+}
+/* 'ìŸ' */
+.ui-grid-icon-sort-alt-up:before {
+ content: '\c360';
+}
+/* 'ì ' */
+.ui-grid-icon-sort-alt-down:before {
+ content: '\c361';
+}
+/* 'ì¡' */
+.ui-grid-icon-ok:before {
+ content: '\c362';
+}
+/* 'ì¢' */
+.ui-grid-icon-menu:before {
+ content: '\c363';
+ color: #fff;
+}
+/* 'ì£' */
+.ui-grid-icon-indent-left:before {
+ content: '\e800';
+}
+/* 'î €' */
+.ui-grid-icon-indent-right:before {
+ content: '\e801';
+}
+/* 'î ' */
+.ui-grid-icon-spin5:before {
+ content: '\ea61';
+}
+/* 'î©¡' */
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.eot b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.eot
new file mode 100644
index 00000000..15e42a56
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.eot
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.js
new file mode 100644
index 00000000..531485ce
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.js
@@ -0,0 +1,26735 @@
+/*!
+ * ui-grid - v3.0.7 - 2015-10-06
+ * Copyright (c) 2015 ; License: MIT
+ */
+
+(function () {
+ 'use strict';
+ angular.module('ui.grid.i18n', []);
+ angular.module('ui.grid', ['ui.grid.i18n']);
+})();
+(function () {
+ 'use strict';
+ angular.module('ui.grid').constant('uiGridConstants', {
+ LOG_DEBUG_MESSAGES: true,
+ LOG_WARN_MESSAGES: true,
+ LOG_ERROR_MESSAGES: true,
+ CUSTOM_FILTERS: /CUSTOM_FILTERS/g,
+ COL_FIELD: /COL_FIELD/g,
+ MODEL_COL_FIELD: /MODEL_COL_FIELD/g,
+ TOOLTIP: /title=\"TOOLTIP\"/g,
+ DISPLAY_CELL_TEMPLATE: /DISPLAY_CELL_TEMPLATE/g,
+ TEMPLATE_REGEXP: /<.+>/,
+ FUNC_REGEXP: /(\([^)]*\))?$/,
+ DOT_REGEXP: /\./g,
+ APOS_REGEXP: /'/g,
+ BRACKET_REGEXP: /^(.*)((?:\s*\[\s*\d+\s*\]\s*)|(?:\s*\[\s*"(?:[^"\\]|\\.)*"\s*\]\s*)|(?:\s*\[\s*'(?:[^'\\]|\\.)*'\s*\]\s*))(.*)$/,
+ COL_CLASS_PREFIX: 'ui-grid-col',
+ events: {
+ GRID_SCROLL: 'uiGridScroll',
+ COLUMN_MENU_SHOWN: 'uiGridColMenuShown',
+ ITEM_DRAGGING: 'uiGridItemDragStart', // For any item being dragged
+ COLUMN_HEADER_CLICK: 'uiGridColumnHeaderClick'
+ },
+ // copied from http://www.lsauer.com/2011/08/javascript-keymap-keycodes-in-json.html
+ keymap: {
+ TAB: 9,
+ STRG: 17,
+ CAPSLOCK: 20,
+ CTRL: 17,
+ CTRLRIGHT: 18,
+ CTRLR: 18,
+ SHIFT: 16,
+ RETURN: 13,
+ ENTER: 13,
+ BACKSPACE: 8,
+ BCKSP: 8,
+ ALT: 18,
+ ALTR: 17,
+ ALTRIGHT: 17,
+ SPACE: 32,
+ WIN: 91,
+ MAC: 91,
+ FN: null,
+ PG_UP: 33,
+ PG_DOWN: 34,
+ UP: 38,
+ DOWN: 40,
+ LEFT: 37,
+ RIGHT: 39,
+ ESC: 27,
+ DEL: 46,
+ F1: 112,
+ F2: 113,
+ F3: 114,
+ F4: 115,
+ F5: 116,
+ F6: 117,
+ F7: 118,
+ F8: 119,
+ F9: 120,
+ F10: 121,
+ F11: 122,
+ F12: 123
+ },
+ ASC: 'asc',
+ DESC: 'desc',
+ filter: {
+ STARTS_WITH: 2,
+ ENDS_WITH: 4,
+ EXACT: 8,
+ CONTAINS: 16,
+ GREATER_THAN: 32,
+ GREATER_THAN_OR_EQUAL: 64,
+ LESS_THAN: 128,
+ LESS_THAN_OR_EQUAL: 256,
+ NOT_EQUAL: 512,
+ SELECT: 'select',
+ INPUT: 'input'
+ },
+
+ aggregationTypes: {
+ sum: 2,
+ count: 4,
+ avg: 8,
+ min: 16,
+ max: 32
+ },
+
+ // TODO(c0bra): Create full list of these somehow. NOTE: do any allow a space before or after them?
+ CURRENCY_SYMBOLS: ['ƒ', '$', '£', '$', '¤', '¥', '៛', '₩', '₱', '฿', '₫'],
+
+ scrollDirection: {
+ UP: 'up',
+ DOWN: 'down',
+ LEFT: 'left',
+ RIGHT: 'right',
+ NONE: 'none'
+
+ },
+
+ dataChange: {
+ ALL: 'all',
+ EDIT: 'edit',
+ ROW: 'row',
+ COLUMN: 'column',
+ OPTIONS: 'options'
+ },
+ scrollbars: {
+ NEVER: 0,
+ ALWAYS: 1
+ //WHEN_NEEDED: 2
+ }
+ });
+
+})();
+angular.module('ui.grid').directive('uiGridCell', ['$compile', '$parse', 'gridUtil', 'uiGridConstants', function ($compile, $parse, gridUtil, uiGridConstants) {
+ var uiGridCell = {
+ priority: 0,
+ scope: false,
+ require: '?^uiGrid',
+ compile: function() {
+ return {
+ pre: function($scope, $elm, $attrs, uiGridCtrl) {
+ function compileTemplate() {
+ var compiledElementFn = $scope.col.compiledElementFn;
+
+ compiledElementFn($scope, function(clonedElement, scope) {
+ $elm.append(clonedElement);
+ });
+ }
+
+ // If the grid controller is present, use it to get the compiled cell template function
+ if (uiGridCtrl && $scope.col.compiledElementFn) {
+ compileTemplate();
+ }
+ // No controller, compile the element manually (for unit tests)
+ else {
+ if ( uiGridCtrl && !$scope.col.compiledElementFn ){
+ // gridUtil.logError('Render has been called before precompile. Please log a ui-grid issue');
+
+ $scope.col.getCompiledElementFn()
+ .then(function (compiledElementFn) {
+ compiledElementFn($scope, function(clonedElement, scope) {
+ $elm.append(clonedElement);
+ });
+ });
+ }
+ else {
+ var html = $scope.col.cellTemplate
+ .replace(uiGridConstants.MODEL_COL_FIELD, 'row.entity.' + gridUtil.preEval($scope.col.field))
+ .replace(uiGridConstants.COL_FIELD, 'grid.getCellValue(row, col)');
+
+ var cellElement = $compile(html)($scope);
+ $elm.append(cellElement);
+ }
+ }
+ },
+ post: function($scope, $elm, $attrs, uiGridCtrl) {
+ var initColClass = $scope.col.getColClass(false);
+ $elm.addClass(initColClass);
+
+ var classAdded;
+ var updateClass = function( grid ){
+ var contents = $elm;
+ if ( classAdded ){
+ contents.removeClass( classAdded );
+ classAdded = null;
+ }
+
+ if (angular.isFunction($scope.col.cellClass)) {
+ classAdded = $scope.col.cellClass($scope.grid, $scope.row, $scope.col, $scope.rowRenderIndex, $scope.colRenderIndex);
+ }
+ else {
+ classAdded = $scope.col.cellClass;
+ }
+ contents.addClass(classAdded);
+ };
+
+ if ($scope.col.cellClass) {
+ updateClass();
+ }
+
+ // Register a data change watch that would get triggered whenever someone edits a cell or modifies column defs
+ var dataChangeDereg = $scope.grid.registerDataChangeCallback( updateClass, [uiGridConstants.dataChange.COLUMN, uiGridConstants.dataChange.EDIT]);
+
+ // watch the col and row to see if they change - which would indicate that we've scrolled or sorted or otherwise
+ // changed the row/col that this cell relates to, and we need to re-evaluate cell classes and maybe other things
+ var cellChangeFunction = function( n, o ){
+ if ( n !== o ) {
+ if ( classAdded || $scope.col.cellClass ){
+ updateClass();
+ }
+
+ // See if the column's internal class has changed
+ var newColClass = $scope.col.getColClass(false);
+ if (newColClass !== initColClass) {
+ $elm.removeClass(initColClass);
+ $elm.addClass(newColClass);
+ initColClass = newColClass;
+ }
+ }
+ };
+
+ // TODO(c0bra): Turn this into a deep array watch
+/* shouldn't be needed any more given track by col.name
+ var colWatchDereg = $scope.$watch( 'col', cellChangeFunction );
+*/
+ var rowWatchDereg = $scope.$watch( 'row', cellChangeFunction );
+
+
+ var deregisterFunction = function() {
+ dataChangeDereg();
+// colWatchDereg();
+ rowWatchDereg();
+ };
+
+ $scope.$on( '$destroy', deregisterFunction );
+ $elm.on( '$destroy', deregisterFunction );
+ }
+ };
+ }
+ };
+
+ return uiGridCell;
+}]);
+
+
+(function(){
+
+angular.module('ui.grid')
+.service('uiGridColumnMenuService', [ 'i18nService', 'uiGridConstants', 'gridUtil',
+function ( i18nService, uiGridConstants, gridUtil ) {
+/**
+ * @ngdoc service
+ * @name ui.grid.service:uiGridColumnMenuService
+ *
+ * @description Services for working with column menus, factored out
+ * to make the code easier to understand
+ */
+
+ var service = {
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:uiGridColumnMenuService
+ * @name initialize
+ * @description Sets defaults, puts a reference to the $scope on
+ * the uiGridController
+ * @param {$scope} $scope the $scope from the uiGridColumnMenu
+ * @param {controller} uiGridCtrl the uiGridController for the grid
+ * we're on
+ *
+ */
+ initialize: function( $scope, uiGridCtrl ){
+ $scope.grid = uiGridCtrl.grid;
+
+ // Store a reference to this link/controller in the main uiGrid controller
+ // to allow showMenu later
+ uiGridCtrl.columnMenuScope = $scope;
+
+ // Save whether we're shown or not so the columns can check
+ $scope.menuShown = false;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:uiGridColumnMenuService
+ * @name setColMenuItemWatch
+ * @description Setup a watch on $scope.col.menuItems, and update
+ * menuItems based on this. $scope.col needs to be set by the column
+ * before calling the menu.
+ * @param {$scope} $scope the $scope from the uiGridColumnMenu
+ * @param {controller} uiGridCtrl the uiGridController for the grid
+ * we're on
+ *
+ */
+ setColMenuItemWatch: function ( $scope ){
+ var deregFunction = $scope.$watch('col.menuItems', function (n, o) {
+ if (typeof(n) !== 'undefined' && n && angular.isArray(n)) {
+ n.forEach(function (item) {
+ if (typeof(item.context) === 'undefined' || !item.context) {
+ item.context = {};
+ }
+ item.context.col = $scope.col;
+ });
+
+ $scope.menuItems = $scope.defaultMenuItems.concat(n);
+ }
+ else {
+ $scope.menuItems = $scope.defaultMenuItems;
+ }
+ });
+
+ $scope.$on( '$destroy', deregFunction );
+ },
+
+
+ /**
+ * @ngdoc boolean
+ * @name enableSorting
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description (optional) True by default. When enabled, this setting adds sort
+ * widgets to the column header, allowing sorting of the data in the individual column.
+ */
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:uiGridColumnMenuService
+ * @name sortable
+ * @description determines whether this column is sortable
+ * @param {$scope} $scope the $scope from the uiGridColumnMenu
+ *
+ */
+ sortable: function( $scope ) {
+ if ( $scope.grid.options.enableSorting && typeof($scope.col) !== 'undefined' && $scope.col && $scope.col.enableSorting) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:uiGridColumnMenuService
+ * @name isActiveSort
+ * @description determines whether the requested sort direction is current active, to
+ * allow highlighting in the menu
+ * @param {$scope} $scope the $scope from the uiGridColumnMenu
+ * @param {string} direction the direction that we'd have selected for us to be active
+ *
+ */
+ isActiveSort: function( $scope, direction ){
+ return (typeof($scope.col) !== 'undefined' && typeof($scope.col.sort) !== 'undefined' &&
+ typeof($scope.col.sort.direction) !== 'undefined' && $scope.col.sort.direction === direction);
+
+ },
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:uiGridColumnMenuService
+ * @name suppressRemoveSort
+ * @description determines whether we should suppress the removeSort option
+ * @param {$scope} $scope the $scope from the uiGridColumnMenu
+ *
+ */
+ suppressRemoveSort: function( $scope ) {
+ if ($scope.col && $scope.col.suppressRemoveSort) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ },
+
+
+ /**
+ * @ngdoc boolean
+ * @name enableHiding
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description (optional) True by default. When set to false, this setting prevents a user from hiding the column
+ * using the column menu or the grid menu.
+ */
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:uiGridColumnMenuService
+ * @name hideable
+ * @description determines whether a column can be hidden, by checking the enableHiding columnDef option
+ * @param {$scope} $scope the $scope from the uiGridColumnMenu
+ *
+ */
+ hideable: function( $scope ) {
+ if (typeof($scope.col) !== 'undefined' && $scope.col && $scope.col.colDef && $scope.col.colDef.enableHiding === false ) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:uiGridColumnMenuService
+ * @name getDefaultMenuItems
+ * @description returns the default menu items for a column menu
+ * @param {$scope} $scope the $scope from the uiGridColumnMenu
+ *
+ */
+ getDefaultMenuItems: function( $scope ){
+ return [
+ {
+ title: i18nService.getSafeText('sort.ascending'),
+ icon: 'ui-grid-icon-sort-alt-up',
+ action: function($event) {
+ $event.stopPropagation();
+ $scope.sortColumn($event, uiGridConstants.ASC);
+ },
+ shown: function () {
+ return service.sortable( $scope );
+ },
+ active: function() {
+ return service.isActiveSort( $scope, uiGridConstants.ASC);
+ }
+ },
+ {
+ title: i18nService.getSafeText('sort.descending'),
+ icon: 'ui-grid-icon-sort-alt-down',
+ action: function($event) {
+ $event.stopPropagation();
+ $scope.sortColumn($event, uiGridConstants.DESC);
+ },
+ shown: function() {
+ return service.sortable( $scope );
+ },
+ active: function() {
+ return service.isActiveSort( $scope, uiGridConstants.DESC);
+ }
+ },
+ {
+ title: i18nService.getSafeText('sort.remove'),
+ icon: 'ui-grid-icon-cancel',
+ action: function ($event) {
+ $event.stopPropagation();
+ $scope.unsortColumn();
+ },
+ shown: function() {
+ return service.sortable( $scope ) &&
+ typeof($scope.col) !== 'undefined' && (typeof($scope.col.sort) !== 'undefined' &&
+ typeof($scope.col.sort.direction) !== 'undefined') && $scope.col.sort.direction !== null &&
+ !service.suppressRemoveSort( $scope );
+ }
+ },
+ {
+ title: i18nService.getSafeText('column.hide'),
+ icon: 'ui-grid-icon-cancel',
+ shown: function() {
+ return service.hideable( $scope );
+ },
+ action: function ($event) {
+ $event.stopPropagation();
+ $scope.hideColumn();
+ }
+ },
+ {
+ title: i18nService.getSafeText('columnMenu.close'),
+ screenReaderOnly: true,
+ shown: function(){
+ return true;
+ },
+ action: function($event){
+ $event.stopPropagation();
+ }
+ }
+ ];
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:uiGridColumnMenuService
+ * @name getColumnElementPosition
+ * @description gets the position information needed to place the column
+ * menu below the column header
+ * @param {$scope} $scope the $scope from the uiGridColumnMenu
+ * @param {GridCol} column the column we want to position below
+ * @param {element} $columnElement the column element we want to position below
+ * @returns {hash} containing left, top, offset, height, width
+ *
+ */
+ getColumnElementPosition: function( $scope, column, $columnElement ){
+ var positionData = {};
+ positionData.left = $columnElement[0].offsetLeft;
+ positionData.top = $columnElement[0].offsetTop;
+ positionData.parentLeft = $columnElement[0].offsetParent.offsetLeft;
+
+ // Get the grid scrollLeft
+ positionData.offset = 0;
+ if (column.grid.options.offsetLeft) {
+ positionData.offset = column.grid.options.offsetLeft;
+ }
+
+ positionData.height = gridUtil.elementHeight($columnElement, true);
+ positionData.width = gridUtil.elementWidth($columnElement, true);
+
+ return positionData;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:uiGridColumnMenuService
+ * @name repositionMenu
+ * @description Reposition the menu below the new column. If the menu has no child nodes
+ * (i.e. it's not currently visible) then we guess it's width at 100, we'll be called again
+ * later to fix it
+ * @param {$scope} $scope the $scope from the uiGridColumnMenu
+ * @param {GridCol} column the column we want to position below
+ * @param {hash} positionData a hash containing left, top, offset, height, width
+ * @param {element} $elm the column menu element that we want to reposition
+ * @param {element} $columnElement the column element that we want to reposition underneath
+ *
+ */
+ repositionMenu: function( $scope, column, positionData, $elm, $columnElement ) {
+ var menu = $elm[0].querySelectorAll('.ui-grid-menu');
+ var containerId = column.renderContainer ? column.renderContainer : 'body';
+ var renderContainer = column.grid.renderContainers[containerId];
+
+ // It's possible that the render container of the column we're attaching to is
+ // offset from the grid (i.e. pinned containers), we need to get the difference in the offsetLeft
+ // between the render container and the grid
+ var renderContainerElm = gridUtil.closestElm($columnElement, '.ui-grid-render-container');
+ var renderContainerOffset = renderContainerElm.getBoundingClientRect().left - $scope.grid.element[0].getBoundingClientRect().left;
+
+ var containerScrollLeft = renderContainerElm.querySelectorAll('.ui-grid-viewport')[0].scrollLeft;
+
+ // default value the last width for _this_ column, otherwise last width for _any_ column, otherwise default to 170
+ var myWidth = column.lastMenuWidth ? column.lastMenuWidth : ( $scope.lastMenuWidth ? $scope.lastMenuWidth : 170);
+ var paddingRight = column.lastMenuPaddingRight ? column.lastMenuPaddingRight : ( $scope.lastMenuPaddingRight ? $scope.lastMenuPaddingRight : 10);
+
+ if ( menu.length !== 0 ){
+ var mid = menu[0].querySelectorAll('.ui-grid-menu-mid');
+ if ( mid.length !== 0 && !angular.element(mid).hasClass('ng-hide') ) {
+ myWidth = gridUtil.elementWidth(menu, true);
+ $scope.lastMenuWidth = myWidth;
+ column.lastMenuWidth = myWidth;
+
+ // TODO(c0bra): use padding-left/padding-right based on document direction (ltr/rtl), place menu on proper side
+ // Get the column menu right padding
+ paddingRight = parseInt(gridUtil.getStyles(angular.element(menu)[0])['paddingRight'], 10);
+ $scope.lastMenuPaddingRight = paddingRight;
+ column.lastMenuPaddingRight = paddingRight;
+ }
+ }
+
+ var left = positionData.left + renderContainerOffset - containerScrollLeft + positionData.parentLeft + positionData.width - myWidth + paddingRight;
+ if (left < positionData.offset){
+ left = positionData.offset;
+ }
+
+ $elm.css('left', left + 'px');
+ $elm.css('top', (positionData.top + positionData.height) + 'px');
+ }
+
+ };
+
+ return service;
+}])
+
+
+.directive('uiGridColumnMenu', ['$timeout', 'gridUtil', 'uiGridConstants', 'uiGridColumnMenuService', '$document',
+function ($timeout, gridUtil, uiGridConstants, uiGridColumnMenuService, $document) {
+/**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridColumnMenu
+ * @description Provides the column menu framework, leverages uiGridMenu underneath
+ *
+ */
+
+ var uiGridColumnMenu = {
+ priority: 0,
+ scope: true,
+ require: '^uiGrid',
+ templateUrl: 'ui-grid/uiGridColumnMenu',
+ replace: true,
+ link: function ($scope, $elm, $attrs, uiGridCtrl) {
+ var self = this;
+
+ uiGridColumnMenuService.initialize( $scope, uiGridCtrl );
+
+ $scope.defaultMenuItems = uiGridColumnMenuService.getDefaultMenuItems( $scope );
+
+ // Set the menu items for use with the column menu. The user can later add additional items via the watch
+ $scope.menuItems = $scope.defaultMenuItems;
+ uiGridColumnMenuService.setColMenuItemWatch( $scope );
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.directive:uiGridColumnMenu
+ * @name showMenu
+ * @description Shows the column menu. If the menu is already displayed it
+ * calls the menu to ask it to hide (it will animate), then it repositions the menu
+ * to the right place whilst hidden (it will make an assumption on menu width),
+ * then it asks the menu to show (it will animate), then it repositions the menu again
+ * once we can calculate it's size.
+ * @param {GridCol} column the column we want to position below
+ * @param {element} $columnElement the column element we want to position below
+ */
+ $scope.showMenu = function(column, $columnElement, event) {
+ // Swap to this column
+ $scope.col = column;
+
+ // Get the position information for the column element
+ var colElementPosition = uiGridColumnMenuService.getColumnElementPosition( $scope, column, $columnElement );
+
+ if ($scope.menuShown) {
+ // we want to hide, then reposition, then show, but we want to wait for animations
+ // we set a variable, and then rely on the menu-hidden event to call the reposition and show
+ $scope.colElement = $columnElement;
+ $scope.colElementPosition = colElementPosition;
+ $scope.hideThenShow = true;
+
+ $scope.$broadcast('hide-menu', { originalEvent: event });
+ } else {
+ self.shown = $scope.menuShown = true;
+ uiGridColumnMenuService.repositionMenu( $scope, column, colElementPosition, $elm, $columnElement );
+
+ $scope.colElement = $columnElement;
+ $scope.colElementPosition = colElementPosition;
+ $scope.$broadcast('show-menu', { originalEvent: event });
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.directive:uiGridColumnMenu
+ * @name hideMenu
+ * @description Hides the column menu.
+ * @param {boolean} broadcastTrigger true if we were triggered by a broadcast
+ * from the menu itself - in which case don't broadcast again as we'll get
+ * an infinite loop
+ */
+ $scope.hideMenu = function( broadcastTrigger ) {
+ $scope.menuShown = false;
+ if ( !broadcastTrigger ){
+ $scope.$broadcast('hide-menu');
+ }
+ };
+
+
+ $scope.$on('menu-hidden', function() {
+ if ( $scope.hideThenShow ){
+ delete $scope.hideThenShow;
+
+ uiGridColumnMenuService.repositionMenu( $scope, $scope.col, $scope.colElementPosition, $elm, $scope.colElement );
+ $scope.$broadcast('show-menu');
+
+ $scope.menuShown = true;
+ } else {
+ $scope.hideMenu( true );
+
+ if ($scope.col) {
+ //Focus on the menu button
+ gridUtil.focus.bySelector($document, '.ui-grid-header-cell.' + $scope.col.getColClass()+ ' .ui-grid-column-menu-button', $scope.col.grid, false);
+ }
+ }
+ });
+
+ $scope.$on('menu-shown', function() {
+ $timeout( function() {
+ uiGridColumnMenuService.repositionMenu( $scope, $scope.col, $scope.colElementPosition, $elm, $scope.colElement );
+ delete $scope.colElementPosition;
+ delete $scope.columnElement;
+ }, 200);
+ });
+
+
+ /* Column methods */
+ $scope.sortColumn = function (event, dir) {
+ event.stopPropagation();
+
+ $scope.grid.sortColumn($scope.col, dir, true)
+ .then(function () {
+ $scope.grid.refresh();
+ $scope.hideMenu();
+ });
+ };
+
+ $scope.unsortColumn = function () {
+ $scope.col.unsort();
+
+ $scope.grid.refresh();
+ $scope.hideMenu();
+ };
+
+ //Since we are hiding this column the default hide action will fail so we need to focus somewhere else.
+ var setFocusOnHideColumn = function(){
+ $timeout(function(){
+ // Get the UID of the first
+ var focusToGridMenu = function(){
+ return gridUtil.focus.byId('grid-menu', $scope.grid);
+ };
+
+ var thisIndex;
+ $scope.grid.columns.some(function(element, index){
+ if (angular.equals(element, $scope.col)) {
+ thisIndex = index;
+ return true;
+ }
+ });
+
+ var previousVisibleCol;
+ // Try and find the next lower or nearest column to focus on
+ $scope.grid.columns.some(function(element, index){
+ if (!element.visible){
+ return false;
+ } // This columns index is below the current column index
+ else if ( index < thisIndex){
+ previousVisibleCol = element;
+ } // This elements index is above this column index and we haven't found one that is lower
+ else if ( index > thisIndex && !previousVisibleCol) {
+ // This is the next best thing
+ previousVisibleCol = element;
+ // We've found one so use it.
+ return true;
+ } // We've reached an element with an index above this column and the previousVisibleCol variable has been set
+ else if (index > thisIndex && previousVisibleCol) {
+ // We are done.
+ return true;
+ }
+ });
+ // If found then focus on it
+ if (previousVisibleCol){
+ var colClass = previousVisibleCol.getColClass();
+ gridUtil.focus.bySelector($document, '.ui-grid-header-cell.' + colClass+ ' .ui-grid-header-cell-primary-focus', true).then(angular.noop, function(reason){
+ if (reason !== 'canceled'){ // If this is canceled then don't perform the action
+ //The fallback action is to focus on the grid menu
+ return focusToGridMenu();
+ }
+ });
+ } else {
+ // Fallback action to focus on the grid menu
+ focusToGridMenu();
+ }
+ });
+ };
+
+ $scope.hideColumn = function () {
+ $scope.col.colDef.visible = false;
+ $scope.col.visible = false;
+
+ $scope.grid.queueGridRefresh();
+ $scope.hideMenu();
+ $scope.grid.api.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
+ $scope.grid.api.core.raise.columnVisibilityChanged( $scope.col );
+
+ // We are hiding so the default action of focusing on the button that opened this menu will fail.
+ setFocusOnHideColumn();
+ };
+ },
+
+
+
+ controller: ['$scope', function ($scope) {
+ var self = this;
+
+ $scope.$watch('menuItems', function (n, o) {
+ self.menuItems = n;
+ });
+ }]
+ };
+
+ return uiGridColumnMenu;
+
+}]);
+
+})();
+
+(function(){
+ 'use strict';
+
+ angular.module('ui.grid').directive('uiGridFilter', ['$compile', '$templateCache', 'i18nService', 'gridUtil', function ($compile, $templateCache, i18nService, gridUtil) {
+
+ return {
+ compile: function() {
+ return {
+ pre: function ($scope, $elm, $attrs, controllers) {
+ $scope.col.updateFilters = function( filterable ){
+ $elm.children().remove();
+ if ( filterable ){
+ var template = $scope.col.filterHeaderTemplate;
+
+ $elm.append($compile(template)($scope));
+ }
+ };
+
+ $scope.$on( '$destroy', function() {
+ delete $scope.col.updateFilters;
+ });
+ },
+ post: function ($scope, $elm, $attrs, controllers){
+ $scope.aria = i18nService.getSafeText('headerCell.aria');
+ $scope.removeFilter = function(colFilter, index){
+ colFilter.term = null;
+ //Set the focus to the filter input after the action disables the button
+ gridUtil.focus.bySelector($elm, '.ui-grid-filter-input-' + index);
+ };
+ }
+ };
+ }
+ };
+ }]);
+})();
+
+(function () {
+ 'use strict';
+
+ angular.module('ui.grid').directive('uiGridFooterCell', ['$timeout', 'gridUtil', 'uiGridConstants', '$compile',
+ function ($timeout, gridUtil, uiGridConstants, $compile) {
+ var uiGridFooterCell = {
+ priority: 0,
+ scope: {
+ col: '=',
+ row: '=',
+ renderIndex: '='
+ },
+ replace: true,
+ require: '^uiGrid',
+ compile: function compile(tElement, tAttrs, transclude) {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ var cellFooter = $compile($scope.col.footerCellTemplate)($scope);
+ $elm.append(cellFooter);
+ },
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ //$elm.addClass($scope.col.getColClass(false));
+ $scope.grid = uiGridCtrl.grid;
+
+ var initColClass = $scope.col.getColClass(false);
+ $elm.addClass(initColClass);
+
+ // apply any footerCellClass
+ var classAdded;
+ var updateClass = function( grid ){
+ var contents = $elm;
+ if ( classAdded ){
+ contents.removeClass( classAdded );
+ classAdded = null;
+ }
+
+ if (angular.isFunction($scope.col.footerCellClass)) {
+ classAdded = $scope.col.footerCellClass($scope.grid, $scope.row, $scope.col, $scope.rowRenderIndex, $scope.colRenderIndex);
+ }
+ else {
+ classAdded = $scope.col.footerCellClass;
+ }
+ contents.addClass(classAdded);
+ };
+
+ if ($scope.col.footerCellClass) {
+ updateClass();
+ }
+
+ $scope.col.updateAggregationValue();
+
+ // Watch for column changes so we can alter the col cell class properly
+/* shouldn't be needed any more, given track by col.name
+ $scope.$watch('col', function (n, o) {
+ if (n !== o) {
+ // See if the column's internal class has changed
+ var newColClass = $scope.col.getColClass(false);
+ if (newColClass !== initColClass) {
+ $elm.removeClass(initColClass);
+ $elm.addClass(newColClass);
+ initColClass = newColClass;
+ }
+ }
+ });
+*/
+
+
+ // Register a data change watch that would get triggered whenever someone edits a cell or modifies column defs
+ var dataChangeDereg = $scope.grid.registerDataChangeCallback( updateClass, [uiGridConstants.dataChange.COLUMN]);
+ // listen for visible rows change and update aggregation values
+ $scope.grid.api.core.on.rowsRendered( $scope, $scope.col.updateAggregationValue );
+ $scope.grid.api.core.on.rowsRendered( $scope, updateClass );
+ $scope.$on( '$destroy', dataChangeDereg );
+ }
+ };
+ }
+ };
+
+ return uiGridFooterCell;
+ }]);
+
+})();
+
+(function () {
+ 'use strict';
+
+ angular.module('ui.grid').directive('uiGridFooter', ['$templateCache', '$compile', 'uiGridConstants', 'gridUtil', '$timeout', function ($templateCache, $compile, uiGridConstants, gridUtil, $timeout) {
+
+ return {
+ restrict: 'EA',
+ replace: true,
+ // priority: 1000,
+ require: ['^uiGrid', '^uiGridRenderContainer'],
+ scope: true,
+ compile: function ($elm, $attrs) {
+ return {
+ pre: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0];
+ var containerCtrl = controllers[1];
+
+ $scope.grid = uiGridCtrl.grid;
+ $scope.colContainer = containerCtrl.colContainer;
+
+ containerCtrl.footer = $elm;
+
+ var footerTemplate = $scope.grid.options.footerTemplate;
+ gridUtil.getTemplate(footerTemplate)
+ .then(function (contents) {
+ var template = angular.element(contents);
+
+ var newElm = $compile(template)($scope);
+ $elm.append(newElm);
+
+ if (containerCtrl) {
+ // Inject a reference to the footer viewport (if it exists) into the grid controller for use in the horizontal scroll handler below
+ var footerViewport = $elm[0].getElementsByClassName('ui-grid-footer-viewport')[0];
+
+ if (footerViewport) {
+ containerCtrl.footerViewport = footerViewport;
+ }
+ }
+ });
+ },
+
+ post: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0];
+ var containerCtrl = controllers[1];
+
+ // gridUtil.logDebug('ui-grid-footer link');
+
+ var grid = uiGridCtrl.grid;
+
+ // Don't animate footer cells
+ gridUtil.disableAnimations($elm);
+
+ containerCtrl.footer = $elm;
+
+ var footerViewport = $elm[0].getElementsByClassName('ui-grid-footer-viewport')[0];
+ if (footerViewport) {
+ containerCtrl.footerViewport = footerViewport;
+ }
+ }
+ };
+ }
+ };
+ }]);
+
+})();
+(function () {
+ 'use strict';
+
+ angular.module('ui.grid').directive('uiGridGridFooter', ['$templateCache', '$compile', 'uiGridConstants', 'gridUtil', '$timeout', function ($templateCache, $compile, uiGridConstants, gridUtil, $timeout) {
+
+ return {
+ restrict: 'EA',
+ replace: true,
+ // priority: 1000,
+ require: '^uiGrid',
+ scope: true,
+ compile: function ($elm, $attrs) {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+
+ $scope.grid = uiGridCtrl.grid;
+
+
+
+ var footerTemplate = $scope.grid.options.gridFooterTemplate;
+ gridUtil.getTemplate(footerTemplate)
+ .then(function (contents) {
+ var template = angular.element(contents);
+
+ var newElm = $compile(template)($scope);
+ $elm.append(newElm);
+ });
+ },
+
+ post: function ($scope, $elm, $attrs, controllers) {
+
+ }
+ };
+ }
+ };
+ }]);
+
+})();
+(function(){
+ 'use strict';
+
+ angular.module('ui.grid').directive('uiGridGroupPanel', ["$compile", "uiGridConstants", "gridUtil", function($compile, uiGridConstants, gridUtil) {
+ var defaultTemplate = 'ui-grid/ui-grid-group-panel';
+
+ return {
+ restrict: 'EA',
+ replace: true,
+ require: '?^uiGrid',
+ scope: false,
+ compile: function($elm, $attrs) {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ var groupPanelTemplate = $scope.grid.options.groupPanelTemplate || defaultTemplate;
+
+ gridUtil.getTemplate(groupPanelTemplate)
+ .then(function (contents) {
+ var template = angular.element(contents);
+
+ var newElm = $compile(template)($scope);
+ $elm.append(newElm);
+ });
+ },
+
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ $elm.bind('$destroy', function() {
+ // scrollUnbinder();
+ });
+ }
+ };
+ }
+ };
+ }]);
+
+})();
+(function(){
+ 'use strict';
+
+ angular.module('ui.grid').directive('uiGridHeaderCell', ['$compile', '$timeout', '$window', '$document', 'gridUtil', 'uiGridConstants', 'ScrollEvent', 'i18nService',
+ function ($compile, $timeout, $window, $document, gridUtil, uiGridConstants, ScrollEvent, i18nService) {
+ // Do stuff after mouse has been down this many ms on the header cell
+ var mousedownTimeout = 500;
+ var changeModeTimeout = 500; // length of time between a touch event and a mouse event being recognised again, and vice versa
+
+ var uiGridHeaderCell = {
+ priority: 0,
+ scope: {
+ col: '=',
+ row: '=',
+ renderIndex: '='
+ },
+ require: ['^uiGrid', '^uiGridRenderContainer'],
+ replace: true,
+ compile: function() {
+ return {
+ pre: function ($scope, $elm, $attrs) {
+ var cellHeader = $compile($scope.col.headerCellTemplate)($scope);
+ $elm.append(cellHeader);
+ },
+
+ post: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0];
+ var renderContainerCtrl = controllers[1];
+
+ $scope.i18n = {
+ headerCell: i18nService.getSafeText('headerCell'),
+ sort: i18nService.getSafeText('sort')
+ };
+ $scope.getSortDirectionAriaLabel = function(){
+ var col = $scope.col;
+ //Trying to recreate this sort of thing but it was getting messy having it in the template.
+ //Sort direction {{col.sort.direction == asc ? 'ascending' : ( col.sort.direction == desc ? 'descending':'none')}}. {{col.sort.priority ? {{columnPriorityText}} {{col.sort.priority}} : ''}
+ var sortDirectionText = col.sort.direction === uiGridConstants.ASC ? $scope.i18n.sort.ascending : ( col.sort.direction === uiGridConstants.DESC ? $scope.i18n.sort.descending : $scope.i18n.sort.none);
+ var label = sortDirectionText;
+ //Append the priority if it exists
+ if (col.sort.priority) {
+ label = label + '. ' + $scope.i18n.headerCell.priority + ' ' + col.sort.priority;
+ }
+ return label;
+ };
+
+ $scope.grid = uiGridCtrl.grid;
+
+ $scope.renderContainer = uiGridCtrl.grid.renderContainers[renderContainerCtrl.containerId];
+
+ var initColClass = $scope.col.getColClass(false);
+ $elm.addClass(initColClass);
+
+ // Hide the menu by default
+ $scope.menuShown = false;
+
+ // Put asc and desc sort directions in scope
+ $scope.asc = uiGridConstants.ASC;
+ $scope.desc = uiGridConstants.DESC;
+
+ // Store a reference to menu element
+ var $colMenu = angular.element( $elm[0].querySelectorAll('.ui-grid-header-cell-menu') );
+
+ var $contentsElm = angular.element( $elm[0].querySelectorAll('.ui-grid-cell-contents') );
+
+
+ // apply any headerCellClass
+ var classAdded;
+ var previousMouseX;
+
+ // filter watchers
+ var filterDeregisters = [];
+
+
+ /*
+ * Our basic approach here for event handlers is that we listen for a down event (mousedown or touchstart).
+ * Once we have a down event, we need to work out whether we have a click, a drag, or a
+ * hold. A click would sort the grid (if sortable). A drag would be used by moveable, so
+ * we ignore it. A hold would open the menu.
+ *
+ * So, on down event, we put in place handlers for move and up events, and a timer. If the
+ * timer expires before we see a move or up, then we have a long press and hence a column menu open.
+ * If the up happens before the timer, then we have a click, and we sort if the column is sortable.
+ * If a move happens before the timer, then we are doing column move, so we do nothing, the moveable feature
+ * will handle it.
+ *
+ * To deal with touch enabled devices that also have mice, we only create our handlers when
+ * we get the down event, and we create the corresponding handlers - if we're touchstart then
+ * we get touchmove and touchend, if we're mousedown then we get mousemove and mouseup.
+ *
+ * We also suppress the click action whilst this is happening - otherwise after the mouseup there
+ * will be a click event and that can cause the column menu to close
+ *
+ */
+
+ $scope.downFn = function( event ){
+ event.stopPropagation();
+
+ if (typeof(event.originalEvent) !== 'undefined' && event.originalEvent !== undefined) {
+ event = event.originalEvent;
+ }
+
+ // Don't show the menu if it's not the left button
+ if (event.button && event.button !== 0) {
+ return;
+ }
+ previousMouseX = event.pageX;
+
+ $scope.mousedownStartTime = (new Date()).getTime();
+ $scope.mousedownTimeout = $timeout(function() { }, mousedownTimeout);
+
+ $scope.mousedownTimeout.then(function () {
+ if ( $scope.colMenu ) {
+ uiGridCtrl.columnMenuScope.showMenu($scope.col, $elm, event);
+ }
+ });
+
+ uiGridCtrl.fireEvent(uiGridConstants.events.COLUMN_HEADER_CLICK, {event: event, columnName: $scope.col.colDef.name});
+
+ $scope.offAllEvents();
+ if ( event.type === 'touchstart'){
+ $document.on('touchend', $scope.upFn);
+ $document.on('touchmove', $scope.moveFn);
+ } else if ( event.type === 'mousedown' ){
+ $document.on('mouseup', $scope.upFn);
+ $document.on('mousemove', $scope.moveFn);
+ }
+ };
+
+ $scope.upFn = function( event ){
+ event.stopPropagation();
+ $timeout.cancel($scope.mousedownTimeout);
+ $scope.offAllEvents();
+ $scope.onDownEvents(event.type);
+
+ var mousedownEndTime = (new Date()).getTime();
+ var mousedownTime = mousedownEndTime - $scope.mousedownStartTime;
+
+ if (mousedownTime > mousedownTimeout) {
+ // long click, handled above with mousedown
+ }
+ else {
+ // short click
+ if ( $scope.sortable ){
+ $scope.handleClick(event);
+ }
+ }
+ };
+
+ $scope.moveFn = function( event ){
+ // Chrome is known to fire some bogus move events.
+ var changeValue = event.pageX - previousMouseX;
+ if ( changeValue === 0 ){ return; }
+
+ // we're a move, so do nothing and leave for column move (if enabled) to take over
+ $timeout.cancel($scope.mousedownTimeout);
+ $scope.offAllEvents();
+ $scope.onDownEvents(event.type);
+ };
+
+ $scope.clickFn = function ( event ){
+ event.stopPropagation();
+ $contentsElm.off('click', $scope.clickFn);
+ };
+
+
+ $scope.offAllEvents = function(){
+ $contentsElm.off('touchstart', $scope.downFn);
+ $contentsElm.off('mousedown', $scope.downFn);
+
+ $document.off('touchend', $scope.upFn);
+ $document.off('mouseup', $scope.upFn);
+
+ $document.off('touchmove', $scope.moveFn);
+ $document.off('mousemove', $scope.moveFn);
+
+ $contentsElm.off('click', $scope.clickFn);
+ };
+
+ $scope.onDownEvents = function( type ){
+ // If there is a previous event, then wait a while before
+ // activating the other mode - i.e. if the last event was a touch event then
+ // don't enable mouse events for a wee while (500ms or so)
+ // Avoids problems with devices that emulate mouse events when you have touch events
+
+ switch (type){
+ case 'touchmove':
+ case 'touchend':
+ $contentsElm.on('click', $scope.clickFn);
+ $contentsElm.on('touchstart', $scope.downFn);
+ $timeout(function(){
+ $contentsElm.on('mousedown', $scope.downFn);
+ }, changeModeTimeout);
+ break;
+ case 'mousemove':
+ case 'mouseup':
+ $contentsElm.on('click', $scope.clickFn);
+ $contentsElm.on('mousedown', $scope.downFn);
+ $timeout(function(){
+ $contentsElm.on('touchstart', $scope.downFn);
+ }, changeModeTimeout);
+ break;
+ default:
+ $contentsElm.on('click', $scope.clickFn);
+ $contentsElm.on('touchstart', $scope.downFn);
+ $contentsElm.on('mousedown', $scope.downFn);
+ }
+ };
+
+
+ var updateHeaderOptions = function( grid ){
+ var contents = $elm;
+ if ( classAdded ){
+ contents.removeClass( classAdded );
+ classAdded = null;
+ }
+
+ if (angular.isFunction($scope.col.headerCellClass)) {
+ classAdded = $scope.col.headerCellClass($scope.grid, $scope.row, $scope.col, $scope.rowRenderIndex, $scope.colRenderIndex);
+ }
+ else {
+ classAdded = $scope.col.headerCellClass;
+ }
+ contents.addClass(classAdded);
+
+ var rightMostContainer = $scope.grid.renderContainers['right'] ? $scope.grid.renderContainers['right'] : $scope.grid.renderContainers['body'];
+ $scope.isLastCol = ( $scope.col === rightMostContainer.visibleColumnCache[ rightMostContainer.visibleColumnCache.length - 1 ] );
+
+ // Figure out whether this column is sortable or not
+ if (uiGridCtrl.grid.options.enableSorting && $scope.col.enableSorting) {
+ $scope.sortable = true;
+ }
+ else {
+ $scope.sortable = false;
+ }
+
+ // Figure out whether this column is filterable or not
+ var oldFilterable = $scope.filterable;
+ if (uiGridCtrl.grid.options.enableFiltering && $scope.col.enableFiltering) {
+ $scope.filterable = true;
+ }
+ else {
+ $scope.filterable = false;
+ }
+
+ if ( oldFilterable !== $scope.filterable){
+ if ( typeof($scope.col.updateFilters) !== 'undefined' ){
+ $scope.col.updateFilters($scope.filterable);
+ }
+
+ // if column is filterable add a filter watcher
+ if ($scope.filterable) {
+ $scope.col.filters.forEach( function(filter, i) {
+ filterDeregisters.push($scope.$watch('col.filters[' + i + '].term', function(n, o) {
+ if (n !== o) {
+ uiGridCtrl.grid.api.core.raise.filterChanged();
+ uiGridCtrl.grid.api.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
+ uiGridCtrl.grid.queueGridRefresh();
+ }
+ }));
+ });
+ $scope.$on('$destroy', function() {
+ filterDeregisters.forEach( function(filterDeregister) {
+ filterDeregister();
+ });
+ });
+ } else {
+ filterDeregisters.forEach( function(filterDeregister) {
+ filterDeregister();
+ });
+ }
+
+ }
+
+ // figure out whether we support column menus
+ if ($scope.col.grid.options && $scope.col.grid.options.enableColumnMenus !== false &&
+ $scope.col.colDef && $scope.col.colDef.enableColumnMenu !== false){
+ $scope.colMenu = true;
+ } else {
+ $scope.colMenu = false;
+ }
+
+ /**
+ * @ngdoc property
+ * @name enableColumnMenu
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description if column menus are enabled, controls the column menus for this specific
+ * column (i.e. if gridOptions.enableColumnMenus, then you can control column menus
+ * using this option. If gridOptions.enableColumnMenus === false then you get no column
+ * menus irrespective of the value of this option ). Defaults to true.
+ *
+ */
+ /**
+ * @ngdoc property
+ * @name enableColumnMenus
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description Override for column menus everywhere - if set to false then you get no
+ * column menus. Defaults to true.
+ *
+ */
+
+ $scope.offAllEvents();
+
+ if ($scope.sortable || $scope.colMenu) {
+ $scope.onDownEvents();
+
+ $scope.$on('$destroy', function () {
+ $scope.offAllEvents();
+ });
+ }
+ };
+
+/*
+ $scope.$watch('col', function (n, o) {
+ if (n !== o) {
+ // See if the column's internal class has changed
+ var newColClass = $scope.col.getColClass(false);
+ if (newColClass !== initColClass) {
+ $elm.removeClass(initColClass);
+ $elm.addClass(newColClass);
+ initColClass = newColClass;
+ }
+ }
+ });
+*/
+ updateHeaderOptions();
+
+ // Register a data change watch that would get triggered whenever someone edits a cell or modifies column defs
+ var dataChangeDereg = $scope.grid.registerDataChangeCallback( updateHeaderOptions, [uiGridConstants.dataChange.COLUMN]);
+
+ $scope.$on( '$destroy', dataChangeDereg );
+
+ $scope.handleClick = function(event) {
+ // If the shift key is being held down, add this column to the sort
+ var add = false;
+ if (event.shiftKey) {
+ add = true;
+ }
+
+ // Sort this column then rebuild the grid's rows
+ uiGridCtrl.grid.sortColumn($scope.col, add)
+ .then(function () {
+ if (uiGridCtrl.columnMenuScope) { uiGridCtrl.columnMenuScope.hideMenu(); }
+ uiGridCtrl.grid.refresh();
+ });
+ };
+
+
+ $scope.toggleMenu = function(event) {
+ event.stopPropagation();
+
+ // If the menu is already showing...
+ if (uiGridCtrl.columnMenuScope.menuShown) {
+ // ... and we're the column the menu is on...
+ if (uiGridCtrl.columnMenuScope.col === $scope.col) {
+ // ... hide it
+ uiGridCtrl.columnMenuScope.hideMenu();
+ }
+ // ... and we're NOT the column the menu is on
+ else {
+ // ... move the menu to our column
+ uiGridCtrl.columnMenuScope.showMenu($scope.col, $elm);
+ }
+ }
+ // If the menu is NOT showing
+ else {
+ // ... show it on our column
+ uiGridCtrl.columnMenuScope.showMenu($scope.col, $elm);
+ }
+ };
+ }
+ };
+ }
+ };
+
+ return uiGridHeaderCell;
+ }]);
+
+})();
+
+(function(){
+ 'use strict';
+
+ angular.module('ui.grid').directive('uiGridHeader', ['$templateCache', '$compile', 'uiGridConstants', 'gridUtil', '$timeout', 'ScrollEvent',
+ function($templateCache, $compile, uiGridConstants, gridUtil, $timeout, ScrollEvent) {
+ var defaultTemplate = 'ui-grid/ui-grid-header';
+ var emptyTemplate = 'ui-grid/ui-grid-no-header';
+
+ return {
+ restrict: 'EA',
+ // templateUrl: 'ui-grid/ui-grid-header',
+ replace: true,
+ // priority: 1000,
+ require: ['^uiGrid', '^uiGridRenderContainer'],
+ scope: true,
+ compile: function($elm, $attrs) {
+ return {
+ pre: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0];
+ var containerCtrl = controllers[1];
+
+ $scope.grid = uiGridCtrl.grid;
+ $scope.colContainer = containerCtrl.colContainer;
+
+ updateHeaderReferences();
+
+ var headerTemplate;
+ if (!$scope.grid.options.showHeader) {
+ headerTemplate = emptyTemplate;
+ }
+ else {
+ headerTemplate = ($scope.grid.options.headerTemplate) ? $scope.grid.options.headerTemplate : defaultTemplate;
+ }
+
+ gridUtil.getTemplate(headerTemplate)
+ .then(function (contents) {
+ var template = angular.element(contents);
+
+ var newElm = $compile(template)($scope);
+ $elm.replaceWith(newElm);
+
+ // And update $elm to be the new element
+ $elm = newElm;
+
+ updateHeaderReferences();
+
+ if (containerCtrl) {
+ // Inject a reference to the header viewport (if it exists) into the grid controller for use in the horizontal scroll handler below
+ var headerViewport = $elm[0].getElementsByClassName('ui-grid-header-viewport')[0];
+
+
+ if (headerViewport) {
+ containerCtrl.headerViewport = headerViewport;
+ angular.element(headerViewport).on('scroll', scrollHandler);
+ $scope.$on('$destroy', function () {
+ angular.element(headerViewport).off('scroll', scrollHandler);
+ });
+ }
+ }
+
+ $scope.grid.queueRefresh();
+ });
+
+ function updateHeaderReferences() {
+ containerCtrl.header = containerCtrl.colContainer.header = $elm;
+
+ var headerCanvases = $elm[0].getElementsByClassName('ui-grid-header-canvas');
+
+ if (headerCanvases.length > 0) {
+ containerCtrl.headerCanvas = containerCtrl.colContainer.headerCanvas = headerCanvases[0];
+ }
+ else {
+ containerCtrl.headerCanvas = null;
+ }
+ }
+
+ function scrollHandler(evt) {
+ if (uiGridCtrl.grid.isScrollingHorizontally) {
+ return;
+ }
+ var newScrollLeft = gridUtil.normalizeScrollLeft(containerCtrl.headerViewport, uiGridCtrl.grid);
+ var horizScrollPercentage = containerCtrl.colContainer.scrollHorizontal(newScrollLeft);
+
+ var scrollEvent = new ScrollEvent(uiGridCtrl.grid, null, containerCtrl.colContainer, ScrollEvent.Sources.ViewPortScroll);
+ scrollEvent.newScrollLeft = newScrollLeft;
+ if ( horizScrollPercentage > -1 ){
+ scrollEvent.x = { percentage: horizScrollPercentage };
+ }
+
+ uiGridCtrl.grid.scrollContainers(null, scrollEvent);
+ }
+ },
+
+ post: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0];
+ var containerCtrl = controllers[1];
+
+ // gridUtil.logDebug('ui-grid-header link');
+
+ var grid = uiGridCtrl.grid;
+
+ // Don't animate header cells
+ gridUtil.disableAnimations($elm);
+
+ function updateColumnWidths() {
+ // this styleBuilder always runs after the renderContainer, so we can rely on the column widths
+ // already being populated correctly
+
+ var columnCache = containerCtrl.colContainer.visibleColumnCache;
+
+ // Build the CSS
+ // uiGridCtrl.grid.columns.forEach(function (column) {
+ var ret = '';
+ var canvasWidth = 0;
+ columnCache.forEach(function (column) {
+ ret = ret + column.getColClassDefinition();
+ canvasWidth += column.drawnWidth;
+ });
+
+ containerCtrl.colContainer.canvasWidth = canvasWidth;
+
+ // Return the styles back to buildStyles which pops them into the `customStyles` scope variable
+ return ret;
+ }
+
+ containerCtrl.header = $elm;
+
+ var headerViewport = $elm[0].getElementsByClassName('ui-grid-header-viewport')[0];
+ if (headerViewport) {
+ containerCtrl.headerViewport = headerViewport;
+ }
+
+ //todo: remove this if by injecting gridCtrl into unit tests
+ if (uiGridCtrl) {
+ uiGridCtrl.grid.registerStyleComputation({
+ priority: 15,
+ func: updateColumnWidths
+ });
+ }
+ }
+ };
+ }
+ };
+ }]);
+
+})();
+
+(function(){
+
+angular.module('ui.grid')
+.service('uiGridGridMenuService', [ 'gridUtil', 'i18nService', 'uiGridConstants', function( gridUtil, i18nService, uiGridConstants ) {
+ /**
+ * @ngdoc service
+ * @name ui.grid.gridMenuService
+ *
+ * @description Methods for working with the grid menu
+ */
+
+ var service = {
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.gridMenuService
+ * @name initialize
+ * @description Sets up the gridMenu. Most importantly, sets our
+ * scope onto the grid object as grid.gridMenuScope, allowing us
+ * to operate when passed only the grid. Second most importantly,
+ * we register the 'addToGridMenu' and 'removeFromGridMenu' methods
+ * on the core api.
+ * @param {$scope} $scope the scope of this gridMenu
+ * @param {Grid} grid the grid to which this gridMenu is associated
+ */
+ initialize: function( $scope, grid ){
+ grid.gridMenuScope = $scope;
+ $scope.grid = grid;
+ $scope.registeredMenuItems = [];
+
+ // not certain this is needed, but would be bad to create a memory leak
+ $scope.$on('$destroy', function() {
+ if ( $scope.grid && $scope.grid.gridMenuScope ){
+ $scope.grid.gridMenuScope = null;
+ }
+ if ( $scope.grid ){
+ $scope.grid = null;
+ }
+ if ( $scope.registeredMenuItems ){
+ $scope.registeredMenuItems = null;
+ }
+ });
+
+ $scope.registeredMenuItems = [];
+
+ /**
+ * @ngdoc function
+ * @name addToGridMenu
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description add items to the grid menu. Used by features
+ * to add their menu items if they are enabled, can also be used by
+ * end users to add menu items. This method has the advantage of allowing
+ * remove again, which can simplify management of which items are included
+ * in the menu when. (Noting that in most cases the shown and active functions
+ * provide a better way to handle visibility of menu items)
+ * @param {Grid} grid the grid on which we are acting
+ * @param {array} items menu items in the format as described in the tutorial, with
+ * the added note that if you want to use remove you must also specify an `id` field,
+ * which is provided when you want to remove an item. The id should be unique.
+ *
+ */
+ grid.api.registerMethod( 'core', 'addToGridMenu', service.addToGridMenu );
+
+ /**
+ * @ngdoc function
+ * @name removeFromGridMenu
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Remove an item from the grid menu based on a provided id. Assumes
+ * that the id is unique, removes only the last instance of that id. Does nothing if
+ * the specified id is not found
+ * @param {Grid} grid the grid on which we are acting
+ * @param {string} id the id we'd like to remove from the menu
+ *
+ */
+ grid.api.registerMethod( 'core', 'removeFromGridMenu', service.removeFromGridMenu );
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name addToGridMenu
+ * @propertyOf ui.grid.gridMenuService
+ * @description add items to the grid menu. Used by features
+ * to add their menu items if they are enabled, can also be used by
+ * end users to add menu items. This method has the advantage of allowing
+ * remove again, which can simplify management of which items are included
+ * in the menu when. (Noting that in most cases the shown and active functions
+ * provide a better way to handle visibility of menu items)
+ * @param {Grid} grid the grid on which we are acting
+ * @param {array} items menu items in the format as described in the tutorial, with
+ * the added note that if you want to use remove you must also specify an `id` field,
+ * which is provided when you want to remove an item. The id should be unique.
+ *
+ */
+ addToGridMenu: function( grid, menuItems ) {
+ if ( !angular.isArray( menuItems ) ) {
+ gridUtil.logError( 'addToGridMenu: menuItems must be an array, and is not, not adding any items');
+ } else {
+ if ( grid.gridMenuScope ){
+ grid.gridMenuScope.registeredMenuItems = grid.gridMenuScope.registeredMenuItems ? grid.gridMenuScope.registeredMenuItems : [];
+ grid.gridMenuScope.registeredMenuItems = grid.gridMenuScope.registeredMenuItems.concat( menuItems );
+ } else {
+ gridUtil.logError( 'Asked to addToGridMenu, but gridMenuScope not present. Timing issue? Please log issue with ui-grid');
+ }
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name removeFromGridMenu
+ * @methodOf ui.grid.gridMenuService
+ * @description Remove an item from the grid menu based on a provided id. Assumes
+ * that the id is unique, removes only the last instance of that id. Does nothing if
+ * the specified id is not found. If there is no gridMenuScope or registeredMenuItems
+ * then do nothing silently - the desired result is those menu items not be present and they
+ * aren't.
+ * @param {Grid} grid the grid on which we are acting
+ * @param {string} id the id we'd like to remove from the menu
+ *
+ */
+ removeFromGridMenu: function( grid, id ){
+ var foundIndex = -1;
+
+ if ( grid && grid.gridMenuScope ){
+ grid.gridMenuScope.registeredMenuItems.forEach( function( value, index ) {
+ if ( value.id === id ){
+ if (foundIndex > -1) {
+ gridUtil.logError( 'removeFromGridMenu: found multiple items with the same id, removing only the last' );
+ } else {
+
+ foundIndex = index;
+ }
+ }
+ });
+ }
+
+ if ( foundIndex > -1 ){
+ grid.gridMenuScope.registeredMenuItems.splice( foundIndex, 1 );
+ }
+ },
+
+
+ /**
+ * @ngdoc array
+ * @name gridMenuCustomItems
+ * @propertyOf ui.grid.class:GridOptions
+ * @description (optional) An array of menu items that should be added to
+ * the gridMenu. Follow the format documented in the tutorial for column
+ * menu customisation. The context provided to the action function will
+ * include context.grid. An alternative if working with dynamic menus is to use the
+ * provided api - core.addToGridMenu and core.removeFromGridMenu, which handles
+ * some of the management of items for you.
+ *
+ */
+ /**
+ * @ngdoc boolean
+ * @name gridMenuShowHideColumns
+ * @propertyOf ui.grid.class:GridOptions
+ * @description true by default, whether the grid menu should allow hide/show
+ * of columns
+ *
+ */
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.gridMenuService
+ * @name getMenuItems
+ * @description Decides the menu items to show in the menu. This is a
+ * combination of:
+ *
+ * - the default menu items that are always included,
+ * - any menu items that have been provided through the addMenuItem api. These
+ * are typically added by features within the grid
+ * - any menu items included in grid.options.gridMenuCustomItems. These can be
+ * changed dynamically, as they're always recalculated whenever we show the
+ * menu
+ * @param {$scope} $scope the scope of this gridMenu, from which we can find all
+ * the information that we need
+ * @returns {array} an array of menu items that can be shown
+ */
+ getMenuItems: function( $scope ) {
+ var menuItems = [
+ // this is where we add any menu items we want to always include
+ ];
+
+ if ( $scope.grid.options.gridMenuCustomItems ){
+ if ( !angular.isArray( $scope.grid.options.gridMenuCustomItems ) ){
+ gridUtil.logError( 'gridOptions.gridMenuCustomItems must be an array, and is not');
+ } else {
+ menuItems = menuItems.concat( $scope.grid.options.gridMenuCustomItems );
+ }
+ }
+
+ var clearFilters = [{
+ title: i18nService.getSafeText('gridMenu.clearAllFilters'),
+ action: function ($event) {
+ $scope.grid.clearAllFilters(undefined, true, undefined);
+ },
+ shown: function() {
+ return $scope.grid.options.enableFiltering;
+ },
+ order: 100
+ }];
+ menuItems = menuItems.concat( clearFilters );
+
+ menuItems = menuItems.concat( $scope.registeredMenuItems );
+
+ if ( $scope.grid.options.gridMenuShowHideColumns !== false ){
+ menuItems = menuItems.concat( service.showHideColumns( $scope ) );
+ }
+
+ menuItems.sort(function(a, b){
+ return a.order - b.order;
+ });
+
+ return menuItems;
+ },
+
+
+ /**
+ * @ngdoc array
+ * @name gridMenuTitleFilter
+ * @propertyOf ui.grid.class:GridOptions
+ * @description (optional) A function that takes a title string
+ * (usually the col.displayName), and converts it into a display value. The function
+ * must return either a string or a promise.
+ *
+ * Used for internationalization of the grid menu column names - for angular-translate
+ * you can pass $translate as the function, for i18nService you can pass getSafeText as the
+ * function
+ * @example
+ * <pre>
+ * gridOptions = {
+ * gridMenuTitleFilter: $translate
+ * }
+ * </pre>
+ */
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.gridMenuService
+ * @name showHideColumns
+ * @description Adds two menu items for each of the columns in columnDefs. One
+ * menu item for hide, one menu item for show. Each is visible when appropriate
+ * (show when column is not visible, hide when column is visible). Each toggles
+ * the visible property on the columnDef using toggleColumnVisibility
+ * @param {$scope} $scope of a gridMenu, which contains a reference to the grid
+ */
+ showHideColumns: function( $scope ){
+ var showHideColumns = [];
+ if ( !$scope.grid.options.columnDefs || $scope.grid.options.columnDefs.length === 0 || $scope.grid.columns.length === 0 ) {
+ return showHideColumns;
+ }
+
+ // add header for columns
+ showHideColumns.push({
+ title: i18nService.getSafeText('gridMenu.columns'),
+ order: 300
+ });
+
+ $scope.grid.options.gridMenuTitleFilter = $scope.grid.options.gridMenuTitleFilter ? $scope.grid.options.gridMenuTitleFilter : function( title ) { return title; };
+
+ $scope.grid.options.columnDefs.forEach( function( colDef, index ){
+ if ( colDef.enableHiding !== false ){
+ // add hide menu item - shows an OK icon as we only show when column is already visible
+ var menuItem = {
+ icon: 'ui-grid-icon-ok',
+ action: function($event) {
+ $event.stopPropagation();
+ service.toggleColumnVisibility( this.context.gridCol );
+ },
+ shown: function() {
+ return this.context.gridCol.colDef.visible === true || this.context.gridCol.colDef.visible === undefined;
+ },
+ context: { gridCol: $scope.grid.getColumn(colDef.name || colDef.field) },
+ leaveOpen: true,
+ order: 301 + index * 2
+ };
+ service.setMenuItemTitle( menuItem, colDef, $scope.grid );
+ showHideColumns.push( menuItem );
+
+ // add show menu item - shows no icon as we only show when column is invisible
+ menuItem = {
+ icon: 'ui-grid-icon-cancel',
+ action: function($event) {
+ $event.stopPropagation();
+ service.toggleColumnVisibility( this.context.gridCol );
+ },
+ shown: function() {
+ return !(this.context.gridCol.colDef.visible === true || this.context.gridCol.colDef.visible === undefined);
+ },
+ context: { gridCol: $scope.grid.getColumn(colDef.name || colDef.field) },
+ leaveOpen: true,
+ order: 301 + index * 2 + 1
+ };
+ service.setMenuItemTitle( menuItem, colDef, $scope.grid );
+ showHideColumns.push( menuItem );
+ }
+ });
+ return showHideColumns;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.gridMenuService
+ * @name setMenuItemTitle
+ * @description Handles the response from gridMenuTitleFilter, adding it directly to the menu
+ * item if it returns a string, otherwise waiting for the promise to resolve or reject then
+ * putting the result into the title
+ * @param {object} menuItem the menuItem we want to put the title on
+ * @param {object} colDef the colDef from which we can get displayName, name or field
+ * @param {Grid} grid the grid, from which we can get the options.gridMenuTitleFilter
+ *
+ */
+ setMenuItemTitle: function( menuItem, colDef, grid ){
+ var title = grid.options.gridMenuTitleFilter( colDef.displayName || gridUtil.readableColumnName(colDef.name) || colDef.field );
+
+ if ( typeof(title) === 'string' ){
+ menuItem.title = title;
+ } else if ( title.then ){
+ // must be a promise
+ menuItem.title = "";
+ title.then( function( successValue ) {
+ menuItem.title = successValue;
+ }, function( errorValue ) {
+ menuItem.title = errorValue;
+ });
+ } else {
+ gridUtil.logError('Expected gridMenuTitleFilter to return a string or a promise, it has returned neither, bad config');
+ menuItem.title = 'badconfig';
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.gridMenuService
+ * @name toggleColumnVisibility
+ * @description Toggles the visibility of an individual column. Expects to be
+ * provided a context that has on it a gridColumn, which is the column that
+ * we'll operate upon. We change the visibility, and refresh the grid as appropriate
+ * @param {GridCol} gridCol the column that we want to toggle
+ *
+ */
+ toggleColumnVisibility: function( gridCol ) {
+ gridCol.colDef.visible = !( gridCol.colDef.visible === true || gridCol.colDef.visible === undefined );
+
+ gridCol.grid.refresh();
+ gridCol.grid.api.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
+ gridCol.grid.api.core.raise.columnVisibilityChanged( gridCol );
+ }
+ };
+
+ return service;
+}])
+
+
+
+.directive('uiGridMenuButton', ['gridUtil', 'uiGridConstants', 'uiGridGridMenuService', 'i18nService',
+function (gridUtil, uiGridConstants, uiGridGridMenuService, i18nService) {
+
+ return {
+ priority: 0,
+ scope: true,
+ require: ['^uiGrid'],
+ templateUrl: 'ui-grid/ui-grid-menu-button',
+ replace: true,
+
+ link: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0];
+
+ // For the aria label
+ $scope.i18n = {
+ aria: i18nService.getSafeText('gridMenu.aria')
+ };
+
+ uiGridGridMenuService.initialize($scope, uiGridCtrl.grid);
+
+ $scope.shown = false;
+
+ $scope.toggleMenu = function () {
+ if ( $scope.shown ){
+ $scope.$broadcast('hide-menu');
+ $scope.shown = false;
+ } else {
+ $scope.menuItems = uiGridGridMenuService.getMenuItems( $scope );
+ $scope.$broadcast('show-menu');
+ $scope.shown = true;
+ }
+ };
+
+ $scope.$on('menu-hidden', function() {
+ $scope.shown = false;
+ gridUtil.focus.bySelector($elm, '.ui-grid-icon-container');
+ });
+ }
+ };
+
+}]);
+
+})();
+
+(function(){
+
+/**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridMenu
+ * @element style
+ * @restrict A
+ *
+ * @description
+ * Allows us to interpolate expressions in `<style>` elements. Angular doesn't do this by default as it can/will/might? break in IE8.
+ *
+ * @example
+ <doc:example module="app">
+ <doc:source>
+ <script>
+ var app = angular.module('app', ['ui.grid']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+
+ }]);
+ </script>
+
+ <div ng-controller="MainCtrl">
+ <div ui-grid-menu shown="true" ></div>
+ </div>
+ </doc:source>
+ <doc:scenario>
+ </doc:scenario>
+ </doc:example>
+ */
+angular.module('ui.grid')
+
+.directive('uiGridMenu', ['$compile', '$timeout', '$window', '$document', 'gridUtil', 'uiGridConstants', 'i18nService',
+function ($compile, $timeout, $window, $document, gridUtil, uiGridConstants, i18nService) {
+ var uiGridMenu = {
+ priority: 0,
+ scope: {
+ // shown: '&',
+ menuItems: '=',
+ autoHide: '=?'
+ },
+ require: '?^uiGrid',
+ templateUrl: 'ui-grid/uiGridMenu',
+ replace: false,
+ link: function ($scope, $elm, $attrs, uiGridCtrl) {
+ var self = this;
+ var menuMid;
+ var $animate;
+
+ $scope.i18n = {
+ close: i18nService.getSafeText('columnMenu.close')
+ };
+
+ // *** Show/Hide functions ******
+ self.showMenu = $scope.showMenu = function(event, args) {
+ if ( !$scope.shown ){
+
+ /*
+ * In order to animate cleanly we remove the ng-if, wait a digest cycle, then
+ * animate the removal of the ng-hide. We can't successfully (so far as I can tell)
+ * animate removal of the ng-if, as the menu items aren't there yet. And we don't want
+ * to rely on ng-show only, as that leaves elements in the DOM that are needlessly evaluated
+ * on scroll events.
+ *
+ * Note when testing animation that animations don't run on the tutorials. When debugging it looks
+ * like they do, but angular has a default $animate provider that is just a stub, and that's what's
+ * being called. ALso don't be fooled by the fact that your browser has actually loaded the
+ * angular-translate.js, it's not using it. You need to test animations in an external application.
+ */
+ $scope.shown = true;
+
+ $timeout( function() {
+ $scope.shownMid = true;
+ $scope.$emit('menu-shown');
+ });
+ } else if ( !$scope.shownMid ) {
+ // we're probably doing a hide then show, so we don't need to wait for ng-if
+ $scope.shownMid = true;
+ $scope.$emit('menu-shown');
+ }
+
+ var docEventType = 'click';
+ if (args && args.originalEvent && args.originalEvent.type && args.originalEvent.type === 'touchstart') {
+ docEventType = args.originalEvent.type;
+ }
+
+ // Turn off an existing document click handler
+ angular.element(document).off('click touchstart', applyHideMenu);
+
+ // Turn on the document click handler, but in a timeout so it doesn't apply to THIS click if there is one
+ $timeout(function() {
+ angular.element(document).on(docEventType, applyHideMenu);
+ });
+ //automatically set the focus to the first button element in the now open menu.
+ gridUtil.focus.bySelector($elm, 'button[type=button]', true);
+ };
+
+
+ self.hideMenu = $scope.hideMenu = function(event, args) {
+ if ( $scope.shown ){
+ /*
+ * In order to animate cleanly we animate the addition of ng-hide, then use a $timeout to
+ * set the ng-if (shown = false) after the animation runs. In theory we can cascade off the
+ * callback on the addClass method, but it is very unreliable with unit tests for no discernable reason.
+ *
+ * The user may have clicked on the menu again whilst
+ * we're waiting, so we check that the mid isn't shown before applying the ng-if.
+ */
+ $scope.shownMid = false;
+ $timeout( function() {
+ if ( !$scope.shownMid ){
+ $scope.shown = false;
+ $scope.$emit('menu-hidden');
+ }
+ }, 200);
+ }
+
+ angular.element(document).off('click touchstart', applyHideMenu);
+ };
+
+ $scope.$on('hide-menu', function (event, args) {
+ $scope.hideMenu(event, args);
+ });
+
+ $scope.$on('show-menu', function (event, args) {
+ $scope.showMenu(event, args);
+ });
+
+
+ // *** Auto hide when click elsewhere ******
+ var applyHideMenu = function(){
+ if ($scope.shown) {
+ $scope.$apply(function () {
+ $scope.hideMenu();
+ });
+ }
+ };
+
+ if (typeof($scope.autoHide) === 'undefined' || $scope.autoHide === undefined) {
+ $scope.autoHide = true;
+ }
+
+ if ($scope.autoHide) {
+ angular.element($window).on('resize', applyHideMenu);
+ }
+
+ $scope.$on('$destroy', function () {
+ angular.element(document).off('click touchstart', applyHideMenu);
+ });
+
+
+ $scope.$on('$destroy', function() {
+ angular.element($window).off('resize', applyHideMenu);
+ });
+
+ if (uiGridCtrl) {
+ $scope.$on('$destroy', uiGridCtrl.grid.api.core.on.scrollBegin($scope, applyHideMenu ));
+ }
+
+ $scope.$on('$destroy', $scope.$on(uiGridConstants.events.ITEM_DRAGGING, applyHideMenu ));
+ },
+
+
+ controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
+ var self = this;
+ }]
+ };
+
+ return uiGridMenu;
+}])
+
+.directive('uiGridMenuItem', ['gridUtil', '$compile', 'i18nService', function (gridUtil, $compile, i18nService) {
+ var uiGridMenuItem = {
+ priority: 0,
+ scope: {
+ name: '=',
+ active: '=',
+ action: '=',
+ icon: '=',
+ shown: '=',
+ context: '=',
+ templateUrl: '=',
+ leaveOpen: '=',
+ screenReaderOnly: '='
+ },
+ require: ['?^uiGrid', '^uiGridMenu'],
+ templateUrl: 'ui-grid/uiGridMenuItem',
+ replace: false,
+ compile: function($elm, $attrs) {
+ return {
+ pre: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0],
+ uiGridMenuCtrl = controllers[1];
+
+ if ($scope.templateUrl) {
+ gridUtil.getTemplate($scope.templateUrl)
+ .then(function (contents) {
+ var template = angular.element(contents);
+
+ var newElm = $compile(template)($scope);
+ $elm.replaceWith(newElm);
+ });
+ }
+ },
+ post: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0],
+ uiGridMenuCtrl = controllers[1];
+
+ // TODO(c0bra): validate that shown and active are functions if they're defined. An exception is already thrown above this though
+ // if (typeof($scope.shown) !== 'undefined' && $scope.shown && typeof($scope.shown) !== 'function') {
+ // throw new TypeError("$scope.shown is defined but not a function");
+ // }
+ if (typeof($scope.shown) === 'undefined' || $scope.shown === null) {
+ $scope.shown = function() { return true; };
+ }
+
+ $scope.itemShown = function () {
+ var context = {};
+ if ($scope.context) {
+ context.context = $scope.context;
+ }
+
+ if (typeof(uiGridCtrl) !== 'undefined' && uiGridCtrl) {
+ context.grid = uiGridCtrl.grid;
+ }
+
+ return $scope.shown.call(context);
+ };
+
+ $scope.itemAction = function($event,title) {
+ gridUtil.logDebug('itemAction');
+ $event.stopPropagation();
+
+ if (typeof($scope.action) === 'function') {
+ var context = {};
+
+ if ($scope.context) {
+ context.context = $scope.context;
+ }
+
+ // Add the grid to the function call context if the uiGrid controller is present
+ if (typeof(uiGridCtrl) !== 'undefined' && uiGridCtrl) {
+ context.grid = uiGridCtrl.grid;
+ }
+
+ $scope.action.call(context, $event, title);
+
+ if ( !$scope.leaveOpen ){
+ $scope.$emit('hide-menu');
+ } else {
+ /*
+ * XXX: Fix after column refactor
+ * Ideally the focus would remain on the item.
+ * However, since there are two menu items that have their 'show' property toggled instead. This is a quick fix.
+ */
+ gridUtil.focus.bySelector(angular.element(gridUtil.closestElm($elm, ".ui-grid-menu-items")), 'button[type=button]', true);
+ }
+ }
+ };
+
+ $scope.i18n = i18nService.get();
+ }
+ };
+ }
+ };
+
+ return uiGridMenuItem;
+}]);
+
+})();
+
+(function(){
+ 'use strict';
+ /**
+ * @ngdoc overview
+ * @name ui.grid.directive:uiGridOneBind
+ * @summary A group of directives that provide a one time bind to a dom element.
+ * @description A group of directives that provide a one time bind to a dom element.
+ * As one time bindings are not supported in Angular 1.2.* this directive provdes this capability.
+ * This is done to reduce the number of watchers on the dom.
+ * <br/>
+ * <h2>Short Example ({@link ui.grid.directive:uiGridOneBindSrc ui-grid-one-bind-src})</h2>
+ * <pre>
+ <div ng-init="imageName = 'myImageDir.jpg'">
+ <img ui-grid-one-bind-src="imageName"></img>
+ </div>
+ </pre>
+ * Will become:
+ * <pre>
+ <div ng-init="imageName = 'myImageDir.jpg'">
+ <img ui-grid-one-bind-src="imageName" src="myImageDir.jpg"></img>
+ </div>
+ </pre>
+ </br>
+ <h2>Short Example ({@link ui.grid.directive:uiGridOneBindText ui-grid-one-bind-text})</h2>
+ * <pre>
+ <div ng-init="text='Add this text'" ui-grid-one-bind-text="text"></div>
+ </pre>
+ * Will become:
+ * <pre>
+ <div ng-init="text='Add this text'" ui-grid-one-bind-text="text">Add this text</div>
+ </pre>
+ </br>
+ * <b>Note:</b> This behavior is slightly different for the {@link ui.grid.directive:uiGridOneBindIdGrid uiGridOneBindIdGrid}
+ * and {@link ui.grid.directive:uiGridOneBindAriaLabelledbyGrid uiGridOneBindAriaLabelledbyGrid} directives.
+ *
+ */
+ //https://github.com/joshkurz/Black-Belt-AngularJS-Directives/blob/master/directives/Optimization/oneBind.js
+ var oneBinders = angular.module('ui.grid');
+ angular.forEach([
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindSrc
+ * @memberof ui.grid.directive:uiGridOneBind
+ * @element img
+ * @restrict A
+ * @param {String} uiGridOneBindSrc The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the src dom tag.
+ *
+ */
+ {tag: 'Src', method: 'attr'},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindText
+ * @element div
+ * @restrict A
+ * @param {String} uiGridOneBindText The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the text dom tag.
+ */
+ {tag: 'Text', method: 'text'},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindHref
+ * @element div
+ * @restrict A
+ * @param {String} uiGridOneBindHref The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the href dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
+ */
+ {tag: 'Href', method: 'attr'},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindClass
+ * @element div
+ * @restrict A
+ * @param {String} uiGridOneBindClass The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @param {Object} uiGridOneBindClass The object that you want to bind. At least one of the values in the object must be something other than null or undefined for the watcher to be removed.
+ * this is to prevent the watcher from being removed before the scope is initialized.
+ * @param {Array} uiGridOneBindClass An array of classes to bind to this element.
+ * @description One time binding for the class dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
+ */
+ {tag: 'Class', method: 'addClass'},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindHtml
+ * @element div
+ * @restrict A
+ * @param {String} uiGridOneBindHtml The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the html method on a dom element. For more information see {@link ui.grid.directive:uiGridOneBind}.
+ */
+ {tag: 'Html', method: 'html'},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindAlt
+ * @element div
+ * @restrict A
+ * @param {String} uiGridOneBindAlt The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the alt dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
+ */
+ {tag: 'Alt', method: 'attr'},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindStyle
+ * @element div
+ * @restrict A
+ * @param {String} uiGridOneBindStyle The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the style dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
+ */
+ {tag: 'Style', method: 'css'},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindValue
+ * @element div
+ * @restrict A
+ * @param {String} uiGridOneBindValue The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the value dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
+ */
+ {tag: 'Value', method: 'attr'},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindId
+ * @element div
+ * @restrict A
+ * @param {String} uiGridOneBindId The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the value dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
+ */
+ {tag: 'Id', method: 'attr'},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindIdGrid
+ * @element div
+ * @restrict A
+ * @param {String} uiGridOneBindIdGrid The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the id dom tag.
+ * <h1>Important Note!</h1>
+ * If the id tag passed as a parameter does <b>not</b> contain the grid id as a substring
+ * then the directive will search the scope and the parent controller (if it is a uiGridController) for the grid.id value.
+ * If this value is found then it is appended to the begining of the id tag. If the grid is not found then the directive throws an error.
+ * This is done in order to ensure uniqueness of id tags across the grid.
+ * This is to prevent two grids in the same document having duplicate id tags.
+ */
+ {tag: 'Id', directiveName:'IdGrid', method: 'attr', appendGridId: true},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindTitle
+ * @element div
+ * @restrict A
+ * @param {String} uiGridOneBindTitle The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the title dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
+ */
+ {tag: 'Title', method: 'attr'},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindAriaLabel
+ * @element div
+ * @restrict A
+ * @param {String} uiGridOneBindAriaLabel The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the aria-label dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
+ *<br/>
+ * <pre>
+ <div ng-init="text='Add this text'" ui-grid-one-bind-aria-label="text"></div>
+ </pre>
+ * Will become:
+ * <pre>
+ <div ng-init="text='Add this text'" ui-grid-one-bind-aria-label="text" aria-label="Add this text"></div>
+ </pre>
+ */
+ {tag: 'Label', method: 'attr', aria:true},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindAriaLabelledby
+ * @element div
+ * @restrict A
+ * @param {String} uiGridOneBindAriaLabelledby The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the aria-labelledby dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
+ *<br/>
+ * <pre>
+ <div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-labelledby="anId"></div>
+ </pre>
+ * Will become:
+ * <pre>
+ <div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-labelledby="anId" aria-labelledby="gridID32"></div>
+ </pre>
+ */
+ {tag: 'Labelledby', method: 'attr', aria:true},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindAriaLabelledbyGrid
+ * @element div
+ * @restrict A
+ * @param {String} uiGridOneBindAriaLabelledbyGrid The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the aria-labelledby dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
+ * Works somewhat like {@link ui.grid.directive:uiGridOneBindIdGrid} however this one supports a list of ids (seperated by a space) and will dynamically add the
+ * grid id to each one.
+ *<br/>
+ * <pre>
+ <div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-labelledby-grid="anId"></div>
+ </pre>
+ * Will become ([grid.id] will be replaced by the actual grid id):
+ * <pre>
+ <div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-labelledby-grid="anId" aria-labelledby-Grid="[grid.id]-gridID32"></div>
+ </pre>
+ */
+ {tag: 'Labelledby', directiveName:'LabelledbyGrid', appendGridId:true, method: 'attr', aria:true},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindAriaDescribedby
+ * @element ANY
+ * @restrict A
+ * @param {String} uiGridOneBindAriaDescribedby The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the aria-describedby dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
+ *<br/>
+ * <pre>
+ <div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-describedby="anId"></div>
+ </pre>
+ * Will become:
+ * <pre>
+ <div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-describedby="anId" aria-describedby="gridID32"></div>
+ </pre>
+ */
+ {tag: 'Describedby', method: 'attr', aria:true},
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridOneBindAriaDescribedbyGrid
+ * @element ANY
+ * @restrict A
+ * @param {String} uiGridOneBindAriaDescribedbyGrid The angular string you want to bind. Does not support interpolation. Don't use <code>{{scopeElt}}</code> instead use <code>scopeElt</code>.
+ * @description One time binding for the aria-labelledby dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}.
+ * Works somewhat like {@link ui.grid.directive:uiGridOneBindIdGrid} however this one supports a list of ids (seperated by a space) and will dynamically add the
+ * grid id to each one.
+ *<br/>
+ * <pre>
+ <div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-describedby-grid="anId"></div>
+ </pre>
+ * Will become ([grid.id] will be replaced by the actual grid id):
+ * <pre>
+ <div ng-init="anId = 'gridID32'" ui-grid-one-bind-aria-describedby-grid="anId" aria-describedby="[grid.id]-gridID32"></div>
+ </pre>
+ */
+ {tag: 'Describedby', directiveName:'DescribedbyGrid', appendGridId:true, method: 'attr', aria:true}],
+ function(v){
+
+ var baseDirectiveName = 'uiGridOneBind';
+ //If it is an aria tag then append the aria label seperately
+ //This is done because the aria tags are formatted aria-* and the directive name can't have a '-' character in it.
+ //If the diretiveName has to be overridden then it does so here. This is because the tag being modified and the directive sometimes don't match up.
+ var directiveName = (v.aria ? baseDirectiveName + 'Aria' : baseDirectiveName) + (v.directiveName ? v.directiveName : v.tag);
+ oneBinders.directive(directiveName, ['gridUtil', function(gridUtil){
+ return {
+ restrict: 'A',
+ require: ['?uiGrid','?^uiGrid'],
+ link: function(scope, iElement, iAttrs, controllers){
+ /* Appends the grid id to the beginnig of the value. */
+ var appendGridId = function(val){
+ var grid; //Get an instance of the grid if its available
+ //If its available in the scope then we don't need to try to find it elsewhere
+ if (scope.grid) {
+ grid = scope.grid;
+ }
+ //Another possible location to try to find the grid
+ else if (scope.col && scope.col.grid){
+ grid = scope.col.grid;
+ }
+ //Last ditch effort: Search through the provided controllers.
+ else if (!controllers.some( //Go through the controllers till one has the element we need
+ function(controller){
+ if (controller && controller.grid) {
+ grid = controller.grid;
+ return true; //We've found the grid
+ }
+ })){
+ //We tried our best to find it for you
+ gridUtil.logError("["+directiveName+"] A valid grid could not be found to bind id. Are you using this directive " +
+ "within the correct scope? Trying to generate id: [gridID]-" + val);
+ throw new Error("No valid grid could be found");
+ }
+
+ if (grid){
+ var idRegex = new RegExp(grid.id.toString());
+ //If the grid id hasn't been appended already in the template declaration
+ if (!idRegex.test(val)){
+ val = grid.id.toString() + '-' + val;
+ }
+ }
+ return val;
+ };
+
+ // The watch returns a function to remove itself.
+ var rmWatcher = scope.$watch(iAttrs[directiveName], function(newV){
+ if (newV){
+ //If we are trying to add an id element then we also apply the grid id if it isn't already there
+ if (v.appendGridId) {
+ var newIdString = null;
+ //Append the id to all of the new ids.
+ angular.forEach( newV.split(' '), function(s){
+ newIdString = (newIdString ? (newIdString + ' ') : '') + appendGridId(s);
+ });
+ newV = newIdString;
+ }
+
+ // Append this newValue to the dom element.
+ switch (v.method) {
+ case 'attr': //The attr method takes two paraams the tag and the value
+ if (v.aria) {
+ //If it is an aria element then append the aria prefix
+ iElement[v.method]('aria-' + v.tag.toLowerCase(),newV);
+ } else {
+ iElement[v.method](v.tag.toLowerCase(),newV);
+ }
+ break;
+ case 'addClass':
+ //Pulled from https://github.com/Pasvaz/bindonce/blob/master/bindonce.js
+ if (angular.isObject(newV) && !angular.isArray(newV)) {
+ var results = [];
+ var nonNullFound = false; //We don't want to remove the binding unless the key is actually defined
+ angular.forEach(newV, function (value, index) {
+ if (value !== null && typeof(value) !== "undefined"){
+ nonNullFound = true; //A non null value for a key was found so the object must have been initialized
+ if (value) {results.push(index);}
+ }
+ });
+ //A non null value for a key wasn't found so assume that the scope values haven't been fully initialized
+ if (!nonNullFound){
+ return; // If not initialized then the watcher should not be removed yet.
+ }
+ newV = results;
+ }
+
+ if (newV) {
+ iElement.addClass(angular.isArray(newV) ? newV.join(' ') : newV);
+ } else {
+ return;
+ }
+ break;
+ default:
+ iElement[v.method](newV);
+ break;
+ }
+
+ //Removes the watcher on itself after the bind
+ rmWatcher();
+ }
+ // True ensures that equality is determined using angular.equals instead of ===
+ }, true); //End rm watchers
+ } //End compile function
+ }; //End directive return
+ } // End directive function
+ ]); //End directive
+ }); // End angular foreach
+})();
+
+(function () {
+ 'use strict';
+
+ var module = angular.module('ui.grid');
+
+ module.directive('uiGridRenderContainer', ['$timeout', '$document', 'uiGridConstants', 'gridUtil', 'ScrollEvent',
+ function($timeout, $document, uiGridConstants, gridUtil, ScrollEvent) {
+ return {
+ replace: true,
+ transclude: true,
+ templateUrl: 'ui-grid/uiGridRenderContainer',
+ require: ['^uiGrid', 'uiGridRenderContainer'],
+ scope: {
+ containerId: '=',
+ rowContainerName: '=',
+ colContainerName: '=',
+ bindScrollHorizontal: '=',
+ bindScrollVertical: '=',
+ enableVerticalScrollbar: '=',
+ enableHorizontalScrollbar: '='
+ },
+ controller: 'uiGridRenderContainer as RenderContainer',
+ compile: function () {
+ return {
+ pre: function prelink($scope, $elm, $attrs, controllers) {
+
+ var uiGridCtrl = controllers[0];
+ var containerCtrl = controllers[1];
+ var grid = $scope.grid = uiGridCtrl.grid;
+
+ // Verify that the render container for this element exists
+ if (!$scope.rowContainerName) {
+ throw "No row render container name specified";
+ }
+ if (!$scope.colContainerName) {
+ throw "No column render container name specified";
+ }
+
+ if (!grid.renderContainers[$scope.rowContainerName]) {
+ throw "Row render container '" + $scope.rowContainerName + "' is not registered.";
+ }
+ if (!grid.renderContainers[$scope.colContainerName]) {
+ throw "Column render container '" + $scope.colContainerName + "' is not registered.";
+ }
+
+ var rowContainer = $scope.rowContainer = grid.renderContainers[$scope.rowContainerName];
+ var colContainer = $scope.colContainer = grid.renderContainers[$scope.colContainerName];
+
+ containerCtrl.containerId = $scope.containerId;
+ containerCtrl.rowContainer = rowContainer;
+ containerCtrl.colContainer = colContainer;
+ },
+ post: function postlink($scope, $elm, $attrs, controllers) {
+
+ var uiGridCtrl = controllers[0];
+ var containerCtrl = controllers[1];
+
+ var grid = uiGridCtrl.grid;
+ var rowContainer = containerCtrl.rowContainer;
+ var colContainer = containerCtrl.colContainer;
+ var scrollTop = null;
+ var scrollLeft = null;
+
+
+ var renderContainer = grid.renderContainers[$scope.containerId];
+
+ // Put the container name on this element as a class
+ $elm.addClass('ui-grid-render-container-' + $scope.containerId);
+
+ // Scroll the render container viewport when the mousewheel is used
+ gridUtil.on.mousewheel($elm, function (event) {
+ var scrollEvent = new ScrollEvent(grid, rowContainer, colContainer, ScrollEvent.Sources.RenderContainerMouseWheel);
+ if (event.deltaY !== 0) {
+ var scrollYAmount = event.deltaY * -1 * event.deltaFactor;
+
+ scrollTop = containerCtrl.viewport[0].scrollTop;
+
+ // Get the scroll percentage
+ scrollEvent.verticalScrollLength = rowContainer.getVerticalScrollLength();
+ var scrollYPercentage = (scrollTop + scrollYAmount) / scrollEvent.verticalScrollLength;
+
+ // If we should be scrolled 100%, make sure the scrollTop matches the maximum scroll length
+ // Viewports that have "overflow: hidden" don't let the mousewheel scroll all the way to the bottom without this check
+ if (scrollYPercentage >= 1 && scrollTop < scrollEvent.verticalScrollLength) {
+ containerCtrl.viewport[0].scrollTop = scrollEvent.verticalScrollLength;
+ }
+
+ // Keep scrollPercentage within the range 0-1.
+ if (scrollYPercentage < 0) { scrollYPercentage = 0; }
+ else if (scrollYPercentage > 1) { scrollYPercentage = 1; }
+
+ scrollEvent.y = { percentage: scrollYPercentage, pixels: scrollYAmount };
+ }
+ if (event.deltaX !== 0) {
+ var scrollXAmount = event.deltaX * event.deltaFactor;
+
+ // Get the scroll percentage
+ scrollLeft = gridUtil.normalizeScrollLeft(containerCtrl.viewport, grid);
+ scrollEvent.horizontalScrollLength = (colContainer.getCanvasWidth() - colContainer.getViewportWidth());
+ var scrollXPercentage = (scrollLeft + scrollXAmount) / scrollEvent.horizontalScrollLength;
+
+ // Keep scrollPercentage within the range 0-1.
+ if (scrollXPercentage < 0) { scrollXPercentage = 0; }
+ else if (scrollXPercentage > 1) { scrollXPercentage = 1; }
+
+ scrollEvent.x = { percentage: scrollXPercentage, pixels: scrollXAmount };
+ }
+
+ // Let the parent container scroll if the grid is already at the top/bottom
+ if ((event.deltaY !== 0 && (scrollEvent.atTop(scrollTop) || scrollEvent.atBottom(scrollTop))) ||
+ (event.deltaX !== 0 && (scrollEvent.atLeft(scrollLeft) || scrollEvent.atRight(scrollLeft)))) {
+ //parent controller scrolls
+ }
+ else {
+ event.preventDefault();
+ event.stopPropagation();
+ scrollEvent.fireThrottledScrollingEvent('', scrollEvent);
+ }
+
+ });
+
+ $elm.bind('$destroy', function() {
+ $elm.unbind('keydown');
+
+ ['touchstart', 'touchmove', 'touchend','keydown', 'wheel', 'mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'].forEach(function (eventName) {
+ $elm.unbind(eventName);
+ });
+ });
+
+ // TODO(c0bra): Handle resizing the inner canvas based on the number of elements
+ function update() {
+ var ret = '';
+
+ var canvasWidth = colContainer.canvasWidth;
+ var viewportWidth = colContainer.getViewportWidth();
+
+ var canvasHeight = rowContainer.getCanvasHeight();
+
+ //add additional height for scrollbar on left and right container
+ //if ($scope.containerId !== 'body') {
+ // canvasHeight -= grid.scrollbarHeight;
+ //}
+
+ var viewportHeight = rowContainer.getViewportHeight();
+ //shorten the height to make room for a scrollbar placeholder
+ if (colContainer.needsHScrollbarPlaceholder()) {
+ viewportHeight -= grid.scrollbarHeight;
+ }
+
+ var headerViewportWidth,
+ footerViewportWidth;
+ headerViewportWidth = footerViewportWidth = colContainer.getHeaderViewportWidth();
+
+ // Set canvas dimensions
+ ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-canvas { width: ' + canvasWidth + 'px; height: ' + canvasHeight + 'px; }';
+
+ ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-header-canvas { width: ' + (canvasWidth + grid.scrollbarWidth) + 'px; }';
+
+ if (renderContainer.explicitHeaderCanvasHeight) {
+ ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-header-canvas { height: ' + renderContainer.explicitHeaderCanvasHeight + 'px; }';
+ }
+ else {
+ ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-header-canvas { height: inherit; }';
+ }
+
+ ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-viewport { width: ' + viewportWidth + 'px; height: ' + viewportHeight + 'px; }';
+ ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-header-viewport { width: ' + headerViewportWidth + 'px; }';
+
+ ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-footer-canvas { width: ' + (canvasWidth + grid.scrollbarWidth) + 'px; }';
+ ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-footer-viewport { width: ' + footerViewportWidth + 'px; }';
+
+ return ret;
+ }
+
+ uiGridCtrl.grid.registerStyleComputation({
+ priority: 6,
+ func: update
+ });
+ }
+ };
+ }
+ };
+
+ }]);
+
+ module.controller('uiGridRenderContainer', ['$scope', 'gridUtil', function ($scope, gridUtil) {
+
+ }]);
+
+})();
+
+(function(){
+ 'use strict';
+
+ angular.module('ui.grid').directive('uiGridRow', ['gridUtil', function(gridUtil) {
+ return {
+ replace: true,
+ // priority: 2001,
+ // templateUrl: 'ui-grid/ui-grid-row',
+ require: ['^uiGrid', '^uiGridRenderContainer'],
+ scope: {
+ row: '=uiGridRow',
+ //rowRenderIndex is added to scope to give the true visual index of the row to any directives that need it
+ rowRenderIndex: '='
+ },
+ compile: function() {
+ return {
+ pre: function($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0];
+ var containerCtrl = controllers[1];
+
+ var grid = uiGridCtrl.grid;
+
+ $scope.grid = uiGridCtrl.grid;
+ $scope.colContainer = containerCtrl.colContainer;
+
+ // Function for attaching the template to this scope
+ var clonedElement, cloneScope;
+ function compileTemplate() {
+ $scope.row.getRowTemplateFn.then(function (compiledElementFn) {
+ // var compiledElementFn = $scope.row.compiledElementFn;
+
+ // Create a new scope for the contents of this row, so we can destroy it later if need be
+ var newScope = $scope.$new();
+
+ compiledElementFn(newScope, function (newElm, scope) {
+ // If we already have a cloned element, we need to remove it and destroy its scope
+ if (clonedElement) {
+ clonedElement.remove();
+ cloneScope.$destroy();
+ }
+
+ // Empty the row and append the new element
+ $elm.empty().append(newElm);
+
+ // Save the new cloned element and scope
+ clonedElement = newElm;
+ cloneScope = newScope;
+ });
+ });
+ }
+
+ // Initially attach the compiled template to this scope
+ compileTemplate();
+
+ // If the row's compiled element function changes, we need to replace this element's contents with the new compiled template
+ $scope.$watch('row.getRowTemplateFn', function (newFunc, oldFunc) {
+ if (newFunc !== oldFunc) {
+ compileTemplate();
+ }
+ });
+ },
+ post: function($scope, $elm, $attrs, controllers) {
+
+ }
+ };
+ }
+ };
+ }]);
+
+})();
+(function(){
+// 'use strict';
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGridStyle
+ * @element style
+ * @restrict A
+ *
+ * @description
+ * Allows us to interpolate expressions in `<style>` elements. Angular doesn't do this by default as it can/will/might? break in IE8.
+ *
+ * @example
+ <doc:example module="app">
+ <doc:source>
+ <script>
+ var app = angular.module('app', ['ui.grid']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.myStyle = '.blah { border: 1px solid }';
+ }]);
+ </script>
+
+ <div ng-controller="MainCtrl">
+ <style ui-grid-style>{{ myStyle }}</style>
+ <span class="blah">I am in a box.</span>
+ </div>
+ </doc:source>
+ <doc:scenario>
+ it('should apply the right class to the element', function () {
+ element(by.css('.blah')).getCssValue('border-top-width')
+ .then(function(c) {
+ expect(c).toContain('1px');
+ });
+ });
+ </doc:scenario>
+ </doc:example>
+ */
+
+
+ angular.module('ui.grid').directive('uiGridStyle', ['gridUtil', '$interpolate', function(gridUtil, $interpolate) {
+ return {
+ // restrict: 'A',
+ // priority: 1000,
+ // require: '?^uiGrid',
+ link: function($scope, $elm, $attrs, uiGridCtrl) {
+ // gridUtil.logDebug('ui-grid-style link');
+ // if (uiGridCtrl === undefined) {
+ // gridUtil.logWarn('[ui-grid-style link] uiGridCtrl is undefined!');
+ // }
+
+ var interpolateFn = $interpolate($elm.text(), true);
+
+ if (interpolateFn) {
+ $scope.$watch(interpolateFn, function(value) {
+ $elm.text(value);
+ });
+ }
+
+ // uiGridCtrl.recalcRowStyles = function() {
+ // var offset = (scope.options.offsetTop || 0) - (scope.options.excessRows * scope.options.rowHeight);
+ // var rowHeight = scope.options.rowHeight;
+
+ // var ret = '';
+ // var rowStyleCount = uiGridCtrl.minRowsToRender() + (scope.options.excessRows * 2);
+ // for (var i = 1; i <= rowStyleCount; i++) {
+ // ret = ret + ' .grid' + scope.gridId + ' .ui-grid-row:nth-child(' + i + ') { top: ' + offset + 'px; }';
+ // offset = offset + rowHeight;
+ // }
+
+ // scope.rowStyles = ret;
+ // };
+
+ // uiGridCtrl.styleComputions.push(uiGridCtrl.recalcRowStyles);
+
+ }
+ };
+ }]);
+
+})();
+
+(function(){
+ 'use strict';
+
+ angular.module('ui.grid').directive('uiGridViewport', ['gridUtil','ScrollEvent','uiGridConstants', '$log',
+ function(gridUtil, ScrollEvent, uiGridConstants, $log) {
+ return {
+ replace: true,
+ scope: {},
+ controllerAs: 'Viewport',
+ templateUrl: 'ui-grid/uiGridViewport',
+ require: ['^uiGrid', '^uiGridRenderContainer'],
+ link: function($scope, $elm, $attrs, controllers) {
+ // gridUtil.logDebug('viewport post-link');
+
+ var uiGridCtrl = controllers[0];
+ var containerCtrl = controllers[1];
+
+ $scope.containerCtrl = containerCtrl;
+
+ var rowContainer = containerCtrl.rowContainer;
+ var colContainer = containerCtrl.colContainer;
+
+ var grid = uiGridCtrl.grid;
+
+ $scope.grid = uiGridCtrl.grid;
+
+ // Put the containers in scope so we can get rows and columns from them
+ $scope.rowContainer = containerCtrl.rowContainer;
+ $scope.colContainer = containerCtrl.colContainer;
+
+ // Register this viewport with its container
+ containerCtrl.viewport = $elm;
+
+
+ $elm.on('scroll', scrollHandler);
+
+ var ignoreScroll = false;
+
+ function scrollHandler(evt) {
+ //Leaving in this commented code in case it can someday be used
+ //It does improve performance, but because the horizontal scroll is normalized,
+ // using this code will lead to the column header getting slightly out of line with columns
+ //
+ //if (ignoreScroll && (grid.isScrollingHorizontally || grid.isScrollingHorizontally)) {
+ // //don't ask for scrollTop if we just set it
+ // ignoreScroll = false;
+ // return;
+ //}
+ //ignoreScroll = true;
+
+ var newScrollTop = $elm[0].scrollTop;
+ var newScrollLeft = gridUtil.normalizeScrollLeft($elm, grid);
+
+ var vertScrollPercentage = rowContainer.scrollVertical(newScrollTop);
+ var horizScrollPercentage = colContainer.scrollHorizontal(newScrollLeft);
+
+ var scrollEvent = new ScrollEvent(grid, rowContainer, colContainer, ScrollEvent.Sources.ViewPortScroll);
+ scrollEvent.newScrollLeft = newScrollLeft;
+ scrollEvent.newScrollTop = newScrollTop;
+ if ( horizScrollPercentage > -1 ){
+ scrollEvent.x = { percentage: horizScrollPercentage };
+ }
+
+ if ( vertScrollPercentage > -1 ){
+ scrollEvent.y = { percentage: vertScrollPercentage };
+ }
+
+ grid.scrollContainers($scope.$parent.containerId, scrollEvent);
+ }
+
+ if ($scope.$parent.bindScrollVertical) {
+ grid.addVerticalScrollSync($scope.$parent.containerId, syncVerticalScroll);
+ }
+
+ if ($scope.$parent.bindScrollHorizontal) {
+ grid.addHorizontalScrollSync($scope.$parent.containerId, syncHorizontalScroll);
+ grid.addHorizontalScrollSync($scope.$parent.containerId + 'header', syncHorizontalHeader);
+ grid.addHorizontalScrollSync($scope.$parent.containerId + 'footer', syncHorizontalFooter);
+ }
+
+ function syncVerticalScroll(scrollEvent){
+ containerCtrl.prevScrollArgs = scrollEvent;
+ var newScrollTop = scrollEvent.getNewScrollTop(rowContainer,containerCtrl.viewport);
+ $elm[0].scrollTop = newScrollTop;
+
+ }
+
+ function syncHorizontalScroll(scrollEvent){
+ containerCtrl.prevScrollArgs = scrollEvent;
+ var newScrollLeft = scrollEvent.getNewScrollLeft(colContainer, containerCtrl.viewport);
+ $elm[0].scrollLeft = gridUtil.denormalizeScrollLeft(containerCtrl.viewport,newScrollLeft, grid);
+ }
+
+ function syncHorizontalHeader(scrollEvent){
+ var newScrollLeft = scrollEvent.getNewScrollLeft(colContainer, containerCtrl.viewport);
+ if (containerCtrl.headerViewport) {
+ containerCtrl.headerViewport.scrollLeft = gridUtil.denormalizeScrollLeft(containerCtrl.viewport,newScrollLeft, grid);
+ }
+ }
+
+ function syncHorizontalFooter(scrollEvent){
+ var newScrollLeft = scrollEvent.getNewScrollLeft(colContainer, containerCtrl.viewport);
+ if (containerCtrl.footerViewport) {
+ containerCtrl.footerViewport.scrollLeft = gridUtil.denormalizeScrollLeft(containerCtrl.viewport,newScrollLeft, grid);
+ }
+ }
+
+
+ },
+ controller: ['$scope', function ($scope) {
+ this.rowStyle = function (index) {
+ var rowContainer = $scope.rowContainer;
+ var colContainer = $scope.colContainer;
+
+ var styles = {};
+
+ if (index === 0 && rowContainer.currentTopRow !== 0) {
+ // The row offset-top is just the height of the rows above the current top-most row, which are no longer rendered
+ var hiddenRowWidth = (rowContainer.currentTopRow) * rowContainer.grid.options.rowHeight;
+
+ // return { 'margin-top': hiddenRowWidth + 'px' };
+ styles['margin-top'] = hiddenRowWidth + 'px';
+ }
+
+ if (colContainer.currentFirstColumn !== 0) {
+ if (colContainer.grid.isRTL()) {
+ styles['margin-right'] = colContainer.columnOffset + 'px';
+ }
+ else {
+ styles['margin-left'] = colContainer.columnOffset + 'px';
+ }
+ }
+
+ return styles;
+ };
+ }]
+ };
+ }
+ ]);
+
+})();
+
+(function() {
+
+angular.module('ui.grid')
+.directive('uiGridVisible', function uiGridVisibleAction() {
+ return function ($scope, $elm, $attr) {
+ $scope.$watch($attr.uiGridVisible, function (visible) {
+ // $elm.css('visibility', visible ? 'visible' : 'hidden');
+ $elm[visible ? 'removeClass' : 'addClass']('ui-grid-invisible');
+ });
+ };
+});
+
+})();
+(function () {
+ 'use strict';
+
+ angular.module('ui.grid').controller('uiGridController', ['$scope', '$element', '$attrs', 'gridUtil', '$q', 'uiGridConstants',
+ '$templateCache', 'gridClassFactory', '$timeout', '$parse', '$compile',
+ function ($scope, $elm, $attrs, gridUtil, $q, uiGridConstants,
+ $templateCache, gridClassFactory, $timeout, $parse, $compile) {
+ // gridUtil.logDebug('ui-grid controller');
+
+ var self = this;
+
+ self.grid = gridClassFactory.createGrid($scope.uiGrid);
+
+ //assign $scope.$parent if appScope not already assigned
+ self.grid.appScope = self.grid.appScope || $scope.$parent;
+
+ $elm.addClass('grid' + self.grid.id);
+ self.grid.rtl = gridUtil.getStyles($elm[0])['direction'] === 'rtl';
+
+
+ // angular.extend(self.grid.options, );
+
+ //all properties of grid are available on scope
+ $scope.grid = self.grid;
+
+ if ($attrs.uiGridColumns) {
+ $attrs.$observe('uiGridColumns', function(value) {
+ self.grid.options.columnDefs = value;
+ self.grid.buildColumns()
+ .then(function(){
+ self.grid.preCompileCellTemplates();
+
+ self.grid.refreshCanvas(true);
+ });
+ });
+ }
+
+
+ // if fastWatch is set we watch only the length and the reference, not every individual object
+ var deregFunctions = [];
+ if (self.grid.options.fastWatch) {
+ self.uiGrid = $scope.uiGrid;
+ if (angular.isString($scope.uiGrid.data)) {
+ deregFunctions.push( $scope.$parent.$watch($scope.uiGrid.data, dataWatchFunction) );
+ deregFunctions.push( $scope.$parent.$watch(function() {
+ if ( self.grid.appScope[$scope.uiGrid.data] ){
+ return self.grid.appScope[$scope.uiGrid.data].length;
+ } else {
+ return undefined;
+ }
+ }, dataWatchFunction) );
+ } else {
+ deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.data; }, dataWatchFunction) );
+ deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.data.length; }, dataWatchFunction) );
+ }
+ deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.columnDefs; }, columnDefsWatchFunction) );
+ deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.columnDefs.length; }, columnDefsWatchFunction) );
+ } else {
+ if (angular.isString($scope.uiGrid.data)) {
+ deregFunctions.push( $scope.$parent.$watchCollection($scope.uiGrid.data, dataWatchFunction) );
+ } else {
+ deregFunctions.push( $scope.$parent.$watchCollection(function() { return $scope.uiGrid.data; }, dataWatchFunction) );
+ }
+ deregFunctions.push( $scope.$parent.$watchCollection(function() { return $scope.uiGrid.columnDefs; }, columnDefsWatchFunction) );
+ }
+
+
+ function columnDefsWatchFunction(n, o) {
+ if (n && n !== o) {
+ self.grid.options.columnDefs = n;
+ self.grid.buildColumns({ orderByColumnDefs: true })
+ .then(function(){
+
+ self.grid.preCompileCellTemplates();
+
+ self.grid.callDataChangeCallbacks(uiGridConstants.dataChange.COLUMN);
+ });
+ }
+ }
+
+ function dataWatchFunction(newData) {
+ // gridUtil.logDebug('dataWatch fired');
+ var promises = [];
+
+ if ( self.grid.options.fastWatch ){
+ if (angular.isString($scope.uiGrid.data)) {
+ newData = self.grid.appScope[$scope.uiGrid.data];
+ } else {
+ newData = $scope.uiGrid.data;
+ }
+ }
+
+ if (newData) {
+ // columns length is greater than the number of row header columns, which don't count because they're created automatically
+ var hasColumns = self.grid.columns.length > (self.grid.rowHeaderColumns ? self.grid.rowHeaderColumns.length : 0);
+
+ if (
+ // If we have no columns
+ !hasColumns &&
+ // ... and we don't have a ui-grid-columns attribute, which would define columns for us
+ !$attrs.uiGridColumns &&
+ // ... and we have no pre-defined columns
+ self.grid.options.columnDefs.length === 0 &&
+ // ... but we DO have data
+ newData.length > 0
+ ) {
+ // ... then build the column definitions from the data that we have
+ self.grid.buildColumnDefsFromData(newData);
+ }
+
+ // If we haven't built columns before and either have some columns defined or some data defined
+ if (!hasColumns && (self.grid.options.columnDefs.length > 0 || newData.length > 0)) {
+ // Build the column set, then pre-compile the column cell templates
+ promises.push(self.grid.buildColumns()
+ .then(function() {
+ self.grid.preCompileCellTemplates();
+ }));
+ }
+
+ $q.all(promises).then(function() {
+ self.grid.modifyRows(newData)
+ .then(function () {
+ // if (self.viewport) {
+ self.grid.redrawInPlace(true);
+ // }
+
+ $scope.$evalAsync(function() {
+ self.grid.refreshCanvas(true);
+ self.grid.callDataChangeCallbacks(uiGridConstants.dataChange.ROW);
+ });
+ });
+ });
+ }
+ }
+
+ var styleWatchDereg = $scope.$watch(function () { return self.grid.styleComputations; }, function() {
+ self.grid.refreshCanvas(true);
+ });
+
+ $scope.$on('$destroy', function() {
+ deregFunctions.forEach( function( deregFn ){ deregFn(); });
+ styleWatchDereg();
+ });
+
+ self.fireEvent = function(eventName, args) {
+ // Add the grid to the event arguments if it's not there
+ if (typeof(args) === 'undefined' || args === undefined) {
+ args = {};
+ }
+
+ if (typeof(args.grid) === 'undefined' || args.grid === undefined) {
+ args.grid = self.grid;
+ }
+
+ $scope.$broadcast(eventName, args);
+ };
+
+ self.innerCompile = function innerCompile(elm) {
+ $compile(elm)($scope);
+ };
+
+ }]);
+
+/**
+ * @ngdoc directive
+ * @name ui.grid.directive:uiGrid
+ * @element div
+ * @restrict EA
+ * @param {Object} uiGrid Options for the grid to use
+ *
+ * @description Create a very basic grid.
+ *
+ * @example
+ <example module="app">
+ <file name="app.js">
+ var app = angular.module('app', ['ui.grid']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.data = [
+ { name: 'Bob', title: 'CEO' },
+ { name: 'Frank', title: 'Lowly Developer' }
+ ];
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <div ui-grid="{ data: data }"></div>
+ </div>
+ </file>
+ </example>
+ */
+angular.module('ui.grid').directive('uiGrid', uiGridDirective);
+
+uiGridDirective.$inject = ['$compile', '$templateCache', '$timeout', '$window', 'gridUtil', 'uiGridConstants'];
+function uiGridDirective($compile, $templateCache, $timeout, $window, gridUtil, uiGridConstants) {
+ return {
+ templateUrl: 'ui-grid/ui-grid',
+ scope: {
+ uiGrid: '='
+ },
+ replace: true,
+ transclude: true,
+ controller: 'uiGridController',
+ compile: function () {
+ return {
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ var grid = uiGridCtrl.grid;
+ // Initialize scrollbars (TODO: move to controller??)
+ uiGridCtrl.scrollbars = [];
+ grid.element = $elm;
+
+
+ // See if the grid has a rendered width, if not, wait a bit and try again
+ var sizeCheckInterval = 100; // ms
+ var maxSizeChecks = 20; // 2 seconds total
+ var sizeChecks = 0;
+
+ // Setup (event listeners) the grid
+ setup();
+
+ // And initialize it
+ init();
+
+ // Mark rendering complete so API events can happen
+ grid.renderingComplete();
+
+ // If the grid doesn't have size currently, wait for a bit to see if it gets size
+ checkSize();
+
+ /*-- Methods --*/
+
+ function checkSize() {
+ // If the grid has no width and we haven't checked more than <maxSizeChecks> times, check again in <sizeCheckInterval> milliseconds
+ if ($elm[0].offsetWidth <= 0 && sizeChecks < maxSizeChecks) {
+ setTimeout(checkSize, sizeCheckInterval);
+ sizeChecks++;
+ }
+ else {
+ $timeout(init);
+ }
+ }
+
+ // Setup event listeners and watchers
+ function setup() {
+ // Bind to window resize events
+ angular.element($window).on('resize', gridResize);
+
+ // Unbind from window resize events when the grid is destroyed
+ $elm.on('$destroy', function () {
+ angular.element($window).off('resize', gridResize);
+ });
+
+ // If we add a left container after render, we need to watch and react
+ $scope.$watch(function () { return grid.hasLeftContainer();}, function (newValue, oldValue) {
+ if (newValue === oldValue) {
+ return;
+ }
+ grid.refreshCanvas(true);
+ });
+
+ // If we add a right container after render, we need to watch and react
+ $scope.$watch(function () { return grid.hasRightContainer();}, function (newValue, oldValue) {
+ if (newValue === oldValue) {
+ return;
+ }
+ grid.refreshCanvas(true);
+ });
+ }
+
+ // Initialize the directive
+ function init() {
+ grid.gridWidth = $scope.gridWidth = gridUtil.elementWidth($elm);
+
+ // Default canvasWidth to the grid width, in case we don't get any column definitions to calculate it from
+ grid.canvasWidth = uiGridCtrl.grid.gridWidth;
+
+ grid.gridHeight = $scope.gridHeight = gridUtil.elementHeight($elm);
+
+ // If the grid isn't tall enough to fit a single row, it's kind of useless. Resize it to fit a minimum number of rows
+ if (grid.gridHeight < grid.options.rowHeight && grid.options.enableMinHeightCheck) {
+ autoAdjustHeight();
+ }
+
+ // Run initial canvas refresh
+ grid.refreshCanvas(true);
+ }
+
+ // Set the grid's height ourselves in the case that its height would be unusably small
+ function autoAdjustHeight() {
+ // Figure out the new height
+ var contentHeight = grid.options.minRowsToShow * grid.options.rowHeight;
+ var headerHeight = grid.options.showHeader ? grid.options.headerRowHeight : 0;
+ var footerHeight = grid.calcFooterHeight();
+
+ var scrollbarHeight = 0;
+ if (grid.options.enableHorizontalScrollbar === uiGridConstants.scrollbars.ALWAYS) {
+ scrollbarHeight = gridUtil.getScrollbarWidth();
+ }
+
+ var maxNumberOfFilters = 0;
+ // Calculates the maximum number of filters in the columns
+ angular.forEach(grid.options.columnDefs, function(col) {
+ if (col.hasOwnProperty('filter')) {
+ if (maxNumberOfFilters < 1) {
+ maxNumberOfFilters = 1;
+ }
+ }
+ else if (col.hasOwnProperty('filters')) {
+ if (maxNumberOfFilters < col.filters.length) {
+ maxNumberOfFilters = col.filters.length;
+ }
+ }
+ });
+
+ if (grid.options.enableFiltering) {
+ var allColumnsHaveFilteringTurnedOff = grid.options.columnDefs.every(function(col) {
+ return col.enableFiltering === false;
+ });
+
+ if (!allColumnsHaveFilteringTurnedOff) {
+ maxNumberOfFilters++;
+ }
+ }
+
+ var filterHeight = maxNumberOfFilters * headerHeight;
+
+ var newHeight = headerHeight + contentHeight + footerHeight + scrollbarHeight + filterHeight;
+
+ $elm.css('height', newHeight + 'px');
+
+ grid.gridHeight = $scope.gridHeight = gridUtil.elementHeight($elm);
+ }
+
+ // Resize the grid on window resize events
+ function gridResize($event) {
+ grid.gridWidth = $scope.gridWidth = gridUtil.elementWidth($elm);
+ grid.gridHeight = $scope.gridHeight = gridUtil.elementHeight($elm);
+
+ grid.refreshCanvas(true);
+ }
+ }
+ };
+ }
+ };
+}
+
+})();
+
+(function(){
+ 'use strict';
+
+ // TODO: rename this file to ui-grid-pinned-container.js
+
+ angular.module('ui.grid').directive('uiGridPinnedContainer', ['gridUtil', function (gridUtil) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ template: '<div class="ui-grid-pinned-container"><div ui-grid-render-container container-id="side" row-container-name="\'body\'" col-container-name="side" bind-scroll-vertical="true" class="{{ side }} ui-grid-render-container-{{ side }}"></div></div>',
+ scope: {
+ side: '=uiGridPinnedContainer'
+ },
+ require: '^uiGrid',
+ compile: function compile() {
+ return {
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ // gridUtil.logDebug('ui-grid-pinned-container ' + $scope.side + ' link');
+
+ var grid = uiGridCtrl.grid;
+
+ var myWidth = 0;
+
+ $elm.addClass('ui-grid-pinned-container-' + $scope.side);
+
+ // Monkey-patch the viewport width function
+ if ($scope.side === 'left' || $scope.side === 'right') {
+ grid.renderContainers[$scope.side].getViewportWidth = monkeyPatchedGetViewportWidth;
+ }
+
+ function monkeyPatchedGetViewportWidth() {
+ /*jshint validthis: true */
+ var self = this;
+
+ var viewportWidth = 0;
+ self.visibleColumnCache.forEach(function (column) {
+ viewportWidth += column.drawnWidth;
+ });
+
+ var adjustment = self.getViewportAdjustment();
+
+ viewportWidth = viewportWidth + adjustment.width;
+
+ return viewportWidth;
+ }
+
+ function updateContainerWidth() {
+ if ($scope.side === 'left' || $scope.side === 'right') {
+ var cols = grid.renderContainers[$scope.side].visibleColumnCache;
+ var width = 0;
+ for (var i = 0; i < cols.length; i++) {
+ var col = cols[i];
+ width += col.drawnWidth || col.width || 0;
+ }
+
+ return width;
+ }
+ }
+
+ function updateContainerDimensions() {
+ var ret = '';
+
+ // Column containers
+ if ($scope.side === 'left' || $scope.side === 'right') {
+ myWidth = updateContainerWidth();
+
+ // gridUtil.logDebug('myWidth', myWidth);
+
+ // TODO(c0bra): Subtract sum of col widths from grid viewport width and update it
+ $elm.attr('style', null);
+
+ // var myHeight = grid.renderContainers.body.getViewportHeight(); // + grid.horizontalScrollbarHeight;
+
+ ret += '.grid' + grid.id + ' .ui-grid-pinned-container-' + $scope.side + ', .grid' + grid.id + ' .ui-grid-pinned-container-' + $scope.side + ' .ui-grid-render-container-' + $scope.side + ' .ui-grid-viewport { width: ' + myWidth + 'px; } ';
+ }
+
+ return ret;
+ }
+
+ grid.renderContainers.body.registerViewportAdjuster(function (adjustment) {
+ myWidth = updateContainerWidth();
+
+ // Subtract our own width
+ adjustment.width -= myWidth;
+ adjustment.side = $scope.side;
+
+ return adjustment;
+ });
+
+ // Register style computation to adjust for columns in `side`'s render container
+ grid.registerStyleComputation({
+ priority: 15,
+ func: updateContainerDimensions
+ });
+ }
+ };
+ }
+ };
+ }]);
+})();
+
+(function(){
+
+angular.module('ui.grid')
+.factory('Grid', ['$q', '$compile', '$parse', 'gridUtil', 'uiGridConstants', 'GridOptions', 'GridColumn', 'GridRow', 'GridApi', 'rowSorter', 'rowSearcher', 'GridRenderContainer', '$timeout','ScrollEvent',
+ function($q, $compile, $parse, gridUtil, uiGridConstants, GridOptions, GridColumn, GridRow, GridApi, rowSorter, rowSearcher, GridRenderContainer, $timeout, ScrollEvent) {
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.core.api:PublicApi
+ * @description Public Api for the core grid features
+ *
+ */
+
+ /**
+ * @ngdoc function
+ * @name ui.grid.class:Grid
+ * @description Grid is the main viewModel. Any properties or methods needed to maintain state are defined in
+ * this prototype. One instance of Grid is created per Grid directive instance.
+ * @param {object} options Object map of options to pass into the grid. An 'id' property is expected.
+ */
+ var Grid = function Grid(options) {
+ var self = this;
+ // Get the id out of the options, then remove it
+ if (options !== undefined && typeof(options.id) !== 'undefined' && options.id) {
+ if (!/^[_a-zA-Z0-9-]+$/.test(options.id)) {
+ throw new Error("Grid id '" + options.id + '" is invalid. It must follow CSS selector syntax rules.');
+ }
+ }
+ else {
+ throw new Error('No ID provided. An ID must be given when creating a grid.');
+ }
+
+ self.id = options.id;
+ delete options.id;
+
+ // Get default options
+ self.options = GridOptions.initialize( options );
+
+ /**
+ * @ngdoc object
+ * @name appScope
+ * @propertyOf ui.grid.class:Grid
+ * @description reference to the application scope (the parent scope of the ui-grid element). Assigned in ui-grid controller
+ * <br/>
+ * use gridOptions.appScopeProvider to override the default assignment of $scope.$parent with any reference
+ */
+ self.appScope = self.options.appScopeProvider;
+
+ self.headerHeight = self.options.headerRowHeight;
+
+
+ /**
+ * @ngdoc object
+ * @name footerHeight
+ * @propertyOf ui.grid.class:Grid
+ * @description returns the total footer height gridFooter + columnFooter
+ */
+ self.footerHeight = self.calcFooterHeight();
+
+
+ /**
+ * @ngdoc object
+ * @name columnFooterHeight
+ * @propertyOf ui.grid.class:Grid
+ * @description returns the total column footer height
+ */
+ self.columnFooterHeight = self.calcColumnFooterHeight();
+
+ self.rtl = false;
+ self.gridHeight = 0;
+ self.gridWidth = 0;
+ self.columnBuilders = [];
+ self.rowBuilders = [];
+ self.rowsProcessors = [];
+ self.columnsProcessors = [];
+ self.styleComputations = [];
+ self.viewportAdjusters = [];
+ self.rowHeaderColumns = [];
+ self.dataChangeCallbacks = {};
+ self.verticalScrollSyncCallBackFns = {};
+ self.horizontalScrollSyncCallBackFns = {};
+
+ // self.visibleRowCache = [];
+
+ // Set of 'render' containers for self grid, which can render sets of rows
+ self.renderContainers = {};
+
+ // Create a
+ self.renderContainers.body = new GridRenderContainer('body', self);
+
+ self.cellValueGetterCache = {};
+
+ // Cached function to use with custom row templates
+ self.getRowTemplateFn = null;
+
+
+ //representation of the rows on the grid.
+ //these are wrapped references to the actual data rows (options.data)
+ self.rows = [];
+
+ //represents the columns on the grid
+ self.columns = [];
+
+ /**
+ * @ngdoc boolean
+ * @name isScrollingVertically
+ * @propertyOf ui.grid.class:Grid
+ * @description set to true when Grid is scrolling vertically. Set to false via debounced method
+ */
+ self.isScrollingVertically = false;
+
+ /**
+ * @ngdoc boolean
+ * @name isScrollingHorizontally
+ * @propertyOf ui.grid.class:Grid
+ * @description set to true when Grid is scrolling horizontally. Set to false via debounced method
+ */
+ self.isScrollingHorizontally = false;
+
+ /**
+ * @ngdoc property
+ * @name scrollDirection
+ * @propertyOf ui.grid.class:Grid
+ * @description set one of the uiGridConstants.scrollDirection values (UP, DOWN, LEFT, RIGHT, NONE), which tells
+ * us which direction we are scrolling. Set to NONE via debounced method
+ */
+ self.scrollDirection = uiGridConstants.scrollDirection.NONE;
+
+ //if true, grid will not respond to any scroll events
+ self.disableScrolling = false;
+
+
+ function vertical (scrollEvent) {
+ self.isScrollingVertically = false;
+ self.api.core.raise.scrollEnd(scrollEvent);
+ self.scrollDirection = uiGridConstants.scrollDirection.NONE;
+ }
+
+ var debouncedVertical = gridUtil.debounce(vertical, self.options.scrollDebounce);
+ var debouncedVerticalMinDelay = gridUtil.debounce(vertical, 0);
+
+ function horizontal (scrollEvent) {
+ self.isScrollingHorizontally = false;
+ self.api.core.raise.scrollEnd(scrollEvent);
+ self.scrollDirection = uiGridConstants.scrollDirection.NONE;
+ }
+
+ var debouncedHorizontal = gridUtil.debounce(horizontal, self.options.scrollDebounce);
+ var debouncedHorizontalMinDelay = gridUtil.debounce(horizontal, 0);
+
+
+ /**
+ * @ngdoc function
+ * @name flagScrollingVertically
+ * @methodOf ui.grid.class:Grid
+ * @description sets isScrollingVertically to true and sets it to false in a debounced function
+ */
+ self.flagScrollingVertically = function(scrollEvent) {
+ if (!self.isScrollingVertically && !self.isScrollingHorizontally) {
+ self.api.core.raise.scrollBegin(scrollEvent);
+ }
+ self.isScrollingVertically = true;
+ if (self.options.scrollDebounce === 0 || !scrollEvent.withDelay) {
+ debouncedVerticalMinDelay(scrollEvent);
+ }
+ else {
+ debouncedVertical(scrollEvent);
+ }
+ };
+
+ /**
+ * @ngdoc function
+ * @name flagScrollingHorizontally
+ * @methodOf ui.grid.class:Grid
+ * @description sets isScrollingHorizontally to true and sets it to false in a debounced function
+ */
+ self.flagScrollingHorizontally = function(scrollEvent) {
+ if (!self.isScrollingVertically && !self.isScrollingHorizontally) {
+ self.api.core.raise.scrollBegin(scrollEvent);
+ }
+ self.isScrollingHorizontally = true;
+ if (self.options.scrollDebounce === 0 || !scrollEvent.withDelay) {
+ debouncedHorizontalMinDelay(scrollEvent);
+ }
+ else {
+ debouncedHorizontal(scrollEvent);
+ }
+ };
+
+ self.scrollbarHeight = 0;
+ self.scrollbarWidth = 0;
+ if (self.options.enableHorizontalScrollbar === uiGridConstants.scrollbars.ALWAYS) {
+ self.scrollbarHeight = gridUtil.getScrollbarWidth();
+ }
+
+ if (self.options.enableVerticalScrollbar === uiGridConstants.scrollbars.ALWAYS) {
+ self.scrollbarWidth = gridUtil.getScrollbarWidth();
+ }
+
+
+
+ self.api = new GridApi(self);
+
+ /**
+ * @ngdoc function
+ * @name refresh
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Refresh the rendered grid on screen.
+ * The refresh method re-runs both the columnProcessors and the
+ * rowProcessors, as well as calling refreshCanvas to update all
+ * the grid sizing. In general you should prefer to use queueGridRefresh
+ * instead, which is basically a debounced version of refresh.
+ *
+ * If you only want to resize the grid, not regenerate all the rows
+ * and columns, you should consider directly calling refreshCanvas instead.
+ *
+ */
+ self.api.registerMethod( 'core', 'refresh', this.refresh );
+
+ /**
+ * @ngdoc function
+ * @name queueGridRefresh
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Request a refresh of the rendered grid on screen, if multiple
+ * calls to queueGridRefresh are made within a digest cycle only one will execute.
+ * The refresh method re-runs both the columnProcessors and the
+ * rowProcessors, as well as calling refreshCanvas to update all
+ * the grid sizing. In general you should prefer to use queueGridRefresh
+ * instead, which is basically a debounced version of refresh.
+ *
+ */
+ self.api.registerMethod( 'core', 'queueGridRefresh', this.queueGridRefresh );
+
+ /**
+ * @ngdoc function
+ * @name refreshRows
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Runs only the rowProcessors, columns remain as they were.
+ * It then calls redrawInPlace and refreshCanvas, which adjust the grid sizing.
+ * @returns {promise} promise that is resolved when render completes?
+ *
+ */
+ self.api.registerMethod( 'core', 'refreshRows', this.refreshRows );
+
+ /**
+ * @ngdoc function
+ * @name queueRefresh
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Requests execution of refreshCanvas, if multiple requests are made
+ * during a digest cycle only one will run. RefreshCanvas updates the grid sizing.
+ * @returns {promise} promise that is resolved when render completes?
+ *
+ */
+ self.api.registerMethod( 'core', 'queueRefresh', this.queueRefresh );
+
+ /**
+ * @ngdoc function
+ * @name handleWindowResize
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Trigger a grid resize, normally this would be picked
+ * up by a watch on window size, but in some circumstances it is necessary
+ * to call this manually
+ * @returns {promise} promise that is resolved when render completes?
+ *
+ */
+ self.api.registerMethod( 'core', 'handleWindowResize', this.handleWindowResize );
+
+
+ /**
+ * @ngdoc function
+ * @name addRowHeaderColumn
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description adds a row header column to the grid
+ * @param {object} column def
+ *
+ */
+ self.api.registerMethod( 'core', 'addRowHeaderColumn', this.addRowHeaderColumn );
+
+ /**
+ * @ngdoc function
+ * @name scrollToIfNecessary
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Scrolls the grid to make a certain row and column combo visible,
+ * in the case that it is not completely visible on the screen already.
+ * @param {GridRow} gridRow row to make visible
+ * @param {GridCol} gridCol column to make visible
+ * @returns {promise} a promise that is resolved when scrolling is complete
+ *
+ */
+ self.api.registerMethod( 'core', 'scrollToIfNecessary', function(gridRow, gridCol) { return self.scrollToIfNecessary(gridRow, gridCol);} );
+
+ /**
+ * @ngdoc function
+ * @name scrollTo
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Scroll the grid such that the specified
+ * row and column is in view
+ * @param {object} rowEntity gridOptions.data[] array instance to make visible
+ * @param {object} colDef to make visible
+ * @returns {promise} a promise that is resolved after any scrolling is finished
+ */
+ self.api.registerMethod( 'core', 'scrollTo', function (rowEntity, colDef) { return self.scrollTo(rowEntity, colDef);} );
+
+ /**
+ * @ngdoc function
+ * @name registerRowsProcessor
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description
+ * Register a "rows processor" function. When the rows are updated,
+ * the grid calls each registered "rows processor", which has a chance
+ * to alter the set of rows (sorting, etc) as long as the count is not
+ * modified.
+ *
+ * @param {function(renderedRowsToProcess, columns )} processorFunction rows processor function, which
+ * is run in the context of the grid (i.e. this for the function will be the grid), and must
+ * return the updated rows list, which is passed to the next processor in the chain
+ * @param {number} priority the priority of this processor. In general we try to do them in 100s to leave room
+ * for other people to inject rows processors at intermediate priorities. Lower priority rowsProcessors run earlier.
+ *
+ * At present allRowsVisible is running at 50, sort manipulations running at 60-65, filter is running at 100,
+ * sort is at 200, grouping and treeview at 400-410, selectable rows at 500, pagination at 900 (pagination will generally want to be last)
+ */
+ self.api.registerMethod( 'core', 'registerRowsProcessor', this.registerRowsProcessor );
+
+ /**
+ * @ngdoc function
+ * @name registerColumnsProcessor
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description
+ * Register a "columns processor" function. When the columns are updated,
+ * the grid calls each registered "columns processor", which has a chance
+ * to alter the set of columns as long as the count is not
+ * modified.
+ *
+ * @param {function(renderedColumnsToProcess, rows )} processorFunction columns processor function, which
+ * is run in the context of the grid (i.e. this for the function will be the grid), and must
+ * return the updated columns list, which is passed to the next processor in the chain
+ * @param {number} priority the priority of this processor. In general we try to do them in 100s to leave room
+ * for other people to inject columns processors at intermediate priorities. Lower priority columnsProcessors run earlier.
+ *
+ * At present allRowsVisible is running at 50, filter is running at 100, sort is at 200, grouping at 400, selectable rows at 500, pagination at 900 (pagination will generally want to be last)
+ */
+ self.api.registerMethod( 'core', 'registerColumnsProcessor', this.registerColumnsProcessor );
+
+
+
+ /**
+ * @ngdoc function
+ * @name sortHandleNulls
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description A null handling method that can be used when building custom sort
+ * functions
+ * @example
+ * <pre>
+ * mySortFn = function(a, b) {
+ * var nulls = $scope.gridApi.core.sortHandleNulls(a, b);
+ * if ( nulls !== null ){
+ * return nulls;
+ * } else {
+ * // your code for sorting here
+ * };
+ * </pre>
+ * @param {object} a sort value a
+ * @param {object} b sort value b
+ * @returns {number} null if there were no nulls/undefineds, otherwise returns
+ * a sort value that should be passed back from the sort function
+ *
+ */
+ self.api.registerMethod( 'core', 'sortHandleNulls', rowSorter.handleNulls );
+
+
+ /**
+ * @ngdoc function
+ * @name sortChanged
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description The sort criteria on one or more columns has
+ * changed. Provides as parameters the grid and the output of
+ * getColumnSorting, which is an array of gridColumns
+ * that have sorting on them, sorted in priority order.
+ *
+ * @param {$scope} scope The scope of the controller. This is used to deregister this event when the scope is destroyed.
+ * @param {Function} callBack Will be called when the event is emited. The function passes back an array of columns with
+ * sorts on them, in priority order.
+ *
+ * @example
+ * <pre>
+ * gridApi.core.on.sortChanged( $scope, function(sortColumns){
+ * // do something
+ * });
+ * </pre>
+ */
+ self.api.registerEvent( 'core', 'sortChanged' );
+
+ /**
+ * @ngdoc function
+ * @name columnVisibilityChanged
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description The visibility of a column has changed,
+ * the column itself is passed out as a parameter of the event.
+ *
+ * @param {$scope} scope The scope of the controller. This is used to deregister this event when the scope is destroyed.
+ * @param {Function} callBack Will be called when the event is emited. The function passes back the GridCol that has changed.
+ *
+ * @example
+ * <pre>
+ * gridApi.core.on.columnVisibilityChanged( $scope, function (column) {
+ * // do something
+ * } );
+ * </pre>
+ */
+ self.api.registerEvent( 'core', 'columnVisibilityChanged' );
+
+ /**
+ * @ngdoc method
+ * @name notifyDataChange
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Notify the grid that a data or config change has occurred,
+ * where that change isn't something the grid was otherwise noticing. This
+ * might be particularly relevant where you've changed values within the data
+ * and you'd like cell classes to be re-evaluated, or changed config within
+ * the columnDef and you'd like headerCellClasses to be re-evaluated.
+ * @param {string} type one of the
+ * uiGridConstants.dataChange values (ALL, ROW, EDIT, COLUMN), which tells
+ * us which refreshes to fire.
+ *
+ */
+ self.api.registerMethod( 'core', 'notifyDataChange', this.notifyDataChange );
+
+ /**
+ * @ngdoc method
+ * @name clearAllFilters
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Clears all filters and optionally refreshes the visible rows.
+ * @param {object} refreshRows Defaults to true.
+ * @param {object} clearConditions Defaults to false.
+ * @param {object} clearFlags Defaults to false.
+ * @returns {promise} If `refreshRows` is true, returns a promise of the rows refreshing.
+ */
+ self.api.registerMethod('core', 'clearAllFilters', this.clearAllFilters);
+
+ self.registerDataChangeCallback( self.columnRefreshCallback, [uiGridConstants.dataChange.COLUMN]);
+ self.registerDataChangeCallback( self.processRowsCallback, [uiGridConstants.dataChange.EDIT]);
+ self.registerDataChangeCallback( self.updateFooterHeightCallback, [uiGridConstants.dataChange.OPTIONS]);
+
+ self.registerStyleComputation({
+ priority: 10,
+ func: self.getFooterStyles
+ });
+ };
+
+ Grid.prototype.calcFooterHeight = function () {
+ if (!this.hasFooter()) {
+ return 0;
+ }
+
+ var height = 0;
+ if (this.options.showGridFooter) {
+ height += this.options.gridFooterHeight;
+ }
+
+ height += this.calcColumnFooterHeight();
+
+ return height;
+ };
+
+ Grid.prototype.calcColumnFooterHeight = function () {
+ var height = 0;
+
+ if (this.options.showColumnFooter) {
+ height += this.options.columnFooterHeight;
+ }
+
+ return height;
+ };
+
+ Grid.prototype.getFooterStyles = function () {
+ var style = '.grid' + this.id + ' .ui-grid-footer-aggregates-row { height: ' + this.options.columnFooterHeight + 'px; }';
+ style += ' .grid' + this.id + ' .ui-grid-footer-info { height: ' + this.options.gridFooterHeight + 'px; }';
+ return style;
+ };
+
+ Grid.prototype.hasFooter = function () {
+ return this.options.showGridFooter || this.options.showColumnFooter;
+ };
+
+ /**
+ * @ngdoc function
+ * @name isRTL
+ * @methodOf ui.grid.class:Grid
+ * @description Returns true if grid is RightToLeft
+ */
+ Grid.prototype.isRTL = function () {
+ return this.rtl;
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name registerColumnBuilder
+ * @methodOf ui.grid.class:Grid
+ * @description When the build creates columns from column definitions, the columnbuilders will be called to add
+ * additional properties to the column.
+ * @param {function(colDef, col, gridOptions)} columnBuilder function to be called
+ */
+ Grid.prototype.registerColumnBuilder = function registerColumnBuilder(columnBuilder) {
+ this.columnBuilders.push(columnBuilder);
+ };
+
+ /**
+ * @ngdoc function
+ * @name buildColumnDefsFromData
+ * @methodOf ui.grid.class:Grid
+ * @description Populates columnDefs from the provided data
+ * @param {function(colDef, col, gridOptions)} rowBuilder function to be called
+ */
+ Grid.prototype.buildColumnDefsFromData = function (dataRows){
+ this.options.columnDefs = gridUtil.getColumnsFromData(dataRows, this.options.excludeProperties);
+ };
+
+ /**
+ * @ngdoc function
+ * @name registerRowBuilder
+ * @methodOf ui.grid.class:Grid
+ * @description When the build creates rows from gridOptions.data, the rowBuilders will be called to add
+ * additional properties to the row.
+ * @param {function(row, gridOptions)} rowBuilder function to be called
+ */
+ Grid.prototype.registerRowBuilder = function registerRowBuilder(rowBuilder) {
+ this.rowBuilders.push(rowBuilder);
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name registerDataChangeCallback
+ * @methodOf ui.grid.class:Grid
+ * @description When a data change occurs, the data change callbacks of the specified type
+ * will be called. The rules are:
+ *
+ * - when the data watch fires, that is considered a ROW change (the data watch only notices
+ * added or removed rows)
+ * - when the api is called to inform us of a change, the declared type of that change is used
+ * - when a cell edit completes, the EDIT callbacks are triggered
+ * - when the columnDef watch fires, the COLUMN callbacks are triggered
+ * - when the options watch fires, the OPTIONS callbacks are triggered
+ *
+ * For a given event:
+ * - ALL calls ROW, EDIT, COLUMN, OPTIONS and ALL callbacks
+ * - ROW calls ROW and ALL callbacks
+ * - EDIT calls EDIT and ALL callbacks
+ * - COLUMN calls COLUMN and ALL callbacks
+ * - OPTIONS calls OPTIONS and ALL callbacks
+ *
+ * @param {function(grid)} callback function to be called
+ * @param {array} types the types of data change you want to be informed of. Values from
+ * the uiGridConstants.dataChange values ( ALL, EDIT, ROW, COLUMN, OPTIONS ). Optional and defaults to
+ * ALL
+ * @returns {function} deregister function - a function that can be called to deregister this callback
+ */
+ Grid.prototype.registerDataChangeCallback = function registerDataChangeCallback(callback, types, _this) {
+ var uid = gridUtil.nextUid();
+ if ( !types ){
+ types = [uiGridConstants.dataChange.ALL];
+ }
+ if ( !Array.isArray(types)){
+ gridUtil.logError("Expected types to be an array or null in registerDataChangeCallback, value passed was: " + types );
+ }
+ this.dataChangeCallbacks[uid] = { callback: callback, types: types, _this:_this };
+
+ var self = this;
+ var deregisterFunction = function() {
+ delete self.dataChangeCallbacks[uid];
+ };
+ return deregisterFunction;
+ };
+
+ /**
+ * @ngdoc function
+ * @name callDataChangeCallbacks
+ * @methodOf ui.grid.class:Grid
+ * @description Calls the callbacks based on the type of data change that
+ * has occurred. Always calls the ALL callbacks, calls the ROW, EDIT, COLUMN and OPTIONS callbacks if the
+ * event type is matching, or if the type is ALL.
+ * @param {number} type the type of event that occurred - one of the
+ * uiGridConstants.dataChange values (ALL, ROW, EDIT, COLUMN, OPTIONS)
+ */
+ Grid.prototype.callDataChangeCallbacks = function callDataChangeCallbacks(type, options) {
+ angular.forEach( this.dataChangeCallbacks, function( callback, uid ){
+ if ( callback.types.indexOf( uiGridConstants.dataChange.ALL ) !== -1 ||
+ callback.types.indexOf( type ) !== -1 ||
+ type === uiGridConstants.dataChange.ALL ) {
+ if (callback._this) {
+ callback.callback.apply(callback._this,this);
+ }
+ else {
+ callback.callback( this );
+ }
+ }
+ }, this);
+ };
+
+ /**
+ * @ngdoc function
+ * @name notifyDataChange
+ * @methodOf ui.grid.class:Grid
+ * @description Notifies us that a data change has occurred, used in the public
+ * api for users to tell us when they've changed data or some other event that
+ * our watches cannot pick up
+ * @param {string} type the type of event that occurred - one of the
+ * uiGridConstants.dataChange values (ALL, ROW, EDIT, COLUMN)
+ */
+ Grid.prototype.notifyDataChange = function notifyDataChange(type) {
+ var constants = uiGridConstants.dataChange;
+ if ( type === constants.ALL ||
+ type === constants.COLUMN ||
+ type === constants.EDIT ||
+ type === constants.ROW ||
+ type === constants.OPTIONS ){
+ this.callDataChangeCallbacks( type );
+ } else {
+ gridUtil.logError("Notified of a data change, but the type was not recognised, so no action taken, type was: " + type);
+ }
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name columnRefreshCallback
+ * @methodOf ui.grid.class:Grid
+ * @description refreshes the grid when a column refresh
+ * is notified, which triggers handling of the visible flag.
+ * This is called on uiGridConstants.dataChange.COLUMN, and is
+ * registered as a dataChangeCallback in grid.js
+ * @param {string} name column name
+ */
+ Grid.prototype.columnRefreshCallback = function columnRefreshCallback( grid ){
+ grid.buildColumns();
+ grid.queueGridRefresh();
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name processRowsCallback
+ * @methodOf ui.grid.class:Grid
+ * @description calls the row processors, specifically
+ * intended to reset the sorting when an edit is called,
+ * registered as a dataChangeCallback on uiGridConstants.dataChange.EDIT
+ * @param {string} name column name
+ */
+ Grid.prototype.processRowsCallback = function processRowsCallback( grid ){
+ grid.queueGridRefresh();
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name updateFooterHeightCallback
+ * @methodOf ui.grid.class:Grid
+ * @description recalculates the footer height,
+ * registered as a dataChangeCallback on uiGridConstants.dataChange.OPTIONS
+ * @param {string} name column name
+ */
+ Grid.prototype.updateFooterHeightCallback = function updateFooterHeightCallback( grid ){
+ grid.footerHeight = grid.calcFooterHeight();
+ grid.columnFooterHeight = grid.calcColumnFooterHeight();
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name getColumn
+ * @methodOf ui.grid.class:Grid
+ * @description returns a grid column for the column name
+ * @param {string} name column name
+ */
+ Grid.prototype.getColumn = function getColumn(name) {
+ var columns = this.columns.filter(function (column) {
+ return column.colDef.name === name;
+ });
+ return columns.length > 0 ? columns[0] : null;
+ };
+
+ /**
+ * @ngdoc function
+ * @name getColDef
+ * @methodOf ui.grid.class:Grid
+ * @description returns a grid colDef for the column name
+ * @param {string} name column.field
+ */
+ Grid.prototype.getColDef = function getColDef(name) {
+ var colDefs = this.options.columnDefs.filter(function (colDef) {
+ return colDef.name === name;
+ });
+ return colDefs.length > 0 ? colDefs[0] : null;
+ };
+
+ /**
+ * @ngdoc function
+ * @name assignTypes
+ * @methodOf ui.grid.class:Grid
+ * @description uses the first row of data to assign colDef.type for any types not defined.
+ */
+ /**
+ * @ngdoc property
+ * @name type
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description the type of the column, used in sorting. If not provided then the
+ * grid will guess the type. Add this only if the grid guessing is not to your
+ * satisfaction. One of:
+ * - 'string'
+ * - 'boolean'
+ * - 'number'
+ * - 'date'
+ * - 'object'
+ * - 'numberStr'
+ * Note that if you choose date, your dates should be in a javascript date type
+ *
+ */
+ Grid.prototype.assignTypes = function(){
+ var self = this;
+ self.options.columnDefs.forEach(function (colDef, index) {
+
+ //Assign colDef type if not specified
+ if (!colDef.type) {
+ var col = new GridColumn(colDef, index, self);
+ var firstRow = self.rows.length > 0 ? self.rows[0] : null;
+ if (firstRow) {
+ colDef.type = gridUtil.guessType(self.getCellValue(firstRow, col));
+ }
+ else {
+ colDef.type = 'string';
+ }
+ }
+ });
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name isRowHeaderColumn
+ * @methodOf ui.grid.class:Grid
+ * @description returns true if the column is a row Header
+ * @param {object} column column
+ */
+ Grid.prototype.isRowHeaderColumn = function isRowHeaderColumn(column) {
+ return this.rowHeaderColumns.indexOf(column) !== -1;
+ };
+
+ /**
+ * @ngdoc function
+ * @name addRowHeaderColumn
+ * @methodOf ui.grid.class:Grid
+ * @description adds a row header column to the grid
+ * @param {object} column def
+ */
+ Grid.prototype.addRowHeaderColumn = function addRowHeaderColumn(colDef) {
+ var self = this;
+ var rowHeaderCol = new GridColumn(colDef, gridUtil.nextUid(), self);
+ rowHeaderCol.isRowHeader = true;
+ if (self.isRTL()) {
+ self.createRightContainer();
+ rowHeaderCol.renderContainer = 'right';
+ }
+ else {
+ self.createLeftContainer();
+ rowHeaderCol.renderContainer = 'left';
+ }
+
+ // relies on the default column builder being first in array, as it is instantiated
+ // as part of grid creation
+ self.columnBuilders[0](colDef,rowHeaderCol,self.options)
+ .then(function(){
+ rowHeaderCol.enableFiltering = false;
+ rowHeaderCol.enableSorting = false;
+ rowHeaderCol.enableHiding = false;
+ self.rowHeaderColumns.push(rowHeaderCol);
+ self.buildColumns()
+ .then( function() {
+ self.preCompileCellTemplates();
+ self.queueGridRefresh();
+ });
+ });
+ };
+
+ /**
+ * @ngdoc function
+ * @name getOnlyDataColumns
+ * @methodOf ui.grid.class:Grid
+ * @description returns all columns except for rowHeader columns
+ */
+ Grid.prototype.getOnlyDataColumns = function getOnlyDataColumns() {
+ var self = this;
+ var cols = [];
+ self.columns.forEach(function (col) {
+ if (self.rowHeaderColumns.indexOf(col) === -1) {
+ cols.push(col);
+ }
+ });
+ return cols;
+ };
+
+ /**
+ * @ngdoc function
+ * @name buildColumns
+ * @methodOf ui.grid.class:Grid
+ * @description creates GridColumn objects from the columnDefinition. Calls each registered
+ * columnBuilder to further process the column
+ * @param {object} options An object contains options to use when building columns
+ *
+ * * **orderByColumnDefs**: defaults to **false**. When true, `buildColumns` will reorder existing columns according to the order within the column definitions.
+ *
+ * @returns {Promise} a promise to load any needed column resources
+ */
+ Grid.prototype.buildColumns = function buildColumns(opts) {
+ var options = {
+ orderByColumnDefs: false
+ };
+
+ angular.extend(options, opts);
+
+ // gridUtil.logDebug('buildColumns');
+ var self = this;
+ var builderPromises = [];
+ var headerOffset = self.rowHeaderColumns.length;
+ var i;
+
+ // Remove any columns for which a columnDef cannot be found
+ // Deliberately don't use forEach, as it doesn't like splice being called in the middle
+ // Also don't cache columns.length, as it will change during this operation
+ for (i = 0; i < self.columns.length; i++){
+ if (!self.getColDef(self.columns[i].name)) {
+ self.columns.splice(i, 1);
+ i--;
+ }
+ }
+
+ //add row header columns to the grid columns array _after_ columns without columnDefs have been removed
+ self.rowHeaderColumns.forEach(function (rowHeaderColumn) {
+ self.columns.unshift(rowHeaderColumn);
+ });
+
+
+ // look at each column def, and update column properties to match. If the column def
+ // doesn't have a column, then splice in a new gridCol
+ self.options.columnDefs.forEach(function (colDef, index) {
+ self.preprocessColDef(colDef);
+ var col = self.getColumn(colDef.name);
+
+ if (!col) {
+ col = new GridColumn(colDef, gridUtil.nextUid(), self);
+ self.columns.splice(index + headerOffset, 0, col);
+ }
+ else {
+ // tell updateColumnDef that the column was pre-existing
+ col.updateColumnDef(colDef, false);
+ }
+
+ self.columnBuilders.forEach(function (builder) {
+ builderPromises.push(builder.call(self, colDef, col, self.options));
+ });
+ });
+
+ /*** Reorder columns if necessary ***/
+ if (!!options.orderByColumnDefs) {
+ // Create a shallow copy of the columns as a cache
+ var columnCache = self.columns.slice(0);
+
+ // We need to allow for the "row headers" when mapping from the column defs array to the columns array
+ // If we have a row header in columns[0] and don't account for it we'll overwrite it with the column in columnDefs[0]
+
+ // Go through all the column defs, use the shorter of columns length and colDefs.length because if a user has given two columns the same name then
+ // columns will be shorter than columnDefs. In this situation we'll avoid an error, but the user will still get an unexpected result
+ var len = Math.min(self.options.columnDefs.length, self.columns.length);
+ for (i = 0; i < len; i++) {
+ // If the column at this index has a different name than the column at the same index in the column defs...
+ if (self.columns[i + headerOffset].name !== self.options.columnDefs[i].name) {
+ // Replace the one in the cache with the appropriate column
+ columnCache[i + headerOffset] = self.getColumn(self.options.columnDefs[i].name);
+ }
+ else {
+ // Otherwise just copy over the one from the initial columns
+ columnCache[i + headerOffset] = self.columns[i + headerOffset];
+ }
+ }
+
+ // Empty out the columns array, non-destructively
+ self.columns.length = 0;
+
+ // And splice in the updated, ordered columns from the cache
+ Array.prototype.splice.apply(self.columns, [0, 0].concat(columnCache));
+ }
+
+ return $q.all(builderPromises).then(function(){
+ if (self.rows.length > 0){
+ self.assignTypes();
+ }
+ });
+ };
+
+/**
+ * @ngdoc function
+ * @name preCompileCellTemplates
+ * @methodOf ui.grid.class:Grid
+ * @description precompiles all cell templates
+ */
+ Grid.prototype.preCompileCellTemplates = function() {
+ var self = this;
+
+ var preCompileTemplate = function( col ) {
+ var html = col.cellTemplate.replace(uiGridConstants.MODEL_COL_FIELD, self.getQualifiedColField(col));
+ html = html.replace(uiGridConstants.COL_FIELD, 'grid.getCellValue(row, col)');
+
+ var compiledElementFn = $compile(html);
+ col.compiledElementFn = compiledElementFn;
+
+ if (col.compiledElementFnDefer) {
+ col.compiledElementFnDefer.resolve(col.compiledElementFn);
+ }
+ };
+
+ this.columns.forEach(function (col) {
+ if ( col.cellTemplate ){
+ preCompileTemplate( col );
+ } else if ( col.cellTemplatePromise ){
+ col.cellTemplatePromise.then( function() {
+ preCompileTemplate( col );
+ });
+ }
+ });
+ };
+
+ /**
+ * @ngdoc function
+ * @name getGridQualifiedColField
+ * @methodOf ui.grid.class:Grid
+ * @description Returns the $parse-able accessor for a column within its $scope
+ * @param {GridColumn} col col object
+ */
+ Grid.prototype.getQualifiedColField = function (col) {
+ return 'row.entity.' + gridUtil.preEval(col.field);
+ };
+
+ /**
+ * @ngdoc function
+ * @name createLeftContainer
+ * @methodOf ui.grid.class:Grid
+ * @description creates the left render container if it doesn't already exist
+ */
+ Grid.prototype.createLeftContainer = function() {
+ if (!this.hasLeftContainer()) {
+ this.renderContainers.left = new GridRenderContainer('left', this, { disableColumnOffset: true });
+ }
+ };
+
+ /**
+ * @ngdoc function
+ * @name createRightContainer
+ * @methodOf ui.grid.class:Grid
+ * @description creates the right render container if it doesn't already exist
+ */
+ Grid.prototype.createRightContainer = function() {
+ if (!this.hasRightContainer()) {
+ this.renderContainers.right = new GridRenderContainer('right', this, { disableColumnOffset: true });
+ }
+ };
+
+ /**
+ * @ngdoc function
+ * @name hasLeftContainer
+ * @methodOf ui.grid.class:Grid
+ * @description returns true if leftContainer exists
+ */
+ Grid.prototype.hasLeftContainer = function() {
+ return this.renderContainers.left !== undefined;
+ };
+
+ /**
+ * @ngdoc function
+ * @name hasRightContainer
+ * @methodOf ui.grid.class:Grid
+ * @description returns true if rightContainer exists
+ */
+ Grid.prototype.hasRightContainer = function() {
+ return this.renderContainers.right !== undefined;
+ };
+
+
+ /**
+ * undocumented function
+ * @name preprocessColDef
+ * @methodOf ui.grid.class:Grid
+ * @description defaults the name property from field to maintain backwards compatibility with 2.x
+ * validates that name or field is present
+ */
+ Grid.prototype.preprocessColDef = function preprocessColDef(colDef) {
+ var self = this;
+
+ if (!colDef.field && !colDef.name) {
+ throw new Error('colDef.name or colDef.field property is required');
+ }
+
+ //maintain backwards compatibility with 2.x
+ //field was required in 2.x. now name is required
+ if (colDef.name === undefined && colDef.field !== undefined) {
+ // See if the column name already exists:
+ var newName = colDef.field,
+ counter = 2;
+ while (self.getColumn(newName)) {
+ newName = colDef.field + counter.toString();
+ counter++;
+ }
+ colDef.name = newName;
+ }
+ };
+
+ // Return a list of items that exist in the `n` array but not the `o` array. Uses optional property accessors passed as third & fourth parameters
+ Grid.prototype.newInN = function newInN(o, n, oAccessor, nAccessor) {
+ var self = this;
+
+ var t = [];
+ for (var i = 0; i < n.length; i++) {
+ var nV = nAccessor ? n[i][nAccessor] : n[i];
+
+ var found = false;
+ for (var j = 0; j < o.length; j++) {
+ var oV = oAccessor ? o[j][oAccessor] : o[j];
+ if (self.options.rowEquality(nV, oV)) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ t.push(nV);
+ }
+ }
+
+ return t;
+ };
+
+ /**
+ * @ngdoc function
+ * @name getRow
+ * @methodOf ui.grid.class:Grid
+ * @description returns the GridRow that contains the rowEntity
+ * @param {object} rowEntity the gridOptions.data array element instance
+ * @param {array} rows [optional] the rows to look in - if not provided then
+ * looks in grid.rows
+ */
+ Grid.prototype.getRow = function getRow(rowEntity, lookInRows) {
+ var self = this;
+
+ lookInRows = typeof(lookInRows) === 'undefined' ? self.rows : lookInRows;
+
+ var rows = lookInRows.filter(function (row) {
+ return self.options.rowEquality(row.entity, rowEntity);
+ });
+ return rows.length > 0 ? rows[0] : null;
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name modifyRows
+ * @methodOf ui.grid.class:Grid
+ * @description creates or removes GridRow objects from the newRawData array. Calls each registered
+ * rowBuilder to further process the row
+ * @param {array} newRawData Modified set of data
+ *
+ * This method aims to achieve three things:
+ * 1. the resulting rows array is in the same order as the newRawData, we'll call
+ * rowsProcessors immediately after to sort the data anyway
+ * 2. if we have row hashing available, we try to use the rowHash to find the row
+ * 3. no memory leaks - rows that are no longer in newRawData need to be garbage collected
+ *
+ * The basic logic flow makes use of the newRawData, oldRows and oldHash, and creates
+ * the newRows and newHash
+ *
+ * ```
+ * newRawData.forEach newEntity
+ * if (hashing enabled)
+ * check oldHash for newEntity
+ * else
+ * look for old row directly in oldRows
+ * if !oldRowFound // must be a new row
+ * create newRow
+ * append to the newRows and add to newHash
+ * run the processors
+ * ```
+ *
+ * Rows are identified using the hashKey if configured. If not configured, then rows
+ * are identified using the gridOptions.rowEquality function
+ *
+ * This method is useful when trying to select rows immediately after loading data without
+ * using a $timeout/$interval, e.g.:
+ *
+ * $scope.gridOptions.data = someData;
+ * $scope.gridApi.grid.modifyRows($scope.gridOptions.data);
+ * $scope.gridApi.selection.selectRow($scope.gridOptions.data[0]);
+ *
+ * OR to persist row selection after data update (e.g. rows selected, new data loaded, want
+ * originally selected rows to be re-selected))
+ */
+ Grid.prototype.modifyRows = function modifyRows(newRawData) {
+ var self = this;
+ var oldRows = self.rows.slice(0);
+ var oldRowHash = self.rowHashMap || self.createRowHashMap();
+ self.rowHashMap = self.createRowHashMap();
+ self.rows.length = 0;
+
+ newRawData.forEach( function( newEntity, i ) {
+ var newRow;
+ if ( self.options.enableRowHashing ){
+ // if hashing is enabled, then this row will be in the hash if we already know about it
+ newRow = oldRowHash.get( newEntity );
+ } else {
+ // otherwise, manually search the oldRows to see if we can find this row
+ newRow = self.getRow(newEntity, oldRows);
+ }
+
+ // if we didn't find the row, it must be new, so create it
+ if ( !newRow ){
+ newRow = self.processRowBuilders(new GridRow(newEntity, i, self));
+ }
+
+ self.rows.push( newRow );
+ self.rowHashMap.put( newEntity, newRow );
+ });
+
+ self.assignTypes();
+
+ var p1 = $q.when(self.processRowsProcessors(self.rows))
+ .then(function (renderableRows) {
+ return self.setVisibleRows(renderableRows);
+ });
+
+ var p2 = $q.when(self.processColumnsProcessors(self.columns))
+ .then(function (renderableColumns) {
+ return self.setVisibleColumns(renderableColumns);
+ });
+
+ return $q.all([p1, p2]);
+ };
+
+
+ /**
+ * Private Undocumented Method
+ * @name addRows
+ * @methodOf ui.grid.class:Grid
+ * @description adds the newRawData array of rows to the grid and calls all registered
+ * rowBuilders. this keyword will reference the grid
+ */
+ Grid.prototype.addRows = function addRows(newRawData) {
+ var self = this;
+
+ var existingRowCount = self.rows.length;
+ for (var i = 0; i < newRawData.length; i++) {
+ var newRow = self.processRowBuilders(new GridRow(newRawData[i], i + existingRowCount, self));
+
+ if (self.options.enableRowHashing) {
+ var found = self.rowHashMap.get(newRow.entity);
+ if (found) {
+ found.row = newRow;
+ }
+ }
+
+ self.rows.push(newRow);
+ }
+ };
+
+ /**
+ * @ngdoc function
+ * @name processRowBuilders
+ * @methodOf ui.grid.class:Grid
+ * @description processes all RowBuilders for the gridRow
+ * @param {GridRow} gridRow reference to gridRow
+ * @returns {GridRow} the gridRow with all additional behavior added
+ */
+ Grid.prototype.processRowBuilders = function processRowBuilders(gridRow) {
+ var self = this;
+
+ self.rowBuilders.forEach(function (builder) {
+ builder.call(self, gridRow, self.options);
+ });
+
+ return gridRow;
+ };
+
+ /**
+ * @ngdoc function
+ * @name registerStyleComputation
+ * @methodOf ui.grid.class:Grid
+ * @description registered a styleComputation function
+ *
+ * If the function returns a value it will be appended into the grid's `<style>` block
+ * @param {function($scope)} styleComputation function
+ */
+ Grid.prototype.registerStyleComputation = function registerStyleComputation(styleComputationInfo) {
+ this.styleComputations.push(styleComputationInfo);
+ };
+
+
+ // NOTE (c0bra): We already have rowBuilders. I think these do exactly the same thing...
+ // Grid.prototype.registerRowFilter = function(filter) {
+ // // TODO(c0bra): validate filter?
+
+ // this.rowFilters.push(filter);
+ // };
+
+ // Grid.prototype.removeRowFilter = function(filter) {
+ // var idx = this.rowFilters.indexOf(filter);
+
+ // if (typeof(idx) !== 'undefined' && idx !== undefined) {
+ // this.rowFilters.slice(idx, 1);
+ // }
+ // };
+
+ // Grid.prototype.processRowFilters = function(rows) {
+ // var self = this;
+ // self.rowFilters.forEach(function (filter) {
+ // filter.call(self, rows);
+ // });
+ // };
+
+
+ /**
+ * @ngdoc function
+ * @name registerRowsProcessor
+ * @methodOf ui.grid.class:Grid
+ * @description
+ *
+ * Register a "rows processor" function. When the rows are updated,
+ * the grid calls each registered "rows processor", which has a chance
+ * to alter the set of rows (sorting, etc) as long as the count is not
+ * modified.
+ *
+ * @param {function(renderedRowsToProcess, columns )} processorFunction rows processor function, which
+ * is run in the context of the grid (i.e. this for the function will be the grid), and must
+ * return the updated rows list, which is passed to the next processor in the chain
+ * @param {number} priority the priority of this processor. In general we try to do them in 100s to leave room
+ * for other people to inject rows processors at intermediate priorities. Lower priority rowsProcessors run earlier.
+ *
+ * At present all rows visible is running at 50, filter is running at 100, sort is at 200, grouping at 400, selectable rows at 500, pagination at 900 (pagination will generally want to be last)
+ *
+ */
+ Grid.prototype.registerRowsProcessor = function registerRowsProcessor(processor, priority) {
+ if (!angular.isFunction(processor)) {
+ throw 'Attempt to register non-function rows processor: ' + processor;
+ }
+
+ this.rowsProcessors.push({processor: processor, priority: priority});
+ this.rowsProcessors.sort(function sortByPriority( a, b ){
+ return a.priority - b.priority;
+ });
+ };
+
+ /**
+ * @ngdoc function
+ * @name removeRowsProcessor
+ * @methodOf ui.grid.class:Grid
+ * @param {function(renderableRows)} rows processor function
+ * @description Remove a registered rows processor
+ */
+ Grid.prototype.removeRowsProcessor = function removeRowsProcessor(processor) {
+ var idx = -1;
+ this.rowsProcessors.forEach(function(rowsProcessor, index){
+ if ( rowsProcessor.processor === processor ){
+ idx = index;
+ }
+ });
+
+ if ( idx !== -1 ) {
+ this.rowsProcessors.splice(idx, 1);
+ }
+ };
+
+ /**
+ * Private Undocumented Method
+ * @name processRowsProcessors
+ * @methodOf ui.grid.class:Grid
+ * @param {Array[GridRow]} The array of "renderable" rows
+ * @param {Array[GridColumn]} The array of columns
+ * @description Run all the registered rows processors on the array of renderable rows
+ */
+ Grid.prototype.processRowsProcessors = function processRowsProcessors(renderableRows) {
+ var self = this;
+
+ // Create a shallow copy of the rows so that we can safely sort them without altering the original grid.rows sort order
+ var myRenderableRows = renderableRows.slice(0);
+
+ // Return myRenderableRows with no processing if we have no rows processors
+ if (self.rowsProcessors.length === 0) {
+ return $q.when(myRenderableRows);
+ }
+
+ // Counter for iterating through rows processors
+ var i = 0;
+
+ // Promise for when we're done with all the processors
+ var finished = $q.defer();
+
+ // This function will call the processor in self.rowsProcessors at index 'i', and then
+ // when done will call the next processor in the list, using the output from the processor
+ // at i as the argument for 'renderedRowsToProcess' on the next iteration.
+ //
+ // If we're at the end of the list of processors, we resolve our 'finished' callback with
+ // the result.
+ function startProcessor(i, renderedRowsToProcess) {
+ // Get the processor at 'i'
+ var processor = self.rowsProcessors[i].processor;
+
+ // Call the processor, passing in the rows to process and the current columns
+ // (note: it's wrapped in $q.when() in case the processor does not return a promise)
+ return $q.when( processor.call(self, renderedRowsToProcess, self.columns) )
+ .then(function handleProcessedRows(processedRows) {
+ // Check for errors
+ if (!processedRows) {
+ throw "Processor at index " + i + " did not return a set of renderable rows";
+ }
+
+ if (!angular.isArray(processedRows)) {
+ throw "Processor at index " + i + " did not return an array";
+ }
+
+ // Processor is done, increment the counter
+ i++;
+
+ // If we're not done with the processors, call the next one
+ if (i <= self.rowsProcessors.length - 1) {
+ return startProcessor(i, processedRows);
+ }
+ // We're done! Resolve the 'finished' promise
+ else {
+ finished.resolve(processedRows);
+ }
+ });
+ }
+
+ // Start on the first processor
+ startProcessor(0, myRenderableRows);
+
+ return finished.promise;
+ };
+
+ Grid.prototype.setVisibleRows = function setVisibleRows(rows) {
+ var self = this;
+
+ // Reset all the render container row caches
+ for (var i in self.renderContainers) {
+ var container = self.renderContainers[i];
+
+ container.canvasHeightShouldUpdate = true;
+
+ if ( typeof(container.visibleRowCache) === 'undefined' ){
+ container.visibleRowCache = [];
+ } else {
+ container.visibleRowCache.length = 0;
+ }
+ }
+
+ // rows.forEach(function (row) {
+ for (var ri = 0; ri < rows.length; ri++) {
+ var row = rows[ri];
+
+ var targetContainer = (typeof(row.renderContainer) !== 'undefined' && row.renderContainer) ? row.renderContainer : 'body';
+
+ // If the row is visible
+ if (row.visible) {
+ self.renderContainers[targetContainer].visibleRowCache.push(row);
+ }
+ }
+ self.api.core.raise.rowsRendered(this.api);
+ };
+
+ /**
+ * @ngdoc function
+ * @name registerColumnsProcessor
+ * @methodOf ui.grid.class:Grid
+ * @param {function(renderedColumnsToProcess, rows)} columnProcessor column processor function, which
+ * is run in the context of the grid (i.e. this for the function will be the grid), and
+ * which must return an updated renderedColumnsToProcess which can be passed to the next processor
+ * in the chain
+ * @param {number} priority the priority of this processor. In general we try to do them in 100s to leave room
+ * for other people to inject columns processors at intermediate priorities. Lower priority columnsProcessors run earlier.
+ *
+ * At present all rows visible is running at 50, filter is running at 100, sort is at 200, grouping at 400, selectable rows at 500, pagination at 900 (pagination will generally want to be last)
+ * @description
+
+ Register a "columns processor" function. When the columns are updated,
+ the grid calls each registered "columns processor", which has a chance
+ to alter the set of columns, as long as the count is not modified.
+ */
+ Grid.prototype.registerColumnsProcessor = function registerColumnsProcessor(processor, priority) {
+ if (!angular.isFunction(processor)) {
+ throw 'Attempt to register non-function rows processor: ' + processor;
+ }
+
+ this.columnsProcessors.push({processor: processor, priority: priority});
+ this.columnsProcessors.sort(function sortByPriority( a, b ){
+ return a.priority - b.priority;
+ });
+ };
+
+ Grid.prototype.removeColumnsProcessor = function removeColumnsProcessor(processor) {
+ var idx = this.columnsProcessors.indexOf(processor);
+
+ if (typeof(idx) !== 'undefined' && idx !== undefined) {
+ this.columnsProcessors.splice(idx, 1);
+ }
+ };
+
+ Grid.prototype.processColumnsProcessors = function processColumnsProcessors(renderableColumns) {
+ var self = this;
+
+ // Create a shallow copy of the rows so that we can safely sort them without altering the original grid.rows sort order
+ var myRenderableColumns = renderableColumns.slice(0);
+
+ // Return myRenderableRows with no processing if we have no rows processors
+ if (self.columnsProcessors.length === 0) {
+ return $q.when(myRenderableColumns);
+ }
+
+ // Counter for iterating through rows processors
+ var i = 0;
+
+ // Promise for when we're done with all the processors
+ var finished = $q.defer();
+
+ // This function will call the processor in self.rowsProcessors at index 'i', and then
+ // when done will call the next processor in the list, using the output from the processor
+ // at i as the argument for 'renderedRowsToProcess' on the next iteration.
+ //
+ // If we're at the end of the list of processors, we resolve our 'finished' callback with
+ // the result.
+ function startProcessor(i, renderedColumnsToProcess) {
+ // Get the processor at 'i'
+ var processor = self.columnsProcessors[i].processor;
+
+ // Call the processor, passing in the rows to process and the current columns
+ // (note: it's wrapped in $q.when() in case the processor does not return a promise)
+ return $q.when( processor.call(self, renderedColumnsToProcess, self.rows) )
+ .then(function handleProcessedRows(processedColumns) {
+ // Check for errors
+ if (!processedColumns) {
+ throw "Processor at index " + i + " did not return a set of renderable rows";
+ }
+
+ if (!angular.isArray(processedColumns)) {
+ throw "Processor at index " + i + " did not return an array";
+ }
+
+ // Processor is done, increment the counter
+ i++;
+
+ // If we're not done with the processors, call the next one
+ if (i <= self.columnsProcessors.length - 1) {
+ return startProcessor(i, myRenderableColumns);
+ }
+ // We're done! Resolve the 'finished' promise
+ else {
+ finished.resolve(myRenderableColumns);
+ }
+ });
+ }
+
+ // Start on the first processor
+ startProcessor(0, myRenderableColumns);
+
+ return finished.promise;
+ };
+
+ Grid.prototype.setVisibleColumns = function setVisibleColumns(columns) {
+ // gridUtil.logDebug('setVisibleColumns');
+
+ var self = this;
+
+ // Reset all the render container row caches
+ for (var i in self.renderContainers) {
+ var container = self.renderContainers[i];
+
+ container.visibleColumnCache.length = 0;
+ }
+
+ for (var ci = 0; ci < columns.length; ci++) {
+ var column = columns[ci];
+
+ // If the column is visible
+ if (column.visible) {
+ // If the column has a container specified
+ if (typeof(column.renderContainer) !== 'undefined' && column.renderContainer) {
+ self.renderContainers[column.renderContainer].visibleColumnCache.push(column);
+ }
+ // If not, put it into the body container
+ else {
+ self.renderContainers.body.visibleColumnCache.push(column);
+ }
+ }
+ }
+ };
+
+ /**
+ * @ngdoc function
+ * @name handleWindowResize
+ * @methodOf ui.grid.class:Grid
+ * @description Triggered when the browser window resizes; automatically resizes the grid
+ */
+ Grid.prototype.handleWindowResize = function handleWindowResize($event) {
+ var self = this;
+
+ self.gridWidth = gridUtil.elementWidth(self.element);
+ self.gridHeight = gridUtil.elementHeight(self.element);
+
+ self.queueRefresh();
+ };
+
+ /**
+ * @ngdoc function
+ * @name queueRefresh
+ * @methodOf ui.grid.class:Grid
+ * @description queues a grid refreshCanvas, a way of debouncing all the refreshes we might otherwise issue
+ */
+ Grid.prototype.queueRefresh = function queueRefresh() {
+ var self = this;
+
+ if (self.refreshCanceller) {
+ $timeout.cancel(self.refreshCanceller);
+ }
+
+ self.refreshCanceller = $timeout(function () {
+ self.refreshCanvas(true);
+ });
+
+ self.refreshCanceller.then(function () {
+ self.refreshCanceller = null;
+ });
+
+ return self.refreshCanceller;
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name queueGridRefresh
+ * @methodOf ui.grid.class:Grid
+ * @description queues a grid refresh, a way of debouncing all the refreshes we might otherwise issue
+ */
+ Grid.prototype.queueGridRefresh = function queueGridRefresh() {
+ var self = this;
+
+ if (self.gridRefreshCanceller) {
+ $timeout.cancel(self.gridRefreshCanceller);
+ }
+
+ self.gridRefreshCanceller = $timeout(function () {
+ self.refresh(true);
+ });
+
+ self.gridRefreshCanceller.then(function () {
+ self.gridRefreshCanceller = null;
+ });
+
+ return self.gridRefreshCanceller;
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name updateCanvasHeight
+ * @methodOf ui.grid.class:Grid
+ * @description flags all render containers to update their canvas height
+ */
+ Grid.prototype.updateCanvasHeight = function updateCanvasHeight() {
+ var self = this;
+
+ for (var containerId in self.renderContainers) {
+ if (self.renderContainers.hasOwnProperty(containerId)) {
+ var container = self.renderContainers[containerId];
+ container.canvasHeightShouldUpdate = true;
+ }
+ }
+ };
+
+ /**
+ * @ngdoc function
+ * @name buildStyles
+ * @methodOf ui.grid.class:Grid
+ * @description calls each styleComputation function
+ */
+ // TODO: this used to take $scope, but couldn't see that it was used
+ Grid.prototype.buildStyles = function buildStyles() {
+ // gridUtil.logDebug('buildStyles');
+
+ var self = this;
+
+ self.customStyles = '';
+
+ self.styleComputations
+ .sort(function(a, b) {
+ if (a.priority === null) { return 1; }
+ if (b.priority === null) { return -1; }
+ if (a.priority === null && b.priority === null) { return 0; }
+ return a.priority - b.priority;
+ })
+ .forEach(function (compInfo) {
+ // this used to provide $scope as a second parameter, but I couldn't find any
+ // style builders that used it, so removed it as part of moving to grid from controller
+ var ret = compInfo.func.call(self);
+
+ if (angular.isString(ret)) {
+ self.customStyles += '\n' + ret;
+ }
+ });
+ };
+
+
+ Grid.prototype.minColumnsToRender = function minColumnsToRender() {
+ var self = this;
+ var viewport = this.getViewportWidth();
+
+ var min = 0;
+ var totalWidth = 0;
+ self.columns.forEach(function(col, i) {
+ if (totalWidth < viewport) {
+ totalWidth += col.drawnWidth;
+ min++;
+ }
+ else {
+ var currWidth = 0;
+ for (var j = i; j >= i - min; j--) {
+ currWidth += self.columns[j].drawnWidth;
+ }
+ if (currWidth < viewport) {
+ min++;
+ }
+ }
+ });
+
+ return min;
+ };
+
+ Grid.prototype.getBodyHeight = function getBodyHeight() {
+ // Start with the viewportHeight
+ var bodyHeight = this.getViewportHeight();
+
+ // Add the horizontal scrollbar height if there is one
+ //if (typeof(this.horizontalScrollbarHeight) !== 'undefined' && this.horizontalScrollbarHeight !== undefined && this.horizontalScrollbarHeight > 0) {
+ // bodyHeight = bodyHeight + this.horizontalScrollbarHeight;
+ //}
+
+ return bodyHeight;
+ };
+
+ // NOTE: viewport drawable height is the height of the grid minus the header row height (including any border)
+ // TODO(c0bra): account for footer height
+ Grid.prototype.getViewportHeight = function getViewportHeight() {
+ var self = this;
+
+ var viewPortHeight = this.gridHeight - this.headerHeight - this.footerHeight;
+
+ // Account for native horizontal scrollbar, if present
+ //if (typeof(this.horizontalScrollbarHeight) !== 'undefined' && this.horizontalScrollbarHeight !== undefined && this.horizontalScrollbarHeight > 0) {
+ // viewPortHeight = viewPortHeight - this.horizontalScrollbarHeight;
+ //}
+
+ var adjustment = self.getViewportAdjustment();
+
+ viewPortHeight = viewPortHeight + adjustment.height;
+
+ //gridUtil.logDebug('viewPortHeight', viewPortHeight);
+
+ return viewPortHeight;
+ };
+
+ Grid.prototype.getViewportWidth = function getViewportWidth() {
+ var self = this;
+
+ var viewPortWidth = this.gridWidth;
+
+ //if (typeof(this.verticalScrollbarWidth) !== 'undefined' && this.verticalScrollbarWidth !== undefined && this.verticalScrollbarWidth > 0) {
+ // viewPortWidth = viewPortWidth - this.verticalScrollbarWidth;
+ //}
+
+ var adjustment = self.getViewportAdjustment();
+
+ viewPortWidth = viewPortWidth + adjustment.width;
+
+ //gridUtil.logDebug('getviewPortWidth', viewPortWidth);
+
+ return viewPortWidth;
+ };
+
+ Grid.prototype.getHeaderViewportWidth = function getHeaderViewportWidth() {
+ var viewPortWidth = this.getViewportWidth();
+
+ //if (typeof(this.verticalScrollbarWidth) !== 'undefined' && this.verticalScrollbarWidth !== undefined && this.verticalScrollbarWidth > 0) {
+ // viewPortWidth = viewPortWidth + this.verticalScrollbarWidth;
+ //}
+
+ return viewPortWidth;
+ };
+
+ Grid.prototype.addVerticalScrollSync = function (containerId, callBackFn) {
+ this.verticalScrollSyncCallBackFns[containerId] = callBackFn;
+ };
+
+ Grid.prototype.addHorizontalScrollSync = function (containerId, callBackFn) {
+ this.horizontalScrollSyncCallBackFns[containerId] = callBackFn;
+ };
+
+/**
+ * Scroll needed containers by calling their ScrollSyncs
+ * @param sourceContainerId the containerId that has already set it's top/left.
+ * can be empty string which means all containers need to set top/left
+ * @param scrollEvent
+ */
+ Grid.prototype.scrollContainers = function (sourceContainerId, scrollEvent) {
+
+ if (scrollEvent.y) {
+ //default for no container Id (ex. mousewheel means that all containers must set scrollTop/Left)
+ var verts = ['body','left', 'right'];
+
+ this.flagScrollingVertically(scrollEvent);
+
+ if (sourceContainerId === 'body') {
+ verts = ['left', 'right'];
+ }
+ else if (sourceContainerId === 'left') {
+ verts = ['body', 'right'];
+ }
+ else if (sourceContainerId === 'right') {
+ verts = ['body', 'left'];
+ }
+
+ for (var i = 0; i < verts.length; i++) {
+ var id = verts[i];
+ if (this.verticalScrollSyncCallBackFns[id]) {
+ this.verticalScrollSyncCallBackFns[id](scrollEvent);
+ }
+ }
+
+ }
+
+ if (scrollEvent.x) {
+ //default for no container Id (ex. mousewheel means that all containers must set scrollTop/Left)
+ var horizs = ['body','bodyheader', 'bodyfooter'];
+
+ this.flagScrollingHorizontally(scrollEvent);
+ if (sourceContainerId === 'body') {
+ horizs = ['bodyheader', 'bodyfooter'];
+ }
+
+ for (var j = 0; j < horizs.length; j++) {
+ var idh = horizs[j];
+ if (this.horizontalScrollSyncCallBackFns[idh]) {
+ this.horizontalScrollSyncCallBackFns[idh](scrollEvent);
+ }
+ }
+
+ }
+
+ };
+
+ Grid.prototype.registerViewportAdjuster = function registerViewportAdjuster(func) {
+ this.viewportAdjusters.push(func);
+ };
+
+ Grid.prototype.removeViewportAdjuster = function registerViewportAdjuster(func) {
+ var idx = this.viewportAdjusters.indexOf(func);
+
+ if (typeof(idx) !== 'undefined' && idx !== undefined) {
+ this.viewportAdjusters.splice(idx, 1);
+ }
+ };
+
+ Grid.prototype.getViewportAdjustment = function getViewportAdjustment() {
+ var self = this;
+
+ var adjustment = { height: 0, width: 0 };
+
+ self.viewportAdjusters.forEach(function (func) {
+ adjustment = func.call(this, adjustment);
+ });
+
+ return adjustment;
+ };
+
+ Grid.prototype.getVisibleRowCount = function getVisibleRowCount() {
+ // var count = 0;
+
+ // this.rows.forEach(function (row) {
+ // if (row.visible) {
+ // count++;
+ // }
+ // });
+
+ // return this.visibleRowCache.length;
+ return this.renderContainers.body.visibleRowCache.length;
+ };
+
+ Grid.prototype.getVisibleRows = function getVisibleRows() {
+ return this.renderContainers.body.visibleRowCache;
+ };
+
+ Grid.prototype.getVisibleColumnCount = function getVisibleColumnCount() {
+ // var count = 0;
+
+ // this.rows.forEach(function (row) {
+ // if (row.visible) {
+ // count++;
+ // }
+ // });
+
+ // return this.visibleRowCache.length;
+ return this.renderContainers.body.visibleColumnCache.length;
+ };
+
+
+ Grid.prototype.searchRows = function searchRows(renderableRows) {
+ return rowSearcher.search(this, renderableRows, this.columns);
+ };
+
+ Grid.prototype.sortByColumn = function sortByColumn(renderableRows) {
+ return rowSorter.sort(this, renderableRows, this.columns);
+ };
+
+ /**
+ * @ngdoc function
+ * @name getCellValue
+ * @methodOf ui.grid.class:Grid
+ * @description Gets the value of a cell for a particular row and column
+ * @param {GridRow} row Row to access
+ * @param {GridColumn} col Column to access
+ */
+ Grid.prototype.getCellValue = function getCellValue(row, col){
+ if ( typeof(row.entity[ '$$' + col.uid ]) !== 'undefined' ) {
+ return row.entity[ '$$' + col.uid].rendered;
+ } else if (this.options.flatEntityAccess && typeof(col.field) !== 'undefined' ){
+ return row.entity[col.field];
+ } else {
+ if (!col.cellValueGetterCache) {
+ col.cellValueGetterCache = $parse(row.getEntityQualifiedColField(col));
+ }
+
+ return col.cellValueGetterCache(row);
+ }
+ };
+
+ /**
+ * @ngdoc function
+ * @name getCellDisplayValue
+ * @methodOf ui.grid.class:Grid
+ * @description Gets the displayed value of a cell after applying any the `cellFilter`
+ * @param {GridRow} row Row to access
+ * @param {GridColumn} col Column to access
+ */
+ Grid.prototype.getCellDisplayValue = function getCellDisplayValue(row, col) {
+ if ( !col.cellDisplayGetterCache ) {
+ var custom_filter = col.cellFilter ? " | " + col.cellFilter : "";
+
+ if (typeof(row.entity['$$' + col.uid]) !== 'undefined') {
+ col.cellDisplayGetterCache = $parse(row.entity['$$' + col.uid].rendered + custom_filter);
+ } else if (this.options.flatEntityAccess && typeof(col.field) !== 'undefined') {
+ col.cellDisplayGetterCache = $parse(row.entity[col.field] + custom_filter);
+ } else {
+ col.cellDisplayGetterCache = $parse(row.getEntityQualifiedColField(col) + custom_filter);
+ }
+ }
+
+ return col.cellDisplayGetterCache(row);
+ };
+
+
+ Grid.prototype.getNextColumnSortPriority = function getNextColumnSortPriority() {
+ var self = this,
+ p = 0;
+
+ self.columns.forEach(function (col) {
+ if (col.sort && col.sort.priority && col.sort.priority > p) {
+ p = col.sort.priority;
+ }
+ });
+
+ return p + 1;
+ };
+
+ /**
+ * @ngdoc function
+ * @name resetColumnSorting
+ * @methodOf ui.grid.class:Grid
+ * @description Return the columns that the grid is currently being sorted by
+ * @param {GridColumn} [excludedColumn] Optional GridColumn to exclude from having its sorting reset
+ */
+ Grid.prototype.resetColumnSorting = function resetColumnSorting(excludeCol) {
+ var self = this;
+
+ self.columns.forEach(function (col) {
+ if (col !== excludeCol && !col.suppressRemoveSort) {
+ col.sort = {};
+ }
+ });
+ };
+
+ /**
+ * @ngdoc function
+ * @name getColumnSorting
+ * @methodOf ui.grid.class:Grid
+ * @description Return the columns that the grid is currently being sorted by
+ * @returns {Array[GridColumn]} An array of GridColumn objects
+ */
+ Grid.prototype.getColumnSorting = function getColumnSorting() {
+ var self = this;
+
+ var sortedCols = [], myCols;
+
+ // Iterate through all the columns, sorted by priority
+ // Make local copy of column list, because sorting is in-place and we do not want to
+ // change the original sequence of columns
+ myCols = self.columns.slice(0);
+ myCols.sort(rowSorter.prioritySort).forEach(function (col) {
+ if (col.sort && typeof(col.sort.direction) !== 'undefined' && col.sort.direction && (col.sort.direction === uiGridConstants.ASC || col.sort.direction === uiGridConstants.DESC)) {
+ sortedCols.push(col);
+ }
+ });
+
+ return sortedCols;
+ };
+
+ /**
+ * @ngdoc function
+ * @name sortColumn
+ * @methodOf ui.grid.class:Grid
+ * @description Set the sorting on a given column, optionally resetting any existing sorting on the Grid.
+ * Emits the sortChanged event whenever the sort criteria are changed.
+ * @param {GridColumn} column Column to set the sorting on
+ * @param {uiGridConstants.ASC|uiGridConstants.DESC} [direction] Direction to sort by, either descending or ascending.
+ * If not provided, the column will iterate through the sort directions
+ * specified in the {@link ui.grid.class:GridOptions.columnDef#sortDirectionCycle sortDirectionCycle} attribute.
+ * @param {boolean} [add] Add this column to the sorting. If not provided or set to `false`, the Grid will reset any existing sorting and sort
+ * by this column only
+ * @returns {Promise} A resolved promise that supplies the column.
+ */
+
+ Grid.prototype.sortColumn = function sortColumn(column, directionOrAdd, add) {
+ var self = this,
+ direction = null;
+
+ if (typeof(column) === 'undefined' || !column) {
+ throw new Error('No column parameter provided');
+ }
+
+ // Second argument can either be a direction or whether to add this column to the existing sort.
+ // If it's a boolean, it's an add, otherwise, it's a direction
+ if (typeof(directionOrAdd) === 'boolean') {
+ add = directionOrAdd;
+ }
+ else {
+ direction = directionOrAdd;
+ }
+
+ if (!add) {
+ self.resetColumnSorting(column);
+ column.sort.priority = 0;
+ // Get the actual priority since there may be columns which have suppressRemoveSort set
+ column.sort.priority = self.getNextColumnSortPriority();
+ }
+ else if (!column.sort.priority){
+ column.sort.priority = self.getNextColumnSortPriority();
+ }
+
+ if (!direction) {
+ // Find the current position in the cycle (or -1).
+ var i = column.sortDirectionCycle.indexOf(column.sort.direction ? column.sort.direction : null);
+ // Proceed to the next position in the cycle (or start at the beginning).
+ i = (i+1) % column.sortDirectionCycle.length;
+ // If suppressRemoveSort is set, and the next position in the cycle would
+ // remove the sort, skip it.
+ if (column.colDef && column.suppressRemoveSort && !column.sortDirectionCycle[i]) {
+ i = (i+1) % column.sortDirectionCycle.length;
+ }
+
+ if (column.sortDirectionCycle[i]) {
+ column.sort.direction = column.sortDirectionCycle[i];
+ } else {
+ column.sort = {};
+ }
+ }
+ else {
+ column.sort.direction = direction;
+ }
+
+ self.api.core.raise.sortChanged( self, self.getColumnSorting() );
+
+ return $q.when(column);
+ };
+
+ /**
+ * communicate to outside world that we are done with initial rendering
+ */
+ Grid.prototype.renderingComplete = function(){
+ if (angular.isFunction(this.options.onRegisterApi)) {
+ this.options.onRegisterApi(this.api);
+ }
+ this.api.core.raise.renderingComplete( this.api );
+ };
+
+ Grid.prototype.createRowHashMap = function createRowHashMap() {
+ var self = this;
+
+ var hashMap = new RowHashMap();
+ hashMap.grid = self;
+
+ return hashMap;
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name refresh
+ * @methodOf ui.grid.class:Grid
+ * @description Refresh the rendered grid on screen.
+ * @param {boolean} [rowsAltered] Optional flag for refreshing when the number of rows has changed.
+ */
+ Grid.prototype.refresh = function refresh(rowsAltered) {
+ var self = this;
+
+ var p1 = self.processRowsProcessors(self.rows).then(function (renderableRows) {
+ self.setVisibleRows(renderableRows);
+ });
+
+ var p2 = self.processColumnsProcessors(self.columns).then(function (renderableColumns) {
+ self.setVisibleColumns(renderableColumns);
+ });
+
+ return $q.all([p1, p2]).then(function () {
+ self.redrawInPlace(rowsAltered);
+
+ self.refreshCanvas(true);
+ });
+ };
+
+ /**
+ * @ngdoc function
+ * @name refreshRows
+ * @methodOf ui.grid.class:Grid
+ * @description Refresh the rendered rows on screen? Note: not functional at present
+ * @returns {promise} promise that is resolved when render completes?
+ *
+ */
+ Grid.prototype.refreshRows = function refreshRows() {
+ var self = this;
+
+ return self.processRowsProcessors(self.rows)
+ .then(function (renderableRows) {
+ self.setVisibleRows(renderableRows);
+
+ self.redrawInPlace();
+
+ self.refreshCanvas( true );
+ });
+ };
+
+ /**
+ * @ngdoc function
+ * @name refreshCanvas
+ * @methodOf ui.grid.class:Grid
+ * @description Builds all styles and recalculates much of the grid sizing
+ * @param {object} buildStyles optional parameter. Use TBD
+ * @returns {promise} promise that is resolved when the canvas
+ * has been refreshed
+ *
+ */
+ Grid.prototype.refreshCanvas = function(buildStyles) {
+ var self = this;
+
+ if (buildStyles) {
+ self.buildStyles();
+ }
+
+ var p = $q.defer();
+
+ // Get all the header heights
+ var containerHeadersToRecalc = [];
+ for (var containerId in self.renderContainers) {
+ if (self.renderContainers.hasOwnProperty(containerId)) {
+ var container = self.renderContainers[containerId];
+
+ // Skip containers that have no canvasWidth set yet
+ if (container.canvasWidth === null || isNaN(container.canvasWidth)) {
+ continue;
+ }
+
+ if (container.header || container.headerCanvas) {
+ container.explicitHeaderHeight = container.explicitHeaderHeight || null;
+ container.explicitHeaderCanvasHeight = container.explicitHeaderCanvasHeight || null;
+
+ containerHeadersToRecalc.push(container);
+ }
+ }
+ }
+
+ /*
+ *
+ * Here we loop through the headers, measuring each element as well as any header "canvas" it has within it.
+ *
+ * If any header is less than the largest header height, it will be resized to that so that we don't have headers
+ * with different heights, which looks like a rendering problem
+ *
+ * We'll do the same thing with the header canvases, and give the header CELLS an explicit height if their canvas
+ * is smaller than the largest canvas height. That was header cells without extra controls like filtering don't
+ * appear shorter than other cells.
+ *
+ */
+ if (containerHeadersToRecalc.length > 0) {
+ // Build the styles without the explicit header heights
+ if (buildStyles) {
+ self.buildStyles();
+ }
+
+ // Putting in a timeout as it's not calculating after the grid element is rendered and filled out
+ $timeout(function() {
+ // var oldHeaderHeight = self.grid.headerHeight;
+ // self.grid.headerHeight = gridUtil.outerElementHeight(self.header);
+
+ var rebuildStyles = false;
+
+ // Get all the header heights
+ var maxHeaderHeight = 0;
+ var maxHeaderCanvasHeight = 0;
+ var i, container;
+ var getHeight = function(oldVal, newVal){
+ if ( oldVal !== newVal){
+ rebuildStyles = true;
+ }
+ return newVal;
+ };
+ for (i = 0; i < containerHeadersToRecalc.length; i++) {
+ container = containerHeadersToRecalc[i];
+
+ // Skip containers that have no canvasWidth set yet
+ if (container.canvasWidth === null || isNaN(container.canvasWidth)) {
+ continue;
+ }
+
+ if (container.header) {
+ var headerHeight = container.headerHeight = getHeight(container.headerHeight, parseInt(gridUtil.outerElementHeight(container.header), 10));
+
+ // Get the "inner" header height, that is the height minus the top and bottom borders, if present. We'll use it to make sure all the headers have a consistent height
+ var topBorder = gridUtil.getBorderSize(container.header, 'top');
+ var bottomBorder = gridUtil.getBorderSize(container.header, 'bottom');
+ var innerHeaderHeight = parseInt(headerHeight - topBorder - bottomBorder, 10);
+
+ innerHeaderHeight = innerHeaderHeight < 0 ? 0 : innerHeaderHeight;
+
+ container.innerHeaderHeight = innerHeaderHeight;
+
+ // If the header doesn't have an explicit height set, save the largest header height for use later
+ // Explicit header heights are based off of the max we are calculating here. We never want to base the max on something we're setting explicitly
+ if (!container.explicitHeaderHeight && innerHeaderHeight > maxHeaderHeight) {
+ maxHeaderHeight = innerHeaderHeight;
+ }
+ }
+
+ if (container.headerCanvas) {
+ var headerCanvasHeight = container.headerCanvasHeight = getHeight(container.headerCanvasHeight, parseInt(gridUtil.outerElementHeight(container.headerCanvas), 10));
+
+
+ // If the header doesn't have an explicit canvas height, save the largest header canvas height for use later
+ // Explicit header heights are based off of the max we are calculating here. We never want to base the max on something we're setting explicitly
+ if (!container.explicitHeaderCanvasHeight && headerCanvasHeight > maxHeaderCanvasHeight) {
+ maxHeaderCanvasHeight = headerCanvasHeight;
+ }
+ }
+ }
+
+ // Go through all the headers
+ for (i = 0; i < containerHeadersToRecalc.length; i++) {
+ container = containerHeadersToRecalc[i];
+
+ /* If:
+ 1. We have a max header height
+ 2. This container has a header height defined
+ 3. And either this container has an explicit header height set, OR its header height is less than the max
+
+ then:
+
+ Give this container's header an explicit height so it will line up with the tallest header
+ */
+ if (
+ maxHeaderHeight > 0 && typeof(container.headerHeight) !== 'undefined' && container.headerHeight !== null &&
+ (container.explicitHeaderHeight || container.headerHeight < maxHeaderHeight)
+ ) {
+ container.explicitHeaderHeight = getHeight(container.explicitHeaderHeight, maxHeaderHeight);
+ }
+
+ // Do the same as above except for the header canvas
+ if (
+ maxHeaderCanvasHeight > 0 && typeof(container.headerCanvasHeight) !== 'undefined' && container.headerCanvasHeight !== null &&
+ (container.explicitHeaderCanvasHeight || container.headerCanvasHeight < maxHeaderCanvasHeight)
+ ) {
+ container.explicitHeaderCanvasHeight = getHeight(container.explicitHeaderCanvasHeight, maxHeaderCanvasHeight);
+ }
+ }
+
+ // Rebuild styles if the header height has changed
+ // The header height is used in body/viewport calculations and those are then used in other styles so we need it to be available
+ if (buildStyles && rebuildStyles) {
+ self.buildStyles();
+ }
+
+ p.resolve();
+ });
+ }
+ else {
+ // Timeout still needs to be here to trigger digest after styles have been rebuilt
+ $timeout(function() {
+ p.resolve();
+ });
+ }
+
+ return p.promise;
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name redrawCanvas
+ * @methodOf ui.grid.class:Grid
+ * @description Redraw the rows and columns based on our current scroll position
+ * @param {boolean} [rowsAdded] Optional to indicate rows are added and the scroll percentage must be recalculated
+ *
+ */
+ Grid.prototype.redrawInPlace = function redrawInPlace(rowsAdded) {
+ // gridUtil.logDebug('redrawInPlace');
+
+ var self = this;
+
+ for (var i in self.renderContainers) {
+ var container = self.renderContainers[i];
+
+ // gridUtil.logDebug('redrawing container', i);
+
+ if (rowsAdded) {
+ container.adjustRows(container.prevScrollTop, null);
+ container.adjustColumns(container.prevScrollLeft, null);
+ }
+ else {
+ container.adjustRows(null, container.prevScrolltopPercentage);
+ container.adjustColumns(null, container.prevScrollleftPercentage);
+ }
+ }
+ };
+
+ /**
+ * @ngdoc function
+ * @name hasLeftContainerColumns
+ * @methodOf ui.grid.class:Grid
+ * @description returns true if leftContainer has columns
+ */
+ Grid.prototype.hasLeftContainerColumns = function () {
+ return this.hasLeftContainer() && this.renderContainers.left.renderedColumns.length > 0;
+ };
+
+ /**
+ * @ngdoc function
+ * @name hasRightContainerColumns
+ * @methodOf ui.grid.class:Grid
+ * @description returns true if rightContainer has columns
+ */
+ Grid.prototype.hasRightContainerColumns = function () {
+ return this.hasRightContainer() && this.renderContainers.right.renderedColumns.length > 0;
+ };
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:Grid
+ * @name scrollToIfNecessary
+ * @description Scrolls the grid to make a certain row and column combo visible,
+ * in the case that it is not completely visible on the screen already.
+ * @param {GridRow} gridRow row to make visible
+ * @param {GridCol} gridCol column to make visible
+ * @returns {promise} a promise that is resolved when scrolling is complete
+ */
+ Grid.prototype.scrollToIfNecessary = function (gridRow, gridCol) {
+ var self = this;
+
+ var scrollEvent = new ScrollEvent(self, 'uiGrid.scrollToIfNecessary');
+
+ // Alias the visible row and column caches
+ var visRowCache = self.renderContainers.body.visibleRowCache;
+ var visColCache = self.renderContainers.body.visibleColumnCache;
+
+ /*-- Get the top, left, right, and bottom "scrolled" edges of the grid --*/
+
+ // The top boundary is the current Y scroll position PLUS the header height, because the header can obscure rows when the grid is scrolled downwards
+ var topBound = self.renderContainers.body.prevScrollTop + self.headerHeight;
+
+ // Don't the let top boundary be less than 0
+ topBound = (topBound < 0) ? 0 : topBound;
+
+ // The left boundary is the current X scroll position
+ var leftBound = self.renderContainers.body.prevScrollLeft;
+
+ // The bottom boundary is the current Y scroll position, plus the height of the grid, but minus the header height.
+ // Basically this is the viewport height added on to the scroll position
+ var bottomBound = self.renderContainers.body.prevScrollTop + self.gridHeight - self.renderContainers.body.headerHeight - self.footerHeight - self.scrollbarWidth;
+
+ // If there's a horizontal scrollbar, remove its height from the bottom boundary, otherwise we'll be letting it obscure rows
+ //if (self.horizontalScrollbarHeight) {
+ // bottomBound = bottomBound - self.horizontalScrollbarHeight;
+ //}
+
+ // The right position is the current X scroll position minus the grid width
+ var rightBound = self.renderContainers.body.prevScrollLeft + Math.ceil(self.renderContainers.body.getViewportWidth());
+
+ // If there's a vertical scrollbar, subtract it from the right boundary or we'll allow it to obscure cells
+ //if (self.verticalScrollbarWidth) {
+ // rightBound = rightBound - self.verticalScrollbarWidth;
+ //}
+
+ // We were given a row to scroll to
+ if (gridRow !== null) {
+ // This is the index of the row we want to scroll to, within the list of rows that can be visible
+ var seekRowIndex = visRowCache.indexOf(gridRow);
+
+ // Total vertical scroll length of the grid
+ var scrollLength = (self.renderContainers.body.getCanvasHeight() - self.renderContainers.body.getViewportHeight());
+
+ // Add the height of the native horizontal scrollbar to the scroll length, if it's there. Otherwise it will mask over the final row
+ //if (self.horizontalScrollbarHeight && self.horizontalScrollbarHeight > 0) {
+ // scrollLength = scrollLength + self.horizontalScrollbarHeight;
+ //}
+
+ // This is the minimum amount of pixels we need to scroll vertical in order to see this row.
+ var pixelsToSeeRow = ((seekRowIndex + 1) * self.options.rowHeight);
+
+ // Don't let the pixels required to see the row be less than zero
+ pixelsToSeeRow = (pixelsToSeeRow < 0) ? 0 : pixelsToSeeRow;
+
+ var scrollPixels, percentage;
+
+ // If the scroll position we need to see the row is LESS than the top boundary, i.e. obscured above the top of the self...
+ if (pixelsToSeeRow < topBound) {
+ // Get the different between the top boundary and the required scroll position and subtract it from the current scroll position\
+ // to get the full position we need
+ scrollPixels = self.renderContainers.body.prevScrollTop - (topBound - pixelsToSeeRow);
+
+ // Turn the scroll position into a percentage and make it an argument for a scroll event
+ percentage = scrollPixels / scrollLength;
+ scrollEvent.y = { percentage: percentage };
+ }
+ // Otherwise if the scroll position we need to see the row is MORE than the bottom boundary, i.e. obscured below the bottom of the self...
+ else if (pixelsToSeeRow > bottomBound) {
+ // Get the different between the bottom boundary and the required scroll position and add it to the current scroll position
+ // to get the full position we need
+ scrollPixels = pixelsToSeeRow - bottomBound + self.renderContainers.body.prevScrollTop;
+
+ // Turn the scroll position into a percentage and make it an argument for a scroll event
+ percentage = scrollPixels / scrollLength;
+ scrollEvent.y = { percentage: percentage };
+ }
+ }
+
+ // We were given a column to scroll to
+ if (gridCol !== null) {
+ // This is the index of the row we want to scroll to, within the list of rows that can be visible
+ var seekColumnIndex = visColCache.indexOf(gridCol);
+
+ // Total vertical scroll length of the grid
+ var horizScrollLength = (self.renderContainers.body.getCanvasWidth() - self.renderContainers.body.getViewportWidth());
+
+ // Add the height of the native horizontal scrollbar to the scroll length, if it's there. Otherwise it will mask over the final row
+ // if (self.verticalScrollbarWidth && self.verticalScrollbarWidth > 0) {
+ // horizScrollLength = horizScrollLength + self.verticalScrollbarWidth;
+ // }
+
+ // This is the minimum amount of pixels we need to scroll vertical in order to see this column
+ var columnLeftEdge = 0;
+ for (var i = 0; i < seekColumnIndex; i++) {
+ var col = visColCache[i];
+ columnLeftEdge += col.drawnWidth;
+ }
+ columnLeftEdge = (columnLeftEdge < 0) ? 0 : columnLeftEdge;
+
+ var columnRightEdge = columnLeftEdge + gridCol.drawnWidth;
+
+ // Don't let the pixels required to see the column be less than zero
+ columnRightEdge = (columnRightEdge < 0) ? 0 : columnRightEdge;
+
+ var horizScrollPixels, horizPercentage;
+
+ // If the scroll position we need to see the row is LESS than the top boundary, i.e. obscured above the top of the self...
+ if (columnLeftEdge < leftBound) {
+ // Get the different between the top boundary and the required scroll position and subtract it from the current scroll position\
+ // to get the full position we need
+ horizScrollPixels = self.renderContainers.body.prevScrollLeft - (leftBound - columnLeftEdge);
+
+ // Turn the scroll position into a percentage and make it an argument for a scroll event
+ horizPercentage = horizScrollPixels / horizScrollLength;
+ horizPercentage = (horizPercentage > 1) ? 1 : horizPercentage;
+ scrollEvent.x = { percentage: horizPercentage };
+ }
+ // Otherwise if the scroll position we need to see the row is MORE than the bottom boundary, i.e. obscured below the bottom of the self...
+ else if (columnRightEdge > rightBound) {
+ // Get the different between the bottom boundary and the required scroll position and add it to the current scroll position
+ // to get the full position we need
+ horizScrollPixels = columnRightEdge - rightBound + self.renderContainers.body.prevScrollLeft;
+
+ // Turn the scroll position into a percentage and make it an argument for a scroll event
+ horizPercentage = horizScrollPixels / horizScrollLength;
+ horizPercentage = (horizPercentage > 1) ? 1 : horizPercentage;
+ scrollEvent.x = { percentage: horizPercentage };
+ }
+ }
+
+ var deferred = $q.defer();
+
+ // If we need to scroll on either the x or y axes, fire a scroll event
+ if (scrollEvent.y || scrollEvent.x) {
+ scrollEvent.withDelay = false;
+ self.scrollContainers('',scrollEvent);
+ var dereg = self.api.core.on.scrollEnd(null,function() {
+ deferred.resolve(scrollEvent);
+ dereg();
+ });
+ }
+ else {
+ deferred.resolve();
+ }
+
+ return deferred.promise;
+ };
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:Grid
+ * @name scrollTo
+ * @description Scroll the grid such that the specified
+ * row and column is in view
+ * @param {object} rowEntity gridOptions.data[] array instance to make visible
+ * @param {object} colDef to make visible
+ * @returns {promise} a promise that is resolved after any scrolling is finished
+ */
+ Grid.prototype.scrollTo = function (rowEntity, colDef) {
+ var gridRow = null, gridCol = null;
+
+ if (rowEntity !== null && typeof(rowEntity) !== 'undefined' ) {
+ gridRow = this.getRow(rowEntity);
+ }
+
+ if (colDef !== null && typeof(colDef) !== 'undefined' ) {
+ gridCol = this.getColumn(colDef.name ? colDef.name : colDef.field);
+ }
+ return this.scrollToIfNecessary(gridRow, gridCol);
+ };
+
+ /**
+ * @ngdoc function
+ * @name clearAllFilters
+ * @methodOf ui.grid.class:Grid
+ * @description Clears all filters and optionally refreshes the visible rows.
+ * @param {object} refreshRows Defaults to true.
+ * @param {object} clearConditions Defaults to false.
+ * @param {object} clearFlags Defaults to false.
+ * @returns {promise} If `refreshRows` is true, returns a promise of the rows refreshing.
+ */
+ Grid.prototype.clearAllFilters = function clearAllFilters(refreshRows, clearConditions, clearFlags) {
+ // Default `refreshRows` to true because it will be the most commonly desired behaviour.
+ if (refreshRows === undefined) {
+ refreshRows = true;
+ }
+ if (clearConditions === undefined) {
+ clearConditions = false;
+ }
+ if (clearFlags === undefined) {
+ clearFlags = false;
+ }
+
+ this.columns.forEach(function(column) {
+ column.filters.forEach(function(filter) {
+ filter.term = undefined;
+
+ if (clearConditions) {
+ filter.condition = undefined;
+ }
+
+ if (clearFlags) {
+ filter.flags = undefined;
+ }
+ });
+ });
+
+ if (refreshRows) {
+ return this.refreshRows();
+ }
+ };
+
+
+ // Blatantly stolen from Angular as it isn't exposed (yet? 2.0?)
+ function RowHashMap() {}
+
+ RowHashMap.prototype = {
+ /**
+ * Store key value pair
+ * @param key key to store can be any type
+ * @param value value to store can be any type
+ */
+ put: function(key, value) {
+ this[this.grid.options.rowIdentity(key)] = value;
+ },
+
+ /**
+ * @param key
+ * @returns {Object} the value for the key
+ */
+ get: function(key) {
+ return this[this.grid.options.rowIdentity(key)];
+ },
+
+ /**
+ * Remove the key/value pair
+ * @param key
+ */
+ remove: function(key) {
+ var value = this[key = this.grid.options.rowIdentity(key)];
+ delete this[key];
+ return value;
+ }
+ };
+
+
+
+ return Grid;
+
+}]);
+
+})();
+
+(function () {
+
+ angular.module('ui.grid')
+ .factory('GridApi', ['$q', '$rootScope', 'gridUtil', 'uiGridConstants', 'GridRow', 'uiGridGridMenuService',
+ function ($q, $rootScope, gridUtil, uiGridConstants, GridRow, uiGridGridMenuService) {
+ /**
+ * @ngdoc function
+ * @name ui.grid.class:GridApi
+ * @description GridApi provides the ability to register public methods events inside the grid and allow
+ * for other components to use the api via featureName.raise.methodName and featureName.on.eventName(function(args){}.
+ * <br/>
+ * To listen to events, you must add a callback to gridOptions.onRegisterApi
+ * <pre>
+ * $scope.gridOptions.onRegisterApi = function(gridApi){
+ * gridApi.cellNav.on.navigate($scope,function(newRowCol, oldRowCol){
+ * $log.log('navigation event');
+ * });
+ * };
+ * </pre>
+ * @param {object} grid grid that owns api
+ */
+ var GridApi = function GridApi(grid) {
+ this.grid = grid;
+ this.listeners = [];
+
+ /**
+ * @ngdoc function
+ * @name renderingComplete
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Rendering is complete, called at the same
+ * time as `onRegisterApi`, but provides a way to obtain
+ * that same event within features without stopping end
+ * users from getting at the onRegisterApi method.
+ *
+ * Included in gridApi so that it's always there - otherwise
+ * there is still a timing problem with when a feature can
+ * call this.
+ *
+ * @param {GridApi} gridApi the grid api, as normally
+ * returned in the onRegisterApi method
+ *
+ * @example
+ * <pre>
+ * gridApi.core.on.renderingComplete( grid );
+ * </pre>
+ */
+ this.registerEvent( 'core', 'renderingComplete' );
+
+ /**
+ * @ngdoc event
+ * @name filterChanged
+ * @eventOf ui.grid.core.api:PublicApi
+ * @description is raised after the filter is changed. The nature
+ * of the watch expression doesn't allow notification of what changed,
+ * so the receiver of this event will need to re-extract the filter
+ * conditions from the columns.
+ *
+ */
+ this.registerEvent( 'core', 'filterChanged' );
+
+ /**
+ * @ngdoc function
+ * @name setRowInvisible
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Sets an override on the row to make it always invisible,
+ * which will override any filtering or other visibility calculations.
+ * If the row is currently visible then sets it to invisible and calls
+ * both grid refresh and emits the rowsVisibleChanged event
+ * @param {object} rowEntity gridOptions.data[] array instance
+ */
+ this.registerMethod( 'core', 'setRowInvisible', GridRow.prototype.setRowInvisible );
+
+ /**
+ * @ngdoc function
+ * @name clearRowInvisible
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Clears any override on visibility for the row so that it returns to
+ * using normal filtering and other visibility calculations.
+ * If the row is currently invisible then sets it to visible and calls
+ * both grid refresh and emits the rowsVisibleChanged event
+ * TODO: if a filter is active then we can't just set it to visible?
+ * @param {object} rowEntity gridOptions.data[] array instance
+ */
+ this.registerMethod( 'core', 'clearRowInvisible', GridRow.prototype.clearRowInvisible );
+
+ /**
+ * @ngdoc function
+ * @name getVisibleRows
+ * @methodOf ui.grid.core.api:PublicApi
+ * @description Returns all visible rows
+ * @param {Grid} grid the grid you want to get visible rows from
+ * @returns {array} an array of gridRow
+ */
+ this.registerMethod( 'core', 'getVisibleRows', this.grid.getVisibleRows );
+
+ /**
+ * @ngdoc event
+ * @name rowsVisibleChanged
+ * @eventOf ui.grid.core.api:PublicApi
+ * @description is raised after the rows that are visible
+ * change. The filtering is zero-based, so it isn't possible
+ * to say which rows changed (unlike in the selection feature).
+ * We can plausibly know which row was changed when setRowInvisible
+ * is called, but in that situation the user already knows which row
+ * they changed. When a filter runs we don't know what changed,
+ * and that is the one that would have been useful.
+ *
+ */
+ this.registerEvent( 'core', 'rowsVisibleChanged' );
+
+ /**
+ * @ngdoc event
+ * @name rowsRendered
+ * @eventOf ui.grid.core.api:PublicApi
+ * @description is raised after the cache of visible rows is changed.
+ */
+ this.registerEvent( 'core', 'rowsRendered' );
+
+
+ /**
+ * @ngdoc event
+ * @name scrollBegin
+ * @eventOf ui.grid.core.api:PublicApi
+ * @description is raised when scroll begins. Is throttled, so won't be raised too frequently
+ */
+ this.registerEvent( 'core', 'scrollBegin' );
+
+ /**
+ * @ngdoc event
+ * @name scrollEnd
+ * @eventOf ui.grid.core.api:PublicApi
+ * @description is raised when scroll has finished. Is throttled, so won't be raised too frequently
+ */
+ this.registerEvent( 'core', 'scrollEnd' );
+
+ /**
+ * @ngdoc event
+ * @name canvasHeightChanged
+ * @eventOf ui.grid.core.api:PublicApi
+ * @description is raised when the canvas height has changed
+ * <br/>
+ * arguments: oldHeight, newHeight
+ */
+ this.registerEvent( 'core', 'canvasHeightChanged');
+ };
+
+ /**
+ * @ngdoc function
+ * @name ui.grid.class:suppressEvents
+ * @methodOf ui.grid.class:GridApi
+ * @description Used to execute a function while disabling the specified event listeners.
+ * Disables the listenerFunctions, executes the callbackFn, and then enables
+ * the listenerFunctions again
+ * @param {object} listenerFuncs listenerFunc or array of listenerFuncs to suppress. These must be the same
+ * functions that were used in the .on.eventName method
+ * @param {object} callBackFn function to execute
+ * @example
+ * <pre>
+ * var navigate = function (newRowCol, oldRowCol){
+ * //do something on navigate
+ * }
+ *
+ * gridApi.cellNav.on.navigate(scope,navigate);
+ *
+ *
+ * //call the scrollTo event and suppress our navigate listener
+ * //scrollTo will still raise the event for other listeners
+ * gridApi.suppressEvents(navigate, function(){
+ * gridApi.cellNav.scrollTo(aRow, aCol);
+ * });
+ *
+ * </pre>
+ */
+ GridApi.prototype.suppressEvents = function (listenerFuncs, callBackFn) {
+ var self = this;
+ var listeners = angular.isArray(listenerFuncs) ? listenerFuncs : [listenerFuncs];
+
+ //find all registered listeners
+ var foundListeners = self.listeners.filter(function(listener) {
+ return listeners.some(function(l) {
+ return listener.handler === l;
+ });
+ });
+
+ //deregister all the listeners
+ foundListeners.forEach(function(l){
+ l.dereg();
+ });
+
+ callBackFn();
+
+ //reregister all the listeners
+ foundListeners.forEach(function(l){
+ l.dereg = registerEventWithAngular(l.eventId, l.handler, self.grid, l._this);
+ });
+
+ };
+
+ /**
+ * @ngdoc function
+ * @name registerEvent
+ * @methodOf ui.grid.class:GridApi
+ * @description Registers a new event for the given feature. The event will get a
+ * .raise and .on prepended to it
+ * <br>
+ * .raise.eventName() - takes no arguments
+ * <br/>
+ * <br/>
+ * .on.eventName(scope, callBackFn, _this)
+ * <br/>
+ * scope - a scope reference to add a deregister call to the scopes .$on('destroy'). Scope is optional and can be a null value,
+ * but in this case you must deregister it yourself via the returned deregister function
+ * <br/>
+ * callBackFn - The function to call
+ * <br/>
+ * _this - optional this context variable for callbackFn. If omitted, grid.api will be used for the context
+ * <br/>
+ * .on.eventName returns a dereg funtion that will remove the listener. It's not necessary to use it as the listener
+ * will be removed when the scope is destroyed.
+ * @param {string} featureName name of the feature that raises the event
+ * @param {string} eventName name of the event
+ */
+ GridApi.prototype.registerEvent = function (featureName, eventName) {
+ var self = this;
+ if (!self[featureName]) {
+ self[featureName] = {};
+ }
+
+ var feature = self[featureName];
+ if (!feature.on) {
+ feature.on = {};
+ feature.raise = {};
+ }
+
+ var eventId = self.grid.id + featureName + eventName;
+
+ // gridUtil.logDebug('Creating raise event method ' + featureName + '.raise.' + eventName);
+ feature.raise[eventName] = function () {
+ $rootScope.$emit.apply($rootScope, [eventId].concat(Array.prototype.slice.call(arguments)));
+ };
+
+ // gridUtil.logDebug('Creating on event method ' + featureName + '.on.' + eventName);
+ feature.on[eventName] = function (scope, handler, _this) {
+ if ( scope !== null && typeof(scope.$on) === 'undefined' ){
+ gridUtil.logError('asked to listen on ' + featureName + '.on.' + eventName + ' but scope wasn\'t passed in the input parameters. It is legitimate to pass null, but you\'ve passed something else, so you probably forgot to provide scope rather than did it deliberately, not registering');
+ return;
+ }
+ var deregAngularOn = registerEventWithAngular(eventId, handler, self.grid, _this);
+
+ //track our listener so we can turn off and on
+ var listener = {handler: handler, dereg: deregAngularOn, eventId: eventId, scope: scope, _this:_this};
+ self.listeners.push(listener);
+
+ var removeListener = function(){
+ listener.dereg();
+ var index = self.listeners.indexOf(listener);
+ self.listeners.splice(index,1);
+ };
+
+ //destroy tracking when scope is destroyed
+ if (scope) {
+ scope.$on('$destroy', function() {
+ removeListener();
+ });
+ }
+
+
+ return removeListener;
+ };
+ };
+
+ function registerEventWithAngular(eventId, handler, grid, _this) {
+ return $rootScope.$on(eventId, function (event) {
+ var args = Array.prototype.slice.call(arguments);
+ args.splice(0, 1); //remove evt argument
+ handler.apply(_this ? _this : grid.api, args);
+ });
+ }
+
+ /**
+ * @ngdoc function
+ * @name registerEventsFromObject
+ * @methodOf ui.grid.class:GridApi
+ * @description Registers features and events from a simple objectMap.
+ * eventObjectMap must be in this format (multiple features allowed)
+ * <pre>
+ * {featureName:
+ * {
+ * eventNameOne:function(args){},
+ * eventNameTwo:function(args){}
+ * }
+ * }
+ * </pre>
+ * @param {object} eventObjectMap map of feature/event names
+ */
+ GridApi.prototype.registerEventsFromObject = function (eventObjectMap) {
+ var self = this;
+ var features = [];
+ angular.forEach(eventObjectMap, function (featProp, featPropName) {
+ var feature = {name: featPropName, events: []};
+ angular.forEach(featProp, function (prop, propName) {
+ feature.events.push(propName);
+ });
+ features.push(feature);
+ });
+
+ features.forEach(function (feature) {
+ feature.events.forEach(function (event) {
+ self.registerEvent(feature.name, event);
+ });
+ });
+
+ };
+
+ /**
+ * @ngdoc function
+ * @name registerMethod
+ * @methodOf ui.grid.class:GridApi
+ * @description Registers a new event for the given feature
+ * @param {string} featureName name of the feature
+ * @param {string} methodName name of the method
+ * @param {object} callBackFn function to execute
+ * @param {object} _this binds callBackFn 'this' to _this. Defaults to gridApi.grid
+ */
+ GridApi.prototype.registerMethod = function (featureName, methodName, callBackFn, _this) {
+ if (!this[featureName]) {
+ this[featureName] = {};
+ }
+
+ var feature = this[featureName];
+
+ feature[methodName] = gridUtil.createBoundedWrapper(_this || this.grid, callBackFn);
+ };
+
+ /**
+ * @ngdoc function
+ * @name registerMethodsFromObject
+ * @methodOf ui.grid.class:GridApi
+ * @description Registers features and methods from a simple objectMap.
+ * eventObjectMap must be in this format (multiple features allowed)
+ * <br>
+ * {featureName:
+ * {
+ * methodNameOne:function(args){},
+ * methodNameTwo:function(args){}
+ * }
+ * @param {object} eventObjectMap map of feature/event names
+ * @param {object} _this binds this to _this for all functions. Defaults to gridApi.grid
+ */
+ GridApi.prototype.registerMethodsFromObject = function (methodMap, _this) {
+ var self = this;
+ var features = [];
+ angular.forEach(methodMap, function (featProp, featPropName) {
+ var feature = {name: featPropName, methods: []};
+ angular.forEach(featProp, function (prop, propName) {
+ feature.methods.push({name: propName, fn: prop});
+ });
+ features.push(feature);
+ });
+
+ features.forEach(function (feature) {
+ feature.methods.forEach(function (method) {
+ self.registerMethod(feature.name, method.name, method.fn, _this);
+ });
+ });
+
+ };
+
+ return GridApi;
+
+ }]);
+
+})();
+
+(function(){
+
+angular.module('ui.grid')
+.factory('GridColumn', ['gridUtil', 'uiGridConstants', 'i18nService', function(gridUtil, uiGridConstants, i18nService) {
+
+ /**
+ * ******************************************************************************************
+ * PaulL1: Ugly hack here in documentation. These properties are clearly properties of GridColumn,
+ * and need to be noted as such for those extending and building ui-grid itself.
+ * However, from an end-developer perspective, they interact with all these through columnDefs,
+ * and they really need to be documented there. I feel like they're relatively static, and
+ * I can't find an elegant way for ngDoc to reference to both....so I've duplicated each
+ * comment block. Ugh.
+ *
+ */
+
+ /**
+ * @ngdoc property
+ * @name name
+ * @propertyOf ui.grid.class:GridColumn
+ * @description (mandatory) each column should have a name, although for backward
+ * compatibility with 2.x name can be omitted if field is present
+ *
+ */
+
+ /**
+ * @ngdoc property
+ * @name name
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description (mandatory) each column should have a name, although for backward
+ * compatibility with 2.x name can be omitted if field is present
+ *
+ */
+
+ /**
+ * @ngdoc property
+ * @name displayName
+ * @propertyOf ui.grid.class:GridColumn
+ * @description Column name that will be shown in the header. If displayName is not
+ * provided then one is generated using the name.
+ *
+ */
+
+ /**
+ * @ngdoc property
+ * @name displayName
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description Column name that will be shown in the header. If displayName is not
+ * provided then one is generated using the name.
+ *
+ */
+
+ /**
+ * @ngdoc property
+ * @name field
+ * @propertyOf ui.grid.class:GridColumn
+ * @description field must be provided if you wish to bind to a
+ * property in the data source. Should be an angular expression that evaluates against grid.options.data
+ * array element. Can be a complex expression: <code>employee.address.city</code>, or can be a function: <code>employee.getFullAddress()</code>.
+ * See the angular docs on binding expressions.
+ *
+ */
+
+ /**
+ * @ngdoc property
+ * @name field
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description field must be provided if you wish to bind to a
+ * property in the data source. Should be an angular expression that evaluates against grid.options.data
+ * array element. Can be a complex expression: <code>employee.address.city</code>, or can be a function: <code>employee.getFullAddress()</code>. * See the angular docs on binding expressions. *
+ */
+
+ /**
+ * @ngdoc property
+ * @name filter
+ * @propertyOf ui.grid.class:GridColumn
+ * @description Filter on this column.
+ * @example
+ * <pre>{ term: 'text', condition: uiGridConstants.filter.STARTS_WITH, placeholder: 'type to filter...', ariaLabel: 'Filter for text', flags: { caseSensitive: false }, type: uiGridConstants.filter.SELECT, [ { value: 1, label: 'male' }, { value: 2, label: 'female' } ] }</pre>
+ *
+ */
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.class:GridColumn
+ * @description Represents the viewModel for each column. Any state or methods needed for a Grid Column
+ * are defined on this prototype
+ * @param {ColumnDef} colDef the column def to associate with this column
+ * @param {number} uid the unique and immutable uid we'd like to allocate to this column
+ * @param {Grid} grid the grid we'd like to create this column in
+ */
+ function GridColumn(colDef, uid, grid) {
+ var self = this;
+
+ self.grid = grid;
+ self.uid = uid;
+
+ self.updateColumnDef(colDef, true);
+
+ /**
+ * @ngdoc function
+ * @name hideColumn
+ * @methodOf ui.grid.class:GridColumn
+ * @description Hides the column by setting colDef.visible = false
+ */
+ GridColumn.prototype.hideColumn = function() {
+ this.colDef.visible = false;
+ };
+
+ self.aggregationValue = undefined;
+
+ // The footer cell registers to listen for the rowsRendered event, and calls this. Needed to be
+ // in something with a scope so that the dereg would get called
+ self.updateAggregationValue = function() {
+
+ // gridUtil.logDebug('getAggregationValue for Column ' + self.colDef.name);
+
+ /**
+ * @ngdoc property
+ * @name aggregationType
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description The aggregation that you'd like to show in the columnFooter for this
+ * column. Valid values are in uiGridConstants, and currently include `uiGridConstants.aggregationTypes.count`,
+ * `uiGridConstants.aggregationTypes.sum`, `uiGridConstants.aggregationTypes.avg`, `uiGridConstants.aggregationTypes.min`,
+ * `uiGridConstants.aggregationTypes.max`.
+ *
+ * You can also provide a function as the aggregation type, in this case your function needs to accept the full
+ * set of visible rows, and return a value that should be shown
+ */
+ if (!self.aggregationType) {
+ self.aggregationValue = undefined;
+ return;
+ }
+
+ var result = 0;
+ var visibleRows = self.grid.getVisibleRows();
+
+ var cellValues = function(){
+ var values = [];
+ visibleRows.forEach(function (row) {
+ var cellValue = self.grid.getCellValue(row, self);
+ var cellNumber = Number(cellValue);
+ if (!isNaN(cellNumber)) {
+ values.push(cellNumber);
+ }
+ });
+ return values;
+ };
+
+ if (angular.isFunction(self.aggregationType)) {
+ self.aggregationValue = self.aggregationType(visibleRows, self);
+ }
+ else if (self.aggregationType === uiGridConstants.aggregationTypes.count) {
+ self.aggregationValue = self.grid.getVisibleRowCount();
+ }
+ else if (self.aggregationType === uiGridConstants.aggregationTypes.sum) {
+ cellValues().forEach(function (value) {
+ result += value;
+ });
+ self.aggregationValue = result;
+ }
+ else if (self.aggregationType === uiGridConstants.aggregationTypes.avg) {
+ cellValues().forEach(function (value) {
+ result += value;
+ });
+ result = result / cellValues().length;
+ self.aggregationValue = result;
+ }
+ else if (self.aggregationType === uiGridConstants.aggregationTypes.min) {
+ self.aggregationValue = Math.min.apply(null, cellValues());
+ }
+ else if (self.aggregationType === uiGridConstants.aggregationTypes.max) {
+ self.aggregationValue = Math.max.apply(null, cellValues());
+ }
+ else {
+ self.aggregationValue = '\u00A0';
+ }
+ };
+
+// var throttledUpdateAggregationValue = gridUtil.throttle(updateAggregationValue, self.grid.options.aggregationCalcThrottle, { trailing: true, context: self.name });
+
+ /**
+ * @ngdoc function
+ * @name getAggregationValue
+ * @methodOf ui.grid.class:GridColumn
+ * @description gets the aggregation value based on the aggregation type for this column.
+ * Debounced using scrollDebounce option setting
+ */
+ this.getAggregationValue = function() {
+// if (!self.grid.isScrollingVertically && !self.grid.isScrollingHorizontally) {
+// throttledUpdateAggregationValue();
+// }
+
+ return self.aggregationValue;
+ };
+ }
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:GridColumn
+ * @name setPropertyOrDefault
+ * @description Sets a property on the column using the passed in columnDef, and
+ * setting the defaultValue if the value cannot be found on the colDef
+ * @param {ColumnDef} colDef the column def to look in for the property value
+ * @param {string} propName the property name we'd like to set
+ * @param {object} defaultValue the value to use if the colDef doesn't provide the setting
+ */
+ GridColumn.prototype.setPropertyOrDefault = function (colDef, propName, defaultValue) {
+ var self = this;
+
+ // Use the column definition filter if we were passed it
+ if (typeof(colDef[propName]) !== 'undefined' && colDef[propName]) {
+ self[propName] = colDef[propName];
+ }
+ // Otherwise use our own if it's set
+ else if (typeof(self[propName]) !== 'undefined') {
+ self[propName] = self[propName];
+ }
+ // Default to empty object for the filter
+ else {
+ self[propName] = defaultValue ? defaultValue : {};
+ }
+ };
+
+
+
+ /**
+ * @ngdoc property
+ * @name width
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description sets the column width. Can be either
+ * a number or a percentage, or an * for auto.
+ * @example
+ * <pre> $scope.gridOptions.columnDefs = [ { field: 'field1', width: 100},
+ * { field: 'field2', width: '20%'},
+ * { field: 'field3', width: '*' }]; </pre>
+ *
+ */
+
+ /**
+ * @ngdoc property
+ * @name minWidth
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description sets the minimum column width. Should be a number.
+ * @example
+ * <pre> $scope.gridOptions.columnDefs = [ { field: 'field1', minWidth: 100}]; </pre>
+ *
+ */
+
+ /**
+ * @ngdoc property
+ * @name maxWidth
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description sets the maximum column width. Should be a number.
+ * @example
+ * <pre> $scope.gridOptions.columnDefs = [ { field: 'field1', maxWidth: 100}]; </pre>
+ *
+ */
+
+ /**
+ * @ngdoc property
+ * @name visible
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description sets whether or not the column is visible
+ * </br>Default is true
+ * @example
+ * <pre> $scope.gridOptions.columnDefs = [
+ * { field: 'field1', visible: true},
+ * { field: 'field2', visible: false }
+ * ]; </pre>
+ *
+ */
+
+ /**
+ * @ngdoc property
+ * @name sort
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description An object of sort information, attributes are:
+ *
+ * - direction: values are uiGridConstants.ASC or uiGridConstants.DESC
+ * - ignoreSort: if set to true this sort is ignored (used by tree to manipulate the sort functionality)
+ * - priority: says what order to sort the columns in (lower priority gets sorted first).
+ * @example
+ * <pre>
+ * $scope.gridOptions.columnDefs = [{
+ * field: 'field1',
+ * sort: {
+ * direction: uiGridConstants.ASC,
+ * ignoreSort: true,
+ * priority: 0
+ * }
+ * }];
+ * </pre>
+ */
+
+
+ /**
+ * @ngdoc property
+ * @name sortingAlgorithm
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description Algorithm to use for sorting this column. Takes 'a' and 'b' parameters
+ * like any normal sorting function with additional 'rowA', 'rowB', and 'direction' parameters
+ * that are the row objects and the current direction of the sort respectively.
+ *
+ */
+
+ /**
+ * @ngdoc array
+ * @name filters
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description Specify multiple filter fields.
+ * @example
+ * <pre>$scope.gridOptions.columnDefs = [
+ * {
+ * field: 'field1', filters: [
+ * {
+ * term: 'aa',
+ * condition: uiGridConstants.filter.STARTS_WITH,
+ * placeholder: 'starts with...',
+ * ariaLabel: 'Filter for field1',
+ * flags: { caseSensitive: false },
+ * type: uiGridConstants.filter.SELECT,
+ * selectOptions: [ { value: 1, label: 'male' }, { value: 2, label: 'female' } ]
+ * },
+ * {
+ * condition: uiGridConstants.filter.ENDS_WITH,
+ * placeholder: 'ends with...'
+ * }
+ * ]
+ * }
+ * ]; </pre>
+ *
+ *
+ */
+
+ /**
+ * @ngdoc array
+ * @name filters
+ * @propertyOf ui.grid.class:GridColumn
+ * @description Filters for this column. Includes 'term' property bound to filter input elements.
+ * @example
+ * <pre>[
+ * {
+ * term: 'foo', // ngModel for <input>
+ * condition: uiGridConstants.filter.STARTS_WITH,
+ * placeholder: 'starts with...',
+ * ariaLabel: 'Filter for foo',
+ * flags: { caseSensitive: false },
+ * type: uiGridConstants.filter.SELECT,
+ * selectOptions: [ { value: 1, label: 'male' }, { value: 2, label: 'female' } ]
+ * },
+ * {
+ * term: 'baz',
+ * condition: uiGridConstants.filter.ENDS_WITH,
+ * placeholder: 'ends with...'
+ * }
+ * ] </pre>
+ *
+ *
+ */
+
+ /**
+ * @ngdoc array
+ * @name menuItems
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description used to add menu items to a column. Refer to the tutorial on this
+ * functionality. A number of settings are supported:
+ *
+ * - title: controls the title that is displayed in the menu
+ * - icon: the icon shown alongside that title
+ * - action: the method to call when the menu is clicked
+ * - shown: a function to evaluate to determine whether or not to show the item
+ * - active: a function to evaluate to determine whether or not the item is currently selected
+ * - context: context to pass to the action function, available in this.context in your handler
+ * - leaveOpen: if set to true, the menu should stay open after the action, defaults to false
+ * @example
+ * <pre> $scope.gridOptions.columnDefs = [
+ * { field: 'field1', menuItems: [
+ * {
+ * title: 'Outer Scope Alert',
+ * icon: 'ui-grid-icon-info-circled',
+ * action: function($event) {
+ * this.context.blargh(); // $scope.blargh() would work too, this is just an example
+ * },
+ * shown: function() { return true; },
+ * active: function() { return true; },
+ * context: $scope
+ * },
+ * {
+ * title: 'Grid ID',
+ * action: function() {
+ * alert('Grid ID: ' + this.grid.id);
+ * }
+ * }
+ * ] }]; </pre>
+ *
+ */
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:GridColumn
+ * @name updateColumnDef
+ * @description Moves settings from the columnDef down onto the column,
+ * and sets properties as appropriate
+ * @param {ColumnDef} colDef the column def to look in for the property value
+ * @param {boolean} isNew whether the column is being newly created, if not
+ * we're updating an existing column, and some items such as the sort shouldn't
+ * be copied down
+ */
+ GridColumn.prototype.updateColumnDef = function(colDef, isNew) {
+ var self = this;
+
+ self.colDef = colDef;
+
+ if (colDef.name === undefined) {
+ throw new Error('colDef.name is required for column at index ' + self.grid.options.columnDefs.indexOf(colDef));
+ }
+
+ self.displayName = (colDef.displayName === undefined) ? gridUtil.readableColumnName(colDef.name) : colDef.displayName;
+
+ if (!angular.isNumber(self.width) || !self.hasCustomWidth || colDef.allowCustomWidthOverride) {
+ var colDefWidth = colDef.width;
+ var parseErrorMsg = "Cannot parse column width '" + colDefWidth + "' for column named '" + colDef.name + "'";
+ self.hasCustomWidth = false;
+
+ if (!angular.isString(colDefWidth) && !angular.isNumber(colDefWidth)) {
+ self.width = '*';
+ } else if (angular.isString(colDefWidth)) {
+ // See if it ends with a percent
+ if (gridUtil.endsWith(colDefWidth, '%')) {
+ // If so we should be able to parse the non-percent-sign part to a number
+ var percentStr = colDefWidth.replace(/%/g, '');
+ var percent = parseInt(percentStr, 10);
+ if (isNaN(percent)) {
+ throw new Error(parseErrorMsg);
+ }
+ self.width = colDefWidth;
+ }
+ // And see if it's a number string
+ else if (colDefWidth.match(/^(\d+)$/)) {
+ self.width = parseInt(colDefWidth.match(/^(\d+)$/)[1], 10);
+ }
+ // Otherwise it should be a string of asterisks
+ else if (colDefWidth.match(/^\*+$/)) {
+ self.width = colDefWidth;
+ }
+ // No idea, throw an Error
+ else {
+ throw new Error(parseErrorMsg);
+ }
+ }
+ // Is a number, use it as the width
+ else {
+ self.width = colDefWidth;
+ }
+ }
+
+ ['minWidth', 'maxWidth'].forEach(function (name) {
+ var minOrMaxWidth = colDef[name];
+ var parseErrorMsg = "Cannot parse column " + name + " '" + minOrMaxWidth + "' for column named '" + colDef.name + "'";
+
+ if (!angular.isString(minOrMaxWidth) && !angular.isNumber(minOrMaxWidth)) {
+ //Sets default minWidth and maxWidth values
+ self[name] = ((name === 'minWidth') ? 30 : 9000);
+ } else if (angular.isString(minOrMaxWidth)) {
+ if (minOrMaxWidth.match(/^(\d+)$/)) {
+ self[name] = parseInt(minOrMaxWidth.match(/^(\d+)$/)[1], 10);
+ } else {
+ throw new Error(parseErrorMsg);
+ }
+ } else {
+ self[name] = minOrMaxWidth;
+ }
+ });
+
+ //use field if it is defined; name if it is not
+ self.field = (colDef.field === undefined) ? colDef.name : colDef.field;
+
+ if ( typeof( self.field ) !== 'string' ){
+ gridUtil.logError( 'Field is not a string, this is likely to break the code, Field is: ' + self.field );
+ }
+
+ self.name = colDef.name;
+
+ // Use colDef.displayName as long as it's not undefined, otherwise default to the field name
+ self.displayName = (colDef.displayName === undefined) ? gridUtil.readableColumnName(colDef.name) : colDef.displayName;
+
+ //self.originalIndex = index;
+
+ self.aggregationType = angular.isDefined(colDef.aggregationType) ? colDef.aggregationType : null;
+ self.footerCellTemplate = angular.isDefined(colDef.footerCellTemplate) ? colDef.footerCellTemplate : null;
+
+ /**
+ * @ngdoc property
+ * @name cellTooltip
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description Whether or not to show a tooltip when a user hovers over the cell.
+ * If set to false, no tooltip. If true, the cell value is shown in the tooltip (useful
+ * if you have long values in your cells), if a function then that function is called
+ * passing in the row and the col `cellTooltip( row, col )`, and the return value is shown in the tooltip,
+ * if it is a static string then displays that static string.
+ *
+ * Defaults to false
+ *
+ */
+ if ( typeof(colDef.cellTooltip) === 'undefined' || colDef.cellTooltip === false ) {
+ self.cellTooltip = false;
+ } else if ( colDef.cellTooltip === true ){
+ self.cellTooltip = function(row, col) {
+ return self.grid.getCellValue( row, col );
+ };
+ } else if (typeof(colDef.cellTooltip) === 'function' ){
+ self.cellTooltip = colDef.cellTooltip;
+ } else {
+ self.cellTooltip = function ( row, col ){
+ return col.colDef.cellTooltip;
+ };
+ }
+
+ /**
+ * @ngdoc property
+ * @name headerTooltip
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description Whether or not to show a tooltip when a user hovers over the header cell.
+ * If set to false, no tooltip. If true, the displayName is shown in the tooltip (useful
+ * if you have long values in your headers), if a function then that function is called
+ * passing in the row and the col `headerTooltip( col )`, and the return value is shown in the tooltip,
+ * if a static string then shows that static string.
+ *
+ * Defaults to false
+ *
+ */
+ if ( typeof(colDef.headerTooltip) === 'undefined' || colDef.headerTooltip === false ) {
+ self.headerTooltip = false;
+ } else if ( colDef.headerTooltip === true ){
+ self.headerTooltip = function(col) {
+ return col.displayName;
+ };
+ } else if (typeof(colDef.headerTooltip) === 'function' ){
+ self.headerTooltip = colDef.headerTooltip;
+ } else {
+ self.headerTooltip = function ( col ) {
+ return col.colDef.headerTooltip;
+ };
+ }
+
+
+ /**
+ * @ngdoc property
+ * @name footerCellClass
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description footerCellClass can be a string specifying the class to append to a cell
+ * or it can be a function(row,rowRenderIndex, col, colRenderIndex) that returns a class name
+ *
+ */
+ self.footerCellClass = colDef.footerCellClass;
+
+ /**
+ * @ngdoc property
+ * @name cellClass
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description cellClass can be a string specifying the class to append to a cell
+ * or it can be a function(row,rowRenderIndex, col, colRenderIndex) that returns a class name
+ *
+ */
+ self.cellClass = colDef.cellClass;
+
+ /**
+ * @ngdoc property
+ * @name headerCellClass
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description headerCellClass can be a string specifying the class to append to a cell
+ * or it can be a function(row,rowRenderIndex, col, colRenderIndex) that returns a class name
+ *
+ */
+ self.headerCellClass = colDef.headerCellClass;
+
+ /**
+ * @ngdoc property
+ * @name cellFilter
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description cellFilter is a filter to apply to the content of each cell
+ * @example
+ * <pre>
+ * gridOptions.columnDefs[0].cellFilter = 'date'
+ *
+ */
+ self.cellFilter = colDef.cellFilter ? colDef.cellFilter : "";
+
+ /**
+ * @ngdoc boolean
+ * @name sortCellFiltered
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description (optional) False by default. When `true` uiGrid will apply the cellFilter before
+ * sorting the data. Note that when using this option uiGrid will assume that the displayed value is
+ * a string, and use the {@link ui.grid.class:RowSorter#sortAlpha sortAlpha} `sortFn`. It is possible
+ * to return a non-string value from an angularjs filter, in which case you should define a {@link ui.grid.class:GridOptions.columnDef#sortingAlgorithm sortingAlgorithm}
+ * for the column which hanldes the returned type. You may specify one of the `sortingAlgorithms`
+ * found in the {@link ui.grid.RowSorter rowSorter} service.
+ */
+ self.sortCellFiltered = colDef.sortCellFiltered ? true : false;
+
+ /**
+ * @ngdoc boolean
+ * @name filterCellFiltered
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description (optional) False by default. When `true` uiGrid will apply the cellFilter before
+ * applying "search" `filters`.
+ */
+ self.filterCellFiltered = colDef.filterCellFiltered ? true : false;
+
+ /**
+ * @ngdoc property
+ * @name headerCellFilter
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description headerCellFilter is a filter to apply to the content of the column header
+ * @example
+ * <pre>
+ * gridOptions.columnDefs[0].headerCellFilter = 'translate'
+ *
+ */
+ self.headerCellFilter = colDef.headerCellFilter ? colDef.headerCellFilter : "";
+
+ /**
+ * @ngdoc property
+ * @name footerCellFilter
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description footerCellFilter is a filter to apply to the content of the column footer
+ * @example
+ * <pre>
+ * gridOptions.columnDefs[0].footerCellFilter = 'date'
+ *
+ */
+ self.footerCellFilter = colDef.footerCellFilter ? colDef.footerCellFilter : "";
+
+ self.visible = gridUtil.isNullOrUndefined(colDef.visible) || colDef.visible;
+
+ self.headerClass = colDef.headerClass;
+ //self.cursor = self.sortable ? 'pointer' : 'default';
+
+ // Turn on sorting by default
+ self.enableSorting = typeof(colDef.enableSorting) !== 'undefined' ? colDef.enableSorting : true;
+ self.sortingAlgorithm = colDef.sortingAlgorithm;
+
+ /**
+ * @ngdoc property
+ * @name sortDirectionCycle
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description (optional) An array of sort directions, specifying the order that they
+ * should cycle through as the user repeatedly clicks on the column heading.
+ * The default is `[null, uiGridConstants.ASC, uiGridConstants.DESC]`. Null
+ * refers to the unsorted state. This does not affect the initial sort
+ * direction; use the {@link ui.grid.class:GridOptions.columnDef#sort sort}
+ * property for that. If
+ * {@link ui.grid.class:GridOptions.columnDef#suppressRemoveSort suppressRemoveSort}
+ * is also set, the unsorted state will be skipped even if it is listed here.
+ * Each direction may not appear in the list more than once (e.g. `[ASC,
+ * DESC, DESC]` is not allowed), and the list may not be empty.
+ */
+ self.sortDirectionCycle = typeof(colDef.sortDirectionCycle) !== 'undefined' ?
+ colDef.sortDirectionCycle :
+ [null, uiGridConstants.ASC, uiGridConstants.DESC];
+
+ /**
+ * @ngdoc boolean
+ * @name suppressRemoveSort
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description (optional) False by default. When enabled, this setting hides the removeSort option
+ * in the menu, and prevents users from manually removing the sort
+ */
+ if ( typeof(self.suppressRemoveSort) === 'undefined'){
+ self.suppressRemoveSort = typeof(colDef.suppressRemoveSort) !== 'undefined' ? colDef.suppressRemoveSort : false;
+ }
+
+ /**
+ * @ngdoc property
+ * @name enableFiltering
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description turn off filtering for an individual column, where
+ * you've turned on filtering for the overall grid
+ * @example
+ * <pre>
+ * gridOptions.columnDefs[0].enableFiltering = false;
+ *
+ */
+ // Turn on filtering by default (it's disabled by default at the Grid level)
+ self.enableFiltering = typeof(colDef.enableFiltering) !== 'undefined' ? colDef.enableFiltering : true;
+
+ // self.menuItems = colDef.menuItems;
+ self.setPropertyOrDefault(colDef, 'menuItems', []);
+
+ // Use the column definition sort if we were passed it, but only if this is a newly added column
+ if ( isNew ){
+ self.setPropertyOrDefault(colDef, 'sort');
+ }
+
+ // Set up default filters array for when one is not provided.
+ // In other words, this (in column def):
+ //
+ // filter: { term: 'something', flags: {}, condition: [CONDITION] }
+ //
+ // is just shorthand for this:
+ //
+ // filters: [{ term: 'something', flags: {}, condition: [CONDITION] }]
+ //
+ var defaultFilters = [];
+ if (colDef.filter) {
+ defaultFilters.push(colDef.filter);
+ }
+ else if ( colDef.filters ){
+ defaultFilters = colDef.filters;
+ } else {
+ // Add an empty filter definition object, which will
+ // translate to a guessed condition and no pre-populated
+ // value for the filter <input>.
+ defaultFilters.push({});
+ }
+
+ /**
+ * @ngdoc property
+ * @name filter
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description Specify a single filter field on this column.
+ *
+ * A filter consists of a condition, a term, and a placeholder:
+ *
+ * - condition defines how rows are chosen as matching the filter term. This can be set to
+ * one of the constants in uiGridConstants.filter, or you can supply a custom filter function
+ * that gets passed the following arguments: [searchTerm, cellValue, row, column].
+ * - term: If set, the filter field will be pre-populated
+ * with this value.
+ * - placeholder: String that will be set to the `<input>.placeholder` attribute.
+ * - ariaLabel: String that will be set to the `<input>.ariaLabel` attribute. This is what is read as a label to screen reader users.
+ * - noTerm: set this to true if you have defined a custom function in condition, and
+ * your custom function doesn't require a term (so it can run even when the term is null)
+ * - flags: only flag currently available is `caseSensitive`, set to false if you don't want
+ * case sensitive matching
+ * - type: defaults to uiGridConstants.filter.INPUT, which gives a text box. If set to uiGridConstants.filter.SELECT
+ * then a select box will be shown with options selectOptions
+ * - selectOptions: options in the format `[ { value: 1, label: 'male' }]`. No i18n filter is provided, you need
+ * to perform the i18n on the values before you provide them
+ * - disableCancelFilterButton: defaults to false. If set to true then the 'x' button that cancels/clears the filter
+ * will not be shown.
+ * @example
+ * <pre>$scope.gridOptions.columnDefs = [
+ * {
+ * field: 'field1',
+ * filter: {
+ * term: 'xx',
+ * condition: uiGridConstants.filter.STARTS_WITH,
+ * placeholder: 'starts with...',
+ * ariaLabel: 'Starts with filter for field1',
+ * flags: { caseSensitive: false },
+ * type: uiGridConstants.filter.SELECT,
+ * selectOptions: [ { value: 1, label: 'male' }, { value: 2, label: 'female' } ],
+ * disableCancelFilterButton: true
+ * }
+ * }
+ * ]; </pre>
+ *
+ */
+
+ /*
+
+
+ /*
+
+ self.filters = [
+ {
+ term: 'search term'
+ condition: uiGridConstants.filter.CONTAINS,
+ placeholder: 'my placeholder',
+ ariaLabel: 'Starts with filter for field1',
+ flags: {
+ caseSensitive: true
+ }
+ }
+ ]
+
+ */
+
+ // Only set filter if this is a newly added column, if we're updating an existing
+ // column then we don't want to put the default filter back if the user may have already
+ // removed it.
+ // However, we do want to keep the settings if they change, just not the term
+ if ( isNew ) {
+ self.setPropertyOrDefault(colDef, 'filter');
+ self.setPropertyOrDefault(colDef, 'filters', defaultFilters);
+ } else if ( self.filters.length === defaultFilters.length ) {
+ self.filters.forEach( function( filter, index ){
+ if (typeof(defaultFilters[index].placeholder) !== 'undefined') {
+ filter.placeholder = defaultFilters[index].placeholder;
+ }
+ if (typeof(defaultFilters[index].ariaLabel) !== 'undefined') {
+ filter.ariaLabel = defaultFilters[index].ariaLabel;
+ }
+ if (typeof(defaultFilters[index].flags) !== 'undefined') {
+ filter.flags = defaultFilters[index].flags;
+ }
+ if (typeof(defaultFilters[index].type) !== 'undefined') {
+ filter.type = defaultFilters[index].type;
+ }
+ if (typeof(defaultFilters[index].selectOptions) !== 'undefined') {
+ filter.selectOptions = defaultFilters[index].selectOptions;
+ }
+ });
+ }
+
+ // Remove this column from the grid sorting, include inside build columns so has
+ // access to self - all seems a bit dodgy but doesn't work otherwise so have left
+ // as is
+ GridColumn.prototype.unsort = function () {
+ this.sort = {};
+ self.grid.api.core.raise.sortChanged( self.grid, self.grid.getColumnSorting() );
+ };
+
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name getColClass
+ * @methodOf ui.grid.class:GridColumn
+ * @description Returns the class name for the column
+ * @param {bool} prefixDot if true, will return .className instead of className
+ */
+ GridColumn.prototype.getColClass = function (prefixDot) {
+ var cls = uiGridConstants.COL_CLASS_PREFIX + this.uid;
+
+ return prefixDot ? '.' + cls : cls;
+ };
+
+ /**
+ * @ngdoc function
+ * @name isPinnedLeft
+ * @methodOf ui.grid.class:GridColumn
+ * @description Returns true if column is in the left render container
+ */
+ GridColumn.prototype.isPinnedLeft = function () {
+ return this.renderContainer === 'left';
+ };
+
+ /**
+ * @ngdoc function
+ * @name isPinnedRight
+ * @methodOf ui.grid.class:GridColumn
+ * @description Returns true if column is in the right render container
+ */
+ GridColumn.prototype.isPinnedRight = function () {
+ return this.renderContainer === 'right';
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name getColClassDefinition
+ * @methodOf ui.grid.class:GridColumn
+ * @description Returns the class definition for th column
+ */
+ GridColumn.prototype.getColClassDefinition = function () {
+ return ' .grid' + this.grid.id + ' ' + this.getColClass(true) + ' { min-width: ' + this.drawnWidth + 'px; max-width: ' + this.drawnWidth + 'px; }';
+ };
+
+ /**
+ * @ngdoc function
+ * @name getRenderContainer
+ * @methodOf ui.grid.class:GridColumn
+ * @description Returns the render container object that this column belongs to.
+ *
+ * Columns will be default be in the `body` render container if they aren't allocated to one specifically.
+ */
+ GridColumn.prototype.getRenderContainer = function getRenderContainer() {
+ var self = this;
+
+ var containerId = self.renderContainer;
+
+ if (containerId === null || containerId === '' || containerId === undefined) {
+ containerId = 'body';
+ }
+
+ return self.grid.renderContainers[containerId];
+ };
+
+ /**
+ * @ngdoc function
+ * @name showColumn
+ * @methodOf ui.grid.class:GridColumn
+ * @description Makes the column visible by setting colDef.visible = true
+ */
+ GridColumn.prototype.showColumn = function() {
+ this.colDef.visible = true;
+ };
+
+
+ /**
+ * @ngdoc property
+ * @name aggregationHideLabel
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description defaults to false, if set to true hides the label text
+ * in the aggregation footer, so only the value is displayed.
+ *
+ */
+ /**
+ * @ngdoc function
+ * @name getAggregationText
+ * @methodOf ui.grid.class:GridColumn
+ * @description Gets the aggregation label from colDef.aggregationLabel if
+ * specified or by using i18n, including deciding whether or not to display
+ * based on colDef.aggregationHideLabel.
+ *
+ * @param {string} label the i18n lookup value to use for the column label
+ *
+ */
+ GridColumn.prototype.getAggregationText = function () {
+ var self = this;
+ if ( self.colDef.aggregationHideLabel ){
+ return '';
+ }
+ else if ( self.colDef.aggregationLabel ) {
+ return self.colDef.aggregationLabel;
+ }
+ else {
+ switch ( self.colDef.aggregationType ){
+ case uiGridConstants.aggregationTypes.count:
+ return i18nService.getSafeText('aggregation.count');
+ case uiGridConstants.aggregationTypes.sum:
+ return i18nService.getSafeText('aggregation.sum');
+ case uiGridConstants.aggregationTypes.avg:
+ return i18nService.getSafeText('aggregation.avg');
+ case uiGridConstants.aggregationTypes.min:
+ return i18nService.getSafeText('aggregation.min');
+ case uiGridConstants.aggregationTypes.max:
+ return i18nService.getSafeText('aggregation.max');
+ default:
+ return '';
+ }
+ }
+ };
+
+ GridColumn.prototype.getCellTemplate = function () {
+ var self = this;
+
+ return self.cellTemplatePromise;
+ };
+
+ GridColumn.prototype.getCompiledElementFn = function () {
+ var self = this;
+
+ return self.compiledElementFnDefer.promise;
+ };
+
+ return GridColumn;
+}]);
+
+})();
+
+ (function(){
+
+angular.module('ui.grid')
+.factory('GridOptions', ['gridUtil','uiGridConstants', function(gridUtil,uiGridConstants) {
+
+ /**
+ * @ngdoc function
+ * @name ui.grid.class:GridOptions
+ * @description Default GridOptions class. GridOptions are defined by the application developer and overlaid
+ * over this object. Setting gridOptions within your controller is the most common method for an application
+ * developer to configure the behaviour of their ui-grid
+ *
+ * @example To define your gridOptions within your controller:
+ * <pre>$scope.gridOptions = {
+ * data: $scope.myData,
+ * columnDefs: [
+ * { name: 'field1', displayName: 'pretty display name' },
+ * { name: 'field2', visible: false }
+ * ]
+ * };</pre>
+ *
+ * You can then use this within your html template, when you define your grid:
+ * <pre>&lt;div ui-grid="gridOptions"&gt;&lt;/div&gt;</pre>
+ *
+ * To provide default options for all of the grids within your application, use an angular
+ * decorator to modify the GridOptions factory.
+ * <pre>
+ * app.config(function($provide){
+ * $provide.decorator('GridOptions',function($delegate){
+ * var gridOptions;
+ * gridOptions = angular.copy($delegate);
+ * gridOptions.initialize = function(options) {
+ * var initOptions;
+ * initOptions = $delegate.initialize(options);
+ * initOptions.enableColumnMenus = false;
+ * return initOptions;
+ * };
+ * return gridOptions;
+ * });
+ * });
+ * </pre>
+ */
+ return {
+ initialize: function( baseOptions ){
+ /**
+ * @ngdoc function
+ * @name onRegisterApi
+ * @propertyOf ui.grid.class:GridOptions
+ * @description A callback that returns the gridApi once the grid is instantiated, which is
+ * then used to interact with the grid programatically.
+ *
+ * Note that the gridApi.core.renderingComplete event is identical to this
+ * callback, but has the advantage that it can be called from multiple places
+ * if needed
+ *
+ * @example
+ * <pre>
+ * $scope.gridOptions.onRegisterApi = function ( gridApi ) {
+ * $scope.gridApi = gridApi;
+ * $scope.gridApi.selection.selectAllRows( $scope.gridApi.grid );
+ * };
+ * </pre>
+ *
+ */
+ baseOptions.onRegisterApi = baseOptions.onRegisterApi || angular.noop();
+
+ /**
+ * @ngdoc object
+ * @name data
+ * @propertyOf ui.grid.class:GridOptions
+ * @description (mandatory) Array of data to be rendered into the grid, providing the data source or data binding for
+ * the grid.
+ *
+ * Most commonly the data is an array of objects, where each object has a number of attributes.
+ * Each attribute automatically becomes a column in your grid. This array could, for example, be sourced from
+ * an angularJS $resource query request. The array can also contain complex objects, refer the binding tutorial
+ * for examples of that.
+ *
+ * The most flexible usage is to set your data on $scope:
+ *
+ * `$scope.data = data;`
+ *
+ * And then direct the grid to resolve whatever is in $scope.data:
+ *
+ * `$scope.gridOptions.data = 'data';`
+ *
+ * This is the most flexible approach as it allows you to replace $scope.data whenever you feel like it without
+ * getting pointer issues.
+ *
+ * Alternatively you can directly set the data array:
+ *
+ * `$scope.gridOptions.data = [ ];`
+ * or
+ *
+ * `$http.get('/data/100.json')
+ * .success(function(data) {
+ * $scope.myData = data;
+ * $scope.gridOptions.data = $scope.myData;
+ * });`
+ *
+ * Where you do this, you need to take care in updating the data - you can't just update `$scope.myData` to some other
+ * array, you need to update $scope.gridOptions.data to point to that new array as well.
+ *
+ */
+ baseOptions.data = baseOptions.data || [];
+
+ /**
+ * @ngdoc array
+ * @name columnDefs
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Array of columnDef objects. Only required property is name.
+ * The individual options available in columnDefs are documented in the
+ * {@link ui.grid.class:GridOptions.columnDef columnDef} section
+ * </br>_field property can be used in place of name for backwards compatibility with 2.x_
+ * @example
+ *
+ * <pre>var columnDefs = [{name:'field1'}, {name:'field2'}];</pre>
+ *
+ */
+ baseOptions.columnDefs = baseOptions.columnDefs || [];
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.class:GridOptions.columnDef
+ * @description Definition / configuration of an individual column, which would typically be
+ * one of many column definitions within the gridOptions.columnDefs array
+ * @example
+ * <pre>{name:'field1', field: 'field1', filter: { term: 'xxx' }}</pre>
+ *
+ */
+
+
+ /**
+ * @ngdoc array
+ * @name excludeProperties
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Array of property names in data to ignore when auto-generating column names. Provides the
+ * inverse of columnDefs - columnDefs is a list of columns to include, excludeProperties is a list of columns
+ * to exclude.
+ *
+ * If columnDefs is defined, this will be ignored.
+ *
+ * Defaults to ['$$hashKey']
+ */
+
+ baseOptions.excludeProperties = baseOptions.excludeProperties || ['$$hashKey'];
+
+ /**
+ * @ngdoc boolean
+ * @name enableRowHashing
+ * @propertyOf ui.grid.class:GridOptions
+ * @description True by default. When enabled, this setting allows uiGrid to add
+ * `$$hashKey`-type properties (similar to Angular) to elements in the `data` array. This allows
+ * the grid to maintain state while vastly speeding up the process of altering `data` by adding/moving/removing rows.
+ *
+ * Note that this DOES add properties to your data that you may not want, but they are stripped out when using `angular.toJson()`. IF
+ * you do not want this at all you can disable this setting but you will take a performance hit if you are using large numbers of rows
+ * and are altering the data set often.
+ */
+ baseOptions.enableRowHashing = baseOptions.enableRowHashing !== false;
+
+ /**
+ * @ngdoc function
+ * @name rowIdentity
+ * @methodOf ui.grid.class:GridOptions
+ * @description This function is used to get and, if necessary, set the value uniquely identifying this row (i.e. if an identity is not present it will set one).
+ *
+ * By default it returns the `$$hashKey` property if it exists. If it doesn't it uses gridUtil.nextUid() to generate one
+ */
+ baseOptions.rowIdentity = baseOptions.rowIdentity || function rowIdentity(row) {
+ return gridUtil.hashKey(row);
+ };
+
+ /**
+ * @ngdoc function
+ * @name getRowIdentity
+ * @methodOf ui.grid.class:GridOptions
+ * @description This function returns the identity value uniquely identifying this row, if one is not present it does not set it.
+ *
+ * By default it returns the `$$hashKey` property but can be overridden to use any property or set of properties you want.
+ */
+ baseOptions.getRowIdentity = baseOptions.getRowIdentity || function getRowIdentity(row) {
+ return row.$$hashKey;
+ };
+
+ /**
+ * @ngdoc property
+ * @name flatEntityAccess
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Set to true if your columns are all related directly to fields in a flat object structure - i.e.
+ * each of your columns associate directly with a property on each of the entities in your data array.
+ *
+ * In that situation we can avoid all the logic associated with complex binding to functions or to properties of sub-objects,
+ * which can provide a significant speed improvement with large data sets when filtering or sorting.
+ *
+ * By default false
+ */
+ baseOptions.flatEntityAccess = baseOptions.flatEntityAccess === true;
+
+ /**
+ * @ngdoc property
+ * @name showHeader
+ * @propertyOf ui.grid.class:GridOptions
+ * @description True by default. When set to false, this setting will replace the
+ * standard header template with '<div></div>', resulting in no header being shown.
+ */
+ baseOptions.showHeader = typeof(baseOptions.showHeader) !== "undefined" ? baseOptions.showHeader : true;
+
+ /* (NOTE): Don't show this in the docs. We only use it internally
+ * @ngdoc property
+ * @name headerRowHeight
+ * @propertyOf ui.grid.class:GridOptions
+ * @description The height of the header in pixels, defaults to 30
+ *
+ */
+ if (!baseOptions.showHeader) {
+ baseOptions.headerRowHeight = 0;
+ }
+ else {
+ baseOptions.headerRowHeight = typeof(baseOptions.headerRowHeight) !== "undefined" ? baseOptions.headerRowHeight : 30;
+ }
+
+ /**
+ * @ngdoc property
+ * @name rowHeight
+ * @propertyOf ui.grid.class:GridOptions
+ * @description The height of the row in pixels, defaults to 30
+ *
+ */
+ baseOptions.rowHeight = baseOptions.rowHeight || 30;
+
+ /**
+ * @ngdoc integer
+ * @name minRowsToShow
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Minimum number of rows to show when the grid doesn't have a defined height. Defaults to "10".
+ */
+ baseOptions.minRowsToShow = typeof(baseOptions.minRowsToShow) !== "undefined" ? baseOptions.minRowsToShow : 10;
+
+ /**
+ * @ngdoc property
+ * @name showGridFooter
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Whether or not to show the footer, defaults to false
+ * The footer display Total Rows and Visible Rows (filtered rows)
+ */
+ baseOptions.showGridFooter = baseOptions.showGridFooter === true;
+
+ /**
+ * @ngdoc property
+ * @name showColumnFooter
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Whether or not to show the column footer, defaults to false
+ * The column footer displays column aggregates
+ */
+ baseOptions.showColumnFooter = baseOptions.showColumnFooter === true;
+
+ /**
+ * @ngdoc property
+ * @name columnFooterHeight
+ * @propertyOf ui.grid.class:GridOptions
+ * @description The height of the footer rows (column footer and grid footer) in pixels
+ *
+ */
+ baseOptions.columnFooterHeight = typeof(baseOptions.columnFooterHeight) !== "undefined" ? baseOptions.columnFooterHeight : 30;
+ baseOptions.gridFooterHeight = typeof(baseOptions.gridFooterHeight) !== "undefined" ? baseOptions.gridFooterHeight : 30;
+
+ baseOptions.columnWidth = typeof(baseOptions.columnWidth) !== "undefined" ? baseOptions.columnWidth : 50;
+
+ /**
+ * @ngdoc property
+ * @name maxVisibleColumnCount
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Defaults to 200
+ *
+ */
+ baseOptions.maxVisibleColumnCount = typeof(baseOptions.maxVisibleColumnCount) !== "undefined" ? baseOptions.maxVisibleColumnCount : 200;
+
+ /**
+ * @ngdoc property
+ * @name virtualizationThreshold
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Turn virtualization on when number of data elements goes over this number, defaults to 20
+ */
+ baseOptions.virtualizationThreshold = typeof(baseOptions.virtualizationThreshold) !== "undefined" ? baseOptions.virtualizationThreshold : 20;
+
+ /**
+ * @ngdoc property
+ * @name columnVirtualizationThreshold
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Turn virtualization on when number of columns goes over this number, defaults to 10
+ */
+ baseOptions.columnVirtualizationThreshold = typeof(baseOptions.columnVirtualizationThreshold) !== "undefined" ? baseOptions.columnVirtualizationThreshold : 10;
+
+ /**
+ * @ngdoc property
+ * @name excessRows
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Extra rows to to render outside of the viewport, which helps with smoothness of scrolling.
+ * Defaults to 4
+ */
+ baseOptions.excessRows = typeof(baseOptions.excessRows) !== "undefined" ? baseOptions.excessRows : 4;
+ /**
+ * @ngdoc property
+ * @name scrollThreshold
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Defaults to 4
+ */
+ baseOptions.scrollThreshold = typeof(baseOptions.scrollThreshold) !== "undefined" ? baseOptions.scrollThreshold : 4;
+
+ /**
+ * @ngdoc property
+ * @name excessColumns
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Extra columns to to render outside of the viewport, which helps with smoothness of scrolling.
+ * Defaults to 4
+ */
+ baseOptions.excessColumns = typeof(baseOptions.excessColumns) !== "undefined" ? baseOptions.excessColumns : 4;
+ /**
+ * @ngdoc property
+ * @name horizontalScrollThreshold
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Defaults to 4
+ */
+ baseOptions.horizontalScrollThreshold = typeof(baseOptions.horizontalScrollThreshold) !== "undefined" ? baseOptions.horizontalScrollThreshold : 2;
+
+
+ /**
+ * @ngdoc property
+ * @name aggregationCalcThrottle
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Default time in milliseconds to throttle aggregation calcuations, defaults to 500ms
+ */
+ baseOptions.aggregationCalcThrottle = typeof(baseOptions.aggregationCalcThrottle) !== "undefined" ? baseOptions.aggregationCalcThrottle : 500;
+
+ /**
+ * @ngdoc property
+ * @name wheelScrollThrottle
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Default time in milliseconds to throttle scroll events to, defaults to 70ms
+ */
+ baseOptions.wheelScrollThrottle = typeof(baseOptions.wheelScrollThrottle) !== "undefined" ? baseOptions.wheelScrollThrottle : 70;
+
+
+ /**
+ * @ngdoc property
+ * @name scrollDebounce
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Default time in milliseconds to debounce scroll events, defaults to 300ms
+ */
+ baseOptions.scrollDebounce = typeof(baseOptions.scrollDebounce) !== "undefined" ? baseOptions.scrollDebounce : 300;
+
+ /**
+ * @ngdoc boolean
+ * @name enableSorting
+ * @propertyOf ui.grid.class:GridOptions
+ * @description True by default. When enabled, this setting adds sort
+ * widgets to the column headers, allowing sorting of the data for the entire grid.
+ * Sorting can then be disabled on individual columns using the columnDefs.
+ */
+ baseOptions.enableSorting = baseOptions.enableSorting !== false;
+
+ /**
+ * @ngdoc boolean
+ * @name enableFiltering
+ * @propertyOf ui.grid.class:GridOptions
+ * @description False by default. When enabled, this setting adds filter
+ * boxes to each column header, allowing filtering within the column for the entire grid.
+ * Filtering can then be disabled on individual columns using the columnDefs.
+ */
+ baseOptions.enableFiltering = baseOptions.enableFiltering === true;
+
+ /**
+ * @ngdoc boolean
+ * @name enableColumnMenus
+ * @propertyOf ui.grid.class:GridOptions
+ * @description True by default. When enabled, this setting displays a column
+ * menu within each column.
+ */
+ baseOptions.enableColumnMenus = baseOptions.enableColumnMenus !== false;
+
+ /**
+ * @ngdoc boolean
+ * @name enableVerticalScrollbar
+ * @propertyOf ui.grid.class:GridOptions
+ * @description uiGridConstants.scrollbars.ALWAYS by default. This settings controls the vertical scrollbar for the grid.
+ * Supported values: uiGridConstants.scrollbars.ALWAYS, uiGridConstants.scrollbars.NEVER
+ */
+ baseOptions.enableVerticalScrollbar = typeof(baseOptions.enableVerticalScrollbar) !== "undefined" ? baseOptions.enableVerticalScrollbar : uiGridConstants.scrollbars.ALWAYS;
+
+ /**
+ * @ngdoc boolean
+ * @name enableHorizontalScrollbar
+ * @propertyOf ui.grid.class:GridOptions
+ * @description uiGridConstants.scrollbars.ALWAYS by default. This settings controls the horizontal scrollbar for the grid.
+ * Supported values: uiGridConstants.scrollbars.ALWAYS, uiGridConstants.scrollbars.NEVER
+ */
+ baseOptions.enableHorizontalScrollbar = typeof(baseOptions.enableHorizontalScrollbar) !== "undefined" ? baseOptions.enableHorizontalScrollbar : uiGridConstants.scrollbars.ALWAYS;
+
+ /**
+ * @ngdoc boolean
+ * @name enableMinHeightCheck
+ * @propertyOf ui.grid.class:GridOptions
+ * @description True by default. When enabled, a newly initialized grid will check to see if it is tall enough to display
+ * at least one row of data. If the grid is not tall enough, it will resize the DOM element to display minRowsToShow number
+ * of rows.
+ */
+ baseOptions.enableMinHeightCheck = baseOptions.enableMinHeightCheck !== false;
+
+ /**
+ * @ngdoc boolean
+ * @name minimumColumnSize
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Columns can't be smaller than this, defaults to 10 pixels
+ */
+ baseOptions.minimumColumnSize = typeof(baseOptions.minimumColumnSize) !== "undefined" ? baseOptions.minimumColumnSize : 10;
+
+ /**
+ * @ngdoc function
+ * @name rowEquality
+ * @methodOf ui.grid.class:GridOptions
+ * @description By default, rows are compared using object equality. This option can be overridden
+ * to compare on any data item property or function
+ * @param {object} entityA First Data Item to compare
+ * @param {object} entityB Second Data Item to compare
+ */
+ baseOptions.rowEquality = baseOptions.rowEquality || function(entityA, entityB) {
+ return entityA === entityB;
+ };
+
+ /**
+ * @ngdoc string
+ * @name headerTemplate
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Null by default. When provided, this setting uses a custom header
+ * template, rather than the default template. Can be set to either the name of a template file:
+ * <pre> $scope.gridOptions.headerTemplate = 'header_template.html';</pre>
+ * inline html
+ * <pre> $scope.gridOptions.headerTemplate = '<div class="ui-grid-top-panel" style="text-align: center">I am a Custom Grid Header</div>'</pre>
+ * or the id of a precompiled template (TBD how to use this).
+ * </br>Refer to the custom header tutorial for more information.
+ * If you want no header at all, you can set to an empty div:
+ * <pre> $scope.gridOptions.headerTemplate = '<div></div>';</pre>
+ *
+ * If you want to only have a static header, then you can set to static content. If
+ * you want to tailor the existing column headers, then you should look at the
+ * current 'ui-grid-header.html' template in github as your starting point.
+ *
+ */
+ baseOptions.headerTemplate = baseOptions.headerTemplate || null;
+
+ /**
+ * @ngdoc string
+ * @name footerTemplate
+ * @propertyOf ui.grid.class:GridOptions
+ * @description (optional) ui-grid/ui-grid-footer by default. This footer shows the per-column
+ * aggregation totals.
+ * When provided, this setting uses a custom footer template. Can be set to either the name of a template file 'footer_template.html', inline html
+ * <pre>'<div class="ui-grid-bottom-panel" style="text-align: center">I am a Custom Grid Footer</div>'</pre>, or the id
+ * of a precompiled template (TBD how to use this). Refer to the custom footer tutorial for more information.
+ */
+ baseOptions.footerTemplate = baseOptions.footerTemplate || 'ui-grid/ui-grid-footer';
+
+ /**
+ * @ngdoc string
+ * @name gridFooterTemplate
+ * @propertyOf ui.grid.class:GridOptions
+ * @description (optional) ui-grid/ui-grid-grid-footer by default. This template by default shows the
+ * total items at the bottom of the grid, and the selected items if selection is enabled.
+ */
+ baseOptions.gridFooterTemplate = baseOptions.gridFooterTemplate || 'ui-grid/ui-grid-grid-footer';
+
+ /**
+ * @ngdoc string
+ * @name rowTemplate
+ * @propertyOf ui.grid.class:GridOptions
+ * @description 'ui-grid/ui-grid-row' by default. When provided, this setting uses a
+ * custom row template. Can be set to either the name of a template file:
+ * <pre> $scope.gridOptions.rowTemplate = 'row_template.html';</pre>
+ * inline html
+ * <pre> $scope.gridOptions.rowTemplate = '<div style="background-color: aquamarine" ng-click="grid.appScope.fnOne(row)" ng-repeat="col in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ui-grid-cell></div>';</pre>
+ * or the id of a precompiled template (TBD how to use this) can be provided.
+ * </br>Refer to the custom row template tutorial for more information.
+ */
+ baseOptions.rowTemplate = baseOptions.rowTemplate || 'ui-grid/ui-grid-row';
+
+ /**
+ * @ngdoc object
+ * @name appScopeProvider
+ * @propertyOf ui.grid.class:GridOptions
+ * @description by default, the parent scope of the ui-grid element will be assigned to grid.appScope
+ * this property allows you to assign any reference you want to grid.appScope
+ */
+ baseOptions.appScopeProvider = baseOptions.appScopeProvider || null;
+
+ return baseOptions;
+ }
+ };
+
+
+}]);
+
+})();
+
+(function(){
+
+angular.module('ui.grid')
+
+ /**
+ * @ngdoc function
+ * @name ui.grid.class:GridRenderContainer
+ * @description The grid has render containers, allowing the ability to have pinned columns. If the grid
+ * is right-to-left then there may be a right render container, if left-to-right then there may
+ * be a left render container. There is always a body render container.
+ * @param {string} name The name of the render container ('body', 'left', or 'right')
+ * @param {Grid} grid the grid the render container is in
+ * @param {object} options the render container options
+ */
+.factory('GridRenderContainer', ['gridUtil', 'uiGridConstants', function(gridUtil, uiGridConstants) {
+ function GridRenderContainer(name, grid, options) {
+ var self = this;
+
+ // if (gridUtil.type(grid) !== 'Grid') {
+ // throw new Error('Grid argument is not a Grid object');
+ // }
+
+ self.name = name;
+
+ self.grid = grid;
+
+ // self.rowCache = [];
+ // self.columnCache = [];
+
+ self.visibleRowCache = [];
+ self.visibleColumnCache = [];
+
+ self.renderedRows = [];
+ self.renderedColumns = [];
+
+ self.prevScrollTop = 0;
+ self.prevScrolltopPercentage = 0;
+ self.prevRowScrollIndex = 0;
+
+ self.prevScrollLeft = 0;
+ self.prevScrollleftPercentage = 0;
+ self.prevColumnScrollIndex = 0;
+
+ self.columnStyles = "";
+
+ self.viewportAdjusters = [];
+
+ /**
+ * @ngdoc boolean
+ * @name hasHScrollbar
+ * @propertyOf ui.grid.class:GridRenderContainer
+ * @description flag to signal that container has a horizontal scrollbar
+ */
+ self.hasHScrollbar = false;
+
+ /**
+ * @ngdoc boolean
+ * @name hasVScrollbar
+ * @propertyOf ui.grid.class:GridRenderContainer
+ * @description flag to signal that container has a vertical scrollbar
+ */
+ self.hasVScrollbar = false;
+
+ /**
+ * @ngdoc boolean
+ * @name canvasHeightShouldUpdate
+ * @propertyOf ui.grid.class:GridRenderContainer
+ * @description flag to signal that container should recalculate the canvas size
+ */
+ self.canvasHeightShouldUpdate = true;
+
+ /**
+ * @ngdoc boolean
+ * @name canvasHeight
+ * @propertyOf ui.grid.class:GridRenderContainer
+ * @description last calculated canvas height value
+ */
+ self.$$canvasHeight = 0;
+
+ if (options && angular.isObject(options)) {
+ angular.extend(self, options);
+ }
+
+ grid.registerStyleComputation({
+ priority: 5,
+ func: function () {
+ self.updateColumnWidths();
+ return self.columnStyles;
+ }
+ });
+ }
+
+
+ GridRenderContainer.prototype.reset = function reset() {
+ // this.rowCache.length = 0;
+ // this.columnCache.length = 0;
+
+ this.visibleColumnCache.length = 0;
+ this.visibleRowCache.length = 0;
+
+ this.renderedRows.length = 0;
+ this.renderedColumns.length = 0;
+ };
+
+ // TODO(c0bra): calculate size?? Should this be in a stackable directive?
+
+
+ GridRenderContainer.prototype.containsColumn = function (col) {
+ return this.visibleColumnCache.indexOf(col) !== -1;
+ };
+
+ GridRenderContainer.prototype.minRowsToRender = function minRowsToRender() {
+ var self = this;
+ var minRows = 0;
+ var rowAddedHeight = 0;
+ var viewPortHeight = self.getViewportHeight();
+ for (var i = self.visibleRowCache.length - 1; rowAddedHeight < viewPortHeight && i >= 0; i--) {
+ rowAddedHeight += self.visibleRowCache[i].height;
+ minRows++;
+ }
+ return minRows;
+ };
+
+ GridRenderContainer.prototype.minColumnsToRender = function minColumnsToRender() {
+ var self = this;
+ var viewportWidth = this.getViewportWidth();
+
+ var min = 0;
+ var totalWidth = 0;
+ // self.columns.forEach(function(col, i) {
+ for (var i = 0; i < self.visibleColumnCache.length; i++) {
+ var col = self.visibleColumnCache[i];
+
+ if (totalWidth < viewportWidth) {
+ totalWidth += col.drawnWidth ? col.drawnWidth : 0;
+ min++;
+ }
+ else {
+ var currWidth = 0;
+ for (var j = i; j >= i - min; j--) {
+ currWidth += self.visibleColumnCache[j].drawnWidth ? self.visibleColumnCache[j].drawnWidth : 0;
+ }
+ if (currWidth < viewportWidth) {
+ min++;
+ }
+ }
+ }
+
+ return min;
+ };
+
+ GridRenderContainer.prototype.getVisibleRowCount = function getVisibleRowCount() {
+ return this.visibleRowCache.length;
+ };
+
+ /**
+ * @ngdoc function
+ * @name registerViewportAdjuster
+ * @methodOf ui.grid.class:GridRenderContainer
+ * @description Registers an adjuster to the render container's available width or height. Adjusters are used
+ * to tell the render container that there is something else consuming space, and to adjust it's size
+ * appropriately.
+ * @param {function} func the adjuster function we want to register
+ */
+
+ GridRenderContainer.prototype.registerViewportAdjuster = function registerViewportAdjuster(func) {
+ this.viewportAdjusters.push(func);
+ };
+
+ /**
+ * @ngdoc function
+ * @name removeViewportAdjuster
+ * @methodOf ui.grid.class:GridRenderContainer
+ * @description Removes an adjuster, should be used when your element is destroyed
+ * @param {function} func the adjuster function we want to remove
+ */
+ GridRenderContainer.prototype.removeViewportAdjuster = function removeViewportAdjuster(func) {
+ var idx = this.viewportAdjusters.indexOf(func);
+
+ if (idx > -1) {
+ this.viewportAdjusters.splice(idx, 1);
+ }
+ };
+
+ /**
+ * @ngdoc function
+ * @name getViewportAdjustment
+ * @methodOf ui.grid.class:GridRenderContainer
+ * @description Gets the adjustment based on the viewportAdjusters.
+ * @returns {object} a hash of { height: x, width: y }. Usually the values will be negative
+ */
+ GridRenderContainer.prototype.getViewportAdjustment = function getViewportAdjustment() {
+ var self = this;
+
+ var adjustment = { height: 0, width: 0 };
+
+ self.viewportAdjusters.forEach(function (func) {
+ adjustment = func.call(this, adjustment);
+ });
+
+ return adjustment;
+ };
+
+ GridRenderContainer.prototype.getMargin = function getMargin(side) {
+ var self = this;
+
+ var amount = 0;
+
+ self.viewportAdjusters.forEach(function (func) {
+ var adjustment = func.call(this, { height: 0, width: 0 });
+
+ if (adjustment.side && adjustment.side === side) {
+ amount += adjustment.width * -1;
+ }
+ });
+
+ return amount;
+ };
+
+ GridRenderContainer.prototype.getViewportHeight = function getViewportHeight() {
+ var self = this;
+
+ var headerHeight = (self.headerHeight) ? self.headerHeight : self.grid.headerHeight;
+
+ var viewPortHeight = self.grid.gridHeight - headerHeight - self.grid.footerHeight;
+
+
+ var adjustment = self.getViewportAdjustment();
+
+ viewPortHeight = viewPortHeight + adjustment.height;
+
+ return viewPortHeight;
+ };
+
+ GridRenderContainer.prototype.getViewportWidth = function getViewportWidth() {
+ var self = this;
+
+ var viewportWidth = self.grid.gridWidth;
+
+ //if (typeof(self.grid.verticalScrollbarWidth) !== 'undefined' && self.grid.verticalScrollbarWidth !== undefined && self.grid.verticalScrollbarWidth > 0) {
+ // viewPortWidth = viewPortWidth - self.grid.verticalScrollbarWidth;
+ //}
+
+ // var viewportWidth = 0;\
+ // self.visibleColumnCache.forEach(function (column) {
+ // viewportWidth += column.drawnWidth;
+ // });
+
+ var adjustment = self.getViewportAdjustment();
+
+ viewportWidth = viewportWidth + adjustment.width;
+
+ return viewportWidth;
+ };
+
+ GridRenderContainer.prototype.getHeaderViewportWidth = function getHeaderViewportWidth() {
+ var self = this;
+
+ var viewportWidth = this.getViewportWidth();
+
+ //if (typeof(self.grid.verticalScrollbarWidth) !== 'undefined' && self.grid.verticalScrollbarWidth !== undefined && self.grid.verticalScrollbarWidth > 0) {
+ // viewPortWidth = viewPortWidth + self.grid.verticalScrollbarWidth;
+ //}
+
+ // var adjustment = self.getViewportAdjustment();
+ // viewPortWidth = viewPortWidth + adjustment.width;
+
+ return viewportWidth;
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name getCanvasHeight
+ * @methodOf ui.grid.class:GridRenderContainer
+ * @description Returns the total canvas height. Only recalculates if canvasHeightShouldUpdate = false
+ * @returns {number} total height of all the visible rows in the container
+ */
+ GridRenderContainer.prototype.getCanvasHeight = function getCanvasHeight() {
+ var self = this;
+
+ if (!self.canvasHeightShouldUpdate) {
+ return self.$$canvasHeight;
+ }
+
+ var oldCanvasHeight = self.$$canvasHeight;
+
+ self.$$canvasHeight = 0;
+
+ self.visibleRowCache.forEach(function(row){
+ self.$$canvasHeight += row.height;
+ });
+
+
+ self.canvasHeightShouldUpdate = false;
+
+ self.grid.api.core.raise.canvasHeightChanged(oldCanvasHeight, self.$$canvasHeight);
+
+ return self.$$canvasHeight;
+ };
+
+ GridRenderContainer.prototype.getVerticalScrollLength = function getVerticalScrollLength() {
+ return this.getCanvasHeight() - this.getViewportHeight() + this.grid.scrollbarHeight;
+ };
+
+ GridRenderContainer.prototype.getCanvasWidth = function getCanvasWidth() {
+ var self = this;
+
+ var ret = self.canvasWidth;
+
+ return ret;
+ };
+
+ GridRenderContainer.prototype.setRenderedRows = function setRenderedRows(newRows) {
+ this.renderedRows.length = newRows.length;
+ for (var i = 0; i < newRows.length; i++) {
+ this.renderedRows[i] = newRows[i];
+ }
+ };
+
+ GridRenderContainer.prototype.setRenderedColumns = function setRenderedColumns(newColumns) {
+ var self = this;
+
+ // OLD:
+ this.renderedColumns.length = newColumns.length;
+ for (var i = 0; i < newColumns.length; i++) {
+ this.renderedColumns[i] = newColumns[i];
+ }
+
+ this.updateColumnOffset();
+ };
+
+ GridRenderContainer.prototype.updateColumnOffset = function updateColumnOffset() {
+ // Calculate the width of the columns on the left side that are no longer rendered.
+ // That will be the offset for the columns as we scroll horizontally.
+ var hiddenColumnsWidth = 0;
+ for (var i = 0; i < this.currentFirstColumn; i++) {
+ hiddenColumnsWidth += this.visibleColumnCache[i].drawnWidth;
+ }
+
+ this.columnOffset = hiddenColumnsWidth;
+ };
+
+ GridRenderContainer.prototype.scrollVertical = function (newScrollTop) {
+ var vertScrollPercentage = -1;
+
+ if (newScrollTop !== this.prevScrollTop) {
+ var yDiff = newScrollTop - this.prevScrollTop;
+
+ if (yDiff > 0 ) { this.grid.scrollDirection = uiGridConstants.scrollDirection.DOWN; }
+ if (yDiff < 0 ) { this.grid.scrollDirection = uiGridConstants.scrollDirection.UP; }
+
+ var vertScrollLength = this.getVerticalScrollLength();
+
+ vertScrollPercentage = newScrollTop / vertScrollLength;
+
+ // console.log('vert', vertScrollPercentage, newScrollTop, vertScrollLength);
+
+ if (vertScrollPercentage > 1) { vertScrollPercentage = 1; }
+ if (vertScrollPercentage < 0) { vertScrollPercentage = 0; }
+
+ this.adjustScrollVertical(newScrollTop, vertScrollPercentage);
+ return vertScrollPercentage;
+ }
+ };
+
+ GridRenderContainer.prototype.scrollHorizontal = function(newScrollLeft){
+ var horizScrollPercentage = -1;
+
+ // Handle RTL here
+
+ if (newScrollLeft !== this.prevScrollLeft) {
+ var xDiff = newScrollLeft - this.prevScrollLeft;
+
+ if (xDiff > 0) { this.grid.scrollDirection = uiGridConstants.scrollDirection.RIGHT; }
+ if (xDiff < 0) { this.grid.scrollDirection = uiGridConstants.scrollDirection.LEFT; }
+
+ var horizScrollLength = (this.canvasWidth - this.getViewportWidth());
+ if (horizScrollLength !== 0) {
+ horizScrollPercentage = newScrollLeft / horizScrollLength;
+ }
+ else {
+ horizScrollPercentage = 0;
+ }
+
+ this.adjustScrollHorizontal(newScrollLeft, horizScrollPercentage);
+ return horizScrollPercentage;
+ }
+ };
+
+ GridRenderContainer.prototype.adjustScrollVertical = function adjustScrollVertical(scrollTop, scrollPercentage, force) {
+ if (this.prevScrollTop === scrollTop && !force) {
+ return;
+ }
+
+ if (typeof(scrollTop) === 'undefined' || scrollTop === undefined || scrollTop === null) {
+ scrollTop = (this.getCanvasHeight() - this.getViewportHeight()) * scrollPercentage;
+ }
+
+ this.adjustRows(scrollTop, scrollPercentage, false);
+
+ this.prevScrollTop = scrollTop;
+ this.prevScrolltopPercentage = scrollPercentage;
+
+ this.grid.queueRefresh();
+ };
+
+ GridRenderContainer.prototype.adjustScrollHorizontal = function adjustScrollHorizontal(scrollLeft, scrollPercentage, force) {
+ if (this.prevScrollLeft === scrollLeft && !force) {
+ return;
+ }
+
+ if (typeof(scrollLeft) === 'undefined' || scrollLeft === undefined || scrollLeft === null) {
+ scrollLeft = (this.getCanvasWidth() - this.getViewportWidth()) * scrollPercentage;
+ }
+
+ this.adjustColumns(scrollLeft, scrollPercentage);
+
+ this.prevScrollLeft = scrollLeft;
+ this.prevScrollleftPercentage = scrollPercentage;
+
+ this.grid.queueRefresh();
+ };
+
+ GridRenderContainer.prototype.adjustRows = function adjustRows(scrollTop, scrollPercentage, postDataLoaded) {
+ var self = this;
+
+ var minRows = self.minRowsToRender();
+
+ var rowCache = self.visibleRowCache;
+
+ var maxRowIndex = rowCache.length - minRows;
+
+ // console.log('scroll%1', scrollPercentage);
+
+ // Calculate the scroll percentage according to the scrollTop location, if no percentage was provided
+ if ((typeof(scrollPercentage) === 'undefined' || scrollPercentage === null) && scrollTop) {
+ scrollPercentage = scrollTop / self.getVerticalScrollLength();
+ }
+
+ var rowIndex = Math.ceil(Math.min(maxRowIndex, maxRowIndex * scrollPercentage));
+
+ // console.log('maxRowIndex / scroll%', maxRowIndex, scrollPercentage, rowIndex);
+
+ // Define a max row index that we can't scroll past
+ if (rowIndex > maxRowIndex) {
+ rowIndex = maxRowIndex;
+ }
+
+ var newRange = [];
+ if (rowCache.length > self.grid.options.virtualizationThreshold) {
+ if (!(typeof(scrollTop) === 'undefined' || scrollTop === null)) {
+ // Have we hit the threshold going down?
+ if ( !self.grid.suppressParentScrollDown && self.prevScrollTop < scrollTop && rowIndex < self.prevRowScrollIndex + self.grid.options.scrollThreshold && rowIndex < maxRowIndex) {
+ return;
+ }
+ //Have we hit the threshold going up?
+ if ( !self.grid.suppressParentScrollUp && self.prevScrollTop > scrollTop && rowIndex > self.prevRowScrollIndex - self.grid.options.scrollThreshold && rowIndex < maxRowIndex) {
+ return;
+ }
+ }
+ var rangeStart = {};
+ var rangeEnd = {};
+
+ rangeStart = Math.max(0, rowIndex - self.grid.options.excessRows);
+ rangeEnd = Math.min(rowCache.length, rowIndex + minRows + self.grid.options.excessRows);
+
+ newRange = [rangeStart, rangeEnd];
+ }
+ else {
+ var maxLen = self.visibleRowCache.length;
+ newRange = [0, Math.max(maxLen, minRows + self.grid.options.excessRows)];
+ }
+
+ self.updateViewableRowRange(newRange);
+
+ self.prevRowScrollIndex = rowIndex;
+ };
+
+ GridRenderContainer.prototype.adjustColumns = function adjustColumns(scrollLeft, scrollPercentage) {
+ var self = this;
+
+ var minCols = self.minColumnsToRender();
+
+ var columnCache = self.visibleColumnCache;
+ var maxColumnIndex = columnCache.length - minCols;
+
+ // Calculate the scroll percentage according to the scrollLeft location, if no percentage was provided
+ if ((typeof(scrollPercentage) === 'undefined' || scrollPercentage === null) && scrollLeft) {
+ var horizScrollLength = (self.getCanvasWidth() - self.getViewportWidth());
+ scrollPercentage = scrollLeft / horizScrollLength;
+ }
+
+ var colIndex = Math.ceil(Math.min(maxColumnIndex, maxColumnIndex * scrollPercentage));
+
+ // Define a max row index that we can't scroll past
+ if (colIndex > maxColumnIndex) {
+ colIndex = maxColumnIndex;
+ }
+
+ var newRange = [];
+ if (columnCache.length > self.grid.options.columnVirtualizationThreshold && self.getCanvasWidth() > self.getViewportWidth()) {
+ /* Commented the following lines because otherwise the moved column wasn't visible immediately on the new position
+ * in the case of many columns with horizontal scroll, one had to scroll left or right and then return in order to see it
+ // Have we hit the threshold going down?
+ if (self.prevScrollLeft < scrollLeft && colIndex < self.prevColumnScrollIndex + self.grid.options.horizontalScrollThreshold && colIndex < maxColumnIndex) {
+ return;
+ }
+ //Have we hit the threshold going up?
+ if (self.prevScrollLeft > scrollLeft && colIndex > self.prevColumnScrollIndex - self.grid.options.horizontalScrollThreshold && colIndex < maxColumnIndex) {
+ return;
+ }*/
+
+ var rangeStart = Math.max(0, colIndex - self.grid.options.excessColumns);
+ var rangeEnd = Math.min(columnCache.length, colIndex + minCols + self.grid.options.excessColumns);
+
+ newRange = [rangeStart, rangeEnd];
+ }
+ else {
+ var maxLen = self.visibleColumnCache.length;
+
+ newRange = [0, Math.max(maxLen, minCols + self.grid.options.excessColumns)];
+ }
+
+ self.updateViewableColumnRange(newRange);
+
+ self.prevColumnScrollIndex = colIndex;
+ };
+
+ // Method for updating the visible rows
+ GridRenderContainer.prototype.updateViewableRowRange = function updateViewableRowRange(renderedRange) {
+ // Slice out the range of rows from the data
+ // var rowArr = uiGridCtrl.grid.rows.slice(renderedRange[0], renderedRange[1]);
+ var rowArr = this.visibleRowCache.slice(renderedRange[0], renderedRange[1]);
+
+ // Define the top-most rendered row
+ this.currentTopRow = renderedRange[0];
+
+ this.setRenderedRows(rowArr);
+ };
+
+ // Method for updating the visible columns
+ GridRenderContainer.prototype.updateViewableColumnRange = function updateViewableColumnRange(renderedRange) {
+ // Slice out the range of rows from the data
+ // var columnArr = uiGridCtrl.grid.columns.slice(renderedRange[0], renderedRange[1]);
+ var columnArr = this.visibleColumnCache.slice(renderedRange[0], renderedRange[1]);
+
+ // Define the left-most rendered columns
+ this.currentFirstColumn = renderedRange[0];
+
+ this.setRenderedColumns(columnArr);
+ };
+
+ GridRenderContainer.prototype.headerCellWrapperStyle = function () {
+ var self = this;
+
+ if (self.currentFirstColumn !== 0) {
+ var offset = self.columnOffset;
+
+ if (self.grid.isRTL()) {
+ return { 'margin-right': offset + 'px' };
+ }
+ else {
+ return { 'margin-left': offset + 'px' };
+ }
+ }
+
+ return null;
+ };
+
+ /**
+ * @ngdoc boolean
+ * @name updateColumnWidths
+ * @propertyOf ui.grid.class:GridRenderContainer
+ * @description Determine the appropriate column width of each column across all render containers.
+ *
+ * Column width is easy when each column has a specified width. When columns are variable width (i.e.
+ * have an * or % of the viewport) then we try to calculate so that things fit in. The problem is that
+ * we have multiple render containers, and we don't want one render container to just take the whole viewport
+ * when it doesn't need to - we want things to balance out across the render containers.
+ *
+ * To do this, we use this method to calculate all the renderContainers, recognising that in a given render
+ * cycle it'll get called once per render container, so it needs to return the same values each time.
+ *
+ * The constraints on this method are therefore:
+ * - must return the same value when called multiple times, to do this it needs to rely on properties of the
+ * columns, but not properties that change when this is called (so it shouldn't rely on drawnWidth)
+ *
+ * The general logic of this method is:
+ * - calculate our total available width
+ * - look at all the columns across all render containers, and work out which have widths and which have
+ * constraints such as % or * or something else
+ * - for those with *, count the total number of * we see and add it onto a running total, add this column to an * array
+ * - for those with a %, allocate the % as a percentage of the viewport, having consideration of min and max
+ * - for those with manual width (in pixels) we set the drawnWidth to the specified width
+ * - we end up with an asterisks array still to process
+ * - we look at our remaining width. If it's greater than zero, we divide it up among the asterisk columns, then process
+ * them for min and max width constraints
+ * - if it's zero or less, we set the asterisk columns to their minimum widths
+ * - we use parseInt quite a bit, as we try to make all our column widths integers
+ */
+ GridRenderContainer.prototype.updateColumnWidths = function () {
+ var self = this;
+
+ var asterisksArray = [],
+ asteriskNum = 0,
+ usedWidthSum = 0,
+ ret = '';
+
+ // Get the width of the viewport
+ var availableWidth = self.grid.getViewportWidth() - self.grid.scrollbarWidth;
+
+ // get all the columns across all render containers, we have to calculate them all or one render container
+ // could consume the whole viewport
+ var columnCache = [];
+ angular.forEach(self.grid.renderContainers, function( container, name){
+ columnCache = columnCache.concat(container.visibleColumnCache);
+ });
+
+ // look at each column, process any manual values or %, put the * into an array to look at later
+ columnCache.forEach(function(column, i) {
+ var width = 0;
+ // Skip hidden columns
+ if (!column.visible) { return; }
+
+ if (angular.isNumber(column.width)) {
+ // pixel width, set to this value
+ width = parseInt(column.width, 10);
+ usedWidthSum = usedWidthSum + width;
+ column.drawnWidth = width;
+
+ } else if (gridUtil.endsWith(column.width, "%")) {
+ // percentage width, set to percentage of the viewport
+ width = parseInt(parseInt(column.width.replace(/%/g, ''), 10) / 100 * availableWidth);
+
+ if ( width > column.maxWidth ){
+ width = column.maxWidth;
+ }
+
+ if ( width < column.minWidth ){
+ width = column.minWidth;
+ }
+
+ usedWidthSum = usedWidthSum + width;
+ column.drawnWidth = width;
+ } else if (angular.isString(column.width) && column.width.indexOf('*') !== -1) {
+ // is an asterisk column, the gridColumn already checked the string consists only of '****'
+ asteriskNum = asteriskNum + column.width.length;
+ asterisksArray.push(column);
+ }
+ });
+
+ // Get the remaining width (available width subtracted by the used widths sum)
+ var remainingWidth = availableWidth - usedWidthSum;
+
+ var i, column, colWidth;
+
+ if (asterisksArray.length > 0) {
+ // the width that each asterisk value would be assigned (this can be negative)
+ var asteriskVal = remainingWidth / asteriskNum;
+
+ asterisksArray.forEach(function( column ){
+ var width = parseInt(column.width.length * asteriskVal, 10);
+
+ if ( width > column.maxWidth ){
+ width = column.maxWidth;
+ }
+
+ if ( width < column.minWidth ){
+ width = column.minWidth;
+ }
+
+ usedWidthSum = usedWidthSum + width;
+ column.drawnWidth = width;
+ });
+ }
+
+ // If the grid width didn't divide evenly into the column widths and we have pixels left over, or our
+ // calculated widths would have the grid narrower than the available space,
+ // dole the remainder out one by one to make everything fit
+ var processColumnUpwards = function(column){
+ if ( column.drawnWidth < column.maxWidth && leftoverWidth > 0) {
+ column.drawnWidth++;
+ usedWidthSum++;
+ leftoverWidth--;
+ columnsToChange = true;
+ }
+ };
+
+ var leftoverWidth = availableWidth - usedWidthSum;
+ var columnsToChange = true;
+
+ while (leftoverWidth > 0 && columnsToChange) {
+ columnsToChange = false;
+ asterisksArray.forEach(processColumnUpwards);
+ }
+
+ // We can end up with too much width even though some columns aren't at their max width, in this situation
+ // we can trim the columns a little
+ var processColumnDownwards = function(column){
+ if ( column.drawnWidth > column.minWidth && excessWidth > 0) {
+ column.drawnWidth--;
+ usedWidthSum--;
+ excessWidth--;
+ columnsToChange = true;
+ }
+ };
+
+ var excessWidth = usedWidthSum - availableWidth;
+ columnsToChange = true;
+
+ while (excessWidth > 0 && columnsToChange) {
+ columnsToChange = false;
+ asterisksArray.forEach(processColumnDownwards);
+ }
+
+
+ // all that was across all the renderContainers, now we need to work out what that calculation decided for
+ // our renderContainer
+ var canvasWidth = 0;
+ self.visibleColumnCache.forEach(function(column){
+ if ( column.visible ){
+ canvasWidth = canvasWidth + column.drawnWidth;
+ }
+ });
+
+ // Build the CSS
+ columnCache.forEach(function (column) {
+ ret = ret + column.getColClassDefinition();
+ });
+
+ self.canvasWidth = canvasWidth;
+
+ // Return the styles back to buildStyles which pops them into the `customStyles` scope variable
+ // return ret;
+
+ // Set this render container's column styles so they can be used in style computation
+ this.columnStyles = ret;
+ };
+
+ GridRenderContainer.prototype.needsHScrollbarPlaceholder = function () {
+ return this.grid.options.enableHorizontalScrollbar && !this.hasHScrollbar && !this.grid.disableScrolling;
+ };
+
+ GridRenderContainer.prototype.getViewportStyle = function () {
+ var self = this;
+ var styles = {};
+
+ self.hasHScrollbar = false;
+ self.hasVScrollbar = false;
+
+ if (self.grid.disableScrolling) {
+ styles['overflow-x'] = 'hidden';
+ styles['overflow-y'] = 'hidden';
+ return styles;
+ }
+
+ if (self.name === 'body') {
+ self.hasHScrollbar = self.grid.options.enableHorizontalScrollbar !== uiGridConstants.scrollbars.NEVER;
+ if (!self.grid.isRTL()) {
+ if (!self.grid.hasRightContainerColumns()) {
+ self.hasVScrollbar = self.grid.options.enableVerticalScrollbar !== uiGridConstants.scrollbars.NEVER;
+ }
+ }
+ else {
+ if (!self.grid.hasLeftContainerColumns()) {
+ self.hasVScrollbar = self.grid.options.enableVerticalScrollbar !== uiGridConstants.scrollbars.NEVER;
+ }
+ }
+ }
+ else if (self.name === 'left') {
+ self.hasVScrollbar = self.grid.isRTL() ? self.grid.options.enableVerticalScrollbar !== uiGridConstants.scrollbars.NEVER : false;
+ }
+ else {
+ self.hasVScrollbar = !self.grid.isRTL() ? self.grid.options.enableVerticalScrollbar !== uiGridConstants.scrollbars.NEVER : false;
+ }
+
+ styles['overflow-x'] = self.hasHScrollbar ? 'scroll' : 'hidden';
+ styles['overflow-y'] = self.hasVScrollbar ? 'scroll' : 'hidden';
+
+
+ return styles;
+
+
+ };
+
+ return GridRenderContainer;
+}]);
+
+})();
+
+(function(){
+
+angular.module('ui.grid')
+.factory('GridRow', ['gridUtil', function(gridUtil) {
+
+ /**
+ * @ngdoc function
+ * @name ui.grid.class:GridRow
+ * @description GridRow is the viewModel for one logical row on the grid. A grid Row is not necessarily a one-to-one
+ * relation to gridOptions.data.
+ * @param {object} entity the array item from GridOptions.data
+ * @param {number} index the current position of the row in the array
+ * @param {Grid} reference to the parent grid
+ */
+ function GridRow(entity, index, grid) {
+
+ /**
+ * @ngdoc object
+ * @name grid
+ * @propertyOf ui.grid.class:GridRow
+ * @description A reference back to the grid
+ */
+ this.grid = grid;
+
+ /**
+ * @ngdoc object
+ * @name entity
+ * @propertyOf ui.grid.class:GridRow
+ * @description A reference to an item in gridOptions.data[]
+ */
+ this.entity = entity;
+
+ /**
+ * @ngdoc object
+ * @name uid
+ * @propertyOf ui.grid.class:GridRow
+ * @description UniqueId of row
+ */
+ this.uid = gridUtil.nextUid();
+
+ /**
+ * @ngdoc object
+ * @name visible
+ * @propertyOf ui.grid.class:GridRow
+ * @description If true, the row will be rendered
+ */
+ // Default to true
+ this.visible = true;
+
+
+ this.$$height = grid.options.rowHeight;
+
+ }
+
+ /**
+ * @ngdoc object
+ * @name height
+ * @propertyOf ui.grid.class:GridRow
+ * @description height of each individual row. changing the height will flag all
+ * row renderContainers to recalculate their canvas height
+ */
+ Object.defineProperty(GridRow.prototype, 'height', {
+ get: function() {
+ return this.$$height;
+ },
+ set: function(height) {
+ if (height !== this.$$height) {
+ this.grid.updateCanvasHeight();
+ this.$$height = height;
+ }
+ }
+ });
+
+ /**
+ * @ngdoc function
+ * @name getQualifiedColField
+ * @methodOf ui.grid.class:GridRow
+ * @description returns the qualified field name as it exists on scope
+ * ie: row.entity.fieldA
+ * @param {GridCol} col column instance
+ * @returns {string} resulting name that can be evaluated on scope
+ */
+ GridRow.prototype.getQualifiedColField = function(col) {
+ return 'row.' + this.getEntityQualifiedColField(col);
+ };
+
+ /**
+ * @ngdoc function
+ * @name getEntityQualifiedColField
+ * @methodOf ui.grid.class:GridRow
+ * @description returns the qualified field name minus the row path
+ * ie: entity.fieldA
+ * @param {GridCol} col column instance
+ * @returns {string} resulting name that can be evaluated against a row
+ */
+ GridRow.prototype.getEntityQualifiedColField = function(col) {
+ return gridUtil.preEval('entity.' + col.field);
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name setRowInvisible
+ * @methodOf ui.grid.class:GridRow
+ * @description Sets an override on the row that forces it to always
+ * be invisible. Emits the rowsVisibleChanged event if it changed the row visibility.
+ *
+ * This method can be called from the api, passing in the gridRow we want
+ * altered. It should really work by calling gridRow.setRowInvisible, but that's
+ * not the way I coded it, and too late to change now. Changed to just call
+ * the internal function row.setThisRowInvisible().
+ *
+ * @param {GridRow} row the row we want to set to invisible
+ *
+ */
+ GridRow.prototype.setRowInvisible = function ( row ) {
+ if (row && row.setThisRowInvisible){
+ row.setThisRowInvisible( 'user' );
+ }
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name clearRowInvisible
+ * @methodOf ui.grid.class:GridRow
+ * @description Clears an override on the row that forces it to always
+ * be invisible. Emits the rowsVisibleChanged event if it changed the row visibility.
+ *
+ * This method can be called from the api, passing in the gridRow we want
+ * altered. It should really work by calling gridRow.clearRowInvisible, but that's
+ * not the way I coded it, and too late to change now. Changed to just call
+ * the internal function row.clearThisRowInvisible().
+ *
+ * @param {GridRow} row the row we want to clear the invisible flag
+ *
+ */
+ GridRow.prototype.clearRowInvisible = function ( row ) {
+ if (row && row.clearThisRowInvisible){
+ row.clearThisRowInvisible( 'user' );
+ }
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name setThisRowInvisible
+ * @methodOf ui.grid.class:GridRow
+ * @description Sets an override on the row that forces it to always
+ * be invisible. Emits the rowsVisibleChanged event if it changed the row visibility
+ *
+ * @param {string} reason the reason (usually the module) for the row to be invisible.
+ * E.g. grouping, user, filter
+ * @param {boolean} fromRowsProcessor whether we were called from a rowsProcessor, passed through to evaluateRowVisibility
+ */
+ GridRow.prototype.setThisRowInvisible = function ( reason, fromRowsProcessor ) {
+ if ( !this.invisibleReason ){
+ this.invisibleReason = {};
+ }
+ this.invisibleReason[reason] = true;
+ this.evaluateRowVisibility( fromRowsProcessor);
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name clearRowInvisible
+ * @methodOf ui.grid.class:GridRow
+ * @description Clears any override on the row visibility, returning it
+ * to normal visibility calculations. Emits the rowsVisibleChanged
+ * event
+ *
+ * @param {string} reason the reason (usually the module) for the row to be invisible.
+ * E.g. grouping, user, filter
+ * @param {boolean} fromRowsProcessor whether we were called from a rowsProcessor, passed through to evaluateRowVisibility
+ */
+ GridRow.prototype.clearThisRowInvisible = function ( reason, fromRowsProcessor ) {
+ if (typeof(this.invisibleReason) !== 'undefined' ) {
+ delete this.invisibleReason[reason];
+ }
+ this.evaluateRowVisibility( fromRowsProcessor );
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name evaluateRowVisibility
+ * @methodOf ui.grid.class:GridRow
+ * @description Determines whether the row should be visible based on invisibleReason,
+ * and if it changes the row visibility, then emits the rowsVisibleChanged event.
+ *
+ * Queues a grid refresh, but doesn't call it directly to avoid hitting lots of grid refreshes.
+ * @param {boolean} fromRowProcessor if true, then it won't raise events or queue the refresh, the
+ * row processor does that already
+ */
+ GridRow.prototype.evaluateRowVisibility = function ( fromRowProcessor ) {
+ var newVisibility = true;
+ if ( typeof(this.invisibleReason) !== 'undefined' ){
+ angular.forEach(this.invisibleReason, function( value, key ){
+ if ( value ){
+ newVisibility = false;
+ }
+ });
+ }
+
+ if ( typeof(this.visible) === 'undefined' || this.visible !== newVisibility ){
+ this.visible = newVisibility;
+ if ( !fromRowProcessor ){
+ this.grid.queueGridRefresh();
+ this.grid.api.core.raise.rowsVisibleChanged(this);
+ }
+ }
+ };
+
+
+ return GridRow;
+}]);
+
+})();
+
+(function(){
+ 'use strict';
+ /**
+ * @ngdoc object
+ * @name ui.grid.class:GridRowColumn
+ * @param {GridRow} row The row for this pair
+ * @param {GridColumn} column The column for this pair
+ * @description A row and column pair that represents the intersection of these two entities.
+ * Must be instantiated as a constructor using the `new` keyword.
+ */
+ angular.module('ui.grid')
+ .factory('GridRowColumn', ['$parse', '$filter',
+ function GridRowColumnFactory($parse, $filter){
+ var GridRowColumn = function GridRowColumn(row, col) {
+ if ( !(this instanceof GridRowColumn)){
+ throw "Using GridRowColumn as a function insead of as a constructor. Must be called with `new` keyword";
+ }
+
+ /**
+ * @ngdoc object
+ * @name row
+ * @propertyOf ui.grid.class:GridRowColumn
+ * @description {@link ui.grid.class:GridRow }
+ */
+ this.row = row;
+ /**
+ * @ngdoc object
+ * @name col
+ * @propertyOf ui.grid.class:GridRowColumn
+ * @description {@link ui.grid.class:GridColumn }
+ */
+ this.col = col;
+ };
+
+ /**
+ * @ngdoc function
+ * @name getIntersectionValueRaw
+ * @methodOf ui.grid.class:GridRowColumn
+ * @description Gets the intersection of where the row and column meet.
+ * @returns {String|Number|Object} The value from the grid data that this GridRowColumn points too.
+ * If the column has a cellFilter this will NOT return the filtered value.
+ */
+ GridRowColumn.prototype.getIntersectionValueRaw = function(){
+ var getter = $parse(this.row.getEntityQualifiedColField(this.col));
+ var context = this.row;
+ return getter(context);
+ };
+ /**
+ * @ngdoc function
+ * @name getIntersectionValueFiltered
+ * @methodOf ui.grid.class:GridRowColumn
+ * @description Gets the intersection of where the row and column meet.
+ * @returns {String|Number|Object} The value from the grid data that this GridRowColumn points too.
+ * If the column has a cellFilter this will also apply the filter to it and return the value that the filter displays.
+ */
+ GridRowColumn.prototype.getIntersectionValueFiltered = function(){
+ var value = this.getIntersectionValueRaw();
+ if (this.col.cellFilter && this.col.cellFilter !== ''){
+ var getFilterIfExists = function(filterName){
+ try {
+ return $filter(filterName);
+ } catch (e){
+ return null;
+ }
+ };
+ var filter = getFilterIfExists(this.col.cellFilter);
+ if (filter) { // Check if this is filter name or a filter string
+ value = filter(value);
+ } else { // We have the template version of a filter so we need to parse it apart
+ // Get the filter params out using a regex
+ // Test out this regex here https://regex101.com/r/rC5eR5/2
+ var re = /([^:]*):([^:]*):?([\s\S]+)?/;
+ var matches;
+ if ((matches = re.exec(this.col.cellFilter)) !== null) {
+ // View your result using the matches-variable.
+ // eg matches[0] etc.
+ value = $filter(matches[1])(value, matches[2], matches[3]);
+ }
+ }
+ }
+ return value;
+ };
+ return GridRowColumn;
+ }
+ ]);
+})();
+
+(function () {
+ angular.module('ui.grid')
+ .factory('ScrollEvent', ['gridUtil', function (gridUtil) {
+
+ /**
+ * @ngdoc function
+ * @name ui.grid.class:ScrollEvent
+ * @description Model for all scrollEvents
+ * @param {Grid} grid that owns the scroll event
+ * @param {GridRenderContainer} sourceRowContainer that owns the scroll event. Can be null
+ * @param {GridRenderContainer} sourceColContainer that owns the scroll event. Can be null
+ * @param {string} source the source of the event - from uiGridConstants.scrollEventSources or a string value of directive/service/factory.functionName
+ */
+ function ScrollEvent(grid, sourceRowContainer, sourceColContainer, source) {
+ var self = this;
+ if (!grid) {
+ throw new Error("grid argument is required");
+ }
+
+ /**
+ * @ngdoc object
+ * @name grid
+ * @propertyOf ui.grid.class:ScrollEvent
+ * @description A reference back to the grid
+ */
+ self.grid = grid;
+
+
+
+ /**
+ * @ngdoc object
+ * @name source
+ * @propertyOf ui.grid.class:ScrollEvent
+ * @description the source of the scroll event. limited to values from uiGridConstants.scrollEventSources
+ */
+ self.source = source;
+
+
+ /**
+ * @ngdoc object
+ * @name noDelay
+ * @propertyOf ui.grid.class:ScrollEvent
+ * @description most scroll events from the mouse or trackpad require delay to operate properly
+ * set to false to eliminate delay. Useful for scroll events that the grid causes, such as scrolling to make a row visible.
+ */
+ self.withDelay = true;
+
+ self.sourceRowContainer = sourceRowContainer;
+ self.sourceColContainer = sourceColContainer;
+
+ self.newScrollLeft = null;
+ self.newScrollTop = null;
+ self.x = null;
+ self.y = null;
+
+ self.verticalScrollLength = -9999999;
+ self.horizontalScrollLength = -999999;
+
+
+ /**
+ * @ngdoc function
+ * @name fireThrottledScrollingEvent
+ * @methodOf ui.grid.class:ScrollEvent
+ * @description fires a throttled event using grid.api.core.raise.scrollEvent
+ */
+ self.fireThrottledScrollingEvent = gridUtil.throttle(function(sourceContainerId) {
+ self.grid.scrollContainers(sourceContainerId, self);
+ }, self.grid.options.wheelScrollThrottle, {trailing: true});
+
+ }
+
+
+ /**
+ * @ngdoc function
+ * @name getNewScrollLeft
+ * @methodOf ui.grid.class:ScrollEvent
+ * @description returns newScrollLeft property if available; calculates a new value if it isn't
+ */
+ ScrollEvent.prototype.getNewScrollLeft = function(colContainer, viewport){
+ var self = this;
+
+ if (!self.newScrollLeft){
+ var scrollWidth = (colContainer.getCanvasWidth() - colContainer.getViewportWidth());
+
+ var oldScrollLeft = gridUtil.normalizeScrollLeft(viewport, self.grid);
+
+ var scrollXPercentage;
+ if (typeof(self.x.percentage) !== 'undefined' && self.x.percentage !== undefined) {
+ scrollXPercentage = self.x.percentage;
+ }
+ else if (typeof(self.x.pixels) !== 'undefined' && self.x.pixels !== undefined) {
+ scrollXPercentage = self.x.percentage = (oldScrollLeft + self.x.pixels) / scrollWidth;
+ }
+ else {
+ throw new Error("No percentage or pixel value provided for scroll event X axis");
+ }
+
+ return Math.max(0, scrollXPercentage * scrollWidth);
+ }
+
+ return self.newScrollLeft;
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name getNewScrollTop
+ * @methodOf ui.grid.class:ScrollEvent
+ * @description returns newScrollTop property if available; calculates a new value if it isn't
+ */
+ ScrollEvent.prototype.getNewScrollTop = function(rowContainer, viewport){
+ var self = this;
+
+
+ if (!self.newScrollTop){
+ var scrollLength = rowContainer.getVerticalScrollLength();
+
+ var oldScrollTop = viewport[0].scrollTop;
+
+ var scrollYPercentage;
+ if (typeof(self.y.percentage) !== 'undefined' && self.y.percentage !== undefined) {
+ scrollYPercentage = self.y.percentage;
+ }
+ else if (typeof(self.y.pixels) !== 'undefined' && self.y.pixels !== undefined) {
+ scrollYPercentage = self.y.percentage = (oldScrollTop + self.y.pixels) / scrollLength;
+ }
+ else {
+ throw new Error("No percentage or pixel value provided for scroll event Y axis");
+ }
+
+ return Math.max(0, scrollYPercentage * scrollLength);
+ }
+
+ return self.newScrollTop;
+ };
+
+ ScrollEvent.prototype.atTop = function(scrollTop) {
+ return (this.y && (this.y.percentage === 0 || this.verticalScrollLength < 0) && scrollTop === 0);
+ };
+
+ ScrollEvent.prototype.atBottom = function(scrollTop) {
+ return (this.y && (this.y.percentage === 1 || this.verticalScrollLength === 0) && scrollTop > 0);
+ };
+
+ ScrollEvent.prototype.atLeft = function(scrollLeft) {
+ return (this.x && (this.x.percentage === 0 || this.horizontalScrollLength < 0) && scrollLeft === 0);
+ };
+
+ ScrollEvent.prototype.atRight = function(scrollLeft) {
+ return (this.x && (this.x.percentage === 1 || this.horizontalScrollLength ===0) && scrollLeft > 0);
+ };
+
+
+ ScrollEvent.Sources = {
+ ViewPortScroll: 'ViewPortScroll',
+ RenderContainerMouseWheel: 'RenderContainerMouseWheel',
+ RenderContainerTouchMove: 'RenderContainerTouchMove',
+ Other: 99
+ };
+
+ return ScrollEvent;
+ }]);
+
+
+
+})();
+
+(function () {
+ 'use strict';
+ /**
+ * @ngdoc object
+ * @name ui.grid.service:gridClassFactory
+ *
+ * @description factory to return dom specific instances of a grid
+ *
+ */
+ angular.module('ui.grid').service('gridClassFactory', ['gridUtil', '$q', '$compile', '$templateCache', 'uiGridConstants', 'Grid', 'GridColumn', 'GridRow',
+ function (gridUtil, $q, $compile, $templateCache, uiGridConstants, Grid, GridColumn, GridRow) {
+
+ var service = {
+ /**
+ * @ngdoc method
+ * @name createGrid
+ * @methodOf ui.grid.service:gridClassFactory
+ * @description Creates a new grid instance. Each instance will have a unique id
+ * @param {object} options An object map of options to pass into the created grid instance.
+ * @returns {Grid} grid
+ */
+ createGrid : function(options) {
+ options = (typeof(options) !== 'undefined') ? options : {};
+ options.id = gridUtil.newId();
+ var grid = new Grid(options);
+
+ // NOTE/TODO: rowTemplate should always be defined...
+ if (grid.options.rowTemplate) {
+ var rowTemplateFnPromise = $q.defer();
+ grid.getRowTemplateFn = rowTemplateFnPromise.promise;
+
+ gridUtil.getTemplate(grid.options.rowTemplate)
+ .then(
+ function (template) {
+ var rowTemplateFn = $compile(template);
+ rowTemplateFnPromise.resolve(rowTemplateFn);
+ },
+ function (res) {
+ // Todo handle response error here?
+ throw new Error("Couldn't fetch/use row template '" + grid.options.rowTemplate + "'");
+ });
+ }
+
+ grid.registerColumnBuilder(service.defaultColumnBuilder);
+
+ // Row builder for custom row templates
+ grid.registerRowBuilder(service.rowTemplateAssigner);
+
+ // Reset all rows to visible initially
+ grid.registerRowsProcessor(function allRowsVisible(rows) {
+ rows.forEach(function (row) {
+ row.evaluateRowVisibility( true );
+ }, 50);
+
+ return rows;
+ });
+
+ grid.registerColumnsProcessor(function allColumnsVisible(columns) {
+ columns.forEach(function (column) {
+ column.visible = true;
+ });
+
+ return columns;
+ }, 50);
+
+ grid.registerColumnsProcessor(function(renderableColumns) {
+ renderableColumns.forEach(function (column) {
+ if (column.colDef.visible === false) {
+ column.visible = false;
+ }
+ });
+
+ return renderableColumns;
+ }, 50);
+
+
+ grid.registerRowsProcessor(grid.searchRows, 100);
+
+ // Register the default row processor, it sorts rows by selected columns
+ if (grid.options.externalSort && angular.isFunction(grid.options.externalSort)) {
+ grid.registerRowsProcessor(grid.options.externalSort, 200);
+ }
+ else {
+ grid.registerRowsProcessor(grid.sortByColumn, 200);
+ }
+
+ return grid;
+ },
+
+ /**
+ * @ngdoc function
+ * @name defaultColumnBuilder
+ * @methodOf ui.grid.service:gridClassFactory
+ * @description Processes designTime column definitions and applies them to col for the
+ * core grid features
+ * @param {object} colDef reference to column definition
+ * @param {GridColumn} col reference to gridCol
+ * @param {object} gridOptions reference to grid options
+ */
+ defaultColumnBuilder: function (colDef, col, gridOptions) {
+
+ var templateGetPromises = [];
+
+ // Abstracts the standard template processing we do for every template type.
+ var processTemplate = function( templateType, providedType, defaultTemplate, filterType, tooltipType ) {
+ if ( !colDef[templateType] ){
+ col[providedType] = defaultTemplate;
+ } else {
+ col[providedType] = colDef[templateType];
+ }
+
+ templateGetPromises.push(gridUtil.getTemplate(col[providedType])
+ .then(
+ function (template) {
+ if ( angular.isFunction(template) ) { template = template(); }
+ var tooltipCall = ( tooltipType === 'cellTooltip' ) ? 'col.cellTooltip(row,col)' : 'col.headerTooltip(col)';
+ if ( tooltipType && col[tooltipType] === false ){
+ template = template.replace(uiGridConstants.TOOLTIP, '');
+ } else if ( tooltipType && col[tooltipType] ){
+ template = template.replace(uiGridConstants.TOOLTIP, 'title="{{' + tooltipCall + ' CUSTOM_FILTERS }}"');
+ }
+
+ if ( filterType ){
+ col[templateType] = template.replace(uiGridConstants.CUSTOM_FILTERS, function() {
+ return col[filterType] ? "|" + col[filterType] : "";
+ });
+ } else {
+ col[templateType] = template;
+ }
+ },
+ function (res) {
+ throw new Error("Couldn't fetch/use colDef." + templateType + " '" + colDef[templateType] + "'");
+ })
+ );
+
+ };
+
+
+ /**
+ * @ngdoc property
+ * @name cellTemplate
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description a custom template for each cell in this column. The default
+ * is ui-grid/uiGridCell. If you are using the cellNav feature, this template
+ * must contain a div that can receive focus.
+ *
+ */
+ processTemplate( 'cellTemplate', 'providedCellTemplate', 'ui-grid/uiGridCell', 'cellFilter', 'cellTooltip' );
+ col.cellTemplatePromise = templateGetPromises[0];
+
+ /**
+ * @ngdoc property
+ * @name headerCellTemplate
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description a custom template for the header for this column. The default
+ * is ui-grid/uiGridHeaderCell
+ *
+ */
+ processTemplate( 'headerCellTemplate', 'providedHeaderCellTemplate', 'ui-grid/uiGridHeaderCell', 'headerCellFilter', 'headerTooltip' );
+
+ /**
+ * @ngdoc property
+ * @name footerCellTemplate
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description a custom template for the footer for this column. The default
+ * is ui-grid/uiGridFooterCell
+ *
+ */
+ processTemplate( 'footerCellTemplate', 'providedFooterCellTemplate', 'ui-grid/uiGridFooterCell', 'footerCellFilter' );
+
+ /**
+ * @ngdoc property
+ * @name filterHeaderTemplate
+ * @propertyOf ui.grid.class:GridOptions.columnDef
+ * @description a custom template for the filter input. The default is ui-grid/ui-grid-filter
+ *
+ */
+ processTemplate( 'filterHeaderTemplate', 'providedFilterHeaderTemplate', 'ui-grid/ui-grid-filter' );
+
+ // Create a promise for the compiled element function
+ col.compiledElementFnDefer = $q.defer();
+
+ return $q.all(templateGetPromises);
+ },
+
+
+ rowTemplateAssigner: function rowTemplateAssigner(row) {
+ var grid = this;
+
+ // Row has no template assigned to it
+ if (!row.rowTemplate) {
+ // Use the default row template from the grid
+ row.rowTemplate = grid.options.rowTemplate;
+
+ // Use the grid's function for fetching the compiled row template function
+ row.getRowTemplateFn = grid.getRowTemplateFn;
+ }
+ // Row has its own template assigned
+ else {
+ // Create a promise for the compiled row template function
+ var perRowTemplateFnPromise = $q.defer();
+ row.getRowTemplateFn = perRowTemplateFnPromise.promise;
+
+ // Get the row template
+ gridUtil.getTemplate(row.rowTemplate)
+ .then(function (template) {
+ // Compile the template
+ var rowTemplateFn = $compile(template);
+
+ // Resolve the compiled template function promise
+ perRowTemplateFnPromise.resolve(rowTemplateFn);
+ },
+ function (res) {
+ // Todo handle response error here?
+ throw new Error("Couldn't fetch/use row template '" + row.rowTemplate + "'");
+ });
+ }
+
+ return row.getRowTemplateFn;
+ }
+ };
+
+ //class definitions (moved to separate factories)
+
+ return service;
+ }]);
+
+})();
+
+(function() {
+
+var module = angular.module('ui.grid');
+
+function escapeRegExp(str) {
+ return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
+}
+
+
+/**
+ * @ngdoc service
+ * @name ui.grid.service:rowSearcher
+ *
+ * @description Service for searching/filtering rows based on column value conditions.
+ */
+module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil, uiGridConstants) {
+ var defaultCondition = uiGridConstants.filter.CONTAINS;
+
+ var rowSearcher = {};
+
+ /**
+ * @ngdoc function
+ * @name getTerm
+ * @methodOf ui.grid.service:rowSearcher
+ * @description Get the term from a filter
+ * Trims leading and trailing whitespace
+ * @param {object} filter object to use
+ * @returns {object} Parsed term
+ */
+ rowSearcher.getTerm = function getTerm(filter) {
+ if (typeof(filter.term) === 'undefined') { return filter.term; }
+
+ var term = filter.term;
+
+ // Strip leading and trailing whitespace if the term is a string
+ if (typeof(term) === 'string') {
+ term = term.trim();
+ }
+
+ return term;
+ };
+
+ /**
+ * @ngdoc function
+ * @name stripTerm
+ * @methodOf ui.grid.service:rowSearcher
+ * @description Remove leading and trailing asterisk (*) from the filter's term
+ * @param {object} filter object to use
+ * @returns {uiGridConstants.filter<int>} Value representing the condition constant value
+ */
+ rowSearcher.stripTerm = function stripTerm(filter) {
+ var term = rowSearcher.getTerm(filter);
+
+ if (typeof(term) === 'string') {
+ return escapeRegExp(term.replace(/(^\*|\*$)/g, ''));
+ }
+ else {
+ return term;
+ }
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name guessCondition
+ * @methodOf ui.grid.service:rowSearcher
+ * @description Guess the condition for a filter based on its term
+ * <br>
+ * Defaults to STARTS_WITH. Uses CONTAINS for strings beginning and ending with *s (*bob*).
+ * Uses STARTS_WITH for strings ending with * (bo*). Uses ENDS_WITH for strings starting with * (*ob).
+ * @param {object} filter object to use
+ * @returns {uiGridConstants.filter<int>} Value representing the condition constant value
+ */
+ rowSearcher.guessCondition = function guessCondition(filter) {
+ if (typeof(filter.term) === 'undefined' || !filter.term) {
+ return defaultCondition;
+ }
+
+ var term = rowSearcher.getTerm(filter);
+
+ if (/\*/.test(term)) {
+ var regexpFlags = '';
+ if (!filter.flags || !filter.flags.caseSensitive) {
+ regexpFlags += 'i';
+ }
+
+ var reText = term.replace(/(\\)?\*/g, function ($0, $1) { return $1 ? $0 : '[\\s\\S]*?'; });
+ return new RegExp('^' + reText + '$', regexpFlags);
+ }
+ // Otherwise default to default condition
+ else {
+ return defaultCondition;
+ }
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name setupFilters
+ * @methodOf ui.grid.service:rowSearcher
+ * @description For a given columns filters (either col.filters, or [col.filter] can be passed in),
+ * do all the parsing and pre-processing and store that data into a new filters object. The object
+ * has the condition, the flags, the stripped term, and a parsed reg exp if there was one.
+ *
+ * We could use a forEach in here, since it's much less performance sensitive, but since we're using
+ * for loops everywhere else in this module...
+ *
+ * @param {array} filters the filters from the column (col.filters or [col.filter])
+ * @returns {array} An array of parsed/preprocessed filters
+ */
+ rowSearcher.setupFilters = function setupFilters( filters ){
+ var newFilters = [];
+
+ var filtersLength = filters.length;
+ for ( var i = 0; i < filtersLength; i++ ){
+ var filter = filters[i];
+
+ if ( filter.noTerm || !gridUtil.isNullOrUndefined(filter.term) ){
+ var newFilter = {};
+
+ var regexpFlags = '';
+ if (!filter.flags || !filter.flags.caseSensitive) {
+ regexpFlags += 'i';
+ }
+
+ if ( !gridUtil.isNullOrUndefined(filter.term) ){
+ // it is possible to have noTerm. We don't need to copy that across, it was just a flag to avoid
+ // getting the filter ignored if the filter was a function that didn't use a term
+ newFilter.term = rowSearcher.stripTerm(filter);
+ }
+
+ if ( filter.condition ){
+ newFilter.condition = filter.condition;
+ } else {
+ newFilter.condition = rowSearcher.guessCondition(filter);
+ }
+
+ newFilter.flags = angular.extend( { caseSensitive: false, date: false }, filter.flags );
+
+ if (newFilter.condition === uiGridConstants.filter.STARTS_WITH) {
+ newFilter.startswithRE = new RegExp('^' + newFilter.term, regexpFlags);
+ }
+
+ if (newFilter.condition === uiGridConstants.filter.ENDS_WITH) {
+ newFilter.endswithRE = new RegExp(newFilter.term + '$', regexpFlags);
+ }
+
+ if (newFilter.condition === uiGridConstants.filter.CONTAINS) {
+ newFilter.containsRE = new RegExp(newFilter.term, regexpFlags);
+ }
+
+ if (newFilter.condition === uiGridConstants.filter.EXACT) {
+ newFilter.exactRE = new RegExp('^' + newFilter.term + '$', regexpFlags);
+ }
+
+ newFilters.push(newFilter);
+ }
+ }
+ return newFilters;
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name runColumnFilter
+ * @methodOf ui.grid.service:rowSearcher
+ * @description Runs a single pre-parsed filter against a cell, returning true
+ * if the cell matches that one filter.
+ *
+ * @param {Grid} grid the grid we're working against
+ * @param {GridRow} row the row we're matching against
+ * @param {GridCol} column the column that we're working against
+ * @param {object} filter the specific, preparsed, filter that we want to test
+ * @returns {boolean} true if we match (row stays visible)
+ */
+ rowSearcher.runColumnFilter = function runColumnFilter(grid, row, column, filter) {
+ // Cache typeof condition
+ var conditionType = typeof(filter.condition);
+
+ // Term to search for.
+ var term = filter.term;
+
+ // Get the column value for this row
+ var value;
+ if ( column.filterCellFiltered ){
+ value = grid.getCellDisplayValue(row, column);
+ } else {
+ value = grid.getCellValue(row, column);
+ }
+
+
+ // If the filter's condition is a RegExp, then use it
+ if (filter.condition instanceof RegExp) {
+ return filter.condition.test(value);
+ }
+
+ // If the filter's condition is a function, run it
+ if (conditionType === 'function') {
+ return filter.condition(term, value, row, column);
+ }
+
+ if (filter.startswithRE) {
+ return filter.startswithRE.test(value);
+ }
+
+ if (filter.endswithRE) {
+ return filter.endswithRE.test(value);
+ }
+
+ if (filter.containsRE) {
+ return filter.containsRE.test(value);
+ }
+
+ if (filter.exactRE) {
+ return filter.exactRE.test(value);
+ }
+
+ if (filter.condition === uiGridConstants.filter.NOT_EQUAL) {
+ var regex = new RegExp('^' + term + '$');
+ return !regex.exec(value);
+ }
+
+ if (typeof(value) === 'number' && typeof(term) === 'string' ){
+ // if the term has a decimal in it, it comes through as '9\.4', we need to take out the \
+ // the same for negative numbers
+ // TODO: I suspect the right answer is to look at escapeRegExp at the top of this code file, maybe it's not needed?
+ var tempFloat = parseFloat(term.replace(/\\\./,'.').replace(/\\\-/,'-'));
+ if (!isNaN(tempFloat)) {
+ term = tempFloat;
+ }
+ }
+
+ if (filter.flags.date === true) {
+ value = new Date(value);
+ // If the term has a dash in it, it comes through as '\-' -- we need to take out the '\'.
+ term = new Date(term.replace(/\\/g, ''));
+ }
+
+ if (filter.condition === uiGridConstants.filter.GREATER_THAN) {
+ return (value > term);
+ }
+
+ if (filter.condition === uiGridConstants.filter.GREATER_THAN_OR_EQUAL) {
+ return (value >= term);
+ }
+
+ if (filter.condition === uiGridConstants.filter.LESS_THAN) {
+ return (value < term);
+ }
+
+ if (filter.condition === uiGridConstants.filter.LESS_THAN_OR_EQUAL) {
+ return (value <= term);
+ }
+
+ return true;
+ };
+
+
+ /**
+ * @ngdoc boolean
+ * @name useExternalFiltering
+ * @propertyOf ui.grid.class:GridOptions
+ * @description False by default. When enabled, this setting suppresses the internal filtering.
+ * All UI logic will still operate, allowing filter conditions to be set and modified.
+ *
+ * The external filter logic can listen for the `filterChange` event, which fires whenever
+ * a filter has been adjusted.
+ */
+ /**
+ * @ngdoc function
+ * @name searchColumn
+ * @methodOf ui.grid.service:rowSearcher
+ * @description Process provided filters on provided column against a given row. If the row meets
+ * the conditions on all the filters, return true.
+ * @param {Grid} grid Grid to search in
+ * @param {GridRow} row Row to search on
+ * @param {GridCol} column Column with the filters to use
+ * @param {array} filters array of pre-parsed/preprocessed filters to apply
+ * @returns {boolean} Whether the column matches or not.
+ */
+ rowSearcher.searchColumn = function searchColumn(grid, row, column, filters) {
+ if (grid.options.useExternalFiltering) {
+ return true;
+ }
+
+ var filtersLength = filters.length;
+ for (var i = 0; i < filtersLength; i++) {
+ var filter = filters[i];
+
+ var ret = rowSearcher.runColumnFilter(grid, row, column, filter);
+ if (!ret) {
+ return false;
+ }
+ }
+
+ return true;
+ };
+
+
+ /**
+ * @ngdoc function
+ * @name search
+ * @methodOf ui.grid.service:rowSearcher
+ * @description Run a search across the given rows and columns, marking any rows that don't
+ * match the stored col.filters or col.filter as invisible.
+ * @param {Grid} grid Grid instance to search inside
+ * @param {Array[GridRow]} rows GridRows to filter
+ * @param {Array[GridColumn]} columns GridColumns with filters to process
+ */
+ rowSearcher.search = function search(grid, rows, columns) {
+ /*
+ * Added performance optimisations into this code base, as this logic creates deeply nested
+ * loops and is therefore very performance sensitive. In particular, avoiding forEach as
+ * this impacts some browser optimisers (particularly Chrome), using iterators instead
+ */
+
+ // Don't do anything if we weren't passed any rows
+ if (!rows) {
+ return;
+ }
+
+ // don't filter if filtering currently disabled
+ if (!grid.options.enableFiltering){
+ return rows;
+ }
+
+ // Build list of filters to apply
+ var filterData = [];
+
+ var colsLength = columns.length;
+
+ var hasTerm = function( filters ) {
+ var hasTerm = false;
+
+ filters.forEach( function (filter) {
+ if ( !gridUtil.isNullOrUndefined(filter.term) && filter.term !== '' || filter.noTerm ){
+ hasTerm = true;
+ }
+ });
+
+ return hasTerm;
+ };
+
+ for (var i = 0; i < colsLength; i++) {
+ var col = columns[i];
+
+ if (typeof(col.filters) !== 'undefined' && hasTerm(col.filters) ) {
+ filterData.push( { col: col, filters: rowSearcher.setupFilters(col.filters) } );
+ }
+ }
+
+ if (filterData.length > 0) {
+ // define functions outside the loop, performance optimisation
+ var foreachRow = function(grid, row, col, filters){
+ if ( row.visible && !rowSearcher.searchColumn(grid, row, col, filters) ) {
+ row.visible = false;
+ }
+ };
+
+ var foreachFilterCol = function(grid, filterData){
+ var rowsLength = rows.length;
+ for ( var i = 0; i < rowsLength; i++){
+ foreachRow(grid, rows[i], filterData.col, filterData.filters);
+ }
+ };
+
+ // nested loop itself - foreachFilterCol, which in turn calls foreachRow
+ var filterDataLength = filterData.length;
+ for ( var j = 0; j < filterDataLength; j++){
+ foreachFilterCol( grid, filterData[j] );
+ }
+
+ if (grid.api.core.raise.rowsVisibleChanged) {
+ grid.api.core.raise.rowsVisibleChanged();
+ }
+
+ // drop any invisible rows
+ // keeping these, as needed with filtering for trees - we have to come back and make parent nodes visible if child nodes are selected in the filter
+ // rows = rows.filter(function(row){ return row.visible; });
+
+ }
+
+ return rows;
+ };
+
+ return rowSearcher;
+}]);
+
+})();
+
+(function() {
+
+var module = angular.module('ui.grid');
+
+/**
+ * @ngdoc object
+ * @name ui.grid.class:RowSorter
+ * @description RowSorter provides the default sorting mechanisms,
+ * including guessing column types and applying appropriate sort
+ * algorithms
+ *
+ */
+
+module.service('rowSorter', ['$parse', 'uiGridConstants', function ($parse, uiGridConstants) {
+ var currencyRegexStr =
+ '(' +
+ uiGridConstants.CURRENCY_SYMBOLS
+ .map(function (a) { return '\\' + a; }) // Escape all the currency symbols ($ at least will jack up this regex)
+ .join('|') + // Join all the symbols together with |s
+ ')?';
+
+ // /^[-+]?[£$¤¥]?[\d,.]+%?$/
+ var numberStrRegex = new RegExp('^[-+]?' + currencyRegexStr + '[\\d,.]+' + currencyRegexStr + '%?$');
+
+ var rowSorter = {
+ // Cache of sorting functions. Once we create them, we don't want to keep re-doing it
+ // this takes a piece of data from the cell and tries to determine its type and what sorting
+ // function to use for it
+ colSortFnCache: {}
+ };
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:RowSorter
+ * @name guessSortFn
+ * @description Assigns a sort function to use based on the itemType in the column
+ * @param {string} itemType one of 'number', 'boolean', 'string', 'date', 'object'. And
+ * error will be thrown for any other type.
+ * @returns {function} a sort function that will sort that type
+ */
+ rowSorter.guessSortFn = function guessSortFn(itemType) {
+ switch (itemType) {
+ case "number":
+ return rowSorter.sortNumber;
+ case "numberStr":
+ return rowSorter.sortNumberStr;
+ case "boolean":
+ return rowSorter.sortBool;
+ case "string":
+ return rowSorter.sortAlpha;
+ case "date":
+ return rowSorter.sortDate;
+ case "object":
+ return rowSorter.basicSort;
+ default:
+ throw new Error('No sorting function found for type:' + itemType);
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:RowSorter
+ * @name handleNulls
+ * @description Sorts nulls and undefined to the bottom (top when
+ * descending). Called by each of the internal sorters before
+ * attempting to sort. Note that this method is available on the core api
+ * via gridApi.core.sortHandleNulls
+ * @param {object} a sort value a
+ * @param {object} b sort value b
+ * @returns {number} null if there were no nulls/undefineds, otherwise returns
+ * a sort value that should be passed back from the sort function
+ */
+ rowSorter.handleNulls = function handleNulls(a, b) {
+ // We want to allow zero values and false values to be evaluated in the sort function
+ if ((!a && a !== 0 && a !== false) || (!b && b !== 0 && b !== false)) {
+ // We want to force nulls and such to the bottom when we sort... which effectively is "greater than"
+ if ((!a && a !== 0 && a !== false) && (!b && b !== 0 && b !== false)) {
+ return 0;
+ }
+ else if (!a && a !== 0 && a !== false) {
+ return 1;
+ }
+ else if (!b && b !== 0 && b !== false) {
+ return -1;
+ }
+ }
+ return null;
+ };
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:RowSorter
+ * @name basicSort
+ * @description Sorts any values that provide the < method, including strings
+ * or numbers. Handles nulls and undefined through calling handleNulls
+ * @param {object} a sort value a
+ * @param {object} b sort value b
+ * @returns {number} normal sort function, returns -ve, 0, +ve
+ */
+ rowSorter.basicSort = function basicSort(a, b) {
+ var nulls = rowSorter.handleNulls(a, b);
+ if ( nulls !== null ){
+ return nulls;
+ } else {
+ if (a === b) {
+ return 0;
+ }
+ if (a < b) {
+ return -1;
+ }
+ return 1;
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:RowSorter
+ * @name sortNumber
+ * @description Sorts numerical values. Handles nulls and undefined through calling handleNulls
+ * @param {object} a sort value a
+ * @param {object} b sort value b
+ * @returns {number} normal sort function, returns -ve, 0, +ve
+ */
+ rowSorter.sortNumber = function sortNumber(a, b) {
+ var nulls = rowSorter.handleNulls(a, b);
+ if ( nulls !== null ){
+ return nulls;
+ } else {
+ return a - b;
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:RowSorter
+ * @name sortNumberStr
+ * @description Sorts numerical values that are stored in a string (i.e. parses them to numbers first).
+ * Handles nulls and undefined through calling handleNulls
+ * @param {object} a sort value a
+ * @param {object} b sort value b
+ * @returns {number} normal sort function, returns -ve, 0, +ve
+ */
+ rowSorter.sortNumberStr = function sortNumberStr(a, b) {
+ var nulls = rowSorter.handleNulls(a, b);
+ if ( nulls !== null ){
+ return nulls;
+ } else {
+ var numA, // The parsed number form of 'a'
+ numB, // The parsed number form of 'b'
+ badA = false,
+ badB = false;
+
+ // Try to parse 'a' to a float
+ numA = parseFloat(a.replace(/[^0-9.-]/g, ''));
+
+ // If 'a' couldn't be parsed to float, flag it as bad
+ if (isNaN(numA)) {
+ badA = true;
+ }
+
+ // Try to parse 'b' to a float
+ numB = parseFloat(b.replace(/[^0-9.-]/g, ''));
+
+ // If 'b' couldn't be parsed to float, flag it as bad
+ if (isNaN(numB)) {
+ badB = true;
+ }
+
+ // We want bad ones to get pushed to the bottom... which effectively is "greater than"
+ if (badA && badB) {
+ return 0;
+ }
+
+ if (badA) {
+ return 1;
+ }
+
+ if (badB) {
+ return -1;
+ }
+
+ return numA - numB;
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:RowSorter
+ * @name sortAlpha
+ * @description Sorts string values. Handles nulls and undefined through calling handleNulls
+ * @param {object} a sort value a
+ * @param {object} b sort value b
+ * @returns {number} normal sort function, returns -ve, 0, +ve
+ */
+ rowSorter.sortAlpha = function sortAlpha(a, b) {
+ var nulls = rowSorter.handleNulls(a, b);
+ if ( nulls !== null ){
+ return nulls;
+ } else {
+ var strA = a.toString().toLowerCase(),
+ strB = b.toString().toLowerCase();
+
+ return strA === strB ? 0 : (strA < strB ? -1 : 1);
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:RowSorter
+ * @name sortDate
+ * @description Sorts date values. Handles nulls and undefined through calling handleNulls.
+ * Handles date strings by converting to Date object if not already an instance of Date
+ * @param {object} a sort value a
+ * @param {object} b sort value b
+ * @returns {number} normal sort function, returns -ve, 0, +ve
+ */
+ rowSorter.sortDate = function sortDate(a, b) {
+ var nulls = rowSorter.handleNulls(a, b);
+ if ( nulls !== null ){
+ return nulls;
+ } else {
+ if (!(a instanceof Date)) {
+ a = new Date(a);
+ }
+ if (!(b instanceof Date)){
+ b = new Date(b);
+ }
+ var timeA = a.getTime(),
+ timeB = b.getTime();
+
+ return timeA === timeB ? 0 : (timeA < timeB ? -1 : 1);
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:RowSorter
+ * @name sortBool
+ * @description Sorts boolean values, true is considered larger than false.
+ * Handles nulls and undefined through calling handleNulls
+ * @param {object} a sort value a
+ * @param {object} b sort value b
+ * @returns {number} normal sort function, returns -ve, 0, +ve
+ */
+ rowSorter.sortBool = function sortBool(a, b) {
+ var nulls = rowSorter.handleNulls(a, b);
+ if ( nulls !== null ){
+ return nulls;
+ } else {
+ if (a && b) {
+ return 0;
+ }
+
+ if (!a && !b) {
+ return 0;
+ }
+ else {
+ return a ? 1 : -1;
+ }
+ }
+ };
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:RowSorter
+ * @name getSortFn
+ * @description Get the sort function for the column. Looks first in
+ * rowSorter.colSortFnCache using the column name, failing that it
+ * looks at col.sortingAlgorithm (and puts it in the cache), failing that
+ * it guesses the sort algorithm based on the data type.
+ *
+ * The cache currently seems a bit pointless, as none of the work we do is
+ * processor intensive enough to need caching. Presumably in future we might
+ * inspect the row data itself to guess the sort function, and in that case
+ * it would make sense to have a cache, the infrastructure is in place to allow
+ * that.
+ *
+ * @param {Grid} grid the grid to consider
+ * @param {GridCol} col the column to find a function for
+ * @param {array} rows an array of grid rows. Currently unused, but presumably in future
+ * we might inspect the rows themselves to decide what sort of data might be there
+ * @returns {function} the sort function chosen for the column
+ */
+ rowSorter.getSortFn = function getSortFn(grid, col, rows) {
+ var sortFn, item;
+
+ // See if we already figured out what to use to sort the column and have it in the cache
+ if (rowSorter.colSortFnCache[col.colDef.name]) {
+ sortFn = rowSorter.colSortFnCache[col.colDef.name];
+ }
+ // If the column has its OWN sorting algorithm, use that
+ else if (col.sortingAlgorithm !== undefined) {
+ sortFn = col.sortingAlgorithm;
+ rowSorter.colSortFnCache[col.colDef.name] = col.sortingAlgorithm;
+ }
+ // Always default to sortAlpha when sorting after a cellFilter
+ else if ( col.sortCellFiltered && col.cellFilter ){
+ sortFn = rowSorter.sortAlpha;
+ rowSorter.colSortFnCache[col.colDef.name] = sortFn;
+ }
+ // Try and guess what sort function to use
+ else {
+ // Guess the sort function
+ sortFn = rowSorter.guessSortFn(col.colDef.type);
+
+ // If we found a sort function, cache it
+ if (sortFn) {
+ rowSorter.colSortFnCache[col.colDef.name] = sortFn;
+ }
+ else {
+ // We assign the alpha sort because anything that is null/undefined will never get passed to
+ // the actual sorting function. It will get caught in our null check and returned to be sorted
+ // down to the bottom
+ sortFn = rowSorter.sortAlpha;
+ }
+ }
+
+ return sortFn;
+ };
+
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:RowSorter
+ * @name prioritySort
+ * @description Used where multiple columns are present in the sort criteria,
+ * we determine which column should take precedence in the sort by sorting
+ * the columns based on their sort.priority
+ *
+ * @param {gridColumn} a column a
+ * @param {gridColumn} b column b
+ * @returns {number} normal sort function, returns -ve, 0, +ve
+ */
+ rowSorter.prioritySort = function (a, b) {
+ // Both columns have a sort priority
+ if (a.sort.priority !== undefined && b.sort.priority !== undefined) {
+ // A is higher priority
+ if (a.sort.priority < b.sort.priority) {
+ return -1;
+ }
+ // Equal
+ else if (a.sort.priority === b.sort.priority) {
+ return 0;
+ }
+ // B is higher
+ else {
+ return 1;
+ }
+ }
+ // Only A has a priority
+ else if (a.sort.priority || a.sort.priority === 0) {
+ return -1;
+ }
+ // Only B has a priority
+ else if (b.sort.priority || b.sort.priority === 0) {
+ return 1;
+ }
+ // Neither has a priority
+ else {
+ return 0;
+ }
+ };
+
+
+ /**
+ * @ngdoc object
+ * @name useExternalSorting
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Prevents the internal sorting from executing. Events will
+ * still be fired when the sort changes, and the sort information on
+ * the columns will be updated, allowing an external sorter (for example,
+ * server sorting) to be implemented. Defaults to false.
+ *
+ */
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.class:RowSorter
+ * @name sort
+ * @description sorts the grid
+ * @param {Object} grid the grid itself
+ * @param {array} rows the rows to be sorted
+ * @param {array} columns the columns in which to look
+ * for sort criteria
+ * @returns {array} sorted rows
+ */
+ rowSorter.sort = function rowSorterSort(grid, rows, columns) {
+ // first make sure we are even supposed to do work
+ if (!rows) {
+ return;
+ }
+
+ if (grid.options.useExternalSorting){
+ return rows;
+ }
+
+ // Build the list of columns to sort by
+ var sortCols = [];
+ columns.forEach(function (col) {
+ if (col.sort && !col.sort.ignoreSort && col.sort.direction && (col.sort.direction === uiGridConstants.ASC || col.sort.direction === uiGridConstants.DESC)) {
+ sortCols.push(col);
+ }
+ });
+
+ // Sort the "sort columns" by their sort priority
+ sortCols = sortCols.sort(rowSorter.prioritySort);
+
+ // Now rows to sort by, maintain original order
+ if (sortCols.length === 0) {
+ return rows;
+ }
+
+ // Re-usable variables
+ var col, direction;
+
+ // put a custom index field on each row, used to make a stable sort out of unstable sorts (e.g. Chrome)
+ var setIndex = function( row, idx ){
+ row.entity.$$uiGridIndex = idx;
+ };
+ rows.forEach(setIndex);
+
+ // IE9-11 HACK.... the 'rows' variable would be empty where we call rowSorter.getSortFn(...) below. We have to use a separate reference
+ // var d = data.slice(0);
+ var r = rows.slice(0);
+
+ // Now actually sort the data
+ var rowSortFn = function (rowA, rowB) {
+ var tem = 0,
+ idx = 0,
+ sortFn;
+
+ while (tem === 0 && idx < sortCols.length) {
+ // grab the metadata for the rest of the logic
+ col = sortCols[idx];
+ direction = sortCols[idx].sort.direction;
+
+ sortFn = rowSorter.getSortFn(grid, col, r);
+
+ var propA, propB;
+
+ if ( col.sortCellFiltered ){
+ propA = grid.getCellDisplayValue(rowA, col);
+ propB = grid.getCellDisplayValue(rowB, col);
+ } else {
+ propA = grid.getCellValue(rowA, col);
+ propB = grid.getCellValue(rowB, col);
+ }
+
+ tem = sortFn(propA, propB, rowA, rowB, direction);
+
+ idx++;
+ }
+
+ // Chrome doesn't implement a stable sort function. If our sort returns 0
+ // (i.e. the items are equal), and we're at the last sort column in the list,
+ // then return the previous order using our custom
+ // index variable
+ if (tem === 0 ) {
+ return rowA.entity.$$uiGridIndex - rowB.entity.$$uiGridIndex;
+ }
+
+ // Made it this far, we don't have to worry about null & undefined
+ if (direction === uiGridConstants.ASC) {
+ return tem;
+ } else {
+ return 0 - tem;
+ }
+ };
+
+ var newRows = rows.sort(rowSortFn);
+
+ // remove the custom index field on each row, used to make a stable sort out of unstable sorts (e.g. Chrome)
+ var clearIndex = function( row, idx ){
+ delete row.entity.$$uiGridIndex;
+ };
+ rows.forEach(clearIndex);
+
+ return newRows;
+ };
+
+ return rowSorter;
+}]);
+
+})();
+
+(function() {
+
+var module = angular.module('ui.grid');
+
+var bindPolyfill;
+if (typeof Function.prototype.bind !== "function") {
+ bindPolyfill = function() {
+ var slice = Array.prototype.slice;
+ return function(context) {
+ var fn = this,
+ args = slice.call(arguments, 1);
+ if (args.length) {
+ return function() {
+ return arguments.length ? fn.apply(context, args.concat(slice.call(arguments))) : fn.apply(context, args);
+ };
+ }
+ return function() {
+ return arguments.length ? fn.apply(context, arguments) : fn.call(context);
+ };
+ };
+ };
+}
+
+function getStyles (elem) {
+ var e = elem;
+ if (typeof(e.length) !== 'undefined' && e.length) {
+ e = elem[0];
+ }
+
+ return e.ownerDocument.defaultView.getComputedStyle(e, null);
+}
+
+var rnumnonpx = new RegExp( "^(" + (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source + ")(?!px)[a-z%]+$", "i" ),
+ // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
+ // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
+ rdisplayswap = /^(block|none|table(?!-c[ea]).+)/,
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" };
+
+function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
+ var i = extra === ( isBorderBox ? 'border' : 'content' ) ?
+ // If we already have the right measurement, avoid augmentation
+ 4 :
+ // Otherwise initialize for horizontal or vertical properties
+ name === 'width' ? 1 : 0,
+
+ val = 0;
+
+ var sides = ['Top', 'Right', 'Bottom', 'Left'];
+
+ for ( ; i < 4; i += 2 ) {
+ var side = sides[i];
+ // dump('side', side);
+
+ // both box models exclude margin, so add it if we want it
+ if ( extra === 'margin' ) {
+ var marg = parseFloat(styles[extra + side]);
+ if (!isNaN(marg)) {
+ val += marg;
+ }
+ }
+ // dump('val1', val);
+
+ if ( isBorderBox ) {
+ // border-box includes padding, so remove it if we want content
+ if ( extra === 'content' ) {
+ var padd = parseFloat(styles['padding' + side]);
+ if (!isNaN(padd)) {
+ val -= padd;
+ // dump('val2', val);
+ }
+ }
+
+ // at this point, extra isn't border nor margin, so remove border
+ if ( extra !== 'margin' ) {
+ var bordermarg = parseFloat(styles['border' + side + 'Width']);
+ if (!isNaN(bordermarg)) {
+ val -= bordermarg;
+ // dump('val3', val);
+ }
+ }
+ }
+ else {
+ // at this point, extra isn't content, so add padding
+ var nocontentPad = parseFloat(styles['padding' + side]);
+ if (!isNaN(nocontentPad)) {
+ val += nocontentPad;
+ // dump('val4', val);
+ }
+
+ // at this point, extra isn't content nor padding, so add border
+ if ( extra !== 'padding') {
+ var nocontentnopad = parseFloat(styles['border' + side + 'Width']);
+ if (!isNaN(nocontentnopad)) {
+ val += nocontentnopad;
+ // dump('val5', val);
+ }
+ }
+ }
+ }
+
+ // dump('augVal', val);
+
+ return val;
+}
+
+function getWidthOrHeight( elem, name, extra ) {
+ // Start with offset property, which is equivalent to the border-box value
+ var valueIsBorderBox = true,
+ val, // = name === 'width' ? elem.offsetWidth : elem.offsetHeight,
+ styles = getStyles(elem),
+ isBorderBox = styles['boxSizing'] === 'border-box';
+
+ // some non-html elements return undefined for offsetWidth, so check for null/undefined
+ // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
+ // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
+ if ( val <= 0 || val == null ) {
+ // Fall back to computed then uncomputed css if necessary
+ val = styles[name];
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ];
+ }
+
+ // Computed unit is not pixels. Stop here and return.
+ if ( rnumnonpx.test(val) ) {
+ return val;
+ }
+
+ // we need the check for style in case a browser which returns unreliable values
+ // for getComputedStyle silently falls back to the reliable elem.style
+ valueIsBorderBox = isBorderBox &&
+ ( true || val === elem.style[ name ] ); // use 'true' instead of 'support.boxSizingReliable()'
+
+ // Normalize "", auto, and prepare for extra
+ val = parseFloat( val ) || 0;
+ }
+
+ // use the active box-sizing model to add/subtract irrelevant styles
+ var ret = ( val +
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra || ( isBorderBox ? "border" : "content" ),
+ valueIsBorderBox,
+ styles
+ )
+ );
+
+ // dump('ret', ret, val);
+ return ret;
+}
+
+function getLineHeight(elm) {
+ elm = angular.element(elm)[0];
+ var parent = elm.parentElement;
+
+ if (!parent) {
+ parent = document.getElementsByTagName('body')[0];
+ }
+
+ return parseInt( getStyles(parent).fontSize ) || parseInt( getStyles(elm).fontSize ) || 16;
+}
+
+var uid = ['0', '0', '0', '0'];
+var uidPrefix = 'uiGrid-';
+
+/**
+ * @ngdoc service
+ * @name ui.grid.service:GridUtil
+ *
+ * @description Grid utility functions
+ */
+module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateCache', '$timeout', '$interval', '$injector', '$q', '$interpolate', 'uiGridConstants',
+ function ($log, $window, $document, $http, $templateCache, $timeout, $interval, $injector, $q, $interpolate, uiGridConstants) {
+ var s = {
+
+ augmentWidthOrHeight: augmentWidthOrHeight,
+
+ getStyles: getStyles,
+
+ /**
+ * @ngdoc method
+ * @name createBoundedWrapper
+ * @methodOf ui.grid.service:GridUtil
+ *
+ * @param {object} Object to bind 'this' to
+ * @param {method} Method to bind
+ * @returns {Function} The wrapper that performs the binding
+ *
+ * @description
+ * Binds given method to given object.
+ *
+ * By means of a wrapper, ensures that ``method`` is always bound to
+ * ``object`` regardless of its calling environment.
+ * Iow, inside ``method``, ``this`` always points to ``object``.
+ *
+ * See http://alistapart.com/article/getoutbindingsituations
+ *
+ */
+ createBoundedWrapper: function(object, method) {
+ return function() {
+ return method.apply(object, arguments);
+ };
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name readableColumnName
+ * @methodOf ui.grid.service:GridUtil
+ *
+ * @param {string} columnName Column name as a string
+ * @returns {string} Column name appropriately capitalized and split apart
+ *
+ @example
+ <example module="app">
+ <file name="app.js">
+ var app = angular.module('app', ['ui.grid']);
+
+ app.controller('MainCtrl', ['$scope', 'gridUtil', function ($scope, gridUtil) {
+ $scope.name = 'firstName';
+ $scope.columnName = function(name) {
+ return gridUtil.readableColumnName(name);
+ };
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <strong>Column name:</strong> <input ng-model="name" />
+ <br>
+ <strong>Output:</strong> <span ng-bind="columnName(name)"></span>
+ </div>
+ </file>
+ </example>
+ */
+ readableColumnName: function (columnName) {
+ // Convert underscores to spaces
+ if (typeof(columnName) === 'undefined' || columnName === undefined || columnName === null) { return columnName; }
+
+ if (typeof(columnName) !== 'string') {
+ columnName = String(columnName);
+ }
+
+ return columnName.replace(/_+/g, ' ')
+ // Replace a completely all-capsed word with a first-letter-capitalized version
+ .replace(/^[A-Z]+$/, function (match) {
+ return angular.lowercase(angular.uppercase(match.charAt(0)) + match.slice(1));
+ })
+ // Capitalize the first letter of words
+ .replace(/([\w\u00C0-\u017F]+)/g, function (match) {
+ return angular.uppercase(match.charAt(0)) + match.slice(1);
+ })
+ // Put a space in between words that have partial capilizations (i.e. 'firstName' becomes 'First Name')
+ // .replace(/([A-Z]|[A-Z]\w+)([A-Z])/g, "$1 $2");
+ // .replace(/(\w+?|\w)([A-Z])/g, "$1 $2");
+ .replace(/(\w+?(?=[A-Z]))/g, '$1 ');
+ },
+
+ /**
+ * @ngdoc method
+ * @name getColumnsFromData
+ * @methodOf ui.grid.service:GridUtil
+ * @description Return a list of column names, given a data set
+ *
+ * @param {string} data Data array for grid
+ * @returns {Object} Column definitions with field accessor and column name
+ *
+ * @example
+ <pre>
+ var data = [
+ { firstName: 'Bob', lastName: 'Jones' },
+ { firstName: 'Frank', lastName: 'Smith' }
+ ];
+
+ var columnDefs = GridUtil.getColumnsFromData(data, excludeProperties);
+
+ columnDefs == [
+ {
+ field: 'firstName',
+ name: 'First Name'
+ },
+ {
+ field: 'lastName',
+ name: 'Last Name'
+ }
+ ];
+ </pre>
+ */
+ getColumnsFromData: function (data, excludeProperties) {
+ var columnDefs = [];
+
+ if (!data || typeof(data[0]) === 'undefined' || data[0] === undefined) { return []; }
+ if (angular.isUndefined(excludeProperties)) { excludeProperties = []; }
+
+ var item = data[0];
+
+ angular.forEach(item,function (prop, propName) {
+ if ( excludeProperties.indexOf(propName) === -1){
+ columnDefs.push({
+ name: propName
+ });
+ }
+ });
+
+ return columnDefs;
+ },
+
+ /**
+ * @ngdoc method
+ * @name newId
+ * @methodOf ui.grid.service:GridUtil
+ * @description Return a unique ID string
+ *
+ * @returns {string} Unique string
+ *
+ * @example
+ <pre>
+ var id = GridUtil.newId();
+
+ # 1387305700482;
+ </pre>
+ */
+ newId: (function() {
+ var seedId = new Date().getTime();
+ return function() {
+ return seedId += 1;
+ };
+ })(),
+
+
+ /**
+ * @ngdoc method
+ * @name getTemplate
+ * @methodOf ui.grid.service:GridUtil
+ * @description Get's template from cache / element / url
+ *
+ * @param {string|element|promise} Either a string representing the template id, a string representing the template url,
+ * an jQuery/Angualr element, or a promise that returns the template contents to use.
+ * @returns {object} a promise resolving to template contents
+ *
+ * @example
+ <pre>
+ GridUtil.getTemplate(url).then(function (contents) {
+ alert(contents);
+ })
+ </pre>
+ */
+ getTemplate: function (template) {
+ // Try to fetch the template out of the templateCache
+ if ($templateCache.get(template)) {
+ return s.postProcessTemplate($templateCache.get(template));
+ }
+
+ // See if the template is itself a promise
+ if (template.hasOwnProperty('then')) {
+ return template.then(s.postProcessTemplate);
+ }
+
+ // If the template is an element, return the element
+ try {
+ if (angular.element(template).length > 0) {
+ return $q.when(template).then(s.postProcessTemplate);
+ }
+ }
+ catch (err){
+ //do nothing; not valid html
+ }
+
+ s.logDebug('fetching url', template);
+
+ // Default to trying to fetch the template as a url with $http
+ return $http({ method: 'GET', url: template})
+ .then(
+ function (result) {
+ var templateHtml = result.data.trim();
+ //put in templateCache for next call
+ $templateCache.put(template, templateHtml);
+ return templateHtml;
+ },
+ function (err) {
+ throw new Error("Could not get template " + template + ": " + err);
+ }
+ )
+ .then(s.postProcessTemplate);
+ },
+
+ //
+ postProcessTemplate: function (template) {
+ var startSym = $interpolate.startSymbol(),
+ endSym = $interpolate.endSymbol();
+
+ // If either of the interpolation symbols have been changed, we need to alter this template
+ if (startSym !== '{{' || endSym !== '}}') {
+ template = template.replace(/\{\{/g, startSym);
+ template = template.replace(/\}\}/g, endSym);
+ }
+
+ return $q.when(template);
+ },
+
+ /**
+ * @ngdoc method
+ * @name guessType
+ * @methodOf ui.grid.service:GridUtil
+ * @description guesses the type of an argument
+ *
+ * @param {string/number/bool/object} item variable to examine
+ * @returns {string} one of the following
+ * - 'string'
+ * - 'boolean'
+ * - 'number'
+ * - 'date'
+ * - 'object'
+ */
+ guessType : function (item) {
+ var itemType = typeof(item);
+
+ // Check for numbers and booleans
+ switch (itemType) {
+ case "number":
+ case "boolean":
+ case "string":
+ return itemType;
+ default:
+ if (angular.isDate(item)) {
+ return "date";
+ }
+ return "object";
+ }
+ },
+
+
+ /**
+ * @ngdoc method
+ * @name elementWidth
+ * @methodOf ui.grid.service:GridUtil
+ *
+ * @param {element} element DOM element
+ * @param {string} [extra] Optional modifier for calculation. Use 'margin' to account for margins on element
+ *
+ * @returns {number} Element width in pixels, accounting for any borders, etc.
+ */
+ elementWidth: function (elem) {
+
+ },
+
+ /**
+ * @ngdoc method
+ * @name elementHeight
+ * @methodOf ui.grid.service:GridUtil
+ *
+ * @param {element} element DOM element
+ * @param {string} [extra] Optional modifier for calculation. Use 'margin' to account for margins on element
+ *
+ * @returns {number} Element height in pixels, accounting for any borders, etc.
+ */
+ elementHeight: function (elem) {
+
+ },
+
+ // Thanks to http://stackoverflow.com/a/13382873/888165
+ getScrollbarWidth: function() {
+ var outer = document.createElement("div");
+ outer.style.visibility = "hidden";
+ outer.style.width = "100px";
+ outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
+
+ document.body.appendChild(outer);
+
+ var widthNoScroll = outer.offsetWidth;
+ // force scrollbars
+ outer.style.overflow = "scroll";
+
+ // add innerdiv
+ var inner = document.createElement("div");
+ inner.style.width = "100%";
+ outer.appendChild(inner);
+
+ var widthWithScroll = inner.offsetWidth;
+
+ // remove divs
+ outer.parentNode.removeChild(outer);
+
+ return widthNoScroll - widthWithScroll;
+ },
+
+ swap: function( elem, options, callback, args ) {
+ var ret, name,
+ old = {};
+
+ // Remember the old values, and insert the new ones
+ for ( name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ ret = callback.apply( elem, args || [] );
+
+ // Revert the old values
+ for ( name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
+
+ return ret;
+ },
+
+ fakeElement: function( elem, options, callback, args ) {
+ var ret, name,
+ newElement = angular.element(elem).clone()[0];
+
+ for ( name in options ) {
+ newElement.style[ name ] = options[ name ];
+ }
+
+ angular.element(document.body).append(newElement);
+
+ ret = callback.call( newElement, newElement );
+
+ angular.element(newElement).remove();
+
+ return ret;
+ },
+
+ /**
+ * @ngdoc method
+ * @name normalizeWheelEvent
+ * @methodOf ui.grid.service:GridUtil
+ *
+ * @param {event} event A mouse wheel event
+ *
+ * @returns {event} A normalized event
+ *
+ * @description
+ * Given an event from this list:
+ *
+ * `wheel, mousewheel, DomMouseScroll, MozMousePixelScroll`
+ *
+ * "normalize" it
+ * so that it stays consistent no matter what browser it comes from (i.e. scale it correctly and make sure the direction is right.)
+ */
+ normalizeWheelEvent: function (event) {
+ // var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'];
+ // var toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'];
+ var lowestDelta, lowestDeltaXY;
+
+ var orgEvent = event || window.event,
+ args = [].slice.call(arguments, 1),
+ delta = 0,
+ deltaX = 0,
+ deltaY = 0,
+ absDelta = 0,
+ absDeltaXY = 0,
+ fn;
+
+ // event = $.event.fix(orgEvent);
+ // event.type = 'mousewheel';
+
+ // NOTE: jQuery masks the event and stores it in the event as originalEvent
+ if (orgEvent.originalEvent) {
+ orgEvent = orgEvent.originalEvent;
+ }
+
+ // Old school scrollwheel delta
+ if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta; }
+ if ( orgEvent.detail ) { delta = orgEvent.detail * -1; }
+
+ // At a minimum, setup the deltaY to be delta
+ deltaY = delta;
+
+ // Firefox < 17 related to DOMMouseScroll event
+ if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
+ deltaY = 0;
+ deltaX = delta * -1;
+ }
+
+ // New school wheel delta (wheel event)
+ if ( orgEvent.deltaY ) {
+ deltaY = orgEvent.deltaY * -1;
+ delta = deltaY;
+ }
+ if ( orgEvent.deltaX ) {
+ deltaX = orgEvent.deltaX;
+ delta = deltaX * -1;
+ }
+
+ // Webkit
+ if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY; }
+ if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = orgEvent.wheelDeltaX; }
+
+ // Look for lowest delta to normalize the delta values
+ absDelta = Math.abs(delta);
+ if ( !lowestDelta || absDelta < lowestDelta ) { lowestDelta = absDelta; }
+ absDeltaXY = Math.max(Math.abs(deltaY), Math.abs(deltaX));
+ if ( !lowestDeltaXY || absDeltaXY < lowestDeltaXY ) { lowestDeltaXY = absDeltaXY; }
+
+ // Get a whole value for the deltas
+ fn = delta > 0 ? 'floor' : 'ceil';
+ delta = Math[fn](delta / lowestDelta);
+ deltaX = Math[fn](deltaX / lowestDeltaXY);
+ deltaY = Math[fn](deltaY / lowestDeltaXY);
+
+ return {
+ delta: delta,
+ deltaX: deltaX,
+ deltaY: deltaY
+ };
+ },
+
+ // Stolen from Modernizr
+ // TODO: make this, and everythign that flows from it, robust
+ //http://www.stucox.com/blog/you-cant-detect-a-touchscreen/
+ isTouchEnabled: function() {
+ var bool;
+
+ if (('ontouchstart' in $window) || $window.DocumentTouch && $document instanceof DocumentTouch) {
+ bool = true;
+ }
+
+ return bool;
+ },
+
+ isNullOrUndefined: function(obj) {
+ if (obj === undefined || obj === null) {
+ return true;
+ }
+ return false;
+ },
+
+ endsWith: function(str, suffix) {
+ if (!str || !suffix || typeof str !== "string") {
+ return false;
+ }
+ return str.indexOf(suffix, str.length - suffix.length) !== -1;
+ },
+
+ arrayContainsObjectWithProperty: function(array, propertyName, propertyValue) {
+ var found = false;
+ angular.forEach(array, function (object) {
+ if (object[propertyName] === propertyValue) {
+ found = true;
+ }
+ });
+ return found;
+ },
+
+ //// Shim requestAnimationFrame
+ //requestAnimationFrame: $window.requestAnimationFrame && $window.requestAnimationFrame.bind($window) ||
+ // $window.webkitRequestAnimationFrame && $window.webkitRequestAnimationFrame.bind($window) ||
+ // function(fn) {
+ // return $timeout(fn, 10, false);
+ // },
+
+ numericAndNullSort: function (a, b) {
+ if (a === null) { return 1; }
+ if (b === null) { return -1; }
+ if (a === null && b === null) { return 0; }
+ return a - b;
+ },
+
+ // Disable ngAnimate animations on an element
+ disableAnimations: function (element) {
+ var $animate;
+ try {
+ $animate = $injector.get('$animate');
+ // See: http://brianhann.com/angular-1-4-breaking-changes-to-be-aware-of/#animate
+ if (angular.version.major > 1 || (angular.version.major === 1 && angular.version.minor >= 4)) {
+ $animate.enabled(element, false);
+ } else {
+ $animate.enabled(false, element);
+ }
+ }
+ catch (e) {}
+ },
+
+ enableAnimations: function (element) {
+ var $animate;
+ try {
+ $animate = $injector.get('$animate');
+ // See: http://brianhann.com/angular-1-4-breaking-changes-to-be-aware-of/#animate
+ if (angular.version.major > 1 || (angular.version.major === 1 && angular.version.minor >= 4)) {
+ $animate.enabled(element, true);
+ } else {
+ $animate.enabled(true, element);
+ }
+ return $animate;
+ }
+ catch (e) {}
+ },
+
+ // Blatantly stolen from Angular as it isn't exposed (yet. 2.0 maybe?)
+ nextUid: function nextUid() {
+ var index = uid.length;
+ var digit;
+
+ while (index) {
+ index--;
+ digit = uid[index].charCodeAt(0);
+ if (digit === 57 /*'9'*/) {
+ uid[index] = 'A';
+ return uidPrefix + uid.join('');
+ }
+ if (digit === 90 /*'Z'*/) {
+ uid[index] = '0';
+ } else {
+ uid[index] = String.fromCharCode(digit + 1);
+ return uidPrefix + uid.join('');
+ }
+ }
+ uid.unshift('0');
+
+ return uidPrefix + uid.join('');
+ },
+
+ // Blatantly stolen from Angular as it isn't exposed (yet. 2.0 maybe?)
+ hashKey: function hashKey(obj) {
+ var objType = typeof obj,
+ key;
+
+ if (objType === 'object' && obj !== null) {
+ if (typeof (key = obj.$$hashKey) === 'function') {
+ // must invoke on object to keep the right this
+ key = obj.$$hashKey();
+ }
+ else if (typeof(obj.$$hashKey) !== 'undefined' && obj.$$hashKey) {
+ key = obj.$$hashKey;
+ }
+ else if (key === undefined) {
+ key = obj.$$hashKey = s.nextUid();
+ }
+ }
+ else {
+ key = obj;
+ }
+
+ return objType + ':' + key;
+ },
+
+ resetUids: function () {
+ uid = ['0', '0', '0'];
+ },
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:GridUtil
+ * @name logError
+ * @description wraps the $log method, allowing us to choose different
+ * treatment within ui-grid if we so desired. At present we only log
+ * error messages if uiGridConstants.LOG_ERROR_MESSAGES is set to true
+ * @param {string} logMessage message to be logged to the console
+ *
+ */
+ logError: function( logMessage ){
+ if ( uiGridConstants.LOG_ERROR_MESSAGES ){
+ $log.error( logMessage );
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:GridUtil
+ * @name logWarn
+ * @description wraps the $log method, allowing us to choose different
+ * treatment within ui-grid if we so desired. At present we only log
+ * warning messages if uiGridConstants.LOG_WARN_MESSAGES is set to true
+ * @param {string} logMessage message to be logged to the console
+ *
+ */
+ logWarn: function( logMessage ){
+ if ( uiGridConstants.LOG_WARN_MESSAGES ){
+ $log.warn( logMessage );
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:GridUtil
+ * @name logDebug
+ * @description wraps the $log method, allowing us to choose different
+ * treatment within ui-grid if we so desired. At present we only log
+ * debug messages if uiGridConstants.LOG_DEBUG_MESSAGES is set to true
+ *
+ */
+ logDebug: function() {
+ if ( uiGridConstants.LOG_DEBUG_MESSAGES ){
+ $log.debug.apply($log, arguments);
+ }
+ }
+
+ };
+
+ /**
+ * @ngdoc object
+ * @name focus
+ * @propertyOf ui.grid.service:GridUtil
+ * @description Provies a set of methods to set the document focus inside the grid.
+ * See {@link ui.grid.service:GridUtil.focus} for more information.
+ */
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.service:GridUtil.focus
+ * @description Provies a set of methods to set the document focus inside the grid.
+ * Timeouts are utilized to ensure that the focus is invoked after any other event has been triggered.
+ * e.g. click events that need to run before the focus or
+ * inputs elements that are in a disabled state but are enabled when those events
+ * are triggered.
+ */
+ s.focus = {
+ queue: [],
+ //http://stackoverflow.com/questions/25596399/set-element-focus-in-angular-way
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:GridUtil.focus
+ * @name byId
+ * @description Sets the focus of the document to the given id value.
+ * If provided with the grid object it will automatically append the grid id.
+ * This is done to encourage unique dom id's as it allows for multiple grids on a
+ * page.
+ * @param {String} id the id of the dom element to set the focus on
+ * @param {Object=} Grid the grid object for this grid instance. See: {@link ui.grid.class:Grid}
+ * @param {Number} Grid.id the unique id for this grid. Already set on an initialized grid object.
+ * @returns {Promise} The `$timeout` promise that will be resolved once focus is set. If another focus is requested before this request is evaluated.
+ * then the promise will fail with the `'canceled'` reason.
+ */
+ byId: function (id, Grid) {
+ this._purgeQueue();
+ var promise = $timeout(function() {
+ var elementID = (Grid && Grid.id ? Grid.id + '-' : '') + id;
+ var element = $window.document.getElementById(elementID);
+ if (element) {
+ element.focus();
+ } else {
+ s.logWarn('[focus.byId] Element id ' + elementID + ' was not found.');
+ }
+ });
+ this.queue.push(promise);
+ return promise;
+ },
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:GridUtil.focus
+ * @name byElement
+ * @description Sets the focus of the document to the given dom element.
+ * @param {(element|angular.element)} element the DOM element to set the focus on
+ * @returns {Promise} The `$timeout` promise that will be resolved once focus is set. If another focus is requested before this request is evaluated.
+ * then the promise will fail with the `'canceled'` reason.
+ */
+ byElement: function(element){
+ if (!angular.isElement(element)){
+ s.logWarn("Trying to focus on an element that isn\'t an element.");
+ return $q.reject('not-element');
+ }
+ element = angular.element(element);
+ this._purgeQueue();
+ var promise = $timeout(function(){
+ if (element){
+ element[0].focus();
+ }
+ });
+ this.queue.push(promise);
+ return promise;
+ },
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.service:GridUtil.focus
+ * @name bySelector
+ * @description Sets the focus of the document to the given dom element.
+ * @param {(element|angular.element)} parentElement the parent/ancestor of the dom element that you are selecting using the query selector
+ * @param {String} querySelector finds the dom element using the {@link http://www.w3schools.com/jsref/met_document_queryselector.asp querySelector}
+ * @param {boolean} [aSync=false] If true then the selector will be querried inside of a timeout. Otherwise the selector will be querried imidately
+ * then the focus will be called.
+ * @returns {Promise} The `$timeout` promise that will be resolved once focus is set. If another focus is requested before this request is evaluated.
+ * then the promise will fail with the `'canceled'` reason.
+ */
+ bySelector: function(parentElement, querySelector, aSync){
+ var self = this;
+ if (!angular.isElement(parentElement)){
+ throw new Error("The parent element is not an element.");
+ }
+ // Ensure that this is an angular element.
+ // It is fine if this is already an angular element.
+ parentElement = angular.element(parentElement);
+ var focusBySelector = function(){
+ var element = parentElement[0].querySelector(querySelector);
+ return self.byElement(element);
+ };
+ this._purgeQueue();
+ if (aSync){ //Do this asynchronysly
+ var promise = $timeout(focusBySelector);
+ this.queue.push($timeout(focusBySelector));
+ return promise;
+ } else {
+ return focusBySelector();
+ }
+ },
+ _purgeQueue: function(){
+ this.queue.forEach(function(element){
+ $timeout.cancel(element);
+ });
+ this.queue = [];
+ }
+ };
+
+
+ ['width', 'height'].forEach(function (name) {
+ var capsName = angular.uppercase(name.charAt(0)) + name.substr(1);
+ s['element' + capsName] = function (elem, extra) {
+ var e = elem;
+ if (e && typeof(e.length) !== 'undefined' && e.length) {
+ e = elem[0];
+ }
+
+ if (e) {
+ var styles = getStyles(e);
+ return e.offsetWidth === 0 && rdisplayswap.test(styles.display) ?
+ s.swap(e, cssShow, function() {
+ return getWidthOrHeight(e, name, extra );
+ }) :
+ getWidthOrHeight( e, name, extra );
+ }
+ else {
+ return null;
+ }
+ };
+
+ s['outerElement' + capsName] = function (elem, margin) {
+ return elem ? s['element' + capsName].call(this, elem, margin ? 'margin' : 'border') : null;
+ };
+ });
+
+ // http://stackoverflow.com/a/24107550/888165
+ s.closestElm = function closestElm(el, selector) {
+ if (typeof(el.length) !== 'undefined' && el.length) {
+ el = el[0];
+ }
+
+ var matchesFn;
+
+ // find vendor prefix
+ ['matches','webkitMatchesSelector','mozMatchesSelector','msMatchesSelector','oMatchesSelector'].some(function(fn) {
+ if (typeof document.body[fn] === 'function') {
+ matchesFn = fn;
+ return true;
+ }
+ return false;
+ });
+
+ // traverse parents
+ var parent;
+ while (el !== null) {
+ parent = el.parentElement;
+ if (parent !== null && parent[matchesFn](selector)) {
+ return parent;
+ }
+ el = parent;
+ }
+
+ return null;
+ };
+
+ s.type = function (obj) {
+ var text = Function.prototype.toString.call(obj.constructor);
+ return text.match(/function (.*?)\(/)[1];
+ };
+
+ s.getBorderSize = function getBorderSize(elem, borderType) {
+ if (typeof(elem.length) !== 'undefined' && elem.length) {
+ elem = elem[0];
+ }
+
+ var styles = getStyles(elem);
+
+ // If a specific border is supplied, like 'top', read the 'borderTop' style property
+ if (borderType) {
+ borderType = 'border' + borderType.charAt(0).toUpperCase() + borderType.slice(1);
+ }
+ else {
+ borderType = 'border';
+ }
+
+ borderType += 'Width';
+
+ var val = parseInt(styles[borderType], 10);
+
+ if (isNaN(val)) {
+ return 0;
+ }
+ else {
+ return val;
+ }
+ };
+
+ // http://stackoverflow.com/a/22948274/888165
+ // TODO: Opera? Mobile?
+ s.detectBrowser = function detectBrowser() {
+ var userAgent = $window.navigator.userAgent;
+
+ var browsers = {chrome: /chrome/i, safari: /safari/i, firefox: /firefox/i, ie: /internet explorer|trident\//i};
+
+ for (var key in browsers) {
+ if (browsers[key].test(userAgent)) {
+ return key;
+ }
+ }
+
+ return 'unknown';
+ };
+
+ // Borrowed from https://github.com/othree/jquery.rtl-scroll-type
+ // Determine the scroll "type" this browser is using for RTL
+ s.rtlScrollType = function rtlScrollType() {
+ if (rtlScrollType.type) {
+ return rtlScrollType.type;
+ }
+
+ var definer = angular.element('<div dir="rtl" style="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll">A</div>')[0],
+ type = 'reverse';
+
+ document.body.appendChild(definer);
+
+ if (definer.scrollLeft > 0) {
+ type = 'default';
+ }
+ else {
+ definer.scrollLeft = 1;
+ if (definer.scrollLeft === 0) {
+ type = 'negative';
+ }
+ }
+
+ angular.element(definer).remove();
+ rtlScrollType.type = type;
+
+ return type;
+ };
+
+ /**
+ * @ngdoc method
+ * @name normalizeScrollLeft
+ * @methodOf ui.grid.service:GridUtil
+ *
+ * @param {element} element The element to get the `scrollLeft` from.
+ * @param {grid} grid - grid used to normalize (uses the rtl property)
+ *
+ * @returns {number} A normalized scrollLeft value for the current browser.
+ *
+ * @description
+ * Browsers currently handle RTL in different ways, resulting in inconsistent scrollLeft values. This method normalizes them
+ */
+ s.normalizeScrollLeft = function normalizeScrollLeft(element, grid) {
+ if (typeof(element.length) !== 'undefined' && element.length) {
+ element = element[0];
+ }
+
+ var scrollLeft = element.scrollLeft;
+
+ if (grid.isRTL()) {
+ switch (s.rtlScrollType()) {
+ case 'default':
+ return element.scrollWidth - scrollLeft - element.clientWidth;
+ case 'negative':
+ return Math.abs(scrollLeft);
+ case 'reverse':
+ return scrollLeft;
+ }
+ }
+
+ return scrollLeft;
+ };
+
+ /**
+ * @ngdoc method
+ * @name denormalizeScrollLeft
+ * @methodOf ui.grid.service:GridUtil
+ *
+ * @param {element} element The element to normalize the `scrollLeft` value for
+ * @param {number} scrollLeft The `scrollLeft` value to denormalize.
+ * @param {grid} grid The grid that owns the scroll event.
+ *
+ * @returns {number} A normalized scrollLeft value for the current browser.
+ *
+ * @description
+ * Browsers currently handle RTL in different ways, resulting in inconsistent scrollLeft values. This method denormalizes a value for the current browser.
+ */
+ s.denormalizeScrollLeft = function denormalizeScrollLeft(element, scrollLeft, grid) {
+ if (typeof(element.length) !== 'undefined' && element.length) {
+ element = element[0];
+ }
+
+ if (grid.isRTL()) {
+ switch (s.rtlScrollType()) {
+ case 'default':
+ // Get the max scroll for the element
+ var maxScrollLeft = element.scrollWidth - element.clientWidth;
+
+ // Subtract the current scroll amount from the max scroll
+ return maxScrollLeft - scrollLeft;
+ case 'negative':
+ return scrollLeft * -1;
+ case 'reverse':
+ return scrollLeft;
+ }
+ }
+
+ return scrollLeft;
+ };
+
+ /**
+ * @ngdoc method
+ * @name preEval
+ * @methodOf ui.grid.service:GridUtil
+ *
+ * @param {string} path Path to evaluate
+ *
+ * @returns {string} A path that is normalized.
+ *
+ * @description
+ * Takes a field path and converts it to bracket notation to allow for special characters in path
+ * @example
+ * <pre>
+ * gridUtil.preEval('property') == 'property'
+ * gridUtil.preEval('nested.deep.prop-erty') = "nested['deep']['prop-erty']"
+ * </pre>
+ */
+ s.preEval = function (path) {
+ var m = uiGridConstants.BRACKET_REGEXP.exec(path);
+ if (m) {
+ return (m[1] ? s.preEval(m[1]) : m[1]) + m[2] + (m[3] ? s.preEval(m[3]) : m[3]);
+ } else {
+ path = path.replace(uiGridConstants.APOS_REGEXP, '\\\'');
+ var parts = path.split(uiGridConstants.DOT_REGEXP);
+ var preparsed = [parts.shift()]; // first item must be var notation, thus skip
+ angular.forEach(parts, function (part) {
+ preparsed.push(part.replace(uiGridConstants.FUNC_REGEXP, '\']$1'));
+ });
+ return preparsed.join('[\'');
+ }
+ };
+
+ /**
+ * @ngdoc method
+ * @name debounce
+ * @methodOf ui.grid.service:GridUtil
+ *
+ * @param {function} func function to debounce
+ * @param {number} wait milliseconds to delay
+ * @param {boolean} immediate execute before delay
+ *
+ * @returns {function} A function that can be executed as debounced function
+ *
+ * @description
+ * Copied from https://github.com/shahata/angular-debounce
+ * Takes a function, decorates it to execute only 1 time after multiple calls, and returns the decorated function
+ * @example
+ * <pre>
+ * var debouncedFunc = gridUtil.debounce(function(){alert('debounced');}, 500);
+ * debouncedFunc();
+ * debouncedFunc();
+ * debouncedFunc();
+ * </pre>
+ */
+ s.debounce = function (func, wait, immediate) {
+ var timeout, args, context, result;
+ function debounce() {
+ /* jshint validthis:true */
+ context = this;
+ args = arguments;
+ var later = function () {
+ timeout = null;
+ if (!immediate) {
+ result = func.apply(context, args);
+ }
+ };
+ var callNow = immediate && !timeout;
+ if (timeout) {
+ $timeout.cancel(timeout);
+ }
+ timeout = $timeout(later, wait);
+ if (callNow) {
+ result = func.apply(context, args);
+ }
+ return result;
+ }
+ debounce.cancel = function () {
+ $timeout.cancel(timeout);
+ timeout = null;
+ };
+ return debounce;
+ };
+
+ /**
+ * @ngdoc method
+ * @name throttle
+ * @methodOf ui.grid.service:GridUtil
+ *
+ * @param {function} func function to throttle
+ * @param {number} wait milliseconds to delay after first trigger
+ * @param {Object} params to use in throttle.
+ *
+ * @returns {function} A function that can be executed as throttled function
+ *
+ * @description
+ * Adapted from debounce function (above)
+ * Potential keys for Params Object are:
+ * trailing (bool) - whether to trigger after throttle time ends if called multiple times
+ * Updated to use $interval rather than $timeout, as protractor (e2e tests) is able to work with $interval,
+ * but not with $timeout
+ *
+ * Note that when using throttle, you need to use throttle to create a new function upfront, then use the function
+ * return from that call each time you need to call throttle. If you call throttle itself repeatedly, the lastCall
+ * variable will get overwritten and the throttling won't work
+ *
+ * @example
+ * <pre>
+ * var throttledFunc = gridUtil.throttle(function(){console.log('throttled');}, 500, {trailing: true});
+ * throttledFunc(); //=> logs throttled
+ * throttledFunc(); //=> queues attempt to log throttled for ~500ms (since trailing param is truthy)
+ * throttledFunc(); //=> updates arguments to keep most-recent request, but does not do anything else.
+ * </pre>
+ */
+ s.throttle = function(func, wait, options){
+ options = options || {};
+ var lastCall = 0, queued = null, context, args;
+
+ function runFunc(endDate){
+ lastCall = +new Date();
+ func.apply(context, args);
+ $interval(function(){ queued = null; }, 0, 1);
+ }
+
+ return function(){
+ /* jshint validthis:true */
+ context = this;
+ args = arguments;
+ if (queued === null){
+ var sinceLast = +new Date() - lastCall;
+ if (sinceLast > wait){
+ runFunc();
+ }
+ else if (options.trailing){
+ queued = $interval(runFunc, wait - sinceLast, 1);
+ }
+ }
+ };
+ };
+
+ s.on = {};
+ s.off = {};
+ s._events = {};
+
+ s.addOff = function (eventName) {
+ s.off[eventName] = function (elm, fn) {
+ var idx = s._events[eventName].indexOf(fn);
+ if (idx > 0) {
+ s._events[eventName].removeAt(idx);
+ }
+ };
+ };
+
+ var mouseWheeltoBind = ( 'onwheel' in document || document.documentMode >= 9 ) ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
+ nullLowestDeltaTimeout,
+ lowestDelta;
+
+ s.on.mousewheel = function (elm, fn) {
+ if (!elm || !fn) { return; }
+
+ var $elm = angular.element(elm);
+
+ // Store the line height and page height for this particular element
+ $elm.data('mousewheel-line-height', getLineHeight($elm));
+ $elm.data('mousewheel-page-height', s.elementHeight($elm));
+ if (!$elm.data('mousewheel-callbacks')) { $elm.data('mousewheel-callbacks', {}); }
+
+ var cbs = $elm.data('mousewheel-callbacks');
+ cbs[fn] = (Function.prototype.bind || bindPolyfill).call(mousewheelHandler, $elm[0], fn);
+
+ // Bind all the mousew heel events
+ for ( var i = mouseWheeltoBind.length; i; ) {
+ $elm.on(mouseWheeltoBind[--i], cbs[fn]);
+ }
+ };
+ s.off.mousewheel = function (elm, fn) {
+ var $elm = angular.element(elm);
+
+ var cbs = $elm.data('mousewheel-callbacks');
+ var handler = cbs[fn];
+
+ if (handler) {
+ for ( var i = mouseWheeltoBind.length; i; ) {
+ $elm.off(mouseWheeltoBind[--i], handler);
+ }
+ }
+
+ delete cbs[fn];
+
+ if (Object.keys(cbs).length === 0) {
+ $elm.removeData('mousewheel-line-height');
+ $elm.removeData('mousewheel-page-height');
+ $elm.removeData('mousewheel-callbacks');
+ }
+ };
+
+ function mousewheelHandler(fn, event) {
+ var $elm = angular.element(this);
+
+ var delta = 0,
+ deltaX = 0,
+ deltaY = 0,
+ absDelta = 0,
+ offsetX = 0,
+ offsetY = 0;
+
+ // jQuery masks events
+ if (event.originalEvent) { event = event.originalEvent; }
+
+ if ( 'detail' in event ) { deltaY = event.detail * -1; }
+ if ( 'wheelDelta' in event ) { deltaY = event.wheelDelta; }
+ if ( 'wheelDeltaY' in event ) { deltaY = event.wheelDeltaY; }
+ if ( 'wheelDeltaX' in event ) { deltaX = event.wheelDeltaX * -1; }
+
+ // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
+ if ( 'axis' in event && event.axis === event.HORIZONTAL_AXIS ) {
+ deltaX = deltaY * -1;
+ deltaY = 0;
+ }
+
+ // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
+ delta = deltaY === 0 ? deltaX : deltaY;
+
+ // New school wheel delta (wheel event)
+ if ( 'deltaY' in event ) {
+ deltaY = event.deltaY * -1;
+ delta = deltaY;
+ }
+ if ( 'deltaX' in event ) {
+ deltaX = event.deltaX;
+ if ( deltaY === 0 ) { delta = deltaX * -1; }
+ }
+
+ // No change actually happened, no reason to go any further
+ if ( deltaY === 0 && deltaX === 0 ) { return; }
+
+ // Need to convert lines and pages to pixels if we aren't already in pixels
+ // There are three delta modes:
+ // * deltaMode 0 is by pixels, nothing to do
+ // * deltaMode 1 is by lines
+ // * deltaMode 2 is by pages
+ if ( event.deltaMode === 1 ) {
+ var lineHeight = $elm.data('mousewheel-line-height');
+ delta *= lineHeight;
+ deltaY *= lineHeight;
+ deltaX *= lineHeight;
+ }
+ else if ( event.deltaMode === 2 ) {
+ var pageHeight = $elm.data('mousewheel-page-height');
+ delta *= pageHeight;
+ deltaY *= pageHeight;
+ deltaX *= pageHeight;
+ }
+
+ // Store lowest absolute delta to normalize the delta values
+ absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
+
+ if ( !lowestDelta || absDelta < lowestDelta ) {
+ lowestDelta = absDelta;
+
+ // Adjust older deltas if necessary
+ if ( shouldAdjustOldDeltas(event, absDelta) ) {
+ lowestDelta /= 40;
+ }
+ }
+
+ // Get a whole, normalized value for the deltas
+ delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
+ deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
+ deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
+
+ event.deltaMode = 0;
+
+ // Normalise offsetX and offsetY properties
+ // if ($elm[0].getBoundingClientRect ) {
+ // var boundingRect = $(elm)[0].getBoundingClientRect();
+ // offsetX = event.clientX - boundingRect.left;
+ // offsetY = event.clientY - boundingRect.top;
+ // }
+
+ // event.deltaX = deltaX;
+ // event.deltaY = deltaY;
+ // event.deltaFactor = lowestDelta;
+
+ var newEvent = {
+ originalEvent: event,
+ deltaX: deltaX,
+ deltaY: deltaY,
+ deltaFactor: lowestDelta,
+ preventDefault: function () { event.preventDefault(); },
+ stopPropagation: function () { event.stopPropagation(); }
+ };
+
+ // Clearout lowestDelta after sometime to better
+ // handle multiple device types that give
+ // a different lowestDelta
+ // Ex: trackpad = 3 and mouse wheel = 120
+ if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
+ nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
+
+ fn.call($elm[0], newEvent);
+ }
+
+ function nullLowestDelta() {
+ lowestDelta = null;
+ }
+
+ function shouldAdjustOldDeltas(orgEvent, absDelta) {
+ // If this is an older event and the delta is divisable by 120,
+ // then we are assuming that the browser is treating this as an
+ // older mouse wheel event and that we should divide the deltas
+ // by 40 to try and get a more usable deltaFactor.
+ // Side note, this actually impacts the reported scroll distance
+ // in older browsers and can cause scrolling to be slower than native.
+ // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
+ return orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
+ }
+
+ return s;
+}]);
+
+// Add 'px' to the end of a number string if it doesn't have it already
+module.filter('px', function() {
+ return function(str) {
+ if (str.match(/^[\d\.]+$/)) {
+ return str + 'px';
+ }
+ else {
+ return str;
+ }
+ };
+});
+
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ var lang = {
+ aggregate: {
+ label: 'položky'
+ },
+ groupPanel: {
+ description: 'Přesuňte záhlaví zde pro vytvoření skupiny dle sloupce.'
+ },
+ search: {
+ placeholder: 'Hledat...',
+ showingItems: 'Zobrazuji položky:',
+ selectedItems: 'Vybrané položky:',
+ totalItems: 'Celkem položek:',
+ size: 'Velikost strany:',
+ first: 'První strana',
+ next: 'Další strana',
+ previous: 'Předchozí strana',
+ last: 'Poslední strana'
+ },
+ menu: {
+ text: 'Vyberte sloupec:'
+ },
+ sort: {
+ ascending: 'Seřadit od A-Z',
+ descending: 'Seřadit od Z-A',
+ remove: 'Odebrat seřazení'
+ },
+ column: {
+ hide: 'Schovat sloupec'
+ },
+ aggregation: {
+ count: 'celkem řádků: ',
+ sum: 'celkem: ',
+ avg: 'avg: ',
+ min: 'min.: ',
+ max: 'max.: '
+ },
+ pinning: {
+ pinLeft: 'Zamknout vlevo',
+ pinRight: 'Zamknout vpravo',
+ unpin: 'Odemknout'
+ },
+ gridMenu: {
+ columns: 'Sloupce:',
+ importerTitle: 'Importovat soubor',
+ exporterAllAsCsv: 'Exportovat všechna data do csv',
+ exporterVisibleAsCsv: 'Exportovat viditelná data do csv',
+ exporterSelectedAsCsv: 'Exportovat vybraná data do csv',
+ exporterAllAsPdf: 'Exportovat všechna data do pdf',
+ exporterVisibleAsPdf: 'Exportovat viditelná data do pdf',
+ exporterSelectedAsPdf: 'Exportovat vybraná data do pdf',
+ clearAllFilters: 'Odstranit všechny filtry'
+ },
+ importer: {
+ noHeaders: 'Názvy sloupců se nepodařilo získat, obsahuje soubor záhlaví?',
+ noObjects: 'Data se nepodařilo zpracovat, obsahuje soubor řádky mimo záhlaví?',
+ invalidCsv: 'Soubor nelze zpracovat, jedná se o CSV?',
+ invalidJson: 'Soubor nelze zpracovat, je to JSON?',
+ jsonNotArray: 'Soubor musí obsahovat json. UkonÄuji..'
+ },
+ pagination: {
+ sizes: 'položek na stránku',
+ totalItems: 'položek'
+ },
+ grouping: {
+ group: 'Seskupit',
+ ungroup: 'Odebrat seskupení',
+ aggregate_count: 'Agregace: Count',
+ aggregate_sum: 'Agregace: Sum',
+ aggregate_max: 'Agregace: Max',
+ aggregate_min: 'Agregace: Min',
+ aggregate_avg: 'Agregace: Avg',
+ aggregate_remove: 'Agregace: Odebrat'
+ }
+ };
+
+ // support varianty of different czech keys.
+ $delegate.add('cs', lang);
+ $delegate.add('cz', lang);
+ $delegate.add('cs-cz', lang);
+ $delegate.add('cs-CZ', lang);
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function(){
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('da', {
+ aggregate:{
+ label: 'artikler'
+ },
+ groupPanel:{
+ description: 'Grupér rækker udfra en kolonne ved at trække dens overskift hertil.'
+ },
+ search:{
+ placeholder: 'Søg...',
+ showingItems: 'Viste rækker:',
+ selectedItems: 'Valgte rækker:',
+ totalItems: 'Rækker totalt:',
+ size: 'Side størrelse:',
+ first: 'Første side',
+ next: 'Næste side',
+ previous: 'Forrige side',
+ last: 'Sidste side'
+ },
+ menu:{
+ text: 'Vælg kolonner:'
+ },
+ column: {
+ hide: 'Skjul kolonne'
+ },
+ aggregation: {
+ count: 'samlede rækker: ',
+ sum: 'smalede: ',
+ avg: 'gns: ',
+ min: 'min: ',
+ max: 'max: '
+ },
+ gridMenu: {
+ columns: 'Columns:',
+ importerTitle: 'Import file',
+ exporterAllAsCsv: 'Export all data as csv',
+ exporterVisibleAsCsv: 'Export visible data as csv',
+ exporterSelectedAsCsv: 'Export selected data as csv',
+ exporterAllAsPdf: 'Export all data as pdf',
+ exporterVisibleAsPdf: 'Export visible data as pdf',
+ exporterSelectedAsPdf: 'Export selected data as pdf',
+ clearAllFilters: 'Clear all filters'
+ },
+ importer: {
+ noHeaders: 'Column names were unable to be derived, does the file have a header?',
+ noObjects: 'Objects were not able to be derived, was there data in the file other than headers?',
+ invalidCsv: 'File was unable to be processed, is it valid CSV?',
+ invalidJson: 'File was unable to be processed, is it valid Json?',
+ jsonNotArray: 'Imported json file must contain an array, aborting.'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function ($provide) {
+ $provide.decorator('i18nService', ['$delegate', function ($delegate) {
+ $delegate.add('de', {
+ aggregate: {
+ label: 'Eintrag'
+ },
+ groupPanel: {
+ description: 'Ziehen Sie eine Spaltenüberschrift hierhin, um nach dieser Spalte zu gruppieren.'
+ },
+ search: {
+ placeholder: 'Suche...',
+ showingItems: 'Zeige Einträge:',
+ selectedItems: 'Ausgewählte Einträge:',
+ totalItems: 'Einträge gesamt:',
+ size: 'Einträge pro Seite:',
+ first: 'Erste Seite',
+ next: 'Nächste Seite',
+ previous: 'Vorherige Seite',
+ last: 'Letzte Seite'
+ },
+ menu: {
+ text: 'Spalten auswählen:'
+ },
+ sort: {
+ ascending: 'aufsteigend sortieren',
+ descending: 'absteigend sortieren',
+ remove: 'Sortierung zurücksetzen'
+ },
+ column: {
+ hide: 'Spalte ausblenden'
+ },
+ aggregation: {
+ count: 'Zeilen insgesamt: ',
+ sum: 'gesamt: ',
+ avg: 'Durchschnitt: ',
+ min: 'min: ',
+ max: 'max: '
+ },
+ pinning: {
+ pinLeft: 'Links anheften',
+ pinRight: 'Rechts anheften',
+ unpin: 'Lösen'
+ },
+ gridMenu: {
+ columns: 'Spalten:',
+ importerTitle: 'Datei importieren',
+ exporterAllAsCsv: 'Alle Daten als CSV exportieren',
+ exporterVisibleAsCsv: 'sichtbare Daten als CSV exportieren',
+ exporterSelectedAsCsv: 'markierte Daten als CSV exportieren',
+ exporterAllAsPdf: 'Alle Daten als PDF exportieren',
+ exporterVisibleAsPdf: 'sichtbare Daten als PDF exportieren',
+ exporterSelectedAsPdf: 'markierte Daten als CSV exportieren',
+ clearAllFilters: 'Alle filter reinigen'
+ },
+ importer: {
+ noHeaders: 'Es konnten keine Spaltennamen ermittelt werden. Sind in der Datei Spaltendefinitionen enthalten?',
+ noObjects: 'Es konnten keine Zeileninformationen gelesen werden, Sind in der Datei außer den Spaltendefinitionen auch Daten enthalten?',
+ invalidCsv: 'Die Datei konnte nicht eingelesen werden, ist es eine gültige CSV-Datei?',
+ invalidJson: 'Die Datei konnte nicht eingelesen werden. Enthält sie gültiges JSON?',
+ jsonNotArray: 'Die importierte JSON-Datei muß ein Array enthalten. Breche Import ab.'
+ },
+ pagination: {
+ sizes: 'Einträge pro Seite',
+ totalItems: 'Einträge'
+ },
+ grouping: {
+ group: 'Gruppieren',
+ ungroup: 'Gruppierung aufheben',
+ aggregate_count: 'Agg: Anzahl',
+ aggregate_sum: 'Agg: Summe',
+ aggregate_max: 'Agg: Maximum',
+ aggregate_min: 'Agg: Minimum',
+ aggregate_avg: 'Agg: Mittelwert',
+ aggregate_remove: 'Aggregation entfernen'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('en', {
+ headerCell: {
+ aria: {
+ defaultFilterLabel: 'Filter for column',
+ removeFilter: 'Remove Filter',
+ columnMenuButtonLabel: 'Column Menu'
+ },
+ priority: 'Priority:',
+ filterLabel: "Filter for column: "
+ },
+ aggregate: {
+ label: 'items'
+ },
+ groupPanel: {
+ description: 'Drag a column header here and drop it to group by that column.'
+ },
+ search: {
+ placeholder: 'Search...',
+ showingItems: 'Showing Items:',
+ selectedItems: 'Selected Items:',
+ totalItems: 'Total Items:',
+ size: 'Page Size:',
+ first: 'First Page',
+ next: 'Next Page',
+ previous: 'Previous Page',
+ last: 'Last Page'
+ },
+ menu: {
+ text: 'Choose Columns:'
+ },
+ sort: {
+ ascending: 'Sort Ascending',
+ descending: 'Sort Descending',
+ none: 'Sort None',
+ remove: 'Remove Sort'
+ },
+ column: {
+ hide: 'Hide Column'
+ },
+ aggregation: {
+ count: 'total rows: ',
+ sum: 'total: ',
+ avg: 'avg: ',
+ min: 'min: ',
+ max: 'max: '
+ },
+ pinning: {
+ pinLeft: 'Pin Left',
+ pinRight: 'Pin Right',
+ unpin: 'Unpin'
+ },
+ columnMenu: {
+ close: 'Close'
+ },
+ gridMenu: {
+ aria: {
+ buttonLabel: 'Grid Menu'
+ },
+ columns: 'Columns:',
+ importerTitle: 'Import file',
+ exporterAllAsCsv: 'Export all data as csv',
+ exporterVisibleAsCsv: 'Export visible data as csv',
+ exporterSelectedAsCsv: 'Export selected data as csv',
+ exporterAllAsPdf: 'Export all data as pdf',
+ exporterVisibleAsPdf: 'Export visible data as pdf',
+ exporterSelectedAsPdf: 'Export selected data as pdf',
+ clearAllFilters: 'Clear all filters'
+ },
+ importer: {
+ noHeaders: 'Column names were unable to be derived, does the file have a header?',
+ noObjects: 'Objects were not able to be derived, was there data in the file other than headers?',
+ invalidCsv: 'File was unable to be processed, is it valid CSV?',
+ invalidJson: 'File was unable to be processed, is it valid Json?',
+ jsonNotArray: 'Imported json file must contain an array, aborting.'
+ },
+ pagination: {
+ aria: {
+ pageToFirst: 'Page to first',
+ pageBack: 'Page back',
+ pageSelected: 'Selected page',
+ pageForward: 'Page forward',
+ pageToLast: 'Page to last'
+ },
+ sizes: 'items per page',
+ totalItems: 'items',
+ through: 'through',
+ of: 'of'
+ },
+ grouping: {
+ group: 'Group',
+ ungroup: 'Ungroup',
+ aggregate_count: 'Agg: Count',
+ aggregate_sum: 'Agg: Sum',
+ aggregate_max: 'Agg: Max',
+ aggregate_min: 'Agg: Min',
+ aggregate_avg: 'Agg: Avg',
+ aggregate_remove: 'Agg: Remove'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('es', {
+ aggregate: {
+ label: 'Artículos'
+ },
+ groupPanel: {
+ description: 'Arrastre un encabezado de columna aquí y suéltelo para agrupar por esa columna.'
+ },
+ search: {
+ placeholder: 'Buscar...',
+ showingItems: 'Artículos Mostrados:',
+ selectedItems: 'Artículos Seleccionados:',
+ totalItems: 'Artículos Totales:',
+ size: 'Tamaño de Página:',
+ first: 'Primera Página',
+ next: 'Página Siguiente',
+ previous: 'Página Anterior',
+ last: 'Última Página'
+ },
+ menu: {
+ text: 'Elegir columnas:'
+ },
+ sort: {
+ ascending: 'Orden Ascendente',
+ descending: 'Orden Descendente',
+ remove: 'Sin Ordenar'
+ },
+ column: {
+ hide: 'Ocultar la columna'
+ },
+ aggregation: {
+ count: 'filas totales: ',
+ sum: 'total: ',
+ avg: 'media: ',
+ min: 'min: ',
+ max: 'max: '
+ },
+ pinning: {
+ pinLeft: 'Fijar a la Izquierda',
+ pinRight: 'Fijar a la Derecha',
+ unpin: 'Quitar Fijación'
+ },
+ gridMenu: {
+ columns: 'Columnas:',
+ importerTitle: 'Importar archivo',
+ exporterAllAsCsv: 'Exportar todo como csv',
+ exporterVisibleAsCsv: 'Exportar vista como csv',
+ exporterSelectedAsCsv: 'Exportar selección como csv',
+ exporterAllAsPdf: 'Exportar todo como pdf',
+ exporterVisibleAsPdf: 'Exportar vista como pdf',
+ exporterSelectedAsPdf: 'Exportar selección como pdf',
+ clearAllFilters: 'Limpiar todos los filtros'
+ },
+ importer: {
+ noHeaders: 'No fue posible derivar los nombres de las columnas, ¿tiene encabezados el archivo?',
+ noObjects: 'No fue posible obtener registros, ¿contiene datos el archivo, aparte de los encabezados?',
+ invalidCsv: 'No fue posible procesar el archivo, ¿es un CSV válido?',
+ invalidJson: 'No fue posible procesar el archivo, ¿es un Json válido?',
+ jsonNotArray: 'El archivo json importado debe contener un array, abortando.'
+ },
+ pagination: {
+ sizes: 'registros por página',
+ totalItems: 'registros',
+ of: 'de'
+ },
+ grouping: {
+ group: 'Agrupar',
+ ungroup: 'Desagrupar',
+ aggregate_count: 'Agr: Cont',
+ aggregate_sum: 'Agr: Sum',
+ aggregate_max: 'Agr: Máx',
+ aggregate_min: 'Agr: Min',
+ aggregate_avg: 'Agr: Prom',
+ aggregate_remove: 'Agr: Quitar'
+ }
+ });
+ return $delegate;
+ }]);
+}]);
+})();
+
+/**
+ * Translated by: R. Salarmehr
+ * M. Hosseynzade
+ * Using Vajje.com online dictionary.
+ */
+(function () {
+ angular.module('ui.grid').config(['$provide', function ($provide) {
+ $provide.decorator('i18nService', ['$delegate', function ($delegate) {
+ $delegate.add('fa', {
+ aggregate: {
+ label: 'قلم'
+ },
+ groupPanel: {
+ description: 'عنوان یک ستون را بگیر و به گروهی از آن ستون رها کن.'
+ },
+ search: {
+ placeholder: 'جستجو...',
+ showingItems: 'نمایش اقلام:',
+ selectedItems: 'قلم\u200cهای انتخاب شده:',
+ totalItems: 'مجموع اقلام:',
+ size: 'اندازه\u200cÛŒ صÙحه:',
+ first: 'اولین صÙحه',
+ next: 'صÙحه\u200cÛŒ\u200cبعدی',
+ previous: 'صÙحه\u200cÛŒ\u200c قبلی',
+ last: 'آخرین صÙحه'
+ },
+ menu: {
+ text: 'ستون\u200cهای انتخابی:'
+ },
+ sort: {
+ ascending: 'ترتیب صعودی',
+ descending: 'ترتیب نزولی',
+ remove: 'حذ٠مرتب کردن'
+ },
+ column: {
+ hide: 'پنهان\u200cکردن ستون'
+ },
+ aggregation: {
+ count: 'تعداد: ',
+ sum: 'مجموع: ',
+ avg: 'میانگین: ',
+ min: 'کمترین: ',
+ max: 'بیشترین: '
+ },
+ pinning: {
+ pinLeft: 'پین کردن سمت چپ',
+ pinRight: 'پین کردن سمت راست',
+ unpin: 'حذ٠پین'
+ },
+ gridMenu: {
+ columns: 'ستون\u200cها:',
+ importerTitle: 'وارد کردن Ùایل',
+ exporterAllAsCsv: 'خروجی تمام داده\u200cها در Ùایل csv',
+ exporterVisibleAsCsv: 'خروجی داده\u200cهای قابل مشاهده در Ùایل csv',
+ exporterSelectedAsCsv: 'خروجی داده\u200cهای انتخاب\u200cشده در Ùایل csv',
+ exporterAllAsPdf: 'خروجی تمام داده\u200cها در Ùایل pdf',
+ exporterVisibleAsPdf: 'خروجی داده\u200cهای قابل مشاهده در Ùایل pdf',
+ exporterSelectedAsPdf: 'خروجی داده\u200cهای انتخاب\u200cشده در Ùایل pdf',
+ clearAllFilters: 'پاک کردن تمام Ùیلتر'
+ },
+ importer: {
+ noHeaders: 'نام ستون قابل استخراج نیست. آیا Ùایل عنوان دارد؟',
+ noObjects: 'اشیا قابل استخراج نیستند. آیا به جز عنوان\u200cها در Ùایل داده وجود دارد؟',
+ invalidCsv: 'Ùایل قابل پردازش نیست. آیا Ùرمت csv معتبر است؟',
+ invalidJson: 'Ùایل قابل پردازش نیست. آیا Ùرمت json معتبر است؟',
+ jsonNotArray: 'Ùایل json وارد شده باید حاوی آرایه باشد. عملیات ساقط شد.'
+ },
+ pagination: {
+ sizes: 'اقلام در هر صÙحه',
+ totalItems: 'اقلام',
+ of: 'از'
+ },
+ grouping: {
+ group: 'گروه\u200cبندی',
+ ungroup: 'حذ٠گروه\u200cبندی',
+ aggregate_count: 'Agg: تعداد',
+ aggregate_sum: 'Agg: جمع',
+ aggregate_max: 'Agg: بیشینه',
+ aggregate_min: 'Agg: کمینه',
+ aggregate_avg: 'Agg: میانگین',
+ aggregate_remove: 'Agg: حذÙ'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('fi', {
+ aggregate: {
+ label: 'rivit'
+ },
+ groupPanel: {
+ description: 'Raahaa ja pudota otsikko tähän ryhmittääksesi sarakkeen mukaan.'
+ },
+ search: {
+ placeholder: 'Hae...',
+ showingItems: 'Näytetään rivejä:',
+ selectedItems: 'Valitut rivit:',
+ totalItems: 'Rivejä yht.:',
+ size: 'Näytä:',
+ first: 'Ensimmäinen sivu',
+ next: 'Seuraava sivu',
+ previous: 'Edellinen sivu',
+ last: 'Viimeinen sivu'
+ },
+ menu: {
+ text: 'Valitse sarakkeet:'
+ },
+ sort: {
+ ascending: 'Järjestä nouseva',
+ descending: 'Järjestä laskeva',
+ remove: 'Poista järjestys'
+ },
+ column: {
+ hide: 'Piilota sarake'
+ },
+ aggregation: {
+ count: 'Rivejä yht.: ',
+ sum: 'Summa: ',
+ avg: 'K.a.: ',
+ min: 'Min: ',
+ max: 'Max: '
+ },
+ pinning: {
+ pinLeft: 'Lukitse vasemmalle',
+ pinRight: 'Lukitse oikealle',
+ unpin: 'Poista lukitus'
+ },
+ gridMenu: {
+ columns: 'Sarakkeet:',
+ importerTitle: 'Tuo tiedosto',
+ exporterAllAsCsv: 'Vie tiedot csv-muodossa',
+ exporterVisibleAsCsv: 'Vie näkyvä tieto csv-muodossa',
+ exporterSelectedAsCsv: 'Vie valittu tieto csv-muodossa',
+ exporterAllAsPdf: 'Vie tiedot pdf-muodossa',
+ exporterVisibleAsPdf: 'Vie näkyvä tieto pdf-muodossa',
+ exporterSelectedAsPdf: 'Vie valittu tieto pdf-muodossa',
+ clearAllFilters: 'Puhdista kaikki suodattimet'
+ },
+ importer: {
+ noHeaders: 'Sarakkeen nimiä ei voitu päätellä, onko tiedostossa otsikkoriviä?',
+ noObjects: 'Tietoja ei voitu lukea, onko tiedostossa muuta kuin otsikkot?',
+ invalidCsv: 'Tiedostoa ei voitu käsitellä, oliko se CSV-muodossa?',
+ invalidJson: 'Tiedostoa ei voitu käsitellä, oliko se JSON-muodossa?',
+ jsonNotArray: 'Tiedosto ei sisältänyt taulukkoa, lopetetaan.'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('fr', {
+ aggregate: {
+ label: 'éléments'
+ },
+ groupPanel: {
+ description: 'Faites glisser une en-tête de colonne ici pour créer un groupe de colonnes.'
+ },
+ search: {
+ placeholder: 'Recherche...',
+ showingItems: 'Affichage des éléments :',
+ selectedItems: 'Éléments sélectionnés :',
+ totalItems: 'Nombre total d\'éléments:',
+ size: 'Taille de page:',
+ first: 'Première page',
+ next: 'Page Suivante',
+ previous: 'Page précédente',
+ last: 'Dernière page'
+ },
+ menu: {
+ text: 'Choisir des colonnes :'
+ },
+ sort: {
+ ascending: 'Trier par ordre croissant',
+ descending: 'Trier par ordre décroissant',
+ remove: 'Enlever le tri'
+ },
+ column: {
+ hide: 'Cacher la colonne'
+ },
+ aggregation: {
+ count: 'lignes totales: ',
+ sum: 'total: ',
+ avg: 'moy: ',
+ min: 'min: ',
+ max: 'max: '
+ },
+ pinning: {
+ pinLeft: 'Épingler à gauche',
+ pinRight: 'Épingler à droite',
+ unpin: 'Détacher'
+ },
+ gridMenu: {
+ columns: 'Colonnes:',
+ importerTitle: 'Importer un fichier',
+ exporterAllAsCsv: 'Exporter toutes les données en CSV',
+ exporterVisibleAsCsv: 'Exporter les données visibles en CSV',
+ exporterSelectedAsCsv: 'Exporter les données sélectionnées en CSV',
+ exporterAllAsPdf: 'Exporter toutes les données en PDF',
+ exporterVisibleAsPdf: 'Exporter les données visibles en PDF',
+ exporterSelectedAsPdf: 'Exporter les données sélectionnées en PDF',
+ clearAllFilters: 'Nettoyez tous les filtres'
+ },
+ importer: {
+ noHeaders: 'Impossible de déterminer le nom des colonnes, le fichier possède-t-il une en-tête ?',
+ noObjects: 'Aucun objet trouvé, le fichier possède-t-il des données autres que l\'en-tête ?',
+ invalidCsv: 'Le fichier n\'a pas pu être traité, le CSV est-il valide ?',
+ invalidJson: 'Le fichier n\'a pas pu être traité, le JSON est-il valide ?',
+ jsonNotArray: 'Le fichier JSON importé doit contenir un tableau, abandon.'
+ },
+ pagination: {
+ sizes: 'éléments par page',
+ totalItems: 'éléments',
+ of: 'sur'
+ },
+ grouping: {
+ group: 'Grouper',
+ ungroup: 'Dégrouper',
+ aggregate_count: 'Agg: Compte',
+ aggregate_sum: 'Agg: Somme',
+ aggregate_max: 'Agg: Max',
+ aggregate_min: 'Agg: Min',
+ aggregate_avg: 'Agg: Moy',
+ aggregate_remove: 'Agg: Retirer'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function ($provide) {
+ $provide.decorator('i18nService', ['$delegate', function ($delegate) {
+ $delegate.add('he', {
+ aggregate: {
+ label: 'items'
+ },
+ groupPanel: {
+ description: 'גרור עמודה לכ×ן ושחרר בכדי לקבץ עמודה זו.'
+ },
+ search: {
+ placeholder: 'חפש...',
+ showingItems: 'מציג:',
+ selectedItems: 'סה"כ נבחרו:',
+ totalItems: 'סה"כ רשומות:',
+ size: 'תוצ×ות בדף:',
+ first: 'דף ר×שון',
+ next: 'דף הב×',
+ previous: 'דף קוד×',
+ last: 'דף ×חרון'
+ },
+ menu: {
+ text: 'בחר עמודות:'
+ },
+ sort: {
+ ascending: 'סדר עולה',
+ descending: 'סדר יורד',
+ remove: 'בטל'
+ },
+ column: {
+ hide: 'טור הסתר'
+ },
+ aggregation: {
+ count: 'total rows: ',
+ sum: 'total: ',
+ avg: 'avg: ',
+ min: 'min: ',
+ max: 'max: '
+ },
+ gridMenu: {
+ columns: 'Columns:',
+ importerTitle: 'Import file',
+ exporterAllAsCsv: 'Export all data as csv',
+ exporterVisibleAsCsv: 'Export visible data as csv',
+ exporterSelectedAsCsv: 'Export selected data as csv',
+ exporterAllAsPdf: 'Export all data as pdf',
+ exporterVisibleAsPdf: 'Export visible data as pdf',
+ exporterSelectedAsPdf: 'Export selected data as pdf',
+ clearAllFilters: 'Clean all filters'
+ },
+ importer: {
+ noHeaders: 'Column names were unable to be derived, does the file have a header?',
+ noObjects: 'Objects were not able to be derived, was there data in the file other than headers?',
+ invalidCsv: 'File was unable to be processed, is it valid CSV?',
+ invalidJson: 'File was unable to be processed, is it valid Json?',
+ jsonNotArray: 'Imported json file must contain an array, aborting.'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('hy', {
+ aggregate: {
+ label: 'Õ¿Õ¾ÕµÕ¡Õ¬Õ¶Õ¥Ö€'
+ },
+ groupPanel: {
+ description: 'Ô¸Õ½Õ¿ Õ½ÕµÕ¡Õ¶ Õ­Õ´Õ¢Õ¡Õ¾Õ¸Ö€Õ¥Õ¬Õ¸Ö‚ Õ°Õ¡Õ´Õ¡Ö€ Ö„Õ¡Õ·Õ¥Ö„ Ö‡ Õ£ÖÕ¥Ö„ Õ¾Õ¥Ö€Õ¶Õ¡Õ£Õ«Ö€Õ¶ Õ¡ÕµÕ½Õ¿Õ¥Õ²Ö‰'
+ },
+ search: {
+ placeholder: 'Õ“Õ¶Õ¿Ö€Õ¸Ö‚Õ´...',
+ showingItems: 'Õ‘Õ¸Ö‚ÖÕ¡Õ¤Ö€Õ¾Õ¡Õ® Õ¿Õ¾ÕµÕ¡Õ¬Õ¶Õ¥Ö€Õ',
+ selectedItems: 'Ô¸Õ¶Õ¿Ö€Õ¾Õ¡Õ®:',
+ totalItems: 'Ô¸Õ¶Õ¤Õ¡Õ´Õ¥Õ¶Õ¨Õ',
+ size: 'ÕÕ¸Õ²Õ¥Ö€Õ« Ö„Õ¡Õ¶Õ¡Õ¯Õ¨ Õ§Õ»Õ¸Ö‚Õ´Õ',
+ first: 'Ô±Õ¼Õ¡Õ»Õ«Õ¶ Õ§Õ»',
+ next: 'Õ€Õ¡Õ»Õ¸Ö€Õ¤ Õ§Õ»',
+ previous: 'Õ†Õ¡Õ­Õ¸Ö€Õ¤ Õ§Õ»',
+ last: 'ÕŽÕ¥Ö€Õ»Õ«Õ¶ Õ§Õ»'
+ },
+ menu: {
+ text: 'Ô¸Õ¶Õ¿Ö€Õ¥Õ¬ Õ½ÕµÕ¸Ö‚Õ¶Õ¥Ö€Õ¨:'
+ },
+ sort: {
+ ascending: 'Ô±Õ³Õ´Õ¡Õ¶ Õ¯Õ¡Ö€Õ£Õ¸Õ¾',
+ descending: 'Õ†Õ¾Õ¡Õ¦Õ´Õ¡Õ¶ Õ¯Õ¡Ö€Õ£Õ¸Õ¾',
+ remove: 'Õ€Õ¡Õ¶Õ¥Õ¬ '
+ },
+ column: {
+ hide: 'Ô¹Õ¡Ö„ÖÕ¶Õ¥Õ¬ Õ½ÕµÕ¸Ö‚Õ¶Õ¨'
+ },
+ aggregation: {
+ count: 'Õ¨Õ¶Õ¤Õ¡Õ´Õ¥Õ¶Õ¨ Õ¿Õ¸Õ²Õ ',
+ sum: 'Õ¨Õ¶Õ¤Õ¡Õ´Õ¥Õ¶Õ¨Õ ',
+ avg: 'Õ´Õ«Õ»Õ«Õ¶Õ ',
+ min: 'Õ´Õ«Õ¶Õ ',
+ max: 'Õ´Õ¡Ö„Õ½Õ '
+ },
+ pinning: {
+ pinLeft: 'Ô¿ÕºÖÕ¶Õ¥Õ¬ Õ±Õ¡Õ­ Õ¯Õ¸Õ²Õ´Õ¸Ö‚Õ´',
+ pinRight: 'Ô¿ÕºÖÕ¶Õ¥Õ¬ Õ¡Õ» Õ¯Õ¸Õ²Õ´Õ¸Ö‚Õ´',
+ unpin: 'Ô±Ö€Õ±Õ¡Õ¯Õ¥Õ¬'
+ },
+ gridMenu: {
+ columns: 'ÕÕµÕ¸Ö‚Õ¶Õ¥Ö€:',
+ importerTitle: 'Õ†Õ¥Ö€Õ´Õ¸Ö‚Õ®Õ¥Õ¬ Ö†Õ¡ÕµÕ¬',
+ exporterAllAsCsv: 'Ô±Ö€Õ¿Õ¡Õ°Õ¡Õ¶Õ¥Õ¬ Õ¡Õ´Õ¢Õ¸Õ²Õ»Õ¨ CSV',
+ exporterVisibleAsCsv: 'Ô±Ö€Õ¿Õ¡Õ°Õ¡Õ¶Õ¥Õ¬ Õ¥Ö€Ö‡Õ¡ÖÕ¸Õ² Õ¿Õ¾ÕµÕ¡Õ¬Õ¶Õ¥Ö€Õ¨ CSV',
+ exporterSelectedAsCsv: 'Ô±Ö€Õ¿Õ¡Õ°Õ¡Õ¶Õ¥Õ¬ Õ¨Õ¶Õ¿Ö€Õ¾Õ¡Õ® Õ¿Õ¾ÕµÕ¡Õ¬Õ¶Õ¥Ö€Õ¨ CSV',
+ exporterAllAsPdf: 'Ô±Ö€Õ¿Õ¡Õ°Õ¡Õ¶Õ¥Õ¬ PDF',
+ exporterVisibleAsPdf: 'Ô±Ö€Õ¿Õ¡Õ°Õ¡Õ¶Õ¥Õ¬ Õ¥Ö€Ö‡Õ¡ÖÕ¸Õ² Õ¿Õ¾ÕµÕ¡Õ¬Õ¶Õ¥Ö€Õ¨ PDF',
+ exporterSelectedAsPdf: 'Ô±Ö€Õ¿Õ¡Õ°Õ¡Õ¶Õ¥Õ¬ Õ¨Õ¶Õ¿Ö€Õ¾Õ¡Õ® Õ¿Õ¾ÕµÕ¡Õ¬Õ¶Õ¥Ö€Õ¨ PDF',
+ clearAllFilters: 'Õ„Õ¡Ö„Ö€Õ¥Õ¬ Õ¢Õ¸Õ¬Õ¸Ö€ Ö†Õ«Õ¬Õ¿Ö€Õ¥Ö€Õ¨'
+ },
+ importer: {
+ noHeaders: 'Õ€Õ¶Õ¡Ö€Õ¡Õ¾Õ¸Ö€ Õ¹Õ¥Õ²Õ¡Õ¾ Õ¸Ö€Õ¸Õ·Õ¥Õ¬ Õ½ÕµÕ¡Õ¶ Õ¾Õ¥Ö€Õ¶Õ¡Õ£Ö€Õ¥Ö€Õ¨Ö‰ Ô±Ö€Õ¤ÕµÕ¸ÕžÖ„ Ö†Õ¡ÕµÕ¬Õ¨ Õ¸Ö‚Õ¶Õ« Õ¾Õ¥Ö€Õ¶Õ¡Õ£Ö€Õ¥Ö€Ö‰',
+ noObjects: 'Õ€Õ¶Õ¡Ö€Õ¡Õ¾Õ¸Ö€ Õ¹Õ¥Õ²Õ¡Õ¾ Õ¯Õ¡Ö€Õ¤Õ¡Õ¬ Õ¿Õ¾ÕµÕ¡Õ¬Õ¶Õ¥Ö€Õ¨Ö‰ Ô±Ö€Õ¤ÕµÕ¸ÕžÖ„ Ö†Õ¡ÕµÕ¬Õ¸Ö‚Õ´ Õ¯Õ¡Õ¶ Õ¿Õ¾ÕµÕ¡Õ¬Õ¶Õ¥Ö€Ö‰',
+ invalidCsv: 'Õ€Õ¶Õ¡Ö€Õ¡Õ¾Õ¸Ö€ Õ¹Õ¥Õ²Õ¡Õ¾ Õ´Õ·Õ¡Õ¯Õ¥Õ¬ Ö†Õ¡ÕµÕ¬Õ¨Ö‰ Ô±Ö€Õ¤ÕµÕ¸ÕžÖ„ Õ¡ÕµÕ¶ Õ¾Õ¡Õ¾Õ¥Ö€ CSV Õ§Ö‰',
+ invalidJson: 'Õ€Õ¶Õ¡Ö€Õ¡Õ¾Õ¸Ö€ Õ¹Õ¥Õ²Õ¡Õ¾ Õ´Õ·Õ¡Õ¯Õ¥Õ¬ Ö†Õ¡ÕµÕ¬Õ¨Ö‰ Ô±Ö€Õ¤ÕµÕ¸ÕžÖ„ Õ¡ÕµÕ¶ Õ¾Õ¡Õ¾Õ¥Ö€ Json Õ§Ö‰',
+ jsonNotArray: 'Õ†Õ¥Ö€Õ´Õ¸Ö‚Õ®Õ¾Õ¡Õ® json Ö†Õ¡ÕµÕ¬Õ¨ ÕºÕ¥Õ¿Ö„ Õ§ ÕºÕ¡Ö€Õ¸Ö‚Õ¶Õ¡Õ¯Õ« Õ¦Õ¡Õ¶Õ£Õ¾Õ¡Õ®, Õ¯Õ¡Õ½Õ¥ÖÕ¾Õ¸Ö‚Õ´ Õ§Ö‰'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('it', {
+ aggregate: {
+ label: 'elementi'
+ },
+ groupPanel: {
+ description: 'Trascina un\'intestazione all\'interno del gruppo della colonna.'
+ },
+ search: {
+ placeholder: 'Ricerca...',
+ showingItems: 'Mostra:',
+ selectedItems: 'Selezionati:',
+ totalItems: 'Totali:',
+ size: 'Tot Pagine:',
+ first: 'Prima',
+ next: 'Prossima',
+ previous: 'Precedente',
+ last: 'Ultima'
+ },
+ menu: {
+ text: 'Scegli le colonne:'
+ },
+ sort: {
+ ascending: 'Asc.',
+ descending: 'Desc.',
+ remove: 'Annulla ordinamento'
+ },
+ column: {
+ hide: 'Nascondi'
+ },
+ aggregation: {
+ count: 'righe totali: ',
+ sum: 'tot: ',
+ avg: 'media: ',
+ min: 'minimo: ',
+ max: 'massimo: '
+ },
+ pinning: {
+ pinLeft: 'Blocca a sx',
+ pinRight: 'Blocca a dx',
+ unpin: 'Blocca in alto'
+ },
+ gridMenu: {
+ columns: 'Colonne:',
+ importerTitle: 'Importa',
+ exporterAllAsCsv: 'Esporta tutti i dati in CSV',
+ exporterVisibleAsCsv: 'Esporta i dati visibili in CSV',
+ exporterSelectedAsCsv: 'Esporta i dati selezionati in CSV',
+ exporterAllAsPdf: 'Esporta tutti i dati in PDF',
+ exporterVisibleAsPdf: 'Esporta i dati visibili in PDF',
+ exporterSelectedAsPdf: 'Esporta i dati selezionati in PDF',
+ clearAllFilters: 'Pulire tutti i filtri'
+ },
+ importer: {
+ noHeaders: 'Impossibile reperire i nomi delle colonne, sicuro che siano indicati all\'interno del file?',
+ noObjects: 'Impossibile reperire gli oggetti, sicuro che siano indicati all\'interno del file?',
+ invalidCsv: 'Impossibile elaborare il file, sicuro che sia un CSV?',
+ invalidJson: 'Impossibile elaborare il file, sicuro che sia un JSON valido?',
+ jsonNotArray: 'Errore! Il file JSON da importare deve contenere un array.'
+ },
+ grouping: {
+ group: 'Raggruppa',
+ ungroup: 'Separa',
+ aggregate_count: 'Agg: N. Elem.',
+ aggregate_sum: 'Agg: Somma',
+ aggregate_max: 'Agg: Massimo',
+ aggregate_min: 'Agg: Minimo',
+ aggregate_avg: 'Agg: Media',
+ aggregate_remove: 'Agg: Rimuovi'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function() {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('ja', {
+ aggregate: {
+ label: 'é …ç›®'
+ },
+ groupPanel: {
+ description: 'ã“ã“ã«åˆ—ヘッダをドラッグアンドドロップã—ã¦ã€ãã®åˆ—ã§ã‚°ãƒ«ãƒ¼ãƒ—化ã—ã¾ã™ã€‚'
+ },
+ search: {
+ placeholder: '検索...',
+ showingItems: '表示中ã®é …ç›®:',
+ selectedItems: 'é¸æŠžã—ãŸé …ç›®:',
+ totalItems: 'é …ç›®ã®ç·æ•°:',
+ size: 'ページサイズ:',
+ first: '最åˆã®ãƒšãƒ¼ã‚¸',
+ next: '次ã®ãƒšãƒ¼ã‚¸',
+ previous: 'å‰ã®ãƒšãƒ¼ã‚¸',
+ last: 'å‰ã®ãƒšãƒ¼ã‚¸'
+ },
+ menu: {
+ text: '列ã®é¸æŠž:'
+ },
+ sort: {
+ ascending: '昇順ã«ä¸¦ã¹æ›¿ãˆ',
+ descending: 'é™é †ã«ä¸¦ã¹æ›¿ãˆ',
+ remove: '並ã¹æ›¿ãˆã®è§£é™¤'
+ },
+ column: {
+ hide: '列ã®éžè¡¨ç¤º'
+ },
+ aggregation: {
+ count: 'åˆè¨ˆè¡Œæ•°: ',
+ sum: 'åˆè¨ˆ: ',
+ avg: 'å¹³å‡: ',
+ min: '最å°: ',
+ max: '最大: '
+ },
+ pinning: {
+ pinLeft: 'å·¦ã«å›ºå®š',
+ pinRight: 'å³ã«å›ºå®š',
+ unpin: '固定解除'
+ },
+ gridMenu: {
+ columns: '列:',
+ importerTitle: 'ファイルã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆ',
+ exporterAllAsCsv: 'ã™ã¹ã¦ã®ãƒ‡ãƒ¼ã‚¿ã‚’CSVå½¢å¼ã§ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆ',
+ exporterVisibleAsCsv: '表示中ã®ãƒ‡ãƒ¼ã‚¿ã‚’CSVå½¢å¼ã§ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆ',
+ exporterSelectedAsCsv: 'é¸æŠžã—ãŸãƒ‡ãƒ¼ã‚¿ã‚’CSVå½¢å¼ã§ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆ',
+ exporterAllAsPdf: 'ã™ã¹ã¦ã®ãƒ‡ãƒ¼ã‚¿ã‚’PDFå½¢å¼ã§ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆ',
+ exporterVisibleAsPdf: '表示中ã®ãƒ‡ãƒ¼ã‚¿ã‚’PDFå½¢å¼ã§ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆ',
+ exporterSelectedAsPdf: 'é¸æŠžã—ãŸãƒ‡ãƒ¼ã‚¿ã‚’PDFå½¢å¼ã§ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆ',
+ clearAllFilters: 'ã™ã¹ã¦ã®ãƒ•ã‚£ãƒ«ã‚¿ã‚’清掃ã—ã¦ãã ã•ã„'
+ },
+ importer: {
+ noHeaders: '列åã‚’å–å¾—ã§ãã¾ã›ã‚“。ファイルã«ãƒ˜ãƒƒãƒ€ãŒå«ã¾ã‚Œã¦ã„ã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。',
+ noObjects: 'オブジェクトをå–å¾—ã§ãã¾ã›ã‚“。ファイルã«ãƒ˜ãƒƒãƒ€ä»¥å¤–ã®ãƒ‡ãƒ¼ã‚¿ãŒå«ã¾ã‚Œã¦ã„ã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。',
+ invalidCsv: 'ファイルを処ç†ã§ãã¾ã›ã‚“。ファイルãŒæœ‰åŠ¹ãªCSVå½¢å¼ã§ã‚ã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。',
+ invalidJson: 'ファイルを処ç†ã§ãã¾ã›ã‚“。ファイルãŒæœ‰åŠ¹ãªJSONå½¢å¼ã§ã‚ã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。',
+ jsonNotArray: 'インãƒãƒ¼ãƒˆã—ãŸJSONファイルã«ã¯é…列ãŒå«ã¾ã‚Œã¦ã„ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚処ç†ã‚’中止ã—ã¾ã™ã€‚'
+ },
+ pagination: {
+ sizes: '項目/ページ',
+ totalItems: 'é …ç›®'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('ko', {
+ aggregate: {
+ label: 'ì•„ì´í…œ'
+ },
+ groupPanel: {
+ description: '컬럼으로 그룹핑하기 위해서는 컬럼 í—¤ë”를 ëŒì–´ 떨어뜨려 주세요.'
+ },
+ search: {
+ placeholder: '검색...',
+ showingItems: '항목 보여주기:',
+ selectedItems: 'ì„ íƒ í•­ëª©:',
+ totalItems: '전체 항목:',
+ size: '페ì´ì§€ í¬ê¸°:',
+ first: '첫번째 페ì´ì§€',
+ next: 'ë‹¤ìŒ íŽ˜ì´ì§€',
+ previous: 'ì´ì „ 페ì´ì§€',
+ last: '마지막 페ì´ì§€'
+ },
+ menu: {
+ text: 'ì»¬ëŸ¼ì„ ì„ íƒí•˜ì„¸ìš”:'
+ },
+ sort: {
+ ascending: '오름차순 정렬',
+ descending: '내림차순 정렬',
+ remove: '소팅 제거'
+ },
+ column: {
+ hide: '컬럼 제거'
+ },
+ aggregation: {
+ count: '전체 갯수: ',
+ sum: 'ì „ì²´: ',
+ avg: 'í‰ê· : ',
+ min: '최소: ',
+ max: '최대: '
+ },
+ pinning: {
+ pinLeft: '왼쪽 핀',
+ pinRight: '오른쪽 핀',
+ unpin: '핀 제거'
+ },
+ gridMenu: {
+ columns: '컬럼:',
+ importerTitle: 'íŒŒì¼ ê°€ì ¸ì˜¤ê¸°',
+ exporterAllAsCsv: 'csvë¡œ 모든 ë°ì´í„° 내보내기',
+ exporterVisibleAsCsv: 'csvë¡œ ë³´ì´ëŠ” ë°ì´í„° 내보내기',
+ exporterSelectedAsCsv: 'csvë¡œ ì„ íƒëœ ë°ì´í„° 내보내기',
+ exporterAllAsPdf: 'pdfë¡œ 모든 ë°ì´í„° 내보내기',
+ exporterVisibleAsPdf: 'pdfë¡œ ë³´ì´ëŠ” ë°ì´í„° 내보내기',
+ exporterSelectedAsPdf: 'pdfë¡œ ì„ íƒ ë°ì´í„° 내보내기',
+ clearAllFilters: '모든 필터를 청소'
+ },
+ importer: {
+ noHeaders: 'ì»¬ëŸ¼ëª…ì´ ì§€ì •ë˜ì–´ 있지 않습니다. 파ì¼ì— í—¤ë”ê°€ 명시ë˜ì–´ 있는지 확ì¸í•´ 주세요.',
+ noObjects: 'ë°ì´í„°ê°€ 지정ë˜ì–´ 있지 않습니다. ë°ì´í„°ê°€ 파ì¼ì— 있는지 확ì¸í•´ 주세요.',
+ invalidCsv: '파ì¼ì„ 처리할 수 없습니다. 올바른 csvì¸ì§€ 확ì¸í•´ 주세요.',
+ invalidJson: '파ì¼ì„ 처리할 수 없습니다. 올바른 jsonì¸ì§€ 확ì¸í•´ 주세요.',
+ jsonNotArray: 'json 파ì¼ì€ ë°°ì—´ì„ í¬í•¨í•´ì•¼ 합니다.'
+ },
+ pagination: {
+ sizes: '페ì´ì§€ë‹¹ 항목',
+ totalItems: '전체 항목'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('nl', {
+ aggregate: {
+ label: 'items'
+ },
+ groupPanel: {
+ description: 'Sleep hier een kolomnaam heen om op te groeperen.'
+ },
+ search: {
+ placeholder: 'Zoeken...',
+ showingItems: 'Getoonde items:',
+ selectedItems: 'Geselecteerde items:',
+ totalItems: 'Totaal aantal items:',
+ size: 'Items per pagina:',
+ first: 'Eerste pagina',
+ next: 'Volgende pagina',
+ previous: 'Vorige pagina',
+ last: 'Laatste pagina'
+ },
+ menu: {
+ text: 'Kies kolommen:'
+ },
+ sort: {
+ ascending: 'Sorteer oplopend',
+ descending: 'Sorteer aflopend',
+ remove: 'Verwijder sortering'
+ },
+ column: {
+ hide: 'Verberg kolom'
+ },
+ aggregation: {
+ count: 'Aantal rijen: ',
+ sum: 'Som: ',
+ avg: 'Gemiddelde: ',
+ min: 'Min: ',
+ max: 'Max: '
+ },
+ pinning: {
+ pinLeft: 'Zet links vast',
+ pinRight: 'Zet rechts vast',
+ unpin: 'Maak los'
+ },
+ gridMenu: {
+ columns: 'Kolommen:',
+ importerTitle: 'Importeer bestand',
+ exporterAllAsCsv: 'Exporteer alle data als csv',
+ exporterVisibleAsCsv: 'Exporteer zichtbare data als csv',
+ exporterSelectedAsCsv: 'Exporteer geselecteerde data als csv',
+ exporterAllAsPdf: 'Exporteer alle data als pdf',
+ exporterVisibleAsPdf: 'Exporteer zichtbare data als pdf',
+ exporterSelectedAsPdf: 'Exporteer geselecteerde data als pdf',
+ clearAllFilters: 'Reinig alle filters'
+ },
+ importer: {
+ noHeaders: 'Kolomnamen kunnen niet worden afgeleid. Heeft het bestand een header?',
+ noObjects: 'Objecten kunnen niet worden afgeleid. Bevat het bestand data naast de headers?',
+ invalidCsv: 'Het bestand kan niet verwerkt worden. Is het een valide csv bestand?',
+ invalidJson: 'Het bestand kan niet verwerkt worden. Is het valide json?',
+ jsonNotArray: 'Het json bestand moet een array bevatten. De actie wordt geannuleerd.'
+ },
+ pagination: {
+ sizes: 'items per pagina',
+ totalItems: 'items',
+ of: 'van de'
+ },
+ grouping: {
+ group: 'Groepeer',
+ ungroup: 'Groepering opheffen',
+ aggregate_count: 'Agg: Aantal',
+ aggregate_sum: 'Agg: Som',
+ aggregate_max: 'Agg: Max',
+ aggregate_min: 'Agg: Min',
+ aggregate_avg: 'Agg: Gem',
+ aggregate_remove: 'Agg: Verwijder'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('pt-br', {
+ aggregate: {
+ label: 'itens'
+ },
+ groupPanel: {
+ description: 'Arraste e solte uma coluna aqui para agrupar por essa coluna'
+ },
+ search: {
+ placeholder: 'Procurar...',
+ showingItems: 'Mostrando os Itens:',
+ selectedItems: 'Items Selecionados:',
+ totalItems: 'Total de Itens:',
+ size: 'Tamanho da Página:',
+ first: 'Primeira Página',
+ next: 'Próxima Página',
+ previous: 'Página Anterior',
+ last: 'Última Página'
+ },
+ menu: {
+ text: 'Selecione as colunas:'
+ },
+ sort: {
+ ascending: 'Ordenar Ascendente',
+ descending: 'Ordenar Descendente',
+ remove: 'Remover Ordenação'
+ },
+ column: {
+ hide: 'Esconder coluna'
+ },
+ aggregation: {
+ count: 'total de linhas: ',
+ sum: 'total: ',
+ avg: 'med: ',
+ min: 'min: ',
+ max: 'max: '
+ },
+ pinning: {
+ pinLeft: 'Fixar Esquerda',
+ pinRight: 'Fixar Direita',
+ unpin: 'Desprender'
+ },
+ gridMenu: {
+ columns: 'Colunas:',
+ importerTitle: 'Importar arquivo',
+ exporterAllAsCsv: 'Exportar todos os dados como csv',
+ exporterVisibleAsCsv: 'Exportar dados visíveis como csv',
+ exporterSelectedAsCsv: 'Exportar dados selecionados como csv',
+ exporterAllAsPdf: 'Exportar todos os dados como pdf',
+ exporterVisibleAsPdf: 'Exportar dados visíveis como pdf',
+ exporterSelectedAsPdf: 'Exportar dados selecionados como pdf',
+ clearAllFilters: 'Limpar todos os filtros'
+ },
+ importer: {
+ noHeaders: 'Nomes de colunas não puderam ser derivados. O arquivo tem um cabeçalho?',
+ noObjects: 'Objetos não puderam ser derivados. Havia dados no arquivo, além dos cabeçalhos?',
+ invalidCsv: 'Arquivo não pode ser processado. É um CSV válido?',
+ invalidJson: 'Arquivo não pode ser processado. É um Json válido?',
+ jsonNotArray: 'Arquivo json importado tem que conter um array. Abortando.'
+ },
+ pagination: {
+ sizes: 'itens por página',
+ totalItems: 'itens'
+ },
+ grouping: {
+ group: 'Agrupar',
+ ungroup: 'Desagrupar',
+ aggregate_count: 'Agr: Contar',
+ aggregate_sum: 'Agr: Soma',
+ aggregate_max: 'Agr: Max',
+ aggregate_min: 'Agr: Min',
+ aggregate_avg: 'Agr: Med',
+ aggregate_remove: 'Agr: Remover'
+ }
+ });
+ return $delegate;
+ }]);
+}]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('pt', {
+ aggregate: {
+ label: 'itens'
+ },
+ groupPanel: {
+ description: 'Arraste e solte uma coluna aqui para agrupar por essa coluna'
+ },
+ search: {
+ placeholder: 'Procurar...',
+ showingItems: 'Mostrando os Itens:',
+ selectedItems: 'Itens Selecionados:',
+ totalItems: 'Total de Itens:',
+ size: 'Tamanho da Página:',
+ first: 'Primeira Página',
+ next: 'Próxima Página',
+ previous: 'Página Anterior',
+ last: 'Última Página'
+ },
+ menu: {
+ text: 'Selecione as colunas:'
+ },
+ sort: {
+ ascending: 'Ordenar Ascendente',
+ descending: 'Ordenar Descendente',
+ remove: 'Remover Ordenação'
+ },
+ column: {
+ hide: 'Esconder coluna'
+ },
+ aggregation: {
+ count: 'total de linhas: ',
+ sum: 'total: ',
+ avg: 'med: ',
+ min: 'min: ',
+ max: 'max: '
+ },
+ pinning: {
+ pinLeft: 'Fixar Esquerda',
+ pinRight: 'Fixar Direita',
+ unpin: 'Desprender'
+ },
+ gridMenu: {
+ columns: 'Colunas:',
+ importerTitle: 'Importar ficheiro',
+ exporterAllAsCsv: 'Exportar todos os dados como csv',
+ exporterVisibleAsCsv: 'Exportar dados visíveis como csv',
+ exporterSelectedAsCsv: 'Exportar dados selecionados como csv',
+ exporterAllAsPdf: 'Exportar todos os dados como pdf',
+ exporterVisibleAsPdf: 'Exportar dados visíveis como pdf',
+ exporterSelectedAsPdf: 'Exportar dados selecionados como pdf',
+ clearAllFilters: 'Limpar todos os filtros'
+ },
+ importer: {
+ noHeaders: 'Nomes de colunas não puderam ser derivados. O ficheiro tem um cabeçalho?',
+ noObjects: 'Objetos não puderam ser derivados. Havia dados no ficheiro, além dos cabeçalhos?',
+ invalidCsv: 'Ficheiro não pode ser processado. É um CSV válido?',
+ invalidJson: 'Ficheiro não pode ser processado. É um Json válido?',
+ jsonNotArray: 'Ficheiro json importado tem que conter um array. Interrompendo.'
+ },
+ pagination: {
+ sizes: 'itens por página',
+ totalItems: 'itens',
+ of: 'de'
+ },
+ grouping: {
+ group: 'Agrupar',
+ ungroup: 'Desagrupar',
+ aggregate_count: 'Agr: Contar',
+ aggregate_sum: 'Agr: Soma',
+ aggregate_max: 'Agr: Max',
+ aggregate_min: 'Agr: Min',
+ aggregate_avg: 'Agr: Med',
+ aggregate_remove: 'Agr: Remover'
+ }
+ });
+ return $delegate;
+ }]);
+}]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('ru', {
+ aggregate: {
+ label: 'Ñлементы'
+ },
+ groupPanel: {
+ description: 'Ð”Ð»Ñ Ð³Ñ€ÑƒÐ¿Ð¿Ð¸Ñ€Ð¾Ð²ÐºÐ¸ по Ñтолбцу перетащите Ñюда его название.'
+ },
+ search: {
+ placeholder: 'ПоиÑк...',
+ showingItems: 'Показать Ñлементы:',
+ selectedItems: 'Выбранные Ñлементы:',
+ totalItems: 'Ð’Ñего Ñлементов:',
+ size: 'Размер Ñтраницы:',
+ first: 'ÐŸÐµÑ€Ð²Ð°Ñ Ñтраница',
+ next: 'Ð¡Ð»ÐµÐ´ÑƒÑŽÑ‰Ð°Ñ Ñтраница',
+ previous: 'ÐŸÑ€ÐµÐ´Ñ‹Ð´ÑƒÑ‰Ð°Ñ Ñтраница',
+ last: 'ПоÑледнÑÑ Ñтраница'
+ },
+ menu: {
+ text: 'Выбрать Ñтолбцы:'
+ },
+ sort: {
+ ascending: 'По возраÑтанию',
+ descending: 'По убыванию',
+ remove: 'Убрать Ñортировку'
+ },
+ column: {
+ hide: 'СпрÑтать Ñтолбец'
+ },
+ aggregation: {
+ count: 'вÑего Ñтрок: ',
+ sum: 'итого: ',
+ avg: 'Ñреднее: ',
+ min: 'мин: ',
+ max: 'макÑ: '
+ },
+ pinning: {
+ pinLeft: 'Закрепить Ñлева',
+ pinRight: 'Закрепить Ñправа',
+ unpin: 'Открепить'
+ },
+ gridMenu: {
+ columns: 'Столбцы:',
+ importerTitle: 'Import file',
+ exporterAllAsCsv: 'ЭкÑпортировать вÑÑ‘ в CSV',
+ exporterVisibleAsCsv: 'ЭкÑпортировать видимые данные в CSV',
+ exporterSelectedAsCsv: 'ЭкÑпортировать выбранные данные в CSV',
+ exporterAllAsPdf: 'ЭкÑпортировать вÑÑ‘ в PDF',
+ exporterVisibleAsPdf: 'ЭкÑпортировать видимые данные в PDF',
+ exporterSelectedAsPdf: 'ЭкÑпортировать выбранные данные в PDF',
+ clearAllFilters: 'ОчиÑтите вÑе фильтры'
+ },
+ importer: {
+ noHeaders: 'Column names were unable to be derived, does the file have a header?',
+ noObjects: 'Objects were not able to be derived, was there data in the file other than headers?',
+ invalidCsv: 'File was unable to be processed, is it valid CSV?',
+ invalidJson: 'File was unable to be processed, is it valid Json?',
+ jsonNotArray: 'Imported json file must contain an array, aborting.'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('sk', {
+ aggregate: {
+ label: 'items'
+ },
+ groupPanel: {
+ description: 'Pretiahni sem názov stĺpca pre zoskupenie podľa toho stĺpca.'
+ },
+ search: {
+ placeholder: 'Hľadaj...',
+ showingItems: 'Zobrazujem položky:',
+ selectedItems: 'Vybraté položky:',
+ totalItems: 'PoÄet položiek:',
+ size: 'PoÄet:',
+ first: 'Prvá strana',
+ next: 'Ďalšia strana',
+ previous: 'Predchádzajúca strana',
+ last: 'Posledná strana'
+ },
+ menu: {
+ text: 'Vyberte stĺpce:'
+ },
+ sort: {
+ ascending: 'Zotriediť vzostupne',
+ descending: 'Zotriediť zostupne',
+ remove: 'Vymazať triedenie'
+ },
+ aggregation: {
+ count: 'total rows: ',
+ sum: 'total: ',
+ avg: 'avg: ',
+ min: 'min: ',
+ max: 'max: '
+ },
+ gridMenu: {
+ columns: 'Columns:',
+ importerTitle: 'Import file',
+ exporterAllAsCsv: 'Export all data as csv',
+ exporterVisibleAsCsv: 'Export visible data as csv',
+ exporterSelectedAsCsv: 'Export selected data as csv',
+ exporterAllAsPdf: 'Export all data as pdf',
+ exporterVisibleAsPdf: 'Export visible data as pdf',
+ exporterSelectedAsPdf: 'Export selected data as pdf',
+ clearAllFilters: 'Clear all filters'
+ },
+ importer: {
+ noHeaders: 'Column names were unable to be derived, does the file have a header?',
+ noObjects: 'Objects were not able to be derived, was there data in the file other than headers?',
+ invalidCsv: 'File was unable to be processed, is it valid CSV?',
+ invalidJson: 'File was unable to be processed, is it valid Json?',
+ jsonNotArray: 'Imported json file must contain an array, aborting.'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('sv', {
+ aggregate: {
+ label: 'Artiklar'
+ },
+ groupPanel: {
+ description: 'Dra en kolumnrubrik hit och släpp den för gruppera efter den kolumnen.'
+ },
+ search: {
+ placeholder: 'Sök...',
+ showingItems: 'Visar artiklar:',
+ selectedItems: 'Valda artiklar:',
+ totalItems: 'Antal artiklar:',
+ size: 'Sidstorlek:',
+ first: 'Första sidan',
+ next: 'Nästa sida',
+ previous: 'Föregående sida',
+ last: 'Sista sidan'
+ },
+ menu: {
+ text: 'Välj kolumner:'
+ },
+ sort: {
+ ascending: 'Sortera stigande',
+ descending: 'Sortera fallande',
+ remove: 'Inaktivera sortering'
+ },
+ column: {
+ hide: 'Göm kolumn'
+ },
+ aggregation: {
+ count: 'Antal rader: ',
+ sum: 'Summa: ',
+ avg: 'Genomsnitt: ',
+ min: 'Min: ',
+ max: 'Max: '
+ },
+ pinning: {
+ pinLeft: 'Fäst vänster',
+ pinRight: 'Fäst höger',
+ unpin: 'Lösgör'
+ },
+ gridMenu: {
+ columns: 'Kolumner:',
+ importerTitle: 'Importera fil',
+ exporterAllAsCsv: 'Exportera all data som CSV',
+ exporterVisibleAsCsv: 'Exportera synlig data som CSV',
+ exporterSelectedAsCsv: 'Exportera markerad data som CSV',
+ exporterAllAsPdf: 'Exportera all data som PDF',
+ exporterVisibleAsPdf: 'Exportera synlig data som PDF',
+ exporterSelectedAsPdf: 'Exportera markerad data som PDF',
+ clearAllFilters: 'Rengör alla filter'
+ },
+ importer: {
+ noHeaders: 'Kolumnnamn kunde inte härledas. Har filen ett sidhuvud?',
+ noObjects: 'Objekt kunde inte härledas. Har filen data undantaget sidhuvud?',
+ invalidCsv: 'Filen kunde inte behandlas, är den en giltig CSV?',
+ invalidJson: 'Filen kunde inte behandlas, är den en giltig JSON?',
+ jsonNotArray: 'Importerad JSON-fil måste innehålla ett fält. Import avbruten.'
+ },
+ pagination: {
+ sizes: 'Artiklar per sida',
+ totalItems: 'Artiklar'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function () {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('ta', {
+ aggregate: {
+ label: 'உரà¯à®ªà¯à®ªà®Ÿà®¿à®•à®³à¯'
+ },
+ groupPanel: {
+ description: 'ஒர௠பதà¯à®¤à®¿à®¯à¯ˆ கà¯à®´à¯à®µà®¾à®• அமைகà¯à®• அபà¯à®ªà®¤à¯à®¤à®¿à®¯à®¿à®©à¯ தலைபà¯à®ªà¯ˆ இஙà¯à®•à¯‡ இழà¯à®¤à¯à®¤à¯ வரவà¯à®®à¯ '
+ },
+ search: {
+ placeholder: 'தேடல௠...',
+ showingItems: 'உரà¯à®ªà¯à®ªà®Ÿà®¿à®•à®³à¯ˆ காணà¯à®ªà®¿à®¤à¯à®¤à®²à¯:',
+ selectedItems: 'தேரà¯à®¨à¯à®¤à¯†à®Ÿà¯à®•à¯à®•à®ªà¯à®ªà®Ÿà¯à®Ÿ உரà¯à®ªà¯à®ªà®Ÿà®¿à®•à®³à¯:',
+ totalItems: 'மொதà¯à®¤ உரà¯à®ªà¯à®ªà®Ÿà®¿à®•à®³à¯:',
+ size: 'பகà¯à®• அளவà¯: ',
+ first: 'à®®à¯à®¤à®²à¯ பகà¯à®•à®®à¯',
+ next: 'அடà¯à®¤à¯à®¤ பகà¯à®•à®®à¯',
+ previous: 'à®®à¯à®¨à¯à®¤à¯ˆà®¯ பகà¯à®•à®®à¯ ',
+ last: 'இறà¯à®¤à®¿ பகà¯à®•à®®à¯'
+ },
+ menu: {
+ text: 'பதà¯à®¤à®¿à®•à®³à¯ˆ தேரà¯à®¨à¯à®¤à¯†à®Ÿà¯:'
+ },
+ sort: {
+ ascending: 'மேலிரà¯à®¨à¯à®¤à¯ கீழாக',
+ descending: 'கீழிரà¯à®¨à¯à®¤à¯ மேலாக',
+ remove: 'வரிசையை நீகà¯à®•à¯'
+ },
+ column: {
+ hide: 'பதà¯à®¤à®¿à®¯à¯ˆ மறைதà¯à®¤à¯ வை '
+ },
+ aggregation: {
+ count: 'மொதà¯à®¤ வரிகளà¯:',
+ sum: 'மொதà¯à®¤à®®à¯: ',
+ avg: 'சராசரி: ',
+ min: 'கà¯à®±à¯ˆà®¨à¯à®¤à®ªà®Ÿà¯à®š: ',
+ max: 'அதிகபடà¯à®š: '
+ },
+ pinning: {
+ pinLeft: 'இடதà¯à®ªà¯à®±à®®à®¾à®• தைகà¯à®• ',
+ pinRight: 'வலதà¯à®ªà¯à®±à®®à®¾à®• தைகà¯à®•',
+ unpin: 'பிரி'
+ },
+ gridMenu: {
+ columns: 'பதà¯à®¤à®¿à®•à®³à¯:',
+ importerTitle: 'கோபà¯à®ªà¯ : படிதà¯à®¤à®²à¯',
+ exporterAllAsCsv: 'எலà¯à®²à®¾ தரவà¯à®•à®³à¯ˆà®¯à¯à®®à¯ கோபà¯à®ªà®¾à®•à¯à®•à¯: csv',
+ exporterVisibleAsCsv: 'இரà¯à®•à¯à®•à¯à®®à¯ தரவà¯à®•à®³à¯ˆ கோபà¯à®ªà®¾à®•à¯à®•à¯: csv',
+ exporterSelectedAsCsv: 'தேரà¯à®¨à¯à®¤à¯†à®Ÿà¯à®¤à¯à®¤ தரவà¯à®•à®³à¯ˆ கோபà¯à®ªà®¾à®•à¯à®•à¯: csv',
+ exporterAllAsPdf: 'எலà¯à®²à®¾ தரவà¯à®•à®³à¯ˆà®¯à¯à®®à¯ கோபà¯à®ªà®¾à®•à¯à®•à¯: pdf',
+ exporterVisibleAsPdf: 'இரà¯à®•à¯à®•à¯à®®à¯ தரவà¯à®•à®³à¯ˆ கோபà¯à®ªà®¾à®•à¯à®•à¯: pdf',
+ exporterSelectedAsPdf: 'தேரà¯à®¨à¯à®¤à¯†à®Ÿà¯à®¤à¯à®¤ தரவà¯à®•à®³à¯ˆ கோபà¯à®ªà®¾à®•à¯à®•à¯: pdf',
+ clearAllFilters: 'Clear all filters'
+ },
+ importer: {
+ noHeaders: 'பதà¯à®¤à®¿à®¯à®¿à®©à¯ தலைபà¯à®ªà¯à®•à®³à¯ˆ பெற இயலவிலà¯à®²à¯ˆ, கோபà¯à®ªà®¿à®±à¯à®•à¯ தலைபà¯à®ªà¯ உளà¯à®³à®¤à®¾?',
+ noObjects: 'இலகà¯à®•à¯à®•à®³à¯ˆ உரà¯à®µà®¾à®•à¯à®• à®®à¯à®Ÿà®¿à®¯à®µà®¿à®²à¯à®²à¯ˆ, கோபà¯à®ªà®¿à®²à¯ தலைபà¯à®ªà¯à®•à®³à¯ˆ தவிர தரவ௠à®à®¤à¯‡à®©à¯à®®à¯ உளà¯à®³à®¤à®¾? ',
+ invalidCsv: 'சரிவர நடைமà¯à®±à¯ˆ படà¯à®¤à¯à®¤ இயலவிலà¯à®²à¯ˆ, கோபà¯à®ªà¯ சரிதானா? - csv',
+ invalidJson: 'சரிவர நடைமà¯à®±à¯ˆ படà¯à®¤à¯à®¤ இயலவிலà¯à®²à¯ˆ, கோபà¯à®ªà¯ சரிதானா? - json',
+ jsonNotArray: 'படிதà¯à®¤ கோபà¯à®ªà®¿à®²à¯ வரிசைகள௠உளà¯à®³à®¤à¯, நடைமà¯à®±à¯ˆ ரதà¯à®¤à¯ செய௠: json'
+ },
+ pagination: {
+ sizes : 'உரà¯à®ªà¯à®ªà®Ÿà®¿à®•à®³à¯ / பகà¯à®•à®®à¯',
+ totalItems : 'உரà¯à®ªà¯à®ªà®Ÿà®¿à®•à®³à¯ '
+ },
+ grouping: {
+ group : 'கà¯à®´à¯',
+ ungroup : 'பிரி',
+ aggregate_count : 'மதிபà¯à®ªà¯€à®Ÿà¯à®Ÿà¯ : எணà¯à®£à¯',
+ aggregate_sum : 'மதிபà¯à®ªà¯€à®Ÿà¯à®Ÿà¯ : கூடà¯à®Ÿà®²à¯',
+ aggregate_max : 'மதிபà¯à®ªà¯€à®Ÿà¯à®Ÿà¯ : அதிகபடà¯à®šà®®à¯',
+ aggregate_min : 'மதிபà¯à®ªà¯€à®Ÿà¯à®Ÿà¯ : கà¯à®±à¯ˆà®¨à¯à®¤à®ªà®Ÿà¯à®šà®®à¯',
+ aggregate_avg : 'மதிபà¯à®ªà¯€à®Ÿà¯à®Ÿà¯ : சராசரி',
+ aggregate_remove : 'மதிபà¯à®ªà¯€à®Ÿà¯à®Ÿà¯ : நீகà¯à®•à¯'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+/**
+ * @ngdoc overview
+ * @name ui.grid.i18n
+ * @description
+ *
+ * # ui.grid.i18n
+ * This module provides i18n functions to ui.grid and any application that wants to use it
+
+ *
+ * <div doc-module-components="ui.grid.i18n"></div>
+ */
+
+(function () {
+ var DIRECTIVE_ALIASES = ['uiT', 'uiTranslate'];
+ var FILTER_ALIASES = ['t', 'uiTranslate'];
+
+ var module = angular.module('ui.grid.i18n');
+
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.i18n.constant:i18nConstants
+ *
+ * @description constants available in i18n module
+ */
+ module.constant('i18nConstants', {
+ MISSING: '[MISSING]',
+ UPDATE_EVENT: '$uiI18n',
+
+ LOCALE_DIRECTIVE_ALIAS: 'uiI18n',
+ // default to english
+ DEFAULT_LANG: 'en'
+ });
+
+// module.config(['$provide', function($provide) {
+// $provide.decorator('i18nService', ['$delegate', function($delegate) {}])}]);
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.i18n.service:i18nService
+ *
+ * @description Services for i18n
+ */
+ module.service('i18nService', ['$log', 'i18nConstants', '$rootScope',
+ function ($log, i18nConstants, $rootScope) {
+
+ var langCache = {
+ _langs: {},
+ current: null,
+ get: function (lang) {
+ return this._langs[lang.toLowerCase()];
+ },
+ add: function (lang, strings) {
+ var lower = lang.toLowerCase();
+ if (!this._langs[lower]) {
+ this._langs[lower] = {};
+ }
+ angular.extend(this._langs[lower], strings);
+ },
+ getAllLangs: function () {
+ var langs = [];
+ if (!this._langs) {
+ return langs;
+ }
+
+ for (var key in this._langs) {
+ langs.push(key);
+ }
+
+ return langs;
+ },
+ setCurrent: function (lang) {
+ this.current = lang.toLowerCase();
+ },
+ getCurrentLang: function () {
+ return this.current;
+ }
+ };
+
+ var service = {
+
+ /**
+ * @ngdoc service
+ * @name add
+ * @methodOf ui.grid.i18n.service:i18nService
+ * @description Adds the languages and strings to the cache. Decorate this service to
+ * add more translation strings
+ * @param {string} lang language to add
+ * @param {object} stringMaps of strings to add grouped by property names
+ * @example
+ * <pre>
+ * i18nService.add('en', {
+ * aggregate: {
+ * label1: 'items',
+ * label2: 'some more items'
+ * }
+ * },
+ * groupPanel: {
+ * description: 'Drag a column header here and drop it to group by that column.'
+ * }
+ * }
+ * </pre>
+ */
+ add: function (langs, stringMaps) {
+ if (typeof(langs) === 'object') {
+ angular.forEach(langs, function (lang) {
+ if (lang) {
+ langCache.add(lang, stringMaps);
+ }
+ });
+ } else {
+ langCache.add(langs, stringMaps);
+ }
+ },
+
+ /**
+ * @ngdoc service
+ * @name getAllLangs
+ * @methodOf ui.grid.i18n.service:i18nService
+ * @description return all currently loaded languages
+ * @returns {array} string
+ */
+ getAllLangs: function () {
+ return langCache.getAllLangs();
+ },
+
+ /**
+ * @ngdoc service
+ * @name get
+ * @methodOf ui.grid.i18n.service:i18nService
+ * @description return all currently loaded languages
+ * @param {string} lang to return. If not specified, returns current language
+ * @returns {object} the translation string maps for the language
+ */
+ get: function (lang) {
+ var language = lang ? lang : service.getCurrentLang();
+ return langCache.get(language);
+ },
+
+ /**
+ * @ngdoc service
+ * @name getSafeText
+ * @methodOf ui.grid.i18n.service:i18nService
+ * @description returns the text specified in the path or a Missing text if text is not found
+ * @param {string} path property path to use for retrieving text from string map
+ * @param {string} lang to return. If not specified, returns current language
+ * @returns {object} the translation for the path
+ * @example
+ * <pre>
+ * i18nService.getSafeText('sort.ascending')
+ * </pre>
+ */
+ getSafeText: function (path, lang) {
+ var language = lang ? lang : service.getCurrentLang();
+ var trans = langCache.get(language);
+
+ if (!trans) {
+ return i18nConstants.MISSING;
+ }
+
+ var paths = path.split('.');
+ var current = trans;
+
+ for (var i = 0; i < paths.length; ++i) {
+ if (current[paths[i]] === undefined || current[paths[i]] === null) {
+ return i18nConstants.MISSING;
+ } else {
+ current = current[paths[i]];
+ }
+ }
+
+ return current;
+
+ },
+
+ /**
+ * @ngdoc service
+ * @name setCurrentLang
+ * @methodOf ui.grid.i18n.service:i18nService
+ * @description sets the current language to use in the application
+ * $broadcasts the Update_Event on the $rootScope
+ * @param {string} lang to set
+ * @example
+ * <pre>
+ * i18nService.setCurrentLang('fr');
+ * </pre>
+ */
+
+ setCurrentLang: function (lang) {
+ if (lang) {
+ langCache.setCurrent(lang);
+ $rootScope.$broadcast(i18nConstants.UPDATE_EVENT);
+ }
+ },
+
+ /**
+ * @ngdoc service
+ * @name getCurrentLang
+ * @methodOf ui.grid.i18n.service:i18nService
+ * @description returns the current language used in the application
+ */
+ getCurrentLang: function () {
+ var lang = langCache.getCurrentLang();
+ if (!lang) {
+ lang = i18nConstants.DEFAULT_LANG;
+ langCache.setCurrent(lang);
+ }
+ return lang;
+ }
+
+ };
+
+ return service;
+
+ }]);
+
+ var localeDirective = function (i18nService, i18nConstants) {
+ return {
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs) {
+ var alias = i18nConstants.LOCALE_DIRECTIVE_ALIAS;
+ // check for watchable property
+ var lang = $scope.$eval($attrs[alias]);
+ if (lang) {
+ $scope.$watch($attrs[alias], function () {
+ i18nService.setCurrentLang(lang);
+ });
+ } else if ($attrs.$$observers) {
+ $attrs.$observe(alias, function () {
+ i18nService.setCurrentLang($attrs[alias] || i18nConstants.DEFAULT_LANG);
+ });
+ }
+ }
+ };
+ }
+ };
+ };
+
+ module.directive('uiI18n', ['i18nService', 'i18nConstants', localeDirective]);
+
+ // directive syntax
+ var uitDirective = function ($parse, i18nService, i18nConstants) {
+ return {
+ restrict: 'EA',
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs) {
+ var alias1 = DIRECTIVE_ALIASES[0],
+ alias2 = DIRECTIVE_ALIASES[1];
+ var token = $attrs[alias1] || $attrs[alias2] || $elm.html();
+ var missing = i18nConstants.MISSING + token;
+ var observer;
+ if ($attrs.$$observers) {
+ var prop = $attrs[alias1] ? alias1 : alias2;
+ observer = $attrs.$observe(prop, function (result) {
+ if (result) {
+ $elm.html($parse(result)(i18nService.getCurrentLang()) || missing);
+ }
+ });
+ }
+ var getter = $parse(token);
+ var listener = $scope.$on(i18nConstants.UPDATE_EVENT, function (evt) {
+ if (observer) {
+ observer($attrs[alias1] || $attrs[alias2]);
+ } else {
+ // set text based on i18n current language
+ $elm.html(getter(i18nService.get()) || missing);
+ }
+ });
+ $scope.$on('$destroy', listener);
+
+ $elm.html(getter(i18nService.get()) || missing);
+ }
+ };
+ }
+ };
+ };
+
+ angular.forEach( DIRECTIVE_ALIASES, function ( alias ) {
+ module.directive( alias, ['$parse', 'i18nService', 'i18nConstants', uitDirective] );
+ } );
+
+ // optional filter syntax
+ var uitFilter = function ($parse, i18nService, i18nConstants) {
+ return function (data) {
+ var getter = $parse(data);
+ // set text based on i18n current language
+ return getter(i18nService.get()) || i18nConstants.MISSING + data;
+ };
+ };
+
+ angular.forEach( FILTER_ALIASES, function ( alias ) {
+ module.filter( alias, ['$parse', 'i18nService', 'i18nConstants', uitFilter] );
+ } );
+
+
+})();
+(function() {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('zh-cn', {
+ headerCell: {
+ aria: {
+ defaultFilterLabel: '列过滤器',
+ removeFilter: '移除过滤器',
+ columnMenuButtonLabel: '列èœå•'
+ },
+ priority: '优先级:',
+ filterLabel: "列过滤器: "
+ },
+ aggregate: {
+ label: '行'
+ },
+ groupPanel: {
+ description: '拖曳表头到此处进行分组'
+ },
+ search: {
+ placeholder: '查找',
+ showingItems: '已显示行数:',
+ selectedItems: '已选择行数:',
+ totalItems: '总行数:',
+ size: 'æ¯é¡µæ˜¾ç¤ºè¡Œæ•°ï¼š',
+ first: '首页',
+ next: '下一页',
+ previous: '上一页',
+ last: '末页'
+ },
+ menu: {
+ text: '选择列:'
+ },
+ sort: {
+ ascending: 'å‡åº',
+ descending: 'é™åº',
+ none: 'æ— åº',
+ remove: 'å–消排åº'
+ },
+ column: {
+ hide: 'éšè—列'
+ },
+ aggregation: {
+ count: '计数:',
+ sum: '求和:',
+ avg: 'å‡å€¼ï¼š',
+ min: '最å°å€¼ï¼š',
+ max: '最大值:'
+ },
+ pinning: {
+ pinLeft: '左侧固定',
+ pinRight: 'å³ä¾§å›ºå®š',
+ unpin: 'å–消固定'
+ },
+ columnMenu: {
+ close: '关闭'
+ },
+ gridMenu: {
+ aria: {
+ buttonLabel: '表格èœå•'
+ },
+ columns: '列:',
+ importerTitle: '导入文件',
+ exporterAllAsCsv: '导出全部数æ®åˆ°CSV',
+ exporterVisibleAsCsv: '导出å¯è§æ•°æ®åˆ°CSV',
+ exporterSelectedAsCsv: '导出已选数æ®åˆ°CSV',
+ exporterAllAsPdf: '导出全部数æ®åˆ°PDF',
+ exporterVisibleAsPdf: '导出å¯è§æ•°æ®åˆ°PDF',
+ exporterSelectedAsPdf: '导出已选数æ®åˆ°PDF',
+ clearAllFilters: '清除所有过滤器'
+ },
+ importer: {
+ noHeaders: '无法获å–列å,确定文件包å«è¡¨å¤´ï¼Ÿ',
+ noObjects: '无法获å–æ•°æ®ï¼Œç¡®å®šæ–‡ä»¶åŒ…å«æ•°æ®ï¼Ÿ',
+ invalidCsv: '无法处ç†æ–‡ä»¶ï¼Œç¡®å®šæ˜¯åˆæ³•çš„CSV文件?',
+ invalidJson: '无法处ç†æ–‡ä»¶ï¼Œç¡®å®šæ˜¯åˆæ³•çš„JSON文件?',
+ jsonNotArray: '导入的文件ä¸æ˜¯JSON数组ï¼'
+ },
+ pagination: {
+ aria: {
+ pageToFirst: '第一页',
+ pageBack: '上一页',
+ pageSelected: '当å‰é¡µ',
+ pageForward: '下一页',
+ pageToLast: '最åŽä¸€é¡µ'
+ },
+ sizes: 'è¡Œæ¯é¡µ',
+ totalItems: '行',
+ through: '至',
+ of: 'å…±'
+ },
+ grouping: {
+ group: '分组',
+ ungroup: 'å–消分组',
+ aggregate_count: 'åˆè®¡: 计数',
+ aggregate_sum: 'åˆè®¡: 求和',
+ aggregate_max: 'åˆè®¡: 最大',
+ aggregate_min: 'åˆè®¡: 最å°',
+ aggregate_avg: 'åˆè®¡: å¹³å‡',
+ aggregate_remove: 'åˆè®¡: 移除'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function() {
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('i18nService', ['$delegate', function($delegate) {
+ $delegate.add('zh-tw', {
+ aggregate: {
+ label: '行'
+ },
+ groupPanel: {
+ description: '拖曳表頭到此處進行分組'
+ },
+ search: {
+ placeholder: '查找',
+ showingItems: '已顯示行數:',
+ selectedItems: 'å·²é¸æ“‡è¡Œæ•¸ï¼š',
+ totalItems: '總行數:',
+ size: 'æ¯é é¡¯ç¤ºè¡Œæ•¸ï¼š',
+ first: '首é ',
+ next: '下壹é ',
+ previous: '上壹é ',
+ last: '末é '
+ },
+ menu: {
+ text: 'é¸æ“‡åˆ—:'
+ },
+ sort: {
+ ascending: 'å‡åº',
+ descending: 'é™åº',
+ remove: 'å–消排åº'
+ },
+ column: {
+ hide: 'éš±è—列'
+ },
+ aggregation: {
+ count: '計數:',
+ sum: '求和:',
+ avg: 'å‡å€¼ï¼š',
+ min: '最å°å€¼ï¼š',
+ max: '最大值:'
+ },
+ pinning: {
+ pinLeft: 'å·¦å´å›ºå®š',
+ pinRight: 'å³å´å›ºå®š',
+ unpin: 'å–消固定'
+ },
+ gridMenu: {
+ columns: '列:',
+ importerTitle: '導入文件',
+ exporterAllAsCsv: '導出全部數據到CSV',
+ exporterVisibleAsCsv: '導出å¯è¦‹æ•¸æ“šåˆ°CSV',
+ exporterSelectedAsCsv: '導出已é¸æ•¸æ“šåˆ°CSV',
+ exporterAllAsPdf: '導出全部數據到PDF',
+ exporterVisibleAsPdf: '導出å¯è¦‹æ•¸æ“šåˆ°PDF',
+ exporterSelectedAsPdf: '導出已é¸æ•¸æ“šåˆ°PDF',
+ clearAllFilters: '清除所有过滤器'
+ },
+ importer: {
+ noHeaders: '無法ç²å–列å,確定文件包å«è¡¨é ­ï¼Ÿ',
+ noObjects: '無法ç²å–數據,確定文件包å«æ•¸æ“šï¼Ÿ',
+ invalidCsv: '無法處ç†æ–‡ä»¶ï¼Œç¢ºå®šæ˜¯åˆæ³•çš„CSV文件?',
+ invalidJson: '無法處ç†æ–‡ä»¶ï¼Œç¢ºå®šæ˜¯åˆæ³•çš„JSON文件?',
+ jsonNotArray: '導入的文件ä¸æ˜¯JSON數組ï¼'
+ },
+ pagination: {
+ sizes: 'è¡Œæ¯é ',
+ totalItems: '行'
+ }
+ });
+ return $delegate;
+ }]);
+ }]);
+})();
+
+(function() {
+ 'use strict';
+ /**
+ * @ngdoc overview
+ * @name ui.grid.autoResize
+ *
+ * @description
+ *
+ * #ui.grid.autoResize
+ *
+ * <div class="alert alert-warning" role="alert"><strong>Beta</strong> This feature is ready for testing, but it either hasn't seen a lot of use or has some known bugs.</div>
+ *
+ * This module provides auto-resizing functionality to UI-Grid.
+ */
+ var module = angular.module('ui.grid.autoResize', ['ui.grid']);
+
+
+ module.directive('uiGridAutoResize', ['$timeout', 'gridUtil', function ($timeout, gridUtil) {
+ return {
+ require: 'uiGrid',
+ scope: false,
+ link: function ($scope, $elm, $attrs, uiGridCtrl) {
+ var prevGridWidth, prevGridHeight;
+
+ function getDimensions() {
+ prevGridHeight = gridUtil.elementHeight($elm);
+ prevGridWidth = gridUtil.elementWidth($elm);
+ }
+
+ // Initialize the dimensions
+ getDimensions();
+
+ var resizeTimeoutId;
+ function startTimeout() {
+ clearTimeout(resizeTimeoutId);
+
+ resizeTimeoutId = setTimeout(function () {
+ var newGridHeight = gridUtil.elementHeight($elm);
+ var newGridWidth = gridUtil.elementWidth($elm);
+
+ if (newGridHeight !== prevGridHeight || newGridWidth !== prevGridWidth) {
+ uiGridCtrl.grid.gridHeight = newGridHeight;
+ uiGridCtrl.grid.gridWidth = newGridWidth;
+
+ $scope.$apply(function () {
+ uiGridCtrl.grid.refresh()
+ .then(function () {
+ getDimensions();
+
+ startTimeout();
+ });
+ });
+ }
+ else {
+ startTimeout();
+ }
+ }, 250);
+ }
+
+ startTimeout();
+
+ $scope.$on('$destroy', function() {
+ clearTimeout(resizeTimeoutId);
+ });
+ }
+ };
+ }]);
+})();
+
+(function () {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.cellNav
+ *
+ * @description
+
+ #ui.grid.cellNav
+
+ <div class="alert alert-success" role="alert"><strong>Stable</strong> This feature is stable. There should no longer be breaking api changes without a deprecation warning.</div>
+
+ This module provides auto-resizing functionality to UI-Grid.
+ */
+ var module = angular.module('ui.grid.cellNav', ['ui.grid']);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.cellNav.constant:uiGridCellNavConstants
+ *
+ * @description constants available in cellNav
+ */
+ module.constant('uiGridCellNavConstants', {
+ FEATURE_NAME: 'gridCellNav',
+ CELL_NAV_EVENT: 'cellNav',
+ direction: {LEFT: 0, RIGHT: 1, UP: 2, DOWN: 3, PG_UP: 4, PG_DOWN: 5},
+ EVENT_TYPE: {
+ KEYDOWN: 0,
+ CLICK: 1,
+ CLEAR: 2
+ }
+ });
+
+
+ module.factory('uiGridCellNavFactory', ['gridUtil', 'uiGridConstants', 'uiGridCellNavConstants', 'GridRowColumn', '$q',
+ function (gridUtil, uiGridConstants, uiGridCellNavConstants, GridRowColumn, $q) {
+ /**
+ * @ngdoc object
+ * @name ui.grid.cellNav.object:CellNav
+ * @description returns a CellNav prototype function
+ * @param {object} rowContainer container for rows
+ * @param {object} colContainer parent column container
+ * @param {object} leftColContainer column container to the left of parent
+ * @param {object} rightColContainer column container to the right of parent
+ */
+ var UiGridCellNav = function UiGridCellNav(rowContainer, colContainer, leftColContainer, rightColContainer) {
+ this.rows = rowContainer.visibleRowCache;
+ this.columns = colContainer.visibleColumnCache;
+ this.leftColumns = leftColContainer ? leftColContainer.visibleColumnCache : [];
+ this.rightColumns = rightColContainer ? rightColContainer.visibleColumnCache : [];
+ this.bodyContainer = rowContainer;
+ };
+
+ /** returns focusable columns of all containers */
+ UiGridCellNav.prototype.getFocusableCols = function () {
+ var allColumns = this.leftColumns.concat(this.columns, this.rightColumns);
+
+ return allColumns.filter(function (col) {
+ return col.colDef.allowCellFocus;
+ });
+ };
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.cellNav.api:GridRow
+ *
+ * @description GridRow settings for cellNav feature, these are available to be
+ * set only internally (for example, by other features)
+ */
+
+ /**
+ * @ngdoc object
+ * @name allowCellFocus
+ * @propertyOf ui.grid.cellNav.api:GridRow
+ * @description Enable focus on a cell within this row. If set to false then no cells
+ * in this row can be focused - group header rows as an example would set this to false.
+ * <br/>Defaults to true
+ */
+ /** returns focusable rows */
+ UiGridCellNav.prototype.getFocusableRows = function () {
+ return this.rows.filter(function(row) {
+ return row.allowCellFocus !== false;
+ });
+ };
+
+ UiGridCellNav.prototype.getNextRowCol = function (direction, curRow, curCol) {
+ switch (direction) {
+ case uiGridCellNavConstants.direction.LEFT:
+ return this.getRowColLeft(curRow, curCol);
+ case uiGridCellNavConstants.direction.RIGHT:
+ return this.getRowColRight(curRow, curCol);
+ case uiGridCellNavConstants.direction.UP:
+ return this.getRowColUp(curRow, curCol);
+ case uiGridCellNavConstants.direction.DOWN:
+ return this.getRowColDown(curRow, curCol);
+ case uiGridCellNavConstants.direction.PG_UP:
+ return this.getRowColPageUp(curRow, curCol);
+ case uiGridCellNavConstants.direction.PG_DOWN:
+ return this.getRowColPageDown(curRow, curCol);
+ }
+
+ };
+
+ UiGridCellNav.prototype.initializeSelection = function () {
+ var focusableCols = this.getFocusableCols();
+ var focusableRows = this.getFocusableRows();
+ if (focusableCols.length === 0 || focusableRows.length === 0) {
+ return null;
+ }
+
+ var curRowIndex = 0;
+ var curColIndex = 0;
+ return new GridRowColumn(focusableRows[0], focusableCols[0]); //return same row
+ };
+
+ UiGridCellNav.prototype.getRowColLeft = function (curRow, curCol) {
+ var focusableCols = this.getFocusableCols();
+ var focusableRows = this.getFocusableRows();
+ var curColIndex = focusableCols.indexOf(curCol);
+ var curRowIndex = focusableRows.indexOf(curRow);
+
+ //could not find column in focusable Columns so set it to 1
+ if (curColIndex === -1) {
+ curColIndex = 1;
+ }
+
+ var nextColIndex = curColIndex === 0 ? focusableCols.length - 1 : curColIndex - 1;
+
+ //get column to left
+ if (nextColIndex > curColIndex) {
+ // On the first row
+ // if (curRowIndex === 0 && curColIndex === 0) {
+ // return null;
+ // }
+ if (curRowIndex === 0) {
+ return new GridRowColumn(curRow, focusableCols[nextColIndex]); //return same row
+ }
+ else {
+ //up one row and far right column
+ return new GridRowColumn(focusableRows[curRowIndex - 1], focusableCols[nextColIndex]);
+ }
+ }
+ else {
+ return new GridRowColumn(curRow, focusableCols[nextColIndex]);
+ }
+ };
+
+
+
+ UiGridCellNav.prototype.getRowColRight = function (curRow, curCol) {
+ var focusableCols = this.getFocusableCols();
+ var focusableRows = this.getFocusableRows();
+ var curColIndex = focusableCols.indexOf(curCol);
+ var curRowIndex = focusableRows.indexOf(curRow);
+
+ //could not find column in focusable Columns so set it to 0
+ if (curColIndex === -1) {
+ curColIndex = 0;
+ }
+ var nextColIndex = curColIndex === focusableCols.length - 1 ? 0 : curColIndex + 1;
+
+ if (nextColIndex < curColIndex) {
+ if (curRowIndex === focusableRows.length - 1) {
+ return new GridRowColumn(curRow, focusableCols[nextColIndex]); //return same row
+ }
+ else {
+ //down one row and far left column
+ return new GridRowColumn(focusableRows[curRowIndex + 1], focusableCols[nextColIndex]);
+ }
+ }
+ else {
+ return new GridRowColumn(curRow, focusableCols[nextColIndex]);
+ }
+ };
+
+ UiGridCellNav.prototype.getRowColDown = function (curRow, curCol) {
+ var focusableCols = this.getFocusableCols();
+ var focusableRows = this.getFocusableRows();
+ var curColIndex = focusableCols.indexOf(curCol);
+ var curRowIndex = focusableRows.indexOf(curRow);
+
+ //could not find column in focusable Columns so set it to 0
+ if (curColIndex === -1) {
+ curColIndex = 0;
+ }
+
+ if (curRowIndex === focusableRows.length - 1) {
+ return new GridRowColumn(curRow, focusableCols[curColIndex]); //return same row
+ }
+ else {
+ //down one row
+ return new GridRowColumn(focusableRows[curRowIndex + 1], focusableCols[curColIndex]);
+ }
+ };
+
+ UiGridCellNav.prototype.getRowColPageDown = function (curRow, curCol) {
+ var focusableCols = this.getFocusableCols();
+ var focusableRows = this.getFocusableRows();
+ var curColIndex = focusableCols.indexOf(curCol);
+ var curRowIndex = focusableRows.indexOf(curRow);
+
+ //could not find column in focusable Columns so set it to 0
+ if (curColIndex === -1) {
+ curColIndex = 0;
+ }
+
+ var pageSize = this.bodyContainer.minRowsToRender();
+ if (curRowIndex >= focusableRows.length - pageSize) {
+ return new GridRowColumn(focusableRows[focusableRows.length - 1], focusableCols[curColIndex]); //return last row
+ }
+ else {
+ //down one page
+ return new GridRowColumn(focusableRows[curRowIndex + pageSize], focusableCols[curColIndex]);
+ }
+ };
+
+ UiGridCellNav.prototype.getRowColUp = function (curRow, curCol) {
+ var focusableCols = this.getFocusableCols();
+ var focusableRows = this.getFocusableRows();
+ var curColIndex = focusableCols.indexOf(curCol);
+ var curRowIndex = focusableRows.indexOf(curRow);
+
+ //could not find column in focusable Columns so set it to 0
+ if (curColIndex === -1) {
+ curColIndex = 0;
+ }
+
+ if (curRowIndex === 0) {
+ return new GridRowColumn(curRow, focusableCols[curColIndex]); //return same row
+ }
+ else {
+ //up one row
+ return new GridRowColumn(focusableRows[curRowIndex - 1], focusableCols[curColIndex]);
+ }
+ };
+
+ UiGridCellNav.prototype.getRowColPageUp = function (curRow, curCol) {
+ var focusableCols = this.getFocusableCols();
+ var focusableRows = this.getFocusableRows();
+ var curColIndex = focusableCols.indexOf(curCol);
+ var curRowIndex = focusableRows.indexOf(curRow);
+
+ //could not find column in focusable Columns so set it to 0
+ if (curColIndex === -1) {
+ curColIndex = 0;
+ }
+
+ var pageSize = this.bodyContainer.minRowsToRender();
+ if (curRowIndex - pageSize < 0) {
+ return new GridRowColumn(focusableRows[0], focusableCols[curColIndex]); //return first row
+ }
+ else {
+ //up one page
+ return new GridRowColumn(focusableRows[curRowIndex - pageSize], focusableCols[curColIndex]);
+ }
+ };
+ return UiGridCellNav;
+ }]);
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.cellNav.service:uiGridCellNavService
+ *
+ * @description Services for cell navigation features. If you don't like the key maps we use,
+ * or the direction cells navigation, override with a service decorator (see angular docs)
+ */
+ module.service('uiGridCellNavService', ['gridUtil', 'uiGridConstants', 'uiGridCellNavConstants', '$q', 'uiGridCellNavFactory', 'GridRowColumn', 'ScrollEvent',
+ function (gridUtil, uiGridConstants, uiGridCellNavConstants, $q, UiGridCellNav, GridRowColumn, ScrollEvent) {
+
+ var service = {
+
+ initializeGrid: function (grid) {
+ grid.registerColumnBuilder(service.cellNavColumnBuilder);
+
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.cellNav:Grid.cellNav
+ * @description cellNav properties added to grid class
+ */
+ grid.cellNav = {};
+ grid.cellNav.lastRowCol = null;
+ grid.cellNav.focusedCells = [];
+
+ service.defaultGridOptions(grid.options);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.cellNav.api:PublicApi
+ *
+ * @description Public Api for cellNav feature
+ */
+ var publicApi = {
+ events: {
+ cellNav: {
+ /**
+ * @ngdoc event
+ * @name navigate
+ * @eventOf ui.grid.cellNav.api:PublicApi
+ * @description raised when the active cell is changed
+ * <pre>
+ * gridApi.cellNav.on.navigate(scope,function(newRowcol, oldRowCol){})
+ * </pre>
+ * @param {object} newRowCol new position
+ * @param {object} oldRowCol old position
+ */
+ navigate: function (newRowCol, oldRowCol) {},
+ /**
+ * @ngdoc event
+ * @name viewPortKeyDown
+ * @eventOf ui.grid.cellNav.api:PublicApi
+ * @description is raised when the viewPort receives a keyDown event. Cells never get focus in uiGrid
+ * due to the difficulties of setting focus on a cell that is not visible in the viewport. Use this
+ * event whenever you need a keydown event on a cell
+ * <br/>
+ * @param {object} event keydown event
+ * @param {object} rowCol current rowCol position
+ */
+ viewPortKeyDown: function (event, rowCol) {},
+
+ /**
+ * @ngdoc event
+ * @name viewPortKeyPress
+ * @eventOf ui.grid.cellNav.api:PublicApi
+ * @description is raised when the viewPort receives a keyPress event. Cells never get focus in uiGrid
+ * due to the difficulties of setting focus on a cell that is not visible in the viewport. Use this
+ * event whenever you need a keypress event on a cell
+ * <br/>
+ * @param {object} event keypress event
+ * @param {object} rowCol current rowCol position
+ */
+ viewPortKeyPress: function (event, rowCol) {}
+ }
+ },
+ methods: {
+ cellNav: {
+ /**
+ * @ngdoc function
+ * @name scrollToFocus
+ * @methodOf ui.grid.cellNav.api:PublicApi
+ * @description brings the specified row and column into view, and sets focus
+ * to that cell
+ * @param {object} rowEntity gridOptions.data[] array instance to make visible and set focus
+ * @param {object} colDef to make visible and set focus
+ * @returns {promise} a promise that is resolved after any scrolling is finished
+ */
+ scrollToFocus: function (rowEntity, colDef) {
+ return service.scrollToFocus(grid, rowEntity, colDef);
+ },
+
+ /**
+ * @ngdoc function
+ * @name getFocusedCell
+ * @methodOf ui.grid.cellNav.api:PublicApi
+ * @description returns the current (or last if Grid does not have focus) focused row and column
+ * <br> value is null if no selection has occurred
+ */
+ getFocusedCell: function () {
+ return grid.cellNav.lastRowCol;
+ },
+
+ /**
+ * @ngdoc function
+ * @name getCurrentSelection
+ * @methodOf ui.grid.cellNav.api:PublicApi
+ * @description returns an array containing the current selection
+ * <br> array is empty if no selection has occurred
+ */
+ getCurrentSelection: function () {
+ return grid.cellNav.focusedCells;
+ },
+
+ /**
+ * @ngdoc function
+ * @name rowColSelectIndex
+ * @methodOf ui.grid.cellNav.api:PublicApi
+ * @description returns the index in the order in which the GridRowColumn was selected, returns -1 if the GridRowColumn
+ * isn't selected
+ * @param {object} rowCol the rowCol to evaluate
+ */
+ rowColSelectIndex: function (rowCol) {
+ //return gridUtil.arrayContainsObjectWithProperty(grid.cellNav.focusedCells, 'col.uid', rowCol.col.uid) &&
+ var index = -1;
+ for (var i = 0; i < grid.cellNav.focusedCells.length; i++) {
+ if (grid.cellNav.focusedCells[i].col.uid === rowCol.col.uid &&
+ grid.cellNav.focusedCells[i].row.uid === rowCol.row.uid) {
+ index = i;
+ break;
+ }
+ }
+ return index;
+ }
+ }
+ }
+ };
+
+ grid.api.registerEventsFromObject(publicApi.events);
+
+ grid.api.registerMethodsFromObject(publicApi.methods);
+
+ },
+
+ defaultGridOptions: function (gridOptions) {
+ /**
+ * @ngdoc object
+ * @name ui.grid.cellNav.api:GridOptions
+ *
+ * @description GridOptions for cellNav feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+
+ /**
+ * @ngdoc object
+ * @name modifierKeysToMultiSelectCells
+ * @propertyOf ui.grid.cellNav.api:GridOptions
+ * @description Enable multiple cell selection only when using the ctrlKey or shiftKey.
+ * <br/>Defaults to false
+ */
+ gridOptions.modifierKeysToMultiSelectCells = gridOptions.modifierKeysToMultiSelectCells === true;
+
+ },
+
+ /**
+ * @ngdoc service
+ * @name decorateRenderContainers
+ * @methodOf ui.grid.cellNav.service:uiGridCellNavService
+ * @description decorates grid renderContainers with cellNav functions
+ */
+ decorateRenderContainers: function (grid) {
+
+ var rightContainer = grid.hasRightContainer() ? grid.renderContainers.right : null;
+ var leftContainer = grid.hasLeftContainer() ? grid.renderContainers.left : null;
+
+ if (leftContainer !== null) {
+ grid.renderContainers.left.cellNav = new UiGridCellNav(grid.renderContainers.body, leftContainer, rightContainer, grid.renderContainers.body);
+ }
+ if (rightContainer !== null) {
+ grid.renderContainers.right.cellNav = new UiGridCellNav(grid.renderContainers.body, rightContainer, grid.renderContainers.body, leftContainer);
+ }
+
+ grid.renderContainers.body.cellNav = new UiGridCellNav(grid.renderContainers.body, grid.renderContainers.body, leftContainer, rightContainer);
+ },
+
+ /**
+ * @ngdoc service
+ * @name getDirection
+ * @methodOf ui.grid.cellNav.service:uiGridCellNavService
+ * @description determines which direction to for a given keyDown event
+ * @returns {uiGridCellNavConstants.direction} direction
+ */
+ getDirection: function (evt) {
+ if (evt.keyCode === uiGridConstants.keymap.LEFT ||
+ (evt.keyCode === uiGridConstants.keymap.TAB && evt.shiftKey)) {
+ return uiGridCellNavConstants.direction.LEFT;
+ }
+ if (evt.keyCode === uiGridConstants.keymap.RIGHT ||
+ evt.keyCode === uiGridConstants.keymap.TAB) {
+ return uiGridCellNavConstants.direction.RIGHT;
+ }
+
+ if (evt.keyCode === uiGridConstants.keymap.UP ||
+ (evt.keyCode === uiGridConstants.keymap.ENTER && evt.shiftKey) ) {
+ return uiGridCellNavConstants.direction.UP;
+ }
+
+ if (evt.keyCode === uiGridConstants.keymap.PG_UP){
+ return uiGridCellNavConstants.direction.PG_UP;
+ }
+
+ if (evt.keyCode === uiGridConstants.keymap.DOWN ||
+ evt.keyCode === uiGridConstants.keymap.ENTER && !(evt.ctrlKey || evt.altKey)) {
+ return uiGridCellNavConstants.direction.DOWN;
+ }
+
+ if (evt.keyCode === uiGridConstants.keymap.PG_DOWN){
+ return uiGridCellNavConstants.direction.PG_DOWN;
+ }
+
+ return null;
+ },
+
+ /**
+ * @ngdoc service
+ * @name cellNavColumnBuilder
+ * @methodOf ui.grid.cellNav.service:uiGridCellNavService
+ * @description columnBuilder function that adds cell navigation properties to grid column
+ * @returns {promise} promise that will load any needed templates when resolved
+ */
+ cellNavColumnBuilder: function (colDef, col, gridOptions) {
+ var promises = [];
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.cellNav.api:ColumnDef
+ *
+ * @description Column Definitions for cellNav feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions.columnDef gridOptions.columnDefs}
+ */
+
+ /**
+ * @ngdoc object
+ * @name allowCellFocus
+ * @propertyOf ui.grid.cellNav.api:ColumnDef
+ * @description Enable focus on a cell within this column.
+ * <br/>Defaults to true
+ */
+ colDef.allowCellFocus = colDef.allowCellFocus === undefined ? true : colDef.allowCellFocus;
+
+ return $q.all(promises);
+ },
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.cellNav.service:uiGridCellNavService
+ * @name scrollToFocus
+ * @description Scroll the grid such that the specified
+ * row and column is in view, and set focus to the cell in that row and column
+ * @param {Grid} grid the grid you'd like to act upon, usually available
+ * from gridApi.grid
+ * @param {object} rowEntity gridOptions.data[] array instance to make visible and set focus to
+ * @param {object} colDef to make visible and set focus to
+ * @returns {promise} a promise that is resolved after any scrolling is finished
+ */
+ scrollToFocus: function (grid, rowEntity, colDef) {
+ var gridRow = null, gridCol = null;
+
+ if (typeof(rowEntity) !== 'undefined' && rowEntity !== null) {
+ gridRow = grid.getRow(rowEntity);
+ }
+
+ if (typeof(colDef) !== 'undefined' && colDef !== null) {
+ gridCol = grid.getColumn(colDef.name ? colDef.name : colDef.field);
+ }
+ return grid.api.core.scrollToIfNecessary(gridRow, gridCol).then(function () {
+ var rowCol = { row: gridRow, col: gridCol };
+
+ // Broadcast the navigation
+ if (gridRow !== null && gridCol !== null) {
+ grid.cellNav.broadcastCellNav(rowCol);
+ }
+ });
+
+
+
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.cellNav.service:uiGridCellNavService
+ * @name getLeftWidth
+ * @description Get the current drawn width of the columns in the
+ * grid up to the numbered column, and add an apportionment for the
+ * column that we're on. So if we are on column 0, we want to scroll
+ * 0% (i.e. exclude this column from calc). If we're on the last column
+ * we want to scroll to 100% (i.e. include this column in the calc). So
+ * we include (thisColIndex / totalNumberCols) % of this column width
+ * @param {Grid} grid the grid you'd like to act upon, usually available
+ * from gridApi.grid
+ * @param {gridCol} upToCol the column to total up to and including
+ */
+ getLeftWidth: function (grid, upToCol) {
+ var width = 0;
+
+ if (!upToCol) {
+ return width;
+ }
+
+ var lastIndex = grid.renderContainers.body.visibleColumnCache.indexOf( upToCol );
+
+ // total column widths up-to but not including the passed in column
+ grid.renderContainers.body.visibleColumnCache.forEach( function( col, index ) {
+ if ( index < lastIndex ){
+ width += col.drawnWidth;
+ }
+ });
+
+ // pro-rata the final column based on % of total columns.
+ var percentage = lastIndex === 0 ? 0 : (lastIndex + 1) / grid.renderContainers.body.visibleColumnCache.length;
+ width += upToCol.drawnWidth * percentage;
+
+ return width;
+ }
+ };
+
+ return service;
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.cellNav.directive:uiCellNav
+ * @element div
+ * @restrict EA
+ *
+ * @description Adds cell navigation features to the grid columns
+ *
+ * @example
+ <example module="app">
+ <file name="app.js">
+ var app = angular.module('app', ['ui.grid', 'ui.grid.cellNav']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.data = [
+ { name: 'Bob', title: 'CEO' },
+ { name: 'Frank', title: 'Lowly Developer' }
+ ];
+
+ $scope.columnDefs = [
+ {name: 'name'},
+ {name: 'title'}
+ ];
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <div ui-grid="{ data: data, columnDefs: columnDefs }" ui-grid-cellnav></div>
+ </div>
+ </file>
+ </example>
+ */
+ module.directive('uiGridCellnav', ['gridUtil', 'uiGridCellNavService', 'uiGridCellNavConstants', 'uiGridConstants', 'GridRowColumn', '$timeout', '$compile',
+ function (gridUtil, uiGridCellNavService, uiGridCellNavConstants, uiGridConstants, GridRowColumn, $timeout, $compile) {
+ return {
+ replace: true,
+ priority: -150,
+ require: '^uiGrid',
+ scope: false,
+ controller: function () {},
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ var _scope = $scope;
+
+ var grid = uiGridCtrl.grid;
+ uiGridCellNavService.initializeGrid(grid);
+
+ uiGridCtrl.cellNav = {};
+
+ //Ensure that the object has all of the methods we expect it to
+ uiGridCtrl.cellNav.makeRowCol = function (obj) {
+ if (!(obj instanceof GridRowColumn)) {
+ obj = new GridRowColumn(obj.row, obj.col);
+ }
+ return obj;
+ };
+
+ uiGridCtrl.cellNav.getActiveCell = function () {
+ var elms = $elm[0].getElementsByClassName('ui-grid-cell-focus');
+ if (elms.length > 0){
+ return elms[0];
+ }
+
+ return undefined;
+ };
+
+ uiGridCtrl.cellNav.broadcastCellNav = grid.cellNav.broadcastCellNav = function (newRowCol, modifierDown, originEvt) {
+ modifierDown = !(modifierDown === undefined || !modifierDown);
+
+ newRowCol = uiGridCtrl.cellNav.makeRowCol(newRowCol);
+
+ uiGridCtrl.cellNav.broadcastFocus(newRowCol, modifierDown, originEvt);
+ _scope.$broadcast(uiGridCellNavConstants.CELL_NAV_EVENT, newRowCol, modifierDown, originEvt);
+ };
+
+ uiGridCtrl.cellNav.clearFocus = grid.cellNav.clearFocus = function () {
+ grid.cellNav.focusedCells = [];
+ _scope.$broadcast(uiGridCellNavConstants.CELL_NAV_EVENT);
+ };
+
+ uiGridCtrl.cellNav.broadcastFocus = function (rowCol, modifierDown, originEvt) {
+ modifierDown = !(modifierDown === undefined || !modifierDown);
+
+ rowCol = uiGridCtrl.cellNav.makeRowCol(rowCol);
+
+ var row = rowCol.row,
+ col = rowCol.col;
+
+ var rowColSelectIndex = uiGridCtrl.grid.api.cellNav.rowColSelectIndex(rowCol);
+
+ if (grid.cellNav.lastRowCol === null || rowColSelectIndex === -1) {
+ var newRowCol = new GridRowColumn(row, col);
+
+ grid.api.cellNav.raise.navigate(newRowCol, grid.cellNav.lastRowCol);
+ grid.cellNav.lastRowCol = newRowCol;
+ if (uiGridCtrl.grid.options.modifierKeysToMultiSelectCells && modifierDown) {
+ grid.cellNav.focusedCells.push(rowCol);
+ } else {
+ grid.cellNav.focusedCells = [rowCol];
+ }
+ } else if (grid.options.modifierKeysToMultiSelectCells && modifierDown &&
+ rowColSelectIndex >= 0) {
+
+ grid.cellNav.focusedCells.splice(rowColSelectIndex, 1);
+ }
+ };
+
+ uiGridCtrl.cellNav.handleKeyDown = function (evt) {
+ var direction = uiGridCellNavService.getDirection(evt);
+ if (direction === null) {
+ return null;
+ }
+
+ var containerId = 'body';
+ if (evt.uiGridTargetRenderContainerId) {
+ containerId = evt.uiGridTargetRenderContainerId;
+ }
+
+ // Get the last-focused row+col combo
+ var lastRowCol = uiGridCtrl.grid.api.cellNav.getFocusedCell();
+ if (lastRowCol) {
+ // Figure out which new row+combo we're navigating to
+ var rowCol = uiGridCtrl.grid.renderContainers[containerId].cellNav.getNextRowCol(direction, lastRowCol.row, lastRowCol.col);
+ var focusableCols = uiGridCtrl.grid.renderContainers[containerId].cellNav.getFocusableCols();
+ var rowColSelectIndex = uiGridCtrl.grid.api.cellNav.rowColSelectIndex(rowCol);
+ // Shift+tab on top-left cell should exit cellnav on render container
+ if (
+ // Navigating left
+ direction === uiGridCellNavConstants.direction.LEFT &&
+ // New col is last col (i.e. wrap around)
+ rowCol.col === focusableCols[focusableCols.length - 1] &&
+ // Staying on same row, which means we're at first row
+ rowCol.row === lastRowCol.row &&
+ evt.keyCode === uiGridConstants.keymap.TAB &&
+ evt.shiftKey
+ ) {
+ grid.cellNav.focusedCells.splice(rowColSelectIndex, 1);
+ uiGridCtrl.cellNav.clearFocus();
+ return true;
+ }
+ // Tab on bottom-right cell should exit cellnav on render container
+ else if (
+ direction === uiGridCellNavConstants.direction.RIGHT &&
+ // New col is first col (i.e. wrap around)
+ rowCol.col === focusableCols[0] &&
+ // Staying on same row, which means we're at first row
+ rowCol.row === lastRowCol.row &&
+ evt.keyCode === uiGridConstants.keymap.TAB &&
+ !evt.shiftKey
+ ) {
+ grid.cellNav.focusedCells.splice(rowColSelectIndex, 1);
+ uiGridCtrl.cellNav.clearFocus();
+ return true;
+ }
+
+ // Scroll to the new cell, if it's not completely visible within the render container's viewport
+ grid.scrollToIfNecessary(rowCol.row, rowCol.col).then(function () {
+ uiGridCtrl.cellNav.broadcastCellNav(rowCol);
+ });
+
+
+ evt.stopPropagation();
+ evt.preventDefault();
+
+ return false;
+ }
+ };
+ },
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ var _scope = $scope;
+ var grid = uiGridCtrl.grid;
+
+ function addAriaLiveRegion(){
+ // Thanks to google docs for the inspiration behind how to do this
+ // XXX: Why is this entire mess nessasary?
+ // Because browsers take a lot of coercing to get them to read out live regions
+ //http://www.paciellogroup.com/blog/2012/06/html5-accessibility-chops-aria-rolealert-browser-support/
+ var ariaNotifierDomElt = '<div ' +
+ 'id="' + grid.id +'-aria-speakable" ' +
+ 'class="ui-grid-a11y-ariascreenreader-speakable ui-grid-offscreen" ' +
+ 'aria-live="assertive" ' +
+ 'role="region" ' +
+ 'aria-atomic="true" ' +
+ 'aria-hidden="false" ' +
+ 'aria-relevant="additions" ' +
+ '>' +
+ '&nbsp;' +
+ '</div>';
+
+ var ariaNotifier = $compile(ariaNotifierDomElt)($scope);
+ $elm.prepend(ariaNotifier);
+ $scope.$on(uiGridCellNavConstants.CELL_NAV_EVENT, function (evt, rowCol, modifierDown, originEvt) {
+ /*
+ * If the cell nav event was because of a focus event then we don't want to
+ * change the notifier text.
+ * Reasoning: Voice Over fires a focus events when moving arround the grid.
+ * If the screen reader is handing the grid nav properly then we don't need to
+ * use the alert to notify the user of the movement.
+ * In all other cases we do want a notification event.
+ */
+ if (originEvt && originEvt.type === 'focus'){return;}
+
+ function setNotifyText(text){
+ if (text === ariaNotifier.text()){return;}
+ ariaNotifier[0].style.clip = 'rect(0px,0px,0px,0px)';
+ /*
+ * This is how google docs handles clearing the div. Seems to work better than setting the text of the div to ''
+ */
+ ariaNotifier[0].innerHTML = "";
+ ariaNotifier[0].style.visibility = 'hidden';
+ ariaNotifier[0].style.visibility = 'visible';
+ if (text !== ''){
+ ariaNotifier[0].style.clip = 'auto';
+ /*
+ * The space after the text is something that google docs does.
+ */
+ ariaNotifier[0].appendChild(document.createTextNode(text + " "));
+ ariaNotifier[0].style.visibility = 'hidden';
+ ariaNotifier[0].style.visibility = 'visible';
+ }
+ }
+
+ var values = [];
+ var currentSelection = grid.api.cellNav.getCurrentSelection();
+ for (var i = 0; i < currentSelection.length; i++) {
+ values.push(currentSelection[i].getIntersectionValueFiltered());
+ }
+ var cellText = values.toString();
+ setNotifyText(cellText);
+
+ });
+ }
+ addAriaLiveRegion();
+ }
+ };
+ }
+ };
+ }]);
+
+ module.directive('uiGridRenderContainer', ['$timeout', '$document', 'gridUtil', 'uiGridConstants', 'uiGridCellNavService', '$compile','uiGridCellNavConstants',
+ function ($timeout, $document, gridUtil, uiGridConstants, uiGridCellNavService, $compile, uiGridCellNavConstants) {
+ return {
+ replace: true,
+ priority: -99999, //this needs to run very last
+ require: ['^uiGrid', 'uiGridRenderContainer', '?^uiGridCellnav'],
+ scope: false,
+ compile: function () {
+ return {
+ post: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0],
+ renderContainerCtrl = controllers[1],
+ uiGridCellnavCtrl = controllers[2];
+
+ // Skip attaching cell-nav specific logic if the directive is not attached above us
+ if (!uiGridCtrl.grid.api.cellNav) { return; }
+
+ var containerId = renderContainerCtrl.containerId;
+
+ var grid = uiGridCtrl.grid;
+
+ //run each time a render container is created
+ uiGridCellNavService.decorateRenderContainers(grid);
+
+ // focusser only created for body
+ if (containerId !== 'body') {
+ return;
+ }
+
+
+
+ if (uiGridCtrl.grid.options.modifierKeysToMultiSelectCells){
+ $elm.attr('aria-multiselectable', true);
+ } else {
+ $elm.attr('aria-multiselectable', false);
+ }
+
+ //add an element with no dimensions that can be used to set focus and capture keystrokes
+ var focuser = $compile('<div class="ui-grid-focuser" role="region" aria-live="assertive" aria-atomic="false" tabindex="0" aria-controls="' + grid.id +'-aria-speakable '+ grid.id + '-grid-container' +'" aria-owns="' + grid.id + '-grid-container' + '"></div>')($scope);
+ $elm.append(focuser);
+
+ focuser.on('focus', function (evt) {
+ evt.uiGridTargetRenderContainerId = containerId;
+ var rowCol = uiGridCtrl.grid.api.cellNav.getFocusedCell();
+ if (rowCol === null) {
+ rowCol = uiGridCtrl.grid.renderContainers[containerId].cellNav.getNextRowCol(uiGridCellNavConstants.direction.DOWN, null, null);
+ if (rowCol.row && rowCol.col) {
+ uiGridCtrl.cellNav.broadcastCellNav(rowCol);
+ }
+ }
+ });
+
+ uiGridCellnavCtrl.setAriaActivedescendant = function(id){
+ $elm.attr('aria-activedescendant', id);
+ };
+
+ uiGridCellnavCtrl.removeAriaActivedescendant = function(id){
+ if ($elm.attr('aria-activedescendant') === id){
+ $elm.attr('aria-activedescendant', '');
+ }
+ };
+
+
+ uiGridCtrl.focus = function () {
+ gridUtil.focus.byElement(focuser[0]);
+ //allow for first time grid focus
+ };
+
+ var viewPortKeyDownWasRaisedForRowCol = null;
+ // Bind to keydown events in the render container
+ focuser.on('keydown', function (evt) {
+ evt.uiGridTargetRenderContainerId = containerId;
+ var rowCol = uiGridCtrl.grid.api.cellNav.getFocusedCell();
+ var result = uiGridCtrl.cellNav.handleKeyDown(evt);
+ if (result === null) {
+ uiGridCtrl.grid.api.cellNav.raise.viewPortKeyDown(evt, rowCol);
+ viewPortKeyDownWasRaisedForRowCol = rowCol;
+ }
+ });
+ //Bind to keypress events in the render container
+ //keypress events are needed by edit function so the key press
+ //that initiated an edit is not lost
+ //must fire the event in a timeout so the editor can
+ //initialize and subscribe to the event on another event loop
+ focuser.on('keypress', function (evt) {
+ if (viewPortKeyDownWasRaisedForRowCol) {
+ $timeout(function () {
+ uiGridCtrl.grid.api.cellNav.raise.viewPortKeyPress(evt, viewPortKeyDownWasRaisedForRowCol);
+ },4);
+
+ viewPortKeyDownWasRaisedForRowCol = null;
+ }
+ });
+
+ $scope.$on('$destroy', function(){
+ //Remove all event handlers associated with this focuser.
+ focuser.off();
+ });
+
+ }
+ };
+ }
+ };
+ }]);
+
+ module.directive('uiGridViewport', ['$timeout', '$document', 'gridUtil', 'uiGridConstants', 'uiGridCellNavService', 'uiGridCellNavConstants','$log','$compile',
+ function ($timeout, $document, gridUtil, uiGridConstants, uiGridCellNavService, uiGridCellNavConstants, $log, $compile) {
+ return {
+ replace: true,
+ priority: -99999, //this needs to run very last
+ require: ['^uiGrid', '^uiGridRenderContainer', '?^uiGridCellnav'],
+ scope: false,
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ },
+ post: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0],
+ renderContainerCtrl = controllers[1];
+
+ // Skip attaching cell-nav specific logic if the directive is not attached above us
+ if (!uiGridCtrl.grid.api.cellNav) { return; }
+
+ var containerId = renderContainerCtrl.containerId;
+ //no need to process for other containers
+ if (containerId !== 'body') {
+ return;
+ }
+
+ var grid = uiGridCtrl.grid;
+
+ grid.api.core.on.scrollBegin($scope, function (args) {
+
+ // Skip if there's no currently-focused cell
+ var lastRowCol = uiGridCtrl.grid.api.cellNav.getFocusedCell();
+ if (lastRowCol === null) {
+ return;
+ }
+
+ //if not in my container, move on
+ //todo: worry about horiz scroll
+ if (!renderContainerCtrl.colContainer.containsColumn(lastRowCol.col)) {
+ return;
+ }
+
+ uiGridCtrl.cellNav.clearFocus();
+
+ });
+
+ grid.api.core.on.scrollEnd($scope, function (args) {
+ // Skip if there's no currently-focused cell
+ var lastRowCol = uiGridCtrl.grid.api.cellNav.getFocusedCell();
+ if (lastRowCol === null) {
+ return;
+ }
+
+ //if not in my container, move on
+ //todo: worry about horiz scroll
+ if (!renderContainerCtrl.colContainer.containsColumn(lastRowCol.col)) {
+ return;
+ }
+
+ uiGridCtrl.cellNav.broadcastCellNav(lastRowCol);
+
+ });
+
+ grid.api.cellNav.on.navigate($scope, function () {
+ //focus again because it can be lost
+ uiGridCtrl.focus();
+ });
+
+ }
+ };
+ }
+ };
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.cellNav.directive:uiGridCell
+ * @element div
+ * @restrict A
+ * @description Stacks on top of ui.grid.uiGridCell to provide cell navigation
+ */
+ module.directive('uiGridCell', ['$timeout', '$document', 'uiGridCellNavService', 'gridUtil', 'uiGridCellNavConstants', 'uiGridConstants', 'GridRowColumn',
+ function ($timeout, $document, uiGridCellNavService, gridUtil, uiGridCellNavConstants, uiGridConstants, GridRowColumn) {
+ return {
+ priority: -150, // run after default uiGridCell directive and ui.grid.edit uiGridCell
+ restrict: 'A',
+ require: ['^uiGrid', '?^uiGridCellnav'],
+ scope: false,
+ link: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0],
+ uiGridCellnavCtrl = controllers[1];
+ // Skip attaching cell-nav specific logic if the directive is not attached above us
+ if (!uiGridCtrl.grid.api.cellNav) { return; }
+
+ if (!$scope.col.colDef.allowCellFocus) {
+ return;
+ }
+
+ //Convinience local variables
+ var grid = uiGridCtrl.grid;
+ $scope.focused = false;
+
+ // Make this cell focusable but only with javascript/a mouse click
+ $elm.attr('tabindex', -1);
+
+ // When a cell is clicked, broadcast a cellNav event saying that this row+col combo is now focused
+ $elm.find('div').on('click', function (evt) {
+ uiGridCtrl.cellNav.broadcastCellNav(new GridRowColumn($scope.row, $scope.col), evt.ctrlKey || evt.metaKey, evt);
+
+ evt.stopPropagation();
+ $scope.$apply();
+ });
+
+
+ /*
+ * XXX Hack for screen readers.
+ * This allows the grid to focus using only the screen reader cursor.
+ * Since the focus event doesn't include key press information we can't use it
+ * as our primary source of the event.
+ */
+ $elm.on('mousedown', preventMouseDown);
+
+ //turn on and off for edit events
+ if (uiGridCtrl.grid.api.edit) {
+ uiGridCtrl.grid.api.edit.on.beginCellEdit($scope, function () {
+ $elm.off('mousedown', preventMouseDown);
+ });
+
+ uiGridCtrl.grid.api.edit.on.afterCellEdit($scope, function () {
+ $elm.on('mousedown', preventMouseDown);
+ });
+
+ uiGridCtrl.grid.api.edit.on.cancelCellEdit($scope, function () {
+ $elm.on('mousedown', preventMouseDown);
+ });
+ }
+
+ function preventMouseDown(evt) {
+ //Prevents the foucus event from firing if the click event is already going to fire.
+ //If both events fire it will cause bouncing behavior.
+ evt.preventDefault();
+ }
+
+ //You can only focus on elements with a tabindex value
+ $elm.on('focus', function (evt) {
+ uiGridCtrl.cellNav.broadcastCellNav(new GridRowColumn($scope.row, $scope.col), false, evt);
+ evt.stopPropagation();
+ $scope.$apply();
+ });
+
+ // This event is fired for all cells. If the cell matches, then focus is set
+ $scope.$on(uiGridCellNavConstants.CELL_NAV_EVENT, function (evt, rowCol, modifierDown) {
+ var isFocused = grid.cellNav.focusedCells.some(function(focusedRowCol, index){
+ return (focusedRowCol.row === $scope.row && focusedRowCol.col === $scope.col);
+ });
+ if (isFocused){
+ setFocused();
+ } else {
+ clearFocus();
+ }
+ });
+
+ function setFocused() {
+ if (!$scope.focused){
+ var div = $elm.find('div');
+ div.addClass('ui-grid-cell-focus');
+ $elm.attr('aria-selected', true);
+ uiGridCellnavCtrl.setAriaActivedescendant($elm.attr('id'));
+ $scope.focused = true;
+ }
+ }
+
+ function clearFocus() {
+ if ($scope.focused){
+ var div = $elm.find('div');
+ div.removeClass('ui-grid-cell-focus');
+ $elm.attr('aria-selected', false);
+ uiGridCellnavCtrl.removeAriaActivedescendant($elm.attr('id'));
+ $scope.focused = false;
+ }
+ }
+
+ $scope.$on('$destroy', function () {
+ //.off withouth paramaters removes all handlers
+ $elm.find('div').off();
+ $elm.off();
+ });
+ }
+ };
+ }]);
+
+})();
+
+(function () {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.edit
+ * @description
+ *
+ * # ui.grid.edit
+ *
+ * <div class="alert alert-success" role="alert"><strong>Stable</strong> This feature is stable. There should no longer be breaking api changes without a deprecation warning.</div>
+ *
+ * This module provides cell editing capability to ui.grid. The goal was to emulate keying data in a spreadsheet via
+ * a keyboard.
+ * <br/>
+ * <br/>
+ * To really get the full spreadsheet-like data entry, the ui.grid.cellNav module should be used. This will allow the
+ * user to key data and then tab, arrow, or enter to the cells beside or below.
+ *
+ * <div doc-module-components="ui.grid.edit"></div>
+ */
+
+ var module = angular.module('ui.grid.edit', ['ui.grid']);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.edit.constant:uiGridEditConstants
+ *
+ * @description constants available in edit module
+ */
+ module.constant('uiGridEditConstants', {
+ EDITABLE_CELL_TEMPLATE: /EDITABLE_CELL_TEMPLATE/g,
+ //must be lowercase because template bulder converts to lower
+ EDITABLE_CELL_DIRECTIVE: /editable_cell_directive/g,
+ events: {
+ BEGIN_CELL_EDIT: 'uiGridEventBeginCellEdit',
+ END_CELL_EDIT: 'uiGridEventEndCellEdit',
+ CANCEL_CELL_EDIT: 'uiGridEventCancelCellEdit'
+ }
+ });
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.edit.service:uiGridEditService
+ *
+ * @description Services for editing features
+ */
+ module.service('uiGridEditService', ['$q', 'uiGridConstants', 'gridUtil',
+ function ($q, uiGridConstants, gridUtil) {
+
+ var service = {
+
+ initializeGrid: function (grid) {
+
+ service.defaultGridOptions(grid.options);
+
+ grid.registerColumnBuilder(service.editColumnBuilder);
+ grid.edit = {};
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.edit.api:PublicApi
+ *
+ * @description Public Api for edit feature
+ */
+ var publicApi = {
+ events: {
+ edit: {
+ /**
+ * @ngdoc event
+ * @name afterCellEdit
+ * @eventOf ui.grid.edit.api:PublicApi
+ * @description raised when cell editing is complete
+ * <pre>
+ * gridApi.edit.on.afterCellEdit(scope,function(rowEntity, colDef){})
+ * </pre>
+ * @param {object} rowEntity the options.data element that was edited
+ * @param {object} colDef the column that was edited
+ * @param {object} newValue new value
+ * @param {object} oldValue old value
+ */
+ afterCellEdit: function (rowEntity, colDef, newValue, oldValue) {
+ },
+ /**
+ * @ngdoc event
+ * @name beginCellEdit
+ * @eventOf ui.grid.edit.api:PublicApi
+ * @description raised when cell editing starts on a cell
+ * <pre>
+ * gridApi.edit.on.beginCellEdit(scope,function(rowEntity, colDef){})
+ * </pre>
+ * @param {object} rowEntity the options.data element that was edited
+ * @param {object} colDef the column that was edited
+ * @param {object} triggerEvent the event that triggered the edit. Useful to prevent losing keystrokes on some
+ * complex editors
+ */
+ beginCellEdit: function (rowEntity, colDef, triggerEvent) {
+ },
+ /**
+ * @ngdoc event
+ * @name cancelCellEdit
+ * @eventOf ui.grid.edit.api:PublicApi
+ * @description raised when cell editing is cancelled on a cell
+ * <pre>
+ * gridApi.edit.on.cancelCellEdit(scope,function(rowEntity, colDef){})
+ * </pre>
+ * @param {object} rowEntity the options.data element that was edited
+ * @param {object} colDef the column that was edited
+ */
+ cancelCellEdit: function (rowEntity, colDef) {
+ }
+ }
+ },
+ methods: {
+ edit: { }
+ }
+ };
+
+ grid.api.registerEventsFromObject(publicApi.events);
+ //grid.api.registerMethodsFromObject(publicApi.methods);
+
+ },
+
+ defaultGridOptions: function (gridOptions) {
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.edit.api:GridOptions
+ *
+ * @description Options for configuring the edit feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+
+ /**
+ * @ngdoc object
+ * @name enableCellEdit
+ * @propertyOf ui.grid.edit.api:GridOptions
+ * @description If defined, sets the default value for the editable flag on each individual colDefs
+ * if their individual enableCellEdit configuration is not defined. Defaults to undefined.
+ */
+
+ /**
+ * @ngdoc object
+ * @name cellEditableCondition
+ * @propertyOf ui.grid.edit.api:GridOptions
+ * @description If specified, either a value or function to be used by all columns before editing.
+ * If falsy, then editing of cell is not allowed.
+ * @example
+ * <pre>
+ * function($scope){
+ * //use $scope.row.entity and $scope.col.colDef to determine if editing is allowed
+ * return true;
+ * }
+ * </pre>
+ */
+ gridOptions.cellEditableCondition = gridOptions.cellEditableCondition === undefined ? true : gridOptions.cellEditableCondition;
+
+ /**
+ * @ngdoc object
+ * @name editableCellTemplate
+ * @propertyOf ui.grid.edit.api:GridOptions
+ * @description If specified, cellTemplate to use as the editor for all columns.
+ * <br/> defaults to 'ui-grid/cellTextEditor'
+ */
+
+ /**
+ * @ngdoc object
+ * @name enableCellEditOnFocus
+ * @propertyOf ui.grid.edit.api:GridOptions
+ * @description If true, then editor is invoked as soon as cell receives focus. Default false.
+ * <br/>_requires cellNav feature and the edit feature to be enabled_
+ */
+ //enableCellEditOnFocus can only be used if cellnav module is used
+ gridOptions.enableCellEditOnFocus = gridOptions.enableCellEditOnFocus === undefined ? false : gridOptions.enableCellEditOnFocus;
+ },
+
+ /**
+ * @ngdoc service
+ * @name editColumnBuilder
+ * @methodOf ui.grid.edit.service:uiGridEditService
+ * @description columnBuilder function that adds edit properties to grid column
+ * @returns {promise} promise that will load any needed templates when resolved
+ */
+ editColumnBuilder: function (colDef, col, gridOptions) {
+
+ var promises = [];
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.edit.api:ColumnDef
+ *
+ * @description Column Definition for edit feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions.columnDef gridOptions.columnDefs}
+ */
+
+ /**
+ * @ngdoc object
+ * @name enableCellEdit
+ * @propertyOf ui.grid.edit.api:ColumnDef
+ * @description enable editing on column
+ */
+ colDef.enableCellEdit = colDef.enableCellEdit === undefined ? (gridOptions.enableCellEdit === undefined ?
+ (colDef.type !== 'object') : gridOptions.enableCellEdit) : colDef.enableCellEdit;
+
+ /**
+ * @ngdoc object
+ * @name cellEditableCondition
+ * @propertyOf ui.grid.edit.api:ColumnDef
+ * @description If specified, either a value or function evaluated before editing cell. If falsy, then editing of cell is not allowed.
+ * @example
+ * <pre>
+ * function($scope){
+ * //use $scope.row.entity and $scope.col.colDef to determine if editing is allowed
+ * return true;
+ * }
+ * </pre>
+ */
+ colDef.cellEditableCondition = colDef.cellEditableCondition === undefined ? gridOptions.cellEditableCondition : colDef.cellEditableCondition;
+
+ /**
+ * @ngdoc object
+ * @name editableCellTemplate
+ * @propertyOf ui.grid.edit.api:ColumnDef
+ * @description cell template to be used when editing this column. Can be Url or text template
+ * <br/>Defaults to gridOptions.editableCellTemplate
+ */
+ if (colDef.enableCellEdit) {
+ colDef.editableCellTemplate = colDef.editableCellTemplate || gridOptions.editableCellTemplate || 'ui-grid/cellEditor';
+
+ promises.push(gridUtil.getTemplate(colDef.editableCellTemplate)
+ .then(
+ function (template) {
+ col.editableCellTemplate = template;
+ },
+ function (res) {
+ // Todo handle response error here?
+ throw new Error("Couldn't fetch/use colDef.editableCellTemplate '" + colDef.editableCellTemplate + "'");
+ }));
+ }
+
+ /**
+ * @ngdoc object
+ * @name enableCellEditOnFocus
+ * @propertyOf ui.grid.edit.api:ColumnDef
+ * @requires ui.grid.cellNav
+ * @description If true, then editor is invoked as soon as cell receives focus. Default false.
+ * <br>_requires both the cellNav feature and the edit feature to be enabled_
+ */
+ //enableCellEditOnFocus can only be used if cellnav module is used
+ colDef.enableCellEditOnFocus = colDef.enableCellEditOnFocus === undefined ? gridOptions.enableCellEditOnFocus : colDef.enableCellEditOnFocus;
+
+
+ /**
+ * @ngdoc string
+ * @name editModelField
+ * @propertyOf ui.grid.edit.api:ColumnDef
+ * @description a bindable string value that is used when binding to edit controls instead of colDef.field
+ * <br/> example: You have a complex property on and object like state:{abbrev:'MS',name:'Mississippi'}. The
+ * grid should display state.name in the cell and sort/filter based on the state.name property but the editor
+ * requires the full state object.
+ * <br/>colDef.field = 'state.name'
+ * <br/>colDef.editModelField = 'state'
+ */
+ //colDef.editModelField
+
+ return $q.all(promises);
+ },
+
+ /**
+ * @ngdoc service
+ * @name isStartEditKey
+ * @methodOf ui.grid.edit.service:uiGridEditService
+ * @description Determines if a keypress should start editing. Decorate this service to override with your
+ * own key events. See service decorator in angular docs.
+ * @param {Event} evt keydown event
+ * @returns {boolean} true if an edit should start
+ */
+ isStartEditKey: function (evt) {
+ if (evt.metaKey ||
+ evt.keyCode === uiGridConstants.keymap.ESC ||
+ evt.keyCode === uiGridConstants.keymap.SHIFT ||
+ evt.keyCode === uiGridConstants.keymap.CTRL ||
+ evt.keyCode === uiGridConstants.keymap.ALT ||
+ evt.keyCode === uiGridConstants.keymap.WIN ||
+ evt.keyCode === uiGridConstants.keymap.CAPSLOCK ||
+
+ evt.keyCode === uiGridConstants.keymap.LEFT ||
+ (evt.keyCode === uiGridConstants.keymap.TAB && evt.shiftKey) ||
+
+ evt.keyCode === uiGridConstants.keymap.RIGHT ||
+ evt.keyCode === uiGridConstants.keymap.TAB ||
+
+ evt.keyCode === uiGridConstants.keymap.UP ||
+ (evt.keyCode === uiGridConstants.keymap.ENTER && evt.shiftKey) ||
+
+ evt.keyCode === uiGridConstants.keymap.DOWN ||
+ evt.keyCode === uiGridConstants.keymap.ENTER) {
+ return false;
+
+ }
+ return true;
+ }
+
+
+ };
+
+ return service;
+
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.edit.directive:uiGridEdit
+ * @element div
+ * @restrict A
+ *
+ * @description Adds editing features to the ui-grid directive.
+ *
+ * @example
+ <example module="app">
+ <file name="app.js">
+ var app = angular.module('app', ['ui.grid', 'ui.grid.edit']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.data = [
+ { name: 'Bob', title: 'CEO' },
+ { name: 'Frank', title: 'Lowly Developer' }
+ ];
+
+ $scope.columnDefs = [
+ {name: 'name', enableCellEdit: true},
+ {name: 'title', enableCellEdit: true}
+ ];
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <div ui-grid="{ data: data, columnDefs: columnDefs }" ui-grid-edit></div>
+ </div>
+ </file>
+ </example>
+ */
+ module.directive('uiGridEdit', ['gridUtil', 'uiGridEditService', function (gridUtil, uiGridEditService) {
+ return {
+ replace: true,
+ priority: 0,
+ require: '^uiGrid',
+ scope: false,
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ uiGridEditService.initializeGrid(uiGridCtrl.grid);
+ },
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ }
+ };
+ }
+ };
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.edit.directive:uiGridRenderContainer
+ * @element div
+ * @restrict A
+ *
+ * @description Adds keydown listeners to renderContainer element so we can capture when to begin edits
+ *
+ */
+ module.directive('uiGridViewport', [ 'uiGridEditConstants',
+ function ( uiGridEditConstants) {
+ return {
+ replace: true,
+ priority: -99998, //run before cellNav
+ require: ['^uiGrid', '^uiGridRenderContainer'],
+ scope: false,
+ compile: function () {
+ return {
+ post: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0];
+
+ // Skip attaching if edit and cellNav is not enabled
+ if (!uiGridCtrl.grid.api.edit || !uiGridCtrl.grid.api.cellNav) { return; }
+
+ var containerId = controllers[1].containerId;
+ //no need to process for other containers
+ if (containerId !== 'body') {
+ return;
+ }
+
+ //refocus on the grid
+ $scope.$on(uiGridEditConstants.events.CANCEL_CELL_EDIT, function () {
+ uiGridCtrl.focus();
+ });
+ $scope.$on(uiGridEditConstants.events.END_CELL_EDIT, function () {
+ uiGridCtrl.focus();
+ });
+
+ }
+ };
+ }
+ };
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.edit.directive:uiGridCell
+ * @element div
+ * @restrict A
+ *
+ * @description Stacks on top of ui.grid.uiGridCell to provide in-line editing capabilities to the cell
+ * Editing Actions.
+ *
+ * Binds edit start events to the uiGridCell element. When the events fire, the gridCell element is appended
+ * with the columnDef.editableCellTemplate element ('cellEditor.html' by default).
+ *
+ * The editableCellTemplate should respond to uiGridEditConstants.events.BEGIN\_CELL\_EDIT angular event
+ * and do the initial steps needed to edit the cell (setfocus on input element, etc).
+ *
+ * When the editableCellTemplate recognizes that the editing is ended (blur event, Enter key, etc.)
+ * it should emit the uiGridEditConstants.events.END\_CELL\_EDIT event.
+ *
+ * If editableCellTemplate recognizes that the editing has been cancelled (esc key)
+ * it should emit the uiGridEditConstants.events.CANCEL\_CELL\_EDIT event. The original value
+ * will be set back on the model by the uiGridCell directive.
+ *
+ * Events that invoke editing:
+ * - dblclick
+ * - F2 keydown (when using cell selection)
+ *
+ * Events that end editing:
+ * - Dependent on the specific editableCellTemplate
+ * - Standards should be blur and enter keydown
+ *
+ * Events that cancel editing:
+ * - Dependent on the specific editableCellTemplate
+ * - Standards should be Esc keydown
+ *
+ * Grid Events that end editing:
+ * - uiGridConstants.events.GRID_SCROLL
+ *
+ */
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.edit.api:GridRow
+ *
+ * @description GridRow options for edit feature, these are available to be
+ * set internally only, by other features
+ */
+
+ /**
+ * @ngdoc object
+ * @name enableCellEdit
+ * @propertyOf ui.grid.edit.api:GridRow
+ * @description enable editing on row, grouping for example might disable editing on group header rows
+ */
+
+ module.directive('uiGridCell',
+ ['$compile', '$injector', '$timeout', 'uiGridConstants', 'uiGridEditConstants', 'gridUtil', '$parse', 'uiGridEditService', '$rootScope',
+ function ($compile, $injector, $timeout, uiGridConstants, uiGridEditConstants, gridUtil, $parse, uiGridEditService, $rootScope) {
+ var touchstartTimeout = 500;
+ if ($injector.has('uiGridCellNavService')) {
+ var uiGridCellNavService = $injector.get('uiGridCellNavService');
+ }
+
+ return {
+ priority: -100, // run after default uiGridCell directive
+ restrict: 'A',
+ scope: false,
+ require: '?^uiGrid',
+ link: function ($scope, $elm, $attrs, uiGridCtrl) {
+ var html;
+ var origCellValue;
+ var inEdit = false;
+ var cellModel;
+ var cancelTouchstartTimeout;
+
+ var editCellScope;
+
+ if (!$scope.col.colDef.enableCellEdit) {
+ return;
+ }
+
+ var cellNavNavigateDereg = function() {};
+ var viewPortKeyDownDereg = function() {};
+
+
+ var setEditable = function() {
+ if ($scope.col.colDef.enableCellEdit && $scope.row.enableCellEdit !== false) {
+ if (!$scope.beginEditEventsWired) { //prevent multiple attachments
+ registerBeginEditEvents();
+ }
+ } else {
+ if ($scope.beginEditEventsWired) {
+ cancelBeginEditEvents();
+ }
+ }
+ };
+
+ setEditable();
+
+ var rowWatchDereg = $scope.$watch('row', function (n, o) {
+ if (n !== o) {
+ setEditable();
+ }
+ });
+
+
+ $scope.$on( '$destroy', rowWatchDereg );
+
+ function registerBeginEditEvents() {
+ $elm.on('dblclick', beginEdit);
+
+ // Add touchstart handling. If the users starts a touch and it doesn't end after X milliseconds, then start the edit
+ $elm.on('touchstart', touchStart);
+
+ if (uiGridCtrl && uiGridCtrl.grid.api.cellNav) {
+
+ viewPortKeyDownDereg = uiGridCtrl.grid.api.cellNav.on.viewPortKeyDown($scope, function (evt, rowCol) {
+ if (rowCol === null) {
+ return;
+ }
+
+ if (rowCol.row === $scope.row && rowCol.col === $scope.col && !$scope.col.colDef.enableCellEditOnFocus) {
+ //important to do this before scrollToIfNecessary
+ beginEditKeyDown(evt);
+ }
+ });
+
+ cellNavNavigateDereg = uiGridCtrl.grid.api.cellNav.on.navigate($scope, function (newRowCol, oldRowCol) {
+ if ($scope.col.colDef.enableCellEditOnFocus) {
+ // Don't begin edit if the cell hasn't changed
+ if ((!oldRowCol || newRowCol.row !== oldRowCol.row || newRowCol.col !== oldRowCol.col) &&
+ newRowCol.row === $scope.row && newRowCol.col === $scope.col) {
+ $timeout(function () {
+ beginEdit();
+ });
+ }
+ }
+ });
+ }
+
+ $scope.beginEditEventsWired = true;
+
+ }
+
+ function touchStart(event) {
+ // jQuery masks events
+ if (typeof(event.originalEvent) !== 'undefined' && event.originalEvent !== undefined) {
+ event = event.originalEvent;
+ }
+
+ // Bind touchend handler
+ $elm.on('touchend', touchEnd);
+
+ // Start a timeout
+ cancelTouchstartTimeout = $timeout(function() { }, touchstartTimeout);
+
+ // Timeout's done! Start the edit
+ cancelTouchstartTimeout.then(function () {
+ // Use setTimeout to start the edit because beginEdit expects to be outside of $digest
+ setTimeout(beginEdit, 0);
+
+ // Undbind the touchend handler, we don't need it anymore
+ $elm.off('touchend', touchEnd);
+ });
+ }
+
+ // Cancel any touchstart timeout
+ function touchEnd(event) {
+ $timeout.cancel(cancelTouchstartTimeout);
+ $elm.off('touchend', touchEnd);
+ }
+
+ function cancelBeginEditEvents() {
+ $elm.off('dblclick', beginEdit);
+ $elm.off('keydown', beginEditKeyDown);
+ $elm.off('touchstart', touchStart);
+ cellNavNavigateDereg();
+ viewPortKeyDownDereg();
+ $scope.beginEditEventsWired = false;
+ }
+
+ function beginEditKeyDown(evt) {
+ if (uiGridEditService.isStartEditKey(evt)) {
+ beginEdit(evt);
+ }
+ }
+
+ function shouldEdit(col, row) {
+ return !row.isSaving &&
+ ( angular.isFunction(col.colDef.cellEditableCondition) ?
+ col.colDef.cellEditableCondition($scope) :
+ col.colDef.cellEditableCondition );
+ }
+
+
+ function beginEdit(triggerEvent) {
+ //we need to scroll the cell into focus before invoking the editor
+ $scope.grid.api.core.scrollToIfNecessary($scope.row, $scope.col)
+ .then(function () {
+ beginEditAfterScroll(triggerEvent);
+ });
+ }
+
+ /**
+ * @ngdoc property
+ * @name editDropdownOptionsArray
+ * @propertyOf ui.grid.edit.api:ColumnDef
+ * @description an array of values in the format
+ * [ {id: xxx, value: xxx} ], which is populated
+ * into the edit dropdown
+ *
+ */
+ /**
+ * @ngdoc property
+ * @name editDropdownIdLabel
+ * @propertyOf ui.grid.edit.api:ColumnDef
+ * @description the label for the "id" field
+ * in the editDropdownOptionsArray. Defaults
+ * to 'id'
+ * @example
+ * <pre>
+ * $scope.gridOptions = {
+ * columnDefs: [
+ * {name: 'status', editableCellTemplate: 'ui-grid/dropdownEditor',
+ * editDropdownOptionsArray: [{code: 1, status: 'active'}, {code: 2, status: 'inactive'}],
+ * editDropdownIdLabel: 'code', editDropdownValueLabel: 'status' }
+ * ],
+ * </pre>
+ *
+ */
+ /**
+ * @ngdoc property
+ * @name editDropdownRowEntityOptionsArrayPath
+ * @propertyOf ui.grid.edit.api:ColumnDef
+ * @description a path to a property on row.entity containing an
+ * array of values in the format
+ * [ {id: xxx, value: xxx} ], which will be used to populate
+ * the edit dropdown. This can be used when the dropdown values are dependent on
+ * the backing row entity.
+ * If this property is set then editDropdownOptionsArray will be ignored.
+ * @example
+ * <pre>
+ * $scope.gridOptions = {
+ * columnDefs: [
+ * {name: 'status', editableCellTemplate: 'ui-grid/dropdownEditor',
+ * editDropdownRowEntityOptionsArrayPath: 'foo.bars[0].baz',
+ * editDropdownIdLabel: 'code', editDropdownValueLabel: 'status' }
+ * ],
+ * </pre>
+ *
+ */
+ /**
+ * @ngdoc property
+ * @name editDropdownValueLabel
+ * @propertyOf ui.grid.edit.api:ColumnDef
+ * @description the label for the "value" field
+ * in the editDropdownOptionsArray. Defaults
+ * to 'value'
+ * @example
+ * <pre>
+ * $scope.gridOptions = {
+ * columnDefs: [
+ * {name: 'status', editableCellTemplate: 'ui-grid/dropdownEditor',
+ * editDropdownOptionsArray: [{code: 1, status: 'active'}, {code: 2, status: 'inactive'}],
+ * editDropdownIdLabel: 'code', editDropdownValueLabel: 'status' }
+ * ],
+ * </pre>
+ *
+ */
+ /**
+ * @ngdoc property
+ * @name editDropdownFilter
+ * @propertyOf ui.grid.edit.api:ColumnDef
+ * @description A filter that you would like to apply to the values in the options list
+ * of the dropdown. For example if you were using angular-translate you might set this
+ * to `'translate'`
+ * @example
+ * <pre>
+ * $scope.gridOptions = {
+ * columnDefs: [
+ * {name: 'status', editableCellTemplate: 'ui-grid/dropdownEditor',
+ * editDropdownOptionsArray: [{code: 1, status: 'active'}, {code: 2, status: 'inactive'}],
+ * editDropdownIdLabel: 'code', editDropdownValueLabel: 'status', editDropdownFilter: 'translate' }
+ * ],
+ * </pre>
+ *
+ */
+ function beginEditAfterScroll(triggerEvent) {
+ // If we are already editing, then just skip this so we don't try editing twice...
+ if (inEdit) {
+ return;
+ }
+
+ if (!shouldEdit($scope.col, $scope.row)) {
+ return;
+ }
+
+
+ cellModel = $parse($scope.row.getQualifiedColField($scope.col));
+ //get original value from the cell
+ origCellValue = cellModel($scope);
+
+ html = $scope.col.editableCellTemplate;
+
+ if ($scope.col.colDef.editModelField) {
+ html = html.replace(uiGridConstants.MODEL_COL_FIELD, gridUtil.preEval('row.entity.' + $scope.col.colDef.editModelField));
+ }
+ else {
+ html = html.replace(uiGridConstants.MODEL_COL_FIELD, $scope.row.getQualifiedColField($scope.col));
+ }
+
+ html = html.replace(uiGridConstants.COL_FIELD, 'grid.getCellValue(row, col)');
+
+ var optionFilter = $scope.col.colDef.editDropdownFilter ? '|' + $scope.col.colDef.editDropdownFilter : '';
+ html = html.replace(uiGridConstants.CUSTOM_FILTERS, optionFilter);
+
+ var inputType = 'text';
+ switch ($scope.col.colDef.type){
+ case 'boolean':
+ inputType = 'checkbox';
+ break;
+ case 'number':
+ inputType = 'number';
+ break;
+ case 'date':
+ inputType = 'date';
+ break;
+ }
+ html = html.replace('INPUT_TYPE', inputType);
+
+ var editDropdownRowEntityOptionsArrayPath = $scope.col.colDef.editDropdownRowEntityOptionsArrayPath;
+ if (editDropdownRowEntityOptionsArrayPath) {
+ $scope.editDropdownOptionsArray = resolveObjectFromPath($scope.row.entity, editDropdownRowEntityOptionsArrayPath);
+ }
+ else {
+ $scope.editDropdownOptionsArray = $scope.col.colDef.editDropdownOptionsArray;
+ }
+ $scope.editDropdownIdLabel = $scope.col.colDef.editDropdownIdLabel ? $scope.col.colDef.editDropdownIdLabel : 'id';
+ $scope.editDropdownValueLabel = $scope.col.colDef.editDropdownValueLabel ? $scope.col.colDef.editDropdownValueLabel : 'value';
+
+ var cellElement;
+ var createEditor = function(){
+ inEdit = true;
+ cancelBeginEditEvents();
+ var cellElement = angular.element(html);
+ $elm.append(cellElement);
+ editCellScope = $scope.$new();
+ $compile(cellElement)(editCellScope);
+ var gridCellContentsEl = angular.element($elm.children()[0]);
+ gridCellContentsEl.addClass('ui-grid-cell-contents-hidden');
+ };
+ if (!$rootScope.$$phase) {
+ $scope.$apply(createEditor);
+ } else {
+ createEditor();
+ }
+
+ //stop editing when grid is scrolled
+ var deregOnGridScroll = $scope.col.grid.api.core.on.scrollBegin($scope, function () {
+ if ($scope.grid.disableScrolling) {
+ return;
+ }
+ endEdit();
+ $scope.grid.api.edit.raise.afterCellEdit($scope.row.entity, $scope.col.colDef, cellModel($scope), origCellValue);
+ deregOnGridScroll();
+ deregOnEndCellEdit();
+ deregOnCancelCellEdit();
+ });
+
+ //end editing
+ var deregOnEndCellEdit = $scope.$on(uiGridEditConstants.events.END_CELL_EDIT, function () {
+ endEdit();
+ $scope.grid.api.edit.raise.afterCellEdit($scope.row.entity, $scope.col.colDef, cellModel($scope), origCellValue);
+ deregOnEndCellEdit();
+ deregOnGridScroll();
+ deregOnCancelCellEdit();
+ });
+
+ //cancel editing
+ var deregOnCancelCellEdit = $scope.$on(uiGridEditConstants.events.CANCEL_CELL_EDIT, function () {
+ cancelEdit();
+ deregOnCancelCellEdit();
+ deregOnGridScroll();
+ deregOnEndCellEdit();
+ });
+
+ $scope.$broadcast(uiGridEditConstants.events.BEGIN_CELL_EDIT, triggerEvent);
+ $timeout(function () {
+ //execute in a timeout to give any complex editor templates a cycle to completely render
+ $scope.grid.api.edit.raise.beginCellEdit($scope.row.entity, $scope.col.colDef, triggerEvent);
+ });
+ }
+
+ function endEdit() {
+ $scope.grid.disableScrolling = false;
+ if (!inEdit) {
+ return;
+ }
+
+ //sometimes the events can't keep up with the keyboard and grid focus is lost, so always focus
+ //back to grid here. The focus call needs to be before the $destroy and removal of the control,
+ //otherwise ng-model-options of UpdateOn: 'blur' will not work.
+ if (uiGridCtrl && uiGridCtrl.grid.api.cellNav) {
+ uiGridCtrl.focus();
+ }
+
+ var gridCellContentsEl = angular.element($elm.children()[0]);
+ //remove edit element
+ editCellScope.$destroy();
+ angular.element($elm.children()[1]).remove();
+ gridCellContentsEl.removeClass('ui-grid-cell-contents-hidden');
+ inEdit = false;
+ registerBeginEditEvents();
+ $scope.grid.api.core.notifyDataChange( uiGridConstants.dataChange.EDIT );
+ }
+
+ function cancelEdit() {
+ $scope.grid.disableScrolling = false;
+ if (!inEdit) {
+ return;
+ }
+ cellModel.assign($scope, origCellValue);
+ $scope.$apply();
+
+ $scope.grid.api.edit.raise.cancelCellEdit($scope.row.entity, $scope.col.colDef);
+ endEdit();
+ }
+
+ // resolves a string path against the given object
+ // shamelessly borrowed from
+ // http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key
+ function resolveObjectFromPath(object, path) {
+ path = path.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
+ path = path.replace(/^\./, ''); // strip a leading dot
+ var a = path.split('.');
+ while (a.length) {
+ var n = a.shift();
+ if (n in object) {
+ object = object[n];
+ } else {
+ return;
+ }
+ }
+ return object;
+ }
+
+ }
+ };
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.edit.directive:uiGridEditor
+ * @element div
+ * @restrict A
+ *
+ * @description input editor directive for editable fields.
+ * Provides EndEdit and CancelEdit events
+ *
+ * Events that end editing:
+ * blur and enter keydown
+ *
+ * Events that cancel editing:
+ * - Esc keydown
+ *
+ */
+ module.directive('uiGridEditor',
+ ['gridUtil', 'uiGridConstants', 'uiGridEditConstants','$timeout', 'uiGridEditService',
+ function (gridUtil, uiGridConstants, uiGridEditConstants, $timeout, uiGridEditService) {
+ return {
+ scope: true,
+ require: ['?^uiGrid', '?^uiGridRenderContainer', 'ngModel'],
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs) {
+
+ },
+ post: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl, renderContainerCtrl, ngModel;
+ if (controllers[0]) { uiGridCtrl = controllers[0]; }
+ if (controllers[1]) { renderContainerCtrl = controllers[1]; }
+ if (controllers[2]) { ngModel = controllers[2]; }
+
+ //set focus at start of edit
+ $scope.$on(uiGridEditConstants.events.BEGIN_CELL_EDIT, function (evt,triggerEvent) {
+ $timeout(function () {
+ $elm[0].focus();
+ //only select text if it is not being replaced below in the cellNav viewPortKeyPress
+ if ($scope.col.colDef.enableCellEditOnFocus || !(uiGridCtrl && uiGridCtrl.grid.api.cellNav)) {
+ $elm[0].select();
+ }
+ else {
+ //some browsers (Chrome) stupidly, imo, support the w3 standard that number, email, ...
+ //fields should not allow setSelectionRange. We ignore the error for those browsers
+ //https://www.w3.org/Bugs/Public/show_bug.cgi?id=24796
+ try {
+ $elm[0].setSelectionRange($elm[0].value.length, $elm[0].value.length);
+ }
+ catch (ex) {
+ //ignore
+ }
+ }
+ });
+
+ //set the keystroke that started the edit event
+ //we must do this because the BeginEdit is done in a different event loop than the intitial
+ //keydown event
+ //fire this event for the keypress that is received
+ if (uiGridCtrl && uiGridCtrl.grid.api.cellNav) {
+ var viewPortKeyDownUnregister = uiGridCtrl.grid.api.cellNav.on.viewPortKeyPress($scope, function (evt, rowCol) {
+ if (uiGridEditService.isStartEditKey(evt)) {
+ ngModel.$setViewValue(String.fromCharCode(evt.keyCode), evt);
+ ngModel.$render();
+ }
+ viewPortKeyDownUnregister();
+ });
+ }
+
+ $elm.on('blur', function (evt) {
+ $scope.stopEdit(evt);
+ });
+ });
+
+
+ $scope.deepEdit = false;
+
+ $scope.stopEdit = function (evt) {
+ if ($scope.inputForm && !$scope.inputForm.$valid) {
+ evt.stopPropagation();
+ $scope.$emit(uiGridEditConstants.events.CANCEL_CELL_EDIT);
+ }
+ else {
+ $scope.$emit(uiGridEditConstants.events.END_CELL_EDIT);
+ }
+ $scope.deepEdit = false;
+ };
+
+
+ $elm.on('click', function (evt) {
+ if ($elm[0].type !== 'checkbox') {
+ $scope.deepEdit = true;
+ $timeout(function () {
+ $scope.grid.disableScrolling = true;
+ });
+ }
+ });
+
+ $elm.on('keydown', function (evt) {
+ switch (evt.keyCode) {
+ case uiGridConstants.keymap.ESC:
+ evt.stopPropagation();
+ $scope.$emit(uiGridEditConstants.events.CANCEL_CELL_EDIT);
+ break;
+ }
+
+ if ($scope.deepEdit &&
+ (evt.keyCode === uiGridConstants.keymap.LEFT ||
+ evt.keyCode === uiGridConstants.keymap.RIGHT ||
+ evt.keyCode === uiGridConstants.keymap.UP ||
+ evt.keyCode === uiGridConstants.keymap.DOWN)) {
+ evt.stopPropagation();
+ }
+ // Pass the keydown event off to the cellNav service, if it exists
+ else if (uiGridCtrl && uiGridCtrl.grid.api.cellNav) {
+ evt.uiGridTargetRenderContainerId = renderContainerCtrl.containerId;
+ if (uiGridCtrl.cellNav.handleKeyDown(evt) !== null) {
+ $scope.stopEdit(evt);
+ }
+ }
+ else {
+ //handle enter and tab for editing not using cellNav
+ switch (evt.keyCode) {
+ case uiGridConstants.keymap.ENTER: // Enter (Leave Field)
+ case uiGridConstants.keymap.TAB:
+ evt.stopPropagation();
+ evt.preventDefault();
+ $scope.stopEdit(evt);
+ break;
+ }
+ }
+
+ return true;
+ });
+ }
+ };
+ }
+ };
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.edit.directive:input
+ * @element input
+ * @restrict E
+ *
+ * @description directive to provide binding between input[date] value and ng-model for angular 1.2
+ * It is similar to input[date] directive of angular 1.3
+ *
+ * Supported date format for input is 'yyyy-MM-dd'
+ * The directive will set the $valid property of input element and the enclosing form to false if
+ * model is invalid date or value of input is entered wrong.
+ *
+ */
+ module.directive('uiGridEditor', ['$filter', function ($filter) {
+ function parseDateString(dateString) {
+ if (typeof(dateString) === 'undefined' || dateString === '') {
+ return null;
+ }
+ var parts = dateString.split('-');
+ if (parts.length !== 3) {
+ return null;
+ }
+ var year = parseInt(parts[0], 10);
+ var month = parseInt(parts[1], 10);
+ var day = parseInt(parts[2], 10);
+
+ if (month < 1 || year < 1 || day < 1) {
+ return null;
+ }
+ return new Date(year, (month - 1), day);
+ }
+ return {
+ priority: -100, // run after default uiGridEditor directive
+ require: '?ngModel',
+ link: function (scope, element, attrs, ngModel) {
+
+ if (angular.version.minor === 2 && attrs.type && attrs.type === 'date' && ngModel) {
+
+ ngModel.$formatters.push(function (modelValue) {
+ ngModel.$setValidity(null,(!modelValue || !isNaN(modelValue.getTime())));
+ return $filter('date')(modelValue, 'yyyy-MM-dd');
+ });
+
+ ngModel.$parsers.push(function (viewValue) {
+ if (viewValue && viewValue.length > 0) {
+ var dateValue = parseDateString(viewValue);
+ ngModel.$setValidity(null, (dateValue && !isNaN(dateValue.getTime())));
+ return dateValue;
+ }
+ else {
+ ngModel.$setValidity(null, true);
+ return null;
+ }
+ });
+ }
+ }
+ };
+ }]);
+
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.edit.directive:uiGridEditDropdown
+ * @element div
+ * @restrict A
+ *
+ * @description dropdown editor for editable fields.
+ * Provides EndEdit and CancelEdit events
+ *
+ * Events that end editing:
+ * blur and enter keydown, and any left/right nav
+ *
+ * Events that cancel editing:
+ * - Esc keydown
+ *
+ */
+ module.directive('uiGridEditDropdown',
+ ['uiGridConstants', 'uiGridEditConstants',
+ function (uiGridConstants, uiGridEditConstants) {
+ return {
+ require: ['?^uiGrid', '?^uiGridRenderContainer'],
+ scope: true,
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs) {
+
+ },
+ post: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl = controllers[0];
+ var renderContainerCtrl = controllers[1];
+
+ //set focus at start of edit
+ $scope.$on(uiGridEditConstants.events.BEGIN_CELL_EDIT, function () {
+ $elm[0].focus();
+ $elm[0].style.width = ($elm[0].parentElement.offsetWidth - 1) + 'px';
+ $elm.on('blur', function (evt) {
+ $scope.stopEdit(evt);
+ });
+ });
+
+
+ $scope.stopEdit = function (evt) {
+ // no need to validate a dropdown - invalid values shouldn't be
+ // available in the list
+ $scope.$emit(uiGridEditConstants.events.END_CELL_EDIT);
+ };
+
+ $elm.on('keydown', function (evt) {
+ switch (evt.keyCode) {
+ case uiGridConstants.keymap.ESC:
+ evt.stopPropagation();
+ $scope.$emit(uiGridEditConstants.events.CANCEL_CELL_EDIT);
+ break;
+ }
+ if (uiGridCtrl && uiGridCtrl.grid.api.cellNav) {
+ evt.uiGridTargetRenderContainerId = renderContainerCtrl.containerId;
+ if (uiGridCtrl.cellNav.handleKeyDown(evt) !== null) {
+ $scope.stopEdit(evt);
+ }
+ }
+ else {
+ //handle enter and tab for editing not using cellNav
+ switch (evt.keyCode) {
+ case uiGridConstants.keymap.ENTER: // Enter (Leave Field)
+ case uiGridConstants.keymap.TAB:
+ evt.stopPropagation();
+ evt.preventDefault();
+ $scope.stopEdit(evt);
+ break;
+ }
+ }
+ return true;
+ });
+ }
+ };
+ }
+ };
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.edit.directive:uiGridEditFileChooser
+ * @element div
+ * @restrict A
+ *
+ * @description input editor directive for editable fields.
+ * Provides EndEdit and CancelEdit events
+ *
+ * Events that end editing:
+ * blur and enter keydown
+ *
+ * Events that cancel editing:
+ * - Esc keydown
+ *
+ */
+ module.directive('uiGridEditFileChooser',
+ ['gridUtil', 'uiGridConstants', 'uiGridEditConstants','$timeout',
+ function (gridUtil, uiGridConstants, uiGridEditConstants, $timeout) {
+ return {
+ scope: true,
+ require: ['?^uiGrid', '?^uiGridRenderContainer'],
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs) {
+
+ },
+ post: function ($scope, $elm, $attrs, controllers) {
+ var uiGridCtrl, renderContainerCtrl;
+ if (controllers[0]) { uiGridCtrl = controllers[0]; }
+ if (controllers[1]) { renderContainerCtrl = controllers[1]; }
+ var grid = uiGridCtrl.grid;
+
+ var handleFileSelect = function( event ){
+ var target = event.srcElement || event.target;
+
+ if (target && target.files && target.files.length > 0) {
+ /**
+ * @ngdoc property
+ * @name editFileChooserCallback
+ * @propertyOf ui.grid.edit.api:ColumnDef
+ * @description A function that should be called when any files have been chosen
+ * by the user. You should use this to process the files appropriately for your
+ * application.
+ *
+ * It passes the gridCol, the gridRow (from which you can get gridRow.entity),
+ * and the files. The files are in the format as returned from the file chooser,
+ * an array of files, with each having useful information such as:
+ * - `files[0].lastModifiedDate`
+ * - `files[0].name`
+ * - `files[0].size` (appears to be in bytes)
+ * - `files[0].type` (MIME type by the looks)
+ *
+ * Typically you would do something with these files - most commonly you would
+ * use the filename or read the file itself in. The example function does both.
+ *
+ * @example
+ * <pre>
+ * editFileChooserCallBack: function(gridRow, gridCol, files ){
+ * // ignore all but the first file, it can only choose one anyway
+ * // set the filename into this column
+ * gridRow.entity.filename = file[0].name;
+ *
+ * // read the file and set it into a hidden column, which we may do stuff with later
+ * var setFile = function(fileContent){
+ * gridRow.entity.file = fileContent.currentTarget.result;
+ * };
+ * var reader = new FileReader();
+ * reader.onload = setFile;
+ * reader.readAsText( files[0] );
+ * }
+ * </pre>
+ */
+ if ( typeof($scope.col.colDef.editFileChooserCallback) === 'function' ) {
+ $scope.col.colDef.editFileChooserCallback($scope.row, $scope.col, target.files);
+ } else {
+ gridUtil.logError('You need to set colDef.editFileChooserCallback to use the file chooser');
+ }
+
+ target.form.reset();
+ $scope.$emit(uiGridEditConstants.events.END_CELL_EDIT);
+ } else {
+ $scope.$emit(uiGridEditConstants.events.CANCEL_CELL_EDIT);
+ }
+ };
+
+ $elm[0].addEventListener('change', handleFileSelect, false); // TODO: why the false on the end? Google
+
+ $scope.$on(uiGridEditConstants.events.BEGIN_CELL_EDIT, function () {
+ $elm[0].focus();
+ $elm[0].select();
+
+ $elm.on('blur', function (evt) {
+ $scope.$emit(uiGridEditConstants.events.END_CELL_EDIT);
+ });
+ });
+ }
+ };
+ }
+ };
+ }]);
+
+
+})();
+
+(function () {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.expandable
+ * @description
+ *
+ * # ui.grid.expandable
+ *
+ * <div class="alert alert-warning" role="alert"><strong>Alpha</strong> This feature is in development. There will almost certainly be breaking api changes, or there are major outstanding bugs.</div>
+ *
+ * This module provides the ability to create subgrids with the ability to expand a row
+ * to show the subgrid.
+ *
+ * <div doc-module-components="ui.grid.expandable"></div>
+ */
+ var module = angular.module('ui.grid.expandable', ['ui.grid']);
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.expandable.service:uiGridExpandableService
+ *
+ * @description Services for the expandable grid
+ */
+ module.service('uiGridExpandableService', ['gridUtil', '$compile', function (gridUtil, $compile) {
+ var service = {
+ initializeGrid: function (grid) {
+
+ grid.expandable = {};
+ grid.expandable.expandedAll = false;
+
+ /**
+ * @ngdoc object
+ * @name enableExpandable
+ * @propertyOf ui.grid.expandable.api:GridOptions
+ * @description Whether or not to use expandable feature, allows you to turn off expandable on specific grids
+ * within your application, or in specific modes on _this_ grid. Defaults to true.
+ * @example
+ * <pre>
+ * $scope.gridOptions = {
+ * enableExpandable: false
+ * }
+ * </pre>
+ */
+ grid.options.enableExpandable = grid.options.enableExpandable !== false;
+
+ /**
+ * @ngdoc object
+ * @name expandableRowHeight
+ * @propertyOf ui.grid.expandable.api:GridOptions
+ * @description Height in pixels of the expanded subgrid. Defaults to
+ * 150
+ * @example
+ * <pre>
+ * $scope.gridOptions = {
+ * expandableRowHeight: 150
+ * }
+ * </pre>
+ */
+ grid.options.expandableRowHeight = grid.options.expandableRowHeight || 150;
+
+ /**
+ * @ngdoc object
+ * @name
+ * @propertyOf ui.grid.expandable.api:GridOptions
+ * @description Width in pixels of the expandable column. Defaults to 40
+ * @example
+ * <pre>
+ * $scope.gridOptions = {
+ * expandableRowHeaderWidth: 40
+ * }
+ * </pre>
+ */
+ grid.options.expandableRowHeaderWidth = grid.options.expandableRowHeaderWidth || 40;
+
+ /**
+ * @ngdoc object
+ * @name expandableRowTemplate
+ * @propertyOf ui.grid.expandable.api:GridOptions
+ * @description Mandatory. The template for your expanded row
+ * @example
+ * <pre>
+ * $scope.gridOptions = {
+ * expandableRowTemplate: 'expandableRowTemplate.html'
+ * }
+ * </pre>
+ */
+ if ( grid.options.enableExpandable && !grid.options.expandableRowTemplate ){
+ gridUtil.logError( 'You have not set the expandableRowTemplate, disabling expandable module' );
+ grid.options.enableExpandable = false;
+ }
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.expandable.api:PublicApi
+ *
+ * @description Public Api for expandable feature
+ */
+ /**
+ * @ngdoc object
+ * @name ui.grid.expandable.api:GridOptions
+ *
+ * @description Options for configuring the expandable feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+ var publicApi = {
+ events: {
+ expandable: {
+ /**
+ * @ngdoc event
+ * @name rowExpandedStateChanged
+ * @eventOf ui.grid.expandable.api:PublicApi
+ * @description raised when cell editing is complete
+ * <pre>
+ * gridApi.expandable.on.rowExpandedStateChanged(scope,function(row){})
+ * </pre>
+ * @param {GridRow} row the row that was expanded
+ */
+ rowExpandedBeforeStateChanged: function(scope,row){
+ },
+ rowExpandedStateChanged: function (scope, row) {
+ }
+ }
+ },
+
+ methods: {
+ expandable: {
+ /**
+ * @ngdoc method
+ * @name toggleRowExpansion
+ * @methodOf ui.grid.expandable.api:PublicApi
+ * @description Toggle a specific row
+ * <pre>
+ * gridApi.expandable.toggleRowExpansion(rowEntity);
+ * </pre>
+ * @param {object} rowEntity the data entity for the row you want to expand
+ */
+ toggleRowExpansion: function (rowEntity) {
+ var row = grid.getRow(rowEntity);
+ if (row !== null) {
+ service.toggleRowExpansion(grid, row);
+ }
+ },
+
+ /**
+ * @ngdoc method
+ * @name expandAllRows
+ * @methodOf ui.grid.expandable.api:PublicApi
+ * @description Expand all subgrids.
+ * <pre>
+ * gridApi.expandable.expandAllRows();
+ * </pre>
+ */
+ expandAllRows: function() {
+ service.expandAllRows(grid);
+ },
+
+ /**
+ * @ngdoc method
+ * @name collapseAllRows
+ * @methodOf ui.grid.expandable.api:PublicApi
+ * @description Collapse all subgrids.
+ * <pre>
+ * gridApi.expandable.collapseAllRows();
+ * </pre>
+ */
+ collapseAllRows: function() {
+ service.collapseAllRows(grid);
+ },
+
+ /**
+ * @ngdoc method
+ * @name toggleAllRows
+ * @methodOf ui.grid.expandable.api:PublicApi
+ * @description Toggle all subgrids.
+ * <pre>
+ * gridApi.expandable.toggleAllRows();
+ * </pre>
+ */
+ toggleAllRows: function() {
+ service.toggleAllRows(grid);
+ }
+ }
+ }
+ };
+ grid.api.registerEventsFromObject(publicApi.events);
+ grid.api.registerMethodsFromObject(publicApi.methods);
+ },
+
+ toggleRowExpansion: function (grid, row) {
+ // trigger the "before change" event. Can change row height dynamically this way.
+ grid.api.expandable.raise.rowExpandedBeforeStateChanged(row);
+ row.isExpanded = !row.isExpanded;
+ if (angular.isUndefined(row.expandedRowHeight)){
+ row.expandedRowHeight = grid.options.expandableRowHeight;
+ }
+
+ if (row.isExpanded) {
+ row.height = row.grid.options.rowHeight + row.expandedRowHeight;
+ }
+ else {
+ row.height = row.grid.options.rowHeight;
+ grid.expandable.expandedAll = false;
+ }
+ grid.api.expandable.raise.rowExpandedStateChanged(row);
+ },
+
+ expandAllRows: function(grid, $scope) {
+ grid.renderContainers.body.visibleRowCache.forEach( function(row) {
+ if (!row.isExpanded) {
+ service.toggleRowExpansion(grid, row);
+ }
+ });
+ grid.expandable.expandedAll = true;
+ grid.queueGridRefresh();
+ },
+
+ collapseAllRows: function(grid) {
+ grid.renderContainers.body.visibleRowCache.forEach( function(row) {
+ if (row.isExpanded) {
+ service.toggleRowExpansion(grid, row);
+ }
+ });
+ grid.expandable.expandedAll = false;
+ grid.queueGridRefresh();
+ },
+
+ toggleAllRows: function(grid) {
+ if (grid.expandable.expandedAll) {
+ service.collapseAllRows(grid);
+ }
+ else {
+ service.expandAllRows(grid);
+ }
+ }
+ };
+ return service;
+ }]);
+
+ /**
+ * @ngdoc object
+ * @name enableExpandableRowHeader
+ * @propertyOf ui.grid.expandable.api:GridOptions
+ * @description Show a rowHeader to provide the expandable buttons. If set to false then implies
+ * you're going to use a custom method for expanding and collapsing the subgrids. Defaults to true.
+ * @example
+ * <pre>
+ * $scope.gridOptions = {
+ * enableExpandableRowHeader: false
+ * }
+ * </pre>
+ */
+ module.directive('uiGridExpandable', ['uiGridExpandableService', '$templateCache',
+ function (uiGridExpandableService, $templateCache) {
+ return {
+ replace: true,
+ priority: 0,
+ require: '^uiGrid',
+ scope: false,
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ if ( uiGridCtrl.grid.options.enableExpandableRowHeader !== false ) {
+ var expandableRowHeaderColDef = {
+ name: 'expandableButtons',
+ displayName: '',
+ exporterSuppressExport: true,
+ enableColumnResizing: false,
+ enableColumnMenu: false,
+ width: uiGridCtrl.grid.options.expandableRowHeaderWidth || 40
+ };
+ expandableRowHeaderColDef.cellTemplate = $templateCache.get('ui-grid/expandableRowHeader');
+ expandableRowHeaderColDef.headerCellTemplate = $templateCache.get('ui-grid/expandableTopRowHeader');
+ uiGridCtrl.grid.addRowHeaderColumn(expandableRowHeaderColDef);
+ }
+ uiGridExpandableService.initializeGrid(uiGridCtrl.grid);
+ },
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ }
+ };
+ }
+ };
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.expandable.directive:uiGrid
+ * @description stacks on the uiGrid directive to register child grid with parent row when child is created
+ */
+ module.directive('uiGrid', ['uiGridExpandableService', '$templateCache',
+ function (uiGridExpandableService, $templateCache) {
+ return {
+ replace: true,
+ priority: 599,
+ require: '^uiGrid',
+ scope: false,
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+
+ uiGridCtrl.grid.api.core.on.renderingComplete($scope, function() {
+ //if a parent grid row is on the scope, then add the parentRow property to this childGrid
+ if ($scope.row && $scope.row.grid && $scope.row.grid.options && $scope.row.grid.options.enableExpandable) {
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.expandable.class:Grid
+ * @description Additional Grid properties added by expandable module
+ */
+
+ /**
+ * @ngdoc object
+ * @name parentRow
+ * @propertyOf ui.grid.expandable.class:Grid
+ * @description reference to the expanded parent row that owns this grid
+ */
+ uiGridCtrl.grid.parentRow = $scope.row;
+
+ //todo: adjust height on parent row when child grid height changes. we need some sort of gridHeightChanged event
+ // uiGridCtrl.grid.core.on.canvasHeightChanged($scope, function(oldHeight, newHeight) {
+ // uiGridCtrl.grid.parentRow = newHeight;
+ // });
+ }
+
+ });
+ },
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+
+ }
+ };
+ }
+ };
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.expandable.directive:uiGridExpandableRow
+ * @description directive to render the expandable row template
+ */
+ module.directive('uiGridExpandableRow',
+ ['uiGridExpandableService', '$timeout', '$compile', 'uiGridConstants','gridUtil','$interval', '$log',
+ function (uiGridExpandableService, $timeout, $compile, uiGridConstants, gridUtil, $interval, $log) {
+
+ return {
+ replace: false,
+ priority: 0,
+ scope: false,
+
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ gridUtil.getTemplate($scope.grid.options.expandableRowTemplate).then(
+ function (template) {
+ if ($scope.grid.options.expandableRowScope) {
+ var expandableRowScope = $scope.grid.options.expandableRowScope;
+ for (var property in expandableRowScope) {
+ if (expandableRowScope.hasOwnProperty(property)) {
+ $scope[property] = expandableRowScope[property];
+ }
+ }
+ }
+ var expandedRowElement = $compile(template)($scope);
+ $elm.append(expandedRowElement);
+ $scope.row.expandedRendered = true;
+ });
+ },
+
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ $scope.$on('$destroy', function() {
+ $scope.row.expandedRendered = false;
+ });
+ }
+ };
+ }
+ };
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.expandable.directive:uiGridRow
+ * @description stacks on the uiGridRow directive to add support for expandable rows
+ */
+ module.directive('uiGridRow',
+ ['$compile', 'gridUtil', '$templateCache',
+ function ($compile, gridUtil, $templateCache) {
+ return {
+ priority: -200,
+ scope: false,
+ compile: function ($elm, $attrs) {
+ return {
+ pre: function ($scope, $elm, $attrs, controllers) {
+
+ $scope.expandableRow = {};
+
+ $scope.expandableRow.shouldRenderExpand = function () {
+ var ret = $scope.colContainer.name === 'body' && $scope.grid.options.enableExpandable !== false && $scope.row.isExpanded && (!$scope.grid.isScrollingVertically || $scope.row.expandedRendered);
+ return ret;
+ };
+
+ $scope.expandableRow.shouldRenderFiller = function () {
+ var ret = $scope.row.isExpanded && ( $scope.colContainer.name !== 'body' || ($scope.grid.isScrollingVertically && !$scope.row.expandedRendered));
+ return ret;
+ };
+
+ /*
+ * Commented out @PaulL1. This has no purpose that I can see, and causes #2964. If this code needs to be reinstated for some
+ * reason it needs to use drawnWidth, not width, and needs to check column visibility. It should really use render container
+ * visible column cache also instead of checking column.renderContainer.
+ function updateRowContainerWidth() {
+ var grid = $scope.grid;
+ var colWidth = 0;
+ grid.columns.forEach( function (column) {
+ if (column.renderContainer === 'left') {
+ colWidth += column.width;
+ }
+ });
+ colWidth = Math.floor(colWidth);
+ return '.grid' + grid.id + ' .ui-grid-pinned-container-' + $scope.colContainer.name + ', .grid' + grid.id +
+ ' .ui-grid-pinned-container-' + $scope.colContainer.name + ' .ui-grid-render-container-' + $scope.colContainer.name +
+ ' .ui-grid-viewport .ui-grid-canvas .ui-grid-row { width: ' + colWidth + 'px; }';
+ }
+
+ if ($scope.colContainer.name === 'left') {
+ $scope.grid.registerStyleComputation({
+ priority: 15,
+ func: updateRowContainerWidth
+ });
+ }*/
+
+ },
+ post: function ($scope, $elm, $attrs, controllers) {
+ }
+ };
+ }
+ };
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.expandable.directive:uiGridViewport
+ * @description stacks on the uiGridViewport directive to append the expandable row html elements to the
+ * default gridRow template
+ */
+ module.directive('uiGridViewport',
+ ['$compile', 'gridUtil', '$templateCache',
+ function ($compile, gridUtil, $templateCache) {
+ return {
+ priority: -200,
+ scope: false,
+ compile: function ($elm, $attrs) {
+ var rowRepeatDiv = angular.element($elm.children().children()[0]);
+ var expandedRowFillerElement = $templateCache.get('ui-grid/expandableScrollFiller');
+ var expandedRowElement = $templateCache.get('ui-grid/expandableRow');
+ rowRepeatDiv.append(expandedRowElement);
+ rowRepeatDiv.append(expandedRowFillerElement);
+ return {
+ pre: function ($scope, $elm, $attrs, controllers) {
+ },
+ post: function ($scope, $elm, $attrs, controllers) {
+ }
+ };
+ }
+ };
+ }]);
+
+})();
+
+/* global console */
+
+(function () {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.exporter
+ * @description
+ *
+ * # ui.grid.exporter
+ *
+ * <div class="alert alert-success" role="alert"><strong>Stable</strong> This feature is stable. There should no longer be breaking api changes without a deprecation warning.</div>
+ *
+ * This module provides the ability to exporter data from the grid.
+ *
+ * Data can be exported in a range of formats, and all data, visible
+ * data, or selected rows can be exported, with all columns or visible
+ * columns.
+ *
+ * No UI is provided, the caller should provide their own UI/buttons
+ * as appropriate, or enable the gridMenu
+ *
+ * <br/>
+ * <br/>
+ *
+ * <div doc-module-components="ui.grid.exporter"></div>
+ */
+
+ var module = angular.module('ui.grid.exporter', ['ui.grid']);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.exporter.constant:uiGridExporterConstants
+ *
+ * @description constants available in exporter module
+ */
+ /**
+ * @ngdoc property
+ * @propertyOf ui.grid.exporter.constant:uiGridExporterConstants
+ * @name ALL
+ * @description export all data, including data not visible. Can
+ * be set for either rowTypes or colTypes
+ */
+ /**
+ * @ngdoc property
+ * @propertyOf ui.grid.exporter.constant:uiGridExporterConstants
+ * @name VISIBLE
+ * @description export only visible data, including data not visible. Can
+ * be set for either rowTypes or colTypes
+ */
+ /**
+ * @ngdoc property
+ * @propertyOf ui.grid.exporter.constant:uiGridExporterConstants
+ * @name SELECTED
+ * @description export all data, including data not visible. Can
+ * be set only for rowTypes, selection of only some columns is
+ * not supported
+ */
+ module.constant('uiGridExporterConstants', {
+ featureName: 'exporter',
+ ALL: 'all',
+ VISIBLE: 'visible',
+ SELECTED: 'selected',
+ CSV_CONTENT: 'CSV_CONTENT',
+ BUTTON_LABEL: 'BUTTON_LABEL',
+ FILE_NAME: 'FILE_NAME'
+ });
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.exporter.service:uiGridExporterService
+ *
+ * @description Services for exporter feature
+ */
+ module.service('uiGridExporterService', ['$q', 'uiGridExporterConstants', 'gridUtil', '$compile', '$interval', 'i18nService',
+ function ($q, uiGridExporterConstants, gridUtil, $compile, $interval, i18nService) {
+
+ var service = {
+
+ delay: 100,
+
+ initializeGrid: function (grid) {
+
+ //add feature namespace and any properties to grid for needed state
+ grid.exporter = {};
+ this.defaultGridOptions(grid.options);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.exporter.api:PublicApi
+ *
+ * @description Public Api for exporter feature
+ */
+ var publicApi = {
+ events: {
+ exporter: {
+ }
+ },
+ methods: {
+ exporter: {
+ /**
+ * @ngdoc function
+ * @name csvExport
+ * @methodOf ui.grid.exporter.api:PublicApi
+ * @description Exports rows from the grid in csv format,
+ * the data exported is selected based on the provided options
+ * @param {string} rowTypes which rows to export, valid values are
+ * uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE,
+ * uiGridExporterConstants.SELECTED
+ * @param {string} colTypes which columns to export, valid values are
+ * uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE
+ */
+ csvExport: function (rowTypes, colTypes) {
+ service.csvExport(grid, rowTypes, colTypes);
+ },
+ /**
+ * @ngdoc function
+ * @name pdfExport
+ * @methodOf ui.grid.exporter.api:PublicApi
+ * @description Exports rows from the grid in pdf format,
+ * the data exported is selected based on the provided options
+ * Note that this function has a dependency on pdfMake, all
+ * going well this has been installed for you.
+ * The resulting pdf opens in a new browser window.
+ * @param {string} rowTypes which rows to export, valid values are
+ * uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE,
+ * uiGridExporterConstants.SELECTED
+ * @param {string} colTypes which columns to export, valid values are
+ * uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE
+ */
+ pdfExport: function (rowTypes, colTypes) {
+ service.pdfExport(grid, rowTypes, colTypes);
+ }
+ }
+ }
+ };
+
+ grid.api.registerEventsFromObject(publicApi.events);
+
+ grid.api.registerMethodsFromObject(publicApi.methods);
+
+ if (grid.api.core.addToGridMenu){
+ service.addToMenu( grid );
+ } else {
+ // order of registration is not guaranteed, register in a little while
+ $interval( function() {
+ if (grid.api.core.addToGridMenu){
+ service.addToMenu( grid );
+ }
+ }, this.delay, 1);
+ }
+
+ },
+
+ defaultGridOptions: function (gridOptions) {
+ //default option to true unless it was explicitly set to false
+ /**
+ * @ngdoc object
+ * @name ui.grid.exporter.api:GridOptions
+ *
+ * @description GridOptions for exporter feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+ /**
+ * @ngdoc object
+ * @name ui.grid.exporter.api:ColumnDef
+ * @description ColumnDef settings for exporter
+ */
+ /**
+ * @ngdoc object
+ * @name exporterSuppressMenu
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description Don't show the export menu button, implying the user
+ * will roll their own UI for calling the exporter
+ * <br/>Defaults to false
+ */
+ gridOptions.exporterSuppressMenu = gridOptions.exporterSuppressMenu === true;
+ /**
+ * @ngdoc object
+ * @name exporterMenuLabel
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description The text to show on the exporter menu button
+ * link
+ * <br/>Defaults to 'Export'
+ */
+ gridOptions.exporterMenuLabel = gridOptions.exporterMenuLabel ? gridOptions.exporterMenuLabel : 'Export';
+ /**
+ * @ngdoc object
+ * @name exporterSuppressColumns
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description Columns that should not be exported. The selectionRowHeader is already automatically
+ * suppressed, but if you had a button column or some other "system" column that shouldn't be shown in the
+ * output then add it in this list. You should provide an array of column names.
+ * <br/>Defaults to: []
+ * <pre>
+ * gridOptions.exporterSuppressColumns = [ 'buttons' ];
+ * </pre>
+ */
+ gridOptions.exporterSuppressColumns = gridOptions.exporterSuppressColumns ? gridOptions.exporterSuppressColumns : [];
+ /**
+ * @ngdoc object
+ * @name exporterCsvColumnSeparator
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description The character to use as column separator
+ * link
+ * <br/>Defaults to ','
+ */
+ gridOptions.exporterCsvColumnSeparator = gridOptions.exporterCsvColumnSeparator ? gridOptions.exporterCsvColumnSeparator : ',';
+ /**
+ * @ngdoc object
+ * @name exporterCsvFilename
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description The default filename to use when saving the downloaded csv.
+ * This will only work in some browsers.
+ * <br/>Defaults to 'download.csv'
+ */
+ gridOptions.exporterCsvFilename = gridOptions.exporterCsvFilename ? gridOptions.exporterCsvFilename : 'download.csv';
+ /**
+ * @ngdoc object
+ * @name exporterPdfFilename
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description The default filename to use when saving the downloaded pdf, only used in IE (other browsers open pdfs in a new window)
+ * <br/>Defaults to 'download.pdf'
+ */
+ gridOptions.exporterPdfFilename = gridOptions.exporterPdfFilename ? gridOptions.exporterPdfFilename : 'download.pdf';
+ /**
+ * @ngdoc object
+ * @name exporterOlderExcelCompatibility
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description Some versions of excel don't like the utf-16 BOM on the front, and it comes
+ * through as  in the first column header. Setting this option to false will suppress this, at the
+ * expense of proper utf-16 handling in applications that do recognise the BOM
+ * <br/>Defaults to false
+ */
+ gridOptions.exporterOlderExcelCompatibility = gridOptions.exporterOlderExcelCompatibility === true;
+ /**
+ * @ngdoc object
+ * @name exporterPdfDefaultStyle
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description The default style in pdfMake format
+ * <br/>Defaults to:
+ * <pre>
+ * {
+ * fontSize: 11
+ * }
+ * </pre>
+ */
+ gridOptions.exporterPdfDefaultStyle = gridOptions.exporterPdfDefaultStyle ? gridOptions.exporterPdfDefaultStyle : { fontSize: 11 };
+ /**
+ * @ngdoc object
+ * @name exporterPdfTableStyle
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description The table style in pdfMake format
+ * <br/>Defaults to:
+ * <pre>
+ * {
+ * margin: [0, 5, 0, 15]
+ * }
+ * </pre>
+ */
+ gridOptions.exporterPdfTableStyle = gridOptions.exporterPdfTableStyle ? gridOptions.exporterPdfTableStyle : { margin: [0, 5, 0, 15] };
+ /**
+ * @ngdoc object
+ * @name exporterPdfTableHeaderStyle
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description The tableHeader style in pdfMake format
+ * <br/>Defaults to:
+ * <pre>
+ * {
+ * bold: true,
+ * fontSize: 12,
+ * color: 'black'
+ * }
+ * </pre>
+ */
+ gridOptions.exporterPdfTableHeaderStyle = gridOptions.exporterPdfTableHeaderStyle ? gridOptions.exporterPdfTableHeaderStyle : { bold: true, fontSize: 12, color: 'black' };
+ /**
+ * @ngdoc object
+ * @name exporterPdfHeader
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description The header section for pdf exports. Can be
+ * simple text:
+ * <pre>
+ * gridOptions.exporterPdfHeader = 'My Header';
+ * </pre>
+ * Can be a more complex object in pdfMake format:
+ * <pre>
+ * gridOptions.exporterPdfHeader = {
+ * columns: [
+ * 'Left part',
+ * { text: 'Right part', alignment: 'right' }
+ * ]
+ * };
+ * </pre>
+ * Or can be a function, allowing page numbers and the like
+ * <pre>
+ * gridOptions.exporterPdfHeader: function(currentPage, pageCount) { return currentPage.toString() + ' of ' + pageCount; };
+ * </pre>
+ */
+ gridOptions.exporterPdfHeader = gridOptions.exporterPdfHeader ? gridOptions.exporterPdfHeader : null;
+ /**
+ * @ngdoc object
+ * @name exporterPdfFooter
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description The header section for pdf exports. Can be
+ * simple text:
+ * <pre>
+ * gridOptions.exporterPdfFooter = 'My Footer';
+ * </pre>
+ * Can be a more complex object in pdfMake format:
+ * <pre>
+ * gridOptions.exporterPdfFooter = {
+ * columns: [
+ * 'Left part',
+ * { text: 'Right part', alignment: 'right' }
+ * ]
+ * };
+ * </pre>
+ * Or can be a function, allowing page numbers and the like
+ * <pre>
+ * gridOptions.exporterPdfFooter: function(currentPage, pageCount) { return currentPage.toString() + ' of ' + pageCount; };
+ * </pre>
+ */
+ gridOptions.exporterPdfFooter = gridOptions.exporterPdfFooter ? gridOptions.exporterPdfFooter : null;
+ /**
+ * @ngdoc object
+ * @name exporterPdfOrientation
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description The orientation, should be a valid pdfMake value,
+ * 'landscape' or 'portrait'
+ * <br/>Defaults to landscape
+ */
+ gridOptions.exporterPdfOrientation = gridOptions.exporterPdfOrientation ? gridOptions.exporterPdfOrientation : 'landscape';
+ /**
+ * @ngdoc object
+ * @name exporterPdfPageSize
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description The orientation, should be a valid pdfMake
+ * paper size, usually 'A4' or 'LETTER'
+ * {@link https://github.com/bpampuch/pdfmake/blob/master/src/standardPageSizes.js pdfMake page sizes}
+ * <br/>Defaults to A4
+ */
+ gridOptions.exporterPdfPageSize = gridOptions.exporterPdfPageSize ? gridOptions.exporterPdfPageSize : 'A4';
+ /**
+ * @ngdoc object
+ * @name exporterPdfMaxGridWidth
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description The maxium grid width - the current grid width
+ * will be scaled to match this, with any fixed width columns
+ * being adjusted accordingly.
+ * <br/>Defaults to 720 (for A4 landscape), use 670 for LETTER
+ */
+ gridOptions.exporterPdfMaxGridWidth = gridOptions.exporterPdfMaxGridWidth ? gridOptions.exporterPdfMaxGridWidth : 720;
+ /**
+ * @ngdoc object
+ * @name exporterPdfTableLayout
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description A tableLayout in pdfMake format,
+ * controls gridlines and the like. We use the default
+ * layout usually.
+ * <br/>Defaults to null, which means no layout
+ */
+
+ /**
+ * @ngdoc object
+ * @name exporterMenuAllData
+ * @porpertyOf ui.grid.exporter.api:GridOptions
+ * @description Add export all data as cvs/pdf menu items to the ui-grid grid menu, if it's present. Defaults to true.
+ */
+ gridOptions.exporterMenuAllData = gridOptions.exporterMenuAllData !== undefined ? gridOptions.exporterMenuAllData : true;
+
+ /**
+ * @ngdoc object
+ * @name exporterMenuCsv
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description Add csv export menu items to the ui-grid grid menu, if it's present. Defaults to true.
+ */
+ gridOptions.exporterMenuCsv = gridOptions.exporterMenuCsv !== undefined ? gridOptions.exporterMenuCsv : true;
+
+ /**
+ * @ngdoc object
+ * @name exporterMenuPdf
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description Add pdf export menu items to the ui-grid grid menu, if it's present. Defaults to true.
+ */
+ gridOptions.exporterMenuPdf = gridOptions.exporterMenuPdf !== undefined ? gridOptions.exporterMenuPdf : true;
+
+ /**
+ * @ngdoc object
+ * @name exporterPdfCustomFormatter
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description A custom callback routine that changes the pdf document, adding any
+ * custom styling or content that is supported by pdfMake. Takes in the complete docDefinition, and
+ * must return an updated docDefinition ready for pdfMake.
+ * @example
+ * In this example we add a style to the style array, so that we can use it in our
+ * footer definition.
+ * <pre>
+ * gridOptions.exporterPdfCustomFormatter = function ( docDefinition ) {
+ * docDefinition.styles.footerStyle = { bold: true, fontSize: 10 };
+ * return docDefinition;
+ * }
+ *
+ * gridOptions.exporterPdfFooter = { text: 'My footer', style: 'footerStyle' }
+ * </pre>
+ */
+ gridOptions.exporterPdfCustomFormatter = ( gridOptions.exporterPdfCustomFormatter && typeof( gridOptions.exporterPdfCustomFormatter ) === 'function' ) ? gridOptions.exporterPdfCustomFormatter : function ( docDef ) { return docDef; };
+
+ /**
+ * @ngdoc object
+ * @name exporterHeaderFilterUseName
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description Defaults to false, which leads to `displayName` being passed into the headerFilter.
+ * If set to true, then will pass `name` instead.
+ *
+ *
+ * @example
+ * <pre>
+ * gridOptions.exporterHeaderFilterUseName = true;
+ * </pre>
+ */
+ gridOptions.exporterHeaderFilterUseName = gridOptions.exporterHeaderFilterUseName === true;
+
+ /**
+ * @ngdoc object
+ * @name exporterHeaderFilter
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description A function to apply to the header displayNames before exporting. Useful for internationalisation,
+ * for example if you were using angular-translate you'd set this to `$translate.instant`. Note that this
+ * call must be synchronous, it cannot be a call that returns a promise.
+ *
+ * Behaviour can be changed to pass in `name` instead of `displayName` through use of `exporterHeaderFilterUseName: true`.
+ *
+ * @example
+ * <pre>
+ * gridOptions.exporterHeaderFilter = function( displayName ){ return 'col: ' + name; };
+ * </pre>
+ * OR
+ * <pre>
+ * gridOptions.exporterHeaderFilter = $translate.instant;
+ * </pre>
+ */
+
+ /**
+ * @ngdoc function
+ * @name exporterFieldCallback
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description A function to call for each field before exporting it. Allows
+ * massaging of raw data into a display format, for example if you have applied
+ * filters to convert codes into decodes, or you require
+ * a specific date format in the exported content.
+ *
+ * The method is called once for each field exported, and provides the grid, the
+ * gridCol and the GridRow for you to use as context in massaging the data.
+ *
+ * @param {Grid} grid provides the grid in case you have need of it
+ * @param {GridRow} row the row from which the data comes
+ * @param {GridCol} col the column from which the data comes
+ * @param {object} value the value for your massaging
+ * @returns {object} you must return the massaged value ready for exporting
+ *
+ * @example
+ * <pre>
+ * gridOptions.exporterFieldCallback = function ( grid, row, col, value ){
+ * if ( col.name === 'status' ){
+ * value = decodeStatus( value );
+ * }
+ * return value;
+ * }
+ * </pre>
+ */
+ gridOptions.exporterFieldCallback = gridOptions.exporterFieldCallback ? gridOptions.exporterFieldCallback : function( grid, row, col, value ) { return value; };
+
+ /**
+ * @ngdoc function
+ * @name exporterAllDataFn
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description This promise is needed when exporting all rows,
+ * and the data need to be provided by server side. Default is null.
+ * @returns {Promise} a promise to load all data from server
+ *
+ * @example
+ * <pre>
+ * gridOptions.exporterAllDataFn = function () {
+ * return $http.get('/data/100.json')
+ * }
+ * </pre>
+ */
+ gridOptions.exporterAllDataFn = gridOptions.exporterAllDataFn ? gridOptions.exporterAllDataFn : null;
+
+ /**
+ * @ngdoc function
+ * @name exporterAllDataPromise
+ * @propertyOf ui.grid.exporter.api:GridOptions
+ * @description DEPRECATED - exporterAllDataFn used to be
+ * called this, but it wasn't a promise, it was a function that returned
+ * a promise. Deprecated, but supported for backward compatibility, use
+ * exporterAllDataFn instead.
+ * @returns {Promise} a promise to load all data from server
+ *
+ * @example
+ * <pre>
+ * gridOptions.exporterAllDataFn = function () {
+ * return $http.get('/data/100.json')
+ * }
+ * </pre>
+ */
+ if ( gridOptions.exporterAllDataFn == null && gridOptions.exporterAllDataPromise ) {
+ gridOptions.exporterAllDataFn = gridOptions.exporterAllDataPromise;
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name addToMenu
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Adds export items to the grid menu,
+ * allowing the user to select export options
+ * @param {Grid} grid the grid from which data should be exported
+ */
+ addToMenu: function ( grid ) {
+ grid.api.core.addToGridMenu( grid, [
+ {
+ title: i18nService.getSafeText('gridMenu.exporterAllAsCsv'),
+ action: function ($event) {
+ this.grid.api.exporter.csvExport( uiGridExporterConstants.ALL, uiGridExporterConstants.ALL );
+ },
+ shown: function() {
+ return this.grid.options.exporterMenuCsv && this.grid.options.exporterMenuAllData;
+ },
+ order: 200
+ },
+ {
+ title: i18nService.getSafeText('gridMenu.exporterVisibleAsCsv'),
+ action: function ($event) {
+ this.grid.api.exporter.csvExport( uiGridExporterConstants.VISIBLE, uiGridExporterConstants.VISIBLE );
+ },
+ shown: function() {
+ return this.grid.options.exporterMenuCsv;
+ },
+ order: 201
+ },
+ {
+ title: i18nService.getSafeText('gridMenu.exporterSelectedAsCsv'),
+ action: function ($event) {
+ this.grid.api.exporter.csvExport( uiGridExporterConstants.SELECTED, uiGridExporterConstants.VISIBLE );
+ },
+ shown: function() {
+ return this.grid.options.exporterMenuCsv &&
+ ( this.grid.api.selection && this.grid.api.selection.getSelectedRows().length > 0 );
+ },
+ order: 202
+ },
+ {
+ title: i18nService.getSafeText('gridMenu.exporterAllAsPdf'),
+ action: function ($event) {
+ this.grid.api.exporter.pdfExport( uiGridExporterConstants.ALL, uiGridExporterConstants.ALL );
+ },
+ shown: function() {
+ return this.grid.options.exporterMenuPdf && this.grid.options.exporterMenuAllData;
+ },
+ order: 203
+ },
+ {
+ title: i18nService.getSafeText('gridMenu.exporterVisibleAsPdf'),
+ action: function ($event) {
+ this.grid.api.exporter.pdfExport( uiGridExporterConstants.VISIBLE, uiGridExporterConstants.VISIBLE );
+ },
+ shown: function() {
+ return this.grid.options.exporterMenuPdf;
+ },
+ order: 204
+ },
+ {
+ title: i18nService.getSafeText('gridMenu.exporterSelectedAsPdf'),
+ action: function ($event) {
+ this.grid.api.exporter.pdfExport( uiGridExporterConstants.SELECTED, uiGridExporterConstants.VISIBLE );
+ },
+ shown: function() {
+ return this.grid.options.exporterMenuPdf &&
+ ( this.grid.api.selection && this.grid.api.selection.getSelectedRows().length > 0 );
+ },
+ order: 205
+ }
+ ]);
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name csvExport
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Exports rows from the grid in csv format,
+ * the data exported is selected based on the provided options
+ * @param {Grid} grid the grid from which data should be exported
+ * @param {string} rowTypes which rows to export, valid values are
+ * uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE,
+ * uiGridExporterConstants.SELECTED
+ * @param {string} colTypes which columns to export, valid values are
+ * uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE,
+ * uiGridExporterConstants.SELECTED
+ */
+ csvExport: function (grid, rowTypes, colTypes) {
+ var self = this;
+ this.loadAllDataIfNeeded(grid, rowTypes, colTypes).then(function() {
+ var exportColumnHeaders = grid.options.showHeader ? self.getColumnHeaders(grid, colTypes) : [];
+ var exportData = self.getData(grid, rowTypes, colTypes);
+ var csvContent = self.formatAsCsv(exportColumnHeaders, exportData, grid.options.exporterCsvColumnSeparator);
+
+ self.downloadFile (grid.options.exporterCsvFilename, csvContent, grid.options.exporterOlderExcelCompatibility);
+ });
+ },
+
+ /**
+ * @ngdoc function
+ * @name loadAllDataIfNeeded
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description When using server side pagination, use exporterAllDataFn to
+ * load all data before continuing processing.
+ * When using client side pagination, return a resolved promise so processing
+ * continues immediately
+ * @param {Grid} grid the grid from which data should be exported
+ * @param {string} rowTypes which rows to export, valid values are
+ * uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE,
+ * uiGridExporterConstants.SELECTED
+ * @param {string} colTypes which columns to export, valid values are
+ * uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE,
+ * uiGridExporterConstants.SELECTED
+ */
+ loadAllDataIfNeeded: function (grid, rowTypes, colTypes) {
+ if ( rowTypes === uiGridExporterConstants.ALL && grid.rows.length !== grid.options.totalItems && grid.options.exporterAllDataFn) {
+ return grid.options.exporterAllDataFn()
+ .then(function() {
+ grid.modifyRows(grid.options.data);
+ });
+ } else {
+ var deferred = $q.defer();
+ deferred.resolve();
+ return deferred.promise;
+ }
+ },
+
+ /**
+ * @ngdoc property
+ * @propertyOf ui.grid.exporter.api:ColumnDef
+ * @name exporterSuppressExport
+ * @description Suppresses export for this column. Used by selection and expandable.
+ */
+
+ /**
+ * @ngdoc function
+ * @name getColumnHeaders
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Gets the column headers from the grid to use
+ * as a title row for the exported file, all headers have
+ * headerCellFilters applied as appropriate.
+ *
+ * Column headers are an array of objects, each object has
+ * name, displayName, width and align attributes. Only name is
+ * used for csv, all attributes are used for pdf.
+ *
+ * @param {Grid} grid the grid from which data should be exported
+ * @param {string} colTypes which columns to export, valid values are
+ * uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE,
+ * uiGridExporterConstants.SELECTED
+ */
+ getColumnHeaders: function (grid, colTypes) {
+ var headers = [];
+ var columns;
+
+ if ( colTypes === uiGridExporterConstants.ALL ){
+ columns = grid.columns;
+ } else {
+ var leftColumns = grid.renderContainers.left ? grid.renderContainers.left.visibleColumnCache.filter( function( column ){ return column.visible; } ) : [];
+ var bodyColumns = grid.renderContainers.body ? grid.renderContainers.body.visibleColumnCache.filter( function( column ){ return column.visible; } ) : [];
+ var rightColumns = grid.renderContainers.right ? grid.renderContainers.right.visibleColumnCache.filter( function( column ){ return column.visible; } ) : [];
+
+ columns = leftColumns.concat(bodyColumns,rightColumns);
+ }
+
+ columns.forEach( function( gridCol, index ) {
+ if ( gridCol.colDef.exporterSuppressExport !== true &&
+ grid.options.exporterSuppressColumns.indexOf( gridCol.name ) === -1 ){
+ headers.push({
+ name: gridCol.field,
+ displayName: grid.options.exporterHeaderFilter ? ( grid.options.exporterHeaderFilterUseName ? grid.options.exporterHeaderFilter(gridCol.name) : grid.options.exporterHeaderFilter(gridCol.displayName) ) : gridCol.displayName,
+ width: gridCol.drawnWidth ? gridCol.drawnWidth : gridCol.width,
+ align: gridCol.colDef.type === 'number' ? 'right' : 'left'
+ });
+ }
+ });
+
+ return headers;
+ },
+
+
+ /**
+ * @ngdoc property
+ * @propertyOf ui.grid.exporter.api:ColumnDef
+ * @name exporterPdfAlign
+ * @description the alignment you'd like for this specific column when
+ * exported into a pdf. Can be 'left', 'right', 'center' or any other
+ * valid pdfMake alignment option.
+ */
+
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.exporter.api:GridRow
+ * @description GridRow settings for exporter
+ */
+ /**
+ * @ngdoc object
+ * @name exporterEnableExporting
+ * @propertyOf ui.grid.exporter.api:GridRow
+ * @description If set to false, then don't export this row, notwithstanding visible or
+ * other settings
+ * <br/>Defaults to true
+ */
+
+ /**
+ * @ngdoc function
+ * @name getData
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Gets data from the grid based on the provided options,
+ * all cells have cellFilters applied as appropriate. Any rows marked
+ * `exporterEnableExporting: false` will not be exported
+ * @param {Grid} grid the grid from which data should be exported
+ * @param {string} rowTypes which rows to export, valid values are
+ * uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE,
+ * uiGridExporterConstants.SELECTED
+ * @param {string} colTypes which columns to export, valid values are
+ * uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE,
+ * uiGridExporterConstants.SELECTED
+ */
+ getData: function (grid, rowTypes, colTypes) {
+ var data = [];
+ var rows;
+ var columns;
+
+ switch ( rowTypes ) {
+ case uiGridExporterConstants.ALL:
+ rows = grid.rows;
+ break;
+ case uiGridExporterConstants.VISIBLE:
+ rows = grid.getVisibleRows();
+ break;
+ case uiGridExporterConstants.SELECTED:
+ if ( grid.api.selection ){
+ rows = grid.api.selection.getSelectedGridRows();
+ } else {
+ gridUtil.logError('selection feature must be enabled to allow selected rows to be exported');
+ }
+ break;
+ }
+
+ if ( colTypes === uiGridExporterConstants.ALL ){
+ columns = grid.columns;
+ } else {
+ var leftColumns = grid.renderContainers.left ? grid.renderContainers.left.visibleColumnCache.filter( function( column ){ return column.visible; } ) : [];
+ var bodyColumns = grid.renderContainers.body ? grid.renderContainers.body.visibleColumnCache.filter( function( column ){ return column.visible; } ) : [];
+ var rightColumns = grid.renderContainers.right ? grid.renderContainers.right.visibleColumnCache.filter( function( column ){ return column.visible; } ) : [];
+
+ columns = leftColumns.concat(bodyColumns,rightColumns);
+ }
+
+ rows.forEach( function( row, index ) {
+
+ if (row.exporterEnableExporting !== false) {
+ var extractedRow = [];
+
+
+ columns.forEach( function( gridCol, index ) {
+ if ( (gridCol.visible || colTypes === uiGridExporterConstants.ALL ) &&
+ gridCol.colDef.exporterSuppressExport !== true &&
+ grid.options.exporterSuppressColumns.indexOf( gridCol.name ) === -1 ){
+ var extractedField = { value: grid.options.exporterFieldCallback( grid, row, gridCol, grid.getCellValue( row, gridCol ) ) };
+ if ( gridCol.colDef.exporterPdfAlign ) {
+ extractedField.alignment = gridCol.colDef.exporterPdfAlign;
+ }
+ extractedRow.push(extractedField);
+ }
+ });
+
+ data.push(extractedRow);
+ }
+ });
+
+ return data;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name formatAsCSV
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Formats the column headers and data as a CSV,
+ * and sends that data to the user
+ * @param {array} exportColumnHeaders an array of column headers,
+ * where each header is an object with name, width and maybe alignment
+ * @param {array} exportData an array of rows, where each row is
+ * an array of column data
+ * @returns {string} csv the formatted csv as a string
+ */
+ formatAsCsv: function (exportColumnHeaders, exportData, separator) {
+ var self = this;
+
+ var bareHeaders = exportColumnHeaders.map(function(header){return { value: header.displayName };});
+
+ var csv = bareHeaders.length > 0 ? (self.formatRowAsCsv(this, separator)(bareHeaders) + '\n') : '';
+
+ csv += exportData.map(this.formatRowAsCsv(this, separator)).join('\n');
+
+ return csv;
+ },
+
+ /**
+ * @ngdoc function
+ * @name formatRowAsCsv
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Renders a single field as a csv field, including
+ * quotes around the value
+ * @param {exporterService} exporter pass in exporter
+ * @param {array} row the row to be turned into a csv string
+ * @returns {string} a csv-ified version of the row
+ */
+ formatRowAsCsv: function (exporter, separator) {
+ return function (row) {
+ return row.map(exporter.formatFieldAsCsv).join(separator);
+ };
+ },
+
+ /**
+ * @ngdoc function
+ * @name formatFieldAsCsv
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Renders a single field as a csv field, including
+ * quotes around the value
+ * @param {field} field the field to be turned into a csv string,
+ * may be of any type
+ * @returns {string} a csv-ified version of the field
+ */
+ formatFieldAsCsv: function (field) {
+ if (field.value == null) { // we want to catch anything null-ish, hence just == not ===
+ return '';
+ }
+ if (typeof(field.value) === 'number') {
+ return field.value;
+ }
+ if (typeof(field.value) === 'boolean') {
+ return (field.value ? 'TRUE' : 'FALSE') ;
+ }
+ if (typeof(field.value) === 'string') {
+ return '"' + field.value.replace(/"/g,'""') + '"';
+ }
+
+ return JSON.stringify(field.value);
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name isIE
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Checks whether current browser is IE and returns it's version if it is
+ */
+ isIE: function () {
+ var match = navigator.userAgent.match(/(?:MSIE |Trident\/.*; rv:)(\d+)/);
+ return match ? parseInt(match[1]) : false;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name downloadFile
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Triggers download of a csv file. Logic provided
+ * by @cssensei (from his colleagues at https://github.com/ifeelgoods) in issue #2391
+ * @param {string} fileName the filename we'd like our file to be
+ * given
+ * @param {string} csvContent the csv content that we'd like to
+ * download as a file
+ * @param {boolean} exporterOlderExcelCompatibility whether or not we put a utf-16 BOM on the from (\uFEFF)
+ */
+ downloadFile: function (fileName, csvContent, exporterOlderExcelCompatibility) {
+ var D = document;
+ var a = D.createElement('a');
+ var strMimeType = 'application/octet-stream;charset=utf-8';
+ var rawFile;
+ var ieVersion;
+
+ ieVersion = this.isIE();
+ if (ieVersion && ieVersion < 10) {
+ var frame = D.createElement('iframe');
+ document.body.appendChild(frame);
+
+ frame.contentWindow.document.open("text/html", "replace");
+ frame.contentWindow.document.write('sep=,\r\n' + csvContent);
+ frame.contentWindow.document.close();
+ frame.contentWindow.focus();
+ frame.contentWindow.document.execCommand('SaveAs', true, fileName);
+
+ document.body.removeChild(frame);
+ return true;
+ }
+
+ // IE10+
+ if (navigator.msSaveBlob) {
+ return navigator.msSaveOrOpenBlob(
+ new Blob(
+ [exporterOlderExcelCompatibility ? "\uFEFF" : '', csvContent],
+ { type: strMimeType } ),
+ fileName
+ );
+ }
+
+ //html5 A[download]
+ if ('download' in a) {
+ var blob = new Blob(
+ [exporterOlderExcelCompatibility ? "\uFEFF" : '', csvContent],
+ { type: strMimeType }
+ );
+ rawFile = URL.createObjectURL(blob);
+ a.setAttribute('download', fileName);
+ } else {
+ rawFile = 'data:' + strMimeType + ',' + encodeURIComponent(csvContent);
+ a.setAttribute('target', '_blank');
+ }
+
+ a.href = rawFile;
+ a.setAttribute('style', 'display:none;');
+ D.body.appendChild(a);
+ setTimeout(function() {
+ if (a.click) {
+ a.click();
+ // Workaround for Safari 5
+ } else if (document.createEvent) {
+ var eventObj = document.createEvent('MouseEvents');
+ eventObj.initEvent('click', true, true);
+ a.dispatchEvent(eventObj);
+ }
+ D.body.removeChild(a);
+
+ }, this.delay);
+ },
+
+ /**
+ * @ngdoc function
+ * @name pdfExport
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Exports rows from the grid in pdf format,
+ * the data exported is selected based on the provided options.
+ * Note that this function has a dependency on pdfMake, which must
+ * be installed. The resulting pdf opens in a new
+ * browser window.
+ * @param {Grid} grid the grid from which data should be exported
+ * @param {string} rowTypes which rows to export, valid values are
+ * uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE,
+ * uiGridExporterConstants.SELECTED
+ * @param {string} colTypes which columns to export, valid values are
+ * uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE,
+ * uiGridExporterConstants.SELECTED
+ */
+ pdfExport: function (grid, rowTypes, colTypes) {
+ var self = this;
+ this.loadAllDataIfNeeded(grid, rowTypes, colTypes).then(function () {
+ var exportColumnHeaders = self.getColumnHeaders(grid, colTypes);
+ var exportData = self.getData(grid, rowTypes, colTypes);
+ var docDefinition = self.prepareAsPdf(grid, exportColumnHeaders, exportData);
+
+ if (self.isIE()) {
+ self.downloadPDF(grid.options.exporterPdfFilename, docDefinition);
+ } else {
+ pdfMake.createPdf(docDefinition).open();
+ }
+ });
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name downloadPdf
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Generates and retrieves the pdf as a blob, then downloads
+ * it as a file. Only used in IE, in all other browsers we use the native
+ * pdfMake.open function to just open the PDF
+ * @param {string} fileName the filename to give to the pdf, can be set
+ * through exporterPdfFilename
+ * @param {object} docDefinition a pdf docDefinition that we can generate
+ * and get a blob from
+ */
+ downloadPDF: function (fileName, docDefinition) {
+ var D = document;
+ var a = D.createElement('a');
+ var strMimeType = 'application/octet-stream;charset=utf-8';
+ var rawFile;
+ var ieVersion;
+
+ ieVersion = this.isIE();
+ var doc = pdfMake.createPdf(docDefinition);
+ var blob;
+
+ doc.getBuffer( function (buffer) {
+ blob = new Blob([buffer]);
+
+ if (ieVersion && ieVersion < 10) {
+ var frame = D.createElement('iframe');
+ document.body.appendChild(frame);
+
+ frame.contentWindow.document.open("text/html", "replace");
+ frame.contentWindow.document.write(blob);
+ frame.contentWindow.document.close();
+ frame.contentWindow.focus();
+ frame.contentWindow.document.execCommand('SaveAs', true, fileName);
+
+ document.body.removeChild(frame);
+ return true;
+ }
+
+ // IE10+
+ if (navigator.msSaveBlob) {
+ return navigator.msSaveBlob(
+ blob, fileName
+ );
+ }
+ });
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name renderAsPdf
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Renders the data into a pdf, and opens that pdf.
+ *
+ * @param {Grid} grid the grid from which data should be exported
+ * @param {array} exportColumnHeaders an array of column headers,
+ * where each header is an object with name, width and maybe alignment
+ * @param {array} exportData an array of rows, where each row is
+ * an array of column data
+ * @returns {object} a pdfMake format document definition, ready
+ * for generation
+ */
+ prepareAsPdf: function(grid, exportColumnHeaders, exportData) {
+ var headerWidths = this.calculatePdfHeaderWidths( grid, exportColumnHeaders );
+
+ var headerColumns = exportColumnHeaders.map( function( header ) {
+ return { text: header.displayName, style: 'tableHeader' };
+ });
+
+ var stringData = exportData.map(this.formatRowAsPdf(this));
+
+ var allData = [headerColumns].concat(stringData);
+
+ var docDefinition = {
+ pageOrientation: grid.options.exporterPdfOrientation,
+ pageSize: grid.options.exporterPdfPageSize,
+ content: [{
+ style: 'tableStyle',
+ table: {
+ headerRows: 1,
+ widths: headerWidths,
+ body: allData
+ }
+ }],
+ styles: {
+ tableStyle: grid.options.exporterPdfTableStyle,
+ tableHeader: grid.options.exporterPdfTableHeaderStyle
+ },
+ defaultStyle: grid.options.exporterPdfDefaultStyle
+ };
+
+ if ( grid.options.exporterPdfLayout ){
+ docDefinition.layout = grid.options.exporterPdfLayout;
+ }
+
+ if ( grid.options.exporterPdfHeader ){
+ docDefinition.header = grid.options.exporterPdfHeader;
+ }
+
+ if ( grid.options.exporterPdfFooter ){
+ docDefinition.footer = grid.options.exporterPdfFooter;
+ }
+
+ if ( grid.options.exporterPdfCustomFormatter ){
+ docDefinition = grid.options.exporterPdfCustomFormatter( docDefinition );
+ }
+ return docDefinition;
+
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name calculatePdfHeaderWidths
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Determines the column widths base on the
+ * widths we got from the grid. If the column is drawn
+ * then we have a drawnWidth. If the column is not visible
+ * then we have '*', 'x%' or a width. When columns are
+ * not visible they don't contribute to the overall gridWidth,
+ * so we need to adjust to allow for extra columns
+ *
+ * Our basic heuristic is to take the current gridWidth, plus
+ * numeric columns and call this the base gridwidth.
+ *
+ * To that we add 100 for any '*' column, and x% of the base gridWidth
+ * for any column that is a %
+ *
+ * @param {Grid} grid the grid from which data should be exported
+ * @param {array} exportHeaders array of header information
+ * @returns {object} an array of header widths
+ */
+ calculatePdfHeaderWidths: function ( grid, exportHeaders ) {
+ var baseGridWidth = 0;
+ exportHeaders.forEach( function(value){
+ if (typeof(value.width) === 'number'){
+ baseGridWidth += value.width;
+ }
+ });
+
+ var extraColumns = 0;
+ exportHeaders.forEach( function(value){
+ if (value.width === '*'){
+ extraColumns += 100;
+ }
+ if (typeof(value.width) === 'string' && value.width.match(/(\d)*%/)) {
+ var percent = parseInt(value.width.match(/(\d)*%/)[0]);
+
+ value.width = baseGridWidth * percent / 100;
+ extraColumns += value.width;
+ }
+ });
+
+ var gridWidth = baseGridWidth + extraColumns;
+
+ return exportHeaders.map(function( header ) {
+ return header.width === '*' ? header.width : header.width * grid.options.exporterPdfMaxGridWidth / gridWidth;
+ });
+
+ },
+
+ /**
+ * @ngdoc function
+ * @name formatRowAsPdf
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Renders a row in a format consumable by PDF,
+ * mainly meaning casting everything to a string
+ * @param {exporterService} exporter pass in exporter
+ * @param {array} row the row to be turned into a csv string
+ * @returns {string} a csv-ified version of the row
+ */
+ formatRowAsPdf: function ( exporter ) {
+ return function( row ) {
+ return row.map(exporter.formatFieldAsPdfString);
+ };
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name formatFieldAsCsv
+ * @methodOf ui.grid.exporter.service:uiGridExporterService
+ * @description Renders a single field as a pdf-able field, which
+ * is different from a csv field only in that strings don't have quotes
+ * around them
+ * @param {field} field the field to be turned into a pdf string,
+ * may be of any type
+ * @returns {string} a string-ified version of the field
+ */
+ formatFieldAsPdfString: function (field) {
+ var returnVal;
+ if (field.value == null) { // we want to catch anything null-ish, hence just == not ===
+ returnVal = '';
+ } else if (typeof(field.value) === 'number') {
+ returnVal = field.value.toString();
+ } else if (typeof(field.value) === 'boolean') {
+ returnVal = (field.value ? 'TRUE' : 'FALSE') ;
+ } else if (typeof(field.value) === 'string') {
+ returnVal = field.value.replace(/"/g,'""');
+ } else {
+ returnVal = JSON.stringify(field.value).replace(/^"/,'').replace(/"$/,'');
+ }
+
+ if (field.alignment && typeof(field.alignment) === 'string' ){
+ returnVal = { text: returnVal, alignment: field.alignment };
+ }
+
+ return returnVal;
+ }
+ };
+
+ return service;
+
+ }
+ ]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.exporter.directive:uiGridExporter
+ * @element div
+ * @restrict A
+ *
+ * @description Adds exporter features to grid
+ *
+ * @example
+ <example module="app">
+ <file name="app.js">
+ var app = angular.module('app', ['ui.grid', 'ui.grid.exporter']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.data = [
+ { name: 'Bob', title: 'CEO' },
+ { name: 'Frank', title: 'Lowly Developer' }
+ ];
+
+ $scope.gridOptions = {
+ enableGridMenu: true,
+ exporterMenuCsv: false,
+ columnDefs: [
+ {name: 'name', enableCellEdit: true},
+ {name: 'title', enableCellEdit: true}
+ ],
+ data: $scope.data
+ };
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <div ui-grid="gridOptions" ui-grid-exporter></div>
+ </div>
+ </file>
+ </example>
+ */
+ module.directive('uiGridExporter', ['uiGridExporterConstants', 'uiGridExporterService', 'gridUtil', '$compile',
+ function (uiGridExporterConstants, uiGridExporterService, gridUtil, $compile) {
+ return {
+ replace: true,
+ priority: 0,
+ require: '^uiGrid',
+ scope: false,
+ link: function ($scope, $elm, $attrs, uiGridCtrl) {
+ uiGridExporterService.initializeGrid(uiGridCtrl.grid);
+ uiGridCtrl.grid.exporter.$scope = $scope;
+ }
+ };
+ }
+ ]);
+})();
+
+(function () {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.grouping
+ * @description
+ *
+ * # ui.grid.grouping
+ *
+ * <div class="alert alert-warning" role="alert"><strong>Beta</strong> This feature is ready for testing, but it either hasn't seen a lot of use or has some known bugs.</div>
+ *
+ * This module provides grouping of rows based on the data in them, similar
+ * in concept to excel grouping. You can group multiple columns, resulting in
+ * nested grouping.
+ *
+ * In concept this feature is similar to sorting + grid footer/aggregation, it
+ * sorts the data based on the grouped columns, then creates group rows that
+ * reflect a break in the data. Each of those group rows can have aggregations for
+ * the data within that group.
+ *
+ * This feature leverages treeBase to provide the tree functionality itself,
+ * the key thing this feature does therefore is to set treeLevels on the rows
+ * and insert the group headers.
+ *
+ * Design information:
+ * -------------------
+ *
+ * Each column will get new menu items - group by, and aggregate by. Group by
+ * will cause this column to be sorted (if not already), and will move this column
+ * to the front of the sorted columns (i.e. grouped columns take precedence over
+ * sorted columns). It will respect the sort order already set if there is one,
+ * and it will allow the sorting logic to change that sort order, it just forces
+ * the column to the front of the sorting. You can group by multiple columns, the
+ * logic will add this column to the sorting after any already grouped columns.
+ *
+ * Once a grouping is defined, grouping logic is added to the rowsProcessors. This
+ * will process the rows, identifying a break in the data value, and inserting a grouping row.
+ * Grouping rows have specific attributes on them:
+ *
+ * - internalRow = true: tells us that this isn't a real row, so we can ignore it
+ * from any processing that it looking at core data rows. This is used by the core
+ * logic (or will be one day), as it's not grouping specific
+ * - groupHeader = true: tells us this is a groupHeader. This is used by the grouping logic
+ * to know if this is a groupHeader row or not
+ *
+ * Since the logic is baked into the rowsProcessors, it should get triggered whenever
+ * row order or filtering or anything like that is changed. In order to avoid the row instantiation
+ * time, and to preserve state across invocations, we hold a cache of the rows that we created
+ * last time, and we use them again this time if we can.
+ *
+ * By default rows are collapsed, which means all data rows have their visible property
+ * set to false, and only level 0 group rows are set to visible.
+ *
+ * <br/>
+ * <br/>
+ *
+ * <div doc-module-components="ui.grid.grouping"></div>
+ */
+
+ var module = angular.module('ui.grid.grouping', ['ui.grid', 'ui.grid.treeBase']);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.grouping.constant:uiGridGroupingConstants
+ *
+ * @description constants available in grouping module, this includes
+ * all the constants declared in the treeBase module (these are manually copied
+ * as there isn't an easy way to include constants in another constants file, and
+ * we don't want to make users include treeBase)
+ *
+ */
+ module.constant('uiGridGroupingConstants', {
+ featureName: "grouping",
+ rowHeaderColName: 'treeBaseRowHeaderCol',
+ EXPANDED: 'expanded',
+ COLLAPSED: 'collapsed',
+ aggregation: {
+ COUNT: 'count',
+ SUM: 'sum',
+ MAX: 'max',
+ MIN: 'min',
+ AVG: 'avg'
+ }
+ });
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.grouping.service:uiGridGroupingService
+ *
+ * @description Services for grouping features
+ */
+ module.service('uiGridGroupingService', ['$q', 'uiGridGroupingConstants', 'gridUtil', 'rowSorter', 'GridRow', 'gridClassFactory', 'i18nService', 'uiGridConstants', 'uiGridTreeBaseService',
+ function ($q, uiGridGroupingConstants, gridUtil, rowSorter, GridRow, gridClassFactory, i18nService, uiGridConstants, uiGridTreeBaseService) {
+
+ var service = {
+
+ initializeGrid: function (grid, $scope) {
+ uiGridTreeBaseService.initializeGrid( grid, $scope );
+
+ //add feature namespace and any properties to grid for needed
+ /**
+ * @ngdoc object
+ * @name ui.grid.grouping.grid:grouping
+ *
+ * @description Grid properties and functions added for grouping
+ */
+ grid.grouping = {};
+
+ /**
+ * @ngdoc property
+ * @propertyOf ui.grid.grouping.grid:grouping
+ * @name groupHeaderCache
+ *
+ * @description Cache that holds the group header rows we created last time, we'll
+ * reuse these next time, not least because they hold our expanded states.
+ *
+ * We need to take care with these that they don't become a memory leak, we
+ * create a new cache each time using the values from the old cache. This works
+ * so long as we're creating group rows for invisible rows as well.
+ *
+ * The cache is a nested hash, indexed on the value we grouped by. So if we
+ * grouped by gender then age, we'd maybe have something like:
+ * ```
+ * {
+ * male: {
+ * row: <pointer to the old row>,
+ * children: {
+ * 22: { row: <pointer to the old row> },
+ * 31: { row: <pointer to the old row> }
+ * },
+ * female: {
+ * row: <pointer to the old row>,
+ * children: {
+ * 28: { row: <pointer to the old row> },
+ * 55: { row: <pointer to the old row> }
+ * }
+ * }
+ * ```
+ *
+ * We create new rows for any missing rows, this means that they come in as collapsed.
+ *
+ */
+ grid.grouping.groupHeaderCache = {};
+
+ service.defaultGridOptions(grid.options);
+
+ grid.registerRowsProcessor(service.groupRows, 400);
+
+ grid.registerColumnBuilder( service.groupingColumnBuilder);
+
+ grid.registerColumnsProcessor(service.groupingColumnProcessor, 400);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.grouping.api:PublicApi
+ *
+ * @description Public Api for grouping feature
+ */
+ var publicApi = {
+ events: {
+ grouping: {
+ /**
+ * @ngdoc event
+ * @eventOf ui.grid.grouping.api:PublicApi
+ * @name aggregationChanged
+ * @description raised whenever aggregation is changed, added or removed from a column
+ *
+ * <pre>
+ * gridApi.grouping.on.aggregationChanged(scope,function(col){})
+ * </pre>
+ * @param {gridCol} col the column which on which aggregation changed. The aggregation
+ * type is available as `col.treeAggregation.type`
+ */
+ aggregationChanged: {},
+ /**
+ * @ngdoc event
+ * @eventOf ui.grid.grouping.api:PublicApi
+ * @name groupingChanged
+ * @description raised whenever the grouped columns changes
+ *
+ * <pre>
+ * gridApi.grouping.on.groupingChanged(scope,function(col){})
+ * </pre>
+ * @param {gridCol} col the column which on which grouping changed. The new grouping is
+ * available as `col.grouping`
+ */
+ groupingChanged: {}
+ }
+ },
+ methods: {
+ grouping: {
+ /**
+ * @ngdoc function
+ * @name getGrouping
+ * @methodOf ui.grid.grouping.api:PublicApi
+ * @description Get the grouping configuration for this grid,
+ * used by the saveState feature. Adds expandedState to the information
+ * provided by the internal getGrouping, and removes any aggregations that have a source
+ * of grouping (i.e. will be automatically reapplied when we regroup the column)
+ * Returned grouping is an object
+ * `{ grouping: groupArray, treeAggregations: aggregateArray, expandedState: hash }`
+ * where grouping contains an array of objects:
+ * `{ field: column.field, colName: column.name, groupPriority: column.grouping.groupPriority }`
+ * and aggregations contains an array of objects:
+ * `{ field: column.field, colName: column.name, aggregation: column.grouping.aggregation }`
+ * and expandedState is a hash of the currently expanded nodes
+ *
+ * The groupArray will be sorted by groupPriority.
+ *
+ * @param {boolean} getExpanded whether or not to return the expanded state
+ * @returns {object} grouping configuration
+ */
+ getGrouping: function ( getExpanded ) {
+ var grouping = service.getGrouping(grid);
+
+ grouping.grouping.forEach( function( group ) {
+ group.colName = group.col.name;
+ delete group.col;
+ });
+
+ grouping.aggregations.forEach( function( aggregation ) {
+ aggregation.colName = aggregation.col.name;
+ delete aggregation.col;
+ });
+
+ grouping.aggregations = grouping.aggregations.filter( function( aggregation ){
+ return !aggregation.aggregation.source || aggregation.aggregation.source !== 'grouping';
+ });
+
+ if ( getExpanded ){
+ grouping.rowExpandedStates = service.getRowExpandedStates( grid.grouping.groupingHeaderCache );
+ }
+
+ return grouping;
+ },
+
+ /**
+ * @ngdoc function
+ * @name setGrouping
+ * @methodOf ui.grid.grouping.api:PublicApi
+ * @description Set the grouping configuration for this grid,
+ * used by the saveState feature, but can also be used by any
+ * user to specify a combined grouping and aggregation configuration
+ * @param {object} config the config you want to apply, in the format
+ * provided out by getGrouping
+ */
+ setGrouping: function ( config ) {
+ service.setGrouping(grid, config);
+ },
+
+ /**
+ * @ngdoc function
+ * @name groupColumn
+ * @methodOf ui.grid.grouping.api:PublicApi
+ * @description Adds this column to the existing grouping, at the end of the priority order.
+ * If the column doesn't have a sort, adds one, by default ASC
+ *
+ * This column will move to the left of any non-group columns, the
+ * move is handled in a columnProcessor, so gets called as part of refresh
+ *
+ * @param {string} columnName the name of the column we want to group
+ */
+ groupColumn: function( columnName ) {
+ var column = grid.getColumn(columnName);
+ service.groupColumn(grid, column);
+ },
+
+ /**
+ * @ngdoc function
+ * @name ungroupColumn
+ * @methodOf ui.grid.grouping.api:PublicApi
+ * @description Removes the groupPriority from this column. If the
+ * column was previously aggregated the aggregation will come back.
+ * The sort will remain.
+ *
+ * This column will move to the right of any other group columns, the
+ * move is handled in a columnProcessor, so gets called as part of refresh
+ *
+ * @param {string} columnName the name of the column we want to ungroup
+ */
+ ungroupColumn: function( columnName ) {
+ var column = grid.getColumn(columnName);
+ service.ungroupColumn(grid, column);
+ },
+
+ /**
+ * @ngdoc function
+ * @name clearGrouping
+ * @methodOf ui.grid.grouping.api:PublicApi
+ * @description Clear any grouped columns and any aggregations. Doesn't remove sorting,
+ * as we don't know whether that sorting was added by grouping or was there beforehand
+ *
+ */
+ clearGrouping: function() {
+ service.clearGrouping(grid);
+ },
+
+ /**
+ * @ngdoc function
+ * @name aggregateColumn
+ * @methodOf ui.grid.grouping.api:PublicApi
+ * @description Sets the aggregation type on a column, if the
+ * column is currently grouped then it removes the grouping first.
+ * If the aggregationDef is null then will result in the aggregation
+ * being removed
+ *
+ * @param {string} columnName the column we want to aggregate
+ * @param {string} or {function} aggregationDef one of the recognised types
+ * from uiGridGroupingConstants or a custom aggregation function.
+ * @param {string} aggregationLabel (optional) The label to use for this aggregation.
+ */
+ aggregateColumn: function( columnName, aggregationDef, aggregationLabel){
+ var column = grid.getColumn(columnName);
+ service.aggregateColumn( grid, column, aggregationDef, aggregationLabel);
+ }
+
+ }
+ }
+ };
+
+ grid.api.registerEventsFromObject(publicApi.events);
+
+ grid.api.registerMethodsFromObject(publicApi.methods);
+
+ grid.api.core.on.sortChanged( $scope, service.tidyPriorities);
+
+ },
+
+ defaultGridOptions: function (gridOptions) {
+ //default option to true unless it was explicitly set to false
+ /**
+ * @ngdoc object
+ * @name ui.grid.grouping.api:GridOptions
+ *
+ * @description GridOptions for grouping feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+
+ /**
+ * @ngdoc object
+ * @name enableGrouping
+ * @propertyOf ui.grid.grouping.api:GridOptions
+ * @description Enable row grouping for entire grid.
+ * <br/>Defaults to true
+ */
+ gridOptions.enableGrouping = gridOptions.enableGrouping !== false;
+
+ /**
+ * @ngdoc object
+ * @name groupingShowCounts
+ * @propertyOf ui.grid.grouping.api:GridOptions
+ * @description shows counts on the groupHeader rows. Not that if you are using a cellFilter or a
+ * sortingAlgorithm which relies on a specific format or data type, showing counts may cause that
+ * to break, since the group header rows will always be a string with groupingShowCounts enabled.
+ * <br/>Defaults to true except on columns of type 'date'
+ */
+ gridOptions.groupingShowCounts = gridOptions.groupingShowCounts !== false;
+
+ /**
+ * @ngdoc object
+ * @name groupingNullLabel
+ * @propertyOf ui.grid.grouping.api:GridOptions
+ * @description The string to use for the grouping header row label on rows which contain a null or undefined value in the grouped column.
+ * <br/>Defaults to "Null"
+ */
+ gridOptions.groupingNullLabel = typeof(gridOptions.groupingNullLabel) === 'undefined' ? 'Null' : gridOptions.groupingNullLabel;
+
+ /**
+ * @ngdoc object
+ * @name enableGroupHeaderSelection
+ * @propertyOf ui.grid.grouping.api:GridOptions
+ * @description Allows group header rows to be selected.
+ * <br/>Defaults to false
+ */
+ gridOptions.enableGroupHeaderSelection = gridOptions.enableGroupHeaderSelection === true;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name groupingColumnBuilder
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Sets the grouping defaults based on the columnDefs
+ *
+ * @param {object} colDef columnDef we're basing on
+ * @param {GridCol} col the column we're to update
+ * @param {object} gridOptions the options we should use
+ * @returns {promise} promise for the builder - actually we do it all inline so it's immediately resolved
+ */
+ groupingColumnBuilder: function (colDef, col, gridOptions) {
+ /**
+ * @ngdoc object
+ * @name ui.grid.grouping.api:ColumnDef
+ *
+ * @description ColumnDef for grouping feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions.columnDef gridOptions.columnDefs}
+ */
+
+ /**
+ * @ngdoc object
+ * @name enableGrouping
+ * @propertyOf ui.grid.grouping.api:ColumnDef
+ * @description Enable grouping on this column
+ * <br/>Defaults to true.
+ */
+ if (colDef.enableGrouping === false){
+ return;
+ }
+
+ /**
+ * @ngdoc object
+ * @name grouping
+ * @propertyOf ui.grid.grouping.api:ColumnDef
+ * @description Set the grouping for a column. Format is:
+ * ```
+ * {
+ * groupPriority: <number, starts at 0, if less than 0 or undefined then we're aggregating in this column>
+ * }
+ * ```
+ *
+ * **Note that aggregation used to be included in grouping, but is now separately set on the column via treeAggregation
+ * setting in treeBase**
+ *
+ * We group in the priority order given, this will also put these columns to the high order of the sort irrespective
+ * of the sort priority given them. If there is no sort defined then we sort ascending, if there is a sort defined then
+ * we use that sort.
+ *
+ * If the groupPriority is undefined or less than 0, then we expect to be aggregating, and we look at the
+ * aggregation types to determine what sort of aggregation we can do. Values are in the constants file, but
+ * include SUM, COUNT, MAX, MIN
+ *
+ * groupPriorities should generally be sequential, if they're not then the next time getGrouping is called
+ * we'll renumber them to be sequential.
+ * <br/>Defaults to undefined.
+ */
+
+ if ( typeof(col.grouping) === 'undefined' && typeof(colDef.grouping) !== 'undefined') {
+ col.grouping = angular.copy(colDef.grouping);
+ if ( typeof(col.grouping.groupPriority) !== 'undefined' && col.grouping.groupPriority > -1 ){
+ col.treeAggregationFn = uiGridTreeBaseService.nativeAggregations()[uiGridGroupingConstants.aggregation.COUNT].aggregationFn;
+ col.treeAggregationFinalizerFn = service.groupedFinalizerFn;
+ }
+ } else if (typeof(col.grouping) === 'undefined'){
+ col.grouping = {};
+ }
+
+ if (typeof(col.grouping) !== 'undefined' && typeof(col.grouping.groupPriority) !== 'undefined' && col.grouping.groupPriority >= 0){
+ col.suppressRemoveSort = true;
+ }
+
+ var groupColumn = {
+ name: 'ui.grid.grouping.group',
+ title: i18nService.get().grouping.group,
+ icon: 'ui-grid-icon-indent-right',
+ shown: function () {
+ return typeof(this.context.col.grouping) === 'undefined' ||
+ typeof(this.context.col.grouping.groupPriority) === 'undefined' ||
+ this.context.col.grouping.groupPriority < 0;
+ },
+ action: function () {
+ service.groupColumn( this.context.col.grid, this.context.col );
+ }
+ };
+
+ var ungroupColumn = {
+ name: 'ui.grid.grouping.ungroup',
+ title: i18nService.get().grouping.ungroup,
+ icon: 'ui-grid-icon-indent-left',
+ shown: function () {
+ return typeof(this.context.col.grouping) !== 'undefined' &&
+ typeof(this.context.col.grouping.groupPriority) !== 'undefined' &&
+ this.context.col.grouping.groupPriority >= 0;
+ },
+ action: function () {
+ service.ungroupColumn( this.context.col.grid, this.context.col );
+ }
+ };
+
+ var aggregateRemove = {
+ name: 'ui.grid.grouping.aggregateRemove',
+ title: i18nService.get().grouping.aggregate_remove,
+ shown: function () {
+ return typeof(this.context.col.treeAggregationFn) !== 'undefined';
+ },
+ action: function () {
+ service.aggregateColumn( this.context.col.grid, this.context.col, null);
+ }
+ };
+
+ // generic adder for the aggregation menus, which follow a pattern
+ var addAggregationMenu = function(type, title){
+ title = title || i18nService.get().grouping['aggregate_' + type] || type;
+ var menuItem = {
+ name: 'ui.grid.grouping.aggregate' + type,
+ title: title,
+ shown: function () {
+ return typeof(this.context.col.treeAggregation) === 'undefined' ||
+ typeof(this.context.col.treeAggregation.type) === 'undefined' ||
+ this.context.col.treeAggregation.type !== type;
+ },
+ action: function () {
+ service.aggregateColumn( this.context.col.grid, this.context.col, type);
+ }
+ };
+
+ if (!gridUtil.arrayContainsObjectWithProperty(col.menuItems, 'name', 'ui.grid.grouping.aggregate' + type)) {
+ col.menuItems.push(menuItem);
+ }
+ };
+
+ /**
+ * @ngdoc object
+ * @name groupingShowGroupingMenu
+ * @propertyOf ui.grid.grouping.api:ColumnDef
+ * @description Show the grouping (group and ungroup items) menu on this column
+ * <br/>Defaults to true.
+ */
+ if ( col.colDef.groupingShowGroupingMenu !== false ){
+ if (!gridUtil.arrayContainsObjectWithProperty(col.menuItems, 'name', 'ui.grid.grouping.group')) {
+ col.menuItems.push(groupColumn);
+ }
+
+ if (!gridUtil.arrayContainsObjectWithProperty(col.menuItems, 'name', 'ui.grid.grouping.ungroup')) {
+ col.menuItems.push(ungroupColumn);
+ }
+ }
+
+
+ /**
+ * @ngdoc object
+ * @name groupingShowAggregationMenu
+ * @propertyOf ui.grid.grouping.api:ColumnDef
+ * @description Show the aggregation menu on this column
+ * <br/>Defaults to true.
+ */
+ if ( col.colDef.groupingShowAggregationMenu !== false ){
+ angular.forEach(uiGridTreeBaseService.nativeAggregations(), function(aggregationDef, name){
+ addAggregationMenu(name);
+ });
+ angular.forEach(gridOptions.treeCustomAggregations, function(aggregationDef, name){
+ addAggregationMenu(name, aggregationDef.menuTitle);
+ });
+
+ if (!gridUtil.arrayContainsObjectWithProperty(col.menuItems, 'name', 'ui.grid.grouping.aggregateRemove')) {
+ col.menuItems.push(aggregateRemove);
+ }
+ }
+ },
+
+
+
+
+ /**
+ * @ngdoc function
+ * @name groupingColumnProcessor
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Moves the columns around based on which are grouped
+ *
+ * @param {array} columns the columns to consider rendering
+ * @param {array} rows the grid rows, which we don't use but are passed to us
+ * @returns {array} updated columns array
+ */
+ groupingColumnProcessor: function( columns, rows ) {
+ var grid = this;
+
+ columns = service.moveGroupColumns(this, columns, rows);
+ return columns;
+ },
+
+ /**
+ * @ngdoc function
+ * @name groupedFinalizerFn
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Used on group columns to display the rendered value and optionally
+ * display the count of rows.
+ *
+ * @param {aggregation} the aggregation entity for a grouped column
+ */
+ groupedFinalizerFn: function( aggregation ){
+ var col = this;
+
+ if ( typeof(aggregation.groupVal) !== 'undefined') {
+ aggregation.rendered = aggregation.groupVal;
+ if ( col.grid.options.groupingShowCounts && col.colDef.type !== 'date' ){
+ aggregation.rendered += (' (' + aggregation.value + ')');
+ }
+ } else {
+ aggregation.rendered = null;
+ }
+ },
+
+ /**
+ * @ngdoc function
+ * @name moveGroupColumns
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Moves the column order so that the grouped columns are lined up
+ * to the left (well, unless you're RTL, then it's the right). By doing this in
+ * the columnsProcessor, we make it transient - when the column is ungrouped it'll
+ * go back to where it was.
+ *
+ * Does nothing if the option `moveGroupColumns` is set to false.
+ *
+ * @param {Grid} grid grid object
+ * @param {array} columns the columns that we should process/move
+ * @param {array} rows the grid rows
+ * @returns {array} updated columns
+ */
+ moveGroupColumns: function( grid, columns, rows ){
+ if ( grid.options.moveGroupColumns === false){
+ return columns;
+ }
+
+ columns.forEach( function(column, index){
+ // position used to make stable sort in moveGroupColumns
+ column.groupingPosition = index;
+ });
+
+ columns.sort(function(a, b){
+ var a_group, b_group;
+ if (a.isRowHeader){
+ a_group = -1000;
+ }
+ else if ( typeof(a.grouping) === 'undefined' || typeof(a.grouping.groupPriority) === 'undefined' || a.grouping.groupPriority < 0){
+ a_group = null;
+ } else {
+ a_group = a.grouping.groupPriority;
+ }
+
+ if (b.isRowHeader){
+ b_group = -1000;
+ }
+ else if ( typeof(b.grouping) === 'undefined' || typeof(b.grouping.groupPriority) === 'undefined' || b.grouping.groupPriority < 0){
+ b_group = null;
+ } else {
+ b_group = b.grouping.groupPriority;
+ }
+
+ // groups get sorted to the top
+ if ( a_group !== null && b_group === null) { return -1; }
+ if ( b_group !== null && a_group === null) { return 1; }
+ if ( a_group !== null && b_group !== null) {return a_group - b_group; }
+
+ return a.groupingPosition - b.groupingPosition;
+ });
+
+ columns.forEach( function(column, index) {
+ delete column.groupingPosition;
+ });
+
+ return columns;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name groupColumn
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Adds this column to the existing grouping, at the end of the priority order.
+ * If the column doesn't have a sort, adds one, by default ASC
+ *
+ * This column will move to the left of any non-group columns, the
+ * move is handled in a columnProcessor, so gets called as part of refresh
+ *
+ * @param {Grid} grid grid object
+ * @param {GridCol} column the column we want to group
+ */
+ groupColumn: function( grid, column){
+ if ( typeof(column.grouping) === 'undefined' ){
+ column.grouping = {};
+ }
+
+ // set the group priority to the next number in the hierarchy
+ var existingGrouping = service.getGrouping( grid );
+ column.grouping.groupPriority = existingGrouping.grouping.length;
+
+ // add sort if not present
+ if ( !column.sort ){
+ column.sort = { direction: uiGridConstants.ASC };
+ } else if ( typeof(column.sort.direction) === 'undefined' || column.sort.direction === null ){
+ column.sort.direction = uiGridConstants.ASC;
+ }
+
+ column.treeAggregation = { type: uiGridGroupingConstants.aggregation.COUNT, source: 'grouping' };
+ column.treeAggregationFn = uiGridTreeBaseService.nativeAggregations()[uiGridGroupingConstants.aggregation.COUNT].aggregationFn;
+ column.treeAggregationFinalizerFn = service.groupedFinalizerFn;
+
+ grid.api.grouping.raise.groupingChanged(column);
+ // This indirectly calls service.tidyPriorities( grid );
+ grid.api.core.raise.sortChanged(grid, grid.getColumnSorting());
+
+ grid.queueGridRefresh();
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name ungroupColumn
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Removes the groupPriority from this column. If the
+ * column was previously aggregated the aggregation will come back.
+ * The sort will remain.
+ *
+ * This column will move to the right of any other group columns, the
+ * move is handled in a columnProcessor, so gets called as part of refresh
+ *
+ * @param {Grid} grid grid object
+ * @param {GridCol} column the column we want to ungroup
+ */
+ ungroupColumn: function( grid, column){
+ if ( typeof(column.grouping) === 'undefined' ){
+ return;
+ }
+
+ delete column.grouping.groupPriority;
+ delete column.treeAggregation;
+ delete column.customTreeAggregationFinalizer;
+
+ service.tidyPriorities( grid );
+
+ grid.api.grouping.raise.groupingChanged(column);
+
+ grid.queueGridRefresh();
+ },
+
+ /**
+ * @ngdoc function
+ * @name aggregateColumn
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Sets the aggregation type on a column, if the
+ * column is currently grouped then it removes the grouping first.
+ *
+ * @param {Grid} grid grid object
+ * @param {GridCol} column the column we want to aggregate
+ * @param {string} one of the recognised types from uiGridGroupingConstants or one of the custom aggregations from gridOptions
+ */
+ aggregateColumn: function( grid, column, aggregationType){
+
+ if (typeof(column.grouping) !== 'undefined' && typeof(column.grouping.groupPriority) !== 'undefined' && column.grouping.groupPriority >= 0){
+ service.ungroupColumn( grid, column );
+ }
+
+ var aggregationDef = {};
+ if ( typeof(grid.options.treeCustomAggregations[aggregationType]) !== 'undefined' ){
+ aggregationDef = grid.options.treeCustomAggregations[aggregationType];
+ } else if ( typeof(uiGridTreeBaseService.nativeAggregations()[aggregationType]) !== 'undefined' ){
+ aggregationDef = uiGridTreeBaseService.nativeAggregations()[aggregationType];
+ }
+
+ column.treeAggregation = { type: aggregationType, label: i18nService.get().aggregation[aggregationDef.label] || aggregationDef.label };
+ column.treeAggregationFn = aggregationDef.aggregationFn;
+ column.treeAggregationFinalizerFn = aggregationDef.finalizerFn;
+
+ grid.api.grouping.raise.aggregationChanged(column);
+
+ grid.queueGridRefresh();
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name setGrouping
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Set the grouping based on a config object, used by the save state feature
+ * (more specifically, by the restore function in that feature )
+ *
+ * @param {Grid} grid grid object
+ * @param {object} config the config we want to set, same format as that returned by getGrouping
+ */
+ setGrouping: function ( grid, config ){
+ if ( typeof(config) === 'undefined' ){
+ return;
+ }
+
+ // first remove any existing grouping
+ service.clearGrouping(grid);
+
+ if ( config.grouping && config.grouping.length && config.grouping.length > 0 ){
+ config.grouping.forEach( function( group ) {
+ var col = grid.getColumn(group.colName);
+
+ if ( col ) {
+ service.groupColumn( grid, col );
+ }
+ });
+ }
+
+ if ( config.aggregations && config.aggregations.length ){
+ config.aggregations.forEach( function( aggregation ) {
+ var col = grid.getColumn(aggregation.colName);
+
+ if ( col ) {
+ service.aggregateColumn( grid, col, aggregation.aggregation.type );
+ }
+ });
+ }
+
+ if ( config.rowExpandedStates ){
+ service.applyRowExpandedStates( grid.grouping.groupingHeaderCache, config.rowExpandedStates );
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name clearGrouping
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Clear any grouped columns and any aggregations. Doesn't remove sorting,
+ * as we don't know whether that sorting was added by grouping or was there beforehand
+ *
+ * @param {Grid} grid grid object
+ */
+ clearGrouping: function( grid ) {
+ var currentGrouping = service.getGrouping(grid);
+
+ if ( currentGrouping.grouping.length > 0 ){
+ currentGrouping.grouping.forEach( function( group ) {
+ if (!group.col){
+ // should have a group.colName if there's no col
+ group.col = grid.getColumn(group.colName);
+ }
+ service.ungroupColumn(grid, group.col);
+ });
+ }
+
+ if ( currentGrouping.aggregations.length > 0 ){
+ currentGrouping.aggregations.forEach( function( aggregation ){
+ if (!aggregation.col){
+ // should have a group.colName if there's no col
+ aggregation.col = grid.getColumn(aggregation.colName);
+ }
+ service.aggregateColumn(grid, aggregation.col, null);
+ });
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name tidyPriorities
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Renumbers groupPriority and sortPriority such that
+ * groupPriority is contiguous, and sortPriority either matches
+ * groupPriority (for group columns), and otherwise is contiguous and
+ * higher than groupPriority.
+ *
+ * @param {Grid} grid grid object
+ */
+ tidyPriorities: function( grid ){
+ // if we're called from sortChanged, grid is in this, not passed as param, the param can be a column or undefined
+ if ( ( typeof(grid) === 'undefined' || typeof(grid.grid) !== 'undefined' ) && typeof(this.grid) !== 'undefined' ) {
+ grid = this.grid;
+ }
+
+ var groupArray = [];
+ var sortArray = [];
+
+ grid.columns.forEach( function(column, index){
+ if ( typeof(column.grouping) !== 'undefined' && typeof(column.grouping.groupPriority) !== 'undefined' && column.grouping.groupPriority >= 0){
+ groupArray.push(column);
+ } else if ( typeof(column.sort) !== 'undefined' && typeof(column.sort.priority) !== 'undefined' && column.sort.priority >= 0){
+ sortArray.push(column);
+ }
+ });
+
+ groupArray.sort(function(a, b){ return a.grouping.groupPriority - b.grouping.groupPriority; });
+ groupArray.forEach( function(column, index){
+ column.grouping.groupPriority = index;
+ column.suppressRemoveSort = true;
+ if ( typeof(column.sort) === 'undefined'){
+ column.sort = {};
+ }
+ column.sort.priority = index;
+ });
+
+ var i = groupArray.length;
+ sortArray.sort(function(a, b){ return a.sort.priority - b.sort.priority; });
+ sortArray.forEach( function(column, index){
+ column.sort.priority = i;
+ column.suppressRemoveSort = column.colDef.suppressRemoveSort;
+ i++;
+ });
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name groupRows
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description The rowProcessor that creates the groupHeaders (i.e. does
+ * the actual grouping).
+ *
+ * Assumes it is always called after the sorting processor, guaranteed by the priority setting
+ *
+ * Processes all the rows in order, inserting a groupHeader row whenever there is a change
+ * in value of a grouped row, based on the sortAlgorithm used for the column. The group header row
+ * is looked up in the groupHeaderCache, and used from there if there is one. The entity is reset
+ * to {} if one is found.
+ *
+ * As it processes it maintains a `processingState` array. This records, for each level of grouping we're
+ * working with, the following information:
+ * ```
+ * {
+ * fieldName: name,
+ * col: col,
+ * initialised: boolean,
+ * currentValue: value,
+ * currentRow: gridRow,
+ * }
+ * ```
+ * We look for changes in the currentValue at any of the levels. Where we find a change we:
+ *
+ * - create a new groupHeader row in the array
+ *
+ * @param {array} renderableRows the rows we want to process, usually the output from the previous rowProcessor
+ * @returns {array} the updated rows, including our new group rows
+ */
+ groupRows: function( renderableRows ) {
+ if (renderableRows.length === 0){
+ return renderableRows;
+ }
+
+ var grid = this;
+ grid.grouping.oldGroupingHeaderCache = grid.grouping.groupingHeaderCache || {};
+ grid.grouping.groupingHeaderCache = {};
+
+ var processingState = service.initialiseProcessingState( grid );
+
+ // processes each of the fields we are grouping by, checks if the value has changed and inserts a groupHeader
+ // Broken out as shouldn't create functions in a loop.
+ var updateProcessingState = function( groupFieldState, stateIndex ) {
+ var fieldValue = grid.getCellValue(row, groupFieldState.col);
+
+ // look for change of value - and insert a header
+ if ( !groupFieldState.initialised || rowSorter.getSortFn(grid, groupFieldState.col, renderableRows)(fieldValue, groupFieldState.currentValue) !== 0 ){
+ service.insertGroupHeader( grid, renderableRows, i, processingState, stateIndex );
+ i++;
+ }
+ };
+
+ // use a for loop because it's tolerant of the array length changing whilst we go - we can
+ // manipulate the iterator when we insert groupHeader rows
+ for (var i = 0; i < renderableRows.length; i++ ){
+ var row = renderableRows[i];
+
+ if ( row.visible ){
+ processingState.forEach( updateProcessingState );
+ }
+ }
+
+ delete grid.grouping.oldGroupingHeaderCache;
+ return renderableRows;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name initialiseProcessingState
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Creates the processing state array that is used
+ * for groupRows.
+ *
+ * @param {Grid} grid grid object
+ * @returns {array} an array in the format described in the groupRows method,
+ * initialised with blank values
+ */
+ initialiseProcessingState: function( grid ){
+ var processingState = [];
+ var columnSettings = service.getGrouping( grid );
+
+ columnSettings.grouping.forEach( function( groupItem, index){
+ processingState.push({
+ fieldName: groupItem.field,
+ col: groupItem.col,
+ initialised: false,
+ currentValue: null,
+ currentRow: null
+ });
+ });
+
+ return processingState;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name getGrouping
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Get the grouping settings from the columns. As a side effect
+ * this always renumbers the grouping starting at 0
+ * @param {Grid} grid grid object
+ * @returns {array} an array of the group fields, in order of priority
+ */
+ getGrouping: function( grid ){
+ var groupArray = [];
+ var aggregateArray = [];
+
+ // get all the grouping
+ grid.columns.forEach( function(column, columnIndex){
+ if ( column.grouping ){
+ if ( typeof(column.grouping.groupPriority) !== 'undefined' && column.grouping.groupPriority >= 0){
+ groupArray.push({ field: column.field, col: column, groupPriority: column.grouping.groupPriority, grouping: column.grouping });
+ }
+ }
+ if ( column.treeAggregation && column.treeAggregation.type ){
+ aggregateArray.push({ field: column.field, col: column, aggregation: column.treeAggregation });
+ }
+ });
+
+ // sort grouping into priority order
+ groupArray.sort( function(a, b){
+ return a.groupPriority - b.groupPriority;
+ });
+
+ // renumber the priority in case it was somewhat messed up, then remove the grouping reference
+ groupArray.forEach( function( group, index) {
+ group.grouping.groupPriority = index;
+ group.groupPriority = index;
+ delete group.grouping;
+ });
+
+ return { grouping: groupArray, aggregations: aggregateArray };
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name insertGroupHeader
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Create a group header row, and link it to the various configuration
+ * items that we use.
+ *
+ * Look for the row in the oldGroupingHeaderCache, write the row into the new groupingHeaderCache.
+ *
+ * @param {Grid} grid grid object
+ * @param {array} renderableRows the rows that we are processing
+ * @param {number} rowIndex the row we were up to processing
+ * @param {array} processingState the current processing state
+ * @param {number} stateIndex the processing state item that we were on when we triggered a new group header -
+ * i.e. the column that we want to create a header for
+ */
+ insertGroupHeader: function( grid, renderableRows, rowIndex, processingState, stateIndex ) {
+ // set the value that caused the end of a group into the header row and the processing state
+ var fieldName = processingState[stateIndex].fieldName;
+ var col = processingState[stateIndex].col;
+
+ var newValue = grid.getCellValue(renderableRows[rowIndex], col);
+ var newDisplayValue = newValue;
+ if ( typeof(newValue) === 'undefined' || newValue === null ) {
+ newDisplayValue = grid.options.groupingNullLabel;
+ }
+
+ var cacheItem = grid.grouping.oldGroupingHeaderCache;
+ for ( var i = 0; i < stateIndex; i++ ){
+ if ( cacheItem && cacheItem[processingState[i].currentValue] ){
+ cacheItem = cacheItem[processingState[i].currentValue].children;
+ }
+ }
+
+ var headerRow;
+ if ( cacheItem && cacheItem[newValue]){
+ headerRow = cacheItem[newValue].row;
+ headerRow.entity = {};
+ } else {
+ headerRow = new GridRow( {}, null, grid );
+ gridClassFactory.rowTemplateAssigner.call(grid, headerRow);
+ }
+
+ headerRow.entity['$$' + processingState[stateIndex].col.uid] = { groupVal: newDisplayValue };
+ headerRow.treeLevel = stateIndex;
+ headerRow.groupHeader = true;
+ headerRow.internalRow = true;
+ headerRow.enableCellEdit = false;
+ headerRow.enableSelection = grid.options.enableGroupHeaderSelection;
+ processingState[stateIndex].initialised = true;
+ processingState[stateIndex].currentValue = newValue;
+ processingState[stateIndex].currentRow = headerRow;
+
+ // set all processing states below this one to not be initialised - change of this state
+ // means all those need to start again
+ service.finaliseProcessingState( processingState, stateIndex + 1);
+
+ // insert our new header row
+ renderableRows.splice(rowIndex, 0, headerRow);
+
+ // add our new header row to the cache
+ cacheItem = grid.grouping.groupingHeaderCache;
+ for ( i = 0; i < stateIndex; i++ ){
+ cacheItem = cacheItem[processingState[i].currentValue].children;
+ }
+ cacheItem[newValue] = { row: headerRow, children: {} };
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name finaliseProcessingState
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Set all processing states lower than the one that had a break in value to
+ * no longer be initialised. Render the counts into the entity ready for display.
+ *
+ * @param {Grid} grid grid object
+ * @param {array} processingState the current processing state
+ * @param {number} stateIndex the processing state item that we were on when we triggered a new group header, all
+ * processing states after this need to be finalised
+ */
+ finaliseProcessingState: function( processingState, stateIndex ){
+ for ( var i = stateIndex; i < processingState.length; i++){
+ processingState[i].initialised = false;
+ processingState[i].currentRow = null;
+ processingState[i].currentValue = null;
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name getRowExpandedStates
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Extract the groupHeaderCache hash, pulling out only the states.
+ *
+ * The example below shows a grid that is grouped by gender then age
+ *
+ * <pre>
+ * {
+ * male: {
+ * state: 'expanded',
+ * children: {
+ * 22: { state: 'expanded' },
+ * 30: { state: 'collapsed' }
+ * }
+ * },
+ * female: {
+ * state: 'expanded',
+ * children: {
+ * 28: { state: 'expanded' },
+ * 55: { state: 'collapsed' }
+ * }
+ * }
+ * }
+ * </pre>
+ *
+ * @param {Grid} grid grid object
+ * @returns {hash} the expanded states as a hash
+ */
+ getRowExpandedStates: function(treeChildren){
+ if ( typeof(treeChildren) === 'undefined' ){
+ return {};
+ }
+
+ var newChildren = {};
+
+ angular.forEach( treeChildren, function( value, key ){
+ newChildren[key] = { state: value.row.treeNode.state };
+ if ( value.children ){
+ newChildren[key].children = service.getRowExpandedStates( value.children );
+ } else {
+ newChildren[key].children = {};
+ }
+ });
+
+ return newChildren;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name applyRowExpandedStates
+ * @methodOf ui.grid.grouping.service:uiGridGroupingService
+ * @description Take a hash in the format as created by getRowExpandedStates,
+ * and apply it to the grid.grouping.groupHeaderCache.
+ *
+ * Takes a treeSubset, and applies to a treeSubset - so can be called
+ * recursively.
+ *
+ * @param {object} currentNode can be grid.grouping.groupHeaderCache, or any of
+ * the children of that hash
+ * @returns {hash} expandedStates can be the full expanded states, or children
+ * of that expanded states (which hopefully matches the subset of the groupHeaderCache)
+ */
+ applyRowExpandedStates: function( currentNode, expandedStates ){
+ if ( typeof(expandedStates) === 'undefined' ){
+ return;
+ }
+
+ angular.forEach(expandedStates, function( value, key ) {
+ if ( currentNode[key] ){
+ currentNode[key].row.treeNode.state = value.state;
+
+ if (value.children && currentNode[key].children){
+ service.applyRowExpandedStates( currentNode[key].children, value.children );
+ }
+ }
+ });
+ }
+
+
+ };
+
+ return service;
+
+ }]);
+
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.grouping.directive:uiGridGrouping
+ * @element div
+ * @restrict A
+ *
+ * @description Adds grouping features to grid
+ *
+ * @example
+ <example module="app">
+ <file name="app.js">
+ var app = angular.module('app', ['ui.grid', 'ui.grid.grouping']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.data = [
+ { name: 'Bob', title: 'CEO' },
+ { name: 'Frank', title: 'Lowly Developer' }
+ ];
+
+ $scope.columnDefs = [
+ {name: 'name', enableCellEdit: true},
+ {name: 'title', enableCellEdit: true}
+ ];
+
+ $scope.gridOptions = { columnDefs: $scope.columnDefs, data: $scope.data };
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <div ui-grid="gridOptions" ui-grid-grouping></div>
+ </div>
+ </file>
+ </example>
+ */
+ module.directive('uiGridGrouping', ['uiGridGroupingConstants', 'uiGridGroupingService', '$templateCache',
+ function (uiGridGroupingConstants, uiGridGroupingService, $templateCache) {
+ return {
+ replace: true,
+ priority: 0,
+ require: '^uiGrid',
+ scope: false,
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ if (uiGridCtrl.grid.options.enableGrouping !== false){
+ uiGridGroupingService.initializeGrid(uiGridCtrl.grid, $scope);
+ }
+ },
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ }
+ };
+ }
+ };
+ }]);
+
+})();
+
+(function () {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.importer
+ * @description
+ *
+ * # ui.grid.importer
+ *
+ * <div class="alert alert-success" role="alert"><strong>Stable</strong> This feature is stable. There should no longer be breaking api changes without a deprecation warning.</div>
+ *
+ * This module provides the ability to import data into the grid. It
+ * uses the column defs to work out which data belongs in which column,
+ * and creates entities from a configured class (typically a $resource).
+ *
+ * If the rowEdit feature is enabled, it also calls save on those newly
+ * created objects, and then displays any errors in the imported data.
+ *
+ * Currently the importer imports only CSV and json files, although provision has been
+ * made to process other file formats, and these can be added over time.
+ *
+ * For json files, the properties within each object in the json must match the column names
+ * (to put it another way, the importer doesn't process the json, it just copies the objects
+ * within the json into a new instance of the specified object type)
+ *
+ * For CSV import, the default column identification relies on each column in the
+ * header row matching a column.name or column.displayName. Optionally, a column identification
+ * callback can be used. This allows matching using other attributes, which is particularly
+ * useful if your application has internationalised column headings (i.e. the headings that
+ * the user sees don't match the column names).
+ *
+ * The importer makes use of the grid menu as the UI for requesting an
+ * import.
+ *
+ * <div ui-grid-importer></div>
+ */
+
+ var module = angular.module('ui.grid.importer', ['ui.grid']);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.importer.constant:uiGridImporterConstants
+ *
+ * @description constants available in importer module
+ */
+
+ module.constant('uiGridImporterConstants', {
+ featureName: 'importer'
+ });
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.importer.service:uiGridImporterService
+ *
+ * @description Services for importer feature
+ */
+ module.service('uiGridImporterService', ['$q', 'uiGridConstants', 'uiGridImporterConstants', 'gridUtil', '$compile', '$interval', 'i18nService', '$window',
+ function ($q, uiGridConstants, uiGridImporterConstants, gridUtil, $compile, $interval, i18nService, $window) {
+
+ var service = {
+
+ initializeGrid: function ($scope, grid) {
+
+ //add feature namespace and any properties to grid for needed state
+ grid.importer = {
+ $scope: $scope
+ };
+
+ this.defaultGridOptions(grid.options);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.importer.api:PublicApi
+ *
+ * @description Public Api for importer feature
+ */
+ var publicApi = {
+ events: {
+ importer: {
+ }
+ },
+ methods: {
+ importer: {
+ /**
+ * @ngdoc function
+ * @name importFile
+ * @methodOf ui.grid.importer.api:PublicApi
+ * @description Imports a file into the grid using the file object
+ * provided. Bypasses the grid menu
+ * @param {File} fileObject the file we want to import, as a javascript
+ * File object
+ */
+ importFile: function ( fileObject ) {
+ service.importThisFile( grid, fileObject );
+ }
+ }
+ }
+ };
+
+ grid.api.registerEventsFromObject(publicApi.events);
+
+ grid.api.registerMethodsFromObject(publicApi.methods);
+
+ if ( grid.options.enableImporter && grid.options.importerShowMenu ){
+ if ( grid.api.core.addToGridMenu ){
+ service.addToMenu( grid );
+ } else {
+ // order of registration is not guaranteed, register in a little while
+ $interval( function() {
+ if (grid.api.core.addToGridMenu){
+ service.addToMenu( grid );
+ }
+ }, 100, 1);
+ }
+ }
+ },
+
+
+ defaultGridOptions: function (gridOptions) {
+ //default option to true unless it was explicitly set to false
+ /**
+ * @ngdoc object
+ * @name ui.grid.importer.api:GridOptions
+ *
+ * @description GridOptions for importer feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+
+ /**
+ * @ngdoc property
+ * @propertyOf ui.grid.importer.api:GridOptions
+ * @name enableImporter
+ * @description Whether or not importer is enabled. Automatically set
+ * to false if the user's browser does not support the required fileApi.
+ * Otherwise defaults to true.
+ *
+ */
+ if (gridOptions.enableImporter || gridOptions.enableImporter === undefined) {
+ if ( !($window.hasOwnProperty('File') && $window.hasOwnProperty('FileReader') && $window.hasOwnProperty('FileList') && $window.hasOwnProperty('Blob')) ) {
+ gridUtil.logError('The File APIs are not fully supported in this browser, grid importer cannot be used.');
+ gridOptions.enableImporter = false;
+ } else {
+ gridOptions.enableImporter = true;
+ }
+ } else {
+ gridOptions.enableImporter = false;
+ }
+
+ /**
+ * @ngdoc method
+ * @name importerProcessHeaders
+ * @methodOf ui.grid.importer.api:GridOptions
+ * @description A callback function that will process headers using custom
+ * logic. Set this callback function if the headers that your user will provide in their
+ * import file don't necessarily match the grid header or field names. This might commonly
+ * occur where your application is internationalised, and therefore the field names
+ * that the user recognises are in a different language than the field names that
+ * ui-grid knows about.
+ *
+ * Defaults to the internal `processHeaders` method, which seeks to match using both
+ * displayName and column.name. Any non-matching columns are discarded.
+ *
+ * Your callback routine should respond by processing the header array, and returning an array
+ * of matching column names. A null value in any given position means "don't import this column"
+ *
+ * <pre>
+ * gridOptions.importerProcessHeaders: function( headerArray ) {
+ * var myHeaderColumns = [];
+ * var thisCol;
+ * headerArray.forEach( function( value, index ) {
+ * thisCol = mySpecialLookupFunction( value );
+ * myHeaderColumns.push( thisCol.name );
+ * });
+ *
+ * return myHeaderCols;
+ * })
+ * </pre>
+ * @param {Grid} grid the grid we're importing into
+ * @param {array} headerArray an array of the text from the first row of the csv file,
+ * which you need to match to column.names
+ * @returns {array} array of matching column names, in the same order as the headerArray
+ *
+ */
+ gridOptions.importerProcessHeaders = gridOptions.importerProcessHeaders || service.processHeaders;
+
+ /**
+ * @ngdoc method
+ * @name importerHeaderFilter
+ * @methodOf ui.grid.importer.api:GridOptions
+ * @description A callback function that will filter (usually translate) a single
+ * header. Used when you want to match the passed in column names to the column
+ * displayName after the header filter.
+ *
+ * Your callback routine needs to return the filtered header value.
+ * <pre>
+ * gridOptions.importerHeaderFilter: function( displayName ) {
+ * return $translate.instant( displayName );
+ * })
+ * </pre>
+ *
+ * or:
+ * <pre>
+ * gridOptions.importerHeaderFilter: $translate.instant
+ * </pre>
+ * @param {string} displayName the displayName that we'd like to translate
+ * @returns {string} the translated name
+ *
+ */
+ gridOptions.importerHeaderFilter = gridOptions.importerHeaderFilter || function( displayName ) { return displayName; };
+
+ /**
+ * @ngdoc method
+ * @name importerErrorCallback
+ * @methodOf ui.grid.importer.api:GridOptions
+ * @description A callback function that provides custom error handling, rather
+ * than the standard grid behaviour of an alert box and a console message. You
+ * might use this to internationalise the console log messages, or to write to a
+ * custom logging routine that returned errors to the server.
+ *
+ * <pre>
+ * gridOptions.importerErrorCallback: function( grid, errorKey, consoleMessage, context ) {
+ * myUserDisplayRoutine( errorKey );
+ * myLoggingRoutine( consoleMessage, context );
+ * })
+ * </pre>
+ * @param {Grid} grid the grid we're importing into, may be useful if you're positioning messages
+ * in some way
+ * @param {string} errorKey one of the i18n keys the importer can return - importer.noHeaders,
+ * importer.noObjects, importer.invalidCsv, importer.invalidJson, importer.jsonNotArray
+ * @param {string} consoleMessage the English console message that importer would have written
+ * @param {object} context the context data that importer would have appended to that console message,
+ * often the file content itself or the element that is in error
+ *
+ */
+ if ( !gridOptions.importerErrorCallback || typeof(gridOptions.importerErrorCallback) !== 'function' ){
+ delete gridOptions.importerErrorCallback;
+ }
+
+ /**
+ * @ngdoc method
+ * @name importerDataAddCallback
+ * @methodOf ui.grid.importer.api:GridOptions
+ * @description A mandatory callback function that adds data to the source data array. The grid
+ * generally doesn't add rows to the source data array, it is tidier to handle this through a user
+ * callback.
+ *
+ * <pre>
+ * gridOptions.importerDataAddCallback: function( grid, newObjects ) {
+ * $scope.myData = $scope.myData.concat( newObjects );
+ * })
+ * </pre>
+ * @param {Grid} grid the grid we're importing into, may be useful in some way
+ * @param {array} newObjects an array of new objects that you should add to your data
+ *
+ */
+ if ( gridOptions.enableImporter === true && !gridOptions.importerDataAddCallback ) {
+ gridUtil.logError("You have not set an importerDataAddCallback, importer is disabled");
+ gridOptions.enableImporter = false;
+ }
+
+ /**
+ * @ngdoc object
+ * @name importerNewObject
+ * @propertyOf ui.grid.importer.api:GridOptions
+ * @description An object on which we call `new` to create each new row before inserting it into
+ * the data array. Typically this would be a $resource entity, which means that if you're using
+ * the rowEdit feature, you can directly call save on this entity when the save event is triggered.
+ *
+ * Defaults to a vanilla javascript object
+ *
+ * @example
+ * <pre>
+ * gridOptions.importerNewObject = MyRes;
+ * </pre>
+ *
+ */
+
+ /**
+ * @ngdoc property
+ * @propertyOf ui.grid.importer.api:GridOptions
+ * @name importerShowMenu
+ * @description Whether or not to show an item in the grid menu. Defaults to true.
+ *
+ */
+ gridOptions.importerShowMenu = gridOptions.importerShowMenu !== false;
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.importer.api:GridOptions
+ * @name importerObjectCallback
+ * @description A callback that massages the data for each object. For example,
+ * you might have data stored as a code value, but display the decode. This callback
+ * can be used to change the decoded value back into a code. Defaults to doing nothing.
+ * @param {Grid} grid in case you need it
+ * @param {object} newObject the new object as importer has created it, modify it
+ * then return the modified version
+ * @returns {object} the modified object
+ * @example
+ * <pre>
+ * gridOptions.importerObjectCallback = function ( grid, newObject ) {
+ * switch newObject.status {
+ * case 'Active':
+ * newObject.status = 1;
+ * break;
+ * case 'Inactive':
+ * newObject.status = 2;
+ * break;
+ * }
+ * return newObject;
+ * };
+ * </pre>
+ */
+ gridOptions.importerObjectCallback = gridOptions.importerObjectCallback || function( grid, newObject ) { return newObject; };
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name addToMenu
+ * @methodOf ui.grid.importer.service:uiGridImporterService
+ * @description Adds import menu item to the grid menu,
+ * allowing the user to request import of a file
+ * @param {Grid} grid the grid into which data should be imported
+ */
+ addToMenu: function ( grid ) {
+ grid.api.core.addToGridMenu( grid, [
+ {
+ title: i18nService.getSafeText('gridMenu.importerTitle'),
+ order: 150
+ },
+ {
+ templateUrl: 'ui-grid/importerMenuItemContainer',
+ action: function ($event) {
+ this.grid.api.importer.importAFile( grid );
+ },
+ order: 151
+ }
+ ]);
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name importThisFile
+ * @methodOf ui.grid.importer.service:uiGridImporterService
+ * @description Imports the provided file into the grid using the file object
+ * provided. Bypasses the grid menu
+ * @param {Grid} grid the grid we're importing into
+ * @param {File} fileObject the file we want to import, as returned from the File
+ * javascript object
+ */
+ importThisFile: function ( grid, fileObject ) {
+ if (!fileObject){
+ gridUtil.logError( 'No file object provided to importThisFile, should be impossible, aborting');
+ return;
+ }
+
+ var reader = new FileReader();
+
+ switch ( fileObject.type ){
+ case 'application/json':
+ reader.onload = service.importJsonClosure( grid );
+ break;
+ default:
+ reader.onload = service.importCsvClosure( grid );
+ break;
+ }
+
+ reader.readAsText( fileObject );
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name importJson
+ * @methodOf ui.grid.importer.service:uiGridImporterService
+ * @description Creates a function that imports a json file into the grid.
+ * The json data is imported into new objects of type `gridOptions.importerNewObject`,
+ * and if the rowEdit feature is enabled the rows are marked as dirty
+ * @param {Grid} grid the grid we want to import into
+ * @param {FileObject} importFile the file that we want to import, as
+ * a FileObject
+ */
+ importJsonClosure: function( grid ) {
+ return function( importFile ){
+ var newObjects = [];
+ var newObject;
+
+ var importArray = service.parseJson( grid, importFile );
+ if (importArray === null){
+ return;
+ }
+ importArray.forEach( function( value, index ) {
+ newObject = service.newObject( grid );
+ angular.extend( newObject, value );
+ newObject = grid.options.importerObjectCallback( grid, newObject );
+ newObjects.push( newObject );
+ });
+
+ service.addObjects( grid, newObjects );
+
+ };
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name parseJson
+ * @methodOf ui.grid.importer.service:uiGridImporterService
+ * @description Parses a json file, returns the parsed data.
+ * Displays an error if file doesn't parse
+ * @param {Grid} grid the grid that we want to import into
+ * @param {FileObject} importFile the file that we want to import, as
+ * a FileObject
+ * @returns {array} array of objects from the imported json
+ */
+ parseJson: function( grid, importFile ){
+ var loadedObjects;
+ try {
+ loadedObjects = JSON.parse( importFile.target.result );
+ } catch (e) {
+ service.alertError( grid, 'importer.invalidJson', 'File could not be processed, is it valid json? Content was: ', importFile.target.result );
+ return;
+ }
+
+ if ( !Array.isArray( loadedObjects ) ){
+ service.alertError( grid, 'importer.jsonNotarray', 'Import failed, file is not an array, file was: ', importFile.target.result );
+ return [];
+ } else {
+ return loadedObjects;
+ }
+ },
+
+
+
+ /**
+ * @ngdoc function
+ * @name importCsvClosure
+ * @methodOf ui.grid.importer.service:uiGridImporterService
+ * @description Creates a function that imports a csv file into the grid
+ * (allowing it to be used in the reader.onload event)
+ * @param {Grid} grid the grid that we want to import into
+ * @param {FileObject} importFile the file that we want to import, as
+ * a file object
+ */
+ importCsvClosure: function( grid ) {
+ return function( importFile ){
+ var importArray = service.parseCsv( importFile );
+ if ( !importArray || importArray.length < 1 ){
+ service.alertError( grid, 'importer.invalidCsv', 'File could not be processed, is it valid csv? Content was: ', importFile.target.result );
+ return;
+ }
+
+ var newObjects = service.createCsvObjects( grid, importArray );
+ if ( !newObjects || newObjects.length === 0 ){
+ service.alertError( grid, 'importer.noObjects', 'Objects were not able to be derived, content was: ', importFile.target.result );
+ return;
+ }
+
+ service.addObjects( grid, newObjects );
+ };
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name parseCsv
+ * @methodOf ui.grid.importer.service:uiGridImporterService
+ * @description Parses a csv file into an array of arrays, with the first
+ * array being the headers, and the remaining arrays being the data.
+ * The logic for this comes from https://github.com/thetalecrafter/excel.js/blob/master/src/csv.js,
+ * which is noted as being under the MIT license. The code is modified to pass the jscs yoda condition
+ * checker
+ * @param {FileObject} importFile the file that we want to import, as a
+ * file object
+ */
+ parseCsv: function( importFile ) {
+ var csv = importFile.target.result;
+
+ // use the CSV-JS library to parse
+ return CSV.parse(csv);
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name createCsvObjects
+ * @methodOf ui.grid.importer.service:uiGridImporterService
+ * @description Converts an array of arrays (representing the csv file)
+ * into a set of objects. Uses the provided `gridOptions.importerNewObject`
+ * to create the objects, and maps the header row into the individual columns
+ * using either `gridOptions.importerProcessHeaders`, or by using a native method
+ * of matching to either the displayName, column name or column field of
+ * the columns in the column defs. The resulting objects will have attributes
+ * that are named based on the column.field or column.name, in that order.
+ * @param {Grid} grid the grid that we want to import into
+ * @param {Array} importArray the data that we want to import, as an array
+ */
+ createCsvObjects: function( grid, importArray ){
+ // pull off header row and turn into headers
+ var headerMapping = grid.options.importerProcessHeaders( grid, importArray.shift() );
+ if ( !headerMapping || headerMapping.length === 0 ){
+ service.alertError( grid, 'importer.noHeaders', 'Column names could not be derived, content was: ', importArray );
+ return [];
+ }
+
+ var newObjects = [];
+ var newObject;
+ importArray.forEach( function( row, index ) {
+ newObject = service.newObject( grid );
+ if ( row !== null ){
+ row.forEach( function( field, index ){
+ if ( headerMapping[index] !== null ){
+ newObject[ headerMapping[index] ] = field;
+ }
+ });
+ }
+ newObject = grid.options.importerObjectCallback( grid, newObject );
+ newObjects.push( newObject );
+ });
+
+ return newObjects;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name processHeaders
+ * @methodOf ui.grid.importer.service:uiGridImporterService
+ * @description Determines the columns that the header row from
+ * a csv (or other) file represents.
+ * @param {Grid} grid the grid we're importing into
+ * @param {array} headerRow the header row that we wish to match against
+ * the column definitions
+ * @returns {array} an array of the attribute names that should be used
+ * for that column, based on matching the headers or creating the headers
+ *
+ */
+ processHeaders: function( grid, headerRow ) {
+ var headers = [];
+ if ( !grid.options.columnDefs || grid.options.columnDefs.length === 0 ){
+ // we are going to create new columnDefs for all these columns, so just remove
+ // spaces from the names to create fields
+ headerRow.forEach( function( value, index ) {
+ headers.push( value.replace( /[^0-9a-zA-Z\-_]/g, '_' ) );
+ });
+ return headers;
+ } else {
+ var lookupHash = service.flattenColumnDefs( grid, grid.options.columnDefs );
+ headerRow.forEach( function( value, index ) {
+ if ( lookupHash[value] ) {
+ headers.push( lookupHash[value] );
+ } else if ( lookupHash[ value.toLowerCase() ] ) {
+ headers.push( lookupHash[ value.toLowerCase() ] );
+ } else {
+ headers.push( null );
+ }
+ });
+ return headers;
+ }
+ },
+
+
+ /**
+ * @name flattenColumnDefs
+ * @methodOf ui.grid.importer.service:uiGridImporterService
+ * @description Runs through the column defs and creates a hash of
+ * the displayName, name and field, and of each of those values forced to lower case,
+ * with each pointing to the field or name
+ * (whichever is present). Used to lookup column headers and decide what
+ * attribute name to give to the resulting field.
+ * @param {Grid} grid the grid we're importing into
+ * @param {array} columnDefs the columnDefs that we should flatten
+ * @returns {hash} the flattened version of the column def information, allowing
+ * us to look up a value by `flattenedHash[ headerValue ]`
+ */
+ flattenColumnDefs: function( grid, columnDefs ){
+ var flattenedHash = {};
+ columnDefs.forEach( function( columnDef, index) {
+ if ( columnDef.name ){
+ flattenedHash[ columnDef.name ] = columnDef.field || columnDef.name;
+ flattenedHash[ columnDef.name.toLowerCase() ] = columnDef.field || columnDef.name;
+ }
+
+ if ( columnDef.field ){
+ flattenedHash[ columnDef.field ] = columnDef.field || columnDef.name;
+ flattenedHash[ columnDef.field.toLowerCase() ] = columnDef.field || columnDef.name;
+ }
+
+ if ( columnDef.displayName ){
+ flattenedHash[ columnDef.displayName ] = columnDef.field || columnDef.name;
+ flattenedHash[ columnDef.displayName.toLowerCase() ] = columnDef.field || columnDef.name;
+ }
+
+ if ( columnDef.displayName && grid.options.importerHeaderFilter ){
+ flattenedHash[ grid.options.importerHeaderFilter(columnDef.displayName) ] = columnDef.field || columnDef.name;
+ flattenedHash[ grid.options.importerHeaderFilter(columnDef.displayName).toLowerCase() ] = columnDef.field || columnDef.name;
+ }
+ });
+
+ return flattenedHash;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name addObjects
+ * @methodOf ui.grid.importer.service:uiGridImporterService
+ * @description Inserts our new objects into the grid data, and
+ * sets the rows to dirty if the rowEdit feature is being used
+ *
+ * Does this by registering a watch on dataChanges, which essentially
+ * is waiting on the result of the grid data watch, and downstream processing.
+ *
+ * When the callback is called, it deregisters itself - we don't want to run
+ * again next time data is added.
+ *
+ * If we never get called, we deregister on destroy.
+ *
+ * @param {Grid} grid the grid we're importing into
+ * @param {array} newObjects the objects we want to insert into the grid data
+ * @returns {object} the new object
+ */
+ addObjects: function( grid, newObjects, $scope ){
+ if ( grid.api.rowEdit ){
+ var dataChangeDereg = grid.registerDataChangeCallback( function() {
+ grid.api.rowEdit.setRowsDirty( newObjects );
+ dataChangeDereg();
+ }, [uiGridConstants.dataChange.ROW] );
+
+ grid.importer.$scope.$on( '$destroy', dataChangeDereg );
+ }
+
+ grid.importer.$scope.$apply( grid.options.importerDataAddCallback( grid, newObjects ) );
+
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name newObject
+ * @methodOf ui.grid.importer.service:uiGridImporterService
+ * @description Makes a new object based on `gridOptions.importerNewObject`,
+ * or based on an empty object if not present
+ * @param {Grid} grid the grid we're importing into
+ * @returns {object} the new object
+ */
+ newObject: function( grid ){
+ if ( typeof(grid.options) !== "undefined" && typeof(grid.options.importerNewObject) !== "undefined" ){
+ return new grid.options.importerNewObject();
+ } else {
+ return {};
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name alertError
+ * @methodOf ui.grid.importer.service:uiGridImporterService
+ * @description Provides an internationalised user alert for the failure,
+ * and logs a console message including diagnostic content.
+ * Optionally, if the the `gridOptions.importerErrorCallback` routine
+ * is defined, then calls that instead, allowing user specified error routines
+ * @param {Grid} grid the grid we're importing into
+ * @param {array} headerRow the header row that we wish to match against
+ * the column definitions
+ */
+ alertError: function( grid, alertI18nToken, consoleMessage, context ){
+ if ( grid.options.importerErrorCallback ){
+ grid.options.importerErrorCallback( grid, alertI18nToken, consoleMessage, context );
+ } else {
+ $window.alert(i18nService.getSafeText( alertI18nToken ));
+ gridUtil.logError(consoleMessage + context );
+ }
+ }
+ };
+
+ return service;
+
+ }
+ ]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.importer.directive:uiGridImporter
+ * @element div
+ * @restrict A
+ *
+ * @description Adds importer features to grid
+ *
+ */
+ module.directive('uiGridImporter', ['uiGridImporterConstants', 'uiGridImporterService', 'gridUtil', '$compile',
+ function (uiGridImporterConstants, uiGridImporterService, gridUtil, $compile) {
+ return {
+ replace: true,
+ priority: 0,
+ require: '^uiGrid',
+ scope: false,
+ link: function ($scope, $elm, $attrs, uiGridCtrl) {
+ uiGridImporterService.initializeGrid($scope, uiGridCtrl.grid);
+ }
+ };
+ }
+ ]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.importer.directive:uiGridImporterMenuItem
+ * @element div
+ * @restrict A
+ *
+ * @description Handles the processing from the importer menu item - once a file is
+ * selected
+ *
+ */
+ module.directive('uiGridImporterMenuItem', ['uiGridImporterConstants', 'uiGridImporterService', 'gridUtil', '$compile',
+ function (uiGridImporterConstants, uiGridImporterService, gridUtil, $compile) {
+ return {
+ replace: true,
+ priority: 0,
+ require: '^uiGrid',
+ scope: false,
+ templateUrl: 'ui-grid/importerMenuItem',
+ link: function ($scope, $elm, $attrs, uiGridCtrl) {
+ var handleFileSelect = function( event ){
+ var target = event.srcElement || event.target;
+
+ if (target && target.files && target.files.length === 1) {
+ var fileObject = target.files[0];
+ uiGridImporterService.importThisFile( grid, fileObject );
+ target.form.reset();
+ }
+ };
+
+ var fileChooser = $elm[0].querySelectorAll('.ui-grid-importer-file-chooser');
+ var grid = uiGridCtrl.grid;
+
+ if ( fileChooser.length !== 1 ){
+ gridUtil.logError('Found > 1 or < 1 file choosers within the menu item, error, cannot continue');
+ } else {
+ fileChooser[0].addEventListener('change', handleFileSelect, false); // TODO: why the false on the end? Google
+ }
+ }
+ };
+ }
+ ]);
+})();
+
+(function() {
+ 'use strict';
+ /**
+ * @ngdoc overview
+ * @name ui.grid.infiniteScroll
+ *
+ * @description
+ *
+ * #ui.grid.infiniteScroll
+ *
+ * <div class="alert alert-warning" role="alert"><strong>Beta</strong> This feature is ready for testing, but it either hasn't seen a lot of use or has some known bugs.</div>
+ *
+ * This module provides infinite scroll functionality to ui-grid
+ *
+ */
+ var module = angular.module('ui.grid.infiniteScroll', ['ui.grid']);
+ /**
+ * @ngdoc service
+ * @name ui.grid.infiniteScroll.service:uiGridInfiniteScrollService
+ *
+ * @description Service for infinite scroll features
+ */
+ module.service('uiGridInfiniteScrollService', ['gridUtil', '$compile', '$timeout', 'uiGridConstants', 'ScrollEvent', '$q', function (gridUtil, $compile, $timeout, uiGridConstants, ScrollEvent, $q) {
+
+ var service = {
+
+ /**
+ * @ngdoc function
+ * @name initializeGrid
+ * @methodOf ui.grid.infiniteScroll.service:uiGridInfiniteScrollService
+ * @description This method register events and methods into grid public API
+ */
+
+ initializeGrid: function(grid, $scope) {
+ service.defaultGridOptions(grid.options);
+
+ if (!grid.options.enableInfiniteScroll){
+ return;
+ }
+
+ grid.infiniteScroll = { dataLoading: false };
+ service.setScrollDirections( grid, grid.options.infiniteScrollUp, grid.options.infiniteScrollDown );
+ grid.api.core.on.scrollEnd($scope, service.handleScroll);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.infiniteScroll.api:PublicAPI
+ *
+ * @description Public API for infinite scroll feature
+ */
+ var publicApi = {
+ events: {
+ infiniteScroll: {
+
+ /**
+ * @ngdoc event
+ * @name needLoadMoreData
+ * @eventOf ui.grid.infiniteScroll.api:PublicAPI
+ * @description This event fires when scroll reaches bottom percentage of grid
+ * and needs to load data
+ */
+
+ needLoadMoreData: function ($scope, fn) {
+ },
+
+ /**
+ * @ngdoc event
+ * @name needLoadMoreDataTop
+ * @eventOf ui.grid.infiniteScroll.api:PublicAPI
+ * @description This event fires when scroll reaches top percentage of grid
+ * and needs to load data
+ */
+
+ needLoadMoreDataTop: function ($scope, fn) {
+ }
+ }
+ },
+ methods: {
+ infiniteScroll: {
+
+ /**
+ * @ngdoc function
+ * @name dataLoaded
+ * @methodOf ui.grid.infiniteScroll.api:PublicAPI
+ * @description Call this function when you have loaded the additional data
+ * requested. You should set scrollUp and scrollDown to indicate
+ * whether there are still more pages in each direction.
+ *
+ * If you call dataLoaded without first calling `saveScrollPercentage` then we will
+ * scroll the user to the start of the newly loaded data, which usually gives a smooth scroll
+ * experience, but can give a jumpy experience with large `infiniteScrollRowsFromEnd` values, and
+ * on variable speed internet connections. Using `saveScrollPercentage` as demonstrated in the tutorial
+ * should give a smoother scrolling experience for users.
+ *
+ * See infinite_scroll tutorial for example of usage
+ * @param {boolean} scrollUp if set to false flags that there are no more pages upwards, so don't fire
+ * any more infinite scroll events upward
+ * @param {boolean} scrollDown if set to false flags that there are no more pages downwards, so don't
+ * fire any more infinite scroll events downward
+ * @returns {promise} a promise that is resolved when the grid scrolling is fully adjusted. If you're
+ * planning to remove pages, you should wait on this promise first, or you'll break the scroll positioning
+ */
+ dataLoaded: function( scrollUp, scrollDown ) {
+ service.setScrollDirections(grid, scrollUp, scrollDown);
+
+ var promise = service.adjustScroll(grid).then(function() {
+ grid.infiniteScroll.dataLoading = false;
+ });
+
+ return promise;
+ },
+
+ /**
+ * @ngdoc function
+ * @name resetScroll
+ * @methodOf ui.grid.infiniteScroll.api:PublicAPI
+ * @description Call this function when you have taken some action that makes the current
+ * scroll position invalid. For example, if you're using external sorting and you've resorted
+ * then you might reset the scroll, or if you've otherwise substantially changed the data, perhaps
+ * you've reused an existing grid for a new data set
+ *
+ * You must tell us whether there is data upwards or downwards after the reset
+ *
+ * @param {boolean} scrollUp flag that there are pages upwards, fire
+ * infinite scroll events upward
+ * @param {boolean} scrollDown flag that there are pages downwards, so
+ * fire infinite scroll events downward
+ * @returns {promise} promise that is resolved when the scroll reset is complete
+ */
+ resetScroll: function( scrollUp, scrollDown ) {
+ service.setScrollDirections( grid, scrollUp, scrollDown);
+
+ return service.adjustInfiniteScrollPosition(grid, 0);
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name saveScrollPercentage
+ * @methodOf ui.grid.infiniteScroll.api:PublicAPI
+ * @description Saves the scroll percentage and number of visible rows before you adjust the data,
+ * used if you're subsequently going to call `dataRemovedTop` or `dataRemovedBottom`
+ */
+ saveScrollPercentage: function() {
+ grid.infiniteScroll.prevScrollTop = grid.renderContainers.body.prevScrollTop;
+ grid.infiniteScroll.previousVisibleRows = grid.getVisibleRowCount();
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name dataRemovedTop
+ * @methodOf ui.grid.infiniteScroll.api:PublicAPI
+ * @description Adjusts the scroll position after you've removed data at the top
+ * @param {boolean} scrollUp flag that there are pages upwards, fire
+ * infinite scroll events upward
+ * @param {boolean} scrollDown flag that there are pages downwards, so
+ * fire infinite scroll events downward
+ */
+ dataRemovedTop: function( scrollUp, scrollDown ) {
+ service.dataRemovedTop( grid, scrollUp, scrollDown );
+ },
+
+ /**
+ * @ngdoc function
+ * @name dataRemovedBottom
+ * @methodOf ui.grid.infiniteScroll.api:PublicAPI
+ * @description Adjusts the scroll position after you've removed data at the bottom
+ * @param {boolean} scrollUp flag that there are pages upwards, fire
+ * infinite scroll events upward
+ * @param {boolean} scrollDown flag that there are pages downwards, so
+ * fire infinite scroll events downward
+ */
+ dataRemovedBottom: function( scrollUp, scrollDown ) {
+ service.dataRemovedBottom( grid, scrollUp, scrollDown );
+ },
+
+ /**
+ * @ngdoc function
+ * @name setScrollDirections
+ * @methodOf ui.grid.infiniteScroll.service:uiGridInfiniteScrollService
+ * @description Sets the scrollUp and scrollDown flags, handling nulls and undefined,
+ * and also sets the grid.suppressParentScroll
+ * @param {boolean} scrollUp whether there are pages available up - defaults to false
+ * @param {boolean} scrollDown whether there are pages available down - defaults to true
+ */
+ setScrollDirections: function ( scrollUp, scrollDown ) {
+ service.setScrollDirections( grid, scrollUp, scrollDown );
+ }
+
+ }
+ }
+ };
+ grid.api.registerEventsFromObject(publicApi.events);
+ grid.api.registerMethodsFromObject(publicApi.methods);
+ },
+
+
+ defaultGridOptions: function (gridOptions) {
+ //default option to true unless it was explicitly set to false
+ /**
+ * @ngdoc object
+ * @name ui.grid.infiniteScroll.api:GridOptions
+ *
+ * @description GridOptions for infinite scroll feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+
+ /**
+ * @ngdoc object
+ * @name enableInfiniteScroll
+ * @propertyOf ui.grid.infiniteScroll.api:GridOptions
+ * @description Enable infinite scrolling for this grid
+ * <br/>Defaults to true
+ */
+ gridOptions.enableInfiniteScroll = gridOptions.enableInfiniteScroll !== false;
+
+ /**
+ * @ngdoc property
+ * @name infiniteScrollRowsFromEnd
+ * @propertyOf ui.grid.class:GridOptions
+ * @description This setting controls how close to the end of the dataset a user gets before
+ * more data is requested by the infinite scroll, whether scrolling up or down. This allows you to
+ * 'prefetch' rows before the user actually runs out of scrolling.
+ *
+ * Note that if you set this value too high it may give jumpy scrolling behaviour, if you're getting
+ * this behaviour you could use the `saveScrollPercentageMethod` right before loading your data, and we'll
+ * preserve that scroll position
+ *
+ * <br> Defaults to 20
+ */
+ gridOptions.infiniteScrollRowsFromEnd = gridOptions.infiniteScrollRowsFromEnd || 20;
+
+ /**
+ * @ngdoc property
+ * @name infiniteScrollUp
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Whether you allow infinite scroll up, implying that the first page of data
+ * you have displayed is in the middle of your data set. If set to true then we trigger the
+ * needMoreDataTop event when the user hits the top of the scrollbar.
+ * <br> Defaults to false
+ */
+ gridOptions.infiniteScrollUp = gridOptions.infiniteScrollUp === true;
+
+ /**
+ * @ngdoc property
+ * @name infiniteScrollDown
+ * @propertyOf ui.grid.class:GridOptions
+ * @description Whether you allow infinite scroll down, implying that the first page of data
+ * you have displayed is in the middle of your data set. If set to true then we trigger the
+ * needMoreData event when the user hits the bottom of the scrollbar.
+ * <br> Defaults to true
+ */
+ gridOptions.infiniteScrollDown = gridOptions.infiniteScrollDown !== false;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name setScrollDirections
+ * @methodOf ui.grid.infiniteScroll.service:uiGridInfiniteScrollService
+ * @description Sets the scrollUp and scrollDown flags, handling nulls and undefined,
+ * and also sets the grid.suppressParentScroll
+ * @param {grid} grid the grid we're operating on
+ * @param {boolean} scrollUp whether there are pages available up - defaults to false
+ * @param {boolean} scrollDown whether there are pages available down - defaults to true
+ */
+ setScrollDirections: function ( grid, scrollUp, scrollDown ) {
+ grid.infiniteScroll.scrollUp = ( scrollUp === true );
+ grid.suppressParentScrollUp = ( scrollUp === true );
+
+ grid.infiniteScroll.scrollDown = ( scrollDown !== false);
+ grid.suppressParentScrollDown = ( scrollDown !== false);
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name handleScroll
+ * @methodOf ui.grid.infiniteScroll.service:uiGridInfiniteScrollService
+ * @description Called whenever the grid scrolls, determines whether the scroll should
+ * trigger an infinite scroll request for more data
+ * @param {object} args the args from the event
+ */
+ handleScroll: function (args) {
+ // don't request data if already waiting for data, or if source is coming from ui.grid.adjustInfiniteScrollPosition() function
+ if ( args.grid.infiniteScroll && args.grid.infiniteScroll.dataLoading || args.source === 'ui.grid.adjustInfiniteScrollPosition' ){
+ return;
+ }
+
+ if (args.y) {
+ var percentage;
+ var targetPercentage = args.grid.options.infiniteScrollRowsFromEnd / args.grid.renderContainers.body.visibleRowCache.length;
+ if (args.grid.scrollDirection === uiGridConstants.scrollDirection.UP ) {
+ percentage = args.y.percentage;
+ if (percentage <= targetPercentage){
+ service.loadData(args.grid);
+ }
+ } else if (args.grid.scrollDirection === uiGridConstants.scrollDirection.DOWN) {
+ percentage = 1 - args.y.percentage;
+ if (percentage <= targetPercentage){
+ service.loadData(args.grid);
+ }
+ }
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name loadData
+ * @methodOf ui.grid.infiniteScroll.service:uiGridInfiniteScrollService
+ * @description This function fires 'needLoadMoreData' or 'needLoadMoreDataTop' event based on scrollDirection
+ * and whether there are more pages upwards or downwards. It also stores the number of rows that we had previously,
+ * and clears out any saved scroll position so that we know whether or not the user calls `saveScrollPercentage`
+ * @param {Grid} grid the grid we're working on
+ */
+ loadData: function (grid) {
+ // save number of currently visible rows to calculate new scroll position later - we know that we want
+ // to be at approximately the row we're currently at
+ grid.infiniteScroll.previousVisibleRows = grid.renderContainers.body.visibleRowCache.length;
+ grid.infiniteScroll.direction = grid.scrollDirection;
+ delete grid.infiniteScroll.prevScrollTop;
+
+ if (grid.scrollDirection === uiGridConstants.scrollDirection.UP && grid.infiniteScroll.scrollUp ) {
+ grid.infiniteScroll.dataLoading = true;
+ grid.api.infiniteScroll.raise.needLoadMoreDataTop();
+ } else if (grid.scrollDirection === uiGridConstants.scrollDirection.DOWN && grid.infiniteScroll.scrollDown ) {
+ grid.infiniteScroll.dataLoading = true;
+ grid.api.infiniteScroll.raise.needLoadMoreData();
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name adjustScroll
+ * @methodOf ui.grid.infiniteScroll.service:uiGridInfiniteScrollService
+ * @description Once we are informed that data has been loaded, adjust the scroll position to account for that
+ * addition and to make things look clean.
+ *
+ * If we're scrolling up we scroll to the first row of the old data set -
+ * so we're assuming that you would have gotten to the top of the grid (from the 20% need more data trigger) by
+ * the time the data comes back. If we're scrolling down we scoll to the last row of the old data set - so we're
+ * assuming that you would have gotten to the bottom of the grid (from the 80% need more data trigger) by the time
+ * the data comes back.
+ *
+ * Neither of these are good assumptions, but making this a smoother experience really requires
+ * that trigger to not be a percentage, and to be much closer to the end of the data (say, 5 rows off the end). Even then
+ * it'd be better still to actually run into the end. But if the data takes a while to come back, they may have scrolled
+ * somewhere else in the mean-time, in which case they'll get a jump back to the new data. Anyway, this will do for
+ * now, until someone wants to do better.
+ * @param {Grid} grid the grid we're working on
+ * @returns {promise} a promise that is resolved when scrolling has finished
+ */
+ adjustScroll: function(grid){
+ var promise = $q.defer();
+ $timeout(function () {
+ var newPercentage, viewportHeight, rowHeight, newVisibleRows, oldTop, newTop;
+
+ viewportHeight = grid.getViewportHeight() + grid.headerHeight - grid.renderContainers.body.headerHeight - grid.scrollbarHeight;
+ rowHeight = grid.options.rowHeight;
+
+ if ( grid.infiniteScroll.direction === undefined ){
+ // called from initialize, tweak our scroll up a little
+ service.adjustInfiniteScrollPosition(grid, 0);
+ }
+
+ newVisibleRows = grid.getVisibleRowCount();
+
+ // in case not enough data is loaded to enable scroller - load more data
+ var canvasHeight = rowHeight * newVisibleRows;
+ if (grid.infiniteScroll.scrollDown && (viewportHeight > canvasHeight)) {
+ grid.api.infiniteScroll.raise.needLoadMoreData();
+ }
+
+ if ( grid.infiniteScroll.direction === uiGridConstants.scrollDirection.UP ){
+ oldTop = grid.infiniteScroll.prevScrollTop || 0;
+ newTop = oldTop + (newVisibleRows - grid.infiniteScroll.previousVisibleRows)*rowHeight;
+ service.adjustInfiniteScrollPosition(grid, newTop);
+ $timeout( function() {
+ promise.resolve();
+ });
+ }
+
+ if ( grid.infiniteScroll.direction === uiGridConstants.scrollDirection.DOWN ){
+ newTop = grid.infiniteScroll.prevScrollTop || (grid.infiniteScroll.previousVisibleRows*rowHeight - viewportHeight);
+ service.adjustInfiniteScrollPosition(grid, newTop);
+ $timeout( function() {
+ promise.resolve();
+ });
+ }
+ }, 0);
+
+ return promise.promise;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name adjustInfiniteScrollPosition
+ * @methodOf ui.grid.infiniteScroll.service:uiGridInfiniteScrollService
+ * @description This function fires 'needLoadMoreData' or 'needLoadMoreDataTop' event based on scrollDirection
+ * @param {Grid} grid the grid we're working on
+ * @param {number} scrollTop the position through the grid that we want to scroll to
+ * @returns {promise} a promise that is resolved when the scrolling finishes
+ */
+ adjustInfiniteScrollPosition: function (grid, scrollTop) {
+ var scrollEvent = new ScrollEvent(grid, null, null, 'ui.grid.adjustInfiniteScrollPosition'),
+ visibleRows = grid.getVisibleRowCount(),
+ viewportHeight = grid.getViewportHeight() + grid.headerHeight - grid.renderContainers.body.headerHeight - grid.scrollbarHeight,
+ rowHeight = grid.options.rowHeight,
+ scrollHeight = visibleRows*rowHeight-viewportHeight;
+
+ //for infinite scroll, if there are pages upwards then never allow it to be at the zero position so the up button can be active
+ if (scrollTop === 0 && grid.infiniteScroll.scrollUp) {
+ // using pixels results in a relative scroll, hence we have to use percentage
+ scrollEvent.y = {percentage: 1/scrollHeight};
+ }
+ else {
+ scrollEvent.y = {percentage: scrollTop/scrollHeight};
+ }
+ grid.scrollContainers('', scrollEvent);
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name dataRemovedTop
+ * @methodOf ui.grid.infiniteScroll.api:PublicAPI
+ * @description Adjusts the scroll position after you've removed data at the top. You should
+ * have called `saveScrollPercentage` before you remove the data, and if you're doing this in
+ * response to a `needMoreData` you should wait until the promise from `loadData` has resolved
+ * before you start removing data
+ * @param {Grid} grid the grid we're working on
+ * @param {boolean} scrollUp flag that there are pages upwards, fire
+ * infinite scroll events upward
+ * @param {boolean} scrollDown flag that there are pages downwards, so
+ * fire infinite scroll events downward
+ * @returns {promise} a promise that is resolved when the scrolling finishes
+ */
+ dataRemovedTop: function( grid, scrollUp, scrollDown ) {
+ var newVisibleRows, oldTop, newTop, rowHeight;
+ service.setScrollDirections( grid, scrollUp, scrollDown );
+
+ newVisibleRows = grid.renderContainers.body.visibleRowCache.length;
+ oldTop = grid.infiniteScroll.prevScrollTop;
+ rowHeight = grid.options.rowHeight;
+
+ // since we removed from the top, our new scroll row will be the old scroll row less the number
+ // of rows removed
+ newTop = oldTop - ( grid.infiniteScroll.previousVisibleRows - newVisibleRows )*rowHeight;
+
+ return service.adjustInfiniteScrollPosition( grid, newTop );
+ },
+
+ /**
+ * @ngdoc function
+ * @name dataRemovedBottom
+ * @methodOf ui.grid.infiniteScroll.api:PublicAPI
+ * @description Adjusts the scroll position after you've removed data at the bottom. You should
+ * have called `saveScrollPercentage` before you remove the data, and if you're doing this in
+ * response to a `needMoreData` you should wait until the promise from `loadData` has resolved
+ * before you start removing data
+ * @param {Grid} grid the grid we're working on
+ * @param {boolean} scrollUp flag that there are pages upwards, fire
+ * infinite scroll events upward
+ * @param {boolean} scrollDown flag that there are pages downwards, so
+ * fire infinite scroll events downward
+ */
+ dataRemovedBottom: function( grid, scrollUp, scrollDown ) {
+ var newTop;
+ service.setScrollDirections( grid, scrollUp, scrollDown );
+
+ newTop = grid.infiniteScroll.prevScrollTop;
+
+ return service.adjustInfiniteScrollPosition( grid, newTop );
+ }
+ };
+ return service;
+ }]);
+ /**
+ * @ngdoc directive
+ * @name ui.grid.infiniteScroll.directive:uiGridInfiniteScroll
+ * @element div
+ * @restrict A
+ *
+ * @description Adds infinite scroll features to grid
+ *
+ * @example
+ <example module="app">
+ <file name="app.js">
+ var app = angular.module('app', ['ui.grid', 'ui.grid.infiniteScroll']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.data = [
+ { name: 'Alex', car: 'Toyota' },
+ { name: 'Sam', car: 'Lexus' }
+ ];
+
+ $scope.columnDefs = [
+ {name: 'name'},
+ {name: 'car'}
+ ];
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <div ui-grid="{ data: data, columnDefs: columnDefs }" ui-grid-infinite-scroll="20"></div>
+ </div>
+ </file>
+ </example>
+ */
+
+ module.directive('uiGridInfiniteScroll', ['uiGridInfiniteScrollService',
+ function (uiGridInfiniteScrollService) {
+ return {
+ priority: -200,
+ scope: false,
+ require: '^uiGrid',
+ compile: function($scope, $elm, $attr){
+ return {
+ pre: function($scope, $elm, $attr, uiGridCtrl) {
+ uiGridInfiniteScrollService.initializeGrid(uiGridCtrl.grid, $scope);
+ },
+ post: function($scope, $elm, $attr) {
+ }
+ };
+ }
+ };
+ }]);
+
+})();
+
+(function () {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.moveColumns
+ * @description
+ *
+ * # ui.grid.moveColumns
+ *
+ * <div class="alert alert-warning" role="alert"><strong>Alpha</strong> This feature is in development. There will almost certainly be breaking api changes, or there are major outstanding bugs.</div>
+ *
+ * This module provides column moving capability to ui.grid. It enables to change the position of columns.
+ * <div doc-module-components="ui.grid.moveColumns"></div>
+ */
+ var module = angular.module('ui.grid.moveColumns', ['ui.grid']);
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.moveColumns.service:uiGridMoveColumnService
+ * @description Service for column moving feature.
+ */
+ module.service('uiGridMoveColumnService', ['$q', '$timeout', '$log', 'ScrollEvent', 'uiGridConstants', 'gridUtil', function ($q, $timeout, $log, ScrollEvent, uiGridConstants, gridUtil) {
+
+ var service = {
+ initializeGrid: function (grid) {
+ var self = this;
+ this.registerPublicApi(grid);
+ this.defaultGridOptions(grid.options);
+ grid.moveColumns = {orderCache: []}; // Used to cache the order before columns are rebuilt
+ grid.registerColumnBuilder(self.movableColumnBuilder);
+ grid.registerDataChangeCallback(self.verifyColumnOrder, [uiGridConstants.dataChange.COLUMN]);
+ },
+ registerPublicApi: function (grid) {
+ var self = this;
+ /**
+ * @ngdoc object
+ * @name ui.grid.moveColumns.api:PublicApi
+ * @description Public Api for column moving feature.
+ */
+ var publicApi = {
+ events: {
+ /**
+ * @ngdoc event
+ * @name columnPositionChanged
+ * @eventOf ui.grid.moveColumns.api:PublicApi
+ * @description raised when column is moved
+ * <pre>
+ * gridApi.colMovable.on.columnPositionChanged(scope,function(colDef, originalPosition, newPosition){})
+ * </pre>
+ * @param {object} colDef the column that was moved
+ * @param {integer} originalPosition of the column
+ * @param {integer} finalPosition of the column
+ */
+ colMovable: {
+ columnPositionChanged: function (colDef, originalPosition, newPosition) {
+ }
+ }
+ },
+ methods: {
+ /**
+ * @ngdoc method
+ * @name moveColumn
+ * @methodOf ui.grid.moveColumns.api:PublicApi
+ * @description Method can be used to change column position.
+ * <pre>
+ * gridApi.colMovable.moveColumn(oldPosition, newPosition)
+ * </pre>
+ * @param {integer} originalPosition of the column
+ * @param {integer} finalPosition of the column
+ */
+ colMovable: {
+ moveColumn: function (originalPosition, finalPosition) {
+ var columns = grid.columns;
+ if (!angular.isNumber(originalPosition) || !angular.isNumber(finalPosition)) {
+ gridUtil.logError('MoveColumn: Please provide valid values for originalPosition and finalPosition');
+ return;
+ }
+ var nonMovableColumns = 0;
+ for (var i = 0; i < columns.length; i++) {
+ if ((angular.isDefined(columns[i].colDef.visible) && columns[i].colDef.visible === false) || columns[i].isRowHeader === true) {
+ nonMovableColumns++;
+ }
+ }
+ if (originalPosition >= (columns.length - nonMovableColumns) || finalPosition >= (columns.length - nonMovableColumns)) {
+ gridUtil.logError('MoveColumn: Invalid values for originalPosition, finalPosition');
+ return;
+ }
+ var findPositionForRenderIndex = function (index) {
+ var position = index;
+ for (var i = 0; i <= position; i++) {
+ if (angular.isDefined(columns[i]) && ((angular.isDefined(columns[i].colDef.visible) && columns[i].colDef.visible === false) || columns[i].isRowHeader === true)) {
+ position++;
+ }
+ }
+ return position;
+ };
+ self.redrawColumnAtPosition(grid, findPositionForRenderIndex(originalPosition), findPositionForRenderIndex(finalPosition));
+ }
+ }
+ }
+ };
+ grid.api.registerEventsFromObject(publicApi.events);
+ grid.api.registerMethodsFromObject(publicApi.methods);
+ },
+ defaultGridOptions: function (gridOptions) {
+ /**
+ * @ngdoc object
+ * @name ui.grid.moveColumns.api:GridOptions
+ *
+ * @description Options for configuring the move column feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+ /**
+ * @ngdoc object
+ * @name enableColumnMoving
+ * @propertyOf ui.grid.moveColumns.api:GridOptions
+ * @description If defined, sets the default value for the colMovable flag on each individual colDefs
+ * if their individual enableColumnMoving configuration is not defined. Defaults to true.
+ */
+ gridOptions.enableColumnMoving = gridOptions.enableColumnMoving !== false;
+ },
+ movableColumnBuilder: function (colDef, col, gridOptions) {
+ var promises = [];
+ /**
+ * @ngdoc object
+ * @name ui.grid.moveColumns.api:ColumnDef
+ *
+ * @description Column Definition for move column feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions.columnDef gridOptions.columnDefs}
+ */
+ /**
+ * @ngdoc object
+ * @name enableColumnMoving
+ * @propertyOf ui.grid.moveColumns.api:ColumnDef
+ * @description Enable column moving for the column.
+ */
+ colDef.enableColumnMoving = colDef.enableColumnMoving === undefined ? gridOptions.enableColumnMoving
+ : colDef.enableColumnMoving;
+ return $q.all(promises);
+ },
+ /**
+ * @ngdoc method
+ * @name updateColumnCache
+ * @methodOf ui.grid.moveColumns
+ * @description Cache the current order of columns, so we can restore them after new columnDefs are defined
+ */
+ updateColumnCache: function(grid){
+ grid.moveColumns.orderCache = grid.getOnlyDataColumns();
+ },
+ /**
+ * @ngdoc method
+ * @name verifyColumnOrder
+ * @methodOf ui.grid.moveColumns
+ * @description dataChangeCallback which uses the cached column order to restore the column order
+ * when it is reset by altering the columnDefs array.
+ */
+ verifyColumnOrder: function(grid){
+ var headerRowOffset = grid.rowHeaderColumns.length;
+ var newIndex;
+
+ angular.forEach(grid.moveColumns.orderCache, function(cacheCol, cacheIndex){
+ newIndex = grid.columns.indexOf(cacheCol);
+ if ( newIndex !== -1 && newIndex - headerRowOffset !== cacheIndex ){
+ var column = grid.columns.splice(newIndex, 1)[0];
+ grid.columns.splice(cacheIndex + headerRowOffset, 0, column);
+ }
+ });
+ },
+ redrawColumnAtPosition: function (grid, originalPosition, newPosition) {
+
+ var columns = grid.columns;
+
+ var originalColumn = columns[originalPosition];
+ if (originalColumn.colDef.enableColumnMoving) {
+ if (originalPosition > newPosition) {
+ for (var i1 = originalPosition; i1 > newPosition; i1--) {
+ columns[i1] = columns[i1 - 1];
+ }
+ }
+ else if (newPosition > originalPosition) {
+ for (var i2 = originalPosition; i2 < newPosition; i2++) {
+ columns[i2] = columns[i2 + 1];
+ }
+ }
+ columns[newPosition] = originalColumn;
+ service.updateColumnCache(grid);
+ grid.queueGridRefresh();
+ $timeout(function () {
+ grid.api.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
+ grid.api.colMovable.raise.columnPositionChanged(originalColumn.colDef, originalPosition, newPosition);
+ });
+ }
+ }
+ };
+ return service;
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.moveColumns.directive:uiGridMoveColumns
+ * @element div
+ * @restrict A
+ * @description Adds column moving features to the ui-grid directive.
+ * @example
+ <example module="app">
+ <file name="app.js">
+ var app = angular.module('app', ['ui.grid', 'ui.grid.moveColumns']);
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.data = [
+ { name: 'Bob', title: 'CEO', age: 45 },
+ { name: 'Frank', title: 'Lowly Developer', age: 25 },
+ { name: 'Jenny', title: 'Highly Developer', age: 35 }
+ ];
+ $scope.columnDefs = [
+ {name: 'name'},
+ {name: 'title'},
+ {name: 'age'}
+ ];
+ }]);
+ </file>
+ <file name="main.css">
+ .grid {
+ width: 100%;
+ height: 150px;
+ }
+ </file>
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <div class="grid" ui-grid="{ data: data, columnDefs: columnDefs }" ui-grid-move-columns></div>
+ </div>
+ </file>
+ </example>
+ */
+ module.directive('uiGridMoveColumns', ['uiGridMoveColumnService', function (uiGridMoveColumnService) {
+ return {
+ replace: true,
+ priority: 0,
+ require: '^uiGrid',
+ scope: false,
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ uiGridMoveColumnService.initializeGrid(uiGridCtrl.grid);
+ },
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ }
+ };
+ }
+ };
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.moveColumns.directive:uiGridHeaderCell
+ * @element div
+ * @restrict A
+ *
+ * @description Stacks on top of ui.grid.uiGridHeaderCell to provide capability to be able to move it to reposition column.
+ *
+ * On receiving mouseDown event headerCell is cloned, now as the mouse moves the cloned header cell also moved in the grid.
+ * In case the moving cloned header cell reaches the left or right extreme of grid, grid scrolling is triggered (if horizontal scroll exists).
+ * On mouseUp event column is repositioned at position where mouse is released and cloned header cell is removed.
+ *
+ * Events that invoke cloning of header cell:
+ * - mousedown
+ *
+ * Events that invoke movement of cloned header cell:
+ * - mousemove
+ *
+ * Events that invoke repositioning of column:
+ * - mouseup
+ */
+ module.directive('uiGridHeaderCell', ['$q', 'gridUtil', 'uiGridMoveColumnService', '$document', '$log', 'uiGridConstants', 'ScrollEvent',
+ function ($q, gridUtil, uiGridMoveColumnService, $document, $log, uiGridConstants, ScrollEvent) {
+ return {
+ priority: -10,
+ require: '^uiGrid',
+ compile: function () {
+ return {
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+
+ if ($scope.col.colDef.enableColumnMoving) {
+
+ /*
+ * Our general approach to column move is that we listen to a touchstart or mousedown
+ * event over the column header. When we hear one, then we wait for a move of the same type
+ * - if we are a touchstart then we listen for a touchmove, if we are a mousedown we listen for
+ * a mousemove (i.e. a drag) before we decide that there's a move underway. If there's never a move,
+ * and we instead get a mouseup or a touchend, then we just drop out again and do nothing.
+ *
+ */
+ var $contentsElm = angular.element( $elm[0].querySelectorAll('.ui-grid-cell-contents') );
+
+ var gridLeft;
+ var previousMouseX;
+ var totalMouseMovement;
+ var rightMoveLimit;
+ var elmCloned = false;
+ var movingElm;
+ var reducedWidth;
+ var moveOccurred = false;
+
+ var downFn = function( event ){
+ //Setting some variables required for calculations.
+ gridLeft = $scope.grid.element[0].getBoundingClientRect().left;
+ if ( $scope.grid.hasLeftContainer() ){
+ gridLeft += $scope.grid.renderContainers.left.header[0].getBoundingClientRect().width;
+ }
+
+ previousMouseX = event.pageX;
+ totalMouseMovement = 0;
+ rightMoveLimit = gridLeft + $scope.grid.getViewportWidth();
+
+ if ( event.type === 'mousedown' ){
+ $document.on('mousemove', moveFn);
+ $document.on('mouseup', upFn);
+ } else if ( event.type === 'touchstart' ){
+ $document.on('touchmove', moveFn);
+ $document.on('touchend', upFn);
+ }
+ };
+
+ var moveFn = function( event ) {
+ var changeValue = event.pageX - previousMouseX;
+ if ( changeValue === 0 ){ return; }
+ //Disable text selection in Chrome during column move
+ document.onselectstart = function() { return false; };
+
+ moveOccurred = true;
+
+ if (!elmCloned) {
+ cloneElement();
+ }
+ else if (elmCloned) {
+ moveElement(changeValue);
+ previousMouseX = event.pageX;
+ }
+ };
+
+ var upFn = function( event ){
+ //Re-enable text selection after column move
+ document.onselectstart = null;
+
+ //Remove the cloned element on mouse up.
+ if (movingElm) {
+ movingElm.remove();
+ elmCloned = false;
+ }
+
+ offAllEvents();
+ onDownEvents();
+
+ if (!moveOccurred){
+ return;
+ }
+
+ var columns = $scope.grid.columns;
+ var columnIndex = 0;
+ for (var i = 0; i < columns.length; i++) {
+ if (columns[i].colDef.name !== $scope.col.colDef.name) {
+ columnIndex++;
+ }
+ else {
+ break;
+ }
+ }
+
+ //Case where column should be moved to a position on its left
+ if (totalMouseMovement < 0) {
+ var totalColumnsLeftWidth = 0;
+ for (var il = columnIndex - 1; il >= 0; il--) {
+ if (angular.isUndefined(columns[il].colDef.visible) || columns[il].colDef.visible === true) {
+ totalColumnsLeftWidth += columns[il].drawnWidth || columns[il].width || columns[il].colDef.width;
+ if (totalColumnsLeftWidth > Math.abs(totalMouseMovement)) {
+ uiGridMoveColumnService.redrawColumnAtPosition
+ ($scope.grid, columnIndex, il + 1);
+ break;
+ }
+ }
+ }
+ //Case where column should be moved to beginning of the grid.
+ if (totalColumnsLeftWidth < Math.abs(totalMouseMovement)) {
+ uiGridMoveColumnService.redrawColumnAtPosition
+ ($scope.grid, columnIndex, 0);
+ }
+ }
+
+ //Case where column should be moved to a position on its right
+ else if (totalMouseMovement > 0) {
+ var totalColumnsRightWidth = 0;
+ for (var ir = columnIndex + 1; ir < columns.length; ir++) {
+ if (angular.isUndefined(columns[ir].colDef.visible) || columns[ir].colDef.visible === true) {
+ totalColumnsRightWidth += columns[ir].drawnWidth || columns[ir].width || columns[ir].colDef.width;
+ if (totalColumnsRightWidth > totalMouseMovement) {
+ uiGridMoveColumnService.redrawColumnAtPosition
+ ($scope.grid, columnIndex, ir - 1);
+ break;
+ }
+ }
+ }
+ //Case where column should be moved to end of the grid.
+ if (totalColumnsRightWidth < totalMouseMovement) {
+ uiGridMoveColumnService.redrawColumnAtPosition
+ ($scope.grid, columnIndex, columns.length - 1);
+ }
+ }
+ };
+
+ var onDownEvents = function(){
+ $contentsElm.on('touchstart', downFn);
+ $contentsElm.on('mousedown', downFn);
+ };
+
+ var offAllEvents = function() {
+ $contentsElm.off('touchstart', downFn);
+ $contentsElm.off('mousedown', downFn);
+
+ $document.off('mousemove', moveFn);
+ $document.off('touchmove', moveFn);
+
+ $document.off('mouseup', upFn);
+ $document.off('touchend', upFn);
+ };
+
+ onDownEvents();
+
+
+ var cloneElement = function () {
+ elmCloned = true;
+
+ //Cloning header cell and appending to current header cell.
+ movingElm = $elm.clone();
+ $elm.parent().append(movingElm);
+
+ //Left of cloned element should be aligned to original header cell.
+ movingElm.addClass('movingColumn');
+ var movingElementStyles = {};
+ var elmLeft;
+ if (gridUtil.detectBrowser() === 'safari') {
+ //Correction for Safari getBoundingClientRect,
+ //which does not correctly compute when there is an horizontal scroll
+ elmLeft = $elm[0].offsetLeft + $elm[0].offsetWidth - $elm[0].getBoundingClientRect().width;
+ }
+ else {
+ elmLeft = $elm[0].getBoundingClientRect().left;
+ }
+ movingElementStyles.left = (elmLeft - gridLeft) + 'px';
+ var gridRight = $scope.grid.element[0].getBoundingClientRect().right;
+ var elmRight = $elm[0].getBoundingClientRect().right;
+ if (elmRight > gridRight) {
+ reducedWidth = $scope.col.drawnWidth + (gridRight - elmRight);
+ movingElementStyles.width = reducedWidth + 'px';
+ }
+ movingElm.css(movingElementStyles);
+ };
+
+ var moveElement = function (changeValue) {
+ //Calculate total column width
+ var columns = $scope.grid.columns;
+ var totalColumnWidth = 0;
+ for (var i = 0; i < columns.length; i++) {
+ if (angular.isUndefined(columns[i].colDef.visible) || columns[i].colDef.visible === true) {
+ totalColumnWidth += columns[i].drawnWidth || columns[i].width || columns[i].colDef.width;
+ }
+ }
+
+ //Calculate new position of left of column
+ var currentElmLeft = movingElm[0].getBoundingClientRect().left - 1;
+ var currentElmRight = movingElm[0].getBoundingClientRect().right;
+ var newElementLeft;
+
+ newElementLeft = currentElmLeft - gridLeft + changeValue;
+ newElementLeft = newElementLeft < rightMoveLimit ? newElementLeft : rightMoveLimit;
+
+ //Update css of moving column to adjust to new left value or fire scroll in case column has reached edge of grid
+ if ((currentElmLeft >= gridLeft || changeValue > 0) && (currentElmRight <= rightMoveLimit || changeValue < 0)) {
+ movingElm.css({visibility: 'visible', 'left': newElementLeft + 'px'});
+ }
+ else if (totalColumnWidth > Math.ceil(uiGridCtrl.grid.gridWidth)) {
+ changeValue *= 8;
+ var scrollEvent = new ScrollEvent($scope.col.grid, null, null, 'uiGridHeaderCell.moveElement');
+ scrollEvent.x = {pixels: changeValue};
+ scrollEvent.grid.scrollContainers('',scrollEvent);
+ }
+
+ //Calculate total width of columns on the left of the moving column and the mouse movement
+ var totalColumnsLeftWidth = 0;
+ for (var il = 0; il < columns.length; il++) {
+ if (angular.isUndefined(columns[il].colDef.visible) || columns[il].colDef.visible === true) {
+ if (columns[il].colDef.name !== $scope.col.colDef.name) {
+ totalColumnsLeftWidth += columns[il].drawnWidth || columns[il].width || columns[il].colDef.width;
+ }
+ else {
+ break;
+ }
+ }
+ }
+ if ($scope.newScrollLeft === undefined) {
+ totalMouseMovement += changeValue;
+ }
+ else {
+ totalMouseMovement = $scope.newScrollLeft + newElementLeft - totalColumnsLeftWidth;
+ }
+
+ //Increase width of moving column, in case the rightmost column was moved and its width was
+ //decreased because of overflow
+ if (reducedWidth < $scope.col.drawnWidth) {
+ reducedWidth += Math.abs(changeValue);
+ movingElm.css({'width': reducedWidth + 'px'});
+ }
+ };
+ }
+ }
+ };
+ }
+ };
+ }]);
+})();
+
+(function() {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.pagination
+ *
+ * @description
+ *
+ * # ui.grid.pagination
+ *
+ * <div class="alert alert-warning" role="alert"><strong>Alpha</strong> This feature is in development. There will almost certainly be breaking api changes, or there are major outstanding bugs.</div>
+ *
+ * This module provides pagination support to ui-grid
+ */
+ var module = angular.module('ui.grid.pagination', ['ng', 'ui.grid']);
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.pagination.service:uiGridPaginationService
+ *
+ * @description Service for the pagination feature
+ */
+ module.service('uiGridPaginationService', ['gridUtil',
+ function (gridUtil) {
+ var service = {
+ /**
+ * @ngdoc method
+ * @name initializeGrid
+ * @methodOf ui.grid.pagination.service:uiGridPaginationService
+ * @description Attaches the service to a certain grid
+ * @param {Grid} grid The grid we want to work with
+ */
+ initializeGrid: function (grid) {
+ service.defaultGridOptions(grid.options);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.pagination.api:PublicAPI
+ *
+ * @description Public API for the pagination feature
+ */
+ var publicApi = {
+ events: {
+ pagination: {
+ /**
+ * @ngdoc event
+ * @name paginationChanged
+ * @eventOf ui.grid.pagination.api:PublicAPI
+ * @description This event fires when the pageSize or currentPage changes
+ * @param {int} currentPage requested page number
+ * @param {int} pageSize requested page size
+ */
+ paginationChanged: function (currentPage, pageSize) { }
+ }
+ },
+ methods: {
+ pagination: {
+ /**
+ * @ngdoc method
+ * @name getPage
+ * @methodOf ui.grid.pagination.api:PublicAPI
+ * @description Returns the number of the current page
+ */
+ getPage: function () {
+ return grid.options.enablePagination ? grid.options.paginationCurrentPage : null;
+ },
+ /**
+ * @ngdoc method
+ * @name getTotalPages
+ * @methodOf ui.grid.pagination.api:PublicAPI
+ * @description Returns the total number of pages
+ */
+ getTotalPages: function () {
+ if (!grid.options.enablePagination) {
+ return null;
+ }
+
+ return (grid.options.totalItems === 0) ? 1 : Math.ceil(grid.options.totalItems / grid.options.paginationPageSize);
+ },
+ /**
+ * @ngdoc method
+ * @name nextPage
+ * @methodOf ui.grid.pagination.api:PublicAPI
+ * @description Moves to the next page, if possible
+ */
+ nextPage: function () {
+ if (!grid.options.enablePagination) {
+ return;
+ }
+
+ if (grid.options.totalItems > 0) {
+ grid.options.paginationCurrentPage = Math.min(
+ grid.options.paginationCurrentPage + 1,
+ publicApi.methods.pagination.getTotalPages()
+ );
+ } else {
+ grid.options.paginationCurrentPage++;
+ }
+ },
+ /**
+ * @ngdoc method
+ * @name previousPage
+ * @methodOf ui.grid.pagination.api:PublicAPI
+ * @description Moves to the previous page, if we're not on the first page
+ */
+ previousPage: function () {
+ if (!grid.options.enablePagination) {
+ return;
+ }
+
+ grid.options.paginationCurrentPage = Math.max(grid.options.paginationCurrentPage - 1, 1);
+ },
+ /**
+ * @ngdoc method
+ * @name seek
+ * @methodOf ui.grid.pagination.api:PublicAPI
+ * @description Moves to the requested page
+ * @param {int} page The number of the page that should be displayed
+ */
+ seek: function (page) {
+ if (!grid.options.enablePagination) {
+ return;
+ }
+ if (!angular.isNumber(page) || page < 1) {
+ throw 'Invalid page number: ' + page;
+ }
+
+ grid.options.paginationCurrentPage = Math.min(page, publicApi.methods.pagination.getTotalPages());
+ }
+ }
+ }
+ };
+
+ grid.api.registerEventsFromObject(publicApi.events);
+ grid.api.registerMethodsFromObject(publicApi.methods);
+
+ var processPagination = function( renderableRows ){
+ if (grid.options.useExternalPagination || !grid.options.enablePagination) {
+ return renderableRows;
+ }
+ //client side pagination
+ var pageSize = parseInt(grid.options.paginationPageSize, 10);
+ var currentPage = parseInt(grid.options.paginationCurrentPage, 10);
+
+ var visibleRows = renderableRows.filter(function (row) { return row.visible; });
+ grid.options.totalItems = visibleRows.length;
+
+ var firstRow = (currentPage - 1) * pageSize;
+ if (firstRow > visibleRows.length) {
+ currentPage = grid.options.paginationCurrentPage = 1;
+ firstRow = (currentPage - 1) * pageSize;
+ }
+ return visibleRows.slice(firstRow, firstRow + pageSize);
+ };
+
+ grid.registerRowsProcessor(processPagination, 900 );
+
+ },
+ defaultGridOptions: function (gridOptions) {
+ /**
+ * @ngdoc object
+ * @name ui.grid.pagination.api:GridOptions
+ *
+ * @description GridOptions for the pagination feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+
+ /**
+ * @ngdoc property
+ * @name enablePagination
+ * @propertyOf ui.grid.pagination.api:GridOptions
+ * @description Enables pagination, defaults to true
+ */
+ gridOptions.enablePagination = gridOptions.enablePagination !== false;
+ /**
+ * @ngdoc property
+ * @name enablePaginationControls
+ * @propertyOf ui.grid.pagination.api:GridOptions
+ * @description Enables the paginator at the bottom of the grid. Turn this off, if you want to implement your
+ * own controls outside the grid.
+ */
+ gridOptions.enablePaginationControls = gridOptions.enablePaginationControls !== false;
+ /**
+ * @ngdoc property
+ * @name useExternalPagination
+ * @propertyOf ui.grid.pagination.api:GridOptions
+ * @description Disables client side pagination. When true, handle the paginationChanged event and set data
+ * and totalItems, defaults to `false`
+ */
+ gridOptions.useExternalPagination = gridOptions.useExternalPagination === true;
+ /**
+ * @ngdoc property
+ * @name totalItems
+ * @propertyOf ui.grid.pagination.api:GridOptions
+ * @description Total number of items, set automatically when client side pagination, needs set by user
+ * for server side pagination
+ */
+ if (gridUtil.isNullOrUndefined(gridOptions.totalItems)) {
+ gridOptions.totalItems = 0;
+ }
+ /**
+ * @ngdoc property
+ * @name paginationPageSizes
+ * @propertyOf ui.grid.pagination.api:GridOptions
+ * @description Array of page sizes, defaults to `[250, 500, 1000]`
+ */
+ if (gridUtil.isNullOrUndefined(gridOptions.paginationPageSizes)) {
+ gridOptions.paginationPageSizes = [250, 500, 1000];
+ }
+ /**
+ * @ngdoc property
+ * @name paginationPageSize
+ * @propertyOf ui.grid.pagination.api:GridOptions
+ * @description Page size, defaults to the first item in paginationPageSizes, or 0 if paginationPageSizes is empty
+ */
+ if (gridUtil.isNullOrUndefined(gridOptions.paginationPageSize)) {
+ if (gridOptions.paginationPageSizes.length > 0) {
+ gridOptions.paginationPageSize = gridOptions.paginationPageSizes[0];
+ } else {
+ gridOptions.paginationPageSize = 0;
+ }
+ }
+ /**
+ * @ngdoc property
+ * @name paginationCurrentPage
+ * @propertyOf ui.grid.pagination.api:GridOptions
+ * @description Current page number, defaults to 1
+ */
+ if (gridUtil.isNullOrUndefined(gridOptions.paginationCurrentPage)) {
+ gridOptions.paginationCurrentPage = 1;
+ }
+
+ /**
+ * @ngdoc property
+ * @name paginationTemplate
+ * @propertyOf ui.grid.pagination.api:GridOptions
+ * @description A custom template for the pager, defaults to `ui-grid/pagination`
+ */
+ if (gridUtil.isNullOrUndefined(gridOptions.paginationTemplate)) {
+ gridOptions.paginationTemplate = 'ui-grid/pagination';
+ }
+ },
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.pagination.service:uiGridPaginationService
+ * @name uiGridPaginationService
+ * @description Raises paginationChanged and calls refresh for client side pagination
+ * @param {Grid} grid the grid for which the pagination changed
+ * @param {int} currentPage requested page number
+ * @param {int} pageSize requested page size
+ */
+ onPaginationChanged: function (grid, currentPage, pageSize) {
+ grid.api.pagination.raise.paginationChanged(currentPage, pageSize);
+ if (!grid.options.useExternalPagination) {
+ grid.queueGridRefresh(); //client side pagination
+ }
+ }
+ };
+
+ return service;
+ }
+ ]);
+ /**
+ * @ngdoc directive
+ * @name ui.grid.pagination.directive:uiGridPagination
+ * @element div
+ * @restrict A
+ *
+ * @description Adds pagination features to grid
+ * @example
+ <example module="app">
+ <file name="app.js">
+ var app = angular.module('app', ['ui.grid', 'ui.grid.pagination']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.data = [
+ { name: 'Alex', car: 'Toyota' },
+ { name: 'Sam', car: 'Lexus' },
+ { name: 'Joe', car: 'Dodge' },
+ { name: 'Bob', car: 'Buick' },
+ { name: 'Cindy', car: 'Ford' },
+ { name: 'Brian', car: 'Audi' },
+ { name: 'Malcom', car: 'Mercedes Benz' },
+ { name: 'Dave', car: 'Ford' },
+ { name: 'Stacey', car: 'Audi' },
+ { name: 'Amy', car: 'Acura' },
+ { name: 'Scott', car: 'Toyota' },
+ { name: 'Ryan', car: 'BMW' },
+ ];
+
+ $scope.gridOptions = {
+ data: 'data',
+ paginationPageSizes: [5, 10, 25],
+ paginationPageSize: 5,
+ columnDefs: [
+ {name: 'name'},
+ {name: 'car'}
+ ]
+ }
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <div ui-grid="gridOptions" ui-grid-pagination></div>
+ </div>
+ </file>
+ </example>
+ */
+ module.directive('uiGridPagination', ['gridUtil', 'uiGridPaginationService',
+ function (gridUtil, uiGridPaginationService) {
+ return {
+ priority: -200,
+ scope: false,
+ require: 'uiGrid',
+ link: {
+ pre: function ($scope, $elm, $attr, uiGridCtrl) {
+ uiGridPaginationService.initializeGrid(uiGridCtrl.grid);
+
+ gridUtil.getTemplate(uiGridCtrl.grid.options.paginationTemplate)
+ .then(function (contents) {
+ var template = angular.element(contents);
+ $elm.append(template);
+ uiGridCtrl.innerCompile(template);
+ });
+ }
+ }
+ };
+ }
+ ]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.pagination.directive:uiGridPager
+ * @element div
+ *
+ * @description Panel for handling pagination
+ */
+ module.directive('uiGridPager', ['uiGridPaginationService', 'uiGridConstants', 'gridUtil', 'i18nService',
+ function (uiGridPaginationService, uiGridConstants, gridUtil, i18nService) {
+ return {
+ priority: -200,
+ scope: true,
+ require: '^uiGrid',
+ link: function ($scope, $elm, $attr, uiGridCtrl) {
+ var defaultFocusElementSelector = '.ui-grid-pager-control-input';
+ $scope.aria = i18nService.getSafeText('pagination.aria'); //Returns an object with all of the aria labels
+
+ $scope.paginationApi = uiGridCtrl.grid.api.pagination;
+ $scope.sizesLabel = i18nService.getSafeText('pagination.sizes');
+ $scope.totalItemsLabel = i18nService.getSafeText('pagination.totalItems');
+ $scope.paginationOf = i18nService.getSafeText('pagination.of');
+ $scope.paginationThrough = i18nService.getSafeText('pagination.through');
+
+ var options = uiGridCtrl.grid.options;
+
+ uiGridCtrl.grid.renderContainers.body.registerViewportAdjuster(function (adjustment) {
+ adjustment.height = adjustment.height - gridUtil.elementHeight($elm);
+ return adjustment;
+ });
+
+ var dataChangeDereg = uiGridCtrl.grid.registerDataChangeCallback(function (grid) {
+ if (!grid.options.useExternalPagination) {
+ grid.options.totalItems = grid.rows.length;
+ }
+ }, [uiGridConstants.dataChange.ROW]);
+
+ $scope.$on('$destroy', dataChangeDereg);
+
+ var setShowing = function () {
+ $scope.showingLow = ((options.paginationCurrentPage - 1) * options.paginationPageSize) + 1;
+ $scope.showingHigh = Math.min(options.paginationCurrentPage * options.paginationPageSize, options.totalItems);
+ };
+
+ var deregT = $scope.$watch('grid.options.totalItems + grid.options.paginationPageSize', setShowing);
+
+ var deregP = $scope.$watch('grid.options.paginationCurrentPage + grid.options.paginationPageSize', function (newValues, oldValues) {
+ if (newValues === oldValues || oldValues === undefined) {
+ return;
+ }
+
+ if (!angular.isNumber(options.paginationCurrentPage) || options.paginationCurrentPage < 1) {
+ options.paginationCurrentPage = 1;
+ return;
+ }
+
+ if (options.totalItems > 0 && options.paginationCurrentPage > $scope.paginationApi.getTotalPages()) {
+ options.paginationCurrentPage = $scope.paginationApi.getTotalPages();
+ return;
+ }
+
+ setShowing();
+ uiGridPaginationService.onPaginationChanged($scope.grid, options.paginationCurrentPage, options.paginationPageSize);
+ }
+ );
+
+ $scope.$on('$destroy', function() {
+ deregT();
+ deregP();
+ });
+
+ $scope.cantPageForward = function () {
+ if (options.totalItems > 0) {
+ return options.paginationCurrentPage >= $scope.paginationApi.getTotalPages();
+ } else {
+ return options.data.length < 1;
+ }
+ };
+
+ $scope.cantPageToLast = function () {
+ if (options.totalItems > 0) {
+ return $scope.cantPageForward();
+ } else {
+ return true;
+ }
+ };
+
+ $scope.cantPageBackward = function () {
+ return options.paginationCurrentPage <= 1;
+ };
+
+ var focusToInputIf = function(condition){
+ if (condition){
+ gridUtil.focus.bySelector($elm, defaultFocusElementSelector);
+ }
+ };
+
+ //Takes care of setting focus to the middle element when focus is lost
+ $scope.pageFirstPageClick = function () {
+ $scope.paginationApi.seek(1);
+ focusToInputIf($scope.cantPageBackward());
+ };
+
+ $scope.pagePreviousPageClick = function () {
+ $scope.paginationApi.previousPage();
+ focusToInputIf($scope.cantPageBackward());
+ };
+
+ $scope.pageNextPageClick = function () {
+ $scope.paginationApi.nextPage();
+ focusToInputIf($scope.cantPageForward());
+ };
+
+ $scope.pageLastPageClick = function () {
+ $scope.paginationApi.seek($scope.paginationApi.getTotalPages());
+ focusToInputIf($scope.cantPageToLast());
+ };
+
+ }
+ };
+ }
+ ]);
+})();
+
+(function () {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.pinning
+ * @description
+ *
+ * # ui.grid.pinning
+ *
+ * <div class="alert alert-success" role="alert"><strong>Stable</strong> This feature is stable. There should no longer be breaking api changes without a deprecation warning.</div>
+ *
+ * This module provides column pinning to the end user via menu options in the column header
+ *
+ * <div doc-module-components="ui.grid.pinning"></div>
+ */
+
+ var module = angular.module('ui.grid.pinning', ['ui.grid']);
+
+ module.constant('uiGridPinningConstants', {
+ container: {
+ LEFT: 'left',
+ RIGHT: 'right',
+ NONE: ''
+ }
+ });
+
+ module.service('uiGridPinningService', ['gridUtil', 'GridRenderContainer', 'i18nService', 'uiGridPinningConstants', function (gridUtil, GridRenderContainer, i18nService, uiGridPinningConstants) {
+ var service = {
+
+ initializeGrid: function (grid) {
+ service.defaultGridOptions(grid.options);
+
+ // Register a column builder to add new menu items for pinning left and right
+ grid.registerColumnBuilder(service.pinningColumnBuilder);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.pinning.api:PublicApi
+ *
+ * @description Public Api for pinning feature
+ */
+ var publicApi = {
+ events: {
+ pinning: {
+ /**
+ * @ngdoc event
+ * @name columnPin
+ * @eventOf ui.grid.pinning.api:PublicApi
+ * @description raised when column pin state has changed
+ * <pre>
+ * gridApi.pinning.on.columnPinned(scope, function(colDef){})
+ * </pre>
+ * @param {object} colDef the column that was changed
+ * @param {string} container the render container the column is in ('left', 'right', '')
+ */
+ columnPinned: function(colDef, container) {
+ }
+ }
+ },
+ methods: {
+ pinning: {
+ /**
+ * @ngdoc function
+ * @name pinColumn
+ * @methodOf ui.grid.pinning.api:PublicApi
+ * @description pin column left, right, or none
+ * <pre>
+ * gridApi.pinning.pinColumn(col, uiGridPinningConstants.container.LEFT)
+ * </pre>
+ * @param {gridColumn} col the column being pinned
+ * @param {string} container one of the recognised types
+ * from uiGridPinningConstants
+ */
+ pinColumn: function(col, container) {
+ service.pinColumn(grid, col, container);
+ }
+ }
+ }
+ };
+
+ grid.api.registerEventsFromObject(publicApi.events);
+ grid.api.registerMethodsFromObject(publicApi.methods);
+ },
+
+ defaultGridOptions: function (gridOptions) {
+ //default option to true unless it was explicitly set to false
+ /**
+ * @ngdoc object
+ * @name ui.grid.pinning.api:GridOptions
+ *
+ * @description GridOptions for pinning feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+
+ /**
+ * @ngdoc object
+ * @name enablePinning
+ * @propertyOf ui.grid.pinning.api:GridOptions
+ * @description Enable pinning for the entire grid.
+ * <br/>Defaults to true
+ */
+ gridOptions.enablePinning = gridOptions.enablePinning !== false;
+
+ },
+
+ pinningColumnBuilder: function (colDef, col, gridOptions) {
+ //default to true unless gridOptions or colDef is explicitly false
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.pinning.api:ColumnDef
+ *
+ * @description ColumnDef for pinning feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions.columnDef gridOptions.columnDefs}
+ */
+
+ /**
+ * @ngdoc object
+ * @name enablePinning
+ * @propertyOf ui.grid.pinning.api:ColumnDef
+ * @description Enable pinning for the individual column.
+ * <br/>Defaults to true
+ */
+ colDef.enablePinning = colDef.enablePinning === undefined ? gridOptions.enablePinning : colDef.enablePinning;
+
+
+ /**
+ * @ngdoc object
+ * @name pinnedLeft
+ * @propertyOf ui.grid.pinning.api:ColumnDef
+ * @description Column is pinned left when grid is rendered
+ * <br/>Defaults to false
+ */
+
+ /**
+ * @ngdoc object
+ * @name pinnedRight
+ * @propertyOf ui.grid.pinning.api:ColumnDef
+ * @description Column is pinned right when grid is rendered
+ * <br/>Defaults to false
+ */
+ if (colDef.pinnedLeft) {
+ col.renderContainer = 'left';
+ col.grid.createLeftContainer();
+ }
+ else if (colDef.pinnedRight) {
+ col.renderContainer = 'right';
+ col.grid.createRightContainer();
+ }
+
+ if (!colDef.enablePinning) {
+ return;
+ }
+
+ var pinColumnLeftAction = {
+ name: 'ui.grid.pinning.pinLeft',
+ title: i18nService.get().pinning.pinLeft,
+ icon: 'ui-grid-icon-left-open',
+ shown: function () {
+ return typeof(this.context.col.renderContainer) === 'undefined' || !this.context.col.renderContainer || this.context.col.renderContainer !== 'left';
+ },
+ action: function () {
+ service.pinColumn(this.context.col.grid, this.context.col, uiGridPinningConstants.container.LEFT);
+ }
+ };
+
+ var pinColumnRightAction = {
+ name: 'ui.grid.pinning.pinRight',
+ title: i18nService.get().pinning.pinRight,
+ icon: 'ui-grid-icon-right-open',
+ shown: function () {
+ return typeof(this.context.col.renderContainer) === 'undefined' || !this.context.col.renderContainer || this.context.col.renderContainer !== 'right';
+ },
+ action: function () {
+ service.pinColumn(this.context.col.grid, this.context.col, uiGridPinningConstants.container.RIGHT);
+ }
+ };
+
+ var removePinAction = {
+ name: 'ui.grid.pinning.unpin',
+ title: i18nService.get().pinning.unpin,
+ icon: 'ui-grid-icon-cancel',
+ shown: function () {
+ return typeof(this.context.col.renderContainer) !== 'undefined' && this.context.col.renderContainer !== null && this.context.col.renderContainer !== 'body';
+ },
+ action: function () {
+ service.pinColumn(this.context.col.grid, this.context.col, uiGridPinningConstants.container.UNPIN);
+ }
+ };
+
+ if (!gridUtil.arrayContainsObjectWithProperty(col.menuItems, 'name', 'ui.grid.pinning.pinLeft')) {
+ col.menuItems.push(pinColumnLeftAction);
+ }
+ if (!gridUtil.arrayContainsObjectWithProperty(col.menuItems, 'name', 'ui.grid.pinning.pinRight')) {
+ col.menuItems.push(pinColumnRightAction);
+ }
+ if (!gridUtil.arrayContainsObjectWithProperty(col.menuItems, 'name', 'ui.grid.pinning.unpin')) {
+ col.menuItems.push(removePinAction);
+ }
+ },
+
+ pinColumn: function(grid, col, container) {
+ if (container === uiGridPinningConstants.container.NONE) {
+ col.renderContainer = null;
+ }
+ else {
+ col.renderContainer = container;
+ if (container === uiGridPinningConstants.container.LEFT) {
+ grid.createLeftContainer();
+ }
+ else if (container === uiGridPinningConstants.container.RIGHT) {
+ grid.createRightContainer();
+ }
+ }
+
+ grid.refresh()
+ .then(function() {
+ grid.api.pinning.raise.columnPinned( col.colDef, container );
+ });
+ }
+ };
+
+ return service;
+ }]);
+
+ module.directive('uiGridPinning', ['gridUtil', 'uiGridPinningService',
+ function (gridUtil, uiGridPinningService) {
+ return {
+ require: 'uiGrid',
+ scope: false,
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ uiGridPinningService.initializeGrid(uiGridCtrl.grid);
+ },
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ }
+ };
+ }
+ };
+ }]);
+
+
+})();
+
+(function(){
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.resizeColumns
+ * @description
+ *
+ * # ui.grid.resizeColumns
+ *
+ * <div class="alert alert-success" role="alert"><strong>Stable</strong> This feature is stable. There should no longer be breaking api changes without a deprecation warning.</div>
+ *
+ * This module allows columns to be resized.
+ */
+ var module = angular.module('ui.grid.resizeColumns', ['ui.grid']);
+
+ module.service('uiGridResizeColumnsService', ['gridUtil', '$q', '$timeout',
+ function (gridUtil, $q, $timeout) {
+
+ var service = {
+ defaultGridOptions: function(gridOptions){
+ //default option to true unless it was explicitly set to false
+ /**
+ * @ngdoc object
+ * @name ui.grid.resizeColumns.api:GridOptions
+ *
+ * @description GridOptions for resizeColumns feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+
+ /**
+ * @ngdoc object
+ * @name enableColumnResizing
+ * @propertyOf ui.grid.resizeColumns.api:GridOptions
+ * @description Enable column resizing on the entire grid
+ * <br/>Defaults to true
+ */
+ gridOptions.enableColumnResizing = gridOptions.enableColumnResizing !== false;
+
+ //legacy support
+ //use old name if it is explicitly false
+ if (gridOptions.enableColumnResize === false){
+ gridOptions.enableColumnResizing = false;
+ }
+ },
+
+ colResizerColumnBuilder: function (colDef, col, gridOptions) {
+
+ var promises = [];
+ /**
+ * @ngdoc object
+ * @name ui.grid.resizeColumns.api:ColumnDef
+ *
+ * @description ColumnDef for resizeColumns feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions.columnDef gridOptions.columnDefs}
+ */
+
+ /**
+ * @ngdoc object
+ * @name enableColumnResizing
+ * @propertyOf ui.grid.resizeColumns.api:ColumnDef
+ * @description Enable column resizing on an individual column
+ * <br/>Defaults to GridOptions.enableColumnResizing
+ */
+ //default to true unless gridOptions or colDef is explicitly false
+ colDef.enableColumnResizing = colDef.enableColumnResizing === undefined ? gridOptions.enableColumnResizing : colDef.enableColumnResizing;
+
+
+ //legacy support of old option name
+ if (colDef.enableColumnResize === false){
+ colDef.enableColumnResizing = false;
+ }
+
+ return $q.all(promises);
+ },
+
+ registerPublicApi: function (grid) {
+ /**
+ * @ngdoc object
+ * @name ui.grid.resizeColumns.api:PublicApi
+ * @description Public Api for column resize feature.
+ */
+ var publicApi = {
+ events: {
+ /**
+ * @ngdoc event
+ * @name columnSizeChanged
+ * @eventOf ui.grid.resizeColumns.api:PublicApi
+ * @description raised when column is resized
+ * <pre>
+ * gridApi.colResizable.on.columnSizeChanged(scope,function(colDef, deltaChange){})
+ * </pre>
+ * @param {object} colDef the column that was resized
+ * @param {integer} delta of the column size change
+ */
+ colResizable: {
+ columnSizeChanged: function (colDef, deltaChange) {
+ }
+ }
+ }
+ };
+ grid.api.registerEventsFromObject(publicApi.events);
+ },
+
+ fireColumnSizeChanged: function (grid, colDef, deltaChange) {
+ $timeout(function () {
+ if ( grid.api.colResizable ){
+ grid.api.colResizable.raise.columnSizeChanged(colDef, deltaChange);
+ } else {
+ gridUtil.logError("The resizeable api is not registered, this may indicate that you've included the module but not added the 'ui-grid-resize-columns' directive to your grid definition. Cannot raise any events.");
+ }
+ });
+ },
+
+ // get either this column, or the column next to this column, to resize,
+ // returns the column we're going to resize
+ findTargetCol: function(col, position, rtlMultiplier){
+ var renderContainer = col.getRenderContainer();
+
+ if (position === 'left') {
+ // Get the column to the left of this one
+ var colIndex = renderContainer.visibleColumnCache.indexOf(col);
+ return renderContainer.visibleColumnCache[colIndex - 1 * rtlMultiplier];
+ } else {
+ return col;
+ }
+ }
+
+ };
+
+ return service;
+
+ }]);
+
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.resizeColumns.directive:uiGridResizeColumns
+ * @element div
+ * @restrict A
+ * @description
+ * Enables resizing for all columns on the grid. If, for some reason, you want to use the ui-grid-resize-columns directive, but not allow column resizing, you can explicitly set the
+ * option to false. This prevents resizing for the entire grid, regardless of individual columnDef options.
+ *
+ * @example
+ <doc:example module="app">
+ <doc:source>
+ <script>
+ var app = angular.module('app', ['ui.grid', 'ui.grid.resizeColumns']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.gridOpts = {
+ data: [
+ { "name": "Ethel Price", "gender": "female", "company": "Enersol" },
+ { "name": "Claudine Neal", "gender": "female", "company": "Sealoud" },
+ { "name": "Beryl Rice", "gender": "female", "company": "Velity" },
+ { "name": "Wilder Gonzales", "gender": "male", "company": "Geekko" }
+ ]
+ };
+ }]);
+ </script>
+
+ <div ng-controller="MainCtrl">
+ <div class="testGrid" ui-grid="gridOpts" ui-grid-resize-columns ></div>
+ </div>
+ </doc:source>
+ <doc:scenario>
+
+ </doc:scenario>
+ </doc:example>
+ */
+ module.directive('uiGridResizeColumns', ['gridUtil', 'uiGridResizeColumnsService', function (gridUtil, uiGridResizeColumnsService) {
+ return {
+ replace: true,
+ priority: 0,
+ require: '^uiGrid',
+ scope: false,
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ uiGridResizeColumnsService.defaultGridOptions(uiGridCtrl.grid.options);
+ uiGridCtrl.grid.registerColumnBuilder( uiGridResizeColumnsService.colResizerColumnBuilder);
+ uiGridResizeColumnsService.registerPublicApi(uiGridCtrl.grid);
+ },
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ }
+ };
+ }
+ };
+ }]);
+
+ // Extend the uiGridHeaderCell directive
+ module.directive('uiGridHeaderCell', ['gridUtil', '$templateCache', '$compile', '$q', 'uiGridResizeColumnsService', 'uiGridConstants', '$timeout', function (gridUtil, $templateCache, $compile, $q, uiGridResizeColumnsService, uiGridConstants, $timeout) {
+ return {
+ // Run after the original uiGridHeaderCell
+ priority: -10,
+ require: '^uiGrid',
+ // scope: false,
+ compile: function() {
+ return {
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ var grid = uiGridCtrl.grid;
+
+ if (grid.options.enableColumnResizing) {
+ var columnResizerElm = $templateCache.get('ui-grid/columnResizer');
+
+ var rtlMultiplier = 1;
+ //when in RTL mode reverse the direction using the rtlMultiplier and change the position to left
+ if (grid.isRTL()) {
+ $scope.position = 'left';
+ rtlMultiplier = -1;
+ }
+
+ var displayResizers = function(){
+
+ // remove any existing resizers.
+ var resizers = $elm[0].getElementsByClassName('ui-grid-column-resizer');
+ for ( var i = 0; i < resizers.length; i++ ){
+ angular.element(resizers[i]).remove();
+ }
+
+ // get the target column for the left resizer
+ var otherCol = uiGridResizeColumnsService.findTargetCol($scope.col, 'left', rtlMultiplier);
+ var renderContainer = $scope.col.getRenderContainer();
+
+ // Don't append the left resizer if this is the first column or the column to the left of this one has resizing disabled
+ if (otherCol && renderContainer.visibleColumnCache.indexOf($scope.col) !== 0 && otherCol.colDef.enableColumnResizing !== false) {
+ var resizerLeft = angular.element(columnResizerElm).clone();
+ resizerLeft.attr('position', 'left');
+
+ $elm.prepend(resizerLeft);
+ $compile(resizerLeft)($scope);
+ }
+
+ // Don't append the right resizer if this column has resizing disabled
+ if ($scope.col.colDef.enableColumnResizing !== false) {
+ var resizerRight = angular.element(columnResizerElm).clone();
+ resizerRight.attr('position', 'right');
+
+ $elm.append(resizerRight);
+ $compile(resizerRight)($scope);
+ }
+ };
+
+ displayResizers();
+
+ var waitDisplay = function(){
+ $timeout(displayResizers);
+ };
+
+ var dataChangeDereg = grid.registerDataChangeCallback( waitDisplay, [uiGridConstants.dataChange.COLUMN] );
+
+ $scope.$on( '$destroy', dataChangeDereg );
+ }
+ }
+ };
+ }
+ };
+ }]);
+
+
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.resizeColumns.directive:uiGridColumnResizer
+ * @element div
+ * @restrict A
+ *
+ * @description
+ * Draggable handle that controls column resizing.
+ *
+ * @example
+ <doc:example module="app">
+ <doc:source>
+ <script>
+ var app = angular.module('app', ['ui.grid', 'ui.grid.resizeColumns']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.gridOpts = {
+ enableColumnResizing: true,
+ data: [
+ { "name": "Ethel Price", "gender": "female", "company": "Enersol" },
+ { "name": "Claudine Neal", "gender": "female", "company": "Sealoud" },
+ { "name": "Beryl Rice", "gender": "female", "company": "Velity" },
+ { "name": "Wilder Gonzales", "gender": "male", "company": "Geekko" }
+ ]
+ };
+ }]);
+ </script>
+
+ <div ng-controller="MainCtrl">
+ <div class="testGrid" ui-grid="gridOpts"></div>
+ </div>
+ </doc:source>
+ <doc:scenario>
+ // TODO: e2e specs?
+
+ // TODO: post-resize a horizontal scroll event should be fired
+ </doc:scenario>
+ </doc:example>
+ */
+ module.directive('uiGridColumnResizer', ['$document', 'gridUtil', 'uiGridConstants', 'uiGridResizeColumnsService', function ($document, gridUtil, uiGridConstants, uiGridResizeColumnsService) {
+ var resizeOverlay = angular.element('<div class="ui-grid-resize-overlay"></div>');
+
+ var resizer = {
+ priority: 0,
+ scope: {
+ col: '=',
+ position: '@',
+ renderIndex: '='
+ },
+ require: '?^uiGrid',
+ link: function ($scope, $elm, $attrs, uiGridCtrl) {
+ var startX = 0,
+ x = 0,
+ gridLeft = 0,
+ rtlMultiplier = 1;
+
+ //when in RTL mode reverse the direction using the rtlMultiplier and change the position to left
+ if (uiGridCtrl.grid.isRTL()) {
+ $scope.position = 'left';
+ rtlMultiplier = -1;
+ }
+
+ if ($scope.position === 'left') {
+ $elm.addClass('left');
+ }
+ else if ($scope.position === 'right') {
+ $elm.addClass('right');
+ }
+
+ // Refresh the grid canvas
+ // takes an argument representing the diff along the X-axis that the resize had
+ function refreshCanvas(xDiff) {
+ // Then refresh the grid canvas, rebuilding the styles so that the scrollbar updates its size
+ uiGridCtrl.grid.refreshCanvas(true).then( function() {
+ uiGridCtrl.grid.queueGridRefresh();
+ });
+ }
+
+ // Check that the requested width isn't wider than the maxWidth, or narrower than the minWidth
+ // Returns the new recommended with, after constraints applied
+ function constrainWidth(col, width){
+ var newWidth = width;
+
+ // If the new width would be less than the column's allowably minimum width, don't allow it
+ if (col.minWidth && newWidth < col.minWidth) {
+ newWidth = col.minWidth;
+ }
+ else if (col.maxWidth && newWidth > col.maxWidth) {
+ newWidth = col.maxWidth;
+ }
+
+ return newWidth;
+ }
+
+
+ /*
+ * Our approach to event handling aims to deal with both touch devices and mouse devices
+ * We register down handlers on both touch and mouse. When a touchstart or mousedown event
+ * occurs, we register the corresponding touchmove/touchend, or mousemove/mouseend events.
+ *
+ * This way we can listen for both without worrying about the fact many touch devices also emulate
+ * mouse events - basically whichever one we hear first is what we'll go with.
+ */
+ function moveFunction(event, args) {
+ if (event.originalEvent) { event = event.originalEvent; }
+ event.preventDefault();
+
+ x = (event.targetTouches ? event.targetTouches[0] : event).clientX - gridLeft;
+
+ if (x < 0) { x = 0; }
+ else if (x > uiGridCtrl.grid.gridWidth) { x = uiGridCtrl.grid.gridWidth; }
+
+ var col = uiGridResizeColumnsService.findTargetCol($scope.col, $scope.position, rtlMultiplier);
+
+ // Don't resize if it's disabled on this column
+ if (col.colDef.enableColumnResizing === false) {
+ return;
+ }
+
+ if (!uiGridCtrl.grid.element.hasClass('column-resizing')) {
+ uiGridCtrl.grid.element.addClass('column-resizing');
+ }
+
+ // Get the diff along the X axis
+ var xDiff = x - startX;
+
+ // Get the width that this mouse would give the column
+ var newWidth = parseInt(col.drawnWidth + xDiff * rtlMultiplier, 10);
+
+ // check we're not outside the allowable bounds for this column
+ x = x + ( constrainWidth(col, newWidth) - newWidth ) * rtlMultiplier;
+
+ resizeOverlay.css({ left: x + 'px' });
+
+ uiGridCtrl.fireEvent(uiGridConstants.events.ITEM_DRAGGING);
+ }
+
+
+ function upFunction(event, args) {
+ if (event.originalEvent) { event = event.originalEvent; }
+ event.preventDefault();
+
+ uiGridCtrl.grid.element.removeClass('column-resizing');
+
+ resizeOverlay.remove();
+
+ // Resize the column
+ x = (event.changedTouches ? event.changedTouches[0] : event).clientX - gridLeft;
+ var xDiff = x - startX;
+
+ if (xDiff === 0) {
+ // no movement, so just reset event handlers, including turning back on both
+ // down events - we turned one off when this event started
+ offAllEvents();
+ onDownEvents();
+ return;
+ }
+
+ var col = uiGridResizeColumnsService.findTargetCol($scope.col, $scope.position, rtlMultiplier);
+
+ // Don't resize if it's disabled on this column
+ if (col.colDef.enableColumnResizing === false) {
+ return;
+ }
+
+ // Get the new width
+ var newWidth = parseInt(col.drawnWidth + xDiff * rtlMultiplier, 10);
+
+ // check we're not outside the allowable bounds for this column
+ col.width = constrainWidth(col, newWidth);
+ col.hasCustomWidth = true;
+
+ refreshCanvas(xDiff);
+
+ uiGridResizeColumnsService.fireColumnSizeChanged(uiGridCtrl.grid, col.colDef, xDiff);
+
+ // stop listening of up and move events - wait for next down
+ // reset the down events - we will have turned one off when this event started
+ offAllEvents();
+ onDownEvents();
+ }
+
+
+ var downFunction = function(event, args) {
+ if (event.originalEvent) { event = event.originalEvent; }
+ event.stopPropagation();
+
+ // Get the left offset of the grid
+ // gridLeft = uiGridCtrl.grid.element[0].offsetLeft;
+ gridLeft = uiGridCtrl.grid.element[0].getBoundingClientRect().left;
+
+ // Get the starting X position, which is the X coordinate of the click minus the grid's offset
+ startX = (event.targetTouches ? event.targetTouches[0] : event).clientX - gridLeft;
+
+ // Append the resizer overlay
+ uiGridCtrl.grid.element.append(resizeOverlay);
+
+ // Place the resizer overlay at the start position
+ resizeOverlay.css({ left: startX });
+
+ // Add handlers for move and up events - if we were mousedown then we listen for mousemove and mouseup, if
+ // we were touchdown then we listen for touchmove and touchup. Also remove the handler for the equivalent
+ // down event - so if we're touchdown, then remove the mousedown handler until this event is over, if we're
+ // mousedown then remove the touchdown handler until this event is over, this avoids processing duplicate events
+ if ( event.type === 'touchstart' ){
+ $document.on('touchend', upFunction);
+ $document.on('touchmove', moveFunction);
+ $elm.off('mousedown', downFunction);
+ } else {
+ $document.on('mouseup', upFunction);
+ $document.on('mousemove', moveFunction);
+ $elm.off('touchstart', downFunction);
+ }
+ };
+
+ var onDownEvents = function() {
+ $elm.on('mousedown', downFunction);
+ $elm.on('touchstart', downFunction);
+ };
+
+ var offAllEvents = function() {
+ $document.off('mouseup', upFunction);
+ $document.off('touchend', upFunction);
+ $document.off('mousemove', moveFunction);
+ $document.off('touchmove', moveFunction);
+ $elm.off('mousedown', downFunction);
+ $elm.off('touchstart', downFunction);
+ };
+
+ onDownEvents();
+
+
+ // On doubleclick, resize to fit all rendered cells
+ var dblClickFn = function(event, args){
+ event.stopPropagation();
+
+ var col = uiGridResizeColumnsService.findTargetCol($scope.col, $scope.position, rtlMultiplier);
+
+ // Don't resize if it's disabled on this column
+ if (col.colDef.enableColumnResizing === false) {
+ return;
+ }
+
+ // Go through the rendered rows and find out the max size for the data in this column
+ var maxWidth = 0;
+ var xDiff = 0;
+
+ // Get the parent render container element
+ var renderContainerElm = gridUtil.closestElm($elm, '.ui-grid-render-container');
+
+ // Get the cell contents so we measure correctly. For the header cell we have to account for the sort icon and the menu buttons, if present
+ var cells = renderContainerElm.querySelectorAll('.' + uiGridConstants.COL_CLASS_PREFIX + col.uid + ' .ui-grid-cell-contents');
+ Array.prototype.forEach.call(cells, function (cell) {
+ // Get the cell width
+ // gridUtil.logDebug('width', gridUtil.elementWidth(cell));
+
+ // Account for the menu button if it exists
+ var menuButton;
+ if (angular.element(cell).parent().hasClass('ui-grid-header-cell')) {
+ menuButton = angular.element(cell).parent()[0].querySelectorAll('.ui-grid-column-menu-button');
+ }
+
+ gridUtil.fakeElement(cell, {}, function(newElm) {
+ // Make the element float since it's a div and can expand to fill its container
+ var e = angular.element(newElm);
+ e.attr('style', 'float: left');
+
+ var width = gridUtil.elementWidth(e);
+
+ if (menuButton) {
+ var menuButtonWidth = gridUtil.elementWidth(menuButton);
+ width = width + menuButtonWidth;
+ }
+
+ if (width > maxWidth) {
+ maxWidth = width;
+ xDiff = maxWidth - width;
+ }
+ });
+ });
+
+ // check we're not outside the allowable bounds for this column
+ col.width = constrainWidth(col, maxWidth);
+ col.hasCustomWidth = true;
+
+ refreshCanvas(xDiff);
+
+ uiGridResizeColumnsService.fireColumnSizeChanged(uiGridCtrl.grid, col.colDef, xDiff); };
+ $elm.on('dblclick', dblClickFn);
+
+ $elm.on('$destroy', function() {
+ $elm.off('dblclick', dblClickFn);
+ offAllEvents();
+ });
+ }
+ };
+
+ return resizer;
+ }]);
+
+})();
+
+(function () {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.rowEdit
+ * @description
+ *
+ * # ui.grid.rowEdit
+ *
+ * <div class="alert alert-success" role="alert"><strong>Stable</strong> This feature is stable. There should no longer be breaking api changes without a deprecation warning.</div>
+ *
+ * This module extends the edit feature to provide tracking and saving of rows
+ * of data. The tutorial provides more information on how this feature is best
+ * used {@link tutorial/205_row_editable here}.
+ * <br/>
+ * This feature depends on usage of the ui-grid-edit feature, and also benefits
+ * from use of ui-grid-cellNav to provide the full spreadsheet-like editing
+ * experience
+ *
+ */
+
+ var module = angular.module('ui.grid.rowEdit', ['ui.grid', 'ui.grid.edit', 'ui.grid.cellNav']);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.rowEdit.constant:uiGridRowEditConstants
+ *
+ * @description constants available in row edit module
+ */
+ module.constant('uiGridRowEditConstants', {
+ });
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.rowEdit.service:uiGridRowEditService
+ *
+ * @description Services for row editing features
+ */
+ module.service('uiGridRowEditService', ['$interval', '$q', 'uiGridConstants', 'uiGridRowEditConstants', 'gridUtil',
+ function ($interval, $q, uiGridConstants, uiGridRowEditConstants, gridUtil) {
+
+ var service = {
+
+ initializeGrid: function (scope, grid) {
+ /**
+ * @ngdoc object
+ * @name ui.grid.rowEdit.api:PublicApi
+ *
+ * @description Public Api for rowEdit feature
+ */
+
+ grid.rowEdit = {};
+
+ var publicApi = {
+ events: {
+ rowEdit: {
+ /**
+ * @ngdoc event
+ * @eventOf ui.grid.rowEdit.api:PublicApi
+ * @name saveRow
+ * @description raised when a row is ready for saving. Once your
+ * row has saved you may need to use angular.extend to update the
+ * data entity with any changed data from your save (for example,
+ * lock version information if you're using optimistic locking,
+ * or last update time/user information).
+ *
+ * Your method should call setSavePromise somewhere in the body before
+ * returning control. The feature will then wait, with the gridRow greyed out
+ * whilst this promise is being resolved.
+ *
+ * <pre>
+ * gridApi.rowEdit.on.saveRow(scope,function(rowEntity){})
+ * </pre>
+ * and somewhere within the event handler:
+ * <pre>
+ * gridApi.rowEdit.setSavePromise( rowEntity, savePromise)
+ * </pre>
+ * @param {object} rowEntity the options.data element that was edited
+ * @returns {promise} Your saveRow method should return a promise, the
+ * promise should either be resolved (implying successful save), or
+ * rejected (implying an error).
+ */
+ saveRow: function (rowEntity) {
+ }
+ }
+ },
+ methods: {
+ rowEdit: {
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.api:PublicApi
+ * @name setSavePromise
+ * @description Sets the promise associated with the row save, mandatory that
+ * the saveRow event handler calls this method somewhere before returning.
+ * <pre>
+ * gridApi.rowEdit.setSavePromise(rowEntity, savePromise)
+ * </pre>
+ * @param {object} rowEntity a data row from the grid for which a save has
+ * been initiated
+ * @param {promise} savePromise the promise that will be resolved when the
+ * save is successful, or rejected if the save fails
+ *
+ */
+ setSavePromise: function ( rowEntity, savePromise) {
+ service.setSavePromise(grid, rowEntity, savePromise);
+ },
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.api:PublicApi
+ * @name getDirtyRows
+ * @description Returns all currently dirty rows
+ * <pre>
+ * gridApi.rowEdit.getDirtyRows(grid)
+ * </pre>
+ * @returns {array} An array of gridRows that are currently dirty
+ *
+ */
+ getDirtyRows: function () {
+ return grid.rowEdit.dirtyRows ? grid.rowEdit.dirtyRows : [];
+ },
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.api:PublicApi
+ * @name getErrorRows
+ * @description Returns all currently errored rows
+ * <pre>
+ * gridApi.rowEdit.getErrorRows(grid)
+ * </pre>
+ * @returns {array} An array of gridRows that are currently in error
+ *
+ */
+ getErrorRows: function () {
+ return grid.rowEdit.errorRows ? grid.rowEdit.errorRows : [];
+ },
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.api:PublicApi
+ * @name flushDirtyRows
+ * @description Triggers a save event for all currently dirty rows, could
+ * be used where user presses a save button or navigates away from the page
+ * <pre>
+ * gridApi.rowEdit.flushDirtyRows(grid)
+ * </pre>
+ * @returns {promise} a promise that represents the aggregate of all
+ * of the individual save promises - i.e. it will be resolved when all
+ * the individual save promises have been resolved.
+ *
+ */
+ flushDirtyRows: function () {
+ return service.flushDirtyRows(grid);
+ },
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.api:PublicApi
+ * @name setRowsDirty
+ * @description Sets each of the rows passed in dataRows
+ * to be dirty. note that if you have only just inserted the
+ * rows into your data you will need to wait for a $digest cycle
+ * before the gridRows are present - so often you would wrap this
+ * call in a $interval or $timeout
+ * <pre>
+ * $interval( function() {
+ * gridApi.rowEdit.setRowsDirty(myDataRows);
+ * }, 0, 1);
+ * </pre>
+ * @param {array} dataRows the data entities for which the gridRows
+ * should be set dirty.
+ *
+ */
+ setRowsDirty: function ( dataRows) {
+ service.setRowsDirty(grid, dataRows);
+ },
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.api:PublicApi
+ * @name setRowsClean
+ * @description Sets each of the rows passed in dataRows
+ * to be clean, removing them from the dirty cache and the error cache,
+ * and clearing the error flag and the dirty flag
+ * <pre>
+ * var gridRows = $scope.gridApi.rowEdit.getDirtyRows();
+ * var dataRows = gridRows.map( function( gridRow ) { return gridRow.entity; });
+ * $scope.gridApi.rowEdit.setRowsClean( dataRows );
+ * </pre>
+ * @param {array} dataRows the data entities for which the gridRows
+ * should be set clean.
+ *
+ */
+ setRowsClean: function ( dataRows) {
+ service.setRowsClean(grid, dataRows);
+ }
+ }
+ }
+ };
+
+ grid.api.registerEventsFromObject(publicApi.events);
+ grid.api.registerMethodsFromObject(publicApi.methods);
+
+ grid.api.core.on.renderingComplete( scope, function ( gridApi ) {
+ grid.api.edit.on.afterCellEdit( scope, service.endEditCell );
+ grid.api.edit.on.beginCellEdit( scope, service.beginEditCell );
+ grid.api.edit.on.cancelCellEdit( scope, service.cancelEditCell );
+
+ if ( grid.api.cellNav ) {
+ grid.api.cellNav.on.navigate( scope, service.navigate );
+ }
+ });
+
+ },
+
+ defaultGridOptions: function (gridOptions) {
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.rowEdit.api:GridOptions
+ *
+ * @description Options for configuring the rowEdit feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name saveRow
+ * @description Returns a function that saves the specified row from the grid,
+ * and returns a promise
+ * @param {object} grid the grid for which dirty rows should be flushed
+ * @param {GridRow} gridRow the row that should be saved
+ * @returns {function} the saveRow function returns a function. That function
+ * in turn, when called, returns a promise relating to the save callback
+ */
+ saveRow: function ( grid, gridRow ) {
+ var self = this;
+
+ return function() {
+ gridRow.isSaving = true;
+
+ if ( gridRow.rowEditSavePromise ){
+ // don't save the row again if it's already saving - that causes stale object exceptions
+ return gridRow.rowEditSavePromise;
+ }
+
+ var promise = grid.api.rowEdit.raise.saveRow( gridRow.entity );
+
+ if ( gridRow.rowEditSavePromise ){
+ gridRow.rowEditSavePromise.then( self.processSuccessPromise( grid, gridRow ), self.processErrorPromise( grid, gridRow ));
+ } else {
+ gridUtil.logError( 'A promise was not returned when saveRow event was raised, either nobody is listening to event, or event handler did not return a promise' );
+ }
+ return promise;
+ };
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name setSavePromise
+ * @description Sets the promise associated with the row save, mandatory that
+ * the saveRow event handler calls this method somewhere before returning.
+ * <pre>
+ * gridApi.rowEdit.setSavePromise(grid, rowEntity)
+ * </pre>
+ * @param {object} grid the grid for which dirty rows should be returned
+ * @param {object} rowEntity a data row from the grid for which a save has
+ * been initiated
+ * @param {promise} savePromise the promise that will be resolved when the
+ * save is successful, or rejected if the save fails
+ *
+ */
+ setSavePromise: function (grid, rowEntity, savePromise) {
+ var gridRow = grid.getRow( rowEntity );
+ gridRow.rowEditSavePromise = savePromise;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name processSuccessPromise
+ * @description Returns a function that processes the successful
+ * resolution of a save promise
+ * @param {object} grid the grid for which the promise should be processed
+ * @param {GridRow} gridRow the row that has been saved
+ * @returns {function} the success handling function
+ */
+ processSuccessPromise: function ( grid, gridRow ) {
+ var self = this;
+
+ return function() {
+ delete gridRow.isSaving;
+ delete gridRow.isDirty;
+ delete gridRow.isError;
+ delete gridRow.rowEditSaveTimer;
+ delete gridRow.rowEditSavePromise;
+ self.removeRow( grid.rowEdit.errorRows, gridRow );
+ self.removeRow( grid.rowEdit.dirtyRows, gridRow );
+ };
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name processErrorPromise
+ * @description Returns a function that processes the failed
+ * resolution of a save promise
+ * @param {object} grid the grid for which the promise should be processed
+ * @param {GridRow} gridRow the row that is now in error
+ * @returns {function} the error handling function
+ */
+ processErrorPromise: function ( grid, gridRow ) {
+ return function() {
+ delete gridRow.isSaving;
+ delete gridRow.rowEditSaveTimer;
+ delete gridRow.rowEditSavePromise;
+
+ gridRow.isError = true;
+
+ if (!grid.rowEdit.errorRows){
+ grid.rowEdit.errorRows = [];
+ }
+ if (!service.isRowPresent( grid.rowEdit.errorRows, gridRow ) ){
+ grid.rowEdit.errorRows.push( gridRow );
+ }
+ };
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name removeRow
+ * @description Removes a row from a cache of rows - either
+ * grid.rowEdit.errorRows or grid.rowEdit.dirtyRows. If the row
+ * is not present silently does nothing.
+ * @param {array} rowArray the array from which to remove the row
+ * @param {GridRow} gridRow the row that should be removed
+ */
+ removeRow: function( rowArray, removeGridRow ){
+ if (typeof(rowArray) === 'undefined' || rowArray === null){
+ return;
+ }
+
+ rowArray.forEach( function( gridRow, index ){
+ if ( gridRow.uid === removeGridRow.uid ){
+ rowArray.splice( index, 1);
+ }
+ });
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name isRowPresent
+ * @description Checks whether a row is already present
+ * in the given array
+ * @param {array} rowArray the array in which to look for the row
+ * @param {GridRow} gridRow the row that should be looked for
+ */
+ isRowPresent: function( rowArray, removeGridRow ){
+ var present = false;
+ rowArray.forEach( function( gridRow, index ){
+ if ( gridRow.uid === removeGridRow.uid ){
+ present = true;
+ }
+ });
+ return present;
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name flushDirtyRows
+ * @description Triggers a save event for all currently dirty rows, could
+ * be used where user presses a save button or navigates away from the page
+ * <pre>
+ * gridApi.rowEdit.flushDirtyRows(grid)
+ * </pre>
+ * @param {object} grid the grid for which dirty rows should be flushed
+ * @returns {promise} a promise that represents the aggregate of all
+ * of the individual save promises - i.e. it will be resolved when all
+ * the individual save promises have been resolved.
+ *
+ */
+ flushDirtyRows: function(grid){
+ var promises = [];
+ grid.api.rowEdit.getDirtyRows().forEach( function( gridRow ){
+ service.saveRow( grid, gridRow )();
+ promises.push( gridRow.rowEditSavePromise );
+ });
+
+ return $q.all( promises );
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name endEditCell
+ * @description Receives an afterCellEdit event from the edit function,
+ * and sets flags as appropriate. Only the rowEntity parameter
+ * is processed, although other params are available. Grid
+ * is automatically provided by the gridApi.
+ * @param {object} rowEntity the data entity for which the cell
+ * was edited
+ */
+ endEditCell: function( rowEntity, colDef, newValue, previousValue ){
+ var grid = this.grid;
+ var gridRow = grid.getRow( rowEntity );
+ if ( !gridRow ){ gridUtil.logError( 'Unable to find rowEntity in grid data, dirty flag cannot be set' ); return; }
+
+ if ( newValue !== previousValue || gridRow.isDirty ){
+ if ( !grid.rowEdit.dirtyRows ){
+ grid.rowEdit.dirtyRows = [];
+ }
+
+ if ( !gridRow.isDirty ){
+ gridRow.isDirty = true;
+ grid.rowEdit.dirtyRows.push( gridRow );
+ }
+
+ delete gridRow.isError;
+
+ service.considerSetTimer( grid, gridRow );
+ }
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name beginEditCell
+ * @description Receives a beginCellEdit event from the edit function,
+ * and cancels any rowEditSaveTimers if present, as the user is still editing
+ * this row. Only the rowEntity parameter
+ * is processed, although other params are available. Grid
+ * is automatically provided by the gridApi.
+ * @param {object} rowEntity the data entity for which the cell
+ * editing has commenced
+ */
+ beginEditCell: function( rowEntity, colDef ){
+ var grid = this.grid;
+ var gridRow = grid.getRow( rowEntity );
+ if ( !gridRow ){ gridUtil.logError( 'Unable to find rowEntity in grid data, timer cannot be cancelled' ); return; }
+
+ service.cancelTimer( grid, gridRow );
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name cancelEditCell
+ * @description Receives a cancelCellEdit event from the edit function,
+ * and if the row was already dirty, restarts the save timer. If the row
+ * was not already dirty, then it's not dirty now either and does nothing.
+ *
+ * Only the rowEntity parameter
+ * is processed, although other params are available. Grid
+ * is automatically provided by the gridApi.
+ *
+ * @param {object} rowEntity the data entity for which the cell
+ * editing was cancelled
+ */
+ cancelEditCell: function( rowEntity, colDef ){
+ var grid = this.grid;
+ var gridRow = grid.getRow( rowEntity );
+ if ( !gridRow ){ gridUtil.logError( 'Unable to find rowEntity in grid data, timer cannot be set' ); return; }
+
+ service.considerSetTimer( grid, gridRow );
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name navigate
+ * @description cellNav tells us that the selected cell has changed. If
+ * the new row had a timer running, then stop it similar to in a beginCellEdit
+ * call. If the old row is dirty and not the same as the new row, then
+ * start a timer on it.
+ * @param {object} newRowCol the row and column that were selected
+ * @param {object} oldRowCol the row and column that was left
+ *
+ */
+ navigate: function( newRowCol, oldRowCol ){
+ var grid = this.grid;
+ if ( newRowCol.row.rowEditSaveTimer ){
+ service.cancelTimer( grid, newRowCol.row );
+ }
+
+ if ( oldRowCol && oldRowCol.row && oldRowCol.row !== newRowCol.row ){
+ service.considerSetTimer( grid, oldRowCol.row );
+ }
+ },
+
+
+ /**
+ * @ngdoc property
+ * @propertyOf ui.grid.rowEdit.api:GridOptions
+ * @name rowEditWaitInterval
+ * @description How long the grid should wait for another change on this row
+ * before triggering a save (in milliseconds). If set to -1, then saves are
+ * never triggered by timer (implying that the user will call flushDirtyRows()
+ * manually)
+ *
+ * @example
+ * Setting the wait interval to 4 seconds
+ * <pre>
+ * $scope.gridOptions = { rowEditWaitInterval: 4000 }
+ * </pre>
+ *
+ */
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name considerSetTimer
+ * @description Consider setting a timer on this row (if it is dirty). if there is a timer running
+ * on the row and the row isn't currently saving, cancel it, using cancelTimer, then if the row is
+ * dirty and not currently saving then set a new timer
+ * @param {object} grid the grid for which we are processing
+ * @param {GridRow} gridRow the row for which the timer should be adjusted
+ *
+ */
+ considerSetTimer: function( grid, gridRow ){
+ service.cancelTimer( grid, gridRow );
+
+ if ( gridRow.isDirty && !gridRow.isSaving ){
+ if ( grid.options.rowEditWaitInterval !== -1 ){
+ var waitTime = grid.options.rowEditWaitInterval ? grid.options.rowEditWaitInterval : 2000;
+ gridRow.rowEditSaveTimer = $interval( service.saveRow( grid, gridRow ), waitTime, 1);
+ }
+ }
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name cancelTimer
+ * @description cancel the $interval for any timer running on this row
+ * then delete the timer itself
+ * @param {object} grid the grid for which we are processing
+ * @param {GridRow} gridRow the row for which the timer should be adjusted
+ *
+ */
+ cancelTimer: function( grid, gridRow ){
+ if ( gridRow.rowEditSaveTimer && !gridRow.isSaving ){
+ $interval.cancel(gridRow.rowEditSaveTimer);
+ delete gridRow.rowEditSaveTimer;
+ }
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name setRowsDirty
+ * @description Sets each of the rows passed in dataRows
+ * to be dirty. note that if you have only just inserted the
+ * rows into your data you will need to wait for a $digest cycle
+ * before the gridRows are present - so often you would wrap this
+ * call in a $interval or $timeout
+ * <pre>
+ * $interval( function() {
+ * gridApi.rowEdit.setRowsDirty( myDataRows);
+ * }, 0, 1);
+ * </pre>
+ * @param {object} grid the grid for which rows should be set dirty
+ * @param {array} dataRows the data entities for which the gridRows
+ * should be set dirty.
+ *
+ */
+ setRowsDirty: function( grid, myDataRows ) {
+ var gridRow;
+ myDataRows.forEach( function( value, index ){
+ gridRow = grid.getRow( value );
+ if ( gridRow ){
+ if ( !grid.rowEdit.dirtyRows ){
+ grid.rowEdit.dirtyRows = [];
+ }
+
+ if ( !gridRow.isDirty ){
+ gridRow.isDirty = true;
+ grid.rowEdit.dirtyRows.push( gridRow );
+ }
+
+ delete gridRow.isError;
+
+ service.considerSetTimer( grid, gridRow );
+ } else {
+ gridUtil.logError( "requested row not found in rowEdit.setRowsDirty, row was: " + value );
+ }
+ });
+ },
+
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.grid.rowEdit.service:uiGridRowEditService
+ * @name setRowsClean
+ * @description Sets each of the rows passed in dataRows
+ * to be clean, clearing the dirty flag and the error flag, and removing
+ * the rows from the dirty and error caches.
+ * @param {object} grid the grid for which rows should be set clean
+ * @param {array} dataRows the data entities for which the gridRows
+ * should be set clean.
+ *
+ */
+ setRowsClean: function( grid, myDataRows ) {
+ var gridRow;
+
+ myDataRows.forEach( function( value, index ){
+ gridRow = grid.getRow( value );
+ if ( gridRow ){
+ delete gridRow.isDirty;
+ service.removeRow( grid.rowEdit.dirtyRows, gridRow );
+ service.cancelTimer( grid, gridRow );
+
+ delete gridRow.isError;
+ service.removeRow( grid.rowEdit.errorRows, gridRow );
+ } else {
+ gridUtil.logError( "requested row not found in rowEdit.setRowsClean, row was: " + value );
+ }
+ });
+ }
+
+ };
+
+ return service;
+
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.rowEdit.directive:uiGridEdit
+ * @element div
+ * @restrict A
+ *
+ * @description Adds row editing features to the ui-grid-edit directive.
+ *
+ */
+ module.directive('uiGridRowEdit', ['gridUtil', 'uiGridRowEditService', 'uiGridEditConstants',
+ function (gridUtil, uiGridRowEditService, uiGridEditConstants) {
+ return {
+ replace: true,
+ priority: 0,
+ require: '^uiGrid',
+ scope: false,
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ uiGridRowEditService.initializeGrid($scope, uiGridCtrl.grid);
+ },
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+ }
+ };
+ }
+ };
+ }]);
+
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.rowEdit.directive:uiGridViewport
+ * @element div
+ *
+ * @description Stacks on top of ui.grid.uiGridViewport to alter the attributes used
+ * for the grid row to allow coloring of saving and error rows
+ */
+ module.directive('uiGridViewport',
+ ['$compile', 'uiGridConstants', 'gridUtil', '$parse',
+ function ($compile, uiGridConstants, gridUtil, $parse) {
+ return {
+ priority: -200, // run after default directive
+ scope: false,
+ compile: function ($elm, $attrs) {
+ var rowRepeatDiv = angular.element($elm.children().children()[0]);
+
+ var existingNgClass = rowRepeatDiv.attr("ng-class");
+ var newNgClass = '';
+ if ( existingNgClass ) {
+ newNgClass = existingNgClass.slice(0, -1) + ", 'ui-grid-row-dirty': row.isDirty, 'ui-grid-row-saving': row.isSaving, 'ui-grid-row-error': row.isError}";
+ } else {
+ newNgClass = "{'ui-grid-row-dirty': row.isDirty, 'ui-grid-row-saving': row.isSaving, 'ui-grid-row-error': row.isError}";
+ }
+ rowRepeatDiv.attr("ng-class", newNgClass);
+
+ return {
+ pre: function ($scope, $elm, $attrs, controllers) {
+
+ },
+ post: function ($scope, $elm, $attrs, controllers) {
+ }
+ };
+ }
+ };
+ }]);
+
+})();
+
+(function () {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.saveState
+ * @description
+ *
+ * # ui.grid.saveState
+ *
+ * <div class="alert alert-success" role="alert"><strong>Stable</strong> This feature is stable. There should no longer be breaking api changes without a deprecation warning.</div>
+ *
+ * This module provides the ability to save the grid state, and restore
+ * it when the user returns to the page.
+ *
+ * No UI is provided, the caller should provide their own UI/buttons
+ * as appropriate. Usually the navigate events would be used to save
+ * the grid state and restore it.
+ *
+ * <br/>
+ * <br/>
+ *
+ * <div doc-module-components="ui.grid.save-state"></div>
+ */
+
+ var module = angular.module('ui.grid.saveState', ['ui.grid', 'ui.grid.selection', 'ui.grid.cellNav', 'ui.grid.grouping', 'ui.grid.pinning', 'ui.grid.treeView']);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.saveState.constant:uiGridSaveStateConstants
+ *
+ * @description constants available in save state module
+ */
+
+ module.constant('uiGridSaveStateConstants', {
+ featureName: 'saveState'
+ });
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.saveState.service:uiGridSaveStateService
+ *
+ * @description Services for saveState feature
+ */
+ module.service('uiGridSaveStateService', ['$q', 'uiGridSaveStateConstants', 'gridUtil', '$compile', '$interval', 'uiGridConstants',
+ function ($q, uiGridSaveStateConstants, gridUtil, $compile, $interval, uiGridConstants ) {
+
+ var service = {
+
+ initializeGrid: function (grid) {
+
+ //add feature namespace and any properties to grid for needed state
+ grid.saveState = {};
+ this.defaultGridOptions(grid.options);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.saveState.api:PublicApi
+ *
+ * @description Public Api for saveState feature
+ */
+ var publicApi = {
+ events: {
+ saveState: {
+ }
+ },
+ methods: {
+ saveState: {
+ /**
+ * @ngdoc function
+ * @name save
+ * @methodOf ui.grid.saveState.api:PublicApi
+ * @description Packages the current state of the grid into
+ * an object, and provides it to the user for saving
+ * @returns {object} the state as a javascript object that can be saved
+ */
+ save: function () {
+ return service.save(grid);
+ },
+ /**
+ * @ngdoc function
+ * @name restore
+ * @methodOf ui.grid.saveState.api:PublicApi
+ * @description Restores the provided state into the grid
+ * @param {scope} $scope a scope that we can broadcast on
+ * @param {object} state the state that should be restored into the grid
+ */
+ restore: function ( $scope, state) {
+ service.restore(grid, $scope, state);
+ }
+ }
+ }
+ };
+
+ grid.api.registerEventsFromObject(publicApi.events);
+
+ grid.api.registerMethodsFromObject(publicApi.methods);
+
+ },
+
+ defaultGridOptions: function (gridOptions) {
+ //default option to true unless it was explicitly set to false
+ /**
+ * @ngdoc object
+ * @name ui.grid.saveState.api:GridOptions
+ *
+ * @description GridOptions for saveState feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+ /**
+ * @ngdoc object
+ * @name saveWidths
+ * @propertyOf ui.grid.saveState.api:GridOptions
+ * @description Save the current column widths. Note that unless
+ * you've provided the user with some way to resize their columns (say
+ * the resize columns feature), then this makes little sense.
+ * <br/>Defaults to true
+ */
+ gridOptions.saveWidths = gridOptions.saveWidths !== false;
+ /**
+ * @ngdoc object
+ * @name saveOrder
+ * @propertyOf ui.grid.saveState.api:GridOptions
+ * @description Restore the current column order. Note that unless
+ * you've provided the user with some way to reorder their columns (for
+ * example the move columns feature), this makes little sense.
+ * <br/>Defaults to true
+ */
+ gridOptions.saveOrder = gridOptions.saveOrder !== false;
+ /**
+ * @ngdoc object
+ * @name saveScroll
+ * @propertyOf ui.grid.saveState.api:GridOptions
+ * @description Save the current scroll position. Note that this
+ * is saved as the percentage of the grid scrolled - so if your
+ * user returns to a grid with a significantly different number of
+ * rows (perhaps some data has been deleted) then the scroll won't
+ * actually show the same rows as before. If you want to scroll to
+ * a specific row then you should instead use the saveFocus option, which
+ * is the default.
+ *
+ * Note that this element will only be saved if the cellNav feature is
+ * enabled
+ * <br/>Defaults to false
+ */
+ gridOptions.saveScroll = gridOptions.saveScroll === true;
+ /**
+ * @ngdoc object
+ * @name saveFocus
+ * @propertyOf ui.grid.saveState.api:GridOptions
+ * @description Save the current focused cell. On returning
+ * to this focused cell we'll also scroll. This option is
+ * preferred to the saveScroll option, so is set to true by
+ * default. If saveScroll is set to true then this option will
+ * be disabled.
+ *
+ * By default this option saves the current row number and column
+ * number, and returns to that row and column. However, if you define
+ * a saveRowIdentity function, then it will return you to the currently
+ * selected column within that row (in a business sense - so if some
+ * rows have been deleted, it will still find the same data, presuming it
+ * still exists in the list. If it isn't in the list then it will instead
+ * return to the same row number - i.e. scroll percentage)
+ *
+ * Note that this option will do nothing if the cellNav
+ * feature is not enabled.
+ *
+ * <br/>Defaults to true (unless saveScroll is true)
+ */
+ gridOptions.saveFocus = gridOptions.saveScroll !== true && gridOptions.saveFocus !== false;
+ /**
+ * @ngdoc object
+ * @name saveRowIdentity
+ * @propertyOf ui.grid.saveState.api:GridOptions
+ * @description A function that can be called, passing in a rowEntity,
+ * and that will return a unique id for that row. This might simply
+ * return the `id` field from that row (if you have one), or it might
+ * concatenate some fields within the row to make a unique value.
+ *
+ * This value will be used to find the same row again and set the focus
+ * to it, if it exists when we return.
+ *
+ * <br/>Defaults to undefined
+ */
+ /**
+ * @ngdoc object
+ * @name saveVisible
+ * @propertyOf ui.grid.saveState.api:GridOptions
+ * @description Save whether or not columns are visible.
+ *
+ * <br/>Defaults to true
+ */
+ gridOptions.saveVisible = gridOptions.saveVisible !== false;
+ /**
+ * @ngdoc object
+ * @name saveSort
+ * @propertyOf ui.grid.saveState.api:GridOptions
+ * @description Save the current sort state for each column
+ *
+ * <br/>Defaults to true
+ */
+ gridOptions.saveSort = gridOptions.saveSort !== false;
+ /**
+ * @ngdoc object
+ * @name saveFilter
+ * @propertyOf ui.grid.saveState.api:GridOptions
+ * @description Save the current filter state for each column
+ *
+ * <br/>Defaults to true
+ */
+ gridOptions.saveFilter = gridOptions.saveFilter !== false;
+ /**
+ * @ngdoc object
+ * @name saveSelection
+ * @propertyOf ui.grid.saveState.api:GridOptions
+ * @description Save the currently selected rows. If the `saveRowIdentity` callback
+ * is defined, then it will save the id of the row and select that. If not, then
+ * it will attempt to select the rows by row number, which will give the wrong results
+ * if the data set has changed in the mean-time.
+ *
+ * Note that this option only does anything
+ * if the selection feature is enabled.
+ *
+ * <br/>Defaults to true
+ */
+ gridOptions.saveSelection = gridOptions.saveSelection !== false;
+ /**
+ * @ngdoc object
+ * @name saveGrouping
+ * @propertyOf ui.grid.saveState.api:GridOptions
+ * @description Save the grouping configuration. If set to true and the
+ * grouping feature is not enabled then does nothing.
+ *
+ * <br/>Defaults to true
+ */
+ gridOptions.saveGrouping = gridOptions.saveGrouping !== false;
+ /**
+ * @ngdoc object
+ * @name saveGroupingExpandedStates
+ * @propertyOf ui.grid.saveState.api:GridOptions
+ * @description Save the grouping row expanded states. If set to true and the
+ * grouping feature is not enabled then does nothing.
+ *
+ * This can be quite a bit of data, in many cases you wouldn't want to save this
+ * information.
+ *
+ * <br/>Defaults to false
+ */
+ gridOptions.saveGroupingExpandedStates = gridOptions.saveGroupingExpandedStates === true;
+ /**
+ * @ngdoc object
+ * @name savePinning
+ * @propertyOf ui.grid.saveState.api:GridOptions
+ * @description Save pinning state for columns.
+ *
+ * <br/>Defaults to true
+ */
+ gridOptions.savePinning = gridOptions.savePinning !== false;
+ /**
+ * @ngdoc object
+ * @name saveTreeView
+ * @propertyOf ui.grid.saveState.api:GridOptions
+ * @description Save the treeView configuration. If set to true and the
+ * treeView feature is not enabled then does nothing.
+ *
+ * <br/>Defaults to true
+ */
+ gridOptions.saveTreeView = gridOptions.saveTreeView !== false;
+ },
+
+
+
+ /**
+ * @ngdoc function
+ * @name save
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Saves the current grid state into an object, and
+ * passes that object back to the caller
+ * @param {Grid} grid the grid whose state we'd like to save
+ * @returns {object} the state ready to be saved
+ */
+ save: function (grid) {
+ var savedState = {};
+
+ savedState.columns = service.saveColumns( grid );
+ savedState.scrollFocus = service.saveScrollFocus( grid );
+ savedState.selection = service.saveSelection( grid );
+ savedState.grouping = service.saveGrouping( grid );
+ savedState.treeView = service.saveTreeView( grid );
+
+ return savedState;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name restore
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Applies the provided state to the grid
+ *
+ * @param {Grid} grid the grid whose state we'd like to restore
+ * @param {scope} $scope a scope that we can broadcast on
+ * @param {object} state the state we'd like to restore
+ */
+ restore: function( grid, $scope, state ){
+ if ( state.columns ) {
+ service.restoreColumns( grid, state.columns );
+ }
+
+ if ( state.scrollFocus ){
+ service.restoreScrollFocus( grid, $scope, state.scrollFocus );
+ }
+
+ if ( state.selection ){
+ service.restoreSelection( grid, state.selection );
+ }
+
+ if ( state.grouping ){
+ service.restoreGrouping( grid, state.grouping );
+ }
+
+ if ( state.treeView ){
+ service.restoreTreeView( grid, state.treeView );
+ }
+
+ grid.refresh();
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name saveColumns
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Saves the column setup, including sort, filters, ordering,
+ * pinning and column widths.
+ *
+ * Works through the current columns, storing them in order. Stores the
+ * column name, then the visible flag, width, sort and filters for each column.
+ *
+ * @param {Grid} grid the grid whose state we'd like to save
+ * @returns {array} the columns state ready to be saved
+ */
+ saveColumns: function( grid ) {
+ var columns = [];
+ grid.getOnlyDataColumns().forEach( function( column ) {
+ var savedColumn = {};
+ savedColumn.name = column.name;
+
+ if ( grid.options.saveVisible ){
+ savedColumn.visible = column.visible;
+ }
+
+ if ( grid.options.saveWidths ){
+ savedColumn.width = column.width;
+ }
+
+ // these two must be copied, not just pointed too - otherwise our saved state is pointing to the same object as current state
+ if ( grid.options.saveSort ){
+ savedColumn.sort = angular.copy( column.sort );
+ }
+
+ if ( grid.options.saveFilter ){
+ savedColumn.filters = [];
+ column.filters.forEach( function( filter ){
+ var copiedFilter = {};
+ angular.forEach( filter, function( value, key) {
+ if ( key !== 'condition' && key !== '$$hashKey' && key !== 'placeholder'){
+ copiedFilter[key] = value;
+ }
+ });
+ savedColumn.filters.push(copiedFilter);
+ });
+ }
+
+ if ( !!grid.api.pinning && grid.options.savePinning ){
+ savedColumn.pinned = column.renderContainer ? column.renderContainer : '';
+ }
+
+ columns.push( savedColumn );
+ });
+
+ return columns;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name saveScrollFocus
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Saves the currently scroll or focus.
+ *
+ * If cellNav isn't present then does nothing - we can't return
+ * to the scroll position without cellNav anyway.
+ *
+ * If the cellNav module is present, and saveFocus is true, then
+ * it saves the currently focused cell. If rowIdentity is present
+ * then saves using rowIdentity, otherwise saves visibleRowNum.
+ *
+ * If the cellNav module is not present, and saveScroll is true, then
+ * it approximates the current scroll row and column, and saves that.
+ *
+ * @param {Grid} grid the grid whose state we'd like to save
+ * @returns {object} the selection state ready to be saved
+ */
+ saveScrollFocus: function( grid ){
+ if ( !grid.api.cellNav ){
+ return {};
+ }
+
+ var scrollFocus = {};
+ if ( grid.options.saveFocus ){
+ scrollFocus.focus = true;
+ var rowCol = grid.api.cellNav.getFocusedCell();
+ if ( rowCol !== null ) {
+ if ( rowCol.col !== null ){
+ scrollFocus.colName = rowCol.col.colDef.name;
+ }
+ if ( rowCol.row !== null ){
+ scrollFocus.rowVal = service.getRowVal( grid, rowCol.row );
+ }
+ }
+ }
+
+ if ( grid.options.saveScroll || grid.options.saveFocus && !scrollFocus.colName && !scrollFocus.rowVal ) {
+ scrollFocus.focus = false;
+ if ( grid.renderContainers.body.prevRowScrollIndex ){
+ scrollFocus.rowVal = service.getRowVal( grid, grid.renderContainers.body.visibleRowCache[ grid.renderContainers.body.prevRowScrollIndex ]);
+ }
+
+ if ( grid.renderContainers.body.prevColScrollIndex ){
+ scrollFocus.colName = grid.renderContainers.body.visibleColumnCache[ grid.renderContainers.body.prevColScrollIndex ].name;
+ }
+ }
+
+ return scrollFocus;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name saveSelection
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Saves the currently selected rows, if the selection feature is enabled
+ * @param {Grid} grid the grid whose state we'd like to save
+ * @returns {array} the selection state ready to be saved
+ */
+ saveSelection: function( grid ){
+ if ( !grid.api.selection || !grid.options.saveSelection ){
+ return [];
+ }
+
+ var selection = grid.api.selection.getSelectedGridRows().map( function( gridRow ) {
+ return service.getRowVal( grid, gridRow );
+ });
+
+ return selection;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name saveGrouping
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Saves the grouping state, if the grouping feature is enabled
+ * @param {Grid} grid the grid whose state we'd like to save
+ * @returns {object} the grouping state ready to be saved
+ */
+ saveGrouping: function( grid ){
+ if ( !grid.api.grouping || !grid.options.saveGrouping ){
+ return {};
+ }
+
+ return grid.api.grouping.getGrouping( grid.options.saveGroupingExpandedStates );
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name saveTreeView
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Saves the tree view state, if the tree feature is enabled
+ * @param {Grid} grid the grid whose state we'd like to save
+ * @returns {object} the tree view state ready to be saved
+ */
+ saveTreeView: function( grid ){
+ if ( !grid.api.treeView || !grid.options.saveTreeView ){
+ return {};
+ }
+
+ return grid.api.treeView.getTreeView();
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name getRowVal
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Helper function that gets either the rowNum or
+ * the saveRowIdentity, given a gridRow
+ * @param {Grid} grid the grid the row is in
+ * @param {GridRow} gridRow the row we want the rowNum for
+ * @returns {object} an object containing { identity: true/false, row: rowNumber/rowIdentity }
+ *
+ */
+ getRowVal: function( grid, gridRow ){
+ if ( !gridRow ) {
+ return null;
+ }
+
+ var rowVal = {};
+ if ( grid.options.saveRowIdentity ){
+ rowVal.identity = true;
+ rowVal.row = grid.options.saveRowIdentity( gridRow.entity );
+ } else {
+ rowVal.identity = false;
+ rowVal.row = grid.renderContainers.body.visibleRowCache.indexOf( gridRow );
+ }
+ return rowVal;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name restoreColumns
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Restores the columns, including order, visible, width,
+ * pinning, sort and filters.
+ *
+ * @param {Grid} grid the grid whose state we'd like to restore
+ * @param {object} columnsState the list of columns we had before, with their state
+ */
+ restoreColumns: function( grid, columnsState ){
+ var isSortChanged = false;
+
+ columnsState.forEach( function( columnState, index ) {
+ var currentCol = grid.getColumn( columnState.name );
+
+ if ( currentCol && !grid.isRowHeaderColumn(currentCol) ){
+ if ( grid.options.saveVisible &&
+ ( currentCol.visible !== columnState.visible ||
+ currentCol.colDef.visible !== columnState.visible ) ){
+ currentCol.visible = columnState.visible;
+ currentCol.colDef.visible = columnState.visible;
+ grid.api.core.raise.columnVisibilityChanged(currentCol);
+ }
+
+ if ( grid.options.saveWidths ){
+ currentCol.width = columnState.width;
+ }
+
+ if ( grid.options.saveSort &&
+ !angular.equals(currentCol.sort, columnState.sort) &&
+ !( currentCol.sort === undefined && angular.isEmpty(columnState.sort) ) ){
+ currentCol.sort = angular.copy( columnState.sort );
+ isSortChanged = true;
+ }
+
+ if ( grid.options.saveFilter &&
+ !angular.equals(currentCol.filters, columnState.filters ) ){
+ columnState.filters.forEach( function( filter, index ){
+ angular.extend( currentCol.filters[index], filter );
+ if ( typeof(filter.term) === 'undefined' || filter.term === null ){
+ delete currentCol.filters[index].term;
+ }
+ });
+ grid.api.core.raise.filterChanged();
+ }
+
+ if ( !!grid.api.pinning && grid.options.savePinning && currentCol.renderContainer !== columnState.pinned ){
+ grid.api.pinning.pinColumn(currentCol, columnState.pinned);
+ }
+
+ var currentIndex = grid.getOnlyDataColumns().indexOf( currentCol );
+ if (currentIndex !== -1) {
+ if (grid.options.saveOrder && currentIndex !== index) {
+ var column = grid.columns.splice(currentIndex + grid.rowHeaderColumns.length, 1)[0];
+ grid.columns.splice(index + grid.rowHeaderColumns.length, 0, column);
+ }
+ }
+ }
+ });
+
+ if ( isSortChanged ) {
+ grid.api.core.raise.sortChanged( grid, grid.getColumnSorting() );
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name restoreScrollFocus
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Scrolls to the position that was saved. If focus is true, then
+ * sets focus to the specified row/col. If focus is false, then scrolls to the
+ * specified row/col.
+ *
+ * @param {Grid} grid the grid whose state we'd like to restore
+ * @param {scope} $scope a scope that we can broadcast on
+ * @param {object} scrollFocusState the scroll/focus state ready to be restored
+ */
+ restoreScrollFocus: function( grid, $scope, scrollFocusState ){
+ if ( !grid.api.cellNav ){
+ return;
+ }
+
+ var colDef, row;
+ if ( scrollFocusState.colName ){
+ var colDefs = grid.options.columnDefs.filter( function( colDef ) { return colDef.name === scrollFocusState.colName; });
+ if ( colDefs.length > 0 ){
+ colDef = colDefs[0];
+ }
+ }
+
+ if ( scrollFocusState.rowVal && scrollFocusState.rowVal.row ){
+ if ( scrollFocusState.rowVal.identity ){
+ row = service.findRowByIdentity( grid, scrollFocusState.rowVal );
+ } else {
+ row = grid.renderContainers.body.visibleRowCache[ scrollFocusState.rowVal.row ];
+ }
+ }
+
+ var entity = row && row.entity ? row.entity : null ;
+
+ if ( colDef || entity ) {
+ if (scrollFocusState.focus ){
+ grid.api.cellNav.scrollToFocus( entity, colDef );
+ } else {
+ grid.scrollTo( entity, colDef );
+ }
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name restoreSelection
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Selects the rows that are provided in the selection
+ * state. If you are using `saveRowIdentity` and more than one row matches the identity
+ * function then only the first is selected.
+ * @param {Grid} grid the grid whose state we'd like to restore
+ * @param {object} selectionState the selection state ready to be restored
+ */
+ restoreSelection: function( grid, selectionState ){
+ if ( !grid.api.selection ){
+ return;
+ }
+
+ grid.api.selection.clearSelectedRows();
+
+ selectionState.forEach( function( rowVal ) {
+ if ( rowVal.identity ){
+ var foundRow = service.findRowByIdentity( grid, rowVal );
+
+ if ( foundRow ){
+ grid.api.selection.selectRow( foundRow.entity );
+ }
+
+ } else {
+ grid.api.selection.selectRowByVisibleIndex( rowVal.row );
+ }
+ });
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name restoreGrouping
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Restores the grouping configuration, if the grouping feature
+ * is enabled.
+ * @param {Grid} grid the grid whose state we'd like to restore
+ * @param {object} groupingState the grouping state ready to be restored
+ */
+ restoreGrouping: function( grid, groupingState ){
+ if ( !grid.api.grouping || typeof(groupingState) === 'undefined' || groupingState === null || angular.equals(groupingState, {}) ){
+ return;
+ }
+
+ grid.api.grouping.setGrouping( groupingState );
+ },
+
+ /**
+ * @ngdoc function
+ * @name restoreTreeView
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Restores the tree view configuration, if the tree view feature
+ * is enabled.
+ * @param {Grid} grid the grid whose state we'd like to restore
+ * @param {object} treeViewState the tree view state ready to be restored
+ */
+ restoreTreeView: function( grid, treeViewState ){
+ if ( !grid.api.treeView || typeof(treeViewState) === 'undefined' || treeViewState === null || angular.equals(treeViewState, {}) ){
+ return;
+ }
+
+ grid.api.treeView.setTreeView( treeViewState );
+ },
+
+ /**
+ * @ngdoc function
+ * @name findRowByIdentity
+ * @methodOf ui.grid.saveState.service:uiGridSaveStateService
+ * @description Finds a row given it's identity value, returns the first found row
+ * if any are found, otherwise returns null if no rows are found.
+ * @param {Grid} grid the grid whose state we'd like to restore
+ * @param {object} rowVal the row we'd like to find
+ * @returns {gridRow} the found row, or null if none found
+ */
+ findRowByIdentity: function( grid, rowVal ){
+ if ( !grid.options.saveRowIdentity ){
+ return null;
+ }
+
+ var filteredRows = grid.rows.filter( function( gridRow ) {
+ if ( grid.options.saveRowIdentity( gridRow.entity ) === rowVal.row ){
+ return true;
+ } else {
+ return false;
+ }
+ });
+
+ if ( filteredRows.length > 0 ){
+ return filteredRows[0];
+ } else {
+ return null;
+ }
+ }
+ };
+
+ return service;
+
+ }
+ ]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.saveState.directive:uiGridSaveState
+ * @element div
+ * @restrict A
+ *
+ * @description Adds saveState features to grid
+ *
+ * @example
+ <example module="app">
+ <file name="app.js">
+ var app = angular.module('app', ['ui.grid', 'ui.grid.saveState']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.data = [
+ { name: 'Bob', title: 'CEO' },
+ { name: 'Frank', title: 'Lowly Developer' }
+ ];
+
+ $scope.gridOptions = {
+ columnDefs: [
+ {name: 'name'},
+ {name: 'title', enableCellEdit: true}
+ ],
+ data: $scope.data
+ };
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <div ui-grid="gridOptions" ui-grid-save-state></div>
+ </div>
+ </file>
+ </example>
+ */
+ module.directive('uiGridSaveState', ['uiGridSaveStateConstants', 'uiGridSaveStateService', 'gridUtil', '$compile',
+ function (uiGridSaveStateConstants, uiGridSaveStateService, gridUtil, $compile) {
+ return {
+ replace: true,
+ priority: 0,
+ require: '^uiGrid',
+ scope: false,
+ link: function ($scope, $elm, $attrs, uiGridCtrl) {
+ uiGridSaveStateService.initializeGrid(uiGridCtrl.grid);
+ }
+ };
+ }
+ ]);
+})();
+
+(function () {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.selection
+ * @description
+ *
+ * # ui.grid.selection
+ * This module provides row selection
+ *
+ * <div class="alert alert-success" role="alert"><strong>Stable</strong> This feature is stable. There should no longer be breaking api changes without a deprecation warning.</div>
+ *
+ * <div doc-module-components="ui.grid.selection"></div>
+ */
+
+ var module = angular.module('ui.grid.selection', ['ui.grid']);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.selection.constant:uiGridSelectionConstants
+ *
+ * @description constants available in selection module
+ */
+ module.constant('uiGridSelectionConstants', {
+ featureName: "selection",
+ selectionRowHeaderColName: 'selectionRowHeaderCol'
+ });
+
+ //add methods to GridRow
+ angular.module('ui.grid').config(['$provide', function($provide) {
+ $provide.decorator('GridRow', ['$delegate', function($delegate) {
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.selection.api:GridRow
+ *
+ * @description GridRow prototype functions added for selection
+ */
+
+ /**
+ * @ngdoc object
+ * @name enableSelection
+ * @propertyOf ui.grid.selection.api:GridRow
+ * @description Enable row selection for this row, only settable by internal code.
+ *
+ * The grouping feature, for example, might set group header rows to not be selectable.
+ * <br/>Defaults to true
+ */
+
+ /**
+ * @ngdoc object
+ * @name isSelected
+ * @propertyOf ui.grid.selection.api:GridRow
+ * @description Selected state of row. Should be readonly. Make any changes to selected state using setSelected().
+ * <br/>Defaults to false
+ */
+
+
+ /**
+ * @ngdoc function
+ * @name setSelected
+ * @methodOf ui.grid.selection.api:GridRow
+ * @description Sets the isSelected property and updates the selectedCount
+ * Changes to isSelected state should only be made via this function
+ * @param {bool} selected value to set
+ */
+ $delegate.prototype.setSelected = function(selected) {
+ this.isSelected = selected;
+ if (selected) {
+ this.grid.selection.selectedCount++;
+ }
+ else {
+ this.grid.selection.selectedCount--;
+ }
+ };
+
+ return $delegate;
+ }]);
+ }]);
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.selection.service:uiGridSelectionService
+ *
+ * @description Services for selection features
+ */
+ module.service('uiGridSelectionService', ['$q', '$templateCache', 'uiGridSelectionConstants', 'gridUtil',
+ function ($q, $templateCache, uiGridSelectionConstants, gridUtil) {
+
+ var service = {
+
+ initializeGrid: function (grid) {
+
+ //add feature namespace and any properties to grid for needed
+ /**
+ * @ngdoc object
+ * @name ui.grid.selection.grid:selection
+ *
+ * @description Grid properties and functions added for selection
+ */
+ grid.selection = {};
+ grid.selection.lastSelectedRow = null;
+ grid.selection.selectAll = false;
+
+
+ /**
+ * @ngdoc object
+ * @name selectedCount
+ * @propertyOf ui.grid.selection.grid:selection
+ * @description Current count of selected rows
+ * @example
+ * var count = grid.selection.selectedCount
+ */
+ grid.selection.selectedCount = 0;
+
+ service.defaultGridOptions(grid.options);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.selection.api:PublicApi
+ *
+ * @description Public Api for selection feature
+ */
+ var publicApi = {
+ events: {
+ selection: {
+ /**
+ * @ngdoc event
+ * @name rowSelectionChanged
+ * @eventOf ui.grid.selection.api:PublicApi
+ * @description is raised after the row.isSelected state is changed
+ * @param {GridRow} row the row that was selected/deselected
+ * @param {Event} event object if raised from an event
+ */
+ rowSelectionChanged: function (scope, row, evt) {
+ },
+ /**
+ * @ngdoc event
+ * @name rowSelectionChangedBatch
+ * @eventOf ui.grid.selection.api:PublicApi
+ * @description is raised after the row.isSelected state is changed
+ * in bulk, if the `enableSelectionBatchEvent` option is set to true
+ * (which it is by default). This allows more efficient processing
+ * of bulk events.
+ * @param {array} rows the rows that were selected/deselected
+ * @param {Event} event object if raised from an event
+ */
+ rowSelectionChangedBatch: function (scope, rows, evt) {
+ }
+ }
+ },
+ methods: {
+ selection: {
+ /**
+ * @ngdoc function
+ * @name toggleRowSelection
+ * @methodOf ui.grid.selection.api:PublicApi
+ * @description Toggles data row as selected or unselected
+ * @param {object} rowEntity gridOptions.data[] array instance
+ * @param {Event} event object if raised from an event
+ */
+ toggleRowSelection: function (rowEntity, evt) {
+ var row = grid.getRow(rowEntity);
+ if (row !== null) {
+ service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
+ }
+ },
+ /**
+ * @ngdoc function
+ * @name selectRow
+ * @methodOf ui.grid.selection.api:PublicApi
+ * @description Select the data row
+ * @param {object} rowEntity gridOptions.data[] array instance
+ * @param {Event} event object if raised from an event
+ */
+ selectRow: function (rowEntity, evt) {
+ var row = grid.getRow(rowEntity);
+ if (row !== null && !row.isSelected) {
+ service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
+ }
+ },
+ /**
+ * @ngdoc function
+ * @name selectRowByVisibleIndex
+ * @methodOf ui.grid.selection.api:PublicApi
+ * @description Select the specified row by visible index (i.e. if you
+ * specify row 0 you'll get the first visible row selected). In this context
+ * visible means of those rows that are theoretically visible (i.e. not filtered),
+ * rather than rows currently rendered on the screen.
+ * @param {number} index index within the rowsVisible array
+ * @param {Event} event object if raised from an event
+ */
+ selectRowByVisibleIndex: function ( rowNum, evt ) {
+ var row = grid.renderContainers.body.visibleRowCache[rowNum];
+ if (row !== null && typeof(row) !== 'undefined' && !row.isSelected) {
+ service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
+ }
+ },
+ /**
+ * @ngdoc function
+ * @name unSelectRow
+ * @methodOf ui.grid.selection.api:PublicApi
+ * @description UnSelect the data row
+ * @param {object} rowEntity gridOptions.data[] array instance
+ * @param {Event} event object if raised from an event
+ */
+ unSelectRow: function (rowEntity, evt) {
+ var row = grid.getRow(rowEntity);
+ if (row !== null && row.isSelected) {
+ service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
+ }
+ },
+ /**
+ * @ngdoc function
+ * @name selectAllRows
+ * @methodOf ui.grid.selection.api:PublicApi
+ * @description Selects all rows. Does nothing if multiSelect = false
+ * @param {Event} event object if raised from an event
+ */
+ selectAllRows: function (evt) {
+ if (grid.options.multiSelect === false) {
+ return;
+ }
+
+ var changedRows = [];
+ grid.rows.forEach(function (row) {
+ if ( !row.isSelected && row.enableSelection !== false ){
+ row.setSelected(true);
+ service.decideRaiseSelectionEvent( grid, row, changedRows, evt );
+ }
+ });
+ service.decideRaiseSelectionBatchEvent( grid, changedRows, evt );
+ grid.selection.selectAll = true;
+ },
+ /**
+ * @ngdoc function
+ * @name selectAllVisibleRows
+ * @methodOf ui.grid.selection.api:PublicApi
+ * @description Selects all visible rows. Does nothing if multiSelect = false
+ * @param {Event} event object if raised from an event
+ */
+ selectAllVisibleRows: function (evt) {
+ if (grid.options.multiSelect === false) {
+ return;
+ }
+
+ var changedRows = [];
+ grid.rows.forEach(function (row) {
+ if (row.visible) {
+ if (!row.isSelected && row.enableSelection !== false){
+ row.setSelected(true);
+ service.decideRaiseSelectionEvent( grid, row, changedRows, evt );
+ }
+ } else {
+ if (row.isSelected){
+ row.setSelected(false);
+ service.decideRaiseSelectionEvent( grid, row, changedRows, evt );
+ }
+ }
+ });
+ service.decideRaiseSelectionBatchEvent( grid, changedRows, evt );
+ grid.selection.selectAll = true;
+ },
+ /**
+ * @ngdoc function
+ * @name clearSelectedRows
+ * @methodOf ui.grid.selection.api:PublicApi
+ * @description Unselects all rows
+ * @param {Event} event object if raised from an event
+ */
+ clearSelectedRows: function (evt) {
+ service.clearSelectedRows(grid, evt);
+ },
+ /**
+ * @ngdoc function
+ * @name getSelectedRows
+ * @methodOf ui.grid.selection.api:PublicApi
+ * @description returns all selectedRow's entity references
+ */
+ getSelectedRows: function () {
+ return service.getSelectedRows(grid).map(function (gridRow) {
+ return gridRow.entity;
+ });
+ },
+ /**
+ * @ngdoc function
+ * @name getSelectedGridRows
+ * @methodOf ui.grid.selection.api:PublicApi
+ * @description returns all selectedRow's as gridRows
+ */
+ getSelectedGridRows: function () {
+ return service.getSelectedRows(grid);
+ },
+ /**
+ * @ngdoc function
+ * @name setMultiSelect
+ * @methodOf ui.grid.selection.api:PublicApi
+ * @description Sets the current gridOption.multiSelect to true or false
+ * @param {bool} multiSelect true to allow multiple rows
+ */
+ setMultiSelect: function (multiSelect) {
+ grid.options.multiSelect = multiSelect;
+ },
+ /**
+ * @ngdoc function
+ * @name setModifierKeysToMultiSelect
+ * @methodOf ui.grid.selection.api:PublicApi
+ * @description Sets the current gridOption.modifierKeysToMultiSelect to true or false
+ * @param {bool} modifierKeysToMultiSelect true to only allow multiple rows when using ctrlKey or shiftKey is used
+ */
+ setModifierKeysToMultiSelect: function (modifierKeysToMultiSelect) {
+ grid.options.modifierKeysToMultiSelect = modifierKeysToMultiSelect;
+ },
+ /**
+ * @ngdoc function
+ * @name getSelectAllState
+ * @methodOf ui.grid.selection.api:PublicApi
+ * @description Returns whether or not the selectAll checkbox is currently ticked. The
+ * grid doesn't automatically select rows when you add extra data - so when you add data
+ * you need to explicitly check whether the selectAll is set, and then call setVisible rows
+ * if it is
+ */
+ getSelectAllState: function () {
+ return grid.selection.selectAll;
+ }
+
+ }
+ }
+ };
+
+ grid.api.registerEventsFromObject(publicApi.events);
+
+ grid.api.registerMethodsFromObject(publicApi.methods);
+
+ },
+
+ defaultGridOptions: function (gridOptions) {
+ //default option to true unless it was explicitly set to false
+ /**
+ * @ngdoc object
+ * @name ui.grid.selection.api:GridOptions
+ *
+ * @description GridOptions for selection feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+
+ /**
+ * @ngdoc object
+ * @name enableRowSelection
+ * @propertyOf ui.grid.selection.api:GridOptions
+ * @description Enable row selection for entire grid.
+ * <br/>Defaults to true
+ */
+ gridOptions.enableRowSelection = gridOptions.enableRowSelection !== false;
+ /**
+ * @ngdoc object
+ * @name multiSelect
+ * @propertyOf ui.grid.selection.api:GridOptions
+ * @description Enable multiple row selection for entire grid
+ * <br/>Defaults to true
+ */
+ gridOptions.multiSelect = gridOptions.multiSelect !== false;
+ /**
+ * @ngdoc object
+ * @name noUnselect
+ * @propertyOf ui.grid.selection.api:GridOptions
+ * @description Prevent a row from being unselected. Works in conjunction
+ * with `multiselect = false` and `gridApi.selection.selectRow()` to allow
+ * you to create a single selection only grid - a row is always selected, you
+ * can only select different rows, you can't unselect the row.
+ * <br/>Defaults to false
+ */
+ gridOptions.noUnselect = gridOptions.noUnselect === true;
+ /**
+ * @ngdoc object
+ * @name modifierKeysToMultiSelect
+ * @propertyOf ui.grid.selection.api:GridOptions
+ * @description Enable multiple row selection only when using the ctrlKey or shiftKey. Requires multiSelect to be true.
+ * <br/>Defaults to false
+ */
+ gridOptions.modifierKeysToMultiSelect = gridOptions.modifierKeysToMultiSelect === true;
+ /**
+ * @ngdoc object
+ * @name enableRowHeaderSelection
+ * @propertyOf ui.grid.selection.api:GridOptions
+ * @description Enable a row header to be used for selection
+ * <br/>Defaults to true
+ */
+ gridOptions.enableRowHeaderSelection = gridOptions.enableRowHeaderSelection !== false;
+ /**
+ * @ngdoc object
+ * @name enableFullRowSelection
+ * @propertyOf ui.grid.selection.api:GridOptions
+ * @description Enable selection by clicking anywhere on the row. Defaults to
+ * false if `enableRowHeaderSelection` is true, otherwise defaults to false.
+ */
+ if ( typeof(gridOptions.enableFullRowSelection) === 'undefined' ){
+ gridOptions.enableFullRowSelection = !gridOptions.enableRowHeaderSelection;
+ }
+ /**
+ * @ngdoc object
+ * @name enableSelectAll
+ * @propertyOf ui.grid.selection.api:GridOptions
+ * @description Enable the select all checkbox at the top of the selectionRowHeader
+ * <br/>Defaults to true
+ */
+ gridOptions.enableSelectAll = gridOptions.enableSelectAll !== false;
+ /**
+ * @ngdoc object
+ * @name enableSelectionBatchEvent
+ * @propertyOf ui.grid.selection.api:GridOptions
+ * @description If selected rows are changed in bulk, either via the API or
+ * via the selectAll checkbox, then a separate event is fired. Setting this
+ * option to false will cause the rowSelectionChanged event to be called multiple times
+ * instead
+ * <br/>Defaults to true
+ */
+ gridOptions.enableSelectionBatchEvent = gridOptions.enableSelectionBatchEvent !== false;
+ /**
+ * @ngdoc object
+ * @name selectionRowHeaderWidth
+ * @propertyOf ui.grid.selection.api:GridOptions
+ * @description can be used to set a custom width for the row header selection column
+ * <br/>Defaults to 30px
+ */
+ gridOptions.selectionRowHeaderWidth = angular.isDefined(gridOptions.selectionRowHeaderWidth) ? gridOptions.selectionRowHeaderWidth : 30;
+
+ /**
+ * @ngdoc object
+ * @name enableFooterTotalSelected
+ * @propertyOf ui.grid.selection.api:GridOptions
+ * @description Shows the total number of selected items in footer if true.
+ * <br/>Defaults to true.
+ * <br/>GridOptions.showGridFooter must also be set to true.
+ */
+ gridOptions.enableFooterTotalSelected = gridOptions.enableFooterTotalSelected !== false;
+
+ /**
+ * @ngdoc object
+ * @name isRowSelectable
+ * @propertyOf ui.grid.selection.api:GridOptions
+ * @description Makes it possible to specify a method that evaluates for each row and sets its "enableSelection" property.
+ */
+
+ gridOptions.isRowSelectable = angular.isDefined(gridOptions.isRowSelectable) ? gridOptions.isRowSelectable : angular.noop;
+ },
+
+ /**
+ * @ngdoc function
+ * @name toggleRowSelection
+ * @methodOf ui.grid.selection.service:uiGridSelectionService
+ * @description Toggles row as selected or unselected
+ * @param {Grid} grid grid object
+ * @param {GridRow} row row to select or deselect
+ * @param {Event} event object if resulting from event
+ * @param {bool} multiSelect if false, only one row at time can be selected
+ * @param {bool} noUnselect if true then rows cannot be unselected
+ */
+ toggleRowSelection: function (grid, row, evt, multiSelect, noUnselect) {
+ var selected = row.isSelected;
+
+ if ( row.enableSelection === false && !selected ){
+ return;
+ }
+
+ var selectedRows;
+ if (!multiSelect && !selected) {
+ service.clearSelectedRows(grid, evt);
+ } else if (!multiSelect && selected) {
+ selectedRows = service.getSelectedRows(grid);
+ if (selectedRows.length > 1) {
+ selected = false; // Enable reselect of the row
+ service.clearSelectedRows(grid, evt);
+ }
+ }
+
+ if (selected && noUnselect){
+ // don't deselect the row
+ } else {
+ row.setSelected(!selected);
+ if (row.isSelected === true) {
+ grid.selection.lastSelectedRow = row;
+ }
+
+ selectedRows = service.getSelectedRows(grid);
+ grid.selection.selectAll = grid.rows.length === selectedRows.length;
+
+ grid.api.selection.raise.rowSelectionChanged(row, evt);
+ }
+ },
+ /**
+ * @ngdoc function
+ * @name shiftSelect
+ * @methodOf ui.grid.selection.service:uiGridSelectionService
+ * @description selects a group of rows from the last selected row using the shift key
+ * @param {Grid} grid grid object
+ * @param {GridRow} clicked row
+ * @param {Event} event object if raised from an event
+ * @param {bool} multiSelect if false, does nothing this is for multiSelect only
+ */
+ shiftSelect: function (grid, row, evt, multiSelect) {
+ if (!multiSelect) {
+ return;
+ }
+ var selectedRows = service.getSelectedRows(grid);
+ var fromRow = selectedRows.length > 0 ? grid.renderContainers.body.visibleRowCache.indexOf(grid.selection.lastSelectedRow) : 0;
+ var toRow = grid.renderContainers.body.visibleRowCache.indexOf(row);
+ //reverse select direction
+ if (fromRow > toRow) {
+ var tmp = fromRow;
+ fromRow = toRow;
+ toRow = tmp;
+ }
+
+ var changedRows = [];
+ for (var i = fromRow; i <= toRow; i++) {
+ var rowToSelect = grid.renderContainers.body.visibleRowCache[i];
+ if (rowToSelect) {
+ if ( !rowToSelect.isSelected && rowToSelect.enableSelection !== false ){
+ rowToSelect.setSelected(true);
+ grid.selection.lastSelectedRow = rowToSelect;
+ service.decideRaiseSelectionEvent( grid, rowToSelect, changedRows, evt );
+ }
+ }
+ }
+ service.decideRaiseSelectionBatchEvent( grid, changedRows, evt );
+ },
+ /**
+ * @ngdoc function
+ * @name getSelectedRows
+ * @methodOf ui.grid.selection.service:uiGridSelectionService
+ * @description Returns all the selected rows
+ * @param {Grid} grid grid object
+ */
+ getSelectedRows: function (grid) {
+ return grid.rows.filter(function (row) {
+ return row.isSelected;
+ });
+ },
+
+ /**
+ * @ngdoc function
+ * @name clearSelectedRows
+ * @methodOf ui.grid.selection.service:uiGridSelectionService
+ * @description Clears all selected rows
+ * @param {Grid} grid grid object
+ * @param {Event} event object if raised from an event
+ */
+ clearSelectedRows: function (grid, evt) {
+ var changedRows = [];
+ service.getSelectedRows(grid).forEach(function (row) {
+ if ( row.isSelected ){
+ row.setSelected(false);
+ service.decideRaiseSelectionEvent( grid, row, changedRows, evt );
+ }
+ });
+ service.decideRaiseSelectionBatchEvent( grid, changedRows, evt );
+ grid.selection.selectAll = false;
+ grid.selection.selectedCount = 0;
+ },
+
+ /**
+ * @ngdoc function
+ * @name decideRaiseSelectionEvent
+ * @methodOf ui.grid.selection.service:uiGridSelectionService
+ * @description Decides whether to raise a single event or a batch event
+ * @param {Grid} grid grid object
+ * @param {GridRow} row row that has changed
+ * @param {array} changedRows an array to which we can append the changed
+ * @param {Event} event object if raised from an event
+ * row if we're doing batch events
+ */
+ decideRaiseSelectionEvent: function( grid, row, changedRows, evt ){
+ if ( !grid.options.enableSelectionBatchEvent ){
+ grid.api.selection.raise.rowSelectionChanged(row, evt);
+ } else {
+ changedRows.push(row);
+ }
+ },
+
+ /**
+ * @ngdoc function
+ * @name raiseSelectionEvent
+ * @methodOf ui.grid.selection.service:uiGridSelectionService
+ * @description Decides whether we need to raise a batch event, and
+ * raises it if we do.
+ * @param {Grid} grid grid object
+ * @param {array} changedRows an array of changed rows, only populated
+ * @param {Event} event object if raised from an event
+ * if we're doing batch events
+ */
+ decideRaiseSelectionBatchEvent: function( grid, changedRows, evt ){
+ if ( changedRows.length > 0 ){
+ grid.api.selection.raise.rowSelectionChangedBatch(changedRows, evt);
+ }
+ }
+ };
+
+ return service;
+
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.selection.directive:uiGridSelection
+ * @element div
+ * @restrict A
+ *
+ * @description Adds selection features to grid
+ *
+ * @example
+ <example module="app">
+ <file name="app.js">
+ var app = angular.module('app', ['ui.grid', 'ui.grid.selection']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.data = [
+ { name: 'Bob', title: 'CEO' },
+ { name: 'Frank', title: 'Lowly Developer' }
+ ];
+
+ $scope.columnDefs = [
+ {name: 'name', enableCellEdit: true},
+ {name: 'title', enableCellEdit: true}
+ ];
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <div ui-grid="{ data: data, columnDefs: columnDefs }" ui-grid-selection></div>
+ </div>
+ </file>
+ </example>
+ */
+ module.directive('uiGridSelection', ['uiGridSelectionConstants', 'uiGridSelectionService', '$templateCache', 'uiGridConstants',
+ function (uiGridSelectionConstants, uiGridSelectionService, $templateCache, uiGridConstants) {
+ return {
+ replace: true,
+ priority: 0,
+ require: '^uiGrid',
+ scope: false,
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ uiGridSelectionService.initializeGrid(uiGridCtrl.grid);
+ if (uiGridCtrl.grid.options.enableRowHeaderSelection) {
+ var selectionRowHeaderDef = {
+ name: uiGridSelectionConstants.selectionRowHeaderColName,
+ displayName: '',
+ width: uiGridCtrl.grid.options.selectionRowHeaderWidth,
+ minWidth: 10,
+ cellTemplate: 'ui-grid/selectionRowHeader',
+ headerCellTemplate: 'ui-grid/selectionHeaderCell',
+ enableColumnResizing: false,
+ enableColumnMenu: false,
+ exporterSuppressExport: true,
+ allowCellFocus: true
+ };
+
+ uiGridCtrl.grid.addRowHeaderColumn(selectionRowHeaderDef);
+ }
+
+ var processorSet = false;
+
+ var processSelectableRows = function( rows ){
+ rows.forEach(function(row){
+ row.enableSelection = uiGridCtrl.grid.options.isRowSelectable(row);
+ });
+ return rows;
+ };
+
+ var updateOptions = function(){
+ if (uiGridCtrl.grid.options.isRowSelectable !== angular.noop && processorSet !== true) {
+ uiGridCtrl.grid.registerRowsProcessor(processSelectableRows, 500);
+ processorSet = true;
+ }
+ };
+
+ updateOptions();
+
+ var dataChangeDereg = uiGridCtrl.grid.registerDataChangeCallback( updateOptions, [uiGridConstants.dataChange.OPTIONS] );
+
+ $scope.$on( '$destroy', dataChangeDereg);
+ },
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+
+ }
+ };
+ }
+ };
+ }]);
+
+ module.directive('uiGridSelectionRowHeaderButtons', ['$templateCache', 'uiGridSelectionService', 'gridUtil',
+ function ($templateCache, uiGridSelectionService, gridUtil) {
+ return {
+ replace: true,
+ restrict: 'E',
+ template: $templateCache.get('ui-grid/selectionRowHeaderButtons'),
+ scope: true,
+ require: '^uiGrid',
+ link: function($scope, $elm, $attrs, uiGridCtrl) {
+ var self = uiGridCtrl.grid;
+ $scope.selectButtonClick = selectButtonClick;
+
+ // On IE, prevent mousedowns on the select button from starting a selection.
+ // If this is not done and you shift+click on another row, the browser will select a big chunk of text
+ if (gridUtil.detectBrowser() === 'ie') {
+ $elm.on('mousedown', selectButtonMouseDown);
+ }
+
+
+ function selectButtonClick(row, evt) {
+ evt.stopPropagation();
+
+ if (evt.shiftKey) {
+ uiGridSelectionService.shiftSelect(self, row, evt, self.options.multiSelect);
+ }
+ else if (evt.ctrlKey || evt.metaKey) {
+ uiGridSelectionService.toggleRowSelection(self, row, evt, self.options.multiSelect, self.options.noUnselect);
+ }
+ else {
+ uiGridSelectionService.toggleRowSelection(self, row, evt, (self.options.multiSelect && !self.options.modifierKeysToMultiSelect), self.options.noUnselect);
+ }
+ }
+
+ function selectButtonMouseDown(evt) {
+ if (evt.ctrlKey || evt.shiftKey) {
+ evt.target.onselectstart = function () { return false; };
+ window.setTimeout(function () { evt.target.onselectstart = null; }, 0);
+ }
+ }
+ }
+ };
+ }]);
+
+ module.directive('uiGridSelectionSelectAllButtons', ['$templateCache', 'uiGridSelectionService',
+ function ($templateCache, uiGridSelectionService) {
+ return {
+ replace: true,
+ restrict: 'E',
+ template: $templateCache.get('ui-grid/selectionSelectAllButtons'),
+ scope: false,
+ link: function($scope, $elm, $attrs, uiGridCtrl) {
+ var self = $scope.col.grid;
+
+ $scope.headerButtonClick = function(row, evt) {
+ if ( self.selection.selectAll ){
+ uiGridSelectionService.clearSelectedRows(self, evt);
+ if ( self.options.noUnselect ){
+ self.api.selection.selectRowByVisibleIndex(0, evt);
+ }
+ self.selection.selectAll = false;
+ } else {
+ if ( self.options.multiSelect ){
+ self.api.selection.selectAllVisibleRows(evt);
+ self.selection.selectAll = true;
+ }
+ }
+ };
+ }
+ };
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.selection.directive:uiGridViewport
+ * @element div
+ *
+ * @description Stacks on top of ui.grid.uiGridViewport to alter the attributes used
+ * for the grid row
+ */
+ module.directive('uiGridViewport',
+ ['$compile', 'uiGridConstants', 'uiGridSelectionConstants', 'gridUtil', '$parse', 'uiGridSelectionService',
+ function ($compile, uiGridConstants, uiGridSelectionConstants, gridUtil, $parse, uiGridSelectionService) {
+ return {
+ priority: -200, // run after default directive
+ scope: false,
+ compile: function ($elm, $attrs) {
+ var rowRepeatDiv = angular.element($elm.children().children()[0]);
+
+ var existingNgClass = rowRepeatDiv.attr("ng-class");
+ var newNgClass = '';
+ if ( existingNgClass ) {
+ newNgClass = existingNgClass.slice(0, -1) + ",'ui-grid-row-selected': row.isSelected}";
+ } else {
+ newNgClass = "{'ui-grid-row-selected': row.isSelected}";
+ }
+ rowRepeatDiv.attr("ng-class", newNgClass);
+
+ return {
+ pre: function ($scope, $elm, $attrs, controllers) {
+
+ },
+ post: function ($scope, $elm, $attrs, controllers) {
+ }
+ };
+ }
+ };
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.selection.directive:uiGridCell
+ * @element div
+ * @restrict A
+ *
+ * @description Stacks on top of ui.grid.uiGridCell to provide selection feature
+ */
+ module.directive('uiGridCell',
+ ['$compile', 'uiGridConstants', 'uiGridSelectionConstants', 'gridUtil', '$parse', 'uiGridSelectionService', '$timeout',
+ function ($compile, uiGridConstants, uiGridSelectionConstants, gridUtil, $parse, uiGridSelectionService, $timeout) {
+ return {
+ priority: -200, // run after default uiGridCell directive
+ restrict: 'A',
+ require: '?^uiGrid',
+ scope: false,
+ link: function ($scope, $elm, $attrs, uiGridCtrl) {
+
+ var touchStartTime = 0;
+ var touchTimeout = 300;
+
+ // Bind to keydown events in the render container
+ if (uiGridCtrl.grid.api.cellNav) {
+
+ uiGridCtrl.grid.api.cellNav.on.viewPortKeyDown($scope, function (evt, rowCol) {
+ if (rowCol === null ||
+ rowCol.row !== $scope.row ||
+ rowCol.col !== $scope.col) {
+ return;
+ }
+
+ if (evt.keyCode === 32 && $scope.col.colDef.name === "selectionRowHeaderCol") {
+ uiGridSelectionService.toggleRowSelection($scope.grid, $scope.row, evt, ($scope.grid.options.multiSelect && !$scope.grid.options.modifierKeysToMultiSelect), $scope.grid.options.noUnselect);
+ $scope.$apply();
+ }
+
+ // uiGridCellNavService.scrollToIfNecessary(uiGridCtrl.grid, rowCol.row, rowCol.col);
+ });
+ }
+
+ //$elm.bind('keydown', function (evt) {
+ // if (evt.keyCode === 32 && $scope.col.colDef.name === "selectionRowHeaderCol") {
+ // uiGridSelectionService.toggleRowSelection($scope.grid, $scope.row, evt, ($scope.grid.options.multiSelect && !$scope.grid.options.modifierKeysToMultiSelect), $scope.grid.options.noUnselect);
+ // $scope.$apply();
+ // }
+ //});
+
+ var selectCells = function(evt){
+ // if we get a click, then stop listening for touchend
+ $elm.off('touchend', touchEnd);
+
+ if (evt.shiftKey) {
+ uiGridSelectionService.shiftSelect($scope.grid, $scope.row, evt, $scope.grid.options.multiSelect);
+ }
+ else if (evt.ctrlKey || evt.metaKey) {
+ uiGridSelectionService.toggleRowSelection($scope.grid, $scope.row, evt, $scope.grid.options.multiSelect, $scope.grid.options.noUnselect);
+ }
+ else {
+ uiGridSelectionService.toggleRowSelection($scope.grid, $scope.row, evt, ($scope.grid.options.multiSelect && !$scope.grid.options.modifierKeysToMultiSelect), $scope.grid.options.noUnselect);
+ }
+ $scope.$apply();
+
+ // don't re-enable the touchend handler for a little while - some devices generate both, and it will
+ // take a little while to move your hand from the mouse to the screen if you have both modes of input
+ $timeout(function() {
+ $elm.on('touchend', touchEnd);
+ }, touchTimeout);
+ };
+
+ var touchStart = function(evt){
+ touchStartTime = (new Date()).getTime();
+
+ // if we get a touch event, then stop listening for click
+ $elm.off('click', selectCells);
+ };
+
+ var touchEnd = function(evt) {
+ var touchEndTime = (new Date()).getTime();
+ var touchTime = touchEndTime - touchStartTime;
+
+ if (touchTime < touchTimeout ) {
+ // short touch
+ selectCells(evt);
+ }
+
+ // don't re-enable the click handler for a little while - some devices generate both, and it will
+ // take a little while to move your hand from the screen to the mouse if you have both modes of input
+ $timeout(function() {
+ $elm.on('click', selectCells);
+ }, touchTimeout);
+ };
+
+ function registerRowSelectionEvents() {
+ if ($scope.grid.options.enableRowSelection && $scope.grid.options.enableFullRowSelection) {
+ $elm.addClass('ui-grid-disable-selection');
+ $elm.on('touchstart', touchStart);
+ $elm.on('touchend', touchEnd);
+ $elm.on('click', selectCells);
+
+ $scope.registered = true;
+ }
+ }
+
+ function deregisterRowSelectionEvents() {
+ if ($scope.registered){
+ $elm.removeClass('ui-grid-disable-selection');
+
+ $elm.off('touchstart', touchStart);
+ $elm.off('touchend', touchEnd);
+ $elm.off('click', selectCells);
+
+ $scope.registered = false;
+ }
+ }
+
+ registerRowSelectionEvents();
+ // register a dataChange callback so that we can change the selection configuration dynamically
+ // if the user changes the options
+ var dataChangeDereg = $scope.grid.registerDataChangeCallback( function() {
+ if ( $scope.grid.options.enableRowSelection && $scope.grid.options.enableFullRowSelection &&
+ !$scope.registered ){
+ registerRowSelectionEvents();
+ } else if ( ( !$scope.grid.options.enableRowSelection || !$scope.grid.options.enableFullRowSelection ) &&
+ $scope.registered ){
+ deregisterRowSelectionEvents();
+ }
+ }, [uiGridConstants.dataChange.OPTIONS] );
+
+ $elm.on( '$destroy', dataChangeDereg);
+ }
+ };
+ }]);
+
+ module.directive('uiGridGridFooter', ['$compile', 'uiGridConstants', 'gridUtil', function ($compile, uiGridConstants, gridUtil) {
+ return {
+ restrict: 'EA',
+ replace: true,
+ priority: -1000,
+ require: '^uiGrid',
+ scope: true,
+ compile: function ($elm, $attrs) {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+
+ if (!uiGridCtrl.grid.options.showGridFooter) {
+ return;
+ }
+
+
+ gridUtil.getTemplate('ui-grid/gridFooterSelectedItems')
+ .then(function (contents) {
+ var template = angular.element(contents);
+
+ var newElm = $compile(template)($scope);
+
+ angular.element($elm[0].getElementsByClassName('ui-grid-grid-footer')[0]).append(newElm);
+ });
+ },
+
+ post: function ($scope, $elm, $attrs, controllers) {
+
+ }
+ };
+ }
+ };
+ }]);
+
+})();
+
+(function () {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.treeBase
+ * @description
+ *
+ * # ui.grid.treeBase
+ *
+ * <div class="alert alert-warning" role="alert"><strong>Beta</strong> This feature is ready for testing, but it either hasn't seen a lot of use or has some known bugs.</div>
+ *
+ * This module provides base tree handling functions that are shared by other features, notably grouping
+ * and treeView. It provides a tree view of the data, with nodes in that
+ * tree and leaves.
+ *
+ * Design information:
+ * -------------------
+ *
+ * The raw data that is provided must come with a $$treeLevel on any non-leaf node. Grouping will create
+ * these on all the group header rows, treeView will expect these to be set in the raw data by the user.
+ * TreeBase will run a rowsProcessor that:
+ * - builds `treeBase.tree` out of the provided rows
+ * - permits a recursive sort of the tree
+ * - maintains the expand/collapse state of each node
+ * - provides the expand/collapse all button and the expand/collapse buttons
+ * - maintains the count of children for each node
+ *
+ * Each row is updated with a link to the tree node that represents it. Refer {@link ui.grid.treeBase.grid:treeBase.tree tree documentation}
+ * for information.
+ *
+ * TreeBase adds information to the rows
+ * - treeLevel: if present and > -1 tells us the level (level 0 is the top level)
+ * - treeNode: pointer to the node in the grid.treeBase.tree that refers
+ * to this row, allowing us to manipulate the state
+ *
+ * Since the logic is baked into the rowsProcessors, it should get triggered whenever
+ * row order or filtering or anything like that is changed. We recall the expanded state
+ * across invocations of the rowsProcessors by the reference to the treeNode on the individual
+ * rows. We rebuild the tree itself quite frequently, when we do this we use the saved treeNodes to
+ * get the state, but we overwrite the other data in that treeNode.
+ *
+ * By default rows are collapsed, which means all data rows have their visible property
+ * set to false, and only level 0 group rows are set to visible.
+ *
+ * We rely on the rowsProcessors to do the actual expanding and collapsing, so we set the flags we want into
+ * grid.treeBase.tree, then call refresh. This is because we can't easily change the visible
+ * row cache without calling the processors, and once we've built the logic into the rowProcessors we may as
+ * well use it all the time.
+ *
+ * Tree base provides sorting (on non-grouped columns).
+ *
+ * Sorting works in two passes. The standard sorting is performed for any columns that are important to building
+ * the tree (for example, any grouped columns). Then after the tree is built, a recursive tree sort is performed
+ * for the remaining sort columns (including the original sort) - these columns are sorted within each tree level
+ * (so all the level 1 nodes are sorted, then all the level 2 nodes within each level 1 node etc).
+ *
+ * To achieve this we make use of the `ignoreSort` property on the sort configuration. The parent feature (treeView or grouping)
+ * must provide a rowsProcessor that runs with very low priority (typically in the 60-65 range), and that sets
+ * the `ignoreSort`on any sort that it wants to run on the tree. TreeBase will clear the ignoreSort on all sorts - so it
+ * will turn on any sorts that haven't run. It will then call a recursive sort on the tree.
+ *
+ * Tree base provides treeAggregation. It checks the treeAggregation configuration on each column, and aggregates based on
+ * the logic provided as it builds the tree. Footer aggregation from the uiGrid core should not be used with treeBase aggregation,
+ * since it operates on all visible rows, as opposed to to leaf nodes only. Setting `showColumnFooter: true` will show the
+ * treeAggregations in the column footer. Aggregation information will be collected in the format:
+ *
+ * ```
+ * {
+ * type: 'count',
+ * value: 4,
+ * label: 'count: ',
+ * rendered: 'count: 4'
+ * }
+ * ```
+ *
+ * A callback is provided to format the value once it is finalised (aka a valueFilter).
+ *
+ * <br/>
+ * <br/>
+ *
+ * <div doc-module-components="ui.grid.treeBase"></div>
+ */
+
+ var module = angular.module('ui.grid.treeBase', ['ui.grid']);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.treeBase.constant:uiGridTreeBaseConstants
+ *
+ * @description constants available in treeBase module.
+ *
+ * These constants are manually copied into grouping and treeView,
+ * as I haven't found a way to simply include them, and it's not worth
+ * investing time in for something that changes very infrequently.
+ *
+ */
+ module.constant('uiGridTreeBaseConstants', {
+ featureName: "treeBase",
+ rowHeaderColName: 'treeBaseRowHeaderCol',
+ EXPANDED: 'expanded',
+ COLLAPSED: 'collapsed',
+ aggregation: {
+ COUNT: 'count',
+ SUM: 'sum',
+ MAX: 'max',
+ MIN: 'min',
+ AVG: 'avg'
+ }
+ });
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.treeBase.service:uiGridTreeBaseService
+ *
+ * @description Services for treeBase feature
+ */
+ /**
+ * @ngdoc object
+ * @name ui.grid.treeBase.api:ColumnDef
+ *
+ * @description ColumnDef for tree feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions.columnDef gridOptions.columnDefs}
+ */
+
+ module.service('uiGridTreeBaseService', ['$q', 'uiGridTreeBaseConstants', 'gridUtil', 'GridRow', 'gridClassFactory', 'i18nService', 'uiGridConstants', 'rowSorter',
+ function ($q, uiGridTreeBaseConstants, gridUtil, GridRow, gridClassFactory, i18nService, uiGridConstants, rowSorter) {
+
+ var service = {
+
+ initializeGrid: function (grid, $scope) {
+
+ //add feature namespace and any properties to grid for needed
+ /**
+ * @ngdoc object
+ * @name ui.grid.treeBase.grid:treeBase
+ *
+ * @description Grid properties and functions added for treeBase
+ */
+ grid.treeBase = {};
+
+ /**
+ * @ngdoc property
+ * @propertyOf ui.grid.treeBase.grid:treeBase
+ * @name numberLevels
+ *
+ * @description Total number of tree levels currently used, calculated by the rowsProcessor by
+ * retaining the highest tree level it sees
+ */
+ grid.treeBase.numberLevels = 0;
+
+ /**
+ * @ngdoc property
+ * @propertyOf ui.grid.treeBase.grid:treeBase
+ * @name expandAll
+ *
+ * @description Whether or not the expandAll box is selected
+ */
+ grid.treeBase.expandAll = false;
+
+ /**
+ * @ngdoc property
+ * @propertyOf ui.grid.treeBase.grid:treeBase
+ * @name tree
+ *
+ * @description Tree represented as a nested array that holds the state of each node, along with a
+ * pointer to the row. The array order is material - we will display the children in the order
+ * they are stored in the array
+ *
+ * Each node stores:
+ *
+ * - the state of this node
+ * - an array of children of this node
+ * - a pointer to the parent of this node (reverse pointer, allowing us to walk up the tree)
+ * - the number of children of this node
+ * - aggregation information calculated from the nodes
+ *
+ * ```
+ * [{
+ * state: 'expanded',
+ * row: <reference to row>,
+ * parentRow: null,
+ * aggregations: [{
+ * type: 'count',
+ * col: <gridCol>,
+ * value: 2,
+ * label: 'count: ',
+ * rendered: 'count: 2'
+ * }],
+ * children: [
+ * {
+ * state: 'expanded',
+ * row: <reference to row>,
+ * parentRow: <reference to row>,
+ * aggregations: [{
+ * type: 'count',
+ * col: '<gridCol>,
+ * value: 4,
+ * label: 'count: ',
+ * rendered: 'count: 4'
+ * }],
+ * children: [
+ * { state: 'expanded', row: <reference to row>, parentRow: <reference to row> },
+ * { state: 'collapsed', row: <reference to row>, parentRow: <reference to row> },
+ * { state: 'expanded', row: <reference to row>, parentRow: <reference to row> },
+ * { state: 'collapsed', row: <reference to row>, parentRow: <reference to row> }
+ * ]
+ * },
+ * {
+ * state: 'collapsed',
+ * row: <reference to row>,
+ * parentRow: <reference to row>,
+ * aggregations: [{
+ * type: 'count',
+ * col: <gridCol>,
+ * value: 3,
+ * label: 'count: ',
+ * rendered: 'count: 3'
+ * }],
+ * children: [
+ * { state: 'expanded', row: <reference to row>, parentRow: <reference to row> },
+ * { state: 'collapsed', row: <reference to row>, parentRow: <reference to row> },
+ * { state: 'expanded', row: <reference to row>, parentRow: <reference to row> }
+ * ]
+ * }
+ * ]
+ * }, {<another level 0 node maybe>} ]
+ * ```
+ * Missing state values are false - meaning they aren't expanded.
+ *
+ * This is used because the rowProcessors run every time the grid is refreshed, so
+ * we'd lose the expanded state every time the grid was refreshed. This instead gives
+ * us a reliable lookup that persists across rowProcessors.
+ *
+ * This tree is rebuilt every time we run the rowsProcessors. Since each row holds a pointer
+ * to it's tree node we can persist expand/collapse state across calls to rowsProcessor, we discard
+ * all transient information on the tree (children, childCount) and recalculate it
+ *
+ */
+ grid.treeBase.tree = {};
+
+ service.defaultGridOptions(grid.options);
+
+ grid.registerRowsProcessor(service.treeRows, 410);
+
+ grid.registerColumnBuilder( service.treeBaseColumnBuilder );
+
+ service.createRowHeader( grid );
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.treeBase.api:PublicApi
+ *
+ * @description Public Api for treeBase feature
+ */
+ var publicApi = {
+ events: {
+ treeBase: {
+ /**
+ * @ngdoc event
+ * @eventOf ui.grid.treeBase.api:PublicApi
+ * @name rowExpanded
+ * @description raised whenever a row is expanded. If you are dynamically
+ * rendering your tree you can listen to this event, and then retrieve
+ * the children of this row and load them into the grid data.
+ *
+ * When the data is loaded the grid will automatically refresh to show these new rows
+ *
+ * <pre>
+ * gridApi.treeBase.on.rowExpanded(scope,function(row){})
+ * </pre>
+ * @param {gridRow} row the row that was expanded. You can also
+ * retrieve the grid from this row with row.grid
+ */
+ rowExpanded: {},
+
+ /**
+ * @ngdoc event
+ * @eventOf ui.grid.treeBase.api:PublicApi
+ * @name rowCollapsed
+ * @description raised whenever a row is collapsed. Doesn't really have
+ * a purpose at the moment, included for symmetry
+ *
+ * <pre>
+ * gridApi.treeBase.on.rowCollapsed(scope,function(row){})
+ * </pre>
+ * @param {gridRow} row the row that was collapsed. You can also
+ * retrieve the grid from this row with row.grid
+ */
+ rowCollapsed: {}
+ }
+ },
+
+ methods: {
+ treeBase: {
+ /**
+ * @ngdoc function
+ * @name expandAllRows
+ * @methodOf ui.grid.treeBase.api:PublicApi
+ * @description Expands all tree rows
+ */
+ expandAllRows: function () {
+ service.expandAllRows(grid);
+ },
+
+ /**
+ * @ngdoc function
+ * @name collapseAllRows
+ * @methodOf ui.grid.treeBase.api:PublicApi
+ * @description collapse all tree rows
+ */
+ collapseAllRows: function () {
+ service.collapseAllRows(grid);
+ },
+
+ /**
+ * @ngdoc function
+ * @name toggleRowTreeState
+ * @methodOf ui.grid.treeBase.api:PublicApi
+ * @description call expand if the row is collapsed, collapse if it is expanded
+ * @param {gridRow} row the row you wish to toggle
+ */
+ toggleRowTreeState: function (row) {
+ service.toggleRowTreeState(grid, row);
+ },
+
+ /**
+ * @ngdoc function
+ * @name expandRow
+ * @methodOf ui.grid.treeBase.api:PublicApi
+ * @description expand the immediate children of the specified row
+ * @param {gridRow} row the row you wish to expand
+ */
+ expandRow: function (row) {
+ service.expandRow(grid, row);
+ },
+
+ /**
+ * @ngdoc function
+ * @name expandRowChildren
+ * @methodOf ui.grid.treeBase.api:PublicApi
+ * @description expand all children of the specified row
+ * @param {gridRow} row the row you wish to expand
+ */
+ expandRowChildren: function (row) {
+ service.expandRowChildren(grid, row);
+ },
+
+ /**
+ * @ngdoc function
+ * @name collapseRow
+ * @methodOf ui.grid.treeBase.api:PublicApi
+ * @description collapse the specified row. When
+ * you expand the row again, all grandchildren will retain their state
+ * @param {gridRow} row the row you wish to collapse
+ */
+ collapseRow: function ( row ) {
+ service.collapseRow(grid, row);
+ },
+
+ /**
+ * @ngdoc function
+ * @name collapseRowChildren
+ * @methodOf ui.grid.treeBase.api:PublicApi
+ * @description collapse all children of the specified row. When
+ * you expand the row again, all grandchildren will be collapsed
+ * @param {gridRow} row the row you wish to collapse children for
+ */
+ collapseRowChildren: function ( row ) {
+ service.collapseRowChildren(grid, row);
+ },
+
+ /**
+ * @ngdoc function
+ * @name getTreeState
+ * @methodOf ui.grid.treeBase.api:PublicApi
+ * @description Get the tree state for this grid,
+ * used by the saveState feature
+ * Returned treeState as an object
+ * `{ expandedState: { uid: 'expanded', uid: 'collapsed' } }`
+ * where expandedState is a hash of row uid and the current expanded state
+ *
+ * @returns {object} tree state
+ *
+ * TODO - this needs work - we need an identifier that persists across instantiations,
+ * not uid. This really means we need a row identity defined, but that won't work for
+ * grouping. Perhaps this needs to be moved up to treeView and grouping, rather than
+ * being in base.
+ */
+ getTreeExpandedState: function () {
+ return { expandedState: service.getTreeState(grid) };
+ },
+
+ /**
+ * @ngdoc function
+ * @name setTreeState
+ * @methodOf ui.grid.treeBase.api:PublicApi
+ * @description Set the expanded states of the tree
+ * @param {object} config the config you want to apply, in the format
+ * provided by getTreeState
+ */
+ setTreeState: function ( config ) {
+ service.setTreeState( grid, config );
+ },
+
+ /**
+ * @ngdoc function
+ * @name getRowChildren
+ * @methodOf ui.grid.treeBase.api:PublicApi
+ * @description Get the children of the specified row
+ * @param {GridRow} row the row you want the children of
+ * @returns {Array} array of children of this row, the children
+ * are all gridRows
+ */
+ getRowChildren: function ( row ){
+ return row.treeNode.children.map( function( childNode ){
+ return childNode.row;
+ });
+ }
+ }
+ }
+ };
+
+ grid.api.registerEventsFromObject(publicApi.events);
+
+ grid.api.registerMethodsFromObject(publicApi.methods);
+ },
+
+
+ defaultGridOptions: function (gridOptions) {
+ //default option to true unless it was explicitly set to false
+ /**
+ * @ngdoc object
+ * @name ui.grid.treeBase.api:GridOptions
+ *
+ * @description GridOptions for treeBase feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ */
+
+ /**
+ * @ngdoc object
+ * @name treeRowHeaderBaseWidth
+ * @propertyOf ui.grid.treeBase.api:GridOptions
+ * @description Base width of the tree header, provides for a single level of tree. This
+ * is incremented by `treeIndent` for each extra level
+ * <br/>Defaults to 30
+ */
+ gridOptions.treeRowHeaderBaseWidth = gridOptions.treeRowHeaderBaseWidth || 30;
+
+ /**
+ * @ngdoc object
+ * @name treeIndent
+ * @propertyOf ui.grid.treeBase.api:GridOptions
+ * @description Number of pixels of indent for the icon at each tree level, wider indents are visually more pleasing,
+ * but will make the tree row header wider
+ * <br/>Defaults to 10
+ */
+ gridOptions.treeIndent = gridOptions.treeIndent || 10;
+
+ /**
+ * @ngdoc object
+ * @name showTreeRowHeader
+ * @propertyOf ui.grid.treeBase.api:GridOptions
+ * @description If set to false, don't create the row header. Youll need to programatically control the expand
+ * states
+ * <br/>Defaults to true
+ */
+ gridOptions.showTreeRowHeader = gridOptions.showTreeRowHeader !== false;
+
+ /**
+ * @ngdoc object
+ * @name showTreeExpandNoChildren
+ * @propertyOf ui.grid.treeBase.api:GridOptions
+ * @description If set to true, show the expand/collapse button even if there are no
+ * children of a node. You'd use this if you're planning to dynamically load the children
+ *
+ * <br/>Defaults to true, grouping overrides to false
+ */
+ gridOptions.showTreeExpandNoChildren = gridOptions.showTreeExpandNoChildren !== false;
+
+ /**
+ * @ngdoc object
+ * @name treeRowHeaderAlwaysVisible
+ * @propertyOf ui.grid.treeBase.api:GridOptions
+ * @description If set to true, row header even if there are no tree nodes
+ *
+ * <br/>Defaults to true
+ */
+ gridOptions.treeRowHeaderAlwaysVisible = gridOptions.treeRowHeaderAlwaysVisible !== false;
+
+ /**
+ * @ngdoc object
+ * @name treeCustomAggregations
+ * @propertyOf ui.grid.treeBase.api:GridOptions
+ * @description Define custom aggregation functions. The properties of this object will be
+ * aggregation types available for use on columnDef with {@link ui.grid.treeBase.api:ColumnDef treeAggregationType} or through the column menu.
+ * If a function defined here uses the same name as one of the native aggregations, this one will take precedence.
+ * The object format is:
+ *
+ * <pre>
+ * {
+ * aggregationName: {
+ * label: (optional) string,
+ * aggregationFn: function( aggregation, fieldValue, numValue, row ){...},
+ * finalizerFn: (optional) function( aggregation ){...}
+ * },
+ * mean: {
+ * label: 'mean',
+ * aggregationFn: function( aggregation, fieldValue, numValue ){
+ * aggregation.count = (aggregation.count || 1) + 1;
+ * aggregation.sum = (aggregation.sum || 0) + numValue;
+ * },
+ * finalizerFn: function( aggregation ){
+ * aggregation.value = aggregation.sum / aggregation.count
+ * }
+ * }
+ * }
+ * </pre>
+ *
+ * <br/>The `finalizerFn` may be used to manipulate the value before rendering, or to
+ * apply a custom rendered value. If `aggregation.rendered` is left undefined, the value will be
+ * rendered. Note that the native aggregation functions use an `finalizerFn` to concatenate
+ * the label and the value.
+ *
+ * <br/>Defaults to {}
+ */
+ gridOptions.treeCustomAggregations = gridOptions.treeCustomAggregations || {};
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name treeBaseColumnBuilder
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Sets the tree defaults based on the columnDefs
+ *
+ * @param {object} colDef columnDef we're basing on
+ * @param {GridCol} col the column we're to update
+ * @param {object} gridOptions the options we should use
+ * @returns {promise} promise for the builder - actually we do it all inline so it's immediately resolved
+ */
+ treeBaseColumnBuilder: function (colDef, col, gridOptions) {
+
+
+ /**
+ * @ngdoc object
+ * @name customTreeAggregationFn
+ * @propertyOf ui.grid.treeBase.api:ColumnDef
+ * @description A custom function that aggregates rows into some form of
+ * total. Aggregations run row-by-row, the function needs to be capable of
+ * creating a running total.
+ *
+ * The function will be provided the aggregation item (in which you can store running
+ * totals), the row value that is to be aggregated, and that same row value converted to
+ * a number (most aggregations work on numbers)
+ * @example
+ * <pre>
+ * customTreeAggregationFn = function ( aggregation, fieldValue, numValue, row ){
+ * // calculates the average of the squares of the values
+ * if ( typeof(aggregation.count) === 'undefined' ){
+ * aggregation.count = 0;
+ * }
+ * aggregation.count++;
+ *
+ * if ( !isNaN(numValue) ){
+ * if ( typeof(aggregation.total) === 'undefined' ){
+ * aggregation.total = 0;
+ * }
+ * aggregation.total = aggregation.total + numValue * numValue;
+ * }
+ *
+ * aggregation.value = aggregation.total / aggregation.count;
+ * }
+ * </pre>
+ * <br/>Defaults to undefined. May be overwritten by treeAggregationType, the two options should not be used together.
+ */
+ if ( typeof(colDef.customTreeAggregationFn) !== 'undefined' ){
+ col.treeAggregationFn = colDef.customTreeAggregationFn;
+ }
+
+ /**
+ * @ngdoc object
+ * @name treeAggregationType
+ * @propertyOf ui.grid.treeBase.api:ColumnDef
+ * @description Use one of the native or grid-level aggregation methods for calculating aggregations on this column.
+ * Native method are in the constants file and include: SUM, COUNT, MIN, MAX, AVG. This may also be the property the
+ * name of an aggregation function defined with {@link ui.grid.treeBase.api:GridOptions treeCustomAggregations}.
+ *
+ * <pre>
+ * treeAggregationType = uiGridTreeBaseConstants.aggregation.SUM,
+ * }
+ * </pre>
+ *
+ * If you are using aggregations you should either:
+ *
+ * - also use grouping, in which case the aggregations are displayed in the group header, OR
+ * - use treeView, in which case you can set `treeAggregationUpdateEntity: true` in the colDef, and
+ * treeBase will store the aggregation information in the entity, or you can set `treeAggregationUpdateEntity: false`
+ * in the colDef, and you need to manual retrieve the calculated aggregations from the row.treeNode.aggregations
+ *
+ * <br/>Takes precendence over a treeAggregationFn, the two options should not be used together.
+ * <br/>Defaults to undefined.
+ */
+ if ( typeof(colDef.treeAggregationType) !== 'undefined' ){
+ col.treeAggregation = { type: colDef.treeAggregationType };
+ if ( typeof(gridOptions.treeCustomAggregations[colDef.treeAggregationType]) !== 'undefined' ){
+ col.treeAggregationFn = gridOptions.treeCustomAggregations[colDef.treeAggregationType].aggregationFn;
+ col.treeAggregationFinalizerFn = gridOptions.treeCustomAggregations[colDef.treeAggregationType].finalizerFn;
+ col.treeAggregation.label = gridOptions.treeCustomAggregations[colDef.treeAggregationType].label;
+ } else if ( typeof(service.nativeAggregations()[colDef.treeAggregationType]) !== 'undefined' ){
+ col.treeAggregationFn = service.nativeAggregations()[colDef.treeAggregationType].aggregationFn;
+ col.treeAggregation.label = service.nativeAggregations()[colDef.treeAggregationType].label;
+ }
+ }
+
+ /**
+ * @ngdoc object
+ * @name treeAggregationLabel
+ * @propertyOf ui.grid.treeBase.api:ColumnDef
+ * @description A custom label to use for this aggregation. If provided we don't use native i18n.
+ */
+ if ( typeof(colDef.treeAggregationLabel) !== 'undefined' ){
+ if (typeof(col.treeAggregation) === 'undefined' ){
+ col.treeAggregation = {};
+ }
+ col.treeAggregation.label = colDef.treeAggregationLabel;
+ }
+
+ /**
+ * @ngdoc object
+ * @name treeAggregationUpdateEntity
+ * @propertyOf ui.grid.treeBase.api:ColumnDef
+ * @description Store calculated aggregations into the entity, allowing them
+ * to be displayed in the grid using a standard cellTemplate. This defaults to true,
+ * if you are using grouping then you shouldn't set it to false, as then the aggregations won't
+ * display.
+ *
+ * If you are using treeView in most cases you'll want to set this to true. This will result in
+ * getCellValue returning the aggregation rather than whatever was stored in the cell attribute on
+ * the entity. If you want to render the underlying entity value (and do something else with the aggregation)
+ * then you could use a custom cellTemplate to display `row.entity.myAttribute`, rather than using getCellValue.
+ *
+ * <br/>Defaults to true
+ *
+ * @example
+ * <pre>
+ * gridOptions.columns = [{
+ * name: 'myCol',
+ * treeAggregation: { type: uiGridTreeBaseConstants.aggregation.SUM },
+ * treeAggregationUpdateEntity: true
+ * cellTemplate: '<div>{{row.entity.myCol + " " + row.treeNode.aggregations[0].rendered}}</div>'
+ * }];
+ * </pre>
+ */
+ col.treeAggregationUpdateEntity = colDef.treeAggregationUpdateEntity !== false;
+
+ /**
+ * @ngdoc object
+ * @name customTreeAggregationFinalizerFn
+ * @propertyOf ui.grid.treeBase.api:ColumnDef
+ * @description A custom function that populates aggregation.rendered, this is called when
+ * a particular aggregation has been fully calculated, and we want to render the value.
+ *
+ * With the native aggregation options we just concatenate `aggregation.label` and
+ * `aggregation.value`, but if you wanted to apply a filter or otherwise manipulate the label
+ * or the value, you can do so with this function. This function will be called after the
+ * the default `finalizerFn`.
+ *
+ * @example
+ * <pre>
+ * customTreeAggregationFinalizerFn = function ( aggregation ){
+ * aggregation.rendered = aggregation.label + aggregation.value / 100 + '%';
+ * }
+ * </pre>
+ * <br/>Defaults to undefined.
+ */
+ if ( typeof(col.customTreeAggregationFinalizerFn) === 'undefined' ){
+ col.customTreeAggregationFinalizerFn = colDef.customTreeAggregationFinalizerFn;
+ }
+
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name createRowHeader
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Create the rowHeader. If treeRowHeaderAlwaysVisible then
+ * set it to visible, otherwise set it to invisible
+ *
+ * @param {Grid} grid grid object
+ */
+ createRowHeader: function( grid ){
+ var rowHeaderColumnDef = {
+ name: uiGridTreeBaseConstants.rowHeaderColName,
+ displayName: '',
+ width: grid.options.treeRowHeaderBaseWidth,
+ minWidth: 10,
+ cellTemplate: 'ui-grid/treeBaseRowHeader',
+ headerCellTemplate: 'ui-grid/treeBaseHeaderCell',
+ enableColumnResizing: false,
+ enableColumnMenu: false,
+ exporterSuppressExport: true,
+ allowCellFocus: true
+ };
+
+ rowHeaderColumnDef.visible = grid.options.treeRowHeaderAlwaysVisible;
+ grid.addRowHeaderColumn( rowHeaderColumnDef );
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name expandAllRows
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Expands all nodes in the tree
+ *
+ * @param {Grid} grid grid object
+ */
+ expandAllRows: function (grid) {
+ grid.treeBase.tree.forEach( function( node ) {
+ service.setAllNodes( grid, node, uiGridTreeBaseConstants.EXPANDED);
+ });
+ grid.treeBase.expandAll = true;
+ grid.queueGridRefresh();
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name collapseAllRows
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Collapses all nodes in the tree
+ *
+ * @param {Grid} grid grid object
+ */
+ collapseAllRows: function (grid) {
+ grid.treeBase.tree.forEach( function( node ) {
+ service.setAllNodes( grid, node, uiGridTreeBaseConstants.COLLAPSED);
+ });
+ grid.treeBase.expandAll = false;
+ grid.queueGridRefresh();
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name setAllNodes
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Works through a subset of grid.treeBase.rowExpandedStates, setting
+ * all child nodes (and their descendents) of the provided node to the given state.
+ *
+ * Calls itself recursively on all nodes so as to achieve this.
+ *
+ * @param {Grid} grid the grid we're operating on (so we can raise events)
+ * @param {object} treeNode a node in the tree that we want to update
+ * @param {string} targetState the state we want to set it to
+ */
+ setAllNodes: function (grid, treeNode, targetState) {
+ if ( typeof(treeNode.state) !== 'undefined' && treeNode.state !== targetState ){
+ treeNode.state = targetState;
+
+ if ( targetState === uiGridTreeBaseConstants.EXPANDED ){
+ grid.api.treeBase.raise.rowExpanded(treeNode.row);
+ } else {
+ grid.api.treeBase.raise.rowCollapsed(treeNode.row);
+ }
+ }
+
+ // set all child nodes
+ if ( treeNode.children ){
+ treeNode.children.forEach(function( childNode ){
+ service.setAllNodes(grid, childNode, targetState);
+ });
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name toggleRowTreeState
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Toggles the expand or collapse state of this grouped row, if
+ * it's a parent row
+ *
+ * @param {Grid} grid grid object
+ * @param {GridRow} row the row we want to toggle
+ */
+ toggleRowTreeState: function ( grid, row ){
+ if ( typeof(row.treeLevel) === 'undefined' || row.treeLevel === null || row.treeLevel < 0 ){
+ return;
+ }
+
+ if (row.treeNode.state === uiGridTreeBaseConstants.EXPANDED){
+ service.collapseRow(grid, row);
+ } else {
+ service.expandRow(grid, row);
+ }
+
+ grid.queueGridRefresh();
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name expandRow
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Expands this specific row, showing only immediate children.
+ *
+ * @param {Grid} grid grid object
+ * @param {GridRow} row the row we want to expand
+ */
+ expandRow: function ( grid, row ){
+ if ( typeof(row.treeLevel) === 'undefined' || row.treeLevel === null || row.treeLevel < 0 ){
+ return;
+ }
+
+ if ( row.treeNode.state !== uiGridTreeBaseConstants.EXPANDED ){
+ row.treeNode.state = uiGridTreeBaseConstants.EXPANDED;
+ grid.api.treeBase.raise.rowExpanded(row);
+ grid.treeBase.expandAll = service.allExpanded(grid.treeBase.tree);
+ grid.queueGridRefresh();
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name expandRowChildren
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Expands this specific row, showing all children.
+ *
+ * @param {Grid} grid grid object
+ * @param {GridRow} row the row we want to expand
+ */
+ expandRowChildren: function ( grid, row ){
+ if ( typeof(row.treeLevel) === 'undefined' || row.treeLevel === null || row.treeLevel < 0 ){
+ return;
+ }
+
+ service.setAllNodes(grid, row.treeNode, uiGridTreeBaseConstants.EXPANDED);
+ grid.treeBase.expandAll = service.allExpanded(grid.treeBase.tree);
+ grid.queueGridRefresh();
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name collapseRow
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Collapses this specific row
+ *
+ * @param {Grid} grid grid object
+ * @param {GridRow} row the row we want to collapse
+ */
+ collapseRow: function( grid, row ){
+ if ( typeof(row.treeLevel) === 'undefined' || row.treeLevel === null || row.treeLevel < 0 ){
+ return;
+ }
+
+ if ( row.treeNode.state !== uiGridTreeBaseConstants.COLLAPSED ){
+ row.treeNode.state = uiGridTreeBaseConstants.COLLAPSED;
+ grid.treeBase.expandAll = false;
+ grid.api.treeBase.raise.rowCollapsed(row);
+ grid.queueGridRefresh();
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name collapseRowChildren
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Collapses this specific row and all children
+ *
+ * @param {Grid} grid grid object
+ * @param {GridRow} row the row we want to collapse
+ */
+ collapseRowChildren: function( grid, row ){
+ if ( typeof(row.treeLevel) === 'undefined' || row.treeLevel === null || row.treeLevel < 0 ){
+ return;
+ }
+
+ service.setAllNodes(grid, row.treeNode, uiGridTreeBaseConstants.COLLAPSED);
+ grid.treeBase.expandAll = false;
+ grid.queueGridRefresh();
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name allExpanded
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Returns true if all rows are expanded, false
+ * if they're not. Walks the tree to determine this. Used
+ * to set the expandAll state.
+ *
+ * If the node has no children, then return true (it's immaterial
+ * whether it is expanded). If the node has children, then return
+ * false if this node is collapsed, or if any child node is not all expanded
+ *
+ * @param {object} tree the grid to check
+ * @returns {boolean} whether or not the tree is all expanded
+ */
+ allExpanded: function( tree ){
+ var allExpanded = true;
+ tree.forEach( function( node ){
+ if ( !service.allExpandedInternal( node ) ){
+ allExpanded = false;
+ }
+ });
+ return allExpanded;
+ },
+
+ allExpandedInternal: function( treeNode ){
+ if ( treeNode.children && treeNode.children.length > 0 ){
+ if ( treeNode.state === uiGridTreeBaseConstants.COLLAPSED ){
+ return false;
+ }
+ var allExpanded = true;
+ treeNode.children.forEach( function( node ){
+ if ( !service.allExpandedInternal( node ) ){
+ allExpanded = false;
+ }
+ });
+ return allExpanded;
+ } else {
+ return true;
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name treeRows
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description The rowProcessor that adds the nodes to the tree, and sets the visible
+ * state of each row based on it's parent state
+ *
+ * Assumes it is always called after the sorting processor, and the grouping processor if there is one.
+ * Performs any tree sorts itself after having built the tree
+ *
+ * Processes all the rows in order, setting the group level based on the $$treeLevel in the associated
+ * entity, and setting the visible state based on the parent's state.
+ *
+ * Calculates the deepest level of tree whilst it goes, and updates that so that the header column can be correctly
+ * sized.
+ *
+ * Aggregates if necessary along the way.
+ *
+ * @param {array} renderableRows the rows we want to process, usually the output from the previous rowProcessor
+ * @returns {array} the updated rows
+ */
+ treeRows: function( renderableRows ) {
+ if (renderableRows.length === 0){
+ return renderableRows;
+ }
+
+ var grid = this;
+ var currentLevel = 0;
+ var currentState = uiGridTreeBaseConstants.EXPANDED;
+ var parents = [];
+
+ grid.treeBase.tree = service.createTree( grid, renderableRows );
+ service.updateRowHeaderWidth( grid );
+
+ service.sortTree( grid );
+ service.fixFilter( grid );
+
+ return service.renderTree( grid.treeBase.tree );
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name createOrUpdateRowHeaderWidth
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Calculates the rowHeader width.
+ *
+ * If rowHeader is always present, updates the width.
+ *
+ * If rowHeader is only sometimes present (`treeRowHeaderAlwaysVisible: false`), determines whether there
+ * should be one, then creates or removes it as appropriate, with the created rowHeader having the
+ * right width.
+ *
+ * If there's never a rowHeader then never creates one: `showTreeRowHeader: false`
+ *
+ * @param {Grid} grid the grid we want to set the row header on
+ */
+ updateRowHeaderWidth: function( grid ){
+ var rowHeader = grid.getColumn(uiGridTreeBaseConstants.rowHeaderColName);
+
+ var newWidth = grid.options.treeRowHeaderBaseWidth + grid.options.treeIndent * Math.max(grid.treeBase.numberLevels - 1, 0);
+ if ( rowHeader && newWidth !== rowHeader.width ){
+ rowHeader.width = newWidth;
+ grid.queueRefresh();
+ }
+
+ var newVisibility = true;
+ if ( grid.options.showTreeRowHeader === false ){
+ newVisibility = false;
+ }
+ if ( grid.options.treeRowHeaderAlwaysVisible === false && grid.treeBase.numberLevels <= 0 ){
+ newVisibility = false;
+ }
+ if ( rowHeader.visible !== newVisibility ) {
+ rowHeader.visible = newVisibility;
+ rowHeader.colDef.visible = newVisibility;
+ grid.queueGridRefresh();
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name renderTree
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Creates an array of rows based on the tree, exporting only
+ * the visible nodes and leaves
+ *
+ * @param {array} nodeList the list of nodes - can be grid.treeBase.tree, or can be node.children when
+ * we're calling recursively
+ * @returns {array} renderable rows
+ */
+ renderTree: function( nodeList ){
+ var renderableRows = [];
+
+ nodeList.forEach( function ( node ){
+ if ( node.row.visible ){
+ renderableRows.push( node.row );
+ }
+ if ( node.state === uiGridTreeBaseConstants.EXPANDED && node.children && node.children.length > 0 ){
+ renderableRows = renderableRows.concat( service.renderTree( node.children ) );
+ }
+ });
+ return renderableRows;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name createTree
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Creates a tree from the renderableRows
+ *
+ * @param {Grid} grid the grid
+ * @param {array} renderableRows the rows we want to create a tree from
+ * @returns {object} the tree we've build
+ */
+ createTree: function( grid, renderableRows ) {
+ var currentLevel = -1;
+ var parents = [];
+ var currentState;
+ grid.treeBase.tree = [];
+ grid.treeBase.numberLevels = 0;
+ var aggregations = service.getAggregations( grid );
+
+ var createNode = function( row ){
+ if ( typeof(row.entity.$$treeLevel) !== 'undefined' && row.treeLevel !== row.entity.$$treeLevel ){
+ row.treeLevel = row.entity.$$treeLevel;
+ }
+
+ if ( row.treeLevel <= currentLevel ){
+ // pop any levels that aren't parents of this level, formatting the aggregation at the same time
+ while ( row.treeLevel <= currentLevel ){
+ var lastParent = parents.pop();
+ service.finaliseAggregations( lastParent );
+ currentLevel--;
+ }
+
+ // reset our current state based on the new parent, set to expanded if this is a level 0 node
+ if ( parents.length > 0 ){
+ currentState = service.setCurrentState(parents);
+ } else {
+ currentState = uiGridTreeBaseConstants.EXPANDED;
+ }
+ }
+
+ // aggregate if this is a leaf node
+ if ( ( typeof(row.treeLevel) === 'undefined' || row.treeLevel === null || row.treeLevel < 0 ) && row.visible ){
+ service.aggregate( grid, row, parents );
+ }
+
+ // add this node to the tree
+ service.addOrUseNode(grid, row, parents, aggregations);
+
+ if ( typeof(row.treeLevel) !== 'undefined' && row.treeLevel !== null && row.treeLevel >= 0 ){
+ parents.push(row);
+ currentLevel++;
+ currentState = service.setCurrentState(parents);
+ }
+
+ // update the tree number of levels, so we can set header width if we need to
+ if ( grid.treeBase.numberLevels < row.treeLevel + 1){
+ grid.treeBase.numberLevels = row.treeLevel + 1;
+ }
+ };
+
+ renderableRows.forEach( createNode );
+
+ // finalise remaining aggregations
+ while ( parents.length > 0 ){
+ var lastParent = parents.pop();
+ service.finaliseAggregations( lastParent );
+ }
+
+ return grid.treeBase.tree;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name addOrUseNode
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Creates a tree node for this row. If this row already has a treeNode
+ * recorded against it, preserves the state, but otherwise overwrites the data.
+ *
+ * @param {grid} grid the grid we're operating on
+ * @param {gridRow} row the row we want to set
+ * @param {array} parents an array of the parents this row should have
+ * @param {array} aggregationBase empty aggregation information
+ * @returns {undefined} updates the parents array, updates the row to have a treeNode, and updates the
+ * grid.treeBase.tree
+ */
+ addOrUseNode: function( grid, row, parents, aggregationBase ){
+ var newAggregations = [];
+ aggregationBase.forEach( function(aggregation){
+ newAggregations.push(service.buildAggregationObject(aggregation.col));
+ });
+
+ var newNode = { state: uiGridTreeBaseConstants.COLLAPSED, row: row, parentRow: null, aggregations: newAggregations, children: [] };
+ if ( row.treeNode ){
+ newNode.state = row.treeNode.state;
+ }
+ if ( parents.length > 0 ){
+ newNode.parentRow = parents[parents.length - 1];
+ }
+ row.treeNode = newNode;
+
+ if ( parents.length === 0 ){
+ grid.treeBase.tree.push( newNode );
+ } else {
+ parents[parents.length - 1].treeNode.children.push( newNode );
+ }
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name setCurrentState
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Looks at the parents array to determine our current state.
+ * If any node in the hierarchy is collapsed, then return collapsed, otherwise return
+ * expanded.
+ *
+ * @param {array} parents an array of the parents this row should have
+ * @returns {string} the state we should be setting to any nodes we see
+ */
+ setCurrentState: function( parents ){
+ var currentState = uiGridTreeBaseConstants.EXPANDED;
+ parents.forEach( function(parent){
+ if ( parent.treeNode.state === uiGridTreeBaseConstants.COLLAPSED ){
+ currentState = uiGridTreeBaseConstants.COLLAPSED;
+ }
+ });
+ return currentState;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name sortTree
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Performs a recursive sort on the tree nodes, sorting the
+ * children of each node and putting them back into the children array.
+ *
+ * Before doing this it turns back on all the sortIgnore - things that were previously
+ * ignored we process now. Since we're sorting within the nodes, presumably anything
+ * that was already sorted is how we derived the nodes, we can keep those sorts too.
+ *
+ * We only sort tree nodes that are expanded - no point in wasting effort sorting collapsed
+ * nodes
+ *
+ * @param {Grid} grid the grid to get the aggregation information from
+ * @returns {array} the aggregation information
+ */
+ sortTree: function( grid ){
+ grid.columns.forEach( function( column ) {
+ if ( column.sort && column.sort.ignoreSort ){
+ delete column.sort.ignoreSort;
+ }
+ });
+
+ grid.treeBase.tree = service.sortInternal( grid, grid.treeBase.tree );
+ },
+
+ sortInternal: function( grid, treeList ){
+ var rows = treeList.map( function( node ){
+ return node.row;
+ });
+
+ rows = rowSorter.sort( grid, rows, grid.columns );
+
+ var treeNodes = rows.map( function( row ){
+ return row.treeNode;
+ });
+
+ treeNodes.forEach( function( node ){
+ if ( node.state === uiGridTreeBaseConstants.EXPANDED && node.children && node.children.length > 0 ){
+ node.children = service.sortInternal( grid, node.children );
+ }
+ });
+
+ return treeNodes;
+ },
+
+ /**
+ * @ngdoc function
+ * @name fixFilter
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description After filtering has run, we need to go back through the tree
+ * and make sure the parent rows are always visible if any of the child rows
+ * are visible (filtering may make a child visible, but the parent may not
+ * match the filter criteria)
+ *
+ * This has a risk of being computationally expensive, we do it by walking
+ * the tree and remembering whether there are any invisible nodes on the
+ * way down.
+ *
+ * @param {Grid} grid the grid to fix filters on
+ */
+ fixFilter: function( grid ){
+ var parentsVisible;
+
+ grid.treeBase.tree.forEach( function( node ){
+ if ( node.children && node.children.length > 0 ){
+ parentsVisible = node.row.visible;
+ service.fixFilterInternal( node.children, parentsVisible );
+ }
+ });
+ },
+
+ fixFilterInternal: function( nodes, parentsVisible) {
+ nodes.forEach( function( node ){
+ if ( node.row.visible && !parentsVisible ){
+ service.setParentsVisible( node );
+ parentsVisible = true;
+ }
+
+ if ( node.children && node.children.length > 0 ){
+ if ( service.fixFilterInternal( node.children, ( parentsVisible && node.row.visible ) ) ) {
+ parentsVisible = true;
+ }
+ }
+ });
+
+ return parentsVisible;
+ },
+
+ setParentsVisible: function( node ){
+ while ( node.parentRow ){
+ node.parentRow.visible = true;
+ node = node.parentRow.treeNode;
+ }
+ },
+
+ /**
+ * @ngdoc function
+ * @name buildAggregationObject
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Build the object which is stored on the column for holding meta-data about the aggregation.
+ * This method should only be called with columns which have an aggregation.
+ *
+ * @param {Column} the column which this object relates to
+ * @returns {object} {col: Column object, label: string, type: string (optional)}
+ */
+ buildAggregationObject: function( column ){
+ var newAggregation = { col: column };
+
+ if ( column.treeAggregation && column.treeAggregation.type ){
+ newAggregation.type = column.treeAggregation.type;
+ }
+
+ if ( column.treeAggregation && column.treeAggregation.label ){
+ newAggregation.label = column.treeAggregation.label;
+ }
+
+ return newAggregation;
+ },
+
+ /**
+ * @ngdoc function
+ * @name getAggregations
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Looks through the grid columns to find those with aggregations,
+ * and collates the aggregation information into an array, returns that array
+ *
+ * @param {Grid} grid the grid to get the aggregation information from
+ * @returns {array} the aggregation information
+ */
+ getAggregations: function( grid ){
+ var aggregateArray = [];
+
+ grid.columns.forEach( function(column){
+ if ( typeof(column.treeAggregationFn) !== 'undefined' ){
+ aggregateArray.push( service.buildAggregationObject(column) );
+
+ if ( grid.options.showColumnFooter && typeof(column.colDef.aggregationType) === 'undefined' && column.treeAggregation ){
+ // Add aggregation object for footer
+ column.treeFooterAggregation = service.buildAggregationObject(column);
+ column.aggregationType = service.treeFooterAggregationType;
+ }
+ }
+ });
+ return aggregateArray;
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name aggregate
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Accumulate the data from this row onto the aggregations for each parent
+ *
+ * Iterate over the parents, then iterate over the aggregations for each of those parents,
+ * and perform the aggregation for each individual aggregation
+ *
+ * @param {Grid} grid grid object
+ * @param {GridRow} row the row we want to set grouping visibility on
+ * @param {array} parents the parents that we would want to aggregate onto
+ */
+ aggregate: function( grid, row, parents ){
+ if ( parents.length === 0 && row.treeNode && row.treeNode.aggregations ){
+ row.treeNode.aggregations.forEach(function(aggregation){
+ // Calculate aggregations for footer even if there are no grouped rows
+ if ( typeof(aggregation.col.treeFooterAggregation) !== 'undefined' ) {
+ var fieldValue = grid.getCellValue(row, aggregation.col);
+ var numValue = Number(fieldValue);
+ aggregation.col.treeAggregationFn(aggregation.col.treeFooterAggregation, fieldValue, numValue, row);
+ }
+ });
+ }
+
+ parents.forEach( function( parent, index ){
+ if ( parent.treeNode.aggregations ){
+ parent.treeNode.aggregations.forEach( function( aggregation ){
+ var fieldValue = grid.getCellValue(row, aggregation.col);
+ var numValue = Number(fieldValue);
+ aggregation.col.treeAggregationFn(aggregation, fieldValue, numValue, row);
+
+ if ( index === 0 && typeof(aggregation.col.treeFooterAggregation) !== 'undefined' ){
+ aggregation.col.treeAggregationFn(aggregation.col.treeFooterAggregation, fieldValue, numValue, row);
+ }
+ });
+ }
+ });
+ },
+
+
+ // Aggregation routines - no doco needed as self evident
+ nativeAggregations: function() {
+ var nativeAggregations = {
+ count: {
+ label: i18nService.get().aggregation.count,
+ menuTitle: i18nService.get().grouping.aggregate_count,
+ aggregationFn: function (aggregation, fieldValue, numValue) {
+ if (typeof(aggregation.value) === 'undefined') {
+ aggregation.value = 1;
+ } else {
+ aggregation.value++;
+ }
+ }
+ },
+
+ sum: {
+ label: i18nService.get().aggregation.sum,
+ menuTitle: i18nService.get().grouping.aggregate_sum,
+ aggregationFn: function( aggregation, fieldValue, numValue ) {
+ if (!isNaN(numValue)) {
+ if (typeof(aggregation.value) === 'undefined') {
+ aggregation.value = numValue;
+ } else {
+ aggregation.value += numValue;
+ }
+ }
+ }
+ },
+
+ min: {
+ label: i18nService.get().aggregation.min,
+ menuTitle: i18nService.get().grouping.aggregate_min,
+ aggregationFn: function( aggregation, fieldValue, numValue ) {
+ if (typeof(aggregation.value) === 'undefined') {
+ aggregation.value = fieldValue;
+ } else {
+ if (typeof(fieldValue) !== 'undefined' && fieldValue !== null && (fieldValue < aggregation.value || aggregation.value === null)) {
+ aggregation.value = fieldValue;
+ }
+ }
+ }
+ },
+
+ max: {
+ label: i18nService.get().aggregation.max,
+ menuTitle: i18nService.get().grouping.aggregate_max,
+ aggregationFn: function( aggregation, fieldValue, numValue ){
+ if ( typeof(aggregation.value) === 'undefined' ){
+ aggregation.value = fieldValue;
+ } else {
+ if ( typeof(fieldValue) !== 'undefined' && fieldValue !== null && (fieldValue > aggregation.value || aggregation.value === null)){
+ aggregation.value = fieldValue;
+ }
+ }
+ }
+ },
+
+ avg: {
+ label: i18nService.get().aggregation.avg,
+ menuTitle: i18nService.get().grouping.aggregate_avg,
+ aggregationFn: function( aggregation, fieldValue, numValue ){
+ if ( typeof(aggregation.count) === 'undefined' ){
+ aggregation.count = 1;
+ } else {
+ aggregation.count++;
+ }
+
+ if ( isNaN(numValue) ){
+ return;
+ }
+
+ if ( typeof(aggregation.value) === 'undefined' || typeof(aggregation.sum) === 'undefined' ){
+ aggregation.value = numValue;
+ aggregation.sum = numValue;
+ } else {
+ aggregation.sum += numValue;
+ aggregation.value = aggregation.sum / aggregation.count;
+ }
+ }
+ }
+ };
+ return nativeAggregations;
+ },
+
+ /**
+ * @ngdoc function
+ * @name finaliseAggregation
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Helper function used to finalize aggregation nodes and footer cells
+ *
+ * @param {gridRow} row the parent we're finalising
+ * @param {aggregation} the aggregation object manipulated by the aggregationFn
+ */
+ finaliseAggregation: function(row, aggregation){
+ if ( aggregation.col.treeAggregationUpdateEntity && typeof(row) !== 'undefined' && typeof(row.entity[ '$$' + aggregation.col.uid ]) !== 'undefined' ){
+ angular.extend( aggregation, row.entity[ '$$' + aggregation.col.uid ]);
+ }
+
+ if ( typeof(aggregation.col.treeAggregationFinalizerFn) === 'function' ){
+ aggregation.col.treeAggregationFinalizerFn( aggregation );
+ }
+ if ( typeof(aggregation.col.customTreeAggregationFinalizerFn) === 'function' ){
+ aggregation.col.customTreeAggregationFinalizerFn( aggregation );
+ }
+ if ( typeof(aggregation.rendered) === 'undefined' ){
+ aggregation.rendered = aggregation.label ? aggregation.label + aggregation.value : aggregation.value;
+ }
+ },
+
+ /**
+ * @ngdoc function
+ * @name finaliseAggregations
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Format the data from the aggregation into the rendered text
+ * e.g. if we had label: 'sum: ' and value: 25, we'd create 'sum: 25'.
+ *
+ * As part of this we call any formatting callback routines we've been provided.
+ *
+ * We write our aggregation out to the row.entity if treeAggregationUpdateEntity is
+ * set on the column - we don't overwrite any information that's already there, we append
+ * to it so that grouping can have set the groupVal beforehand without us overwriting it.
+ *
+ * We need to copy the data from the row.entity first before we finalise the aggregation,
+ * we need that information for the finaliserFn
+ *
+ * @param {gridRow} row the parent we're finalising
+ */
+ finaliseAggregations: function( row ){
+ if ( typeof(row.treeNode.aggregations) === 'undefined' ){
+ return;
+ }
+
+ row.treeNode.aggregations.forEach( function( aggregation ) {
+ service.finaliseAggregation(row, aggregation);
+
+ if ( aggregation.col.treeAggregationUpdateEntity ){
+ var aggregationCopy = {};
+ angular.forEach( aggregation, function( value, key ){
+ if ( aggregation.hasOwnProperty(key) && key !== 'col' ){
+ aggregationCopy[key] = value;
+ }
+ });
+
+ row.entity[ '$$' + aggregation.col.uid ] = aggregationCopy;
+ }
+ });
+ },
+
+ /**
+ * @ngdoc function
+ * @name treeFooterAggregationType
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Uses the tree aggregation functions and finalizers to set the
+ * column footer aggregations.
+ *
+ * @param {rows} visible rows. not used, but accepted to match signature of GridColumn.aggregationType
+ * @param {gridColumn} the column we are finalizing
+ */
+ treeFooterAggregationType: function( rows, column ) {
+ service.finaliseAggregation(undefined, column.treeFooterAggregation);
+ if ( typeof(column.treeFooterAggregation.value) === 'undefined' || column.treeFooterAggregation.rendered === null ){
+ // The was apparently no aggregation performed (perhaps this is a grouped column
+ return '';
+ }
+ return column.treeFooterAggregation.rendered;
+ }
+ };
+
+ return service;
+
+ }]);
+
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.treeBase.directive:uiGridTreeRowHeaderButtons
+ * @element div
+ *
+ * @description Provides the expand/collapse button on rows
+ */
+ module.directive('uiGridTreeBaseRowHeaderButtons', ['$templateCache', 'uiGridTreeBaseService',
+ function ($templateCache, uiGridTreeBaseService) {
+ return {
+ replace: true,
+ restrict: 'E',
+ template: $templateCache.get('ui-grid/treeBaseRowHeaderButtons'),
+ scope: true,
+ require: '^uiGrid',
+ link: function($scope, $elm, $attrs, uiGridCtrl) {
+ var self = uiGridCtrl.grid;
+ $scope.treeButtonClick = function(row, evt) {
+ uiGridTreeBaseService.toggleRowTreeState(self, row, evt);
+ };
+ }
+ };
+ }]);
+
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.treeBase.directive:uiGridTreeBaseExpandAllButtons
+ * @element div
+ *
+ * @description Provides the expand/collapse all button
+ */
+ module.directive('uiGridTreeBaseExpandAllButtons', ['$templateCache', 'uiGridTreeBaseService',
+ function ($templateCache, uiGridTreeBaseService) {
+ return {
+ replace: true,
+ restrict: 'E',
+ template: $templateCache.get('ui-grid/treeBaseExpandAllButtons'),
+ scope: false,
+ link: function($scope, $elm, $attrs, uiGridCtrl) {
+ var self = $scope.col.grid;
+
+ $scope.headerButtonClick = function(row, evt) {
+ if ( self.treeBase.expandAll ){
+ uiGridTreeBaseService.collapseAllRows(self, evt);
+ } else {
+ uiGridTreeBaseService.expandAllRows(self, evt);
+ }
+ };
+ }
+ };
+ }]);
+
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.treeBase.directive:uiGridViewport
+ * @element div
+ *
+ * @description Stacks on top of ui.grid.uiGridViewport to set formatting on a tree header row
+ */
+ module.directive('uiGridViewport',
+ ['$compile', 'uiGridConstants', 'gridUtil', '$parse',
+ function ($compile, uiGridConstants, gridUtil, $parse) {
+ return {
+ priority: -200, // run after default directive
+ scope: false,
+ compile: function ($elm, $attrs) {
+ var rowRepeatDiv = angular.element($elm.children().children()[0]);
+
+ var existingNgClass = rowRepeatDiv.attr("ng-class");
+ var newNgClass = '';
+ if ( existingNgClass ) {
+ newNgClass = existingNgClass.slice(0, -1) + ",'ui-grid-tree-header-row': row.treeLevel > -1}";
+ } else {
+ newNgClass = "{'ui-grid-tree-header-row': row.treeLevel > -1}";
+ }
+ rowRepeatDiv.attr("ng-class", newNgClass);
+
+ return {
+ pre: function ($scope, $elm, $attrs, controllers) {
+
+ },
+ post: function ($scope, $elm, $attrs, controllers) {
+ }
+ };
+ }
+ };
+ }]);
+})();
+
+(function () {
+ 'use strict';
+
+ /**
+ * @ngdoc overview
+ * @name ui.grid.treeView
+ * @description
+ *
+ * # ui.grid.treeView
+ *
+ * <div class="alert alert-warning" role="alert"><strong>Beta</strong> This feature is ready for testing, but it either hasn't seen a lot of use or has some known bugs.</div>
+ *
+ * This module provides a tree view of the data that it is provided, with nodes in that
+ * tree and leaves. Unlike grouping, the tree is an inherent property of the data and must
+ * be provided with your data array.
+ *
+ * Design information:
+ * -------------------
+ *
+ * TreeView uses treeBase for the underlying functionality, and is a very thin wrapper around
+ * that logic. Most of the design information has now moved to treebase.
+ * <br/>
+ * <br/>
+ *
+ * <div doc-module-components="ui.grid.treeView"></div>
+ */
+
+ var module = angular.module('ui.grid.treeView', ['ui.grid', 'ui.grid.treeBase']);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.treeView.constant:uiGridTreeViewConstants
+ *
+ * @description constants available in treeView module, this includes
+ * all the constants declared in the treeBase module (these are manually copied
+ * as there isn't an easy way to include constants in another constants file, and
+ * we don't want to make users include treeBase)
+ *
+ */
+ module.constant('uiGridTreeViewConstants', {
+ featureName: "treeView",
+ rowHeaderColName: 'treeBaseRowHeaderCol',
+ EXPANDED: 'expanded',
+ COLLAPSED: 'collapsed',
+ aggregation: {
+ COUNT: 'count',
+ SUM: 'sum',
+ MAX: 'max',
+ MIN: 'min',
+ AVG: 'avg'
+ }
+ });
+
+ /**
+ * @ngdoc service
+ * @name ui.grid.treeView.service:uiGridTreeViewService
+ *
+ * @description Services for treeView features
+ */
+ module.service('uiGridTreeViewService', ['$q', 'uiGridTreeViewConstants', 'uiGridTreeBaseConstants', 'uiGridTreeBaseService', 'gridUtil', 'GridRow', 'gridClassFactory', 'i18nService', 'uiGridConstants',
+ function ($q, uiGridTreeViewConstants, uiGridTreeBaseConstants, uiGridTreeBaseService, gridUtil, GridRow, gridClassFactory, i18nService, uiGridConstants) {
+
+ var service = {
+
+ initializeGrid: function (grid, $scope) {
+ uiGridTreeBaseService.initializeGrid( grid, $scope );
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.treeView.grid:treeView
+ *
+ * @description Grid properties and functions added for treeView
+ */
+ grid.treeView = {};
+
+ grid.registerRowsProcessor(service.adjustSorting, 60);
+
+ /**
+ * @ngdoc object
+ * @name ui.grid.treeView.api:PublicApi
+ *
+ * @description Public Api for treeView feature
+ */
+ var publicApi = {
+ events: {
+ treeView: {
+ }
+ },
+ methods: {
+ treeView: {
+ }
+ }
+ };
+
+ grid.api.registerEventsFromObject(publicApi.events);
+
+ grid.api.registerMethodsFromObject(publicApi.methods);
+
+ },
+
+ defaultGridOptions: function (gridOptions) {
+ //default option to true unless it was explicitly set to false
+ /**
+ * @ngdoc object
+ * @name ui.grid.treeView.api:GridOptions
+ *
+ * @description GridOptions for treeView feature, these are available to be
+ * set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
+ *
+ * Many tree options are set on treeBase, make sure to look at that feature in
+ * conjunction with these options.
+ */
+
+ /**
+ * @ngdoc object
+ * @name enableTreeView
+ * @propertyOf ui.grid.treeView.api:GridOptions
+ * @description Enable row tree view for entire grid.
+ * <br/>Defaults to true
+ */
+ gridOptions.enableTreeView = gridOptions.enableTreeView !== false;
+
+ },
+
+
+ /**
+ * @ngdoc function
+ * @name adjustSorting
+ * @methodOf ui.grid.treeBase.service:uiGridTreeBaseService
+ * @description Trees cannot be sorted the same as flat lists of rows -
+ * trees are sorted recursively within each level - so the children of each
+ * node are sorted, but not the full set of rows.
+ *
+ * To achieve this, we suppress the normal sorting by setting ignoreSort on
+ * each of the sort columns. When the treeBase rowsProcessor runs it will then
+ * unignore these, and will perform a recursive sort against the tree that it builds.
+ *
+ * @param {array} renderableRows the rows that we need to pass on through
+ * @returns {array} renderableRows that we passed on through
+ */
+ adjustSorting: function( renderableRows ) {
+ var grid = this;
+
+ grid.columns.forEach( function( column ){
+ if ( column.sort ){
+ column.sort.ignoreSort = true;
+ }
+ });
+
+ return renderableRows;
+ }
+
+ };
+
+ return service;
+
+ }]);
+
+ /**
+ * @ngdoc directive
+ * @name ui.grid.treeView.directive:uiGridTreeView
+ * @element div
+ * @restrict A
+ *
+ * @description Adds treeView features to grid
+ *
+ * @example
+ <example module="app">
+ <file name="app.js">
+ var app = angular.module('app', ['ui.grid', 'ui.grid.treeView']);
+
+ app.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.data = [
+ { name: 'Bob', title: 'CEO' },
+ { name: 'Frank', title: 'Lowly Developer' }
+ ];
+
+ $scope.columnDefs = [
+ {name: 'name', enableCellEdit: true},
+ {name: 'title', enableCellEdit: true}
+ ];
+
+ $scope.gridOptions = { columnDefs: $scope.columnDefs, data: $scope.data };
+ }]);
+ </file>
+ <file name="index.html">
+ <div ng-controller="MainCtrl">
+ <div ui-grid="gridOptions" ui-grid-tree-view></div>
+ </div>
+ </file>
+ </example>
+ */
+ module.directive('uiGridTreeView', ['uiGridTreeViewConstants', 'uiGridTreeViewService', '$templateCache',
+ function (uiGridTreeViewConstants, uiGridTreeViewService, $templateCache) {
+ return {
+ replace: true,
+ priority: 0,
+ require: '^uiGrid',
+ scope: false,
+ compile: function () {
+ return {
+ pre: function ($scope, $elm, $attrs, uiGridCtrl) {
+ if (uiGridCtrl.grid.options.enableTreeView !== false){
+ uiGridTreeViewService.initializeGrid(uiGridCtrl.grid, $scope);
+ }
+ },
+ post: function ($scope, $elm, $attrs, uiGridCtrl) {
+
+ }
+ };
+ }
+ };
+ }]);
+})();
+
+angular.module('ui.grid').run(['$templateCache', function($templateCache) {
+ 'use strict';
+
+ $templateCache.put('ui-grid/ui-grid-filter',
+ "<div class=\"ui-grid-filter-container\" ng-repeat=\"colFilter in col.filters\" ng-class=\"{'ui-grid-filter-cancel-button-hidden' : colFilter.disableCancelFilterButton === true }\"><div ng-if=\"colFilter.type !== 'select'\"><input type=\"text\" class=\"ui-grid-filter-input ui-grid-filter-input-{{$index}}\" ng-model=\"colFilter.term\" ng-attr-placeholder=\"{{colFilter.placeholder || ''}}\" aria-label=\"{{colFilter.ariaLabel || aria.defaultFilterLabel}}\"><div role=\"button\" class=\"ui-grid-filter-button\" ng-click=\"removeFilter(colFilter, $index)\" ng-if=\"!colFilter.disableCancelFilterButton\" ng-disabled=\"colFilter.term === undefined || colFilter.term === null || colFilter.term === ''\" ng-show=\"colFilter.term !== undefined && colFilter.term !== null && colFilter.term !== ''\"><i class=\"ui-grid-icon-cancel\" ui-grid-one-bind-aria-label=\"aria.removeFilter\">&nbsp;</i></div></div><div ng-if=\"colFilter.type === 'select'\"><select class=\"ui-grid-filter-select ui-grid-filter-input-{{$index}}\" ng-model=\"colFilter.term\" ng-attr-placeholder=\"{{colFilter.placeholder || aria.defaultFilterLabel}}\" aria-label=\"{{colFilter.ariaLabel || ''}}\" ng-options=\"option.value as option.label for option in colFilter.selectOptions\"><option value=\"\"></option></select><div role=\"button\" class=\"ui-grid-filter-button-select\" ng-click=\"removeFilter(colFilter, $index)\" ng-if=\"!colFilter.disableCancelFilterButton\" ng-disabled=\"colFilter.term === undefined || colFilter.term === null || colFilter.term === ''\" ng-show=\"colFilter.term !== undefined && colFilter.term != null\"><i class=\"ui-grid-icon-cancel\" ui-grid-one-bind-aria-label=\"aria.removeFilter\">&nbsp;</i></div></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/ui-grid-footer',
+ "<div class=\"ui-grid-footer-panel ui-grid-footer-aggregates-row\"><!-- tfooter --><div class=\"ui-grid-footer ui-grid-footer-viewport\"><div class=\"ui-grid-footer-canvas\"><div class=\"ui-grid-footer-cell-wrapper\" ng-style=\"colContainer.headerCellWrapperStyle()\"><div role=\"row\" class=\"ui-grid-footer-cell-row\"><div ui-grid-footer-cell role=\"gridcell\" ng-repeat=\"col in colContainer.renderedColumns track by col.uid\" col=\"col\" render-index=\"$index\" class=\"ui-grid-footer-cell ui-grid-clearfix\"></div></div></div></div></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/ui-grid-grid-footer',
+ "<div class=\"ui-grid-footer-info ui-grid-grid-footer\"><span>{{'search.totalItems' | t}} {{grid.rows.length}}</span> <span ng-if=\"grid.renderContainers.body.visibleRowCache.length !== grid.rows.length\" class=\"ngLabel\">({{\"search.showingItems\" | t}} {{grid.renderContainers.body.visibleRowCache.length}})</span></div>"
+ );
+
+
+ $templateCache.put('ui-grid/ui-grid-group-panel',
+ "<div class=\"ui-grid-group-panel\"><div ui-t=\"groupPanel.description\" class=\"description\" ng-show=\"groupings.length == 0\"></div><ul ng-show=\"groupings.length > 0\" class=\"ngGroupList\"><li class=\"ngGroupItem\" ng-repeat=\"group in configGroups\"><span class=\"ngGroupElement\"><span class=\"ngGroupName\">{{group.displayName}} <span ng-click=\"removeGroup($index)\" class=\"ngRemoveGroup\">x</span></span> <span ng-hide=\"$last\" class=\"ngGroupArrow\"></span></span></li></ul></div>"
+ );
+
+
+ $templateCache.put('ui-grid/ui-grid-header',
+ "<div role=\"rowgroup\" class=\"ui-grid-header\"><!-- theader --><div class=\"ui-grid-top-panel\"><div class=\"ui-grid-header-viewport\"><div class=\"ui-grid-header-canvas\"><div class=\"ui-grid-header-cell-wrapper\" ng-style=\"colContainer.headerCellWrapperStyle()\"><div role=\"row\" class=\"ui-grid-header-cell-row\"><div class=\"ui-grid-header-cell ui-grid-clearfix\" ng-repeat=\"col in colContainer.renderedColumns track by col.uid\" ui-grid-header-cell col=\"col\" render-index=\"$index\"></div></div></div></div></div></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/ui-grid-menu-button',
+ "<div class=\"ui-grid-menu-button\"><div role=\"button\" ui-grid-one-bind-id-grid=\"'grid-menu'\" class=\"ui-grid-icon-container\" ng-click=\"toggleMenu()\" aria-haspopup=\"true\"><i class=\"ui-grid-icon-menu\" ui-grid-one-bind-aria-label=\"i18n.aria.buttonLabel\">&nbsp;</i></div><div ui-grid-menu menu-items=\"menuItems\"></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/ui-grid-no-header',
+ "<div class=\"ui-grid-top-panel\"></div>"
+ );
+
+
+ $templateCache.put('ui-grid/ui-grid-row',
+ "<div ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.uid\" ui-grid-one-bind-id-grid=\"rowRenderIndex + '-' + col.uid + '-cell'\" class=\"ui-grid-cell\" ng-class=\"{ 'ui-grid-row-header-cell': col.isRowHeader }\" role=\"{{col.isRowHeader ? 'rowheader' : 'gridcell'}}\" ui-grid-cell></div>"
+ );
+
+
+ $templateCache.put('ui-grid/ui-grid',
+ "<div ui-i18n=\"en\" class=\"ui-grid\"><!-- TODO (c0bra): add \"scoped\" attr here, eventually? --><style ui-grid-style>.grid{{ grid.id }} {\n" +
+ " /* Styles for the grid */\n" +
+ " }\n" +
+ "\n" +
+ " .grid{{ grid.id }} .ui-grid-row, .grid{{ grid.id }} .ui-grid-cell, .grid{{ grid.id }} .ui-grid-cell .ui-grid-vertical-bar {\n" +
+ " height: {{ grid.options.rowHeight }}px;\n" +
+ " }\n" +
+ "\n" +
+ " .grid{{ grid.id }} .ui-grid-row:last-child .ui-grid-cell {\n" +
+ " border-bottom-width: {{ ((grid.getTotalRowHeight() < grid.getViewportHeight()) && '1') || '0' }}px;\n" +
+ " }\n" +
+ "\n" +
+ " {{ grid.verticalScrollbarStyles }}\n" +
+ " {{ grid.horizontalScrollbarStyles }}\n" +
+ "\n" +
+ " /*\n" +
+ " .ui-grid[dir=rtl] .ui-grid-viewport {\n" +
+ " padding-left: {{ grid.verticalScrollbarWidth }}px;\n" +
+ " }\n" +
+ " */\n" +
+ "\n" +
+ " {{ grid.customStyles }}</style><div class=\"ui-grid-contents-wrapper\"><div ui-grid-menu-button ng-if=\"grid.options.enableGridMenu\"></div><div ng-if=\"grid.hasLeftContainer()\" style=\"width: 0\" ui-grid-pinned-container=\"'left'\"></div><div ui-grid-render-container container-id=\"'body'\" col-container-name=\"'body'\" row-container-name=\"'body'\" bind-scroll-horizontal=\"true\" bind-scroll-vertical=\"true\" enable-horizontal-scrollbar=\"grid.options.enableHorizontalScrollbar\" enable-vertical-scrollbar=\"grid.options.enableVerticalScrollbar\"></div><div ng-if=\"grid.hasRightContainer()\" style=\"width: 0\" ui-grid-pinned-container=\"'right'\"></div><div ui-grid-grid-footer ng-if=\"grid.options.showGridFooter\"></div><div ui-grid-column-menu ng-if=\"grid.options.enableColumnMenus\"></div><div ng-transclude></div></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/uiGridCell',
+ "<div class=\"ui-grid-cell-contents\" title=\"TOOLTIP\">{{COL_FIELD CUSTOM_FILTERS}}</div>"
+ );
+
+
+ $templateCache.put('ui-grid/uiGridColumnMenu',
+ "<div class=\"ui-grid-column-menu\"><div ui-grid-menu menu-items=\"menuItems\"><!-- <div class=\"ui-grid-column-menu\">\n" +
+ " <div class=\"inner\" ng-show=\"menuShown\">\n" +
+ " <ul>\n" +
+ " <div ng-show=\"grid.options.enableSorting\">\n" +
+ " <li ng-click=\"sortColumn($event, asc)\" ng-class=\"{ 'selected' : col.sort.direction == asc }\"><i class=\"ui-grid-icon-sort-alt-up\"></i> Sort Ascending</li>\n" +
+ " <li ng-click=\"sortColumn($event, desc)\" ng-class=\"{ 'selected' : col.sort.direction == desc }\"><i class=\"ui-grid-icon-sort-alt-down\"></i> Sort Descending</li>\n" +
+ " <li ng-show=\"col.sort.direction\" ng-click=\"unsortColumn()\"><i class=\"ui-grid-icon-cancel\"></i> Remove Sort</li>\n" +
+ " </div>\n" +
+ " </ul>\n" +
+ " </div>\n" +
+ " </div> --></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/uiGridFooterCell',
+ "<div class=\"ui-grid-cell-contents\" col-index=\"renderIndex\"><div>{{ col.getAggregationText() + ( col.getAggregationValue() CUSTOM_FILTERS ) }}</div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/uiGridHeaderCell',
+ "<div role=\"columnheader\" ng-class=\"{ 'sortable': sortable }\" ui-grid-one-bind-aria-labelledby-grid=\"col.uid + '-header-text ' + col.uid + '-sortdir-text'\" aria-sort=\"{{col.sort.direction == asc ? 'ascending' : ( col.sort.direction == desc ? 'descending' : (!col.sort.direction ? 'none' : 'other'))}}\"><div role=\"button\" tabindex=\"0\" class=\"ui-grid-cell-contents ui-grid-header-cell-primary-focus\" col-index=\"renderIndex\" title=\"TOOLTIP\"><span class=\"ui-grid-header-cell-label\" ui-grid-one-bind-id-grid=\"col.uid + '-header-text'\">{{ col.displayName CUSTOM_FILTERS }}</span> <span ui-grid-one-bind-id-grid=\"col.uid + '-sortdir-text'\" ui-grid-visible=\"col.sort.direction\" aria-label=\"{{getSortDirectionAriaLabel()}}\"><i ng-class=\"{ 'ui-grid-icon-up-dir': col.sort.direction == asc, 'ui-grid-icon-down-dir': col.sort.direction == desc, 'ui-grid-icon-blank': !col.sort.direction }\" title=\"{{col.sort.priority ? i18n.headerCell.priority + ' ' + col.sort.priority : null}}\" aria-hidden=\"true\"></i> <sub class=\"ui-grid-sort-priority-number\">{{col.sort.priority}}</sub></span></div><div role=\"button\" tabindex=\"0\" ui-grid-one-bind-id-grid=\"col.uid + '-menu-button'\" class=\"ui-grid-column-menu-button\" ng-if=\"grid.options.enableColumnMenus && !col.isRowHeader && col.colDef.enableColumnMenu !== false\" ng-click=\"toggleMenu($event)\" ng-class=\"{'ui-grid-column-menu-button-last-col': isLastCol}\" ui-grid-one-bind-aria-label=\"i18n.headerCell.aria.columnMenuButtonLabel\" aria-haspopup=\"true\"><i class=\"ui-grid-icon-angle-down\" aria-hidden=\"true\">&nbsp;</i></div><div ui-grid-filter></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/uiGridMenu',
+ "<div class=\"ui-grid-menu\" ng-if=\"shown\"><div class=\"ui-grid-menu-mid\" ng-show=\"shownMid\"><div class=\"ui-grid-menu-inner\"><button type=\"button\" ng-focus=\"focus=true\" ng-blur=\"focus=false\" class=\"ui-grid-menu-close-button\" ng-class=\"{'ui-grid-sr-only': (!focus)}\"><i class=\"ui-grid-icon-cancel\" ui-grid-one-bind-aria-label=\"i18n.close\"></i></button><ul role=\"menu\" class=\"ui-grid-menu-items\"><li ng-repeat=\"item in menuItems\" role=\"menuitem\" ui-grid-menu-item ui-grid-one-bind-id=\"'menuitem-'+$index\" action=\"item.action\" name=\"item.title\" active=\"item.active\" icon=\"item.icon\" shown=\"item.shown\" context=\"item.context\" template-url=\"item.templateUrl\" leave-open=\"item.leaveOpen\" screen-reader-only=\"item.screenReaderOnly\"></li></ul></div></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/uiGridMenuItem',
+ "<button type=\"button\" class=\"ui-grid-menu-item\" ng-click=\"itemAction($event, title)\" ng-show=\"itemShown()\" ng-class=\"{ 'ui-grid-menu-item-active': active(), 'ui-grid-sr-only': (!focus && screenReaderOnly) }\" aria-pressed=\"{{active()}}\" tabindex=\"0\" ng-focus=\"focus=true\" ng-blur=\"focus=false\"><i ng-class=\"icon\" aria-hidden=\"true\">&nbsp;</i> {{ name }}</button>"
+ );
+
+
+ $templateCache.put('ui-grid/uiGridRenderContainer',
+ "<div role=\"grid\" ui-grid-one-bind-id-grid=\"'grid-container'\" class=\"ui-grid-render-container\" ng-style=\"{ 'margin-left': colContainer.getMargin('left') + 'px', 'margin-right': colContainer.getMargin('right') + 'px' }\"><!-- All of these dom elements are replaced in place --><div ui-grid-header></div><div ui-grid-viewport></div><div ng-if=\"colContainer.needsHScrollbarPlaceholder()\" class=\"ui-grid-scrollbar-placeholder\" ng-style=\"{height:colContainer.grid.scrollbarHeight + 'px'}\"></div><ui-grid-footer ng-if=\"grid.options.showColumnFooter\"></ui-grid-footer></div>"
+ );
+
+
+ $templateCache.put('ui-grid/uiGridViewport',
+ "<div role=\"rowgroup\" class=\"ui-grid-viewport\" ng-style=\"colContainer.getViewportStyle()\"><!-- tbody --><div class=\"ui-grid-canvas\"><div ng-repeat=\"(rowRenderIndex, row) in rowContainer.renderedRows track by $index\" class=\"ui-grid-row\" ng-style=\"Viewport.rowStyle(rowRenderIndex)\"><div role=\"row\" ui-grid-row=\"row\" row-render-index=\"rowRenderIndex\"></div></div></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/cellEditor',
+ "<div><form name=\"inputForm\"><input type=\"INPUT_TYPE\" ng-class=\"'colt' + col.uid\" ui-grid-editor ng-model=\"MODEL_COL_FIELD\"></form></div>"
+ );
+
+
+ $templateCache.put('ui-grid/dropdownEditor',
+ "<div><form name=\"inputForm\"><select ng-class=\"'colt' + col.uid\" ui-grid-edit-dropdown ng-model=\"MODEL_COL_FIELD\" ng-options=\"field[editDropdownIdLabel] as field[editDropdownValueLabel] CUSTOM_FILTERS for field in editDropdownOptionsArray\"></select></form></div>"
+ );
+
+
+ $templateCache.put('ui-grid/fileChooserEditor',
+ "<div><form name=\"inputForm\"><input ng-class=\"'colt' + col.uid\" ui-grid-edit-file-chooser type=\"file\" id=\"files\" name=\"files[]\" ng-model=\"MODEL_COL_FIELD\"></form></div>"
+ );
+
+
+ $templateCache.put('ui-grid/expandableRow',
+ "<div ui-grid-expandable-row ng-if=\"expandableRow.shouldRenderExpand()\" class=\"expandableRow\" style=\"float:left; margin-top: 1px; margin-bottom: 1px\" ng-style=\"{width: (grid.renderContainers.body.getCanvasWidth()) + 'px', height: row.expandedRowHeight + 'px'}\"></div>"
+ );
+
+
+ $templateCache.put('ui-grid/expandableRowHeader',
+ "<div class=\"ui-grid-row-header-cell ui-grid-expandable-buttons-cell\"><div class=\"ui-grid-cell-contents\"><i ng-class=\"{ 'ui-grid-icon-plus-squared' : !row.isExpanded, 'ui-grid-icon-minus-squared' : row.isExpanded }\" ng-click=\"grid.api.expandable.toggleRowExpansion(row.entity)\"></i></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/expandableScrollFiller',
+ "<div ng-if=\"expandableRow.shouldRenderFiller()\" ng-class=\"{scrollFiller:true, scrollFillerClass:(colContainer.name === 'body')}\" ng-style=\"{ width: (grid.getViewportWidth()) + 'px', height: row.expandedRowHeight + 2 + 'px', 'margin-left': grid.options.rowHeader.rowHeaderWidth + 'px' }\"><i class=\"ui-grid-icon-spin5 ui-grid-animate-spin\" ng-style=\"{'margin-top': ( row.expandedRowHeight/2 - 5) + 'px', 'margin-left' : ((grid.getViewportWidth() - grid.options.rowHeader.rowHeaderWidth)/2 - 5) + 'px'}\"></i></div>"
+ );
+
+
+ $templateCache.put('ui-grid/expandableTopRowHeader',
+ "<div class=\"ui-grid-row-header-cell ui-grid-expandable-buttons-cell\"><div class=\"ui-grid-cell-contents\"><i ng-class=\"{ 'ui-grid-icon-plus-squared' : !grid.expandable.expandedAll, 'ui-grid-icon-minus-squared' : grid.expandable.expandedAll }\" ng-click=\"grid.api.expandable.toggleAllRows()\"></i></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/csvLink',
+ "<span class=\"ui-grid-exporter-csv-link-span\"><a href=\"data:text/csv;charset=UTF-8,CSV_CONTENT\" download=\"FILE_NAME\">LINK_LABEL</a></span>"
+ );
+
+
+ $templateCache.put('ui-grid/importerMenuItem',
+ "<li class=\"ui-grid-menu-item\"><form><input class=\"ui-grid-importer-file-chooser\" type=\"file\" id=\"files\" name=\"files[]\"></form></li>"
+ );
+
+
+ $templateCache.put('ui-grid/importerMenuItemContainer',
+ "<div ui-grid-importer-menu-item></div>"
+ );
+
+
+ $templateCache.put('ui-grid/pagination',
+ "<div role=\"contentinfo\" class=\"ui-grid-pager-panel\" ui-grid-pager ng-show=\"grid.options.enablePaginationControls\"><div role=\"navigation\" class=\"ui-grid-pager-container\"><div role=\"menubar\" class=\"ui-grid-pager-control\"><button type=\"button\" role=\"menuitem\" class=\"ui-grid-pager-first\" ui-grid-one-bind-title=\"aria.pageToFirst\" ui-grid-one-bind-aria-label=\"aria.pageToFirst\" ng-click=\"pageFirstPageClick()\" ng-disabled=\"cantPageBackward()\"><div class=\"first-triangle\"><div class=\"first-bar\"></div></div></button> <button type=\"button\" role=\"menuitem\" class=\"ui-grid-pager-previous\" ui-grid-one-bind-title=\"aria.pageBack\" ui-grid-one-bind-aria-label=\"aria.pageBack\" ng-click=\"pagePreviousPageClick()\" ng-disabled=\"cantPageBackward()\"><div class=\"first-triangle prev-triangle\"></div></button> <input type=\"number\" ui-grid-one-bind-title=\"aria.pageSelected\" ui-grid-one-bind-aria-label=\"aria.pageSelected\" class=\"ui-grid-pager-control-input\" ng-model=\"grid.options.paginationCurrentPage\" min=\"1\" max=\"{{ paginationApi.getTotalPages() }}\" required> <span class=\"ui-grid-pager-max-pages-number\" ng-show=\"paginationApi.getTotalPages() > 0\"><abbr ui-grid-one-bind-title=\"paginationOf\">/</abbr> {{ paginationApi.getTotalPages() }}</span> <button type=\"button\" role=\"menuitem\" class=\"ui-grid-pager-next\" ui-grid-one-bind-title=\"aria.pageForward\" ui-grid-one-bind-aria-label=\"aria.pageForward\" ng-click=\"pageNextPageClick()\" ng-disabled=\"cantPageForward()\"><div class=\"last-triangle next-triangle\"></div></button> <button type=\"button\" role=\"menuitem\" class=\"ui-grid-pager-last\" ui-grid-one-bind-title=\"aria.pageToLast\" ui-grid-one-bind-aria-label=\"aria.pageToLast\" ng-click=\"pageLastPageClick()\" ng-disabled=\"cantPageToLast()\"><div class=\"last-triangle\"><div class=\"last-bar\"></div></div></button></div><div class=\"ui-grid-pager-row-count-picker\" ng-if=\"grid.options.paginationPageSizes.length > 1\"><select ui-grid-one-bind-aria-labelledby-grid=\"'items-per-page-label'\" ng-model=\"grid.options.paginationPageSize\" ng-options=\"o as o for o in grid.options.paginationPageSizes\"></select><span ui-grid-one-bind-id-grid=\"'items-per-page-label'\" class=\"ui-grid-pager-row-count-label\">&nbsp;{{sizesLabel}}</span></div><span ng-if=\"grid.options.paginationPageSizes.length <= 1\" class=\"ui-grid-pager-row-count-label\">{{grid.options.paginationPageSize}}&nbsp;{{sizesLabel}}</span></div><div class=\"ui-grid-pager-count-container\"><div class=\"ui-grid-pager-count\"><span ng-show=\"grid.options.totalItems > 0\">{{showingLow}} <abbr ui-grid-one-bind-title=\"paginationThrough\">-</abbr> {{showingHigh}} {{paginationOf}} {{grid.options.totalItems}} {{totalItemsLabel}}</span></div></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/columnResizer',
+ "<div ui-grid-column-resizer ng-if=\"grid.options.enableColumnResizing\" class=\"ui-grid-column-resizer\" col=\"col\" position=\"right\" render-index=\"renderIndex\" unselectable=\"on\"></div>"
+ );
+
+
+ $templateCache.put('ui-grid/gridFooterSelectedItems',
+ "<span ng-if=\"grid.selection.selectedCount !== 0 && grid.options.enableFooterTotalSelected\">({{\"search.selectedItems\" | t}} {{grid.selection.selectedCount}})</span>"
+ );
+
+
+ $templateCache.put('ui-grid/selectionHeaderCell',
+ "<div><!-- <div class=\"ui-grid-vertical-bar\">&nbsp;</div> --><div class=\"ui-grid-cell-contents\" col-index=\"renderIndex\"><ui-grid-selection-select-all-buttons ng-if=\"grid.options.enableSelectAll\"></ui-grid-selection-select-all-buttons></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/selectionRowHeader',
+ "<div class=\"ui-grid-disable-selection\"><div class=\"ui-grid-cell-contents\"><ui-grid-selection-row-header-buttons></ui-grid-selection-row-header-buttons></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/selectionRowHeaderButtons',
+ "<div class=\"ui-grid-selection-row-header-buttons ui-grid-icon-ok\" ng-class=\"{'ui-grid-row-selected': row.isSelected}\" ng-click=\"selectButtonClick(row, $event)\">&nbsp;</div>"
+ );
+
+
+ $templateCache.put('ui-grid/selectionSelectAllButtons',
+ "<div class=\"ui-grid-selection-row-header-buttons ui-grid-icon-ok\" ng-class=\"{'ui-grid-all-selected': grid.selection.selectAll}\" ng-click=\"headerButtonClick($event)\"></div>"
+ );
+
+
+ $templateCache.put('ui-grid/treeBaseExpandAllButtons',
+ "<div class=\"ui-grid-tree-base-row-header-buttons\" ng-class=\"{'ui-grid-icon-minus-squared': grid.treeBase.numberLevels > 0 && grid.treeBase.expandAll, 'ui-grid-icon-plus-squared': grid.treeBase.numberLevels > 0 && !grid.treeBase.expandAll}\" ng-click=\"headerButtonClick($event)\"></div>"
+ );
+
+
+ $templateCache.put('ui-grid/treeBaseHeaderCell',
+ "<div><div class=\"ui-grid-cell-contents\" col-index=\"renderIndex\"><ui-grid-tree-base-expand-all-buttons></ui-grid-tree-base-expand-all-buttons></div></div>"
+ );
+
+
+ $templateCache.put('ui-grid/treeBaseRowHeader',
+ "<div class=\"ui-grid-cell-contents\"><ui-grid-tree-base-row-header-buttons></ui-grid-tree-base-row-header-buttons></div>"
+ );
+
+
+ $templateCache.put('ui-grid/treeBaseRowHeaderButtons',
+ "<div class=\"ui-grid-tree-base-row-header-buttons\" ng-class=\"{'ui-grid-tree-base-header': row.treeLevel > -1 }\" ng-click=\"treeButtonClick(row, $event)\"><i ng-class=\"{'ui-grid-icon-minus-squared': ( ( grid.options.showTreeExpandNoChildren && row.treeLevel > -1 ) || ( row.treeNode.children && row.treeNode.children.length > 0 ) ) && row.treeNode.state === 'expanded', 'ui-grid-icon-plus-squared': ( ( grid.options.showTreeExpandNoChildren && row.treeLevel > -1 ) || ( row.treeNode.children && row.treeNode.children.length > 0 ) ) && row.treeNode.state === 'collapsed'}\" ng-style=\"{'padding-left': grid.options.treeIndent * row.treeLevel + 'px'}\"></i> &nbsp;</div>"
+ );
+
+}]);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.svg b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.svg
new file mode 100644
index 00000000..3d675f63
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.svg
@@ -0,0 +1,34 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata>Copyright (C) 2015 by original authors @ fontello.com</metadata>
+<defs>
+<font id="ui-grid" horiz-adv-x="1000" >
+<font-face font-family="ui-grid" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
+<missing-glyph horiz-adv-x="1000" />
+<glyph glyph-name="plus-squared" unicode="&#xc350;" d="m714 314v72q0 14-10 25t-25 10h-179v179q0 15-11 25t-25 11h-71q-15 0-25-11t-11-25v-179h-178q-15 0-26-10t-10-25v-72q0-14 10-25t26-10h178v-179q0-14 11-25t25-11h71q15 0 25 11t11 25v179h179q14 0 25 10t10 25z m143 304v-536q0-66-47-113t-114-48h-535q-67 0-114 48t-47 113v536q0 66 47 113t114 48h535q67 0 114-48t47-113z" horiz-adv-x="857.1" />
+<glyph glyph-name="minus-squared" unicode="&#xc351;" d="m714 314v72q0 14-10 25t-25 10h-500q-15 0-26-10t-10-25v-72q0-14 10-25t26-10h500q14 0 25 10t10 25z m143 304v-536q0-66-47-113t-114-48h-535q-67 0-114 48t-47 113v536q0 66 47 113t114 48h535q67 0 114-48t47-113z" horiz-adv-x="857.1" />
+<glyph glyph-name="search" unicode="&#xc352;" d="m643 386q0 103-74 176t-176 74-177-74-73-176 73-177 177-73 176 73 74 177z m286-465q0-29-22-50t-50-21q-30 0-50 21l-191 191q-100-69-223-69-80 0-153 31t-125 84-84 125-31 153 31 152 84 126 125 84 153 31 152-31 126-84 84-126 31-152q0-123-69-223l191-191q21-21 21-51z" horiz-adv-x="928.6" />
+<glyph glyph-name="cancel" unicode="&#xc353;" d="m724 112q0-22-15-38l-76-76q-16-15-38-15t-38 15l-164 165-164-165q-16-15-38-15t-38 15l-76 76q-16 16-16 38t16 38l164 164-164 164q-16 16-16 38t16 38l76 76q16 16 38 16t38-16l164-164 164 164q16 16 38 16t38-16l76-76q15-15 15-38t-15-38l-164-164 164-164q15-15 15-38z" horiz-adv-x="785.7" />
+<glyph glyph-name="info-circled" unicode="&#xc354;" d="m571 82v89q0 8-5 13t-12 5h-54v286q0 8-5 13t-13 5h-178q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h53v-179h-53q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h250q7 0 12 5t5 13z m-71 500v89q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h107q8 0 13 5t5 13z m357-232q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
+<glyph glyph-name="lock" unicode="&#xc355;" d="m179 421h285v108q0 59-42 101t-101 41-101-41-41-101v-108z m464-53v-322q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v322q0 22 16 38t38 15h17v108q0 102 74 176t176 74 177-74 73-176v-108h18q23 0 38-15t16-38z" horiz-adv-x="642.9" />
+<glyph glyph-name="lock-open" unicode="&#xc356;" d="m929 529v-143q0-15-11-25t-25-11h-36q-14 0-25 11t-11 25v143q0 59-41 101t-101 41-101-41-42-101v-108h53q23 0 38-15t16-38v-322q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v322q0 22 16 38t38 15h375v108q0 103 73 176t177 74 176-74 74-176z" horiz-adv-x="928.6" />
+<glyph glyph-name="pencil" unicode="&#xc357;" d="m203-7l50 51-131 131-51-51v-60h72v-71h60z m291 518q0 12-12 12-5 0-9-4l-303-302q-4-4-4-10 0-12 13-12 5 0 9 4l303 302q3 4 3 10z m-30 107l232-232-464-465h-232v233z m381-54q0-29-20-50l-93-93-232 233 93 92q20 21 50 21 29 0 51-21l131-131q20-22 20-51z" horiz-adv-x="857.1" />
+<glyph glyph-name="down-dir" unicode="&#xc358;" d="m571 457q0-14-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 11-11 25t11 25 25 11h500q14 0 25-11t10-25z" horiz-adv-x="571.4" />
+<glyph glyph-name="up-dir" unicode="&#xc359;" d="m571 171q0-14-10-25t-25-10h-500q-15 0-25 10t-11 25 11 26l250 250q10 10 25 10t25-10l250-250q10-11 10-26z" horiz-adv-x="571.4" />
+<glyph glyph-name="left-dir" unicode="&#xc35a;" d="m357 600v-500q0-14-10-25t-26-11-25 11l-250 250q-10 11-10 25t10 25l250 250q11 11 25 11t26-11 10-25z" horiz-adv-x="357.1" />
+<glyph glyph-name="right-dir" unicode="&#xc35b;" d="m321 350q0-14-10-25l-250-250q-11-11-25-11t-25 11-11 25v500q0 15 11 25t25 11 25-11l250-250q10-10 10-25z" horiz-adv-x="357.1" />
+<glyph glyph-name="left-open" unicode="&#xc35c;" d="m653 682l-296-296 296-297q11-10 11-25t-11-25l-92-93q-11-10-25-10t-25 10l-414 415q-11 10-11 25t11 25l414 414q10 10 25 10t25-10l92-93q11-10 11-25t-11-25z" horiz-adv-x="714.3" />
+<glyph glyph-name="right-open" unicode="&#xc35d;" d="m618 361l-414-415q-11-10-25-10t-26 10l-92 93q-11 11-11 25t11 25l296 297-296 296q-11 11-11 25t11 25l92 93q11 10 26 10t25-10l414-414q10-11 10-25t-10-25z" horiz-adv-x="714.3" />
+<glyph glyph-name="angle-down" unicode="&#xc35e;" d="m600 439q0-7-6-13l-260-260q-5-5-13-5t-12 5l-260 260q-6 6-6 13t6 13l27 28q6 6 13 6t13-6l219-219 220 219q5 6 13 6t12-6l28-28q6-5 6-13z" horiz-adv-x="642.9" />
+<glyph glyph-name="filter" unicode="&#xc35f;" d="m783 685q9-23-8-39l-275-275v-414q0-23-22-33-7-3-14-3-15 0-25 11l-143 143q-10 10-10 25v271l-275 275q-18 16-8 39 9 22 33 22h714q23 0 33-22z" horiz-adv-x="785.7" />
+<glyph glyph-name="sort-alt-up" unicode="&#xc360;" d="m411 46q0-6-6-13l-178-178q-5-5-13-5-6 0-13 5l-178 179q-8 9-4 19 4 11 17 11h107v768q0 8 5 13t13 5h107q8 0 13-5t5-13v-768h107q8 0 13-5t5-13z m589-71v-107q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v107q0 8 5 13t13 5h464q8 0 13-5t5-13z m-107 286v-107q0-8-5-13t-13-5h-357q-8 0-13 5t-5 13v107q0 8 5 13t13 5h357q8 0 13-5t5-13z m-107 285v-107q0-8-5-13t-13-5h-250q-8 0-13 5t-5 13v107q0 8 5 13t13 5h250q8 0 13-5t5-13z m-107 286v-107q0-8-5-13t-13-5h-143q-8 0-13 5t-5 13v107q0 8 5 13t13 5h143q8 0 13-5t5-13z" horiz-adv-x="1000" />
+<glyph glyph-name="sort-alt-down" unicode="&#xc361;" d="m679-25v-107q0-8-5-13t-13-5h-143q-8 0-13 5t-5 13v107q0 8 5 13t13 5h143q8 0 13-5t5-13z m-268 71q0-6-6-13l-178-178q-5-5-13-5-6 0-13 5l-178 179q-8 9-4 19 4 11 17 11h107v768q0 8 5 13t13 5h107q8 0 13-5t5-13v-768h107q8 0 13-5t5-13z m375 215v-107q0-8-5-13t-13-5h-250q-8 0-13 5t-5 13v107q0 8 5 13t13 5h250q8 0 13-5t5-13z m107 285v-107q0-8-5-13t-13-5h-357q-8 0-13 5t-5 13v107q0 8 5 13t13 5h357q8 0 13-5t5-13z m107 286v-107q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v107q0 8 5 13t13 5h464q8 0 13-5t5-13z" horiz-adv-x="1000" />
+<glyph glyph-name="ok" unicode="&#xc362;" d="m932 534q0-22-15-38l-404-404-76-76q-16-15-38-15t-38 15l-76 76-202 202q-15 16-15 38t15 38l76 76q16 16 38 16t38-16l164-165 366 367q16 16 38 16t38-16l76-76q15-16 15-38z" horiz-adv-x="1000" />
+<glyph glyph-name="menu" unicode="&#xc363;" d="m857 100v-71q0-15-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 25t25 11h785q15 0 26-11t10-25z m0 286v-72q0-14-10-25t-26-10h-785q-15 0-25 10t-11 25v72q0 14 11 25t25 10h785q15 0 26-10t10-25z m0 285v-71q0-15-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 26t25 10h785q15 0 26-10t10-26z" horiz-adv-x="857.1" />
+<glyph glyph-name="indent-left" unicode="&#xe800;" d="m214 546v-321q0-7-5-13t-13-5q-7 0-12 5l-161 161q-5 5-5 13t5 13l161 160q5 5 12 5 8 0 13-5t5-13z m786-428v-107q0-7-5-13t-13-5h-964q-7 0-13 5t-5 13v107q0 7 5 12t13 6h964q7 0 13-6t5-12z m0 214v-107q0-7-5-13t-13-5h-607q-7 0-13 5t-5 13v107q0 7 5 13t13 5h607q7 0 13-5t5-13z m0 214v-107q0-7-5-12t-13-6h-607q-7 0-13 6t-5 12v107q0 8 5 13t13 5h607q7 0 13-5t5-13z m0 215v-107q0-8-5-13t-13-5h-964q-7 0-13 5t-5 13v107q0 7 5 12t13 6h964q7 0 13-6t5-12z" horiz-adv-x="1000" />
+<glyph glyph-name="indent-right" unicode="&#xe801;" d="m196 386q0-8-5-13l-160-161q-5-5-13-5-7 0-13 5t-5 13v321q0 8 5 13t13 5q8 0 13-5l160-160q5-5 5-13z m804-268v-107q0-7-5-13t-13-5h-964q-7 0-13 5t-5 13v107q0 7 5 12t13 6h964q7 0 13-6t5-12z m0 214v-107q0-7-5-13t-13-5h-607q-7 0-13 5t-5 13v107q0 7 5 13t13 5h607q7 0 13-5t5-13z m0 214v-107q0-7-5-12t-13-6h-607q-7 0-13 6t-5 12v107q0 8 5 13t13 5h607q7 0 13-5t5-13z m0 215v-107q0-8-5-13t-13-5h-964q-7 0-13 5t-5 13v107q0 7 5 12t13 6h964q7 0 13-6t5-12z" horiz-adv-x="1000" />
+<glyph glyph-name="spin5" unicode="&#xea61;" d="m462 850c-6 0-11-5-11-11l0-183 0 0c0-6 5-11 11-11l69 0c1 0 1 0 1 0 7 0 12 5 12 11l0 183 0 0c0 6-5 11-12 11l-69 0c0 0 0 0-1 0z m250-47c-4 1-8-2-10-5l-91-158 0 0c-4-6-2-13 4-16l60-35c0 0 0 0 0 0 6-3 13-1 16 4l91 158c3 6 2 13-4 16l-61 35c-1 1-3 1-5 1z m-428-2c-2 0-4-1-6-2l-61-35c-5-3-7-10-4-16l91-157c0 0 0 0 0 0 3-6 10-8 16-5l61 35c5 4 7 11 4 16l-91 157c0 1 0 1 0 1-2 4-6 6-10 6z m620-163c-2 0-4 0-6-1l-157-91c0 0 0 0 0 0-6-3-8-10-5-16l35-61c4-5 11-7 16-4l157 91c1 0 1 0 1 0 6 3 7 10 4 16l-35 61c-2 3-6 5-10 5z m-810-4c-5 0-9-2-11-6l-35-61c-3-5-1-12 4-15l158-92 0 0c6-3 13-1 16 5l35 60c0 0 0 0 0 0 3 6 1 13-4 16l-158 91c-2 1-4 2-5 2z m712-235l0 0c-6 0-11-5-11-11l0-69c0-1 0-1 0-1 0-7 5-12 11-12l183 0 0 0c6 0 11 5 11 12l0 69c0 0 0 0 0 1 0 6-5 11-11 11l-183 0z m-794-5l0 0c-7 0-12-5-12-12l0-69c0 0 0 0 0-1 0-6 5-11 12-11l182 0 0 0c6 0 11 5 11 11l0 69c0 1 0 1 0 1 0 7-5 12-11 12l-182 0z m772-153c-4 0-8-2-10-6l-34-60c-1 0-1 0-1 0-3-6-1-13 4-16l158-91c6-3 13-2 16 4l35 61c3 5 1 12-4 15l-158 91 0 0c-2 1-4 2-6 2z m-566-5c-1 0-3 0-5-1l-157-91c0 0-1 0-1 0-5-3-7-11-4-16l35-61c3-5 10-7 16-4l157 91c0 0 0 0 0 0 6 3 8 10 5 16l-35 61c-3 3-7 5-11 5z m468-121c-2 0-4 0-6-1l-61-35c-5-4-7-11-4-16l91-157c0-1 0-1 0-1 3-6 11-7 16-4l61 35c5 3 7 10 4 16l-91 157c0 0 0 0 0 0-2 4-6 6-10 6z m-367-3c-4 1-8-2-10-5l-91-158c-3-6-1-13 4-16l61-35c5-3 12-1 15 4l92 158 0 0c3 6 1 13-5 16l-60 34c0 1 0 1 0 1-2 1-4 1-6 1z m149-57c-7 0-12-5-12-11l0-183 0 0c0-6 5-11 12-11l69 0c0 0 0 0 1 0 6 0 11 5 11 11l0 183 0 0c0 6-5 11-11 11l-69 0c-1 0-1 0-1 0z" horiz-adv-x="1000" />
+</font>
+</defs>
+</svg> \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.ttf b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.ttf
new file mode 100644
index 00000000..dbf56e98
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.ttf
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.woff b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.woff
new file mode 100644
index 00000000..fb19c43c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.woff
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/vfs_fonts.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/vfs_fonts.js
new file mode 100644
index 00000000..f5fd30a8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/vfs_fonts.js
@@ -0,0 +1 @@
+window.pdfMake = window.pdfMake || {}; window.pdfMake.vfs = {"LICENSE.txt":"DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBcGFjaGUgTGljZW5zZQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgVmVyc2lvbiAyLjAsIEphbnVhcnkgMjAwNA0KICAgICAgICAgICAgICAgICAgICAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzLw0KDQogICBURVJNUyBBTkQgQ09ORElUSU9OUyBGT1IgVVNFLCBSRVBST0RVQ1RJT04sIEFORCBESVNUUklCVVRJT04NCg0KICAgMS4gRGVmaW5pdGlvbnMuDQoNCiAgICAgICJMaWNlbnNlIiBzaGFsbCBtZWFuIHRoZSB0ZXJtcyBhbmQgY29uZGl0aW9ucyBmb3IgdXNlLCByZXByb2R1Y3Rpb24sDQogICAgICBhbmQgZGlzdHJpYnV0aW9uIGFzIGRlZmluZWQgYnkgU2VjdGlvbnMgMSB0aHJvdWdoIDkgb2YgdGhpcyBkb2N1bWVudC4NCg0KICAgICAgIkxpY2Vuc29yIiBzaGFsbCBtZWFuIHRoZSBjb3B5cmlnaHQgb3duZXIgb3IgZW50aXR5IGF1dGhvcml6ZWQgYnkNCiAgICAgIHRoZSBjb3B5cmlnaHQgb3duZXIgdGhhdCBpcyBncmFudGluZyB0aGUgTGljZW5zZS4NCg0KICAgICAgIkxlZ2FsIEVudGl0eSIgc2hhbGwgbWVhbiB0aGUgdW5pb24gb2YgdGhlIGFjdGluZyBlbnRpdHkgYW5kIGFsbA0KICAgICAgb3RoZXIgZW50aXRpZXMgdGhhdCBjb250cm9sLCBhcmUgY29udHJvbGxlZCBieSwgb3IgYXJlIHVuZGVyIGNvbW1vbg0KICAgICAgY29udHJvbCB3aXRoIHRoYXQgZW50aXR5LiBGb3IgdGhlIHB1cnBvc2VzIG9mIHRoaXMgZGVmaW5pdGlvbiwNCiAgICAgICJjb250cm9sIiBtZWFucyAoaSkgdGhlIHBvd2VyLCBkaXJlY3Qgb3IgaW5kaXJlY3QsIHRvIGNhdXNlIHRoZQ0KICAgICAgZGlyZWN0aW9uIG9yIG1hbmFnZW1lbnQgb2Ygc3VjaCBlbnRpdHksIHdoZXRoZXIgYnkgY29udHJhY3Qgb3INCiAgICAgIG90aGVyd2lzZSwgb3IgKGlpKSBvd25lcnNoaXAgb2YgZmlmdHkgcGVyY2VudCAoNTAlKSBvciBtb3JlIG9mIHRoZQ0KICAgICAgb3V0c3RhbmRpbmcgc2hhcmVzLCBvciAoaWlpKSBiZW5lZmljaWFsIG93bmVyc2hpcCBvZiBzdWNoIGVudGl0eS4NCg0KICAgICAgIllvdSIgKG9yICJZb3VyIikgc2hhbGwgbWVhbiBhbiBpbmRpdmlkdWFsIG9yIExlZ2FsIEVudGl0eQ0KICAgICAgZXhlcmNpc2luZyBwZXJtaXNzaW9ucyBncmFudGVkIGJ5IHRoaXMgTGljZW5zZS4NCg0KICAgICAgIlNvdXJjZSIgZm9ybSBzaGFsbCBtZWFuIHRoZSBwcmVmZXJyZWQgZm9ybSBmb3IgbWFraW5nIG1vZGlmaWNhdGlvbnMsDQogICAgICBpbmNsdWRpbmcgYnV0IG5vdCBsaW1pdGVkIHRvIHNvZnR3YXJlIHNvdXJjZSBjb2RlLCBkb2N1bWVudGF0aW9uDQogICAgICBzb3VyY2UsIGFuZCBjb25maWd1cmF0aW9uIGZpbGVzLg0KDQogICAgICAiT2JqZWN0IiBmb3JtIHNoYWxsIG1lYW4gYW55IGZvcm0gcmVzdWx0aW5nIGZyb20gbWVjaGFuaWNhbA0KICAgICAgdHJhbnNmb3JtYXRpb24gb3IgdHJhbnNsYXRpb24gb2YgYSBTb3VyY2UgZm9ybSwgaW5jbHVkaW5nIGJ1dA0KICAgICAgbm90IGxpbWl0ZWQgdG8gY29tcGlsZWQgb2JqZWN0IGNvZGUsIGdlbmVyYXRlZCBkb2N1bWVudGF0aW9uLA0KICAgICAgYW5kIGNvbnZlcnNpb25zIHRvIG90aGVyIG1lZGlhIHR5cGVzLg0KDQogICAgICAiV29yayIgc2hhbGwgbWVhbiB0aGUgd29yayBvZiBhdXRob3JzaGlwLCB3aGV0aGVyIGluIFNvdXJjZSBvcg0KICAgICAgT2JqZWN0IGZvcm0sIG1hZGUgYXZhaWxhYmxlIHVuZGVyIHRoZSBMaWNlbnNlLCBhcyBpbmRpY2F0ZWQgYnkgYQ0KICAgICAgY29weXJpZ2h0IG5vdGljZSB0aGF0IGlzIGluY2x1ZGVkIGluIG9yIGF0dGFjaGVkIHRvIHRoZSB3b3JrDQogICAgICAoYW4gZXhhbXBsZSBpcyBwcm92aWRlZCBpbiB0aGUgQXBwZW5kaXggYmVsb3cpLg0KDQogICAgICAiRGVyaXZhdGl2ZSBXb3JrcyIgc2hhbGwgbWVhbiBhbnkgd29yaywgd2hldGhlciBpbiBTb3VyY2Ugb3IgT2JqZWN0DQogICAgICBmb3JtLCB0aGF0IGlzIGJhc2VkIG9uIChvciBkZXJpdmVkIGZyb20pIHRoZSBXb3JrIGFuZCBmb3Igd2hpY2ggdGhlDQogICAgICBlZGl0b3JpYWwgcmV2aXNpb25zLCBhbm5vdGF0aW9ucywgZWxhYm9yYXRpb25zLCBvciBvdGhlciBtb2RpZmljYXRpb25zDQogICAgICByZXByZXNlbnQsIGFzIGEgd2hvbGUsIGFuIG9yaWdpbmFsIHdvcmsgb2YgYXV0aG9yc2hpcC4gRm9yIHRoZSBwdXJwb3Nlcw0KICAgICAgb2YgdGhpcyBMaWNlbnNlLCBEZXJpdmF0aXZlIFdvcmtzIHNoYWxsIG5vdCBpbmNsdWRlIHdvcmtzIHRoYXQgcmVtYWluDQogICAgICBzZXBhcmFibGUgZnJvbSwgb3IgbWVyZWx5IGxpbmsgKG9yIGJpbmQgYnkgbmFtZSkgdG8gdGhlIGludGVyZmFjZXMgb2YsDQogICAgICB0aGUgV29yayBhbmQgRGVyaXZhdGl2ZSBXb3JrcyB0aGVyZW9mLg0KDQogICAgICAiQ29udHJpYnV0aW9uIiBzaGFsbCBtZWFuIGFueSB3b3JrIG9mIGF1dGhvcnNoaXAsIGluY2x1ZGluZw0KICAgICAgdGhlIG9yaWdpbmFsIHZlcnNpb24gb2YgdGhlIFdvcmsgYW5kIGFueSBtb2RpZmljYXRpb25zIG9yIGFkZGl0aW9ucw0KICAgICAgdG8gdGhhdCBXb3JrIG9yIERlcml2YXRpdmUgV29ya3MgdGhlcmVvZiwgdGhhdCBpcyBpbnRlbnRpb25hbGx5DQogICAgICBzdWJtaXR0ZWQgdG8gTGljZW5zb3IgZm9yIGluY2x1c2lvbiBpbiB0aGUgV29yayBieSB0aGUgY29weXJpZ2h0IG93bmVyDQogICAgICBvciBieSBhbiBpbmRpdmlkdWFsIG9yIExlZ2FsIEVudGl0eSBhdXRob3JpemVkIHRvIHN1Ym1pdCBvbiBiZWhhbGYgb2YNCiAgICAgIHRoZSBjb3B5cmlnaHQgb3duZXIuIEZvciB0aGUgcHVycG9zZXMgb2YgdGhpcyBkZWZpbml0aW9uLCAic3VibWl0dGVkIg0KICAgICAgbWVhbnMgYW55IGZvcm0gb2YgZWxlY3Ryb25pYywgdmVyYmFsLCBvciB3cml0dGVuIGNvbW11bmljYXRpb24gc2VudA0KICAgICAgdG8gdGhlIExpY2Vuc29yIG9yIGl0cyByZXByZXNlbnRhdGl2ZXMsIGluY2x1ZGluZyBidXQgbm90IGxpbWl0ZWQgdG8NCiAgICAgIGNvbW11bmljYXRpb24gb24gZWxlY3Ryb25pYyBtYWlsaW5nIGxpc3RzLCBzb3VyY2UgY29kZSBjb250cm9sIHN5c3RlbXMsDQogICAgICBhbmQgaXNzdWUgdHJhY2tpbmcgc3lzdGVtcyB0aGF0IGFyZSBtYW5hZ2VkIGJ5LCBvciBvbiBiZWhhbGYgb2YsIHRoZQ0KICAgICAgTGljZW5zb3IgZm9yIHRoZSBwdXJwb3NlIG9mIGRpc2N1c3NpbmcgYW5kIGltcHJvdmluZyB0aGUgV29yaywgYnV0DQogICAgICBleGNsdWRpbmcgY29tbXVuaWNhdGlvbiB0aGF0IGlzIGNvbnNwaWN1b3VzbHkgbWFya2VkIG9yIG90aGVyd2lzZQ0KICAgICAgZGVzaWduYXRlZCBpbiB3cml0aW5nIGJ5IHRoZSBjb3B5cmlnaHQgb3duZXIgYXMgIk5vdCBhIENvbnRyaWJ1dGlvbi4iDQoNCiAgICAgICJDb250cmlidXRvciIgc2hhbGwgbWVhbiBMaWNlbnNvciBhbmQgYW55IGluZGl2aWR1YWwgb3IgTGVnYWwgRW50aXR5DQogICAgICBvbiBiZWhhbGYgb2Ygd2hvbSBhIENvbnRyaWJ1dGlvbiBoYXMgYmVlbiByZWNlaXZlZCBieSBMaWNlbnNvciBhbmQNCiAgICAgIHN1YnNlcXVlbnRseSBpbmNvcnBvcmF0ZWQgd2l0aGluIHRoZSBXb3JrLg0KDQogICAyLiBHcmFudCBvZiBDb3B5cmlnaHQgTGljZW5zZS4gU3ViamVjdCB0byB0aGUgdGVybXMgYW5kIGNvbmRpdGlvbnMgb2YNCiAgICAgIHRoaXMgTGljZW5zZSwgZWFjaCBDb250cmlidXRvciBoZXJlYnkgZ3JhbnRzIHRvIFlvdSBhIHBlcnBldHVhbCwNCiAgICAgIHdvcmxkd2lkZSwgbm9uLWV4Y2x1c2l2ZSwgbm8tY2hhcmdlLCByb3lhbHR5LWZyZWUsIGlycmV2b2NhYmxlDQogICAgICBjb3B5cmlnaHQgbGljZW5zZSB0byByZXByb2R1Y2UsIHByZXBhcmUgRGVyaXZhdGl2ZSBXb3JrcyBvZiwNCiAgICAgIHB1YmxpY2x5IGRpc3BsYXksIHB1YmxpY2x5IHBlcmZvcm0sIHN1YmxpY2Vuc2UsIGFuZCBkaXN0cmlidXRlIHRoZQ0KICAgICAgV29yayBhbmQgc3VjaCBEZXJpdmF0aXZlIFdvcmtzIGluIFNvdXJjZSBvciBPYmplY3QgZm9ybS4NCg0KICAgMy4gR3JhbnQgb2YgUGF0ZW50IExpY2Vuc2UuIFN1YmplY3QgdG8gdGhlIHRlcm1zIGFuZCBjb25kaXRpb25zIG9mDQogICAgICB0aGlzIExpY2Vuc2UsIGVhY2ggQ29udHJpYnV0b3IgaGVyZWJ5IGdyYW50cyB0byBZb3UgYSBwZXJwZXR1YWwsDQogICAgICB3b3JsZHdpZGUsIG5vbi1leGNsdXNpdmUsIG5vLWNoYXJnZSwgcm95YWx0eS1mcmVlLCBpcnJldm9jYWJsZQ0KICAgICAgKGV4Y2VwdCBhcyBzdGF0ZWQgaW4gdGhpcyBzZWN0aW9uKSBwYXRlbnQgbGljZW5zZSB0byBtYWtlLCBoYXZlIG1hZGUsDQogICAgICB1c2UsIG9mZmVyIHRvIHNlbGwsIHNlbGwsIGltcG9ydCwgYW5kIG90aGVyd2lzZSB0cmFuc2ZlciB0aGUgV29yaywNCiAgICAgIHdoZXJlIHN1Y2ggbGljZW5zZSBhcHBsaWVzIG9ubHkgdG8gdGhvc2UgcGF0ZW50IGNsYWltcyBsaWNlbnNhYmxlDQogICAgICBieSBzdWNoIENvbnRyaWJ1dG9yIHRoYXQgYXJlIG5lY2Vzc2FyaWx5IGluZnJpbmdlZCBieSB0aGVpcg0KICAgICAgQ29udHJpYnV0aW9uKHMpIGFsb25lIG9yIGJ5IGNvbWJpbmF0aW9uIG9mIHRoZWlyIENvbnRyaWJ1dGlvbihzKQ0KICAgICAgd2l0aCB0aGUgV29yayB0byB3aGljaCBzdWNoIENvbnRyaWJ1dGlvbihzKSB3YXMgc3VibWl0dGVkLiBJZiBZb3UNCiAgICAgIGluc3RpdHV0ZSBwYXRlbnQgbGl0aWdhdGlvbiBhZ2FpbnN0IGFueSBlbnRpdHkgKGluY2x1ZGluZyBhDQogICAgICBjcm9zcy1jbGFpbSBvciBjb3VudGVyY2xhaW0gaW4gYSBsYXdzdWl0KSBhbGxlZ2luZyB0aGF0IHRoZSBXb3JrDQogICAgICBvciBhIENvbnRyaWJ1dGlvbiBpbmNvcnBvcmF0ZWQgd2l0aGluIHRoZSBXb3JrIGNvbnN0aXR1dGVzIGRpcmVjdA0KICAgICAgb3IgY29udHJpYnV0b3J5IHBhdGVudCBpbmZyaW5nZW1lbnQsIHRoZW4gYW55IHBhdGVudCBsaWNlbnNlcw0KICAgICAgZ3JhbnRlZCB0byBZb3UgdW5kZXIgdGhpcyBMaWNlbnNlIGZvciB0aGF0IFdvcmsgc2hhbGwgdGVybWluYXRlDQogICAgICBhcyBvZiB0aGUgZGF0ZSBzdWNoIGxpdGlnYXRpb24gaXMgZmlsZWQuDQoNCiAgIDQuIFJlZGlzdHJpYnV0aW9uLiBZb3UgbWF5IHJlcHJvZHVjZSBhbmQgZGlzdHJpYnV0ZSBjb3BpZXMgb2YgdGhlDQogICAgICBXb3JrIG9yIERlcml2YXRpdmUgV29ya3MgdGhlcmVvZiBpbiBhbnkgbWVkaXVtLCB3aXRoIG9yIHdpdGhvdXQNCiAgICAgIG1vZGlmaWNhdGlvbnMsIGFuZCBpbiBTb3VyY2Ugb3IgT2JqZWN0IGZvcm0sIHByb3ZpZGVkIHRoYXQgWW91DQogICAgICBtZWV0IHRoZSBmb2xsb3dpbmcgY29uZGl0aW9uczoNCg0KICAgICAgKGEpIFlvdSBtdXN0IGdpdmUgYW55IG90aGVyIHJlY2lwaWVudHMgb2YgdGhlIFdvcmsgb3INCiAgICAgICAgICBEZXJpdmF0aXZlIFdvcmtzIGEgY29weSBvZiB0aGlzIExpY2Vuc2U7IGFuZA0KDQogICAgICAoYikgWW91IG11c3QgY2F1c2UgYW55IG1vZGlmaWVkIGZpbGVzIHRvIGNhcnJ5IHByb21pbmVudCBub3RpY2VzDQogICAgICAgICAgc3RhdGluZyB0aGF0IFlvdSBjaGFuZ2VkIHRoZSBmaWxlczsgYW5kDQoNCiAgICAgIChjKSBZb3UgbXVzdCByZXRhaW4sIGluIHRoZSBTb3VyY2UgZm9ybSBvZiBhbnkgRGVyaXZhdGl2ZSBXb3Jrcw0KICAgICAgICAgIHRoYXQgWW91IGRpc3RyaWJ1dGUsIGFsbCBjb3B5cmlnaHQsIHBhdGVudCwgdHJhZGVtYXJrLCBhbmQNCiAgICAgICAgICBhdHRyaWJ1dGlvbiBub3RpY2VzIGZyb20gdGhlIFNvdXJjZSBmb3JtIG9mIHRoZSBXb3JrLA0KICAgICAgICAgIGV4Y2x1ZGluZyB0aG9zZSBub3RpY2VzIHRoYXQgZG8gbm90IHBlcnRhaW4gdG8gYW55IHBhcnQgb2YNCiAgICAgICAgICB0aGUgRGVyaXZhdGl2ZSBXb3JrczsgYW5kDQoNCiAgICAgIChkKSBJZiB0aGUgV29yayBpbmNsdWRlcyBhICJOT1RJQ0UiIHRleHQgZmlsZSBhcyBwYXJ0IG9mIGl0cw0KICAgICAgICAgIGRpc3RyaWJ1dGlvbiwgdGhlbiBhbnkgRGVyaXZhdGl2ZSBXb3JrcyB0aGF0IFlvdSBkaXN0cmlidXRlIG11c3QNCiAgICAgICAgICBpbmNsdWRlIGEgcmVhZGFibGUgY29weSBvZiB0aGUgYXR0cmlidXRpb24gbm90aWNlcyBjb250YWluZWQNCiAgICAgICAgICB3aXRoaW4gc3VjaCBOT1RJQ0UgZmlsZSwgZXhjbHVkaW5nIHRob3NlIG5vdGljZXMgdGhhdCBkbyBub3QNCiAgICAgICAgICBwZXJ0YWluIHRvIGFueSBwYXJ0IG9mIHRoZSBEZXJpdmF0aXZlIFdvcmtzLCBpbiBhdCBsZWFzdCBvbmUNCiAgICAgICAgICBvZiB0aGUgZm9sbG93aW5nIHBsYWNlczogd2l0aGluIGEgTk9USUNFIHRleHQgZmlsZSBkaXN0cmlidXRlZA0KICAgICAgICAgIGFzIHBhcnQgb2YgdGhlIERlcml2YXRpdmUgV29ya3M7IHdpdGhpbiB0aGUgU291cmNlIGZvcm0gb3INCiAgICAgICAgICBkb2N1bWVudGF0aW9uLCBpZiBwcm92aWRlZCBhbG9uZyB3aXRoIHRoZSBEZXJpdmF0aXZlIFdvcmtzOyBvciwNCiAgICAgICAgICB3aXRoaW4gYSBkaXNwbGF5IGdlbmVyYXRlZCBieSB0aGUgRGVyaXZhdGl2ZSBXb3JrcywgaWYgYW5kDQogICAgICAgICAgd2hlcmV2ZXIgc3VjaCB0aGlyZC1wYXJ0eSBub3RpY2VzIG5vcm1hbGx5IGFwcGVhci4gVGhlIGNvbnRlbnRzDQogICAgICAgICAgb2YgdGhlIE5PVElDRSBmaWxlIGFyZSBmb3IgaW5mb3JtYXRpb25hbCBwdXJwb3NlcyBvbmx5IGFuZA0KICAgICAgICAgIGRvIG5vdCBtb2RpZnkgdGhlIExpY2Vuc2UuIFlvdSBtYXkgYWRkIFlvdXIgb3duIGF0dHJpYnV0aW9uDQogICAgICAgICAgbm90aWNlcyB3aXRoaW4gRGVyaXZhdGl2ZSBXb3JrcyB0aGF0IFlvdSBkaXN0cmlidXRlLCBhbG9uZ3NpZGUNCiAgICAgICAgICBvciBhcyBhbiBhZGRlbmR1bSB0byB0aGUgTk9USUNFIHRleHQgZnJvbSB0aGUgV29yaywgcHJvdmlkZWQNCiAgICAgICAgICB0aGF0IHN1Y2ggYWRkaXRpb25hbCBhdHRyaWJ1dGlvbiBub3RpY2VzIGNhbm5vdCBiZSBjb25zdHJ1ZWQNCiAgICAgICAgICBhcyBtb2RpZnlpbmcgdGhlIExpY2Vuc2UuDQoNCiAgICAgIFlvdSBtYXkgYWRkIFlvdXIgb3duIGNvcHlyaWdodCBzdGF0ZW1lbnQgdG8gWW91ciBtb2RpZmljYXRpb25zIGFuZA0KICAgICAgbWF5IHByb3ZpZGUgYWRkaXRpb25hbCBvciBkaWZmZXJlbnQgbGljZW5zZSB0ZXJtcyBhbmQgY29uZGl0aW9ucw0KICAgICAgZm9yIHVzZSwgcmVwcm9kdWN0aW9uLCBvciBkaXN0cmlidXRpb24gb2YgWW91ciBtb2RpZmljYXRpb25zLCBvcg0KICAgICAgZm9yIGFueSBzdWNoIERlcml2YXRpdmUgV29ya3MgYXMgYSB3aG9sZSwgcHJvdmlkZWQgWW91ciB1c2UsDQogICAgICByZXByb2R1Y3Rpb24sIGFuZCBkaXN0cmlidXRpb24gb2YgdGhlIFdvcmsgb3RoZXJ3aXNlIGNvbXBsaWVzIHdpdGgNCiAgICAgIHRoZSBjb25kaXRpb25zIHN0YXRlZCBpbiB0aGlzIExpY2Vuc2UuDQoNCiAgIDUuIFN1Ym1pc3Npb24gb2YgQ29udHJpYnV0aW9ucy4gVW5sZXNzIFlvdSBleHBsaWNpdGx5IHN0YXRlIG90aGVyd2lzZSwNCiAgICAgIGFueSBDb250cmlidXRpb24gaW50ZW50aW9uYWxseSBzdWJtaXR0ZWQgZm9yIGluY2x1c2lvbiBpbiB0aGUgV29yaw0KICAgICAgYnkgWW91IHRvIHRoZSBMaWNlbnNvciBzaGFsbCBiZSB1bmRlciB0aGUgdGVybXMgYW5kIGNvbmRpdGlvbnMgb2YNCiAgICAgIHRoaXMgTGljZW5zZSwgd2l0aG91dCBhbnkgYWRkaXRpb25hbCB0ZXJtcyBvciBjb25kaXRpb25zLg0KICAgICAgTm90d2l0aHN0YW5kaW5nIHRoZSBhYm92ZSwgbm90aGluZyBoZXJlaW4gc2hhbGwgc3VwZXJzZWRlIG9yIG1vZGlmeQ0KICAgICAgdGhlIHRlcm1zIG9mIGFueSBzZXBhcmF0ZSBsaWNlbnNlIGFncmVlbWVudCB5b3UgbWF5IGhhdmUgZXhlY3V0ZWQNCiAgICAgIHdpdGggTGljZW5zb3IgcmVnYXJkaW5nIHN1Y2ggQ29udHJpYnV0aW9ucy4NCg0KICAgNi4gVHJhZGVtYXJrcy4gVGhpcyBMaWNlbnNlIGRvZXMgbm90IGdyYW50IHBlcm1pc3Npb24gdG8gdXNlIHRoZSB0cmFkZQ0KICAgICAgbmFtZXMsIHRyYWRlbWFya3MsIHNlcnZpY2UgbWFya3MsIG9yIHByb2R1Y3QgbmFtZXMgb2YgdGhlIExpY2Vuc29yLA0KICAgICAgZXhjZXB0IGFzIHJlcXVpcmVkIGZvciByZWFzb25hYmxlIGFuZCBjdXN0b21hcnkgdXNlIGluIGRlc2NyaWJpbmcgdGhlDQogICAgICBvcmlnaW4gb2YgdGhlIFdvcmsgYW5kIHJlcHJvZHVjaW5nIHRoZSBjb250ZW50IG9mIHRoZSBOT1RJQ0UgZmlsZS4NCg0KICAgNy4gRGlzY2xhaW1lciBvZiBXYXJyYW50eS4gVW5sZXNzIHJlcXVpcmVkIGJ5IGFwcGxpY2FibGUgbGF3IG9yDQogICAgICBhZ3JlZWQgdG8gaW4gd3JpdGluZywgTGljZW5zb3IgcHJvdmlkZXMgdGhlIFdvcmsgKGFuZCBlYWNoDQogICAgICBDb250cmlidXRvciBwcm92aWRlcyBpdHMgQ29udHJpYnV0aW9ucykgb24gYW4gIkFTIElTIiBCQVNJUywNCiAgICAgIFdJVEhPVVQgV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWSBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvcg0KICAgICAgaW1wbGllZCwgaW5jbHVkaW5nLCB3aXRob3V0IGxpbWl0YXRpb24sIGFueSB3YXJyYW50aWVzIG9yIGNvbmRpdGlvbnMNCiAgICAgIG9mIFRJVExFLCBOT04tSU5GUklOR0VNRU5ULCBNRVJDSEFOVEFCSUxJVFksIG9yIEZJVE5FU1MgRk9SIEENCiAgICAgIFBBUlRJQ1VMQVIgUFVSUE9TRS4gWW91IGFyZSBzb2xlbHkgcmVzcG9uc2libGUgZm9yIGRldGVybWluaW5nIHRoZQ0KICAgICAgYXBwcm9wcmlhdGVuZXNzIG9mIHVzaW5nIG9yIHJlZGlzdHJpYnV0aW5nIHRoZSBXb3JrIGFuZCBhc3N1bWUgYW55DQogICAgICByaXNrcyBhc3NvY2lhdGVkIHdpdGggWW91ciBleGVyY2lzZSBvZiBwZXJtaXNzaW9ucyB1bmRlciB0aGlzIExpY2Vuc2UuDQoNCiAgIDguIExpbWl0YXRpb24gb2YgTGlhYmlsaXR5LiBJbiBubyBldmVudCBhbmQgdW5kZXIgbm8gbGVnYWwgdGhlb3J5LA0KICAgICAgd2hldGhlciBpbiB0b3J0IChpbmNsdWRpbmcgbmVnbGlnZW5jZSksIGNvbnRyYWN0LCBvciBvdGhlcndpc2UsDQogICAgICB1bmxlc3MgcmVxdWlyZWQgYnkgYXBwbGljYWJsZSBsYXcgKHN1Y2ggYXMgZGVsaWJlcmF0ZSBhbmQgZ3Jvc3NseQ0KICAgICAgbmVnbGlnZW50IGFjdHMpIG9yIGFncmVlZCB0byBpbiB3cml0aW5nLCBzaGFsbCBhbnkgQ29udHJpYnV0b3IgYmUNCiAgICAgIGxpYWJsZSB0byBZb3UgZm9yIGRhbWFnZXMsIGluY2x1ZGluZyBhbnkgZGlyZWN0LCBpbmRpcmVjdCwgc3BlY2lhbCwNCiAgICAgIGluY2lkZW50YWwsIG9yIGNvbnNlcXVlbnRpYWwgZGFtYWdlcyBvZiBhbnkgY2hhcmFjdGVyIGFyaXNpbmcgYXMgYQ0KICAgICAgcmVzdWx0IG9mIHRoaXMgTGljZW5zZSBvciBvdXQgb2YgdGhlIHVzZSBvciBpbmFiaWxpdHkgdG8gdXNlIHRoZQ0KICAgICAgV29yayAoaW5jbHVkaW5nIGJ1dCBub3QgbGltaXRlZCB0byBkYW1hZ2VzIGZvciBsb3NzIG9mIGdvb2R3aWxsLA0KICAgICAgd29yayBzdG9wcGFnZSwgY29tcHV0ZXIgZmFpbHVyZSBvciBtYWxmdW5jdGlvbiwgb3IgYW55IGFuZCBhbGwNCiAgICAgIG90aGVyIGNvbW1lcmNpYWwgZGFtYWdlcyBvciBsb3NzZXMpLCBldmVuIGlmIHN1Y2ggQ29udHJpYnV0b3INCiAgICAgIGhhcyBiZWVuIGFkdmlzZWQgb2YgdGhlIHBvc3NpYmlsaXR5IG9mIHN1Y2ggZGFtYWdlcy4NCg0KICAgOS4gQWNjZXB0aW5nIFdhcnJhbnR5IG9yIEFkZGl0aW9uYWwgTGlhYmlsaXR5LiBXaGlsZSByZWRpc3RyaWJ1dGluZw0KICAgICAgdGhlIFdvcmsgb3IgRGVyaXZhdGl2ZSBXb3JrcyB0aGVyZW9mLCBZb3UgbWF5IGNob29zZSB0byBvZmZlciwNCiAgICAgIGFuZCBjaGFyZ2UgYSBmZWUgZm9yLCBhY2NlcHRhbmNlIG9mIHN1cHBvcnQsIHdhcnJhbnR5LCBpbmRlbW5pdHksDQogICAgICBvciBvdGhlciBsaWFiaWxpdHkgb2JsaWdhdGlvbnMgYW5kL29yIHJpZ2h0cyBjb25zaXN0ZW50IHdpdGggdGhpcw0KICAgICAgTGljZW5zZS4gSG93ZXZlciwgaW4gYWNjZXB0aW5nIHN1Y2ggb2JsaWdhdGlvbnMsIFlvdSBtYXkgYWN0IG9ubHkNCiAgICAgIG9uIFlvdXIgb3duIGJlaGFsZiBhbmQgb24gWW91ciBzb2xlIHJlc3BvbnNpYmlsaXR5LCBub3Qgb24gYmVoYWxmDQogICAgICBvZiBhbnkgb3RoZXIgQ29udHJpYnV0b3IsIGFuZCBvbmx5IGlmIFlvdSBhZ3JlZSB0byBpbmRlbW5pZnksDQogICAgICBkZWZlbmQsIGFuZCBob2xkIGVhY2ggQ29udHJpYnV0b3IgaGFybWxlc3MgZm9yIGFueSBsaWFiaWxpdHkNCiAgICAgIGluY3VycmVkIGJ5LCBvciBjbGFpbXMgYXNzZXJ0ZWQgYWdhaW5zdCwgc3VjaCBDb250cmlidXRvciBieSByZWFzb24NCiAgICAgIG9mIHlvdXIgYWNjZXB0aW5nIGFueSBzdWNoIHdhcnJhbnR5IG9yIGFkZGl0aW9uYWwgbGlhYmlsaXR5Lg0KDQogICBFTkQgT0YgVEVSTVMgQU5EIENPTkRJVElPTlMNCg0KICAgQVBQRU5ESVg6IEhvdyB0byBhcHBseSB0aGUgQXBhY2hlIExpY2Vuc2UgdG8geW91ciB3b3JrLg0KDQogICAgICBUbyBhcHBseSB0aGUgQXBhY2hlIExpY2Vuc2UgdG8geW91ciB3b3JrLCBhdHRhY2ggdGhlIGZvbGxvd2luZw0KICAgICAgYm9pbGVycGxhdGUgbm90aWNlLCB3aXRoIHRoZSBmaWVsZHMgZW5jbG9zZWQgYnkgYnJhY2tldHMgIltdIg0KICAgICAgcmVwbGFjZWQgd2l0aCB5b3VyIG93biBpZGVudGlmeWluZyBpbmZvcm1hdGlvbi4gKERvbid0IGluY2x1ZGUNCiAgICAgIHRoZSBicmFja2V0cyEpICBUaGUgdGV4dCBzaG91bGQgYmUgZW5jbG9zZWQgaW4gdGhlIGFwcHJvcHJpYXRlDQogICAgICBjb21tZW50IHN5bnRheCBmb3IgdGhlIGZpbGUgZm9ybWF0LiBXZSBhbHNvIHJlY29tbWVuZCB0aGF0IGENCiAgICAgIGZpbGUgb3IgY2xhc3MgbmFtZSBhbmQgZGVzY3JpcHRpb24gb2YgcHVycG9zZSBiZSBpbmNsdWRlZCBvbiB0aGUNCiAgICAgIHNhbWUgInByaW50ZWQgcGFnZSIgYXMgdGhlIGNvcHlyaWdodCBub3RpY2UgZm9yIGVhc2llcg0KICAgICAgaWRlbnRpZmljYXRpb24gd2l0aGluIHRoaXJkLXBhcnR5IGFyY2hpdmVzLg0KDQogICBDb3B5cmlnaHQgW3l5eXldIFtuYW1lIG9mIGNvcHlyaWdodCBvd25lcl0NCg0KICAgTGljZW5zZWQgdW5kZXIgdGhlIEFwYWNoZSBMaWNlbnNlLCBWZXJzaW9uIDIuMCAodGhlICJMaWNlbnNlIik7DQogICB5b3UgbWF5IG5vdCB1c2UgdGhpcyBmaWxlIGV4Y2VwdCBpbiBjb21wbGlhbmNlIHdpdGggdGhlIExpY2Vuc2UuDQogICBZb3UgbWF5IG9idGFpbiBhIGNvcHkgb2YgdGhlIExpY2Vuc2UgYXQNCg0KICAgICAgIGh0dHA6Ly93d3cuYXBhY2hlLm9yZy9saWNlbnNlcy9MSUNFTlNFLTIuMA0KDQogICBVbmxlc3MgcmVxdWlyZWQgYnkgYXBwbGljYWJsZSBsYXcgb3IgYWdyZWVkIHRvIGluIHdyaXRpbmcsIHNvZnR3YXJlDQogICBkaXN0cmlidXRlZCB1bmRlciB0aGUgTGljZW5zZSBpcyBkaXN0cmlidXRlZCBvbiBhbiAiQVMgSVMiIEJBU0lTLA0KICAgV0lUSE9VVCBXQVJSQU5USUVTIE9SIENPTkRJVElPTlMgT0YgQU5ZIEtJTkQsIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuDQogICBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kDQogICBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4NCg==","Roboto-Italic.ttf":"AAEAAAAOAIAAAwBgR0RFRgsuCy8AATmYAAAASEdQT1OC3T4oAAE54AAAkPhHU1VCeolvLwABytgAAANsT1MvMrivKS4AAAFoAAAAYFZETVhu6nZPAAASPAAABeBjbWFwg/CFnwAAGBwAAA7yZ2x5ZqugYnAAACcQAADhjGhlYWQVl+THAAAA7AAAADZoaGVhK3TmIgAAASQAAAAkaG10eH7tDo8AAAHIAAAQdGxvY2H/CzayAAEInAAACDxtYXhwBDwA9gAAAUgAAAAgbmFtZW3ArcAAARDYAAAEb3Bvc3QJy9dbAAEVSAAAJE0AAQAAAAEAAERFNtJfDzz1AAkIAAAAAADE8BEuAAAAAM2Cslz6t9PdKU8IYgACAAkAAgAAAAAAAAABAAAHbP4MAAAJA/q32vUpTwABAAAAAAAAAAAAAAAAAAAEHQABAAAEHQCWABYAXgAFAAEAAAAAAAAAAAAAAAAAAwABAAMEQQGQAAUAAAWaBTMAAAEfBZoFMwAAA9EAZgIAAAAAAAAAAAAAAAAA4AAC/1AAIFsAAAAgAAAAAHB5cnMAAQAA//0GAP4AAGYHmgIAIAABn08BAAAEOgWwAAAAIAACAeMAAAAAAAAB4wAAAeMAAAJ1AMUErABDBDoARwV7ANMErAAbAVcAxgKBAFcCiP+MA0AAoQRCAHIBgf+YAhUAPgIGAEYDH/+mBDoAUAQ6AXAEOgAtBDoANQQ6ACcEOgBoBDoAZwQ6ANgEOgA1BDoAfwHpAEYB8f/GA9EAZQQ6AI4D7gBWA5IAwga0ABME/v/VBMsAWATBAGIE8ABYBGIAWARfAFgFJgBoBVgAWAIkAGIEJQAPBH4APgQgAFgGkgBYBVkAWAUcAF4EzQBYBTsAXgT4AFcEjQBDBHoA7AUSAGcE3QDNBpUA7AS9//wEpgDuBDIAIAIKABIDHAD3Agr/lwMnAHwDa/+WAl0A8wQgADoERAA1A/wARwREAEQD+QBHApsAigRDADcERAA1AegARAH2/x0D2QA2AegARAaLADUERAA1BEQARgRE/+IERABEAqQANQPuADsCaQBvBEQAWgPIAJcFrACyA8j/6QPI/7wDyAAIApEAUQHhADYCkf+pBRgAggHh/+sEHQBXBGAALQVVACYEjgBxAdkAAQSc/8gDvwEnBd4AUgNeAMIDjABwBCsApgXfAFIDewEDAtABBQQGAE4DMQCnAzgAqgJoAPsERP/rA7EAhwH/AMMB4//OAg8BBANtAM8DiwA1BdUBDgY7ARsGgQC6A7f/8wcF/54EBABIBR0AJgRvAEgEeQAwBlIABARnACYESgBqBEUATARY/+sFRABVAegAPgQxAD4D8wBJAhEARwUwAEYERAA1BygATwbHAEQB6ABEApb/ZgUjAFkETgBGBToAZwSuAFoB7/8bA/kAPAOWAUgDYgFeAzgBCwINAUECkQEiAhP/twOXAQgCzwEHAnoAHQAK/fIACv5BAAr9WAAK/kYACv1LAAr83AHzAWQD1AFBAgAAwwQuAFcFS//MBR0ATwTs/94ETQAiBVoAWARN//EFXwBXBS8AigUAAB0EPwBABHL/9QPIALMERABBBAsAKQPsAIsERAA1BEYAVgJ5AH4EKv/RA7AAOgR6AHAERP/iBAsASQREAEMD7gC3BBwAWgVNAD8FRABDBisAXQSiAFoD/wCzBeEAZAWfANsFEgBmCAj/3ggTAFcGGgDyBVoAVwS7AEgFqv+WBtP/ygR0ACAFWQBYBU//3gS3AKMF0QBbBX8AVwUnANEHDgBXB0cAVwWrAMkGggBXBLkASAURAIcGrABiBM4ADAQnAEQETgBAAygAPgSQ/5oFvP/DA9IAHgRaAEAEFQBABFv/1QWSAEAEWQBABFoAQAOfAJAFbwBABHkAQAQYAH8GEgBABjoANQSlAIYF2ABABBYAQAQLADMGHgBABCH/1QRFADUEDABRBlj/1QZzAEAERQA1BFoAQAaRAGgFtwBFBBQAPga2AGMFmQA8BIb/2AQF/7wGmAB0BaoAXQZrADoFigA6CHsAYgddAD4D5f/HA5//xgUdAF0ERQBGBL4A6APIALMFHQBPBEUARgaLAGwFtwBIBpIAaAW4AEUE5ABkBAgASgSyAFUACv09AAr9ZAAK/m8ACv6QAAr6twAK+tYEFAA+BMsAVwRD/+IEHwBIA1wANQSXAFcDyQA1BL0ASAQ+AD4GJADzBTQApQdEAFcFVQA1B6kAVwaGADUFjQBlBIkATga/AOgFCwCIBR0A0QQmAJcFHQDQBc8ArgR0ACUEvQBIBBsAPgVYAFcERAA1BSsARgRgADYEYP/tBHIACgMY//sEtQA2BjQANgZzAEAF7wDoBNkAiAQIAM8DywC8B0H/8QYM/+wHfQBOBjUANQSoAGAD3gBGBVIA1wTPAKwFEQBqA9UAAAehAAAD1QAAB6EAAAKSAAAB7wAAAU4AAAQ4AAACEwAAAY8AAADMAAAACgAABS8A6QYSAQADb/9oAY0A1gGNALEBjP+kAY7/YQK7ANYCwgC9Aqn/pAQkAJUESQAQApAArwOPAEcFDABHByYArgJGAIACRgAhA24ACQN0AIsDLgCjBGAALQYmAEkD/gBgBYkA4wOXAGcIOABOBLQBIwTGAHwGUAD+BtwArAcIAKoGbQEeBFkAJgU/ADkEZ/+7BEoAzwSIAGgHqABJAfL/OwQ7AFAD7wCOA/YASAP9AEcDyQBnAjYAjwJ1AJQB7f/mBC0AaAAKAAAHq/+1B6wAhwPfAB8DXAAnBDoAUQLg/+AB6P8dAhH/egF+/8IDbQE3A2wBNwNsATcDyAEPA9ABCwPIAF8DxwEXA20BDQHrAS8Eb//UBDIAPgRJAE0EYAA+BAQAPgPfAD4EhgBKBKsAPgHoAD4DzwALBBwAPgOEAD4FlwA+BMoAPgR/AE0ElQBNBGMAPgQrACMD7gC9BLMAWARwAL4FoQDUBEH/4wQcALUD/v/5BDMASgJNAKwDqQAPA9YAIAQjACUEJQAeA+8ATgOEAL0D7gAjA+cAbQIPAH8DKAAiAzgAJQLTAO0DRwArA0gAQALjAI8DTwAuAzgAZANtAD4DZwC5ApEBKwMbAPUEOgAuBDoAJwQ6AGEESwBkA/n/kQQBAOsEMP/OBDoANQR7AEAERABBBPAAWAQgADcE3gBXBNMAWAPZADYE7ABYA9gANgQ6AH0EMgA+AzgBCwHjAAACFQA+BTMAXgUzAF4EYgBTBHoA7AJpAAcE/v/VBP7/1QT+/9UE/v/VBP7/1QT+/9UE/v/VBMsAYgRiAFgEYgBYBGIAWARiAFgCJABiAiQAYgIkAGICJABiBVkAWAU7AF4FOwBeBTsAXgU7AF4FOwBeBRIAZwUSAGcFEgBnBRIAZwSmAO4EIAA6BCAAOgQgADoEIAA6BCAAOgQgADoEIAA6A/wARwP5AEcD+QBHA/kARwP5AEcB6AA+AegAPgHoAD4B6AA+BEQANQREAEYERABGBEQARgREAEYERABGBEQAWgREAFoERABaBEQAWgPI/7wDyP+8BP7/1QQgADoE/v/VBCAAOgT+/9UEIAA6BMsAYgP8AEcEywBiA/wARwTLAGID/ABHBMsAYgP8AEcFFQBYBNoARARiAFgD+QBHBGIAWAP5AEcEYgBYA/kARwRiAFgD+QBHBGIAWAP5AEcFJgBoBEMANwUmAGgEQwA3BSYAaARDADcFJgBoBEMANwVYAFgERAA1AiQAYgHoAD4CJABiAegAPgIkAGIB6AA+AiT/mgHo/3sCJABiBkkAYgPeAEQEJQAPAe//GwTTAD4D2QA2BCAAWAHoAEQEIABYAej/qAQgAFgCfgBEBCAAWALEAEQFWQBYBEQANQVZAFgERAA1BVkAWAREADUERAA1BTsAXgREAEYFOwBeBEQARgU7AF4ERABGBPgAVwKkADUE+ABXAqT/pgT4AFcCpAA1BJgAQwPuADsEmABDA+4AOwSYAEMD7gA7BJgAQwPuADsEmABDA+4AOwR6AOwCaQBFBHoA7AJpAG8EegDsApEAbwUSAGcERABaBRIAZwREAFoFEgBnBEQAWgUSAGcERABaBRIAZwREAFoFEgBnBEQAWgaVAOwFrACyBKYA7gPI/7wEpgDuBH0AIAPIAAgEfQAgA8gACAR9ACADyAAIBwX/ngZSAAQFHQAmBEUATARgAAsEYAALA+4AvQRv/9QEb//UBG//1ARv/9QEb//UBG//1ARv/9QESQBNBAQAPgQEAD4EBAA+BAQAPgHoAD4B6AA+AegAPgHoAD4EygA+BH8ATQR/AE0EfwBNBH8ATQR/AE0EswBYBLMAWASzAFgEswBYBBwAtQRv/9QEb//UBG//1ARJAE0ESQBNBEkATQRJAE0EYAA+BAQAPgQEAD4EBAA+BAQAPgQEAD4EhgBKBIYASgSGAEoEhgBKBKsAPgHoAD4B6AA+AegAPgHo/3MB6AA+A88ACwQcAD4DhAA+A4QAPgOEAD4DhAA+BMoAPgTKAD4EygA+BH8ATQR/AE0EfwBNBGMAPgRjAD4EYwA+BCsAIwQrACMEKwAjBCsAIwPuAJcD7gC9BLMAWASzAFgEswBYBLMAWASzAFgEswBYBaEA1AQcALUEHAC1A/7/+QP+//kD/v/5CFYAIwT+/9UExgCbBbwAvAKIAMYFTwByBQoASQUUADECeQBsBP7/1QTLAFgEYgBYBH0AIAVYAFgCJABiBNMAPgaSAFgFWQBYBTsAXgTNAFgEegDsBKYA7gS9//wCJABiBKYA7gQ/AEAECwApBEQANQJ5AH4EHABaBDEAPgREAEYERP/rA8gAlwPI/+kCeQB+BBwAWgREAEYEHABaBisAXQRiAFgELgBXBJgAQwIkAGICJABiBCUADwTTAD4E0wA+BLcAowT+/9UEywBYBC4AVwRiAFgFWQBYBpIAWAVYAFgFOwBeBVoAWATNAFgEywBiBHoA7AS9//wEIAA6A/kARwRaAEAERABGBET/4gP8AEcDyP+8A8j/6QP5AEcDKAA+A+4AOwHoAEQB6AA+Afb/HQQVAEADyP+8BpUA7AWsALIGlQDsBawAsgaVAOwFrACyBKYA7gPI/7wBVwDGAnUAxQP6AE8EgwCKAe//GwGNALEGkgBYBosANQT+/9UEIAA6BTsAAQbIAIoHHgCKBGIAWAVZAFgD+QBHBFoAQAUvAIoFRABDBL4A6APIALMIDABGCQMAXgR0ACAD0gAeBMsAYgP8AEcEpgDuA8gAswIkAGIG0//KBbz/wwIkAGIE/v/VBCAAOgT+/9UEIAA6BwX/ngZSAAQEYgBYA/kARwUrAEYD+QA8A/kAPAbT/8oFvP/DBHQAIAPSAB4FWQBYBFoAQAVZAFgEWgBABTsAXgREAEYFHQBdBEUARgUdAF0ERQBGBREAhwQLADMEtwCjA8j/vAS3AKMDyP+8BLcAowPI/7wFJwDRBBgAfwaCAFcF2ABABL3//API/+kERABEBU//3gRb/9UE/v/VBCAAOgT+/9UEIAA6BP7/1QQgADoE/v/VBCAAOgT+/9UEIAA6BP7/1QQgADoE/v/VBCAAOgT+/9UEIAA6BP7/1QQgADoE/v/VBCAAOgT+/9UEIAA6BP7/1QQgADoEYgBYA/kARwRiAFgD+QBHBGIAWAP5AEcEYgBYA/kARwRiAFgD+QBHBGIAWAP5AEcEYgBYA/kARwRiAFgD+QBHAiQAYgHoAD4CJAAXAej/+gU7AF4ERABGBTsAXgREAEYFOwBeBEQARgU7AF4ERABGBTsAXgREAEYFOwBeBEQARgU7AF4ERABGBSMAWQROAEYFIwBZBE4ARgUjAFkETgBGBSMAWQROAEYFIwBZBE4ARgUSAGcERABaBRIAZwREAFoFOgBnBK4AWgU6AGcErgBaBToAZwSuAFoFOgBnBK4AWgU6AGcErgBaBKYA7gPI/7wEpgDuA8j/vASmAO4DyP+8BGIARARiABME0wA+BBUAQAVYAFgEWQBABHoA7AOfAJAEvf/8A8j/6QUnANEEGAB/BScA0QQYAH8ELgBXAygAPgbT/8oFvP/DBc8ArgR0ACUERAA1BLkASAS5AEgELgA0AygACgTnAFID7QBKBVkAWARaAEAFWABYBFkAQAaSAFgFkgBABU//3gRb/9UEpgDuA8gAbQS9//wDyP/pBAsAKQRf//wGEgEAAAoAAAAKAAAB/QBPAAAAAQABAQEBAQAMAPgI/wAIAAj//gAJAAn//QAKAAr//QALAAv//QAMAAz//QANAA3//AAOAA7//AAPAA///AAQABD//AARABH/+wASABL/+wATABP/+wAUABT/+wAVABT/+gAWABX/+gAXABb/+gAYABf/+gAZABj/+QAaABn/+QAbABr/+QAcABv/+QAdABz/+AAeAB3/+AAfAB7/+AAgAB//+AAhACD/9wAiACH/9wAjACL/9wAkACP/9wAlACT/9gAmACX/9gAnACb/9gAoACf/9gApACf/9QAqACj/9QArACn/9QAsACr/9QAtACv/9AAuACz/9AAvAC3/9AAwAC7/9AAxAC//8wAyADD/8wAzADH/8wA0ADL/8wA1ADP/8gA2ADT/8gA3ADX/8gA4ADb/8gA5ADf/8QA6ADj/8QA7ADn/8QA8ADr/8QA9ADr/8AA+ADv/8AA/ADz/8ABAAD3/8ABBAD7/7wBCAD//7wBDAED/7wBEAEH/7wBFAEL/7gBGAEP/7gBHAET/7gBIAEX/7gBJAEb/7QBKAEf/7QBLAEj/7QBMAEn/7QBNAEr/7ABOAEv/7ABPAEz/7ABQAE3/7ABRAE3/6wBSAE7/6wBTAE//6wBUAFD/6wBVAFH/6gBWAFL/6gBXAFP/6gBYAFT/6gBZAFX/6QBaAFb/6QBbAFf/6QBcAFj/6QBdAFn/6ABeAFr/6ABfAFv/6ABgAFz/6ABhAF3/5wBiAF7/5wBjAF//5wBkAGD/5wBlAGD/5gBmAGH/5gBnAGL/5gBoAGP/5gBpAGT/5QBqAGX/5QBrAGb/5QBsAGf/5QBtAGj/5ABuAGn/5ABvAGr/5ABwAGv/5ABxAGz/4wByAG3/4wBzAG7/4wB0AG//4wB1AHD/4gB2AHH/4gB3AHL/4gB4AHP/4gB5AHP/4QB6AHT/4QB7AHX/4QB8AHb/4QB9AHf/4AB+AHj/4AB/AHn/4ACAAHr/4ACBAHv/3wCCAHz/3wCDAH3/3wCEAH7/3wCFAH//3gCGAID/3gCHAIH/3gCIAIL/3gCJAIP/3QCKAIT/3QCLAIX/3QCMAIb/3QCNAIb/3ACOAIf/3ACPAIj/3ACQAIn/3ACRAIr/2wCSAIv/2wCTAIz/2wCUAI3/2wCVAI7/2gCWAI//2gCXAJD/2gCYAJH/2gCZAJL/2QCaAJP/2QCbAJT/2QCcAJX/2QCdAJb/2ACeAJf/2ACfAJj/2ACgAJn/2AChAJn/1wCiAJr/1wCjAJv/1wCkAJz/1wClAJ3/1gCmAJ7/1gCnAJ//1gCoAKD/1gCpAKH/1QCqAKL/1QCrAKP/1QCsAKT/1QCtAKX/1ACuAKb/1ACvAKf/1ACwAKj/1ACxAKn/0wCyAKr/0wCzAKv/0wC0AKz/0wC1AKz/0gC2AK3/0gC3AK7/0gC4AK//0gC5ALD/0QC6ALH/0QC7ALL/0QC8ALP/0QC9ALT/0AC+ALX/0AC/ALb/0ADAALf/0ADBALj/zwDCALn/zwDDALr/zwDEALv/zwDFALz/zgDGAL3/zgDHAL7/zgDIAL//zgDJAL//zQDKAMD/zQDLAMH/zQDMAML/zQDNAMP/zADOAMT/zADPAMX/zADQAMb/zADRAMf/ywDSAMj/ywDTAMn/ywDUAMr/ywDVAMv/ygDWAMz/ygDXAM3/ygDYAM7/ygDZAM//yQDaAND/yQDbANH/yQDcANL/yQDdANL/yADeANP/yADfANT/yADgANX/yADhANb/xwDiANf/xwDjANj/xwDkANn/xwDlANr/xgDmANv/xgDnANz/xgDoAN3/xgDpAN7/xQDqAN//xQDrAOD/xQDsAOH/xQDtAOL/xADuAOP/xADvAOT/xADwAOX/xADxAOX/wwDyAOb/wwDzAOf/wwD0AOj/wwD1AOn/wgD2AOr/wgD3AOv/wgD4AOz/wgD5AO3/wQD6AO7/wQD7AO//wQD8APD/wQD9APH/wAD+APL/wAD/APP/wAAAAAMAAAADAAAIjAABAAAAAAAcAAMAAQAAAiYABgIKAAAAAAEAAAEAAAAAAAAAAAAAAAAAAAABAAIAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAADBBwABAAFAAYABwAIAAkACgALAAwADQAOAA8AEAARABIAEwAUABUAFgAXABgAGQAaABsAHAAdAB4AHwAgACEAIgAjACQAJQAmACcAKAApACoAKwAsAC0ALgAvADAAMQAyADMANAA1ADYANwA4ADkAOgA7ADwAPQA+AD8AQABBAEIAQwBEAEUARgBHAEgASQBKAEsATABNAE4ATwBQAFEAUgBTAFQAVQBWAFcAWABZAFoAWwBcAF0AXgBfAGAAAAH1AfYB+AH6AgECBgIKAg0CDAIOAhACDwIRAhMCFQIUAhYCFwIZAhgCGgIbAhwCHgIdAh8CIQIgAiMCIgIkAiUBbABvAGIAYwBnAW4AdQCDAG0AaQF9AHMAaAGLAH8AgQGIAHABjAGNAGUAdAGDAYUBhADBAYkAagB5ALUAhACHAH4AYQBsAYcAkwGKAK0AawB6AXAAAwHxAfQCBQCQAJEBYgFjAWkBagFlAWYAhgGOAicClgF0AXkBcgFzAZIDUAFtAHYBZwFrAXEB8wH7AfIB/AH5Af4B/wIAAf0CAwIEAAACAgIIAgkCBwCKAJoAoABuAJwAnQCeAHcAoQCfAJsABAZmAAAA7ACAAAYAbAAAAAIACQANACEAfgCgAKwArQC/AMYAzwDmAO8A/gEPAREBJQEnATABOAFAAVMBXwFnAX4BfwGSAaEBsAHwAfsB/wIZAhsCNwJZArwCxwLJAt0C8wMBAwMDCQMPAyMDigOMA5IDoQOwA7kDyQPOA9ID1gQlBC8ERQRPBGIEbwR5BIYEzgTXBOEE9QUBBRAFEx4BHj8ehR7xHvMe+R9NIAsgFSAeICIgJiAwIDMgOiA8IEQgdCB/IKQgpyCsIQUhEyEWISIhJiEuIV4iAiIGIg8iEiIaIh4iKyJIImAiZSXK7gL2w/sE/v///f//AAAAAAACAAkADQAgACIAoAChAK0ArgDAAMcA0ADnAPAA/wEQARIBJgEoATEBOQFBAVQBYAFoAX8BkgGgAa8B8AH6AfwCGAIaAjcCWQK8AsYCyQLYAvMDAAMDAwkDDwMjA4QDjAOOA5MDowOxA7oDygPRA9YEAAQmBDAERgRQBGMEcAR6BIgEzwTYBOIE9gUCBREeAB4+HoAeoB7yHvQfTSAAIBMgFyAgICUgMCAyIDkgPCBEIHQgfyCjIKcgqyEFIRMhFiEiISYhLiFbIgIiBiIPIhEiGiIeIisiSCJgImQlyu4B9sP7Af7///z//wABBBgEEv/1AAD/4gAA/8AAAP+/AAABMQAAASwAAAEoAAABJgAAASQAAAEiAAABHAAAAR4AAP8B/vT+5wFhAAAAoQBkAGb+Yf5AAJb91P2l/cT9r/2j/aL9nf2Y/YUAAP9w/28AAAAA/QUAAP9Q/Pn89gAA/LUAAPytAAD8ogAA/JwAAP6eAAD+mwAA/EUAAOVV5RXkxeT45Fnk9uQK4VYAAOFN4UzhSuFB4xvhOeMT4TDhAeD3AADg0QAA4HXgaOBm4Fvfj+BQ4CTfgd6n33XfdN9t32rfXt9C3yvfKNvEE44KzgAAApQBmAABAAAAAAAAAAAA5AAAAOQAAADiAAAA4AAAAOoAAAEUAAABLgAAAS4AAAEuAAABOgAAAVwAAAFoAAAAAAAAAAABYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFEAAAAAAFMAWgAAAGAAAAAAAAAAZgAAAHgAAACCAAAAioAAAI6AAACxAAAAtQAAALoAAAAAAAAAAAAAAAAAAAAAALcAAAAAAAAAAAAAAAAAAAAAAAAAAACzAAAAswAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqYAAAAAAAAAAwQcAeoB6wHxAfIB8wH0AfUB9gB/Ae0CAQICAgMCBAIFAgYAgACBAgcCCAIJAgoCCwCCAIMCDAINAg4CDwIQAhEAhACFAhwCHQIeAh8CIAIhAIYAhwIiAiMCJAIlAiYAiAHsA/AAiQHuAIoCVQJWAlcCWAJZAloAiwCMAI0CYwJkAmUCZgJnAmgCaQCOAI8CagJrAmwCbQJuAm8AkACRAn4CfwKCAoMChAKFAe8B8ACSAfcCEgCpAKoC+ACrAvkC+gL7AKwArQMCAwMDBACuAwUDBgCvAwcDCACwAwkAsQMKALIDCwMMALMDDQC0ALUDDgMPAxADEQMSAxMDFAMVAL8DFwMYAMADFgDBAMIAwwDEAMUAxgDHAxkAyADJA1oDHwDNAyAAzgMhAyIDIwMkAM8A0ADRAyYDWwMnANIDKADTAykDKgDUAysA1QDWANcDLAMlANgDLQMuAy8DMAMxAzIDMwDZANoDNAM1AOUA5gDnAOgDNgDpAOoA6wM3AOwA7QDuAO8DOADwAzkDOgDxAzsA8gM8A1wDPQD9Az4A/gM/A0ADQQNCAP8BAAEBA0MDXQNEAQIBAwEEBAYDXgNfARIBEwEUARUDYANhA2MDYgEjASQECwQMBAUBJQEmAScBKAEpBAcECAEqASsEAAQBA2QDZQPyA/MBLAEtBAkECgEuAS8D9AP1ATABMQEyATMBNAE1A2YDZwP2A/cDaANpBBMEFAP4A/kBNgE3A/oD+wE4ATkBOgQEATsBPAQCBAMDagNrA2wBPQE+BBEEEgE/AUAEDQQOA/wD/QQPBBABQQN3A3YDeAN5A3oDewN8AUIBQwP+A/8DkQOSAUQBRQOTA5QEFQQWAUYDlQQXA5YDlwFiAWMEGQQYAXcD8QF5AZIDUANYA1kABAZmAAAA7ACAAAYAbAAAAAIACQANACEAfgCgAKwArQC/AMYAzwDmAO8A/gEPAREBJQEnATABOAFAAVMBXwFnAX4BfwGSAaEBsAHwAfsB/wIZAhsCNwJZArwCxwLJAt0C8wMBAwMDCQMPAyMDigOMA5IDoQOwA7kDyQPOA9ID1gQlBC8ERQRPBGIEbwR5BIYEzgTXBOEE9QUBBRAFEx4BHj8ehR7xHvMe+R9NIAsgFSAeICIgJiAwIDMgOiA8IEQgdCB/IKQgpyCsIQUhEyEWISIhJiEuIV4iAiIGIg8iEiIaIh4iKyJIImAiZSXK7gL2w/sE/v///f//AAAAAAACAAkADQAgACIAoAChAK0ArgDAAMcA0ADnAPAA/wEQARIBJgEoATEBOQFBAVQBYAFoAX8BkgGgAa8B8AH6AfwCGAIaAjcCWQK8AsYCyQLYAvMDAAMDAwkDDwMjA4QDjAOOA5MDowOxA7oDygPRA9YEAAQmBDAERgRQBGMEcAR6BIgEzwTYBOIE9gUCBREeAB4+HoAeoB7yHvQfTSAAIBMgFyAgICUgMCAyIDkgPCBEIHQgfyCjIKcgqyEFIRMhFiEiISYhLiFbIgIiBiIPIhEiGiIeIisiSCJgImQlyu4B9sP7Af7///z//wABBBgEEv/1AAD/4gAA/8AAAP+/AAABMQAAASwAAAEoAAABJgAAASQAAAEiAAABHAAAAR4AAP8B/vT+5wFhAAAAoQBkAGb+Yf5AAJb91P2l/cT9r/2j/aL9nf2Y/YUAAP9w/28AAAAA/QUAAP9Q/Pn89gAA/LUAAPytAAD8ogAA/JwAAP6eAAD+mwAA/EUAAOVV5RXkxeT45Fnk9uQK4VYAAOFN4UzhSuFB4xvhOeMT4TDhAeD3AADg0QAA4HXgaOBm4Fvfj+BQ4CTfgd6n33XfdN9t32rfXt9C3yvfKNvEE44KzgAAApQBmAABAAAAAAAAAAAA5AAAAOQAAADiAAAA4AAAAOoAAAEUAAABLgAAAS4AAAEuAAABOgAAAVwAAAFoAAAAAAAAAAABYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFEAAAAAAFMAWgAAAGAAAAAAAAAAZgAAAHgAAACCAAAAioAAAI6AAACxAAAAtQAAALoAAAAAAAAAAAAAAAAAAAAAALcAAAAAAAAAAAAAAAAAAAAAAAAAAACzAAAAswAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqYAAAAAAAAAAwQcAeoB6wHxAfIB8wH0AfUB9gB/Ae0CAQICAgMCBAIFAgYAgACBAgcCCAIJAgoCCwCCAIMCDAINAg4CDwIQAhEAhACFAhwCHQIeAh8CIAIhAIYAhwIiAiMCJAIlAiYAiAHsA/AAiQHuAIoCVQJWAlcCWAJZAloAiwCMAI0CYwJkAmUCZgJnAmgCaQCOAI8CagJrAmwCbQJuAm8AkACRAn4CfwKCAoMChAKFAe8B8ACSAfcCEgCpAKoC+ACrAvkC+gL7AKwArQMCAwMDBACuAwUDBgCvAwcDCACwAwkAsQMKALIDCwMMALMDDQC0ALUDDgMPAxADEQMSAxMDFAMVAL8DFwMYAMADFgDBAMIAwwDEAMUAxgDHAxkAyADJA1oDHwDNAyAAzgMhAyIDIwMkAM8A0ADRAyYDWwMnANIDKADTAykDKgDUAysA1QDWANcDLAMlANgDLQMuAy8DMAMxAzIDMwDZANoDNAM1AOUA5gDnAOgDNgDpAOoA6wM3AOwA7QDuAO8DOADwAzkDOgDxAzsA8gM8A1wDPQD9Az4A/gM/A0ADQQNCAP8BAAEBA0MDXQNEAQIBAwEEBAYDXgNfARIBEwEUARUDYANhA2MDYgEjASQECwQMBAUBJQEmAScBKAEpBAcECAEqASsEAAQBA2QDZQPyA/MBLAEtBAkECgEuAS8D9AP1ATABMQEyATMBNAE1A2YDZwP2A/cDaANpBBMEFAP4A/kBNgE3A/oD+wE4ATkBOgQEATsBPAQCBAMDagNrA2wBPQE+BBEEEgE/AUAEDQQOA/wD/QQPBBABQQN3A3YDeAN5A3oDewN8AUIBQwP+A/8DkQOSAUQBRQOTA5QEFQQWAUYDlQQXA5YDlwFiAWMEGQQYAXcD8QF5AZIDUANYA1kAAAACAMUEFAK9BhgABQALAAABAyMTNzMFAyMTNzMBiGpZOhiIAQdrWjwXiQWN/ocBcJSL/ocBd40AAAIAQwAABM8FsAAbAB8AAAEjAyMTIzczEyM3IRMzAzMTMwMzByMDMwcjAyMDMxMjApnvnIuc3Bv1ie8bAQifi5/vn4yfuRvTic8b552MHu6J7gGa/mYBmocBZokBoP5gAaD+YIn+mof+ZgIhAWYAAAABAEf/MAQ+BpsAKwAAATYmJy4BNz4BPwEzBx4BByM2JiMiBgcGFhceAQcOAQ8BIzcuATczBhYzMjYDEQ9fhbacHBvNoiORJJaIILQYWG1rhhERW4+4lRse2LAekR6brSK1G3lvdp4BdmF6NT/Gra3IFNrcGuvJkqJ+bGhzOUS/rLXCEr/AE9TVpnx+AAUA0//rBTAFxQANABsAKQA3ADsAABM+ATMyFg8BDgEjIiY3MwYWMzI2PwE2JiMiBgcBPgEzMhYPAQ4BIyImNzMGFjMyNj8BNiYjIgYHBScBF/wbtIR5fBkPHLODen0ahxE2SUFiEA8QNEhCZA8BZRu1g3l8GQ8cs4N6fRqHETZJQmIQDxA1SEJkD/4BWAN6WASYiqOuf02Koa1+UWNpS01RZWtL/M2Jo65+TouhrX9SY2lMTlFkakv2QQRyQQAAAAMAG//rBIQFxQAgACsAOAAAEz4BNy4BNz4BMzIWBw4BDwETPgE3Mw4BBxcjJw4BIyImBTI2NwEHDgEHBhYTBhYXNz4BNzYmIyIGORSdmDwuDh3Lo5CeFRFycHX8M0IPohZpVYzYQFa7YsbQAa1Di0P+8yljSQkTa5YJHymQPDIKC0pLS2UBhoGuX2aZVLKss4BohUxT/mNCmlqL1lrkaD4/404yMgG4HUl7NXiOA+k4ckVhJ1g4QltxAAAAAQDGBCMBqAYYAAUAAAEDIxM3MwGWd1k8FZEFqP57AXWAAAAAAQBX/ioDHwZqAA8AABMSADcXBgADBwISFwcmAhOZQgF0vxGT/vo4AjtuczaZzEACTwGfAhJqeGz+K/6gDv6R/j14b2cCJAGQAAAAAAH/jP4qAlUGagAPAAABAgAHJzYAEzcSAic3FhIDAhRD/oy9FJEBCTkCOnZrOJfMPwJF/l/98GpvbAHdAWEOAWoBzHRvZ/3Z/nMAAAABAKECYgOgBbAADgAAASU3FxMzAyUXBRMHCwEnAaP+/kv9PJVPASYP/tR/jG/daAPYW5RwAVn+oXCWXP7wXQEh/uZaAAEAcgCSBDUEtgALAAABIQchAyMTITchEzMCwAF1I/6MXLZc/oojAXVWtgMLrP4zAc2sAasAAAAAAf+Y/swBAADaAAkAADcOAQcnPgE/ATPiFn9eVzxGER+2RmvHSEhKkFWXAAABAD4CIQIjArYAAwAAASE3IQIF/jkeAccCIZUAAQBGAAABIwDFAAMAADMjNzP8tie2xQAAAf+m/4MDsQWwAAMAABcjATNBmwNymX0GLQAAAAIAUP/rBGEFxQANABsAAAECACMiAhsBEgAzMhIDJzYmIyIGBwMGFjMyNjcD5T3+7dC/tjhFPAEV0L+0N60pV39zrSZUKll+dKsnAiz+0P7vASoBFwFXAS4BFP7V/uko0bPEwP5b0bXEwgAAAAEBcAAAA14FsAAFAAAhIxMFNyUCO7X5/vEYAdYE3Ah3ZQAAAAEALQAABDMFxQAYAAApATcBPgE3NiYjIgYHIzYkMzIWBw4BBwEhA5r8kxUCEZFsDxNdZYqiF7UhARPcsrkcFaGU/lICk4MCE5GnW3aQnI/L9uKzf+CT/lcAAAAAAQA1/+sEKAXFACoAAAE/ATMyNjc2JiMiBgcjNiQzMhYHDgEHHgEHBgQjIiY3MwYWMzI2NzYmKwEBmQsHn3h/ExVddWqZErUcAQbAucAgEYBwc0wSIv7xw7fUH7YUandznRYXXoSfAsNGJ4Z2hX6Jc7Te1chirS8ttnLT19e/fIWJiJF6AAAAAAIAJwAABBwFsAAKAA8AAAEzByMDIxMhNwEzASETJwcDWrweu0S0RP2eFQMhv/zrAZ+MAyAB6JX+rQFTawPy/DgCvAE6AAAAAAEAaP/rBD4FsAAfAAAbASEHIQMXPgE3NhIHDgEjIiY3MwYWMzI2NzYmIyIGB8vOAqUb/fRuAy1vR7+pJSb716nJIasVaGpyoBoYY3ZqcCMCkQMfqf5gASItAgL+++To/cnLgH+xnZetSEoAAAIAZ//rBBkFxQAaACcAAAEyFhcHLgEjIgYPAT4BMzISBwYAIyICGwESABMiBg8BBhYzMjY3NiYDHkWFKD4pXkWO3SAERaFbsq8hJv71xcPYLi4uAVA4XpExEiN5fG+hGRlmBcUiG5EaHvjLGDc7/vTS7v7xATIBGwEfASYBSP1zVEl118/Ompy0AAAAAQDYAAAEhAWwAAwAAAEAAgMHIzcSABMhNyEEbP7T9WAntidgATPy/R8YA5QFGv7F/iH+mZmZAWICGAEHlgAAAAMANf/rBFgFxQAXACMALwAAAQ4BBx4BBwYEIyImNz4BNy4BNz4BMzIWATYmIyIGBwYWMzI2EzYmIyIGBwYWMzI2BDIalXBraBct/u/Mv9EpGqyEXVYXKvu9q7/+whpxdW61GBtvfG2xexdfZF+ZFxleaFyaBDV+pigvt3rbw9TKiLYpLadx0b/Q/JiEkZt6iIWQAyF3h4tze36IAAIAf//rBDcFxQAbACgAACUyNj8BJw4BIyICNzYAMzISCwECACMiJic3HgETMjY/ATYmIyIGBwYWAa6ExiQFAzaSV8G/JiYBHbTQyyw5MP7R3EePNzM1cLVlmCwYIGaIZLEaG2OA2NghAUVDAQbu8QEW/uf+6v6c/tX+5BwfkB0ZAd9jTpjNus6jp7j//wBGAAAB1AQ6ACYAEAAAAAcAEACxA3X////G/swB1QQ6ACcAEACyA3UABgAOLgAAAQBlAMUDxQRJAAoAAAEPARcFBwE/AQEHAWVPAUgB2yf9VBcGA0MmApsVAxTpwQF7ch0BesEAAAACAI4BkAQIA80AAwAHAAABITchAyE3IQPo/PkgAwdz/PkgAwcDL579w54AAAEAVgDGA9oESgALAAATNwEPAgE3JTc1J+QmAtAGEQb8mSUCX1JJA4+7/oYdVR3+hbzyFQMWAAAAAgDCAAAD5gXFABkAHQAAAT4BNz4BNzYmIyIGByM+ATMyFgcOAQcOAQcDIzczAU0eQHN7XxMXT2ZSjxO3JPyrrqskHJySPSYSTL4pvgGZk2lef3VddmtnYqnAybONu4A2VF7+Z8sAAAACABP+OwbGBZYAMwBDAAABBgAjIiYnDgEjIiY3EgAzMhYXBzMDBhYzMjY3EgIhIAADAhIhMjY3Fw4BIyAAExIAISAAAQYWMzI2Nz4BNxMuASMiBgZgNf760kFTBkGTW3BVOEsBDpxcdTgEBaMgKDBsvixd0P7B/u7+OFhe3QEqT7NCD0rGXf6v/tJnaAINAWEBUAEm+9koHkc6cDgCBgSXFzEecKwB99v+z1VOVE/xxAEIATM2NAT9uHNS5rEBhwGj/jH+jP6A/lArI2grLgHzAbABsAII/g39/ZKVNEQMGQ8CHQwO3QAAAv/VAAAEfwWwAAcACwAAASEDIwEzEyMBIQMnA5H9ztK4Ay+b4Ln96gHNXAMBhP58BbD6UAIZAqABAAAAAwBYAAAE0AWwAA8AGAAhAAAzASEyFgcOAQcVHgEHBgQjCwEhMjY3NiYjJSEyNjc2JiMhWAEjAbjL0icWjGV0YRss/vLXtWsBPnitGRtWff7FASljnRcab4r+/QWwxMVqlCIDG8eI2cECrf3oh3yMiZV6b4JtAAAAAQBi/+sE+AXFABsAAAEGBCMiABsBEgAzMhIHIzYmIyICBwMGEjMyNjcEdUP+89/f/vs2MzsBNezZ+Be3C4qZkNooMyyYoouhNwG/4PQBagELAQEBKAE8/vLgo7X+/8v+/dj++JinAAACAFgAAAUdBbAACQATAAAzASEgAAMHAgAhCwEhMhI/ATYCI1gBIwF6AQABKDcnPv6s/u8K5wEPsfMrKCy/xwWw/pT+7cX+zf7HBRr7ewEB1sjeAQgAAAAAAQBYAAAE8gWwAAsAAAEhAyEHIQEhByEDIQQC/ZJpAswe/H8BIwN3Hv0+YAJuAqb975UFsJb+IgABAFgAAAT5BbAACQAAASEDIwEhByEDIQP5/ZWBtQEjA34e/TdmAmsCiP14BbCW/gQAAAAAAQBo/+sFDwXFAB8AACUGBCMiABsBEgAzMhYHIzYmIyIGBwMGFjMyNjcTITchBFtA/vvC6P78NTs5AV3z2NYLtQJ0mpT6Jjwrn6ttqidD/tUeAeC/UYMBTwEKASkBIAE48smInf3D/tXV70QqAVCVAAEAWAAABXkFsAALAAAhIxMhAyMBMwMhEzMEVrWB/WyBtQEjtYQClIS1Aob9egWw/WsClQABAGIAAAI6BbAAAwAAISMBMwEXtQEjtQWwAAAAAQAP/+sEUgWwAA8AAAEzAwYEIyImNzMGFjMyNjcDnbXSK/74vrvFKrUeYnthoxoFsPvk1NXW0JZ7ln4AAQA+AAAFNQWwAAwAAAEjAyMBMwMzATMJASMCAomEtwEjt3+TAiPm/WsBhM8Clf1rBbD9hAJ8/Sj9KAAAAQBYAAADrQWwAAUAACUhByEBMwErAoIe/MkBI7WVlQWwAAAAAQBYAAAGswWwABEAAAETMwEzASMbAScBIwMjCwEjAQJkwgMCouj+3bV1iQP9WnnOA2R1tQEjBbD7UwSt+lACRwJUAftkBJj9r/25BbAAAAABAFgAAAV6BbAACwAAISMBIwMjATMBMxMzBFe2/lID47UBI7UBrgPjtgRw+5AFsPuRBG8AAgBe/+sFNgXFAA0AGwAAAQIAIyIAGwESADMyAAMnNiYjIgYHAwYWMzI2NwTOPP6y/eX+/DYzOwFE9OwBEDW0K6qzl98pMy2gqqHoKgJO/tr+wwFrAQoBAQEmAT7+k/73Atr++M7+/dz+99EAAgBYAAAFGAWwAAoAEwAAAQMjASEyFgcGBCMlITI2NzYmIyEBgnW1ASMCBM7LJyv+7OH+zwFPg7EZGmaP/rECSv22BbDww9bdlaN5hZoAAAACAF7/DAU2BcUAEwAhAAABDgEHFwcnDgEjIgAbARIAMzIAAyc2JiMiBgcDBhYzMjY3BM4kl3Kqk8MrVS7l/vw2MzsBRPTsARA1tCuqs5ffKTMtoKqh6CoCTrH9TtNz9gsMAWsBCgEBASYBPv6T/vcC2v74zv793P730QAAAgBXAAAFAgWvABoAIwAAAQMjASEyFgcOAQceAQ8BBhYXByMmNj8BNiYjJSEyNjc2JiMhAYt+tgEjAerUyikZkHlmRhkbDwccBbseBQ8bGWBx/s0BI5OrGxtnk/7MAnr9hgWv08p8oC8prn2JSWYjGCN+S4WCh5WDgod/AAEAQ//rBMAFxQAlAAABNiYnLgE3NiQzMhYHIzYmIyIGBwYWFx4BBwYEIyIkNzMGFjMyNgN+GHCz1rEoIwEFw9jpKrYciZJpnREaZrvbsCcl/vXM2f7jMLUjuJpqqwFMd4RCSMvGsbLs1ouhdFd/d0dPx8O4q9brq4FyAAABAOwAAAULBbAABwAAASEBIwEhNyEE7f5a/vu1AQX+Wh4EAQUa+uYFGpYAAAEAZ//rBVcFsAARAAABAwIEIyImNxMzAwYWMzI2NxMFV8U0/r7y1u0wxbbFJYqWkeIixQWw/CX+/ef87gPb/CW2n62oA9sAAAEAzQAABVcFsAAJAAABHwE3ATMBIwEzAkAMAzMCEcT9IJ3+88QBXnIBcwRS+lAFsAAAAAABAOwAAAbsBbAAFQAAAQczNwEzEx8BNwEzASMDJyMHASMDMwHDBANGAZOhYQgDOwFUtf3homkEAy/+TqJMtQHvv78Dwfw/wAHBA8H6UAP9iYn8AwWwAAAAAf/8AAAFHQWwAAsAAAkBMwkBIwMBIwkBMwKnAZvb/d4BQtfr/l3cAi3+xtkDcwI9/S79IgJI/bgC3gLSAAAAAAEA7gAABVMFsAAIAAAJATMBAyMTATMCjQH3z/1oZ7Rp/uXQAs0C4/xU/fwCDwOhAAEAIAAABFsFsAAJAAA3IQchNwEhNyEH+QK0HvyRCQNE/ZAeA0AblZWNBI2WiAAAAAEAEv7IArQGgAAHAAABIwEzByEBIQKcr/70rxj+mgE8AWYF6vl0lge4AAAAAQD3/4MCnAWwAAMAABMzEyP3rPmsBbD50wAAAAH/l/7IAjkGgAAHAAATIQEhNzMBI9MBZv7E/poYsQEMsQaA+EiWBowAAAAAAQB8AtkDIgWwAAkAAAEjATMTIwMnIwcBJKgBp3uEp0YCAx8C2QLX/SkBqkxMAAAAAf+W/2sDDQAAAAMAAAUhNyEC7/ynHgNZlZUAAAEA8wS7AkgFxQADAAABIwMzAkiTwtsEuwEKAAACADr/7AP3BE4AIAArAAAhNDY3Jw4BIyImNzYkOwE3NiYjIgYHIzYkMzIWBwMOARclMjY/ASMiBgcGFgKgBAUDQq5dlokeIgEB0L4WFVdnWI4OtRsBALaktSJoDQkE/jlXrS8ow2ukEBFBMz4fAUhdrJaoom5paWRGhbu7r/32PWY3i2BEyXtTUE8AAAIANf/rBCcGGAASACAAAAEOASMiJicHIwEzAxc+ATMyEgMjNiYjIgYHAx4BMzI2NwPvM+i+WY0rM50BOLZ0AziOV7GnM7UnXIdPfTJgGW9ae5chAeL/+GBWoQYY/b0BPD7+rP79yvNeUf4gS1W3pgABAEf/7AP7BE4AGwAAJTI2NzMGBCMiAj8BNgAzMhYHIzYmIyIGDwEGFgHxWqAPrBn+8qbXuyUHJwER4a7BGqwQameNpBoHHFWBeFyazwEy6ir1ASfeqmyG4qQqsdYAAAACAET/6wSVBhgAEgAgAAATGgEzMhYXEzMBIzcnDgEjIgI3MwYWMzI2NxMuASMiBgd3OO7BV4greLX+yJ0JAzyQWLCuL7YkYYlMdTNlG2tUfJ8mAh4BHAEUSEQCVvnoaAI/QAE06rPRU08B+kRP2b0AAgBH/+wD6wROABUAHQAABSICPwE2ADMyEg8BIQYWMzI2NxcOAQMiBgchNzYmAePOzicHJwEptMerIxP9bBhrh1qXPDNAuQFaoCkB2gQTWRQBKvEt9QEl/vvdea3FOTJ7OksDzKqGGn2ZAAAAAQCKAAADhwYtABcAADMTIzczNz4BMzIWFwcuASMiBg8BMwcjA4q8nRydHCXFnB5AJTMQLRtNaBMc0hzSvAOtjYu7rQsKkQUGamOLjfxTAAACADf+SwQ9BE4AHgAsAAATGgEzMhYXNzMDBgQjIiYnNx4BMzI2PwEnDgEjIgI3MwYWMzI2NxMuASMiBgd6OPHCXIwrLJnVLv752kWkOUwsg0V+oRwPAziKU7GxL7UkZYlNdjNkG2tVfaMlAh4BHAEUUEyI+9Tk3ysklB8kmItNATg5ATXpstJUUAH2RVDavAABADUAAAQZBhgAFAAAARc+ATMyFgcDIxM2JiMiBgcDIwEzAaoDQKRem48rh7WIHk9vSY85nrYBOLYDuwJITdDZ/VsCp5Z3VEj86AYYAAAAAAIARAAAAjEGGAADAAcAADMjEzMTIzcz+bXYtTi1KLUEOgEYxgAAAAAC/x3+SwI5BhgADwATAAABAw4BIyImJzceATMyNjcbASM3MwHe6iW5lRswGSsNMQ48WhXq6bYntgQ6+222pgkJlgUIW2YEkwEcwgAAAQA2AAAEKAYYAAwAAAEjAyMBMwMzATMJASMByHhktgE4trZ2AW7W/kMBFtYB9v4KBhj8dQGt/hP9swAAAQBEAAACMQYYAAMAADMjATP5tQE4tQYYAAAAAAEANQAABlsETgAkAAABFz4BMzIWFz4BMzIWBwMjEzYmIw4BBxUDIxM2JiMiBgcDIxMzAaECQKVmXn0UQq9vk4stgraCI0hqY5AgiraDIUtpUn4unbbYowOyAUxRYmNeZ+Dk/XYCi7F4AZFuA/1PAo2ngFNL/OoEOgAAAAABADUAAAQYBE4AFAAAARc+ATMyFgcDIxM2JiMiBgcDIxMzAZ8CQaZkm5EqibaIIE5xTI04nLbYowOoAVJVzNf9VQKnn25ZTfzyBDoAAgBG/+wEHAROAA0AGwAAEzYAMzISDwEGACMiAjczBhYzMjY/ATYmIyIGB3EpARrWzcUmBCn+5tbNxie2HmOJga4cBB1jiIGvGwIo/gEo/szyGP/+2wEx87fY4a4YtdvkrAAAAAL/4v5gBCYETgASACAAAAEOASMiJicDIwEzBxc+ATMyEgMjNiYjIgYHAx4BMzI2NwPuM+i+W4starYBK5wIAzuUWrKnNLYoYolJdjBqG2tWfJ8hAeH/90RD/e4F2m4BQEP+rP78yfVSSP3xQ0i8pQACAET+YAQrBE4AEgAgAAATGgEzMhYXNzMBIxMnDgEjIgI3MwYWMzI2NxMuASMiBgd3OO7BWYcsJZz+1bVjAzeETrCuL7YkYIlGbzJtHGhQfJ8mAh4BHAEURUR1+iYB8gI0NQE06rTVTUcCIj1F3L4AAQA1AAADDQROABAAAAEnIgYHAyMTMwcXPgEzMhYXAtJnR3QsmbbYow0DOYxVFC4LA5MGUEr9AQQ6jgFPVAcEAAEAO//sA8kETgAlAAABNiYnLgE3PgEzMhYHIzYmIyIGBwYWFx4BBw4BIyImNzMGFjMyNgK8C01/s58VFuesrLYXtQ1cX19yCgxGgLueFBnttbzBGLUMd11hfwEeRlIgLI+Bi7HBkE1uXkJFRx8tlIGXqNCQbF9WAAEAb//sAqQFQQAXAAABAzMHIwMGFjMyNjcHDgEjIiY3EyM3MxMCGjW/HL+EEiQrFDMTAhxdLGNjIISNHI01BUH++Y39alY5CAWDERWPnAKWjQEHAAEAWv/sBDsEOgAUAAAhNycOASMiJjcTMwMGFjMyNjcTMwMCwRICP6RknZMwf7Z/JkNpX5Mzm7XYkQFSVOHwAn39gb53W1MDBvvGAAABAJcAAAQKBDoACQAAARczNwEzASMDMwHFBQMgAWS5/eCJyrkBOlNTAwD7xgQ6AAABALIAAAX6BDoAFQAAAQcXNwEzExUzNwEzASMDLwEHASMDMwGEBQM4AVOSPwM8ASm0/gSSPgYDT/67k0y1AYaKAYsCtP1Mm5sCtPvGApu7Abz9ZQQ6AAAAAf/pAAAD8QQ6AAsAAAkBMwETIwMBIwEDMwIGARjT/mT40J7+3dMBqfLRAqcBk/3p/d0Bnv5iAiMCFwAAAf+8/ksEKgQ6ABUAAAEfAQEzAQ4BIyImJzcmFjMyNj8BAzMBtwcDAZ7L/V8/qXsVQhMxJGkLOEw+RaTLAYaFAQM6+x9vnwsFlQMIT2d1BCQAAAAAAQAIAAAD3wQ6AAkAADchByE3ASE3IQf7Akoe/OEbAsP94h4C+RmVlYUDHpeBAAAAAQBR/pADHAY9AB8AAAEuAT8BNiYjPwEyNj8BPgE3Fw4BDwEOAQceAQ8BBhYXAc+wcB0hEkhmEwRhdBMhHLnEEm5yFSETZlpJNxAhFzhj/pA4667Pd3h4F3xy0LTkOXEls4jQcJ4rL51nz4ytJgAAAAEANv7yAdwFsAADAAATIwEzyJIBFJL+8ga+AAAB/6n+kAJ2Bj0AHwAABz4BPwE+ATcuAT8BNiYnNx4BDwEGFjMPASIGDwEOAQdXbnIXIRJsYVE9EiEWOWI4r28cIRNJZxIFYnUSIR64wv4lsojPcpwqK51s0IyvJXE46q/QeHZwH35xz7TlOAABAIIBkwTMAyEAGQAAAQ4BIyImJy4BIyIGByc+ATMyFhceATMyNjcEzBe8fVF+Ry9QMD5rDIAXuX5Qg0MvUDE8bg0C5JDBQkoyMGtOEo+4RkY0LnNQAAAAAv/r/ooBxAQ6AAMABwAAEyMTMxMjNzOhtsS2N7Yotv6KA9IBEswAAAEAV/8LBAAFJgAhAAAlMjY3Mw4BDwEjNyYCPwE2Ej8BMwceAQcjNiYjIgYPAQYWAftaoA+sF+OWLbYwmX0fByPpwC22LoCCFawQameNpBoHHFWBeFyLxhTl8SsBHMUq3QEeG97lI8uNbIbipCqx1gABAC0AAAR/BcUAIQAAAQcOAQchByE3Mz4BPwEjNzMTPgEzMhYHIzYmIyIGBwMhBwG7GRU8JwKsH/x2HgkwUxYZmR2ULSz1tbGtI7caW2FYjhsuAYUdAmqYY6A6lZUNxWuYlQER3djTsIRpl4j+75UAAgAm/+UFjATxACMALwAAJQ4BIyImJwcnNy4BNz4BNyc3Fz4BMzIWFzcXBx4BBw4BBxcHAQYWMzIANzYmIyIAA8dWt2NbmT2bZaQiERUVWEJommVSsF5Vlj6rZrEkExQWUjtkm/0vK6qnlwEeJymppZn+4Wc+PUNCi4WTT7BjbrtPkoaONzlAO5qHoFC0ZmuyTIyGAnvQ+wEMv876/vUAAAEAcQAABS4FsAAWAAAJATMBIQchByEHIQMjEyE3ITchNyEDMwKLAdPQ/egBJRj+myIBZRj+m0G1Qf6iGAFeIv6iGAEk+NADGwKV/S94q3b+ugFGdqt4AtEAAAAAAgAB/vICEAWwAAMABwAAGwEzAxMjEzMBnraewraXtv7yAxb86gPIAvYAAAAC/8j+EQTBBcUAMQBDAAABDgEHHgEHBgQjIiY/AQYWMzI2NzYmJy4BNz4BNy4BNzYkMzIWByM2JiMiBgcGFhceASUuAScOAQcGFhceARc+ATc2JgQxFnFbOCYUJv7u2sf4LbchlIZ5sRMTabrWqiQUcFs3IxQkARbZz9AptRpyh4GqEhdiwtmn/hgpRR9IXQ0XY8AoQx5JYg8TawGvZ4gmM4VjurTN4gKge3ldZVxBQbO0Y4koM4dis7vhzoKXelxtWj1Fr1QLGA4UY0ZvXD8OFwwVY0ZkYgACAScE7APFBbAAAwAHAAABIzczBSM3MwOmyh/K/i3LH8sE7MTExAAAAwBS/+sF4AXEABsAJwAzAAABDgEjIiY/AT4BMzIWByM2JiMiBg8BBhYzMjY3JQIAMzIAExIAIyIAAxIAISAAAwIAISAABC4at5eSkB0THcuZj44YjhBEV1Z5EhMVR1tTYxD9VS4BAuzfAYArLP7/6+H+gZk1AboBHQEMAUIyNv5F/ub+8f6+AlSkltOwd7fMnptnU490eH6HWGSF/uX+ogFsAQ0BGQFc/pb+9QFOAZ3+U/7C/rH+YQGvAAACAMICtAN+BcUAIAArAAABJjQ3Jw4BIyImNz4BOwE3NiYjIgYHJz4BMzIWBwMOARclMjY/ASMiBgcGFgJ3AwMDKXFJaWYWF62cgQsOJzk8UwqbFrKHd3obPwsFBP67LXEbF4BDXwkKKwLCFi4WAS47e2l2bzVHQTg0Dm57job+xjVSLnk7JXNDLzMu//8AcAB3A5MDkQAmAXLw3QAHAXIBJv/dAAEApgF4A84DHwAHAAABBwMjEyE3IQO/ETW2Nf2uIAMIAtVV/vgBCJ8AAAAABABS/+sF4AXEAAsAFwAyADsAABMSACEgAAMCACEgABMCADMyABMSACMiAAEDIxMhMhYHDgEHHgEPAQ4BFwcjJjY/ATYmIyczPgE3NiYrAYY1AboBHAENAUIyNv5F/uX+8v6+oy4BAezgAX8rLP7/6+H+ggFpNoqIAQSLjRMLTEM6KAwJBwMGAo0GCQcIDTJKgI0+XQoMPV56AtkBTgGd/lP+wv6x/mEBrwE//uX+ogFsAQ0BGQFc/pb+rP6sA1KBf0JbIBxoSjgrPxUQFlIoNk5AfgE/O084AAAAAAEBAwUjA7gFsAADAAABITchA6H9YhcCngUjjQACAQUDwQMIBcUACwAXAAABPgEzMhYHDgEjIiY3BhYzMjY3NiYjIgYBGhemZlxvFRihZF5zjgw1My5TDAwyMi9XBMFzkZpqdYuVaz1FSjg9SE0AAAACAE4ACQP4BPMACwAPAAABIQchAyMTITchEzMTITchAqkBTxj+sUKjQv6eGAFiQ6Nq/PgeAwgDVpb+YQGflgGd+xaVAAEApwKbA1EFxwAZAAABITcBPgE3NiYjIgYHIz4BMzIWBw4BDwEXIQLM/dsZAU1ONwkLJzk8VQqdFrOIeHoXEl6LsAEBVQKbfgEIPkosNzxCNHCFf3RXYnCPAwAAAQCqAo8DYwXGACkAAAEzMjY3NiYjIgYHIz4BMzIWBw4BBx4BBw4BIyImNzMGFjMyNjc2JisBNwGjeztKCwo2QzFPCJ8VsHuAixYNUUA7NAwZuI1ymBefCjk+QF0KDTZGexEEbzs1MTczKWxvd248WhgaXEN5cnV0NDc8MkU1VQABAPsEvAKsBcYAAwAAATMBIwHR2/7XiAXG/vYAAf/r/mAEMwQ6ABcAAAEDNwYWMzI2NxMzAyM3Jw4BIyImJwMjAQHLfQEqSmVagS+fttijCwI0f1FBXiBetQErBDr9jwLRek9OAx37xmEBPDsjKP4qBdoAAAEAhwAAA9wFsAAKAAAhEyMiAjc2JDMhAQIDaE7PxyosARrhAQT+3QIIAQTQ4PT6UAAAAAABAMMCcAGkA0EAAwAAASM3MwF6tyq3AnDRAAAAAf/O/k0BIwAAAA8AADMHHgEHDgEjNzI2NzYmJze/Fzw/EBWjjQ5AXwsKOFQ5NQtQUmdqajIyNSMHhgAAAQEEApkCRgXFAAUAAAEjEwc3JQGkoIR3GgEbApkClAGCFwAAAgDPArMDowXFAA0AGwAAAT4BMzIWDwEOASMiJjczBhYzMjY/ATYmIyIGBwEEIMyXjJAdFyDLmIyRHp8UPFNKbRIXEjtSS20RBHagr7uUdaKsupRhZW1ZdV1nb1UAAAD//wA1AJkDYQO0ACYBcxQAAAcBcwFUAAD//wEOAAAFYAXEACcByQDXApgAJwF0AQUACAAHAZcCiQAAAAD//wEbAAAFvQXEACcBdAESAAgAJwHJANcCmAAHAcoC8QAAAAD//wC6AAAGEQXHACcBdAGyAAgAJwGXAzoAAAAHAcsAlQKbAAAAAv/z/nYDFgQ7ABkAHQAAAQ4BBw4BBwYWMzI2NzMOASMiJjc+ATc+ATcTMwcjAo0gQHJ8XxIYUGZRkBS1JPyqr6okHJySPSYTTL4pvgKhlGpcgHVbdmtnYqnAybOLvIA1VF8BmswAAAAC/54AAAd1BbAADwATAAApARMhASMBIQchAyEHIQMhARMnAQaL/MI5/fr+/N4EVgOBHv19TAIkHf3hVgKP/Ph0A/3tAWL+ngWwlv4mlf3qAXkC0AH9LwAAAQBIAOIEFwR2AAsAABMBAzcTARcBEwcDAUgBde+N7QFzXP6K8I3u/o0BXAFQAVB6/rMBTXr+sP6wegFN/rMAAAMAJv+jBWsF7AAZACQALwAAAQIAIyImJwcjNy4BNxMSADMyFhc3MwceAQcBBhYXAS4BIyICByE2JicBHgEzMgA3BNA6/pL9TYA1eYq3PigbMzkBZPRUjzttiq05JBj8RBMFFgK/J2pGmP0nAtQPAxL9RSNdPKEBBykCV/7j/rEsLaH0WOOFAQEBHAFRNjOQ5lfaff7/WpM8A6YqK/71xFCHOvxfIyEBCscAAAACAEgAAAR6BbAADAAVAAABAzMyFgcGBCsBAyMBEwMzMjY3NiYjAiE7+83MJCn+6t/7P7YBI11u/IGxFxlmjgWw/trtu83b/sYFsP5F/dqgcX2YAAABADD/7AQrBg8AJwAAMyMTPgEzMhYHDgEHBgAHDgEjIiYnNx4BMzI2NzYANz4BNzYmIyIGB+W12DD/s46gIRqhCxMBDRwl2a1IoR9IIm47YXYRE/7zHhKtEBRIQV6bHwQ68OWrpYPOOl7+8Iy0misdmR0vYFBhARKSXNJMZmSmmgAAAAADAAT/6wZgBE4ALAA3AD8AAAUiJicOASMiJjc+ATsBNzYmIyIGByc+ATMyFhc+ATMyEg8BIQYWMzI2NxcOASUyNj8BIyIGBwYWASIGByE3NiYEQXirL0XjmpeSHyLt1dYRF0VfXY0QsB7xuWOQI0uyZL6sLRf9ZSBnl1uUSyM6u/yoRK01LNRrmhARSQPIZKYsAeEGGk8VZF5Tb6+VrKBVdnJwUBKaqk9NTU/+/eN1s8A7MIUuTZVYOt90UlNYAzitix+GkwAAAAIAJv/rBKsF7QAgAC4AAAEWEg8BAgAjIgI3NgAzMhYXNzYmJwUnJS4BJzceARc3FwEuASMiBgcGFjMyNj8BA8hLKCkTNf7E0cHWKjEBLs9MgCsDBSst/tw0AQgfQiZWQm4v9TP+vBSCcXXHHh1vh3fRIxQFCHv+us9h/vb+3gEYzvkBB0U6AXKpQKBjkRglEJ4XRTCGY/0rPU/Tl5DB57BjAAAAAwBqALcELgSvAAMABwALAAABITchJSM3MwMjNzMECvxgJAOg/ri2KLbLtie2Alq02sf8CMcAAAADAEz/eQQ4BLkAGQAkAC8AABM2ADMyFhc3MwceAQ8BBgAjIiYnByM3LgE3MwYWFwEuASMiBgchNiYnAR4BMzI2N3EpARrWPGQrbHeZPy0VBCn+5tYzVydmdo1MOBi2DwseAb0bQyqBrxsCGQwGEv5OFzUjga4cAij+ASgdHKTnTdmEGP/+2xQUm9ZL5pBfljUCpBYY5KxPhDX9bA4N4a4AAv/r/mAELwYYABUAIwAAAQ4BIyImJwMjEzcbATMDFz4BMzISAyM2JiMiBgcDHgEzMjY3A/cz6L5biy1qtlMQyGC1cwM6jFWypzS2KGKJSXYwaRpqV3yfIQHh//dEQv3vAaBTA+cB3v3EATg7/qz+/Mn1UUj98EJJvKUAAAIAVQAABcMFsAATABcAAAEzByMDIxMhAyMTIzczEzMDIRMzASE3IQU8hxyHzbWB/WyBtcyHHIc7tToCkzu1/DMClC39bQSNjfwAAob9egQAjQEj/t0BI/1r5QAAAQA+AAABzQQ6AAMAADMjEzP1t9i3BDoAAQA+AAAEYAQ6AAwAAAEjAyMTMwMzATMJASMBrl5ctti2XFABxdv97wFY5AHP/jEEOv41Acv9+P3OAAAAAQBJAAADngWwAA0AAAElBwUDIQchEwc/ARMzAaYBDB/+82oCgh78yXx8IHyHtQNJVp9W/euVAmwnnycCpQAAAAEARwAAAlMGGAALAAABNw8BAyMTBz8BEzMBu5ggmI61f5AgkJm1A2g6oDr9OAJ+N6A3AvoAAAAAAQBG/ksFaQWwABgAAAkBDgEjIiYnNx4BMzI2PwEBIwMjATMBMxMFaf7LJbuVHC8aKgw9EDZYExL+TwPgtgEjtgGwA+EFsPn3tacJCZEFCGldWQRj+50FsPudBGMAAAAAAQA1/ksEEAROACAAAAEXPgEzMhYHAw4BIyImJzceATMyNjcTNiYjIgYHAyMTMwGgAkCiYZuQK5olupQcMhktDDwSN1QTmSBOck6CM6G22KMDsQFOUM3Y/P61pwkJmgUHYFwC/qBvSUP82AQ6AAAAAAIAT//rB4MFxQAXACUAACkBDgEjIgIbARIAMzIWFyEHIQMhByEDIQUyNjcTLgEjIgYHAwYWBmr8vVl5P97pNT05AVPyPYhGAzke/T5gAm4e/ZJpAsz7rDBqOOk0ZDWX6is9L4UKCwFLAQoBMAEgATUMCZb+Ipb97xUICQSOCAnn1/7O69UAAAADAET/6wbVBE4AIQAvADcAABMSADMyFhc+ATMyEg8BIQYWMzI2NxcOASMiJicOASMiAjczBhYzMjY/ATYmIyIGBwEiBgchNzYmeTQBI9dyoytQy2zBpisY/WsgZIdYnTwwQr2AdKUsTs9/x74xtSZZin28IwQlWYp9vCIEIlipLgHZBRlSAigBBQEhbmRmbP7523mwwzoyeztLamNmZwE08bvV5KwYudfmqgGQq4UagJYAAAABAEQAAANBBi0ADwAAMxM+ATMyFhcHLgEjIgYHA0T0JsSdHUEkMhMmGE5wE/QExbutDAmMBQZvY/s7AAAB/2b+SwNHBi0AIwAAASMDDgEjIiYnNx4BMzI2NxMjNzM3PgEzMhYXBy4BIyIGDwEzAoy2pR23kxwvGSQMPBA3URClnhaeFh3Amx8/Ji4QLhpQXxAWtgOt+/qxqwkJkQUIaV0EBo2LtrILCpEFBmlkiwAAAAIAWf/rBiUGNgAXACUAAAECACMiAhsBEgAzMhYXPgE3Mw4BBx4BByc2JiMiAgcDBhYzMgA3BMw6/pL94O41MzkBZPRpqT1XcRmjI5uAHgwStCqTr5j9JzQsiaahAQcpAlf+4/6xAWYBBgEBARwBUVJLCYl8r7wdTKtfAtb5/vXE/v3Y+QEKxwACAEb/7AUJBLAAFwAlAAATNgAzMhYXMjY3Mw4BBx4BDwEGACMiAjczBhYzMjY/ATYmIyIGB3EpARrWX5EyWVoZkSKFfhYJDQQp/ubWzcYnth5jiYGuHAQdY4iBrxsCKP4BKEhEd3ekpRNCllQY//7bATHzt9jhrhi12+SsAAAAAAEAZ//rBqUGDQAZAAABBz4BNzMOAQcDAgQjIiY3EzMDBhYzMjY3EwVXKFVkGqMqvKyBNP6+8tbtMMW2xSWKlpHiIsUFsMoakXzRzhT9e/795/zuA9v8JbafragD2wAAAAEAWv/sBVcEkQAcAAABDgEHAyM3Jw4BIyImNxMzAwYWMzI2NxMzBz4BNwVXJI2cp6ISAj+kZJ2TMH+2fyZDaV+TM5u1HFVLFwSRsJEI/LiRAVJU4fACff2BvndbUwMGigpmcQAB/xv+SwHcBDoADwAAAQMOASMiJic3HgEzMjY3EwHc6iW5lRowGioNPA83VhPqBDr7bbamCQmRBQhpXQSTAAAAAgA8/+wD9gRPABUAHQAAATISDwEGACciAj8BITYmIyIGByc+AQMyNjchBwYWAmnGxy8JM/7OtcKmLBkClR1jhVqdPC5BvSZXqi/+JwUaUgRP/tLuLf3+4wEBBtt5r8Q8MXw6TPwzqYYZgZUAAQFIBOQDhwXpAAgAAAEHIycHIzclMwOHBZRrppUFARZuBPwYlpYZ7AAAAAABAV4E5AOpBekACAAAATczBwUjJzczAmamnQT+4G26BJkFU5YS8/EUAAAAAAEBCwSlA08FsAANAAABDgEjIiY3MwYWMzI2NwNPFKuEfoMUkwsxR0JRCwWwf4ySeUZQVEIAAAAAAQFBBOoCMQWwAAMAAAEjNzMCCsknyQTqxgAAAAIBIgRfAsEF4AALABcAAAE+ATMyFgcOASMiJjcGFjMyNjc2JiMiBgEzEYJUS1wQE35TTV5wCSwpJUYJCSopJ0cFHlpob1NcY2pVLzg7LDA5PQAAAAH/t/5QAScANwATAAAhDgEHBhYzMjY3Bw4BIyImNz4BNwEnV2IJBhsoGTAXByBMMk9XDg+OjD5kPCUlEQt4ExljWlmVPAAAAAEBCATiA68F8QATAAABDgEjIiYjIgYHJz4BMzIWMzI2NwOvEIBWQIAyJkIHYA9/VzONMiZDCAXSYnxfQi8aYoFgQTEAAgEHBOQD7wXuAAQACAAAATMXASMDMwEjAxjWAf6xpBLJ/uWRBe4D/vkBCv72AAAAAgAd/ocBV/+rAAsAFwAAFz4BMzIWBw4BIyImNwYWMzI2NzYmIyIGKg5jPzhFDQ5ePjpJYAYdHBcrBgYaGhou6UVPVEBETFE/HSMlGyAkJgAB/fIEuv7KBhMAAwAAASMDM/7KeGCsBLoBWQAAAf5BBLv/owYUAAMAAAEzAyP++6jzbwYU/qcA///9WATi//8F8QAHAKD8UAAAAAAAAf5GBNn/lQZzAA8AAAE3PgE3NiYjNzIWBw4BDwH+Rh1NPwcJTUIcjnsTDl5BDwTZlwUdKSgnaV5dSEgJRgAAAAL9SwTk/8sF7gADAAcAAAEjAzMBIwMz/tak59sBpZGuyATkAQr+9gEKAAAAAfzc/rH9y/92AAMAAAEjNzP9pMgnyP6xxQAAAAEBZAT4AqoGeAADAAABMwMjAenB8FYGeP6AAAADAUEE7QP5BogAAwAHAAsAAAEjNzMFIzczNzMDIwPStye3/gG5J7mdyqqCBO3Dw8PY/vj//wDDAnABpANBAAYAdgAAAAEAVwAABLkFsAAFAAABIQEjASEEm/13/vu2ASMDPwUa+uYFsAAAAAAC/8wAAAS+BbAAAwAHAAABEyEJASEDIwPJ9fsOA2H9sAMQpAMFsPpQBbD65QQkAAADAE//6wUnBcUAAwARAB8AAAEhNyEXAgAjIgAbARIAMzIAAyc2JiMiBgcDBhYzMjY3A7D+JR4B2/E8/rL95f78NjM7AUT07AEQNbQrqrOX3ykzLaCqoegqApSW3P7a/sMBawEKAQEBJgE+/pP+9wLa/vjO/v3c/vfRAAAAAf/eAAAEXQWwAAcAAAEnASMBMxMjAwoD/ZG6AxSdzroEmAH7ZwWw+lAAAAADACIAAAShBbAAAwAHAAsAADchByETIQchEyEHIUADZx78mfQCwx79PU4DWx78pZWVAzyWAwqWAAEAWAAABXsFsAAHAAAhIwEhASMBIQRYtQEF/Wr++7UBIwQABRr65gWwAAAAAf/xAAAEoAWwAAwAAAkBIQchNwkBNyEHIQEDAP3nAuIe/EYcAjX+thwDjB79TQE2As79yJaOAk0CR46W/c0AAAMAVwAABX0FsAAVAB4AJwAAATMyEgcCACsBByM3IyICNxIAOwE3MwEiBgcGFjsBEzMDMzI2NzYmIwOzBdH0LzX+qeUFI7YjB9LyMTMBVuUHJbb/AJjhIyiApQeftp8HluElJ4GjBPb+zu/++/7hsbEBMfEBAwEguv6x2LbHxgMb/OXYt8TIAAABAIoAAAWSBbAAFwAAAT4BNxMzAwIABwMjEyYCNxMzAwYWFxMzAvKO0SJqtWo1/sfnSLZIyMsxarRqJm6EvbYCAxvUrAIS/e7+9v7rFf6WAWscASXyAhL97rvKFwOuAAABAB0AAAUIBcUAKAAAJT8BNhITNzYmIyIGDwECEhcPAiE3MyYCPwESADMyEgMHBgIHFzMHIQJjFwGLyTQXM4Cll+0uFzhbhwEXB/4zHt9ZOyMXPQFY8d3lOBclrXkB2B7+MyJzBhsBGwECdv7o/Op2/uz+9xsGcyKVYwEvrHQBNAFK/p7+5HS2/thdA5UAAAACAED/6wQ0BE4AHAAqAAABAwYWMzI2NwcOASMiJicOASMiAj8BEgAzMhYXNwEGFjMyNjcTLgEjIgYHBDSdExgjBxIGBSA5IkBIBEKeY6+gLwQ4AQTCWn0kLv2LJVSHT4E5XBRbUH22JQQ6/OxdOwMDiBMOS1RQTwEg6hUBGwEpU1CP/bu1wGBYAc1VXvK8AAAC//X+fwRwBcQAFAArAAABMhYHDgEHHgEHBgQjIiYnAyMBNiQDPwEzMjY3NiYjIgYHAx4BMzI2NzYmIwMLrLkiFHleZFcYLv7zxEqFMFy3ASMkAR04EA5MbIwXFFdqYKgWqB93VXOxGhhWbAXE261kli0vwH/i2S8w/jQFsbXf/P9QRXxsaIaRbfy6NDWggnulAAAAAQCz/mAEJgQ6AAsAAAEzAQMjEwMzExczNwNtuf3XYLZhlblXAQMkBDr8BP4iAeQD9v0AU1MAAAACAEH/7AQqBhwAIQAvAAABPgEzMhYXBy4BIyIGBwYWFxYSDwEGACMiAj8BPgE/AS4BAwYWMzI2PwE2JiciBgcBfB3TrEONQkIxfkRKawwLRXG6iSkEM/7f18jBLwQm1o0GU0dCJVyKfLkhBB1ldn28IAT2k5MtKIAXJEk/NlosS/7uzhf8/uwBKOgXvOsjCyeM/WGyytikF5HSGtyhAAAAAQAp/+0D/QRMACkAABM+ATcuATc+ATMyFgcjNiYjIgYHBhY7AQ8BIyIGBwYWMzI2NzMGBCMiJkgTeWZKRQ8h7sSizhy1D2phaIsNEFFwwggVwmyIERFpc2SjELUk/u+0tNABMGR9HyV2SKOWsI9OXmJEUlEmaldZUl9yTrSerAABAIv+gQRYBbAAIAAAAQcBDgEHBhYfAR4BBw4BByc+ATc2Ji8BLgE3NhI3ASE3BFgX/mualBwWKUpzhlcVEYpGTzk7Cgc3SU6aXCEauK0BRf2vHgWwdv5Snd6QalsTJixDbUqpM1M3Uy0nLxYXL56hgAEvrwFAlgABADX+YQQSBE4AFAAAARc+ATMyFgcDIxM2JiMiBgcDIxMzAaACQKJhno8t27XaIE5yToEzorbYowOxAU5QxOH7uAREoHNKRPzWBDoAAwBW/+sEZwXFAA0AFgAfAAABAgAjIgIbARIAMzISAwUhNzYmIyIGBwEhBwYWMzI2NwPrPf7t0L+2OEU8ARXQv7Q3/UQB8xwpV39zrSYBuf4NGipZfnSrJwIs/tD+7wEqARcBVwEuART+1f7pY4vRs8TA/uCF0bXEwgAAAAEAfv/rAfwEOQAPAAABAwYWMzI2NxcOASMiJjcTAfSiESUtFTAWDjBUM2tcIaAEOfzUVDQOC4AeFY6eAyIAAAAB/9H/8AO3Be4AIQAAMyMBJy4BIyIGIzc+ATMyFhcTHgEzOgE3Bw4BIyImJwMjB5vKAjgsCiUnCRwIHBFGGVVPCbsHHx8LEQgZDikVVVYTZAMzBALuOi4CjAQIU1X7qDUrApQFB1F9Al5zAAABADr+dwQbBcMAMwAAAS4BIyIGBwYWOwEHMwcjIgYHBhYfAR4BBw4BByc+ATc2Ji8BLgE3PgE3NS4BNzYkMzIWFwPjOF4zgqgQFnSfhAgBF4So3CAcbW1jgF4VEYlGTz8yDAk1TjLIpSsgvZVjXhQiAQ7cPIEoBQoRE21QcWsnb6CjiYsdFyNKbUmmNFM8RjcuJxMNNMDUosErAyuUXa+nFxAAAAEAcP/rBJcEOgAXAAABIwMGFjMyNjcXDgEjIiY3EyEDIxMjNyEEeXGEESUtFTAWDjBUM2tcIYL+jbq2unceA8YDpP1pVDQOC4AeFY6eAo38XAOklgAAAAAC/+L+YAQmBE4AEAAeAAABCgEjIiYnAyMTNRIkMzISAyM2JiMiBgcDHgEzMjY3A+0z+b9YgCpotsc1ARm8yao1tSlJh22uGz4XXlN8siEB9f8A/vc/QP31A+ICAQz+/sP++c7g64v+zUVJz6UAAAAAAQBJ/ooD/wROACEAAAEyFgcjNiYjIgYPAQYWFx4BBw4BByc+ATc2JicuAT8BNgACoae3JKsXVW96uB8IH3ihiWQWEIpGTj4yDAkzUNmtKwgxASAETtG3c3/qnCqWrTEsTW5IqDNTPUQ3MCcUNP7WKvYBJgACAEP/7ASzBDoAEAAeAAABIR4BDwEGACMiAj8BNgA3IQEGFjMyNj8BNiYjIgYHBJX+/EwzGgUu/trUx78xBDIBIdcCEfx3JlmKfbwjBCNciX26IAOjStGFF+X+5QE08Bj7ARYB/da71OOsGK/M2qEAAQC3/+sEHgQ6ABMAAAEhAwYWMzI2NxcOASMiJjcTITchBAH+qoQRJS0VMBYOMFQza1whgv7BHQNKA6b9Z1Q0DguAHhWOngKPlAAAAAEAWv/rA/QEOgAVAAABAwYWMzISNzYmJzMeAQcCACMiJjcTAcGDIkRZds8iFgkYvhsGHzb+5N+rny6DBDr9b6iBAQmogfuNbf2f/vT+xtvlAo8AAAIAP/4iBUAEOgAZACMAAAUmAjc+ATcXDgEHBhYXEz4BMzISBwYABQMjAT4BNzYmIyIGBwHq7b4vJKSNSV5vGyNnoZAWlXG01y0y/tP+7Fy2ATCo2R4cYYEaKAUQHAFB5rf2WoNKyHKq5hwC0XBy/svl9f7bF/4zAmYc6ZOh4ikcAAAAAAEAQ/4pBS4EOgAbAAABAz4BNzYmJzMeAQcCAAUDIxMmAhsBMwMGFhcTA3O9qNsgFgoavRwKHzX+1f7oWrZb2sU5YbZhL3GMvQQ5/E8f9ZyA+4ds+pz+/P7PFf47AcgcASwBGwHm/hjm0BYDswAAAAABAF3/6wXsBDoAKQAAAQ4BBwYWMzI2NxMzAwYWMzI2NzYCJzMeAQcKASMiJi8BDgEjIgI3PgE3AjNZeB0qMGpYkCQ8tzwnSmFglScWEiO/IxEfOOjFaIERAz2sdbZ6MiJxUwQ6iP+EzuGkswEr/tXClfG+hAEAh2/9n/7u/s51cgF4cAFJ+6vwcAAAAAIAWv/rBQoFxQAZACQAACUyNjcuAT8BPgEzMhYHAwIAIyICGwE3AwYWAQYWFxM2JiMiBgcCJZPoK8DNJg0l0JKLhyNmPf6y8NPZNoS3hSx0AYwbaoFIFyxEO2IVhvDTCvq/Pry/yrH+Av7T/swBWQEIApgC/Wba7AOEhZkIAWZ4Z3BvAAEAswAABNgFuwAjAAABPgEzMhYXBy4BIyIGBwEDIxMDLgEjIgYHNz4BMzIWFxMXMzcDW0mETR4vFjQFEwweOxn+aXS0dJYIKx8OFgQJGTAgR2EYVQQDIgTXfmYKDpIDBSUs/X79ugJEAoQtJAUDkg4KZ33+aEpKAAIAZP/rBjQEOgAXAC0AAAEjFgYHCgEjIiYvAQ4BIyICNz4BNyM3IQE2JichDgEHBhYzMjY/ATMHBhYzMjYGFn4MBRU42LFpgBADPat1pGgyFkEtaR4FZf6gEAEP/Qs2ShQqIFZXkSQztzMnSWJNgwOjVLZq/u/+zXZyAXlwAUn7cbJRl/31XbdgYrZczeKks/z8wpXyAAAAAQDb//UFfwWwABsAAAEhAz4BMzIWBwYEIzcyNjc2JiMiBgcDIwEhNyEE9/4eXVGQM9rZLC/+8+kaj6ocHHWYN5RIibYBBf58HgQcBRr+LRcd8Nvn1I+ckJaWGhb9VAUalgAAAAEAZv/sBPwFxgAfAAABBgQjIgAbARIAMzISByM2JiMiAg8BIQchBwYSMzI2NwR5Q/7z39/++zYzOwE17Nn4F7cLipmQ2igLAhke/ecKLJiii6E3AcDg9AFqAQsBAQEoATz+8uCjtf7/yzmVNdj++JinAAAAAv/eAAAH4wWwABYAHwAAAQMhMhYHBgQjIQEhAwIAKwE3MzISGwEBAyEyNjc2JiMFcXIBTs3JJyv+6t/9+wEF/itrVf717TEeJoW6RokCsXUBToG0GRpmjQWw/cX3xNbkBRr96/5k/peVAR8BUQKr/TD9tax7gqIAAgBXAAAH6AWwABIAGwAAASETMwMhMhYHBgQjIRMhAyMBMwEDITI2NzYmIwGxApV/tnwBT87MJSn+7OD9/Ib9a4a2ASO2ArJqAU6DrxcYaI8DNwJ5/Zbku8zbAqL9XgWw/QH97phye40AAAAAAQDyAAAFqgWwABcAAAEhAz4BMzIWBwMjEzYmIyIGBwMjASE3IQUP/hRZT5Rh1sYvW7VbJGSWT6FUjrUBBf6EHgQdBRr+RRQU0+3+OQHHtnQWFP05BRqWAAEAV/6aBXsFsAALAAABMwEhATMBIQMjEyEBerb++wKVAQW2/t3+YUi1SP5TBbD65QUb+lD+mgFmAAAAAAIASAAABKoFsAAMABYAAAEhAyEyFgcGBCMhASEBBwMhMjY3NiYjBIz9d1oBTs/MJyv+7eH9/AEjAz/84R9QAU6DsBkZZ48FGv4+5sLU3AWw/ROe/nCjeoCRAAAAAv+W/poFhQWwAA4AFQAAASMTIQMjEzM2EhsBIQEzAQYCByETIQTTtUf8Lki1ZnNaukKTAy3++7j9RDqnZQKV5/41/psBZf6aAftYAVABLQJG+uUC1fj+lnMEhQAB/8oAAAddBbAAFQAAASMDIxMjASMJATMTMxMzAzMBMwkBIwSJkIa1hpX9/uMCYf7o1OKZf7V/kgHg1P3VAS7iAp/9YQKf/WEDAQKv/YQCfP2EAnz9U/z9AAAAAAEAIP/rBLAFxQApAAABDgEHHgEHBgQjIiY3MwYWMzI2NzYmKwE/ATMyNjc2JiMiBgcjNiQzMhYEiReUdGxcGCz+zei7+Cu1GoKJjc0YHXqdmA0RmIqsFxh1l3DBFbUnASjK098EJ3CjLSyqfNnR1tN/lZd6k3c/V4Z0e4mQbMXN1wAAAAEAWAAABXoFsAALAAABMwEjEycBIwEzAxcExLb+3bbgA/yPtQEjteADBbD6UARfAfugBbD7oQEAAf/eAAAFcQWwAA8AAAkBIwEhAwoBKwE3MzISGwEFcf7dtwEF/iR5YfjgMB4lealPmwWw+lAFGv3r/l7+nZUBGQFXAqsAAAAAAQCj/+sFRQWwABUAAAEXMwEzAQ4BIyImJzceATMyNj8BAzMCbB8DAeTT/TNVlo8WPgchCT0QPlAyNu7LAvu4A237QIZ/BgOQAgJOTlQEQAADAFv/xAX2BewAFQAeACcAAAEzMgADAgArAQcjNyMiABMSADsBNzMBIgYHBhY7ARMzAzMyNjc2JiMD+RngAQQzOP6R9BontSca4f79NDcBbvUbKbX+6aj5Jy2OuBuvta8bpvgpK461BR7+uP8A/uj+zMbGAUgBAgEWATTO/p3ux9zZA2r8lu3K2NsAAAEAV/6hBXoFsAALAAABMwEhATMBMwMjEyEBerX++wKWAQW1/vuNd6FG/CcFsPrlBRv66f4IAV8AAQDRAAAFSAWwABMAAAkBIxMOASMiJjcTMwMGFjMyNjcTBUj+3bV6Yqdy18cwW7dbJWOXW71jiwWw+lACYR0a0u4Bxv46t3McHAK4AAEAVwAABzAFsAALAAAJASEBMwEhATMBIQECMP77AcwBBbX++wHJAQW2/t36SgEjBbD65QUb+uUFG/pQBbAAAAABAFf+oQcwBbAADwAACQEhATMBIQEzATMDIxMhAQIw/vsBzAEFtf77AckBBbb++5B2o0b6bwEjBbD65QUb+uUFG/rl/gwBXwWwAAAAAgDJAAAFgQWwAAwAFQAAEyEDITIWBwYEIyEBIQEDITI2NzYmI+cCKXgBTs/MJyv+7eH9/AEF/o0BsW8BToOwGRlnjwWw/ajmwtTcBRv9qP3So3qAkQAAAAMAVwAABqIFsAAKABMAFwAAASEyFgcGBCMhATMLASEyNjc2JiMBIwEzAbgBTs/MJyv+7eH9/AEjtpZvAU6DsBkZZ48Cl7UBI7UDWObC1NwFsP0T/dKjeoCR/T0FsAAAAAIASAAABJIFsAAKABMAAAEhMhYHBgQjIQEzCwEhMjY3NiYjAakBTs/MJyv+7eH9/AEjtpZvAU6DsBkZZ48DWObC1NwFsP0T/dKjeoCRAAAAAQCH/+wFNAXGAB8AAAE2ADMyEgsBAgAjIgI3MwYWMzISPwEhNyE3NiYjIgYHAR0tAUDr2+Q2Mzv+qO/c5i21I4GgkfUpC/3oHgIXCyt+n5PTHwPf4wEE/qD+8/7//tv+uQEF36qlAQzJOJU22/y0nQAAAAACAGL/6wblBcUAFQAjAAABAgAjIgATNyMDIwEzAzM3EgAzMgADJzYmIyIGBwMGFjMyNjcGfTz+sv3l/vw2BrN/tQEjtYayEDsBRPTsARA1tCuqs5ffKTMtoKqh6CoCTv7a/sMBawEKH/2BBbD9ZE0BJgE+/pP+9wLa/vjO/v3c/vfRAAACAAwAAATxBbAADQAWAAAzIwEuATc2JDMhASMTIQEjIgYHBhY7Ac3BAbt+XyApATbWAbL+3bdy/tEBwvuXrh0bf4j8Am82upvR5fpQAjwC3o2RhKYAAAAAAgBE/+sEUAYRABwAKgAAATISDwEGACMiAj8CEgA3PgE3Mw4BBw4BBxc+ARciBg8BBhYzMjY/ATYmAqG8uCIEKP7o1szJJgEVNgEo4H11DJQerriDzTcCS68kgKoXBBxjiYGuGwQYaAP7/u/YGPX+5gEm6QiAAVYBaiwZQEq4aCAYpKQBQEuVw5EYrc3VpRiaugAAAAMAQAAABCoEOgAPABgAIQAAMxMhMhYHDgEHFR4BBw4BIwsBITI2NzYmIyczPgE3NiYrAUDYAYy/xx4RaFRYSxIh4sG3QgEWYn8QEVVr+eFshhARZHvWBDqUlVJzHQMYh1qkjwHc/rdWT1VPkgFNTFVJAAAAAQA+AAADlQQ6AAUAAAEhAyMTIQN3/je6ttgCfwOj/F0EOgAAAv+a/sIETgQ6AA4AFQAANz4BNxMhAzMDIxMhAyMTAQ4BByETIUhieTtgApC7hl61QP1KQLZfAhovflAByZn+05VizuABlfxb/i0BPv7CAdMCELv8WQL8AAH/wwAABgEEOgAVAAABIwMjEyMBIwEDMxMzEzMDMwEzARMjA7R1XrZedf6U5QHd5Nugclq2WnMBVNv+UPjlAdj+KAHY/igCPgH8/j8Bwf4/AcH+A/3DAAABAB7/7QPEBEwAKwAAATMyNjc2JiMiBgcjPgEzMhYHDgEHHgEHDgEjIiY3MwYWMzI2NzYmKwE/AgFtr1xpEA9KZVOQDrQf+aqorh4QaVNOQxIh8bme0iK1EmNlX4kPE01rrwgJBQJ1UkxLW2RInKOil1F3IiJ9WqSfq6dUbGVMYUoqLRgAAAAAAQBAAAAERwQ6AAsAAAEzAyMTJwEjEzMDFwORtti2mwP9pLXYtZsDBDr7xgMJAfz2BDr89wEAAAABAEAAAARhBDoADAAAASMDIxMzAzMBMwkBIwHKeFy22LZcbAGp2v4JAT/mAc/+MQQ6/jUBy/36/cwAAAAB/9UAAARJBDoADwAAAQMjEyEDCgErAT8BMjYbAQRJ2Le6/rZKUse+NCQmW3M+bgQ6+8YDo/7H/rH+5aIBxwEAAdAAAAEAQAAABX8EOgAOAAAlATMDIxMnASMDIwMjEzMCpwH149i1mAL+LX2jA5y22OvyA0j7xgL8Af0DAwv89QQ6AAABAEAAAARGBDoACwAAISMTIQMjEzMDIRMzA262XP4+XLbYtl4Bwl62AdD+MAQ6/ioB1gAAAQBAAAAERwQ6AAcAACEjEyEDIxMhA2+2uv49urbYAy8Do/xdBDoAAAEAkAAAA/cEOgAHAAABIQMjEyE3IQPa/rK6tbr+uR0DSgOm/FoDppQAAAAAAwBA/mAFVwYYAB8ALQA7AAATGgEzMhYXEzMDPgEzMhIDBwoBIyImJwMjEw4BIyICNyU2JiMiBgcDHgEzMjY3IQYWMzI2NxMuASMiBgdzOfK3JkAbYrViI0wtqIg1BDPttSxIHlW1VCFFKKaNLwP9KUR+HDEXnhMuH3OjIfy9JUN9Gi0WnhIrGXOjJgIKAR0BJw8OAef+Fw8Q/sL++hX/AP72ERD+VAGlDQ0BHuwVzeELCfzrCAfPpre+CAgDGQcI8L4AAAEAQP6/BEcEOgALAAABMwMhEzMDMwMjEyEBGLa6AcO6trt7cKJA/QsEOvxbA6X8W/4qAUEAAAAAAQB/AAAEBgQ7ABMAACEjEw4BIyImNxMzAwYWMzI2NxMzAy62TjlwQa+uKj+1Px5ObDp0PWu2AYgQD8zMATr+xpFwEBACGgAAAQBAAAAGAgQ6AAsAAAEDIRMzAyETMwMhEwHOugFkura6AWS6ttj7FtgEOvxbA6X8WwOl+8YEOgABADX+vwX3BDoADwAAAQMhEzMDIRMzAzMDIxMhEwHDugFkura6AWS6truRcKFA+znYBDr8WwOl/FsDpfxb/ioBQQQ6AAIAhgAABIEEOgAMABUAABMhAzMyFgcOASMhEyEBAzMyNjc2JiOjAd1L+6qnHiPmuP5Quv7aAZFR+l97ERJEZwQ6/orDm6q8A6X+iv5mdVVbdQAAAAMAQAAABasEOgAKAA4AFwAAATMyFgcOASMhEzMBIxMzAQMzMjY3NiYjAYP7qqceI+a4/lDYtgMFt9i3+7pR+l97ERJEZwLEw5uqvAQ6+8YEOv31/mZ1VVt1AAAAAgBAAAADzwQ6AAoAEwAAATMyFgcOASMhEzMLATMyNjc2JiMBg/uqpx4j5rj+UNi2aVH6X3sREkRnAsTDm6q8BDr99f5mdVVbdQAAAAEAM//rA+kETgAdAAABIgYHIzYkMzISDwEGACMiJjczBhYzMjY3ITchNiYCUlOhEq0fARGhwbgtCDL+4NKjuiKtF2Bjb68o/pIeAW0SWQO4eluezf7G4ir4/tvfqHCCypKVlLMAAAAAAgBA/+wF9QROABMAIQAAATM2JDMyEg8BBgAjIgI3IwMjEzMBBhYzMjY/ATYmIyIGBwFz5TUBEMbNxSYEKf7m1sDHFOpet9i3AS0eY4mBrhwEHWOIga8bAm7h//7M8hj//tsBDt7+KAQ6/da32OGuGLXb5KwAAAAAAv/VAAAEDgQ6AA0AFgAAAQMjEyMBIwEuATc+ATMBBhYzIRMjIgYEDti2VPf+vMQBXFhMFh/pu/7zEEVeAQZJ8mCCBDr7xgGm/loBxSibaJ2t/rRRYgFrbgAAAAABADX+SwQZBhgALAAAASEHFz4BMzIWDwEzAw4BIyImJzceATMyNj8BEzc2JiMiBgcDIxMjNzM3MwchAt7+/zMDQKRem48rLQJtJbqUHTMXLAs9EDZXExJbLR5Pb0mPOZ628pwenCi2KAEBBLr/AkhN0Nnf/eG1pwgJkgUJal1ZAcbhlndUSPzoBLqVyckAAAABAFH/7AQFBE4AHQAAJTI2NzMGBCMiAj8BNgAzMhYHIzYmIyIGByEHIQYWAftaoA+sGf7ypte7JQcnARHhrsEarBBqZ4GfIQFxHv6VEV6BeFyazwEy6ir1ASfeqmyGvpOVm7YAAv/VAAAGIQQ6ABYAHwAAAQMzMhYHDgEjIRMhAwoBKwE/ATI2NxMBAzMyNjc2JiMEJVP7qqodIOW4/k+6/tc+RtTHMyEnX4UyXAIlSvpefBAPR2cEOv5juZKgsgOj/sf+qf7tmAHb9gHQ/c7+i3NOUWMAAAACAEAAAAZCBDoAEgAbAAABIRMzAzMyFgcOASMhEyEDIxMzAQMzMjY3NiYjAXwBwlK2U/uqqh0g5Ln+UGj+Pmi22LYCB0r6XnwQD0dnAqABmv5iuJKgsgIM/fQEOv3O/otzTlFjAAAAAAEANQAABBkGGAAcAAABIQMXPgEzMhYHAyMTNiYjIgYHAyMTIzczNzMHIQL1/uk0A0CkXpuPK4e1iB5Pb0mPOZ6284Yehie2JwEXBL/+/AJITdDZ/VsCp5Z3VEj86AS/lcTEAAABAED+nARHBDoACwAAAQMhEzMDIQMjEyETAc66AcO6ttj+xke2R/7B2AQ6/FsDpfvG/pwBZAQ6AAEAaP/rBskFsAAgAAABAw4BIyImJw4BIyImNxMzAwYWMzI2NxMzAwYWMzI2NxMGydQt9LVgih5Bs3GhqSnUttQdTFphmhvUu9QdVmNYkBvUBbD72dzCVlhcUtPLBCf72Y18h4IEJ/vZjXyHggQnAAABAEX/6wXIBDoAIAAAAQMOASMiJicOASMiJjcTMwMGFjMyNjcTMwMGFjMyNjcTBciRKN6kUngdOptikpgmkbWRGTxKUIIXkbaRGUZSSHgXkQQ6/SnIsEdITEO/uQLX/Sl5anNwAtf9KXlqc3AC1wAAAgA+AAAD1AYYABIAGwAAASEDMzIWBw4BIyETIzczEzMDIQEDMzI2NzYmIwL3/tZD+aumISTouf5Q2LAesEK3QgEq/ldZ+V99ExNCZwQ6/q7MpLLGBDqVAUn+t/2E/kJ/XWKAAAEAY//sBp8FxgAnAAABMzcSADMyEgcjNiYjIgIPASEHIQcGEjMyNjczBgQjIgATNyMDIwEzAb6tBzsBNezZ+Be3C4qZkNooBwIBHv3/DiyYoouhN7dD/vPf3/77Ng6tiLUBI7UDQCIBKAE8/vLgo7X+/8sklknY/viYp+D0AWoBC0n9VgWwAAABADz/7AWRBE4AIwAAATM2ADMyFgcjNiYjIgYHIQchBhYzMjY3MwYEIyICNyMDIxMzAW6lMAEL1K7BGqwQameBnyEBlx7+bxFeiVqgD6wZ/vKmyb4Tq1232LcCZ98BCN6qbIa+k5Wbtnhcms8BD9f+LgQ6AAL/2AAABDsFsAALAA8AAAEjAyMTIwMjATMTIwEhAyMDTpdYtFiL57kDDJu8uf5IAXJCAwG6/kYBuv5GBbD6UAJYAjwAAv+8AAADjgQ6AAsAEQAAASMDIxMjAyMBMxMjASEDJyMHAqBkO7U7aam5AnKcxLr+nwETNgQDIgEr/tUBK/7VBDr7xgHBAT1KSgAAAAIAdAAABicFsAATABcAAAEhATMTIwMjAyMTIwMjEyEDIwEzASEDIwGhAWUBypu8uTSXWLRYi+e57f7QWLUBI7UBawFxQgMCWQNX+lABuv5GAbr+RgG6/kYFsPyoAjwAAAIAXQAABS4EOgATABkAAAEzATMTIwMjAyMTIwMjEyMDIxMzASEDJyMHAW3zAW6cxLo0ZDu1O2mpua26O7fYtwEnARM2BAMiAcECefvGASv+1QEr/tUBK/7VBDr9hwE9SkoAAAACADoAAAY8BbAAIQAlAAABMzchATMyFgcDIxM2JisBBwMjEycjIgYHAyMTNiQ7AQMzEzMBIQKtAwMDif4QGdXGL0q1SiNjlW8efLV/CnuJoCBKtkoyAQHqJu7Q3wQBcf3gBaMN/XvO6f6MAXSxcCj9kwJ7Gn6j/owBdPy7AoX9ewHvAAACADoAAAUOBDoAGwAeAAABHgEPASM3NiYrAQcDIxMnIyIGDwEjNz4BNwMhARMhA6KwnyshtiEjUoEuDle1WQM4d44gIbYhMOXJrAOB/eHo/rECWgrP3KWlsXAS/kwBvgh+o6Wl9LwGAd/+JwFDAAAAAgBiAAAISgWwACkALQAAIRM+ATchAyMBMwMhOwEDMxczNyEBMzIWBwMjEzYmKwEHAyMTJyMiBgcDATMBIQJIShM9Lf6MhLUBI7WBAuEVJu7QBAMDA4n+EBnVxi9KtUojY5VvHny1fwp7iaAgSgKYBAFx/eABdGGNNP1qBbD9ewKFDQ39e87p/owBdLFwKP2TAnsafqP+jAMrAe8AAgA+AAAG4gQ6ACIAJQAAITc+ATchAyMTMwMhAyEBHgEPASM3NiYrAQcDIxMnIw4BDwEBEyECDiETOyr+qFq32LdgAp+rA4H+lLCfKyG2ISNSgS4OV7VZA0NzhyAhAf/o/rGlYYw0/joEOv4iAd7+IArP3KWlsXAS/kwBvggDf5+lAmEBQwAAAAL/x/5HBEcHcAAtADYAAAEyFgcOAQceAQcGBCsBIgYHBhYXBy4BNz4BOwEyNjc2JisBPwEzMjY3NiYjITcBNzMHBSMnNzMCZbzXJBeXd25gGSv+6M0vRE8KEEM7YV9vFRy2nSdzsRgdepqFBxaFiaoXF2iG/uYeAbmmnQT+4G26BJkFsNS1caEqLKx92NE8NUxOIHsvn3CKc5d5kn0jcoJzcX+VASqWEvPxFAAC/8b+RwO+BhsALQA2AAABMhYHDgEHHgEHDgErASIGBwYWFwcuATc+ATsBMjY3NiYrAT8BMzI2NzYmIyE3ATczBwUjJzczAhiqyxwRdV9aURAh+rstRFAKEEM8YV9vFRy1nSZijxAScIeFBxeFdo0QDmBw/uceAXymnQT+4G26BJkEOqaOUXUiI3dUo6A8NUxNIXsvn3CKc15MW0wjclZMSFKWAUuWEvPxFAAAAwBd/+sFNwXFAA0AFgAfAAABAgAjIgIbARIAMzISAwUhNzYmIyICBwUhBwYWMzIANwTQOv6S/eDuNTM5AWT06Pk0/GsC1A0qk6+Y/ScCqf0sCSyJpqEBBykCV/7j/rEBZgEGAQEBHAFR/pn++j5A1vn+9cTWLdj5AQrHAAMARv/sBBwETgANABQAGwAAEzYAMzISDwEGACMiAjcBMjY3IQYWEyIGByE2JnEpARrWzcUmBCn+5tbNxicBhHWmJf3rEGf/dKQlAhMLZwIo/gEo/szyGP/+2wEx8/5xvpmgtwM3uJOZsgAAAAEA6AAABVwFxAARAAABFzM3AT4BMxcHIyIGBwEjAzMCFQcDOQGRTpBmLyIMLUcq/aqbt8QBcXt7AzSegQGjP1T7cwWwAAAAAAEAswAABEsETQAVAAABFzM3Ez4BMzIWFwcuASMiBgcBIwMzAa4CAyT5QY5NHS8TMQUSDB1CFf5Eioq5ATpVVQIjfnIKDpIDBTIr/LIEOgAABABP/3MFJwY1AAMABwAVACMAAAEjEzMBIxMzAQIAIyIAGwESADMyAAMnNiYjIgYHAwYWMzI2NwOFtU21/qa1TrUB+Tz+sv3l/vw2MzsBRPTsARA1tCuqs5ffKTMtoKqh6CoEtQGA+T4BiQFS/tr+wwFrAQoBAQEmAT7+k/73Atr++M7+/dz+99EAAAAEAEb/iAQcBLYAAwAHABUAIwAAASMTMwEjEzMBNgAzMhIPAQYAIyICNzMGFjMyNj8BNiYjIgYHAtC1SbX+97VJtf4YKQEa1s3FJgQp/ubWzcYnth5jiYGuHAQdY4iBrxsDSAFu+tIBbgEy/gEo/szyGP/+2wEx87fY4a4YtdvkrAAAAAADAGz/6waVB1QALAA+AEQAAAEyFgcDDgEjIiYnDgEjIiY3Ez4BMwciBgcDBhYzMjY3EzMDBhYzMjY3EzYmIxMHIyIkIyIGDwEjNz4BMzIWMwEnPwEzBwVRn6UrczHurmSRIUGxcKGlLHMv77AeUosdcyBIWmGaG1e2Vx1ea1GLHnMfSFm4GStw/v0rLUQKBHsIFoNuPfpt/g89TRytGQWv59v9wO7UVVZbUObcAkDt1ZWak/3AoI2HggG0/kyNfJmUAkCfjgG7fX85NhIkdWV//lJAdIx8AAADAEj/6wWfBfEALAA+AEQAAAEyFgcDDgEjIiYnDgEjIiY3Ez4BMwciBgcDBhYzMjY/ATMHBhYzMjY3EzYmIxMHIyIkIyIGDwEjNz4BMzIWMwUHJz8BMwR6kJUoOizXnld/IDqcYpKUKTor158dRHIZOhw4SlCCFy+1LxhPWUJxGjobN0j7GStx/v4qLUQKBHwHF4NvPPpu/s7APk4brgRE08n+39vBSElNRNLKASHZw5WHgP7fjXpzcOvreWqFggEhjHsBwn1/ODYSI3VmgOrEQHSMAAIAaP/rBskHAwAHACgAAAE3IQchByM3BQMOASMiJjcTIwMOASMiJjcTIwMGFjMyNjceATMyNjcTArcVAvsV/s0ZpRkCOtQbkFhjVh3Uu9QbmmFaTB3UttQpqaFxs0EeimC19C3UBplqan196fvZgod8jQQn+9mCh3yNBCf72cvTUlxYVsLcBCcAAAAAAgBF/+sFyAWxAAcAKAAAATchByEHIzcBAw4BIyImNxMjAw4BIyImNxMjAwYWMzI2Nx4BMzI2NxMCIRUC+hL+yhmkGQHPkRd4SFJGGZG2kReCUEo8GZG1kSaYkmKbOh14UqTeKJEFR2pqgID+8/0pcHNqeQLX/Slwc2p5Atf9Kbm/Q0xIR7DIAtcAAAABAGT+gwUNBcUAGAAAASMTJgI3ExIAMzISByM2JiMiAgcDBhY7AQJDtUm8tzIzOwFZ79vmLLYigJ+S9Sg0LICgav6DAW4fAVL1AQEBJQFI/vneqab+88j+/dv8AAEASv6DA/sETgAYAAABIxMmAj8BNgAzMhYHIzYmIyIGDwEGFjsBAdu2SpyJKQgxASHUobkhqxZiYHq5HwgjUodi/oMBciIBKMkq9gEm4advg+qcKq7aAAABAFUAAATCBT4AEwAAARcHJwMjASc3FwEnNxcTMwEXBycCOuta7emgASHrWe8BBetc7e6e/trtXekBvax5qv6+AY6reasBb6t7qwFN/mereKoAAAAB/T0EpwAcBfsABwAAAQcnNyE3Fwf9+BmiMAH5FKIrBSV+AedsAdUAAf1kBRcAQwYVABEAAAEyJDMyFg8BIzc2JiMiBCsBN/2mbQErPG9aFgd8AwstLSv+zHArGQWVgGZ1IxI2OH99AAH+bwUY/zcGWAAFAAABNzMHFwf+bxmsHB9XBdx8jHRAAAAAAAH+kAUY/6cGWAAFAAABJz8BMwf+zT1NG68ZBRhAdIx8AAAAAAj6t/7EAdoFrwANABsAKQA3AEUAUwBhAG8AAAE+ATMyFgcjNiYjIgYHAT4BMzIWByM2JiMiBgcDPgEzMhYHIzYmIyIGBwE+ATMyFgcjNiYjIgYHAT4BMzIWByM2JiMiBgcBPgEzMhYHIzYmIyIGBwE+ATMyFgcjNiYjIgYHAz4BMzIWByM2JiMiBgf+DBN5XVZZEWgKIDErOwkBhRJ6XFZaEGkJITErOgghEnpdVlkQaQkfMSw7CP56EnlcVlkQaAkgMSs6Cf1HE3ldVloRaAkgMSs7Cf6DE3pdVlkRaAohMSs5Cv6NE3pcV1kRaQofMis7CTYSe1xWWxFpCiAyKzoJBPNaYmlTLzY6K/7rWmJpUy82Oiv+CVpiaVMvNjor/flaYmlTLzY7Kv7kW2FoVDA1OisFGlpiaVMvNjor/glaYmlTLzY6K/35WmJpUy82OyoAAAAI+tb+YwGOBcYABAAJAA4AEwAZAB4AIwAoAAAFFwMjGwEnEzMDATcFByUFByU3BQE3JRcGBQEHBSclEycDNxMBFxMHA/4YB7VaibcJtlmIAZQPAR0U/sz7vA/+4xQBMwOxBgFHMyj+7/x5Bf63MgE6bBBISn0CghBKTHs8Dv6tAWEEog4BUv6g/hEMfGJHOwx8YkcBrhCZRBex/I4RmUXIAuQCAUZF/tX84wL+u0cBKwAAAAACAD4AAAPUBnAAEgAbAAABIQMzMhYHDgEjIQEjNzM3MwchAQMzMjY3NiYjAyT+1nD5q6YhJOi5/lABBbAesCe3JwEq/ipZ+V99ExNCZwUa/c7MpLLGBRqWwMD8o/5Cf11igAAAAwBXAAAFFwWwAAMADgAXAAABBwE3AQMjASEyFgcGBCMlITI2NzYmIyEEr3/+9n/93HW1ASMCBM7LJyv+7OH+zwFPg7EZGmaP/rECPmQBk2X+eP22BbDww9bdlaN5hZoAA//i/mAEJgROAAMAFgAkAAAlBwM3JQ4BIyImJwMjATMHFz4BMzISAyM2JiMiBgcDHgEzMjY3A5OA7n8BSjPovluLLWq2ASucCAM7lFqypzS2KGKJSXYwahtrVnyfIQ1lAXVlX//3REP97gXabgFAQ/6s/vzJ9VJI/fFDSLylAAABAEgAAATwBwEACQAAASMVIQEjASETMwSOAv13/vu2ASMCjES1BRsB+uYFsAFRAAABADUAAAPRBXgACQAAASMVIQMjEyETMwNzBf43urbYAc5AtgOkAfxdBDoBPgAAAAABAFf+3gS5BbAAFQAAASEDMzISAwIAIzcyNjc2JisBAyMBIQSb/Xdfqvv0Njj+8N8bhasmKY2/qoa2ASMDPwUa/ib+0P7v/uf++JHSvtLQ/V8FsAABADX+5QOMBDoAFQAAASEDMzIWBwYCByc+ATc2JisBAyMTIQNu/jc5aMnfLB7ovBOChxcdfYdoYbbYAn8Do/7i/t2M/uskkCKedZmj/hoEOgAAAAABAEgAAAVQBbAAFAAACQIjAyMHIzcjAyMBMwMzEzMDMwEFUP4CAQLiu0gxkTFchLYBI7aBXDSRNEYBqgWw/U/9AQKV9/f9awWw/XoBAv7+AoYAAAABAD4AAASfBDoAFAAACQETIwMjByM3IwMjEzMDMzczBzMBBJ/+XevloCknkCdZXLbYtlxZK5ArJAFHBDr9//3HAc/ExP4xBDr+NdbWAcsAAAEA8wAABoYFsAAOAAABIwMjASE3IQMzATMJASMDU4mEtwEF/l8eAlh/kwIj5v1rAYTPApX9awUblf2EAnz9KP0oAAAAAQClAAAFjAQ6AA4AAAEjAyMTITchAzMBMwkBIwL1eFy2uv6AHgI2XGwBqdr+CQE/5gHP/jEDpJb+NQHL/fr9zAAAAAABAFcAAAfIBbAADQAAASETIQchASMTIQMjATMBqwKUhAMFHv2w/vu1gf1sgbUBI7UDGwKVlfrlAob9egWwAAAAAQA1AAAFjgQ6AA0AAAEhEyEHIQMjEyEDIxMzAWUBwl4CCR7+rbq2XP4+XLbYtgJkAdaW/FwB0P4wBDoAAQBX/t8HWgWwABcAAAEzMhIDAgAjNzI2NzYmKwEDIwEhASMBIQT9bvv0Njj+8N8bhasmKY2/boa1AQX9av77tQEjBAADQf7Q/u/+5/74kdK+0tD9XgUa+uYFsAABADX+5QY8BDoAFwAAATMyFgcGAgcnPgE3NiYrAQMjEyEDIxMhA+Sd0uksHui9EoKGFx2GkJxhtrr+Pbq22AMvAoX+3Yz+6ySQIp51maP+GgOj/F0EOgAAAgBl/+IFxAXFACkANwAABSImJw4BIyICEzcSADMHIgIPAQISMzI2NyYCPwE2ADMyEg8BBgIHHgEzAQYWFz4BPwE2JiMiBgcE4GCoSkudVfL6PCI6ASfDHmq+KCM0lrgiRCJkSyIuMgEJsKOdMDIimXIsYjz+ISE4WWyUHTMlP2FXnyAeJSYiIAGOASyqASUBUZz+9Mys/v/+4gkLZQERqOb/AST+zvH6q/74XQ0KAjmk5khL5o/9vMrgpgACAE7/6wR8BE8AKQA4AAAFIiYnDgEjIgITNzYSMwciBg8BBhYzMjY3LgE/AT4BMzIWDwEOAQceATMDNzYmIyIGDwEGFhc+ATcD+1mTPj16P9S5OAsp9IsfRm4eDCdseRQnFEcuHBUl2IGMbSoVF2dLJFIvkRUZHjQ6VhoVFSo8NUkUDBwdISEBOgETO80BDpummD289gQFTdaKZ73v7tNpcL9NDg0Bl2x+pYqFa2ejOzeXYgABAOj+oQZkBbAADwAAASE3IQchAyEBMwEzAyMTIQJG/qIeA3ce/pznApYBBbX++413oUb8JwUblZX7egUb+un+CAFfAAEAiP6/BM8EOwAPAAABIzchByMDIRMzAzMDIxMhAYL6HgKTHuOcAcO6trt7cKJA/QsDppWV/O8Dpfxb/ioBQQACANEAAAVIBbAAAwAXAAABIxMzCQEjEw4BIyImNxMzAwYWMzI2NxMC1ZGMkQHn/t21emKnctfHMFu3WyVjl1u9Y4sBQAK8AbT6UAJhHRrS7gHG/jq3cxwcArgAAAIAlwAABB4EOwADABcAACUjEzMTIxMOASMiJjcTMwMGFjMyNjcTMwI3kXGRnrZOOXBBr64qP7U/Hk5sOnQ9a7bmAjX85QGIEA/MzAE6/saRcBAQAhoAAAABANAAAAVGBbAAEwAAMwEzAz4BMzIWBwMjEzYmIyIGBwPQASO1el+odNbHL1u3WyRjll27Y4sFsP2eHBzT7f46Aca2dB0b/UgAAAAAAgCu/+kF7gXDAB4AJwAABSACEzcuATczBhYXNxIAMzISAwchBwYWMzI2NxcOAQEhNzYmIyICBwNa/v74OBaJdyCRFTJMAjsBXd3qxT0V/McULonOX6VGEza9/psChAYtY7CO6igXAVgBGWwXwZtldhIHASYBSv6e/sttZeX3MSaGJkADWSHh6f7wygACACX/7ARRBE4AHAAkAAAFIgI/AS4BNzMGFhc2JDMyEg8BIQYWMzI2NxcOAQMiBgchNzYmAknOzicCYk8akA4SIz0BEJzHqyMT/WwYa4dalzwzQLkBWqApAdoEE1kUASrxECGpgUdcGcXj/vvdea3FOTJ7OksDzKqGGn2ZAAAAAAEASP7ZBVAFsAAWAAAzIwEzAzMBMwEWEgcCACM3MjY3NiYrAf62ASO2fncCY9P9ktrKMjn+8d8bhawmKI3A9wWw/YsCdf2HGP7X/P7n/viR0r7R0AAAAAABAD7+/QRfBDoAFgAAAR4BBwYCByc+ATc2JisBAyMTMwMzATMCgKOiJR3luxKAhBcciJOdXLbYtlxQAcXaAmIf3LmH/vkjkCGSbpaL/jEEOv41AcsAAAAAAQBX/ksFegWwABcAAAEDIRMzAQ4BIyImJzceATMyNjcTIQMjAQIwhAKThLf+yyW7lBwwGisMPBE2VhOT/W2BtgEjBbD9awKV+fe1pwkJkQUIaV0C3/16BbAAAAABADX+SwQ7BDoAFwAAAQMhEzMDDgEjIiYnNx4BMzI2NxMhAyMTAcNeAcJetuolupUcMBorDDwRNlcTb/4+XbbYBDr+KgHW+221pwkJkQUIaV0CKf4wBDoAAgBG/+sFQAXFABYAHgAAASAAAwcCACMgAhM3ITc2AiMiBgcnPgEDMhI3IQcGFgMmARMBBzshQP6L7f7z7z4WA6oMMZngZK5KEjfGN5n/Mf0NBy2FBcX+j/7Vo/7D/qIBYAE2bzn4AQ4yJYYlQvq7ARfWI+LoAAAAAQA2/+sEhQWwABsAAAkBITchBwEeAQcGBCMiJjczBhYzMjY3NiYrATcB0wG//a0eAygW/hzDvSgs/uDVrOArtxpsdnu5GCF1nIcdA1MBx5Z1/hEO4sfZ0dbTf5WXeqqDkAAAAAH/7f51BDoEOgAcAAAJASE3IQcBHgEHBgQjIiY3MwYWMzI2NzYmKwE/AQGGAa39wR4DKBb+Kb21Jyv+39Ws3im3Gmx2e7kYInadiAcWAdwBx5d1/g8R4cTX0tfRfZWXeKqDI20AAAD//wAK/ksE/QWwACYArEQAACYB08BAAAcBmgDtAAAAAP////v+SwPkBDoAJgDnTwAAJgHTnY4ABwGaAN4AAAAAAAIANgAABPMFsAAKABMAAAETMwEhIiY3NiQzGwEhIgYHBhYzA8p0tf7d/f3PyCcrARHjvXP+soSwFxxljwNsAkT6UPXF1d39KQJCpHeHoAAAAgA2AAAGCwWwABgAIQAAISImNzYkMyETMwE3PgE3PgEnMx4BBwYEIycTISIGBwYWMwHNz8gnKwER4wFOdLX++lBlhh0RBAywCgMRLv75puZz/rKEsBccZY/1xdXdAkT65AEBjIJOpVJpkkrP1ZUCQqR3h6AAAAAAAgBA/+kGMAYYACIAMwAAExIAMzIWFxMzAwYWMz4BNz4BJzcWBgcCACMGJicOASMiAjcBLgEjIgYPAQYWMzI2Nz4BN3M4AQTCUnUmdrbzFjxKgbEpFQsIrwcFFDn+zMFxgxVEpGmvoC8C0RhcS322JQQkU4hMfTQCAwMCCgEbASlDQQJO+0FkdQHRv2TGaAF6u17+8f7pAlReWVcBIOoBPj1E77sVtLxMRhUcEQAAAAABAOj/6AWbBbAALQAAATc2JisBNzMyNjc2JiMhNyEyFgcOAQceAQ8BBhYzPgE3PgEnMxYGBwIAIwYmNwJ7DRpgcLIef5OsGxpolP6zHgFN1MwoGox3ZUQZDhE3QG6hKBULCLAGBBM6/t+xmIEcATJBgoiWgIWEfpbSyH6gLymufUVQYAHVu2THaIawXf7z/ucDmq4AAQCI/+MEpQQ6AC4AACUGFjM+ATc+ASczHgEHBgQjBiY/ATYmKwE3MzI2NzYmKwE3MzIWBw4BBxUeAQ8BApIKGi1miiAPBAywCwQQMf71p4NnFA8PT1/EG6tqgBARVHPzF/m2uR4SbGBTPREP1i0vApmOTqFQbItI2+IDb4RMT0qUVk5YW5Sql1ltIgMceVZOAAAAAAIAz/7EA7sFsAAhACsAABM3MzI2NzYmKwE3MzIWBw4BBx4BDwEGFhcHIyY2PwE2JiMBDgEHJz4BPwEzzx6WlasbG2aU/x7/08soGot4ZUYZGw8IHAW6HwUPGxlgcQGuFn9eVzxGER+2AnqWgoKIf5XUyX2fLymvfYhJZSQZJHxNhIKH/cRrx0hISpBVlwAAAAIAvP61A20EOgAiACwAABM3MzI2NzYmIyE3ITIWBw4BBxUeAQ8BBhYXByMmNj8BNiYjAQ4BByc+AT8BM7wew2t/EBJTdP77HAEGtrgeEm5iVD0SFAoKHAS7HgILExFOYAGcFn9eVzxGER+2AbqUVk9aWZSomFtuIgMeg15hMVIWExdjM19YVv51a8dISEqQVZcAAAAB//H/6AcfBbAAIQAAASEDAgArATczMhIbASEDBhYzPgE3PgEnNxYGBwIAIwYmNwSQ/kdrV/7+8TEeJoS8QokDJN4VPEqAsSkVCwivBwUUOf7MwKKFHgUa/eb+Uv6ulQEiAUkCsPupZXQB0b9kxmgBerte/vH+6QOtxAAAAf/s/+gF8wQ6ACEAAAEDBhYzPgE3PgEnMxYGBwYAIwYmNxMhAwoBKwE/ATI2NxMEMpMVO0llkSUUCQmvBwITNf7vqKCGH3X+4D5F1MY1IyhfhDFcBDr9H2R1AbmpXrxjeK1Y+P8AA63EAkr+y/6o/uqiAdf0AcwAAQBO/+gHJgWwAB0AAAEDBhYzPgE3PgEnNxYGBwIAIwYmNxMhAyMBMwMhEwVq3hU7SoGxKhQLB68HBBQ6/svBoIYfPP1ygbYBI7aEAo6EBbD7qWR1AdG/Y8ZpAXy5Xv7x/ukDrcQBLf16BbD9awKVAAEANf/oBgUEOgAdAAABIQMjEzMDIRMzAwYWMz4BNz4BJzMWBgcGACMGJjcDEv40XLXYtV4BzF62kxU7SWaRJRMJCK4HARM1/u+poIYfAc/+MQQ6/ikB1/0fZHUBualdvGR7qlj4/wADrcQAAAEAYP/rBJsFxQAhAAAFIgIbARIAMzIWFwcuASMiAAcDBhYzPgE3PgEnMxYGBwYEAjXk8TU1OgFj+WOhN1M4flCc/wAnNSyLqoGnHxILBLABAxEw/tYVAV4BDAEGASIBSC0qgyIi/vPF/vjZ/AGajlWxY518UNziAAEARv/rA5oETgAhAAAlPgE3PgE3Mw4BBw4BIyICPwE2ADMyFhcHLgEjIgYPAQYWAfJbWRQMDQOvAQoLJNqdy8MuCDEBINNTgiVGJ2pBebkfCCNcgAFVVz1zPEVxNqKgATviKvQBKCMfjRse7JoqrNwAAAAAAQDX/+gFJAWwABkAAAEhNyEHIQMGFjM+ATc+ASc3FgYHAgAjBiY3Ao7+SR4ELx7+PsAWPEqBsCsUCwivBwQVOf7MwaCGHgUalpb8P2R1AdG/Y8ZpAX24Xv7x/ukDrcQAAQCs/+gEfAQ6ABkAAAEhNyEHIQMGFjM+ATc+ASczHgEHBgQjBiY3AfT+uB0DTB3+snUWO0xliiAQBgyuCwQRMP71qKGGHgOmlJT9s2tuAZuPUKZQaJRK3eMDrcQAAAAAAQBq/+sFQwXFAC0AAAEHIyIGBwYWMzI2NzMGBCMiJDc+ATcuATc2JDMyFgcjNiYjIgYHBhY7AQczDwEDgAaqoswbG5qsi+EYtS7+tN3l/vsoG6WMZ2EVKgEx+cf9JLYXlYqdzRcZfaqqBwEKBwK7IIOHhI2fdeTF4siLqCcxo2TYxt21dYeTcX58Ii8lAAD//wDpAowFAAMhAEYBhtwAUzNAAP//AQACjAYJAyEARgGGtQBmZkAA////aP5uAxEAAAAnAEH/0v8DAAYAQQQAAAEA1gQCAkUGKwAJAAATPgE3Fw4BDwEj+RV/X1k9SBEktQSxa8dIR0qQVrIAAQCxA+cCIAYYAAkAAAEOAQcnPgE/ATMB+xV+X1g7RxIltgVhbMdHSEiRVroAAAAAAf+k/tYBEAD6AAkAADcOAQcnPgE/ATPuFn9eVztGEiO2T2vHR0dIkVauAP///2ED5wDQBhgARwFmAYEAAMABQAAAAP//ANYEAgNyBisAJgFlAAAABwFlAS0AAP//AL0D5wNSBhgAJgFmDAAABwFmATIAAAAC/6T+1gItAPoACQATAAA3DgEHJz4BPwEzFw4BByc+AT8BM+4Wf15XO0YSI7b7Fn9fVztHEiO2T2vHR0dIkVauq2vHR0dJkVWuAAAAAQCVAAAERgWwAAsAAAEhAyMTITchEzMDIQQu/oyVtpX+kRgBbzy2PAF0A6P8XQOjlwF2/ooAAAABABD+YARVBbAAEwAAKQEDIxMhNyETITchEzMDIQchAyEDqP6LQrZC/pMYAW1+/pIYAW48tjwBdBj+jH4Bdf5gAaCVAw6XAXb+ipf88gAAAAEArwIYAl8D3gANAAATPgEzMhYPAQ4BIyImN80Se1tUVhEMFHhcU1gSAxheaG9XPV9kbFcAAAD//wBHAAACvgDFACYAEAEAAAcAEAGbAAD//wBHAAAERADFACYAEAEAACcAEAGbAAAABwAQAyEAAAAGAK7/6wbhBcUAGQAnADUAQwBRAFUAAAE+ATMyFhc+ATMyFg8BDgEjIiYnDgEjIiY3AT4BMzIWDwEOASMiJjcBBhYzMjY/ATYmIyIGBwUGFjMyNj8BNiYjIgYHAQYWMzI2PwE2JiMiBgcTJwEXAvEbtYNBXhoteEp5fBkPHLODQl8ZLnhIen0a/fUbtIR5fBkPHLODen0aAqERNklCYhAPEDVIQmQPAZkRNklBYxAPEDVIQmQP/C8RNklCYhAPEDVIQmQPElgDelgBZYmjPzc5Pa5+TouhPTg5PK1/A4GKo65/TYqhrX78zFJjaUxOUWRqS05SY2lMTlFkaksC5lFjaUtNUmRrS/vXQQRyQQAAAAEAgACaAm0DtAAHAAABEyMDPwEBMwEvn4jGAwEBYYgCJ/5zAYQNBgGDAAAAAQAhAJkCDQO0AAgAAAETBzMHASMBAwFJxAIBA/6hiQE8nQO0/nwGDf58AY0BjgAAAQAJAG8D2wUiAAMAADcnARdhWAN6WG9BBHJBAAIAiwIwA3UFxQAKAA8AAAEzByMHIzchNwEzATMTJwcC6osZiyWfJf5ZDwImo/3t+04DFANmfbm5XgJ+/aEBhgIeAAAAAQCjAosDewW6ABQAAAEfAT4BMzIWBwMjEzYmIyIGBwMjEwHABAMsckVtZB9mpmAWLkAwUR5wpqAFq28BPkGWnf4EAd1xUzs1/c8DIAAAAAABAC0AAAR/BcUAJwAAAQ4BByEHITczPgE3IzczNyM3Mzc+ATMyFgcjNiYjIgYPASEHIQchBwGeFTkmAqwf/HYeCS5PGJ8emhiUHo4ZLPW1sa0jtxpbYViOGxkBiB7+fRkBfx4Bvl2VN5WVDbJqlpGWld3Y07CEaZeIlZaRlgAAAAMASf/sBiEFsAAKABMAKwAAAQMjASEyFgcGBCMnMzI2NzYmKwElAzMHIwMGFjMyNjcHDgEjIiY3EyM3MxMBb3G1ASMBSc3KJyv+6eB2lIKzGRtljpQDlDW/HL+EEiQrFDMTAhxdLGNjIISNHI01Ajb9ygWw+MXX5pareoakJv75jf1qVjkIBYMRFY+cApaNAQcAAAABAGD/6wRiBcUAKQAAASEGFjMyNjcHDgEjIgI3IzczNyM3MzcSADMyFhcHLgEjIgYPASEHIQchA2n+NSd2jjNtNAw6cjrN2TKJGIkhiBiIBDUBNN81bDsxMGM2g84jBAHLGP41IgHLAgK/wxERmA8QASL1eKl6EQEJAQ4QD5oQE9CvE3qpAAAABADj/+sFMAXFABsAKQA3ADsAAAEOASMiJj8BPgEzMhYHIzYmIyIGDwEGFjMyNjcTBhYzMjY/ATYmIyIGBzM+ATMyFg8BDgEjIiY3AScBFwL/FrBvfWocDxm3cXpuF4cMMzo/VBAPEDE7PU0MYRp9eoOzHA8ZfHmDtRuHD2RCSDUQDxBiQkk2EQF/WPyGWAQebJKhik1/rot0OU9kUk1Kakw7/Pl/raGLTn6uo4lLamRRTkxpY1IDykH7jkEAAAAAAgBn/+sD6wXFABoAJgAABSImPwEOASM3MjY3Ez4BMzIWDwEGAA8BBhYzEzc2JiMiBgcDPgE3AkjEjS4DMF8yIzReL2AjwXt2ax8IIP8AthQdQminCQ8bIDJCF01lfhgV3+UQDg2uDA0B37HKn50qm/66aWaRmAPXLE9RZnn+gErQeQAABABOAAAIaQXAAAMAEQAfACsAAAEhNyEBPgEzMhYPAQ4BIyImNzMGFjMyNj8BNiYjIgYHASMBIwMjATMBMxMzB3X9+RwCB/46IMuYjI8dFyDLl42QHp8UPFRJbRIXEjxRS2wS/eO2/lID47UBI7UBrgPjtgFrjQJ5oa67lHWirLmVYWRtWHVeZm5W+48EcPuQBbD7kQRvAAACASMDlwTkBbAADgAWAAABEzMDIxMnAyMDIwMjEzMHIwMjEyM3IQOU6mZrVkUC1S9KA0lXa2zEh1tXW4cQAWUEIAGQ/ecBXwH+oAFs/pQCGVH+OAHIUQAAAgB8/+wEjwROABUAHgAAJQ4BIyICNzYAMzISDwEhAx4BMzI2NwMiBgcDIRMuAQOQXrdaweQuMQFjw7fXLgn9NkIrdElUvl20QpRBNwH2OShyXjg6AUno9gE7/srnL/64Njg8PgMqQTn+6wEeNjsA//8A/v/1BgUFsgAnAckAjgKGACcBdAD1AAAABwHQAxAAAAAA//8ArP/1BpAFwAAnAcsAhwKUACcBdAGfAAAABwHQA5sAAAAA//8Aqv/1Br0FrwAnAc0AfwKOACcBdAHTAAAABwHQA8gAAAAA//8BHv/1BiMFrwAnAc8AjwKOACcBdAEhAAAABwHQAy4AAAAAAAIAJv/rBFoF7QAUACEAAAEWEgMHAgAjIgI3NgAzMhYXNzYmJwMyNj8BLgEjIgYHBhYCpOvLRRY1/sTRwdYqMgEV01KNLgMJoJVvd9EjFRGJeXmuHx1vBe1L/j3+qHD+9v7eARjO/QEDQTsB2eM9+zHnsGpRac2dkMEAAAABADn/KgVBBbAABwAABSMTIQMjASEENrXz/W7ztgELA/3WBfD6EAaGAAAAAAH/u/7zBOQFsAAMAAAJASEHITcJATchByEBA1z9UgNEHvvnHALH/locA9Ae/QQBlwJB/UiWjQLOAtSOlv1AAAABAM8CjAP1AyEAAwAAASE3IQPX/PgeAwgCjJUAAQBoAAAFKQWwAAsAAAEVFzcBMwEjAyM3IQH1AyUCU7n834lqrR4BMAFPWAFZBGH6UAJ1lwAAAAADAEn/6weABE4AGQAnADUAAAEGACMiJicGBCMiAj8BNgAzMhYXNiQzMhIHBQYWMzIAPwEmAiMiBgchNiYjIgAPARYSMzI2NwdGMf7nxZGyMWr++J23tC0OMAEYxpGzMWwBB5+0syz51yVRe3gBBy8IBoqEb6shBWYjUHd6/vkwCAWKhG+rIgH68/7k2p+g2QEw30TyAR7cnqDa/s7eRLfDASBoKmwBGtOntcX+4Wcqb/7n0akAAAAAAf87/ksDHQYtABwAAAUOASMiJic3HgEzMjY3Ez4BMzIWFwcuASMiBgcDAQUdtZQbMBkkDTwPOFEQ0R3Amx9AJS4RJxlPaRDRWbGrCQmRBQhpXQUetrILCowFBm5k+uIAAgBQARoEPgP7ABsANwAAEz4BMzYWFx4BMzI2NxcHDgEjIiYnLgEHIgYHJwM+ATM2FhceATMyNjcXBw4BIyImJy4BByIGByfFPIA+QTNWSjU+OYQ4Axg8gDw6Q0FUNUE6hTYDRzyAPUE0Vk4wPjmFNwMXPYA9OkBCWy5COoQ2AwNoRkwBFzMuF0xCAaNHSxwpMhgBTUEB/vpGTAEXMzAWTUIBpEdLHCk2FQFNQgEAAAABAI4ApAQIBN8AEwAAATMHIQMhByEHJzcjNyETITchExcDS70g/vWyAYog/iikR3u/IAENs/5zIAHav0cDzZ7+/57sOrKeAQGeARI7AAAA//8ASAACBDkEjQBnAB4AdACyQAA5mgAHAYb/ef12AAD//wBHAAAEEgSgAGcAIAA4AMRAADmaAAcBhv94/XQAAAACAGcAAAPaBbAABQAPAAABMxMBIwMhAy8BBwETHwE3Am2I5f38ieYCuokGAx7+sIkGAx4FsP0n/SkC1wIDNwE4/f39/jcBOP//AI8AsgIbBOsAJwAQAEkAsgAHABAA+AQmAAAAAgCUAnoCngQ6AAMABwAAASMTMxMjEzMBHYlZic+JWYkCegHA/kABwAAAAAAB/+b/LwEjAOwACQAAJQ4BByc+AT8BMwEOFGpSWDA6EBatgGKvQEg/e0xvAAIAaAAABBcGLQAXABsAADMTIzczNz4BMzIWFwcuASMiBg8BMwcjAyEjEzNovJ4cnhgn5Lc7ekc+LGk8aHsWGMkcybwCIbbYtgOtjXfFtyAdmhYda213jfxTBDoAFv+1/nIIMwWuAA0AHQArADsAQQBHAE0AUwBcAGAAZABoAGwAcAB0AH0AgQCFAIkAjQCRAJUAAAE2JiMiBg8BBhYzMjY3FzI2NzYmLwE+ATc2JisBAycOASMiJj8BPgEzMhYHBQ4BIyImNyMGFjMyNjcTIwETMwczByE3MzczAwETIQcjByU3IQMjNwEyFgcOASsBNwE3IQchNyEHITchBxM3IQchNyEHITchBwEzMhYHDgEHIwUjNzM3IzczAyM3MyUjNzM3IzczAyM3MwMkE2RaZIkVFhRjXWKJFt9abBEJIicBJzEJD1xar25oD1Y4QDQPFg1YOT40DgNYCT8kMSgLVhFVUk9wEUxW+UM/aSi2FwTMF7koZz/6LzkBHxe2IgWkFwEgOWci/GkxJggIPC11IgHgFwECF/2LFwEBF/2MFwEAF4oXAQIX/YsXAQEX/YwXAQAXAY5XOywICDwvYf0KaTNpGWkyaclpMmkGu2czZxlnMmfJZzJnAkRge3JpcGJ5cWrYSFMtRA0DDjorS0v929hFTkhLcERPSUqbLDYpMlJSVlUBevtPATvKcXHK/sUGHwEddKmpdP7jqfy2KysoK6kDSnR0dHR0dPk4cXFxcXFxBFsdKiYpAZb8fvr8Ffl+/H76/BX5AAAABQCH/dUHfAhiAAMAHQAhACUAKQAACQMFPgE3PgE3NiYjIgYHMz4BMzIWBw4BBw4BBxcjBzMDMwcjATMHIwTDArn7wf1KA5ULIixMcBEbe456vBy9C0ApMCwKCzswVUcTqrwivNAEAQQCGgQBBAZS/DH8MQPP8To3GyiAUIyLg4c0M0A0NkgdOVZaW6r9TAQKjQQAAAEAH//vA84EjQAeAAAbASEHIQM+ATc2FgcOASMiJj8BBhYzMjY3NiYjIgYHk8YCdSD+KF4pcDatkiYn4tKgxiG4E1xhaYkXF01iW24gAfkClJ7+wRomAgPGvMHDoaIOXWF+cXZ2PDUAAgAnAAAC1wMhAAoADwAAATMHIwcjNyE3ATMBMxMnBwJhdhl2H50f/nwMAfag/hjjQAMUARh+mppiAiX99wFCARsAAAACAFH/6wRiBcUADQAbAAABAgAjIgIbARIAMzISAyc2JiMiBgcDBhYzMjY3A+Y9/uzQvrY4RTwBFNDAtDeuKVd/c6wmVCpYfnSrJwIs/tH+7gEqARcBVwEuART+1f7pKNGzxMD+W9G1xcEAAAAB/+D+3wKzA0EADwAAETMyEgMCACM3MjY3NiYrAcT79DY4/vDfG4WrJimNv8QDQf7Q/u/+5/74kdK+0tAAAAAAAf8d/ksBJACYAA8AACUHDgEjIiYnNx4BMzI2PwEBJDAluZUbMBksDDsROFMTMJjxtqYJCZoFB2Bc8QAAAf96/mYBPgBAABMAADceAQcOASMiJic3HgEzMjY3NiYnpFhCDxaKYzpZHzYdLB82PwkKLDJANIxNaWQaEncMDzEpNk8zAAAAAf/C/pkA3wCaAAMAABMjEzN4tme2/pkCAQAAAAIBNwTZA6EGzgANACEAAAEOASMiJjczBhYzMjY3Ew4BIyImIyIGByc+ATMyFjMyNjcDdRWog3mFE5MMMUY/UQu+EWpFMGcoHjcHSw9qRSdvKR04CAWuaG12XzhARDQBCVFiTDQlFU5nTDMmAAIBNwTgA2wHAgANAB0AAAEOASMiJjcjBhYzMjY3JTc+ATc2JiM3MhYHDgEPAQLdClA+RjILjhOEeIGkFP68GEg8BwZLPxeIeQ4LVj0OBbAzQT03XXNrZRB8AxcgHx1QSEc3Ngg+AAAAAgE3BN8DgQaJAA0AEQAAAQ4BIyImNzMGFjMyNjcnMwcjA4EUq4Z9iBOUCzRIQFMKK5S/YwWwZWxzXjc+QjPZxgAAAAACAQ8E5APABtIABwAbAAABIycHIyclMzcOASMiJiMiBgcnPgEzMhYzMjY3A8Ckl9eeAQFIf+EOaUAtXSUcPAVFDWpAI2clGzoGBOSfnwPw5URYSDAcE0JeRiwdAAIBCwTkBKkGzgAGABYAAAEjATM3FzMnNz4BNzYmIzcyFgcOAQ8BAvW2/syj3ZGkNxlCNQgGQjcWemsQDVA3DQXp/vu6uomDBRYkIiFcUVA/Pgc8AAIAXwTSA70GgAAHAAsAAAEjJwcjJwEzBSMDMwO9v3y8uQEBQZL+kIeJwgTSn58DAQJYAQEAAAAAAgEXBOQFHgaSAAcACwAAATMTIycHIycBMwMjAlqT2796vLsBA0TD8IkF6f77n58DAav+/wAAAAACAQ0EpwOfBnkADQARAAABDgEjIiY3MwYWMzI2NwcjJzMDnxrCloqWGJIOQFxSZw5ckZzRBbCBiJJ3R01TQQXOAAAAAAEBLwSQAkYGFwAFAAABNzMPASMBTKBaRxu1BSP0/YoAAv/UAAAD6ASNAAcACwAAASEDIwEzEyMBIQMnAwH+J5i8Ap6ry7v+TQFwUQMBEP7wBI37cwGkAfsBAAAAAwA+AAAEGgSNAA8AGAAhAAAzEyEyFgcOAQcVHgEHDgEjCwEzMjY3NiYjJzMyNjc2JisBPukBcrzFHxNtVlpKEyTjv5JM+2GAExNSaeC7b48SEl9/uwSNnp9bfh4DGZJjsJgCC/6IYFpgXolbV19BAAEATf/vBEIEnQAbAAABBgQjIgI/ATYAMzIWByM2JiMiBg8BBhYzMjY3A9w4/vPAuNIuIzABMMi5wxu2DV92bskeIyJteG6aKgGO0M8BH+Ks9AEN0suKf9GbrarEgooAAAIAPgAABEkEjQAJABMAADMTITISDwEGBCMLATMyNj8BNiYjPukBiLrgKiou/svMBq7RcNAcKx18egSN/vPR0uT5A/n8mr2N05eyAAABAD4AAAQdBI0ACwAAASEDIQchEyEHIQMhA0/+EE0CPx39CukC9h79wUMB7wIV/n6TBI2U/rAAAAEAPgAABB8EjQAJAAABIQMjEyEHIQMhA0r+EGW36QL4Hv2/SAHwAfj+CASNlP6UAAEASv/vBF4EnQAfAAAlDgEjIgI/ATYkMzIWDwE2JiMiBg8BBhYzMjY/ASM3IQPNOPKrzeEqMS0BN9rBuhG0CGV2fdMbMSB9jl2QITLxHgGlnUJsAQnV8+X4xqQBbWq7jfScry0c/JUAAQA+AAAEpASNAAsAACEjEyEDIxMzAyETMwO7tmP98GO36bdpAhBptgHu/hIEjf31AgsAAAEAPgAAAd0EjQADAAAzIxMz9LbptgSNAAEAC//vA9EEjQAPAAABMwMOASMiJjczBhYzMjY3Ax20oiXxqa63I7YXV2lPihUEjfzUuLqyr3Fde2QAAAEAPgAABHEEjQAMAAABIwMjEzMDMwEzCQEjAbRaZbfpt2ZOAdHa/eQBU+UB+P4IBI3+AgH+/dH9ogAAAAEAPgAAAvsEjQAFAAAlIQchEzMBEgHpHf1g6beTkwSNAAAAAAEAPgAABY4EjQAPAAAlFwEzAyMTJwEjAyMDIxMzAqQDAgTj6bWkA/4ifZcDp7fp6/cBA5f7cwM1AfzKA0T8vASNAAAAAQA+AAAEvgSNAAsAACEjASMDIxMzATMTMwPVtP6EA6236bcBewOutANh/J8EjfydA2MAAAIATf/vBG8EnQANABsAAAEGACMiAj8BNgAzMhIHJzYmIyIGDwEGFjMyNjcEHzL+09jH1C4jMQEu2MbULbUlb4t+xCIjJm+Lf8MjAfD6/vkBG+as+AEJ/uTlAbqywautvLLBrQACAE3/iwRvBJ0AEwAhAAABDgEHFwcnDgEjIgI/ATYAMzISByc2JiMiBg8BBhYzMjY3BB8WUTx7knw7f0fH1C4jMQEu2MbULbUlb4t+xCIjJm+Lf8MjAfBsp0Gib6AfHQEb5qz4AQn+5OUBurLBq628ssGtAAIAPgAABD8EjQAaACMAAAEDIxMhMhYHDgEHHgEPAQ4BFwcjJjY/ATYmIyczMjY3NiYrAQFVYLfpAa21tiAVcmVYPhQUDAETBLsSCQwUE0tf9fZrgRIUUXT2AeL+HgSNs6JjeCYgjmdlNlwYExppO2NjXpVhWWRkAAEAI//vBDIEnQAlAAABNiYnLgE3PgEzMhYHIzYmIyIGBwYWFx4BBwYEIyImNzMGFjMyNgMAD12Wx5weIPrHusAitRRhc2+RDxBWpMGbHSL+/tO25Sa1GIF0dKEBL05RLDuRl5+hu6xlbmBLUEsuO5eTp5qqvXhcYQAAAAABAL0AAAQlBI0ABwAAASEDIxMhNyEEB/6zy7XL/rgeA0oD+fwHA/mUAAAAAAEAWP/vBLwEjQARAAABAwYEIyImNxMzAwYWMzI2NxMEvJkr/t/ZxeEombSZHH+Ee78amQSN/QHVytzDAv/9AYiEjn4C/wAAAAEAvgAABMoEjQAJAAABHwE3ATMBIwMzAf0GAycB28L9ZanIwwEgVQFUA2/7cwSNAAEA1AAABfIEjQATAAABNzMHATMTNzMHATMBIwMjASMDMwGMAgICAYGpGgICAgFbw/4FqCcD/n6mKcIBCQkHA4L8fAkHA4L7cwNd/KMEjQAAAf/jAAAEhQSNAAsAAAkBMwETIwMBIwEDMwJTAVzW/iH/1LT+ntgB7fzWAtcBtv2//bQBv/5BAkwCQQAAAQC1AAAEgQSNAAgAAAkBMwEDIxMDMwIoAY7L/dtStVT0ywJNAkD9Dv5lAaUC6AAAAf/5AAAEFgSNAAkAADchByE3ASE3IQfvAnEd/LYXAw79xh4DFBaTk3IDh5RuAAAAAgBK/+8EIASdAA0AGwAAAQYEIyImNxM2JDMyFgcnNiYjIgYHAwYWMzI2NwO0K/76w7TCKEUqAQjEssEntRtecWijGUUcYXFnohkBm9fV58UBV9TX58QBiY2Yfv6oio+ZgAAAAAEArAAAAk0EnQAFAAAhIxMHNyUBYbXEwBsBggPTA4hFAAAAAAEADwAAA6YEnQAYAAApATcBPgE3NiYjIgYHIz4BMzIWBw4BBwEhAuX9Kh0BzHVVDRI9VFuGEbYg8bSbniIYd8X+3QH1kwGYZXFAXWt1VqC/tqh3f7D++gABACD/7wPJBJ0AKQAAATMyNjc2JiMiBgcjPgEzMhYHDgEHHgEHDgEjIiY3MwYWMzI2NzYmKwE3AXWcXHUSEE9lTIQOtR/uo6mzHxNyWVJHEyP3upfHIrQRWF5fjxIWUmucFQKaYlVUZGJKnaOroFmDJCWHYa+nq6hXaW9UbVhpAAIAJQAAA8kEjQAKAA4AAAEzByMHIzchNwEzARMnAQMStx63L7Uv/eYUArq7/q9pA/5EAYKV7e12Ayr89QIJAf32AAAAAQAeAAAEVQXFABgAACkBNwE+ATc2JiMiBgcjNiQzMhYHDgEHASEDi/yTGgIml3MTF1Zmhq0btSkBGt6ttCMapp3+QQKTgwITkadbeY2ejdDx5LGC2pb+VwAAAAACAE7/7wO7BJ0AGwAoAAABMhYXBy4BIyIGDwEXPgEzMhYHDgEjIiY3EzYkEyIGDwEGFjMyNjc2JgLBO4c4OjJjRmu4GRQDNoxUpJojJf24prwnPyoBIitPgSgIHFpkXZcUF08EnRsYjxkVpYBhAjE0x7K5xfjEATfU5/20Qjoqip+IY3RwAAAAAQC9AAADwwSNAAwAAAEGAgMHIzcSADchNyEDpePUOCW1JTsBAsT9ux4C6AP57f7I/uW5uQEpAVbBlAAAAwAj/+8D3wSdABcAIwAvAAABDgEHHgEHDgEjIiY3PgE3LgE3PgEzMhYBNiYjIgYHBhYzMjYTNiYjIgYHBhYzMjYDwBR2W1hVEyP+tKzRIRSObk5JESHwr5m4/uESaF5epBAUb2hYmVsQWFBTixASYFlKhQNdYIEjKYxesKe1omiNJCeBVqaap/1UXWpxVmFnbgJpU11gUFZeZQAAAgBt/+8DyASdABsAKAAAJTI2PwEnDgEjIiY3NiQzMhYHAwYEIyImJzceARMyNj8BNiYjIgYHBhYBhmCqFxUDMXxFrawjJAECt6S2JkUo/vC8PIc5ODRlq02GJQsbWGFamhMXUIKXcGoCLy3PrrXS98T+qMXWGhiQGhUBpU03N4mell1wfwAAAAEAfwAAAcEDLAAFAAAhIxMHNyUBH6CEdxoBGwKUAYIXAAAAAAEAIgAAAswDLAAZAAApATcBPgE3NiYjIgYHIz4BMzIWBw4BDwEXIQJH/dsZAU1ONwkLJzk8VQqdFrOIeHoXEl6LsAEBVX4BCD5KLDc8QjRwhX90V2JwjwMAAAAAAQAl//UC3gMsACkAAAEzMjY3NiYjIgYHIz4BMzIWBw4BBx4BBw4BIyImNzMGFjMyNjc2JisBNwEeeztKCwo2QzFPCJ8VsHuAixYNUUA7NAwZuI1ymBefCjk+QF0KDTZGexEB1Ts1MTczKWxvd248WhgaXEN5cnV0NDc8MkU1VQABAO0AAALSBbAABQAAISMTBTclAa+1+f76GAHNBNwId2UAAAABACv/9QLoAyEAHgAAGwEhByEHPgE3NhYHDgEjIiY/AQYWMzI2NzYmIyIGB32LAeAa/qw8Hk4pfmwaG6igepsXnwxBQ0ZYDg41QTpKFAFaAceBvxIZAQKOgoSGbm8LNzNHREpMJB8AAAIAQP/1AscDLAAbACgAAAEyFhcHLgEjIgYPARc+ATMyFgcOASMiJj8BPgETIgYPAQYWMzI2NzYmAg4vZCQzI0cxSXoQDAMlYz11chgZvot9kBsrHdcpOVkXARI9Qj9hDA41AywTEHsQD2BQOwIgIox6f4iqh9aTnf5ZLygIVl1NPEdCAAEAjwAAAswDIQAMAAABDgEPASM3PgE3ITchArOgjiUZnhkotnL+fRkCJAKioca8f3/I92R/AAAAAwAu//UC9QMsABcAIwAvAAABDgEHHgEHDgEjIiY3PgE3LgE3PgEzMhYDNiYjIgYHBhYzMjYTNiYjIgYHBhYzMjYC4A1VQj8+DBi8iYKgFw1mTzk1DBezhHSO5AtGPz5rCwxMRjpjOgo6NjZYCQtAOjBUAlBBWRkdYT56cnxwRWEbHFg6cmpz/i46P0Q1Ojo+AZczMjUwMzc6AAAAAgBk//UC5gMsABsAKAAAJTI2PwEnDgEjIiY3PgEzMhYPAQ4BIyImJzceARMyNj8BNiYjIgYHBhYBQUBuDgwDIFEugYIZGMCKeo0aLxvMji1lKzIlSX01VxMFETxAPGAKDzVzVkU/Ah4ckHp8kayG64eTEhB7Eg0BGDMlF1VeVTlITAAAAgA+//UDGAMsAA0AGwAAAQ4BIyImPwE+ATMyFgcnNiYjIgYPAQYWMzI2NwLPHsWSh5UcLx3EkoeVGqAQQEtGZw8vEkBNRGcRARuTk56I65GVoIYBVFJYTuxXUVhQAAAAAQC5AowDKgMhAAMAAAEhNyEDDP2tHgJTAoyVAAMBKwRCAz0GcwAEABAAHAAAATMXByMHPgEzMhYHDgEjIiY3BhYzMjY3NiYjIgYCirIB8G6lD29HPksOD2pEQVFhCCYjHTkHCCIhIDwGcwO1101ZX0dNVVtHJy0wJCgwMwAAAAACAPUEcANuBdYABQAPAAABEzMHASMnPgE3Fw4BDwEjAgWpwAT+7VX8EnBeOzI4DhCkBIMBQhX+wlRchS86LmdHUAAAAAEALv/rBEsFxQArAAABPwIzMjY3NiYjIgYHIzYkMzIWBw4BBx4BBwYEIyImNzMGFjMyNjc2JisBAaYLAwifdIkYG1h2Z6EXtSQBDMK0vCcVh3RuSBUs/uzFstAmthpmeHClGx5ZhZ8CwzcPJ4d1iHuKcrja1sdlrS4utm/Y0ti+f4KKh5V2AAACACcAAAQcBbAACgAPAAABMwcjAyMTITcBMwEhEycHA1q8HrtEtET9nhUDIb/86wGfjAMgAeiV/q0BU2sD8vw4ArwBOgAAAAABAGH/6wRpBbAAHwAAGwEhByEDFz4BNzYSBwYEIyImNzMGFjMyNjc2JiMiBgfW7gKlIv30fwMwcEe+ny0w/v3ZpMUpqxtja2+pIB9cd2d2JQKRAx+p/mABIywCAv775O34ysqEe7Kcm6lJSQACAGT/6wQ5BcUAGwAoAAABMhYXBy4BIyIGDwEXPgEzMhIHBgAjIgIbARIAEyIGDwEGFjMyNjc2JgNKQ4YmQylcRYvqKAQDRKJbrKspMf7tx77QOTk8AVkgXJczFyxxfWutHx9eBcUjGpEaHvnKEgE0Of7y0PP+9gE0ARkBHwEtAUH9c1ZKctzK0JigsAAAAAAD/5H+SgRTBE4ALwA/AE0AAAEjHgEPAQYEIyImJw4BBwYWOwEyFgcGBCMiJjc+ATcuATc+ATcuAT8BPgEzMhYXIQEiJicOAQcGFjMyNjc2JiMDBhYzMjY/ATYmIyIGBwQ4lhUNCgUh/wC1JkIeGyUHCjU6oLKyHhz+yefC0BcUc1MWEQkPUDxFOhMFIf65Iz8gAWH84xQjEDNNCxBsgYjRDg9KdLESYmVamBEFEmFkXZgQA6orYTYWo8IKDBQ0JDEjkpOIzKJ0ZH8nFjsmTl8lMpVYFqm9Cgr79AIEF109TVd6RU9BAqRadn1TFl1zelYAAAAAAQDrAAAEiwWwAAwAAAEIAQMHIzcSABMhNyEEbf7Q/wBtLbYtbQFA8/0xHgOCBRr+xf4i/piZmQFhAhgBCJYAAAH/zv5MBFoESQAjAAABMhYfAQEzARMeATMyNjcHDgEjIiYnAwEjAQMuASMiBiM3PgEBRW9ZGjMBSrb+LGIPLCkMDBQhCyMNY10eQP6QwAIETQ08OQo0AhwWOQRJlHf7Aff9L/4hS00CA5wGCX+QAT39yQMTAYFUZAWSBQoAAAAAAwA1/+sEWAXFABcAIwAvAAABDgEHHgEHBgQjIiY3PgE3LgE3PgEzMhYBNiYjIgYHBhYzMjYTNiYjIgYHBhYzMjYEMhqVcGtoFy3+78y/0SkarIRdVhcq+72rv/7CGnF1brUYG298bbF7F19kX5kXGV5oXJoENX6mKC+3etvD1MqItiktp3HRv9D8mISRm3qIhZADIXeHi3N7fogAAgBA/+sEkQROABQAIgAAJScOASMiAj8BEgAzMhYXMzczCwEjAQYWMzI2PwE2JiMiBgcDHwNJw4GvoC8EOAEEwneRHQNMrNACrP4SJVSHZalCCApPbX22JeABeX0BIOoVARsBKYB55f3i/eQB9bXA2LAmrN7yvAAAAgBB090pTwWwABoAKwAAAQchFgABFhIPAQYAIyICPwE2JDc6ARcmAic3AwYWMzI2PwE2JicuASMiBgcERR3+Xg8mutnNiXMfBDP+39jHwS8EKQEO0ggPCgbXKheIJVyKfLshBBk6PhMnGIbDHwWwkh3O3DB8nv73nhj9/uwBKegYzPkZAQcBBUFy/EyyytmjGH2qNgYG0JkAAAAAAgBYAAAE+QWwAAkAEwAAMwEhIBIDBwIAIRMDMzI2PwE2JiNYASMBXgEu8jwxQv62/rZc56nX/i4xMZTqBbD+z/7S8/62/uwFGvt74+b2988AAAAAAgA3/+sD/QROACAAKwAAITQ2NycOASMiJjc+ATsBNzYmIyIGByM+ATMyFgcDDgEXJTI2PwEjIgYHBhYCoAMDAkGtXZqIIST/2bUcFFdsZYAPtRzi07WqI20NCQT+OVerLC67e5sTEDosNxsBQFSgobaWiWZRYUmOsp+w/ds9ZjeKUTnkbmJTSwAAAAACAFcAAATuBa8ADgAXAAABDgEHEwcjAyEDIwEhMhYBITI2NzYmIyEExh2efcQEy6v+sHu2ASMB2NLK/LgBJIGsGhtnkf7eBAuLuy/9fBICav2WBa/a/iqOgIiFAAEAWAAABVgFsAANAAABBwMjATMDFzcBMwkBIwIuu2a1ASO1kAO4Ai3Q/WkBtuMCq63+AgWw/TECrQIk/YP8zQABADYAAAQxBhgADQAAAQcDIwEzAxc3ATMJASMBvIVLtgE4tr4DdgF52f4bATXWAfB4/ogGGPxLAXIBZv45/Y0AAQBYAAAFVgWwAAsAAAEDIwEzAzMBMwkBIwGXirUBI7WCDAK74f0JAfrfArL9TgWw/XgCiP05/RcAAAAAAQA2AAAEFAYYAAwAAAEjAyMBMwMXATMJASMBVARktgE4trUDAbfr/eoBZt8B9P4MBhj8eAEBq/4O/bgAAgB9/+sEVwXFABsAKAAAJTI2PwEnDgEjIgI3NgAzMhILAQIAIyImJzceARMyNj8BNiYjIgYHBhYBpYDTKwYDOZNXvLowMQEktsvENkg+/svfRZA1ODRwx2KeMB4qX4liuyAjWoDZ1x0BREABCOz3ARD+5f7s/pz+zf7sHB+QHRkB32RNmNK1z6KsswACAD4AAARDBI0ACgATAAABAyMTITIWBw4BIyczMjY3NiYrAQFJVLfpAbKyuCAl98Pe/GiQEhRUcfsBpv5aBI3QpLPAlIJbZX0AAAD//wELBKUDTwWwAgYAnAAA//8AAAAAAAAAAAIGAAMAAP//AD4CIQIjArYCBgAPAAAAAgBeAAAFOwWwAA0AGwAAMxMjNzMTISAAAwcCACETIQMhMhI/ATYCKwEDIXaFnR6dgAF6AQABKDcnPv6s/u93/v9nAQ+x8ysoLL/HxWIBAQKalQKB/pT+7cX+zf7HApr9+wEB1sjeAQj+FQAAAgBeAAAFOwWwAA0AGwAAMxMjNzMTISAAAwcCACETIQMhMhI/ATYCKwEDIXaFnR6dgAF6AQABKDcnPv6s/u93/v9nAQ+x8ysoLL/HxWIBAQKalQKB/pT+7cX+zf7HApr9+wEB1sjeAQj+FQAAAQBTAAAENwYYABwAAAEjAxc+ATMyFgcDIxM2JiMiBgcDIxMjNzM3MwczAvz8OANApF6bjyuHtYgeT29JjzmetvehHqAktiT9BNL+6QJITdDZ/VsCp5Z3VEj86ATSlbGxAAAAAAEA7AAABQsFsAAPAAABIwMjEyM3MxMhNyEHIQMzA7HLpLWk0x7TQ/5aHgQBHv5aQ8sDNvzKAzaVAU+Wlv6xAAABAAf/7AKkBUEAHwAAAQMzByMHMwcjAwYWMzI2NwcOASMiJjcTIzczNyM3MxMCGjW/HL8m1R7VQBIkKxQzEwIcXSxjYyBAyB7IJo0cjTUFQf75jb6V/r1WOQgFgxEVj5wBQ5W+jQEH////1QAABH8HIgImACMAAAAHAEIBawFd////1QAABMMHHwImACMAAAAHAHMCFwFZ////1QAABI0HRgImACMAAAAHAJoBBgFd////1QAABNQHUQImACMAAAAHAKABJQFg////1QAABMwHDAImACMAAAAHAGgBBwFc////1QAABH8HiAImACMAAAAHAJ4BkgGo////1QAABMYHnwImACMAAAAHAdQBiQEs//8AYv5EBPgFxQAmACUAAAAHAHcBt//3//8AWAAABPIHIgImACcAAAAHAEIBNwFd//8AWAAABPIHHwImACcAAAAHAHMB4wFZ//8AWAAABPIHRgImACcAAAAHAJoA0gFd//8AWAAABPIHDAImACcAAAAHAGgA0wFc//8AYgAAAkQHIgImACsAAAAHAEL//AFd//8AYgAAA1MHHwImACsAAAAHAHMApwFZ//8AYgAAAx4HRgImACsAAAAHAJr/lwFd//8AYgAAA10HDAImACsAAAAHAGj/mAFc//8AWAAABXoHUQImADAAAAAHAKABTgFg//8AXv/rBTYHNwAmADEAAAAHAEIBjAFy//8AXv/rBTYHNAAmADEAAAAHAHMCOAFu//8AXv/rBTYHWwAmADEAAAAHAJoBJwFy//8AXv/rBTYHZgAmADEAAAAHAKABRgF1//8AXv/rBTYHIQAmADEAAAAHAGgBKAFx//8AZ//rBVcHIgImADcAAAAHAEIBdwFd//8AZ//rBVcHHwImADcAAAAHAHMCIwFZ//8AZ//rBVcHRgImADcAAAAHAJoBEgFd//8AZ//rBVcHDAImADcAAAAHAGgBEwFc//8A7gAABVMHHQImADsAAAAHAHMB6QFX//8AOv/sA/cF4AImAEMAAAAHAEIAswAb//8AOv/sBAsF3QImAEMAAAAHAHMBXwAX//8AOv/sA/cGBAImAEMAAAAGAJpOGwAA//8AOv/sBBwGDwImAEMAAAAGAKBtHgAA//8AOv/sBBQFygImAEMAAAAGAGhPGgAA//8AOv/sA/cGRgImAEMAAAAHAJ4A2gBm//8AOv/sBA4GXgImAEMAAAAHAdQA0f/r//8AR/5EA/sETgImAEUAAAAHAHcBOf/3//8AR//sA+sF4QImAEcAAAAHAEIAkQAc//8AR//sA+sF3gImAEcAAAAHAHMBPQAY//8AR//sA+sGBQImAEcAAAAGAJosHAAA//8AR//sA/IFywImAEcAAAAGAGgtGwAA//8APgAAAd0FywImAIoAAAAGAEKVBgAA//8APgAAAuwFyAImAIoAAAAGAHNAAgAA//8APgAAArcF7wImAIoAAAAHAJr/MAAG//8APgAAAvYFtQImAIoAAAAHAGj/MQAF//8ANQAABDIGDwImAFAAAAAHAKAAgwAe//8ARv/sBBwF4AImAFEAAAAHAEIApwAb//8ARv/sBBwF3QImAFEAAAAHAHMBUwAX//8ARv/sBBwGBAImAFEAAAAGAJpCGwAA//8ARv/sBBwGDwImAFEAAAAGAKBhHgAA//8ARv/sBBwFygImAFEAAAAGAGhDGgAA//8AWv/sBDsFywImAFcAAAAHAEIAxgAG//8AWv/sBDsFyAImAFcAAAAHAHMBcgAC//8AWv/sBDsF7wImAFcAAAAGAJphBgAA//8AWv/sBDsFtQImAFcAAAAGAGhiBQAA////vP5LBCoFyAImAFsAAAAHAHMBNQAC////vP5LBCoFtQImAFsAAAAGAGglBQAA////1QAABN4G+gImACMAAAAHAG4BJgFK//8AOv/sBCYFuAImAEMAAAAGAG5uCAAA////1QAABLAHTAImACMAAAAHAJwBYQGc//8AOv/sA/gGCgImAEMAAAAHAJwAqQBaAAL/1f5QBH8FsAAaAB4AAAEzEyMOAQcGFjMyNjcHDgEjIiY3PgE3AyEDIwEhAycDBJvgJVdiCQYbKBkwFwcgTDJPWA8LY180/c7SuAHbAc1cAwWw+lA+ZDwlJRELeBMZY1pJfTYBe/58AhkCoAEAAAACADr+UAP3BE4ANAA/AAAhNDY3Jw4BIyImNzYkOwE3NiYjIgYHIzYkMzIWBwMOARcjDgEHBhYzMjY3Bw4BIyImNz4BNyUyNj8BIyIGBwYWAqAEBQNCrl2WiR4iAQHQvhYVV2dYjg61GwEAtqS1ImgNCQQTV2IJBhsoGTAXByBMMk9YDwtbWP7wV60vKMNrpBARQTM+HwFIXayWqKJuaWlkRoW7u6/99j1mNz5kPCUlEQt4ExljWkZ5NItgRMl7U1BPAAD//wBi/+sE+Ac0ACYAJQAAAAcAcwIhAW7//wBH/+wD+wXdAiYARQAAAAcAcwEqABf//wBi/+sE+AdbACYAJQAAAAcAmgEQAXL//wBH/+wD+wYEAiYARQAAAAYAmhkbAAD//wBi/+sE+AciACYAJQAAAAcAnQHRAXL//wBH/+wD+wXLAiYARQAAAAcAnQDaABv//wBi/+sE+AdcACYAJQAAAAcAmwEmAXP//wBH/+wD+wYFAiYARQAAAAYAmy8cAAD//wBYAAAFHQdHACYAJgAAAAcAmwDgAV7//wBE/+sFwwYYACYARgAAAAcBkQSgBSz//wBYAAAE8gb6AiYAJwAAAAcAbgDyAUr//wBH/+wEBAW5AiYARwAAAAYAbkwJAAD//wBYAAAE8gdMAiYAJwAAAAcAnAEtAZz//wBH/+wD6wYLAiYARwAAAAcAnACHAFv//wBYAAAE8gcNAiYAJwAAAAcAnQGTAV3//wBH/+wD6wXMAiYARwAAAAcAnQDtABwAAQBY/lAE8gWwACAAAAEhAyEHIw4BBwYWMzI2NwcOASMiJjc+ATcnIQEhByEDIQQC/ZJpAsweNFdiCQYbKBkwFwcgTDJPWA8LWlQB/V0BIwN3Hv0+YAJuAqb975U+ZDwlJRELeBMZY1pGeDIDBbCW/iIAAAACAEf+ZAPrBE4AKQAxAAAlDgEHDgEHBhYzMjY3Bw4BIyImNz4BNycmAj8BNgAzMhIPASEGFjMyNjcDIgYHITc2JgNbIVM0U14IBhsoGTAXByBMMk9YDwg/OQHIyicHJwEptMerIxP9bBhrh1qXPMdaoCkB2gQTWXEeMxI7YjslJRELeBMZY1o5YywDAwEp7y31ASX++915rcU5MgLMqoYafZkA//8AWAAABPIHRwImACcAAAAHAJsA6AFe//8AR//sA+sGBgImAEcAAAAGAJtCHQAA//8AaP/rBQ8HWwImACkAAAAHAJoBBgFy//8AN/5LBD0GBAImAEkAAAAGAJpWGwAA//8AaP/rBQ8HYQImACkAAAAHAJwBYQGx//8AN/5LBD0GCgImAEkAAAAHAJwAsQBa//8AaP/rBQ8HIgImACkAAAAHAJ0BxwFy//8AN/5LBD0FywImAEkAAAAHAJ0BFwAb//8AaP3lBQ8FxQImACkAAAAHAZEBRv62//8AN/5LBD0GbQImAEkAAAAHAaUBKABW//8AWAAABXkHRgImACoAAAAHAJoBKQFd//8ANQAABBkHRQImAEoAAAAHAJoAYwFc//8AYgAAA2UHUQImACsAAAAHAKD/tgFg//8APgAAAv4F+gImAIoAAAAHAKD/TwAJ//8AYgAAA28G+gImACsAAAAHAG7/twFK//8APgAAAwgFpAImAIoAAAAHAG7/UP/0//8AYgAAA0EHTAImACsAAAAHAJz/8gGc//8APgAAAtoF9QImAIoAAAAGAJyLRQAA////mv5YAjoFsAImACsAAAAGAJ/jCAAA////e/5QAjEGGAImAEsAAAAGAJ/EAAAA//8AYgAAAogHDQImACsAAAAHAJ0AVwFd//8AYv/rBnYFsAAmACsAAAAHACwCJAAA//8ARP5LBCEGGAAmAEsAAAAHAEwB6AAA//8AD//rBSwHOQImACwAAAAHAJoBpQFQ////G/5LAsQF3AImAJgAAAAHAJr/Pf/z//8APv31BTUFsAAmAC0AAAAHAZEBIP7G//8ANv33BCgGGAImAE0AAAAHAZEAxP7I//8AWAAAA60G4AImAC4AAAAHAHMAjwEa//8ARAAAA0MHXAImAE4AAAAHAHMAlwGW//8AWP33A60FsAImAC4AAAAHAZEBGv7I////qP33AjEGGAImAE4AAAAHAZH/wv7I//8AWAAAA9UFsQImAC4AAAAHAZECsgTF//8ARAAAA3IGGAAmAE4AAAAHAZECTwUs//8AWAAAA60FsAImAC4AAAAHAJ0BNP3F//8ARAAAAukGGAAmAE4AAAAHAJ0AuP23//8AWAAABXoHHwImADAAAAAHAHMCQAFZ//8ANQAABCEF3QImAFAAAAAHAHMBdQAX//8AWP33BXoFsAImADAAAAAHAZEBd/7I//8ANf33BBgETgImAFAAAAAHAZEA7P7I//8AWAAABXoHRwImADAAAAAHAJsBRQFe//8ANQAABCMGBQImAFAAAAAGAJt6HAAA//8ANQAABBgGGAImAFAAAAAHAZEAiwUs//8AXv/rBTYHDwAmADEAAAAHAG4BRwFf//8ARv/sBBwFuAImAFEAAAAGAG5iCAAA//8AXv/rBTYHYQAmADEAAAAHAJwBggGx//8ARv/sBBwGCgImAFEAAAAHAJwAnQBa//8AXv/rBZkHYAAmADEAAAAHAKEBqgFy//8ARv/sBLQGCQImAFEAAAAHAKEAxQAb//8AVwAABQIHHwImADQAAAAHAHMB3AFZ//8ANQAAA4cF3QImAFQAAAAHAHMA2wAX//8AV/33BQIFrwImADQAAAAHAZEBE/7I////pv33Aw0ETgImAFQAAAAHAZH/wP7I//8AVwAABQIHRwImADQAAAAHAJsA4QFe//8ANQAAA4oGBQImAFQAAAAGAJvhHAAA//8AQ//rBMAHNAAmADUAAAAHAHMB1gFu//8AO//sA9MF3QImAFUAAAAHAHMBJwAX//8AQ//rBMAHWwAmADUAAAAHAJoAxQFy//8AO//sA8kGBAImAFUAAAAGAJoWGwAA//8AQ/5EBMAFxQAmADUAAAAHAHcBbP/3//8AO/5FA8kETgImAFUAAAAHAHcBN//4//8AQ/3jBMAFxQAmADUAAAAHAZEBBP60//8AO/3kA8kETgImAFUAAAAHAZEAz/61//8AQ//rBMAHXAAmADUAAAAHAJsA2wFz//8AO//sA9UGBQImAFUAAAAGAJssHAAA//8A7P31BQsFsAImADYAAAAHAZEBDP7G//8ARf3tAqQFQQImAFYAAAAHAZEAX/6+//8A7P5VBQsFsAImADYAAAAHAHcBdAAI//8Ab/5NAqQFQQImAFYAAAAHAHcAxwAA//8A7AAABQsHRgImADYAAAAHAJsA2gFd//8Ab//sA7QGMQAmAFYAAAAHAZECkQVF//8AZ//rBVcHUQImADcAAAAHAKABMQFg//8AWv/sBDsF+gImAFcAAAAHAKAAgAAJ//8AZ//rBVcG+gImADcAAAAHAG4BMgFK//8AWv/sBDsFpAImAFcAAAAHAG4Agf/0//8AZ//rBVcHTAImADcAAAAHAJwBbQGc//8AWv/sBDsF9QImAFcAAAAHAJwAvABF//8AZ//rBVcHiAImADcAAAAHAJ4BngGo//8AWv/sBDsGMQImAFcAAAAHAJ4A7QBR//8AZ//rBYQHSwImADcAAAAHAKEBlQFd//8AWv/sBNMF9AImAFcAAAAHAKEA5AAGAAEAZ/5uBVcFsAAoAAABAw4BBw4BBwYWMzI2NwcOASMiJjc+ATcnIgYjIiY3EzMDBhYzMjY3EwVXxSW4jE5cCQYbKBkwFwcgTDJPWA8IOTQBBBYG1u0wxbbFJYqWkeIixQWw/CW22jI3YzklJRELeBMZY1o2XioDAfzuA9v8JbafragD2wAAAAABAFr+UAQ7BDoAJwAAIQ4BBwYWMzI2NwcOASMiJjc+AT8BJw4BIyImNxMzAwYWMzI2NxMzAwNiV2IJBhsoGTAXByBMMk9YDwpeWRIDP6JlnZMwf7Z/JkNpX5Mzm7XYPmQ8JSURC3gTGWNaRno1jwFSVOHwAn39gb53W1MDBvvG//8A7AAABuwHRgImADkAAAAHAJoBnAFd//8AsgAABfoF7wImAFkAAAAHAJoBFQAG//8A7gAABVMHRAImADsAAAAHAJoA2AFb////vP5LBCoF7wImAFsAAAAGAJokBgAA//8A7gAABVMHCgImADsAAAAHAGgA2QFa//8AIAAABH0HHwAmADwAAAAHAHMB0QFZ//8ACAAAA+oFyAImAFwAAAAHAHMBPgAC//8AIAAABFsHDQAmADwAAAAHAJ0BgQFd//8ACAAAA98FtgImAFwAAAAHAJ0A7gAG//8AIAAABH8HRwAmADwAAAAHAJsA1gFe//8ACAAAA+wF8AImAFwAAAAGAJtDBwAA////ngAAB3UHHwImAH8AAAAHAHMDAQFZ//8ABP/rBmAF3gImAIQAAAAHAHMCegAY//8AJv+jBWsHXQImAIEAAAAHAHMCMQGX//8ATP95BDgF3AImAIcAAAAHAHMBUAAW//8ACwAABEkEjQImAakAAAAHAdP/Uv97//8ACwAABEkEjQImAakAAAAHAdP/Uv97//8AvQAABCUEjQImAbgAAAAGAdMo9wAA////1AAAA+gF3wImAaYAAAAHAEIA2QAa////1AAABDEF3AImAaYAAAAHAHMBhQAW////1AAAA/sGAwImAaYAAAAGAJp0GgAA////1AAABEIGDgImAaYAAAAHAKAAkwAd////1AAABDoFyQImAaYAAAAGAGh1GQAA////1AAAA+gGRQImAaYAAAAHAJ4BAABl////1AAABDQGXQImAaYAAAAHAdQA9//q//8ATf5HBEIEnQImAagAAAAHAHcBU//6//8APgAABB0F3wImAaoAAAAHAEIAqgAa//8APgAABB0F3AImAaoAAAAHAHMBVgAW//8APgAABB0GAwImAaoAAAAGAJpFGgAA//8APgAABB0FyQImAaoAAAAGAGhGGQAA//8APgAAAd8F3wImAa4AAAAGAEKXGgAA//8APgAAAu4F3AImAa4AAAAGAHNCFgAA//8APgAAArkGAwImAa4AAAAHAJr/MgAa//8APgAAAvgFyQImAa4AAAAHAGj/MwAZ//8APgAABL4GDgImAbMAAAAHAKAAsQAd//8ATf/vBG8F7wImAbQAAAAHAEIA3QAq//8ATf/vBG8F7AImAbQAAAAHAHMBiQAm//8ATf/vBG8GEwImAbQAAAAGAJp4KgAA//8ATf/vBG8GHgImAbQAAAAHAKAAlwAt//8ATf/vBG8F2QImAbQAAAAGAGh5KQAA//8AWP/vBLwF4AImAbkAAAAHAEIA9QAb//8AWP/vBLwF3QImAbkAAAAHAHMBoQAX//8AWP/vBLwGBAImAbkAAAAHAJoAkAAb//8AWP/vBLwFygImAbkAAAAHAGgAkQAa//8AtQAABIEF2wImAb0AAAAHAHMBWAAV////1AAABEwFtwImAaYAAAAHAG4AlAAH////1AAABB4GCQImAaYAAAAHAJwAzwBZAAL/1P5QA+gEjQAaAB4AAAETIw4BBwYWMzI2NwcOASMiJjc+ATcnIQMjAQMhAycDHcs3V2IJBhsoGTAXByBMMk9YDwtqZin+J5i8Ap74AXBRAwSN+3M+ZDwlJRELeBMZY1pMgDj//vAEjf0XAfsBAP//AE3/7wRCBewCJgGoAAAABwBzAXoAJv//AE3/7wRCBhMCJgGoAAAABgCaaSoAAP//AE3/7wRCBdoCJgGoAAAABwCdASoAKv//AE3/7wRCBhQCJgGoAAAABgCbfysAAP//AD4AAARJBgQCJgGpAAAABgCbLhsAAP//AD4AAAQdBbcCJgGqAAAABgBuZQcAAP//AD4AAAQdBgkCJgGqAAAABwCcAKAAWf//AD4AAAQdBcoCJgGqAAAABwCdAQYAGgABAD7+UAQdBI0AIAAAASEDIQcjDgEHBhYzMjY3Bw4BIyImNz4BNychEyEHIQMhA0/+EE0CPx1CV2IJBhsoGTAXByBMMk9YDwtaVAH99ukC9h79wUMB7wIV/n6TPmQ8JSURC3gTGWNaRngyAwSNlP6wAAAA//8APgAABB0GBAImAaoAAAAGAJtbGwAA//8ASv/vBF4GEwImAawAAAAGAJpzKgAA//8ASv/vBF4GGQImAawAAAAHAJwAzgBp//8ASv/vBF4F2gImAawAAAAHAJ0BNAAq//8ASv3nBF4EnQImAawAAAAHAZEA9/64//8APgAABKQGAwImAa0AAAAGAJp7GgAA//8APgAAAwAGDgImAa4AAAAHAKD/UQAd//8APgAAAwoFtwImAa4AAAAHAG7/UgAH//8APgAAAtwGCQImAa4AAAAGAJyNWQAA////c/5QAd0EjQImAa4AAAAGAJ+8AAAA//8APgAAAiQFygImAa4AAAAGAJ3zGgAA//8AC//vBKYF+QImAa8AAAAHAJoBHwAQ//8APv3zBHEEjQImAbAAAAAHAZEArP7E//8APgAAAvsFwQImAbEAAAAGAHND+wAA//8APv31AvsEjQImAbEAAAAHAZEAjP7G//8APgAAAxAEjgImAbEAAAAHAZEB7QOi//8APgAAAvsEjQImAbEAAAAHAJ0Aif0m//8APgAABL4F3AImAbMAAAAHAHMBowAW//8APv31BL4EjQImAbMAAAAHAZEBGv7G//8APgAABL4GBAImAbMAAAAHAJsAqAAb//8ATf/vBG8FxwImAbQAAAAHAG4AmAAX//8ATf/vBG8GGQImAbQAAAAHAJwA0wBp//8ATf/vBOoGGAImAbQAAAAHAKEA+wAq//8APgAABD8F3AImAbYAAAAHAHMBOQAW//8APv31BD8EjQImAbYAAAAHAZEAsP7G//8APgAABD8GBAImAbYAAAAGAJs+GwAA//8AI//vBDIF7AImAbcAAAAHAHMBZAAm//8AI//vBDIGEwImAbcAAAAGAJpTKgAA//8AI/5HBDIEnQImAbcAAAAHAHcBPf/6//8AI//vBDIGFAImAbcAAAAGAJtpKwAA//8Al/31BCUEjQImAbgAAAAHAZEAsf7G//8AvQAABCUGAwImAbgAAAAGAJs/GgAA//8AWP/vBLwGDwImAbkAAAAHAKAArwAe//8AWP/vBLwFuAImAbkAAAAHAG4AsAAI//8AWP/vBLwGCgImAbkAAAAHAJwA6wBa//8AWP/vBLwGRgImAbkAAAAHAJ4BHABm//8AWP/vBQIGCQImAbkAAAAHAKEBEwAbAAEAWP57BLwEjQAoAAABAw4BBw4BBwYWMzI2NwcOASMiJjc+ATcnIgYjIiY3EzMDBhYzMjY3EwS8mR2QcFBbCAYbKBkwFwcgTDJPWA8HNC4BBQ0LxeEombSZHH+Ee78amQSN/QGLszA5YDolJRELeBMZY1ozWigDAdzDAv/9AYiEjn4C/wAAAP//ANQAAAXyBgMCJgG7AAAABwCaAQwAGv//ALUAAASBBgICJgG9AAAABgCaRxkAAP//ALUAAASBBcgCJgG9AAAABgBoSBgAAP////kAAAQWBdwCJgG+AAAABwBzATcAFv////kAAAQWBcoCJgG+AAAABwCdAOcAGv////kAAAQWBgQCJgG+AAAABgCbPBsAAP//ACP/7whdBJ0AJgG3AAAABwG3BCsAAP///9UAAAR/BngCJgAjAAAABgCpPAAAAP//AJsAAAVWBnoAJgAnZAAABwCp/zcAAv//ALwAAAXdBnoAJgAqZAAABwCp/2MAAv//AMYAAAKeBnkAJgArZAAABwCp/2cAAf//AHL/6wVKBngAJgAxFAAABgCpmgAAAP//AEkAAAW3BngAJgA7ZAAABwCp/uUAAP//ADEAAAUcBngAJgC1FAAABgCphAAAAP//AGz/6wMkBj8CJgC+AAAABwCq/yv/t////9UAAAR/BbACBgAjAAD//wBYAAAE0AWwAgYAJAAA//8AWAAABPIFsAIGACcAAP//ACAAAARbBbAABgA8AAD//wBYAAAFeQWwAgYAKgAA//8AYgAAAjoFsAIGACsAAP//AD4AAAU1BbAABgAtAAD//wBYAAAGswWwAgYALwAA//8AWAAABXoFsAIGADAAAP//AF7/6wU2BcUABgAxAAD//wBYAAAFGAWwAgYAMgAA//8A7AAABQsFsAIGADYAAP//AO4AAAVTBbACBgA7AAD////8AAAFHQWwAgYAOgAA//8AYgAAA10HDAImACsAAAAHAGj/mAFc//8A7gAABVMHCgImADsAAAAHAGgA2QFa//8AQP/rBDQGegImALYAAAAHAKkBWwAC//8AKf/tA/0GeQImALoAAAAHAKkBFgAB//8ANf5hBBIGegImALwAAAAHAKkBMAAC//8Afv/rAtQGZgImAL4AAAAGAKkq7gAA//8AWv/rBAUGPwImAMYAAAAGAKoMtwAA//8APgAABGAEOgIGAIsAAP//AEb/7AQcBE4CBgBRAAD////r/mAEMwQ6AgYAdAAA//8AlwAABAoEOgIGAFgAAP///+kAAAPxBDoCBgBaAAD//wB+/+sDJQW1AiYAvgAAAAcAaP9gAAX//wBa/+sEBgW1AiYAxgAAAAYAaEEFAAD//wBG/+wEHAZ6AiYAUQAAAAcAqQEOAAL//wBa/+sD9AZmAiYAxgAAAAcAqQEM/+7//wBd/+sF7AZjAiYAyQAAAAcAqQIj/+v//wBYAAAE8gcMAiYAJwAAAAcAaADTAVz//wBXAAAEuQcfAiYArAAAAAcAcwHhAVkAAQBD/+sEwAXFACUAAAE2JicuATc2JDMyFgcjNiYjIgYHBhYXHgEHBgQjIiQ3MwYWMzI2A34YcLPWsSgjAQXD2OkqthyJkmmdERpmu9uwJyX+9czZ/uMwtSO4mmqrAUx3hEJIy8axsuzWi6F0V393R0/Hw7ir1uurgXIA//8AYgAAAjoFsAIGACsAAP//AGIAAANdBwwCJgArAAAABwBo/5gBXP//AA//6wRSBbACBgAsAAD//wA+AAAFNQWwAAYALQAA//8APgAABTUGxwAmAC0AAAAHAHMBxQEB//8Ao//rBUUHTAImANkAAAAHAJwBPgGc////1QAABH8FsAIGACMAAP//AFgAAATQBbACBgAkAAD//wBXAAAEuQWwAgYArAAA//8AWAAABPIFsAIGACcAAP//AFgAAAV6B0wCJgDXAAAABwCcAY4BnP//AFgAAAazBbACBgAvAAD//wBYAAAFeQWwAgYAKgAA//8AXv/rBTYFxQAGADEAAP//AFgAAAV7BbACBgCxAAD//wBYAAAFGAWwAgYAMgAA//8AYv/rBPgFxQAGACUAAP//AOwAAAULBbACBgA2AAD////8AAAFHQWwAgYAOgAA//8AOv/sA/cETgIGAEMAAP//AEf/7APrBE4CBgBHAAD//wBAAAAERwX1AiYA6wAAAAcAnADIAEX//wBG/+wEHAROAgYAUQAA////4v5gBCYETgIGAFIAAAABAEf/7AP7BE4AGwAAJTI2NzMGBCMiAj8BNgAzMhYHIzYmIyIGDwEGFgHxWqAPrBn+8qbXuyUHJwER4a7BGqwQameNpBoHHFWBeFyazwEy6ir1ASfeqmyG4qQqsdYAAP///7z+SwQqBDoCBgBbAAD////pAAAD8QQ6AgYAWgAA//8AR//sA/IFywImAEcAAAAGAGgtGwAA//8APgAAA5UFyAImAOcAAAAHAHMA5wAC//8AO//sA8kETgIGAFUAAP//AEQAAAIxBhgCBgBLAAD//wA+AAAC9gW1AiYAigAAAAcAaP8xAAX///8d/ksCOQYYAgYATAAA//8AQAAABGEFxwImAOwAAAAHAHMBTQAB////vP5LBCoF9QImAFsAAAAGAJx/RQAA//8A7AAABuwHIgImADkAAAAHAEICAQFd//8AsgAABfoFywImAFkAAAAHAEIBegAG//8A7AAABuwHHwImADkAAAAHAHMCrQFZ//8AsgAABfoFyAImAFkAAAAHAHMCJgAC//8A7AAABuwHDAImADkAAAAHAGgBnQFc//8AsgAABfoFtQImAFkAAAAHAGgBFgAF//8A7gAABVMHIAImADsAAAAHAEIBPQFb////vP5LBCoFywImAFsAAAAHAEIAiQAG//8AxgQjAagGGAIGAAkAAP//AMUEFAK9BhgCBgAEAAD//wBPAAAEJQWwACYEHAAAAAcEHAH9AAD//wCKAAAEzAYtACYASAAAAAcATgKbAAD///8b/ksC/AXdAiYAmAAAAAcAm/9T//T//wCxA+cCIAYYAgYBZgAA//8AWAAABrMHHwImAC8AAAAHAHMC3wFZ//8ANQAABlsF3QImAE8AAAAHAHMCrwAX////1f6HBH8FsAImACMAAAAHAKIBOQAA//8AOv6HA/cETgImAEMAAAAHAKIAkgAA//8AAf/rBTYGogAmADEAAAAHAdX/DADM//8AigAABrIGLQAmAEgAAAAHAZICmwAA//8AigAAB2cGLQAmAEgAAAAnAEgCmwAAAAcATgU2AAD//wBYAAAE8gciAiYAJwAAAAcAQgE3AV3//wBYAAAFegciAiYA1wAAAAcAQgGYAV3//wBH/+wD6wXhAiYARwAAAAcAQgCRABz//wBAAAAERwXLAiYA6wAAAAcAQgDSAAb//wCKAAAFkgWwAgYAtAAA//8AQ/4pBS4EOgIGAMgAAP//AOgAAAVcB0cCJgEUAAAABwCnBDEBWf//ALMAAARLBh8CJgEVAAAABwCnA5gAMf//AEb+SwhuBE4AJgBRAAAABwBbBEQAAP//AF7+SwllBcUAJgAxAAAABwBbBTsAAP//ACD+UQSwBcUCJgDWAAAABwGcAXD/uP//AB7+UgPEBEwCJgDqAAAABwGcASD/uf//AGL+UQT4BcUAJgAlAAAABwGcAb//uP//AEf+UQP7BE4CJgBFAAAABwGcAUH/uP//AO4AAAVTBbACBgA7AAD//wCz/mAEJgQ6AgYAuAAA//8AYgAAAjoFsAIGACsAAP///8oAAAddB0wCJgDVAAAABwCcAkwBnP///8MAAAYBBfUCJgDpAAAABwCcAaQARf//AGIAAAI6BbACBgArAAD////VAAAEsAdMAiYAIwAAAAcAnAFhAZz//wA6/+wD+AYKAiYAQwAAAAcAnACpAFr////VAAAEzAcMAiYAIwAAAAcAaAEHAVz//wA6/+wEFAXKAiYAQwAAAAYAaE8aAAD///+eAAAHdQWwAgYAfwAA//8ABP/rBmAETgIGAIQAAP//AFgAAATyB0wCJgAnAAAABwCcAS0BnP//AEf/7APrBgsCJgBHAAAABwCcAIcAW///AEb/6wVABt4CJgFBAAAABwBoAMsBLv//ADz/7AP2BE8CBgCZAAD//wA8/+wEFgXLAiYAmQAAAAYAaFEbAAD////KAAAHXQcMAiYA1QAAAAcAaAHyAVz////DAAAGAQW1AiYA6QAAAAcAaAFKAAX//wAg/+sEsAchAiYA1gAAAAcAaADCAXH//wAe/+0D8gXJAiYA6gAAAAYAaC0ZAAD//wBYAAAFegb6AiYA1wAAAAcAbgFTAUr//wBAAAAERwWkAiYA6wAAAAcAbgCN//T//wBYAAAFegcMAiYA1wAAAAcAaAE0AVz//wBAAAAERwW1AiYA6wAAAAYAaG4FAAD//wBe/+sFNgchACYAMQAAAAcAaAEoAXH//wBG/+wEHAXKAiYAUQAAAAYAaEMaAAD//wBd/+sFNwXFAgYBEgAA//8ARv/sBBwETgIGARMAAP//AF3/6wU3BwcCJgESAAAABwBoAScBV///AEb/7AQeBeYCJgETAAAABgBoWTYAAP//AIf/7AU0ByICJgDiAAAABwBoARQBcv//ADP/6wQNBcoCJgD6AAAABgBoSBoAAP//AKP/6wVFBvoCJgDZAAAABwBuAQMBSv///7z+SwQqBaQCJgBbAAAABgBuRPQAAP//AKP/6wVFBwwCJgDZAAAABwBoAOQBXP///7z+SwQqBbUCJgBbAAAABgBoJQUAAP//AKP/6wVVB0sCJgDZAAAABwChAWYBXf///7z+SwSWBfQCJgBbAAAABwChAKcABv//ANEAAAVIBwwCJgDcAAAABwBoAQsBXP//AH8AAAQGBbUCJgD0AAAABgBoLwUAAP//AFcAAAaiBwwAJgDhDwAAJwArBGgAAAAHAGgByAFc//8AQAAABasFtQAmAPkAAAAnAIoD3gAAAAcAaAEjAAX////8/ksFHQWwAiYAOgAAAAcBmgN+AAD////p/ksD8QQ6AiYAWgAAAAcBmgKWAAD//wBE/+sElQYYAgYARgAA////3v5LBXEFsAImANgAAAAHAZoD/AAA////1f5LBEkEOgImAO0AAAAHAZoDHwAA////1f6xBH8FsAImACMAAAAHAKgErAAA//8AOv6xA/cETgImAEMAAAAHAKgEBQAA////1QAABH8HxgImACMAAAAHAKYE5QFT//8AOv/sA/cGhAImAEMAAAAHAKYELQAR////1QAABg4HqAImACMAAAAHAaMA8AEW//8AOv/sBVYGZwImAEMAAAAGAaM41QAA////1QAABLcHpQImACMAAAAHAaIA+gEl//8AOv/sA/8GZAImAEMAAAAGAaJC5AAA////1QAABZ4H2wImACMAAAAHAaEA9QEN//8AOv/sBOYGmgImAEMAAAAGAaE9zAAA////1QAABLYH5QImACMAAAAHAaAA9gET//8AOv/sA/4GpAImAEMAAAAGAaA+0gAA////1f6xBI0HRgImACMAAAAnAJoBBgFdAAcAqASsAAD//wA6/rED9wYEAiYAQwAAACYAmk4bAAcAqAQFAAAAAP///9UAAASqB90CJgAjAAAABwGfASkBVP//ADr/7AP3BpsCJgBDAAAABgGfcRIAAP///9UAAATOB+ACJgAjAAAABwGkAS8BZ///ADr/7AQWBp4CJgBDAAAABgGkdyUAAP///9UAAASVCEsCJgAjAAAABwGeASkBSf//ADr/7AP3BwkCJgBDAAAABgGecQcAAP///9UAAATMCB8CJgAjAAAABwGdASsBUf//ADr/7AQUBt0CJgBDAAAABgGdcw8AAP///9X+sQSwB0wCJgAjAAAAJwCcAWEBnAAHAKgErAAA//8AOv6xA/gGCgImAEMAAAAnAJwAqQBaAAcAqAQFAAD//wBY/rsE8gWwAiYAJwAAAAcAqAR3AAr//wBH/rED6wROAiYARwAAAAcAqARRAAD//wBYAAAE8gfGAiYAJwAAAAcApgSxAVP//wBH/+wD6waFAiYARwAAAAcApgQLABL//wBYAAAE8gdRAiYAJwAAAAcAoADxAWD//wBH/+wD+gYQAiYARwAAAAYAoEsfAAD//wBYAAAF2geoAiYAJwAAAAcBowC8ARb//wBH/+wFNAZoAiYARwAAAAYBoxbWAAD//wBYAAAE8gelAiYAJwAAAAcBogDGASX//wBH/+wD6wZlAiYARwAAAAYBoiDlAAD//wBYAAAFagfbAiYAJwAAAAcBoQDBAQ3//wBH/+wExAabAiYARwAAAAYBoRvNAAD//wBYAAAE8gflAiYAJwAAAAcBoADCARP//wBH/+wD6walAiYARwAAAAYBoBzTAAD//wBY/rsE8gdGAiYAJwAAACcAmgDSAV0ABwCoBHcACv//AEf+sQPrBgUCJgBHAAAAJgCaLBwABwCoBFEAAAAA//8AYgAAAwoHxgImACsAAAAHAKYDdQFT//8APgAAAqMGcAImAIoAAAAHAKYDDv/9//8AF/65AjoFsAImACsAAAAHAKgDOwAI////+v67AjEGGAImAEsAAAAHAKgDHgAK//8AXv6pBTYFxQAmADEAAAAHAKgEw//4//8ARv6oBBwETgImAFEAAAAHAKgEV//3//8AXv/rBTYH2wAmADEAAAAHAKYFBgFo//8ARv/sBBwGhAImAFEAAAAHAKYEIQAR//8AXv/rBi8HvQAmADEAAAAHAaMBEQEr//8ARv/sBUoGZwImAFEAAAAGAaMs1QAA//8AXv/rBTYHugAmADEAAAAHAaIBGwE6//8ARv/sBBwGZAImAFEAAAAGAaI25AAA//8AXv/rBb8H8AAmADEAAAAHAaEBFgEi//8ARv/sBNoGmgImAFEAAAAGAaExzAAA//8AXv/rBTYH+gAmADEAAAAHAaABFwEo//8ARv/sBBwGpAImAFEAAAAGAaAy0gAA//8AXv6pBTYHWwAmADEAAAAnAJoBJwFyAAcAqATD//j//wBG/qgEHAYEAiYAUQAAACYAmkIbAAcAqARX//cAAP//AFn/6wYlBw8CJgCUAAAABwBzAiQBSf//AEb/7AUJBd0CJgCVAAAABwBzAXgAF///AFn/6wYlBxICJgCUAAAABwBCAXgBTf//AEb/7AUJBeACJgCVAAAABwBCAMwAG///AFn/6wYlB7YCJgCUAAAABwCmBPIBQ///AEb/7AUJBoQCJgCVAAAABwCmBEYAEf//AFn/6wYlB0ECJgCUAAAABwCgATIBUP//AEb/7AUJBg8CJgCVAAAABwCgAIYAHv//AFn+sQYlBjYCJgCUAAAABwCoBLEAAP//AEb+qAUJBLACJgCVAAAABwCoBEj/9///AGf+qgVXBbACJgA3AAAABwCoBLL/+f//AFr+sQQ7BDoCJgBXAAAABwCoBAsAAP//AGf/6wVXB8YCJgA3AAAABwCmBPEBU///AFr/7AQ7BnACJgBXAAAABwCmBED//f//AGf/6walBx8CJgCWAAAABwBzAiIBWf//AFr/7AVXBcgCJgCXAAAABwBzAXIAAv//AGf/6walByICJgCWAAAABwBCAXYBXf//AFr/7AVXBcsCJgCXAAAABwBCAMYABv//AGf/6walB8YCJgCWAAAABwCmBPABU///AFr/7AVXBnACJgCXAAAABwCmBED//f//AGf/6walB1ECJgCWAAAABwCgATABYP//AFr/7AVXBfoCJgCXAAAABwCgAIAACf//AGf+qQalBg0CJgCWAAAABwCoBLH/+P//AFr+sQVXBJECJgCXAAAABwCoBAsAAP//AO7+uwVTBbACJgA7AAAABwCoBH0ACv///7z+FAQqBDoCJgBbAAAABwCoBKj/Y///AO4AAAVTB8QCJgA7AAAABwCmBLcBUf///7z+SwQqBnACJgBbAAAABwCmBAP//f//AO4AAAVTB08CJgA7AAAABwCgAPcBXv///7z+SwQqBfoCJgBbAAAABgCgQwkAAAACAET/6wUmBhgAGgAoAAABIwMjNycOASMiAj8BGgEzMhYXEyM3MzczBzMBBhYzMjY3Ey4BIyIGBwUItPedCQM8kFiwri8EOO7BWIcrN+oe6SS1JLX8AyRhiUx1M2Uba1R8nyYE0vsuaAI/QAE06hUBHAEUSEUBEZWxsfyis9FTTwH6RE/ZvQD//wAT/u4FJgYYACYARgAAACcB0wH8AkYABgBBfYMAAP//AD7+mQU1BbAAJgAtAAAABwGcA/QAAP//AED+mQRhBDoCJgDsAAAABwGcAxMAAP//AFj+mQV5BbACJgAqAAAABwGcBBwAAP//AED+mQRGBDoCJgDvAAAABwGcAzQAAP//AOz+mQULBbACJgA2AAAABwGcAggAAP//AJD+mQP3BDoCJgDxAAAABwGcAZgAAP////z+mQUdBbACJgA6AAAABwGcA5YAAP///+n+mQPxBDoCJgBaAAAABwGcAq4AAP//ANH+mQVIBbACJgDcAAAABwGcA+sAAP//AH/+mQQGBDsCJgD0AAAABwGcAvMAAP//ANH+mQVIBbACJgDcAAAABwGcAt8AAP//AH/+mQQGBDsCJgD0AAAABwGcAeYAAP//AFf+mQS5BbACJgCsAAAABwGcANMAAP//AD7+mQOVBDoCJgDnAAAABwGcAJsAAP///8r+mQddBbACJgDVAAAABwGcBeEAAP///8P+mQYBBDoCJgDpAAAABwGcBKoAAP//AK7+VAXuBcMCJgE7AAAABwGcAsn/u///ACX+WARRBE4CJgE8AAAABwGcAdL/v///ADUAAAQZBhgCBgBKAAAAAgBIAAAEkgWwABIAGwAAASMHITIWBwYEIyETIzczNzMHMwEDITI2NzYmIwKv1TEBTs/MJyv+7eH9/NzIHsgptinV/r5vAU6DsBkZZ48EUPjmwtTcBFCVy8v93v3So3qAkQAAAAIASAAABJIFsAASABsAAAEjByEyFgcGBCMhEyM3MzczBzMBAyEyNjc2JiMCr9UxAU7PzCcr/u3h/fzcyB7IKbYp1f6+bwFOg7AZGWePBFD45sLU3ARQlcvL/d790qN6gJEAAAABADQAAAS5BbAADQAAASMDIxMjNzMTIQchAzMCh/KItoirHqt9Az8e/Xdf8gKs/VQCrJUCb5b+JwAAAAABAAoAAAOVBDoADQAAASEDIxMjNzMTIQchAyECXf72X7Zfkx6TWwJ/Hv43PQEKAd/+IQHflQHGl/7RAAABAFIAAAVJBbAAFAAAASMDIxMjNzM3MwczByMDMwEzCQEjAhaJhLfnrB6sHrce8B7wRJQCI+b9awGEzwKV/WsEhZWWlpX+rwJ8/Sj9KAAAAAEASgAABDwGGAAUAAABIwMjEyM3MzczBzMHIwMzATMJASMB3HhktvPGHsYntifXHtdxdgFu1v5DARbWAfb+CgTBlcLClf3MAa3+E/2zAAD//wBY/ooFegdMAiYA1wAAACcAnAGOAZwABwAOBCz/vv//AED+igRHBfUCJgDrAAAAJwCcAMgARQAHAA4DRP++//8AWP6KBXkFsAImACoAAAAHAA4EK/++//8AQP6KBEYEOgImAO8AAAAHAA4DQ/++//8AWP6KBrMFsAImAC8AAAAHAA4FZf++//8AQP6KBX8EOgImAO4AAAAHAA4EfP++////3v6KBXEFsAImANgAAAAHAA4EI/++////1f6KBEkEOgImAO0AAAAHAA4DRv++AAEA7gAABVMFsAAQAAAJATMBMwcjBwMjEycjNzMDMwKNAffP/dpyHr0JZ7RqAdsekO7QAs0C4/z2lQ39/AIQAZUDCgAAAQBt/mAEJgQ6ABEAAAUjAyMTIzczAzMTFzM3ATMBMwLA0lG2Ucses4u5VwEDJAGCuf3/uQz+bAGUlQOx/QBTUwMA/E8AAAAAAf/8AAAFHQWwABEAAAEjASMDASMBIzczATMTATMBMwO0nQEm1+v+XdwB/Jcehf7r2d8Bm9v+HpcCnv1iAkj9uAKelQJ9/cMCPf2DAAH/6QAAA/EEOgARAAABIxMjAwEjASM3MwMzEwEzATMDDpva0J7+3dMBdaMek8zRlQEY0/6klwHh/h8Bnv5iAeGVAcT+bQGT/jwAAP//ACn/7QP9BEwCBgC6AAD////8AAAE+QWwAiYAKAAAAAcB0/9D/n7//wEAAowGCQMhAEYBhrUAZmZAAAACAE8AAAIoBbAAAwAHAAABIxMzASM3MwFltsO2/t22KLYB3gPS+lDIAAAAAAAAAAAAAAAAAAAcAFQAmgD6AVgBagGQAbYB2AH0AgoCGAIkAjICaAJ6AqgC7AMQA0YDjAOsA/oEQARMBFgEdASKBKYE2gVOBWwFqAXcBggGJAY+BnYGkAaeBrwG2gbsBxQHLgdkB4wHyggICEYIXAiACJoIxgjmCP4JFgksCToJUAloCXYJhAnKCgIKMgpqCqAKyAsQCzgLTAtyC5ALngvcDAIMNAxsDKQMxA0ADSoNUA1oDZQNsg3cDfQOLA46DnAOnA6wDugPIA9wD54PtBAgEDQQkhDYEOQQ+hFoEXYRoBHCEfASMBI+EmoShBKSErASwhLyEv4TEBMiEzQTaBOUE7QUChQ0FHYU2hUsFUgVmBXWFgQWEBYuFk4WahaaFtIXFhdwF44XyBgMGEwYfBiuGM4ZBBkaGTAZTBlaGYQZqBnKGeIaChoYGiYaMBpQGmYadBqCGpwapBq4GtAbDhskG0AbVht2G7ob6hwyHHocxBzgHTAdcB2sHdIeEB4wHmYeuB7kHxwfVh+OH7Qf3iAgIFggniDgIRwhaCGaIdQiECJGInIikCK+IuwjGiNcI3gjnCPEJAokJiRMJGwkkiS+JO4lFiVQJZIlviYIJkImVCaAJqwm8CcMJyonTCdsJ4YnmiewKBIoLihSKG4okCi6KOgpDilCKX4prCn0KiYqYCqUKsYq4isaK1IrhCvILAIsJCxKLHosrCzuLSYtdC24Lg4uZC6iLtgu/C8kL2ovrDAYMIIwyDEOMTwxaDGSMaYxxjHYMeoylDLuMyAzUDOQM6gzwDPqNBQ0PjRmNIg0qjTKNOg1FjVCNaA1+jYcNjw2ajaWNrw3AjdCN243mjfIN/Q4MDhiOJY4pji2ON45GjlyObw6BjpOOpg61jsSO0o7gDu8O/Y8JjxWPJ48njyePJ48njyePJ48njyePJ48njyePJ48qDyyPL481DzsPQI9Dj0aPSY9TD1oPZA9rD24Pcg+UD5mPn4+jD6uPtY/Fj9gP6RABEBGQJJAvkD2QQhBGkEsQT5BfEGSQbJBwEHcQjhCaELAQuhC+EMIQyxDOkNQQ2ZDlEOURIpE1EUIRSpFYEWARZ5FwkXQRgZGOkZcRopGtEbQRuxHDkceRzxHdEekR8pH5kf+SDJITEhYSHZIlEimSMhI4kkUSU5JiknISd5KAkoaSkJKYEp4SpBKwkrUSwBLQEtiS5BL1EvyTEBMhEyWTMRNBE0WTUpNjE2oTfZOOE5oTnZOqE7KTw5PMk9oT7BQKlBKUIpQ2FEUUWJRjFHSUgBSIFJAUl5SfFLCUuhS8FL4UwBTNlNsU55TvlPyU/5UClQWVCJULlQ6VEZUUlReVGpUdlSCVI5UmlSmVLJUvlTKVNZU4lTuVPpVBlUSVR5VKlU2VUJVTlVaVWZVclV+VYpVllWiVa5VulXGVdJV3lXqVfZWAlYOVhpWJlYyVj5WSlZWVmJWblZ6VoZWklaeVqpWtlbuV1BXXFdoV3RXgFeMV5hXpFewV7xXyFfUV+BX7Ff4WARYEFhKWJxYqFi0WMBYzFjYWORY8Fj8WQhZFFkgWSxZOFlEWVBZXFloWXRZgFmMWZhZpFmwWbxZyFnUWeBZ7Fn4WgRaEFocWihaNFpAWkxaWFpkWnBafFqIWpRaoFqsWrhaxFrQWtxa6Fr0WwBbDFsYWyRbMFs8W0hbVFtgW2xbeFuEW5BbnFuoW7RbwFvMW9hb5FvwW/xcCFwUXCBcLFw4XERcUFxcXKBc4FzsXPhdBF0QXRxdKF00XUBdTF1YXWRdcF18XYhdlF2gXaxduF3EXdBd3F3oXfReAF4MXhheJF4wXjxeSF5UXmBebF54XoRekF6cXqhetF7AXsxe2F7kXvBe/F8IXxRfTF9YX2RfcF98X4hflF+gX6xf5l/yX/5gCmAWYCJgLmA6YEZgUmBeYGpgdmCCYI5gmmCmYLJgvmDKYNZg4mDuYPphBmESYR5hKmE2YUJhTmFaYWZhcmF+YYphlmGiYeZh8mH+YgpiFmIiYi5iOmJGYlJiXmJqYnZigmKOYppiomKqYrJiumLCYspi0mLaYuJi6mLyYvpjAmMKYxZjImMuYzpjRmNSY15jZmNuY3ZjfmOGY5JjnmOqY7ZjwmPOY9pkGGQgZCxkNGQ8ZEhkVGRcZGRkbGR0ZIBkiGSQZJhkoGSoZLBkuGTAZMhk0GTcZORk7GUcZSRlLGU4ZURlTGVUZWBlaGV0ZYBljGWYZaRlsGW8Zchl1GXgZehl8GX8ZghmFGYcZihmNGZAZkxmWGZkZnRmgGaMZphmpGasZrRmwGbMZthm5GbwZvxnCGcUZxxnJGcsZzhnRGdMZ1hnZGdwZ3xnhGeMZ5hnpGewZ7hnxGfQZ9xn6Gf0aABoDGgYaCRoMGg8aERoTGhYaGRocGh8aIholGigaKxouGjEaNBo3GjsaPxpCGkUaRxpKGk0aUBpTGlYaWRpcGl8aYhplGmgaaxpuGnEadRp5GnwafxqCGoUaiBqLGo4akRqVGpkanBqfGqIapRqoGqsarhqxGrQatxq6Gr0awBrDGscayxrOGtEa1BrXGtoa3RrgGuMa5hrpGuwa7xryGvUa+Br7Gv8bAxsGGwkbDBsPGxIbFRsYGxsbHhshGyQbJxsqGy0bMBszGzYbORs8Gz8bQhtFG0gbSxtOG1EbVBtXG1obXRtuG3IbdRt4G3sbfhuBG4QbhxuKG40bkBuTG5YbmRucG58bohulG6gbqhu2m8MbypvSG9wb5hvqG+4b8Rv0G/cb+hv9HAAcCJwRnBscJJwmnCmcLBwsHCwcMYAAAAbAUoAAQAAAAAAAAAfAAAAAQAAAAAAAQAGAB8AAQAAAAAAAgAGACUAAQAAAAAAAwASACsAAQAAAAAABAANAD0AAQAAAAAABQAWAEoAAQAAAAAABgANAGAAAQAAAAAABwAgAG0AAQAAAAAACQAGAI0AAQAAAAAACwAKAJMAAQAAAAAADAATAJ0AAQAAAAAADQAuALAAAQAAAAAADgAqAN4AAQAAAAAAEgANAQgAAwABBAkAAAA+ARUAAwABBAkAAQAMAVMAAwABBAkAAgAMAV8AAwABBAkAAwAkAWsAAwABBAkABAAaAY8AAwABBAkABQAsAakAAwABBAkABgAaAdUAAwABBAkABwBAAe8AAwABBAkACQAMAi8AAwABBAkACwAUAjsAAwABBAkADAAmAk8AAwABBAkADQBcAnUAAwABBAkADgBUAtFGb250IGRhdGEgY29weXJpZ2h0IEdvb2dsZSAyMDEzUm9ib3RvSXRhbGljR29vZ2xlOlJvYm90bzoyMDEzUm9ib3RvIEl0YWxpY1ZlcnNpb24gMS4yMDAzMTA7IDIwMTNSb2JvdG8tSXRhbGljUm9ib3RvIGlzIGEgdHJhZGVtYXJrIG9mIEdvb2dsZS5Hb29nbGVHb29nbGUuY29tQ2hyaXN0aWFuIFJvYmVydHNvbkxpY2Vuc2VkIHVuZGVyIHRoZSBBcGFjaGUgTGljZW5zZSwgVmVyc2lvbiAyLjBodHRwOi8vd3d3LmFwYWNoZS5vcmcvbGljZW5zZXMvTElDRU5TRS0yLjBSb2JvdG8gSXRhbGljAEYAbwBuAHQAIABkAGEAdABhACAAYwBvAHAAeQByAGkAZwBoAHQAIABHAG8AbwBnAGwAZQAgADIAMAAxADMAUgBvAGIAbwB0AG8ASQB0AGEAbABpAGMARwBvAG8AZwBsAGUAOgBSAG8AYgBvAHQAbwA6ADIAMAAxADMAUgBvAGIAbwB0AG8AIABJAHQAYQBsAGkAYwBWAGUAcgBzAGkAbwBuACAAMQAuADIAMAAwADMAMQAwADsAIAAyADAAMQAzAFIAbwBiAG8AdABvAC0ASQB0AGEAbABpAGMAUgBvAGIAbwB0AG8AIABpAHMAIABhACAAdAByAGEAZABlAG0AYQByAGsAIABvAGYAIABHAG8AbwBnAGwAZQAuAEcAbwBvAGcAbABlAEcAbwBvAGcAbABlAC4AYwBvAG0AQwBoAHIAaQBzAHQAaQBhAG4AIABSAG8AYgBlAHIAdABzAG8AbgBMAGkAYwBlAG4AcwBlAGQAIAB1AG4AZABlAHIAIAB0AGgAZQAgAEEAcABhAGMAaABlACAATABpAGMAZQBuAHMAZQAsACAAVgBlAHIAcwBpAG8AbgAgADIALgAwAGgAdAB0AHAAOgAvAC8AdwB3AHcALgBhAHAAYQBjAGgAZQAuAG8AcgBnAC8AbABpAGMAZQBuAHMAZQBzAC8ATABJAEMARQBOAFMARQAtADIALgAwAAACAAAAAAAA/2oAZAAAAAAAAAAAAAAAAAAAAAAAAAAABB0AAAECAAIAAwAFAAYABwAIAAkACgALAAwADQAOAA8AEAARABIAEwAUABUAFgAXABgAGQAaABsAHAAdAB4AHwAgACEAIgAjACQAJQAmACcAKAApACoAKwAsAC0ALgAvADAAMQAyADMANAA1ADYANwA4ADkAOgA7ADwAPQA+AD8AQABBAEIAQwBEAEUARgBHAEgASQBKAEsATABNAE4ATwBQAFEAUgBTAFQAVQBWAFcAWABZAFoAWwBcAF0AXgBfAGAAYQCjAIQAhQC9AJYA6ACGAI4AiwCdAKkApACKAQMAgwCTAPIA8wCNAJcAiAEEAN4A8QCeAKoA9QD0APYAogCQAPAAkQDtAIkAoADqALgAoQDuAQUA1wEGAOIA4wEHAQgAsACxAQkApgEKAQsBDAENAQ4BDwDYAOEA2wDcAN0A4ADZAN8BEAERARIBEwEUARUBFgEXARgBGQEaARsBHAEdAR4BHwEgASEBIgCfASMBJAElASYBJwEoASkBKgErASwBLQCbAS4BLwEwATEBMgEzATQBNQE2ATcBOAE5AToBOwE8AT0BPgE/AUABQQFCAUMBRAFFAUYBRwFIAUkBSgFLAUwBTQFOAU8BUAFRAVIBUwFUAVUBVgFXAVgBWQFaAVsBXAFdAV4BXwFgAWEBYgFjAWQBZQFmAWcBaAFpAWoBawFsAW0BbgFvAXABcQFyAXMBdAF1AXYBdwF4AXkBegF7AXwBfQF+AX8BgAGBAYIBgwGEAYUBhgGHAYgBiQGKAYsBjAGNAY4BjwGQAZEBkgGTAZQBlQGWAZcBmAGZAZoBmwGcAZ0BngGfAaABoQGiAaMBpAGlAaYBpwGoAakBqgGrAawBrQGuAa8BsAGxAbIBswG0AbUBtgG3AbgBuQG6AbsBvAG9Ab4BvwHAAcEBwgHDAcQBxQHGAccByAHJAcoBywHMAc0AsgCzAc4AtgC3AMQBzwC0ALUAxQCCAMIAhwHQAKsAxgC+AL8AvAHRAdIB0wHUAdUB1gHXAdgAjAHZAdoB2wHcAd0AmACaAJkA7wClAJIAnACnAI8AlACVALkB3gHfAeAAwAHhAeIB4wHkAeUB5gHnAegB6QHqAesB7AHtAe4B7wHwAfEB8gHzAfQB9QH2AfcB+AH5AfoB+wH8Af0B/gH/AgACAQICAgMCBAIFAgYCBwIIAgkCCgILAgwCDQIOAg8CEAIRAhICEwIUAhUCFgIXAhgCGQIaAhsCHAIdAh4CHwIgAiECIgIjAiQCJQImAicCKAIpAioCKwIsAi0CLgIvAjACMQIyAjMCNAI1AjYCNwCsAjgCOQDpAjoCOwI8AK0AyQDHAK4AYgBjAj0AZADLAGUAyADKAM8AzADNAM4AZgDTANAA0QCvAGcA1gDUANUAaADrAGoAaQBrAG0AbABuAj4AbwBxAHAAcgBzAHUAdAB2AHcAeAB6AHkAewB9AHwAfwB+AIAAgQDsALoCPwJAAkECQgJDAkQA/QD+AkUCRgJHAkgA/wEAAkkCSgJLAkwCTQJOAk8CUAJRAlICUwJUAlUCVgD4APkCVwJYAlkCWgJbAlwCXQJeAl8CYAJhAmICYwJkAmUCZgJnAmgCaQJqAmsCbAJtAm4CbwJwAnECcgJzAnQCdQJ2AncCeAJ5AnoCewJ8An0CfgJ/AoACgQKCAoMChAKFAoYChwKIAokCigD7APwCiwKMAOQA5QKNAo4CjwKQApECkgKTApQClQKWApcCmAKZApoCmwKcAp0CngKfAqACoQKiALsCowKkAqUCpgDmAOcCpwKoAqkCqgKrAqwCrQKuAq8CsAKxArICswK0ArUCtgK3ArgCuQK6ArsCvAK9Ar4CvwLAAsECwgLDAsQCxQLGAscCyALJAsoCywLMAs0CzgLPAtAC0QLSAtMC1ALVAtYC1wLYAtkC2gLbAtwC3QLeAt8C4ALhAuIC4wLkAuUC5gLnAugC6QLqAusC7ALtAu4C7wLwAvEC8gLzAvQC9QL2AvcC+AL5AvoC+wL8Av0C/gL/AwADAQMCAwMDBAMFAwYDBwMIAwkDCgMLAwwDDQMOAw8DEAMRAxIDEwMUAxUDFgMXAxgDGQMaAxsDHAMdAx4DHwMgAyEDIgMjAyQDJQMmAycDKAMpAyoDKwMsAy0DLgMvAzADMQMyAzMDNAM1AzYDNwM4AzkDOgM7AzwDPQM+Az8DQANBA0IDQwNEA0UDRgNHA0gDSQNKA0sDTANNA04DTwNQA1EDUgNTA1QDVQNWA1cDWANZA1oDWwNcA10DXgNfA2ADYQNiA2MDZANlA2YDZwNoA2kDagNrA2wDbQNuA28DcANxA3IDcwN0A3UDdgN3A3gDeQN6A3sDfAN9A34DfwOAA4EDggODA4QDhQOGA4cDiAOJA4oDiwOMA40DjgOPA5ADkQOSA5MDlAOVA5YDlwOYA5kDmgObA5wDnQOeA58DoAOhA6IDowOkA6UDpgOnA6gDqQOqA6sDrAOtA64DrwOwA7EDsgOzA7QDtQO2A7cDuAO5A7oDuwO8A70DvgO/A8ADwQPCA8MDxAPFA8YDxwPIA8kDygPLA8wDzQPOA88D0APRA9ID0wPUA9UD1gPXA9gD2QPaA9sD3APdA94D3wPgA+ED4gPjA+QD5QPmA+cD6APpA+oD6wPsA+0D7gPvA/AD8QPyA/MD9AP1A/YD9wP4A/kD+gP7A/wD/QP+A/8EAAQBBAIEAwQEBAUEBgQHBAgECQQKBAsEDAQNBA4EDwQQBBEEEgQTBBQEFQQWBBcEGAQZBBoEGwQcBB0EHgQfBCAEIQD3BCIEIwQkAAQETlVMTAZtYWNyb24OcGVyaW9kY2VudGVyZWQESGJhcgxrZ3JlZW5sYW5kaWMDRW5nA2VuZwVsb25ncwVPaG9ybgVvaG9ybgVVaG9ybgV1aG9ybgd1bmkwMjM3BXNjaHdhB3VuaTAyRjMJZ3JhdmVjb21iCWFjdXRlY29tYgl0aWxkZWNvbWIEaG9vawd1bmkwMzBGCGRvdGJlbG93BXRvbm9zDWRpZXJlc2lzdG9ub3MJYW5vdGVsZWlhBUdhbW1hBURlbHRhBVRoZXRhBkxhbWJkYQJYaQJQaQVTaWdtYQNQaGkDUHNpBWFscGhhBGJldGEFZ2FtbWEFZGVsdGEHZXBzaWxvbgR6ZXRhA2V0YQV0aGV0YQRpb3RhBmxhbWJkYQJ4aQNyaG8Gc2lnbWExBXNpZ21hA3RhdQd1cHNpbG9uA3BoaQNwc2kFb21lZ2EHdW5pMDNEMQd1bmkwM0QyB3VuaTAzRDYHdW5pMDQwMgd1bmkwNDA0B3VuaTA0MDkHdW5pMDQwQQd1bmkwNDBCB3VuaTA0MEYHdW5pMDQxMQd1bmkwNDE0B3VuaTA0MTYHdW5pMDQxNwd1bmkwNDE4B3VuaTA0MUIHdW5pMDQyMwd1bmkwNDI0B3VuaTA0MjYHdW5pMDQyNwd1bmkwNDI4B3VuaTA0MjkHdW5pMDQyQQd1bmkwNDJCB3VuaTA0MkMHdW5pMDQyRAd1bmkwNDJFB3VuaTA0MkYHdW5pMDQzMQd1bmkwNDMyB3VuaTA0MzMHdW5pMDQzNAd1bmkwNDM2B3VuaTA0MzcHdW5pMDQzOAd1bmkwNDNBB3VuaTA0M0IHdW5pMDQzQwd1bmkwNDNEB3VuaTA0M0YHdW5pMDQ0Mgd1bmkwNDQ0B3VuaTA0NDYHdW5pMDQ0Nwd1bmkwNDQ4B3VuaTA0NDkHdW5pMDQ0QQd1bmkwNDRCB3VuaTA0NEMHdW5pMDQ0RAd1bmkwNDRFB3VuaTA0NEYHdW5pMDQ1Mgd1bmkwNDU0B3VuaTA0NTkHdW5pMDQ1QQd1bmkwNDVCB3VuaTA0NUYHdW5pMDQ2MAd1bmkwNDYxB3VuaTA0NjMHdW5pMDQ2NAd1bmkwNDY1B3VuaTA0NjYHdW5pMDQ2Nwd1bmkwNDY4B3VuaTA0NjkHdW5pMDQ2QQd1bmkwNDZCB3VuaTA0NkMHdW5pMDQ2RAd1bmkwNDZFB3VuaTA0NkYHdW5pMDQ3Mgd1bmkwNDczB3VuaTA0NzQHdW5pMDQ3NQd1bmkwNDdBB3VuaTA0N0IHdW5pMDQ3Qwd1bmkwNDdEB3VuaTA0N0UHdW5pMDQ3Rgd1bmkwNDgwB3VuaTA0ODEHdW5pMDQ4Mgd1bmkwNDgzB3VuaTA0ODQHdW5pMDQ4NQd1bmkwNDg2B3VuaTA0ODgHdW5pMDQ4OQd1bmkwNDhEB3VuaTA0OEUHdW5pMDQ4Rgd1bmkwNDkwB3VuaTA0OTEHdW5pMDQ5NAd1bmkwNDk1B3VuaTA0OUMHdW5pMDQ5RAd1bmkwNEEwB3VuaTA0QTEHdW5pMDRBNAd1bmkwNEE1B3VuaTA0QTYHdW5pMDRBNwd1bmkwNEE4B3VuaTA0QTkHdW5pMDRCNAd1bmkwNEI1B3VuaTA0QjgHdW5pMDRCOQd1bmkwNEJBB3VuaTA0QkMHdW5pMDRCRAd1bmkwNEMzB3VuaTA0QzQHdW5pMDRDNwd1bmkwNEM4B3VuaTA0RDgHdW5pMDRFMAd1bmkwNEUxB3VuaTA0RkEHdW5pMDRGQgd1bmkwNTAwB3VuaTA1MDIHdW5pMDUwMwd1bmkwNTA0B3VuaTA1MDUHdW5pMDUwNgd1bmkwNTA3B3VuaTA1MDgHdW5pMDUwOQd1bmkwNTBBB3VuaTA1MEIHdW5pMDUwQwd1bmkwNTBEB3VuaTA1MEUHdW5pMDUwRgd1bmkwNTEwB3VuaTIwMDAHdW5pMjAwMQd1bmkyMDAyB3VuaTIwMDMHdW5pMjAwNAd1bmkyMDA1B3VuaTIwMDYHdW5pMjAwNwd1bmkyMDA4B3VuaTIwMDkHdW5pMjAwQQd1bmkyMDBCDXVuZGVyc2NvcmVkYmwNcXVvdGVyZXZlcnNlZAd1bmkyMDI1B3VuaTIwNzQJbnN1cGVyaW9yBGxpcmEGcGVzZXRhBEV1cm8HdW5pMjEwNQd1bmkyMTEzB3VuaTIxMTYJZXN0aW1hdGVkCW9uZWVpZ2h0aAx0aHJlZWVpZ2h0aHMLZml2ZWVpZ2h0aHMMc2V2ZW5laWdodGhzCmNvbG9uLmxudW0JcXVvdGVkYmx4C2NvbW1hYWNjZW50B3VuaUZFRkYHdW5pRkZGQwd1bmlGRkZECWZpdmUuc21jcAhmb3VyLnN1cAl6ZXJvLmxudW0ObGFyZ2VyaWdodGhvb2sMY3lyaWxsaWNob29rEGN5cmlsbGljaG9va2xlZnQLY3lyaWxsaWN0aWMOYnJldmV0aWxkZWNvbWINYnJldmVob29rY29tYg5icmV2ZWFjdXRlY29tYhNjaXJjdW1mbGV4dGlsZGVjb21iEmNpcmN1bWZsZXhob29rY29tYhNjaXJjdW1mbGV4Z3JhdmVjb21iE2NpcmN1bWZsZXhhY3V0ZWNvbWIOYnJldmVncmF2ZWNvbWIRY29tbWFhY2NlbnRyb3RhdGUGQS5zbWNwBkIuc21jcAZDLnNtY3AGRC5zbWNwBkUuc21jcAZGLnNtY3AGRy5zbWNwBkguc21jcAZJLnNtY3AGSi5zbWNwBksuc21jcAZMLnNtY3AGTS5zbWNwBk4uc21jcAZPLnNtY3AGUS5zbWNwBlIuc21jcAZTLnNtY3AGVC5zbWNwBlUuc21jcAZWLnNtY3AGVy5zbWNwBlguc21jcAZZLnNtY3AGWi5zbWNwCXplcm8uc21jcAhvbmUuc21jcAh0d28uc21jcAp0aHJlZS5zbWNwCWZvdXIuc21jcAh0d28ubG51bQhzaXguc21jcApzZXZlbi5zbWNwCmVpZ2h0LnNtY3AJbmluZS5zbWNwB29uZS5zdXAHdHdvLnN1cAl0aHJlZS5zdXAIb25lLmxudW0IZml2ZS5zdXAHc2l4LnN1cAlzZXZlbi5zdXAJZWlnaHQuc3VwCG5pbmUuc3VwCHplcm8uc3VwCGNyb3NzYmFyCXJpbmdhY3V0ZQlkYXNpYW94aWEKdGhyZWUubG51bQlmb3VyLmxudW0JZml2ZS5sbnVtCHNpeC5sbnVtBWcuYWx0CnNldmVuLmxudW0HY2hpLmFsdAplaWdodC5sbnVtCWFscGhhLmFsdAlkZWx0YS5hbHQERC5jbgRhLmNuBVIuYWx0BUsuYWx0BWsuYWx0BksuYWx0MgZrLmFsdDIJbmluZS5sbnVtBlAuc21jcA1jeXJpbGxpY2JyZXZlB3VuaTAwQUQGRGNyb2F0BGhiYXIEVGJhcgR0YmFyCkFyaW5nYWN1dGUKYXJpbmdhY3V0ZQdBbWFjcm9uB2FtYWNyb24GQWJyZXZlBmFicmV2ZQdBb2dvbmVrB2FvZ29uZWsLQ2NpcmN1bWZsZXgLY2NpcmN1bWZsZXgHdW5pMDEwQQd1bmkwMTBCBkRjYXJvbgZkY2Fyb24HRW1hY3JvbgdlbWFjcm9uBkVicmV2ZQZlYnJldmUKRWRvdGFjY2VudAplZG90YWNjZW50B0VvZ29uZWsHZW9nb25lawZFY2Fyb24GZWNhcm9uC0djaXJjdW1mbGV4C2djaXJjdW1mbGV4B3VuaTAxMjAHdW5pMDEyMQxHY29tbWFhY2NlbnQMZ2NvbW1hYWNjZW50C0hjaXJjdW1mbGV4C2hjaXJjdW1mbGV4Bkl0aWxkZQZpdGlsZGUHSW1hY3JvbgdpbWFjcm9uBklicmV2ZQZpYnJldmUHSW9nb25lawdpb2dvbmVrCklkb3RhY2NlbnQCSUoCaWoLSmNpcmN1bWZsZXgLamNpcmN1bWZsZXgMS2NvbW1hYWNjZW50DGtjb21tYWFjY2VudAZMYWN1dGUGbGFjdXRlDExjb21tYWFjY2VudAxsY29tbWFhY2NlbnQGTGNhcm9uBmxjYXJvbgRMZG90BGxkb3QGTmFjdXRlBm5hY3V0ZQxOY29tbWFhY2NlbnQMbmNvbW1hYWNjZW50Bk5jYXJvbgZuY2Fyb24LbmFwb3N0cm9waGUHT21hY3JvbgdvbWFjcm9uBk9icmV2ZQZvYnJldmUNT2h1bmdhcnVtbGF1dA1vaHVuZ2FydW1sYXV0BlJhY3V0ZQZyYWN1dGUMUmNvbW1hYWNjZW50DHJjb21tYWFjY2VudAZSY2Fyb24GcmNhcm9uBlNhY3V0ZQZzYWN1dGULU2NpcmN1bWZsZXgLc2NpcmN1bWZsZXgHdW5pMDIxOAd1bmkwMjE5B3VuaTAyMUEHdW5pMDIxQgd1bmkwMTYyB3VuaTAxNjMGVGNhcm9uBnRjYXJvbgZVdGlsZGUGdXRpbGRlB1VtYWNyb24HdW1hY3JvbgZVYnJldmUGdWJyZXZlBVVyaW5nBXVyaW5nDVVodW5nYXJ1bWxhdXQNdWh1bmdhcnVtbGF1dAdVb2dvbmVrB3VvZ29uZWsLV2NpcmN1bWZsZXgLd2NpcmN1bWZsZXgLWWNpcmN1bWZsZXgLeWNpcmN1bWZsZXgGWmFjdXRlBnphY3V0ZQpaZG90YWNjZW50Cnpkb3RhY2NlbnQHQUVhY3V0ZQdhZWFjdXRlC09zbGFzaGFjdXRlC29zbGFzaGFjdXRlC0Rjcm9hdC5zbWNwCEV0aC5zbWNwCVRiYXIuc21jcAtBZ3JhdmUuc21jcAtBYWN1dGUuc21jcBBBY2lyY3VtZmxleC5zbWNwC0F0aWxkZS5zbWNwDkFkaWVyZXNpcy5zbWNwCkFyaW5nLnNtY3APQXJpbmdhY3V0ZS5zbWNwDUNjZWRpbGxhLnNtY3ALRWdyYXZlLnNtY3ALRWFjdXRlLnNtY3AQRWNpcmN1bWZsZXguc21jcA5FZGllcmVzaXMuc21jcAtJZ3JhdmUuc21jcAtJYWN1dGUuc21jcBBJY2lyY3VtZmxleC5zbWNwDklkaWVyZXNpcy5zbWNwC050aWxkZS5zbWNwC09ncmF2ZS5zbWNwC09hY3V0ZS5zbWNwEE9jaXJjdW1mbGV4LnNtY3ALT3RpbGRlLnNtY3AOT2RpZXJlc2lzLnNtY3ALVWdyYXZlLnNtY3ALVWFjdXRlLnNtY3AQVWNpcmN1bWZsZXguc21jcA5VZGllcmVzaXMuc21jcAtZYWN1dGUuc21jcAxBbWFjcm9uLnNtY3ALQWJyZXZlLnNtY3AMQW9nb25lay5zbWNwC0NhY3V0ZS5zbWNwEENjaXJjdW1mbGV4LnNtY3AMdW5pMDEwQS5zbWNwC0NjYXJvbi5zbWNwC0RjYXJvbi5zbWNwDEVtYWNyb24uc21jcAtFYnJldmUuc21jcA9FZG90YWNjZW50LnNtY3AMRW9nb25lay5zbWNwC0VjYXJvbi5zbWNwEEdjaXJjdW1mbGV4LnNtY3ALR2JyZXZlLnNtY3AMdW5pMDEyMC5zbWNwEUdjb21tYWFjY2VudC5zbWNwEEhjaXJjdW1mbGV4LnNtY3ALSXRpbGRlLnNtY3AMSW1hY3Jvbi5zbWNwC0licmV2ZS5zbWNwDElvZ29uZWsuc21jcA9JZG90YWNjZW50LnNtY3AQSmNpcmN1bWZsZXguc21jcBFLY29tbWFhY2NlbnQuc21jcAtMYWN1dGUuc21jcBFMY29tbWFhY2NlbnQuc21jcAtMY2Fyb24uc21jcAlMZG90LnNtY3ALTmFjdXRlLnNtY3ARTmNvbW1hYWNjZW50LnNtY3ALTmNhcm9uLnNtY3AMT21hY3Jvbi5zbWNwC09icmV2ZS5zbWNwEk9odW5nYXJ1bWxhdXQuc21jcAtSYWN1dGUuc21jcBFSY29tbWFhY2NlbnQuc21jcAtSY2Fyb24uc21jcAtTYWN1dGUuc21jcBBTY2lyY3VtZmxleC5zbWNwDVNjZWRpbGxhLnNtY3ALU2Nhcm9uLnNtY3ARVGNvbW1hYWNjZW50LnNtY3ALVGNhcm9uLnNtY3ALVXRpbGRlLnNtY3AMVW1hY3Jvbi5zbWNwC1VicmV2ZS5zbWNwClVyaW5nLnNtY3ASVWh1bmdhcnVtbGF1dC5zbWNwDFVvZ29uZWsuc21jcBBXY2lyY3VtZmxleC5zbWNwEFljaXJjdW1mbGV4LnNtY3AOWWRpZXJlc2lzLnNtY3ALWmFjdXRlLnNtY3APWmRvdGFjY2VudC5zbWNwC1pjYXJvbi5zbWNwD2dlcm1hbmRibHMuc21jcApBbHBoYXRvbm9zDEVwc2lsb250b25vcwhFdGF0b25vcwlJb3RhdG9ub3MMT21pY3JvbnRvbm9zDFVwc2lsb250b25vcwpPbWVnYXRvbm9zEWlvdGFkaWVyZXNpc3Rvbm9zBUFscGhhBEJldGEHRXBzaWxvbgRaZXRhA0V0YQRJb3RhBUthcHBhAk11Ak51B09taWNyb24DUmhvA1RhdQdVcHNpbG9uA0NoaQxJb3RhZGllcmVzaXMPVXBzaWxvbmRpZXJlc2lzCmFscGhhdG9ub3MMZXBzaWxvbnRvbm9zCGV0YXRvbm9zCWlvdGF0b25vcxR1cHNpbG9uZGllcmVzaXN0b25vcwVrYXBwYQdvbWljcm9uB3VuaTAzQkMCbnUDY2hpDGlvdGFkaWVyZXNpcw91cHNpbG9uZGllcmVzaXMMb21pY3JvbnRvbm9zDHVwc2lsb250b25vcwpvbWVnYXRvbm9zB3VuaTA0MDEHdW5pMDQwMwd1bmkwNDA1B3VuaTA0MDYHdW5pMDQwNwd1bmkwNDA4B3VuaTA0MUEHdW5pMDQwQwd1bmkwNDBFB3VuaTA0MTAHdW5pMDQxMgd1bmkwNDEzB3VuaTA0MTUHdW5pMDQxOQd1bmkwNDFDB3VuaTA0MUQHdW5pMDQxRQd1bmkwNDFGB3VuaTA0MjAHdW5pMDQyMQd1bmkwNDIyB3VuaTA0MjUHdW5pMDQzMAd1bmkwNDM1B3VuaTA0MzkHdW5pMDQzRQd1bmkwNDQwB3VuaTA0NDEHdW5pMDQ0Mwd1bmkwNDQ1B3VuaTA0NTEHdW5pMDQ1Mwd1bmkwNDU1B3VuaTA0NTYHdW5pMDQ1Nwd1bmkwNDU4B3VuaTA0NUMHdW5pMDQ1RQZXZ3JhdmUGd2dyYXZlBldhY3V0ZQZ3YWN1dGUJV2RpZXJlc2lzCXdkaWVyZXNpcwZZZ3JhdmUGeWdyYXZlBm1pbnV0ZQZzZWNvbmQJZXhjbGFtZGJsB3VuaUZCMDIHdW5pMDFGMAd1bmkwMkJDB3VuaTFFM0UHdW5pMUUzRgd1bmkxRTAwB3VuaTFFMDEHdW5pMUY0RAd1bmlGQjAzB3VuaUZCMDQHdW5pMDQwMAd1bmkwNDBEB3VuaTA0NTAHdW5pMDQ1RAd1bmkwNDcwB3VuaTA0NzEHdW5pMDQ3Ngd1bmkwNDc3B3VuaTA0NzkHdW5pMDQ3OAd1bmkwNDk4B3VuaTA0OTkHdW5pMDRBQQd1bmkwNEFCB3VuaTA0QUUHdW5pMDRBRgd1bmkwNEMwB3VuaTA0QzEHdW5pMDRDMgd1bmkwNENGB3VuaTA0RDAHdW5pMDREMQd1bmkwNEQyB3VuaTA0RDMHdW5pMDRENAd1bmkwNEQ1B3VuaTA0RDYHdW5pMDRENwd1bmkwNERBB3VuaTA0RDkHdW5pMDREQgd1bmkwNERDB3VuaTA0REQHdW5pMDRERQd1bmkwNERGB3VuaTA0RTIHdW5pMDRFMwd1bmkwNEU0B3VuaTA0RTUHdW5pMDRFNgd1bmkwNEU3B3VuaTA0RTgHdW5pMDRFOQd1bmkwNEVBB3VuaTA0RUIHdW5pMDRFQwd1bmkwNEVEB3VuaTA0RUUHdW5pMDRFRgd1bmkwNEYwB3VuaTA0RjEHdW5pMDRGMgd1bmkwNEYzB3VuaTA0RjQHdW5pMDRGNQd1bmkwNEY4B3VuaTA0RjkHdW5pMDRGQwd1bmkwNEZEB3VuaTA1MDEHdW5pMDUxMgd1bmkwNTEzB3VuaTFFQTAHdW5pMUVBMQd1bmkxRUEyB3VuaTFFQTMHdW5pMUVBNAd1bmkxRUE1B3VuaTFFQTYHdW5pMUVBNwd1bmkxRUE4B3VuaTFFQTkHdW5pMUVBQQd1bmkxRUFCB3VuaTFFQUMHdW5pMUVBRAd1bmkxRUFFB3VuaTFFQUYHdW5pMUVCMAd1bmkxRUIxB3VuaTFFQjIHdW5pMUVCMwd1bmkxRUI0B3VuaTFFQjUHdW5pMUVCNgd1bmkxRUI3B3VuaTFFQjgHdW5pMUVCOQd1bmkxRUJBB3VuaTFFQkIHdW5pMUVCQwd1bmkxRUJEB3VuaTFFQkUHdW5pMUVCRgd1bmkxRUMwB3VuaTFFQzEHdW5pMUVDMgd1bmkxRUMzB3VuaTFFQzQHdW5pMUVDNQd1bmkxRUM2B3VuaTFFQzcHdW5pMUVDOAd1bmkxRUM5B3VuaTFFQ0EHdW5pMUVDQgd1bmkxRUNDB3VuaTFFQ0QHdW5pMUVDRQd1bmkxRUNGB3VuaTFFRDAHdW5pMUVEMQd1bmkxRUQyB3VuaTFFRDMHdW5pMUVENAd1bmkxRUQ1B3VuaTFFRDYHdW5pMUVENwd1bmkxRUQ4B3VuaTFFRDkHdW5pMUVEQQd1bmkxRURCB3VuaTFFREMHdW5pMUVERAd1bmkxRURFB3VuaTFFREYHdW5pMUVFMAd1bmkxRUUxB3VuaTFFRTIHdW5pMUVFMwd1bmkxRUU0B3VuaTFFRTUHdW5pMUVFNgd1bmkxRUU3B3VuaTFFRTgHdW5pMUVFOQd1bmkxRUVBB3VuaTFFRUIHdW5pMUVFQwd1bmkxRUVEB3VuaTFFRUUHdW5pMUVFRgd1bmkxRUYwB3VuaTFFRjEHdW5pMUVGNAd1bmkxRUY1B3VuaTFFRjYHdW5pMUVGNwd1bmkxRUY4B3VuaTFFRjkGZGNyb2F0B3VuaTIwQUIHdW5pMDQ5QQd1bmkwNDlCB3VuaTA0QTIHdW5pMDRBMwd1bmkwNEFDB3VuaTA0QUQHdW5pMDRCMgd1bmkwNEIzB3VuaTA0QjYHdW5pMDRCNwd1bmkwNENCB3VuaTA0Q0MHdW5pMDRGNgd1bmkwNEY3B3VuaTA0OTYHdW5pMDQ5Nwd1bmkwNEJFB3VuaTA0QkYHdW5pMDRCQgd1bmkwNDhDB3VuaTA0NjIHdW5pMDQ5Mgd1bmkwNDkzB3VuaTA0OUUHdW5pMDQ5Rgd1bmkwNDhBB3VuaTA0OEIHdW5pMDRDOQd1bmkwNENBB3VuaTA0Q0QHdW5pMDRDRQd1bmkwNEM1B3VuaTA0QzYHdW5pMDRCMAd1bmkwNEIxB3VuaTA0RkUHdW5pMDRGRgd1bmkwNTExB3VuaTIwMTUHdW5pMDAwMgd1bmkwMDA5AAAAAAEAAAAMAAAAAAAAAAIACADKAMoAAQEeASQAAQFWAWEAAQF2AXYAAQF7AXwAAQF+AX4AAQGTAZUAAQHVAdUAAQAAAAAAAAAAAAEAAAAKAB4ALAABREZMVAAIAAQAAAAA//8AAQAAAAFrZXJuAAgAAAABAAAAAQAEAAIAAAAEAA5NaFUGc1wAAXrYAAQAAAGtA2QDagNwA3YD6APyBAQEKgRABEoEbASOBJQE4gUQBTIFVAV6BaAFpgaMBpIGuAbeB0AH0gf0CBIILAgyCEAIRghMCFIIeAiSCKAIvgjECOII/AkCCcQKNgpcCs4K1AreCuQK6grwCw4LHAtGC0wLYgt8C4ILnAuiC6gL3gvkC+4MHAxCDGgMigysDM4M/A1eDXQNlg24DgIOJA5GDngOng7EDs4O2A7yDwQPDg8oDy4PRA+SD6wPxg/cD/4QIBA6EEAQYhCEEKYRGBE+EWQRghGcEl4SaBK2EwQTDhMUExoTIBMmEywTUhNcE2ITdBOeE7QTxhPYE/4UBBQaFCQUNhRcFHIUeBR+FJgUnhTEFOoV0BZCFrQXJheYGAoYfBjuGQAZFhksGUIZWBl6GZwZvhngGgIaKBpOGnQamhrAGsYazBrSGtgbahuIG6YbxBviHAAcHhw8HEIcSBxOHFQcWhyAHKYczBzyHRgdNh1UHcYd5B5WHnQe5h8EHxYfKB86H0wfch+IH44fpB+qH8Afxh/cH+If+B/+ICAgJiBIIGogjCCuINAg1iEkIVIhgCGuIdwh/iIEIiYiLCJOIlQiWiKAIqYizCLyIxgjPiNMI1ojaCROJTQmGiYgJiYmLCYyJjgmPiZkJvYnFCemJ8gn6igMKH4olCi2KNgo/imQKgIqDCoiKkQqZiqIKtYq+CsaK0ArZixMLN4tQC1iLfQt+i4gLj4uZC56LzwvXi+AL4Yv1DAiMGww3jDoMaoxwDHiMgQyKjJQMmIzSDOqM8gzzjP0NA40LDQyNDg0QjRgNIY0rDTSNWQ1gjWINY41lDW2Nbw2LjZMNnI2iDaONrQ20jbkN3Y3lDe2OBg4HjhAOLI40DlCOWA5djl8OYI5iDnqOfA6Fjo8OmI6fDrGOuQ7LjtMO5Y7tDwWPBw8jjysPR49PD2uPcw+Pj5cPs4+7D9eP3w/7kAMQH5AnEEOQSxBnkG8Qi5CTEK+QtxC8kL4Qw5DFEMqQzBDRkNMQ2JDaEN+Q4RDmkOgQ7ZDvEPeRABEJkRMRHJEmES+RORFCkUwRVZFfEWiRchF7kYURjpGQEZGRthG9keIR6ZIOEhWSKRIxkmsSg5KFErWSuBLQktIS05LdEw2TIRMpkzIAAEAWQALAAEAWQALAAEAEf8gABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAIBDAALAVP/5gAEAAv/5gA///QAX//vATz/7QAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAUASP/uAFn/6gG7//ABvP/tAb7/8AACAFT/5gGn/8AACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AABAaf/6wATAFn/wQCz/8UAxf+0AOX/1wDx/7kBBP+yARf/0gEb/8gBL/+gATn/xQFB/+QBSv/MAUz/zAFU/8sBVf/vAan/6AGt/+YBtf/nAbb/5wALAFn/pAGnABMBqf/zAa3/8QG1//IBtv/xAbn/OwG6/9oBu/9UAbz/kQG+/z8ACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAkAVgAOAH//nwC//94Awv/lANT/qADo/8oBRv/jAaf/xgHf//UAAQGnAA4AOQBU/7UAWf/HAGv+uAB6/ygAf/9NAIT/jgCH/6EAs/+uALr/fgC+/2cAwf+HAML/ZQDF/54Ax/9qAMj/cwDJ/14A1P+lAOEADwDl/+QA5v+gAOj/dADq/4AA8f+yAPj/fQD6/4AA/P95AQL/fQEE/38BF/+YARv/2gEn/4EBKf+YAS3/fQEv/7MBM/+gATn/fAE7/5oBPP9sAUH/5gFG/2sBSv+SAUz/rQFQ/3sBUwAPAVT/kQFV//IBp/+vAan/uQGt/7kBtf+5Abb/uQG4/7wBuf/xAbz/8QG9/+0B3P+pAd//yQABAaf/6wAJAAsAFAA/ABEAVP/iAF8AEwGn/7QBqf/ZAa3/2QG1/9kBtv/ZAAkACwAPAD8ADABU/+sAXwAOAaf/ywGp/+kBrf/nAbX/5wG2/+cAGACz/9QAvf/tAL8AEQDF/+AAx//nAMj/5QDJ/+4A1AASAOX/6QDx/9cBL//XATn/0wE7/9YBPP/FAUH/5wFJAA0BSwAMAVT/1gFV//IBqf/pAa3/5wG1/+cBtv/pAd//8AAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBp/+rAan/zQGt/8sBtf/LAbb/ywG5//MBvP/zAb3/7wHc/+gB3//uAAgAWf/lALP/ywDI/+QBpwANAan/7QGt/+sBtf/sAbb/7AAHAPH/8AEE//EBG//zAS//8QFK//MBTP/pAVT/0wAGAMX/6gDo/+4A8f+wAS//7AFU/+wB3P/oAAEA8f/1AAMACwAUAD8AEgBfABMAAQDx/8AAAQDx/8AAAQDx/8AACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAGAMX/6gDo/+4A8f+wAS//7AFU/+wB3P/oAAMASAAPAFYAIABZABEABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UAAQEX//EABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UABgDF/+oA6P/uAPH/sAEv/+wBVP/sAdz/6AABAPH/9QAwAFT/bQBZ/4wAa/2/AHr+fQB//rwAhP8rAIf/SwCz/2EAuv8PAL7+6ADB/x8Awv7lAMX/RgDH/u0AyP79AMn+2QDU/1IA4QAFAOX/vQDm/0kA6P7+AOr/EwDx/2gA+P8OAPr/EwD8/wcBAv8OAQT/EQEX/zwBG/+sASf/FQEp/zwBLf8OAS//agEz/0kBOf8MATv/PwE8/vEBQf/AAUb+7wFK/zEBTP9fAVD/CgFTAAUBVP8wAVX/1QHc/1kB3/+PABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QAAQC/AA0AAgCz/8IAvwAQAAEAv//iAAEAwv/yAAEAvwAOAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1AAMAxf/tAPH/wAHc/+wACgC6/+YAvf/rAL7/6QDA//AAwf/nAMX/4wDH/84AyP/UAMn/2wHf/+4AAQDx/8AABQC9/+wAvwAPAMH/6gDF/8QAx//nAAYASP/pAL3/7gC/ABAAwf/sAMX/IAHc/9oAAQC/AA8ABgDF/+oA6P/uAPH/qwEv/+wBVP/sAdz/6AABAPH/1QABAMUACwANAEgADADBAAsAxQAMAaf/vwGp/+4Brf/sAbX/7QG2/+wBuP/1AbkADgG7AA0BvgANAd//7QABAPH/2AACAPH/qgHc/+EACwDh/9QA8f/JAQT/5QEb/+MBL//EATj/4QFJ/9QBSv/1AUv/5wFT/9IBVP/JAAkA4f/DAPH/zwEv/84BOP/nATv/3wFJ/9EBS//sAVP/oAFU/9EACQDh/8MA8f/PAS//zgE4/+cBO//fAUn/0QFL/+wBU/+gAVT/0QAIAOH/yQDx/98BBP/tARv/6wEv/98BO//pAUr/9QFU/+AACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA4f/mAPH/0AEv/84BOP/oAUn/5wFL/+0BU//mAVT/0AALANQAFADh/+AA6AATATj/4QE5/+ABPP/hAUH/6QFJ/98BS//eAVP/3wFV//IAGACz/9QAvf/tAL8AEQDF/+AAx//nAMj/5QDJ/+4A1AASAOX/6QDx/9cBL//XATn/0wE7/9YBPP/FAUH/5wFJAA0BSwAMAVT/1gFV//IBqf/pAa3/5wG1/+cBtv/pAd//8AAFABn/8gDh//EBSf/yAUv/8gFT//IACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AASANT/rgDhABIA5v/gAOj/rQDq/9YA+P/fAPz/0gEC/+ABF//OASf/3QEp/+IBLf/gATP/4AE5/+kBPP/aAUb/vQFQ/98BUwARAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QADADUABMA4f/mAOL/9ADoABIA8f/nAS//5wE4/+UBOf/oAUn/5gFL/+YBU//mAVT/5wAJAOH/wwDx/88BL//OATj/5wE7/98BSf/RAUv/7AFT/6ABVP/RAAkA4f/DAPH/zwEv/84BOP/nATv/3wFJ/9EBS//sAVP/oAFU/9EAAgDU/+IBU//kAAIA1P/hAOj/5AAGAOj/7gDx/+4BBP/0ARv/8QEv/+8BVP/vAAQA8f/0AQT/9QEv//UBVP/1AAIA6P/JARf/7gAGAOgAFADx/+0A9//iAS//7QE5/+0BVP/tAAEBF//xAAUBF//rAan/6wGt/+kBtf/rAbb/6wATAEgADQDC/6sAw//AAMf/1QDo/6oBF//iARsADAFKAAsBTAALAaf/vwGp/+4Brf/sAbX/7QG2/+wBuP/1AbkADgG7AA0BvgANAd//sAAGAMX/6gDo/+4A8f+wAS//7AFU/+wB3P/oAAYA6AAUAPH/8AD8AAwBL//wATn/5gFU//AABQDoADoA8f/jAS//4gE5/+MBVP/jAAgA8f+6AQT/zwEb/9sBL/9QATn/nQFK//ABTP/yAVT/TAAIAPH/ugEE/88BG//bAS//UAE5/50BSv/wAUz/8gFU/0wABgDF/+oA6P/uAPH/sAEv/+wBVP/sAdz/6AABAOj/7wAIAPH/ugEE/88BG//bAS//UAE5/50BSv/wAUz/8gFU/0wACADx/7oBBP/PARv/2wEv/1ABOf+dAUr/8AFM//IBVP9MAAgA8f+6AQT/zwEb/9sBL/9QATn/nQFK//ABTP/yAVT/TAAcACH/wwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oBL/+fATj/UQE5/3sBO//KATz/3QFB//IBSf91AUv/ygFT/08BVP+MAa3/9QG1//UBuf/HAbr/8QG7/80BvP/dAb7/xAAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAkACwAUAD8AEQBU/+IAXwATAaf/tAGp/9kBrf/ZAbX/2QG2/9kABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UABgDF/+oA6P/uAPH/sAEv/+wBVP/sAdz/6AAwAFT/bQBZ/4wAa/2/AHr+fQB//rwAhP8rAIf/SwCz/2EAuv8PAL7+6ADB/x8Awv7lAMX/RgDH/u0AyP79AMn+2QDU/1IA4QAFAOX/vQDm/0kA6P7+AOr/EwDx/2gA+P8OAPr/EwD8/wcBAv8OAQT/EQEX/zwBG/+sASf/FQEp/zwBLf8OAS//agEz/0kBOf8MATv/PwE8/vEBQf/AAUb+7wFK/zEBTP9fAVD/CgFTAAUBVP8wAVX/1QHc/1kB3/+PAAIA6P/JARf/7gATAFn/wQCz/8UAxf+0AOX/1wDx/7kBBP+yARf/0gEb/8gBL/+gATn/xQFB/+QBSv/MAUz/zAFU/8sBVf/vAan/6AGt/+YBtf/nAbb/5wATAFn/wQCz/8UAxf+0AOX/1wDx/7kBBP+yARf/0gEb/8gBL/+gATn/xQFB/+QBSv/MAUz/zAFU/8sBVf/vAan/6AGt/+YBtf/nAbb/5wACAOj/yQEX/+4AAQBZAAsAAQBZAAsAAQBZAAsAAQBZAAsAAQBZAAsACQGp//IBrf/yAbX/8gG2//IBuf/AAbr/7AG7/8cBvP/YAb7/vwACAbv/7gG8//UAAQGn/9IABAGp/+sBrf/pAbX/6wG2/+sACgGnABEBqf/wAa3/7gG1/+8Btv/wAbn/uwG6/+wBu/+3Abz/1QG+/7QABQGn//MBuf/uAbv/8QG9/+wBvv/qAAQBuf/pAbv/6wG8//EBvv/lAAQBuf/yAbv/8QG8//UBvv/uAAkBp/+/Aan/7gGt/+wBtf/tAbb/7AG4//UBuQAOAbsADQG+AA0AAQGn/+8ABQGn/8cBqf/yAa3/8AG1//ABtv/wAAIBp//cAbkADgAEAan/7QGt/+sBtf/rAbb/6wAJAaf/wAGp/+0Brf/rAbX/6wG2/+sBuQAPAbsAEAG8AA0BvgAQAAUBpwAMAan/8AGt//ABtf/wAbb/8AABAdf/agABAdf/FQAGAEgACwC6//IAx//xAMn/7wHcAA8B3//uAAEBp//VAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QA5AFT/tQBZ/8cAa/64AHr/KAB//00AhP+OAIf/oQCz/64Auv9+AL7/ZwDB/4cAwv9lAMX/ngDH/2oAyP9zAMn/XgDU/6UA4QAPAOX/5ADm/6AA6P90AOr/gADx/7IA+P99APr/gAD8/3kBAv99AQT/fwEX/5gBG//aASf/gQEp/5gBLf99AS//swEz/6ABOf98ATv/mgE8/2wBQf/mAUb/awFK/5IBTP+tAVD/ewFTAA8BVP+RAVX/8gGn/68Bqf+5Aa3/uQG1/7kBtv+5Abj/vAG5//EBvP/xAb3/7QHc/6kB3//JABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAQAC//mAD//9ABf/+8BPP/tAAUASP/uAFn/6gG7//ABvP/tAb7/8AAFAEj/7gBZ/+oBu//wAbz/7QG+//AABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAUASP/uAFn/6gG7//ABvP/tAb7/8AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QABAaf/6wABAaf/6wABAaf/6wABAaf/6wAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBp/+rAan/zQGt/8sBtf/LAbb/ywG5//MBvP/zAb3/7wHc/+gB3//uAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TAAEA8f/1AAEA8f/1AAEA8f/1AAEA8f/1AAEA8f/AAAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAcACH/wwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oBL/+fATj/UQE5/3sBO//KATz/3QFB//IBSf91AUv/ygFT/08BVP+MAa3/9QG1//UBuf/HAbr/8QG7/80BvP/dAb7/xAAHAPH/8AEE//EBG//zAS//8QFK//MBTP/pAVT/0wAcACH/wwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oBL/+fATj/UQE5/3sBO//KATz/3QFB//IBSf91AUv/ygFT/08BVP+MAa3/9QG1//UBuf/HAbr/8QG7/80BvP/dAb7/xAAHAPH/8AEE//EBG//zAS//8QFK//MBTP/pAVT/0wAcACH/wwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oBL/+fATj/UQE5/3sBO//KATz/3QFB//IBSf91AUv/ygFT/08BVP+MAa3/9QG1//UBuf/HAbr/8QG7/80BvP/dAb7/xAAHAPH/8AEE//EBG//zAS//8QFK//MBTP/pAVT/0wAEAAv/5gA///QAX//vATz/7QAEAAv/5gA///QAX//vATz/7QAEAAv/5gA///QAX//vATz/7QAEAAv/5gA///QAX//vATz/7QAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAUASP/uAFn/6gG7//ABvP/tAb7/8AABAPH/9QAFAEj/7gBZ/+oBu//wAbz/7QG+//AAAQDx//UABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAEA8f/1AAUASP/uAFn/6gG7//ABvP/tAb7/8AABAPH/9QAFAEj/7gBZ/+oBu//wAbz/7QG+//AAAQDx//UACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAEA8f/AAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAAQGn/+sAEwBZ/8EAs//FAMX/tADl/9cA8f+5AQT/sgEX/9IBG//IAS//oAE5/8UBQf/kAUr/zAFM/8wBVP/LAVX/7wGp/+gBrf/mAbX/5wG2/+cACwBZ/6QBpwATAan/8wGt//EBtf/yAbb/8QG5/zsBuv/aAbv/VAG8/5EBvv8/AAsAWf+kAacAEwGp//MBrf/xAbX/8gG2//EBuf87Abr/2gG7/1QBvP+RAb7/PwALAFn/pAGnABMBqf/zAa3/8QG1//IBtv/xAbn/OwG6/9oBu/9UAbz/kQG+/z8ACwBZ/6QBpwATAan/8wGt//EBtf/yAbb/8QG5/zsBuv/aAbv/VAG8/5EBvv8/AAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AABAPH/wAAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAAQDx/8AACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAEA8f/AAAEA8f/AAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAMASAAPAFYAIABZABEAAwBIAA8AVgAgAFkAEQADAEgADwBWACAAWQARADkAVP+1AFn/xwBr/rgAev8oAH//TQCE/44Ah/+hALP/rgC6/34Avv9nAMH/hwDC/2UAxf+eAMf/agDI/3MAyf9eANT/pQDhAA8A5f/kAOb/oADo/3QA6v+AAPH/sgD4/30A+v+AAPz/eQEC/30BBP9/ARf/mAEb/9oBJ/+BASn/mAEt/30BL/+zATP/oAE5/3wBO/+aATz/bAFB/+YBRv9rAUr/kgFM/60BUP97AVMADwFU/5EBVf/yAaf/rwGp/7kBrf+5AbX/uQG2/7kBuP+8Abn/8QG8//EBvf/tAdz/qQHf/8kAOQBU/7UAWf/HAGv+uAB6/ygAf/9NAIT/jgCH/6EAs/+uALr/fgC+/2cAwf+HAML/ZQDF/54Ax/9qAMj/cwDJ/14A1P+lAOEADwDl/+QA5v+gAOj/dADq/4AA8f+yAPj/fQD6/4AA/P95AQL/fQEE/38BF/+YARv/2gEn/4EBKf+YAS3/fQEv/7MBM/+gATn/fAE7/5oBPP9sAUH/5gFG/2sBSv+SAUz/rQFQ/3sBUwAPAVT/kQFV//IBp/+vAan/uQGt/7kBtf+5Abb/uQG4/7wBuf/xAbz/8QG9/+0B3P+pAd//yQA5AFT/tQBZ/8cAa/64AHr/KAB//00AhP+OAIf/oQCz/64Auv9+AL7/ZwDB/4cAwv9lAMX/ngDH/2oAyP9zAMn/XgDU/6UA4QAPAOX/5ADm/6AA6P90AOr/gADx/7IA+P99APr/gAD8/3kBAv99AQT/fwEX/5gBG//aASf/gQEp/5gBLf99AS//swEz/6ABOf98ATv/mgE8/2wBQf/mAUb/awFK/5IBTP+tAVD/ewFTAA8BVP+RAVX/8gGn/68Bqf+5Aa3/uQG1/7kBtv+5Abj/vAG5//EBvP/xAb3/7QHc/6kB3//JAAEBp//rAAEBp//rAAEBp//rAAEBp//rAAEBp//rAAEBp//rAAkACwAPAD8ADABU/+sAXwAOAaf/ywGp/+kBrf/nAbX/5wG2/+cAJAAI/+IACwAUAAz/zwA/ABIASP/qAFT/2ABW/+oAXwATAGv/rgB6/80Af/+gAIT/wQCH/8AAs//QALf/6gC6/8YAuwANAL3/6QC+/9YAwf/oAML/ugDF/+kAx//LAMj/2gDJ/8cBbv/TAaf/qwGp/80Brf/LAbX/ywG2/8sBuf/zAbz/8wG9/+8B3P/oAd//7gAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBp/+rAan/zQGt/8sBtf/LAbb/ywG5//MBvP/zAb3/7wHc/+gB3//uAAgAWf/lALP/ywDI/+QBpwANAan/7QGt/+sBtf/sAbb/7AAIAFn/5QCz/8sAyP/kAacADQGp/+0Brf/rAbX/7AG2/+wACABZ/+UAs//LAMj/5AGnAA0Bqf/tAa3/6wG1/+wBtv/sABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAUASP/uAFn/6gG7//ABvP/tAb7/8AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UAJAAI/+IACwAUAAz/zwA/ABIASP/qAFT/2ABW/+oAXwATAGv/rgB6/80Af/+gAIT/wQCH/8AAs//QALf/6gC6/8YAuwANAL3/6QC+/9YAwf/oAML/ugDF/+kAx//LAMj/2gDJ/8cBbv/TAaf/qwGp/80Brf/LAbX/ywG2/8sBuf/zAbz/8wG9/+8B3P/oAd//7gAcACH/wwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oBL/+fATj/UQE5/3sBO//KATz/3QFB//IBSf91AUv/ygFT/08BVP+MAa3/9QG1//UBuf/HAbr/8QG7/80BvP/dAb7/xAACAQwACwFT/+YABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAgAWf/lALP/ywDI/+QBpwANAan/7QGt/+sBtf/sAbb/7AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kABMAWf/BALP/xQDF/7QA5f/XAPH/uQEE/7IBF//SARv/yAEv/6ABOf/FAUH/5AFK/8wBTP/MAVT/ywFV/+8Bqf/oAa3/5gG1/+cBtv/nAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAJAFYADgB//58Av//eAML/5QDU/6gA6P/KAUb/4wGn/8YB3//1ADkAVP+1AFn/xwBr/rgAev8oAH//TQCE/44Ah/+hALP/rgC6/34Avv9nAMH/hwDC/2UAxf+eAMf/agDI/3MAyf9eANT/pQDhAA8A5f/kAOb/oADo/3QA6v+AAPH/sgD4/30A+v+AAPz/eQEC/30BBP9/ARf/mAEb/9oBJ/+BASn/mAEt/30BL/+zATP/oAE5/3wBO/+aATz/bAFB/+YBRv9rAUr/kgFM/60BUP97AVMADwFU/5EBVf/yAaf/rwGp/7kBrf+5AbX/uQG2/7kBuP+8Abn/8QG8//EBvf/tAdz/qQHf/8kAJAAI/+IACwAUAAz/zwA/ABIASP/qAFT/2ABW/+oAXwATAGv/rgB6/80Af/+gAIT/wQCH/8AAs//QALf/6gC6/8YAuwANAL3/6QC+/9YAwf/oAML/ugDF/+kAx//LAMj/2gDJ/8cBbv/TAaf/qwGp/80Brf/LAbX/ywG2/8sBuf/zAbz/8wG9/+8B3P/oAd//7gAYALP/1AC9/+0AvwARAMX/4ADH/+cAyP/lAMn/7gDUABIA5f/pAPH/1wEv/9cBOf/TATv/1gE8/8UBQf/nAUkADQFLAAwBVP/WAVX/8gGp/+kBrf/nAbX/5wG2/+kB3//wAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBp/+rAan/zQGt/8sBtf/LAbb/ywG5//MBvP/zAb3/7wHc/+gB3//uAAEA8f/AAAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAFAEj/7gBZ/+oBu//wAbz/7QG+//AAMABU/20AWf+MAGv9vwB6/n0Af/68AIT/KwCH/0sAs/9hALr/DwC+/ugAwf8fAML+5QDF/0YAx/7tAMj+/QDJ/tkA1P9SAOEABQDl/70A5v9JAOj+/gDq/xMA8f9oAPj/DgD6/xMA/P8HAQL/DgEE/xEBF/88ARv/rAEn/xUBKf88AS3/DgEv/2oBM/9JATn/DAE7/z8BPP7xAUH/wAFG/u8BSv8xAUz/XwFQ/woBUwAFAVT/MAFV/9UB3P9ZAd//jwAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAEBp//rABMAWf/BALP/xQDF/7QA5f/XAPH/uQEE/7IBF//SARv/yAEv/6ABOf/FAUH/5AFK/8wBTP/MAVT/ywFV/+8Bqf/oAa3/5gG1/+cBtv/nABMAWf/BALP/xQDF/7QA5f/XAPH/uQEE/7IBF//SARv/yAEv/6ABOf/FAUH/5AFK/8wBTP/MAVT/ywFV/+8Bqf/oAa3/5gG1/+cBtv/nABIA1P+uAOEAEgDm/+AA6P+tAOr/1gD4/98A/P/SAQL/4AEX/84BJ//dASn/4gEt/+ABM//gATn/6QE8/9oBRv+9AVD/3wFTABEAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QAAgEMAAsBU//mADAAVP9tAFn/jABr/b8Aev59AH/+vACE/ysAh/9LALP/YQC6/w8Avv7oAMH/HwDC/uUAxf9GAMf+7QDI/v0Ayf7ZANT/UgDhAAUA5f+9AOb/SQDo/v4A6v8TAPH/aAD4/w4A+v8TAPz/BwEC/w4BBP8RARf/PAEb/6wBJ/8VASn/PAEt/w4BL/9qATP/SQE5/wwBO/8/ATz+8QFB/8ABRv7vAUr/MQFM/18BUP8KAVMABQFU/zABVf/VAdz/WQHf/48ABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAJAFYADgB//58Av//eAML/5QDU/6gA6P/KAUb/4wGn/8YB3//1AAQAC//mAD//9ABf/+8BPP/tADkAVP+1AFn/xwBr/rgAev8oAH//TQCE/44Ah/+hALP/rgC6/34Avv9nAMH/hwDC/2UAxf+eAMf/agDI/3MAyf9eANT/pQDhAA8A5f/kAOb/oADo/3QA6v+AAPH/sgD4/30A+v+AAPz/eQEC/30BBP9/ARf/mAEb/9oBJ/+BASn/mAEt/30BL/+zATP/oAE5/3wBO/+aATz/bAFB/+YBRv9rAUr/kgFM/60BUP97AVMADwFU/5EBVf/yAaf/rwGp/7kBrf+5AbX/uQG2/7kBuP+8Abn/8QG8//EBvf/tAdz/qQHf/8kAGACz/9QAvf/tAL8AEQDF/+AAx//nAMj/5QDJ/+4A1AASAOX/6QDx/9cBL//XATn/0wE7/9YBPP/FAUH/5wFJAA0BSwAMAVT/1gFV//IBqf/pAa3/5wG1/+cBtv/pAd//8AAHAPH/8AEE//EBG//zAS//8QFK//MBTP/pAVT/0wABAPH/9QAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAYAxf/qAOj/7gDx/7ABL//sAVT/7AHc/+gABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UAAQEX//EAAQDx//UAAgDo/8kBF//uAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1AAkACwAPAD8ADABU/+sAXwAOAaf/ywGp/+kBrf/nAbX/5wG2/+cACQALAA8APwAMAFT/6wBfAA4Bp//LAan/6QGt/+cBtf/nAbb/5wAJAAsADwA/AAwAVP/rAF8ADgGn/8sBqf/pAa3/5wG1/+cBtv/nACQACP/iAAsAFAAM/88APwASAEj/6gBU/9gAVv/qAF8AEwBr/64Aev/NAH//oACE/8EAh//AALP/0AC3/+oAuv/GALsADQC9/+kAvv/WAMH/6ADC/7oAxf/pAMf/ywDI/9oAyf/HAW7/0wGn/6sBqf/NAa3/ywG1/8sBtv/LAbn/8wG8//MBvf/vAdz/6AHf/+4ABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UAAQBZAAsAAQBZAAsAAQBZAAsACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAEA8f/AABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAEA8f/1AAkACwAUAD8AEQBU/+IAXwATAaf/tAGp/9kBrf/ZAbX/2QG2/9kABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UABAAL/+YAP//0AF//7wE8/+0AJAAI/+IACwAUAAz/zwA/ABIASP/qAFT/2ABW/+oAXwATAGv/rgB6/80Af/+gAIT/wQCH/8AAs//QALf/6gC6/8YAuwANAL3/6QC+/9YAwf/oAML/ugDF/+kAx//LAMj/2gDJ/8cBbv/TAaf/qwGp/80Brf/LAbX/ywG2/8sBuf/zAbz/8wG9/+8B3P/oAd//7gAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAGACz/9QAvf/tAL8AEQDF/+AAx//nAMj/5QDJ/+4A1AASAOX/6QDx/9cBL//XATn/0wE7/9YBPP/FAUH/5wFJAA0BSwAMAVT/1gFV//IBqf/pAa3/5wG1/+cBtv/pAd//8AABARf/8QAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAEA8f/1AAEA8f/1AAEA8f/1ABgAs//UAL3/7QC/ABEAxf/gAMf/5wDI/+UAyf/uANQAEgDl/+kA8f/XAS//1wE5/9MBO//WATz/xQFB/+cBSQANAUsADAFU/9YBVf/yAan/6QGt/+cBtf/nAbb/6QHf//AAAQEX//EACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oABgDF/+oA6P/uAPH/sAEv/+wBVP/sAdz/6AASANT/rgDhABIA5v/gAOj/rQDq/9YA+P/fAPz/0gEC/+ABF//OASf/3QEp/+IBLf/gATP/4AE5/+kBPP/aAUb/vQFQ/98BUwARAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1ABIA1P+uAOEAEgDm/+AA6P+tAOr/1gD4/98A/P/SAQL/4AEX/84BJ//dASn/4gEt/+ABM//gATn/6QE8/9oBRv+9AVD/3wFTABEABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UAEgDU/64A4QASAOb/4ADo/60A6v/WAPj/3wD8/9IBAv/gARf/zgEn/90BKf/iAS3/4AEz/+ABOf/pATz/2gFG/70BUP/fAVMAEQAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAYALP/1AC9/+0AvwARAMX/4ADH/+cAyP/lAMn/7gDUABIA5f/pAPH/1wEv/9cBOf/TATv/1gE8/8UBQf/nAUkADQFLAAwBVP/WAVX/8gGp/+kBrf/nAbX/5wG2/+kB3//wAAEBF//xABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TAAUASP/uAFn/6gG7//ABvP/tAb7/8AABAPH/9QAFAEj/7gBZ/+oBu//wAbz/7QG+//AAAQDx//UABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAEA8f/1AAUASP/uAFn/6gG7//ABvP/tAb7/8AABAPH/9QAFAEj/7gBZ/+oBu//wAbz/7QG+//AAAQDx//UABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAEA8f/1AAUASP/uAFn/6gG7//ABvP/tAb7/8AABAPH/9QAFAEj/7gBZ/+oBu//wAbz/7QG+//AAAQDx//UACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gABAaf/6wABAaf/6wAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBp/+rAan/zQGt/8sBtf/LAbb/ywG5//MBvP/zAb3/7wHc/+gB3//uAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1ACQACP/iAAsAFAAM/88APwASAEj/6gBU/9gAVv/qAF8AEwBr/64Aev/NAH//oACE/8EAh//AALP/0AC3/+oAuv/GALsADQC9/+kAvv/WAMH/6ADC/7oAxf/pAMf/ywDI/9oAyf/HAW7/0wGn/6sBqf/NAa3/ywG1/8sBtv/LAbn/8wG8//MBvf/vAdz/6AHf/+4ABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UAJAAI/+IACwAUAAz/zwA/ABIASP/qAFT/2ABW/+oAXwATAGv/rgB6/80Af/+gAIT/wQCH/8AAs//QALf/6gC6/8YAuwANAL3/6QC+/9YAwf/oAML/ugDF/+kAx//LAMj/2gDJ/8cBbv/TAaf/qwGp/80Brf/LAbX/ywG2/8sBuf/zAbz/8wG9/+8B3P/oAd//7gAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QATAFn/wQCz/8UAxf+0AOX/1wDx/7kBBP+yARf/0gEb/8gBL/+gATn/xQFB/+QBSv/MAUz/zAFU/8sBVf/vAan/6AGt/+YBtf/nAbb/5wAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAOQBU/7UAWf/HAGv+uAB6/ygAf/9NAIT/jgCH/6EAs/+uALr/fgC+/2cAwf+HAML/ZQDF/54Ax/9qAMj/cwDJ/14A1P+lAOEADwDl/+QA5v+gAOj/dADq/4AA8f+yAPj/fQD6/4AA/P95AQL/fQEE/38BF/+YARv/2gEn/4EBKf+YAS3/fQEv/7MBM/+gATn/fAE7/5oBPP9sAUH/5gFG/2sBSv+SAUz/rQFQ/3sBUwAPAVT/kQFV//IBp/+vAan/uQGt/7kBtf+5Abb/uQG4/7wBuf/xAbz/8QG9/+0B3P+pAd//yQAYALP/1AC9/+0AvwARAMX/4ADH/+cAyP/lAMn/7gDUABIA5f/pAPH/1wEv/9cBOf/TATv/1gE8/8UBQf/nAUkADQFLAAwBVP/WAVX/8gGp/+kBrf/nAbX/5wG2/+kB3//wAAEBF//xADAAVP9tAFn/jABr/b8Aev59AH/+vACE/ysAh/9LALP/YQC6/w8Avv7oAMH/HwDC/uUAxf9GAMf+7QDI/v0Ayf7ZANT/UgDhAAUA5f+9AOb/SQDo/v4A6v8TAPH/aAD4/w4A+v8TAPz/BwEC/w4BBP8RARf/PAEb/6wBJ/8VASn/PAEt/w4BL/9qATP/SQE5/wwBO/8/ATz+8QFB/8ABRv7vAUr/MQFM/18BUP8KAVMABQFU/zABVf/VAdz/WQHf/48AAgDo/8kBF//uABgAs//UAL3/7QC/ABEAxf/gAMf/5wDI/+UAyf/uANQAEgDl/+kA8f/XAS//1wE5/9MBO//WATz/xQFB/+cBSQANAUsADAFU/9YBVf/yAan/6QGt/+cBtf/nAbb/6QHf//AAAQEX//EAAQDx/8AACQDh/8MA8f/PAS//zgE4/+cBO//fAUn/0QFL/+wBU/+gAVT/0QAwAFT/bQBZ/4wAa/2/AHr+fQB//rwAhP8rAIf/SwCz/2EAuv8PAL7+6ADB/x8Awv7lAMX/RgDH/u0AyP79AMn+2QDU/1IA4QAFAOX/vQDm/0kA6P7+AOr/EwDx/2gA+P8OAPr/EwD8/wcBAv8OAQT/EQEX/zwBG/+sASf/FQEp/zwBLf8OAS//agEz/0kBOf8MATv/PwE8/vEBQf/AAUb+7wFK/zEBTP9fAVD/CgFTAAUBVP8wAVX/1QHc/1kB3/+PABMAWf/BALP/xQDF/7QA5f/XAPH/uQEE/7IBF//SARv/yAEv/6ABOf/FAUH/5AFK/8wBTP/MAVT/ywFV/+8Bqf/oAa3/5gG1/+cBtv/nAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAJAAI/+IACwAUAAz/zwA/ABIASP/qAFT/2ABW/+oAXwATAGv/rgB6/80Af/+gAIT/wQCH/8AAs//QALf/6gC6/8YAuwANAL3/6QC+/9YAwf/oAML/ugDF/+kAx//LAMj/2gDJ/8cBbv/TAaf/qwGp/80Brf/LAbX/ywG2/8sBuf/zAbz/8wG9/+8B3P/oAd//7gABMLIABAAAAAoAHgB0A6YEJASOBNAF7gbkB0IHXAAVADgAFAA5ABIAOwAWARQAFAILABYCkgASApQAFgKWABYC/QAWAwwAFgMPABYDRQASA0cAEgNJABIDSwAWA2AAFANoABYD6gAWA+wAFgPuABYEEwAWAMwADv8WABD/FgAj/1YALP74ADYAFABD/94ARf/rAEb/6wBH/+sASf/rAFH/6wBT/+sAV//qAFj/6ABb/+gAkf/rAJX/6wCX/+oArf9WAK//VgC2/+sAuP/oAMP/6wDE/+sAxv/qAM0AFADRABQA8v/rAP7/6wEI/1YBE//rARX/6AEZ/+sBHf/rAS4AFAE1/+sBNgAUAUf/6wFI/+sBUv/rAWf/FgFr/xYBb/8WAXD/FgHx/1YB8v9WAfP/VgH0/1YB9f9WAfb/VgH3/1YCDP/eAg3/3gIO/94CD//eAhD/3gIR/94CEv/eAhP/6wIU/+sCFf/rAhb/6wIX/+sCHf/rAh7/6wIf/+sCIP/rAiH/6wIi/+oCI//qAiT/6gIl/+oCJv/oAif/6AIo/1YCKf/eAir/VgIr/94CLP9WAi3/3gIv/+sCMf/rAjP/6wI1/+sCN//rAjn/6wI7/+sCPf/rAj//6wJB/+sCQ//rAkX/6wJH/+sCSf/rAlf++AJr/+sCbf/rAm//6wKAABQCggAUAoQAFAKH/+oCif/qAov/6gKN/+oCj//qApH/6gKV/+gC+P9WAwD/VgMQ/+sDFP/qAxb/6wMY/+gDG//qAxz/6wMd/+oDJP74Ayj/VgMzABQDNf/eAzb/6wM4/+sDOv/rAzv/6AM9/+sDRP/oA0z/6ANV/1YDVv/eA1z/6wNh/+gDYv/rA2f/6wNp/+gDbv9WA2//3gNw/1YDcf/eA3X/6wN3/+sDeP/rA4L/6wOE/+sDhv/rA4r/6AOM/+gDjv/oA5X/6wOY/1YDmf/eA5r/VgOb/94DnP9WA53/3gOe/1YDn//eA6D/VgOh/94Dov9WA6P/3gOk/1YDpf/eA6b/VgOn/94DqP9WA6n/3gOq/1YDq//eA6z/VgOt/94Drv9WA6//3gOx/+sDs//rA7X/6wO3/+sDuf/rA7v/6wO9/+sDv//rA8X/6wPH/+sDyf/rA8v/6wPN/+sDz//rA9H/6wPT/+sD1f/rA9f/6wPZ/+sD2//rA93/6gPf/+oD4f/qA+P/6gPl/+oD5//qA+n/6gPr/+gD7f/oA+//6AP2ABQAHwA2/9UAOP/kADn/7AA7/90Azf/VANH/1QEU/+QBLv/VATb/1QIL/90CgP/VAoL/1QKE/9UCkv/sApT/3QKW/90C/f/dAwz/3QMP/90DM//VA0X/7ANH/+wDSf/sA0v/3QNg/+QDaP/dA+r/3QPs/90D7v/dA/b/1QQT/90AGgA2/7AAOP/tADv/0ADN/7AA0f+wART/7QEu/7ABNv+wAgv/0AKA/7ACgv+wAoT/sAKU/9AClv/QAv3/0AMM/9ADD//QAzP/sANL/9ADYP/tA2j/0APq/9AD7P/QA+7/0AP2/7AEE//QABAALP/uADf/7gIH/+4CCP/uAgn/7gIK/+4CV//uAob/7gKI/+4Civ/uAoz/7gKO/+4CkP/uAyT/7gPc/+4D3v/uAEcABAAQAAkAEABF/+gARv/oAEf/6ABJ/+gAU//oAJH/6ACV/+gAtv/oAMP/6ADE/+gA8v/oAP7/6AEZ/+gBHf/oATX/6AFH/+gBSP/oAVL/6AFlABABZgAQAWgAEAFpABABagAQAhP/6AIU/+gCFf/oAhb/6AIX/+gCL//oAjH/6AIz/+gCNf/oAjf/6AI5/+gCO//oAj3/6AI//+gCQf/oAkP/6AJF/+gCR//oAkn/6AMQ/+gDNv/oAzr/6AM9/+gDTQAQA04AEANSABADXP/oA2L/6ANn/+gDdf/oA3f/6AN4/+gDhP/oA5X/6AOx/+gDs//oA7X/6AO3/+gDuf/oA7v/6AO9/+gDv//oA9P/6APV/+gD1//oA9v/6AA9AEX/7ABG/+wAR//sAEn/7ABT/+wAkf/sAJX/7AC2/+wAw//sAMT/7ADy/+wA/v/sARn/7AEd/+wBNf/sAUf/7AFI/+wBUv/sAhP/7AIU/+wCFf/sAhb/7AIX/+wCL//sAjH/7AIz/+wCNf/sAjf/7AI5/+wCO//sAj3/7AI//+wCQf/sAkP/7AJF/+wCR//sAkn/7AMQ/+wDNv/sAzr/7AM9/+wDXP/sA2L/7ANn/+wDdf/sA3f/7AN4/+wDhP/sA5X/7AOx/+wDs//sA7X/7AO3/+wDuf/sA7v/7AO9/+wDv//sA9P/7APV/+wD1//sA9v/7AAXAFH/7AET/+wCHf/sAh7/7AIf/+wCIP/sAiH/7AJr/+wCbf/sAm//7AMW/+wDHP/sAzj/7AOC/+wDhv/sA8X/7APH/+wDyf/sA8v/7APN/+wDz//sA9H/7APZ/+wABgAO/4QAEP+EAWf/hAFr/4QBb/+EAXD/hAAQACz/7AA3/+wCB//sAgj/7AIJ/+wCCv/sAlf/7AKG/+wCiP/sAor/7AKM/+wCjv/sApD/7AMk/+wD3P/sA97/7AABKSwABAAAACIATgDEAaoCkANqBAQGnghkCTYKLAvyDCQMVgzUDroPMBACEhQSyhQwFOoVcBXOFpAXBhcYF0IYlBrSGvQcChyIHLIc3AAdAAT/8gAJ//IAWP/zAFv/8wC4//MBFf/zAWX/8gFm//IBaP/yAWn/8gFq//ICJv/zAif/8wKV//MDGP/zAzv/8wNE//MDTP/zA03/8gNO//IDUv/yA2H/8wNp//MDiv/zA4z/8wOO//MD6//zA+3/8wPv//MAOQAl//MAKf/zADH/8wAz//MAgf/zAJD/8wCU//MArv/zAM7/8wED//MBEv/zARb/8wEY//MBGv/zARz/8wE0//MBUf/zAfj/8wIC//MCA//zAgT/8wIF//MCBv/zAi7/8wIw//MCMv/zAjT/8wJC//MCRP/zAkb/8wJI//MCav/zAmz/8wJu//MCn//zAvz/8wMJ//MDL//zAzL/8wNX//MDY//zA2b/8wOB//MDg//zA4X/8wPE//MDxv/zA8j/8wPK//MDzP/zA87/8wPQ//MD0v/zA9T/8wPW//MD2P/zA9r/8wA5ACX/5gAp/+YAMf/mADP/5gCB/+YAkP/mAJT/5gCu/+YAzv/mAQP/5gES/+YBFv/mARj/5gEa/+YBHP/mATT/5gFR/+YB+P/mAgL/5gID/+YCBP/mAgX/5gIG/+YCLv/mAjD/5gIy/+YCNP/mAkL/5gJE/+YCRv/mAkj/5gJq/+YCbP/mAm7/5gKf/+YC/P/mAwn/5gMv/+YDMv/mA1f/5gNj/+YDZv/mA4H/5gOD/+YDhf/mA8T/5gPG/+YDyP/mA8r/5gPM/+YDzv/mA9D/5gPS/+YD1P/mA9b/5gPY/+YD2v/mADYAI//kADr/0gA7/9MArf/kAK//5ADV/9IBCP/kAfH/5AHy/+QB8//kAfT/5AH1/+QB9v/kAff/5AIL/9MCKP/kAir/5AIs/+QClP/TApb/0wL4/+QC/f/TAwD/5AMM/9MDDf/SAw//0wMo/+QDNP/SA0v/0wNV/+QDaP/TA2v/0gNu/+QDcP/kA3n/0gOT/9IDmP/kA5r/5AOc/+QDnv/kA6D/5AOi/+QDpP/kA6b/5AOo/+QDqv/kA6z/5AOu/+QD6v/TA+z/0wPu/9MD+P/SBAD/0gQT/9MAJgAO/x4AEP8eACP/zQCt/80Ar//NAQj/zQFn/x4Ba/8eAW//HgFw/x4B8f/NAfL/zQHz/80B9P/NAfX/zQH2/80B9//NAij/zQIq/80CLP/NAvj/zQMA/80DKP/NA1X/zQNu/80DcP/NA5j/zQOa/80DnP/NA57/zQOg/80Dov/NA6T/zQOm/80DqP/NA6r/zQOs/80Drv/NAKYARf/cAEb/3ABH/9wASf/cAE//8wBQ//MAUf/WAFL/8wBT/9wAV//dAFj/4QBb/+EAkf/cAJX/3ACX/90Atv/cALj/4QC8//MAw//cAMT/3ADG/90A5//zAOv/8wDs//MA7v/zAO//8wDw//MA8v/cAPP/8wD1//MA9v/zAPn/8wD7//MA/v/cAQD/8wET/9YBFf/hARn/3AEd/9wBMf/zATX/3AFA//MBRf/zAUf/3AFI/9wBUv/cAhP/3AIU/9wCFf/cAhb/3AIX/9wCHP/zAh3/1gIe/9YCH//WAiD/1gIh/9YCIv/dAiP/3QIk/90CJf/dAib/4QIn/+ECL//cAjH/3AIz/9wCNf/cAjf/3AI5/9wCO//cAj3/3AI//9wCQf/cAkP/3AJF/9wCR//cAkn/3AJk//MCZv/zAmj/8wJp//MCa//WAm3/1gJv/9YCh//dAon/3QKL/90Cjf/dAo//3QKR/90Clf/hAxD/3AMS//MDFP/dAxb/1gMY/+EDG//dAxz/1gMd/90DNv/cAzf/8wM4/9YDOf/zAzr/3AM7/+EDPf/cAz7/8wND//MDRP/hA0z/4QNU//MDXP/cA13/8wNh/+EDYv/cA2f/3ANp/+EDdf/cA3f/3AN4/9wDfv/zA4D/8wOC/9YDhP/cA4b/1gOK/+EDjP/hA47/4QOS//MDlf/cA7H/3AOz/9wDtf/cA7f/3AO5/9wDu//cA73/3AO//9wDxf/WA8f/1gPJ/9YDy//WA83/1gPP/9YD0f/WA9P/3APV/9wD1//cA9n/1gPb/9wD3f/dA9//3QPh/90D4//dA+X/3QPn/90D6f/dA+v/4QPt/+ED7//hA/P/8wP1//MD///zBAz/8wQO//MEEP/zAHEABP/aAAn/2gBF//AARv/wAEf/8ABJ//AAU//wAFf/7wBY/9wAW//cAJH/8ACV//AAl//vALb/8AC4/9wAw//wAMT/8ADG/+8A8v/wAP7/8AEV/9wBGf/wAR3/8AE1//ABR//wAUj/8AFS//ABZf/aAWb/2gFo/9oBaf/aAWr/2gIT//ACFP/wAhX/8AIW//ACF//wAiL/7wIj/+8CJP/vAiX/7wIm/9wCJ//cAi//8AIx//ACM//wAjX/8AI3//ACOf/wAjv/8AI9//ACP//wAkH/8AJD//ACRf/wAkf/8AJJ//ACh//vAon/7wKL/+8Cjf/vAo//7wKR/+8Clf/cAxD/8AMU/+8DGP/cAxv/7wMd/+8DNv/wAzr/8AM7/9wDPf/wA0T/3ANM/9wDTf/aA07/2gNS/9oDXP/wA2H/3ANi//ADZ//wA2n/3AN1//ADd//wA3j/8AOE//ADiv/cA4z/3AOO/9wDlf/wA7H/8AOz//ADtf/wA7f/8AO5//ADu//wA73/8AO///AD0//wA9X/8APX//AD2//wA93/7wPf/+8D4f/vA+P/7wPl/+8D5//vA+n/7wPr/9wD7f/cA+//3AA0AAT/oAAJ/6AAV//xAFj/xQBb/8UAl//xALj/xQDG//EBFf/FAWX/oAFm/6ABaP+gAWn/oAFq/6ACIv/xAiP/8QIk//ECJf/xAib/xQIn/8UCh//xAon/8QKL//ECjf/xAo//8QKR//EClf/FAxT/8QMY/8UDG//xAx3/8QM7/8UDRP/FA0z/xQNN/6ADTv+gA1L/oANh/8UDaf/FA4r/xQOM/8UDjv/FA93/8QPf//ED4f/xA+P/8QPl//ED5//xA+n/8QPr/8UD7f/FA+//xQA9AEX/5wBG/+cAR//nAEn/5wBT/+cAkf/nAJX/5wC2/+cAw//nAMT/5wDy/+cA/v/nARn/5wEd/+cBNf/nAUf/5wFI/+cBUv/nAhP/5wIU/+cCFf/nAhb/5wIX/+cCL//nAjH/5wIz/+cCNf/nAjf/5wI5/+cCO//nAj3/5wI//+cCQf/nAkP/5wJF/+cCR//nAkn/5wMQ/+cDNv/nAzr/5wM9/+cDXP/nA2L/5wNn/+cDdf/nA3f/5wN4/+cDhP/nA5X/5wOx/+cDs//nA7X/5wO3/+cDuf/nA7v/5wO9/+cDv//nA9P/5wPV/+cD1//nA9v/5wBxAAQADAAJAAwARf/oAEb/6ABH/+gASf/oAFH/6gBT/+gAWAALAFsACwCR/+gAlf/oALb/6AC4AAsAw//oAMT/6ADy/+gA/v/oARP/6gEVAAsBGf/oAR3/6AE1/+gBR//oAUj/6AFS/+gBZQAMAWYADAFoAAwBaQAMAWoADAIT/+gCFP/oAhX/6AIW/+gCF//oAh3/6gIe/+oCH//qAiD/6gIh/+oCJgALAicACwIv/+gCMf/oAjP/6AI1/+gCN//oAjn/6AI7/+gCPf/oAj//6AJB/+gCQ//oAkX/6AJH/+gCSf/oAmv/6gJt/+oCb//qApUACwMQ/+gDFv/qAxgACwMc/+oDNv/oAzj/6gM6/+gDOwALAz3/6ANEAAsDTAALA00ADANOAAwDUgAMA1z/6ANhAAsDYv/oA2f/6ANpAAsDdf/oA3f/6AN4/+gDgv/qA4T/6AOG/+oDigALA4wACwOOAAsDlf/oA7H/6AOz/+gDtf/oA7f/6AO5/+gDu//oA73/6AO//+gDxf/qA8f/6gPJ/+oDy//qA83/6gPP/+oD0f/qA9P/6APV/+gD1//oA9n/6gPb/+gD6wALA+0ACwPvAAsADABa/+0AXP/tAOn/7QKY/+0Cmv/tApz/7QM8/+0DbP/tA3r/7QOU/+0D+f/tBAH/7QAMAFr/8gBc//IA6f/yApj/8gKa//ICnP/yAzz/8gNs//IDev/yA5T/8gP5//IEAf/yAB8AWP/0AFr/8gBb//QAXP/zALj/9ADp//IBFf/0Aib/9AIn//QClf/0Apj/8wKa//MCnP/zAxj/9AM7//QDPP/yA0T/9ANM//QDYf/0A2n/9ANs//IDev/yA4r/9AOM//QDjv/0A5T/8gPr//QD7f/0A+//9AP5//IEAf/yAHkABP/KAAn/ygA2/9IAOP/UADr/9AA7/9MAT//RAFD/0QBS/9EAWP/mAFr/7wBb/+YAuP/mALz/0QDN/9IA0f/SANX/9ADZ/+0A3P/hAOf/0QDp/+8A6//RAOz/0QDu/9EA7//RAPD/0QDz/9EA9f/RAPb/0QD5/9EA+//RAQD/0QEU/9QBFf/mAS7/0gEx/9EBNv/SAUD/0QFF/9EBZf/KAWb/ygFo/8oBaf/KAWr/ygIL/9MCHP/RAib/5gIn/+YCZP/RAmb/0QJo/9ECaf/RAoD/0gKC/9IChP/SApT/0wKV/+YClv/TAv3/0wMM/9MDDf/0Aw//0wMS/9EDGP/mAyf/7QMz/9IDNP/0Azf/0QM5/9EDO//mAzz/7wM+/9EDQ//RA0T/5gNL/9MDTP/mA03/ygNO/8oDUv/KA1T/0QNd/9EDYP/UA2H/5gNo/9MDaf/mA2v/9ANs/+8Def/0A3r/7wN+/9EDgP/RA4n/7QOK/+YDi//tA4z/5gON/+0Djv/mA4//4QOS/9EDk//0A5T/7wPq/9MD6//mA+z/0wPt/+YD7v/TA+//5gPz/9ED9f/RA/b/0gP4//QD+f/vA/r/4QP8/+ED///RBAD/9AQB/+8EDP/RBA7/0QQQ/9EEE//TAB0ANv++AFj/7wBb/+8AuP/vAM3/vgDR/74BFf/vAS7/vgE2/74CJv/vAif/7wKA/74Cgv++AoT/vgKV/+8DGP/vAzP/vgM7/+8DRP/vA0z/7wNh/+8Daf/vA4r/7wOM/+8Djv/vA+v/7wPt/+8D7//vA/b/vgA0ADb/5gA4/+cAOv/yADv/5wBa//EAzf/mANH/5gDV//IA2f/uANz/6ADp//EBFP/nAS7/5gE2/+YCC//nAoD/5gKC/+YChP/mApT/5wKW/+cC/f/nAwz/5wMN//IDD//nAyf/7gMz/+YDNP/yAzz/8QNL/+cDYP/nA2j/5wNr//IDbP/xA3n/8gN6//EDif/uA4v/7gON/+4Dj//oA5P/8gOU//ED6v/nA+z/5wPu/+cD9v/mA/j/8gP5//ED+v/oA/z/6AQA//IEAf/xBBP/5wCEACMAEAAl/+gAKf/oADH/6AAz/+gANv/gADj/4AA7/98Agf/oAJD/6ACU/+gArQAQAK7/6ACvABAAzf/gAM7/6ADPABAA0f/gANgAEADc/+EA7QAQAPT/4AD/ABABA//oAQgAEAES/+gBFP/gARb/6AEY/+gBGv/oARz/6AEu/+ABNP/oATb/4AFNABABUf/oAfEAEAHyABAB8wAQAfQAEAH1ABAB9gAQAfcAEAH4/+gCAv/oAgP/6AIE/+gCBf/oAgb/6AIL/98CKAAQAioAEAIsABACLv/oAjD/6AIy/+gCNP/oAkL/6AJE/+gCRv/oAkj/6AJq/+gCbP/oAm7/6AKA/+ACgv/gAoT/4AKU/98Clv/fAp//6AL4ABAC/P/oAv3/3wMAABADCf/oAwz/3wMP/98DKAAQAy//6AMy/+gDM//gA0v/3wNVABADV//oA2D/4ANj/+gDZv/oA2j/3wNuABADcAAQA4H/6AOD/+gDhf/oA4//4QOQ/+ADlgAQA5cAEAOYABADmgAQA5wAEAOeABADoAAQA6IAEAOkABADpgAQA6gAEAOqABADrAAQA64AEAPE/+gDxv/oA8j/6APK/+gDzP/oA87/6APQ/+gD0v/oA9T/6APW/+gD2P/oA9r/6APq/98D7P/fA+7/3wP2/+AD+v/hA/v/4AP8/+ED/f/gBBEAEAQSABAEE//fAC0ANv/xADj/9AA6//QAO//wAM3/8QDP//UA0f/xANX/9ADY//UA2f/zART/9AEu//EBNv/xAU3/9QIL//ACgP/xAoL/8QKE//EClP/wApb/8AL9//ADDP/wAw3/9AMP//ADJ//zAzP/8QM0//QDS//wA2D/9ANo//ADa//0A3n/9AOJ//MDi//zA43/8wOT//QDlv/1A+r/8APs//AD7v/wA/b/8QP4//QEAP/0BBH/9QQT//AAWQAjAA8ANv/mADj/5gA6AA4AO//mAK0ADwCvAA8Azf/mAM8ADgDR/+YA1QAOANgADgDZAAsA3P/lAO0ADwD0/+gA/wAPAQgADwEU/+YBLv/mATb/5gFNAA4B8QAPAfIADwHzAA8B9AAPAfUADwH2AA8B9wAPAgv/5gIoAA8CKgAPAiwADwKA/+YCgv/mAoT/5gKU/+YClv/mAvgADwL9/+YDAAAPAwz/5gMNAA4DD//mAycACwMoAA8DM//mAzQADgNL/+YDVQAPA2D/5gNo/+YDawAOA24ADwNwAA8DeQAOA4kACwOLAAsDjQALA4//5QOQ/+gDkwAOA5YADgOXAA8DmAAPA5oADwOcAA8DngAPA6AADwOiAA8DpAAPA6YADwOoAA8DqgAPA6wADwOuAA8D6v/mA+z/5gPu/+YD9v/mA/gADgP6/+UD+//oA/z/5QP9/+gEAAAOBBEADgQSAA8EE//mAC4ANv/jADr/5QA7/+QAzf/jAM//5QDR/+MA1f/lANj/5QDZ/+kA7f/qAP//6gEu/+MBNv/jAU3/5QIL/+QCgP/jAoL/4wKE/+MClP/kApb/5AL9/+QDDP/kAw3/5QMP/+QDJ//pAzP/4wM0/+UDS//kA2j/5ANr/+UDef/lA4n/6QOL/+kDjf/pA5P/5QOW/+UDl//qA+r/5APs/+QD7v/kA/b/4wP4/+UEAP/lBBH/5QQS/+oEE//kACEANv/iADr/5ADN/+IAz//kANH/4gDV/+QA2P/kANn/6QDt/+sA///rAS7/4gE2/+IBTf/kAoD/4gKC/+IChP/iAw3/5AMn/+kDM//iAzT/5ANr/+QDef/kA4n/6QOL/+kDjf/pA5P/5AOW/+QDl//rA/b/4gP4/+QEAP/kBBH/5AQS/+sAFwA2/+sAO//zAM3/6wDR/+sBLv/rATb/6wIL//MCgP/rAoL/6wKE/+sClP/zApb/8wL9//MDDP/zAw//8wMz/+sDS//zA2j/8wPq//MD7P/zA+7/8wP2/+sEE//zADAAT//vAFD/7wBS/+8AWv/wALz/7wDn/+8A6f/wAOv/7wDs/+8A7v/vAO//7wDw/+8A8//vAPX/7wD2/+8A+f/vAPv/7wEA/+8BMf/vAUD/7wFF/+8CHP/vAmT/7wJm/+8CaP/vAmn/7wMS/+8DN//vAzn/7wM8//ADPv/vA0P/7wNU/+8DXf/vA2z/8AN6//ADfv/vA4D/7wOS/+8DlP/wA/P/7wP1/+8D+f/wA///7wQB//AEDP/vBA7/7wQQ/+8AHQAE//IACf/yAFj/9QBb//UAuP/1ARX/9QFl//IBZv/yAWj/8gFp//IBav/yAib/9QIn//UClf/1Axj/9QM7//UDRP/1A0z/9QNN//IDTv/yA1L/8gNh//UDaf/1A4r/9QOM//UDjv/1A+v/9QPt//UD7//1AAQA9P/tA5D/7QP7/+0D/f/tAAoABP/1AAn/9QFl//UBZv/1AWj/9QFp//UBav/1A03/9QNO//UDUv/1AFQARf/wAEb/8ABH//AASf/wAFH/6wBT//AAkf/wAJX/8AC2//AAw//wAMT/8ADy//AA/v/wARP/6wEZ//ABHf/wATX/8AFH//ABSP/wAVL/8AIT//ACFP/wAhX/8AIW//ACF//wAh3/6wIe/+sCH//rAiD/6wIh/+sCL//wAjH/8AIz//ACNf/wAjf/8AI5//ACO//wAj3/8AI///ACQf/wAkP/8AJF//ACR//wAkn/8AJr/+sCbf/rAm//6wMQ//ADFv/rAxz/6wM2//ADOP/rAzr/8AM9//ADXP/wA2L/8ANn//ADdf/wA3f/8AN4//ADgv/rA4T/8AOG/+sDlf/wA7H/8AOz//ADtf/wA7f/8AO5//ADu//wA73/8AO///ADxf/rA8f/6wPJ/+sDy//rA83/6wPP/+sD0f/rA9P/8APV//AD1//wA9n/6wPb//AAjwAEAA0ACQANAEP/8ABF/7AARv+wAEf/sABJ/7AAUf/WAFP/sABYAAsAWwALAJH/sACV/7AAtv+wALgACwDE/7AA7f+vAPL/sAD+/7AA//+vARP/1gEVAAsBGf+wAR3/sAE1/7ABR/+wAUj/sAFS/7ABZQANAWYADQFoAA0BaQANAWoADQIM//ACDf/wAg7/8AIP//ACEP/wAhH/8AIS//ACE/+wAhT/sAIV/7ACFv+wAhf/sAId/9YCHv/WAh//1gIg/9YCIf/WAiYACwInAAsCKf/wAiv/8AIt//ACL/+wAjH/sAIz/7ACNf+wAjf/sAI5/7ACO/+wAj3/sAI//7ACQf+wAkP/sAJF/7ACR/+wAkn/sAJr/9YCbf/WAm//1gKVAAsDEP+wAxb/1gMYAAsDHP/WAzX/8AM2/7ADOP/WAzr/sAM7AAsDPf+wA0QACwNMAAsDTQANA04ADQNSAA0DVv/wA1z/sANhAAsDYv+wA2f/sANpAAsDb//wA3H/8AN1/7ADd/+wA3j/sAOC/9YDhP+wA4b/1gOKAAsDjAALA44ACwOV/7ADl/+vA5n/8AOb//ADnf/wA5//8AOh//ADo//wA6X/8AOn//ADqf/wA6v/8AOt//ADr//wA7H/sAOz/7ADtf+wA7f/sAO5/7ADu/+wA73/sAO//7ADxf/WA8f/1gPJ/9YDy//WA83/1gPP/9YD0f/WA9P/sAPV/7AD1/+wA9n/1gPb/7AD6wALA+0ACwPvAAsEEv+vAAgA7QAQAPT/8AD/ABADkP/wA5cAEAP7//AD/f/wBBIAEABFAEUADABGAAwARwAMAEkADABTAAwAkQAMAJUADAC2AAwAwwAMAMQADADtABgA8gAMAPT/9wD+AAwA/wAYARkADAEdAAwBNQAMAUcADAFIAAwBUgAMAhMADAIUAAwCFQAMAhYADAIXAAwCLwAMAjEADAIzAAwCNQAMAjcADAI5AAwCOwAMAj0ADAI/AAwCQQAMAkMADAJFAAwCRwAMAkkADAMQAAwDNgAMAzoADAM9AAwDXAAMA2IADANnAAwDdQAMA3cADAN4AAwDhAAMA5D/9wOVAAwDlwAYA7EADAOzAAwDtQAMA7cADAO5AAwDuwAMA70ADAO/AAwD0wAMA9UADAPXAAwD2wAMA/v/9wP9//cEEgAYAB8AWP/0AFr/8ABb//QAuP/0AOn/8ADt//MA///zARX/9AIm//QCJ//0ApX/9AMY//QDO//0Azz/8ANE//QDTP/0A2H/9ANp//QDbP/wA3r/8AOK//QDjP/0A47/9AOU//ADl//zA+v/9APt//QD7//0A/n/8AQB//AEEv/zAAoABP/WAAn/1gFl/9YBZv/WAWj/1gFp/9YBav/WA03/1gNO/9YDUv/WAAoABP/1AAn/9QFl//UBZv/1AWj/9QFp//UBav/1A03/9QNO//UDUv/1AF4ABAALAAkACwBF/+sARv/rAEf/6wBJ/+sAUf/pAFP/6wCR/+sAlf/rALb/6wDD/+sAxP/rAPL/6wD+/+sBE//pARn/6wEd/+sBNf/rAUf/6wFI/+sBUv/rAWUACwFmAAsBaAALAWkACwFqAAsCE//rAhT/6wIV/+sCFv/rAhf/6wId/+kCHv/pAh//6QIg/+kCIf/pAi//6wIx/+sCM//rAjX/6wI3/+sCOf/rAjv/6wI9/+sCP//rAkH/6wJD/+sCRf/rAkf/6wJJ/+sCa//pAm3/6QJv/+kDEP/rAxb/6QMc/+kDNv/rAzj/6QM6/+sDPf/rA00ACwNOAAsDUgALA1z/6wNi/+sDZ//rA3X/6wN3/+sDeP/rA4L/6QOE/+sDhv/pA5X/6wOx/+sDs//rA7X/6wO3/+sDuf/rA7v/6wO9/+sDv//rA8X/6QPH/+kDyf/pA8v/6QPN/+kDz//pA9H/6QPT/+sD1f/rA9f/6wPZ/+kD2//rAAILHgAEAAAN5hU6ACEAHQAAABH/zv+PABL/9f/v/4j/9P+7/3//9QAM/6n/ov/JAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/lAAAAAP/o/8kAAP/zAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAA/+UAEQAAAAAAAAAAAAD/4wAAAAAAAP/k/+QAAAASABEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+EAAAAAAAAAAAAAAAAAAAAA/+UAAAAA/+r/1QAAAAD/6//q/5r/6QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/jAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/mAAAAAAAAAAAAAP/tAAAAFP/vAAAAAAAAAAAAAAAAAAAAAAAA/+0AAAAAAAAAAAAAAAAAAAAA/8v/uP98/37/5AAAAAD/nQAPABD/of/EABAAEAAAAAD/sQAA/yYAAP+d/7P/GP+T//D/j/+M/xAAAP+S/3L/DP8P/70AAAAA/0QABQAH/0v/hgAHAAcAAAAA/z4AAP56AAD/RP9q/mL/M//R/yz/JwAAAAAAAAAAAAD/2AAAAAAAAP/sAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+wAAAAAAAAAAAAAAAAAAAAAAAD/2P+jAAD/4QAAAAD/5QAAAAD/6QAAAAAAAAAAAAAAAAAAAAAAAP/mAAD/wP/pAAAAAAAAAAAAAAAA/3sAAAAA/7//yv92AAD/cf7t/9QAAP9R/xEAAAAAABMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/yQAPAAD/2QAAAAAAAP/zAAAAAAAAAAAAAAAAAAAAAP92/+H+vP/m//MAAAAAAAAAAP/1AAD/OAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/6gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//UAAAAA//MAAAAA/9IAAAAA/+QAAAAAAAAAAAAA/7UAAP8fAAD/1AAA/9sAAAAA/9IAAAAAAAAAEf/h/9EAEf/nAAAAAP/rAAAAAP/rAAAADgAAAAAAAAAAAAAAAAAA/+YAAP/SAAAAAAAAAAAAAAAAAAD/7AAAAAD/4/+gAAD/vwARABH/2f/iABIAEgAAAAD/ogAN/y0AAP+//+n/zP/Y//D/t//G/6AAAAAAAAAAAAAAAAAAAAAA/+EAAAAO/+0AAAAAAAAAAAAA/9UAAP+FAAD/4QAA/8QAAAAA/98AAAAAAAAAAP/lAAAAAP/mAAAAAP/rAAAAAP/tAAAAAAAAAAAAAAANAAAAAAAA/+sAAAAAAAAAAAAAAAAAAAAA/8oAAP/p/7v/6QAAAAD/vQAAABIAAAAAAAAAEgAAAAD/pQAA/m0AAP+9AAD/if+aAAD/kf/SAAAAAAAA//EAAAAAAAAAAP+9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/9QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/9QAA//IAAAAA/+MAAAAAAAAAAP/xAAAAAAAAAAAAAAAAAAAAAAAA//EAAAAAAAAAAAAAAAAAAAAA//MAAAAAAAAAAP/yAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/8QAA//AAAAAA/+wAAAAAAAAAAP/wAAAAAAAAAAAAAAAAAAAAAAAA/+sAAAAAAAAAAAAAAAAAAAAAAAAAAP/XAAAAAAAP//EAAAAAAAAAAAAAAAAAAAAAAAAAAP+VAAD/8wAAAAAAAAAA//EAAAAAAAAAAAASAAAAAAAAAAAAEP/sAAAAAAAAAAAAAAAAAAAAAAAAAAD/hQAA/+0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/7AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/sAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/lf/DAAAAAAAAAAAAAAAAAAAAAP+IAAAAAAAA/8UAAAAA/+wAAP/O/7AAAAAAAAAAAAAAAAAAAAAA/1YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/1AAAAAAAAAAAAAP/AAAAAAP71AAAAAP/I/63/5//rAAD/8AAAAAAAAP/JAAAAAAAAAAAAAAAAAAAAAP/d/9kAAAAAAAD/eQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/9QAAAAAAAAAAAAAAAAACAIgABAAEAAAACQAJAAEAEQARAAIAIwAoAAMAKgAzAAkANgA8ABMAQwBEABoARwBIABwASgBKAB4ATwBSAB8AVABUACMAWABYACQAWgBbACUAiACIACcAmQCZACgArACwACkAsgC0AC4AtgC2ADEAuAC5ADIAuwC8ADQAvgDAADYAwgDHADkAzQDNAD8AzwDZAEAA2wDbAEsA3QDfAEwA4QDjAE8A5QDpAFIA7ADsAFcA8QDzAFgA9gD3AFsA+QD7AF0A/wEAAGABBQEFAGIBCAEIAGMBEwEVAGQBJwEpAGcBLAEsAGoBLgEuAGsBRQFFAGwBZQFmAG0BaAFqAG8BpgGmAHIBqQGpAHMBqwGrAHQBsAGxAHUBtAG2AHcBuAG+AHoBxAHEAIEB2wHcAIIB6AHoAIQB7AHtAIUB7wHvAIcB8QISAIgCFAIXAKoCHAIhAK4CJgIuALQCMAIwAL0CMgIyAL4CNAI0AL8CNgI2AMACOAJBAMECSgJMAMsCTgJOAM4CUAJQAM8CUgJSANACVAJUANECVwJXANICWQJZANMCWwJbANQCXQJdANUCXwJfANYCYQJhANcCYwJvANgCcQJxAOUCcwJzAOYCdQJ1AOcCgAKAAOgCggKCAOkChAKEAOoChgKGAOsCiAKIAOwCigKKAO0CjAKMAO4CjgKOAO8CkAKQAPACkgKSAPEClAKXAPICmQKZAPYCmwKbAPcC+AL9APgDAAMPAP4DEgMSAQ4DFgMWAQ8DGAMYARADHAMcAREDHwMgARIDIgMrARQDLQMvAR4DMQM2ASEDOAM5AScDOwM+ASkDRANFAS0DRwNHAS8DSQNJATADSwNOATEDUgNXATUDWgNaATsDXANcATwDYANhAT0DZgNmAT8DaANxAUADdAN1AUoDdwN6AUwDgQOCAVADhgOGAVIDiAOOAVMDkwOUAVoDmAPAAVwDwgPCAYUDxAPRAYYD2QPZAZQD3APcAZUD3gPeAZYD6gPvAZcD8gPyAZ0D9AP0AZ4D9gP2AZ8D+AP5AaAD/gQBAaIEBAQEAaYEBgQHAacECQQJAakEDQQNAaoEDwQPAasEEwQTAawAAQAKAAoAKAAzADQAPQBIAE0AVgBZAF0AAQAiAJkAsACyALMAtAC7AL4AvwDAAMUAxwDIAMkAzQDRANMA1ADWAN4A4gDjAOQA5QDmAOgA6gDsAPEA8wD2APsA/gEdAdwAAgB2AAQABAAAAAkACQABAA4ADgACABAAEAADACMAJwAEACoAMgAJADYAPAASAEMARQAZAEcARwAcAEoASgAdAE8AUgAeAFQAVAAiAFgAWAAjAFoAXAAkAIgAiAAnAKwArwAoALgAuAAsALwAvAAtAMIAwgAuAM8A0AAvANIA0gAxANUA1QAyANcA2QAzANsA2wA2AN0A3QA3AN8A3wA4AOEA4QA5AOcA5wA6AOkA6QA7APIA8gA8APcA9wA9APkA+gA+AP8BAABAAQUBBQBCAQgBCABDARMBFQBEAScBKQBHASwBLABKAS4BLgBLAUUBRQBMAWUBawBNAW8BcABUAewB7QBWAe8B7wBYAfECFwBZAhwCIQCAAiYCNgCGAjgCQQCXAkoCTAChAk4CTgCkAlACUAClAlICUgCmAlQCVACnAlcCVwCoAlkCWQCpAlsCWwCqAl0CXQCrAl8CXwCsAmECYQCtAmMCbwCuAnECcQC7AnMCcwC8AnUCdQC9AoACgAC+AoICggC/AoQChADAAoYChgDBAogCiADCAooCigDDAowCjADEAo4CjgDFApACkADGApICkgDHApQCnADIAvgC/QDRAwADDwDXAxIDEgDnAxYDFgDoAxgDGADpAxwDHADqAx8DIADrAyIDKwDtAy0DLwD3AzEDNgD6AzgDPgEAA0QDRQEHA0cDRwEJA0kDSQEKA0sDTgELA1IDVwEPA1oDWgEVA1wDXAEWA2ADYQEXA2YDcQEZA3QDdQElA3cDegEnA4EDggErA4YDhgEtA4gDjgEuA5MDlAE1A5gDwAE3A8IDwgFgA8QD0QFhA9kD2QFvA9wD3AFwA94D3gFxA+oD7wFyA/ID8gF4A/QD9AF5A/YD9gF6A/gD+QF7A/4EAQF9BAQEBAGBBAYEBwGCBAkECQGEBA0EDQGFBA8EDwGGBBMEEwGHAAIBOAAEAAQAHQAJAAkAHQAOAA4AHgAQABAAHgAkACQAAQAlACUABAAmACYAAwAnACcABQAqACsAAgAsACwADAAtAC0ACQAuAC4ACgAvADAAAgAxADEAAwAyADIACwA2ADYABgA3ADcADAA4ADgADQA5ADkAEAA6ADoADgA7ADsADwA8ADwAEQBDAEMAEwBEAEQAFQBFAEUAFABHAEcAFgBKAEoAFwBPAFAAFwBRAFEAGABSAFIAFQBUAFQAGgBYAFgAGQBaAFoAGwBbAFsAGQBcAFwAHACIAIgAFQCsAKwABwCuAK4AAwC4ALgAGQC8ALwAFwDCAMIAFQDPANAAHwDSANIAAgDVANUADgDXANgAAgDZANkAEgDbANsAAgDdAN0AAgDfAN8AHwDhAOEAHwDnAOcACADpAOkAGwDyAPIAFQD3APcAIAD5APkAIAD6APoAFQD/AQAAIAEFAQUAIAETARMAGAEUARQADQEVARUAGQEnAScAFQEoASgABwEpASkACAEsASwACQEuAS4ACQFFAUUACAFlAWYAHQFnAWcAHgFoAWoAHQFrAWsAHgFvAXAAHgHsAe0AAwHvAe8ABgH4AfgABAH5AfwABQH9AgEAAgICAgYAAwIHAgoADAILAgsADwIMAhIAEwITAhMAFAIUAhcAFgIcAhwAFwIdAiEAGAImAicAGQIpAikAEwIrAisAEwItAi0AEwIuAi4ABAIvAi8AFAIwAjAABAIxAjEAFAIyAjIABAIzAjMAFAI0AjQABAI1AjUAFAI2AjYAAwI4AjgABQI5AjkAFgI6AjoABQI7AjsAFgI8AjwABQI9Aj0AFgI+Aj4ABQI/Aj8AFgJAAkAABQJBAkEAFgJKAkoAAgJLAksAFwJMAkwAAgJOAk4AAgJQAlAAAgJSAlIAAgJUAlQAAgJXAlcADAJZAlkACQJbAlsACgJdAl0ACgJfAl8ACgJhAmEACgJjAmMAAgJkAmQAFwJlAmUAAgJmAmYAFwJnAmcAAgJoAmkAFwJqAmoAAwJrAmsAGAJsAmwAAwJtAm0AGAJuAm4AAwJvAm8AGAJxAnEAGgJzAnMAGgJ1AnUAGgKAAoAABgKCAoIABgKEAoQABgKGAoYADAKIAogADAKKAooADAKMAowADAKOAo4ADAKQApAADAKSApIAEAKUApQADwKVApUAGQKWApYADwKXApcAEQKYApgAHAKZApkAEQKaApoAHAKbApsAEQKcApwAHAL5AvkABQL6AvsAAgL8AvwAAwL9Av0ADwMBAwEAAQMCAwIABQMDAwMAEQMEAwUAAgMGAwYACQMHAwgAAgMJAwkAAwMKAwoACwMLAwsABgMMAwwADwMNAw0ADgMOAw4AAgMPAw8ADwMSAxIAFwMWAxYAGAMYAxgAGQMcAxwAGAMfAx8ABQMgAyAABwMiAyMAAgMkAyQADAMlAyYACQMnAycAEgMpAykAAQMqAyoABwMrAysABQMtAy4AAgMvAy8AAwMxAzEACwMyAzIABAMzAzMABgM0AzQADgM1AzUAEwM2AzYAFgM4AzgAGAM5AzkAFQM6AzoAFAM7AzsAGQM8AzwAGwM9Az0AFgM+Az4ACANEA0QAGQNFA0UAEANHA0cAEANJA0kAEANLA0sADwNMA0wAGQNNA04AHQNSA1IAHQNTA1MAAgNUA1QAFwNWA1YAEwNXA1cAAwNaA1oABQNcA1wAFgNgA2AADQNhA2EAGQNmA2YABANnA2cAFANoA2gADwNpA2kAGQNqA2oAAgNrA2sADgNsA2wAGwNtA20AAgNvA28AEwNxA3EAEwN0A3QABQN1A3UAFgN3A3gAFgN5A3kADgN6A3oAGwOBA4EAAwOCA4IAGAOGA4YAGAOIA4gAFQOJA4kAEgOKA4oAGQOLA4sAEgOMA4wAGQONA40AEgOOA44AGQOTA5MADgOUA5QAGwOZA5kAEwObA5sAEwOdA50AEwOfA58AEwOhA6EAEwOjA6MAEwOlA6UAEwOnA6cAEwOpA6kAEwOrA6sAEwOtA60AEwOvA68AEwOwA7AABQOxA7EAFgOyA7IABQOzA7MAFgO0A7QABQO1A7UAFgO2A7YABQO3A7cAFgO4A7gABQO5A7kAFgO6A7oABQO7A7sAFgO8A7wABQO9A70AFgO+A74ABQO/A78AFgPAA8AAAgPCA8IAAgPEA8QAAwPFA8UAGAPGA8YAAwPHA8cAGAPIA8gAAwPJA8kAGAPKA8oAAwPLA8sAGAPMA8wAAwPNA80AGAPOA84AAwPPA88AGAPQA9AAAwPRA9EAGAPZA9kAGAPcA9wADAPeA94ADAPqA+oADwPrA+sAGQPsA+wADwPtA+0AGQPuA+4ADwPvA+8AGQPyA/IACQP0A/QAAgP2A/YABgP4A/gADgP5A/kAGwP+A/4ABwP/A/8ACAQABAAADgQBBAEAGwQEBAQAFwQGBAYAHwQHBAcABwQJBAkACQQNBA0AAgQPBA8AAgQTBBMADwABAAQEFgAHAAAAAAAAAAAABwAAAAAAAAAAABMAFwATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEAAAAFAAAAAAAAAAUAAAAAABwAAAAAAAAAAAAFAAAABQAAABkACgAGAA0ACQASAA4AFAAAAAAAAAAAAAAAAAAaAAAAFQAVABUAAAAVAAAAAAAAAAAAAAAYABgACAAYABUAAAAbAAAACwACAAAAFgACAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAVAAAAAAAFABUAAAALAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEABQARAAAAAAAAAAAAAAAAABUAAAACAAAAAAAAABgAAAAAAAAAAAAAAAAAFQAVAAAACwAAAAAAAAAAAAAAAAAKAAUAAQAAAAoAAAAAAAAAEgAAAAAAAQAQAAAAAAAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAABYAAAAYABgABAAYABgAGAAAABUAGAADABgAGAAAAAAAGAAAABgAAAAAABUABAAYAAAAAAAFAAAAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAAFAAgADQACAAUAAAAFABUABQAAAAUAFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAABgAAAAAAAUAFQAKAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAYAAAAFQAVAAAAAAAAAAAAAQAAAAAAAAAFABUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFwAXAAAABwAHABMABwAHAAcAEwAAAAAAAAATABMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABcAAAAAAAAAAAAAABEAEQARABEAEQARABEABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABgAGAAYABgAOABoAGgAaABoAGgAaABoAFQAVABUAFQAVAAAAAAAAAAAAGAAIAAgACAAIAAgACwALAAsACwACAAIAEQAaABEAGgARABoABQAVAAUAFQAFABUABQAVAAAAFQAAABUAAAAVAAAAFQAAABUAAAAVAAUAFQAFABUABQAVAAUAFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAABgAAAAYABgABQAIAAUACAAFAAgAAAAAAAAAAAAAAAAAGQAbABkAGwAZABsAGQAbABkAGwAKAAAACgAAAAoAAAAGAAsABgALAAYACwAGAAsABgALAAYACwAJAAAADgACAA4AFAAMABQADAAUAAwAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAUADgAAAAAAEQAAAAAAFAAAAAAAAAAAAAAABQAAAAAADgASAAAADgAVAAAAGAAAAAsAAAAIAAAAAgAAAAAACwAIAAsAAAAAAAAAAAAAAAAAHAAAAAAAEAARAAAAAAAAAAAAAAAAAAUAAAAAAAUACgASABoAFQAYAAgAGAAVAAIAFgAVABgAGwAAAAAAAAAYAAIACQAAAAkAAAAJAAAADgACAAcABwAAAAAAAAAHAAAAGAARABoABQAAAAAAAAAAABUAGAAAAAAADQACABUABQAAAAAABQAVAA4AAgAAABIAFgAAABEAGgARABoAAAAAAAAAFQAAABUAFQASABYAAAAAAAAAGAAAABgABQAIAAUAFQAFAAgAAAAAABAAAgAQAAIAEAACAA8AAwAAABgAEgAWABUAAQAEABEAGgARABoAEQAaABEAGgARABoAEQAaABEAGgARABoAEQAaABEAGgARABoAEQAaAAAAFQAAABUAAAAVAAAAFQAAABUAAAAVAAAAFQAAABUAAAAAAAAAAAAFAAgABQAIAAUACAAFAAgABQAIAAUACAAFAAgABQAVAAUAFQAFABUABQAIAAUAFQAGAAsABgALAAAACwAAAAsAAAALAAAACwAAAAsADgACAA4AAgAOAAIAAAAAAAAAGAAAABgACgAAABIAFgAPAAMADwADAAAAGAASABYAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAGAAAABgAAQAEAA4AAAAAAAAAAAAAABcAAQAAAAoALACOAAFERkxUAAgABAAAAAD//wAIAAAAAQACAAMABAAFAAYABwAIbGlnYQAybG51bQA4c21jcAA+c3MwMQBEc3MwMgBKc3MwMwBQc3MwNABWc3MwNQBcAAAAAQABAAAAAQACAAAAAQAAAAAAAQADAAAAAQAEAAAAAQAFAAAAAQAGAAAAAQAHAAgAEgAaACIAKgAyADoAQgBKAAEAAAABAEAABAAAAAEB9gABAAAAAQIAAAEAAAABAhIAAQAAAAECEAABAAAAAQIOAAEAAAABAgwAAQAAAAECDgACAhAA3AGmAacBqAGpAaoBqwGsAa0BrgGvAbABsQGyAbMBtAHoAbUBtgG3AbgBuQG6AbsBvAG9Ab4BpgGnAagBqQGqAasBrAGtAa4BrwGwAbEBsgGzAbQB6AG1AbYBtwG4AbkBugG7AbwBvQG+AvcCogKhAqICowKjAqQCpQKmAqcCqAKpAqoCqwKsAq0CrgKvArACsQKyArMCtAK1ArYCtwK4ArkCugK7ArwCvQK+AqQCpQKmAqcCqAKpAqoCqwKsAq0CrgKvArACsQKyArMCtAK1ArYCtwK4ArkCugK7ArwCvQK+AvMCvwK/AsACwALBAsECwgLCAsMCwwLFAsUCxgLGAscCxwLIAsgCyQLJAsoCygLLAssCzALMAs0CzQLPAs8C0ALQAtEC0QLSAtIC0wLTAtQC1ALVAtYC1gLXAtcC2ALYAtkC2QLaAtoC2wLbAtwC3ALdAt0C3gLeAt8C3wLgAuAC4QLhAuIC4gLjAuMC5ALkAuUC5QLmAuYC5wLnAugC6P////8C6gLqAusC6wLsAuwC7QLtAu4C7gLvAu8C8ALwAvEC8QLyAvIC8wL0AvQC9QL1AvYC9gKhAAEApAABAAgAAQAEAZIAAgBLAAIAmAAKAZgBzAHEAdYB1wHYAdkB2wHdAecAAQCIAZEAAQCIASgAAQCIAa4AAgCIAAIB4wHkAAIAfgACAeUB5gACAA0AIwA8AAAAQwBcABoAgwCDADQAhQCFADUB7AHtADYB7wIxADgCNAJFAHsCSAJUAI0CVwJoAJoCagJ7AKwCfgJ/AL4CggKcAMAD8APwANsAAQABAEgAAgABABIAGwAAAAEAAQBJAAEAAQC2AAEAAQA0AAEAAgAtAE0=","Roboto-Medium.ttf":"AAEAAAAOAIAAAwBgR0RFRgsuCy8AASxgAAAASEdQT1OQeyOPAAEsqAAAl/pHU1VCeolvLwABxKQAAANsT1MvMrkTKcoAAAFoAAAAYFZETVhu6nZPAAASOAAABeBjbWFwf76BZgAAGBgAAA7iZ2x5Zm8zqQ4AACb8AADUQGhlYWT1Pw7VAAAA7AAAADZoaGVhCx4JIwAAASQAAAAkaG10eLpNNCcAAAHIAAAQcGxvY2EEms7QAAD7PAAACDptYXhwBDsA9gAAAUgAAAAgbmFtZb10XwMAAQN4AAAEn3Bvc3Tfb5xiAAEIGAAAJEYAAQAAAAEAAF5SMstfDzz1AAkIAAAAAADE8BEuAAAAAM2CsnL6JP3VCYsIYgAAAAkAAgAAAAAAAAABAAAHbP4MAAAJnfok/V0JiwABAAAAAAAAAAAAAAAAAAAEHAABAAAEHACXABYAXQAFAAEAAAAAAAAAAAAAAAAAAwABAAME3gH0AAUAAAWaBTMAAAEfBZoFMwAAA9EAZgIAAAAAAAAAAAAAAAAA4AAC/1AAIFsAAAAgAAAAAHB5cnMAAAAA//0GAP4AAGYHmgIAIAABn08BAAAEOgWwAAAAIAACAf4AAAAAAAAB/gAAAf4AAAKYAFIE4gA8BIwAZAXgAGQFHQA+AVoAUgK3AIACvAARA38AGwR1AEQBwgAnAqAARwI8AJkDKgACBIwAaASMAMoEjABRBIwATwSMADgEjACBBIwAdASMAEUEjABhBIwAUgIlAJkCIABRBBEAPwSOAJEEKgCAA+QAKQchAEoFQgAaBSAAnwUgAHQFYgCfBKMAnwShAJ8FbQB0BbAAnwJNAK0EfAA6BSgAnwRkAJ8HAgCfBbAAnwWPAHQFKwCfBZAAdAVFAJ8E8wBTBOoANQV0AIYFKwAaBwIARAUUAC8FAwATBMAAWAIxAIQDVwAVAjEADANrADUDnAADApQASgRaAF4EiACABDMAUQSIAFMEPABZAs8AMQSIAFQEiAB9AhMAkAIZ/7AEMACBAhMAkAb1AIAEiAB+BIgAUwSIAIAEiABTAtoAgAQpAFECnQAZBIgAewQOACAF+gAlBA4AIQQOABAEDgBVAq8AOAICAK4CrwAbBVEAdQIeAI8EfQBoBLUAUQWdAF0E4AAaAfwAiAT4AFoEHgCkBkQAVwORAHQD4gBUBG0AfwZEAFcD2wCHAwoAfwRLAF8DYQBtA2MAYQKxAHgEuwCSBBAAPgJCAKACEABtAjUAZAOnAHcD4gBcBgwAmwZmAJMG0wBmBAEAYAeF//YERABNBXoAaQTKAJQE5wCIBsEANAS6ADwEkQBDBIkAUwSXAIcFogAYAhoAjwSYAI4EJAAbAj8AGwWSAJMEiAB+B7QAZQc6AFsCDACLAtD/3QWJAGYEnwBSBaUAhgTyAHsCJv+1BDwAWQPmAJsDsAB5A3wAdQJPAJoCsgCCAk0AKQPYAIADLwB6ApwAqwAA/NsAAP02AAD8eQAA/T4AAPwMAAD9IgJdANcEPACdAkIAoAR1AJ8FvQAaBXsAZgU5ACMEkQBwBbEAnwSRAEcF6wBLBacASAVbAGwEhABWBMYAlgQOACAEiABUBGAAYAQaAGEEiAB+BKIAcwKmAKkEagAWBBMAZAT3AE8EiACABDcAUgSQAFIELgBABGAAgAXQAEQFyQBPBpQAZgUuAHUEdf/uBnEAMwX/ACQFPgByCIoALgiRAJ8GXwA1BasAmQUIAJQGBwAmB5oAGATTAEoFqgCaBakALgUKAD8GYABPBfYAmQWIAI8HmgCeB/oAngYaABgG+QCfBQcAlAU8AIgHVACqBPsALQR9AFsEjwCPA1oAhQT2ACcGdgAXBBYATQSYAIYEbgCPBJoAHwYDAI8ElwCGBJgAhgP1ACMF0wBUBNMAhgRmAF8GjgCGBuwAfgUYAB8GbwCPBGgAjwQ8AFEGhACQBHAAJwSJ/+EEPQBYBtEAHwbkAIYEif/1BJgAhgdDAI0GTwBwBGf/4AcpAKIGAQCGBQcAIARgAAoHQgC2BjYAnQbtAIQF5gCCCTIArQf5AI8EIQApA/AAMwV7AGoEiQBSBRkAEQQOACAFewBqBIkAUwc+AI0GRAB0B0MAjQZQAHAFHQBqBEoAXAT/AG0AAPxmAAD8cwAA/XsAAP2lAAD6JP7p+k0EZ//gBRQAnwSHAIAEagCUA6IAfgS3AJ8EIAB+BSoAlASrAI4GlgA0BaQAPgfRAJ8FqwB+CEcAnwb1AH4GJQBpBP8AYQcyAC4FcQAmBXUAggRzAHQFhwCKBiYAIATE/84FHwCUBHgAjgWwAJ8EiAB+BYgAUwSmAF0EpgBdBMcAOwNTADQFBwBUBusAZgbdAF4GUwA7BSgALwR7AEkEPwB1B74AQwadAD8H/gCYBp4AdwUDAGIELABVBaoAIgUdAEQFVwCHBBQAAAgpAAAEFAAACCkAAAK5AAACCgAAAVwAAAR/AAACMAAAAaIAAADRAAAAAAAABYcArQaBALIDnQAEAcAAYAG8ADMBzgAyAagARwMUAGIDGwBAAwgAMgRdAEAEmQBcAssAiAP6AJwFpgCcB6gASwJyAGwCaQBUA5wALQOpAD8DXABpBLUATwa4AJkETQBLBeUAcQPiAEUIyACYBQkAZAUUAJYGyQBpB2EAageRAGoG7wBqBLsAQwWWAKYE2QBABIMAngSyADsIRQBkAiH/sgSOAGUETACYBEYAqgRLAKAEGgAkAlsAswKYAGMB8QBFBKgAGAAAAAAIMABZCDUAXAQyAE0DiwBNBJMAbAMn/58CEP+wAk0AGAGzAFwDoQB1A6EAdQOhAHUECwB5BAsAdQQL/0wECwB6A6EAWwIFAJAEyAAcBIwAjgSUAGgErwCOBEcAjgQqAI4E2wBoBRIAjgIVAI4EFwAuBHcAjgO9AI4GBgCOBSEAjgTKAGYE3QBoBKgAjgRwAE8EMgA8BQAAfgSxABwGDgA0BIwALARVABMETQBKBIYAbQKFAD4D/wBSBCIATQRlADkEfABRBD0AbQOvADwEQwBSBCoAPwIzAFcDVQBrA2YAYAL9ADgDdgBoA3YAcAMAAFIDgwBoA2YAYAOfAHADuQCXArIAlgNCAGwEjABPBIwAOASMAIEEmAB0BDsACgQ0ADIEYgA+BIwAYQS7AFYEiABTBUkAnwRaAGAFMgCfBSgAnwQwAIEFOgCfBC0AgQSNAFIEjACOA3wAdQH+AAACoABHBYAAJAWAACQEpv/9BOoANQKd/+cFQgAaBUIAGgVCABoFQgAaBUIAGgVCABoFQgAaBSAAdASjAJ8EowCfBKMAnwSjAJ8CTf/MAk0ArQJN/9gCTf+9BbAAnwWPAHQFjwB0BY8AdAWPAHQFjwB0BXQAhgV0AIYFdACGBXQAhgUDABMEWgBeBFoAXgRaAF4EWgBeBFoAXgRaAF4EWgBeBDMAUQQ8AFkEPABZBDwAWQQ8AFkCGv+vAhoAjwIa/7sCGv+gBIgAfgSIAFMEiABTBIgAUwSIAFMEiABTBIgAewSIAHsEiAB7BIgAewQOABAEDgAQBUIAGgRaAF4FQgAaBFoAXgVCABoEWgBeBSAAdAQzAFEFIAB0BDMAUQUgAHQEMwBRBSAAdAQzAFEFYgCfBR4AUwSjAJ8EPABZBKMAnwQ8AFkEowCfBDwAWQSjAJ8EPABZBKMAnwQ8AFkFbQB0BIgAVAVtAHQEiABUBW0AdASIAFQFbQB0BIgAVAWwAJ8EiAB9Ak3/vwIa/6ICTf+/Ahr/ogJN/+UCGv/IAk0AHAIT//4CTQCjBskArQQsAJAEfAA6Aib/tQUoAJ8EMACBBGQAnwITAJAEZACfAhMAWARkAJ8CqQCQBGQAnwLvAJAFsACfBIgAfgWwAJ8EiAB+BbAAnwSIAH4EiP/VBY8AdASIAFMFjwB0BIgAUwWPAHQEiABTBUUAnwLaAIAFRQCfAtoAVgVFAJ8C2gBDBPMAUwQpAFEE8wBTBCkAUQTzAFMEKQBRBPMAUwQpAFEE8wBTBCkAUQTqADUCnQAZBOoANQKdABkE6gA1AsUAGQV0AIYEiAB7BXQAhgSIAHsFdACGBIgAewV0AIYEiAB7BXQAhgSIAHsFdACGBIgAewcCAEQF+gAlBQMAEwQOABAFAwATBMAAWAQOAFUEwABYBA4AVQTAAFgEDgBVB4X/9gbBADQFegBpBIkAUwSv/+oEr//qBDIAPATIABwEyAAcBMgAHATIABwEyAAcBMgAHATIABwElABoBEcAjgRHAI4ERwCOBEcAjgIV/6wCFQCOAhX/uAIV/50FIQCOBMoAZgTKAGYEygBmBMoAZgTKAGYFAAB+BQAAfgUAAH4FAAB+BFUAEwTIABwEyAAcBMgAHASUAGgElABoBJQAaASUAGgErwCOBEcAjgRHAI4ERwCOBEcAjgRHAI4E2wBoBNsAaATbAGgE2wBoBRIAjgIV/58CFf+fAhX/xQIV//kCFQCEBBcALgR3AI4DvQCOA70AjgO9AI4DvQCOBSEAjgUhAI4FIQCOBMoAZgTKAGYEygBmBKgAjgSoAI4EqACOBHAATwRwAE8EcABPBHAATwQyADwEMgA8BQAAfgUAAH4FAAB+BQAAfgUAAH4FAAB+Bg4ANARVABMEVQATBE0ASgRNAEoETQBKCOAATwVCABoFB/+vBhT/3AKx/+MFowAqBWf/ZwVvABMCpv+wBUIAGgUgAJ8EowCfBMAAWAWwAJ8CTQCtBSgAnwcCAJ8FsACfBY8AdAUrAJ8E6gA1BQMAEwUUAC8CTf+9BQMAEwSEAFYEYABgBIgAfgKmAKkEYACABJgAjgSIAFMEuwCSBA4AIAQOACECpv/EBGAAgASIAFMEYACABpQAZgSjAJ8EdQCfBPMAUwJNAK0CTf+9BHwAOgUoAJ8FKACfBQoAPwVCABoFIACfBHUAnwSjAJ8FqgCaBwIAnwWwAJ8FjwB0BbEAnwUrAJ8FIAB0BOoANQUUAC8EWgBeBDwAWQSYAIYEiABTBIgAgAQzAFEEDgAQBA4AIQQ8AFkDWgCFBCkAUQITAJACGv+gAhn/sARuAI8EDgAQBwIARAX6ACUHAgBEBfoAJQcCAEQF+gAlBQMAEwQOABABWgBSApgAUgRKAJoE4gAxAib/tQG8ADMHAgCfBvUAgAVCABoEWgBeBY//PQd3ADEHsQAxBKMAnwWqAJoEPABZBJgAhgWnAEgFyQBPBRkAEQQO/+MIlgBTCZ0AdATTAEoEFgBNBSAAdAQzAFEFAwATBA4AIAJNAK0HmgAYBnYAFwJNAK0FQgAaBFoAXgVCABoEWgBeB4X/9gbBADQEowCfBDwAWQWIAFMEPABZBDwAWQeaABgGdgAXBNMASgQWAE0FqgCaBJgAhgWqAJoEmACGBY8AdASIAFMFewBqBIkAUgV7AGoEiQBSBTwAiAQ8AFEFCgA/BA4AEAUKAD8EDgAQBQoAPwQOABAFiACPBGYAXwb5AJ8GbwCPBRQALwQOACEEiABTBakALgSaAB8FQgAaBFoAXgVCABoEWgBeBUIAGgRaAF4FQgAEBFr/iQVCABoEWgBeBUIAGgRaAF4FQgAaBFoAXgVCABoEWgBeBUIAGgRaAF4FQgAaBFoAXgVCABoEWgBeBUIAGgRaAF4EowCfBDwAWQSjAJ8EPABZBKMAnwQ8AFkEowCfBDwAWQSj/8wEPP+LBKMAnwQ8AFkEowCfBDwAWQSjAJ8EPABZAk0ArQIaAI8CTQCfAhMAggWPAHQEiABTBY8AdASIAFMFjwB0BIgAUwWPACsEiP+mBY8AdASIAFMFjwB0BIgAUwWPAHQEiABTBYkAZgSfAFIFiQBmBJ8AUgWJAGYEnwBSBYkAZgSfAFIFiQBmBJ8AUgV0AIYEiAB7BXQAhgSIAHsFpQCGBPIAewWlAIYE8gB7BaUAhgTyAHsFpQCGBPIAewWlAIYE8gB7BQMAEwQOABAFAwATBA4AEAUDABMEDgAQBKYAUwSmAFMFKACfBG4AjwWwAJ8ElwCGBOoANQP1ACMFFAAvBA4AIQWIAI8EZgBfBYgAjwRmAF8EdQCfA1oAhQeaABgGdgAXBiYAIATE/84EiAB9BQf/1wUH/9cEdf/3A1r/6QU8/90ERP/MBaoAmgSYAIYFsACfBJcAhgcCAJ8GAwCPBakALgSaAB8FAwATBA4AIAUUAC8EDgAhBGAAYAShABYGgQCyAAAAAAIlAJoAAAABAAEBAQEBAAwA+Aj/AAgACP/+AAkACf/9AAoACv/9AAsAC//9AAwADP/9AA0ADf/8AA4ADv/8AA8AD//8ABAAEP/8ABEAEf/7ABIAEv/7ABMAE//7ABQAFP/7ABUAFP/6ABYAFf/6ABcAFv/6ABgAF//6ABkAGP/5ABoAGf/5ABsAGv/5ABwAG//5AB0AHP/4AB4AHf/4AB8AHv/4ACAAH//4ACEAIP/3ACIAIf/3ACMAIv/3ACQAI//3ACUAJP/2ACYAJf/2ACcAJv/2ACgAJ//2ACkAJ//1ACoAKP/1ACsAKf/1ACwAKv/1AC0AK//0AC4ALP/0AC8ALf/0ADAALv/0ADEAL//zADIAMP/zADMAMf/zADQAMv/zADUAM//yADYANP/yADcANf/yADgANv/yADkAN//xADoAOP/xADsAOf/xADwAOv/xAD0AOv/wAD4AO//wAD8APP/wAEAAPf/wAEEAPv/vAEIAP//vAEMAQP/vAEQAQf/vAEUAQv/uAEYAQ//uAEcARP/uAEgARf/uAEkARv/tAEoAR//tAEsASP/tAEwASf/tAE0ASv/sAE4AS//sAE8ATP/sAFAATf/sAFEATf/rAFIATv/rAFMAT//rAFQAUP/rAFUAUf/qAFYAUv/qAFcAU//qAFgAVP/qAFkAVf/pAFoAVv/pAFsAV//pAFwAWP/pAF0AWf/oAF4AWv/oAF8AW//oAGAAXP/oAGEAXf/nAGIAXv/nAGMAX//nAGQAYP/nAGUAYP/mAGYAYf/mAGcAYv/mAGgAY//mAGkAZP/lAGoAZf/lAGsAZv/lAGwAZ//lAG0AaP/kAG4Aaf/kAG8Aav/kAHAAa//kAHEAbP/jAHIAbf/jAHMAbv/jAHQAb//jAHUAcP/iAHYAcf/iAHcAcv/iAHgAc//iAHkAc//hAHoAdP/hAHsAdf/hAHwAdv/hAH0Ad//gAH4AeP/gAH8Aef/gAIAAev/gAIEAe//fAIIAfP/fAIMAff/fAIQAfv/fAIUAf//eAIYAgP/eAIcAgf/eAIgAgv/eAIkAg//dAIoAhP/dAIsAhf/dAIwAhv/dAI0Ahv/cAI4Ah//cAI8AiP/cAJAAif/cAJEAiv/bAJIAi//bAJMAjP/bAJQAjf/bAJUAjv/aAJYAj//aAJcAkP/aAJgAkf/aAJkAkv/ZAJoAk//ZAJsAlP/ZAJwAlf/ZAJ0Alv/YAJ4Al//YAJ8AmP/YAKAAmf/YAKEAmf/XAKIAmv/XAKMAm//XAKQAnP/XAKUAnf/WAKYAnv/WAKcAn//WAKgAoP/WAKkAof/VAKoAov/VAKsAo//VAKwApP/VAK0Apf/UAK4Apv/UAK8Ap//UALAAqP/UALEAqf/TALIAqv/TALMAq//TALQArP/TALUArP/SALYArf/SALcArv/SALgAr//SALkAsP/RALoAsf/RALsAsv/RALwAs//RAL0AtP/QAL4Atf/QAL8Atv/QAMAAt//QAMEAuP/PAMIAuf/PAMMAuv/PAMQAu//PAMUAvP/OAMYAvf/OAMcAvv/OAMgAv//OAMkAv//NAMoAwP/NAMsAwf/NAMwAwv/NAM0Aw//MAM4AxP/MAM8Axf/MANAAxv/MANEAx//LANIAyP/LANMAyf/LANQAyv/LANUAy//KANYAzP/KANcAzf/KANgAzv/KANkAz//JANoA0P/JANsA0f/JANwA0v/JAN0A0v/IAN4A0//IAN8A1P/IAOAA1f/IAOEA1v/HAOIA1//HAOMA2P/HAOQA2f/HAOUA2v/GAOYA2//GAOcA3P/GAOgA3f/GAOkA3v/FAOoA3//FAOsA4P/FAOwA4f/FAO0A4v/EAO4A4//EAO8A5P/EAPAA5f/EAPEA5f/DAPIA5v/DAPMA5//DAPQA6P/DAPUA6f/CAPYA6v/CAPcA6//CAPgA7P/CAPkA7f/BAPoA7v/BAPsA7//BAPwA8P/BAP0A8f/AAP4A8v/AAP8A8//AAAAAAwAAAAMAAAiEAAEAAAAAABwAAwABAAACJgAGAgoAAAAAAQAAAQAAAAAAAAAAAAAAAAAAAAEAAgAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAMEGwAEAAUABgAHAAgACQAKAAsADAANAA4ADwAQABEAEgATABQAFQAWABcAGAAZABoAGwAcAB0AHgAfACAAIQAiACMAJAAlACYAJwAoACkAKgArACwALQAuAC8AMAAxADIAMwA0ADUANgA3ADgAOQA6ADsAPAA9AD4APwBAAEEAQgBDAEQARQBGAEcASABJAEoASwBMAE0ATgBPAFAAUQBSAFMAVABVAFYAVwBYAFkAWgBbAFwAXQBeAF8AYAAAAfUB9gH4AfoCAQIGAgoCDQIMAg4CEAIPAhECEwIVAhQCFgIXAhkCGAIaAhsCHAIeAh0CHwIhAiACIwIiAiQCJQFsAG8AYgBjAGcBbgB1AIMAbQBpAX0AcwBoAYsAfwCBAYgAcAGMAY0AZQB0AYMBhQGEAMEBiQBqAHkAtQCEAIcAfgBhAGwBhwCTAYoArQBrAHoBcAADAfEB9AIFAJAAkQFiAWMBaQFqAWUBZgCGAY4CJwKWAXQBeQFyAXMBkgNQAW0AdgFnAWsBcQHzAfsB8gH8AfkB/gH/AgAB/QIDAgQAAAICAggCCQIHAIoAmgCgAG4AnACdAJ4AdwChAJ8AmwAEBl4AAADqAIAABgBqAAAAAgANACEAfgCgAKwArQC/AMYAzwDmAO8A/gEPAREBJQEnATABOAFAAVMBXwFnAX4BfwGSAaEBsAHwAfsB/wIZAhsCNwJZArwCxwLJAt0C8wMBAwMDCQMPAyMDigOMA5IDoQOwA7kDyQPOA9ID1gQlBC8ERQRPBGIEbwR5BIYEzgTXBOEE9QUBBRAFEx4BHj8ehR7xHvMe+R9NIAsgFSAeICIgJiAwIDMgOiA8IEQgdCB/IKQgpyCsIQUhEyEWISIhJiEuIV4iAiIGIg8iEiIaIh4iKyJIImAiZSXK7gL2w/sE/v///f//AAAAAAACAA0AIAAiAKAAoQCtAK4AwADHANAA5wDwAP8BEAESASYBKAExATkBQQFUAWABaAF/AZIBoAGvAfAB+gH8AhgCGgI3AlkCvALGAskC2ALzAwADAwMJAw8DIwOEA4wDjgOTA6MDsQO6A8oD0QPWBAAEJgQwBEYEUARjBHAEegSIBM8E2ATiBPYFAgURHgAePh6AHqAe8h70H00gACATIBcgICAlIDAgMiA5IDwgRCB0IH8goyCnIKshBSETIRYhIiEmIS4hWyICIgYiDyIRIhoiHiIrIkgiYCJkJcruAfbD+wH+///8//8AAQQY//UAAP/iAAD/wAAA/78AAAExAAABLAAAASgAAAEmAAABJAAAASIAAAEcAAABHgAA/wH+9P7nAWEAAAChAGQAZv5h/kAAlv3U/aX9xP2v/aP9ov2d/Zj9hQAA/3D/bwAAAAD9BQAA/1D8+fz2AAD8tQAA/K0AAPyiAAD8nAAA/p4AAP6bAAD8RQAA5VXlFeTF5PjkWeT25ArhVgAA4U3hTOFK4UHjG+E54xPhMOEB4PcAAODRAADgdeBo4GbgW9+P4FDgJN+B3qffdd90323fat9e30LfK98o28QTjgrOAAAClAGYAAEAAAAAAAAA5AAAAOQAAADiAAAA4AAAAOoAAAEUAAABLgAAAS4AAAEuAAABOgAAAVwAAAFoAAAAAAAAAAABYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFEAAAAAAFMAWgAAAGAAAAAAAAAAZgAAAHgAAACCAAAAioAAAI6AAACxAAAAtQAAALoAAAAAAAAAAAAAAAAAAAAAALcAAAAAAAAAAAAAAAAAAAAAAAAAAACzAAAAswAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqYAAAAAAAAAAwQbAeoB6wHxAfIB8wH0AfUB9gB/Ae0CAQICAgMCBAIFAgYAgACBAgcCCAIJAgoCCwCCAIMCDAINAg4CDwIQAhEAhACFAhwCHQIeAh8CIAIhAIYAhwIiAiMCJAIlAiYAiAHsA/AAiQHuAIoCVQJWAlcCWAJZAloAiwCMAI0CYwJkAmUCZgJnAmgCaQCOAI8CagJrAmwCbQJuAm8AkACRAn4CfwKCAoMChAKFAe8B8ACSAfcCEgCpAKoC+ACrAvkC+gL7AKwArQMCAwMDBACuAwUDBgCvAwcDCACwAwkAsQMKALIDCwMMALMDDQC0ALUDDgMPAxADEQMSAxMDFAMVAL8DFwMYAMADFgDBAMIAwwDEAMUAxgDHAxkAyADJA1oDHwDNAyAAzgMhAyIDIwMkAM8A0ADRAyYDWwMnANIDKADTAykDKgDUAysA1QDWANcDLAMlANgDLQMuAy8DMAMxAzIDMwDZANoDNAM1AOUA5gDnAOgDNgDpAOoA6wM3AOwA7QDuAO8DOADwAzkDOgDxAzsA8gM8A1wDPQD9Az4A/gM/A0ADQQNCAP8BAAEBA0MDXQNEAQIBAwEEBAYDXgNfARIBEwEUARUDYANhA2MDYgEjASQECwQMBAUBJQEmAScBKAEpBAcECAEqASsEAAQBA2QDZQPyA/MBLAEtBAkECgEuAS8D9AP1ATABMQEyATMBNAE1A2YDZwP2A/cDaANpBBMEFAP4A/kBNgE3A/oD+wE4ATkBOgQEATsBPAQCBAMDagNrA2wBPQE+BBEEEgE/AUAEDQQOA/wD/QQPBBABQQN3A3YDeAN5A3oDewN8AUIBQwP+A/8DkQOSAUQBRQOTA5QEFQQWAUYDlQQXA5YDlwFiAWMEGQQYAXcD8QF5AZIDUANYA1kABAZeAAAA6gCAAAYAagAAAAIADQAhAH4AoACsAK0AvwDGAM8A5gDvAP4BDwERASUBJwEwATgBQAFTAV8BZwF+AX8BkgGhAbAB8AH7Af8CGQIbAjcCWQK8AscCyQLdAvMDAQMDAwkDDwMjA4oDjAOSA6EDsAO5A8kDzgPSA9YEJQQvBEUETwRiBG8EeQSGBM4E1wThBPUFAQUQBRMeAR4/HoUe8R7zHvkfTSALIBUgHiAiICYgMCAzIDogPCBEIHQgfyCkIKcgrCEFIRMhFiEiISYhLiFeIgIiBiIPIhIiGiIeIisiSCJgImUlyu4C9sP7BP7///3//wAAAAAAAgANACAAIgCgAKEArQCuAMAAxwDQAOcA8AD/ARABEgEmASgBMQE5AUEBVAFgAWgBfwGSAaABrwHwAfoB/AIYAhoCNwJZArwCxgLJAtgC8wMAAwMDCQMPAyMDhAOMA44DkwOjA7EDugPKA9ED1gQABCYEMARGBFAEYwRwBHoEiATPBNgE4gT2BQIFER4AHj4egB6gHvIe9B9NIAAgEyAXICAgJSAwIDIgOSA8IEQgdCB/IKMgpyCrIQUhEyEWISIhJiEuIVsiAiIGIg8iESIaIh4iKyJIImAiZCXK7gH2w/sB/v///P//AAEEGP/1AAD/4gAA/8AAAP+/AAABMQAAASwAAAEoAAABJgAAASQAAAEiAAABHAAAAR4AAP8B/vT+5wFhAAAAoQBkAGb+Yf5AAJb91P2l/cT9r/2j/aL9nf2Y/YUAAP9w/28AAAAA/QUAAP9Q/Pn89gAA/LUAAPytAAD8ogAA/JwAAP6eAAD+mwAA/EUAAOVV5RXkxeT45Fnk9uQK4VYAAOFN4UzhSuFB4xvhOeMT4TDhAeD3AADg0QAA4HXgaOBm4Fvfj+BQ4CTfgd6n33XfdN9t32rfXt9C3yvfKNvEE44KzgAAApQBmAABAAAAAAAAAOQAAADkAAAA4gAAAOAAAADqAAABFAAAAS4AAAEuAAABLgAAAToAAAFcAAABaAAAAAAAAAAAAWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABRAAAAAABTAFoAAABgAAAAAAAAAGYAAAB4AAAAggAAAIqAAACOgAAAsQAAALUAAAC6AAAAAAAAAAAAAAAAAAAAAAC3AAAAAAAAAAAAAAAAAAAAAAAAAAAAswAAALMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKmAAAAAAAAAAMEGwHqAesB8QHyAfMB9AH1AfYAfwHtAgECAgIDAgQCBQIGAIAAgQIHAggCCQIKAgsAggCDAgwCDQIOAg8CEAIRAIQAhQIcAh0CHgIfAiACIQCGAIcCIgIjAiQCJQImAIgB7APwAIkB7gCKAlUCVgJXAlgCWQJaAIsAjACNAmMCZAJlAmYCZwJoAmkAjgCPAmoCawJsAm0CbgJvAJAAkQJ+An8CggKDAoQChQHvAfAAkgH3AhIAqQCqAvgAqwL5AvoC+wCsAK0DAgMDAwQArgMFAwYArwMHAwgAsAMJALEDCgCyAwsDDACzAw0AtAC1Aw4DDwMQAxEDEgMTAxQDFQC/AxcDGADAAxYAwQDCAMMAxADFAMYAxwMZAMgAyQNaAx8AzQMgAM4DIQMiAyMDJADPANAA0QMmA1sDJwDSAygA0wMpAyoA1AMrANUA1gDXAywDJQDYAy0DLgMvAzADMQMyAzMA2QDaAzQDNQDlAOYA5wDoAzYA6QDqAOsDNwDsAO0A7gDvAzgA8AM5AzoA8QM7APIDPANcAz0A/QM+AP4DPwNAA0EDQgD/AQABAQNDA10DRAECAQMBBAQGA14DXwESARMBFAEVA2ADYQNjA2IBIwEkBAsEDAQFASUBJgEnASgBKQQHBAgBKgErBAAEAQNkA2UD8gPzASwBLQQJBAoBLgEvA/QD9QEwATEBMgEzATQBNQNmA2cD9gP3A2gDaQQTBBQD+AP5ATYBNwP6A/sBOAE5AToEBAE7ATwEAgQDA2oDawNsAT0BPgQRBBIBPwFABA0EDgP8A/0EDwQQAUEDdwN2A3gDeQN6A3sDfAFCAUMD/gP/A5EDkgFEAUUDkwOUBBUEFgFGA5UEFwOWA5cBYgFjBBkEGAF3A/EBeQGSA1ADWANZAAAAAgBSA/wCPwYYAAQACQAAAQMjETMFAyMRMwEBOHevAT44d68Fj/5tAhyJ/m0CHAAAAgA8AAAEmAWwABsAHwAAASMDIxMjNSETIzUhEzMDMxMzAzMVIwMzFSMDIwMzEyMCq+FMp0znAQU68wERTqdO4E6oTtDuOt37TKd34TrhAZr+ZgGangE5nwGg/mABoP5gn/7Hnv5mAjgBOQAAAQBk/y0EJgabACsAAAE0JicuATU0Njc1MxUeARUjNCYjIgYVFBYXHgEVFAYHFSM1LgE1MxQWMzI2AzNshdfPx7Cgr73ybmRoZGiO18rPuZ+25fOJanF4AXxXbS9JxrOq0RXa3Brty4CPa15YaTJNw7KwyxPDwhPb3pF3agAAAAAFAGT/6wWJBcUADQAbACkANwA7AAATNDYzMhYdARQGIyImNTMUFjMyNj0BNCYjIgYVATQ2MzIWHQEUBiMiJjUzFBYzMjY9ATQmIyIGFQUnARdkopKToqKRk6OpSEVDRkdEREcCE6ORkqOikZKkqUpDR0NIRERH/gV9Asd9BJiDqqqDTYOoqYJCV1dCTUJZWUL8zYKqqoJOg6mpg0FZVUVOQVlZQfhIBHJIAAAAAwA+/+sE+AXFACAAKwA4AAATNDY3LgE1NDYzMhYVFAYPAQE+ATUzFAYHFyEnDgEjIiYFMjY3AQcOARUUFgMUFhc3PgE1NCYjIgY+hYtLRsqzosRlYGQBMSksxUhLyf7nUVO4at79AeJAdzj+uB5KLnwMMDFyOiZURktOAYl6rVxhl1GvwbyKZJZGSP6WQJNWi+Jc7V87OeIgIyQBgxY5ZjFmfgOrMWQ/TCZPMjdUYQABAFIEBAELBhgABAAAAQMjETMBC0J3uQWb/mkCFAAAAAEAgP4xAqIGXwAPAAATEAA3FwYCERUQEhcHJgARgAE1vTCJvLuKML3+ywJQAZECIV2OaP5H/qIU/qL+R2+HXgIfAZIAAQAR/jECOwZfAA8AAAEQAAcnNhIRNRACJzcWABECO/7EvTGHvsKDMb0BPAJA/nP93F6HaAG/AV8UAVoBwWqIXf3Z/nUAAAAAAQAbAk8DYgWwAA4AAAElNwUDMwMlFwUTBwsBJwFF/tY1ASgNrg8BIzX+0cONsa6PA8xZqXUBV/6ic6tY/vZpAR/+6WYAAAAAAQBEAJIEKgS2AAsAAAEhFSERIxEhNSERMwKuAXz+hOz+ggF+7AMh3v5PAbHeAZUAAQAn/qsBZADrAAkAACUUBgcnPgE9ATMBY2hVfyws5Tdn3ElOSJNbvAAAAAABAEcCCQJUAs0AAwAAASE1IQJU/fMCDQIJxAAAAQCZAAABiwDpAAMAACEjNTMBi/Ly6QAAAQAC/4MC/gWwAAMAABcjATPBvwI9v30GLQAAAAIAaP/rBCMFxQANABsAAAEQAiMiAhkBEBIzMhIRJzQmIyIGFREUFjMyNjUEI/vh4f784eH983Z1dXV3dXV0AjH+3v7cASUBIQFNASEBJv7a/t8ltqmptv5ruKmouQAAAAEAygAAAt4FsAAFAAAhIxEhNSUC3vP+3wIUBKCfcQAAAQBRAAAENAXFABgAACkBNQE+ATU0JiMiBhUjNAAzMhYVFAYHASEENPw5Adp2VnBjgnrzAQXq1vCKl/63ApinAgWCn09kgo2BygEH5L+A3qb+pAAAAQBP/+sEFgXFACgAAAEzMjY1NCYjIgYVIzQkMzIWFRQGBx4BFRQEIyIkNTMUFjMyNjU0JisBAYapeWVub2V78wECztn6b2x/cv7x2s7+8POAbnOAdX+pA0ZzbWtxb16v4dTLX6sxLbB2zOHUx2N2eHJ+cgACADgAAARZBbAACgAPAAABMxUjESMRIScBMwEhEScHA6G4uPL9jwYCb/r9hwGHAxcCB8T+vQFDlQPY/FcCVgExAAAAAAEAgf/rBCYFsAAeAAAbASEVIQM+ATc2EhUUAiMiJDU3FBYzMjY1NCYjIgYHnFQDAf3JLCxvSNHk8OvE/vrremVzdXhzZl4XAosDJdL+kyApAgP+/Ora/vTRyQhsdJ2FhqM/PwACAHT/6wRGBcUAGgAnAAABMhYXBy4BIyIGHQE+ATMyEhUUAiMiABkBEAATIgYHFRQWMzI2NTQmAqhQjTouOWdIlK89nWDH3//Y4v7nATy0XX4jkndtd34FxSAcvBgb3cMHODv+89fk/ucBMgEeARYBIgFS/UpAOWi9xLOIhaIAAAEARQAABDMFsAAMAAABAAIDByM3GgE3ITUhBDP/AKsoD/MPJ+bO/P0D7gTt/tP+Mv6ompoBUAIP9MMAAAMAYf/rBCoFxQAXACMALwAAARQGBx4BFRQEIyIkNTQ2Ny4BNTQ2MzIWAzQmIyIGFRQWMzI2AzQmIyIGFRQWMzI2BAV1anqK/vnc3/75iHxqdPHNy/XNh2xug4JxbYQmcF1fbG1gXW4EMHGmLi+1es/T0897tDAtpnHGz8/8o22Eg25wfH0C/WJ5dWZldXUAAAIAUv/rBBcFxQAbACgAACUyNj0BJw4BIyICNTQAMzIAGQEQACMiJic3HgETMjY3NTQmIyIGFRQWAgOFnQMwilXV7AEKy+cBCf7c8EyeRCBAfXhdfSGAemSCdq29vSMBQUIBBPHmASL+3P7k/qv+5v7VHh64GxcB2EY7nLGvt46SpgAA//8AmQAAAYsEOgAmABAAAAAHABAAAANR//8AUf6rAY4EOgAnABD//QNRAAYADioAAAEAPwCkA4QETgAJAAABBxUXBRUBNQEVAUIREQJC/LsDRQJ9BAQE2vMBdcEBdPMAAAIAkQFkA+8D1gADAAcAAAEhNSERITUhA+/8ogNe/KIDXgMMyv2OyQABAIAApQPgBE4ACQAAEzUBFQE1JT8BJ4ADYPygAl0QAREDX+/+jMH+jO/iBAMFAAACACkAAAOgBcUAGQAdAAABPgE3PgE1NCYjIgYVIz4BMzIWFRQGBw4BFRMjNTMBVAE+cFBaZ2NVcvMC8sbW55FyOhwE+PgBnJJ2X06HVmNpWVu5xtPBgdVcM1hY/mTpAAACAEr+OwbTBZAAMwBDAAABBgIjIiYnDgEjIiY3GgEzMhYXBzMDBhYzMjY3EgAhIAADAgAhMjY3Fw4BIyAAExIAISAAAQYWMzI2NzwBNxMuASMiBgbDCeHqTGsZMIdeh44TGeSqcINSAwUzCDMseYwJEf7N/rL+yP6XDxIBRQE8WbFBJkTMZf51/mIREwHLAYMBhgGR+/4KOkc9YSgCLRgzHHl5Afvc/sxST1JN68gBBgEwMzcE/b1nStqtAXcBkv5N/o3+jP5jKCGCKy4B6gG5AbECAf4c/fSIhzBACA8NAgMJC8kAAAAAAgAaAAAFKAWwAAcACwAAASEDIwEzASMBIQMjA7r9z3j3AhfnAhD3/ZsBrNQDAVz+pAWw+lACHwJrAAAAAwCfAAAEvAWwAA8AGAAhAAAzESEyBBUUBgcVHgEVFAQjAREhMjY1NCYjJSEyNjU0JisBnwHo9QEJb2OBiP798f7KATZ+hHB6/rIBD3N+hIf1BbDDymSZJgMcvoHR0QKW/ix0bHZ+tWhlbmcAAQB0/+sE2AXFABsAAAEGACMgABkBEAAhIAAXIy4BIyIGFREUFjMyNjcE1xb+5f3+/f7OATUBAAECARUY8xOPmpirqZqXkRMB2Ob++QFRAREBFQEPAVT+/fCYmOi2/um555SXAAIAnwAABO4FsAAJABMAADMRISAAERUQACEDETMyNj0BNCYjnwHKASoBW/6i/szKw9nNys8FsP6m/uLB/uD+qQTt+9Xqy8PN5gAAAAABAJ8AAAR1BbAACwAAASERIRUhESEVIREhBA/9gwLj/CoDz/0kAn0Cj/4zwgWww/5lAAAAAQCfAAAEcgWwAAkAAAEhESMRIRUhESEEDP2G8wPT/SACegJt/ZMFsMP+QwABAHT/6wTiBcUAHwAAJQYEIyAAGQEQACEgBBcjLgEjIgYVERQWMzI2NxEhNSEE4jz+/NP+8/6yATwBAgEGAQsf7xiPlpq2xaR0iiL+3gIVvlKBAUgBDQEwAQ0BSPTagIvesv7OtN80JQEktgABAJ8AAAUQBbAACwAAISMRIREjETMRIREzBRDy/XTz8wKM8gJt/ZMFsP2AAoAAAAABAK0AAAGgBbAAAwAAISMRMwGg8/MFsAABADr/6wPmBbAADwAAATMRFAQjIiY1MxQWMzI2NQLz8/8A0N/983V0ZncFsPv10OrX239xgnYAAAEAnwAABS8FsAAMAAABIxEjETMRMwEhCQEhAjqo8/OLAckBIP30AjX+1wJ2/YoFsP2XAmn9Sf0HAAAAAAEAnwAABC8FsAAFAAAlIRUhETMBkgKd/HDzwsIFsAAAAQCfAAAGYgWwABAAAAkCIREjERMjASMBIxMRIxEB2gGmAacBO/MZA/5Mo/5OAxnzBbD7mARo+lAB8AKA+5AEbf2D/hAFsAAAAQCfAAAFEAWwAAsAACEjAQcRIxEzATcRMwUQ8v13A/PzAokD8gQrAfvWBbD71gEEKQAAAAIAdP/rBRsFxQANABsAAAEQACEgABkBEAAhIAARJzQmIyIGFREUFjMyNjUFG/61/vH+9v69AUIBCgEPAUzzwKijt7ijqb4CVf7z/qMBXgEMAQYBCwFf/qH+9QK16+q2/vi46+u4AAAAAgCfAAAE2gWwAAoAEwAAAREjESEyBBUUBCMlITI2NTQmIyEBkvMCOfYBDP709v66AUaKhYWK/roCKP3YBbD1z9Hzw45xcZIAAgB0/wkFJwXFABMAIQAAARQGBxcHJQ4BIyAAGQEQACEgABEnNCYjIgYVERQWMzI2NQUbdGvroP7tLFgv/vb+vQFCAQoBDwFM88Coo7e4o6m+AlWZ+1fSj/oLDQFeAQwBBgELAV/+of71ArXr6rb++Ljr67gAAAAAAgCfAAAE8AWwABoAIwAAAREjESEyFhUUBgceAR0BFBYXFSMuAT0BNCYjJSEyNjU0JiMhAZLzAiX3/Ht5fmkfJ/kpFntx/sYBGpWDfon+1QJc/aQFsNXQdp4yKayGeUF0Ihoii0Z1c4HDbnVxegAAAAEAU//rBKAFxQAlAAABNCYnJiQ1NCQzMgAVIzQmIyIGFRQWFx4BFRQEIyIkNTMUFjMyNgOtg676/v4BH+r0ASLzlo+HjZe47+/+4fHp/qzztJaJlAF2XHMuQs6us+H/AL1yiXNdVWsyQdiwudTu24eBawAAAQA1AAAEtQWwAAcAAAEhESMRITUhBLX+OfP+OgSABO37EwTtwwAAAAEAhv/rBPEFsAARAAABERQEISIkNREzERQWMzI2NREE8f7J/vz//s/zqZSZrwWw/DD3/v/2A9D8MJyXl5wD0AABABoAAAUQBbAACQAAARczNwEhASMBIQJ4HAMbAVsBA/355/34AQQBfW1rBDX6UAWwAAAAAQBEAAAGuwWwABMAAAE1MzUBMwEVPwETMwEjASMBIwEzAgMDARnAARwDAc7u/r7c/uQD/uTc/r7uAYQCAQQp+9QDAQUEKfpQBBz75AWwAAABAC8AAATqBbAACwAACQEhCQEhCQEhCQEhAoYBNAEf/kEB0P7d/sP+xP7hAcn+QQEdA5YCGv0u/SICI/3dAt4C0gAAAAEAEwAABO8FsAAIAAAJASEBESMRASECgAFgAQ/+B/L+DwEPAuwCxPxN/gMCDAOkAAEAWAAABHEFsAAJAAAlIRUhNQEhNSEVAXkC+PvnAtv9KwP6wsKYBFXDkgAAAQCE/rwCHAaOAAcAAAEjETMVIREhAhylpf5oAZgF0PmpvQfSAAAAAAEAFf+DA2EFsAADAAATMwEjFewCYOwFsPnTAAABAAz+vAGmBo4ABwAAEyERITUzESMMAZr+ZqenBo74Lr0GVwABADUC2QM1BbAACQAAASMBMwEjAycjBwEDzgErqwEqzaUNBA0C2QLX/SkBnTw8AAABAAP/QQOYAAAAAwAABSE1IQOY/GsDlb+/AAAAAQBKBLwCFwXGAAMAAAEjASECF8T+9wEUBLwBCgAAAAACAF7/7AQBBE4AHwAqAAAhLgEnDgEjIiY1NDY7ATU0JiMiBhUjNDYzMhYVERQWFyUyNjc1IyIGFRQWAwsLDwQ3nGKns/TlsWRgWGTz9cnB5xEV/exUhSK1bXVOIkQkRlirmqCsX1ZfT0CIxL23/h9FeDyvSDa4Z0k/RwAAAgCA/+wENgYYABIAIAAAARQCIyImJwcjETMRFz4BMzISESM0JiMiBgcRHgEzMjY1BDbZzWaRMxTS8wMxiV7P2fNxgVJsICFtUoFvAfny/uVPT4oGGP2sAURH/sn+963MR0H+N0BErZoAAAAAAQBR/+wD9wROABsAACUyNjUzFAQjIgI9ATQSMzIWFSM0JiMiBh0BFBYCO1t85f7/uPT5+fPH8+V1Yotsaq5nUaDaAS7xI/ABMOG3W3rDmiOdwAAAAgBT/+wEAwYYABIAIAAAExASMzIWFzcRMxEjJw4BIyICNTMUFjMyNjcRLgEjIgYVU9rNWocyA/PSFDWPYcva83F/TmkjI2lMf3MCDgEIAThEQQECTvnohExMARzxma5APgHYPULOqwACAFn/7AP4BE8AFQAdAAAFIgA9ATQAFzISHQEhHgEzMjY3Fw4BAyIGByE1NCYCUOr+8wEL0ODk/VYKiX5kiUJHPcKiW3QSAbRnFAEo8CjxATIB/vvjj4eiLy2mNUMDn411GWmAAAAAAAEAMQAAAuAGLQAXAAAzESM1MzU0NjMyFhcHLgEjIgYdATMVIxHWpaW/syRHLRgWLx1RTNzcA4a0fra/Cwq8BAZYVn60/HoAAAIAVP5MBAgETgAeACwAABMQEjMyFhc3MxEUBCMiJic3HgEzMjY9AScOASMiAjUzFBYzMjY3ES4BIyIGFVTezWKPNBTQ/wDsVbdPNEOPTIR+AzKIW8ve83SAUGkhImlNgHYCDgEHATlQTYn73djzLSqwISaNf1MBQEABHfCYrz8+Ado9Qc+qAAABAH0AAAQMBhgAFAAAARc+ATMyFhURIxE0JiMiBgcRIxEzAXADNZdgsL3zZGhJbibz8wOzAUtR1Of9bQKVgnA6NfzoBhgAAAACAJAAAAGDBhgAAwAHAAAhIxEzESM1MwGD8/Pz8wQ6AQnVAAAC/7D+SwGOBhgADwATAAABERQGIyImJzceATMyNjUREyM1MwGOt6klOCEOEjEVP0bt8/MEOvuHt78ICcIFB1NcBHkBDNIAAAABAIEAAAQ1BhgADAAAASMRIxEzETMBIQkBIQHib/LyaQEPARz+nwGP/uYB2f4nBhj8hAGe/hH9tQAAAAABAJAAAAGDBhgAAwAAISMRMwGD8/MGGAABAIAAAAZ1BE4AJgAAARczPgEzMhYXPgEzMhYVESMRNCYjIgYHFBYVESMRNCYjIgYHESMRAV4NAjSda2yVJzOhcKe5815gUGkZAvNgX0tmHvMEOolMUV5iW2Xb5/10Ao2NbVJJDxYK/UMCjYdzODX85gQ6AAEAfgAABAsETgAUAAABHwE+ATMyFhURIxE0JiMiBgcRIxEBXA4CNZ5mrbnzY2lJbSXzBDqXAVJayd39WAKmfWQ+OPzvBDoAAAIAU//sBDQETgANABsAABM0ADMyAB0BFAAjIgA1MxQWMzI2PQE0JiMiBhVTAQTr7QEF/vzs7f7883qEgnx8hIJ6Aif2ATH+0PcV+P7SAS74osLDoRWexsaeAAAAAgCA/mAENAROABIAIAAAARQCIyImJwcRIxEzFz4BMzISESM0JiMiBgcRHgEzMjY1BDTayl6KMgPz2RA0j2HM2/J6f01pICBoUH94Afnx/uQ/PwH99wXagkpM/sj++KnQQDv+Fzo7s5gAAAAAAgBT/mAD/AROABIAIAAAExASMzIWFzczESMRJw4BIyICNTMUFjMyNjcRLgEjIgYVU9rNXos0E9LzAzGEWcva83F/S2YiI2VJf3MCDgEIAThJSH36JgIDATw8ARzxmbI6OAH4NzzRrAABAIAAAALDBE4AEAAAASciBgcRIxEzFzM+ATMyFhcCpnNIXhrz3g8DKX5VGDAPA1wEOjf9EQQ6mFFbBwUAAAAAAQBR/+wDzwROACUAAAE0JicuATU0NjMyFhUjNCYjIgYVFBYXHgEVFAYjIiY1Mx4BMzI2AuBdhsbD47/K5/JkW1paVIjQwe3J1/HrBH5eYGQBJjlIHSqUhIu9wZhEX046OkEbK5WHlbLWk2BTRgAAAAEAGf/sAnAFQQAXAAABETMVIxEUFjMyNjcXDgEjIiY1ESM1MxEBocPDMSsZLBQaIV4xg4+VlQVB/vm0/apFNgcGshAUmasCVrQBBwABAHv/7AQKBDoAFAAAJScOASMiJjURMxEUFjMyNjcRMxEjAyICNJhnssDyWl9ZdSPz2JABUVTY7wKH/XeRbj48Aw77xgAAAAABACAAAAP1BDoACQAAARczNxMzASMBMwH4FAMU1/v+gNP+fvsBbl9fAsz7xgQ6AAABACUAAAXQBDoAFQAAARczNxMzExczNxMzASMDJyMHAyMBMwGzCgMN1bHWDgMPnun+2MfPFwMWzsf+2OkBdkhGAsb9OlNaAr/7xgKbaGf9ZAQ6AAABACEAAAPtBDoACwAAARMhCQEhCwEhCQEhAgTIARf+rAFe/uzR0f7qAV7+rAEUAscBc/3p/d0BfP6EAiMCFwAAAQAQ/ksD/AQ6ABUAAAEXMxMhAQ4BIyImJzceATMyNj8BASEB5xkD7wEK/kAqmpIeRSAbDi4NRUAlKP53AQkBsnEC+fsicaAMCLwBBEBVYgQtAAAAAQBVAAADxAQ6AAkAACUhFSE1ASE1IRUBggJC/JECIv3pA0rCwp8C18SaAAABADj+mAKRBj0AHgAAAS4BPQE0JiM1MjY9ATQ2NxcOAR0BFAYHHgEdARQWFwJhx6FdZGRdoccwZE9UWVlUT2T+mDjsrstqcrJybMuu6ziMIqR/y2qeLjCeaMt/pCIAAAABAK7+8gFVBbAAAwAAASMRMwFVp6f+8ga+AAAAAQAb/pgCdQY9AB4AABc+AT0BNDY3LgE9ATQmJzceAR0BFBYzFSIGHQEUBgcbY1FXX19XUWMwxqJcZmZcosbbIqR/y2udLSyebct/pCKMOOqvy2xysnJqy6/rOAABAHUBgwTcAy8AGQAAARQGIyImJy4BIyIGFSc0NjMyFhceATMyNjUE3K2IWY1VOVUvPVOqqolXlFI3VDA8VQLumtE/SS4sZUoWmcpCRTAqa0wAAAACAI/+igGCBDoAAwAHAAABIxEzESM1MwGC8/Pz8/6KA8QBAesAAAAAAQBo/wsEDgUmACEAACUyNjUzFAYHFSM1JgI9ATQSNzUzFR4BFSM0JiMiBh0BFBYCUlt85caZyL/AwL/Ior3ldWKLbGquZ1GLzBvp6yMBH9Mj0QEhJOLfG9efW3rDmiOdwAAAAAEAUQAABGsFxQAhAAABFxQGByEHITUzPgE1JyM1Myc0NjMyFhUjNCYjIgYVFyEVAecFLCsC1gH8JgowLgWimwnkx9Pi82tXV2EJAYUCV3FTljvCwg2vYHnE7tPp17prY4F47sQAAAAAAgBd/+UFTwTxACMALwAAJQ4BIyImJwcnNy4BNTQ2Nyc3Fz4BMzIWFzcXBx4BFRQGBxcHARQWMzI2NTQmIyIGBD1OtmZntE2BjYcyMjc2kI2OTKxjYq5NkY6UNDcyMIuO/Hjsrq3s7K2v62s/QEA+hJCJTq9kZ7ZQk5CRODs8OZSRl0+0ZmOtTY2RAnu9/v69u/39AAEAGgAABL4FsAAWAAAJASEBIRUhFSEVIREjESE1ITUhNSEBIQJsAUMBD/5zART+nQFj/p3z/psBZf6bAR/+cQEQAzACgP02k4+S/s4BMpKPkwLKAAIAiP7yAW0FsAADAAcAABMRMxkBIxEziOXl5f7yAxv85QPIAvYAAAACAFr+JASMBcUAMQBDAAABFAYHHgEVFAQjIiQ1NxQWMzI2NTQmJy4BNTQ2Ny4BNTQkMzIEFSM0JiMiBhUUFhceASUuAScOARUUFhceARc+ATU0JgSMV1REQ/707Of+0fKofH2Jgr/34FZTREEBDuvzAQnzin+FgXbI+eD9zSpOJTg0eMY2RCE4O4UBx1+HKzOHY7PCx+MBfGxhT09XOUG1slyJLTOIY63K3dFnhGNPWFM1RLQpCxgOFVQ7Wlk4EBULFlQ6UV8AAAIApATkA3kFsAADAAcAAAEjNTMFIzUzA3ny8v4c8fEE5MzMzAAAAAADAFf/6wXiBcQAGwAnADMAAAEUBiMiJj0BNDYzMhYVIzQmIyIGHQEUFjMyNjUlEAAzMgAREAAjIgADEAAhIAAREAAhIAAEXq6hpLm6o6CwnFhcYGNjYFxX/Q8BUvr5AVL+rvn7/q96AZgBLgEsAZn+Z/7U/tL+aAJUnpzRsnew056cX1SIc3h2hlFihf7z/pwBZAENAQwBYv6e/vQBQQGq/lb+v/6+/lQBqwAAAgB0ArQDEQXFAB8AKgAAAS4BJw4BIyImNTQ2OwE1NCYjIgYVJzQ2MzIWFREUFhclMjY3NSMiBhUUFgJgCAoDIm1PeYCmpYk5O0NHraiPiZoLD/6HNGkTiExROQLCFS8aMDx4bHF2Mz9AMzAOaIGMiP7GNFYrgjkkaT8vLCwAAP//AFQAdAOFA5MAJgFy6N0ABwFyAVL/3QABAH8BdgPCAyUABQAAASMRITUhA8LI/YUDQwF2AQSrAAQAV//rBeIFxAALABcAMgA7AAATEAAhIAAREAAhIAATEAAzMgAREAAjIgABESMRITIWFRQGBx4BHQEUFhcVIy4BPQE0JiMnMzI2NTQmKwFXAZgBLgEsAZn+Z/7U/tL+aHoBUvr5AVL+rvn7/q8BvJcBGZqrPDw/NgcKmwkEQU6ej0VdTGOCAtkBQQGq/lb+v/6+/lQBqwFD/vP+nAFkAQ0BDAFi/p7+qP6vA1KDgTxZHx1qTDgqQBUQFk8rNklChjw4SjgAAAAAAQCHBRIDXgWwAAMAAAEhNSEDXv0pAtcFEp4AAAIAfwOwAosFxQALABcAABM0NjMyFhUUBiMiJjcUFjMyNjU0JiMiBn+Zb22Xl21vmYtINTRGRjQ1SAS4cJ2dcHGXmHA2RkU3N0lJAAACAF8AAAPzBQoACwAPAAABIRUhESMRITUhETMBITUhApwBV/6p1/6aAWbXASj8vQNDA4rH/nUBi8cBgPr2xAAAAQBtApsC1wXHABgAAAEhNQE+ATU0JiMiBhUjNDYzMhYVFAYPASEC1/2hATFCJjI3Pj++qpSOmF96iAFnApuRAQA3RCotNzsxbZGAd1Nya3QAAAAAAQBhAo8C7AXGACgAAAEyNjU0JiMiBhUjNDYzMhYVFAYHHgEVFAYjIiY1MxQWMzI2NTQmKwE1AaJCPEA/Nj6/q4WYqUY+R0qxmIq4v0Q+QkpFR3sEczQxKDQsImh4dXA4WRoYXkVyenh3LDIzLjk2gwAAAAABAHgEvAJMBcYAAwAAASEBIwE3ARX+6b0Fxv72AAAAAAEAkv5gBB8EOgAVAAABERQWMzI2NxEzESMnDgEjIiYnESMRAYRiY1lsHvPfBy50TT9gJ/IEOv2UqnU8PQMS+8ZWNjUaHf4+BdoAAAABAD4AAANwBbAACgAAIREjIiY1NBIzIRECfVPu/v/tAUYCCP/V0wEB+lAAAAEAoAJSAZIDQgADAAABIzUzAZLy8gJS8AAAAAABAG3+QQHJAAMADwAAJQceARUUBiMnMjY1NCYnNwE+C0FVpqEHP0pDVCADNgtRUWh3iSwtLSMFiwAAAAABAGQCmQGjBcUABQAAASMRIzUlAaPAfwE/ApkCf5YXAAIAdwKzAywFxQANABsAABM0NjMyFh0BFAYjIiY1MxQWMzI2PQE0JiMiBhV3uaGiubmgorqvVldUVldVVVYEdpe4uJd1mLa2mFdlZVd1VGdnVAAA//8AXACXA5kDtgAmAXMIAAAHAXMBfgAA//8AmwAABccFxAAnAckARAKYACcBdAD8AAgABwGXAqIAAAAA//8AkwAABdkFxAAnAXQBAQAIACcByQA8ApgABwHKAwQAAAAA//8AZgAABoMFxwAnAXQBwgAIACcBlwNeAAAABwHLAAYCmwAAAAIAYP52A9gEOgAZAB0AAAEOAQcOARUUFjMyNjczDgEjIiY1NDY3PgE1AzMVIwKsAj1wUlhmZVNyAvMD88TY5pBzOR4E+PgCnZN1XlGFVWNpWlu6xdLAgdZbMlhZAZ3pAAL/9gAAB1cFsAAPABMAACkBAyEDIQEhFSETIRUhEyEBIQMnB1f8fg/+Crj+3gNDA+D9ehECJP3kFAKX+u0BeRsDAVT+rAWwxf5oxf42AWcCggEAAAEATQDWA+wEhgALAAATCQE3CQEXCQEHCQFNATz+xJQBOwE8lP7EATyU/sT+xQFsAUIBQpb+vgFClv6+/r6WAUH+vwAAAwBp/6EFEAXuABkAJAAvAAABEAAhIiYnByM3LgE1ERAAITIWFzczBx4BFQEUFhcBLgEjIgYVITQmJwEeATMyNjUFEP61/vFVkkFYlIVdYQFCAQphpklRlIJSVvxLISIB+i9wRKO3AsIZGf4NKF44qb4CVf7z/qMmJpbiV+2OAQYBCwFfMS+J3Ffegv76TYM2A1woKuq2PnAy/K8dHeu4AAIAlAAABH4FsAAMABUAAAERMzIEFRQEKwERIxETETMyNjU0JiMBh/b3AQr+9vf28/P2ioSEigWw/ujvx8ju/tQFsP4l/hqJaGqLAAABAIj/7ASbBh8AJwAAISMRNDYzMhYVFAYVFAAVFAYjIiYnNx4BMzI2NTQANTQ2NTQmIyIGFQF68vLOrdh2AUTWyVGoKDEsdkBfXP67fl5AXW0EReX1tLB0yz9F/uiNt7AjG8QaJlFITQERlFbPTVFgkocAAAMANP/rBoQETgAsADcAPwAABSImJw4BIyImNTQ2OwE1NCYjIgYVJzQ2MzIWFz4BMzISHQEhHgEzMjY3Fw4BJTI2NzUjIgYVFBYBIgYHITU0JgTmh8hEPdGYuMHt685bWF5q8u/Nbqc5QKVm2uj9UAiKjmR6U0k6xvxuRZApzG94WQNCanMOAb1kFVdVS2GwnaGpR11lWUITk7hBQUBC/v7ojYufLS+lLku5SDK9YEdCTgLnjnsebH8AAAAAAgA8/+sETgXtACEAMQAAARYSHQEQACMiADU0ADMyFhc3LgEnByc3LgEnNx4BFzM3FwM0JjUuASMiBhUUFjMyNjUDcWty/tjl6P7jAQ3iUIs4AxdQOfxO2CNIJ0tRj0IB2k7YASSOaICRlIJ/lwUDef7ExVf++v6/ARXU5wESNS4CWY86jm16FCENxBVFMXtt/RsDDwQxP7KLe6zYrQAAAAMAQwCqBDcEtgADAAcACwAAASE1ISUjNTMRIzUzBDf8DAP0/oHz8/PzAkbUv9379N0AAAADAFP/dgQ0BLwAGQAkAC8AABM0ADMyFhc3MwceAR0BFAAjIiYnByM3LgE1MxQWFwEuASMiBhUhNCYnAR4BMzI2NVMBBOs2YS5IkGhdYP787DFZKkiQZmVm8x0gASoYNR6CegH8Ghr+2xMtG4J8Aif2ATETEZLTS+WSFfj+0g8Ok89J65lPgDACYAsNxp5Gdy/9qwkHw6EAAAIAh/5gBDsGGAATACEAAAEUAiMiJicHESMRMxEXPgEzMhIRIzQmIyIGBxEeATMyNjUEO9rKXooyA/PzAzGKXMzb8np/TWkgIGhQf3gB+fH+5D8/Af33B7j9sgFBRP7I/vip0EA7/hc6O7OYAAIAGAAABZYFsAATABcAAAEzFSMRIxEhESMRIzUzETMRIREzASE1IQUPh4fy/XTzhobzAozy/IICjP10BKSi+/4Cbf2TBAKiAQz+9AEM/YDSAAAAAAEAjwAAAYIEOgADAAAhIxEzAYLz8wQ6AAEAjgAABGsEOgAMAAABIxEjETMRMwEhCQEhAe9v8vJVAVABLP5cAb7+ywGs/lQEOv5QAbD9+v3MAAAAAAEAGwAABCAFsAANAAABJRUFESEVIREHNTcRMwGDAQL+/gKd/HB1dfMDYU64Tv4ZwgJfI7gjApkAAQAbAAACKAYYAAsAAAE3FQcRIxEHNTcRMwGXkZHziYnzA3s0uDT9PQJtMbgxAvMAAQCT/ksFBAWwABgAAAERFAYjIiYnNx4BMzI2PQEBBxEjETMBNxEFBLipJTkhDhE8FjxA/XgD8/MCiAMFsPoRtsAICb8FCF1WPwQdAfvkBbD74wEEHAAAAAEAfv5LBAYETgAgAAABHwE+ATMyFhURFAYjIiYnNx4BMzI2NRE0JiMiBgcRIxEBXA0DNZtkrbm4qSQ6IQ4SOxY8QGBmTGwk8wQ6kQFPV8vi/SC2wAgJxgUHVlUC3oBoNTL84AQ6AAAAAgBl/+sHVgXFABcAJQAAKQEOASMgABkBEAAhMhYXIRUhESEVIREhBTI2NxEuASMiBhURFBYHVvx1XX9E/vf+wwE7AQlGjFADhP0kAn39gwLj+1U3aTU7ZzWjr7EKCwFGAQ8BMAEOAUcMCcP+ZcP+MxQICAQ0BwnJx/7OyMoAAAADAFv/6wbyBE4AIQAvADcAABM0ADMyFhc+ATMyEh0BIR4BMzI2NxcOASMiJicOASMiADUzFBYzMjY9ATQmIyIGFQEiBgchNTQmWwED7H6/QkK1buDk/VYKiX5kikFPQMSIfsFEQr587f788nuEgnt8g4J7A+FbdBIBtWgCJ/cBMFtWVlv+++OPh6MvLp84SFlVVVkBL/iiw8ShFZ7Gxp4BZI50GWiBAAABAIsAAAKVBi0ADwAAMxE0NjMyFhcHLgEjIgYVEYu/syRHLRkXKRxRUgS4tr8LCrkFBlxW+0gAAAH/3f5LAtMGLQAjAAABIxEUBiMiJic3HgEzMjY1ESM1MzU0NjMyFhcHLgEjIgYdATMChMm3qSU5IA8ROhY7QKWlwLMkRi4ZFDEcUU3JA4b8O7e/CAm/BQhdVgPFtH62vwsKvAQGWFZ+AAAAAAIAZv/rBa8GLgAXACUAAAEQACEgABkBEAAhMhYXPgE1MxQGBx4BFSc0JiMiBhURFBYzMjY1BQ3+tf7x/vb+vQFCAQqB1FNTRrx2eiYo88Coo7e4o6m+AlX+8/6jAV4BDAEGAQsBX1dRDYZ+p8slSJ1XArXr6rb++Ljr67gAAAAAAgBS/+wEvASpABcAJQAAEzQAMzIWFz4BNTMUBgceAR0BFAAjIgA1MxQWMzI2PQE0JiMiBhVSAQTrc7NCQCuoXmkeIP787O3+/PN6hIJ8fISCegIn9gExTUgTcmuQriJCj1EV+P7SAS74osLDoRWexsaeAAABAIb/6wZLBhAAGQAAARU+ATUzFAYHERQEISIkNREzERQWMzI2NREE8V1BvKC6/sn+/P/+z/OplJmvBbDNFo6J0eAV/Zb3/v/2A9D8MJyXl5wD0AABAHv/7AUpBJQAHAAAARQGBxEjLwEOASMiJjURMxEUFjMyNjcRMxU+ATUFKX6h2BACNJhnssDyWl9ZdSPzVDAElKunDvzMkAFRVNjvAof9d5FuPjwDDosNZXMAAAH/tf5LAZMEOgAPAAABERQGIyImJzceATMyNjURAZO3qSQ5IQ8SORY7QQQ6+4e3vwgJvwUIXVYEeQAAAAIAWf/sA/gEUAAVAB0AAAEyAB0BFAAnIgI9ASEuASMiBgcnPgETMjY3IRUUFgIA6gEO/vTP4eMCqgyJfGWJQU8/xaVZdBT+S2cEUP7W8Cjy/tABAQPkj4akMC2fN0r8X4x2GWmAAAAAAQCbBOQDPAXuAAgAAAEVIycHIzUlMwM8vJaVugEIjwT8GJKSGvAAAAEAeQTkAy0F8QAIAAABNzMVBSMlNTMB0ovQ/vSd/vXOBWKPEfz6EwABAHUElQL7BbAADQAAARQGIyImNTMUFjMyNjUC+62Wl6y2Q0pJQwWwgpmZgj9MTD8AAAAAAQCaBNcBnQW2AAMAAAEhNSEBnf79AQME198AAAIAggRUAiYF3AALABcAABM0NjMyFhUUBiMiJjcUFjMyNjU0JiMiBoJ6Wlh4d1lbeW46LCs3NyssOgUWVnBwVldra1csOTgtLjo7AAABACn+UgGhADwAEwAAIQ4BFRQWMzI2NxcOASMiJjU0NjcBjFBRICcaKhYVIU03XnV6hjNcOCEjDQqOExlpYFWROwAAAAEAgATWA1EF9wATAAABFAYjIiYjIgYVJzQ2MzIWMzI2NQNRdlxJojQoNYN1XDqwNSc3BdBhhFlALiNgiVk/LwACAHoE5AObBe4AAwAHAAABIQEjAzMDIwKbAQD+1cpu8vW7Be7+9gEK/vYAAAIAq/5+Afr/uAALABcAABc0NjMyFhUUBiMiJjcUFjMyNjU0JiMiBqthSUZfXkdKYGUnHhsmJhseJ+dGWVlGRVZWRR0mJxwfJycAAAAB/NsEs/4qBf0AAwAAASMDM/4qmbbQBLMBSgAAAf02BLb+hgYBAAMAAAEzAyP9uM6+kgYB/rUA///8eQTW/0oF9wAHAKD7+QAAAAAAAf0+BOb+mQZ/AA8AAAEnPgE1NCYjNzIWFRQGBxX9UQdNPU5IB6mrVUEE5pIEHSMnIXtlW0VHCEUAAAAAAvwMBOT/NAXuAAMABwAAASMBIQEjAzP+B9D+1QEGAiLD9foE5AEK/vYBCgAB/SL+pf4w/4QAAwAAASE1If4w/vIBDv6l3wAAAQDXBPYCDQZwAAMAAAEzAyMBG/LAdgZw/oYAAAMAnQTkA44GpAADAAcACwAAASM1MwUjNTM3MwMjA47a2v3p2tp4+JWSBOTMzMz0/tcAAP//AKACUgGSA0ICBgB2AAAAAQCfAAAENwWwAAUAAAEhESMRIQQ3/VvzA5gE7fsTBbAAAAAAAgAaAAAFmAWwAAMABgAAATMBISUhAQJz5wI++oIBSALy/pAFsPpQwgPOAAADAGb/6wUNBcUAAwARAB8AAAEhNSEFEAAhIAAZARAAISAAESc0JiMiBhURFBYzMjY1A6P+QAHAAWr+tf7x/vb+vQFCAQoBDwFM88Coo7e4o6m+AnnD5/7z/qMBXgEMAQYBCwFf/qH+9QK16+q2/vi46+u4AAEAIwAABREFsAAHAAABIwEjATMBIwKbA/6G+wID5wIE/AR0+4wFsPpQAAAAAwBwAAAELQWwAAMABwALAAA3IRUhEyEVIQMhFSFwA738Q2AC9/0JVgOa/GbCwgNMvwMjwwAAAAABAJ8AAAURBbAABwAAISMRIREjESEFEfL9c/MEcgTt+xMFsAABAEcAAARMBbAADAAACQEhFSE1CQE1IRUhAQMW/m0Cyfv7Ac7+MgPf/V4BkgLP/fTDmAJBAj+Yw/32AAADAEsAAAWjBbAAEQAYAB8AAAEWABUUAAcVIzUmADU0ADc1MwEUFhcRDgEFNCYnET4BA3H5ATn+x/ny/P7IATj88v3JqJ2dqAN5p5uaqAT+BP7S+vr+1AKqqgEBK/r7ATADsv0gprQBAr4CuKeotgP9QgG2AAEASAAABVEFsAAXAAABPgE1ETMREAAHESMRJgAZATMRFBYXETMDQoqS8/7m9fLz/uvykYXyAjgXwakB9/4J/v7+1Rn+jQFyGAErAQQB9/4JpsEZA3cAAAABAGwAAATaBcUAJAAAJTYSPQE0JiMiBh0BFBIXFSE1MzcmAj0BEAAhIAARFRQCBzMVIQLfeYGilZWghHz+DOcBcoMBNQEBAQEBN4Vy8f4LyB0BDPhp1tjY1mn5/vQcyMQDXgEho2cBHAFZ/qf+5Gek/uBhxAAAAAACAFb/6wR5BE4AHAArAAABERQWMzI2NxcOASMiJicOASMiAj0BEBIzMhYXNwEUFjMyNjc1ES4BIyIGFQP9JSQHDgYYHzomUmsaM5Bky9vbzV6KNBP+HHF/TGQiImRKf3MEOf0KTzsCArQRDU1UUVABHfEVAQgBOE1Lg/3AmbNGQw0BukVJ0awAAgCW/ncEagXEABQAKgAAATIWFRQGBx4BFRQGIyImJxEjETQkEzI2NTQmIyIGFREeATMyNjU0JisBNQJp0fBhWnqB8tFQkj3yAQ3CbmRrY2N+KnxPdoR3bHkFxNK4YJoxLbqD1eQoK/44Bai37v2ZbWdXeX5k/OEoKodvbpK5AAABACD+XwP1BDoACwAAATMBESMRATMTFzM3Avr7/o/z/o/73RQDFAQ6+/D+NQHQBAv9NF9fAAAAAAIAVP/sBDgGIAAhAC8AABM0NjMyFhcHLgEjIgYVFBYXFhIdARQAIyIAPQE0Nj8BLgETFBYzMjY9ATQmJyIGFdDRwEyYUiw6h0ZQWFBv5Nn++uru/vqyiQReZXZ/g39/jHKBgQTqk6MsKKMWIj00KlAmUf7s0xTw/tgBJO4UqvMjCymI/X2cwsKcFHjKGMOXAAEAYP/sBAwETQAoAAATNDY3LgE1NDYzMhYVIzQmIyIGFRQWOwEVIyIGFRQWMzI2NTMUBCMiJGBmZVlf9NbA/vJ4W2hoYmfHx25ud2xofPL+8cDW/vkBMlx9IiR3SpmisJY9TlI6QEetSE5AVlpBqqusAAAAAQBh/n4DygWwACAAAAEVAQ4BFRQWHwEeARUOAQcnPgE1NCYvAS4BNTQSNxMhNQPK/qN6ZURRbJt5AX5NfTAtPUlSs5CGkOv9xAWwkf5bjsqLXlkTIC5RcU61PGU2UyQjMBIVL6iejQEoqwEOwwAAAAEAfv5hBAYETgAUAAABHwE+ATMyFhURIxE0JiMiBgcRIxEBXA0DNZtkr7fzYWVMbCTzBDqRAU9Xxej7wAQ+gWs3M/zfBDoAAAMAc//rBC4FxQANABYAHwAAARACIyICGQEQEjMyEhEDIRUUFjMyNjUBITU0JiMiBhUELvvh4f784eH98/4rd3V1dP4rAdV2dXV1AjH+3v7cASUBIQFNASEBJv7a/t/+/Gy4qai5ASprtqmptgAAAAABAKn/6wJ+BDkADwAAAREUFjMyNjcXDgEjIiY1EQGcMC4bKRomL1Y3i44EOfzvRDILC7EZE5qqAwoAAAABABb/7gRKBfQAIQAAKQEBJy4BIyIGByc+ATMyFhcBHgEzOgE3Fw4BIyImJwMjBwEf/vcBgVYWOCsRGAsDGFUhZ2sfAbAULCMMEAcEFDAab3YtzwMXBA7IMSoBAbUGCk5V+8QxLQHABAZYfAIkZwAAAQBk/nYD1AXEADEAAAEuASMiBhUUFjsBFSMiBhUUFh8BHgEVDgEHJz4BNTQmLwEuATU0Njc1LgE1NCQzMhYXA4NKYDeDf4OQko+wr4tyapSCAn9MfTQpO0su7uGck293AQHkUoc9BNsTEVpIWGDGjJFvgBgYIlpzTrY6ZDpJLSkqEQszvtaRwS8DJ41hrb4XFAAAAAEAT//rBOoEOgAXAAABIxEUFjMyNjcXDgEjIiY1ESERIxEjNSEEj4cwLhspGiYvVjeLjv628ooEQAN9/atEMgsLsRkTmqoCTvyDA329AAAAAgCA/mAEMQROAA8AHQAAARQCIyImJxEjETQAMzISESM0JiMiBhURHgEzMjY1BDHYyV2LNfMBAtTp8vNxfXBtIGhQfnUB+fL+5Ts8/f0D3/YBGf7K/vat0MuN/vA6O7KZAAAAAAEAUv6KA+kETgAhAAABMhYVIzQmIyIGHQEUFhceARcOAQcnPgE1NCYnLgE9ATQSAjjG6+RnZn91j5+lfgMBfU1/NCk8RvLl/QRO1sJed8mUI4WZLDBVc062O2U6Si0oKw8699gj7QEzAAAAAAIAUv/sBH0EOgARAB8AAAEhBx4BHQEUACMiAD0BNAAzIQEUFjMyNj0BNCYjIgYVBH3++wFVYf785e3++wEE7AI7/Mh6hX54eX+DegN2A0S/chXb/t4BLvgV7gEl/diiwsOhFZW6upUAAQBA/+sD7QQ6ABMAAAEhERQWMzI2NxcOASMiJjURITUhA+3+lTAuGykaJi9WN4uO/rEDrQN5/a9EMgsLsRkTmqoCSsEAAAAAAQCA/+sECAQ6ABUAAAERFBYzMjY1LgEnMx4BFRACIyImNREBclVMeIoDOjTxND/098nUBDr9bYZ07J1/+4pq/pz+/P651+cCkQAAAAIARP4iBYUEQQAZACMAAAUkADU0EjcXDgEHFBYXETQ2MzIAFRQABREjEz4BNS4BIyIGFQJl/uD+/3t2mExHA4yim3/qARz++P7b8/OmlAOGeh4ZDh8BQvGkAQNVkkm7ZpjUIAKEdZD+x+Hl/ssc/jEClB3IjJTCIhcAAAABAE/+IgV+BDoAGwAAARE+ATUuASczHgEVFAAFESMRJAAZATMRFBYXEQNSpZUDPTXuN0L++/7Z8/7+/vLzlYgEOvx9H9aYfPSGaPeX9f69HP4yAdAeASUBHAHp/hW6wRwDggAAAQBm/+sGLQQ6ACgAAAEOAQcUFjMyNjURMxEUFjMyNjUuASczHgEVEAIjIiYnDgEjIgIRNDY3AeVCSANXYldk+2RXYlcESEDxQE3C3nSiLi+gc+DBTEEEOof8gbDZkKMBRf67o5DYsYD9h2r+nP70/sFvb29vAT8BDJz+agAAAAACAHX/7AThBcQAGQAkAAAlMjY3LgE9ATQ2MzIWFREQACEgABkBNxEUFhMUFhcRNCYjIgYVAqmVpgTJ9rubp7v+zP78/wD+zPqm8nVsODk0PLbHtgzvuVu0zs28/gT+7f7AAU0BBgKlAv1ZsdgDL2WECwFZVlJUVAAB/+4AAASFBcIAIwAAAT4BMzIWFwcuASMiBgcBESMRAS4BIyIGByc+ATMyFhcTFzM3AvI5hWogMxgYBBsNIzcR/tvy/twSNiIPGgMXFzEiaoQ5pRMEEwTEjnAJDMACAysn/W398wISAo4nKwMCwAwJbY7+d1VVAAACADP/6wZUBDoAFgAsAAABIx4BFRACIyImJw4BIyICETQ2NyM1IQEuASchDgEHFBYzMjY9ATMVFBYzMjYGVIAaHbbQeKUtLqV30LUbG28GIf7FAyAe/MYeIAJKVFpp+mdbU0sDg02jXf70/sFxcnJxAT8BDF2kTLf9/FOjV1ekUrDZkKPi4qOQ2AAAAAEAJP/xBbsFsAAbAAABIRE+ATMyBBUUBiEnMjY1LgEjIgYHESMRITUhBJH+D06EOPwBFf/+9QGgeAGPjkKFQ/P+dwRtBO3+ZhMY6d/U8bqIfH2HEBD9bQTtwwAAAQBy/+wE1gXGAB8AAAEGACMgABkBEAAhIAAXIy4BIyIGHQEhFSEVFBYzMjY3BNUW/uX9/v3+zgE1AQABAgEVGPMTj5qYqwIB/f+pmpeREwHZ5v75AVEBEQEVAQ8BVP798JiY6LYmwy6555SXAAAAAAIALgAACEMFsAAWAB8AAAERITIEFRQEIyERIREQAiEjNTMyEhkBAREhMjY1NCYjBQoBNPUBEP7w9f3Z/kDs/vMwKJh3A6UBNImKiYoFsP3r/dHR/ATt/iD+Xf6WwgEDAUgCo/0o/eqac3GYAAIAnwAACEoFsAASABsAAAEhETMRITIEFRQEIyERIREjETMBESEyNjU0JiMBkgKM8wE09gEP/vH2/dn9dPPzA38BNIqJiYoDRAJs/cnwycz0AoH9fwWw/Qb+FIttaooAAAEANQAABcsFsAAXAAABIRE+ATMgBBURIxE0JiMiBgcRIxEhNSEEmP4LQ4xPAQEBCfKClkeQR/P+hQRjBO3+jw4P2vX+NgHKmnEQDv1JBO3DAAAAAAEAmf6YBQsFsAALAAATMxEhETMRIREjESGZ8wKM8/5K8/43BbD7EgTu+lD+mAFoAAIAlAAABMEFsAAMABUAAAEhESEyBBUUBCMhESEBESEyNjU0JiMELP1bATT4AQ7+8ff92QOY/VsBNIqJiIsE7f6Q7M7Q8wWw/Qr+CJFybocAAgAm/pkF2wWwAA4AFQAAASMRIREjAzM2EhsBIREzAQYCByERIQXR6fwx7Ad3T3gIJQOPu/yGCVtLAnv+S/6aAWb+mQIpTgEtAR8CVPsSApro/r5wBCsAAAEAGAAAB4kFsAAVAAABIxEjESMBIQkBIQEzETMRMwEhCQEhBPCi8qn+k/7SAdf+SgEkAWGe8pgBXgEk/k0B1P7SAnv9hQJ7/YUDBwKp/ZwCZP2cAmT9WPz4AAAAAQBK/+sEewXFACgAAAEyNjU0JiMiBhUjNCQzMgQVFAYHHgEVFAQjIiQ1MxQWMzI2NTQmKwE1AmiKgI2NcpTzASDZ+AEVeG58gP7V+Nr+zPOcf5CgjpKqA0dza2F8d1673dTMZqMwLKl/zeDU1WSDgWl9csEAAAAAAQCaAAAFCwWwAAsAAAEzESMRIwEjETMRMwQY8/MD/Xjz8wMFsPpQBBj76AWw++kAAQAuAAAFCgWwAA8AAAERIxEhAwoBKwE1Mz4BGwEFCvP+OREPzvY+KIliDBgFsPpQBO3+IP5W/p3CBfYBUAKjAAEAP//rBNkFsAAVAAABFzMBIQEOASMiJic3HgEzMjY/AQEhAmgzAwEvAQz+Cj6WnxlCDAIKPBFMRCAf/g4BCgMekgMk+1KMiwQCwAICRkpFBC4AAAMAT//EBhkF7AAVAB4AJwAAATMgABEQACEjFSM1IyAAERAAITM1MwEiBhUUFjsBETMRMzI2NTQmIwOvDwELAVD+r/72D/MT/vX+sQFPAQsT8/76r7u6sBPzEa28u64FJv66/vL+9P69v78BQQEMAQ8BR8b+cM6+u8gDD/zxyru9zQAAAAEAmf6hBbYFsAALAAATMxEhETMRMwMjESGZ8wKM86sU3fvUBbD7EgTu+xX93AFfAAEAjwAABOkFsAATAAABESMRDgEjICQ1ETMRFBYzMjY3EQTp81CrYf7+/vfzgZdVs1QFsPpQAkEWFdr1Acv+NZtwFhYCqgAAAAEAngAABvwFsAALAAABESERMxEhETMRIREBkQHF8gHB8/miBbD7EgTu+xIE7vpQBbAAAAABAJ7+oQetBbAADwAAAREhETMRIREzETMDIxEhEQGRAcXyAcHzsRTd+eIFsPsSBO77EgTu+xP93gFfBbAAAAAAAgAYAAAF0wWwAAwAFQAAEyERITIEFRQEIyERIQERITI2NTQmIxgCgQE0+AEO/vH3/dn+cgKBATSKiYiLBbD9zezO0PME7f3N/giRcm6HAAADAJ8AAAZZBbAACgAOABcAAAEhMgQVFAQjIREzASMRMwERITI2NTQmIwGSATT4AQ7+8ff92fMEx/Pz+zkBNIqJiIsDfezO0PMFsPpQBbD9Cv4IkXJuhwAAAgCUAAAEwQWwAAoAEwAAASEyBBUUBCMhETMZASEyNjU0JiMBhwE0+AEO/vH3/dnzATSKiYiLA33sztDzBbD9Cv4IkXJuhwAAAQCI/+wE1wXGAB8AABM0ADMyABkBEAAjIAA1MxQWMzI2PQEhNSE1NCYjIgYViAEj//4BL/7R/v79/uHyl5mVpP3zAg2klZiXA9TkAQ7+rf7w/uv+7/6vAQHulZjmuCnDK7jompUAAAACAKr/6wcABcUAFQAjAAABEAAhIAARNSMRIxEzETM1EAAhIAARJzQmIyIGFREUFjMyNjUHAP61/vH+9v69vPPzvAFCAQoBDwFM88Coo7e4o6m+AlX+8/6jAV4BDAj9owWw/XE6AQsBX/6h/vUCtevqtv74uOvruAACAC0AAARiBbAADQAWAAApAQEuATU0JDMhESMRIQEjIgYVFBY7AQEx/vwBSIOBARL7AeTz/t4BIvGPjI2O8QJsOsGO2eL6UAIlAsiFfICKAAIAW//rBDwGEwAbACkAAAEyEh0BFAAjIgA9ARAANz4BNTMUBgcOAQcXPgEXIgYdARQWMzI2PQE0JgJz2fD+/Ozt/vwBBuN6ZsS0znOfIwNFnzKCenqEgnx9A/7+7d8V7f7hASTvZwFlAY0sFzZDxXojFI+GAjhAw6mGFZW1tZUVhqkAAAMAjwAABDoEOgAPABgAIQAAMxEhMhYVFAYHFR4BFRQGIwERITI2NTQmIyUzMjY1NCYrAY8Bt9vrXFduc9zS/vYBCmBbWmH+9shqZWhrxAQ6lJhNdB8DGIRam5oBzf7zQ0NBRq48PkRAAAAAAAEAhQAAA00EOgAFAAABIREjESEDTf4q8gLIA3b8igQ6AAAAAAIAJ/6+BMUEOgAOABUAADc+ATcTIREzESMRIREjEwEOAQchESGBXE0LCwLvlvL9SvYBAgAJRjwBoP7ww2bHyQGB/Ij9/AFC/r4CBQH2rPNYAqcAAAEAFwAABl8EOgAVAAABIxEjESMDIQkBIRMzETMRMxMhCQEhBDSA84D2/swBb/6rASzycvNz8gEt/qoBb/7LAbP+TQGz/k0CQQH5/lcBqf5XAan+B/2/AAABAE3/7APEBE0AKAAAARQGBx4BFRQGIyIkNTMUFjMyNjU0JisBNTMyNjU0JiMiBhUjNDYzMhYDsFZQXF7yy7j+/vJwYGBiWmKurltOVFxUavLxuMveAxJKdyQhfV2bq6uqQVpVQU9Gr0RCPFBOPZawoQAAAAEAhgAABBIEOgALAAABMxEjEScBIxEzERcDIPLyA/5b8vIDBDr7xgLUAf0rBDr9LgEAAAABAI8AAARlBDoADAAAASMRIxEzETMBIQkBIQH9e/PzawErASz+eQGo/sQBrP5UBDr+UAGw/fr9zAAAAAABAB8AAAQUBDoADwAAAREjESEDCgErATczMjY3EwQU8/7QCw+m3jQBJGY+CxQEOvvGA3b+9/6y/uHNqfcBzQAAAQCPAAAFbwQ6AA4AAAkBIREjEScBIwEHESMRIQL/AUABMPMD/tml/tgD8wEyASsDD/vGAsQB/TsCyQH9OAQ6AAEAhgAABBEEOgALAAAhIxEhESMRMxEhETMEEfP+W/PzAaXzAbX+SwQ6/j0BwwAAAAEAhgAABBIEOgAHAAAhIxEhESMRIQQS8/5a8wOMA3b8igQ6AAEAIwAAA9AEOgAHAAABIREjESE1IQPQ/qHz/qUDrQN5/IcDecEAAAADAFT+YAV/BhgAHwAtADsAABMQEjMyFhcRMxE+ATMyEhEVFAIjIiYnESMRDgEjIgI1JTQmIyIGBxEeATMyNjUhFBYzMjY3ES4BIyIGFVTKwidDIPIgSS3Cy8vALUoh8h9FKMDKBDhqdBgoEhEpGnNp/LpidBclEhIlFXRkAg4BCQE3Dg4B5v4WEBD+yf73FfL+5BAO/lcBpQ0NARzyFazRBwb9OQYEs5mbsQQGAsoEBs+uAAABAIb+vwSlBDoACwAAEzMRIREzETMDIxEhhvMBpvOTFN380gQ6/IgDePyI/f0BQQABAF8AAAPgBDsAEwAAISMRDgEjIiY1ETMRFBYzMjY3ETMD4PMxYjPd6/NlcDVfMvMBaQsLytIBTP60dmILDAIMAAAAAAEAhgAABgMEOgALAAABESERMxEhETMRIREBeQFS8wFT8vqDBDr8iAN4/IgDePvGBDoAAAABAH7+vwa1BDoADwAAAREhETMRIREzETMDIxEhEQFxAVLzAVPyuhTd+roEOvyIA3j8iAN4/Ij9/QFBBDoAAAAAAgAfAAAE6gQ6AAwAFQAAATMyFhUUBiMhESE1IRkBMzI2NTQmIwJK7dDj5M/+IP7IAivtZFxcZALiyKimzAN3w/3l/qNgS0xmAAAAAAMAjwAABckEOgAKAA4AFwAAATMyFhUUBiMhETMBIxEzAREzMjY1NCYjAYLt0OPkz/4g8wRH8/P7ue1kXFxkAuLIqKbMBDr7xgQ6/eX+o2BLTGYAAAIAjwAABCIEOgAKABMAAAEzMhYVFAYjIREzGQEzMjY1NCYjAYLt0OPkz/4g8+1kXFxkAuLIqKbMBDr95f6jYEtMZgAAAQBR/+sD6AROAB0AAAEiBhUjNDYzMhIdARQCIyImNTMUFjMyNjchNSEuAQIBV3Tl/LTo///nw+7lcFxwdQv+rAFTD3MDi2hQn9z+ze0j7v7O4LdbeqKBqHyXAAACAJD/7AYvBE4AEwAhAAABMz4BMzIAHQEUACMiJicjESMRMwEUFjMyNj0BNCYjIgYVAYPRGv3S7QEF/vzs2f8Vz/PzAb56hIJ8fISCegKI0Pb+0PcV+P7S/9n+PAQ6/diiwsOhFZ7Gxp4AAAACACcAAAPfBDoADQAWAAABESMRIwMjEy4BNTQ2MwMUFjsBESMiBgPf8uPn/P9maefPw1tb7eBiYQQ6+8YBjf5zAbUqmmebv/6gQFkBOF4AAAH/4f5LBAwGGAAoAAABIRUXPgEzMhYVERQGIyImJzceATMyNjURNCYjIgYHESMRIzUzNTMVIQJw/wADNZdgsL22qSU6IQ8ROxY7QGRoSW4m85yc8wEABK77AUtR1Of9Lre/CAm/BQhcVwLUgnA6NfzoBK6qwMAAAAEAWP/sA/4ETgAdAAAlMjY1MxQEIyICPQE0EjMyFhUjNCYjIgYHIRUhHgECQlt85f7/uPT5+fPH8+V1YnxwCQFW/qsLbq5nUaDaAS7xI/ABMOG3W3qegqiAlQAAAgAfAAAGmgQ6ABYAHwAAAREzMhYVFAYjIREhERACKwE/ATI2NREBETMyNjU0JiMD+u3Q4+PQ/iD+7b7jNAEkZFkC+e1jXVxkBDr+h7+foMMDdv73/r3+1sUByN8Bzf3F/sFeR0NXAAACAIYAAAaxBDoAEgAbAAABIREzETMyFhUUBiMhESERIxEzAREzMjY1NCYjAXkBpfPt0OPj0P4g/lvz8wKY7WNdXWMCnwGb/oe/n6DDAd3+IwQ6/cX+wV9GQ1cAAAH/9QAABAwGGAAcAAABIREXPgEzMhYVESMRNCYjIgYHESMRIzUzNTMVIQKE/uwDNZdgsL3zZGhJbibziIjzARQEtf7+AUtR1Of9bQKVgnA6NfzoBLWqubkAAAAAAQCG/poEEgQ6AAsAAAERIREzESERIxEhEQF5Aabz/rXz/rIEOvyIA3j7xv6aAWYEOgAAAAEAjf/rBrIFsAAgAAABERQGIyImJw4BIyImNREzERQWMzI2NREzERQWMzI2NREGsvbOcKo2OLBxye/zaVxod/dwY2JvBbD79drgUlRUUuDaBAv79X17en4EC/v1fXt6fgQLAAABAHD/6wXtBDoAIAAAAREUBiMiJicOASMiJjURMxEUFjMyNjURMxEUFjMyNjURBe3du2KVMDSaY7fW81BKV2L0WFNOVwQ6/VHN00ZISEbSzgKv/VFybG1xAq/9UXJsbXECrwAAAv/gAAAEIQYYABIAGwAAASERMzIWFRQGIyERIzUzETMRIQERMzI2NTQmIwKj/t7t0OPj0P4grq7zASL+3u1kXF1jBDn+ytGur9UEOasBNP7M/Vz+gmpUUW8AAAABAKL/7Aa2BcYAJwAAATM1EAAhIAAXIy4BIyIGHQEhFSEVFBYzMjY3MwYAIyAAETUjESMRMwGVvQE1AQABAgEVGPMTj5qYqwHs/hSpmpeRE/MW/uX9/v3+zr3z8wNQEwEPAVT+/fCYmOi2FcQ+ueeUl+b++QFRARE+/XQFsAAAAAEAhv/sBb4ETgAjAAABMzYSMzIWFSM0JiMiBgchFSEeATMyNjUzFAQjIgInIxEjETMBeaES9+HH8+V1YnpwCgF4/ocKb3xbfOX+/7ji9xKh8/MCctcBBeG3W3qaf6uCl2dRoNoBBNf+OQQ6AAIAIAAABQ4FsAALAA8AAAEjESMRIwMjATMBIwEhAyMDhITdd5H7AgfnAgD7/dgBW6sDAaz+VAGs/lQFsPpQAmcB/wAAAgAKAAAERQQ6AAsAEQAAASMRIxEjAyMBMwEjATMDJyMHAuRdw1to9wGp5wGr9/5c+GQXBBcBF/7pARf+6QQ6+8YBxAEGXl4AAgC2AAAHJwWwABMAFwAAASEBMwEjAyMRIxEjAyMTIREjETMBIQMjAakBawEs5wIA+4+E3XeR+5j+2PPzAlsBW6sDAmcDSfpQAaz+VAGs/lQBrP5UBbD8twH/AAACAJ0AAAYYBDoAEwAZAAABMxMzASMDIxEjESMDIxMjESMRMwEzAycjBwGQ/vjnAav3al3DW2j3bbrz8wHt+GQXBBcBxAJ2+8YBF/7pARf+6QEX/ukEOv2KAQZeXgAAAAACAIQAAAZpBbAAHAAfAAABHgEVESMRNCYrAQcRIxEnIyIGFREjETQ2ITMBIQETIQR0+vvzfZBpCfICgJB88/8BAAz+hQTc/ZLy/hwDKwPS8v6cAWSVbRH9qwJjA22V/pwBZPXSAoX9hgG1AAACAIIAAAVkBDoAGgAdAAAzNTQ2NwEhAR4BHQEjNTQmKwEHESMRIyIGHQEBEyGCycr+6wP0/urCxPNmdiQB8i13ZQGFlf7Wqd3MDQHb/iQQzNmpqZBrA/5fAaRrkKkCaQEiAAAAAgCtAAAIrgWwACQAJwAAIRE0NjchESMRMxEhOwEBIQEeARURIxE0JisBBxEjEScjIgYVEQETIQLJGx7+nvPzAxAYDP6FBNz+hPr7832QaQnyAoCQfAIL8v4cAWRRfjT9mQWw/XsChf17A9Ly/pwBZJVtEf2rAmMDbZX+nAM2AbUAAAAAAgCPAAAHdwQ6ACEAJAAAITU0NjchESMRMxEhASEBHgEdASM1NCYrAQcRIxEjIgYdAQETIQKVGhz+t/PzAqT+7QP0/urCxPNmdiQB8i13ZQGFlf7WqVB8M/5YBDr+KAHY/iQQzNmpqZBrA/5fAaRrkKkCaQEiAAAAAgAp/kADqgd4AC0ANgAAATI2NTQmIyE1ITIEFRQGBxUeARUUBCsBIgYVFBYXBy4BJzQ2OwEyNjU0JisBNQE3MxUFIyU1MwGQiH5/gP7lARvmAQx5b4KH/vfgNUU9VkJRhqEBtKkzeIaWlY8BBYvQ/vSd/vXOA05vZFtuxse9caAsAyqqgM7fNjFCSx6ZKbOBjYh8Znp5xwObjxH8+hMAAAIAM/5HA4gGCwAtADYAAAEyNjU0JiMhNSEyFhUUBgcVHgEVFAYrASIGFRQWFwcuASc0NjsBMjY1NCYrATUTNzMVBSMlNTMBl3Rqb2/+5QEb1vpeV2lt880xSUBTPlJ6nwGuoTBreIGAl9eL0P70nf71zgJvS0Q8R7mdlFB2IwMhd1WbqjYxQkseki+ueYWBT0FKSakDDY8R/PoTAAMAav/rBREFxQANABYAHwAAARAAISAAGQEQACEgABEFITU0JiMiBhUFIRUUFjMyNjUFEf61/vH+9v69AUIBCgEPAUz8SwLCwKijtwLC/T64o6m+AlX+8/6jAV4BDAEGAQsBX/6h/vUxM7Xr6rbeKrjr67gAAwBS/+wEMwROAA0AFAAbAAATNAAzMgAdARQAIyIANQEyNjchHgETIgYHIS4BUgEE6+0BBf787O3+/AHxcnoO/gsNenJxeQ4B8w97Aif2ATH+0PcV+P7SAS74/pyXhISXAt2XgICXAAABABEAAATvBcMAEQAAARczNxM+ATMXByMiBgcBIwEhAlwbAxvpNJJ9LgEULzsW/pLn/gwBBAGLcG4C/aiVAdA9RPuPBbAAAAABACAAAAQYBE4AFQAAARczNxM+ATMyFhcHLgEjIgYHASMBMwHjEgQSei6SaSExGBcEGw0jOg3+9tP+kvsBblpaAb6UjgkNwAIENir84gQ6AAQAav92BREGLgADAAcAFQAjAAABIxEzEyMRMwEQACEgABkBEAAhIAARJzQmIyIGFREUFjMyNjUDIMbGAcXFAfD+tf7x/vb+vQFCAQoBDwFM88Coo7e4o6m+BIQBqvlIAbQBK/7z/qMBXgEMAQYBCwFf/qH+9QK16+q2/vi46+u4AAAAAAQAU/+IBDQEtAADAAcAFQAjAAABIxEzAyMRMyU0ADMyAB0BFAAjIgA1MxQWMzI2PQE0JiMiBhUCori4A7e3/bQBBOvtAQX+/Ozt/vzzeoSCfHyEgnoDGwGZ+tQBoP/2ATH+0PcV+P7SAS74osLDoRWexsaeAAAAAAMAjf/rBqcHRAAsAD4ARAAAATIWFREUBiMiJicOASMiJjURNDYzFSIGFREUFjMyNjURMxEUFjMyNjURNCYjExUjIiQjIgYdASM1NDYzMgQzASc3JzMVBO7J8PDJcK03Oa1vye/vyVxpaVxod+x1aVxqalxqJIT+0CoyN4Z4c0gBKnL+N1E6AboFsO/m/eTm7k9RUU/u5gIc5fDDiIr95IuHen4Bi/51fnqHiwIciogB34Z4MjQSJW9qeP5LPXCPfQAAAAADAHT/6wXRBeMALAA+AEQAAAEyFh0BFAYjIiYnDgEjIiY9ATQ2MxUiBh0BFBYzMjY9ATMVFBYzMjY9ATQmIxMVIyIkIyIGHQEjNTQ2MzIEMwUHJzcnMwQ6ud7Ws2GUMTKUX7XU3LtOVk9HUV7sXVNGUFdNvSSF/tAqMjaHeHNJASly/tmiUToBugRH3tb119xHSklI3Nf11t7Dd3r1e3ZtccbGcW13evV6dwHnhngyNBIlb2p48L49b4kAAAIAjf/rBrIHBwAHACgAAAE1IRchFSM1BREUBiMiJjURIxEUBiMiJjURIxEUFjMyNjceATMyNjURAesDVQH+prUCjW9iY3D3d2hcafPvyXGwODaqcM72BpdwcH9/5/v1fnp7fQQL+/V+ent9BAv79drgUlRUUuDaBAsAAAACAHD/6wXtBbEABwAoAAABNSEXIRUjNQERFAYjIiY1ESMRFAYjIiY1ESMRFBYzMjY3HgEzMjY1EQGXAzgF/rG1AipXTlNY9GJXSlDz1rdjmjQwlWK73QVBcHB/f/75/VFxbWxyAq/9UXFtbHICr/1RztJGSEhG080CrwAAAQBq/ooEuAXFABgAAAEjESYCNREQACEgABUjNCYjIgYVERQWOwEDMPLa+gEwAQABAQEd85OYl6enl5b+igFoIAFF9gEVARABU/797ZWY57f+6bnnAAAAAAEAXP6JA/METgAYAAABIxEmAj0BNBIzMhYVIzQmIyIGHQEUFjsBAtXzvcn+6MLv5XBcf3RzgZL+iQFqIQEk0yPtATPitlt6yZQjmMYAAAAAAQBtAAAEkwU+ABMAAAEFByUDIxMlNwUTJTcFEzMDBQclAlsBIUj+3bWv4f7fRwElyv7eSQEjuazkASVM/uABwayAqv7BAY6rgKsBaKuCqwFG/murf6oAAAH8ZgSi/zkF/QAHAAABFSc3IScXFf0XsQECIgGxBSB+Ae5sAdwAAAAB/HMFF/9tBhUAEQAAATIkMzIWHQEjNTQmIyIEKwE1/JV0AS1JdXmIODIr/s2GJAWdeGpvJRI0MniGAAAB/XsFFv5yBmAABQAAATUzBxcH/Xu9ATtSBdyElnBEAAH9pQUW/pwGYAAFAAABJzcnMxX991I7Ab0FFkRwloQACPok/sQBvwWvAA0AGwApADcARQBTAGEAbwAAATQ2MzIWFSM0JiMiBhUBNDYzMhYVIzQmIyIGFRM0NjMyFhUjNCYjIgYVATQ2MzIWFSM0JiMiBhUBNDYzMhYVIzQmIyIGFQE0NjMyFhUjNCYjIgYVATQ2MzIWFSM0JiMiBhUTNDYzMhYVIzQmIyIGFf0RcGJjcHAvNDIvAd5xYGJycS80MS5IcGJicXAvNDMu/stxYGJxcC80MS/9T3BiY3BwLzQyL/1NcWJjcHAvNDIv/t5xYWNwcC41Mi81cWFjcXEuNTIuBPNVZ2dVLDk5LP7rVWdnVSw5OSz+CVVnZ1UsOTks/flVZ2dVLDk5LP7kVmZmVi04OC0FGlVnZ1UsOTks/glVZ2dVLDk5LP35VWdnVSw5OSwAAAAI+k3+YwGMBcYABAAJAA4AEwAZAB4AIwAoAAAFFwMjEwMnEzMDATcFFSUFByU1BQE3JRcGBQEHBSclAycDNxMBFxMHA/5QC3pgRjoMemBGAh0NAU3+pvt1Df6zAVoDnAIBQEQl/wD88wL+wEUBJisRlEHGA2ARlELEPA7+rQFhBKIOAVL+oP4RDHxiRzsMfGJHAa4QmUQXsfyOEZlFyALkAgFGRf7V/OMC/rtHASsAAAL/4AAABCEGYgASABsAAAEhETMyFhUUBiMhESM1MzUzFSEBETMyNjU0JiMCo/7e7dDj49D+IK6u8wEi/t7tZFxdYwUF/f7Rrq/VBQWrsrL8kP6CalRRbwADAJ8AAATaBbAAAwAOABcAAAEHATcBESMRITIEFRQEIyUhMjY1NCYjIQTabv5sbv5M8wI59gEM/vT2/roBRoqFhYr+ugIjZAG/ZP5G/dgFsPXP0fPDjnFxkgAAAAMAgP5gBDQETgADABYAJAAAJQcBNyUUAiMiJicHESMRMxc+ATMyEhEjNCYjIgYHER4BMzI2NQQtb/6XbwFw2speijID89kQNI9hzNvyen9NaSAgaFB/eA1jAaFkSvH+5D8/Af33BdqCSkz+yP74qdBAO/4XOjuzmAAAAAABAJQAAAQ0BxAABwAAASERIxEhETMENP1T8wKt8wTt+xMFsAFgAAAAAQB+AAADXAV0AAcAAAEhESMRIREzA1z+FPIB6/MDdvyKBDoBOgAAAAEAn/7GBJ0FsAAVAAABIREzIAAREAIhJzI2NS4BKwERIxEhBDf9W7EBIAE6+f78AZhzAbC2sfMDmATt/lb+1f7k/vv+z7rKq8PB/YcFsAAAAQB+/uID2wQ6ABUAAAEhFTMyBBUUAgcnPgE1NCYrAREjESEDRv4qU/UBI76+VHVonIlT8gLIA3bl+umL/vAxrSiLbImQ/jkEOgAAAAEAlAAABSwFsAAUAAAJAiEBIxUjNSMRIxEzETM1MxUzAQUE/nsBrf7O/s1Do1rz81qjOwEhBbD9Wfz3AnTq6v2MBbD9lf7+AmsAAAABAI4AAASuBDoAFAAACQIhAyMVIzUjESMRMxEzNTMVMxMElP7EAVb+y9gvm1fy8lebJ88EOv3+/cgBrLKy/lQEOv5Qx8cBsAABADQAAAahBbAADgAAASMRIxEhNSERMwEhCQEhA6yo8/4jAtCLAckBIP30AjX+1wJ2/YoE7cP9lwJp/Un9BwAAAQA+AAAFqQQ6AA4AAAEjESMRITUhETMBIQkBIQNBe/P+awKIawErASz+eQGo/sQBrP5UA3bE/lABsP36/cwAAAEAnwAAB4QFsAANAAABIREhFSERIxEhESMRMwGSAowDZv2M8v108/MDMAKAw/sTAm39kwWwAAAAAQB+AAAFZwQ6AA0AAAEhESEVIREjESERIxEzAXEBpQJR/qLz/lvz8wJ3AcPE/IoBtf5LBDoAAAABAJ/+xAfvBbAAFwAAATMgABEQAiEnMjY1LgErAREjESERIxEhBRGEASABOvn+/AGYcwGwtoTy/XPzBHIDQf7V/uT++/7Pusqrw8H9iQTt+xMFsAABAH7+5Qa7BDoAFwAAATMyBBUUAgcnPgE1LgErAREjESERIxEhBAqE/wEuvr5VdGoBppOE8/5a8wOMApX66Yz+8DGuJ4xsiY/+NgN2/IoEOgAAAAACAGn/6AXMBcUAKQA3AAAFIiYnDgEjIAARNRAAMxUiBh0BFBIzMjY3JgI9ATQSMzISERUUBgceATMBFBYXPgE9ATQmIyIGFQXMcsZaS6Fa/tn+nAEI22181bwYLhhxdOW+xexhXi5kOP2NZmdSVmFdWF8YIyUjIgGEAS+2AREBYMzpurjb/vMEBGMBB6LU8QE0/sb+/9SX/GELCgIdi9VJRs6B5a6ytqMAAAAAAgBh/+sEyQROACkAOAAABSImJw4BIyIAPQE0EjMVDgEdARQWMzI2Ny4BPQE0NjMyFh0BFAYHHgEzATU0JiMiBh0BFBYXPgE1BMlhpEg9g0rv/t7VsEJJlIMIEQxIR7GZm7hCPyZRLv7pOjQ1ODw8MTISGhwdHAFB/EvRAQrKBJN4TabMAQFKum5/vOn+x35rtEgJCAGAgGqIemWEVos1MIRTAAABAC7+oQaxBbAADwAAASE1IRUhESERMxEzAyMRIQGU/poDvf6cAozzqxTd+9QE7cPD+9UE7vsV/dwBXwABACb+vwU6BDsADwAAASM1IRUjESERMxEzAyMRIQEb9QLE3AGm85MU3fzSA3fExP1LA3j8iP39AUEAAAACAIIAAATcBbAAAwAXAAABIxEzAREjEQ4BIyAkNREzERQWMzI2NxEDLqOjAa7zUKth/v7+9/OBl1WzVAEsAtsBqfpQAkEWFdr1Acv+NZtwFhYCqgACAHQAAAP1BDsAAwAXAAAlIxEzASMRDgEjIiY1ETMRFBYzMjY3ETMCjaSkAWjzMWIz3evzZXA1XzLzzAJf/NUBaQsLytIBTP60dmILDAIMAAEAigAABOQFsAATAAAzETMRPgEzIAQVESMRNCYjIgYHEYrzUKthAQEBCvOCllezUgWw/b4VF9v0/jUBy5pxGBT9VgAAAgAg/+kFwAXEAB0AJgAABSAAETUuATUzFBYXEAAXIAARFSEVFBYzMjY3Fw4BASE1NCYjIgYVA+L+yf63oKKyRUsBQfUBEQEX/JW90G6eTzE1xf3hAniPppuoFwFUASJKF86sWnIVARMBWAH+nf6/hDzD6CghvCA4A2kftdHptwAC/87/7AR2BE8AGwAjAAAFIgAnLgE1MxQWFz4BFzISHQEhHgEzMjY3Fw4BAyIGByE1NCYCzub+9AWEhaoyNiH8teDk/VYKiX5kiUJHPcKiW3QSAbRnFAEd6R68l0pjGMXsAf7744+Hoi8tpjVDA5+NdRlpgAAAAAABAJT+xATnBbAAGAAAASMRIxEzETMBIQEWEhUQAiEnMjY1LgErAQGYEfPzcwHCAST+Gu7/+f78AZh0AbG29QJ4/YgFsP2hAl/9ix7+3P7++/7Ousqsw8AAAQCO/uoEQwQ6ABYAAAEeARUUAgcnPgE1LgEnIxEjETMRMwEhAs2tvr2+VXVpAZGGrvLyVQFBAS0CYSnbtYj++S+tJoRnfn4I/lQEOv5QAbAAAAAAAQCf/ksFEAWwABcAAAERIREzERQGIyImJzceATMyNjURIREjEQGSAozyt6klOiAOETsWPEH9dPMFsP2AAoD6EbbACAm/BQhdVgKs/ZMFsAABAH7+SwQJBDoAFwAAAREhETMRFAYjIiYnNx4BMzI2NREhESMRAXEBpfO4qSQ6IQ8ROxY7Qf5b8wQ6/j0Bw/uHtsAICb8FCF1WAfT+SwQ6AAIAU//qBRsFxQAWAB4AAAEgABEVEAAlIAARNSE1NCYjIgYHJz4BEzI2NyEVFBYCcwFKAV7+q/7+/sn+xgPW0uR2p1IxN8/robgL/R6wBcX+lv7Mov7X/o4BAWEBQoQV0/8pILwfOvrx6L0fttAAAAABAF3/6wRGBbAAGgAAARcBHgEVFAQjIiQ1MxQWMzI2NTQmKwE1ASE1BBsB/n/Q2/7o6cz+5POGb3+PlJmOAWr9kAWwm/5FGOPHzeDU1WSDgWmVhasBkcMAAQBd/nUERgQ6ABoAAAEhNSEXAR4BFRQEIyIkNTMUFjMyNjU0JisBNQL0/ZsDjAH+iMzW/ujpzP7k84Zvf4+UmY8DdsSb/kMZ48XL4dTUYoOCZ5WEqwAA//8AO/5LBIkFsAAmAKxSAAAmAdOkKQAHAZoBNQAAAAD//wA0/kkDogQ6ACYA51UAACcB0/+d/3oABwGaAQv//gACAFQAAASABbAACgATAAABETMRISIkNTQkMwERISIGFRQWMwOO8v3Z9v7xAQ73ATX+y4uHiIoDlAIc+lD80dD3/S4CD5Jwc5oAAAAAAgBmAAAGpQWwABgAIQAAISIkNTQkMyERMxE3PgE3NiYnMx4BBwYEIyURISIGFRQWMwJr9v7xAQ73ATXyTGVpBAEfHuwiIwIE/wDB/sL+y4uHiIr80dD3Ahz7EgEBdm9OolBlkknR2MICD5Jwc5oAAAIAXv/pBn4GGAAiADMAABMQEjMyFhcRMxEGFjM+ATc2JiczHgEHAgAjBiYnDgEjIgI1AS4BIyIGHQEUFjMyNjcuATVe2s1UgTPzAk1Ed38EAR4f7CIjAgT+6tOAqiw1l2rL2gKvI2NEf3Nxf0lmIwMDAg4BCAE4PTsCQvtPU2UBuahjyGiBtV3+8f7pAlVgWVoBHfEBJjI2zqsVma86OA8iEwAAAQA7/+gF4QWwAC0AAAE0JisBNTMyNjU0JiMhNSEyBBUUBgcXHgEdAQYWMz4BNzYmJzMeAQcCACMGJicCpntr1JuehYCP/qABYP4BBHx6AYJvAT42anIEAR4f7CMiAgT+9cunsAgBeG2BxW55aXDF0c90ojADJaiARD1KAbipY8hoiK9c/vD+6gOdsQABAC//4gT/BDoALgAAJQYWMz4BNzYmJzMeAQcOASMGJic1NCYrASczMjY1NCYjISchMhYVFAYHFx4BHQEDAQEhLFpfBAEfH+wjIwIF77WjmwhRTukCt2ddXmb++gYBDNbhVlYBZFbrKy0BjYJNoVFoj0jb4wNwhEs8QL1EQ0ZQw6ecUW8jAxp1WT4AAAIASf6sBCQFsAAhACsAABMnMzI2NTQmIyEnITIEFRQGBx4BHQEUFhcVIy4BPQE0JiMBFAYHJz4BPQEzlwHIlYSBiv7gAwEj9wEGc3N+aiAm+ikWfXICmmhVfyws5QJcw291b3vD2M9zoDMorYR4QXgiFyKLR3Rzgf3cZ9xJTkiTW7wAAAIAdf6cBAsEOgAhACsAABM1MzI2NTQmIyEnITIWFRQGBx4BHQEUFhcVIy4BPQE0JiMBFAYHJz4BPQEzs+VpZGZn/uEEASPW61dXYVMXHfsdDmJfAl5oVX8sLOUBnLNJRUdVwa+gUnMoIYJhVSdZFBEUYTFTT1T+jGfcSU5Ik1u8AAAAAAEAQ//oB34FsAAhAAABIREQAiEjNTMyEhkBIREGFjM+ATc2JiczHgEHAgAjBiYnBA3+VN3+9DUpjHcDkQFNRHd+BAEeH+wiIwIE/uvTuMIJBOv+Ff5q/pbEAQUBNwKw+7dUZAG5qGPIaIG1Xf7x/ukDtMsAAQA//+gGWQQ6ACEAAAERBhYzPgE3NiYnMx4BBwYCIwYmJxEhERACKwE/ATI2NREECgFRR11iBAEeH+wiIwIE97u7xgn+/7jfQAQpZFMEOv0tVGQBopZevWJ6q1j7/v4DtMsCDf76/rz+1tMBu98BzAAAAAABAJj/6AeFBbAAHQAAAREGFjM+ATc2JiczHgEHAgAjBiYnESERIxEzESERBQYBTUR4fgQBHx/sIiQCBf7r07fCCf138/MCiQWw+7dTZQG4qWPHaX+2Xv7x/ukDtMsBBv2TBbD9gAKAAAEAd//oBlwEOgAdAAABIREjETMRIREzEQYWMz4BNzYmJzMeAQcGAiMGJicDGv5Q8/MBsPMCUEheYwQBHx7rIyICBPe8usYJAbr+RgQ6/kMBvf0tU2UBopZdvWOBpVf7/v4DtMsAAAAAAQBi/+sEtgXFACEAAAUgABkBEAAhMhYXBy4BIyIGFREUFjM+ATc2JiczHgEHBgQCu/7w/rcBSQEQdK1GP0SOVqe/v6d/hQQBGhnrJhQBBP7jFQFYARIBBgERAVksLbAiIu61/vi57QGFe1OtYqpqTuDlAAABAFX/6wPlBE4AIQAAJT4BNzQmJzMeARUOASMiAD0BNAAzMhYXBy4BIyIGHQEUFgJaU0IDCgnrDQ4E1bL1/vABBupgizAuMHhFgH2GrwFERzdxNkZnMamnATXoKucBNSIgvRwey4wqj8oAAAABACL/6AVYBbAAGQAAASE1IRUhEQYWMz4BNzYmJzMeAQcCACMGJicB5/47BID+OAFNRHd/BAEfH+wjIgIE/uvTt8MJBOvFxfx8U2UBuKljx2l/t13+8f7pA7TLAAEARP/oBMwEOgAZAAABITUhFSERBhYzPgE3NiYnMx4BBw4BIwYmJwGJ/rsDi/6tAVFHXWMEAR8e6yMjAgT4u7rGCgN3w8P98FRkAYF4SptMY4lF2+MDtMsAAAAAAQCH/+sFAQXFACkAAAEiBhUUFjMyNjUzFAQjICQ1NDY3NS4BNTQkITIEFSM0JiMiBhUUFjsBFQLCp6G0pI2v8/656P70/sGGhHSAASoBC+YBNfOpf6KgkqC+AoZyfWmBg2TV1ODNf6krAy6jZszU3bted3xha3PBAAAA//8ArQJtBOoDMQBGAYbgAFMzQAD//wCyAm0F6gMxAEYBhrYAZmZAAP//AAT+PwOZAAAAJwBBAAH+/gAGAEEBAAABAGAD8wGWBjIACQAAEzQ2NxcOAR0BI2BkUoAuK90ErGbYSE1Ik1y7AAAAAAEAMwPWAWkGGAAJAAABFAYHJz4BPQEzAWllUn8tLN0FXGfYR01Hk12+AAAAAQAy/sIBaAENAAkAACUUBgcnPgE9ATMBZ2RSfyws3kdl2EhOSJNbxwAAAP//AEcD1gF9BhgARwFmAbAAAMABQAAAAP//AGID8wLlBjIAJgFlAgAABwFlAU8AAP//AEAD1gLABhgAJgFmDQAABwFmAVcAAAACADL+wgKqAQ0ACQATAAAlFAYHJz4BPQEzBRQGByc+AT0BMwFnZFJ/LCzeAUJlUn8sLN5HZdhITkiTW8fGZdhITkiTW8cAAAABAEAAAAQeBbAACwAAASERIxEhNSERMxEhBB7+iPP+jQFz8wF4A3L8jgNyyAF2/ooAAAAAAQBc/mAEOQWwABMAACkBESMRITUhESE1IREzESEVIREhBDn+iPP+jgFy/o4BcvMBeP6IAXj+YAGgwgK0xAF2/orE/UwAAAAAAQCIAf8CRAP4AA0AABM0NjMyFh0BFAYjIiY1iHZnaHd2aGh2AyFgd3ZhTWF0dGH//wCcAAADWADpACYAEAMAAAcAEAHNAAD//wCcAAAFEQDpACYAEAMAACcAEAHNAAAABwAQA4YAAAAGAEv/6wdgBcUAGQAnADUAQwBRAFUAAAE0NjMyFhc+ATMyFh0BFAYjIiYnDgEjIiY1ATQ2MzIWHQEUBiMiJjUBFBYzMjY9ATQmIyIGFQUUFjMyNj0BNCYjIgYVARQWMzI2PQE0JiMiBhUTJwEXAzClj0tyJiZyTI+mpY5NdCUmcUqRpf0boYyQpaWOjaIDjklER0JHREVGAcdKQ0ZDR0RFRvtNR0ZDR0hERUbqfQLHfQFlgas6NTU6q4FOgqo5NTU5qoIDgYKrq4JNgqmpgvzMQlhVRU5BWVlBTkFZVkROQVlZQQLmQldXQk1CWVlC+9VIBHJIAAAAAAEAbACXAjMDtgAGAAABEyMBNQEzATz3p/7gASCnAib+cQGGEwGGAAABAFQAlwIbA7YABgAAEwEVASMTA/sBIP7gp/f3A7b+ehP+egGPAZAAAQAtAG0DcQUnAAMAADcnAReqfQLHfW1IBHJIAAIAPwIwA1YFxQAKAA4AAAEzFSMVIzUhJwEzAxEnAwLUgoLE/jMEAczJxAP3A3iYsLBwAnX9swFOAf6xAAEAaQKMAv8FugATAAABFz4BMzIWFREjETQmIyIGBxEjEQEBICRuSX6FxUFBNEMTxQWseUFGk6D+BQHJZ1cvKv3SAyAAAQBPAAAEawXFACcAAAEOAQchByE1Mz4BNyM1MycjNTMnNDYzMhYVIzQmIyIGFRchFSEXIRUB6wIgHwLBAfwmCi8tAqehBZ6YBOTH0+Lza1dXYQQBiP5+BQF/AcBNfzLCwg2VXKaAp3zT6de6a2OBeHyngKYAAAAAAwCZ/+wGSQWwAAoAEwArAAABESMRITIEFRQEIyczMjY1NCYrASURMxUjERQWMzI2NxcOASMiJjURIzUzEQGT+gF49wEL/vX3fn6GgoKGfgPnw8MxKxksFBohXjGDj5WVAhz95AWw+c3T+8ySbmyQXf75tP2qRTYHBrIQFJmrAla0AQcAAQBL/+sD4AXFACsAAAEhFRQWMzI2NxcOASMiAD0BIzUzNSM1MzU0ADMyFhcHLgEjIgYdASEVIRUhA5z+NJeIO201FDp4P/L+4JKSkpIBH/E9ckQUN246h5YBzP40AcwB8AKapxERxQ8QARLxAo6cjgz2ARsQD8cQE7CcDo6cAAAEAHH/6wWJBcUAGwApADcAOwAAARQGIyImPQE0NjMyFhUjNCYjIgYdARQWMzI2NQEUFjMyNj0BNCYjIgYVMzQ2MzIWHQEUBiMiJjUTJwEXArGXh4mZmIiImKk9Ojs8PTw5PAEYpJKRoqOSkaOpR0RESENHQ0rBff05fQQlcZSpgk2DqpZxMURZQk1CV0Qv/PKDqamDToKqqoJBWVlBTkVVWUEDyEj7jkgAAAAAAgBF/+sDkAXFABoAJgAABSImPQEOASM1MjY3ETQ2MzIWHQEUAgcVFBYzAzU0JiMiBhURPgE1Atvq5DFiNTdhMLCfi6nPul13MCkiLSxSUhXs2AcLCbsLCwGyxtqxmiqY/sBnRYeBA4osPUJdYf6zR7ZjAAAEAJgAAAhPBcAAAwARAB8AKwAAASE1IQE0NjMyFh0BFAYjIiY1MxQWMzI2PQE0JiMiBhUBIwEHESMRMwE3ETMIEP3GAjr9irmhorm5oKK6r1ZXVFZXVVVW/sDy/XcD8/MCiQPyAXyVAmCXuLiXdZi2tphXZWVXdVRnZ1T7jwQrAfvWBbD71gEEKQAAAAIAZAOUBGIFsAAOABYAAAEnAyMDBxEjETMbATMRIwEjESMRIzUhA/QDhD2JA2+JkJGDbv33inWIAYcE2QH+ugFSAf6vAhz+gwF9/eQBvf5FAbtfAAIAlv/sBJEETgAVAB4AACUOASMiADU0ADMyAB0BIREeATMyNjcBIgYHESERLgEEFFm4Yd7+0gE/zdMBHP0AOYlPYbZZ/pBLizsCHDeIXjg6AUTt5gFL/s7rL/64Njg7PwMqQDr+6wEeNjsA//8Aaf/1Bl8FsgAnAckAEgKGACcBdAEMAAAABwHQA1EAAAAA//8Aav/1BvYFwAAnAcsACgKUACcBdAHFAAAABwHQA+gAAAAA//8Aav/1ByYFrwAnAc0AAgKOACcBdAH9AAAABwHQBBgAAAAA//8Aav/1BoUFrwAnAc8AGAKOACcBdAFCAAAABwHQA3cAAAAAAAIAQ//rBE4F7QAUACIAAAEEABEVFAAjIgA1NBIzMhYXNy4BJwEuASMiBhUUFjMyNj0BAegBGQFN/tjl5f7n+OJSkTkDL9mXAb4llW+AfJB/e5sF7Ub+Nv6kZP3+ywEV1OoBDy8rAqnNMf1rPE6tkHqtz6FmAAAAAAEApv8bBPQFsAAHAAAFIxEhESMRIQT01/1f1gRO5QXU+iwGlQAAAAABAED+8wTBBbAADAAACQEhFSE1CQE1IRUhAQOP/e4DRPt/Ak/9sQRH/PYCEgJD/XPDlwLIAsaYw/1zAAABAJ4CbQPhAzEAAwAAASE1IQPh/L0DQwJtxAAAAQA7AAAEiwWwAAsAAAEXMzcBMwEjAyM1IQIiHQMcAVvS/he+2NEBYwF8hYUENPpQAkHFAAMAZP/rB9kETgAZACcANQAAARQAIyImJw4BIyIAPQE0ADMyFhc+ATMyABUjNCYjIgYHFR4BMzI2NSEUFjMyNjc1LgEjIgYVB9n++uGi409P5KHi/vwBA+Gi5U9O5aPgAQXzeniHuhgVvIZ5e/pxeHuFvBYXu4d5eAH/6/7XwJaWwAEp6zrqASu+k5O+/tXqmrj4YSRi/7WdnbX/YiRg+bebAAAAAf+y/ksCqAYtABwAAAUUBiMiJic3HgEzMjY1ETQ2MzIWFwcuASMiBhURAZC3qSU4IQ8SORY7Qb+zJEctGRcpHFFSP7e/CAm/BQhdVgT3tr8LCrkFBlxW+wkAAAACAGUA/QQiBAEAGwA3AAATPgEzNhYXHgEzMjY3HwEOASMiJicuAQciBgcnBz4BMzYWFx4BMzI2Nx8BDgEjIiYnLgEHIgYHJ28weUNHSl9RTERBeS8DCjF5QkRMUV9KR0J5LgMUMHlDR0pfUUxEQXkvAwoxeUJETFFfSkdCeS4DA21GTAIcLyobSkQBwUdLGyovHAJLQwHtRkwCHC8qG0pEAcFHSxsqLxwCS0MBAAAAAAEAmACBA/YEwgATAAABMxUhByEVIQcnNyM1ITchNSE3FwM6vP7TfAGp/eh+ZFq+AS18/lcCGoNkA9bK38njQaLJ38rsQQAA//8AqgAVBBYErwBnAB4AkgDQQAA5mgAHAYYADP2oAAD//wCgABMEAATDAGcAIAAgAORAADmaAAcBhgAI/aYAAAACACQAAAP5BbAABQAPAAABMwkBIwEhAycjBwMTFzM3AaTSAYP+gNP+fgLZ3BQDFNfdEwMUBbD9J/0pAtcB30FB/iH+IkBAAP//ALMAtgGlBPAAJwAQABoAtgAHABAAGgQHAAAAAgBjAn8CPgQ5AAMABwAAASMRMwEjETMBAJ2dAT6dnQJ/Abr+RgG6AAEARf83AVoBBgAJAAAlFAYHJz4BPQEzAVpQRYAmJsmbYMNBTj9/UHMAAAAAAgAYAAAEFwYtABcAGwAAMxEjNTM1NDYzMhYXBy4BIyIGHQEzFSMRISMRM72lpeLTSopeJT92R3Bj1dUCZ/PzA4a0XMfQHh7JFhpfY1y0/HoEOgAAFgBZ/nIH7AWuAA0AHQArADsAQQBHAE0AUwBdAGEAZQBpAG0AcQB1AH4AggCGAIoAjgCSAJYAAAE0JiMiBh0BFBYzMjY1BTI2NTQmJzU+ATU0JisBEScUBiMiJj0BNDYzMhYVBRQGIyImNSMUFjMyNjURIwERMxUzFSE1MzUzEQERIRUjFSU1IREjNQEzHgEVFAYrATUBNSEVITUhFSE1IRUBNSEVITUhFSE1IRUTMzIWFRQGKwEFIzUzNSM1MxEjNTMlIzUzNSM1MxEjNTMDN39oaH5+amh9ASBeZzQtJSptZ7yfSEFDSUhCQUoDujYpMzVdaF1TaFz5xHHEBSjHb/htATXEBewBNm/82gUwMjQzfgFOARb9WwEV/VwBFAIKARb9WwEV/VwBFLxdPjg6PF388XFxcXFxcQcib29vb29vAkRieXlicGR3d2TYTk0uRA0DDjwoTEr929hHTExHcEVOTkWbLDYsL1NRW1ABevtPATvKcXHK/sUGHwEddKmpdP7jqfy2Ai0nKSqpA0p0dHR0dHT5OHFxcXFxcQRbHygpJ5b8fvr8Ffl+/H76/BX5AAAAAAUAXP3VB9cIYgADAB0AIQAlACkAAAkDBTQ2Nz4BNTQmIyIGBzM+ATMyFhUUBgcOARUXIxUzAzMVIwMzFSMEGAO//EH8RAQPGSlJXaaWi6UCywE6LDc6MitQOsrKyksEBAIEBAZS/DH8MQPP8TY7GyiAUIOUgYk0Mz42Mk0cOVZaW6r9TAQKjQQAAAAAAQBN/+8DygSNAB4AABsBIRUhAz4BNzYWFRQGIyImNTcUFjMyNjU0JiMiBgd8RwLJ/gwdJmo7usrY58L88m9daWNlXFlYFAH4ApXG/vMWIAIDx7u1z6KnEEZTamBday4oAAAAAAIATQAAAyUDIQAKAA8AAAEzFSMVIzUhJwEzATMRIwcCs3Jyv/5jCgGmwP5g4QMPASKRkZF0Ahz+AQEbGAAAAAACAGz/6wQnBcUADQAbAAABEAIjIgIZARASMzISESc0JiMiBhURFBYzMjY1BCf74eH+/OHh/fN2dXV1dnZ1dAIx/t7+3AElASEBTQEhASb+2v7fJbapqbb+a7ipqLkAAAAB/5/+xQLtA0IADwAAAzMgABEQAiEnMjY1LgErAWH0ASABOvn+/AGYcwGwtvQDQv7V/uT++/7Pusqrw8EAAAAAAf+w/ksBjgDNAA8AACURFAYjIiYnNx4BMzI2NREBjrepJTghDhE5FzxAzf70t78ICcYFB1ZVAQwAAAAAAQAY/l8B0wBCABMAACUeARUUBiMiJic3HgEzMjY1NCYnAQ9lX4lsQ1wnIx0vITouOjhCNYtNZ28ZE44KDS0jME0xAAABAFz+mgFPALYAAwAAASMRMwFP8/P+mgIcAAAAAgB1BNAC9wbcAA0AIQAAARQGIyImNTMUFjMyNjUTFAYjIiYjIgYVJzQ2MzIWMzI2NQL3rJWWq69ETkxGkF5IOYEpICloXUktiyseLAWwZ3l6ZjI9PTIBD01pRzIlG0tuRzElAAIAdQTVAvYHCAANAB0AAAEUBiMiJjUjFBYzMjY1JSc+ATU0JiM3MhYVFAYPAQJIR0tNR62ql5Wr/nMIST5NRQecoVJAAQWwMTw8MWV2dmUZdgIWGx0ZYE5GNTUHOgAAAAIAdQTTAwAGfgANABEAAAEUBiMiJjUzFBYzMjY1JzMHIwMAr5aZrbFGT0xHZbapgAWwZXh4ZTI+PjLOwAAAAAACAHkE5wNYBtEACAAcAAABByMnByMnJTM3FAYjIiYjIgYVJzQ2MzIWMzI2NQNYAbyzsrwBASaTulc/M3glHChaVEEogiUbKwTqA46OA+rfP15CLBsYP2FBLRwAAAIAdQTnBAoGywAGABYAAAEjBTM3FzMvAT4BNTQmIzcyFhUUBg8BAka7/urBsrPBXQdBNkQ9B4iNSTgBBeH6oqKGfQQZHSEdaVdNOz0HOwAAAv9MBNoDXAaDAAYACgAAASMnByMlMwUjAzMDXNWfn9QBI6H+h53X3QTajo76XAELAAAAAAIAegTnBIsGkAAGAAoAAAEzBSMnByMBMwMjAZ2hASPUn5/VAzPe2J0F4fqOjgGp/vUAAAACAFsElQMVBpgADQARAAABFAYjIiY1MxQWMzI2NScjJzMDFbuio7q1UFhWUDq/0vsFsIKZmYI7SUk7FdMAAAAAAQCQBGkBhQYMAAUAABM3MwMVI5B3fhvaBQ3//veaAAACABwAAASsBI0ABwAKAAAlIQcjATMBIwEhAwNX/hlW/gHM+AHM/v4KAVes6ekEjftzAasBzQAAAAMAjgAABC4EjQAPABgAIQAAMxEhMhYVFAYHFR4BFRQGIwERITI2NTQmIyUzMjY1NCYrAY4BrdvrYFpxdtzS/wABAGJZWmH/ALtqaWVuuwSNnqNUgCADGo5jpqQB+v7GS01PU6hISE4+AAAAAAEAaP/vBDIEnQAbAAABDgEjIgA9ATQAMzIWFyMuASMiBh0BFBYzMjY3BDEP+NXb/u4BEtvZ9BDzEG1tc4iJcnFoEAGU1NEBFOS+4wEV0dJ3a62Jv4quaXwAAAAAAgCOAAAEQgSNAAkAEwAAMxEhMgAdARQAIwMRMzI2PQE0JiOOAbfeAR/+4d7FxXSWlnQEjf741tLX/voDzPz0oH3Te6EAAAAAAQCOAAADzgSNAAsAAAEhESEVIREhFSERIQN4/ggCTvzAA0D9sgH4Afz+xMAEjcH+8gAAAAEAjgAAA9oEjQAJAAABIREjESEVIREhA4P9/fIDTP2mAgMB3v4iBI3B/tQAAQBo/+8EXwSdAB8AACUOASMiAD0BNAAzMhYXIy4BIyIGHQEUFjMyNjc1IzUhBF8577/v/t8BH+nh7hPyDnNvf5eYhmJ0H+8B4Z9IaAEF2fPXAQbCtF1Ynn30gJ4fF9SxAAAAAAEAjgAABHoEjQALAAAhIxEhESMRMxEhETMEevT9+vLyAgb0Adj+KASN/g0B8wAAAAEAjgAAAYAEjQADAAAhIxEzAYDy8gSNAAEALv/uA4wEjQAPAAABMxEUBiMiJjUzFBYzMjY1Apry6b3P6fNpXE9lBI385bXPubpbWGpaAAAAAQCOAAAEXQSNAAwAAAEjESMRMxEzASEJASEB62vy8lUBQQEt/mQBtv7LAdX+KwSN/iAB4P3V/Z4AAAAAAQCOAAADeQSNAAUAACUhFSERMwGAAfn9FfLAwASNAAABAI4AAAVuBI0ADgAACQEhESMRIwEjASMRIxEhAv4BQAEw8wP+2KX+2APyATIBKwNi+3MC/v0CAwH8/wSNAAAAAQCOAAAEhQSNAAsAACEjAQcRIxEzATcRMwSF8v3wA/LyAhAD8gMeAfzjBI385AEDGwAAAAIAZv/uBGQEnQANABsAAAEUACMiAD0BNAAzMgAVJzQmIyIGHQEUFjMyNjUEZP7p6Of+6AEW6OcBGfOOf4CLjX9/jQHn5f7sARTlvuQBFP7s5AGPp6ePv5GoqJEAAgBo/38ElASdABMAIQAAARQGBxcHJw4BIyIAPQE0ADMyABUnNCYjIgYdARQWMzI2NQRmODacoaE3c0Hn/ugBFujnARnzjn+AjI2Af40B52OlQZ2CoBkYARTlvuQBFP7s5AGPp6aQv5GoqJEAAgCOAAAESQSNABsAJAAAAREjESEyFhUUBgcVHgEdARQWFxUjLgE9ATQmIyczMjY1NCYrAQGA8gHO1uphYGxcERX6FQpgYPDcaWRlaNwBvf5DBI22pl6CKQMejWtWLGYXEBZsOFRWWcJUT05cAAAAAAEAT//uBBkEnQAlAAABNCYnLgE1NDYzMhYVIzQmIyIGFRQWFx4BFRQEIyIkNTMeATMyNgMnbJPlyfLV2u/yam1uZ2Sj28v/AN/d/vLyAYlvd3YBOz5NITSWoJa2v69RXEw+QUgkM5uanrG4uV9STQABADwAAAPpBI0ABwAAASERIxEhNSED6f6g8/6mA60DzPw0A8zBAAAAAQB+/+4EewSNABEAAAERFAQjIiQ1ETMRFBYzMjY1EQR7/uvp6f7q8o5/f40Ejf0KzN3dzAL2/Qpyd3dyAvYAAAEAHAAABIsEjQAJAAABFzM3ASEBIwEhAkARAxEBJQEB/kP3/kUBAQE1R0QDW/tzBI0AAAABADQAAAXXBI0ADwAAATMTIQEjAyMDIwEhEzMTMwQ4A5sBAf7j580DzOf+5AEAnAPK0gFZAzT7cwMM/PQEjfzJAzcAAAEALAAABFEEjQALAAABEyEJASELASEJASECPPEBG/6KAX/+5/n4/uUBgP6JARkC+AGV/b/9tAGd/mMCTAJBAAABABMAAAQ8BI0ACAAACQEhAREjEQEhAigBCQEL/mLz/mgBCwJvAh79Cv5pAaIC6wABAEoAAAPrBI0ACQAAJSEVITUBITUhFQF+Am38XwJZ/cgDcMDAegNSwXUAAAIAbf/vBBMEnQANABsAAAEUBiMiJjURNDYzMhYVJzQmIyIGFREUFjMyNjUEE/3V1v781tX/83dqaXZ3aml2AZvI5OTIAVfH5OTHAWx9fmv+qG5+fW8AAAABAD4AAAHzBJ0ABQAAISMRIzUlAfPzwgG1A6e6PAAAAAEAUgAAA5IEnQAYAAApATUBPgE1NCYjIgYVIzQ2MzIWFRQGDwEhA5L80QGeVkNMTlph8+bIvc6DntMB+8ABg1FrOEZfZE6j0LmteKuNxwAAAQBN/+8DuwSdACgAAAEyNjU0JiMiBhUjNDYzMhYVFAYHHgEVFAYjIiY1MxQWMzI2NTQmKwE1AgZcVFxaTmLy6LPL5F5WYmX2zLP58WpYXWtfY7kCq09LQFdMPpmyqaNSgicjh2Wls6ytQVhdRVpPsQAAAAACADkAAAQYBI0ACgAPAAABMxUjFSM1IScBMwEhEScHA3Gnp/L9xQsCQ/X9yQFFAwIBm8PY2J8DFv0OAboBBAAAAQBRAAAENAXFABgAACkBNQE+ATU0JiMiBhUjNAAzMhYVFAYHASEENPw5Adp2VnBjgnrzAQXq1vCKl/63ApinAgWCn09kgo2BygEH5L+A3qb+pAAAAgBt/+8D8ASdABoAJwAAATIWFwcuASMiBh0BPgEzMhYVFAYjIiY1ETQkEyIGBxUUFjMyNjU0JgJcSotDJzltSHKNModVvcX1zMX9ARexT2sbeV5ba2AEnRoYuhcUi3VWMTTCsrLW+MoBKc71/ZIyLh5wkm5UW2MAAQA8AAADZgSNAAwAAAEGAhEVIzUQEjchNSEDZriW8+OE/bADKgPM5f7e/vS5uQEHAYqCwQAAAAADAFL/7wPnBJ0AFwAjAC8AAAEUBgceARUUBiMiJDU0NjcuATU0NjMyFgM0JiMiBhUUFjMyNgM0JiMiBhUUFjMyNgPEZFlpd/3Fzf76em1eZvC/t+nQeVdgf39hWHcjZElSa21RSWMDXFeCJymMX6W0tKVfjCkngVicpaX9XUlcXElLW1sCREBOTEJBUVEAAAACAD//7wO1BJ0AGgAnAAAlMjY9AQ4BIyImNTQ2MzIWFREUBCMiJic3HgETMjY3NTQmIyIGFRQWAeFify1xQsjb98nA9v79ykiaRyY+c2JKZRt0WllqZa9/YVoqKs20qd75yv62u+YaGLgXEwGUNCpAbY57UFtzAAABAFcAAAGWAywABQAAISMRIzUlAZbAfwE/An+WFwAAAAEAawAAAtUDLAAYAAApATUBPgE1NCYjIgYVIzQ2MzIWFRQGDwEhAtX9oQExQiYyNz4/vqqUjphfeogBZ5EBADdEKi03OzFtkYB3U3JrdAAAAQBg//UC6wMsACgAAAEyNjU0JiMiBhUjNDYzMhYVFAYHHgEVFAYjIiY1MxQWMzI2NTQmKwE1AaFCPEA/Nj6/q4WYqUY+R0qxmIq4v0Q+QkpFR3sB2TQxKDQsImh4dXA4WRoYXkVyenh3LDIzLjk2gwAAAAABADgAAAJGBbAABQAAISMRITUlAkbz/uUCDgSgpmoAAAEAaP/1AwEDIQAeAAAbASEVIQc+ATc2FhUUBiMiJjU3FBYzMjY1NCYjIgYHiTQCFP6VFRxMLIeVoayRu75NQUpERj0+Pw8BWgHHkqoRFgECi4CAj290DC0xPjw/SR4ZAAIAcP/1AwoDLAAaACcAAAEyFhcHLgEjIgYdAT4BMzIWFRQGIyImPQE0NhMiBgcVFBYzMjY1NCYB4DdnLiApTzJRYiViP4iNtpeTus6DNkoSUkBCSUQDLBIRjQ8PWE0zICKHeXuUqo3Ij6n+Sx8cEEtbQTc6PwAAAAEAUgAAAqQDIQAMAAABDgEdASM1NBI3ITUhAqSHaL+aWf5pAlICj6C7tX9/tAELUZIAAAADAGj/9QMOAywAFwAjAC8AAAEUBgceARUUBiMiJjU0NjcuATU0NjMyFgM0JiMiBhUUFjMyNgM0JiMiBhUUFjMyNgL2SUBLVrqSmMJYT0RLs46IraZTPENYWEQ9URpDMjlISjgxQwJQO1obHWFAcnt7ckBhHRtaO2txcf4wMDs7MC82NgGIKC4tKSoyMgAAAAACAGD/9QLwAywAGgAnAAAlMjY9AQ4BIyImNTQ2MzIWHQEUBiMiJic3HgETMjY3NTQmIyIGFRQWAZVEWCBRLZOgs5KRusOYNW40ICtTSzVGD1E+PUdFhk5AOyAfkH91mK2M3oKeERGOEQ4BESUeGUpdSzU7SAAAAAACAHD/9QMkAywADQAbAAABFAYjIiY9ATQ2MzIWFSc0JiMiBh0BFBYzMjY1AyS7n5+7up+evb9SSkpQUEtJUgEnkKKikNGPpaWPAktVVUvTTlNTTgABAJcChwMmAzEAAwAAASE1IQMm/XECjwKHqgAAAwCWBEgCngaVAAQAEAAcAAABMxcHIwc0NjMyFhUUBiMiJjcUFjMyNjU0JiMiBgG84QHxlYJrUU5qaU9Ra2MzJiQwMCQmMwaVA7/eTWVkTk1gYE0mMDAmJzMzAAACAGwEbwLMBdcABQAPAAABEzMVAyMlNDY3Fw4BHQEjAYpv0+Zc/uJbVVAqJbEEhQFAFf7BVlqKLEgpYURSAAAAAQBP/+sEFgXFACgAAAEzMjY1NCYjIgYVIzQkMzIWFRQGBx4BFRQEIyIkNTMUFjMyNjU0JisBAYapeWVub2V78wECztn6b2x/cv7x2s7+8POAbnOAdX+pA0ZzbWtxb16v4dTLX6sxLbB2zOHUx2N2eHJ+cgACADgAAARZBbAACgAPAAABMxUjESMRIScBMwEhEScHA6G4uPL9jwYCb/r9hwGHAxcCB8T+vQFDlQPY/FcCVgExAAAAAAEAgf/rBCYFsAAeAAAbASEVIQM+ATc2EhUUAiMiJDU3FBYzMjY1NCYjIgYHnFQDAf3JLCxvSNHk8OvE/vrremVzdXhzZl4XAosDJdL+kyApAgP+/Ora/vTRyQhsdJ2FhqM/PwACAHT/6wRGBcUAGgAnAAABMhYXBy4BIyIGHQE+ATMyEhUUAiMiABkBEAATIgYHFRQWMzI2NTQmAqhQjTouOWdIlK89nWDH3//Y4v7nATy0XX4jkndtd34FxSAcvBgb3cMHODv+89fk/ucBMgEeARYBIgFS/UpAOWi9xLOIhaIAAAMACv5KBBsETgAvAD8ATQAAASMeAR0BFAYjIiYnDgEVFBY7ATIWFRQEIyImNTQ2Ny4BNTQ2Ny4BPQE0NjMyFhchASImJw4BFRQWMzI2NTQmIwEUFjMyNj0BNCYjIgYVBBuKHB73yipJIxITQj2xxc3+1vno/GNTGRk/Nlxi9s0rTicBcf2GGCoUJy59fZCiUGX+zHNgXXJzXl9yA6AqXzUWnc8IChEoGSsilJWF2552WXwpFzwnQ18mMZxhFqPJCgr73gMEFUYwPlFiPDo7ArRJaGhJFktlZUsAAAABADIAAAP3BbAADAAAAQoBAwcjNxoBNyE1IQP3+KQnD/MPJ9zH/ScDxQTt/tP+NP6mmpoBUgIO88MAAAABAD7+TQREBEoAIwAAEzIWHwETMwETHgEXOgE3Bw4BJy4BLwEDIwEDLgEjIgYHJz4BwYxzPVvh9f6fxRo9KxARDwcTNhdxeT9l+PgBfKccWTwMKA8CH0IESoqGzgHO/Sj+QT1EBQLGBgYBBZST5v4AAwwBgEVRBAG6CAsAAwBh/+sEKgXFABcAIwAvAAABFAYHHgEVFAQjIiQ1NDY3LgE1NDYzMhYDNCYjIgYVFBYzMjYDNCYjIgYVFBYzMjYEBXVqeor++dzf/vmIfGp08c3L9c2HbG6DgnFthCZwXV9sbWBdbgQwcaYuL7V6z9PTz3u0MC2mccbPz/yjbYSDbnB8fQL9Ynl1ZmV1dQAAAgBW/+sEXwROABQAIgAAJScOASMiAj0BEBIzMhYXPwEzAxMjARQWMzI2NzUuASMiBhUDZAM2qn7O397Reqc3AxvdbHPd/cdxf21vFxFzbX9zvwFpbAEd8RUBCAE4bGcBvv3i/eQB+Zmzt5ovm8PRrAAAAAACAFP/6wQ0BbAAGgArAAABFSEeARcWEh0BFAAjIgA9ATQSNzI2My4BJzUTFBYzMjY9ATQmJy4BIyIGFQPD/lQaZzqvs/787Oz+++bHCQwMgZI3b3qEgnxgSBMjFYmABbDBG1gul/77nxXw/t0BHegVwwEHHAF0iD+J/E6ZuLmYFW6pMAQEupUAAgCfAAAEyAWwAAkAEwAAMxEhIAARFRAAIQMRMzI2PQE0JiOfAZ4BUwE4/sj+rauk57i45wWw/tH+z/H+z/7SBO371cXY89XGAAAAAAIAYP/rA/4ETgAfACoAACEuAScOASMiJjU0NjsBNTQmIyIGFSM0NjMyFhURFBYXJTI2NzUjIgYVFBYDCAkMAzefYqys8+qrX2VjWfPd4dHXDxT98lSDIa96bUcdNRw6SaKiqqR6VEZMQ5S4oLn+BEZ4O647K9FdVUJDAAACAJ8AAAT+BbAADgAXAAABFAYHARUhASERIxEhMgQBITI2NTQmIyEEqn93AUr+9f7d/sLzAg34AQb86AEbhoSCif7mBAaGwDX9iBMCS/21BbDa/jh7dXB/AAAAAAEAnwAABS8FsAAMAAABBxEjETMRNwEhCQEhAieV8/OSAasBIP3eAmL+zAKApf4lBbD9X6sB9v2J/McAAAEAgQAABDwGGAANAAABBxEjETMRFzcBIQkBIQHgbfLyA1ABLQEe/m0Bvv7mAc9z/qQGGPxxAWEBUf5A/YYAAAABAJ8AAAURBbAACwAAAREjETMRMwEhCQEhAZLz8wcCJgEt/ZsCiv7TAp/9YQWw/X8Cgf02/RoAAAEAgQAABCIGGAAMAAABBxEjETMRFwEhCQEhAXYD8vIDAVYBKv5QAdz+2wHnAf4aBhj8iAEBm/4M/boAAAIAUv/rBBcFxQAbACgAACUyNj0BJw4BIyICNTQAMzIAGQEQACMiJic3HgETMjY3NTQmIyIGFRQWAgOFnQMwilXV7AEKy+cBCf7c8EyeRCBAfXhdfSGAemSCdq29vSMBQUIBBPHmASL+3P7k/qv+5v7VHh64GxcB2EY7nLGvt46SpgAAAAIAjgAABEAEjQAKABMAAAERIxEhMhYVFAYjJzMyNjU0JisBAYDyAePY9/fY8fFscHBs8QGG/noEjdaur9TCblFTcgD//wB1BJUC+wWwAgYAnAAA//8AAAAAAAAAAAIGAAMAAP//AEcCCQJUAs0CBgAPAAAAAgAkAAAFDAWwAA0AGwAAMxEjNTMRISAAERUQACETIREzMjY9ATQmKwERIb2ZmQHKASoBW/6i/sw5/v3D2c3Kz9ABAwKRqgJ1/qb+4sH+4P6pApH+MerLw83m/k4AAAAAAgAkAAAFDAWwAA0AGwAAMxEjNTMRISAAERUQACETIREzMjY9ATQmKwERIb2ZmQHKASoBW/6i/sw5/v3D2c3Kz9ABAwKRqgJ1/qb+4sH+4P6pApH+MerLw83m/k4AAAAAAf/9AAAEKgYYABwAAAEjERc+ATMyFhURIxE0JiMiBgcRIxEjNTM1MxUzAoz+AzWXYLC982RoSW4m856e8/4Ex/7sAUtR1Of9bQKVgnA6NfzoBMeqp6cAAAEANQAABLUFsAAPAAABIxEjESM1MxEhNSEVIREzA73P883N/joEgP45zwMS/O4DEqoBMcPD/s8AAf/n/+wCdgVBAB8AAAERMxUjFTMVIxEUFjMyNjcXDgEjIiY1ESM1MzUjNTMRAaHDw9XVMSsZLBQaIV4xg4/Hx5WVBUH++bSlqv75RTYHBrIQFJmrAQeqpbQBB///ABoAAAUoByICJgAjAAAABwBCAPwBXP//ABoAAAUoByECJgAjAAAABwBzAbMBW///ABoAAAUoB0cCJgAjAAAABwCaALcBWf//ABoAAAUoB2MCJgAjAAAABwCgALkBbP//ABoAAAUoBw0CJgAjAAAABwBoAJMBXf//ABoAAAUoB48CJgAjAAAABwCeAUwBs///ABoAAAUoB70CJgAjAAAABwHUAVIBKP//AHT+PATYBcUCJgAlAAAABwB3Acb/+///AJ8AAAR1ByICJgAnAAAABwBCAMQBXP//AJ8AAAR1ByECJgAnAAAABwBzAXsBW///AJ8AAAR1B0cCJgAnAAAABwCaAH8BWf//AJ8AAAR1Bw0CJgAnAAAABwBoAFsBXf///8wAAAGgByICJgArAAAABwBC/4IBXP//AK0AAAKEByECJgArAAAABwBzADgBW////9gAAAJ5B0cCJgArAAAABwCa/z0BWf///70AAAKSBw0CJgArAAAABwBo/xkBXf//AJ8AAAUQB2MCJgAwAAAABwCgAO4BbP//AHT/6wUbBzcCJgAxAAAABwBCASMBcf//AHT/6wUbBzYCJgAxAAAABwBzAdoBcP//AHT/6wUbB1wCJgAxAAAABwCaAN4Bbv//AHT/6wUbB3gCJgAxAAAABwCgAOABgf//AHT/6wUbByICJgAxAAAABwBoALoBcv//AIb/6wTxByICJgA3AAAABwBCARcBXP//AIb/6wTxByECJgA3AAAABwBzAc4BW///AIb/6wTxB0cCJgA3AAAABwCaANIBWf//AIb/6wTxBw0CJgA3AAAABwBoAK4BXf//ABMAAATvByECJgA7AAAABwBzAZYBW///AF7/7AQBBeACJgBDAAAABwBCAIEAGv//AF7/7AQBBd8CJgBDAAAABwBzATgAGf//AF7/7AQBBgUCJgBDAAAABgCaPBcAAP//AF7/7AQBBiECJgBDAAAABgCgPioAAP//AF7/7AQBBcsCJgBDAAAABgBoGBsAAP//AF7/7AQBBk0CJgBDAAAABwCeANEAcf//AF7/7AQBBnwCJgBDAAAABwHUANf/5///AFH+PAP3BE4CJgBFAAAABwB3AT7/+///AFn/7AP4BeECJgBHAAAABwBCAIMAG///AFn/7AP4BeACJgBHAAAABwBzAToAGv//AFn/7AP4BgYCJgBHAAAABgCaPhgAAP//AFn/7AP4BcwCJgBHAAAABgBoGhwAAP///68AAAGCBcsCJgCKAAAABwBC/2UABf//AI8AAAJnBcoCJgCKAAAABgBzGwQAAP///7sAAAJcBfACJgCKAAAABwCa/yAAAv///6AAAAJ1BbYCJgCKAAAABwBo/vwABv//AH4AAAQLBiECJgBQAAAABgCgWSoAAP//AFP/7AQ0BeACJgBRAAAABwBCAJ4AGv//AFP/7AQ0Bd8CJgBRAAAABwBzAVUAGf//AFP/7AQ0BgUCJgBRAAAABgCaWRcAAP//AFP/7AQ0BiECJgBRAAAABgCgWyoAAP//AFP/7AQ0BcsCJgBRAAAABgBoNRsAAP//AHv/7AQKBcsCJgBXAAAABwBCAJ0ABf//AHv/7AQKBcoCJgBXAAAABwBzAVQABP//AHv/7AQKBfACJgBXAAAABgCaWAIAAP//AHv/7AQKBbYCJgBXAAAABgBoNAYAAP//ABD+SwP8BcoCJgBbAAAABwBzARgABP//ABD+SwP8BbYCJgBbAAAABgBo+QYAAP//ABoAAAUoBvYCJgAjAAAABwBuALIBRv//AF7/7AQBBbQCJgBDAAAABgBuNwQAAP//ABoAAAUoB1wCJgAjAAAABwCcAOoBrP//AF7/7AQBBhoCJgBDAAAABgCcb2oAAAACABr+UgUoBbAAGgAeAAAJASMOARUUFjMyNjcXDgEjIiY1NDY3AyEDIwEDIQMjAxgCEERQUSAnGioWFSFNN151UVlx/c949wIXZQGs1AMFsPpQM1w4ISMNCo4TGWlgRno1AUz+pAWw/G8CawACAF7+UgQBBE4AMwA+AAAhLgEnDgEjIiY1NDY7ATU0JiMiBhUjNDYzMhYVERQWFyMOARUUFjMyNjcXDgEjIiY1NDY3JTI2NzUjIgYVFBYDCwsPBDecYqez9OWxZGBYZPP1ycHnERUiUFEgJxoqFhUhTTdedUVM/uBUhSK1bXVOIkQkRlirmqCsX1ZfT0CIxL23/h9FeDwzXDghIw0KjhMZaWBBcTOvSDa4Z0k/RwAA//8AdP/rBNgHNgImACUAAAAHAHMBvwFw//8AUf/sA/cF3wImAEUAAAAHAHMBKAAZ//8AdP/rBNgHXAImACUAAAAHAJoAwwFu//8AUf/sA/cGBQImAEUAAAAGAJosFwAA//8AdP/rBNgHNgImACUAAAAHAJ0BkAGA//8AUf/sA/cF3wImAEUAAAAHAJ0A+QAp//8AdP/rBNgHYwImACUAAAAHAJsA2gFy//8AUf/sA/cGDAImAEUAAAAGAJtDGwAA//8AnwAABO4HTgImACYAAAAHAJsAjQFd//8AU//sBVcGGAAmAEYAAAAHAZED/QUS//8AnwAABHUG9gImACcAAAAHAG4AegFG//8AWf/sA/gFtQImAEcAAAAGAG45BQAA//8AnwAABHUHXAImACcAAAAHAJwAsgGs//8AWf/sA/gGGwImAEcAAAAGAJxxawAA//8AnwAABHUHIQImACcAAAAHAJ0BTAFr//8AWf/sA/gF4AImAEcAAAAHAJ0BCwAqAAEAn/5SBHUFsAAgAAABIREhFSMOARUUFjMyNjcXDgEjIiY1NDY3JyERIRUhESEED/2DAuNAUFEgJxoqFhUhTTdedURJAf1BA8/9JAJ9Ao/+M8IzXDghIw0KjhMZaWBAcTEDBbDD/mUAAgBZ/mAD+ARPACkAMQAAJQ4BBzMOARUUFjMyNjcXDgEjIiY1NDY3JgA9ATQAFzISHQEhHgEzMjY3ASIGByE1NCYD1R5OMgFQUSAnGioWFSFNN151MDXh/wABC9Dg5P1WCol+ZIlC/qZbdBIBtGdkGiwQM1w4ISMNCo4TGWlgNmEtCAEk6yjxATIB/vvjj4eiLy0CgY11GWmAAAD//wCfAAAEdQdOAiYAJwAAAAcAmwCWAV3//wBZ/+wD+AYNAiYARwAAAAYAm1UcAAD//wB0/+sE4gdcAiYAKQAAAAcAmgC6AW7//wBU/kwECAYFAiYASQAAAAYAmkYXAAD//wB0/+sE4gdxAiYAKQAAAAcAnADtAcH//wBU/kwECAYaAiYASQAAAAYAnHlqAAD//wB0/+sE4gc2AiYAKQAAAAcAnQGHAYD//wBU/kwECAXfAiYASQAAAAcAnQETACn//wB0/eIE4gXFAiYAKQAAAAcBkQG2/qv//wBU/kwECAaKAiYASQAAAAcBpQEtAH7//wCfAAAFEAdHAiYAKgAAAAcAmgDoAVn//wB9AAAEDAdiAiYASgAAAAcAmgAbAXT///+/AAACkAdjAiYAKwAAAAcAoP8/AWz///+iAAACcwYMAiYAigAAAAcAoP8iABX///+/AAAClgb2AiYAKwAAAAcAbv84AUb///+iAAACeQWgAiYAigAAAAcAbv8b//D////lAAACawdcAiYAKwAAAAcAnP9wAaz////IAAACTgYFAiYAigAAAAcAnP9TAFX//wAc/lwBoAWwAiYAKwAAAAYAn/MKAAD////+/lIBgwYYAiYASwAAAAYAn9UAAAD//wCjAAABpgchAiYAKwAAAAcAnQAJAWv//wCt/+sGMwWwACYAKwAAAAcALAJNAAD//wCQ/ksDoQYYACYASwAAAAcATAITAAD//wA6/+sEsgc/AiYALAAAAAcAmgF2AVH///+1/ksCZAXjAiYAmAAAAAcAmv8o//X//wCf/fAFLwWwAiYALQAAAAcBkQGK/rn//wCB/fIENQYYAiYATQAAAAcBkQEv/rv//wCfAAAELwb4AiYALgAAAAcAcwAqATL//wCQAAACZwdfAiYATgAAAAcAcwAbAZn//wCf/fIELwWwAiYALgAAAAcBkQF1/rv//wBY/fIBgwYYAiYATgAAAAcBkQAT/rv//wCfAAAELwWyAiYALgAAAAcBkQIEBKz//wCQAAAC6AYYACYATgAAAAcBkQGOBRL//wCfAAAELwWwAiYALgAAAAcAnQG7/dT//wCQAAAC9wYYACYATgAAAAcAnQFa/a///wCfAAAFEAchAiYAMAAAAAcAcwHoAVv//wB+AAAECwXfAiYAUAAAAAcAcwFTABn//wCf/fIFEAWwAiYAMAAAAAcBkQHg/rv//wB+/fIECwROAiYAUAAAAAcBkQFL/rv//wCfAAAFEAdOAiYAMAAAAAcAmwEDAV3//wB+AAAECwYMAiYAUAAAAAYAm24bAAD////VAAAECwYYAiYAUAAAAAcBkf+QBRL//wB0/+sFGwcLAiYAMQAAAAcAbgDZAVv//wBT/+wENAW0AiYAUQAAAAYAblQEAAD//wB0/+sFGwdxAiYAMQAAAAcAnAERAcH//wBT/+wENAYaAiYAUQAAAAcAnACMAGr//wB0/+sFGwdgAiYAMQAAAAcAoQFDAXL//wBT/+wEWQYJAiYAUQAAAAcAoQC+ABv//wCfAAAE8AchAiYANAAAAAcAcwGDAVv//wCAAAAC+gXfAiYAVAAAAAcAcwCuABn//wCf/fIE8AWwAiYANAAAAAcBkQF7/rv//wBW/fICwwROAiYAVAAAAAcBkQAR/rv//wCfAAAE8AdOAiYANAAAAAcAmwCeAV3//wBDAAAC9wYMAiYAVAAAAAYAm8obAAD//wBT/+sEoAc2AiYANQAAAAcAcwGBAXD//wBR/+wDzwXfAiYAVQAAAAcAcwEiABn//wBT/+sEoAdcAiYANQAAAAcAmgCFAW7//wBR/+wDzwYFAiYAVQAAAAYAmiYXAAD//wBT/jgEoAXFAiYANQAAAAcAdwGW//f//wBR/jgDzwROAiYAVQAAAAcAdwEv//f//wBT/d4EoAXFAiYANQAAAAcBkQGB/qf//wBR/d4DzwROAiYAVQAAAAcBkQEa/qf//wBT/+sEoAdjAiYANQAAAAcAmwCcAXL//wBR/+wDzwYMAiYAVQAAAAYAmz0bAAD//wA1/fIEtQWwAiYANgAAAAcBkQGB/rv//wAZ/egCcAVBAiYAVgAAAAcBkQC5/rH//wA1/ksEtQWwAiYANgAAAAcAdwGWAAr//wAZ/kEClwVBAiYAVgAAAAcAdwDOAAD//wA1AAAEtQdOAiYANgAAAAcAmwCkAV3//wAZ/+wDLwY2ACYAVgAAAAcBkQHVBTD//wCG/+sE8QdjAiYANwAAAAcAoADUAWz//wB7/+wECgYMAiYAVwAAAAYAoFoVAAD//wCG/+sE8Qb2AiYANwAAAAcAbgDNAUb//wB7/+wECgWgAiYAVwAAAAYAblPwAAD//wCG/+sE8QdcAiYANwAAAAcAnAEFAaz//wB7/+wECgYFAiYAVwAAAAcAnACLAFX//wCG/+sE8QePAiYANwAAAAcAngFnAbP//wB7/+wECgY4AiYAVwAAAAcAngDtAFz//wCG/+sE8QdLAiYANwAAAAcAoQE3AV3//wB7/+wEWAX0AiYAVwAAAAcAoQC9AAYAAQCG/nkE8QWwACcAAAERFAYHDgEVFBYzMjY3Fw4BIyImNTQ2NyIGIyIkNREzERQWMzI2NREE8YyBUFEgJxoqFhUhTTdedSMnBA4D//7P86mUma8FsPwwo9o8M1w4ISMNCo4TGWlgLlQoAf/2A9D8MJyXl5wD0AAAAQB7/lIEEAQ6ACcAACEOARUUFjMyNjcXDgEjIiY1NDY3LwEOASMiJjURMxEUFjMyNjcRMxED+1BRICcaKhYVIU03XnVJUA8CNJhnssDyWl9ZdSPzM1w4ISMNCo4TGWlgQnUziwFRVNjvAof9d5FuPjwDDvvGAAD//wBEAAAGuwdHAiYAOQAAAAcAmgGVAVn//wAlAAAF0AXwAiYAWQAAAAcAmgERAAL//wATAAAE7wdHAiYAOwAAAAcAmgCaAVn//wAQ/ksD/AXwAiYAWwAAAAYAmhwCAAD//wATAAAE7wcNAiYAOwAAAAcAaAB2AV3//wBYAAAEcQciAiYAPAAAAAcAcwFvAVz//wBVAAADxAXKAiYAXAAAAAcAcwEeAAT//wBYAAAEcQciAiYAPAAAAAcAnQFAAWz//wBVAAADxAXKAiYAXAAAAAcAnQDvABT//wBYAAAEcQdPAiYAPAAAAAcAmwCKAV7//wBVAAADxAX3AiYAXAAAAAYAmzkGAAD////2AAAHVwchAiYAfwAAAAcAcwK4AVv//wA0/+sGhAXgAiYAhAAAAAcAcwJuABr//wBp/6EFEAdfAiYAgQAAAAcAcwHSAZn//wBT/3YENAXcAiYAhwAAAAcAcwEuABb////qAAAEQgSNAiYBqQAAAAcB0/9T/3f////qAAAEQgSNAiYBqQAAAAcB0/9T/3f//wA8AAAD6QSNAiYBuAAAAAYB0y3eAAD//wAcAAAErAXfAiYBpgAAAAcAQgC6ABn//wAcAAAErAXeAiYBpgAAAAcAcwFxABj//wAcAAAErAYEAiYBpgAAAAYAmnUWAAD//wAcAAAErAYgAiYBpgAAAAYAoHcpAAD//wAcAAAErAXKAiYBpgAAAAYAaFEaAAD//wAcAAAErAZMAiYBpgAAAAcAngEKAHD//wAcAAAErAZ7AiYBpgAAAAcB1AEQ/+b//wBo/j4EMgSdAiYBqAAAAAcAdwFi//3//wCOAAADzgXfAiYBqgAAAAYAQnsZAAD//wCOAAADzgXeAiYBqgAAAAcAcwEyABj//wCOAAADzgYEAiYBqgAAAAYAmjYWAAD//wCOAAADzgXKAiYBqgAAAAYAaBIaAAD///+sAAABgAXfAiYBrgAAAAcAQv9iABn//wCOAAACZAXeAiYBrgAAAAYAcxgYAAD///+4AAACWQYEAiYBrgAAAAcAmv8dABb///+dAAACcgXKAiYBrgAAAAcAaP75ABr//wCOAAAEhQYgAiYBswAAAAcAoACQACn//wBm/+4EZAXwAiYBtAAAAAcAQgCxACr//wBm/+4EZAXvAiYBtAAAAAcAcwFoACn//wBm/+4EZAYVAiYBtAAAAAYAmmwnAAD//wBm/+4EZAYxAiYBtAAAAAYAoG46AAD//wBm/+4EZAXbAiYBtAAAAAYAaEgrAAD//wB+/+4EewXhAiYBuQAAAAcAQgDKABv//wB+/+4EewXgAiYBuQAAAAcAcwGBABr//wB+/+4EewYGAiYBuQAAAAcAmgCFABj//wB+/+4EewXMAiYBuQAAAAYAaGEcAAD//wATAAAEPAXeAiYBvQAAAAcAcwE4ABj//wAcAAAErAWzAiYBpgAAAAYAbnADAAD//wAcAAAErAYZAiYBpgAAAAcAnACoAGkAAgAc/lIErASNABoAHQAAATMBIw4BFRQWMzI2NxcOASMiJjU0NjcnIQcjASEDAej4AcxQUFEgJxoqFhUhTTdedVNbUP4ZVv4BnAFXrASN+3MzXDghIw0KjhMZaWBHezXX6QGrAc0AAP//AGj/7wQyBe4CJgGoAAAABwBzAVoAKP//AGj/7wQyBhQCJgGoAAAABgCaXiYAAP//AGj/7wQyBe4CJgGoAAAABwCdASsAOP//AGj/7wQyBhsCJgGoAAAABgCbdSoAAP//AI4AAARCBgsCJgGpAAAABgCbJRoAAP//AI4AAAPOBbMCJgGqAAAABgBuMQMAAP//AI4AAAPOBhkCJgGqAAAABgCcaWkAAP//AI4AAAPOBd4CJgGqAAAABwCdAQMAKAABAI7+UgPOBI0AIAAAASERIRUjDgEVFBYzMjY3Fw4BIyImNTQ2NychESEVIREhA3j+CAJOQ1BRICcaKhYVIU03XnVESQH92gNA/bIB+AH8/sTAM1w4ISMNCo4TGWlgQHExAwSNwf7y//8AjgAAA84GCwImAaoAAAAGAJtNGgAA//8AaP/vBF8GFAImAawAAAAGAJpuJgAA//8AaP/vBF8GKQImAawAAAAHAJwAoQB5//8AaP/vBF8F7gImAawAAAAHAJ0BOwA4//8AaP3kBF8EnQImAawAAAAHAZEBaf6t//8AjgAABHoGBAImAa0AAAAHAJoAggAW////nwAAAnAGIAImAa4AAAAHAKD/HwAp////nwAAAnYFswImAa4AAAAHAG7/GAAD////xQAAAksGGQImAa4AAAAHAJz/UABp////+f5SAYAEjQImAa4AAAAGAJ/QAAAA//8AhAAAAYcF3gImAa4AAAAGAJ3qKAAA//8ALv/uBF4GAAImAa8AAAAHAJoBIgAS//8Ajv3uBF0EjQImAbAAAAAHAZEBG/63//8AjgAAA3kFywImAbEAAAAGAHMXBQAA//8Ajv3wA3kEjQImAbEAAAAHAZEA7f65//8AjgAAA3kEjwImAbEAAAAHAZEBkAOJ//8AjgAAA3kEjQImAbEAAAAHAJ0BSv0y//8AjgAABIUF3gImAbMAAAAHAHMBigAY//8Ajv3wBIUEjQImAbMAAAAHAZEBgv65//8AjgAABIUGCwImAbMAAAAHAJsApQAa//8AZv/uBGQFxAImAbQAAAAGAG5nFAAA//8AZv/uBGQGKgImAbQAAAAHAJwAnwB6//8AZv/uBGwGGQImAbQAAAAHAKEA0QAr//8AjgAABEkF3gImAbYAAAAHAHMBIQAY//8Ajv3wBEkEjQImAbYAAAAHAZEBGf65//8AjgAABEkGCwImAbYAAAAGAJs8GgAA//8AT//uBBkF8AImAbcAAAAHAHMBPQAq//8AT//uBBkGFgImAbcAAAAGAJpBKAAA//8AT/47BBkEnQImAbcAAAAHAHcBSv/6//8AT//uBBkGHQImAbcAAAAGAJtYLAAA//8APP3wA+kEjQImAbgAAAAHAZEBFv65//8APAAAA+kGCwImAbgAAAAGAJs5GgAA//8Afv/uBHsGIgImAbkAAAAHAKAAhwAr//8Afv/uBHsFtQImAbkAAAAHAG4AgAAF//8Afv/uBHsGGwImAbkAAAAHAJwAuABr//8Afv/uBHsGTgImAbkAAAAHAJ4BGgBy//8Afv/uBIUGCgImAbkAAAAHAKEA6gAcAAEAfv58BHsEjQAmAAABERQGBzMOARUUFjMyNjcXDgEjIiY1NDY3IyIkNREzERQWMzI2NREEe3NsAVBRICcaKhYVIU03XnUjJgbp/uryjn9/jQSN/QqBtjYzXDghIw0KjhMZaWAuVCfdzAL2/Qpyd3dyAvb//wA0AAAF1wYEAiYBuwAAAAcAmgEWABb//wATAAAEPAYEAiYBvQAAAAYAmjwWAAD//wATAAAEPAXKAiYBvQAAAAYAaBgaAAD//wBKAAAD6wXfAiYBvgAAAAcAcwEoABn//wBKAAAD6wXfAiYBvgAAAAcAnQD5ACn//wBKAAAD6wYMAiYBvgAAAAYAm0MbAAD//wBP/+4IiQSdACYBtwAAAAcBtwRwAAD//wAaAAAFKAZwAiYAIwAAAAYAqeUAAAD///+vAAAE2QZyACYAJ2QAAAcAqf7YAAL////cAAAFdAZwACYAKmQAAAcAqf8FAAD////jAAACBAZyACYAK2QAAAcAqf8MAAL//wAq/+sFLwZwACYAMRQAAAcAqf9TAAD///9nAAAFUwZwACYAO2QAAAcAqf6QAAD//wATAAAE7gZwACYAtRQAAAcAqf88AAD///+w/+sCoQZfAiYAvgAAAAcAqv8T/7v//wAaAAAFKAWwAgYAIwAA//8AnwAABLwFsAIGACQAAP//AJ8AAAR1BbACBgAnAAD//wBYAAAEcQWwAgYAPAAA//8AnwAABRAFsAIGACoAAP//AK0AAAGgBbACBgArAAD//wCfAAAFLwWwAgYALQAA//8AnwAABmIFsAIGAC8AAP//AJ8AAAUQBbACBgAwAAD//wB0/+sFGwXFAgYAMQAA//8AnwAABNoFsAIGADIAAP//ADUAAAS1BbACBgA2AAD//wATAAAE7wWwAgYAOwAA//8ALwAABOoFsAIGADoAAP///70AAAKSBw0CJgArAAAABwBo/xkBXf//ABMAAATvBw0CJgA7AAAABwBoAHYBXf//AFb/6wR5BlwCJgC2AAAABwCpAUT/7P//AGD/7AQMBlsCJgC6AAAABwCpAQ3/6///AH7+YQQGBlwCJgC8AAAABwCpARf/7P//AKn/6wJ+BkYCJgC+AAAABgCpA9YAAP//AID/6wQIBmACJgDGAAAABgCqGLwAAP//AI4AAARrBDoCBgCLAAD//wBT/+wENAROAgYAUQAA//8Akv5gBB8EOgIGAHQAAP//ACAAAAP1BDoCBgBYAAD//wAhAAAD7QQ6AgYAWgAA////xP/rApkFtQImAL4AAAAHAGj/IAAF//8AgP/rBAgFtgImAMYAAAAGAGglBgAA//8AU//sBDQGXAImAFEAAAAHAKkBGf/s//8AgP/rBAgGRwImAMYAAAAHAKkBCf/X//8AZv/rBi0GRQImAMkAAAAHAKkCIf/V//8AnwAABHUHDQImACcAAAAHAGgAWwFd//8AnwAABDcHIQImAKwAAAAHAHMBfQFbAAEAU//rBKAFxQAlAAABNCYnJiQ1NCQzMgAVIzQmIyIGFRQWFx4BFRQEIyIkNTMUFjMyNgOtg676/v4BH+r0ASLzlo+HjZe47+/+4fHp/qzztJaJlAF2XHMuQs6us+H/AL1yiXNdVWsyQdiwudTu24eBawD//wCtAAABoAWwAgYAKwAA////vQAAApIHDQImACsAAAAHAGj/GQFd//8AOv/rA+YFsAIGACwAAP//AJ8AAAUvBbACBgAtAAD//wCfAAAFLwbJAiYALQAAAAcAcwFzAQP//wA//+sE2QdcAiYA2QAAAAcAnADPAaz//wAaAAAFKAWwAgYAIwAA//8AnwAABLwFsAIGACQAAP//AJ8AAAQ3BbACBgCsAAD//wCfAAAEdQWwAgYAJwAA//8AmgAABQsHXAImANcAAAAHAJwBHQGs//8AnwAABmIFsAIGAC8AAP//AJ8AAAUQBbACBgAqAAD//wB0/+sFGwXFAgYAMQAA//8AnwAABREFsAIGALEAAP//AJ8AAATaBbACBgAyAAD//wB0/+sE2AXFAgYAJQAA//8ANQAABLUFsAIGADYAAP//AC8AAATqBbACBgA6AAD//wBe/+wEAQROAgYAQwAA//8AWf/sA/gETwIGAEcAAP//AIYAAAQSBgUCJgDrAAAABwCcAJUAVf//AFP/7AQ0BE4CBgBRAAD//wCA/mAENAROAgYAUgAAAAEAUf/sA/cETgAbAAAlMjY1MxQEIyICPQE0EjMyFhUjNCYjIgYdARQWAjtbfOX+/7j0+fnzx/PldWKLbGquZ1Gg2gEu8SPwATDht1t6w5ojncAA//8AEP5LA/wEOgIGAFsAAP//ACEAAAPtBDoCBgBaAAD//wBZ/+wD+AXMAiYARwAAAAYAaBocAAD//wCFAAADTQXKAiYA5wAAAAcAcwC+AAT//wBR/+wDzwROAgYAVQAA//8AkAAAAYMGGAIGAEsAAP///6AAAAJ1BbYCJgCKAAAABwBo/vwABv///7D+SwGOBhgCBgBMAAD//wCPAAAEZQXJAiYA7AAAAAcAcwE8AAP//wAQ/ksD/AYFAiYAWwAAAAYAnE9VAAD//wBEAAAGuwciAiYAOQAAAAcAQgHaAVz//wAlAAAF0AXLAiYAWQAAAAcAQgFWAAX//wBEAAAGuwchAiYAOQAAAAcAcwKRAVv//wAlAAAF0AXKAiYAWQAAAAcAcwINAAT//wBEAAAGuwcNAiYAOQAAAAcAaAFxAV3//wAlAAAF0AW2AiYAWQAAAAcAaADtAAb//wATAAAE7wciAiYAOwAAAAcAQgDfAVz//wAQ/ksD/AXLAiYAWwAAAAYAQmEFAAD//wBSBAQBCwYYAgYACQAA//8AUgP8Aj8GGAIGAAQAAP//AJoAAAOyBbAAJgQbAAAABwQbAiUAAP//ADEAAARSBi0AJgBIAAAABwBOAs8AAP///7X+SwJsBeoCJgCYAAAABwCb/z//+f//ADMD1gFpBhgCBgFmAAD//wCfAAAGYgchAiYALwAAAAcAcwKSAVv//wCAAAAGdQXfAiYATwAAAAcAcwKhABn//wAa/n4FKAWwAiYAIwAAAAcAogFIAAD//wBe/oUEAQROAiYAQwAAAAcAogCQAAf///89/+sFGwasAiYAMQAAAAcB1f7RANX//wAxAAAG5gYtACYASAAAAAcBkgLPAAD//wAxAAAHIQYtACYASAAAACcASALPAAAABwBOBZ4AAP//AJ8AAAR1ByICJgAnAAAABwBCAMQBXP//AJoAAAULByICJgDXAAAABwBCAS8BXP//AFn/7AP4BeECJgBHAAAABwBCAIMAG///AIYAAAQSBcsCJgDrAAAABwBCAKcABf//AEgAAAVRBbACBgC0AAD//wBP/iIFfgQ6AgYAyAAA//8AEQAABO8HRAImARQAAAAHAKcEOwFW////4wAABBgGMgImARUAAAAHAKcD1wBE//8AU/5LCIQETgAmAFEAAAAHAFsEiAAA//8AdP5LCYsFxQAmADEAAAAHAFsFjwAA//8ASv46BHsFxQImANYAAAAHAZwBkv+g//8ATf47A8QETQImAOoAAAAHAZwBOf+h//8AdP4+BNgFxQImACUAAAAHAZwB0/+k//8AUf4+A/cETgImAEUAAAAHAZwBS/+k//8AEwAABO8FsAIGADsAAP//ACD+XwP1BDoCBgC4AAD//wCtAAABoAWwAgYAKwAA//8AGAAAB4kHXAImANUAAAAHAJwCHAGs//8AFwAABl8GBQImAOkAAAAHAJwBpQBV//8ArQAAAaAFsAIGACsAAP//ABoAAAUoB1wCJgAjAAAABwCcAOoBrP//AF7/7AQBBhoCJgBDAAAABgCcb2oAAP//ABoAAAUoBw0CJgAjAAAABwBoAJMBXf//AF7/7AQBBcsCJgBDAAAABgBoGBsAAP////YAAAdXBbACBgB/AAD//wA0/+sGhAROAgYAhAAA//8AnwAABHUHXAImACcAAAAHAJwAsgGs//8AWf/sA/gGGwImAEcAAAAGAJxxawAA//8AU//qBRsG2gImAUEAAAAHAGgAcwEq//8AWf/sA/gEUAIGAJkAAP//AFn/7AP4BcwCJgCZAAAABgBoGhwAAP//ABgAAAeJBw0CJgDVAAAABwBoAcUBXf//ABcAAAZfBbYCJgDpAAAABwBoAU4ABv//AEr/6wR7ByICJgDWAAAABwBoAFgBcv//AE3/7APEBcoCJgDqAAAABgBoABoAAP//AJoAAAULBvYCJgDXAAAABwBuAOUBRv//AIYAAAQSBaACJgDrAAAABgBuXfAAAP//AJoAAAULBw0CJgDXAAAABwBoAMYBXf//AIYAAAQSBbYCJgDrAAAABgBoPgYAAP//AHT/6wUbByICJgAxAAAABwBoALoBcv//AFP/7AQ0BcsCJgBRAAAABgBoNRsAAP//AGr/6wURBcUCBgESAAD//wBS/+wEMwROAgYBEwAA//8Aav/rBREHCAImARIAAAAHAGgAxgFY//8AUv/sBDMF5wImARMAAAAGAGghNwAA//8AiP/sBNcHIwImAOIAAAAHAGgAjwFz//8AUf/rA+gFywImAPoAAAAGAGgPGwAA//8AP//rBNkG9gImANkAAAAHAG4AlwFG//8AEP5LA/wFoAImAFsAAAAGAG4X8AAA//8AP//rBNkHDQImANkAAAAHAGgAeAFd//8AEP5LA/wFtgImAFsAAAAGAGj5BgAA//8AP//rBNkHSwImANkAAAAHAKEBAQFd//8AEP5LBBwF9AImAFsAAAAHAKEAgQAG//8AjwAABOkHDQImANwAAAAHAGgAwgFd//8AXwAAA+AFtgImAPQAAAAGAGgNBgAA//8AnwAABlkHDQAmAOELAAAnACsEuQAAAAcAaAFuAV3//wCPAAAFyQW2ACYA+QAAACcAigRHAAAABwBoAR8ABv//AC/+SwVUBbACJgA6AAAABwGaA8YAAP//ACH+SwRYBDoCJgBaAAAABwGaAsoAAP//AFP/7AQDBhgCBgBGAAD//wAu/ksF/QWwAiYA2AAAAAcBmgRvAAD//wAf/ksFBwQ6AiYA7QAAAAcBmgN5AAD//wAa/qUFKAWwAiYAIwAAAAcAqAT8AAD//wBe/qwEAQROAiYAQwAAAAcAqAREAAf//wAaAAAFKAfHAiYAIwAAAAcApgT5AUj//wBe/+wEAQaFAiYAQwAAAAcApgR+AAb//wAaAAAFPgejAiYAIwAAAAcBowCzARP//wBe/+wEwwZiAiYAQwAAAAYBozjSAAD//wAEAAAFKAegAiYAIwAAAAcBogC4AR3///+J/+wEAQZfAiYAQwAAAAYBoj3cAAD//wAaAAAFKAfWAiYAIwAAAAcBoQC3AQv//wBe/+wERgaVAiYAQwAAAAYBoTzKAAD//wAaAAAFKAfiAiYAIwAAAAcBoAC4ARH//wBe/+wEAQahAiYAQwAAAAYBoD3QAAD//wAa/qUFKAdHAiYAIwAAACcAmgC3AVkABwCoBPwAAP//AF7+rAQBBgUCJgBDAAAAJgCaPBcABwCoBEQABwAA//8AGgAABSgHzgImACMAAAAHAZ8A4wFQ//8AXv/sBAEGjAImAEMAAAAGAZ9oDgAA//8AGgAABSgIFwImACMAAAAHAaQA6AF///8AXv/sBAEG1QImAEMAAAAGAaRtPQAA//8AGgAABSgISgImACMAAAAHAZ4A4gFC//8AXv/sBAEHCAImAEMAAAAGAZ5nAAAA//8AGgAABSgIJAImACMAAAAHAZ0A5QFI//8AXv/sBAEG4gImAEMAAAAGAZ1qBgAA//8AGv6lBSgHXAImACMAAAAnAJwA6gGsAAcAqAT8AAD//wBe/qwEAQYaAiYAQwAAACYAnG9qAAcAqAREAAcAAP//AJ/+rwR1BbACJgAnAAAABwCoBMAACv//AFn+pQP4BE8CJgBHAAAABwCoBJUAAP//AJ8AAAR1B8cCJgAnAAAABwCmBMEBSP//AFn/7AP4BoYCJgBHAAAABwCmBIAAB///AJ8AAAR1B2MCJgAnAAAABwCgAIEBbP//AFn/7AP4BiICJgBHAAAABgCgQCsAAP//AJ8AAAUGB6MCJgAnAAAABwGjAHsBE///AFn/7ATFBmMCJgBHAAAABgGjOtMAAP///8wAAAR1B6ACJgAnAAAABwGiAIABHf///4v/7AP4BmACJgBHAAAABgGiP90AAP//AJ8AAASJB9YCJgAnAAAABwGhAH8BC///AFn/7ARIBpYCJgBHAAAABgGhPssAAP//AJ8AAAR1B+ICJgAnAAAABwGgAIABEf//AFn/7AP4BqICJgBHAAAABgGgP9EAAP//AJ/+rwR1B0cCJgAnAAAAJwCaAH8BWQAHAKgEwAAK//8AWf6lA/gGBgImAEcAAAAmAJo+GAAHAKgElQAAAAD//wCtAAACFwfHAiYAKwAAAAcApgN+AUj//wCPAAAB+gZxAiYAigAAAAcApgNh//L//wCf/q8BrQWwAiYAKwAAAAcAqAN9AAr//wCC/q8BkAYYAiYASwAAAAcAqANgAAr//wB0/pwFGwXFAiYAMQAAAAcAqAUf//f//wBT/pwENAROAiYAUQAAAAcAqASb//f//wB0/+sFGwfcAiYAMQAAAAcApgUgAV3//wBT/+wENAaFAiYAUQAAAAcApgSbAAb//wB0/+sFZQe4AiYAMQAAAAcBowDaASj//wBT/+wE4AZiAiYAUQAAAAYBo1XSAAD//wAr/+sFGwe1AiYAMQAAAAcBogDfATL///+m/+wENAZfAiYAUQAAAAYBolrcAAD//wB0/+sFGwfrAiYAMQAAAAcBoQDeASD//wBT/+wEYwaVAiYAUQAAAAYBoVnKAAD//wB0/+sFGwf3AiYAMQAAAAcBoADfASb//wBT/+wENAahAiYAUQAAAAYBoFrQAAD//wB0/pwFGwdcAiYAMQAAACcAmgDeAW4ABwCoBR//9///AFP+nAQ0BgUCJgBRAAAAJgCaWRcABwCoBJv/9wAA//8AZv/rBa8HEwImAJQAAAAHAHMB1QFN//8AUv/sBLwF3wImAJUAAAAHAHMBVgAZ//8AZv/rBa8HFAImAJQAAAAHAEIBHgFO//8AUv/sBLwF4AImAJUAAAAHAEIAnwAa//8AZv/rBa8HuQImAJQAAAAHAKYFGwE6//8AUv/sBLwGhQImAJUAAAAHAKYEnAAG//8AZv/rBa8HVQImAJQAAAAHAKAA2wFe//8AUv/sBLwGIQImAJUAAAAGAKBcKgAA//8AZv6lBa8GLgImAJQAAAAHAKgFCwAA//8AUv6cBLwEqQImAJUAAAAHAKgEm//3//8Ahv6cBPEFsAImADcAAAAHAKgFE//3//8Ae/6lBAoEOgImAFcAAAAHAKgERQAA//8Ahv/rBPEHxwImADcAAAAHAKYFFAFI//8Ae//sBAoGcQImAFcAAAAHAKYEmv/y//8Ahv/rBksHIQImAJYAAAAHAHMB1AFb//8Ae//sBSkFygImAJcAAAAHAHMBVAAE//8Ahv/rBksHIgImAJYAAAAHAEIBHQFc//8Ae//sBSkFywImAJcAAAAHAEIAnQAF//8Ahv/rBksHxwImAJYAAAAHAKYFGgFI//8Ae//sBSkGcQImAJcAAAAHAKYEmv/y//8Ahv/rBksHYwImAJYAAAAHAKAA2gFs//8Ae//sBSkGDAImAJcAAAAGAKBaFQAA//8Ahv6cBksGEAImAJYAAAAHAKgFGf/3//8Ae/6lBSkElAImAJcAAAAHAKgERQAA//8AE/6vBO8FsAImADsAAAAHAKgE2wAK//8AEP3/A/wEOgImAFsAAAAHAKgFOv9a//8AEwAABO8HxwImADsAAAAHAKYE3AFI//8AEP5LA/wGcQImAFsAAAAHAKYEXv/y//8AEwAABO8HYwImADsAAAAHAKAAnAFs//8AEP5LA/wGDAImAFsAAAAGAKAeFQAAAAIAU//sBK8GGAAaACgAAAEjESMnDgEjIgI9ARASMzIWFzc1IzUzNTMVMwEUFjMyNjcRLgEjIgYVBK+s0hQ1j2HL2trNWocyA/Dw86z8l3F/TmkjI2lMf3MEyfs3hExMARzxFQEIAThEQQH/qqWl/IaZrkA+Adg9Qs6rAP//AFP+xASvBhgAJgBGAAAAJwHTAYkCQgAHAEEAm/+D//8An/6aBWcFsAImAC0AAAAHAZwEGAAA//8Aj/6aBKEEOgImAOwAAAAHAZwDUgAA//8An/6aBbMFsAImACoAAAAHAZwEZAAA//8Ahv6aBLQEOgImAO8AAAAHAZwDZQAA//8ANf6aBLUFsAImADYAAAAHAZwCQgAA//8AI/6aA9AEOgImAPEAAAAHAZwBxQAA//8AL/6aBQQFsAImADoAAAAHAZwDtQAA//8AIf6aBAgEOgImAFoAAAAHAZwCuQAA//8Aj/6aBYwFsAImANwAAAAHAZwEPQAA//8AX/6aBIMEOwImAPQAAAAHAZwDNAAA//8Aj/6aBOkFsAImANwAAAAHAZwC8QAA//8AX/6aA+AEOwImAPQAAAAHAZwB6AAA//8An/6aBDcFsAImAKwAAAAHAZwA5gAA//8Ahf6aA00EOgImAOcAAAAHAZwApQAA//8AGP6aB+QFsAImANUAAAAHAZwGlQAA//8AF/6aBpMEOgImAOkAAAAHAZwFRAAA//8AIP5DBcAFxAImATsAAAAHAZwC7f+p////zv5HBHYETwImATwAAAAHAZwB9f+t//8AfQAABAwGGAIGAEoAAAAC/9cAAATBBbAAEgAbAAABIxUhMgQVFAQjIREjNTM1MxUzAxEhMjY1NCYjAmbfATT4AQ7+8ff92b2989/fATSKiYiLBEfK7M7Q8wRHqr+//cn+CJFybocAAv/XAAAEwQWwABIAGwAAASMVITIEFRQEIyERIzUzNTMVMwMRITI2NTQmIwJm3wE0+AEO/vH3/dm9vfPf3wE0iomIiwRHyuzO0PMER6q/v/3J/giRcm6HAAH/9wAABDcFsAANAAABIxEjESM1MxEhFSERMwKG9POoqAOY/Vv0Ap/9YQKfqgJnw/5cAAAB/+kAAANNBDoADQAAASERIxEjNTMRIRUhFSECeP7/8pycAsj+KgEBAdH+LwHRqgG/xPsAAf/dAAAFQwWwABQAAAEjESMRIzUzNTMVMxUjETMBIQkBIQJOqPPW1vPGxosByQEg/fQCNf7XAnb9igR6qoyMqv7NAmn9Sf0HAAAAAAH/zAAABEkGGAAUAAABIxEjESM1MzUzFTMVIxEzASEJASEB9m/yycny1NRpAQ8BHP6fAY/+5gHZ/icEu6qzs6r94QGe/hH9tQAAAP//AJr+bwX3B1wCJgDXAAAAJwCcAR0BrAAHAA4Ek//E//8Ahv5vBP4GBQImAOsAAAAnAJwAlQBVAAcADgOa/8T//wCf/m8F/AWwAiYAKgAAAAcADgSY/8T//wCG/m8E/QQ6AiYA7wAAAAcADgOZ/8T//wCf/m8HTgWwAiYALwAAAAcADgXq/8T//wCP/m8GWwQ6AiYA7gAAAAcADgT3/8T//wAu/m8F9gWwAiYA2AAAAAcADgSS/8T//wAf/m8FAAQ6AiYA7QAAAAcADgOc/8QAAQATAAAE7wWwAA8AAAkBIQEzFSMHESMRIzUzASECgAFgAQ/+aWzHB/LPdf5pAQ8C7ALE/QWqDv4DAguqAvsAAAEAIP5fA/UEOgARAAAFIxEjESM1MwEzExczNxMzATMDWdXzx5v+u/vdFAMU1/v+vKgB/mABoKoDkf00X18CzPxvAAAAAQAvAAAE6gWwABEAAAEjASEJASEBIzUzASEJASEBMwPXjwGi/t3+w/7E/uEBm4J0/n0BHQEwATQBH/59gQKV/WsCI/3dApWqAnH95gIa/Y8AAAAAAQAhAAAD7QQ6ABEAAAEjASELASEBIzUzASEbASEBMwNRkgEu/uzR0f7qAS2Mgf7oARTFyAEX/ueHAdf+KQF8/oQB16oBuf6NAXP+RwAAAP//AGD/7AQMBE0CBgC6AAD//wAWAAAEcgWwAiYAKAAAAAcB0/9//m7//wCyAm0F6gMxAEYBhrYAZmZAAAACAJoAAAGNBbAAAwAHAAABIxEzESM1MwGN8/Pz8wHrA8X6UOoAAAAAAAAAAAAAAAAAABgATgCOAOQBPAFMAW4BkgG2Ac4B5AHyAf4CDAI8AkwCdgKwAtIDBANEA2IDqgPsA/gEBAQcBDAESAR4BOwFCgVABXIFmAWyBcgF/gYWBiIGPgZcBmwGkAaqBt4HAgc+B3YHsAfEB+QH/ggmCEgIYAh2CIoImAiqCMII0AjgCR4JVAl+CbIJ5goKCk4KcgqECqgKxgrSCwwLMAteC5QLyAvoDCAMRgxqDIIMrAzMDPYNDA08DUoNeA2iDbYN6A4cDmYOkA6kDwgPHA9yD7IPvg/OEDIQQBBmEIYQsBDqEPoRIBE2EUQRYhFyEZwRqBG6EcwR3hIOEjgSWhKqEtATChNoE7gT0hQeFFQUfhSKFKgUxBTcFQgVPBV8FdAV7BYiFmIWnBbGFvQXEhdGF1oXbheIF5YXvBfeF/4YFBg6GEgYVhhgGH4YlBiiGLAYyhjSGOQY+hk0GUoZZhl4GZYZ0Bn8GjgafBq8GtgbIBtaG5IbthvuHAwcRByOHLYc6B0eHVIddh2cHdoeDB5MHogexB8KHzgfcB+mH9YgACAYIEAgbCCaINYg7iEOITgheiGSIbYh0CHwIhgiRCJoIpwi2CMAI0IjeCOKI7Qj4CQaJDQkUiRyJJIkqiS8JNAlKiVCJWQlfiWeJcQl7iYQJj4mdCacJtgnBic6J2gnliewJ+IoFChCKIIouCjaKP4pLClcKZIpxCoGKkIqkirgKxorTityK5or3CwYLHos2C0WLVQtgC2oLdQt6C4GLhYuJi7ALxgvRC9yL7AvxC/YMAAwJjBMMHAwkDCwMMww6DESMTwxkjHkMgIyIDJKMnIylDLUMxAzPDNmM44ztjPuNBo0RjRWNGY0jDTENRY1XDWiNeQ2JjZgNpo2zjcCNzw3cjegN844DDgMOAw4DDgMOAw4DDgMOAw4DDgMOAw4DDgWOCA4LDhCOFg4bjh6OIY4kji2ONA49DkMORg5KDmkObg5zDnaOfg6GjpWOpg62DsuO2g7rjvYPA48IDwyPEQ8VjySPKY8xDzSPOw9Pj1sPcQ96D34Pgg+LD46Pk4+ZD6OPo4/aD+uP+BAAEAwQFBAbkCQQJ5A0EEAQSBBTkF2QZBBqkHKQdpB9kIsQlpCfkKYQq5C4EL4QwRDIEM+Q05DbkOIQ7ZD7EQkRFxEcESQRKpEzETsRQRFGkVGRVZFfkW4RdhGAkY+RlpGokbeRu5HFkdQR2BHkEfMR+ZILkhqSJRIokjQSPBJKklMSX5JvkosSkpKiErQSwpLTkt0S7JL4Ev+TB5MOkxYTJpMvEzETMxM1E0ETTRNYE18TapNtk3CTc5N2k3mTfJN/k4KThZOIk4uTjpORk5STl5Oak52ToJOjk6aTqZOsk6+TspO1k7iTu5O+k8GTxJPHk8qTzZPQk9OT1pPZk9yT35Pik+WT6JPrk+6T8ZP0k/eT+pP9lACUA5QGlAmUDJQPlBKUFZQYlBuUKRQ/FEIURRRIFEsUThRRFFQUVxRaFF0UYBRjFGYUaRRsFG8UfBSPlJKUlZSYlJuUnpShlKSUp5SqlK2UsJSzlLaUuZS8lL+UwpTFlMiUy5TOlNGU1JTXlNqU3ZTglOOU5pTplOyU75TylPWU+JT7lP6VAZUElQeVCpUNlRCVE5UWlRmVHJUflSKVJZUolSuVLpUxlTSVN5U6lT2VQJVDlUaVSZVMlU+VUpVVlViVW5VelWGVZJVnlWqVbZVwlXOVdpV5lXyVf5WOlZ2VoJWjlaaVqZWsla+VspW1lbiVu5W+lcGVxJXHlcqVzZXQldOV1pXZldyV35XileWV6JXrle6V8ZX0lfeV+pX9lgCWA5YGlgmWDJYPlhKWFZYYlhuWHpYhliSWJ5YqljeWOpY9lkCWQ5ZGlkmWTJZPllyWX5ZilmWWaJZrlm6WcZZ0lneWepZ9loCWg5aGlomWjJaPlpKWlZaYlpuWnpahlqSWp5aqlq2WsJazlraWuZa8lr+WwpbFlsiWy5baFt0W4BbjFuYW6RbsFu8W8hb1FvgW+xb+FwEXBBcHFwkXCxcNFw8XERcTFxUXFxcZFxsXHRcfFyEXIxcmFykXLBcvFzIXNRc4FzoXPBc+F0AXQhdFF0gXSxdOF1EXVBdXF2WXZ5dql2yXbpdxl3SXdpd4l3qXfJd/l4GXg5eFl4eXiZeLl42Xj5eRl5OXlpeYl5qXpRenF6kXrBevF7EXsxe2F7gXuxe+F8EXxBfHF8oXzRfQF9MX1hfYF9oX3RfgF+MX5RfoF+sX7hfxF/QX9xf7F/4YARgEGAcYCRgLGA4YERgUGBcYGhgdGCAYIxglGCcYKRgsGC8YMRg0GDcYOhg9GD8YQRhEGEcYShhMGE8YUhhVGFgYWxheGGEYZBhnGGoYbRhvGHEYdBh3GHoYfRiAGIMYhhiJGIwYjxiSGJUYmRidGKAYoxilGKgYqxiuGLEYtBi3GLoYvRjAGMMYxhjJGMwYzxjTGNcY2hjdGOAY4xjmGOkY7BjvGPMY9xj6GP0ZABkDGQYZCRkMGQ8ZEhkVGRgZGxkeGSEZJRkpGSwZLxkyGTUZOBk7GT4ZQRlEGUcZShlNGVAZUxlWGVkZXRlhGWQZZxlqGW0ZcBlzGXYZeRl8GX8ZghmFGYgZixmOGZEZlBmXGZoZnRmgGaMZphmpGawZrxmyGbUZuBm7GcqZzpnRmdSZ15namd2Z4JnjmeaZ6Znsme+Z8pn1mfiZ+5n+mgGaBJoGmhGaHJojGimaMxo8mkCaRJpHmkqaTZpQmlOaVppemmcacZp7mn2agJqDGoMaiAAAAAAAB0BYgABAAAAAAAAAB8AAAABAAAAAAABAAYAHwABAAAAAAACAAYAJQABAAAAAAADABIAKwABAAAAAAAEAA0APQABAAAAAAAFABYASgABAAAAAAAGAA0AYAABAAAAAAAHACAAbQABAAAAAAAJAAYAjQABAAAAAAALAAoAkwABAAAAAAAMABMAnQABAAAAAAANAC4AsAABAAAAAAAOACoA3gABAAAAAAASAA0BCAADAAEECQAAAD4BFQADAAEECQABAAwBUwADAAEECQACAAwBXwADAAEECQADACQBawADAAEECQAEABoBjwADAAEECQAFACwBqQADAAEECQAGABoB1QADAAEECQAHAEAB7wADAAEECQAJAAwCLwADAAEECQALABQCOwADAAEECQAMACYCTwADAAEECQANAFwCdQADAAEECQAOAFQC0QADAAEECQAQAAwDJQADAAEECQARAAwDMUZvbnQgZGF0YSBjb3B5cmlnaHQgR29vZ2xlIDIwMTNSb2JvdG9NZWRpdW1Hb29nbGU6Um9ib3RvOjIwMTNSb2JvdG8gTWVkaXVtVmVyc2lvbiAxLjIwMDMxMDsgMjAxM1JvYm90by1NZWRpdW1Sb2JvdG8gaXMgYSB0cmFkZW1hcmsgb2YgR29vZ2xlLkdvb2dsZUdvb2dsZS5jb21DaHJpc3RpYW4gUm9iZXJ0c29uTGljZW5zZWQgdW5kZXIgdGhlIEFwYWNoZSBMaWNlbnNlLCBWZXJzaW9uIDIuMGh0dHA6Ly93d3cuYXBhY2hlLm9yZy9saWNlbnNlcy9MSUNFTlNFLTIuMFJvYm90byBNZWRpdW0ARgBvAG4AdAAgAGQAYQB0AGEAIABjAG8AcAB5AHIAaQBnAGgAdAAgAEcAbwBvAGcAbABlACAAMgAwADEAMwBSAG8AYgBvAHQAbwBNAGUAZABpAHUAbQBHAG8AbwBnAGwAZQA6AFIAbwBiAG8AdABvADoAMgAwADEAMwBSAG8AYgBvAHQAbwAgAE0AZQBkAGkAdQBtAFYAZQByAHMAaQBvAG4AIAAxAC4AMgAwADAAMwAxADAAOwAgADIAMAAxADMAUgBvAGIAbwB0AG8ALQBNAGUAZABpAHUAbQBSAG8AYgBvAHQAbwAgAGkAcwAgAGEAIAB0AHIAYQBkAGUAbQBhAHIAawAgAG8AZgAgAEcAbwBvAGcAbABlAC4ARwBvAG8AZwBsAGUARwBvAG8AZwBsAGUALgBjAG8AbQBDAGgAcgBpAHMAdABpAGEAbgAgAFIAbwBiAGUAcgB0AHMAbwBuAEwAaQBjAGUAbgBzAGUAZAAgAHUAbgBkAGUAcgAgAHQAaABlACAAQQBwAGEAYwBoAGUAIABMAGkAYwBlAG4AcwBlACwAIABWAGUAcgBzAGkAbwBuACAAMgAuADAAaAB0AHQAcAA6AC8ALwB3AHcAdwAuAGEAcABhAGMAaABlAC4AbwByAGcALwBsAGkAYwBlAG4AcwBlAHMALwBMAEkAQwBFAE4AUwBFAC0AMgAuADAAUgBvAGIAbwB0AG8ATQBlAGQAaQB1AG0AAAIAAAAAAAD/agBkAAAAAAAAAAAAAAAAAAAAAAAAAAAEHAAAAQIAAgADAAUABgAHAAgACQAKAAsADAANAA4ADwAQABEAEgATABQAFQAWABcAGAAZABoAGwAcAB0AHgAfACAAIQAiACMAJAAlACYAJwAoACkAKgArACwALQAuAC8AMAAxADIAMwA0ADUANgA3ADgAOQA6ADsAPAA9AD4APwBAAEEAQgBDAEQARQBGAEcASABJAEoASwBMAE0ATgBPAFAAUQBSAFMAVABVAFYAVwBYAFkAWgBbAFwAXQBeAF8AYABhAKMAhACFAL0AlgDoAIYAjgCLAJ0AqQCkAIoBAwCDAJMA8gDzAI0AlwCIAQQA3gDxAJ4AqgD1APQA9gCiAJAA8ACRAO0AiQCgAOoAuAChAO4BBQDXAQYA4gDjAQcBCACwALEBCQCmAQoBCwEMAQ0BDgEPANgA4QDbANwA3QDgANkA3wEQAREBEgETARQBFQEWARcBGAEZARoBGwEcAR0BHgEfASABIQEiAJ8BIwEkASUBJgEnASgBKQEqASsBLAEtAJsBLgEvATABMQEyATMBNAE1ATYBNwE4ATkBOgE7ATwBPQE+AT8BQAFBAUIBQwFEAUUBRgFHAUgBSQFKAUsBTAFNAU4BTwFQAVEBUgFTAVQBVQFWAVcBWAFZAVoBWwFcAV0BXgFfAWABYQFiAWMBZAFlAWYBZwFoAWkBagFrAWwBbQFuAW8BcAFxAXIBcwF0AXUBdgF3AXgBeQF6AXsBfAF9AX4BfwGAAYEBggGDAYQBhQGGAYcBiAGJAYoBiwGMAY0BjgGPAZABkQGSAZMBlAGVAZYBlwGYAZkBmgGbAZwBnQGeAZ8BoAGhAaIBowGkAaUBpgGnAagBqQGqAasBrAGtAa4BrwGwAbEBsgGzAbQBtQG2AbcBuAG5AboBuwG8Ab0BvgG/AcABwQHCAcMBxAHFAcYBxwHIAckBygHLAcwBzQCyALMBzgC2ALcAxAHPALQAtQDFAIIAwgCHAdAAqwDGAL4AvwC8AdEB0gHTAdQB1QHWAdcB2ACMAdkB2gHbAdwB3QCYAJoAmQDvAKUAkgCcAKcAjwCUAJUAuQHeAd8B4ADAAeEB4gHjAeQB5QHmAecB6AHpAeoB6wHsAe0B7gHvAfAB8QHyAfMB9AH1AfYB9wH4AfkB+gH7AfwB/QH+Af8CAAIBAgICAwIEAgUCBgIHAggCCQIKAgsCDAINAg4CDwIQAhECEgITAhQCFQIWAhcCGAIZAhoCGwIcAh0CHgIfAiACIQIiAiMCJAIlAiYCJwIoAikCKgIrAiwCLQIuAi8CMAIxAjICMwI0AjUCNgI3AKwCOAI5AOkCOgI7AjwArQDJAMcArgBiAGMCPQBkAMsAZQDIAMoAzwDMAM0AzgBmANMA0ADRAK8AZwDWANQA1QBoAOsAagBpAGsAbQBsAG4CPgBvAHEAcAByAHMAdQB0AHYAdwB4AHoAeQB7AH0AfAB/AH4AgACBAOwAugI/AkACQQJCAkMCRAD9AP4CRQJGAkcCSAD/AQACSQJKAksCTAJNAk4CTwJQAlECUgJTAlQCVQJWAPgA+QJXAlgCWQJaAlsCXAJdAl4CXwJgAmECYgJjAmQCZQJmAmcCaAJpAmoCawJsAm0CbgJvAnACcQJyAnMCdAJ1AnYCdwJ4AnkCegJ7AnwCfQJ+An8CgAKBAoICgwKEAoUChgKHAogCiQKKAPsA/AKLAowA5ADlAo0CjgKPApACkQKSApMClAKVApYClwKYApkCmgKbApwCnQKeAp8CoAKhAqIAuwKjAqQCpQKmAOYA5wKnAqgCqQKqAqsCrAKtAq4CrwKwArECsgKzArQCtQK2ArcCuAK5AroCuwK8Ar0CvgK/AsACwQLCAsMCxALFAsYCxwLIAskCygLLAswCzQLOAs8C0ALRAtIC0wLUAtUC1gLXAtgC2QLaAtsC3ALdAt4C3wLgAuEC4gLjAuQC5QLmAucC6ALpAuoC6wLsAu0C7gLvAvAC8QLyAvMC9AL1AvYC9wL4AvkC+gL7AvwC/QL+Av8DAAMBAwIDAwMEAwUDBgMHAwgDCQMKAwsDDAMNAw4DDwMQAxEDEgMTAxQDFQMWAxcDGAMZAxoDGwMcAx0DHgMfAyADIQMiAyMDJAMlAyYDJwMoAykDKgMrAywDLQMuAy8DMAMxAzIDMwM0AzUDNgM3AzgDOQM6AzsDPAM9Az4DPwNAA0EDQgNDA0QDRQNGA0cDSANJA0oDSwNMA00DTgNPA1ADUQNSA1MDVANVA1YDVwNYA1kDWgNbA1wDXQNeA18DYANhA2IDYwNkA2UDZgNnA2gDaQNqA2sDbANtA24DbwNwA3EDcgNzA3QDdQN2A3cDeAN5A3oDewN8A30DfgN/A4ADgQOCA4MDhAOFA4YDhwOIA4kDigOLA4wDjQOOA48DkAORA5IDkwOUA5UDlgOXA5gDmQOaA5sDnAOdA54DnwOgA6EDogOjA6QDpQOmA6cDqAOpA6oDqwOsA60DrgOvA7ADsQOyA7MDtAO1A7YDtwO4A7kDugO7A7wDvQO+A78DwAPBA8IDwwPEA8UDxgPHA8gDyQPKA8sDzAPNA84DzwPQA9ED0gPTA9QD1QPWA9cD2APZA9oD2wPcA90D3gPfA+AD4QPiA+MD5APlA+YD5wPoA+kD6gPrA+wD7QPuA+8D8APxA/ID8wP0A/UD9gP3A/gD+QP6A/sD/AP9A/4D/wQABAEEAgQDBAQEBQQGBAcECAQJBAoECwQMBA0EDgQPBBAEEQQSBBMEFAQVBBYEFwQYBBkEGgQbBBwEHQQeBB8EIAQhAPcEIgQjAAQHdW5pMDAwOQZtYWNyb24OcGVyaW9kY2VudGVyZWQESGJhcgxrZ3JlZW5sYW5kaWMDRW5nA2VuZwVsb25ncwVPaG9ybgVvaG9ybgVVaG9ybgV1aG9ybgd1bmkwMjM3BXNjaHdhB3VuaTAyRjMJZ3JhdmVjb21iCWFjdXRlY29tYgl0aWxkZWNvbWIEaG9vawd1bmkwMzBGCGRvdGJlbG93BXRvbm9zDWRpZXJlc2lzdG9ub3MJYW5vdGVsZWlhBUdhbW1hBURlbHRhBVRoZXRhBkxhbWJkYQJYaQJQaQVTaWdtYQNQaGkDUHNpBWFscGhhBGJldGEFZ2FtbWEFZGVsdGEHZXBzaWxvbgR6ZXRhA2V0YQV0aGV0YQRpb3RhBmxhbWJkYQJ4aQNyaG8Gc2lnbWExBXNpZ21hA3RhdQd1cHNpbG9uA3BoaQNwc2kFb21lZ2EHdW5pMDNEMQd1bmkwM0QyB3VuaTAzRDYHdW5pMDQwMgd1bmkwNDA0B3VuaTA0MDkHdW5pMDQwQQd1bmkwNDBCB3VuaTA0MEYHdW5pMDQxMQd1bmkwNDE0B3VuaTA0MTYHdW5pMDQxNwd1bmkwNDE4B3VuaTA0MUIHdW5pMDQyMwd1bmkwNDI0B3VuaTA0MjYHdW5pMDQyNwd1bmkwNDI4B3VuaTA0MjkHdW5pMDQyQQd1bmkwNDJCB3VuaTA0MkMHdW5pMDQyRAd1bmkwNDJFB3VuaTA0MkYHdW5pMDQzMQd1bmkwNDMyB3VuaTA0MzMHdW5pMDQzNAd1bmkwNDM2B3VuaTA0MzcHdW5pMDQzOAd1bmkwNDNBB3VuaTA0M0IHdW5pMDQzQwd1bmkwNDNEB3VuaTA0M0YHdW5pMDQ0Mgd1bmkwNDQ0B3VuaTA0NDYHdW5pMDQ0Nwd1bmkwNDQ4B3VuaTA0NDkHdW5pMDQ0QQd1bmkwNDRCB3VuaTA0NEMHdW5pMDQ0RAd1bmkwNDRFB3VuaTA0NEYHdW5pMDQ1Mgd1bmkwNDU0B3VuaTA0NTkHdW5pMDQ1QQd1bmkwNDVCB3VuaTA0NUYHdW5pMDQ2MAd1bmkwNDYxB3VuaTA0NjMHdW5pMDQ2NAd1bmkwNDY1B3VuaTA0NjYHdW5pMDQ2Nwd1bmkwNDY4B3VuaTA0NjkHdW5pMDQ2QQd1bmkwNDZCB3VuaTA0NkMHdW5pMDQ2RAd1bmkwNDZFB3VuaTA0NkYHdW5pMDQ3Mgd1bmkwNDczB3VuaTA0NzQHdW5pMDQ3NQd1bmkwNDdBB3VuaTA0N0IHdW5pMDQ3Qwd1bmkwNDdEB3VuaTA0N0UHdW5pMDQ3Rgd1bmkwNDgwB3VuaTA0ODEHdW5pMDQ4Mgd1bmkwNDgzB3VuaTA0ODQHdW5pMDQ4NQd1bmkwNDg2B3VuaTA0ODgHdW5pMDQ4OQd1bmkwNDhEB3VuaTA0OEUHdW5pMDQ4Rgd1bmkwNDkwB3VuaTA0OTEHdW5pMDQ5NAd1bmkwNDk1B3VuaTA0OUMHdW5pMDQ5RAd1bmkwNEEwB3VuaTA0QTEHdW5pMDRBNAd1bmkwNEE1B3VuaTA0QTYHdW5pMDRBNwd1bmkwNEE4B3VuaTA0QTkHdW5pMDRCNAd1bmkwNEI1B3VuaTA0QjgHdW5pMDRCOQd1bmkwNEJBB3VuaTA0QkMHdW5pMDRCRAd1bmkwNEMzB3VuaTA0QzQHdW5pMDRDNwd1bmkwNEM4B3VuaTA0RDgHdW5pMDRFMAd1bmkwNEUxB3VuaTA0RkEHdW5pMDRGQgd1bmkwNTAwB3VuaTA1MDIHdW5pMDUwMwd1bmkwNTA0B3VuaTA1MDUHdW5pMDUwNgd1bmkwNTA3B3VuaTA1MDgHdW5pMDUwOQd1bmkwNTBBB3VuaTA1MEIHdW5pMDUwQwd1bmkwNTBEB3VuaTA1MEUHdW5pMDUwRgd1bmkwNTEwB3VuaTIwMDAHdW5pMjAwMQd1bmkyMDAyB3VuaTIwMDMHdW5pMjAwNAd1bmkyMDA1B3VuaTIwMDYHdW5pMjAwNwd1bmkyMDA4B3VuaTIwMDkHdW5pMjAwQQd1bmkyMDBCDXVuZGVyc2NvcmVkYmwNcXVvdGVyZXZlcnNlZAd1bmkyMDI1B3VuaTIwNzQJbnN1cGVyaW9yBGxpcmEGcGVzZXRhBEV1cm8HdW5pMjEwNQd1bmkyMTEzB3VuaTIxMTYJZXN0aW1hdGVkCW9uZWVpZ2h0aAx0aHJlZWVpZ2h0aHMLZml2ZWVpZ2h0aHMMc2V2ZW5laWdodGhzCmNvbG9uLmxudW0JcXVvdGVkYmx4C2NvbW1hYWNjZW50B3VuaUZFRkYHdW5pRkZGQwd1bmlGRkZECWZpdmUuc21jcAhmb3VyLnN1cAl6ZXJvLmxudW0ObGFyZ2VyaWdodGhvb2sMY3lyaWxsaWNob29rEGN5cmlsbGljaG9va2xlZnQLY3lyaWxsaWN0aWMOYnJldmV0aWxkZWNvbWINYnJldmVob29rY29tYg5icmV2ZWFjdXRlY29tYhNjaXJjdW1mbGV4dGlsZGVjb21iEmNpcmN1bWZsZXhob29rY29tYhNjaXJjdW1mbGV4Z3JhdmVjb21iE2NpcmN1bWZsZXhhY3V0ZWNvbWIOYnJldmVncmF2ZWNvbWIRY29tbWFhY2NlbnRyb3RhdGUGQS5zbWNwBkIuc21jcAZDLnNtY3AGRC5zbWNwBkUuc21jcAZGLnNtY3AGRy5zbWNwBkguc21jcAZJLnNtY3AGSi5zbWNwBksuc21jcAZMLnNtY3AGTS5zbWNwBk4uc21jcAZPLnNtY3AGUS5zbWNwBlIuc21jcAZTLnNtY3AGVC5zbWNwBlUuc21jcAZWLnNtY3AGVy5zbWNwBlguc21jcAZZLnNtY3AGWi5zbWNwCXplcm8uc21jcAhvbmUuc21jcAh0d28uc21jcAp0aHJlZS5zbWNwCWZvdXIuc21jcAh0d28ubG51bQhzaXguc21jcApzZXZlbi5zbWNwCmVpZ2h0LnNtY3AJbmluZS5zbWNwB29uZS5zdXAHdHdvLnN1cAl0aHJlZS5zdXAIb25lLmxudW0IZml2ZS5zdXAHc2l4LnN1cAlzZXZlbi5zdXAJZWlnaHQuc3VwCG5pbmUuc3VwCHplcm8uc3VwCGNyb3NzYmFyCXJpbmdhY3V0ZQlkYXNpYW94aWEKdGhyZWUubG51bQlmb3VyLmxudW0JZml2ZS5sbnVtCHNpeC5sbnVtBWcuYWx0CnNldmVuLmxudW0HY2hpLmFsdAplaWdodC5sbnVtCWFscGhhLmFsdAlkZWx0YS5hbHQERC5jbgRhLmNuBVIuYWx0BUsuYWx0BWsuYWx0BksuYWx0MgZrLmFsdDIJbmluZS5sbnVtBlAuc21jcA1jeXJpbGxpY2JyZXZlB3VuaTAwQUQGRGNyb2F0BGhiYXIEVGJhcgR0YmFyCkFyaW5nYWN1dGUKYXJpbmdhY3V0ZQdBbWFjcm9uB2FtYWNyb24GQWJyZXZlBmFicmV2ZQdBb2dvbmVrB2FvZ29uZWsLQ2NpcmN1bWZsZXgLY2NpcmN1bWZsZXgHdW5pMDEwQQd1bmkwMTBCBkRjYXJvbgZkY2Fyb24HRW1hY3JvbgdlbWFjcm9uBkVicmV2ZQZlYnJldmUKRWRvdGFjY2VudAplZG90YWNjZW50B0VvZ29uZWsHZW9nb25lawZFY2Fyb24GZWNhcm9uC0djaXJjdW1mbGV4C2djaXJjdW1mbGV4B3VuaTAxMjAHdW5pMDEyMQxHY29tbWFhY2NlbnQMZ2NvbW1hYWNjZW50C0hjaXJjdW1mbGV4C2hjaXJjdW1mbGV4Bkl0aWxkZQZpdGlsZGUHSW1hY3JvbgdpbWFjcm9uBklicmV2ZQZpYnJldmUHSW9nb25lawdpb2dvbmVrCklkb3RhY2NlbnQCSUoCaWoLSmNpcmN1bWZsZXgLamNpcmN1bWZsZXgMS2NvbW1hYWNjZW50DGtjb21tYWFjY2VudAZMYWN1dGUGbGFjdXRlDExjb21tYWFjY2VudAxsY29tbWFhY2NlbnQGTGNhcm9uBmxjYXJvbgRMZG90BGxkb3QGTmFjdXRlBm5hY3V0ZQxOY29tbWFhY2NlbnQMbmNvbW1hYWNjZW50Bk5jYXJvbgZuY2Fyb24LbmFwb3N0cm9waGUHT21hY3JvbgdvbWFjcm9uBk9icmV2ZQZvYnJldmUNT2h1bmdhcnVtbGF1dA1vaHVuZ2FydW1sYXV0BlJhY3V0ZQZyYWN1dGUMUmNvbW1hYWNjZW50DHJjb21tYWFjY2VudAZSY2Fyb24GcmNhcm9uBlNhY3V0ZQZzYWN1dGULU2NpcmN1bWZsZXgLc2NpcmN1bWZsZXgHdW5pMDIxOAd1bmkwMjE5B3VuaTAyMUEHdW5pMDIxQgd1bmkwMTYyB3VuaTAxNjMGVGNhcm9uBnRjYXJvbgZVdGlsZGUGdXRpbGRlB1VtYWNyb24HdW1hY3JvbgZVYnJldmUGdWJyZXZlBVVyaW5nBXVyaW5nDVVodW5nYXJ1bWxhdXQNdWh1bmdhcnVtbGF1dAdVb2dvbmVrB3VvZ29uZWsLV2NpcmN1bWZsZXgLd2NpcmN1bWZsZXgLWWNpcmN1bWZsZXgLeWNpcmN1bWZsZXgGWmFjdXRlBnphY3V0ZQpaZG90YWNjZW50Cnpkb3RhY2NlbnQHQUVhY3V0ZQdhZWFjdXRlC09zbGFzaGFjdXRlC29zbGFzaGFjdXRlC0Rjcm9hdC5zbWNwCEV0aC5zbWNwCVRiYXIuc21jcAtBZ3JhdmUuc21jcAtBYWN1dGUuc21jcBBBY2lyY3VtZmxleC5zbWNwC0F0aWxkZS5zbWNwDkFkaWVyZXNpcy5zbWNwCkFyaW5nLnNtY3APQXJpbmdhY3V0ZS5zbWNwDUNjZWRpbGxhLnNtY3ALRWdyYXZlLnNtY3ALRWFjdXRlLnNtY3AQRWNpcmN1bWZsZXguc21jcA5FZGllcmVzaXMuc21jcAtJZ3JhdmUuc21jcAtJYWN1dGUuc21jcBBJY2lyY3VtZmxleC5zbWNwDklkaWVyZXNpcy5zbWNwC050aWxkZS5zbWNwC09ncmF2ZS5zbWNwC09hY3V0ZS5zbWNwEE9jaXJjdW1mbGV4LnNtY3ALT3RpbGRlLnNtY3AOT2RpZXJlc2lzLnNtY3ALVWdyYXZlLnNtY3ALVWFjdXRlLnNtY3AQVWNpcmN1bWZsZXguc21jcA5VZGllcmVzaXMuc21jcAtZYWN1dGUuc21jcAxBbWFjcm9uLnNtY3ALQWJyZXZlLnNtY3AMQW9nb25lay5zbWNwC0NhY3V0ZS5zbWNwEENjaXJjdW1mbGV4LnNtY3AMdW5pMDEwQS5zbWNwC0NjYXJvbi5zbWNwC0RjYXJvbi5zbWNwDEVtYWNyb24uc21jcAtFYnJldmUuc21jcA9FZG90YWNjZW50LnNtY3AMRW9nb25lay5zbWNwC0VjYXJvbi5zbWNwEEdjaXJjdW1mbGV4LnNtY3ALR2JyZXZlLnNtY3AMdW5pMDEyMC5zbWNwEUdjb21tYWFjY2VudC5zbWNwEEhjaXJjdW1mbGV4LnNtY3ALSXRpbGRlLnNtY3AMSW1hY3Jvbi5zbWNwC0licmV2ZS5zbWNwDElvZ29uZWsuc21jcA9JZG90YWNjZW50LnNtY3AQSmNpcmN1bWZsZXguc21jcBFLY29tbWFhY2NlbnQuc21jcAtMYWN1dGUuc21jcBFMY29tbWFhY2NlbnQuc21jcAtMY2Fyb24uc21jcAlMZG90LnNtY3ALTmFjdXRlLnNtY3ARTmNvbW1hYWNjZW50LnNtY3ALTmNhcm9uLnNtY3AMT21hY3Jvbi5zbWNwC09icmV2ZS5zbWNwEk9odW5nYXJ1bWxhdXQuc21jcAtSYWN1dGUuc21jcBFSY29tbWFhY2NlbnQuc21jcAtSY2Fyb24uc21jcAtTYWN1dGUuc21jcBBTY2lyY3VtZmxleC5zbWNwDVNjZWRpbGxhLnNtY3ALU2Nhcm9uLnNtY3ARVGNvbW1hYWNjZW50LnNtY3ALVGNhcm9uLnNtY3ALVXRpbGRlLnNtY3AMVW1hY3Jvbi5zbWNwC1VicmV2ZS5zbWNwClVyaW5nLnNtY3ASVWh1bmdhcnVtbGF1dC5zbWNwDFVvZ29uZWsuc21jcBBXY2lyY3VtZmxleC5zbWNwEFljaXJjdW1mbGV4LnNtY3AOWWRpZXJlc2lzLnNtY3ALWmFjdXRlLnNtY3APWmRvdGFjY2VudC5zbWNwC1pjYXJvbi5zbWNwD2dlcm1hbmRibHMuc21jcApBbHBoYXRvbm9zDEVwc2lsb250b25vcwhFdGF0b25vcwlJb3RhdG9ub3MMT21pY3JvbnRvbm9zDFVwc2lsb250b25vcwpPbWVnYXRvbm9zEWlvdGFkaWVyZXNpc3Rvbm9zBUFscGhhBEJldGEHRXBzaWxvbgRaZXRhA0V0YQRJb3RhBUthcHBhAk11Ak51B09taWNyb24DUmhvA1RhdQdVcHNpbG9uA0NoaQxJb3RhZGllcmVzaXMPVXBzaWxvbmRpZXJlc2lzCmFscGhhdG9ub3MMZXBzaWxvbnRvbm9zCGV0YXRvbm9zCWlvdGF0b25vcxR1cHNpbG9uZGllcmVzaXN0b25vcwVrYXBwYQdvbWljcm9uB3VuaTAzQkMCbnUDY2hpDGlvdGFkaWVyZXNpcw91cHNpbG9uZGllcmVzaXMMb21pY3JvbnRvbm9zDHVwc2lsb250b25vcwpvbWVnYXRvbm9zB3VuaTA0MDEHdW5pMDQwMwd1bmkwNDA1B3VuaTA0MDYHdW5pMDQwNwd1bmkwNDA4B3VuaTA0MUEHdW5pMDQwQwd1bmkwNDBFB3VuaTA0MTAHdW5pMDQxMgd1bmkwNDEzB3VuaTA0MTUHdW5pMDQxOQd1bmkwNDFDB3VuaTA0MUQHdW5pMDQxRQd1bmkwNDFGB3VuaTA0MjAHdW5pMDQyMQd1bmkwNDIyB3VuaTA0MjUHdW5pMDQzMAd1bmkwNDM1B3VuaTA0MzkHdW5pMDQzRQd1bmkwNDQwB3VuaTA0NDEHdW5pMDQ0Mwd1bmkwNDQ1B3VuaTA0NTEHdW5pMDQ1Mwd1bmkwNDU1B3VuaTA0NTYHdW5pMDQ1Nwd1bmkwNDU4B3VuaTA0NUMHdW5pMDQ1RQZXZ3JhdmUGd2dyYXZlBldhY3V0ZQZ3YWN1dGUJV2RpZXJlc2lzCXdkaWVyZXNpcwZZZ3JhdmUGeWdyYXZlBm1pbnV0ZQZzZWNvbmQJZXhjbGFtZGJsB3VuaUZCMDIHdW5pMDFGMAd1bmkwMkJDB3VuaTFFM0UHdW5pMUUzRgd1bmkxRTAwB3VuaTFFMDEHdW5pMUY0RAd1bmlGQjAzB3VuaUZCMDQHdW5pMDQwMAd1bmkwNDBEB3VuaTA0NTAHdW5pMDQ1RAd1bmkwNDcwB3VuaTA0NzEHdW5pMDQ3Ngd1bmkwNDc3B3VuaTA0NzkHdW5pMDQ3OAd1bmkwNDk4B3VuaTA0OTkHdW5pMDRBQQd1bmkwNEFCB3VuaTA0QUUHdW5pMDRBRgd1bmkwNEMwB3VuaTA0QzEHdW5pMDRDMgd1bmkwNENGB3VuaTA0RDAHdW5pMDREMQd1bmkwNEQyB3VuaTA0RDMHdW5pMDRENAd1bmkwNEQ1B3VuaTA0RDYHdW5pMDRENwd1bmkwNERBB3VuaTA0RDkHdW5pMDREQgd1bmkwNERDB3VuaTA0REQHdW5pMDRERQd1bmkwNERGB3VuaTA0RTIHdW5pMDRFMwd1bmkwNEU0B3VuaTA0RTUHdW5pMDRFNgd1bmkwNEU3B3VuaTA0RTgHdW5pMDRFOQd1bmkwNEVBB3VuaTA0RUIHdW5pMDRFQwd1bmkwNEVEB3VuaTA0RUUHdW5pMDRFRgd1bmkwNEYwB3VuaTA0RjEHdW5pMDRGMgd1bmkwNEYzB3VuaTA0RjQHdW5pMDRGNQd1bmkwNEY4B3VuaTA0RjkHdW5pMDRGQwd1bmkwNEZEB3VuaTA1MDEHdW5pMDUxMgd1bmkwNTEzB3VuaTFFQTAHdW5pMUVBMQd1bmkxRUEyB3VuaTFFQTMHdW5pMUVBNAd1bmkxRUE1B3VuaTFFQTYHdW5pMUVBNwd1bmkxRUE4B3VuaTFFQTkHdW5pMUVBQQd1bmkxRUFCB3VuaTFFQUMHdW5pMUVBRAd1bmkxRUFFB3VuaTFFQUYHdW5pMUVCMAd1bmkxRUIxB3VuaTFFQjIHdW5pMUVCMwd1bmkxRUI0B3VuaTFFQjUHdW5pMUVCNgd1bmkxRUI3B3VuaTFFQjgHdW5pMUVCOQd1bmkxRUJBB3VuaTFFQkIHdW5pMUVCQwd1bmkxRUJEB3VuaTFFQkUHdW5pMUVCRgd1bmkxRUMwB3VuaTFFQzEHdW5pMUVDMgd1bmkxRUMzB3VuaTFFQzQHdW5pMUVDNQd1bmkxRUM2B3VuaTFFQzcHdW5pMUVDOAd1bmkxRUM5B3VuaTFFQ0EHdW5pMUVDQgd1bmkxRUNDB3VuaTFFQ0QHdW5pMUVDRQd1bmkxRUNGB3VuaTFFRDAHdW5pMUVEMQd1bmkxRUQyB3VuaTFFRDMHdW5pMUVENAd1bmkxRUQ1B3VuaTFFRDYHdW5pMUVENwd1bmkxRUQ4B3VuaTFFRDkHdW5pMUVEQQd1bmkxRURCB3VuaTFFREMHdW5pMUVERAd1bmkxRURFB3VuaTFFREYHdW5pMUVFMAd1bmkxRUUxB3VuaTFFRTIHdW5pMUVFMwd1bmkxRUU0B3VuaTFFRTUHdW5pMUVFNgd1bmkxRUU3B3VuaTFFRTgHdW5pMUVFOQd1bmkxRUVBB3VuaTFFRUIHdW5pMUVFQwd1bmkxRUVEB3VuaTFFRUUHdW5pMUVFRgd1bmkxRUYwB3VuaTFFRjEHdW5pMUVGNAd1bmkxRUY1B3VuaTFFRjYHdW5pMUVGNwd1bmkxRUY4B3VuaTFFRjkGZGNyb2F0B3VuaTIwQUIHdW5pMDQ5QQd1bmkwNDlCB3VuaTA0QTIHdW5pMDRBMwd1bmkwNEFDB3VuaTA0QUQHdW5pMDRCMgd1bmkwNEIzB3VuaTA0QjYHdW5pMDRCNwd1bmkwNENCB3VuaTA0Q0MHdW5pMDRGNgd1bmkwNEY3B3VuaTA0OTYHdW5pMDQ5Nwd1bmkwNEJFB3VuaTA0QkYHdW5pMDRCQgd1bmkwNDhDB3VuaTA0NjIHdW5pMDQ5Mgd1bmkwNDkzB3VuaTA0OUUHdW5pMDQ5Rgd1bmkwNDhBB3VuaTA0OEIHdW5pMDRDOQd1bmkwNENBB3VuaTA0Q0QHdW5pMDRDRQd1bmkwNEM1B3VuaTA0QzYHdW5pMDRCMAd1bmkwNEIxB3VuaTA0RkUHdW5pMDRGRgd1bmkwNTExB3VuaTIwMTUHdW5pMDAwMgAAAAEAAAAMAAAAAAAAAAIACADKAMoAAQEeASQAAQFWAWEAAQF2AXYAAQF7AXwAAQF+AX4AAQGTAZUAAQHVAdUAAQAAAAAAAAAAAAEAAAAKAB4ALAABREZMVAAIAAQAAAAA//8AAQAAAAFrZXJuAAgAAAABAAAAAQAEAAIAAAAEAA5PUFUOekAAAYG8AAQAAAGtA2QDagNwA3YD7AP2BAgELgREBE4EcASSBJgE6gUYBToFXAWCBagFrgacBqIGyAbuB1AH4ggECCYIRAhKCFgIXghkCGoIkAiuCLwI2gjgCP4JHAkiCewKYgqICv4LBAsOCxQLGgsgCz4LaAtuC4QLiguoC64LtAvuC/QL/gwwDFoMhAyqDMwM8g0gDYINmA26DdwOJg5IDmoOoA7KDvQO/g8IDyYPPA9GD2QPag+AD84P7BAKECgQThB0EJIQnBDCEOgRDhGEEaoR0BHuEgwS1hLgEzIThBOOE5QTmhOgE6YTrBPSE9wT4hP0FB4UNBRGFFgUfhSEFJoUpBS2FNwU8hT4FP4VBBUeFSwVMhVYFX4WbBbiF1gXzhhEGLoZMBmmGbgZzhnkGfoaEBoyGlQadhqYGroa4BsGGywbUht4G34bhBuKG5AcIhxEHGYciByqHMwc7h0QHRYdHB0iHSgdLh1UHXodoB3GHeweCh4oHp4ewB82H1gfzh/wIAIgFCAmIDggXiB0IHogkCCWIKwgsiDIIM4g5CDqIQwhEiE0IVYheCGaIbwhwiIUIkIicCKeIswi7iL0IxYjHCM+I0QjSiNwI5YjvCPiJAgkLiQ8JEokWCVGJjQnIicoJy4nNCc6J0AnRidsJ/4oHCiuKNAo8ikUKYopoCnCKeQqCiqcKxIrHCsyK1QrdiuYK+osDCwuLFQsei1oLfouXC5+LxAvFi88L1ovgC+WMGAwgjCkMKow/DFOMZgyDjIYMuIy+DMaMzwzYjOIM5o0iDTqNQw1EjU4NVY1dDV6NYA1ijWoNc419DYaNqw2yjbQNtY23Db+NwQ3ejecN8I32DfeOAQ4Ijg0OMY45DkGOWg5bjmQOgY6KDqeOsA61jrcOuI66DtKO1A7djucO8I74DwqPEg8kjywPPo9GD16PYA99j4YPo4+sD8mP0g/vj/gQFZAeEDuQRBBhkGoQh5CQEK2QthDTkNwQ+ZECER+RKBEtkS8RNJE2ETuRPRFCkUQRSZFLEVCRUhFXkVkRXpFgEWiRcRF6kYQRjZGXEaCRqhGzkb0RxpHQEdmR4xHskfYR/5IBEgKSJxIuklMSWpJ/EoaSmxKjkt8S95L5EyuTLhNGk0gTSZNUE4aTmxOjk6wAAEAWQALAAEAWQALAAEAEf8IAB0AIf+vAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygD5/9ABL/+BATj/ZQE5/4UBO/9mATz/3QFB//IBSf+xAUv/ygFT/6kBVP/IAaz/9QG0//UBuP/HAbn/8QG6/80Bu//dAb3/xAACAQwACwFT/+YABAAL/+YAP//0AF//7wE8/+0ACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABpv/tAbz/9QAFAEj/7gBZ/+oBuv/wAbv/7QG9//AAAgBU/+YBpv/AAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAAQGm/+sAFABZ/8EAs//FAMX/tADl/9cA8f+5APn/6QEE/7IBF//SARv/yAEv/6ABOf/FAUH/5AFK/8wBTP/MAVT/ywFV/+8BqP/oAaz/5gG0/+cBtf/nAAsAWf/MAaYAEwGo//MBrP/xAbT/8gG1//IBuP+9Abn/7gG6/7gBu//XAb3/twAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAab/7QG8//UACQBWAA4Af/7XAL//mADC/8cA1P8SAOj/UgFG/88Bpv+AAd//1wABAaYADgA7AFT/vwBZ/9EAa/9sAHr/bgB//0MAhP+sAIf/oQCz/7gAuv9+AL7/ewDB/5sAwv95AMX/sgDH/34AyP99AMn/fADU/68A4QAPAOX/5ADm/6AA6P90AOr/gADx/7IA+P99APn/sgD6/4AA/P95AP0AKAEC/30BBP9/ARf/ZgEb/9oBJ/+BASn/mAEt/30BL/+zATP/oAE5/3wBO/+aATz/bAFB/+YBRv9rAUr/kgFM/60BUP97AVMADwFU/5EBVf/yAab/rwGo/7kBrP+5AbT/uQG1/7kBt/+8Abj/8QG7//EBvP/tAdz/swHf//EAAQGm/+sACQALABQAPwARAFT/4gBfABMBpv+0Aaj/2QGs/9kBtP/ZAbX/2QAJAAsADwA/AAwAVP/rAF8ADgGm/8sBqP/pAaz/5wG0/+cBtf/nABgAs//UAL3/7QC/ABEAxf/gAMf/5wDI/+UAyf/uANQAEgDl/+kA8f/XAS//1wE5/9MBO//WATz/xQFB/+cBSQANAUsADAFU/9YBVf/yAaj/6QGs/+cBtP/nAbX/6QHf//AAJAAI/+IACwAUAAz/zwA/ABIASP/qAFT/2ABW/+oAXwATAGv/rgB6/80Af/+gAIT/wQCH/8AAs//QALf/6gC6/8YAuwANAL3/6QC+/9YAwf/oAML/ugDF/+kAx//LAMj/2gDJ/8cBbv/TAab/qwGo/80BrP/LAbT/ywG1/8sBuP/zAbv/8wG8/+8B3P/AAd//7gAIAFn/5QCz/8sAyP/kAaYADQGo/+0BrP/rAbT/7AG1/+wACADx//AA+f/wAQT/8QEb//MBL//xAUr/8wFM//MBVP/xAAcAxf/qAOj/7gDx/9YA+f/tAS//7AFU/+wB3P/oAAEA8f/1AAMACwAUAD8AEgBfABMAAQDx/9YAAQDx/9YAAQDx/9YACQDF/+oA6P+4APH/4gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAHAMX/6gDo/+4A8f/WAPn/7QEv/+wBVP/sAdz/6AADAEgAFABWABgAWQARAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1AAEBF//xAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1AAcAxf/qAOj/7gDx/9YA+f/tAS//7AFU/+wB3P/oAAEA8f/1ADIAVP9+AFn/nQBr/vEAev70AH/+qwCE/14Ah/9LALP/cgC6/w8Avv8KAMH/QQDC/wcAxf9oAMf/DwDI/w4Ayf8MANT/YwDhAAUA5f+9AOb/SQDo/v4A6v8TAPH/aAD4/w4A+f9oAPr/EwD8/wcA/QAwAQL/DgEE/xEBF/7nARv/rAEn/xUBKf88AS3/DgEv/2oBM/9JATn/DAE7/z8BPP7xAUH/wAFG/u8BSv8xAUz/XwFQ/woBUwAFAVT/MAFV/9UB3P9qAd//0wAdACH/rwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oA+f/QAS//gQE4/2UBOf+FATv/ZgE8/90BQf/yAUn/sQFL/8oBU/+pAVT/yAGs//UBtP/1Abj/xwG5//EBuv/NAbv/3QG9/8QACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABpv/tAbz/9QAdACH/rwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oA+f/QAS//gQE4/2UBOf+FATv/ZgE8/90BQf/yAUn/sQFL/8oBU/+pAVT/yAGs//UBtP/1Abj/xwG5//EBuv/NAbv/3QG9/8QAAQC/AA0AAgCz/8IAvwAQAAEAv//iAAEAwv/yAAEAvwAOAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1AAoAuv/mAL3/6wC+/+kAwP/wAMH/5wDF/+MAx//OAMj/1ADJ/9sB3//uAAEA8f/WAAUAvf/sAL8ADwDB/+oAxf/OAMf/5wABAL8ADwAHAMX/6gDo/+4A8f/VAPn/7QEv/+wBVP/sAdz/6AABAPH/wAABAMUAIAAOAEgADAC//5AAwQALAMUADAGm/78BqP/uAaz/7AG0/+0Btf/sAbf/9QG4AA4BugANAb0ADQHf/+0AAQDx/+IAAgDx/8AB3P/hAAwA4f/UAPH/yQD5/9EBBP/lARv/4wEv/8QBOP/hAUn/1AFK//UBS//nAVP/ZAFU/8kACgDh/8EA8f/NAPn/0gEv/8wBOP/lATv/3wFJ/84BS//qAVP/ngFU/84ACgDh/8IA8f/GAPn/zwEv/8ABOP/hATv/3wFJ/80BS//oAVP/nwFU/8YACQDh/8kA8f/fAPn/4QEE/+0BG//rAS//3wE7/+kBSv/1AVT/4AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACQDh/+YA8f/QAPn/1gEv/84BOP/oAUn/5wFL/+0BU//mAVT/0AALANQAFADh/+AA6AATATj/4QE5/+ABPP/hAUH/6QFJ/98BS//eAVP/3wFV//IAGACz/9QAvf/tAL8AEQDF/+AAx//nAMj/5QDJ/+4A1AASAOX/6QDx/9cBL//XATn/0wE7/9YBPP/FAUH/5wFJAA0BSwAMAVT/1gFV//IBqP/pAaz/5wG0/+cBtf/pAd//8AAFABn/8gDh//EBSf/yAUv/8gFT//IACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AASANT/rgDhABIA5v/gAOj/rQDq/9YA+P/fAPz/0gEC/+ABF//OASf/3QEp/+IBLf/gATP/4AE5/+kBPP/aAUb/vQFQ/98BUwARAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QADQDUABMA4f/mAOL/9ADoABIA8f/nAPn/5wEv/+cBOP/lATn/6AFJ/+YBS//mAVP/5gFU/+cACgDh/8QA8f/NAPn/1QEv/8wBOP/mATv/3wFJ/9EBS//sAVP/oQFU/88ACgDh/8MA8f/PAPn/1AEv/84BOP/nATv/3wFJ/9EBS//sAVP/oAFU/9EAAgDU/+IBU//kAAIA1P/hAOj/5AAHAOj/7gDx/+4A+f/vAQT/9AEb//EBL//vAVT/7wAFAPH/9AD5//QBBP/1AS//9QFU//UAAgDo/2gBF//uAAcA6AAUAPH/7QD3/9AA+f/uAS//7QE5/+0BVP/tAAEBF//xAAUBF//rAaj/6wGs/+kBtP/rAbX/6wATAEgADQDC/9YAw//AAMf/1QDo/8gBF//sARsADAFKAAsBTAALAab/vwGo/+4BrP/sAbT/7QG1/+wBt//1AbgADgG6AA0BvQANAd//xAAHAMX/6gDo/+4A8f/WAPn/7QEv/+wBVP/sAdz/6AAHAOgAFADx//AA+f/wAPwAFgEv/+YBOf/cAVT/8AAHAOgAEgDx/+MA9/+4APn/4wEv/7oBOf/ZAVT/4wAJAPH/gAD5//ABBP/bARv/3AEv/0cBOf/uAUoABwFM//QBVP9/AAkA8f9qAPn/xgEE/9kBG//bAS//HgE5/+0BSv/wAUz/8gFU/1YABwDF/+oA6P/uAPH/1gD5/+0BL//sAVT/7AHc/+gAAgDo/+8A+f/uAAkA8f92APn/0wEE/9kBG//bAS//HgE5/+0BSv/wAUz/8gFU/1YACQDx/2QA+f/ZAQT/2QEb/9sBL/8eATn/7QFK//ABTP/yAVT/VgAJAPH/agD5/8YBBP/ZARv/2wEv/x4BOf/tAUr/8AFM//IBVP9WAB0AIf+vAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygD5/9ABL/+BATj/ZQE5/4UBO/9mATz/3QFB//IBSf+xAUv/ygFT/6kBVP/IAaz/9QG0//UBuP/HAbn/8QG6/80Bu//dAb3/xAAJAMX/6gDo/7gA8f/iAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAkACwAUAD8AEQBU/+IAXwATAab/tAGo/9kBrP/ZAbT/2QG1/9kABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UABwDF/+oA6P/uAPH/1gD5/+0BL//sAVT/7AHc/+gAMgBU/34AWf+dAGv+8QB6/vQAf/6rAIT/XgCH/0sAs/9yALr/DwC+/woAwf9BAML/BwDF/2gAx/8PAMj/DgDJ/wwA1P9jAOEABQDl/70A5v9JAOj+/gDq/xMA8f9oAPj/DgD5/2gA+v8TAPz/BwD9ADABAv8OAQT/EQEX/ucBG/+sASf/FQEp/zwBLf8OAS//agEz/0kBOf8MATv/PwE8/vEBQf/AAUb+7wFK/zEBTP9fAVD/CgFTAAUBVP8wAVX/1QHc/2oB3//TAAIA6P9oARf/7gAUAFn/wQCz/8UAxf+0AOX/1wDx/7kA+f/pAQT/sgEX/9IBG//IAS//oAE5/8UBQf/kAUr/zAFM/8wBVP/LAVX/7wGo/+gBrP/mAbT/5wG1/+cAFABZ/8EAs//FAMX/tADl/9cA8f+5APn/6QEE/7IBF//SARv/yAEv/6ABOf/FAUH/5AFK/8wBTP/MAVT/ywFV/+8BqP/oAaz/5gG0/+cBtf/nAAIA6P9oARf/7gABAFkACwABAFkACwABAFkACwABAFkACwABAFkACwAJAaj/8gGs//IBtP/yAbX/8gG4/8ABuf/sAbr/xwG7/9gBvf+/AAIBuv/uAbv/9QABAab/0gAEAaj/6wGs/+kBtP/rAbX/6wAKAaYAEQGo//ABrP/uAbT/7wG1//ABuP+7Abn/7AG6/7cBu//VAb3/tAAFAab/8wG4/+4Buv/xAbz/7AG9/+oABAG4/+kBuv/rAbv/8QG9/+UABAG4//IBuv/xAbv/9QG9/+4ACQGm/78BqP/uAaz/7AG0/+0Btf/sAbf/9QG4AA4BugANAb0ADQABAab/7wAFAab/xwGo//IBrP/wAbT/8AG1//AAAgGm/9wBuAAOAAQBqP/tAaz/6wG0/+sBtf/rAAkBpv/AAaj/7QGs/+sBtP/rAbX/6wG4AA8BugAQAbsADQG9ABAABQGmAAwBqP/wAaz/8AG0//ABtf/wAAEB1//VAAEBxP/VAAEB1/9AAAYASAALALr/8gDH//EAyf/vAdwADwHf/+4AAwDF/+0A8f/VAdz/7AABAab/1QAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGm/+0BvP/1AAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAab/7QG8//UAOwBU/78AWf/RAGv/bAB6/24Af/9DAIT/rACH/6EAs/+4ALr/fgC+/3sAwf+bAML/eQDF/7IAx/9+AMj/fQDJ/3wA1P+vAOEADwDl/+QA5v+gAOj/dADq/4AA8f+yAPj/fQD5/7IA+v+AAPz/eQD9ACgBAv99AQT/fwEX/2YBG//aASf/gQEp/5gBLf99AS//swEz/6ABOf98ATv/mgE8/2wBQf/mAUb/awFK/5IBTP+tAVD/ewFTAA8BVP+RAVX/8gGm/68BqP+5Aaz/uQG0/7kBtf+5Abf/vAG4//EBu//xAbz/7QHc/7MB3//xAB0AIf+vAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygD5/9ABL/+BATj/ZQE5/4UBO/9mATz/3QFB//IBSf+xAUv/ygFT/6kBVP/IAaz/9QG0//UBuP/HAbn/8QG6/80Bu//dAb3/xAAdACH/rwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oA+f/QAS//gQE4/2UBOf+FATv/ZgE8/90BQf/yAUn/sQFL/8oBU/+pAVT/yAGs//UBtP/1Abj/xwG5//EBuv/NAbv/3QG9/8QAHQAh/68AVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAPn/0AEv/4EBOP9lATn/hQE7/2YBPP/dAUH/8gFJ/7EBS//KAVP/qQFU/8gBrP/1AbT/9QG4/8cBuf/xAbr/zQG7/90Bvf/EAB0AIf+vAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygD5/9ABL/+BATj/ZQE5/4UBO/9mATz/3QFB//IBSf+xAUv/ygFT/6kBVP/IAaz/9QG0//UBuP/HAbn/8QG6/80Bu//dAb3/xAAdACH/rwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oA+f/QAS//gQE4/2UBOf+FATv/ZgE8/90BQf/yAUn/sQFL/8oBU/+pAVT/yAGs//UBtP/1Abj/xwG5//EBuv/NAbv/3QG9/8QAHQAh/68AVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAPn/0AEv/4EBOP9lATn/hQE7/2YBPP/dAUH/8gFJ/7EBS//KAVP/qQFU/8gBrP/1AbT/9QG4/8cBuf/xAbr/zQG7/90Bvf/EAB0AIf+vAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygD5/9ABL/+BATj/ZQE5/4UBO/9mATz/3QFB//IBSf+xAUv/ygFT/6kBVP/IAaz/9QG0//UBuP/HAbn/8QG6/80Bu//dAb3/xAAEAAv/5gA///QAX//vATz/7QAFAEj/7gBZ/+oBuv/wAbv/7QG9//AABQBI/+4AWf/qAbr/8AG7/+0Bvf/wAAUASP/uAFn/6gG6//ABu//tAb3/8AAFAEj/7gBZ/+oBuv/wAbv/7QG9//AACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGm/+0BvP/1AAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAab/7QG8//UACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABpv/tAbz/9QAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGm/+0BvP/1AAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAab/7QG8//UAAQGm/+sAAQGm/+sAAQGm/+sAAQGm/+sAJAAI/+IACwAUAAz/zwA/ABIASP/qAFT/2ABW/+oAXwATAGv/rgB6/80Af/+gAIT/wQCH/8AAs//QALf/6gC6/8YAuwANAL3/6QC+/9YAwf/oAML/ugDF/+kAx//LAMj/2gDJ/8cBbv/TAab/qwGo/80BrP/LAbT/ywG1/8sBuP/zAbv/8wG8/+8B3P/AAd//7gAIAPH/8AD5//ABBP/xARv/8wEv//EBSv/zAUz/8wFU//EACADx//AA+f/wAQT/8QEb//MBL//xAUr/8wFM//MBVP/xAAgA8f/wAPn/8AEE//EBG//zAS//8QFK//MBTP/zAVT/8QAIAPH/8AD5//ABBP/xARv/8wEv//EBSv/zAUz/8wFU//EACADx//AA+f/wAQT/8QEb//MBL//xAUr/8wFM//MBVP/xAAgA8f/wAPn/8AEE//EBG//zAS//8QFK//MBTP/zAVT/8QAIAPH/8AD5//ABBP/xARv/8wEv//EBSv/zAUz/8wFU//EAAQDx//UAAQDx//UAAQDx//UAAQDx//UAAQDx/9YACQDF/+oA6P+4APH/4gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAMX/6gDo/7gA8f/iAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAkAxf/qAOj/uADx/+IBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQDF/+oA6P+4APH/4gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAMX/6gDo/7gA8f/iAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1AAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1AB0AIf+vAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygD5/9ABL/+BATj/ZQE5/4UBO/9mATz/3QFB//IBSf+xAUv/ygFT/6kBVP/IAaz/9QG0//UBuP/HAbn/8QG6/80Bu//dAb3/xAAIAPH/8AD5//ABBP/xARv/8wEv//EBSv/zAUz/8wFU//EAHQAh/68AVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAPn/0AEv/4EBOP9lATn/hQE7/2YBPP/dAUH/8gFJ/7EBS//KAVP/qQFU/8gBrP/1AbT/9QG4/8cBuf/xAbr/zQG7/90Bvf/EAAgA8f/wAPn/8AEE//EBG//zAS//8QFK//MBTP/zAVT/8QAdACH/rwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oA+f/QAS//gQE4/2UBOf+FATv/ZgE8/90BQf/yAUn/sQFL/8oBU/+pAVT/yAGs//UBtP/1Abj/xwG5//EBuv/NAbv/3QG9/8QACADx//AA+f/wAQT/8QEb//MBL//xAUr/8wFM//MBVP/xAAQAC//mAD//9ABf/+8BPP/tAAQAC//mAD//9ABf/+8BPP/tAAQAC//mAD//9ABf/+8BPP/tAAQAC//mAD//9ABf/+8BPP/tAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAab/7QG8//UABQBI/+4AWf/qAbr/8AG7/+0Bvf/wAAEA8f/1AAUASP/uAFn/6gG6//ABu//tAb3/8AABAPH/9QAFAEj/7gBZ/+oBuv/wAbv/7QG9//AAAQDx//UABQBI/+4AWf/qAbr/8AG7/+0Bvf/wAAEA8f/1AAUASP/uAFn/6gG6//ABu//tAb3/8AABAPH/9QAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAAQDx/9YACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AABAab/6wAUAFn/wQCz/8UAxf+0AOX/1wDx/7kA+f/pAQT/sgEX/9IBG//IAS//oAE5/8UBQf/kAUr/zAFM/8wBVP/LAVX/7wGo/+gBrP/mAbT/5wG1/+cACwBZ/8wBpgATAaj/8wGs//EBtP/yAbX/8gG4/70Buf/uAbr/uAG7/9cBvf+3AAsAWf/MAaYAEwGo//MBrP/xAbT/8gG1//IBuP+9Abn/7gG6/7gBu//XAb3/twALAFn/zAGmABMBqP/zAaz/8QG0//IBtf/yAbj/vQG5/+4Buv+4Abv/1wG9/7cACwBZ/8wBpgATAaj/8wGs//EBtP/yAbX/8gG4/70Buf/uAbr/uAG7/9cBvf+3AAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AABAPH/1gAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAAQDx/9YACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAEA8f/WAAEA8f/WAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAab/7QG8//UACQDF/+oA6P+4APH/4gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGm/+0BvP/1AAkAxf/qAOj/uADx/+IBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABpv/tAbz/9QAJAMX/6gDo/7gA8f/iAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAMASAAUAFYAGABZABEAAwBIABQAVgAYAFkAEQADAEgAFABWABgAWQARADsAVP+/AFn/0QBr/2wAev9uAH//QwCE/6wAh/+hALP/uAC6/34Avv97AMH/mwDC/3kAxf+yAMf/fgDI/30Ayf98ANT/rwDhAA8A5f/kAOb/oADo/3QA6v+AAPH/sgD4/30A+f+yAPr/gAD8/3kA/QAoAQL/fQEE/38BF/9mARv/2gEn/4EBKf+YAS3/fQEv/7MBM/+gATn/fAE7/5oBPP9sAUH/5gFG/2sBSv+SAUz/rQFQ/3sBUwAPAVT/kQFV//IBpv+vAaj/uQGs/7kBtP+5AbX/uQG3/7wBuP/xAbv/8QG8/+0B3P+zAd//8QA7AFT/vwBZ/9EAa/9sAHr/bgB//0MAhP+sAIf/oQCz/7gAuv9+AL7/ewDB/5sAwv95AMX/sgDH/34AyP99AMn/fADU/68A4QAPAOX/5ADm/6AA6P90AOr/gADx/7IA+P99APn/sgD6/4AA/P95AP0AKAEC/30BBP9/ARf/ZgEb/9oBJ/+BASn/mAEt/30BL/+zATP/oAE5/3wBO/+aATz/bAFB/+YBRv9rAUr/kgFM/60BUP97AVMADwFU/5EBVf/yAab/rwGo/7kBrP+5AbT/uQG1/7kBt/+8Abj/8QG7//EBvP/tAdz/swHf//EAOwBU/78AWf/RAGv/bAB6/24Af/9DAIT/rACH/6EAs/+4ALr/fgC+/3sAwf+bAML/eQDF/7IAx/9+AMj/fQDJ/3wA1P+vAOEADwDl/+QA5v+gAOj/dADq/4AA8f+yAPj/fQD5/7IA+v+AAPz/eQD9ACgBAv99AQT/fwEX/2YBG//aASf/gQEp/5gBLf99AS//swEz/6ABOf98ATv/mgE8/2wBQf/mAUb/awFK/5IBTP+tAVD/ewFTAA8BVP+RAVX/8gGm/68BqP+5Aaz/uQG0/7kBtf+5Abf/vAG4//EBu//xAbz/7QHc/7MB3//xAAEBpv/rAAEBpv/rAAEBpv/rAAEBpv/rAAEBpv/rAAEBpv/rAAkACwAPAD8ADABU/+sAXwAOAab/ywGo/+kBrP/nAbT/5wG1/+cAJAAI/+IACwAUAAz/zwA/ABIASP/qAFT/2ABW/+oAXwATAGv/rgB6/80Af/+gAIT/wQCH/8AAs//QALf/6gC6/8YAuwANAL3/6QC+/9YAwf/oAML/ugDF/+kAx//LAMj/2gDJ/8cBbv/TAab/qwGo/80BrP/LAbT/ywG1/8sBuP/zAbv/8wG8/+8B3P/AAd//7gAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBpv+rAaj/zQGs/8sBtP/LAbX/ywG4//MBu//zAbz/7wHc/8AB3//uAAgAWf/lALP/ywDI/+QBpgANAaj/7QGs/+sBtP/sAbX/7AAIAFn/5QCz/8sAyP/kAaYADQGo/+0BrP/rAbT/7AG1/+wACABZ/+UAs//LAMj/5AGmAA0BqP/tAaz/6wG0/+wBtf/sAB0AIf+vAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygD5/9ABL/+BATj/ZQE5/4UBO/9mATz/3QFB//IBSf+xAUv/ygFT/6kBVP/IAaz/9QG0//UBuP/HAbn/8QG6/80Bu//dAb3/xAAFAEj/7gBZ/+oBuv/wAbv/7QG9//AACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGm/+0BvP/1ACQACP/iAAsAFAAM/88APwASAEj/6gBU/9gAVv/qAF8AEwBr/64Aev/NAH//oACE/8EAh//AALP/0AC3/+oAuv/GALsADQC9/+kAvv/WAMH/6ADC/7oAxf/pAMf/ywDI/9oAyf/HAW7/0wGm/6sBqP/NAaz/ywG0/8sBtf/LAbj/8wG7//MBvP/vAdz/wAHf/+4AHQAh/68AVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAPn/0AEv/4EBOP9lATn/hQE7/2YBPP/dAUH/8gFJ/7EBS//KAVP/qQFU/8gBrP/1AbT/9QG4/8cBuf/xAbr/zQG7/90Bvf/EAAIBDAALAVP/5gAFAEj/7gBZ/+oBuv/wAbv/7QG9//AACABZ/+UAs//LAMj/5AGmAA0BqP/tAaz/6wG0/+wBtf/sAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAFABZ/8EAs//FAMX/tADl/9cA8f+5APn/6QEE/7IBF//SARv/yAEv/6ABOf/FAUH/5AFK/8wBTP/MAVT/ywFV/+8BqP/oAaz/5gG0/+cBtf/nAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABpv/tAbz/9QAJAFYADgB//tcAv/+YAML/xwDU/xIA6P9SAUb/zwGm/4AB3//XADsAVP+/AFn/0QBr/2wAev9uAH//QwCE/6wAh/+hALP/uAC6/34Avv97AMH/mwDC/3kAxf+yAMf/fgDI/30Ayf98ANT/rwDhAA8A5f/kAOb/oADo/3QA6v+AAPH/sgD4/30A+f+yAPr/gAD8/3kA/QAoAQL/fQEE/38BF/9mARv/2gEn/4EBKf+YAS3/fQEv/7MBM/+gATn/fAE7/5oBPP9sAUH/5gFG/2sBSv+SAUz/rQFQ/3sBUwAPAVT/kQFV//IBpv+vAaj/uQGs/7kBtP+5AbX/uQG3/7wBuP/xAbv/8QG8/+0B3P+zAd//8QAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBpv+rAaj/zQGs/8sBtP/LAbX/ywG4//MBu//zAbz/7wHc/8AB3//uABgAs//UAL3/7QC/ABEAxf/gAMf/5wDI/+UAyf/uANQAEgDl/+kA8f/XAS//1wE5/9MBO//WATz/xQFB/+cBSQANAUsADAFU/9YBVf/yAaj/6QGs/+cBtP/nAbX/6QHf//AACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kACQACP/iAAsAFAAM/88APwASAEj/6gBU/9gAVv/qAF8AEwBr/64Aev/NAH//oACE/8EAh//AALP/0AC3/+oAuv/GALsADQC9/+kAvv/WAMH/6ADC/7oAxf/pAMf/ywDI/9oAyf/HAW7/0wGm/6sBqP/NAaz/ywG0/8sBtf/LAbj/8wG7//MBvP/vAdz/wAHf/+4AAQDx/9YACQDF/+oA6P+4APH/4gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAJAMX/6gDo/7gA8f/iAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAUASP/uAFn/6gG6//ABu//tAb3/8AAyAFT/fgBZ/50Aa/7xAHr+9AB//qsAhP9eAIf/SwCz/3IAuv8PAL7/CgDB/0EAwv8HAMX/aADH/w8AyP8OAMn/DADU/2MA4QAFAOX/vQDm/0kA6P7+AOr/EwDx/2gA+P8OAPn/aAD6/xMA/P8HAP0AMAEC/w4BBP8RARf+5wEb/6wBJ/8VASn/PAEt/w4BL/9qATP/SQE5/wwBO/8/ATz+8QFB/8ABRv7vAUr/MQFM/18BUP8KAVMABQFU/zABVf/VAdz/agHf/9MACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AABAab/6wAUAFn/wQCz/8UAxf+0AOX/1wDx/7kA+f/pAQT/sgEX/9IBG//IAS//oAE5/8UBQf/kAUr/zAFM/8wBVP/LAVX/7wGo/+gBrP/mAbT/5wG1/+cAFABZ/8EAs//FAMX/tADl/9cA8f+5APn/6QEE/7IBF//SARv/yAEv/6ABOf/FAUH/5AFK/8wBTP/MAVT/ywFV/+8BqP/oAaz/5gG0/+cBtf/nABIA1P+uAOEAEgDm/+AA6P+tAOr/1gD4/98A/P/SAQL/4AEX/84BJ//dASn/4gEt/+ABM//gATn/6QE8/9oBRv+9AVD/3wFTABEAHQAh/68AVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAPn/0AEv/4EBOP9lATn/hQE7/2YBPP/dAUH/8gFJ/7EBS//KAVP/qQFU/8gBrP/1AbT/9QG4/8cBuf/xAbr/zQG7/90Bvf/EAAIBDAALAVP/5gAyAFT/fgBZ/50Aa/7xAHr+9AB//qsAhP9eAIf/SwCz/3IAuv8PAL7/CgDB/0EAwv8HAMX/aADH/w8AyP8OAMn/DADU/2MA4QAFAOX/vQDm/0kA6P7+AOr/EwDx/2gA+P8OAPn/aAD6/xMA/P8HAP0AMAEC/w4BBP8RARf+5wEb/6wBJ/8VASn/PAEt/w4BL/9qATP/SQE5/wwBO/8/ATz+8QFB/8ABRv7vAUr/MQFM/18BUP8KAVMABQFU/zABVf/VAdz/agHf/9MABQBI/+4AWf/qAbr/8AG7/+0Bvf/wAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABpv/tAbz/9QAJAFYADgB//tcAv/+YAML/xwDU/xIA6P9SAUb/zwGm/4AB3//XAAQAC//mAD//9ABf/+8BPP/tADsAVP+/AFn/0QBr/2wAev9uAH//QwCE/6wAh/+hALP/uAC6/34Avv97AMH/mwDC/3kAxf+yAMf/fgDI/30Ayf98ANT/rwDhAA8A5f/kAOb/oADo/3QA6v+AAPH/sgD4/30A+f+yAPr/gAD8/3kA/QAoAQL/fQEE/38BF/9mARv/2gEn/4EBKf+YAS3/fQEv/7MBM/+gATn/fAE7/5oBPP9sAUH/5gFG/2sBSv+SAUz/rQFQ/3sBUwAPAVT/kQFV//IBpv+vAaj/uQGs/7kBtP+5AbX/uQG3/7wBuP/xAbv/8QG8/+0B3P+zAd//8QAYALP/1AC9/+0AvwARAMX/4ADH/+cAyP/lAMn/7gDUABIA5f/pAPH/1wEv/9cBOf/TATv/1gE8/8UBQf/nAUkADQFLAAwBVP/WAVX/8gGo/+kBrP/nAbT/5wG1/+kB3//wAAgA8f/wAPn/8AEE//EBG//zAS//8QFK//MBTP/zAVT/8QABAPH/9QAJAMX/6gDo/7gA8f/iAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAcAxf/qAOj/7gDx/9YA+f/tAS//7AFU/+wB3P/oAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1AAEBF//xAAEA8f/1AAIA6P9oARf/7gAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAJAAsADwA/AAwAVP/rAF8ADgGm/8sBqP/pAaz/5wG0/+cBtf/nAAkACwAPAD8ADABU/+sAXwAOAab/ywGo/+kBrP/nAbT/5wG1/+cACQALAA8APwAMAFT/6wBfAA4Bpv/LAaj/6QGs/+cBtP/nAbX/5wAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBpv+rAaj/zQGs/8sBtP/LAbX/ywG4//MBu//zAbz/7wHc/8AB3//uAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1AAEAWQALAAEAWQALAAEAWQALAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AABAPH/1gAdACH/rwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oA+f/QAS//gQE4/2UBOf+FATv/ZgE8/90BQf/yAUn/sQFL/8oBU/+pAVT/yAGs//UBtP/1Abj/xwG5//EBuv/NAbv/3QG9/8QACADx//AA+f/wAQT/8QEb//MBL//xAUr/8wFM//MBVP/xAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAab/7QG8//UABQBI/+4AWf/qAbr/8AG7/+0Bvf/wAAEA8f/1AAkACwAUAD8AEQBU/+IAXwATAab/tAGo/9kBrP/ZAbT/2QG1/9kABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UABAAL/+YAP//0AF//7wE8/+0AJAAI/+IACwAUAAz/zwA/ABIASP/qAFT/2ABW/+oAXwATAGv/rgB6/80Af/+gAIT/wQCH/8AAs//QALf/6gC6/8YAuwANAL3/6QC+/9YAwf/oAML/ugDF/+kAx//LAMj/2gDJ/8cBbv/TAab/qwGo/80BrP/LAbT/ywG1/8sBuP/zAbv/8wG8/+8B3P/AAd//7gAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAGACz/9QAvf/tAL8AEQDF/+AAx//nAMj/5QDJ/+4A1AASAOX/6QDx/9cBL//XATn/0wE7/9YBPP/FAUH/5wFJAA0BSwAMAVT/1gFV//IBqP/pAaz/5wG0/+cBtf/pAd//8AABARf/8QAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAHQAh/68AVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAPn/0AEv/4EBOP9lATn/hQE7/2YBPP/dAUH/8gFJ/7EBS//KAVP/qQFU/8gBrP/1AbT/9QG4/8cBuf/xAbr/zQG7/90Bvf/EAAgA8f/wAPn/8AEE//EBG//zAS//8QFK//MBTP/zAVT/8QAdACH/rwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oA+f/QAS//gQE4/2UBOf+FATv/ZgE8/90BQf/yAUn/sQFL/8oBU/+pAVT/yAGs//UBtP/1Abj/xwG5//EBuv/NAbv/3QG9/8QACADx//AA+f/wAQT/8QEb//MBL//xAUr/8wFM//MBVP/xAAUASP/uAFn/6gG6//ABu//tAb3/8AABAPH/9QABAPH/9QABAPH/9QAYALP/1AC9/+0AvwARAMX/4ADH/+cAyP/lAMn/7gDUABIA5f/pAPH/1wEv/9cBOf/TATv/1gE8/8UBQf/nAUkADQFLAAwBVP/WAVX/8gGo/+kBrP/nAbT/5wG1/+kB3//wAAEBF//xAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAab/7QG8//UACQDF/+oA6P+4APH/4gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAMX/6gDo/7gA8f/iAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAcAxf/qAOj/7gDx/9YA+f/tAS//7AFU/+wB3P/oABIA1P+uAOEAEgDm/+AA6P+tAOr/1gD4/98A/P/SAQL/4AEX/84BJ//dASn/4gEt/+ABM//gATn/6QE8/9oBRv+9AVD/3wFTABEABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UAEgDU/64A4QASAOb/4ADo/60A6v/WAPj/3wD8/9IBAv/gARf/zgEn/90BKf/iAS3/4AEz/+ABOf/pATz/2gFG/70BUP/fAVMAEQAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QASANT/rgDhABIA5v/gAOj/rQDq/9YA+P/fAPz/0gEC/+ABF//OASf/3QEp/+IBLf/gATP/4AE5/+kBPP/aAUb/vQFQ/98BUwARAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1ABgAs//UAL3/7QC/ABEAxf/gAMf/5wDI/+UAyf/uANQAEgDl/+kA8f/XAS//1wE5/9MBO//WATz/xQFB/+cBSQANAUsADAFU/9YBVf/yAaj/6QGs/+cBtP/nAbX/6QHf//AAAQEX//EAHQAh/68AVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAPn/0AEv/4EBOP9lATn/hQE7/2YBPP/dAUH/8gFJ/7EBS//KAVP/qQFU/8gBrP/1AbT/9QG4/8cBuf/xAbr/zQG7/90Bvf/EAAgA8f/wAPn/8AEE//EBG//zAS//8QFK//MBTP/zAVT/8QAdACH/rwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oA+f/QAS//gQE4/2UBOf+FATv/ZgE8/90BQf/yAUn/sQFL/8oBU/+pAVT/yAGs//UBtP/1Abj/xwG5//EBuv/NAbv/3QG9/8QACADx//AA+f/wAQT/8QEb//MBL//xAUr/8wFM//MBVP/xAB0AIf+vAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygD5/9ABL/+BATj/ZQE5/4UBO/9mATz/3QFB//IBSf+xAUv/ygFT/6kBVP/IAaz/9QG0//UBuP/HAbn/8QG6/80Bu//dAb3/xAAIAPH/8AD5//ABBP/xARv/8wEv//EBSv/zAUz/8wFU//EAHQAh/68AVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAPn/0AEv/4EBOP9lATn/hQE7/2YBPP/dAUH/8gFJ/7EBS//KAVP/qQFU/8gBrP/1AbT/9QG4/8cBuf/xAbr/zQG7/90Bvf/EAAgA8f/wAPn/8AEE//EBG//zAS//8QFK//MBTP/zAVT/8QAdACH/rwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oA+f/QAS//gQE4/2UBOf+FATv/ZgE8/90BQf/yAUn/sQFL/8oBU/+pAVT/yAGs//UBtP/1Abj/xwG5//EBuv/NAbv/3QG9/8QACADx//AA+f/wAQT/8QEb//MBL//xAUr/8wFM//MBVP/xAB0AIf+vAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygD5/9ABL/+BATj/ZQE5/4UBO/9mATz/3QFB//IBSf+xAUv/ygFT/6kBVP/IAaz/9QG0//UBuP/HAbn/8QG6/80Bu//dAb3/xAAIAPH/8AD5//ABBP/xARv/8wEv//EBSv/zAUz/8wFU//EAHQAh/68AVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAPn/0AEv/4EBOP9lATn/hQE7/2YBPP/dAUH/8gFJ/7EBS//KAVP/qQFU/8gBrP/1AbT/9QG4/8cBuf/xAbr/zQG7/90Bvf/EAAgA8f/wAPn/8AEE//EBG//zAS//8QFK//MBTP/zAVT/8QAdACH/rwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oA+f/QAS//gQE4/2UBOf+FATv/ZgE8/90BQf/yAUn/sQFL/8oBU/+pAVT/yAGs//UBtP/1Abj/xwG5//EBuv/NAbv/3QG9/8QACADx//AA+f/wAQT/8QEb//MBL//xAUr/8wFM//MBVP/xAB0AIf+vAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygD5/9ABL/+BATj/ZQE5/4UBO/9mATz/3QFB//IBSf+xAUv/ygFT/6kBVP/IAaz/9QG0//UBuP/HAbn/8QG6/80Bu//dAb3/xAAIAPH/8AD5//ABBP/xARv/8wEv//EBSv/zAUz/8wFU//EAHQAh/68AVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAPn/0AEv/4EBOP9lATn/hQE7/2YBPP/dAUH/8gFJ/7EBS//KAVP/qQFU/8gBrP/1AbT/9QG4/8cBuf/xAbr/zQG7/90Bvf/EAAgA8f/wAPn/8AEE//EBG//zAS//8QFK//MBTP/zAVT/8QAdACH/rwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oA+f/QAS//gQE4/2UBOf+FATv/ZgE8/90BQf/yAUn/sQFL/8oBU/+pAVT/yAGs//UBtP/1Abj/xwG5//EBuv/NAbv/3QG9/8QACADx//AA+f/wAQT/8QEb//MBL//xAUr/8wFM//MBVP/xAB0AIf+vAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygD5/9ABL/+BATj/ZQE5/4UBO/9mATz/3QFB//IBSf+xAUv/ygFT/6kBVP/IAaz/9QG0//UBuP/HAbn/8QG6/80Bu//dAb3/xAAIAPH/8AD5//ABBP/xARv/8wEv//EBSv/zAUz/8wFU//EABQBI/+4AWf/qAbr/8AG7/+0Bvf/wAAEA8f/1AAUASP/uAFn/6gG6//ABu//tAb3/8AABAPH/9QAFAEj/7gBZ/+oBuv/wAbv/7QG9//AAAQDx//UABQBI/+4AWf/qAbr/8AG7/+0Bvf/wAAEA8f/1AAUASP/uAFn/6gG6//ABu//tAb3/8AABAPH/9QAFAEj/7gBZ/+oBuv/wAbv/7QG9//AAAQDx//UABQBI/+4AWf/qAbr/8AG7/+0Bvf/wAAEA8f/1AAUASP/uAFn/6gG6//ABu//tAb3/8AABAPH/9QAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAab/7QG8//UACQDF/+oA6P+4APH/4gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGm/+0BvP/1AAkAxf/qAOj/uADx/+IBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABpv/tAbz/9QAJAMX/6gDo/7gA8f/iAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAab/7QG8//UACQDF/+oA6P+4APH/4gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGm/+0BvP/1AAkAxf/qAOj/uADx/+IBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABpv/tAbz/9QAJAMX/6gDo/7gA8f/iAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAab/7QG8//UACQDF/+oA6P+4APH/4gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAMX/6gDo/7gA8f/iAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAEBpv/rAAEBpv/rACQACP/iAAsAFAAM/88APwASAEj/6gBU/9gAVv/qAF8AEwBr/64Aev/NAH//oACE/8EAh//AALP/0AC3/+oAuv/GALsADQC9/+kAvv/WAMH/6ADC/7oAxf/pAMf/ywDI/9oAyf/HAW7/0wGm/6sBqP/NAaz/ywG0/8sBtf/LAbj/8wG7//MBvP/vAdz/wAHf/+4ABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UAJAAI/+IACwAUAAz/zwA/ABIASP/qAFT/2ABW/+oAXwATAGv/rgB6/80Af/+gAIT/wQCH/8AAs//QALf/6gC6/8YAuwANAL3/6QC+/9YAwf/oAML/ugDF/+kAx//LAMj/2gDJ/8cBbv/TAab/qwGo/80BrP/LAbT/ywG1/8sBuP/zAbv/8wG8/+8B3P/AAd//7gAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBpv+rAaj/zQGs/8sBtP/LAbX/ywG4//MBu//zAbz/7wHc/8AB3//uAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1ABQAWf/BALP/xQDF/7QA5f/XAPH/uQD5/+kBBP+yARf/0gEb/8gBL/+gATn/xQFB/+QBSv/MAUz/zAFU/8sBVf/vAaj/6AGs/+YBtP/nAbX/5wAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAOwBU/78AWf/RAGv/bAB6/24Af/9DAIT/rACH/6EAs/+4ALr/fgC+/3sAwf+bAML/eQDF/7IAx/9+AMj/fQDJ/3wA1P+vAOEADwDl/+QA5v+gAOj/dADq/4AA8f+yAPj/fQD5/7IA+v+AAPz/eQD9ACgBAv99AQT/fwEX/2YBG//aASf/gQEp/5gBLf99AS//swEz/6ABOf98ATv/mgE8/2wBQf/mAUb/awFK/5IBTP+tAVD/ewFTAA8BVP+RAVX/8gGm/68BqP+5Aaz/uQG0/7kBtf+5Abf/vAG4//EBu//xAbz/7QHc/7MB3//xABgAs//UAL3/7QC/ABEAxf/gAMf/5wDI/+UAyf/uANQAEgDl/+kA8f/XAS//1wE5/9MBO//WATz/xQFB/+cBSQANAUsADAFU/9YBVf/yAaj/6QGs/+cBtP/nAbX/6QHf//AAAQEX//EAMgBU/34AWf+dAGv+8QB6/vQAf/6rAIT/XgCH/0sAs/9yALr/DwC+/woAwf9BAML/BwDF/2gAx/8PAMj/DgDJ/wwA1P9jAOEABQDl/70A5v9JAOj+/gDq/xMA8f9oAPj/DgD5/2gA+v8TAPz/BwD9ADABAv8OAQT/EQEX/ucBG/+sASf/FQEp/zwBLf8OAS//agEz/0kBOf8MATv/PwE8/vEBQf/AAUb+7wFK/zEBTP9fAVD/CgFTAAUBVP8wAVX/1QHc/2oB3//TAAIA6P9oARf/7gAYALP/1AC9/+0AvwARAMX/4ADH/+cAyP/lAMn/7gDUABIA5f/pAPH/1wEv/9cBOf/TATv/1gE8/8UBQf/nAUkADQFLAAwBVP/WAVX/8gGo/+kBrP/nAbT/5wG1/+kB3//wAAEBF//xAAEA8f/WAAoA4f/DAPH/zwD5/9QBL//OATj/5wE7/98BSf/RAUv/7AFT/6ABVP/RADIAVP9+AFn/nQBr/vEAev70AH/+qwCE/14Ah/9LALP/cgC6/w8Avv8KAMH/QQDC/wcAxf9oAMf/DwDI/w4Ayf8MANT/YwDhAAUA5f+9AOb/SQDo/v4A6v8TAPH/aAD4/w4A+f9oAPr/EwD8/wcA/QAwAQL/DgEE/xEBF/7nARv/rAEn/xUBKf88AS3/DgEv/2oBM/9JATn/DAE7/z8BPP7xAUH/wAFG/u8BSv8xAUz/XwFQ/woBUwAFAVT/MAFV/9UB3P9qAd//0wAUAFn/wQCz/8UAxf+0AOX/1wDx/7kA+f/pAQT/sgEX/9IBG//IAS//oAE5/8UBQf/kAUr/zAFM/8wBVP/LAVX/7wGo/+gBrP/mAbT/5wG1/+cACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBpv+rAaj/zQGs/8sBtP/LAbX/ywG4//MBu//zAbz/7wHc/8AB3//uAAE1wAAEAAAABgAWAGwDngQcBIYEyAAVADgAFAA5ACYAOwAWARQAFAILABYCkgAmApQAFgKWABYC/QAWAwwAFgMPABYDRQAmA0cAJgNJACYDSwAWA2AAFANoABYD6gAWA+wAFgPuABYEEwAWAMwADv7uABD+7gAj/0AALP8wADYAFABD/94ARf/rAEb/6wBH/+sASf/rAFH/6wBT/+sAV//qAFj/6ABb/+gAkf/rAJX/6wCX/+oArf9AAK//QAC2/+sAuP/oAMP/6wDE/+sAxv/qAM0AFADRABQA8v/rAP7/6wEI/0ABE//rARX/6AEZ/+sBHf/rAS4AFAE1/+sBNgAUAUf/6wFI/+sBUv/rAWf+7gFr/u4Bb/7uAXD+7gHx/0AB8v9AAfP/QAH0/0AB9f9AAfb/QAH3/0ACDP/eAg3/3gIO/94CD//eAhD/3gIR/94CEv/eAhP/6wIU/+sCFf/rAhb/6wIX/+sCHf/rAh7/6wIf/+sCIP/rAiH/6wIi/+oCI//qAiT/6gIl/+oCJv/oAif/6AIo/0ACKf/eAir/QAIr/94CLP9AAi3/3gIv/+sCMf/rAjP/6wI1/+sCN//rAjn/6wI7/+sCPf/rAj//6wJB/+sCQ//rAkX/6wJH/+sCSf/rAlf/MAJr/+sCbf/rAm//6wKAABQCggAUAoQAFAKH/+oCif/qAov/6gKN/+oCj//qApH/6gKV/+gC+P9AAwD/QAMQ/+sDFP/qAxb/6wMY/+gDG//qAxz/6wMd/+oDJP8wAyj/QAMzABQDNf/eAzb/6wM4/+sDOv/rAzv/6AM9/+sDRP/oA0z/6ANV/0ADVv/eA1z/6wNh/+gDYv/rA2f/6wNp/+gDbv9AA2//3gNw/0ADcf/eA3X/6wN3/+sDeP/rA4L/6wOE/+sDhv/rA4r/6AOM/+gDjv/oA5X/6wOY/0ADmf/eA5r/QAOb/94DnP9AA53/3gOe/0ADn//eA6D/QAOh/94Dov9AA6P/3gOk/0ADpf/eA6b/QAOn/94DqP9AA6n/3gOq/0ADq//eA6z/QAOt/94Drv9AA6//3gOx/+sDs//rA7X/6wO3/+sDuf/rA7v/6wO9/+sDv//rA8X/6wPH/+sDyf/rA8v/6wPN/+sDz//rA9H/6wPT/+sD1f/rA9f/6wPZ/+sD2//rA93/6gPf/+oD4f/qA+P/6gPl/+oD5//qA+n/6gPr/+gD7f/oA+//6AP2ABQAHwA2/98AOP/kADn/7AA7/90Azf/fANH/3wEU/+QBLv/fATb/3wIL/90CgP/fAoL/3wKE/98Ckv/sApT/3QKW/90C/f/dAwz/3QMP/90DM//fA0X/7ANH/+wDSf/sA0v/3QNg/+QDaP/dA+r/3QPs/90D7v/dA/b/3wQT/90AGgA2/84AOP/tADv/0ADN/84A0f/OART/7QEu/84BNv/OAgv/0AKA/84Cgv/OAoT/zgKU/9AClv/QAv3/0AMM/9ADD//QAzP/zgNL/9ADYP/tA2j/0APq/9AD7P/QA+7/0AP2/84EE//QABAALP/uADf/7gIH/+4CCP/uAgn/7gIK/+4CV//uAob/7gKI/+4Civ/uAoz/7gKO/+4CkP/uAyT/7gPc/+4D3v/uAD0ARf/oAEb/6ABH/+gASf/oAFP/6ACR/+gAlf/oALb/6ADD/+gAxP/oAPL/6AD+/+gBGf/oAR3/6AE1/+gBR//oAUj/6AFS/+gCE//oAhT/6AIV/+gCFv/oAhf/6AIv/+gCMf/oAjP/6AI1/+gCN//oAjn/6AI7/+gCPf/oAj//6AJB/+gCQ//oAkX/6AJH/+gCSf/oAxD/6AM2/+gDOv/oAz3/6ANc/+gDYv/oA2f/6AN1/+gDd//oA3j/6AOE/+gDlf/oA7H/6AOz/+gDtf/oA7f/6AO5/+gDu//oA73/6AO//+gD0//oA9X/6APX/+gD2//oAAEwEgAEAAAALABiAIwBggHgAfoCPAKyA5gEfgVYBfIIjApSC2ANJg1YDYoOCA9OENgSbhOAFO4XABe2GRwZ0hqMGxIbcBwuHKQdUh18Hs4hDCEuIkQioiMgI0ojfCOOI7gACgAEABAACQAQAWUAEAFmABABaAAQAWkAEAFqABADTQAQA04AEANSABAAPQBF/+wARv/sAEf/7ABJ/+wAU//sAJH/7ACV/+wAtv/sAMP/7ADE/+wA8v/sAP7/7AEZ/+wBHf/sATX/7AFH/+wBSP/sAVL/7AIT/+wCFP/sAhX/7AIW/+wCF//sAi//7AIx/+wCM//sAjX/7AI3/+wCOf/sAjv/7AI9/+wCP//sAkH/7AJD/+wCRf/sAkf/7AJJ/+wDEP/sAzb/7AM6/+wDPf/sA1z/7ANi/+wDZ//sA3X/7AN3/+wDeP/sA4T/7AOV/+wDsf/sA7P/7AO1/+wDt//sA7n/7AO7/+wDvf/sA7//7APT/+wD1f/sA9f/7APb/+wAFwBR/+IBE//iAh3/4gIe/+ICH//iAiD/4gIh/+ICa//iAm3/4gJv/+IDFv/iAxz/4gM4/+IDgv/iA4b/4gPF/+IDx//iA8n/4gPL/+IDzf/iA8//4gPR/+ID2f/iAAYADv+EABD/hAFn/4QBa/+EAW//hAFw/4QAEAAs/+wAN//sAgf/7AII/+wCCf/sAgr/7AJX/+wChv/sAoj/7AKK/+wCjP/sAo7/7AKQ/+wDJP/sA9z/7APe/+wAHQAE//IACf/yAFj/8wBb//MAuP/zARX/8wFl//IBZv/yAWj/8gFp//IBav/yAib/8wIn//MClf/zAxj/8wM7//MDRP/zA0z/8wNN//IDTv/yA1L/8gNh//MDaf/zA4r/8wOM//MDjv/zA+v/8wPt//MD7//zADkAJf/zACn/8wAx//MAM//zAIH/8wCQ//MAlP/zAK7/8wDO//MBA//zARL/8wEW//MBGP/zARr/8wEc//MBNP/zAVH/8wH4//MCAv/zAgP/8wIE//MCBf/zAgb/8wIu//MCMP/zAjL/8wI0//MCQv/zAkT/8wJG//MCSP/zAmr/8wJs//MCbv/zAp//8wL8//MDCf/zAy//8wMy//MDV//zA2P/8wNm//MDgf/zA4P/8wOF//MDxP/zA8b/8wPI//MDyv/zA8z/8wPO//MD0P/zA9L/8wPU//MD1v/zA9j/8wPa//MAOQAl/+YAKf/mADH/5gAz/+YAgf/mAJD/5gCU/+YArv/mAM7/5gED/+YBEv/mARb/5gEY/+YBGv/mARz/5gE0/+YBUf/mAfj/5gIC/+YCA//mAgT/5gIF/+YCBv/mAi7/5gIw/+YCMv/mAjT/5gJC/+YCRP/mAkb/5gJI/+YCav/mAmz/5gJu/+YCn//mAvz/5gMJ/+YDL//mAzL/5gNX/+YDY//mA2b/5gOB/+YDg//mA4X/5gPE/+YDxv/mA8j/5gPK/+YDzP/mA87/5gPQ/+YD0v/mA9T/5gPW/+YD2P/mA9r/5gA2ACP/5AA6/9IAO//TAK3/5ACv/+QA1f/SAQj/5AHx/+QB8v/kAfP/5AH0/+QB9f/kAfb/5AH3/+QCC//TAij/5AIq/+QCLP/kApT/0wKW/9MC+P/kAv3/0wMA/+QDDP/TAw3/0gMP/9MDKP/kAzT/0gNL/9MDVf/kA2j/0wNr/9IDbv/kA3D/5AN5/9IDk//SA5j/5AOa/+QDnP/kA57/5AOg/+QDov/kA6T/5AOm/+QDqP/kA6r/5AOs/+QDrv/kA+r/0wPs/9MD7v/TA/j/0gQA/9IEE//TACYADv9GABD/RgAj/80Arf/NAK//zQEI/80BZ/9GAWv/RgFv/0YBcP9GAfH/zQHy/80B8//NAfT/zQH1/80B9v/NAff/zQIo/80CKv/NAiz/zQL4/80DAP/NAyj/zQNV/80Dbv/NA3D/zQOY/80Dmv/NA5z/zQOe/80DoP/NA6L/zQOk/80Dpv/NA6j/zQOq/80DrP/NA67/zQCmAEX/3ABG/9wAR//cAEn/3ABP/8EAUP/BAFH/1gBS/8EAU//cAFf/3QBY/+EAW//hAJH/3ACV/9wAl//dALb/3AC4/+EAvP/BAMP/3ADE/9wAxv/dAOf/wQDr/8EA7P/BAO7/wQDv/8EA8P/BAPL/3ADz/8EA9f/BAPb/wQD5/8EA+//BAP7/3AEA/8EBE//WARX/4QEZ/9wBHf/cATH/wQE1/9wBQP/BAUX/wQFH/9wBSP/cAVL/3AIT/9wCFP/cAhX/3AIW/9wCF//cAhz/wQId/9YCHv/WAh//1gIg/9YCIf/WAiL/3QIj/90CJP/dAiX/3QIm/+ECJ//hAi//3AIx/9wCM//cAjX/3AI3/9wCOf/cAjv/3AI9/9wCP//cAkH/3AJD/9wCRf/cAkf/3AJJ/9wCZP/BAmb/wQJo/8ECaf/BAmv/1gJt/9YCb//WAof/3QKJ/90Ci//dAo3/3QKP/90Ckf/dApX/4QMQ/9wDEv/BAxT/3QMW/9YDGP/hAxv/3QMc/9YDHf/dAzb/3AM3/8EDOP/WAzn/wQM6/9wDO//hAz3/3AM+/8EDQ//BA0T/4QNM/+EDVP/BA1z/3ANd/8EDYf/hA2L/3ANn/9wDaf/hA3X/3AN3/9wDeP/cA37/wQOA/8EDgv/WA4T/3AOG/9YDiv/hA4z/4QOO/+EDkv/BA5X/3AOx/9wDs//cA7X/3AO3/9wDuf/cA7v/3AO9/9wDv//cA8X/1gPH/9YDyf/WA8v/1gPN/9YDz//WA9H/1gPT/9wD1f/cA9f/3APZ/9YD2//cA93/3QPf/90D4f/dA+P/3QPl/90D5//dA+n/3QPr/+ED7f/hA+//4QPz/8ED9f/BA///wQQM/8EEDv/BBBD/wQBxAAT/2gAJ/9oARf/wAEb/8ABH//AASf/wAFP/8ABX/+8AWP/cAFv/3ACR//AAlf/wAJf/7wC2//AAuP/cAMP/8ADE//AAxv/vAPL/8AD+//ABFf/cARn/8AEd//ABNf/wAUf/8AFI//ABUv/wAWX/2gFm/9oBaP/aAWn/2gFq/9oCE//wAhT/8AIV//ACFv/wAhf/8AIi/+8CI//vAiT/7wIl/+8CJv/cAif/3AIv//ACMf/wAjP/8AI1//ACN//wAjn/8AI7//ACPf/wAj//8AJB//ACQ//wAkX/8AJH//ACSf/wAof/7wKJ/+8Ci//vAo3/7wKP/+8Ckf/vApX/3AMQ//ADFP/vAxj/3AMb/+8DHf/vAzb/8AM6//ADO//cAz3/8ANE/9wDTP/cA03/2gNO/9oDUv/aA1z/8ANh/9wDYv/wA2f/8ANp/9wDdf/wA3f/8AN4//ADhP/wA4r/3AOM/9wDjv/cA5X/8AOx//ADs//wA7X/8AO3//ADuf/wA7v/8AO9//ADv//wA9P/8APV//AD1//wA9v/8APd/+8D3//vA+H/7wPj/+8D5f/vA+f/7wPp/+8D6//cA+3/3APv/9wAQwAOAAwAEAAMAEX/5wBG/+cAR//nAEn/5wBT/+cAkf/nAJX/5wC2/+cAw//nAMT/5wDy/+cA/v/nARn/5wEd/+cBNf/nAUf/5wFI/+cBUv/nAWcADAFrAAwBbwAMAXAADAIT/+cCFP/nAhX/5wIW/+cCF//nAi//5wIx/+cCM//nAjX/5wI3/+cCOf/nAjv/5wI9/+cCP//nAkH/5wJD/+cCRf/nAkf/5wJJ/+cDEP/nAzb/5wM6/+cDPf/nA1z/5wNi/+cDZ//nA3X/5wN3/+cDeP/nA4T/5wOV/+cDsf/nA7P/5wO1/+cDt//nA7n/5wO7/+cDvf/nA7//5wPT/+cD1f/nA9f/5wPb/+cAcQAEAAwACQAMAEX/6ABG/+gAR//oAEn/6ABR/+oAU//oAFgACwBbAAsAkf/oAJX/6AC2/+gAuAALAMP/6ADE/+gA8v/oAP7/6AET/+oBFQALARn/6AEd/+gBNf/oAUf/6AFI/+gBUv/oAWUADAFmAAwBaAAMAWkADAFqAAwCE//oAhT/6AIV/+gCFv/oAhf/6AId/+oCHv/qAh//6gIg/+oCIf/qAiYACwInAAsCL//oAjH/6AIz/+gCNf/oAjf/6AI5/+gCO//oAj3/6AI//+gCQf/oAkP/6AJF/+gCR//oAkn/6AJr/+oCbf/qAm//6gKVAAsDEP/oAxb/6gMYAAsDHP/qAzb/6AM4/+oDOv/oAzsACwM9/+gDRAALA0wACwNNAAwDTgAMA1IADANc/+gDYQALA2L/6ANn/+gDaQALA3X/6AN3/+gDeP/oA4L/6gOE/+gDhv/qA4oACwOMAAsDjgALA5X/6AOx/+gDs//oA7X/6AO3/+gDuf/oA7v/6AO9/+gDv//oA8X/6gPH/+oDyf/qA8v/6gPN/+oDz//qA9H/6gPT/+gD1f/oA9f/6APZ/+oD2//oA+sACwPtAAsD7wALAAwAWv/tAFz/7QDp/+0CmP/tApr/7QKc/+0DPP/tA2z/7QN6/+0DlP/tA/n/7QQB/+0ADABa//IAXP/yAOn/8gKY//ICmv/yApz/8gM8//IDbP/yA3r/8gOU//ID+f/yBAH/8gAfAFj/9ABa//IAW//0AFz/8wC4//QA6f/yARX/9AIm//QCJ//0ApX/9AKY//MCmv/zApz/8wMY//QDO//0Azz/8gNE//QDTP/0A2H/9ANp//QDbP/yA3r/8gOK//QDjP/0A47/9AOU//ID6//0A+3/9APv//QD+f/yBAH/8gBRAAT/ygAJ/8oANv/SADj/1AA6//QAO//TAFj/5gBa/+8AW//mALj/5gDN/9IA0f/SANX/9ADZ/+0A3P/hAOn/7wEU/9QBFf/mAS7/0gE2/9IBZf/KAWb/ygFo/8oBaf/KAWr/ygIL/9MCJv/mAif/5gKA/9ICgv/SAoT/0gKU/9MClf/mApb/0wL9/9MDDP/TAw3/9AMP/9MDGP/mAyf/7QMz/9IDNP/0Azv/5gM8/+8DRP/mA0v/0wNM/+YDTf/KA07/ygNS/8oDYP/UA2H/5gNo/9MDaf/mA2v/9ANs/+8Def/0A3r/7wOJ/+0Div/mA4v/7QOM/+YDjf/tA47/5gOP/+EDk//0A5T/7wPq/9MD6//mA+z/0wPt/+YD7v/TA+//5gP2/9ID+P/0A/n/7wP6/+ED/P/hBAD/9AQB/+8EE//TAGIABP/AAAn/wAA2/50AOP/HADr/8AA7/6sAT//SAFD/0gBS/9IAvP/SAM3/nQDP//UA0f+dANX/8ADY//UA2f/qANz/5QDn/9IA6//SAOz/0gDu/9IA7//SAPD/0gDz/9IA9f/SAPb/0gD7/9IBAP/SART/xwEu/50BMf/SATb/nQFA/9IBRf/SAU3/9QFl/8ABZv/AAWj/wAFp/8ABav/AAgv/qwIc/9ICZP/SAmb/0gJo/9ICaf/SAoD/nQKC/50ChP+dApT/qwKW/6sC/f+rAwz/qwMN//ADD/+rAxL/0gMn/+oDM/+dAzT/8AM3/9IDOf/SAz7/0gND/9IDS/+rA03/wANO/8ADUv/AA1T/0gNd/9IDYP/HA2j/qwNr//ADef/wA37/0gOA/9IDif/qA4v/6gON/+oDj//lA5L/0gOT//ADlv/1A+r/qwPs/6sD7v+rA/P/0gP1/9ID9v+dA/j/8AP6/+UD/P/lA///0gQA//AEDP/SBA7/0gQQ/9IEEf/1BBP/qwBlAAT/sQAJ/7EANv+eADj/xQA6//IAO/+oAE//zwBQ/88AUv/PAFr/7wC8/88Azf+eANH/ngDV//IA2f/sANz/4QDn/88A6f/vAOv/zwDs/88A7v/PAO//zwDw/88A8//PAPX/zwD2/88A+//PAQD/zwEU/8UBLv+eATH/zwE2/54BQP/PAUX/zwFl/7EBZv+xAWj/sQFp/7EBav+xAgv/qAIc/88CZP/PAmb/zwJo/88Caf/PAoD/ngKC/54ChP+eApT/qAKW/6gC/f+oAwz/qAMN//IDD/+oAxL/zwMn/+wDM/+eAzT/8gM3/88DOf/PAzz/7wM+/88DQ//PA0v/qANN/7EDTv+xA1L/sQNU/88DXf/PA2D/xQNo/6gDa//yA2z/7wN5//IDev/vA37/zwOA/88Dif/sA4v/7AON/+wDj//hA5L/zwOT//IDlP/vA+r/qAPs/6gD7v+oA/P/zwP1/88D9v+eA/j/8gP5/+8D+v/hA/z/4QP//88EAP/yBAH/7wQM/88EDv/PBBD/zwQT/6gARAA2/74AT//hAFD/4QBS/+EAWP/vAFv/7wC4/+8AvP/hAM3/vgDR/74A5//hAOv/4QDs/+EA7v/hAO//4QDw/+EA8//hAPX/4QD2/+EA+//hAQD/4QEV/+8BLv++ATH/4QE2/74BQP/hAUX/4QIc/+ECJv/vAif/7wJk/+ECZv/hAmj/4QJp/+ECgP++AoL/vgKE/74Clf/vAxL/4QMY/+8DM/++Azf/4QM5/+EDO//vAz7/4QND/+EDRP/vA0z/7wNU/+EDXf/hA2H/7wNp/+8Dfv/hA4D/4QOK/+8DjP/vA47/7wOS/+ED6//vA+3/7wPv/+8D8//hA/X/4QP2/74D///hBAz/4QQO/+EEEP/hAFsANv/mADj/5wA6//IAO//nAE//1gBQ/9YAUv/WAFr/8QC8/9YAzf/mANH/5gDV//IA2f/uANz/6ADn/9YA6f/xAOv/1gDs/9YA7v/WAO//1gDw/9YA8//WAPX/1gD2/9YA+//WAQD/1gEU/+cBLv/mATH/1gE2/+YBQP/WAUX/1gIL/+cCHP/WAmT/1gJm/9YCaP/WAmn/1gKA/+YCgv/mAoT/5gKU/+cClv/nAv3/5wMM/+cDDf/yAw//5wMS/9YDJ//uAzP/5gM0//IDN//WAzn/1gM8//EDPv/WA0P/1gNL/+cDVP/WA13/1gNg/+cDaP/nA2v/8gNs//EDef/yA3r/8QN+/9YDgP/WA4n/7gOL/+4Djf/uA4//6AOS/9YDk//yA5T/8QPq/+cD7P/nA+7/5wPz/9YD9f/WA/b/5gP4//ID+f/xA/r/6AP8/+gD///WBAD/8gQB//EEDP/WBA7/1gQQ/9YEE//nAIQAIwAQACX/6AAp/+gAMf/oADP/6AA2/+AAOP/gADv/3wCB/+gAkP/oAJT/6ACtABAArv/oAK8AEADN/+AAzv/oAM8AEADR/+AA2AAQANz/4QDtABAA9P/gAP8AEAED/+gBCAAQARL/6AEU/+ABFv/oARj/6AEa/+gBHP/oAS7/4AE0/+gBNv/gAU0AEAFR/+gB8QAQAfIAEAHzABAB9AAQAfUAEAH2ABAB9wAQAfj/6AIC/+gCA//oAgT/6AIF/+gCBv/oAgv/3wIoABACKgAQAiwAEAIu/+gCMP/oAjL/6AI0/+gCQv/oAkT/6AJG/+gCSP/oAmr/6AJs/+gCbv/oAoD/4AKC/+AChP/gApT/3wKW/98Cn//oAvgAEAL8/+gC/f/fAwAAEAMJ/+gDDP/fAw//3wMoABADL//oAzL/6AMz/+ADS//fA1UAEANX/+gDYP/gA2P/6ANm/+gDaP/fA24AEANwABADgf/oA4P/6AOF/+gDj//hA5D/4AOWABADlwAQA5gAEAOaABADnAAQA54AEAOgABADogAQA6QAEAOmABADqAAQA6oAEAOsABADrgAQA8T/6APG/+gDyP/oA8r/6APM/+gDzv/oA9D/6APS/+gD1P/oA9b/6APY/+gD2v/oA+r/3wPs/98D7v/fA/b/4AP6/+ED+//gA/z/4QP9/+AEEQAQBBIAEAQT/98ALQA2//EAOP/0ADr/9AA7//AAzf/xAM//9QDR//EA1f/0ANj/9QDZ//MBFP/0AS7/8QE2//EBTf/1Agv/8AKA//ECgv/xAoT/8QKU//AClv/wAv3/8AMM//ADDf/0Aw//8AMn//MDM//xAzT/9ANL//ADYP/0A2j/8ANr//QDef/0A4n/8wOL//MDjf/zA5P/9AOW//UD6v/wA+z/8APu//AD9v/xA/j/9AQA//QEEf/1BBP/8ABZACMADwA2/+YAOP/mADoADgA7/+YArQAPAK8ADwDN/+YAzwAOANH/5gDVAA4A2AAOANkACwDc/+UA7QAPAPT/6AD/AA8BCAAPART/5gEu/+YBNv/mAU0ADgHxAA8B8gAPAfMADwH0AA8B9QAPAfYADwH3AA8CC//mAigADwIqAA8CLAAPAoD/5gKC/+YChP/mApT/5gKW/+YC+AAPAv3/5gMAAA8DDP/mAw0ADgMP/+YDJwALAygADwMz/+YDNAAOA0v/5gNVAA8DYP/mA2j/5gNrAA4DbgAPA3AADwN5AA4DiQALA4sACwONAAsDj//lA5D/6AOTAA4DlgAOA5cADwOYAA8DmgAPA5wADwOeAA8DoAAPA6IADwOkAA8DpgAPA6gADwOqAA8DrAAPA64ADwPq/+YD7P/mA+7/5gP2/+YD+AAOA/r/5QP7/+gD/P/lA/3/6AQAAA4EEQAOBBIADwQT/+YALQAE/78ACf+/ADb/nwA4/8kAO/+tAM3/nwDR/58A2f/sANz/5gEU/8kBLv+fATb/nwFl/78BZv+/AWj/vwFp/78Bav+/Agv/rQKA/58Cgv+fAoT/nwKU/60Clv+tAv3/rQMM/60DD/+tAyf/7AMz/58DS/+tA03/vwNO/78DUv+/A2D/yQNo/60Dif/sA4v/7AON/+wDj//mA+r/rQPs/60D7v+tA/b/nwP6/+YD/P/mBBP/rQAuADb/4wA6/+UAO//kAM3/4wDP/+UA0f/jANX/5QDY/+UA2f/pAO3/6gD//+oBLv/jATb/4wFN/+UCC//kAoD/4wKC/+MChP/jApT/5AKW/+QC/f/kAwz/5AMN/+UDD//kAyf/6QMz/+MDNP/lA0v/5ANo/+QDa//lA3n/5QOJ/+kDi//pA43/6QOT/+UDlv/lA5f/6gPq/+QD7P/kA+7/5AP2/+MD+P/lBAD/5QQR/+UEEv/qBBP/5AAhADb/4gA6/+QAzf/iAM//5ADR/+IA1f/kANj/5ADZ/+kA7f/rAP//6wEu/+IBNv/iAU3/5AKA/+ICgv/iAoT/4gMN/+QDJ//pAzP/4gM0/+QDa//kA3n/5AOJ/+kDi//pA43/6QOT/+QDlv/kA5f/6wP2/+ID+P/kBAD/5AQR/+QEEv/rABcANv/rADv/8wDN/+sA0f/rAS7/6wE2/+sCC//zAoD/6wKC/+sChP/rApT/8wKW//MC/f/zAwz/8wMP//MDM//rA0v/8wNo//MD6v/zA+z/8wPu//MD9v/rBBP/8wAvAE//7wBQ/+8AUv/vAFr/8AC8/+8A5//vAOn/8ADr/+8A7P/vAO7/7wDv/+8A8P/vAPP/7wD1/+8A9v/vAPv/7wEA/+8BMf/vAUD/7wFF/+8CHP/vAmT/7wJm/+8CaP/vAmn/7wMS/+8DN//vAzn/7wM8//ADPv/vA0P/7wNU/+8DXf/vA2z/8AN6//ADfv/vA4D/7wOS/+8DlP/wA/P/7wP1/+8D+f/wA///7wQB//AEDP/vBA7/7wQQ/+8AHQAE//IACf/yAFj/9QBb//UAuP/1ARX/9QFl//IBZv/yAWj/8gFp//IBav/yAib/9QIn//UClf/1Axj/9QM7//UDRP/1A0z/9QNN//IDTv/yA1L/8gNh//UDaf/1A4r/9QOM//UDjv/1A+v/9QPt//UD7//1ACsAT//uAFD/7gBS/+4AvP/uAOf/7gDr/+4A7P/uAO7/7gDv/+4A8P/uAPP/7gD0/+0A9f/uAPb/7gD7/+4BAP/uATH/7gFA/+4BRf/uAhz/7gJk/+4CZv/uAmj/7gJp/+4DEv/uAzf/7gM5/+4DPv/uA0P/7gNU/+4DXf/uA37/7gOA/+4DkP/tA5L/7gPz/+4D9f/uA/v/7QP9/+0D///uBAz/7gQO/+4EEP/uAAoABP/1AAn/9QFl//UBZv/1AWj/9QFp//UBav/1A03/9QNO//UDUv/1AFQARf/wAEb/8ABH//AASf/wAFH/xwBT//AAkf/wAJX/8AC2//AAw//wAMT/8ADy//AA/v/wARP/xwEZ//ABHf/wATX/8AFH//ABSP/wAVL/8AIT//ACFP/wAhX/8AIW//ACF//wAh3/xwIe/8cCH//HAiD/xwIh/8cCL//wAjH/8AIz//ACNf/wAjf/8AI5//ACO//wAj3/8AI///ACQf/wAkP/8AJF//ACR//wAkn/8AJr/8cCbf/HAm//xwMQ//ADFv/HAxz/xwM2//ADOP/HAzr/8AM9//ADXP/wA2L/8ANn//ADdf/wA3f/8AN4//ADgv/HA4T/8AOG/8cDlf/wA7H/8AOz//ADtf/wA7f/8AO5//ADu//wA73/8AO///ADxf/HA8f/xwPJ/8cDy//HA83/xwPP/8cD0f/HA9P/8APV//AD1//wA9n/xwPb//AAjwAEAA0ACQANAEP/8ABF/8AARv/AAEf/wABJ/8AAUf/iAFP/wABYAAsAWwALAJH/wACV/8AAtv/AALgACwDE/8AA7f/XAPL/wAD+/8AA///XARP/4gEVAAsBGf/AAR3/wAE1/8ABR//AAUj/wAFS/8ABZQANAWYADQFoAA0BaQANAWoADQIM//ACDf/wAg7/8AIP//ACEP/wAhH/8AIS//ACE//AAhT/wAIV/8ACFv/AAhf/wAId/+ICHv/iAh//4gIg/+ICIf/iAiYACwInAAsCKf/wAiv/8AIt//ACL//AAjH/wAIz/8ACNf/AAjf/wAI5/8ACO//AAj3/wAI//8ACQf/AAkP/wAJF/8ACR//AAkn/wAJr/+ICbf/iAm//4gKVAAsDEP/AAxb/4gMYAAsDHP/iAzX/8AM2/8ADOP/iAzr/wAM7AAsDPf/AA0QACwNMAAsDTQANA04ADQNSAA0DVv/wA1z/wANhAAsDYv/AA2f/wANpAAsDb//wA3H/8AN1/8ADd//AA3j/wAOC/+IDhP/AA4b/4gOKAAsDjAALA44ACwOV/8ADl//XA5n/8AOb//ADnf/wA5//8AOh//ADo//wA6X/8AOn//ADqf/wA6v/8AOt//ADr//wA7H/wAOz/8ADtf/AA7f/wAO5/8ADu//AA73/wAO//8ADxf/iA8f/4gPJ/+IDy//iA83/4gPP/+ID0f/iA9P/wAPV/8AD1//AA9n/4gPb/8AD6wALA+0ACwPvAAsEEv/XAAgA7QAQAPT/8AD/ABADkP/wA5cAEAP7//AD/f/wBBIAEABFAEX/7gBG/+4AR//uAEn/7gBT/+4Akf/uAJX/7gC2/+4Aw//uAMT/7gDtAA4A8v/uAPT/4wD+/+4A/wAOARn/7gEd/+4BNf/uAUf/7gFI/+4BUv/uAhP/7gIU/+4CFf/uAhb/7gIX/+4CL//uAjH/7gIz/+4CNf/uAjf/7gI5/+4CO//uAj3/7gI//+4CQf/uAkP/7gJF/+4CR//uAkn/7gMQ/+4DNv/uAzr/7gM9/+4DXP/uA2L/7gNn/+4Ddf/uA3f/7gN4/+4DhP/uA5D/4wOV/+4DlwAOA7H/7gOz/+4Dtf/uA7f/7gO5/+4Du//uA73/7gO//+4D0//uA9X/7gPX/+4D2//uA/v/4wP9/+MEEgAOABcAWP/AAFv/wAC4/8AA9P/uARX/wAIm/8ACJ//AApX/wAMY/8ADO//AA0T/wANM/8ADYf/AA2n/wAOK/8ADjP/AA47/wAOQ/+4D6//AA+3/wAPv/8AD+//uA/3/7gAfAFj/9ABa//AAW//0ALj/9ADp//AA7f/zAP//8wEV//QCJv/0Aif/9AKV//QDGP/0Azv/9AM8//ADRP/0A0z/9ANh//QDaf/0A2z/8AN6//ADiv/0A4z/9AOO//QDlP/wA5f/8wPr//QD7f/0A+//9AP5//AEAf/wBBL/8wAKAAT/1gAJ/9YBZf/WAWb/1gFo/9YBaf/WAWr/1gNN/9YDTv/WA1L/1gAMAFr/4ADp/+AA9P/CAzz/4ANs/+ADev/gA5D/wgOU/+AD+f/gA/v/wgP9/8IEAf/gAAQA9P/SA5D/0gP7/9ID/f/SAAoABP/XAAn/1wFl/9cBZv/XAWj/1wFp/9cBav/XA03/1wNO/9cDUv/XAF4ABAALAAkACwBF/+sARv/rAEf/6wBJ/+sAUf/pAFP/6wCR/+sAlf/rALb/6wDD/+sAxP/rAPL/6wD+/+sBE//pARn/6wEd/+sBNf/rAUf/6wFI/+sBUv/rAWUACwFmAAsBaAALAWkACwFqAAsCE//rAhT/6wIV/+sCFv/rAhf/6wId/+kCHv/pAh//6QIg/+kCIf/pAi//6wIx/+sCM//rAjX/6wI3/+sCOf/rAjv/6wI9/+sCP//rAkH/6wJD/+sCRf/rAkf/6wJJ/+sCa//pAm3/6QJv/+kDEP/rAxb/6QMc/+kDNv/rAzj/6QM6/+sDPf/rA00ACwNOAAsDUgALA1z/6wNi/+sDZ//rA3X/6wN3/+sDeP/rA4L/6QOE/+sDhv/pA5X/6wOx/+sDs//rA7X/6wO3/+sDuf/rA7v/6wO9/+sDv//rA8X/6QPH/+kDyf/pA8v/6QPN/+kDz//pA9H/6QPT/+sD1f/rA9f/6wPZ/+kD2//rAAILPAAEAAAOBBVYACEAHQAAAAwAEf/f//T/zv/1/7P/7//Q/2r/iP+n//X/yf/ZABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/oAAAAAP/JAAD/5QAAAAAAAAAA//MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAR/+UAAAAAAAAAAAAAAAD/5AAA/+MAAP/kAAAAEQAAABIAEQAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/4QAAAAAAAAAA/+oAAAAA/9UAAP/lAAAAAAAAAAAAAP/r/+r/6f+GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/7f/mAAAAAAAAAAAAAAAAABT/7wAAAAAAAAAAAAAAAAAAAAD/7QAAAAAAAAAAAAAAAAAA/8T/y/98/7H/rv/kABAAAP+nABAAAAAQ/78AAAAP/34AAP+TAAAAAP7+/6f/s/+0/vD/8P+t/ygAAP+G/5L/DP9m/2H/vQAHAAD/VQAHAAAAB/9+AAAABf8PAAD/MwAAAAD+Nv9V/2r/a/4e/9H/XwAAAAAAAAAAAAD/7AAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/2AAAAAAAAAAAAAD/7AAAAAAAAAAAAAAAAAAAAAAAAP+j/+X/2P/hAAAAAAAAAAAAAAAA/+kAAAAAAAAAAAAAAAAAAAAA/+YAAAAA/1wAAAAAAAAAAAAAAAAAAAAA/4X/5/8y/+gAAP7p/v7/M//yAAD/owAAAAAAEwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP9vAAD/8wAPAAAAAAAAAAAAAAAAAAAAAAAAAAD/pwAA/07/zf/c/mz/8wAAAAAAAAAA//X/SAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/qAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/S//X/8wAAAAAAAAAAAAAAAP/kAAAAAAAAAAD/tQAAAAD/Kf/UAAAAAP9jAAD/0gAAAAAAAAAR/9H/6//h/+cADgAAAAAAAAAAAAD/6wAAAAAAEQAAAAAAAAAAAAD/5gAAAAD/ZAAAAAAAAAAA/+IAAAAA/7//7P/jABL/oP/YABIAAAAR/9kAAAARAAAAAP9qAA0AAP8Z/7//6f/G/2j/8P/B/6AAAAAAAAAAAP/hAAAAAAAAAAAAAAAAAAAADv/tAAAAAAAAAAD/1QAAAAD/cf/hAAAAAP/EAAD/3wAAAAAAAAAAAAD/6//l/+YAAAAAAAAAAAAAAAD/7QAAAAAAAAAAAA0AAAAAAAD/6wAAAAAAAAAAAAAAAAAAAAD/yv/p/70AAP/pAAAAAP+uABIAAAASAAAAAAAA/7sAAP+lAAAAAP53/70AAP/S/zkAAP+vAAAAAAAAAAAAAAAA//EAAAAAAAAAAAAA/+8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//EAAAAAAAD/9QAAAAAAAAAAAAD/4wAAAAAAAAAA//IAAAAAAAAAAAAAAAD/8QAAAAAAAAAAAAAAAAAAAAAAAAAA//MAAAAAAAAAAAAA//IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//AAAAAAAAD/8QAAAAAAAAAAAAD/7AAAAAAAAAAA//AAAAAAAAAAAAAAAAD/6wAAAAAAAAAAAAAAAAAAAAAAAP/xAAAAAAAAAAAAAAAAAA8AAAAAAAAAAP/XAAAAAAAAAAD/Wf/zAAAAAAAAAAD/8QAAAAAAAAAAAAD/7AASAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAA/1P/7QAAAAAAAAAA/+wAAAAAAAAAAAAA/9gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+wAAAAAAAAAAAAAAAAAAAAAAAAAAP/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/wAAAAAAAAAAAAAAAAAAAAAAAAAAD/pQAAAAAAAAAA/+wAAP/bAAAAAAAAAAAAAAAA/4gAAAAAAAD/xQAA/6QAAAAA/84AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/IAAAAAP+t/8D/nwAA/+cAAAAA/+sAAAAAAAAAAAAA/8kAAAAAAAAAAAAAAAAAAAAA/+MAAP+1AAAAAAAAAAAAAP95AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/rAAAAAAAAAAAAAAACAIsABAAEAAAACQAJAAEAEQARAAIAIwAoAAMAKgAzAAkANgA8ABMAQwBEABoARwBIABwASgBKAB4ATwBSAB8AVABUACMAWABYACQAWgBbACUAiACIACcAmQCZACgArACwACkAsgC0AC4AtgC2ADEAuAC4ADIAuwC8ADMAvgC+ADUAwADAADYAwgDHADcAzQDNAD0AzwDZAD4A2wDbAEkA3QDfAEoA4QDjAE0A5QDpAFAA7ADsAFUA8QDzAFYA9gD3AFkA+QD7AFsA/wEAAF4BBQEFAGABCAEIAGEBEwEVAGIBJwEpAGUBLAEsAGgBLgEuAGkBRQFFAGoBZQFmAGsBaAFqAG0BpgGmAHABqQGpAHEBqwGrAHIBsAGxAHMBtAG2AHUBuAG+AHgBxAHEAH8B1wHXAIAB2wHcAIEB3wHfAIMB6AHoAIQB7AHtAIUB7wHvAIcB8QISAIgCFAIXAKoCHAIhAK4CJgIuALQCMAIwAL0CMgIyAL4CNAI0AL8CNgI2AMACOAJBAMECSgJMAMsCTgJOAM4CUAJQAM8CUgJSANACVAJUANECVwJXANICWQJZANMCWwJbANQCXQJdANUCXwJfANYCYQJhANcCYwJvANgCcQJxAOUCcwJzAOYCdQJ1AOcCgAKAAOgCggKCAOkChAKEAOoChgKGAOsCiAKIAOwCigKKAO0CjAKMAO4CjgKOAO8CkAKQAPACkgKSAPEClAKXAPICmQKZAPYCmwKbAPcC+AL9APgDAAMPAP4DEgMSAQ4DFgMWAQ8DGAMYARADHAMcAREDHwMgARIDIgMrARQDLQMvAR4DMQM2ASEDOAM5AScDOwM+ASkDRANFAS0DRwNHAS8DSQNJATADSwNOATEDUgNXATUDWgNaATsDXANcATwDYANhAT0DZgNmAT8DaANxAUADdAN1AUoDdwN6AUwDgQOCAVADhgOGAVIDiAOOAVMDkwOUAVoDmAPAAVwDwgPCAYUDxAPRAYYD2QPZAZQD3APcAZUD3gPeAZYD6gPvAZcD8gPyAZ0D9AP0AZ4D9gP2AZ8D+AP5AaAD/gQBAaIEBAQEAaYEBgQHAacECQQJAakEDQQNAaoEDwQPAasEEwQTAawAAQAGAAoAKAAzADQAPQBIAAEALABIAE0AVgBZAF0AmQCwALIAswC0ALsAvgDAAMUAxwDIAMkAzQDPANAA0QDTANQA1gDeAN8A4gDjAOQA5QDmAOgA6gDsAPEA8wD2APcA+wD+AP8BAAEdAdwAAgB2AAQABAAAAAkACQABAA4ADgACABAAEAADACMAJwAEACoAMgAJADYAPAASAEMARQAZAEcARwAcAEoASgAdAE8AUgAeAFQAVAAiAFgAWAAjAFoAXAAkAIgAiAAnAKwArwAoALgAuAAsALwAvAAtAMIAwgAuAM8A0AAvANIA0gAxANUA1QAyANcA2QAzANsA2wA2AN0A3QA3AN8A3wA4AOEA4QA5AOcA5wA6AOkA6QA7APIA8gA8APcA9wA9APkA+gA+AP8BAABAAQUBBQBCAQgBCABDARMBFQBEAScBKQBHASwBLABKAS4BLgBLAUUBRQBMAWUBawBNAW8BcABUAewB7QBWAe8B7wBYAfECFwBZAhwCIQCAAiYCNgCGAjgCQQCXAkoCTAChAk4CTgCkAlACUAClAlICUgCmAlQCVACnAlcCVwCoAlkCWQCpAlsCWwCqAl0CXQCrAl8CXwCsAmECYQCtAmMCbwCuAnECcQC7AnMCcwC8AnUCdQC9AoACgAC+AoICggC/AoQChADAAoYChgDBAogCiADCAooCigDDAowCjADEAo4CjgDFApACkADGApICkgDHApQCnADIAvgC/QDRAwADDwDXAxIDEgDnAxYDFgDoAxgDGADpAxwDHADqAx8DIADrAyIDKwDtAy0DLwD3AzEDNgD6AzgDPgEAA0QDRQEHA0cDRwEJA0kDSQEKA0sDTgELA1IDVwEPA1oDWgEVA1wDXAEWA2ADYQEXA2YDcQEZA3QDdQElA3cDegEnA4EDggErA4YDhgEtA4gDjgEuA5MDlAE1A5gDwAE3A8IDwgFgA8QD0QFhA9kD2QFvA9wD3AFwA94D3gFxA+oD7wFyA/ID8gF4A/QD9AF5A/YD9gF6A/gD+QF7A/4EAQF9BAQEBAGBBAYEBwGCBAkECQGEBA0EDQGFBA8EDwGGBBMEEwGHAAIBOAAEAAQAHQAJAAkAHQAOAA4AHgAQABAAHgAkACQAAQAlACUABAAmACYAAwAnACcABQAqACsAAgAsACwADAAtAC0ACQAuAC4ACgAvADAAAgAxADEAAwAyADIACwA2ADYABgA3ADcADAA4ADgADQA5ADkAEAA6ADoADgA7ADsADwA8ADwAEQBDAEMAEwBEAEQAFQBFAEUAFABHAEcAFgBKAEoAFwBPAFAAFwBRAFEAGABSAFIAFQBUAFQAGgBYAFgAGQBaAFoAGwBbAFsAGQBcAFwAHACIAIgAFQCsAKwABwCuAK4AAwC4ALgAGQC8ALwAFwDCAMIAFQDPANAAHwDSANIAAgDVANUADgDXANgAAgDZANkAEgDbANsAAgDdAN0AAgDfAN8AHwDhAOEAHwDnAOcACADpAOkAGwDyAPIAFQD3APcAIAD5APkAIAD6APoAFQD/AQAAIAEFAQUAIAETARMAGAEUARQADQEVARUAGQEnAScAFQEoASgABwEpASkACAEsASwACQEuAS4ACQFFAUUACAFlAWYAHQFnAWcAHgFoAWoAHQFrAWsAHgFvAXAAHgHsAe0AAwHvAe8ABgH4AfgABAH5AfwABQH9AgEAAgICAgYAAwIHAgoADAILAgsADwIMAhIAEwITAhMAFAIUAhcAFgIcAhwAFwIdAiEAGAImAicAGQIpAikAEwIrAisAEwItAi0AEwIuAi4ABAIvAi8AFAIwAjAABAIxAjEAFAIyAjIABAIzAjMAFAI0AjQABAI1AjUAFAI2AjYAAwI4AjgABQI5AjkAFgI6AjoABQI7AjsAFgI8AjwABQI9Aj0AFgI+Aj4ABQI/Aj8AFgJAAkAABQJBAkEAFgJKAkoAAgJLAksAFwJMAkwAAgJOAk4AAgJQAlAAAgJSAlIAAgJUAlQAAgJXAlcADAJZAlkACQJbAlsACgJdAl0ACgJfAl8ACgJhAmEACgJjAmMAAgJkAmQAFwJlAmUAAgJmAmYAFwJnAmcAAgJoAmkAFwJqAmoAAwJrAmsAGAJsAmwAAwJtAm0AGAJuAm4AAwJvAm8AGAJxAnEAGgJzAnMAGgJ1AnUAGgKAAoAABgKCAoIABgKEAoQABgKGAoYADAKIAogADAKKAooADAKMAowADAKOAo4ADAKQApAADAKSApIAEAKUApQADwKVApUAGQKWApYADwKXApcAEQKYApgAHAKZApkAEQKaApoAHAKbApsAEQKcApwAHAL5AvkABQL6AvsAAgL8AvwAAwL9Av0ADwMBAwEAAQMCAwIABQMDAwMAEQMEAwUAAgMGAwYACQMHAwgAAgMJAwkAAwMKAwoACwMLAwsABgMMAwwADwMNAw0ADgMOAw4AAgMPAw8ADwMSAxIAFwMWAxYAGAMYAxgAGQMcAxwAGAMfAx8ABQMgAyAABwMiAyMAAgMkAyQADAMlAyYACQMnAycAEgMpAykAAQMqAyoABwMrAysABQMtAy4AAgMvAy8AAwMxAzEACwMyAzIABAMzAzMABgM0AzQADgM1AzUAEwM2AzYAFgM4AzgAGAM5AzkAFQM6AzoAFAM7AzsAGQM8AzwAGwM9Az0AFgM+Az4ACANEA0QAGQNFA0UAEANHA0cAEANJA0kAEANLA0sADwNMA0wAGQNNA04AHQNSA1IAHQNTA1MAAgNUA1QAFwNWA1YAEwNXA1cAAwNaA1oABQNcA1wAFgNgA2AADQNhA2EAGQNmA2YABANnA2cAFANoA2gADwNpA2kAGQNqA2oAAgNrA2sADgNsA2wAGwNtA20AAgNvA28AEwNxA3EAEwN0A3QABQN1A3UAFgN3A3gAFgN5A3kADgN6A3oAGwOBA4EAAwOCA4IAGAOGA4YAGAOIA4gAFQOJA4kAEgOKA4oAGQOLA4sAEgOMA4wAGQONA40AEgOOA44AGQOTA5MADgOUA5QAGwOZA5kAEwObA5sAEwOdA50AEwOfA58AEwOhA6EAEwOjA6MAEwOlA6UAEwOnA6cAEwOpA6kAEwOrA6sAEwOtA60AEwOvA68AEwOwA7AABQOxA7EAFgOyA7IABQOzA7MAFgO0A7QABQO1A7UAFgO2A7YABQO3A7cAFgO4A7gABQO5A7kAFgO6A7oABQO7A7sAFgO8A7wABQO9A70AFgO+A74ABQO/A78AFgPAA8AAAgPCA8IAAgPEA8QAAwPFA8UAGAPGA8YAAwPHA8cAGAPIA8gAAwPJA8kAGAPKA8oAAwPLA8sAGAPMA8wAAwPNA80AGAPOA84AAwPPA88AGAPQA9AAAwPRA9EAGAPZA9kAGAPcA9wADAPeA94ADAPqA+oADwPrA+sAGQPsA+wADwPtA+0AGQPuA+4ADwPvA+8AGQPyA/IACQP0A/QAAgP2A/YABgP4A/gADgP5A/kAGwP+A/4ABwP/A/8ACAQABAAADgQBBAEAGwQEBAQAFwQGBAYAHwQHBAcABwQJBAkACQQNBA0AAgQPBA8AAgQTBBMADwABAAQEFgALAAAAAAAAAAAACwAAAAAAAAAAABUAGQAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAGAAAAAAAAAAYAAAAAABwAAAAAAAAAAAAGAAAABgAAABoADAAIAAcADwATAAoAFAAAAAAAAAAAAAAAAAAbAAAAFgAWABYAAAAWAAAAAAAAAAAAAAAJAAkABAAJABYAAAAYAAAADQAFAAAAFwAFAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAWAAAAAAAGABYAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIABgASAAAAAAAAAAAAAAAAABYAAAAFAAAAAAAAAAkAAAAAAAAAAAAAAAAAFgAWAAAADQAAAAAAAAAAAAAAAAAMAAYAAgAAAAwAAAAAAAAAEwAAAAAAAgARAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAABcAAAAJAAkAEAAJAAkACQAAABYACQADAAkACQAAAAAACQAAAAkAAAAAABYAEAAJAAAAAAAGAAAAAAAAAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAAGAAQABwAFAAYAAAAGABYABgAAAAYAFgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAkAAAAAAAYAFgAMAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAJAAAAFgAWAAAAAAAAAAAAAgAAAAAAAAAGABYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGQAZAAAACwALABUACwALAAsAFQAAAAAAAAAVABUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkAAAAAAAAAAAAAABIAEgASABIAEgASABIABgAAAAAAAAAAAAAAAAAAAAAAAAAGAAYABgAGAAYACAAIAAgACAAKABsAGwAbABsAGwAbABsAFgAWABYAFgAWAAAAAAAAAAAACQAEAAQABAAEAAQADQANAA0ADQAFAAUAEgAbABIAGwASABsABgAWAAYAFgAGABYABgAWAAAAFgAAABYAAAAWAAAAFgAAABYAAAAWAAYAFgAGABYABgAWAAYAFgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAkAAAAJAAkABgAEAAYABAAGAAQAAAAAAAAAAAAAAAAAGgAYABoAGAAaABgAGgAYABoAGAAMAAAADAAAAAwAAAAIAA0ACAANAAgADQAIAA0ACAANAAgADQAPAAAACgAFAAoAFAABABQAAQAUAAEAAAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAYACgAAAAAAEgAAAAAAFAAAAAAAAAAAAAAABgAAAAAACgATAAAACgAWAAAACQAAAA0AAAAEAAAABQAAAAAADQAEAA0AAAAAAAAAAAAAAAAAHAAAAAAAEQASAAAAAAAAAAAAAAAAAAYAAAAAAAYADAATABsAFgAJAAQACQAWAAUAFwAWAAkAGAAAAAAAAAAJAAUADwAAAA8AAAAPAAAACgAFAAsACwAAAAAAAAALAAAACQASABsABgAAAAAAAAAAABYACQAAAAAABwAFABYABgAAAAAABgAWAAoABQAAABMAFwAAABIAGwASABsAAAAAAAAAFgAAABYAFgATABcAAAAAAAAACQAAAAkABgAEAAYAFgAGAAQAAAAAABEABQARAAUAEQAFAA4AAwAAAAkAEwAXABYAAgAQABIAGwASABsAEgAbABIAGwASABsAEgAbABIAGwASABsAEgAbABIAGwASABsAEgAbAAAAFgAAABYAAAAWAAAAFgAAABYAAAAWAAAAFgAAABYAAAAAAAAAAAAGAAQABgAEAAYABAAGAAQABgAEAAYABAAGAAQABgAWAAYAFgAGABYABgAEAAYAFgAIAA0ACAANAAAADQAAAA0AAAANAAAADQAAAA0ACgAFAAoABQAKAAUAAAAAAAAACQAAAAkADAAAABMAFwAOAAMADgADAAAACQATABcAAAAAAAAAAAAAAAAAAAAAAAAAAAAJAAAACQAAAAkAAgAQAAoAAAAAAAAAAAAAABkAAAABAAAACgAsAI4AAURGTFQACAAEAAAAAP//AAgAAAABAAIAAwAEAAUABgAHAAhsaWdhADJsbnVtADhzbWNwAD5zczAxAERzczAyAEpzczAzAFBzczA0AFZzczA1AFwAAAABAAEAAAABAAIAAAABAAAAAAABAAMAAAABAAQAAAABAAUAAAABAAYAAAABAAcACAASABoAIgAqADIAOgBCAEoAAQAAAAEAQAAEAAAAAQH2AAEAAAABAgAAAQAAAAECEgABAAAAAQIQAAEAAAABAg4AAQAAAAECDAABAAAAAQIOAAICEADcAaYBpwGoAakBqgGrAawBrQGuAa8BsAGxAbIBswG0AegBtQG2AbcBuAG5AboBuwG8Ab0BvgGmAacBqAGpAaoBqwGsAa0BrgGvAbABsQGyAbMBtAHoAbUBtgG3AbgBuQG6AbsBvAG9Ab4C9wKiAqECogKjAqMCpAKlAqYCpwKoAqkCqgKrAqwCrQKuAq8CsAKxArICswK0ArUCtgK3ArgCuQK6ArsCvAK9Ar4CpAKlAqYCpwKoAqkCqgKrAqwCrQKuAq8CsAKxArICswK0ArUCtgK3ArgCuQK6ArsCvAK9Ar4C8wK/Ar8CwALAAsECwQLCAsICwwLDAsUCxQLGAsYCxwLHAsgCyALJAskCygLKAssCywLMAswCzQLNAs8CzwLQAtAC0QLRAtIC0gLTAtMC1ALUAtUC1gLWAtcC1wLYAtgC2QLZAtoC2gLbAtsC3ALcAt0C3QLeAt4C3wLfAuAC4ALhAuEC4gLiAuMC4wLkAuQC5QLlAuYC5gLnAucC6ALo/////wLqAuoC6wLrAuwC7ALtAu0C7gLuAu8C7wLwAvAC8QLxAvIC8gLzAvQC9AL1AvUC9gL2AqEAAQCkAAEACAABAAQBkgACAEsAAgCYAAoBmAHMAcQB1gHXAdgB2QHbAd0B5wABAIgBkQABAIgBKAABAIgBrgACAIgAAgHjAeQAAgB+AAIB5QHmAAIADQAjADwAAABDAFwAGgCDAIMANACFAIUANQHsAe0ANgHvAjEAOAI0AkUAewJIAlQAjQJXAmgAmgJqAnsArAJ+An8AvgKCApwAwAPwA/AA2wABAAEASAACAAEAEgAbAAAAAQABAEkAAQABALYAAQABADQAAQACAC0ATQ==","Roboto-Regular.ttf":"AAEAAAAOAIAAAwBgR0RFRgsuCy8AASx0AAAASEdQT1OC3T4oAAEsvAAAkPhHU1VCeolvLwABvbQAAANsT1MvMrivKcMAAAFoAAAAYFZETVhu6nZPAAASOAAABeBjbWFwf76BZgAAGBgAAA7iZ2x5ZusE9WMAACb8AADUeGhlYWT1kQ7EAAAA7AAAADZoaGVhC3AJkwAAASQAAAAkaG10eJaDaacAAAHIAAAQcGxvY2EvrvnGAAD7dAAACDptYXhwBDsA9gAAAUgAAAAgbmFtZbs83bQAAQOwAAAEeXBvc3Tfb5xiAAEILAAAJEYAAQAAAAEAAHdFsyVfDzz1AAkIAAAAAADE8BEuAAAAAM2CsmH6jf3VCXQIYgAAAAkAAgAAAAAAAAABAAAHbP4MAAAJkvqN/dgJdAABAAAAAAAAAAAAAAAAAAAEHAABAAAEHACXABYAXQAFAAEAAAAAAAAAAAAAAAAAAwABAAMElwGQAAUAAAWaBTMAAAEfBZoFMwAAA9EAZgIAAAAAAAAAAAAAAAAA4AAC/1AAIFsAAAAgAAAAAHB5cnMAQAAA//0GAP4AAGYHmgIAIAABn08BAAAEOgWwAAAAIAACAfsAAAAAAAAB+wAAAfsAAAKPAGkE+wBGBH4AbgXcAGkE+QBEAWUAZwKhAIUCqgAIA3IAHASJAE4BkgAdAjUAJQIbAKIDTAASBH4AcgR+ANcEfgBdBH4AXgR+ADkEfgCaBH4AhwR+AE0EfgBmBH4AVAH4AKACAABKBBEASASAAJgELgCGA8cAOgcvAGEFSgAnBRcAtgUeAIMFaQC2BKoAtgSnALYFfgCFBbMAtgI/AMMEagA/BSQAtgRgALYHAwC2BbQAtgWQAIIFGQC2BZAAggVMALUE4wBaBMYAOwVoAJYFKQAnBw0ASAUJAEEE8gAeBMkAYQIfAJIDSAAoAh8ACQNYAEADnAAEAnkATwRiAHIEiACRBDsAYQSIAGQENwBiAr4AQgSIAGYEiACRAfwAoQIL/7YEEwCSAfwAoQcCAJAEiACRBIgAYASIAJEEiABkAsoAkQQrAGYCjAAdBIgAjQQCAC4GDgAwBAIALgQCABsEAgBeArUAQAHzAK8CtQATBXEAggHzAJAEYQBuBKYARgW0AGkE2AAgAesAkwToAFoD9ACpBkkAWwOTAHoDwQBmBG4AfwZKAFoDqgB4Av0AggRHAGEDXwBxA2gAaQKCAIEEiACaA+kAQgIWAKIB+wB0AiYAXgOjAHoDwABvBjYAtAaWALQG6wB7A+0AcQd6//IERABZBXIAcwS6AKYEwgCLBsEAPQSwAEwEkQBHBIkAYAScAJoFmwAeAfoAmwRzAJoEMwAmAioAIwWLAKQEiACRB6EAaQdEAGEB/ACgArn/5AV/AHEEkwBgBZAAlgTzAI0CA/+0BDcAYgPEAKkDjQCMA2oAgQIhAKACtQCLAioAMgPGAIIC/ABoAp0AtgAA/NoAAP13AAD8kwAA/V4AAPwnAAD9QwINAMMECwChAhcAogRzALUFpAAgBXIAcwU+ADQEkQB6BbUAtgSRAEUFuwBOBYkAXQVSAHIEhQBkBL0AoAQCAC4EiABgBFAAYwQlAG0EiACRBI8AegKXAMMEbgAlA+wAZQTFAE8EiACRBE0AZQSIAGAELABRBF0AjwWjAFcFmgBfBpcAegTwAHQEQv/nBkgASgX/ACsFZQCHCJkAMgikALUGggBABbQAtQULAKYGBAA0B0MAGwS/AFEFtAC2BakAMAUHAFEGLQBTBdkAtAV6AJcHhwC0B8AAtAYSABEG6wC1BQUApgVkALEHJwDDBRgAYwRsAGEEkgCdA1sAmgTUAC4GIAAVBBAAWASeAJwEUgCcBKAAKAXvAJ0EnQCcBJ4AnAPYACgFzQBkBL0AnARZAGcGeACcBp8AkQT3AB4GNgCdBFgAnQRNAGQGiACdBGQALwSJ/+cETgBsBskAJwbkAJwEif/9BJ4AnAcIAJ8GKwCBBFb/3AcsAMQF+QCZBNIAKgRGAA8HDADWBgwAvAbRAJYF4QCWCQUAwwfRAJsEJABQA9sATAVyAHMEjABgBQoAFwQDAC4FcgBzBIkAYAcBAJ8GJAB+BwkAnwYsAIEFMgB4BEcAZAT9AHQAAPxnAAD8cQAA/WYAAP2kAAD6jQAA+qQEVv/cBRsAtQSKAJEEZACmA5AAkQTbALUEBgCRBQkApgR+AJoGjABFBYQAPgfPALUFtACRCDEAtAb0AJEF7gBzBNMAbQctADQFXAAfBXAAlwRrAIMFcACOBi8ARwS+/+MFCQCmBFoAmgWyALUEiACRBYcAXwSoAGkEqABpBLcAOgNJADsE9gBZBpQAWQbkAGQGVgA2BSsAMQRKAFMECAB5B8EARQZ1AD8H+wCtBqEAkAT2AHkEHQBlBa0AJAUgAEYFZACbBBQAAAgpAAAEFAAACCkAAAK5AAACCgAAAVwAAAR/AAACMAAAAaIAAADRAAAAAAAABYgAswZ9ALsDpgANAZkAYAGZADABlwAkAZoAUALUAGAC2wA8AsEAJARpAEYEjwBXArIAigPEAKYFWgCmB6oARAJmAGwCZgBZA6MAOwOrAEgDYAB6BKYARgaRAKcEPgBPBegAewPOAGgIywCrBQEAZgUXAJgGuwBvB1AAawd/AGwG2wBrBKIATAWOAKkErwBFBJIAqATFAD8IOgBrAgz/tASCAGUELQCYBDYAngQ8AJkECAArAkwAxwKPAG4CAwBcBG4AHwAAAAAIMwBbCDUAXAQcAFwDjQBXBIAAcwML/6IB/P+2AiUAGwGRAGcDpACDA54AgQOfAIED9ABtBA4AaQPz/14D7wBuA6QAWwH9AJ8EtQApBHUAmwSPAHIEpgCbBEMAmwQdAJsEzwByBPYAmwH6AJsECwBBBF0AmwO5AJsF9ACbBRkAmwTLAHIE4QByBKkAmwRvAF0ELABHBQIAjAS4ACoGBQBBBIQAOAReACAEPgBOBHcAewJpAEID4QBaBBIAWQRkAEcEaQBdBC0AegO5AEcELQBcBCcASwInAF4DVQBxA2gAaQL8AEoDeQByA3oAewMMAF4DggByA2sAaQOkAHwDlgCPArUAngNHAG8EfgBeBH4AOQR+AJoEjwCHBDoAHgRCADsEbwBaBH4AZgTDAGQEiABgBUQAtgRiAHIFLwC1BSQAtgQTAJIFPQC2BA8AkgR+AFQEdQCbA2oAgQH7AAACNQAlBYcALgWHAC4EpgAGBMYAOwKM/+MFSgAnBUoAJwVKACcFSgAnBUoAJwVKACcFSgAnBR4AgwSqALYEqgC2BKoAtgSqALYCP//cAj8AwwI///ICP//MBbQAtgWQAIIFkACCBZAAggWQAIIFkACCBWgAlgVoAJYFaACWBWgAlgTyAB4EYgByBGIAcgRiAHIEYgByBGIAcgRiAHIEYgByBDsAYQQ3AGIENwBiBDcAYgQ3AGIB+v+1AfoAmwH6/8sB+v+lBIgAkQSIAGAEiABgBIgAYASIAGAEiABgBIgAjQSIAI0EiACNBIgAjQQCABsEAgAbBUoAJwRiAHIFSgAnBGIAcgVKACcEYgByBR4AgwQ7AGEFHgCDBDsAYQUeAIMEOwBhBR4AgwQ7AGEFaQC2BR4AZASqALYENwBiBKoAtgQ3AGIEqgC2BDcAYgSqALYENwBiBKoAtgQ3AGIFfgCFBIgAZgV+AIUEiABmBX4AhQSIAGYFfgCFBIgAZgWzALYEiACRAj//xQH6/54CP/+/Afr/mAI///UB+v/OAj8AIQH8AAACPwC3BqkAwwQHAKEEagA/AgP/tAUkALYEEwCSBGAAtgH8AKEEYAC2AfwAWwRgALYCkgChBGAAtgLYAKEFtAC2BIgAkQW0ALYEiACRBbQAtgSIAJEEiP/SBZAAggSIAGAFkACCBIgAYAWQAIIEiABgBUwAtQLKAJEFTAC1AsoAWAVMALUCygBpBOMAWgQrAGYE4wBaBCsAZgTjAFoEKwBmBOMAWgQrAGYE4wBaBCsAZgTGADsCjAAdBMYAOwKMAB0ExgA7ArQAHQVoAJYEiACNBWgAlgSIAI0FaACWBIgAjQVoAJYEiACNBWgAlgSIAI0FaACWBIgAjQcNAEgGDgAwBPIAHgQCABsE8gAeBMkAYQQCAF4EyQBhBAIAXgTJAGEEAgBeB3r/8gbBAD0FcgBzBIkAYASm//MEpv/zBCwARwS1ACkEtQApBLUAKQS1ACkEtQApBLUAKQS1ACkEjwByBEMAmwRDAJsEQwCbBEMAmwH6/7MB+gCbAfr/yQH6/6MFGQCbBMsAcgTLAHIEywByBMsAcgTLAHIFAgCMBQIAjAUCAIwFAgCMBF4AIAS1ACkEtQApBLUAKQSPAHIEjwByBI8AcgSPAHIEpgCbBEMAmwRDAJsEQwCbBEMAmwRDAJsEzwByBM8AcgTPAHIEzwByBPYAmwH6/5wB+v+WAfr/zAH6//cB+gCPBAsAQQRdAJsDuQCbA7kAmwO5AJsDuQCbBRkAmwUZAJsFGQCbBMsAcgTLAHIEywByBKkAmwSpAJsEqQCbBG8AXQRvAF0EbwBdBG8AXQQsAEcELABHBQIAjAUCAIwFAgCMBQIAjAUCAIwFAgCMBgUAQQReACAEXgAgBD4ATgQ+AE4EPgBOCN4AXQVKACcFDv/mBhcAEwKjABkFpABSBVb/jQVmAD8Cl//IBUoAJwUXALYEqgC2BMkAYQWzALYCPwDDBSQAtgcDALYFtAC2BZAAggUZALYExgA7BPIAHgUJAEECP//MBPIAHgSFAGQEUABjBIgAkQKXAMMEXQCPBHMAmgSIAGAEiACaBAIALgQCAC4Cl//TBF0AjwSIAGAEXQCPBpcAegSqALYEcwC1BOMAWgI/AMMCP//MBGoAPwUkALYFJAC2BQcAUQVKACcFFwC2BHMAtQSqALYFtAC2BwMAtgWzALYFkACCBbUAtgUZALYFHgCDBMYAOwUJAEEEYgByBDcAYgSeAJwEiABgBIgAkQQ7AGEEAgAbBAIALgQ3AGIDWwCaBCsAZgH8AKEB+v+lAgv/tgRSAJwEAgAbBw0ASAYOADAHDQBIBg4AMAcNAEgGDgAwBPIAHgQCABsBZQBnAo8AaQQeAKkEugBCAgP/tAGZADAHAwC2BwIAkAVKACcEYgByBZD/PgcsAEIHeABCBKoAtgW0ALYENwBiBJ4AnAWJAF0FmgBfBQoAFwQD//kIigBgCZIAggS/AFEEEABYBR4AgwQ7AGEE8gAeBAIALgI/AMMHQwAbBiAAFQI/AMMFSgAnBGIAcgVKACcEYgByB3r/8gbBAD0EqgC2BDcAYgWHAF8ENwBiBDcAYgdDABsGIAAVBL8AUQQQAFgFtAC2BJ4AnAW0ALYEngCcBZAAggSIAGAFcgBzBIwAYAVyAHMEjABgBWQAsQRNAGQFBwBRBAIAGwUHAFEEAgAbBQcAUQQCABsFegCXBFkAZwbrALUGNgCdBQkAQQQCAC4EiABkBakAMASgACgFSgAnBGIAcgVKACcEYgByBUoAJwRiAHIFSgAnBGL/rgVKACcEYgByBUoAJwRiAHIFSgAnBGIAcgVKACcEYgByBUoAJwRiAHIFSgAnBGIAcgVKACcEYgByBUoAJwRiAHIEqgC2BDcAYgSqALYENwBiBKoAtgQ3AGIEqgC2BDcAYgSq//gEN/+zBKoAtgQ3AGIEqgC2BDcAYgSqALYENwBiAj8AwwH6AJsCPwC3AfwAlgWQAIIEiABgBZAAggSIAGAFkACCBIgAYAWQAEwEiP/LBZAAggSIAGAFkACCBIgAYAWQAIIEiABgBX8AcQSTAGAFfwBxBJMAYAV/AHEEkwBgBX8AcQSTAGAFfwBxBJMAYAVoAJYEiACNBWgAlgSIAI0FkACWBPMAjQWQAJYE8wCNBZAAlgTzAI0FkACWBPMAjQWQAJYE8wCNBPIAHgQCABsE8gAeBAIAGwTyAB4EAgAbBKYAZASmAGQFJAC2BFIAnAWzALYEnQCcBMYAOwPYACgFCQBBBAIALgV6AJcEWQBnBXoAlwRZAGcEcwC1A1sAmgdDABsGIAAVBi8ARwS+/+MEiACRBQX/1AUF/9QEcwADA1v//AU4//UEJ//YBbQAtgSeAJwFswC2BJ0AnAcDALYF7wCdBakAMASgACgE8gAeBAIALgUJAEEEAgAuBFAAYwSnABsGfQC7AAAAAAIPAKkAAAABAAEBAQEBAAwA+Aj/AAgACP/+AAkACf/9AAoACv/9AAsAC//9AAwADP/9AA0ADf/8AA4ADv/8AA8AD//8ABAAEP/8ABEAEf/7ABIAEv/7ABMAE//7ABQAFP/7ABUAFP/6ABYAFf/6ABcAFv/6ABgAF//6ABkAGP/5ABoAGf/5ABsAGv/5ABwAG//5AB0AHP/4AB4AHf/4AB8AHv/4ACAAH//4ACEAIP/3ACIAIf/3ACMAIv/3ACQAI//3ACUAJP/2ACYAJf/2ACcAJv/2ACgAJ//2ACkAJ//1ACoAKP/1ACsAKf/1ACwAKv/1AC0AK//0AC4ALP/0AC8ALf/0ADAALv/0ADEAL//zADIAMP/zADMAMf/zADQAMv/zADUAM//yADYANP/yADcANf/yADgANv/yADkAN//xADoAOP/xADsAOf/xADwAOv/xAD0AOv/wAD4AO//wAD8APP/wAEAAPf/wAEEAPv/vAEIAP//vAEMAQP/vAEQAQf/vAEUAQv/uAEYAQ//uAEcARP/uAEgARf/uAEkARv/tAEoAR//tAEsASP/tAEwASf/tAE0ASv/sAE4AS//sAE8ATP/sAFAATf/sAFEATf/rAFIATv/rAFMAT//rAFQAUP/rAFUAUf/qAFYAUv/qAFcAU//qAFgAVP/qAFkAVf/pAFoAVv/pAFsAV//pAFwAWP/pAF0AWf/oAF4AWv/oAF8AW//oAGAAXP/oAGEAXf/nAGIAXv/nAGMAX//nAGQAYP/nAGUAYP/mAGYAYf/mAGcAYv/mAGgAY//mAGkAZP/lAGoAZf/lAGsAZv/lAGwAZ//lAG0AaP/kAG4Aaf/kAG8Aav/kAHAAa//kAHEAbP/jAHIAbf/jAHMAbv/jAHQAb//jAHUAcP/iAHYAcf/iAHcAcv/iAHgAc//iAHkAc//hAHoAdP/hAHsAdf/hAHwAdv/hAH0Ad//gAH4AeP/gAH8Aef/gAIAAev/gAIEAe//fAIIAfP/fAIMAff/fAIQAfv/fAIUAf//eAIYAgP/eAIcAgf/eAIgAgv/eAIkAg//dAIoAhP/dAIsAhf/dAIwAhv/dAI0Ahv/cAI4Ah//cAI8AiP/cAJAAif/cAJEAiv/bAJIAi//bAJMAjP/bAJQAjf/bAJUAjv/aAJYAj//aAJcAkP/aAJgAkf/aAJkAkv/ZAJoAk//ZAJsAlP/ZAJwAlf/ZAJ0Alv/YAJ4Al//YAJ8AmP/YAKAAmf/YAKEAmf/XAKIAmv/XAKMAm//XAKQAnP/XAKUAnf/WAKYAnv/WAKcAn//WAKgAoP/WAKkAof/VAKoAov/VAKsAo//VAKwApP/VAK0Apf/UAK4Apv/UAK8Ap//UALAAqP/UALEAqf/TALIAqv/TALMAq//TALQArP/TALUArP/SALYArf/SALcArv/SALgAr//SALkAsP/RALoAsf/RALsAsv/RALwAs//RAL0AtP/QAL4Atf/QAL8Atv/QAMAAt//QAMEAuP/PAMIAuf/PAMMAuv/PAMQAu//PAMUAvP/OAMYAvf/OAMcAvv/OAMgAv//OAMkAv//NAMoAwP/NAMsAwf/NAMwAwv/NAM0Aw//MAM4AxP/MAM8Axf/MANAAxv/MANEAx//LANIAyP/LANMAyf/LANQAyv/LANUAy//KANYAzP/KANcAzf/KANgAzv/KANkAz//JANoA0P/JANsA0f/JANwA0v/JAN0A0v/IAN4A0//IAN8A1P/IAOAA1f/IAOEA1v/HAOIA1//HAOMA2P/HAOQA2f/HAOUA2v/GAOYA2//GAOcA3P/GAOgA3f/GAOkA3v/FAOoA3//FAOsA4P/FAOwA4f/FAO0A4v/EAO4A4//EAO8A5P/EAPAA5f/EAPEA5f/DAPIA5v/DAPMA5//DAPQA6P/DAPUA6f/CAPYA6v/CAPcA6//CAPgA7P/CAPkA7f/BAPoA7v/BAPsA7//BAPwA8P/BAP0A8f/AAP4A8v/AAP8A8//AAAAAAwAAAAMAAAiEAAEAAAAAABwAAwABAAACJgAGAgoAAAAAAQAAAQAAAAAAAAAAAAAAAAAAAAEAAgAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAMEGwAEAAUABgAHAAgACQAKAAsADAANAA4ADwAQABEAEgATABQAFQAWABcAGAAZABoAGwAcAB0AHgAfACAAIQAiACMAJAAlACYAJwAoACkAKgArACwALQAuAC8AMAAxADIAMwA0ADUANgA3ADgAOQA6ADsAPAA9AD4APwBAAEEAQgBDAEQARQBGAEcASABJAEoASwBMAE0ATgBPAFAAUQBSAFMAVABVAFYAVwBYAFkAWgBbAFwAXQBeAF8AYAAAAfUB9gH4AfoCAQIGAgoCDQIMAg4CEAIPAhECEwIVAhQCFgIXAhkCGAIaAhsCHAIeAh0CHwIhAiACIwIiAiQCJQFsAG8AYgBjAGcBbgB1AIMAbQBpAX0AcwBoAYsAfwCBAYgAcAGMAY0AZQB0AYMBhQGEAMEBiQBqAHkAtQCEAIcAfgBhAGwBhwCTAYoArQBrAHoBcAADAfEB9AIFAJAAkQFiAWMBaQFqAWUBZgCGAY4CJwKWAXQBeQFyAXMBkgNQAW0AdgFnAWsBcQHzAfsB8gH8AfkB/gH/AgAB/QIDAgQAAAICAggCCQIHAIoAmgCgAG4AnACdAJ4AdwChAJ8AmwAEBl4AAADqAIAABgBqAAAAAgANACEAfgCgAKwArQC/AMYAzwDmAO8A/gEPAREBJQEnATABOAFAAVMBXwFnAX4BfwGSAaEBsAHwAfsB/wIZAhsCNwJZArwCxwLJAt0C8wMBAwMDCQMPAyMDigOMA5IDoQOwA7kDyQPOA9ID1gQlBC8ERQRPBGIEbwR5BIYEzgTXBOEE9QUBBRAFEx4BHj8ehR7xHvMe+R9NIAsgFSAeICIgJiAwIDMgOiA8IEQgdCB/IKQgpyCsIQUhEyEWISIhJiEuIV4iAiIGIg8iEiIaIh4iKyJIImAiZSXK7gL2w/sE/v///f//AAAAAAACAA0AIAAiAKAAoQCtAK4AwADHANAA5wDwAP8BEAESASYBKAExATkBQQFUAWABaAF/AZIBoAGvAfAB+gH8AhgCGgI3AlkCvALGAskC2ALzAwADAwMJAw8DIwOEA4wDjgOTA6MDsQO6A8oD0QPWBAAEJgQwBEYEUARjBHAEegSIBM8E2ATiBPYFAgURHgAePh6AHqAe8h70H00gACATIBcgICAlIDAgMiA5IDwgRCB0IH8goyCnIKshBSETIRYhIiEmIS4hWyICIgYiDyIRIhoiHiIrIkgiYCJkJcruAfbD+wH+///8//8AAQQY//UAAP/iAAD/wAAA/78AAAExAAABLAAAASgAAAEmAAABJAAAASIAAAEcAAABHgAA/wH+9P7nAWEAAAChAGQAZv5h/kAAlv3U/aX9xP2v/aP9ov2d/Zj9hQAA/3D/bwAAAAD9BQAA/1D8+fz2AAD8tQAA/K0AAPyiAAD8nAAA/p4AAP6bAAD8RQAA5VXlFeTF5PjkWeT25ArhVgAA4U3hTOFK4UHjG+E54xPhMOEB4PcAAODRAADgdeBo4GbgW9+P4FDgJN+B3qffdd90323fat9e30LfK98o28QTjgrOAAAClAGYAAEAAAAAAAAA5AAAAOQAAADiAAAA4AAAAOoAAAEUAAABLgAAAS4AAAEuAAABOgAAAVwAAAFoAAAAAAAAAAABYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFEAAAAAAFMAWgAAAGAAAAAAAAAAZgAAAHgAAACCAAAAioAAAI6AAACxAAAAtQAAALoAAAAAAAAAAAAAAAAAAAAAALcAAAAAAAAAAAAAAAAAAAAAAAAAAACzAAAAswAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqYAAAAAAAAAAwQbAeoB6wHxAfIB8wH0AfUB9gB/Ae0CAQICAgMCBAIFAgYAgACBAgcCCAIJAgoCCwCCAIMCDAINAg4CDwIQAhEAhACFAhwCHQIeAh8CIAIhAIYAhwIiAiMCJAIlAiYAiAHsA/AAiQHuAIoCVQJWAlcCWAJZAloAiwCMAI0CYwJkAmUCZgJnAmgCaQCOAI8CagJrAmwCbQJuAm8AkACRAn4CfwKCAoMChAKFAe8B8ACSAfcCEgCpAKoC+ACrAvkC+gL7AKwArQMCAwMDBACuAwUDBgCvAwcDCACwAwkAsQMKALIDCwMMALMDDQC0ALUDDgMPAxADEQMSAxMDFAMVAL8DFwMYAMADFgDBAMIAwwDEAMUAxgDHAxkAyADJA1oDHwDNAyAAzgMhAyIDIwMkAM8A0ADRAyYDWwMnANIDKADTAykDKgDUAysA1QDWANcDLAMlANgDLQMuAy8DMAMxAzIDMwDZANoDNAM1AOUA5gDnAOgDNgDpAOoA6wM3AOwA7QDuAO8DOADwAzkDOgDxAzsA8gM8A1wDPQD9Az4A/gM/A0ADQQNCAP8BAAEBA0MDXQNEAQIBAwEEBAYDXgNfARIBEwEUARUDYANhA2MDYgEjASQECwQMBAUBJQEmAScBKAEpBAcECAEqASsEAAQBA2QDZQPyA/MBLAEtBAkECgEuAS8D9AP1ATABMQEyATMBNAE1A2YDZwP2A/cDaANpBBMEFAP4A/kBNgE3A/oD+wE4ATkBOgQEATsBPAQCBAMDagNrA2wBPQE+BBEEEgE/AUAEDQQOA/wD/QQPBBABQQN3A3YDeAN5A3oDewN8AUIBQwP+A/8DkQOSAUQBRQOTA5QEFQQWAUYDlQQXA5YDlwFiAWMEGQQYAXcD8QF5AZIDUANYA1kABAZeAAAA6gCAAAYAagAAAAIADQAhAH4AoACsAK0AvwDGAM8A5gDvAP4BDwERASUBJwEwATgBQAFTAV8BZwF+AX8BkgGhAbAB8AH7Af8CGQIbAjcCWQK8AscCyQLdAvMDAQMDAwkDDwMjA4oDjAOSA6EDsAO5A8kDzgPSA9YEJQQvBEUETwRiBG8EeQSGBM4E1wThBPUFAQUQBRMeAR4/HoUe8R7zHvkfTSALIBUgHiAiICYgMCAzIDogPCBEIHQgfyCkIKcgrCEFIRMhFiEiISYhLiFeIgIiBiIPIhIiGiIeIisiSCJgImUlyu4C9sP7BP7///3//wAAAAAAAgANACAAIgCgAKEArQCuAMAAxwDQAOcA8AD/ARABEgEmASgBMQE5AUEBVAFgAWgBfwGSAaABrwHwAfoB/AIYAhoCNwJZArwCxgLJAtgC8wMAAwMDCQMPAyMDhAOMA44DkwOjA7EDugPKA9ED1gQABCYEMARGBFAEYwRwBHoEiATPBNgE4gT2BQIFER4AHj4egB6gHvIe9B9NIAAgEyAXICAgJSAwIDIgOSA8IEQgdCB/IKMgpyCrIQUhEyEWISIhJiEuIVsiAiIGIg8iESIaIh4iKyJIImAiZCXK7gH2w/sB/v///P//AAEEGP/1AAD/4gAA/8AAAP+/AAABMQAAASwAAAEoAAABJgAAASQAAAEiAAABHAAAAR4AAP8B/vT+5wFhAAAAoQBkAGb+Yf5AAJb91P2l/cT9r/2j/aL9nf2Y/YUAAP9w/28AAAAA/QUAAP9Q/Pn89gAA/LUAAPytAAD8ogAA/JwAAP6eAAD+mwAA/EUAAOVV5RXkxeT45Fnk9uQK4VYAAOFN4UzhSuFB4xvhOeMT4TDhAeD3AADg0QAA4HXgaOBm4Fvfj+BQ4CTfgd6n33XfdN9t32rfXt9C3yvfKNvEE44KzgAAApQBmAABAAAAAAAAAOQAAADkAAAA4gAAAOAAAADqAAABFAAAAS4AAAEuAAABLgAAAToAAAFcAAABaAAAAAAAAAAAAWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABRAAAAAABTAFoAAABgAAAAAAAAAGYAAAB4AAAAggAAAIqAAACOgAAAsQAAALUAAAC6AAAAAAAAAAAAAAAAAAAAAAC3AAAAAAAAAAAAAAAAAAAAAAAAAAAAswAAALMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKmAAAAAAAAAAMEGwHqAesB8QHyAfMB9AH1AfYAfwHtAgECAgIDAgQCBQIGAIAAgQIHAggCCQIKAgsAggCDAgwCDQIOAg8CEAIRAIQAhQIcAh0CHgIfAiACIQCGAIcCIgIjAiQCJQImAIgB7APwAIkB7gCKAlUCVgJXAlgCWQJaAIsAjACNAmMCZAJlAmYCZwJoAmkAjgCPAmoCawJsAm0CbgJvAJAAkQJ+An8CggKDAoQChQHvAfAAkgH3AhIAqQCqAvgAqwL5AvoC+wCsAK0DAgMDAwQArgMFAwYArwMHAwgAsAMJALEDCgCyAwsDDACzAw0AtAC1Aw4DDwMQAxEDEgMTAxQDFQC/AxcDGADAAxYAwQDCAMMAxADFAMYAxwMZAMgAyQNaAx8AzQMgAM4DIQMiAyMDJADPANAA0QMmA1sDJwDSAygA0wMpAyoA1AMrANUA1gDXAywDJQDYAy0DLgMvAzADMQMyAzMA2QDaAzQDNQDlAOYA5wDoAzYA6QDqAOsDNwDsAO0A7gDvAzgA8AM5AzoA8QM7APIDPANcAz0A/QM+AP4DPwNAA0EDQgD/AQABAQNDA10DRAECAQMBBAQGA14DXwESARMBFAEVA2ADYQNjA2IBIwEkBAsEDAQFASUBJgEnASgBKQQHBAgBKgErBAAEAQNkA2UD8gPzASwBLQQJBAoBLgEvA/QD9QEwATEBMgEzATQBNQNmA2cD9gP3A2gDaQQTBBQD+AP5ATYBNwP6A/sBOAE5AToEBAE7ATwEAgQDA2oDawNsAT0BPgQRBBIBPwFABA0EDgP8A/0EDwQQAUEDdwN2A3gDeQN6A3sDfAFCAUMD/gP/A5EDkgFEAUUDkwOUBBUEFgFGA5UEFwOWA5cBYgFjBBkEGAF3A/EBeQGSA1ADWANZAAAAAgBpBBQCHwYYAAUACgAAAQMjEzUzBQMjETMCHy9eAYz+1i9djAWN/ocBd42L/ocCBAAAAAIARgAABKIFsAAbAB8AAAEhAyMTIzUhEyE1IRMzAyETMwMzFSMDMxUjAyMDIRMhAsz++FCPUO8BCUb+/QEeUY9RAQhRkFHL5kbh+1CQngEIRv74AZr+ZgGahwFmiQGg/mABoP5gif6ah/5mAiEBZgABAG7/MAQRBpsAKwAAATQmJy4BNTQ2NzUzFR4BFSM0JiMiBhUUFhceARUUBgcVIzUuATUzFBYzMjYDWH+bz8m8qpWst7iAeHx5eabRwsu3lLDduaB4hpMBdl1/ND/GrajMFdrbGOnOjKh8bmV3OES/rK/IEr+/EdPZoIJ8AAAAAAUAaf/rBYMFxQANABsAKQA3ADsAABM0NjMyFh0BFAYjIiY1MxQWMzI2PQE0JiMiBhUBNDYzMhYdARQGIyImNTMUFjMyNj0BNCYjIgYVBScBF2mgioqhoImLoYtST01RUk5OUQI6oIqKoaCJi6GLUk9OUVJPTlH+EmgCx2gEmIKrq4JNgaqqgU1nZ01NTWlpTfzNgaurgU6CqqqCTWhnTk5NaGhN9kEEckEAAAADAET/6wTRBcUAIAArADgAABM0NjcuATU0NjMyFhUUBg8BAT4BNTMUBgcXIycOASMiJgUyNjcBBw4BFRQWAxQWFzc+ATU0JiMiBkSMj1BKvayfvmVmcwFcLC+mTEu+3VtTv2zc+wHXTI5A/o8qYTyQDzc4kDopYFJXWQGGfLRgYptUq7OxgmOLS1X+XkSdXIXcW+NsQEHgSzIyAbofSXw0dJID6Td0R2QnWTdAXXAAAAEAZwQjAP0GGAAFAAATAyMTNTP9OV0BlQWo/nsBdYAAAQCF/ioClQZqAA8AABMQADcXBgIRFRASFwcmABGFATW1Jo3KyY4mtv7MAk8BjwInZXhs/iz+nw7+n/4sdW9mAiQBkQABAAj+KgIYBmoADwAAARAAByc2EhE1EAInNxYAEQIY/su0J4vM0oUntAE1AkX+b/3cZm9rAd0BYg4BXAHfb29m/dn+cgAAAAABABwCYgNVBbAADgAAASU3BQMzAyUXBRMHCwEnAUr+0i4BLgmZCgEpLv7Nxny6tH0D2FuUcAFZ/qFwllz+8F0BIf7mWgAAAAABAE4AkgQ0BLYACwAAASEVIREjESE1IREzAp4Blv5quv5qAZa6Awus/jMBzawBqwABAB3+zAE0ANoACQAAJRQGByc+AT0BMwE0XFJpMC65RmTPR0hJkVWXAAAAAAEAJQIhAg0CtgADAAABITUhAg3+GAHoAiGVAAABAKIAAAFeAMUAAwAAISM1MwFevLzFAAABABL/gwMQBbAAAwAAFyMBM7GfAmCefQYtAAAAAgBy/+sEDAXFAA0AGwAAARACIyICGQEQEjMyEhEnNCYjIgYVERQWMzI2NQQM8dva9PLa2/O5i4qJioyJiokCLP7j/twBJQEcAVcBHAEm/tr+5CjEwMDE/lvEwsDGAAAAAQDXAAACuQWwAAUAACEjEQU1JQK5uf7XAeIE3Ah3ZQABAF0AAAQjBcUAGAAAKQE1AT4BNTQmIyIGFSM0NjMyFhUUBgcBIQQj/FYB3YRagXCckbn+6MbljIP+eQLLgwITkqdacpSakcP+4LV56ZD+VwAAAAABAF7/6wP6BcUAKAAAATMyNjU0JiMiBhUjNDYzMhYVFAYHHgEVFAQjIiQ1MxQWMzI2NTQmKwEBhqeKc36BeY659srO6m5wh27/AM7K/vy6koKFkISQpwMwhHiBgoh0reXTyl2wMCu2dcvf1cF3ioeKi4AAAAIAOQAABFEFsAAKAA8AAAEzFSMRIxEhNQEzASERIwcDhM3NuP1tAofE/X0BywMbAeiV/q0BU2sD8vw4AslGAAABAJr/6wQRBbAAHgAAGwEhFSEDPgE3NhIVFAIjIiY1MxQWMzI2NTQmIyIGB7FUAtX9xzAwclHK4+TlvPKvi3SEjI2AemwaApEDH6n+XCUtAgL+++Tg/vvHzXyDr5+Rs0ZMAAAAAgCH/+sEMwXFABoAJwAAATIWFwcuASMiBh0BPgEzMhIVFAIjIgAZARAAEyIGBxUUFjMyNjU0JgKfTJEyKDRpSqC/QaVjx+Pz0Nj+7wEwqWqRJaqGgIqSBcUiG5EaHvXOIjtB/vfV5f7oAS8BHgEfARsBU/1zVUpzztjMnJa6AAABAE0AAAQiBbAADAAAAQACAwcjNxoBEyE1IQQi/ve+KQ+6Dyvw2PziA9UFGv7B/hv+o5mZAWICFwEIlgADAGb/6wQYBcUAGAAkADAAAAEUBgceARUUBCMiJDU0Njc1LgE1NDYzMhYDNCYjIgYVFBYzMjYDNCYjIgYVFBYzMjYD8H9vgZX+/tba/wCRf2166cbD75Gif4Kdm4aBnimKbnCGh3FvhwQ1dakrLbh+zdHQzn65LAMpqXTEzM38lXuamXyAjY4DI3COiXVzhoYAAAAAAgBU/+sD/QXFABsAKAAAJTI2PQEnDgEjIgI1NAAzMgAZARAAIyImJzceARMyNjc1NCYjIgYVFBYB/5auAzCWXtfxAQLA5gEB/uroT5tCHT9+b3KUIZWSdJqOgNbaLAFJSgED8egBH/7q/uf+nP7g/tkcH5AeGAHfYE2cxcLMpaG+AAD//wCgAAABXQQ6ACYAEP4AAAcAEP//A3X//wBK/swBYQQ6ACcAEAAAA3UABgAOLQAAAQBIAMUDegRJAAkAAAEHFRcFFQE1ARUBQk9PAjj8zgMyApsUBBTpwQF7jwF6wQAAAgCYAZAD2gPNAAMABwAAASE1IREhNSED2vy+A0L8vgNCAy+e/cOeAAEAhgDGA9wESgAJAAATNQEVATUlNzUnhgNW/KoCXFJSA4+7/oaP/oW88hUDFgAAAAIAOgAAA28FxQAZAB0AAAE+ATc+ATU0JiMiBhUjPgEzMhYVFAYHDgEVEyM1MwFnAS1mZlRybmGAugLjtsbUiXg4FgjExAGZk2pddn5db3JlZKnAxbeE0HQ2VF7+Z8sAAAIAYf47BtgFlgAzAEMAAAEGAiMiJicOASMiJjcaATMyFhcHMwMGFjMyNjcSACEgAAMCACEyNjcXDgEjIAATEgAhIAABBhYzMjY3PAE3Ey4BIyIGBscJ2d9LaRY0jmKBhxIY4qhqekwEBjMJPzSAlAkR/sP+pv7E/ogQEgFOAURasUAlRctk/n3+aBITAcYBfAGEAYz78AxDT0RuLgIvGzwigYgB99r+zlROU0/tyAEIATMzNwT9uHJT4rUBhwGj/jj+hf6A/lAqJGgrLgHqAbkBrwIJ/hf985KVNUYQFQwCGg0Q2QAAAAACACcAAAUiBbAABwAKAAABIQMjATMBIwEhAwPY/ZuPvQIyoAIpvf1FAfj6AYT+fAWw+lACGQKyAAMAtgAABKkFsAAPABgAIQAAMxEhMhYVFAYHFR4BFRQGIwERITI2NTQmIyUhPgE1NCYjIbYB0+j9eWODlP7h/qUBW42ZgYn+iQFMc4eXlf7mBbDByGSYJAMbx4jLzwKt/eiFfoOSlQN3b3p1AAEAg//rBMkFxQAbAAABBgAjIgAZARAAMzIEFyMuASMiAhURFBIzMjY3BMkY/u/x/P7QATD89QENGLkZo6Wsx8espqIZAc3c/voBWAEUAQEBEwFa/eimqf73zP79zv73pKkAAAACALYAAATnBbAACQATAAAzESEgABEVEAAhAxEzMhI9ATQmI7YBuwEiAVT+qP7Q8PDo5uLaBbD+pv7kxf7i/qkFGvt7AQXbx9//AAAAAQC2AAAEdQWwAAsAAAEhESEVIREhFSERIQQP/WADBvxBA7X9BAKgAqb975UFsJb+IgAAAAEAtgAABHMFsAAJAAABIREjESEVIREhBA39YrkDvfz8Ap4CiP14BbCW/gQAAQCF/+sE2wXFAB8AACUOASMgABkBEAAhMgQXIy4BIyIGFREUFjMyNjcRITUhBNs0/c/+9/6zATcBAPgBCB+5GqOpr87kuIKiI/62AgO/UIQBSgEPASkBDwFJ7c6HnvnH/tXJ+0IsAVCVAAAAAQC2AAAE/QWwAAsAACEjESERIxEzESERMwT9uf0rubkC1bkChv16BbD9awKVAAAAAQDDAAABfAWwAAMAACEjETMBfLm5BbAAAQA//+sDwAWwAA8AAAEzERQGIyImNTMUFjMyNjUDB7nyx9XzuYqFco4FsPvkyOHS1IyFlIAAAAABALYAAAUcBbAADAAAASMRIxEzETMBMwkBIwIfsLm5nwIR1P3DAmbjApT9bAWw/XkCh/0+/RIAAAEAtgAABCUFsAAFAAAlIRUhETMBbwK2/JG5lZUFsAAAAQC2AAAGTQWwABAAAAkCMxEjERMjASMBIxMRIxEBpAHdAd7uuRMD/ht8/hwDE7kFsPtPBLH6UAJHAmP7VgSo/Z/9uQWwAAAAAQC2AAAE/gWwAAsAACEjASMRIxEzATMRMwT+uf0tA7m5AtMDuQR7+4UFsPuGBHoAAgCC/+sFDQXFAA0AGwAAARAAISAAGQEQACEgABEnNAIjIgIVERQSMzISNQUN/rv+9v7+/sYBOgECAQoBRbnavLTPz7S92QJX/vT+oAFgAQwBAQELAWL+nv71AskBBv76yf79y/76AQXMAAAAAgC2AAAExAWwAAoAEwAAAREjESEyFhUUBiMlITI2NTQmIyEBb7kCJO39/e3+lQFrnJWVnP6VAkr9tgWw68jK6ZWffX6hAAAAAgCC/wwFDQXFABMAIQAAARQCBxcHJQ4BIyAAGQEQACEgABEnNAIjIgIVERQSMzISNQUNfHPuf/7yL18z/v7+xgE6AQIBCgFFudq8tM/PtL3ZAleh/vtW3HP9DhABYAEMAQEBCwFi/p7+9QLJAQb++sn+/cv++gEFzAAAAAIAtQAABOIFrwAaACMAAAERIxEhMhYVFAYHHgEdARQWFxUjLgE9ATQmIyUhMjY1NCYjIQFuuQIK8/d5dXtpHiW/KBaMfP6RAT6vlZKf/q8Cev2GBa/PznKkMiirhIlGaSMYI4NGhXqPlYCFf4cAAAABAFr/6wSKBcUAJQAAATQmJy4BNTQkMzIAFSM0JiMiBhUUFhceARUUBCMiJDUzFBYzMjYD0JbH7P4BE+HxARi5rKSboKnI6u3+5evf/rW5056csAFuaIUxONClrd/+/raEnoVuYn8xO9ins9Loz5GRfgAAAAEAOwAABIoFsAAHAAABIREjESE1IQSK/jW5/jUETwUa+uYFGpYAAAABAJb/6wTXBbAAEQAAAREUBCMiJDURMxEUFjMyNjURBNf+0vv0/ty6vaGpxwWw/CXy+PjyA9v8JauqqqsD2wAAAQAnAAAFAgWwAAkAAAEXMzcBMwEjATMCciEEIQGCyP3jof3jyQFednYEUvpQBbAAAQBIAAAGwgWwABUAAAEXMzcBMwEXMzcTMwEjAScjBwEjATMB0x8DLAERpQETKwMhz7r+rqb+2x0DHf7Xpv6vuQHvysoDwfw/zMwDwfpQA/2RkfwDBbAAAAEAQQAABNAFsAALAAAJATMJASMJASMJATMChgFg3/4vAdzc/pb+l+AB3P4v3gNzAj39Lv0iAkj9uALeAtIAAAABAB4AAATTBbAACAAACQEzAREjEQEzAngBh9T9/rj+BdQCvgLy/FL9/gIPA6EAAAABAGEAAARtBbAACQAAJSEVITUBITUhFQE1Azj79AMU/PkD3pWVjQSNlogAAAEAkv7IAgsGgAAHAAABIxEzFSERIQILv7/+hwF5Ber5dJYHuAAAAAABACj/gwM4BbAAAwAAEzMBIyiwAmCwBbD50wAAAQAJ/sgBgwaAAAcAABMhESE1MxEjCQF6/obBwQaA+EiWBowAAQBAAtkDFAWwAAkAABMjATMBIwMnIwfsrAErfwEqq6sTBBMC2QLX/SkBqlVVAAAAAQAE/2sDmAAAAAMAAAUhNSEDmPxsA5SVlQAAAAEATwS7AeQFxQADAAABIwMzAeSY/eIEuwEKAAACAHL/7APsBE4AHwAqAAAhLgEnDgEjIiY1NDY7ATU0JiMiBhUjNDYzMhYVERQWFyUyNjc1IyIGFRQWAy0KCgI6rGerrfjc0XpxaYG57r+73wwQ/flopSXXgZRdM0IkTGGpmZ6sbmNvY0d9w7iy/fY6ajaLYEbHeVVLVAAAAgCR/+wEJQYYABIAIAAAARQCIyImJwcjETMRFz4BMzISESM0JiMiBgcRHgEzMjY1BCXbyW2cNRKgugMylmnL27mKkWF/Jid/YpGIAfXw/udSUpAGGP2gAUpN/sb+9sDqWk/+JVBaxqkAAAAAAQBh/+wD8gROABsAACUyNjczDgEjIgI9ATQSMzIWFyMuASMiBh0BFBYCQ2eXAbAB/6/u9PTuv+8BsAGOcKGHhoF4XJTVAS/tKuwBMNysaIrfpyqr3AAAAAIAZP/sA/AGGAASACAAABMQEjMyFhc3ETMRIycOASMiAjUzFBYzMjY3ES4BIyIGFWTazGSSNAO5oRA2mGnJ27mHkl56KSh8W5OIAgoBCgE6SEYBAlf56IdOTQEa76rFUkwB9khS6sAAAgBi/+wD6QROABUAHQAABSIAPQE0ADMyEh0BIR4BMzI2NxcOAQMiBgchNTQmAk7k/vgBD7/c3f0zBJ2RZZM7STu5pmmRFAIOgBQBJ/Qt7AEu/v7geabMODN7OksDzKmHGnmdAAEAQgAAAs4GLQAXAAAzESM1MzU0NjMyFhcHLgEjIgYdATMVIxHsqqqvoyJDKxcTMh1aVebmA62Ni6+5CwqRBQZoZYuN/FMAAAIAZv5MA/cETgAeACwAABMQEjMyFhc3MxEUBiMiJic3HgEzMjY9AScOASMiAjUzFBYzMjY3ES4BIyIGFWbezWqYNhKc8uRUs00vQpVMk4wDNJRkyt+5ipNeeyknfF2TjAIKAQoBOlJRj/vU1uwsKoohKZ2PaQFGRgEa76nGU04B8EpT678AAAABAJEAAAP6BhgAFAAAARc+ATMyFhURIxE0JiMiBgcRIxEzAUsDN6Jnsbu5dHdXiCy6ugOnAVBYzN39WwKnjYBSSPzmBhgAAAACAKEAAAFaBhgAAwAHAAAhIxEzESM1MwFaubm5uQQ6ARjGAAAC/7b+SwFnBhgADwATAAABERQGIyImJzceATMyNjUREyM1MwFnp5sgMh0ODzURRk+zubkEOvttqrIJCZYFCFpnBJMBHMIAAAABAJIAAAQUBhgADAAAASMRIxEzETMBMwkBIwHNgbq6fgE72/6GAa7bAfb+CgYY/HUBrf4T/bMAAAEAoQAAAVoGGAADAAAhIxEzAVq5uQYYAAEAkAAABnIETgAkAAABHwE+ATMyFhc+ATMyFhURIxE0JiMOAQcVESMRNCYjIgYHESMRATcNAzShcHGaJzSndam7um9xb4ALunJwYXcgugQ6kAFPVmVqYW7c6P12AoulhAGSbwH9TwKNnYpQSvzmBDoAAAAAAQCRAAAD+AROABQAAAEfAT4BMzIWFREjETQmIyIGBxEjEQE4DQM1o2uxvLpxeVuFKboEOqIBV2DI2/1VAqeVeFZN/O8EOgAAAgBg/+wEJwROAA0AGwAAEzQAMzIAHQEUACMiADUzFBYzMjY9ATQmIyIGFWABAOLkAQH/AOPk/wC6lJaUlpeVlJQCKPUBMf7P9Rj2/tIBLvax3t+wGK7i4q4AAAACAJH+YAQkBE4AEgAgAAABFAIjIiYnBxEjETMXPgEzMhIRIzQmIyIGBxEeATMyNjUEJNvJZ5Y1A7qfEjaaa8zbupCTW3smKHldko8B9fD+50NDAf3vBdqKTlD+x/71v+tQRv32R0zLqQAAAAACAGT+YAPmBE4AEgAgAAATEBIzMhYXNzMRIxEnDgEjIgI1MxQWMzI2NxEuASMiBhVk2sxkkzYPoLkDNI5gydu5h5JYdikpd1WTiAIKAQoBOklIffomAgoBQD8BGu+qykpGAhpCS+3BAAEAkQAAArEETgAQAAABJyIGBxEjETMfAT4BMzIWFwKYbFVuHrqmEgMtiFwYLw0DkwZOSfz+BDqdAVReBwQAAAABAGb/7APCBE4AJQAAATQmJy4BNTQ2MzIWFSM0JiMiBhUUFhceARUUBiMiJjUzHgEzMjYDCWSRyMHatsDcuXppbmlaks/D47/R6bkGlGdweQEeRFUfK5CBhra/kkpxXUNDSR8tlIGSrc2TbV5VAAAAAQAd/+wCTgVBABcAAAERMxUjERQWMzI2NxcOASMiJjURIzUzEQFy0NA2LxgxFRkaXS5xgJubBUH++Y39alA/BwaDERWNngKWjQEHAAEAjf/sA/YEOgAUAAAlJw4BIyImNREzERQWMzI2NxEzESMDQwMynm20wrpocXCJJLmmngFXXN30An39gbKDV1MDCvvGAAAAAAEALgAAA98EOgAJAAABFzM3ATMBIwEzAfIWAxcBAL3+cI3+bL0BOl1dAwD7xgQ6AAEAMAAABdgEOgAVAAABHwE3EzMTFzM3EzMBIwMnIwcDIwEzAaAbAyHaltojAyKvuP7GltYvAy3Sl/7GuQGGlgGXArT9TKSkArT7xgKbwcH9ZQQ6AAEALgAAA88EOgALAAABEzMJASMLASMJATMB/PDY/p8BbNX6+tgBbf6e1gKnAZP96f3dAZ7+YgIjAhcAAAEAG/5LA+QEOgAVAAABFzMBMwEOASMiJic3JhYzMjY/AQEzAdkmAwETz/42KZSEGEYUEwNOC0M+LjH+a88BhpADRPsfb58LBZUBBktrdQQkAAAAAAEAXgAAA7gEOgAJAAAlIRUhNQEhNSEVAT4CevymAlH9twMulZWFAx6XgQAAAQBA/pACngY9AB4AAAEuAT0BNCYjNTI2PQE0NjcXDgEdARQGBx4BHQEUFhcCeMSgZm5uZp/FJnNeUldXUl5z/pA4667Pc3yPenTQrus4cSWziNBrni0unmrPh7MlAAAAAQCv/vIBRAWwAAMAAAEjETMBRJWV/vIGvgAAAAEAE/6QAnIGPQAeAAAXPgE9ATQ2Ny4BPQE0Jic3HgEdARQWMxUiBh0BFAYHE3JgV19fV19yJsSgZW9vZaDE/iWzh89unCsqnm/QiLMlcTjqr9B0eo98c8+u6zgAAQCCAZME7wMhABkAAAEUBiMiJicuASMiBhUnNDYzMhYXHgEzMjY1BO+qg1uOWjxhNEZfh6eFWpJXPGA1RWEC5IvGQUsyMGpPEoq9REg1LXJRAAAAAgCQ/ooBTQQ6AAMABwAAASMRMxMjNTMBS7m5Ar29/ooD0gESzAAAAAEAbv8LA/8FJgAhAAAlMjY3Mw4BBxUjNSYCPQE0Ejc1MxUeARcjLgEjIgYdARQWAlBnlwGwAcqWurq8vLq6oMABsAGOcKGHhoF4XILIGOjsIwEfzyrNAR8l494Y0phoit+nKqvcAAAAAQBGAAAEUQXFACEAAAEXFAYHIQchNTM+ATUnIzUzAzQ2MzIWFSM0JiMiBhUTIRUBqQYhIALjAfw2CjQyBqqkCtu+ytW6fWhpdgoBpwJqmF2jPZWVDcVrmJUBEdDlz7R8cZSL/u+VAAACAGn/5QVbBPEAIwAvAAAlDgEjIiYnByc3LgE1NDY3JzcXPgEzMhYXNxcHHgEVFAYHFwcBFBIzMhI1NAIjIgIET0+5aGm3ToaCjDQ1OTiUgpNMsWRksU6VhJg2OTUxj4T8YPS0svT0srT0cEFDQkCIhY5Os2ZpuVGXhpY7PT47mIebULdoZLJOkYYCe8P++AEIw8EBB/75AAEAIAAABKsFsAAWAAAJATMBIRUhFSEVIREjESE1ITUhNSEBMwJmAXHU/loBP/57AYX+e7n+gwF9/oMBPv5Z1QMNAqP9L3irdv66AUZ2q3gC0QAAAAIAk/7yAU0FsAADAAcAABMRMxkBIxEzk7q6uv7yAxb86gPIAvYAAAACAFr+EQR4BcUAMQBDAAABFAYHHgEVFAQjIiQ1NxQWMzI2NTQmJy4BNTQ2Ny4BNTQkMzIEFSM0JiMiBhUUFhceASUuAScOARUUFhceARc+ATU0JgR4YFtJRv785OH+17rDjY+fjdL13l5aR0QBBuPsAQC5oZKZloPa+dv94jROIlBMh9sxTCNPVJIBr2CJKTSFZa7Ay+QClYZ3X19jQEGztF2LKjOHZKjG3dJ7nndfZ2E8Ra9UDRgOE2NJaGU9DhgMFGNIXmoAAAIAqQTsA1IFsAADAAcAAAEjNTMFIzUzA1LT0/4r1NQE7MTExAAAAAADAFv/6wXmBcQAGwAnADMAAAEUBiMiJj0BNDYzMhYVIzQmIyIGHQEUFjMyNjUlEAAzMgAREAAjIgADEAAhIAAREAAhIAAEX62eori4op6ukltfY2dnY19a/QEBVv37AVf+qfv9/qpzAZgBLgEsAZn+Z/7U/tL+aAJUnpzRsnew052cY1eNdnh5jFZmhf7w/pcBaQEQAQ4BZ/6Z/vIBQQGq/lb+v/6+/lQBqwAAAgB6ArQDDwXFAB8AKgAAAS4BJw4BIyImNTQ2OwE1NCYjIgYVJzQ2MzIWFREUFhclMjY3NSMiBhUUFgJqCAoDInBQeYCko5E9P0hMoaeOh5gMDv6LN24TkE9WPALCFTAaMTx4bG92NUNFNzUOaIGMiP7GM1creTsmckIwMDEAAP//AGYAdwNkA5EAJgFy+t0ABwFyAUT/3QABAH8BeAO+Ax8ABQAAASMRITUhA766/XsDPwF4AQifAAQAWv/rBeUFxAALABcAMgA7AAATEAAhIAAREAAhIAATEAAzMgAREAAjIgABESMRITIWFRQGBx4BHQEUFhcVIy4BPQE0JiMnMz4BNTQmKwFaAZgBLgEsAZn+Z/7U/tL+aHMBVv38AVb+qvz9/qoBwI0BFJqoQkBDOgcKkQoEQ1CjnEVbTmeHAtkBQQGq/lb+v/6+/lQBqwFD/vD+lwFpARABDgFn/pn+qf6sA1KAgD9dIBtoTDgqQBUQFk8rNktDfgE/O0w7AAAAAQB4BSMDQgWwAAMAAAEhNSEDQv02AsoFI40AAAIAggPBAnwFxQALABcAABM0NjMyFhUUBiMiJjcUFjMyNjU0JiMiBoKUa2mSkmlrlH1KODdJSTc3SwTBbJiYbG2Tk205SUg6OktMAAACAGEACQP1BPMACwAPAAABIRUhESMRITUhETMBITUhAooBa/6Vp/5+AYKnAUz8vQNDA1aW/mEBn5YBnfsWlQAAAQBxApsCxgXHABgAAAEhNQE+ATU0JiMiBhUjNDYzMhYVFAYPASECxv20AS9ILDo/SEqhpI+IlFd1qAF6Apt+AQg+Siw0P0E1aYx9dlBtbJIAAAAAAQBpAo8C4AXGACgAAAEyNjU0JiMiBhUjNDYzMhYVFAYHHgEVFAYjIiY1MxQWMzI2NTQmKwE1AadIQUlKO0qip4CSo0U/SEqwk4C0o01ETVRKTYMEbzo2LjoyKmV2dXA4WhoYXUZxenR1MTo7M0E5egAAAAABAIEEvAIeBcYAAwAAATMBIwE94f7wjQXG/vYAAQCa/mAD7gQ6ABYAAAERFBYzMjY3ETMRIy8BDgEjIiYnESMRAVNxa2p7ILqmCgMrgVhMbiq5BDr9kcOITUwDIfvGbgFBQyIo/isF2gAAAAABAEIAAAM/BbAACgAAIREjIiY1NBIzIREChVfu/v/tARECCP/V0wEB+lAAAAEAogJwAWEDQQADAAABIzUzAWG/vwJw0QAAAAABAHT+TQGqAAAADwAAIQceARUUBiMnMjY1NCYnNwEdDENWm5QHSlxIWiA1C1BSYXBqMTMyJgeGAAEAXgKZAYQFxQAFAAABIxEHNSUBhKSCASYCmQKUAYIXAAAAAAIAegKzAycFxQANABsAABM0NjMyFh0BFAYjIiY1MxQWMzI2PQE0JiMiBhV6t5+gt7afoLijWltYWltZWVoEdpa5uJd1mLa3l1tra1t1WGxsWAAA//8AbwCZA3gDtAAmAXMWAAAHAXMBagAA//8AtAAABdwFxAAnAckAVgKYACcBdAEVAAgABwGXArgAAAAA//8AtAAABe4FxAAnAXQBIgAIACcByQBWApgABwHKAygAAAAA//8AewAABp0FxwAnAXQB0QAIACcBlwN5AAAABwHLABICmwAAAAIAcf52A6YEOwAZAB0AAAEOAQcOARUUFjMyNjczDgEjIiY1NDY3PgE1AzMVIwJ6Ai1mZ1Nxb2CBAbkD47XH04h5NxcIxMQCoZRpXXd9XG9yZWSpwMW3gtB1NVRfAZrMAAL/8gAAB1cFsAAPABMAACkBAyEDIwEhFSETIRUhEyEBIQMjB1f8jQ/9zM3iA3ADt/1NFAJO/bgXAsD6rQHKHwMBYv6eBbCW/iaV/eoBeQLcAAAAAAEAWQDiA90EdgALAAATCQE3CQEXCQEHCQFZAUr+uHcBSQFJd/63AUt3/rX+tQFcAVEBT3r+sQFPev6x/q96AVH+rwAAAwBz/6ME/gXsABkAJAAvAAABEAAhIiYnByM3LgE1ERAAITIWFzczBx4BFQEUFhcBLgEjIgIVITQmJwEeATMyEjUE/v67/vZWlUJdj4xWWQE6AQJip0lUj4ZOUvwuKSoCLDR9S7TPAxkkIv3XLmtAvdkCV/70/qAqKpzqV+iLAQEBCwFiNTKO4Ffcgf7/WJg9A6UsLv76yU2JO/xhIyMBBcwAAAACAKYAAARdBbAADAAVAAABESEyFhUUBiMhESMRExEhMjY1NCYjAWABFer+/ur+67q6ARWZlZWZBbD+2ujAwef+xgWw/kX92px1dp8AAQCL/+wEagYPACcAACEjETQ2MzIWFRQGFRQAFRQGIyImJzceATMyNjU0ADU0NjU0JiMiBhUBRLniuqHEgAFez7JTsSgrKoNAcmr+oopnRW5/BDrh9Kiod9g8VP7ojqmlKx2ZHS9eUlcBGpRT2U5fa6ScAAADAD3/6wZ8BE4ALAA3AD8AAAUiJicOASMiJjU0NjsBNTQmIyIGFSc0NjMyFhc+ATMyFh0BIR4BMzI2NxcOASUyNjc1IyIGFRQWASIGByE1NCYE7ovKQznao6224d/qaWdvfbjiwnWsMkGuadji/S4EnaNqhkxAObX8SFCnLOiAiWcDZXeNEAIVexVhXVJsq5miqlVweG5SEpC0UlJQVP/ndarJODOFL0yVWDrfcVVOXQM4q40ffpsAAgBM/+sELQXtACAAMAAAARYSHQEUACMiADU0ADMyFhc3LgEnBSc3LgEnNx4BFzcXAzQmNS4BIyIGFRQWMzI2NQNTanD+59rd/u8BDtpXlzkDF1Y+/utJ+iZPKzlMhj3sSbgBJKB7jKOnkoyqBQd8/rvOYfr+zgET0+oBFkA3AWqmQZ5jjxgnEJ4XRTGHY/z2CCIJPVHPm4jJ47QAAwBHALcELQSvAAMABwALAAABITUhJSM1MxEjNTMELfwaA+b+bb29vb0CWrTax/wIxwAAAAMAYP95BCcEuQAZACQALwAAEzQAMzIWFzczBx4BHQEUACMiJicHIzcuATUzFBYXAS4BIyIGFSE0JicBHgEzMjY1YAEA4jpmMEp7aFpe/wDjNVsrSXtkZGW6LC8BVx9EJ5SUAlQnJ/6uGjkjlJYCKPUBMRcVl9JL5JAY9v7SERGVy0nqmWCbNwK3ERLirlaROP1SDQvfsAAAAgCa/mAELQYYABMAIQAAARQCIyImJwcRIxEzERc+ATMyEhEjNCYjIgYHER4BMzI2NQQt28lnljUDurkDNJZmzNu6kJNbeicoeV2SjwH18P7nQ0MB/e8HuP2oAUZJ/sf+9b/rUEb99kdMy6kAAgAeAAAFiQWwABMAFwAAATMVIxEjESERIxEjNTMRMxEhETMBITUhBPeSkrn9K7mSkrkC1bn8cgLV/SsEjY38AAKG/XoEAI0BI/7dASP9a+UAAAAAAQCbAAABVQQ6AAMAACEjETMBVbq6BDoAAQCaAAAEPwQ6AAwAAAEjESMRMxEzATMJASMBvmq6ulsBjd/+NwHt6QHP/jEEOv41Acv9+P3OAAABACYAAAQVBbAADQAAASUVBREhFSERBzU3ETMBXwEU/uwCtvyRgIC5A0dYn1j97ZUCbSifKAKkAAEAIwAAAgsGGAALAAABNxUHESMRBzU3ETMBcZqauZWVuQNnO6A7/TkCgDmgOQL4AAEApP5LBO0FsAAYAAABERQGIyImJzceATMyNj0BASMRIxEzATMRBO2omyAzHQ4OQhJCSP0tA7q6AtMDBbD596qyCQmRBQhnX1kEb/uRBbD7kQRvAAEAkf5LA/AETgAgAAABHwE+ATMyFhURFAYjIiYnNx4BMzI2NRE0JiMiBgcRIxEBNw0DNZ5psbynmyA1Hg4OQxRCR3N5XH0nugQ6lQFRWcnc/P6qsgkJmgUHX10C/pZ5RkH80wQ6AAAAAgBp/+sHOAXFABcAJQAAKQEOASMiABkBEAAzMhYXIRUhESEVIREhBTI2NxEuASMiBhURFBYHOPyCXoFF/f7QAS79R45RA3T9BAKg/WADBvteOHE6OnE6scHDCgsBRgEPATABDgFHDAmW/iKW/e8VCAkEjQgK49v+ztzkAAMAYf/rBwAETgAhAC8ANwAAEzQSMzIWFz4BMzISHQEhHgEzMjY3Fw4BIyImJw4BIyIANTMUFjMyNj0BNCYjIgYVASIGByE1NCZh/+OHyEBCwnHc3f0yBJ2QZ5U4Sjy6iIfMQEHFheT/ALmVlpSVlpWVlAQtapEUAg6AAij1ATFxaGdy/v3feabNOTN7O0ttZ2dtAS/2sd/fsRiv4eKuAZCphxp5nQAAAAEAoAAAAoIGLQAPAAAzETQ2MzIWFwcuASMiBhURoLCjIkMqFxUsGltcBMWwuAsKjAUGbWX7OwAAAf/k/ksCvAYtACMAAAEjERQGIyImJzceATMyNjURIzUzNTQ2MzIWFwcuASMiBh0BMwJgy6ebIDMcDg5AE0FHq6uvoyJDKhYUMhxaVcsDrfv6qrIJCZEFCGdfBAaNi6+5CwqRBQZoZYsAAAAAAgBx/+sFnQY2ABcAJQAAARAAISAAGQEQACEyFhc+ATUzFAYHHgEVJzQCIyICFREUEjMyEjUE/P67/vb+/v7GAToBAnrKUGFUp32ALS+52ry0z8+0vdkCV/70/qABYAEMAQEBCwFiUUwKhn6jwyBMrGACyQEG/vrJ/v3L/voBBcwAAAAAAgBg/+wEugSwABcAJQAAEzQAMzIWFz4BNTMUBgceAR0BFAAjIgA1MxQWMzI2PQE0JiMiBhVgAQDia6hBVziVZHUjI/8A4+T/ALqUlpSWl5WUlAIo9QExR0QIcnOUqRpCmFcY9v7SAS72sd7fsBiu4uKuAAABAJb/6wYmBg0AGQAAARU+ATUzFAYHERQEIyIkNREzERQWMzI2NREE115Kp5+w/tL79P7cur2hqccFsM0WkITG1xb9e/L4+PID2/wlq6qqqwPbAAABAI3/7AUQBJEAHAAAARQGBxEjLwEOASMiJjURMxEUFjMyNjcRMxU+ATUFEHqgpg0DMp5ttMK6aHFwiSS5YDUEkaWbCfy4ngFXXN30An39gbKDV1MDCooJYnYAAAH/tP5LAWUEOgAPAAABERQGIyImJzceATMyNjURAWWnmx8yHg4OQBNBSAQ6+22qsgkJkQUIaF4EkwAAAAIAYv/sA+kETwAVAB0AAAEyAB0BFAAnIgI9ASEuASMiBgcnPgETMjY3IRUUFgH/4gEI/vG/3dwCzQWdjmmUOEk7uqVpkBX9838ET/7X8y3t/tMBAQHgeaXOOjN8Okz8M6eIGXqcAAAAAQCpBOQDBgXpAAgAAAEVIycHIzU3MwMGmZaVmfR0BPwYlpYZ7AAAAAEAjATkAvcF6QAIAAABNzMVByMnNTMBwJWi/nP6ngVTlhLz8RQAAAABAIEEpQLYBbAADQAAARQGIyImNTMUFjMyNjUC2KCLjKCXRk9NSAWwepGRekRSU0MAAAAAAQCgBOoBbwWwAAMAAAEjNTMBb8/PBOrGAAAAAAIAiwRfAhwF4AALABcAABM0NjMyFhUUBiMiJjcUFjMyNjU0JiMiBot0VlRzclVXc2M8Kys5OSsrPAUeVG5uVFZpaVYsOzotLTw8AAABADL+UAGSADcAEwAAIQ4BFRQWMzI2NxcOASMiJjU0NjcBflNYIysdLxgNIEo2V2mAhz1lPCQmEAx4ExliW1aYPAAAAAEAggTiAzQF8QATAAABFAYjIiYjIgYVJzQ2MzIWMzI2NQM0dFtJlzUsOmhyXDukNis8BdJff19BMBpehWBBMQACAGgE5ANIBe4AAwAHAAABMwEjAzMDIwJn4f7OqUfO9pYF7v72AQr+9gAAAAIAtv6HAen/qwALABcAABc0NjMyFhUUBiMiJjcUFjMyNjU0JiMiBrZZQ0BXV0BDWVcnHhsmJhseJ+lBU1NBQFBQQBslJBweJiYAAAAB/NoEuv4HBhMAAwAAASMDM/4HfbCxBLoBWQAAAf13BLv+pAYUAAMAAAEzAyP99625dAYU/qcA///8kwTi/0UF8QAHAKD8EQAAAAAAAf1eBNn+lAZzAA8AAAEnPgE1NCYjNzIWFRQGDwH9dAFQQVpMB5SbVkUBBNmXBR8nKSZpZFdISAlGAAAAAvwnBOT/BwXuAAMABwAAASMBMwEjAzP+Aqn+zuEB/5b2zgTkAQr+9gEKAAAB/UP+sf4S/3YAAwAAASM1M/4Sz8/+scUAAAAAAQDDBPgBygZ4AAMAAAEzAyMBAsitWgZ4/oAAAAMAoQTtA1wGiAADAAcACwAAASM1MwUjNTM3MwMjA1zAwP4GwcF/036FBO3Dw8PY/vgAAP//AKICcAFhA0EABgB2AAAAAQC1AAAEMAWwAAUAAAEhESMRIQQw/T65A3sFGvrmBbAAAAAAAgAgAAAFbQWwAAMABgAAATMBITchAQKJoQJD+rP7A1v+YQWw+lCVBDcAAAADAHP/6wT+BcUAAwARAB8AAAEhNSEFEAAhIAAZARAAISAAESc0AiMiAhURFBIzMhI1A8D9/AIEAT7+u/72/v7+xgE6AQIBCgFFudq8tM/PtL3ZApSW0/70/qABYAEMAQEBCwFi/p7+9QLJAQb++sn+/cv++gEFzAABADQAAAUCBbAABwAAASMBIwEzASMCnQT+Wb4CFqICFr4EqPtYBbD6UAAAAAMAegAABCAFsAADAAcACwAANyEVIRMhFSEDIRUhegOm/FpVAvP9DVMDlvxqlZUDPJYDCpYAAAAAAQC2AAAE/wWwAAcAACEjESERIxEhBP+5/Sm5BEkFGvrmBbAAAQBFAAAERAWwAAwAAAkBIRUhNQkBNSEVIQEC7v46Axz8AQHl/hsDzf0XAcUCzv3Ilo4CTQJHjpb9zQAAAwBOAAAFbAWwABUAHgAnAAABMzIAFRQAKwEVIzUjIgA1NAA7ATUzAyIGFRQWOwERMxEzMjY1NCYjAzoF9AE5/sbzBboH9P7JATf0B7rBtL++tQe6B7LAwLIE9v7T9PX+0bGxAS319AEvuv6x1Lq70gMb/OXUu7nTAAAAAAEAXQAABRgFsAAXAAABPgE1ETMRFAAHESMRJgA1ETMRFBYXETMDD52zuf7n8Lrp/vG4qpa6AgEX1LICEv3u+v7dF/6WAWoYASL6AhL97rHTGQOvAAEAcgAABM0FxQAjAAAlNhIRNTQmIyIGHQEQEhcVITUzJgI9ARAAMzIAERUUAgczFSEC4ZCfw7CxwaOT/hXwc4EBLv38ATGBcvb+FJsbARwBAXbu+Pjudv7//uMam5VjAS+sdAEhAV3+o/7fdKz+0WOVAAAAAgBk/+sEdwROABwAKgAAAREUFjMyNjcXDgEjIiYnDgEjIgI9ARASMzIWFzcBFBYzMjY3ES4BIyIGFQPuKiYJEgcXHTkkSlsUNppsydvazGiYNhH9zIeSXXkpKXlbk4gEOvzsV0EDA4gTDkxYUlIBG+8VAQoBOlFPjP27qstgWgHBWmPtwQAAAAIAoP5/BE0FxAAUACoAAAEyFhUUBgceARUUBiMiJicRIxE0JBMyNjU0JiMiBhURHgEzMjY1NCYrATUCXcXnYll7hPjOVps8ugEDtoF2f3Rxki2QXYmXiHiPBcTXsV2XLyzChNTnLjH+NAWxqur9lHpuYoyPb/zENzydhXWrlQAAAQAu/mAD3wQ6AAsAAAEzAREjEQEzARczNwMivf6Fuv6EvQEHFgMXBDr7//4nAeAD+v0AXV0AAAACAGD/7AQnBhwAIQAvAAATNDYzMhYXBy4BIyIGFRQWFxYSHQEUACMiAD0BNDY/AS4BExQWMzI2PQE0JiciBhXdxrRNm1ApPYxKWGNihdjQ/wDi5f8Au4wEZWk+lJaTlaODlZcE9oqcLSiAGCNIQDNdLEv+7s4X7f7dASPtF7D4Igsni/1iqNTUqBeH3BrXpgABAGP/7QPsBEwAKQAAASIGFRQWMzI2NTMUBCMiJjU0Njc1LgE1NDYzMhYVIzQmIyIGFRQWOwEVAhuBfIx9eJS5/va7zfdlZFdf5M26+bmPa3x7cHvNAeBVW01kcFCpqamaXn0gAyN3S5mgrZJKYmBGTVaQAAEAbf6BA8MFsAAgAAABFQEOARUUFh8BHgEVDgEHJz4BNTQmLwEuATU0EjcBITUDw/6igm5HWYGXbAJvQGIzL0dSWrKHhZIBGf2BBbB2/lKa4JFkYRMmLENtSqg0UzpRLCQyFhcvn6B6ATisAUCWAAABAJH+YQPwBE4AFAAAAR8BPgEzMhYVESMRNCYjIgYHESMRATcNAzWeabS5uXR4XH0nugQ6lQFRWcDl+7gERJd8SEL80gQ6AAADAHr/6wQUBcUADQAWAB8AAAEQAiMiAhkBEBIzMhIRBSE1NCYjIgYVASEVFBYzMjY1BBTx29r08trb8/0fAiiLiomKAij92IyJiokCLP7j/twBJQEcAVcBHAEm/tr+5GOLxMDAxP7ghcTCwMYAAAAAAQDD/+sCawQ5AA8AAAERFBYzMjY3Fw4BIyImNREBfDcyGS4WKS1UNHt4BDn81E85DQyAHhWLoQMiAAAAAQAl//AEOwXuACEAADMjAScuASMiBiMnPgEzMhYXAR4BMzoBNxcOASMiJicDIwfzzgGKYBg0LQocCQERRhplXh0BsxQtJA0SBwYOKhZiZi/vAyAEBes6LgKMBAhQWPuoNSsClAQIT38CZ3wAAQBl/ncDqQXDADEAAAEuASMiBhUUFjsBFSMiBhUUFh8BHgEVDgEHJz4BNTQmLwEuATU0Nj8BLgE1NCQzMhYXA3I/azeal5qrjY3CxJ59a5B0AW9AYjkoRVY35N2hlQF2gAED50SIMQUKERNrUmpylp2mgJUcFyJLbUmkNlNCQTYrKxINNMDUlsYuAymWYaSyFhEAAAEAT//rBM4EOgAXAAABIxEUFjMyNjcXDgEjIiY1ESERIxEjNSEEXX43MhkuFiktVDR7eP5luoIEDgOk/WlPOQ0MgB4Vi6ECjfxcA6SWAAAAAgCR/mAEHwROABEAHwAAARQCIyImJxEjETMnNBIzMhIRIzQmIyIGFREeATMyNjUEH9fIZpc4ugEB+8Tl6rmFkYOCKHldkYwB9fD+5z0//fgD4gL7AQ/+yf7zwuzlkf7SR0zLqQAAAAABAGX+igPhBE4AIQAAATIWFSM0JiMiBh0BFBYXHgEVDgEHJz4BNTQmJy4BPQE0EgI9vuavfneQj661m3oCbj9iOChDWfTw+gROzrpshuWhKo23MCtObkinNFNBQTYtKhQ0/tYq6AE0AAIAYP/sBHkEOgARACAAAAEhBx4BHQEUACMiAD0BNAAzIQEUFjMyNj0BNCYrAQ4BFQR5/usBX2X+/N/k/wABAOICN/yhlJaUlpeVAZSTA6MDSNCFF9j+2AEu9hjsASb91rHe37AYpdYB1aUAAAEAUf/rA9kEOgATAAABIREUFjMyNjcXDgEjIiY1ESE1IQPZ/o03MhkuFiktVDR7eP6kA4gDpv1nTzkNDIAeFYuhAo+UAAAAAAEAj//rA/YEOgAVAAABERQWMzISNS4BJzMeARUUAiMiJjURAUlqX42eA0A4wzM+8OvBywQ6/W+djAEDroH8jG79nv3+t9fpAo8AAAACAFf+IgVMBDoAGQAjAAAFJAI1NBI3Fw4BBxQWFxE0NjMyABUUAAURIxM+ATUuASMiBhUCbP7p/n+BZVdQBKS3iHPMARn+9/7iubm9sQScjCAiERkBO/CsAQNYg0vIcaLwGwLSaHr+z+nn/s0X/jMCZBnnmqHiKRwAAAAAAQBf/ikFQwQ6ABsAAAERPgE1LgEnMx4BFRQABREjESYAGQEzERQWFxEDHL+vA0I6wjVB/vv+3rn8/vi6rZ0EOfxNGvOlgPmJbfmc9v7CFv47AccZASgBIwHm/hjZ2hgDsgAAAAEAev/rBhkEOgApAAABDgEHFBYzMjY1ETMRFBYzMjY1LgEnMx4BFRACIyImJyMOASMiAhE0NjcBxENLA2h0Z3a7dWhzaQRLQsM9SrzPeaIoAymieNC7ST4EOon/g8LtobYBK/7VtqHsw4P/iW/9n/7+/r51dXV1AUIBAp//bQAAAgB0/+sEqQXFABkAJAAAJTI2NyYkPQE0NjMyFhUREAAjIgAZATcRFBYTFBYXETQmIyIGFQKFrL4B3v76uJeesP7X+/D+37q24puPSktGT4br2An2xD6wy8e0/gL+5f66AVQBDQKYAv1mzfkDhH2hCAFmcW5ucQAAAf/nAAAEWQW7ACMAAAE+ATMyFhcHLgEjIgYHAREjEQEuASMiBgcnPgEzMhYXExczNwLsNHhTIjIaFwYXDyQ5FP7XuP7WFTkjEBYFFxgxI1N3NrQXAxcE139lCg6SAwUkLf18/bwCRAKELSQFA5IOCmV//mhUVAAAAgBK/+sGGwQ6ABcALQAAASMeARUQAiMiJicjDgEjIgIRNDY3IzUhAS4BJyEOAQcUFjMyNj0BMxUUFjMyNgYbiR8irLt5oicEKKF4vKshIHUF0f7+Aygk/LwlKAJYYGd1u3RpXlgDo1W1av7+/r52dXV2AUIBAmq1VZf99V23YGK2XMLtobb8/Lah7AABACv/9QWwBbAAGwAAASERPgEzMgQVFAYjJzI2NS4BIyIGBxEjESE1IQSV/fNSmTn4AQz49QKojgKkpUKaSLr+XQRqBRr+LBce7N/Z4o+Zk5aWGhf9VQUalgAAAAEAh//sBM0FxgAfAAABBgAjIgAZARAAMzIEFyMuASMiAh0BIRUhFRQSMzI2NwTNGP7v8fz+0AEw/PUBDRi5GaOlrMcCO/3Fx6ymohkBztz++gFYARQBAQETAVr96Kap/vfMMJU+zv73pKkAAAIAMgAACEUFsAAWAB8AAAERITIWFRQGIyERIQMKASsBNTMyEhsBAREhMjY1NCYjBPQBaOz9/ez93v3/AwTO/zMonIMEBANzAWialpaaBbD9xfLJyfEFGv3r/mP+mJUBFwFZAqv9MP21qH98qAAAAAACALUAAAhPBbAAEgAbAAABIREzESEyFhUUBiMhESERIxEzAREhMjY1NCYjAW4C17kBaO38/ez93/0pubkDkAFonJWVnAM3Ann9lt/AwOcCov1eBbD9Af3ulXV0lAAAAAABAEAAAAXWBbAAFwAAASERPgEzMhYVESMRNCYjIgYHESMRITUhBKv961CeavT0uY6hXKRYuf5jBGsFGv5DFRXP8f45AceqgBYV/ToFGpYAAAEAtf6aBP4FsAALAAATMxEhETMRIREjESG1uQLXuf4/uf4xBbD65QUb+lD+mgFmAAIApgAABLEFsAAMABUAAAEhESEyFhUUBiMhESEBESEyNjU0JiMEIf0+AWju/P3t/d8De/0+AWiclJScBRr+PuHHyOgFsP0T/dKffnmYAAAAAgA0/poFyQWwAA4AFQAAJTMRIxEhESMRMzYSGwEhAQYCByERIQUIwbn73bl5T4MIIANh/ToJaFQC0v4Jlf4GAWX+mgH7WgFOAS0CRv269/6WdASFAAAAAAEAGwAABygFsAAVAAABIxEjESMBIwkBMwEzETMRMwEzCQEjBJ2buaL+XOgB7v472QGGprmfAYbZ/joB7ucCn/1hAp/9YQMAArD9hAJ8/YQCfP1R/P8AAAABAFH/6wRnBcUAKAAAATI2NTQmIyIGFSM0JDMyBBUUBgceARUUBCMiJDUzFBYzMjY1NCYrATUCXqSWoqWErrkBGNPyAQ58coGD/t3z1f7VubOUprenqaUDMYN3dJCObrja08topDArqoHM3tTVd52VfIqAlgAAAAABALYAAAT+BbAACwAAATMRIxEjASMRMxEzBEW5uQP9Lbm5AwWw+lAEb/uRBbD7kgABADAAAAT0BbAADwAAAREjESEDCgErATUzMhIbAQT0uv3xEQ677jMojHEMFgWw+lAFGv3r/l3+npUBEQFfAqsAAQBR/+sEyAWwABQAAAEXATMBDgEjIiYnNx4BMzI2PwEBMwJOSwFY1/38PIiaGUEKBgpAEktCKCr+DtAC+8MDePtAhIEGA5ACAkpSVgQ+AAADAFP/xAXjBewAFQAeACcAAAEzIAAREAAhIxUjNSMgABEQACEzNTMDIgYVFBY7AREzETMyNjU0JiMDeBsBAgFO/rL+/hu5Hf79/rQBTAEDHbnWxtHRxh25HcTS0sQFHv69/vv++f67xsYBQwEHAQUBRc7+nenMzucDavyW6c7L6AAAAAABALT+oQWSBbAACwAAEzMRIREzETMDIxEhtLkC17mVEqX72QWw+uUFG/rp/ggBXwABAJcAAATEBbAAEwAAAREjEQ4BIyImNREzERQWMzI2NxEExLlhsHv187qMomm8ZwWw+lACYR0azvIBxv46q38cHAK4AAEAtAAABtIFsAALAAABESERMxEhETMRIREBbgH6uQH4ufniBbD65QUb+uUFG/pQBbAAAAABALT+oQdrBbAADwAAAREhETMRIREzETMDIxEhEQFuAfq5Afi5mRKm+gEFsPrlBRv65QUb+uX+DAFfBbAAAAAAAgARAAAFuAWwAAwAFQAAEyERITIWFRQGIyERIQERITI2NTQmIxECVQFo7vz97f3f/mQCVQFonJSUnAWw/ajhx8joBRv9qP3Sn355mAAAAAADALUAAAY1BbAACgATABcAAAEhMhYVFAYjIREzGQEhMjY1NCYjASMRMwFuAWju/P3t/d+5AWiclJScA1+5uQNY4cfI6AWw/RP90p9+eZj9PQWwAAACAKYAAASxBbAACgATAAABITIWFRQGIyERMxkBITI2NTQmIwFfAWju/P3t/d+5AWiclJScA1jhx8joBbD9E/3Sn355mAAAAAABALH/7AT2BcYAHwAAEzQAMzIAGQEQACMiADUzFBYzMhI9ASE1ITU0AiMiBhWxAST2+wEw/tD7+/7hubWsq8f9uwJFx6ustQPf1QES/qb+7f7//uz+qAEB46CvAQjNOJU2zgEJsKEAAAIAw//rBt4FxQAVACMAAAEQACEgABE1IxEjETMRMzUQACEgABEnNAIjIgIVERQSMzISNQbe/rv+9v7+/sbXubnXAToBAgEKAUW52ry0z8+0vdkCV/70/qABYAEMKP2BBbD9ZEQBCwFi/p7+9QLJAQb++sn+/cv++gEFzAACAGMAAARnBbAADQAWAAAhIwEuATU0JDMhESMRIQEhIgYVFBYzIQEoxQFVkJABC/UBz7r+qwFV/uujpKSdARsCbzbDktTi+lACPALeloiHowAAAAACAGH/6wQoBhEAGwApAAABMhIdARQAIyIAPQEQADc+ATUzFAYHDgEHFz4BFyIGHQEUFjMyNj0BNCYCZ9Pu/wDj5P8AAQPmhnOYsLqNwx4DRrJFlJSVlZSWlwP7/vLbGOz+3QEj7IgBSgF3KxlASrFxHhipqgJGUZXAlBin09OnGJTAAAADAJ0AAAQpBDoADwAYACEAADMRITIWFRQGBxUeARUUBiMBESEyNjU0JiMlMz4BNTQmKwGdAabY51lUZW/Yyf7OATJ0c3N0/s77fXuChO0EOpKXTnUfAxiHWpqZAdz+t1RRUFSSAUxNUE4AAAABAJoAAANHBDoABQAAASERIxEhA0f+DboCrQOj/F0EOgAAAAACAC7+wgSTBDoADgAVAAA3PgE3EyERMxEjESERIxMBDgEHIREhg1VYDxACuYu5/Q25AQHJC1BCAfT+s5Vkzd8Blfxb/i0BPv7CAdMCELv9WAL8AAABABUAAAYEBDoAFQAAASMRIxEjASMJATMBMxEzETMBMwkBIwPqgbmC/tHqAYz+meABF3+5fgEZ4P6YAYzqAdj+KAHY/igCOwH//j8Bwf4/AcH+Af3FAAAAAQBY/+0DrARMACgAAAEUBgceARUUBiMiJjUzFBYzMjY1NCYrATUzMjY1NCYjIgYVIzQ2MzIWA5hXUl5f5MKz+7iIbnJ6ana5uXBdaXBig7jsscHRAxNLeCQhfV6aqaqoUHBjTltQmlBOSF5jSZGunwAAAAABAJwAAAQBBDoACwAAATMRIxEjASMRMxEzA0i5uQP+ELm5AwQ6+8YDF/zpBDr86gABAJwAAAQ/BDoADAAAASMRIxEzETMBMwkBIwHdh7q6eQFs4P5SAdLrAc/+MQQ6/jUBy/35/c0AAAEAKAAABAMEOgAPAAABESMRIQMKASsBPwEyNhsBBAO6/pEND5fJNgQoaUoNFAQ6+8YDo/7H/rL+5KIBwQEGAdAAAAAAAQCdAAAFUgQ6AA4AACUBMxEjESMBIwEjESMRMwL7AXDnuQP+pYD+ngO58PIDSPvGAwz89AMd/OMEOgAAAQCcAAAEAAQ6AAsAACEjESERIxEzESERMwQAuf4PuroB8bkB0P4wBDr+KgHWAAAAAQCcAAAEAQQ6AAcAACEjESERIxEhBAG5/g66A2UDo/xdBDoAAQAoAAADsAQ6AAcAAAEhESMRITUhA7D+lbn+nAOIA6b8WgOmlAAAAAMAZP5gBWkGGAAfAC0AOwAAExASMzIWFxEzET4BMzISERUUAiMiJicRIxEOASMiAjUlNCYjIgYHER4BMzI2NSEUFjMyNjcRLgEjIgYVZMjBK0khuSJQMsHJyb8yUSO5IUosvskETICHIjYWFjcjh378bXWHHzMXFzIeiHYCCgEMATgPDgHn/hMREv7I/vQV8f7nEQ/+VQGoDg8BGfEVwe0LCfztCQjKq63ICQkDFQgJ6sQAAAEAnP6/BIIEOgALAAATMxEhETMRMwMjESGcugHyuYESpvzSBDr8WwOl/Fv+KgFBAAEAZwAAA70EOwATAAAhIxEOASMiJjURMxEUFjMyNjcRMwO9uj53RcrYuXJ3RXk8ugGKERDI0AE6/saJeBARAhkAAAAAAQCcAAAF4AQ6AAsAAAERIREzESERMxEhEQFWAYy5AYu6+rwEOvxbA6X8WwOl+8YEOgAAAAEAkf6/Bm0EOgAPAAABESERMxEhETMRMwMjESERAUsBjLkBi7qYEqX62wQ6/FsDpfxbA6X8W/4qAUEEOgAAAAACAB4AAAS/BDoADAAVAAATIREhMhYVFAYjIREhAREhMjY1NCYjHgH6ARPD0dLC/jT+vwH6ARNyaGlxBDr+ir+foMYDpf6K/mZyWFZ6AAAAAAMAnQAABX8EOgAKAA4AFwAAASEyFhUUBiMhETMBIxEzAREhMjY1NCYjAVYBE8PR0sL+NLkEKbq6+9cBE3JoaXECxL+foMYEOvvGBDr99f5mclhWegAAAAACAJ0AAAP9BDoACgATAAABITIWFRQGIyERMxkBITI2NTQmIwFWARPD0dLC/jS5ARNyaGlxAsS/n6DGBDr99f5mclhWegAAAAABAGT/6wPgBE4AHQAAASIGFSM0NjMyEh0BFAIjIiY1MxQWMzI2NyE1IS4BAghikrD7qd76+t6567CKaoWNC/5qAZUPjAO4eVyU1/7M6Crp/szcq2mJx5WVjrkAAAIAnf/sBiMETgATACEAAAEhNhIzMgAdARQAIyICJyERIxEzARQWMzI2PQE0JiMiBhUBVwEIE/zQ5AEB/wDj1v0P/vm6ugG/lJaUlpeVlJQCbtkBB/7P9Rj2/tIBDOD+KAQ6/dax3t+wGK7i4q4AAAACAC8AAAPHBDoADQAWAAABESMRIQEjAS4BNTQ2MwMUFjMhESEiBgPHuv7q/wDIARFqbtfE4WNnASH+9nJvBDr7xgGm/loBwSWdbZS2/rRMZwFrawAB/+f+SwP7BhgAKgAAASERFz4BMzIWHQEzERQGIyImJzceATMyNjURNCYjIgYHESMRIzUzNTMVIQJj/ugDN6JnsbsBp5siNRwPDUQTQUd0d1eILLqqqroBGAS6/u0BUFjM3d/94aqyCAmSBQloXwMAjYBSSPzmBLqVyckAAQBs/+wD/QROAB0AACUyNjczDgEjIgI9ATQSMzIWFyMuASMiBgchFSEeAQJOZ5cBsAH/r+709O6/7wGwAY5wk4oKAZD+cQqIgXhclNUBL+0q7AEw3KxoiryVlZe6AAAAAgAnAAAGhgQ6ABYAHwAAAREhMhYVFAYjIREhERACKwE/ATI2NREBESEyNjU0JiMD3wETw9HSwv4z/rCqzjYDKW1cAsMBE3BqaXEEOv5jtZaXuwOj/sf+vP7amAHW+wHQ/c7+i3FQTGgAAAAAAgCcAAAGpwQ6ABIAGwAAASERMxEhMhYVFAYjIREhESMRMwERITI2NTQmIwFWAfG5ARPD0dLC/jT+D7q6AqoBE3BqaXECoAGa/mK0lpe7Agz99AQ6/c7+i3FQTGgAAAAAAf/9AAAD+gYYABwAAAEhERc+ATMyFhURIxE0JiMiBgcRIxEjNTM1MxUhAnn+0gM3omexu7l0d1eILLqUlLoBLgS//ugBUFjM3f1bAqeNgFJI/OYEv5XExAAAAAABAJz+nAQBBDoACwAAAREhETMRIREjESERAVYB8rn+rbn+pwQ6/FsDpfvG/pwBZAQ6AAAAAQCf/+sGaQWwACAAAAERFAYjIiYnDgEjIiY1ETMRFBYzMjY1ETMRFBYzMjY1EQZp4b1xpzAzrnW317pyYnGHv31qaXwFsPvZztBYWlpY0M4EJ/vZhIWFhAQn+9mEhYWEBCcAAAEAgf/rBa0EOgAgAAABERQGIyImJw4BIyImNREzERQWMzI2NREzERQWMzI2NREFrc2rYpEsMJhlpsK5XVJfcrpnWldoBDr9Kbu9SUxMSby8Atf9KXJxcnEC1/0pcnFycQLXAAAC/9wAAAP8BhgAEgAbAAABIREhMhYVFAYjIREjNTMRMxEhAREhMjY1NCYjApb+vwESxNHTwv40v7+6AUH+vwEScmhpcQQ6/q7Jp6jQBDqVAUn+t/2E/kJ8YF2FAAEAxP/sBpEFxgAnAAABMzUQADMyBBcjLgEjIgIdASEVIRUUEjMyNjczBgAjIgARNSMRIxEzAX3OATD89QENGLkZo6WsxwIa/ebHrKaiGbkY/u/x/P7Qzrm5A0AZARMBWv3opqn+98wbllLO/vekqdz++gFYARRS/VYFsAABAJn/7AWnBE4AIwAAATM2EjMyFhcjLgEjIgYHIRUhHgEzMjY3Mw4BIyICJyMRIxEzAVPEDvTfv+8BsAGOcJOKCgGx/lAKiJRnlwGwAf+v4PIPxLq6AmfYAQ/crGiKvJWVl7p4XJTVAQza/i4EOgAAAgAqAAAE3gWwAAsADwAAASMRIxEjAyMBMwEjASEDIwOJrrihmr4CD6ACBb39mAGaygMBuv5GAbr+RgWw+lACWAJNAAACAA8AAAQlBDoACwARAAABIxEjESMDIwEzASMBIQMnIwcC7XW5e3i9AbqfAb2+/hkBMIEWBBYBK/7VASv+1QQ6+8YBwQE9U1MAAAAAAgDWAAAG7wWwABMAFwAAASEBMwEjAyMRIxEjAyMTIREjETMBIQMjAY8BhQE2oAIFvZiuuKGavqD+tLm5AjsBmsoDAlkDV/pQAbr+RgG6/kYBuv5GBbD8qAJNAAACALwAAAXkBDoAEwAZAAABIQEzASMDIxEjESMDIxMjESMRMwEhAycjBwF2AQ8BA58Bvb56dbl7eL160rq6AckBMIEWBBYBwQJ5+8YBK/7VASv+1QEr/tUEOv2HAT1TUwACAJYAAAY7BbAAIQAlAAABNzUhATMyFhURIxE0JisBBxEjEScjIgYVESMRNDY7AQEzATMBIQHzAwPQ/nUf8fC5ip57F7kRh5+Iuu/yK/521QF6EQEi/asFpQEK/XvK7f6MAXSmeyf9kgJ6G3um/owBdO3KAoX9ewHvAAAAAgCWAAAFSwQ6ABsAHwAAAR4BHQEjNTQmKwEHESMRJyMiBh0BIzU0NjcBIQEzEyEDtcnNuniLMwu5Bj6Md7rR0f7fA7/+HgW4/ooCWgnM4KWlpnsT/k0BvQl7pqWl5coGAeD+IQFJAAACAMMAAAhuBbAAKQAtAAAhETQ2NyERIxEzESE7AQEzFzc1IQEzMhYVESMRNCYrAQcRIxEnIyIGFREBMwEhAsknKf5jubkDFxcr/nbVBgMD0P51H/HwuYqeexe5EYefiAIXEQEi/asBdF+NNv1qBbD9ewKFCwEK/XvK7f6MAXSmeyf9kgJ6G3um/owDKwHvAAACAJsAAAc7BDoAIgAmAAAhNTQ2NyERIxEzESEBIQEeAR0BIzU0JisBBxEjEScjIgYdAQETIRMChiQm/oW6ugLS/uADv/7fyc26eIszC7kGPox3Aam5/om5pV6NNv46BDr+IgHe/iAJzOClpaZ7E/5NAb0Je6alAlsBSf63AAAAAAIAUP5HA6oHcAAtADYAAAEyNjU0JiMhNSEyBBUUBgcVHgEVFAQrASIGFRQWFwcuASc0NjsBMjY1NCYrATUBNzMVByMnNTMBoqOVkpL+zgEy2AEGf3OChv742DVQRV5DSm6YAaqjLYqdqKeNAQqVov5z+p4DNn92a4WV0LlpoisDKayDyt86N0dVHnsvoG+BfJV7ioWVA6SWEvPxFAAAAAACAEz+RwN3BhsALQA2AAABMjY1NCYjITUhMhYVFAYHFR4BFRQGKwEiBhUUFhcHLgEnNDY7ATI2NTQmKwE1EzczFQcjJzUzAZqNgH18/tMBLcTvZFpobPHFMFBFXkNKbpgBqqIpdoaRko3BlaL+c/qeAmhUTkRWlqSQS3UjAyB5V5mqOjdHVR57L6BvgXxcTlZRlQMdlhLz8RQAAAADAHP/6wT+BcUADQAWAB8AAAEQACEgABkBEAAhIAARBSE1NAIjIgIVBSEVFBIzMhI1BP7+u/72/v7+xgE6AQIBCgFF/C4DGdq8tM8DGfznz7S92QJX/vT+oAFgAQwBAQELAWL+nv71PkDJAQb++snWLcv++gEFzAADAGD/7AQnBE4ADQAUABsAABM0ADMyAB0BFAAjIgA1ATI2NyEeARMiBgchLgFgAQDi5AEB/wDj5P8AAeSHkw39sQyTh4SSDwJND5QCKPUBMf7P9Rj2/tIBLvb+cbybm7wDN7aVlbYAAAEAFwAABNoFxAARAAABFzM3AT4BMxcHIyIGBwEjATMCPyIDIgEFMYFuLwEMNUEd/nig/gXJAXF+fgM0noEBoz5V+3MFsAAAAAEALgAABAsETQAVAAABFzM3Ez4BMzIWFwcuASMiBgcBIwEzAdsWAxedKX5SIjAYFQUYDSE7D/7Xjf6DvQE6XV0CI35yCg6SAwUxLPyyBDoABABz/3ME/gY1AAMABwAVACMAAAEjETMRIxEzARAAISAAGQEQACEgABEnNAIjIgIVERQSMzISNQMWubm5uQHo/rv+9v7+/sYBOgECAQoBRbnavLTPz7S92QS1AYD5PgGJAVv+9P6gAWABDAEBAQsBYv6e/vUCyQEG/vrJ/v3L/voBBcwABABg/4gEJwS2AAMABwAVACMAAAEjETMRIxEzATQAMzIAHQEUACMiADUzFBYzMjY9ATQmIyIGFQKhubm5uf2/AQDi5AEB/wDj5P8AupSWlJaXlZSUA0gBbvrSAW4BMvUBMf7P9Rj2/tIBLvax3t+wGK7i4q4AAAAAAwCf/+sGZAdUACwAPgBEAAABMhYVERQGIyImJw4BIyImNRE0NjMVIgYVERQWMzI2NREzERQWMzI2NRE0JiMTFSMiJCMiBh0BIzU0NjMyBDMBJzc1MxUE1rbY2LZ1rTM0rXO319e3YnJyYnGHuoVyYXR0YWgshf7dLjY8f3l0SwEec/5BTDq0Ba/k3v3A3+NWWVlW498CQN7klZiV/cCWl4WEAbT+TISFl5YCQJWYAbt9fzg3EiRubH/+UkB0jHwAAwB+/+sFqgXxACwAPgBEAAABMhYVERQGIyImJw4BIyImNRE0NjMVIgYVERQWMzI2PQEzFRQWMzI2NRE0JiMTFSMiJCMiBh0BIzU0NjMyBDMFByc3JzMEQqXDw6VnmS8vmWWmwsKmUl1dUl9yuXJgUF5eUKoshf7dLTc7gHp0SgEedP7ioU07AbQERNDM/t/Nz0pMTErPzQEhzNCVhIP+34SDcnHr63Fyg4QBIYOEAcJ9fzc3EiNubYDqxEB0jAAAAgCf/+sGaQcDAAcAKAAAATUhFyEVIzUFERQGIyImNREjERQGIyImNREjERQWMzI2Nx4BMzI2NREB3QMrAf61qAKafGlqfb+HcWJyute3da4zMKdxveEGmWpqfX3p+9mEhYWEBCf72YSFhYQEJ/vZztBYWlpY0M4EJwAAAAIAgf/rBa0FsQAHACgAAAE1IRchFSM1AREUBiMiJjURIxEUBiMiJjURIxEUFjMyNjceATMyNjURAYgDKwP+s6gCM2hXWme6cl9SXbnCpmWYMCyRYqvNBUdqaoCA/vP9KXFycXIC1/0pcXJxcgLX/Sm8vElMTEm9uwLXAAABAHj+gwS+BcUAGAAAASMRJgA1ERAAMzIAFSM0JiMiAhURFBI7AQMRud3+/QEw/PoBILq1q6zHx6xt/oMBbRwBTv0BAQETAVr+/eKfsP73zP79zv73AAAAAQBk/oMD4AROABgAAAEjESYCPQE0EjMyFhUjNCYjIgYdARQWOwECorm7yvrfuOuvjGiRj46SZf6DAW8fASbRKugBNN2raIrloSqk5AAAAAABAHQAAASQBT4AEwAAAQUHJQMjEyU3BRMlNwUTMwMFByUCWAEhRP7dtqjh/t9EASXN/t5GASO8pecBJUj+4AG9rHmq/r4Bjqt5qwFvq3urAU3+Z6t4qgAAAfxnBKf/JwX7AAcAAAEVJzchJxcV/Q2mAQIbAaUFJX4B52wB1QAAAAH8cQUX/2QGFQARAAABMiQzMhYdASM1NCYjIgQrATX8m3MBHkp0eoA7Ny3+3YUsBZWAbW4jEjc3f30AAAH9ZgUY/lQGWAAFAAABNTMVFwf9ZrM7TQXcfIx0QAAAAf2kBRj+kwZYAAUAAAEnNyczFf3xTTsBtQUYQHSMfAAI+o3+xAIoBa8ADQAbACkANwBFAFMAYQBvAAABNDYzMhYVIzQmIyIGFQE0NjMyFhUjNCYjIgYVEzQ2MzIWFSM0JiMiBhUBNDYzMhYVIzQmIyIGFQE0NjMyFhUjNCYjIgYVATQ2MzIWFSM0JiMiBhUBNDYzMhYVIzQmIyIGFRM0NjMyFhUjNCYjIgYV/XpwYmNwcC80Mi8B3m9iYnJxLzQzLUlwYmJxcC80My7+y29iYnFwLzQzLv1QcGJjcHAvNDIv/U1xYmNwcC80Mi/+3nFhY3BwLjUyLzVxYWNxcS41Mi4E81VnZ1UsOTks/utVZ2dVLDk5LP4JVWdnVSw5OSz9+VVnZ1UsOTks/uRWZmZWLTg4LQUaVWdnVSw5OSz+CVVnZ1UsOTks/flVZ2dVLDk5LAAAAAj6pP5jAeMFxgAEAAkADgATABkAHgAjACgAAAUXAyMTAycTMwMBNwUVJQUHJTUFATclFwYFAQcFJyUDJwM3EwEXEwcD/qcLemBGOgx6YEYCHQ0BTf6m+3UN/rMBWgOcAgFARCX/APzzAv7ARQEmKxGUQcYDXxGVQsQ8Dv6tAWEEog4BUv6g/hEMfGJHOwx8YkcBrhCZRBex/I4RmUXIAuQCAUZF/tX84wL+u0cBKwAAAv/cAAAD/AZwABIAGwAAASERITIWFRQGIyERIzUzNTMVIQERITI2NTQmIwKW/r8BEsTR08L+NL+/ugFB/r8BEnJoaXEFGv3Oyaeo0AUalsDA/KP+QnxgXYUAAAADALUAAATYBbAAAwAOABcAAAEHATcBESMRITIWFRQGIyUhMjY1NCYjIQTYbv6Rbf4GuQIk7f397f6VAWuclZWc/pUCPmQBk2X+eP22BbDryMrplZ99fqEAAwCR/mAEJAROAAMAFgAkAAAlBwE3JRQCIyImJwcRIxEzFz4BMzISESM0JiMiBgcRHgEzMjY1BCNu/rZuAUvbyWeWNQO6nxI2mmvM27qQk1t7Jih5XZKPDWUBdWVz8P7nQ0MB/e8F2opOUP7H/vW/61BG/fZHTMupAAAAAAEApgAABCMHAQAJAAABIxUhESMRIREzBCMC/T65AsS5BRsB+uYFsAFRAAAAAQCRAAADQwV4AAkAAAEjFSERIxEhETMDQwX+DboB+LoDpAH8XQQ6AT4AAAABALX+3gR8BbAAFQAAASERMyAAERACIycyNjUuASsBESMRIQQw/T65AR8BNu/qApyFAcvPubkDewUa/ib+1f7q/vf+6JHNw9HR/V8FsAAAAAEAkf7lA74EOgAVAAABIREzMgQVBgIHJz4BNS4BKwERIxEhAz7+DXTnARgBvcIxh3EBsJV0ugKtA6P+4vrhjP7rJJAinnWZo/4aBDoAAAAAAQCmAAAE+AWwABQAAAkCIwEjFSM1IxEjETMRMxEzETMBBMv+bgG/5/6cUJVpublplU8BRwWw/U79AgKV9/f9awWw/XoBAv7+AoYAAAEAmgAABH8EOgAUAAAJAiMBIxUjNSMRIxEzETM1MxUzAQRa/q0BeOv+6jGUZbq6ZZQqAQMEOv3+/cgBz8TE/jEEOv411tYBywAAAAABAEUAAAaJBbAADgAAASMRIxEhNSERMwEzCQEjA4ywuf4iApefAhHU/cMCZuMClP1sBRuV/XkCh/0+/RIAAAAAAQA+AAAFfAQ6AA4AAAEjESMRITUhETMBMwkBIwMah7r+ZQJVeQFs4P5SAdLrAc/+MQOklv41Acv9+f3NAAAAAAEAtQAAB4QFsAANAAABIREhFSERIxEhESMRMwFuAtUDQf14uf0rubkDGwKVlfrlAob9egWwAAAAAQCRAAAFagQ6AA0AAAEhESEVIREjESERIxEzAUsB8QIu/ou5/g+6ugJkAdaW/FwB0P4wBDoAAAABALT+3wfNBbAAFwAAATMgABEQAiMnMjY1LgErAREjESERIxEhBP17AR8BNu/qApyFAcvPe7n9KbkESQNB/tX+6v73/uiRzcPR0f1eBRr65gWwAAABAJH+5QawBDoAFwAAATMyBBUGAgcnPgE1LgErAREjESERIxEhA/ao8AEiAb3DMIdxAbqeqLn+DroDZQKF+uGM/uskkCKddpmj/hoDo/xdBDoAAAACAHP/4gWaBcUAKQA3AAAFIiYnDgEjIAARNRASMxciAh0BFBIzMjY3JgI9ATQSMzISHQEUAgceATMBFBYXPgE9ATQmIyIGFQWab8FZR5pX/un+sfjOAX6Q5sckQSB+g9+5ut9wajNxQv18eHllaXZqaHceJSUhIAGIATKqARMBY5z++dGs8v7TBwhjARSs5vABM/7T9vqi/vdhDg0COZ/sSknmlP2x1durAAAAAgBt/+sEnARPACkAOAAABSImJw4BIyIAETU0EjMVIgYdARQWMzI2Ny4BPQE0NjMyFh0BFAYHHgEzAzU0JiMiBh0BFBYXPgE1BJxbnEc7gUnf/vPAoE1Zo48YLRdhYqiUk6tCQChYMulGP0FCT080NgwcHSEhAUoBAzvRAQqbsY09wfEFB1DXg2fB6/vGaXPBTgsKAZdsgKOSfWtrpzo5nWEAAAABADT+oQaOBbAADwAAASE1IRUhESERMxEzAyMRIQGw/oQDuf58Ate5lRKl+9kFG5WV+3oFG/rp/ggBXwABAB/+vwUXBDsADwAAASE1IRUjESERMxEzAyMRIQEx/u4CxPgB8rmBEqb80gOmlZX87wOl/Fv+KgFBAAACAJcAAATEBbAAAwAXAAABIxEzAREjEQ4BIyImNREzERQWMzI2NxEDF5WVAa25YbB79fO6jKJpvGcBQAK8AbT6UAJhHRrO8gHG/jqrfxwcArgAAAACAIMAAAPZBDsAAwAXAAAlIxEzASMRDgEjIiY1ETMRFBYzMjY3ETMChpWVAVO6PndFyti5cndFeTy65gI1/OUBihEQyNABOv7GiXgQEQIZAAEAjgAABLsFsAATAAAzETMRPgEzMhYVESMRNCYjIgYHEY65Ya989PS6jaFqvGYFsP2eHBzP8f46AcaqgB0c/UkAAAAAAgBH/+kFwAXDAB4AJwAABSAAETUuATUzFBYXNRAAMyAAERUhFRQSMzI2NxcOAQEhNTQmIyICFQPt/tj+waCflVJYATTpAQwBEfyAz95wnUowOLz9wALHpr6puhcBUgEfaxS/oWB5FAcBFAFc/qX+xG1l2f79LyiGJz8DWSHU9v71zwAAAv/j/+wEWQROABwAJAAABSIAPQEuATUzFBYXPgEzMhIdASEeATMyNjcXDgEDIgYHITU0JgK+5P74eHeUMDQg/qfc3f0zBJ2RZZM7STu5pmmRFAIOgBQBJ/QMHKqJSWEZwu3+/uB5psw4M3s6SwPMqYcaeZ0AAAAAAQCm/tkEywWwABYAAAEWABEQAiMnMjY1LgEjIREjETMRMwEzArr9AQ3u6wKdhQLK0P7wubmHAg3YAzgV/tn+/v73/uiRzcPQ0f1lBbD9iwJ1AAAAAQCa/v0EGQQ6ABYAAAEeARUGAgcnPgE1LgErAREjETMRMwEzAn291gG8wzCHcQG2oqu6ulsBiuACZB3av4f++SOQIZJulov+MQQ6/jUBywABALX+SwT9BbAAFwAAAREhETMRFAYjIiYnNx4BMzI2NREhESMRAW4C1bqomx80HQ4OQhJCR/0ruQWw/WsClfn3qrIJCZEFCGdfAt/9egWwAAEAkf5LA/UEOgAXAAABESERMxEUBiMiJic3HgEzMjY1ESERIxEBSwHxuaibHzQdDw1CEkJI/g+6BDr+KgHW+22qsgkJkQUIZ18CKf4wBDoAAgBf/+sFEAXFABYAHgAAASAAERUQACMgABE1ITU0AiMiBgcnPgETMhI3IRUUFgKCAToBVP60+f7N/scD+OTxdqdOLzrG47XPB/zDyQXF/pb+zqP+1/6OAVoBPG856gEcMCeGJkH6uwES2yPV9QAAAAEAaf/rBCgFsAAaAAABITUhFwEeARUUBCMiJDUzFBYzMjY1NCYrATUDIP10A2UB/mTg6v703sP+7rqbgJGgoaaOBRqWdf4SDd/My9/U1XedlXyfjpUAAAABAGn+dQQoBDoAGgAAASE1IRcBHgEVFAQjIiQ1MxQWMzI2NTQmKwE1Awz9iANlAf5x2eT+9N7D/u66m4CRoKSmjQOjl3X+EBHeyMng1dN1nZV6n46VAAD//wA6/ksEdAWwACYArEQAACYB06tAAAcBmgDwAAAAAP//ADv+SwOWBDoAJgDnTwAAJgHTrI4ABwGaAOEAAAAAAAIAWQAABGMFsAAKABMAAAERMxEhIiY1NDYzAREhIgYVFBYzA6q5/d/t/PvuAWj+mJyUlJwDbAJE+lDxycjq/SkCQqB7f6gAAAIAWQAABl4FsAAYACEAACEiJjU0NjMhETMRNz4BNzYmJzMeAQcOASMlESEiBhUUFjMCQu38++4BaLlab3MEAR8esyEjAgTrsP7t/piclJSc8cnI6gJE+uQBAYyCT6VRZpVKz9WVAkKge3+oAAIAZP/pBm4GGAAjADQAABMQEjMyFhc3ETMRBhYzPgE3NiYnNx4BBwIAIwYmJw4BIyICNQEuASMiBh0BFBYzMjY3LgE1ZNrMXo0zA7kCXFGMlAQBHx+zIiMCBP71znmfKDagccnbAscodlWTiIeSWncpAwICCgEKATpBPgECSPtBZHUB0b9jxmkBfLle/vH+6QJWYVtaARvvAThAR+rAFarGTEcVHBAAAAEANv/oBdIFsAAsAAABNCYrATUzMjY1NCYjITUhMhYVFAYHHgEdAQYWMz4BNzYmJzMeAQcKASMGJicCw4h5v4yslZKh/pkBZ/P5dXR4ZAFSSHqDBAEfH7QjIgIE+b6gqggBc3qQln2IfYWWzsx0pTEorINFUGAB1btjx2mIr1z+8/7nA5quAAABADH/4wTpBDoALgAAJQYWMz4BNzYmJzMeAQcOASMGJic1NCYrASczMjY1NCYjISchMhYVFAYHFR4BHQEC5wEpNXB1BAEgH7QjIwIF7LKLhgZrZ9MCu3tydnv++gYBDNDcXVthVdUtLgKZjk2iUGiPSNviA2+ETEpPlFVPU2CUpptTcSIDHHdaTgAAAAIAU/7EA9AFsAAhACsAABM1MzI2NTQmIyE1ITIWFRQGBx4BHQEUFhcVIy4BPQE0JiMBFAYHJz4BPQEzsKKvlpGg/u0BE/P3dHN7aB8lvikWjHwCRVxSaTAuuQJ6ln+FgIeVz85zpDEorISIRWojGSSCR4R6j/3EZM9HSEmRVZcAAgB5/rUDuQQ6ACIALAAAEzUzMjY1NCYjITUhMhYVFAYHFR4BHQEUFhcVIy4BPQE0JiMBFAYHJz4BPQEzwtR+cnJ+/uMBHc/bXl1kVhoivyQSa2gCBlxSaTAuuQG6lFRRVV6UpZtUcyIDHYFjYS9UFhMXYjRfU1v+dWTPR0hJkVWXAAAAAQBF/+gHbwWwACEAAAERBhYzPgE3NiYnNx4BBwIAIwYmJxEhERACKwE1MzISGQEE5QFcUYyTBAEfH7MiIwIE/vXNqrMI/hnQ+zUpmoQFsPupZHUB0b9jxmkBfLle/vH+6QOtxAPB/eb+av6WlQEbAVACsAABAD//6AY5BDoAIQAAAREGFjM+ATc2JiczHgEHDgEjBiYnESEREAIrAT8BMjY1EQPqAVpQcXYEAR8fsyIjAgTstKiyCP69qsw5AypuWwQ6/R9kdQG5qV68Y3qrWPn/A63EAkr+y/69/tWiAdL5AcwAAQCt/+gHcQWwAB0AAAERBhYzPgE3NiYnNx4BBwIAIwYmJxEhESMRMxEhEQTmAVtRjJQEAR8fsyIkAgX+9c6pswj9Obm5AscFsPupZXQB0b9ixWsBf7Ze/vD+6gOtxAEt/XoFsP1rApUAAAAAAQCQ/+gGTAQ6AB0AAAEhESMRMxEhETMRBhYzPgE3NiYnMx4BBw4BIwYmJwND/ga5uQH6uQFaUHF3BAEfH7IjIwIE7LWosggBz/4xBDr+KQHX/R9kdQG5qV28ZH2pV/n/A63EAAEAef/rBJ0FxQAhAAAFIAAZARAAITIWFwcuASMiAhURFBIzPgE3NiYnMx4BBwYEArn++/7FATsBBXKsRTtEjla20dC3j5YEARoZtCYTAQT+8BUBWAESAQYBEQFZLCuDIiL+98n++M3++AGajlWxY7VlT9ziAAAAAAEAZf/rA8YETgAhAAAlPgE3NCYnMx4BFQ4BIyIAPQE0EjMyFhcHLgEjIgYdARQWAlFnUgMLCbINDgTIqen+/fneX4owLDB3RpCOl4ABVVc5eTpGcDaioAE16CrnATUiII0bHuefKqPlAAAAAAEAJP/oBUUFsAAZAAABITUhFSERBhYzPgE3NiYnNx4BBwIAIwYmJwIC/iIEgP4YAlxRjJQEASAfsyMiAgT+9c2ptAgFGpaW/D9kdQHRv2LGagF/t13+8f7pA63EAAAAAAEARv/oBLgEOgAZAAABITUhFSERBhYzPgE3NiYnMx4BBw4BIwYmJwGs/poDi/6VAVtRcXYEAR8esiMjAgTttKm0CAOmlJT9s2V0AZuPTqVTapJK3eMDrcQAAAAAAQCb/+sFAAXFACkAAAEiBhUUFjMyNjUzFAQjICQ1NDY3NS4BNTQkITIEFSM0JiMiBhUUFjsBFQLMv7nLuqXJuf6+5f76/siKiXmEASMBBeQBL7nGlLq1qbm3ApuAinyVnXfV1N7MgaoqAy6kaMrU2rhujpB0d4OWAAAA//8AswKMBPADIQBGAYbZAFMzQAD//wC7AowF8wMhAEYBhq8AZmZAAP//AA3+bgOhAAAAJwBBAAn/AwAGAEEJAAABAGAEAgF4BisACQAAEzQ2NxcOAR0BI2BcUmoyLbkEsWTPR0dKkFayAAAAAAEAMAPnAUcGGAAJAAABFAYHJz4BPQEzAUdcUmkwLrkFYWXPRkhIkVa6AAAAAQAk/tYBOwD6AAkAACUUBgcnPgE9ATMBO1xSaTAuuU9kz0ZHSZFVrgAAAP//AFAD5wFnBhgARwFmAZcAAMABQAAAAP//AGAEAgKyBisAJgFlAAAABwFlAToAAP//ADwD5wKGBhgAJgFmDAAABwFmAT8AAAACACT+1gJkAPoACQATAAAlFAYHJz4BPQEzBRQGByc+AT0BMwE7XFJpMC65ASldUmkwLrpPZM9GR0mRVa6rZM9GR0mRVa4AAAABAEYAAAQkBbAACwAAASERIxEhNSERMxEhBCT+bLr+cAGQugGUA6P8XQOjlwF2/ooAAAAAAQBX/mAENAWwABMAACkBESMRITUhESE1IREzESEVIREhBDT+arr+cwGN/nMBjboBlv5qAZb+YAGglQMOlwF2/oqX/PIAAAAAAQCKAhgCIgPeAA0AABM0NjMyFh0BFAYjIiY1im1eYG1tX19tAxhZbW1ZPVlqaln//wCmAAADFwDFACYAEAQAAAcAEAG5AAD//wCmAAAEtgDFACYAEAQAACcAEAG5AAAABwAQA1gAAAAGAET/6wdXBcUAGQAnADUAQwBRAFUAAAE0NjMyFhc+ATMyFh0BFAYjIiYnDgEjIiY1ATQ2MzIWHQEUBiMiJjUBFBYzMjY9ATQmIyIGFQUUFjMyNj0BNCYjIgYVARQWMzI2PQE0JiMiBhUTJwEXAzegikx0JiVzTYqhoIlOdCUlc0yLof0NoIqKoZ+Ki6EDflJPTlFST05RAcpST01SUk9OUftDUk9OUVNOTlH8aALHaAFlgatAOTlAq4FOgqo+Ojo+qoIDgYKrq4JNgqmqgfzMTWhnTk5NaGhNTk1oZ05OTWhoTQLmTWdnTU1NaWlN+9dBBHJBAAAAAAEAbACaAiADtAAGAAAJASMBNQEzAR4BAo3+2QEnjQIn/nMBhBMBgwABAFkAmQIOA7QABgAAEwEVASMJAecBJ/7ZjgEC/v4DtP58E/58AY0BjgAAAAEAOwBvA2oFIgADAAA3JwEXo2gCx2hvQQRyQQACAEgCMANSBcUACgAPAAABMxUjFSM1IScBMwEhEScHArqYmKP+NQQByan+QgEbAxEDZn25uV4Cfv2hAYsBIgAAAQB6AosC+AW6ABMAABMXPgEzMhYVESMRNCYjIgYHESMR+h4lbkl+hqpKRjlMFaoFq3pCR5Og/gQB3WpaOTP9ywMgAAABAEYAAARRBcUAJwAAAQ4BByEHITUzPgE3IzUzJyM1Myc0NjMyFhUjNCYjIgYVFyEVIRchFQGvAyAeAuMB/DYKMTIDsKsGpJ4F277K1bp9aGl2BQGm/mAFAZwBvliYOZWVDbNplpGWldDlz7R8cZSLlZaRlgAAAAADAKf/7AYMBbAACgATACsAAAERIxEhMhYVFAYjJzMyNjU0JisBJREzFSMRFBYzMjY3Fw4BIyImNREjNTMRAWC5AV/s/v7spqablZWbpgPQ0NA2LxgxFRkaXS5xgJubAjb9ygWw9MnK85anfn+rJv75jf1qUD8HBoMRFY2eApaNAQcAAAABAE//6wPUBcUAKQAAASEUFjMyNjcXDgEjIgA1IzUzNSM1MzU0ADMyFhcHLgEjIgYdASEVIRUhA5L+DK6ZO201Ejp3Pur+6paWlpYBFOo8cUQSN246mawB9P4MAfQCArTOERGYDxABHfp4qXoR+QEeEA+aEBPMsxN6qQAABAB7/+sFgwXFABsAKQA3ADsAAAEUBiMiJj0BNDYzMhYVIzQmIyIGHQEUFjMyNjUBFBYzMjY9ATQmIyIGFTM0NjMyFh0BFAYjIiY1EycBFwKplX+CmJeBgJaLR0RFSEpFQ0YBEKGLiaChioqgi1FOT1JRTk9Sy2j9OWgEHm6QqoFNgaySbTpOaU1NTGhPOPz5gqqqgk6Bq6uBTWhoTU5OZ2hNA8pB+45BAAAAAAIAaP/rA2oFxQAaACYAAAUiJj0BDgEjNTI2NxE0NjMyFh0BFAIHFRQWMwM1NCYjIgYVET4BNQLMzMgzZTg6ZjCYi3qVx7JhehsuKDY0YGAV7NgPDgyuDg4B3LTHqZMqpP6zZVqVlAPXLFFPbnH+gkzScwAABACrAAAISgXAAAMAEQAfACsAAAEhNSEBNDYzMhYdARQGIyImNTMUFjMyNj0BNCYjIgYVASMBIxEjETMBMxEzCAz90wIt/ZK3n5+3tp6ht6NaW1haW1laWf6yuf0tA7m5AtMDuQFrjQJ5l7i4l3WYtraYW2pqW3VYbGtZ+48Ee/uFBbD7hgR6AAIAZgOXBFwFsAAOABYAAAEjAyMDIxEjETMbATMRIwEjESMRIzUhBAIDmzOgA1pxpadrWv3kkluTAYAE/P6bAXL+jgIZ/nABkP3nAcj+OAHIUQAAAAIAmP/sBJMETgAVAB4AACUOASMiADU0ADMyAB0BIREeATMyNjcBIgYHESERLgEEFlm4Yd7+0gE/zdMBHP0AOYlPYbZZ/pBLizsCHDeIXjg6AUTt5gFL/s7rL/64Njg7PwMqQDr+6wEeNjsA//8Ab//1Bk8FsgAnAckAEQKGACcBdAEJAAAABwHQA0wAAAAA//8Aa//1BuIFwAAnAcsAAgKUACcBdAG8AAAABwHQA98AAAAA//8AbP/1BxIFrwAnAc3/+gKOACcBdAH0AAAABwHQBA8AAAAA//8Aa//1Bm8FrwAnAc8ADQKOACcBdAE3AAAABwHQA2wAAAAAAAIATP/rBC0F7QAUACEAAAEEABEVFAAjIgA1NBIzMhYXNy4BJxMyNj0BLgEjIgYVFBYB6AENATj+59rd/u/13l6jPAMp4qWPjKolrISQiqcF7Uv+Pv6ncPr+zgET0+8BETw5AsnwOPsx47RlUm3JoYjJAAAAAQCp/yoE5QWwAAcAAAUjESERIxEhBOW5/Ta5BDzWBfD6EAaGAAAAAAEARf7zBKsFsAAMAAAJASEVITUJATUhFSEBA2v9uQOH+5oCYf2fBBn8xQJIAkH9SJaNAs4C1I6W/UAAAAEAqAKMA+sDIQADAAABITUhA+v8vQNDAoyVAAABAD8AAASYBbAACwAAARczNwEzASMDIzUhAh4VAxcBjr394o32uAE7AU9iYgRh+lACdZcAAwBr/+sHwgROABkAJwA1AAABFAIjIiYnDgEjIgI9ATQSMzIWFz4BMzISFQUUFjMyEjc1JgIjIgYVITQmIyICBxUWEjMyNjUHwvXRq+tQUOup0/T00arsUVDsq8/1+WKHh5PSHB3Tk4WHBeWIg5XTHBvTlIWIAfrk/tXZoaHZASrlROMBLdqgoNr+0+NErc0BGW8qbQEZz6urz/7nbSpv/ufNrQAB/7T+SwKOBi0AHAAABRQGIyImJzceATMyNjURNDYzMhYXBy4BIyIGFREBZaebIDIdDg5AE0FIr6MiRCoYFCwbWlxZqrIJCZEFCGheBR6vuQsKjAUGbWX64gAAAAIAZQEaBBQD+wAbADcAABM+ATM2FhceATMyNjcfAQ4BIyImJy4BByIGBycDPgEzNhYXHgEzMjY3HwEOASMiJicuAQciBgcnbzB5Q0Y9Z1g/Q0F5LwMJMXlCQz9YZz1GQnkuAxMweUNGPWdbPENBeS8DCTF5QkM/WGs5RkJ5LgMDaEZMARczLRhKRAGjR0sYLTMXAUtDAf76RkwBFzMvF0tEAaRHSxgtNRYBTEMBAAAAAQCYAKQD2gTfABMAAAEzFSEDIRUhByc3IzUhEyE1IRMXAw/L/t2OAbH994NTY8YBHY/+VAIEmFMDzZ7+/57sOrKeAQGeARI7AAAA//8AngACA+YEjQBnAB4AVgCyQAA5mgAHAYb/+/12AAD//wCZAAAD7wSgAGcAIAATAMRAADmaAAcBhv/6/XQAAAACACsAAAPcBbAABQAPAAABMwkBIwEhAScjBwkBFzM3AbyMAZT+cI3+bAL0/vkWAxb/AAEGFgMWBbD9J/0pAtcCAz4+/f39/j8/AAD//wDHALIBgwTrACcAEAAlALIABwAQACUEJgAAAAIAbgJ6AjMEOgADAAcAABMjETMBIxEz+42NATiNjQJ6AcD+QAHAAAABAFz/LwFXAOwACQAAJRQGByc+AT0BMwFXS0dpJiSxgFy2P0g/e0xvAAAAAAIAHwAAA80GLQAXABsAADMRIzUzNTQ2MzIWFwcuASMiBh0BMxUjESEjETPKq6vOvkSCVR83dUJ4aN3dAkm6ugOtjXe5wx8emhYdaHB3jfxTBDoAABYAW/5yB+4FrgANAB0AKwA7AEEARwBNAFMAXQBhAGUAaQBtAHEAdQB+AIIAhgCKAI4AkgCWAAABNCYjIgYdARQWMzI2NQUyNjU0Jic1PgE1NCYrAREnFAYjIiY9ATQ2MzIWFQUUBiMiJjUjFBYzMjY1ESMBETMVMxUhNTM1MxEBESEVIxUlNSERIzUBMx4BFRQGKwE1ATUhFSE1IRUhNSEVATUhFSE1IRUhNSEVEzMyFhUUBisBBSM1MzUjNTMRIzUzJSM1MzUjNTMRIzUzAzl/aGh+fmpofQEgXmc0LSUqbWe8n0hBQ0lIQkFKA7o2KTM1XWhdU2hc+cRxxAUox2/4bQE1xAXsATZv/NoFMDI0M34BTgEW/VsBFf1cARQCCgEW/VsBFf1cARS8XT44Ojxd/PFxcXFxcXEHIm9vb29vbwJEYnl5YnBkd3dk2E5NLkQNAw48KExK/dvYR0xMR3BFTk5Fmyw2LC9TUVtQAXr7TwE7ynFxyv7FBh8BHXSpqXT+46n8tgItJykqqQNKdHR0dHR0+ThxcXFxcXEEWx8oKSeW/H76/BX5fvx++vwV+QAAAAAFAFz91QfXCGIAAwAdACEAJQApAAAJAwU0Njc+ATU0JiMiBgczPgEzMhYVFAYHDgEVFyMVMwMzFSMDMxUjBBgDv/xB/EQEDxkpSV2mloulAssBOiw3OjIrUDrKyspLBAQCBAQGUvwx/DEDz/E2OxsogFCDlIGJNDM+NjJNHDlWWluq/UwECo0EAAAAAAEAXP/vA6QEjQAeAAAbASEVIQM+ATc2FhUUBiMiJjU3FBYzMjY1NCYjIgYHiEcCof4AIyhxP7fIzN216rl9aXx0cmpsZRkB+QKUnv7BGyUCA8a8ts6fpA5XZ3xzb305OAAAAAACAFcAAAMkAyEACgAPAAABMxUjFSM1IScBMwEzEScHAqKCgqH+XQcBpqX+Y/wDEgEYfpqaYgIl/fcBRgEfAAAAAgBz/+sEDQXFAA0AGwAAARACIyICGQEQEjMyEhEnNCYjIgYVERQWMzI2NQQN8dva9PLa2/O6i4mJioyJiYkCLP7j/twBJQEcAVcBHAEm/tr+5CjEwMDE/lvEwsDGAAAAAf+i/t8CzANBAA8AAAMzIAAREAIjJzI2NS4BKwFe1QEfATbv6gKchQHLz9UDQf7V/ur+9/7okc3D0dEAAf+2/ksBZwCYAA8AACUVFAYjIiYnNx4BMzI2PQEBZ6ebIDIdDg4/FEJHmPGqsgkJmgUHX13xAAABABv+ZgHCAEAAEwAANx4BFRQGIyImJzceATMyNjU0Jif4ZmR/ZENbJh8jMCM9NEQ9QDSMTWJrGRN3DQ4wKjJWMAAAAAEAZ/6ZASEAmgADAAABIxEzASG6uv6ZAgEAAAACAIME2QLSBs4ADQAhAAABFAYjIiY1MxQWMzI2NRMUBiMiJiMiBhUnNDYzMhYzMjY1AtKeiYqelkVNS0aNXkg6eSojL1NcSS+DKyIxBa5hdHRhNkJDNQEJTGdMMyYVSmtMMyYAAgCBBOACygcCAA0AHQAAARQGIyImNSMUFjMyNjUlJz4BNTQmIzcyFhUUBg8BAjdGS01GkpyJiJz+pAFMQFdJB4+VU0IBBbA0QEA0X3FxXxB8AxkeHx1QTEM3Nwc+AAAAAgCBBN8C4AaJAA0AEQAAARQGIyImNTMUFjMyNjUnMwcjAuCijY+hmEhQTUlgmaRmBbBgcXFgNUBBNNnGAAAAAAIAbQTkA0IG0gAIABwAAAEHIycHIyclMzcUBiMiJiMiBhUnNDYzMhYzMjY1A0IBpcXFpAEBKYPDXkM2bycgM01dQyt5KB80BOcDn58D8OU/XUgwHBM+YkYsHQAAAgBpBOQD7AbOAAYAFgAAASMBMzcXMy8BPgE1NCYjNzIWFRQGDwECNbz+8KnFxapTAUU3TUAFf4dLOwEF6f77urqJgwQZIiMgXFZLPz4HPAAC/14E0gNGBoAABgAKAAABIycHIwEzBSMDMwNGxaqqxAEimP6PjMjHBNKfnwEFWAEBAAAAAgBuBOQEWAaSAAYACgAAATMBIycHIwEzAyMBkpgBIsWpqsYDIsjJjQXp/vufnwGu/v8AAAIAWwSnAv8GeQANABEAAAEUBiMiJjUzFBYzMjY1ByMnMwL/tZ2etJZYZGFaZ5fS2AWweZCQeUNRUkIFzgAAAAABAJ8EkAFwBhcABQAAEzczBxUjn3NeGLkFI/T9igAAAAIAKQAABIMEjQAHAAoAAAEhAyMBMwEjASEDA1r9+GnAAdavAdW//ccBlswBEP7wBI37cwGkAg0AAwCbAAAECQSNAA8AGAAhAAAzESEyFhUUBgcVHgEVFAYjAREhMjY1NCYjJTMyNjU0JisBmwGK1+dcVmZy2Mf+6wEVc3Jzcv7r0IKDfYjQBI2coVaBIAMYlGKkpAIL/ohfW1pkiVlZWUcAAAAAAQBy/+8EJASdABsAAAEOASMiAD0BNAAzMhYXIy4BIyIGHQEUFjMyNjcEIw70ztL+8QEP0tTvDroOhoOCpaWCg4UOAY7QzwEb5qzlARzOz4p/zZ+toM5/jQAAAAACAJsAAAQtBI0ACQATAAAzESEyAB0BFAAjAxEzMjY9ATQmI5sBotUBG/7l1ejohLKyhASN/vfV0tb++QP5/Jq7j9OOuwAAAAABAJsAAAPHBI0ACwAAASERIRUhESEVIREhA3D95QJy/NQDLP2OAhsCFf5+kwSNlP6wAAAAAQCbAAADyASNAAkAAAEhESMRIRUhESEDcf3kugMt/Y0CHAH4/ggEjZT+lAABAHL/7wRHBJ0AHwAAJQ4BIyIAPQE0ADMyFhcHLgEjIgYdARQWMzI2NzUhNSEERy7st+r+5gEb5N7hErgOh4SSs7GZb4sf/vgBwJ1CbAEF2fPXAQbBqQFtariQ9JO4LB38lQAAAQCbAAAEVQSNAAsAACEjESERIxEzESERMwRVuv26uroCRroB7v4SBI399QILAAAAAQCbAAABVASNAAMAACEjETMBVLm5BI0AAQBB/+8DcQSNAA8AAAEzERQGIyImNTMUFjMyNjUCubjdscXdunZyXXkEjfzUrcWvsmpkeWYAAAABAJsAAARABI0ADAAAASMRIxEzETMBMwkBIwG+abq6WwGN3/4zAfHqAfj+CASN/gIB/v3P/aQAAAEAmwAAA2oEjQAFAAAlIRUhETMBVQIV/TG6k5MEjQAAAQCbAAAFUASNAA4AACUBMxEjEScBIwEHESMRMwL5AXDnuQP+pYD+nwO68PIDm/tzA0YB/LkDWQH8qASNAAAAAAEAmwAABHIEjQALAAAhIwEHESMRMwE3ETMEcrj9ngO6ugJiA7gDbwH8kgSN/JABA28AAAACAHL/7wRXBJ0ADQAbAAABFAAjIgA9ATQAMzIAFSc0JiMiBh0BFBYzMjY1BFf+8ePj/vABD+LjARG5ppWUo6SVlaQB8Ov+6gEX6qzpARj+6OkBr72+rq2wvr2xAAIAcv+LBJoEnQATACEAAAEUBgcXBycOASMiAD0BNAAzMgAVJzQmIyIGHQEUFjMyNjUEVzY0rX+uO4JL4/7wAQ/i4wERuaaVlKOklZWkAfBlp0Kob6ciIQEX6qzpARj+6OkBr72+rq2wvr2xAAIAmwAABDoEjQAbACQAAAERIxEhMhYVFAYHFR4BHQEUFhcVIy4BPQE0JiMlITI2NTQmIyEBVboBy8/bYF9nWBIYvxgMa2f+0AERf3Fyfv7vAeL+HgSNsKVbfSUDHo1rZTNfGBMaazljXWSVXlxfaQABAF3/7wQNBJ0AJQAAATQmJy4BNTQ2MzIWFSM0JiMiBhUUFhceARUUBiMiJDUzFBYzMjYDVHur4sbt0NXouYd9hIByudzH+d3N/vO5pnuKkwEvSVcrPJCXlau4r2BzXk1MUC07l5Ocpai/cGRfAAAAAQBHAAADzwSNAAcAAAEhESMRITUhA8/+lbn+nAOIA/n8BwP5lAAAAAEAjP/vBHAEjQARAAABERQEIyIkNREzERQWMzI2NREEcP7w4uH+77isjpCqBI39AcfY2McC//0BgIyMgAL/AAABACoAAAR9BI0ACQAAARczNwEzASMBMwI6GQMYAUnG/i2u/i7HASBZVwNv+3MEjQABAEEAAAXABI0AEwAAARczNxMzExczNxMzASMDIwMjATMBwwMDA9+t4AMDA7jH/tes6QPqq/7XxgEJFBYDgvx8FBYDgvtzA2z8lASNAAAAAAEAOAAABD4EjQALAAAJATMJASMJASMJATMCOQEg2/51AZXZ/tb+2dwBlv5z2gLXAbb9v/20Ab/+QQJMAkEAAAABACAAAAQwBI0ACAAACQEzAREjEQEzAigBOND+Urn+V9ACQgJL/Q3+ZgGjAuoAAAABAE4AAAPYBI0ACQAAJSEVITUBITUhFQEyAqb8dgKM/ZYDUJOTcgOHlG4AAAIAe//vA/YEnQANABsAAAEUBiMiJjURNDYzMhYVJzQmIyIGFREUFjMyNjUD9vHLzfLwzczyuYp7eoqMenqJAZvJ4+PJAVfI4+THAYGVlYH+qIKXl4IAAAABAEIAAAHLBJ0ABQAAISMRBzUlAcu50AGJA9MDiEUAAAEAWgAAA3AEnQAYAAApATUBPgE1NCYjIgYVIzQ2MzIWFRQGBwEhA3D89QGbaUReXWxzudu9scR0nv74AiOTAZhlcUBYcHNYl8izq2+Wof76AAAAAAEAWf/vA50EnQAoAAABMjY1NCYjIgYVIzQ2MzIWFRQGBx4BFRQGIyImNTMUFjMyNjU0JisBNQH+bmVvb1t1ud+qwNhfV2Nl6cGr77h8ZnF/cXSnAppgV1BoYUuTramiU4MnIohmpLKpqlJubVZmX5AAAAAAAgBHAAAEEQSNAAoADgAAATMVIxUjNSEnATMDEScBA0nIyLn9uwQCQsC5A/6IAYKV7e12Ayr89QIRAf3uAAAAAAEAXQAABCMFxQAYAAApATUBPgE1NCYjIgYVIzQ2MzIWFRQGBwEhBCP8VgHdhFqBcJyRuf7oxuWMg/55AsuDAhOSp1pylJqRw/7gtXnpkP5XAAAAAAIAev/vA9IEnQAaACcAAAEyFhcHLgEjIgYdAT4BMzIWFRQGIyImNRE0JBMiBgcVFBYzMjY1NCYCTUSRQh87b0x+nTOPXL3D6sC98QEKplx9HYhsb4JzBJ0bGI8ZFaOCcTc8w7at0fTIATfH9P20QjoqgqeGZW13AAEARwAAA2MEjQAMAAABBgIRFSM1EBI3ITUhA2PBornkkf2LAxwD+ev+xv7lubkBFQGSmZQAAAAAAwBc/+8DxQSdABcAIwAvAAABFAYHHgEVFAYjIiY1NDY3LgE1NDYzMhYDNCYjIgYVFBYzMjYDNCYjIgYVFBYzMjYDomRZaXfxu8T5eW1dZ+S1rd6XjWdulJNxZ4sjeldifoBiWHcDXVmDJSeOYaSzs6Rhjiclg1mbpaX9Uldwb1hbbW0Cak5iX1FQZGQAAAAAAgBL/+8DnQSdABoAJwAAJTI2PQEOASMiJjU0NjMyFhURFAYjIiYnNx4BEzI2NzU0JiMiBhUUFgHec5IvgE3G1urAvOz6xUSRRB09clxdfRyHaWyCdoKUc3o1Ncyxqt30x/6ouOMaGJAaFQGlSjg5gKeTYGqFAAAAAQBeAAABhAMsAAUAACEjEQc1JQGEpIIBJgKUAYIXAAABAHEAAALGAywAGAAAKQE1AT4BNTQmIyIGFSM0NjMyFhUUBg8BIQLG/bQBL0gsOj9ISqGkj4iUV3WoAXp+AQg+Siw0P0E1aYx9dlBtbJIAAAEAaf/1AuADLAAoAAABMjY1NCYjIgYVIzQ2MzIWFRQGBx4BFRQGIyImNTMUFjMyNjU0JisBNQGnSEFJSjtKoqeAkqNFP0hKsJOAtKNNRE1USk2DAdU6Ni46MipldnVwOFoaGF1GcXp0dTE6OzNBOXoAAAAAAQBKAAACIwWwAAUAACEjEQU1JQIjuf7gAdkE3Ah3ZQABAHL/9QLxAyEAHgAAGwEhFSEHPgE3NhYVFAYjIiY1NxQWMzI2NTQmIyIGB5MzAgD+kBkdUC6Gk5unirOhVEhUTE5HRUUQAVoBx4G/EhkBAo6CfY1tcAszN0VGRVEjIAACAHv/9QMAAywAGgAnAAABMhYXBy4BIyIGHQE+ATMyFhUUBiMiJj0BNDYTIgYHFRQWMzI2NTQmAd02aiwdKFA1V2skZkKGkbGRj7TIgkNWD1lIS1ZMAywTEHsQD19RRyQoiX13kKeK1oqm/lktKApRYks+Q0YAAAABAF4AAAKoAyEADAAAAQ4BHQEjNTQSNyE1IQKoim6imF3+WwJKAqKgx7x/f7sBEVd/AAAAAwBy//UDAwMsABcAIwAvAAABFAYHHgEVFAYjIiY1NDY3LgE1NDYzMhYDNCYjIgYVFBYzMjYDNCYjIgYVFBYzMjYC60hASla0jpS7WE5DSqyJhKeJXkRKY2JMRVwaTTtBUlRAOU4CUDxaGxxiQHJ6enJAYhwbWjxrcXH+LDZDQzY3PT0BmC82NDEwOjoAAAAAAgBp//UC6AMsABoAJwAAJTI2PQEOASMiJjU0NjMyFh0BFAYjIiYnNx4BEzI2NzU0JiMiBhUUFgGWTWEgVjKToLCRi7O+lDNsMxsrU0g/Ug5ZRkdTTXNVRkwjIo58dZipiet/mxERexEOARgwJBtQY1Q6RFAAAAAAAgB8//UDGwMsAA0AGwAAARQGIyImPQE0NjMyFhUnNCYjIgYdARQWMzI2NQMbtpmatrWZmrejXFJSWltTUloBG4qcnIrriZ2diQFPV1dP7FFXV1EAAQCPAowDCwMhAAMAAAEhNSEDC/2EAnwCjJUAAAMAngRCAmsGcwAEABAAHAAAATMXByMHNDYzMhYVFAYjIiY3FBYzMjY1NCYjIgYBsbkB2XKCY0lHYGBHSWNVMiUjMDAjJTIGcwO110heXUlJWVpIJDAwJCYyMwAAAgBvBHACvgXWAAUADwAAARMzFQMjJTQ2NxcOAR0BIwGGdMTfWf7pWlhJLCeoBIMBQhX+wlRXiy46LmdHUAAAAAEAXv/rA/oFxQAoAAABMzI2NTQmIyIGFSM0NjMyFhUUBgceARUUBCMiJDUzFBYzMjY1NCYrAQGGp4pzfoF5jrn2ys7qbnCHbv8Azsr+/LqSgoWQhJCnAzCEeIGCiHSt5dPKXbAwK7Z1y9/VwXeKh4qLgAAAAgA5AAAEUQWwAAoADwAAATMVIxEjESE1ATMBIREjBwOEzc24/W0Ch8T9fQHLAxsB6JX+rQFTawPy/DgCyUYAAAEAmv/rBBEFsAAeAAAbASEVIQM+ATc2EhUUAiMiJjUzFBYzMjY1NCYjIgYHsVQC1f3HMDByUcrj5OW88q+LdISMjYB6bBoCkQMfqf5cJS0CAv775OD++8fNfIOvn5GzRkwAAAACAIf/6wQzBcUAGgAnAAABMhYXBy4BIyIGHQE+ATMyEhUUAiMiABkBEAATIgYHFRQWMzI2NTQmAp9MkTIoNGlKoL9ApWTH4/PQ2P7vATCpapElqoaAipIFxSIbkRoe9c4jPEH+99Xl/ugBLwEeAR8BGwFT/XNVSnPO2MyclroAAAMAHv5KBBEETgAvAD8ATQAAASMeAR0BFAYjIiYnDgEVFBY7ATIWFRQEIyImNTQ2Ny4BNTQ2Ny4BPQE0NjMyFhchASImJw4BFRQWMzI2NTQmIwEUFjMyNj0BNCYjIgYVBBGZHh/tvStJIxkcQzytytH+3PTe8mFSHB0/NVVa68EoSyQBb/2MFSYTNUGLjKC/ZH7+q4dua4aGbW6FA6orYDcWmcwKCxQ0Iy4mj5aA1J54XIEqFzsoRmEmMZdcFp/HCgr79AIEGFw9SFx4R0tFAqRVe3tVFlh4eFgAAAABADsAAAP8BbAADAAAAQoBAwcjNxoBEyE1IQP8/7YnD7oPKefP/PYDwQUa/sH+G/6jmZkBYgIXAQiWAAABAFr+TARHBEkAIwAAEzIWFxsBMwETHgEzMjY3Bw4BIyImJwMBIwEDLgEjIgYjJz4Bwn9uO3P/u/6g0SFBLQ4OFAILJA5vc0KP/ufEAYOoI1M+CzcCARU8BEmJgv74AgT9L/4hS00CA5wGCXmWAUf9vwMQAYRWYgWSBQoAAwBm/+sEGAXFABgAJAAwAAABFAYHHgEVFAQjIiQ1NDY3NS4BNTQ2MzIWAzQmIyIGFRQWMzI2AzQmIyIGFRQWMzI2A/B/b4GV/v7W2v8AkX9teunGw++Ron+CnZuGgZ4pim5whodxb4cENXWpKy24fs3R0M5+uSwDKal0xMzN/JV7mpl8gI2OAyNwjol1c4aGAAAAAAIAZP/rBFgETgAUACIAACUjDgEjIgI9ARASMzIWFz8BMwMTIwEUFjMyNjc1LgEjIgYVA4MDNbeMydvazIm1NQMhsGpxsP11h5J3giIahnmTiOt+ggEb7xUBCgE6gHsB5v3i/eQB9arL07UmrN7twQACAGD/6wQnBbAAGwAsAAABFSEeARcWEh0BFAAjIgA9ATQSNzoBMzcmJCc1ExQWMzI2PQE0JicuASMiBhUDtP40HHRMsbL/AOPk/wDz2gkUCgEW/ug5LJWVlJZnSxcwHJ+gBbCSH2ZAnf73nxjt/twBJO0YwAEGGAIU9kBy/Eyo1NWnGHO1NQYGzJ0AAAIAtgAABLYFsAAJABMAADMRISAAERUQACEDETMyNj0BNCYjtgF3AVgBMf7P/qi+vvnX1/kFsP7W/svz/sv+1wUa+3ve6/bo3gAAAAACAHL/6wPsBE4AHwAqAAAhLgEnDgEjIiY1NDY7ATU0JiMiBhUjNDYzMhYVERQWFyUyNjc1IyIGFRQWAy0JCQI7rGivqfrjyHZ1d3O50dzNzQwQ/flopiTOkoxVKzsfRFadpKuhiWBXX0uFu5yz/ds6ajaKUTvia2VOUAAAAgC1AAAE8gWvAA4AFwAAARQGBwEVIwEhESMRITIWASEyNjU0JiMhBJeHfAFez/7A/ou5Afrv+fzXAUaWlJOc/r8EC4LDMP18EgJq/ZYFr9b+JouDf44AAAEAtgAABR0FsAAMAAABBxEjETMRNwEzCQEjAhanubmoAevV/bwCiugCrbH+BAWw/Sa2AiT9g/zNAAAAAAEAkgAABBQGGAAMAAABBxEjETMRNwEzCQEjAcN3urprAVTe/lQB19sB8nz+igYY/EN5AWb+Of2NAAAAAAEAtgAABPkFsAALAAABESMRMxEzATMJASMBb7m5DAJu5/1jAsbkArf9SQWw/XgCiP08/RQAAAAAAQCSAAAD8QYYAAwAAAEjESMRMxEzATMJASMBUQW6ugEBivD+KgIA5AH0/gwGGPxzAa/+Df25AAACAFT/6wP9BcUAGwAoAAAlMjY9AScOASMiAjU0ADMyABkBEAAjIiYnNx4BEzI2NzU0JiMiBhUUFgH/lq4DMJZe1/EBAsDmAQH+6uhPm0IdP35vcpQhlZJ0mo6A1tosAUlKAQPx6AEf/ur+5/6c/uD+2RwfkB4YAd9gTZzFwsylob4AAAACAJsAAAQZBI0ACgATAAABESMRITIWFRQGIyUhMjY1NCYjIQFVugHPzOPizf7rARV7enp7/usBpv5aBI3Np6nKlH9eYIIAAP//AIEEpQLYBbACBgCcAAD//wAAAAAAAAAAAgYAAwAA//8AJQIhAg0CtgIGAA8AAAACAC4AAAUFBbAADQAbAAAzESM1MxEhIAARFRAAIRMhETMyEj0BNCYjIREh1KamAbsBIgFU/qj+0C3+4/Do5uLa/v4BHQKalQKB/qb+5MX+4v6pApr9+wEF28ff//4VAAACAC4AAAUFBbAADQAbAAAzESM1MxEhIAARFRAAIRMhETMyEj0BNCYjIREh1KamAbsBIgFU/qj+0C3+4/Do5uLa/v4BHQKalQKB/qb+5MX+4v6pApr9+wEF28ff//4VAAABAAYAAAQYBhgAHAAAASERFz4BMzIWFREjETQmIyIGBxEjESM1MzUzFSECgv7nAzeiZ7G7uXR3V4gsuqmpugEZBNL+1QFQWMzd/VsCp42AUkj85gTSlbGxAAAAAAEAOwAABIoFsAAPAAABIxEjESM1MxEhNSEVIREzA5zduebm/jUET/413QM2/MoDNpUBT5aW/rEAAf/j/+wCXwVBAB8AAAERMxUjFTMVIxEUFjMyNjcXDgEjIiY1ESM1MzUjNTMRAXLQ0O3tNi8YMRUZGl0ucYDV1ZubBUH++Y2+lf69UD8HBoMRFY2eAUOVvo0BB///ACcAAAUiByICJgAjAAAABwBCARQBXf//ACcAAAUiBx8CJgAjAAAABwBzAc4BWf//ACcAAAUiB0YCJgAjAAAABwCaANABXf//ACcAAAUiB1ECJgAjAAAABwCgAMoBYP//ACcAAAUiBwwCJgAjAAAABwBoAKoBXP//ACcAAAUiB4gCJgAjAAAABwCeAVEBqP//ACcAAAUiB58CJgAjAAAABwHUAWEBLP//AIP+RATJBcUCJgAlAAAABwB3Adv/9///ALYAAAR1ByICJgAnAAAABwBCAOABXf//ALYAAAR1Bx8CJgAnAAAABwBzAZoBWf//ALYAAAR1B0YCJgAnAAAABwCaAJwBXf//ALYAAAR1BwwCJgAnAAAABwBoAHYBXP///9wAAAF8ByICJgArAAAABwBC/40BXf//AMMAAAJkBx8CJgArAAAABwBzAEYBWf////IAAAJPB0YCJgArAAAABwCa/0kBXf///8wAAAJ1BwwCJgArAAAABwBo/yMBXP//ALYAAAT+B1ECJgAwAAAABwCgAPsBYP//AIL/6wUNBzcCJgAxAAAABwBCATQBcv//AIL/6wUNBzQCJgAxAAAABwBzAe4Bbv//AIL/6wUNB1sCJgAxAAAABwCaAPABcv//AIL/6wUNB2YCJgAxAAAABwCgAOoBdf//AIL/6wUNByECJgAxAAAABwBoAMoBcf//AJb/6wTXByICJgA3AAAABwBCASYBXf//AJb/6wTXBx8CJgA3AAAABwBzAeABWf//AJb/6wTXB0YCJgA3AAAABwCaAOIBXf//AJb/6wTXBwwCJgA3AAAABwBoALwBXP//AB4AAATTBx0CJgA7AAAABwBzAaABV///AHL/7APsBeACJgBDAAAABwBCAJYAG///AHL/7APsBd0CJgBDAAAABwBzAVAAF///AHL/7APsBgQCJgBDAAAABgCaUhsAAP//AHL/7APsBg8CJgBDAAAABgCgTB4AAP//AHL/7APsBcoCJgBDAAAABgBoLBoAAP//AHL/7APsBkYCJgBDAAAABwCeANMAZv//AHL/7APsBl4CJgBDAAAABwHUAOP/6///AGH+RAPyBE4CJgBFAAAABwB3AUX/9///AGL/7APpBeECJgBHAAAABwBCAJsAHP//AGL/7APpBd4CJgBHAAAABwBzAVUAGP//AGL/7APpBgUCJgBHAAAABgCaVxwAAP//AGL/7APpBcsCJgBHAAAABgBoMRsAAP///7UAAAFVBcsCJgCKAAAABwBC/2YABv//AJsAAAI9BcgCJgCKAAAABgBzHwIAAP///8sAAAIoBe8CJgCKAAAABwCa/yIABv///6UAAAJOBbUCJgCKAAAABwBo/vwABf//AJEAAAP4Bg8CJgBQAAAABgCgZR4AAP//AGD/7AQnBeACJgBRAAAABwBCALMAG///AGD/7AQnBd0CJgBRAAAABwBzAW0AF///AGD/7AQnBgQCJgBRAAAABgCabxsAAP//AGD/7AQnBg8CJgBRAAAABgCgaR4AAP//AGD/7AQnBcoCJgBRAAAABgBoSRoAAP//AI3/7AP2BcsCJgBXAAAABwBCALEABv//AI3/7AP2BcgCJgBXAAAABwBzAWsAAv//AI3/7AP2Be8CJgBXAAAABgCabQYAAP//AI3/7AP2BbUCJgBXAAAABgBoRwUAAP//ABv+SwPkBcgCJgBbAAAABwBzASkAAv//ABv+SwPkBbUCJgBbAAAABgBoBQUAAP//ACcAAAUiBvoCJgAjAAAABwBuAM4BSv//AHL/7APsBbgCJgBDAAAABgBuUAgAAP//ACcAAAUiB0wCJgAjAAAABwCcAPsBnP//AHL/7APsBgoCJgBDAAAABgCcfVoAAAACACf+UAUiBbAAGgAdAAABMwEjDgEVFBYzMjY3Fw4BIyImNTQ2NwMhAyMBIQMCWaACKSVTWCMrHS8YDSBKNldpVVuJ/ZuPvQGDAfj6BbD6UD1lPCQmEAx4ExliW0d+NwF7/nwCGQKyAAIAcv5QA+0ETgAzAD4AACEuAScOASMiJjU0NjsBNTQmIyIGFSM0NjMyFhURFBYXIw4BFRQWMzI2NxcOASMiJjU0NjclMjY3NSMiBhUUFgMtCgoCOqxnq6343NF6cWmBue6/u98MEBNTWCMrHS8YDSBKNldpTlP+t2ilJdeBlF0zQiRMYamZnqxuY29jR33DuLL99jpqNj1lPCQmEAx4ExliW0R6NYtgRsd5VUtUAAD//wCD/+sEyQc0AiYAJQAAAAcAcwHXAW7//wBh/+wD8gXdAiYARQAAAAcAcwFBABf//wCD/+sEyQdbAiYAJQAAAAcAmgDZAXL//wBh/+wD8gYEAiYARQAAAAYAmkMbAAD//wCD/+sEyQciAiYAJQAAAAcAnQGoAXL//wBh/+wD8gXLAiYARQAAAAcAnQESABv//wCD/+sEyQdcAiYAJQAAAAcAmwDvAXP//wBh/+wD8gYFAiYARQAAAAYAm1kcAAD//wC2AAAE5wdHAiYAJgAAAAcAmwCoAV7//wBk/+wFMAYYACYARgAAAAcBkQPZBSz//wC2AAAEdQb6AiYAJwAAAAcAbgCaAUr//wBi/+wD6QW5AiYARwAAAAYAblUJAAD//wC2AAAEdQdMAiYAJwAAAAcAnADHAZz//wBi/+wD6QYLAiYARwAAAAcAnACCAFv//wC2AAAEdQcNAiYAJwAAAAcAnQFrAV3//wBi/+wD6QXMAiYARwAAAAcAnQEmABwAAQC2/lAEdQWwACAAAAEhESEVIw4BFRQWMzI2NxcOASMiJjU0NjcnIREhFSERIQQP/WADBjhTWCMrHS8YDSBKNldpTVAB/SkDtf0EAqACpv3vlT1lPCQmEAx4ExliW0N6MwMFsJb+IgACAGL+ZAPpBE4AKQAxAAAFIgA9ATQAMzISHQEhHgEzMjY3Fw4BBw4BFRQWMzI2NxcOASMiJjU0NjcDIgYHITU0JgJO5P74AQ+/3N39MwSdkWWTO0keSzBRVyMrHS8YDSBKNldpNDgkaZEUAg6AFAEn9C3sAS7+/uB5psw4M3sdMRE7ZTwkJhAMeBMZYls3ZS8DzKmHGnmd//8AtgAABHUHRwImACcAAAAHAJsAsgFe//8AYv/sA+kGBgImAEcAAAAGAJttHQAA//8Ahf/rBNsHWwImACkAAAAHAJoA0QFy//8AZv5MA/cGBAImAEkAAAAGAJpdGwAA//8Ahf/rBNsHYQImACkAAAAHAJwA/AGx//8AZv5MA/cGCgImAEkAAAAHAJwAiABa//8Ahf/rBNsHIgImACkAAAAHAJ0BoAFy//8AZv5MA/cFywImAEkAAAAHAJ0BLAAb//8Ahf3lBNsFxQImACkAAAAHAZEBq/62//8AZv5MA/cGbQImAEkAAAAHAaUBMwBW//8AtgAABP0HRgImACoAAAAHAJoA+gFd//8AkQAAA/oHRQImAEoAAAAHAJoAIwFc////xQAAAncHUQImACsAAAAHAKD/QwFg////ngAAAlAF+gImAIoAAAAHAKD/HAAJ////vwAAAokG+gImACsAAAAHAG7/RwFK////mAAAAmIFpAImAIoAAAAHAG7/IP/0////9QAAAkwHTAImACsAAAAHAJz/dAGc////zgAAAiUF9QImAIoAAAAHAJz/TQBF//8AIf5YAYEFsAImACsAAAAGAJ/vCAAA//8AAP5QAWAGGAImAEsAAAAGAJ/OAAAA//8AtwAAAYYHDQImACsAAAAHAJ0AFwFd//8Aw//rBf8FsAAmACsAAAAHACwCPwAA//8Aof5LA2MGGAAmAEsAAAAHAEwB/AAA//8AP//rBIsHOQImACwAAAAHAJoBhQFQ////tP5LAjkF3AImAJgAAAAHAJr/M//z//8Atv31BRwFsAImAC0AAAAHAZEBev7G//8Akv33BBQGGAImAE0AAAAHAZEBGP7I//8AtgAABCUG4AImAC4AAAAHAHMANwEa//8AoQAAAkMHXAImAE4AAAAHAHMAJQGW//8Atv33BCUFsAImAC4AAAAHAZEBdP7I//8AW/33AVoGGAImAE4AAAAHAZH///7I//8AtgAABCUFsQImAC4AAAAHAZEB2QTF//8AoQAAAq0GGAAmAE4AAAAHAZEBVgUs//8AtgAABCUFsAImAC4AAAAHAJ0Bxf3F//8AoQAAAq0GGAAmAE4AAAAHAJ0BPv23//8AtgAABP4HHwImADAAAAAHAHMB/wFZ//8AkQAAA/gF3QImAFAAAAAHAHMBaQAX//8Atv33BP4FsAImADAAAAAHAZEB2P7I//8Akf33A/gETgImAFAAAAAHAZEBQv7I//8AtgAABP4HRwImADAAAAAHAJsBFwFe//8AkQAAA/gGBQImAFAAAAAHAJsAgQAc////0gAAA/gGGAImAFAAAAAHAZH/dgUs//8Agv/rBQ0HDwImADEAAAAHAG4A7gFf//8AYP/sBCcFuAImAFEAAAAGAG5tCAAA//8Agv/rBQ0HYQImADEAAAAHAJwBGwGx//8AYP/sBCcGCgImAFEAAAAHAJwAmgBa//8Agv/rBQ0HYAImADEAAAAHAKEBdwFy//8AYP/sBD4GCQImAFEAAAAHAKEA9gAb//8AtQAABOIHHwImADQAAAAHAHMBkgFZ//8AkQAAAuIF3QImAFQAAAAHAHMAxAAX//8Atf33BOIFrwImADQAAAAHAZEBa/7I//8AWP33ArEETgImAFQAAAAHAZH//P7I//8AtQAABOIHRwImADQAAAAHAJsAqgFe//8AaQAAAtQGBQImAFQAAAAGAJvdHAAA//8AWv/rBIoHNAImADUAAAAHAHMBiQFu//8AZv/sA8IF3QImAFUAAAAHAHMBPAAX//8AWv/rBIoHWwImADUAAAAHAJoAiwFy//8AZv/sA8IGBAImAFUAAAAGAJo+GwAA//8AWv5EBIoFxQImADUAAAAHAHcBjf/3//8AZv5FA8IETgImAFUAAAAHAHcBQP/4//8AWv3jBIoFxQImADUAAAAHAZEBYv60//8AZv3kA8IETgImAFUAAAAHAZEBFf61//8AWv/rBIoHXAImADUAAAAHAJsAoQFz//8AZv/sA8IGBQImAFUAAAAGAJtUHAAA//8AO/31BIoFsAImADYAAAAHAZEBZf7G//8AHf3tAk4FQQImAFYAAAAHAZEArP6+//8AO/5VBIoFsAImADYAAAAHAHcBkAAI//8AHf5NAoEFQQImAFYAAAAHAHcA1wAA//8AOwAABIoHRgImADYAAAAHAJsApAFd//8AHf/sAuwGMQAmAFYAAAAHAZEBlQVF//8Alv/rBNcHUQImADcAAAAHAKAA3AFg//8Ajf/sA/YF+gImAFcAAAAGAKBnCQAA//8Alv/rBNcG+gImADcAAAAHAG4A4AFK//8Ajf/sA/YFpAImAFcAAAAGAG5r9AAA//8Alv/rBNcHTAImADcAAAAHAJwBDQGc//8Ajf/sA/YF9QImAFcAAAAHAJwAmABF//8Alv/rBNcHiAImADcAAAAHAJ4BYwGo//8Ajf/sA/YGMQImAFcAAAAHAJ4A7gBR//8Alv/rBNcHSwImADcAAAAHAKEBaQFd//8Ajf/sBDwF9AImAFcAAAAHAKEA9AAGAAEAlv5uBNcFsAAnAAABERQGBw4BFRQWMzI2NxcOASMiJjU0NjciBiMiJDURMxEUFjMyNjURBNeRhFNYIysdLxgNIEo2V2kuMgcbBvT+3Lq9oanHBbD8JaXaOD1lPCQmEAx4ExliWzRhLAH48gPb/CWrqqqrA9sAAAEAjf5QBAkEOgAnAAAhDgEVFBYzMjY3Fw4BIyImNTQ2Ny8BDgEjIiY1ETMRFBYzMjY3ETMRA/VTWCMrHS8YDSBKNldpUFYMAzKebbTCumhxcIkkuT1lPCQmEAx4ExliW0R8NpsBV1zd9AJ9/YGyg1dTAwr7xgAA//8ASAAABsIHRgImADkAAAAHAJoBrQFd//8AMAAABdgF7wImAFkAAAAHAJoBLgAG//8AHgAABNMHRAImADsAAAAHAJoAogFb//8AG/5LA+QF7wImAFsAAAAGAJorBgAA//8AHgAABNMHCgImADsAAAAHAGgAfAFa//8AYQAABG0HHwImADwAAAAHAHMBiAFZ//8AXgAAA7gFyAImAFwAAAAHAHMBMwAC//8AYQAABG0HDQImADwAAAAHAJ0BWQFd//8AXgAAA7gFtgImAFwAAAAHAJ0BBAAG//8AYQAABG0HRwImADwAAAAHAJsAoAFe//8AXgAAA7gF8AImAFwAAAAGAJtLBwAA////8gAAB1cHHwImAH8AAAAHAHMC0QFZ//8APf/rBnwF3gImAIQAAAAHAHMCggAY//8Ac/+jBP4HXQImAIEAAAAHAHMB4gGX//8AYP95BCcF3AImAIcAAAAHAHMBQAAW////8wAABC0EjQImAakAAAAHAdP/ZP97////8wAABC0EjQImAakAAAAHAdP/ZP97//8ARwAAA88EjQImAbgAAAAGAdMx9wAA//8AKQAABIMF3wImAaYAAAAHAEIAvwAa//8AKQAABIMF3AImAaYAAAAHAHMBeQAW//8AKQAABIMGAwImAaYAAAAGAJp7GgAA//8AKQAABIMGDgImAaYAAAAGAKB1HQAA//8AKQAABIMFyQImAaYAAAAGAGhVGQAA//8AKQAABIMGRQImAaYAAAAHAJ4A/ABl//8AKQAABIMGXQImAaYAAAAHAdQBDP/q//8Acv5HBCQEnQImAagAAAAHAHcBb//6//8AmwAAA8cF3wImAaoAAAAHAEIAjgAa//8AmwAAA8cF3AImAaoAAAAHAHMBSAAW//8AmwAAA8cGAwImAaoAAAAGAJpKGgAA//8AmwAAA8cFyQImAaoAAAAGAGgkGQAA////swAAAVQF3wImAa4AAAAHAEL/ZAAa//8AmwAAAjsF3AImAa4AAAAGAHMdFgAA////yQAAAiYGAwImAa4AAAAHAJr/IAAa////owAAAkwFyQImAa4AAAAHAGj++gAZ//8AmwAABHIGDgImAbMAAAAHAKAAlgAd//8Acv/vBFcF7wImAbQAAAAHAEIAwAAq//8Acv/vBFcF7AImAbQAAAAHAHMBegAm//8Acv/vBFcGEwImAbQAAAAGAJp8KgAA//8Acv/vBFcGHgImAbQAAAAGAKB2LQAA//8Acv/vBFcF2QImAbQAAAAGAGhWKQAA//8AjP/vBHAF4AImAbkAAAAHAEIA4AAb//8AjP/vBHAF3QImAbkAAAAHAHMBmgAX//8AjP/vBHAGBAImAbkAAAAHAJoAnAAb//8AjP/vBHAFygImAbkAAAAGAGh2GgAA//8AIAAABDAF2wImAb0AAAAHAHMBSQAV//8AKQAABIMFtwImAaYAAAAGAG55BwAA//8AKQAABIMGCQImAaYAAAAHAJwApgBZAAIAKf5QBIMEjQAaAB0AAAEzASMOARUUFjMyNjcXDgEjIiY1NDY3JyEDIwEhAwH/rwHVN1NYIysdLxgNIEo2V2lcYWP9+GnAAWIBlswEjftzPWU8JCYQDHgTGWJbSYM4//7wAaQCDQD//wBy/+8EJAXsAiYBqAAAAAcAcwFrACb//wBy/+8EJAYTAiYBqAAAAAYAmm0qAAD//wBy/+8EJAXaAiYBqAAAAAcAnQE8ACr//wBy/+8EJAYUAiYBqAAAAAcAmwCDACv//wCbAAAELQYEAiYBqQAAAAYAmy8bAAD//wCbAAADxwW3AiYBqgAAAAYAbkgHAAD//wCbAAADxwYJAiYBqgAAAAYAnHVZAAD//wCbAAADxwXKAiYBqgAAAAcAnQEZABoAAQCb/lADxwSNACAAAAEhESEVIw4BFRQWMzI2NxcOASMiJjU0NjcnIREhFSERIQNw/eUCckhTWCMrHS8YDSBKNldpTVAB/cwDLP2OAhsCFf5+kz1lPCQmEAx4ExliW0N6MwMEjZT+sP//AJsAAAPHBgQCJgGqAAAABgCbYBsAAP//AHL/7wRHBhMCJgGsAAAABgCadSoAAP//AHL/7wRHBhkCJgGsAAAABwCcAKAAaf//AHL/7wRHBdoCJgGsAAAABwCdAUQAKv//AHL95wRHBJ0CJgGsAAAABwGRAVL+uP//AJsAAARVBgMCJgGtAAAABwCaAIMAGv///5wAAAJOBg4CJgGuAAAABwCg/xoAHf///5YAAAJgBbcCJgGuAAAABwBu/x4AB////8wAAAIjBgkCJgGuAAAABwCc/0sAWf////f+UAFXBI0CJgGuAAAABgCfxQAAAP//AI8AAAFeBcoCJgGuAAAABgCd7xoAAP//AEH/7wQ9BfkCJgGvAAAABwCaATcAEP//AJv98wRABI0CJgGwAAAABwGRAP/+xP//AJsAAANqBcECJgGxAAAABgBzI/sAAP//AJv99QNqBI0CJgGxAAAABwGRANz+xv//AJsAAANqBI4CJgGxAAAABwGRAUUDov//AJsAAANqBI0CJgGxAAAABwCdATH9Jv//AJsAAARyBdwCJgGzAAAABwBzAZoAFv//AJv99QRyBI0CJgGzAAAABwGRAXP+xv//AJsAAARyBgQCJgGzAAAABwCbALIAG///AHL/7wRXBccCJgG0AAAABgBuehcAAP//AHL/7wRXBhkCJgG0AAAABwCcAKcAaf//AHL/7wRXBhgCJgG0AAAABwChAQMAKv//AJsAAAQ6BdwCJgG2AAAABwBzASYAFv//AJv99QQ6BI0CJgG2AAAABwGRAP/+xv//AJsAAAQ6BgQCJgG2AAAABgCbPhsAAP//AF3/7wQNBewCJgG3AAAABwBzAVQAJv//AF3/7wQNBhMCJgG3AAAABgCaVioAAP//AF3+RwQNBJ0CJgG3AAAABwB3AVj/+v//AF3/7wQNBhQCJgG3AAAABgCbbCsAAP//AEf99QPPBI0CJgG4AAAABwGRAQP+xv//AEcAAAPPBgMCJgG4AAAABgCbQhoAAP//AIz/7wRwBg8CJgG5AAAABwCgAJYAHv//AIz/7wRwBbgCJgG5AAAABwBuAJoACP//AIz/7wRwBgoCJgG5AAAABwCcAMcAWv//AIz/7wRwBkYCJgG5AAAABwCeAR0AZv//AIz/7wRwBgkCJgG5AAAABwChASMAGwABAIz+ewRwBI0AJwAAAREUBgcOARUUFjMyNjcXDgEjIiY1NDY3IgYjIiQ1ETMRFBYzMjY1EQRwcGhTWCMrHS8YDSBKNldpKi0HGAbh/u+4rI6QqgSN/QF9sjQ9ZTwkJhAMeBMZYlsyWysB2McC//0BgIyMgAL/AP//AEEAAAXABgMCJgG7AAAABwCaASEAGv//ACAAAAQwBgICJgG9AAAABgCaSxkAAP//ACAAAAQwBcgCJgG9AAAABgBoJRgAAP//AE4AAAPYBdwCJgG+AAAABwBzAScAFv//AE4AAAPYBcoCJgG+AAAABwCdAPgAGv//AE4AAAPYBgQCJgG+AAAABgCbPxsAAP//AF3/7wh8BJ0AJgG3AAAABwG3BG8AAP//ACcAAAUiBngCJgAjAAAABgCpOgAAAP///+YAAATZBnoAJgAnZAAABwCp/yMAAv//ABMAAAVhBnoAJgAqZAAABwCp/1AAAv//ABkAAAHgBnkAJgArZAAABwCp/1YAAf//AFL/6wUhBngAJgAxFAAABgCpjwAAAP///40AAAU3BngAJgA7ZAAABwCp/soAAP//AD8AAAThBngAJgC1FAAABwCp/3wAAP///8j/6wKDBj8CJgC+AAAABwCq/yf/t///ACcAAAUiBbACBgAjAAD//wC2AAAEqQWwAgYAJAAA//8AtgAABHUFsAIGACcAAP//AGEAAARtBbACBgA8AAD//wC2AAAE/QWwAgYAKgAA//8AwwAAAXwFsAIGACsAAP//ALYAAAUcBbACBgAtAAD//wC2AAAGTQWwAgYALwAA//8AtgAABP4FsAIGADAAAP//AIL/6wUNBcUCBgAxAAD//wC2AAAExAWwAgYAMgAA//8AOwAABIoFsAIGADYAAP//AB4AAATTBbACBgA7AAD//wBBAAAE0AWwAgYAOgAA////zAAAAnUHDAImACsAAAAHAGj/IwFc//8AHgAABNMHCgImADsAAAAHAGgAfAFa//8AZP/rBHcGegImALYAAAAHAKkBdQAC//8AY//tA+wGeQImALoAAAAHAKkBKwAB//8Akf5hA/AGegImALwAAAAHAKkBRgAC//8Aw//rAmsGZgImAL4AAAAGAKkq7gAA//8Aj//rA/YGPwImAMYAAAAGAKoetwAA//8AmgAABD8EOgIGAIsAAP//AGD/7AQnBE4CBgBRAAD//wCa/mAD7gQ6AgYAdAAA//8ALgAAA98EOgIGAFgAAP//AC4AAAPPBDoCBgBaAAD////T/+sCfAW1AiYAvgAAAAcAaP8qAAX//wCP/+sD9gW1AiYAxgAAAAYAaCEFAAD//wBg/+wEJwZ6AiYAUQAAAAcAqQFKAAL//wCP/+sD9gZmAiYAxgAAAAcAqQEi/+7//wB6/+sGGQZjAiYAyQAAAAcAqQJT/+v//wC2AAAEdQcMAiYAJwAAAAcAaAB2AVz//wC1AAAEMAcfAiYArAAAAAcAcwGYAVkAAQBa/+sEigXFACUAAAE0JicuATU0JDMyABUjNCYjIgYVFBYXHgEVFAQjIiQ1MxQWMzI2A9CWx+z+ARPh8QEYuaykm6CpyOrt/uXr3/61udOenLABbmiFMTjQpa3f/v62hJ6FbmJ/MTvYp7PS6M+RkX4AAP//AMMAAAF8BbACBgArAAD////MAAACdQcMAiYAKwAAAAcAaP8jAVz//wA//+sDwAWwAgYALAAA//8AtgAABRwFsAIGAC0AAP//ALYAAAUcBscCJgAtAAAABwBzAYwBAf//AFH/6wTIB0wCJgDZAAAABwCcANoBnP//ACcAAAUiBbACBgAjAAD//wC2AAAEqQWwAgYAJAAA//8AtQAABDAFsAIGAKwAAP//ALYAAAR1BbACBgAnAAD//wC2AAAE/gdMAiYA1wAAAAcAnAExAZz//wC2AAAGTQWwAgYALwAA//8AtgAABP0FsAIGACoAAP//AIL/6wUNBcUCBgAxAAD//wC2AAAE/wWwAgYAsQAA//8AtgAABMQFsAIGADIAAP//AIP/6wTJBcUCBgAlAAD//wA7AAAEigWwAgYANgAA//8AQQAABNAFsAIGADoAAP//AHL/7APsBE4CBgBDAAD//wBi/+wD6QROAgYARwAA//8AnAAABAEF9QImAOsAAAAHAJwAogBF//8AYP/sBCcETgIGAFEAAP//AJH+YAQkBE4CBgBSAAAAAQBh/+wD8gROABsAACUyNjczDgEjIgI9ATQSMzIWFyMuASMiBh0BFBYCQ2eXAbAB/6/u9PTuv+8BsAGOcKGHhoF4XJTVAS/tKuwBMNysaIrfpyqr3AAA//8AG/5LA+QEOgIGAFsAAP//AC4AAAPPBDoCBgBaAAD//wBi/+wD6QXLAiYARwAAAAYAaDEbAAD//wCaAAADRwXIAiYA5wAAAAcAcwDVAAL//wBm/+wDwgROAgYAVQAA//8AoQAAAVoGGAIGAEsAAP///6UAAAJOBbUCJgCKAAAABwBo/vwABf///7b+SwFnBhgCBgBMAAD//wCcAAAEPwXHAiYA7AAAAAcAcwFDAAH//wAb/ksD5AX1AiYAWwAAAAYAnFZFAAD//wBIAAAGwgciAiYAOQAAAAcAQgHxAV3//wAwAAAF2AXLAiYAWQAAAAcAQgFyAAb//wBIAAAGwgcfAiYAOQAAAAcAcwKrAVn//wAwAAAF2AXIAiYAWQAAAAcAcwIsAAL//wBIAAAGwgcMAiYAOQAAAAcAaAGHAVz//wAwAAAF2AW1AiYAWQAAAAcAaAEIAAX//wAeAAAE0wcgAiYAOwAAAAcAQgDmAVv//wAb/ksD5AXLAiYAWwAAAAYAQm8GAAD//wBnBCMA/QYYAgYACQAA//8AaQQUAh8GGAIGAAQAAP//AKkAAAN1BbAAJgQbAAAABwQbAg8AAP//AEIAAAQYBi0AJgBIAAAABwBOAr4AAP///7T+SwJABd0CJgCYAAAABwCb/0n/9P//ADAD5wFHBhgCBgFmAAD//wC2AAAGTQcfAiYALwAAAAcAcwKpAVn//wCQAAAGcgXdAiYATwAAAAcAcwK7ABf//wAn/ocFIgWwAiYAIwAAAAcAogFPAAD//wBy/ocD7AROAiYAQwAAAAcAogCeAAD///8+/+sFDQaiAiYAMQAAAAcB1f7PAMz//wBCAAAGiwYtACYASAAAAAcBkgK+AAD//wBCAAAG1gYtACYASAAAACcASAK+AAAABwBOBXwAAP//ALYAAAR1ByICJgAnAAAABwBCAOABXf//ALYAAAT+ByICJgDXAAAABwBCAUoBXf//AGL/7APpBeECJgBHAAAABwBCAJsAHP//AJwAAAQBBcsCJgDrAAAABwBCALsABv//AF0AAAUYBbACBgC0AAD//wBf/ikFQwQ6AgYAyAAA//8AFwAABNoHRwImARQAAAAHAKcENwFZ////+QAABAsGHwImARUAAAAHAKcD0gAx//8AYP5LCGwETgAmAFEAAAAHAFsEiAAA//8Agv5LCXQFxQAmADEAAAAHAFsFkAAA//8AUf5RBGcFxQImANYAAAAHAZwBnP+4//8AWP5SA6wETAImAOoAAAAHAZwBQ/+5//8Ag/5RBMkFxQImACUAAAAHAZwB7v+4//8AYf5RA/IETgImAEUAAAAHAZwBWP+4//8AHgAABNMFsAIGADsAAP//AC7+YAPfBDoCBgC4AAD//wDDAAABfAWwAgYAKwAA//8AGwAABygHTAImANUAAAAHAJwB+AGc//8AFQAABgQF9QImAOkAAAAHAJwBjQBF//8AwwAAAXwFsAIGACsAAP//ACcAAAUiB0wCJgAjAAAABwCcAPsBnP//AHL/7APsBgoCJgBDAAAABgCcfVoAAP//ACcAAAUiBwwCJgAjAAAABwBoAKoBXP//AHL/7APsBcoCJgBDAAAABgBoLBoAAP////IAAAdXBbACBgB/AAD//wA9/+sGfAROAgYAhAAA//8AtgAABHUHTAImACcAAAAHAJwAxwGc//8AYv/sA+kGCwImAEcAAAAHAJwAggBb//8AX//rBRAG3gImAUEAAAAHAGgAfQEu//8AYv/sA+kETwIGAJkAAP//AGL/7APpBcsCJgCZAAAABgBoMRsAAP//ABsAAAcoBwwCJgDVAAAABwBoAacBXP//ABUAAAYEBbUCJgDpAAAABwBoATwABf//AFH/6wRnByECJgDWAAAABwBoAGEBcf//AFj/7QOsBckCJgDqAAAABgBoCBkAAP//ALYAAAT+BvoCJgDXAAAABwBuAQQBSv//AJwAAAQBBaQCJgDrAAAABgBudfQAAP//ALYAAAT+BwwCJgDXAAAABwBoAOABXP//AJwAAAQBBbUCJgDrAAAABgBoUQUAAP//AIL/6wUNByECJgAxAAAABwBoAMoBcf//AGD/7AQnBcoCJgBRAAAABgBoSRoAAP//AHP/6wT+BcUCBgESAAD//wBg/+wEJwROAgYBEwAA//8Ac//rBP4HBwImARIAAAAHAGgA0gFX//8AYP/sBCcF5gImARMAAAAGAGgyNgAA//8Asf/sBPYHIgImAOIAAAAHAGgAtwFy//8AZP/rA+AFygImAPoAAAAGAGgmGgAA//8AUf/rBMgG+gImANkAAAAHAG4ArQFK//8AG/5LA+QFpAImAFsAAAAGAG4p9AAA//8AUf/rBMgHDAImANkAAAAHAGgAiQFc//8AG/5LA+QFtQImAFsAAAAGAGgFBQAA//8AUf/rBMgHSwImANkAAAAHAKEBNgFd//8AG/5LA/oF9AImAFsAAAAHAKEAsgAG//8AlwAABMQHDAImANwAAAAHAGgAswFc//8AZwAAA70FtQImAPQAAAAGAGgOBQAA//8AtQAABjUHDAAmAOEPAAAnACsEuQAAAAcAaAF9AVz//wCdAAAFfwW1ACYA+QAAACcAigQqAAAABwBoARcABf//AEH+SwUXBbACJgA6AAAABwGaA7AAAP//AC7+SwQfBDoCJgBaAAAABwGaArgAAP//AGT/7APwBhgCBgBGAAD//wAw/ksFrAWwAiYA2AAAAAcBmgRFAAD//wAo/ksEuwQ6AiYA7QAAAAcBmgNUAAD//wAn/rEFIgWwAiYAIwAAAAcAqAUBAAD//wBy/rED7AROAiYAQwAAAAcAqARQAAD//wAnAAAFIgfGAiYAIwAAAAcApgT1AVP//wBy/+wD7AaEAiYAQwAAAAcApgR3ABH//wAnAAAFIgeoAiYAIwAAAAcBowDKARb//wBy/+wEpAZnAiYAQwAAAAYBo0zVAAD//wAnAAAFIgelAiYAIwAAAAcBogDOASX///+u/+wD7AZkAiYAQwAAAAYBolDkAAD//wAnAAAFIgfbAiYAIwAAAAcBoQDPAQ3//wBy/+wEPQaaAiYAQwAAAAYBoVHMAAD//wAnAAAFIgflAiYAIwAAAAcBoADOARP//wBy/+wD7AakAiYAQwAAAAYBoFDSAAD//wAn/rEFIgdGAiYAIwAAACcAmgDQAV0ABwCoBQEAAP//AHL+sQPsBgQCJgBDAAAAJgCaUhsABwCoBFAAAAAA//8AJwAABSIH3QImACMAAAAHAZ8A8QFU//8Acv/sA+wGmwImAEMAAAAGAZ9zEgAA//8AJwAABSIH4AImACMAAAAHAaQA9QFn//8Acv/sA+wGngImAEMAAAAGAaR3JQAA//8AJwAABSIISwImACMAAAAHAZ4A9QFJ//8Acv/sA+wHCQImAEMAAAAGAZ53BwAA//8AJwAABSIIHwImACMAAAAHAZ0A9QFR//8Acv/sA+wG3QImAEMAAAAGAZ13DwAA//8AJ/6xBSIHTAImACMAAAAnAJwA+wGcAAcAqAUBAAD//wBy/rED7AYKAiYAQwAAACYAnH1aAAcAqARQAAAAAP//ALb+uwR1BbACJgAnAAAABwCoBMgACv//AGL+sQPpBE4CJgBHAAAABwCoBJIAAP//ALYAAAR1B8YCJgAnAAAABwCmBMEBU///AGL/7APpBoUCJgBHAAAABwCmBHwAEv//ALYAAAR1B1ECJgAnAAAABwCgAJYBYP//AGL/7APpBhACJgBHAAAABgCgUR8AAP//ALYAAATuB6gCJgAnAAAABwGjAJYBFv//AGL/7ASpBmgCJgBHAAAABgGjUdYAAP////gAAAR1B6UCJgAnAAAABwGiAJoBJf///7P/7APpBmUCJgBHAAAABgGiVeUAAP//ALYAAASHB9sCJgAnAAAABwGhAJsBDf//AGL/7ARCBpsCJgBHAAAABgGhVs0AAP//ALYAAAR1B+UCJgAnAAAABwGgAJoBE///AGL/7APpBqUCJgBHAAAABgGgVdMAAP//ALb+uwR1B0YCJgAnAAAAJwCaAJwBXQAHAKgEyAAK//8AYv6xA+kGBQImAEcAAAAmAJpXHAAHAKgEkgAAAAD//wDDAAACAQfGAiYAKwAAAAcApgNtAVP//wCbAAAB2gZwAiYAigAAAAcApgNG//3//wC3/rkBhgWwAiYAKwAAAAcAqAN0AAj//wCW/rsBZQYYAiYASwAAAAcAqANTAAr//wCC/qkFDQXFAiYAMQAAAAcAqAUd//j//wBg/qgEJwROAiYAUQAAAAcAqASb//f//wCC/+sFDQfbAiYAMQAAAAcApgUVAWj//wBg/+wEJwaEAiYAUQAAAAcApgSUABH//wCC/+sFQge9AiYAMQAAAAcBowDqASv//wBg/+wEwQZnAiYAUQAAAAYBo2nVAAD//wBM/+sFDQe6AiYAMQAAAAcBogDuATr////L/+wEJwZkAiYAUQAAAAYBom3kAAD//wCC/+sFDQfwAiYAMQAAAAcBoQDvASL//wBg/+wEWgaaAiYAUQAAAAYBoW7MAAD//wCC/+sFDQf6AiYAMQAAAAcBoADuASj//wBg/+wEJwakAiYAUQAAAAYBoG3SAAD//wCC/qkFDQdbAiYAMQAAACcAmgDwAXIABwCoBR3/+P//AGD+qAQnBgQCJgBRAAAAJgCabxsABwCoBJv/9wAA//8Acf/rBZ0HDwImAJQAAAAHAHMB5gFJ//8AYP/sBLoF3QImAJUAAAAHAHMBbQAX//8Acf/rBZ0HEgImAJQAAAAHAEIBLAFN//8AYP/sBLoF4AImAJUAAAAHAEIAswAb//8Acf/rBZ0HtgImAJQAAAAHAKYFDQFD//8AYP/sBLoGhAImAJUAAAAHAKYElAAR//8Acf/rBZ0HQQImAJQAAAAHAKAA4gFQ//8AYP/sBLoGDwImAJUAAAAGAKBpHgAA//8Acf6xBZ0GNgImAJQAAAAHAKgFCQAA//8AYP6oBLoEsAImAJUAAAAHAKgEm//3//8Alv6qBNcFsAImADcAAAAHAKgFDP/5//8Ajf6xA/YEOgImAFcAAAAHAKgEVwAA//8Alv/rBNcHxgImADcAAAAHAKYFBwFT//8Ajf/sA/YGcAImAFcAAAAHAKYEkv/9//8Alv/rBiYHHwImAJYAAAAHAHMB3QFZ//8Ajf/sBRAFyAImAJcAAAAHAHMBawAC//8Alv/rBiYHIgImAJYAAAAHAEIBIwFd//8Ajf/sBRAFywImAJcAAAAHAEIAsQAG//8Alv/rBiYHxgImAJYAAAAHAKYFBAFT//8Ajf/sBRAGcAImAJcAAAAHAKYEkv/9//8Alv/rBiYHUQImAJYAAAAHAKAA2QFg//8Ajf/sBRAF+gImAJcAAAAGAKBnCQAA//8Alv6pBiYGDQImAJYAAAAHAKgFCf/4//8Ajf6xBRAEkQImAJcAAAAHAKgEVwAA//8AHv67BNMFsAImADsAAAAHAKgEzgAK//8AG/4UA+QEOgImAFsAAAAHAKgFIv9j//8AHgAABNMHxAImADsAAAAHAKYExwFR//8AG/5LA+QGcAImAFsAAAAHAKYEUP/9//8AHgAABNMHTwImADsAAAAHAKAAnAFe//8AG/5LA+QF+gImAFsAAAAGAKAlCQAAAAIAZP/sBLEGGAAaACgAAAEjESMnDgEjIgI9ARASMzIWFzcRITUhNTMVMwEUFjMyNjcRLgEjIgYVBLHBoRA2mGnJ29rMZJI0A/7+AQK5wfxsh5JeeikofFuTiATS+y6HTk0BGu8VAQoBOkhGAQERlbGx/I6qxVJMAfZIUurAAAD//wBk/u4EsQYYACYARgAAACcB0wGmAkYABwBBAKP/g///ALb+mQVbBbACJgAtAAAABwGcBDoAAP//AJz+mQRpBDoCJgDsAAAABwGcA0gAAP//ALb+mQWHBbACJgAqAAAABwGcBGYAAP//AJz+mQSKBDoCJgDvAAAABwGcA2kAAP//ADv+mQSKBbACJgA2AAAABwGcAigAAP//ACj+mQOwBDoCJgDxAAAABwGcAa4AAP//AEH+mQTpBbACJgA6AAAABwGcA8gAAP//AC7+mQPxBDoCJgBaAAAABwGcAtAAAP//AJf+mQVOBbACJgDcAAAABwGcBC0AAP//AGf+mQRGBDsCJgD0AAAABwGcAyUAAP//AJf+mQTEBbACJgDcAAAABwGcAxkAAP//AGf+mQO9BDsCJgD0AAAABwGcAhAAAP//ALX+mQQwBbACJgCsAAAABwGcANcAAP//AJr+mQNHBDoCJgDnAAAABwGcAJ4AAP//ABv+mQdqBbACJgDVAAAABwGcBkkAAP//ABX+mQYlBDoCJgDpAAAABwGcBQQAAP//AEf+VAXABcMCJgE7AAAABwGcAwb/u////+P+WARZBE4CJgE8AAAABwGcAgH/v///AJEAAAP6BhgCBgBKAAAAAv/UAAAEsQWwABIAGwAAASMVITIWFRQGIyERIzUzNTMVMwMRITI2NTQmIwJQ8QFo7vz97f3f0tK58fEBaJyUlJwEUPjhx8joBFCVy8v93v3Sn355mAAAAAL/1AAABLEFsAASABsAAAEjFSEyFhUUBiMhESM1MzUzFTMDESEyNjU0JiMCUPEBaO78/e3939LSufHxAWiclJScBFD44cfI6ARQlcvL/d790p9+eZgAAAABAAMAAAQwBbAADQAAASERIxEjNTMRIRUhESECf/7vubKyA3v9PgERAqz9VAKslQJvlv4nAAAAAAH//AAAA0cEOgANAAABIREjESM1MxEhFSERIQJ4/ty6np4Crf4NASQB3/4hAd+VAcaX/tEAAAAAAf/1AAAFMAWwABQAAAEjESMRIzUzNTMVMxUjETMBMwkBIwIzsLnV1bnu7p8CEdT9wwJm4wKU/WwEhZWWlpX+pAKH/T79EgAAAf/YAAAEKAYYABQAAAEjESMRIzUzNTMVMxUjETMBMwkBIwHhgbrOzrr09H4BO9v+hgGu2wH2/goEwZXCwpX9zAGt/hP9swD//wC2/ooFtwdMAiYA1wAAACcAnAExAZwABwAOBIP/vv//AJz+igS6BfUCJgDrAAAAJwCcAKIARQAHAA4Dhv++//8Atv6KBbYFsAImACoAAAAHAA4Egv++//8AnP6KBLkEOgImAO8AAAAHAA4Dhf++//8Atv6KBwYFsAImAC8AAAAHAA4F0v++//8Anf6KBgsEOgImAO4AAAAHAA4E1/++//8AMP6KBa0FsAImANgAAAAHAA4Eef++//8AKP6KBLwEOgImAO0AAAAHAA4DiP++AAEAHgAABNMFsAAQAAAJATMBMxUjBxEjEScjNTMBMwJ4AYfU/ld+zwi4Aeya/ljUAr4C8vz2lQ/9/gIPApUDCgABAC7+YAPfBDoAEQAABSMRIxEjNTMBMwEXMzcBMwEzA0rmutzB/p+9AQcWAxcBAL3+oskM/mwBlJUDsf0AXl4DAPxPAAEAQQAABNAFsAARAAABIwEjCQEjASM1MwEzCQEzATMDzbABs9z+lv6X4AGyopX+Zt4BXAFg3/5lowKe/WICSP24Ap6VAn39wwI9/YMAAAAAAQAuAAADzwQ6ABEAAAEjASMLASMBIzUzATMbATMBMwM+rwFA1fr62AFBraL+1dbt8Nj+1qQB4f4fAZ7+YgHhlQHE/m0Bk/48AAAA//8AY//tA+wETAIGALoAAP//ABsAAARzBbACJgAoAAAABwHT/4z+fv//ALsCjAXzAyEARgGGrwBmZkAAAAIAqQAAAWYFsAADAAcAAAEjETMTIzUzAWS5uQK9vQHeA9L6UMgAAAAAAAAAAAAAAAAAGgBSAJIA6AFAAVABcgGWAboB0gHoAfYCAgIQAkACUAJ6ArQC1AMGA0YDZAOuA/AD/AQIBCAENARMBHwE8AUMBUIFdAWaBbQFygYABhgGJAZABlwGbAaQBqgG3gcCB0AHeAeyB8YH5gf+CCoISghiCHgIjAiaCKwIxAjSCOAJHglUCYAJtAnmCgoKTgpyCoQKqArECtALCgsuC1wLkgvGC+YMHgxEDGgMgAyqDMgM8g0IDTgNRg10DZ4Nsg3mDhoOZg6QDqQPCA8cD3IPsg++D84QMhBAEGYQhhCwEOoQ+BEgETYRRBFgEXIRnBGoEboRzBHeEg4SOBJaEqwS0hMME2gTthPQFBwUUhR8FIgUpBTAFNgVAhU2FXQVyBXkFhoWXBaWFsAW7hcMF0AXVBdoF4IXkBe2F9gX+BgOGDQYQhhQGFoYeBiOGJwYqhjEGMwY3hj0GTAZRhliGXQZkhnQGfoaNBp4Grga1BscG1YbjhuyG+ocCBw+HIgcsBzkHRgdTh1yHZgd1h4IHkgehB7AHwYfNB9qH6If0h/6IBIgOiBmIJIgziDmIQYhLiFwIYghqiHEIeQiDCI2IloijiLMIvYjOCNuI4AjqiPWJBAkKCREJGYkhCScJK4kwiUcJTQlViVwJZAluCXkJggmNiZuJpgm1icGJzwnbCeaJ7Qn5igYKEYohCi8KN4pBCkyKWIpoCnUKhwqXCqsKvorNitqK44rtiv4LDQslCz0LTItcC2cLcQt8C4ELiIuMi5CLtwvNC9iL44vzC/iL/gwIDBIMG4wlDC0MNQw8DEMMTYxYDG2MggyJjJEMm4yljK4MvozNjNgM4gzsDPYNBA0PDRoNHg0iDSsNOI1NjV6NcA2ADZCNnw2tDbqNxw3WDeON7437DgqOCo4KjgqOCo4KjgqOCo4KjgqOCo4KjgqODQ4PjhKOGA4djiMOJg4pDiwONQ47jkSOSo5NjlGOcI51jnsOfo6Gjo8Ong6ujr4O047iDvMO/Y8LDw+PFA8Yjx0PK48wjzgPO49CD1aPYg94D4GPhY+Jj5MPlo+bj6EPq4+rj+IP85AAEAgQFBAbkCKQKxAukDsQRxBPEFqQZJBrEHGQeZB9kISQkhCdkKaQrRCykL8QxRDIEM8Q1hDaEOIQ6JD0EQGRD5EdkSKRKpEwkTqRQpFIkU4RWRFdEWeRdhF+EYiRl5GekbCRv5HDkc2R3BHgEewR+xIBkhOSIpItEjCSPBJEElKSWpJnEncSkpKaEqmSvBLKEtuS5RL0kv+TBxMOkxWTHJMtEzYTOBM6EzwTSBNUE1+TZpNyE3UTeBN7E34TgROEE4cTihONE5ATkxOWE5kTnBOfE6ITpROoE6sTrhOxE7QTtxO6E70TwBPDE8YTyRPME88T0hPVE9gT2xPeE+ET5BPnE+oT7RPwE/MT9hP5E/wT/xQCFAUUCBQLFA4UERQUFBcUGhQdFCAUIxQwFEYUSRRMFE8UUhRVFFgUWxReFGEUZBRnFGoUbRRwFHMUdhSDFJYUmRScFJ8UohSlFKgUqxSuFLEUtBS3FLoUvRTAFMMUxhTJFMwUzxTSFNUU2BTbFN4U4RTkFOcU6hTtFPAU8xT2FPkU/BT/FQIVBRUIFQsVDhURFRQVFxUaFR0VIBUjFSYVKRUsFS8VMhU1FTgVOxU+FUEVRBVHFUoVTRVQFVMVVhVZFVwVXxViFWUVaBVrFW4VcRV0FXcVehV9FYAVgxWGFZUVpBWnFaoVrRWwFbMVthW5FbwVvxXCFcUVyBXLFc4V0RXUFdcV2hXdFeAV4xXmFekV7BXvFfIV9RX4FfsV/hYBFgQWBxYKFg0WEBYTFhYWGRYcFh8WIhYlFigWKxYuFjEWPhZBFkQWRxZKFk0WUBZTFlYWYxZmFmkWbBZvFnIWdRZ4FnsWfhaBFoQWhxaKFo0WkBaTFpYWmRacFp8WohalFqgWqxauFrEWtBa3FroWvRbAFsMWxhbJFswWzxbSFuEW5BbnFuoW7RbwFvMW9hb5FvwW/xcCFwUXCBcLFw4XEBcSFxQXFhcYFxoXHBceFyAXIhckFyYXKBcqFy0XMBczFzYXORc8Fz8XQRdDF0UXRxdJF0wXTxdSF1UXWBdbF14XbJdul3GXc5d1l3iXe5d9l3+XgZeDl4aXiJeKl4yXjpeQl5KXlJeWl5iXmpedl5+XoZesl66XsJezl7aXuJe6l72Xv5fCl8WXyJfLl86X0ZfUl9eX2pfdl9+X4Zfkl+eX6pfsl++X8pf1l/iX+5f+mAKYBZgImAuYDpgQmBKYFZgYmBuYHpghmCSYJ5gqmCyYLpgwmDOYNpg4mDuYPphBmESYRphImEuYTphRmFOYVphZmFyYX5himGWYaJhrmG6YcZh0mHaYeJh7mH6YgZiEmIeYipiNmJCYk5iWmJmYnJigmKSYp5iqmKyYr5iymLWYuJi7mL6YwZjEmMeYypjNmNCY05jWmNqY3pjhmOSY55jqmO2Y8JjzmPaY+pj+mQGZBJkHmQqZDZkQmROZFpkZmRyZH5kimSWZKJksmTCZM5k2mTmZPJk/mUKZRZlImUuZTplRmVSZV5lamV2ZYJlkmWiZa5lumXGZdJl3mXqZfZmAmYOZhpmJmYyZj5mSmZWZmJmbmZ6ZoZmkmaeZqpmtmbCZs5m2mbmZvJm/mcKZ0pnWmdmZ3JnfmeKZ5ZnomeuZ7pnxmfSZ95n6mf2aAJoDmgaaCZoMmg6aGZokmiuaMpo7mkSaSJpMmk+aUppVmliaW5pemmaabxp5GoKahJqHmooaihqPAAAAAAAGwFKAAEAAAAAAAAAHwAAAAEAAAAAAAEABgAfAAEAAAAAAAIABwAlAAEAAAAAAAMAEgAsAAEAAAAAAAQADgA+AAEAAAAAAAUAFgBMAAEAAAAAAAYADgBiAAEAAAAAAAcAIABwAAEAAAAAAAkABgCQAAEAAAAAAAsACgCWAAEAAAAAAAwAEwCgAAEAAAAAAA0ALgCzAAEAAAAAAA4AKgDhAAEAAAAAABIADgELAAMAAQQJAAAAPgEZAAMAAQQJAAEADAFXAAMAAQQJAAIADgFjAAMAAQQJAAMAJAFxAAMAAQQJAAQAHAGVAAMAAQQJAAUALAGxAAMAAQQJAAYAHAHdAAMAAQQJAAcAQAH5AAMAAQQJAAkADAI5AAMAAQQJAAsAFAJFAAMAAQQJAAwAJgJZAAMAAQQJAA0AXAJ/AAMAAQQJAA4AVALbRm9udCBkYXRhIGNvcHlyaWdodCBHb29nbGUgMjAxM1JvYm90b1JlZ3VsYXJHb29nbGU6Um9ib3RvOjIwMTNSb2JvdG8gUmVndWxhclZlcnNpb24gMS4yMDAzMTA7IDIwMTNSb2JvdG8tUmVndWxhclJvYm90byBpcyBhIHRyYWRlbWFyayBvZiBHb29nbGUuR29vZ2xlR29vZ2xlLmNvbUNocmlzdGlhbiBSb2JlcnRzb25MaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4waHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wUm9ib3RvIFJlZ3VsYXIARgBvAG4AdAAgAGQAYQB0AGEAIABjAG8AcAB5AHIAaQBnAGgAdAAgAEcAbwBvAGcAbABlACAAMgAwADEAMwBSAG8AYgBvAHQAbwBSAGUAZwB1AGwAYQByAEcAbwBvAGcAbABlADoAUgBvAGIAbwB0AG8AOgAyADAAMQAzAFIAbwBiAG8AdABvACAAUgBlAGcAdQBsAGEAcgBWAGUAcgBzAGkAbwBuACAAMQAuADIAMAAwADMAMQAwADsAIAAyADAAMQAzAFIAbwBiAG8AdABvAC0AUgBlAGcAdQBsAGEAcgBSAG8AYgBvAHQAbwAgAGkAcwAgAGEAIAB0AHIAYQBkAGUAbQBhAHIAawAgAG8AZgAgAEcAbwBvAGcAbABlAC4ARwBvAG8AZwBsAGUARwBvAG8AZwBsAGUALgBjAG8AbQBDAGgAcgBpAHMAdABpAGEAbgAgAFIAbwBiAGUAcgB0AHMAbwBuAEwAaQBjAGUAbgBzAGUAZAAgAHUAbgBkAGUAcgAgAHQAaABlACAAQQBwAGEAYwBoAGUAIABMAGkAYwBlAG4AcwBlACwAIABWAGUAcgBzAGkAbwBuACAAMgAuADAAaAB0AHQAcAA6AC8ALwB3AHcAdwAuAGEAcABhAGMAaABlAC4AbwByAGcALwBsAGkAYwBlAG4AcwBlAHMALwBMAEkAQwBFAE4AUwBFAC0AMgAuADAAAAAAAgAAAAAAAP9qAGQAAAAAAAAAAAAAAAAAAAAAAAAAAAQcAAABAgACAAMABQAGAAcACAAJAAoACwAMAA0ADgAPABAAEQASABMAFAAVABYAFwAYABkAGgAbABwAHQAeAB8AIAAhACIAIwAkACUAJgAnACgAKQAqACsALAAtAC4ALwAwADEAMgAzADQANQA2ADcAOAA5ADoAOwA8AD0APgA/AEAAQQBCAEMARABFAEYARwBIAEkASgBLAEwATQBOAE8AUABRAFIAUwBUAFUAVgBXAFgAWQBaAFsAXABdAF4AXwBgAGEAowCEAIUAvQCWAOgAhgCOAIsAnQCpAKQAigEDAIMAkwDyAPMAjQCXAIgBBADeAPEAngCqAPUA9AD2AKIAkADwAJEA7QCJAKAA6gC4AKEA7gEFANcBBgDiAOMBBwEIALAAsQEJAKYBCgELAQwBDQEOAQ8A2ADhANsA3ADdAOAA2QDfARABEQESARMBFAEVARYBFwEYARkBGgEbARwBHQEeAR8BIAEhASIAnwEjASQBJQEmAScBKAEpASoBKwEsAS0AmwEuAS8BMAExATIBMwE0ATUBNgE3ATgBOQE6ATsBPAE9AT4BPwFAAUEBQgFDAUQBRQFGAUcBSAFJAUoBSwFMAU0BTgFPAVABUQFSAVMBVAFVAVYBVwFYAVkBWgFbAVwBXQFeAV8BYAFhAWIBYwFkAWUBZgFnAWgBaQFqAWsBbAFtAW4BbwFwAXEBcgFzAXQBdQF2AXcBeAF5AXoBewF8AX0BfgF/AYABgQGCAYMBhAGFAYYBhwGIAYkBigGLAYwBjQGOAY8BkAGRAZIBkwGUAZUBlgGXAZgBmQGaAZsBnAGdAZ4BnwGgAaEBogGjAaQBpQGmAacBqAGpAaoBqwGsAa0BrgGvAbABsQGyAbMBtAG1AbYBtwG4AbkBugG7AbwBvQG+Ab8BwAHBAcIBwwHEAcUBxgHHAcgByQHKAcsBzAHNALIAswHOALYAtwDEAc8AtAC1AMUAggDCAIcB0ACrAMYAvgC/ALwB0QHSAdMB1AHVAdYB1wHYAIwB2QHaAdsB3AHdAJgAmgCZAO8ApQCSAJwApwCPAJQAlQC5Ad4B3wHgAMAB4QHiAeMB5AHlAeYB5wHoAekB6gHrAewB7QHuAe8B8AHxAfIB8wH0AfUB9gH3AfgB+QH6AfsB/AH9Af4B/wIAAgECAgIDAgQCBQIGAgcCCAIJAgoCCwIMAg0CDgIPAhACEQISAhMCFAIVAhYCFwIYAhkCGgIbAhwCHQIeAh8CIAIhAiICIwIkAiUCJgInAigCKQIqAisCLAItAi4CLwIwAjECMgIzAjQCNQI2AjcArAI4AjkA6QI6AjsCPACtAMkAxwCuAGIAYwI9AGQAywBlAMgAygDPAMwAzQDOAGYA0wDQANEArwBnANYA1ADVAGgA6wBqAGkAawBtAGwAbgI+AG8AcQBwAHIAcwB1AHQAdgB3AHgAegB5AHsAfQB8AH8AfgCAAIEA7AC6Aj8CQAJBAkICQwJEAP0A/gJFAkYCRwJIAP8BAAJJAkoCSwJMAk0CTgJPAlACUQJSAlMCVAJVAlYA+AD5AlcCWAJZAloCWwJcAl0CXgJfAmACYQJiAmMCZAJlAmYCZwJoAmkCagJrAmwCbQJuAm8CcAJxAnICcwJ0AnUCdgJ3AngCeQJ6AnsCfAJ9An4CfwKAAoECggKDAoQChQKGAocCiAKJAooA+wD8AosCjADkAOUCjQKOAo8CkAKRApICkwKUApUClgKXApgCmQKaApsCnAKdAp4CnwKgAqECogC7AqMCpAKlAqYA5gDnAqcCqAKpAqoCqwKsAq0CrgKvArACsQKyArMCtAK1ArYCtwK4ArkCugK7ArwCvQK+Ar8CwALBAsICwwLEAsUCxgLHAsgCyQLKAssCzALNAs4CzwLQAtEC0gLTAtQC1QLWAtcC2ALZAtoC2wLcAt0C3gLfAuAC4QLiAuMC5ALlAuYC5wLoAukC6gLrAuwC7QLuAu8C8ALxAvIC8wL0AvUC9gL3AvgC+QL6AvsC/AL9Av4C/wMAAwEDAgMDAwQDBQMGAwcDCAMJAwoDCwMMAw0DDgMPAxADEQMSAxMDFAMVAxYDFwMYAxkDGgMbAxwDHQMeAx8DIAMhAyIDIwMkAyUDJgMnAygDKQMqAysDLAMtAy4DLwMwAzEDMgMzAzQDNQM2AzcDOAM5AzoDOwM8Az0DPgM/A0ADQQNCA0MDRANFA0YDRwNIA0kDSgNLA0wDTQNOA08DUANRA1IDUwNUA1UDVgNXA1gDWQNaA1sDXANdA14DXwNgA2EDYgNjA2QDZQNmA2cDaANpA2oDawNsA20DbgNvA3ADcQNyA3MDdAN1A3YDdwN4A3kDegN7A3wDfQN+A38DgAOBA4IDgwOEA4UDhgOHA4gDiQOKA4sDjAONA44DjwOQA5EDkgOTA5QDlQOWA5cDmAOZA5oDmwOcA50DngOfA6ADoQOiA6MDpAOlA6YDpwOoA6kDqgOrA6wDrQOuA68DsAOxA7IDswO0A7UDtgO3A7gDuQO6A7sDvAO9A74DvwPAA8EDwgPDA8QDxQPGA8cDyAPJA8oDywPMA80DzgPPA9AD0QPSA9MD1APVA9YD1wPYA9kD2gPbA9wD3QPeA98D4APhA+ID4wPkA+UD5gPnA+gD6QPqA+sD7APtA+4D7wPwA/ED8gPzA/QD9QP2A/cD+AP5A/oD+wP8A/0D/gP/BAAEAQQCBAMEBAQFBAYEBwQIBAkECgQLBAwEDQQOBA8EEAQRBBIEEwQUBBUEFgQXBBgEGQQaBBsEHAQdBB4EHwQgBCEA9wQiBCMABAd1bmkwMDA5Bm1hY3Jvbg5wZXJpb2RjZW50ZXJlZARIYmFyDGtncmVlbmxhbmRpYwNFbmcDZW5nBWxvbmdzBU9ob3JuBW9ob3JuBVVob3JuBXVob3JuB3VuaTAyMzcFc2Nod2EHdW5pMDJGMwlncmF2ZWNvbWIJYWN1dGVjb21iCXRpbGRlY29tYgRob29rB3VuaTAzMEYIZG90YmVsb3cFdG9ub3MNZGllcmVzaXN0b25vcwlhbm90ZWxlaWEFR2FtbWEFRGVsdGEFVGhldGEGTGFtYmRhAlhpAlBpBVNpZ21hA1BoaQNQc2kFYWxwaGEEYmV0YQVnYW1tYQVkZWx0YQdlcHNpbG9uBHpldGEDZXRhBXRoZXRhBGlvdGEGbGFtYmRhAnhpA3JobwZzaWdtYTEFc2lnbWEDdGF1B3Vwc2lsb24DcGhpA3BzaQVvbWVnYQd1bmkwM0QxB3VuaTAzRDIHdW5pMDNENgd1bmkwNDAyB3VuaTA0MDQHdW5pMDQwOQd1bmkwNDBBB3VuaTA0MEIHdW5pMDQwRgd1bmkwNDExB3VuaTA0MTQHdW5pMDQxNgd1bmkwNDE3B3VuaTA0MTgHdW5pMDQxQgd1bmkwNDIzB3VuaTA0MjQHdW5pMDQyNgd1bmkwNDI3B3VuaTA0MjgHdW5pMDQyOQd1bmkwNDJBB3VuaTA0MkIHdW5pMDQyQwd1bmkwNDJEB3VuaTA0MkUHdW5pMDQyRgd1bmkwNDMxB3VuaTA0MzIHdW5pMDQzMwd1bmkwNDM0B3VuaTA0MzYHdW5pMDQzNwd1bmkwNDM4B3VuaTA0M0EHdW5pMDQzQgd1bmkwNDNDB3VuaTA0M0QHdW5pMDQzRgd1bmkwNDQyB3VuaTA0NDQHdW5pMDQ0Ngd1bmkwNDQ3B3VuaTA0NDgHdW5pMDQ0OQd1bmkwNDRBB3VuaTA0NEIHdW5pMDQ0Qwd1bmkwNDREB3VuaTA0NEUHdW5pMDQ0Rgd1bmkwNDUyB3VuaTA0NTQHdW5pMDQ1OQd1bmkwNDVBB3VuaTA0NUIHdW5pMDQ1Rgd1bmkwNDYwB3VuaTA0NjEHdW5pMDQ2Mwd1bmkwNDY0B3VuaTA0NjUHdW5pMDQ2Ngd1bmkwNDY3B3VuaTA0NjgHdW5pMDQ2OQd1bmkwNDZBB3VuaTA0NkIHdW5pMDQ2Qwd1bmkwNDZEB3VuaTA0NkUHdW5pMDQ2Rgd1bmkwNDcyB3VuaTA0NzMHdW5pMDQ3NAd1bmkwNDc1B3VuaTA0N0EHdW5pMDQ3Qgd1bmkwNDdDB3VuaTA0N0QHdW5pMDQ3RQd1bmkwNDdGB3VuaTA0ODAHdW5pMDQ4MQd1bmkwNDgyB3VuaTA0ODMHdW5pMDQ4NAd1bmkwNDg1B3VuaTA0ODYHdW5pMDQ4OAd1bmkwNDg5B3VuaTA0OEQHdW5pMDQ4RQd1bmkwNDhGB3VuaTA0OTAHdW5pMDQ5MQd1bmkwNDk0B3VuaTA0OTUHdW5pMDQ5Qwd1bmkwNDlEB3VuaTA0QTAHdW5pMDRBMQd1bmkwNEE0B3VuaTA0QTUHdW5pMDRBNgd1bmkwNEE3B3VuaTA0QTgHdW5pMDRBOQd1bmkwNEI0B3VuaTA0QjUHdW5pMDRCOAd1bmkwNEI5B3VuaTA0QkEHdW5pMDRCQwd1bmkwNEJEB3VuaTA0QzMHdW5pMDRDNAd1bmkwNEM3B3VuaTA0QzgHdW5pMDREOAd1bmkwNEUwB3VuaTA0RTEHdW5pMDRGQQd1bmkwNEZCB3VuaTA1MDAHdW5pMDUwMgd1bmkwNTAzB3VuaTA1MDQHdW5pMDUwNQd1bmkwNTA2B3VuaTA1MDcHdW5pMDUwOAd1bmkwNTA5B3VuaTA1MEEHdW5pMDUwQgd1bmkwNTBDB3VuaTA1MEQHdW5pMDUwRQd1bmkwNTBGB3VuaTA1MTAHdW5pMjAwMAd1bmkyMDAxB3VuaTIwMDIHdW5pMjAwMwd1bmkyMDA0B3VuaTIwMDUHdW5pMjAwNgd1bmkyMDA3B3VuaTIwMDgHdW5pMjAwOQd1bmkyMDBBB3VuaTIwMEINdW5kZXJzY29yZWRibA1xdW90ZXJldmVyc2VkB3VuaTIwMjUHdW5pMjA3NAluc3VwZXJpb3IEbGlyYQZwZXNldGEERXVybwd1bmkyMTA1B3VuaTIxMTMHdW5pMjExNgllc3RpbWF0ZWQJb25lZWlnaHRoDHRocmVlZWlnaHRocwtmaXZlZWlnaHRocwxzZXZlbmVpZ2h0aHMKY29sb24ubG51bQlxdW90ZWRibHgLY29tbWFhY2NlbnQHdW5pRkVGRgd1bmlGRkZDB3VuaUZGRkQJZml2ZS5zbWNwCGZvdXIuc3VwCXplcm8ubG51bQ5sYXJnZXJpZ2h0aG9vawxjeXJpbGxpY2hvb2sQY3lyaWxsaWNob29rbGVmdAtjeXJpbGxpY3RpYw5icmV2ZXRpbGRlY29tYg1icmV2ZWhvb2tjb21iDmJyZXZlYWN1dGVjb21iE2NpcmN1bWZsZXh0aWxkZWNvbWISY2lyY3VtZmxleGhvb2tjb21iE2NpcmN1bWZsZXhncmF2ZWNvbWITY2lyY3VtZmxleGFjdXRlY29tYg5icmV2ZWdyYXZlY29tYhFjb21tYWFjY2VudHJvdGF0ZQZBLnNtY3AGQi5zbWNwBkMuc21jcAZELnNtY3AGRS5zbWNwBkYuc21jcAZHLnNtY3AGSC5zbWNwBkkuc21jcAZKLnNtY3AGSy5zbWNwBkwuc21jcAZNLnNtY3AGTi5zbWNwBk8uc21jcAZRLnNtY3AGUi5zbWNwBlMuc21jcAZULnNtY3AGVS5zbWNwBlYuc21jcAZXLnNtY3AGWC5zbWNwBlkuc21jcAZaLnNtY3AJemVyby5zbWNwCG9uZS5zbWNwCHR3by5zbWNwCnRocmVlLnNtY3AJZm91ci5zbWNwCHR3by5sbnVtCHNpeC5zbWNwCnNldmVuLnNtY3AKZWlnaHQuc21jcAluaW5lLnNtY3AHb25lLnN1cAd0d28uc3VwCXRocmVlLnN1cAhvbmUubG51bQhmaXZlLnN1cAdzaXguc3VwCXNldmVuLnN1cAllaWdodC5zdXAIbmluZS5zdXAIemVyby5zdXAIY3Jvc3NiYXIJcmluZ2FjdXRlCWRhc2lhb3hpYQp0aHJlZS5sbnVtCWZvdXIubG51bQlmaXZlLmxudW0Ic2l4LmxudW0FZy5hbHQKc2V2ZW4ubG51bQdjaGkuYWx0CmVpZ2h0LmxudW0JYWxwaGEuYWx0CWRlbHRhLmFsdARELmNuBGEuY24FUi5hbHQFSy5hbHQFay5hbHQGSy5hbHQyBmsuYWx0MgluaW5lLmxudW0GUC5zbWNwDWN5cmlsbGljYnJldmUHdW5pMDBBRAZEY3JvYXQEaGJhcgRUYmFyBHRiYXIKQXJpbmdhY3V0ZQphcmluZ2FjdXRlB0FtYWNyb24HYW1hY3JvbgZBYnJldmUGYWJyZXZlB0FvZ29uZWsHYW9nb25lawtDY2lyY3VtZmxleAtjY2lyY3VtZmxleAd1bmkwMTBBB3VuaTAxMEIGRGNhcm9uBmRjYXJvbgdFbWFjcm9uB2VtYWNyb24GRWJyZXZlBmVicmV2ZQpFZG90YWNjZW50CmVkb3RhY2NlbnQHRW9nb25lawdlb2dvbmVrBkVjYXJvbgZlY2Fyb24LR2NpcmN1bWZsZXgLZ2NpcmN1bWZsZXgHdW5pMDEyMAd1bmkwMTIxDEdjb21tYWFjY2VudAxnY29tbWFhY2NlbnQLSGNpcmN1bWZsZXgLaGNpcmN1bWZsZXgGSXRpbGRlBml0aWxkZQdJbWFjcm9uB2ltYWNyb24GSWJyZXZlBmlicmV2ZQdJb2dvbmVrB2lvZ29uZWsKSWRvdGFjY2VudAJJSgJpagtKY2lyY3VtZmxleAtqY2lyY3VtZmxleAxLY29tbWFhY2NlbnQMa2NvbW1hYWNjZW50BkxhY3V0ZQZsYWN1dGUMTGNvbW1hYWNjZW50DGxjb21tYWFjY2VudAZMY2Fyb24GbGNhcm9uBExkb3QEbGRvdAZOYWN1dGUGbmFjdXRlDE5jb21tYWFjY2VudAxuY29tbWFhY2NlbnQGTmNhcm9uBm5jYXJvbgtuYXBvc3Ryb3BoZQdPbWFjcm9uB29tYWNyb24GT2JyZXZlBm9icmV2ZQ1PaHVuZ2FydW1sYXV0DW9odW5nYXJ1bWxhdXQGUmFjdXRlBnJhY3V0ZQxSY29tbWFhY2NlbnQMcmNvbW1hYWNjZW50BlJjYXJvbgZyY2Fyb24GU2FjdXRlBnNhY3V0ZQtTY2lyY3VtZmxleAtzY2lyY3VtZmxleAd1bmkwMjE4B3VuaTAyMTkHdW5pMDIxQQd1bmkwMjFCB3VuaTAxNjIHdW5pMDE2MwZUY2Fyb24GdGNhcm9uBlV0aWxkZQZ1dGlsZGUHVW1hY3Jvbgd1bWFjcm9uBlVicmV2ZQZ1YnJldmUFVXJpbmcFdXJpbmcNVWh1bmdhcnVtbGF1dA11aHVuZ2FydW1sYXV0B1VvZ29uZWsHdW9nb25lawtXY2lyY3VtZmxleAt3Y2lyY3VtZmxleAtZY2lyY3VtZmxleAt5Y2lyY3VtZmxleAZaYWN1dGUGemFjdXRlClpkb3RhY2NlbnQKemRvdGFjY2VudAdBRWFjdXRlB2FlYWN1dGULT3NsYXNoYWN1dGULb3NsYXNoYWN1dGULRGNyb2F0LnNtY3AIRXRoLnNtY3AJVGJhci5zbWNwC0FncmF2ZS5zbWNwC0FhY3V0ZS5zbWNwEEFjaXJjdW1mbGV4LnNtY3ALQXRpbGRlLnNtY3AOQWRpZXJlc2lzLnNtY3AKQXJpbmcuc21jcA9BcmluZ2FjdXRlLnNtY3ANQ2NlZGlsbGEuc21jcAtFZ3JhdmUuc21jcAtFYWN1dGUuc21jcBBFY2lyY3VtZmxleC5zbWNwDkVkaWVyZXNpcy5zbWNwC0lncmF2ZS5zbWNwC0lhY3V0ZS5zbWNwEEljaXJjdW1mbGV4LnNtY3AOSWRpZXJlc2lzLnNtY3ALTnRpbGRlLnNtY3ALT2dyYXZlLnNtY3ALT2FjdXRlLnNtY3AQT2NpcmN1bWZsZXguc21jcAtPdGlsZGUuc21jcA5PZGllcmVzaXMuc21jcAtVZ3JhdmUuc21jcAtVYWN1dGUuc21jcBBVY2lyY3VtZmxleC5zbWNwDlVkaWVyZXNpcy5zbWNwC1lhY3V0ZS5zbWNwDEFtYWNyb24uc21jcAtBYnJldmUuc21jcAxBb2dvbmVrLnNtY3ALQ2FjdXRlLnNtY3AQQ2NpcmN1bWZsZXguc21jcAx1bmkwMTBBLnNtY3ALQ2Nhcm9uLnNtY3ALRGNhcm9uLnNtY3AMRW1hY3Jvbi5zbWNwC0VicmV2ZS5zbWNwD0Vkb3RhY2NlbnQuc21jcAxFb2dvbmVrLnNtY3ALRWNhcm9uLnNtY3AQR2NpcmN1bWZsZXguc21jcAtHYnJldmUuc21jcAx1bmkwMTIwLnNtY3ARR2NvbW1hYWNjZW50LnNtY3AQSGNpcmN1bWZsZXguc21jcAtJdGlsZGUuc21jcAxJbWFjcm9uLnNtY3ALSWJyZXZlLnNtY3AMSW9nb25lay5zbWNwD0lkb3RhY2NlbnQuc21jcBBKY2lyY3VtZmxleC5zbWNwEUtjb21tYWFjY2VudC5zbWNwC0xhY3V0ZS5zbWNwEUxjb21tYWFjY2VudC5zbWNwC0xjYXJvbi5zbWNwCUxkb3Quc21jcAtOYWN1dGUuc21jcBFOY29tbWFhY2NlbnQuc21jcAtOY2Fyb24uc21jcAxPbWFjcm9uLnNtY3ALT2JyZXZlLnNtY3AST2h1bmdhcnVtbGF1dC5zbWNwC1JhY3V0ZS5zbWNwEVJjb21tYWFjY2VudC5zbWNwC1JjYXJvbi5zbWNwC1NhY3V0ZS5zbWNwEFNjaXJjdW1mbGV4LnNtY3ANU2NlZGlsbGEuc21jcAtTY2Fyb24uc21jcBFUY29tbWFhY2NlbnQuc21jcAtUY2Fyb24uc21jcAtVdGlsZGUuc21jcAxVbWFjcm9uLnNtY3ALVWJyZXZlLnNtY3AKVXJpbmcuc21jcBJVaHVuZ2FydW1sYXV0LnNtY3AMVW9nb25lay5zbWNwEFdjaXJjdW1mbGV4LnNtY3AQWWNpcmN1bWZsZXguc21jcA5ZZGllcmVzaXMuc21jcAtaYWN1dGUuc21jcA9aZG90YWNjZW50LnNtY3ALWmNhcm9uLnNtY3APZ2VybWFuZGJscy5zbWNwCkFscGhhdG9ub3MMRXBzaWxvbnRvbm9zCEV0YXRvbm9zCUlvdGF0b25vcwxPbWljcm9udG9ub3MMVXBzaWxvbnRvbm9zCk9tZWdhdG9ub3MRaW90YWRpZXJlc2lzdG9ub3MFQWxwaGEEQmV0YQdFcHNpbG9uBFpldGEDRXRhBElvdGEFS2FwcGECTXUCTnUHT21pY3JvbgNSaG8DVGF1B1Vwc2lsb24DQ2hpDElvdGFkaWVyZXNpcw9VcHNpbG9uZGllcmVzaXMKYWxwaGF0b25vcwxlcHNpbG9udG9ub3MIZXRhdG9ub3MJaW90YXRvbm9zFHVwc2lsb25kaWVyZXNpc3Rvbm9zBWthcHBhB29taWNyb24HdW5pMDNCQwJudQNjaGkMaW90YWRpZXJlc2lzD3Vwc2lsb25kaWVyZXNpcwxvbWljcm9udG9ub3MMdXBzaWxvbnRvbm9zCm9tZWdhdG9ub3MHdW5pMDQwMQd1bmkwNDAzB3VuaTA0MDUHdW5pMDQwNgd1bmkwNDA3B3VuaTA0MDgHdW5pMDQxQQd1bmkwNDBDB3VuaTA0MEUHdW5pMDQxMAd1bmkwNDEyB3VuaTA0MTMHdW5pMDQxNQd1bmkwNDE5B3VuaTA0MUMHdW5pMDQxRAd1bmkwNDFFB3VuaTA0MUYHdW5pMDQyMAd1bmkwNDIxB3VuaTA0MjIHdW5pMDQyNQd1bmkwNDMwB3VuaTA0MzUHdW5pMDQzOQd1bmkwNDNFB3VuaTA0NDAHdW5pMDQ0MQd1bmkwNDQzB3VuaTA0NDUHdW5pMDQ1MQd1bmkwNDUzB3VuaTA0NTUHdW5pMDQ1Ngd1bmkwNDU3B3VuaTA0NTgHdW5pMDQ1Qwd1bmkwNDVFBldncmF2ZQZ3Z3JhdmUGV2FjdXRlBndhY3V0ZQlXZGllcmVzaXMJd2RpZXJlc2lzBllncmF2ZQZ5Z3JhdmUGbWludXRlBnNlY29uZAlleGNsYW1kYmwHdW5pRkIwMgd1bmkwMUYwB3VuaTAyQkMHdW5pMUUzRQd1bmkxRTNGB3VuaTFFMDAHdW5pMUUwMQd1bmkxRjREB3VuaUZCMDMHdW5pRkIwNAd1bmkwNDAwB3VuaTA0MEQHdW5pMDQ1MAd1bmkwNDVEB3VuaTA0NzAHdW5pMDQ3MQd1bmkwNDc2B3VuaTA0NzcHdW5pMDQ3OQd1bmkwNDc4B3VuaTA0OTgHdW5pMDQ5OQd1bmkwNEFBB3VuaTA0QUIHdW5pMDRBRQd1bmkwNEFGB3VuaTA0QzAHdW5pMDRDMQd1bmkwNEMyB3VuaTA0Q0YHdW5pMDREMAd1bmkwNEQxB3VuaTA0RDIHdW5pMDREMwd1bmkwNEQ0B3VuaTA0RDUHdW5pMDRENgd1bmkwNEQ3B3VuaTA0REEHdW5pMDREOQd1bmkwNERCB3VuaTA0REMHdW5pMDRERAd1bmkwNERFB3VuaTA0REYHdW5pMDRFMgd1bmkwNEUzB3VuaTA0RTQHdW5pMDRFNQd1bmkwNEU2B3VuaTA0RTcHdW5pMDRFOAd1bmkwNEU5B3VuaTA0RUEHdW5pMDRFQgd1bmkwNEVDB3VuaTA0RUQHdW5pMDRFRQd1bmkwNEVGB3VuaTA0RjAHdW5pMDRGMQd1bmkwNEYyB3VuaTA0RjMHdW5pMDRGNAd1bmkwNEY1B3VuaTA0RjgHdW5pMDRGOQd1bmkwNEZDB3VuaTA0RkQHdW5pMDUwMQd1bmkwNTEyB3VuaTA1MTMHdW5pMUVBMAd1bmkxRUExB3VuaTFFQTIHdW5pMUVBMwd1bmkxRUE0B3VuaTFFQTUHdW5pMUVBNgd1bmkxRUE3B3VuaTFFQTgHdW5pMUVBOQd1bmkxRUFBB3VuaTFFQUIHdW5pMUVBQwd1bmkxRUFEB3VuaTFFQUUHdW5pMUVBRgd1bmkxRUIwB3VuaTFFQjEHdW5pMUVCMgd1bmkxRUIzB3VuaTFFQjQHdW5pMUVCNQd1bmkxRUI2B3VuaTFFQjcHdW5pMUVCOAd1bmkxRUI5B3VuaTFFQkEHdW5pMUVCQgd1bmkxRUJDB3VuaTFFQkQHdW5pMUVCRQd1bmkxRUJGB3VuaTFFQzAHdW5pMUVDMQd1bmkxRUMyB3VuaTFFQzMHdW5pMUVDNAd1bmkxRUM1B3VuaTFFQzYHdW5pMUVDNwd1bmkxRUM4B3VuaTFFQzkHdW5pMUVDQQd1bmkxRUNCB3VuaTFFQ0MHdW5pMUVDRAd1bmkxRUNFB3VuaTFFQ0YHdW5pMUVEMAd1bmkxRUQxB3VuaTFFRDIHdW5pMUVEMwd1bmkxRUQ0B3VuaTFFRDUHdW5pMUVENgd1bmkxRUQ3B3VuaTFFRDgHdW5pMUVEOQd1bmkxRURBB3VuaTFFREIHdW5pMUVEQwd1bmkxRUREB3VuaTFFREUHdW5pMUVERgd1bmkxRUUwB3VuaTFFRTEHdW5pMUVFMgd1bmkxRUUzB3VuaTFFRTQHdW5pMUVFNQd1bmkxRUU2B3VuaTFFRTcHdW5pMUVFOAd1bmkxRUU5B3VuaTFFRUEHdW5pMUVFQgd1bmkxRUVDB3VuaTFFRUQHdW5pMUVFRQd1bmkxRUVGB3VuaTFFRjAHdW5pMUVGMQd1bmkxRUY0B3VuaTFFRjUHdW5pMUVGNgd1bmkxRUY3B3VuaTFFRjgHdW5pMUVGOQZkY3JvYXQHdW5pMjBBQgd1bmkwNDlBB3VuaTA0OUIHdW5pMDRBMgd1bmkwNEEzB3VuaTA0QUMHdW5pMDRBRAd1bmkwNEIyB3VuaTA0QjMHdW5pMDRCNgd1bmkwNEI3B3VuaTA0Q0IHdW5pMDRDQwd1bmkwNEY2B3VuaTA0RjcHdW5pMDQ5Ngd1bmkwNDk3B3VuaTA0QkUHdW5pMDRCRgd1bmkwNEJCB3VuaTA0OEMHdW5pMDQ2Mgd1bmkwNDkyB3VuaTA0OTMHdW5pMDQ5RQd1bmkwNDlGB3VuaTA0OEEHdW5pMDQ4Qgd1bmkwNEM5B3VuaTA0Q0EHdW5pMDRDRAd1bmkwNENFB3VuaTA0QzUHdW5pMDRDNgd1bmkwNEIwB3VuaTA0QjEHdW5pMDRGRQd1bmkwNEZGB3VuaTA1MTEHdW5pMjAxNQd1bmkwMDAyAAAAAQAAAAwAAAAAAAAAAgAIAMoAygABAR4BJAABAVYBYQABAXYBdgABAXsBfAABAX4BfgABAZMBlQABAdUB1QABAAAAAAAAAAAAAQAAAAoAHgAsAAFERkxUAAgABAAAAAD//wABAAAAAWtlcm4ACAAAAAEAAAABAAQAAgAAAAQADk1oVQZzXAABetgABAAAAa0DZANqA3ADdgPoA/IEBAQqBEAESgRsBI4ElATiBRAFMgVUBXoFoAWmBowGkga4Bt4HQAfSB/QIEggsCDIIQAhGCEwIUgh4CJIIoAi+CMQI4gj8CQIJxAo2ClwKzgrUCt4K5ArqCvALDgscC0YLTAtiC3wLggucC6ILqAveC+QL7gwcDEIMaAyKDKwMzgz8DV4NdA2WDbgOAg4kDkYOeA6eDsQOzg7YDvIPBA8ODygPLg9ED5IPrA/GD9wP/hAgEDoQQBBiEIQQphEYET4RZBGCEZwSXhJoErYTBBMOExQTGhMgEyYTLBNSE1wTYhN0E54TtBPGE9gT/hQEFBoUJBQ2FFwUchR4FH4UmBSeFMQU6hXQFkIWtBcmF5gYChh8GO4ZABkWGSwZQhlYGXoZnBm+GeAaAhooGk4adBqaGsAaxhrMGtIa2BtqG4gbphvEG+IcABweHDwcQhxIHE4cVBxaHIAcphzMHPIdGB02HVQdxh3kHlYedB7mHwQfFh8oHzofTB9yH4gfjh+kH6ofwB/GH9wf4h/4H/4gICAmIEggaiCMIK4g0CDWISQhUiGAIa4h3CH+IgQiJiIsIk4iVCJaIoAipiLMIvIjGCM+I0wjWiNoJE4lNCYaJiAmJiYsJjImOCY+JmQm9icUJ6YnyCfqKAwofiiUKLYo2Cj+KZAqAioMKiIqRCpmKogq1ir4KxorQCtmLEws3i1ALWIt9C36LiAuPi5kLnovPC9eL4Avhi/UMCIwbDDeMOgxqjHAMeIyBDIqMlAyYjNIM6ozyDPOM/Q0DjQsNDI0ODRCNGA0hjSsNNI1ZDWCNYg1jjWUNbY1vDYuNkw2cjaINo42tDbSNuQ3djeUN7Y4GDgeOEA4sjjQOUI5YDl2OXw5gjmIOeo58DoWOjw6Yjp8OsY65DsuO0w7lju0PBY8HDyOPKw9Hj08Pa49zD4+Plw+zj7sP14/fD/uQAxAfkCcQQ5BLEGeQbxCLkJMQr5C3ELyQvhDDkMUQypDMENGQ0xDYkNoQ35DhEOaQ6BDtkO8Q95EAEQmRExEckSYRL5E5EUKRTBFVkV8RaJFyEXuRhRGOkZARkZG2Eb2R4hHpkg4SFZIpEjGSaxKDkoUStZK4EtCS0hLTkt0TDZMhEymTMgAAQBZAAsAAQBZAAsAAQAR/yAAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QAAgEMAAsBU//mAAQAC//mAD//9ABf/+8BPP/tAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAIAVP/mAaf/wAAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAEBp//rABMAWf/BALP/xQDF/7QA5f/XAPH/uQEE/7IBF//SARv/yAEv/6ABOf/FAUH/5AFK/8wBTP/MAVT/ywFV/+8Bqf/oAa3/5gG1/+cBtv/nAAsAWf+kAacAEwGp//MBrf/xAbX/8gG2//EBuf87Abr/2gG7/1QBvP+RAb7/PwAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UACQBWAA4Af/+fAL//3gDC/+UA1P+oAOj/ygFG/+MBp//GAd//9QABAacADgA5AFT/tQBZ/8cAa/64AHr/KAB//00AhP+OAIf/oQCz/64Auv9+AL7/ZwDB/4cAwv9lAMX/ngDH/2oAyP9zAMn/XgDU/6UA4QAPAOX/5ADm/6AA6P90AOr/gADx/7IA+P99APr/gAD8/3kBAv99AQT/fwEX/5gBG//aASf/gQEp/5gBLf99AS//swEz/6ABOf98ATv/mgE8/2wBQf/mAUb/awFK/5IBTP+tAVD/ewFTAA8BVP+RAVX/8gGn/68Bqf+5Aa3/uQG1/7kBtv+5Abj/vAG5//EBvP/xAb3/7QHc/6kB3//JAAEBp//rAAkACwAUAD8AEQBU/+IAXwATAaf/tAGp/9kBrf/ZAbX/2QG2/9kACQALAA8APwAMAFT/6wBfAA4Bp//LAan/6QGt/+cBtf/nAbb/5wAYALP/1AC9/+0AvwARAMX/4ADH/+cAyP/lAMn/7gDUABIA5f/pAPH/1wEv/9cBOf/TATv/1gE8/8UBQf/nAUkADQFLAAwBVP/WAVX/8gGp/+kBrf/nAbX/5wG2/+kB3//wACQACP/iAAsAFAAM/88APwASAEj/6gBU/9gAVv/qAF8AEwBr/64Aev/NAH//oACE/8EAh//AALP/0AC3/+oAuv/GALsADQC9/+kAvv/WAMH/6ADC/7oAxf/pAMf/ywDI/9oAyf/HAW7/0wGn/6sBqf/NAa3/ywG1/8sBtv/LAbn/8wG8//MBvf/vAdz/6AHf/+4ACABZ/+UAs//LAMj/5AGnAA0Bqf/tAa3/6wG1/+wBtv/sAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TAAYAxf/qAOj/7gDx/7ABL//sAVT/7AHc/+gAAQDx//UAAwALABQAPwASAF8AEwABAPH/wAABAPH/wAABAPH/wAAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAYAxf/qAOj/7gDx/7ABL//sAVT/7AHc/+gAAwBIAA8AVgAgAFkAEQAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QABARf/8QAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAGAMX/6gDo/+4A8f+wAS//7AFU/+wB3P/oAAEA8f/1ADAAVP9tAFn/jABr/b8Aev59AH/+vACE/ysAh/9LALP/YQC6/w8Avv7oAMH/HwDC/uUAxf9GAMf+7QDI/v0Ayf7ZANT/UgDhAAUA5f+9AOb/SQDo/v4A6v8TAPH/aAD4/w4A+v8TAPz/BwEC/w4BBP8RARf/PAEb/6wBJ/8VASn/PAEt/w4BL/9qATP/SQE5/wwBO/8/ATz+8QFB/8ABRv7vAUr/MQFM/18BUP8KAVMABQFU/zABVf/VAdz/WQHf/48AHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAcACH/wwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oBL/+fATj/UQE5/3sBO//KATz/3QFB//IBSf91AUv/ygFT/08BVP+MAa3/9QG1//UBuf/HAbr/8QG7/80BvP/dAb7/xAABAL8ADQACALP/wgC/ABAAAQC//+IAAQDC//IAAQC/AA4ABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UAAwDF/+0A8f/AAdz/7AAKALr/5gC9/+sAvv/pAMD/8ADB/+cAxf/jAMf/zgDI/9QAyf/bAd//7gABAPH/wAAFAL3/7AC/AA8Awf/qAMX/xADH/+cABgBI/+kAvf/uAL8AEADB/+wAxf8gAdz/2gABAL8ADwAGAMX/6gDo/+4A8f+rAS//7AFU/+wB3P/oAAEA8f/VAAEAxQALAA0ASAAMAMEACwDFAAwBp/+/Aan/7gGt/+wBtf/tAbb/7AG4//UBuQAOAbsADQG+AA0B3//tAAEA8f/YAAIA8f+qAdz/4QALAOH/1ADx/8kBBP/lARv/4wEv/8QBOP/hAUn/1AFK//UBS//nAVP/0gFU/8kACQDh/8MA8f/PAS//zgE4/+cBO//fAUn/0QFL/+wBU/+gAVT/0QAJAOH/wwDx/88BL//OATj/5wE7/98BSf/RAUv/7AFT/6ABVP/RAAgA4f/JAPH/3wEE/+0BG//rAS//3wE7/+kBSv/1AVT/4AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADh/+YA8f/QAS//zgE4/+gBSf/nAUv/7QFT/+YBVP/QAAsA1AAUAOH/4ADoABMBOP/hATn/4AE8/+EBQf/pAUn/3wFL/94BU//fAVX/8gAYALP/1AC9/+0AvwARAMX/4ADH/+cAyP/lAMn/7gDUABIA5f/pAPH/1wEv/9cBOf/TATv/1gE8/8UBQf/nAUkADQFLAAwBVP/WAVX/8gGp/+kBrf/nAbX/5wG2/+kB3//wAAUAGf/yAOH/8QFJ//IBS//yAVP/8gAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kABIA1P+uAOEAEgDm/+AA6P+tAOr/1gD4/98A/P/SAQL/4AEX/84BJ//dASn/4gEt/+ABM//gATn/6QE8/9oBRv+9AVD/3wFTABEACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAMANQAEwDh/+YA4v/0AOgAEgDx/+cBL//nATj/5QE5/+gBSf/mAUv/5gFT/+YBVP/nAAkA4f/DAPH/zwEv/84BOP/nATv/3wFJ/9EBS//sAVP/oAFU/9EACQDh/8MA8f/PAS//zgE4/+cBO//fAUn/0QFL/+wBU/+gAVT/0QACANT/4gFT/+QAAgDU/+EA6P/kAAYA6P/uAPH/7gEE//QBG//xAS//7wFU/+8ABADx//QBBP/1AS//9QFU//UAAgDo/8kBF//uAAYA6AAUAPH/7QD3/+IBL//tATn/7QFU/+0AAQEX//EABQEX/+sBqf/rAa3/6QG1/+sBtv/rABMASAANAML/qwDD/8AAx//VAOj/qgEX/+IBGwAMAUoACwFMAAsBp/+/Aan/7gGt/+wBtf/tAbb/7AG4//UBuQAOAbsADQG+AA0B3/+wAAYAxf/qAOj/7gDx/7ABL//sAVT/7AHc/+gABgDoABQA8f/wAPwADAEv//ABOf/mAVT/8AAFAOgAOgDx/+MBL//iATn/4wFU/+MACADx/7oBBP/PARv/2wEv/1ABOf+dAUr/8AFM//IBVP9MAAgA8f+6AQT/zwEb/9sBL/9QATn/nQFK//ABTP/yAVT/TAAGAMX/6gDo/+4A8f+wAS//7AFU/+wB3P/oAAEA6P/vAAgA8f+6AQT/zwEb/9sBL/9QATn/nQFK//ABTP/yAVT/TAAIAPH/ugEE/88BG//bAS//UAE5/50BSv/wAUz/8gFU/0wACADx/7oBBP/PARv/2wEv/1ABOf+dAUr/8AFM//IBVP9MABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQALABQAPwARAFT/4gBfABMBp/+0Aan/2QGt/9kBtf/ZAbb/2QAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAGAMX/6gDo/+4A8f+wAS//7AFU/+wB3P/oADAAVP9tAFn/jABr/b8Aev59AH/+vACE/ysAh/9LALP/YQC6/w8Avv7oAMH/HwDC/uUAxf9GAMf+7QDI/v0Ayf7ZANT/UgDhAAUA5f+9AOb/SQDo/v4A6v8TAPH/aAD4/w4A+v8TAPz/BwEC/w4BBP8RARf/PAEb/6wBJ/8VASn/PAEt/w4BL/9qATP/SQE5/wwBO/8/ATz+8QFB/8ABRv7vAUr/MQFM/18BUP8KAVMABQFU/zABVf/VAdz/WQHf/48AAgDo/8kBF//uABMAWf/BALP/xQDF/7QA5f/XAPH/uQEE/7IBF//SARv/yAEv/6ABOf/FAUH/5AFK/8wBTP/MAVT/ywFV/+8Bqf/oAa3/5gG1/+cBtv/nABMAWf/BALP/xQDF/7QA5f/XAPH/uQEE/7IBF//SARv/yAEv/6ABOf/FAUH/5AFK/8wBTP/MAVT/ywFV/+8Bqf/oAa3/5gG1/+cBtv/nAAIA6P/JARf/7gABAFkACwABAFkACwABAFkACwABAFkACwABAFkACwAJAan/8gGt//IBtf/yAbb/8gG5/8ABuv/sAbv/xwG8/9gBvv+/AAIBu//uAbz/9QABAaf/0gAEAan/6wGt/+kBtf/rAbb/6wAKAacAEQGp//ABrf/uAbX/7wG2//ABuf+7Abr/7AG7/7cBvP/VAb7/tAAFAaf/8wG5/+4Bu//xAb3/7AG+/+oABAG5/+kBu//rAbz/8QG+/+UABAG5//IBu//xAbz/9QG+/+4ACQGn/78Bqf/uAa3/7AG1/+0Btv/sAbj/9QG5AA4BuwANAb4ADQABAaf/7wAFAaf/xwGp//IBrf/wAbX/8AG2//AAAgGn/9wBuQAOAAQBqf/tAa3/6wG1/+sBtv/rAAkBp//AAan/7QGt/+sBtf/rAbb/6wG5AA8BuwAQAbwADQG+ABAABQGnAAwBqf/wAa3/8AG1//ABtv/wAAEB1/9qAAEB1/8VAAYASAALALr/8gDH//EAyf/vAdwADwHf/+4AAQGn/9UACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1ADkAVP+1AFn/xwBr/rgAev8oAH//TQCE/44Ah/+hALP/rgC6/34Avv9nAMH/hwDC/2UAxf+eAMf/agDI/3MAyf9eANT/pQDhAA8A5f/kAOb/oADo/3QA6v+AAPH/sgD4/30A+v+AAPz/eQEC/30BBP9/ARf/mAEb/9oBJ/+BASn/mAEt/30BL/+zATP/oAE5/3wBO/+aATz/bAFB/+YBRv9rAUr/kgFM/60BUP97AVMADwFU/5EBVf/yAaf/rwGp/7kBrf+5AbX/uQG2/7kBuP+8Abn/8QG8//EBvf/tAdz/qQHf/8kAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABAAL/+YAP//0AF//7wE8/+0ABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAUASP/uAFn/6gG7//ABvP/tAb7/8AAFAEj/7gBZ/+oBu//wAbz/7QG+//AABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAEBp//rAAEBp//rAAEBp//rAAEBp//rACQACP/iAAsAFAAM/88APwASAEj/6gBU/9gAVv/qAF8AEwBr/64Aev/NAH//oACE/8EAh//AALP/0AC3/+oAuv/GALsADQC9/+kAvv/WAMH/6ADC/7oAxf/pAMf/ywDI/9oAyf/HAW7/0wGn/6sBqf/NAa3/ywG1/8sBtv/LAbn/8wG8//MBvf/vAdz/6AHf/+4ABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MAAQDx//UAAQDx//UAAQDx//UAAQDx//UAAQDx/8AACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1AAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1ABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TAAQAC//mAD//9ABf/+8BPP/tAAQAC//mAD//9ABf/+8BPP/tAAQAC//mAD//9ABf/+8BPP/tAAQAC//mAD//9ABf/+8BPP/tAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAEA8f/1AAUASP/uAFn/6gG7//ABvP/tAb7/8AABAPH/9QAFAEj/7gBZ/+oBu//wAbz/7QG+//AAAQDx//UABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAEA8f/1AAUASP/uAFn/6gG7//ABvP/tAb7/8AABAPH/9QAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAAQDx/8AACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AABAaf/6wATAFn/wQCz/8UAxf+0AOX/1wDx/7kBBP+yARf/0gEb/8gBL/+gATn/xQFB/+QBSv/MAUz/zAFU/8sBVf/vAan/6AGt/+YBtf/nAbb/5wALAFn/pAGnABMBqf/zAa3/8QG1//IBtv/xAbn/OwG6/9oBu/9UAbz/kQG+/z8ACwBZ/6QBpwATAan/8wGt//EBtf/yAbb/8QG5/zsBuv/aAbv/VAG8/5EBvv8/AAsAWf+kAacAEwGp//MBrf/xAbX/8gG2//EBuf87Abr/2gG7/1QBvP+RAb7/PwALAFn/pAGnABMBqf/zAa3/8QG1//IBtv/xAbn/OwG6/9oBu/9UAbz/kQG+/z8ACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAEA8f/AAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AABAPH/wAAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAAQDx/8AAAQDx/8AACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oAAwBIAA8AVgAgAFkAEQADAEgADwBWACAAWQARAAMASAAPAFYAIABZABEAOQBU/7UAWf/HAGv+uAB6/ygAf/9NAIT/jgCH/6EAs/+uALr/fgC+/2cAwf+HAML/ZQDF/54Ax/9qAMj/cwDJ/14A1P+lAOEADwDl/+QA5v+gAOj/dADq/4AA8f+yAPj/fQD6/4AA/P95AQL/fQEE/38BF/+YARv/2gEn/4EBKf+YAS3/fQEv/7MBM/+gATn/fAE7/5oBPP9sAUH/5gFG/2sBSv+SAUz/rQFQ/3sBUwAPAVT/kQFV//IBp/+vAan/uQGt/7kBtf+5Abb/uQG4/7wBuf/xAbz/8QG9/+0B3P+pAd//yQA5AFT/tQBZ/8cAa/64AHr/KAB//00AhP+OAIf/oQCz/64Auv9+AL7/ZwDB/4cAwv9lAMX/ngDH/2oAyP9zAMn/XgDU/6UA4QAPAOX/5ADm/6AA6P90AOr/gADx/7IA+P99APr/gAD8/3kBAv99AQT/fwEX/5gBG//aASf/gQEp/5gBLf99AS//swEz/6ABOf98ATv/mgE8/2wBQf/mAUb/awFK/5IBTP+tAVD/ewFTAA8BVP+RAVX/8gGn/68Bqf+5Aa3/uQG1/7kBtv+5Abj/vAG5//EBvP/xAb3/7QHc/6kB3//JADkAVP+1AFn/xwBr/rgAev8oAH//TQCE/44Ah/+hALP/rgC6/34Avv9nAMH/hwDC/2UAxf+eAMf/agDI/3MAyf9eANT/pQDhAA8A5f/kAOb/oADo/3QA6v+AAPH/sgD4/30A+v+AAPz/eQEC/30BBP9/ARf/mAEb/9oBJ/+BASn/mAEt/30BL/+zATP/oAE5/3wBO/+aATz/bAFB/+YBRv9rAUr/kgFM/60BUP97AVMADwFU/5EBVf/yAaf/rwGp/7kBrf+5AbX/uQG2/7kBuP+8Abn/8QG8//EBvf/tAdz/qQHf/8kAAQGn/+sAAQGn/+sAAQGn/+sAAQGn/+sAAQGn/+sAAQGn/+sACQALAA8APwAMAFT/6wBfAA4Bp//LAan/6QGt/+cBtf/nAbb/5wAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBp/+rAan/zQGt/8sBtf/LAbb/ywG5//MBvP/zAb3/7wHc/+gB3//uAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1ACQACP/iAAsAFAAM/88APwASAEj/6gBU/9gAVv/qAF8AEwBr/64Aev/NAH//oACE/8EAh//AALP/0AC3/+oAuv/GALsADQC9/+kAvv/WAMH/6ADC/7oAxf/pAMf/ywDI/9oAyf/HAW7/0wGn/6sBqf/NAa3/ywG1/8sBtv/LAbn/8wG8//MBvf/vAdz/6AHf/+4ACABZ/+UAs//LAMj/5AGnAA0Bqf/tAa3/6wG1/+wBtv/sAAgAWf/lALP/ywDI/+QBpwANAan/7QGt/+sBtf/sAbb/7AAIAFn/5QCz/8sAyP/kAacADQGp/+0Brf/rAbX/7AG2/+wAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBp/+rAan/zQGt/8sBtf/LAbb/ywG5//MBvP/zAb3/7wHc/+gB3//uABwAIf/DAFb/7wBZ/98Alv/uALP/5QC0/9EAvwARAMX/yADUABMA4f/FAPH/ygEv/58BOP9RATn/ewE7/8oBPP/dAUH/8gFJ/3UBS//KAVP/TwFU/4wBrf/1AbX/9QG5/8cBuv/xAbv/zQG8/90Bvv/EAAIBDAALAVP/5gAFAEj/7gBZ/+oBu//wAbz/7QG+//AACABZ/+UAs//LAMj/5AGnAA0Bqf/tAa3/6wG1/+wBtv/sAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAEwBZ/8EAs//FAMX/tADl/9cA8f+5AQT/sgEX/9IBG//IAS//oAE5/8UBQf/kAUr/zAFM/8wBVP/LAVX/7wGp/+gBrf/mAbX/5wG2/+cACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAkAVgAOAH//nwC//94Awv/lANT/qADo/8oBRv/jAaf/xgHf//UAOQBU/7UAWf/HAGv+uAB6/ygAf/9NAIT/jgCH/6EAs/+uALr/fgC+/2cAwf+HAML/ZQDF/54Ax/9qAMj/cwDJ/14A1P+lAOEADwDl/+QA5v+gAOj/dADq/4AA8f+yAPj/fQD6/4AA/P95AQL/fQEE/38BF/+YARv/2gEn/4EBKf+YAS3/fQEv/7MBM/+gATn/fAE7/5oBPP9sAUH/5gFG/2sBSv+SAUz/rQFQ/3sBUwAPAVT/kQFV//IBp/+vAan/uQGt/7kBtf+5Abb/uQG4/7wBuf/xAbz/8QG9/+0B3P+pAd//yQAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBp/+rAan/zQGt/8sBtf/LAbb/ywG5//MBvP/zAb3/7wHc/+gB3//uABgAs//UAL3/7QC/ABEAxf/gAMf/5wDI/+UAyf/uANQAEgDl/+kA8f/XAS//1wE5/9MBO//WATz/xQFB/+cBSQANAUsADAFU/9YBVf/yAan/6QGt/+cBtf/nAbb/6QHf//AACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kACQACP/iAAsAFAAM/88APwASAEj/6gBU/9gAVv/qAF8AEwBr/64Aev/NAH//oACE/8EAh//AALP/0AC3/+oAuv/GALsADQC9/+kAvv/WAMH/6ADC/7oAxf/pAMf/ywDI/9oAyf/HAW7/0wGn/6sBqf/NAa3/ywG1/8sBtv/LAbn/8wG8//MBvf/vAdz/6AHf/+4AAQDx/8AACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAUASP/uAFn/6gG7//ABvP/tAb7/8AAwAFT/bQBZ/4wAa/2/AHr+fQB//rwAhP8rAIf/SwCz/2EAuv8PAL7+6ADB/x8Awv7lAMX/RgDH/u0AyP79AMn+2QDU/1IA4QAFAOX/vQDm/0kA6P7+AOr/EwDx/2gA+P8OAPr/EwD8/wcBAv8OAQT/EQEX/zwBG/+sASf/FQEp/zwBLf8OAS//agEz/0kBOf8MATv/PwE8/vEBQf/AAUb+7wFK/zEBTP9fAVD/CgFTAAUBVP8wAVX/1QHc/1kB3/+PAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAAQGn/+sAEwBZ/8EAs//FAMX/tADl/9cA8f+5AQT/sgEX/9IBG//IAS//oAE5/8UBQf/kAUr/zAFM/8wBVP/LAVX/7wGp/+gBrf/mAbX/5wG2/+cAEwBZ/8EAs//FAMX/tADl/9cA8f+5AQT/sgEX/9IBG//IAS//oAE5/8UBQf/kAUr/zAFM/8wBVP/LAVX/7wGp/+gBrf/mAbX/5wG2/+cAEgDU/64A4QASAOb/4ADo/60A6v/WAPj/3wD8/9IBAv/gARf/zgEn/90BKf/iAS3/4AEz/+ABOf/pATz/2gFG/70BUP/fAVMAEQAcACH/wwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oBL/+fATj/UQE5/3sBO//KATz/3QFB//IBSf91AUv/ygFT/08BVP+MAa3/9QG1//UBuf/HAbr/8QG7/80BvP/dAb7/xAACAQwACwFT/+YAMABU/20AWf+MAGv9vwB6/n0Af/68AIT/KwCH/0sAs/9hALr/DwC+/ugAwf8fAML+5QDF/0YAx/7tAMj+/QDJ/tkA1P9SAOEABQDl/70A5v9JAOj+/gDq/xMA8f9oAPj/DgD6/xMA/P8HAQL/DgEE/xEBF/88ARv/rAEn/xUBKf88AS3/DgEv/2oBM/9JATn/DAE7/z8BPP7xAUH/wAFG/u8BSv8xAUz/XwFQ/woBUwAFAVT/MAFV/9UB3P9ZAd//jwAFAEj/7gBZ/+oBu//wAbz/7QG+//AACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAkAVgAOAH//nwC//94Awv/lANT/qADo/8oBRv/jAaf/xgHf//UABAAL/+YAP//0AF//7wE8/+0AOQBU/7UAWf/HAGv+uAB6/ygAf/9NAIT/jgCH/6EAs/+uALr/fgC+/2cAwf+HAML/ZQDF/54Ax/9qAMj/cwDJ/14A1P+lAOEADwDl/+QA5v+gAOj/dADq/4AA8f+yAPj/fQD6/4AA/P95AQL/fQEE/38BF/+YARv/2gEn/4EBKf+YAS3/fQEv/7MBM/+gATn/fAE7/5oBPP9sAUH/5gFG/2sBSv+SAUz/rQFQ/3sBUwAPAVT/kQFV//IBp/+vAan/uQGt/7kBtf+5Abb/uQG4/7wBuf/xAbz/8QG9/+0B3P+pAd//yQAYALP/1AC9/+0AvwARAMX/4ADH/+cAyP/lAMn/7gDUABIA5f/pAPH/1wEv/9cBOf/TATv/1gE8/8UBQf/nAUkADQFLAAwBVP/WAVX/8gGp/+kBrf/nAbX/5wG2/+kB3//wAAcA8f/wAQT/8QEb//MBL//xAUr/8wFM/+kBVP/TAAEA8f/1AAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oABgDF/+oA6P/uAPH/sAEv/+wBVP/sAdz/6AAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QABARf/8QABAPH/9QACAOj/yQEX/+4ABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UACQALAA8APwAMAFT/6wBfAA4Bp//LAan/6QGt/+cBtf/nAbb/5wAJAAsADwA/AAwAVP/rAF8ADgGn/8sBqf/pAa3/5wG1/+cBtv/nAAkACwAPAD8ADABU/+sAXwAOAaf/ywGp/+kBrf/nAbX/5wG2/+cAJAAI/+IACwAUAAz/zwA/ABIASP/qAFT/2ABW/+oAXwATAGv/rgB6/80Af/+gAIT/wQCH/8AAs//QALf/6gC6/8YAuwANAL3/6QC+/9YAwf/oAML/ugDF/+kAx//LAMj/2gDJ/8cBbv/TAaf/qwGp/80Brf/LAbX/ywG2/8sBuf/zAbz/8wG9/+8B3P/oAd//7gAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QABAFkACwABAFkACwABAFkACwAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QAAQDx/8AAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAFAEj/7gBZ/+oBu//wAbz/7QG+//AAAQDx//UACQALABQAPwARAFT/4gBfABMBp/+0Aan/2QGt/9kBtf/ZAbb/2QAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAEAAv/5gA///QAX//vATz/7QAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBp/+rAan/zQGt/8sBtf/LAbb/ywG5//MBvP/zAb3/7wHc/+gB3//uAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1AAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAYALP/1AC9/+0AvwARAMX/4ADH/+cAyP/lAMn/7gDUABIA5f/pAPH/1wEv/9cBOf/TATv/1gE8/8UBQf/nAUkADQFLAAwBVP/WAVX/8gGp/+kBrf/nAbX/5wG2/+kB3//wAAEBF//xAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAcACH/wwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oBL/+fATj/UQE5/3sBO//KATz/3QFB//IBSf91AUv/ygFT/08BVP+MAa3/9QG1//UBuf/HAbr/8QG7/80BvP/dAb7/xAAHAPH/8AEE//EBG//zAS//8QFK//MBTP/pAVT/0wAcACH/wwBW/+8AWf/fAJb/7gCz/+UAtP/RAL8AEQDF/8gA1AATAOH/xQDx/8oBL/+fATj/UQE5/3sBO//KATz/3QFB//IBSf91AUv/ygFT/08BVP+MAa3/9QG1//UBuf/HAbr/8QG7/80BvP/dAb7/xAAHAPH/8AEE//EBG//zAS//8QFK//MBTP/pAVT/0wAFAEj/7gBZ/+oBu//wAbz/7QG+//AAAQDx//UAAQDx//UAAQDx//UAGACz/9QAvf/tAL8AEQDF/+AAx//nAMj/5QDJ/+4A1AASAOX/6QDx/9cBL//XATn/0wE7/9YBPP/FAUH/5wFJAA0BSwAMAVT/1gFV//IBqf/pAa3/5wG1/+cBtv/pAd//8AABARf/8QAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAGAMX/6gDo/+4A8f+wAS//7AFU/+wB3P/oABIA1P+uAOEAEgDm/+AA6P+tAOr/1gD4/98A/P/SAQL/4AEX/84BJ//dASn/4gEt/+ABM//gATn/6QE8/9oBRv+9AVD/3wFTABEABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UAEgDU/64A4QASAOb/4ADo/60A6v/WAPj/3wD8/9IBAv/gARf/zgEn/90BKf/iAS3/4AEz/+ABOf/pATz/2gFG/70BUP/fAVMAEQAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QASANT/rgDhABIA5v/gAOj/rQDq/9YA+P/fAPz/0gEC/+ABF//OASf/3QEp/+IBLf/gATP/4AE5/+kBPP/aAUb/vQFQ/98BUwARAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1ABgAs//UAL3/7QC/ABEAxf/gAMf/5wDI/+UAyf/uANQAEgDl/+kA8f/XAS//1wE5/9MBO//WATz/xQFB/+cBSQANAUsADAFU/9YBVf/yAan/6QGt/+cBtf/nAbb/6QHf//AAAQEX//EAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MAHAAh/8MAVv/vAFn/3wCW/+4As//lALT/0QC/ABEAxf/IANQAEwDh/8UA8f/KAS//nwE4/1EBOf97ATv/ygE8/90BQf/yAUn/dQFL/8oBU/9PAVT/jAGt//UBtf/1Abn/xwG6//EBu//NAbz/3QG+/8QABwDx//ABBP/xARv/8wEv//EBSv/zAUz/6QFU/9MABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAEA8f/1AAUASP/uAFn/6gG7//ABvP/tAb7/8AABAPH/9QAFAEj/7gBZ/+oBu//wAbz/7QG+//AAAQDx//UABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAEA8f/1AAUASP/uAFn/6gG7//ABvP/tAb7/8AABAPH/9QAFAEj/7gBZ/+oBu//wAbz/7QG+//AAAQDx//UABQBI/+4AWf/qAbv/8AG8/+0Bvv/wAAEA8f/1AAUASP/uAFn/6gG7//ABvP/tAb7/8AABAPH/9QAIANQAFQDoABUBOP/kATn/5QE7/+QBSf/jAUv/4gFT/+QACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAH//3wCw//MAsv/wAL//6gDU/98A4f/gAVP/4AGn/+0Bvf/1AAkAxf/qAOj/uADx/+oBBP/wARv/8QEv/+sBSv/1AVT/7AHc/+oACQB//98AsP/zALL/8AC//+oA1P/fAOH/4AFT/+ABp//tAb3/9QAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAkAf//fALD/8wCy//AAv//qANT/3wDh/+ABU//gAaf/7QG9//UACQDF/+oA6P+4APH/6gEE//ABG//xAS//6wFK//UBVP/sAdz/6gAJAMX/6gDo/7gA8f/qAQT/8AEb//EBL//rAUr/9QFU/+wB3P/qAAEBp//rAAEBp//rACQACP/iAAsAFAAM/88APwASAEj/6gBU/9gAVv/qAF8AEwBr/64Aev/NAH//oACE/8EAh//AALP/0AC3/+oAuv/GALsADQC9/+kAvv/WAMH/6ADC/7oAxf/pAMf/ywDI/9oAyf/HAW7/0wGn/6sBqf/NAa3/ywG1/8sBtv/LAbn/8wG8//MBvf/vAdz/6AHf/+4ABwBIAA0AwQALAML/6gDFAAwA6P/IARf/8QHf//UAJAAI/+IACwAUAAz/zwA/ABIASP/qAFT/2ABW/+oAXwATAGv/rgB6/80Af/+gAIT/wQCH/8AAs//QALf/6gC6/8YAuwANAL3/6QC+/9YAwf/oAML/ugDF/+kAx//LAMj/2gDJ/8cBbv/TAaf/qwGp/80Brf/LAbX/ywG2/8sBuf/zAbz/8wG9/+8B3P/oAd//7gAHAEgADQDBAAsAwv/qAMUADADo/8gBF//xAd//9QAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBp/+rAan/zQGt/8sBtf/LAbb/ywG5//MBvP/zAb3/7wHc/+gB3//uAAcASAANAMEACwDC/+oAxQAMAOj/yAEX//EB3//1ABMAWf/BALP/xQDF/7QA5f/XAPH/uQEE/7IBF//SARv/yAEv/6ABOf/FAUH/5AFK/8wBTP/MAVT/ywFV/+8Bqf/oAa3/5gG1/+cBtv/nAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AA5AFT/tQBZ/8cAa/64AHr/KAB//00AhP+OAIf/oQCz/64Auv9+AL7/ZwDB/4cAwv9lAMX/ngDH/2oAyP9zAMn/XgDU/6UA4QAPAOX/5ADm/6AA6P90AOr/gADx/7IA+P99APr/gAD8/3kBAv99AQT/fwEX/5gBG//aASf/gQEp/5gBLf99AS//swEz/6ABOf98ATv/mgE8/2wBQf/mAUb/awFK/5IBTP+tAVD/ewFTAA8BVP+RAVX/8gGn/68Bqf+5Aa3/uQG1/7kBtv+5Abj/vAG5//EBvP/xAb3/7QHc/6kB3//JABgAs//UAL3/7QC/ABEAxf/gAMf/5wDI/+UAyf/uANQAEgDl/+kA8f/XAS//1wE5/9MBO//WATz/xQFB/+cBSQANAUsADAFU/9YBVf/yAan/6QGt/+cBtf/nAbb/6QHf//AAAQEX//EAMABU/20AWf+MAGv9vwB6/n0Af/68AIT/KwCH/0sAs/9hALr/DwC+/ugAwf8fAML+5QDF/0YAx/7tAMj+/QDJ/tkA1P9SAOEABQDl/70A5v9JAOj+/gDq/xMA8f9oAPj/DgD6/xMA/P8HAQL/DgEE/xEBF/88ARv/rAEn/xUBKf88AS3/DgEv/2oBM/9JATn/DAE7/z8BPP7xAUH/wAFG/u8BSv8xAUz/XwFQ/woBUwAFAVT/MAFV/9UB3P9ZAd//jwACAOj/yQEX/+4AGACz/9QAvf/tAL8AEQDF/+AAx//nAMj/5QDJ/+4A1AASAOX/6QDx/9cBL//XATn/0wE7/9YBPP/FAUH/5wFJAA0BSwAMAVT/1gFV//IBqf/pAa3/5wG1/+cBtv/pAd//8AABARf/8QABAPH/wAAJAOH/wwDx/88BL//OATj/5wE7/98BSf/RAUv/7AFT/6ABVP/RADAAVP9tAFn/jABr/b8Aev59AH/+vACE/ysAh/9LALP/YQC6/w8Avv7oAMH/HwDC/uUAxf9GAMf+7QDI/v0Ayf7ZANT/UgDhAAUA5f+9AOb/SQDo/v4A6v8TAPH/aAD4/w4A+v8TAPz/BwEC/w4BBP8RARf/PAEb/6wBJ/8VASn/PAEt/w4BL/9qATP/SQE5/wwBO/8/ATz+8QFB/8ABRv7vAUr/MQFM/18BUP8KAVMABQFU/zABVf/VAdz/WQHf/48AEwBZ/8EAs//FAMX/tADl/9cA8f+5AQT/sgEX/9IBG//IAS//oAE5/8UBQf/kAUr/zAFM/8wBVP/LAVX/7wGp/+gBrf/mAbX/5wG2/+cACADUABUA6AAVATj/5AE5/+UBO//kAUn/4wFL/+IBU//kAAgA1AAVAOgAFQE4/+QBOf/lATv/5AFJ/+MBS//iAVP/5AAkAAj/4gALABQADP/PAD8AEgBI/+oAVP/YAFb/6gBfABMAa/+uAHr/zQB//6AAhP/BAIf/wACz/9AAt//qALr/xgC7AA0Avf/pAL7/1gDB/+gAwv+6AMX/6QDH/8sAyP/aAMn/xwFu/9MBp/+rAan/zQGt/8sBtf/LAbb/ywG5//MBvP/zAb3/7wHc/+gB3//uAAEwsgAEAAAACgAeAHQDpgQkBI4E0AXuBuQHQgdcABUAOAAUADkAEgA7ABYBFAAUAgsAFgKSABIClAAWApYAFgL9ABYDDAAWAw8AFgNFABIDRwASA0kAEgNLABYDYAAUA2gAFgPqABYD7AAWA+4AFgQTABYAzAAO/xYAEP8WACP/VgAs/vgANgAUAEP/3gBF/+sARv/rAEf/6wBJ/+sAUf/rAFP/6wBX/+oAWP/oAFv/6ACR/+sAlf/rAJf/6gCt/1YAr/9WALb/6wC4/+gAw//rAMT/6wDG/+oAzQAUANEAFADy/+sA/v/rAQj/VgET/+sBFf/oARn/6wEd/+sBLgAUATX/6wE2ABQBR//rAUj/6wFS/+sBZ/8WAWv/FgFv/xYBcP8WAfH/VgHy/1YB8/9WAfT/VgH1/1YB9v9WAff/VgIM/94CDf/eAg7/3gIP/94CEP/eAhH/3gIS/94CE//rAhT/6wIV/+sCFv/rAhf/6wId/+sCHv/rAh//6wIg/+sCIf/rAiL/6gIj/+oCJP/qAiX/6gIm/+gCJ//oAij/VgIp/94CKv9WAiv/3gIs/1YCLf/eAi//6wIx/+sCM//rAjX/6wI3/+sCOf/rAjv/6wI9/+sCP//rAkH/6wJD/+sCRf/rAkf/6wJJ/+sCV/74Amv/6wJt/+sCb//rAoAAFAKCABQChAAUAof/6gKJ/+oCi//qAo3/6gKP/+oCkf/qApX/6AL4/1YDAP9WAxD/6wMU/+oDFv/rAxj/6AMb/+oDHP/rAx3/6gMk/vgDKP9WAzMAFAM1/94DNv/rAzj/6wM6/+sDO//oAz3/6wNE/+gDTP/oA1X/VgNW/94DXP/rA2H/6ANi/+sDZ//rA2n/6ANu/1YDb//eA3D/VgNx/94Ddf/rA3f/6wN4/+sDgv/rA4T/6wOG/+sDiv/oA4z/6AOO/+gDlf/rA5j/VgOZ/94Dmv9WA5v/3gOc/1YDnf/eA57/VgOf/94DoP9WA6H/3gOi/1YDo//eA6T/VgOl/94Dpv9WA6f/3gOo/1YDqf/eA6r/VgOr/94DrP9WA63/3gOu/1YDr//eA7H/6wOz/+sDtf/rA7f/6wO5/+sDu//rA73/6wO//+sDxf/rA8f/6wPJ/+sDy//rA83/6wPP/+sD0f/rA9P/6wPV/+sD1//rA9n/6wPb/+sD3f/qA9//6gPh/+oD4//qA+X/6gPn/+oD6f/qA+v/6APt/+gD7//oA/YAFAAfADb/1QA4/+QAOf/sADv/3QDN/9UA0f/VART/5AEu/9UBNv/VAgv/3QKA/9UCgv/VAoT/1QKS/+wClP/dApb/3QL9/90DDP/dAw//3QMz/9UDRf/sA0f/7ANJ/+wDS//dA2D/5ANo/90D6v/dA+z/3QPu/90D9v/VBBP/3QAaADb/sAA4/+0AO//QAM3/sADR/7ABFP/tAS7/sAE2/7ACC//QAoD/sAKC/7AChP+wApT/0AKW/9AC/f/QAwz/0AMP/9ADM/+wA0v/0ANg/+0DaP/QA+r/0APs/9AD7v/QA/b/sAQT/9AAEAAs/+4AN//uAgf/7gII/+4CCf/uAgr/7gJX/+4Chv/uAoj/7gKK/+4CjP/uAo7/7gKQ/+4DJP/uA9z/7gPe/+4ARwAEABAACQAQAEX/6ABG/+gAR//oAEn/6ABT/+gAkf/oAJX/6AC2/+gAw//oAMT/6ADy/+gA/v/oARn/6AEd/+gBNf/oAUf/6AFI/+gBUv/oAWUAEAFmABABaAAQAWkAEAFqABACE//oAhT/6AIV/+gCFv/oAhf/6AIv/+gCMf/oAjP/6AI1/+gCN//oAjn/6AI7/+gCPf/oAj//6AJB/+gCQ//oAkX/6AJH/+gCSf/oAxD/6AM2/+gDOv/oAz3/6ANNABADTgAQA1IAEANc/+gDYv/oA2f/6AN1/+gDd//oA3j/6AOE/+gDlf/oA7H/6AOz/+gDtf/oA7f/6AO5/+gDu//oA73/6AO//+gD0//oA9X/6APX/+gD2//oAD0ARf/sAEb/7ABH/+wASf/sAFP/7ACR/+wAlf/sALb/7ADD/+wAxP/sAPL/7AD+/+wBGf/sAR3/7AE1/+wBR//sAUj/7AFS/+wCE//sAhT/7AIV/+wCFv/sAhf/7AIv/+wCMf/sAjP/7AI1/+wCN//sAjn/7AI7/+wCPf/sAj//7AJB/+wCQ//sAkX/7AJH/+wCSf/sAxD/7AM2/+wDOv/sAz3/7ANc/+wDYv/sA2f/7AN1/+wDd//sA3j/7AOE/+wDlf/sA7H/7AOz/+wDtf/sA7f/7AO5/+wDu//sA73/7AO//+wD0//sA9X/7APX/+wD2//sABcAUf/sARP/7AId/+wCHv/sAh//7AIg/+wCIf/sAmv/7AJt/+wCb//sAxb/7AMc/+wDOP/sA4L/7AOG/+wDxf/sA8f/7APJ/+wDy//sA83/7APP/+wD0f/sA9n/7AAGAA7/hAAQ/4QBZ/+EAWv/hAFv/4QBcP+EABAALP/sADf/7AIH/+wCCP/sAgn/7AIK/+wCV//sAob/7AKI/+wCiv/sAoz/7AKO/+wCkP/sAyT/7APc/+wD3v/sAAEpLAAEAAAAIgBOAMQBqgKQA2oEBAaeCGQJNgosC/IMJAxWDNQOug8wEAISFBLKFDAU6hVwFc4WkBcGFxgXQhiUGtIa9BwKHIgcshzcAB0ABP/yAAn/8gBY//MAW//zALj/8wEV//MBZf/yAWb/8gFo//IBaf/yAWr/8gIm//MCJ//zApX/8wMY//MDO//zA0T/8wNM//MDTf/yA07/8gNS//IDYf/zA2n/8wOK//MDjP/zA47/8wPr//MD7f/zA+//8wA5ACX/8wAp//MAMf/zADP/8wCB//MAkP/zAJT/8wCu//MAzv/zAQP/8wES//MBFv/zARj/8wEa//MBHP/zATT/8wFR//MB+P/zAgL/8wID//MCBP/zAgX/8wIG//MCLv/zAjD/8wIy//MCNP/zAkL/8wJE//MCRv/zAkj/8wJq//MCbP/zAm7/8wKf//MC/P/zAwn/8wMv//MDMv/zA1f/8wNj//MDZv/zA4H/8wOD//MDhf/zA8T/8wPG//MDyP/zA8r/8wPM//MDzv/zA9D/8wPS//MD1P/zA9b/8wPY//MD2v/zADkAJf/mACn/5gAx/+YAM//mAIH/5gCQ/+YAlP/mAK7/5gDO/+YBA//mARL/5gEW/+YBGP/mARr/5gEc/+YBNP/mAVH/5gH4/+YCAv/mAgP/5gIE/+YCBf/mAgb/5gIu/+YCMP/mAjL/5gI0/+YCQv/mAkT/5gJG/+YCSP/mAmr/5gJs/+YCbv/mAp//5gL8/+YDCf/mAy//5gMy/+YDV//mA2P/5gNm/+YDgf/mA4P/5gOF/+YDxP/mA8b/5gPI/+YDyv/mA8z/5gPO/+YD0P/mA9L/5gPU/+YD1v/mA9j/5gPa/+YANgAj/+QAOv/SADv/0wCt/+QAr//kANX/0gEI/+QB8f/kAfL/5AHz/+QB9P/kAfX/5AH2/+QB9//kAgv/0wIo/+QCKv/kAiz/5AKU/9MClv/TAvj/5AL9/9MDAP/kAwz/0wMN/9IDD//TAyj/5AM0/9IDS//TA1X/5ANo/9MDa//SA27/5ANw/+QDef/SA5P/0gOY/+QDmv/kA5z/5AOe/+QDoP/kA6L/5AOk/+QDpv/kA6j/5AOq/+QDrP/kA67/5APq/9MD7P/TA+7/0wP4/9IEAP/SBBP/0wAmAA7/HgAQ/x4AI//NAK3/zQCv/80BCP/NAWf/HgFr/x4Bb/8eAXD/HgHx/80B8v/NAfP/zQH0/80B9f/NAfb/zQH3/80CKP/NAir/zQIs/80C+P/NAwD/zQMo/80DVf/NA27/zQNw/80DmP/NA5r/zQOc/80Dnv/NA6D/zQOi/80DpP/NA6b/zQOo/80Dqv/NA6z/zQOu/80ApgBF/9wARv/cAEf/3ABJ/9wAT//zAFD/8wBR/9YAUv/zAFP/3ABX/90AWP/hAFv/4QCR/9wAlf/cAJf/3QC2/9wAuP/hALz/8wDD/9wAxP/cAMb/3QDn//MA6//zAOz/8wDu//MA7//zAPD/8wDy/9wA8//zAPX/8wD2//MA+f/zAPv/8wD+/9wBAP/zARP/1gEV/+EBGf/cAR3/3AEx//MBNf/cAUD/8wFF//MBR//cAUj/3AFS/9wCE//cAhT/3AIV/9wCFv/cAhf/3AIc//MCHf/WAh7/1gIf/9YCIP/WAiH/1gIi/90CI//dAiT/3QIl/90CJv/hAif/4QIv/9wCMf/cAjP/3AI1/9wCN//cAjn/3AI7/9wCPf/cAj//3AJB/9wCQ//cAkX/3AJH/9wCSf/cAmT/8wJm//MCaP/zAmn/8wJr/9YCbf/WAm//1gKH/90Cif/dAov/3QKN/90Cj//dApH/3QKV/+EDEP/cAxL/8wMU/90DFv/WAxj/4QMb/90DHP/WAx3/3QM2/9wDN//zAzj/1gM5//MDOv/cAzv/4QM9/9wDPv/zA0P/8wNE/+EDTP/hA1T/8wNc/9wDXf/zA2H/4QNi/9wDZ//cA2n/4QN1/9wDd//cA3j/3AN+//MDgP/zA4L/1gOE/9wDhv/WA4r/4QOM/+EDjv/hA5L/8wOV/9wDsf/cA7P/3AO1/9wDt//cA7n/3AO7/9wDvf/cA7//3APF/9YDx//WA8n/1gPL/9YDzf/WA8//1gPR/9YD0//cA9X/3APX/9wD2f/WA9v/3APd/90D3//dA+H/3QPj/90D5f/dA+f/3QPp/90D6//hA+3/4QPv/+ED8//zA/X/8wP///MEDP/zBA7/8wQQ//MAcQAE/9oACf/aAEX/8ABG//AAR//wAEn/8ABT//AAV//vAFj/3ABb/9wAkf/wAJX/8ACX/+8Atv/wALj/3ADD//AAxP/wAMb/7wDy//AA/v/wARX/3AEZ//ABHf/wATX/8AFH//ABSP/wAVL/8AFl/9oBZv/aAWj/2gFp/9oBav/aAhP/8AIU//ACFf/wAhb/8AIX//ACIv/vAiP/7wIk/+8CJf/vAib/3AIn/9wCL//wAjH/8AIz//ACNf/wAjf/8AI5//ACO//wAj3/8AI///ACQf/wAkP/8AJF//ACR//wAkn/8AKH/+8Cif/vAov/7wKN/+8Cj//vApH/7wKV/9wDEP/wAxT/7wMY/9wDG//vAx3/7wM2//ADOv/wAzv/3AM9//ADRP/cA0z/3ANN/9oDTv/aA1L/2gNc//ADYf/cA2L/8ANn//ADaf/cA3X/8AN3//ADeP/wA4T/8AOK/9wDjP/cA47/3AOV//ADsf/wA7P/8AO1//ADt//wA7n/8AO7//ADvf/wA7//8APT//AD1f/wA9f/8APb//AD3f/vA9//7wPh/+8D4//vA+X/7wPn/+8D6f/vA+v/3APt/9wD7//cADQABP+gAAn/oABX//EAWP/FAFv/xQCX//EAuP/FAMb/8QEV/8UBZf+gAWb/oAFo/6ABaf+gAWr/oAIi//ECI//xAiT/8QIl//ECJv/FAif/xQKH//ECif/xAov/8QKN//ECj//xApH/8QKV/8UDFP/xAxj/xQMb//EDHf/xAzv/xQNE/8UDTP/FA03/oANO/6ADUv+gA2H/xQNp/8UDiv/FA4z/xQOO/8UD3f/xA9//8QPh//ED4//xA+X/8QPn//ED6f/xA+v/xQPt/8UD7//FAD0ARf/nAEb/5wBH/+cASf/nAFP/5wCR/+cAlf/nALb/5wDD/+cAxP/nAPL/5wD+/+cBGf/nAR3/5wE1/+cBR//nAUj/5wFS/+cCE//nAhT/5wIV/+cCFv/nAhf/5wIv/+cCMf/nAjP/5wI1/+cCN//nAjn/5wI7/+cCPf/nAj//5wJB/+cCQ//nAkX/5wJH/+cCSf/nAxD/5wM2/+cDOv/nAz3/5wNc/+cDYv/nA2f/5wN1/+cDd//nA3j/5wOE/+cDlf/nA7H/5wOz/+cDtf/nA7f/5wO5/+cDu//nA73/5wO//+cD0//nA9X/5wPX/+cD2//nAHEABAAMAAkADABF/+gARv/oAEf/6ABJ/+gAUf/qAFP/6ABYAAsAWwALAJH/6ACV/+gAtv/oALgACwDD/+gAxP/oAPL/6AD+/+gBE//qARUACwEZ/+gBHf/oATX/6AFH/+gBSP/oAVL/6AFlAAwBZgAMAWgADAFpAAwBagAMAhP/6AIU/+gCFf/oAhb/6AIX/+gCHf/qAh7/6gIf/+oCIP/qAiH/6gImAAsCJwALAi//6AIx/+gCM//oAjX/6AI3/+gCOf/oAjv/6AI9/+gCP//oAkH/6AJD/+gCRf/oAkf/6AJJ/+gCa//qAm3/6gJv/+oClQALAxD/6AMW/+oDGAALAxz/6gM2/+gDOP/qAzr/6AM7AAsDPf/oA0QACwNMAAsDTQAMA04ADANSAAwDXP/oA2EACwNi/+gDZ//oA2kACwN1/+gDd//oA3j/6AOC/+oDhP/oA4b/6gOKAAsDjAALA44ACwOV/+gDsf/oA7P/6AO1/+gDt//oA7n/6AO7/+gDvf/oA7//6APF/+oDx//qA8n/6gPL/+oDzf/qA8//6gPR/+oD0//oA9X/6APX/+gD2f/qA9v/6APrAAsD7QALA+8ACwAMAFr/7QBc/+0A6f/tApj/7QKa/+0CnP/tAzz/7QNs/+0Dev/tA5T/7QP5/+0EAf/tAAwAWv/yAFz/8gDp//ICmP/yApr/8gKc//IDPP/yA2z/8gN6//IDlP/yA/n/8gQB//IAHwBY//QAWv/yAFv/9ABc//MAuP/0AOn/8gEV//QCJv/0Aif/9AKV//QCmP/zApr/8wKc//MDGP/0Azv/9AM8//IDRP/0A0z/9ANh//QDaf/0A2z/8gN6//IDiv/0A4z/9AOO//QDlP/yA+v/9APt//QD7//0A/n/8gQB//IAeQAE/8oACf/KADb/0gA4/9QAOv/0ADv/0wBP/9EAUP/RAFL/0QBY/+YAWv/vAFv/5gC4/+YAvP/RAM3/0gDR/9IA1f/0ANn/7QDc/+EA5//RAOn/7wDr/9EA7P/RAO7/0QDv/9EA8P/RAPP/0QD1/9EA9v/RAPn/0QD7/9EBAP/RART/1AEV/+YBLv/SATH/0QE2/9IBQP/RAUX/0QFl/8oBZv/KAWj/ygFp/8oBav/KAgv/0wIc/9ECJv/mAif/5gJk/9ECZv/RAmj/0QJp/9ECgP/SAoL/0gKE/9IClP/TApX/5gKW/9MC/f/TAwz/0wMN//QDD//TAxL/0QMY/+YDJ//tAzP/0gM0//QDN//RAzn/0QM7/+YDPP/vAz7/0QND/9EDRP/mA0v/0wNM/+YDTf/KA07/ygNS/8oDVP/RA13/0QNg/9QDYf/mA2j/0wNp/+YDa//0A2z/7wN5//QDev/vA37/0QOA/9EDif/tA4r/5gOL/+0DjP/mA43/7QOO/+YDj//hA5L/0QOT//QDlP/vA+r/0wPr/+YD7P/TA+3/5gPu/9MD7//mA/P/0QP1/9ED9v/SA/j/9AP5/+8D+v/hA/z/4QP//9EEAP/0BAH/7wQM/9EEDv/RBBD/0QQT/9MAHQA2/74AWP/vAFv/7wC4/+8Azf++ANH/vgEV/+8BLv++ATb/vgIm/+8CJ//vAoD/vgKC/74ChP++ApX/7wMY/+8DM/++Azv/7wNE/+8DTP/vA2H/7wNp/+8Div/vA4z/7wOO/+8D6//vA+3/7wPv/+8D9v++ADQANv/mADj/5wA6//IAO//nAFr/8QDN/+YA0f/mANX/8gDZ/+4A3P/oAOn/8QEU/+cBLv/mATb/5gIL/+cCgP/mAoL/5gKE/+YClP/nApb/5wL9/+cDDP/nAw3/8gMP/+cDJ//uAzP/5gM0//IDPP/xA0v/5wNg/+cDaP/nA2v/8gNs//EDef/yA3r/8QOJ/+4Di//uA43/7gOP/+gDk//yA5T/8QPq/+cD7P/nA+7/5wP2/+YD+P/yA/n/8QP6/+gD/P/oBAD/8gQB//EEE//nAIQAIwAQACX/6AAp/+gAMf/oADP/6AA2/+AAOP/gADv/3wCB/+gAkP/oAJT/6ACtABAArv/oAK8AEADN/+AAzv/oAM8AEADR/+AA2AAQANz/4QDtABAA9P/gAP8AEAED/+gBCAAQARL/6AEU/+ABFv/oARj/6AEa/+gBHP/oAS7/4AE0/+gBNv/gAU0AEAFR/+gB8QAQAfIAEAHzABAB9AAQAfUAEAH2ABAB9wAQAfj/6AIC/+gCA//oAgT/6AIF/+gCBv/oAgv/3wIoABACKgAQAiwAEAIu/+gCMP/oAjL/6AI0/+gCQv/oAkT/6AJG/+gCSP/oAmr/6AJs/+gCbv/oAoD/4AKC/+AChP/gApT/3wKW/98Cn//oAvgAEAL8/+gC/f/fAwAAEAMJ/+gDDP/fAw//3wMoABADL//oAzL/6AMz/+ADS//fA1UAEANX/+gDYP/gA2P/6ANm/+gDaP/fA24AEANwABADgf/oA4P/6AOF/+gDj//hA5D/4AOWABADlwAQA5gAEAOaABADnAAQA54AEAOgABADogAQA6QAEAOmABADqAAQA6oAEAOsABADrgAQA8T/6APG/+gDyP/oA8r/6APM/+gDzv/oA9D/6APS/+gD1P/oA9b/6APY/+gD2v/oA+r/3wPs/98D7v/fA/b/4AP6/+ED+//gA/z/4QP9/+AEEQAQBBIAEAQT/98ALQA2//EAOP/0ADr/9AA7//AAzf/xAM//9QDR//EA1f/0ANj/9QDZ//MBFP/0AS7/8QE2//EBTf/1Agv/8AKA//ECgv/xAoT/8QKU//AClv/wAv3/8AMM//ADDf/0Aw//8AMn//MDM//xAzT/9ANL//ADYP/0A2j/8ANr//QDef/0A4n/8wOL//MDjf/zA5P/9AOW//UD6v/wA+z/8APu//AD9v/xA/j/9AQA//QEEf/1BBP/8ABZACMADwA2/+YAOP/mADoADgA7/+YArQAPAK8ADwDN/+YAzwAOANH/5gDVAA4A2AAOANkACwDc/+UA7QAPAPT/6AD/AA8BCAAPART/5gEu/+YBNv/mAU0ADgHxAA8B8gAPAfMADwH0AA8B9QAPAfYADwH3AA8CC//mAigADwIqAA8CLAAPAoD/5gKC/+YChP/mApT/5gKW/+YC+AAPAv3/5gMAAA8DDP/mAw0ADgMP/+YDJwALAygADwMz/+YDNAAOA0v/5gNVAA8DYP/mA2j/5gNrAA4DbgAPA3AADwN5AA4DiQALA4sACwONAAsDj//lA5D/6AOTAA4DlgAOA5cADwOYAA8DmgAPA5wADwOeAA8DoAAPA6IADwOkAA8DpgAPA6gADwOqAA8DrAAPA64ADwPq/+YD7P/mA+7/5gP2/+YD+AAOA/r/5QP7/+gD/P/lA/3/6AQAAA4EEQAOBBIADwQT/+YALgA2/+MAOv/lADv/5ADN/+MAz//lANH/4wDV/+UA2P/lANn/6QDt/+oA///qAS7/4wE2/+MBTf/lAgv/5AKA/+MCgv/jAoT/4wKU/+QClv/kAv3/5AMM/+QDDf/lAw//5AMn/+kDM//jAzT/5QNL/+QDaP/kA2v/5QN5/+UDif/pA4v/6QON/+kDk//lA5b/5QOX/+oD6v/kA+z/5APu/+QD9v/jA/j/5QQA/+UEEf/lBBL/6gQT/+QAIQA2/+IAOv/kAM3/4gDP/+QA0f/iANX/5ADY/+QA2f/pAO3/6wD//+sBLv/iATb/4gFN/+QCgP/iAoL/4gKE/+IDDf/kAyf/6QMz/+IDNP/kA2v/5AN5/+QDif/pA4v/6QON/+kDk//kA5b/5AOX/+sD9v/iA/j/5AQA/+QEEf/kBBL/6wAXADb/6wA7//MAzf/rANH/6wEu/+sBNv/rAgv/8wKA/+sCgv/rAoT/6wKU//MClv/zAv3/8wMM//MDD//zAzP/6wNL//MDaP/zA+r/8wPs//MD7v/zA/b/6wQT//MAMABP/+8AUP/vAFL/7wBa//AAvP/vAOf/7wDp//AA6//vAOz/7wDu/+8A7//vAPD/7wDz/+8A9f/vAPb/7wD5/+8A+//vAQD/7wEx/+8BQP/vAUX/7wIc/+8CZP/vAmb/7wJo/+8Caf/vAxL/7wM3/+8DOf/vAzz/8AM+/+8DQ//vA1T/7wNd/+8DbP/wA3r/8AN+/+8DgP/vA5L/7wOU//AD8//vA/X/7wP5//AD///vBAH/8AQM/+8EDv/vBBD/7wAdAAT/8gAJ//IAWP/1AFv/9QC4//UBFf/1AWX/8gFm//IBaP/yAWn/8gFq//ICJv/1Aif/9QKV//UDGP/1Azv/9QNE//UDTP/1A03/8gNO//IDUv/yA2H/9QNp//UDiv/1A4z/9QOO//UD6//1A+3/9QPv//UABAD0/+0DkP/tA/v/7QP9/+0ACgAE//UACf/1AWX/9QFm//UBaP/1AWn/9QFq//UDTf/1A07/9QNS//UAVABF//AARv/wAEf/8ABJ//AAUf/rAFP/8ACR//AAlf/wALb/8ADD//AAxP/wAPL/8AD+//ABE//rARn/8AEd//ABNf/wAUf/8AFI//ABUv/wAhP/8AIU//ACFf/wAhb/8AIX//ACHf/rAh7/6wIf/+sCIP/rAiH/6wIv//ACMf/wAjP/8AI1//ACN//wAjn/8AI7//ACPf/wAj//8AJB//ACQ//wAkX/8AJH//ACSf/wAmv/6wJt/+sCb//rAxD/8AMW/+sDHP/rAzb/8AM4/+sDOv/wAz3/8ANc//ADYv/wA2f/8AN1//ADd//wA3j/8AOC/+sDhP/wA4b/6wOV//ADsf/wA7P/8AO1//ADt//wA7n/8AO7//ADvf/wA7//8APF/+sDx//rA8n/6wPL/+sDzf/rA8//6wPR/+sD0//wA9X/8APX//AD2f/rA9v/8ACPAAQADQAJAA0AQ//wAEX/sABG/7AAR/+wAEn/sABR/9YAU/+wAFgACwBbAAsAkf+wAJX/sAC2/7AAuAALAMT/sADt/68A8v+wAP7/sAD//68BE//WARUACwEZ/7ABHf+wATX/sAFH/7ABSP+wAVL/sAFlAA0BZgANAWgADQFpAA0BagANAgz/8AIN//ACDv/wAg//8AIQ//ACEf/wAhL/8AIT/7ACFP+wAhX/sAIW/7ACF/+wAh3/1gIe/9YCH//WAiD/1gIh/9YCJgALAicACwIp//ACK//wAi3/8AIv/7ACMf+wAjP/sAI1/7ACN/+wAjn/sAI7/7ACPf+wAj//sAJB/7ACQ/+wAkX/sAJH/7ACSf+wAmv/1gJt/9YCb//WApUACwMQ/7ADFv/WAxgACwMc/9YDNf/wAzb/sAM4/9YDOv+wAzsACwM9/7ADRAALA0wACwNNAA0DTgANA1IADQNW//ADXP+wA2EACwNi/7ADZ/+wA2kACwNv//ADcf/wA3X/sAN3/7ADeP+wA4L/1gOE/7ADhv/WA4oACwOMAAsDjgALA5X/sAOX/68Dmf/wA5v/8AOd//ADn//wA6H/8AOj//ADpf/wA6f/8AOp//ADq//wA63/8AOv//ADsf+wA7P/sAO1/7ADt/+wA7n/sAO7/7ADvf+wA7//sAPF/9YDx//WA8n/1gPL/9YDzf/WA8//1gPR/9YD0/+wA9X/sAPX/7AD2f/WA9v/sAPrAAsD7QALA+8ACwQS/68ACADtABAA9P/wAP8AEAOQ//ADlwAQA/v/8AP9//AEEgAQAEUARQAMAEYADABHAAwASQAMAFMADACRAAwAlQAMALYADADDAAwAxAAMAO0AGADyAAwA9P/3AP4ADAD/ABgBGQAMAR0ADAE1AAwBRwAMAUgADAFSAAwCEwAMAhQADAIVAAwCFgAMAhcADAIvAAwCMQAMAjMADAI1AAwCNwAMAjkADAI7AAwCPQAMAj8ADAJBAAwCQwAMAkUADAJHAAwCSQAMAxAADAM2AAwDOgAMAz0ADANcAAwDYgAMA2cADAN1AAwDdwAMA3gADAOEAAwDkP/3A5UADAOXABgDsQAMA7MADAO1AAwDtwAMA7kADAO7AAwDvQAMA78ADAPTAAwD1QAMA9cADAPbAAwD+//3A/3/9wQSABgAHwBY//QAWv/wAFv/9AC4//QA6f/wAO3/8wD///MBFf/0Aib/9AIn//QClf/0Axj/9AM7//QDPP/wA0T/9ANM//QDYf/0A2n/9ANs//ADev/wA4r/9AOM//QDjv/0A5T/8AOX//MD6//0A+3/9APv//QD+f/wBAH/8AQS//MACgAE/9YACf/WAWX/1gFm/9YBaP/WAWn/1gFq/9YDTf/WA07/1gNS/9YACgAE//UACf/1AWX/9QFm//UBaP/1AWn/9QFq//UDTf/1A07/9QNS//UAXgAEAAsACQALAEX/6wBG/+sAR//rAEn/6wBR/+kAU//rAJH/6wCV/+sAtv/rAMP/6wDE/+sA8v/rAP7/6wET/+kBGf/rAR3/6wE1/+sBR//rAUj/6wFS/+sBZQALAWYACwFoAAsBaQALAWoACwIT/+sCFP/rAhX/6wIW/+sCF//rAh3/6QIe/+kCH//pAiD/6QIh/+kCL//rAjH/6wIz/+sCNf/rAjf/6wI5/+sCO//rAj3/6wI//+sCQf/rAkP/6wJF/+sCR//rAkn/6wJr/+kCbf/pAm//6QMQ/+sDFv/pAxz/6QM2/+sDOP/pAzr/6wM9/+sDTQALA04ACwNSAAsDXP/rA2L/6wNn/+sDdf/rA3f/6wN4/+sDgv/pA4T/6wOG/+kDlf/rA7H/6wOz/+sDtf/rA7f/6wO5/+sDu//rA73/6wO//+sDxf/pA8f/6QPJ/+kDy//pA83/6QPP/+kD0f/pA9P/6wPV/+sD1//rA9n/6QPb/+sAAgseAAQAAA3mFToAIQAdAAAAEf/O/48AEv/1/+//iP/0/7v/f//1AAz/qf+i/8kAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+UAAAAA/+j/yQAA//MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARAAD/5QARAAAAAAAAAAAAAP/jAAAAAAAA/+T/5AAAABIAEQAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/4QAAAAAAAAAAAAAAAAAAAAD/5QAAAAD/6v/VAAAAAP/r/+r/mv/pAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+YAAAAAAAAAAAAA/+0AAAAU/+8AAAAAAAAAAAAAAAAAAAAAAAD/7QAAAAAAAAAAAAAAAAAAAAD/y/+4/3z/fv/kAAAAAP+dAA8AEP+h/8QAEAAQAAAAAP+xAAD/JgAA/53/s/8Y/5P/8P+P/4z/EAAA/5L/cv8M/w//vQAAAAD/RAAFAAf/S/+GAAcABwAAAAD/PgAA/noAAP9E/2r+Yv8z/9H/LP8nAAAAAAAAAAAAAP/YAAAAAAAA/+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/7AAAAAAAAAAAAAAAAAAAAAAAAP/Y/6MAAP/hAAAAAP/lAAAAAP/pAAAAAAAAAAAAAAAAAAAAAAAA/+YAAP/A/+kAAAAAAAAAAAAAAAD/ewAAAAD/v//K/3YAAP9x/u3/1AAA/1H/EQAAAAAAEwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/JAA8AAP/ZAAAAAAAA//MAAAAAAAAAAAAAAAAAAAAA/3b/4f68/+b/8wAAAAAAAAAA//UAAP84AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/qAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/9QAAAAD/8wAAAAD/0gAAAAD/5AAAAAAAAAAAAAD/tQAA/x8AAP/UAAD/2wAAAAD/0gAAAAAAAAAR/+H/0QAR/+cAAAAA/+sAAAAA/+sAAAAOAAAAAAAAAAAAAAAAAAD/5gAA/9IAAAAAAAAAAAAAAAAAAP/sAAAAAP/j/6AAAP+/ABEAEf/Z/+IAEgASAAAAAP+iAA3/LQAA/7//6f/M/9j/8P+3/8b/oAAAAAAAAAAAAAAAAAAAAAD/4QAAAA7/7QAAAAAAAAAAAAD/1QAA/4UAAP/hAAD/xAAAAAD/3wAAAAAAAAAA/+UAAAAA/+YAAAAA/+sAAAAA/+0AAAAAAAAAAAAAAA0AAAAAAAD/6wAAAAAAAAAAAAAAAAAAAAD/ygAA/+n/u//pAAAAAP+9AAAAEgAAAAAAAAASAAAAAP+lAAD+bQAA/70AAP+J/5oAAP+R/9IAAAAAAAD/8QAAAAAAAAAA/70AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/1AAD/8gAAAAD/4wAAAAAAAAAA//EAAAAAAAAAAAAAAAAAAAAAAAD/8QAAAAAAAAAAAAAAAAAAAAD/8wAAAAAAAAAA//IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/xAAD/8AAAAAD/7AAAAAAAAAAA//AAAAAAAAAAAAAAAAAAAAAAAAD/6wAAAAAAAAAAAAAAAAAAAAAAAAAA/9cAAAAAAA//8QAAAAAAAAAAAAAAAAAAAAAAAAAA/5UAAP/zAAAAAAAAAAD/8QAAAAAAAAAAABIAAAAAAAAAAAAQ/+wAAAAAAAAAAAAAAAAAAAAAAAAAAP+FAAD/7QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/sAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP+V/8MAAAAAAAAAAAAAAAAAAAAA/4gAAAAAAAD/xQAAAAD/7AAA/87/sAAAAAAAAAAAAAAAAAAAAAD/VgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//UAAAAAAAAAAAAA/8AAAAAA/vUAAAAA/8j/rf/n/+sAAP/wAAAAAAAA/8kAAAAAAAAAAAAAAAAAAAAA/93/2QAAAAAAAP95AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/1AAAAAAAAAAAAAAAAAAIAiAAEAAQAAAAJAAkAAQARABEAAgAjACgAAwAqADMACQA2ADwAEwBDAEQAGgBHAEgAHABKAEoAHgBPAFIAHwBUAFQAIwBYAFgAJABaAFsAJQCIAIgAJwCZAJkAKACsALAAKQCyALQALgC2ALYAMQC4ALkAMgC7ALwANAC+AMAANgDCAMcAOQDNAM0APwDPANkAQADbANsASwDdAN8ATADhAOMATwDlAOkAUgDsAOwAVwDxAPMAWAD2APcAWwD5APsAXQD/AQAAYAEFAQUAYgEIAQgAYwETARUAZAEnASkAZwEsASwAagEuAS4AawFFAUUAbAFlAWYAbQFoAWoAbwGmAaYAcgGpAakAcwGrAasAdAGwAbEAdQG0AbYAdwG4Ab4AegHEAcQAgQHbAdwAggHoAegAhAHsAe0AhQHvAe8AhwHxAhIAiAIUAhcAqgIcAiEArgImAi4AtAIwAjAAvQIyAjIAvgI0AjQAvwI2AjYAwAI4AkEAwQJKAkwAywJOAk4AzgJQAlAAzwJSAlIA0AJUAlQA0QJXAlcA0gJZAlkA0wJbAlsA1AJdAl0A1QJfAl8A1gJhAmEA1wJjAm8A2AJxAnEA5QJzAnMA5gJ1AnUA5wKAAoAA6AKCAoIA6QKEAoQA6gKGAoYA6wKIAogA7AKKAooA7QKMAowA7gKOAo4A7wKQApAA8AKSApIA8QKUApcA8gKZApkA9gKbApsA9wL4Av0A+AMAAw8A/gMSAxIBDgMWAxYBDwMYAxgBEAMcAxwBEQMfAyABEgMiAysBFAMtAy8BHgMxAzYBIQM4AzkBJwM7Az4BKQNEA0UBLQNHA0cBLwNJA0kBMANLA04BMQNSA1cBNQNaA1oBOwNcA1wBPANgA2EBPQNmA2YBPwNoA3EBQAN0A3UBSgN3A3oBTAOBA4IBUAOGA4YBUgOIA44BUwOTA5QBWgOYA8ABXAPCA8IBhQPEA9EBhgPZA9kBlAPcA9wBlQPeA94BlgPqA+8BlwPyA/IBnQP0A/QBngP2A/YBnwP4A/kBoAP+BAEBogQEBAQBpgQGBAcBpwQJBAkBqQQNBA0BqgQPBA8BqwQTBBMBrAABAAoACgAoADMANAA9AEgATQBWAFkAXQABACIAmQCwALIAswC0ALsAvgC/AMAAxQDHAMgAyQDNANEA0wDUANYA3gDiAOMA5ADlAOYA6ADqAOwA8QDzAPYA+wD+AR0B3AACAHYABAAEAAAACQAJAAEADgAOAAIAEAAQAAMAIwAnAAQAKgAyAAkANgA8ABIAQwBFABkARwBHABwASgBKAB0ATwBSAB4AVABUACIAWABYACMAWgBcACQAiACIACcArACvACgAuAC4ACwAvAC8AC0AwgDCAC4AzwDQAC8A0gDSADEA1QDVADIA1wDZADMA2wDbADYA3QDdADcA3wDfADgA4QDhADkA5wDnADoA6QDpADsA8gDyADwA9wD3AD0A+QD6AD4A/wEAAEABBQEFAEIBCAEIAEMBEwEVAEQBJwEpAEcBLAEsAEoBLgEuAEsBRQFFAEwBZQFrAE0BbwFwAFQB7AHtAFYB7wHvAFgB8QIXAFkCHAIhAIACJgI2AIYCOAJBAJcCSgJMAKECTgJOAKQCUAJQAKUCUgJSAKYCVAJUAKcCVwJXAKgCWQJZAKkCWwJbAKoCXQJdAKsCXwJfAKwCYQJhAK0CYwJvAK4CcQJxALsCcwJzALwCdQJ1AL0CgAKAAL4CggKCAL8ChAKEAMAChgKGAMECiAKIAMICigKKAMMCjAKMAMQCjgKOAMUCkAKQAMYCkgKSAMcClAKcAMgC+AL9ANEDAAMPANcDEgMSAOcDFgMWAOgDGAMYAOkDHAMcAOoDHwMgAOsDIgMrAO0DLQMvAPcDMQM2APoDOAM+AQADRANFAQcDRwNHAQkDSQNJAQoDSwNOAQsDUgNXAQ8DWgNaARUDXANcARYDYANhARcDZgNxARkDdAN1ASUDdwN6AScDgQOCASsDhgOGAS0DiAOOAS4DkwOUATUDmAPAATcDwgPCAWADxAPRAWED2QPZAW8D3APcAXAD3gPeAXED6gPvAXID8gPyAXgD9AP0AXkD9gP2AXoD+AP5AXsD/gQBAX0EBAQEAYEEBgQHAYIECQQJAYQEDQQNAYUEDwQPAYYEEwQTAYcAAgE4AAQABAAdAAkACQAdAA4ADgAeABAAEAAeACQAJAABACUAJQAEACYAJgADACcAJwAFACoAKwACACwALAAMAC0ALQAJAC4ALgAKAC8AMAACADEAMQADADIAMgALADYANgAGADcANwAMADgAOAANADkAOQAQADoAOgAOADsAOwAPADwAPAARAEMAQwATAEQARAAVAEUARQAUAEcARwAWAEoASgAXAE8AUAAXAFEAUQAYAFIAUgAVAFQAVAAaAFgAWAAZAFoAWgAbAFsAWwAZAFwAXAAcAIgAiAAVAKwArAAHAK4ArgADALgAuAAZALwAvAAXAMIAwgAVAM8A0AAfANIA0gACANUA1QAOANcA2AACANkA2QASANsA2wACAN0A3QACAN8A3wAfAOEA4QAfAOcA5wAIAOkA6QAbAPIA8gAVAPcA9wAgAPkA+QAgAPoA+gAVAP8BAAAgAQUBBQAgARMBEwAYARQBFAANARUBFQAZAScBJwAVASgBKAAHASkBKQAIASwBLAAJAS4BLgAJAUUBRQAIAWUBZgAdAWcBZwAeAWgBagAdAWsBawAeAW8BcAAeAewB7QADAe8B7wAGAfgB+AAEAfkB/AAFAf0CAQACAgICBgADAgcCCgAMAgsCCwAPAgwCEgATAhMCEwAUAhQCFwAWAhwCHAAXAh0CIQAYAiYCJwAZAikCKQATAisCKwATAi0CLQATAi4CLgAEAi8CLwAUAjACMAAEAjECMQAUAjICMgAEAjMCMwAUAjQCNAAEAjUCNQAUAjYCNgADAjgCOAAFAjkCOQAWAjoCOgAFAjsCOwAWAjwCPAAFAj0CPQAWAj4CPgAFAj8CPwAWAkACQAAFAkECQQAWAkoCSgACAksCSwAXAkwCTAACAk4CTgACAlACUAACAlICUgACAlQCVAACAlcCVwAMAlkCWQAJAlsCWwAKAl0CXQAKAl8CXwAKAmECYQAKAmMCYwACAmQCZAAXAmUCZQACAmYCZgAXAmcCZwACAmgCaQAXAmoCagADAmsCawAYAmwCbAADAm0CbQAYAm4CbgADAm8CbwAYAnECcQAaAnMCcwAaAnUCdQAaAoACgAAGAoICggAGAoQChAAGAoYChgAMAogCiAAMAooCigAMAowCjAAMAo4CjgAMApACkAAMApICkgAQApQClAAPApUClQAZApYClgAPApcClwARApgCmAAcApkCmQARApoCmgAcApsCmwARApwCnAAcAvkC+QAFAvoC+wACAvwC/AADAv0C/QAPAwEDAQABAwIDAgAFAwMDAwARAwQDBQACAwYDBgAJAwcDCAACAwkDCQADAwoDCgALAwsDCwAGAwwDDAAPAw0DDQAOAw4DDgACAw8DDwAPAxIDEgAXAxYDFgAYAxgDGAAZAxwDHAAYAx8DHwAFAyADIAAHAyIDIwACAyQDJAAMAyUDJgAJAycDJwASAykDKQABAyoDKgAHAysDKwAFAy0DLgACAy8DLwADAzEDMQALAzIDMgAEAzMDMwAGAzQDNAAOAzUDNQATAzYDNgAWAzgDOAAYAzkDOQAVAzoDOgAUAzsDOwAZAzwDPAAbAz0DPQAWAz4DPgAIA0QDRAAZA0UDRQAQA0cDRwAQA0kDSQAQA0sDSwAPA0wDTAAZA00DTgAdA1IDUgAdA1MDUwACA1QDVAAXA1YDVgATA1cDVwADA1oDWgAFA1wDXAAWA2ADYAANA2EDYQAZA2YDZgAEA2cDZwAUA2gDaAAPA2kDaQAZA2oDagACA2sDawAOA2wDbAAbA20DbQACA28DbwATA3EDcQATA3QDdAAFA3UDdQAWA3cDeAAWA3kDeQAOA3oDegAbA4EDgQADA4IDggAYA4YDhgAYA4gDiAAVA4kDiQASA4oDigAZA4sDiwASA4wDjAAZA40DjQASA44DjgAZA5MDkwAOA5QDlAAbA5kDmQATA5sDmwATA50DnQATA58DnwATA6EDoQATA6MDowATA6UDpQATA6cDpwATA6kDqQATA6sDqwATA60DrQATA68DrwATA7ADsAAFA7EDsQAWA7IDsgAFA7MDswAWA7QDtAAFA7UDtQAWA7YDtgAFA7cDtwAWA7gDuAAFA7kDuQAWA7oDugAFA7sDuwAWA7wDvAAFA70DvQAWA74DvgAFA78DvwAWA8ADwAACA8IDwgACA8QDxAADA8UDxQAYA8YDxgADA8cDxwAYA8gDyAADA8kDyQAYA8oDygADA8sDywAYA8wDzAADA80DzQAYA84DzgADA88DzwAYA9AD0AADA9ED0QAYA9kD2QAYA9wD3AAMA94D3gAMA+oD6gAPA+sD6wAZA+wD7AAPA+0D7QAZA+4D7gAPA+8D7wAZA/ID8gAJA/QD9AACA/YD9gAGA/gD+AAOA/kD+QAbA/4D/gAHA/8D/wAIBAAEAAAOBAEEAQAbBAQEBAAXBAYEBgAfBAcEBwAHBAkECQAJBA0EDQACBA8EDwACBBMEEwAPAAEABAQWAAcAAAAAAAAAAAAHAAAAAAAAAAAAEwAXABMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAUAAAAAAAAABQAAAAAAHAAAAAAAAAAAAAUAAAAFAAAAGQAKAAYADQAJABIADgAUAAAAAAAAAAAAAAAAABoAAAAVABUAFQAAABUAAAAAAAAAAAAAABgAGAAIABgAFQAAABsAAAALAAIAAAAWAAIADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFABUAAAAAAAUAFQAAAAsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAFABEAAAAAAAAAAAAAAAAAFQAAAAIAAAAAAAAAGAAAAAAAAAAAAAAAAAAVABUAAAALAAAAAAAAAAAAAAAAAAoABQABAAAACgAAAAAAAAASAAAAAAABABAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAFgAAABgAGAAEABgAGAAYAAAAFQAYAAMAGAAYAAAAAAAYAAAAGAAAAAAAFQAEABgAAAAAAAUAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAUACAANAAIABQAAAAUAFQAFAAAABQAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAAAGAAAAAAABQAVAAoAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAABgAAAAVABUAAAAAAAAAAAABAAAAAAAAAAUAFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXABcAAAAHAAcAEwAHAAcABwATAAAAAAAAABMAEwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFwAAAAAAAAAAAAAAEQARABEAEQARABEAEQAFAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAGAAYABgAGAA4AGgAaABoAGgAaABoAGgAVABUAFQAVABUAAAAAAAAAAAAYAAgACAAIAAgACAALAAsACwALAAIAAgARABoAEQAaABEAGgAFABUABQAVAAUAFQAFABUAAAAVAAAAFQAAABUAAAAVAAAAFQAAABUABQAVAAUAFQAFABUABQAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAGAAAABgAGAAFAAgABQAIAAUACAAAAAAAAAAAAAAAAAAZABsAGQAbABkAGwAZABsAGQAbAAoAAAAKAAAACgAAAAYACwAGAAsABgALAAYACwAGAAsABgALAAkAAAAOAAIADgAUAAwAFAAMABQADAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEAAAAAAAAABQAOAAAAAAARAAAAAAAUAAAAAAAAAAAAAAAFAAAAAAAOABIAAAAOABUAAAAYAAAACwAAAAgAAAACAAAAAAALAAgACwAAAAAAAAAAAAAAAAAcAAAAAAAQABEAAAAAAAAAAAAAAAAABQAAAAAABQAKABIAGgAVABgACAAYABUAAgAWABUAGAAbAAAAAAAAABgAAgAJAAAACQAAAAkAAAAOAAIABwAHAAAAAAAAAAcAAAAYABEAGgAFAAAAAAAAAAAAFQAYAAAAAAANAAIAFQAFAAAAAAAFABUADgACAAAAEgAWAAAAEQAaABEAGgAAAAAAAAAVAAAAFQAVABIAFgAAAAAAAAAYAAAAGAAFAAgABQAVAAUACAAAAAAAEAACABAAAgAQAAIADwADAAAAGAASABYAFQABAAQAEQAaABEAGgARABoAEQAaABEAGgARABoAEQAaABEAGgARABoAEQAaABEAGgARABoAAAAVAAAAFQAAABUAAAAVAAAAFQAAABUAAAAVAAAAFQAAAAAAAAAAAAUACAAFAAgABQAIAAUACAAFAAgABQAIAAUACAAFABUABQAVAAUAFQAFAAgABQAVAAYACwAGAAsAAAALAAAACwAAAAsAAAALAAAACwAOAAIADgACAA4AAgAAAAAAAAAYAAAAGAAKAAAAEgAWAA8AAwAPAAMAAAAYABIAFgAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAYAAAAGAABAAQADgAAAAAAAAAAAAAAFwABAAAACgAsAI4AAURGTFQACAAEAAAAAP//AAgAAAABAAIAAwAEAAUABgAHAAhsaWdhADJsbnVtADhzbWNwAD5zczAxAERzczAyAEpzczAzAFBzczA0AFZzczA1AFwAAAABAAEAAAABAAIAAAABAAAAAAABAAMAAAABAAQAAAABAAUAAAABAAYAAAABAAcACAASABoAIgAqADIAOgBCAEoAAQAAAAEAQAAEAAAAAQH2AAEAAAABAgAAAQAAAAECEgABAAAAAQIQAAEAAAABAg4AAQAAAAECDAABAAAAAQIOAAICEADcAaYBpwGoAakBqgGrAawBrQGuAa8BsAGxAbIBswG0AegBtQG2AbcBuAG5AboBuwG8Ab0BvgGmAacBqAGpAaoBqwGsAa0BrgGvAbABsQGyAbMBtAHoAbUBtgG3AbgBuQG6AbsBvAG9Ab4C9wKiAqECogKjAqMCpAKlAqYCpwKoAqkCqgKrAqwCrQKuAq8CsAKxArICswK0ArUCtgK3ArgCuQK6ArsCvAK9Ar4CpAKlAqYCpwKoAqkCqgKrAqwCrQKuAq8CsAKxArICswK0ArUCtgK3ArgCuQK6ArsCvAK9Ar4C8wK/Ar8CwALAAsECwQLCAsICwwLDAsUCxQLGAsYCxwLHAsgCyALJAskCygLKAssCywLMAswCzQLNAs8CzwLQAtAC0QLRAtIC0gLTAtMC1ALUAtUC1gLWAtcC1wLYAtgC2QLZAtoC2gLbAtsC3ALcAt0C3QLeAt4C3wLfAuAC4ALhAuEC4gLiAuMC4wLkAuQC5QLlAuYC5gLnAucC6ALo/////wLqAuoC6wLrAuwC7ALtAu0C7gLuAu8C7wLwAvAC8QLxAvIC8gLzAvQC9AL1AvUC9gL2AqEAAQCkAAEACAABAAQBkgACAEsAAgCYAAoBmAHMAcQB1gHXAdgB2QHbAd0B5wABAIgBkQABAIgBKAABAIgBrgACAIgAAgHjAeQAAgB+AAIB5QHmAAIADQAjADwAAABDAFwAGgCDAIMANACFAIUANQHsAe0ANgHvAjEAOAI0AkUAewJIAlQAjQJXAmgAmgJqAnsArAJ+An8AvgKCApwAwAPwA/AA2wABAAEASAACAAEAEgAbAAAAAQABAEkAAQABALYAAQABADQAAQACAC0ATQ==","sampleImage.jpg":"/9j/4RC5RXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAgAAAAcgEyAAIAAAAUAAAAkodpAAQAAAABAAAAqAAAANQACvyAAAAnEAAK/IAAACcQQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaAAyMDE0OjAzOjE5IDAzOjAyOjI2AAAAAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAregAwAEAAAAAQAAATYAAAAAAAAABgEDAAMAAAABAAYAAAEaAAUAAAABAAABIgEbAAUAAAABAAABKgEoAAMAAAABAAIAAAIBAAQAAAABAAABMgICAAQAAAABAAAPfwAAAAAAAABIAAAAAQAAAEgAAAAB/9j/7QAMQWRvYmVfQ00AAf/uAA5BZG9iZQBkgAAAAAH/2wCEAAwICAgJCAwJCQwRCwoLERUPDAwPFRgTExUTExgRDAwMDAwMEQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBDQsLDQ4NEA4OEBQODg4UFA4ODg4UEQwMDAwMEREMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEIAEcAoAMBIgACEQEDEQH/3QAEAAr/xAE/AAABBQEBAQEBAQAAAAAAAAADAAECBAUGBwgJCgsBAAEFAQEBAQEBAAAAAAAAAAEAAgMEBQYHCAkKCxAAAQQBAwIEAgUHBggFAwwzAQACEQMEIRIxBUFRYRMicYEyBhSRobFCIyQVUsFiMzRygtFDByWSU/Dh8WNzNRaisoMmRJNUZEXCo3Q2F9JV4mXys4TD03Xj80YnlKSFtJXE1OT0pbXF1eX1VmZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3EQACAgECBAQDBAUGBwcGBTUBAAIRAyExEgRBUWFxIhMFMoGRFKGxQiPBUtHwMyRi4XKCkkNTFWNzNPElBhaisoMHJjXC0kSTVKMXZEVVNnRl4vKzhMPTdePzRpSkhbSVxNTk9KW1xdXl9VZmdoaWprbG1ub2JzdHV2d3h5ent8f/2gAMAwEAAhEDEQA/AO9gJbfNShKFatpsfcPNRJd31RITEJWpGH2A6Ex4KJPkilqbajYRqikpiPLXxRCxNtTrUjIP+1SG8cBPBT7dPPxStCVrslrQ5jdzBzw6FH7VaHSII7wOFCXARJA8FEiU0RHUBcZHoSn+1vPYfM/3qFmW94iI+CFt7dkmhoI3at7gcoiER0VxyPVmy2sCXyT4awpG9rj7Xlo7hQln5o2jxOqi41xLZJHc8flR4RfVXFpuFw92rnu0/NH96Gbn7uyR3Hkp20veJER5p1AbosnZg615/wByGSTyilkHmfgmhOBC031f/9D0X0H+B/BRNTx2VuJGibXwT/cLEcQae1w7JiPEK9BPITGuSj7ngj2uzS0SA3GByrbDXbu9Mts2OLX7TMOH0mP2/n/yU5YD2R9zwR7Xi0oTbJPCtuobOmiQpEzyUfcCPbLWYGQQ5m49j/BRLY5aFc2tA1H8U2yuZiZ7hLj808GjRI+SaFedTVOg7eJ/vUDUBwJThkC04i1NqYtVr0xPh8UtidxrfbLT2+SW1Wy1zR218lAsPgPkiJoMGtt+acNPafvRjWfBMKXeCPEFcJ7MRXqCYPknOODJbB8giCt4HA+9OGxyhxeK4R7h/9H0oOrJ0BkrKt+tf1aqkftKl7hI21v36jT832/9JXMfJqvxq8tocaLam3ca7Ht9SHfu+1ebV9K+vEAOz8MjQCK6NPvwv3ETKu31WgfyD1nUfrl0+7Dvx8O4tttrc1l5urrLCdBYwsdbZ7Vy7uo51vtyeqeuwGWtOXEGNu7+b/e9T/z3/wAIiYPS/rPvsPUcyl1XpONIx2Ywf62noeo63B/mPper/hFa6hg9XdjbenXVY+UXja+2ui2st2nfU5rsc+n7/f63v/0f+EQ4vGP8v8FRjfSX8v8ACaRynwWtzIaXF4aMsD3kbfUftq99n8tEZ1Tr24OZ1na9rmuaXXeq2AWy2ynaxtjH7bWfS/P/AOCV+vAzgykWuY6wCoXlooAc4N/WfT/Vvb6ln82sf6wvb0+thzzb+sY11eB9nc1hbmNLXm/I+zfY/wBV9F+P+js9f3+p+gTgSSBcde3/AKKigNalp3/9GenwfrK7HuvttvrubkHe6uyyGsf7W7qHbXenV6bPdR9D/DfT9b1bbvrphMfse7Ha/TT1XmZIa2HNoc125zmrygdRyw0l2RcWgSYsfMf5y1s7q31n6DRh05FuMx17C6ptNNZb6Iaz0t7m7avV93vZ6Pqf6W23/BGWMxIF3xfT/vlCYIJqq+r6APrv00jd6uOQYg+q/udjf8B+/wC1IfXfpZBd62PGkn1X95j/AAH8hy5vo3Vep5tIs9VucxzKnPvrqNba7X6ZHT3Ctu227EZsust/4VXWZnWDXW77HZvc6tr2fpJYHu2XWT6fubjs/Su/fTSCP/Ro/wDepsfyjJ12/XXpbo2247p4i1x7Od/oP3a3op+tOGOfRkcgXa/jUsO276xPAqxML1LrC1ostn06w71PWyLfWayt7cVlbLPTsf8ApPU/6zdh59HUbOq3VsuvZWAw2OqbY9lTjUyxtThhBzHOs+n+hZ/hEo2TV19YlE5AC6v/AAZPQdU691HJua7EzqsSoNLRWy2JcfznGH7vd/0FUHVOsguI6n7nd/XHA+hzT+7+6sjo7uo2ZIx2utbn12B11d9gLBjt2/bcd7Mh1lf2raf0T/T3s/01a231dXlxaKg0B4AJoJneDX/g/d+g3MTttLj/AIX/AKKs31qX+D/6Mh/afWWOcaupBhedzybgZMMYHH9D/oq9n+vv1em/WO6jGFebfVlW+oXG02iSwx+i+gz6KoCnqQquFjqha994xnA0FoDh/k9lkV/Srf8Azu7/AMGSNPUzdXHpCsPJtbux5dWai1rWONf0vteyz/i/+20r/rQ/l/gpArpL6/8AozvD609NPMsHjvpP4C5EH1gwHAFpJB1BBq/9Lrna6uoAsNoYWgs9QB1APBFv5jXN/SbHLhupY3Sq+qZdHUaX29QrD7sqyq6prHWemcq30mVYzWbXf8G1C+xifLVI8RIeb7FV1Kq8MNYJFhIafb23fuPf+4im0+C4j6o9Qpoqr6fSPTwcKy9ofY7c8Q9+nsrYxzH22vc36di6L9t9PLnMFji5oBPscNHFwb7nhrfzHJQnoeKtD+CZRNiuz//So9P6t9lyvVZYdzWw7ffW6sHIAxq77La273Mp+0faXv2Pr/R/y61rW9Uof0u7Hq610+nqLg4VZLMkOrYd+5jt17rMj+Y/Ru9n01yHoBzrnfaHO+02ltjHs3F1VTD6LtK9m+2/0/0dLdlf6JZ7sKxtRfXjudYWPEtaT9L2Tua33e1yhjkjKJuUeIa1p6lvuAeP1e8t6i111j6vrBgsqdblvrYchntqupbV0ur/ANp+ZuybP+h6yVPUA2yp1v1gwbK2WYLrWjIr1ZRW5nV2/m/8p3/pK/8AwT0FwFXRszc26rFve1jg8ltDnCB7vptDmtRcfp2f6D/8mPe703kuNNhLvUdWx0kfS+zfTq/cUnCLriG29xTx+Bez+15rcQVH6z9P+0/ZfT9U3sg5H2n7T9r1bu2fsv8AUfo/T/wez9Ms/wDxg9SwModOGFfRlAPySfSsbb6YIx9v8y921/8AXXL4+Pa59RGF61T7W+nc+pzt7WN9F7Q4bGur/wAJsQXYWc1jLnY11eOwBrH+m4Md3cN8bfplKFcUSSB9YolOwRSZr5BG0vEGWjkgCXLR+tVmT9k6WMrqOP1O1oui7Gsa8MZtxvTx7BU1np2Vx+cqbcLIZiW5Ty2p1BINFpDbPaBqa3uZZ+dsbtZ9NaZ+qPT7cfbXlWNc0eqS/wBMQXtrcW27jX6fsZ/hXVqTJmx2JcYIhd0jHA0RXzVTd+p2Zk19IeMO3GpJuyTa3KtrDjb9noHT31Nt2foftf8AP/8ABroreo9R3H0Mrp4b+n27rqp/mK/2d+f/AOWXr/af+62xcfT9TulvL9+Y+ahLmudjVvH0tu6qy93q7q632/on2f8AFItv1J6d6DjXdk7thNbnMqDSfcWOc7d9BRGcJeoSBEtQWQAjStnr6uqZLMtrvtmAynfb7zfUNrPSr+yvd7zu2Zn2p13/AAXpLk+rue/qD3PvryXFtc30P31uOxo3V2sDGv8Ab7PooeJ9UacXJrttuBYJaRsDnOkW0xXTFvrPe70/0Xvs9/p/zivt6J0xtftyrxVUIkY73Na2SYL2VbW+47PejCUAdx9iyYMtK/Fn9V8vp2Jm7svZS8iwtzLbRWxjTWR6T22fo3Otd+et93VunHI3N6vhCo21PFf2lk+m1rhfXs1/nbNrvpf9crXP09N6bh9RpvGbacioE14z8Z1jXkhzJOOaX+t9P9z6f/CLHzvqu9nVMmvD+0XYlBcym9oL3OIDfz6WbPd+k3bNnpv+miZxJNHcVsgAgVWxv5v0v3fS9mOq4LWtbZ1nCL2ioPP2pp9zbN2Q76P+Eo/Rf+fP9Ig3dUrdU9tXX+nMsNdja3m0ECx14ux7CB+ZXgbsR/8AwvvWIei9Nx+nY7jj3WZDy9uTYWXFzWNtG+l7aR6fqOwnbX+33/p/T/SIWTi9Jrvx2YvRbcqm7+dt25bTUJj1Nrm/p2bHb/0aackSdfP5YhNVp4dZF6N/WcM2WFvWunitz8g1t9Yghjwz9nsJ93vxnNt+0O/7YXJZlfW39Qz3MutzK7LLXU5NJcWWNspu9I02e3fW2z0WN/4VJrayBP1WtDy/aW7skkN/0n0Vft6N0H7Xv/ZlrsU1vDpx8wOddvbsfJj2ej6nt/fSM4j/AHop+z7VsCy/p+Hm5OZQ47X3Xem/b7g4Ndv/AEgtY79I51n6Suz+aQXfXLCAhmExsN3Of+jBc1w9P/B4zPT99jXfo0+TV07Ccw4uC4Yz6bqvstldzPVvea/TZ6lm29vq07v8J/N1WqtQOmm7FOR0ZtGM+suyHD1niff6FQ3WHfTvbRY2ytD3IjU6691E+IH1f//T5lv7d/SFpyJIA1Do0+jLWt2/R+h6f5ikLetj2tF4siXEtkxHf2Ljklln2uvB/wA1qa+L1zr+pydzX7dd0tgydNf0f7qeh3Uy57i6xhcRIa0nQfR0LPbYuQSQPtUa4f8Amo1e1st6o4PFrrAOHbqwD/1H/f1Oo9TdYfTdYD/JBBn+wxrVw6SjPt1pw/8ANVr4vbi3qpLQPWEiG+0zHj7Wu9iEcnPEw1xAJDj6cDj3ep7P+qXGpJw9rrX/ADVavZi7Oa6WD3RqGMBdB+ju9n/mCduRcWtc4bdCA19bPLwZ/wCYLi0kvR4X9Favb13Zjmba/olx+gwDXvDhXt3JPuubra1jmtjcHsGzy3abVxCSaeG+n9qtXvqM7Elotx2SeIazU6bYhu5v8hWmWYj90MrAH0hAB/tbfztq83SUc6/RXC/B9JD8cPmptLrB9ICNxJ/ejanDmuZu2NYCBoD7QB2hpe3uvNUkxWr6W5w3htgZvj6RHb5u3KJFjhEsaBHplnh+Z9H6f530l5skiFPojxVuJN1Qsc7RvpSOP+i701EV4wc8NsYbDt3eQn9HG0Nf/VXnqSdqj7H/2f/tF+hQaG90b3Nob3AgMy4wADhCSU0EJQAAAAAAEAAAAAAAAAAAAAAAAAAAAAA4QklNBDoAAAAAAJMAAAAQAAAAAQAAAAAAC3ByaW50T3V0cHV0AAAABQAAAABDbHJTZW51bQAAAABDbHJTAAAAAFJHQkMAAAAASW50ZWVudW0AAAAASW50ZQAAAABDbHJtAAAAAE1wQmxib29sAQAAAA9wcmludFNpeHRlZW5CaXRib29sAAAAAAtwcmludGVyTmFtZVRFWFQAAAABAAAAOEJJTQQ7AAAAAAGyAAAAEAAAAAEAAAAAABJwcmludE91dHB1dE9wdGlvbnMAAAASAAAAAENwdG5ib29sAAAAAABDbGJyYm9vbAAAAAAAUmdzTWJvb2wAAAAAAENybkNib29sAAAAAABDbnRDYm9vbAAAAAAATGJsc2Jvb2wAAAAAAE5ndHZib29sAAAAAABFbWxEYm9vbAAAAAAASW50cmJvb2wAAAAAAEJja2dPYmpjAAAAAQAAAAAAAFJHQkMAAAADAAAAAFJkICBkb3ViQG/gAAAAAAAAAAAAR3JuIGRvdWJAb+AAAAAAAAAAAABCbCAgZG91YkBv4AAAAAAAAAAAAEJyZFRVbnRGI1JsdAAAAAAAAAAAAAAAAEJsZCBVbnRGI1JsdAAAAAAAAAAAAAAAAFJzbHRVbnRGI1B4bEBSAAAAAAAAAAAACnZlY3RvckRhdGFib29sAQAAAABQZ1BzZW51bQAAAABQZ1BzAAAAAFBnUEMAAAAATGVmdFVudEYjUmx0AAAAAAAAAAAAAAAAVG9wIFVudEYjUmx0AAAAAAAAAAAAAAAAU2NsIFVudEYjUHJjQFkAAAAAAAA4QklNA+0AAAAAABAASAAAAAEAAgBIAAAAAQACOEJJTQQmAAAAAAAOAAAAAAAAAAAAAD+AAAA4QklNBA0AAAAAAAQAAAB4OEJJTQQZAAAAAAAEAAAAHjhCSU0D8wAAAAAACQAAAAAAAAAAAQA4QklNJxAAAAAAAAoAAQAAAAAAAAACOEJJTQP1AAAAAABIAC9mZgABAGxmZgAGAAAAAAABAC9mZgABAKGZmgAGAAAAAAABADIAAAABAFoAAAAGAAAAAAABADUAAAABAC0AAAAGAAAAAAABOEJJTQP4AAAAAABwAAD/////////////////////////////A+gAAAAA/////////////////////////////wPoAAAAAP////////////////////////////8D6AAAAAD/////////////////////////////A+gAADhCSU0EAAAAAAAAAgABOEJJTQQCAAAAAAAEAAAAADhCSU0EMAAAAAAAAgEBOEJJTQQtAAAAAAAGAAEAAAACOEJJTQQIAAAAAAAQAAAAAQAAAkAAAAJAAAAAADhCSU0EHgAAAAAABAAAAAA4QklNBBoAAAAAA0sAAAAGAAAAAAAAAAAAAAE2AAACtwAAAAsAQgBlAHoAIABuAGEAegB3AHkALQAxAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAK3AAABNgAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAABAAAAAAAAbnVsbAAAAAIAAAAGYm91bmRzT2JqYwAAAAEAAAAAAABSY3QxAAAABAAAAABUb3AgbG9uZwAAAAAAAAAATGVmdGxvbmcAAAAAAAAAAEJ0b21sb25nAAABNgAAAABSZ2h0bG9uZwAAArcAAAAGc2xpY2VzVmxMcwAAAAFPYmpjAAAAAQAAAAAABXNsaWNlAAAAEgAAAAdzbGljZUlEbG9uZwAAAAAAAAAHZ3JvdXBJRGxvbmcAAAAAAAAABm9yaWdpbmVudW0AAAAMRVNsaWNlT3JpZ2luAAAADWF1dG9HZW5lcmF0ZWQAAAAAVHlwZWVudW0AAAAKRVNsaWNlVHlwZQAAAABJbWcgAAAABmJvdW5kc09iamMAAAABAAAAAAAAUmN0MQAAAAQAAAAAVG9wIGxvbmcAAAAAAAAAAExlZnRsb25nAAAAAAAAAABCdG9tbG9uZwAAATYAAAAAUmdodGxvbmcAAAK3AAAAA3VybFRFWFQAAAABAAAAAAAAbnVsbFRFWFQAAAABAAAAAAAATXNnZVRFWFQAAAABAAAAAAAGYWx0VGFnVEVYVAAAAAEAAAAAAA5jZWxsVGV4dElzSFRNTGJvb2wBAAAACGNlbGxUZXh0VEVYVAAAAAEAAAAAAAlob3J6QWxpZ25lbnVtAAAAD0VTbGljZUhvcnpBbGlnbgAAAAdkZWZhdWx0AAAACXZlcnRBbGlnbmVudW0AAAAPRVNsaWNlVmVydEFsaWduAAAAB2RlZmF1bHQAAAALYmdDb2xvclR5cGVlbnVtAAAAEUVTbGljZUJHQ29sb3JUeXBlAAAAAE5vbmUAAAAJdG9wT3V0c2V0bG9uZwAAAAAAAAAKbGVmdE91dHNldGxvbmcAAAAAAAAADGJvdHRvbU91dHNldGxvbmcAAAAAAAAAC3JpZ2h0T3V0c2V0bG9uZwAAAAAAOEJJTQQoAAAAAAAMAAAAAj/wAAAAAAAAOEJJTQQUAAAAAAAEAAAAAjhCSU0EDAAAAAAPmwAAAAEAAACgAAAARwAAAeAAAIUgAAAPfwAYAAH/2P/tAAxBZG9iZV9DTQAB/+4ADkFkb2JlAGSAAAAAAf/bAIQADAgICAkIDAkJDBELCgsRFQ8MDA8VGBMTFRMTGBEMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAENCwsNDg0QDg4QFA4ODhQUDg4ODhQRDAwMDAwREQwMDAwMDBEMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgARwCgAwEiAAIRAQMRAf/dAAQACv/EAT8AAAEFAQEBAQEBAAAAAAAAAAMAAQIEBQYHCAkKCwEAAQUBAQEBAQEAAAAAAAAAAQACAwQFBgcICQoLEAABBAEDAgQCBQcGCAUDDDMBAAIRAwQhEjEFQVFhEyJxgTIGFJGhsUIjJBVSwWIzNHKC0UMHJZJT8OHxY3M1FqKygyZEk1RkRcKjdDYX0lXiZfKzhMPTdePzRieUpIW0lcTU5PSltcXV5fVWZnaGlqa2xtbm9jdHV2d3h5ent8fX5/cRAAICAQIEBAMEBQYHBwYFNQEAAhEDITESBEFRYXEiEwUygZEUobFCI8FS0fAzJGLhcoKSQ1MVY3M08SUGFqKygwcmNcLSRJNUoxdkRVU2dGXi8rOEw9N14/NGlKSFtJXE1OT0pbXF1eX1VmZ2hpamtsbW5vYnN0dXZ3eHl6e3x//aAAwDAQACEQMRAD8A72Alt81KEoVq2mx9w81El3fVEhMQlakYfYDoTHgok+SKWptqNhGqKSmI8tfFELE21OtSMg/7VIbxwE8FPt08/FK0JWuyWtDmN3MHPDoUftVodIgjvA4UJcBEkDwUSJTREdQFxkehKf7W89h8z/eoWZb3iIj4IW3t2SaGgjdq3uByiIRHRXHI9WbLawJfJPhrCkb2uPteWjuFCWfmjaPE6qLjXEtkkdzx+VHhF9VcWm4XD3aue7T80f3oZufu7JHceSnbS94kRHmnUBuiydmDrXn/AHIZJPKKWQeZ+CaE4ELTfV//0PRfQf4H8FE1PHZW4kaJtfBP9wsRxBp7XDsmI8Qr0E8hMa5KPueCPa7NLRIDcYHKtsNdu70y2zY4tftMw4fSY/b+f/JTlgPZH3PBHteLShNsk8K26hs6aJCkTPJR9wI9stZgZBDmbj2P8FEtjloVza0DUfxTbK5mJnuEuPzTwaNEj5JoV51NU6Dt4n+9QNQHAlOGQLTiLU2pi1WvTE+HxS2J3Gt9stPb5JbVbLXNHbXyUCw+A+SImgwa235pw09p+9GNZ8Ewpd4I8QVwnsxFeoJg+Sc44MlsHyCIK3gcD704bHKHF4rhHuH/0fSg6snQGSsq361/VqqR+0qXuEjbW/fqNPzfb/0lcx8mq/Gry2hxotqbdxrse31Id+77V5tX0r68QA7PwyNAIro0+/C/cRMq7fVaB/IPWdR+uXT7sO/Hw7i222tzWXm6ussJ0FjCx1tntXLu6jnW+3J6p67AZa05cQY27v5v971P/Pf/AAiJg9L+s++w9RzKXVek40jHZjB/raeh6jrcH+Y+l6v+EVrqGD1d2Nt6ddVj5ReNr7a6Lay3ad9Tmuxz6fv9/re//R/4RDi8Y/y/wVGN9Jfy/wAJpHKfBa3MhpcXhoywPeRt9R+2r32fy0RnVOvbg5nWdr2ua5pdd6rYBbLbKdrG2MfttZ9L8/8A4JX68DODKRa5jrAKheWigBzg39Z9P9W9vqWfzax/rC9vT62HPNv6xjXV4H2dzWFuY0teb8j7N9j/AFX0X4/6Oz1/f6n6BOBJIFx17f8AoqKA1qWnf/0Z6fB+srse6+22+u5uQd7q7LIax/tbuodtd6dXps91H0P8N9P1vVtu+umEx+x7sdr9NPVeZkhrYc2hzXbnOavKB1HLDSXZFxaBJix8x/nLWzurfWfoNGHTkW4zHXsLqm001lvohrPS3ubtq9X3e9no+p/pbbf8EZYzEgXfF9P++UJggmqr6voA+u/TSN3q45BiD6r+52N/wH7/ALUh9d+lkF3rY8aSfVf3mP8AAfyHLm+jdV6nm0iz1W5zHMqc++uo1trtfpkdPcK27bbsRmy6y3/hVdZmdYNdbvsdm9zq2vZ+klge7ZdZPp+5uOz9K799NII/9Gj/AN6mx/KMnXb9delujbbjuniLXHs53+g/drein604Y59GRyBdr+NSw7bvrE8CrEwvUusLWiy2fTrDvU9bIt9ZrK3txWVss9Ox/wCk9T/rN2Hn0dRs6rdWy69lYDDY6ptj2VONTLG1OGEHMc6z6f6Fn+ESjZNXX1iUTkALq/8ABk9B1Tr3Ucm5rsTOqxKg0tFbLYlx/OcYfu93/QVQdU6yC4jqfud39ccD6HNP7v7qyOju6jZkjHa61ufXYHXV32AsGO3b9tx3syHWV/atp/RP9Pez/TVrbfV1eXFoqDQHgAmgmd4Nf+D936DcxO20uP8Ahf8AoqzfWpf4P/oyH9p9ZY5xq6kGF53PJuBkwxgcf0P+ir2f6+/V6b9Y7qMYV5t9WVb6hcbTaJLDH6L6DPoqgKepCq4WOqFr33jGcDQWgOH+T2WRX9Kt/wDO7v8AwZI09TN1cekKw8m1u7Hl1ZqLWtY41/S+17LP+L/7bSv+tD+X+CkCukvr/wCjO8PrT008yweO+k/gLkQfWDAcAWkkHUEGr/0uudrq6gCw2hhaCz1AHUA8EW/mNc39JscuG6ljdKr6pl0dRpfb1CsPuyrKrqmsdZ6ZyrfSZVjNZtd/wbUL7GJ8tUjxEh5vsVXUqrww1gkWEhp9vbd+49/7iKbT4LiPqj1Cmiqvp9I9PBwrL2h9jtzxD36eytjHMfba9zfp2Lov2308ucwWOLmgE+xw0cXBvueGt/MclCeh4q0P4JlE2K7P/9Kj0/q32XK9Vlh3NbDt99bqwcgDGrvstrbvcyn7R9pe/Y+v9H/LrWtb1Sh/S7serrXT6eouDhVksyQ6th37mO3XusyP5j9G72fTXIegHOud9oc77TaW2MezcXVVMPou0r2b7b/T/R0t2V/olnuwrG1F9eO51hY8S1pP0vZO5rfd7XKGOSMom5R4hrWnqW+4B4/V7y3qLXXWPq+sGCyp1uW+thyGe2q6ltXS6v8A2n5m7Js/6HrJU9QDbKnW/WDBsrZZgutaMivVlFbmdXb+b/ynf+kr/wDBPQXAVdGzNzbqsW97WODyW0OcIHu+m0Oa1Fx+nZ/oP/yY97vTeS402Eu9R1bHSR9L7N9Or9xScIuuIbb3FPH4F7P7XmtxBUfrP0/7T9l9P1TeyDkfaftP2vVu7Z+y/wBR+j9P/B7P0yz/APGD1LAyh04YV9GUA/JJ9KxtvpgjH2/zL3bX/wBdcvj49rn1EYXrVPtb6dz6nO3tY30XtDhsa6v/AAmxBdhZzWMudjXV47AGsf6bgx3dw3xt+mUoVxRJIH1iiU7BFJmvkEbS8QZaOSAJctH61WZP2TpYyuo4/U7Wi6Lsaxrwxm3G9PHsFTWenZXH5yptwshmJblPLanUEg0WkNs9oGpre5ln52xu1n01pn6o9Ptx9teVY1zR6pL/AExBe2txbbuNfp+xn+FdWpMmbHYlxgiF3SMcDRFfNVN36nZmTX0h4w7cakm7JNrcq2sONv2egdPfU23Z+h+1/wA//wAGuit6j1HcfQyunhv6fbuuqn+Yr/Z35/8A5Zev9p/7rbFx9P1O6W8v35j5qEua52NW8fS27qrL3erurrfb+ifZ/wAUi2/Unp3oONd2Tu2E1ucyoNJ9xY5zt30FEZwl6hIES1BZACNK2evq6pksy2u+2YDKd9vvN9Q2s9Kv7K93vO7ZmfanXf8ABekuT6u57+oPc++vJcW1zfQ/fW47GjdXawMa/wBvs+ih4n1Rpxcmu224FglpGwOc6RbTFdMW+s97vT/Re+z3+n/OK+3onTG1+3KvFVQiRjvc1rZJgvZVtb7js96MJQB3H2LJgy0r8Wf1Xy+nYmbuy9lLyLC3MttFbGNNZHpPbZ+jc6135633dW6ccjc3q+EKjbU8V/aWT6bWuF9ezX+ds2u+l/1ytc/T03puH1Gm8ZtpyKgTXjPxnWNeSHMk45pf630/3Pp/8IsfO+q72dUya8P7RdiUFzKb2gvc4gN/PpZs936Tds2em/6aJnEk0dxWyACBVbG/m/S/d9L2Y6rgta1tnWcIvaKg8/amn3Ns3ZDvo/4Sj9F/58/0iDd1St1T21df6cyw12NrebQQLHXi7HsIH5leBuxH/wDC+9Yh6L03H6djuOPdZkPL25NhZcXNY20b6XtpHp+o7Cdtf7ff+n9P9IhZOL0mu/HZi9Ftyqbv523bltNQmPU2ub+nZsdv/RppyRJ18/liE1Wnh1kXo39ZwzZYW9a6eK3PyDW31iCGPDP2ewn3e/Gc237Q7/thclmV9bf1DPcy63MrsstdTk0lxZY2ym70jTZ7d9bbPRY3/hUmtrIE/Va0PL9pbuySQ3/SfRV+3o3Qfte/9mWuxTW8OnHzA5129ux8mPZ6Pqe399IziP8Aein7PtWwLL+n4ebk5lDjtfdd6b9vuDg12/8ASC1jv0jnWfpK7P5pBd9csICGYTGw3c5/6MFzXD0/8HjM9P32Nd+jT5NXTsJzDi4LhjPpuq+y2V3M9W95r9NnqWbb2+rTu/wn83Vaq1A6absU5HRm0Yz6y7IcPWeJ9/oVDdYd9O9tFjbK0PciNTrr3UT4gfV//9PmW/t39IWnIkgDUOjT6Mta3b9H6Hp/mKQt62Pa0XiyJcS2TEd/YuOSWWfa68H/ADWpr4vXOv6nJ3Nft13S2DJ01/R/up6HdTLnuLrGFxEhrSdB9HQs9ti5BJA+1Rrh/wCajV7Wy3qjg8WusA4durAP/Uf9/U6j1N1h9N1gP8kEGf7DGtXDpKM+3WnD/wA1Wvi9uLeqktA9YSIb7TMePta72IRyc8TDXEAkOPpwOPd6ns/6pcaknD2utf8ANVq9mLs5rpYPdGoYwF0H6O72f+YJ25Fxa1zht0IDX1s8vBn/AJguLSS9Hhf0Vq9vXdmOZtr+iXH6DANe8OFe3ck+65utrWOa2NwewbPLdptXEJJp4b6f2q1e+ozsSWi3HZJ4hrNTptiG7m/yFaZZiP3QysAfSEAH+1t/O2rzdJRzr9FcL8H0kPxw+am0usH0gI3En96NqcOa5m7Y1gIGgPtAHaGl7e681STFavpbnDeG2Bm+PpEdvm7cokWOESxoEemWeH5n0fp/nfSXmySIU+iPFW4k3VCxztG+lI4/6LvTURXjBzw2xhsO3d5Cf0cbQ1/9VeepJ2qPsf/ZADhCSU0EIQAAAAAAWQAAAAEBAAAADwBBAGQAbwBiAGUAIABQAGgAbwB0AG8AcwBoAG8AcAAAABUAQQBkAG8AYgBlACAAUABoAG8AdABvAHMAaABvAHAAIABDAFMANQAuADEAAAABADhCSU0EBgAAAAAABwAEAAAAAQEA/+EN3Gh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8APD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjEgNjQuMTQwOTQ5LCAyMDEwLzEyLzA3LTEwOjU3OjAxICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1LjEgTWFjaW50b3NoIiB4bXA6Q3JlYXRlRGF0ZT0iMjAxNC0wMy0xOVQwMzowMjoyNiswMTowMCIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAxNC0wMy0xOVQwMzowMjoyNiswMTowMCIgeG1wOk1vZGlmeURhdGU9IjIwMTQtMDMtMTlUMDM6MDI6MjYrMDE6MDAiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MDI4MDExNzQwNzIwNjgxMTg3MUY4MTMxRkI2RTY4OTgiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MDE4MDExNzQwNzIwNjgxMTg3MUY4MTMxRkI2RTY4OTgiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowMTgwMTE3NDA3MjA2ODExODcxRjgxMzFGQjZFNjg5OCIgZGM6Zm9ybWF0PSJpbWFnZS9qcGVnIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiBwaG90b3Nob3A6SUNDUHJvZmlsZT0ic1JHQiBJRUM2MTk2Ni0yLjEiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjAxODAxMTc0MDcyMDY4MTE4NzFGODEzMUZCNkU2ODk4IiBzdEV2dDp3aGVuPSIyMDE0LTAzLTE5VDAzOjAyOjI2KzAxOjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ1M1LjEgTWFjaW50b3NoIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDowMjgwMTE3NDA3MjA2ODExODcxRjgxMzFGQjZFNjg5OCIgc3RFdnQ6d2hlbj0iMjAxNC0wMy0xOVQwMzowMjoyNiswMTowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPD94cGFja2V0IGVuZD0idyI/Pv/iDFhJQ0NfUFJPRklMRQABAQAADEhMaW5vAhAAAG1udHJSR0IgWFlaIAfOAAIACQAGADEAAGFjc3BNU0ZUAAAAAElFQyBzUkdCAAAAAAAAAAAAAAABAAD21gABAAAAANMtSFAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEWNwcnQAAAFQAAAAM2Rlc2MAAAGEAAAAbHd0cHQAAAHwAAAAFGJrcHQAAAIEAAAAFHJYWVoAAAIYAAAAFGdYWVoAAAIsAAAAFGJYWVoAAAJAAAAAFGRtbmQAAAJUAAAAcGRtZGQAAALEAAAAiHZ1ZWQAAANMAAAAhnZpZXcAAAPUAAAAJGx1bWkAAAP4AAAAFG1lYXMAAAQMAAAAJHRlY2gAAAQwAAAADHJUUkMAAAQ8AAAIDGdUUkMAAAQ8AAAIDGJUUkMAAAQ8AAAIDHRleHQAAAAAQ29weXJpZ2h0IChjKSAxOTk4IEhld2xldHQtUGFja2FyZCBDb21wYW55AABkZXNjAAAAAAAAABJzUkdCIElFQzYxOTY2LTIuMQAAAAAAAAAAAAAAEnNSR0IgSUVDNjE5NjYtMi4xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABYWVogAAAAAAAA81EAAQAAAAEWzFhZWiAAAAAAAAAAAAAAAAAAAAAAWFlaIAAAAAAAAG+iAAA49QAAA5BYWVogAAAAAAAAYpkAALeFAAAY2lhZWiAAAAAAAAAkoAAAD4QAALbPZGVzYwAAAAAAAAAWSUVDIGh0dHA6Ly93d3cuaWVjLmNoAAAAAAAAAAAAAAAWSUVDIGh0dHA6Ly93d3cuaWVjLmNoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGRlc2MAAAAAAAAALklFQyA2MTk2Ni0yLjEgRGVmYXVsdCBSR0IgY29sb3VyIHNwYWNlIC0gc1JHQgAAAAAAAAAAAAAALklFQyA2MTk2Ni0yLjEgRGVmYXVsdCBSR0IgY29sb3VyIHNwYWNlIC0gc1JHQgAAAAAAAAAAAAAAAAAAAAAAAAAAAABkZXNjAAAAAAAAACxSZWZlcmVuY2UgVmlld2luZyBDb25kaXRpb24gaW4gSUVDNjE5NjYtMi4xAAAAAAAAAAAAAAAsUmVmZXJlbmNlIFZpZXdpbmcgQ29uZGl0aW9uIGluIElFQzYxOTY2LTIuMQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdmlldwAAAAAAE6T+ABRfLgAQzxQAA+3MAAQTCwADXJ4AAAABWFlaIAAAAAAATAlWAFAAAABXH+dtZWFzAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAACjwAAAAJzaWcgAAAAAENSVCBjdXJ2AAAAAAAABAAAAAAFAAoADwAUABkAHgAjACgALQAyADcAOwBAAEUASgBPAFQAWQBeAGMAaABtAHIAdwB8AIEAhgCLAJAAlQCaAJ8ApACpAK4AsgC3ALwAwQDGAMsA0ADVANsA4ADlAOsA8AD2APsBAQEHAQ0BEwEZAR8BJQErATIBOAE+AUUBTAFSAVkBYAFnAW4BdQF8AYMBiwGSAZoBoQGpAbEBuQHBAckB0QHZAeEB6QHyAfoCAwIMAhQCHQImAi8COAJBAksCVAJdAmcCcQJ6AoQCjgKYAqICrAK2AsECywLVAuAC6wL1AwADCwMWAyEDLQM4A0MDTwNaA2YDcgN+A4oDlgOiA64DugPHA9MD4APsA/kEBgQTBCAELQQ7BEgEVQRjBHEEfgSMBJoEqAS2BMQE0wThBPAE/gUNBRwFKwU6BUkFWAVnBXcFhgWWBaYFtQXFBdUF5QX2BgYGFgYnBjcGSAZZBmoGewaMBp0GrwbABtEG4wb1BwcHGQcrBz0HTwdhB3QHhgeZB6wHvwfSB+UH+AgLCB8IMghGCFoIbgiCCJYIqgi+CNII5wj7CRAJJQk6CU8JZAl5CY8JpAm6Cc8J5Qn7ChEKJwo9ClQKagqBCpgKrgrFCtwK8wsLCyILOQtRC2kLgAuYC7ALyAvhC/kMEgwqDEMMXAx1DI4MpwzADNkM8w0NDSYNQA1aDXQNjg2pDcMN3g34DhMOLg5JDmQOfw6bDrYO0g7uDwkPJQ9BD14Peg+WD7MPzw/sEAkQJhBDEGEQfhCbELkQ1xD1ERMRMRFPEW0RjBGqEckR6BIHEiYSRRJkEoQSoxLDEuMTAxMjE0MTYxODE6QTxRPlFAYUJxRJFGoUixStFM4U8BUSFTQVVhV4FZsVvRXgFgMWJhZJFmwWjxayFtYW+hcdF0EXZReJF64X0hf3GBsYQBhlGIoYrxjVGPoZIBlFGWsZkRm3Gd0aBBoqGlEadxqeGsUa7BsUGzsbYxuKG7Ib2hwCHCocUhx7HKMczBz1HR4dRx1wHZkdwx3sHhYeQB5qHpQevh7pHxMfPh9pH5Qfvx/qIBUgQSBsIJggxCDwIRwhSCF1IaEhziH7IiciVSKCIq8i3SMKIzgjZiOUI8Ij8CQfJE0kfCSrJNolCSU4JWgllyXHJfcmJyZXJocmtyboJxgnSSd6J6sn3CgNKD8ocSiiKNQpBik4KWspnSnQKgIqNSpoKpsqzysCKzYraSudK9EsBSw5LG4soizXLQwtQS12Last4S4WLkwugi63Lu4vJC9aL5Evxy/+MDUwbDCkMNsxEjFKMYIxujHyMioyYzKbMtQzDTNGM38zuDPxNCs0ZTSeNNg1EzVNNYc1wjX9Njc2cjauNuk3JDdgN5w31zgUOFA4jDjIOQU5Qjl/Obw5+To2OnQ6sjrvOy07azuqO+g8JzxlPKQ84z0iPWE9oT3gPiA+YD6gPuA/IT9hP6I/4kAjQGRApkDnQSlBakGsQe5CMEJyQrVC90M6Q31DwEQDREdEikTORRJFVUWaRd5GIkZnRqtG8Ec1R3tHwEgFSEtIkUjXSR1JY0mpSfBKN0p9SsRLDEtTS5pL4kwqTHJMuk0CTUpNk03cTiVObk63TwBPSU+TT91QJ1BxULtRBlFQUZtR5lIxUnxSx1MTU19TqlP2VEJUj1TbVShVdVXCVg9WXFapVvdXRFeSV+BYL1h9WMtZGllpWbhaB1pWWqZa9VtFW5Vb5Vw1XIZc1l0nXXhdyV4aXmxevV8PX2Ffs2AFYFdgqmD8YU9homH1YklinGLwY0Njl2PrZEBklGTpZT1lkmXnZj1mkmboZz1nk2fpaD9olmjsaUNpmmnxakhqn2r3a09rp2v/bFdsr20IbWBtuW4SbmtuxG8eb3hv0XArcIZw4HE6cZVx8HJLcqZzAXNdc7h0FHRwdMx1KHWFdeF2Pnabdvh3VnezeBF4bnjMeSp5iXnnekZ6pXsEe2N7wnwhfIF84X1BfaF+AX5ifsJ/I3+Ef+WAR4CogQqBa4HNgjCCkoL0g1eDuoQdhICE44VHhauGDoZyhteHO4efiASIaYjOiTOJmYn+imSKyoswi5aL/IxjjMqNMY2Yjf+OZo7OjzaPnpAGkG6Q1pE/kaiSEZJ6kuOTTZO2lCCUipT0lV+VyZY0lp+XCpd1l+CYTJi4mSSZkJn8mmia1ZtCm6+cHJyJnPedZJ3SnkCerp8dn4uf+qBpoNihR6G2oiailqMGo3aj5qRWpMelOKWpphqmi6b9p26n4KhSqMSpN6mpqhyqj6sCq3Wr6axcrNCtRK24ri2uoa8Wr4uwALB1sOqxYLHWskuywrM4s660JbSctRO1irYBtnm28Ldot+C4WbjRuUq5wro7urW7LrunvCG8m70VvY++Cr6Evv+/er/1wHDA7MFnwePCX8Lbw1jD1MRRxM7FS8XIxkbGw8dBx7/IPci8yTrJuco4yrfLNsu2zDXMtc01zbXONs62zzfPuNA50LrRPNG+0j/SwdNE08bUSdTL1U7V0dZV1tjXXNfg2GTY6Nls2fHadtr724DcBdyK3RDdlt4c3qLfKd+v4DbgveFE4cziU+Lb42Pj6+Rz5PzlhOYN5pbnH+ep6DLovOlG6dDqW+rl63Dr++yG7RHtnO4o7rTvQO/M8Fjw5fFy8f/yjPMZ86f0NPTC9VD13vZt9vv3ivgZ+Kj5OPnH+lf65/t3/Af8mP0p/br+S/7c/23////uAA5BZG9iZQBkAAAAAAH/2wCEAAYEBAQFBAYFBQYJBgUGCQsIBgYICwwKCgsKCgwQDAwMDAwMEAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBBwcHDQwNGBAQGBQODg4UFA4ODg4UEQwMDAwMEREMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEIATYCtwMBEQACEQEDEQH/3QAEAFf/xAGiAAAABwEBAQEBAAAAAAAAAAAEBQMCBgEABwgJCgsBAAICAwEBAQEBAAAAAAAAAAEAAgMEBQYHCAkKCxAAAgEDAwIEAgYHAwQCBgJzAQIDEQQABSESMUFRBhNhInGBFDKRoQcVsUIjwVLR4TMWYvAkcoLxJUM0U5KismNzwjVEJ5OjszYXVGR0w9LiCCaDCQoYGYSURUaktFbTVSga8uPzxNTk9GV1hZWltcXV5fVmdoaWprbG1ub2N0dXZ3eHl6e3x9fn9zhIWGh4iJiouMjY6PgpOUlZaXmJmam5ydnp+So6SlpqeoqaqrrK2ur6EQACAgECAwUFBAUGBAgDA20BAAIRAwQhEjFBBVETYSIGcYGRMqGx8BTB0eEjQhVSYnLxMyQ0Q4IWklMlomOywgdz0jXiRIMXVJMICQoYGSY2RRonZHRVN/Kjs8MoKdPj84SUpLTE1OT0ZXWFlaW1xdXl9UZWZnaGlqa2xtbm9kdXZ3eHl6e3x9fn9zhIWGh4iJiouMjY6Pg5SVlpeYmZqbnJ2en5KjpKWmp6ipqqusra6vr/2gAMAwEAAhEDEQA/AO70YnNo6pqrA9cUO5v440rfPxrjSthwdq40l3IdK4KYku2wq0GI2rUYquDKDQgfPpkSGVr/AFSo+EkU+nBwp4nC6lIoW/DHgC8ZaMs/XkTjwhPEWxcSeJ+WPAF4y5rhidjQ48ATxFct01NzjwBeNY0rnrXCIhBkSpcpB+0flkqYEtCWQHrvjwhIkvFzIOorg4AjxFVL4jvTInG2DKrJqFRQ7jIeEy8VSlmDbBvoOSEUEoUlgadMtpoNtFm+nFRa0pKN6U8MKaLvjpu2+FC0hgRU7eIxVsueWxNMSFbaRya128MeFbcxFQRUDwGNJta5NTSowhCwnxJwsbW716nCriD44otbVgeu2KLXiaQH4TTBQTxFxdmNSanCAkEtFqeOKbXLJseu+DhW2jQ9zXwwsVypX9v78BLKlQRU/bGRJZBVBoKc8jTYHDlWof8AHBSEVbyUPxNlUotsSjVMTD7X0ZSQWwFr0oi1akHDbKlX01A61yNp4VJyiHfpkhugrFcNuv3YSGJXiQjtgISCqpNQg1+jIEM7VTdDtvkOBeJYZmY0yQim1prkqQSpujE9SMQqqkZHU4kpc23fAgqbSUB3yQDEyQ8lwQNjXJiLAyQb3NTlwi1GakZ98mIo4mjcLTY48LHiaWSp2bDS2rJKa7A5AhkCUQCxHSn05W2ArubKOv0YKTbYuvfHgRxLXuQcPAvGFM3A8foyXAjjUzOPfJCK8Sm0+S4WBkt9Qk0JJrhpFr1B71wJtplXxxWljcQP44QghT9Q9B0yVKvV/bAQtrmYH2xCkqbsabH78IDFYQw75JBCw07E4UKbuw6ZIBiSos57k5OmNrPWp4n6cNMeJYZHPenthpbcCfHFFv8A/9DvlM2Vuoa4jG1aKjG1aKA4bVaY/DDabdwNcVbo3hjYVaSRvhQ1WvXFXUxQ4DfFbVFlK9hkSGXE2bg9wMeBPGptID+yMIixMlnIV2JB+/JUxBbWVsFJ4my9R0xRxLSRhW1pY0w0qznvhAQ2j0PTAQm0QNxUb+2RLO2mZlWpG2IUlTaSuGmNtCVqUGGk2VpY4aQt5YVaL+2KLdyxRbdcNLa5pKjBS2tWjHfFQqmOMLWtTkbLKgosB2ybArMUOpirsVaIOFWhyGKrgTWmBVwG9anFILjTxwMrXKB3NcSoVUWMAb0r2yBZhUG26iv05Flbfr0Fa0OPDa8Tk1BlIqa4DiXxkYmo7eOVHE2jKpzXyuDko46RLIoJeLHuD9OTOO2HGu/SW/Xrg8JfFVorlm3B28ciYU2CdqyzHvue2Q4WQk01w6ipoBiIp410dyCK8qHEwTxhprhxvXbAIIMm0vPHpicaibbXKkbmnhgEEmaHeVSeuWCLAyCGmmNevXLYxapSUOa+OTphbXMN0/HDS2qJBy3ArXIkqIoqGxjG8n3DKpTLdGPeiQsXRRldkswtZB44VUJ+QHw5OLCSDkkl7jLgGokuSOVxUniMTSAFxQgGprgZUhZZWDEA7ZaItRkpCSU7DfDQRxFF20bFg7E/LK5FsjurTzKppWmRiGZlSibqOnX6clwMTNRe7FdhkhBici360D028cnwLxuW5IwcCOJxuiemPAjiWGZ69cPCjiWNK56tkuFBkVplbxw8K2saUnvkgEWsZmOLElrCxbG+K22KdPngSH//0e+ZsXUF2Kuwq1iyb3xRTsCHYq0Vr1w2q1o6kU2w8SrSrDCtNYUU7FDRAOKKa44qtpvhV2FLqnwxpacKU6Y0tLSBiq0rhtacBTClcrsp2ORpVxkLbNjSrMKrab1wq1Uk+2KGgN8VXFcVdTFFLSMKKdvihoYq3VqdcUupirZFDimnMvh0xQVmKHYq7FXYq3U4q6u+KurTFIK4N41wEJ4lVJlXod8iYshJbI3IeJwgKSohd/bvkmCKV4SoHceGVkFtBDYjhY05EYLKdkPPEUOxqMsibYSipZJrVlmYDbI8IZcS4XEnY4OAMxIrjPUUclsHCvEt9Q9jTwx4Vtf6zUoTtjwp4it9cjv9+PCgyd9ZenWmPAjjWtOfGuHhXiWGUEb7nJAMSVMk+OFja5AOtcBSEwsyOJPanXKJuRjXyTx9iT75ERbDIOW5Aw8CONv6yp2rjwJ4nGQHauPCtrCFPXphtiQGtgaYUFRmYAZKIYSOyAarHbvl4aVa2XiQSMhIsohG8lVdsrbkLMpkNa75OOzXIIWRQvf6MtBaypE5NDqjFFuBwLbeK24nCqw1rhQ1irRG+KrcKtjFFN7YFcOv0Ypf/9LvZzZOqcMUOGKurXFadXFabocCHYq7FXYq7DatUxtVpj8MNopaVIG+FaaoMUU7iMbQ0Vw2rXE4VaK064q1TDaXccVaoMVa474UtFSMbV2KtYVaIPyxVunviinUwWtOGKXUxtXUxtFO4DDaKWkUxtS6hwsab+KmBk0Sx64oa413GFFOKgDrv4YqtxVUCVHbBbKlvpv2GG0UuEZB+Ibd8BKRFeEtyNyQcjZZcIXxwoP2tsBkyEQi4ILd6cqHKZSIbYwCIbSLd0PD4a98h4xDPwgUJNo8iNVDVO/zy0ZwWqWCkIYHjNHUjLRIFrMCGmoPsj78IQs5k98ICCWuKnen04bRTXAYopw2xUFUDLTcYCyC5Xj/AJQcibZWF1YD7e2O62FkypQEEYRaJKDEZNrW7Yq3irRxVsf5jFVT15AKA8R4YOEMhIrDM/c4aRZa9ZvHGk24TNWuNKJLvXf6MeFPEV63L136ZHhCRIr/AKxQeOPCy4lJ5FfxrhApBWoorhRSulAMgWQWNLxrUYRFSaUHnZthsMsEWsyUyK9ckwU2rkgrsKtrgKG8CCtO/wBGSCQ3QnFVpBGKtYq7jXFWiKYq6mK04Yq//9PvebJ1JbwIdTFWqDCm26eBpitu59sCG8CuIGG1dTbFXUxVrFXYq7CrRUHG1Wem3jhVogjqPpxRTqfdhRTVBihxAw2rRG2Nq1TCrRAxVxXFNtU36Y2rRXDaWihGNqtySuwFXYFdireKt4q0cVb3xRTWK03itNbfLDaWiBhtFNcRja03tTpgSvWQjbrgIVt5amoFMFKsDkUwqCuaQt1A+jDSqkOzA7/LISDKKaQXDBQAajwzFlByoyakv6NxphGNZZEHNKHHX7sujGmmUrQcgoeuWtJWqVB3GGkWuafaijGlMlPl49ckAi1nNGYhSCV+0B2xYt1xV1cVtxbFVpJPfbwwrbWKuocVdirvbFXcW8MU0uCeJ3wWkBv0icbTwt/Vx442y4Vph8DhBRTRjUDrhRS0ca9cbTS4CppgSvWIVrgJSAvoAcFq1z7Y0tqErA98mAwkVLJsG8WK0qDhBVopQbYbVobYlW8CuxV2KupjatcRhtWivhjauIrhS1T78VcBvir/AP/U75mxdQ7FXYq4A98VbpgtNOp7YbQ44Fa3FMVbxV2KupXCrqYq1Q4q7FXYq7FVpAwppor4YUUtp9+FiQ7AimsKuIxtWqYbVrCrsVapim3UBxtK3hjatFThVricVdQ4q6uKt4q7FXYq0TirWKuxVvFWsVXBCae+NquaFgadcFppaSw2O4wodyH8owq1yatRtgpVwlevU4KTZbeQt418caW1nI1rhQ0aHrvXCEFYyjsa5IMGqYq7FVqRRoXZFCtIeUhH7RoBU/QMVtdirsVdscVaphVrFXYq2Kk4qiI7UlCT17ZWZtwxu9B++PEogvWBh+z9OAyTwuZHxtNKThhkgxJWUrtXrkmKrLYsq1D8iciJs+BDiFgx5ZLiY0qVAPTfFVrTN0AxAUyU2kbxyVNZKmzMd65IBbW4UN4ot2KHYq7FWqDG1dxxVog4VaOKuxV2KuxVsUxV1BhtXBN8bS//1e+ZsXUOpthTTYHvgWm6YFDgcUu2xV1MUU1XFadihvFLWKHYq7FNOIrhtDqYq1TFWqYUuxV3zxVoouG0U1wxtBC0imKKdhQ1scVdxxtLuGG1pbSmFDsVdtitupittU9sWTVBjatcffG1aIIwq1uMVaxVv3xVrFW6Yq6hwq2CVOBV4farYFWMRTbocKrcVdirsVbxV2KuIw2gtGv3YQxpojFadxHH3wrS2hxQ7FWn5BCVXkwGy1pU+FTirogWUErwYjdSQSD4VG2KaXEUPjihor37Yq4rthTSIt0RSGbK5lsjQR63MAHyyjhLkcYUXuY6/CPpyQgWJyBDtcsx75PhazkUmlJP8MnTHiaRHlNANvHtiTSx3REdooHvkDNsEUR6aEAM4FPHK7LZspSRwAGkgJycSWBpASEA0DZcGklTyTBawrhQt4nCrsKl2BFOwrTsVpviSKjBaadwOC1pv0277Y2tOKEY2tLaZJFNUGK07jitNEYVp1DitOrimm98Uv8A/9bvtN82NuqdvjauwK4HfClvfpgQ1vhV2BV3emKlxGBi0a4Vd9GKXYq7FDWKuxV2KuoMVdTDau4jxxtNraHCtu6Yq7bvitOoMUU1wHbG0ENcSMNrTVDirsVaoMKu4jG0U1xOG1pbQ4UU6mKtUxW3UxTbqYrbuIxRbRQY2tuCjFkuFKdMCLdhtDRFcVdTFXEA42q3ga7YU2tIOKWsVbGKt4q7FXYq7CimjitNcR9GFjS2mKKdTFXCoxV3XFWwK7V38MVDuIp1wsmq++NItqpxRbsVcS3Y4rblIHXFKpHMU6dMBDKMqae5lJNDQYBAJM1Lmx2Jrk6YEtHFCw1PXCrsKuxVsYpapvitN7YFcAtaHG1pWitufQH3yJlSRG0Utivfp4HKzkbBBd9Vjr8I+/BxsuAKTxKu5O2TEmBCHkK7gZMMSpGlDkrYLCD4YbVo18MVdhV2Nq1xGNpbAxV//9f0BTM91Tq0xQ11xV3HG1brih2K21QYrbqDFFu2xV1MUu3xV1MVtojFW6DFVprkgyC0++GkU2DvgpaXYEOocVdirVBhtXUGNq7iMbVojwxS1vhV2KuIU9cUU1xGK01xPbDa00a+GKGiaYVdsfnja0sOFi7CrhXFW+JwLTVMU07FaditOpitOpitOwrTsVp2KHYqt4DG1top4Y2m2uDY2tuoa0wpdvirqbYq7FXYq6gw2inUGNo4XYrwrSCR4YUUs3BwocScVdirWKt4q7FWjvirRGKtYVdirsVcRirXHDauK+GNq1QjemKXYVdQ4FVo1G1QMiSkIiN+PemVkMxsrLLXr08cjTO2nc9sQFtCylyp7DLAGuRQ9NjTc5YwLVKe2Nq6o7b42hxHjjaXbdKYUONAPDFVhpXDauGKv//Q9A75nurprFDsVdirqYrTsVpo4op1DiimqnCtN1ONLTt/DAtO3xWnYrTsU04rXDaQsK4bVuhxtVwpTIodTFFOxV2KupirqYq4jauFWqE9NxjaXe2KGiuG1a442lxBGKtVOFXYq0VBHTFVpSnvkrRS3jhRTfyGBacDU79MLKlSK2eVwqVNfuyEpgM447XvaSxvx6++AZAQyOIhs2rkUNB74PER4ZUzbSg79clxsTByW0jKWHQdceNfDLvQiD7knHiK8Kn6bA7KfbJWjhb9JiPi2xtBisK0+jDbAhrCh2KuxV2KuxW1pB+jG1tor4YbSC4An/PwxTbVD4b4q6h8MVt2KuxVqmG0ENcR4Y2imioxtadww2tNFcNop3A42imuJ8MVp1DitOKkdsbVqmKuC42rXE4q7Crq4q6mKtcRirXD3xtVy1HfAtrubdsaTbfqP44KXiLvWbGk8TYLNtTrhUFxiFTQ/RgtNLTFvvvhtaXJEa7dMBKiKobf+bBxJ4VKSIDY7eGSEkGKlxbwyVop3pt4Y2tO4GvTG1p//9H0MY2rmbbrStMXjjaCFpj98NrTfpjxxtaaKGu2K01Q4UNYq7FaaoMUN4q7FXYq7FXYq7FXYq1TFWxtirq4q7bFXCgxVvbFadTFaaIxWmt8WLqYq4jFXbYq4jw2xtNtFcIK2tIGFXYVpqoxVxI8MVpv0mIqBXHiZcLQA+kYsSitPl4ScSNj0yrKLDdikjXCOzVpXtlI2cjYqErcSVGWRYFCO78wT36jLAGqRc9x8HFdq9TiIsTNQ50NMmwtWBRAD1ORLMELZZgRsPnhEUSkoU2ybSWuOG0OpirWFXYq7FXYq7FXYq7FXVxVriuKtFfDDa2tNRim2q4pdXFXVxV2Ku2xRTqe+G0U1xHXvjau+P54ULa06jFXEjww0hscT3p88CuIGG0reIxWnccUO44VdirYXfwwFQGygAr1xZUtoPDFDa8DtT6cSoX7L075EslhDHocISuVXP0d8BKgKqCh75EskSSpTbqMiyUWUbmlThCCFIxnwpkrRSzgR0GESQQ4K3hhtD//0vRW+ZVuuouKnuMbC8Ja2HbDaaLVBXbG0UXcd/fG1orTGd8NppoIDjxKWim+2StFLTGcbWmiMKKaocUU6mK07FDsUOxV2KuxV2KuxV2KuxV2KuxV2KuxV1CADTY9DgtPCXYUO2xWnUGK01iimqYUuIxBVbxwpb442q6N+PIeORIZiWywg1675NrpyllNQd8BSFVJjy+I9e4yBizjNt2Zj12xASSpMHrU5MMStoK7jDbWQ4KOvTG0NcduuG0hZwamEFWqkYUU4EYKY03itNUxtDVMNq4jG1apirqHFXYVdirsVdirsVcd8VWlFxTbXp4bW3FKdMbW1mKXYq7FWwcVdih1PEYbRTRQYbWncBja06m42xtNONMUFrFDsNrTRUHG0U1xOBNLgMUrginrjaaaZD4fTjaeFeqFhv8ARkSUgKyxADYb5G2XC7hJX2wWmm+mNrTccbkkgYkpiFZYRWhGQMmdNvAOgxEl4VJ4CoyQkgwUinxDbJWw4X//0/TKop6CmWEtFNlBTxyNp4Wgu5/VhtFOMMZ+0BXHiKRAFY0KdsIkgwWG3WlRucPEx4VMwSdKD55LiDHhWm2lUVp065ITDEwKz02PbDbHgbFuxHQU8ceJeBY0TDthEl4Vvpt4YeJFNGJvDDxLwtGI+GNhHCtETnoK4bC8DjGw6g42EGJW/hhRwl1DiinUOKuxV2K06mK06mK06mK07fFI5owEulCKjwHbKXI5oedVVqAUp1yyJtomKU8kxccVcKk7Yq2QQd8bWmiMbWnYq4D2xWl6qgUnjvgtnSwr9+EFjTXAnpvhtNN+i3hg4k8KosRO1RgJZU36Mf7Tfdg4lpaRD0GIJQYhYUU9MmCx4Qs9L4tj9GNrwtFaHbDbExW0PhhtFNFARhtaWhD44bY01uO2K02AT2xRTqHwxWnUPhja06h8MFrTXH2w2inccbWncR44bWnca42tNcDja07icbWncTitNYULtiBgVaUr2w2lrgMUOMftjad1vpnxxtLuB9sNq7ia42i2qHwxtNthSTTpirRFD44q1htXUGNoprjhtadx98bWmwMFrTeKWwCTgVU3GBkFwpTAleCQP14CkFdyr8sDINV3xVf6tBQCmClBWCY8t9wMeFPEiFlDbnbI0ziWyVI64KZWsKpUYbYv/9T0wtRXw98mWndUqDkWVtcPc4qQt4gNuaYSUALqL41yLJsBSNsbQspvQ4rTiCVI8clFiVojWvSpw2ilxjU7FdsFp4VrRLt2w8SOFvglOmG08KlWgPw4bYkOEXJSTsMeJHCpj4PnkrRS5pqihGIVYFVmqV2w2il4gjJoB88TJPCHLbRk1pUYONeANGONagIB74gqYhSdI+pJH0ZMFgYhr6sp+yTiZrwKq20NNwa5HjLIYwse2i5UrQ+GHjKDjC2S2jH2WwiZRwNrG4Witt4YCUiNKbwyHrkhJgYkrDA4FcnxMTBaUI642jhbSoOKgKwNRXjUnIM1jCpJbt0GEFipld+mStFKiRilTvgJZCKoANi3TrTIkswKcyKy1ApgBVuOJQWI6jpiZJAXJFUEtgtIis9Msx8cNopzxKF64iS8KgyEdAcmJMCHem9RtthtABXeltv18MHEnhU2+E0OSYlaXjPVakYQq0lfDCxaoK7Y2vC2VPhjaDF3E1xtFO4Y2oDYjwWy4Xelja8LvTOG14Wiu+NseF3EV/hja03QY2kh1B442xpoqK42kBsqtK0xtaW+mnhhtHC2I17Y2vC16Nehx4k8Nti3wcSRBVEIYU7jBbLgWmzFNsRNeAKMluyioyYk1ygp8WHY/PJWx4XHG0NYq0VBw2rRVRtTG0tEJhtVtBXFXfPFXbYq7FXcj22xVcHPfAq/4O4wMlwKjrX2GKVQfhkWYab2xtBWqW79MKHbV6YqqI4p0yJDYCu5kmgwUydU1rTFX//V9OEE9BiwaCV69sNrwl32Qe+BaaLVyVILW2AoC4FR0xoptx4k74EtgDFQFoWh64qV1AtTihaaHFLioqPDFW+FenTFacVoMILEhaUFKU2yVopZ6APsMPEjhXegtOmDiTTloCRvv3xRTgAuwwEshFzKCNxjxLTXBOvHEyKeELgo8AMILGlwA47AVwFkpmNC3IjfHiY8IaaJD02OESUhrgAaGmStjTRjLDYAe+G00ta3NOuIkxMVH0SOvXwyfExMVhFDuuStgQ4EV6GnyxULvgPiD3wJpaAK7YSildFFNup6nIEtkQvKAilBkbLLhcsagHpiSoC4QioPTAZJ4W2jalB0xtPCp+mVJJ6HDaKX8ErvgtVjqrbDYeOEWghUCxKKAVIwWUgKbx8vDDaCFwtIK147+JwHIUjGFzwQ03UDBGRUwCg8EfbY5aJFgYLFgUGvUfjjxI4XNGKeGESUxUmgr0yXEwMGjEqmhOHiXhbACntjaab4BgSMFrS0xN4bYbQQpvGR16+GEFjS0Jt4ZK0U6gG1cUEN+mp3BwErTYjXxONp4W/RT+bBxJ4Q4hR3xVaWQDwwgK0HOGkO9VhjS8TfrsR0x4V43eu2NI42jMx7bd8NLxLeYJ3xpi3RfDbFVpCfy4bRQWmNCfDCCtLTHTDbGlhQHww2tNemO+Nopb6a+Jw2rvTHjjauCb742rYUdsVdTFkAuBGApVBTrtkWQVFZQCQBXwwUya9TfoMaUFolSOgxCdmggrXavjhJQAvAU5Hdku4qNxjuydXAh//W9OBx2NMNNdrga98DMFo4qWiAaY2xU2AXYfCPHrkgWBDlJ7MGGEoHNsUrkC2NsjHZfvwimJU6srfEemSACLXgqR12wUkF1U6Vx4U2vFKbZFVwOLIFpqHFStKjthtjTRBxWm+LHAmmgp77YbRwt8aYFWk7dMmi2lNe2K8S7I2l2JKttTjgVbXY4QgrCDIcmxXqhUUwWycVr1OIKFJkNaAVOStFLghpja070z36YLQQsENRU98lxIoLvq0fQCmPGU8LvQoaqcHEngWksDTCFLW1cJYhes3I8enuciQyBX8qbE4E2uBU9KHBRStKVOG0LTEw6HHiWm0U/tfRiim+C1674pAXgVyBZguZRhDEhRZAP2voyYKC4RFtxSnjhtDfpIDVjXBakKbIO2StBCm0ZO9ATkrY8KwxnuKZIFHCp8itRTChcHNRttjSuKqevjgQQtEan3w2jhd6KHxx4ikRbMFB8OG08LRRu+/vjaCGuB8MbRwrSntXDaOFaYmOEFFFr0Gr1pjxI4XeicbXhWshGEFBitNfDCx4S754UU4jFVtPfFLRLYULanGlbq3jhCtYVaqBihojFWgDirdMVp1Dilvgx74rTXpsMbTTY5dCMUN74pdyI7VwJbDOdgN8BSF4DE0pgtmAuMeC002kZPUYLSA36e+Npp//1/ThRD1yTCg7ilKdsBSuAFMCWipPQkYqQt4t41+eKKaoR2+7DaKcFB6jAtrq70ofnihorXvhtat3DtXG08LXoDxw8S8K4R075FPC3w98VpumKadQYrTXHeuK07FIbxUhaQT2xYOKjFFO4g4bWmqHCpao3bpkUt8SepxVpkNCMIQXIpB6YSVC/IqspQ5IFXVI7bYkpa3yNrTitevTCCxpb6fauStFLgtNq1OKQ4A1yDJxWo3yQLEhaIkrk7RTjFTpucbWmgxA+JcCFM0rsTkgFbSdgadcTFQVQyq+335GqTamVABwqtHINWu2SKFQF6+I98iWQVRWm/4ZFko8QzkE7VybFc4VRQbnAtKYAJ3JwoXMi02NcbVbwP8ANjaKWtEx/bwiSCFpi+HZt8lbHhWenJXDa8LXFgdzja8LZ8fxwsXAqTscUhs08d8AZW1vSuFebt8UELeGLGm6HtitOp44q7FCw9emSBStNPDCCgtcVPUYbY0704/vxteELTGnhjaCGjEpxteF3pJh4l4GjEPCuIkpgpmHfJcTHhb9Hxx4l4WvRYdseNeFv0tsHEyEWxATsMeJPA36DDtjxLwLvQb6cjxLwLhEwFKY8SRFv0h4YOJPC70RjxMuFxQDalcHEjha4ivSmPEinBRhtk3t0xVokdsVaB3rhV//0PSxcVpTbLGq2hKFGwpjwoBXLMO+AxSCvEynvTHhZW36ifzYOFHE7mvjgpbb5CmCltvDS26oxpILq40m3V9sC26vtim2wCdwDituofA4rbdG8MUWlPmO/wDqukXUkdwIZ0C8SCvIEsB0PzwgIJSZfzJ0c/8AHtcj5hP8nwb/ACsPCkFd/wArH0jvbXP/AAKf5X+V/k48KeJ53aT+Zh+e9zGJ71dNe8RBCJHMHpekWYcalQhPtk5DZqxmyXtGo3sdhYzXkykxwIZGVaciFFaLWm+V022x3/lYujVA9C5qTTZU/m4/zYeFbCYaL5r0/V7praCKWORY/UrIFAI+HYUJ3+LAQtpyQfDAxbofDFDqHwxVrFWmdVUsxAVRVidgAO+KoWy1jSb8stjeQXTJ9oRSK5H3HGlRVSain04q1xxVdiq1hvilbUA0yYVeK0yJQtNe+EBXChNe+FLTmgwsStCVFSTja0taPfbCCpDvRPj9GNsaa4EbHG0tqi1rU42mlxVR742mlveo2xVvk3TApWFO+G0U7iR0NcNoWkPXbDau+OtMdkN/Ecdktd8VdhVpq9sUO+E9RihaeBxBQt+DwyatHjirTNGiszGigVJ8AMBTEXyUbO9s763W5s5kuLd68JomDKaGhoR4HG2UokGir9MbY01yxtBCncXcFvbyTysEjjUu7HYAAV74krAGRpLvLfmfSvMOkrqencxbPJJFSQcWDRNxYEVOIDPNjOOXCU09SKngThprJWkJ442imiF8cIKKa4EnbfDYWm/TfwwcQXhbCHHiWm+D+GDiTTQVxsRXHiWnen3OPGvC2IxgM08LZT2wcS8LqbYeJIi1THiWm8HEmnDDa07Da00dsUU0WAGKrSzeOJKGjkUU7DaKaJqMbULcmCloncZJX//R9KmJvCuW21Ut9GSvTDxLS703Hvgtaa4N4Y2rRjbrTG0UtKMD0Iw7Ip1XHjirhz8ThoK7kw/aI+eCkrg7DviQm16zEHepwGKgrvXXwyPCtvD/AM3PMF/ZecjDbahcWq/VoiIYp3jU1rVuKsB/ssnRaZTNlg7efLtaq3mCUMmxBvnBJ8P7zHhLHjK0efL4gf8AOwTUPU/Xn29v7zBwpEyh7rzLHflhPqf1l5RxIkui9VHahfHhWyprd6epqXXbZf3rbn3+LBwlfEXC904bmdTTc/vm8On2seBj4hRMfmIR3hu49QaO5O7Ti5YP4btyr9nDw2mOSl195vmvIPRutWlmhYgmKS6crUdCQWw+GviFAfpHTBubhNj19c+P+tkfDUzKIttct7WYT218YJlFUljuCrAkEbENjwJGQo7/AB1qtR/ueuCT4Xj0/wCJ4eBPEWv8dasAD+nrkEGh/wBMf/mvBwrxFtvPWtcSRr1yPA/W36f8Fh4UHIzj8sPzssEkbQvM2oAAMfqGpzEmvf0pX35f8VSftfYbIyjTdGVvRb78wvJK2cx/S0MgZGWkQaRviFNlA98AZEGnjH5X3+k+ULrVdSlmBufqbrZRmFvjlqCqnhU9viyRkCURBAe8eU/M1l5i0SDUbd09R1UXUCtyMMvEFo27qd/2v2cr6sqTmorTJUha1K9cFK19O2GkuPHvhVwdR3wEFXcgTirRemGlWE1ySLXK60pvgIW1xYUqN/bGlWl2+WKrTyJxUhrcYUgNlvHAlbXCxJdUDFi2DXFmGicCC1yOLG3V3xQ6rHvhtVtCOuStLXIg79MbVsMuRtUu1nWYbFRGgEl44+CPsB/M/gv/ABLAZKA8nvfOXmmK/njXV3ASVlVOMWw5dKccnHcW0TO6kfO/mwhv9yz+3wRf805JjxIe380eYbaQNFqsoJBJ5cWqfpBxXiXXPnPzRNbmCXVn9OUFZAFiWqmoIqFr0xSMpBsIbRvMes6Hpy6dpeoGC0iZnjiCxsAXPJt2Bb7RxTPNKRs80ePzB82cj/uWqKd44a/8RxphxlY3n3zY6qDqxHLrSOIH7wMFLxlTufOXma5sZLW41ATQP8LBo460rt8VK1wkWoyEGwh9H8za3osEtrpt4sEDu0pj4K9ZH+03xct2xplLNKRs80dF5983pTjqfLkKnlFG2/tUYsfEK7/lYPnUCv6STc0AMEX9MFJ4y4/mF51PKmoq3EV2gip0+WFfELKPy+8069qusTW+p3azQrbmSOMRpH8QcCtVFehwFMZG3oBcUyNtyFs7uWa4u45AFEEiqg6mjRq25Hu2ElF7oqoyKXVGKuLDFVpbCrRceOHhVrkMaW2ua48K27muPCtuDjGkN8gemHdNtVrjurXLbtjZVpmxCreWSVrkcUFrFDVcQruW+HiV/9L05y9sm1u5eIwFXGhxVbTGldQYVd8sKuIJ69MC0tKeGG0UtMbeGG1poxnDa0tKcRVjQeJ2GNoSy98yeX7JS1zqMC8dioYOa+FE5HGwrx/8wPO1tP5wgu7HTry7t4LFreRxGqUb1udR6jLVSoy7HkiBu42XFKRNPOtJ1+Wzso7ebyWt5KXlcXDiDnJzkZ6nkjHYN/NkjniowSoBCW+rSx+ZbrVm8nK9tNbx2qWdIOKSI9S4+DiS32dlweMEjBIAphda8Z7i09Pyd+jzZ3MVzNcQi3LhI6kj4VT7X+tiM0UHBJkX+NlJVf0NfcmFQPTi6D/Z5MZ4NfgSKyy85QpbKraNfkl3AYRxEEs5O3x4DmjaRp5UoXvm23dpz+h76noNExMcWzFgez+GP5iLE6aRVv8AFmnFuJ0W/rQmhhj6f8HkhqAv5WSna+brKNX/ANw99SaQvFSGPcFR/l+2A6iKjTSCWeY/MlteSadLH5fubuKzuWkuLeeKJUflE0YHxFwSGcHpg8eLKOCQKW6zrEF5pd5aQeSfq08sLIswS3rGWBAf4UB29sHjQT4E12laxbwWFpayeR/XmjhRWkKWxLlFAL/Eld/fEZoMjgnfNUh1T/cFrtpF5fubaXU3m+qwQxRGNDJEsaryUqPtKa0XD40GB08zTHNC8u+YtP1fTJUsZv0fzBlBFTbuq1NaVojncA5hznYc7HGnr9hqUtOJJBWnXrmPbkBN4b3kBU7+NcKkK3lbWJ9E8w3l81lPcWtyhT9xJGOTVHEujsu6Ubif8rJxlQYcLMP+VlQU/wCOPe7f5Vv/ANVMPiBh4Tv+Vl25/wClRfD6YP8Aqpj4oXwnD8yLev8AxyL6n/PD/qpj4oXwy5vzItyf+ORe/wDJD/qpkvEivAWx+ZFt30m+H0Qf9VMfEivAVw/Me17aVffdD/1UweJFeErh+Ylt30q++6D/AKq4+JFeAt/8rEsx/wBKq++6H/qrg8QI8Mt/8rEs/wDq13w/2MP/AFVx8QJ4C2PzCs/+rbe/8DD/ANVMPiRXhLh+YNmf+lbe/wDAw/8AVTB4kV4C2PzAsq/8c69/4GL/AKqY+KF4S3/j+w/6t97/AMDF/wBVMfFCeBo+fbE/8eF5/wABH/1Ux8QLwFr/AB7YjpYXn/ARf9VMfECPDLv8fWB62F5/wEf/ADXj4oTwF3+P9PA/3gvf+Aj/AOqmPiBPAWv8f6dXewvvn6af814+IGPAW/8AH2mn/jxvf+Raf814+IF8Mtp570ok1trxKeMa/wAGOHjCOArj520kn+5ut/8Air/m7HxAjhLX+NtKB2iuf+RX9uHxYo4Sv/xxpQG8Nz/yK/tx8SKeEpXL+YF0LidUsZDAVAt3KioavxFhXf4dxlZyMhFh3mTzLczapHaQLPZ2twvK91RlVpgBUFYkr/eN/vw/DH+yuRjKymQoPL79fL6ReZ7eDS7hzcyTHTJJLSWVyrQhVPqlSwPqAmpb/KzaYZxEaLrs0JGdhFQ3fkQRxiTy5NzCryP6NY7gUPbxyZnBr8KSD0qfyZCl0Lvy/M7PdTPATp7vSF2rGvTbiP2f2ceOCnFJfb3Pk9de+sJo0sNn9UMbK2nyAGX1QwPEI37H7WEZIsTjmmF3qHk028ippjcyPhpp0o7+Pp5LxYI8OaodW8iVr+jyP+3dL/1SweLBBxzQkeo+ShOhfTyFBmLE2EvRmBT/AHX4Y+LBfDmvvNU8jNbSrHYnmV+ECwlG/wDyLw+JBPhzVf0p5BJr9S2r/wAsEv8A1Tx8SCBjmk1ld+RkmvzeaVLL6l1I9vILKYj0SF4gUUUoeXw5EzgyMMim9z5F/TaSfoiYWP1ZlkT6nPT1ualTxp/Jy+LETgvBkXajdeSZI7b9H6TNFKl1A7t9TnUeksgMoJI3HD9n9rESxqY5KZ9+WvmfQtL8wawtjp7kX0NsLd1iNvvH6nqAGRV8UJplGfJHo3aeEhzelN59pT/cbKT3BkQZjeKHM4Cg4POZivLq4OmyN67IygTJsFjCGo6dsfFCPDkzGxujdWcNzwMZmRX9M7leQrSoyfNirBxTqMaUF3PDSkrSxxpBaLYVWlziq3kcKu5+OKHcjgS7mfHCttFz4/RirXP54q7meldsaRbRfDS2t9UdsICLd6mPCtteoRh4Vtwkx4Uv/9P0h9YfLaaW/Xf5YeFXeu3jjwq16z+ONJbErHvh4UW4zsoqx4jxOw/HBSbS+880aLZsEuNQhRz0jDhnNP8AJWpxoMeJJbv8y9DiD+iJ7gJsWVOC18AXKk/QuOzLdJ7n80dSccLOxjhciv75zJwX+ZuPAf7GuAkLwlJ7vz75nuWBF4YYifgSBFRpDTsSCwT6cjaQEnu7+9uWdrm6llb/AHdK7syr/kICftYCWQih1DLxVECsBWKM9EH87/5WKUNNHGwqQXjJ6/tTP/zT/n9nBa0oPaqWerAOBW4lGwUdQi/5/wCVgQpfVB8BVAGpS3j/AJR3dsUtfVIgu45Qqdz1Mslf6/58VxQu+pkllLAMRWdx0VR0QH/P+bFQG1tmqhVeLH4YEp9lf5iP8/5cUrGtUAO1YYjuepeSv47/APD4sW/qRPJD9t/inYdFX+UYUgNfViT6oFGk+CBT2X+b+P8AwOBabNogHSsUHTxZ/wDM/wDBYopv6hUiJ92f95cEeHYfLt/qriq9Laqc12eY8IvZfH9bYCkBVEEMdWUfu7cUA8WIw2mkRbRMgSIn4z+8lPvXp9+ApRHMsvJqO0r0jBFaDx+4VwUm1dXhXm1Cqx9SN96VpQ5HhZAoqKVKhQwLEV49DSuKbRMcjDr9GAhKus46UyBCCvV1PhjSrgwHhjSF1Vr2xS3QE1xpWyfAY0ri46HbBS24v02xVxcg0AxV3InxwK3ybrTfvgVcCepHXCq0nsBuMbS2Q1B1wq6jdxirhy32xV1SNqbnFDRJA36eOKtqCy1p1wrS4J4jFFBTkuLSI0eQBv5Qan7hiIkoNBDvqQp+6iJ3pyf4R925yYxljxISa5upK8m4Ab8UFNvmd8sGMMeJDyW6nelSw2Y7n7zkqDElDGI0qdwdmwoIWG3alPD7J8R4Y2ilv1XwNFY1+nG1pY1qxPIncfCflimm/qrmq19x742tNC2NN+/68Fopr6sw69R1wgrTTWxI2O3bCSimvq7bD7t8bWnLCwqKVJO4ONqu9HerD4um/fBa0u+rg9uhw2mkTbx8eYPtWmC1CKDSrTix+/Y/24KDO1wnJJDAH36ffTHgTxKbPqFWEV/cRRtsIlIYKPatNssEyOTUcYJUVtb5hQ6nJU9mUD8emPjS7gvgjvRFuuv24b6vqc6q3XhSn4HIHNLuSMI70Rb6n5mt5RJ+lppOP7EoV16d1ORGUsvCCL/xR5oPW8i9v3CYfFK+EHf4n8z/APLXF9MC/wBcHilPghr/ABP5or/vXFT/AIwL/XHxSjwR3t/4m8zf8tUR/wCeC/1x8Yr4I72v8SeZv+WqE/OBf4HD4xXwR3tHzL5prtdQ/wDIgf8ANWDxivgjvTmy1TVZrWN5blfUI+IrGoB++uUS1EmccIVWub1lNbtx/qhB/wAa5H8xLvZ+DFU0Kad5r9ZZnm4SqI+ZrxUoDQbDvmdpshlHdxM0QJUE155ktTueKtcjhVqpxVsE4LW3/9T0VRa7A5bbU2DthtDq1xtW6YLV5V+c/mfXNMS3j0fW4raK4SSOe2REkkDJSp58uSHfpTAS1E+p5W3nDWpggur95SCSQ5LAkbAnkx6DI0WziUh5r1GkgFx9pvjbiAaV6LQ7bY8PmnjLl84aly5GZQQv7peI4j3pXrjwp8Qr28z6gvGM3FVryc8RVjT9rfBwr4hbXzRqTiQi54yN8NeO6rWnw77YOBfE8lx80agsvH1xxiX4F4ClT3Pxb48HmnxPJYnmrUWVUNz/AHh5THgKnatK8unbHg80eIe5z+adTAlmFyOQHFBwFAKdhyw8PmnxFh803XKNBdDgoLEGMVZtqcvi38ceHzR4nk1/im+KPW7XnI3xsEFQtaUHxbbYBDzXxT3NjzXe8uXrp8C0iX09hXvSuHh80DI2vmi9CIhuFKk8pSU3JpWh3wcA71OU9yofNF+VaQXK+o5IrwFVUDbjvjwp8Qt/4oulkUfWF9OMVUcBu3TffHgXxT3NL5ovDGAbhayNWWiCtK9OvTHhXxGx5pvCZpBcJyA4xDhsBStevjjwr4ionmG6rEhuVKKCx+AVLCnXf3x4V8XyXJ5gvJI243K85Xp/djYVpTr4YOFHiFuXXtbE5EMkDFCkSh1IHxhmJ25fyYCyEyrx3XmMxxj6zaUryaquST1328cCnIvN75jHqn61acjt9l9hTttjunxAq/W/MYkX/SbMBFoq8JKdvpx3XxFovPM3pgG7tKM/I/u5Kn4sd18QLjf+ZQ8h+tWgJUAfBIaUrgT4gcupeaF9JVvbYBVNBwkp0774r4qFbz1q+j30Lau0M+nyzenPLEHDxq2/JVPw8V/a/wAnHhtMc1ml+s2MVxr2oXtx5dudZt7j0TZ3UBRk4LEAwFZU/a/ycyMU4gbtWWEidkjvdBebVtOntvKN/FYQmU30Pwgy8lpGKetvxbfMjxcbQcWVV1bQPW0u6hsPKOowX0kbC2mPEBHI2NRMenywHLjQMORFW2jWyWsKS+TdQedUUSybfE4UBj/fdzg8bGpxZUJpOhTW8moHUPKeo3CTXLSWQG/pwFQAn98OjcsfExp8LIjbfTHTUTJb+W7+zg+pzxMHQvymcqY2A9R/sgN8WHxcaDiyLNN0eIWdvFd+UdSa4SJFnlox5SKoDN/fD7RwHLjTHFl6lB6fod5Deag115V1KWCWcPYp8X7uLiBw/vdvi3wjLjQcWVu90K/k1Owlt/K+px2MRkN7B8Q9QMlE29X9lsfFxKMebvVdT0a7l025isfKuqQXbxsLeX4gFemzf3x6HD4uJRjzd6KttKpawJN5T1Z51jUTOeW7hQGP993OQGTEnw8vehLrQNYk0xIV0PUwv195WgTmkotiDxX1BJ2NPh55bHNhHNicea9ig77ytqTaZOln5f1yPUGU+hK9xMURuxI9Y1/4HDLLg6Moxz9SmcGlzJDEsvlbVmkVFEjAyGrBRyP993OV+JhYnHn70Ho+lX8UNwuo+W9Xmla4leFlMh4wMR6aH96PsjHxMTLw83eqw6Lz18y3nlzXf0P9W4pbwSTRuLnnXmaTD4eG32sicmLozjDL1TVdL0lLzT5NN8u+YLaSK5Vrp7t55oTBxYMpjaaQMeRX9jBx42RhMhNtTLTzejp8EltJEgZ/rCSRKpDBh8NRXkBgOaPINZxz5lDwzeYImXi9uaDYt6h+ffKyLT4pCoup+ZlVTztRU/ytjwr4pd+lfNPxnnbH+UcW8K48JZeN5O/Sfmv4avbe+z74DEo8YNHVPNXpseVtsaDZ/ltjwp8Zr6/5oJofq3TcUbHhScvksi1PzMXX1mtxGepUMWr1HWm2SEGJzeSJ+v6uWaksR8AUPWnzw8CPFLX17WQF/ewmn2vgP9cBgvilo6hrQr8cNR0+A9PvxGNfGLf6Q1jkKyQhT/kHr9+PAvilr9Iazx3khqPtEqen34eBHilpr/WKmkkQP7HwH+uPAnxStbUNX2PqQ8f2vgPX78Hhr4pa/Ses0PxQ1rt8B6ffh4F8UtnU9XqPigp1Hwt1HXvg4EeM1+k9a415wV/a+Bv64eBfG8m11jW15ANBUfZHFv648C+KVzazrpK8Wh413qrf1wcC+M3+mNc6MYOVd/hbp9+HgXxW/wBL64K0MHT4fhb+uPAnxXfpnWqDeGnfZuv348C+K4azrgqawV6nZumDw18Yrhr+v1+1ER+zUMa/fg8IJ8cqcmueZA0ZjitnRfthi61PgaA4DiXxykt7+dXl/S7mWx1a2uRfW7mOcwRhouVK/AzOCdjkfDLkRnYUP+hgPJH++L7/AJFJ/wA14PDLLicP+cgfJHUwX3/IpP8AmvHwyvE3/wBDBeSP98X1P+MSf814fDK8Tv8AoYHyOTX0L7/kUn/NeDwyvEHqnk/zBZa75cs9WsuYtbpS0YkAVwFYqagE9xmHkiQWyErCecvDwytmraEQLvUVP88TfembLSfS4Gp+tOPh8czQ0tbeOFWiQO+BLXIU642hoEeOBX//1fRu3t92WNK2q16YFd8PvirvhrtiryPztqHkzSdfuRrklnZXFwxlQ3KorOh25gkfF0zGyA23YyDskI82/lV/1dNL++L+mV7ttBcPNX5WOKDU9LPtWP8Apg3TQcfMn5XGn+5DTPpMX9MbK8IcPMX5WHf9JaV/wUWG14Wj5h/K7/q46UK9+UWNp4F36e/Kv/q4aV/wUWNlHC79N/lZT4dQ0o/7KLBa8DY1n8rKf73aUT/rRY8S8K4av+Vlf97tJ/4KLDZXhC79LflbX/e3SfnyhxsoEQ2NX/K3/lu0n/g4cbK0Hfpf8rDWt7pO/i0OC14Q1+k/yrp/vbpIH+vDhtPCHfpL8qD/AMfukf8ABw4bRwhv6/8AlVWv1zSNv8uH+uNleENi/wDypJr9c0in+vD/AFxJKOENfX/yqr/vZpFf9eH+uNrwho6h+Vf/AC2aSP8AZw/1xteENNfflXwbheaUTSnwyRV/XiCVlEU8R/x1f2d7dWlusMlrDcSpCx5t8CuQu4bcUzYwxAh18juiofPupPyHpRHl12f5eOW/lwWHEih501djX0IunQCT+uH8sE8a5fOepHb6vHtvWknjXxwHTBHEuPnHUSSfQj8NhJ/XB+V81E3DzfqWx9GPbYDjJ/XH8r5rxpp5VeDzHrcVjq9vG9pR5WUGRDyAAHxE++Y+oxcEbb8FEvVrfyxotnZiC0mnggiUrHGly4CjsAKnMK3M5KdjdSFzbXBrc29A7dOan7MgH+V3/wAvlhSmAlFD74oXrIcVXJP2IrgWmzcrUVNB74rTRv4lYBmAG/fFaXPfQ0DBxU/LAtLF1FQ9GIp0BwJpVW/hJpyH34rRWm/QkgMKAb74rTZvohvyArv1GC1pqTUYwh3BNN9xja06PUYyCAR7bjCtL0uot/iArhWl3rx1FWrXYU3JJ6AUwJR2r6BNaWlnNcyyRXFxzJiRuIRQAQD4vv8AFhDEsQ8y2sWn6Hf6hbScrqJDKObcwxqK1HU1GWwu2udU8wHnjWBT9xbmnT4ZP65ncDr7aPnbWCB+4t69fsyb/jjwIto+dtbqaRW4rt/dvt+OPAkFy+dtaotYoHC9Ko/8Dg4Ftsed9YANYYADufhkH8ceBeJUj8+6lUco7Y0H+X/XAYM4m3p+n3HlWTyzod3fvZQXl5bvJMHlVWLGZwuzty+yNswjI3TmCMatUD+S6/70WX/I2P8A5qw3JeGHk4HyYynjcWTAbAiVKbbdmw+tHDDybY+TQByuLJSTQVmjFT4CrYCZJEYt8PKFP7+zr/xmT/mrD6kVB1PJxr/pNnXoaTJ1/wCCxuSeGPktc+TVoWu7JR2JnQfrbG5LwhsjyeaEXNmQe4mQj/iWNyTwx8myPKFafWLOvgJkrT/gsbkvDFaR5QA5NcWYVdyTMlPxbBckcEfJ1PJ53E9mQe4lTp/wWSuSKj5NV8oA0FxZhvD1krT/AILBck8MfJph5PVam4swOpJmQf8AG2NyXhj5NKfJzDktzZsOlVnQ/qbG5I4Yt08n/wDLRaVPQGZKn/hsfUtR8ncPKVf7+0r/AMZk/wCasfWvDHyaX/B53+sWZHSvrIf+NsfUioNcvJwIBuLIHsDMn4fFj6k1DyWtJ5NA3urMAf8AFyf81Y+peGLyr897TTb7TNH/AEE0N0yzSmdLWRHoGReLNxJ+/LMPFe6ZcIDx0aBrPT6nLt7Zk008QcPL+s9Pqclfl/biniDX+H9aPSzl+4f1wUvEHf4f1v8A5Ypfuw0vEH1J+SE4X8v9PsZCFvLT1RPb1HNA0rsvIDpyG4zW6kHibsB2Pvegh/vzHb1XRWA1C/Feqwt+DDNjpD6XB1P1BOua065l7tDRYUxStJHjitNcl8cVpoOK4Vf/1vRQ33ybS3hVrFWiK9emBXy1/wA5TRrP52tI2Ab09PjoG95HO2XCNhx4mpF4RNpkdSAAD7YPDb+IojR9Mpec6qypx/Fqd8HCAVMjSZzQr9SmAQE8P5R+zCxOW8IabNrorOGOwt1MSsWiRuVB14n/AJqyMQGUpG0MLW3bUg3pr8KoAOI7sckIhHEaU72K3GnykIvLiQCFAp8Z9sJiERkbZr+TP5d6N5lsdSur6KSVoZ0hhCMFH2eR6g+ODHp4S5ss2WUapm3nr8lfK2jeTb3V0SRZ7cwmNXdSvxzIhBHHwbI+BAHZgMuTa2Zw6PpCQLGtjbcVUKv7mPoPoywANc5G1HTtL0r6zqBNlb0+sAU9GPtEnthIDGJNMb/NzTtMh/L7VpYrOCOUCLi6RIrCsq9CBXISqimJPFH3vmPMN2bMfyxsre485aGssSSo9x8aOoZSArGhBqD0y2ADVM830suh6JX/AI51p7fuIv8AmnMkAODZS3Q9G0c6ajfULY8pJjUwxf7+f/Jw0EAlKta0bSW86+WkFlbhCt8zqIowDSFaVAXelcEwKZYzuWS/oHQyP+Oda/P0Iv8AmnHZBtL/AC5o2jfosN+j7U1nudzBGTT6xIB1XBQTZoMG/PjTdMh8v6Wbe0hgdrtwWijRCR6R2PEDIkAs8ciJPUPy6sLNfI2ggQRD/QoSfgXclak9O+V2me5YD+e8MEd/owjRErFOTxolfiTwzIwcmrq8yQkftCvs5y9krrNtvx/4M4oVFlQmnJQf+MhxSvDddx/yMOBUs8w3U1vZLPC/F4pAQQ5NdiKEZj6mNxbcBIkhbTzdVAXnKN0IJIp+OaiWEuzE2V65+ZQ1Xy5Y+ldtHrllN6UskTsrS27KaMeJFfiC8v8AK+LMrTQ33aM8ttkrh8z69IARqF1Sm/7yT/mrM/w49zh8cu9WTzJr/bULr5epJ/zVh8OPcx8SSw+bNaUkfpK5quxo8h3+hsHhx7k+LLvZh+WPnHQ/rupf4t1RFi9KP6mL6Rqcizc+HIntSuYmoiARQcjDO+b0NfMn5Skcvr1ga96n+mY9NtjvbHmX8om2Ooad4Ecjjw+Sb81w8x/k6SFOo6by7Ly3+7GvJbXjX/yhFSL/AE4e9SP4Y15LfmvXX/yiFf8AT9ONepqf6YDHyW3DzL+TXLidT0sOP2S4r9xwcB7k2u/xH+TxFf0nplPdxjwHuW/N36d/KCtf0hpn0OMeA9y35t/4j/KHtqWmmmxpJWlO2AxPcniRNn+Yf5PaJN+km1KxD2itJGkR5SswX7Manq57ZUQTyZgvNfMnnO48+al+m9Sv0t7aK4hj0jREY14GZd3Heo+1X7WZGCB4g1Zcg4SAyTzzpdjHoE0kMCROkikMihTtWoqMzzEOuhIvMiSd6/8AD4bQ7w/5ryQFoJA3LiCKkggePI4Tjl3NQzw7w6oAG/X/AC8g2orTArahaBgGQzxBlLcgQXHbvhgN0T5PTP0fp5be1goP+K0/pmSQHGsvGrG0toPzdkCRqqx6qojUAUUFjsB2GY0YjicycjwPfo0hNCVX7hlhaRLZjWjKiDUFAApqV6dgO87H+OWR5NUuaR/mIqGPy8xAPHWLc1oPfBLmzgTwy9zLSqVNVH3YXHtKdAWPlqo4j/jo3FRQdwh/jhplI7sY/OWCN/LNoSo2vB1A7xtleQCw5OCR3egeS7e3bydojcFJ+o2/Yf77GMhu1h0dpAPOUw4L8Wmx9h+zcP8A1xBSeiG/MG0hPkvW14L/ALySHoOwrjLkzhsUL5UWNvLOkniN7OHt/kDLSHHaWGP/ABXL8I+LT496fyzv/XAAk9EP57t4m8mawOA/3mY9B2IOQkNm3EfUEp/Je3ifyaw4D4buXt7KcIiAGOQ3Msi8xW0SS6O3EVGoRilB+1HIP45IDdhP6SmHopUfCPuGJRRpKfLUMY0114gcLq6XoP8AlofFTzK++ijHmDRDxG7XS1IHeGv/ABrgWXL4p20ERRgUXcEdB4ZA8myPMPGfK3kOTUdIS5SeONfUkUKykn4WI7HMSeYQNU5oxGScD8spa/71xD/Yn+uQ/NDuZ/lyv/5Vi9Km8j/4A/1wfmh3J/Lnvb/5VjMOl1HT/UP9cfzQ7kflz3tj8sZ+puo/+BP9cfzQ7kjTnvZZ5G0u68q/XOJjuvrfCu5Tj6fL2b+bMbNPjbcOMxNsqHmi9DA/VY9v+LD/AM05R4bkcTIfLFw1xczTOoRpYImKqagHkw6kDMzS7CnF1G5BZDTMu2imq74LSA1UY2mmiRjxIpwbfpthtaf/1+1eUvM2m6xYcbS/N/Na0S5laJoWqa8eSsOtB2xojmg0d0+EmHiY8LYYY8S8LjJtjxI4Xz/+a/lbWvNPmRtQ063jUIiwH60y1Kx16ca/tVxjnAKBhPMMHH5R+bCJfUgsieNI/iIo1R19qVwnUjzZeEVGL8n/ADetyjtb2LRApzCyMCVDVNN/DpjLURQMJ6q8/wCVfnNbcpb2tkSY5Iwsz8lUOpSg3b9lvtfzZH8xFgMBbl/KfzUVtVjtbQenCiTcpG+2Bvxofs5IZwEywm1Afk/5t5SSPaWXrMVCESPQIAa13+1yOD8yF8Eqbfk35se3eB7KyIKMFpM/2qfBU16cvtZL8yE+CWcflh5S1nypo9xaXtiv1ma4M1bOYemV4Kor6jcuWxycdUAiWEmk6882/mHXvK13o9nY/vZzHx+syII/3civ8XA8/wBnH8zFgcErCpBD5gFrGJbOk4QeoqshXnTfiSwNMrGoCZYCVK2tNeikuna0P72X1E4mPccVXer9dsl+YFsfyxpbqVhql9p8lnd6NDfQSEFre44MhANd6SDpTlkcmexszx4CDuwTzp+W195hgpp3lqwtb61EcCzRyfV4lCAExlI2HLirU5ZjRmerkmKC8pflN5v0XzBpt8+n2iW1qQ8zpK7yBjGQ3EM1D8TbVy8ZhTXLGS9VaHVhQi3JI9l/5qywagNEtOUHpuna3b2SQyW1JFLkhOJFWct3bwOH8zFj+WkgrzRvMM3mHStRSyDRWUdysjFlDqZlVV4jnRunxVxOpFUmGnkLTZItc5UNo3EHYnhX/iWR/MRX8tJAadp3mS1s0gayAIeVm4utPjldx1avRhXJDURU6aSQ/mL5R8xeY9KtbdbIE20jyuS6ghTGwqlG3blx+1+zg/MjkyjgI5oXyz+dPlfSdA0/Srqzvzd2ECW1x6cKsvqRDi9Dz3HIZZwEtcgxf8x/POl+bL2wl06G5hS0ikWT6zGEqzsCONGbsMyMII5tRjuxNWPv/wACMuQqAt/lU/1Bilurd+X/AAAxVeruPslv+AxVuTQtV19JbGwtHvbkL6ghXihPE/zE5j5yAN23EDa7Rvyc80HUoW1jy7eJpyuPrPpzR8vToalaBj8NMwDIU5gCb+Y4vykg0CCG30u4sLxhcmwnDytIZEbgwmDL8S+oPh5fs4cUpk7BjkApgdtJRRUD/gTmyi4ZR0UgPYf8CckinuH5VQo/k62NBvJcf8nmyiUmBG7zf894kHmu2XahsVP/AA74OY3bIbPX9KUfomyouwt4e3b01yQaSo6fEn+mniP96Zuw8RkmLHdQVP8AlZejMFApp11XYfzDIy3LZH6SyHWFB0e/qBvazdv8g4kMAmMdunox0UABV7e2R4k08hlhiH55MSopXwH/ACyDDQtmSeB6nqcEb6Rd/u1r6EvYf77OJaxyRMMEZtovhH2F6gfyjBxJILHvKiQx33mAlAeOrykrQb/uojTJEWE8iLeX/mymu3+ow3uqtEsPqSxWdlASyRIhFSSQtXb9psxI4qcvx+LkzDy9pWoSeS4Tb2M8xadJIzHEzchHMjNxNKGgGThkALVKEiz+7ez1S0khvbO9itQ6tIHhMRIFdvjpsfHI5M1cmzFgPV5x5hs/LFsI20a9uLlnPxpLHGQo/wBZKfRtk8eQnojJCIS7TfivowRUUOxSnQeObDSAGdOj7YNYPizrTfLVrf8AlrVdTkkdZbJW4RALxaicviqK98zNRnMZiFbSdJo9GMmKWS6ON5paO5hSprUDquaqQ3etx/SEdbXK288Uzq7JFIkjKiVYhWBPH32wA0WUhYZePP2jkk/Vr2n/ABg/5uy3xA0+DJj58gedv8ZDzNHo8p068uItQtVLxLK8DHkCVL/CzL+y2Yo1EQXLOCRi9EW719R/yj17/wAHbf8AVXLDqoFgNNJLLCDzLbteep5fuyJ7ue4Ti9uaLK3IA/vOvjiNXCkS0syUu816J5s1eLTkttBuUazvobpzJJbiqRVqBSQ/FvgOqgmOlkLTwjzEST+gLzc95Lb/AKq5L83BqOimg9MsfM9rJfM+g3JF1dPcR0lttldUWh/edarj+aik6OaWee/LHm7zFo0VjaaNLFLHOsvOaWALQKwI+F2P7WROpi249NKLJvLa+YtM8vadpk+hXDz2dvHDI6TWxUlBSorIDTInUxX8tJEWqan+n31O8064tLYWX1ZRWKVy/qmTlRHICqvi2RnqwOTIaU3u35pt7jU/LV7Y6dZ3VxdXlu8S81iijBdaKxZpPs/6obIx1gPMNn5WuqUaDY+Z9O0SxsJ9Dnaa1hSJ2Sa3KkqKVFZBmR+bg4v5Sdtmz8z/AKaF+NCuPS+q/VyvrW3Ll6nOv95SlMH5uCTpJ7Kev2fmjUdEvtPi0C4WW6heJHea24gsKAmkhOJ1UCyhppA2lv5f6B5x8s6HJp93ok08jztMHhmt+IDKop8Tqa/Dg/NRqkHSyMiU21WDzTe/U/T0C4U211HcNymtt1QMCBSTr8WI1UVOllSK9XzIP+meuv8Akda/9VMkdXBH5SaC0q380WcEsUnl64cyXE8y8Zrb7MshcA1k6iuP5uCPyk7XXlt5pmv9Nuo/L84WykkeQNPbVKvE0dB+88WyP5uNpOklSY/XfMnfy7cnx/f2v/VTAdVFI00nnlvoXnby15W1h75ZLNDKkli6PE4j5v8AH0r9quYs5RnJzIgxBYdqnm7zfb2plj1i45cgD9jof9jl3gxaoZ5Ero/NXm97NZf0zccmTl1TrT/VwHDEMfHlbI/MOu+YI9N0CaDUp4XubBJLhkKj1JNqu232sqxwBJbckyIilkHmDzGfIOo3g1Sb9IwagkSXLcWZYiq/BuKU3wHGOKmeOZIJWfl5feZ/MMV5cat5omtLeEtHEsSxPLzUA82T4f3QrTr8TZXlAi2RlZZUuk3qSqI/Nl5eEipj9H0h16c1ZxlPEGb1vyfG0EixFi5FpHyZjVieR3JPzzI00ubj5hyZOzgfaIHzzKtrpRe9sozR541PuwGC000t7aMKrOhWvUMMbC0tfUbFPtXEY/2QyJkGQionXdLBA9cGvcA0/Vg8QJ8Mv//QmH5GSrLZ60yspKXEcb8TWh4E0Pgd8nlNljEVB6ZLdQQ8PWlWP1GCR82C8mPRRXvldItV5b4aW3F9sC2wMsDK/jyb9ZzHPNyI8lC5llELmAKZuJ9PlXjyptypvTIsqXws/pL6oAfiOdNxWm9MWJC31Lj6yAFQ23Dc1PPnXw6caYpAVWc0biByp8IbpXCqy2knMCG5VVm4gyiMkrX/ACa/FTArriS4AQ26o5ZwJOZIAT9oigPxeGKq3MbV2p92KqSS3H1mUMqfVwq+m4J5E/tVHT5YrS6aWQQyGAKZgpMavUKWptWm9MNquSRzEpkAV6AsF3ANN8UUseW59UCNUMHpklyTy512FP5ae+BNJd5e+vC2uTqDRfWzcymT0QQnYDjy36YpTK3luWVhOioQzcOB5ApX4Sagb0+1htBbuZJ0t3a2VZJgP3auSqk17kAn8MbULxJQb7V64oKmJLj6068F+rcAUcN8Zap5AilKdKb4FCozkK3HdwDxU7AntXG1pq3lkaBDOgSUqDIqnkoam9DQVGFVt44FjOQK/A2/0YRzRLk+OppgdSuzUCs8p+0e7nNxjOzrZBExyjxX58jltsCrowPQrt35nCqopFeq/wDBnFVQMKj4l/4M4quDA919vjOFWdfk7v5qlNQaW7dGJ6svjmDreQcrS8y9ydgIm3oaZrnLfOn53WaS3dnfRQC2gRmhC9DI0lZHcqN0YMOLA5l6Y9GjOHnULgU6f8NmcC4pCLjmA+XzOTtFMl0L8zPNWg6cmnWCWb2sTO0ZlSQv+8YuakMB1OUyxpFMp8s+X7380UvdZ1W++oXNoyWSLZxjgYwvqVPqEnlV8x8kzE03Qx29Tg8q3EVtHAt5URoqBim5CgCvX2yPjlfy4ag8pTx+rS85eq7SGq9OXYb4+OUflx3oK4/LyabWLfVBqbJJbwvAIhGChEhqWNTWuPjFPgbVaLm8j3U0EkTakQsqMjER7gMKVHxYnOWI0w70bH5UugKfXaigH934f7LKjmLMacJH/wAqiQ+ZG199Wl9diG9ARrwFI/ToDXl03yQ1BZeAKpPpfJskts8BvSFkRkLBKkcl4169sTqCxGmConlKVEVBefZAFSvWm3jkfHKfy470BbflvLBLePHqj/6bO1ywMYPFmVVotCPh+Dvh/NFZaUHqvtfyR0vWtatJdYvpbqxtmklkswqosnKnws1S3HKpamRZx08YvRPNFna2a6fa2sKwW0ELJFDGAqKqkUAAyHVu5MT13iNKum41ohNB128MbV4JoWktq93NbRs4aO3muFCVct6QqFpVePKv2v2c2IlQdaRck9H5bayHCjUrCO6ST6v6QujzF2U9T6t9n++9M8+P8uShmo2GGXSicakLCvD5d/MBtGbTLfV4qXSwyXekJLGtysd03CN5SIw3Fjt9v7OSnnMpWWOLRQhAxiKBQS+Q7W2076w+swP6dzJaObblPEHiRWKhlo3ME8XXj8OWYRxk006zMMEQSxiGYOgI29i5yqQot+M2AUfAVIG46fznKZt0eb6IglQ6RotSBXTLXv8A8V5g3u7ADZvlFTqPwwrSFSKVbqaT6wGjfjwhNKLQUND742ghE+rGKVIH0jFab9WIioZfvGBaQgjmF1LN9YDRSABYTSikdSD/AJWG1IV1mjpQkD6RgtivEsRH2l+8YbZUg72Jnk9ZLgqixurQAgq3IdT7jtgtQFPRr+K60u2n4tGrIAFkHBvh+GvE70NKr/k4QWJG6O9SA7h1+8Y2mkPdxtK0LR3HpCNuTKpWjilOJr2wcS0qrKFFGZT7gjCChsTwH9tfvGBKneKs9s8Mdx6DuKCVGHJfcYpdHIEQB5VcgUJqKnFivNxCR9tQfcjCqjehbi3aKO5ELNSkiMvIUNdsFsgG45FVfikRqd+Q3xsIYh+b10ifl5q8kbq0kaIwWoPSRfDJwO6a2L5bfV7u6t3WXdCwNAo2p75nwlbhHGAUyt9YgWzSIxSFgnHYCnT54S1cG7I/Ot7Mvl7ylJCzqHsSDSn7PDxyjF9RciQ9Kpol2W/LTXHlDsY72Fm6Fjy4DBI+sJxjYqf5WIksusA/AGib7XYHft8shqAyx83puhKhhRgCobcBhQj5jMVvZ4muNauktqw5NAEd9vhoa9DksVi2M43SBu9b1C4Yubg79CAAfwGWmSiIQ8V1O0oZpWJPXc9MFppjOi3N23mCUSu7olxKFqWIC8TT22wsTzZb67Dv2wEsqXJOeJ3/AGT+rEckv//RZZajBbys+nXQtzIxJa3k9PkVNCTwI5EZXuyBFJxD5w80QlSmovKFPwiZUmFf9kpP44eIqYpvb/mf5hiUevDbXA7/AAtGfvUkf8Lh40GAZt5W8xvr2mS3bW4tjG5j4h+YNFBqDRfHDxMZQrdIdzU06nMY826PJSIo1D88DJeSB8+wxRTqCu3XEJXcT3G3uMJChoL1C4KRTqAHfqMUruJ8DTCtNItG2G5FcCuKbksOvTFVyqeNACRirVN6d8VQumgmO5YjY3M2/wAmpiVRaqewrTFXFfEb++KFyq3gd++JVpRuaDrirZUdwfbGlbHFQADsOgxKqOocf0fct4RtT7sYndjLk+NnZje3J33mkPQfznN1Dk6+SKiLbfaH0DJsCikLUp8X3DCxVlZuo5e2wyQVcGf/ACtvYYFVAXI/a+4Y2rOvyfD/AOJpia7W56gD9seGYWtOwcrS9XtkpPoNt2Oa4FzXhn598fR05qkNzAO5ApxY9OmZem5uPneRI3v/AMNmc4pV1kPY/wDDZJWpJjTc/L4sBQ9w/wCceJD/AId1Y13N6vev+6lzB1HNysXJ60rimUtjreL0lKh2epLVcliORrTft4YqvaPlIj8mBSvwg0U1/mHfFVcgMhBJFRSo64CUNwj041jBLBQAGY1Y08T3yBZAtlf3wl5tUKV41+Hehrx8cDJc8nKMrUgEUqNiPkcVWRt6cax8i/ABeTGrGm1ST1OKto3GZpBI3xADgT8IpXoO3XfIkJCKg1y4syDbRLLMxCIHNF37k9aDK2SaebNMQ2lrLdSNPcyMQ0lSoA414ooNFXJgMSWF6xp0CWMzJX4RUAs3Y/PJhiXheiatd6VeS3NrIkcrQyQVliLrxkoG2UrvTfNgRs4ANFGt5y1lbtrz17czvqC6xx+ryBfrKwi34/a+xwH/ADdgpkZL/wDHWtvBGGltPrkHpiC/NkfrAELc4/j5U+D7Iqv2ceFPGoap5u1fUo0tzJZ2Nssjy8La0MQaWUfvJXAZvjPjl+HLLGbHVw9XpYZwBLlEpHbqyIBUmnfiMgTe7dGAiKCYQepT9r/gRlM2yPN7t5StLefyLoDzRiSQpdAu4BY8bhgKk+A6ZhEbubA7I86XZnpEn/AjFO639F21aCBT8lGNIsuOmWw2MCj/AGIxpbLf6Mt6f7zr/wACMNLa39G2h/3Qp/2IxpbcdMtB1gUD3UY0vEXfou0O4t1p/qjBS8RabTbUVpAgIr+yKjbGlsqNnptsbG3ZoFqY0JJUd1GGltVGmWpG0Cf8CP6Y0ttnTLXb9wg/2I/pgpC06bbAVMCf8CP6YeFNuGm2h6QIf9iMeFFtHTbTp6CV8OIwUm2jptoKfuE3/wAkf0w0i1w0+zPSFPoUY0rv0ba/74T/AIEYgJtx0+1H+6E2/wAkY0EML/NePRIPK7RX06afb3sn1c3PEGhZS2wp/k4YjfZIGzxRfLvkS59O3/xOGdiEjVI1BJY7dBmSMsnHGMI6fQPJ2mTPYXXmYwTW54PE0Sll2rQ/CcfGkQnwBaa6va+UX8vaIk+vG3sYopIrO44BvXVSFYkFTTiRlcJkFJhYpAtaeXbfyBr9voepnUl5wSzMVK8G9RQB0XqFw2TIJjEAFL/yp2vdWRqb27Hb/UY5LUBhi+p6fpbHitcxHKKbSve+mq2drJdzHb0ohU08T7ZOLFDxWPnebj6fl2ZVYAN6ksScfHqd8bC279Ged6MphsbWVdv3tyHoQDWoQV2OFFqUPl7zcsnNtT06FWHJ0ijmkatNyGJp9qv7OSQbRsehawwQS60OQ6tFbjfan7bEdemNBO6ne6TLaTWrjUbmT6xN6ZSkQReS0+zxrt1+3hCv/9KJR6TfxPbepAT6Aui5FD8UzMVp7/FiJBrMT9iGEV7bWQHGWKWOwKCnKvrVBAFOr4dkm0xgv74amsHrOYjNFGVbccfRZn6+LAZGQFMok29y/LCg8usR+1cv+AUZGLLLyYD5S8v6BqEes32qW0c8tzrGocZZdyI0nMaqCTsq8egzN4A4IkeEbovydZeXojPdaRIhW4MnOJKHgqysF6VbttyzD1EKczTyJG7Ja7e/jmM5CQfmDcNB5I1idWo6W5I3I/aHcZPGLk15pVHZ5h+Umt3F75yihkjRFSCZyV512BH7TMMv1GMAbNemkSTar+fl/d2+u6YLeaSP/Q5HYI7KD+98AfbDp4AjdrzTILOPyemkl8jwzSuXeSedqseRALdKnwynMPW5Y+gPEdM1HU5PNNrEbqYxy36gqZHIobhduvgcy5QAg4eGZ4w9e/PvUbiw8kLPbyNHIbyJeSMVNCHJFRmFjG7fmJY9/wA496vd6lcas9zK0gihhVOTFty7VO/yxzABlivhNpP+Z+qahF5+1BY7mWOBBCvEOwUViWtADQZkYwOFxpzIL0+SeVPyle4Dt6q6OX9Wp5cvQJry61zGPNy8h2eZ+StVvZ/zcsrRruUwRpVoS7FWP1SpLCtPtb4yGzVhJMym3/ORWo39o2gG0uZLfl9Y5+k7JWnCleJFcMeTHLMgp9+QN3c3nk24nuZnuJDfSKrysWNFjj2qcjPYt0CTAPHdf8269H521K1iunWAX0qBSxNB6pFBvl3CKaYzNvefzavp7DyHcXMTFXjmtgCCR1kAIqKdcqxCy2aiRA2Yf+Seu3epa9eJcSFhHakgVJFTIviTlmUU16eRkDb2UEUym3ICG1IkaZdf8YziBuiXJ8qpfaFFIVk0WOZuTepM0jjkanfNgLp10uaFvZ9PlugbO2S2hVACgZjViSaktXMjET1YkNLwA/Y+85axIVFK1pRPvPXCELgy7fZp/rHCqorL1+GnzOKrG1m/0u8tp7G4e2dmZXMMjKWXj0PEjauY+eII3bMUiLIZBpHnLzJfarYW0mo3Qje5QMVmk3XeqnfcHMGWIByceYkpv+e8oa308GvMTNUjYUCsBk9NzZZ3kaknep29xma4xCsGNB1+VRk0IyDRtWurcXFvAXhatH5oOhodjlEswBpbe1/kJYXlnoOpRXKcGkvFYCobb0gO2YuWVlysXJOrD83NButbi0dLS5FxJMLdXb0+HItwr9quQMSoyRJpOPOX5gaV5SFob6CaYXnqemYApp6fGteTL15YxiSspiPNHeXPNtjr+gHW7SKWO2BlBjk48/3P2vskjftvgIo0yiQRaSeXPzf0DXtYtdLtbS6jnuuXpvKI+I4oXNeLE9BkpYyBbCOQE0jvNn5l6L5Xv4LG/imeS4j9VHj4cQORXcswPUZAQJZmQB3TKDzZYTeVv8SKkn1L0WuPTPHnxQlT349vHI8JumfEEq8rfmdonmXU206yt54pkieYtLw4cUKgj4WY1+LJzxGIssIZRI0FLzJ+aOj6Dqs2mXNrPJNAiSO8ZTjSQVFOTA4I4jIWFllETum2q+abPT/LY16WKR7YxxSiJSvOk3HiNzx25ZARJNNnEKtbpfmaO9lXhCQ3pJcKC6t8LnYHj0OQMaKiVor80fM948/lqOG6khilnmjnjhdo0Yek3GpG54kDLcO53a88iI7ML+u3/wBbSNr25uIncIUedmWhPUiv68yJQAi4kMsjJ5kwHI7gePxnMiPJiebR4EUPH2+M5IIdSIbfD/wZyNq2qpTenv8AGcbVE2MNvLeQRyAGOSVFdQ7VKs4BAp7YQN0E7PUh5F8qh/hsmArQfvpv+a8yTCNNMZS72daFZQ2PlbTbWAFYYpb0RKSWopuWIFWJbvmklzLuIfSiajIpY551iWWztlYtxExNFZl/YP8AKRmx7NhGWSpC3A7RyGGOwa3QnkSJYbrUgrMYyLcqrOzgH94CRyJpWgyztTFGEgIjha+zsspxPEbY95ttl+satKEmkmrLxEUjq1aUHEclUcczdNhgcHFW7ianPMZ64qDMdVUy+VlRyWDRQczUgn7Pcb5qNNEHKAXZ55EYiQd6STyraLD5gUpyCNayhl5sVJEkZFQSRXrmf2jijGIoOD2fllKR4jav5gsbKfXJWnj5twjA+JgKcelARh0GKMsdkdWWuzSjMAGhSYeXkdPJ1vGzMWSFlDMSW2ZgNzU9BmszxAyEOwwm4gsU0Syij8w6TPEGVvXkEtGahDQSdQTT7VM2mqxQGAEB1elzSOYglMPzE1zTdIurRryJ5VlhYpwptxbvUr1rmv0kbJdhqiQBSafl/qMGo+XDcwK0cUk8wRH3IoQPE5XnjUqTpzcWBaN5q0641qws/SmjlkuYkVzQiocdaNmXKI4HHBkJsq/NPW4NG0/T7mWAzJJM8ZVG4kHgGruPbMTT1e7kZ74Nl/5X61ZatZX9zaKyRpOiFXpUN6YJpQnDqKvZjpZGt2O6nrWiJqV3DJeQrcLPIhjLUfmHIpTrWuZEAOBoyykMnNmnna4tLXRklupFii+sIhdzReTBgAcxcAHG5WckY7CX+Rbm1nurxraWOVPTh5GNgw+0/hlmpABFNOmkTaA1GKE6tdclBPrPX/gjmVhgDDk055kTO7wv82iy32nxBiIxA6lamhaOeRA1OnKnfK5xADk4CTe7DNHkKatZVOwuIiT8nGUW3S5Mh8/ov+OtV5iqtIhpudii4cPJE+ibaqts/kHy00ilwpuFUBS1Pj9vlgh9TX/Cfev8q/Vj5R82x8SsfpQMQQQaA/f2wS5hljH3L/ypkj/TOpLGfhNtJTr/ACN445zYTj2kHp2myfCuYhchmXk+X/cqBXqjA+PbD0YHmxOL80/NkmneY5p7uC3bSdRgtYZY4V+GGRpVfkG58m+Bfiy44hswyZCDID+EMot7n6xGl0W5tOiSmSlORdQ1ae9cBDKEuIAlWVwFB8K4GSS6h5hmtbyyt4Y0Kz8+TsTVeJUUAFK154bWWwRusbtYH+W6T8QcIQeT/9OJR+do3jSSSNPitzduqlqheVEFKH7dcrIpPH0R9t5ktbmSVHiZGtYkmuQp5FPVHwpSn28x8+YQiDamYHNfb61YTXQt1D+pz9NSQCKqvPrXwy6O8QVjIHkjI/OV7pt7HpdpcMkkkiiOFX41eSlNvfMjHQjbVI8RpJE8lfmBHbmB9L9RjPLNJJ9aQBzLMZOh+eSGpDX4BqmTflP5X1ny+dV/SloLV7t0ePg6yAkci32enXMfPkEuTl4o8MaL0LkP7cptmkHn7T9Q1LyfqWn6dD9YvLmNUii5KtfjUndiB0GSxmjbDLGwwD8r/JPmnRPNRvtW0/6ta/V5Y/UEiP8AG/Ggopr/ADZdmzCQoMMEDG7VPzg8meaPMWu2tzpFkbm2htDC8nqIlHZmNKMQe+OHKIjdhmxmUmY/lppeoaN5Ot7DUIDb3sTTF4aqxozErQqabjKckgZW5I+mnk+iflp56t/Mdjd3WllbaK7jmlf1ojRBKGY0DeAzJnnBjTjYsRErL0f85/LeseZfK8Gm6Rbm4nF2ksihlSiKrCvxEd2zGxEDm25QSdko/JHyZ5i8rS6qNZtvq6XKwC1+JXqEL8vsk0+1jkILLH9O6UfmJ5I856t5o1K703S2kt5mT6vciWJeQWNV3BYGlR3yYls488ZJehXem6k35Zy6PFCzao2lC0W3qoJmMQQrUnj9r3ymPNyZ7jZ5/wCTfInmS0/M+PzBcWbJpSCSP1uSHcQ+l9kHl9sUyyRBDDFGibTP88PJnmfzRNpI0SyNzHapN6780QKZGXiPiI/lxxkUwyRJNp5+S/lzV/LXlJ9O1eD6vd/XJJuFQwKsqAEFSR+zkMhst4+mnkurflJ+YF15rudTXTG+rS3zzqfUiqYzMWBpy/ly7iFNEYkF7J+a+j6rrvkmfTdKt2uLySeBhECq/Cj8mNWIG2VY5cJZ5o8Q2Yl+THk7zH5d1m/n1ize2Se2EcTsyMCwcEj4WJyzNMS5McEDEG3sINem+UFuCH1ZuOl3R/4rOGPNE+T4zmuJprmR0jk4Emg28fnmyjE068x81exLqXLq6liOoHauXwBDAhMFfru33DLEFesj1J3+dBixXiQ9at9wwqqLK5Famg67DCq+HQtX1u8ghsLWa6MPKSZYghZVIoDRmUdffMfUSADZjiTbIdI8i+cLTW7O5bRLmKygmSR2JjdgADU0VqnMIzFN2PCQUT+eMyvHp5U1/et28FINQffDpebbleUpXao27bDM0OOV9T4f8KMkxpF2WrXsUYhW4dIlLUVWKgVNemUSiDugh7n+RF3JcaFqDO5creKoLGp/u1OY2QUdnJwj0vNPLsyH8xLEhhy/SgBFRWvrnLSPS48B62df85AMjNoQcgLW5Jqabfu8hhbdQNmQ/lRMrflpIy0C8r2gHQUByE/qbMX0vKfyem5fmLpAr09bv/xS+ZGWuBoxD1Mk/wCcgh/ud06U0IFpwpUAgmRjWnhkcDLUR3Zfpcn/ACAQGv8A0qpt/wDZPlUvrboj0MG/Iadn86XHL/lhl71/3ZHl2oPpaMA9SH/Ou4KeebxAwUSW1uCe+yHI4JVFdQLls9I84Sov5Ro7fZW0sSd6ftRd8oiam5BHoSj8q9SWeWdTOsi29lCteQPEeq3XDm5oxcmTfmBY6tqFrodxpdlNfpa3EjzGAKaAoy9WKjIYjRZZomQoJBaW3mP9IWpm0a6t7cSqZp5RHxVQOp4uT+GZE5iqcXFhkDZYGeVd+R/2Iy8HZgebjyp0P/AjDaG6tTowI/yRgVsBv8r/AIEYqqwTtDIk/B3MTLJxULVuJBoPuwg0UU9Aj/NfSWbfSNQ3/wAmH/mvJzzLHE9J8u6pFqnlHTL+GGS3jllvAsU1OYpN34kjNXI7uyjyRg3FcCUg85QapLY2/wCjbI30yS1eESJEQpUjlyfbrmXo84xysuJrMByQoITyZBq8Ut2dS05rDmIxGDLHKH48q/Y6Urk9dqY5SCGvRYDiBBSfX7DzS+q3zWujG5tpHYxTi5hTkrDrwPxL9OZWn18YY+EuPqNCZ5OIMn1FL9vLPpW1t618sUIFqXVCWUryXmar2O+a7Fk4cnF0c+eMygYpP5ag8wpqqyahpZsoBE6+r68cvxMVovFNx9nrmVq9XHKKDjaXSnHK3eZ4PMR1cyadpX122MaVl+sRw0YVBXiwr9OHR6wYo0QjWaM5JWE20SG8Xy/HBcwfV7vg4eAurhSzMQA4+E9euYWbIJTJDmaeBjEAsZ0Sy8xjV7WabSxHYJIzC6FwjHhxZVb06cvir/sczsutjLFwU4GPRyjl47VfzI8va5rItBpdotyFjdJS0qxcCWDLswPLpmHgy8Dm5ocQTT8vtP1XTNCFrq0CW90J5H4RsrrxYgihWmRzZOI2uCBiKLzfR/y086WPmG0v5bSI28F4s70uVb92JOVQvEb8e1ct8YGNNZxHitm/5peWNU8yaPZWunRLNLDcGV1eUQgKUK1qVavyynHLhO7dOPFGlD8qPK2seWrHULbVIViNzOk0PpyCUUCcTUgL3GOWYkww4zHmwnzL+VHnG+8z6hqdrBAbee7eeBmnAPEvyFV47fflsMoAphlwkyt6J+Y+gan5k8pSabp6R/XJJoZQkz8FAQkt8QB33ymMwJW3mNxpIvyl8leYfK9xqX6WjhCXaw+m8MnOhiL1BFF/nyeXJxNWHEYm0TfaD5zTWNQmtrO2urSe5ea2eS6MbBGp8JX02pvX9rLsep4Y015tOZTsPJ/zc8kearbTYtc1KK3htrY+gyRTGVi00ryA0KJ/NTE5hIU24sRjby2xbjfW7ntKh+5hlbOXIsm/MdjH50vpBvyELU9zGvXHGdlIsBN5ZkP5eaCzUH+kXKD/AIInDD6muQqJVPJ8iHR/NkddvqkbV7bVwT5hOIb/AAU/yqkDeZL1VNQ9vLQ+PwNgzckw5h6dpkg4rTMQuQmdz5ll8t2E2sRQi4eCg9JmKAhzT7Qrk8cbNMSWNwfm9aJHP6XlfTUFywkuAan1HBJDP8PxNueuZPg+bV4m/Jbcfm3cegLpdNhVXPEwq7KqcTxotB0xGNfErkhz+bt8UamnwjsP3j9PfbHw0+Ig9U88NObC6Foi+kpZRzbcyUqDUdAUxjjRKeyvdfmdql2YS1tBGIZVnUIX3Me/Fia/Cf2skMdI8R//1I1/hfy0kjTSKURI0RyHYj04mDItByP7I7Zg6zNwQJ6lGQiItj2t3mg20sjSTTI17MJrr02CsKDilahabbrH/wALmrxXkIveMXDJEjRKdaT5btbO5t7yK7lmVS8oEgB5euoG/f4QM3GGQMduTmwjQS+X0m/MXTg7KALu3G7U7KfD+OZY+hpgf3r3trq2rT1U/wCCX+uYbmqZubYmolTw+0P64opoTQmo9RP+CGK0uEsAIPqJ/wAEP64lNLnuoCP7xf8Agh/XHmrS3EIG0i0rueQxC00J4t/3iGv+UP64qAv9eLjTmte+4xpSHLLEK/Gv0EY0u7jMh/aB+kYVpeJYgteQ+8YFpaHjJX4huR3GJRVITSZR9RSpH25D18ZGxCaRquo3qPfcY0tO5qd6g777480U2WQLQnfGkUt5D+hwUtODL0xpabDDFO6X6/dJHpVwjGjSRvw360FTjGVSDGfJ8dwSAlqkdT3Pjm6iXXyCLj4+x+k5YGKJUpt9n/gjhpBVFC+K0PucCheOHio2/mOKCqR8OI+zT/WOFD0f8lFB1++IA2t16En9vMHW8g5mm6vbGU8DscwLDl08K/5yMgt47mxZEAdpnBanZYkIH3scyNMd2jKHjKsPD7wcz3HpeGHh+BwhClJHGaniK/I5ExDISL3L/nHo8fLOqAbf6cP+TS5hZebkQeiReXPLkdwtxHpdolwjc1mWGMOGrXkGpWte+Qsp4AjL7StK1H0zf2cN36dfT9eNZOPLrTkDStMbIUi1W0sdPs7Y2tpbRW9seVYI0CoeX2vhApvgSBSlaaBoNpMk9rp1tBNH9iWOFFZaimxABGSJNIEQFW90bRr+RZb6xt7qRRxV5o0dgvgCwO2RshJAKqljYJZfUEt4lsuJT6sEURcTuV4U40yHVQNqULTRNEsZvXsrC2tp6FfUhiRG4nqKqBthJJURAWXmh6HezGe80+3uJyADLLEjtQdBVgTiCQnhCtNZ2Etn9Slt45LOgX6syKY6L0HEim1NsimlGx0bQ7OQm0sbeBpKB/TiReQBqA1AK0OA2tAMuWp09QBsJB0/1TiqW6stNPnPHoh/Vh6q+cWMZ/lJ/wBY5shydcebiV22X/gjihw4Gmyj/ZHFWwY+4X/gjiq5WQHcLv7nBaomGSIdePXxOVzZh7n5EngHkDSOUiKPWvAAWA/3aPHMI83NhyTf6xbV/vo/+CX+uKXGe3p/eoP9kv8AXFId9Yt6U9aP/g1/rirX1m17zRg/66/1wq19as+88X/Br/XAVWteWHVrmEHtWRB/HFaUzqOnjrdwf8jU/rimmhqel1A+uW9f+Msf9cbWkLp+p6YlhAkl5bqyqAwaaMEEbdCcWFK51jRx11C1A954/wDmrJIorTreiA76jaf8j4v+asFlFNPr2hbD9J2n/SRF/wA1YppZ/iDy+Kg6pZ/9JEX/ADViVAK0+ZfLqmn6Wsh/0cRf81YsqWnzN5Zp/wAdayH/AEcw/wDNWKrR5q8rr11ix/6SYf8AmrFNNHzZ5W3/ANzNiP8Ao5h/5qxtSHf4w8ojrrdh/wBJUP8AzVjSKYR+c13p2vfl9d22j3cGo3P1i3dYraVJGoH32Untk4c90XzD53Xyl5hV1YadOKEHcDxy0yDUbIZN578taxqHmGS5tLKaaOSKIc048SyoAepyMJAJN0Fa48s63L5B07T/AKjI13b3ksjwDiGVGBoxqab1xEgJLRVPJ/lXX7XTvMcFxYyQtfWRitVYpV33ouxp374JyCY81b8tvKXmbTPMJnvrF4YGidC5ZD1U/wArHHJKwgDdnlhb3iqoeMgUBrtmOQ3Wo+cz/wA6pqRYGiRq1KVOzDLMWxQXjsWt2yxiscvh9j+3MzicWkUt4j6JNOA3BZCQKfF1HbACit0F+m7cKB6Uu/8Akj+uSJDKkc98F0WG4ZWZeQotKtQse2RBYgWhk1y36enLQgkfCPA++TteF//V5noWm6la6xqd3LE0UCW9nArSKaFQiiULuKEcT8WabtbIOAR6yacxqO/exq8lt18wTuGE1vM5khfkFMQ6kKK9V/ZwYwTjH8JH1OJEWGWeU2vWv7JZDOYRFctIHJ4luSBa/s+JXM3T7Rc/Cdku8z6gLbzBclnPpq1AtW2/dp2HfM6MbDROQEixS6ZhcSXHpCcyAqBMvNaH2Pf3wnE2Qy7JA1lcKe9MBgz41Nobhf5seBImjtB0q41DU4YKkRg85mqQAg65javKMUCUHI7Xw7arOyNUMa1Umnh3w6UXjDHHPZL+MvicyeBnxu4zeJx8NeN37/8Amb7zjwJ40fo1lNe3yxO7iJfikIJGw98x9TPw42xlkoKN9bXlrcNE7k03BVuQofcHJYpCYsLHJYQ4e5/nf7zl3AWXEujN20iIJHBZgAanqTgMF4k082PdjzLqYMjFhcOCQT1BpjwIE0BaJdz3EcfOQhmAbiSSBXfbIZPTG0HImvmc3H1xXilcKqhCoLAgLsCfmMxNEbjRa8eW7tJfVvP9+v8A8Ef65n+G28bvWvP9/Sf8E2Phrxt+te/7+k/4Jv64+GvGqW/6SnlWKKWQuxoByb+uRmBEWUHJTI7ljZWEdikrNcSR0uXLNUtXkB1245rMcjknxdAfS4xyklKbeGQdj9wzoYjZEkZGJRtQ/cMsYKwSTwb7hhtSqqrDqH+4YFCotRuQ4+gYrSZaVe3NstzHHDC4mhdGkmjDuAVpRDWi1/mpkZRtkCkd7NqkHD6rO8UpBBdWaOvw+MZB265RnjYbcMqSs+Z/NMMhX9LXisp/5aJevX+bMThDlCZTfzpr2uX9roialePd8rJbnlLu5kkd0JLfab4I0XLMUaYSNsaV/wDPfMkFrIXhzT28N8LEhosaYCkBN/L/AJ781eXLeW20e9+rQTP6sienG9XoFrV1Y9BmPOLbEpr/AMrn/Mb/AKug/wCREH/NGV8IZWvH51/mQOmpr/yIg/5ox4Qtt/8AK7fzI/6ua/8ASPB/zRg4AttH87PzJ/6ugH/PCD/mjDwrbv8Aldn5lf8AV2H/ACIg/wCaMHAFtr/ldf5l/wDV3/5IQf8AVPHgCeJw/On8y2NP0v1/4og/6p4+GEGbZ/OT8yz/ANLb/khB/wBU8fCC+Itb84/zK76sf+RMH/VPD4ajIjtA/NL8x9Q1WK1/Sx+MMT+5gH2VJ7JkTjCTlKprHmvzu96EudevWod1EroA3YBUAHfI8DA5SifIWseZLzzHDZ3l1c3P+kGVZJJ5TQQox9PiW4MjftDjkjBfFRYZt68q9vs5mDk4Z5uJYn9r7lxQ1WTanP8A4XFW6sBSj/8AC4q4Ox2+P/hcFJDbGanRx92R2ZLLKz1ea6NzY2Ul7LAKbw/WFTl0PGhCtt8JymeIFsjlI2SfUtF1bT7cLqcEtrayTtKZbiJlLSOKEcmoaU/ZyHAs8prZBTTWp5IJVeMfDGWc7Cle4x4GvxSltxRTJwkhaIoaoWq9adtgPlkuAMhlKto0zTR27SyRn06JSQnkd9utdt8jKCZTlacQrpRMhJX1FB22NGHTt0yowYHKUn1axN3cqxoaRqCU6dT45Zig2RmaQ99aPdNH6iIghjEUaRqEUKvsO5O5OXDEg5SoRaQgmSo2DLX78lwI8Qpx5x8u+n5i1SUFWR7uaig1YDmacsx8WSMpcPUMpZKKR/ogV6ZkcCPELX6JHhjwL4hd+iB4fjjwL4pd+iB4Y8CPFLv0QD2pjwL4hd+iF8Pxw8CfFLf6IXw/HBwI8QoqO3jRET0FJReNeRAPXcinvgOK0+KVBNIjruB9+SGNj4hTrS/McXllGAtPXFzQij8ePD6G68shlgzwmzaOb82EJB/Rh2/4u/5syrgcgFVH5wAKB+iqkd/X/wCvePAtrl/OQhq/ogEeHrn/AKp4PCW1Vfzmfto9G8fXr/xoMIwljab+XvzUn1TWLbT49MELXD8BJ6vKhIp04jBLFSRMWmMXne/NoZUsIyEb00VpSCxHUj4cxJZwJiPUsiQDSrrd9d6j5M1aS4gWB/qzURGLbAj2GZEeaebwfk/Dv198yWqhafWLE+WLsDYgn9YOHow/iSIySFVrWm9OuNllwhPpef8AhNCQRQjiaEbc6YOIHkiI3KRo78ht+w3j4HDxMqD/AP/W5Xc+dL6+0DUo54IYJHYRR8GZudTUjce2arWYbyQN7BxtTKwGCSlklinvVWX1FqI42ClT0oRQjtmTGiCIsYgcg9C0jzTNZeX4pUtykK7r8ZkcmvRqgUGa/URkJCMSylkpDG90TVoob68kuI7meQiVIZOKg0p04nwXNhizyiOE7lrlEFIZ4oTK3HjQMePIkmldq++bYbhkAttYYkuY3KI/E1p16DwyMhsyBUbqzgM8tFQDk1APngA2W0XodmFNwIgpd1FSCRQdeozV9pigCeTGRsJJcPAsjpLGrOK8mA3Jr/TMnSHZEOSEuIxHPEvENyQVG/Wv68yJ30bQdlVLZPrLDgFoSKV2yrFIkreylG1qsSlwpbiC1RU19Tp/wOZYpBtNtAljSN6KKymgoDuB1WmaztCNxBYZDtSB1NuUsCFArcgtAKbf5WDS80YeRZD5W0HTLy2unurdZmWXjG5LbAKppsR45dqJEFM5GkJrWl2NrrMMFrCIk/dGgLE8mk9ycniJMSnHIksw1Lyrot1e3lxNaAyM8sjyBn3NSa7EZSJm6RKRBed2Ui213BIQAjLRm+IgciNyBvXwyesiZQpJ3CLvXVb2TmC877AgkjrT4q+2YOG+EVyaoJ7o/lXTJ9Btrqe25zS8mL8mFRX2PhlmXNIGgW2UklXSbR/MC2YjAga4KekGboFJpWtczeM+FdrE2U51vy1pNrp1zJHbBZokUo4ZtizUrucpw5ZGkGSSaXCkLSTBV5RAMr1Pw12yztA+mu9hI7KepSQzTBlkcsoJYnpyNBUd8wcAMQxhySSW7mSXiNuO1Kk/xzYxma5uXGAITXTnZoS70BqKAkjala5lYCSN2mYRYYDf4SfDkcyGtWDJ/k+3xHFK7klADTf/ACjiqtBKoqBxpSg+I4QhK9eNLXkhCsCB8LEnfKc3Jsxc2NkkmpNTmE5bIPNVeGiDw0q3/F5DlmNBSRf898vYFeKf5nFCpGoI32rWm58cxJ5SCxJamWP1GVegA3r3+nJ4iZDdMSaUfTH+ZyzhZ8SvbRQsGDx8+hDciKe22VT2LCcyGpYIhKAoovw8gSe5wRlsVjM0ip7Oz+ru0ScWQDcsSTvTplcZm6YDJK1GCKzCVmWpBINCQfwycpG2UpS6Ie6SNXb09krRR9GSvZnA2ttByuEB9/1YxO7KfJM0toPRDOWLOdqHYbnKpZKLimRtqztIpnkV6mkbstD3DAA/dlhkQLbAU/8AIllF/iu1RSTyjuK8TVtoj098jjJkWMp1ElmR+o3ttLNE84aI8ZoW3lQk03UA5dLEQ0w1MZBJvLssml+Zprjd2tmm4oxNCeJXelPHAI9HJtGGNASKp18DlsRs0nm16ajuv3HDSuVE7so/2JxpDYjTfdf+BOKqdzGos5zUV9J9+Br9k98B5JDEhuoqWpTxP9cxLLa9a/JjWdP0rTNVju5mie6KcGCNJspYN0I/m23zKwYpTGzg6rWY8J9f8Sl+dutabe+ULG1tbl5ZbafkG9No6JxCgVYsa/M5LPp5QFldHr8WU8MOjym65t5Y0mMeoeV1cBTXdyeApWnbMWR9Ic7vSuKAFpBK7oyg9+hHY5T4hBYmS2GEGKMxs4csAxBoOvbCch4me9rri1mhvZIiZFCnduRrxO4JP+UMMp7KU/0a3BZohx+JY+L/ABEsWJFWqTQ5PHmsbhhRZrJ+VWuj/d0G4DUHLuK5MaiLI4ZKL/ljrMKiSW4t0TkBU1G56DIz1MQGPhSQ+p6Feav511OziuI0k9eXjG4PRW6mma/T5AJ3SJxJlSNH5Ua1Wn1mDf8AyWzY/mYpGGS4flNrJ/4+4B/sD/XH81FPgSXj8pdR9Ir9ai9UsCrcTTiBuONetcfzMU+BJaPyj1cj/e2Ef7A/1x/NRXwJO/5VHqx2F5D/AMAf64fzMV8CTv8AlUerkf72Q0Hbgf64PzI7l8CTh+UerHf65EKf5B/rj+ZHcvgSXf8AKo9SrT67Hv8A5H9uP5kdy+BJev5S6hT/AHuT2/d/24fzQ7l8AobUfyWvb1YwdRRClTX069f9l7ZGWpB6MoYpRSu8/JL6hbvdXmrqtvFvIREa0/4LMfNrBGNgM5CQChpX5SWesBn0/VgAv2opI/jXtvRsGDWiQ3G7CMpFMf8AlQ1yDtqaU7Vj/wCbsv8AzA7mRhNsfkXdV31FNv8Aiv8A5ux/MDuR4ck48r/lZFoGsQ6xd6grR2aySrVKAOqMUr1qOVNsyNMRllwkNWWMo0brdi19rrW2qepLxaFwskEEI+AGejOafzb0zQTw+s1zElnM8VvR5PLM13o81qLhFivYSnIVJUOAfppmfCXVyokkWwtvyDQf9LY0J2/db0/4LLvFCKkjbb8mVg0+az/SJZJiavwAIr7Vx8byY+GbtDL+Q1iFHPVJCQasQgG3y3yE8/CLZUVOz8nWGuTS6J9ZkS2tkVIGUhmCqT9o0KjcfZzXaPUEmz/E0gESpMIfyH0RUbnfXDuVZVcFFAJBFSOBr9+bLxW/gL//1+e6loWjaHpd24qbllMkUcnJqGuwFDszdf8AU/181GsyGRjEd7TqgAGHeWNGbW9UntXZlnkjcrKVJTqAd9+gqP2ctnsBTDFh4gnvmPR5dK0KK2nHpdIxFGSVfh0etT1/lbMW5HKCWOWFEKPk7y9puoWU6yyfv4HJ4LIwNGH2iAR+rMsT9TdHEJC0rOzELzABIFAOx983cOTSURp8fqahbRsHIeVFYUWhDMAa4Zckx5rb9FF5cBVdVErhQAtKcjTEDZiCrRXS2WmyyxR8pn+Es5AAqaDbbNF2hEzyCJ+ljM9GKRNNdzyJxqQKFhT6My8MKIpsiKCLudPnnkSSjKY1CkEDsa5nmNqDTcNnOshdgxDVqBTrkceERKTLZBPot2Budv8AVyzhXjCZ6Z6ljaOQvJ4xuzbKKnb8c12vgSAC1ZJWl7SvcXbgMKqQZDQktQ1NK46XGAQyiKCb6frusabDLBaGP0ZXMjepHVqkAda+2ZmTT8RUkHm5Lm/1LVrZ7rjzeSGNSi8RQSDr9+Sji4YllEAHZMtV80a/HqN5DE0XorNKiAx1PHkR1yEcHVZSBKSadBS8jmdeSQJuDUb9jtmP2hA+GxJ2UtTvXF8REoVpwAO9ATU/TmDgxXHfoxhG90bbeY/MdtaR2cEsXoRCiAxVNK13Nc2P5EHdsMgg1utQS5W8Vl+urKZeXD4KkEdPpzI8H08KBIApte6nq915fM9w0fOe5+ryBUI/dxoJBSp+1ybIQwCMlJFJabgQWjs0lK/ZQjr2Ncx9aOKQDXVpMZBIHkA4moAp45VVbNojWyu9i7SrI0cTEdRxcBtu9Dmbjw7JGShSKgWVC9VVATXjGCFFBT9ok5k448LXI2rcm267ewyy2K+rnryNOmww2raliKfER40GDiCd1USkAAV+4YgqnHl7y3a+Y5prW8keOONVcFKA1rTwOY2py8LfhhafH8lvLldrq4/4NP8AmnMHx/JyfDPeitW/K7QrqS2WaeYLa20NrEQwFQicv5TU1b9nJRz10QcZ70sv/wAmbR7crp80sVwSCHmKsvHv8IoanJ/mwx8MpJYflTe3xnEN6I2tpDFIrJUlh1YfENjlePXA82IxkoxfyY1gUI1CP4agfuq7H/Z4yyxO7M4Cibf8orSxheTVriSfnIio1vxjCg1BLAl65IZ65L4JTWL8oPK8oqLm5FfF1/5pw/mivg+aqv5N+XVrxuLk12+2B/xrkJZr6IOFsfkt5cbrLcknYjmP+acRl25MhhV/+VL6F6fEvdcTTo3gf9XB4nkx8ALf+VJ+Xjtyu/EktQb+9MJy+SfB80Drv5QaRZ6bLc2sVxcSoQeDvVd9qkAxk/8ABrko5L2Xw63YfZ+S9Z9cyLoUZWJS7n1iKKNixrPt1ywNMiT0TLT/ACPqF5M0U9hBDCkcsgKyPIRxVm7TjIGIu0RhZ5LbHyXrDzpBbWunrM6soDy3BqtOR/b2+z45MkVSeE9yY+S/Jltd+YYIr1rMI6ScRbPOsvLgaULtQCvX4WxjMQ3DCen448JZxpPkCCxme6Dl7lk4qpclAWALV2BbfJ5NYDs0YOzzDe2rX8u4E1K5vJHHG5SYSqrEkepGeXGop1+zlEsoOznDG0vkIOQ3qmjb7seh38MkNQx8G1w/L9OVWlPGvZ2rTH8ynwHJ+Xyb8pKjvR2x/Mr4Dl/L+Po0p37Bn69u+D8yvgOb8vIpIpIzIaOpXZ377b7+GJ1CjAla/k5ZEGtwa7cd3p71+LK/GCfBKd6H+X40jg1vMheNw6Fw7Lsa7gt45kYdd4YIrYuDrey/GMTdGKd6f+Wuj67qYi11RdW0vqSNCheNeRoQdmrschqe0vEiIhjouxximZk/U8p/NHQLOwlttH0mAwW9neyC1iTlIazJG7k1LM24zGhM9XOyjh2YXPY3MkIkmdJATSOSu1KGvbESDQCKTbyr5bgvtA+tx7X3rmKJxJTiQocVQ/DRt0/2WGc92+BBBRvlfQrG81+5XVYGuIprd5oFYFQxDcV4kUPUcciZsOZpHWfly1tdflt4yUjNzFEqjoq+qRtUnplgl6S2Sju9+13SbSy00yoCbiJxHIxJowC7GnaoGYgkbcrhFMI128jTTGJoEqPVL7KBUHc/s4zFhhPkxvRLa2b8ydamb966kvEFFVQualmJ7/srTBAbtHD6rZ3z+nLm9dyVasa8QKnv74Cl5+Pzh8v2M9zBqQuDKs0gjMMYZfTr8O7Mpw4oGTWJC3H88PJY29O99v3Kf9VMt8KTLjCZ6p+YWm6TZxarepOdPvVgazWONTIPVjMnxAsvYfzZCMLNMrCUf8rz8oCn7m+6/wC+o/8Aqrk/BkjiCbab+aOgX1lc3kMNysNvBLcssiIHZIqcuIDsO/dspP1cKBkBNJL/AMr58qA7WV+R/qQ/9VctGEp4gnflH8ytG80X01jY29zDJDEZmecRheIYLT4XY1q2CeMgLxBlYY1rWop1yq2VMf8AP15Ja+VruRI1kXjSQNXZT+1sD3yjMCaDXk+lhf5Lw3Us9/eyrIIwAiSk0jJO/EDuRl5gAdnGxDfZ6qX3G/ti5q0t1xWleyuXgukkjCFjVKOodfiFPsnJRkQdmMogvnHWrMpeFUjeVg/wotAVVCRTj9qtB/xtlMTubcLJHcl623mkaV5OOrtbCWC1iiEcMTgcgSqH4iDxoxyzELcnDyYkfz8tf2dGk+m4H/VPMjwmfEGUeSfzCTzPBqMqWJtv0eqtRpA5fmGNPsrT7GQnClErlTGIPztt9QkNo2mNbCccPW9cNx96emMp1mnJxmmM8lBE+QPMMUnmg2MMXITRSSGUEV+DcGlK7jr8WY+nwGMbLVH6renpfXSo8SFQj0DbAmg3oD75lW5L/9DnPm689SF42q/rOBcTqQZAvKu3Tb5fs5zkZCWSx0aNSQSmHlKbQrOyS3troPdMOUykmg+g/CoFcyBl6lycU4gKnnO3lv7NYIZF2q5U7V2oCDXvlOXUQEwXH1MwSFHyxYWGjaPcTSNH9auXPqPGakqB8Ip269Ms/NCrZjLGMPexO4j05maCyt55JxyPqsxKmlOR4qOm+Z2n1uQyBkYxi4USTuu0y0uE1K3keOkcE8fqtyPw8WBNc2GTWY4jctgmAVC9hBuJSjK7c2JCuf2jX+OHDq4yYiVoK4/3kmViF5KampYmngMp1Y4qI6FmRaX2UkFqFidxzlqSaHev2d8qxTPFfRv4dkdX4qDifH4jm0EgQ0UV427Lt0+M4bVaSQegP+zONopZPMY7GcIgLOADRiTQZg6zGZEHoGJCV6fCziSYheTbLvQgDrlmniA2SG1IplYdVHv8RzLtrITPysofzLpSMAytdRAqSSD8YyOQjhbMY9SG1Y11W7IAoZ5P2j/McMDswI3XWRSGJp3ViK0UAkj7huc1+vPEKbYQsJM0DPfFnqygFgxBWtTUdcjpwDQU7BEVJ6j/AIY5sxINJDdQN6bd9zhsKmcjD/DEB7G+lpue0Mf9ch/EylyCU3SvLAVWlRvuScpzQ4t0RO6XxAySqiqBwNS3T78xowstpGyZc6UFNvZjmyFAU0t8q9t/mcbC0vDk7fxOFU+8l6MNY1yO34rII19X0iwAkIICx/EQvxMcxNXqI44WeTk6XTyyE0PpZ9qGn+eouIhgmRYzSKOK4gQL/sQyrmrhqMBFm24xyeTFdb0jzBIxj1eH/csE9eICSMlrcGhZirUqpFOuXYNXjB9J9Ky08zGyu/Lm5CahcsaCsa96nqfHMvVmwGvTino6yyyVBPFOzMBX6F/5q/4HMLipyqVuMYvJl7qIlUmlaeih6/TkJzVFAUPJRUjp06+GAmgkCylc9trunzxLp1rBDp8pZ5uL2omckVLVcklgx6H7K/Dmrhk00pESMuNyJ4ssNgNkubV/Ni6grTx8tOd1+rIfQEoK9Vf0zv6i8v8AJRuGXRzYBKsZN/xIhiyyB4hsnGsqbuwihQrFLNJGEEh6tvRfh5fEx+Ff8rNhA2ebRLZMbfSvzFsVa307ywJrLjtcOiNKz1B+Lk47bcczY4hXNwpZZdAsaPz5EJJ9X0oaZAv2JioEYA/35xZyrb9hjkgANizx5T1UJvMV0lrbyxSUZ1Ik27g7VzFFuS3/AIjuZNMmeQqZVniC1H7LJJWgH+qMd1pu3165ayvea/GgiaKgP89Gp9Bw2UUpxajdXFleo8Hqsbd2hjJKgyIQy1NNsQd1IQGiR3Ut1LDeaascNzBLGxWYtU8eSjZVoOS9ckSx4WtB0tFv4zc6fHGkwaGVo5C54yqUOxA8cFhab07y7Y2d/HPFbKpRyCw68SCpoa+B8MBK8KItPK9hp2p+vbjg0DkRkU3A23PywWKRwbp/SO3At05MsSKoYncjiKYgsyrSfCHANQYXYH5o2EHdBCnaF3tYGP2mjQkj3UYCkK4U7bYUu4niaDAinEe22JVwU+GQJK0W+QFCcCRErw4rQkVyMmQiU58tMp1SMBhXi3f2yktjx38zB6Xmb61HP6UttfCRQYfVUkQigPxLtTM/DEVbh5QOJgkegpMfh1MhRWi/VwAP+Hy3gHc0HHae+UNPt9MElj9aNxC9X4vEqjl8NKHkTtxyE4DmzhFuJLldRgv4NSVHtkeGGMWqlAju0hrWT4jykb4sTEMyASnvleeGw1K6v9QlGpvclCsbRJEEKuXJXd+tcryQsbNkeb1TWtbttU8nvq6MIlNRMhI+AryPxHb7OY1UWy9nl1xrGjXMbwTT280Eg4vG8kZDA9tzTLhEtct1CC6tbHzxrsTXSWyrLSkjooZQBQb77ZXwniaSKkyAeYtH6fX7ce5lT+uXcJbbVR5j0RQWOoW3/I5NvxwGJRYeBfmKLceY5vqrpJAatzi+JCzMdw29aimW6YUGFC2M7nxrmUVeiee9Qs7jyZo8UVxG8yRWPOJWBYFbZ1aoG+x65jQB4iz6POt6DMlgzTy0sEnljUZZpY4mt4LlI1aXg7F4tgEG71Y5hTx/vLawPVbCwD4ZmNls+/JzU7DTtfvJL6dLaJ7MqryHiC3qoaD3plWYEjZQd3r/APjTysKf7lIK9/iP9MxeCXc3cQQ175t8oXdpNbTalC0UylGALdCPYZDJiMhTEyCVeUte8r6Ho/1GXULZZFd2bgZD1O3LkPtU8PhyUMUq3a8YEU3bz/5SqK6jF7UD/wDNOTOOXc28YWN+YPlOgrqMfXeiv/zTg4Jdy8YVtO88+WLnVLa2ivlaSaVERQripcgAfZ98RjlfJEph5p5n1HTF80W7x0Yqvp6gGDcao3Fq06/Z3yqUDu4+Y7p35182+W7zypqGnWM4Z3iVYYUidFqsimgHEAdMyMeOQPJuhKIDxf0Zv5G+45lEFjxB6D+VPmDTtFh1hNSkaBbpIhDRGbkVEgboD/MMqyQJTGQBtg9i13bXIkSN67qRQjZtuuHJDijRYSILNPJmu2Ol+a7W8uTILeO1mhkkCl/jZSFUADpyzHxYzwn3oga5vSE/MzytQgyz1od/RfrQ4fBk3cYf/9HnIjiuozOk/CJCysJECkGuwIbbf55yEiYmiN3WHvXW+lTyyOZoViUx1VYmHJviqORUjb/JxnmobFIulIaPrhDPIeMs6kcQxaNAppRqj2/ZwnPj5DlH/TINr7Hy7cfDFNJ6rSHnOkfKgGwpvt2+LI5dUOYQSqyeW9ThuWNhDJC7A1kd0kSn7IAUAhf8nEamBFS3WJIUj5evLkq2rK0yo3P04gUSneo35fZyf5kR+j/ZKAoL5SsrfT5beBGa4lLSNdyVLJGCCFQUpy36Yfz0pSBPIfwqSSiz5E09baKO4iN08Q5RSuzKwr8R4hR3/lIwDtKXEa2BbIyIQB8oaULeJTachGS1xIVcyeKqv7PxH/J+zlo1875szmJKrH5b8h3jRNf6VdW8zNRmgdkQitCWBVu/XMjFrskNieINkcw6o+y/Lz8sZ3Ag+tSBjuWnICgEg1rCOmZMu1Ijns2eJE9Uav5P/lw7sPXuFp1/0pQKnpSsOTHaUO9mJx70Dffll+W9oDxe9lboQLlAFPcn9yP9jlcu1O7dEpjogpvy78ievboi3vpuObH105Ffpj6H9n4crHa1bkNfigFHxfld+XcsBuFW/CKxT0zOnInxA9L+OTPa8atn4sau0R5b/L7yUmtx3VpFfJdWMomiMsqehVDVeRWIH8f9ljh7TE+ey4coJVdR/KXyT6nqXMt291dSHk0My8fUY8jsI24j5nLJ9p4xte4ZGosQ17yPPa3QtdOWRNKXZpiwkIBFSealfir+zxXKf5Qxne7LCWUBf5e8k+WbmQWeqSXLzN0ZJFjRqUrQGNun+thPaNeqlhO+eyZ6v+XPkjTGg+rrc3NzIQ6RNOjJQGlG/drjPtK43EscuSuRSpPKvkuGVo9Rsr6GZQCfQuIilG8VdGYUG5w4+0CRfNhDMOqY3nlDyhBZR2EKXdzbxObpwZQ0itMip+xGg40QHIZO0p36aWeU9EPZfl75RupZK22pJBGGFVmh5M6j9nlH92VnteUa4q3QM+6c235QeRLpG9G7vOYA5xtPCHWvSoMfXtmZj7RhIXbkRMSLBQGo/lf5QsZPhN7cKOXMepETUDelFXpmLPte5VFoyZaOzHl8nyXfBotHeC0LkrIGKTcAftsH5Gn8u2TOvEDvPf8A2LXHIb5siv8A8vvL9m6CGO6uWFGVX9P06gUUuVXfp45Tk7TN1EimWXIRsF2l2V7o7y6lDZlTwWN47RkEpHMMv2K0qe3/AAWY+TUDIOAy5/zmzS6k4jt1ZCdc8wtJwYSrECoaYojAMTv8KjmeP81MojIiNCX+a5w1uM7lj2u3+vXjTyrYzTekvBpn2Do5IqFHGo3PLfLtPwRq5bycTNrJHaPJBeTvL9kmpNeXcVzpptvTlijh4LHKUapDeqwqB/rZszrQBRILHBk7yzfVvNFjBbj6h6ks/Hm8ZVD8INKfC56775RLUg/S2S1A6Iuy1WO8WO9ZWSGVEYFVRiP3YWp+Jd6r/wADkZ5RCV2zGQc0xhv7WOSG4ZnaNGDt8EdGANaU9T9qmVZtWDEi22OYA30QLec/0heSyRaE9hal3KSSegoFDQ8Y4jX4v9X4s5+eilH1eJxSP83ic6famKuqGvtWjkhkdbEtMi1jnAjY1Y8f3dasG4j/ACclhwyEgeL72ufakeAgBIk/MKzstV0r6/aO0Npdwzcq/tQmoBA6jxXOk08snOxQdWNQSd2b3/50SXTo8Gm6t6EqP6UsF3LErAGtQgdaDj+3T/VzPGugOZptOWPehtb893MltBZQ/XjLexBFnaSS8FueaszS+seLEIXIZv8AUymHasJiX8PD/skSlEb2t0zXNLmn+oveNcXKkKJzAilix7qpCrTMUdodTsEwzxJpOJTpiRK55SHoUWNSwPiVrk4doQJq24yAQslzpBcDgVr1aWICn3HBk18Qdi1HPFQvb7SbSBneJnKgFQsZQUI926fRhlrQB5rPOAoQa95daISyTGCXosXxVr23B74jXCrKBqIoix1LQ7uYxxXbRuo5KAGBHHr32OAdoDqmOYFbqFzDZSK1JzCVL+uR8NQeg3O+HNrxHkLTKdJdrvmOOwEbRLNcyzfEVZQDQ7k7A/ZGUfn5TlUaoNGTUUdm5fIujeYI31y5uLqKS5VWYGaSEmi8QFRXC9F8MzRrOGO9NwlYu0ss7HSm8xJdyy3kJ0iIJC/NzFIUUokcimoP2qu2YuPtMg3KqaBmPFudkFF+X3k2eX975l1WG4YqXh5gIGc9E+A/DX7OZmPtTHIcmQzDvTmT8j/LiCsnmbVl+c0f/NOXHXYwN6bfixu/8l/l/Z3aWzeYtalLEKWSSMgE/Ne3fKP5TBO0dmk5hdWn3l3y15Ei0fWbS31+/kS/iSC4a4kjEkXFiwMfw9/5viwz7QiBZDYJiuaUp5D8jRaWdUj1fULuZAQbCSccC4rsSqq/Qcspy9oE49vTMtU5+nYsee30q6QR3Ma2qmhMcTlZFQn4fjJYKxHxfFmPHPkibszcOOeYN2Uw0vyn+W+o6tHpsNzrTSSKWXncQhiAKkhQn2f9lmd+dlz4fS5sNRxHmz3yt5T8k+S9ci1uyn1K4vLdHQQTuGWko4NVQg8f5sjk1sSHIGQDqlGuan5Z1jXLiPUp59Pkeb1FZVSRdl40IahAp3ODFr6jdbOPPODJEaf5U8lXY52+uPISPiXjGCO2+2ZA7QiWUeE9UXF5O8rI7MmpyxmM0JVYt6j3BOR/PRPNmCO9Yvkvyd6iIuqTfF8TOBEKClRuFyGTtGEVuPK1O6tPLeiE2yzT3EbOqvOyxOSJKABW4028PtZg5dZHJMEEsZZRHZOtPTyxLol/o6ajcyWl4CtxG/ANGxUq3E8QOVP9bMyGrgd+TOGUEc2G3P5OeW4KPbX1z6DEHlOi9zRfiXY5LJqJDlIU0yxHnxIjXfImlapqWo6xLLJ6kshYwooLcafDWu1SMxc2vlEcUSEZO+0ptPJHlSURrJNLHI5+GBl+Kv0ZVHtHLL+Joib6psv5UaCyclvXow+IcU798vGsyfz4tvhf0kFcflr5ei4SNdTSRluEnFI34b9wK/qyEtfOJu4rKB70Qn5X+VPS5reM4NKkJH1+Vcme0p19QUQ80Qn5S6BLG00dxL6Y2qVi2p2oT1yyGsyEXxRZeGe9TH5S6IYg31xkUn4eSQb/APDDJR10qsyijwfNRh/LPQZWpFqMzjcOqJBRSDTerrlf5+zdhRDzXp+W3lj1nie7nBipyJWFd2NOPXrjDtCZJFxCBAXzRiflV5aozrPO/HdgphBFfpyz81kP8cWYxX1Xn8tPLYm9JnnLjb7cY7dPtZV+anf1xXwvNGH8ofLhZY0uVdyoYxGYK4r2NaD8cP5jJ/PCfB81Gb8rtGhLyvbTuBUyN6sTj/hWyuepyjnJEsKg3kTyq3BFtpz4jYNQ9xR/iysarJ0kw4AojyN5S9T0nt5lB2H7xamm5254/nMt7yTwea6z8u+RbPV7d42dbu3kSVYmlUHlGwYVBb2yX56Y34jXuYmIvcpZq/ljywsF3qM0LvdBmdmEgCksxbpyrx37ZGWslI7FZ0WIQX+nXssQTTolsjxS4lDFXVq0opqN6DLzLJHnM8TikkJvqI8jWcqJBp17OgAZ5SzKFB7bAr18TkBqc8jtIU2mYTTTdD8lT6WLue0lVpB6kSiQ0ZD0+02xyk9o5I3En1LCYPNA+j5IaV4xZO/w1jdJmA8KMev3Lhjq84FkoEwFkmmeWYFkaa3JC0KLykB+I9BuOW+QGuznYFBmpWVz5cla5A0zi0a86MWIKUIqK5bPPmFermg5N3//0ohF5k0QTOj+msPIsIwlRyG34++cRPS5C67ZJ9W833McxFo8cdsjkh2QK4BoCAcysOjBjUhugSTODzlYXFujSOtOQFFqtQNq+GY89FIGmRkETL5k0y3jWITlvVryCCpUEfD/AC7f8NlcdJM7p2QqeZtNZuEUsqLsGY1FPl1yw6SQQaVTqtk7/urksNquSVIApkPBkOiLCutxYLRri8ZkmBY7gAVNRypkeE8gE2FZNc0aFEj9SrVqKVJqe9TXbB4EzuzEgqNrFojcjcCpHVQSfwGA4ZMCQhH1K1lVjE7STqwI59K9+oOS4JCkGQVIr+2YhXYRPwPNAQVFO1fnjKBKbBWRXfrtVJYwYqGjPQE08R/L2wiBioUdRv4Y4SEMUkrU5RMQVZt8ljgSfJBk5NSt5oGEsKLMq8YyOh4/ZB26YmBCJbpNe6/eRXKtIVZIyGXkKb0oVWh2GZWPAJBjuE80/WLCezWVmRHHwmMcjSgoKMeu5zFyYCDTMSVP0tZD4kuuRX4eDdd/Db9nrkfAPcvErWWp2F0hVp4wsbmiMRUkmtatSpOQlhI6JRlxdWSxhy684x/d7FgB4Gm3+VkBGXQMiVOSTTZAqoOUvLirKwBqu/w164RGTEgLL+XT4UHAxer6n963E9FoadetaZKEZBEqStbu4a/VkCURgBCGCihJHKtcu4BW6IojUrmaG4t04RxggtHKzjiWqOQO+Qx4QQUl1xf3FsAEECBqFmUrXia7mp98MYdEA1yVJPMcENVKxc2FCQQahd6jr8siNMSpLcfmKzPSaOJW+EF6/E/dq/yjE6YrHZx1nTDO0clws5koPT/ZJO1RU8cIwT5opfJqGnszLBwElAFAKgVB3I99sfCkyruUWuIkYMJoEaRQSjOOQC9aVB7nDHEUCJVJtXX0Vhlkio5IYMygU38OnjgGA9Ay5NJqllcK4j9Jo6HkC3Y9qdcJxkLYaWz00uWkto25jisiGjCg+yDXGJlytIIDoZbNbcJCiLDHReIfYAfT4YzEiWRkF9vqMV1KsaMskYFREXBJG/7O32chPEQGHFeylLp+ntLLPMvosikIoYhdzxPQjxwwkaphS1Y7Q8lt26kry9WrUU0DfENuuSkDbIkdFGLSbdKTGKB5BVJHkIZgvTam3tXJnJKqsqEXyQFzI0TBFJWE0VVX+VaeIyoxKbRcj28loqSBY4pR8ILca0HQg77ZAYyDakghDC0sOScE4SkghwNzvsK/LLakgABEfVLz1PVe+V0pu3EKaUIXp/LXBKI7mRsdUKdLnuJ5FF2si9OK7Ny2NOVckDQ5MS4abfqOSz+oI19Liep4n4uW56eGRkR3JJXrpSQ0J4KC3Op4n4m/a3+ziZEsCFCy0xIfVnjuYgi19Z1Cs5HXenv1yUiTzZAJvaxlbeONJSUjHw0+yK7vtvlcgbbRM8rU2jpEGEwJHx/F14/LpXBwMeEIJrjmWjjulAbf0033Pf38ct4O9BKq1u7WpE85WNalkAAb6e/yyG3cxMtqQ0iaZxXmr8IwVAC70O/I/wA3TJAFja0rplxGsYvJY+TVUftDlseu/TJDbdIk5vLUE0Txw3isJqci6BjUEGoZgG7YRmo8mQpExaDb2kkxSdQ0lOcQQ8dhTr8WQlk4uaCFi+WtKuIQzMzKx+LiSA1du3h44RlIRGKx/KumOxlMIaUsBU0AIXalKfZwjUSqrTQKIHlq1EkdwlYp+ZLzKQGNRTiG/ZFP5cAzSqk8KI/RnwBC7NMBTm9CwoKV5EU2yviJK0Vp8u+uknqAMz0HFgNjTryO9TkuMjkjgbstHhtnKC3C8T8NBsaihqNsEpE80xjTo7GSByTIuwJ5Ur8VdiOvviWYQ62gNw/qzmjkqqqdgPeg64CA0rp9HMoj/ec0iIZEZv2gO9Ou+Mdr82VWp/4agaC4nf4jLR5KfZXwIP2h0yfHLaujIQbtNNijRbT1CI670mJHjUchscZ2d2PRMYtHtY4puDMpkasgZi3IDY0PbIEX8GQipppUlamdI4geKqOtO1T1yPCGPCsuoJLOP1mq6R7VA5HhXeg2riMYUgrbA2U8jlJldD8XwbfH4GvxHp8WSMCEA7rrhGkT/RyFlRt1rtWoFSenemAQFsjy2XW8NyIF+syhXc/CoPICSm/TEgA7KCURJ6ckvppyUMo5CgAJ6daYBBPEUHc6Fp7RuJGdVcFTRiDXr277bZOM6Y8K2z0zTAX9ISersJXlJJLDw+jJSkSilZtJDSExTH1EWiKWoCdyK198rBSLX6XpBMjyXgkNSPVRZf5dqAjf/WyQEeZ6JiCTuiLrSLOSUXFm0qxk09NpCxSu25OSkRzDOYrkls0WmQJNHKGAl+Fzzbff26ZGywGQhuOWzhcsKVRaIF6U8BTr0wCJtESirawS6WqAPzX6zHI8gUcR136hqD7GWjGSmiUlNpost09wlvG0przahqq1rUnHjkBVtR5tx2WkSMfrFseAYiOnIg1BB5YiZHJmA1BovlzTrZoLKCWWIuXLAcveu+5AyWTLKZsndSBe26rNa6MYvTaoe54KkTfCWYdPh8aZGyOXRjYQ0h4l4QqBFQqqk7KWXbb/AGORqzaLpAWGk2Md16qWwSJCUkkib9nb7S16++ZE80iKJWUrKa3senmz9UQlkK9K8SeR23OY4Jtl0Q1vcaeySIbUC4RCU32LEfFvt8stIPexf//T4c8N4wAhIaQFuTtQUVT0BzS3Gzbqg208E8YWY0qN2OwJH68iIkHZCIttOWGMjmvE7py7D6PHK55rKktahJCnBSzPQUWnUU+eOIEoU7f0rklreVkII5I4oCPn7ZKdx+oJBKOMEsUikOSd/hB6/PKOIEKVdjMsZWRlao6eAyAq9kIWSS4knKwzKkMY3G1QewHfrloAA3G621ELppf70oVbchq7eIwnhA5LaMWahIDni1KmtTXKTFFqM96to6iSWryHYdqE+PbJxx8Q2DIFb6Uc10twZkZUaiVqRWnXam+GzGNUqJYoVFXVmBFDsd+mVC1Q99fi3RVkLHY0IPQV+eWY8XFyVAJJBeOv76h/Z2Jr/rHLyDAckkUmUMMsQFZeTrUKKUFKUzHlIHoxJU4X1ZJg0oR4qGiqK1Pv4ZKQxkbc1tXVZANlFD8XIdRXwrkLCQVkSgljyYAHjxqBv3O3z64ZFNr1imZQUkLAbFvn3yJkB0Y2oSM8TgOCwagZj238BlgohbXpC0klCxpu3cewyJlQTaIksTyD8i3Aj4Sdqg7ZAZEW2fUWQh4w22xpWlR1ONik8SoJFAP7sFjsRx32yO56otdIC1WQBD4dSPowA0xtqMqCRQlkGzUG5HSmJJTa2SYHZoeRJ2oOnfCB5ptZ6Cs/IghS3TtSlAN8lxGlte6gtyXjXo602P35G0ElTMkyPWKJA46PSlR4DJgDqyBX/WCUHqrwb9oE7V69Dg4d9kEro2Q0HU7swAFBkSEKX7uKUyQsQ5FGcHfr298luRRSNlX1nZgrNVCtfiNSfDY4OFNqhuIEDKQTXoB02yJiSUWoXLQvCCpIkDAluRpSn4ZKGyb2UbNzHC3ryBqUovsa06/LJzFnZFohmtpal5XfiKorN8IJpgG3RNr47ekgJuHCk/D3oeux7YDLyTaJqnGQCVyrCgofv+7Kvgi0uWC+iukk+s/A4JYn22HTLyYmNUto0SzxtyMjRMaV4EknbenzyvhC24zFpVdJnoB8VRTenXp1x4QE2px3MXqmNmARgeQHw15deWHh6qCiYpZoSF9ZUWhCAGhow6YDEdy2hJ0D1EkzMUY1WhNCdqHtvko0Oir44LYc5Y4zzABFKqdvlglM8mNoiK6EcBVnk4n9ksWFfp8KZWRaSV312cssbSSlwKBa7Lt4HAQi2zcIjlkpzSlGZqb9+njkeG02mEGrrEih4fVoAABThQnfc5A4mXEjYZ45i0LyTJb8aBAR33JDAg/DkOGkiaYWvG3URxytO0hBVn6KKjYLtlcrLKJ3Xp+kYbglY+SN4bAKTX33qd/8nEbMuqOhEzfFJwCrWqg7iuwPbGmQBdduEQsGPEnYBRWopvgpBQ8t1bKm8j+owqqg9TXr498kAjiCks6qysPWfkeIB6qDua+IxIRxK884oDHGvqtQoDsa0rucBDIleZFEYfgqt1Kgg9u1cCLCHjjij5tHGGB+MndTXw6nwxJKBSvJPGiFvUPpKRULtyI3IJxBLLjQd3fqkIaGBpTUBoH2NCRuKihyUR3sbCNGowFOYQs1K0rQ1H8cFrxhTGpxPGzxwMkgrVWIArsa8gTikzCg1xbXCFZLdmr1qSQK/I40UcS9LfR7dIwtuIubMW4A1JO5JpvhJJ5sdlGRIFldYRGqgByHFVJDU3yIJSCpGRY5VKNGF3JG5FKePbfDw2GNoqLVoQvPirlaF6LQ7ioFScQGQkF7XySLxEY226/FxHxGhGAimRLRu4yUaRY3G3JVBoK1r07j3xFptCpqpEoRYkElRymI+KhHw0rXvjwkMeKipT61dxrIqwJyWokPKoqaUO3jXfJCLEzWWt7LMgeWMAbVYCo3HYVNMapRO1Ux2MxWR2+JVoF6AbdvY4CuxQWoTCJFkiHJQQoVB9kE0I37UyUBbBfPdwxqqGYBuJqCVqO5FOm2JiSyHkgY9QtbeZXD8wlXMjfEQSOpNN8n4ZLGlzPN65nVSYACzlTRSdievWnIfDgrZatauvfU7tIooDHJJzDlgxqCKkKwpxqP8nJjESLXipWt7i3uTxmYnmOYrTlQDfcGvQf8DkOEhQXCysrluCylFVeK1ovKlRsD8Rw8VLzbtdJtbepS7k4yVEnwAmij4Sa4ZZCeieFEk2VqiqiMY2+Lc/CeWx6CmQJtlwoe3n08SPcCzZwY2JZzsOoqp8cs3Twh/9TjE9xxfglOVTSvY1365z4j3unIU59PjmZC9OJJb1FNOIpvhjlI5JulaGhkihDGRFFefjkJciVUp4GNweYNaGvZhy2GTjLZbULe1hgl9IMQ/E8anfrk5TMhaTJGLUgL6hpX4Sdvpyk+5i3MAkocyckHTcEUI6mmMdxVIU4GieYsK8SD2ou23X2yUgQEuiEVtI5L1JFQNyQD06YJXILTa8lj5UJHXY0NSe/XE81pDX1ks1JGanHvWgJO9OmW4slbJBIX2kBihI9QGIKabd/EYJys+a2rLb3HEOsgWMLyDEgUY5XxDuQh5bKa4hKLJ0apJqeR8N6Uy2OQRKYmm7fTLqKSMswFDxZa0HI9ME80SCtpwljVoy7F0pV9+3htmGcvNBVrWyS15py5jdgpNaZCeQy3VdIbUsYiCWf4hvTYd8A4uaLQ7R2bExrJxrsQepGWAy50i7X/AKNDjlDOYoqbgHxweNXMWUqkcQVqvKvEHiF9/p+WAm+QS2ArPzVixUcgB0I6VOR5BStSP4W9Q78eRHia4Se5gCpw2U4kr6xIO5Fex98lLIK5JJREelSTTLSRkrUniw3K7mhPU7fDkDmAHJlGNqk9vEkJaFJXl9YxCPYsUK15Gnh+1gjIk71w0yOPbZCvcRx8QwoDUKCaE9qjLBAlgApJcR3Sc4w2wpXwPyyRgYmikBpo3jcGKUhhRQO/LwyQLMSAV0g5o3xDkaV8fnlRnTGRtzQyqAoJO+/H2P34bQh7pY+aRzV5yklifs+HU5OBPMIUhHEpeTmxMg4Kp8BSmw22AyZkTspK2Cr1jU0Irx5V6de22Mtt1BXRJcMVJZeNfi5GlPvp4YnhSq/UtUcqAOAPau5H09sHFEKrfUrqCF2dA7V2X2pU5HjBKqRKqHEkXFqgsD0qdgu+Kr60CVhHMV4oKct/ngrzQQow6okhaNkCkA7FgK18NqZOWEjdbR9tJUclj4q3QVBp36DKJCkhWNy05ROAAjJVeIFdzyNfvxpLTq9RxoaA7npvgGyhTWB1lpUEkhSRuSaZK1LS28hYhCGUddh160rhBRTc1sSih6FlOx67Dp0xEkhyQMo+EkA1NRWgp12wcSktCZOfpF2DDcKAaH5k/PExNWhWiZWkT4nVBvQ7jfb6OuRspDkAkZjx5FWNGHcD3OE7MSpzRICOLBnBowpTYb1yQVtYkY8KsisteR78abADE7JC9JZo6ULbA9TsKfLI8KolNSdyGRwnbiDt92RliBZAo2HXXBCer+8I+yTQ+9MrliTxJkuqSoBRuRP7TEUP30yvgZcRVY9RcMxkYfF8Kim47+ODhY8TbXCcVeiPyYmoNCPAFjkSVtUM8pK+pHRmP2gQeK/TTIpVXt+CIyVYvX9qpHXwwkqXOJw/H0y0ZG7AhgdqmqjBYSQ0Udj6gjNWJ4AVIG3th4gilG4S4KenursdyegpWgp/NT/hsFpLUVtcA0kqPSoUY0J6b9NjhkGNFCSOAwtiGKUJ3B38STt3yKKQtlqkLyC2QOpWjKqrWnWtaVH35bKBAtCZFrQyPEJ2UqQZuW3EnfqRkK2Z7KohgRy8cvqCMlGWoruKH7hkaARThZvyUsw9MqSHFANz36kHESTW6mlpDydeXwVHwEbkmpAyQkEUqPaiFEZ1UF/gINKk/s+++DiZGFLf3Mboi/CCvIKOqnfx36YbWlryNIvJUBTmKuDUV67/ADxCOFFLbyrC7NErSAlwincAU8O3I1wlnGNoK6XVmWR4bWP4QzqqniCuyhAB8VeWGNXuWXh2FCwaeZmhngkSWhYuaFAan4UII6ZKUAORauEq9vp1y8TbhEIKsWrsQdqZAFeEr57C9MkTF1KKy+pCVNXTqTt/N/k5IEDmngV5dP0mdi8cC15VFasfs0wcfczq3W2nKLThBaxxpuHjAoCQd9vDBxEsQOiLaJ1Q/Z+GgCU34r/bTBaRCkNcafbytG71QqK812Ox6NhEypAQw0a19WirTaqsTxJPfcDvvhMkCCtJpnp/GT8Sg7nqB1+EZE2yMacbWJo1TmRI5+JjQe+StG6ndWc3oLCFUuzUKdQBSpYVwEqonT4vgdY2rxbmp2/ZPEUrTDxIf//V41erak/bVWq1D8RPXftmghxW6kqSxL6Kcphxp4NSn/A/fhJ3U0q2MUIuAI5izdSaMB8umRy3W6oq7U82KODJStKGlPDplOOuvJiUMyRNx5OiS9qVpX6A2+Wj7E0tuILf6tzW4T6wAtY1EnJg1e/EABP2slDn5JAU/SrabzKBtzIFfi+kYb9SNkRAjegvoSIU8AG+mldsrlV7pKnKqhjV1JpQg8qU7HcZKKlT/ecqbdNzU/0yVBi16bGZKSkEUryDcT49iMdqSLRTiMKKlSKHjXYdTlYClCy+tROdDBtWta09tq5ZER+KNmoUBZBG7CMyfaPLY9ui/qwy865Kio0b0pKutanmfiryrt1HhlRqwqvGs44+m4MfGg+1SvY9MrPD15pKJpcggEqZeI378a9tsrqPwQsCziVW5IdtlbrX22yXppQAl9xGhdDJIBRySo5b+I2HjmRDlsu1pnB6gtE9KhavxDfx98xpAcW5UqJEfKL1Ch3JWv8AN3G+SrnSUTb/AG3MfGtBQDpSuVyG26Gz6vqFmoQQeadgK+JwUKQVsoueElGBHfjXrUUpt4ZKIjswKMtzdiMEKC/da/xymQjfNsCtp3I3hEQIuOD/ABIRXhx+PYj+XI5AOHc7NkLSK7Nvyb1VWo+yVJqT7Uo2ZsAehauq/TBBWcxH9r94orTl33I/Vhy3taV05vQqmMIxB3Wu5+WRiI3uVU7UXRnJcqr7bDkTw964ZCNbIVbo3YRvQUMxIE1DSnv92RiI3uVS29BKL6xVQKemX5Enw7UpXMjGBeyqsZuDbgMAsXYgk99698gRG+e7EoaIXRIrQD4qA18evTLCIqEcIoyq85lWI/b4gkBvoGU382Saxq/KHi1RQUrWvT5eGYprdV1wLkSfaBXYsWr49MEQEoG/DmT4ywlPLdK1B9uIy/EGO6BCt9Xbmx6UTjy5cduR3HKuXbWhRjigBoJyzb8XIcHj32IyciUprpq0T4W5Kft0rQD35DMbKGYRh9WrelT1KniB14967dchtSDyUIHu6kGNTAAAhqKn3/mwkRrnuoVJOAjH2WqfiIJFKnalB9oZGIVZMGD1SjbjkDUCn3YYhSrW5uBCgRVLEncno307ZGQF81XWR1MMTOqMNgASeNd9xXb50xyCPQqi0KG4HIRqNqk+GVUaSW7kERngQ0lfg7b9qVwQG+6EucS8T6Z/eileFaH58RTMgAKW4OJHxgLJv4kV4nwxrfZQ2irQfEpNSDy5bbbnpgkqyWIs4ZJikatUoikhvauWROyUQFgFQrcpiBua0A9qjISu0Ier14qq0q3JifirXbtXGh3qEVMJTAPXZVkrRQvIj5nbIGrVHRc/QFOm9ORNOu/auVTAtUdBzMfwUXcGux7nZq9spoMgioyjbFeA3oQanpvkCEhMYTF6JCCjcqhiSTWmy0pgDPoheUnqEcD6nEfGD8+NQNsjIDvYm1WNnJUsoV6KCKkmm+5ptuOuNBLrh72gM8a8qqI1JNAOJ3/l6UyZA6JKnKlx6WzktyUyEV5V22+EZFibWP6ProDx4hPjZtiTTYEUOTUqGnRWIuC1rMGu6EBCCDuTxIJHQfF1yU7pApXZLAzH1pEW55Dn6oJOx2rUdz/wuV7suu7Xo2Zc/VrhlUMQCA/EtyBJ+z9GE2pV7mFeJZrj91yUhCrfaDCgqB0PfAqlCn72UTO3qjjzJrUgMePbuciQxHNq8jt3uSbmYQychRaM3xjoBtTfv/lYYhlNSmjsfUYCat2JCasG5FeO4oBk+it2KxDn8aMhPwCQNQGu/KoC1riyFplai7+sSm2P78bSg8iDsDVqjpTBRZxvoqrzCMGo0ZBoRUUT4eXvg2tMTKlBfWHIR8CA9eRrU7bgDqMQDbA23HwEu+9UcjqFHWoG3XCQjdDKl0ySESemwIIVwzArT4gNulf9jgARu1YgCesBJJQ8lFaA16EkdMK7rrd9a9N+UY5LUL9kclr1O5pkiB3qOJDRtraFlCiR1ZjzrTnUjYA0Aof9jgqPej1ISZvMPq/vkHpAjkFK/F8VNiP+CyYEK5o9SZqLtZ3qeabGIioPTpTpkJBI4lCdL43C/GFkK/FzDGg79skFNqEolChWYNIKVdeVCe9BTbHZiqypKQtXoApKkh6Up0ag6fPAeagd7cf1urFKenQhweXTx33/AONsI5p3f//Z"}; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/images/blank.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/images/blank.gif
new file mode 100644
index 00000000..75b945d2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/images/blank.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/scribble.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/scribble.css
new file mode 100644
index 00000000..9986f2ac
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/scribble.css
@@ -0,0 +1,40 @@
+#scribble-pad {
+/* margin-left:auto;
+ margin-right:auto;
+ height: 475px;
+ width: 475px;*/
+ background:url(https://www.ibm.com/developerworks/mydeveloperworks/blogs/bobleah/resource/stickynote.jpg) no-repeat center center;
+ background-size: 110% 110%;
+}
+
+
+
+#scribble {
+ white-space: pre-wrap; /* css-3 */
+ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
+ white-space: -pre-wrap; /* Opera 4-6 */
+ white-space: -o-pre-wrap; /* Opera 7 */
+ word-wrap: break-word; /* Internet Explorer 5.5+ */
+ max-width: 300px;
+ padding: 120px 100px 100px 75px;
+ color: #486891;
+ border-color: #ff0000 #0000ff;
+ border-color: transparent;
+ background-color:rgba(0, 0, 0, 0);
+ font-family: Arial,sans-serif;
+ font-size: 120%;
+ font-style: italic;
+ font-weight:bold;
+ line-height: 1.5em;
+}
+
+#scribble:focus {
+outline-width: 0;
+}
+.c-link {
+ color: #486891;
+ font-family: Arial,sans-serif;
+ font-size: 95%;
+ font-weight:bold;
+ text-decoration: none;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/slider.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/slider.css
new file mode 100644
index 00000000..f609403c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/slider.css
@@ -0,0 +1,142 @@
+div,span,p { margin:0; padding:0; border:0; outline:0; font-weight:inherit; font-style:inherit; font-size:100%; font-family:inherit; vertical-align:baseline; }
+
+
+#container {
+ width:580px;
+ padding:10px;
+ margin:0 auto;
+ position:relative;
+ z-index:0;
+}
+
+#example {
+ width:600px;
+ height:350px;
+ position:relative;
+}
+
+#ribbon {
+ position:absolute;
+ top:-3px;
+ left:-15px;
+ z-index:500;
+}
+
+#frame {
+ position:absolute;
+ z-index:0;
+ width:739px;
+ height:341px;
+ top:-3px;
+ left:-80px;
+}
+
+/*
+ Slideshow
+*/
+
+#slides {
+ position:absolute;
+ top:15px;
+ left:4px;
+ z-index:100;
+}
+
+/*
+ Slides container
+ Important:
+ Set the width of your slides container
+ Set to display none, prevents content flash
+*/
+
+.slides_container {
+ width:570px;
+ overflow:hidden;
+ position:relative;
+ display:none;
+}
+
+/*
+ Each slide
+ Important:
+ Set the width of your slides
+ If height not specified height will be set by the slide content
+ Set to display block
+*/
+
+.slides_container div.slide {
+ width:570px;
+ height:270px;
+ display:block;
+}
+
+
+/*
+ Next/prev buttons
+*/
+
+#slides .next,#slides .prev {
+ position:absolute;
+ top:107px;
+ left:-39px;
+ width:24px;
+ height:43px;
+ display:block;
+ z-index:101;
+}
+
+#slides .next {
+ left:585px;
+}
+
+/*
+ Pagination
+*/
+
+.pagination {
+ margin:26px auto 0;
+ width:100px;
+}
+
+.pagination li {
+ float:left;
+ margin:0 1px;
+ list-style:none;
+}
+
+.pagination li a {
+ display:block;
+ width:12px;
+ height:0;
+ padding-top:12px;
+ background-image:url(../images/pagination.png);
+ background-position:0 0;
+ float:left;
+ overflow:hidden;
+}
+
+.pagination li.current a {
+ background-position:0 -12px;
+}
+
+/*
+ Caption
+*/
+
+.caption {
+ z-index:500;
+ position:absolute;
+ bottom:-35px;
+ left:0;
+ height:30px;
+ padding:5px 20px 0 20px;
+ background:#000;
+ background:rgba(0,0,0,.5);
+ width:540px;
+ font-size:1.3em;
+ line-height:1.33;
+ color:#fff;
+ border-top:1px solid #000;
+ text-shadow:none;
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/spacegallery.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/spacegallery.css
new file mode 100644
index 00000000..ce4fd57c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/spacegallery.css
@@ -0,0 +1,18 @@
+.spacegallery {
+ position: relative;
+ overflow: hidden;
+}
+.spacegallery img {
+ position: absolute;
+ left: 50%;
+}
+.spacegallery a {
+ position: absolute;
+ z-index: 1000;
+ display: block;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ background: url(images/blank.gif);
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/welcome.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/welcome.css
new file mode 100644
index 00000000..559db709
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/welcome.css
@@ -0,0 +1,169 @@
+/* Area Chart */
+
+#areaChart {
+ overflow: hidden;}
+
+#lineChart {
+ overflow: hidden;
+}
+
+#areaChart svg {
+ height: 200px;
+ width: 380px;
+ min-width: 100px;
+ min-height: 100px;
+}
+
+#lineChart svg {
+ height: 200px;
+ width: 380px;
+ min-width: 100px;
+ min-height: 100px;
+}
+
+#areaChart tr.z-row-over>td.z-row-inner, tr.z-row-over>.z-cell {
+ background-color: rgb(255, 255, 255);
+}
+
+#lineChart tr.z-row-over>td.z-row-inner, tr.z-row-over>.z-cell {
+ background-color: rgb(255, 255, 255);
+}
+
+#areaChart .nodatadiv {
+ display: table-cell;
+ width: 700px;
+ height: 370px;
+ text-align: center;
+ vertical-align: middle;
+}
+
+#lineChart .nodatadiv {
+ display: table-cell;
+ width: 700px;
+ height: 370px;
+ text-align: center;
+ vertical-align: middle;
+}
+
+#areaChart .nodatainner {
+ padding: 10px;
+}
+
+#lineChart .nodatainner {
+ padding: 10px;
+}
+
+/* Area Chart END */
+
+.button--small, [class*=bg-] .button--small {
+ font-size: 14px;
+ };
+
+/* Gridster (EBIZ) */
+
+.gridster-item-container .gridster-item-body{
+bottom:0px;
+}
+.gridster-item-container{
+min-height:50px;
+}
+.att-accordion {
+ border-width: 0px;
+}
+
+/* End Gridster */
+
+#myGallery {
+ width: 100%;
+ height: 400px;
+}
+
+#myGallery img {
+ border: 2px solid #52697E;
+}
+
+a.loading {
+ background: #fff url(../images/ajax_small.gif) no-repeat center;
+}
+
+.center {
+ margin-left: auto;
+ margin-right: auto;
+}
+
+
+#selectedTrafficDay ul {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+}
+
+#selectedTrafficDay li {
+ float: left;
+ border: 1px solid #000;
+ border-bottom-width: 0;
+ margin: 3px 3px 3px 3px;
+ padding: 5px 5px 5px 5px;
+ background-color: #F2F2F2;
+ color: #696969;
+}
+
+#SelectedTrafficeDayView {
+ padding: 0 1em;
+}
+
+#selectedTrafficDay .active1 {
+ background-color: #FFF;
+ color: #000;
+}
+
+#BusyHourTraffic ul {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+}
+
+#BusyHourTraffic li {
+ float: left;
+ border: 1px solid #000;
+ border-bottom-width: 0;
+ margin: 3px 3px 3px 3px;
+ padding: 5px 5px 5px 5px;
+ background-color: #F2F2F2;
+ color: #696969;
+}
+
+#BusyHourTrafficView {
+ padding: 0 1em;
+}
+
+#BusyHourTraffic .active2 {
+ background-color: #FFF;
+ color: #000;
+}
+
+#slider {
+ width: 600px;
+ margin: 0 auto;
+ clear: left;
+}
+
+@media only screen and (device-width: 768px) {
+ #slider {
+ width: 400px;
+ }
+}
+
+#container {
+
+}
+
+#title {
+ float:left;
+ width:100%;
+ height:30px;
+ margin:;
+ color:#222222;
+ text-shadow: 1px 1px 2px #A0A0A0;
+}
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/area_chart.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/area_chart.html
new file mode 100644
index 00000000..30ef2011
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/area_chart.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<meta http-equiv="content-type" content="text/html; charset=UTF8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge" />
+<link href="../../d3/css/nv.d3.css" rel="stylesheet" type="text/css">
+<style>
+ body {
+ overflow-y:scroll;
+ }
+ text {
+ font: 12px sans-serif;
+ }
+ svg {
+ display: block;
+ }
+ #chart461 svg {
+ height: 175px;
+ width: 300px;
+ min-width: 100px;
+ min-height: 100px;
+ }
+ tr.z-row-over > td.z-row-inner, tr.z-row-over > .z-cell { background-color: rgb(255, 255, 255); }
+.nodatadiv {
+ display: table-cell;
+ width: 700px;
+ height:370px;
+ text-align:center;
+ vertical-align: middle;
+}
+.nodatainner {
+ padding: 10px;
+}
+ </style>
+<body>
+<div align="center"><H3></H3></div><div id="chart461"> <svg></svg> </div>
+<script src="../../d3/js/d3.v3.min.js"></script>
+<script src="../../d3/js/nv.d3.min.js"></script>
+<script src="../../d3/js/models/axis.min.js"></script>
+<script>
+historicalBarChart = [
+ { "type":"line", "key": "AP_CPU", "yAxis": "1","values": [{ "x":1388552400000 , "y":2.13}, { "x":1388552400000 , "y":5.0}, { "x":1388552400000 , "y":2.36}, { "x":1388552400000 , "y":10.0}, { "x":1391230800000 , "y":3.15}, { "x":1391230800000 , "y":2.88}, { "x":1391230800000 , "y":3.0}, { "x":1391230800000 , "y":4.0}, { "x":1393650000000 , "y":8.0}, { "x":1393650000000 , "y":3.93}, { "x":1393650000000 , "y":4.27}, { "x":1393650000000 , "y":4.0}, { "x":1396324800000 , "y":4.25}, { "x":1396324800000 , "y":5.35}, { "x":1396324800000 , "y":5.92}, { "x":1396324800000 , "y":12.0}, { "x":1398916800000 , "y":5.55}, { "x":1398916800000 , "y":4.89}, { "x":1398916800000 , "y":5.01}, { "x":1398916800000 , "y":3.27}, { "x":1401595200000 , "y":6.27}, { "x":1401595200000 , "y":9.17}, { "x":1401595200000 , "y":9.31}, { "x":1401595200000 , "y":6.07}, { "x":1404187200000 , "y":8.37}, { "x":1404187200000 , "y":8.11}, { "x":1404187200000 , "y":8.84}, { "x":1404187200000 , "y":8.93}, { "x":1406865600000 , "y":11.79}, { "x":1406865600000 , "y":12.22}, { "x":1406865600000 , "y":12.6}, { "x":1406865600000 , "y":11.61}, { "x":1409544000000 , "y":15.27}, { "x":1409544000000 , "y":19.09}, { "x":1409544000000 , "y":16.09}, { "x":1409544000000 , "y":18.66}, { "x":1412136000000 , "y":18.4}, { "x":1412136000000 , "y":22.05}, { "x":1412136000000 , "y":21.66}, { "x":1412136000000 , "y":19.04}, { "x":1414814400000 , "y":19.13}, { "x":1414814400000 , "y":19.61}, { "x":1414814400000 , "y":17.61}, { "x":1414814400000 , "y":17.5}, { "x":1417410000000 , "y":19.0}, { "x":1417410000000 , "y":15.73}, { "x":1420088400000 , "y":9.67}, { "x":1420088400000 , "y":15.19}, { "x":1420088400000 , "y":15.02}, { "x":1420088400000 , "y":9.62333333333333}, { "x":1422766800000 , "y":16.95}, { "x":1422766800000 , "y":14.29}, { "x":1425186000000 , "y":12.9}, { "x":1425186000000 , "y":16.1166666666667} ] } ,
+ { "type":"line", "key": "ROUTER_CPU", "yAxis": "1","values": [{ "x":1388552400000 , "y":3.0}, { "x":1388552400000 , "y":4.0}, { "x":1388552400000 , "y":4.89}, { "x":1388552400000 , "y":7.0}, { "x":1391230800000 , "y":4.57}, { "x":1391230800000 , "y":4.0}, { "x":1391230800000 , "y":4.0}, { "x":1391230800000 , "y":7.0}, { "x":1393650000000 , "y":7.0}, { "x":1393650000000 , "y":4.18}, { "x":1393650000000 , "y":5.0}, { "x":1393650000000 , "y":5.0}, { "x":1396324800000 , "y":5.0}, { "x":1396324800000 , "y":5.0}, { "x":1396324800000 , "y":5.06}, { "x":1396324800000 , "y":6.0}, { "x":1398916800000 , "y":5.0}, { "x":1398916800000 , "y":5.0}, { "x":1398916800000 , "y":5.0}, { "x":1398916800000 , "y":5.0}, { "x":1401595200000 , "y":6.0}, { "x":1401595200000 , "y":6.09}, { "x":1401595200000 , "y":6.0}, { "x":1401595200000 , "y":6.0}, { "x":1404187200000 , "y":6.36}, { "x":1404187200000 , "y":7.0}, { "x":1404187200000 , "y":7.0}, { "x":1404187200000 , "y":7.0}, { "x":1406865600000 , "y":7.0}, { "x":1406865600000 , "y":7.02}, { "x":1406865600000 , "y":7.24}, { "x":1406865600000 , "y":7.0}, { "x":1409544000000 , "y":8.23}, { "x":1409544000000 , "y":8.11}, { "x":1409544000000 , "y":8.12}, { "x":1409544000000 , "y":8.03}, { "x":1412136000000 , "y":9.0}, { "x":1412136000000 , "y":8.93}, { "x":1412136000000 , "y":8.57}, { "x":1412136000000 , "y":9.0}, { "x":1414814400000 , "y":5.97}, { "x":1414814400000 , "y":6.0}, { "x":1414814400000 , "y":9.0}, { "x":1414814400000 , "y":9.0}, { "x":1417410000000 , "y":9.0}, { "x":1417410000000 , "y":8.78}, { "x":1420088400000 , "y":3.0}, { "x":1420088400000 , "y":2.01}, { "x":1420088400000 , "y":3.0}, { "x":1420088400000 , "y":3.01}, { "x":1422766800000 , "y":2.67}, { "x":1422766800000 , "y":2.0}, { "x":1425186000000 , "y":2.8}, { "x":1425186000000 , "y":3.63333333333333} ] } ,
+ { "type":"line", "key": "SCTP_CPU", "yAxis": "1","values": [{ "x":1388552400000 , "y":7.0}, { "x":1388552400000 , "y":10.0}, { "x":1388552400000 , "y":8.27}, { "x":1388552400000 , "y":8.0}, { "x":1391230800000 , "y":10.02}, { "x":1391230800000 , "y":8.04}, { "x":1391230800000 , "y":9.0}, { "x":1391230800000 , "y":10.0}, { "x":1393650000000 , "y":12.0}, { "x":1393650000000 , "y":10.04}, { "x":1393650000000 , "y":11.16}, { "x":1393650000000 , "y":10.0}, { "x":1396324800000 , "y":10.7}, { "x":1396324800000 , "y":13.31}, { "x":1396324800000 , "y":12.73}, { "x":1396324800000 , "y":9.0}, { "x":1398916800000 , "y":12.41}, { "x":1398916800000 , "y":11.95}, { "x":1398916800000 , "y":12.82}, { "x":1398916800000 , "y":9.58}, { "x":1401595200000 , "y":11.28}, { "x":1401595200000 , "y":14.01}, { "x":1401595200000 , "y":14.63}, { "x":1401595200000 , "y":11.83}, { "x":1404187200000 , "y":14.06}, { "x":1404187200000 , "y":13.96}, { "x":1404187200000 , "y":14.66}, { "x":1404187200000 , "y":14.36}, { "x":1406865600000 , "y":16.6}, { "x":1406865600000 , "y":16.95}, { "x":1406865600000 , "y":17.11}, { "x":1406865600000 , "y":15.94}, { "x":1409544000000 , "y":19.86}, { "x":1409544000000 , "y":22.97}, { "x":1409544000000 , "y":21.56}, { "x":1409544000000 , "y":24.55}, { "x":1412136000000 , "y":22.66}, { "x":1412136000000 , "y":26.79}, { "x":1412136000000 , "y":26.54}, { "x":1412136000000 , "y":25.35}, { "x":1414814400000 , "y":21.0}, { "x":1414814400000 , "y":20.35}, { "x":1414814400000 , "y":21.93}, { "x":1414814400000 , "y":23.63}, { "x":1417410000000 , "y":24.0}, { "x":1417410000000 , "y":21.43}, { "x":1420088400000 , "y":12.63}, { "x":1420088400000 , "y":25.14}, { "x":1420088400000 , "y":21.85}, { "x":1420088400000 , "y":12.5766666666667}, { "x":1422766800000 , "y":26.3}, { "x":1422766800000 , "y":24.4}, { "x":1425186000000 , "y":23.3833333333333}, { "x":1425186000000 , "y":24.5833333333333} ] } ,
+ { "type":"line", "key": "DP_CPU", "yAxis": "1","values": [{ "x":1388552400000 , "y":2.0}, { "x":1388552400000 , "y":5.0}, { "x":1388552400000 , "y":2.17}, { "x":1388552400000 , "y":2.0}, { "x":1391230800000 , "y":3.01}, { "x":1391230800000 , "y":2.56}, { "x":1391230800000 , "y":3.0}, { "x":1391230800000 , "y":9.0}, { "x":1393650000000 , "y":10.0}, { "x":1393650000000 , "y":3.64}, { "x":1393650000000 , "y":4.06}, { "x":1393650000000 , "y":4.0}, { "x":1396324800000 , "y":4.04}, { "x":1396324800000 , "y":5.11}, { "x":1396324800000 , "y":5.9}, { "x":1396324800000 , "y":8.0}, { "x":1398916800000 , "y":5.08}, { "x":1398916800000 , "y":4.65}, { "x":1398916800000 , "y":4.74}, { "x":1398916800000 , "y":2.98}, { "x":1401595200000 , "y":6.13}, { "x":1401595200000 , "y":8.98}, { "x":1401595200000 , "y":9.22}, { "x":1401595200000 , "y":5.84}, { "x":1404187200000 , "y":8.12}, { "x":1404187200000 , "y":7.89}, { "x":1404187200000 , "y":8.41}, { "x":1404187200000 , "y":8.47}, { "x":1406865600000 , "y":11.06}, { "x":1406865600000 , "y":11.84}, { "x":1406865600000 , "y":11.92}, { "x":1406865600000 , "y":10.8}, { "x":1409544000000 , "y":14.58}, { "x":1409544000000 , "y":18.39}, { "x":1409544000000 , "y":15.5}, { "x":1409544000000 , "y":18.33}, { "x":1412136000000 , "y":18.01}, { "x":1412136000000 , "y":21.3}, { "x":1412136000000 , "y":21.11}, { "x":1412136000000 , "y":18.37}, { "x":1414814400000 , "y":18.59}, { "x":1414814400000 , "y":18.81}, { "x":1414814400000 , "y":17.13}, { "x":1414814400000 , "y":16.92}, { "x":1417410000000 , "y":18.0}, { "x":1417410000000 , "y":15.18}, { "x":1420088400000 , "y":9.16}, { "x":1420088400000 , "y":12.13}, { "x":1420088400000 , "y":11.76}, { "x":1420088400000 , "y":9.31}, { "x":1422766800000 , "y":13.47}, { "x":1422766800000 , "y":13.41}, { "x":1425186000000 , "y":12.2333333333333}, { "x":1425186000000 , "y":12.4} ] }
+];
+
+</script>
+<script src="js/area_chart.min.js"></script>
+</body> </html> \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/bar_chart.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/bar_chart.html
new file mode 100644
index 00000000..0be16ec1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/bar_chart.html
@@ -0,0 +1,95 @@
+<!DOCTYPE html>
+<html>
+<meta http-equiv="content-type" content="text/html; charset=UTF8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge" />
+<link href="../../d3/css/nv.d3.css" rel="stylesheet" type="text/css">
+<style>
+ body {
+ overflow-y:scroll;
+ }
+ text {
+ font: 12px sans-serif;
+ }
+ svg {
+ display: block;
+ }
+ #chart461 svg {
+ height: 420px;
+ width: 700px;
+ min-width: 100px;
+ min-height: 100px;
+ }
+ tr.z-row-over > td.z-row-inner, tr.z-row-over > .z-cell { background-color: rgb(255, 255, 255); }
+.nodatadiv {
+ display: table-cell;
+ width: 700px;
+ height:370px;
+ text-align:center;
+ vertical-align: middle;
+}
+.nodatainner {
+ padding: 10px;
+}
+ </style>
+<body>
+<div align="center"><H3></H3></div><div id="chart461"> <svg></svg> </div>
+<script src="../../d3/js/d3.v3.min.js"></script>
+<script src="../../d3/js/nv.d3.min.js"></script>
+<script src="../../d3/js/tooltip.js"></script>
+<script src="../../d3/js/utils.js"></script>
+<script src="../../d3/js/models/axis.min.js"></script>
+<script src="../../d3/js/models/multiChart.js"></script>
+<script>
+historicalBarChart = [
+ { "type":"bar", "key": "AP_CPU", "yAxis": "1", "values": [{ "x":1388552400000 , "y":10}, { "x":1391230800000 , "y":4}, { "x":1393650000000 , "y":4}, { "x":1396324800000 , "y":12}, { "x":1398916800000 , "y":3.27}, { "x":1401595200000 , "y":6.07}, { "x":1404187200000 , "y":8.93}, { "x":1406865600000 , "y":11.61}, { "x":1409544000000 , "y":18.66}, { "x":1412136000000 , "y":19.04}, { "x":1414814400000 , "y":17.5}, { "x":1417410000000 , "y":15.73}, { "x":1420088400000 , "y":9.62333333333333}, { "x":1422766800000 , "y":14.29}, { "x":1425186000000 , "y":16.1166666666667} ] } ,
+ { "type":"bar", "key": "ROUTER_CPU", "yAxis": "1", "values": [{ "x":1388552400000 , "y":7}, { "x":1391230800000 , "y":7}, { "x":1393650000000 , "y":5}, { "x":1396324800000 , "y":6}, { "x":1398916800000 , "y":5}, { "x":1401595200000 , "y":6}, { "x":1404187200000 , "y":7}, { "x":1406865600000 , "y":7}, { "x":1409544000000 , "y":8.03}, { "x":1412136000000 , "y":9}, { "x":1414814400000 , "y":9}, { "x":1417410000000 , "y":8.78}, { "x":1420088400000 , "y":3.01}, { "x":1422766800000 , "y":2}, { "x":1425186000000 , "y":3.63333333333333} ] } ,
+ { "type":"bar", "key": "SCTP_CPU", "yAxis": "1", "values": [{ "x":1388552400000 , "y":8}, { "x":1391230800000 , "y":10}, { "x":1393650000000 , "y":10}, { "x":1396324800000 , "y":9}, { "x":1398916800000 , "y":9.58}, { "x":1401595200000 , "y":11.83}, { "x":1404187200000 , "y":14.36}, { "x":1406865600000 , "y":15.94}, { "x":1409544000000 , "y":24.55}, { "x":1412136000000 , "y":25.35}, { "x":1414814400000 , "y":23.63}, { "x":1417410000000 , "y":21.43}, { "x":1420088400000 , "y":12.5766666666667}, { "x":1422766800000 , "y":24.4}, { "x":1425186000000 , "y":24.5833333333333} ] } ,
+ { "type":"bar", "key": "DP_CPU", "yAxis": "1", "values": [{ "x":1388552400000 , "y":2}, { "x":1391230800000 , "y":9}, { "x":1393650000000 , "y":4}, { "x":1396324800000 , "y":8}, { "x":1398916800000 , "y":2.98}, { "x":1401595200000 , "y":5.84}, { "x":1404187200000 , "y":8.47}, { "x":1406865600000 , "y":10.8}, { "x":1409544000000 , "y":18.33}, { "x":1412136000000 , "y":18.37}, { "x":1414814400000 , "y":16.92}, { "x":1417410000000 , "y":15.18}, { "x":1420088400000 , "y":9.31}, { "x":1422766800000 , "y":13.41}, { "x":1425186000000 , "y":12.4} ] }
+];
+var chart;
+nv.addGraph(function() {
+ chart = nv.models.multiBarChart()
+ .margin({top: 30, right: 60, bottom: 50, left: 100})
+ .showLegend(true)
+ .reduceXTicks(false)
+ .forceY([0, 34.0])
+ .showControls(true)
+ .stacked(false)
+ .logScale(false)
+ .legendPos('top')
+ .color(d3.scale.category10().range());
+ chart.xAxis
+ .tickValues([1388552400000,1391230800000,1393650000000,1396324800000,1398916800000,1401595200000,1404187200000,1406865600000,1409544000000,1412136000000,1414814400000,1417410000000,1420088400000,1422766800000])
+ .staggerLabels(false)
+ .showMaxMin(false)
+ .rotateLabels(90)
+ .axisLabel('Timestamp')
+ .tickFormat(function(d) {
+ return d3.time.format('%b %y')(new Date(d)) });
+ chart.yAxis
+ .logScale(false)
+ .axisLabel('')
+ .tickFormat(d3.format(',.1f'));
+ d3.select('#chart461 svg')
+ .datum(historicalBarChart)
+ .transition().duration(1000)
+ .call(chart);
+nv.utils.windowResize(chart.update);
+return chart;
+});
+function redraw() {
+ d3.select('#chart461 svg')
+ .datum(historicalBarChart)
+ .transition().duration(500)
+ .call(chart);
+}
+
+ setInterval(function () {
+ redraw();
+ }, 1500)
+if(historicalBarChart.length <= 0 ) {
+ document.getElementById("chart461").innerHTML = "<div id='noData'><b>No Data Available</b></div>";
+ document.getElementById("chart461").className="nodatadiv";
+ document.getElementById("nodata").className="nodatainner";
+}
+</script> </body></html> \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/d3_gauges_demo.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/d3_gauges_demo.html
new file mode 100644
index 00000000..94596e73
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/d3_gauges_demo.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=utf-8">
+ <title>d3.js gauges</title>
+
+ <style>
+
+ body
+ {
+ font: 10px arial;
+ }
+
+ </style>
+
+ <script src="../../d3/js/d3.v3.min.js" charset="utf-8"></script>
+
+
+ <script>
+
+ var dataURL = "data/speedometer2.csv";
+ var gauges = [];
+ var recordLength = 0;
+ var dataset ;
+
+ </script>
+ <script type="text/javascript" src="js/gauges.min.js"></script>
+
+ </head>
+
+ <body onload="initialize()">
+ <span id="Bedminster"></span>
+ <span id="Piscataway"></span>
+ <br/>
+ <span id="Middletown"></span>
+ <span id="Paramus"></span>
+ </body>
+
+</html> \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer2.csv b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer2.csv
new file mode 100644
index 00000000..406143ea
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer2.csv
@@ -0,0 +1,16 @@
+"YEARMONTH","Bedminster","Piscataway","Middletown","Paramus"
+"201401",8.27,4.89,2.36,2.17
+"201402",10.02,4.57,3.15,3.01
+"201403",11.16,5.00,4.27,4.06
+"201404",13.31,5.00,5.35,5.11
+"201405",12.82,5.00,5.01,4.74
+"201406",14.01,6.09,9.17,8.98
+"201407",14.66,7.00,8.84,8.41
+"201408",16.95,7.02,12.22,11.84
+"201409",21.56,8.12,16.09,15.50
+"201410",25.35,9.00,19.04,18.37
+"201411",21.93,9.00,17.61,17.13
+"201412",24.00,9.00,19.00,18.00
+"201501",25.14,2.01,15.19,12.13
+"201502",26.30,2.67,16.95,13.47
+"201503",26.5833333333333,45.63333333333333,16.1166666666667,12.40
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer3.csv b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer3.csv
new file mode 100644
index 00000000..046383e4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer3.csv
@@ -0,0 +1,2 @@
+"YEARMONTH","Bedminster","Piscataway","Middletown","Paramus"
+"201401",8.27,4.89,2.36,2.17 \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/worddata.csv b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/worddata.csv
new file mode 100644
index 00000000..6a74cded
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/worddata.csv
@@ -0,0 +1,22 @@
+text,frequency
+video,100
+Domain 2.0,75
+spectrum,60
+4GLTE,60
+research,50
+UVerse,60
+DirectTV,30
+Iusacell,89
+Gamma,79
+BigData,55
+RCloud,45
+Raptor,20
+SDN,50
+NFV,50
+ASC,70
+AVPN,40
+Web-RTC,68
+MIS,40
+UDNC,30
+3G,30
+2G,10 \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/donut_d3.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/donut_d3.html
new file mode 100644
index 00000000..afcac359
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/donut_d3.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<style>
+
+body {
+ font: 10px sans-serif;
+}
+
+svg {
+ padding: 10px 0 0 10px;
+}
+
+.arc {
+ stroke: #fff;
+}
+
+ .slice text {
+ font-size: 16pt;
+ font-family: Arial;
+ }
+</style>
+<body>
+<script src="../../d3/js/d3.js"></script>
+
+<script>
+
+var radius = 74,
+ padding = 10;
+
+var width = 200,
+ height = 200;
+
+var outerRadius = height / 2 - 20,
+ innerRadius = outerRadius / 3,
+ cornerRadius = 10;
+//var color = d3.scale.ordinal()
+ // .range(["#98abc5", "#8a89a6", "#7b6888", "#6b486b", "#a05d56", "#d0743c", "#ff8c00"]);
+ var color = d3.scale.category10();
+ var dataURL = "data/speedometer3.csv";
+
+
+</script>
+<script src="js/donut.min.js"></script> \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/area_chart.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/area_chart.min.js
new file mode 100644
index 00000000..9b3decb9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/area_chart.min.js
@@ -0,0 +1 @@
+function redrawAreaChart(){d3.select("#areaChart svg").datum(historicalBarChart).call(area_chart)}var area_chart;nv.addGraph(function(){return area_chart=nv.models.stackedAreaChart().showControls(!1).margin({top:30,right:60,bottom:50,left:100}).showLegend(!1).yAxisTooltipFormat(d3.format(",.1f")).x(function(a){return a.x}).y(function(a){return a.y}).color(d3.scale.category10().range()),area_chart.xAxis.axisLabel("").staggerLabels(!1).showMaxMin(!1).rotateLabels(90).tickFormat(function(a){return d3.time.format("%b %y")(new Date(a))}),area_chart.yAxis.axisLabel("").tickFormat(d3.format(",.1f")),d3.select("#areaChart svg").datum(historicalBarChart).call(area_chart),nv.utils.windowResize(area_chart.update),area_chart}),redrawAreaChart(),historicalBarChart.length<=0&&(document.getElementById("areaChart").innerHTML="<div id='noData'><b>No Data Available</b></div>",document.getElementById("areaChart").className="nodatadiv",document.getElementById("nodata").className="nodatainner"); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/donut.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/donut.min.js
new file mode 100644
index 00000000..60c4fd4b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/donut.min.js
@@ -0,0 +1 @@
+function angle(t){var e=90*(t.startAngle+t.endAngle)/Math.PI-90;return e>90?e-180:e}function arcTween(t,e){return function(){d3.select(this).transition().delay(e).attrTween("d",function(e){var r=d3.interpolate(e.outerRadius,t);return function(t){return e.outerRadius=r(t),arc(e)}})}}var arc=d3.svg.arc().padRadius(outerRadius).innerRadius(innerRadius),pie=d3.layout.pie().sort(null).padAngle(.02).value(function(t){return t.performance});d3.csv(dataURL,function(t,e){color.domain(d3.keys(e[0]).filter(function(t){return"YEARMONTH"!==t})),e.forEach(function(t){t.performance=color.domain().map(function(e){return{name:e,performance:+t[e]}})});var r=d3.select("body").append("svg").attr("class","legend").attr("width",radius).attr("height",2*radius).selectAll("g").data(color.domain().slice().reverse()).enter().append("g").attr("transform",function(t,e){return"translate(0,"+20*e+")"});r.append("rect").attr("width",18).attr("height",18).style("fill",color),r.append("text").attr("x",24).attr("y",9).attr("dy",".35em").text(function(t){return t});var a=d3.select("body").append("svg").attr("width",width).attr("height",height).data(e).append("g").attr("transform","translate("+radius+","+height/2+")"),n=a.selectAll("g.slice").data(function(t){return pie(t.performance)}).enter().append("g").attr("class","slice");n.append("path").each(function(t){t.outerRadius=outerRadius-10}).attr("class","arc").attr("d",arc).style("fill",function(t){return color(t.data.name)}).on("mouseover",arcTween(outerRadius,0)).on("mouseout",arcTween(outerRadius-10,150)),n.append("text").attr("dy",".35em").attr("transform",function(t){return t.outerRadius=outerRadius,t.innerRadius=outerRadius/2,"translate("+arc.centroid(t)+")rotate("+angle(t)+")"}).attr("text-anchor","middle").style("fill","white").style("font","bold 12px Arial").text(function(t){return t.value}),a.append("text").attr("dy",".35em").style("text-anchor","middle").text(function(t){return t.YEARMONTH})}); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/gauges.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/gauges.min.js
new file mode 100644
index 00000000..c0fd7484
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/gauges.min.js
@@ -0,0 +1 @@
+function Gauge(t,i){this.placeholderName=t;var n=this;this.configure=function(t){this.config=t,this.config.size=.9*this.config.size,this.config.raduis=.97*this.config.size/2,this.config.cx=this.config.size/2,this.config.cy=this.config.size/2,this.config.min=void 0!=t.min?t.min:0,this.config.max=void 0!=t.max?t.max:100,this.config.range=this.config.max-this.config.min,this.config.majorTicks=t.majorTicks||5,this.config.minorTicks=t.minorTicks||2,this.config.greenColor=t.greenColor||"#109618",this.config.yellowColor=t.yellowColor||"#FF9900",this.config.redColor=t.redColor||"#DC3912",this.config.transitionDuration=t.transitionDuration||500},this.render=function(){this.body=d3.select("#"+this.placeholderName).append("svg:svg").attr("class","gauge").attr("width",this.config.size).attr("height",this.config.size),this.body.append("svg:circle").attr("cx",this.config.cx).attr("cy",this.config.cy).attr("r",this.config.raduis).style("fill","#ccc").style("stroke","#000").style("stroke-width","0.5px"),this.body.append("svg:circle").attr("cx",this.config.cx).attr("cy",this.config.cy).attr("r",.9*this.config.raduis).style("fill","#fff").style("stroke","#e0e0e0").style("stroke-width","2px");for(var t in this.config.greenZones)this.drawBand(this.config.greenZones[t].from,this.config.greenZones[t].to,n.config.greenColor);for(var t in this.config.yellowZones)this.drawBand(this.config.yellowZones[t].from,this.config.yellowZones[t].to,n.config.yellowColor);for(var t in this.config.redZones)this.drawBand(this.config.redZones[t].from,this.config.redZones[t].to,n.config.redColor);if(void 0!=this.config.label){var i=Math.round(this.config.size/12);this.body.append("svg:text").attr("x",this.config.cx).attr("y",this.config.cy/2+i/2).attr("dy",i/2).attr("text-anchor","middle").text(this.config.label).style("font-size",i+"px").style("fill","#333").style("stroke-width","0px")}for(var i=Math.round(this.config.size/16),e=this.config.range/(this.config.majorTicks-1),o=this.config.min;o<=this.config.max;o+=e){for(var a=e/this.config.minorTicks,r=o+a;r<Math.min(o+e,this.config.max);r+=a){var s=this.valueToPoint(r,.75),c=this.valueToPoint(r,.85);this.body.append("svg:line").attr("x1",s.x).attr("y1",s.y).attr("x2",c.x).attr("y2",c.y).style("stroke","#666").style("stroke-width","1px")}var s=this.valueToPoint(o,.7),c=this.valueToPoint(o,.85);if(this.body.append("svg:line").attr("x1",s.x).attr("y1",s.y).attr("x2",c.x).attr("y2",c.y).style("stroke","#333").style("stroke-width","2px"),o==this.config.min||o==this.config.max){var g=this.valueToPoint(o,.63);this.body.append("svg:text").attr("x",g.x).attr("y",g.y).attr("dy",i/3).attr("text-anchor",o==this.config.min?"start":"end").text(o).style("font-size",i+"px").style("fill","#333").style("stroke-width","0px")}}var f=this.body.append("svg:g").attr("class","pointerContainer"),h=(this.config.min+this.config.max)/2,l=this.buildPointerPath(h),d=d3.svg.line().x(function(t){return t.x}).y(function(t){return t.y}).interpolate("basis");f.selectAll("path").data([l]).enter().append("svg:path").attr("d",d).style("fill","#dc3912").style("stroke","#c63310").style("fill-opacity",.7),f.append("svg:circle").attr("cx",this.config.cx).attr("cy",this.config.cy).attr("r",.12*this.config.raduis).style("fill","#4684EE").style("stroke","#666").style("opacity",1);var i=Math.round(this.config.size/10);f.selectAll("text").data([h]).enter().append("svg:text").attr("x",this.config.cx).attr("y",this.config.size-this.config.cy/4-i).attr("dy",i/2).attr("text-anchor","middle").style("font-size",i+"px").style("fill","#000").style("stroke-width","0px"),this.redraw(this.config.min,0)},this.buildPointerPath=function(t){function i(t,i){var e=n.valueToPoint(t,i);return e.x-=n.config.cx,e.y-=n.config.cy,e}var e=this.config.range/13,o=i(t,.85),a=i(t-e,.12),r=i(t+e,.12),s=t-this.config.range*(1/.75)/2,c=i(s,.28),g=i(s-e,.12),f=i(s+e,.12);return[o,a,f,c,g,r,o]},this.drawBand=function(t,i,e){0>=i-t||this.body.append("svg:path").style("fill",e).attr("d",d3.svg.arc().startAngle(this.valueToRadians(t)).endAngle(this.valueToRadians(i)).innerRadius(.65*this.config.raduis).outerRadius(.85*this.config.raduis)).attr("transform",function(){return"translate("+n.config.cx+", "+n.config.cy+") rotate(270)"})},this.redraw=function(t,i,e){var o=this.body.select(".pointerContainer"),a=o.selectAll("text");y=a.attr("y"),dy=parseFloat(a.attr("dy")),a.selectAll("tspan").remove(),a.append("tspan").attr("x",45).attr("dy",0).text(Math.round(t)),a.append("tspan").attr("x",45).attr("dy",10).text(i),o.selectAll("text").style("fill",function(){var i=n.config.max-n.config.min;return Math.round(t)>.9*i?"#DC3912":Math.round(t)>.5*i&&Math.round(t)<.9*i?"#FF9900":"#000000"});var r=o.selectAll("path");r.transition().duration(void 0!=e?e:this.config.transitionDuration).attrTween("transform",function(){var i=t;t>n.config.max?i=n.config.max+.02*n.config.range:t<n.config.min&&(i=n.config.min-.02*n.config.range);var e=n.valueToDegrees(i)-90,o=n._currentRotation||e;return n._currentRotation=e,function(t){var i=o+(e-o)*t;return"translate("+n.config.cx+", "+n.config.cy+") rotate("+i+")"}})},this.valueToDegrees=function(t){return t/this.config.range*270-(this.config.min/this.config.range*270+45)},this.valueToRadians=function(t){return this.valueToDegrees(t)*Math.PI/180},this.valueToPoint=function(t,i){return{x:this.config.cx-this.config.raduis*i*Math.cos(this.valueToRadians(t)),y:this.config.cy-this.config.raduis*i*Math.sin(this.valueToRadians(t))}},this.configure(i)}function createGauge(t,i,n,e){var o={size:100,label:i,min:void 0!=n?n:0,max:void 0!=e?e:100,minorTicks:5},a=o.max-o.min;o.yellowZones=[{from:o.min+.5*a,to:o.min+.9*a}],o.redZones=[{from:o.min+.9*a,to:o.max}],gauges[t]=new Gauge(t,o),gauges[t].render()}function createGauges(){createGauge("Bedminster","Bedminster",0,50),createGauge("Piscataway","Piscataway",0,50),createGauge("Middletown","Middletown",0,50),createGauge("Paramus","Paramus",0,50)}function updateGauges(t){for(var i in gauges){var n=getValue(i,t),e=getDate1(i,t);n&&gauges[i].redraw(n,e,100)}}function getValue(gauge_id,index){var d=dataset[index];return eval("d."+gauge_id)}function getDate1(t,i){var n=dataset[i];return n.YEARMONTH}function getROUTER_CPU_Value(t){d3.csv(dataURL,function(i){i.forEach(function(i,n){return n==t?i.ROUTER_CPU:void 0})})}function getAP_CPU_Value(t){d3.csv(dataURL,function(i){i.forEach(function(i,n){return n==t?i.AP_CPU:void 0})})}function updateData(){for(var t=0;t<recordLength;t++);}function initialize(){createGauges(),d3.csv(dataURL,function(t){dataset=t,recordLength=t.length,dataset.some(function(t,i){return 1==i?(updateGauges(i),1==i):void 0});var i=1e3,n=2,e=function(){return function(){return updateGauges(n++),n<recordLength?(d3.timer(e(),i),!0):(n=0,d3.timer(e(),i),!0)}};d3.timer(e(),i)})} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/line_chart.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/line_chart.min.js
new file mode 100644
index 00000000..e501260b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/line_chart.min.js
@@ -0,0 +1 @@
+function redrawLineChart(){d3.select("#lineChart svg").datum(historicalBarChart).call(line_chart)}var line_chart;nv.addGraph(function(){return line_chart=nv.models.multiChart().dualaxis(!1).legendPos("top").margin({top:30,right:60,bottom:50,left:100}).showLegend(!1).color(d3.scale.category10().range()),line_chart.lines1.forceY([0,34]),line_chart.lines2.forceY([0,1]),line_chart.xAxis.axisLabel("").staggerLabels(!1).showMaxMin(!1).rotateLabels(90).tickFormat(function(a){return d3.time.format("%b %y")(new Date(a))}),line_chart.yAxis1.axisLabel("").tickFormat(d3.format(",.1f")),d3.select("#lineChart svg").datum(historicalBarChart).call(line_chart),nv.utils.windowResize(line_chart.update),line_chart}),redrawLineChart(),historicalBarChart.length<=0&&(document.getElementById("lineChart").innerHTML="<div id='noData2'><b>No Data Available</b></div>",document.getElementById("lineChart").className="nodatadiv",document.getElementById("nodata2").className="nodatainner"); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/pie_chart.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/pie_chart.min.js
new file mode 100644
index 00000000..f78eec70
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/pie_chart.min.js
@@ -0,0 +1 @@
+function redraw(){d3.select("#chart423 svg").datum(historicalBarChart).transition().duration(500).call(chart)}var chart;nv.addGraph(function(){return chart=nv.models.pieChart().margin({top:30,right:60,bottom:50,left:100}).x(function(t){return t.key}).y(function(t){return t.y}),chart.showLegend(!1),d3.select("#chart423 svg").datum(historicalBarChart).transition().duration(1200).call(chart),nv.utils.windowResize(chart.update),chart}),setInterval(function(){redraw()},1500),historicalBarChart.length<=0&&(document.getElementById("chart423").innerHTML="<div id='noData'><b>No Data Available</b></div>",document.getElementById("chart423").className="nodatadiv",document.getElementById("nodata").className="nodatainner"); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/worddata.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/worddata.min.js
new file mode 100644
index 00000000..6b827460
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/worddata.min.js
@@ -0,0 +1 @@
+function dataViz(t){function e(t){var e=d3.select("svg").append("g").attr("id","wordCloudG").attr("transform","translate(210,175)");e.selectAll("text").data(t).enter().append("text").style("font-size",function(t){return 1*t.size+"px"}).style("fill",function(t){return keywords.indexOf(t.text)>-1?"red":"black"}).style("opacity",.75).attr("text-anchor","middle").attr("transform",function(t){return"translate("+[t.x,t.y]+")rotate("+t.rotate+")"}).text(function(t){return t.text})}d3.layout.cloud().size([420,350]).words(t).rotate(function(t){return t.text.length>5?0:90}).fontSize(function(t){return wordScale(t.frequency)}).on("end",e).start()}d3.csv(dataURL,function(t){dataViz(t)}),wordScale=d3.scale.linear().domain([0,100]).range([0,70]).clamp(!0); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/line_chart.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/line_chart.html
new file mode 100644
index 00000000..d4ba57a4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/line_chart.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<meta http-equiv="content-type" content="text/html; charset=UTF8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge" />
+<link href="../../d3/css/nv.d3.css" rel="stylesheet" type="text/css">
+<style>
+ body {
+ overflow-y:scroll;
+ }
+ text {
+ font: 12px sans-serif;
+ }
+ svg {
+ display: block;
+ }
+ #chart461 svg {
+ height: 175px;
+ width: 300px;
+ min-width: 100px;
+ min-height: 100px;
+ }
+ tr.z-row-over > td.z-row-inner, tr.z-row-over > .z-cell { background-color: rgb(255, 255, 255); }
+.nodatadiv {
+ display: table-cell;
+ width: 700px;
+ height:370px;
+ text-align:center;
+ vertical-align: middle;
+}
+.nodatainner {
+ padding: 10px;
+}
+ </style>
+<body>
+<div align="center"><H3></H3></div><div id="chart461"> <svg></svg> </div>
+<script src="../../d3/js/d3.v3.min.js"></script>
+<script src="../../d3/js/nv.d3.min.js"></script>
+<script src="../../d3/js/models/axis.min.js"></script>
+<script>
+historicalBarChart = [
+ { "type":"line", "key": "AP_CPU", "yAxis": "1","values": [{ "x":1388552400000 , "y":2.13}, { "x":1388552400000 , "y":5.0}, { "x":1388552400000 , "y":2.36}, { "x":1388552400000 , "y":10.0}, { "x":1391230800000 , "y":3.15}, { "x":1391230800000 , "y":2.88}, { "x":1391230800000 , "y":3.0}, { "x":1391230800000 , "y":4.0}, { "x":1393650000000 , "y":8.0}, { "x":1393650000000 , "y":3.93}, { "x":1393650000000 , "y":4.27}, { "x":1393650000000 , "y":4.0}, { "x":1396324800000 , "y":4.25}, { "x":1396324800000 , "y":5.35}, { "x":1396324800000 , "y":5.92}, { "x":1396324800000 , "y":12.0}, { "x":1398916800000 , "y":5.55}, { "x":1398916800000 , "y":4.89}, { "x":1398916800000 , "y":5.01}, { "x":1398916800000 , "y":3.27}, { "x":1401595200000 , "y":6.27}, { "x":1401595200000 , "y":9.17}, { "x":1401595200000 , "y":9.31}, { "x":1401595200000 , "y":6.07}, { "x":1404187200000 , "y":8.37}, { "x":1404187200000 , "y":8.11}, { "x":1404187200000 , "y":8.84}, { "x":1404187200000 , "y":8.93}, { "x":1406865600000 , "y":11.79}, { "x":1406865600000 , "y":12.22}, { "x":1406865600000 , "y":12.6}, { "x":1406865600000 , "y":11.61}, { "x":1409544000000 , "y":15.27}, { "x":1409544000000 , "y":19.09}, { "x":1409544000000 , "y":16.09}, { "x":1409544000000 , "y":18.66}, { "x":1412136000000 , "y":18.4}, { "x":1412136000000 , "y":22.05}, { "x":1412136000000 , "y":21.66}, { "x":1412136000000 , "y":19.04}, { "x":1414814400000 , "y":19.13}, { "x":1414814400000 , "y":19.61}, { "x":1414814400000 , "y":17.61}, { "x":1414814400000 , "y":17.5}, { "x":1417410000000 , "y":19.0}, { "x":1417410000000 , "y":15.73}, { "x":1420088400000 , "y":9.67}, { "x":1420088400000 , "y":15.19}, { "x":1420088400000 , "y":15.02}, { "x":1420088400000 , "y":9.62333333333333}, { "x":1422766800000 , "y":16.95}, { "x":1422766800000 , "y":14.29}, { "x":1425186000000 , "y":12.9}, { "x":1425186000000 , "y":16.1166666666667} ] } ,
+ { "type":"line", "key": "ROUTER_CPU", "yAxis": "1","values": [{ "x":1388552400000 , "y":3.0}, { "x":1388552400000 , "y":4.0}, { "x":1388552400000 , "y":4.89}, { "x":1388552400000 , "y":7.0}, { "x":1391230800000 , "y":4.57}, { "x":1391230800000 , "y":4.0}, { "x":1391230800000 , "y":4.0}, { "x":1391230800000 , "y":7.0}, { "x":1393650000000 , "y":7.0}, { "x":1393650000000 , "y":4.18}, { "x":1393650000000 , "y":5.0}, { "x":1393650000000 , "y":5.0}, { "x":1396324800000 , "y":5.0}, { "x":1396324800000 , "y":5.0}, { "x":1396324800000 , "y":5.06}, { "x":1396324800000 , "y":6.0}, { "x":1398916800000 , "y":5.0}, { "x":1398916800000 , "y":5.0}, { "x":1398916800000 , "y":5.0}, { "x":1398916800000 , "y":5.0}, { "x":1401595200000 , "y":6.0}, { "x":1401595200000 , "y":6.09}, { "x":1401595200000 , "y":6.0}, { "x":1401595200000 , "y":6.0}, { "x":1404187200000 , "y":6.36}, { "x":1404187200000 , "y":7.0}, { "x":1404187200000 , "y":7.0}, { "x":1404187200000 , "y":7.0}, { "x":1406865600000 , "y":7.0}, { "x":1406865600000 , "y":7.02}, { "x":1406865600000 , "y":7.24}, { "x":1406865600000 , "y":7.0}, { "x":1409544000000 , "y":8.23}, { "x":1409544000000 , "y":8.11}, { "x":1409544000000 , "y":8.12}, { "x":1409544000000 , "y":8.03}, { "x":1412136000000 , "y":9.0}, { "x":1412136000000 , "y":8.93}, { "x":1412136000000 , "y":8.57}, { "x":1412136000000 , "y":9.0}, { "x":1414814400000 , "y":5.97}, { "x":1414814400000 , "y":6.0}, { "x":1414814400000 , "y":9.0}, { "x":1414814400000 , "y":9.0}, { "x":1417410000000 , "y":9.0}, { "x":1417410000000 , "y":8.78}, { "x":1420088400000 , "y":3.0}, { "x":1420088400000 , "y":2.01}, { "x":1420088400000 , "y":3.0}, { "x":1420088400000 , "y":3.01}, { "x":1422766800000 , "y":2.67}, { "x":1422766800000 , "y":2.0}, { "x":1425186000000 , "y":2.8}, { "x":1425186000000 , "y":3.63333333333333} ] } ,
+ { "type":"line", "key": "SCTP_CPU", "yAxis": "1","values": [{ "x":1388552400000 , "y":7.0}, { "x":1388552400000 , "y":10.0}, { "x":1388552400000 , "y":8.27}, { "x":1388552400000 , "y":8.0}, { "x":1391230800000 , "y":10.02}, { "x":1391230800000 , "y":8.04}, { "x":1391230800000 , "y":9.0}, { "x":1391230800000 , "y":10.0}, { "x":1393650000000 , "y":12.0}, { "x":1393650000000 , "y":10.04}, { "x":1393650000000 , "y":11.16}, { "x":1393650000000 , "y":10.0}, { "x":1396324800000 , "y":10.7}, { "x":1396324800000 , "y":13.31}, { "x":1396324800000 , "y":12.73}, { "x":1396324800000 , "y":9.0}, { "x":1398916800000 , "y":12.41}, { "x":1398916800000 , "y":11.95}, { "x":1398916800000 , "y":12.82}, { "x":1398916800000 , "y":9.58}, { "x":1401595200000 , "y":11.28}, { "x":1401595200000 , "y":14.01}, { "x":1401595200000 , "y":14.63}, { "x":1401595200000 , "y":11.83}, { "x":1404187200000 , "y":14.06}, { "x":1404187200000 , "y":13.96}, { "x":1404187200000 , "y":14.66}, { "x":1404187200000 , "y":14.36}, { "x":1406865600000 , "y":16.6}, { "x":1406865600000 , "y":16.95}, { "x":1406865600000 , "y":17.11}, { "x":1406865600000 , "y":15.94}, { "x":1409544000000 , "y":19.86}, { "x":1409544000000 , "y":22.97}, { "x":1409544000000 , "y":21.56}, { "x":1409544000000 , "y":24.55}, { "x":1412136000000 , "y":22.66}, { "x":1412136000000 , "y":26.79}, { "x":1412136000000 , "y":26.54}, { "x":1412136000000 , "y":25.35}, { "x":1414814400000 , "y":21.0}, { "x":1414814400000 , "y":20.35}, { "x":1414814400000 , "y":21.93}, { "x":1414814400000 , "y":23.63}, { "x":1417410000000 , "y":24.0}, { "x":1417410000000 , "y":21.43}, { "x":1420088400000 , "y":12.63}, { "x":1420088400000 , "y":25.14}, { "x":1420088400000 , "y":21.85}, { "x":1420088400000 , "y":12.5766666666667}, { "x":1422766800000 , "y":26.3}, { "x":1422766800000 , "y":24.4}, { "x":1425186000000 , "y":23.3833333333333}, { "x":1425186000000 , "y":24.5833333333333} ] } ,
+ { "type":"line", "key": "DP_CPU", "yAxis": "1","values": [{ "x":1388552400000 , "y":2.0}, { "x":1388552400000 , "y":5.0}, { "x":1388552400000 , "y":2.17}, { "x":1388552400000 , "y":2.0}, { "x":1391230800000 , "y":3.01}, { "x":1391230800000 , "y":2.56}, { "x":1391230800000 , "y":3.0}, { "x":1391230800000 , "y":9.0}, { "x":1393650000000 , "y":10.0}, { "x":1393650000000 , "y":3.64}, { "x":1393650000000 , "y":4.06}, { "x":1393650000000 , "y":4.0}, { "x":1396324800000 , "y":4.04}, { "x":1396324800000 , "y":5.11}, { "x":1396324800000 , "y":5.9}, { "x":1396324800000 , "y":8.0}, { "x":1398916800000 , "y":5.08}, { "x":1398916800000 , "y":4.65}, { "x":1398916800000 , "y":4.74}, { "x":1398916800000 , "y":2.98}, { "x":1401595200000 , "y":6.13}, { "x":1401595200000 , "y":8.98}, { "x":1401595200000 , "y":9.22}, { "x":1401595200000 , "y":5.84}, { "x":1404187200000 , "y":8.12}, { "x":1404187200000 , "y":7.89}, { "x":1404187200000 , "y":8.41}, { "x":1404187200000 , "y":8.47}, { "x":1406865600000 , "y":11.06}, { "x":1406865600000 , "y":11.84}, { "x":1406865600000 , "y":11.92}, { "x":1406865600000 , "y":10.8}, { "x":1409544000000 , "y":14.58}, { "x":1409544000000 , "y":18.39}, { "x":1409544000000 , "y":15.5}, { "x":1409544000000 , "y":18.33}, { "x":1412136000000 , "y":18.01}, { "x":1412136000000 , "y":21.3}, { "x":1412136000000 , "y":21.11}, { "x":1412136000000 , "y":18.37}, { "x":1414814400000 , "y":18.59}, { "x":1414814400000 , "y":18.81}, { "x":1414814400000 , "y":17.13}, { "x":1414814400000 , "y":16.92}, { "x":1417410000000 , "y":18.0}, { "x":1417410000000 , "y":15.18}, { "x":1420088400000 , "y":9.16}, { "x":1420088400000 , "y":12.13}, { "x":1420088400000 , "y":11.76}, { "x":1420088400000 , "y":9.31}, { "x":1422766800000 , "y":13.47}, { "x":1422766800000 , "y":13.41}, { "x":1425186000000 , "y":12.2333333333333}, { "x":1425186000000 , "y":12.4} ] }
+];
+
+</script>
+<script src="js/line_chart.min.js"></script>
+</body> </html> \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/pie_chart.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/pie_chart.html
new file mode 100644
index 00000000..ebbdd9c0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/pie_chart.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<meta http-equiv="content-type" content="text/html; charset=UTF8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge" />
+<link href="../../d3/css/nv.d3.css" rel="stylesheet" type="text/css">
+<style>
+ body {
+ overflow-y:scroll;
+ }
+ text {
+ font: 12px sans-serif;
+ }
+ tr.z-row-over > td.z-row-inner, tr.z-row-over > .z-cell { background-color: rgb(255, 255, 255); } svg { display: block; } #chart423 svg {
+ height: 275px;
+ width: 300px;
+ min-width: 100px;
+ min-height: 100px;
+ }
+ </style>
+<body>
+<div id="chart423"><svg></svg></div>
+<script src="../../d3/js/d3.v3.min.js"></script>
+<script src="../../d3/js/nv.d3.min.js"></script>
+<script src="../../d3/js/models/legend.js"></script>
+<script src="../../d3/js/models/pie.js"></script>
+<script src="../../d3/js/models/pieChart.js"></script>
+<script src="../../d3/js/utils.js"></script>
+<script>
+historicalBarChart = [
+{ "key":"Bedminster", "y":8.27},
+{ "key":"Middletown", "y":2.36},
+{ "key":"Paramus", "y":2.17},
+{ "key":"Piscataway", "y":4.89}
+];
+
+</script>
+<script src="js/pie_chart.min.js"></script>
+</body> </html> \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/wordcloud.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/wordcloud.html
new file mode 100644
index 00000000..d9fc53fb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/wordcloud.html
@@ -0,0 +1,37 @@
+<html>
+<head>
+ <title>Word Cloud Example</title>
+ <meta charset="utf-8" />
+<script src="../../d3/js/d3.v3.min.js" type="text/JavaScript"></script>
+<script src="../../d3/js/colorbrewer.js" type="text/JavaScript"></script>
+<script src="../../d3/js/d3.layout.cloud.js" type="text/JavaScript"></script>
+
+</head>
+<style>
+ svg {
+ height: 350px;
+ width: 420px;
+ border: 1px solid gray;
+ }
+
+</style>
+<body>
+
+<div id="viz">
+ <svg>
+ </svg>
+</div>
+<div id="controls" />
+</body>
+ <footer>
+
+<script>
+var cloudSize = 200;
+var dataURL = "data/worddata.csv";
+var keywords = ["video", "raptor", "4GLTE", "style", "append", "attr"];
+
+</script>
+<script src="js/worddata.min.js" type="text/JavaScript"></script>
+ </footer>
+
+</html> \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/Calendar-16x16.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/Calendar-16x16.png
new file mode 100644
index 00000000..ac970bda
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/Calendar-16x16.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-next.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-next.png
new file mode 100644
index 00000000..1a4f72c6
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-next.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-prev.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-prev.png
new file mode 100644
index 00000000..8211eba1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-prev.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_drive_test_map.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_drive_test_map.png
new file mode 100644
index 00000000..78a8873b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_drive_test_map.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_county.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_county.png
new file mode 100644
index 00000000..df471d7d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_county.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_regression.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_regression.png
new file mode 100644
index 00000000..e59fc189
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_regression.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_ios_throughput.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_ios_throughput.png
new file mode 100644
index 00000000..76a2d2b7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_ios_throughput.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map.png
new file mode 100644
index 00000000..174ef9b8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map_legend.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map_legend.png
new file mode 100644
index 00000000..f7f2719a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map_legend.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_nova_sdn_map.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_nova_sdn_map.png
new file mode 100644
index 00000000..ee0ddef9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_nova_sdn_map.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/copyicon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/copyicon.png
new file mode 100644
index 00000000..6c1c3c15
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/copyicon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/deleteicon.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/deleteicon.gif
new file mode 100644
index 00000000..4b07af82
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/deleteicon.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/example-frame.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/example-frame.png
new file mode 100644
index 00000000..31f2fe1c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/example-frame.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/loading.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/loading.gif
new file mode 100644
index 00000000..cccb0fc9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/loading.gif
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/1_mon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/1_mon.png
new file mode 100644
index 00000000..d46eee50
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/1_mon.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/2_tue.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/2_tue.png
new file mode 100644
index 00000000..ed82aad3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/2_tue.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/3_wed.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/3_wed.png
new file mode 100644
index 00000000..8f8c0328
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/3_wed.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/4_thu.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/4_thu.png
new file mode 100644
index 00000000..750dca5d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/4_thu.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/5_fri.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/5_fri.png
new file mode 100644
index 00000000..599e51f1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/5_fri.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/6_sat.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/6_sat.png
new file mode 100644
index 00000000..70323ea0
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/6_sat.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/7_sun.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/7_sun.png
new file mode 100644
index 00000000..9d579d68
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/7_sun.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_IN.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_IN.png
new file mode 100644
index 00000000..af1ac0a7
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_IN.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_OUT.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_OUT.png
new file mode 100644
index 00000000..935b5386
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_OUT.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat.png
new file mode 100644
index 00000000..916a655f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Def.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Def.png
new file mode 100644
index 00000000..a8b516d9
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Def.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Priority.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Priority.png
new file mode 100644
index 00000000..2cf81411
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Priority.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/FusionCharts.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/FusionCharts.js
new file mode 100644
index 00000000..4c174dfa
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/FusionCharts.js
@@ -0,0 +1,361 @@
+/**
+ * FusionCharts: Flash Player detection and Chart embedding.
+ * Version 1.2.3F ( 22 November 2008) - Specialized for FusionChartsFREE
+ * Checking Flash Version >=6 and added updateChartXML() for FREE Charts.
+ * Version: 1.2.3 (1st September, 2008) - Added Fix for % and & characters, scaled dimensions, fixes in to properly handling of double quotes and single quotes in setDataXML() function.
+ * Version: 1.2.2 (10th July, 2008) - Added Fix for % scaled dimensions, fixes in setDataXML() and setDataURL() functions
+ * Version: 1.2.1 (21st December, 2007) - Added setting up Transparent/opaque mode: setTransparent() function
+ * Version: 1.2 (1st November, 2007) - Added FORM fixes for IE
+ * Version: 1.1 (29th June, 2007) - Added Player detection, New conditional fixes for IE
+ *
+ * Morphed from SWFObject (http://blog.deconcept.com/swfobject/) under MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ */
+if(typeof infosoftglobal == "undefined") var infosoftglobal = new Object();
+if(typeof infosoftglobal.FusionChartsUtil == "undefined") infosoftglobal.FusionChartsUtil = new Object();
+infosoftglobal.FusionCharts = function(swf, id, w, h, debugMode, registerWithJS, c, scaleMode, lang, detectFlashVersion, autoInstallRedirect){
+ if (!document.getElementById) { return; }
+
+ //Flag to see whether data has been set initially
+ this.initialDataSet = false;
+
+ //Create container objects
+ this.params = new Object();
+ this.variables = new Object();
+ this.attributes = new Array();
+
+ //Set attributes for the SWF
+ if(swf) { this.setAttribute('swf', swf); }
+ if(id) { this.setAttribute('id', id); }
+
+ w=w.toString().replace(/\%$/,"%25");
+ if(w) { this.setAttribute('width', w); }
+ h=h.toString().replace(/\%$/,"%25");
+ if(h) { this.setAttribute('height', h); }
+
+
+ //Set background color
+ if(c) { this.addParam('bgcolor', c); }
+
+ //Set Quality
+ this.addParam('quality', 'high');
+
+ //Add scripting access parameter
+ this.addParam('allowScriptAccess', 'always');
+
+ //Pass width and height to be appended as chartWidth and chartHeight
+ this.addVariable('chartWidth', w);
+ this.addVariable('chartHeight', h);
+
+ //Whether in debug mode
+ debugMode = debugMode ? debugMode : 0;
+ this.addVariable('debugMode', debugMode);
+ //Pass DOM ID to Chart
+ this.addVariable('DOMId', id);
+ //Whether to registed with JavaScript
+ registerWithJS = registerWithJS ? registerWithJS : 0;
+ this.addVariable('registerWithJS', registerWithJS);
+
+ //Scale Mode of chart
+ scaleMode = scaleMode ? scaleMode : 'noScale';
+ this.addVariable('scaleMode', scaleMode);
+
+ //Application Message Language
+ lang = lang ? lang : 'EN';
+ this.addVariable('lang', lang);
+
+ //Whether to auto detect and re-direct to Flash Player installation
+ this.detectFlashVersion = detectFlashVersion?detectFlashVersion:1;
+ this.autoInstallRedirect = autoInstallRedirect?autoInstallRedirect:1;
+
+ //Ger Flash Player version
+ this.installedVer = infosoftglobal.FusionChartsUtil.getPlayerVersion();
+
+ if (!window.opera && document.all && this.installedVer.major > 7) {
+ // Only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
+ infosoftglobal.FusionCharts.doPrepUnload = true;
+ }
+}
+
+infosoftglobal.FusionCharts.prototype = {
+ setAttribute: function(name, value){
+ this.attributes[name] = value;
+ },
+ getAttribute: function(name){
+ return this.attributes[name];
+ },
+ addParam: function(name, value){
+ this.params[name] = value;
+ },
+ getParams: function(){
+ return this.params;
+ },
+ addVariable: function(name, value){
+ this.variables[name] = value;
+ },
+ getVariable: function(name){
+ return this.variables[name];
+ },
+ getVariables: function(){
+ return this.variables;
+ },
+ getVariablePairs: function(){
+ var variablePairs = new Array();
+ var key;
+ var variables = this.getVariables();
+ for(key in variables){
+ variablePairs.push(key +"="+ variables[key]);
+ }
+ return variablePairs;
+ },
+ getSWFHTML: function() {
+ var swfNode = "";
+ if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
+ // netscape plugin architecture
+ swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" ';
+ swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
+ var params = this.getParams();
+ for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
+ var pairs = this.getVariablePairs().join("&");
+ if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
+ swfNode += '/>';
+ } else { // PC IE
+ swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
+ swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
+ var params = this.getParams();
+ for(var key in params) {
+ swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
+ }
+ var pairs = this.getVariablePairs().join("&");
+ if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
+ swfNode += "</object>";
+ }
+ return swfNode;
+ },
+ setDataURL: function(strDataURL){
+ //This method sets the data URL for the chart.
+ //If being set initially
+ if (this.initialDataSet==false){
+ this.addVariable('dataURL',strDataURL);
+ //Update flag
+ this.initialDataSet = true;
+ }else{
+ //Else, we update the chart data using External Interface
+ //Get reference to chart object
+ var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));
+
+ if (!chartObj.setDataURL)
+ {
+ __flash__addCallback(chartObj, "setDataURL");
+ }
+
+ chartObj.setDataURL(strDataURL);
+ }
+ },
+ //This function :
+ //fixes the double quoted attributes to single quotes
+ //Encodes all quotes inside attribute values
+ //Encodes % to %25 and & to %26;
+ encodeDataXML: function(strDataXML){
+
+ var regExpReservedCharacters=["\\$","\\+"];
+ var arrDQAtt=strDataXML.match(/=\s*\".*?\"/g);
+ if (arrDQAtt){
+ for(var i=0;i<arrDQAtt.length;i++){
+ var repStr=arrDQAtt[i].replace(/^=\s*\"|\"$/g,"");
+ repStr=repStr.replace(/\'/g,"%26apos;");
+ var strTo=strDataXML.indexOf(arrDQAtt[i]);
+ var repStrr="='"+repStr+"'";
+ var strStart=strDataXML.substring(0,strTo);
+ var strEnd=strDataXML.substring(strTo+arrDQAtt[i].length);
+ var strDataXML=strStart+repStrr+strEnd;
+ }
+ }
+
+ strDataXML=strDataXML.replace(/\"/g,"%26quot;");
+ strDataXML=strDataXML.replace(/%(?![\da-f]{2}|[\da-f]{4})/ig,"%25");
+ strDataXML=strDataXML.replace(/\&/g,"%26");
+
+ return strDataXML;
+
+ },
+ setDataXML: function(strDataXML){
+ //If being set initially
+ if (this.initialDataSet==false){
+ //This method sets the data XML for the chart INITIALLY.
+ this.addVariable('dataXML',this.encodeDataXML(strDataXML));
+ //Update flag
+ this.initialDataSet = true;
+ }else{
+ //Else, we update the chart data using External Interface
+ //Get reference to chart object
+ var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));
+ chartObj.setDataXML(strDataXML);
+ }
+ },
+ setTransparent: function(isTransparent){
+ //Sets chart to transparent mode when isTransparent is true (default)
+ //When no parameter is passed, we assume transparent to be true.
+ if(typeof isTransparent=="undefined") {
+ isTransparent=true;
+ }
+ //Set the property
+ if(isTransparent)
+ this.addParam('WMode', 'transparent');
+ else
+ this.addParam('WMode', 'Opaque');
+ },
+
+ render: function(elementId){
+ //First check for installed version of Flash Player - we need a minimum of 6
+ if((this.detectFlashVersion==1) && (this.installedVer.major < 6)){
+ if (this.autoInstallRedirect==1){
+ //If we can auto redirect to install the player?
+ var installationConfirm = window.confirm("You need Adobe Flash Player 6 (or above) to view the charts. It is a free and lightweight installation from Adobe.com. Please click on Ok to install the same.");
+ if (installationConfirm){
+ window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
+ }else{
+ return false;
+ }
+ }else{
+ //Else, do not take an action. It means the developer has specified a message in the DIV (and probably a link).
+ //So, expect the developers to provide a course of way to their end users.
+ //window.alert("You need Adobe Flash Player 8 (or above) to view the charts. It is a free and lightweight installation from Adobe.com. ");
+ return false;
+ }
+ }else{
+ //Render the chart
+ var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
+ n.innerHTML = this.getSWFHTML();
+
+ //Added <FORM> compatibility
+ //Check if it's added in Mozilla embed array or if already exits
+ if(!document.embeds[this.getAttribute('id')] && !window[this.getAttribute('id')])
+ window[this.getAttribute('id')]=document.getElementById(this.getAttribute('id'));
+ //or else document.forms[formName/formIndex][chartId]
+ return true;
+ }
+ }
+}
+
+/* ---- detection functions ---- */
+infosoftglobal.FusionChartsUtil.getPlayerVersion = function(){
+ var PlayerVersion = new infosoftglobal.PlayerVersion([0,0,0]);
+ if(navigator.plugins && navigator.mimeTypes.length){
+ var x = navigator.plugins["Shockwave Flash"];
+ if(x && x.description) {
+ PlayerVersion = new infosoftglobal.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
+ }
+ }else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){
+ //If Windows CE
+ var axo = 1;
+ var counter = 3;
+ while(axo) {
+ try {
+ counter++;
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
+ PlayerVersion = new infosoftglobal.PlayerVersion([counter,0,0]);
+ } catch (e) {
+ axo = null;
+ }
+ }
+ } else {
+ // Win IE (non mobile)
+ // Do minor version lookup in IE, but avoid Flash Player 6 crashing issues
+ try{
+ var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
+ }catch(e){
+ try {
+ var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
+ PlayerVersion = new infosoftglobal.PlayerVersion([6,0,21]);
+ axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
+ } catch(e) {
+ if (PlayerVersion.major == 6) {
+ return PlayerVersion;
+ }
+ }
+ try {
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
+ } catch(e) {}
+ }
+ if (axo != null) {
+ PlayerVersion = new infosoftglobal.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
+ }
+ }
+ return PlayerVersion;
+}
+infosoftglobal.PlayerVersion = function(arrVersion){
+ this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
+ this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
+ this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
+}
+// ------------ Fix for Out of Memory Bug in IE in FP9 ---------------//
+/* Fix for video streaming bug */
+infosoftglobal.FusionChartsUtil.cleanupSWFs = function() {
+ var objects = document.getElementsByTagName("OBJECT");
+ for (var i = objects.length - 1; i >= 0; i--) {
+ objects[i].style.display = 'none';
+ for (var x in objects[i]) {
+ if (typeof objects[i][x] == 'function') {
+ objects[i][x] = function(){};
+ }
+ }
+ }
+}
+// Fixes bug in fp9
+if (infosoftglobal.FusionCharts.doPrepUnload) {
+ if (!infosoftglobal.unloadSet) {
+ infosoftglobal.FusionChartsUtil.prepUnload = function() {
+ __flash_unloadHandler = function(){};
+ __flash_savedUnloadHandler = function(){};
+ window.attachEvent("onunload", infosoftglobal.FusionChartsUtil.cleanupSWFs);
+ }
+ window.attachEvent("onbeforeunload", infosoftglobal.FusionChartsUtil.prepUnload);
+ infosoftglobal.unloadSet = true;
+ }
+}
+/* Add document.getElementById if needed (mobile IE < 5) */
+if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}
+/* Add Array.push if needed (ie5) */
+if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}
+
+/* Function to return Flash Object from ID */
+infosoftglobal.FusionChartsUtil.getChartObject = function(id)
+{
+ var chartRef=null;
+ if (navigator.appName.indexOf("Microsoft Internet")==-1) {
+ if (document.embeds && document.embeds[id])
+ chartRef = document.embeds[id];
+ else
+ chartRef = window.document[id];
+ }
+ else {
+ chartRef = window[id];
+ }
+ if (!chartRef)
+ chartRef = document.getElementById(id);
+
+ return chartRef;
+}
+/*
+ Function to update chart's data at client side (FOR FusionCharts vFREE and 2.x
+*/
+infosoftglobal.FusionChartsUtil.updateChartXML = function(chartId, strXML){
+ //Get reference to chart object
+ var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(chartId);
+ //Set dataURL to null
+ chartObj.SetVariable("_root.dataURL","");
+ //Set the flag
+ chartObj.SetVariable("_root.isNewData","1");
+ //Set the actual data
+ chartObj.SetVariable("_root.newData",strXML);
+ //Go to the required frame
+ chartObj.TGotoLabel("/", "JavaScriptHandler");
+}
+
+
+/* Aliases for easy usage */
+var getChartFromId = infosoftglobal.FusionChartsUtil.getChartObject;
+var updateChartXML = infosoftglobal.FusionChartsUtil.updateChartXML;
+var FusionCharts = infosoftglobal.FusionCharts; \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/charts.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/charts.js
new file mode 100644
index 00000000..4bebbd36
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/charts.js
@@ -0,0 +1,132 @@
+
+function drawSingleSeriesChart(tabId, chartId, chartWidth, chartHeight, chartType, chartData,mme,yyyyMo) {
+ // define, set the data for each chart, and render them (if indicated)
+ var myChart = new FusionCharts("static/fusion/inc/fusionchart/" + chartType, "myChartId" + chartId, chartWidth, chartHeight);
+
+ var mmeLabel = "";//mme + "";
+
+ var chartCaptionId = tabId + "-chartdiv" + chartId + "-label";
+
+ document.getElementById(chartCaptionId).innerHTML = "Hosted Voice Usage in "+ yyyyMo;
+
+ myChart.setDataXML("<graph caption='"+mmeLabel + "' xAxisName='' yAxisName='# of Inbound/Outbound calls' showNames='1' decimalPrecision='0' formatNumberScale='0'>" + chartData + "</graph>");
+ myChart.setTransparent(true);
+ myChart.render(tabId + "-"+ "chartdiv" + chartId);
+
+
+ }
+
+
+ // gauge charts
+ function drawGaugeChart(chartId, gaugeIndex, value) {
+ var myChart = new FusionCharts("static/fusion/inc/fusionchart/AngularGauge.swf", "myChartId" + chartId, "300", "300", "0", "0");
+ //CPU for NYCMNYBWLT1 on 201301 : 12.63//
+ var chartData =
+ "<Chart showBorder='0' editMode='1' bgColor='FFFFFF' upperLimit='100' lowerLimit='0' label='CPU' baseFontColor='FFFFFF' majorTMNumber='11' majorTMColor='FFFFFF' majorTMHeight='8' minorTMNumber='5' minorTMColor='FFFFFF' minorTMHeight='3' toolTipBorderColor='FFFFFF' toolTipBgColor='333333' gaugeOuterRadius='100' gaugeOriginX='150' gaugeOriginY='150' gaugeScaleAngle='270' placeValuesInside='1' gaugeInnerRadius='80%25' annRenderDelay='0' gaugeFillMix='' pivotRadius='10' showPivotBorder='0' pivotFillMix='{CCCCCC},{333333}' pivotFillRatio='50,50' showShadow='0' >" +
+ "<colorRange>" +
+ "<color minValue='0' maxValue='50' code='C1E1C1' alpha='60'/>" +
+ "<color minValue='50' maxValue='85' code='F6F164' alpha='60'/>" +
+ "<color minValue='85' maxValue='120' code='F70118' alpha='60'/>" +
+ "</colorRange>" +
+ "<dials>" +
+ "<dial value='" + value + "' borderColor='FFFFFF' bgColor='000000,CCCCCC,000000' borderAlpha='0' baseWidth='10'/>" +
+ "</dials>" +
+ "<annotations>" +
+ "<annotationGroup xPos='150' yPos='150' showBelow='1'>" +
+ "<annotation type='circle' xPos='0' yPos='0' radius='120' startAngle='0' endAngle='360' fillColor='CCCCCC,111111' fillPattern='linear' fillAlpha='100,100' fillRatio='50,50' fillAngle='-45'/>" +
+ "<annotation type='circle' xPos='0' yPos='0' radius='110' startAngle='0' endAngle='360' fillColor='111111,cccccc' fillPattern='linear' fillAlpha='100,100' fillRatio='50,50' fillAngle='-45'/>" +
+ "<annotation type='text' label='CPU'/>" +
+ "</annotationGroup>" +
+ "</annotations>" +
+ "</Chart>";
+
+ myChart.setDataXML(chartData);
+ myChart.render("chartdiv" + chartId);
+ }
+
+
+ function updateGaugeChart(chartId, gaugeIndex, refreshCount) {
+ var myChart = getChartFromId("myChartId" + chartId);
+ var val = 0;
+ if (gaugeIndex == "10") val = 12;
+ else if (gaugeIndex == "20") val = 15;
+ else if (gaugeIndex == "30") val = 52;
+ else if (gaugeIndex == "40") val = 42;
+ myChart.setData(1, val);
+ myChart.setData(2, val+20);
+ }
+
+ function updateGaugeChartWithMMEData(chartId, value) {
+ var myChart = getChartFromId("myChartId" + chartId);
+ myChart.setData(1, value);
+ }
+
+
+ function updateGaugeChartWithMMEData(chartId, value, yyyyMo, mme) {
+ var myChart = getChartFromId("myChartId" + chartId);
+ myChart.setData(1, value);
+ document.getElementById("cpuYyyyMm").innerHTML = "Hosted Voice Utilization in "+ yyyyMo;
+
+ }
+
+ function drawMultiSeriesChart(tabId,chartId, chartWidth, chartHeight, chartType) {
+ var myChart = new FusionCharts("static/fusion/inc/fusionchart/" + chartType, "myChartId" + chartId, chartWidth, chartHeight, "0", "0");
+
+ myChart.setTransparent(true);
+
+ var chartData =
+ "<graph caption='Hosted Voice v Audited Communication' xAxisName='Month' yAxisName='Bandwidth Usage'" +
+ " showValues='0' decimalPrecision='0' bgcolor='ffffff' bgAlpha='70'" +
+ " showColumnShadow='1' divlinecolor='c5c5c5' divLineAlpha='60' showAlternateHGridColor='1'" +
+ " alternateHGridColor='f8f8f8' alternateHGridAlpha='60' >" +
+ "<categories>" +
+ "<category name='Jan' />" +
+ "<category name='Feb' />" +
+ "<category name='Mar' />" +
+ "<category name='Apr' />" +
+ "<category name='May' />" +
+ "<category name='Jun' />" +
+ "<category name='Jul' />" +
+ "<category name='Aug' />" +
+ "<category name='Sep' />" +
+ "<category name='Oct' />" +
+ "<category name='Nov' />" +
+ "<category name='Dec' />" +
+ "</categories>" +
+ "<dataset seriesName='Hosted Voice' color='c4e3f7' >" +
+ "<set value='7' />" +
+ "<set value='8.04' />" +
+ "<set value='10.04' />" +
+ "<set value='12.73' />" +
+ "<set value='12.41' />" +
+ "<set value='11.83' />" +
+ "<set value='14.06' />" +
+ "<set value='15.94' />" +
+ "<set value='22.97' />" +
+ "<set value='26.79' />" +
+ "<set value='20.35' />" +
+ "<set value='12.63' />" +
+ "</dataset>" +
+ "<dataset seriesName='Audited Communication' color='Fad35e' >" +
+ "<set value='5.49'/>" +
+ "<set value='8.05'/>" +
+ "<set value='15.36'/>" +
+ "<set value='21.23'/>" +
+ "<set value='23.48' />" +
+ "<set value='15.49' />" +
+ "<set value='26.8' />" +
+ "<set value='30.54' />" +
+ "<set value='64' />" +
+ "<set value='75' />" +
+ "<set value='63' />" +
+ "<set value='34' />" +
+ "</dataset>" +
+ "<trendlines>" +
+ "<line startValue='26000' color='91C728' displayValue='Target' showOnTop='1'/>" +
+ "</trendlines>" +
+ "</graph>";
+
+ myChart.setDataXML(chartData);
+ myChart.render(tabId + "-" + "chartdiv" + chartId);
+ }
+
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/eye.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/eye.js
new file mode 100644
index 00000000..8a281dc3
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/eye.js
@@ -0,0 +1,34 @@
+/**
+ *
+ * Zoomimage
+ * Author: Stefan Petre www.eyecon.ro
+ *
+ */
+(function($){
+ var EYE = window.EYE = function() {
+ var _registered = {
+ init: []
+ };
+ return {
+ init: function() {
+ $.each(_registered.init, function(nr, fn){
+ fn.call();
+ });
+ },
+ extend: function(prop) {
+ for (var i in prop) {
+ if (prop[i] != undefined) {
+ this[i] = prop[i];
+ }
+ }
+ },
+ register: function(fn, type) {
+ if (!_registered[type]) {
+ _registered[type] = [];
+ }
+ _registered[type].push(fn);
+ }
+ };
+ }();
+ $(EYE.init);
+})(jQuery);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/jquery.flexslider-min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/jquery.flexslider-min.js
new file mode 100644
index 00000000..5ad6c377
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/jquery.flexslider-min.js
@@ -0,0 +1,5 @@
+/*
+ * jQuery FlexSlider v2.6.0
+ * Copyright 2012 WooThemes
+ * Contributing Author: Tyler Smith
+ */!function($){var e=!0;$.flexslider=function(t,a){var n=$(t);n.vars=$.extend({},$.flexslider.defaults,a);var i=n.vars.namespace,s=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,r=("ontouchstart"in window||s||window.DocumentTouch&&document instanceof DocumentTouch)&&n.vars.touch,o="click touchend MSPointerUp keyup",l="",c,d="vertical"===n.vars.direction,u=n.vars.reverse,v=n.vars.itemWidth>0,p="fade"===n.vars.animation,m=""!==n.vars.asNavFor,f={};$.data(t,"flexslider",n),f={init:function(){n.animating=!1,n.currentSlide=parseInt(n.vars.startAt?n.vars.startAt:0,10),isNaN(n.currentSlide)&&(n.currentSlide=0),n.animatingTo=n.currentSlide,n.atEnd=0===n.currentSlide||n.currentSlide===n.last,n.containerSelector=n.vars.selector.substr(0,n.vars.selector.search(" ")),n.slides=$(n.vars.selector,n),n.container=$(n.containerSelector,n),n.count=n.slides.length,n.syncExists=$(n.vars.sync).length>0,"slide"===n.vars.animation&&(n.vars.animation="swing"),n.prop=d?"top":"marginLeft",n.args={},n.manualPause=!1,n.stopped=!1,n.started=!1,n.startTimeout=null,n.transitions=!n.vars.video&&!p&&n.vars.useCSS&&function(){var e=document.createElement("div"),t=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var a in t)if(void 0!==e.style[t[a]])return n.pfx=t[a].replace("Perspective","").toLowerCase(),n.prop="-"+n.pfx+"-transform",!0;return!1}(),n.ensureAnimationEnd="",""!==n.vars.controlsContainer&&(n.controlsContainer=$(n.vars.controlsContainer).length>0&&$(n.vars.controlsContainer)),""!==n.vars.manualControls&&(n.manualControls=$(n.vars.manualControls).length>0&&$(n.vars.manualControls)),""!==n.vars.customDirectionNav&&(n.customDirectionNav=2===$(n.vars.customDirectionNav).length&&$(n.vars.customDirectionNav)),n.vars.randomize&&(n.slides.sort(function(){return Math.round(Math.random())-.5}),n.container.empty().append(n.slides)),n.doMath(),n.setup("init"),n.vars.controlNav&&f.controlNav.setup(),n.vars.directionNav&&f.directionNav.setup(),n.vars.keyboard&&(1===$(n.containerSelector).length||n.vars.multipleKeyboard)&&$(document).bind("keyup",function(e){var t=e.keyCode;if(!n.animating&&(39===t||37===t)){var a=39===t?n.getTarget("next"):37===t?n.getTarget("prev"):!1;n.flexAnimate(a,n.vars.pauseOnAction)}}),n.vars.mousewheel&&n.bind("mousewheel",function(e,t,a,i){e.preventDefault();var s=0>t?n.getTarget("next"):n.getTarget("prev");n.flexAnimate(s,n.vars.pauseOnAction)}),n.vars.pausePlay&&f.pausePlay.setup(),n.vars.slideshow&&n.vars.pauseInvisible&&f.pauseInvisible.init(),n.vars.slideshow&&(n.vars.pauseOnHover&&n.hover(function(){n.manualPlay||n.manualPause||n.pause()},function(){n.manualPause||n.manualPlay||n.stopped||n.play()}),n.vars.pauseInvisible&&f.pauseInvisible.isHidden()||(n.vars.initDelay>0?n.startTimeout=setTimeout(n.play,n.vars.initDelay):n.play())),m&&f.asNav.setup(),r&&n.vars.touch&&f.touch(),(!p||p&&n.vars.smoothHeight)&&$(window).bind("resize orientationchange focus",f.resize),n.find("img").attr("draggable","false"),setTimeout(function(){n.vars.start(n)},200)},asNav:{setup:function(){n.asNav=!0,n.animatingTo=Math.floor(n.currentSlide/n.move),n.currentItem=n.currentSlide,n.slides.removeClass(i+"active-slide").eq(n.currentItem).addClass(i+"active-slide"),s?(t._slider=n,n.slides.each(function(){var e=this;e._gesture=new MSGesture,e._gesture.target=e,e.addEventListener("MSPointerDown",function(e){e.preventDefault(),e.currentTarget._gesture&&e.currentTarget._gesture.addPointer(e.pointerId)},!1),e.addEventListener("MSGestureTap",function(e){e.preventDefault();var t=$(this),a=t.index();$(n.vars.asNavFor).data("flexslider").animating||t.hasClass("active")||(n.direction=n.currentItem<a?"next":"prev",n.flexAnimate(a,n.vars.pauseOnAction,!1,!0,!0))})})):n.slides.on(o,function(e){e.preventDefault();var t=$(this),a=t.index(),s=t.offset().left-$(n).scrollLeft();0>=s&&t.hasClass(i+"active-slide")?n.flexAnimate(n.getTarget("prev"),!0):$(n.vars.asNavFor).data("flexslider").animating||t.hasClass(i+"active-slide")||(n.direction=n.currentItem<a?"next":"prev",n.flexAnimate(a,n.vars.pauseOnAction,!1,!0,!0))})}},controlNav:{setup:function(){n.manualControls?f.controlNav.setupManual():f.controlNav.setupPaging()},setupPaging:function(){var e="thumbnails"===n.vars.controlNav?"control-thumbs":"control-paging",t=1,a,s;if(n.controlNavScaffold=$('<ol class="'+i+"control-nav "+i+e+'"></ol>'),n.pagingCount>1)for(var r=0;r<n.pagingCount;r++){if(s=n.slides.eq(r),void 0===s.attr("data-thumb-alt")&&s.attr("data-thumb-alt",""),altText=""!==s.attr("data-thumb-alt")?altText=' alt="'+s.attr("data-thumb-alt")+'"':"",a="thumbnails"===n.vars.controlNav?'<img src="'+s.attr("data-thumb")+'"'+altText+"/>":'<a href="#">'+t+"</a>","thumbnails"===n.vars.controlNav&&!0===n.vars.thumbCaptions){var c=s.attr("data-thumbcaption");""!==c&&void 0!==c&&(a+='<span class="'+i+'caption">'+c+"</span>")}n.controlNavScaffold.append("<li>"+a+"</li>"),t++}n.controlsContainer?$(n.controlsContainer).append(n.controlNavScaffold):n.append(n.controlNavScaffold),f.controlNav.set(),f.controlNav.active(),n.controlNavScaffold.delegate("a, img",o,function(e){if(e.preventDefault(),""===l||l===e.type){var t=$(this),a=n.controlNav.index(t);t.hasClass(i+"active")||(n.direction=a>n.currentSlide?"next":"prev",n.flexAnimate(a,n.vars.pauseOnAction))}""===l&&(l=e.type),f.setToClearWatchedEvent()})},setupManual:function(){n.controlNav=n.manualControls,f.controlNav.active(),n.controlNav.bind(o,function(e){if(e.preventDefault(),""===l||l===e.type){var t=$(this),a=n.controlNav.index(t);t.hasClass(i+"active")||(a>n.currentSlide?n.direction="next":n.direction="prev",n.flexAnimate(a,n.vars.pauseOnAction))}""===l&&(l=e.type),f.setToClearWatchedEvent()})},set:function(){var e="thumbnails"===n.vars.controlNav?"img":"a";n.controlNav=$("."+i+"control-nav li "+e,n.controlsContainer?n.controlsContainer:n)},active:function(){n.controlNav.removeClass(i+"active").eq(n.animatingTo).addClass(i+"active")},update:function(e,t){n.pagingCount>1&&"add"===e?n.controlNavScaffold.append($('<li><a href="#">'+n.count+"</a></li>")):1===n.pagingCount?n.controlNavScaffold.find("li").remove():n.controlNav.eq(t).closest("li").remove(),f.controlNav.set(),n.pagingCount>1&&n.pagingCount!==n.controlNav.length?n.update(t,e):f.controlNav.active()}},directionNav:{setup:function(){var e=$('<ul class="'+i+'direction-nav"><li class="'+i+'nav-prev"><a class="'+i+'prev" href="#">'+n.vars.prevText+'</a></li><li class="'+i+'nav-next"><a class="'+i+'next" href="#">'+n.vars.nextText+"</a></li></ul>");n.customDirectionNav?n.directionNav=n.customDirectionNav:n.controlsContainer?($(n.controlsContainer).append(e),n.directionNav=$("."+i+"direction-nav li a",n.controlsContainer)):(n.append(e),n.directionNav=$("."+i+"direction-nav li a",n)),f.directionNav.update(),n.directionNav.bind(o,function(e){e.preventDefault();var t;(""===l||l===e.type)&&(t=$(this).hasClass(i+"next")?n.getTarget("next"):n.getTarget("prev"),n.flexAnimate(t,n.vars.pauseOnAction)),""===l&&(l=e.type),f.setToClearWatchedEvent()})},update:function(){var e=i+"disabled";1===n.pagingCount?n.directionNav.addClass(e).attr("tabindex","-1"):n.vars.animationLoop?n.directionNav.removeClass(e).removeAttr("tabindex"):0===n.animatingTo?n.directionNav.removeClass(e).filter("."+i+"prev").addClass(e).attr("tabindex","-1"):n.animatingTo===n.last?n.directionNav.removeClass(e).filter("."+i+"next").addClass(e).attr("tabindex","-1"):n.directionNav.removeClass(e).removeAttr("tabindex")}},pausePlay:{setup:function(){var e=$('<div class="'+i+'pauseplay"><a href="#"></a></div>');n.controlsContainer?(n.controlsContainer.append(e),n.pausePlay=$("."+i+"pauseplay a",n.controlsContainer)):(n.append(e),n.pausePlay=$("."+i+"pauseplay a",n)),f.pausePlay.update(n.vars.slideshow?i+"pause":i+"play"),n.pausePlay.bind(o,function(e){e.preventDefault(),(""===l||l===e.type)&&($(this).hasClass(i+"pause")?(n.manualPause=!0,n.manualPlay=!1,n.pause()):(n.manualPause=!1,n.manualPlay=!0,n.play())),""===l&&(l=e.type),f.setToClearWatchedEvent()})},update:function(e){"play"===e?n.pausePlay.removeClass(i+"pause").addClass(i+"play").html(n.vars.playText):n.pausePlay.removeClass(i+"play").addClass(i+"pause").html(n.vars.pauseText)}},touch:function(){function e(e){e.stopPropagation(),n.animating?e.preventDefault():(n.pause(),t._gesture.addPointer(e.pointerId),T=0,c=d?n.h:n.w,f=Number(new Date),l=v&&u&&n.animatingTo===n.last?0:v&&u?n.limit-(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo:v&&n.currentSlide===n.last?n.limit:v?(n.itemW+n.vars.itemMargin)*n.move*n.currentSlide:u?(n.last-n.currentSlide+n.cloneOffset)*c:(n.currentSlide+n.cloneOffset)*c)}function a(e){e.stopPropagation();var a=e.target._slider;if(a){var n=-e.translationX,i=-e.translationY;return T+=d?i:n,m=T,x=d?Math.abs(T)<Math.abs(-n):Math.abs(T)<Math.abs(-i),e.detail===e.MSGESTURE_FLAG_INERTIA?void setImmediate(function(){t._gesture.stop()}):void((!x||Number(new Date)-f>500)&&(e.preventDefault(),!p&&a.transitions&&(a.vars.animationLoop||(m=T/(0===a.currentSlide&&0>T||a.currentSlide===a.last&&T>0?Math.abs(T)/c+2:1)),a.setProps(l+m,"setTouch"))))}}function i(e){e.stopPropagation();var t=e.target._slider;if(t){if(t.animatingTo===t.currentSlide&&!x&&null!==m){var a=u?-m:m,n=a>0?t.getTarget("next"):t.getTarget("prev");t.canAdvance(n)&&(Number(new Date)-f<550&&Math.abs(a)>50||Math.abs(a)>c/2)?t.flexAnimate(n,t.vars.pauseOnAction):p||t.flexAnimate(t.currentSlide,t.vars.pauseOnAction,!0)}r=null,o=null,m=null,l=null,T=0}}var r,o,l,c,m,f,g,h,S,x=!1,y=0,b=0,T=0;s?(t.style.msTouchAction="none",t._gesture=new MSGesture,t._gesture.target=t,t.addEventListener("MSPointerDown",e,!1),t._slider=n,t.addEventListener("MSGestureChange",a,!1),t.addEventListener("MSGestureEnd",i,!1)):(g=function(e){n.animating?e.preventDefault():(window.navigator.msPointerEnabled||1===e.touches.length)&&(n.pause(),c=d?n.h:n.w,f=Number(new Date),y=e.touches[0].pageX,b=e.touches[0].pageY,l=v&&u&&n.animatingTo===n.last?0:v&&u?n.limit-(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo:v&&n.currentSlide===n.last?n.limit:v?(n.itemW+n.vars.itemMargin)*n.move*n.currentSlide:u?(n.last-n.currentSlide+n.cloneOffset)*c:(n.currentSlide+n.cloneOffset)*c,r=d?b:y,o=d?y:b,t.addEventListener("touchmove",h,!1),t.addEventListener("touchend",S,!1))},h=function(e){y=e.touches[0].pageX,b=e.touches[0].pageY,m=d?r-b:r-y,x=d?Math.abs(m)<Math.abs(y-o):Math.abs(m)<Math.abs(b-o);var t=500;(!x||Number(new Date)-f>t)&&(e.preventDefault(),!p&&n.transitions&&(n.vars.animationLoop||(m/=0===n.currentSlide&&0>m||n.currentSlide===n.last&&m>0?Math.abs(m)/c+2:1),n.setProps(l+m,"setTouch")))},S=function(e){if(t.removeEventListener("touchmove",h,!1),n.animatingTo===n.currentSlide&&!x&&null!==m){var a=u?-m:m,i=a>0?n.getTarget("next"):n.getTarget("prev");n.canAdvance(i)&&(Number(new Date)-f<550&&Math.abs(a)>50||Math.abs(a)>c/2)?n.flexAnimate(i,n.vars.pauseOnAction):p||n.flexAnimate(n.currentSlide,n.vars.pauseOnAction,!0)}t.removeEventListener("touchend",S,!1),r=null,o=null,m=null,l=null},t.addEventListener("touchstart",g,!1))},resize:function(){!n.animating&&n.is(":visible")&&(v||n.doMath(),p?f.smoothHeight():v?(n.slides.width(n.computedW),n.update(n.pagingCount),n.setProps()):d?(n.viewport.height(n.h),n.setProps(n.h,"setTotal")):(n.vars.smoothHeight&&f.smoothHeight(),n.newSlides.width(n.computedW),n.setProps(n.computedW,"setTotal")))},smoothHeight:function(e){if(!d||p){var t=p?n:n.viewport;e?t.animate({height:n.slides.eq(n.animatingTo).height()},e):t.height(n.slides.eq(n.animatingTo).height())}},sync:function(e){var t=$(n.vars.sync).data("flexslider"),a=n.animatingTo;switch(e){case"animate":t.flexAnimate(a,n.vars.pauseOnAction,!1,!0);break;case"play":t.playing||t.asNav||t.play();break;case"pause":t.pause()}},uniqueID:function(e){return e.filter("[id]").add(e.find("[id]")).each(function(){var e=$(this);e.attr("id",e.attr("id")+"_clone")}),e},pauseInvisible:{visProp:null,init:function(){var e=f.pauseInvisible.getHiddenProp();if(e){var t=e.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(t,function(){f.pauseInvisible.isHidden()?n.startTimeout?clearTimeout(n.startTimeout):n.pause():n.started?n.play():n.vars.initDelay>0?setTimeout(n.play,n.vars.initDelay):n.play()})}},isHidden:function(){var e=f.pauseInvisible.getHiddenProp();return e?document[e]:!1},getHiddenProp:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t<e.length;t++)if(e[t]+"Hidden"in document)return e[t]+"Hidden";return null}},setToClearWatchedEvent:function(){clearTimeout(c),c=setTimeout(function(){l=""},3e3)}},n.flexAnimate=function(e,t,a,s,o){if(n.vars.animationLoop||e===n.currentSlide||(n.direction=e>n.currentSlide?"next":"prev"),m&&1===n.pagingCount&&(n.direction=n.currentItem<e?"next":"prev"),!n.animating&&(n.canAdvance(e,o)||a)&&n.is(":visible")){if(m&&s){var l=$(n.vars.asNavFor).data("flexslider");if(n.atEnd=0===e||e===n.count-1,l.flexAnimate(e,!0,!1,!0,o),n.direction=n.currentItem<e?"next":"prev",l.direction=n.direction,Math.ceil((e+1)/n.visible)-1===n.currentSlide||0===e)return n.currentItem=e,n.slides.removeClass(i+"active-slide").eq(e).addClass(i+"active-slide"),!1;n.currentItem=e,n.slides.removeClass(i+"active-slide").eq(e).addClass(i+"active-slide"),e=Math.floor(e/n.visible)}if(n.animating=!0,n.animatingTo=e,t&&n.pause(),n.vars.before(n),n.syncExists&&!o&&f.sync("animate"),n.vars.controlNav&&f.controlNav.active(),v||n.slides.removeClass(i+"active-slide").eq(e).addClass(i+"active-slide"),n.atEnd=0===e||e===n.last,n.vars.directionNav&&f.directionNav.update(),e===n.last&&(n.vars.end(n),n.vars.animationLoop||n.pause()),p)r?(n.slides.eq(n.currentSlide).css({opacity:0,zIndex:1}),n.slides.eq(e).css({opacity:1,zIndex:2}),n.wrapup(c)):(n.slides.eq(n.currentSlide).css({zIndex:1}).animate({opacity:0},n.vars.animationSpeed,n.vars.easing),n.slides.eq(e).css({zIndex:2}).animate({opacity:1},n.vars.animationSpeed,n.vars.easing,n.wrapup));else{var c=d?n.slides.filter(":first").height():n.computedW,g,h,S;v?(g=n.vars.itemMargin,S=(n.itemW+g)*n.move*n.animatingTo,h=S>n.limit&&1!==n.visible?n.limit:S):h=0===n.currentSlide&&e===n.count-1&&n.vars.animationLoop&&"next"!==n.direction?u?(n.count+n.cloneOffset)*c:0:n.currentSlide===n.last&&0===e&&n.vars.animationLoop&&"prev"!==n.direction?u?0:(n.count+1)*c:u?(n.count-1-e+n.cloneOffset)*c:(e+n.cloneOffset)*c,n.setProps(h,"",n.vars.animationSpeed),n.transitions?(n.vars.animationLoop&&n.atEnd||(n.animating=!1,n.currentSlide=n.animatingTo),n.container.unbind("webkitTransitionEnd transitionend"),n.container.bind("webkitTransitionEnd transitionend",function(){clearTimeout(n.ensureAnimationEnd),n.wrapup(c)}),clearTimeout(n.ensureAnimationEnd),n.ensureAnimationEnd=setTimeout(function(){n.wrapup(c)},n.vars.animationSpeed+100)):n.container.animate(n.args,n.vars.animationSpeed,n.vars.easing,function(){n.wrapup(c)})}n.vars.smoothHeight&&f.smoothHeight(n.vars.animationSpeed)}},n.wrapup=function(e){p||v||(0===n.currentSlide&&n.animatingTo===n.last&&n.vars.animationLoop?n.setProps(e,"jumpEnd"):n.currentSlide===n.last&&0===n.animatingTo&&n.vars.animationLoop&&n.setProps(e,"jumpStart")),n.animating=!1,n.currentSlide=n.animatingTo,n.vars.after(n)},n.animateSlides=function(){!n.animating&&e&&n.flexAnimate(n.getTarget("next"))},n.pause=function(){clearInterval(n.animatedSlides),n.animatedSlides=null,n.playing=!1,n.vars.pausePlay&&f.pausePlay.update("play"),n.syncExists&&f.sync("pause")},n.play=function(){n.playing&&clearInterval(n.animatedSlides),n.animatedSlides=n.animatedSlides||setInterval(n.animateSlides,n.vars.slideshowSpeed),n.started=n.playing=!0,n.vars.pausePlay&&f.pausePlay.update("pause"),n.syncExists&&f.sync("play")},n.stop=function(){n.pause(),n.stopped=!0},n.canAdvance=function(e,t){var a=m?n.pagingCount-1:n.last;return t?!0:m&&n.currentItem===n.count-1&&0===e&&"prev"===n.direction?!0:m&&0===n.currentItem&&e===n.pagingCount-1&&"next"!==n.direction?!1:e!==n.currentSlide||m?n.vars.animationLoop?!0:n.atEnd&&0===n.currentSlide&&e===a&&"next"!==n.direction?!1:n.atEnd&&n.currentSlide===a&&0===e&&"next"===n.direction?!1:!0:!1},n.getTarget=function(e){return n.direction=e,"next"===e?n.currentSlide===n.last?0:n.currentSlide+1:0===n.currentSlide?n.last:n.currentSlide-1},n.setProps=function(e,t,a){var i=function(){var a=e?e:(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo,i=function(){if(v)return"setTouch"===t?e:u&&n.animatingTo===n.last?0:u?n.limit-(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo:n.animatingTo===n.last?n.limit:a;switch(t){case"setTotal":return u?(n.count-1-n.currentSlide+n.cloneOffset)*e:(n.currentSlide+n.cloneOffset)*e;case"setTouch":return u?e:e;case"jumpEnd":return u?e:n.count*e;case"jumpStart":return u?n.count*e:e;default:return e}}();return-1*i+"px"}();n.transitions&&(i=d?"translate3d(0,"+i+",0)":"translate3d("+i+",0,0)",a=void 0!==a?a/1e3+"s":"0s",n.container.css("-"+n.pfx+"-transition-duration",a),n.container.css("transition-duration",a)),n.args[n.prop]=i,(n.transitions||void 0===a)&&n.container.css(n.args),n.container.css("transform",i)},n.setup=function(e){if(p)n.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"}),"init"===e&&(r?n.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+n.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(n.currentSlide).css({opacity:1,zIndex:2}):0==n.vars.fadeFirstSlide?n.slides.css({opacity:0,display:"block",zIndex:1}).eq(n.currentSlide).css({zIndex:2}).css({opacity:1}):n.slides.css({opacity:0,display:"block",zIndex:1}).eq(n.currentSlide).css({zIndex:2}).animate({opacity:1},n.vars.animationSpeed,n.vars.easing)),n.vars.smoothHeight&&f.smoothHeight();else{var t,a;"init"===e&&(n.viewport=$('<div class="'+i+'viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(n).append(n.container),n.cloneCount=0,n.cloneOffset=0,u&&(a=$.makeArray(n.slides).reverse(),n.slides=$(a),n.container.empty().append(n.slides))),n.vars.animationLoop&&!v&&(n.cloneCount=2,n.cloneOffset=1,"init"!==e&&n.container.find(".clone").remove(),n.container.append(f.uniqueID(n.slides.first().clone().addClass("clone")).attr("aria-hidden","true")).prepend(f.uniqueID(n.slides.last().clone().addClass("clone")).attr("aria-hidden","true"))),n.newSlides=$(n.vars.selector,n),t=u?n.count-1-n.currentSlide+n.cloneOffset:n.currentSlide+n.cloneOffset,d&&!v?(n.container.height(200*(n.count+n.cloneCount)+"%").css("position","absolute").width("100%"),setTimeout(function(){n.newSlides.css({display:"block"}),n.doMath(),n.viewport.height(n.h),n.setProps(t*n.h,"init")},"init"===e?100:0)):(n.container.width(200*(n.count+n.cloneCount)+"%"),n.setProps(t*n.computedW,"init"),setTimeout(function(){n.doMath(),n.newSlides.css({width:n.computedW,marginRight:n.computedM,"float":"left",display:"block"}),n.vars.smoothHeight&&f.smoothHeight()},"init"===e?100:0))}v||n.slides.removeClass(i+"active-slide").eq(n.currentSlide).addClass(i+"active-slide"),n.vars.init(n)},n.doMath=function(){var e=n.slides.first(),t=n.vars.itemMargin,a=n.vars.minItems,i=n.vars.maxItems;n.w=void 0===n.viewport?n.width():n.viewport.width(),n.h=e.height(),n.boxPadding=e.outerWidth()-e.width(),v?(n.itemT=n.vars.itemWidth+t,n.itemM=t,n.minW=a?a*n.itemT:n.w,n.maxW=i?i*n.itemT-t:n.w,n.itemW=n.minW>n.w?(n.w-t*(a-1))/a:n.maxW<n.w?(n.w-t*(i-1))/i:n.vars.itemWidth>n.w?n.w:n.vars.itemWidth,n.visible=Math.floor(n.w/n.itemW),n.move=n.vars.move>0&&n.vars.move<n.visible?n.vars.move:n.visible,n.pagingCount=Math.ceil((n.count-n.visible)/n.move+1),n.last=n.pagingCount-1,n.limit=1===n.pagingCount?0:n.vars.itemWidth>n.w?n.itemW*(n.count-1)+t*(n.count-1):(n.itemW+t)*n.count-n.w-t):(n.itemW=n.w,n.itemM=t,n.pagingCount=n.count,n.last=n.count-1),n.computedW=n.itemW-n.boxPadding,n.computedM=n.itemM},n.update=function(e,t){n.doMath(),v||(e<n.currentSlide?n.currentSlide+=1:e<=n.currentSlide&&0!==e&&(n.currentSlide-=1),n.animatingTo=n.currentSlide),n.vars.controlNav&&!n.manualControls&&("add"===t&&!v||n.pagingCount>n.controlNav.length?f.controlNav.update("add"):("remove"===t&&!v||n.pagingCount<n.controlNav.length)&&(v&&n.currentSlide>n.last&&(n.currentSlide-=1,n.animatingTo-=1),f.controlNav.update("remove",n.last))),n.vars.directionNav&&f.directionNav.update()},n.addSlide=function(e,t){var a=$(e);n.count+=1,n.last=n.count-1,d&&u?void 0!==t?n.slides.eq(n.count-t).after(a):n.container.prepend(a):void 0!==t?n.slides.eq(t).before(a):n.container.append(a),n.update(t,"add"),n.slides=$(n.vars.selector+":not(.clone)",n),n.setup(),n.vars.added(n)},n.removeSlide=function(e){var t=isNaN(e)?n.slides.index($(e)):e;n.count-=1,n.last=n.count-1,isNaN(e)?$(e,n.slides).remove():d&&u?n.slides.eq(n.last).remove():n.slides.eq(e).remove(),n.doMath(),n.update(t,"remove"),n.slides=$(n.vars.selector+":not(.clone)",n),n.setup(),n.vars.removed(n)},f.init()},$(window).blur(function(t){e=!1}).focus(function(t){e=!0}),$.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,fadeFirstSlide:!0,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",customDirectionNav:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){},init:function(){}},$.fn.flexslider=function(e){if(void 0===e&&(e={}),"object"==typeof e)return this.each(function(){var t=$(this),a=e.selector?e.selector:".slides > li",n=t.find(a);1===n.length&&e.allowOneSlide===!0||0===n.length?(n.fadeIn(400),e.start&&e.start(t)):void 0===t.data("flexslider")&&new $.flexslider(this,e)});var t=$(this).data("flexslider");switch(e){case"play":t.play();break;case"pause":t.pause();break;case"stop":t.stop();break;case"next":t.flexAnimate(t.getTarget("next"),!0);break;case"prev":case"previous":t.flexAnimate(t.getTarget("prev"),!0);break;default:"number"==typeof e&&t.flexAnimate(e,!0)}}}(jQuery); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/scribble.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/scribble.js
new file mode 100644
index 00000000..5384b304
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/scribble.js
@@ -0,0 +1,19 @@
+ function storeUserScribble(id) {
+ var scribble = document.getElementById('scribble').innerHTML;
+ localStorage.setItem('userScribble',scribble);
+ }
+
+ function getUserScribble() {
+ if ( localStorage.getItem('userScribble')) {
+ var scribble = localStorage.getItem('userScribble');
+ }
+ else {
+ var scribble = 'You can scribble directly on this sticky... and I will also remember your message the next time you visit my blog!';
+ }
+ document.getElementById('scribble').innerHTML = scribble;
+ }
+
+ function clearLocal() {
+ clear: localStorage.clear();
+ return false;
+ }
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/slides.min.jquery.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/slides.min.jquery.js
new file mode 100644
index 00000000..1a1fcdd8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/slides.min.jquery.js
@@ -0,0 +1,20 @@
+/*
+* Slides, A Slideshow Plugin for jQuery
+* Intructions: http://slidesjs.com
+* By: Nathan Searles, http://nathansearles.com
+* Version: 1.1.9
+* Updated: September 5th, 2011
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+(function(a){a.fn.slides=function(b){return b=a.extend({},a.fn.slides.option,b),this.each(function(){function w(g,h,i){if(!p&&o){p=!0,b.animationStart(n+1);switch(g){case"next":l=n,k=n+1,k=e===k?0:k,r=f*2,g=-f*2,n=k;break;case"prev":l=n,k=n-1,k=k===-1?e-1:k,r=0,g=0,n=k;break;case"pagination":k=parseInt(i,10),l=a("."+b.paginationClass+" li."+b.currentClass+" a",c).attr("href").match("[^#/]+$"),k>l?(r=f*2,g=-f*2):(r=0,g=0),n=k}h==="fade"?b.crossfade?d.children(":eq("+k+")",c).css({zIndex:10}).fadeIn(b.fadeSpeed,b.fadeEasing,function(){b.autoHeight?d.animate({height:d.children(":eq("+k+")",c).outerHeight()},b.autoHeightSpeed,function(){d.children(":eq("+l+")",c).css({display:"none",zIndex:0}),d.children(":eq("+k+")",c).css({zIndex:0}),b.animationComplete(k+1),p=!1}):(d.children(":eq("+l+")",c).css({display:"none",zIndex:0}),d.children(":eq("+k+")",c).css({zIndex:0}),b.animationComplete(k+1),p=!1)}):d.children(":eq("+l+")",c).fadeOut(b.fadeSpeed,b.fadeEasing,function(){b.autoHeight?d.animate({height:d.children(":eq("+k+")",c).outerHeight()},b.autoHeightSpeed,function(){d.children(":eq("+k+")",c).fadeIn(b.fadeSpeed,b.fadeEasing)}):d.children(":eq("+k+")",c).fadeIn(b.fadeSpeed,b.fadeEasing,function(){a.browser.msie&&a(this).get(0).style.removeAttribute("filter")}),b.animationComplete(k+1),p=!1}):(d.children(":eq("+k+")").css({left:r,display:"block"}),b.autoHeight?d.animate({left:g,height:d.children(":eq("+k+")").outerHeight()},b.slideSpeed,b.slideEasing,function(){d.css({left:-f}),d.children(":eq("+k+")").css({left:f,zIndex:5}),d.children(":eq("+l+")").css({left:f,display:"none",zIndex:0}),b.animationComplete(k+1),p=!1}):d.animate({left:g},b.slideSpeed,b.slideEasing,function(){d.css({left:-f}),d.children(":eq("+k+")").css({left:f,zIndex:5}),d.children(":eq("+l+")").css({left:f,display:"none",zIndex:0}),b.animationComplete(k+1),p=!1})),b.pagination&&(a("."+b.paginationClass+" li."+b.currentClass,c).removeClass(b.currentClass),a("."+b.paginationClass+" li:eq("+k+")",c).addClass(b.currentClass))}}function x(){clearInterval(c.data("interval"))}function y(){b.pause?(clearTimeout(c.data("pause")),clearInterval(c.data("interval")),u=setTimeout(function(){clearTimeout(c.data("pause")),v=setInterval(function(){w("next",i)},b.play),c.data("interval",v)},b.pause),c.data("pause",u)):x()}a("."+b.container,a(this)).children().wrapAll('<div class="slides_control"/>');var c=a(this),d=a(".slides_control",c),e=d.children().size(),f=d.children().outerWidth(),g=d.children().outerHeight(),h=b.start-1,i=b.effect.indexOf(",")<0?b.effect:b.effect.replace(" ","").split(",")[0],j=b.effect.indexOf(",")<0?i:b.effect.replace(" ","").split(",")[1],k=0,l=0,m=0,n=0,o,p,q,r,s,t,u,v;if(e<2)return a("."+b.container,a(this)).fadeIn(b.fadeSpeed,b.fadeEasing,function(){o=!0,b.slidesLoaded()}),a("."+b.next+", ."+b.prev).fadeOut(0),!1;if(e<2)return;h<0&&(h=0),h>e&&(h=e-1),b.start&&(n=h),b.randomize&&d.randomize(),a("."+b.container,c).css({overflow:"hidden",position:"relative"}),d.children().css({position:"absolute",top:0,left:d.children().outerWidth(),zIndex:0,display:"none"}),d.css({position:"relative",width:f*3,height:g,left:-f}),a("."+b.container,c).css({display:"block"}),b.autoHeight&&(d.children().css({height:"auto"}),d.animate({height:d.children(":eq("+h+")").outerHeight()},b.autoHeightSpeed));if(b.preload&&d.find("img:eq("+h+")").length){a("."+b.container,c).css({background:"url("+b.preloadImage+") no-repeat 50% 50%"});var z=d.find("img:eq("+h+")").attr("src")+"?"+(new Date).getTime();a("img",c).parent().attr("class")!="slides_control"?t=d.children(":eq(0)")[0].tagName.toLowerCase():t=d.find("img:eq("+h+")"),d.find("img:eq("+h+")").attr("src",z).load(function(){d.find(t+":eq("+h+")").fadeIn(b.fadeSpeed,b.fadeEasing,function(){a(this).css({zIndex:5}),a("."+b.container,c).css({background:""}),o=!0,b.slidesLoaded()})})}else d.children(":eq("+h+")").fadeIn(b.fadeSpeed,b.fadeEasing,function(){o=!0,b.slidesLoaded()});b.bigTarget&&(d.children().css({cursor:"pointer"}),d.children().click(function(){return w("next",i),!1})),b.hoverPause&&b.play&&(d.bind("mouseover",function(){x()}),d.bind("mouseleave",function(){y()})),b.generateNextPrev&&(a("."+b.container,c).after('<a href="#" class="'+b.prev+'">Prev</a>'),a("."+b.prev,c).after('<a href="#" class="'+b.next+'">Next</a>')),a("."+b.next,c).click(function(a){a.preventDefault(),b.play&&y(),w("next",i)}),a("."+b.prev,c).click(function(a){a.preventDefault(),b.play&&y(),w("prev",i)}),b.generatePagination?(b.prependPagination?c.prepend("<ul class="+b.paginationClass+"></ul>"):c.append("<ul class="+b.paginationClass+"></ul>"),d.children().each(function(){a("."+b.paginationClass,c).append('<li><a href="#'+m+'">'+(m+1)+"</a></li>"),m++})):a("."+b.paginationClass+" li a",c).each(function(){a(this).attr("href","#"+m),m++}),a("."+b.paginationClass+" li:eq("+h+")",c).addClass(b.currentClass),a("."+b.paginationClass+" li a",c).click(function(){return b.play&&y(),q=a(this).attr("href").match("[^#/]+$"),n!=q&&w("pagination",j,q),!1}),a("a.link",c).click(function(){return b.play&&y(),q=a(this).attr("href").match("[^#/]+$")-1,n!=q&&w("pagination",j,q),!1}),b.play&&(v=setInterval(function(){w("next",i)},b.play),c.data("interval",v))})},a.fn.slides.option={preload:!1,preloadImage:"/img/loading.gif",container:"slides_container",generateNextPrev:!1,next:"next",prev:"prev",pagination:!0,generatePagination:!0,prependPagination:!1,paginationClass:"pagination",currentClass:"current",fadeSpeed:350,fadeEasing:"",slideSpeed:350,slideEasing:"",start:1,effect:"slide",crossfade:!1,randomize:!1,play:0,pause:0,hoverPause:!1,autoHeight:!1,autoHeightSpeed:350,bigTarget:!1,animationStart:function(){},animationComplete:function(){},slidesLoaded:function(){}},a.fn.randomize=function(b){function c(){return Math.round(Math.random())-.5}return a(this).each(function(){var d=a(this),e=d.children(),f=e.length;if(f>1){e.hide();var g=[];for(i=0;i<f;i++)g[g.length]=i;g=g.sort(c),a.each(g,function(a,c){var f=e.eq(c),g=f.clone(!0);g.show().appendTo(d),b!==undefined&&b(f,g),f.remove()})}})}})(jQuery) \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/spacegallery.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/spacegallery.js
new file mode 100644
index 00000000..69ab2ccc
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/spacegallery.js
@@ -0,0 +1,235 @@
+/**
+ *
+ * Spacegallery
+ * Author: Stefan Petre www.eyecon.ro
+ *
+ */
+
+(function($){
+ EYE.extend({
+
+ spacegallery: {
+
+ //default options (many options are controled via CSS)
+ defaults: {
+ border: 6, // border arround the image
+ perspective: 140, // perpective height
+ minScale: 0.2, // minimum scale for the image in the back
+ duration: 800, // aimation duration
+ loadingClass: null, // CSS class applied to the element while looading images
+ before: function(){return false},
+ after: function(){return false}
+ },
+
+ animated: false,
+
+ //position images
+ positionImages: function(el) {
+ var top = 0;
+ EYE.spacegallery.animated = false;
+ $(el)
+ .find('a')
+ .removeClass(el.spacegalleryCfg.loadingClass)
+ .end()
+ .find('img')
+ .removeAttr('height')
+ .each(function(nr){
+ var newWidth = this.spacegallery.origWidth - (this.spacegallery.origWidth - this.spacegallery.origWidth * el.spacegalleryCfg.minScale) * el.spacegalleryCfg.asins[nr];
+ $(this)
+ .css({
+ top: el.spacegalleryCfg.tops[nr] + 'px',
+ marginLeft: - parseInt((newWidth + el.spacegalleryCfg.border)/2, 10) + 'px',
+ opacity: 1 - el.spacegalleryCfg.asins[nr]
+ })
+ .attr('width', parseInt(newWidth));
+ this.spacegallery.next = el.spacegalleryCfg.asins[nr+1];
+ this.spacegallery.nextTop = el.spacegalleryCfg.tops[nr+1] - el.spacegalleryCfg.tops[nr];
+ this.spacegallery.origTop = el.spacegalleryCfg.tops[nr];
+ this.spacegallery.opacity = 1 - el.spacegalleryCfg.asins[nr];
+ this.spacegallery.increment = el.spacegalleryCfg.asins[nr] - this.spacegallery.next;
+ this.spacegallery.current = el.spacegalleryCfg.asins[nr];
+ this.spacegallery.width = newWidth;
+ })
+ },
+
+ //animate to nex image
+ next: function(e) {
+ if (EYE.spacegallery.animated === false) {
+ EYE.spacegallery.animated = true;
+ var el = this.parentNode;
+ el.spacegalleryCfg.before.apply(el);
+ $(el)
+ .css('spacegallery', 0)
+ .animate({
+ spacegallery: 100
+ },{
+ easing: 'easeOut',
+ duration: el.spacegalleryCfg.duration,
+ complete: function() {
+ $(el)
+ .find('img:last')
+ .prependTo(el);
+ EYE.spacegallery.positionImages(el);
+ el.spacegalleryCfg.after.apply(el);
+ },
+ step: function(now) {
+ $('img', this)
+ .each(function(nr){
+ var newWidth, top, next;
+ if (nr + 1 == el.spacegalleryCfg.images) {
+ top = this.spacegallery.origTop + this.spacegallery.nextTop * 4 * now /100;
+ newWidth = this.spacegallery.width * top / this.spacegallery.origTop;
+ $(this)
+ .css({
+ top: top + 'px',
+ opacity: 0.7 - now/100,
+ marginLeft: - parseInt((newWidth + el.spacegalleryCfg.border)/2, 10) + 'px'
+ })
+ .attr('width', newWidth);
+ } else {
+ next = this.spacegallery.current - this.spacegallery.increment * now /100;
+ newWidth = this.spacegallery.origWidth - (this.spacegallery.origWidth - this.spacegallery.origWidth * el.spacegalleryCfg.minScale) * next;
+ $(this).css({
+ top: this.spacegallery.origTop + this.spacegallery.nextTop * now /100 + 'px',
+ opacity: 1 - next,
+ marginLeft: - parseInt((newWidth + el.spacegalleryCfg.border)/2, 10) + 'px'
+ })
+ .attr('width', newWidth);
+ }
+ });
+ }
+ });
+ }
+
+ this.blur();
+ return false;
+ },
+
+ autoNext: function(el) {
+
+ if (EYE.spacegallery.animated === false) {
+ EYE.spacegallery.animated = true;
+ el.spacegalleryCfg.before.apply(el); // run the "before" function
+ $(el)
+ .css('spacegallery', 0)
+ .animate({
+ spacegallery: 100
+ },{
+ easing: 'easeOut',
+ duration: el.spacegalleryCfg.duration,
+ complete: function() { // after animation is complete, move the front image to the back
+ $(el)
+ .find('img:last') // find the last image in this div
+ .prependTo(el); // and stick it at the beginning
+ EYE.spacegallery.positionImages(el); // run "position images"
+ el.spacegalleryCfg.after.apply(el); //run the "after" function
+ },
+ step: function(now) {
+ $('img', this)
+ .each(function(nr){
+ var newWidth, top, next;
+ if (nr + 1 == el.spacegalleryCfg.images) {
+ top = this.spacegallery.origTop + this.spacegallery.nextTop * 4 * now /100;
+ newWidth = this.spacegallery.width * top / this.spacegallery.origTop;
+ $(this)
+ .css({
+ top: top + 'px',
+ opacity: 0.7 - now/100,
+ marginLeft: - parseInt((newWidth + el.spacegalleryCfg.border)/2, 10) + 'px'
+ })
+ .attr('width', newWidth);
+ } else {
+ next = this.spacegallery.current - this.spacegallery.increment * now /100;
+ newWidth = this.spacegallery.origWidth - (this.spacegallery.origWidth - this.spacegallery.origWidth * el.spacegalleryCfg.minScale) * next;
+ $(this).css({
+ top: this.spacegallery.origTop + this.spacegallery.nextTop * now /100 + 'px',
+ opacity: 1 - next,
+ marginLeft: - parseInt((newWidth + el.spacegalleryCfg.border)/2, 10) + 'px'
+ })
+ .attr('width', newWidth);
+ }
+ });
+ }
+ });
+ }
+
+ return false;
+ },
+
+ //constructor
+ init: function(opt) {
+ opt = $.extend({}, EYE.spacegallery.defaults, opt||{});
+ return this.each(function(){
+ var el = this;
+ if ($(el).is('.spacegallery')) {
+ $('<a href="#"></a>')
+ .appendTo(this)
+ .addClass(opt.loadingClass)
+ .bind('click', EYE.spacegallery.next);
+ el.spacegalleryCfg = opt;
+ el.spacegalleryCfg.images = el.getElementsByTagName('img').length;
+ el.spacegalleryCfg.loaded = 0;
+ el.spacegalleryCfg.asin = Math.asin(1);
+ el.spacegalleryCfg.asins = {};
+ el.spacegalleryCfg.tops = {};
+ el.spacegalleryCfg.increment = parseInt(el.spacegalleryCfg.perspective/el.spacegalleryCfg.images, 10);
+ var top = 0;
+ $('img', el)
+ .each(function(nr){
+ var imgEl = new Image();
+ var elImg = this;
+ el.spacegalleryCfg.asins[nr] = 1 - Math.asin((nr+1)/el.spacegalleryCfg.images)/el.spacegalleryCfg.asin;
+ top += el.spacegalleryCfg.increment - el.spacegalleryCfg.increment * el.spacegalleryCfg.asins[nr];
+ el.spacegalleryCfg.tops[nr] = top;
+ elImg.spacegallery = {};
+ imgEl.src = this.src;
+ if (imgEl.complete) {
+ el.spacegalleryCfg.loaded ++;
+ elImg.spacegallery.origWidth = imgEl.width;
+ elImg.spacegallery.origHeight = imgEl.height
+ } else {
+ imgEl.onload = function() {
+ el.spacegalleryCfg.loaded ++;
+ elImg.spacegallery.origWidth = imgEl.width;
+ elImg.spacegallery.origHeight = imgEl.height
+ if (el.spacegalleryCfg.loaded == el.spacegalleryCfg.images) {
+
+ EYE.spacegallery.positionImages(el);
+ }
+ };
+ }
+ });
+ el.spacegalleryCfg.asins[el.spacegalleryCfg.images] = el.spacegalleryCfg.asins[el.spacegalleryCfg.images - 1] * 1.3;
+ el.spacegalleryCfg.tops[el.spacegalleryCfg.images] = el.spacegalleryCfg.tops[el.spacegalleryCfg.images - 1] * 1.3;
+ if (el.spacegalleryCfg.loaded == el.spacegalleryCfg.images) {
+ EYE.spacegallery.positionImages(el);
+ setInterval(function() { EYE.spacegallery.autoNext(el); }, 4000);
+ }
+ }
+ });
+ }
+ }
+ });
+
+ $.fn.extend({
+
+ /**
+ * Create a space gallery
+ * @name spacegallery
+ * @description create a space gallery
+ * @option int border Images' border. Default: 6
+ * @option int perspective Perpective height. Default: 140
+ * @option float minScale Minimum scale for the image in the back. Default: 0.2
+ * @option int duration Animation duration. Default: 800
+ * @option string loadingClass CSS class applied to the element while looading images. Default: null
+ * @option function before Callback function triggered before going to the next image
+ * @option function after Callback function triggered after going to the next image
+ */
+ spacegallery: EYE.spacegallery.init
+ });
+ $.extend($.easing,{
+ easeOut:function (x, t, b, c, d) {
+ return -c *(t/=d)*(t-2) + b;
+ }
+ });
+})(jQuery); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/utils.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/utils.js
new file mode 100644
index 00000000..d9be8532
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/utils.js
@@ -0,0 +1,252 @@
+/**
+ *
+ * Utilities
+ * Author: Stefan Petre www.eyecon.ro
+ *
+ */
+(function($) {
+EYE.extend({
+ getPosition : function(e, forceIt)
+ {
+ var x = 0;
+ var y = 0;
+ var es = e.style;
+ var restoreStyles = false;
+ if (forceIt && jQuery.curCSS(e,'display') == 'none') {
+ var oldVisibility = es.visibility;
+ var oldPosition = es.position;
+ restoreStyles = true;
+ es.visibility = 'hidden';
+ es.display = 'block';
+ es.position = 'absolute';
+ }
+ var el = e;
+ if (el.getBoundingClientRect) { // IE
+ var box = el.getBoundingClientRect();
+ x = box.left + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) - 2;
+ y = box.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop) - 2;
+ } else {
+ x = el.offsetLeft;
+ y = el.offsetTop;
+ el = el.offsetParent;
+ if (e != el) {
+ while (el) {
+ x += el.offsetLeft;
+ y += el.offsetTop;
+ el = el.offsetParent;
+ }
+ }
+ if (jQuery.browser.safari && jQuery.curCSS(e, 'position') == 'absolute' ) {
+ x -= document.body.offsetLeft;
+ y -= document.body.offsetTop;
+ }
+ el = e.parentNode;
+ while (el && el.tagName.toUpperCase() != 'BODY' && el.tagName.toUpperCase() != 'HTML')
+ {
+ if (jQuery.curCSS(el, 'display') != 'inline') {
+ x -= el.scrollLeft;
+ y -= el.scrollTop;
+ }
+ el = el.parentNode;
+ }
+ }
+ if (restoreStyles == true) {
+ es.display = 'none';
+ es.position = oldPosition;
+ es.visibility = oldVisibility;
+ }
+ return {x:x, y:y};
+ },
+ getSize : function(e)
+ {
+ var w = parseInt(jQuery.curCSS(e,'width'), 10);
+ var h = parseInt(jQuery.curCSS(e,'height'), 10);
+ var wb = 0;
+ var hb = 0;
+ if (jQuery.curCSS(e, 'display') != 'none') {
+ wb = e.offsetWidth;
+ hb = e.offsetHeight;
+ } else {
+ var es = e.style;
+ var oldVisibility = es.visibility;
+ var oldPosition = es.position;
+ es.visibility = 'hidden';
+ es.display = 'block';
+ es.position = 'absolute';
+ wb = e.offsetWidth;
+ hb = e.offsetHeight;
+ es.display = 'none';
+ es.position = oldPosition;
+ es.visibility = oldVisibility;
+ }
+ return {w:w, h:h, wb:wb, hb:hb};
+ },
+ getClient : function(e)
+ {
+ var h, w;
+ if (e) {
+ w = e.clientWidth;
+ h = e.clientHeight;
+ } else {
+ var de = document.documentElement;
+ w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
+ h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
+ }
+ return {w:w,h:h};
+ },
+ getScroll : function (e)
+ {
+ var t=0, l=0, w=0, h=0, iw=0, ih=0;
+ if (e && e.nodeName.toLowerCase() != 'body') {
+ t = e.scrollTop;
+ l = e.scrollLeft;
+ w = e.scrollWidth;
+ h = e.scrollHeight;
+ } else {
+ if (document.documentElement) {
+ t = document.documentElement.scrollTop;
+ l = document.documentElement.scrollLeft;
+ w = document.documentElement.scrollWidth;
+ h = document.documentElement.scrollHeight;
+ } else if (document.body) {
+ t = document.body.scrollTop;
+ l = document.body.scrollLeft;
+ w = document.body.scrollWidth;
+ h = document.body.scrollHeight;
+ }
+ if (typeof pageYOffset != 'undefined') {
+ t = pageYOffset;
+ l = pageXOffset;
+ }
+ iw = self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0;
+ ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0;
+ }
+ return { t: t, l: l, w: w, h: h, iw: iw, ih: ih };
+ },
+ getMargins : function(e, toInteger)
+ {
+ var t = jQuery.curCSS(e,'marginTop') || '';
+ var r = jQuery.curCSS(e,'marginRight') || '';
+ var b = jQuery.curCSS(e,'marginBottom') || '';
+ var l = jQuery.curCSS(e,'marginLeft') || '';
+ if (toInteger)
+ return {
+ t: parseInt(t, 10)||0,
+ r: parseInt(r, 10)||0,
+ b: parseInt(b, 10)||0,
+ l: parseInt(l, 10)
+ };
+ else
+ return {t: t, r: r, b: b, l: l};
+ },
+ getPadding : function(e, toInteger)
+ {
+ var t = jQuery.curCSS(e,'paddingTop') || '';
+ var r = jQuery.curCSS(e,'paddingRight') || '';
+ var b = jQuery.curCSS(e,'paddingBottom') || '';
+ var l = jQuery.curCSS(e,'paddingLeft') || '';
+ if (toInteger)
+ return {
+ t: parseInt(t, 10)||0,
+ r: parseInt(r, 10)||0,
+ b: parseInt(b, 10)||0,
+ l: parseInt(l, 10)
+ };
+ else
+ return {t: t, r: r, b: b, l: l};
+ },
+ getBorder : function(e, toInteger)
+ {
+ var t = jQuery.curCSS(e,'borderTopWidth') || '';
+ var r = jQuery.curCSS(e,'borderRightWidth') || '';
+ var b = jQuery.curCSS(e,'borderBottomWidth') || '';
+ var l = jQuery.curCSS(e,'borderLeftWidth') || '';
+ if (toInteger)
+ return {
+ t: parseInt(t, 10)||0,
+ r: parseInt(r, 10)||0,
+ b: parseInt(b, 10)||0,
+ l: parseInt(l, 10)||0
+ };
+ else
+ return {t: t, r: r, b: b, l: l};
+ },
+ traverseDOM : function(nodeEl, func)
+ {
+ func(nodeEl);
+ nodeEl = nodeEl.firstChild;
+ while(nodeEl){
+ EYE.traverseDOM(nodeEl, func);
+ nodeEl = nodeEl.nextSibling;
+ }
+ },
+ getInnerWidth : function(el, scroll) {
+ var offsetW = el.offsetWidth;
+ return scroll ? Math.max(el.scrollWidth,offsetW) - offsetW + el.clientWidth:el.clientWidth;
+ },
+ getInnerHeight : function(el, scroll) {
+ var offsetH = el.offsetHeight;
+ return scroll ? Math.max(el.scrollHeight,offsetH) - offsetH + el.clientHeight:el.clientHeight;
+ },
+ getExtraWidth : function(el) {
+ if($.boxModel)
+ return (parseInt($.curCSS(el, 'paddingLeft'))||0)
+ + (parseInt($.curCSS(el, 'paddingRight'))||0)
+ + (parseInt($.curCSS(el, 'borderLeftWidth'))||0)
+ + (parseInt($.curCSS(el, 'borderRightWidth'))||0);
+ return 0;
+ },
+ getExtraHeight : function(el) {
+ if($.boxModel)
+ return (parseInt($.curCSS(el, 'paddingTop'))||0)
+ + (parseInt($.curCSS(el, 'paddingBottom'))||0)
+ + (parseInt($.curCSS(el, 'borderTopWidth'))||0)
+ + (parseInt($.curCSS(el, 'borderBottomWidth'))||0);
+ return 0;
+ },
+ isChildOf: function(parentEl, el, container) {
+ if (parentEl == el) {
+ return true;
+ }
+ if (!el || !el.nodeType || el.nodeType != 1) {
+ return false;
+ }
+ if (parentEl.contains && !$.browser.safari) {
+ return parentEl.contains(el);
+ }
+ if ( parentEl.compareDocumentPosition ) {
+ return !!(parentEl.compareDocumentPosition(el) & 16);
+ }
+ var prEl = el.parentNode;
+ while(prEl && prEl != container) {
+ if (prEl == parentEl)
+ return true;
+ prEl = prEl.parentNode;
+ }
+ return false;
+ },
+ centerEl : function(el, axis)
+ {
+ var clientScroll = EYE.getScroll();
+ var size = EYE.getSize(el);
+ if (!axis || axis == 'vertically')
+ $(el).css(
+ {
+ top: clientScroll.t + ((Math.min(clientScroll.h,clientScroll.ih) - size.hb)/2) + 'px'
+ }
+ );
+ if (!axis || axis == 'horizontally')
+ $(el).css(
+ {
+ left: clientScroll.l + ((Math.min(clientScroll.w,clientScroll.iw) - size.wb)/2) + 'px'
+ }
+ );
+ }
+});
+if (!$.easing.easeout) {
+ $.easing.easeout = function(p, n, firstNum, delta, duration) {
+ return -delta * ((n=n/duration-1)*n*n*n - 1) + firstNum;
+ };
+}
+
+})(jQuery); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/bootstrap.min.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/bootstrap.min.css
new file mode 100644
index 00000000..3424a5f1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/bootstrap.min.css
@@ -0,0 +1,351 @@
+html,body{margin:0;padding:0;}
+h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,cite,code,del,dfn,em,img,q,s,samp,small,strike,strong,sub,sup,tt,var,dd,dl,dt,li,ol,ul,fieldset,form,label,legend,button,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;font-weight:normal;font-style:normal;font-size:100%;line-height:1;font-family:inherit;}
+ol,ul{list-style:none;}
+q:before,q:after,blockquote:before,blockquote:after{content:"";}
+html{overflow-y:scroll;font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}
+a:focus{outline:thin dotted;}
+a:hover,a:active{outline:0;}
+article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block;}
+audio,canvas,video{display:inline-block;*display:inline;*zoom:1;}
+audio:not([controls]){display:none;}
+sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}
+sup{top:-0.5em;}
+sub{bottom:-0.25em;}
+img{border:0;-ms-interpolation-mode:bicubic;}
+button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle;}
+button,input{line-height:normal;*overflow:visible;}
+button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}
+button,input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button;}
+input[type="search"]{-webkit-appearance:textfield;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;}
+input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}
+textarea{overflow:auto;vertical-align:top;}
+body{background-color:#ffffff;margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:18px;color:#404040;}
+.container{width:940px;margin-left:auto;margin-right:auto;zoom:1;}.container:before,.container:after{display:table;content:"";zoom:1;}
+.container:after{clear:both;}
+.container-fluid{position:relative;min-width:940px;padding-left:20px;padding-right:20px;zoom:1;}.container-fluid:before,.container-fluid:after{display:table;content:"";zoom:1;}
+.container-fluid:after{clear:both;}
+.container-fluid>.sidebar{position:absolute;top:0;left:20px;width:220px;}
+.container-fluid>.content{margin-left:240px;}
+a{color:#0069d6;text-decoration:none;line-height:inherit;font-weight:inherit;}a:hover{color:#00438a;text-decoration:underline;}
+.pull-right{float:right;}
+.pull-left{float:left;}
+.hide{display:none;}
+.show{display:block;}
+.row{zoom:1;margin-left:-20px;}.row:before,.row:after{display:table;content:"";zoom:1;}
+.row:after{clear:both;}
+.row>[class*="span"]{display:inline;float:left;margin-left:20px;}
+.span1{width:40px;}
+.span2{width:100px;}
+.span3{width:160px;}
+.span4{width:220px;}
+.span5{width:280px;}
+.span6{width:340px;}
+.span7{width:400px;}
+.span8{width:460px;}
+.span9{width:520px;}
+.span10{width:580px;}
+.span11{width:640px;}
+.span12{width:700px;}
+.span13{width:760px;}
+.span14{width:820px;}
+.span15{width:880px;}
+.span16{width:940px;}
+.span17{width:1000px;}
+.span18{width:1060px;}
+.span19{width:1120px;}
+.span20{width:1180px;}
+.span21{width:1240px;}
+.span22{width:1300px;}
+.span23{width:1360px;}
+.span24{width:1420px;}
+.row>.offset1{margin-left:80px;}
+.row>.offset2{margin-left:140px;}
+.row>.offset3{margin-left:200px;}
+.row>.offset4{margin-left:260px;}
+.row>.offset5{margin-left:320px;}
+.row>.offset6{margin-left:380px;}
+.row>.offset7{margin-left:440px;}
+.row>.offset8{margin-left:500px;}
+.row>.offset9{margin-left:560px;}
+.row>.offset10{margin-left:620px;}
+.row>.offset11{margin-left:680px;}
+.row>.offset12{margin-left:740px;}
+.span-one-third{width:300px;}
+.span-two-thirds{width:620px;}
+.offset-one-third{margin-left:340px;}
+.offset-two-thirds{margin-left:660px;}
+p{font-size:13px;font-weight:normal;line-height:18px;margin-bottom:9px;}p small{font-size:11px;color:#bfbfbf;}
+h1,h2,h3,h4,h5,h6{font-weight:bold;color:#404040;}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{color:#bfbfbf;}
+h1{margin-bottom:18px;font-size:30px;line-height:36px;}h1 small{font-size:18px;}
+h2{font-size:24px;line-height:36px;}h2 small{font-size:14px;}
+h3,h4,h5,h6{line-height:36px;}
+h3{font-size:18px;}h3 small{font-size:14px;}
+h4{font-size:16px;}h4 small{font-size:12px;}
+h5{font-size:14px;}
+h6{font-size:13px;color:#bfbfbf;text-transform:uppercase;}
+ul,ol{margin:0 0 18px 25px;}
+ul ul,ul ol,ol ol,ol ul{margin-bottom:0;}
+ul{list-style:disc;}
+ol{list-style:decimal;}
+li{line-height:18px;color:#808080;}
+ul.unstyled{list-style:none;margin-left:0;}
+dl{margin-bottom:18px;}dl dt,dl dd{line-height:18px;}
+dl dt{font-weight:bold;}
+dl dd{margin-left:9px;}
+hr{margin:20px 0 19px;border:0;border-bottom:1px solid #eee;}
+strong{font-style:inherit;font-weight:bold;}
+em{font-style:italic;font-weight:inherit;line-height:inherit;}
+.muted{color:#bfbfbf;}
+blockquote{margin-bottom:18px;border-left:5px solid #eee;padding-left:15px;}blockquote p{font-size:14px;font-weight:300;line-height:18px;margin-bottom:0;}
+blockquote small{display:block;font-size:12px;font-weight:300;line-height:18px;color:#bfbfbf;}blockquote small:before{content:'\2014 \00A0';}
+address{display:block;line-height:18px;margin-bottom:18px;}
+code,pre{padding:0 3px 2px;font-family:Monaco, Andale Mono, Courier New, monospace;font-size:12px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
+code{background-color:#fee9cc;color:rgba(0, 0, 0, 0.75);padding:1px 3px;}
+pre{background-color:#f5f5f5;display:block;padding:8.5px;margin:0 0 18px;line-height:18px;font-size:12px;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.15);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;white-space:pre;white-space:pre-wrap;word-wrap:break-word;}
+form{margin-bottom:18px;}
+fieldset{margin-bottom:18px;padding-top:18px;}fieldset legend{display:block;padding-left:150px;font-size:19.5px;line-height:1;color:#404040;*padding:0 0 5px 145px;*line-height:1.5;}
+form .clearfix{margin-bottom:18px;zoom:1;}form .clearfix:before,form .clearfix:after{display:table;content:"";zoom:1;}
+form .clearfix:after{clear:both;}
+label,input,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:normal;}
+label{padding-top:6px;font-size:13px;line-height:18px;float:left;width:130px;text-align:right;color:#404040;}
+form .input{margin-left:150px;}
+input[type=checkbox],input[type=radio]{cursor:pointer;}
+input,textarea,select,.uneditable-input{display:inline-block;width:210px;height:18px;padding:4px;font-size:13px;line-height:18px;color:#808080;border:1px solid #ccc;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
+select{padding:initial;}
+input[type=checkbox],input[type=radio]{width:auto;height:auto;padding:0;margin:3px 0;*margin-top:0;line-height:normal;border:none;}
+input[type=file]{background-color:#ffffff;padding:initial;border:initial;line-height:initial;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;}
+input[type=button],input[type=reset],input[type=submit]{width:auto;height:auto;}
+select,input[type=file]{height:27px;*height:auto;line-height:27px;*margin-top:4px;}
+select[multiple]{height:inherit;background-color:#ffffff;}
+textarea{height:auto;}
+.uneditable-input{background-color:#ffffff;display:block;border-color:#eee;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);cursor:not-allowed;}
+:-moz-placeholder{color:#bfbfbf;}
+::-webkit-input-placeholder{color:#bfbfbf;}
+input,textarea{-webkit-transition:border linear 0.2s,box-shadow linear 0.2s;-moz-transition:border linear 0.2s,box-shadow linear 0.2s;-ms-transition:border linear 0.2s,box-shadow linear 0.2s;-o-transition:border linear 0.2s,box-shadow linear 0.2s;transition:border linear 0.2s,box-shadow linear 0.2s;-webkit-box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1);-moz-box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1);box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1);}
+input:focus,textarea:focus{outline:0;border-color:rgba(82, 168, 236, 0.8);-webkit-box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1),0 0 8px rgba(82, 168, 236, 0.6);-moz-box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1),0 0 8px rgba(82, 168, 236, 0.6);box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1),0 0 8px rgba(82, 168, 236, 0.6);}
+input[type=file]:focus,input[type=checkbox]:focus,select:focus{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;outline:1px dotted #666;}
+form .clearfix.error>label,form .clearfix.error .help-block,form .clearfix.error .help-inline{color:#b94a48;}
+form .clearfix.error input,form .clearfix.error textarea{color:#b94a48;border-color:#ee5f5b;}form .clearfix.error input:focus,form .clearfix.error textarea:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7;}
+form .clearfix.error .input-prepend .add-on,form .clearfix.error .input-append .add-on{color:#b94a48;background-color:#fce6e6;border-color:#b94a48;}
+form .clearfix.warning>label,form .clearfix.warning .help-block,form .clearfix.warning .help-inline{color:#c09853;}
+form .clearfix.warning input,form .clearfix.warning textarea{color:#c09853;border-color:#ccae64;}form .clearfix.warning input:focus,form .clearfix.warning textarea:focus{border-color:#be9a3f;-webkit-box-shadow:0 0 6px #e5d6b1;-moz-box-shadow:0 0 6px #e5d6b1;box-shadow:0 0 6px #e5d6b1;}
+form .clearfix.warning .input-prepend .add-on,form .clearfix.warning .input-append .add-on{color:#c09853;background-color:#d2b877;border-color:#c09853;}
+form .clearfix.success>label,form .clearfix.success .help-block,form .clearfix.success .help-inline{color:#468847;}
+form .clearfix.success input,form .clearfix.success textarea{color:#468847;border-color:#57a957;}form .clearfix.success input:focus,form .clearfix.success textarea:focus{border-color:#458845;-webkit-box-shadow:0 0 6px #9acc9a;-moz-box-shadow:0 0 6px #9acc9a;box-shadow:0 0 6px #9acc9a;}
+form .clearfix.success .input-prepend .add-on,form .clearfix.success .input-append .add-on{color:#468847;background-color:#bcddbc;border-color:#468847;}
+.input-mini,input.mini,textarea.mini,select.mini{width:60px;}
+.input-small,input.small,textarea.small,select.small{width:90px;}
+.input-medium,input.medium,textarea.medium,select.medium{width:150px;}
+.input-large,input.large,textarea.large,select.large{width:210px;}
+.input-xlarge,input.xlarge,textarea.xlarge,select.xlarge{width:270px;}
+.input-xxlarge,input.xxlarge,textarea.xxlarge,select.xxlarge{width:530px;}
+textarea.xxlarge{overflow-y:auto;}
+input.span1,textarea.span1{display:inline-block;float:none;width:30px;margin-left:0;}
+input.span2,textarea.span2{display:inline-block;float:none;width:90px;margin-left:0;}
+input.span3,textarea.span3{display:inline-block;float:none;width:150px;margin-left:0;}
+input.span4,textarea.span4{display:inline-block;float:none;width:210px;margin-left:0;}
+input.span5,textarea.span5{display:inline-block;float:none;width:270px;margin-left:0;}
+input.span6,textarea.span6{display:inline-block;float:none;width:330px;margin-left:0;}
+input.span7,textarea.span7{display:inline-block;float:none;width:390px;margin-left:0;}
+input.span8,textarea.span8{display:inline-block;float:none;width:450px;margin-left:0;}
+input.span9,textarea.span9{display:inline-block;float:none;width:510px;margin-left:0;}
+input.span10,textarea.span10{display:inline-block;float:none;width:570px;margin-left:0;}
+input.span11,textarea.span11{display:inline-block;float:none;width:630px;margin-left:0;}
+input.span12,textarea.span12{display:inline-block;float:none;width:690px;margin-left:0;}
+input.span13,textarea.span13{display:inline-block;float:none;width:750px;margin-left:0;}
+input.span14,textarea.span14{display:inline-block;float:none;width:810px;margin-left:0;}
+input.span15,textarea.span15{display:inline-block;float:none;width:870px;margin-left:0;}
+input.span16,textarea.span16{display:inline-block;float:none;width:930px;margin-left:0;}
+input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{background-color:#f5f5f5;border-color:#ddd;cursor:not-allowed;}
+.actions{background:#f5f5f5;margin-top:18px;margin-bottom:18px;padding:17px 20px 18px 150px;border-top:1px solid #ddd;-webkit-border-radius:0 0 3px 3px;-moz-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;}.actions .secondary-action{float:right;}.actions .secondary-action a{line-height:30px;}.actions .secondary-action a:hover{text-decoration:underline;}
+.help-inline,.help-block{font-size:13px;line-height:18px;color:#bfbfbf;}
+.help-inline{padding-left:5px;*position:relative;*top:-5px;}
+.help-block{display:block;max-width:600px;}
+.inline-inputs{color:#808080;}.inline-inputs span{padding:0 2px 0 1px;}
+.input-prepend input,.input-append input{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;}
+.input-prepend .add-on,.input-append .add-on{position:relative;background:#f5f5f5;border:1px solid #ccc;z-index:2;float:left;display:block;width:auto;min-width:16px;height:18px;padding:4px 4px 4px 5px;margin-right:-1px;font-weight:normal;line-height:18px;color:#bfbfbf;text-align:center;text-shadow:0 1px 0 #ffffff;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;}
+.input-prepend .active,.input-append .active{background:#a9dba9;border-color:#46a546;}
+.input-prepend .add-on{*margin-top:1px;}
+.input-append input{float:left;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;}
+.input-append .add-on{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;margin-right:0;margin-left:-1px;}
+.inputs-list{margin:0 0 5px;width:100%;}.inputs-list li{display:block;padding:0;width:100%;}
+.inputs-list label{display:block;float:none;width:auto;padding:0;margin-left:20px;line-height:18px;text-align:left;white-space:normal;}.inputs-list label strong{color:#808080;}
+.inputs-list label small{font-size:11px;font-weight:normal;}
+.inputs-list .inputs-list{margin-left:25px;margin-bottom:10px;padding-top:0;}
+.inputs-list:first-child{padding-top:6px;}
+.inputs-list li+li{padding-top:2px;}
+.inputs-list input[type=radio],.inputs-list input[type=checkbox]{margin-bottom:0;margin-left:-20px;float:left;}
+.form-stacked{padding-left:20px;}.form-stacked fieldset{padding-top:9px;}
+.form-stacked legend{padding-left:0;}
+.form-stacked label{display:block;float:none;width:auto;font-weight:bold;text-align:left;line-height:20px;padding-top:0;}
+.form-stacked .clearfix{margin-bottom:9px;}.form-stacked .clearfix div.input{margin-left:0;}
+.form-stacked .inputs-list{margin-bottom:0;}.form-stacked .inputs-list li{padding-top:0;}.form-stacked .inputs-list li label{font-weight:normal;padding-top:0;}
+.form-stacked div.clearfix.error{padding-top:10px;padding-bottom:10px;padding-left:10px;margin-top:0;margin-left:-10px;}
+.form-stacked .actions{margin-left:-20px;padding-left:20px;}
+.condensed-table th,.condensed-table td{padding:5px 5px 4px;}
+.bordered-table{border:1px solid #ddd;border-collapse:separate;*border-collapse:collapse;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.bordered-table th+th,.bordered-table td+td,.bordered-table th+td{border-left:1px solid #ddd;}
+.bordered-table thead tr:first-child th:first-child,.bordered-table tbody tr:first-child td:first-child{-webkit-border-radius:4px 0 0 0;-moz-border-radius:4px 0 0 0;border-radius:4px 0 0 0;}
+.bordered-table thead tr:first-child th:last-child,.bordered-table tbody tr:first-child td:last-child{-webkit-border-radius:0 4px 0 0;-moz-border-radius:0 4px 0 0;border-radius:0 4px 0 0;}
+.bordered-table tbody tr:last-child td:first-child{-webkit-border-radius:0 0 0 4px;-moz-border-radius:0 0 0 4px;border-radius:0 0 0 4px;}
+.bordered-table tbody tr:last-child td:last-child{-webkit-border-radius:0 0 4px 0;-moz-border-radius:0 0 4px 0;border-radius:0 0 4px 0;}
+table .span1{width:20px;}
+table .span2{width:60px;}
+table .span3{width:100px;}
+table .span4{width:140px;}
+table .span5{width:180px;}
+table .span6{width:220px;}
+table .span7{width:260px;}
+table .span8{width:300px;}
+table .span9{width:340px;}
+table .span10{width:380px;}
+table .span11{width:420px;}
+table .span12{width:460px;}
+table .span13{width:500px;}
+table .span14{width:540px;}
+table .span15{width:580px;}
+table .span16{width:620px;}
+.zebra-striped tbody tr:nth-child(odd) td,.zebra-striped tbody tr:nth-child(odd) th{background-color:#f9f9f9;}
+.zebra-striped tbody tr:hover td,.zebra-striped tbody tr:hover th{background-color:#f5f5f5;}
+table .header{cursor:pointer;}table .header:after{content:"";float:right;margin-top:7px;border-width:0 4px 4px;border-style:solid;border-color:#000 transparent;visibility:hidden;}
+table .headerSortUp,table .headerSortDown{background-color:rgba(141, 192, 219, 0.25);text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);}
+table .header:hover:after{visibility:visible;}
+table .headerSortDown:after,table .headerSortDown:hover:after{visibility:visible;filter:alpha(opacity=60);-khtml-opacity:0.6;-moz-opacity:0.6;opacity:0.6;}
+table .headerSortUp:after{border-bottom:none;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #000;visibility:visible;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:alpha(opacity=60);-khtml-opacity:0.6;-moz-opacity:0.6;opacity:0.6;}
+table .blue{color:#049cdb;border-bottom-color:#049cdb;}
+table .headerSortUp.blue,table .headerSortDown.blue{background-color:#ade6fe;}
+table .green{color:#46a546;border-bottom-color:#46a546;}
+table .headerSortUp.green,table .headerSortDown.green{background-color:#cdeacd;}
+table .red{color:#9d261d;border-bottom-color:#9d261d;}
+table .headerSortUp.red,table .headerSortDown.red{background-color:#f4c8c5;}
+table .yellow{color:#ffc40d;border-bottom-color:#ffc40d;}
+table .headerSortUp.yellow,table .headerSortDown.yellow{background-color:#fff6d9;}
+table .orange{color:#f89406;border-bottom-color:#f89406;}
+table .headerSortUp.orange,table .headerSortDown.orange{background-color:#fee9cc;}
+table .purple{color:#7a43b6;border-bottom-color:#7a43b6;}
+table .headerSortUp.purple,table .headerSortDown.purple{background-color:#e2d5f0;}
+.topbar{height:40px;position:fixed;top:0;left:0;right:0;z-index:10000;overflow:visible;}.topbar a{color:#bfbfbf;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);}
+.topbar h3 a:hover,.topbar .brand:hover,.topbar ul .active>a{background-color:#333;background-color:rgba(255, 255, 255, 0.05);color:#ffffff;text-decoration:none;}
+.topbar h3{position:relative;}
+.topbar h3 a,.topbar .brand{float:left;display:block;padding:8px 20px 12px;margin-left:-20px;color:#ffffff;font-size:20px;font-weight:200;line-height:1;}
+.topbar p{margin:0;line-height:40px;}.topbar p a:hover{background-color:transparent;color:#ffffff;}
+.topbar form{float:left;margin:5px 0 0 0;position:relative;filter:alpha(opacity=100);-khtml-opacity:1;-moz-opacity:1;opacity:1;}
+.topbar form.pull-right{float:right;}
+.topbar input{background-color:#444;background-color:rgba(255, 255, 255, 0.3);font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:normal;font-weight:13px;line-height:1;padding:4px 9px;color:#ffffff;color:rgba(255, 255, 255, 0.75);border:1px solid #111;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1),0 1px 0px rgba(255, 255, 255, 0.25);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1),0 1px 0px rgba(255, 255, 255, 0.25);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1),0 1px 0px rgba(255, 255, 255, 0.25);-webkit-transition:none;-moz-transition:none;-ms-transition:none;-o-transition:none;transition:none;}.topbar input:-moz-placeholder{color:#e6e6e6;}
+.topbar input::-webkit-input-placeholder{color:#e6e6e6;}
+.topbar input:hover{background-color:#bfbfbf;background-color:rgba(255, 255, 255, 0.5);color:#ffffff;}
+.topbar input:focus,.topbar input.focused{outline:0;background-color:#ffffff;color:#404040;text-shadow:0 1px 0 #ffffff;border:0;padding:5px 10px;-webkit-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);-moz-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);box-shadow:0 0 3px rgba(0, 0, 0, 0.15);}
+.topbar-inner,.topbar .fill{background-color:#222;background-color:#222222;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#333333), to(#222222));background-image:-moz-linear-gradient(top, #333333, #222222);background-image:-ms-linear-gradient(top, #333333, #222222);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #333333), color-stop(100%, #222222));background-image:-webkit-linear-gradient(top, #333333, #222222);background-image:-o-linear-gradient(top, #333333, #222222);background-image:linear-gradient(top, #333333, #222222);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);}
+.topbar div>ul,.nav{display:block;float:left;margin:0 10px 0 0;position:relative;left:0;}.topbar div>ul>li,.nav>li{display:block;float:left;}
+.topbar div>ul a,.nav a{display:block;float:none;padding:10px 10px 11px;line-height:19px;text-decoration:none;}.topbar div>ul a:hover,.nav a:hover{color:#ffffff;text-decoration:none;}
+.topbar div>ul .active>a,.nav .active>a{background-color:#222;background-color:rgba(0, 0, 0, 0.5);}
+.topbar div>ul.secondary-nav,.nav.secondary-nav{float:right;margin-left:10px;margin-right:0;}.topbar div>ul.secondary-nav .menu-dropdown,.nav.secondary-nav .menu-dropdown,.topbar div>ul.secondary-nav .dropdown-menu,.nav.secondary-nav .dropdown-menu{right:0;border:0;}
+.topbar div>ul a.menu:hover,.nav a.menu:hover,.topbar div>ul li.open .menu,.nav li.open .menu,.topbar div>ul .dropdown-toggle:hover,.nav .dropdown-toggle:hover,.topbar div>ul .dropdown.open .dropdown-toggle,.nav .dropdown.open .dropdown-toggle{background:#444;background:rgba(255, 255, 255, 0.05);}
+.topbar div>ul .menu-dropdown,.nav .menu-dropdown,.topbar div>ul .dropdown-menu,.nav .dropdown-menu{background-color:#333;}.topbar div>ul .menu-dropdown a.menu,.nav .menu-dropdown a.menu,.topbar div>ul .dropdown-menu a.menu,.nav .dropdown-menu a.menu,.topbar div>ul .menu-dropdown .dropdown-toggle,.nav .menu-dropdown .dropdown-toggle,.topbar div>ul .dropdown-menu .dropdown-toggle,.nav .dropdown-menu .dropdown-toggle{color:#ffffff;}.topbar div>ul .menu-dropdown a.menu.open,.nav .menu-dropdown a.menu.open,.topbar div>ul .dropdown-menu a.menu.open,.nav .dropdown-menu a.menu.open,.topbar div>ul .menu-dropdown .dropdown-toggle.open,.nav .menu-dropdown .dropdown-toggle.open,.topbar div>ul .dropdown-menu .dropdown-toggle.open,.nav .dropdown-menu .dropdown-toggle.open{background:#444;background:rgba(255, 255, 255, 0.05);}
+.topbar div>ul .menu-dropdown li a,.nav .menu-dropdown li a,.topbar div>ul .dropdown-menu li a,.nav .dropdown-menu li a{color:#999;text-shadow:0 1px 0 rgba(0, 0, 0, 0.5);}.topbar div>ul .menu-dropdown li a:hover,.nav .menu-dropdown li a:hover,.topbar div>ul .dropdown-menu li a:hover,.nav .dropdown-menu li a:hover{background-color:#191919;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#292929), to(#191919));background-image:-moz-linear-gradient(top, #292929, #191919);background-image:-ms-linear-gradient(top, #292929, #191919);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #292929), color-stop(100%, #191919));background-image:-webkit-linear-gradient(top, #292929, #191919);background-image:-o-linear-gradient(top, #292929, #191919);background-image:linear-gradient(top, #292929, #191919);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#292929', endColorstr='#191919', GradientType=0);color:#ffffff;}
+.topbar div>ul .menu-dropdown .active a,.nav .menu-dropdown .active a,.topbar div>ul .dropdown-menu .active a,.nav .dropdown-menu .active a{color:#ffffff;}
+.topbar div>ul .menu-dropdown .divider,.nav .menu-dropdown .divider,.topbar div>ul .dropdown-menu .divider,.nav .dropdown-menu .divider{background-color:#222;border-color:#444;}
+.topbar ul .menu-dropdown li a,.topbar ul .dropdown-menu li a{padding:4px 15px;}
+li.menu,.dropdown{position:relative;}
+a.menu:after,.dropdown-toggle:after{width:0;height:0;display:inline-block;content:"&darr;";text-indent:-99999px;vertical-align:top;margin-top:8px;margin-left:4px;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #ffffff;filter:alpha(opacity=50);-khtml-opacity:0.5;-moz-opacity:0.5;opacity:0.5;}
+.menu-dropdown,.dropdown-menu{background-color:#ffffff;float:left;display:none;position:absolute;top:40px;z-index:900;min-width:160px;max-width:220px;_width:160px;margin-left:0;margin-right:0;padding:6px 0;zoom:1;border-color:#999;border-color:rgba(0, 0, 0, 0.2);border-style:solid;border-width:0 1px 1px;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;-webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 2px 4px rgba(0, 0, 0, 0.2);box-shadow:0 2px 4px rgba(0, 0, 0, 0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;}.menu-dropdown li,.dropdown-menu li{float:none;display:block;background-color:none;}
+.menu-dropdown .divider,.dropdown-menu .divider{height:1px;margin:5px 0;overflow:hidden;background-color:#eee;border-bottom:1px solid #ffffff;}
+.topbar .dropdown-menu a,.dropdown-menu a{display:block;padding:4px 15px;clear:both;font-weight:normal;line-height:18px;color:#808080;text-shadow:0 1px 0 #ffffff;}.topbar .dropdown-menu a:hover,.dropdown-menu a:hover,.topbar .dropdown-menu a.hover,.dropdown-menu a.hover{background-color:#dddddd;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#eeeeee), to(#dddddd));background-image:-moz-linear-gradient(top, #eeeeee, #dddddd);background-image:-ms-linear-gradient(top, #eeeeee, #dddddd);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #eeeeee), color-stop(100%, #dddddd));background-image:-webkit-linear-gradient(top, #eeeeee, #dddddd);background-image:-o-linear-gradient(top, #eeeeee, #dddddd);background-image:linear-gradient(top, #eeeeee, #dddddd);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#dddddd', GradientType=0);color:#404040;text-decoration:none;-webkit-box-shadow:inset 0 1px 0 rgba(0, 0, 0, 0.025),inset 0 -1px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 0 rgba(0, 0, 0, 0.025),inset 0 -1px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 0 rgba(0, 0, 0, 0.025),inset 0 -1px rgba(0, 0, 0, 0.025);}
+.open .menu,.dropdown.open .menu,.open .dropdown-toggle,.dropdown.open .dropdown-toggle{color:#ffffff;background:#ccc;background:rgba(0, 0, 0, 0.3);}
+.open .menu-dropdown,.dropdown.open .menu-dropdown,.open .dropdown-menu,.dropdown.open .dropdown-menu{display:block;}
+.tabs,.pills{margin:0 0 18px;padding:0;list-style:none;zoom:1;}.tabs:before,.pills:before,.tabs:after,.pills:after{display:table;content:"";zoom:1;}
+.tabs:after,.pills:after{clear:both;}
+.tabs>li,.pills>li{float:left;}.tabs>li>a,.pills>li>a{display:block;}
+.tabs{border-color:#ddd;border-style:solid;border-width:0 0 1px;}.tabs>li{position:relative;margin-bottom:-1px;}.tabs>li>a{padding:0 15px;margin-right:2px;line-height:34px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;}.tabs>li>a:hover{text-decoration:none;background-color:#eee;border-color:#eee #eee #ddd;}
+.tabs .active>a,.tabs .active>a:hover{color:#808080;background-color:#ffffff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default;}
+.tabs .menu-dropdown,.tabs .dropdown-menu{top:35px;border-width:1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px;}
+.tabs a.menu:after,.tabs .dropdown-toggle:after{border-top-color:#999;margin-top:15px;margin-left:5px;}
+.tabs li.open.menu .menu,.tabs .open.dropdown .dropdown-toggle{border-color:#999;}
+.tabs li.open a.menu:after,.tabs .dropdown.open .dropdown-toggle:after{border-top-color:#555;}
+.pills a{margin:5px 3px 5px 0;padding:0 15px;line-height:30px;text-shadow:0 1px 1px #ffffff;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;}.pills a:hover{color:#ffffff;text-decoration:none;text-shadow:0 1px 1px rgba(0, 0, 0, 0.25);background-color:#00438a;}
+.pills .active a{color:#ffffff;text-shadow:0 1px 1px rgba(0, 0, 0, 0.25);background-color:#0069d6;}
+.pills-vertical>li{float:none;}
+.tab-content>.tab-pane,.pill-content>.pill-pane,.tab-content>div,.pill-content>div{display:none;}
+.tab-content>.active,.pill-content>.active{display:block;}
+.breadcrumb{padding:7px 14px;margin:0 0 18px;background-color:#f5f5f5;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#ffffff), to(#f5f5f5));background-image:-moz-linear-gradient(top, #ffffff, #f5f5f5);background-image:-ms-linear-gradient(top, #ffffff, #f5f5f5);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(100%, #f5f5f5));background-image:-webkit-linear-gradient(top, #ffffff, #f5f5f5);background-image:-o-linear-gradient(top, #ffffff, #f5f5f5);background-image:linear-gradient(top, #ffffff, #f5f5f5);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f5f5f5', GradientType=0);border:1px solid #ddd;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;}.breadcrumb li{display:inline;text-shadow:0 1px 0 #ffffff;}
+.breadcrumb .divider{padding:0 5px;color:#bfbfbf;}
+.breadcrumb .active a{color:#404040;}
+.hero-unit{background-color:#f5f5f5;margin-bottom:30px;padding:60px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;}.hero-unit h1{margin-bottom:0;font-size:60px;line-height:1;letter-spacing:-1px;}
+.hero-unit p{font-size:18px;font-weight:200;line-height:27px;}
+footer{margin-top:17px;padding-top:17px;border-top:1px solid #eee;}
+.page-header{margin-bottom:17px;border-bottom:1px solid #ddd;-webkit-box-shadow:0 1px 0 rgba(255, 255, 255, 0.5);-moz-box-shadow:0 1px 0 rgba(255, 255, 255, 0.5);box-shadow:0 1px 0 rgba(255, 255, 255, 0.5);}.page-header h1{margin-bottom:8px;}
+.btn.danger,.alert-message.danger,.btn.danger:hover,.alert-message.danger:hover,.btn.error,.alert-message.error,.btn.error:hover,.alert-message.error:hover,.btn.success,.alert-message.success,.btn.success:hover,.alert-message.success:hover,.btn.info,.alert-message.info,.btn.info:hover,.alert-message.info:hover{color:#ffffff;}
+.btn .close,.alert-message .close{font-family:Arial,sans-serif;line-height:18px;}
+.btn.danger,.alert-message.danger,.btn.error,.alert-message.error{background-color:#c43c35;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35));background-image:-moz-linear-gradient(top, #ee5f5b, #c43c35);background-image:-ms-linear-gradient(top, #ee5f5b, #c43c35);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #ee5f5b), color-stop(100%, #c43c35));background-image:-webkit-linear-gradient(top, #ee5f5b, #c43c35);background-image:-o-linear-gradient(top, #ee5f5b, #c43c35);background-image:linear-gradient(top, #ee5f5b, #c43c35);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#c43c35 #c43c35 #882a25;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);}
+.btn.success,.alert-message.success{background-color:#57a957;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#62c462), to(#57a957));background-image:-moz-linear-gradient(top, #62c462, #57a957);background-image:-ms-linear-gradient(top, #62c462, #57a957);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #62c462), color-stop(100%, #57a957));background-image:-webkit-linear-gradient(top, #62c462, #57a957);background-image:-o-linear-gradient(top, #62c462, #57a957);background-image:linear-gradient(top, #62c462, #57a957);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#57a957 #57a957 #3d773d;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);}
+.btn.info,.alert-message.info{background-color:#339bb9;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#5bc0de), to(#339bb9));background-image:-moz-linear-gradient(top, #5bc0de, #339bb9);background-image:-ms-linear-gradient(top, #5bc0de, #339bb9);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #5bc0de), color-stop(100%, #339bb9));background-image:-webkit-linear-gradient(top, #5bc0de, #339bb9);background-image:-o-linear-gradient(top, #5bc0de, #339bb9);background-image:linear-gradient(top, #5bc0de, #339bb9);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#339bb9 #339bb9 #22697d;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);}
+.btn{cursor:pointer;display:inline-block;background-color:#e6e6e6;background-repeat:no-repeat;background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#e6e6e6));background-image:-webkit-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);background-image:-moz-linear-gradient(top, #ffffff, #ffffff 25%, #e6e6e6);background-image:-ms-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);background-image:-o-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);background-image:linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);padding:5px 14px 6px;text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);color:#333;font-size:13px;line-height:normal;border:1px solid #ccc;border-bottom-color:#bbb;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);-webkit-transition:0.1s linear all;-moz-transition:0.1s linear all;-ms-transition:0.1s linear all;-o-transition:0.1s linear all;transition:0.1s linear all;}.btn:hover{background-position:0 -15px;color:#333;text-decoration:none;}
+.btn:focus{outline:1px dotted #666;}
+.btn.primary{color:#ffffff;background-color:#0064cd;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#049cdb), to(#0064cd));background-image:-moz-linear-gradient(top, #049cdb, #0064cd);background-image:-ms-linear-gradient(top, #049cdb, #0064cd);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #049cdb), color-stop(100%, #0064cd));background-image:-webkit-linear-gradient(top, #049cdb, #0064cd);background-image:-o-linear-gradient(top, #049cdb, #0064cd);background-image:linear-gradient(top, #049cdb, #0064cd);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#049cdb', endColorstr='#0064cd', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#0064cd #0064cd #003f81;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);}
+.btn.active,.btn :active{-webkit-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.25),0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.25),0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.25),0 1px 2px rgba(0, 0, 0, 0.05);}
+.btn.disabled{cursor:default;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=65);-khtml-opacity:0.65;-moz-opacity:0.65;opacity:0.65;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;}
+.btn[disabled]{cursor:default;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=65);-khtml-opacity:0.65;-moz-opacity:0.65;opacity:0.65;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;}
+.btn.large{font-size:15px;line-height:normal;padding:9px 14px 9px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;}
+.btn.small{padding:7px 9px 7px;font-size:11px;}
+:root .alert-message,:root .btn{border-radius:0 \0;}
+button.btn::-moz-focus-inner,input[type=submit].btn::-moz-focus-inner{padding:0;border:0;}
+.close{float:right;color:#000000;font-size:20px;font-weight:bold;line-height:13.5px;text-shadow:0 1px 0 #ffffff;filter:alpha(opacity=25);-khtml-opacity:0.25;-moz-opacity:0.25;opacity:0.25;}.close:hover{color:#000000;text-decoration:none;filter:alpha(opacity=40);-khtml-opacity:0.4;-moz-opacity:0.4;opacity:0.4;}
+.alert-message{position:relative;padding:7px 15px;margin-bottom:18px;color:#404040;background-color:#eedc94;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#fceec1), to(#eedc94));background-image:-moz-linear-gradient(top, #fceec1, #eedc94);background-image:-ms-linear-gradient(top, #fceec1, #eedc94);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #fceec1), color-stop(100%, #eedc94));background-image:-webkit-linear-gradient(top, #fceec1, #eedc94);background-image:-o-linear-gradient(top, #fceec1, #eedc94);background-image:linear-gradient(top, #fceec1, #eedc94);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fceec1', endColorstr='#eedc94', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#eedc94 #eedc94 #e4c652;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);border-width:1px;border-style:solid;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.25);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.25);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.25);}.alert-message .close{margin-top:1px;*margin-top:0;}
+.alert-message a{font-weight:bold;color:#404040;}
+.alert-message.danger p a,.alert-message.error p a,.alert-message.success p a,.alert-message.info p a{color:#ffffff;}
+.alert-message h5{line-height:18px;}
+.alert-message p{margin-bottom:0;}
+.alert-message div{margin-top:5px;margin-bottom:2px;line-height:28px;}
+.alert-message .btn{-webkit-box-shadow:0 1px 0 rgba(255, 255, 255, 0.25);-moz-box-shadow:0 1px 0 rgba(255, 255, 255, 0.25);box-shadow:0 1px 0 rgba(255, 255, 255, 0.25);}
+.alert-message.block-message{background-image:none;background-color:#fdf5d9;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);padding:14px;border-color:#fceec1;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;}.alert-message.block-message ul,.alert-message.block-message p{margin-right:30px;}
+.alert-message.block-message ul{margin-bottom:0;}
+.alert-message.block-message li{color:#404040;}
+.alert-message.block-message .alert-actions{margin-top:5px;}
+.alert-message.block-message.error,.alert-message.block-message.success,.alert-message.block-message.info{color:#404040;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);}
+.alert-message.block-message.error{background-color:#fddfde;border-color:#fbc7c6;}
+.alert-message.block-message.success{background-color:#d1eed1;border-color:#bfe7bf;}
+.alert-message.block-message.info{background-color:#ddf4fb;border-color:#c6edf9;}
+.alert-message.block-message.danger p a,.alert-message.block-message.error p a,.alert-message.block-message.success p a,.alert-message.block-message.info p a{color:#404040;}
+.pagination{height:36px;margin:18px 0;}.pagination ul{float:left;margin:0;border:1px solid #ddd;border:1px solid rgba(0, 0, 0, 0.15);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);}
+.pagination li{display:inline;}
+.pagination a{float:left;padding:0 14px;line-height:34px;border-right:1px solid;border-right-color:#ddd;border-right-color:rgba(0, 0, 0, 0.15);*border-right-color:#ddd;text-decoration:none;}
+.pagination a:hover,.pagination .active a{background-color:#c7eefe;}
+.pagination .disabled a,.pagination .disabled a:hover{background-color:transparent;color:#bfbfbf;}
+.pagination .next a{border:0;}
+.well{background-color:#f5f5f5;margin-bottom:20px;padding:19px;min-height:20px;border:1px solid #eee;border:1px solid rgba(0, 0, 0, 0.05);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);}.well blockquote{border-color:#ddd;border-color:rgba(0, 0, 0, 0.15);}
+.modal-backdrop{background-color:#000000;position:fixed;top:0;left:0;right:0;bottom:0;z-index:10000;}.modal-backdrop.fade{opacity:0;}
+.modal-backdrop,.modal-backdrop.fade.in{filter:alpha(opacity=80);-khtml-opacity:0.8;-moz-opacity:0.8;opacity:0.8;}
+.modal{position:fixed;top:50%;left:50%;z-index:11000;width:560px;margin:-250px 0 0 -280px;background-color:#ffffff;border:1px solid #999;border:1px solid rgba(0, 0, 0, 0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;}.modal .close{margin-top:7px;}
+.modal.fade{-webkit-transition:opacity .3s linear, top .3s ease-out;-moz-transition:opacity .3s linear, top .3s ease-out;-ms-transition:opacity .3s linear, top .3s ease-out;-o-transition:opacity .3s linear, top .3s ease-out;transition:opacity .3s linear, top .3s ease-out;top:-25%;}
+.modal.fade.in{top:50%;}
+.modal-header{border-bottom:1px solid #eee;padding:5px 15px;}
+.modal-body{padding:15px;}
+.modal-body form{margin-bottom:0;}
+.modal-footer{background-color:#f5f5f5;padding:14px 15px 15px;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;zoom:1;margin-bottom:0;}.modal-footer:before,.modal-footer:after{display:table;content:"";zoom:1;}
+.modal-footer:after{clear:both;}
+.modal-footer .btn{float:right;margin-left:5px;}
+.modal .popover,.modal .twipsy{z-index:12000;}
+.twipsy{display:block;position:absolute;visibility:visible;padding:5px;font-size:11px;z-index:1000;filter:alpha(opacity=80);-khtml-opacity:0.8;-moz-opacity:0.8;opacity:0.8;}.twipsy.fade.in{filter:alpha(opacity=80);-khtml-opacity:0.8;-moz-opacity:0.8;opacity:0.8;}
+.twipsy.above .twipsy-arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;}
+.twipsy.left .twipsy-arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;}
+.twipsy.below .twipsy-arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;}
+.twipsy.right .twipsy-arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;}
+.twipsy-inner{padding:3px 8px;background-color:#000000;color:white;text-align:center;max-width:200px;text-decoration:none;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
+.twipsy-arrow{position:absolute;width:0;height:0;}
+.popover{position:absolute;top:0;left:0;z-index:1000;padding:5px;display:none;}.popover.above .arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;}
+.popover.right .arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;}
+.popover.below .arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;}
+.popover.left .arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;}
+.popover .arrow{position:absolute;width:0;height:0;}
+.popover .inner{background:#000000;background:rgba(0, 0, 0, 0.8);padding:3px;overflow:hidden;width:280px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);}
+.popover .title{background-color:#f5f5f5;padding:9px 15px;line-height:1;-webkit-border-radius:3px 3px 0 0;-moz-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;border-bottom:1px solid #eee;}
+.popover .content{background-color:#ffffff;padding:14px;-webkit-border-radius:0 0 3px 3px;-moz-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;}.popover .content p,.popover .content ul,.popover .content ol{margin-bottom:0;}
+.fade{-webkit-transition:opacity 0.15s linear;-moz-transition:opacity 0.15s linear;-ms-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear;opacity:0;}.fade.in{opacity:1;}
+.label{padding:1px 3px 2px;font-size:9.75px;font-weight:bold;color:#ffffff;text-transform:uppercase;white-space:nowrap;background-color:#bfbfbf;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}.label.important{background-color:#c43c35;}
+.label.warning{background-color:#f89406;}
+.label.success{background-color:#46a546;}
+.label.notice{background-color:#62cffc;}
+.media-grid{margin-left:-20px;margin-bottom:0;zoom:1;}.media-grid:before,.media-grid:after{display:table;content:"";zoom:1;}
+.media-grid:after{clear:both;}
+.media-grid li{display:inline;}
+.media-grid a{float:left;padding:4px;margin:0 0 18px 20px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);}.media-grid a img{display:block;}
+.media-grid a:hover{border-color:#0069d6;-webkit-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);-moz-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/custom.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/custom.css
new file mode 100644
index 00000000..b7df8c25
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/custom.css
@@ -0,0 +1,97 @@
+body, html, div, p, span, a, h1, h2, h3, h4, h5{
+ margin : 0;
+ padding : 0;
+}
+
+body, html{
+ width : 100%;
+}
+
+body{
+ color : white;
+ font-family : tahoma;
+ font-weight : lighter;
+ padding-top : 40px;
+}
+
+ body p{
+ font-size : 14px;
+ }
+
+ body p a{
+ font-size : 16px;
+ }
+
+h1 {
+ color : #E05E00;
+ font-style : italic;
+}
+
+a{
+ color : #E05E00;
+ text-decoration : none;
+}
+
+a:hover{
+ text-decoration : underline;
+}
+
+/* general */
+.clear {
+ clear: both;
+}
+
+/* Header */
+.brand{
+ color : #E05E00 !important;
+ font-family : georgia;
+ font-style : italic;
+}
+
+/* list stuff */
+#org{
+ background-color : white;
+ margin : 10px;
+ padding : 10px;
+}
+
+#show-list{
+ cursor : pointer;
+}
+
+/* bootstrap overrides */
+.alert-message{
+ margin: 2px 0;
+}
+
+.topbar{
+ position : absolute;
+}
+
+/* Custom chart styling */
+.jOrgChart {
+ margin : 10px;
+ padding : 20px;
+}
+
+/* Custom node styling */
+.jOrgChart .node {
+ font-weight : bold;
+ font-size : 14px;
+ background-color : #D5D6DB;
+ border-radius : 8px;
+ border : 5px solid gray;
+ color : #793a06;
+ -moz-border-radius : 8px;
+}
+ .node p{
+ font-family : tahoma;
+ font-size : 10px;
+ line-height : 11px;
+ padding : 2px;
+ }
+
+table {
+ margin-left: auto;
+ margin-right: auto;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/jquery.jOrgChart.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/jquery.jOrgChart.css
new file mode 100644
index 00000000..ffabe274
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/jquery.jOrgChart.css
@@ -0,0 +1,51 @@
+/* Basic styling */
+/* Draw the lines */
+.jOrgChart .line {
+ height : 20px;
+ width : 4px;
+}
+
+.jOrgChart .down {
+ background-color : black;
+ margin : 0px auto;
+}
+
+.jOrgChart .top {
+ border-top : 3px solid black;
+}
+
+.jOrgChart .left {
+ border-right : 2px solid black;
+}
+
+.jOrgChart .right {
+ border-left : 2px solid black;
+}
+
+/* node cell */
+.jOrgChart td {
+ text-align : center;
+ vertical-align : top;
+ padding : 0;
+}
+
+/* The node */
+.jOrgChart .node {
+ background-color : #35363B;
+ display : inline-block;
+ width : 120px;
+ height : 60px;
+ z-index : 10;
+ margin : 0 2px;
+}
+
+/* jQuery drag 'n drop */
+
+.drag-active {
+ border-style : dashed !important;
+}
+
+.drop-hover {
+ border-style : solid !important;
+ border-color : #E05E00 !important;
+}
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/prettify.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/prettify.css
new file mode 100644
index 00000000..d44b3a22
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/prettify.css
@@ -0,0 +1 @@
+.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example.html
new file mode 100644
index 00000000..543b0f92
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example.html
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>jOrgChart - A jQuery OrgChart Plugin</title>
+ <link rel="stylesheet" href="css/bootstrap.min.css"/>
+ <link rel="stylesheet" href="css/jquery.jOrgChart.css"/>
+ <link rel="stylesheet" href="css/custom.css"/>
+ <link href="css/prettify.css" type="text/css" rel="stylesheet" />
+
+ <script type="text/javascript" src="prettify.js"></script>
+
+ <!-- jQuery includes -->
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
+
+ <script src="jquery.jOrgChart.js"></script>
+
+ <script>
+ jQuery(document).ready(function() {
+ $("#org").jOrgChart({
+ chartElement : '#chart',
+ dragAndDrop : true
+ });
+ });
+ </script>
+ </head>
+
+ <body onload="prettyPrint();">
+ <ul id="org" style="display:none">
+ <li>Product 1<br/>
+ <ul>
+ <li>Service 1<br/>
+ <ul>
+ <li>Resource 1<br/></li>
+ <li>Resource 2<br/></li>
+ <li>Resource 3<br/></li>
+ <li>Resource 4<br/></li>
+ <li>Resource 5<br/></li>
+ </ul>
+ </li>
+ <li>Service 6<br/></li>
+ <li>Service 7<br/>
+ <ul>
+ <li>Resource 8<br/></li>
+ <li>Resource 9<br/></li>
+ <li>Resource 10<br/></li>
+ <li>Resource 11<br/></li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+
+ <div id="chart" class="orgChart"></div>
+
+ <script>
+ jQuery(document).ready(function() {
+
+ /* Custom jQuery for the example */
+ $("#show-list").click(function(e){
+ e.preventDefault();
+
+ $('#list-html').toggle('fast', function(){
+ if($(this).is(':visible')){
+ $('#show-list').text('Hide underlying list.');
+ $(".topbar").fadeTo('fast',0.9);
+ }else{
+ $('#show-list').text('Show underlying list.');
+ $(".topbar").fadeTo('fast',1);
+ }
+ });
+ });
+
+ $('#list-html').text($('#org').html());
+
+ $("#org").bind("DOMSubtreeModified", function() {
+ $('#list-html').text('');
+
+ $('#list-html').text($('#org').html());
+
+ prettyPrint();
+ });
+ });
+ </script>
+</body>
+</html> \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example_vsp.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example_vsp.html
new file mode 100644
index 00000000..a2e3703d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example_vsp.html
@@ -0,0 +1,88 @@
+<!DOCTYPE html>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>jOrgChart - A jQuery OrgChart Plugin</title>
+ <link rel="stylesheet" href="css/bootstrap.min.css"/>
+ <link rel="stylesheet" href="css/jquery.jOrgChart.css"/>
+ <link rel="stylesheet" href="css/custom.css"/>
+ <link href="css/prettify.css" type="text/css" rel="stylesheet" />
+
+ <script type="text/javascript" src="prettify.js"></script>
+
+ <!-- jQuery includes -->
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
+
+ <script src="jquery.jOrgChart.js"></script>
+
+ <script>
+ jQuery(document).ready(function() {
+ $("#org").jOrgChart({
+ chartElement : '#chart',
+ dragAndDrop : true
+ });
+ });
+ </script>
+ </head>
+
+ <body onload="prettyPrint();">
+ <ul id="org" style="display:none">
+ <li>Trinity<br/>
+ <ul>
+ <li>Call Forwarding<br/>
+ <ul>
+ <li>Call Forwarding Busy<br/></li>
+ <li>Call Forwarding Always<br/></li>
+ <li>Call Forwarding Not Reachable<br/></li>
+ </ul>
+ </li>
+ <li>Dial Restrictions<br/>
+ <ul>
+ <li>Outgoing Calls<br/></li>
+ <li>Redirecting Calls<br/></li>
+ <li>Incoming Calls<br/></li>
+ </ul>
+ </li>
+ <li>Messaging<br/>
+ <ul>
+ <li>Voice Management<br/></li>
+ <li>Greetings<br/></li>
+ <li>Fax Messaging<br/></li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+
+ <div id="chart" class="orgChart"></div>
+
+ <script>
+ jQuery(document).ready(function() {
+
+ /* Custom jQuery for the example */
+ $("#show-list").click(function(e){
+ e.preventDefault();
+
+ $('#list-html').toggle('fast', function(){
+ if($(this).is(':visible')){
+ $('#show-list').text('Hide underlying list.');
+ $(".topbar").fadeTo('fast',0.9);
+ }else{
+ $('#show-list').text('Show underlying list.');
+ $(".topbar").fadeTo('fast',1);
+ }
+ });
+ });
+
+ $('#list-html').text($('#org').html());
+
+ $("#org").bind("DOMSubtreeModified", function() {
+ $('#list-html').text('');
+
+ $('#list-html').text($('#org').html());
+
+ prettyPrint();
+ });
+ });
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/bkgd.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/bkgd.png
new file mode 100644
index 00000000..3bbaf5ee
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/bkgd.png
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/raspberry.jpg b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/raspberry.jpg
new file mode 100644
index 00000000..e79a0515
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/raspberry.jpg
Binary files differ
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/jquery.jOrgChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/jquery.jOrgChart.js
new file mode 100644
index 00000000..89411b29
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/jquery.jOrgChart.js
@@ -0,0 +1,267 @@
+/**
+ * jQuery org-chart/tree plugin.
+ *
+ * Author: Wes Nolte
+ * http://twitter.com/wesnolte
+ *
+ * Based on the work of Mark Lee
+ * http://www.capricasoftware.co.uk
+ *
+ * Copyright (c) 2011 Wesley Nolte
+ * Dual licensed under the MIT and GPL licenses.
+ *
+ */
+(function($) {
+
+ $.fn.jOrgChart = function(options) {
+ var opts = $.extend({}, $.fn.jOrgChart.defaults, options);
+ var $appendTo = $(opts.chartElement);
+
+ // build the tree
+ $this = $(this);
+ var $container = $("<div class='" + opts.chartClass + "'/>");
+ if($this.is("ul")) {
+ buildNode($this.find("li:first"), $container, 0, opts);
+ }
+ else if($this.is("li")) {
+ buildNode($this, $container, 0, opts);
+ }
+ $appendTo.append($container);
+
+ // add drag and drop if enabled
+ if(opts.dragAndDrop){
+ $('div.node').draggable({
+ cursor : 'move',
+ distance : 40,
+ helper : 'clone',
+ opacity : 0.8,
+ revert : true,
+ revertDuration : 100,
+ snap : 'div.node.expanded',
+ snapMode : 'inner',
+ stack : 'div.node'
+ });
+
+ $('div.node').droppable({
+ accept : '.node',
+ activeClass : 'drag-active',
+ hoverClass : 'drop-hover'
+ });
+
+ // Drag start event handler for nodes
+ $('div.node').bind("dragstart", function handleDragStart( event, ui ){
+
+ var sourceNode = $(this);
+ sourceNode.parentsUntil('.node-container')
+ .find('*')
+ .filter('.node')
+ .droppable('disable');
+ });
+
+ // Drag stop event handler for nodes
+ $('div.node').bind("dragstop", function handleDragStop( event, ui ){
+
+ /* reload the plugin */
+ $(opts.chartElement).children().remove();
+ $this.jOrgChart(opts);
+ });
+
+ // Drop event handler for nodes
+ $('div.node').bind("drop", function handleDropEvent( event, ui ) {
+ var sourceNode = ui.draggable;
+ var targetNode = $(this);
+
+ // finding nodes based on plaintext and html
+ // content is hard!
+ var targetLi = $('li').filter(function(){
+
+ li = $(this).clone()
+ .children("ul,li")
+ .remove()
+ .end();
+ var attr = li.attr('id');
+ if (typeof attr !== 'undefined' && attr !== false) {
+ return li.attr("id") == targetNode.attr("id");
+ }
+ else {
+ return li.html() == targetNode.html();
+ }
+
+ });
+
+ var sourceLi = $('li').filter(function(){
+
+ li = $(this).clone()
+ .children("ul,li")
+ .remove()
+ .end();
+ var attr = li.attr('id');
+ if (typeof attr !== 'undefined' && attr !== false) {
+ return li.attr("id") == sourceNode.attr("id");
+ }
+ else {
+ return li.html() == sourceNode.html();
+ }
+
+ });
+
+ var sourceliClone = sourceLi.clone();
+ var sourceUl = sourceLi.parent('ul');
+
+ if(sourceUl.children('li').size() > 1){
+ sourceLi.remove();
+ }else{
+ sourceUl.remove();
+ }
+
+ var id = sourceLi.attr("id");
+
+ if(targetLi.children('ul').size() >0){
+ if (typeof id !== 'undefined' && id !== false) {
+ targetLi.children('ul').append('<li id="'+id+'">'+sourceliClone.html()+'</li>');
+ }else{
+ targetLi.children('ul').append('<li>'+sourceliClone.html()+'</li>');
+ }
+ }else{
+ if (typeof id !== 'undefined' && id !== false) {
+ targetLi.append('<ul><li id="'+id+'">'+sourceliClone.html()+'</li></ul>');
+ }else{
+ targetLi.append('<ul><li>'+sourceliClone.html()+'</li></ul>');
+ }
+ }
+
+ }); // handleDropEvent
+
+ } // Drag and drop
+ };
+
+ // Option defaults
+ $.fn.jOrgChart.defaults = {
+ chartElement : 'body',
+ depth : -1,
+ chartClass : "jOrgChart",
+ dragAndDrop: false
+ };
+
+ // Method that recursively builds the tree
+ function buildNode($node, $appendTo, level, opts) {
+ var $table = $("<table cellpadding='0' cellspacing='0' border='0'/>");
+ var $tbody = $("<tbody/>");
+
+ // Construct the node container(s)
+ var $nodeRow = $("<tr/>").addClass("node-cells");
+ var $nodeCell = $("<td/>").addClass("node-cell").attr("colspan", 2);
+ var $childNodes = $node.children("ul:first").children("li");
+ var $nodeDiv;
+
+ if($childNodes.length > 1) {
+ $nodeCell.attr("colspan", $childNodes.length * 2);
+ }
+ // Draw the node
+ // Get the contents - any markup except li and ul allowed
+ var $nodeContent = $node.clone()
+ .children("ul,li")
+ .remove()
+ .end()
+ .html();
+
+ var new_node_id = $node.attr("id");
+ if (typeof new_node_id !== 'undefined' && new_node_id !== false) {
+ $nodeDiv = $("<div>").addClass("node").attr("id", $node.attr("id")).append($nodeContent);
+ }else{
+ $nodeDiv = $("<div>").addClass("node").append($nodeContent);
+ }
+
+ // Expand and contract nodes
+ if ($childNodes.length > 0) {
+ $nodeDiv.click(function() {
+ var $this = $(this);
+ var $tr = $this.closest("tr");
+
+ if($tr.hasClass('contracted')){
+ $this.css('cursor','n-resize');
+ $tr.removeClass('contracted').addClass('expanded');
+ $tr.nextAll("tr").css('visibility', '');
+ }else{
+ $this.css('cursor','s-resize');
+ $tr.removeClass('expanded').addClass('contracted');
+ $tr.nextAll("tr").css('visibility', 'hidden');
+ }
+ });
+ }
+
+ $nodeCell.append($nodeDiv);
+ $nodeRow.append($nodeCell);
+ $tbody.append($nodeRow);
+
+ if($childNodes.length > 0) {
+ // if it can be expanded then change the cursor
+ $nodeDiv.css('cursor','n-resize').addClass('expanded');
+
+ // recurse until leaves found (-1) or to the level specified
+ if(opts.depth == -1 || (level+1 < opts.depth)) {
+ var $downLineRow = $("<tr/>");
+ var $downLineCell = $("<td/>").attr("colspan", $childNodes.length*2);
+ $downLineRow.append($downLineCell);
+
+ // draw the connecting line from the parent node to the horizontal line
+ $downLine = $("<div></div>").addClass("line down");
+ $downLineCell.append($downLine);
+ $tbody.append($downLineRow);
+
+ // Draw the horizontal lines
+ var $linesRow = $("<tr/>");
+ $childNodes.each(function() {
+ var $left = $("<td>&nbsp;</td>").addClass("line left top");
+ var $right = $("<td>&nbsp;</td>").addClass("line right top");
+ $linesRow.append($left).append($right);
+ });
+
+ // horizontal line shouldn't extend beyond the first and last child branches
+ $linesRow.find("td:first")
+ .removeClass("top")
+ .end()
+ .find("td:last")
+ .removeClass("top");
+
+ $tbody.append($linesRow);
+ var $childNodesRow = $("<tr/>");
+ $childNodes.each(function() {
+ var $td = $("<td class='node-container'/>");
+ $td.attr("colspan", 2);
+ // recurse through children lists and items
+ buildNode($(this), $td, level+1, opts);
+ $childNodesRow.append($td);
+ });
+
+ }
+ $tbody.append($childNodesRow);
+ }
+
+ // any classes on the LI element get copied to the relevant node in the tree
+ // apart from the special 'collapsed' class, which collapses the sub-tree at this point
+ if ($node.attr('class') != undefined) {
+ var classList = $node.attr('class').split(/\s+/);
+ $.each(classList, function(index,item) {
+ if (item == 'collapsed') {
+ $nodeRow.nextAll('tr').css('display', 'none');
+ $nodeRow.removeClass('expanded');
+ $nodeRow.addClass('contracted');
+ $nodeDiv.css('cursor','s-resize');
+ } else {
+ $nodeDiv.addClass(item);
+ }
+ });
+ }
+
+ $table.append($tbody);
+ $appendTo.append($table);
+
+ /* Prevent trees collapsing if a link inside a node is clicked */
+ $nodeDiv.children('a').click(function(e){
+ console.log(e);
+ e.stopPropagation();
+ });
+ };
+
+})(jQuery);
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/prettify.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/prettify.js
new file mode 100644
index 00000000..eef5ad7e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/prettify.js
@@ -0,0 +1,28 @@
+var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
+(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
+[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
+f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
+(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
+{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
+t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
+"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
+l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
+q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
+q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
+"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
+a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
+for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
+m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
+a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
+j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
+"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
+H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
+J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
+I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
+["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
+/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
+["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
+hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
+!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
+250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
+PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery-1.10.2.js b/ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery-1.10.2.js
new file mode 100644
index 00000000..c5c64825
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery-1.10.2.js
@@ -0,0 +1,9789 @@
+/*!
+ * jQuery JavaScript Library v1.10.2
+ * http://jquery.com/
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ *
+ * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2013-07-03T13:48Z
+ */
+(function( window, undefined ) {
+
+// Can't do this because several apps including ASP.NET trace
+// the stack via arguments.caller.callee and Firefox dies if
+// you try to trace through "use strict" call chains. (#13335)
+// Support: Firefox 18+
+//"use strict";
+var
+ // The deferred used on DOM ready
+ readyList,
+
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // Support: IE<10
+ // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
+ core_strundefined = typeof undefined,
+
+ // Use the correct document accordingly with window argument (sandbox)
+ location = window.location,
+ document = window.document,
+ docElem = document.documentElement,
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // [[Class]] -> type pairs
+ class2type = {},
+
+ // List of deleted data cache ids, so we can reuse them
+ core_deletedIds = [],
+
+ core_version = "1.10.2",
+
+ // Save a reference to some core methods
+ core_concat = core_deletedIds.concat,
+ core_push = core_deletedIds.push,
+ core_slice = core_deletedIds.slice,
+ core_indexOf = core_deletedIds.indexOf,
+ core_toString = class2type.toString,
+ core_hasOwn = class2type.hasOwnProperty,
+ core_trim = core_version.trim,
+
+ // Define a local copy of jQuery
+ jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context, rootjQuery );
+ },
+
+ // Used for matching numbers
+ core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
+
+ // Used for splitting on whitespace
+ core_rnotwhite = /\S+/g,
+
+ // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
+
+ // A simple way to check for HTML strings
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
+ // Strict HTML recognition (#11290: must start with <)
+ rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
+
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
+
+ // Matches dashed string for camelizing
+ rmsPrefix = /^-ms-/,
+ rdashAlpha = /-([\da-z])/gi,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return letter.toUpperCase();
+ },
+
+ // The ready event handler
+ completed = function( event ) {
+
+ // readyState === "complete" is good enough for us to call the dom ready in oldIE
+ if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
+ detach();
+ jQuery.ready();
+ }
+ },
+ // Clean-up method for dom ready events
+ detach = function() {
+ if ( document.addEventListener ) {
+ document.removeEventListener( "DOMContentLoaded", completed, false );
+ window.removeEventListener( "load", completed, false );
+
+ } else {
+ document.detachEvent( "onreadystatechange", completed );
+ window.detachEvent( "onload", completed );
+ }
+ };
+
+jQuery.fn = jQuery.prototype = {
+ // The current version of jQuery being used
+ jquery: core_version,
+
+ constructor: jQuery,
+ init: function( selector, context, rootjQuery ) {
+ var match, elem;
+
+ // HANDLE: $(""), $(null), $(undefined), $(false)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+ // Assume that strings that start and end with <> are HTML and skip the regex check
+ match = [ null, selector, null ];
+
+ } else {
+ match = rquickExpr.exec( selector );
+ }
+
+ // Match html or make sure no context is specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ context = context instanceof jQuery ? context[0] : context;
+
+ // scripts is true for back-compat
+ jQuery.merge( this, jQuery.parseHTML(
+ match[1],
+ context && context.nodeType ? context.ownerDocument || context : document,
+ true
+ ) );
+
+ // HANDLE: $(html, props)
+ if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
+ for ( match in context ) {
+ // Properties of context are called as methods if possible
+ if ( jQuery.isFunction( this[ match ] ) ) {
+ this[ match ]( context[ match ] );
+
+ // ...and otherwise set as attributes
+ } else {
+ this.attr( match, context[ match ] );
+ }
+ }
+ }
+
+ return this;
+
+ // HANDLE: $(#id)
+ } else {
+ elem = document.getElementById( match[2] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return ( context || rootjQuery ).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return this.constructor( context ).find( selector );
+ }
+
+ // HANDLE: $(DOMElement)
+ } else if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
+
+ if ( selector.selector !== undefined ) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.makeArray( selector, this );
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ toArray: function() {
+ return core_slice.call( this );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == null ?
+
+ // Return a 'clean' array
+ this.toArray() :
+
+ // Return just the object
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems ) {
+
+ // Build a new jQuery matched element set
+ var ret = jQuery.merge( this.constructor(), elems );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+ ret.context = this.context;
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ ready: function( fn ) {
+ // Add the callback
+ jQuery.ready.promise().done( fn );
+
+ return this;
+ },
+
+ slice: function() {
+ return this.pushStack( core_slice.apply( this, arguments ) );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ eq: function( i ) {
+ var len = this.length,
+ j = +i + ( i < 0 ? len : 0 );
+ return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ end: function() {
+ return this.prevObject || this.constructor(null);
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: core_push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+ var src, copyIsArray, copy, name, options, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
+
+ // extend jQuery itself if only one argument is passed
+ if ( length === i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && jQuery.isArray(src) ? src : [];
+
+ } else {
+ clone = src && jQuery.isPlainObject(src) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend({
+ // Unique for each copy of jQuery on the page
+ // Non-digits removed to match rinlinejQuery
+ expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
+
+ noConflict: function( deep ) {
+ if ( window.$ === jQuery ) {
+ window.$ = _$;
+ }
+
+ if ( deep && window.jQuery === jQuery ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
+ },
+
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // A counter to track how many items to wait for before
+ // the ready event fires. See #6781
+ readyWait: 1,
+
+ // Hold (or release) the ready event
+ holdReady: function( hold ) {
+ if ( hold ) {
+ jQuery.readyWait++;
+ } else {
+ jQuery.ready( true );
+ }
+ },
+
+ // Handle when the DOM is ready
+ ready: function( wait ) {
+
+ // Abort if there are pending holds or we're already ready
+ if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
+ return;
+ }
+
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready );
+ }
+
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If a normal DOM Ready event fired, decrement, and wait if need be
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
+ return;
+ }
+
+ // If there are functions bound, to execute
+ readyList.resolveWith( document, [ jQuery ] );
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger("ready").off("ready");
+ }
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return jQuery.type(obj) === "function";
+ },
+
+ isArray: Array.isArray || function( obj ) {
+ return jQuery.type(obj) === "array";
+ },
+
+ isWindow: function( obj ) {
+ /* jshint eqeqeq: false */
+ return obj != null && obj == obj.window;
+ },
+
+ isNumeric: function( obj ) {
+ return !isNaN( parseFloat(obj) ) && isFinite( obj );
+ },
+
+ type: function( obj ) {
+ if ( obj == null ) {
+ return String( obj );
+ }
+ return typeof obj === "object" || typeof obj === "function" ?
+ class2type[ core_toString.call(obj) ] || "object" :
+ typeof obj;
+ },
+
+ isPlainObject: function( obj ) {
+ var key;
+
+ // Must be an Object.
+ // Because of IE, we also have to check the presence of the constructor property.
+ // Make sure that DOM nodes and window objects don't pass through, as well
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ try {
+ // Not own constructor property must be Object
+ if ( obj.constructor &&
+ !core_hasOwn.call(obj, "constructor") &&
+ !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+ } catch ( e ) {
+ // IE8,9 Will throw exceptions on certain host objects #9897
+ return false;
+ }
+
+ // Support: IE<9
+ // Handle iteration over inherited properties before own properties.
+ if ( jQuery.support.ownLast ) {
+ for ( key in obj ) {
+ return core_hasOwn.call( obj, key );
+ }
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+ for ( key in obj ) {}
+
+ return key === undefined || core_hasOwn.call( obj, key );
+ },
+
+ isEmptyObject: function( obj ) {
+ var name;
+ for ( name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ error: function( msg ) {
+ throw new Error( msg );
+ },
+
+ // data: string of html
+ // context (optional): If specified, the fragment will be created in this context, defaults to document
+ // keepScripts (optional): If true, will include scripts passed in the html string
+ parseHTML: function( data, context, keepScripts ) {
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ if ( typeof context === "boolean" ) {
+ keepScripts = context;
+ context = false;
+ }
+ context = context || document;
+
+ var parsed = rsingleTag.exec( data ),
+ scripts = !keepScripts && [];
+
+ // Single tag
+ if ( parsed ) {
+ return [ context.createElement( parsed[1] ) ];
+ }
+
+ parsed = jQuery.buildFragment( [ data ], context, scripts );
+ if ( scripts ) {
+ jQuery( scripts ).remove();
+ }
+ return jQuery.merge( [], parsed.childNodes );
+ },
+
+ parseJSON: function( data ) {
+ // Attempt to parse using the native JSON parser first
+ if ( window.JSON && window.JSON.parse ) {
+ return window.JSON.parse( data );
+ }
+
+ if ( data === null ) {
+ return data;
+ }
+
+ if ( typeof data === "string" ) {
+
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
+ data = jQuery.trim( data );
+
+ if ( data ) {
+ // Make sure the incoming data is actual JSON
+ // Logic borrowed from http://json.org/json2.js
+ if ( rvalidchars.test( data.replace( rvalidescape, "@" )
+ .replace( rvalidtokens, "]" )
+ .replace( rvalidbraces, "")) ) {
+
+ return ( new Function( "return " + data ) )();
+ }
+ }
+ }
+
+ jQuery.error( "Invalid JSON: " + data );
+ },
+
+ // Cross-browser xml parsing
+ parseXML: function( data ) {
+ var xml, tmp;
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ try {
+ if ( window.DOMParser ) { // Standard
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } else { // IE
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
+ xml.async = "false";
+ xml.loadXML( data );
+ }
+ } catch( e ) {
+ xml = undefined;
+ }
+ if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
+ jQuery.error( "Invalid XML: " + data );
+ }
+ return xml;
+ },
+
+ noop: function() {},
+
+ // Evaluates a script in a global context
+ // Workarounds based on findings by Jim Driscoll
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
+ globalEval: function( data ) {
+ if ( data && jQuery.trim( data ) ) {
+ // We use execScript on Internet Explorer
+ // We use an anonymous function so that context is window
+ // rather than jQuery in Firefox
+ ( window.execScript || function( data ) {
+ window[ "eval" ].call( window, data );
+ } )( data );
+ }
+ },
+
+ // Convert dashed to camelCase; used by the css and data modules
+ // Microsoft forgot to hump their vendor prefix (#9572)
+ camelCase: function( string ) {
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
+ },
+
+ // args is for internal usage only
+ each: function( obj, callback, args ) {
+ var value,
+ i = 0,
+ length = obj.length,
+ isArray = isArraylike( obj );
+
+ if ( args ) {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+ }
+
+ return obj;
+ },
+
+ // Use native String.trim function wherever possible
+ trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
+ function( text ) {
+ return text == null ?
+ "" :
+ core_trim.call( text );
+ } :
+
+ // Otherwise use our own trimming functionality
+ function( text ) {
+ return text == null ?
+ "" :
+ ( text + "" ).replace( rtrim, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( arr, results ) {
+ var ret = results || [];
+
+ if ( arr != null ) {
+ if ( isArraylike( Object(arr) ) ) {
+ jQuery.merge( ret,
+ typeof arr === "string" ?
+ [ arr ] : arr
+ );
+ } else {
+ core_push.call( ret, arr );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, arr, i ) {
+ var len;
+
+ if ( arr ) {
+ if ( core_indexOf ) {
+ return core_indexOf.call( arr, elem, i );
+ }
+
+ len = arr.length;
+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
+
+ for ( ; i < len; i++ ) {
+ // Skip accessing in sparse arrays
+ if ( i in arr && arr[ i ] === elem ) {
+ return i;
+ }
+ }
+ }
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ var l = second.length,
+ i = first.length,
+ j = 0;
+
+ if ( typeof l === "number" ) {
+ for ( ; j < l; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+ } else {
+ while ( second[j] !== undefined ) {
+ first[ i++ ] = second[ j++ ];
+ }
+ }
+
+ first.length = i;
+
+ return first;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var retVal,
+ ret = [],
+ i = 0,
+ length = elems.length;
+ inv = !!inv;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( ; i < length; i++ ) {
+ retVal = !!callback( elems[ i ], i );
+ if ( inv !== retVal ) {
+ ret.push( elems[ i ] );
+ }
+ }
+
+ return ret;
+ },
+
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var value,
+ i = 0,
+ length = elems.length,
+ isArray = isArraylike( elems ),
+ ret = [];
+
+ // Go through the array, translating each of the items to their
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+
+ // Go through every key on the object,
+ } else {
+ for ( i in elems ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+ }
+
+ // Flatten any nested arrays
+ return core_concat.apply( [], ret );
+ },
+
+ // A global GUID counter for objects
+ guid: 1,
+
+ // Bind a function to a context, optionally partially applying any
+ // arguments.
+ proxy: function( fn, context ) {
+ var args, proxy, tmp;
+
+ if ( typeof context === "string" ) {
+ tmp = fn[ context ];
+ context = fn;
+ fn = tmp;
+ }
+
+ // Quick check to determine if target is callable, in the spec
+ // this throws a TypeError, but we will just return undefined.
+ if ( !jQuery.isFunction( fn ) ) {
+ return undefined;
+ }
+
+ // Simulated bind
+ args = core_slice.call( arguments, 2 );
+ proxy = function() {
+ return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
+ };
+
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || jQuery.guid++;
+
+ return proxy;
+ },
+
+ // Multifunctional method to get and set values of a collection
+ // The value/s can optionally be executed if it's a function
+ access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
+ var i = 0,
+ length = elems.length,
+ bulk = key == null;
+
+ // Sets many values
+ if ( jQuery.type( key ) === "object" ) {
+ chainable = true;
+ for ( i in key ) {
+ jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
+ }
+
+ // Sets one value
+ } else if ( value !== undefined ) {
+ chainable = true;
+
+ if ( !jQuery.isFunction( value ) ) {
+ raw = true;
+ }
+
+ if ( bulk ) {
+ // Bulk operations run against the entire set
+ if ( raw ) {
+ fn.call( elems, value );
+ fn = null;
+
+ // ...except when executing function values
+ } else {
+ bulk = fn;
+ fn = function( elem, key, value ) {
+ return bulk.call( jQuery( elem ), value );
+ };
+ }
+ }
+
+ if ( fn ) {
+ for ( ; i < length; i++ ) {
+ fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
+ }
+ }
+ }
+
+ return chainable ?
+ elems :
+
+ // Gets
+ bulk ?
+ fn.call( elems ) :
+ length ? fn( elems[0], key ) : emptyGet;
+ },
+
+ now: function() {
+ return ( new Date() ).getTime();
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations.
+ // Note: this method belongs to the css module but it's needed here for the support module.
+ // If support gets modularized, this method should be moved back to the css module.
+ swap: function( elem, options, callback, args ) {
+ var ret, name,
+ old = {};
+
+ // Remember the old values, and insert the new ones
+ for ( name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ ret = callback.apply( elem, args || [] );
+
+ // Revert the old values
+ for ( name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
+
+ return ret;
+ }
+});
+
+jQuery.ready.promise = function( obj ) {
+ if ( !readyList ) {
+
+ readyList = jQuery.Deferred();
+
+ // Catch cases where $(document).ready() is called after the browser event has already occurred.
+ // we once tried to use readyState "interactive" here, but it caused issues like the one
+ // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
+ if ( document.readyState === "complete" ) {
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ setTimeout( jQuery.ready );
+
+ // Standards-based browsers support DOMContentLoaded
+ } else if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", completed, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", completed, false );
+
+ // If IE event model is used
+ } else {
+ // Ensure firing before onload, maybe late but safe also for iframes
+ document.attachEvent( "onreadystatechange", completed );
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", completed );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var top = false;
+
+ try {
+ top = window.frameElement == null && document.documentElement;
+ } catch(e) {}
+
+ if ( top && top.doScroll ) {
+ (function doScrollCheck() {
+ if ( !jQuery.isReady ) {
+
+ try {
+ // Use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ top.doScroll("left");
+ } catch(e) {
+ return setTimeout( doScrollCheck, 50 );
+ }
+
+ // detach all dom ready events
+ detach();
+
+ // and execute any waiting functions
+ jQuery.ready();
+ }
+ })();
+ }
+ }
+ }
+ return readyList.promise( obj );
+};
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+function isArraylike( obj ) {
+ var length = obj.length,
+ type = jQuery.type( obj );
+
+ if ( jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ if ( obj.nodeType === 1 && length ) {
+ return true;
+ }
+
+ return type === "array" || type !== "function" &&
+ ( length === 0 ||
+ typeof length === "number" && length > 0 && ( length - 1 ) in obj );
+}
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+/*!
+ * Sizzle CSS Selector Engine v1.10.2
+ * http://sizzlejs.com/
+ *
+ * Copyright 2013 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2013-07-03
+ */
+(function( window, undefined ) {
+
+var i,
+ support,
+ cachedruns,
+ Expr,
+ getText,
+ isXML,
+ compile,
+ outermostContext,
+ sortInput,
+
+ // Local document vars
+ setDocument,
+ document,
+ docElem,
+ documentIsHTML,
+ rbuggyQSA,
+ rbuggyMatches,
+ matches,
+ contains,
+
+ // Instance-specific data
+ expando = "sizzle" + -(new Date()),
+ preferredDoc = window.document,
+ dirruns = 0,
+ done = 0,
+ classCache = createCache(),
+ tokenCache = createCache(),
+ compilerCache = createCache(),
+ hasDuplicate = false,
+ sortOrder = function( a, b ) {
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+ return 0;
+ },
+
+ // General-purpose constants
+ strundefined = typeof undefined,
+ MAX_NEGATIVE = 1 << 31,
+
+ // Instance methods
+ hasOwn = ({}).hasOwnProperty,
+ arr = [],
+ pop = arr.pop,
+ push_native = arr.push,
+ push = arr.push,
+ slice = arr.slice,
+ // Use a stripped-down indexOf if we can't use a native one
+ indexOf = arr.indexOf || function( elem ) {
+ var i = 0,
+ len = this.length;
+ for ( ; i < len; i++ ) {
+ if ( this[i] === elem ) {
+ return i;
+ }
+ }
+ return -1;
+ },
+
+ booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
+
+ // Regular expressions
+
+ // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
+ whitespace = "[\\x20\\t\\r\\n\\f]",
+ // http://www.w3.org/TR/css3-syntax/#characters
+ characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
+
+ // Loosely modeled on CSS identifier characters
+ // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
+ // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
+ identifier = characterEncoding.replace( "w", "w#" ),
+
+ // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
+ attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
+ "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
+
+ // Prefer arguments quoted,
+ // then not containing pseudos/brackets,
+ // then attribute selectors/non-parenthetical expressions,
+ // then anything else
+ // These preferences are here to reduce the number of selectors
+ // needing tokenize in the PSEUDO preFilter
+ pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
+
+ // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
+
+ rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
+ rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
+
+ rsibling = new RegExp( whitespace + "*[+~]" ),
+ rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ),
+
+ rpseudo = new RegExp( pseudos ),
+ ridentifier = new RegExp( "^" + identifier + "$" ),
+
+ matchExpr = {
+ "ID": new RegExp( "^#(" + characterEncoding + ")" ),
+ "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
+ "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
+ "ATTR": new RegExp( "^" + attributes ),
+ "PSEUDO": new RegExp( "^" + pseudos ),
+ "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
+ "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
+ "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
+ "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
+ // For use in libraries implementing .is()
+ // We use this for POS matching in `select`
+ "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
+ whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
+ },
+
+ rnative = /^[^{]+\{\s*\[native \w/,
+
+ // Easily-parseable/retrievable ID or TAG or CLASS selectors
+ rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
+
+ rinputs = /^(?:input|select|textarea|button)$/i,
+ rheader = /^h\d$/i,
+
+ rescape = /'|\\/g,
+
+ // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
+ runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
+ funescape = function( _, escaped, escapedWhitespace ) {
+ var high = "0x" + escaped - 0x10000;
+ // NaN means non-codepoint
+ // Support: Firefox
+ // Workaround erroneous numeric interpretation of +"0x"
+ return high !== high || escapedWhitespace ?
+ escaped :
+ // BMP codepoint
+ high < 0 ?
+ String.fromCharCode( high + 0x10000 ) :
+ // Supplemental Plane codepoint (surrogate pair)
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
+ };
+
+// Optimize for push.apply( _, NodeList )
+try {
+ push.apply(
+ (arr = slice.call( preferredDoc.childNodes )),
+ preferredDoc.childNodes
+ );
+ // Support: Android<4.0
+ // Detect silently failing push.apply
+ arr[ preferredDoc.childNodes.length ].nodeType;
+} catch ( e ) {
+ push = { apply: arr.length ?
+
+ // Leverage slice if possible
+ function( target, els ) {
+ push_native.apply( target, slice.call(els) );
+ } :
+
+ // Support: IE<9
+ // Otherwise append directly
+ function( target, els ) {
+ var j = target.length,
+ i = 0;
+ // Can't trust NodeList.length
+ while ( (target[j++] = els[i++]) ) {}
+ target.length = j - 1;
+ }
+ };
+}
+
+function Sizzle( selector, context, results, seed ) {
+ var match, elem, m, nodeType,
+ // QSA vars
+ i, groups, old, nid, newContext, newSelector;
+
+ if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
+ setDocument( context );
+ }
+
+ context = context || document;
+ results = results || [];
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
+ return [];
+ }
+
+ if ( documentIsHTML && !seed ) {
+
+ // Shortcuts
+ if ( (match = rquickExpr.exec( selector )) ) {
+ // Speed-up: Sizzle("#ID")
+ if ( (m = match[1]) ) {
+ if ( nodeType === 9 ) {
+ elem = context.getElementById( m );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE, Opera, and Webkit return items
+ // by name instead of ID
+ if ( elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ } else {
+ return results;
+ }
+ } else {
+ // Context is not a document
+ if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
+ contains( context, elem ) && elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ }
+
+ // Speed-up: Sizzle("TAG")
+ } else if ( match[2] ) {
+ push.apply( results, context.getElementsByTagName( selector ) );
+ return results;
+
+ // Speed-up: Sizzle(".CLASS")
+ } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
+ push.apply( results, context.getElementsByClassName( m ) );
+ return results;
+ }
+ }
+
+ // QSA path
+ if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
+ nid = old = expando;
+ newContext = context;
+ newSelector = nodeType === 9 && selector;
+
+ // qSA works strangely on Element-rooted queries
+ // We can work around this by specifying an extra ID on the root
+ // and working up from there (Thanks to Andrew Dupont for the technique)
+ // IE 8 doesn't work on object elements
+ if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+ groups = tokenize( selector );
+
+ if ( (old = context.getAttribute("id")) ) {
+ nid = old.replace( rescape, "\\$&" );
+ } else {
+ context.setAttribute( "id", nid );
+ }
+ nid = "[id='" + nid + "'] ";
+
+ i = groups.length;
+ while ( i-- ) {
+ groups[i] = nid + toSelector( groups[i] );
+ }
+ newContext = rsibling.test( selector ) && context.parentNode || context;
+ newSelector = groups.join(",");
+ }
+
+ if ( newSelector ) {
+ try {
+ push.apply( results,
+ newContext.querySelectorAll( newSelector )
+ );
+ return results;
+ } catch(qsaError) {
+ } finally {
+ if ( !old ) {
+ context.removeAttribute("id");
+ }
+ }
+ }
+ }
+ }
+
+ // All others
+ return select( selector.replace( rtrim, "$1" ), context, results, seed );
+}
+
+/**
+ * Create key-value caches of limited size
+ * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
+ * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
+ * deleting the oldest entry
+ */
+function createCache() {
+ var keys = [];
+
+ function cache( key, value ) {
+ // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
+ if ( keys.push( key += " " ) > Expr.cacheLength ) {
+ // Only keep the most recent entries
+ delete cache[ keys.shift() ];
+ }
+ return (cache[ key ] = value);
+ }
+ return cache;
+}
+
+/**
+ * Mark a function for special use by Sizzle
+ * @param {Function} fn The function to mark
+ */
+function markFunction( fn ) {
+ fn[ expando ] = true;
+ return fn;
+}
+
+/**
+ * Support testing using an element
+ * @param {Function} fn Passed the created div and expects a boolean result
+ */
+function assert( fn ) {
+ var div = document.createElement("div");
+
+ try {
+ return !!fn( div );
+ } catch (e) {
+ return false;
+ } finally {
+ // Remove from its parent by default
+ if ( div.parentNode ) {
+ div.parentNode.removeChild( div );
+ }
+ // release memory in IE
+ div = null;
+ }
+}
+
+/**
+ * Adds the same handler for all of the specified attrs
+ * @param {String} attrs Pipe-separated list of attributes
+ * @param {Function} handler The method that will be applied
+ */
+function addHandle( attrs, handler ) {
+ var arr = attrs.split("|"),
+ i = attrs.length;
+
+ while ( i-- ) {
+ Expr.attrHandle[ arr[i] ] = handler;
+ }
+}
+
+/**
+ * Checks document order of two siblings
+ * @param {Element} a
+ * @param {Element} b
+ * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
+ */
+function siblingCheck( a, b ) {
+ var cur = b && a,
+ diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
+ ( ~b.sourceIndex || MAX_NEGATIVE ) -
+ ( ~a.sourceIndex || MAX_NEGATIVE );
+
+ // Use IE sourceIndex if available on both nodes
+ if ( diff ) {
+ return diff;
+ }
+
+ // Check if b follows a
+ if ( cur ) {
+ while ( (cur = cur.nextSibling) ) {
+ if ( cur === b ) {
+ return -1;
+ }
+ }
+ }
+
+ return a ? 1 : -1;
+}
+
+/**
+ * Returns a function to use in pseudos for input types
+ * @param {String} type
+ */
+function createInputPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === type;
+ };
+}
+
+/**
+ * Returns a function to use in pseudos for buttons
+ * @param {String} type
+ */
+function createButtonPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && elem.type === type;
+ };
+}
+
+/**
+ * Returns a function to use in pseudos for positionals
+ * @param {Function} fn
+ */
+function createPositionalPseudo( fn ) {
+ return markFunction(function( argument ) {
+ argument = +argument;
+ return markFunction(function( seed, matches ) {
+ var j,
+ matchIndexes = fn( [], seed.length, argument ),
+ i = matchIndexes.length;
+
+ // Match elements found at the specified indexes
+ while ( i-- ) {
+ if ( seed[ (j = matchIndexes[i]) ] ) {
+ seed[j] = !(matches[j] = seed[j]);
+ }
+ }
+ });
+ });
+}
+
+/**
+ * Detect xml
+ * @param {Element|Object} elem An element or a document
+ */
+isXML = Sizzle.isXML = function( elem ) {
+ // documentElement is verified for cases where it doesn't yet exist
+ // (such as loading iframes in IE - #4833)
+ var documentElement = elem && (elem.ownerDocument || elem).documentElement;
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+// Expose support vars for convenience
+support = Sizzle.support = {};
+
+/**
+ * Sets document-related variables once based on the current document
+ * @param {Element|Object} [doc] An element or document object to use to set the document
+ * @returns {Object} Returns the current document
+ */
+setDocument = Sizzle.setDocument = function( node ) {
+ var doc = node ? node.ownerDocument || node : preferredDoc,
+ parent = doc.defaultView;
+
+ // If no document and documentElement is available, return
+ if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
+ return document;
+ }
+
+ // Set our document
+ document = doc;
+ docElem = doc.documentElement;
+
+ // Support tests
+ documentIsHTML = !isXML( doc );
+
+ // Support: IE>8
+ // If iframe document is assigned to "document" variable and if iframe has been reloaded,
+ // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
+ // IE6-8 do not support the defaultView property so parent will be undefined
+ if ( parent && parent.attachEvent && parent !== parent.top ) {
+ parent.attachEvent( "onbeforeunload", function() {
+ setDocument();
+ });
+ }
+
+ /* Attributes
+ ---------------------------------------------------------------------- */
+
+ // Support: IE<8
+ // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
+ support.attributes = assert(function( div ) {
+ div.className = "i";
+ return !div.getAttribute("className");
+ });
+
+ /* getElement(s)By*
+ ---------------------------------------------------------------------- */
+
+ // Check if getElementsByTagName("*") returns only elements
+ support.getElementsByTagName = assert(function( div ) {
+ div.appendChild( doc.createComment("") );
+ return !div.getElementsByTagName("*").length;
+ });
+
+ // Check if getElementsByClassName can be trusted
+ support.getElementsByClassName = assert(function( div ) {
+ div.innerHTML = "<div class='a'></div><div class='a i'></div>";
+
+ // Support: Safari<4
+ // Catch class over-caching
+ div.firstChild.className = "i";
+ // Support: Opera<10
+ // Catch gEBCN failure to find non-leading classes
+ return div.getElementsByClassName("i").length === 2;
+ });
+
+ // Support: IE<10
+ // Check if getElementById returns elements by name
+ // The broken getElementById methods don't pick up programatically-set names,
+ // so use a roundabout getElementsByName test
+ support.getById = assert(function( div ) {
+ docElem.appendChild( div ).id = expando;
+ return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
+ });
+
+ // ID find and filter
+ if ( support.getById ) {
+ Expr.find["ID"] = function( id, context ) {
+ if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
+ var m = context.getElementById( id );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [m] : [];
+ }
+ };
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ return elem.getAttribute("id") === attrId;
+ };
+ };
+ } else {
+ // Support: IE6/7
+ // getElementById is not reliable as a find shortcut
+ delete Expr.find["ID"];
+
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
+ return node && node.value === attrId;
+ };
+ };
+ }
+
+ // Tag
+ Expr.find["TAG"] = support.getElementsByTagName ?
+ function( tag, context ) {
+ if ( typeof context.getElementsByTagName !== strundefined ) {
+ return context.getElementsByTagName( tag );
+ }
+ } :
+ function( tag, context ) {
+ var elem,
+ tmp = [],
+ i = 0,
+ results = context.getElementsByTagName( tag );
+
+ // Filter out possible comments
+ if ( tag === "*" ) {
+ while ( (elem = results[i++]) ) {
+ if ( elem.nodeType === 1 ) {
+ tmp.push( elem );
+ }
+ }
+
+ return tmp;
+ }
+ return results;
+ };
+
+ // Class
+ Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
+ if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
+ return context.getElementsByClassName( className );
+ }
+ };
+
+ /* QSA/matchesSelector
+ ---------------------------------------------------------------------- */
+
+ // QSA and matchesSelector support
+
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
+ rbuggyMatches = [];
+
+ // qSa(:focus) reports false when true (Chrome 21)
+ // We allow this because of a bug in IE8/9 that throws an error
+ // whenever `document.activeElement` is accessed on an iframe
+ // So, we allow :focus to pass through QSA all the time to avoid the IE error
+ // See http://bugs.jquery.com/ticket/13378
+ rbuggyQSA = [];
+
+ if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
+ // Build QSA regex
+ // Regex strategy adopted from Diego Perini
+ assert(function( div ) {
+ // Select is set to empty string on purpose
+ // This is to test IE's treatment of not explicitly
+ // setting a boolean content attribute,
+ // since its presence should be enough
+ // http://bugs.jquery.com/ticket/12359
+ div.innerHTML = "<select><option selected=''></option></select>";
+
+ // Support: IE8
+ // Boolean attributes and "value" are not treated correctly
+ if ( !div.querySelectorAll("[selected]").length ) {
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
+ }
+
+ // Webkit/Opera - :checked should return selected option elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":checked").length ) {
+ rbuggyQSA.push(":checked");
+ }
+ });
+
+ assert(function( div ) {
+
+ // Support: Opera 10-12/IE8
+ // ^= $= *= and empty values
+ // Should not select anything
+ // Support: Windows 8 Native Apps
+ // The type attribute is restricted during .innerHTML assignment
+ var input = doc.createElement("input");
+ input.setAttribute( "type", "hidden" );
+ div.appendChild( input ).setAttribute( "t", "" );
+
+ if ( div.querySelectorAll("[t^='']").length ) {
+ rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
+ }
+
+ // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":enabled").length ) {
+ rbuggyQSA.push( ":enabled", ":disabled" );
+ }
+
+ // Opera 10-11 does not throw on post-comma invalid pseudos
+ div.querySelectorAll("*,:x");
+ rbuggyQSA.push(",.*:");
+ });
+ }
+
+ if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||
+ docElem.mozMatchesSelector ||
+ docElem.oMatchesSelector ||
+ docElem.msMatchesSelector) )) ) {
+
+ assert(function( div ) {
+ // Check to see if it's possible to do matchesSelector
+ // on a disconnected node (IE 9)
+ support.disconnectedMatch = matches.call( div, "div" );
+
+ // This should fail with an exception
+ // Gecko does not error, returns false instead
+ matches.call( div, "[s!='']:x" );
+ rbuggyMatches.push( "!=", pseudos );
+ });
+ }
+
+ rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
+ rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
+
+ /* Contains
+ ---------------------------------------------------------------------- */
+
+ // Element contains another
+ // Purposefully does not implement inclusive descendent
+ // As in, an element does not contain itself
+ contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ?
+ function( a, b ) {
+ var adown = a.nodeType === 9 ? a.documentElement : a,
+ bup = b && b.parentNode;
+ return a === bup || !!( bup && bup.nodeType === 1 && (
+ adown.contains ?
+ adown.contains( bup ) :
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
+ ));
+ } :
+ function( a, b ) {
+ if ( b ) {
+ while ( (b = b.parentNode) ) {
+ if ( b === a ) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ /* Sorting
+ ---------------------------------------------------------------------- */
+
+ // Document order sorting
+ sortOrder = docElem.compareDocumentPosition ?
+ function( a, b ) {
+
+ // Flag for duplicate removal
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );
+
+ if ( compare ) {
+ // Disconnected nodes
+ if ( compare & 1 ||
+ (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
+
+ // Choose the first element that is related to our preferred document
+ if ( a === doc || contains(preferredDoc, a) ) {
+ return -1;
+ }
+ if ( b === doc || contains(preferredDoc, b) ) {
+ return 1;
+ }
+
+ // Maintain original order
+ return sortInput ?
+ ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
+ 0;
+ }
+
+ return compare & 4 ? -1 : 1;
+ }
+
+ // Not directly comparable, sort on existence of method
+ return a.compareDocumentPosition ? -1 : 1;
+ } :
+ function( a, b ) {
+ var cur,
+ i = 0,
+ aup = a.parentNode,
+ bup = b.parentNode,
+ ap = [ a ],
+ bp = [ b ];
+
+ // Exit early if the nodes are identical
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+
+ // Parentless nodes are either documents or disconnected
+ } else if ( !aup || !bup ) {
+ return a === doc ? -1 :
+ b === doc ? 1 :
+ aup ? -1 :
+ bup ? 1 :
+ sortInput ?
+ ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
+ 0;
+
+ // If the nodes are siblings, we can do a quick check
+ } else if ( aup === bup ) {
+ return siblingCheck( a, b );
+ }
+
+ // Otherwise we need full lists of their ancestors for comparison
+ cur = a;
+ while ( (cur = cur.parentNode) ) {
+ ap.unshift( cur );
+ }
+ cur = b;
+ while ( (cur = cur.parentNode) ) {
+ bp.unshift( cur );
+ }
+
+ // Walk down the tree looking for a discrepancy
+ while ( ap[i] === bp[i] ) {
+ i++;
+ }
+
+ return i ?
+ // Do a sibling check if the nodes have a common ancestor
+ siblingCheck( ap[i], bp[i] ) :
+
+ // Otherwise nodes in our document sort first
+ ap[i] === preferredDoc ? -1 :
+ bp[i] === preferredDoc ? 1 :
+ 0;
+ };
+
+ return doc;
+};
+
+Sizzle.matches = function( expr, elements ) {
+ return Sizzle( expr, null, null, elements );
+};
+
+Sizzle.matchesSelector = function( elem, expr ) {
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ // Make sure that attribute selectors are quoted
+ expr = expr.replace( rattributeQuotes, "='$1']" );
+
+ if ( support.matchesSelector && documentIsHTML &&
+ ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
+ ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
+
+ try {
+ var ret = matches.call( elem, expr );
+
+ // IE 9's matchesSelector returns false on disconnected nodes
+ if ( ret || support.disconnectedMatch ||
+ // As well, disconnected nodes are said to be in a document
+ // fragment in IE 9
+ elem.document && elem.document.nodeType !== 11 ) {
+ return ret;
+ }
+ } catch(e) {}
+ }
+
+ return Sizzle( expr, document, null, [elem] ).length > 0;
+};
+
+Sizzle.contains = function( context, elem ) {
+ // Set document vars if needed
+ if ( ( context.ownerDocument || context ) !== document ) {
+ setDocument( context );
+ }
+ return contains( context, elem );
+};
+
+Sizzle.attr = function( elem, name ) {
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ var fn = Expr.attrHandle[ name.toLowerCase() ],
+ // Don't get fooled by Object.prototype properties (jQuery #13807)
+ val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
+ fn( elem, name, !documentIsHTML ) :
+ undefined;
+
+ return val === undefined ?
+ support.attributes || !documentIsHTML ?
+ elem.getAttribute( name ) :
+ (val = elem.getAttributeNode(name)) && val.specified ?
+ val.value :
+ null :
+ val;
+};
+
+Sizzle.error = function( msg ) {
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+/**
+ * Document sorting and removing duplicates
+ * @param {ArrayLike} results
+ */
+Sizzle.uniqueSort = function( results ) {
+ var elem,
+ duplicates = [],
+ j = 0,
+ i = 0;
+
+ // Unless we *know* we can detect duplicates, assume their presence
+ hasDuplicate = !support.detectDuplicates;
+ sortInput = !support.sortStable && results.slice( 0 );
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ while ( (elem = results[i++]) ) {
+ if ( elem === results[ i ] ) {
+ j = duplicates.push( i );
+ }
+ }
+ while ( j-- ) {
+ results.splice( duplicates[ j ], 1 );
+ }
+ }
+
+ return results;
+};
+
+/**
+ * Utility function for retrieving the text value of an array of DOM nodes
+ * @param {Array|Element} elem
+ */
+getText = Sizzle.getText = function( elem ) {
+ var node,
+ ret = "",
+ i = 0,
+ nodeType = elem.nodeType;
+
+ if ( !nodeType ) {
+ // If no nodeType, this is expected to be an array
+ for ( ; (node = elem[i]); i++ ) {
+ // Do not traverse comment nodes
+ ret += getText( node );
+ }
+ } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+ // Use textContent for elements
+ // innerText usage removed for consistency of new lines (see #11153)
+ if ( typeof elem.textContent === "string" ) {
+ return elem.textContent;
+ } else {
+ // Traverse its children
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ ret += getText( elem );
+ }
+ }
+ } else if ( nodeType === 3 || nodeType === 4 ) {
+ return elem.nodeValue;
+ }
+ // Do not include comment or processing instruction nodes
+
+ return ret;
+};
+
+Expr = Sizzle.selectors = {
+
+ // Can be adjusted by the user
+ cacheLength: 50,
+
+ createPseudo: markFunction,
+
+ match: matchExpr,
+
+ attrHandle: {},
+
+ find: {},
+
+ relative: {
+ ">": { dir: "parentNode", first: true },
+ " ": { dir: "parentNode" },
+ "+": { dir: "previousSibling", first: true },
+ "~": { dir: "previousSibling" }
+ },
+
+ preFilter: {
+ "ATTR": function( match ) {
+ match[1] = match[1].replace( runescape, funescape );
+
+ // Move the given value to match[3] whether quoted or unquoted
+ match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
+
+ if ( match[2] === "~=" ) {
+ match[3] = " " + match[3] + " ";
+ }
+
+ return match.slice( 0, 4 );
+ },
+
+ "CHILD": function( match ) {
+ /* matches from matchExpr["CHILD"]
+ 1 type (only|nth|...)
+ 2 what (child|of-type)
+ 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
+ 4 xn-component of xn+y argument ([+-]?\d*n|)
+ 5 sign of xn-component
+ 6 x of xn-component
+ 7 sign of y-component
+ 8 y of y-component
+ */
+ match[1] = match[1].toLowerCase();
+
+ if ( match[1].slice( 0, 3 ) === "nth" ) {
+ // nth-* requires argument
+ if ( !match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ // numeric x and y parameters for Expr.filter.CHILD
+ // remember that false/true cast respectively to 0/1
+ match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
+ match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
+
+ // other types prohibit arguments
+ } else if ( match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ return match;
+ },
+
+ "PSEUDO": function( match ) {
+ var excess,
+ unquoted = !match[5] && match[2];
+
+ if ( matchExpr["CHILD"].test( match[0] ) ) {
+ return null;
+ }
+
+ // Accept quoted arguments as-is
+ if ( match[3] && match[4] !== undefined ) {
+ match[2] = match[4];
+
+ // Strip excess characters from unquoted arguments
+ } else if ( unquoted && rpseudo.test( unquoted ) &&
+ // Get excess from tokenize (recursively)
+ (excess = tokenize( unquoted, true )) &&
+ // advance to the next closing parenthesis
+ (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
+
+ // excess is a negative index
+ match[0] = match[0].slice( 0, excess );
+ match[2] = unquoted.slice( 0, excess );
+ }
+
+ // Return only captures needed by the pseudo filter method (type and argument)
+ return match.slice( 0, 3 );
+ }
+ },
+
+ filter: {
+
+ "TAG": function( nodeNameSelector ) {
+ var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
+ return nodeNameSelector === "*" ?
+ function() { return true; } :
+ function( elem ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
+ };
+ },
+
+ "CLASS": function( className ) {
+ var pattern = classCache[ className + " " ];
+
+ return pattern ||
+ (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
+ classCache( className, function( elem ) {
+ return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
+ });
+ },
+
+ "ATTR": function( name, operator, check ) {
+ return function( elem ) {
+ var result = Sizzle.attr( elem, name );
+
+ if ( result == null ) {
+ return operator === "!=";
+ }
+ if ( !operator ) {
+ return true;
+ }
+
+ result += "";
+
+ return operator === "=" ? result === check :
+ operator === "!=" ? result !== check :
+ operator === "^=" ? check && result.indexOf( check ) === 0 :
+ operator === "*=" ? check && result.indexOf( check ) > -1 :
+ operator === "$=" ? check && result.slice( -check.length ) === check :
+ operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
+ operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
+ false;
+ };
+ },
+
+ "CHILD": function( type, what, argument, first, last ) {
+ var simple = type.slice( 0, 3 ) !== "nth",
+ forward = type.slice( -4 ) !== "last",
+ ofType = what === "of-type";
+
+ return first === 1 && last === 0 ?
+
+ // Shortcut for :nth-*(n)
+ function( elem ) {
+ return !!elem.parentNode;
+ } :
+
+ function( elem, context, xml ) {
+ var cache, outerCache, node, diff, nodeIndex, start,
+ dir = simple !== forward ? "nextSibling" : "previousSibling",
+ parent = elem.parentNode,
+ name = ofType && elem.nodeName.toLowerCase(),
+ useCache = !xml && !ofType;
+
+ if ( parent ) {
+
+ // :(first|last|only)-(child|of-type)
+ if ( simple ) {
+ while ( dir ) {
+ node = elem;
+ while ( (node = node[ dir ]) ) {
+ if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
+ return false;
+ }
+ }
+ // Reverse direction for :only-* (if we haven't yet done so)
+ start = dir = type === "only" && !start && "nextSibling";
+ }
+ return true;
+ }
+
+ start = [ forward ? parent.firstChild : parent.lastChild ];
+
+ // non-xml :nth-child(...) stores cache data on `parent`
+ if ( forward && useCache ) {
+ // Seek `elem` from a previously-cached index
+ outerCache = parent[ expando ] || (parent[ expando ] = {});
+ cache = outerCache[ type ] || [];
+ nodeIndex = cache[0] === dirruns && cache[1];
+ diff = cache[0] === dirruns && cache[2];
+ node = nodeIndex && parent.childNodes[ nodeIndex ];
+
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+
+ // Fallback to seeking `elem` from the start
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ // When found, cache indexes on `parent` and break
+ if ( node.nodeType === 1 && ++diff && node === elem ) {
+ outerCache[ type ] = [ dirruns, nodeIndex, diff ];
+ break;
+ }
+ }
+
+ // Use previously-cached element index if available
+ } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
+ diff = cache[1];
+
+ // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
+ } else {
+ // Use the same loop as above to seek `elem` from the start
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
+ // Cache the index of each encountered element
+ if ( useCache ) {
+ (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
+ }
+
+ if ( node === elem ) {
+ break;
+ }
+ }
+ }
+ }
+
+ // Incorporate the offset, then check against cycle size
+ diff -= last;
+ return diff === first || ( diff % first === 0 && diff / first >= 0 );
+ }
+ };
+ },
+
+ "PSEUDO": function( pseudo, argument ) {
+ // pseudo-class names are case-insensitive
+ // http://www.w3.org/TR/selectors/#pseudo-classes
+ // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
+ // Remember that setFilters inherits from pseudos
+ var args,
+ fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
+ Sizzle.error( "unsupported pseudo: " + pseudo );
+
+ // The user may use createPseudo to indicate that
+ // arguments are needed to create the filter function
+ // just as Sizzle does
+ if ( fn[ expando ] ) {
+ return fn( argument );
+ }
+
+ // But maintain support for old signatures
+ if ( fn.length > 1 ) {
+ args = [ pseudo, pseudo, "", argument ];
+ return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
+ markFunction(function( seed, matches ) {
+ var idx,
+ matched = fn( seed, argument ),
+ i = matched.length;
+ while ( i-- ) {
+ idx = indexOf.call( seed, matched[i] );
+ seed[ idx ] = !( matches[ idx ] = matched[i] );
+ }
+ }) :
+ function( elem ) {
+ return fn( elem, 0, args );
+ };
+ }
+
+ return fn;
+ }
+ },
+
+ pseudos: {
+ // Potentially complex pseudos
+ "not": markFunction(function( selector ) {
+ // Trim the selector passed to compile
+ // to avoid treating leading and trailing
+ // spaces as combinators
+ var input = [],
+ results = [],
+ matcher = compile( selector.replace( rtrim, "$1" ) );
+
+ return matcher[ expando ] ?
+ markFunction(function( seed, matches, context, xml ) {
+ var elem,
+ unmatched = matcher( seed, null, xml, [] ),
+ i = seed.length;
+
+ // Match elements unmatched by `matcher`
+ while ( i-- ) {
+ if ( (elem = unmatched[i]) ) {
+ seed[i] = !(matches[i] = elem);
+ }
+ }
+ }) :
+ function( elem, context, xml ) {
+ input[0] = elem;
+ matcher( input, null, xml, results );
+ return !results.pop();
+ };
+ }),
+
+ "has": markFunction(function( selector ) {
+ return function( elem ) {
+ return Sizzle( selector, elem ).length > 0;
+ };
+ }),
+
+ "contains": markFunction(function( text ) {
+ return function( elem ) {
+ return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
+ };
+ }),
+
+ // "Whether an element is represented by a :lang() selector
+ // is based solely on the element's language value
+ // being equal to the identifier C,
+ // or beginning with the identifier C immediately followed by "-".
+ // The matching of C against the element's language value is performed case-insensitively.
+ // The identifier C does not have to be a valid language name."
+ // http://www.w3.org/TR/selectors/#lang-pseudo
+ "lang": markFunction( function( lang ) {
+ // lang value must be a valid identifier
+ if ( !ridentifier.test(lang || "") ) {
+ Sizzle.error( "unsupported lang: " + lang );
+ }
+ lang = lang.replace( runescape, funescape ).toLowerCase();
+ return function( elem ) {
+ var elemLang;
+ do {
+ if ( (elemLang = documentIsHTML ?
+ elem.lang :
+ elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
+
+ elemLang = elemLang.toLowerCase();
+ return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
+ }
+ } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
+ return false;
+ };
+ }),
+
+ // Miscellaneous
+ "target": function( elem ) {
+ var hash = window.location && window.location.hash;
+ return hash && hash.slice( 1 ) === elem.id;
+ },
+
+ "root": function( elem ) {
+ return elem === docElem;
+ },
+
+ "focus": function( elem ) {
+ return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
+ },
+
+ // Boolean properties
+ "enabled": function( elem ) {
+ return elem.disabled === false;
+ },
+
+ "disabled": function( elem ) {
+ return elem.disabled === true;
+ },
+
+ "checked": function( elem ) {
+ // In CSS3, :checked should return both checked and selected elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ var nodeName = elem.nodeName.toLowerCase();
+ return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
+ },
+
+ "selected": function( elem ) {
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ if ( elem.parentNode ) {
+ elem.parentNode.selectedIndex;
+ }
+
+ return elem.selected === true;
+ },
+
+ // Contents
+ "empty": function( elem ) {
+ // http://www.w3.org/TR/selectors/#empty-pseudo
+ // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
+ // not comment, processing instructions, or others
+ // Thanks to Diego Perini for the nodeName shortcut
+ // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ "parent": function( elem ) {
+ return !Expr.pseudos["empty"]( elem );
+ },
+
+ // Element/input types
+ "header": function( elem ) {
+ return rheader.test( elem.nodeName );
+ },
+
+ "input": function( elem ) {
+ return rinputs.test( elem.nodeName );
+ },
+
+ "button": function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === "button" || name === "button";
+ },
+
+ "text": function( elem ) {
+ var attr;
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
+ // use getAttribute instead to test this case
+ return elem.nodeName.toLowerCase() === "input" &&
+ elem.type === "text" &&
+ ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
+ },
+
+ // Position-in-collection
+ "first": createPositionalPseudo(function() {
+ return [ 0 ];
+ }),
+
+ "last": createPositionalPseudo(function( matchIndexes, length ) {
+ return [ length - 1 ];
+ }),
+
+ "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ return [ argument < 0 ? argument + length : argument ];
+ }),
+
+ "even": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 0;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "odd": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 1;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; --i >= 0; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; ++i < length; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ })
+ }
+};
+
+Expr.pseudos["nth"] = Expr.pseudos["eq"];
+
+// Add button/input type pseudos
+for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
+ Expr.pseudos[ i ] = createInputPseudo( i );
+}
+for ( i in { submit: true, reset: true } ) {
+ Expr.pseudos[ i ] = createButtonPseudo( i );
+}
+
+// Easy API for creating new setFilters
+function setFilters() {}
+setFilters.prototype = Expr.filters = Expr.pseudos;
+Expr.setFilters = new setFilters();
+
+function tokenize( selector, parseOnly ) {
+ var matched, match, tokens, type,
+ soFar, groups, preFilters,
+ cached = tokenCache[ selector + " " ];
+
+ if ( cached ) {
+ return parseOnly ? 0 : cached.slice( 0 );
+ }
+
+ soFar = selector;
+ groups = [];
+ preFilters = Expr.preFilter;
+
+ while ( soFar ) {
+
+ // Comma and first run
+ if ( !matched || (match = rcomma.exec( soFar )) ) {
+ if ( match ) {
+ // Don't consume trailing commas as valid
+ soFar = soFar.slice( match[0].length ) || soFar;
+ }
+ groups.push( tokens = [] );
+ }
+
+ matched = false;
+
+ // Combinators
+ if ( (match = rcombinators.exec( soFar )) ) {
+ matched = match.shift();
+ tokens.push({
+ value: matched,
+ // Cast descendant combinators to space
+ type: match[0].replace( rtrim, " " )
+ });
+ soFar = soFar.slice( matched.length );
+ }
+
+ // Filters
+ for ( type in Expr.filter ) {
+ if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
+ (match = preFilters[ type ]( match ))) ) {
+ matched = match.shift();
+ tokens.push({
+ value: matched,
+ type: type,
+ matches: match
+ });
+ soFar = soFar.slice( matched.length );
+ }
+ }
+
+ if ( !matched ) {
+ break;
+ }
+ }
+
+ // Return the length of the invalid excess
+ // if we're just parsing
+ // Otherwise, throw an error or return tokens
+ return parseOnly ?
+ soFar.length :
+ soFar ?
+ Sizzle.error( selector ) :
+ // Cache the tokens
+ tokenCache( selector, groups ).slice( 0 );
+}
+
+function toSelector( tokens ) {
+ var i = 0,
+ len = tokens.length,
+ selector = "";
+ for ( ; i < len; i++ ) {
+ selector += tokens[i].value;
+ }
+ return selector;
+}
+
+function addCombinator( matcher, combinator, base ) {
+ var dir = combinator.dir,
+ checkNonElements = base && dir === "parentNode",
+ doneName = done++;
+
+ return combinator.first ?
+ // Check against closest ancestor/preceding element
+ function( elem, context, xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ return matcher( elem, context, xml );
+ }
+ }
+ } :
+
+ // Check against all ancestor/preceding elements
+ function( elem, context, xml ) {
+ var data, cache, outerCache,
+ dirkey = dirruns + " " + doneName;
+
+ // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
+ if ( xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ if ( matcher( elem, context, xml ) ) {
+ return true;
+ }
+ }
+ }
+ } else {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ outerCache = elem[ expando ] || (elem[ expando ] = {});
+ if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
+ if ( (data = cache[1]) === true || data === cachedruns ) {
+ return data === true;
+ }
+ } else {
+ cache = outerCache[ dir ] = [ dirkey ];
+ cache[1] = matcher( elem, context, xml ) || cachedruns;
+ if ( cache[1] === true ) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ };
+}
+
+function elementMatcher( matchers ) {
+ return matchers.length > 1 ?
+ function( elem, context, xml ) {
+ var i = matchers.length;
+ while ( i-- ) {
+ if ( !matchers[i]( elem, context, xml ) ) {
+ return false;
+ }
+ }
+ return true;
+ } :
+ matchers[0];
+}
+
+function condense( unmatched, map, filter, context, xml ) {
+ var elem,
+ newUnmatched = [],
+ i = 0,
+ len = unmatched.length,
+ mapped = map != null;
+
+ for ( ; i < len; i++ ) {
+ if ( (elem = unmatched[i]) ) {
+ if ( !filter || filter( elem, context, xml ) ) {
+ newUnmatched.push( elem );
+ if ( mapped ) {
+ map.push( i );
+ }
+ }
+ }
+ }
+
+ return newUnmatched;
+}
+
+function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
+ if ( postFilter && !postFilter[ expando ] ) {
+ postFilter = setMatcher( postFilter );
+ }
+ if ( postFinder && !postFinder[ expando ] ) {
+ postFinder = setMatcher( postFinder, postSelector );
+ }
+ return markFunction(function( seed, results, context, xml ) {
+ var temp, i, elem,
+ preMap = [],
+ postMap = [],
+ preexisting = results.length,
+
+ // Get initial elements from seed or context
+ elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
+
+ // Prefilter to get matcher input, preserving a map for seed-results synchronization
+ matcherIn = preFilter && ( seed || !selector ) ?
+ condense( elems, preMap, preFilter, context, xml ) :
+ elems,
+
+ matcherOut = matcher ?
+ // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
+ postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
+
+ // ...intermediate processing is necessary
+ [] :
+
+ // ...otherwise use results directly
+ results :
+ matcherIn;
+
+ // Find primary matches
+ if ( matcher ) {
+ matcher( matcherIn, matcherOut, context, xml );
+ }
+
+ // Apply postFilter
+ if ( postFilter ) {
+ temp = condense( matcherOut, postMap );
+ postFilter( temp, [], context, xml );
+
+ // Un-match failing elements by moving them back to matcherIn
+ i = temp.length;
+ while ( i-- ) {
+ if ( (elem = temp[i]) ) {
+ matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
+ }
+ }
+ }
+
+ if ( seed ) {
+ if ( postFinder || preFilter ) {
+ if ( postFinder ) {
+ // Get the final matcherOut by condensing this intermediate into postFinder contexts
+ temp = [];
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) ) {
+ // Restore matcherIn since elem is not yet a final match
+ temp.push( (matcherIn[i] = elem) );
+ }
+ }
+ postFinder( null, (matcherOut = []), temp, xml );
+ }
+
+ // Move matched elements from seed to results to keep them synchronized
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) &&
+ (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
+
+ seed[temp] = !(results[temp] = elem);
+ }
+ }
+ }
+
+ // Add elements to results, through postFinder if defined
+ } else {
+ matcherOut = condense(
+ matcherOut === results ?
+ matcherOut.splice( preexisting, matcherOut.length ) :
+ matcherOut
+ );
+ if ( postFinder ) {
+ postFinder( null, results, matcherOut, xml );
+ } else {
+ push.apply( results, matcherOut );
+ }
+ }
+ });
+}
+
+function matcherFromTokens( tokens ) {
+ var checkContext, matcher, j,
+ len = tokens.length,
+ leadingRelative = Expr.relative[ tokens[0].type ],
+ implicitRelative = leadingRelative || Expr.relative[" "],
+ i = leadingRelative ? 1 : 0,
+
+ // The foundational matcher ensures that elements are reachable from top-level context(s)
+ matchContext = addCombinator( function( elem ) {
+ return elem === checkContext;
+ }, implicitRelative, true ),
+ matchAnyContext = addCombinator( function( elem ) {
+ return indexOf.call( checkContext, elem ) > -1;
+ }, implicitRelative, true ),
+ matchers = [ function( elem, context, xml ) {
+ return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
+ (checkContext = context).nodeType ?
+ matchContext( elem, context, xml ) :
+ matchAnyContext( elem, context, xml ) );
+ } ];
+
+ for ( ; i < len; i++ ) {
+ if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
+ matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
+ } else {
+ matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
+
+ // Return special upon seeing a positional matcher
+ if ( matcher[ expando ] ) {
+ // Find the next relative operator (if any) for proper handling
+ j = ++i;
+ for ( ; j < len; j++ ) {
+ if ( Expr.relative[ tokens[j].type ] ) {
+ break;
+ }
+ }
+ return setMatcher(
+ i > 1 && elementMatcher( matchers ),
+ i > 1 && toSelector(
+ // If the preceding token was a descendant combinator, insert an implicit any-element `*`
+ tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
+ ).replace( rtrim, "$1" ),
+ matcher,
+ i < j && matcherFromTokens( tokens.slice( i, j ) ),
+ j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
+ j < len && toSelector( tokens )
+ );
+ }
+ matchers.push( matcher );
+ }
+ }
+
+ return elementMatcher( matchers );
+}
+
+function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
+ // A counter to specify which element is currently being matched
+ var matcherCachedRuns = 0,
+ bySet = setMatchers.length > 0,
+ byElement = elementMatchers.length > 0,
+ superMatcher = function( seed, context, xml, results, expandContext ) {
+ var elem, j, matcher,
+ setMatched = [],
+ matchedCount = 0,
+ i = "0",
+ unmatched = seed && [],
+ outermost = expandContext != null,
+ contextBackup = outermostContext,
+ // We must always have either seed elements or context
+ elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
+ // Use integer dirruns iff this is the outermost matcher
+ dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
+
+ if ( outermost ) {
+ outermostContext = context !== document && context;
+ cachedruns = matcherCachedRuns;
+ }
+
+ // Add elements passing elementMatchers directly to results
+ // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ if ( byElement && elem ) {
+ j = 0;
+ while ( (matcher = elementMatchers[j++]) ) {
+ if ( matcher( elem, context, xml ) ) {
+ results.push( elem );
+ break;
+ }
+ }
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ cachedruns = ++matcherCachedRuns;
+ }
+ }
+
+ // Track unmatched elements for set filters
+ if ( bySet ) {
+ // They will have gone through all possible matchers
+ if ( (elem = !matcher && elem) ) {
+ matchedCount--;
+ }
+
+ // Lengthen the array for every element, matched or not
+ if ( seed ) {
+ unmatched.push( elem );
+ }
+ }
+ }
+
+ // Apply set filters to unmatched elements
+ matchedCount += i;
+ if ( bySet && i !== matchedCount ) {
+ j = 0;
+ while ( (matcher = setMatchers[j++]) ) {
+ matcher( unmatched, setMatched, context, xml );
+ }
+
+ if ( seed ) {
+ // Reintegrate element matches to eliminate the need for sorting
+ if ( matchedCount > 0 ) {
+ while ( i-- ) {
+ if ( !(unmatched[i] || setMatched[i]) ) {
+ setMatched[i] = pop.call( results );
+ }
+ }
+ }
+
+ // Discard index placeholder values to get only actual matches
+ setMatched = condense( setMatched );
+ }
+
+ // Add matches to results
+ push.apply( results, setMatched );
+
+ // Seedless set matches succeeding multiple successful matchers stipulate sorting
+ if ( outermost && !seed && setMatched.length > 0 &&
+ ( matchedCount + setMatchers.length ) > 1 ) {
+
+ Sizzle.uniqueSort( results );
+ }
+ }
+
+ // Override manipulation of globals by nested matchers
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ outermostContext = contextBackup;
+ }
+
+ return unmatched;
+ };
+
+ return bySet ?
+ markFunction( superMatcher ) :
+ superMatcher;
+}
+
+compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
+ var i,
+ setMatchers = [],
+ elementMatchers = [],
+ cached = compilerCache[ selector + " " ];
+
+ if ( !cached ) {
+ // Generate a function of recursive functions that can be used to check each element
+ if ( !group ) {
+ group = tokenize( selector );
+ }
+ i = group.length;
+ while ( i-- ) {
+ cached = matcherFromTokens( group[i] );
+ if ( cached[ expando ] ) {
+ setMatchers.push( cached );
+ } else {
+ elementMatchers.push( cached );
+ }
+ }
+
+ // Cache the compiled function
+ cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
+ }
+ return cached;
+};
+
+function multipleContexts( selector, contexts, results ) {
+ var i = 0,
+ len = contexts.length;
+ for ( ; i < len; i++ ) {
+ Sizzle( selector, contexts[i], results );
+ }
+ return results;
+}
+
+function select( selector, context, results, seed ) {
+ var i, tokens, token, type, find,
+ match = tokenize( selector );
+
+ if ( !seed ) {
+ // Try to minimize operations if there is only one group
+ if ( match.length === 1 ) {
+
+ // Take a shortcut and set the context if the root selector is an ID
+ tokens = match[0] = match[0].slice( 0 );
+ if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
+ support.getById && context.nodeType === 9 && documentIsHTML &&
+ Expr.relative[ tokens[1].type ] ) {
+
+ context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
+ if ( !context ) {
+ return results;
+ }
+ selector = selector.slice( tokens.shift().value.length );
+ }
+
+ // Fetch a seed set for right-to-left matching
+ i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
+ while ( i-- ) {
+ token = tokens[i];
+
+ // Abort if we hit a combinator
+ if ( Expr.relative[ (type = token.type) ] ) {
+ break;
+ }
+ if ( (find = Expr.find[ type ]) ) {
+ // Search, expanding context for leading sibling combinators
+ if ( (seed = find(
+ token.matches[0].replace( runescape, funescape ),
+ rsibling.test( tokens[0].type ) && context.parentNode || context
+ )) ) {
+
+ // If seed is empty or no tokens remain, we can return early
+ tokens.splice( i, 1 );
+ selector = seed.length && toSelector( tokens );
+ if ( !selector ) {
+ push.apply( results, seed );
+ return results;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Compile and execute a filtering function
+ // Provide `match` to avoid retokenization if we modified the selector above
+ compile( selector, match )(
+ seed,
+ context,
+ !documentIsHTML,
+ results,
+ rsibling.test( selector )
+ );
+ return results;
+}
+
+// One-time assignments
+
+// Sort stability
+support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
+
+// Support: Chrome<14
+// Always assume duplicates if they aren't passed to the comparison function
+support.detectDuplicates = hasDuplicate;
+
+// Initialize against the default document
+setDocument();
+
+// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
+// Detached nodes confoundingly follow *each other*
+support.sortDetached = assert(function( div1 ) {
+ // Should return 1, but returns 4 (following)
+ return div1.compareDocumentPosition( document.createElement("div") ) & 1;
+});
+
+// Support: IE<8
+// Prevent attribute/property "interpolation"
+// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+if ( !assert(function( div ) {
+ div.innerHTML = "<a href='#'></a>";
+ return div.firstChild.getAttribute("href") === "#" ;
+}) ) {
+ addHandle( "type|href|height|width", function( elem, name, isXML ) {
+ if ( !isXML ) {
+ return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
+ }
+ });
+}
+
+// Support: IE<9
+// Use defaultValue in place of getAttribute("value")
+if ( !support.attributes || !assert(function( div ) {
+ div.innerHTML = "<input/>";
+ div.firstChild.setAttribute( "value", "" );
+ return div.firstChild.getAttribute( "value" ) === "";
+}) ) {
+ addHandle( "value", function( elem, name, isXML ) {
+ if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
+ return elem.defaultValue;
+ }
+ });
+}
+
+// Support: IE<9
+// Use getAttributeNode to fetch booleans when getAttribute lies
+if ( !assert(function( div ) {
+ return div.getAttribute("disabled") == null;
+}) ) {
+ addHandle( booleans, function( elem, name, isXML ) {
+ var val;
+ if ( !isXML ) {
+ return (val = elem.getAttributeNode( name )) && val.specified ?
+ val.value :
+ elem[ name ] === true ? name.toLowerCase() : null;
+ }
+ });
+}
+
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.pseudos;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+
+
+})( window );
+// String to Object options format cache
+var optionsCache = {};
+
+// Convert String-formatted options into Object-formatted ones and store in cache
+function createOptions( options ) {
+ var object = optionsCache[ options ] = {};
+ jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
+ object[ flag ] = true;
+ });
+ return object;
+}
+
+/*
+ * Create a callback list using the following parameters:
+ *
+ * options: an optional list of space-separated options that will change how
+ * the callback list behaves or a more traditional option object
+ *
+ * By default a callback list will act like an event callback list and can be
+ * "fired" multiple times.
+ *
+ * Possible options:
+ *
+ * once: will ensure the callback list can only be fired once (like a Deferred)
+ *
+ * memory: will keep track of previous values and will call any callback added
+ * after the list has been fired right away with the latest "memorized"
+ * values (like a Deferred)
+ *
+ * unique: will ensure a callback can only be added once (no duplicate in the list)
+ *
+ * stopOnFalse: interrupt callings when a callback returns false
+ *
+ */
+jQuery.Callbacks = function( options ) {
+
+ // Convert options from String-formatted to Object-formatted if needed
+ // (we check in cache first)
+ options = typeof options === "string" ?
+ ( optionsCache[ options ] || createOptions( options ) ) :
+ jQuery.extend( {}, options );
+
+ var // Flag to know if list is currently firing
+ firing,
+ // Last fire value (for non-forgettable lists)
+ memory,
+ // Flag to know if list was already fired
+ fired,
+ // End of the loop when firing
+ firingLength,
+ // Index of currently firing callback (modified by remove if needed)
+ firingIndex,
+ // First callback to fire (used internally by add and fireWith)
+ firingStart,
+ // Actual callback list
+ list = [],
+ // Stack of fire calls for repeatable lists
+ stack = !options.once && [],
+ // Fire callbacks
+ fire = function( data ) {
+ memory = options.memory && data;
+ fired = true;
+ firingIndex = firingStart || 0;
+ firingStart = 0;
+ firingLength = list.length;
+ firing = true;
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+ if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
+ memory = false; // To prevent further calls using add
+ break;
+ }
+ }
+ firing = false;
+ if ( list ) {
+ if ( stack ) {
+ if ( stack.length ) {
+ fire( stack.shift() );
+ }
+ } else if ( memory ) {
+ list = [];
+ } else {
+ self.disable();
+ }
+ }
+ },
+ // Actual Callbacks object
+ self = {
+ // Add a callback or a collection of callbacks to the list
+ add: function() {
+ if ( list ) {
+ // First, we save the current length
+ var start = list.length;
+ (function add( args ) {
+ jQuery.each( args, function( _, arg ) {
+ var type = jQuery.type( arg );
+ if ( type === "function" ) {
+ if ( !options.unique || !self.has( arg ) ) {
+ list.push( arg );
+ }
+ } else if ( arg && arg.length && type !== "string" ) {
+ // Inspect recursively
+ add( arg );
+ }
+ });
+ })( arguments );
+ // Do we need to add the callbacks to the
+ // current firing batch?
+ if ( firing ) {
+ firingLength = list.length;
+ // With memory, if we're not firing then
+ // we should call right away
+ } else if ( memory ) {
+ firingStart = start;
+ fire( memory );
+ }
+ }
+ return this;
+ },
+ // Remove a callback from the list
+ remove: function() {
+ if ( list ) {
+ jQuery.each( arguments, function( _, arg ) {
+ var index;
+ while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
+ list.splice( index, 1 );
+ // Handle firing indexes
+ if ( firing ) {
+ if ( index <= firingLength ) {
+ firingLength--;
+ }
+ if ( index <= firingIndex ) {
+ firingIndex--;
+ }
+ }
+ }
+ });
+ }
+ return this;
+ },
+ // Check if a given callback is in the list.
+ // If no argument is given, return whether or not list has callbacks attached.
+ has: function( fn ) {
+ return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
+ },
+ // Remove all callbacks from the list
+ empty: function() {
+ list = [];
+ firingLength = 0;
+ return this;
+ },
+ // Have the list do nothing anymore
+ disable: function() {
+ list = stack = memory = undefined;
+ return this;
+ },
+ // Is it disabled?
+ disabled: function() {
+ return !list;
+ },
+ // Lock the list in its current state
+ lock: function() {
+ stack = undefined;
+ if ( !memory ) {
+ self.disable();
+ }
+ return this;
+ },
+ // Is it locked?
+ locked: function() {
+ return !stack;
+ },
+ // Call all callbacks with the given context and arguments
+ fireWith: function( context, args ) {
+ if ( list && ( !fired || stack ) ) {
+ args = args || [];
+ args = [ context, args.slice ? args.slice() : args ];
+ if ( firing ) {
+ stack.push( args );
+ } else {
+ fire( args );
+ }
+ }
+ return this;
+ },
+ // Call all the callbacks with the given arguments
+ fire: function() {
+ self.fireWith( this, arguments );
+ return this;
+ },
+ // To know if the callbacks have already been called at least once
+ fired: function() {
+ return !!fired;
+ }
+ };
+
+ return self;
+};
+jQuery.extend({
+
+ Deferred: function( func ) {
+ var tuples = [
+ // action, add listener, listener list, final state
+ [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
+ [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
+ [ "notify", "progress", jQuery.Callbacks("memory") ]
+ ],
+ state = "pending",
+ promise = {
+ state: function() {
+ return state;
+ },
+ always: function() {
+ deferred.done( arguments ).fail( arguments );
+ return this;
+ },
+ then: function( /* fnDone, fnFail, fnProgress */ ) {
+ var fns = arguments;
+ return jQuery.Deferred(function( newDefer ) {
+ jQuery.each( tuples, function( i, tuple ) {
+ var action = tuple[ 0 ],
+ fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
+ // deferred[ done | fail | progress ] for forwarding actions to newDefer
+ deferred[ tuple[1] ](function() {
+ var returned = fn && fn.apply( this, arguments );
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
+ returned.promise()
+ .done( newDefer.resolve )
+ .fail( newDefer.reject )
+ .progress( newDefer.notify );
+ } else {
+ newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
+ }
+ });
+ });
+ fns = null;
+ }).promise();
+ },
+ // Get a promise for this deferred
+ // If obj is provided, the promise aspect is added to the object
+ promise: function( obj ) {
+ return obj != null ? jQuery.extend( obj, promise ) : promise;
+ }
+ },
+ deferred = {};
+
+ // Keep pipe for back-compat
+ promise.pipe = promise.then;
+
+ // Add list-specific methods
+ jQuery.each( tuples, function( i, tuple ) {
+ var list = tuple[ 2 ],
+ stateString = tuple[ 3 ];
+
+ // promise[ done | fail | progress ] = list.add
+ promise[ tuple[1] ] = list.add;
+
+ // Handle state
+ if ( stateString ) {
+ list.add(function() {
+ // state = [ resolved | rejected ]
+ state = stateString;
+
+ // [ reject_list | resolve_list ].disable; progress_list.lock
+ }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
+ }
+
+ // deferred[ resolve | reject | notify ]
+ deferred[ tuple[0] ] = function() {
+ deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
+ return this;
+ };
+ deferred[ tuple[0] + "With" ] = list.fireWith;
+ });
+
+ // Make the deferred a promise
+ promise.promise( deferred );
+
+ // Call given func if any
+ if ( func ) {
+ func.call( deferred, deferred );
+ }
+
+ // All done!
+ return deferred;
+ },
+
+ // Deferred helper
+ when: function( subordinate /* , ..., subordinateN */ ) {
+ var i = 0,
+ resolveValues = core_slice.call( arguments ),
+ length = resolveValues.length,
+
+ // the count of uncompleted subordinates
+ remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
+
+ // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
+ deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
+
+ // Update function for both resolve and progress values
+ updateFunc = function( i, contexts, values ) {
+ return function( value ) {
+ contexts[ i ] = this;
+ values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
+ if( values === progressValues ) {
+ deferred.notifyWith( contexts, values );
+ } else if ( !( --remaining ) ) {
+ deferred.resolveWith( contexts, values );
+ }
+ };
+ },
+
+ progressValues, progressContexts, resolveContexts;
+
+ // add listeners to Deferred subordinates; treat others as resolved
+ if ( length > 1 ) {
+ progressValues = new Array( length );
+ progressContexts = new Array( length );
+ resolveContexts = new Array( length );
+ for ( ; i < length; i++ ) {
+ if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
+ resolveValues[ i ].promise()
+ .done( updateFunc( i, resolveContexts, resolveValues ) )
+ .fail( deferred.reject )
+ .progress( updateFunc( i, progressContexts, progressValues ) );
+ } else {
+ --remaining;
+ }
+ }
+ }
+
+ // if we're not waiting on anything, resolve the master
+ if ( !remaining ) {
+ deferred.resolveWith( resolveContexts, resolveValues );
+ }
+
+ return deferred.promise();
+ }
+});
+jQuery.support = (function( support ) {
+
+ var all, a, input, select, fragment, opt, eventName, isSupported, i,
+ div = document.createElement("div");
+
+ // Setup
+ div.setAttribute( "className", "t" );
+ div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+
+ // Finish early in limited (non-browser) environments
+ all = div.getElementsByTagName("*") || [];
+ a = div.getElementsByTagName("a")[ 0 ];
+ if ( !a || !a.style || !all.length ) {
+ return support;
+ }
+
+ // First batch of tests
+ select = document.createElement("select");
+ opt = select.appendChild( document.createElement("option") );
+ input = div.getElementsByTagName("input")[ 0 ];
+
+ a.style.cssText = "top:1px;float:left;opacity:.5";
+
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+ support.getSetAttribute = div.className !== "t";
+
+ // IE strips leading whitespace when .innerHTML is used
+ support.leadingWhitespace = div.firstChild.nodeType === 3;
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ support.tbody = !div.getElementsByTagName("tbody").length;
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ support.htmlSerialize = !!div.getElementsByTagName("link").length;
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText instead)
+ support.style = /top/.test( a.getAttribute("style") );
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ support.hrefNormalized = a.getAttribute("href") === "/a";
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ // Use a regex to work around a WebKit issue. See #5145
+ support.opacity = /^0.5/.test( a.style.opacity );
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ support.cssFloat = !!a.style.cssFloat;
+
+ // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
+ support.checkOn = !!input.value;
+
+ // Make sure that a selected-by-default option has a working selected property.
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+ support.optSelected = opt.selected;
+
+ // Tests for enctype support on a form (#6743)
+ support.enctype = !!document.createElement("form").enctype;
+
+ // Makes sure cloning an html5 element does not cause problems
+ // Where outerHTML is undefined, this still works
+ support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>";
+
+ // Will be defined later
+ support.inlineBlockNeedsLayout = false;
+ support.shrinkWrapBlocks = false;
+ support.pixelPosition = false;
+ support.deleteExpando = true;
+ support.noCloneEvent = true;
+ support.reliableMarginRight = true;
+ support.boxSizingReliable = true;
+
+ // Make sure checked status is properly cloned
+ input.checked = true;
+ support.noCloneChecked = input.cloneNode( true ).checked;
+
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as disabled)
+ select.disabled = true;
+ support.optDisabled = !opt.disabled;
+
+ // Support: IE<9
+ try {
+ delete div.test;
+ } catch( e ) {
+ support.deleteExpando = false;
+ }
+
+ // Check if we can trust getAttribute("value")
+ input = document.createElement("input");
+ input.setAttribute( "value", "" );
+ support.input = input.getAttribute( "value" ) === "";
+
+ // Check if an input maintains its value after becoming a radio
+ input.value = "t";
+ input.setAttribute( "type", "radio" );
+ support.radioValue = input.value === "t";
+
+ // #11217 - WebKit loses check when the name is after the checked attribute
+ input.setAttribute( "checked", "t" );
+ input.setAttribute( "name", "t" );
+
+ fragment = document.createDocumentFragment();
+ fragment.appendChild( input );
+
+ // Check if a disconnected checkbox will retain its checked
+ // value of true after appended to the DOM (IE6/7)
+ support.appendChecked = input.checked;
+
+ // WebKit doesn't clone checked state correctly in fragments
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+ // Support: IE<9
+ // Opera does not clone events (and typeof div.attachEvent === undefined).
+ // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
+ if ( div.attachEvent ) {
+ div.attachEvent( "onclick", function() {
+ support.noCloneEvent = false;
+ });
+
+ div.cloneNode( true ).click();
+ }
+
+ // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
+ // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
+ for ( i in { submit: true, change: true, focusin: true }) {
+ div.setAttribute( eventName = "on" + i, "t" );
+
+ support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
+ }
+
+ div.style.backgroundClip = "content-box";
+ div.cloneNode( true ).style.backgroundClip = "";
+ support.clearCloneStyle = div.style.backgroundClip === "content-box";
+
+ // Support: IE<9
+ // Iteration over object's inherited properties before its own.
+ for ( i in jQuery( support ) ) {
+ break;
+ }
+ support.ownLast = i !== "0";
+
+ // Run tests that need a body at doc ready
+ jQuery(function() {
+ var container, marginDiv, tds,
+ divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
+ body = document.getElementsByTagName("body")[0];
+
+ if ( !body ) {
+ // Return for frameset docs that don't have a body
+ return;
+ }
+
+ container = document.createElement("div");
+ container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
+
+ body.appendChild( container ).appendChild( div );
+
+ // Support: IE8
+ // Check if table cells still have offsetWidth/Height when they are set
+ // to display:none and there are still other visible table cells in a
+ // table row; if so, offsetWidth/Height are not reliable for use when
+ // determining if an element has been hidden directly using
+ // display:none (it is still safe to use offsets if a parent element is
+ // hidden; don safety goggles and see bug #4512 for more information).
+ div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
+ tds = div.getElementsByTagName("td");
+ tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+ tds[ 0 ].style.display = "";
+ tds[ 1 ].style.display = "none";
+
+ // Support: IE8
+ // Check if empty table cells still have offsetWidth/Height
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+ // Check box-sizing and margin behavior.
+ div.innerHTML = "";
+ div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
+
+ // Workaround failing boxSizing test due to offsetWidth returning wrong value
+ // with some non-1 values of body zoom, ticket #13543
+ jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
+ support.boxSizing = div.offsetWidth === 4;
+ });
+
+ // Use window.getComputedStyle because jsdom on node.js will break without it.
+ if ( window.getComputedStyle ) {
+ support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
+ support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
+
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. (#3333)
+ // Fails in WebKit before Feb 2011 nightlies
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ marginDiv = div.appendChild( document.createElement("div") );
+ marginDiv.style.cssText = div.style.cssText = divReset;
+ marginDiv.style.marginRight = marginDiv.style.width = "0";
+ div.style.width = "1px";
+
+ support.reliableMarginRight =
+ !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
+ }
+
+ if ( typeof div.style.zoom !== core_strundefined ) {
+ // Support: IE<8
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ div.innerHTML = "";
+ div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
+
+ // Support: IE6
+ // Check if elements with layout shrink-wrap their children
+ div.style.display = "block";
+ div.innerHTML = "<div></div>";
+ div.firstChild.style.width = "5px";
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
+
+ if ( support.inlineBlockNeedsLayout ) {
+ // Prevent IE 6 from affecting layout for positioned elements #11048
+ // Prevent IE from shrinking the body in IE 7 mode #12869
+ // Support: IE<8
+ body.style.zoom = 1;
+ }
+ }
+
+ body.removeChild( container );
+
+ // Null elements to avoid leaks in IE
+ container = div = tds = marginDiv = null;
+ });
+
+ // Null elements to avoid leaks in IE
+ all = select = fragment = opt = a = input = null;
+
+ return support;
+})({});
+
+var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
+ rmultiDash = /([A-Z])/g;
+
+function internalData( elem, name, data, pvt /* Internal Use Only */ ){
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var ret, thisCache,
+ internalKey = jQuery.expando,
+
+ // We have to handle DOM nodes and JS objects differently because IE6-7
+ // can't GC object references properly across the DOM-JS boundary
+ isNode = elem.nodeType,
+
+ // Only DOM nodes need the global jQuery cache; JS object data is
+ // attached directly to the object so GC can occur automatically
+ cache = isNode ? jQuery.cache : elem,
+
+ // Only defining an ID for JS objects if its cache already exists allows
+ // the code to shortcut on the same path as a DOM node with no cache
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
+
+ // Avoid doing any more work than we need to when trying to get data on an
+ // object that has no data at all
+ if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
+ return;
+ }
+
+ if ( !id ) {
+ // Only DOM nodes need a new unique ID for each element since their data
+ // ends up in the global cache
+ if ( isNode ) {
+ id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++;
+ } else {
+ id = internalKey;
+ }
+ }
+
+ if ( !cache[ id ] ) {
+ // Avoid exposing jQuery metadata on plain JS objects when the object
+ // is serialized using JSON.stringify
+ cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
+ }
+
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
+ // shallow copied over onto the existing cache
+ if ( typeof name === "object" || typeof name === "function" ) {
+ if ( pvt ) {
+ cache[ id ] = jQuery.extend( cache[ id ], name );
+ } else {
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
+ }
+ }
+
+ thisCache = cache[ id ];
+
+ // jQuery data() is stored in a separate object inside the object's internal data
+ // cache in order to avoid key collisions between internal data and user-defined
+ // data.
+ if ( !pvt ) {
+ if ( !thisCache.data ) {
+ thisCache.data = {};
+ }
+
+ thisCache = thisCache.data;
+ }
+
+ if ( data !== undefined ) {
+ thisCache[ jQuery.camelCase( name ) ] = data;
+ }
+
+ // Check for both converted-to-camel and non-converted data property names
+ // If a data property was specified
+ if ( typeof name === "string" ) {
+
+ // First Try to find as-is property data
+ ret = thisCache[ name ];
+
+ // Test for null|undefined property data
+ if ( ret == null ) {
+
+ // Try to find the camelCased property
+ ret = thisCache[ jQuery.camelCase( name ) ];
+ }
+ } else {
+ ret = thisCache;
+ }
+
+ return ret;
+}
+
+function internalRemoveData( elem, name, pvt ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var thisCache, i,
+ isNode = elem.nodeType,
+
+ // See jQuery.data for more information
+ cache = isNode ? jQuery.cache : elem,
+ id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
+
+ // If there is already no cache entry for this object, there is no
+ // purpose in continuing
+ if ( !cache[ id ] ) {
+ return;
+ }
+
+ if ( name ) {
+
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
+
+ if ( thisCache ) {
+
+ // Support array or space separated string names for data keys
+ if ( !jQuery.isArray( name ) ) {
+
+ // try the string as a key before any manipulation
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+
+ // split the camel cased version by spaces unless a key with the spaces exists
+ name = jQuery.camelCase( name );
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+ name = name.split(" ");
+ }
+ }
+ } else {
+ // If "name" is an array of keys...
+ // When data is initially created, via ("key", "val") signature,
+ // keys will be converted to camelCase.
+ // Since there is no way to tell _how_ a key was added, remove
+ // both plain key and camelCase key. #12786
+ // This will only penalize the array argument path.
+ name = name.concat( jQuery.map( name, jQuery.camelCase ) );
+ }
+
+ i = name.length;
+ while ( i-- ) {
+ delete thisCache[ name[i] ];
+ }
+
+ // If there is no data left in the cache, we want to continue
+ // and let the cache object itself get destroyed
+ if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {
+ return;
+ }
+ }
+ }
+
+ // See jQuery.data for more information
+ if ( !pvt ) {
+ delete cache[ id ].data;
+
+ // Don't destroy the parent cache unless the internal data object
+ // had been the only thing left in it
+ if ( !isEmptyDataObject( cache[ id ] ) ) {
+ return;
+ }
+ }
+
+ // Destroy the cache
+ if ( isNode ) {
+ jQuery.cleanData( [ elem ], true );
+
+ // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
+ /* jshint eqeqeq: false */
+ } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
+ /* jshint eqeqeq: true */
+ delete cache[ id ];
+
+ // When all else fails, null
+ } else {
+ cache[ id ] = null;
+ }
+}
+
+jQuery.extend({
+ cache: {},
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "applet": true,
+ "embed": true,
+ // Ban all objects except for Flash (which handle expandos)
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
+ },
+
+ hasData: function( elem ) {
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+ return !!elem && !isEmptyDataObject( elem );
+ },
+
+ data: function( elem, name, data ) {
+ return internalData( elem, name, data );
+ },
+
+ removeData: function( elem, name ) {
+ return internalRemoveData( elem, name );
+ },
+
+ // For internal use only.
+ _data: function( elem, name, data ) {
+ return internalData( elem, name, data, true );
+ },
+
+ _removeData: function( elem, name ) {
+ return internalRemoveData( elem, name, true );
+ },
+
+ // A method for determining if a DOM node can handle the data expando
+ acceptData: function( elem ) {
+ // Do not set data on non-element because it will not be cleared (#8335).
+ if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
+ return false;
+ }
+
+ var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+ // nodes accept data unless otherwise specified; rejection can be conditional
+ return !noData || noData !== true && elem.getAttribute("classid") === noData;
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ var attrs, name,
+ data = null,
+ i = 0,
+ elem = this[0];
+
+ // Special expections of .data basically thwart jQuery.access,
+ // so implement the relevant behavior ourselves
+
+ // Gets all values
+ if ( key === undefined ) {
+ if ( this.length ) {
+ data = jQuery.data( elem );
+
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
+ attrs = elem.attributes;
+ for ( ; i < attrs.length; i++ ) {
+ name = attrs[i].name;
+
+ if ( name.indexOf("data-") === 0 ) {
+ name = jQuery.camelCase( name.slice(5) );
+
+ dataAttr( elem, name, data[ name ] );
+ }
+ }
+ jQuery._data( elem, "parsedAttrs", true );
+ }
+ }
+
+ return data;
+ }
+
+ // Sets multiple values
+ if ( typeof key === "object" ) {
+ return this.each(function() {
+ jQuery.data( this, key );
+ });
+ }
+
+ return arguments.length > 1 ?
+
+ // Sets one value
+ this.each(function() {
+ jQuery.data( this, key, value );
+ }) :
+
+ // Gets one value
+ // Try to fetch any internally stored data first
+ elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ jQuery.removeData( this, key );
+ });
+ }
+});
+
+function dataAttr( elem, key, data ) {
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
+
+ data = elem.getAttribute( name );
+
+ if ( typeof data === "string" ) {
+ try {
+ data = data === "true" ? true :
+ data === "false" ? false :
+ data === "null" ? null :
+ // Only convert to a number if it doesn't change the string
+ +data + "" === data ? +data :
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ jQuery.data( elem, key, data );
+
+ } else {
+ data = undefined;
+ }
+ }
+
+ return data;
+}
+
+// checks a cache object for emptiness
+function isEmptyDataObject( obj ) {
+ var name;
+ for ( name in obj ) {
+
+ // if the public data object is empty, the private is still empty
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
+ continue;
+ }
+ if ( name !== "toJSON" ) {
+ return false;
+ }
+ }
+
+ return true;
+}
+jQuery.extend({
+ queue: function( elem, type, data ) {
+ var queue;
+
+ if ( elem ) {
+ type = ( type || "fx" ) + "queue";
+ queue = jQuery._data( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !queue || jQuery.isArray(data) ) {
+ queue = jQuery._data( elem, type, jQuery.makeArray(data) );
+ } else {
+ queue.push( data );
+ }
+ }
+ return queue || [];
+ }
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ),
+ startLength = queue.length,
+ fn = queue.shift(),
+ hooks = jQuery._queueHooks( elem, type ),
+ next = function() {
+ jQuery.dequeue( elem, type );
+ };
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ startLength--;
+ }
+
+ if ( fn ) {
+
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift( "inprogress" );
+ }
+
+ // clear up the last queue stop function
+ delete hooks.stop;
+ fn.call( elem, next, hooks );
+ }
+
+ if ( !startLength && hooks ) {
+ hooks.empty.fire();
+ }
+ },
+
+ // not intended for public consumption - generates a queueHooks object, or returns the current one
+ _queueHooks: function( elem, type ) {
+ var key = type + "queueHooks";
+ return jQuery._data( elem, key ) || jQuery._data( elem, key, {
+ empty: jQuery.Callbacks("once memory").add(function() {
+ jQuery._removeData( elem, type + "queue" );
+ jQuery._removeData( elem, key );
+ })
+ });
+ }
+});
+
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ var setter = 2;
+
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ setter--;
+ }
+
+ if ( arguments.length < setter ) {
+ return jQuery.queue( this[0], type );
+ }
+
+ return data === undefined ?
+ this :
+ this.each(function() {
+ var queue = jQuery.queue( this, type, data );
+
+ // ensure a hooks for this queue
+ jQuery._queueHooks( this, type );
+
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function( next, hooks ) {
+ var timeout = setTimeout( next, time );
+ hooks.stop = function() {
+ clearTimeout( timeout );
+ };
+ });
+ },
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ },
+ // Get a promise resolved when queues of a certain type
+ // are emptied (fx is the type by default)
+ promise: function( type, obj ) {
+ var tmp,
+ count = 1,
+ defer = jQuery.Deferred(),
+ elements = this,
+ i = this.length,
+ resolve = function() {
+ if ( !( --count ) ) {
+ defer.resolveWith( elements, [ elements ] );
+ }
+ };
+
+ if ( typeof type !== "string" ) {
+ obj = type;
+ type = undefined;
+ }
+ type = type || "fx";
+
+ while( i-- ) {
+ tmp = jQuery._data( elements[ i ], type + "queueHooks" );
+ if ( tmp && tmp.empty ) {
+ count++;
+ tmp.empty.add( resolve );
+ }
+ }
+ resolve();
+ return defer.promise( obj );
+ }
+});
+var nodeHook, boolHook,
+ rclass = /[\t\r\n\f]/g,
+ rreturn = /\r/g,
+ rfocusable = /^(?:input|select|textarea|button|object)$/i,
+ rclickable = /^(?:a|area)$/i,
+ ruseDefault = /^(?:checked|selected)$/i,
+ getSetAttribute = jQuery.support.getSetAttribute,
+ getSetInput = jQuery.support.input;
+
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
+ },
+
+ removeAttr: function( name ) {
+ return this.each(function() {
+ jQuery.removeAttr( this, name );
+ });
+ },
+
+ prop: function( name, value ) {
+ return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
+ },
+
+ removeProp: function( name ) {
+ name = jQuery.propFix[ name ] || name;
+ return this.each(function() {
+ // try/catch handles cases where IE balks (such as removing a property on window)
+ try {
+ this[ name ] = undefined;
+ delete this[ name ];
+ } catch( e ) {}
+ });
+ },
+
+ addClass: function( value ) {
+ var classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).addClass( value.call( this, j, this.className ) );
+ });
+ }
+
+ if ( proceed ) {
+ // The disjunction here is for better compressibility (see removeClass)
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ " "
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
+ cur += clazz + " ";
+ }
+ }
+ elem.className = jQuery.trim( cur );
+
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ var classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = arguments.length === 0 || typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).removeClass( value.call( this, j, this.className ) );
+ });
+ }
+ if ( proceed ) {
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ // This expression is here for better compressibility (see addClass)
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ ""
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ // Remove *all* instances
+ while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
+ cur = cur.replace( " " + clazz + " ", " " );
+ }
+ }
+ elem.className = value ? jQuery.trim( cur ) : "";
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value;
+
+ if ( typeof stateVal === "boolean" && type === "string" ) {
+ return stateVal ? this.addClass( value ) : this.removeClass( value );
+ }
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( i ) {
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+ });
+ }
+
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className,
+ i = 0,
+ self = jQuery( this ),
+ classNames = value.match( core_rnotwhite ) || [];
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space separated list
+ if ( self.hasClass( className ) ) {
+ self.removeClass( className );
+ } else {
+ self.addClass( className );
+ }
+ }
+
+ // Toggle whole class name
+ } else if ( type === core_strundefined || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery._data( this, "__className__", this.className );
+ }
+
+ // If the element has a class name or if we're passed "false",
+ // then remove the whole classname (if there was one, the above saved it).
+ // Otherwise bring back whatever was previously saved (if anything),
+ // falling back to the empty string if nothing was stored.
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
+ }
+ });
+ },
+
+ hasClass: function( selector ) {
+ var className = " " + selector + " ",
+ i = 0,
+ l = this.length;
+ for ( ; i < l; i++ ) {
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ val: function( value ) {
+ var ret, hooks, isFunction,
+ elem = this[0];
+
+ if ( !arguments.length ) {
+ if ( elem ) {
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
+
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+ return ret;
+ }
+
+ ret = elem.value;
+
+ return typeof ret === "string" ?
+ // handle most common string cases
+ ret.replace(rreturn, "") :
+ // handle cases where value is null/undef or number
+ ret == null ? "" : ret;
+ }
+
+ return;
+ }
+
+ isFunction = jQuery.isFunction( value );
+
+ return this.each(function( i ) {
+ var val;
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call( this, i, jQuery( this ).val() );
+ } else {
+ val = value;
+ }
+
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+ } else if ( typeof val === "number" ) {
+ val += "";
+ } else if ( jQuery.isArray( val ) ) {
+ val = jQuery.map(val, function ( value ) {
+ return value == null ? "" : value + "";
+ });
+ }
+
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
+
+ // If set returns undefined, fall back to normal setting
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+ this.value = val;
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ valHooks: {
+ option: {
+ get: function( elem ) {
+ // Use proper attribute retrieval(#6932, #12072)
+ var val = jQuery.find.attr( elem, "value" );
+ return val != null ?
+ val :
+ elem.text;
+ }
+ },
+ select: {
+ get: function( elem ) {
+ var value, option,
+ options = elem.options,
+ index = elem.selectedIndex,
+ one = elem.type === "select-one" || index < 0,
+ values = one ? null : [],
+ max = one ? index + 1 : options.length,
+ i = index < 0 ?
+ max :
+ one ? index : 0;
+
+ // Loop through all the selected options
+ for ( ; i < max; i++ ) {
+ option = options[ i ];
+
+ // oldIE doesn't update selected after form reset (#2551)
+ if ( ( option.selected || i === index ) &&
+ // Don't return options that are disabled or in a disabled optgroup
+ ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
+ ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
+
+ // Get the specific value for the option
+ value = jQuery( option ).val();
+
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ return values;
+ },
+
+ set: function( elem, value ) {
+ var optionSet, option,
+ options = elem.options,
+ values = jQuery.makeArray( value ),
+ i = options.length;
+
+ while ( i-- ) {
+ option = options[ i ];
+ if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
+ optionSet = true;
+ }
+ }
+
+ // force browsers to behave consistently when non-matching value is set
+ if ( !optionSet ) {
+ elem.selectedIndex = -1;
+ }
+ return values;
+ }
+ }
+ },
+
+ attr: function( elem, name, value ) {
+ var hooks, ret,
+ nType = elem.nodeType;
+
+ // don't get/set attributes on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ // Fallback to prop when attributes are not supported
+ if ( typeof elem.getAttribute === core_strundefined ) {
+ return jQuery.prop( elem, name, value );
+ }
+
+ // All attributes are lowercase
+ // Grab necessary hook if one is defined
+ if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
+ name = name.toLowerCase();
+ hooks = jQuery.attrHooks[ name ] ||
+ ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
+ }
+
+ if ( value !== undefined ) {
+
+ if ( value === null ) {
+ jQuery.removeAttr( elem, name );
+
+ } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ elem.setAttribute( name, value + "" );
+ return value;
+ }
+
+ } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+ ret = jQuery.find.attr( elem, name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return ret == null ?
+ undefined :
+ ret;
+ }
+ },
+
+ removeAttr: function( elem, value ) {
+ var name, propName,
+ i = 0,
+ attrNames = value && value.match( core_rnotwhite );
+
+ if ( attrNames && elem.nodeType === 1 ) {
+ while ( (name = attrNames[i++]) ) {
+ propName = jQuery.propFix[ name ] || name;
+
+ // Boolean attributes get special treatment (#10870)
+ if ( jQuery.expr.match.bool.test( name ) ) {
+ // Set corresponding property to false
+ if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
+ elem[ propName ] = false;
+ // Support: IE<9
+ // Also clear defaultChecked/defaultSelected (if appropriate)
+ } else {
+ elem[ jQuery.camelCase( "default-" + name ) ] =
+ elem[ propName ] = false;
+ }
+
+ // See #9699 for explanation of this approach (setting first, then removal)
+ } else {
+ jQuery.attr( elem, name, "" );
+ }
+
+ elem.removeAttribute( getSetAttribute ? name : propName );
+ }
+ }
+ },
+
+ attrHooks: {
+ type: {
+ set: function( elem, value ) {
+ if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
+ // Setting the type on a radio button after the value resets the value in IE6-9
+ // Reset value to default in case type is set after value during creation
+ var val = elem.value;
+ elem.setAttribute( "type", value );
+ if ( val ) {
+ elem.value = val;
+ }
+ return value;
+ }
+ }
+ }
+ },
+
+ propFix: {
+ "for": "htmlFor",
+ "class": "className"
+ },
+
+ prop: function( elem, name, value ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set properties on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
+
+ if ( value !== undefined ) {
+ return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
+ ret :
+ ( elem[ name ] = value );
+
+ } else {
+ return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
+ ret :
+ elem[ name ];
+ }
+ },
+
+ propHooks: {
+ tabIndex: {
+ get: function( elem ) {
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ // Use proper attribute retrieval(#12072)
+ var tabindex = jQuery.find.attr( elem, "tabindex" );
+
+ return tabindex ?
+ parseInt( tabindex, 10 ) :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ -1;
+ }
+ }
+ }
+});
+
+// Hooks for boolean attributes
+boolHook = {
+ set: function( elem, value, name ) {
+ if ( value === false ) {
+ // Remove boolean attributes when set to false
+ jQuery.removeAttr( elem, name );
+ } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
+ // IE<8 needs the *property* name
+ elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
+
+ // Use defaultChecked and defaultSelected for oldIE
+ } else {
+ elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
+ }
+
+ return name;
+ }
+};
+jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
+ var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;
+
+ jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
+ function( elem, name, isXML ) {
+ var fn = jQuery.expr.attrHandle[ name ],
+ ret = isXML ?
+ undefined :
+ /* jshint eqeqeq: false */
+ (jQuery.expr.attrHandle[ name ] = undefined) !=
+ getter( elem, name, isXML ) ?
+
+ name.toLowerCase() :
+ null;
+ jQuery.expr.attrHandle[ name ] = fn;
+ return ret;
+ } :
+ function( elem, name, isXML ) {
+ return isXML ?
+ undefined :
+ elem[ jQuery.camelCase( "default-" + name ) ] ?
+ name.toLowerCase() :
+ null;
+ };
+});
+
+// fix oldIE attroperties
+if ( !getSetInput || !getSetAttribute ) {
+ jQuery.attrHooks.value = {
+ set: function( elem, value, name ) {
+ if ( jQuery.nodeName( elem, "input" ) ) {
+ // Does not return so that setAttribute is also used
+ elem.defaultValue = value;
+ } else {
+ // Use nodeHook if defined (#1954); otherwise setAttribute is fine
+ return nodeHook && nodeHook.set( elem, value, name );
+ }
+ }
+ };
+}
+
+// IE6/7 do not support getting/setting some attributes with get/setAttribute
+if ( !getSetAttribute ) {
+
+ // Use this for any attribute in IE6/7
+ // This fixes almost every IE6/7 issue
+ nodeHook = {
+ set: function( elem, value, name ) {
+ // Set the existing or create a new attribute node
+ var ret = elem.getAttributeNode( name );
+ if ( !ret ) {
+ elem.setAttributeNode(
+ (ret = elem.ownerDocument.createAttribute( name ))
+ );
+ }
+
+ ret.value = value += "";
+
+ // Break association with cloned elements by also using setAttribute (#9646)
+ return name === "value" || value === elem.getAttribute( name ) ?
+ value :
+ undefined;
+ }
+ };
+ jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords =
+ // Some attributes are constructed with empty-string values when not defined
+ function( elem, name, isXML ) {
+ var ret;
+ return isXML ?
+ undefined :
+ (ret = elem.getAttributeNode( name )) && ret.value !== "" ?
+ ret.value :
+ null;
+ };
+ jQuery.valHooks.button = {
+ get: function( elem, name ) {
+ var ret = elem.getAttributeNode( name );
+ return ret && ret.specified ?
+ ret.value :
+ undefined;
+ },
+ set: nodeHook.set
+ };
+
+ // Set contenteditable to false on removals(#10429)
+ // Setting to empty string throws an error as an invalid value
+ jQuery.attrHooks.contenteditable = {
+ set: function( elem, value, name ) {
+ nodeHook.set( elem, value === "" ? false : value, name );
+ }
+ };
+
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )
+ // This is for removals
+ jQuery.each([ "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = {
+ set: function( elem, value ) {
+ if ( value === "" ) {
+ elem.setAttribute( name, "auto" );
+ return value;
+ }
+ }
+ };
+ });
+}
+
+
+// Some attributes require a special call on IE
+// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+if ( !jQuery.support.hrefNormalized ) {
+ // href/src property should get the full normalized URL (#10299/#12915)
+ jQuery.each([ "href", "src" ], function( i, name ) {
+ jQuery.propHooks[ name ] = {
+ get: function( elem ) {
+ return elem.getAttribute( name, 4 );
+ }
+ };
+ });
+}
+
+if ( !jQuery.support.style ) {
+ jQuery.attrHooks.style = {
+ get: function( elem ) {
+ // Return undefined in the case of empty string
+ // Note: IE uppercases css property names, but if we were to .toLowerCase()
+ // .cssText, that would destroy case senstitivity in URL's, like in "background"
+ return elem.style.cssText || undefined;
+ },
+ set: function( elem, value ) {
+ return ( elem.style.cssText = value + "" );
+ }
+ };
+}
+
+// Safari mis-reports the default selected property of an option
+// Accessing the parent's selectedIndex property fixes it
+if ( !jQuery.support.optSelected ) {
+ jQuery.propHooks.selected = {
+ get: function( elem ) {
+ var parent = elem.parentNode;
+
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
+ return null;
+ }
+ };
+}
+
+jQuery.each([
+ "tabIndex",
+ "readOnly",
+ "maxLength",
+ "cellSpacing",
+ "cellPadding",
+ "rowSpan",
+ "colSpan",
+ "useMap",
+ "frameBorder",
+ "contentEditable"
+], function() {
+ jQuery.propFix[ this.toLowerCase() ] = this;
+});
+
+// IE6/7 call enctype encoding
+if ( !jQuery.support.enctype ) {
+ jQuery.propFix.enctype = "encoding";
+}
+
+// Radios and checkboxes getter/setter
+jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = {
+ set: function( elem, value ) {
+ if ( jQuery.isArray( value ) ) {
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+ }
+ }
+ };
+ if ( !jQuery.support.checkOn ) {
+ jQuery.valHooks[ this ].get = function( elem ) {
+ // Support: Webkit
+ // "" is returned instead of "on" if a value isn't specified
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ };
+ }
+});
+var rformElems = /^(?:input|select|textarea)$/i,
+ rkeyEvent = /^key/,
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+ rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
+
+function returnTrue() {
+ return true;
+}
+
+function returnFalse() {
+ return false;
+}
+
+function safeActiveElement() {
+ try {
+ return document.activeElement;
+ } catch ( err ) { }
+}
+
+/*
+ * Helper functions for managing events -- not part of the public interface.
+ * Props to Dean Edwards' addEvent library for many of the ideas.
+ */
+jQuery.event = {
+
+ global: {},
+
+ add: function( elem, types, handler, data, selector ) {
+ var tmp, events, t, handleObjIn,
+ special, eventHandle, handleObj,
+ handlers, type, namespaces, origType,
+ elemData = jQuery._data( elem );
+
+ // Don't attach events to noData or text/comment nodes (but allow plain objects)
+ if ( !elemData ) {
+ return;
+ }
+
+ // Caller can pass in an object of custom data in lieu of the handler
+ if ( handler.handler ) {
+ handleObjIn = handler;
+ handler = handleObjIn.handler;
+ selector = handleObjIn.selector;
+ }
+
+ // Make sure that the handler has a unique ID, used to find/remove it later
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
+
+ // Init the element's event structure and main handler, if this is the first
+ if ( !(events = elemData.events) ) {
+ events = elemData.events = {};
+ }
+ if ( !(eventHandle = elemData.handle) ) {
+ eventHandle = elemData.handle = function( e ) {
+ // Discard the second event of a jQuery.event.trigger() and
+ // when an event is called after a page has unloaded
+ return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
+ jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
+ undefined;
+ };
+ // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
+ eventHandle.elem = elem;
+ }
+
+ // Handle multiple events separated by a space
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // There *must* be a type, no attaching namespace-only handlers
+ if ( !type ) {
+ continue;
+ }
+
+ // If event changes its type, use the special event handlers for the changed type
+ special = jQuery.event.special[ type ] || {};
+
+ // If selector defined, determine special event api type, otherwise given type
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+
+ // Update special based on newly reset type
+ special = jQuery.event.special[ type ] || {};
+
+ // handleObj is passed to all event handlers
+ handleObj = jQuery.extend({
+ type: type,
+ origType: origType,
+ data: data,
+ handler: handler,
+ guid: handler.guid,
+ selector: selector,
+ needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
+ namespace: namespaces.join(".")
+ }, handleObjIn );
+
+ // Init the event handler queue if we're the first
+ if ( !(handlers = events[ type ]) ) {
+ handlers = events[ type ] = [];
+ handlers.delegateCount = 0;
+
+ // Only use addEventListener/attachEvent if the special events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ // Bind the global event handler to the element
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, eventHandle );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ special.add.call( elem, handleObj );
+
+ if ( !handleObj.handler.guid ) {
+ handleObj.handler.guid = handler.guid;
+ }
+ }
+
+ // Add to the element's handler list, delegates in front
+ if ( selector ) {
+ handlers.splice( handlers.delegateCount++, 0, handleObj );
+ } else {
+ handlers.push( handleObj );
+ }
+
+ // Keep track of which events have ever been used, for event optimization
+ jQuery.event.global[ type ] = true;
+ }
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, selector, mappedTypes ) {
+ var j, handleObj, tmp,
+ origCount, t, events,
+ special, handlers, type,
+ namespaces, origType,
+ elemData = jQuery.hasData( elem ) && jQuery._data( elem );
+
+ if ( !elemData || !(events = elemData.events) ) {
+ return;
+ }
+
+ // Once for each type.namespace in types; type may be omitted
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // Unbind all events (on this namespace, if provided) for the element
+ if ( !type ) {
+ for ( type in events ) {
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
+ }
+ continue;
+ }
+
+ special = jQuery.event.special[ type ] || {};
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+ handlers = events[ type ] || [];
+ tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
+
+ // Remove matching events
+ origCount = j = handlers.length;
+ while ( j-- ) {
+ handleObj = handlers[ j ];
+
+ if ( ( mappedTypes || origType === handleObj.origType ) &&
+ ( !handler || handler.guid === handleObj.guid ) &&
+ ( !tmp || tmp.test( handleObj.namespace ) ) &&
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
+ handlers.splice( j, 1 );
+
+ if ( handleObj.selector ) {
+ handlers.delegateCount--;
+ }
+ if ( special.remove ) {
+ special.remove.call( elem, handleObj );
+ }
+ }
+ }
+
+ // Remove generic event handler if we removed something and no more handlers exist
+ // (avoids potential for endless recursion during removal of special event handlers)
+ if ( origCount && !handlers.length ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
+ jQuery.removeEvent( elem, type, elemData.handle );
+ }
+
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ delete elemData.handle;
+
+ // removeData also checks for emptiness and clears the expando if empty
+ // so use it instead of delete
+ jQuery._removeData( elem, "events" );
+ }
+ },
+
+ trigger: function( event, data, elem, onlyHandlers ) {
+ var handle, ontype, cur,
+ bubbleType, special, tmp, i,
+ eventPath = [ elem || document ],
+ type = core_hasOwn.call( event, "type" ) ? event.type : event,
+ namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
+
+ cur = tmp = elem = elem || document;
+
+ // Don't do events on text and comment nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
+ return;
+ }
+
+ if ( type.indexOf(".") >= 0 ) {
+ // Namespaced trigger; create a regexp to match event type in handle()
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ namespaces.sort();
+ }
+ ontype = type.indexOf(":") < 0 && "on" + type;
+
+ // Caller can pass in a jQuery.Event object, Object, or just an event type string
+ event = event[ jQuery.expando ] ?
+ event :
+ new jQuery.Event( type, typeof event === "object" && event );
+
+ // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
+ event.isTrigger = onlyHandlers ? 2 : 3;
+ event.namespace = namespaces.join(".");
+ event.namespace_re = event.namespace ?
+ new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
+ null;
+
+ // Clean up the event in case it is being reused
+ event.result = undefined;
+ if ( !event.target ) {
+ event.target = elem;
+ }
+
+ // Clone any incoming data and prepend the event, creating the handler arg list
+ data = data == null ?
+ [ event ] :
+ jQuery.makeArray( data, [ event ] );
+
+ // Allow special events to draw outside the lines
+ special = jQuery.event.special[ type ] || {};
+ if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
+ return;
+ }
+
+ // Determine event propagation path in advance, per W3C events spec (#9951)
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+ bubbleType = special.delegateType || type;
+ if ( !rfocusMorph.test( bubbleType + type ) ) {
+ cur = cur.parentNode;
+ }
+ for ( ; cur; cur = cur.parentNode ) {
+ eventPath.push( cur );
+ tmp = cur;
+ }
+
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
+ if ( tmp === (elem.ownerDocument || document) ) {
+ eventPath.push( tmp.defaultView || tmp.parentWindow || window );
+ }
+ }
+
+ // Fire handlers on the event path
+ i = 0;
+ while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
+
+ event.type = i > 1 ?
+ bubbleType :
+ special.bindType || type;
+
+ // jQuery handler
+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
+ if ( handle ) {
+ handle.apply( cur, data );
+ }
+
+ // Native handler
+ handle = ontype && cur[ ontype ];
+ if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
+ event.preventDefault();
+ }
+ }
+ event.type = type;
+
+ // If nobody prevented the default action, do it now
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
+
+ if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
+ jQuery.acceptData( elem ) ) {
+
+ // Call a native DOM method on the target with the same name name as the event.
+ // Can't use an .isFunction() check here because IE6/7 fails that test.
+ // Don't do default actions on window, that's where global variables be (#6170)
+ if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
+
+ // Don't re-trigger an onFOO event when we call its FOO() method
+ tmp = elem[ ontype ];
+
+ if ( tmp ) {
+ elem[ ontype ] = null;
+ }
+
+ // Prevent re-triggering of the same event, since we already bubbled it above
+ jQuery.event.triggered = type;
+ try {
+ elem[ type ]();
+ } catch ( e ) {
+ // IE<9 dies on focus/blur to hidden element (#1486,#12518)
+ // only reproducible on winXP IE8 native, not IE9 in IE8 mode
+ }
+ jQuery.event.triggered = undefined;
+
+ if ( tmp ) {
+ elem[ ontype ] = tmp;
+ }
+ }
+ }
+ }
+
+ return event.result;
+ },
+
+ dispatch: function( event ) {
+
+ // Make a writable jQuery.Event from the native event object
+ event = jQuery.event.fix( event );
+
+ var i, ret, handleObj, matched, j,
+ handlerQueue = [],
+ args = core_slice.call( arguments ),
+ handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
+ special = jQuery.event.special[ event.type ] || {};
+
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event
+ args[0] = event;
+ event.delegateTarget = this;
+
+ // Call the preDispatch hook for the mapped type, and let it bail if desired
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
+ return;
+ }
+
+ // Determine handlers
+ handlerQueue = jQuery.event.handlers.call( this, event, handlers );
+
+ // Run delegates first; they may want to stop propagation beneath us
+ i = 0;
+ while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
+ event.currentTarget = matched.elem;
+
+ j = 0;
+ while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
+
+ // Triggered event must either 1) have no namespace, or
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+ if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
+
+ event.handleObj = handleObj;
+ event.data = handleObj.data;
+
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+ .apply( matched.elem, args );
+
+ if ( ret !== undefined ) {
+ if ( (event.result = ret) === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+ }
+ }
+ }
+
+ // Call the postDispatch hook for the mapped type
+ if ( special.postDispatch ) {
+ special.postDispatch.call( this, event );
+ }
+
+ return event.result;
+ },
+
+ handlers: function( event, handlers ) {
+ var sel, handleObj, matches, i,
+ handlerQueue = [],
+ delegateCount = handlers.delegateCount,
+ cur = event.target;
+
+ // Find delegate handlers
+ // Black-hole SVG <use> instance trees (#13180)
+ // Avoid non-left-click bubbling in Firefox (#3861)
+ if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
+
+ /* jshint eqeqeq: false */
+ for ( ; cur != this; cur = cur.parentNode || this ) {
+ /* jshint eqeqeq: true */
+
+ // Don't check non-elements (#13208)
+ // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
+ if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
+ matches = [];
+ for ( i = 0; i < delegateCount; i++ ) {
+ handleObj = handlers[ i ];
+
+ // Don't conflict with Object.prototype properties (#13203)
+ sel = handleObj.selector + " ";
+
+ if ( matches[ sel ] === undefined ) {
+ matches[ sel ] = handleObj.needsContext ?
+ jQuery( sel, this ).index( cur ) >= 0 :
+ jQuery.find( sel, this, null, [ cur ] ).length;
+ }
+ if ( matches[ sel ] ) {
+ matches.push( handleObj );
+ }
+ }
+ if ( matches.length ) {
+ handlerQueue.push({ elem: cur, handlers: matches });
+ }
+ }
+ }
+ }
+
+ // Add the remaining (directly-bound) handlers
+ if ( delegateCount < handlers.length ) {
+ handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
+ }
+
+ return handlerQueue;
+ },
+
+ fix: function( event ) {
+ if ( event[ jQuery.expando ] ) {
+ return event;
+ }
+
+ // Create a writable copy of the event object and normalize some properties
+ var i, prop, copy,
+ type = event.type,
+ originalEvent = event,
+ fixHook = this.fixHooks[ type ];
+
+ if ( !fixHook ) {
+ this.fixHooks[ type ] = fixHook =
+ rmouseEvent.test( type ) ? this.mouseHooks :
+ rkeyEvent.test( type ) ? this.keyHooks :
+ {};
+ }
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
+
+ event = new jQuery.Event( originalEvent );
+
+ i = copy.length;
+ while ( i-- ) {
+ prop = copy[ i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Support: IE<9
+ // Fix target property (#1925)
+ if ( !event.target ) {
+ event.target = originalEvent.srcElement || document;
+ }
+
+ // Support: Chrome 23+, Safari?
+ // Target should not be a text node (#504, #13143)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
+
+ // Support: IE<9
+ // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
+ event.metaKey = !!event.metaKey;
+
+ return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
+ },
+
+ // Includes some event props shared by KeyEvent and MouseEvent
+ props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
+
+ fixHooks: {},
+
+ keyHooks: {
+ props: "char charCode key keyCode".split(" "),
+ filter: function( event, original ) {
+
+ // Add which for key events
+ if ( event.which == null ) {
+ event.which = original.charCode != null ? original.charCode : original.keyCode;
+ }
+
+ return event;
+ }
+ },
+
+ mouseHooks: {
+ props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
+ filter: function( event, original ) {
+ var body, eventDoc, doc,
+ button = original.button,
+ fromElement = original.fromElement;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && original.clientX != null ) {
+ eventDoc = event.target.ownerDocument || document;
+ doc = eventDoc.documentElement;
+ body = eventDoc.body;
+
+ event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
+ event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
+ }
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && fromElement ) {
+ event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
+ }
+
+ // Add which for click: 1 === left; 2 === middle; 3 === right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && button !== undefined ) {
+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
+ }
+
+ return event;
+ }
+ },
+
+ special: {
+ load: {
+ // Prevent triggered image.load events from bubbling to window.load
+ noBubble: true
+ },
+ focus: {
+ // Fire native event if possible so blur/focus sequence is correct
+ trigger: function() {
+ if ( this !== safeActiveElement() && this.focus ) {
+ try {
+ this.focus();
+ return false;
+ } catch ( e ) {
+ // Support: IE<9
+ // If we error on focus to hidden element (#1486, #12518),
+ // let .trigger() run the handlers
+ }
+ }
+ },
+ delegateType: "focusin"
+ },
+ blur: {
+ trigger: function() {
+ if ( this === safeActiveElement() && this.blur ) {
+ this.blur();
+ return false;
+ }
+ },
+ delegateType: "focusout"
+ },
+ click: {
+ // For checkbox, fire native event so checked state will be right
+ trigger: function() {
+ if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
+ this.click();
+ return false;
+ }
+ },
+
+ // For cross-browser consistency, don't fire native .click() on links
+ _default: function( event ) {
+ return jQuery.nodeName( event.target, "a" );
+ }
+ },
+
+ beforeunload: {
+ postDispatch: function( event ) {
+
+ // Even when returnValue equals to undefined Firefox will still show alert
+ if ( event.result !== undefined ) {
+ event.originalEvent.returnValue = event.result;
+ }
+ }
+ }
+ },
+
+ simulate: function( type, elem, event, bubble ) {
+ // Piggyback on a donor event to simulate a different one.
+ // Fake originalEvent to avoid donor's stopPropagation, but if the
+ // simulated event prevents default then we do the same on the donor.
+ var e = jQuery.extend(
+ new jQuery.Event(),
+ event,
+ {
+ type: type,
+ isSimulated: true,
+ originalEvent: {}
+ }
+ );
+ if ( bubble ) {
+ jQuery.event.trigger( e, null, elem );
+ } else {
+ jQuery.event.dispatch.call( elem, e );
+ }
+ if ( e.isDefaultPrevented() ) {
+ event.preventDefault();
+ }
+ }
+};
+
+jQuery.removeEvent = document.removeEventListener ?
+ function( elem, type, handle ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
+ } :
+ function( elem, type, handle ) {
+ var name = "on" + type;
+
+ if ( elem.detachEvent ) {
+
+ // #8545, #7054, preventing memory leaks for custom events in IE6-8
+ // detachEvent needed property on element, by name of that event, to properly expose it to GC
+ if ( typeof elem[ name ] === core_strundefined ) {
+ elem[ name ] = null;
+ }
+
+ elem.detachEvent( name, handle );
+ }
+ };
+
+jQuery.Event = function( src, props ) {
+ // Allow instantiation without the 'new' keyword
+ if ( !(this instanceof jQuery.Event) ) {
+ return new jQuery.Event( src, props );
+ }
+
+ // Event object
+ if ( src && src.type ) {
+ this.originalEvent = src;
+ this.type = src.type;
+
+ // Events bubbling up the document may have been marked as prevented
+ // by a handler lower down the tree; reflect the correct value.
+ this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
+ src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
+
+ // Event type
+ } else {
+ this.type = src;
+ }
+
+ // Put explicitly provided properties onto the event object
+ if ( props ) {
+ jQuery.extend( this, props );
+ }
+
+ // Create a timestamp if incoming event doesn't have one
+ this.timeStamp = src && src.timeStamp || jQuery.now();
+
+ // Mark it as fixed
+ this[ jQuery.expando ] = true;
+};
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse,
+
+ preventDefault: function() {
+ var e = this.originalEvent;
+
+ this.isDefaultPrevented = returnTrue;
+ if ( !e ) {
+ return;
+ }
+
+ // If preventDefault exists, run it on the original event
+ if ( e.preventDefault ) {
+ e.preventDefault();
+
+ // Support: IE
+ // Otherwise set the returnValue property of the original event to false
+ } else {
+ e.returnValue = false;
+ }
+ },
+ stopPropagation: function() {
+ var e = this.originalEvent;
+
+ this.isPropagationStopped = returnTrue;
+ if ( !e ) {
+ return;
+ }
+ // If stopPropagation exists, run it on the original event
+ if ( e.stopPropagation ) {
+ e.stopPropagation();
+ }
+
+ // Support: IE
+ // Set the cancelBubble property of the original event to true
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation: function() {
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ }
+};
+
+// Create mouseenter/leave events using mouseover/out and event-time checks
+jQuery.each({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+}, function( orig, fix ) {
+ jQuery.event.special[ orig ] = {
+ delegateType: fix,
+ bindType: fix,
+
+ handle: function( event ) {
+ var ret,
+ target = this,
+ related = event.relatedTarget,
+ handleObj = event.handleObj;
+
+ // For mousenter/leave call the handler if related is outside the target.
+ // NB: No relatedTarget if the mouse left/entered the browser window
+ if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
+ event.type = handleObj.origType;
+ ret = handleObj.handler.apply( this, arguments );
+ event.type = fix;
+ }
+ return ret;
+ }
+ };
+});
+
+// IE submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+ jQuery.event.special.submit = {
+ setup: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Lazy-add a submit handler when a descendant form may potentially be submitted
+ jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
+ // Node name check avoids a VML-related crash in IE (#9807)
+ var elem = e.target,
+ form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
+ if ( form && !jQuery._data( form, "submitBubbles" ) ) {
+ jQuery.event.add( form, "submit._submit", function( event ) {
+ event._submit_bubble = true;
+ });
+ jQuery._data( form, "submitBubbles", true );
+ }
+ });
+ // return undefined since we don't need an event listener
+ },
+
+ postDispatch: function( event ) {
+ // If form was submitted by the user, bubble the event up the tree
+ if ( event._submit_bubble ) {
+ delete event._submit_bubble;
+ if ( this.parentNode && !event.isTrigger ) {
+ jQuery.event.simulate( "submit", this.parentNode, event, true );
+ }
+ }
+ },
+
+ teardown: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
+ jQuery.event.remove( this, "._submit" );
+ }
+ };
+}
+
+// IE change delegation and checkbox/radio fix
+if ( !jQuery.support.changeBubbles ) {
+
+ jQuery.event.special.change = {
+
+ setup: function() {
+
+ if ( rformElems.test( this.nodeName ) ) {
+ // IE doesn't fire change on a check/radio until blur; trigger it on click
+ // after a propertychange. Eat the blur-change in special.change.handle.
+ // This still fires onchange a second time for check/radio after blur.
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ jQuery.event.add( this, "propertychange._change", function( event ) {
+ if ( event.originalEvent.propertyName === "checked" ) {
+ this._just_changed = true;
+ }
+ });
+ jQuery.event.add( this, "click._change", function( event ) {
+ if ( this._just_changed && !event.isTrigger ) {
+ this._just_changed = false;
+ }
+ // Allow triggered, simulated change events (#11500)
+ jQuery.event.simulate( "change", this, event, true );
+ });
+ }
+ return false;
+ }
+ // Delegated event; lazy-add a change handler on descendant inputs
+ jQuery.event.add( this, "beforeactivate._change", function( e ) {
+ var elem = e.target;
+
+ if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
+ jQuery.event.add( elem, "change._change", function( event ) {
+ if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
+ jQuery.event.simulate( "change", this.parentNode, event, true );
+ }
+ });
+ jQuery._data( elem, "changeBubbles", true );
+ }
+ });
+ },
+
+ handle: function( event ) {
+ var elem = event.target;
+
+ // Swallow native change events from checkbox/radio, we already triggered them above
+ if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
+ return event.handleObj.handler.apply( this, arguments );
+ }
+ },
+
+ teardown: function() {
+ jQuery.event.remove( this, "._change" );
+
+ return !rformElems.test( this.nodeName );
+ }
+ };
+}
+
+// Create "bubbling" focus and blur events
+if ( !jQuery.support.focusinBubbles ) {
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+
+ // Attach a single capturing handler while someone wants focusin/focusout
+ var attaches = 0,
+ handler = function( event ) {
+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
+ };
+
+ jQuery.event.special[ fix ] = {
+ setup: function() {
+ if ( attaches++ === 0 ) {
+ document.addEventListener( orig, handler, true );
+ }
+ },
+ teardown: function() {
+ if ( --attaches === 0 ) {
+ document.removeEventListener( orig, handler, true );
+ }
+ }
+ };
+ });
+}
+
+jQuery.fn.extend({
+
+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
+ var type, origFn;
+
+ // Types can be a map of types/handlers
+ if ( typeof types === "object" ) {
+ // ( types-Object, selector, data )
+ if ( typeof selector !== "string" ) {
+ // ( types-Object, data )
+ data = data || selector;
+ selector = undefined;
+ }
+ for ( type in types ) {
+ this.on( type, selector, data, types[ type ], one );
+ }
+ return this;
+ }
+
+ if ( data == null && fn == null ) {
+ // ( types, fn )
+ fn = selector;
+ data = selector = undefined;
+ } else if ( fn == null ) {
+ if ( typeof selector === "string" ) {
+ // ( types, selector, fn )
+ fn = data;
+ data = undefined;
+ } else {
+ // ( types, data, fn )
+ fn = data;
+ data = selector;
+ selector = undefined;
+ }
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ } else if ( !fn ) {
+ return this;
+ }
+
+ if ( one === 1 ) {
+ origFn = fn;
+ fn = function( event ) {
+ // Can use an empty set, since event contains the info
+ jQuery().off( event );
+ return origFn.apply( this, arguments );
+ };
+ // Use same guid so caller can remove using origFn
+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
+ }
+ return this.each( function() {
+ jQuery.event.add( this, types, fn, data, selector );
+ });
+ },
+ one: function( types, selector, data, fn ) {
+ return this.on( types, selector, data, fn, 1 );
+ },
+ off: function( types, selector, fn ) {
+ var handleObj, type;
+ if ( types && types.preventDefault && types.handleObj ) {
+ // ( event ) dispatched jQuery.Event
+ handleObj = types.handleObj;
+ jQuery( types.delegateTarget ).off(
+ handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
+ handleObj.selector,
+ handleObj.handler
+ );
+ return this;
+ }
+ if ( typeof types === "object" ) {
+ // ( types-object [, selector] )
+ for ( type in types ) {
+ this.off( type, selector, types[ type ] );
+ }
+ return this;
+ }
+ if ( selector === false || typeof selector === "function" ) {
+ // ( types [, fn] )
+ fn = selector;
+ selector = undefined;
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ }
+ return this.each(function() {
+ jQuery.event.remove( this, types, fn, selector );
+ });
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+ triggerHandler: function( type, data ) {
+ var elem = this[0];
+ if ( elem ) {
+ return jQuery.event.trigger( type, data, elem, true );
+ }
+ }
+});
+var isSimple = /^.[^:#\[\.,]*$/,
+ rparentsprev = /^(?:parents|prev(?:Until|All))/,
+ rneedsContext = jQuery.expr.match.needsContext,
+ // methods guaranteed to produce a unique set when starting from a unique set
+ guaranteedUnique = {
+ children: true,
+ contents: true,
+ next: true,
+ prev: true
+ };
+
+jQuery.fn.extend({
+ find: function( selector ) {
+ var i,
+ ret = [],
+ self = this,
+ len = self.length;
+
+ if ( typeof selector !== "string" ) {
+ return this.pushStack( jQuery( selector ).filter(function() {
+ for ( i = 0; i < len; i++ ) {
+ if ( jQuery.contains( self[ i ], this ) ) {
+ return true;
+ }
+ }
+ }) );
+ }
+
+ for ( i = 0; i < len; i++ ) {
+ jQuery.find( selector, self[ i ], ret );
+ }
+
+ // Needed because $( selector, context ) becomes $( context ).find( selector )
+ ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
+ ret.selector = this.selector ? this.selector + " " + selector : selector;
+ return ret;
+ },
+
+ has: function( target ) {
+ var i,
+ targets = jQuery( target, this ),
+ len = targets.length;
+
+ return this.filter(function() {
+ for ( i = 0; i < len; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
+
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector || [], true) );
+ },
+
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector || [], false) );
+ },
+
+ is: function( selector ) {
+ return !!winnow(
+ this,
+
+ // If this is a positional/relative selector, check membership in the returned set
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
+ typeof selector === "string" && rneedsContext.test( selector ) ?
+ jQuery( selector ) :
+ selector || [],
+ false
+ ).length;
+ },
+
+ closest: function( selectors, context ) {
+ var cur,
+ i = 0,
+ l = this.length,
+ ret = [],
+ pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
+ jQuery( selectors, context || this.context ) :
+ 0;
+
+ for ( ; i < l; i++ ) {
+ for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
+ // Always skip document fragments
+ if ( cur.nodeType < 11 && (pos ?
+ pos.index(cur) > -1 :
+
+ // Don't pass non-elements to Sizzle
+ cur.nodeType === 1 &&
+ jQuery.find.matchesSelector(cur, selectors)) ) {
+
+ cur = ret.push( cur );
+ break;
+ }
+ }
+ }
+
+ return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+
+ // No argument, return index in parent
+ if ( !elem ) {
+ return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
+ }
+
+ // index in selector
+ if ( typeof elem === "string" ) {
+ return jQuery.inArray( this[0], jQuery( elem ) );
+ }
+
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem.jquery ? elem[0] : elem, this );
+ },
+
+ add: function( selector, context ) {
+ var set = typeof selector === "string" ?
+ jQuery( selector, context ) :
+ jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
+ all = jQuery.merge( this.get(), set );
+
+ return this.pushStack( jQuery.unique(all) );
+ },
+
+ addBack: function( selector ) {
+ return this.add( selector == null ?
+ this.prevObject : this.prevObject.filter(selector)
+ );
+ }
+});
+
+function sibling( cur, dir ) {
+ do {
+ cur = cur[ dir ];
+ } while ( cur && cur.nodeType !== 1 );
+
+ return cur;
+}
+
+jQuery.each({
+ parent: function( elem ) {
+ var parent = elem.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function( elem ) {
+ return jQuery.dir( elem, "parentNode" );
+ },
+ parentsUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "parentNode", until );
+ },
+ next: function( elem ) {
+ return sibling( elem, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return sibling( elem, "previousSibling" );
+ },
+ nextAll: function( elem ) {
+ return jQuery.dir( elem, "nextSibling" );
+ },
+ prevAll: function( elem ) {
+ return jQuery.dir( elem, "previousSibling" );
+ },
+ nextUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "nextSibling", until );
+ },
+ prevUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "previousSibling", until );
+ },
+ siblings: function( elem ) {
+ return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
+ },
+ children: function( elem ) {
+ return jQuery.sibling( elem.firstChild );
+ },
+ contents: function( elem ) {
+ return jQuery.nodeName( elem, "iframe" ) ?
+ elem.contentDocument || elem.contentWindow.document :
+ jQuery.merge( [], elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var ret = jQuery.map( this, fn, until );
+
+ if ( name.slice( -5 ) !== "Until" ) {
+ selector = until;
+ }
+
+ if ( selector && typeof selector === "string" ) {
+ ret = jQuery.filter( selector, ret );
+ }
+
+ if ( this.length > 1 ) {
+ // Remove duplicates
+ if ( !guaranteedUnique[ name ] ) {
+ ret = jQuery.unique( ret );
+ }
+
+ // Reverse order for parents* and prev-derivatives
+ if ( rparentsprev.test( name ) ) {
+ ret = ret.reverse();
+ }
+ }
+
+ return this.pushStack( ret );
+ };
+});
+
+jQuery.extend({
+ filter: function( expr, elems, not ) {
+ var elem = elems[ 0 ];
+
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return elems.length === 1 && elem.nodeType === 1 ?
+ jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
+ jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
+ return elem.nodeType === 1;
+ }));
+ },
+
+ dir: function( elem, dir, until ) {
+ var matched = [],
+ cur = elem[ dir ];
+
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+ if ( cur.nodeType === 1 ) {
+ matched.push( cur );
+ }
+ cur = cur[dir];
+ }
+ return matched;
+ },
+
+ sibling: function( n, elem ) {
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType === 1 && n !== elem ) {
+ r.push( n );
+ }
+ }
+
+ return r;
+ }
+});
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, not ) {
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep( elements, function( elem, i ) {
+ /* jshint -W018 */
+ return !!qualifier.call( elem, i, elem ) !== not;
+ });
+
+ }
+
+ if ( qualifier.nodeType ) {
+ return jQuery.grep( elements, function( elem ) {
+ return ( elem === qualifier ) !== not;
+ });
+
+ }
+
+ if ( typeof qualifier === "string" ) {
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter( qualifier, elements, not );
+ }
+
+ qualifier = jQuery.filter( qualifier, elements );
+ }
+
+ return jQuery.grep( elements, function( elem ) {
+ return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
+ });
+}
+function createSafeFragment( document ) {
+ var list = nodeNames.split( "|" ),
+ safeFrag = document.createDocumentFragment();
+
+ if ( safeFrag.createElement ) {
+ while ( list.length ) {
+ safeFrag.createElement(
+ list.pop()
+ );
+ }
+ }
+ return safeFrag;
+}
+
+var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
+ "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
+ rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
+ rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
+ rleadingWhitespace = /^\s+/,
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
+ rtagName = /<([\w:]+)/,
+ rtbody = /<tbody/i,
+ rhtml = /<|&#?\w+;/,
+ rnoInnerhtml = /<(?:script|style|link)/i,
+ manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
+ // checked="checked" or checked
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+ rscriptType = /^$|\/(?:java|ecma)script/i,
+ rscriptTypeMasked = /^true\/(.*)/,
+ rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
+
+ // We have to close these tags to support XHTML (#13200)
+ wrapMap = {
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
+ area: [ 1, "<map>", "</map>" ],
+ param: [ 1, "<object>", "</object>" ],
+ thead: [ 1, "<table>", "</table>" ],
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+
+ // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
+ // unless wrapped in a div with non-breaking characters in front of it.
+ _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
+ },
+ safeFragment = createSafeFragment( document ),
+ fragmentDiv = safeFragment.appendChild( document.createElement("div") );
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+jQuery.fn.extend({
+ text: function( value ) {
+ return jQuery.access( this, function( value ) {
+ return value === undefined ?
+ jQuery.text( this ) :
+ this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
+ }, null, value, arguments.length );
+ },
+
+ append: function() {
+ return this.domManip( arguments, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ var target = manipulationTarget( this, elem );
+ target.appendChild( elem );
+ }
+ });
+ },
+
+ prepend: function() {
+ return this.domManip( arguments, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ var target = manipulationTarget( this, elem );
+ target.insertBefore( elem, target.firstChild );
+ }
+ });
+ },
+
+ before: function() {
+ return this.domManip( arguments, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this );
+ }
+ });
+ },
+
+ after: function() {
+ return this.domManip( arguments, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ }
+ });
+ },
+
+ // keepData is for internal use only--do not document
+ remove: function( selector, keepData ) {
+ var elem,
+ elems = selector ? jQuery.filter( selector, this ) : this,
+ i = 0;
+
+ for ( ; (elem = elems[i]) != null; i++ ) {
+
+ if ( !keepData && elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem ) );
+ }
+
+ if ( elem.parentNode ) {
+ if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
+ setGlobalEval( getAll( elem, "script" ) );
+ }
+ elem.parentNode.removeChild( elem );
+ }
+ }
+
+ return this;
+ },
+
+ empty: function() {
+ var elem,
+ i = 0;
+
+ for ( ; (elem = this[i]) != null; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem, false ) );
+ }
+
+ // Remove any remaining nodes
+ while ( elem.firstChild ) {
+ elem.removeChild( elem.firstChild );
+ }
+
+ // If this is a select, ensure that it displays empty (#12336)
+ // Support: IE<9
+ if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
+ elem.options.length = 0;
+ }
+ }
+
+ return this;
+ },
+
+ clone: function( dataAndEvents, deepDataAndEvents ) {
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
+
+ return this.map( function () {
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
+ });
+ },
+
+ html: function( value ) {
+ return jQuery.access( this, function( value ) {
+ var elem = this[0] || {},
+ i = 0,
+ l = this.length;
+
+ if ( value === undefined ) {
+ return elem.nodeType === 1 ?
+ elem.innerHTML.replace( rinlinejQuery, "" ) :
+ undefined;
+ }
+
+ // See if we can take a shortcut and just use innerHTML
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+ ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
+ ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
+ !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
+
+ value = value.replace( rxhtmlTag, "<$1></$2>" );
+
+ try {
+ for (; i < l; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ elem = this[i] || {};
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem, false ) );
+ elem.innerHTML = value;
+ }
+ }
+
+ elem = 0;
+
+ // If using innerHTML throws an exception, use the fallback method
+ } catch(e) {}
+ }
+
+ if ( elem ) {
+ this.empty().append( value );
+ }
+ }, null, value, arguments.length );
+ },
+
+ replaceWith: function() {
+ var
+ // Snapshot the DOM in case .domManip sweeps something relevant into its fragment
+ args = jQuery.map( this, function( elem ) {
+ return [ elem.nextSibling, elem.parentNode ];
+ }),
+ i = 0;
+
+ // Make the changes, replacing each context element with the new content
+ this.domManip( arguments, function( elem ) {
+ var next = args[ i++ ],
+ parent = args[ i++ ];
+
+ if ( parent ) {
+ // Don't use the snapshot next if it has moved (#13810)
+ if ( next && next.parentNode !== parent ) {
+ next = this.nextSibling;
+ }
+ jQuery( this ).remove();
+ parent.insertBefore( elem, next );
+ }
+ // Allow new content to include elements from the context set
+ }, true );
+
+ // Force removal if there was no new content (e.g., from empty arguments)
+ return i ? this : this.remove();
+ },
+
+ detach: function( selector ) {
+ return this.remove( selector, true );
+ },
+
+ domManip: function( args, callback, allowIntersection ) {
+
+ // Flatten any nested arrays
+ args = core_concat.apply( [], args );
+
+ var first, node, hasScripts,
+ scripts, doc, fragment,
+ i = 0,
+ l = this.length,
+ set = this,
+ iNoClone = l - 1,
+ value = args[0],
+ isFunction = jQuery.isFunction( value );
+
+ // We can't cloneNode fragments that contain checked, in WebKit
+ if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
+ return this.each(function( index ) {
+ var self = set.eq( index );
+ if ( isFunction ) {
+ args[0] = value.call( this, index, self.html() );
+ }
+ self.domManip( args, callback, allowIntersection );
+ });
+ }
+
+ if ( l ) {
+ fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this );
+ first = fragment.firstChild;
+
+ if ( fragment.childNodes.length === 1 ) {
+ fragment = first;
+ }
+
+ if ( first ) {
+ scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
+ hasScripts = scripts.length;
+
+ // Use the original fragment for the last item instead of the first because it can end up
+ // being emptied incorrectly in certain situations (#8070).
+ for ( ; i < l; i++ ) {
+ node = fragment;
+
+ if ( i !== iNoClone ) {
+ node = jQuery.clone( node, true, true );
+
+ // Keep references to cloned scripts for later restoration
+ if ( hasScripts ) {
+ jQuery.merge( scripts, getAll( node, "script" ) );
+ }
+ }
+
+ callback.call( this[i], node, i );
+ }
+
+ if ( hasScripts ) {
+ doc = scripts[ scripts.length - 1 ].ownerDocument;
+
+ // Reenable scripts
+ jQuery.map( scripts, restoreScript );
+
+ // Evaluate executable scripts on first document insertion
+ for ( i = 0; i < hasScripts; i++ ) {
+ node = scripts[ i ];
+ if ( rscriptType.test( node.type || "" ) &&
+ !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
+
+ if ( node.src ) {
+ // Hope ajax is available...
+ jQuery._evalUrl( node.src );
+ } else {
+ jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
+ }
+ }
+ }
+ }
+
+ // Fix #11809: Avoid leaking memory
+ fragment = first = null;
+ }
+ }
+
+ return this;
+ }
+});
+
+// Support: IE<8
+// Manipulating tables requires a tbody
+function manipulationTarget( elem, content ) {
+ return jQuery.nodeName( elem, "table" ) &&
+ jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ?
+
+ elem.getElementsByTagName("tbody")[0] ||
+ elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
+ elem;
+}
+
+// Replace/restore the type attribute of script elements for safe DOM manipulation
+function disableScript( elem ) {
+ elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type;
+ return elem;
+}
+function restoreScript( elem ) {
+ var match = rscriptTypeMasked.exec( elem.type );
+ if ( match ) {
+ elem.type = match[1];
+ } else {
+ elem.removeAttribute("type");
+ }
+ return elem;
+}
+
+// Mark scripts as having already been evaluated
+function setGlobalEval( elems, refElements ) {
+ var elem,
+ i = 0;
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
+ }
+}
+
+function cloneCopyEvent( src, dest ) {
+
+ if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
+ return;
+ }
+
+ var type, i, l,
+ oldData = jQuery._data( src ),
+ curData = jQuery._data( dest, oldData ),
+ events = oldData.events;
+
+ if ( events ) {
+ delete curData.handle;
+ curData.events = {};
+
+ for ( type in events ) {
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {
+ jQuery.event.add( dest, type, events[ type ][ i ] );
+ }
+ }
+ }
+
+ // make the cloned public data object a copy from the original
+ if ( curData.data ) {
+ curData.data = jQuery.extend( {}, curData.data );
+ }
+}
+
+function fixCloneNodeIssues( src, dest ) {
+ var nodeName, e, data;
+
+ // We do not need to do anything for non-Elements
+ if ( dest.nodeType !== 1 ) {
+ return;
+ }
+
+ nodeName = dest.nodeName.toLowerCase();
+
+ // IE6-8 copies events bound via attachEvent when using cloneNode.
+ if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
+ data = jQuery._data( dest );
+
+ for ( e in data.events ) {
+ jQuery.removeEvent( dest, e, data.handle );
+ }
+
+ // Event data gets referenced instead of copied if the expando gets copied too
+ dest.removeAttribute( jQuery.expando );
+ }
+
+ // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
+ if ( nodeName === "script" && dest.text !== src.text ) {
+ disableScript( dest ).text = src.text;
+ restoreScript( dest );
+
+ // IE6-10 improperly clones children of object elements using classid.
+ // IE10 throws NoModificationAllowedError if parent is null, #12132.
+ } else if ( nodeName === "object" ) {
+ if ( dest.parentNode ) {
+ dest.outerHTML = src.outerHTML;
+ }
+
+ // This path appears unavoidable for IE9. When cloning an object
+ // element in IE9, the outerHTML strategy above is not sufficient.
+ // If the src has innerHTML and the destination does not,
+ // copy the src.innerHTML into the dest.innerHTML. #10324
+ if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
+ dest.innerHTML = src.innerHTML;
+ }
+
+ } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
+ // IE6-8 fails to persist the checked state of a cloned checkbox
+ // or radio button. Worse, IE6-7 fail to give the cloned element
+ // a checked appearance if the defaultChecked value isn't also set
+
+ dest.defaultChecked = dest.checked = src.checked;
+
+ // IE6-7 get confused and end up setting the value of a cloned
+ // checkbox/radio button to an empty string instead of "on"
+ if ( dest.value !== src.value ) {
+ dest.value = src.value;
+ }
+
+ // IE6-8 fails to return the selected option to the default selected
+ // state when cloning options
+ } else if ( nodeName === "option" ) {
+ dest.defaultSelected = dest.selected = src.defaultSelected;
+
+ // IE6-8 fails to set the defaultValue to the correct value when
+ // cloning other types of input fields
+ } else if ( nodeName === "input" || nodeName === "textarea" ) {
+ dest.defaultValue = src.defaultValue;
+ }
+}
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function( name, original ) {
+ jQuery.fn[ name ] = function( selector ) {
+ var elems,
+ i = 0,
+ ret = [],
+ insert = jQuery( selector ),
+ last = insert.length - 1;
+
+ for ( ; i <= last; i++ ) {
+ elems = i === last ? this : this.clone(true);
+ jQuery( insert[i] )[ original ]( elems );
+
+ // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
+ core_push.apply( ret, elems.get() );
+ }
+
+ return this.pushStack( ret );
+ };
+});
+
+function getAll( context, tag ) {
+ var elems, elem,
+ i = 0,
+ found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
+ typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
+ undefined;
+
+ if ( !found ) {
+ for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
+ if ( !tag || jQuery.nodeName( elem, tag ) ) {
+ found.push( elem );
+ } else {
+ jQuery.merge( found, getAll( elem, tag ) );
+ }
+ }
+ }
+
+ return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
+ jQuery.merge( [ context ], found ) :
+ found;
+}
+
+// Used in buildFragment, fixes the defaultChecked property
+function fixDefaultChecked( elem ) {
+ if ( manipulation_rcheckableType.test( elem.type ) ) {
+ elem.defaultChecked = elem.checked;
+ }
+}
+
+jQuery.extend({
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) {
+ var destElements, node, clone, i, srcElements,
+ inPage = jQuery.contains( elem.ownerDocument, elem );
+
+ if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
+ clone = elem.cloneNode( true );
+
+ // IE<=8 does not properly clone detached, unknown element nodes
+ } else {
+ fragmentDiv.innerHTML = elem.outerHTML;
+ fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
+ }
+
+ if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
+ (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
+
+ // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
+ destElements = getAll( clone );
+ srcElements = getAll( elem );
+
+ // Fix all IE cloning issues
+ for ( i = 0; (node = srcElements[i]) != null; ++i ) {
+ // Ensure that the destination node is not null; Fixes #9587
+ if ( destElements[i] ) {
+ fixCloneNodeIssues( node, destElements[i] );
+ }
+ }
+ }
+
+ // Copy the events from the original to the clone
+ if ( dataAndEvents ) {
+ if ( deepDataAndEvents ) {
+ srcElements = srcElements || getAll( elem );
+ destElements = destElements || getAll( clone );
+
+ for ( i = 0; (node = srcElements[i]) != null; i++ ) {
+ cloneCopyEvent( node, destElements[i] );
+ }
+ } else {
+ cloneCopyEvent( elem, clone );
+ }
+ }
+
+ // Preserve script evaluation history
+ destElements = getAll( clone, "script" );
+ if ( destElements.length > 0 ) {
+ setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
+ }
+
+ destElements = srcElements = node = null;
+
+ // Return the cloned set
+ return clone;
+ },
+
+ buildFragment: function( elems, context, scripts, selection ) {
+ var j, elem, contains,
+ tmp, tag, tbody, wrap,
+ l = elems.length,
+
+ // Ensure a safe fragment
+ safe = createSafeFragment( context ),
+
+ nodes = [],
+ i = 0;
+
+ for ( ; i < l; i++ ) {
+ elem = elems[ i ];
+
+ if ( elem || elem === 0 ) {
+
+ // Add nodes directly
+ if ( jQuery.type( elem ) === "object" ) {
+ jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
+
+ // Convert non-html into a text node
+ } else if ( !rhtml.test( elem ) ) {
+ nodes.push( context.createTextNode( elem ) );
+
+ // Convert html into DOM nodes
+ } else {
+ tmp = tmp || safe.appendChild( context.createElement("div") );
+
+ // Deserialize a standard representation
+ tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
+ wrap = wrapMap[ tag ] || wrapMap._default;
+
+ tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
+
+ // Descend through wrappers to the right content
+ j = wrap[0];
+ while ( j-- ) {
+ tmp = tmp.lastChild;
+ }
+
+ // Manually add leading whitespace removed by IE
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+ nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
+ }
+
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( !jQuery.support.tbody ) {
+
+ // String was a <table>, *may* have spurious <tbody>
+ elem = tag === "table" && !rtbody.test( elem ) ?
+ tmp.firstChild :
+
+ // String was a bare <thead> or <tfoot>
+ wrap[1] === "<table>" && !rtbody.test( elem ) ?
+ tmp :
+ 0;
+
+ j = elem && elem.childNodes.length;
+ while ( j-- ) {
+ if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
+ elem.removeChild( tbody );
+ }
+ }
+ }
+
+ jQuery.merge( nodes, tmp.childNodes );
+
+ // Fix #12392 for WebKit and IE > 9
+ tmp.textContent = "";
+
+ // Fix #12392 for oldIE
+ while ( tmp.firstChild ) {
+ tmp.removeChild( tmp.firstChild );
+ }
+
+ // Remember the top-level container for proper cleanup
+ tmp = safe.lastChild;
+ }
+ }
+ }
+
+ // Fix #11356: Clear elements from fragment
+ if ( tmp ) {
+ safe.removeChild( tmp );
+ }
+
+ // Reset defaultChecked for any radios and checkboxes
+ // about to be appended to the DOM in IE 6/7 (#8060)
+ if ( !jQuery.support.appendChecked ) {
+ jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
+ }
+
+ i = 0;
+ while ( (elem = nodes[ i++ ]) ) {
+
+ // #4087 - If origin and destination elements are the same, and this is
+ // that element, do not do anything
+ if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
+ continue;
+ }
+
+ contains = jQuery.contains( elem.ownerDocument, elem );
+
+ // Append to fragment
+ tmp = getAll( safe.appendChild( elem ), "script" );
+
+ // Preserve script evaluation history
+ if ( contains ) {
+ setGlobalEval( tmp );
+ }
+
+ // Capture executables
+ if ( scripts ) {
+ j = 0;
+ while ( (elem = tmp[ j++ ]) ) {
+ if ( rscriptType.test( elem.type || "" ) ) {
+ scripts.push( elem );
+ }
+ }
+ }
+ }
+
+ tmp = null;
+
+ return safe;
+ },
+
+ cleanData: function( elems, /* internal */ acceptData ) {
+ var elem, type, id, data,
+ i = 0,
+ internalKey = jQuery.expando,
+ cache = jQuery.cache,
+ deleteExpando = jQuery.support.deleteExpando,
+ special = jQuery.event.special;
+
+ for ( ; (elem = elems[i]) != null; i++ ) {
+
+ if ( acceptData || jQuery.acceptData( elem ) ) {
+
+ id = elem[ internalKey ];
+ data = id && cache[ id ];
+
+ if ( data ) {
+ if ( data.events ) {
+ for ( type in data.events ) {
+ if ( special[ type ] ) {
+ jQuery.event.remove( elem, type );
+
+ // This is a shortcut to avoid jQuery.event.remove's overhead
+ } else {
+ jQuery.removeEvent( elem, type, data.handle );
+ }
+ }
+ }
+
+ // Remove cache only if it was not already removed by jQuery.event.remove
+ if ( cache[ id ] ) {
+
+ delete cache[ id ];
+
+ // IE does not allow us to delete expando properties from nodes,
+ // nor does it have a removeAttribute function on Document nodes;
+ // we must handle all of these cases
+ if ( deleteExpando ) {
+ delete elem[ internalKey ];
+
+ } else if ( typeof elem.removeAttribute !== core_strundefined ) {
+ elem.removeAttribute( internalKey );
+
+ } else {
+ elem[ internalKey ] = null;
+ }
+
+ core_deletedIds.push( id );
+ }
+ }
+ }
+ }
+ },
+
+ _evalUrl: function( url ) {
+ return jQuery.ajax({
+ url: url,
+ type: "GET",
+ dataType: "script",
+ async: false,
+ global: false,
+ "throws": true
+ });
+ }
+});
+jQuery.fn.extend({
+ wrapAll: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapAll( html.call(this, i) );
+ });
+ }
+
+ if ( this[0] ) {
+ // The elements to wrap the target around
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
+
+ if ( this[0].parentNode ) {
+ wrap.insertBefore( this[0] );
+ }
+
+ wrap.map(function() {
+ var elem = this;
+
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
+ elem = elem.firstChild;
+ }
+
+ return elem;
+ }).append( this );
+ }
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapInner( html.call(this, i) );
+ });
+ }
+
+ return this.each(function() {
+ var self = jQuery( this ),
+ contents = self.contents();
+
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
+ });
+ },
+
+ wrap: function( html ) {
+ var isFunction = jQuery.isFunction( html );
+
+ return this.each(function(i) {
+ jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
+ });
+ },
+
+ unwrap: function() {
+ return this.parent().each(function() {
+ if ( !jQuery.nodeName( this, "body" ) ) {
+ jQuery( this ).replaceWith( this.childNodes );
+ }
+ }).end();
+ }
+});
+var iframe, getStyles, curCSS,
+ ralpha = /alpha\([^)]*\)/i,
+ ropacity = /opacity\s*=\s*([^)]*)/,
+ rposition = /^(top|right|bottom|left)$/,
+ // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
+ // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
+ rdisplayswap = /^(none|table(?!-c[ea]).+)/,
+ rmargin = /^margin/,
+ rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
+ rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
+ rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
+ elemdisplay = { BODY: "block" },
+
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
+ cssNormalTransform = {
+ letterSpacing: 0,
+ fontWeight: 400
+ },
+
+ cssExpand = [ "Top", "Right", "Bottom", "Left" ],
+ cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
+
+// return a css property mapped to a potentially vendor prefixed property
+function vendorPropName( style, name ) {
+
+ // shortcut for names that are not vendor prefixed
+ if ( name in style ) {
+ return name;
+ }
+
+ // check for vendor prefixed names
+ var capName = name.charAt(0).toUpperCase() + name.slice(1),
+ origName = name,
+ i = cssPrefixes.length;
+
+ while ( i-- ) {
+ name = cssPrefixes[ i ] + capName;
+ if ( name in style ) {
+ return name;
+ }
+ }
+
+ return origName;
+}
+
+function isHidden( elem, el ) {
+ // isHidden might be called from jQuery#filter function;
+ // in that case, element will be second argument
+ elem = el || elem;
+ return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
+}
+
+function showHide( elements, show ) {
+ var display, elem, hidden,
+ values = [],
+ index = 0,
+ length = elements.length;
+
+ for ( ; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+
+ values[ index ] = jQuery._data( elem, "olddisplay" );
+ display = elem.style.display;
+ if ( show ) {
+ // Reset the inline display of this element to learn if it is
+ // being hidden by cascaded rules or not
+ if ( !values[ index ] && display === "none" ) {
+ elem.style.display = "";
+ }
+
+ // Set elements which have been overridden with display: none
+ // in a stylesheet to whatever the default browser style is
+ // for such an element
+ if ( elem.style.display === "" && isHidden( elem ) ) {
+ values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
+ }
+ } else {
+
+ if ( !values[ index ] ) {
+ hidden = isHidden( elem );
+
+ if ( display && display !== "none" || !hidden ) {
+ jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
+ }
+ }
+ }
+ }
+
+ // Set the display of most of the elements in a second loop
+ // to avoid the constant reflow
+ for ( index = 0; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+ if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
+ elem.style.display = show ? values[ index ] || "" : "none";
+ }
+ }
+
+ return elements;
+}
+
+jQuery.fn.extend({
+ css: function( name, value ) {
+ return jQuery.access( this, function( elem, name, value ) {
+ var len, styles,
+ map = {},
+ i = 0;
+
+ if ( jQuery.isArray( name ) ) {
+ styles = getStyles( elem );
+ len = name.length;
+
+ for ( ; i < len; i++ ) {
+ map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
+ }
+
+ return map;
+ }
+
+ return value !== undefined ?
+ jQuery.style( elem, name, value ) :
+ jQuery.css( elem, name );
+ }, name, value, arguments.length > 1 );
+ },
+ show: function() {
+ return showHide( this, true );
+ },
+ hide: function() {
+ return showHide( this );
+ },
+ toggle: function( state ) {
+ if ( typeof state === "boolean" ) {
+ return state ? this.show() : this.hide();
+ }
+
+ return this.each(function() {
+ if ( isHidden( this ) ) {
+ jQuery( this ).show();
+ } else {
+ jQuery( this ).hide();
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ // Add in style property hooks for overriding the default
+ // behavior of getting and setting a style property
+ cssHooks: {
+ opacity: {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // We should always get a number back from opacity
+ var ret = curCSS( elem, "opacity" );
+ return ret === "" ? "1" : ret;
+ }
+ }
+ }
+ },
+
+ // Don't automatically add "px" to these possibly-unitless properties
+ cssNumber: {
+ "columnCount": true,
+ "fillOpacity": true,
+ "fontWeight": true,
+ "lineHeight": true,
+ "opacity": true,
+ "order": true,
+ "orphans": true,
+ "widows": true,
+ "zIndex": true,
+ "zoom": true
+ },
+
+ // Add in properties whose names you wish to fix before
+ // setting or getting the value
+ cssProps: {
+ // normalize float css property
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
+ },
+
+ // Get and set the style property on a DOM Node
+ style: function( elem, name, value, extra ) {
+ // Don't set styles on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
+ return;
+ }
+
+ // Make sure that we're working with the right name
+ var ret, type, hooks,
+ origName = jQuery.camelCase( name ),
+ style = elem.style;
+
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+ // Check if we're setting a value
+ if ( value !== undefined ) {
+ type = typeof value;
+
+ // convert relative number strings (+= or -=) to relative numbers. #7345
+ if ( type === "string" && (ret = rrelNum.exec( value )) ) {
+ value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
+ // Fixes bug #9237
+ type = "number";
+ }
+
+ // Make sure that NaN and null values aren't set. See: #7116
+ if ( value == null || type === "number" && isNaN( value ) ) {
+ return;
+ }
+
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
+ if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
+ value += "px";
+ }
+
+ // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
+ // but it would mean to define eight (for every problematic property) identical functions
+ if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
+ style[ name ] = "inherit";
+ }
+
+ // If a hook was provided, use that value, otherwise just set the specified value
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
+
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
+ // Fixes bug #5509
+ try {
+ style[ name ] = value;
+ } catch(e) {}
+ }
+
+ } else {
+ // If a hook was provided get the non-computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+ return ret;
+ }
+
+ // Otherwise just get the value from the style object
+ return style[ name ];
+ }
+ },
+
+ css: function( elem, name, extra, styles ) {
+ var num, val, hooks,
+ origName = jQuery.camelCase( name );
+
+ // Make sure that we're working with the right name
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+ // If a hook was provided get the computed value from there
+ if ( hooks && "get" in hooks ) {
+ val = hooks.get( elem, true, extra );
+ }
+
+ // Otherwise, if a way to get the computed value exists, use that
+ if ( val === undefined ) {
+ val = curCSS( elem, name, styles );
+ }
+
+ //convert "normal" to computed value
+ if ( val === "normal" && name in cssNormalTransform ) {
+ val = cssNormalTransform[ name ];
+ }
+
+ // Return, converting to number if forced or a qualifier was provided and val looks numeric
+ if ( extra === "" || extra ) {
+ num = parseFloat( val );
+ return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
+ }
+ return val;
+ }
+});
+
+// NOTE: we've included the "window" in window.getComputedStyle
+// because jsdom on node.js will break without it.
+if ( window.getComputedStyle ) {
+ getStyles = function( elem ) {
+ return window.getComputedStyle( elem, null );
+ };
+
+ curCSS = function( elem, name, _computed ) {
+ var width, minWidth, maxWidth,
+ computed = _computed || getStyles( elem ),
+
+ // getPropertyValue is only needed for .css('filter') in IE9, see #12537
+ ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
+ style = elem.style;
+
+ if ( computed ) {
+
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
+ ret = jQuery.style( elem, name );
+ }
+
+ // A tribute to the "awesome hack by Dean Edwards"
+ // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
+ // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
+ // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
+ if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
+
+ // Remember the original values
+ width = style.width;
+ minWidth = style.minWidth;
+ maxWidth = style.maxWidth;
+
+ // Put in the new values to get a computed value out
+ style.minWidth = style.maxWidth = style.width = ret;
+ ret = computed.width;
+
+ // Revert the changed values
+ style.width = width;
+ style.minWidth = minWidth;
+ style.maxWidth = maxWidth;
+ }
+ }
+
+ return ret;
+ };
+} else if ( document.documentElement.currentStyle ) {
+ getStyles = function( elem ) {
+ return elem.currentStyle;
+ };
+
+ curCSS = function( elem, name, _computed ) {
+ var left, rs, rsLeft,
+ computed = _computed || getStyles( elem ),
+ ret = computed ? computed[ name ] : undefined,
+ style = elem.style;
+
+ // Avoid setting ret to empty string here
+ // so we don't default to auto
+ if ( ret == null && style && style[ name ] ) {
+ ret = style[ name ];
+ }
+
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ // but not position css attributes, as those are proportional to the parent element instead
+ // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
+ if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
+
+ // Remember the original values
+ left = style.left;
+ rs = elem.runtimeStyle;
+ rsLeft = rs && rs.left;
+
+ // Put in the new values to get a computed value out
+ if ( rsLeft ) {
+ rs.left = elem.currentStyle.left;
+ }
+ style.left = name === "fontSize" ? "1em" : ret;
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ if ( rsLeft ) {
+ rs.left = rsLeft;
+ }
+ }
+
+ return ret === "" ? "auto" : ret;
+ };
+}
+
+function setPositiveNumber( elem, value, subtract ) {
+ var matches = rnumsplit.exec( value );
+ return matches ?
+ // Guard against undefined "subtract", e.g., when used as in cssHooks
+ Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
+ value;
+}
+
+function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
+ var i = extra === ( isBorderBox ? "border" : "content" ) ?
+ // If we already have the right measurement, avoid augmentation
+ 4 :
+ // Otherwise initialize for horizontal or vertical properties
+ name === "width" ? 1 : 0,
+
+ val = 0;
+
+ for ( ; i < 4; i += 2 ) {
+ // both box models exclude margin, so add it if we want it
+ if ( extra === "margin" ) {
+ val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
+ }
+
+ if ( isBorderBox ) {
+ // border-box includes padding, so remove it if we want content
+ if ( extra === "content" ) {
+ val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+ }
+
+ // at this point, extra isn't border nor margin, so remove border
+ if ( extra !== "margin" ) {
+ val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ } else {
+ // at this point, extra isn't content, so add padding
+ val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+
+ // at this point, extra isn't content nor padding, so add border
+ if ( extra !== "padding" ) {
+ val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ }
+ }
+
+ return val;
+}
+
+function getWidthOrHeight( elem, name, extra ) {
+
+ // Start with offset property, which is equivalent to the border-box value
+ var valueIsBorderBox = true,
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
+ styles = getStyles( elem ),
+ isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
+
+ // some non-html elements return undefined for offsetWidth, so check for null/undefined
+ // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
+ // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
+ if ( val <= 0 || val == null ) {
+ // Fall back to computed then uncomputed css if necessary
+ val = curCSS( elem, name, styles );
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ];
+ }
+
+ // Computed unit is not pixels. Stop here and return.
+ if ( rnumnonpx.test(val) ) {
+ return val;
+ }
+
+ // we need the check for style in case a browser which returns unreliable values
+ // for getComputedStyle silently falls back to the reliable elem.style
+ valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
+
+ // Normalize "", auto, and prepare for extra
+ val = parseFloat( val ) || 0;
+ }
+
+ // use the active box-sizing model to add/subtract irrelevant styles
+ return ( val +
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra || ( isBorderBox ? "border" : "content" ),
+ valueIsBorderBox,
+ styles
+ )
+ ) + "px";
+}
+
+// Try to determine the default display value of an element
+function css_defaultDisplay( nodeName ) {
+ var doc = document,
+ display = elemdisplay[ nodeName ];
+
+ if ( !display ) {
+ display = actualDisplay( nodeName, doc );
+
+ // If the simple way fails, read from inside an iframe
+ if ( display === "none" || !display ) {
+ // Use the already-created iframe if possible
+ iframe = ( iframe ||
+ jQuery("<iframe frameborder='0' width='0' height='0'/>")
+ .css( "cssText", "display:block !important" )
+ ).appendTo( doc.documentElement );
+
+ // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
+ doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
+ doc.write("<!doctype html><html><body>");
+ doc.close();
+
+ display = actualDisplay( nodeName, doc );
+ iframe.detach();
+ }
+
+ // Store the correct default display
+ elemdisplay[ nodeName ] = display;
+ }
+
+ return display;
+}
+
+// Called ONLY from within css_defaultDisplay
+function actualDisplay( name, doc ) {
+ var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
+ display = jQuery.css( elem[0], "display" );
+ elem.remove();
+ return display;
+}
+
+jQuery.each([ "height", "width" ], function( i, name ) {
+ jQuery.cssHooks[ name ] = {
+ get: function( elem, computed, extra ) {
+ if ( computed ) {
+ // certain elements can have dimension info if we invisibly show them
+ // however, it must have a current display style that would benefit from this
+ return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
+ jQuery.swap( elem, cssShow, function() {
+ return getWidthOrHeight( elem, name, extra );
+ }) :
+ getWidthOrHeight( elem, name, extra );
+ }
+ },
+
+ set: function( elem, value, extra ) {
+ var styles = extra && getStyles( elem );
+ return setPositiveNumber( elem, value, extra ?
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra,
+ jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
+ styles
+ ) : 0
+ );
+ }
+ };
+});
+
+if ( !jQuery.support.opacity ) {
+ jQuery.cssHooks.opacity = {
+ get: function( elem, computed ) {
+ // IE uses filters for opacity
+ return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
+ ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
+ computed ? "1" : "";
+ },
+
+ set: function( elem, value ) {
+ var style = elem.style,
+ currentStyle = elem.currentStyle,
+ opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
+ filter = currentStyle && currentStyle.filter || style.filter || "";
+
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ style.zoom = 1;
+
+ // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
+ // if value === "", then remove inline opacity #12685
+ if ( ( value >= 1 || value === "" ) &&
+ jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
+ style.removeAttribute ) {
+
+ // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
+ // if "filter:" is present at all, clearType is disabled, we want to avoid this
+ // style.removeAttribute is IE Only, but so apparently is this code path...
+ style.removeAttribute( "filter" );
+
+ // if there is no filter style applied in a css rule or unset inline opacity, we are done
+ if ( value === "" || currentStyle && !currentStyle.filter ) {
+ return;
+ }
+ }
+
+ // otherwise, set new filter values
+ style.filter = ralpha.test( filter ) ?
+ filter.replace( ralpha, opacity ) :
+ filter + " " + opacity;
+ }
+ };
+}
+
+// These hooks cannot be added until DOM ready because the support test
+// for it is not run until after DOM ready
+jQuery(function() {
+ if ( !jQuery.support.reliableMarginRight ) {
+ jQuery.cssHooks.marginRight = {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ // Work around by temporarily setting element display to inline-block
+ return jQuery.swap( elem, { "display": "inline-block" },
+ curCSS, [ elem, "marginRight" ] );
+ }
+ }
+ };
+ }
+
+ // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
+ // getComputedStyle returns percent when specified for top/left/bottom/right
+ // rather than make the css module depend on the offset module, we just check for it here
+ if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
+ jQuery.each( [ "top", "left" ], function( i, prop ) {
+ jQuery.cssHooks[ prop ] = {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ computed = curCSS( elem, prop );
+ // if curCSS returns percentage, fallback to offset
+ return rnumnonpx.test( computed ) ?
+ jQuery( elem ).position()[ prop ] + "px" :
+ computed;
+ }
+ }
+ };
+ });
+ }
+
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.hidden = function( elem ) {
+ // Support: Opera <= 12.12
+ // Opera reports offsetWidths and offsetHeights less than zero on some elements
+ return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
+ (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
+ };
+
+ jQuery.expr.filters.visible = function( elem ) {
+ return !jQuery.expr.filters.hidden( elem );
+ };
+}
+
+// These hooks are used by animate to expand properties
+jQuery.each({
+ margin: "",
+ padding: "",
+ border: "Width"
+}, function( prefix, suffix ) {
+ jQuery.cssHooks[ prefix + suffix ] = {
+ expand: function( value ) {
+ var i = 0,
+ expanded = {},
+
+ // assumes a single number if not a string
+ parts = typeof value === "string" ? value.split(" ") : [ value ];
+
+ for ( ; i < 4; i++ ) {
+ expanded[ prefix + cssExpand[ i ] + suffix ] =
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
+ }
+
+ return expanded;
+ }
+ };
+
+ if ( !rmargin.test( prefix ) ) {
+ jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
+ }
+});
+var r20 = /%20/g,
+ rbracket = /\[\]$/,
+ rCRLF = /\r?\n/g,
+ rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
+ rsubmittable = /^(?:input|select|textarea|keygen)/i;
+
+jQuery.fn.extend({
+ serialize: function() {
+ return jQuery.param( this.serializeArray() );
+ },
+ serializeArray: function() {
+ return this.map(function(){
+ // Can add propHook for "elements" to filter or add form elements
+ var elements = jQuery.prop( this, "elements" );
+ return elements ? jQuery.makeArray( elements ) : this;
+ })
+ .filter(function(){
+ var type = this.type;
+ // Use .is(":disabled") so that fieldset[disabled] works
+ return this.name && !jQuery( this ).is( ":disabled" ) &&
+ rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
+ ( this.checked || !manipulation_rcheckableType.test( type ) );
+ })
+ .map(function( i, elem ){
+ var val = jQuery( this ).val();
+
+ return val == null ?
+ null :
+ jQuery.isArray( val ) ?
+ jQuery.map( val, function( val ){
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }) :
+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }).get();
+ }
+});
+
+//Serialize an array of form elements or a set of
+//key/values into a query string
+jQuery.param = function( a, traditional ) {
+ var prefix,
+ s = [],
+ add = function( key, value ) {
+ // If value is a function, invoke it and return its value
+ value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
+ };
+
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
+ if ( traditional === undefined ) {
+ traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
+ }
+
+ // If an array was passed in, assume that it is an array of form elements.
+ if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
+ // Serialize the form elements
+ jQuery.each( a, function() {
+ add( this.name, this.value );
+ });
+
+ } else {
+ // If traditional, encode the "old" way (the way 1.3.2 or older
+ // did it), otherwise encode params recursively.
+ for ( prefix in a ) {
+ buildParams( prefix, a[ prefix ], traditional, add );
+ }
+ }
+
+ // Return the resulting serialization
+ return s.join( "&" ).replace( r20, "+" );
+};
+
+function buildParams( prefix, obj, traditional, add ) {
+ var name;
+
+ if ( jQuery.isArray( obj ) ) {
+ // Serialize array item.
+ jQuery.each( obj, function( i, v ) {
+ if ( traditional || rbracket.test( prefix ) ) {
+ // Treat each array item as a scalar.
+ add( prefix, v );
+
+ } else {
+ // Item is non-scalar (array or object), encode its numeric index.
+ buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
+ }
+ });
+
+ } else if ( !traditional && jQuery.type( obj ) === "object" ) {
+ // Serialize object item.
+ for ( name in obj ) {
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
+ }
+
+ } else {
+ // Serialize scalar item.
+ add( prefix, obj );
+ }
+}
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+ "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( data, fn ) {
+ return arguments.length > 0 ?
+ this.on( name, null, data, fn ) :
+ this.trigger( name );
+ };
+});
+
+jQuery.fn.extend({
+ hover: function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+ },
+
+ bind: function( types, data, fn ) {
+ return this.on( types, null, data, fn );
+ },
+ unbind: function( types, fn ) {
+ return this.off( types, null, fn );
+ },
+
+ delegate: function( selector, types, data, fn ) {
+ return this.on( types, selector, data, fn );
+ },
+ undelegate: function( selector, types, fn ) {
+ // ( namespace ) or ( selector, types [, fn] )
+ return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
+ }
+});
+var
+ // Document location
+ ajaxLocParts,
+ ajaxLocation,
+ ajax_nonce = jQuery.now(),
+
+ ajax_rquery = /\?/,
+ rhash = /#.*$/,
+ rts = /([?&])_=[^&]*/,
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
+ // #7653, #8125, #8152: local protocol detection
+ rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
+ rnoContent = /^(?:GET|HEAD)$/,
+ rprotocol = /^\/\//,
+ rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
+
+ // Keep a copy of the old load method
+ _load = jQuery.fn.load,
+
+ /* Prefilters
+ * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
+ * 2) These are called:
+ * - BEFORE asking for a transport
+ * - AFTER param serialization (s.data is a string if s.processData is true)
+ * 3) key is the dataType
+ * 4) the catchall symbol "*" can be used
+ * 5) execution will start with transport dataType and THEN continue down to "*" if needed
+ */
+ prefilters = {},
+
+ /* Transports bindings
+ * 1) key is the dataType
+ * 2) the catchall symbol "*" can be used
+ * 3) selection will start with transport dataType and THEN go to "*" if needed
+ */
+ transports = {},
+
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
+ allTypes = "*/".concat("*");
+
+// #8138, IE may throw an exception when accessing
+// a field from window.location if document.domain has been set
+try {
+ ajaxLocation = location.href;
+} catch( e ) {
+ // Use the href attribute of an A element
+ // since IE will modify it given document.location
+ ajaxLocation = document.createElement( "a" );
+ ajaxLocation.href = "";
+ ajaxLocation = ajaxLocation.href;
+}
+
+// Segment location into parts
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
+
+// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
+function addToPrefiltersOrTransports( structure ) {
+
+ // dataTypeExpression is optional and defaults to "*"
+ return function( dataTypeExpression, func ) {
+
+ if ( typeof dataTypeExpression !== "string" ) {
+ func = dataTypeExpression;
+ dataTypeExpression = "*";
+ }
+
+ var dataType,
+ i = 0,
+ dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
+
+ if ( jQuery.isFunction( func ) ) {
+ // For each dataType in the dataTypeExpression
+ while ( (dataType = dataTypes[i++]) ) {
+ // Prepend if requested
+ if ( dataType[0] === "+" ) {
+ dataType = dataType.slice( 1 ) || "*";
+ (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
+
+ // Otherwise append
+ } else {
+ (structure[ dataType ] = structure[ dataType ] || []).push( func );
+ }
+ }
+ }
+ };
+}
+
+// Base inspection function for prefilters and transports
+function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
+
+ var inspected = {},
+ seekingTransport = ( structure === transports );
+
+ function inspect( dataType ) {
+ var selected;
+ inspected[ dataType ] = true;
+ jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
+ var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
+ if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
+ options.dataTypes.unshift( dataTypeOrTransport );
+ inspect( dataTypeOrTransport );
+ return false;
+ } else if ( seekingTransport ) {
+ return !( selected = dataTypeOrTransport );
+ }
+ });
+ return selected;
+ }
+
+ return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
+}
+
+// A special extend for ajax options
+// that takes "flat" options (not to be deep extended)
+// Fixes #9887
+function ajaxExtend( target, src ) {
+ var deep, key,
+ flatOptions = jQuery.ajaxSettings.flatOptions || {};
+
+ for ( key in src ) {
+ if ( src[ key ] !== undefined ) {
+ ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
+ }
+ }
+ if ( deep ) {
+ jQuery.extend( true, target, deep );
+ }
+
+ return target;
+}
+
+jQuery.fn.load = function( url, params, callback ) {
+ if ( typeof url !== "string" && _load ) {
+ return _load.apply( this, arguments );
+ }
+
+ var selector, response, type,
+ self = this,
+ off = url.indexOf(" ");
+
+ if ( off >= 0 ) {
+ selector = url.slice( off, url.length );
+ url = url.slice( 0, off );
+ }
+
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+
+ // We assume that it's the callback
+ callback = params;
+ params = undefined;
+
+ // Otherwise, build a param string
+ } else if ( params && typeof params === "object" ) {
+ type = "POST";
+ }
+
+ // If we have elements to modify, make the request
+ if ( self.length > 0 ) {
+ jQuery.ajax({
+ url: url,
+
+ // if "type" variable is undefined, then "GET" method will be used
+ type: type,
+ dataType: "html",
+ data: params
+ }).done(function( responseText ) {
+
+ // Save response for use in complete callback
+ response = arguments;
+
+ self.html( selector ?
+
+ // If a selector was specified, locate the right elements in a dummy div
+ // Exclude scripts to avoid IE 'Permission Denied' errors
+ jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
+
+ // Otherwise use the full result
+ responseText );
+
+ }).complete( callback && function( jqXHR, status ) {
+ self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
+ });
+ }
+
+ return this;
+};
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
+ jQuery.fn[ type ] = function( fn ){
+ return this.on( type, fn );
+ };
+});
+
+jQuery.extend({
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+ etag: {},
+
+ ajaxSettings: {
+ url: ajaxLocation,
+ type: "GET",
+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
+ global: true,
+ processData: true,
+ async: true,
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",
+ /*
+ timeout: 0,
+ data: null,
+ dataType: null,
+ username: null,
+ password: null,
+ cache: null,
+ throws: false,
+ traditional: false,
+ headers: {},
+ */
+
+ accepts: {
+ "*": allTypes,
+ text: "text/plain",
+ html: "text/html",
+ xml: "application/xml, text/xml",
+ json: "application/json, text/javascript"
+ },
+
+ contents: {
+ xml: /xml/,
+ html: /html/,
+ json: /json/
+ },
+
+ responseFields: {
+ xml: "responseXML",
+ text: "responseText",
+ json: "responseJSON"
+ },
+
+ // Data converters
+ // Keys separate source (or catchall "*") and destination types with a single space
+ converters: {
+
+ // Convert anything to text
+ "* text": String,
+
+ // Text to html (true = no transformation)
+ "text html": true,
+
+ // Evaluate text as a json expression
+ "text json": jQuery.parseJSON,
+
+ // Parse text as xml
+ "text xml": jQuery.parseXML
+ },
+
+ // For options that shouldn't be deep extended:
+ // you can add your own custom options here if
+ // and when you create one that shouldn't be
+ // deep extended (see ajaxExtend)
+ flatOptions: {
+ url: true,
+ context: true
+ }
+ },
+
+ // Creates a full fledged settings object into target
+ // with both ajaxSettings and settings fields.
+ // If target is omitted, writes into ajaxSettings.
+ ajaxSetup: function( target, settings ) {
+ return settings ?
+
+ // Building a settings object
+ ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
+
+ // Extending ajaxSettings
+ ajaxExtend( jQuery.ajaxSettings, target );
+ },
+
+ ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
+ ajaxTransport: addToPrefiltersOrTransports( transports ),
+
+ // Main method
+ ajax: function( url, options ) {
+
+ // If url is an object, simulate pre-1.5 signature
+ if ( typeof url === "object" ) {
+ options = url;
+ url = undefined;
+ }
+
+ // Force options to be an object
+ options = options || {};
+
+ var // Cross-domain detection vars
+ parts,
+ // Loop variable
+ i,
+ // URL without anti-cache param
+ cacheURL,
+ // Response headers as string
+ responseHeadersString,
+ // timeout handle
+ timeoutTimer,
+
+ // To know if global events are to be dispatched
+ fireGlobals,
+
+ transport,
+ // Response headers
+ responseHeaders,
+ // Create the final options object
+ s = jQuery.ajaxSetup( {}, options ),
+ // Callbacks context
+ callbackContext = s.context || s,
+ // Context for global events is callbackContext if it is a DOM node or jQuery collection
+ globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
+ jQuery( callbackContext ) :
+ jQuery.event,
+ // Deferreds
+ deferred = jQuery.Deferred(),
+ completeDeferred = jQuery.Callbacks("once memory"),
+ // Status-dependent callbacks
+ statusCode = s.statusCode || {},
+ // Headers (they are sent all at once)
+ requestHeaders = {},
+ requestHeadersNames = {},
+ // The jqXHR state
+ state = 0,
+ // Default abort message
+ strAbort = "canceled",
+ // Fake xhr
+ jqXHR = {
+ readyState: 0,
+
+ // Builds headers hashtable if needed
+ getResponseHeader: function( key ) {
+ var match;
+ if ( state === 2 ) {
+ if ( !responseHeaders ) {
+ responseHeaders = {};
+ while ( (match = rheaders.exec( responseHeadersString )) ) {
+ responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
+ }
+ }
+ match = responseHeaders[ key.toLowerCase() ];
+ }
+ return match == null ? null : match;
+ },
+
+ // Raw string
+ getAllResponseHeaders: function() {
+ return state === 2 ? responseHeadersString : null;
+ },
+
+ // Caches the header
+ setRequestHeader: function( name, value ) {
+ var lname = name.toLowerCase();
+ if ( !state ) {
+ name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
+ requestHeaders[ name ] = value;
+ }
+ return this;
+ },
+
+ // Overrides response content-type header
+ overrideMimeType: function( type ) {
+ if ( !state ) {
+ s.mimeType = type;
+ }
+ return this;
+ },
+
+ // Status-dependent callbacks
+ statusCode: function( map ) {
+ var code;
+ if ( map ) {
+ if ( state < 2 ) {
+ for ( code in map ) {
+ // Lazy-add the new callback in a way that preserves old ones
+ statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
+ }
+ } else {
+ // Execute the appropriate callbacks
+ jqXHR.always( map[ jqXHR.status ] );
+ }
+ }
+ return this;
+ },
+
+ // Cancel the request
+ abort: function( statusText ) {
+ var finalText = statusText || strAbort;
+ if ( transport ) {
+ transport.abort( finalText );
+ }
+ done( 0, finalText );
+ return this;
+ }
+ };
+
+ // Attach deferreds
+ deferred.promise( jqXHR ).complete = completeDeferred.add;
+ jqXHR.success = jqXHR.done;
+ jqXHR.error = jqXHR.fail;
+
+ // Remove hash character (#7531: and string promotion)
+ // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
+ // Handle falsy url in the settings object (#10093: consistency with old signature)
+ // We also use the url parameter if available
+ s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
+
+ // Alias method option to type as per ticket #12004
+ s.type = options.method || options.type || s.method || s.type;
+
+ // Extract dataTypes list
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
+
+ // A cross-domain request is in order when we have a protocol:host:port mismatch
+ if ( s.crossDomain == null ) {
+ parts = rurl.exec( s.url.toLowerCase() );
+ s.crossDomain = !!( parts &&
+ ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
+ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
+ ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
+ );
+ }
+
+ // Convert data if not already a string
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
+ s.data = jQuery.param( s.data, s.traditional );
+ }
+
+ // Apply prefilters
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
+
+ // If request was aborted inside a prefilter, stop there
+ if ( state === 2 ) {
+ return jqXHR;
+ }
+
+ // We can fire global events as of now if asked to
+ fireGlobals = s.global;
+
+ // Watch for a new set of requests
+ if ( fireGlobals && jQuery.active++ === 0 ) {
+ jQuery.event.trigger("ajaxStart");
+ }
+
+ // Uppercase the type
+ s.type = s.type.toUpperCase();
+
+ // Determine if request has content
+ s.hasContent = !rnoContent.test( s.type );
+
+ // Save the URL in case we're toying with the If-Modified-Since
+ // and/or If-None-Match header later on
+ cacheURL = s.url;
+
+ // More options handling for requests with no content
+ if ( !s.hasContent ) {
+
+ // If data is available, append data to url
+ if ( s.data ) {
+ cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
+ // #9682: remove data so that it's not used in an eventual retry
+ delete s.data;
+ }
+
+ // Add anti-cache in url if needed
+ if ( s.cache === false ) {
+ s.url = rts.test( cacheURL ) ?
+
+ // If there is already a '_' parameter, set its value
+ cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
+
+ // Otherwise add one to the end
+ cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
+ }
+ }
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ if ( jQuery.lastModified[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
+ }
+ if ( jQuery.etag[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
+ }
+ }
+
+ // Set the correct header, if data is being sent
+ if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
+ jqXHR.setRequestHeader( "Content-Type", s.contentType );
+ }
+
+ // Set the Accepts header for the server, depending on the dataType
+ jqXHR.setRequestHeader(
+ "Accept",
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
+ s.accepts[ "*" ]
+ );
+
+ // Check for headers option
+ for ( i in s.headers ) {
+ jqXHR.setRequestHeader( i, s.headers[ i ] );
+ }
+
+ // Allow custom headers/mimetypes and early abort
+ if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
+ // Abort if not done already and return
+ return jqXHR.abort();
+ }
+
+ // aborting is no longer a cancellation
+ strAbort = "abort";
+
+ // Install callbacks on deferreds
+ for ( i in { success: 1, error: 1, complete: 1 } ) {
+ jqXHR[ i ]( s[ i ] );
+ }
+
+ // Get transport
+ transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
+
+ // If no transport, we auto-abort
+ if ( !transport ) {
+ done( -1, "No Transport" );
+ } else {
+ jqXHR.readyState = 1;
+
+ // Send global event
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
+ }
+ // Timeout
+ if ( s.async && s.timeout > 0 ) {
+ timeoutTimer = setTimeout(function() {
+ jqXHR.abort("timeout");
+ }, s.timeout );
+ }
+
+ try {
+ state = 1;
+ transport.send( requestHeaders, done );
+ } catch ( e ) {
+ // Propagate exception as error if not done
+ if ( state < 2 ) {
+ done( -1, e );
+ // Simply rethrow otherwise
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ // Callback for when everything is done
+ function done( status, nativeStatusText, responses, headers ) {
+ var isSuccess, success, error, response, modified,
+ statusText = nativeStatusText;
+
+ // Called once
+ if ( state === 2 ) {
+ return;
+ }
+
+ // State is "done" now
+ state = 2;
+
+ // Clear timeout if it exists
+ if ( timeoutTimer ) {
+ clearTimeout( timeoutTimer );
+ }
+
+ // Dereference transport for early garbage collection
+ // (no matter how long the jqXHR object will be used)
+ transport = undefined;
+
+ // Cache response headers
+ responseHeadersString = headers || "";
+
+ // Set readyState
+ jqXHR.readyState = status > 0 ? 4 : 0;
+
+ // Determine if successful
+ isSuccess = status >= 200 && status < 300 || status === 304;
+
+ // Get response data
+ if ( responses ) {
+ response = ajaxHandleResponses( s, jqXHR, responses );
+ }
+
+ // Convert no matter what (that way responseXXX fields are always set)
+ response = ajaxConvert( s, response, jqXHR, isSuccess );
+
+ // If successful, handle type chaining
+ if ( isSuccess ) {
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ modified = jqXHR.getResponseHeader("Last-Modified");
+ if ( modified ) {
+ jQuery.lastModified[ cacheURL ] = modified;
+ }
+ modified = jqXHR.getResponseHeader("etag");
+ if ( modified ) {
+ jQuery.etag[ cacheURL ] = modified;
+ }
+ }
+
+ // if no content
+ if ( status === 204 || s.type === "HEAD" ) {
+ statusText = "nocontent";
+
+ // if not modified
+ } else if ( status === 304 ) {
+ statusText = "notmodified";
+
+ // If we have data, let's convert it
+ } else {
+ statusText = response.state;
+ success = response.data;
+ error = response.error;
+ isSuccess = !error;
+ }
+ } else {
+ // We extract error from statusText
+ // then normalize statusText and status for non-aborts
+ error = statusText;
+ if ( status || !statusText ) {
+ statusText = "error";
+ if ( status < 0 ) {
+ status = 0;
+ }
+ }
+ }
+
+ // Set data for the fake xhr object
+ jqXHR.status = status;
+ jqXHR.statusText = ( nativeStatusText || statusText ) + "";
+
+ // Success/Error
+ if ( isSuccess ) {
+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
+ } else {
+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
+ }
+
+ // Status-dependent callbacks
+ jqXHR.statusCode( statusCode );
+ statusCode = undefined;
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
+ [ jqXHR, s, isSuccess ? success : error ] );
+ }
+
+ // Complete
+ completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
+ // Handle the global AJAX counter
+ if ( !( --jQuery.active ) ) {
+ jQuery.event.trigger("ajaxStop");
+ }
+ }
+ }
+
+ return jqXHR;
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get( url, data, callback, "json" );
+ },
+
+ getScript: function( url, callback ) {
+ return jQuery.get( url, undefined, callback, "script" );
+ }
+});
+
+jQuery.each( [ "get", "post" ], function( i, method ) {
+ jQuery[ method ] = function( url, data, callback, type ) {
+ // shift arguments if data argument was omitted
+ if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
+ callback = data;
+ data = undefined;
+ }
+
+ return jQuery.ajax({
+ url: url,
+ type: method,
+ dataType: type,
+ data: data,
+ success: callback
+ });
+ };
+});
+
+/* Handles responses to an ajax request:
+ * - finds the right dataType (mediates between content-type and expected dataType)
+ * - returns the corresponding response
+ */
+function ajaxHandleResponses( s, jqXHR, responses ) {
+ var firstDataType, ct, finalDataType, type,
+ contents = s.contents,
+ dataTypes = s.dataTypes;
+
+ // Remove auto dataType and get content-type in the process
+ while( dataTypes[ 0 ] === "*" ) {
+ dataTypes.shift();
+ if ( ct === undefined ) {
+ ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
+ }
+ }
+
+ // Check if we're dealing with a known content-type
+ if ( ct ) {
+ for ( type in contents ) {
+ if ( contents[ type ] && contents[ type ].test( ct ) ) {
+ dataTypes.unshift( type );
+ break;
+ }
+ }
+ }
+
+ // Check to see if we have a response for the expected dataType
+ if ( dataTypes[ 0 ] in responses ) {
+ finalDataType = dataTypes[ 0 ];
+ } else {
+ // Try convertible dataTypes
+ for ( type in responses ) {
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
+ finalDataType = type;
+ break;
+ }
+ if ( !firstDataType ) {
+ firstDataType = type;
+ }
+ }
+ // Or just use first one
+ finalDataType = finalDataType || firstDataType;
+ }
+
+ // If we found a dataType
+ // We add the dataType to the list if needed
+ // and return the corresponding response
+ if ( finalDataType ) {
+ if ( finalDataType !== dataTypes[ 0 ] ) {
+ dataTypes.unshift( finalDataType );
+ }
+ return responses[ finalDataType ];
+ }
+}
+
+/* Chain conversions given the request and the original response
+ * Also sets the responseXXX fields on the jqXHR instance
+ */
+function ajaxConvert( s, response, jqXHR, isSuccess ) {
+ var conv2, current, conv, tmp, prev,
+ converters = {},
+ // Work with a copy of dataTypes in case we need to modify it for conversion
+ dataTypes = s.dataTypes.slice();
+
+ // Create converters map with lowercased keys
+ if ( dataTypes[ 1 ] ) {
+ for ( conv in s.converters ) {
+ converters[ conv.toLowerCase() ] = s.converters[ conv ];
+ }
+ }
+
+ current = dataTypes.shift();
+
+ // Convert to each sequential dataType
+ while ( current ) {
+
+ if ( s.responseFields[ current ] ) {
+ jqXHR[ s.responseFields[ current ] ] = response;
+ }
+
+ // Apply the dataFilter if provided
+ if ( !prev && isSuccess && s.dataFilter ) {
+ response = s.dataFilter( response, s.dataType );
+ }
+
+ prev = current;
+ current = dataTypes.shift();
+
+ if ( current ) {
+
+ // There's only work to do if current dataType is non-auto
+ if ( current === "*" ) {
+
+ current = prev;
+
+ // Convert response if prev dataType is non-auto and differs from current
+ } else if ( prev !== "*" && prev !== current ) {
+
+ // Seek a direct converter
+ conv = converters[ prev + " " + current ] || converters[ "* " + current ];
+
+ // If none found, seek a pair
+ if ( !conv ) {
+ for ( conv2 in converters ) {
+
+ // If conv2 outputs current
+ tmp = conv2.split( " " );
+ if ( tmp[ 1 ] === current ) {
+
+ // If prev can be converted to accepted input
+ conv = converters[ prev + " " + tmp[ 0 ] ] ||
+ converters[ "* " + tmp[ 0 ] ];
+ if ( conv ) {
+ // Condense equivalence converters
+ if ( conv === true ) {
+ conv = converters[ conv2 ];
+
+ // Otherwise, insert the intermediate dataType
+ } else if ( converters[ conv2 ] !== true ) {
+ current = tmp[ 0 ];
+ dataTypes.unshift( tmp[ 1 ] );
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ // Apply converter (if not an equivalence)
+ if ( conv !== true ) {
+
+ // Unless errors are allowed to bubble, catch and return them
+ if ( conv && s[ "throws" ] ) {
+ response = conv( response );
+ } else {
+ try {
+ response = conv( response );
+ } catch ( e ) {
+ return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return { state: "success", data: response };
+}
+// Install script dataType
+jQuery.ajaxSetup({
+ accepts: {
+ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
+ },
+ contents: {
+ script: /(?:java|ecma)script/
+ },
+ converters: {
+ "text script": function( text ) {
+ jQuery.globalEval( text );
+ return text;
+ }
+ }
+});
+
+// Handle cache's special case and global
+jQuery.ajaxPrefilter( "script", function( s ) {
+ if ( s.cache === undefined ) {
+ s.cache = false;
+ }
+ if ( s.crossDomain ) {
+ s.type = "GET";
+ s.global = false;
+ }
+});
+
+// Bind script tag hack transport
+jQuery.ajaxTransport( "script", function(s) {
+
+ // This transport only deals with cross domain requests
+ if ( s.crossDomain ) {
+
+ var script,
+ head = document.head || jQuery("head")[0] || document.documentElement;
+
+ return {
+
+ send: function( _, callback ) {
+
+ script = document.createElement("script");
+
+ script.async = true;
+
+ if ( s.scriptCharset ) {
+ script.charset = s.scriptCharset;
+ }
+
+ script.src = s.url;
+
+ // Attach handlers for all browsers
+ script.onload = script.onreadystatechange = function( _, isAbort ) {
+
+ if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
+
+ // Handle memory leak in IE
+ script.onload = script.onreadystatechange = null;
+
+ // Remove the script
+ if ( script.parentNode ) {
+ script.parentNode.removeChild( script );
+ }
+
+ // Dereference the script
+ script = null;
+
+ // Callback if not abort
+ if ( !isAbort ) {
+ callback( 200, "success" );
+ }
+ }
+ };
+
+ // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
+ // Use native DOM manipulation to avoid our domManip AJAX trickery
+ head.insertBefore( script, head.firstChild );
+ },
+
+ abort: function() {
+ if ( script ) {
+ script.onload( undefined, true );
+ }
+ }
+ };
+ }
+});
+var oldCallbacks = [],
+ rjsonp = /(=)\?(?=&|$)|\?\?/;
+
+// Default jsonp settings
+jQuery.ajaxSetup({
+ jsonp: "callback",
+ jsonpCallback: function() {
+ var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
+ this[ callback ] = true;
+ return callback;
+ }
+});
+
+// Detect, normalize options and install callbacks for jsonp requests
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
+
+ var callbackName, overwritten, responseContainer,
+ jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
+ "url" :
+ typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
+ );
+
+ // Handle iff the expected data type is "jsonp" or we have a parameter to set
+ if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
+
+ // Get callback name, remembering preexisting value associated with it
+ callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
+ s.jsonpCallback() :
+ s.jsonpCallback;
+
+ // Insert callback into url or form data
+ if ( jsonProp ) {
+ s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
+ } else if ( s.jsonp !== false ) {
+ s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
+ }
+
+ // Use data converter to retrieve json after script execution
+ s.converters["script json"] = function() {
+ if ( !responseContainer ) {
+ jQuery.error( callbackName + " was not called" );
+ }
+ return responseContainer[ 0 ];
+ };
+
+ // force json dataType
+ s.dataTypes[ 0 ] = "json";
+
+ // Install callback
+ overwritten = window[ callbackName ];
+ window[ callbackName ] = function() {
+ responseContainer = arguments;
+ };
+
+ // Clean-up function (fires after converters)
+ jqXHR.always(function() {
+ // Restore preexisting value
+ window[ callbackName ] = overwritten;
+
+ // Save back as free
+ if ( s[ callbackName ] ) {
+ // make sure that re-using the options doesn't screw things around
+ s.jsonpCallback = originalSettings.jsonpCallback;
+
+ // save the callback name for future use
+ oldCallbacks.push( callbackName );
+ }
+
+ // Call if it was a function and we have a response
+ if ( responseContainer && jQuery.isFunction( overwritten ) ) {
+ overwritten( responseContainer[ 0 ] );
+ }
+
+ responseContainer = overwritten = undefined;
+ });
+
+ // Delegate to script
+ return "script";
+ }
+});
+var xhrCallbacks, xhrSupported,
+ xhrId = 0,
+ // #5280: Internet Explorer will keep connections alive if we don't abort on unload
+ xhrOnUnloadAbort = window.ActiveXObject && function() {
+ // Abort all pending requests
+ var key;
+ for ( key in xhrCallbacks ) {
+ xhrCallbacks[ key ]( undefined, true );
+ }
+ };
+
+// Functions to create xhrs
+function createStandardXHR() {
+ try {
+ return new window.XMLHttpRequest();
+ } catch( e ) {}
+}
+
+function createActiveXHR() {
+ try {
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
+ } catch( e ) {}
+}
+
+// Create the request object
+// (This is still attached to ajaxSettings for backward compatibility)
+jQuery.ajaxSettings.xhr = window.ActiveXObject ?
+ /* Microsoft failed to properly
+ * implement the XMLHttpRequest in IE7 (can't request local files),
+ * so we use the ActiveXObject when it is available
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
+ * we need a fallback.
+ */
+ function() {
+ return !this.isLocal && createStandardXHR() || createActiveXHR();
+ } :
+ // For all other browsers, use the standard XMLHttpRequest object
+ createStandardXHR;
+
+// Determine support properties
+xhrSupported = jQuery.ajaxSettings.xhr();
+jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
+xhrSupported = jQuery.support.ajax = !!xhrSupported;
+
+// Create transport if the browser can provide an xhr
+if ( xhrSupported ) {
+
+ jQuery.ajaxTransport(function( s ) {
+ // Cross domain only allowed if supported through XMLHttpRequest
+ if ( !s.crossDomain || jQuery.support.cors ) {
+
+ var callback;
+
+ return {
+ send: function( headers, complete ) {
+
+ // Get a new xhr
+ var handle, i,
+ xhr = s.xhr();
+
+ // Open the socket
+ // Passing null username, generates a login popup on Opera (#2865)
+ if ( s.username ) {
+ xhr.open( s.type, s.url, s.async, s.username, s.password );
+ } else {
+ xhr.open( s.type, s.url, s.async );
+ }
+
+ // Apply custom fields if provided
+ if ( s.xhrFields ) {
+ for ( i in s.xhrFields ) {
+ xhr[ i ] = s.xhrFields[ i ];
+ }
+ }
+
+ // Override mime type if needed
+ if ( s.mimeType && xhr.overrideMimeType ) {
+ xhr.overrideMimeType( s.mimeType );
+ }
+
+ // X-Requested-With header
+ // For cross-domain requests, seeing as conditions for a preflight are
+ // akin to a jigsaw puzzle, we simply never set it to be sure.
+ // (it can always be set on a per-request basis or even using ajaxSetup)
+ // For same-domain requests, won't change header if already provided.
+ if ( !s.crossDomain && !headers["X-Requested-With"] ) {
+ headers["X-Requested-With"] = "XMLHttpRequest";
+ }
+
+ // Need an extra try/catch for cross domain requests in Firefox 3
+ try {
+ for ( i in headers ) {
+ xhr.setRequestHeader( i, headers[ i ] );
+ }
+ } catch( err ) {}
+
+ // Do send the request
+ // This may raise an exception which is actually
+ // handled in jQuery.ajax (so no try/catch here)
+ xhr.send( ( s.hasContent && s.data ) || null );
+
+ // Listener
+ callback = function( _, isAbort ) {
+ var status, responseHeaders, statusText, responses;
+
+ // Firefox throws exceptions when accessing properties
+ // of an xhr when a network error occurred
+ // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
+ try {
+
+ // Was never called and is aborted or complete
+ if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
+
+ // Only called once
+ callback = undefined;
+
+ // Do not keep as active anymore
+ if ( handle ) {
+ xhr.onreadystatechange = jQuery.noop;
+ if ( xhrOnUnloadAbort ) {
+ delete xhrCallbacks[ handle ];
+ }
+ }
+
+ // If it's an abort
+ if ( isAbort ) {
+ // Abort it manually if needed
+ if ( xhr.readyState !== 4 ) {
+ xhr.abort();
+ }
+ } else {
+ responses = {};
+ status = xhr.status;
+ responseHeaders = xhr.getAllResponseHeaders();
+
+ // When requesting binary data, IE6-9 will throw an exception
+ // on any attempt to access responseText (#11426)
+ if ( typeof xhr.responseText === "string" ) {
+ responses.text = xhr.responseText;
+ }
+
+ // Firefox throws an exception when accessing
+ // statusText for faulty cross-domain requests
+ try {
+ statusText = xhr.statusText;
+ } catch( e ) {
+ // We normalize with Webkit giving an empty statusText
+ statusText = "";
+ }
+
+ // Filter status for non standard behaviors
+
+ // If the request is local and we have data: assume a success
+ // (success with no data won't get notified, that's the best we
+ // can do given current implementations)
+ if ( !status && s.isLocal && !s.crossDomain ) {
+ status = responses.text ? 200 : 404;
+ // IE - #1450: sometimes returns 1223 when it should be 204
+ } else if ( status === 1223 ) {
+ status = 204;
+ }
+ }
+ }
+ } catch( firefoxAccessException ) {
+ if ( !isAbort ) {
+ complete( -1, firefoxAccessException );
+ }
+ }
+
+ // Call complete if needed
+ if ( responses ) {
+ complete( status, statusText, responses, responseHeaders );
+ }
+ };
+
+ if ( !s.async ) {
+ // if we're in sync mode we fire the callback
+ callback();
+ } else if ( xhr.readyState === 4 ) {
+ // (IE6 & IE7) if it's in cache and has been
+ // retrieved directly we need to fire the callback
+ setTimeout( callback );
+ } else {
+ handle = ++xhrId;
+ if ( xhrOnUnloadAbort ) {
+ // Create the active xhrs callbacks list if needed
+ // and attach the unload handler
+ if ( !xhrCallbacks ) {
+ xhrCallbacks = {};
+ jQuery( window ).unload( xhrOnUnloadAbort );
+ }
+ // Add to list of active xhrs callbacks
+ xhrCallbacks[ handle ] = callback;
+ }
+ xhr.onreadystatechange = callback;
+ }
+ },
+
+ abort: function() {
+ if ( callback ) {
+ callback( undefined, true );
+ }
+ }
+ };
+ }
+ });
+}
+var fxNow, timerId,
+ rfxtypes = /^(?:toggle|show|hide)$/,
+ rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
+ rrun = /queueHooks$/,
+ animationPrefilters = [ defaultPrefilter ],
+ tweeners = {
+ "*": [function( prop, value ) {
+ var tween = this.createTween( prop, value ),
+ target = tween.cur(),
+ parts = rfxnum.exec( value ),
+ unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
+
+ // Starting value computation is required for potential unit mismatches
+ start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
+ rfxnum.exec( jQuery.css( tween.elem, prop ) ),
+ scale = 1,
+ maxIterations = 20;
+
+ if ( start && start[ 3 ] !== unit ) {
+ // Trust units reported by jQuery.css
+ unit = unit || start[ 3 ];
+
+ // Make sure we update the tween properties later on
+ parts = parts || [];
+
+ // Iteratively approximate from a nonzero starting point
+ start = +target || 1;
+
+ do {
+ // If previous iteration zeroed out, double until we get *something*
+ // Use a string for doubling factor so we don't accidentally see scale as unchanged below
+ scale = scale || ".5";
+
+ // Adjust and apply
+ start = start / scale;
+ jQuery.style( tween.elem, prop, start + unit );
+
+ // Update scale, tolerating zero or NaN from tween.cur()
+ // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
+ } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
+ }
+
+ // Update tween properties
+ if ( parts ) {
+ start = tween.start = +start || +target || 0;
+ tween.unit = unit;
+ // If a +=/-= token was provided, we're doing a relative animation
+ tween.end = parts[ 1 ] ?
+ start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
+ +parts[ 2 ];
+ }
+
+ return tween;
+ }]
+ };
+
+// Animations created synchronously will run synchronously
+function createFxNow() {
+ setTimeout(function() {
+ fxNow = undefined;
+ });
+ return ( fxNow = jQuery.now() );
+}
+
+function createTween( value, prop, animation ) {
+ var tween,
+ collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
+ index = 0,
+ length = collection.length;
+ for ( ; index < length; index++ ) {
+ if ( (tween = collection[ index ].call( animation, prop, value )) ) {
+
+ // we're done with this property
+ return tween;
+ }
+ }
+}
+
+function Animation( elem, properties, options ) {
+ var result,
+ stopped,
+ index = 0,
+ length = animationPrefilters.length,
+ deferred = jQuery.Deferred().always( function() {
+ // don't match elem in the :animated selector
+ delete tick.elem;
+ }),
+ tick = function() {
+ if ( stopped ) {
+ return false;
+ }
+ var currentTime = fxNow || createFxNow(),
+ remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
+ // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
+ temp = remaining / animation.duration || 0,
+ percent = 1 - temp,
+ index = 0,
+ length = animation.tweens.length;
+
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( percent );
+ }
+
+ deferred.notifyWith( elem, [ animation, percent, remaining ]);
+
+ if ( percent < 1 && length ) {
+ return remaining;
+ } else {
+ deferred.resolveWith( elem, [ animation ] );
+ return false;
+ }
+ },
+ animation = deferred.promise({
+ elem: elem,
+ props: jQuery.extend( {}, properties ),
+ opts: jQuery.extend( true, { specialEasing: {} }, options ),
+ originalProperties: properties,
+ originalOptions: options,
+ startTime: fxNow || createFxNow(),
+ duration: options.duration,
+ tweens: [],
+ createTween: function( prop, end ) {
+ var tween = jQuery.Tween( elem, animation.opts, prop, end,
+ animation.opts.specialEasing[ prop ] || animation.opts.easing );
+ animation.tweens.push( tween );
+ return tween;
+ },
+ stop: function( gotoEnd ) {
+ var index = 0,
+ // if we are going to the end, we want to run all the tweens
+ // otherwise we skip this part
+ length = gotoEnd ? animation.tweens.length : 0;
+ if ( stopped ) {
+ return this;
+ }
+ stopped = true;
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( 1 );
+ }
+
+ // resolve when we played the last frame
+ // otherwise, reject
+ if ( gotoEnd ) {
+ deferred.resolveWith( elem, [ animation, gotoEnd ] );
+ } else {
+ deferred.rejectWith( elem, [ animation, gotoEnd ] );
+ }
+ return this;
+ }
+ }),
+ props = animation.props;
+
+ propFilter( props, animation.opts.specialEasing );
+
+ for ( ; index < length ; index++ ) {
+ result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
+ if ( result ) {
+ return result;
+ }
+ }
+
+ jQuery.map( props, createTween, animation );
+
+ if ( jQuery.isFunction( animation.opts.start ) ) {
+ animation.opts.start.call( elem, animation );
+ }
+
+ jQuery.fx.timer(
+ jQuery.extend( tick, {
+ elem: elem,
+ anim: animation,
+ queue: animation.opts.queue
+ })
+ );
+
+ // attach callbacks from options
+ return animation.progress( animation.opts.progress )
+ .done( animation.opts.done, animation.opts.complete )
+ .fail( animation.opts.fail )
+ .always( animation.opts.always );
+}
+
+function propFilter( props, specialEasing ) {
+ var index, name, easing, value, hooks;
+
+ // camelCase, specialEasing and expand cssHook pass
+ for ( index in props ) {
+ name = jQuery.camelCase( index );
+ easing = specialEasing[ name ];
+ value = props[ index ];
+ if ( jQuery.isArray( value ) ) {
+ easing = value[ 1 ];
+ value = props[ index ] = value[ 0 ];
+ }
+
+ if ( index !== name ) {
+ props[ name ] = value;
+ delete props[ index ];
+ }
+
+ hooks = jQuery.cssHooks[ name ];
+ if ( hooks && "expand" in hooks ) {
+ value = hooks.expand( value );
+ delete props[ name ];
+
+ // not quite $.extend, this wont overwrite keys already present.
+ // also - reusing 'index' from above because we have the correct "name"
+ for ( index in value ) {
+ if ( !( index in props ) ) {
+ props[ index ] = value[ index ];
+ specialEasing[ index ] = easing;
+ }
+ }
+ } else {
+ specialEasing[ name ] = easing;
+ }
+ }
+}
+
+jQuery.Animation = jQuery.extend( Animation, {
+
+ tweener: function( props, callback ) {
+ if ( jQuery.isFunction( props ) ) {
+ callback = props;
+ props = [ "*" ];
+ } else {
+ props = props.split(" ");
+ }
+
+ var prop,
+ index = 0,
+ length = props.length;
+
+ for ( ; index < length ; index++ ) {
+ prop = props[ index ];
+ tweeners[ prop ] = tweeners[ prop ] || [];
+ tweeners[ prop ].unshift( callback );
+ }
+ },
+
+ prefilter: function( callback, prepend ) {
+ if ( prepend ) {
+ animationPrefilters.unshift( callback );
+ } else {
+ animationPrefilters.push( callback );
+ }
+ }
+});
+
+function defaultPrefilter( elem, props, opts ) {
+ /* jshint validthis: true */
+ var prop, value, toggle, tween, hooks, oldfire,
+ anim = this,
+ orig = {},
+ style = elem.style,
+ hidden = elem.nodeType && isHidden( elem ),
+ dataShow = jQuery._data( elem, "fxshow" );
+
+ // handle queue: false promises
+ if ( !opts.queue ) {
+ hooks = jQuery._queueHooks( elem, "fx" );
+ if ( hooks.unqueued == null ) {
+ hooks.unqueued = 0;
+ oldfire = hooks.empty.fire;
+ hooks.empty.fire = function() {
+ if ( !hooks.unqueued ) {
+ oldfire();
+ }
+ };
+ }
+ hooks.unqueued++;
+
+ anim.always(function() {
+ // doing this makes sure that the complete handler will be called
+ // before this completes
+ anim.always(function() {
+ hooks.unqueued--;
+ if ( !jQuery.queue( elem, "fx" ).length ) {
+ hooks.empty.fire();
+ }
+ });
+ });
+ }
+
+ // height/width overflow pass
+ if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
+ // Make sure that nothing sneaks out
+ // Record all 3 overflow attributes because IE does not
+ // change the overflow attribute when overflowX and
+ // overflowY are set to the same value
+ opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
+
+ // Set display property to inline-block for height/width
+ // animations on inline elements that are having width/height animated
+ if ( jQuery.css( elem, "display" ) === "inline" &&
+ jQuery.css( elem, "float" ) === "none" ) {
+
+ // inline-level elements accept inline-block;
+ // block-level elements need to be inline with layout
+ if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
+ style.display = "inline-block";
+
+ } else {
+ style.zoom = 1;
+ }
+ }
+ }
+
+ if ( opts.overflow ) {
+ style.overflow = "hidden";
+ if ( !jQuery.support.shrinkWrapBlocks ) {
+ anim.always(function() {
+ style.overflow = opts.overflow[ 0 ];
+ style.overflowX = opts.overflow[ 1 ];
+ style.overflowY = opts.overflow[ 2 ];
+ });
+ }
+ }
+
+
+ // show/hide pass
+ for ( prop in props ) {
+ value = props[ prop ];
+ if ( rfxtypes.exec( value ) ) {
+ delete props[ prop ];
+ toggle = toggle || value === "toggle";
+ if ( value === ( hidden ? "hide" : "show" ) ) {
+ continue;
+ }
+ orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
+ }
+ }
+
+ if ( !jQuery.isEmptyObject( orig ) ) {
+ if ( dataShow ) {
+ if ( "hidden" in dataShow ) {
+ hidden = dataShow.hidden;
+ }
+ } else {
+ dataShow = jQuery._data( elem, "fxshow", {} );
+ }
+
+ // store state if its toggle - enables .stop().toggle() to "reverse"
+ if ( toggle ) {
+ dataShow.hidden = !hidden;
+ }
+ if ( hidden ) {
+ jQuery( elem ).show();
+ } else {
+ anim.done(function() {
+ jQuery( elem ).hide();
+ });
+ }
+ anim.done(function() {
+ var prop;
+ jQuery._removeData( elem, "fxshow" );
+ for ( prop in orig ) {
+ jQuery.style( elem, prop, orig[ prop ] );
+ }
+ });
+ for ( prop in orig ) {
+ tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
+
+ if ( !( prop in dataShow ) ) {
+ dataShow[ prop ] = tween.start;
+ if ( hidden ) {
+ tween.end = tween.start;
+ tween.start = prop === "width" || prop === "height" ? 1 : 0;
+ }
+ }
+ }
+ }
+}
+
+function Tween( elem, options, prop, end, easing ) {
+ return new Tween.prototype.init( elem, options, prop, end, easing );
+}
+jQuery.Tween = Tween;
+
+Tween.prototype = {
+ constructor: Tween,
+ init: function( elem, options, prop, end, easing, unit ) {
+ this.elem = elem;
+ this.prop = prop;
+ this.easing = easing || "swing";
+ this.options = options;
+ this.start = this.now = this.cur();
+ this.end = end;
+ this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+ },
+ cur: function() {
+ var hooks = Tween.propHooks[ this.prop ];
+
+ return hooks && hooks.get ?
+ hooks.get( this ) :
+ Tween.propHooks._default.get( this );
+ },
+ run: function( percent ) {
+ var eased,
+ hooks = Tween.propHooks[ this.prop ];
+
+ if ( this.options.duration ) {
+ this.pos = eased = jQuery.easing[ this.easing ](
+ percent, this.options.duration * percent, 0, 1, this.options.duration
+ );
+ } else {
+ this.pos = eased = percent;
+ }
+ this.now = ( this.end - this.start ) * eased + this.start;
+
+ if ( this.options.step ) {
+ this.options.step.call( this.elem, this.now, this );
+ }
+
+ if ( hooks && hooks.set ) {
+ hooks.set( this );
+ } else {
+ Tween.propHooks._default.set( this );
+ }
+ return this;
+ }
+};
+
+Tween.prototype.init.prototype = Tween.prototype;
+
+Tween.propHooks = {
+ _default: {
+ get: function( tween ) {
+ var result;
+
+ if ( tween.elem[ tween.prop ] != null &&
+ (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
+ return tween.elem[ tween.prop ];
+ }
+
+ // passing an empty string as a 3rd parameter to .css will automatically
+ // attempt a parseFloat and fallback to a string if the parse fails
+ // so, simple values such as "10px" are parsed to Float.
+ // complex values such as "rotate(1rad)" are returned as is.
+ result = jQuery.css( tween.elem, tween.prop, "" );
+ // Empty strings, null, undefined and "auto" are converted to 0.
+ return !result || result === "auto" ? 0 : result;
+ },
+ set: function( tween ) {
+ // use step hook for back compat - use cssHook if its there - use .style if its
+ // available and use plain properties where available
+ if ( jQuery.fx.step[ tween.prop ] ) {
+ jQuery.fx.step[ tween.prop ]( tween );
+ } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
+ jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
+ } else {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+ }
+};
+
+// Support: IE <=9
+// Panic based approach to setting things on disconnected nodes
+
+Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
+ set: function( tween ) {
+ if ( tween.elem.nodeType && tween.elem.parentNode ) {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+};
+
+jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
+ var cssFn = jQuery.fn[ name ];
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return speed == null || typeof speed === "boolean" ?
+ cssFn.apply( this, arguments ) :
+ this.animate( genFx( name, true ), speed, easing, callback );
+ };
+});
+
+jQuery.fn.extend({
+ fadeTo: function( speed, to, easing, callback ) {
+
+ // show any hidden elements after setting opacity to 0
+ return this.filter( isHidden ).css( "opacity", 0 ).show()
+
+ // animate to the value specified
+ .end().animate({ opacity: to }, speed, easing, callback );
+ },
+ animate: function( prop, speed, easing, callback ) {
+ var empty = jQuery.isEmptyObject( prop ),
+ optall = jQuery.speed( speed, easing, callback ),
+ doAnimation = function() {
+ // Operate on a copy of prop so per-property easing won't be lost
+ var anim = Animation( this, jQuery.extend( {}, prop ), optall );
+
+ // Empty animations, or finishing resolves immediately
+ if ( empty || jQuery._data( this, "finish" ) ) {
+ anim.stop( true );
+ }
+ };
+ doAnimation.finish = doAnimation;
+
+ return empty || optall.queue === false ?
+ this.each( doAnimation ) :
+ this.queue( optall.queue, doAnimation );
+ },
+ stop: function( type, clearQueue, gotoEnd ) {
+ var stopQueue = function( hooks ) {
+ var stop = hooks.stop;
+ delete hooks.stop;
+ stop( gotoEnd );
+ };
+
+ if ( typeof type !== "string" ) {
+ gotoEnd = clearQueue;
+ clearQueue = type;
+ type = undefined;
+ }
+ if ( clearQueue && type !== false ) {
+ this.queue( type || "fx", [] );
+ }
+
+ return this.each(function() {
+ var dequeue = true,
+ index = type != null && type + "queueHooks",
+ timers = jQuery.timers,
+ data = jQuery._data( this );
+
+ if ( index ) {
+ if ( data[ index ] && data[ index ].stop ) {
+ stopQueue( data[ index ] );
+ }
+ } else {
+ for ( index in data ) {
+ if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
+ stopQueue( data[ index ] );
+ }
+ }
+ }
+
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
+ timers[ index ].anim.stop( gotoEnd );
+ dequeue = false;
+ timers.splice( index, 1 );
+ }
+ }
+
+ // start the next in the queue if the last step wasn't forced
+ // timers currently will call their complete callbacks, which will dequeue
+ // but only if they were gotoEnd
+ if ( dequeue || !gotoEnd ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ finish: function( type ) {
+ if ( type !== false ) {
+ type = type || "fx";
+ }
+ return this.each(function() {
+ var index,
+ data = jQuery._data( this ),
+ queue = data[ type + "queue" ],
+ hooks = data[ type + "queueHooks" ],
+ timers = jQuery.timers,
+ length = queue ? queue.length : 0;
+
+ // enable finishing flag on private data
+ data.finish = true;
+
+ // empty the queue first
+ jQuery.queue( this, type, [] );
+
+ if ( hooks && hooks.stop ) {
+ hooks.stop.call( this, true );
+ }
+
+ // look for any active animations, and finish them
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
+ timers[ index ].anim.stop( true );
+ timers.splice( index, 1 );
+ }
+ }
+
+ // look for any animations in the old queue and finish them
+ for ( index = 0; index < length; index++ ) {
+ if ( queue[ index ] && queue[ index ].finish ) {
+ queue[ index ].finish.call( this );
+ }
+ }
+
+ // turn off finishing flag
+ delete data.finish;
+ });
+ }
+});
+
+// Generate parameters to create a standard animation
+function genFx( type, includeWidth ) {
+ var which,
+ attrs = { height: type },
+ i = 0;
+
+ // if we include width, step value is 1 to do all cssExpand values,
+ // if we don't include width, step value is 2 to skip over Left and Right
+ includeWidth = includeWidth? 1 : 0;
+ for( ; i < 4 ; i += 2 - includeWidth ) {
+ which = cssExpand[ i ];
+ attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
+ }
+
+ if ( includeWidth ) {
+ attrs.opacity = attrs.width = type;
+ }
+
+ return attrs;
+}
+
+// Generate shortcuts for custom animations
+jQuery.each({
+ slideDown: genFx("show"),
+ slideUp: genFx("hide"),
+ slideToggle: genFx("toggle"),
+ fadeIn: { opacity: "show" },
+ fadeOut: { opacity: "hide" },
+ fadeToggle: { opacity: "toggle" }
+}, function( name, props ) {
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return this.animate( props, speed, easing, callback );
+ };
+});
+
+jQuery.speed = function( speed, easing, fn ) {
+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
+ };
+
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
+
+ // normalize opt.queue - true/undefined/null -> "fx"
+ if ( opt.queue == null || opt.queue === true ) {
+ opt.queue = "fx";
+ }
+
+ // Queueing
+ opt.old = opt.complete;
+
+ opt.complete = function() {
+ if ( jQuery.isFunction( opt.old ) ) {
+ opt.old.call( this );
+ }
+
+ if ( opt.queue ) {
+ jQuery.dequeue( this, opt.queue );
+ }
+ };
+
+ return opt;
+};
+
+jQuery.easing = {
+ linear: function( p ) {
+ return p;
+ },
+ swing: function( p ) {
+ return 0.5 - Math.cos( p*Math.PI ) / 2;
+ }
+};
+
+jQuery.timers = [];
+jQuery.fx = Tween.prototype.init;
+jQuery.fx.tick = function() {
+ var timer,
+ timers = jQuery.timers,
+ i = 0;
+
+ fxNow = jQuery.now();
+
+ for ( ; i < timers.length; i++ ) {
+ timer = timers[ i ];
+ // Checks the timer has not already been removed
+ if ( !timer() && timers[ i ] === timer ) {
+ timers.splice( i--, 1 );
+ }
+ }
+
+ if ( !timers.length ) {
+ jQuery.fx.stop();
+ }
+ fxNow = undefined;
+};
+
+jQuery.fx.timer = function( timer ) {
+ if ( timer() && jQuery.timers.push( timer ) ) {
+ jQuery.fx.start();
+ }
+};
+
+jQuery.fx.interval = 13;
+
+jQuery.fx.start = function() {
+ if ( !timerId ) {
+ timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
+ }
+};
+
+jQuery.fx.stop = function() {
+ clearInterval( timerId );
+ timerId = null;
+};
+
+jQuery.fx.speeds = {
+ slow: 600,
+ fast: 200,
+ // Default speed
+ _default: 400
+};
+
+// Back Compat <1.8 extension point
+jQuery.fx.step = {};
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.animated = function( elem ) {
+ return jQuery.grep(jQuery.timers, function( fn ) {
+ return elem === fn.elem;
+ }).length;
+ };
+}
+jQuery.fn.offset = function( options ) {
+ if ( arguments.length ) {
+ return options === undefined ?
+ this :
+ this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ var docElem, win,
+ box = { top: 0, left: 0 },
+ elem = this[ 0 ],
+ doc = elem && elem.ownerDocument;
+
+ if ( !doc ) {
+ return;
+ }
+
+ docElem = doc.documentElement;
+
+ // Make sure it's not a disconnected DOM node
+ if ( !jQuery.contains( docElem, elem ) ) {
+ return box;
+ }
+
+ // If we don't have gBCR, just use 0,0 rather than error
+ // BlackBerry 5, iOS 3 (original iPhone)
+ if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
+ box = elem.getBoundingClientRect();
+ }
+ win = getWindow( doc );
+ return {
+ top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
+ left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
+ };
+};
+
+jQuery.offset = {
+
+ setOffset: function( elem, options, i ) {
+ var position = jQuery.css( elem, "position" );
+
+ // set position first, in-case top/left are set even on static elem
+ if ( position === "static" ) {
+ elem.style.position = "relative";
+ }
+
+ var curElem = jQuery( elem ),
+ curOffset = curElem.offset(),
+ curCSSTop = jQuery.css( elem, "top" ),
+ curCSSLeft = jQuery.css( elem, "left" ),
+ calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
+ props = {}, curPosition = {}, curTop, curLeft;
+
+ // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
+ if ( calculatePosition ) {
+ curPosition = curElem.position();
+ curTop = curPosition.top;
+ curLeft = curPosition.left;
+ } else {
+ curTop = parseFloat( curCSSTop ) || 0;
+ curLeft = parseFloat( curCSSLeft ) || 0;
+ }
+
+ if ( jQuery.isFunction( options ) ) {
+ options = options.call( elem, i, curOffset );
+ }
+
+ if ( options.top != null ) {
+ props.top = ( options.top - curOffset.top ) + curTop;
+ }
+ if ( options.left != null ) {
+ props.left = ( options.left - curOffset.left ) + curLeft;
+ }
+
+ if ( "using" in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
+ }
+};
+
+
+jQuery.fn.extend({
+
+ position: function() {
+ if ( !this[ 0 ] ) {
+ return;
+ }
+
+ var offsetParent, offset,
+ parentOffset = { top: 0, left: 0 },
+ elem = this[ 0 ];
+
+ // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
+ if ( jQuery.css( elem, "position" ) === "fixed" ) {
+ // we assume that getBoundingClientRect is available when computed position is fixed
+ offset = elem.getBoundingClientRect();
+ } else {
+ // Get *real* offsetParent
+ offsetParent = this.offsetParent();
+
+ // Get correct offsets
+ offset = this.offset();
+ if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
+ parentOffset = offsetParent.offset();
+ }
+
+ // Add offsetParent borders
+ parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
+ parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
+ }
+
+ // Subtract parent offsets and element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ return {
+ top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
+ left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
+ };
+ },
+
+ offsetParent: function() {
+ return this.map(function() {
+ var offsetParent = this.offsetParent || docElem;
+ while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
+ offsetParent = offsetParent.offsetParent;
+ }
+ return offsetParent || docElem;
+ });
+ }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
+ var top = /Y/.test( prop );
+
+ jQuery.fn[ method ] = function( val ) {
+ return jQuery.access( this, function( elem, method, val ) {
+ var win = getWindow( elem );
+
+ if ( val === undefined ) {
+ return win ? (prop in win) ? win[ prop ] :
+ win.document.documentElement[ method ] :
+ elem[ method ];
+ }
+
+ if ( win ) {
+ win.scrollTo(
+ !top ? val : jQuery( win ).scrollLeft(),
+ top ? val : jQuery( win ).scrollTop()
+ );
+
+ } else {
+ elem[ method ] = val;
+ }
+ }, method, val, arguments.length, null );
+ };
+});
+
+function getWindow( elem ) {
+ return jQuery.isWindow( elem ) ?
+ elem :
+ elem.nodeType === 9 ?
+ elem.defaultView || elem.parentWindow :
+ false;
+}
+// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
+jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
+ jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
+ // margin is only for outerHeight, outerWidth
+ jQuery.fn[ funcName ] = function( margin, value ) {
+ var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
+ extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
+
+ return jQuery.access( this, function( elem, type, value ) {
+ var doc;
+
+ if ( jQuery.isWindow( elem ) ) {
+ // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
+ // isn't a whole lot we can do. See pull request at this URL for discussion:
+ // https://github.com/jquery/jquery/pull/764
+ return elem.document.documentElement[ "client" + name ];
+ }
+
+ // Get document width or height
+ if ( elem.nodeType === 9 ) {
+ doc = elem.documentElement;
+
+ // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
+ // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
+ return Math.max(
+ elem.body[ "scroll" + name ], doc[ "scroll" + name ],
+ elem.body[ "offset" + name ], doc[ "offset" + name ],
+ doc[ "client" + name ]
+ );
+ }
+
+ return value === undefined ?
+ // Get width or height on the element, requesting but not forcing parseFloat
+ jQuery.css( elem, type, extra ) :
+
+ // Set width or height on the element
+ jQuery.style( elem, type, value, extra );
+ }, type, chainable ? margin : undefined, chainable, null );
+ };
+ });
+});
+// Limit scope pollution from any deprecated API
+// (function() {
+
+// The number of elements contained in the matched element set
+jQuery.fn.size = function() {
+ return this.length;
+};
+
+jQuery.fn.andSelf = jQuery.fn.addBack;
+
+// })();
+if ( typeof module === "object" && module && typeof module.exports === "object" ) {
+ // Expose jQuery as module.exports in loaders that implement the Node
+ // module pattern (including browserify). Do not create the global, since
+ // the user will be storing it themselves locally, and globals are frowned
+ // upon in the Node module world.
+ module.exports = jQuery;
+} else {
+ // Otherwise expose jQuery to the global object as usual
+ window.jQuery = window.$ = jQuery;
+
+ // Register as a named AMD module, since jQuery can be concatenated with other
+ // files that may use define, but not via a proper concatenation script that
+ // understands anonymous AMD modules. A named AMD is safest and most robust
+ // way to register. Lowercase jquery is used because AMD module names are
+ // derived from file names, and jQuery is normally delivered in a lowercase
+ // file name. Do this after creating the global so that if an AMD module wants
+ // to call noConflict to hide this version of jQuery, it will work.
+ if ( typeof define === "function" && define.amd ) {
+ define( "jquery", [], function () { return jQuery; } );
+ }
+}
+
+})( window );
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery-ui.js b/ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery-ui.js
new file mode 100644
index 00000000..31ee9cd8
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery-ui.js
@@ -0,0 +1,16617 @@
+/*! jQuery UI - v1.11.4 - 2015-03-11
+* http://jqueryui.com
+* Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js
+* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
+
+(function( factory ) {
+ if ( typeof define === "function" && define.amd ) {
+
+ // AMD. Register as an anonymous module.
+ define([ "jquery" ], factory );
+ } else {
+
+ // Browser globals
+ factory( jQuery );
+ }
+}(function( $ ) {
+/*!
+ * jQuery UI Core 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/category/ui-core/
+ */
+
+
+// $.ui might exist from components with no dependencies, e.g., $.ui.position
+$.ui = $.ui || {};
+
+$.extend( $.ui, {
+ version: "1.11.4",
+
+ keyCode: {
+ BACKSPACE: 8,
+ COMMA: 188,
+ DELETE: 46,
+ DOWN: 40,
+ END: 35,
+ ENTER: 13,
+ ESCAPE: 27,
+ HOME: 36,
+ LEFT: 37,
+ PAGE_DOWN: 34,
+ PAGE_UP: 33,
+ PERIOD: 190,
+ RIGHT: 39,
+ SPACE: 32,
+ TAB: 9,
+ UP: 38
+ }
+});
+
+// plugins
+$.fn.extend({
+ scrollParent: function( includeHidden ) {
+ var position = this.css( "position" ),
+ excludeStaticParent = position === "absolute",
+ overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
+ scrollParent = this.parents().filter( function() {
+ var parent = $( this );
+ if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
+ return false;
+ }
+ return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
+ }).eq( 0 );
+
+ return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
+ },
+
+ uniqueId: (function() {
+ var uuid = 0;
+
+ return function() {
+ return this.each(function() {
+ if ( !this.id ) {
+ this.id = "ui-id-" + ( ++uuid );
+ }
+ });
+ };
+ })(),
+
+ removeUniqueId: function() {
+ return this.each(function() {
+ if ( /^ui-id-\d+$/.test( this.id ) ) {
+ $( this ).removeAttr( "id" );
+ }
+ });
+ }
+});
+
+// selectors
+function focusable( element, isTabIndexNotNaN ) {
+ var map, mapName, img,
+ nodeName = element.nodeName.toLowerCase();
+ if ( "area" === nodeName ) {
+ map = element.parentNode;
+ mapName = map.name;
+ if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
+ return false;
+ }
+ img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
+ return !!img && visible( img );
+ }
+ return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
+ !element.disabled :
+ "a" === nodeName ?
+ element.href || isTabIndexNotNaN :
+ isTabIndexNotNaN) &&
+ // the element and all of its ancestors must be visible
+ visible( element );
+}
+
+function visible( element ) {
+ return $.expr.filters.visible( element ) &&
+ !$( element ).parents().addBack().filter(function() {
+ return $.css( this, "visibility" ) === "hidden";
+ }).length;
+}
+
+$.extend( $.expr[ ":" ], {
+ data: $.expr.createPseudo ?
+ $.expr.createPseudo(function( dataName ) {
+ return function( elem ) {
+ return !!$.data( elem, dataName );
+ };
+ }) :
+ // support: jQuery <1.8
+ function( elem, i, match ) {
+ return !!$.data( elem, match[ 3 ] );
+ },
+
+ focusable: function( element ) {
+ return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
+ },
+
+ tabbable: function( element ) {
+ var tabIndex = $.attr( element, "tabindex" ),
+ isTabIndexNaN = isNaN( tabIndex );
+ return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
+ }
+});
+
+// support: jQuery <1.8
+if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
+ $.each( [ "Width", "Height" ], function( i, name ) {
+ var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
+ type = name.toLowerCase(),
+ orig = {
+ innerWidth: $.fn.innerWidth,
+ innerHeight: $.fn.innerHeight,
+ outerWidth: $.fn.outerWidth,
+ outerHeight: $.fn.outerHeight
+ };
+
+ function reduce( elem, size, border, margin ) {
+ $.each( side, function() {
+ size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
+ if ( border ) {
+ size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
+ }
+ if ( margin ) {
+ size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
+ }
+ });
+ return size;
+ }
+
+ $.fn[ "inner" + name ] = function( size ) {
+ if ( size === undefined ) {
+ return orig[ "inner" + name ].call( this );
+ }
+
+ return this.each(function() {
+ $( this ).css( type, reduce( this, size ) + "px" );
+ });
+ };
+
+ $.fn[ "outer" + name] = function( size, margin ) {
+ if ( typeof size !== "number" ) {
+ return orig[ "outer" + name ].call( this, size );
+ }
+
+ return this.each(function() {
+ $( this).css( type, reduce( this, size, true, margin ) + "px" );
+ });
+ };
+ });
+}
+
+// support: jQuery <1.8
+if ( !$.fn.addBack ) {
+ $.fn.addBack = function( selector ) {
+ return this.add( selector == null ?
+ this.prevObject : this.prevObject.filter( selector )
+ );
+ };
+}
+
+// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
+if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
+ $.fn.removeData = (function( removeData ) {
+ return function( key ) {
+ if ( arguments.length ) {
+ return removeData.call( this, $.camelCase( key ) );
+ } else {
+ return removeData.call( this );
+ }
+ };
+ })( $.fn.removeData );
+}
+
+// deprecated
+$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
+
+$.fn.extend({
+ focus: (function( orig ) {
+ return function( delay, fn ) {
+ return typeof delay === "number" ?
+ this.each(function() {
+ var elem = this;
+ setTimeout(function() {
+ $( elem ).focus();
+ if ( fn ) {
+ fn.call( elem );
+ }
+ }, delay );
+ }) :
+ orig.apply( this, arguments );
+ };
+ })( $.fn.focus ),
+
+ disableSelection: (function() {
+ var eventType = "onselectstart" in document.createElement( "div" ) ?
+ "selectstart" :
+ "mousedown";
+
+ return function() {
+ return this.bind( eventType + ".ui-disableSelection", function( event ) {
+ event.preventDefault();
+ });
+ };
+ })(),
+
+ enableSelection: function() {
+ return this.unbind( ".ui-disableSelection" );
+ },
+
+ zIndex: function( zIndex ) {
+ if ( zIndex !== undefined ) {
+ return this.css( "zIndex", zIndex );
+ }
+
+ if ( this.length ) {
+ var elem = $( this[ 0 ] ), position, value;
+ while ( elem.length && elem[ 0 ] !== document ) {
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
+ // This makes behavior of this function consistent across browsers
+ // WebKit always returns auto if the element is positioned
+ position = elem.css( "position" );
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
+ // IE returns 0 when zIndex is not specified
+ // other browsers return a string
+ // we ignore the case of nested elements with an explicit value of 0
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
+ value = parseInt( elem.css( "zIndex" ), 10 );
+ if ( !isNaN( value ) && value !== 0 ) {
+ return value;
+ }
+ }
+ elem = elem.parent();
+ }
+ }
+
+ return 0;
+ }
+});
+
+// $.ui.plugin is deprecated. Use $.widget() extensions instead.
+$.ui.plugin = {
+ add: function( module, option, set ) {
+ var i,
+ proto = $.ui[ module ].prototype;
+ for ( i in set ) {
+ proto.plugins[ i ] = proto.plugins[ i ] || [];
+ proto.plugins[ i ].push( [ option, set[ i ] ] );
+ }
+ },
+ call: function( instance, name, args, allowDisconnected ) {
+ var i,
+ set = instance.plugins[ name ];
+
+ if ( !set ) {
+ return;
+ }
+
+ if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
+ return;
+ }
+
+ for ( i = 0; i < set.length; i++ ) {
+ if ( instance.options[ set[ i ][ 0 ] ] ) {
+ set[ i ][ 1 ].apply( instance.element, args );
+ }
+ }
+ }
+};
+
+
+/*!
+ * jQuery UI Widget 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/jQuery.widget/
+ */
+
+
+var widget_uuid = 0,
+ widget_slice = Array.prototype.slice;
+
+$.cleanData = (function( orig ) {
+ return function( elems ) {
+ var events, elem, i;
+ for ( i = 0; (elem = elems[i]) != null; i++ ) {
+ try {
+
+ // Only trigger remove when necessary to save time
+ events = $._data( elem, "events" );
+ if ( events && events.remove ) {
+ $( elem ).triggerHandler( "remove" );
+ }
+
+ // http://bugs.jquery.com/ticket/8235
+ } catch ( e ) {}
+ }
+ orig( elems );
+ };
+})( $.cleanData );
+
+$.widget = function( name, base, prototype ) {
+ var fullName, existingConstructor, constructor, basePrototype,
+ // proxiedPrototype allows the provided prototype to remain unmodified
+ // so that it can be used as a mixin for multiple widgets (#8876)
+ proxiedPrototype = {},
+ namespace = name.split( "." )[ 0 ];
+
+ name = name.split( "." )[ 1 ];
+ fullName = namespace + "-" + name;
+
+ if ( !prototype ) {
+ prototype = base;
+ base = $.Widget;
+ }
+
+ // create selector for plugin
+ $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
+ return !!$.data( elem, fullName );
+ };
+
+ $[ namespace ] = $[ namespace ] || {};
+ existingConstructor = $[ namespace ][ name ];
+ constructor = $[ namespace ][ name ] = function( options, element ) {
+ // allow instantiation without "new" keyword
+ if ( !this._createWidget ) {
+ return new constructor( options, element );
+ }
+
+ // allow instantiation without initializing for simple inheritance
+ // must use "new" keyword (the code above always passes args)
+ if ( arguments.length ) {
+ this._createWidget( options, element );
+ }
+ };
+ // extend with the existing constructor to carry over any static properties
+ $.extend( constructor, existingConstructor, {
+ version: prototype.version,
+ // copy the object used to create the prototype in case we need to
+ // redefine the widget later
+ _proto: $.extend( {}, prototype ),
+ // track widgets that inherit from this widget in case this widget is
+ // redefined after a widget inherits from it
+ _childConstructors: []
+ });
+
+ basePrototype = new base();
+ // we need to make the options hash a property directly on the new instance
+ // otherwise we'll modify the options hash on the prototype that we're
+ // inheriting from
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );
+ $.each( prototype, function( prop, value ) {
+ if ( !$.isFunction( value ) ) {
+ proxiedPrototype[ prop ] = value;
+ return;
+ }
+ proxiedPrototype[ prop ] = (function() {
+ var _super = function() {
+ return base.prototype[ prop ].apply( this, arguments );
+ },
+ _superApply = function( args ) {
+ return base.prototype[ prop ].apply( this, args );
+ };
+ return function() {
+ var __super = this._super,
+ __superApply = this._superApply,
+ returnValue;
+
+ this._super = _super;
+ this._superApply = _superApply;
+
+ returnValue = value.apply( this, arguments );
+
+ this._super = __super;
+ this._superApply = __superApply;
+
+ return returnValue;
+ };
+ })();
+ });
+ constructor.prototype = $.widget.extend( basePrototype, {
+ // TODO: remove support for widgetEventPrefix
+ // always use the name + a colon as the prefix, e.g., draggable:start
+ // don't prefix for widgets that aren't DOM-based
+ widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
+ }, proxiedPrototype, {
+ constructor: constructor,
+ namespace: namespace,
+ widgetName: name,
+ widgetFullName: fullName
+ });
+
+ // If this widget is being redefined then we need to find all widgets that
+ // are inheriting from it and redefine all of them so that they inherit from
+ // the new version of this widget. We're essentially trying to replace one
+ // level in the prototype chain.
+ if ( existingConstructor ) {
+ $.each( existingConstructor._childConstructors, function( i, child ) {
+ var childPrototype = child.prototype;
+
+ // redefine the child widget using the same prototype that was
+ // originally used, but inherit from the new version of the base
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
+ });
+ // remove the list of existing child constructors from the old constructor
+ // so the old child constructors can be garbage collected
+ delete existingConstructor._childConstructors;
+ } else {
+ base._childConstructors.push( constructor );
+ }
+
+ $.widget.bridge( name, constructor );
+
+ return constructor;
+};
+
+$.widget.extend = function( target ) {
+ var input = widget_slice.call( arguments, 1 ),
+ inputIndex = 0,
+ inputLength = input.length,
+ key,
+ value;
+ for ( ; inputIndex < inputLength; inputIndex++ ) {
+ for ( key in input[ inputIndex ] ) {
+ value = input[ inputIndex ][ key ];
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
+ // Clone objects
+ if ( $.isPlainObject( value ) ) {
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
+ $.widget.extend( {}, target[ key ], value ) :
+ // Don't extend strings, arrays, etc. with objects
+ $.widget.extend( {}, value );
+ // Copy everything else by reference
+ } else {
+ target[ key ] = value;
+ }
+ }
+ }
+ }
+ return target;
+};
+
+$.widget.bridge = function( name, object ) {
+ var fullName = object.prototype.widgetFullName || name;
+ $.fn[ name ] = function( options ) {
+ var isMethodCall = typeof options === "string",
+ args = widget_slice.call( arguments, 1 ),
+ returnValue = this;
+
+ if ( isMethodCall ) {
+ this.each(function() {
+ var methodValue,
+ instance = $.data( this, fullName );
+ if ( options === "instance" ) {
+ returnValue = instance;
+ return false;
+ }
+ if ( !instance ) {
+ return $.error( "cannot call methods on " + name + " prior to initialization; " +
+ "attempted to call method '" + options + "'" );
+ }
+ if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
+ return $.error( "no such method '" + options + "' for " + name + " widget instance" );
+ }
+ methodValue = instance[ options ].apply( instance, args );
+ if ( methodValue !== instance && methodValue !== undefined ) {
+ returnValue = methodValue && methodValue.jquery ?
+ returnValue.pushStack( methodValue.get() ) :
+ methodValue;
+ return false;
+ }
+ });
+ } else {
+
+ // Allow multiple hashes to be passed on init
+ if ( args.length ) {
+ options = $.widget.extend.apply( null, [ options ].concat(args) );
+ }
+
+ this.each(function() {
+ var instance = $.data( this, fullName );
+ if ( instance ) {
+ instance.option( options || {} );
+ if ( instance._init ) {
+ instance._init();
+ }
+ } else {
+ $.data( this, fullName, new object( options, this ) );
+ }
+ });
+ }
+
+ return returnValue;
+ };
+};
+
+$.Widget = function( /* options, element */ ) {};
+$.Widget._childConstructors = [];
+
+$.Widget.prototype = {
+ widgetName: "widget",
+ widgetEventPrefix: "",
+ defaultElement: "<div>",
+ options: {
+ disabled: false,
+
+ // callbacks
+ create: null
+ },
+ _createWidget: function( options, element ) {
+ element = $( element || this.defaultElement || this )[ 0 ];
+ this.element = $( element );
+ this.uuid = widget_uuid++;
+ this.eventNamespace = "." + this.widgetName + this.uuid;
+
+ this.bindings = $();
+ this.hoverable = $();
+ this.focusable = $();
+
+ if ( element !== this ) {
+ $.data( element, this.widgetFullName, this );
+ this._on( true, this.element, {
+ remove: function( event ) {
+ if ( event.target === element ) {
+ this.destroy();
+ }
+ }
+ });
+ this.document = $( element.style ?
+ // element within the document
+ element.ownerDocument :
+ // element is window or document
+ element.document || element );
+ this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
+ }
+
+ this.options = $.widget.extend( {},
+ this.options,
+ this._getCreateOptions(),
+ options );
+
+ this._create();
+ this._trigger( "create", null, this._getCreateEventData() );
+ this._init();
+ },
+ _getCreateOptions: $.noop,
+ _getCreateEventData: $.noop,
+ _create: $.noop,
+ _init: $.noop,
+
+ destroy: function() {
+ this._destroy();
+ // we can probably remove the unbind calls in 2.0
+ // all event bindings should go through this._on()
+ this.element
+ .unbind( this.eventNamespace )
+ .removeData( this.widgetFullName )
+ // support: jquery <1.6.3
+ // http://bugs.jquery.com/ticket/9413
+ .removeData( $.camelCase( this.widgetFullName ) );
+ this.widget()
+ .unbind( this.eventNamespace )
+ .removeAttr( "aria-disabled" )
+ .removeClass(
+ this.widgetFullName + "-disabled " +
+ "ui-state-disabled" );
+
+ // clean up events and states
+ this.bindings.unbind( this.eventNamespace );
+ this.hoverable.removeClass( "ui-state-hover" );
+ this.focusable.removeClass( "ui-state-focus" );
+ },
+ _destroy: $.noop,
+
+ widget: function() {
+ return this.element;
+ },
+
+ option: function( key, value ) {
+ var options = key,
+ parts,
+ curOption,
+ i;
+
+ if ( arguments.length === 0 ) {
+ // don't return a reference to the internal hash
+ return $.widget.extend( {}, this.options );
+ }
+
+ if ( typeof key === "string" ) {
+ // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
+ options = {};
+ parts = key.split( "." );
+ key = parts.shift();
+ if ( parts.length ) {
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
+ for ( i = 0; i < parts.length - 1; i++ ) {
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
+ curOption = curOption[ parts[ i ] ];
+ }
+ key = parts.pop();
+ if ( arguments.length === 1 ) {
+ return curOption[ key ] === undefined ? null : curOption[ key ];
+ }
+ curOption[ key ] = value;
+ } else {
+ if ( arguments.length === 1 ) {
+ return this.options[ key ] === undefined ? null : this.options[ key ];
+ }
+ options[ key ] = value;
+ }
+ }
+
+ this._setOptions( options );
+
+ return this;
+ },
+ _setOptions: function( options ) {
+ var key;
+
+ for ( key in options ) {
+ this._setOption( key, options[ key ] );
+ }
+
+ return this;
+ },
+ _setOption: function( key, value ) {
+ this.options[ key ] = value;
+
+ if ( key === "disabled" ) {
+ this.widget()
+ .toggleClass( this.widgetFullName + "-disabled", !!value );
+
+ // If the widget is becoming disabled, then nothing is interactive
+ if ( value ) {
+ this.hoverable.removeClass( "ui-state-hover" );
+ this.focusable.removeClass( "ui-state-focus" );
+ }
+ }
+
+ return this;
+ },
+
+ enable: function() {
+ return this._setOptions({ disabled: false });
+ },
+ disable: function() {
+ return this._setOptions({ disabled: true });
+ },
+
+ _on: function( suppressDisabledCheck, element, handlers ) {
+ var delegateElement,
+ instance = this;
+
+ // no suppressDisabledCheck flag, shuffle arguments
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
+ handlers = element;
+ element = suppressDisabledCheck;
+ suppressDisabledCheck = false;
+ }
+
+ // no element argument, shuffle and use this.element
+ if ( !handlers ) {
+ handlers = element;
+ element = this.element;
+ delegateElement = this.widget();
+ } else {
+ element = delegateElement = $( element );
+ this.bindings = this.bindings.add( element );
+ }
+
+ $.each( handlers, function( event, handler ) {
+ function handlerProxy() {
+ // allow widgets to customize the disabled handling
+ // - disabled as an array instead of boolean
+ // - disabled class as method for disabling individual parts
+ if ( !suppressDisabledCheck &&
+ ( instance.options.disabled === true ||
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
+ return;
+ }
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
+ .apply( instance, arguments );
+ }
+
+ // copy the guid so direct unbinding works
+ if ( typeof handler !== "string" ) {
+ handlerProxy.guid = handler.guid =
+ handler.guid || handlerProxy.guid || $.guid++;
+ }
+
+ var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
+ eventName = match[1] + instance.eventNamespace,
+ selector = match[2];
+ if ( selector ) {
+ delegateElement.delegate( selector, eventName, handlerProxy );
+ } else {
+ element.bind( eventName, handlerProxy );
+ }
+ });
+ },
+
+ _off: function( element, eventName ) {
+ eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
+ this.eventNamespace;
+ element.unbind( eventName ).undelegate( eventName );
+
+ // Clear the stack to avoid memory leaks (#10056)
+ this.bindings = $( this.bindings.not( element ).get() );
+ this.focusable = $( this.focusable.not( element ).get() );
+ this.hoverable = $( this.hoverable.not( element ).get() );
+ },
+
+ _delay: function( handler, delay ) {
+ function handlerProxy() {
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
+ .apply( instance, arguments );
+ }
+ var instance = this;
+ return setTimeout( handlerProxy, delay || 0 );
+ },
+
+ _hoverable: function( element ) {
+ this.hoverable = this.hoverable.add( element );
+ this._on( element, {
+ mouseenter: function( event ) {
+ $( event.currentTarget ).addClass( "ui-state-hover" );
+ },
+ mouseleave: function( event ) {
+ $( event.currentTarget ).removeClass( "ui-state-hover" );
+ }
+ });
+ },
+
+ _focusable: function( element ) {
+ this.focusable = this.focusable.add( element );
+ this._on( element, {
+ focusin: function( event ) {
+ $( event.currentTarget ).addClass( "ui-state-focus" );
+ },
+ focusout: function( event ) {
+ $( event.currentTarget ).removeClass( "ui-state-focus" );
+ }
+ });
+ },
+
+ _trigger: function( type, event, data ) {
+ var prop, orig,
+ callback = this.options[ type ];
+
+ data = data || {};
+ event = $.Event( event );
+ event.type = ( type === this.widgetEventPrefix ?
+ type :
+ this.widgetEventPrefix + type ).toLowerCase();
+ // the original event may come from any element
+ // so we need to reset the target on the new event
+ event.target = this.element[ 0 ];
+
+ // copy original event properties over to the new event
+ orig = event.originalEvent;
+ if ( orig ) {
+ for ( prop in orig ) {
+ if ( !( prop in event ) ) {
+ event[ prop ] = orig[ prop ];
+ }
+ }
+ }
+
+ this.element.trigger( event, data );
+ return !( $.isFunction( callback ) &&
+ callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
+ event.isDefaultPrevented() );
+ }
+};
+
+$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
+ if ( typeof options === "string" ) {
+ options = { effect: options };
+ }
+ var hasOptions,
+ effectName = !options ?
+ method :
+ options === true || typeof options === "number" ?
+ defaultEffect :
+ options.effect || defaultEffect;
+ options = options || {};
+ if ( typeof options === "number" ) {
+ options = { duration: options };
+ }
+ hasOptions = !$.isEmptyObject( options );
+ options.complete = callback;
+ if ( options.delay ) {
+ element.delay( options.delay );
+ }
+ if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
+ element[ method ]( options );
+ } else if ( effectName !== method && element[ effectName ] ) {
+ element[ effectName ]( options.duration, options.easing, callback );
+ } else {
+ element.queue(function( next ) {
+ $( this )[ method ]();
+ if ( callback ) {
+ callback.call( element[ 0 ] );
+ }
+ next();
+ });
+ }
+ };
+});
+
+var widget = $.widget;
+
+
+/*!
+ * jQuery UI Mouse 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/mouse/
+ */
+
+
+var mouseHandled = false;
+$( document ).mouseup( function() {
+ mouseHandled = false;
+});
+
+var mouse = $.widget("ui.mouse", {
+ version: "1.11.4",
+ options: {
+ cancel: "input,textarea,button,select,option",
+ distance: 1,
+ delay: 0
+ },
+ _mouseInit: function() {
+ var that = this;
+
+ this.element
+ .bind("mousedown." + this.widgetName, function(event) {
+ return that._mouseDown(event);
+ })
+ .bind("click." + this.widgetName, function(event) {
+ if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
+ $.removeData(event.target, that.widgetName + ".preventClickEvent");
+ event.stopImmediatePropagation();
+ return false;
+ }
+ });
+
+ this.started = false;
+ },
+
+ // TODO: make sure destroying one instance of mouse doesn't mess with
+ // other instances of mouse
+ _mouseDestroy: function() {
+ this.element.unbind("." + this.widgetName);
+ if ( this._mouseMoveDelegate ) {
+ this.document
+ .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
+ .unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
+ }
+ },
+
+ _mouseDown: function(event) {
+ // don't let more than one widget handle mouseStart
+ if ( mouseHandled ) {
+ return;
+ }
+
+ this._mouseMoved = false;
+
+ // we may have missed mouseup (out of window)
+ (this._mouseStarted && this._mouseUp(event));
+
+ this._mouseDownEvent = event;
+
+ var that = this,
+ btnIsLeft = (event.which === 1),
+ // event.target.nodeName works around a bug in IE 8 with
+ // disabled inputs (#7620)
+ elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
+ if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
+ return true;
+ }
+
+ this.mouseDelayMet = !this.options.delay;
+ if (!this.mouseDelayMet) {
+ this._mouseDelayTimer = setTimeout(function() {
+ that.mouseDelayMet = true;
+ }, this.options.delay);
+ }
+
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+ this._mouseStarted = (this._mouseStart(event) !== false);
+ if (!this._mouseStarted) {
+ event.preventDefault();
+ return true;
+ }
+ }
+
+ // Click event may never have fired (Gecko & Opera)
+ if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
+ $.removeData(event.target, this.widgetName + ".preventClickEvent");
+ }
+
+ // these delegates are required to keep context
+ this._mouseMoveDelegate = function(event) {
+ return that._mouseMove(event);
+ };
+ this._mouseUpDelegate = function(event) {
+ return that._mouseUp(event);
+ };
+
+ this.document
+ .bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
+ .bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
+
+ event.preventDefault();
+
+ mouseHandled = true;
+ return true;
+ },
+
+ _mouseMove: function(event) {
+ // Only check for mouseups outside the document if you've moved inside the document
+ // at least once. This prevents the firing of mouseup in the case of IE<9, which will
+ // fire a mousemove event if content is placed under the cursor. See #7778
+ // Support: IE <9
+ if ( this._mouseMoved ) {
+ // IE mouseup check - mouseup happened when mouse was out of window
+ if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
+ return this._mouseUp(event);
+
+ // Iframe mouseup check - mouseup occurred in another document
+ } else if ( !event.which ) {
+ return this._mouseUp( event );
+ }
+ }
+
+ if ( event.which || event.button ) {
+ this._mouseMoved = true;
+ }
+
+ if (this._mouseStarted) {
+ this._mouseDrag(event);
+ return event.preventDefault();
+ }
+
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+ this._mouseStarted =
+ (this._mouseStart(this._mouseDownEvent, event) !== false);
+ (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
+ }
+
+ return !this._mouseStarted;
+ },
+
+ _mouseUp: function(event) {
+ this.document
+ .unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
+ .unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
+
+ if (this._mouseStarted) {
+ this._mouseStarted = false;
+
+ if (event.target === this._mouseDownEvent.target) {
+ $.data(event.target, this.widgetName + ".preventClickEvent", true);
+ }
+
+ this._mouseStop(event);
+ }
+
+ mouseHandled = false;
+ return false;
+ },
+
+ _mouseDistanceMet: function(event) {
+ return (Math.max(
+ Math.abs(this._mouseDownEvent.pageX - event.pageX),
+ Math.abs(this._mouseDownEvent.pageY - event.pageY)
+ ) >= this.options.distance
+ );
+ },
+
+ _mouseDelayMet: function(/* event */) {
+ return this.mouseDelayMet;
+ },
+
+ // These are placeholder methods, to be overriden by extending plugin
+ _mouseStart: function(/* event */) {},
+ _mouseDrag: function(/* event */) {},
+ _mouseStop: function(/* event */) {},
+ _mouseCapture: function(/* event */) { return true; }
+});
+
+
+/*!
+ * jQuery UI Position 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/position/
+ */
+
+(function() {
+
+$.ui = $.ui || {};
+
+var cachedScrollbarWidth, supportsOffsetFractions,
+ max = Math.max,
+ abs = Math.abs,
+ round = Math.round,
+ rhorizontal = /left|center|right/,
+ rvertical = /top|center|bottom/,
+ roffset = /[\+\-]\d+(\.[\d]+)?%?/,
+ rposition = /^\w+/,
+ rpercent = /%$/,
+ _position = $.fn.position;
+
+function getOffsets( offsets, width, height ) {
+ return [
+ parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
+ parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
+ ];
+}
+
+function parseCss( element, property ) {
+ return parseInt( $.css( element, property ), 10 ) || 0;
+}
+
+function getDimensions( elem ) {
+ var raw = elem[0];
+ if ( raw.nodeType === 9 ) {
+ return {
+ width: elem.width(),
+ height: elem.height(),
+ offset: { top: 0, left: 0 }
+ };
+ }
+ if ( $.isWindow( raw ) ) {
+ return {
+ width: elem.width(),
+ height: elem.height(),
+ offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
+ };
+ }
+ if ( raw.preventDefault ) {
+ return {
+ width: 0,
+ height: 0,
+ offset: { top: raw.pageY, left: raw.pageX }
+ };
+ }
+ return {
+ width: elem.outerWidth(),
+ height: elem.outerHeight(),
+ offset: elem.offset()
+ };
+}
+
+$.position = {
+ scrollbarWidth: function() {
+ if ( cachedScrollbarWidth !== undefined ) {
+ return cachedScrollbarWidth;
+ }
+ var w1, w2,
+ div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
+ innerDiv = div.children()[0];
+
+ $( "body" ).append( div );
+ w1 = innerDiv.offsetWidth;
+ div.css( "overflow", "scroll" );
+
+ w2 = innerDiv.offsetWidth;
+
+ if ( w1 === w2 ) {
+ w2 = div[0].clientWidth;
+ }
+
+ div.remove();
+
+ return (cachedScrollbarWidth = w1 - w2);
+ },
+ getScrollInfo: function( within ) {
+ var overflowX = within.isWindow || within.isDocument ? "" :
+ within.element.css( "overflow-x" ),
+ overflowY = within.isWindow || within.isDocument ? "" :
+ within.element.css( "overflow-y" ),
+ hasOverflowX = overflowX === "scroll" ||
+ ( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
+ hasOverflowY = overflowY === "scroll" ||
+ ( overflowY === "auto" && within.height < within.element[0].scrollHeight );
+ return {
+ width: hasOverflowY ? $.position.scrollbarWidth() : 0,
+ height: hasOverflowX ? $.position.scrollbarWidth() : 0
+ };
+ },
+ getWithinInfo: function( element ) {
+ var withinElement = $( element || window ),
+ isWindow = $.isWindow( withinElement[0] ),
+ isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
+ return {
+ element: withinElement,
+ isWindow: isWindow,
+ isDocument: isDocument,
+ offset: withinElement.offset() || { left: 0, top: 0 },
+ scrollLeft: withinElement.scrollLeft(),
+ scrollTop: withinElement.scrollTop(),
+
+ // support: jQuery 1.6.x
+ // jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows
+ width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(),
+ height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight()
+ };
+ }
+};
+
+$.fn.position = function( options ) {
+ if ( !options || !options.of ) {
+ return _position.apply( this, arguments );
+ }
+
+ // make a copy, we don't want to modify arguments
+ options = $.extend( {}, options );
+
+ var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
+ target = $( options.of ),
+ within = $.position.getWithinInfo( options.within ),
+ scrollInfo = $.position.getScrollInfo( within ),
+ collision = ( options.collision || "flip" ).split( " " ),
+ offsets = {};
+
+ dimensions = getDimensions( target );
+ if ( target[0].preventDefault ) {
+ // force left top to allow flipping
+ options.at = "left top";
+ }
+ targetWidth = dimensions.width;
+ targetHeight = dimensions.height;
+ targetOffset = dimensions.offset;
+ // clone to reuse original targetOffset later
+ basePosition = $.extend( {}, targetOffset );
+
+ // force my and at to have valid horizontal and vertical positions
+ // if a value is missing or invalid, it will be converted to center
+ $.each( [ "my", "at" ], function() {
+ var pos = ( options[ this ] || "" ).split( " " ),
+ horizontalOffset,
+ verticalOffset;
+
+ if ( pos.length === 1) {
+ pos = rhorizontal.test( pos[ 0 ] ) ?
+ pos.concat( [ "center" ] ) :
+ rvertical.test( pos[ 0 ] ) ?
+ [ "center" ].concat( pos ) :
+ [ "center", "center" ];
+ }
+ pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
+ pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
+
+ // calculate offsets
+ horizontalOffset = roffset.exec( pos[ 0 ] );
+ verticalOffset = roffset.exec( pos[ 1 ] );
+ offsets[ this ] = [
+ horizontalOffset ? horizontalOffset[ 0 ] : 0,
+ verticalOffset ? verticalOffset[ 0 ] : 0
+ ];
+
+ // reduce to just the positions without the offsets
+ options[ this ] = [
+ rposition.exec( pos[ 0 ] )[ 0 ],
+ rposition.exec( pos[ 1 ] )[ 0 ]
+ ];
+ });
+
+ // normalize collision option
+ if ( collision.length === 1 ) {
+ collision[ 1 ] = collision[ 0 ];
+ }
+
+ if ( options.at[ 0 ] === "right" ) {
+ basePosition.left += targetWidth;
+ } else if ( options.at[ 0 ] === "center" ) {
+ basePosition.left += targetWidth / 2;
+ }
+
+ if ( options.at[ 1 ] === "bottom" ) {
+ basePosition.top += targetHeight;
+ } else if ( options.at[ 1 ] === "center" ) {
+ basePosition.top += targetHeight / 2;
+ }
+
+ atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
+ basePosition.left += atOffset[ 0 ];
+ basePosition.top += atOffset[ 1 ];
+
+ return this.each(function() {
+ var collisionPosition, using,
+ elem = $( this ),
+ elemWidth = elem.outerWidth(),
+ elemHeight = elem.outerHeight(),
+ marginLeft = parseCss( this, "marginLeft" ),
+ marginTop = parseCss( this, "marginTop" ),
+ collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
+ collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
+ position = $.extend( {}, basePosition ),
+ myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
+
+ if ( options.my[ 0 ] === "right" ) {
+ position.left -= elemWidth;
+ } else if ( options.my[ 0 ] === "center" ) {
+ position.left -= elemWidth / 2;
+ }
+
+ if ( options.my[ 1 ] === "bottom" ) {
+ position.top -= elemHeight;
+ } else if ( options.my[ 1 ] === "center" ) {
+ position.top -= elemHeight / 2;
+ }
+
+ position.left += myOffset[ 0 ];
+ position.top += myOffset[ 1 ];
+
+ // if the browser doesn't support fractions, then round for consistent results
+ if ( !supportsOffsetFractions ) {
+ position.left = round( position.left );
+ position.top = round( position.top );
+ }
+
+ collisionPosition = {
+ marginLeft: marginLeft,
+ marginTop: marginTop
+ };
+
+ $.each( [ "left", "top" ], function( i, dir ) {
+ if ( $.ui.position[ collision[ i ] ] ) {
+ $.ui.position[ collision[ i ] ][ dir ]( position, {
+ targetWidth: targetWidth,
+ targetHeight: targetHeight,
+ elemWidth: elemWidth,
+ elemHeight: elemHeight,
+ collisionPosition: collisionPosition,
+ collisionWidth: collisionWidth,
+ collisionHeight: collisionHeight,
+ offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
+ my: options.my,
+ at: options.at,
+ within: within,
+ elem: elem
+ });
+ }
+ });
+
+ if ( options.using ) {
+ // adds feedback as second argument to using callback, if present
+ using = function( props ) {
+ var left = targetOffset.left - position.left,
+ right = left + targetWidth - elemWidth,
+ top = targetOffset.top - position.top,
+ bottom = top + targetHeight - elemHeight,
+ feedback = {
+ target: {
+ element: target,
+ left: targetOffset.left,
+ top: targetOffset.top,
+ width: targetWidth,
+ height: targetHeight
+ },
+ element: {
+ element: elem,
+ left: position.left,
+ top: position.top,
+ width: elemWidth,
+ height: elemHeight
+ },
+ horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
+ vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
+ };
+ if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
+ feedback.horizontal = "center";
+ }
+ if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
+ feedback.vertical = "middle";
+ }
+ if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
+ feedback.important = "horizontal";
+ } else {
+ feedback.important = "vertical";
+ }
+ options.using.call( this, props, feedback );
+ };
+ }
+
+ elem.offset( $.extend( position, { using: using } ) );
+ });
+};
+
+$.ui.position = {
+ fit: {
+ left: function( position, data ) {
+ var within = data.within,
+ withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
+ outerWidth = within.width,
+ collisionPosLeft = position.left - data.collisionPosition.marginLeft,
+ overLeft = withinOffset - collisionPosLeft,
+ overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
+ newOverRight;
+
+ // element is wider than within
+ if ( data.collisionWidth > outerWidth ) {
+ // element is initially over the left side of within
+ if ( overLeft > 0 && overRight <= 0 ) {
+ newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
+ position.left += overLeft - newOverRight;
+ // element is initially over right side of within
+ } else if ( overRight > 0 && overLeft <= 0 ) {
+ position.left = withinOffset;
+ // element is initially over both left and right sides of within
+ } else {
+ if ( overLeft > overRight ) {
+ position.left = withinOffset + outerWidth - data.collisionWidth;
+ } else {
+ position.left = withinOffset;
+ }
+ }
+ // too far left -> align with left edge
+ } else if ( overLeft > 0 ) {
+ position.left += overLeft;
+ // too far right -> align with right edge
+ } else if ( overRight > 0 ) {
+ position.left -= overRight;
+ // adjust based on position and margin
+ } else {
+ position.left = max( position.left - collisionPosLeft, position.left );
+ }
+ },
+ top: function( position, data ) {
+ var within = data.within,
+ withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
+ outerHeight = data.within.height,
+ collisionPosTop = position.top - data.collisionPosition.marginTop,
+ overTop = withinOffset - collisionPosTop,
+ overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
+ newOverBottom;
+
+ // element is taller than within
+ if ( data.collisionHeight > outerHeight ) {
+ // element is initially over the top of within
+ if ( overTop > 0 && overBottom <= 0 ) {
+ newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
+ position.top += overTop - newOverBottom;
+ // element is initially over bottom of within
+ } else if ( overBottom > 0 && overTop <= 0 ) {
+ position.top = withinOffset;
+ // element is initially over both top and bottom of within
+ } else {
+ if ( overTop > overBottom ) {
+ position.top = withinOffset + outerHeight - data.collisionHeight;
+ } else {
+ position.top = withinOffset;
+ }
+ }
+ // too far up -> align with top
+ } else if ( overTop > 0 ) {
+ position.top += overTop;
+ // too far down -> align with bottom edge
+ } else if ( overBottom > 0 ) {
+ position.top -= overBottom;
+ // adjust based on position and margin
+ } else {
+ position.top = max( position.top - collisionPosTop, position.top );
+ }
+ }
+ },
+ flip: {
+ left: function( position, data ) {
+ var within = data.within,
+ withinOffset = within.offset.left + within.scrollLeft,
+ outerWidth = within.width,
+ offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
+ collisionPosLeft = position.left - data.collisionPosition.marginLeft,
+ overLeft = collisionPosLeft - offsetLeft,
+ overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
+ myOffset = data.my[ 0 ] === "left" ?
+ -data.elemWidth :
+ data.my[ 0 ] === "right" ?
+ data.elemWidth :
+ 0,
+ atOffset = data.at[ 0 ] === "left" ?
+ data.targetWidth :
+ data.at[ 0 ] === "right" ?
+ -data.targetWidth :
+ 0,
+ offset = -2 * data.offset[ 0 ],
+ newOverRight,
+ newOverLeft;
+
+ if ( overLeft < 0 ) {
+ newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
+ if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
+ position.left += myOffset + atOffset + offset;
+ }
+ } else if ( overRight > 0 ) {
+ newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
+ if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
+ position.left += myOffset + atOffset + offset;
+ }
+ }
+ },
+ top: function( position, data ) {
+ var within = data.within,
+ withinOffset = within.offset.top + within.scrollTop,
+ outerHeight = within.height,
+ offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
+ collisionPosTop = position.top - data.collisionPosition.marginTop,
+ overTop = collisionPosTop - offsetTop,
+ overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
+ top = data.my[ 1 ] === "top",
+ myOffset = top ?
+ -data.elemHeight :
+ data.my[ 1 ] === "bottom" ?
+ data.elemHeight :
+ 0,
+ atOffset = data.at[ 1 ] === "top" ?
+ data.targetHeight :
+ data.at[ 1 ] === "bottom" ?
+ -data.targetHeight :
+ 0,
+ offset = -2 * data.offset[ 1 ],
+ newOverTop,
+ newOverBottom;
+ if ( overTop < 0 ) {
+ newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
+ if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
+ position.top += myOffset + atOffset + offset;
+ }
+ } else if ( overBottom > 0 ) {
+ newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
+ if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
+ position.top += myOffset + atOffset + offset;
+ }
+ }
+ }
+ },
+ flipfit: {
+ left: function() {
+ $.ui.position.flip.left.apply( this, arguments );
+ $.ui.position.fit.left.apply( this, arguments );
+ },
+ top: function() {
+ $.ui.position.flip.top.apply( this, arguments );
+ $.ui.position.fit.top.apply( this, arguments );
+ }
+ }
+};
+
+// fraction support test
+(function() {
+ var testElement, testElementParent, testElementStyle, offsetLeft, i,
+ body = document.getElementsByTagName( "body" )[ 0 ],
+ div = document.createElement( "div" );
+
+ //Create a "fake body" for testing based on method used in jQuery.support
+ testElement = document.createElement( body ? "div" : "body" );
+ testElementStyle = {
+ visibility: "hidden",
+ width: 0,
+ height: 0,
+ border: 0,
+ margin: 0,
+ background: "none"
+ };
+ if ( body ) {
+ $.extend( testElementStyle, {
+ position: "absolute",
+ left: "-1000px",
+ top: "-1000px"
+ });
+ }
+ for ( i in testElementStyle ) {
+ testElement.style[ i ] = testElementStyle[ i ];
+ }
+ testElement.appendChild( div );
+ testElementParent = body || document.documentElement;
+ testElementParent.insertBefore( testElement, testElementParent.firstChild );
+
+ div.style.cssText = "position: absolute; left: 10.7432222px;";
+
+ offsetLeft = $( div ).offset().left;
+ supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
+
+ testElement.innerHTML = "";
+ testElementParent.removeChild( testElement );
+})();
+
+})();
+
+var position = $.ui.position;
+
+
+/*!
+ * jQuery UI Accordion 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/accordion/
+ */
+
+
+var accordion = $.widget( "ui.accordion", {
+ version: "1.11.4",
+ options: {
+ active: 0,
+ animate: {},
+ collapsible: false,
+ event: "click",
+ header: "> li > :first-child,> :not(li):even",
+ heightStyle: "auto",
+ icons: {
+ activeHeader: "ui-icon-triangle-1-s",
+ header: "ui-icon-triangle-1-e"
+ },
+
+ // callbacks
+ activate: null,
+ beforeActivate: null
+ },
+
+ hideProps: {
+ borderTopWidth: "hide",
+ borderBottomWidth: "hide",
+ paddingTop: "hide",
+ paddingBottom: "hide",
+ height: "hide"
+ },
+
+ showProps: {
+ borderTopWidth: "show",
+ borderBottomWidth: "show",
+ paddingTop: "show",
+ paddingBottom: "show",
+ height: "show"
+ },
+
+ _create: function() {
+ var options = this.options;
+ this.prevShow = this.prevHide = $();
+ this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
+ // ARIA
+ .attr( "role", "tablist" );
+
+ // don't allow collapsible: false and active: false / null
+ if ( !options.collapsible && (options.active === false || options.active == null) ) {
+ options.active = 0;
+ }
+
+ this._processPanels();
+ // handle negative values
+ if ( options.active < 0 ) {
+ options.active += this.headers.length;
+ }
+ this._refresh();
+ },
+
+ _getCreateEventData: function() {
+ return {
+ header: this.active,
+ panel: !this.active.length ? $() : this.active.next()
+ };
+ },
+
+ _createIcons: function() {
+ var icons = this.options.icons;
+ if ( icons ) {
+ $( "<span>" )
+ .addClass( "ui-accordion-header-icon ui-icon " + icons.header )
+ .prependTo( this.headers );
+ this.active.children( ".ui-accordion-header-icon" )
+ .removeClass( icons.header )
+ .addClass( icons.activeHeader );
+ this.headers.addClass( "ui-accordion-icons" );
+ }
+ },
+
+ _destroyIcons: function() {
+ this.headers
+ .removeClass( "ui-accordion-icons" )
+ .children( ".ui-accordion-header-icon" )
+ .remove();
+ },
+
+ _destroy: function() {
+ var contents;
+
+ // clean up main element
+ this.element
+ .removeClass( "ui-accordion ui-widget ui-helper-reset" )
+ .removeAttr( "role" );
+
+ // clean up headers
+ this.headers
+ .removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " +
+ "ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-expanded" )
+ .removeAttr( "aria-selected" )
+ .removeAttr( "aria-controls" )
+ .removeAttr( "tabIndex" )
+ .removeUniqueId();
+
+ this._destroyIcons();
+
+ // clean up content panels
+ contents = this.headers.next()
+ .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " +
+ "ui-accordion-content ui-accordion-content-active ui-state-disabled" )
+ .css( "display", "" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-hidden" )
+ .removeAttr( "aria-labelledby" )
+ .removeUniqueId();
+
+ if ( this.options.heightStyle !== "content" ) {
+ contents.css( "height", "" );
+ }
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "active" ) {
+ // _activate() will handle invalid values and update this.options
+ this._activate( value );
+ return;
+ }
+
+ if ( key === "event" ) {
+ if ( this.options.event ) {
+ this._off( this.headers, this.options.event );
+ }
+ this._setupEvents( value );
+ }
+
+ this._super( key, value );
+
+ // setting collapsible: false while collapsed; open first panel
+ if ( key === "collapsible" && !value && this.options.active === false ) {
+ this._activate( 0 );
+ }
+
+ if ( key === "icons" ) {
+ this._destroyIcons();
+ if ( value ) {
+ this._createIcons();
+ }
+ }
+
+ // #5332 - opacity doesn't cascade to positioned elements in IE
+ // so we need to add the disabled class to the headers and panels
+ if ( key === "disabled" ) {
+ this.element
+ .toggleClass( "ui-state-disabled", !!value )
+ .attr( "aria-disabled", value );
+ this.headers.add( this.headers.next() )
+ .toggleClass( "ui-state-disabled", !!value );
+ }
+ },
+
+ _keydown: function( event ) {
+ if ( event.altKey || event.ctrlKey ) {
+ return;
+ }
+
+ var keyCode = $.ui.keyCode,
+ length = this.headers.length,
+ currentIndex = this.headers.index( event.target ),
+ toFocus = false;
+
+ switch ( event.keyCode ) {
+ case keyCode.RIGHT:
+ case keyCode.DOWN:
+ toFocus = this.headers[ ( currentIndex + 1 ) % length ];
+ break;
+ case keyCode.LEFT:
+ case keyCode.UP:
+ toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
+ break;
+ case keyCode.SPACE:
+ case keyCode.ENTER:
+ this._eventHandler( event );
+ break;
+ case keyCode.HOME:
+ toFocus = this.headers[ 0 ];
+ break;
+ case keyCode.END:
+ toFocus = this.headers[ length - 1 ];
+ break;
+ }
+
+ if ( toFocus ) {
+ $( event.target ).attr( "tabIndex", -1 );
+ $( toFocus ).attr( "tabIndex", 0 );
+ toFocus.focus();
+ event.preventDefault();
+ }
+ },
+
+ _panelKeyDown: function( event ) {
+ if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
+ $( event.currentTarget ).prev().focus();
+ }
+ },
+
+ refresh: function() {
+ var options = this.options;
+ this._processPanels();
+
+ // was collapsed or no panel
+ if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
+ options.active = false;
+ this.active = $();
+ // active false only when collapsible is true
+ } else if ( options.active === false ) {
+ this._activate( 0 );
+ // was active, but active panel is gone
+ } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
+ // all remaining panel are disabled
+ if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
+ options.active = false;
+ this.active = $();
+ // activate previous panel
+ } else {
+ this._activate( Math.max( 0, options.active - 1 ) );
+ }
+ // was active, active panel still exists
+ } else {
+ // make sure active index is correct
+ options.active = this.headers.index( this.active );
+ }
+
+ this._destroyIcons();
+
+ this._refresh();
+ },
+
+ _processPanels: function() {
+ var prevHeaders = this.headers,
+ prevPanels = this.panels;
+
+ this.headers = this.element.find( this.options.header )
+ .addClass( "ui-accordion-header ui-state-default ui-corner-all" );
+
+ this.panels = this.headers.next()
+ .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
+ .filter( ":not(.ui-accordion-content-active)" )
+ .hide();
+
+ // Avoid memory leaks (#10056)
+ if ( prevPanels ) {
+ this._off( prevHeaders.not( this.headers ) );
+ this._off( prevPanels.not( this.panels ) );
+ }
+ },
+
+ _refresh: function() {
+ var maxHeight,
+ options = this.options,
+ heightStyle = options.heightStyle,
+ parent = this.element.parent();
+
+ this.active = this._findActive( options.active )
+ .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
+ .removeClass( "ui-corner-all" );
+ this.active.next()
+ .addClass( "ui-accordion-content-active" )
+ .show();
+
+ this.headers
+ .attr( "role", "tab" )
+ .each(function() {
+ var header = $( this ),
+ headerId = header.uniqueId().attr( "id" ),
+ panel = header.next(),
+ panelId = panel.uniqueId().attr( "id" );
+ header.attr( "aria-controls", panelId );
+ panel.attr( "aria-labelledby", headerId );
+ })
+ .next()
+ .attr( "role", "tabpanel" );
+
+ this.headers
+ .not( this.active )
+ .attr({
+ "aria-selected": "false",
+ "aria-expanded": "false",
+ tabIndex: -1
+ })
+ .next()
+ .attr({
+ "aria-hidden": "true"
+ })
+ .hide();
+
+ // make sure at least one header is in the tab order
+ if ( !this.active.length ) {
+ this.headers.eq( 0 ).attr( "tabIndex", 0 );
+ } else {
+ this.active.attr({
+ "aria-selected": "true",
+ "aria-expanded": "true",
+ tabIndex: 0
+ })
+ .next()
+ .attr({
+ "aria-hidden": "false"
+ });
+ }
+
+ this._createIcons();
+
+ this._setupEvents( options.event );
+
+ if ( heightStyle === "fill" ) {
+ maxHeight = parent.height();
+ this.element.siblings( ":visible" ).each(function() {
+ var elem = $( this ),
+ position = elem.css( "position" );
+
+ if ( position === "absolute" || position === "fixed" ) {
+ return;
+ }
+ maxHeight -= elem.outerHeight( true );
+ });
+
+ this.headers.each(function() {
+ maxHeight -= $( this ).outerHeight( true );
+ });
+
+ this.headers.next()
+ .each(function() {
+ $( this ).height( Math.max( 0, maxHeight -
+ $( this ).innerHeight() + $( this ).height() ) );
+ })
+ .css( "overflow", "auto" );
+ } else if ( heightStyle === "auto" ) {
+ maxHeight = 0;
+ this.headers.next()
+ .each(function() {
+ maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
+ })
+ .height( maxHeight );
+ }
+ },
+
+ _activate: function( index ) {
+ var active = this._findActive( index )[ 0 ];
+
+ // trying to activate the already active panel
+ if ( active === this.active[ 0 ] ) {
+ return;
+ }
+
+ // trying to collapse, simulate a click on the currently active header
+ active = active || this.active[ 0 ];
+
+ this._eventHandler({
+ target: active,
+ currentTarget: active,
+ preventDefault: $.noop
+ });
+ },
+
+ _findActive: function( selector ) {
+ return typeof selector === "number" ? this.headers.eq( selector ) : $();
+ },
+
+ _setupEvents: function( event ) {
+ var events = {
+ keydown: "_keydown"
+ };
+ if ( event ) {
+ $.each( event.split( " " ), function( index, eventName ) {
+ events[ eventName ] = "_eventHandler";
+ });
+ }
+
+ this._off( this.headers.add( this.headers.next() ) );
+ this._on( this.headers, events );
+ this._on( this.headers.next(), { keydown: "_panelKeyDown" });
+ this._hoverable( this.headers );
+ this._focusable( this.headers );
+ },
+
+ _eventHandler: function( event ) {
+ var options = this.options,
+ active = this.active,
+ clicked = $( event.currentTarget ),
+ clickedIsActive = clicked[ 0 ] === active[ 0 ],
+ collapsing = clickedIsActive && options.collapsible,
+ toShow = collapsing ? $() : clicked.next(),
+ toHide = active.next(),
+ eventData = {
+ oldHeader: active,
+ oldPanel: toHide,
+ newHeader: collapsing ? $() : clicked,
+ newPanel: toShow
+ };
+
+ event.preventDefault();
+
+ if (
+ // click on active header, but not collapsible
+ ( clickedIsActive && !options.collapsible ) ||
+ // allow canceling activation
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
+ return;
+ }
+
+ options.active = collapsing ? false : this.headers.index( clicked );
+
+ // when the call to ._toggle() comes after the class changes
+ // it causes a very odd bug in IE 8 (see #6720)
+ this.active = clickedIsActive ? $() : clicked;
+ this._toggle( eventData );
+
+ // switch classes
+ // corner classes on the previously active header stay after the animation
+ active.removeClass( "ui-accordion-header-active ui-state-active" );
+ if ( options.icons ) {
+ active.children( ".ui-accordion-header-icon" )
+ .removeClass( options.icons.activeHeader )
+ .addClass( options.icons.header );
+ }
+
+ if ( !clickedIsActive ) {
+ clicked
+ .removeClass( "ui-corner-all" )
+ .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
+ if ( options.icons ) {
+ clicked.children( ".ui-accordion-header-icon" )
+ .removeClass( options.icons.header )
+ .addClass( options.icons.activeHeader );
+ }
+
+ clicked
+ .next()
+ .addClass( "ui-accordion-content-active" );
+ }
+ },
+
+ _toggle: function( data ) {
+ var toShow = data.newPanel,
+ toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
+
+ // handle activating a panel during the animation for another activation
+ this.prevShow.add( this.prevHide ).stop( true, true );
+ this.prevShow = toShow;
+ this.prevHide = toHide;
+
+ if ( this.options.animate ) {
+ this._animate( toShow, toHide, data );
+ } else {
+ toHide.hide();
+ toShow.show();
+ this._toggleComplete( data );
+ }
+
+ toHide.attr({
+ "aria-hidden": "true"
+ });
+ toHide.prev().attr({
+ "aria-selected": "false",
+ "aria-expanded": "false"
+ });
+ // if we're switching panels, remove the old header from the tab order
+ // if we're opening from collapsed state, remove the previous header from the tab order
+ // if we're collapsing, then keep the collapsing header in the tab order
+ if ( toShow.length && toHide.length ) {
+ toHide.prev().attr({
+ "tabIndex": -1,
+ "aria-expanded": "false"
+ });
+ } else if ( toShow.length ) {
+ this.headers.filter(function() {
+ return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
+ })
+ .attr( "tabIndex", -1 );
+ }
+
+ toShow
+ .attr( "aria-hidden", "false" )
+ .prev()
+ .attr({
+ "aria-selected": "true",
+ "aria-expanded": "true",
+ tabIndex: 0
+ });
+ },
+
+ _animate: function( toShow, toHide, data ) {
+ var total, easing, duration,
+ that = this,
+ adjust = 0,
+ boxSizing = toShow.css( "box-sizing" ),
+ down = toShow.length &&
+ ( !toHide.length || ( toShow.index() < toHide.index() ) ),
+ animate = this.options.animate || {},
+ options = down && animate.down || animate,
+ complete = function() {
+ that._toggleComplete( data );
+ };
+
+ if ( typeof options === "number" ) {
+ duration = options;
+ }
+ if ( typeof options === "string" ) {
+ easing = options;
+ }
+ // fall back from options to animation in case of partial down settings
+ easing = easing || options.easing || animate.easing;
+ duration = duration || options.duration || animate.duration;
+
+ if ( !toHide.length ) {
+ return toShow.animate( this.showProps, duration, easing, complete );
+ }
+ if ( !toShow.length ) {
+ return toHide.animate( this.hideProps, duration, easing, complete );
+ }
+
+ total = toShow.show().outerHeight();
+ toHide.animate( this.hideProps, {
+ duration: duration,
+ easing: easing,
+ step: function( now, fx ) {
+ fx.now = Math.round( now );
+ }
+ });
+ toShow
+ .hide()
+ .animate( this.showProps, {
+ duration: duration,
+ easing: easing,
+ complete: complete,
+ step: function( now, fx ) {
+ fx.now = Math.round( now );
+ if ( fx.prop !== "height" ) {
+ if ( boxSizing === "content-box" ) {
+ adjust += fx.now;
+ }
+ } else if ( that.options.heightStyle !== "content" ) {
+ fx.now = Math.round( total - toHide.outerHeight() - adjust );
+ adjust = 0;
+ }
+ }
+ });
+ },
+
+ _toggleComplete: function( data ) {
+ var toHide = data.oldPanel;
+
+ toHide
+ .removeClass( "ui-accordion-content-active" )
+ .prev()
+ .removeClass( "ui-corner-top" )
+ .addClass( "ui-corner-all" );
+
+ // Work around for rendering bug in IE (#5421)
+ if ( toHide.length ) {
+ toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
+ }
+ this._trigger( "activate", null, data );
+ }
+});
+
+
+/*!
+ * jQuery UI Menu 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/menu/
+ */
+
+
+var menu = $.widget( "ui.menu", {
+ version: "1.11.4",
+ defaultElement: "<ul>",
+ delay: 300,
+ options: {
+ icons: {
+ submenu: "ui-icon-carat-1-e"
+ },
+ items: "> *",
+ menus: "ul",
+ position: {
+ my: "left-1 top",
+ at: "right top"
+ },
+ role: "menu",
+
+ // callbacks
+ blur: null,
+ focus: null,
+ select: null
+ },
+
+ _create: function() {
+ this.activeMenu = this.element;
+
+ // Flag used to prevent firing of the click handler
+ // as the event bubbles up through nested menus
+ this.mouseHandled = false;
+ this.element
+ .uniqueId()
+ .addClass( "ui-menu ui-widget ui-widget-content" )
+ .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
+ .attr({
+ role: this.options.role,
+ tabIndex: 0
+ });
+
+ if ( this.options.disabled ) {
+ this.element
+ .addClass( "ui-state-disabled" )
+ .attr( "aria-disabled", "true" );
+ }
+
+ this._on({
+ // Prevent focus from sticking to links inside menu after clicking
+ // them (focus should always stay on UL during navigation).
+ "mousedown .ui-menu-item": function( event ) {
+ event.preventDefault();
+ },
+ "click .ui-menu-item": function( event ) {
+ var target = $( event.target );
+ if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
+ this.select( event );
+
+ // Only set the mouseHandled flag if the event will bubble, see #9469.
+ if ( !event.isPropagationStopped() ) {
+ this.mouseHandled = true;
+ }
+
+ // Open submenu on click
+ if ( target.has( ".ui-menu" ).length ) {
+ this.expand( event );
+ } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) {
+
+ // Redirect focus to the menu
+ this.element.trigger( "focus", [ true ] );
+
+ // If the active item is on the top level, let it stay active.
+ // Otherwise, blur the active item since it is no longer visible.
+ if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
+ clearTimeout( this.timer );
+ }
+ }
+ }
+ },
+ "mouseenter .ui-menu-item": function( event ) {
+ // Ignore mouse events while typeahead is active, see #10458.
+ // Prevents focusing the wrong item when typeahead causes a scroll while the mouse
+ // is over an item in the menu
+ if ( this.previousFilter ) {
+ return;
+ }
+ var target = $( event.currentTarget );
+ // Remove ui-state-active class from siblings of the newly focused menu item
+ // to avoid a jump caused by adjacent elements both having a class with a border
+ target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" );
+ this.focus( event, target );
+ },
+ mouseleave: "collapseAll",
+ "mouseleave .ui-menu": "collapseAll",
+ focus: function( event, keepActiveItem ) {
+ // If there's already an active item, keep it active
+ // If not, activate the first item
+ var item = this.active || this.element.find( this.options.items ).eq( 0 );
+
+ if ( !keepActiveItem ) {
+ this.focus( event, item );
+ }
+ },
+ blur: function( event ) {
+ this._delay(function() {
+ if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
+ this.collapseAll( event );
+ }
+ });
+ },
+ keydown: "_keydown"
+ });
+
+ this.refresh();
+
+ // Clicks outside of a menu collapse any open menus
+ this._on( this.document, {
+ click: function( event ) {
+ if ( this._closeOnDocumentClick( event ) ) {
+ this.collapseAll( event );
+ }
+
+ // Reset the mouseHandled flag
+ this.mouseHandled = false;
+ }
+ });
+ },
+
+ _destroy: function() {
+ // Destroy (sub)menus
+ this.element
+ .removeAttr( "aria-activedescendant" )
+ .find( ".ui-menu" ).addBack()
+ .removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" )
+ .removeAttr( "role" )
+ .removeAttr( "tabIndex" )
+ .removeAttr( "aria-labelledby" )
+ .removeAttr( "aria-expanded" )
+ .removeAttr( "aria-hidden" )
+ .removeAttr( "aria-disabled" )
+ .removeUniqueId()
+ .show();
+
+ // Destroy menu items
+ this.element.find( ".ui-menu-item" )
+ .removeClass( "ui-menu-item" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-disabled" )
+ .removeUniqueId()
+ .removeClass( "ui-state-hover" )
+ .removeAttr( "tabIndex" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-haspopup" )
+ .children().each( function() {
+ var elem = $( this );
+ if ( elem.data( "ui-menu-submenu-carat" ) ) {
+ elem.remove();
+ }
+ });
+
+ // Destroy menu dividers
+ this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
+ },
+
+ _keydown: function( event ) {
+ var match, prev, character, skip,
+ preventDefault = true;
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.PAGE_UP:
+ this.previousPage( event );
+ break;
+ case $.ui.keyCode.PAGE_DOWN:
+ this.nextPage( event );
+ break;
+ case $.ui.keyCode.HOME:
+ this._move( "first", "first", event );
+ break;
+ case $.ui.keyCode.END:
+ this._move( "last", "last", event );
+ break;
+ case $.ui.keyCode.UP:
+ this.previous( event );
+ break;
+ case $.ui.keyCode.DOWN:
+ this.next( event );
+ break;
+ case $.ui.keyCode.LEFT:
+ this.collapse( event );
+ break;
+ case $.ui.keyCode.RIGHT:
+ if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
+ this.expand( event );
+ }
+ break;
+ case $.ui.keyCode.ENTER:
+ case $.ui.keyCode.SPACE:
+ this._activate( event );
+ break;
+ case $.ui.keyCode.ESCAPE:
+ this.collapse( event );
+ break;
+ default:
+ preventDefault = false;
+ prev = this.previousFilter || "";
+ character = String.fromCharCode( event.keyCode );
+ skip = false;
+
+ clearTimeout( this.filterTimer );
+
+ if ( character === prev ) {
+ skip = true;
+ } else {
+ character = prev + character;
+ }
+
+ match = this._filterMenuItems( character );
+ match = skip && match.index( this.active.next() ) !== -1 ?
+ this.active.nextAll( ".ui-menu-item" ) :
+ match;
+
+ // If no matches on the current filter, reset to the last character pressed
+ // to move down the menu to the first item that starts with that character
+ if ( !match.length ) {
+ character = String.fromCharCode( event.keyCode );
+ match = this._filterMenuItems( character );
+ }
+
+ if ( match.length ) {
+ this.focus( event, match );
+ this.previousFilter = character;
+ this.filterTimer = this._delay(function() {
+ delete this.previousFilter;
+ }, 1000 );
+ } else {
+ delete this.previousFilter;
+ }
+ }
+
+ if ( preventDefault ) {
+ event.preventDefault();
+ }
+ },
+
+ _activate: function( event ) {
+ if ( !this.active.is( ".ui-state-disabled" ) ) {
+ if ( this.active.is( "[aria-haspopup='true']" ) ) {
+ this.expand( event );
+ } else {
+ this.select( event );
+ }
+ }
+ },
+
+ refresh: function() {
+ var menus, items,
+ that = this,
+ icon = this.options.icons.submenu,
+ submenus = this.element.find( this.options.menus );
+
+ this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
+
+ // Initialize nested menus
+ submenus.filter( ":not(.ui-menu)" )
+ .addClass( "ui-menu ui-widget ui-widget-content ui-front" )
+ .hide()
+ .attr({
+ role: this.options.role,
+ "aria-hidden": "true",
+ "aria-expanded": "false"
+ })
+ .each(function() {
+ var menu = $( this ),
+ item = menu.parent(),
+ submenuCarat = $( "<span>" )
+ .addClass( "ui-menu-icon ui-icon " + icon )
+ .data( "ui-menu-submenu-carat", true );
+
+ item
+ .attr( "aria-haspopup", "true" )
+ .prepend( submenuCarat );
+ menu.attr( "aria-labelledby", item.attr( "id" ) );
+ });
+
+ menus = submenus.add( this.element );
+ items = menus.find( this.options.items );
+
+ // Initialize menu-items containing spaces and/or dashes only as dividers
+ items.not( ".ui-menu-item" ).each(function() {
+ var item = $( this );
+ if ( that._isDivider( item ) ) {
+ item.addClass( "ui-widget-content ui-menu-divider" );
+ }
+ });
+
+ // Don't refresh list items that are already adapted
+ items.not( ".ui-menu-item, .ui-menu-divider" )
+ .addClass( "ui-menu-item" )
+ .uniqueId()
+ .attr({
+ tabIndex: -1,
+ role: this._itemRole()
+ });
+
+ // Add aria-disabled attribute to any disabled menu item
+ items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
+
+ // If the active item has been removed, blur the menu
+ if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
+ this.blur();
+ }
+ },
+
+ _itemRole: function() {
+ return {
+ menu: "menuitem",
+ listbox: "option"
+ }[ this.options.role ];
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "icons" ) {
+ this.element.find( ".ui-menu-icon" )
+ .removeClass( this.options.icons.submenu )
+ .addClass( value.submenu );
+ }
+ if ( key === "disabled" ) {
+ this.element
+ .toggleClass( "ui-state-disabled", !!value )
+ .attr( "aria-disabled", value );
+ }
+ this._super( key, value );
+ },
+
+ focus: function( event, item ) {
+ var nested, focused;
+ this.blur( event, event && event.type === "focus" );
+
+ this._scrollIntoView( item );
+
+ this.active = item.first();
+ focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" );
+ // Only update aria-activedescendant if there's a role
+ // otherwise we assume focus is managed elsewhere
+ if ( this.options.role ) {
+ this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
+ }
+
+ // Highlight active parent menu item, if any
+ this.active
+ .parent()
+ .closest( ".ui-menu-item" )
+ .addClass( "ui-state-active" );
+
+ if ( event && event.type === "keydown" ) {
+ this._close();
+ } else {
+ this.timer = this._delay(function() {
+ this._close();
+ }, this.delay );
+ }
+
+ nested = item.children( ".ui-menu" );
+ if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
+ this._startOpening(nested);
+ }
+ this.activeMenu = item.parent();
+
+ this._trigger( "focus", event, { item: item } );
+ },
+
+ _scrollIntoView: function( item ) {
+ var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
+ if ( this._hasScroll() ) {
+ borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
+ paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
+ offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
+ scroll = this.activeMenu.scrollTop();
+ elementHeight = this.activeMenu.height();
+ itemHeight = item.outerHeight();
+
+ if ( offset < 0 ) {
+ this.activeMenu.scrollTop( scroll + offset );
+ } else if ( offset + itemHeight > elementHeight ) {
+ this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
+ }
+ }
+ },
+
+ blur: function( event, fromFocus ) {
+ if ( !fromFocus ) {
+ clearTimeout( this.timer );
+ }
+
+ if ( !this.active ) {
+ return;
+ }
+
+ this.active.removeClass( "ui-state-focus" );
+ this.active = null;
+
+ this._trigger( "blur", event, { item: this.active } );
+ },
+
+ _startOpening: function( submenu ) {
+ clearTimeout( this.timer );
+
+ // Don't open if already open fixes a Firefox bug that caused a .5 pixel
+ // shift in the submenu position when mousing over the carat icon
+ if ( submenu.attr( "aria-hidden" ) !== "true" ) {
+ return;
+ }
+
+ this.timer = this._delay(function() {
+ this._close();
+ this._open( submenu );
+ }, this.delay );
+ },
+
+ _open: function( submenu ) {
+ var position = $.extend({
+ of: this.active
+ }, this.options.position );
+
+ clearTimeout( this.timer );
+ this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
+ .hide()
+ .attr( "aria-hidden", "true" );
+
+ submenu
+ .show()
+ .removeAttr( "aria-hidden" )
+ .attr( "aria-expanded", "true" )
+ .position( position );
+ },
+
+ collapseAll: function( event, all ) {
+ clearTimeout( this.timer );
+ this.timer = this._delay(function() {
+ // If we were passed an event, look for the submenu that contains the event
+ var currentMenu = all ? this.element :
+ $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
+
+ // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
+ if ( !currentMenu.length ) {
+ currentMenu = this.element;
+ }
+
+ this._close( currentMenu );
+
+ this.blur( event );
+ this.activeMenu = currentMenu;
+ }, this.delay );
+ },
+
+ // With no arguments, closes the currently active menu - if nothing is active
+ // it closes all menus. If passed an argument, it will search for menus BELOW
+ _close: function( startMenu ) {
+ if ( !startMenu ) {
+ startMenu = this.active ? this.active.parent() : this.element;
+ }
+
+ startMenu
+ .find( ".ui-menu" )
+ .hide()
+ .attr( "aria-hidden", "true" )
+ .attr( "aria-expanded", "false" )
+ .end()
+ .find( ".ui-state-active" ).not( ".ui-state-focus" )
+ .removeClass( "ui-state-active" );
+ },
+
+ _closeOnDocumentClick: function( event ) {
+ return !$( event.target ).closest( ".ui-menu" ).length;
+ },
+
+ _isDivider: function( item ) {
+
+ // Match hyphen, em dash, en dash
+ return !/[^\-\u2014\u2013\s]/.test( item.text() );
+ },
+
+ collapse: function( event ) {
+ var newItem = this.active &&
+ this.active.parent().closest( ".ui-menu-item", this.element );
+ if ( newItem && newItem.length ) {
+ this._close();
+ this.focus( event, newItem );
+ }
+ },
+
+ expand: function( event ) {
+ var newItem = this.active &&
+ this.active
+ .children( ".ui-menu " )
+ .find( this.options.items )
+ .first();
+
+ if ( newItem && newItem.length ) {
+ this._open( newItem.parent() );
+
+ // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
+ this._delay(function() {
+ this.focus( event, newItem );
+ });
+ }
+ },
+
+ next: function( event ) {
+ this._move( "next", "first", event );
+ },
+
+ previous: function( event ) {
+ this._move( "prev", "last", event );
+ },
+
+ isFirstItem: function() {
+ return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
+ },
+
+ isLastItem: function() {
+ return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
+ },
+
+ _move: function( direction, filter, event ) {
+ var next;
+ if ( this.active ) {
+ if ( direction === "first" || direction === "last" ) {
+ next = this.active
+ [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
+ .eq( -1 );
+ } else {
+ next = this.active
+ [ direction + "All" ]( ".ui-menu-item" )
+ .eq( 0 );
+ }
+ }
+ if ( !next || !next.length || !this.active ) {
+ next = this.activeMenu.find( this.options.items )[ filter ]();
+ }
+
+ this.focus( event, next );
+ },
+
+ nextPage: function( event ) {
+ var item, base, height;
+
+ if ( !this.active ) {
+ this.next( event );
+ return;
+ }
+ if ( this.isLastItem() ) {
+ return;
+ }
+ if ( this._hasScroll() ) {
+ base = this.active.offset().top;
+ height = this.element.height();
+ this.active.nextAll( ".ui-menu-item" ).each(function() {
+ item = $( this );
+ return item.offset().top - base - height < 0;
+ });
+
+ this.focus( event, item );
+ } else {
+ this.focus( event, this.activeMenu.find( this.options.items )
+ [ !this.active ? "first" : "last" ]() );
+ }
+ },
+
+ previousPage: function( event ) {
+ var item, base, height;
+ if ( !this.active ) {
+ this.next( event );
+ return;
+ }
+ if ( this.isFirstItem() ) {
+ return;
+ }
+ if ( this._hasScroll() ) {
+ base = this.active.offset().top;
+ height = this.element.height();
+ this.active.prevAll( ".ui-menu-item" ).each(function() {
+ item = $( this );
+ return item.offset().top - base + height > 0;
+ });
+
+ this.focus( event, item );
+ } else {
+ this.focus( event, this.activeMenu.find( this.options.items ).first() );
+ }
+ },
+
+ _hasScroll: function() {
+ return this.element.outerHeight() < this.element.prop( "scrollHeight" );
+ },
+
+ select: function( event ) {
+ // TODO: It should never be possible to not have an active item at this
+ // point, but the tests don't trigger mouseenter before click.
+ this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
+ var ui = { item: this.active };
+ if ( !this.active.has( ".ui-menu" ).length ) {
+ this.collapseAll( event, true );
+ }
+ this._trigger( "select", event, ui );
+ },
+
+ _filterMenuItems: function(character) {
+ var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
+ regex = new RegExp( "^" + escapedCharacter, "i" );
+
+ return this.activeMenu
+ .find( this.options.items )
+
+ // Only match on items, not dividers or other content (#10571)
+ .filter( ".ui-menu-item" )
+ .filter(function() {
+ return regex.test( $.trim( $( this ).text() ) );
+ });
+ }
+});
+
+
+/*!
+ * jQuery UI Autocomplete 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/autocomplete/
+ */
+
+
+$.widget( "ui.autocomplete", {
+ version: "1.11.4",
+ defaultElement: "<input>",
+ options: {
+ appendTo: null,
+ autoFocus: false,
+ delay: 300,
+ minLength: 1,
+ position: {
+ my: "left top",
+ at: "left bottom",
+ collision: "none"
+ },
+ source: null,
+
+ // callbacks
+ change: null,
+ close: null,
+ focus: null,
+ open: null,
+ response: null,
+ search: null,
+ select: null
+ },
+
+ requestIndex: 0,
+ pending: 0,
+
+ _create: function() {
+ // Some browsers only repeat keydown events, not keypress events,
+ // so we use the suppressKeyPress flag to determine if we've already
+ // handled the keydown event. #7269
+ // Unfortunately the code for & in keypress is the same as the up arrow,
+ // so we use the suppressKeyPressRepeat flag to avoid handling keypress
+ // events when we know the keydown event was used to modify the
+ // search term. #7799
+ var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
+ nodeName = this.element[ 0 ].nodeName.toLowerCase(),
+ isTextarea = nodeName === "textarea",
+ isInput = nodeName === "input";
+
+ this.isMultiLine =
+ // Textareas are always multi-line
+ isTextarea ? true :
+ // Inputs are always single-line, even if inside a contentEditable element
+ // IE also treats inputs as contentEditable
+ isInput ? false :
+ // All other element types are determined by whether or not they're contentEditable
+ this.element.prop( "isContentEditable" );
+
+ this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
+ this.isNewMenu = true;
+
+ this.element
+ .addClass( "ui-autocomplete-input" )
+ .attr( "autocomplete", "off" );
+
+ this._on( this.element, {
+ keydown: function( event ) {
+ if ( this.element.prop( "readOnly" ) ) {
+ suppressKeyPress = true;
+ suppressInput = true;
+ suppressKeyPressRepeat = true;
+ return;
+ }
+
+ suppressKeyPress = false;
+ suppressInput = false;
+ suppressKeyPressRepeat = false;
+ var keyCode = $.ui.keyCode;
+ switch ( event.keyCode ) {
+ case keyCode.PAGE_UP:
+ suppressKeyPress = true;
+ this._move( "previousPage", event );
+ break;
+ case keyCode.PAGE_DOWN:
+ suppressKeyPress = true;
+ this._move( "nextPage", event );
+ break;
+ case keyCode.UP:
+ suppressKeyPress = true;
+ this._keyEvent( "previous", event );
+ break;
+ case keyCode.DOWN:
+ suppressKeyPress = true;
+ this._keyEvent( "next", event );
+ break;
+ case keyCode.ENTER:
+ // when menu is open and has focus
+ if ( this.menu.active ) {
+ // #6055 - Opera still allows the keypress to occur
+ // which causes forms to submit
+ suppressKeyPress = true;
+ event.preventDefault();
+ this.menu.select( event );
+ }
+ break;
+ case keyCode.TAB:
+ if ( this.menu.active ) {
+ this.menu.select( event );
+ }
+ break;
+ case keyCode.ESCAPE:
+ if ( this.menu.element.is( ":visible" ) ) {
+ if ( !this.isMultiLine ) {
+ this._value( this.term );
+ }
+ this.close( event );
+ // Different browsers have different default behavior for escape
+ // Single press can mean undo or clear
+ // Double press in IE means clear the whole form
+ event.preventDefault();
+ }
+ break;
+ default:
+ suppressKeyPressRepeat = true;
+ // search timeout should be triggered before the input value is changed
+ this._searchTimeout( event );
+ break;
+ }
+ },
+ keypress: function( event ) {
+ if ( suppressKeyPress ) {
+ suppressKeyPress = false;
+ if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
+ event.preventDefault();
+ }
+ return;
+ }
+ if ( suppressKeyPressRepeat ) {
+ return;
+ }
+
+ // replicate some key handlers to allow them to repeat in Firefox and Opera
+ var keyCode = $.ui.keyCode;
+ switch ( event.keyCode ) {
+ case keyCode.PAGE_UP:
+ this._move( "previousPage", event );
+ break;
+ case keyCode.PAGE_DOWN:
+ this._move( "nextPage", event );
+ break;
+ case keyCode.UP:
+ this._keyEvent( "previous", event );
+ break;
+ case keyCode.DOWN:
+ this._keyEvent( "next", event );
+ break;
+ }
+ },
+ input: function( event ) {
+ if ( suppressInput ) {
+ suppressInput = false;
+ event.preventDefault();
+ return;
+ }
+ this._searchTimeout( event );
+ },
+ focus: function() {
+ this.selectedItem = null;
+ this.previous = this._value();
+ },
+ blur: function( event ) {
+ if ( this.cancelBlur ) {
+ delete this.cancelBlur;
+ return;
+ }
+
+ clearTimeout( this.searching );
+ this.close( event );
+ this._change( event );
+ }
+ });
+
+ this._initSource();
+ this.menu = $( "<ul>" )
+ .addClass( "ui-autocomplete ui-front" )
+ .appendTo( this._appendTo() )
+ .menu({
+ // disable ARIA support, the live region takes care of that
+ role: null
+ })
+ .hide()
+ .menu( "instance" );
+
+ this._on( this.menu.element, {
+ mousedown: function( event ) {
+ // prevent moving focus out of the text field
+ event.preventDefault();
+
+ // IE doesn't prevent moving focus even with event.preventDefault()
+ // so we set a flag to know when we should ignore the blur event
+ this.cancelBlur = true;
+ this._delay(function() {
+ delete this.cancelBlur;
+ });
+
+ // clicking on the scrollbar causes focus to shift to the body
+ // but we can't detect a mouseup or a click immediately afterward
+ // so we have to track the next mousedown and close the menu if
+ // the user clicks somewhere outside of the autocomplete
+ var menuElement = this.menu.element[ 0 ];
+ if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
+ this._delay(function() {
+ var that = this;
+ this.document.one( "mousedown", function( event ) {
+ if ( event.target !== that.element[ 0 ] &&
+ event.target !== menuElement &&
+ !$.contains( menuElement, event.target ) ) {
+ that.close();
+ }
+ });
+ });
+ }
+ },
+ menufocus: function( event, ui ) {
+ var label, item;
+ // support: Firefox
+ // Prevent accidental activation of menu items in Firefox (#7024 #9118)
+ if ( this.isNewMenu ) {
+ this.isNewMenu = false;
+ if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
+ this.menu.blur();
+
+ this.document.one( "mousemove", function() {
+ $( event.target ).trigger( event.originalEvent );
+ });
+
+ return;
+ }
+ }
+
+ item = ui.item.data( "ui-autocomplete-item" );
+ if ( false !== this._trigger( "focus", event, { item: item } ) ) {
+ // use value to match what will end up in the input, if it was a key event
+ if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
+ this._value( item.value );
+ }
+ }
+
+ // Announce the value in the liveRegion
+ label = ui.item.attr( "aria-label" ) || item.value;
+ if ( label && $.trim( label ).length ) {
+ this.liveRegion.children().hide();
+ $( "<div>" ).text( label ).appendTo( this.liveRegion );
+ }
+ },
+ menuselect: function( event, ui ) {
+ var item = ui.item.data( "ui-autocomplete-item" ),
+ previous = this.previous;
+
+ // only trigger when focus was lost (click on menu)
+ if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) {
+ this.element.focus();
+ this.previous = previous;
+ // #6109 - IE triggers two focus events and the second
+ // is asynchronous, so we need to reset the previous
+ // term synchronously and asynchronously :-(
+ this._delay(function() {
+ this.previous = previous;
+ this.selectedItem = item;
+ });
+ }
+
+ if ( false !== this._trigger( "select", event, { item: item } ) ) {
+ this._value( item.value );
+ }
+ // reset the term after the select event
+ // this allows custom select handling to work properly
+ this.term = this._value();
+
+ this.close( event );
+ this.selectedItem = item;
+ }
+ });
+
+ this.liveRegion = $( "<span>", {
+ role: "status",
+ "aria-live": "assertive",
+ "aria-relevant": "additions"
+ })
+ .addClass( "ui-helper-hidden-accessible" )
+ .appendTo( this.document[ 0 ].body );
+
+ // turning off autocomplete prevents the browser from remembering the
+ // value when navigating through history, so we re-enable autocomplete
+ // if the page is unloaded before the widget is destroyed. #7790
+ this._on( this.window, {
+ beforeunload: function() {
+ this.element.removeAttr( "autocomplete" );
+ }
+ });
+ },
+
+ _destroy: function() {
+ clearTimeout( this.searching );
+ this.element
+ .removeClass( "ui-autocomplete-input" )
+ .removeAttr( "autocomplete" );
+ this.menu.element.remove();
+ this.liveRegion.remove();
+ },
+
+ _setOption: function( key, value ) {
+ this._super( key, value );
+ if ( key === "source" ) {
+ this._initSource();
+ }
+ if ( key === "appendTo" ) {
+ this.menu.element.appendTo( this._appendTo() );
+ }
+ if ( key === "disabled" && value && this.xhr ) {
+ this.xhr.abort();
+ }
+ },
+
+ _appendTo: function() {
+ var element = this.options.appendTo;
+
+ if ( element ) {
+ element = element.jquery || element.nodeType ?
+ $( element ) :
+ this.document.find( element ).eq( 0 );
+ }
+
+ if ( !element || !element[ 0 ] ) {
+ element = this.element.closest( ".ui-front" );
+ }
+
+ if ( !element.length ) {
+ element = this.document[ 0 ].body;
+ }
+
+ return element;
+ },
+
+ _initSource: function() {
+ var array, url,
+ that = this;
+ if ( $.isArray( this.options.source ) ) {
+ array = this.options.source;
+ this.source = function( request, response ) {
+ response( $.ui.autocomplete.filter( array, request.term ) );
+ };
+ } else if ( typeof this.options.source === "string" ) {
+ url = this.options.source;
+ this.source = function( request, response ) {
+ if ( that.xhr ) {
+ that.xhr.abort();
+ }
+ that.xhr = $.ajax({
+ url: url,
+ data: request,
+ dataType: "json",
+ success: function( data ) {
+ response( data );
+ },
+ error: function() {
+ response([]);
+ }
+ });
+ };
+ } else {
+ this.source = this.options.source;
+ }
+ },
+
+ _searchTimeout: function( event ) {
+ clearTimeout( this.searching );
+ this.searching = this._delay(function() {
+
+ // Search if the value has changed, or if the user retypes the same value (see #7434)
+ var equalValues = this.term === this._value(),
+ menuVisible = this.menu.element.is( ":visible" ),
+ modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
+
+ if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
+ this.selectedItem = null;
+ this.search( null, event );
+ }
+ }, this.options.delay );
+ },
+
+ search: function( value, event ) {
+ value = value != null ? value : this._value();
+
+ // always save the actual value, not the one passed as an argument
+ this.term = this._value();
+
+ if ( value.length < this.options.minLength ) {
+ return this.close( event );
+ }
+
+ if ( this._trigger( "search", event ) === false ) {
+ return;
+ }
+
+ return this._search( value );
+ },
+
+ _search: function( value ) {
+ this.pending++;
+ this.element.addClass( "ui-autocomplete-loading" );
+ this.cancelSearch = false;
+
+ this.source( { term: value }, this._response() );
+ },
+
+ _response: function() {
+ var index = ++this.requestIndex;
+
+ return $.proxy(function( content ) {
+ if ( index === this.requestIndex ) {
+ this.__response( content );
+ }
+
+ this.pending--;
+ if ( !this.pending ) {
+ this.element.removeClass( "ui-autocomplete-loading" );
+ }
+ }, this );
+ },
+
+ __response: function( content ) {
+ if ( content ) {
+ content = this._normalize( content );
+ }
+ this._trigger( "response", null, { content: content } );
+ if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
+ this._suggest( content );
+ this._trigger( "open" );
+ } else {
+ // use ._close() instead of .close() so we don't cancel future searches
+ this._close();
+ }
+ },
+
+ close: function( event ) {
+ this.cancelSearch = true;
+ this._close( event );
+ },
+
+ _close: function( event ) {
+ if ( this.menu.element.is( ":visible" ) ) {
+ this.menu.element.hide();
+ this.menu.blur();
+ this.isNewMenu = true;
+ this._trigger( "close", event );
+ }
+ },
+
+ _change: function( event ) {
+ if ( this.previous !== this._value() ) {
+ this._trigger( "change", event, { item: this.selectedItem } );
+ }
+ },
+
+ _normalize: function( items ) {
+ // assume all items have the right format when the first item is complete
+ if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
+ return items;
+ }
+ return $.map( items, function( item ) {
+ if ( typeof item === "string" ) {
+ return {
+ label: item,
+ value: item
+ };
+ }
+ return $.extend( {}, item, {
+ label: item.label || item.value,
+ value: item.value || item.label
+ });
+ });
+ },
+
+ _suggest: function( items ) {
+ var ul = this.menu.element.empty();
+ this._renderMenu( ul, items );
+ this.isNewMenu = true;
+ this.menu.refresh();
+
+ // size and position menu
+ ul.show();
+ this._resizeMenu();
+ ul.position( $.extend({
+ of: this.element
+ }, this.options.position ) );
+
+ if ( this.options.autoFocus ) {
+ this.menu.next();
+ }
+ },
+
+ _resizeMenu: function() {
+ var ul = this.menu.element;
+ ul.outerWidth( Math.max(
+ // Firefox wraps long text (possibly a rounding bug)
+ // so we add 1px to avoid the wrapping (#7513)
+ ul.width( "" ).outerWidth() + 1,
+ this.element.outerWidth()
+ ) );
+ },
+
+ _renderMenu: function( ul, items ) {
+ var that = this;
+ $.each( items, function( index, item ) {
+ that._renderItemData( ul, item );
+ });
+ },
+
+ _renderItemData: function( ul, item ) {
+ return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
+ },
+
+ _renderItem: function( ul, item ) {
+ return $( "<li>" ).text( item.label ).appendTo( ul );
+ },
+
+ _move: function( direction, event ) {
+ if ( !this.menu.element.is( ":visible" ) ) {
+ this.search( null, event );
+ return;
+ }
+ if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
+ this.menu.isLastItem() && /^next/.test( direction ) ) {
+
+ if ( !this.isMultiLine ) {
+ this._value( this.term );
+ }
+
+ this.menu.blur();
+ return;
+ }
+ this.menu[ direction ]( event );
+ },
+
+ widget: function() {
+ return this.menu.element;
+ },
+
+ _value: function() {
+ return this.valueMethod.apply( this.element, arguments );
+ },
+
+ _keyEvent: function( keyEvent, event ) {
+ if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
+ this._move( keyEvent, event );
+
+ // prevents moving cursor to beginning/end of the text field in some browsers
+ event.preventDefault();
+ }
+ }
+});
+
+$.extend( $.ui.autocomplete, {
+ escapeRegex: function( value ) {
+ return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
+ },
+ filter: function( array, term ) {
+ var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
+ return $.grep( array, function( value ) {
+ return matcher.test( value.label || value.value || value );
+ });
+ }
+});
+
+// live region extension, adding a `messages` option
+// NOTE: This is an experimental API. We are still investigating
+// a full solution for string manipulation and internationalization.
+$.widget( "ui.autocomplete", $.ui.autocomplete, {
+ options: {
+ messages: {
+ noResults: "No search results.",
+ results: function( amount ) {
+ return amount + ( amount > 1 ? " results are" : " result is" ) +
+ " available, use up and down arrow keys to navigate.";
+ }
+ }
+ },
+
+ __response: function( content ) {
+ var message;
+ this._superApply( arguments );
+ if ( this.options.disabled || this.cancelSearch ) {
+ return;
+ }
+ if ( content && content.length ) {
+ message = this.options.messages.results( content.length );
+ } else {
+ message = this.options.messages.noResults;
+ }
+ this.liveRegion.children().hide();
+ $( "<div>" ).text( message ).appendTo( this.liveRegion );
+ }
+});
+
+var autocomplete = $.ui.autocomplete;
+
+
+/*!
+ * jQuery UI Button 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/button/
+ */
+
+
+var lastActive,
+ baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
+ typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
+ formResetHandler = function() {
+ var form = $( this );
+ setTimeout(function() {
+ form.find( ":ui-button" ).button( "refresh" );
+ }, 1 );
+ },
+ radioGroup = function( radio ) {
+ var name = radio.name,
+ form = radio.form,
+ radios = $( [] );
+ if ( name ) {
+ name = name.replace( /'/g, "\\'" );
+ if ( form ) {
+ radios = $( form ).find( "[name='" + name + "'][type=radio]" );
+ } else {
+ radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument )
+ .filter(function() {
+ return !this.form;
+ });
+ }
+ }
+ return radios;
+ };
+
+$.widget( "ui.button", {
+ version: "1.11.4",
+ defaultElement: "<button>",
+ options: {
+ disabled: null,
+ text: true,
+ label: null,
+ icons: {
+ primary: null,
+ secondary: null
+ }
+ },
+ _create: function() {
+ this.element.closest( "form" )
+ .unbind( "reset" + this.eventNamespace )
+ .bind( "reset" + this.eventNamespace, formResetHandler );
+
+ if ( typeof this.options.disabled !== "boolean" ) {
+ this.options.disabled = !!this.element.prop( "disabled" );
+ } else {
+ this.element.prop( "disabled", this.options.disabled );
+ }
+
+ this._determineButtonType();
+ this.hasTitle = !!this.buttonElement.attr( "title" );
+
+ var that = this,
+ options = this.options,
+ toggleButton = this.type === "checkbox" || this.type === "radio",
+ activeClass = !toggleButton ? "ui-state-active" : "";
+
+ if ( options.label === null ) {
+ options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
+ }
+
+ this._hoverable( this.buttonElement );
+
+ this.buttonElement
+ .addClass( baseClasses )
+ .attr( "role", "button" )
+ .bind( "mouseenter" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return;
+ }
+ if ( this === lastActive ) {
+ $( this ).addClass( "ui-state-active" );
+ }
+ })
+ .bind( "mouseleave" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return;
+ }
+ $( this ).removeClass( activeClass );
+ })
+ .bind( "click" + this.eventNamespace, function( event ) {
+ if ( options.disabled ) {
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ }
+ });
+
+ // Can't use _focusable() because the element that receives focus
+ // and the element that gets the ui-state-focus class are different
+ this._on({
+ focus: function() {
+ this.buttonElement.addClass( "ui-state-focus" );
+ },
+ blur: function() {
+ this.buttonElement.removeClass( "ui-state-focus" );
+ }
+ });
+
+ if ( toggleButton ) {
+ this.element.bind( "change" + this.eventNamespace, function() {
+ that.refresh();
+ });
+ }
+
+ if ( this.type === "checkbox" ) {
+ this.buttonElement.bind( "click" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ });
+ } else if ( this.type === "radio" ) {
+ this.buttonElement.bind( "click" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).addClass( "ui-state-active" );
+ that.buttonElement.attr( "aria-pressed", "true" );
+
+ var radio = that.element[ 0 ];
+ radioGroup( radio )
+ .not( radio )
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ });
+ } else {
+ this.buttonElement
+ .bind( "mousedown" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).addClass( "ui-state-active" );
+ lastActive = this;
+ that.document.one( "mouseup", function() {
+ lastActive = null;
+ });
+ })
+ .bind( "mouseup" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).removeClass( "ui-state-active" );
+ })
+ .bind( "keydown" + this.eventNamespace, function(event) {
+ if ( options.disabled ) {
+ return false;
+ }
+ if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
+ $( this ).addClass( "ui-state-active" );
+ }
+ })
+ // see #8559, we bind to blur here in case the button element loses
+ // focus between keydown and keyup, it would be left in an "active" state
+ .bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {
+ $( this ).removeClass( "ui-state-active" );
+ });
+
+ if ( this.buttonElement.is("a") ) {
+ this.buttonElement.keyup(function(event) {
+ if ( event.keyCode === $.ui.keyCode.SPACE ) {
+ // TODO pass through original event correctly (just as 2nd argument doesn't work)
+ $( this ).click();
+ }
+ });
+ }
+ }
+
+ this._setOption( "disabled", options.disabled );
+ this._resetButton();
+ },
+
+ _determineButtonType: function() {
+ var ancestor, labelSelector, checked;
+
+ if ( this.element.is("[type=checkbox]") ) {
+ this.type = "checkbox";
+ } else if ( this.element.is("[type=radio]") ) {
+ this.type = "radio";
+ } else if ( this.element.is("input") ) {
+ this.type = "input";
+ } else {
+ this.type = "button";
+ }
+
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ // we don't search against the document in case the element
+ // is disconnected from the DOM
+ ancestor = this.element.parents().last();
+ labelSelector = "label[for='" + this.element.attr("id") + "']";
+ this.buttonElement = ancestor.find( labelSelector );
+ if ( !this.buttonElement.length ) {
+ ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
+ this.buttonElement = ancestor.filter( labelSelector );
+ if ( !this.buttonElement.length ) {
+ this.buttonElement = ancestor.find( labelSelector );
+ }
+ }
+ this.element.addClass( "ui-helper-hidden-accessible" );
+
+ checked = this.element.is( ":checked" );
+ if ( checked ) {
+ this.buttonElement.addClass( "ui-state-active" );
+ }
+ this.buttonElement.prop( "aria-pressed", checked );
+ } else {
+ this.buttonElement = this.element;
+ }
+ },
+
+ widget: function() {
+ return this.buttonElement;
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass( "ui-helper-hidden-accessible" );
+ this.buttonElement
+ .removeClass( baseClasses + " ui-state-active " + typeClasses )
+ .removeAttr( "role" )
+ .removeAttr( "aria-pressed" )
+ .html( this.buttonElement.find(".ui-button-text").html() );
+
+ if ( !this.hasTitle ) {
+ this.buttonElement.removeAttr( "title" );
+ }
+ },
+
+ _setOption: function( key, value ) {
+ this._super( key, value );
+ if ( key === "disabled" ) {
+ this.widget().toggleClass( "ui-state-disabled", !!value );
+ this.element.prop( "disabled", !!value );
+ if ( value ) {
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ this.buttonElement.removeClass( "ui-state-focus" );
+ } else {
+ this.buttonElement.removeClass( "ui-state-focus ui-state-active" );
+ }
+ }
+ return;
+ }
+ this._resetButton();
+ },
+
+ refresh: function() {
+ //See #8237 & #8828
+ var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
+
+ if ( isDisabled !== this.options.disabled ) {
+ this._setOption( "disabled", isDisabled );
+ }
+ if ( this.type === "radio" ) {
+ radioGroup( this.element[0] ).each(function() {
+ if ( $( this ).is( ":checked" ) ) {
+ $( this ).button( "widget" )
+ .addClass( "ui-state-active" )
+ .attr( "aria-pressed", "true" );
+ } else {
+ $( this ).button( "widget" )
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ }
+ });
+ } else if ( this.type === "checkbox" ) {
+ if ( this.element.is( ":checked" ) ) {
+ this.buttonElement
+ .addClass( "ui-state-active" )
+ .attr( "aria-pressed", "true" );
+ } else {
+ this.buttonElement
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ }
+ }
+ },
+
+ _resetButton: function() {
+ if ( this.type === "input" ) {
+ if ( this.options.label ) {
+ this.element.val( this.options.label );
+ }
+ return;
+ }
+ var buttonElement = this.buttonElement.removeClass( typeClasses ),
+ buttonText = $( "<span></span>", this.document[0] )
+ .addClass( "ui-button-text" )
+ .html( this.options.label )
+ .appendTo( buttonElement.empty() )
+ .text(),
+ icons = this.options.icons,
+ multipleIcons = icons.primary && icons.secondary,
+ buttonClasses = [];
+
+ if ( icons.primary || icons.secondary ) {
+ if ( this.options.text ) {
+ buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
+ }
+
+ if ( icons.primary ) {
+ buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
+ }
+
+ if ( icons.secondary ) {
+ buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
+ }
+
+ if ( !this.options.text ) {
+ buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
+
+ if ( !this.hasTitle ) {
+ buttonElement.attr( "title", $.trim( buttonText ) );
+ }
+ }
+ } else {
+ buttonClasses.push( "ui-button-text-only" );
+ }
+ buttonElement.addClass( buttonClasses.join( " " ) );
+ }
+});
+
+$.widget( "ui.buttonset", {
+ version: "1.11.4",
+ options: {
+ items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
+ },
+
+ _create: function() {
+ this.element.addClass( "ui-buttonset" );
+ },
+
+ _init: function() {
+ this.refresh();
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "disabled" ) {
+ this.buttons.button( "option", key, value );
+ }
+
+ this._super( key, value );
+ },
+
+ refresh: function() {
+ var rtl = this.element.css( "direction" ) === "rtl",
+ allButtons = this.element.find( this.options.items ),
+ existingButtons = allButtons.filter( ":ui-button" );
+
+ // Initialize new buttons
+ allButtons.not( ":ui-button" ).button();
+
+ // Refresh existing buttons
+ existingButtons.button( "refresh" );
+
+ this.buttons = allButtons
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
+ .filter( ":first" )
+ .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
+ .end()
+ .filter( ":last" )
+ .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
+ .end()
+ .end();
+ },
+
+ _destroy: function() {
+ this.element.removeClass( "ui-buttonset" );
+ this.buttons
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-corner-left ui-corner-right" )
+ .end()
+ .button( "destroy" );
+ }
+});
+
+var button = $.ui.button;
+
+
+/*!
+ * jQuery UI Datepicker 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/datepicker/
+ */
+
+
+$.extend($.ui, { datepicker: { version: "1.11.4" } });
+
+var datepicker_instActive;
+
+function datepicker_getZindex( elem ) {
+ var position, value;
+ while ( elem.length && elem[ 0 ] !== document ) {
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
+ // This makes behavior of this function consistent across browsers
+ // WebKit always returns auto if the element is positioned
+ position = elem.css( "position" );
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
+ // IE returns 0 when zIndex is not specified
+ // other browsers return a string
+ // we ignore the case of nested elements with an explicit value of 0
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
+ value = parseInt( elem.css( "zIndex" ), 10 );
+ if ( !isNaN( value ) && value !== 0 ) {
+ return value;
+ }
+ }
+ elem = elem.parent();
+ }
+
+ return 0;
+}
+/* Date picker manager.
+ Use the singleton instance of this class, $.datepicker, to interact with the date picker.
+ Settings for (groups of) date pickers are maintained in an instance object,
+ allowing multiple different settings on the same page. */
+
+function Datepicker() {
+ this._curInst = null; // The current instance in use
+ this._keyEvent = false; // If the last event was a key event
+ this._disabledInputs = []; // List of date picker inputs that have been disabled
+ this._datepickerShowing = false; // True if the popup picker is showing , false if not
+ this._inDialog = false; // True if showing within a "dialog", false if not
+ this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
+ this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
+ this._appendClass = "ui-datepicker-append"; // The name of the append marker class
+ this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
+ this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
+ this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
+ this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
+ this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
+ this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
+ this.regional = []; // Available regional settings, indexed by language code
+ this.regional[""] = { // Default regional settings
+ closeText: "Done", // Display text for close link
+ prevText: "Prev", // Display text for previous month link
+ nextText: "Next", // Display text for next month link
+ currentText: "Today", // Display text for current month link
+ monthNames: ["January","February","March","April","May","June",
+ "July","August","September","October","November","December"], // Names of months for drop-down and formatting
+ monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting
+ dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting
+ dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting
+ dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], // Column headings for days starting at Sunday
+ weekHeader: "Wk", // Column header for week of the year
+ dateFormat: "mm/dd/yy", // See format options on parseDate
+ firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
+ isRTL: false, // True if right-to-left language, false if left-to-right
+ showMonthAfterYear: false, // True if the year select precedes month, false for month then year
+ yearSuffix: "" // Additional text to append to the year in the month headers
+ };
+ this._defaults = { // Global defaults for all the date picker instances
+ showOn: "focus", // "focus" for popup on focus,
+ // "button" for trigger button, or "both" for either
+ showAnim: "fadeIn", // Name of jQuery animation for popup
+ showOptions: {}, // Options for enhanced animations
+ defaultDate: null, // Used when field is blank: actual date,
+ // +/-number for offset from today, null for today
+ appendText: "", // Display text following the input box, e.g. showing the format
+ buttonText: "...", // Text for trigger button
+ buttonImage: "", // URL for trigger button image
+ buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
+ hideIfNoPrevNext: false, // True to hide next/previous month links
+ // if not applicable, false to just disable them
+ navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
+ gotoCurrent: false, // True if today link goes back to current selection instead
+ changeMonth: false, // True if month can be selected directly, false if only prev/next
+ changeYear: false, // True if year can be selected directly, false if only prev/next
+ yearRange: "c-10:c+10", // Range of years to display in drop-down,
+ // either relative to today's year (-nn:+nn), relative to currently displayed year
+ // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
+ showOtherMonths: false, // True to show dates in other months, false to leave blank
+ selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
+ showWeek: false, // True to show week of the year, false to not show it
+ calculateWeek: this.iso8601Week, // How to calculate the week of the year,
+ // takes a Date and returns the number of the week for it
+ shortYearCutoff: "+10", // Short year values < this are in the current century,
+ // > this are in the previous century,
+ // string value starting with "+" for current year + value
+ minDate: null, // The earliest selectable date, or null for no limit
+ maxDate: null, // The latest selectable date, or null for no limit
+ duration: "fast", // Duration of display/closure
+ beforeShowDay: null, // Function that takes a date and returns an array with
+ // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
+ // [2] = cell title (optional), e.g. $.datepicker.noWeekends
+ beforeShow: null, // Function that takes an input field and
+ // returns a set of custom settings for the date picker
+ onSelect: null, // Define a callback function when a date is selected
+ onChangeMonthYear: null, // Define a callback function when the month or year is changed
+ onClose: null, // Define a callback function when the datepicker is closed
+ numberOfMonths: 1, // Number of months to show at a time
+ showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
+ stepMonths: 1, // Number of months to step back/forward
+ stepBigMonths: 12, // Number of months to step back/forward for the big links
+ altField: "", // Selector for an alternate field to store selected dates into
+ altFormat: "", // The date format to use for the alternate field
+ constrainInput: true, // The input is constrained by the current date format
+ showButtonPanel: false, // True to show button panel, false to not show it
+ autoSize: false, // True to size the input for the date format, false to leave as is
+ disabled: false // The initial disabled state
+ };
+ $.extend(this._defaults, this.regional[""]);
+ this.regional.en = $.extend( true, {}, this.regional[ "" ]);
+ this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
+ this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
+}
+
+$.extend(Datepicker.prototype, {
+ /* Class name added to elements to indicate already configured with a date picker. */
+ markerClassName: "hasDatepicker",
+
+ //Keep track of the maximum number of rows displayed (see #7043)
+ maxRows: 4,
+
+ // TODO rename to "widget" when switching to widget factory
+ _widgetDatepicker: function() {
+ return this.dpDiv;
+ },
+
+ /* Override the default settings for all instances of the date picker.
+ * @param settings object - the new settings to use as defaults (anonymous object)
+ * @return the manager object
+ */
+ setDefaults: function(settings) {
+ datepicker_extendRemove(this._defaults, settings || {});
+ return this;
+ },
+
+ /* Attach the date picker to a jQuery selection.
+ * @param target element - the target input field or division or span
+ * @param settings object - the new settings to use for this date picker instance (anonymous)
+ */
+ _attachDatepicker: function(target, settings) {
+ var nodeName, inline, inst;
+ nodeName = target.nodeName.toLowerCase();
+ inline = (nodeName === "div" || nodeName === "span");
+ if (!target.id) {
+ this.uuid += 1;
+ target.id = "dp" + this.uuid;
+ }
+ inst = this._newInst($(target), inline);
+ inst.settings = $.extend({}, settings || {});
+ if (nodeName === "input") {
+ this._connectDatepicker(target, inst);
+ } else if (inline) {
+ this._inlineDatepicker(target, inst);
+ }
+ },
+
+ /* Create a new instance object. */
+ _newInst: function(target, inline) {
+ var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars
+ return {id: id, input: target, // associated target
+ selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
+ drawMonth: 0, drawYear: 0, // month being drawn
+ inline: inline, // is datepicker inline or not
+ dpDiv: (!inline ? this.dpDiv : // presentation div
+ datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))};
+ },
+
+ /* Attach the date picker to an input field. */
+ _connectDatepicker: function(target, inst) {
+ var input = $(target);
+ inst.append = $([]);
+ inst.trigger = $([]);
+ if (input.hasClass(this.markerClassName)) {
+ return;
+ }
+ this._attachments(input, inst);
+ input.addClass(this.markerClassName).keydown(this._doKeyDown).
+ keypress(this._doKeyPress).keyup(this._doKeyUp);
+ this._autoSize(inst);
+ $.data(target, "datepicker", inst);
+ //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
+ if( inst.settings.disabled ) {
+ this._disableDatepicker( target );
+ }
+ },
+
+ /* Make attachments based on settings. */
+ _attachments: function(input, inst) {
+ var showOn, buttonText, buttonImage,
+ appendText = this._get(inst, "appendText"),
+ isRTL = this._get(inst, "isRTL");
+
+ if (inst.append) {
+ inst.append.remove();
+ }
+ if (appendText) {
+ inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>");
+ input[isRTL ? "before" : "after"](inst.append);
+ }
+
+ input.unbind("focus", this._showDatepicker);
+
+ if (inst.trigger) {
+ inst.trigger.remove();
+ }
+
+ showOn = this._get(inst, "showOn");
+ if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field
+ input.focus(this._showDatepicker);
+ }
+ if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked
+ buttonText = this._get(inst, "buttonText");
+ buttonImage = this._get(inst, "buttonImage");
+ inst.trigger = $(this._get(inst, "buttonImageOnly") ?
+ $("<img/>").addClass(this._triggerClass).
+ attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
+ $("<button type='button'></button>").addClass(this._triggerClass).
+ html(!buttonImage ? buttonText : $("<img/>").attr(
+ { src:buttonImage, alt:buttonText, title:buttonText })));
+ input[isRTL ? "before" : "after"](inst.trigger);
+ inst.trigger.click(function() {
+ if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
+ $.datepicker._hideDatepicker();
+ } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) {
+ $.datepicker._hideDatepicker();
+ $.datepicker._showDatepicker(input[0]);
+ } else {
+ $.datepicker._showDatepicker(input[0]);
+ }
+ return false;
+ });
+ }
+ },
+
+ /* Apply the maximum length for the date format. */
+ _autoSize: function(inst) {
+ if (this._get(inst, "autoSize") && !inst.inline) {
+ var findMax, max, maxI, i,
+ date = new Date(2009, 12 - 1, 20), // Ensure double digits
+ dateFormat = this._get(inst, "dateFormat");
+
+ if (dateFormat.match(/[DM]/)) {
+ findMax = function(names) {
+ max = 0;
+ maxI = 0;
+ for (i = 0; i < names.length; i++) {
+ if (names[i].length > max) {
+ max = names[i].length;
+ maxI = i;
+ }
+ }
+ return maxI;
+ };
+ date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
+ "monthNames" : "monthNamesShort"))));
+ date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
+ "dayNames" : "dayNamesShort"))) + 20 - date.getDay());
+ }
+ inst.input.attr("size", this._formatDate(inst, date).length);
+ }
+ },
+
+ /* Attach an inline date picker to a div. */
+ _inlineDatepicker: function(target, inst) {
+ var divSpan = $(target);
+ if (divSpan.hasClass(this.markerClassName)) {
+ return;
+ }
+ divSpan.addClass(this.markerClassName).append(inst.dpDiv);
+ $.data(target, "datepicker", inst);
+ this._setDate(inst, this._getDefaultDate(inst), true);
+ this._updateDatepicker(inst);
+ this._updateAlternate(inst);
+ //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
+ if( inst.settings.disabled ) {
+ this._disableDatepicker( target );
+ }
+ // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
+ // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
+ inst.dpDiv.css( "display", "block" );
+ },
+
+ /* Pop-up the date picker in a "dialog" box.
+ * @param input element - ignored
+ * @param date string or Date - the initial date to display
+ * @param onSelect function - the function to call when a date is selected
+ * @param settings object - update the dialog date picker instance's settings (anonymous object)
+ * @param pos int[2] - coordinates for the dialog's position within the screen or
+ * event - with x/y coordinates or
+ * leave empty for default (screen centre)
+ * @return the manager object
+ */
+ _dialogDatepicker: function(input, date, onSelect, settings, pos) {
+ var id, browserWidth, browserHeight, scrollX, scrollY,
+ inst = this._dialogInst; // internal instance
+
+ if (!inst) {
+ this.uuid += 1;
+ id = "dp" + this.uuid;
+ this._dialogInput = $("<input type='text' id='" + id +
+ "' style='position: absolute; top: -100px; width: 0px;'/>");
+ this._dialogInput.keydown(this._doKeyDown);
+ $("body").append(this._dialogInput);
+ inst = this._dialogInst = this._newInst(this._dialogInput, false);
+ inst.settings = {};
+ $.data(this._dialogInput[0], "datepicker", inst);
+ }
+ datepicker_extendRemove(inst.settings, settings || {});
+ date = (date && date.constructor === Date ? this._formatDate(inst, date) : date);
+ this._dialogInput.val(date);
+
+ this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
+ if (!this._pos) {
+ browserWidth = document.documentElement.clientWidth;
+ browserHeight = document.documentElement.clientHeight;
+ scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
+ scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+ this._pos = // should use actual width/height below
+ [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
+ }
+
+ // move input on screen for focus, but hidden behind dialog
+ this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px");
+ inst.settings.onSelect = onSelect;
+ this._inDialog = true;
+ this.dpDiv.addClass(this._dialogClass);
+ this._showDatepicker(this._dialogInput[0]);
+ if ($.blockUI) {
+ $.blockUI(this.dpDiv);
+ }
+ $.data(this._dialogInput[0], "datepicker", inst);
+ return this;
+ },
+
+ /* Detach a datepicker from its control.
+ * @param target element - the target input field or division or span
+ */
+ _destroyDatepicker: function(target) {
+ var nodeName,
+ $target = $(target),
+ inst = $.data(target, "datepicker");
+
+ if (!$target.hasClass(this.markerClassName)) {
+ return;
+ }
+
+ nodeName = target.nodeName.toLowerCase();
+ $.removeData(target, "datepicker");
+ if (nodeName === "input") {
+ inst.append.remove();
+ inst.trigger.remove();
+ $target.removeClass(this.markerClassName).
+ unbind("focus", this._showDatepicker).
+ unbind("keydown", this._doKeyDown).
+ unbind("keypress", this._doKeyPress).
+ unbind("keyup", this._doKeyUp);
+ } else if (nodeName === "div" || nodeName === "span") {
+ $target.removeClass(this.markerClassName).empty();
+ }
+
+ if ( datepicker_instActive === inst ) {
+ datepicker_instActive = null;
+ }
+ },
+
+ /* Enable the date picker to a jQuery selection.
+ * @param target element - the target input field or division or span
+ */
+ _enableDatepicker: function(target) {
+ var nodeName, inline,
+ $target = $(target),
+ inst = $.data(target, "datepicker");
+
+ if (!$target.hasClass(this.markerClassName)) {
+ return;
+ }
+
+ nodeName = target.nodeName.toLowerCase();
+ if (nodeName === "input") {
+ target.disabled = false;
+ inst.trigger.filter("button").
+ each(function() { this.disabled = false; }).end().
+ filter("img").css({opacity: "1.0", cursor: ""});
+ } else if (nodeName === "div" || nodeName === "span") {
+ inline = $target.children("." + this._inlineClass);
+ inline.children().removeClass("ui-state-disabled");
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
+ prop("disabled", false);
+ }
+ this._disabledInputs = $.map(this._disabledInputs,
+ function(value) { return (value === target ? null : value); }); // delete entry
+ },
+
+ /* Disable the date picker to a jQuery selection.
+ * @param target element - the target input field or division or span
+ */
+ _disableDatepicker: function(target) {
+ var nodeName, inline,
+ $target = $(target),
+ inst = $.data(target, "datepicker");
+
+ if (!$target.hasClass(this.markerClassName)) {
+ return;
+ }
+
+ nodeName = target.nodeName.toLowerCase();
+ if (nodeName === "input") {
+ target.disabled = true;
+ inst.trigger.filter("button").
+ each(function() { this.disabled = true; }).end().
+ filter("img").css({opacity: "0.5", cursor: "default"});
+ } else if (nodeName === "div" || nodeName === "span") {
+ inline = $target.children("." + this._inlineClass);
+ inline.children().addClass("ui-state-disabled");
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
+ prop("disabled", true);
+ }
+ this._disabledInputs = $.map(this._disabledInputs,
+ function(value) { return (value === target ? null : value); }); // delete entry
+ this._disabledInputs[this._disabledInputs.length] = target;
+ },
+
+ /* Is the first field in a jQuery collection disabled as a datepicker?
+ * @param target element - the target input field or division or span
+ * @return boolean - true if disabled, false if enabled
+ */
+ _isDisabledDatepicker: function(target) {
+ if (!target) {
+ return false;
+ }
+ for (var i = 0; i < this._disabledInputs.length; i++) {
+ if (this._disabledInputs[i] === target) {
+ return true;
+ }
+ }
+ return false;
+ },
+
+ /* Retrieve the instance data for the target control.
+ * @param target element - the target input field or division or span
+ * @return object - the associated instance data
+ * @throws error if a jQuery problem getting data
+ */
+ _getInst: function(target) {
+ try {
+ return $.data(target, "datepicker");
+ }
+ catch (err) {
+ throw "Missing instance data for this datepicker";
+ }
+ },
+
+ /* Update or retrieve the settings for a date picker attached to an input field or division.
+ * @param target element - the target input field or division or span
+ * @param name object - the new settings to update or
+ * string - the name of the setting to change or retrieve,
+ * when retrieving also "all" for all instance settings or
+ * "defaults" for all global defaults
+ * @param value any - the new value for the setting
+ * (omit if above is an object or to retrieve a value)
+ */
+ _optionDatepicker: function(target, name, value) {
+ var settings, date, minDate, maxDate,
+ inst = this._getInst(target);
+
+ if (arguments.length === 2 && typeof name === "string") {
+ return (name === "defaults" ? $.extend({}, $.datepicker._defaults) :
+ (inst ? (name === "all" ? $.extend({}, inst.settings) :
+ this._get(inst, name)) : null));
+ }
+
+ settings = name || {};
+ if (typeof name === "string") {
+ settings = {};
+ settings[name] = value;
+ }
+
+ if (inst) {
+ if (this._curInst === inst) {
+ this._hideDatepicker();
+ }
+
+ date = this._getDateDatepicker(target, true);
+ minDate = this._getMinMaxDate(inst, "min");
+ maxDate = this._getMinMaxDate(inst, "max");
+ datepicker_extendRemove(inst.settings, settings);
+ // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
+ if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
+ inst.settings.minDate = this._formatDate(inst, minDate);
+ }
+ if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
+ inst.settings.maxDate = this._formatDate(inst, maxDate);
+ }
+ if ( "disabled" in settings ) {
+ if ( settings.disabled ) {
+ this._disableDatepicker(target);
+ } else {
+ this._enableDatepicker(target);
+ }
+ }
+ this._attachments($(target), inst);
+ this._autoSize(inst);
+ this._setDate(inst, date);
+ this._updateAlternate(inst);
+ this._updateDatepicker(inst);
+ }
+ },
+
+ // change method deprecated
+ _changeDatepicker: function(target, name, value) {
+ this._optionDatepicker(target, name, value);
+ },
+
+ /* Redraw the date picker attached to an input field or division.
+ * @param target element - the target input field or division or span
+ */
+ _refreshDatepicker: function(target) {
+ var inst = this._getInst(target);
+ if (inst) {
+ this._updateDatepicker(inst);
+ }
+ },
+
+ /* Set the dates for a jQuery selection.
+ * @param target element - the target input field or division or span
+ * @param date Date - the new date
+ */
+ _setDateDatepicker: function(target, date) {
+ var inst = this._getInst(target);
+ if (inst) {
+ this._setDate(inst, date);
+ this._updateDatepicker(inst);
+ this._updateAlternate(inst);
+ }
+ },
+
+ /* Get the date(s) for the first entry in a jQuery selection.
+ * @param target element - the target input field or division or span
+ * @param noDefault boolean - true if no default date is to be used
+ * @return Date - the current date
+ */
+ _getDateDatepicker: function(target, noDefault) {
+ var inst = this._getInst(target);
+ if (inst && !inst.inline) {
+ this._setDateFromField(inst, noDefault);
+ }
+ return (inst ? this._getDate(inst) : null);
+ },
+
+ /* Handle keystrokes. */
+ _doKeyDown: function(event) {
+ var onSelect, dateStr, sel,
+ inst = $.datepicker._getInst(event.target),
+ handled = true,
+ isRTL = inst.dpDiv.is(".ui-datepicker-rtl");
+
+ inst._keyEvent = true;
+ if ($.datepicker._datepickerShowing) {
+ switch (event.keyCode) {
+ case 9: $.datepicker._hideDatepicker();
+ handled = false;
+ break; // hide on tab out
+ case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." +
+ $.datepicker._currentClass + ")", inst.dpDiv);
+ if (sel[0]) {
+ $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
+ }
+
+ onSelect = $.datepicker._get(inst, "onSelect");
+ if (onSelect) {
+ dateStr = $.datepicker._formatDate(inst);
+
+ // trigger custom callback
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
+ } else {
+ $.datepicker._hideDatepicker();
+ }
+
+ return false; // don't submit the form
+ case 27: $.datepicker._hideDatepicker();
+ break; // hide on escape
+ case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ -$.datepicker._get(inst, "stepBigMonths") :
+ -$.datepicker._get(inst, "stepMonths")), "M");
+ break; // previous month/year on page up/+ ctrl
+ case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ +$.datepicker._get(inst, "stepBigMonths") :
+ +$.datepicker._get(inst, "stepMonths")), "M");
+ break; // next month/year on page down/+ ctrl
+ case 35: if (event.ctrlKey || event.metaKey) {
+ $.datepicker._clearDate(event.target);
+ }
+ handled = event.ctrlKey || event.metaKey;
+ break; // clear on ctrl or command +end
+ case 36: if (event.ctrlKey || event.metaKey) {
+ $.datepicker._gotoToday(event.target);
+ }
+ handled = event.ctrlKey || event.metaKey;
+ break; // current on ctrl or command +home
+ case 37: if (event.ctrlKey || event.metaKey) {
+ $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
+ }
+ handled = event.ctrlKey || event.metaKey;
+ // -1 day on ctrl or command +left
+ if (event.originalEvent.altKey) {
+ $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ -$.datepicker._get(inst, "stepBigMonths") :
+ -$.datepicker._get(inst, "stepMonths")), "M");
+ }
+ // next month/year on alt +left on Mac
+ break;
+ case 38: if (event.ctrlKey || event.metaKey) {
+ $.datepicker._adjustDate(event.target, -7, "D");
+ }
+ handled = event.ctrlKey || event.metaKey;
+ break; // -1 week on ctrl or command +up
+ case 39: if (event.ctrlKey || event.metaKey) {
+ $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
+ }
+ handled = event.ctrlKey || event.metaKey;
+ // +1 day on ctrl or command +right
+ if (event.originalEvent.altKey) {
+ $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+ +$.datepicker._get(inst, "stepBigMonths") :
+ +$.datepicker._get(inst, "stepMonths")), "M");
+ }
+ // next month/year on alt +right
+ break;
+ case 40: if (event.ctrlKey || event.metaKey) {
+ $.datepicker._adjustDate(event.target, +7, "D");
+ }
+ handled = event.ctrlKey || event.metaKey;
+ break; // +1 week on ctrl or command +down
+ default: handled = false;
+ }
+ } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home
+ $.datepicker._showDatepicker(this);
+ } else {
+ handled = false;
+ }
+
+ if (handled) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ },
+
+ /* Filter entered characters - based on date format. */
+ _doKeyPress: function(event) {
+ var chars, chr,
+ inst = $.datepicker._getInst(event.target);
+
+ if ($.datepicker._get(inst, "constrainInput")) {
+ chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat"));
+ chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
+ return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1);
+ }
+ },
+
+ /* Synchronise manual entry and field/alternate field. */
+ _doKeyUp: function(event) {
+ var date,
+ inst = $.datepicker._getInst(event.target);
+
+ if (inst.input.val() !== inst.lastVal) {
+ try {
+ date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
+ (inst.input ? inst.input.val() : null),
+ $.datepicker._getFormatConfig(inst));
+
+ if (date) { // only if valid
+ $.datepicker._setDateFromField(inst);
+ $.datepicker._updateAlternate(inst);
+ $.datepicker._updateDatepicker(inst);
+ }
+ }
+ catch (err) {
+ }
+ }
+ return true;
+ },
+
+ /* Pop-up the date picker for a given input field.
+ * If false returned from beforeShow event handler do not show.
+ * @param input element - the input field attached to the date picker or
+ * event - if triggered by focus
+ */
+ _showDatepicker: function(input) {
+ input = input.target || input;
+ if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
+ input = $("input", input.parentNode)[0];
+ }
+
+ if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here
+ return;
+ }
+
+ var inst, beforeShow, beforeShowSettings, isFixed,
+ offset, showAnim, duration;
+
+ inst = $.datepicker._getInst(input);
+ if ($.datepicker._curInst && $.datepicker._curInst !== inst) {
+ $.datepicker._curInst.dpDiv.stop(true, true);
+ if ( inst && $.datepicker._datepickerShowing ) {
+ $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
+ }
+ }
+
+ beforeShow = $.datepicker._get(inst, "beforeShow");
+ beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
+ if(beforeShowSettings === false){
+ return;
+ }
+ datepicker_extendRemove(inst.settings, beforeShowSettings);
+
+ inst.lastVal = null;
+ $.datepicker._lastInput = input;
+ $.datepicker._setDateFromField(inst);
+
+ if ($.datepicker._inDialog) { // hide cursor
+ input.value = "";
+ }
+ if (!$.datepicker._pos) { // position below input
+ $.datepicker._pos = $.datepicker._findPos(input);
+ $.datepicker._pos[1] += input.offsetHeight; // add the height
+ }
+
+ isFixed = false;
+ $(input).parents().each(function() {
+ isFixed |= $(this).css("position") === "fixed";
+ return !isFixed;
+ });
+
+ offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
+ $.datepicker._pos = null;
+ //to avoid flashes on Firefox
+ inst.dpDiv.empty();
+ // determine sizing offscreen
+ inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"});
+ $.datepicker._updateDatepicker(inst);
+ // fix width for dynamic number of date pickers
+ // and adjust position before showing
+ offset = $.datepicker._checkOffset(inst, offset, isFixed);
+ inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
+ "static" : (isFixed ? "fixed" : "absolute")), display: "none",
+ left: offset.left + "px", top: offset.top + "px"});
+
+ if (!inst.inline) {
+ showAnim = $.datepicker._get(inst, "showAnim");
+ duration = $.datepicker._get(inst, "duration");
+ inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
+ $.datepicker._datepickerShowing = true;
+
+ if ( $.effects && $.effects.effect[ showAnim ] ) {
+ inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
+ } else {
+ inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
+ }
+
+ if ( $.datepicker._shouldFocusInput( inst ) ) {
+ inst.input.focus();
+ }
+
+ $.datepicker._curInst = inst;
+ }
+ },
+
+ /* Generate the date picker content. */
+ _updateDatepicker: function(inst) {
+ this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
+ datepicker_instActive = inst; // for delegate hover events
+ inst.dpDiv.empty().append(this._generateHTML(inst));
+ this._attachHandlers(inst);
+
+ var origyearshtml,
+ numMonths = this._getNumberOfMonths(inst),
+ cols = numMonths[1],
+ width = 17,
+ activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
+
+ if ( activeCell.length > 0 ) {
+ datepicker_handleMouseover.apply( activeCell.get( 0 ) );
+ }
+
+ inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
+ if (cols > 1) {
+ inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
+ }
+ inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") +
+ "Class"]("ui-datepicker-multi");
+ inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") +
+ "Class"]("ui-datepicker-rtl");
+
+ if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
+ inst.input.focus();
+ }
+
+ // deffered render of the years select (to avoid flashes on Firefox)
+ if( inst.yearshtml ){
+ origyearshtml = inst.yearshtml;
+ setTimeout(function(){
+ //assure that inst.yearshtml didn't change.
+ if( origyearshtml === inst.yearshtml && inst.yearshtml ){
+ inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);
+ }
+ origyearshtml = inst.yearshtml = null;
+ }, 0);
+ }
+ },
+
+ // #6694 - don't focus the input if it's already focused
+ // this breaks the change event in IE
+ // Support: IE and jQuery <1.9
+ _shouldFocusInput: function( inst ) {
+ return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
+ },
+
+ /* Check positioning to remain on screen. */
+ _checkOffset: function(inst, offset, isFixed) {
+ var dpWidth = inst.dpDiv.outerWidth(),
+ dpHeight = inst.dpDiv.outerHeight(),
+ inputWidth = inst.input ? inst.input.outerWidth() : 0,
+ inputHeight = inst.input ? inst.input.outerHeight() : 0,
+ viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()),
+ viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
+
+ offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0);
+ offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0;
+ offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
+
+ // now check if datepicker is showing outside window viewport - move to a better place if so.
+ offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
+ Math.abs(offset.left + dpWidth - viewWidth) : 0);
+ offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
+ Math.abs(dpHeight + inputHeight) : 0);
+
+ return offset;
+ },
+
+ /* Find an object's position on the screen. */
+ _findPos: function(obj) {
+ var position,
+ inst = this._getInst(obj),
+ isRTL = this._get(inst, "isRTL");
+
+ while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) {
+ obj = obj[isRTL ? "previousSibling" : "nextSibling"];
+ }
+
+ position = $(obj).offset();
+ return [position.left, position.top];
+ },
+
+ /* Hide the date picker from view.
+ * @param input element - the input field attached to the date picker
+ */
+ _hideDatepicker: function(input) {
+ var showAnim, duration, postProcess, onClose,
+ inst = this._curInst;
+
+ if (!inst || (input && inst !== $.data(input, "datepicker"))) {
+ return;
+ }
+
+ if (this._datepickerShowing) {
+ showAnim = this._get(inst, "showAnim");
+ duration = this._get(inst, "duration");
+ postProcess = function() {
+ $.datepicker._tidyDialog(inst);
+ };
+
+ // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
+ if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
+ inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess);
+ } else {
+ inst.dpDiv[(showAnim === "slideDown" ? "slideUp" :
+ (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess);
+ }
+
+ if (!showAnim) {
+ postProcess();
+ }
+ this._datepickerShowing = false;
+
+ onClose = this._get(inst, "onClose");
+ if (onClose) {
+ onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]);
+ }
+
+ this._lastInput = null;
+ if (this._inDialog) {
+ this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" });
+ if ($.blockUI) {
+ $.unblockUI();
+ $("body").append(this.dpDiv);
+ }
+ }
+ this._inDialog = false;
+ }
+ },
+
+ /* Tidy up after a dialog display. */
+ _tidyDialog: function(inst) {
+ inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");
+ },
+
+ /* Close date picker if clicked elsewhere. */
+ _checkExternalClick: function(event) {
+ if (!$.datepicker._curInst) {
+ return;
+ }
+
+ var $target = $(event.target),
+ inst = $.datepicker._getInst($target[0]);
+
+ if ( ( ( $target[0].id !== $.datepicker._mainDivId &&
+ $target.parents("#" + $.datepicker._mainDivId).length === 0 &&
+ !$target.hasClass($.datepicker.markerClassName) &&
+ !$target.closest("." + $.datepicker._triggerClass).length &&
+ $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
+ ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) {
+ $.datepicker._hideDatepicker();
+ }
+ },
+
+ /* Adjust one of the date sub-fields. */
+ _adjustDate: function(id, offset, period) {
+ var target = $(id),
+ inst = this._getInst(target[0]);
+
+ if (this._isDisabledDatepicker(target[0])) {
+ return;
+ }
+ this._adjustInstDate(inst, offset +
+ (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning
+ period);
+ this._updateDatepicker(inst);
+ },
+
+ /* Action for current link. */
+ _gotoToday: function(id) {
+ var date,
+ target = $(id),
+ inst = this._getInst(target[0]);
+
+ if (this._get(inst, "gotoCurrent") && inst.currentDay) {
+ inst.selectedDay = inst.currentDay;
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth;
+ inst.drawYear = inst.selectedYear = inst.currentYear;
+ } else {
+ date = new Date();
+ inst.selectedDay = date.getDate();
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
+ inst.drawYear = inst.selectedYear = date.getFullYear();
+ }
+ this._notifyChange(inst);
+ this._adjustDate(target);
+ },
+
+ /* Action for selecting a new month/year. */
+ _selectMonthYear: function(id, select, period) {
+ var target = $(id),
+ inst = this._getInst(target[0]);
+
+ inst["selected" + (period === "M" ? "Month" : "Year")] =
+ inst["draw" + (period === "M" ? "Month" : "Year")] =
+ parseInt(select.options[select.selectedIndex].value,10);
+
+ this._notifyChange(inst);
+ this._adjustDate(target);
+ },
+
+ /* Action for selecting a day. */
+ _selectDay: function(id, month, year, td) {
+ var inst,
+ target = $(id);
+
+ if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
+ return;
+ }
+
+ inst = this._getInst(target[0]);
+ inst.selectedDay = inst.currentDay = $("a", td).html();
+ inst.selectedMonth = inst.currentMonth = month;
+ inst.selectedYear = inst.currentYear = year;
+ this._selectDate(id, this._formatDate(inst,
+ inst.currentDay, inst.currentMonth, inst.currentYear));
+ },
+
+ /* Erase the input field and hide the date picker. */
+ _clearDate: function(id) {
+ var target = $(id);
+ this._selectDate(target, "");
+ },
+
+ /* Update the input field with the selected date. */
+ _selectDate: function(id, dateStr) {
+ var onSelect,
+ target = $(id),
+ inst = this._getInst(target[0]);
+
+ dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
+ if (inst.input) {
+ inst.input.val(dateStr);
+ }
+ this._updateAlternate(inst);
+
+ onSelect = this._get(inst, "onSelect");
+ if (onSelect) {
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
+ } else if (inst.input) {
+ inst.input.trigger("change"); // fire the change event
+ }
+
+ if (inst.inline){
+ this._updateDatepicker(inst);
+ } else {
+ this._hideDatepicker();
+ this._lastInput = inst.input[0];
+ if (typeof(inst.input[0]) !== "object") {
+ inst.input.focus(); // restore focus
+ }
+ this._lastInput = null;
+ }
+ },
+
+ /* Update any alternate field to synchronise with the main field. */
+ _updateAlternate: function(inst) {
+ var altFormat, date, dateStr,
+ altField = this._get(inst, "altField");
+
+ if (altField) { // update alternate field too
+ altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat");
+ date = this._getDate(inst);
+ dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
+ $(altField).each(function() { $(this).val(dateStr); });
+ }
+ },
+
+ /* Set as beforeShowDay function to prevent selection of weekends.
+ * @param date Date - the date to customise
+ * @return [boolean, string] - is this date selectable?, what is its CSS class?
+ */
+ noWeekends: function(date) {
+ var day = date.getDay();
+ return [(day > 0 && day < 6), ""];
+ },
+
+ /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
+ * @param date Date - the date to get the week for
+ * @return number - the number of the week within the year that contains this date
+ */
+ iso8601Week: function(date) {
+ var time,
+ checkDate = new Date(date.getTime());
+
+ // Find Thursday of this week starting on Monday
+ checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
+
+ time = checkDate.getTime();
+ checkDate.setMonth(0); // Compare with Jan 1
+ checkDate.setDate(1);
+ return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
+ },
+
+ /* Parse a string value into a date object.
+ * See formatDate below for the possible formats.
+ *
+ * @param format string - the expected format of the date
+ * @param value string - the date in the above format
+ * @param settings Object - attributes include:
+ * shortYearCutoff number - the cutoff year for determining the century (optional)
+ * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
+ * dayNames string[7] - names of the days from Sunday (optional)
+ * monthNamesShort string[12] - abbreviated names of the months (optional)
+ * monthNames string[12] - names of the months (optional)
+ * @return Date - the extracted date value or null if value is blank
+ */
+ parseDate: function (format, value, settings) {
+ if (format == null || value == null) {
+ throw "Invalid arguments";
+ }
+
+ value = (typeof value === "object" ? value.toString() : value + "");
+ if (value === "") {
+ return null;
+ }
+
+ var iFormat, dim, extra,
+ iValue = 0,
+ shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff,
+ shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)),
+ dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
+ dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
+ monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
+ monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
+ year = -1,
+ month = -1,
+ day = -1,
+ doy = -1,
+ literal = false,
+ date,
+ // Check whether a format character is doubled
+ lookAhead = function(match) {
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
+ if (matches) {
+ iFormat++;
+ }
+ return matches;
+ },
+ // Extract a number from the string value
+ getNumber = function(match) {
+ var isDoubled = lookAhead(match),
+ size = (match === "@" ? 14 : (match === "!" ? 20 :
+ (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
+ minSize = (match === "y" ? size : 1),
+ digits = new RegExp("^\\d{" + minSize + "," + size + "}"),
+ num = value.substring(iValue).match(digits);
+ if (!num) {
+ throw "Missing number at position " + iValue;
+ }
+ iValue += num[0].length;
+ return parseInt(num[0], 10);
+ },
+ // Extract a name from the string value and convert to an index
+ getName = function(match, shortNames, longNames) {
+ var index = -1,
+ names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
+ return [ [k, v] ];
+ }).sort(function (a, b) {
+ return -(a[1].length - b[1].length);
+ });
+
+ $.each(names, function (i, pair) {
+ var name = pair[1];
+ if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {
+ index = pair[0];
+ iValue += name.length;
+ return false;
+ }
+ });
+ if (index !== -1) {
+ return index + 1;
+ } else {
+ throw "Unknown name at position " + iValue;
+ }
+ },
+ // Confirm that a literal character matches the string value
+ checkLiteral = function() {
+ if (value.charAt(iValue) !== format.charAt(iFormat)) {
+ throw "Unexpected literal at position " + iValue;
+ }
+ iValue++;
+ };
+
+ for (iFormat = 0; iFormat < format.length; iFormat++) {
+ if (literal) {
+ if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
+ literal = false;
+ } else {
+ checkLiteral();
+ }
+ } else {
+ switch (format.charAt(iFormat)) {
+ case "d":
+ day = getNumber("d");
+ break;
+ case "D":
+ getName("D", dayNamesShort, dayNames);
+ break;
+ case "o":
+ doy = getNumber("o");
+ break;
+ case "m":
+ month = getNumber("m");
+ break;
+ case "M":
+ month = getName("M", monthNamesShort, monthNames);
+ break;
+ case "y":
+ year = getNumber("y");
+ break;
+ case "@":
+ date = new Date(getNumber("@"));
+ year = date.getFullYear();
+ month = date.getMonth() + 1;
+ day = date.getDate();
+ break;
+ case "!":
+ date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
+ year = date.getFullYear();
+ month = date.getMonth() + 1;
+ day = date.getDate();
+ break;
+ case "'":
+ if (lookAhead("'")){
+ checkLiteral();
+ } else {
+ literal = true;
+ }
+ break;
+ default:
+ checkLiteral();
+ }
+ }
+ }
+
+ if (iValue < value.length){
+ extra = value.substr(iValue);
+ if (!/^\s+/.test(extra)) {
+ throw "Extra/unparsed characters found in date: " + extra;
+ }
+ }
+
+ if (year === -1) {
+ year = new Date().getFullYear();
+ } else if (year < 100) {
+ year += new Date().getFullYear() - new Date().getFullYear() % 100 +
+ (year <= shortYearCutoff ? 0 : -100);
+ }
+
+ if (doy > -1) {
+ month = 1;
+ day = doy;
+ do {
+ dim = this._getDaysInMonth(year, month - 1);
+ if (day <= dim) {
+ break;
+ }
+ month++;
+ day -= dim;
+ } while (true);
+ }
+
+ date = this._daylightSavingAdjust(new Date(year, month - 1, day));
+ if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {
+ throw "Invalid date"; // E.g. 31/02/00
+ }
+ return date;
+ },
+
+ /* Standard date formats. */
+ ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
+ COOKIE: "D, dd M yy",
+ ISO_8601: "yy-mm-dd",
+ RFC_822: "D, d M y",
+ RFC_850: "DD, dd-M-y",
+ RFC_1036: "D, d M y",
+ RFC_1123: "D, d M yy",
+ RFC_2822: "D, d M yy",
+ RSS: "D, d M y", // RFC 822
+ TICKS: "!",
+ TIMESTAMP: "@",
+ W3C: "yy-mm-dd", // ISO 8601
+
+ _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
+ Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
+
+ /* Format a date object into a string value.
+ * The format can be combinations of the following:
+ * d - day of month (no leading zero)
+ * dd - day of month (two digit)
+ * o - day of year (no leading zeros)
+ * oo - day of year (three digit)
+ * D - day name short
+ * DD - day name long
+ * m - month of year (no leading zero)
+ * mm - month of year (two digit)
+ * M - month name short
+ * MM - month name long
+ * y - year (two digit)
+ * yy - year (four digit)
+ * @ - Unix timestamp (ms since 01/01/1970)
+ * ! - Windows ticks (100ns since 01/01/0001)
+ * "..." - literal text
+ * '' - single quote
+ *
+ * @param format string - the desired format of the date
+ * @param date Date - the date value to format
+ * @param settings Object - attributes include:
+ * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
+ * dayNames string[7] - names of the days from Sunday (optional)
+ * monthNamesShort string[12] - abbreviated names of the months (optional)
+ * monthNames string[12] - names of the months (optional)
+ * @return string - the date in the above format
+ */
+ formatDate: function (format, date, settings) {
+ if (!date) {
+ return "";
+ }
+
+ var iFormat,
+ dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
+ dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
+ monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
+ monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
+ // Check whether a format character is doubled
+ lookAhead = function(match) {
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
+ if (matches) {
+ iFormat++;
+ }
+ return matches;
+ },
+ // Format a number, with leading zero if necessary
+ formatNumber = function(match, value, len) {
+ var num = "" + value;
+ if (lookAhead(match)) {
+ while (num.length < len) {
+ num = "0" + num;
+ }
+ }
+ return num;
+ },
+ // Format a name, short or long as requested
+ formatName = function(match, value, shortNames, longNames) {
+ return (lookAhead(match) ? longNames[value] : shortNames[value]);
+ },
+ output = "",
+ literal = false;
+
+ if (date) {
+ for (iFormat = 0; iFormat < format.length; iFormat++) {
+ if (literal) {
+ if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
+ literal = false;
+ } else {
+ output += format.charAt(iFormat);
+ }
+ } else {
+ switch (format.charAt(iFormat)) {
+ case "d":
+ output += formatNumber("d", date.getDate(), 2);
+ break;
+ case "D":
+ output += formatName("D", date.getDay(), dayNamesShort, dayNames);
+ break;
+ case "o":
+ output += formatNumber("o",
+ Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
+ break;
+ case "m":
+ output += formatNumber("m", date.getMonth() + 1, 2);
+ break;
+ case "M":
+ output += formatName("M", date.getMonth(), monthNamesShort, monthNames);
+ break;
+ case "y":
+ output += (lookAhead("y") ? date.getFullYear() :
+ (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100);
+ break;
+ case "@":
+ output += date.getTime();
+ break;
+ case "!":
+ output += date.getTime() * 10000 + this._ticksTo1970;
+ break;
+ case "'":
+ if (lookAhead("'")) {
+ output += "'";
+ } else {
+ literal = true;
+ }
+ break;
+ default:
+ output += format.charAt(iFormat);
+ }
+ }
+ }
+ }
+ return output;
+ },
+
+ /* Extract all possible characters from the date format. */
+ _possibleChars: function (format) {
+ var iFormat,
+ chars = "",
+ literal = false,
+ // Check whether a format character is doubled
+ lookAhead = function(match) {
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
+ if (matches) {
+ iFormat++;
+ }
+ return matches;
+ };
+
+ for (iFormat = 0; iFormat < format.length; iFormat++) {
+ if (literal) {
+ if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
+ literal = false;
+ } else {
+ chars += format.charAt(iFormat);
+ }
+ } else {
+ switch (format.charAt(iFormat)) {
+ case "d": case "m": case "y": case "@":
+ chars += "0123456789";
+ break;
+ case "D": case "M":
+ return null; // Accept anything
+ case "'":
+ if (lookAhead("'")) {
+ chars += "'";
+ } else {
+ literal = true;
+ }
+ break;
+ default:
+ chars += format.charAt(iFormat);
+ }
+ }
+ }
+ return chars;
+ },
+
+ /* Get a setting value, defaulting if necessary. */
+ _get: function(inst, name) {
+ return inst.settings[name] !== undefined ?
+ inst.settings[name] : this._defaults[name];
+ },
+
+ /* Parse existing date and initialise date picker. */
+ _setDateFromField: function(inst, noDefault) {
+ if (inst.input.val() === inst.lastVal) {
+ return;
+ }
+
+ var dateFormat = this._get(inst, "dateFormat"),
+ dates = inst.lastVal = inst.input ? inst.input.val() : null,
+ defaultDate = this._getDefaultDate(inst),
+ date = defaultDate,
+ settings = this._getFormatConfig(inst);
+
+ try {
+ date = this.parseDate(dateFormat, dates, settings) || defaultDate;
+ } catch (event) {
+ dates = (noDefault ? "" : dates);
+ }
+ inst.selectedDay = date.getDate();
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
+ inst.drawYear = inst.selectedYear = date.getFullYear();
+ inst.currentDay = (dates ? date.getDate() : 0);
+ inst.currentMonth = (dates ? date.getMonth() : 0);
+ inst.currentYear = (dates ? date.getFullYear() : 0);
+ this._adjustInstDate(inst);
+ },
+
+ /* Retrieve the default date shown on opening. */
+ _getDefaultDate: function(inst) {
+ return this._restrictMinMax(inst,
+ this._determineDate(inst, this._get(inst, "defaultDate"), new Date()));
+ },
+
+ /* A date may be specified as an exact value or a relative one. */
+ _determineDate: function(inst, date, defaultDate) {
+ var offsetNumeric = function(offset) {
+ var date = new Date();
+ date.setDate(date.getDate() + offset);
+ return date;
+ },
+ offsetString = function(offset) {
+ try {
+ return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
+ offset, $.datepicker._getFormatConfig(inst));
+ }
+ catch (e) {
+ // Ignore
+ }
+
+ var date = (offset.toLowerCase().match(/^c/) ?
+ $.datepicker._getDate(inst) : null) || new Date(),
+ year = date.getFullYear(),
+ month = date.getMonth(),
+ day = date.getDate(),
+ pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
+ matches = pattern.exec(offset);
+
+ while (matches) {
+ switch (matches[2] || "d") {
+ case "d" : case "D" :
+ day += parseInt(matches[1],10); break;
+ case "w" : case "W" :
+ day += parseInt(matches[1],10) * 7; break;
+ case "m" : case "M" :
+ month += parseInt(matches[1],10);
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
+ break;
+ case "y": case "Y" :
+ year += parseInt(matches[1],10);
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
+ break;
+ }
+ matches = pattern.exec(offset);
+ }
+ return new Date(year, month, day);
+ },
+ newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) :
+ (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
+
+ newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
+ if (newDate) {
+ newDate.setHours(0);
+ newDate.setMinutes(0);
+ newDate.setSeconds(0);
+ newDate.setMilliseconds(0);
+ }
+ return this._daylightSavingAdjust(newDate);
+ },
+
+ /* Handle switch to/from daylight saving.
+ * Hours may be non-zero on daylight saving cut-over:
+ * > 12 when midnight changeover, but then cannot generate
+ * midnight datetime, so jump to 1AM, otherwise reset.
+ * @param date (Date) the date to check
+ * @return (Date) the corrected date
+ */
+ _daylightSavingAdjust: function(date) {
+ if (!date) {
+ return null;
+ }
+ date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
+ return date;
+ },
+
+ /* Set the date(s) directly. */
+ _setDate: function(inst, date, noChange) {
+ var clear = !date,
+ origMonth = inst.selectedMonth,
+ origYear = inst.selectedYear,
+ newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
+
+ inst.selectedDay = inst.currentDay = newDate.getDate();
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
+ inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
+ if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) {
+ this._notifyChange(inst);
+ }
+ this._adjustInstDate(inst);
+ if (inst.input) {
+ inst.input.val(clear ? "" : this._formatDate(inst));
+ }
+ },
+
+ /* Retrieve the date(s) directly. */
+ _getDate: function(inst) {
+ var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null :
+ this._daylightSavingAdjust(new Date(
+ inst.currentYear, inst.currentMonth, inst.currentDay)));
+ return startDate;
+ },
+
+ /* Attach the onxxx handlers. These are declared statically so
+ * they work with static code transformers like Caja.
+ */
+ _attachHandlers: function(inst) {
+ var stepMonths = this._get(inst, "stepMonths"),
+ id = "#" + inst.id.replace( /\\\\/g, "\\" );
+ inst.dpDiv.find("[data-handler]").map(function () {
+ var handler = {
+ prev: function () {
+ $.datepicker._adjustDate(id, -stepMonths, "M");
+ },
+ next: function () {
+ $.datepicker._adjustDate(id, +stepMonths, "M");
+ },
+ hide: function () {
+ $.datepicker._hideDatepicker();
+ },
+ today: function () {
+ $.datepicker._gotoToday(id);
+ },
+ selectDay: function () {
+ $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
+ return false;
+ },
+ selectMonth: function () {
+ $.datepicker._selectMonthYear(id, this, "M");
+ return false;
+ },
+ selectYear: function () {
+ $.datepicker._selectMonthYear(id, this, "Y");
+ return false;
+ }
+ };
+ $(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
+ });
+ },
+
+ /* Generate the HTML for the current state of the date picker. */
+ _generateHTML: function(inst) {
+ var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
+ controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
+ monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
+ selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
+ cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
+ printDate, dRow, tbody, daySettings, otherMonth, unselectable,
+ tempDate = new Date(),
+ today = this._daylightSavingAdjust(
+ new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time
+ isRTL = this._get(inst, "isRTL"),
+ showButtonPanel = this._get(inst, "showButtonPanel"),
+ hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"),
+ navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"),
+ numMonths = this._getNumberOfMonths(inst),
+ showCurrentAtPos = this._get(inst, "showCurrentAtPos"),
+ stepMonths = this._get(inst, "stepMonths"),
+ isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1),
+ currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
+ new Date(inst.currentYear, inst.currentMonth, inst.currentDay))),
+ minDate = this._getMinMaxDate(inst, "min"),
+ maxDate = this._getMinMaxDate(inst, "max"),
+ drawMonth = inst.drawMonth - showCurrentAtPos,
+ drawYear = inst.drawYear;
+
+ if (drawMonth < 0) {
+ drawMonth += 12;
+ drawYear--;
+ }
+ if (maxDate) {
+ maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
+ maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
+ maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
+ while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
+ drawMonth--;
+ if (drawMonth < 0) {
+ drawMonth = 11;
+ drawYear--;
+ }
+ }
+ }
+ inst.drawMonth = drawMonth;
+ inst.drawYear = drawYear;
+
+ prevText = this._get(inst, "prevText");
+ prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
+ this._getFormatConfig(inst)));
+
+ prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
+ "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
+ " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" :
+ (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+ prevText +"'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>"));
+
+ nextText = this._get(inst, "nextText");
+ nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
+ this._getFormatConfig(inst)));
+
+ next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
+ "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
+ " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" :
+ (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+ nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>"));
+
+ currentText = this._get(inst, "currentText");
+ gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today);
+ currentText = (!navigationAsDateFormat ? currentText :
+ this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
+
+ controls = (!inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
+ this._get(inst, "closeText") + "</button>" : "");
+
+ buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") +
+ (this._isInRange(inst, gotoDate) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
+ ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : "";
+
+ firstDay = parseInt(this._get(inst, "firstDay"),10);
+ firstDay = (isNaN(firstDay) ? 0 : firstDay);
+
+ showWeek = this._get(inst, "showWeek");
+ dayNames = this._get(inst, "dayNames");
+ dayNamesMin = this._get(inst, "dayNamesMin");
+ monthNames = this._get(inst, "monthNames");
+ monthNamesShort = this._get(inst, "monthNamesShort");
+ beforeShowDay = this._get(inst, "beforeShowDay");
+ showOtherMonths = this._get(inst, "showOtherMonths");
+ selectOtherMonths = this._get(inst, "selectOtherMonths");
+ defaultDate = this._getDefaultDate(inst);
+ html = "";
+ dow;
+ for (row = 0; row < numMonths[0]; row++) {
+ group = "";
+ this.maxRows = 4;
+ for (col = 0; col < numMonths[1]; col++) {
+ selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
+ cornerClass = " ui-corner-all";
+ calender = "";
+ if (isMultiMonth) {
+ calender += "<div class='ui-datepicker-group";
+ if (numMonths[1] > 1) {
+ switch (col) {
+ case 0: calender += " ui-datepicker-group-first";
+ cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
+ case numMonths[1]-1: calender += " ui-datepicker-group-last";
+ cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
+ default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
+ }
+ }
+ calender += "'>";
+ }
+ calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
+ (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") +
+ (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") +
+ this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
+ row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
+ "</div><table class='ui-datepicker-calendar'><thead>" +
+ "<tr>";
+ thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
+ for (dow = 0; dow < 7; dow++) { // days of the week
+ day = (dow + firstDay) % 7;
+ thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" +
+ "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
+ }
+ calender += thead + "</tr></thead><tbody>";
+ daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
+ if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
+ inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
+ }
+ leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
+ curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
+ numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
+ this.maxRows = numRows;
+ printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
+ for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
+ calender += "<tr>";
+ tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
+ this._get(inst, "calculateWeek")(printDate) + "</td>");
+ for (dow = 0; dow < 7; dow++) { // create date picker days
+ daySettings = (beforeShowDay ?
+ beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]);
+ otherMonth = (printDate.getMonth() !== drawMonth);
+ unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
+ (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
+ tbody += "<td class='" +
+ ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends
+ (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months
+ ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key
+ (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ?
+ // or defaultDate is current printedDate and defaultDate is selectedDate
+ " " + this._dayOverClass : "") + // highlight selected day
+ (unselectable ? " " + this._unselectableClass + " ui-state-disabled": "") + // highlight unselectable days
+ (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates
+ (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day
+ (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different)
+ ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "&#39;") + "'" : "") + // cell title
+ (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions
+ (otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
+ (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
+ (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") +
+ (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day
+ (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months
+ "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date
+ printDate.setDate(printDate.getDate() + 1);
+ printDate = this._daylightSavingAdjust(printDate);
+ }
+ calender += tbody + "</tr>";
+ }
+ drawMonth++;
+ if (drawMonth > 11) {
+ drawMonth = 0;
+ drawYear++;
+ }
+ calender += "</tbody></table>" + (isMultiMonth ? "</div>" +
+ ((numMonths[0] > 0 && col === numMonths[1]-1) ? "<div class='ui-datepicker-row-break'></div>" : "") : "");
+ group += calender;
+ }
+ html += group;
+ }
+ html += buttonPanel;
+ inst._keyEvent = false;
+ return html;
+ },
+
+ /* Generate the month and year header. */
+ _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
+ secondary, monthNames, monthNamesShort) {
+
+ var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
+ changeMonth = this._get(inst, "changeMonth"),
+ changeYear = this._get(inst, "changeYear"),
+ showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
+ html = "<div class='ui-datepicker-title'>",
+ monthHtml = "";
+
+ // month selection
+ if (secondary || !changeMonth) {
+ monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>";
+ } else {
+ inMinYear = (minDate && minDate.getFullYear() === drawYear);
+ inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
+ monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
+ for ( month = 0; month < 12; month++) {
+ if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
+ monthHtml += "<option value='" + month + "'" +
+ (month === drawMonth ? " selected='selected'" : "") +
+ ">" + monthNamesShort[month] + "</option>";
+ }
+ }
+ monthHtml += "</select>";
+ }
+
+ if (!showMonthAfterYear) {
+ html += monthHtml + (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "");
+ }
+
+ // year selection
+ if ( !inst.yearshtml ) {
+ inst.yearshtml = "";
+ if (secondary || !changeYear) {
+ html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
+ } else {
+ // determine range of years to display
+ years = this._get(inst, "yearRange").split(":");
+ thisYear = new Date().getFullYear();
+ determineYear = function(value) {
+ var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
+ (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
+ parseInt(value, 10)));
+ return (isNaN(year) ? thisYear : year);
+ };
+ year = determineYear(years[0]);
+ endYear = Math.max(year, determineYear(years[1] || ""));
+ year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
+ endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
+ inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
+ for (; year <= endYear; year++) {
+ inst.yearshtml += "<option value='" + year + "'" +
+ (year === drawYear ? " selected='selected'" : "") +
+ ">" + year + "</option>";
+ }
+ inst.yearshtml += "</select>";
+
+ html += inst.yearshtml;
+ inst.yearshtml = null;
+ }
+ }
+
+ html += this._get(inst, "yearSuffix");
+ if (showMonthAfterYear) {
+ html += (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "") + monthHtml;
+ }
+ html += "</div>"; // Close datepicker_header
+ return html;
+ },
+
+ /* Adjust one of the date sub-fields. */
+ _adjustInstDate: function(inst, offset, period) {
+ var year = inst.drawYear + (period === "Y" ? offset : 0),
+ month = inst.drawMonth + (period === "M" ? offset : 0),
+ day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0),
+ date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day)));
+
+ inst.selectedDay = date.getDate();
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
+ inst.drawYear = inst.selectedYear = date.getFullYear();
+ if (period === "M" || period === "Y") {
+ this._notifyChange(inst);
+ }
+ },
+
+ /* Ensure a date is within any min/max bounds. */
+ _restrictMinMax: function(inst, date) {
+ var minDate = this._getMinMaxDate(inst, "min"),
+ maxDate = this._getMinMaxDate(inst, "max"),
+ newDate = (minDate && date < minDate ? minDate : date);
+ return (maxDate && newDate > maxDate ? maxDate : newDate);
+ },
+
+ /* Notify change of month/year. */
+ _notifyChange: function(inst) {
+ var onChange = this._get(inst, "onChangeMonthYear");
+ if (onChange) {
+ onChange.apply((inst.input ? inst.input[0] : null),
+ [inst.selectedYear, inst.selectedMonth + 1, inst]);
+ }
+ },
+
+ /* Determine the number of months to show. */
+ _getNumberOfMonths: function(inst) {
+ var numMonths = this._get(inst, "numberOfMonths");
+ return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths));
+ },
+
+ /* Determine the current maximum date - ensure no time components are set. */
+ _getMinMaxDate: function(inst, minMax) {
+ return this._determineDate(inst, this._get(inst, minMax + "Date"), null);
+ },
+
+ /* Find the number of days in a given month. */
+ _getDaysInMonth: function(year, month) {
+ return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
+ },
+
+ /* Find the day of the week of the first of a month. */
+ _getFirstDayOfMonth: function(year, month) {
+ return new Date(year, month, 1).getDay();
+ },
+
+ /* Determines if we should allow a "next/prev" month display change. */
+ _canAdjustMonth: function(inst, offset, curYear, curMonth) {
+ var numMonths = this._getNumberOfMonths(inst),
+ date = this._daylightSavingAdjust(new Date(curYear,
+ curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
+
+ if (offset < 0) {
+ date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
+ }
+ return this._isInRange(inst, date);
+ },
+
+ /* Is the given date in the accepted range? */
+ _isInRange: function(inst, date) {
+ var yearSplit, currentYear,
+ minDate = this._getMinMaxDate(inst, "min"),
+ maxDate = this._getMinMaxDate(inst, "max"),
+ minYear = null,
+ maxYear = null,
+ years = this._get(inst, "yearRange");
+ if (years){
+ yearSplit = years.split(":");
+ currentYear = new Date().getFullYear();
+ minYear = parseInt(yearSplit[0], 10);
+ maxYear = parseInt(yearSplit[1], 10);
+ if ( yearSplit[0].match(/[+\-].*/) ) {
+ minYear += currentYear;
+ }
+ if ( yearSplit[1].match(/[+\-].*/) ) {
+ maxYear += currentYear;
+ }
+ }
+
+ return ((!minDate || date.getTime() >= minDate.getTime()) &&
+ (!maxDate || date.getTime() <= maxDate.getTime()) &&
+ (!minYear || date.getFullYear() >= minYear) &&
+ (!maxYear || date.getFullYear() <= maxYear));
+ },
+
+ /* Provide the configuration settings for formatting/parsing. */
+ _getFormatConfig: function(inst) {
+ var shortYearCutoff = this._get(inst, "shortYearCutoff");
+ shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff :
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
+ return {shortYearCutoff: shortYearCutoff,
+ dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"),
+ monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")};
+ },
+
+ /* Format the given date for display. */
+ _formatDate: function(inst, day, month, year) {
+ if (!day) {
+ inst.currentDay = inst.selectedDay;
+ inst.currentMonth = inst.selectedMonth;
+ inst.currentYear = inst.selectedYear;
+ }
+ var date = (day ? (typeof day === "object" ? day :
+ this._daylightSavingAdjust(new Date(year, month, day))) :
+ this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
+ return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst));
+ }
+});
+
+/*
+ * Bind hover events for datepicker elements.
+ * Done via delegate so the binding only occurs once in the lifetime of the parent div.
+ * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
+ */
+function datepicker_bindHover(dpDiv) {
+ var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
+ return dpDiv.delegate(selector, "mouseout", function() {
+ $(this).removeClass("ui-state-hover");
+ if (this.className.indexOf("ui-datepicker-prev") !== -1) {
+ $(this).removeClass("ui-datepicker-prev-hover");
+ }
+ if (this.className.indexOf("ui-datepicker-next") !== -1) {
+ $(this).removeClass("ui-datepicker-next-hover");
+ }
+ })
+ .delegate( selector, "mouseover", datepicker_handleMouseover );
+}
+
+function datepicker_handleMouseover() {
+ if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) {
+ $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
+ $(this).addClass("ui-state-hover");
+ if (this.className.indexOf("ui-datepicker-prev") !== -1) {
+ $(this).addClass("ui-datepicker-prev-hover");
+ }
+ if (this.className.indexOf("ui-datepicker-next") !== -1) {
+ $(this).addClass("ui-datepicker-next-hover");
+ }
+ }
+}
+
+/* jQuery extend now ignores nulls! */
+function datepicker_extendRemove(target, props) {
+ $.extend(target, props);
+ for (var name in props) {
+ if (props[name] == null) {
+ target[name] = props[name];
+ }
+ }
+ return target;
+}
+
+/* Invoke the datepicker functionality.
+ @param options string - a command, optionally followed by additional parameters or
+ Object - settings for attaching new datepicker functionality
+ @return jQuery object */
+$.fn.datepicker = function(options){
+
+ /* Verify an empty collection wasn't passed - Fixes #6976 */
+ if ( !this.length ) {
+ return this;
+ }
+
+ /* Initialise the date picker. */
+ if (!$.datepicker.initialized) {
+ $(document).mousedown($.datepicker._checkExternalClick);
+ $.datepicker.initialized = true;
+ }
+
+ /* Append datepicker main container to body if not exist. */
+ if ($("#"+$.datepicker._mainDivId).length === 0) {
+ $("body").append($.datepicker.dpDiv);
+ }
+
+ var otherArgs = Array.prototype.slice.call(arguments, 1);
+ if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) {
+ return $.datepicker["_" + options + "Datepicker"].
+ apply($.datepicker, [this[0]].concat(otherArgs));
+ }
+ if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") {
+ return $.datepicker["_" + options + "Datepicker"].
+ apply($.datepicker, [this[0]].concat(otherArgs));
+ }
+ return this.each(function() {
+ typeof options === "string" ?
+ $.datepicker["_" + options + "Datepicker"].
+ apply($.datepicker, [this].concat(otherArgs)) :
+ $.datepicker._attachDatepicker(this, options);
+ });
+};
+
+$.datepicker = new Datepicker(); // singleton instance
+$.datepicker.initialized = false;
+$.datepicker.uuid = new Date().getTime();
+$.datepicker.version = "1.11.4";
+
+var datepicker = $.datepicker;
+
+
+/*!
+ * jQuery UI Draggable 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/draggable/
+ */
+
+
+$.widget("ui.draggable", $.ui.mouse, {
+ version: "1.11.4",
+ widgetEventPrefix: "drag",
+ options: {
+ addClasses: true,
+ appendTo: "parent",
+ axis: false,
+ connectToSortable: false,
+ containment: false,
+ cursor: "auto",
+ cursorAt: false,
+ grid: false,
+ handle: false,
+ helper: "original",
+ iframeFix: false,
+ opacity: false,
+ refreshPositions: false,
+ revert: false,
+ revertDuration: 500,
+ scope: "default",
+ scroll: true,
+ scrollSensitivity: 20,
+ scrollSpeed: 20,
+ snap: false,
+ snapMode: "both",
+ snapTolerance: 20,
+ stack: false,
+ zIndex: false,
+
+ // callbacks
+ drag: null,
+ start: null,
+ stop: null
+ },
+ _create: function() {
+
+ if ( this.options.helper === "original" ) {
+ this._setPositionRelative();
+ }
+ if (this.options.addClasses){
+ this.element.addClass("ui-draggable");
+ }
+ if (this.options.disabled){
+ this.element.addClass("ui-draggable-disabled");
+ }
+ this._setHandleClassName();
+
+ this._mouseInit();
+ },
+
+ _setOption: function( key, value ) {
+ this._super( key, value );
+ if ( key === "handle" ) {
+ this._removeHandleClassName();
+ this._setHandleClassName();
+ }
+ },
+
+ _destroy: function() {
+ if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
+ this.destroyOnClear = true;
+ return;
+ }
+ this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
+ this._removeHandleClassName();
+ this._mouseDestroy();
+ },
+
+ _mouseCapture: function(event) {
+ var o = this.options;
+
+ this._blurActiveElement( event );
+
+ // among others, prevent a drag on a resizable-handle
+ if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
+ return false;
+ }
+
+ //Quit if we're not on a valid handle
+ this.handle = this._getHandle(event);
+ if (!this.handle) {
+ return false;
+ }
+
+ this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
+
+ return true;
+
+ },
+
+ _blockFrames: function( selector ) {
+ this.iframeBlocks = this.document.find( selector ).map(function() {
+ var iframe = $( this );
+
+ return $( "<div>" )
+ .css( "position", "absolute" )
+ .appendTo( iframe.parent() )
+ .outerWidth( iframe.outerWidth() )
+ .outerHeight( iframe.outerHeight() )
+ .offset( iframe.offset() )[ 0 ];
+ });
+ },
+
+ _unblockFrames: function() {
+ if ( this.iframeBlocks ) {
+ this.iframeBlocks.remove();
+ delete this.iframeBlocks;
+ }
+ },
+
+ _blurActiveElement: function( event ) {
+ var document = this.document[ 0 ];
+
+ // Only need to blur if the event occurred on the draggable itself, see #10527
+ if ( !this.handleElement.is( event.target ) ) {
+ return;
+ }
+
+ // support: IE9
+ // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
+ try {
+
+ // Support: IE9, IE10
+ // If the <body> is blurred, IE will switch windows, see #9520
+ if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
+
+ // Blur any element that currently has focus, see #4261
+ $( document.activeElement ).blur();
+ }
+ } catch ( error ) {}
+ },
+
+ _mouseStart: function(event) {
+
+ var o = this.options;
+
+ //Create and append the visible helper
+ this.helper = this._createHelper(event);
+
+ this.helper.addClass("ui-draggable-dragging");
+
+ //Cache the helper size
+ this._cacheHelperProportions();
+
+ //If ddmanager is used for droppables, set the global draggable
+ if ($.ui.ddmanager) {
+ $.ui.ddmanager.current = this;
+ }
+
+ /*
+ * - Position generation -
+ * This block generates everything position related - it's the core of draggables.
+ */
+
+ //Cache the margins of the original element
+ this._cacheMargins();
+
+ //Store the helper's css position
+ this.cssPosition = this.helper.css( "position" );
+ this.scrollParent = this.helper.scrollParent( true );
+ this.offsetParent = this.helper.offsetParent();
+ this.hasFixedAncestor = this.helper.parents().filter(function() {
+ return $( this ).css( "position" ) === "fixed";
+ }).length > 0;
+
+ //The element's absolute position on the page minus margins
+ this.positionAbs = this.element.offset();
+ this._refreshOffsets( event );
+
+ //Generate the original position
+ this.originalPosition = this.position = this._generatePosition( event, false );
+ this.originalPageX = event.pageX;
+ this.originalPageY = event.pageY;
+
+ //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
+
+ //Set a containment if given in the options
+ this._setContainment();
+
+ //Trigger event + callbacks
+ if (this._trigger("start", event) === false) {
+ this._clear();
+ return false;
+ }
+
+ //Recache the helper size
+ this._cacheHelperProportions();
+
+ //Prepare the droppable offsets
+ if ($.ui.ddmanager && !o.dropBehaviour) {
+ $.ui.ddmanager.prepareOffsets(this, event);
+ }
+
+ // Reset helper's right/bottom css if they're set and set explicit width/height instead
+ // as this prevents resizing of elements with right/bottom set (see #7772)
+ this._normalizeRightBottom();
+
+ this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+
+ //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
+ if ( $.ui.ddmanager ) {
+ $.ui.ddmanager.dragStart(this, event);
+ }
+
+ return true;
+ },
+
+ _refreshOffsets: function( event ) {
+ this.offset = {
+ top: this.positionAbs.top - this.margins.top,
+ left: this.positionAbs.left - this.margins.left,
+ scroll: false,
+ parent: this._getParentOffset(),
+ relative: this._getRelativeOffset()
+ };
+
+ this.offset.click = {
+ left: event.pageX - this.offset.left,
+ top: event.pageY - this.offset.top
+ };
+ },
+
+ _mouseDrag: function(event, noPropagation) {
+ // reset any necessary cached properties (see #5009)
+ if ( this.hasFixedAncestor ) {
+ this.offset.parent = this._getParentOffset();
+ }
+
+ //Compute the helpers position
+ this.position = this._generatePosition( event, true );
+ this.positionAbs = this._convertPositionTo("absolute");
+
+ //Call plugins and callbacks and use the resulting position if something is returned
+ if (!noPropagation) {
+ var ui = this._uiHash();
+ if (this._trigger("drag", event, ui) === false) {
+ this._mouseUp({});
+ return false;
+ }
+ this.position = ui.position;
+ }
+
+ this.helper[ 0 ].style.left = this.position.left + "px";
+ this.helper[ 0 ].style.top = this.position.top + "px";
+
+ if ($.ui.ddmanager) {
+ $.ui.ddmanager.drag(this, event);
+ }
+
+ return false;
+ },
+
+ _mouseStop: function(event) {
+
+ //If we are using droppables, inform the manager about the drop
+ var that = this,
+ dropped = false;
+ if ($.ui.ddmanager && !this.options.dropBehaviour) {
+ dropped = $.ui.ddmanager.drop(this, event);
+ }
+
+ //if a drop comes from outside (a sortable)
+ if (this.dropped) {
+ dropped = this.dropped;
+ this.dropped = false;
+ }
+
+ if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
+ $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
+ if (that._trigger("stop", event) !== false) {
+ that._clear();
+ }
+ });
+ } else {
+ if (this._trigger("stop", event) !== false) {
+ this._clear();
+ }
+ }
+
+ return false;
+ },
+
+ _mouseUp: function( event ) {
+ this._unblockFrames();
+
+ //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
+ if ( $.ui.ddmanager ) {
+ $.ui.ddmanager.dragStop(this, event);
+ }
+
+ // Only need to focus if the event occurred on the draggable itself, see #10527
+ if ( this.handleElement.is( event.target ) ) {
+ // The interaction is over; whether or not the click resulted in a drag, focus the element
+ this.element.focus();
+ }
+
+ return $.ui.mouse.prototype._mouseUp.call(this, event);
+ },
+
+ cancel: function() {
+
+ if (this.helper.is(".ui-draggable-dragging")) {
+ this._mouseUp({});
+ } else {
+ this._clear();
+ }
+
+ return this;
+
+ },
+
+ _getHandle: function(event) {
+ return this.options.handle ?
+ !!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
+ true;
+ },
+
+ _setHandleClassName: function() {
+ this.handleElement = this.options.handle ?
+ this.element.find( this.options.handle ) : this.element;
+ this.handleElement.addClass( "ui-draggable-handle" );
+ },
+
+ _removeHandleClassName: function() {
+ this.handleElement.removeClass( "ui-draggable-handle" );
+ },
+
+ _createHelper: function(event) {
+
+ var o = this.options,
+ helperIsFunction = $.isFunction( o.helper ),
+ helper = helperIsFunction ?
+ $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
+ ( o.helper === "clone" ?
+ this.element.clone().removeAttr( "id" ) :
+ this.element );
+
+ if (!helper.parents("body").length) {
+ helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
+ }
+
+ // http://bugs.jqueryui.com/ticket/9446
+ // a helper function can return the original element
+ // which wouldn't have been set to relative in _create
+ if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
+ this._setPositionRelative();
+ }
+
+ if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
+ helper.css("position", "absolute");
+ }
+
+ return helper;
+
+ },
+
+ _setPositionRelative: function() {
+ if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
+ this.element[ 0 ].style.position = "relative";
+ }
+ },
+
+ _adjustOffsetFromHelper: function(obj) {
+ if (typeof obj === "string") {
+ obj = obj.split(" ");
+ }
+ if ($.isArray(obj)) {
+ obj = { left: +obj[0], top: +obj[1] || 0 };
+ }
+ if ("left" in obj) {
+ this.offset.click.left = obj.left + this.margins.left;
+ }
+ if ("right" in obj) {
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+ }
+ if ("top" in obj) {
+ this.offset.click.top = obj.top + this.margins.top;
+ }
+ if ("bottom" in obj) {
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+ }
+ },
+
+ _isRootNode: function( element ) {
+ return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
+ },
+
+ _getParentOffset: function() {
+
+ //Get the offsetParent and cache its position
+ var po = this.offsetParent.offset(),
+ document = this.document[ 0 ];
+
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
+ if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
+ po.left += this.scrollParent.scrollLeft();
+ po.top += this.scrollParent.scrollTop();
+ }
+
+ if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
+ po = { top: 0, left: 0 };
+ }
+
+ return {
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
+ };
+
+ },
+
+ _getRelativeOffset: function() {
+ if ( this.cssPosition !== "relative" ) {
+ return { top: 0, left: 0 };
+ }
+
+ var p = this.element.position(),
+ scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
+
+ return {
+ top: p.top - ( parseInt(this.helper.css( "top" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
+ left: p.left - ( parseInt(this.helper.css( "left" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
+ };
+
+ },
+
+ _cacheMargins: function() {
+ this.margins = {
+ left: (parseInt(this.element.css("marginLeft"), 10) || 0),
+ top: (parseInt(this.element.css("marginTop"), 10) || 0),
+ right: (parseInt(this.element.css("marginRight"), 10) || 0),
+ bottom: (parseInt(this.element.css("marginBottom"), 10) || 0)
+ };
+ },
+
+ _cacheHelperProportions: function() {
+ this.helperProportions = {
+ width: this.helper.outerWidth(),
+ height: this.helper.outerHeight()
+ };
+ },
+
+ _setContainment: function() {
+
+ var isUserScrollable, c, ce,
+ o = this.options,
+ document = this.document[ 0 ];
+
+ this.relativeContainer = null;
+
+ if ( !o.containment ) {
+ this.containment = null;
+ return;
+ }
+
+ if ( o.containment === "window" ) {
+ this.containment = [
+ $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
+ $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
+ $( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left,
+ $( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
+ ];
+ return;
+ }
+
+ if ( o.containment === "document") {
+ this.containment = [
+ 0,
+ 0,
+ $( document ).width() - this.helperProportions.width - this.margins.left,
+ ( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
+ ];
+ return;
+ }
+
+ if ( o.containment.constructor === Array ) {
+ this.containment = o.containment;
+ return;
+ }
+
+ if ( o.containment === "parent" ) {
+ o.containment = this.helper[ 0 ].parentNode;
+ }
+
+ c = $( o.containment );
+ ce = c[ 0 ];
+
+ if ( !ce ) {
+ return;
+ }
+
+ isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
+
+ this.containment = [
+ ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
+ ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
+ ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
+ ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
+ ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
+ this.helperProportions.width -
+ this.margins.left -
+ this.margins.right,
+ ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
+ ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
+ ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
+ this.helperProportions.height -
+ this.margins.top -
+ this.margins.bottom
+ ];
+ this.relativeContainer = c;
+ },
+
+ _convertPositionTo: function(d, pos) {
+
+ if (!pos) {
+ pos = this.position;
+ }
+
+ var mod = d === "absolute" ? 1 : -1,
+ scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
+
+ return {
+ top: (
+ pos.top + // The absolute mouse position
+ this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
+ ( ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod)
+ ),
+ left: (
+ pos.left + // The absolute mouse position
+ this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
+ ( ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod)
+ )
+ };
+
+ },
+
+ _generatePosition: function( event, constrainPosition ) {
+
+ var containment, co, top, left,
+ o = this.options,
+ scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
+ pageX = event.pageX,
+ pageY = event.pageY;
+
+ // Cache the scroll
+ if ( !scrollIsRootNode || !this.offset.scroll ) {
+ this.offset.scroll = {
+ top: this.scrollParent.scrollTop(),
+ left: this.scrollParent.scrollLeft()
+ };
+ }
+
+ /*
+ * - Position constraining -
+ * Constrain the position to a mix of grid, containment.
+ */
+
+ // If we are not dragging yet, we won't check for options
+ if ( constrainPosition ) {
+ if ( this.containment ) {
+ if ( this.relativeContainer ){
+ co = this.relativeContainer.offset();
+ containment = [
+ this.containment[ 0 ] + co.left,
+ this.containment[ 1 ] + co.top,
+ this.containment[ 2 ] + co.left,
+ this.containment[ 3 ] + co.top
+ ];
+ } else {
+ containment = this.containment;
+ }
+
+ if (event.pageX - this.offset.click.left < containment[0]) {
+ pageX = containment[0] + this.offset.click.left;
+ }
+ if (event.pageY - this.offset.click.top < containment[1]) {
+ pageY = containment[1] + this.offset.click.top;
+ }
+ if (event.pageX - this.offset.click.left > containment[2]) {
+ pageX = containment[2] + this.offset.click.left;
+ }
+ if (event.pageY - this.offset.click.top > containment[3]) {
+ pageY = containment[3] + this.offset.click.top;
+ }
+ }
+
+ if (o.grid) {
+ //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
+ top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
+ pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+
+ left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
+ pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+ }
+
+ if ( o.axis === "y" ) {
+ pageX = this.originalPageX;
+ }
+
+ if ( o.axis === "x" ) {
+ pageY = this.originalPageY;
+ }
+ }
+
+ return {
+ top: (
+ pageY - // The absolute mouse position
+ this.offset.click.top - // Click offset (relative to the element)
+ this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
+ ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
+ ),
+ left: (
+ pageX - // The absolute mouse position
+ this.offset.click.left - // Click offset (relative to the element)
+ this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
+ ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
+ )
+ };
+
+ },
+
+ _clear: function() {
+ this.helper.removeClass("ui-draggable-dragging");
+ if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
+ this.helper.remove();
+ }
+ this.helper = null;
+ this.cancelHelperRemoval = false;
+ if ( this.destroyOnClear ) {
+ this.destroy();
+ }
+ },
+
+ _normalizeRightBottom: function() {
+ if ( this.options.axis !== "y" && this.helper.css( "right" ) !== "auto" ) {
+ this.helper.width( this.helper.width() );
+ this.helper.css( "right", "auto" );
+ }
+ if ( this.options.axis !== "x" && this.helper.css( "bottom" ) !== "auto" ) {
+ this.helper.height( this.helper.height() );
+ this.helper.css( "bottom", "auto" );
+ }
+ },
+
+ // From now on bulk stuff - mainly helpers
+
+ _trigger: function( type, event, ui ) {
+ ui = ui || this._uiHash();
+ $.ui.plugin.call( this, type, [ event, ui, this ], true );
+
+ // Absolute position and offset (see #6884 ) have to be recalculated after plugins
+ if ( /^(drag|start|stop)/.test( type ) ) {
+ this.positionAbs = this._convertPositionTo( "absolute" );
+ ui.offset = this.positionAbs;
+ }
+ return $.Widget.prototype._trigger.call( this, type, event, ui );
+ },
+
+ plugins: {},
+
+ _uiHash: function() {
+ return {
+ helper: this.helper,
+ position: this.position,
+ originalPosition: this.originalPosition,
+ offset: this.positionAbs
+ };
+ }
+
+});
+
+$.ui.plugin.add( "draggable", "connectToSortable", {
+ start: function( event, ui, draggable ) {
+ var uiSortable = $.extend( {}, ui, {
+ item: draggable.element
+ });
+
+ draggable.sortables = [];
+ $( draggable.options.connectToSortable ).each(function() {
+ var sortable = $( this ).sortable( "instance" );
+
+ if ( sortable && !sortable.options.disabled ) {
+ draggable.sortables.push( sortable );
+
+ // refreshPositions is called at drag start to refresh the containerCache
+ // which is used in drag. This ensures it's initialized and synchronized
+ // with any changes that might have happened on the page since initialization.
+ sortable.refreshPositions();
+ sortable._trigger("activate", event, uiSortable);
+ }
+ });
+ },
+ stop: function( event, ui, draggable ) {
+ var uiSortable = $.extend( {}, ui, {
+ item: draggable.element
+ });
+
+ draggable.cancelHelperRemoval = false;
+
+ $.each( draggable.sortables, function() {
+ var sortable = this;
+
+ if ( sortable.isOver ) {
+ sortable.isOver = 0;
+
+ // Allow this sortable to handle removing the helper
+ draggable.cancelHelperRemoval = true;
+ sortable.cancelHelperRemoval = false;
+
+ // Use _storedCSS To restore properties in the sortable,
+ // as this also handles revert (#9675) since the draggable
+ // may have modified them in unexpected ways (#8809)
+ sortable._storedCSS = {
+ position: sortable.placeholder.css( "position" ),
+ top: sortable.placeholder.css( "top" ),
+ left: sortable.placeholder.css( "left" )
+ };
+
+ sortable._mouseStop(event);
+
+ // Once drag has ended, the sortable should return to using
+ // its original helper, not the shared helper from draggable
+ sortable.options.helper = sortable.options._helper;
+ } else {
+ // Prevent this Sortable from removing the helper.
+ // However, don't set the draggable to remove the helper
+ // either as another connected Sortable may yet handle the removal.
+ sortable.cancelHelperRemoval = true;
+
+ sortable._trigger( "deactivate", event, uiSortable );
+ }
+ });
+ },
+ drag: function( event, ui, draggable ) {
+ $.each( draggable.sortables, function() {
+ var innermostIntersecting = false,
+ sortable = this;
+
+ // Copy over variables that sortable's _intersectsWith uses
+ sortable.positionAbs = draggable.positionAbs;
+ sortable.helperProportions = draggable.helperProportions;
+ sortable.offset.click = draggable.offset.click;
+
+ if ( sortable._intersectsWith( sortable.containerCache ) ) {
+ innermostIntersecting = true;
+
+ $.each( draggable.sortables, function() {
+ // Copy over variables that sortable's _intersectsWith uses
+ this.positionAbs = draggable.positionAbs;
+ this.helperProportions = draggable.helperProportions;
+ this.offset.click = draggable.offset.click;
+
+ if ( this !== sortable &&
+ this._intersectsWith( this.containerCache ) &&
+ $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
+ innermostIntersecting = false;
+ }
+
+ return innermostIntersecting;
+ });
+ }
+
+ if ( innermostIntersecting ) {
+ // If it intersects, we use a little isOver variable and set it once,
+ // so that the move-in stuff gets fired only once.
+ if ( !sortable.isOver ) {
+ sortable.isOver = 1;
+
+ // Store draggable's parent in case we need to reappend to it later.
+ draggable._parent = ui.helper.parent();
+
+ sortable.currentItem = ui.helper
+ .appendTo( sortable.element )
+ .data( "ui-sortable-item", true );
+
+ // Store helper option to later restore it
+ sortable.options._helper = sortable.options.helper;
+
+ sortable.options.helper = function() {
+ return ui.helper[ 0 ];
+ };
+
+ // Fire the start events of the sortable with our passed browser event,
+ // and our own helper (so it doesn't create a new one)
+ event.target = sortable.currentItem[ 0 ];
+ sortable._mouseCapture( event, true );
+ sortable._mouseStart( event, true, true );
+
+ // Because the browser event is way off the new appended portlet,
+ // modify necessary variables to reflect the changes
+ sortable.offset.click.top = draggable.offset.click.top;
+ sortable.offset.click.left = draggable.offset.click.left;
+ sortable.offset.parent.left -= draggable.offset.parent.left -
+ sortable.offset.parent.left;
+ sortable.offset.parent.top -= draggable.offset.parent.top -
+ sortable.offset.parent.top;
+
+ draggable._trigger( "toSortable", event );
+
+ // Inform draggable that the helper is in a valid drop zone,
+ // used solely in the revert option to handle "valid/invalid".
+ draggable.dropped = sortable.element;
+
+ // Need to refreshPositions of all sortables in the case that
+ // adding to one sortable changes the location of the other sortables (#9675)
+ $.each( draggable.sortables, function() {
+ this.refreshPositions();
+ });
+
+ // hack so receive/update callbacks work (mostly)
+ draggable.currentItem = draggable.element;
+ sortable.fromOutside = draggable;
+ }
+
+ if ( sortable.currentItem ) {
+ sortable._mouseDrag( event );
+ // Copy the sortable's position because the draggable's can potentially reflect
+ // a relative position, while sortable is always absolute, which the dragged
+ // element has now become. (#8809)
+ ui.position = sortable.position;
+ }
+ } else {
+ // If it doesn't intersect with the sortable, and it intersected before,
+ // we fake the drag stop of the sortable, but make sure it doesn't remove
+ // the helper by using cancelHelperRemoval.
+ if ( sortable.isOver ) {
+
+ sortable.isOver = 0;
+ sortable.cancelHelperRemoval = true;
+
+ // Calling sortable's mouseStop would trigger a revert,
+ // so revert must be temporarily false until after mouseStop is called.
+ sortable.options._revert = sortable.options.revert;
+ sortable.options.revert = false;
+
+ sortable._trigger( "out", event, sortable._uiHash( sortable ) );
+ sortable._mouseStop( event, true );
+
+ // restore sortable behaviors that were modfied
+ // when the draggable entered the sortable area (#9481)
+ sortable.options.revert = sortable.options._revert;
+ sortable.options.helper = sortable.options._helper;
+
+ if ( sortable.placeholder ) {
+ sortable.placeholder.remove();
+ }
+
+ // Restore and recalculate the draggable's offset considering the sortable
+ // may have modified them in unexpected ways. (#8809, #10669)
+ ui.helper.appendTo( draggable._parent );
+ draggable._refreshOffsets( event );
+ ui.position = draggable._generatePosition( event, true );
+
+ draggable._trigger( "fromSortable", event );
+
+ // Inform draggable that the helper is no longer in a valid drop zone
+ draggable.dropped = false;
+
+ // Need to refreshPositions of all sortables just in case removing
+ // from one sortable changes the location of other sortables (#9675)
+ $.each( draggable.sortables, function() {
+ this.refreshPositions();
+ });
+ }
+ }
+ });
+ }
+});
+
+$.ui.plugin.add("draggable", "cursor", {
+ start: function( event, ui, instance ) {
+ var t = $( "body" ),
+ o = instance.options;
+
+ if (t.css("cursor")) {
+ o._cursor = t.css("cursor");
+ }
+ t.css("cursor", o.cursor);
+ },
+ stop: function( event, ui, instance ) {
+ var o = instance.options;
+ if (o._cursor) {
+ $("body").css("cursor", o._cursor);
+ }
+ }
+});
+
+$.ui.plugin.add("draggable", "opacity", {
+ start: function( event, ui, instance ) {
+ var t = $( ui.helper ),
+ o = instance.options;
+ if (t.css("opacity")) {
+ o._opacity = t.css("opacity");
+ }
+ t.css("opacity", o.opacity);
+ },
+ stop: function( event, ui, instance ) {
+ var o = instance.options;
+ if (o._opacity) {
+ $(ui.helper).css("opacity", o._opacity);
+ }
+ }
+});
+
+$.ui.plugin.add("draggable", "scroll", {
+ start: function( event, ui, i ) {
+ if ( !i.scrollParentNotHidden ) {
+ i.scrollParentNotHidden = i.helper.scrollParent( false );
+ }
+
+ if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
+ i.overflowOffset = i.scrollParentNotHidden.offset();
+ }
+ },
+ drag: function( event, ui, i ) {
+
+ var o = i.options,
+ scrolled = false,
+ scrollParent = i.scrollParentNotHidden[ 0 ],
+ document = i.document[ 0 ];
+
+ if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
+ if ( !o.axis || o.axis !== "x" ) {
+ if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < o.scrollSensitivity ) {
+ scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
+ } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
+ scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
+ }
+ }
+
+ if ( !o.axis || o.axis !== "y" ) {
+ if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < o.scrollSensitivity ) {
+ scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
+ } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
+ scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
+ }
+ }
+
+ } else {
+
+ if (!o.axis || o.axis !== "x") {
+ if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+ } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+ }
+ }
+
+ if (!o.axis || o.axis !== "y") {
+ if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+ } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+ }
+ }
+
+ }
+
+ if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
+ $.ui.ddmanager.prepareOffsets(i, event);
+ }
+
+ }
+});
+
+$.ui.plugin.add("draggable", "snap", {
+ start: function( event, ui, i ) {
+
+ var o = i.options;
+
+ i.snapElements = [];
+
+ $(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
+ var $t = $(this),
+ $o = $t.offset();
+ if (this !== i.element[0]) {
+ i.snapElements.push({
+ item: this,
+ width: $t.outerWidth(), height: $t.outerHeight(),
+ top: $o.top, left: $o.left
+ });
+ }
+ });
+
+ },
+ drag: function( event, ui, inst ) {
+
+ var ts, bs, ls, rs, l, r, t, b, i, first,
+ o = inst.options,
+ d = o.snapTolerance,
+ x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
+ y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
+
+ for (i = inst.snapElements.length - 1; i >= 0; i--){
+
+ l = inst.snapElements[i].left - inst.margins.left;
+ r = l + inst.snapElements[i].width;
+ t = inst.snapElements[i].top - inst.margins.top;
+ b = t + inst.snapElements[i].height;
+
+ if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
+ if (inst.snapElements[i].snapping) {
+ (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+ }
+ inst.snapElements[i].snapping = false;
+ continue;
+ }
+
+ if (o.snapMode !== "inner") {
+ ts = Math.abs(t - y2) <= d;
+ bs = Math.abs(b - y1) <= d;
+ ls = Math.abs(l - x2) <= d;
+ rs = Math.abs(r - x1) <= d;
+ if (ts) {
+ ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
+ }
+ if (bs) {
+ ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
+ }
+ if (ls) {
+ ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
+ }
+ if (rs) {
+ ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
+ }
+ }
+
+ first = (ts || bs || ls || rs);
+
+ if (o.snapMode !== "outer") {
+ ts = Math.abs(t - y1) <= d;
+ bs = Math.abs(b - y2) <= d;
+ ls = Math.abs(l - x1) <= d;
+ rs = Math.abs(r - x2) <= d;
+ if (ts) {
+ ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
+ }
+ if (bs) {
+ ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
+ }
+ if (ls) {
+ ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
+ }
+ if (rs) {
+ ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
+ }
+ }
+
+ if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
+ (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+ }
+ inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
+
+ }
+
+ }
+});
+
+$.ui.plugin.add("draggable", "stack", {
+ start: function( event, ui, instance ) {
+ var min,
+ o = instance.options,
+ group = $.makeArray($(o.stack)).sort(function(a, b) {
+ return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0);
+ });
+
+ if (!group.length) { return; }
+
+ min = parseInt($(group[0]).css("zIndex"), 10) || 0;
+ $(group).each(function(i) {
+ $(this).css("zIndex", min + i);
+ });
+ this.css("zIndex", (min + group.length));
+ }
+});
+
+$.ui.plugin.add("draggable", "zIndex", {
+ start: function( event, ui, instance ) {
+ var t = $( ui.helper ),
+ o = instance.options;
+
+ if (t.css("zIndex")) {
+ o._zIndex = t.css("zIndex");
+ }
+ t.css("zIndex", o.zIndex);
+ },
+ stop: function( event, ui, instance ) {
+ var o = instance.options;
+
+ if (o._zIndex) {
+ $(ui.helper).css("zIndex", o._zIndex);
+ }
+ }
+});
+
+var draggable = $.ui.draggable;
+
+
+/*!
+ * jQuery UI Resizable 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/resizable/
+ */
+
+
+$.widget("ui.resizable", $.ui.mouse, {
+ version: "1.11.4",
+ widgetEventPrefix: "resize",
+ options: {
+ alsoResize: false,
+ animate: false,
+ animateDuration: "slow",
+ animateEasing: "swing",
+ aspectRatio: false,
+ autoHide: false,
+ containment: false,
+ ghost: false,
+ grid: false,
+ handles: "e,s,se",
+ helper: false,
+ maxHeight: null,
+ maxWidth: null,
+ minHeight: 10,
+ minWidth: 10,
+ // See #7960
+ zIndex: 90,
+
+ // callbacks
+ resize: null,
+ start: null,
+ stop: null
+ },
+
+ _num: function( value ) {
+ return parseInt( value, 10 ) || 0;
+ },
+
+ _isNumber: function( value ) {
+ return !isNaN( parseInt( value, 10 ) );
+ },
+
+ _hasScroll: function( el, a ) {
+
+ if ( $( el ).css( "overflow" ) === "hidden") {
+ return false;
+ }
+
+ var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
+ has = false;
+
+ if ( el[ scroll ] > 0 ) {
+ return true;
+ }
+
+ // TODO: determine which cases actually cause this to happen
+ // if the element doesn't have the scroll set, see if it's possible to
+ // set the scroll
+ el[ scroll ] = 1;
+ has = ( el[ scroll ] > 0 );
+ el[ scroll ] = 0;
+ return has;
+ },
+
+ _create: function() {
+
+ var n, i, handle, axis, hname,
+ that = this,
+ o = this.options;
+ this.element.addClass("ui-resizable");
+
+ $.extend(this, {
+ _aspectRatio: !!(o.aspectRatio),
+ aspectRatio: o.aspectRatio,
+ originalElement: this.element,
+ _proportionallyResizeElements: [],
+ _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
+ });
+
+ // Wrap the element if it cannot hold child nodes
+ if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) {
+
+ this.element.wrap(
+ $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
+ position: this.element.css("position"),
+ width: this.element.outerWidth(),
+ height: this.element.outerHeight(),
+ top: this.element.css("top"),
+ left: this.element.css("left")
+ })
+ );
+
+ this.element = this.element.parent().data(
+ "ui-resizable", this.element.resizable( "instance" )
+ );
+
+ this.elementIsWrapper = true;
+
+ this.element.css({
+ marginLeft: this.originalElement.css("marginLeft"),
+ marginTop: this.originalElement.css("marginTop"),
+ marginRight: this.originalElement.css("marginRight"),
+ marginBottom: this.originalElement.css("marginBottom")
+ });
+ this.originalElement.css({
+ marginLeft: 0,
+ marginTop: 0,
+ marginRight: 0,
+ marginBottom: 0
+ });
+ // support: Safari
+ // Prevent Safari textarea resize
+ this.originalResizeStyle = this.originalElement.css("resize");
+ this.originalElement.css("resize", "none");
+
+ this._proportionallyResizeElements.push( this.originalElement.css({
+ position: "static",
+ zoom: 1,
+ display: "block"
+ }) );
+
+ // support: IE9
+ // avoid IE jump (hard set the margin)
+ this.originalElement.css({ margin: this.originalElement.css("margin") });
+
+ this._proportionallyResize();
+ }
+
+ this.handles = o.handles ||
+ ( !$(".ui-resizable-handle", this.element).length ?
+ "e,s,se" : {
+ n: ".ui-resizable-n",
+ e: ".ui-resizable-e",
+ s: ".ui-resizable-s",
+ w: ".ui-resizable-w",
+ se: ".ui-resizable-se",
+ sw: ".ui-resizable-sw",
+ ne: ".ui-resizable-ne",
+ nw: ".ui-resizable-nw"
+ } );
+
+ this._handles = $();
+ if ( this.handles.constructor === String ) {
+
+ if ( this.handles === "all") {
+ this.handles = "n,e,s,w,se,sw,ne,nw";
+ }
+
+ n = this.handles.split(",");
+ this.handles = {};
+
+ for (i = 0; i < n.length; i++) {
+
+ handle = $.trim(n[i]);
+ hname = "ui-resizable-" + handle;
+ axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
+
+ axis.css({ zIndex: o.zIndex });
+
+ // TODO : What's going on here?
+ if ("se" === handle) {
+ axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
+ }
+
+ this.handles[handle] = ".ui-resizable-" + handle;
+ this.element.append(axis);
+ }
+
+ }
+
+ this._renderAxis = function(target) {
+
+ var i, axis, padPos, padWrapper;
+
+ target = target || this.element;
+
+ for (i in this.handles) {
+
+ if (this.handles[i].constructor === String) {
+ this.handles[i] = this.element.children( this.handles[ i ] ).first().show();
+ } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
+ this.handles[ i ] = $( this.handles[ i ] );
+ this._on( this.handles[ i ], { "mousedown": that._mouseDown });
+ }
+
+ if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)) {
+
+ axis = $(this.handles[i], this.element);
+
+ padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
+
+ padPos = [ "padding",
+ /ne|nw|n/.test(i) ? "Top" :
+ /se|sw|s/.test(i) ? "Bottom" :
+ /^e$/.test(i) ? "Right" : "Left" ].join("");
+
+ target.css(padPos, padWrapper);
+
+ this._proportionallyResize();
+ }
+
+ this._handles = this._handles.add( this.handles[ i ] );
+ }
+ };
+
+ // TODO: make renderAxis a prototype function
+ this._renderAxis(this.element);
+
+ this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
+ this._handles.disableSelection();
+
+ this._handles.mouseover(function() {
+ if (!that.resizing) {
+ if (this.className) {
+ axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
+ }
+ that.axis = axis && axis[1] ? axis[1] : "se";
+ }
+ });
+
+ if (o.autoHide) {
+ this._handles.hide();
+ $(this.element)
+ .addClass("ui-resizable-autohide")
+ .mouseenter(function() {
+ if (o.disabled) {
+ return;
+ }
+ $(this).removeClass("ui-resizable-autohide");
+ that._handles.show();
+ })
+ .mouseleave(function() {
+ if (o.disabled) {
+ return;
+ }
+ if (!that.resizing) {
+ $(this).addClass("ui-resizable-autohide");
+ that._handles.hide();
+ }
+ });
+ }
+
+ this._mouseInit();
+ },
+
+ _destroy: function() {
+
+ this._mouseDestroy();
+
+ var wrapper,
+ _destroy = function(exp) {
+ $(exp)
+ .removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
+ .removeData("resizable")
+ .removeData("ui-resizable")
+ .unbind(".resizable")
+ .find(".ui-resizable-handle")
+ .remove();
+ };
+
+ // TODO: Unwrap at same DOM position
+ if (this.elementIsWrapper) {
+ _destroy(this.element);
+ wrapper = this.element;
+ this.originalElement.css({
+ position: wrapper.css("position"),
+ width: wrapper.outerWidth(),
+ height: wrapper.outerHeight(),
+ top: wrapper.css("top"),
+ left: wrapper.css("left")
+ }).insertAfter( wrapper );
+ wrapper.remove();
+ }
+
+ this.originalElement.css("resize", this.originalResizeStyle);
+ _destroy(this.originalElement);
+
+ return this;
+ },
+
+ _mouseCapture: function(event) {
+ var i, handle,
+ capture = false;
+
+ for (i in this.handles) {
+ handle = $(this.handles[i])[0];
+ if (handle === event.target || $.contains(handle, event.target)) {
+ capture = true;
+ }
+ }
+
+ return !this.options.disabled && capture;
+ },
+
+ _mouseStart: function(event) {
+
+ var curleft, curtop, cursor,
+ o = this.options,
+ el = this.element;
+
+ this.resizing = true;
+
+ this._renderProxy();
+
+ curleft = this._num(this.helper.css("left"));
+ curtop = this._num(this.helper.css("top"));
+
+ if (o.containment) {
+ curleft += $(o.containment).scrollLeft() || 0;
+ curtop += $(o.containment).scrollTop() || 0;
+ }
+
+ this.offset = this.helper.offset();
+ this.position = { left: curleft, top: curtop };
+
+ this.size = this._helper ? {
+ width: this.helper.width(),
+ height: this.helper.height()
+ } : {
+ width: el.width(),
+ height: el.height()
+ };
+
+ this.originalSize = this._helper ? {
+ width: el.outerWidth(),
+ height: el.outerHeight()
+ } : {
+ width: el.width(),
+ height: el.height()
+ };
+
+ this.sizeDiff = {
+ width: el.outerWidth() - el.width(),
+ height: el.outerHeight() - el.height()
+ };
+
+ this.originalPosition = { left: curleft, top: curtop };
+ this.originalMousePosition = { left: event.pageX, top: event.pageY };
+
+ this.aspectRatio = (typeof o.aspectRatio === "number") ?
+ o.aspectRatio :
+ ((this.originalSize.width / this.originalSize.height) || 1);
+
+ cursor = $(".ui-resizable-" + this.axis).css("cursor");
+ $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
+
+ el.addClass("ui-resizable-resizing");
+ this._propagate("start", event);
+ return true;
+ },
+
+ _mouseDrag: function(event) {
+
+ var data, props,
+ smp = this.originalMousePosition,
+ a = this.axis,
+ dx = (event.pageX - smp.left) || 0,
+ dy = (event.pageY - smp.top) || 0,
+ trigger = this._change[a];
+
+ this._updatePrevProperties();
+
+ if (!trigger) {
+ return false;
+ }
+
+ data = trigger.apply(this, [ event, dx, dy ]);
+
+ this._updateVirtualBoundaries(event.shiftKey);
+ if (this._aspectRatio || event.shiftKey) {
+ data = this._updateRatio(data, event);
+ }
+
+ data = this._respectSize(data, event);
+
+ this._updateCache(data);
+
+ this._propagate("resize", event);
+
+ props = this._applyChanges();
+
+ if ( !this._helper && this._proportionallyResizeElements.length ) {
+ this._proportionallyResize();
+ }
+
+ if ( !$.isEmptyObject( props ) ) {
+ this._updatePrevProperties();
+ this._trigger( "resize", event, this.ui() );
+ this._applyChanges();
+ }
+
+ return false;
+ },
+
+ _mouseStop: function(event) {
+
+ this.resizing = false;
+ var pr, ista, soffseth, soffsetw, s, left, top,
+ o = this.options, that = this;
+
+ if (this._helper) {
+
+ pr = this._proportionallyResizeElements;
+ ista = pr.length && (/textarea/i).test(pr[0].nodeName);
+ soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height;
+ soffsetw = ista ? 0 : that.sizeDiff.width;
+
+ s = {
+ width: (that.helper.width() - soffsetw),
+ height: (that.helper.height() - soffseth)
+ };
+ left = (parseInt(that.element.css("left"), 10) +
+ (that.position.left - that.originalPosition.left)) || null;
+ top = (parseInt(that.element.css("top"), 10) +
+ (that.position.top - that.originalPosition.top)) || null;
+
+ if (!o.animate) {
+ this.element.css($.extend(s, { top: top, left: left }));
+ }
+
+ that.helper.height(that.size.height);
+ that.helper.width(that.size.width);
+
+ if (this._helper && !o.animate) {
+ this._proportionallyResize();
+ }
+ }
+
+ $("body").css("cursor", "auto");
+
+ this.element.removeClass("ui-resizable-resizing");
+
+ this._propagate("stop", event);
+
+ if (this._helper) {
+ this.helper.remove();
+ }
+
+ return false;
+
+ },
+
+ _updatePrevProperties: function() {
+ this.prevPosition = {
+ top: this.position.top,
+ left: this.position.left
+ };
+ this.prevSize = {
+ width: this.size.width,
+ height: this.size.height
+ };
+ },
+
+ _applyChanges: function() {
+ var props = {};
+
+ if ( this.position.top !== this.prevPosition.top ) {
+ props.top = this.position.top + "px";
+ }
+ if ( this.position.left !== this.prevPosition.left ) {
+ props.left = this.position.left + "px";
+ }
+ if ( this.size.width !== this.prevSize.width ) {
+ props.width = this.size.width + "px";
+ }
+ if ( this.size.height !== this.prevSize.height ) {
+ props.height = this.size.height + "px";
+ }
+
+ this.helper.css( props );
+
+ return props;
+ },
+
+ _updateVirtualBoundaries: function(forceAspectRatio) {
+ var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
+ o = this.options;
+
+ b = {
+ minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0,
+ maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity,
+ minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0,
+ maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity
+ };
+
+ if (this._aspectRatio || forceAspectRatio) {
+ pMinWidth = b.minHeight * this.aspectRatio;
+ pMinHeight = b.minWidth / this.aspectRatio;
+ pMaxWidth = b.maxHeight * this.aspectRatio;
+ pMaxHeight = b.maxWidth / this.aspectRatio;
+
+ if (pMinWidth > b.minWidth) {
+ b.minWidth = pMinWidth;
+ }
+ if (pMinHeight > b.minHeight) {
+ b.minHeight = pMinHeight;
+ }
+ if (pMaxWidth < b.maxWidth) {
+ b.maxWidth = pMaxWidth;
+ }
+ if (pMaxHeight < b.maxHeight) {
+ b.maxHeight = pMaxHeight;
+ }
+ }
+ this._vBoundaries = b;
+ },
+
+ _updateCache: function(data) {
+ this.offset = this.helper.offset();
+ if (this._isNumber(data.left)) {
+ this.position.left = data.left;
+ }
+ if (this._isNumber(data.top)) {
+ this.position.top = data.top;
+ }
+ if (this._isNumber(data.height)) {
+ this.size.height = data.height;
+ }
+ if (this._isNumber(data.width)) {
+ this.size.width = data.width;
+ }
+ },
+
+ _updateRatio: function( data ) {
+
+ var cpos = this.position,
+ csize = this.size,
+ a = this.axis;
+
+ if (this._isNumber(data.height)) {
+ data.width = (data.height * this.aspectRatio);
+ } else if (this._isNumber(data.width)) {
+ data.height = (data.width / this.aspectRatio);
+ }
+
+ if (a === "sw") {
+ data.left = cpos.left + (csize.width - data.width);
+ data.top = null;
+ }
+ if (a === "nw") {
+ data.top = cpos.top + (csize.height - data.height);
+ data.left = cpos.left + (csize.width - data.width);
+ }
+
+ return data;
+ },
+
+ _respectSize: function( data ) {
+
+ var o = this._vBoundaries,
+ a = this.axis,
+ ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width),
+ ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
+ isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width),
+ isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
+ dw = this.originalPosition.left + this.originalSize.width,
+ dh = this.position.top + this.size.height,
+ cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
+ if (isminw) {
+ data.width = o.minWidth;
+ }
+ if (isminh) {
+ data.height = o.minHeight;
+ }
+ if (ismaxw) {
+ data.width = o.maxWidth;
+ }
+ if (ismaxh) {
+ data.height = o.maxHeight;
+ }
+
+ if (isminw && cw) {
+ data.left = dw - o.minWidth;
+ }
+ if (ismaxw && cw) {
+ data.left = dw - o.maxWidth;
+ }
+ if (isminh && ch) {
+ data.top = dh - o.minHeight;
+ }
+ if (ismaxh && ch) {
+ data.top = dh - o.maxHeight;
+ }
+
+ // Fixing jump error on top/left - bug #2330
+ if (!data.width && !data.height && !data.left && data.top) {
+ data.top = null;
+ } else if (!data.width && !data.height && !data.top && data.left) {
+ data.left = null;
+ }
+
+ return data;
+ },
+
+ _getPaddingPlusBorderDimensions: function( element ) {
+ var i = 0,
+ widths = [],
+ borders = [
+ element.css( "borderTopWidth" ),
+ element.css( "borderRightWidth" ),
+ element.css( "borderBottomWidth" ),
+ element.css( "borderLeftWidth" )
+ ],
+ paddings = [
+ element.css( "paddingTop" ),
+ element.css( "paddingRight" ),
+ element.css( "paddingBottom" ),
+ element.css( "paddingLeft" )
+ ];
+
+ for ( ; i < 4; i++ ) {
+ widths[ i ] = ( parseInt( borders[ i ], 10 ) || 0 );
+ widths[ i ] += ( parseInt( paddings[ i ], 10 ) || 0 );
+ }
+
+ return {
+ height: widths[ 0 ] + widths[ 2 ],
+ width: widths[ 1 ] + widths[ 3 ]
+ };
+ },
+
+ _proportionallyResize: function() {
+
+ if (!this._proportionallyResizeElements.length) {
+ return;
+ }
+
+ var prel,
+ i = 0,
+ element = this.helper || this.element;
+
+ for ( ; i < this._proportionallyResizeElements.length; i++) {
+
+ prel = this._proportionallyResizeElements[i];
+
+ // TODO: Seems like a bug to cache this.outerDimensions
+ // considering that we are in a loop.
+ if (!this.outerDimensions) {
+ this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
+ }
+
+ prel.css({
+ height: (element.height() - this.outerDimensions.height) || 0,
+ width: (element.width() - this.outerDimensions.width) || 0
+ });
+
+ }
+
+ },
+
+ _renderProxy: function() {
+
+ var el = this.element, o = this.options;
+ this.elementOffset = el.offset();
+
+ if (this._helper) {
+
+ this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
+
+ this.helper.addClass(this._helper).css({
+ width: this.element.outerWidth() - 1,
+ height: this.element.outerHeight() - 1,
+ position: "absolute",
+ left: this.elementOffset.left + "px",
+ top: this.elementOffset.top + "px",
+ zIndex: ++o.zIndex //TODO: Don't modify option
+ });
+
+ this.helper
+ .appendTo("body")
+ .disableSelection();
+
+ } else {
+ this.helper = this.element;
+ }
+
+ },
+
+ _change: {
+ e: function(event, dx) {
+ return { width: this.originalSize.width + dx };
+ },
+ w: function(event, dx) {
+ var cs = this.originalSize, sp = this.originalPosition;
+ return { left: sp.left + dx, width: cs.width - dx };
+ },
+ n: function(event, dx, dy) {
+ var cs = this.originalSize, sp = this.originalPosition;
+ return { top: sp.top + dy, height: cs.height - dy };
+ },
+ s: function(event, dx, dy) {
+ return { height: this.originalSize.height + dy };
+ },
+ se: function(event, dx, dy) {
+ return $.extend(this._change.s.apply(this, arguments),
+ this._change.e.apply(this, [ event, dx, dy ]));
+ },
+ sw: function(event, dx, dy) {
+ return $.extend(this._change.s.apply(this, arguments),
+ this._change.w.apply(this, [ event, dx, dy ]));
+ },
+ ne: function(event, dx, dy) {
+ return $.extend(this._change.n.apply(this, arguments),
+ this._change.e.apply(this, [ event, dx, dy ]));
+ },
+ nw: function(event, dx, dy) {
+ return $.extend(this._change.n.apply(this, arguments),
+ this._change.w.apply(this, [ event, dx, dy ]));
+ }
+ },
+
+ _propagate: function(n, event) {
+ $.ui.plugin.call(this, n, [ event, this.ui() ]);
+ (n !== "resize" && this._trigger(n, event, this.ui()));
+ },
+
+ plugins: {},
+
+ ui: function() {
+ return {
+ originalElement: this.originalElement,
+ element: this.element,
+ helper: this.helper,
+ position: this.position,
+ size: this.size,
+ originalSize: this.originalSize,
+ originalPosition: this.originalPosition
+ };
+ }
+
+});
+
+/*
+ * Resizable Extensions
+ */
+
+$.ui.plugin.add("resizable", "animate", {
+
+ stop: function( event ) {
+ var that = $(this).resizable( "instance" ),
+ o = that.options,
+ pr = that._proportionallyResizeElements,
+ ista = pr.length && (/textarea/i).test(pr[0].nodeName),
+ soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height,
+ soffsetw = ista ? 0 : that.sizeDiff.width,
+ style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
+ left = (parseInt(that.element.css("left"), 10) +
+ (that.position.left - that.originalPosition.left)) || null,
+ top = (parseInt(that.element.css("top"), 10) +
+ (that.position.top - that.originalPosition.top)) || null;
+
+ that.element.animate(
+ $.extend(style, top && left ? { top: top, left: left } : {}), {
+ duration: o.animateDuration,
+ easing: o.animateEasing,
+ step: function() {
+
+ var data = {
+ width: parseInt(that.element.css("width"), 10),
+ height: parseInt(that.element.css("height"), 10),
+ top: parseInt(that.element.css("top"), 10),
+ left: parseInt(that.element.css("left"), 10)
+ };
+
+ if (pr && pr.length) {
+ $(pr[0]).css({ width: data.width, height: data.height });
+ }
+
+ // propagating resize, and updating values for each animation step
+ that._updateCache(data);
+ that._propagate("resize", event);
+
+ }
+ }
+ );
+ }
+
+});
+
+$.ui.plugin.add( "resizable", "containment", {
+
+ start: function() {
+ var element, p, co, ch, cw, width, height,
+ that = $( this ).resizable( "instance" ),
+ o = that.options,
+ el = that.element,
+ oc = o.containment,
+ ce = ( oc instanceof $ ) ? oc.get( 0 ) : ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
+
+ if ( !ce ) {
+ return;
+ }
+
+ that.containerElement = $( ce );
+
+ if ( /document/.test( oc ) || oc === document ) {
+ that.containerOffset = {
+ left: 0,
+ top: 0
+ };
+ that.containerPosition = {
+ left: 0,
+ top: 0
+ };
+
+ that.parentData = {
+ element: $( document ),
+ left: 0,
+ top: 0,
+ width: $( document ).width(),
+ height: $( document ).height() || document.body.parentNode.scrollHeight
+ };
+ } else {
+ element = $( ce );
+ p = [];
+ $([ "Top", "Right", "Left", "Bottom" ]).each(function( i, name ) {
+ p[ i ] = that._num( element.css( "padding" + name ) );
+ });
+
+ that.containerOffset = element.offset();
+ that.containerPosition = element.position();
+ that.containerSize = {
+ height: ( element.innerHeight() - p[ 3 ] ),
+ width: ( element.innerWidth() - p[ 1 ] )
+ };
+
+ co = that.containerOffset;
+ ch = that.containerSize.height;
+ cw = that.containerSize.width;
+ width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw );
+ height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;
+
+ that.parentData = {
+ element: ce,
+ left: co.left,
+ top: co.top,
+ width: width,
+ height: height
+ };
+ }
+ },
+
+ resize: function( event ) {
+ var woset, hoset, isParent, isOffsetRelative,
+ that = $( this ).resizable( "instance" ),
+ o = that.options,
+ co = that.containerOffset,
+ cp = that.position,
+ pRatio = that._aspectRatio || event.shiftKey,
+ cop = {
+ top: 0,
+ left: 0
+ },
+ ce = that.containerElement,
+ continueResize = true;
+
+ if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
+ cop = co;
+ }
+
+ if ( cp.left < ( that._helper ? co.left : 0 ) ) {
+ that.size.width = that.size.width +
+ ( that._helper ?
+ ( that.position.left - co.left ) :
+ ( that.position.left - cop.left ) );
+
+ if ( pRatio ) {
+ that.size.height = that.size.width / that.aspectRatio;
+ continueResize = false;
+ }
+ that.position.left = o.helper ? co.left : 0;
+ }
+
+ if ( cp.top < ( that._helper ? co.top : 0 ) ) {
+ that.size.height = that.size.height +
+ ( that._helper ?
+ ( that.position.top - co.top ) :
+ that.position.top );
+
+ if ( pRatio ) {
+ that.size.width = that.size.height * that.aspectRatio;
+ continueResize = false;
+ }
+ that.position.top = that._helper ? co.top : 0;
+ }
+
+ isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
+ isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
+
+ if ( isParent && isOffsetRelative ) {
+ that.offset.left = that.parentData.left + that.position.left;
+ that.offset.top = that.parentData.top + that.position.top;
+ } else {
+ that.offset.left = that.element.offset().left;
+ that.offset.top = that.element.offset().top;
+ }
+
+ woset = Math.abs( that.sizeDiff.width +
+ (that._helper ?
+ that.offset.left - cop.left :
+ (that.offset.left - co.left)) );
+
+ hoset = Math.abs( that.sizeDiff.height +
+ (that._helper ?
+ that.offset.top - cop.top :
+ (that.offset.top - co.top)) );
+
+ if ( woset + that.size.width >= that.parentData.width ) {
+ that.size.width = that.parentData.width - woset;
+ if ( pRatio ) {
+ that.size.height = that.size.width / that.aspectRatio;
+ continueResize = false;
+ }
+ }
+
+ if ( hoset + that.size.height >= that.parentData.height ) {
+ that.size.height = that.parentData.height - hoset;
+ if ( pRatio ) {
+ that.size.width = that.size.height * that.aspectRatio;
+ continueResize = false;
+ }
+ }
+
+ if ( !continueResize ) {
+ that.position.left = that.prevPosition.left;
+ that.position.top = that.prevPosition.top;
+ that.size.width = that.prevSize.width;
+ that.size.height = that.prevSize.height;
+ }
+ },
+
+ stop: function() {
+ var that = $( this ).resizable( "instance" ),
+ o = that.options,
+ co = that.containerOffset,
+ cop = that.containerPosition,
+ ce = that.containerElement,
+ helper = $( that.helper ),
+ ho = helper.offset(),
+ w = helper.outerWidth() - that.sizeDiff.width,
+ h = helper.outerHeight() - that.sizeDiff.height;
+
+ if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
+ $( this ).css({
+ left: ho.left - cop.left - co.left,
+ width: w,
+ height: h
+ });
+ }
+
+ if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
+ $( this ).css({
+ left: ho.left - cop.left - co.left,
+ width: w,
+ height: h
+ });
+ }
+ }
+});
+
+$.ui.plugin.add("resizable", "alsoResize", {
+
+ start: function() {
+ var that = $(this).resizable( "instance" ),
+ o = that.options;
+
+ $(o.alsoResize).each(function() {
+ var el = $(this);
+ el.data("ui-resizable-alsoresize", {
+ width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
+ left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
+ });
+ });
+ },
+
+ resize: function(event, ui) {
+ var that = $(this).resizable( "instance" ),
+ o = that.options,
+ os = that.originalSize,
+ op = that.originalPosition,
+ delta = {
+ height: (that.size.height - os.height) || 0,
+ width: (that.size.width - os.width) || 0,
+ top: (that.position.top - op.top) || 0,
+ left: (that.position.left - op.left) || 0
+ };
+
+ $(o.alsoResize).each(function() {
+ var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
+ css = el.parents(ui.originalElement[0]).length ?
+ [ "width", "height" ] :
+ [ "width", "height", "top", "left" ];
+
+ $.each(css, function(i, prop) {
+ var sum = (start[prop] || 0) + (delta[prop] || 0);
+ if (sum && sum >= 0) {
+ style[prop] = sum || null;
+ }
+ });
+
+ el.css(style);
+ });
+ },
+
+ stop: function() {
+ $(this).removeData("resizable-alsoresize");
+ }
+});
+
+$.ui.plugin.add("resizable", "ghost", {
+
+ start: function() {
+
+ var that = $(this).resizable( "instance" ), o = that.options, cs = that.size;
+
+ that.ghost = that.originalElement.clone();
+ that.ghost
+ .css({
+ opacity: 0.25,
+ display: "block",
+ position: "relative",
+ height: cs.height,
+ width: cs.width,
+ margin: 0,
+ left: 0,
+ top: 0
+ })
+ .addClass("ui-resizable-ghost")
+ .addClass(typeof o.ghost === "string" ? o.ghost : "");
+
+ that.ghost.appendTo(that.helper);
+
+ },
+
+ resize: function() {
+ var that = $(this).resizable( "instance" );
+ if (that.ghost) {
+ that.ghost.css({
+ position: "relative",
+ height: that.size.height,
+ width: that.size.width
+ });
+ }
+ },
+
+ stop: function() {
+ var that = $(this).resizable( "instance" );
+ if (that.ghost && that.helper) {
+ that.helper.get(0).removeChild(that.ghost.get(0));
+ }
+ }
+
+});
+
+$.ui.plugin.add("resizable", "grid", {
+
+ resize: function() {
+ var outerDimensions,
+ that = $(this).resizable( "instance" ),
+ o = that.options,
+ cs = that.size,
+ os = that.originalSize,
+ op = that.originalPosition,
+ a = that.axis,
+ grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
+ gridX = (grid[0] || 1),
+ gridY = (grid[1] || 1),
+ ox = Math.round((cs.width - os.width) / gridX) * gridX,
+ oy = Math.round((cs.height - os.height) / gridY) * gridY,
+ newWidth = os.width + ox,
+ newHeight = os.height + oy,
+ isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
+ isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
+ isMinWidth = o.minWidth && (o.minWidth > newWidth),
+ isMinHeight = o.minHeight && (o.minHeight > newHeight);
+
+ o.grid = grid;
+
+ if (isMinWidth) {
+ newWidth += gridX;
+ }
+ if (isMinHeight) {
+ newHeight += gridY;
+ }
+ if (isMaxWidth) {
+ newWidth -= gridX;
+ }
+ if (isMaxHeight) {
+ newHeight -= gridY;
+ }
+
+ if (/^(se|s|e)$/.test(a)) {
+ that.size.width = newWidth;
+ that.size.height = newHeight;
+ } else if (/^(ne)$/.test(a)) {
+ that.size.width = newWidth;
+ that.size.height = newHeight;
+ that.position.top = op.top - oy;
+ } else if (/^(sw)$/.test(a)) {
+ that.size.width = newWidth;
+ that.size.height = newHeight;
+ that.position.left = op.left - ox;
+ } else {
+ if ( newHeight - gridY <= 0 || newWidth - gridX <= 0) {
+ outerDimensions = that._getPaddingPlusBorderDimensions( this );
+ }
+
+ if ( newHeight - gridY > 0 ) {
+ that.size.height = newHeight;
+ that.position.top = op.top - oy;
+ } else {
+ newHeight = gridY - outerDimensions.height;
+ that.size.height = newHeight;
+ that.position.top = op.top + os.height - newHeight;
+ }
+ if ( newWidth - gridX > 0 ) {
+ that.size.width = newWidth;
+ that.position.left = op.left - ox;
+ } else {
+ newWidth = gridX - outerDimensions.width;
+ that.size.width = newWidth;
+ that.position.left = op.left + os.width - newWidth;
+ }
+ }
+ }
+
+});
+
+var resizable = $.ui.resizable;
+
+
+/*!
+ * jQuery UI Dialog 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/dialog/
+ */
+
+
+var dialog = $.widget( "ui.dialog", {
+ version: "1.11.4",
+ options: {
+ appendTo: "body",
+ autoOpen: true,
+ buttons: [],
+ closeOnEscape: true,
+ closeText: "Close",
+ dialogClass: "",
+ draggable: true,
+ hide: null,
+ height: "auto",
+ maxHeight: null,
+ maxWidth: null,
+ minHeight: 150,
+ minWidth: 150,
+ modal: false,
+ position: {
+ my: "center",
+ at: "center",
+ of: window,
+ collision: "fit",
+ // Ensure the titlebar is always visible
+ using: function( pos ) {
+ var topOffset = $( this ).css( pos ).offset().top;
+ if ( topOffset < 0 ) {
+ $( this ).css( "top", pos.top - topOffset );
+ }
+ }
+ },
+ resizable: true,
+ show: null,
+ title: null,
+ width: 300,
+
+ // callbacks
+ beforeClose: null,
+ close: null,
+ drag: null,
+ dragStart: null,
+ dragStop: null,
+ focus: null,
+ open: null,
+ resize: null,
+ resizeStart: null,
+ resizeStop: null
+ },
+
+ sizeRelatedOptions: {
+ buttons: true,
+ height: true,
+ maxHeight: true,
+ maxWidth: true,
+ minHeight: true,
+ minWidth: true,
+ width: true
+ },
+
+ resizableRelatedOptions: {
+ maxHeight: true,
+ maxWidth: true,
+ minHeight: true,
+ minWidth: true
+ },
+
+ _create: function() {
+ this.originalCss = {
+ display: this.element[ 0 ].style.display,
+ width: this.element[ 0 ].style.width,
+ minHeight: this.element[ 0 ].style.minHeight,
+ maxHeight: this.element[ 0 ].style.maxHeight,
+ height: this.element[ 0 ].style.height
+ };
+ this.originalPosition = {
+ parent: this.element.parent(),
+ index: this.element.parent().children().index( this.element )
+ };
+ this.originalTitle = this.element.attr( "title" );
+ this.options.title = this.options.title || this.originalTitle;
+
+ this._createWrapper();
+
+ this.element
+ .show()
+ .removeAttr( "title" )
+ .addClass( "ui-dialog-content ui-widget-content" )
+ .appendTo( this.uiDialog );
+
+ this._createTitlebar();
+ this._createButtonPane();
+
+ if ( this.options.draggable && $.fn.draggable ) {
+ this._makeDraggable();
+ }
+ if ( this.options.resizable && $.fn.resizable ) {
+ this._makeResizable();
+ }
+
+ this._isOpen = false;
+
+ this._trackFocus();
+ },
+
+ _init: function() {
+ if ( this.options.autoOpen ) {
+ this.open();
+ }
+ },
+
+ _appendTo: function() {
+ var element = this.options.appendTo;
+ if ( element && (element.jquery || element.nodeType) ) {
+ return $( element );
+ }
+ return this.document.find( element || "body" ).eq( 0 );
+ },
+
+ _destroy: function() {
+ var next,
+ originalPosition = this.originalPosition;
+
+ this._untrackInstance();
+ this._destroyOverlay();
+
+ this.element
+ .removeUniqueId()
+ .removeClass( "ui-dialog-content ui-widget-content" )
+ .css( this.originalCss )
+ // Without detaching first, the following becomes really slow
+ .detach();
+
+ this.uiDialog.stop( true, true ).remove();
+
+ if ( this.originalTitle ) {
+ this.element.attr( "title", this.originalTitle );
+ }
+
+ next = originalPosition.parent.children().eq( originalPosition.index );
+ // Don't try to place the dialog next to itself (#8613)
+ if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
+ next.before( this.element );
+ } else {
+ originalPosition.parent.append( this.element );
+ }
+ },
+
+ widget: function() {
+ return this.uiDialog;
+ },
+
+ disable: $.noop,
+ enable: $.noop,
+
+ close: function( event ) {
+ var activeElement,
+ that = this;
+
+ if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
+ return;
+ }
+
+ this._isOpen = false;
+ this._focusedElement = null;
+ this._destroyOverlay();
+ this._untrackInstance();
+
+ if ( !this.opener.filter( ":focusable" ).focus().length ) {
+
+ // support: IE9
+ // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
+ try {
+ activeElement = this.document[ 0 ].activeElement;
+
+ // Support: IE9, IE10
+ // If the <body> is blurred, IE will switch windows, see #4520
+ if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) {
+
+ // Hiding a focused element doesn't trigger blur in WebKit
+ // so in case we have nothing to focus on, explicitly blur the active element
+ // https://bugs.webkit.org/show_bug.cgi?id=47182
+ $( activeElement ).blur();
+ }
+ } catch ( error ) {}
+ }
+
+ this._hide( this.uiDialog, this.options.hide, function() {
+ that._trigger( "close", event );
+ });
+ },
+
+ isOpen: function() {
+ return this._isOpen;
+ },
+
+ moveToTop: function() {
+ this._moveToTop();
+ },
+
+ _moveToTop: function( event, silent ) {
+ var moved = false,
+ zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map(function() {
+ return +$( this ).css( "z-index" );
+ }).get(),
+ zIndexMax = Math.max.apply( null, zIndices );
+
+ if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
+ this.uiDialog.css( "z-index", zIndexMax + 1 );
+ moved = true;
+ }
+
+ if ( moved && !silent ) {
+ this._trigger( "focus", event );
+ }
+ return moved;
+ },
+
+ open: function() {
+ var that = this;
+ if ( this._isOpen ) {
+ if ( this._moveToTop() ) {
+ this._focusTabbable();
+ }
+ return;
+ }
+
+ this._isOpen = true;
+ this.opener = $( this.document[ 0 ].activeElement );
+
+ this._size();
+ this._position();
+ this._createOverlay();
+ this._moveToTop( null, true );
+
+ // Ensure the overlay is moved to the top with the dialog, but only when
+ // opening. The overlay shouldn't move after the dialog is open so that
+ // modeless dialogs opened after the modal dialog stack properly.
+ if ( this.overlay ) {
+ this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
+ }
+
+ this._show( this.uiDialog, this.options.show, function() {
+ that._focusTabbable();
+ that._trigger( "focus" );
+ });
+
+ // Track the dialog immediately upon openening in case a focus event
+ // somehow occurs outside of the dialog before an element inside the
+ // dialog is focused (#10152)
+ this._makeFocusTarget();
+
+ this._trigger( "open" );
+ },
+
+ _focusTabbable: function() {
+ // Set focus to the first match:
+ // 1. An element that was focused previously
+ // 2. First element inside the dialog matching [autofocus]
+ // 3. Tabbable element inside the content element
+ // 4. Tabbable element inside the buttonpane
+ // 5. The close button
+ // 6. The dialog itself
+ var hasFocus = this._focusedElement;
+ if ( !hasFocus ) {
+ hasFocus = this.element.find( "[autofocus]" );
+ }
+ if ( !hasFocus.length ) {
+ hasFocus = this.element.find( ":tabbable" );
+ }
+ if ( !hasFocus.length ) {
+ hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
+ }
+ if ( !hasFocus.length ) {
+ hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
+ }
+ if ( !hasFocus.length ) {
+ hasFocus = this.uiDialog;
+ }
+ hasFocus.eq( 0 ).focus();
+ },
+
+ _keepFocus: function( event ) {
+ function checkFocus() {
+ var activeElement = this.document[0].activeElement,
+ isActive = this.uiDialog[0] === activeElement ||
+ $.contains( this.uiDialog[0], activeElement );
+ if ( !isActive ) {
+ this._focusTabbable();
+ }
+ }
+ event.preventDefault();
+ checkFocus.call( this );
+ // support: IE
+ // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
+ // so we check again later
+ this._delay( checkFocus );
+ },
+
+ _createWrapper: function() {
+ this.uiDialog = $("<div>")
+ .addClass( "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " +
+ this.options.dialogClass )
+ .hide()
+ .attr({
+ // Setting tabIndex makes the div focusable
+ tabIndex: -1,
+ role: "dialog"
+ })
+ .appendTo( this._appendTo() );
+
+ this._on( this.uiDialog, {
+ keydown: function( event ) {
+ if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
+ event.keyCode === $.ui.keyCode.ESCAPE ) {
+ event.preventDefault();
+ this.close( event );
+ return;
+ }
+
+ // prevent tabbing out of dialogs
+ if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
+ return;
+ }
+ var tabbables = this.uiDialog.find( ":tabbable" ),
+ first = tabbables.filter( ":first" ),
+ last = tabbables.filter( ":last" );
+
+ if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
+ this._delay(function() {
+ first.focus();
+ });
+ event.preventDefault();
+ } else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) {
+ this._delay(function() {
+ last.focus();
+ });
+ event.preventDefault();
+ }
+ },
+ mousedown: function( event ) {
+ if ( this._moveToTop( event ) ) {
+ this._focusTabbable();
+ }
+ }
+ });
+
+ // We assume that any existing aria-describedby attribute means
+ // that the dialog content is marked up properly
+ // otherwise we brute force the content as the description
+ if ( !this.element.find( "[aria-describedby]" ).length ) {
+ this.uiDialog.attr({
+ "aria-describedby": this.element.uniqueId().attr( "id" )
+ });
+ }
+ },
+
+ _createTitlebar: function() {
+ var uiDialogTitle;
+
+ this.uiDialogTitlebar = $( "<div>" )
+ .addClass( "ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" )
+ .prependTo( this.uiDialog );
+ this._on( this.uiDialogTitlebar, {
+ mousedown: function( event ) {
+ // Don't prevent click on close button (#8838)
+ // Focusing a dialog that is partially scrolled out of view
+ // causes the browser to scroll it into view, preventing the click event
+ if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
+ // Dialog isn't getting focus when dragging (#8063)
+ this.uiDialog.focus();
+ }
+ }
+ });
+
+ // support: IE
+ // Use type="button" to prevent enter keypresses in textboxes from closing the
+ // dialog in IE (#9312)
+ this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
+ .button({
+ label: this.options.closeText,
+ icons: {
+ primary: "ui-icon-closethick"
+ },
+ text: false
+ })
+ .addClass( "ui-dialog-titlebar-close" )
+ .appendTo( this.uiDialogTitlebar );
+ this._on( this.uiDialogTitlebarClose, {
+ click: function( event ) {
+ event.preventDefault();
+ this.close( event );
+ }
+ });
+
+ uiDialogTitle = $( "<span>" )
+ .uniqueId()
+ .addClass( "ui-dialog-title" )
+ .prependTo( this.uiDialogTitlebar );
+ this._title( uiDialogTitle );
+
+ this.uiDialog.attr({
+ "aria-labelledby": uiDialogTitle.attr( "id" )
+ });
+ },
+
+ _title: function( title ) {
+ if ( !this.options.title ) {
+ title.html( "&#160;" );
+ }
+ title.text( this.options.title );
+ },
+
+ _createButtonPane: function() {
+ this.uiDialogButtonPane = $( "<div>" )
+ .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
+
+ this.uiButtonSet = $( "<div>" )
+ .addClass( "ui-dialog-buttonset" )
+ .appendTo( this.uiDialogButtonPane );
+
+ this._createButtons();
+ },
+
+ _createButtons: function() {
+ var that = this,
+ buttons = this.options.buttons;
+
+ // if we already have a button pane, remove it
+ this.uiDialogButtonPane.remove();
+ this.uiButtonSet.empty();
+
+ if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
+ this.uiDialog.removeClass( "ui-dialog-buttons" );
+ return;
+ }
+
+ $.each( buttons, function( name, props ) {
+ var click, buttonOptions;
+ props = $.isFunction( props ) ?
+ { click: props, text: name } :
+ props;
+ // Default to a non-submitting button
+ props = $.extend( { type: "button" }, props );
+ // Change the context for the click callback to be the main element
+ click = props.click;
+ props.click = function() {
+ click.apply( that.element[ 0 ], arguments );
+ };
+ buttonOptions = {
+ icons: props.icons,
+ text: props.showText
+ };
+ delete props.icons;
+ delete props.showText;
+ $( "<button></button>", props )
+ .button( buttonOptions )
+ .appendTo( that.uiButtonSet );
+ });
+ this.uiDialog.addClass( "ui-dialog-buttons" );
+ this.uiDialogButtonPane.appendTo( this.uiDialog );
+ },
+
+ _makeDraggable: function() {
+ var that = this,
+ options = this.options;
+
+ function filteredUi( ui ) {
+ return {
+ position: ui.position,
+ offset: ui.offset
+ };
+ }
+
+ this.uiDialog.draggable({
+ cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
+ handle: ".ui-dialog-titlebar",
+ containment: "document",
+ start: function( event, ui ) {
+ $( this ).addClass( "ui-dialog-dragging" );
+ that._blockFrames();
+ that._trigger( "dragStart", event, filteredUi( ui ) );
+ },
+ drag: function( event, ui ) {
+ that._trigger( "drag", event, filteredUi( ui ) );
+ },
+ stop: function( event, ui ) {
+ var left = ui.offset.left - that.document.scrollLeft(),
+ top = ui.offset.top - that.document.scrollTop();
+
+ options.position = {
+ my: "left top",
+ at: "left" + (left >= 0 ? "+" : "") + left + " " +
+ "top" + (top >= 0 ? "+" : "") + top,
+ of: that.window
+ };
+ $( this ).removeClass( "ui-dialog-dragging" );
+ that._unblockFrames();
+ that._trigger( "dragStop", event, filteredUi( ui ) );
+ }
+ });
+ },
+
+ _makeResizable: function() {
+ var that = this,
+ options = this.options,
+ handles = options.resizable,
+ // .ui-resizable has position: relative defined in the stylesheet
+ // but dialogs have to use absolute or fixed positioning
+ position = this.uiDialog.css("position"),
+ resizeHandles = typeof handles === "string" ?
+ handles :
+ "n,e,s,w,se,sw,ne,nw";
+
+ function filteredUi( ui ) {
+ return {
+ originalPosition: ui.originalPosition,
+ originalSize: ui.originalSize,
+ position: ui.position,
+ size: ui.size
+ };
+ }
+
+ this.uiDialog.resizable({
+ cancel: ".ui-dialog-content",
+ containment: "document",
+ alsoResize: this.element,
+ maxWidth: options.maxWidth,
+ maxHeight: options.maxHeight,
+ minWidth: options.minWidth,
+ minHeight: this._minHeight(),
+ handles: resizeHandles,
+ start: function( event, ui ) {
+ $( this ).addClass( "ui-dialog-resizing" );
+ that._blockFrames();
+ that._trigger( "resizeStart", event, filteredUi( ui ) );
+ },
+ resize: function( event, ui ) {
+ that._trigger( "resize", event, filteredUi( ui ) );
+ },
+ stop: function( event, ui ) {
+ var offset = that.uiDialog.offset(),
+ left = offset.left - that.document.scrollLeft(),
+ top = offset.top - that.document.scrollTop();
+
+ options.height = that.uiDialog.height();
+ options.width = that.uiDialog.width();
+ options.position = {
+ my: "left top",
+ at: "left" + (left >= 0 ? "+" : "") + left + " " +
+ "top" + (top >= 0 ? "+" : "") + top,
+ of: that.window
+ };
+ $( this ).removeClass( "ui-dialog-resizing" );
+ that._unblockFrames();
+ that._trigger( "resizeStop", event, filteredUi( ui ) );
+ }
+ })
+ .css( "position", position );
+ },
+
+ _trackFocus: function() {
+ this._on( this.widget(), {
+ focusin: function( event ) {
+ this._makeFocusTarget();
+ this._focusedElement = $( event.target );
+ }
+ });
+ },
+
+ _makeFocusTarget: function() {
+ this._untrackInstance();
+ this._trackingInstances().unshift( this );
+ },
+
+ _untrackInstance: function() {
+ var instances = this._trackingInstances(),
+ exists = $.inArray( this, instances );
+ if ( exists !== -1 ) {
+ instances.splice( exists, 1 );
+ }
+ },
+
+ _trackingInstances: function() {
+ var instances = this.document.data( "ui-dialog-instances" );
+ if ( !instances ) {
+ instances = [];
+ this.document.data( "ui-dialog-instances", instances );
+ }
+ return instances;
+ },
+
+ _minHeight: function() {
+ var options = this.options;
+
+ return options.height === "auto" ?
+ options.minHeight :
+ Math.min( options.minHeight, options.height );
+ },
+
+ _position: function() {
+ // Need to show the dialog to get the actual offset in the position plugin
+ var isVisible = this.uiDialog.is( ":visible" );
+ if ( !isVisible ) {
+ this.uiDialog.show();
+ }
+ this.uiDialog.position( this.options.position );
+ if ( !isVisible ) {
+ this.uiDialog.hide();
+ }
+ },
+
+ _setOptions: function( options ) {
+ var that = this,
+ resize = false,
+ resizableOptions = {};
+
+ $.each( options, function( key, value ) {
+ that._setOption( key, value );
+
+ if ( key in that.sizeRelatedOptions ) {
+ resize = true;
+ }
+ if ( key in that.resizableRelatedOptions ) {
+ resizableOptions[ key ] = value;
+ }
+ });
+
+ if ( resize ) {
+ this._size();
+ this._position();
+ }
+ if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
+ this.uiDialog.resizable( "option", resizableOptions );
+ }
+ },
+
+ _setOption: function( key, value ) {
+ var isDraggable, isResizable,
+ uiDialog = this.uiDialog;
+
+ if ( key === "dialogClass" ) {
+ uiDialog
+ .removeClass( this.options.dialogClass )
+ .addClass( value );
+ }
+
+ if ( key === "disabled" ) {
+ return;
+ }
+
+ this._super( key, value );
+
+ if ( key === "appendTo" ) {
+ this.uiDialog.appendTo( this._appendTo() );
+ }
+
+ if ( key === "buttons" ) {
+ this._createButtons();
+ }
+
+ if ( key === "closeText" ) {
+ this.uiDialogTitlebarClose.button({
+ // Ensure that we always pass a string
+ label: "" + value
+ });
+ }
+
+ if ( key === "draggable" ) {
+ isDraggable = uiDialog.is( ":data(ui-draggable)" );
+ if ( isDraggable && !value ) {
+ uiDialog.draggable( "destroy" );
+ }
+
+ if ( !isDraggable && value ) {
+ this._makeDraggable();
+ }
+ }
+
+ if ( key === "position" ) {
+ this._position();
+ }
+
+ if ( key === "resizable" ) {
+ // currently resizable, becoming non-resizable
+ isResizable = uiDialog.is( ":data(ui-resizable)" );
+ if ( isResizable && !value ) {
+ uiDialog.resizable( "destroy" );
+ }
+
+ // currently resizable, changing handles
+ if ( isResizable && typeof value === "string" ) {
+ uiDialog.resizable( "option", "handles", value );
+ }
+
+ // currently non-resizable, becoming resizable
+ if ( !isResizable && value !== false ) {
+ this._makeResizable();
+ }
+ }
+
+ if ( key === "title" ) {
+ this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
+ }
+ },
+
+ _size: function() {
+ // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
+ // divs will both have width and height set, so we need to reset them
+ var nonContentHeight, minContentHeight, maxContentHeight,
+ options = this.options;
+
+ // Reset content sizing
+ this.element.show().css({
+ width: "auto",
+ minHeight: 0,
+ maxHeight: "none",
+ height: 0
+ });
+
+ if ( options.minWidth > options.width ) {
+ options.width = options.minWidth;
+ }
+
+ // reset wrapper sizing
+ // determine the height of all the non-content elements
+ nonContentHeight = this.uiDialog.css({
+ height: "auto",
+ width: options.width
+ })
+ .outerHeight();
+ minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
+ maxContentHeight = typeof options.maxHeight === "number" ?
+ Math.max( 0, options.maxHeight - nonContentHeight ) :
+ "none";
+
+ if ( options.height === "auto" ) {
+ this.element.css({
+ minHeight: minContentHeight,
+ maxHeight: maxContentHeight,
+ height: "auto"
+ });
+ } else {
+ this.element.height( Math.max( 0, options.height - nonContentHeight ) );
+ }
+
+ if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
+ this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
+ }
+ },
+
+ _blockFrames: function() {
+ this.iframeBlocks = this.document.find( "iframe" ).map(function() {
+ var iframe = $( this );
+
+ return $( "<div>" )
+ .css({
+ position: "absolute",
+ width: iframe.outerWidth(),
+ height: iframe.outerHeight()
+ })
+ .appendTo( iframe.parent() )
+ .offset( iframe.offset() )[0];
+ });
+ },
+
+ _unblockFrames: function() {
+ if ( this.iframeBlocks ) {
+ this.iframeBlocks.remove();
+ delete this.iframeBlocks;
+ }
+ },
+
+ _allowInteraction: function( event ) {
+ if ( $( event.target ).closest( ".ui-dialog" ).length ) {
+ return true;
+ }
+
+ // TODO: Remove hack when datepicker implements
+ // the .ui-front logic (#8989)
+ return !!$( event.target ).closest( ".ui-datepicker" ).length;
+ },
+
+ _createOverlay: function() {
+ if ( !this.options.modal ) {
+ return;
+ }
+
+ // We use a delay in case the overlay is created from an
+ // event that we're going to be cancelling (#2804)
+ var isOpening = true;
+ this._delay(function() {
+ isOpening = false;
+ });
+
+ if ( !this.document.data( "ui-dialog-overlays" ) ) {
+
+ // Prevent use of anchors and inputs
+ // Using _on() for an event handler shared across many instances is
+ // safe because the dialogs stack and must be closed in reverse order
+ this._on( this.document, {
+ focusin: function( event ) {
+ if ( isOpening ) {
+ return;
+ }
+
+ if ( !this._allowInteraction( event ) ) {
+ event.preventDefault();
+ this._trackingInstances()[ 0 ]._focusTabbable();
+ }
+ }
+ });
+ }
+
+ this.overlay = $( "<div>" )
+ .addClass( "ui-widget-overlay ui-front" )
+ .appendTo( this._appendTo() );
+ this._on( this.overlay, {
+ mousedown: "_keepFocus"
+ });
+ this.document.data( "ui-dialog-overlays",
+ (this.document.data( "ui-dialog-overlays" ) || 0) + 1 );
+ },
+
+ _destroyOverlay: function() {
+ if ( !this.options.modal ) {
+ return;
+ }
+
+ if ( this.overlay ) {
+ var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
+
+ if ( !overlays ) {
+ this.document
+ .unbind( "focusin" )
+ .removeData( "ui-dialog-overlays" );
+ } else {
+ this.document.data( "ui-dialog-overlays", overlays );
+ }
+
+ this.overlay.remove();
+ this.overlay = null;
+ }
+ }
+});
+
+
+/*!
+ * jQuery UI Droppable 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/droppable/
+ */
+
+
+$.widget( "ui.droppable", {
+ version: "1.11.4",
+ widgetEventPrefix: "drop",
+ options: {
+ accept: "*",
+ activeClass: false,
+ addClasses: true,
+ greedy: false,
+ hoverClass: false,
+ scope: "default",
+ tolerance: "intersect",
+
+ // callbacks
+ activate: null,
+ deactivate: null,
+ drop: null,
+ out: null,
+ over: null
+ },
+ _create: function() {
+
+ var proportions,
+ o = this.options,
+ accept = o.accept;
+
+ this.isover = false;
+ this.isout = true;
+
+ this.accept = $.isFunction( accept ) ? accept : function( d ) {
+ return d.is( accept );
+ };
+
+ this.proportions = function( /* valueToWrite */ ) {
+ if ( arguments.length ) {
+ // Store the droppable's proportions
+ proportions = arguments[ 0 ];
+ } else {
+ // Retrieve or derive the droppable's proportions
+ return proportions ?
+ proportions :
+ proportions = {
+ width: this.element[ 0 ].offsetWidth,
+ height: this.element[ 0 ].offsetHeight
+ };
+ }
+ };
+
+ this._addToManager( o.scope );
+
+ o.addClasses && this.element.addClass( "ui-droppable" );
+
+ },
+
+ _addToManager: function( scope ) {
+ // Add the reference and positions to the manager
+ $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
+ $.ui.ddmanager.droppables[ scope ].push( this );
+ },
+
+ _splice: function( drop ) {
+ var i = 0;
+ for ( ; i < drop.length; i++ ) {
+ if ( drop[ i ] === this ) {
+ drop.splice( i, 1 );
+ }
+ }
+ },
+
+ _destroy: function() {
+ var drop = $.ui.ddmanager.droppables[ this.options.scope ];
+
+ this._splice( drop );
+
+ this.element.removeClass( "ui-droppable ui-droppable-disabled" );
+ },
+
+ _setOption: function( key, value ) {
+
+ if ( key === "accept" ) {
+ this.accept = $.isFunction( value ) ? value : function( d ) {
+ return d.is( value );
+ };
+ } else if ( key === "scope" ) {
+ var drop = $.ui.ddmanager.droppables[ this.options.scope ];
+
+ this._splice( drop );
+ this._addToManager( value );
+ }
+
+ this._super( key, value );
+ },
+
+ _activate: function( event ) {
+ var draggable = $.ui.ddmanager.current;
+ if ( this.options.activeClass ) {
+ this.element.addClass( this.options.activeClass );
+ }
+ if ( draggable ){
+ this._trigger( "activate", event, this.ui( draggable ) );
+ }
+ },
+
+ _deactivate: function( event ) {
+ var draggable = $.ui.ddmanager.current;
+ if ( this.options.activeClass ) {
+ this.element.removeClass( this.options.activeClass );
+ }
+ if ( draggable ){
+ this._trigger( "deactivate", event, this.ui( draggable ) );
+ }
+ },
+
+ _over: function( event ) {
+
+ var draggable = $.ui.ddmanager.current;
+
+ // Bail if draggable and droppable are same element
+ if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
+ return;
+ }
+
+ if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
+ if ( this.options.hoverClass ) {
+ this.element.addClass( this.options.hoverClass );
+ }
+ this._trigger( "over", event, this.ui( draggable ) );
+ }
+
+ },
+
+ _out: function( event ) {
+
+ var draggable = $.ui.ddmanager.current;
+
+ // Bail if draggable and droppable are same element
+ if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
+ return;
+ }
+
+ if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
+ if ( this.options.hoverClass ) {
+ this.element.removeClass( this.options.hoverClass );
+ }
+ this._trigger( "out", event, this.ui( draggable ) );
+ }
+
+ },
+
+ _drop: function( event, custom ) {
+
+ var draggable = custom || $.ui.ddmanager.current,
+ childrenIntersection = false;
+
+ // Bail if draggable and droppable are same element
+ if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
+ return false;
+ }
+
+ this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each(function() {
+ var inst = $( this ).droppable( "instance" );
+ if (
+ inst.options.greedy &&
+ !inst.options.disabled &&
+ inst.options.scope === draggable.options.scope &&
+ inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
+ $.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event )
+ ) { childrenIntersection = true; return false; }
+ });
+ if ( childrenIntersection ) {
+ return false;
+ }
+
+ if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
+ if ( this.options.activeClass ) {
+ this.element.removeClass( this.options.activeClass );
+ }
+ if ( this.options.hoverClass ) {
+ this.element.removeClass( this.options.hoverClass );
+ }
+ this._trigger( "drop", event, this.ui( draggable ) );
+ return this.element;
+ }
+
+ return false;
+
+ },
+
+ ui: function( c ) {
+ return {
+ draggable: ( c.currentItem || c.element ),
+ helper: c.helper,
+ position: c.position,
+ offset: c.positionAbs
+ };
+ }
+
+});
+
+$.ui.intersect = (function() {
+ function isOverAxis( x, reference, size ) {
+ return ( x >= reference ) && ( x < ( reference + size ) );
+ }
+
+ return function( draggable, droppable, toleranceMode, event ) {
+
+ if ( !droppable.offset ) {
+ return false;
+ }
+
+ var x1 = ( draggable.positionAbs || draggable.position.absolute ).left + draggable.margins.left,
+ y1 = ( draggable.positionAbs || draggable.position.absolute ).top + draggable.margins.top,
+ x2 = x1 + draggable.helperProportions.width,
+ y2 = y1 + draggable.helperProportions.height,
+ l = droppable.offset.left,
+ t = droppable.offset.top,
+ r = l + droppable.proportions().width,
+ b = t + droppable.proportions().height;
+
+ switch ( toleranceMode ) {
+ case "fit":
+ return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
+ case "intersect":
+ return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
+ x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
+ t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
+ y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
+ case "pointer":
+ return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width );
+ case "touch":
+ return (
+ ( y1 >= t && y1 <= b ) || // Top edge touching
+ ( y2 >= t && y2 <= b ) || // Bottom edge touching
+ ( y1 < t && y2 > b ) // Surrounded vertically
+ ) && (
+ ( x1 >= l && x1 <= r ) || // Left edge touching
+ ( x2 >= l && x2 <= r ) || // Right edge touching
+ ( x1 < l && x2 > r ) // Surrounded horizontally
+ );
+ default:
+ return false;
+ }
+ };
+})();
+
+/*
+ This manager tracks offsets of draggables and droppables
+*/
+$.ui.ddmanager = {
+ current: null,
+ droppables: { "default": [] },
+ prepareOffsets: function( t, event ) {
+
+ var i, j,
+ m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
+ type = event ? event.type : null, // workaround for #2317
+ list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
+
+ droppablesLoop: for ( i = 0; i < m.length; i++ ) {
+
+ // No disabled and non-accepted
+ if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) {
+ continue;
+ }
+
+ // Filter out elements in the current dragged item
+ for ( j = 0; j < list.length; j++ ) {
+ if ( list[ j ] === m[ i ].element[ 0 ] ) {
+ m[ i ].proportions().height = 0;
+ continue droppablesLoop;
+ }
+ }
+
+ m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
+ if ( !m[ i ].visible ) {
+ continue;
+ }
+
+ // Activate the droppable if used directly from draggables
+ if ( type === "mousedown" ) {
+ m[ i ]._activate.call( m[ i ], event );
+ }
+
+ m[ i ].offset = m[ i ].element.offset();
+ m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight });
+
+ }
+
+ },
+ drop: function( draggable, event ) {
+
+ var dropped = false;
+ // Create a copy of the droppables in case the list changes during the drop (#9116)
+ $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
+
+ if ( !this.options ) {
+ return;
+ }
+ if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
+ dropped = this._drop.call( this, event ) || dropped;
+ }
+
+ if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
+ this.isout = true;
+ this.isover = false;
+ this._deactivate.call( this, event );
+ }
+
+ });
+ return dropped;
+
+ },
+ dragStart: function( draggable, event ) {
+ // Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
+ draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
+ if ( !draggable.options.refreshPositions ) {
+ $.ui.ddmanager.prepareOffsets( draggable, event );
+ }
+ });
+ },
+ drag: function( draggable, event ) {
+
+ // If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
+ if ( draggable.options.refreshPositions ) {
+ $.ui.ddmanager.prepareOffsets( draggable, event );
+ }
+
+ // Run through all droppables and check their positions based on specific tolerance options
+ $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
+
+ if ( this.options.disabled || this.greedyChild || !this.visible ) {
+ return;
+ }
+
+ var parentInstance, scope, parent,
+ intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
+ c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
+ if ( !c ) {
+ return;
+ }
+
+ if ( this.options.greedy ) {
+ // find droppable parents with same scope
+ scope = this.options.scope;
+ parent = this.element.parents( ":data(ui-droppable)" ).filter(function() {
+ return $( this ).droppable( "instance" ).options.scope === scope;
+ });
+
+ if ( parent.length ) {
+ parentInstance = $( parent[ 0 ] ).droppable( "instance" );
+ parentInstance.greedyChild = ( c === "isover" );
+ }
+ }
+
+ // we just moved into a greedy child
+ if ( parentInstance && c === "isover" ) {
+ parentInstance.isover = false;
+ parentInstance.isout = true;
+ parentInstance._out.call( parentInstance, event );
+ }
+
+ this[ c ] = true;
+ this[c === "isout" ? "isover" : "isout"] = false;
+ this[c === "isover" ? "_over" : "_out"].call( this, event );
+
+ // we just moved out of a greedy child
+ if ( parentInstance && c === "isout" ) {
+ parentInstance.isout = false;
+ parentInstance.isover = true;
+ parentInstance._over.call( parentInstance, event );
+ }
+ });
+
+ },
+ dragStop: function( draggable, event ) {
+ draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
+ // Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
+ if ( !draggable.options.refreshPositions ) {
+ $.ui.ddmanager.prepareOffsets( draggable, event );
+ }
+ }
+};
+
+var droppable = $.ui.droppable;
+
+
+/*!
+ * jQuery UI Effects 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/category/effects-core/
+ */
+
+
+var dataSpace = "ui-effects-",
+
+ // Create a local jQuery because jQuery Color relies on it and the
+ // global may not exist with AMD and a custom build (#10199)
+ jQuery = $;
+
+$.effects = {
+ effect: {}
+};
+
+/*!
+ * jQuery Color Animations v2.1.2
+ * https://github.com/jquery/jquery-color
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * Date: Wed Jan 16 08:47:09 2013 -0600
+ */
+(function( jQuery, undefined ) {
+
+ var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
+
+ // plusequals test for += 100 -= 100
+ rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
+ // a set of RE's that can match strings and generate color tuples.
+ stringParsers = [ {
+ re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
+ parse: function( execResult ) {
+ return [
+ execResult[ 1 ],
+ execResult[ 2 ],
+ execResult[ 3 ],
+ execResult[ 4 ]
+ ];
+ }
+ }, {
+ re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
+ parse: function( execResult ) {
+ return [
+ execResult[ 1 ] * 2.55,
+ execResult[ 2 ] * 2.55,
+ execResult[ 3 ] * 2.55,
+ execResult[ 4 ]
+ ];
+ }
+ }, {
+ // this regex ignores A-F because it's compared against an already lowercased string
+ re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
+ parse: function( execResult ) {
+ return [
+ parseInt( execResult[ 1 ], 16 ),
+ parseInt( execResult[ 2 ], 16 ),
+ parseInt( execResult[ 3 ], 16 )
+ ];
+ }
+ }, {
+ // this regex ignores A-F because it's compared against an already lowercased string
+ re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
+ parse: function( execResult ) {
+ return [
+ parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
+ parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
+ parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
+ ];
+ }
+ }, {
+ re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
+ space: "hsla",
+ parse: function( execResult ) {
+ return [
+ execResult[ 1 ],
+ execResult[ 2 ] / 100,
+ execResult[ 3 ] / 100,
+ execResult[ 4 ]
+ ];
+ }
+ } ],
+
+ // jQuery.Color( )
+ color = jQuery.Color = function( color, green, blue, alpha ) {
+ return new jQuery.Color.fn.parse( color, green, blue, alpha );
+ },
+ spaces = {
+ rgba: {
+ props: {
+ red: {
+ idx: 0,
+ type: "byte"
+ },
+ green: {
+ idx: 1,
+ type: "byte"
+ },
+ blue: {
+ idx: 2,
+ type: "byte"
+ }
+ }
+ },
+
+ hsla: {
+ props: {
+ hue: {
+ idx: 0,
+ type: "degrees"
+ },
+ saturation: {
+ idx: 1,
+ type: "percent"
+ },
+ lightness: {
+ idx: 2,
+ type: "percent"
+ }
+ }
+ }
+ },
+ propTypes = {
+ "byte": {
+ floor: true,
+ max: 255
+ },
+ "percent": {
+ max: 1
+ },
+ "degrees": {
+ mod: 360,
+ floor: true
+ }
+ },
+ support = color.support = {},
+
+ // element for support tests
+ supportElem = jQuery( "<p>" )[ 0 ],
+
+ // colors = jQuery.Color.names
+ colors,
+
+ // local aliases of functions called often
+ each = jQuery.each;
+
+// determine rgba support immediately
+supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
+support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
+
+// define cache name and alpha properties
+// for rgba and hsla spaces
+each( spaces, function( spaceName, space ) {
+ space.cache = "_" + spaceName;
+ space.props.alpha = {
+ idx: 3,
+ type: "percent",
+ def: 1
+ };
+});
+
+function clamp( value, prop, allowEmpty ) {
+ var type = propTypes[ prop.type ] || {};
+
+ if ( value == null ) {
+ return (allowEmpty || !prop.def) ? null : prop.def;
+ }
+
+ // ~~ is an short way of doing floor for positive numbers
+ value = type.floor ? ~~value : parseFloat( value );
+
+ // IE will pass in empty strings as value for alpha,
+ // which will hit this case
+ if ( isNaN( value ) ) {
+ return prop.def;
+ }
+
+ if ( type.mod ) {
+ // we add mod before modding to make sure that negatives values
+ // get converted properly: -10 -> 350
+ return (value + type.mod) % type.mod;
+ }
+
+ // for now all property types without mod have min and max
+ return 0 > value ? 0 : type.max < value ? type.max : value;
+}
+
+function stringParse( string ) {
+ var inst = color(),
+ rgba = inst._rgba = [];
+
+ string = string.toLowerCase();
+
+ each( stringParsers, function( i, parser ) {
+ var parsed,
+ match = parser.re.exec( string ),
+ values = match && parser.parse( match ),
+ spaceName = parser.space || "rgba";
+
+ if ( values ) {
+ parsed = inst[ spaceName ]( values );
+
+ // if this was an rgba parse the assignment might happen twice
+ // oh well....
+ inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
+ rgba = inst._rgba = parsed._rgba;
+
+ // exit each( stringParsers ) here because we matched
+ return false;
+ }
+ });
+
+ // Found a stringParser that handled it
+ if ( rgba.length ) {
+
+ // if this came from a parsed string, force "transparent" when alpha is 0
+ // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
+ if ( rgba.join() === "0,0,0,0" ) {
+ jQuery.extend( rgba, colors.transparent );
+ }
+ return inst;
+ }
+
+ // named colors
+ return colors[ string ];
+}
+
+color.fn = jQuery.extend( color.prototype, {
+ parse: function( red, green, blue, alpha ) {
+ if ( red === undefined ) {
+ this._rgba = [ null, null, null, null ];
+ return this;
+ }
+ if ( red.jquery || red.nodeType ) {
+ red = jQuery( red ).css( green );
+ green = undefined;
+ }
+
+ var inst = this,
+ type = jQuery.type( red ),
+ rgba = this._rgba = [];
+
+ // more than 1 argument specified - assume ( red, green, blue, alpha )
+ if ( green !== undefined ) {
+ red = [ red, green, blue, alpha ];
+ type = "array";
+ }
+
+ if ( type === "string" ) {
+ return this.parse( stringParse( red ) || colors._default );
+ }
+
+ if ( type === "array" ) {
+ each( spaces.rgba.props, function( key, prop ) {
+ rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
+ });
+ return this;
+ }
+
+ if ( type === "object" ) {
+ if ( red instanceof color ) {
+ each( spaces, function( spaceName, space ) {
+ if ( red[ space.cache ] ) {
+ inst[ space.cache ] = red[ space.cache ].slice();
+ }
+ });
+ } else {
+ each( spaces, function( spaceName, space ) {
+ var cache = space.cache;
+ each( space.props, function( key, prop ) {
+
+ // if the cache doesn't exist, and we know how to convert
+ if ( !inst[ cache ] && space.to ) {
+
+ // if the value was null, we don't need to copy it
+ // if the key was alpha, we don't need to copy it either
+ if ( key === "alpha" || red[ key ] == null ) {
+ return;
+ }
+ inst[ cache ] = space.to( inst._rgba );
+ }
+
+ // this is the only case where we allow nulls for ALL properties.
+ // call clamp with alwaysAllowEmpty
+ inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
+ });
+
+ // everything defined but alpha?
+ if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
+ // use the default of 1
+ inst[ cache ][ 3 ] = 1;
+ if ( space.from ) {
+ inst._rgba = space.from( inst[ cache ] );
+ }
+ }
+ });
+ }
+ return this;
+ }
+ },
+ is: function( compare ) {
+ var is = color( compare ),
+ same = true,
+ inst = this;
+
+ each( spaces, function( _, space ) {
+ var localCache,
+ isCache = is[ space.cache ];
+ if (isCache) {
+ localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
+ each( space.props, function( _, prop ) {
+ if ( isCache[ prop.idx ] != null ) {
+ same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
+ return same;
+ }
+ });
+ }
+ return same;
+ });
+ return same;
+ },
+ _space: function() {
+ var used = [],
+ inst = this;
+ each( spaces, function( spaceName, space ) {
+ if ( inst[ space.cache ] ) {
+ used.push( spaceName );
+ }
+ });
+ return used.pop();
+ },
+ transition: function( other, distance ) {
+ var end = color( other ),
+ spaceName = end._space(),
+ space = spaces[ spaceName ],
+ startColor = this.alpha() === 0 ? color( "transparent" ) : this,
+ start = startColor[ space.cache ] || space.to( startColor._rgba ),
+ result = start.slice();
+
+ end = end[ space.cache ];
+ each( space.props, function( key, prop ) {
+ var index = prop.idx,
+ startValue = start[ index ],
+ endValue = end[ index ],
+ type = propTypes[ prop.type ] || {};
+
+ // if null, don't override start value
+ if ( endValue === null ) {
+ return;
+ }
+ // if null - use end
+ if ( startValue === null ) {
+ result[ index ] = endValue;
+ } else {
+ if ( type.mod ) {
+ if ( endValue - startValue > type.mod / 2 ) {
+ startValue += type.mod;
+ } else if ( startValue - endValue > type.mod / 2 ) {
+ startValue -= type.mod;
+ }
+ }
+ result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
+ }
+ });
+ return this[ spaceName ]( result );
+ },
+ blend: function( opaque ) {
+ // if we are already opaque - return ourself
+ if ( this._rgba[ 3 ] === 1 ) {
+ return this;
+ }
+
+ var rgb = this._rgba.slice(),
+ a = rgb.pop(),
+ blend = color( opaque )._rgba;
+
+ return color( jQuery.map( rgb, function( v, i ) {
+ return ( 1 - a ) * blend[ i ] + a * v;
+ }));
+ },
+ toRgbaString: function() {
+ var prefix = "rgba(",
+ rgba = jQuery.map( this._rgba, function( v, i ) {
+ return v == null ? ( i > 2 ? 1 : 0 ) : v;
+ });
+
+ if ( rgba[ 3 ] === 1 ) {
+ rgba.pop();
+ prefix = "rgb(";
+ }
+
+ return prefix + rgba.join() + ")";
+ },
+ toHslaString: function() {
+ var prefix = "hsla(",
+ hsla = jQuery.map( this.hsla(), function( v, i ) {
+ if ( v == null ) {
+ v = i > 2 ? 1 : 0;
+ }
+
+ // catch 1 and 2
+ if ( i && i < 3 ) {
+ v = Math.round( v * 100 ) + "%";
+ }
+ return v;
+ });
+
+ if ( hsla[ 3 ] === 1 ) {
+ hsla.pop();
+ prefix = "hsl(";
+ }
+ return prefix + hsla.join() + ")";
+ },
+ toHexString: function( includeAlpha ) {
+ var rgba = this._rgba.slice(),
+ alpha = rgba.pop();
+
+ if ( includeAlpha ) {
+ rgba.push( ~~( alpha * 255 ) );
+ }
+
+ return "#" + jQuery.map( rgba, function( v ) {
+
+ // default to 0 when nulls exist
+ v = ( v || 0 ).toString( 16 );
+ return v.length === 1 ? "0" + v : v;
+ }).join("");
+ },
+ toString: function() {
+ return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
+ }
+});
+color.fn.parse.prototype = color.fn;
+
+// hsla conversions adapted from:
+// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
+
+function hue2rgb( p, q, h ) {
+ h = ( h + 1 ) % 1;
+ if ( h * 6 < 1 ) {
+ return p + ( q - p ) * h * 6;
+ }
+ if ( h * 2 < 1) {
+ return q;
+ }
+ if ( h * 3 < 2 ) {
+ return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
+ }
+ return p;
+}
+
+spaces.hsla.to = function( rgba ) {
+ if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
+ return [ null, null, null, rgba[ 3 ] ];
+ }
+ var r = rgba[ 0 ] / 255,
+ g = rgba[ 1 ] / 255,
+ b = rgba[ 2 ] / 255,
+ a = rgba[ 3 ],
+ max = Math.max( r, g, b ),
+ min = Math.min( r, g, b ),
+ diff = max - min,
+ add = max + min,
+ l = add * 0.5,
+ h, s;
+
+ if ( min === max ) {
+ h = 0;
+ } else if ( r === max ) {
+ h = ( 60 * ( g - b ) / diff ) + 360;
+ } else if ( g === max ) {
+ h = ( 60 * ( b - r ) / diff ) + 120;
+ } else {
+ h = ( 60 * ( r - g ) / diff ) + 240;
+ }
+
+ // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
+ // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
+ if ( diff === 0 ) {
+ s = 0;
+ } else if ( l <= 0.5 ) {
+ s = diff / add;
+ } else {
+ s = diff / ( 2 - add );
+ }
+ return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
+};
+
+spaces.hsla.from = function( hsla ) {
+ if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
+ return [ null, null, null, hsla[ 3 ] ];
+ }
+ var h = hsla[ 0 ] / 360,
+ s = hsla[ 1 ],
+ l = hsla[ 2 ],
+ a = hsla[ 3 ],
+ q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
+ p = 2 * l - q;
+
+ return [
+ Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
+ Math.round( hue2rgb( p, q, h ) * 255 ),
+ Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
+ a
+ ];
+};
+
+each( spaces, function( spaceName, space ) {
+ var props = space.props,
+ cache = space.cache,
+ to = space.to,
+ from = space.from;
+
+ // makes rgba() and hsla()
+ color.fn[ spaceName ] = function( value ) {
+
+ // generate a cache for this space if it doesn't exist
+ if ( to && !this[ cache ] ) {
+ this[ cache ] = to( this._rgba );
+ }
+ if ( value === undefined ) {
+ return this[ cache ].slice();
+ }
+
+ var ret,
+ type = jQuery.type( value ),
+ arr = ( type === "array" || type === "object" ) ? value : arguments,
+ local = this[ cache ].slice();
+
+ each( props, function( key, prop ) {
+ var val = arr[ type === "object" ? key : prop.idx ];
+ if ( val == null ) {
+ val = local[ prop.idx ];
+ }
+ local[ prop.idx ] = clamp( val, prop );
+ });
+
+ if ( from ) {
+ ret = color( from( local ) );
+ ret[ cache ] = local;
+ return ret;
+ } else {
+ return color( local );
+ }
+ };
+
+ // makes red() green() blue() alpha() hue() saturation() lightness()
+ each( props, function( key, prop ) {
+ // alpha is included in more than one space
+ if ( color.fn[ key ] ) {
+ return;
+ }
+ color.fn[ key ] = function( value ) {
+ var vtype = jQuery.type( value ),
+ fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
+ local = this[ fn ](),
+ cur = local[ prop.idx ],
+ match;
+
+ if ( vtype === "undefined" ) {
+ return cur;
+ }
+
+ if ( vtype === "function" ) {
+ value = value.call( this, cur );
+ vtype = jQuery.type( value );
+ }
+ if ( value == null && prop.empty ) {
+ return this;
+ }
+ if ( vtype === "string" ) {
+ match = rplusequals.exec( value );
+ if ( match ) {
+ value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
+ }
+ }
+ local[ prop.idx ] = value;
+ return this[ fn ]( local );
+ };
+ });
+});
+
+// add cssHook and .fx.step function for each named hook.
+// accept a space separated string of properties
+color.hook = function( hook ) {
+ var hooks = hook.split( " " );
+ each( hooks, function( i, hook ) {
+ jQuery.cssHooks[ hook ] = {
+ set: function( elem, value ) {
+ var parsed, curElem,
+ backgroundColor = "";
+
+ if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
+ value = color( parsed || value );
+ if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
+ curElem = hook === "backgroundColor" ? elem.parentNode : elem;
+ while (
+ (backgroundColor === "" || backgroundColor === "transparent") &&
+ curElem && curElem.style
+ ) {
+ try {
+ backgroundColor = jQuery.css( curElem, "backgroundColor" );
+ curElem = curElem.parentNode;
+ } catch ( e ) {
+ }
+ }
+
+ value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
+ backgroundColor :
+ "_default" );
+ }
+
+ value = value.toRgbaString();
+ }
+ try {
+ elem.style[ hook ] = value;
+ } catch ( e ) {
+ // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
+ }
+ }
+ };
+ jQuery.fx.step[ hook ] = function( fx ) {
+ if ( !fx.colorInit ) {
+ fx.start = color( fx.elem, hook );
+ fx.end = color( fx.end );
+ fx.colorInit = true;
+ }
+ jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
+ };
+ });
+
+};
+
+color.hook( stepHooks );
+
+jQuery.cssHooks.borderColor = {
+ expand: function( value ) {
+ var expanded = {};
+
+ each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
+ expanded[ "border" + part + "Color" ] = value;
+ });
+ return expanded;
+ }
+};
+
+// Basic color names only.
+// Usage of any of the other color names requires adding yourself or including
+// jquery.color.svg-names.js.
+colors = jQuery.Color.names = {
+ // 4.1. Basic color keywords
+ aqua: "#00ffff",
+ black: "#000000",
+ blue: "#0000ff",
+ fuchsia: "#ff00ff",
+ gray: "#808080",
+ green: "#008000",
+ lime: "#00ff00",
+ maroon: "#800000",
+ navy: "#000080",
+ olive: "#808000",
+ purple: "#800080",
+ red: "#ff0000",
+ silver: "#c0c0c0",
+ teal: "#008080",
+ white: "#ffffff",
+ yellow: "#ffff00",
+
+ // 4.2.3. "transparent" color keyword
+ transparent: [ null, null, null, 0 ],
+
+ _default: "#ffffff"
+};
+
+})( jQuery );
+
+/******************************************************************************/
+/****************************** CLASS ANIMATIONS ******************************/
+/******************************************************************************/
+(function() {
+
+var classAnimationActions = [ "add", "remove", "toggle" ],
+ shorthandStyles = {
+ border: 1,
+ borderBottom: 1,
+ borderColor: 1,
+ borderLeft: 1,
+ borderRight: 1,
+ borderTop: 1,
+ borderWidth: 1,
+ margin: 1,
+ padding: 1
+ };
+
+$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
+ $.fx.step[ prop ] = function( fx ) {
+ if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
+ jQuery.style( fx.elem, prop, fx.end );
+ fx.setAttr = true;
+ }
+ };
+});
+
+function getElementStyles( elem ) {
+ var key, len,
+ style = elem.ownerDocument.defaultView ?
+ elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
+ elem.currentStyle,
+ styles = {};
+
+ if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
+ len = style.length;
+ while ( len-- ) {
+ key = style[ len ];
+ if ( typeof style[ key ] === "string" ) {
+ styles[ $.camelCase( key ) ] = style[ key ];
+ }
+ }
+ // support: Opera, IE <9
+ } else {
+ for ( key in style ) {
+ if ( typeof style[ key ] === "string" ) {
+ styles[ key ] = style[ key ];
+ }
+ }
+ }
+
+ return styles;
+}
+
+function styleDifference( oldStyle, newStyle ) {
+ var diff = {},
+ name, value;
+
+ for ( name in newStyle ) {
+ value = newStyle[ name ];
+ if ( oldStyle[ name ] !== value ) {
+ if ( !shorthandStyles[ name ] ) {
+ if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
+ diff[ name ] = value;
+ }
+ }
+ }
+ }
+
+ return diff;
+}
+
+// support: jQuery <1.8
+if ( !$.fn.addBack ) {
+ $.fn.addBack = function( selector ) {
+ return this.add( selector == null ?
+ this.prevObject : this.prevObject.filter( selector )
+ );
+ };
+}
+
+$.effects.animateClass = function( value, duration, easing, callback ) {
+ var o = $.speed( duration, easing, callback );
+
+ return this.queue( function() {
+ var animated = $( this ),
+ baseClass = animated.attr( "class" ) || "",
+ applyClassChange,
+ allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
+
+ // map the animated objects to store the original styles.
+ allAnimations = allAnimations.map(function() {
+ var el = $( this );
+ return {
+ el: el,
+ start: getElementStyles( this )
+ };
+ });
+
+ // apply class change
+ applyClassChange = function() {
+ $.each( classAnimationActions, function(i, action) {
+ if ( value[ action ] ) {
+ animated[ action + "Class" ]( value[ action ] );
+ }
+ });
+ };
+ applyClassChange();
+
+ // map all animated objects again - calculate new styles and diff
+ allAnimations = allAnimations.map(function() {
+ this.end = getElementStyles( this.el[ 0 ] );
+ this.diff = styleDifference( this.start, this.end );
+ return this;
+ });
+
+ // apply original class
+ animated.attr( "class", baseClass );
+
+ // map all animated objects again - this time collecting a promise
+ allAnimations = allAnimations.map(function() {
+ var styleInfo = this,
+ dfd = $.Deferred(),
+ opts = $.extend({}, o, {
+ queue: false,
+ complete: function() {
+ dfd.resolve( styleInfo );
+ }
+ });
+
+ this.el.animate( this.diff, opts );
+ return dfd.promise();
+ });
+
+ // once all animations have completed:
+ $.when.apply( $, allAnimations.get() ).done(function() {
+
+ // set the final class
+ applyClassChange();
+
+ // for each animated element,
+ // clear all css properties that were animated
+ $.each( arguments, function() {
+ var el = this.el;
+ $.each( this.diff, function(key) {
+ el.css( key, "" );
+ });
+ });
+
+ // this is guarnteed to be there if you use jQuery.speed()
+ // it also handles dequeuing the next anim...
+ o.complete.call( animated[ 0 ] );
+ });
+ });
+};
+
+$.fn.extend({
+ addClass: (function( orig ) {
+ return function( classNames, speed, easing, callback ) {
+ return speed ?
+ $.effects.animateClass.call( this,
+ { add: classNames }, speed, easing, callback ) :
+ orig.apply( this, arguments );
+ };
+ })( $.fn.addClass ),
+
+ removeClass: (function( orig ) {
+ return function( classNames, speed, easing, callback ) {
+ return arguments.length > 1 ?
+ $.effects.animateClass.call( this,
+ { remove: classNames }, speed, easing, callback ) :
+ orig.apply( this, arguments );
+ };
+ })( $.fn.removeClass ),
+
+ toggleClass: (function( orig ) {
+ return function( classNames, force, speed, easing, callback ) {
+ if ( typeof force === "boolean" || force === undefined ) {
+ if ( !speed ) {
+ // without speed parameter
+ return orig.apply( this, arguments );
+ } else {
+ return $.effects.animateClass.call( this,
+ (force ? { add: classNames } : { remove: classNames }),
+ speed, easing, callback );
+ }
+ } else {
+ // without force parameter
+ return $.effects.animateClass.call( this,
+ { toggle: classNames }, force, speed, easing );
+ }
+ };
+ })( $.fn.toggleClass ),
+
+ switchClass: function( remove, add, speed, easing, callback) {
+ return $.effects.animateClass.call( this, {
+ add: add,
+ remove: remove
+ }, speed, easing, callback );
+ }
+});
+
+})();
+
+/******************************************************************************/
+/*********************************** EFFECTS **********************************/
+/******************************************************************************/
+
+(function() {
+
+$.extend( $.effects, {
+ version: "1.11.4",
+
+ // Saves a set of properties in a data storage
+ save: function( element, set ) {
+ for ( var i = 0; i < set.length; i++ ) {
+ if ( set[ i ] !== null ) {
+ element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
+ }
+ }
+ },
+
+ // Restores a set of previously saved properties from a data storage
+ restore: function( element, set ) {
+ var val, i;
+ for ( i = 0; i < set.length; i++ ) {
+ if ( set[ i ] !== null ) {
+ val = element.data( dataSpace + set[ i ] );
+ // support: jQuery 1.6.2
+ // http://bugs.jquery.com/ticket/9917
+ // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
+ // We can't differentiate between "" and 0 here, so we just assume
+ // empty string since it's likely to be a more common value...
+ if ( val === undefined ) {
+ val = "";
+ }
+ element.css( set[ i ], val );
+ }
+ }
+ },
+
+ setMode: function( el, mode ) {
+ if (mode === "toggle") {
+ mode = el.is( ":hidden" ) ? "show" : "hide";
+ }
+ return mode;
+ },
+
+ // Translates a [top,left] array into a baseline value
+ // this should be a little more flexible in the future to handle a string & hash
+ getBaseline: function( origin, original ) {
+ var y, x;
+ switch ( origin[ 0 ] ) {
+ case "top": y = 0; break;
+ case "middle": y = 0.5; break;
+ case "bottom": y = 1; break;
+ default: y = origin[ 0 ] / original.height;
+ }
+ switch ( origin[ 1 ] ) {
+ case "left": x = 0; break;
+ case "center": x = 0.5; break;
+ case "right": x = 1; break;
+ default: x = origin[ 1 ] / original.width;
+ }
+ return {
+ x: x,
+ y: y
+ };
+ },
+
+ // Wraps the element around a wrapper that copies position properties
+ createWrapper: function( element ) {
+
+ // if the element is already wrapped, return it
+ if ( element.parent().is( ".ui-effects-wrapper" )) {
+ return element.parent();
+ }
+
+ // wrap the element
+ var props = {
+ width: element.outerWidth(true),
+ height: element.outerHeight(true),
+ "float": element.css( "float" )
+ },
+ wrapper = $( "<div></div>" )
+ .addClass( "ui-effects-wrapper" )
+ .css({
+ fontSize: "100%",
+ background: "transparent",
+ border: "none",
+ margin: 0,
+ padding: 0
+ }),
+ // Store the size in case width/height are defined in % - Fixes #5245
+ size = {
+ width: element.width(),
+ height: element.height()
+ },
+ active = document.activeElement;
+
+ // support: Firefox
+ // Firefox incorrectly exposes anonymous content
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
+ try {
+ active.id;
+ } catch ( e ) {
+ active = document.body;
+ }
+
+ element.wrap( wrapper );
+
+ // Fixes #7595 - Elements lose focus when wrapped.
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
+ $( active ).focus();
+ }
+
+ wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
+
+ // transfer positioning properties to the wrapper
+ if ( element.css( "position" ) === "static" ) {
+ wrapper.css({ position: "relative" });
+ element.css({ position: "relative" });
+ } else {
+ $.extend( props, {
+ position: element.css( "position" ),
+ zIndex: element.css( "z-index" )
+ });
+ $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
+ props[ pos ] = element.css( pos );
+ if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
+ props[ pos ] = "auto";
+ }
+ });
+ element.css({
+ position: "relative",
+ top: 0,
+ left: 0,
+ right: "auto",
+ bottom: "auto"
+ });
+ }
+ element.css(size);
+
+ return wrapper.css( props ).show();
+ },
+
+ removeWrapper: function( element ) {
+ var active = document.activeElement;
+
+ if ( element.parent().is( ".ui-effects-wrapper" ) ) {
+ element.parent().replaceWith( element );
+
+ // Fixes #7595 - Elements lose focus when wrapped.
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
+ $( active ).focus();
+ }
+ }
+
+ return element;
+ },
+
+ setTransition: function( element, list, factor, value ) {
+ value = value || {};
+ $.each( list, function( i, x ) {
+ var unit = element.cssUnit( x );
+ if ( unit[ 0 ] > 0 ) {
+ value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
+ }
+ });
+ return value;
+ }
+});
+
+// return an effect options object for the given parameters:
+function _normalizeArguments( effect, options, speed, callback ) {
+
+ // allow passing all options as the first parameter
+ if ( $.isPlainObject( effect ) ) {
+ options = effect;
+ effect = effect.effect;
+ }
+
+ // convert to an object
+ effect = { effect: effect };
+
+ // catch (effect, null, ...)
+ if ( options == null ) {
+ options = {};
+ }
+
+ // catch (effect, callback)
+ if ( $.isFunction( options ) ) {
+ callback = options;
+ speed = null;
+ options = {};
+ }
+
+ // catch (effect, speed, ?)
+ if ( typeof options === "number" || $.fx.speeds[ options ] ) {
+ callback = speed;
+ speed = options;
+ options = {};
+ }
+
+ // catch (effect, options, callback)
+ if ( $.isFunction( speed ) ) {
+ callback = speed;
+ speed = null;
+ }
+
+ // add options to effect
+ if ( options ) {
+ $.extend( effect, options );
+ }
+
+ speed = speed || options.duration;
+ effect.duration = $.fx.off ? 0 :
+ typeof speed === "number" ? speed :
+ speed in $.fx.speeds ? $.fx.speeds[ speed ] :
+ $.fx.speeds._default;
+
+ effect.complete = callback || options.complete;
+
+ return effect;
+}
+
+function standardAnimationOption( option ) {
+ // Valid standard speeds (nothing, number, named speed)
+ if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
+ return true;
+ }
+
+ // Invalid strings - treat as "normal" speed
+ if ( typeof option === "string" && !$.effects.effect[ option ] ) {
+ return true;
+ }
+
+ // Complete callback
+ if ( $.isFunction( option ) ) {
+ return true;
+ }
+
+ // Options hash (but not naming an effect)
+ if ( typeof option === "object" && !option.effect ) {
+ return true;
+ }
+
+ // Didn't match any standard API
+ return false;
+}
+
+$.fn.extend({
+ effect: function( /* effect, options, speed, callback */ ) {
+ var args = _normalizeArguments.apply( this, arguments ),
+ mode = args.mode,
+ queue = args.queue,
+ effectMethod = $.effects.effect[ args.effect ];
+
+ if ( $.fx.off || !effectMethod ) {
+ // delegate to the original method (e.g., .show()) if possible
+ if ( mode ) {
+ return this[ mode ]( args.duration, args.complete );
+ } else {
+ return this.each( function() {
+ if ( args.complete ) {
+ args.complete.call( this );
+ }
+ });
+ }
+ }
+
+ function run( next ) {
+ var elem = $( this ),
+ complete = args.complete,
+ mode = args.mode;
+
+ function done() {
+ if ( $.isFunction( complete ) ) {
+ complete.call( elem[0] );
+ }
+ if ( $.isFunction( next ) ) {
+ next();
+ }
+ }
+
+ // If the element already has the correct final state, delegate to
+ // the core methods so the internal tracking of "olddisplay" works.
+ if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
+ elem[ mode ]();
+ done();
+ } else {
+ effectMethod.call( elem[0], args, done );
+ }
+ }
+
+ return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
+ },
+
+ show: (function( orig ) {
+ return function( option ) {
+ if ( standardAnimationOption( option ) ) {
+ return orig.apply( this, arguments );
+ } else {
+ var args = _normalizeArguments.apply( this, arguments );
+ args.mode = "show";
+ return this.effect.call( this, args );
+ }
+ };
+ })( $.fn.show ),
+
+ hide: (function( orig ) {
+ return function( option ) {
+ if ( standardAnimationOption( option ) ) {
+ return orig.apply( this, arguments );
+ } else {
+ var args = _normalizeArguments.apply( this, arguments );
+ args.mode = "hide";
+ return this.effect.call( this, args );
+ }
+ };
+ })( $.fn.hide ),
+
+ toggle: (function( orig ) {
+ return function( option ) {
+ if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
+ return orig.apply( this, arguments );
+ } else {
+ var args = _normalizeArguments.apply( this, arguments );
+ args.mode = "toggle";
+ return this.effect.call( this, args );
+ }
+ };
+ })( $.fn.toggle ),
+
+ // helper functions
+ cssUnit: function(key) {
+ var style = this.css( key ),
+ val = [];
+
+ $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
+ if ( style.indexOf( unit ) > 0 ) {
+ val = [ parseFloat( style ), unit ];
+ }
+ });
+ return val;
+ }
+});
+
+})();
+
+/******************************************************************************/
+/*********************************** EASING ***********************************/
+/******************************************************************************/
+
+(function() {
+
+// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
+
+var baseEasings = {};
+
+$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
+ baseEasings[ name ] = function( p ) {
+ return Math.pow( p, i + 2 );
+ };
+});
+
+$.extend( baseEasings, {
+ Sine: function( p ) {
+ return 1 - Math.cos( p * Math.PI / 2 );
+ },
+ Circ: function( p ) {
+ return 1 - Math.sqrt( 1 - p * p );
+ },
+ Elastic: function( p ) {
+ return p === 0 || p === 1 ? p :
+ -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
+ },
+ Back: function( p ) {
+ return p * p * ( 3 * p - 2 );
+ },
+ Bounce: function( p ) {
+ var pow2,
+ bounce = 4;
+
+ while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
+ return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
+ }
+});
+
+$.each( baseEasings, function( name, easeIn ) {
+ $.easing[ "easeIn" + name ] = easeIn;
+ $.easing[ "easeOut" + name ] = function( p ) {
+ return 1 - easeIn( 1 - p );
+ };
+ $.easing[ "easeInOut" + name ] = function( p ) {
+ return p < 0.5 ?
+ easeIn( p * 2 ) / 2 :
+ 1 - easeIn( p * -2 + 2 ) / 2;
+ };
+});
+
+})();
+
+var effect = $.effects;
+
+
+/*!
+ * jQuery UI Effects Blind 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/blind-effect/
+ */
+
+
+var effectBlind = $.effects.effect.blind = function( o, done ) {
+ // Create element
+ var el = $( this ),
+ rvertical = /up|down|vertical/,
+ rpositivemotion = /up|left|vertical|horizontal/,
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ direction = o.direction || "up",
+ vertical = rvertical.test( direction ),
+ ref = vertical ? "height" : "width",
+ ref2 = vertical ? "top" : "left",
+ motion = rpositivemotion.test( direction ),
+ animation = {},
+ show = mode === "show",
+ wrapper, distance, margin;
+
+ // if already wrapped, the wrapper's properties are my property. #6245
+ if ( el.parent().is( ".ui-effects-wrapper" ) ) {
+ $.effects.save( el.parent(), props );
+ } else {
+ $.effects.save( el, props );
+ }
+ el.show();
+ wrapper = $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+
+ distance = wrapper[ ref ]();
+ margin = parseFloat( wrapper.css( ref2 ) ) || 0;
+
+ animation[ ref ] = show ? distance : 0;
+ if ( !motion ) {
+ el
+ .css( vertical ? "bottom" : "right", 0 )
+ .css( vertical ? "top" : "left", "auto" )
+ .css({ position: "absolute" });
+
+ animation[ ref2 ] = show ? margin : distance + margin;
+ }
+
+ // start at 0 if we are showing
+ if ( show ) {
+ wrapper.css( ref, 0 );
+ if ( !motion ) {
+ wrapper.css( ref2, margin + distance );
+ }
+ }
+
+ // Animate
+ wrapper.animate( animation, {
+ duration: o.duration,
+ easing: o.easing,
+ queue: false,
+ complete: function() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+};
+
+
+/*!
+ * jQuery UI Effects Bounce 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/bounce-effect/
+ */
+
+
+var effectBounce = $.effects.effect.bounce = function( o, done ) {
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+
+ // defaults:
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ hide = mode === "hide",
+ show = mode === "show",
+ direction = o.direction || "up",
+ distance = o.distance,
+ times = o.times || 5,
+
+ // number of internal animations
+ anims = times * 2 + ( show || hide ? 1 : 0 ),
+ speed = o.duration / anims,
+ easing = o.easing,
+
+ // utility:
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
+ motion = ( direction === "up" || direction === "left" ),
+ i,
+ upAnim,
+ downAnim,
+
+ // we will need to re-assemble the queue to stack our animations in place
+ queue = el.queue(),
+ queuelen = queue.length;
+
+ // Avoid touching opacity to prevent clearType and PNG issues in IE
+ if ( show || hide ) {
+ props.push( "opacity" );
+ }
+
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el ); // Create Wrapper
+
+ // default distance for the BIGGEST bounce is the outer Distance / 3
+ if ( !distance ) {
+ distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
+ }
+
+ if ( show ) {
+ downAnim = { opacity: 1 };
+ downAnim[ ref ] = 0;
+
+ // if we are showing, force opacity 0 and set the initial position
+ // then do the "first" animation
+ el.css( "opacity", 0 )
+ .css( ref, motion ? -distance * 2 : distance * 2 )
+ .animate( downAnim, speed, easing );
+ }
+
+ // start at the smallest distance if we are hiding
+ if ( hide ) {
+ distance = distance / Math.pow( 2, times - 1 );
+ }
+
+ downAnim = {};
+ downAnim[ ref ] = 0;
+ // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
+ for ( i = 0; i < times; i++ ) {
+ upAnim = {};
+ upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
+
+ el.animate( upAnim, speed, easing )
+ .animate( downAnim, speed, easing );
+
+ distance = hide ? distance * 2 : distance / 2;
+ }
+
+ // Last Bounce when Hiding
+ if ( hide ) {
+ upAnim = { opacity: 0 };
+ upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
+
+ el.animate( upAnim, speed, easing );
+ }
+
+ el.queue(function() {
+ if ( hide ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ });
+
+ // inject all the animations we just queued to be first in line (after "inprogress")
+ if ( queuelen > 1) {
+ queue.splice.apply( queue,
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ }
+ el.dequeue();
+
+};
+
+
+/*!
+ * jQuery UI Effects Clip 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/clip-effect/
+ */
+
+
+var effectClip = $.effects.effect.clip = function( o, done ) {
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+ direction = o.direction || "vertical",
+ vert = direction === "vertical",
+ size = vert ? "height" : "width",
+ position = vert ? "top" : "left",
+ animation = {},
+ wrapper, animate, distance;
+
+ // Save & Show
+ $.effects.save( el, props );
+ el.show();
+
+ // Create Wrapper
+ wrapper = $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+ animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
+ distance = animate[ size ]();
+
+ // Shift
+ if ( show ) {
+ animate.css( size, 0 );
+ animate.css( position, distance / 2 );
+ }
+
+ // Create Animation Object:
+ animation[ size ] = show ? distance : 0;
+ animation[ position ] = show ? 0 : distance / 2;
+
+ // Animate
+ animate.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( !show ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+
+};
+
+
+/*!
+ * jQuery UI Effects Drop 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/drop-effect/
+ */
+
+
+var effectDrop = $.effects.effect.drop = function( o, done ) {
+
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+ direction = o.direction || "left",
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
+ motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
+ animation = {
+ opacity: show ? 1 : 0
+ },
+ distance;
+
+ // Adjust
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el );
+
+ distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
+
+ if ( show ) {
+ el
+ .css( "opacity", 0 )
+ .css( ref, motion === "pos" ? -distance : distance );
+ }
+
+ // Animation
+ animation[ ref ] = ( show ?
+ ( motion === "pos" ? "+=" : "-=" ) :
+ ( motion === "pos" ? "-=" : "+=" ) ) +
+ distance;
+
+ // Animate
+ el.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+};
+
+
+/*!
+ * jQuery UI Effects Explode 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/explode-effect/
+ */
+
+
+var effectExplode = $.effects.effect.explode = function( o, done ) {
+
+ var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
+ cells = rows,
+ el = $( this ),
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+
+ // show and then visibility:hidden the element before calculating offset
+ offset = el.show().css( "visibility", "hidden" ).offset(),
+
+ // width and height of a piece
+ width = Math.ceil( el.outerWidth() / cells ),
+ height = Math.ceil( el.outerHeight() / rows ),
+ pieces = [],
+
+ // loop
+ i, j, left, top, mx, my;
+
+ // children animate complete:
+ function childComplete() {
+ pieces.push( this );
+ if ( pieces.length === rows * cells ) {
+ animComplete();
+ }
+ }
+
+ // clone the element for each row and cell.
+ for ( i = 0; i < rows ; i++ ) { // ===>
+ top = offset.top + i * height;
+ my = i - ( rows - 1 ) / 2 ;
+
+ for ( j = 0; j < cells ; j++ ) { // |||
+ left = offset.left + j * width;
+ mx = j - ( cells - 1 ) / 2 ;
+
+ // Create a clone of the now hidden main element that will be absolute positioned
+ // within a wrapper div off the -left and -top equal to size of our pieces
+ el
+ .clone()
+ .appendTo( "body" )
+ .wrap( "<div></div>" )
+ .css({
+ position: "absolute",
+ visibility: "visible",
+ left: -j * width,
+ top: -i * height
+ })
+
+ // select the wrapper - make it overflow: hidden and absolute positioned based on
+ // where the original was located +left and +top equal to the size of pieces
+ .parent()
+ .addClass( "ui-effects-explode" )
+ .css({
+ position: "absolute",
+ overflow: "hidden",
+ width: width,
+ height: height,
+ left: left + ( show ? mx * width : 0 ),
+ top: top + ( show ? my * height : 0 ),
+ opacity: show ? 0 : 1
+ }).animate({
+ left: left + ( show ? 0 : mx * width ),
+ top: top + ( show ? 0 : my * height ),
+ opacity: show ? 1 : 0
+ }, o.duration || 500, o.easing, childComplete );
+ }
+ }
+
+ function animComplete() {
+ el.css({
+ visibility: "visible"
+ });
+ $( pieces ).remove();
+ if ( !show ) {
+ el.hide();
+ }
+ done();
+ }
+};
+
+
+/*!
+ * jQuery UI Effects Fade 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/fade-effect/
+ */
+
+
+var effectFade = $.effects.effect.fade = function( o, done ) {
+ var el = $( this ),
+ mode = $.effects.setMode( el, o.mode || "toggle" );
+
+ el.animate({
+ opacity: mode
+ }, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: done
+ });
+};
+
+
+/*!
+ * jQuery UI Effects Fold 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/fold-effect/
+ */
+
+
+var effectFold = $.effects.effect.fold = function( o, done ) {
+
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+ hide = mode === "hide",
+ size = o.size || 15,
+ percent = /([0-9]+)%/.exec( size ),
+ horizFirst = !!o.horizFirst,
+ widthFirst = show !== horizFirst,
+ ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
+ duration = o.duration / 2,
+ wrapper, distance,
+ animation1 = {},
+ animation2 = {};
+
+ $.effects.save( el, props );
+ el.show();
+
+ // Create Wrapper
+ wrapper = $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+ distance = widthFirst ?
+ [ wrapper.width(), wrapper.height() ] :
+ [ wrapper.height(), wrapper.width() ];
+
+ if ( percent ) {
+ size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
+ }
+ if ( show ) {
+ wrapper.css( horizFirst ? {
+ height: 0,
+ width: size
+ } : {
+ height: size,
+ width: 0
+ });
+ }
+
+ // Animation
+ animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
+ animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
+
+ // Animate
+ wrapper
+ .animate( animation1, duration, o.easing )
+ .animate( animation2, duration, o.easing, function() {
+ if ( hide ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ });
+
+};
+
+
+/*!
+ * jQuery UI Effects Highlight 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/highlight-effect/
+ */
+
+
+var effectHighlight = $.effects.effect.highlight = function( o, done ) {
+ var elem = $( this ),
+ props = [ "backgroundImage", "backgroundColor", "opacity" ],
+ mode = $.effects.setMode( elem, o.mode || "show" ),
+ animation = {
+ backgroundColor: elem.css( "backgroundColor" )
+ };
+
+ if (mode === "hide") {
+ animation.opacity = 0;
+ }
+
+ $.effects.save( elem, props );
+
+ elem
+ .show()
+ .css({
+ backgroundImage: "none",
+ backgroundColor: o.color || "#ffff99"
+ })
+ .animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( mode === "hide" ) {
+ elem.hide();
+ }
+ $.effects.restore( elem, props );
+ done();
+ }
+ });
+};
+
+
+/*!
+ * jQuery UI Effects Size 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/size-effect/
+ */
+
+
+var effectSize = $.effects.effect.size = function( o, done ) {
+
+ // Create element
+ var original, baseline, factor,
+ el = $( this ),
+ props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
+
+ // Always restore
+ props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
+
+ // Copy for children
+ props2 = [ "width", "height", "overflow" ],
+ cProps = [ "fontSize" ],
+ vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
+ hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
+
+ // Set options
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ restore = o.restore || mode !== "effect",
+ scale = o.scale || "both",
+ origin = o.origin || [ "middle", "center" ],
+ position = el.css( "position" ),
+ props = restore ? props0 : props1,
+ zero = {
+ height: 0,
+ width: 0,
+ outerHeight: 0,
+ outerWidth: 0
+ };
+
+ if ( mode === "show" ) {
+ el.show();
+ }
+ original = {
+ height: el.height(),
+ width: el.width(),
+ outerHeight: el.outerHeight(),
+ outerWidth: el.outerWidth()
+ };
+
+ if ( o.mode === "toggle" && mode === "show" ) {
+ el.from = o.to || zero;
+ el.to = o.from || original;
+ } else {
+ el.from = o.from || ( mode === "show" ? zero : original );
+ el.to = o.to || ( mode === "hide" ? zero : original );
+ }
+
+ // Set scaling factor
+ factor = {
+ from: {
+ y: el.from.height / original.height,
+ x: el.from.width / original.width
+ },
+ to: {
+ y: el.to.height / original.height,
+ x: el.to.width / original.width
+ }
+ };
+
+ // Scale the css box
+ if ( scale === "box" || scale === "both" ) {
+
+ // Vertical props scaling
+ if ( factor.from.y !== factor.to.y ) {
+ props = props.concat( vProps );
+ el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
+ el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
+ }
+
+ // Horizontal props scaling
+ if ( factor.from.x !== factor.to.x ) {
+ props = props.concat( hProps );
+ el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
+ el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
+ }
+ }
+
+ // Scale the content
+ if ( scale === "content" || scale === "both" ) {
+
+ // Vertical props scaling
+ if ( factor.from.y !== factor.to.y ) {
+ props = props.concat( cProps ).concat( props2 );
+ el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
+ el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
+ }
+ }
+
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el );
+ el.css( "overflow", "hidden" ).css( el.from );
+
+ // Adjust
+ if (origin) { // Calculate baseline shifts
+ baseline = $.effects.getBaseline( origin, original );
+ el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
+ el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
+ el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
+ el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
+ }
+ el.css( el.from ); // set top & left
+
+ // Animate
+ if ( scale === "content" || scale === "both" ) { // Scale the children
+
+ // Add margins/font-size
+ vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
+ hProps = hProps.concat([ "marginLeft", "marginRight" ]);
+ props2 = props0.concat(vProps).concat(hProps);
+
+ el.find( "*[width]" ).each( function() {
+ var child = $( this ),
+ c_original = {
+ height: child.height(),
+ width: child.width(),
+ outerHeight: child.outerHeight(),
+ outerWidth: child.outerWidth()
+ };
+ if (restore) {
+ $.effects.save(child, props2);
+ }
+
+ child.from = {
+ height: c_original.height * factor.from.y,
+ width: c_original.width * factor.from.x,
+ outerHeight: c_original.outerHeight * factor.from.y,
+ outerWidth: c_original.outerWidth * factor.from.x
+ };
+ child.to = {
+ height: c_original.height * factor.to.y,
+ width: c_original.width * factor.to.x,
+ outerHeight: c_original.height * factor.to.y,
+ outerWidth: c_original.width * factor.to.x
+ };
+
+ // Vertical props scaling
+ if ( factor.from.y !== factor.to.y ) {
+ child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
+ child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
+ }
+
+ // Horizontal props scaling
+ if ( factor.from.x !== factor.to.x ) {
+ child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
+ child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
+ }
+
+ // Animate children
+ child.css( child.from );
+ child.animate( child.to, o.duration, o.easing, function() {
+
+ // Restore children
+ if ( restore ) {
+ $.effects.restore( child, props2 );
+ }
+ });
+ });
+ }
+
+ // Animate
+ el.animate( el.to, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( el.to.opacity === 0 ) {
+ el.css( "opacity", el.from.opacity );
+ }
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ if ( !restore ) {
+
+ // we need to calculate our new positioning based on the scaling
+ if ( position === "static" ) {
+ el.css({
+ position: "relative",
+ top: el.to.top,
+ left: el.to.left
+ });
+ } else {
+ $.each([ "top", "left" ], function( idx, pos ) {
+ el.css( pos, function( _, str ) {
+ var val = parseInt( str, 10 ),
+ toRef = idx ? el.to.left : el.to.top;
+
+ // if original was "auto", recalculate the new value from wrapper
+ if ( str === "auto" ) {
+ return toRef + "px";
+ }
+
+ return val + toRef + "px";
+ });
+ });
+ }
+ }
+
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+
+};
+
+
+/*!
+ * jQuery UI Effects Scale 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/scale-effect/
+ */
+
+
+var effectScale = $.effects.effect.scale = function( o, done ) {
+
+ // Create element
+ var el = $( this ),
+ options = $.extend( true, {}, o ),
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ percent = parseInt( o.percent, 10 ) ||
+ ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
+ direction = o.direction || "both",
+ origin = o.origin,
+ original = {
+ height: el.height(),
+ width: el.width(),
+ outerHeight: el.outerHeight(),
+ outerWidth: el.outerWidth()
+ },
+ factor = {
+ y: direction !== "horizontal" ? (percent / 100) : 1,
+ x: direction !== "vertical" ? (percent / 100) : 1
+ };
+
+ // We are going to pass this effect to the size effect:
+ options.effect = "size";
+ options.queue = false;
+ options.complete = done;
+
+ // Set default origin and restore for show/hide
+ if ( mode !== "effect" ) {
+ options.origin = origin || [ "middle", "center" ];
+ options.restore = true;
+ }
+
+ options.from = o.from || ( mode === "show" ? {
+ height: 0,
+ width: 0,
+ outerHeight: 0,
+ outerWidth: 0
+ } : original );
+ options.to = {
+ height: original.height * factor.y,
+ width: original.width * factor.x,
+ outerHeight: original.outerHeight * factor.y,
+ outerWidth: original.outerWidth * factor.x
+ };
+
+ // Fade option to support puff
+ if ( options.fade ) {
+ if ( mode === "show" ) {
+ options.from.opacity = 0;
+ options.to.opacity = 1;
+ }
+ if ( mode === "hide" ) {
+ options.from.opacity = 1;
+ options.to.opacity = 0;
+ }
+ }
+
+ // Animate
+ el.effect( options );
+
+};
+
+
+/*!
+ * jQuery UI Effects Puff 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/puff-effect/
+ */
+
+
+var effectPuff = $.effects.effect.puff = function( o, done ) {
+ var elem = $( this ),
+ mode = $.effects.setMode( elem, o.mode || "hide" ),
+ hide = mode === "hide",
+ percent = parseInt( o.percent, 10 ) || 150,
+ factor = percent / 100,
+ original = {
+ height: elem.height(),
+ width: elem.width(),
+ outerHeight: elem.outerHeight(),
+ outerWidth: elem.outerWidth()
+ };
+
+ $.extend( o, {
+ effect: "scale",
+ queue: false,
+ fade: true,
+ mode: mode,
+ complete: done,
+ percent: hide ? percent : 100,
+ from: hide ?
+ original :
+ {
+ height: original.height * factor,
+ width: original.width * factor,
+ outerHeight: original.outerHeight * factor,
+ outerWidth: original.outerWidth * factor
+ }
+ });
+
+ elem.effect( o );
+};
+
+
+/*!
+ * jQuery UI Effects Pulsate 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/pulsate-effect/
+ */
+
+
+var effectPulsate = $.effects.effect.pulsate = function( o, done ) {
+ var elem = $( this ),
+ mode = $.effects.setMode( elem, o.mode || "show" ),
+ show = mode === "show",
+ hide = mode === "hide",
+ showhide = ( show || mode === "hide" ),
+
+ // showing or hiding leaves of the "last" animation
+ anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
+ duration = o.duration / anims,
+ animateTo = 0,
+ queue = elem.queue(),
+ queuelen = queue.length,
+ i;
+
+ if ( show || !elem.is(":visible")) {
+ elem.css( "opacity", 0 ).show();
+ animateTo = 1;
+ }
+
+ // anims - 1 opacity "toggles"
+ for ( i = 1; i < anims; i++ ) {
+ elem.animate({
+ opacity: animateTo
+ }, duration, o.easing );
+ animateTo = 1 - animateTo;
+ }
+
+ elem.animate({
+ opacity: animateTo
+ }, duration, o.easing);
+
+ elem.queue(function() {
+ if ( hide ) {
+ elem.hide();
+ }
+ done();
+ });
+
+ // We just queued up "anims" animations, we need to put them next in the queue
+ if ( queuelen > 1 ) {
+ queue.splice.apply( queue,
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ }
+ elem.dequeue();
+};
+
+
+/*!
+ * jQuery UI Effects Shake 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/shake-effect/
+ */
+
+
+var effectShake = $.effects.effect.shake = function( o, done ) {
+
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ direction = o.direction || "left",
+ distance = o.distance || 20,
+ times = o.times || 3,
+ anims = times * 2 + 1,
+ speed = Math.round( o.duration / anims ),
+ ref = (direction === "up" || direction === "down") ? "top" : "left",
+ positiveMotion = (direction === "up" || direction === "left"),
+ animation = {},
+ animation1 = {},
+ animation2 = {},
+ i,
+
+ // we will need to re-assemble the queue to stack our animations in place
+ queue = el.queue(),
+ queuelen = queue.length;
+
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el );
+
+ // Animation
+ animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
+ animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
+ animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
+
+ // Animate
+ el.animate( animation, speed, o.easing );
+
+ // Shakes
+ for ( i = 1; i < times; i++ ) {
+ el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
+ }
+ el
+ .animate( animation1, speed, o.easing )
+ .animate( animation, speed / 2, o.easing )
+ .queue(function() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ });
+
+ // inject all the animations we just queued to be first in line (after "inprogress")
+ if ( queuelen > 1) {
+ queue.splice.apply( queue,
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ }
+ el.dequeue();
+
+};
+
+
+/*!
+ * jQuery UI Effects Slide 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/slide-effect/
+ */
+
+
+var effectSlide = $.effects.effect.slide = function( o, done ) {
+
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
+ mode = $.effects.setMode( el, o.mode || "show" ),
+ show = mode === "show",
+ direction = o.direction || "left",
+ ref = (direction === "up" || direction === "down") ? "top" : "left",
+ positiveMotion = (direction === "up" || direction === "left"),
+ distance,
+ animation = {};
+
+ // Adjust
+ $.effects.save( el, props );
+ el.show();
+ distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
+
+ $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+
+ if ( show ) {
+ el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
+ }
+
+ // Animation
+ animation[ ref ] = ( show ?
+ ( positiveMotion ? "+=" : "-=") :
+ ( positiveMotion ? "-=" : "+=")) +
+ distance;
+
+ // Animate
+ el.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+};
+
+
+/*!
+ * jQuery UI Effects Transfer 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/transfer-effect/
+ */
+
+
+var effectTransfer = $.effects.effect.transfer = function( o, done ) {
+ var elem = $( this ),
+ target = $( o.to ),
+ targetFixed = target.css( "position" ) === "fixed",
+ body = $("body"),
+ fixTop = targetFixed ? body.scrollTop() : 0,
+ fixLeft = targetFixed ? body.scrollLeft() : 0,
+ endPosition = target.offset(),
+ animation = {
+ top: endPosition.top - fixTop,
+ left: endPosition.left - fixLeft,
+ height: target.innerHeight(),
+ width: target.innerWidth()
+ },
+ startPosition = elem.offset(),
+ transfer = $( "<div class='ui-effects-transfer'></div>" )
+ .appendTo( document.body )
+ .addClass( o.className )
+ .css({
+ top: startPosition.top - fixTop,
+ left: startPosition.left - fixLeft,
+ height: elem.innerHeight(),
+ width: elem.innerWidth(),
+ position: targetFixed ? "fixed" : "absolute"
+ })
+ .animate( animation, o.duration, o.easing, function() {
+ transfer.remove();
+ done();
+ });
+};
+
+
+/*!
+ * jQuery UI Progressbar 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/progressbar/
+ */
+
+
+var progressbar = $.widget( "ui.progressbar", {
+ version: "1.11.4",
+ options: {
+ max: 100,
+ value: 0,
+
+ change: null,
+ complete: null
+ },
+
+ min: 0,
+
+ _create: function() {
+ // Constrain initial value
+ this.oldValue = this.options.value = this._constrainedValue();
+
+ this.element
+ .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+ .attr({
+ // Only set static values, aria-valuenow and aria-valuemax are
+ // set inside _refreshValue()
+ role: "progressbar",
+ "aria-valuemin": this.min
+ });
+
+ this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
+ .appendTo( this.element );
+
+ this._refreshValue();
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-valuemin" )
+ .removeAttr( "aria-valuemax" )
+ .removeAttr( "aria-valuenow" );
+
+ this.valueDiv.remove();
+ },
+
+ value: function( newValue ) {
+ if ( newValue === undefined ) {
+ return this.options.value;
+ }
+
+ this.options.value = this._constrainedValue( newValue );
+ this._refreshValue();
+ },
+
+ _constrainedValue: function( newValue ) {
+ if ( newValue === undefined ) {
+ newValue = this.options.value;
+ }
+
+ this.indeterminate = newValue === false;
+
+ // sanitize value
+ if ( typeof newValue !== "number" ) {
+ newValue = 0;
+ }
+
+ return this.indeterminate ? false :
+ Math.min( this.options.max, Math.max( this.min, newValue ) );
+ },
+
+ _setOptions: function( options ) {
+ // Ensure "value" option is set after other values (like max)
+ var value = options.value;
+ delete options.value;
+
+ this._super( options );
+
+ this.options.value = this._constrainedValue( value );
+ this._refreshValue();
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "max" ) {
+ // Don't allow a max less than min
+ value = Math.max( this.min, value );
+ }
+ if ( key === "disabled" ) {
+ this.element
+ .toggleClass( "ui-state-disabled", !!value )
+ .attr( "aria-disabled", value );
+ }
+ this._super( key, value );
+ },
+
+ _percentage: function() {
+ return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
+ },
+
+ _refreshValue: function() {
+ var value = this.options.value,
+ percentage = this._percentage();
+
+ this.valueDiv
+ .toggle( this.indeterminate || value > this.min )
+ .toggleClass( "ui-corner-right", value === this.options.max )
+ .width( percentage.toFixed(0) + "%" );
+
+ this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
+
+ if ( this.indeterminate ) {
+ this.element.removeAttr( "aria-valuenow" );
+ if ( !this.overlayDiv ) {
+ this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv );
+ }
+ } else {
+ this.element.attr({
+ "aria-valuemax": this.options.max,
+ "aria-valuenow": value
+ });
+ if ( this.overlayDiv ) {
+ this.overlayDiv.remove();
+ this.overlayDiv = null;
+ }
+ }
+
+ if ( this.oldValue !== value ) {
+ this.oldValue = value;
+ this._trigger( "change" );
+ }
+ if ( value === this.options.max ) {
+ this._trigger( "complete" );
+ }
+ }
+});
+
+
+/*!
+ * jQuery UI Selectable 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/selectable/
+ */
+
+
+var selectable = $.widget("ui.selectable", $.ui.mouse, {
+ version: "1.11.4",
+ options: {
+ appendTo: "body",
+ autoRefresh: true,
+ distance: 0,
+ filter: "*",
+ tolerance: "touch",
+
+ // callbacks
+ selected: null,
+ selecting: null,
+ start: null,
+ stop: null,
+ unselected: null,
+ unselecting: null
+ },
+ _create: function() {
+ var selectees,
+ that = this;
+
+ this.element.addClass("ui-selectable");
+
+ this.dragged = false;
+
+ // cache selectee children based on filter
+ this.refresh = function() {
+ selectees = $(that.options.filter, that.element[0]);
+ selectees.addClass("ui-selectee");
+ selectees.each(function() {
+ var $this = $(this),
+ pos = $this.offset();
+ $.data(this, "selectable-item", {
+ element: this,
+ $element: $this,
+ left: pos.left,
+ top: pos.top,
+ right: pos.left + $this.outerWidth(),
+ bottom: pos.top + $this.outerHeight(),
+ startselected: false,
+ selected: $this.hasClass("ui-selected"),
+ selecting: $this.hasClass("ui-selecting"),
+ unselecting: $this.hasClass("ui-unselecting")
+ });
+ });
+ };
+ this.refresh();
+
+ this.selectees = selectees.addClass("ui-selectee");
+
+ this._mouseInit();
+
+ this.helper = $("<div class='ui-selectable-helper'></div>");
+ },
+
+ _destroy: function() {
+ this.selectees
+ .removeClass("ui-selectee")
+ .removeData("selectable-item");
+ this.element
+ .removeClass("ui-selectable ui-selectable-disabled");
+ this._mouseDestroy();
+ },
+
+ _mouseStart: function(event) {
+ var that = this,
+ options = this.options;
+
+ this.opos = [ event.pageX, event.pageY ];
+
+ if (this.options.disabled) {
+ return;
+ }
+
+ this.selectees = $(options.filter, this.element[0]);
+
+ this._trigger("start", event);
+
+ $(options.appendTo).append(this.helper);
+ // position helper (lasso)
+ this.helper.css({
+ "left": event.pageX,
+ "top": event.pageY,
+ "width": 0,
+ "height": 0
+ });
+
+ if (options.autoRefresh) {
+ this.refresh();
+ }
+
+ this.selectees.filter(".ui-selected").each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.startselected = true;
+ if (!event.metaKey && !event.ctrlKey) {
+ selectee.$element.removeClass("ui-selected");
+ selectee.selected = false;
+ selectee.$element.addClass("ui-unselecting");
+ selectee.unselecting = true;
+ // selectable UNSELECTING callback
+ that._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ });
+
+ $(event.target).parents().addBack().each(function() {
+ var doSelect,
+ selectee = $.data(this, "selectable-item");
+ if (selectee) {
+ doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected");
+ selectee.$element
+ .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
+ .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
+ selectee.unselecting = !doSelect;
+ selectee.selecting = doSelect;
+ selectee.selected = doSelect;
+ // selectable (UN)SELECTING callback
+ if (doSelect) {
+ that._trigger("selecting", event, {
+ selecting: selectee.element
+ });
+ } else {
+ that._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ return false;
+ }
+ });
+
+ },
+
+ _mouseDrag: function(event) {
+
+ this.dragged = true;
+
+ if (this.options.disabled) {
+ return;
+ }
+
+ var tmp,
+ that = this,
+ options = this.options,
+ x1 = this.opos[0],
+ y1 = this.opos[1],
+ x2 = event.pageX,
+ y2 = event.pageY;
+
+ if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
+ if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
+ this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });
+
+ this.selectees.each(function() {
+ var selectee = $.data(this, "selectable-item"),
+ hit = false;
+
+ //prevent helper from being selected if appendTo: selectable
+ if (!selectee || selectee.element === that.element[0]) {
+ return;
+ }
+
+ if (options.tolerance === "touch") {
+ hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
+ } else if (options.tolerance === "fit") {
+ hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
+ }
+
+ if (hit) {
+ // SELECT
+ if (selectee.selected) {
+ selectee.$element.removeClass("ui-selected");
+ selectee.selected = false;
+ }
+ if (selectee.unselecting) {
+ selectee.$element.removeClass("ui-unselecting");
+ selectee.unselecting = false;
+ }
+ if (!selectee.selecting) {
+ selectee.$element.addClass("ui-selecting");
+ selectee.selecting = true;
+ // selectable SELECTING callback
+ that._trigger("selecting", event, {
+ selecting: selectee.element
+ });
+ }
+ } else {
+ // UNSELECT
+ if (selectee.selecting) {
+ if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
+ selectee.$element.removeClass("ui-selecting");
+ selectee.selecting = false;
+ selectee.$element.addClass("ui-selected");
+ selectee.selected = true;
+ } else {
+ selectee.$element.removeClass("ui-selecting");
+ selectee.selecting = false;
+ if (selectee.startselected) {
+ selectee.$element.addClass("ui-unselecting");
+ selectee.unselecting = true;
+ }
+ // selectable UNSELECTING callback
+ that._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ }
+ if (selectee.selected) {
+ if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
+ selectee.$element.removeClass("ui-selected");
+ selectee.selected = false;
+
+ selectee.$element.addClass("ui-unselecting");
+ selectee.unselecting = true;
+ // selectable UNSELECTING callback
+ that._trigger("unselecting", event, {
+ unselecting: selectee.element
+ });
+ }
+ }
+ }
+ });
+
+ return false;
+ },
+
+ _mouseStop: function(event) {
+ var that = this;
+
+ this.dragged = false;
+
+ $(".ui-unselecting", this.element[0]).each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.$element.removeClass("ui-unselecting");
+ selectee.unselecting = false;
+ selectee.startselected = false;
+ that._trigger("unselected", event, {
+ unselected: selectee.element
+ });
+ });
+ $(".ui-selecting", this.element[0]).each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.$element.removeClass("ui-selecting").addClass("ui-selected");
+ selectee.selecting = false;
+ selectee.selected = true;
+ selectee.startselected = true;
+ that._trigger("selected", event, {
+ selected: selectee.element
+ });
+ });
+ this._trigger("stop", event);
+
+ this.helper.remove();
+
+ return false;
+ }
+
+});
+
+
+/*!
+ * jQuery UI Selectmenu 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/selectmenu
+ */
+
+
+var selectmenu = $.widget( "ui.selectmenu", {
+ version: "1.11.4",
+ defaultElement: "<select>",
+ options: {
+ appendTo: null,
+ disabled: null,
+ icons: {
+ button: "ui-icon-triangle-1-s"
+ },
+ position: {
+ my: "left top",
+ at: "left bottom",
+ collision: "none"
+ },
+ width: null,
+
+ // callbacks
+ change: null,
+ close: null,
+ focus: null,
+ open: null,
+ select: null
+ },
+
+ _create: function() {
+ var selectmenuId = this.element.uniqueId().attr( "id" );
+ this.ids = {
+ element: selectmenuId,
+ button: selectmenuId + "-button",
+ menu: selectmenuId + "-menu"
+ };
+
+ this._drawButton();
+ this._drawMenu();
+
+ if ( this.options.disabled ) {
+ this.disable();
+ }
+ },
+
+ _drawButton: function() {
+ var that = this;
+
+ // Associate existing label with the new button
+ this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button );
+ this._on( this.label, {
+ click: function( event ) {
+ this.button.focus();
+ event.preventDefault();
+ }
+ });
+
+ // Hide original select element
+ this.element.hide();
+
+ // Create button
+ this.button = $( "<span>", {
+ "class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all",
+ tabindex: this.options.disabled ? -1 : 0,
+ id: this.ids.button,
+ role: "combobox",
+ "aria-expanded": "false",
+ "aria-autocomplete": "list",
+ "aria-owns": this.ids.menu,
+ "aria-haspopup": "true"
+ })
+ .insertAfter( this.element );
+
+ $( "<span>", {
+ "class": "ui-icon " + this.options.icons.button
+ })
+ .prependTo( this.button );
+
+ this.buttonText = $( "<span>", {
+ "class": "ui-selectmenu-text"
+ })
+ .appendTo( this.button );
+
+ this._setText( this.buttonText, this.element.find( "option:selected" ).text() );
+ this._resizeButton();
+
+ this._on( this.button, this._buttonEvents );
+ this.button.one( "focusin", function() {
+
+ // Delay rendering the menu items until the button receives focus.
+ // The menu may have already been rendered via a programmatic open.
+ if ( !that.menuItems ) {
+ that._refreshMenu();
+ }
+ });
+ this._hoverable( this.button );
+ this._focusable( this.button );
+ },
+
+ _drawMenu: function() {
+ var that = this;
+
+ // Create menu
+ this.menu = $( "<ul>", {
+ "aria-hidden": "true",
+ "aria-labelledby": this.ids.button,
+ id: this.ids.menu
+ });
+
+ // Wrap menu
+ this.menuWrap = $( "<div>", {
+ "class": "ui-selectmenu-menu ui-front"
+ })
+ .append( this.menu )
+ .appendTo( this._appendTo() );
+
+ // Initialize menu widget
+ this.menuInstance = this.menu
+ .menu({
+ role: "listbox",
+ select: function( event, ui ) {
+ event.preventDefault();
+
+ // support: IE8
+ // If the item was selected via a click, the text selection
+ // will be destroyed in IE
+ that._setSelection();
+
+ that._select( ui.item.data( "ui-selectmenu-item" ), event );
+ },
+ focus: function( event, ui ) {
+ var item = ui.item.data( "ui-selectmenu-item" );
+
+ // Prevent inital focus from firing and check if its a newly focused item
+ if ( that.focusIndex != null && item.index !== that.focusIndex ) {
+ that._trigger( "focus", event, { item: item } );
+ if ( !that.isOpen ) {
+ that._select( item, event );
+ }
+ }
+ that.focusIndex = item.index;
+
+ that.button.attr( "aria-activedescendant",
+ that.menuItems.eq( item.index ).attr( "id" ) );
+ }
+ })
+ .menu( "instance" );
+
+ // Adjust menu styles to dropdown
+ this.menu
+ .addClass( "ui-corner-bottom" )
+ .removeClass( "ui-corner-all" );
+
+ // Don't close the menu on mouseleave
+ this.menuInstance._off( this.menu, "mouseleave" );
+
+ // Cancel the menu's collapseAll on document click
+ this.menuInstance._closeOnDocumentClick = function() {
+ return false;
+ };
+
+ // Selects often contain empty items, but never contain dividers
+ this.menuInstance._isDivider = function() {
+ return false;
+ };
+ },
+
+ refresh: function() {
+ this._refreshMenu();
+ this._setText( this.buttonText, this._getSelectedItem().text() );
+ if ( !this.options.width ) {
+ this._resizeButton();
+ }
+ },
+
+ _refreshMenu: function() {
+ this.menu.empty();
+
+ var item,
+ options = this.element.find( "option" );
+
+ if ( !options.length ) {
+ return;
+ }
+
+ this._parseOptions( options );
+ this._renderMenu( this.menu, this.items );
+
+ this.menuInstance.refresh();
+ this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" );
+
+ item = this._getSelectedItem();
+
+ // Update the menu to have the correct item focused
+ this.menuInstance.focus( null, item );
+ this._setAria( item.data( "ui-selectmenu-item" ) );
+
+ // Set disabled state
+ this._setOption( "disabled", this.element.prop( "disabled" ) );
+ },
+
+ open: function( event ) {
+ if ( this.options.disabled ) {
+ return;
+ }
+
+ // If this is the first time the menu is being opened, render the items
+ if ( !this.menuItems ) {
+ this._refreshMenu();
+ } else {
+
+ // Menu clears focus on close, reset focus to selected item
+ this.menu.find( ".ui-state-focus" ).removeClass( "ui-state-focus" );
+ this.menuInstance.focus( null, this._getSelectedItem() );
+ }
+
+ this.isOpen = true;
+ this._toggleAttr();
+ this._resizeMenu();
+ this._position();
+
+ this._on( this.document, this._documentClick );
+
+ this._trigger( "open", event );
+ },
+
+ _position: function() {
+ this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
+ },
+
+ close: function( event ) {
+ if ( !this.isOpen ) {
+ return;
+ }
+
+ this.isOpen = false;
+ this._toggleAttr();
+
+ this.range = null;
+ this._off( this.document );
+
+ this._trigger( "close", event );
+ },
+
+ widget: function() {
+ return this.button;
+ },
+
+ menuWidget: function() {
+ return this.menu;
+ },
+
+ _renderMenu: function( ul, items ) {
+ var that = this,
+ currentOptgroup = "";
+
+ $.each( items, function( index, item ) {
+ if ( item.optgroup !== currentOptgroup ) {
+ $( "<li>", {
+ "class": "ui-selectmenu-optgroup ui-menu-divider" +
+ ( item.element.parent( "optgroup" ).prop( "disabled" ) ?
+ " ui-state-disabled" :
+ "" ),
+ text: item.optgroup
+ })
+ .appendTo( ul );
+
+ currentOptgroup = item.optgroup;
+ }
+
+ that._renderItemData( ul, item );
+ });
+ },
+
+ _renderItemData: function( ul, item ) {
+ return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
+ },
+
+ _renderItem: function( ul, item ) {
+ var li = $( "<li>" );
+
+ if ( item.disabled ) {
+ li.addClass( "ui-state-disabled" );
+ }
+ this._setText( li, item.label );
+
+ return li.appendTo( ul );
+ },
+
+ _setText: function( element, value ) {
+ if ( value ) {
+ element.text( value );
+ } else {
+ element.html( "&#160;" );
+ }
+ },
+
+ _move: function( direction, event ) {
+ var item, next,
+ filter = ".ui-menu-item";
+
+ if ( this.isOpen ) {
+ item = this.menuItems.eq( this.focusIndex );
+ } else {
+ item = this.menuItems.eq( this.element[ 0 ].selectedIndex );
+ filter += ":not(.ui-state-disabled)";
+ }
+
+ if ( direction === "first" || direction === "last" ) {
+ next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
+ } else {
+ next = item[ direction + "All" ]( filter ).eq( 0 );
+ }
+
+ if ( next.length ) {
+ this.menuInstance.focus( event, next );
+ }
+ },
+
+ _getSelectedItem: function() {
+ return this.menuItems.eq( this.element[ 0 ].selectedIndex );
+ },
+
+ _toggle: function( event ) {
+ this[ this.isOpen ? "close" : "open" ]( event );
+ },
+
+ _setSelection: function() {
+ var selection;
+
+ if ( !this.range ) {
+ return;
+ }
+
+ if ( window.getSelection ) {
+ selection = window.getSelection();
+ selection.removeAllRanges();
+ selection.addRange( this.range );
+
+ // support: IE8
+ } else {
+ this.range.select();
+ }
+
+ // support: IE
+ // Setting the text selection kills the button focus in IE, but
+ // restoring the focus doesn't kill the selection.
+ this.button.focus();
+ },
+
+ _documentClick: {
+ mousedown: function( event ) {
+ if ( !this.isOpen ) {
+ return;
+ }
+
+ if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + this.ids.button ).length ) {
+ this.close( event );
+ }
+ }
+ },
+
+ _buttonEvents: {
+
+ // Prevent text selection from being reset when interacting with the selectmenu (#10144)
+ mousedown: function() {
+ var selection;
+
+ if ( window.getSelection ) {
+ selection = window.getSelection();
+ if ( selection.rangeCount ) {
+ this.range = selection.getRangeAt( 0 );
+ }
+
+ // support: IE8
+ } else {
+ this.range = document.selection.createRange();
+ }
+ },
+
+ click: function( event ) {
+ this._setSelection();
+ this._toggle( event );
+ },
+
+ keydown: function( event ) {
+ var preventDefault = true;
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.TAB:
+ case $.ui.keyCode.ESCAPE:
+ this.close( event );
+ preventDefault = false;
+ break;
+ case $.ui.keyCode.ENTER:
+ if ( this.isOpen ) {
+ this._selectFocusedItem( event );
+ }
+ break;
+ case $.ui.keyCode.UP:
+ if ( event.altKey ) {
+ this._toggle( event );
+ } else {
+ this._move( "prev", event );
+ }
+ break;
+ case $.ui.keyCode.DOWN:
+ if ( event.altKey ) {
+ this._toggle( event );
+ } else {
+ this._move( "next", event );
+ }
+ break;
+ case $.ui.keyCode.SPACE:
+ if ( this.isOpen ) {
+ this._selectFocusedItem( event );
+ } else {
+ this._toggle( event );
+ }
+ break;
+ case $.ui.keyCode.LEFT:
+ this._move( "prev", event );
+ break;
+ case $.ui.keyCode.RIGHT:
+ this._move( "next", event );
+ break;
+ case $.ui.keyCode.HOME:
+ case $.ui.keyCode.PAGE_UP:
+ this._move( "first", event );
+ break;
+ case $.ui.keyCode.END:
+ case $.ui.keyCode.PAGE_DOWN:
+ this._move( "last", event );
+ break;
+ default:
+ this.menu.trigger( event );
+ preventDefault = false;
+ }
+
+ if ( preventDefault ) {
+ event.preventDefault();
+ }
+ }
+ },
+
+ _selectFocusedItem: function( event ) {
+ var item = this.menuItems.eq( this.focusIndex );
+ if ( !item.hasClass( "ui-state-disabled" ) ) {
+ this._select( item.data( "ui-selectmenu-item" ), event );
+ }
+ },
+
+ _select: function( item, event ) {
+ var oldIndex = this.element[ 0 ].selectedIndex;
+
+ // Change native select element
+ this.element[ 0 ].selectedIndex = item.index;
+ this._setText( this.buttonText, item.label );
+ this._setAria( item );
+ this._trigger( "select", event, { item: item } );
+
+ if ( item.index !== oldIndex ) {
+ this._trigger( "change", event, { item: item } );
+ }
+
+ this.close( event );
+ },
+
+ _setAria: function( item ) {
+ var id = this.menuItems.eq( item.index ).attr( "id" );
+
+ this.button.attr({
+ "aria-labelledby": id,
+ "aria-activedescendant": id
+ });
+ this.menu.attr( "aria-activedescendant", id );
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "icons" ) {
+ this.button.find( "span.ui-icon" )
+ .removeClass( this.options.icons.button )
+ .addClass( value.button );
+ }
+
+ this._super( key, value );
+
+ if ( key === "appendTo" ) {
+ this.menuWrap.appendTo( this._appendTo() );
+ }
+
+ if ( key === "disabled" ) {
+ this.menuInstance.option( "disabled", value );
+ this.button
+ .toggleClass( "ui-state-disabled", value )
+ .attr( "aria-disabled", value );
+
+ this.element.prop( "disabled", value );
+ if ( value ) {
+ this.button.attr( "tabindex", -1 );
+ this.close();
+ } else {
+ this.button.attr( "tabindex", 0 );
+ }
+ }
+
+ if ( key === "width" ) {
+ this._resizeButton();
+ }
+ },
+
+ _appendTo: function() {
+ var element = this.options.appendTo;
+
+ if ( element ) {
+ element = element.jquery || element.nodeType ?
+ $( element ) :
+ this.document.find( element ).eq( 0 );
+ }
+
+ if ( !element || !element[ 0 ] ) {
+ element = this.element.closest( ".ui-front" );
+ }
+
+ if ( !element.length ) {
+ element = this.document[ 0 ].body;
+ }
+
+ return element;
+ },
+
+ _toggleAttr: function() {
+ this.button
+ .toggleClass( "ui-corner-top", this.isOpen )
+ .toggleClass( "ui-corner-all", !this.isOpen )
+ .attr( "aria-expanded", this.isOpen );
+ this.menuWrap.toggleClass( "ui-selectmenu-open", this.isOpen );
+ this.menu.attr( "aria-hidden", !this.isOpen );
+ },
+
+ _resizeButton: function() {
+ var width = this.options.width;
+
+ if ( !width ) {
+ width = this.element.show().outerWidth();
+ this.element.hide();
+ }
+
+ this.button.outerWidth( width );
+ },
+
+ _resizeMenu: function() {
+ this.menu.outerWidth( Math.max(
+ this.button.outerWidth(),
+
+ // support: IE10
+ // IE10 wraps long text (possibly a rounding bug)
+ // so we add 1px to avoid the wrapping
+ this.menu.width( "" ).outerWidth() + 1
+ ) );
+ },
+
+ _getCreateOptions: function() {
+ return { disabled: this.element.prop( "disabled" ) };
+ },
+
+ _parseOptions: function( options ) {
+ var data = [];
+ options.each(function( index, item ) {
+ var option = $( item ),
+ optgroup = option.parent( "optgroup" );
+ data.push({
+ element: option,
+ index: index,
+ value: option.val(),
+ label: option.text(),
+ optgroup: optgroup.attr( "label" ) || "",
+ disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
+ });
+ });
+ this.items = data;
+ },
+
+ _destroy: function() {
+ this.menuWrap.remove();
+ this.button.remove();
+ this.element.show();
+ this.element.removeUniqueId();
+ this.label.attr( "for", this.ids.element );
+ }
+});
+
+
+/*!
+ * jQuery UI Slider 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/slider/
+ */
+
+
+var slider = $.widget( "ui.slider", $.ui.mouse, {
+ version: "1.11.4",
+ widgetEventPrefix: "slide",
+
+ options: {
+ animate: false,
+ distance: 0,
+ max: 100,
+ min: 0,
+ orientation: "horizontal",
+ range: false,
+ step: 1,
+ value: 0,
+ values: null,
+
+ // callbacks
+ change: null,
+ slide: null,
+ start: null,
+ stop: null
+ },
+
+ // number of pages in a slider
+ // (how many times can you page up/down to go through the whole range)
+ numPages: 5,
+
+ _create: function() {
+ this._keySliding = false;
+ this._mouseSliding = false;
+ this._animateOff = true;
+ this._handleIndex = null;
+ this._detectOrientation();
+ this._mouseInit();
+ this._calculateNewMax();
+
+ this.element
+ .addClass( "ui-slider" +
+ " ui-slider-" + this.orientation +
+ " ui-widget" +
+ " ui-widget-content" +
+ " ui-corner-all");
+
+ this._refresh();
+ this._setOption( "disabled", this.options.disabled );
+
+ this._animateOff = false;
+ },
+
+ _refresh: function() {
+ this._createRange();
+ this._createHandles();
+ this._setupEvents();
+ this._refreshValue();
+ },
+
+ _createHandles: function() {
+ var i, handleCount,
+ options = this.options,
+ existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
+ handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",
+ handles = [];
+
+ handleCount = ( options.values && options.values.length ) || 1;
+
+ if ( existingHandles.length > handleCount ) {
+ existingHandles.slice( handleCount ).remove();
+ existingHandles = existingHandles.slice( 0, handleCount );
+ }
+
+ for ( i = existingHandles.length; i < handleCount; i++ ) {
+ handles.push( handle );
+ }
+
+ this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
+
+ this.handle = this.handles.eq( 0 );
+
+ this.handles.each(function( i ) {
+ $( this ).data( "ui-slider-handle-index", i );
+ });
+ },
+
+ _createRange: function() {
+ var options = this.options,
+ classes = "";
+
+ if ( options.range ) {
+ if ( options.range === true ) {
+ if ( !options.values ) {
+ options.values = [ this._valueMin(), this._valueMin() ];
+ } else if ( options.values.length && options.values.length !== 2 ) {
+ options.values = [ options.values[0], options.values[0] ];
+ } else if ( $.isArray( options.values ) ) {
+ options.values = options.values.slice(0);
+ }
+ }
+
+ if ( !this.range || !this.range.length ) {
+ this.range = $( "<div></div>" )
+ .appendTo( this.element );
+
+ classes = "ui-slider-range" +
+ // note: this isn't the most fittingly semantic framework class for this element,
+ // but worked best visually with a variety of themes
+ " ui-widget-header ui-corner-all";
+ } else {
+ this.range.removeClass( "ui-slider-range-min ui-slider-range-max" )
+ // Handle range switching from true to min/max
+ .css({
+ "left": "",
+ "bottom": ""
+ });
+ }
+
+ this.range.addClass( classes +
+ ( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) );
+ } else {
+ if ( this.range ) {
+ this.range.remove();
+ }
+ this.range = null;
+ }
+ },
+
+ _setupEvents: function() {
+ this._off( this.handles );
+ this._on( this.handles, this._handleEvents );
+ this._hoverable( this.handles );
+ this._focusable( this.handles );
+ },
+
+ _destroy: function() {
+ this.handles.remove();
+ if ( this.range ) {
+ this.range.remove();
+ }
+
+ this.element
+ .removeClass( "ui-slider" +
+ " ui-slider-horizontal" +
+ " ui-slider-vertical" +
+ " ui-widget" +
+ " ui-widget-content" +
+ " ui-corner-all" );
+
+ this._mouseDestroy();
+ },
+
+ _mouseCapture: function( event ) {
+ var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
+ that = this,
+ o = this.options;
+
+ if ( o.disabled ) {
+ return false;
+ }
+
+ this.elementSize = {
+ width: this.element.outerWidth(),
+ height: this.element.outerHeight()
+ };
+ this.elementOffset = this.element.offset();
+
+ position = { x: event.pageX, y: event.pageY };
+ normValue = this._normValueFromMouse( position );
+ distance = this._valueMax() - this._valueMin() + 1;
+ this.handles.each(function( i ) {
+ var thisDistance = Math.abs( normValue - that.values(i) );
+ if (( distance > thisDistance ) ||
+ ( distance === thisDistance &&
+ (i === that._lastChangedValue || that.values(i) === o.min ))) {
+ distance = thisDistance;
+ closestHandle = $( this );
+ index = i;
+ }
+ });
+
+ allowed = this._start( event, index );
+ if ( allowed === false ) {
+ return false;
+ }
+ this._mouseSliding = true;
+
+ this._handleIndex = index;
+
+ closestHandle
+ .addClass( "ui-state-active" )
+ .focus();
+
+ offset = closestHandle.offset();
+ mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
+ this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
+ left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
+ top: event.pageY - offset.top -
+ ( closestHandle.height() / 2 ) -
+ ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
+ ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
+ ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
+ };
+
+ if ( !this.handles.hasClass( "ui-state-hover" ) ) {
+ this._slide( event, index, normValue );
+ }
+ this._animateOff = true;
+ return true;
+ },
+
+ _mouseStart: function() {
+ return true;
+ },
+
+ _mouseDrag: function( event ) {
+ var position = { x: event.pageX, y: event.pageY },
+ normValue = this._normValueFromMouse( position );
+
+ this._slide( event, this._handleIndex, normValue );
+
+ return false;
+ },
+
+ _mouseStop: function( event ) {
+ this.handles.removeClass( "ui-state-active" );
+ this._mouseSliding = false;
+
+ this._stop( event, this._handleIndex );
+ this._change( event, this._handleIndex );
+
+ this._handleIndex = null;
+ this._clickOffset = null;
+ this._animateOff = false;
+
+ return false;
+ },
+
+ _detectOrientation: function() {
+ this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
+ },
+
+ _normValueFromMouse: function( position ) {
+ var pixelTotal,
+ pixelMouse,
+ percentMouse,
+ valueTotal,
+ valueMouse;
+
+ if ( this.orientation === "horizontal" ) {
+ pixelTotal = this.elementSize.width;
+ pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
+ } else {
+ pixelTotal = this.elementSize.height;
+ pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
+ }
+
+ percentMouse = ( pixelMouse / pixelTotal );
+ if ( percentMouse > 1 ) {
+ percentMouse = 1;
+ }
+ if ( percentMouse < 0 ) {
+ percentMouse = 0;
+ }
+ if ( this.orientation === "vertical" ) {
+ percentMouse = 1 - percentMouse;
+ }
+
+ valueTotal = this._valueMax() - this._valueMin();
+ valueMouse = this._valueMin() + percentMouse * valueTotal;
+
+ return this._trimAlignValue( valueMouse );
+ },
+
+ _start: function( event, index ) {
+ var uiHash = {
+ handle: this.handles[ index ],
+ value: this.value()
+ };
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
+ uiHash.values = this.values();
+ }
+ return this._trigger( "start", event, uiHash );
+ },
+
+ _slide: function( event, index, newVal ) {
+ var otherVal,
+ newValues,
+ allowed;
+
+ if ( this.options.values && this.options.values.length ) {
+ otherVal = this.values( index ? 0 : 1 );
+
+ if ( ( this.options.values.length === 2 && this.options.range === true ) &&
+ ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
+ ) {
+ newVal = otherVal;
+ }
+
+ if ( newVal !== this.values( index ) ) {
+ newValues = this.values();
+ newValues[ index ] = newVal;
+ // A slide can be canceled by returning false from the slide callback
+ allowed = this._trigger( "slide", event, {
+ handle: this.handles[ index ],
+ value: newVal,
+ values: newValues
+ } );
+ otherVal = this.values( index ? 0 : 1 );
+ if ( allowed !== false ) {
+ this.values( index, newVal );
+ }
+ }
+ } else {
+ if ( newVal !== this.value() ) {
+ // A slide can be canceled by returning false from the slide callback
+ allowed = this._trigger( "slide", event, {
+ handle: this.handles[ index ],
+ value: newVal
+ } );
+ if ( allowed !== false ) {
+ this.value( newVal );
+ }
+ }
+ }
+ },
+
+ _stop: function( event, index ) {
+ var uiHash = {
+ handle: this.handles[ index ],
+ value: this.value()
+ };
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
+ uiHash.values = this.values();
+ }
+
+ this._trigger( "stop", event, uiHash );
+ },
+
+ _change: function( event, index ) {
+ if ( !this._keySliding && !this._mouseSliding ) {
+ var uiHash = {
+ handle: this.handles[ index ],
+ value: this.value()
+ };
+ if ( this.options.values && this.options.values.length ) {
+ uiHash.value = this.values( index );
+ uiHash.values = this.values();
+ }
+
+ //store the last changed value index for reference when handles overlap
+ this._lastChangedValue = index;
+
+ this._trigger( "change", event, uiHash );
+ }
+ },
+
+ value: function( newValue ) {
+ if ( arguments.length ) {
+ this.options.value = this._trimAlignValue( newValue );
+ this._refreshValue();
+ this._change( null, 0 );
+ return;
+ }
+
+ return this._value();
+ },
+
+ values: function( index, newValue ) {
+ var vals,
+ newValues,
+ i;
+
+ if ( arguments.length > 1 ) {
+ this.options.values[ index ] = this._trimAlignValue( newValue );
+ this._refreshValue();
+ this._change( null, index );
+ return;
+ }
+
+ if ( arguments.length ) {
+ if ( $.isArray( arguments[ 0 ] ) ) {
+ vals = this.options.values;
+ newValues = arguments[ 0 ];
+ for ( i = 0; i < vals.length; i += 1 ) {
+ vals[ i ] = this._trimAlignValue( newValues[ i ] );
+ this._change( null, i );
+ }
+ this._refreshValue();
+ } else {
+ if ( this.options.values && this.options.values.length ) {
+ return this._values( index );
+ } else {
+ return this.value();
+ }
+ }
+ } else {
+ return this._values();
+ }
+ },
+
+ _setOption: function( key, value ) {
+ var i,
+ valsLength = 0;
+
+ if ( key === "range" && this.options.range === true ) {
+ if ( value === "min" ) {
+ this.options.value = this._values( 0 );
+ this.options.values = null;
+ } else if ( value === "max" ) {
+ this.options.value = this._values( this.options.values.length - 1 );
+ this.options.values = null;
+ }
+ }
+
+ if ( $.isArray( this.options.values ) ) {
+ valsLength = this.options.values.length;
+ }
+
+ if ( key === "disabled" ) {
+ this.element.toggleClass( "ui-state-disabled", !!value );
+ }
+
+ this._super( key, value );
+
+ switch ( key ) {
+ case "orientation":
+ this._detectOrientation();
+ this.element
+ .removeClass( "ui-slider-horizontal ui-slider-vertical" )
+ .addClass( "ui-slider-" + this.orientation );
+ this._refreshValue();
+
+ // Reset positioning from previous orientation
+ this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
+ break;
+ case "value":
+ this._animateOff = true;
+ this._refreshValue();
+ this._change( null, 0 );
+ this._animateOff = false;
+ break;
+ case "values":
+ this._animateOff = true;
+ this._refreshValue();
+ for ( i = 0; i < valsLength; i += 1 ) {
+ this._change( null, i );
+ }
+ this._animateOff = false;
+ break;
+ case "step":
+ case "min":
+ case "max":
+ this._animateOff = true;
+ this._calculateNewMax();
+ this._refreshValue();
+ this._animateOff = false;
+ break;
+ case "range":
+ this._animateOff = true;
+ this._refresh();
+ this._animateOff = false;
+ break;
+ }
+ },
+
+ //internal value getter
+ // _value() returns value trimmed by min and max, aligned by step
+ _value: function() {
+ var val = this.options.value;
+ val = this._trimAlignValue( val );
+
+ return val;
+ },
+
+ //internal values getter
+ // _values() returns array of values trimmed by min and max, aligned by step
+ // _values( index ) returns single value trimmed by min and max, aligned by step
+ _values: function( index ) {
+ var val,
+ vals,
+ i;
+
+ if ( arguments.length ) {
+ val = this.options.values[ index ];
+ val = this._trimAlignValue( val );
+
+ return val;
+ } else if ( this.options.values && this.options.values.length ) {
+ // .slice() creates a copy of the array
+ // this copy gets trimmed by min and max and then returned
+ vals = this.options.values.slice();
+ for ( i = 0; i < vals.length; i += 1) {
+ vals[ i ] = this._trimAlignValue( vals[ i ] );
+ }
+
+ return vals;
+ } else {
+ return [];
+ }
+ },
+
+ // returns the step-aligned value that val is closest to, between (inclusive) min and max
+ _trimAlignValue: function( val ) {
+ if ( val <= this._valueMin() ) {
+ return this._valueMin();
+ }
+ if ( val >= this._valueMax() ) {
+ return this._valueMax();
+ }
+ var step = ( this.options.step > 0 ) ? this.options.step : 1,
+ valModStep = (val - this._valueMin()) % step,
+ alignValue = val - valModStep;
+
+ if ( Math.abs(valModStep) * 2 >= step ) {
+ alignValue += ( valModStep > 0 ) ? step : ( -step );
+ }
+
+ // Since JavaScript has problems with large floats, round
+ // the final value to 5 digits after the decimal point (see #4124)
+ return parseFloat( alignValue.toFixed(5) );
+ },
+
+ _calculateNewMax: function() {
+ var max = this.options.max,
+ min = this._valueMin(),
+ step = this.options.step,
+ aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step;
+ max = aboveMin + min;
+ this.max = parseFloat( max.toFixed( this._precision() ) );
+ },
+
+ _precision: function() {
+ var precision = this._precisionOf( this.options.step );
+ if ( this.options.min !== null ) {
+ precision = Math.max( precision, this._precisionOf( this.options.min ) );
+ }
+ return precision;
+ },
+
+ _precisionOf: function( num ) {
+ var str = num.toString(),
+ decimal = str.indexOf( "." );
+ return decimal === -1 ? 0 : str.length - decimal - 1;
+ },
+
+ _valueMin: function() {
+ return this.options.min;
+ },
+
+ _valueMax: function() {
+ return this.max;
+ },
+
+ _refreshValue: function() {
+ var lastValPercent, valPercent, value, valueMin, valueMax,
+ oRange = this.options.range,
+ o = this.options,
+ that = this,
+ animate = ( !this._animateOff ) ? o.animate : false,
+ _set = {};
+
+ if ( this.options.values && this.options.values.length ) {
+ this.handles.each(function( i ) {
+ valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
+ _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+ $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+ if ( that.options.range === true ) {
+ if ( that.orientation === "horizontal" ) {
+ if ( i === 0 ) {
+ that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
+ }
+ if ( i === 1 ) {
+ that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ } else {
+ if ( i === 0 ) {
+ that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
+ }
+ if ( i === 1 ) {
+ that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ }
+ }
+ lastValPercent = valPercent;
+ });
+ } else {
+ value = this.value();
+ valueMin = this._valueMin();
+ valueMax = this._valueMax();
+ valPercent = ( valueMax !== valueMin ) ?
+ ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
+ 0;
+ _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+ this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+
+ if ( oRange === "min" && this.orientation === "horizontal" ) {
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
+ }
+ if ( oRange === "max" && this.orientation === "horizontal" ) {
+ this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ if ( oRange === "min" && this.orientation === "vertical" ) {
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
+ }
+ if ( oRange === "max" && this.orientation === "vertical" ) {
+ this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+ }
+ }
+ },
+
+ _handleEvents: {
+ keydown: function( event ) {
+ var allowed, curVal, newVal, step,
+ index = $( event.target ).data( "ui-slider-handle-index" );
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.HOME:
+ case $.ui.keyCode.END:
+ case $.ui.keyCode.PAGE_UP:
+ case $.ui.keyCode.PAGE_DOWN:
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.RIGHT:
+ case $.ui.keyCode.DOWN:
+ case $.ui.keyCode.LEFT:
+ event.preventDefault();
+ if ( !this._keySliding ) {
+ this._keySliding = true;
+ $( event.target ).addClass( "ui-state-active" );
+ allowed = this._start( event, index );
+ if ( allowed === false ) {
+ return;
+ }
+ }
+ break;
+ }
+
+ step = this.options.step;
+ if ( this.options.values && this.options.values.length ) {
+ curVal = newVal = this.values( index );
+ } else {
+ curVal = newVal = this.value();
+ }
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.HOME:
+ newVal = this._valueMin();
+ break;
+ case $.ui.keyCode.END:
+ newVal = this._valueMax();
+ break;
+ case $.ui.keyCode.PAGE_UP:
+ newVal = this._trimAlignValue(
+ curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
+ );
+ break;
+ case $.ui.keyCode.PAGE_DOWN:
+ newVal = this._trimAlignValue(
+ curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) );
+ break;
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.RIGHT:
+ if ( curVal === this._valueMax() ) {
+ return;
+ }
+ newVal = this._trimAlignValue( curVal + step );
+ break;
+ case $.ui.keyCode.DOWN:
+ case $.ui.keyCode.LEFT:
+ if ( curVal === this._valueMin() ) {
+ return;
+ }
+ newVal = this._trimAlignValue( curVal - step );
+ break;
+ }
+
+ this._slide( event, index, newVal );
+ },
+ keyup: function( event ) {
+ var index = $( event.target ).data( "ui-slider-handle-index" );
+
+ if ( this._keySliding ) {
+ this._keySliding = false;
+ this._stop( event, index );
+ this._change( event, index );
+ $( event.target ).removeClass( "ui-state-active" );
+ }
+ }
+ }
+});
+
+
+/*!
+ * jQuery UI Sortable 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/sortable/
+ */
+
+
+var sortable = $.widget("ui.sortable", $.ui.mouse, {
+ version: "1.11.4",
+ widgetEventPrefix: "sort",
+ ready: false,
+ options: {
+ appendTo: "parent",
+ axis: false,
+ connectWith: false,
+ containment: false,
+ cursor: "auto",
+ cursorAt: false,
+ dropOnEmpty: true,
+ forcePlaceholderSize: false,
+ forceHelperSize: false,
+ grid: false,
+ handle: false,
+ helper: "original",
+ items: "> *",
+ opacity: false,
+ placeholder: false,
+ revert: false,
+ scroll: true,
+ scrollSensitivity: 20,
+ scrollSpeed: 20,
+ scope: "default",
+ tolerance: "intersect",
+ zIndex: 1000,
+
+ // callbacks
+ activate: null,
+ beforeStop: null,
+ change: null,
+ deactivate: null,
+ out: null,
+ over: null,
+ receive: null,
+ remove: null,
+ sort: null,
+ start: null,
+ stop: null,
+ update: null
+ },
+
+ _isOverAxis: function( x, reference, size ) {
+ return ( x >= reference ) && ( x < ( reference + size ) );
+ },
+
+ _isFloating: function( item ) {
+ return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
+ },
+
+ _create: function() {
+ this.containerCache = {};
+ this.element.addClass("ui-sortable");
+
+ //Get the items
+ this.refresh();
+
+ //Let's determine the parent's offset
+ this.offset = this.element.offset();
+
+ //Initialize mouse events for interaction
+ this._mouseInit();
+
+ this._setHandleClassName();
+
+ //We're ready to go
+ this.ready = true;
+
+ },
+
+ _setOption: function( key, value ) {
+ this._super( key, value );
+
+ if ( key === "handle" ) {
+ this._setHandleClassName();
+ }
+ },
+
+ _setHandleClassName: function() {
+ this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" );
+ $.each( this.items, function() {
+ ( this.instance.options.handle ?
+ this.item.find( this.instance.options.handle ) : this.item )
+ .addClass( "ui-sortable-handle" );
+ });
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass( "ui-sortable ui-sortable-disabled" )
+ .find( ".ui-sortable-handle" )
+ .removeClass( "ui-sortable-handle" );
+ this._mouseDestroy();
+
+ for ( var i = this.items.length - 1; i >= 0; i-- ) {
+ this.items[i].item.removeData(this.widgetName + "-item");
+ }
+
+ return this;
+ },
+
+ _mouseCapture: function(event, overrideHandle) {
+ var currentItem = null,
+ validHandle = false,
+ that = this;
+
+ if (this.reverting) {
+ return false;
+ }
+
+ if(this.options.disabled || this.options.type === "static") {
+ return false;
+ }
+
+ //We have to refresh the items data once first
+ this._refreshItems(event);
+
+ //Find out if the clicked node (or one of its parents) is a actual item in this.items
+ $(event.target).parents().each(function() {
+ if($.data(this, that.widgetName + "-item") === that) {
+ currentItem = $(this);
+ return false;
+ }
+ });
+ if($.data(event.target, that.widgetName + "-item") === that) {
+ currentItem = $(event.target);
+ }
+
+ if(!currentItem) {
+ return false;
+ }
+ if(this.options.handle && !overrideHandle) {
+ $(this.options.handle, currentItem).find("*").addBack().each(function() {
+ if(this === event.target) {
+ validHandle = true;
+ }
+ });
+ if(!validHandle) {
+ return false;
+ }
+ }
+
+ this.currentItem = currentItem;
+ this._removeCurrentsFromItems();
+ return true;
+
+ },
+
+ _mouseStart: function(event, overrideHandle, noActivation) {
+
+ var i, body,
+ o = this.options;
+
+ this.currentContainer = this;
+
+ //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
+ this.refreshPositions();
+
+ //Create and append the visible helper
+ this.helper = this._createHelper(event);
+
+ //Cache the helper size
+ this._cacheHelperProportions();
+
+ /*
+ * - Position generation -
+ * This block generates everything position related - it's the core of draggables.
+ */
+
+ //Cache the margins of the original element
+ this._cacheMargins();
+
+ //Get the next scrolling parent
+ this.scrollParent = this.helper.scrollParent();
+
+ //The element's absolute position on the page minus margins
+ this.offset = this.currentItem.offset();
+ this.offset = {
+ top: this.offset.top - this.margins.top,
+ left: this.offset.left - this.margins.left
+ };
+
+ $.extend(this.offset, {
+ click: { //Where the click happened, relative to the element
+ left: event.pageX - this.offset.left,
+ top: event.pageY - this.offset.top
+ },
+ parent: this._getParentOffset(),
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
+ });
+
+ // Only after we got the offset, we can change the helper's position to absolute
+ // TODO: Still need to figure out a way to make relative sorting possible
+ this.helper.css("position", "absolute");
+ this.cssPosition = this.helper.css("position");
+
+ //Generate the original position
+ this.originalPosition = this._generatePosition(event);
+ this.originalPageX = event.pageX;
+ this.originalPageY = event.pageY;
+
+ //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
+
+ //Cache the former DOM position
+ this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
+
+ //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
+ if(this.helper[0] !== this.currentItem[0]) {
+ this.currentItem.hide();
+ }
+
+ //Create the placeholder
+ this._createPlaceholder();
+
+ //Set a containment if given in the options
+ if(o.containment) {
+ this._setContainment();
+ }
+
+ if( o.cursor && o.cursor !== "auto" ) { // cursor option
+ body = this.document.find( "body" );
+
+ // support: IE
+ this.storedCursor = body.css( "cursor" );
+ body.css( "cursor", o.cursor );
+
+ this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
+ }
+
+ if(o.opacity) { // opacity option
+ if (this.helper.css("opacity")) {
+ this._storedOpacity = this.helper.css("opacity");
+ }
+ this.helper.css("opacity", o.opacity);
+ }
+
+ if(o.zIndex) { // zIndex option
+ if (this.helper.css("zIndex")) {
+ this._storedZIndex = this.helper.css("zIndex");
+ }
+ this.helper.css("zIndex", o.zIndex);
+ }
+
+ //Prepare scrolling
+ if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
+ this.overflowOffset = this.scrollParent.offset();
+ }
+
+ //Call callbacks
+ this._trigger("start", event, this._uiHash());
+
+ //Recache the helper size
+ if(!this._preserveHelperProportions) {
+ this._cacheHelperProportions();
+ }
+
+
+ //Post "activate" events to possible containers
+ if( !noActivation ) {
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {
+ this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
+ }
+ }
+
+ //Prepare possible droppables
+ if($.ui.ddmanager) {
+ $.ui.ddmanager.current = this;
+ }
+
+ if ($.ui.ddmanager && !o.dropBehaviour) {
+ $.ui.ddmanager.prepareOffsets(this, event);
+ }
+
+ this.dragging = true;
+
+ this.helper.addClass("ui-sortable-helper");
+ this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+ return true;
+
+ },
+
+ _mouseDrag: function(event) {
+ var i, item, itemElement, intersection,
+ o = this.options,
+ scrolled = false;
+
+ //Compute the helpers position
+ this.position = this._generatePosition(event);
+ this.positionAbs = this._convertPositionTo("absolute");
+
+ if (!this.lastPositionAbs) {
+ this.lastPositionAbs = this.positionAbs;
+ }
+
+ //Do scrolling
+ if(this.options.scroll) {
+ if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
+
+ if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
+ } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
+ }
+
+ if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
+ } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
+ }
+
+ } else {
+
+ if(event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
+ scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
+ } else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {
+ scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
+ }
+
+ if(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
+ scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);
+ } else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {
+ scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);
+ }
+
+ }
+
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
+ $.ui.ddmanager.prepareOffsets(this, event);
+ }
+ }
+
+ //Regenerate the absolute position used for position checks
+ this.positionAbs = this._convertPositionTo("absolute");
+
+ //Set the helper position
+ if(!this.options.axis || this.options.axis !== "y") {
+ this.helper[0].style.left = this.position.left+"px";
+ }
+ if(!this.options.axis || this.options.axis !== "x") {
+ this.helper[0].style.top = this.position.top+"px";
+ }
+
+ //Rearrange
+ for (i = this.items.length - 1; i >= 0; i--) {
+
+ //Cache variables and intersection, continue if no intersection
+ item = this.items[i];
+ itemElement = item.item[0];
+ intersection = this._intersectsWithPointer(item);
+ if (!intersection) {
+ continue;
+ }
+
+ // Only put the placeholder inside the current Container, skip all
+ // items from other containers. This works because when moving
+ // an item from one container to another the
+ // currentContainer is switched before the placeholder is moved.
+ //
+ // Without this, moving items in "sub-sortables" can cause
+ // the placeholder to jitter between the outer and inner container.
+ if (item.instance !== this.currentContainer) {
+ continue;
+ }
+
+ // cannot intersect with itself
+ // no useless actions that have been done before
+ // no action if the item moved is the parent of the item checked
+ if (itemElement !== this.currentItem[0] &&
+ this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
+ !$.contains(this.placeholder[0], itemElement) &&
+ (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
+ ) {
+
+ this.direction = intersection === 1 ? "down" : "up";
+
+ if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
+ this._rearrange(event, item);
+ } else {
+ break;
+ }
+
+ this._trigger("change", event, this._uiHash());
+ break;
+ }
+ }
+
+ //Post events to containers
+ this._contactContainers(event);
+
+ //Interconnect with droppables
+ if($.ui.ddmanager) {
+ $.ui.ddmanager.drag(this, event);
+ }
+
+ //Call callbacks
+ this._trigger("sort", event, this._uiHash());
+
+ this.lastPositionAbs = this.positionAbs;
+ return false;
+
+ },
+
+ _mouseStop: function(event, noPropagation) {
+
+ if(!event) {
+ return;
+ }
+
+ //If we are using droppables, inform the manager about the drop
+ if ($.ui.ddmanager && !this.options.dropBehaviour) {
+ $.ui.ddmanager.drop(this, event);
+ }
+
+ if(this.options.revert) {
+ var that = this,
+ cur = this.placeholder.offset(),
+ axis = this.options.axis,
+ animation = {};
+
+ if ( !axis || axis === "x" ) {
+ animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft);
+ }
+ if ( !axis || axis === "y" ) {
+ animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop);
+ }
+ this.reverting = true;
+ $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
+ that._clear(event);
+ });
+ } else {
+ this._clear(event, noPropagation);
+ }
+
+ return false;
+
+ },
+
+ cancel: function() {
+
+ if(this.dragging) {
+
+ this._mouseUp({ target: null });
+
+ if(this.options.helper === "original") {
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
+ } else {
+ this.currentItem.show();
+ }
+
+ //Post deactivating events to containers
+ for (var i = this.containers.length - 1; i >= 0; i--){
+ this.containers[i]._trigger("deactivate", null, this._uiHash(this));
+ if(this.containers[i].containerCache.over) {
+ this.containers[i]._trigger("out", null, this._uiHash(this));
+ this.containers[i].containerCache.over = 0;
+ }
+ }
+
+ }
+
+ if (this.placeholder) {
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+ if(this.placeholder[0].parentNode) {
+ this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+ }
+ if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
+ this.helper.remove();
+ }
+
+ $.extend(this, {
+ helper: null,
+ dragging: false,
+ reverting: false,
+ _noFinalSort: null
+ });
+
+ if(this.domPosition.prev) {
+ $(this.domPosition.prev).after(this.currentItem);
+ } else {
+ $(this.domPosition.parent).prepend(this.currentItem);
+ }
+ }
+
+ return this;
+
+ },
+
+ serialize: function(o) {
+
+ var items = this._getItemsAsjQuery(o && o.connected),
+ str = [];
+ o = o || {};
+
+ $(items).each(function() {
+ var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
+ if (res) {
+ str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
+ }
+ });
+
+ if(!str.length && o.key) {
+ str.push(o.key + "=");
+ }
+
+ return str.join("&");
+
+ },
+
+ toArray: function(o) {
+
+ var items = this._getItemsAsjQuery(o && o.connected),
+ ret = [];
+
+ o = o || {};
+
+ items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
+ return ret;
+
+ },
+
+ /* Be careful with the following core functions */
+ _intersectsWith: function(item) {
+
+ var x1 = this.positionAbs.left,
+ x2 = x1 + this.helperProportions.width,
+ y1 = this.positionAbs.top,
+ y2 = y1 + this.helperProportions.height,
+ l = item.left,
+ r = l + item.width,
+ t = item.top,
+ b = t + item.height,
+ dyClick = this.offset.click.top,
+ dxClick = this.offset.click.left,
+ isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
+ isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
+ isOverElement = isOverElementHeight && isOverElementWidth;
+
+ if ( this.options.tolerance === "pointer" ||
+ this.options.forcePointerForContainers ||
+ (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
+ ) {
+ return isOverElement;
+ } else {
+
+ return (l < x1 + (this.helperProportions.width / 2) && // Right Half
+ x2 - (this.helperProportions.width / 2) < r && // Left Half
+ t < y1 + (this.helperProportions.height / 2) && // Bottom Half
+ y2 - (this.helperProportions.height / 2) < b ); // Top Half
+
+ }
+ },
+
+ _intersectsWithPointer: function(item) {
+
+ var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
+ isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
+ isOverElement = isOverElementHeight && isOverElementWidth,
+ verticalDirection = this._getDragVerticalDirection(),
+ horizontalDirection = this._getDragHorizontalDirection();
+
+ if (!isOverElement) {
+ return false;
+ }
+
+ return this.floating ?
+ ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
+ : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
+
+ },
+
+ _intersectsWithSides: function(item) {
+
+ var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
+ isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
+ verticalDirection = this._getDragVerticalDirection(),
+ horizontalDirection = this._getDragHorizontalDirection();
+
+ if (this.floating && horizontalDirection) {
+ return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
+ } else {
+ return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
+ }
+
+ },
+
+ _getDragVerticalDirection: function() {
+ var delta = this.positionAbs.top - this.lastPositionAbs.top;
+ return delta !== 0 && (delta > 0 ? "down" : "up");
+ },
+
+ _getDragHorizontalDirection: function() {
+ var delta = this.positionAbs.left - this.lastPositionAbs.left;
+ return delta !== 0 && (delta > 0 ? "right" : "left");
+ },
+
+ refresh: function(event) {
+ this._refreshItems(event);
+ this._setHandleClassName();
+ this.refreshPositions();
+ return this;
+ },
+
+ _connectWith: function() {
+ var options = this.options;
+ return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
+ },
+
+ _getItemsAsjQuery: function(connected) {
+
+ var i, j, cur, inst,
+ items = [],
+ queries = [],
+ connectWith = this._connectWith();
+
+ if(connectWith && connected) {
+ for (i = connectWith.length - 1; i >= 0; i--){
+ cur = $(connectWith[i], this.document[0]);
+ for ( j = cur.length - 1; j >= 0; j--){
+ inst = $.data(cur[j], this.widgetFullName);
+ if(inst && inst !== this && !inst.options.disabled) {
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
+ }
+ }
+ }
+ }
+
+ queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
+
+ function addItems() {
+ items.push( this );
+ }
+ for (i = queries.length - 1; i >= 0; i--){
+ queries[i][0].each( addItems );
+ }
+
+ return $(items);
+
+ },
+
+ _removeCurrentsFromItems: function() {
+
+ var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
+
+ this.items = $.grep(this.items, function (item) {
+ for (var j=0; j < list.length; j++) {
+ if(list[j] === item.item[0]) {
+ return false;
+ }
+ }
+ return true;
+ });
+
+ },
+
+ _refreshItems: function(event) {
+
+ this.items = [];
+ this.containers = [this];
+
+ var i, j, cur, inst, targetData, _queries, item, queriesLength,
+ items = this.items,
+ queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
+ connectWith = this._connectWith();
+
+ if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
+ for (i = connectWith.length - 1; i >= 0; i--){
+ cur = $(connectWith[i], this.document[0]);
+ for (j = cur.length - 1; j >= 0; j--){
+ inst = $.data(cur[j], this.widgetFullName);
+ if(inst && inst !== this && !inst.options.disabled) {
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
+ this.containers.push(inst);
+ }
+ }
+ }
+ }
+
+ for (i = queries.length - 1; i >= 0; i--) {
+ targetData = queries[i][1];
+ _queries = queries[i][0];
+
+ for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
+ item = $(_queries[j]);
+
+ item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
+
+ items.push({
+ item: item,
+ instance: targetData,
+ width: 0, height: 0,
+ left: 0, top: 0
+ });
+ }
+ }
+
+ },
+
+ refreshPositions: function(fast) {
+
+ // Determine whether items are being displayed horizontally
+ this.floating = this.items.length ?
+ this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
+ false;
+
+ //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
+ if(this.offsetParent && this.helper) {
+ this.offset.parent = this._getParentOffset();
+ }
+
+ var i, item, t, p;
+
+ for (i = this.items.length - 1; i >= 0; i--){
+ item = this.items[i];
+
+ //We ignore calculating positions of all connected containers when we're not over them
+ if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
+ continue;
+ }
+
+ t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
+
+ if (!fast) {
+ item.width = t.outerWidth();
+ item.height = t.outerHeight();
+ }
+
+ p = t.offset();
+ item.left = p.left;
+ item.top = p.top;
+ }
+
+ if(this.options.custom && this.options.custom.refreshContainers) {
+ this.options.custom.refreshContainers.call(this);
+ } else {
+ for (i = this.containers.length - 1; i >= 0; i--){
+ p = this.containers[i].element.offset();
+ this.containers[i].containerCache.left = p.left;
+ this.containers[i].containerCache.top = p.top;
+ this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
+ this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
+ }
+ }
+
+ return this;
+ },
+
+ _createPlaceholder: function(that) {
+ that = that || this;
+ var className,
+ o = that.options;
+
+ if(!o.placeholder || o.placeholder.constructor === String) {
+ className = o.placeholder;
+ o.placeholder = {
+ element: function() {
+
+ var nodeName = that.currentItem[0].nodeName.toLowerCase(),
+ element = $( "<" + nodeName + ">", that.document[0] )
+ .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
+ .removeClass("ui-sortable-helper");
+
+ if ( nodeName === "tbody" ) {
+ that._createTrPlaceholder(
+ that.currentItem.find( "tr" ).eq( 0 ),
+ $( "<tr>", that.document[ 0 ] ).appendTo( element )
+ );
+ } else if ( nodeName === "tr" ) {
+ that._createTrPlaceholder( that.currentItem, element );
+ } else if ( nodeName === "img" ) {
+ element.attr( "src", that.currentItem.attr( "src" ) );
+ }
+
+ if ( !className ) {
+ element.css( "visibility", "hidden" );
+ }
+
+ return element;
+ },
+ update: function(container, p) {
+
+ // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
+ // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
+ if(className && !o.forcePlaceholderSize) {
+ return;
+ }
+
+ //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
+ if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
+ if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
+ }
+ };
+ }
+
+ //Create the placeholder
+ that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
+
+ //Append it after the actual current item
+ that.currentItem.after(that.placeholder);
+
+ //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
+ o.placeholder.update(that, that.placeholder);
+
+ },
+
+ _createTrPlaceholder: function( sourceTr, targetTr ) {
+ var that = this;
+
+ sourceTr.children().each(function() {
+ $( "<td>&#160;</td>", that.document[ 0 ] )
+ .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
+ .appendTo( targetTr );
+ });
+ },
+
+ _contactContainers: function(event) {
+ var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
+ innermostContainer = null,
+ innermostIndex = null;
+
+ // get innermost container that intersects with item
+ for (i = this.containers.length - 1; i >= 0; i--) {
+
+ // never consider a container that's located within the item itself
+ if($.contains(this.currentItem[0], this.containers[i].element[0])) {
+ continue;
+ }
+
+ if(this._intersectsWith(this.containers[i].containerCache)) {
+
+ // if we've already found a container and it's more "inner" than this, then continue
+ if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
+ continue;
+ }
+
+ innermostContainer = this.containers[i];
+ innermostIndex = i;
+
+ } else {
+ // container doesn't intersect. trigger "out" event if necessary
+ if(this.containers[i].containerCache.over) {
+ this.containers[i]._trigger("out", event, this._uiHash(this));
+ this.containers[i].containerCache.over = 0;
+ }
+ }
+
+ }
+
+ // if no intersecting containers found, return
+ if(!innermostContainer) {
+ return;
+ }
+
+ // move the item into the container if it's not there already
+ if(this.containers.length === 1) {
+ if (!this.containers[innermostIndex].containerCache.over) {
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+ this.containers[innermostIndex].containerCache.over = 1;
+ }
+ } else {
+
+ //When entering a new container, we will find the item with the least distance and append our item near it
+ dist = 10000;
+ itemWithLeastDistance = null;
+ floating = innermostContainer.floating || this._isFloating(this.currentItem);
+ posProperty = floating ? "left" : "top";
+ sizeProperty = floating ? "width" : "height";
+ axis = floating ? "clientX" : "clientY";
+
+ for (j = this.items.length - 1; j >= 0; j--) {
+ if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
+ continue;
+ }
+ if(this.items[j].item[0] === this.currentItem[0]) {
+ continue;
+ }
+
+ cur = this.items[j].item.offset()[posProperty];
+ nearBottom = false;
+ if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
+ nearBottom = true;
+ }
+
+ if ( Math.abs( event[ axis ] - cur ) < dist ) {
+ dist = Math.abs( event[ axis ] - cur );
+ itemWithLeastDistance = this.items[ j ];
+ this.direction = nearBottom ? "up": "down";
+ }
+ }
+
+ //Check if dropOnEmpty is enabled
+ if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
+ return;
+ }
+
+ if(this.currentContainer === this.containers[innermostIndex]) {
+ if ( !this.currentContainer.containerCache.over ) {
+ this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
+ this.currentContainer.containerCache.over = 1;
+ }
+ return;
+ }
+
+ itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
+ this._trigger("change", event, this._uiHash());
+ this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
+ this.currentContainer = this.containers[innermostIndex];
+
+ //Update the placeholder
+ this.options.placeholder.update(this.currentContainer, this.placeholder);
+
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+ this.containers[innermostIndex].containerCache.over = 1;
+ }
+
+
+ },
+
+ _createHelper: function(event) {
+
+ var o = this.options,
+ helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
+
+ //Add the helper to the DOM if that didn't happen already
+ if(!helper.parents("body").length) {
+ $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
+ }
+
+ if(helper[0] === this.currentItem[0]) {
+ this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
+ }
+
+ if(!helper[0].style.width || o.forceHelperSize) {
+ helper.width(this.currentItem.width());
+ }
+ if(!helper[0].style.height || o.forceHelperSize) {
+ helper.height(this.currentItem.height());
+ }
+
+ return helper;
+
+ },
+
+ _adjustOffsetFromHelper: function(obj) {
+ if (typeof obj === "string") {
+ obj = obj.split(" ");
+ }
+ if ($.isArray(obj)) {
+ obj = {left: +obj[0], top: +obj[1] || 0};
+ }
+ if ("left" in obj) {
+ this.offset.click.left = obj.left + this.margins.left;
+ }
+ if ("right" in obj) {
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+ }
+ if ("top" in obj) {
+ this.offset.click.top = obj.top + this.margins.top;
+ }
+ if ("bottom" in obj) {
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+ }
+ },
+
+ _getParentOffset: function() {
+
+
+ //Get the offsetParent and cache its position
+ this.offsetParent = this.helper.offsetParent();
+ var po = this.offsetParent.offset();
+
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
+ if(this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
+ po.left += this.scrollParent.scrollLeft();
+ po.top += this.scrollParent.scrollTop();
+ }
+
+ // This needs to be actually done for all browsers, since pageX/pageY includes this information
+ // with an ugly IE fix
+ if( this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
+ po = { top: 0, left: 0 };
+ }
+
+ return {
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+ };
+
+ },
+
+ _getRelativeOffset: function() {
+
+ if(this.cssPosition === "relative") {
+ var p = this.currentItem.position();
+ return {
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
+ };
+ } else {
+ return { top: 0, left: 0 };
+ }
+
+ },
+
+ _cacheMargins: function() {
+ this.margins = {
+ left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
+ top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
+ };
+ },
+
+ _cacheHelperProportions: function() {
+ this.helperProportions = {
+ width: this.helper.outerWidth(),
+ height: this.helper.outerHeight()
+ };
+ },
+
+ _setContainment: function() {
+
+ var ce, co, over,
+ o = this.options;
+ if(o.containment === "parent") {
+ o.containment = this.helper[0].parentNode;
+ }
+ if(o.containment === "document" || o.containment === "window") {
+ this.containment = [
+ 0 - this.offset.relative.left - this.offset.parent.left,
+ 0 - this.offset.relative.top - this.offset.parent.top,
+ o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left,
+ (o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+ ];
+ }
+
+ if(!(/^(document|window|parent)$/).test(o.containment)) {
+ ce = $(o.containment)[0];
+ co = $(o.containment).offset();
+ over = ($(ce).css("overflow") !== "hidden");
+
+ this.containment = [
+ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
+ co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
+ co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
+ co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
+ ];
+ }
+
+ },
+
+ _convertPositionTo: function(d, pos) {
+
+ if(!pos) {
+ pos = this.position;
+ }
+ var mod = d === "absolute" ? 1 : -1,
+ scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
+ scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+ return {
+ top: (
+ pos.top + // The absolute mouse position
+ this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
+ ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+ ),
+ left: (
+ pos.left + // The absolute mouse position
+ this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
+ ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+ )
+ };
+
+ },
+
+ _generatePosition: function(event) {
+
+ var top, left,
+ o = this.options,
+ pageX = event.pageX,
+ pageY = event.pageY,
+ scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+ // This is another very weird special case that only happens for relative elements:
+ // 1. If the css position is relative
+ // 2. and the scroll parent is the document or similar to the offset parent
+ // we have to refresh the relative offset during the scroll so there are no jumps
+ if(this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {
+ this.offset.relative = this._getRelativeOffset();
+ }
+
+ /*
+ * - Position constraining -
+ * Constrain the position to a mix of grid, containment.
+ */
+
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
+
+ if(this.containment) {
+ if(event.pageX - this.offset.click.left < this.containment[0]) {
+ pageX = this.containment[0] + this.offset.click.left;
+ }
+ if(event.pageY - this.offset.click.top < this.containment[1]) {
+ pageY = this.containment[1] + this.offset.click.top;
+ }
+ if(event.pageX - this.offset.click.left > this.containment[2]) {
+ pageX = this.containment[2] + this.offset.click.left;
+ }
+ if(event.pageY - this.offset.click.top > this.containment[3]) {
+ pageY = this.containment[3] + this.offset.click.top;
+ }
+ }
+
+ if(o.grid) {
+ top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
+ pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+
+ left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
+ pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+ }
+
+ }
+
+ return {
+ top: (
+ pageY - // The absolute mouse position
+ this.offset.click.top - // Click offset (relative to the element)
+ this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
+ ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+ ),
+ left: (
+ pageX - // The absolute mouse position
+ this.offset.click.left - // Click offset (relative to the element)
+ this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
+ ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+ )
+ };
+
+ },
+
+ _rearrange: function(event, i, a, hardRefresh) {
+
+ a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
+
+ //Various things done here to improve the performance:
+ // 1. we create a setTimeout, that calls refreshPositions
+ // 2. on the instance, we have a counter variable, that get's higher after every append
+ // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
+ // 4. this lets only the last addition to the timeout stack through
+ this.counter = this.counter ? ++this.counter : 1;
+ var counter = this.counter;
+
+ this._delay(function() {
+ if(counter === this.counter) {
+ this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
+ }
+ });
+
+ },
+
+ _clear: function(event, noPropagation) {
+
+ this.reverting = false;
+ // We delay all events that have to be triggered to after the point where the placeholder has been removed and
+ // everything else normalized again
+ var i,
+ delayedTriggers = [];
+
+ // We first have to update the dom position of the actual currentItem
+ // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
+ if(!this._noFinalSort && this.currentItem.parent().length) {
+ this.placeholder.before(this.currentItem);
+ }
+ this._noFinalSort = null;
+
+ if(this.helper[0] === this.currentItem[0]) {
+ for(i in this._storedCSS) {
+ if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
+ this._storedCSS[i] = "";
+ }
+ }
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
+ } else {
+ this.currentItem.show();
+ }
+
+ if(this.fromOutside && !noPropagation) {
+ delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
+ }
+ if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
+ delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
+ }
+
+ // Check if the items Container has Changed and trigger appropriate
+ // events.
+ if (this !== this.currentContainer) {
+ if(!noPropagation) {
+ delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
+ }
+ }
+
+
+ //Post events to containers
+ function delayEvent( type, instance, container ) {
+ return function( event ) {
+ container._trigger( type, event, instance._uiHash( instance ) );
+ };
+ }
+ for (i = this.containers.length - 1; i >= 0; i--){
+ if (!noPropagation) {
+ delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
+ }
+ if(this.containers[i].containerCache.over) {
+ delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
+ this.containers[i].containerCache.over = 0;
+ }
+ }
+
+ //Do what was originally in plugins
+ if ( this.storedCursor ) {
+ this.document.find( "body" ).css( "cursor", this.storedCursor );
+ this.storedStylesheet.remove();
+ }
+ if(this._storedOpacity) {
+ this.helper.css("opacity", this._storedOpacity);
+ }
+ if(this._storedZIndex) {
+ this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
+ }
+
+ this.dragging = false;
+
+ if(!noPropagation) {
+ this._trigger("beforeStop", event, this._uiHash());
+ }
+
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+ this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+
+ if ( !this.cancelHelperRemoval ) {
+ if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
+ this.helper.remove();
+ }
+ this.helper = null;
+ }
+
+ if(!noPropagation) {
+ for (i=0; i < delayedTriggers.length; i++) {
+ delayedTriggers[i].call(this, event);
+ } //Trigger all delayed events
+ this._trigger("stop", event, this._uiHash());
+ }
+
+ this.fromOutside = false;
+ return !this.cancelHelperRemoval;
+
+ },
+
+ _trigger: function() {
+ if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
+ this.cancel();
+ }
+ },
+
+ _uiHash: function(_inst) {
+ var inst = _inst || this;
+ return {
+ helper: inst.helper,
+ placeholder: inst.placeholder || $([]),
+ position: inst.position,
+ originalPosition: inst.originalPosition,
+ offset: inst.positionAbs,
+ item: inst.currentItem,
+ sender: _inst ? _inst.element : null
+ };
+ }
+
+});
+
+
+/*!
+ * jQuery UI Spinner 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/spinner/
+ */
+
+
+function spinner_modifier( fn ) {
+ return function() {
+ var previous = this.element.val();
+ fn.apply( this, arguments );
+ this._refresh();
+ if ( previous !== this.element.val() ) {
+ this._trigger( "change" );
+ }
+ };
+}
+
+var spinner = $.widget( "ui.spinner", {
+ version: "1.11.4",
+ defaultElement: "<input>",
+ widgetEventPrefix: "spin",
+ options: {
+ culture: null,
+ icons: {
+ down: "ui-icon-triangle-1-s",
+ up: "ui-icon-triangle-1-n"
+ },
+ incremental: true,
+ max: null,
+ min: null,
+ numberFormat: null,
+ page: 10,
+ step: 1,
+
+ change: null,
+ spin: null,
+ start: null,
+ stop: null
+ },
+
+ _create: function() {
+ // handle string values that need to be parsed
+ this._setOption( "max", this.options.max );
+ this._setOption( "min", this.options.min );
+ this._setOption( "step", this.options.step );
+
+ // Only format if there is a value, prevents the field from being marked
+ // as invalid in Firefox, see #9573.
+ if ( this.value() !== "" ) {
+ // Format the value, but don't constrain.
+ this._value( this.element.val(), true );
+ }
+
+ this._draw();
+ this._on( this._events );
+ this._refresh();
+
+ // turning off autocomplete prevents the browser from remembering the
+ // value when navigating through history, so we re-enable autocomplete
+ // if the page is unloaded before the widget is destroyed. #7790
+ this._on( this.window, {
+ beforeunload: function() {
+ this.element.removeAttr( "autocomplete" );
+ }
+ });
+ },
+
+ _getCreateOptions: function() {
+ var options = {},
+ element = this.element;
+
+ $.each( [ "min", "max", "step" ], function( i, option ) {
+ var value = element.attr( option );
+ if ( value !== undefined && value.length ) {
+ options[ option ] = value;
+ }
+ });
+
+ return options;
+ },
+
+ _events: {
+ keydown: function( event ) {
+ if ( this._start( event ) && this._keydown( event ) ) {
+ event.preventDefault();
+ }
+ },
+ keyup: "_stop",
+ focus: function() {
+ this.previous = this.element.val();
+ },
+ blur: function( event ) {
+ if ( this.cancelBlur ) {
+ delete this.cancelBlur;
+ return;
+ }
+
+ this._stop();
+ this._refresh();
+ if ( this.previous !== this.element.val() ) {
+ this._trigger( "change", event );
+ }
+ },
+ mousewheel: function( event, delta ) {
+ if ( !delta ) {
+ return;
+ }
+ if ( !this.spinning && !this._start( event ) ) {
+ return false;
+ }
+
+ this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
+ clearTimeout( this.mousewheelTimer );
+ this.mousewheelTimer = this._delay(function() {
+ if ( this.spinning ) {
+ this._stop( event );
+ }
+ }, 100 );
+ event.preventDefault();
+ },
+ "mousedown .ui-spinner-button": function( event ) {
+ var previous;
+
+ // We never want the buttons to have focus; whenever the user is
+ // interacting with the spinner, the focus should be on the input.
+ // If the input is focused then this.previous is properly set from
+ // when the input first received focus. If the input is not focused
+ // then we need to set this.previous based on the value before spinning.
+ previous = this.element[0] === this.document[0].activeElement ?
+ this.previous : this.element.val();
+ function checkFocus() {
+ var isActive = this.element[0] === this.document[0].activeElement;
+ if ( !isActive ) {
+ this.element.focus();
+ this.previous = previous;
+ // support: IE
+ // IE sets focus asynchronously, so we need to check if focus
+ // moved off of the input because the user clicked on the button.
+ this._delay(function() {
+ this.previous = previous;
+ });
+ }
+ }
+
+ // ensure focus is on (or stays on) the text field
+ event.preventDefault();
+ checkFocus.call( this );
+
+ // support: IE
+ // IE doesn't prevent moving focus even with event.preventDefault()
+ // so we set a flag to know when we should ignore the blur event
+ // and check (again) if focus moved off of the input.
+ this.cancelBlur = true;
+ this._delay(function() {
+ delete this.cancelBlur;
+ checkFocus.call( this );
+ });
+
+ if ( this._start( event ) === false ) {
+ return;
+ }
+
+ this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
+ },
+ "mouseup .ui-spinner-button": "_stop",
+ "mouseenter .ui-spinner-button": function( event ) {
+ // button will add ui-state-active if mouse was down while mouseleave and kept down
+ if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
+ return;
+ }
+
+ if ( this._start( event ) === false ) {
+ return false;
+ }
+ this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
+ },
+ // TODO: do we really want to consider this a stop?
+ // shouldn't we just stop the repeater and wait until mouseup before
+ // we trigger the stop event?
+ "mouseleave .ui-spinner-button": "_stop"
+ },
+
+ _draw: function() {
+ var uiSpinner = this.uiSpinner = this.element
+ .addClass( "ui-spinner-input" )
+ .attr( "autocomplete", "off" )
+ .wrap( this._uiSpinnerHtml() )
+ .parent()
+ // add buttons
+ .append( this._buttonHtml() );
+
+ this.element.attr( "role", "spinbutton" );
+
+ // button bindings
+ this.buttons = uiSpinner.find( ".ui-spinner-button" )
+ .attr( "tabIndex", -1 )
+ .button()
+ .removeClass( "ui-corner-all" );
+
+ // IE 6 doesn't understand height: 50% for the buttons
+ // unless the wrapper has an explicit height
+ if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
+ uiSpinner.height() > 0 ) {
+ uiSpinner.height( uiSpinner.height() );
+ }
+
+ // disable spinner if element was already disabled
+ if ( this.options.disabled ) {
+ this.disable();
+ }
+ },
+
+ _keydown: function( event ) {
+ var options = this.options,
+ keyCode = $.ui.keyCode;
+
+ switch ( event.keyCode ) {
+ case keyCode.UP:
+ this._repeat( null, 1, event );
+ return true;
+ case keyCode.DOWN:
+ this._repeat( null, -1, event );
+ return true;
+ case keyCode.PAGE_UP:
+ this._repeat( null, options.page, event );
+ return true;
+ case keyCode.PAGE_DOWN:
+ this._repeat( null, -options.page, event );
+ return true;
+ }
+
+ return false;
+ },
+
+ _uiSpinnerHtml: function() {
+ return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
+ },
+
+ _buttonHtml: function() {
+ return "" +
+ "<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
+ "<span class='ui-icon " + this.options.icons.up + "'>&#9650;</span>" +
+ "</a>" +
+ "<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
+ "<span class='ui-icon " + this.options.icons.down + "'>&#9660;</span>" +
+ "</a>";
+ },
+
+ _start: function( event ) {
+ if ( !this.spinning && this._trigger( "start", event ) === false ) {
+ return false;
+ }
+
+ if ( !this.counter ) {
+ this.counter = 1;
+ }
+ this.spinning = true;
+ return true;
+ },
+
+ _repeat: function( i, steps, event ) {
+ i = i || 500;
+
+ clearTimeout( this.timer );
+ this.timer = this._delay(function() {
+ this._repeat( 40, steps, event );
+ }, i );
+
+ this._spin( steps * this.options.step, event );
+ },
+
+ _spin: function( step, event ) {
+ var value = this.value() || 0;
+
+ if ( !this.counter ) {
+ this.counter = 1;
+ }
+
+ value = this._adjustValue( value + step * this._increment( this.counter ) );
+
+ if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
+ this._value( value );
+ this.counter++;
+ }
+ },
+
+ _increment: function( i ) {
+ var incremental = this.options.incremental;
+
+ if ( incremental ) {
+ return $.isFunction( incremental ) ?
+ incremental( i ) :
+ Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
+ }
+
+ return 1;
+ },
+
+ _precision: function() {
+ var precision = this._precisionOf( this.options.step );
+ if ( this.options.min !== null ) {
+ precision = Math.max( precision, this._precisionOf( this.options.min ) );
+ }
+ return precision;
+ },
+
+ _precisionOf: function( num ) {
+ var str = num.toString(),
+ decimal = str.indexOf( "." );
+ return decimal === -1 ? 0 : str.length - decimal - 1;
+ },
+
+ _adjustValue: function( value ) {
+ var base, aboveMin,
+ options = this.options;
+
+ // make sure we're at a valid step
+ // - find out where we are relative to the base (min or 0)
+ base = options.min !== null ? options.min : 0;
+ aboveMin = value - base;
+ // - round to the nearest step
+ aboveMin = Math.round(aboveMin / options.step) * options.step;
+ // - rounding is based on 0, so adjust back to our base
+ value = base + aboveMin;
+
+ // fix precision from bad JS floating point math
+ value = parseFloat( value.toFixed( this._precision() ) );
+
+ // clamp the value
+ if ( options.max !== null && value > options.max) {
+ return options.max;
+ }
+ if ( options.min !== null && value < options.min ) {
+ return options.min;
+ }
+
+ return value;
+ },
+
+ _stop: function( event ) {
+ if ( !this.spinning ) {
+ return;
+ }
+
+ clearTimeout( this.timer );
+ clearTimeout( this.mousewheelTimer );
+ this.counter = 0;
+ this.spinning = false;
+ this._trigger( "stop", event );
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "culture" || key === "numberFormat" ) {
+ var prevValue = this._parse( this.element.val() );
+ this.options[ key ] = value;
+ this.element.val( this._format( prevValue ) );
+ return;
+ }
+
+ if ( key === "max" || key === "min" || key === "step" ) {
+ if ( typeof value === "string" ) {
+ value = this._parse( value );
+ }
+ }
+ if ( key === "icons" ) {
+ this.buttons.first().find( ".ui-icon" )
+ .removeClass( this.options.icons.up )
+ .addClass( value.up );
+ this.buttons.last().find( ".ui-icon" )
+ .removeClass( this.options.icons.down )
+ .addClass( value.down );
+ }
+
+ this._super( key, value );
+
+ if ( key === "disabled" ) {
+ this.widget().toggleClass( "ui-state-disabled", !!value );
+ this.element.prop( "disabled", !!value );
+ this.buttons.button( value ? "disable" : "enable" );
+ }
+ },
+
+ _setOptions: spinner_modifier(function( options ) {
+ this._super( options );
+ }),
+
+ _parse: function( val ) {
+ if ( typeof val === "string" && val !== "" ) {
+ val = window.Globalize && this.options.numberFormat ?
+ Globalize.parseFloat( val, 10, this.options.culture ) : +val;
+ }
+ return val === "" || isNaN( val ) ? null : val;
+ },
+
+ _format: function( value ) {
+ if ( value === "" ) {
+ return "";
+ }
+ return window.Globalize && this.options.numberFormat ?
+ Globalize.format( value, this.options.numberFormat, this.options.culture ) :
+ value;
+ },
+
+ _refresh: function() {
+ this.element.attr({
+ "aria-valuemin": this.options.min,
+ "aria-valuemax": this.options.max,
+ // TODO: what should we do with values that can't be parsed?
+ "aria-valuenow": this._parse( this.element.val() )
+ });
+ },
+
+ isValid: function() {
+ var value = this.value();
+
+ // null is invalid
+ if ( value === null ) {
+ return false;
+ }
+
+ // if value gets adjusted, it's invalid
+ return value === this._adjustValue( value );
+ },
+
+ // update the value without triggering change
+ _value: function( value, allowAny ) {
+ var parsed;
+ if ( value !== "" ) {
+ parsed = this._parse( value );
+ if ( parsed !== null ) {
+ if ( !allowAny ) {
+ parsed = this._adjustValue( parsed );
+ }
+ value = this._format( parsed );
+ }
+ }
+ this.element.val( value );
+ this._refresh();
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass( "ui-spinner-input" )
+ .prop( "disabled", false )
+ .removeAttr( "autocomplete" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-valuemin" )
+ .removeAttr( "aria-valuemax" )
+ .removeAttr( "aria-valuenow" );
+ this.uiSpinner.replaceWith( this.element );
+ },
+
+ stepUp: spinner_modifier(function( steps ) {
+ this._stepUp( steps );
+ }),
+ _stepUp: function( steps ) {
+ if ( this._start() ) {
+ this._spin( (steps || 1) * this.options.step );
+ this._stop();
+ }
+ },
+
+ stepDown: spinner_modifier(function( steps ) {
+ this._stepDown( steps );
+ }),
+ _stepDown: function( steps ) {
+ if ( this._start() ) {
+ this._spin( (steps || 1) * -this.options.step );
+ this._stop();
+ }
+ },
+
+ pageUp: spinner_modifier(function( pages ) {
+ this._stepUp( (pages || 1) * this.options.page );
+ }),
+
+ pageDown: spinner_modifier(function( pages ) {
+ this._stepDown( (pages || 1) * this.options.page );
+ }),
+
+ value: function( newVal ) {
+ if ( !arguments.length ) {
+ return this._parse( this.element.val() );
+ }
+ spinner_modifier( this._value ).call( this, newVal );
+ },
+
+ widget: function() {
+ return this.uiSpinner;
+ }
+});
+
+
+/*!
+ * jQuery UI Tabs 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/tabs/
+ */
+
+
+var tabs = $.widget( "ui.tabs", {
+ version: "1.11.4",
+ delay: 300,
+ options: {
+ active: null,
+ collapsible: false,
+ event: "click",
+ heightStyle: "content",
+ hide: null,
+ show: null,
+
+ // callbacks
+ activate: null,
+ beforeActivate: null,
+ beforeLoad: null,
+ load: null
+ },
+
+ _isLocal: (function() {
+ var rhash = /#.*$/;
+
+ return function( anchor ) {
+ var anchorUrl, locationUrl;
+
+ // support: IE7
+ // IE7 doesn't normalize the href property when set via script (#9317)
+ anchor = anchor.cloneNode( false );
+
+ anchorUrl = anchor.href.replace( rhash, "" );
+ locationUrl = location.href.replace( rhash, "" );
+
+ // decoding may throw an error if the URL isn't UTF-8 (#9518)
+ try {
+ anchorUrl = decodeURIComponent( anchorUrl );
+ } catch ( error ) {}
+ try {
+ locationUrl = decodeURIComponent( locationUrl );
+ } catch ( error ) {}
+
+ return anchor.hash.length > 1 && anchorUrl === locationUrl;
+ };
+ })(),
+
+ _create: function() {
+ var that = this,
+ options = this.options;
+
+ this.running = false;
+
+ this.element
+ .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
+ .toggleClass( "ui-tabs-collapsible", options.collapsible );
+
+ this._processTabs();
+ options.active = this._initialActive();
+
+ // Take disabling tabs via class attribute from HTML
+ // into account and update option properly.
+ if ( $.isArray( options.disabled ) ) {
+ options.disabled = $.unique( options.disabled.concat(
+ $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
+ return that.tabs.index( li );
+ })
+ ) ).sort();
+ }
+
+ // check for length avoids error when initializing empty list
+ if ( this.options.active !== false && this.anchors.length ) {
+ this.active = this._findActive( options.active );
+ } else {
+ this.active = $();
+ }
+
+ this._refresh();
+
+ if ( this.active.length ) {
+ this.load( options.active );
+ }
+ },
+
+ _initialActive: function() {
+ var active = this.options.active,
+ collapsible = this.options.collapsible,
+ locationHash = location.hash.substring( 1 );
+
+ if ( active === null ) {
+ // check the fragment identifier in the URL
+ if ( locationHash ) {
+ this.tabs.each(function( i, tab ) {
+ if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
+ active = i;
+ return false;
+ }
+ });
+ }
+
+ // check for a tab marked active via a class
+ if ( active === null ) {
+ active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
+ }
+
+ // no active tab, set to false
+ if ( active === null || active === -1 ) {
+ active = this.tabs.length ? 0 : false;
+ }
+ }
+
+ // handle numbers: negative, out of range
+ if ( active !== false ) {
+ active = this.tabs.index( this.tabs.eq( active ) );
+ if ( active === -1 ) {
+ active = collapsible ? false : 0;
+ }
+ }
+
+ // don't allow collapsible: false and active: false
+ if ( !collapsible && active === false && this.anchors.length ) {
+ active = 0;
+ }
+
+ return active;
+ },
+
+ _getCreateEventData: function() {
+ return {
+ tab: this.active,
+ panel: !this.active.length ? $() : this._getPanelForTab( this.active )
+ };
+ },
+
+ _tabKeydown: function( event ) {
+ var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
+ selectedIndex = this.tabs.index( focusedTab ),
+ goingForward = true;
+
+ if ( this._handlePageNav( event ) ) {
+ return;
+ }
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.RIGHT:
+ case $.ui.keyCode.DOWN:
+ selectedIndex++;
+ break;
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.LEFT:
+ goingForward = false;
+ selectedIndex--;
+ break;
+ case $.ui.keyCode.END:
+ selectedIndex = this.anchors.length - 1;
+ break;
+ case $.ui.keyCode.HOME:
+ selectedIndex = 0;
+ break;
+ case $.ui.keyCode.SPACE:
+ // Activate only, no collapsing
+ event.preventDefault();
+ clearTimeout( this.activating );
+ this._activate( selectedIndex );
+ return;
+ case $.ui.keyCode.ENTER:
+ // Toggle (cancel delayed activation, allow collapsing)
+ event.preventDefault();
+ clearTimeout( this.activating );
+ // Determine if we should collapse or activate
+ this._activate( selectedIndex === this.options.active ? false : selectedIndex );
+ return;
+ default:
+ return;
+ }
+
+ // Focus the appropriate tab, based on which key was pressed
+ event.preventDefault();
+ clearTimeout( this.activating );
+ selectedIndex = this._focusNextTab( selectedIndex, goingForward );
+
+ // Navigating with control/command key will prevent automatic activation
+ if ( !event.ctrlKey && !event.metaKey ) {
+
+ // Update aria-selected immediately so that AT think the tab is already selected.
+ // Otherwise AT may confuse the user by stating that they need to activate the tab,
+ // but the tab will already be activated by the time the announcement finishes.
+ focusedTab.attr( "aria-selected", "false" );
+ this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
+
+ this.activating = this._delay(function() {
+ this.option( "active", selectedIndex );
+ }, this.delay );
+ }
+ },
+
+ _panelKeydown: function( event ) {
+ if ( this._handlePageNav( event ) ) {
+ return;
+ }
+
+ // Ctrl+up moves focus to the current tab
+ if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
+ event.preventDefault();
+ this.active.focus();
+ }
+ },
+
+ // Alt+page up/down moves focus to the previous/next tab (and activates)
+ _handlePageNav: function( event ) {
+ if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
+ this._activate( this._focusNextTab( this.options.active - 1, false ) );
+ return true;
+ }
+ if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
+ this._activate( this._focusNextTab( this.options.active + 1, true ) );
+ return true;
+ }
+ },
+
+ _findNextTab: function( index, goingForward ) {
+ var lastTabIndex = this.tabs.length - 1;
+
+ function constrain() {
+ if ( index > lastTabIndex ) {
+ index = 0;
+ }
+ if ( index < 0 ) {
+ index = lastTabIndex;
+ }
+ return index;
+ }
+
+ while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
+ index = goingForward ? index + 1 : index - 1;
+ }
+
+ return index;
+ },
+
+ _focusNextTab: function( index, goingForward ) {
+ index = this._findNextTab( index, goingForward );
+ this.tabs.eq( index ).focus();
+ return index;
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "active" ) {
+ // _activate() will handle invalid values and update this.options
+ this._activate( value );
+ return;
+ }
+
+ if ( key === "disabled" ) {
+ // don't use the widget factory's disabled handling
+ this._setupDisabled( value );
+ return;
+ }
+
+ this._super( key, value);
+
+ if ( key === "collapsible" ) {
+ this.element.toggleClass( "ui-tabs-collapsible", value );
+ // Setting collapsible: false while collapsed; open first panel
+ if ( !value && this.options.active === false ) {
+ this._activate( 0 );
+ }
+ }
+
+ if ( key === "event" ) {
+ this._setupEvents( value );
+ }
+
+ if ( key === "heightStyle" ) {
+ this._setupHeightStyle( value );
+ }
+ },
+
+ _sanitizeSelector: function( hash ) {
+ return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
+ },
+
+ refresh: function() {
+ var options = this.options,
+ lis = this.tablist.children( ":has(a[href])" );
+
+ // get disabled tabs from class attribute from HTML
+ // this will get converted to a boolean if needed in _refresh()
+ options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
+ return lis.index( tab );
+ });
+
+ this._processTabs();
+
+ // was collapsed or no tabs
+ if ( options.active === false || !this.anchors.length ) {
+ options.active = false;
+ this.active = $();
+ // was active, but active tab is gone
+ } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
+ // all remaining tabs are disabled
+ if ( this.tabs.length === options.disabled.length ) {
+ options.active = false;
+ this.active = $();
+ // activate previous tab
+ } else {
+ this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
+ }
+ // was active, active tab still exists
+ } else {
+ // make sure active index is correct
+ options.active = this.tabs.index( this.active );
+ }
+
+ this._refresh();
+ },
+
+ _refresh: function() {
+ this._setupDisabled( this.options.disabled );
+ this._setupEvents( this.options.event );
+ this._setupHeightStyle( this.options.heightStyle );
+
+ this.tabs.not( this.active ).attr({
+ "aria-selected": "false",
+ "aria-expanded": "false",
+ tabIndex: -1
+ });
+ this.panels.not( this._getPanelForTab( this.active ) )
+ .hide()
+ .attr({
+ "aria-hidden": "true"
+ });
+
+ // Make sure one tab is in the tab order
+ if ( !this.active.length ) {
+ this.tabs.eq( 0 ).attr( "tabIndex", 0 );
+ } else {
+ this.active
+ .addClass( "ui-tabs-active ui-state-active" )
+ .attr({
+ "aria-selected": "true",
+ "aria-expanded": "true",
+ tabIndex: 0
+ });
+ this._getPanelForTab( this.active )
+ .show()
+ .attr({
+ "aria-hidden": "false"
+ });
+ }
+ },
+
+ _processTabs: function() {
+ var that = this,
+ prevTabs = this.tabs,
+ prevAnchors = this.anchors,
+ prevPanels = this.panels;
+
+ this.tablist = this._getList()
+ .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
+ .attr( "role", "tablist" )
+
+ // Prevent users from focusing disabled tabs via click
+ .delegate( "> li", "mousedown" + this.eventNamespace, function( event ) {
+ if ( $( this ).is( ".ui-state-disabled" ) ) {
+ event.preventDefault();
+ }
+ })
+
+ // support: IE <9
+ // Preventing the default action in mousedown doesn't prevent IE
+ // from focusing the element, so if the anchor gets focused, blur.
+ // We don't have to worry about focusing the previously focused
+ // element since clicking on a non-focusable element should focus
+ // the body anyway.
+ .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
+ if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
+ this.blur();
+ }
+ });
+
+ this.tabs = this.tablist.find( "> li:has(a[href])" )
+ .addClass( "ui-state-default ui-corner-top" )
+ .attr({
+ role: "tab",
+ tabIndex: -1
+ });
+
+ this.anchors = this.tabs.map(function() {
+ return $( "a", this )[ 0 ];
+ })
+ .addClass( "ui-tabs-anchor" )
+ .attr({
+ role: "presentation",
+ tabIndex: -1
+ });
+
+ this.panels = $();
+
+ this.anchors.each(function( i, anchor ) {
+ var selector, panel, panelId,
+ anchorId = $( anchor ).uniqueId().attr( "id" ),
+ tab = $( anchor ).closest( "li" ),
+ originalAriaControls = tab.attr( "aria-controls" );
+
+ // inline tab
+ if ( that._isLocal( anchor ) ) {
+ selector = anchor.hash;
+ panelId = selector.substring( 1 );
+ panel = that.element.find( that._sanitizeSelector( selector ) );
+ // remote tab
+ } else {
+ // If the tab doesn't already have aria-controls,
+ // generate an id by using a throw-away element
+ panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
+ selector = "#" + panelId;
+ panel = that.element.find( selector );
+ if ( !panel.length ) {
+ panel = that._createPanel( panelId );
+ panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
+ }
+ panel.attr( "aria-live", "polite" );
+ }
+
+ if ( panel.length) {
+ that.panels = that.panels.add( panel );
+ }
+ if ( originalAriaControls ) {
+ tab.data( "ui-tabs-aria-controls", originalAriaControls );
+ }
+ tab.attr({
+ "aria-controls": panelId,
+ "aria-labelledby": anchorId
+ });
+ panel.attr( "aria-labelledby", anchorId );
+ });
+
+ this.panels
+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+ .attr( "role", "tabpanel" );
+
+ // Avoid memory leaks (#10056)
+ if ( prevTabs ) {
+ this._off( prevTabs.not( this.tabs ) );
+ this._off( prevAnchors.not( this.anchors ) );
+ this._off( prevPanels.not( this.panels ) );
+ }
+ },
+
+ // allow overriding how to find the list for rare usage scenarios (#7715)
+ _getList: function() {
+ return this.tablist || this.element.find( "ol,ul" ).eq( 0 );
+ },
+
+ _createPanel: function( id ) {
+ return $( "<div>" )
+ .attr( "id", id )
+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+ .data( "ui-tabs-destroy", true );
+ },
+
+ _setupDisabled: function( disabled ) {
+ if ( $.isArray( disabled ) ) {
+ if ( !disabled.length ) {
+ disabled = false;
+ } else if ( disabled.length === this.anchors.length ) {
+ disabled = true;
+ }
+ }
+
+ // disable tabs
+ for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) {
+ if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
+ $( li )
+ .addClass( "ui-state-disabled" )
+ .attr( "aria-disabled", "true" );
+ } else {
+ $( li )
+ .removeClass( "ui-state-disabled" )
+ .removeAttr( "aria-disabled" );
+ }
+ }
+
+ this.options.disabled = disabled;
+ },
+
+ _setupEvents: function( event ) {
+ var events = {};
+ if ( event ) {
+ $.each( event.split(" "), function( index, eventName ) {
+ events[ eventName ] = "_eventHandler";
+ });
+ }
+
+ this._off( this.anchors.add( this.tabs ).add( this.panels ) );
+ // Always prevent the default action, even when disabled
+ this._on( true, this.anchors, {
+ click: function( event ) {
+ event.preventDefault();
+ }
+ });
+ this._on( this.anchors, events );
+ this._on( this.tabs, { keydown: "_tabKeydown" } );
+ this._on( this.panels, { keydown: "_panelKeydown" } );
+
+ this._focusable( this.tabs );
+ this._hoverable( this.tabs );
+ },
+
+ _setupHeightStyle: function( heightStyle ) {
+ var maxHeight,
+ parent = this.element.parent();
+
+ if ( heightStyle === "fill" ) {
+ maxHeight = parent.height();
+ maxHeight -= this.element.outerHeight() - this.element.height();
+
+ this.element.siblings( ":visible" ).each(function() {
+ var elem = $( this ),
+ position = elem.css( "position" );
+
+ if ( position === "absolute" || position === "fixed" ) {
+ return;
+ }
+ maxHeight -= elem.outerHeight( true );
+ });
+
+ this.element.children().not( this.panels ).each(function() {
+ maxHeight -= $( this ).outerHeight( true );
+ });
+
+ this.panels.each(function() {
+ $( this ).height( Math.max( 0, maxHeight -
+ $( this ).innerHeight() + $( this ).height() ) );
+ })
+ .css( "overflow", "auto" );
+ } else if ( heightStyle === "auto" ) {
+ maxHeight = 0;
+ this.panels.each(function() {
+ maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
+ }).height( maxHeight );
+ }
+ },
+
+ _eventHandler: function( event ) {
+ var options = this.options,
+ active = this.active,
+ anchor = $( event.currentTarget ),
+ tab = anchor.closest( "li" ),
+ clickedIsActive = tab[ 0 ] === active[ 0 ],
+ collapsing = clickedIsActive && options.collapsible,
+ toShow = collapsing ? $() : this._getPanelForTab( tab ),
+ toHide = !active.length ? $() : this._getPanelForTab( active ),
+ eventData = {
+ oldTab: active,
+ oldPanel: toHide,
+ newTab: collapsing ? $() : tab,
+ newPanel: toShow
+ };
+
+ event.preventDefault();
+
+ if ( tab.hasClass( "ui-state-disabled" ) ||
+ // tab is already loading
+ tab.hasClass( "ui-tabs-loading" ) ||
+ // can't switch durning an animation
+ this.running ||
+ // click on active header, but not collapsible
+ ( clickedIsActive && !options.collapsible ) ||
+ // allow canceling activation
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
+ return;
+ }
+
+ options.active = collapsing ? false : this.tabs.index( tab );
+
+ this.active = clickedIsActive ? $() : tab;
+ if ( this.xhr ) {
+ this.xhr.abort();
+ }
+
+ if ( !toHide.length && !toShow.length ) {
+ $.error( "jQuery UI Tabs: Mismatching fragment identifier." );
+ }
+
+ if ( toShow.length ) {
+ this.load( this.tabs.index( tab ), event );
+ }
+ this._toggle( event, eventData );
+ },
+
+ // handles show/hide for selecting tabs
+ _toggle: function( event, eventData ) {
+ var that = this,
+ toShow = eventData.newPanel,
+ toHide = eventData.oldPanel;
+
+ this.running = true;
+
+ function complete() {
+ that.running = false;
+ that._trigger( "activate", event, eventData );
+ }
+
+ function show() {
+ eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
+
+ if ( toShow.length && that.options.show ) {
+ that._show( toShow, that.options.show, complete );
+ } else {
+ toShow.show();
+ complete();
+ }
+ }
+
+ // start out by hiding, then showing, then completing
+ if ( toHide.length && this.options.hide ) {
+ this._hide( toHide, this.options.hide, function() {
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+ show();
+ });
+ } else {
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+ toHide.hide();
+ show();
+ }
+
+ toHide.attr( "aria-hidden", "true" );
+ eventData.oldTab.attr({
+ "aria-selected": "false",
+ "aria-expanded": "false"
+ });
+ // If we're switching tabs, remove the old tab from the tab order.
+ // If we're opening from collapsed state, remove the previous tab from the tab order.
+ // If we're collapsing, then keep the collapsing tab in the tab order.
+ if ( toShow.length && toHide.length ) {
+ eventData.oldTab.attr( "tabIndex", -1 );
+ } else if ( toShow.length ) {
+ this.tabs.filter(function() {
+ return $( this ).attr( "tabIndex" ) === 0;
+ })
+ .attr( "tabIndex", -1 );
+ }
+
+ toShow.attr( "aria-hidden", "false" );
+ eventData.newTab.attr({
+ "aria-selected": "true",
+ "aria-expanded": "true",
+ tabIndex: 0
+ });
+ },
+
+ _activate: function( index ) {
+ var anchor,
+ active = this._findActive( index );
+
+ // trying to activate the already active panel
+ if ( active[ 0 ] === this.active[ 0 ] ) {
+ return;
+ }
+
+ // trying to collapse, simulate a click on the current active header
+ if ( !active.length ) {
+ active = this.active;
+ }
+
+ anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
+ this._eventHandler({
+ target: anchor,
+ currentTarget: anchor,
+ preventDefault: $.noop
+ });
+ },
+
+ _findActive: function( index ) {
+ return index === false ? $() : this.tabs.eq( index );
+ },
+
+ _getIndex: function( index ) {
+ // meta-function to give users option to provide a href string instead of a numerical index.
+ if ( typeof index === "string" ) {
+ index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
+ }
+
+ return index;
+ },
+
+ _destroy: function() {
+ if ( this.xhr ) {
+ this.xhr.abort();
+ }
+
+ this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );
+
+ this.tablist
+ .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
+ .removeAttr( "role" );
+
+ this.anchors
+ .removeClass( "ui-tabs-anchor" )
+ .removeAttr( "role" )
+ .removeAttr( "tabIndex" )
+ .removeUniqueId();
+
+ this.tablist.unbind( this.eventNamespace );
+
+ this.tabs.add( this.panels ).each(function() {
+ if ( $.data( this, "ui-tabs-destroy" ) ) {
+ $( this ).remove();
+ } else {
+ $( this )
+ .removeClass( "ui-state-default ui-state-active ui-state-disabled " +
+ "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" )
+ .removeAttr( "tabIndex" )
+ .removeAttr( "aria-live" )
+ .removeAttr( "aria-busy" )
+ .removeAttr( "aria-selected" )
+ .removeAttr( "aria-labelledby" )
+ .removeAttr( "aria-hidden" )
+ .removeAttr( "aria-expanded" )
+ .removeAttr( "role" );
+ }
+ });
+
+ this.tabs.each(function() {
+ var li = $( this ),
+ prev = li.data( "ui-tabs-aria-controls" );
+ if ( prev ) {
+ li
+ .attr( "aria-controls", prev )
+ .removeData( "ui-tabs-aria-controls" );
+ } else {
+ li.removeAttr( "aria-controls" );
+ }
+ });
+
+ this.panels.show();
+
+ if ( this.options.heightStyle !== "content" ) {
+ this.panels.css( "height", "" );
+ }
+ },
+
+ enable: function( index ) {
+ var disabled = this.options.disabled;
+ if ( disabled === false ) {
+ return;
+ }
+
+ if ( index === undefined ) {
+ disabled = false;
+ } else {
+ index = this._getIndex( index );
+ if ( $.isArray( disabled ) ) {
+ disabled = $.map( disabled, function( num ) {
+ return num !== index ? num : null;
+ });
+ } else {
+ disabled = $.map( this.tabs, function( li, num ) {
+ return num !== index ? num : null;
+ });
+ }
+ }
+ this._setupDisabled( disabled );
+ },
+
+ disable: function( index ) {
+ var disabled = this.options.disabled;
+ if ( disabled === true ) {
+ return;
+ }
+
+ if ( index === undefined ) {
+ disabled = true;
+ } else {
+ index = this._getIndex( index );
+ if ( $.inArray( index, disabled ) !== -1 ) {
+ return;
+ }
+ if ( $.isArray( disabled ) ) {
+ disabled = $.merge( [ index ], disabled ).sort();
+ } else {
+ disabled = [ index ];
+ }
+ }
+ this._setupDisabled( disabled );
+ },
+
+ load: function( index, event ) {
+ index = this._getIndex( index );
+ var that = this,
+ tab = this.tabs.eq( index ),
+ anchor = tab.find( ".ui-tabs-anchor" ),
+ panel = this._getPanelForTab( tab ),
+ eventData = {
+ tab: tab,
+ panel: panel
+ },
+ complete = function( jqXHR, status ) {
+ if ( status === "abort" ) {
+ that.panels.stop( false, true );
+ }
+
+ tab.removeClass( "ui-tabs-loading" );
+ panel.removeAttr( "aria-busy" );
+
+ if ( jqXHR === that.xhr ) {
+ delete that.xhr;
+ }
+ };
+
+ // not remote
+ if ( this._isLocal( anchor[ 0 ] ) ) {
+ return;
+ }
+
+ this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
+
+ // support: jQuery <1.8
+ // jQuery <1.8 returns false if the request is canceled in beforeSend,
+ // but as of 1.8, $.ajax() always returns a jqXHR object.
+ if ( this.xhr && this.xhr.statusText !== "canceled" ) {
+ tab.addClass( "ui-tabs-loading" );
+ panel.attr( "aria-busy", "true" );
+
+ this.xhr
+ .done(function( response, status, jqXHR ) {
+ // support: jQuery <1.8
+ // http://bugs.jquery.com/ticket/11778
+ setTimeout(function() {
+ panel.html( response );
+ that._trigger( "load", event, eventData );
+
+ complete( jqXHR, status );
+ }, 1 );
+ })
+ .fail(function( jqXHR, status ) {
+ // support: jQuery <1.8
+ // http://bugs.jquery.com/ticket/11778
+ setTimeout(function() {
+ complete( jqXHR, status );
+ }, 1 );
+ });
+ }
+ },
+
+ _ajaxSettings: function( anchor, event, eventData ) {
+ var that = this;
+ return {
+ url: anchor.attr( "href" ),
+ beforeSend: function( jqXHR, settings ) {
+ return that._trigger( "beforeLoad", event,
+ $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
+ }
+ };
+ },
+
+ _getPanelForTab: function( tab ) {
+ var id = $( tab ).attr( "aria-controls" );
+ return this.element.find( this._sanitizeSelector( "#" + id ) );
+ }
+});
+
+
+/*!
+ * jQuery UI Tooltip 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/tooltip/
+ */
+
+
+var tooltip = $.widget( "ui.tooltip", {
+ version: "1.11.4",
+ options: {
+ content: function() {
+ // support: IE<9, Opera in jQuery <1.7
+ // .text() can't accept undefined, so coerce to a string
+ var title = $( this ).attr( "title" ) || "";
+ // Escape title, since we're going from an attribute to raw HTML
+ return $( "<a>" ).text( title ).html();
+ },
+ hide: true,
+ // Disabled elements have inconsistent behavior across browsers (#8661)
+ items: "[title]:not([disabled])",
+ position: {
+ my: "left top+15",
+ at: "left bottom",
+ collision: "flipfit flip"
+ },
+ show: true,
+ tooltipClass: null,
+ track: false,
+
+ // callbacks
+ close: null,
+ open: null
+ },
+
+ _addDescribedBy: function( elem, id ) {
+ var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
+ describedby.push( id );
+ elem
+ .data( "ui-tooltip-id", id )
+ .attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
+ },
+
+ _removeDescribedBy: function( elem ) {
+ var id = elem.data( "ui-tooltip-id" ),
+ describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
+ index = $.inArray( id, describedby );
+
+ if ( index !== -1 ) {
+ describedby.splice( index, 1 );
+ }
+
+ elem.removeData( "ui-tooltip-id" );
+ describedby = $.trim( describedby.join( " " ) );
+ if ( describedby ) {
+ elem.attr( "aria-describedby", describedby );
+ } else {
+ elem.removeAttr( "aria-describedby" );
+ }
+ },
+
+ _create: function() {
+ this._on({
+ mouseover: "open",
+ focusin: "open"
+ });
+
+ // IDs of generated tooltips, needed for destroy
+ this.tooltips = {};
+
+ // IDs of parent tooltips where we removed the title attribute
+ this.parents = {};
+
+ if ( this.options.disabled ) {
+ this._disable();
+ }
+
+ // Append the aria-live region so tooltips announce correctly
+ this.liveRegion = $( "<div>" )
+ .attr({
+ role: "log",
+ "aria-live": "assertive",
+ "aria-relevant": "additions"
+ })
+ .addClass( "ui-helper-hidden-accessible" )
+ .appendTo( this.document[ 0 ].body );
+ },
+
+ _setOption: function( key, value ) {
+ var that = this;
+
+ if ( key === "disabled" ) {
+ this[ value ? "_disable" : "_enable" ]();
+ this.options[ key ] = value;
+ // disable element style changes
+ return;
+ }
+
+ this._super( key, value );
+
+ if ( key === "content" ) {
+ $.each( this.tooltips, function( id, tooltipData ) {
+ that._updateContent( tooltipData.element );
+ });
+ }
+ },
+
+ _disable: function() {
+ var that = this;
+
+ // close open tooltips
+ $.each( this.tooltips, function( id, tooltipData ) {
+ var event = $.Event( "blur" );
+ event.target = event.currentTarget = tooltipData.element[ 0 ];
+ that.close( event, true );
+ });
+
+ // remove title attributes to prevent native tooltips
+ this.element.find( this.options.items ).addBack().each(function() {
+ var element = $( this );
+ if ( element.is( "[title]" ) ) {
+ element
+ .data( "ui-tooltip-title", element.attr( "title" ) )
+ .removeAttr( "title" );
+ }
+ });
+ },
+
+ _enable: function() {
+ // restore title attributes
+ this.element.find( this.options.items ).addBack().each(function() {
+ var element = $( this );
+ if ( element.data( "ui-tooltip-title" ) ) {
+ element.attr( "title", element.data( "ui-tooltip-title" ) );
+ }
+ });
+ },
+
+ open: function( event ) {
+ var that = this,
+ target = $( event ? event.target : this.element )
+ // we need closest here due to mouseover bubbling,
+ // but always pointing at the same event target
+ .closest( this.options.items );
+
+ // No element to show a tooltip for or the tooltip is already open
+ if ( !target.length || target.data( "ui-tooltip-id" ) ) {
+ return;
+ }
+
+ if ( target.attr( "title" ) ) {
+ target.data( "ui-tooltip-title", target.attr( "title" ) );
+ }
+
+ target.data( "ui-tooltip-open", true );
+
+ // kill parent tooltips, custom or native, for hover
+ if ( event && event.type === "mouseover" ) {
+ target.parents().each(function() {
+ var parent = $( this ),
+ blurEvent;
+ if ( parent.data( "ui-tooltip-open" ) ) {
+ blurEvent = $.Event( "blur" );
+ blurEvent.target = blurEvent.currentTarget = this;
+ that.close( blurEvent, true );
+ }
+ if ( parent.attr( "title" ) ) {
+ parent.uniqueId();
+ that.parents[ this.id ] = {
+ element: this,
+ title: parent.attr( "title" )
+ };
+ parent.attr( "title", "" );
+ }
+ });
+ }
+
+ this._registerCloseHandlers( event, target );
+ this._updateContent( target, event );
+ },
+
+ _updateContent: function( target, event ) {
+ var content,
+ contentOption = this.options.content,
+ that = this,
+ eventType = event ? event.type : null;
+
+ if ( typeof contentOption === "string" ) {
+ return this._open( event, target, contentOption );
+ }
+
+ content = contentOption.call( target[0], function( response ) {
+
+ // IE may instantly serve a cached response for ajax requests
+ // delay this call to _open so the other call to _open runs first
+ that._delay(function() {
+
+ // Ignore async response if tooltip was closed already
+ if ( !target.data( "ui-tooltip-open" ) ) {
+ return;
+ }
+
+ // jQuery creates a special event for focusin when it doesn't
+ // exist natively. To improve performance, the native event
+ // object is reused and the type is changed. Therefore, we can't
+ // rely on the type being correct after the event finished
+ // bubbling, so we set it back to the previous value. (#8740)
+ if ( event ) {
+ event.type = eventType;
+ }
+ this._open( event, target, response );
+ });
+ });
+ if ( content ) {
+ this._open( event, target, content );
+ }
+ },
+
+ _open: function( event, target, content ) {
+ var tooltipData, tooltip, delayedShow, a11yContent,
+ positionOption = $.extend( {}, this.options.position );
+
+ if ( !content ) {
+ return;
+ }
+
+ // Content can be updated multiple times. If the tooltip already
+ // exists, then just update the content and bail.
+ tooltipData = this._find( target );
+ if ( tooltipData ) {
+ tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
+ return;
+ }
+
+ // if we have a title, clear it to prevent the native tooltip
+ // we have to check first to avoid defining a title if none exists
+ // (we don't want to cause an element to start matching [title])
+ //
+ // We use removeAttr only for key events, to allow IE to export the correct
+ // accessible attributes. For mouse events, set to empty string to avoid
+ // native tooltip showing up (happens only when removing inside mouseover).
+ if ( target.is( "[title]" ) ) {
+ if ( event && event.type === "mouseover" ) {
+ target.attr( "title", "" );
+ } else {
+ target.removeAttr( "title" );
+ }
+ }
+
+ tooltipData = this._tooltip( target );
+ tooltip = tooltipData.tooltip;
+ this._addDescribedBy( target, tooltip.attr( "id" ) );
+ tooltip.find( ".ui-tooltip-content" ).html( content );
+
+ // Support: Voiceover on OS X, JAWS on IE <= 9
+ // JAWS announces deletions even when aria-relevant="additions"
+ // Voiceover will sometimes re-read the entire log region's contents from the beginning
+ this.liveRegion.children().hide();
+ if ( content.clone ) {
+ a11yContent = content.clone();
+ a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
+ } else {
+ a11yContent = content;
+ }
+ $( "<div>" ).html( a11yContent ).appendTo( this.liveRegion );
+
+ function position( event ) {
+ positionOption.of = event;
+ if ( tooltip.is( ":hidden" ) ) {
+ return;
+ }
+ tooltip.position( positionOption );
+ }
+ if ( this.options.track && event && /^mouse/.test( event.type ) ) {
+ this._on( this.document, {
+ mousemove: position
+ });
+ // trigger once to override element-relative positioning
+ position( event );
+ } else {
+ tooltip.position( $.extend({
+ of: target
+ }, this.options.position ) );
+ }
+
+ tooltip.hide();
+
+ this._show( tooltip, this.options.show );
+ // Handle tracking tooltips that are shown with a delay (#8644). As soon
+ // as the tooltip is visible, position the tooltip using the most recent
+ // event.
+ if ( this.options.show && this.options.show.delay ) {
+ delayedShow = this.delayedShow = setInterval(function() {
+ if ( tooltip.is( ":visible" ) ) {
+ position( positionOption.of );
+ clearInterval( delayedShow );
+ }
+ }, $.fx.interval );
+ }
+
+ this._trigger( "open", event, { tooltip: tooltip } );
+ },
+
+ _registerCloseHandlers: function( event, target ) {
+ var events = {
+ keyup: function( event ) {
+ if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
+ var fakeEvent = $.Event(event);
+ fakeEvent.currentTarget = target[0];
+ this.close( fakeEvent, true );
+ }
+ }
+ };
+
+ // Only bind remove handler for delegated targets. Non-delegated
+ // tooltips will handle this in destroy.
+ if ( target[ 0 ] !== this.element[ 0 ] ) {
+ events.remove = function() {
+ this._removeTooltip( this._find( target ).tooltip );
+ };
+ }
+
+ if ( !event || event.type === "mouseover" ) {
+ events.mouseleave = "close";
+ }
+ if ( !event || event.type === "focusin" ) {
+ events.focusout = "close";
+ }
+ this._on( true, target, events );
+ },
+
+ close: function( event ) {
+ var tooltip,
+ that = this,
+ target = $( event ? event.currentTarget : this.element ),
+ tooltipData = this._find( target );
+
+ // The tooltip may already be closed
+ if ( !tooltipData ) {
+
+ // We set ui-tooltip-open immediately upon open (in open()), but only set the
+ // additional data once there's actually content to show (in _open()). So even if the
+ // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
+ // the period between open() and _open().
+ target.removeData( "ui-tooltip-open" );
+ return;
+ }
+
+ tooltip = tooltipData.tooltip;
+
+ // disabling closes the tooltip, so we need to track when we're closing
+ // to avoid an infinite loop in case the tooltip becomes disabled on close
+ if ( tooltipData.closing ) {
+ return;
+ }
+
+ // Clear the interval for delayed tracking tooltips
+ clearInterval( this.delayedShow );
+
+ // only set title if we had one before (see comment in _open())
+ // If the title attribute has changed since open(), don't restore
+ if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
+ target.attr( "title", target.data( "ui-tooltip-title" ) );
+ }
+
+ this._removeDescribedBy( target );
+
+ tooltipData.hiding = true;
+ tooltip.stop( true );
+ this._hide( tooltip, this.options.hide, function() {
+ that._removeTooltip( $( this ) );
+ });
+
+ target.removeData( "ui-tooltip-open" );
+ this._off( target, "mouseleave focusout keyup" );
+
+ // Remove 'remove' binding only on delegated targets
+ if ( target[ 0 ] !== this.element[ 0 ] ) {
+ this._off( target, "remove" );
+ }
+ this._off( this.document, "mousemove" );
+
+ if ( event && event.type === "mouseleave" ) {
+ $.each( this.parents, function( id, parent ) {
+ $( parent.element ).attr( "title", parent.title );
+ delete that.parents[ id ];
+ });
+ }
+
+ tooltipData.closing = true;
+ this._trigger( "close", event, { tooltip: tooltip } );
+ if ( !tooltipData.hiding ) {
+ tooltipData.closing = false;
+ }
+ },
+
+ _tooltip: function( element ) {
+ var tooltip = $( "<div>" )
+ .attr( "role", "tooltip" )
+ .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
+ ( this.options.tooltipClass || "" ) ),
+ id = tooltip.uniqueId().attr( "id" );
+
+ $( "<div>" )
+ .addClass( "ui-tooltip-content" )
+ .appendTo( tooltip );
+
+ tooltip.appendTo( this.document[0].body );
+
+ return this.tooltips[ id ] = {
+ element: element,
+ tooltip: tooltip
+ };
+ },
+
+ _find: function( target ) {
+ var id = target.data( "ui-tooltip-id" );
+ return id ? this.tooltips[ id ] : null;
+ },
+
+ _removeTooltip: function( tooltip ) {
+ tooltip.remove();
+ delete this.tooltips[ tooltip.attr( "id" ) ];
+ },
+
+ _destroy: function() {
+ var that = this;
+
+ // close open tooltips
+ $.each( this.tooltips, function( id, tooltipData ) {
+ // Delegate to close method to handle common cleanup
+ var event = $.Event( "blur" ),
+ element = tooltipData.element;
+ event.target = event.currentTarget = element[ 0 ];
+ that.close( event, true );
+
+ // Remove immediately; destroying an open tooltip doesn't use the
+ // hide animation
+ $( "#" + id ).remove();
+
+ // Restore the title
+ if ( element.data( "ui-tooltip-title" ) ) {
+ // If the title attribute has changed since open(), don't restore
+ if ( !element.attr( "title" ) ) {
+ element.attr( "title", element.data( "ui-tooltip-title" ) );
+ }
+ element.removeData( "ui-tooltip-title" );
+ }
+ });
+ this.liveRegion.remove();
+ }
+});
+
+
+
+})); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery.mask.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery.mask.min.js
new file mode 100644
index 00000000..984b5b02
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery.mask.min.js
@@ -0,0 +1,12 @@
+// jQuery Mask Plugin v1.7.7
+// github.com/igorescobar/jQuery-Mask-Plugin
+(function(f){"function"===typeof define&&define.amd?define(["jquery"],f):f(window.jQuery||window.Zepto)})(function(f){var A=function(a,d,b){var h=this,m,p;a=f(a);d="function"===typeof d?d(a.val(),void 0,a,b):d;var c={getCaret:function(){try{var e,l=0,c=a.get(0),g=document.selection,d=c.selectionStart;if(g&&!~navigator.appVersion.indexOf("MSIE 10"))e=g.createRange(),e.moveStart("character",a.is("input")?-a.val().length:-a.text().length),l=e.text.length;else if(d||"0"===d)l=d;return l}catch(b){}},setCaret:function(e){try{if(a.is(":focus")){var l,
+c=a.get(0);c.setSelectionRange?c.setSelectionRange(e,e):c.createTextRange&&(l=c.createTextRange(),l.collapse(!0),l.moveEnd("character",e),l.moveStart("character",e),l.select())}}catch(g){}},events:function(){a.on("keydown.mask",function(){m=c.val()}).on("keyup.mask",c.behaviour).on("paste.mask drop.mask",function(){setTimeout(function(){a.keydown().keyup()},100)}).on("change.mask",function(){a.data("changed",!0)}).on("blur.mask",function(){m===a.val()||a.data("changed")||a.trigger("change");a.data("changed",
+!1)}).on("focusout.mask",function(){b.clearIfNotMatch&&!p.test(c.val())&&c.val("")})},getRegexMask:function(){for(var e=[],a,c,g,b,k=0;k<d.length;k++)(a=h.translation[d[k]])?(c=a.pattern.toString().replace(/.{1}$|^.{1}/g,""),g=a.optional,(a=a.recursive)?(e.push(d[k]),b={digit:d[k],pattern:c}):e.push(g||a?c+"?":c)):e.push(d[k].replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"));e=e.join("");b&&(e=e.replace(new RegExp("("+b.digit+"(.*"+b.digit+")?)"),"($1)?").replace(new RegExp(b.digit,"g"),b.pattern));return new RegExp(e)},
+destroyEvents:function(){a.off("keydown keyup paste drop change blur focusout DOMNodeInserted ".split(" ").join(".mask ")).removeData("changeCalled")},val:function(e){var c=a.is("input");return 0<arguments.length?c?a.val(e):a.text(e):c?a.val():a.text()},getMCharsBeforeCount:function(e,a){for(var c=0,b=0,f=d.length;b<f&&b<e;b++)h.translation[d.charAt(b)]||(e=a?e+1:e,c++);return c},caretPos:function(e,a,b,g){return h.translation[d.charAt(Math.min(e-1,d.length-1))]?Math.min(e+b-a-g,b):c.caretPos(e+1,
+a,b,g)},behaviour:function(a){a=a||window.event;var b=a.keyCode||a.which;if(-1===f.inArray(b,h.byPassKeys)){var d=c.getCaret(),g=c.val(),t=g.length,k=d<t,m=c.getMasked(),n=m.length,p=c.getMCharsBeforeCount(n-1)-c.getMCharsBeforeCount(t-1);m!==g&&c.val(m);!k||65===b&&a.ctrlKey||(8!==b&&46!==b&&(d=c.caretPos(d,t,n,p)),c.setCaret(d));return c.callbacks(a)}},getMasked:function(a){var l=[],f=c.val(),g=0,m=d.length,k=0,p=f.length,n=1,u="push",r=-1,q,v;b.reverse?(u="unshift",n=-1,q=0,g=m-1,k=p-1,v=function(){return-1<
+g&&-1<k}):(q=m-1,v=function(){return g<m&&k<p});for(;v();){var w=d.charAt(g),x=f.charAt(k),s=h.translation[w];if(s)x.match(s.pattern)?(l[u](x),s.recursive&&(-1===r?r=g:g===q&&(g=r-n),q===r&&(g-=n)),g+=n):s.optional&&(g+=n,k-=n),k+=n;else{if(!a)l[u](w);x===w&&(k+=n);g+=n}}a=d.charAt(q);m!==p+1||h.translation[a]||l.push(a);return l.join("")},callbacks:function(e){var f=c.val(),h=f!==m;if(!0===h&&"function"===typeof b.onChange)b.onChange(f,e,a,b);if(!0===h&&"function"===typeof b.onKeyPress)b.onKeyPress(f,
+e,a,b);if("function"===typeof b.onComplete&&f.length===d.length)b.onComplete(f,e,a,b)}};h.mask=d;h.options=b;h.remove=function(){var b;c.destroyEvents();c.val(h.getCleanVal()).removeAttr("maxlength");b=c.getCaret();c.setCaret(b-c.getMCharsBeforeCount(b));return a};h.getCleanVal=function(){return c.getMasked(!0)};h.init=function(){b=b||{};h.byPassKeys=[9,16,17,18,36,37,38,39,40,91];h.translation={0:{pattern:/\d/},9:{pattern:/\d/,optional:!0},"#":{pattern:/\d/,recursive:!0},A:{pattern:/[a-zA-Z0-9]/},
+S:{pattern:/[a-zA-Z]/}};h.translation=f.extend({},h.translation,b.translation);h=f.extend(!0,{},h,b);p=c.getRegexMask();!1!==b.maxlength&&a.attr("maxlength",d.length);b.placeholder&&a.attr("placeholder",b.placeholder);a.attr("autocomplete","off");c.destroyEvents();c.events();var e=c.getCaret();c.val(c.getMasked());c.setCaret(e+c.getMCharsBeforeCount(e,!0))}()},y={},z=function(){var a=f(this),d={};a.attr("data-mask-reverse")&&(d.reverse=!0);"false"===a.attr("data-mask-maxlength")&&(d.maxlength=!1);
+a.attr("data-mask-clearifnotmatch")&&(d.clearIfNotMatch=!0);a.mask(a.attr("data-mask"),d)};f.fn.mask=function(a,d){var b=this.selector,h=function(){var b=f(this).data("mask"),h=JSON.stringify;if("object"!==typeof b||h(b.options)!==h(d)||b.mask!==a)return f(this).data("mask",new A(this,a,d))};this.each(h);b&&!y[b]&&(y[b]=!0,setTimeout(function(){f(document).on("DOMNodeInserted.mask",b,h)},500))};f.fn.unmask=function(){try{return this.each(function(){f(this).data("mask").remove().removeData("mask")})}catch(a){}};
+f.fn.cleanVal=function(){return this.data("mask").getCleanVal()};f("*[data-mask]").each(z);f(document).on("DOMNodeInserted.mask","*[data-mask]",z)});
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/js/modalService.js b/ecomp-sdk/sdk-app/src/main/webapp/static/js/modalService.js
new file mode 100644
index 00000000..69f01f42
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/js/modalService.js
@@ -0,0 +1,169 @@
+angular.module("modalServices",[]).service('modalService', ['$modal', function ($modal) {
+
+
+ this.showSuccess = function(heading, messageBody){
+ var modalInstance = $modal.open({
+ templateUrl: 'modal_informative.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ $(".overlayed").css("display","none");
+ $(".loadingId").css("display","none");
+ var message = {
+ title: heading,
+ text: messageBody
+ };
+ return message;
+ }
+ }
+ });
+ };
+ this.showFailure = function(heading, messageBody){
+ var modalInstance = $modal.open({
+ templateUrl: 'modal_warning.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: heading,
+ text: messageBody
+ };
+ return message;
+ }
+ }
+ });
+ };
+
+ this.showWarning = function(heading, messageBody){
+ var modalInstance = $modal.open({
+ templateUrl: 'modal_warning_message.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: heading,
+ text: messageBody
+ };
+ return message;
+ }
+ }
+ });
+ };
+
+ this.popupConfirmWin = function(title, msgBody, callback,dismissCallback){
+ var modalInstance = $modal.open({
+ templateUrl: 'confirmation_informative.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: title,
+ text: msgBody
+ };
+ return message;
+ }
+ }
+ });
+ var args = Array.prototype.slice.call( arguments, 0 );
+ args.splice( 0, 3);
+ modalInstance.result.then(function(){
+ callback.apply(null, args);
+ }, function() {
+ })['finally'](function(){
+ modalInstance = undefined;
+ });
+
+ };
+ this.popupConfirmWinWithCancel = function(title, msgBody, callback,dismissCallback){
+ var modalInstance = $modal.open({
+ templateUrl: 'confirmation_informative.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: title,
+ text: msgBody
+ };
+ return message;
+ }
+ }
+ });
+ var args = Array.prototype.slice.call( arguments, 0 );
+ args.splice( 0, 3);
+ modalInstance.result.then(function(){
+ callback.apply(null, args);
+ }, function() {
+ dismissCallback();
+ })['finally'](function(){
+ modalInstance = undefined;
+ });
+
+ };
+ this.popupDeleteConfirmWin = function(title, msgBody, callback, argForCallBack){
+ var modalInstance = $modal.open({
+ templateUrl: 'confirmation_for_delete.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: title,
+ text: msgBody
+ };
+ return message;
+ }
+ }
+ });
+
+ modalInstance.result.then(function(){
+ callback(argForCallBack);
+ }, function() {
+ })['finally'](function(){
+ modalInstance = undefined;
+ });
+
+ };
+
+ this.popupSuccessRedirectWin = function(title, msgBody, redirectUrl){
+ var modalInstance = $modal.open({
+ templateUrl: 'modal_informative.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: title,
+ text: msgBody
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function() {
+ }, function() {
+ window.location.href=redirectUrl;
+ })['finally'](function(){
+ modalInstance = undefined;
+ });
+ };
+
+ this.popupWarningRedirectWin = function(title, msgBody, redirectUrl){
+ var modalInstance = $modal.open({
+ templateUrl: 'modal_warning_message.html',
+ controller: 'modalpopupController',
+ resolve: {
+ message: function () {
+ var message = {
+ title: title,
+ text: msgBody
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function() {
+ }, function() {
+ window.location.href=redirectUrl;
+ })['finally'](function(){
+ modalInstance = undefined;
+ });
+ };
+ }]); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/js/search.js b/ecomp-sdk/sdk-app/src/main/webapp/static/js/search.js
new file mode 100644
index 00000000..70cb166b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/webapp/static/js/search.js
@@ -0,0 +1,829 @@
+
+
+
+ app.directive('afterRender', [ function() {
+ var def = {
+ restrict : 'A',
+ terminal : true,
+ transclude : false,
+ link : function(scope, element, attrs) {
+ if (attrs) { scope.$eval(attrs.afterRender) }
+ scope.$emit('onAfterRender')
+ }
+ };
+ return def;
+ }]);
+
+ app.directive("search", function() {
+ return {
+ // replace custom element with html5 markup
+ template: '<div >'
+ //+ '<c:set var="zeroidx" value="0" />'
+ + '<div ng-repeat="a in optionsSizeArray track by $index"> '
+ + '<div id="{{sId}}{{a}}" > '
+ + ' <div class="form-field form-field__glued pull-left size-onefourth" style=" width:25%;" >'
+ + ' <div att-search="options" ng-model="valueOptions[a]" placeholder="Select"></div> '
+ + ' </div> '
+ + ' <div class="form-field form-field__glued pull-left size-onefourth" style=" width:25%;"> '
+ + ' <div att-search="operators" ng-model="compareOptions[a]" placeholder="Select"></div> '
+ + ' </div> '
+ + ' <div class="form-field form-field__glued pull-left size-onefourth" style=" width:25%;">'
+ + ' <input ng-model="searchValue[a]" type="text" placeholder="What are you looking for?" style=" border-radius:0px 5px 5px 0px" > '
+ + ' </div> '
+ + ' <div class="form-field form-field__glued pull-left size-onefourth" style=" width:25%; padding-left:5px;"> '
+ + ' <button ng-click="remove(sId,a)" class="myzkBtn" >-</button>'
+ + ' <button ng-if="$index==0" ng-click="addSearch(sId,a,optionsSizeArray)" class="myzkBtn" >+</button> '
+ + ' <button ng-if="$index==0" ng-click="updateparent({filter: { valueOptions: valueOptions, compareOptions: compareOptions, searchValue : searchValue } })" class="myzkBtn" style="background-image:url(static/ebz/images/searchIcon.png); background-repeat: no-repeat; background-position: center;">&nbsp;</button>'
+ + ' </div>'
+ + ' </div> '
+ + '</div>'
+ + '</div> ' ,
+ replace: true,
+ // restrict usage to element only since we use attributes for APIs
+ restrict: 'EA',
+ require: 'ngModel',
+ // new isolate scope
+ scope: {
+ mSearch : '=ngModel'
+ ,updateparent: '&'
+ ,jsonForOption : '='
+ ,jsonForOperator : '='
+ ,searchId : '='
+ },
+ link: function(scope, iElement, iAttrs){
+ scope.optionsSizeArray = [];
+ scope.sId = '';
+ //scope.options = JSON.parse(JSON.stringify(iAttrs.jsonForOption));
+ //scope.operators = JSON.parse(iAttrs.operators);
+
+ scope.$watch("jsonForOption", function(newval, oldval) {
+ scope.options = JSON.parse(JSON.stringify(oldval));
+ console.log('1');
+ scope.evalRepeatIndex(scope.options.length);
+ console.log('2');
+
+ });
+
+ scope.evalRepeatIndex = function(size){
+ for(index = 0; index < size; index++) {
+ scope.optionsSizeArray.push(index);
+ }
+ };
+
+ scope.$watch("jsonForOperator", function(newval, oldval) {
+ scope.operators = JSON.parse(JSON.stringify(oldval));
+
+ });
+
+ if(getParameterByName("search")!=null && getParameterByName("search")!=''){
+ if((getParameterByName("location")!=null && getParameterByName("location")!='')){
+ scope.searchValue[0]=JSON.parse(JSON.stringify(getParameterByName("location")));
+ scope.valueOptions[0]={index:0,value:'Location Name',title:"Location Name",alias:'Location Name'};
+ scope.compareOptions[0]={index:1,value:'Contains',title:"Contains",alias:'Contains'};
+ }else if((getParameterByName("userLastName")!=null && getParameterByName("userLastName")!='')){
+ scope.searchValue[0]=JSON.parse(JSON.stringify(getParameterByName("userLastName")));
+ scope.valueOptions[0]= {index: 0, value: 'Last Name', title: 'Last Name', alias:'Last Name'};
+ scope.compareOptions[0]={index:1,value:'Contains',title:"Contains",alias:'Contains'};
+ }
+ }
+ scope.$watch("searchId", function(newval, oldval) {
+ scope.sId = oldval;
+ scope.hideDiv();
+ });
+
+ scope.showHide = function(div){
+ if(div != 0){
+ $("#s1").css('display', 'none');
+ }
+ return true;
+ };
+
+
+ scope.hideDiv = function(){
+ console.log('3');
+ console.log(scope.optionsSizeArray);
+
+
+ for (i = 1; i < scope.optionsSizeArray.length; i++) {
+ var element = "#"+scope.sId+i;
+ $(element).css('display', 'none');
+ }
+
+ console.log('4');
+
+ };
+
+
+ $(function() {
+ scope.hideDiv();
+ });
+
+ },
+
+ controller: function ($scope) {
+
+ $scope.addSearch = function(searchId, index, optionsLength){
+ console.log('5');
+
+ for(var i = 0; i<=optionsLength.length ;i++){
+ var element = "#"+searchId+i;
+ if($(element).css('display') == 'none'){
+ $(element).css('display', 'inline');
+ break;
+ }
+ };
+ console.log('6');
+
+ };
+
+ $scope.remove = function(searchId, index){
+ var remove = "#"+searchId+index;
+ if(index!=0)
+ $(remove).css("display", "none");
+ var v ={
+ index: 0,
+ value: '',
+ title: 'Select',
+ alias:''
+ };
+ $scope.valueOptions[index]=v;
+ $scope.compareOptions[index]=v;
+ $scope.searchValue[index]="";
+ };
+
+ $scope.search = function() {
+ var data = {
+ valueOptions : $scope.valueOptions,
+ compareOptions : $scope.compareOptions,
+ searchValue : $scope.searchValue
+ };
+ };
+
+ var data = {
+ valueOptions : $scope.valueOptions,
+ compareOptions : $scope.compareOptions,
+ searchValue : $scope.searchValue
+ };
+
+ $scope.mSearch = data;
+ $scope.valueOptions=[];
+ $scope.compareOptions=[];
+ $scope.searchValue=[];
+ }
+ }
+
+ });
+
+ app.directive('phoneNumberMask', [function(){
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ scope: {
+ ngModel : '='
+ },
+ link: function(scope, el, attrs){
+ scope.$watch(attrs.phoneNumberMask, function(newValue, oldValue) {
+
+ if(scope.ngModel)
+ scope.ngModel= scope.ngModel.replace(/(\+1)?(\d{3})(\d{3})(\d{4})/, '$2.$3.$4');
+ $(el).mask("999.999.9999");
+ });
+ scope.$watch("ngModel", function() {
+ var current = $(el).val();
+ if(scope.ngModel && /^(\+1)?\d{3,}$/.test(scope.ngModel))
+ scope.ngModel= scope.ngModel.replace(/(\+1)?(\d{3})(\d{3})(\d{4})/, '$2.$3.$4');
+
+ });
+ },
+ };
+ }]);
+
+ app.directive('allowOnlyNumber', [function(){
+ return {
+ require: 'ngModel',
+ link: function(scope, element, attrs, modelCtrl) {
+ modelCtrl.$parsers.push(function (inputValue) {
+ if (inputValue == undefined) return '';
+ var transformedInput = inputValue.replace(/[^0-9]/g, '');
+ if (transformedInput!=inputValue) {
+ modelCtrl.$setViewValue(transformedInput);
+ modelCtrl.$render();
+ }
+
+ return transformedInput;
+ });
+ }
+ };
+ }]);
+
+ app.directive('showProcessing', function(){
+ return {
+ restrict: 'A',
+ link: function(scope, elem, attrs) {
+ elem.bind('click', function() {
+ $(".overlayed").css("display","inline");
+ $(".loadingId").css("display","inline");
+ });
+ }
+ }
+ });
+
+app.directive("searchCriteria", function() {
+ return {
+ // replace custom element with html5 markup
+ template: '<div >'
+ + '<div ng-repeat="a in searchCriterion track by $index" ng-show="isShown[$index]"> '
+ + ' <div class="form-field form-field__glued form-field__square size-onefourth left_round_border">'
+ + ' <div att-search="availableOptions[$index]" ng-model="valueOptions[$index]"></div> '
+ + ' </div> '
+ + ' <div class="form-field form-field__glued form-field__square size-onefourth"> '
+ + ' <div att-search="availableOperators[$index]" ng-model="compareOptions[$index]" > </div> '
+ + ' </div> '
+ + ' <div class="form-field form-field__glued form-field__square size-onefourth right_round_border">'
+ + ' <input ng-show="!availableValues[$index] || availableValues[$index].length===0" ng-model="searchValue[$index]" type="text" placeholder="What are you looking for?" class="fn-ebz-text" style="width:100%;" > '
+ + ' <div ng-show="availableValues[$index] && availableValues[$index].length!==0" att-search="availableValues[$index]" ng-model="searchValue[$index]"></div> '
+ + ' </div> '
+ + ' <div class="form-field form-field__glued form-field__square size-onefourth" style=" padding-left:5px;" > '
+ + ' <button ng-show="$index!=0" ng-click="removeSearchCriteria($index)" class="myzkBtn">-</button>'
+ + ' <button ng-show="$index==0" ng-click="addSearchCriteria($index)" class="myzkBtn">+</button> '
+ + ' <button ng-show="$index==0" ng-click="search()" class="myzkBtn" style="background-image:url(static/ebz/images/searchIcon.png); background-repeat: no-repeat; background-position: center;">&nbsp;</button>'
+ + ' </div>'
+ + ' </div> '
+ + '</div> ' ,
+ replace: true,
+ // restrict usage to element only since we use attributes for APIs
+ restrict: 'EA',
+ require: 'ngModel',
+ // new isolate scope
+ scope: {
+ mSearch : '=ngModel',
+ updateparent: '&'
+ ,options : '=jsonForOption'
+ ,operators : '=jsonForOperator'
+ },
+
+ controller: function ($scope) {
+ $scope.isShown = [true];
+ $scope.searchCriterion = [];
+ $scope.valueOptions=[];
+ $scope.compareOptions=[];
+ $scope.searchValue=[];
+ $scope.availableOperators=[];
+ $scope.availableValues=[];
+ $scope.availableOptions = [];
+ //init
+ $scope.insertEmptyOption = function(arr){
+ var hasEmpty = false;
+ $.each(arr, function(i, a){
+ if(a.value ===''){
+ hasEmpty = true;
+ }
+ });
+ if(!hasEmpty){
+ $.each(arr, function(i, a){
+ a.index +=1;
+ });
+ arr.unshift({index: 0, value: '', title: 'Select', alias:'Select'});
+ }
+ };
+ $scope.findFirstOption = function(arr){
+
+ };
+ $scope.insertEmptyOption($scope.options);
+ $scope.insertEmptyOption($scope.operators);
+
+ for(var i = 0, l= $scope.options.length; i<l; i++) {
+ var option= $scope.options[i];
+ var n = option.maxOccurs;
+ if(option.value!==''){
+ if(n && Number(n)===n && n%1===0){ //maxOccurs is specified
+ for(var j=0; j<n; j++){
+ $scope.searchCriterion.push("");
+ $scope.availableOperators.push($scope.operators);
+ var valueArr = [];
+ $scope.availableValues.push(valueArr);
+ $scope.availableOptions.push($scope.options);
+ $scope.isShown.push(false);
+ }
+ }else{
+ $scope.searchCriterion.push("");
+ $scope.availableOperators.push($scope.operators);
+ var valueArr = [];
+ $scope.availableValues.push(valueArr);
+ $scope.availableOptions.push($scope.options);
+ $scope.isShown.push(false);
+ }
+ }
+ }
+ $scope.isShown.pop();
+
+ $scope.updateAvailableOptions = function(index, isFirst){
+ var selectedOptions = [];//{value:'name', occurs: }
+ if($scope.options && $scope.options.length > 0){
+ $.each($scope.valueOptions, function(i, a){
+ if(a){
+ var v = a.value;
+ if(v){
+ var s= $.grep(selectedOptions, function(e){ return e.value === v });
+
+ if(s.length ===1){
+ s[0].occurs += 1;
+ }else{
+ selectedOptions.push({value: v, occurs:1});
+ }
+ }
+ var o= $.grep($scope.options, function(e){ return e.value === v });
+ if(o.length ===1){
+ if("operators" in o[0]){
+ $scope.availableOperators[i]=o[0].operators;
+ $scope.insertEmptyOption($scope.availableOperators[i]);
+ }else{
+ $scope.availableOperators[i]=$scope.operators;
+ }
+ if("values" in o[0]){
+ $scope.availableValues[i]=o[0].values;
+ }else{
+ $scope.availableValues[i]=[];
+ }
+ }
+ }
+ });
+ for(var j = 0 , l = $scope.availableOptions.length; j<l ; j++){
+ var newOptions = [];
+ var aoi = 0;
+ $.each($scope.options, function(i, a){
+ var s= $.grep(selectedOptions, function(e){ return e.value === a.value });
+ var maxOccurs = "maxOccurs" in a ? a.maxOccurs :1;
+ if(s.length > 0 && s[0].occurs >= maxOccurs && ($scope.valueOptions[j] && $scope.valueOptions[j].value !== s[0].value)){// reach limit
+ }else{
+ newOptions.push({index: aoi, value: a.value, title: a.title, alias:a.alias});
+ aoi += 1;
+ }
+ });
+ $scope.availableOptions[j] = newOptions;
+ if(isFirst){
+ if($scope.availableValues[j].length>0)
+ $scope.searchValue[j]= $scope.availableValues[j][0];
+ else
+ $scope.searchValue[j]="";
+
+ $scope.compareOptions[j]= $scope.availableOperators[j][0];
+ }
+ };
+
+ }
+ if(typeof index !== 'undefined' && !isFirst){
+ if($scope.availableValues[index].length>0)
+ $scope.searchValue[index]= $scope.availableValues[index][0];
+ else
+ $scope.searchValue[index]="";
+ }
+ };
+
+ $scope.updateAvailableOptions(undefined, true);
+ $.each($scope.availableOptions, function(j, a){
+ $scope.valueOptions[j]= a[0];
+ });
+ $scope.addSearchCriteria = function(index){
+ for(var i = 0 , l =$scope.isShown.length; i<l; i++ ){
+ if(!$scope.isShown[i]){
+ $scope.isShown[i]= true;
+ break;
+ }
+
+ }
+ };
+
+ $scope.removeSearchCriteria = function(index){
+ $scope.isShown[index]= false;
+
+
+ $scope.valueOptions[index]=$scope.availableOptions[index][0];
+ $scope.compareOptions[index]=$scope.availableOperators[index][0];
+ $scope.searchValue[index]="";
+ };
+ $scope.search = function() {
+ //remove empty criteria
+ var vo =[];
+ var co =[];
+ var sv =[];
+ for(var i = 0 , l=$scope.valueOptions.length; i<l ; i++){
+ if($scope.valueOptions[i].value==='' || $scope.compareOptions[i].value==='' ||(typeof $scope.searchValue[i] ==='string' && $scope.searchValue[i] ==='') || $scope.searchValue[i].value === ''){
+ }else{
+ vo.push($scope.valueOptions[i]);
+ co.push($scope.compareOptions[i]);
+ sv.push($scope.searchValue[i]);
+ }
+ }
+ $scope.updateparent({filter: { valueOptions: vo, compareOptions: co, searchValue :sv } });
+ };
+
+ $scope.$watchCollection("valueOptions", function(collection, oldValue ){
+ if(collection) {
+ var index;
+ for(var i = 0 , l =collection.length; i<l; i++ ){
+ if(!oldValue[i] || oldValue[i].value!=collection[i].value){
+ index = i;
+ break;
+ }
+
+ }
+ $scope.updateAvailableOptions(index);
+ }
+ }, true);
+
+ }
+ }
+
+ });
+
+ app.directive("selectUser", function() {
+ return {
+ // replace custom element with html5 markup
+ template: '<div> '
+ + '<table style="width:660px; margin-left:-12px;" >'
+ + '<thead>'
+ + ' <tr >'
+ + ' <th style="width:325px;">{{availableTitle}}</th> '
+ + ' <th style="width:10px;"></th> '
+ + ' <th style="width:325px;">{{userTitle}}</th> '
+ + '</tr>'
+ + '</thead>'
+ + '<tbody>'
+ + '<tr>'
+ + ' <td style="width:325px;">'
+ + ' <div class="ebz-listbox">'
+ + ' <label ng-repeat="canditateId in canditateIds track by canditateId.ociUserId" style="display:block;"> '
+ + ' <input type="checkbox" style="margin-top: 10px;" ng-model="canditateId.available" att-checkbox ng-change="checkCanditate($index)"/> {{canditateId.firstName}} {{canditateId.lastName}}({{canditateId.phone}})<br/>'
+ + ' </label>'
+ + ' </div>'
+ + '</td>'
+ + '<td valign="middle" width="10px">'
+ + ' <img src="static/images/rightarrow_g.png" id="removeBtn" ng-click="chooseSelected()" ng-hide="oneMax && chosenIds.length==1"/>'
+ + ' <img src="static/images/leftarrow_g.png" id="chooseBtn" ng-click="removeSelected()" ng-show="oneMax && chosenIds.length==1"/>'
+ + ' <br/><br/> '
+ + ' <img src="static/images/leftarrow_g.png" id="chooseBtn" ng-click="removeSelected()" ng-hide="oneMax"/>'
+ + ' <br/><br/>'
+ + ' <img id="chooseAllBtn" src="static/images/rightrightarrow_g.png" ng-click="chooseAll()" ng-hide="oneMax"/>'
+ + ' <br/><br/>'
+ + ' <img style="cursor:pointer" id="removeAllBtn" src="static/images/leftleftarrow_g.png" ng-click="removeAll()" ng-hide="oneMax"/>'
+ + '</td>'
+ + '<td style="width:325px;">'
+ + ' <div class="ebz-listbox" >'
+ + ' <label ng-repeat="chosenId in chosenIds" style="display:block;">'
+ + ' <input type="checkbox" style=" margin-top :10px;" att-checkbox ng-model="chosenId.available"/> {{chosenId.firstName}} {{chosenId.lastName}}({{chosenId.phone}})<br/>'
+ + ' </label>'
+ + ' </div>'
+ + '</td> '
+ + ' </tr>'
+ + '</tbody>'
+ + '</table>'
+ + '</div>',
+ replace: true,
+ // restrict usage to element only since we use attributes for APIs
+ restrict: 'EA',
+ // new isolate scope
+ scope: {
+ chosenIds : '=assignedUsers'
+ ,availableUsers : '='
+ ,userTitle : '='
+ ,availableTitle : '='
+ ,oneMax : '=?'
+ },
+ link: function(scope, iElement, attrs){
+
+ scope.$watch("userTitle", function(newval, oldval) {
+ scope.userTitle = newval;
+ });
+ scope.$watch("availableTitle", function(newval, oldval) {
+ scope.availableTitle = newval;
+ });
+
+ scope.$watch("availableUsers", function(newval, oldval) {
+ scope.availableUsers = newval;
+ scope.canditateIds= scope.getArrayRemoved(scope.availableUsers, scope.chosenIds);
+ });
+
+ },
+
+ controller: function ($scope) {
+ $scope.getArrayRemoved = function(from, removed){
+ var retArray = (from)? from:[];
+ if(retArray && retArray.length >0 && removed){
+ for(var i = 0, l = removed.length; i<l; i++ ){
+ retArray = $.grep(retArray, function(e){ return e.ociUserId !== removed[i].ociUserId; });
+ };
+ }
+ return retArray;
+ };
+ $scope.canditateIds= $scope.getArrayRemoved($scope.availableUsers, $scope.chosenIds);
+ $scope.chooseAll = function() {
+
+ var dataFromTableData = $scope.canditateIds;
+ for (var i = dataFromTableData.length - 1; i >= 0; i--){
+ if(!$scope.chosenIds)
+ $scope.chosenIds=[];
+ $scope.chosenIds.push(dataFromTableData[i]);
+ $scope.canditateIds.splice(i,1);
+
+ }
+ var dataFromChoosonTable = $scope.chosenIds;
+ for (var i = dataFromChoosonTable.length - 1; i >= 0; i--){
+ if(dataFromChoosonTable[i].available){
+ $scope.chosenIds[i].available=false;
+ }
+ }
+ };
+
+ $scope.removeAll = function() {
+ var dataFromTableData = $scope.chosenIds;
+ for (var i = dataFromTableData.length - 1; i >= 0; i--){
+ $scope.canditateIds.push(dataFromTableData[i]);
+ $scope.chosenIds.splice(i,1);
+
+ }
+ var dataFromChoosonTable = $scope.canditateIds;
+ for (var i = dataFromChoosonTable.length - 1; i >= 0; i--){
+ if(dataFromChoosonTable[i].available){
+ $scope.canditateIds[i].available=false;
+ }
+ }
+ };
+
+ $scope.chooseSelected = function() {
+
+ var dataFromTableData = $scope.canditateIds;
+
+ for (var i = dataFromTableData.length - 1; i >= 0; i--){
+
+ if(dataFromTableData[i].available){
+ if(!$scope.chosenIds)
+ $scope.chosenIds=[];
+ $scope.chosenIds.push(dataFromTableData[i]);
+ $scope.canditateIds.splice(i,1);
+
+ }
+ }
+ var dataFromChoosonTable = $scope.chosenIds;
+ for (var i = dataFromChoosonTable.length - 1; i >= 0; i--){
+ if(dataFromChoosonTable[i].available){
+ $scope.chosenIds[i].available=false;
+ }
+ }
+ };
+ $scope.removeSelected = function() {
+
+ var dataFromTableData = $scope.chosenIds;
+
+ for (var i = dataFromTableData.length - 1; i >= 0; i--){
+ if(dataFromTableData[i].available){
+ $scope.canditateIds.push(dataFromTableData[i]);
+ $scope.chosenIds.splice(i,1);
+
+ }
+ } ;
+ var dataFromChoosonTable = $scope.canditateIds;
+ for (var i = dataFromChoosonTable.length - 1; i >= 0; i--){
+ if(dataFromChoosonTable[i].available){
+ $scope.canditateIds[i].available=false;
+ }
+ }
+ };
+ $scope.checkCanditate = function(index) {
+ if($scope.oneMax){
+ for (var i = $scope.canditateIds.length - 1; i >= 0; i--){
+ if(i != index)
+ $scope.canditateIds[i].available=false;
+ }
+ }
+ };
+
+
+ }
+ }
+ });
+ app.directive("selectString", function() {
+ return {
+ // replace custom element with html5 markup
+ template: '<div> '
+ + '<table style="width:660px;">'
+ + '<thead>'
+ + ' <tr >'
+ + ' <th style="width:325px;">{{availableTitle}}</th> '
+ + ' <th style="width:10px;"></th> '
+ + ' <th style="width:325px;">{{assignedTitle}}</th> '
+ + '</tr>'
+ + '</thead>'
+ + '<tbody>'
+ + '<tr>'
+ + ' <td style="width:325px;">'
+ + ' <div class="ebz-listbox">'
+ + ' <label ng-repeat="canditateId in canditateIds track by $index" style="display:block;"> '
+ + ' <input type="checkbox" style="margin-top: 10px;" ng-model="canditateId.available" att-checkbox /> {{canditateId}}<br/>'
+ + ' </label>'
+ + ' </div>'
+ + '</td>'
+ + '<td valign="middle" width="10px">'
+ + ' <img src="static/images/rightarrow_g.png" id="removeBtn" ng-click="chooseSelected()" />'
+ + ' <br/><br/> '
+ + ' <img src="static/images/leftarrow_g.png" id="chooseBtn" ng-click="removeSelected()" />'
+ + ' <br/><br/>'
+ + ' <img id="chooseAllBtn" src="static/images/rightrightarrow_g.png" ng-click="chooseAll()" />'
+ + ' <br/><br/>'
+ + ' <img style="cursor:pointer" id="removeAllBtn" src="static/images/leftleftarrow_g.png" ng-click="removeAll()" />'
+ + '</td>'
+ + '<td style="width:325px;">'
+ + ' <div class="ebz-listbox" >'
+ + ' <label ng-repeat="chosenId in chosenIds" style="display:block;">'
+ + ' <input type="checkbox" style=" margin-top :10px;" att-checkbox ng-model="chosenId.available"/> {{chosenId}}<br/>'
+ + ' </label>'
+ + ' </div>'
+ + '</td> '
+ + ' </tr>'
+ + '</tbody>'
+ + '</table>'
+ + '</div>',
+ replace: true,
+ // restrict usage to element only since we use attributes for APIs
+ restrict: 'EA',
+ // new isolate scope
+ scope: {
+ chosenIds : '=assignedOptions'
+ ,availableOptions : '='
+ ,availableTitle : '@'
+ ,assignedTitle : '@'
+ },
+ link: function(scope, iElement, attrs){
+ scope.$watch("availableOptions", function(newval, oldval) {
+ scope.availableOptions = newval;
+ scope.canditateIds= scope.getArrayRemoved(scope.availableOptions, scope.chosenIds);
+ });
+
+ },
+
+ controller: function ($scope) {
+ $scope.getArrayRemoved = function(from, removed){
+ var retArray = (from)? from:[];
+ if(retArray && retArray.length >0 && removed){
+ for(var i = 0, l = removed.length; i<l; i++ ){
+ retArray = $.grep(retArray, function(e){ return e !== removed[i]; });
+ };
+ }
+ return retArray;
+ };
+
+ $scope.canditateIds= $scope.getArrayRemoved($scope.availableOptions, $scope.chosenIds);
+ $scope.chooseAll = function() {
+
+ var dataFromTableData = $scope.canditateIds;
+ for (var i = dataFromTableData.length - 1; i >= 0; i--){
+ if(!$scope.chosenIds)
+ $scope.chosenIds=[];
+ $scope.chosenIds.push(dataFromTableData[i]);
+ $scope.canditateIds.splice(i,1);
+
+ }
+ };
+
+ $scope.removeAll = function() {
+ var dataFromTableData = $scope.chosenIds;
+ for (var i = dataFromTableData.length - 1; i >= 0; i--){
+ $scope.canditateIds.push(dataFromTableData[i]);
+ $scope.chosenIds.splice(i,1);
+
+ }
+ };
+
+ $scope.chooseSelected = function() {
+
+ var dataFromTableData = $scope.canditateIds;
+
+ for (var i = dataFromTableData.length - 1; i >= 0; i--){
+
+ if(dataFromTableData[i].available){
+ if(!$scope.chosenIds)
+ $scope.chosenIds=[];
+ $scope.chosenIds.push(dataFromTableData[i]);
+ $scope.canditateIds.splice(i,1);
+
+ }
+ }
+ };
+ $scope.removeSelected = function() {
+
+ var dataFromTableData = $scope.chosenIds;
+
+ for (var i = dataFromTableData.length - 1; i >= 0; i--){
+ if(dataFromTableData[i].available){
+ $scope.canditateIds.push(dataFromTableData[i]);
+ $scope.chosenIds.splice(i,1);
+
+ }
+ } ;
+ };
+
+ }
+ }
+ });
+ function getParameterByName(name) {
+ name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
+ var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
+ results = regex.exec(location.search);
+ return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
+ };
+
+ app.directive("time", function() {
+ return {
+ // replace custom element with html5 markup
+ template: '<div style="height:80px; display:inline-block;"> '
+ + ' <input type="text" class="fn-ebz-text" ng-model="timeStr" placeholder="HH:MM" style="width:70px" ng-change="parseValue()"/>'
+ + ' <div class="form-field" att-select="ampmOptions" ng-model="ampm" style="width:70px" ng-change="parseValue()"></div>'
+ + ' </div>',
+ replace: true,
+ // restrict usage to element only since we use attributes for APIs
+ restrict: 'EA',
+ // new isolate scope
+ scope: {
+ value : '='
+ ,validTime : '=?'
+ },
+ link: function(scope, iElement, attrs){
+ },
+
+ controller: function ($scope) {
+ $scope.timeStr='';
+ $scope.ampm=null;
+ var am ={index: 0, value: 'AM', title: 'AM', alias:'Name2'};
+ var pm = {index: 1, value: 'PM', title: 'PM', alias:'Name'};
+ $scope.ampmOptions=[
+ am,
+ pm,
+ ]
+ $scope.parseTimeStr= function(str){
+ if(str){
+ try{
+ var date;
+ if(/^(\d*):(\d*)$/.test(str)){
+ var hh = Number(str.match(/^(\d+)/)[1]);
+ var mm = Number(str.match(/:(\d+)/)[1]);
+ date = new Date(1970, 0, 1, hh, mm, 0);
+ }else{
+ date = new Date(str);
+ }
+ var hours = date.getHours();
+ var minutes = date.getMinutes();
+ var ampm = hours >= 12 ?pm : am;
+ hours = hours % 12;
+ hours = hours ? hours : 12; // the hour '0' should be '12'
+ minutes = minutes < 10 ? '0'+minutes : minutes;
+ hours = hours < 10 ? '0'+hours : hours;
+ var strTime = hours + ':' + minutes ;
+
+
+ $scope.timeStr =strTime;
+ $scope.ampm = ampm;
+ if (typeof $scope.validTime != 'undefined'){
+ $scope.validTime=true;
+ }
+ }catch(err){
+ if (typeof $scope.validTime != 'undefined'){
+ $scope.validTime=false;
+ }
+ }
+ }else{
+ $scope.timeStr = "12:00";
+ $scope.ampm =am;
+ }
+ };
+ $scope.parseTimeStr($scope.value);
+ $scope.parseValue = function(){
+ try{
+ var date;
+ var hh = Number($scope.timeStr.match(/^(\d+)/)[1]);
+ var mm = Number($scope.timeStr.match(/:(\d+)/)[1]);
+
+ if(hh<=12 && hh>0 && mm>=0 && mm<=59){
+
+ if($scope.ampm.value=='PM'&& hh<12) hh = hh+12;
+ if($scope.ampm.value=='AM'&& hh==12) hh = hh-12;
+ mm = mm < 10 ? '0'+mm : mm;
+ hh = hh < 10 ? '0'+hh : hh;
+ $scope.value= hh+":"+mm;
+ if (typeof $scope.validTime != 'undefined'){
+ $scope.validTime=true;
+ }
+ }else{
+ if (typeof $scope.validTime != 'undefined'){
+ $scope.validTime=false;
+ }
+ }
+
+ }catch(err){
+ if (typeof $scope.validTime != 'undefined'){
+ $scope.validTime=false;
+ }
+ }
+ };
+ }
+ }
+ }); \ No newline at end of file
diff --git a/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/SanityTest.java b/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/SanityTest.java
new file mode 100644
index 00000000..d455b843
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/SanityTest.java
@@ -0,0 +1,20 @@
+package org.openecomp.portalapp;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.portalsdk.core.MockApplicationContextTestSuite;
+import org.springframework.test.web.servlet.ResultActions;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+
+public class SanityTest extends MockApplicationContextTestSuite {
+
+ @Test
+ public void testGetAvailableRoles() throws Exception {
+
+ ResultActions ra =getMockMvc().perform(MockMvcRequestBuilders.get("/api/roles"));
+ //Assert.assertEquals(UrlAccessRestrictedException.class,ra.andReturn().getResolvedException().getClass());
+ Assert.assertEquals("application/json",ra.andReturn().getResponse().getContentType());
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/controller/CollaborationControllerTest.java b/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/controller/CollaborationControllerTest.java
new file mode 100644
index 00000000..099cf518
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/controller/CollaborationControllerTest.java
@@ -0,0 +1,27 @@
+package org.openecomp.portalapp.controller;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.portalsdk.core.MockApplicationContextTestSuite;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.test.web.servlet.ResultActions;
+import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+
+public class CollaborationControllerTest extends MockApplicationContextTestSuite{
+
+ @Test
+ public void testGetAvailableRoles() throws Exception {
+ MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/collaborate_list");
+ User user = new User();
+ user.setId(1l);
+ user.setOrgUserId("abc");
+ requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
+
+ ResultActions ra =getMockMvc().perform(requestBuilder);
+ Assert.assertEquals(2,ra.andReturn().getModelAndView().getModelMap().size());
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/controller/NetMapTest.java b/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/controller/NetMapTest.java
new file mode 100644
index 00000000..4622f66e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/controller/NetMapTest.java
@@ -0,0 +1,19 @@
+package org.openecomp.portalapp.controller;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.portalsdk.core.MockApplicationContextTestSuite;
+import org.springframework.test.web.servlet.ResultActions;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+
+public class NetMapTest extends MockApplicationContextTestSuite {
+
+ @Test
+ public void testGetNetMap() throws Exception {
+ ResultActions ra =getMockMvc().perform(MockMvcRequestBuilders.get("/net_map"));
+ //Assert.assertEquals(UrlAccessRestrictedException.class,ra.andReturn().getResolvedException().getClass());
+ Assert.assertEquals("net_map_int",ra.andReturn().getModelAndView().getModel().get("frame_int"));
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/service/ProfileServiceTest.java b/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/service/ProfileServiceTest.java
new file mode 100644
index 00000000..f7f30fe5
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/service/ProfileServiceTest.java
@@ -0,0 +1,37 @@
+package org.openecomp.portalapp.service;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.portalsdk.core.MockApplicationContextTestSuite;
+import org.openecomp.portalsdk.core.domain.Profile;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.service.ProfileService;
+import org.openecomp.portalsdk.core.service.UserProfileService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public class ProfileServiceTest extends MockApplicationContextTestSuite {
+
+ @Autowired
+ ProfileService service;
+
+ @Autowired
+ UserProfileService userProfileService;
+
+ @Test
+ public void testFindAll() {
+
+ List<Profile> profiles = service.findAll();
+ Assert.assertTrue(profiles.size() > 0);
+ }
+
+ @Test
+ public void testFindAllActive() {
+
+ List<User> users = userProfileService.findAllActive();
+ List<User> activeUsers = userProfileService.findAllActive();
+ Assert.assertTrue(users.size() - activeUsers.size() >= 0);
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalsdk/core/MockApplicationContextTestSuite.java b/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalsdk/core/MockApplicationContextTestSuite.java
new file mode 100644
index 00000000..1bafe203
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalsdk/core/MockApplicationContextTestSuite.java
@@ -0,0 +1,126 @@
+package org.openecomp.portalsdk.core;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.openecomp.portalsdk.core.conf.AppConfig;
+import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager;
+import org.openecomp.portalsdk.core.util.CacheManager;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.AnnotationConfigWebContextLoader;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+
+/**
+ *
+ *
+ *
+ * In order to write a unit test,
+ * 1. inherit this class - See SanityTest.java
+ * 2. place the "war" folder on your test class's classpath
+ * 3. run the test with the following VM argument; This is important because when starting the application from Container, the System Properties file (SystemProperties.java) can have the direct path
+ * but, when running from the Mock Junit container, the path should be prefixed with "classpath" to enable the mock container to search for the file in the classpath
+ * -Dcontainer.classpath="classpath:"
+ *
+ */
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@WebAppConfiguration
+@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = {MockAppConfig.class})
+@ActiveProfiles(value="test")
+public class MockApplicationContextTestSuite {
+
+ @Autowired
+ public WebApplicationContext wac;
+
+ private MockMvc mockMvc;
+
+ @Before
+ public void setup() {
+ if(mockMvc == null) {
+ this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
+
+ }
+ }
+
+ public Object getBean(String name) {
+ return this.wac.getBean(name);
+ }
+
+
+ public MockMvc getMockMvc() {
+ return mockMvc;
+ }
+
+ public void setMockMvc(MockMvc mockMvc) {
+ this.mockMvc = mockMvc;
+ }
+
+ public WebApplicationContext getWebApplicationContext() {
+ return wac;
+ }
+
+
+
+
+}
+
+
+ @Configuration
+ @ComponentScan(basePackages = "org.openecomp",
+ excludeFilters = {
+
+ }
+ )
+ @Profile("test")
+ class MockAppConfig extends AppConfig {
+
+ @Bean
+ public SystemProperties systemProperties(){
+ return new MockSystemProperties();
+ }
+
+ @Bean
+ public AbstractCacheManager cacheManager() {
+ return new CacheManager() {
+
+ public void configure() throws IOException {
+
+ }
+ };
+ }
+
+ protected String[] tileDefinitions() {
+ return new String[] {"classpath:/WEB-INF/fusion/defs/definitions.xml", "classpath:/WEB-INF/defs/definitions.xml"};
+ }
+
+ @Override
+ public void addInterceptors(InterceptorRegistry registry) {
+ //registry.addInterceptor(new SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout());
+ //registry.addInterceptor(resourceInterceptor());
+ }
+
+ public static class MockSystemProperties extends SystemProperties {
+
+ public MockSystemProperties() {
+ }
+
+ }
+
+ }
+
+
+
+
diff --git a/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleServiceTest.java b/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleServiceTest.java
new file mode 100644
index 00000000..584bad78
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleServiceTest.java
@@ -0,0 +1,41 @@
+package org.openecomp.portalsdk.workflow.services;
+
+import java.util.Calendar;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.portalsdk.core.MockApplicationContextTestSuite;
+import org.openecomp.portalsdk.workflow.domain.WorkflowSchedule;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class WorkflowScheduleServiceTest extends MockApplicationContextTestSuite {
+
+ @Autowired
+ WorkflowScheduleService service;
+// @Autowired
+// SchedulerFactoryBean schedulerBean;
+
+ @Test
+ public void testFire() {
+
+ // List<WorkflowSchedule> wfs = service.findAll();
+
+ final WorkflowSchedule ws = new WorkflowSchedule();
+ ws.setId(999L);
+ ws.setWorkflowKey("test");
+ ws.setCronDetails("0 38 13 3 5 ? 2016");
+ final Calendar instance = Calendar.getInstance();
+ instance.add(Calendar.YEAR, 3);
+ ws.setEndDateTime(instance.getTime());
+
+ ws.setStartDateTime(Calendar.getInstance().getTime());
+ try{
+ service.saveWorkflowSchedule(ws);
+ Assert.assertTrue(true);
+ } catch(Exception e) {
+ Assert.fail(e.getMessage());
+ }
+
+ }
+
+}
diff --git a/ecomp-sdk/sdk-workflow/.gitignore b/ecomp-sdk/sdk-workflow/.gitignore
new file mode 100644
index 00000000..b83d2226
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/ecomp-sdk/sdk-workflow/README.md b/ecomp-sdk/sdk-workflow/README.md
new file mode 100644
index 00000000..d144d21c
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/README.md
@@ -0,0 +1,7 @@
+ECOMP Portal SDK Workflow
+=========================
+
+This is the Maven project for the ECOMP Portal SDK Workflow,
+which is distributed as ecompSDK-workflow-nnn.jar. This library
+requires Hibernate and Spring, and provides features including
+schedulers, workflows and R Cloud integration.
diff --git a/ecomp-sdk/sdk-workflow/pom.xml b/ecomp-sdk/sdk-workflow/pom.xml
new file mode 100644
index 00000000..696f81bf
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/pom.xml
@@ -0,0 +1,111 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>ecompSDK-project</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <artifactId>ecompSDK-workflow</artifactId>
+ <name>Ecomp Portal SDK Workflow</name>
+ <description>Provides workflow features for SDK applications</description>
+ <packaging>jar</packaging>
+
+ <!-- repositories are inherited from parent -->
+
+ <dependencies>
+ <!-- sdk-core -->
+ <dependency>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>ecompSDK-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>${hibernate.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>5.1.3.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>20160212</version>
+ </dependency>
+ <dependency>
+ <groupId>org.quartz-scheduler</groupId>
+ <artifactId>quartz</artifactId>
+ <version>2.2.1</version>
+ <exclusions>
+ <!-- exclude 0.9.1.1 to avoid dupe of com.mchange:c3p0:0.9.2.1 -->
+ <exclusion>
+ <groupId>c3p0</groupId>
+ <artifactId>c3p0</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- bridge to implement commons-logging using slf4j -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>1.7.12</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${springframework.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/NotebookController.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/NotebookController.java
new file mode 100644
index 00000000..037e80d5
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/NotebookController.java
@@ -0,0 +1,54 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.rnotebookintegration.controller;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.controller.CollaborateListController;
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.UserProfileService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+@RequestMapping("/")
+public class NotebookController extends RestrictedBaseController{
+ @Autowired
+ UserProfileService service;
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CollaborateListController.class);
+
+ @RequestMapping(value = {"/notebook" }, method = RequestMethod.GET)
+ public ModelAndView noteBook(HttpServletRequest request) {
+
+ try {
+
+ } catch (Exception e) {
+
+
+ }
+ return new ModelAndView(getViewName());
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/NotebookTestController.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/NotebookTestController.java
new file mode 100644
index 00000000..74d1ae51
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/NotebookTestController.java
@@ -0,0 +1,56 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+
+
+package org.openecomp.portalsdk.rnotebookintegration.controller;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.controller.CollaborateListController;
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.UserProfileService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+@RequestMapping("/")
+public class NotebookTestController extends RestrictedBaseController{
+ @Autowired
+ UserProfileService service;
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CollaborateListController.class);
+
+ @RequestMapping(value = {"/nbooktest" }, method = RequestMethod.GET)
+ public ModelAndView noteBook(HttpServletRequest request) {
+
+ try {
+
+ } catch (Exception e) {
+
+
+ }
+ return new ModelAndView(getViewName());
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/RNoteBookController.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/RNoteBookController.java
new file mode 100644
index 00000000..a53b0573
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/RNoteBookController.java
@@ -0,0 +1,84 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.rnotebookintegration.controller;
+
+import org.openecomp.portalsdk.core.controller.RestrictedRESTfulBaseController;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.openecomp.portalsdk.rnotebookintegration.exception.RNotebookIntegrationException;
+import org.openecomp.portalsdk.rnotebookintegration.service.RNoteBookIntegrationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@Controller
+@RequestMapping("/rNotebook/")
+
+public class RNoteBookController extends RestrictedRESTfulBaseController {
+
+ @Autowired
+ private RNoteBookIntegrationService rNoteBookIntegrationService;
+
+
+
+ public RNoteBookIntegrationService getrNoteBookIntegrationService() {
+ return rNoteBookIntegrationService;
+ }
+
+
+
+ public void setrNoteBookIntegrationService(
+ RNoteBookIntegrationService rNoteBookIntegrationService) {
+ this.rNoteBookIntegrationService = rNoteBookIntegrationService;
+ }
+
+
+
+ @RequestMapping(value = { "authCr" }, method = RequestMethod.GET, produces = "application/json")
+ public @ResponseBody ResponseEntity<String> getRNotebookCredentials (String token) throws Exception {
+ //ObjectMapper mapper = new ObjectMapper();
+ //mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ //JsonNode root = mapper.readTree(request.getReader());
+ //String token = root.get("authenticationToken").textValue();
+
+ String returnJSON = "";
+ try{
+ returnJSON = this.getrNoteBookIntegrationService().getRNotebookCredentials(token);
+ } catch(RNotebookIntegrationException re){
+ if (re.getErrorCode().equals(RNotebookIntegrationException.ERROR_CODE_TOKEN_EXPIRED)){
+ return new ResponseEntity<String>(JsonMessage.buildJsonResponse(false, re.getMessage()), HttpStatus.BAD_REQUEST);
+ }
+ else {
+ return new ResponseEntity<String>(JsonMessage.buildJsonResponse(false, re.getMessage()), HttpStatus.BAD_REQUEST);
+ }
+ }
+ catch (Exception e){
+ return new ResponseEntity<String>(JsonMessage.buildJsonResponse(false, e.getMessage()), HttpStatus.BAD_REQUEST);
+ }
+
+ return new ResponseEntity<String>(returnJSON, HttpStatus.OK);
+
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/RNoteBookFEController.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/RNoteBookFEController.java
new file mode 100644
index 00000000..3b0fcc49
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/RNoteBookFEController.java
@@ -0,0 +1,113 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.rnotebookintegration.controller;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.restful.domain.EcompUser;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.openecomp.portalsdk.rnotebookintegration.exception.RNotebookIntegrationException;
+import org.openecomp.portalsdk.rnotebookintegration.service.RNoteBookIntegrationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@Controller
+@RequestMapping("/rNotebookFE/")
+public class RNoteBookFEController extends RestrictedBaseController {
+ @Autowired
+ private RNoteBookIntegrationService rNoteBookIntegrationService;
+
+
+
+ public RNoteBookIntegrationService getrNoteBookIntegrationService() {
+ return rNoteBookIntegrationService;
+ }
+
+
+
+ public void setrNoteBookIntegrationService(
+ RNoteBookIntegrationService rNoteBookIntegrationService) {
+ this.rNoteBookIntegrationService = rNoteBookIntegrationService;
+ }
+
+ @RequestMapping(value = { "authCr" }, method = RequestMethod.POST, produces = "application/json")
+ public @ResponseBody ResponseEntity<String> saveRNotebookCredentials (@RequestBody String notebookId, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ //ObjectMapper mapper = new ObjectMapper();
+ //mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ //JsonNode root = mapper.readTree(request.getReader());
+ //String token = root.get("authenticationToken").textValue();
+ System.out.println("Notebook id "+notebookId);
+ System.out.println("Query parameters "+request.getParameter("qparams"));
+ String retUrl = "";
+ try{
+
+ User user = UserUtils.getUserSession(request);
+ user = (User) this.getDataAccessService().getDomainObject(User.class, user.getId(), null);
+
+ EcompUser ecUser =UserUtils.convertToEcompUser(user);
+
+ HashMap<String, String> map = new HashMap<String, String>();
+ JSONObject jObject = new JSONObject(request.getParameter("qparams"));
+ Iterator<?> keys = jObject.keys();
+
+ while( keys.hasNext() ){
+ String key = (String)keys.next();
+ String value = jObject.getString(key);
+ map.put(key, value);
+
+ }
+
+ System.out.println("json : "+jObject);
+ System.out.println("map : "+map);
+
+ // String token = this.getrNoteBookIntegrationService().saveRNotebookCredentials(notebookId, ecUser, new HashMap<String, String>());
+ String token = this.getrNoteBookIntegrationService().saveRNotebookCredentials(notebookId, ecUser, map);
+
+ String guard = SystemProperties.getProperty("guard_notebook_url");
+
+ retUrl = guard + "id=" + token;
+
+
+ } catch (RNotebookIntegrationException re){
+ return new ResponseEntity<String>(re.getMessage(), HttpStatus.BAD_REQUEST);
+ } catch (Exception e){
+ return new ResponseEntity<String>(e.getMessage(), HttpStatus.BAD_REQUEST);
+ }
+
+ return new ResponseEntity<String>(retUrl, HttpStatus.OK);
+
+ }
+
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/domain/RNoteBookCredentials.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/domain/RNoteBookCredentials.java
new file mode 100644
index 00000000..9298c5a2
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/domain/RNoteBookCredentials.java
@@ -0,0 +1,93 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.rnotebookintegration.domain;
+
+import java.util.Date;
+import java.util.Map;
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+import org.openecomp.portalsdk.core.restful.domain.EcompUser;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+public class RNoteBookCredentials extends DomainVo {
+ private EcompUser userInfo;
+ private String token;
+ private Date createdDate;
+ private String notebookID;
+ private Map<String, String> parameters;
+ private Date tokenReadDate;
+ @JsonIgnore
+ private String userString;
+ @JsonIgnore
+ private String parametersString;
+
+ public String getToken() {
+ return token;
+ }
+ public void setToken(String token) {
+ this.token = token;
+ }
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+ public String getNotebookID() {
+ return notebookID;
+ }
+ public EcompUser getUserInfo() {
+ return userInfo;
+ }
+ public void setUserInfo(EcompUser userInfo) {
+ this.userInfo = userInfo;
+ }
+ public void setNotebookID(String notebookID) {
+ this.notebookID = notebookID;
+ }
+ public String getUserString() {
+ return userString;
+ }
+ public void setUserString(String userString) {
+ this.userString = userString;
+ }
+ public Map<String, String> getParameters() {
+ return parameters;
+ }
+ public void setParameters(Map<String, String> parameters) {
+ this.parameters = parameters;
+ }
+ public String getParametersString() {
+ return parametersString;
+ }
+ public void setParametersString(String parametersString) {
+ this.parametersString = parametersString;
+ }
+ public Date getTokenReadDate() {
+ return tokenReadDate;
+ }
+ public void setTokenReadDate(Date tokenReadDate) {
+ this.tokenReadDate = tokenReadDate;
+ }
+
+
+
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/exception/RNotebookIntegrationException.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/exception/RNotebookIntegrationException.java
new file mode 100644
index 00000000..b2742641
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/exception/RNotebookIntegrationException.java
@@ -0,0 +1,41 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.rnotebookintegration.exception;
+
+public class RNotebookIntegrationException extends Exception {
+ public static final String ERROR_CODE_TOKEN_EXPIRED = "ERROR_CODE_TOKEN_EXPIRED";
+ public static final String ERROR_CODE_TOKEN_INVALID = "ERROR_CODE_TOKEN_INVALID";
+
+ String errorCode;
+
+ public RNotebookIntegrationException(String errorCodeStr){
+ super(errorCodeStr);
+ this.errorCode = errorCodeStr;
+ }
+
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/service/RNoteBookIntegrationService.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/service/RNoteBookIntegrationService.java
new file mode 100644
index 00000000..2b1e3c9e
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/service/RNoteBookIntegrationService.java
@@ -0,0 +1,31 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.rnotebookintegration.service;
+
+import java.util.Map;
+
+import org.openecomp.portalsdk.core.restful.domain.EcompUser;
+import org.openecomp.portalsdk.rnotebookintegration.exception.RNotebookIntegrationException;
+
+public interface RNoteBookIntegrationService {
+ public String getRNotebookCredentials(String token) throws RNotebookIntegrationException, Exception;
+
+ public String saveRNotebookCredentials(String notebookId, EcompUser user, Map<String, String> params) throws RNotebookIntegrationException, Exception;
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/service/RNoteBookIntegrationServiceImpl.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/service/RNoteBookIntegrationServiceImpl.java
new file mode 100644
index 00000000..1d0972da
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/service/RNoteBookIntegrationServiceImpl.java
@@ -0,0 +1,144 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.rnotebookintegration.service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.restful.domain.EcompUser;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.rnotebookintegration.domain.RNoteBookCredentials;
+import org.openecomp.portalsdk.rnotebookintegration.exception.RNotebookIntegrationException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Service("RNoteBookIntegrationService")
+@Transactional
+public class RNoteBookIntegrationServiceImpl implements RNoteBookIntegrationService {
+
+ private final long tokenTTL = 50000L;
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RNoteBookIntegrationServiceImpl.class);
+
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ @Override
+ public String getRNotebookCredentials(String token) throws RNotebookIntegrationException, Exception {
+ String retString = "";
+
+ try{
+ RNoteBookCredentials notebookCredentials = (RNoteBookCredentials) this.getDataAccessService().getDomainObject(RNoteBookCredentials.class, token, new HashMap<String, String>());
+ if (notebookCredentials.getToken() == null || notebookCredentials.getToken().equals("")){
+ throw new RNotebookIntegrationException(RNotebookIntegrationException.ERROR_CODE_TOKEN_INVALID);
+ }
+ Date currDate = new Date();
+ if ((currDate.getTime() - notebookCredentials.getCreatedDate().getTime() > tokenTTL) || (notebookCredentials.getTokenReadDate() != null)){
+ throw new RNotebookIntegrationException(RNotebookIntegrationException.ERROR_CODE_TOKEN_EXPIRED);
+ }
+ ObjectMapper mapper = new ObjectMapper();
+
+ try{
+ EcompUser userInfo = mapper.readValue(notebookCredentials.getUserString(), EcompUser.class);
+ notebookCredentials.setUserInfo(userInfo);
+ } catch(JsonMappingException me){
+ logger.error("error converting string to user. from JSON" + me.getMessage());
+ } catch(JsonParseException pe){
+ logger.error("error converting string to user. from JSON" + pe.getMessage());
+ }
+
+ try{
+ Map<String, String> params = mapper.readValue(notebookCredentials.getParametersString(), HashMap.class);
+ notebookCredentials.setParameters(params);
+ } catch(JsonMappingException me){
+ logger.error("error converting string to parameters. from JSON" + me.getMessage());
+ } catch(JsonParseException pe){
+ logger.error("error converting string to parameters. from JSON" + pe.getMessage());
+ }
+
+ //expiring the token
+ try{
+ notebookCredentials.setTokenReadDate(new Date());
+ this.getDataAccessService().saveDomainObject(notebookCredentials, null);
+ } catch(Exception e){
+ logger.info("Error while expiring the token");
+ logger.error(e.getMessage());
+ throw new Exception();
+ }
+ //notebookCredentials.setUserString(null);
+ retString = mapper.writeValueAsString(notebookCredentials);
+ } catch(RNotebookIntegrationException re){
+ logger.error(re.getMessage());
+ throw re;
+ } catch(Exception e){
+ logger.info("Error while parsing the rcloud notebook credentials");
+ logger.error(e.getMessage());
+ throw new Exception();
+ }
+
+ return retString;
+ }
+
+ @Override
+ public String saveRNotebookCredentials(String notebookId, EcompUser user, Map<String, String> params) throws RNotebookIntegrationException, Exception {
+
+ String token = "";
+ try{
+ token = UUID.randomUUID().toString();
+
+ ObjectMapper mapper = new ObjectMapper();
+ ;
+ RNoteBookCredentials rc = new RNoteBookCredentials();
+ rc.setToken(token);
+ rc.setCreatedDate(new Date());
+ rc.setNotebookID(notebookId);
+ rc.setParametersString(mapper.writeValueAsString(params));
+ rc.setUserString(mapper.writeValueAsString(user));
+
+ this.getDataAccessService().saveDomainObject(rc, null);
+
+ } catch(Exception e){
+ logger.info("Error while parsing the rcloud notebook credentials");
+ logger.error(e.getMessage());
+ throw new Exception();
+ }
+
+ return token;
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/controllers/WorkflowController.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/controllers/WorkflowController.java
new file mode 100644
index 00000000..ca2b3885
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/controllers/WorkflowController.java
@@ -0,0 +1,183 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.controllers;
+
+import java.io.PrintWriter;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.workflow.domain.WorkflowSchedule;
+import org.openecomp.portalsdk.workflow.models.Workflow;
+import org.openecomp.portalsdk.workflow.models.WorkflowLite;
+import org.openecomp.portalsdk.workflow.services.WorkflowService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * Created by Ikram on 02/15/2016.
+ */
+@Controller
+@RequestMapping("/")
+public class WorkflowController extends RestrictedBaseController {
+
+ @Autowired
+ private WorkflowService workflowService;
+ // @Autowired
+ // private CronJobService cronJobService;
+
+ @RequestMapping(value = { "workflows/saveCronJob" }, method = RequestMethod.POST)
+ public void saveCronJob(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ try {
+ // System.out.println("inside save cron job...");
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+
+ WorkflowSchedule domainCronJobData = new WorkflowSchedule();
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+
+ domainCronJobData.setCronDetails(root.get("cronJobDataObj").get("startDateTime_CRON").textValue());
+ domainCronJobData.setWorkflowKey(root.get("cronJobDataObj").get("workflowKey").textValue());
+ domainCronJobData.setArguments(root.get("cronJobDataObj").get("workflow_arguments").textValue());
+ domainCronJobData.setServerUrl(root.get("cronJobDataObj").get("workflow_server_url").textValue());
+ domainCronJobData
+ .setStartDateTime(dateFormat.parse(root.get("cronJobDataObj").get("startDateTime").textValue()));
+ domainCronJobData
+ .setEndDateTime(dateFormat.parse(root.get("cronJobDataObj").get("endDateTime").textValue()));
+ domainCronJobData.setRecurrence(root.get("cronJobDataObj").get("recurrence").textValue());
+
+ workflowService.saveCronJob(domainCronJobData);
+
+ // response.getWriter().write("hello".toString());
+
+ } catch (Exception e) {
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ PrintWriter out = response.getWriter();
+ out.write(e.getMessage());
+
+ }
+
+ }
+
+ @RequestMapping(value = { "workflows/list" }, method = RequestMethod.GET, produces = "application/json")
+ public @ResponseBody String getWorkflowList() {
+ ObjectMapper mapper = new ObjectMapper();
+ List<Workflow> workflows = workflowService.getAllWorkflows();
+ List<WorkflowLite> workflowLites = new ArrayList<WorkflowLite>();
+
+ try {
+
+ for (Workflow workflow : workflows) {
+ WorkflowLite wfl = new WorkflowLite();
+ wfl.setId(workflow.getId());
+ wfl.setName(workflow.getName());
+ wfl.setDescription(workflow.getDescription());
+ wfl.setActive(workflow.getActive() == null ? "" : workflow.getActive().toString());
+ wfl.setCreated(workflow.getCreated() == null ? "" : workflow.getCreated().toString());
+ wfl.setCreatedBy(workflow.getCreatedBy() == null ? ""
+ : workflow.getCreatedBy().getFirstName() + " " + workflow.getCreatedBy().getLastName());
+ wfl.setModifiedBy(workflow.getModifiedBy() == null ? ""
+ : workflow.getModifiedBy().getFirstName() + " " + workflow.getCreatedBy().getLastName());
+ wfl.setLastUpdated(workflow.getLastUpdated() == null ? "" : workflow.getLastUpdated().toString());
+ wfl.setWorkflowKey(workflow.getWorkflowKey());
+ wfl.setRunLink(workflow.getRunLink());
+ wfl.setSuspendLink(workflow.getSuspendLink());
+
+ workflowLites.add(wfl);
+ }
+
+ return mapper.writeValueAsString(workflowLites);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return "";
+ }
+
+ @RequestMapping(value = "workflows/addWorkflow", method = RequestMethod.POST, consumes = "application/json")
+ public @ResponseBody Workflow addWorkflow(@RequestBody Workflow workflow, HttpServletRequest request,
+ HttpServletResponse response) {
+ String loginId = ((User) (request.getSession().getAttribute("user"))).getLoginId();
+ return workflowService.addWorkflow(workflow, loginId);
+ }
+
+ @RequestMapping(value = "workflows/editWorkflow", method = RequestMethod.POST, consumes = "application/json")
+ public @ResponseBody Workflow editWorkflow(@RequestBody WorkflowLite workflow, HttpServletRequest request,
+ HttpServletResponse response) {
+ String loginId = ((User) (request.getSession().getAttribute("user"))).getLoginId();
+ return workflowService.editWorkflow(workflow, loginId);
+ }
+
+ // @RequestMapping(value = "workflows/removeWorkflow", method =
+ // RequestMethod.DELETE)
+ @RequestMapping(value = { "workflows/removeWorkflow" }, method = RequestMethod.POST, consumes = "application/json")
+ public @ResponseBody void removeWorkflow(@RequestBody Long workflowId, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ // System.out.println("Removing ... " + workflowId);
+
+ workflowService.deleteWorkflow(workflowId);
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ PrintWriter out = null;
+ try {
+ request.setCharacterEncoding("UTF-8");
+ out = response.getWriter();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ JSONObject j = new JSONObject("{removed: 123}");
+ out.write(j.toString());
+
+ }
+
+ @RequestMapping(value = "workflows/removeAllWorkflows", method = RequestMethod.DELETE)
+ public @ResponseBody void removeAllWorkflows() {
+ // workflowService.deleteAll();
+ }
+
+ @RequestMapping(value = { "/workflows" }, method = RequestMethod.GET)
+ public ModelAndView getWorkflowPartialPage() {
+ Map<String, Object> model = new HashMap<String, Object>();
+ return new ModelAndView(getViewName(), "workflows", model);
+ }
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/HibernateConfiguration.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/HibernateConfiguration.java
new file mode 100644
index 00000000..e5ace071
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/HibernateConfiguration.java
@@ -0,0 +1,20 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.dao;
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/WorkflowDAO.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/WorkflowDAO.java
new file mode 100644
index 00000000..435ac9a6
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/WorkflowDAO.java
@@ -0,0 +1,32 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.dao;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.workflow.models.Workflow;
+import org.openecomp.portalsdk.workflow.models.WorkflowLite;
+
+public interface WorkflowDAO {
+ public List<Workflow> getWorkflows();
+ public Workflow save(Workflow workflow, String creatorId);
+ public Workflow edit(WorkflowLite workflow, String creatorId);
+ public void delete(Long workflow);
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/WorkflowDAOImpl.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/WorkflowDAOImpl.java
new file mode 100644
index 00000000..a3382dbb
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/WorkflowDAOImpl.java
@@ -0,0 +1,109 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.workflow.models.Workflow;
+import org.openecomp.portalsdk.workflow.models.WorkflowLite;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+@Repository
+public class WorkflowDAOImpl implements WorkflowDAO{
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ public Workflow save(Workflow workflow, String creatorId){
+ Session session = this.sessionFactory.openSession();
+ Transaction tx = session.beginTransaction();
+
+ try{
+ Query query = session.createQuery("from User where loginId =:loginId");
+ query.setParameter("loginId", creatorId);
+ User creator = (User)(query.list().get(0));
+
+ workflow.setCreatedBy(creator);
+ workflow.setCreated(new Date());
+ }
+ catch(Exception e){
+ e.printStackTrace();
+ }
+
+ long id = (Long) session.save(workflow);
+ Workflow savedWorkflow = (Workflow) session.get(Workflow.class, id);
+ tx.commit();
+ session.close();
+ return savedWorkflow;
+ }
+
+ public List<Workflow> getWorkflows(){
+ Session session = this.sessionFactory.openSession();
+ @SuppressWarnings("unchecked")
+ List<Workflow> workflows = session.createQuery("from Workflow").list();
+ session.close();
+ return workflows;
+ }
+
+ @Override
+ public void delete(Long workflowId) {
+ Session session = this.sessionFactory.openSession();
+ Transaction tx = session.beginTransaction();
+ Query query = session.createQuery("delete from Workflow where id =:id");
+ query.setParameter("id", workflowId);
+ query.executeUpdate();
+ tx.commit();
+ session.close();
+ }
+
+ @Override
+ public Workflow edit(WorkflowLite workflowLight, String creatorId) {
+ Session session = this.sessionFactory.openSession();
+ Transaction tx = session.beginTransaction();
+
+ Query query = session.createQuery("from User where loginId =:loginId");
+ query.setParameter("loginId", creatorId);
+ User creator = (User)(query.list().get(0));
+
+ Workflow workflowToModify = (Workflow) session.get(Workflow.class, workflowLight.getId());
+
+ workflowToModify.setActive(workflowLight.getActive().equalsIgnoreCase("true") ? true : false );
+ workflowToModify.setSuspendLink(workflowLight.getSuspendLink());
+ workflowToModify.setRunLink(workflowLight.getRunLink());
+ workflowToModify.setDescription(workflowLight.getDescription());
+ workflowToModify.setWorkflowKey(workflowLight.getWorkflowKey());
+ workflowToModify.setName(workflowLight.getName());
+
+ workflowToModify.setModifiedBy(creator);
+ workflowToModify.setLastUpdated(new Date());
+
+ session.update(workflowToModify);
+ Workflow savedWorkflow = (Workflow) session.get(Workflow.class, workflowLight.getId());
+ tx.commit();
+ session.close();
+ return savedWorkflow;
+ }
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/domain/WorkflowSchedule.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/domain/WorkflowSchedule.java
new file mode 100644
index 00000000..e8c619f5
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/domain/WorkflowSchedule.java
@@ -0,0 +1,91 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.domain;
+import java.util.Date;
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+public class WorkflowSchedule extends DomainVo{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private Long id;
+ private String serverUrl;
+ private String workflowKey;
+ private String arguments;
+ private String cronDetails;
+ private Date endDateTime;
+ private Date startDateTime;
+ private String recurrence;
+
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public String getServerUrl() {
+ return serverUrl;
+ }
+ public void setServerUrl(String serverUrl) {
+ this.serverUrl = serverUrl;
+ }
+ public String getWorkflowKey() {
+ return workflowKey;
+ }
+ public void setWorkflowKey(String workflowKey) {
+ this.workflowKey = workflowKey;
+ }
+ public String getArguments() {
+ return arguments;
+ }
+ public void setArguments(String arguments) {
+ this.arguments = arguments;
+ }
+ public String getCronDetails() {
+ return cronDetails;
+ }
+ public void setCronDetails(String cronDetails) {
+ this.cronDetails = cronDetails;
+ }
+ public Date getEndDateTime() {
+ return endDateTime;
+ }
+ public void setEndDateTime(Date endDateTime) {
+ this.endDateTime = endDateTime;
+ }
+ public Date getStartDateTime() {
+ return startDateTime;
+ }
+ public void setStartDateTime(Date startDateTime) {
+ this.startDateTime = startDateTime;
+ }
+ public String getRecurrence() {
+ return recurrence;
+ }
+ public void setRecurrence(String recurrence) {
+ this.recurrence = recurrence;
+ }
+ public static long getSerialversionuid() {
+ return serialVersionUID;
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/models/Workflow.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/models/Workflow.java
new file mode 100644
index 00000000..7f93c5ea
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/models/Workflow.java
@@ -0,0 +1,202 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.models;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+import org.openecomp.portalsdk.core.domain.User;
+
+@Entity
+@Table(name = "fn_workflow")
+public class Workflow implements Serializable{
+
+ private static final long serialVersionUID = -3155065449938005856L;
+
+ @Id
+ @Column(name = "id")
+ @GeneratedValue
+ private Long id;
+
+ @Column
+ private String name;
+
+ @Column (name = "workflow_key")
+ private String workflowKey;
+
+ @Column
+ private String description;
+
+ @Column(name = "created")
+ private Date created;
+
+ @OneToOne(fetch = FetchType.EAGER)//, cascade = CascadeType.ALL)
+ @JoinColumn(name = "created_by")
+ private User createdBy;
+
+ @Column(name = "modified")
+ private Date lastUpdated;
+
+ @OneToOne(fetch = FetchType.EAGER)//, cascade = CascadeType.ALL)
+ @JoinColumn(name = "modified_by")
+ private User modifiedBy;
+
+ @Column(name = "active_yn")
+ private Boolean active;
+
+ @Column(name = "run_link")
+ private String runLink;
+
+ @Column(name = "suspend_link")
+ private String suspendLink;
+
+ @Column(name = "modified_link")
+ private String modifiedLink;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getRunLink() {
+ return runLink;
+ }
+
+ public void setRunLink(String runLink) {
+ this.runLink = runLink;
+ }
+
+ public String getSuspendLink() {
+ return suspendLink;
+ }
+
+ public void setSuspendLink(String suspendLink) {
+ this.suspendLink = suspendLink;
+ }
+
+ public String getModifiedLink() {
+ return modifiedLink;
+ }
+
+ public void setModifiedLink(String modifiedLink) {
+ this.modifiedLink = modifiedLink;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public User getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(User createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public Date getLastUpdated() {
+ return lastUpdated;
+ }
+
+ public void setLastUpdated(Date lastUpdated) {
+ this.lastUpdated = lastUpdated;
+ }
+
+ public User getModifiedBy() {
+ return modifiedBy;
+ }
+
+ public void setModifiedBy(User modifiedBy) {
+ this.modifiedBy = modifiedBy;
+ }
+
+ public String getWorkflowKey() {
+ return workflowKey;
+ }
+
+ public void setWorkflowKey(String workflowKey) {
+ this.workflowKey = workflowKey;
+ }
+
+ public Boolean getActive() {
+ return active;
+ }
+
+ public void setActive(Boolean active) {
+ this.active = active;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Workflow other = (Workflow) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/models/WorkflowLite.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/models/WorkflowLite.java
new file mode 100644
index 00000000..c3b727d9
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/models/WorkflowLite.java
@@ -0,0 +1,174 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.models;
+
+
+import java.io.Serializable;
+
+public class WorkflowLite implements Serializable{
+
+ private static final long serialVersionUID = -3155065449938005856L;
+
+ private Long id;
+
+ private String name;
+
+ private String workflowKey;
+
+ private String description;
+
+ private String created;
+
+ private String createdBy;
+
+ private String lastUpdated;
+
+ private String modifiedBy;
+
+ private String active;
+
+ private String runLink;
+
+ private String suspendLink;
+
+ private String modifiedLink;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getWorkflowKey() {
+ return workflowKey;
+ }
+
+ public void setWorkflowKey(String workflowKey) {
+ this.workflowKey = workflowKey;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getCreated() {
+ return created;
+ }
+
+ public void setCreated(String created) {
+ this.created = created;
+ }
+
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public String getLastUpdated() {
+ return lastUpdated;
+ }
+
+ public void setLastUpdated(String lastUpdated) {
+ this.lastUpdated = lastUpdated;
+ }
+
+ public String getModifiedBy() {
+ return modifiedBy;
+ }
+
+ public void setModifiedBy(String modifiedBy) {
+ this.modifiedBy = modifiedBy;
+ }
+
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ public String getRunLink() {
+ return runLink;
+ }
+
+ public void setRunLink(String runLink) {
+ this.runLink = runLink;
+ }
+
+ public String getSuspendLink() {
+ return suspendLink;
+ }
+
+ public void setSuspendLink(String suspendLink) {
+ this.suspendLink = suspendLink;
+ }
+
+ public String getModifiedLink() {
+ return modifiedLink;
+ }
+
+ public void setModifiedLink(String modifiedLink) {
+ this.modifiedLink = modifiedLink;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ WorkflowLite other = (WorkflowLite) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/scheduler/WorkFlowScheduleJob.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/scheduler/WorkFlowScheduleJob.java
new file mode 100644
index 00000000..d90ee05b
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/scheduler/WorkFlowScheduleJob.java
@@ -0,0 +1,45 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.scheduler;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.workflow.services.WorkflowScheduleExecutor;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.scheduling.quartz.QuartzJobBean;
+
+public class WorkFlowScheduleJob extends QuartzJobBean{
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WorkFlowScheduleJob.class);
+
+
+ @Override
+ protected void executeInternal(JobExecutionContext context)
+ throws JobExecutionException {
+
+ String serverUrl = (String)context.getMergedJobDataMap().get("serverUrl");
+ String workflowKey = (String)context.getMergedJobDataMap().get("workflowKey");
+ //String arguments = (String)context.getMergedJobDataMap().get("arguments");
+ logger.info(EELFLoggerDelegate.debugLogger, ("Executing the job for the workflow " + workflowKey));
+ WorkflowScheduleExecutor executor = new WorkflowScheduleExecutor(serverUrl, workflowKey);
+ executor.execute();
+ }
+
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/scheduler/WorkFlowScheduleRegistry.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/scheduler/WorkFlowScheduleRegistry.java
new file mode 100644
index 00000000..bf29f59a
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/scheduler/WorkFlowScheduleRegistry.java
@@ -0,0 +1,107 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.scheduler;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.quartz.impl.triggers.CronTriggerImpl;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
+import org.springframework.scheduling.quartz.JobDetailFactoryBean;
+import org.springframework.stereotype.Component;
+
+@Component
+@DependsOn({"systemProperties"})
+public class WorkFlowScheduleRegistry{
+
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WorkFlowScheduleRegistry.class);
+
+
+ public WorkFlowScheduleRegistry() {
+
+ }
+
+ private static final String groupName = "AppGroup";
+ private static final String jobName = "WorkflowScheduleJob";
+ private static final String triggerName = "WorkflowScheduleTrigger";
+
+ // @Autowired
+ // private SystemProperties systemProperties;
+
+ // @Bean
+ public JobDetailFactoryBean jobDetailFactoryBean(Map<String, ?> contextInfoMap) {
+
+ JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
+ jobDetailFactory.setJobClass(WorkFlowScheduleJob.class);
+ jobDetailFactory.setJobDataAsMap(contextInfoMap);
+ jobDetailFactory.setGroup(groupName);
+ jobDetailFactory.setName(jobName + "_" + UUID.randomUUID());
+ jobDetailFactory.afterPropertiesSet();
+ return jobDetailFactory;
+ }
+
+ // @Bean
+ public CronTriggerFactoryBean cronTriggerFactoryBean(JobDetailFactoryBean jobDetailFactory, Long id,
+ String cronExpression, Date startDateTime, Date enddatetime) throws Exception {
+ CronTriggerFactoryBean cronTriggerFactory = new CronTriggerFactoryBean();
+ cronTriggerFactory.setJobDetail(jobDetailFactory.getObject());
+ cronTriggerFactory.setStartDelay(3000);
+ cronTriggerFactory.setName(triggerName + "_" + id);
+ cronTriggerFactory.setGroup(groupName);
+ logger.debug(EELFLoggerDelegate.debugLogger, (triggerName + " Scheduled: " + cronExpression));
+ cronTriggerFactory.setCronExpression( cronExpression); //"0 * * * * ? *"
+ cronTriggerFactory.afterPropertiesSet();
+
+ final CronTriggerImpl cronTrigger = (CronTriggerImpl) cronTriggerFactory.getObject();
+ cronTrigger.setStartTime(startDateTime == null ? Calendar.getInstance().getTime() : startDateTime);
+ cronTrigger.setEndTime(enddatetime);
+ Date fireAgainTime = cronTrigger.getFireTimeAfter(cronTrigger.getStartTime());
+ if (fireAgainTime == null)
+ throw new Exception("Cron not added as it may not fire again " + " Expr: " + cronExpression + " End Time: "
+ + cronTrigger.getEndTime());
+ return cronTriggerFactory;
+
+ }
+
+ public CronTriggerFactoryBean setUpTrigger(Long wfId, String serverUrl, String workflowKey, String arguments,
+ String startdatetimecron, Date startDateTime, Date enddatetime) throws Exception {
+
+ Map<String, String> contextInfo = new HashMap<String, String>();
+ contextInfo.put("serverUrl", serverUrl);
+ contextInfo.put("workflowKey", workflowKey);
+ contextInfo.put("arguments", arguments);
+ JobDetailFactoryBean jobDetailFactory = jobDetailFactoryBean(contextInfo);
+
+ CronTriggerFactoryBean cronTriggerFactory = cronTriggerFactoryBean(jobDetailFactory, wfId, startdatetimecron, startDateTime, enddatetime);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, (" Job to be Scheduled: " + contextInfo.get("workflowKey")));
+
+ //cronTriggerFactory.
+
+ return cronTriggerFactory;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleExecutor.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleExecutor.java
new file mode 100644
index 00000000..8927e08b
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleExecutor.java
@@ -0,0 +1,108 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.services;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.charset.Charset;
+
+public class WorkflowScheduleExecutor {
+ private String serverURL;
+ private String workflowKey;
+ private String myUrl;
+ private String payload;
+
+ //constructor
+ public WorkflowScheduleExecutor(String serverURL,String workflowKey){
+ this.serverURL = serverURL;
+ this.workflowKey = workflowKey;
+ this.myUrl = this.serverURL + "/engine-rest/process-definition/key/" + this.workflowKey + "/submit-form";;
+ this.payload="{\"variables\":{}}";
+ }
+
+ public static void main(String [] args) throws Exception {
+
+ }
+
+ public void execute() {
+ POST_fromURL(myUrl,payload);
+ }
+
+ public static String get_fromURL(String myURL) {
+ System.out.println("Requeted URL:" + myURL);
+ StringBuilder sb = new StringBuilder();
+ URLConnection urlConn = null;
+ InputStreamReader in = null;
+ try {
+ URL url = new URL(myURL);
+ urlConn = url.openConnection();
+ if (urlConn != null)
+ urlConn.setReadTimeout(60 * 1000);
+ if (urlConn != null && urlConn.getInputStream() != null) {
+ in = new InputStreamReader(urlConn.getInputStream(),
+ Charset.defaultCharset());
+ BufferedReader bufferedReader = new BufferedReader(in);
+ if (bufferedReader != null) {
+ int cp;
+ while ((cp = bufferedReader.read()) != -1) {
+ sb.append((char) cp);
+ }
+ bufferedReader.close();
+ }
+ }
+ in.close();
+ } catch (Exception e) {
+ throw new RuntimeException("Exception while calling URL:"+ myURL, e);
+ }
+ return sb.toString();
+ }
+
+
+ public static String POST_fromURL(String myURL, String payload) {
+ String line;
+ StringBuffer jsonString = new StringBuffer();
+ try {
+ URL url = new URL(myURL);
+
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setDoInput(true);
+ connection.setDoOutput(true);
+ connection.setRequestMethod("POST");
+ connection.setRequestProperty("Accept", "application/json");
+ connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
+ OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");
+ writer.write(payload);
+ writer.close();
+ BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ while ((line = br.readLine()) != null) {
+ jsonString.append(line);
+ }
+ br.close();
+ connection.disconnect();
+ } catch (Exception e) {
+ throw new RuntimeException(e.getMessage());
+ }
+ return jsonString.toString();
+ }
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleService.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleService.java
new file mode 100644
index 00000000..d04b72be
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleService.java
@@ -0,0 +1,34 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.services;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.workflow.domain.WorkflowSchedule;
+import org.quartz.Trigger;
+import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+
+public interface WorkflowScheduleService {
+ List<WorkflowSchedule> findAll();
+ WorkflowSchedule getWorkflowScheduleByKey(Long key);
+ void saveWorkflowSchedule(WorkflowSchedule ws);
+ public void triggerWorkflowScheduling(SchedulerFactoryBean schedulerBean, WorkflowSchedule ws);
+ public List<Trigger> triggerWorkflowScheduling();
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleServiceImpl.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleServiceImpl.java
new file mode 100644
index 00000000..1d0c58a7
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleServiceImpl.java
@@ -0,0 +1,144 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.services;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.workflow.domain.WorkflowSchedule;
+import org.openecomp.portalsdk.workflow.scheduler.WorkFlowScheduleRegistry;
+import org.quartz.JobDetail;
+import org.quartz.Trigger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
+import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+
+
+@Service("workflowScheduleService")
+@Transactional
+
+public class WorkflowScheduleServiceImpl implements WorkflowScheduleService{
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WorkflowScheduleServiceImpl.class);
+
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ @Autowired
+ private WorkFlowScheduleRegistry workflowRegistry;
+
+ @Autowired
+ private ApplicationContext appContext;
+
+
+ public List<WorkflowSchedule> findAll() {
+
+ /* List<WorkflowSchedule> allworkflows = getDataAccessService().getList(WorkflowSchedule.class, null);
+ for (WorkflowSchedule ws : allworkflows) {
+
+ System.out.println("Key:"+ws.getWorkflowKey()+" "+"CronDetails:"+ws.getStartdatetimecron());
+ } */
+ @SuppressWarnings("unchecked")
+ List<WorkflowSchedule> list = getDataAccessService().getList(WorkflowSchedule.class, null);
+ return list;
+ }
+
+
+ public void saveWorkflowSchedule(WorkflowSchedule ws){
+
+ getDataAccessService().saveDomainObject(ws, null);
+ logger.info(EELFLoggerDelegate.debugLogger, ("Workflow Scheduled " + ws.getId() + " " + ws.getEndDateTime()));
+ triggerWorkflowScheduling((SchedulerFactoryBean)appContext.getBean(SchedulerFactoryBean.class),ws);
+
+ }
+
+ public void triggerWorkflowScheduling(SchedulerFactoryBean schedulerBean, WorkflowSchedule ws) {
+
+ try {
+ final CronTriggerFactoryBean triggerBean = workflowRegistry.setUpTrigger(ws.getId(), ws.getServerUrl(), ws.getWorkflowKey(),ws.getArguments(),ws.getCronDetails(), ws.getStartDateTime(),ws.getEndDateTime());
+ schedulerBean.getScheduler().scheduleJob((JobDetail)triggerBean.getJobDataMap().get("jobDetail"),triggerBean.getObject());
+ } catch (Exception e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Error scheduling work flow with Id" + ws.getId() + e.getMessage()));
+ }
+
+ }
+
+ public List<Trigger> triggerWorkflowScheduling() {
+
+ Date date = new Date();
+ List<Trigger> triggers = new ArrayList<Trigger>();
+
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ if (getDataAccessService() != null) {
+ @SuppressWarnings("unchecked")
+ List<WorkflowSchedule> allWorkflows = getDataAccessService()
+ .executeQuery("From WorkflowSchedule where endDateTime > '" + dateFormat.format(date) + "'", null);
+
+ for (WorkflowSchedule ws : allWorkflows) {
+ logger.info(EELFLoggerDelegate.debugLogger, ("Workflow Scheduled " + ws.getId() + "/ End Time: " + ws.getEndDateTime()));
+
+ try {
+
+ final CronTriggerFactoryBean triggerBean = workflowRegistry.setUpTrigger(ws.getId(), ws.getServerUrl(), ws.getWorkflowKey(),ws.getArguments(), ws.getCronDetails(), ws.getStartDateTime(),ws.getEndDateTime());
+
+ triggers.add(triggerBean.getObject());
+
+ //schedulerBean.getScheduler().scheduleJob(trigger);
+
+
+ } catch (Exception e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Error scheduling work flow with Id" + ws.getId() + e.getMessage()));
+ }
+
+
+ }
+ }
+
+ return triggers;
+ }
+
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ @Override
+ public WorkflowSchedule getWorkflowScheduleByKey(Long key) {
+ return (WorkflowSchedule)(getDataAccessService().getDomainObject(WorkflowSchedule.class, key, null));
+ }
+}
+
+
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowService.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowService.java
new file mode 100644
index 00000000..745b0b23
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowService.java
@@ -0,0 +1,35 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.services;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.workflow.domain.WorkflowSchedule;
+import org.openecomp.portalsdk.workflow.models.Workflow;
+import org.openecomp.portalsdk.workflow.models.WorkflowLite;
+
+
+public interface WorkflowService {
+ public void saveCronJob(WorkflowSchedule domainCronJobData);
+ public Workflow addWorkflow(Workflow workflow, String creatorId);
+ public Workflow editWorkflow(WorkflowLite worklow, String creatorId);
+ public void deleteWorkflow(Long worklow);
+ public List<Workflow> getAllWorkflows();
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowServiceImpl.java b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowServiceImpl.java
new file mode 100644
index 00000000..b27d2e2d
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowServiceImpl.java
@@ -0,0 +1,77 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.workflow.services;
+
+import java.util.List;
+
+import org.openecomp.portalsdk.workflow.dao.WorkflowDAO;
+import org.openecomp.portalsdk.workflow.domain.WorkflowSchedule;
+import org.openecomp.portalsdk.workflow.models.Workflow;
+import org.openecomp.portalsdk.workflow.models.WorkflowLite;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+@Service("workflowService")
+public class WorkflowServiceImpl implements WorkflowService {
+
+ @Autowired
+ private WorkflowDAO workflowDAO;
+
+ //@Autowired
+ //private DataAccessService dataAccessService;
+
+ @Autowired
+ private WorkflowScheduleService workflowScheduleService;
+
+ @Override
+ public void saveCronJob(WorkflowSchedule domainCronJobData) {
+ // TODO Auto-generated method stub
+ workflowScheduleService.saveWorkflowSchedule(domainCronJobData);
+/* triggerWorkflowScheduling((SchedulerFactoryBean)appContext.getBean(SchedulerFactoryBean.class),domainCronJobData);
+*/ }
+
+ /*
+ private DataAccessService getDataAccessService() {
+ // TODO Auto-generated method stub
+ return dataAccessService;
+ }
+ */
+
+ @Override
+ public Workflow addWorkflow(Workflow workflow, String creatorId) {
+ return workflowDAO.save(workflow, creatorId);
+ }
+
+ @Override
+ public Workflow editWorkflow(WorkflowLite workflow, String creatorId) {
+ return workflowDAO.edit(workflow, creatorId);
+ }
+
+ @Override
+ public void deleteWorkflow(Long workflowId) {
+ workflowDAO.delete(workflowId);
+ }
+
+ @Override
+ public List<Workflow> getAllWorkflows() {
+ return workflowDAO.getWorkflows();
+ }
+}
diff --git a/ecomp-sdk/sdk-workflow/src/main/resources/RNoteBookIntegration.hbm.xml b/ecomp-sdk/sdk-workflow/src/main/resources/RNoteBookIntegration.hbm.xml
new file mode 100644
index 00000000..44b7986f
--- /dev/null
+++ b/ecomp-sdk/sdk-workflow/src/main/resources/RNoteBookIntegration.hbm.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!--
+ ================================================================================
+ eCOMP Portal SDK
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ================================================================================
+ -->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.openecomp.portalsdk.rnotebookintegration.domain">
+
+
+ <!-- WorkflowSchedule mapping details -->
+ <class name="RNoteBookCredentials" table="rcloudinvocation">
+ <id name="token" column="ID">
+
+ </id>
+ <property name="createdDate" column="created"/>
+ <property name="userString" column="userInfo"/>
+ <property name="notebookID" column="notebookID"/>
+ <property name="parametersString" column="parameters"/>
+ <property name="tokenReadDate" column="tokenreaddate"/>
+ </class>
+
+
+
+</hibernate-mapping>
diff --git a/ecomp-sdk/thirdparty/.gitignore b/ecomp-sdk/thirdparty/.gitignore
new file mode 100644
index 00000000..b83d2226
--- /dev/null
+++ b/ecomp-sdk/thirdparty/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/ecomp-sdk/thirdparty/README.md b/ecomp-sdk/thirdparty/README.md
new file mode 100644
index 00000000..f916e99f
--- /dev/null
+++ b/ecomp-sdk/thirdparty/README.md
@@ -0,0 +1,23 @@
+ECOMP Portal SDK Framework
+==========================
+
+This is the Maven project for the ECOMP Portal SDK Framework,
+which is distributed as ecompFW-nnn.jar. This library
+(formerly called third-party onboarding) provides features to
+partner applications that use a J2EE Servlet 3.0 container
+as Apache Tomcat. These features include:
+- REST endpoint for use by the ECOMP Portal aplication. This endpoint
+ answers queries about roles, users and user-role assignments.
+ The endpoint methods are defined by the Java interface class
+ IPortalRestAPIService. Application developers must provide a
+ class that implements this interface, and publish the name of
+ that class in the properties file as discussed below.
+- A session listener that updates a collection with current user sessions
+ as sessions are created and destroyed. This information is used to maintain
+ and extend user session timeouts across applications that are on-boarded to
+ the ECOMP portal.
+- Communication with the ECOMP Portal to fetch a user-specific functional menu, either
+ via REST or UEB.
+
+Unlike the other ECOMP SDK libraries, this library does NOT require Hibernate,
+nor does it require Spring. \ No newline at end of file
diff --git a/ecomp-sdk/thirdparty/pom.xml b/ecomp-sdk/thirdparty/pom.xml
new file mode 100644
index 00000000..f98fed21
--- /dev/null
+++ b/ecomp-sdk/thirdparty/pom.xml
@@ -0,0 +1,93 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>ecompSDK-project</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <!-- GroupId is inherited from parent -->
+ <artifactId>ecompFW</artifactId>
+ <!-- Version is inherited from parent -->
+ <packaging>jar</packaging>
+ <name>Ecomp Portal Framework (thirdparty)</name>
+
+ <!-- properties are inherited from parent -->
+
+ <!-- repositories are inherited from parent -->
+
+ <!-- profiles are inherited from parent -->
+
+ <build>
+
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/portal*.properties</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <plugins>
+
+ <!-- some plugins inherited from parent -->
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <excludes>
+ <exclude>**/com/att/fusion/core/onboarding/client/*</exclude>
+ </excludes>
+ <archive>
+ <manifestEntries>
+ <archive-version>${project.version}</archive-version>
+ <internal-version>${sdk-internal.version}</internal-version>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+ <dependencies>
+
+
+ <!-- publicly available -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+
+ <!-- UEB was originally named Cambria -->
+ <dependency>
+ <groupId>com.att.nsa</groupId>
+ <artifactId>cambriaClient</artifactId>
+ <version>0.0.1</version>
+ </dependency>
+
+
+ </dependencies>
+
+</project>
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/ECOMPSSOFilter.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/ECOMPSSOFilter.java
new file mode 100644
index 00000000..0fc64999
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/ECOMPSSOFilter.java
@@ -0,0 +1,77 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.client;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.annotation.WebFilter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.portalsdk.core.onboarding.crossapi.ECOMPSSO;
+
+/**
+ * This is an example filter that uses the ecompFW library to require the
+ */
+@WebFilter("/secure/*")
+public class ECOMPSSOFilter implements Filter {
+
+ /*
+ * (non-Javadoc)
+ * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
+ */
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+ throws java.io.IOException, ServletException {
+ if (ECOMPSSO.valdiateECOMPSSO((HttpServletRequest) request) == null) {
+ String redirectURL = ECOMPSSO.getECOMPSSORedirectURL(((HttpServletRequest) request),
+ ((HttpServletResponse) response),
+ (((HttpServletRequest) request).getRequestURI()
+ .substring(((HttpServletRequest) request).getContextPath().length() + 1)
+ + (((HttpServletRequest) request).getQueryString() != null
+ ? ("?" + ((HttpServletRequest) request).getQueryString()) : "")));
+ ((HttpServletResponse) response).sendRedirect(redirectURL);
+ } else {
+ // Pass request back down the filter chain
+ chain.doFilter(request, response);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.Filter#destroy()
+ */
+ public void destroy() {
+ // Called before the Filter instance is removed from service
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
+ */
+ public void init(FilterConfig arg0) throws ServletException {
+ // Called before the filter instance is installed into service.
+ }
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/SecureServlet.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/SecureServlet.java
new file mode 100644
index 00000000..9a583d38
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/SecureServlet.java
@@ -0,0 +1,61 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.client;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Servlet implementation class SecureServlet
+ */
+@WebServlet("/secure/SecureServlet")
+public class SecureServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * @see HttpServlet#HttpServlet()
+ */
+ public SecureServlet() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
+ */
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ response.getWriter().append("Served at: ").append(request.getContextPath());
+ }
+
+ /**
+ * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
+ */
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ doGet(request, response);
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/UnSecureServlet.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/UnSecureServlet.java
new file mode 100644
index 00000000..d5cd2758
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/UnSecureServlet.java
@@ -0,0 +1,61 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.client;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Servlet implementation class SecureServlet
+ */
+@WebServlet("/unsecure/SecureServlet")
+public class UnSecureServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * @see HttpServlet#HttpServlet()
+ */
+ public UnSecureServlet() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
+ */
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ response.getWriter().append("Served at: ").append(request.getContextPath());
+ }
+
+ /**
+ * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
+ */
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ doGet(request, response);
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/CipherUtil.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/CipherUtil.java
new file mode 100644
index 00000000..d355e102
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/CipherUtil.java
@@ -0,0 +1,125 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+
+import org.apache.commons.codec.binary.Base64;
+
+public class CipherUtil {
+
+ private final static String key = "AGLDdG4D04BKm2IxIWEr8o==!";
+
+ /**
+ * @param plainText
+ * @param secretKey
+ * @return encrypted version of plain text.
+ * @throws Exception
+ */
+ public static String encrypt(String plainText, String secretKey) throws Exception{
+ byte[] rawKey;
+ String encryptedString;
+ SecretKeySpec sKeySpec;
+ byte[] encryptText = plainText.getBytes("UTF-8");
+ Cipher cipher;
+ rawKey = Base64.decodeBase64(secretKey);
+ sKeySpec = new SecretKeySpec(rawKey, "AES");
+ cipher = Cipher.getInstance("AES");
+ cipher.init(Cipher.ENCRYPT_MODE, sKeySpec);
+ encryptedString = Base64.encodeBase64String(cipher.doFinal(encryptText));
+
+ return encryptedString;
+ }
+
+ /**
+ *
+ * @param plainText
+ * @return Encrypted Text
+ * @throws Exception
+ */
+ public static String encrypt(String plainText) throws Exception
+ {
+ return CipherUtil.encrypt(plainText,key);
+ }
+
+ /**
+ * @param encryptedText
+ * @param secretKey
+ * @return plain text version of encrypted text
+ * @throws Exception
+ */
+ public static String decrypt(String encryptedText, String secretKey) throws Exception {
+ Cipher cipher;
+ String encryptedString;
+ byte[] encryptText = null;
+ byte[] rawKey;
+ SecretKeySpec sKeySpec;
+
+ rawKey = Base64.decodeBase64(secretKey);
+ sKeySpec = new SecretKeySpec(rawKey, "AES");
+ encryptText = Base64.decodeBase64(encryptedText.getBytes("UTF-8"));
+ cipher = Cipher.getInstance("AES");
+ cipher.init(Cipher.DECRYPT_MODE, sKeySpec);
+ encryptedString = new String(cipher.doFinal(encryptText));
+
+ return encryptedString;
+ }
+
+ /**
+ * @param encryptedText
+ * @return Decrypted Text
+ * @throws Exception
+ */
+ public static String decrypt(String encryptedText) throws Exception
+ {
+ return CipherUtil.decrypt(encryptedText,key);
+ }
+
+
+ public static void main(String[] args) throws Exception {
+
+ String password = "Welcome123";
+ String encrypted;
+ String decrypted;
+
+ if (args.length != 2) {
+ System.out.println("Default password testing... ");
+ System.out.println("Plain password: " + password);
+ encrypted = encrypt(password);
+ System.out.println("Encrypted password: " + encrypted);
+ decrypted = decrypt(encrypted);
+ System.out.println("Decrypted password: " + decrypted);
+ } else {
+ String whatToDo = args[0];
+ if (whatToDo.equalsIgnoreCase("d")) {
+ encrypted = args[1];
+ System.out.println("Encrypted Text: " + encrypted);
+ decrypted = decrypt(encrypted);
+ System.out.println("Decrypted Text: " + decrypted);
+ } else {
+ decrypted = args[1];
+ System.out.println("Plain Text: " + decrypted);
+ encrypted = encrypt(decrypted);
+ System.out.println("Encrypted Text" + encrypted);
+ }
+ }
+ }
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/ECOMPSSO.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/ECOMPSSO.java
new file mode 100644
index 00000000..8fc2ec5b
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/ECOMPSSO.java
@@ -0,0 +1,238 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+/**
+ * Provides authentication service for onboarded ECOMP applications.
+ */
+public class ECOMPSSO {
+
+ private static final String EP_SERVICE = "EPService";
+ private static final String USER_ID = "UserId";
+
+ private static final Log logger = LogFactory.getLog(ECOMPSSO.class);
+
+
+ public static String valdiateECOMPSSO(HttpServletRequest request) {
+ // Check ECOMP Portal cookie
+ if (!isLoginCookieExist(request))
+ return null;
+
+ String userid = null;
+ try {
+ userid = getUserIdFromCookie(request);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return userid;
+ }
+
+ public static String getUserIdFromCookie(HttpServletRequest request) throws Exception {
+ String userId = "";
+ Cookie[] cookies = request.getCookies();
+ Cookie userIdcookie = null;
+ if (cookies != null)
+ for (Cookie cookie : cookies)
+ if (cookie.getName().equals(USER_ID))
+ userIdcookie = cookie;
+ if(userIdcookie!=null){
+ userId = CipherUtil.decrypt(userIdcookie.getValue(),
+ PortalApiProperties.getProperty(PortalApiConstants.Decryption_Key));
+ }
+ return userId;
+
+ }
+
+ /**
+ * Builds a redirect URL from properties file and the specified relative
+ * path in this app. The intent is to take the user to the portal, which
+ * will redirect the user to Global Log On, and finally the user will be
+ * returned to the app.
+ *
+ * @param request
+ * HttpServletRequest
+ * @param response
+ * HttpServletResponse
+ * @param forwardPath
+ * portion of the application path after the protocol, server and
+ * context path plus any query parameters; e.g., "welcome.html";
+ * empty string is allowed.
+ * @return URL that redirects user to ECOMP Portal for login.
+ */
+ public static String getECOMPSSORedirectURL(HttpServletRequest request, HttpServletResponse response,
+ String forwardPath) {
+ // Construct a path for this server, this app's context, etc.
+ String appURL = (request.isSecure() ? "https://" : "http://") + request.getServerName() + ":"
+ + request.getServerPort() + request.getContextPath() + "/" + forwardPath;
+ String encodedAppURL = null;
+ try {
+ encodedAppURL = URLEncoder.encode(appURL, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+ // should never happen
+ logger.error("getECOMPSSORedirectURL: Failed to encode app URL " + appURL);
+ }
+ String portalURL = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL);
+ if (portalURL == null || portalURL.length() == 0) {
+ logger.error("getECOMPSSORedirectURL: Failed to get property " + PortalApiConstants.ECOMP_REDIRECT_URL);
+ return null;
+ }
+ String redirectURL = portalURL + "?redirectUrl=" + encodedAppURL;
+ return redirectURL;
+ }
+
+ /**
+ * Answers whether the ECOMP Portal service cookie is present in the
+ * specified request.
+ *
+ * @param request
+ * @return true if the cookie is found, else false.
+ */
+ private static boolean isLoginCookieExist(HttpServletRequest request) {
+ Cookie ep = getCookie(request, EP_SERVICE);
+ return (ep != null);
+ }
+
+ /**
+ * Searches the request for a cookie with the specified name.
+ *
+ * @param request
+ * @param cookieName
+ * @return Cookie, or null if not found.
+ */
+ public static Cookie getCookie(HttpServletRequest request, String cookieName) {
+ Cookie[] cookies = request.getCookies();
+ if (cookies != null)
+ for (Cookie cookie : cookies)
+ if (cookie.getName().equals(cookieName))
+ return cookie;
+
+ return null;
+ }
+
+ /**
+ * Splits a string into an array.
+ *
+ * @param str
+ * @param delimiter
+ * @return
+ */
+ private static String[] delimitedListToStringArray(String str, String delimiter) {
+ return delimitedListToStringArray(str, delimiter, null);
+ }
+
+ /**
+ * Splits a string into an array, optionally deleting characters.
+ *
+ * @param str
+ * String to be split
+ * @param delimiter
+ * Token to use as the delimiter
+ * @param charsToDelete
+ * Optional String of characters to be removed; ignored if null
+ * @return String array; empty if the input is null or delimiter are null.
+ */
+ private static String[] delimitedListToStringArray(String str, String delimiter, String charsToDelete) {
+ if (str == null)
+ return new String[0];
+ if (delimiter == null)
+ return new String[] { str };
+
+ List<String> result = new ArrayList<String>();
+ if ("".equals(delimiter)) {
+ for (int i = 0; i < str.length(); i++) {
+ result.add(deleteAny(str.substring(i, i + 1), charsToDelete));
+ }
+ } else {
+ int pos = 0;
+ int delPos = 0;
+ while ((delPos = str.indexOf(delimiter, pos)) != -1) {
+ result.add(deleteAny(str.substring(pos, delPos), charsToDelete));
+ pos = delPos + delimiter.length();
+ }
+ if (str.length() > 0 && pos <= str.length()) {
+ // Add rest of String, but not in case of empty input.
+ result.add(deleteAny(str.substring(pos), charsToDelete));
+ }
+ }
+ return toStringArray(result);
+ }
+
+ /**
+ * Convenience method that creates a string array from the items in the
+ * collection.
+ *
+ * @param collection
+ * @return
+ */
+ private static String[] toStringArray(Collection<String> collection) {
+ if (collection == null)
+ return null;
+ return (String[]) collection.toArray(new String[collection.size()]);
+ }
+
+ /**
+ * Builds a new string that has none of the characters in the charsToDelete
+ * argument.
+ *
+ * @param inString
+ * @param charsToDelete
+ * @return Input string after removing all characters in the second
+ * argument.
+ */
+ private static String deleteAny(String inString, String charsToDelete) {
+ if (!hasLength(inString) || !hasLength(charsToDelete)) {
+ return inString;
+ }
+ StringBuffer out = new StringBuffer();
+ for (int i = 0; i < inString.length(); i++) {
+ char c = inString.charAt(i);
+ if (charsToDelete.indexOf(c) == -1) {
+ out.append(c);
+ }
+ }
+ return out.toString();
+ }
+
+ /**
+ *
+ * @param str
+ * @return
+ */
+ private static boolean hasLength(String str) {
+ return (str != null && str.length() > 0);
+ }
+
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/IPortalRestAPIService.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/IPortalRestAPIService.java
new file mode 100644
index 00000000..25a8aeff
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/IPortalRestAPIService.java
@@ -0,0 +1,133 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.restful.domain.EcompRole;
+import org.openecomp.portalsdk.core.restful.domain.EcompUser;
+
+/**
+ * Defines the REST API Interface that an onboarding non-SDK (i.e., third-party)
+ * application must implement to answer queries and accept updates from the
+ * ECOMP Portal about the application's users, roles and user-role assignments.
+ *
+ * @author Ikram Ikramullah
+ */
+public interface IPortalRestAPIService {
+
+ // EcompUser Interface
+
+ /**
+ * Creates a new user.
+ *
+ * @param user
+ * Model object with attributes of user to be created.
+ * @throws PortalAPIException
+ * If any error occurs while processing the request; for
+ * example, user exists already.
+ */
+ public void pushUser(EcompUser user) throws PortalAPIException;
+
+ /**
+ * Updates an existing user's attributes.
+ *
+ * @param loginId
+ * EcompUser ID to be updated.
+ * @param user
+ * Model object with attributes of user to be updated.
+ * @throws PortalAPIException
+ * If any error occurs while processing the request; for
+ * example, unknown user.
+ */
+ public void editUser(String loginId, EcompUser user) throws PortalAPIException;
+
+ /**
+ * Gets details about an existing user.
+ *
+ * @param loginId
+ * EcompUser ID to be fetched
+ * @return Model object with user attributes.
+ * @throws PortalAPIException
+ * If any error occurs while processing the request; for
+ * example, unknown user.
+ */
+ public EcompUser getUser(String loginId) throws PortalAPIException;
+
+ /**
+ * Gets all users.
+ *
+ * @return List of user attribute model objects; empty array if none are
+ * found.
+ * @throws PortalAPIException
+ * If any error occurs while processing the request.
+ */
+ public List<EcompUser> getUsers() throws PortalAPIException;
+
+ // Roles Interface
+
+ /**
+ * Gets all defined roles.
+ *
+ * @return List of role attribute objects; empty array if none are
+ * found.
+ * @throws PortalAPIException
+ * If an unexpected error occurs while processing the request.
+ */
+ public List<EcompRole> getAvailableRoles() throws PortalAPIException;
+
+ /**
+ * Replaces existing user roles with new roles.
+ *
+ * @param loginId
+ * EcompUser ID to be updated.
+ * @param roles
+ * List of model objects with role attributes
+ * @throws PortalAPIException
+ * If any error occurs while processing the request.
+ */
+ public void pushUserRole(String loginId, List<EcompRole> roles) throws PortalAPIException;
+
+ /**
+ * Gets the roles defined for the specified user.
+ *
+ * @param loginId
+ * @return List of model objects; empty if no roles are found.
+ * @throws PortalAPIException
+ * If any error occurs while processing the request; e.g., user
+ * not found.
+ */
+ public List<EcompRole> getUserRoles(String loginId) throws PortalAPIException;
+
+ // Security Interface
+
+ /**
+ * Answers whether the request is authenticated.
+ *
+ * @param request
+ * @return true if the request contains appropriate credentials, else false.
+ * @throws PortalAPIException
+ * If an unexpected error occurs while processing the request.
+ */
+ public boolean isAppAuthenticated(HttpServletRequest request) throws PortalAPIException;
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/IPortalUebAPIService.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/IPortalUebAPIService.java
new file mode 100644
index 00000000..0b55a965
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/IPortalUebAPIService.java
@@ -0,0 +1,46 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+
+/**
+ *
+ * @author Ikram Ikramullah
+ *
+ * UEB API Interface for all the onboarding third party applications.
+ *
+ */
+
+public interface IPortalUebAPIService {
+ //User Interface
+ public String pushUser(String userJson) throws PortalAPIException;
+ public String editUser(String loginId, String userJson) throws PortalAPIException;
+ public String getUser(String loginId) throws PortalAPIException;
+ public String getUsers() throws PortalAPIException;
+
+ //Roles Interface
+ public String getAvailableRoles() throws PortalAPIException;
+ public String getAvailableFullRoles() throws PortalAPIException;
+ public String pushUserRole(String loginId, String rolesJson) throws PortalAPIException;
+ public String getUserRoles(String loginId) throws PortalAPIException;
+
+ //Security Interface
+ public boolean isAppAuthenticated(String appUserName, String appPassword) throws PortalAPIException;
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalAPIException.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalAPIException.java
new file mode 100644
index 00000000..8a4c9e4e
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalAPIException.java
@@ -0,0 +1,49 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+/**
+ * @author Ikram Ikramullah
+ */
+public class PortalAPIException extends Exception{
+
+ private static final long serialVersionUID = 4854048794984375707L;
+
+ public PortalAPIException() {
+ super();
+ }
+
+ public PortalAPIException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+
+ public PortalAPIException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public PortalAPIException(String message) {
+ super(message);
+ }
+
+ public PortalAPIException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalAPIResponse.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalAPIResponse.java
new file mode 100644
index 00000000..f8d73acc
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalAPIResponse.java
@@ -0,0 +1,58 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+/**
+ * This bean holds a response that is returned by the role and user-management
+ * REST API.
+ */
+public class PortalAPIResponse {
+
+ /**
+ * Either "ok" or "error"
+ */
+ private String status;
+ /**
+ * Optional if status is ok
+ */
+ private String message;
+
+ public PortalAPIResponse(boolean isOk, String msg) {
+ status = (isOk? "ok" : "error");
+ message = msg;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalApiConstants.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalApiConstants.java
new file mode 100644
index 00000000..667ad289
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalApiConstants.java
@@ -0,0 +1,62 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+public interface PortalApiConstants {
+ public static final String API_PREFIX = "/api";
+ public static final String PORTAL_JSESSION_ID = "PORTAL_JSESSION_ID";
+ public static final String PORTAL_JSESSION_BIND = "PORTAL_JSESSION_BIND";
+ public static final String ACTIVE_USERS_NAME = "activeUsers";
+
+ /** Portal service cookie name */
+ public static final String EP_SERVICE = "EPService";
+
+ public static final String GLOBAL_SESSION_MAX_IDLE_TIME = "global_session_max_idle_time";
+ public static final String PORTAL_SESSION_SLOT_CHECK = "portal_session_slot_check";
+ public static final String SESSION_PREVIOUS_ACCESS_TIME = "session_previous_access_time";
+ public static final String MAX_IDLE_TIME = "max.idle.time";
+
+ // Names of keys in the portal.properties file
+ public static final String PORTAL_API_IMPL_CLASS = "portal.api.impl.class";
+ public static final String ECOMP_REDIRECT_URL = "ecomp_redirect_url";
+ public static final String ECOMP_REST_URL = "ecomp_rest_url";
+
+ // UEB related
+ public static final String UEB_URL_LIST = "ueb_url_list"; // In properties file
+ public static final String ECOMP_PORTAL_INBOX_NAME = "ecomp_portal_inbox_name";
+ public static final String ECOMP_DEFAULT_MSG_ID = "0";
+ public static final String ECOMP_GENERAL_UEB_PARTITION = "EPGeneralPartition";
+ public static final String UEB_LISTENERS_ENABLE = "ueb_listeners_enable";
+ public static final String UEB_APP_INBOUND_MAILBOX_NAME = "ueb_app_mailbox_name";
+ public static final String UEB_APP_CONSUMER_GROUP_NAME = "ueb_app_consumer_group_name";
+ // UebManager generates a consumer group name for special token {UUID}
+ public static final String UEB_APP_CONSUMER_GROUP_NAME_GENERATOR = "{UUID}";
+ public static final String UEB_APP_KEY = "ueb_app_key";
+ public static final String UEB_APP_SECRET = "ueb_app_secret";
+ public static final String ECOMP_UEB_INVALID_MSG = "100: Invalid Message format.";
+ public static final String ECOMP_UEB_TIMEOUT_ERROR = "101: Timeout";
+ public static final String ECOMP_UEB_UNKNOWN_PUBLISH_ERROR = "102: Unknown error during publish";
+ public static final String ECOMP_UEB_UNKNOWN_CONSUME_ERROR = "103: Unknown error during consume";
+ public static final String USE_REST_FOR_FUNCTIONAL_MENU = "use_rest_for_functional_menu";
+
+ //encrpt key
+ public static final String Decryption_Key = "decryption_key";
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalApiProperties.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalApiProperties.java
new file mode 100644
index 00000000..b9853a9a
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalApiProperties.java
@@ -0,0 +1,98 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Singleton Class representing portal properties. Searches the classpath for
+ * the file "portal.properties".
+ *
+ * To put the file "portal.properties" on the classpath, it can be in the same
+ * directory where the first package folder is - 'myClasses' folder in the
+ * following case as an example:
+ *
+ */
+public class PortalApiProperties {
+
+ private static final Log logger = LogFactory.getLog(PortalApiProperties.class);
+
+ private static Properties properties;
+ private static String propertyFileName = "portal.properties";
+
+ /**
+ * Constructor is private.
+ */
+ private PortalApiProperties() {
+ }
+
+ /**
+ * Gets the property value for the specified key.
+ *
+ * @param property
+ * @return Value for the named property; null if the property file was not
+ * loaded or the key was not found.
+ */
+ public static String getProperty(String property) {
+ if (properties == null) {
+ synchronized (propertyFileName) {
+ try {
+ if (!initialize()) {
+ logger.error("Failed to read property file " + propertyFileName);
+ return null;
+ }
+ } catch (IOException e) {
+ logger.error("Failed to read property file " + propertyFileName, e);
+ return null;
+ }
+ }
+ }
+ return properties.getProperty(property);
+ }
+
+ /**
+ * Reads properties from a portal.properties file on the classpath.
+ *
+ * Clients DO NOT need to call this method. Clients MAY call this method to
+ * test whether the properties file can be loaded successfully.
+ *
+ * @return True if properties were successfully loaded, else false.
+ * @throws IOException
+ */
+ public static boolean initialize() throws IOException {
+ if (properties != null)
+ return true;
+ InputStream in = PortalApiProperties.class.getClassLoader().getResourceAsStream(propertyFileName);
+ if (in == null)
+ return false;
+ properties = new Properties();
+ try {
+ properties.load(in);
+ } finally {
+ in.close();
+ }
+ return true;
+ }
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalRestAPIProxy.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalRestAPIProxy.java
new file mode 100644
index 00000000..3012d1c7
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalRestAPIProxy.java
@@ -0,0 +1,498 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.openecomp.portalsdk.core.restful.domain.EcompRole;
+import org.openecomp.portalsdk.core.restful.domain.EcompUser;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * This servlet responds to ECOMP Portal API calls to query and update user,
+ * role and user-role information. It registers itself at a path like "/api"
+ * (see {@link PortalApiConstants#API_PREFIX}) and proxies all requests on to a
+ * class that implements {@link IPortalRestAPIService}, as named in the required
+ * properties file ("portal.properties"). The servlet will not start if the
+ * properties file is not found.
+ *
+ * Implements the interface solely to ensure that changes to the interface are
+ * made here also, the compiler helps catch problems that way.
+ *
+ * @author Ikram Ikramullah
+ */
+
+@WebServlet(urlPatterns = { PortalApiConstants.API_PREFIX + "/*" })
+public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPIService {
+ private static final long serialVersionUID = 1L;
+
+ private final Log logger = LogFactory.getLog(getClass());
+
+ /**
+ * JSON to object etc.
+ */
+ private final ObjectMapper mapper = new ObjectMapper();
+
+ /**
+ * Client-supplied class that implements our interface.
+ */
+ private IPortalRestAPIService portalRestApiService;
+
+ public PortalRestAPIProxy() {
+ // Ensure that any additional fields sent by the Portal
+ // will be ignored when creating objects.
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ }
+
+ @Override
+ public void init() throws ServletException {
+ String className = PortalApiProperties.getProperty(PortalApiConstants.PORTAL_API_IMPL_CLASS);
+ if (className == null)
+ throw new ServletException(
+ "init: Failed to find class name property " + PortalApiConstants.PORTAL_API_IMPL_CLASS);
+ try {
+ logger.debug("init: creating instance of class " + className);
+ Class<?> implClass = Class.forName(className);
+ portalRestApiService = (IPortalRestAPIService) (implClass.getConstructor().newInstance());
+ } catch (Exception ex) {
+ throw new ServletException("init: Failed to find or instantiate class " + className, ex);
+ }
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException {
+
+ if (portalRestApiService == null) {
+ // Should never happen due to checks in init()
+ logger.error("doPost: no service class instance");
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ response.getWriter().write(buildJsonResponse(false, "Misconfigured - no instance of service class"));
+ return;
+ }
+ boolean secure = false;
+ try {
+ secure = isAppAuthenticated(request);
+ } catch (PortalAPIException ex) {
+ logger.error("doPost: isAppAuthenticated threw exception", ex);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ response.getWriter().write(buildJsonResponse(false, "Failed to authenticate request"));
+ return;
+ }
+ if (!secure) {
+ if (logger.isDebugEnabled())
+ logger.debug("doPost: isAppAuthenticated answered false");
+ response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+ writeAndFlush(response, buildJsonResponse(false, "Not authorized"));
+ return;
+ }
+
+ String requestUri = request.getRequestURI();
+ try {
+ String requestBody = readRequestBody(request);
+ if (logger.isDebugEnabled())
+ logger.debug("doPost: URI = " + requestUri + ", payload = " + requestBody);
+
+ /*
+ * All APIs:
+ *
+ * 1. /user <-- save user
+ *
+ * 2. /user/{loginId} <-- edit user
+ *
+ * 3. /user/{loginId}/roles <-- save roles for user
+ */
+
+ // On success return the empty string.
+ String responseJson = "";
+ if (requestUri.endsWith("/updateSessionTimeOuts")) {
+ if (updateSessionTimeOuts(requestBody)) {
+ if (logger.isDebugEnabled())
+ logger.debug("doPost: updated session timeouts");
+ response.setStatus(HttpServletResponse.SC_OK);
+ } else {
+ String msg = "Failed to update session time outs";
+ logger.error("doPost: " + msg);
+ responseJson = buildJsonResponse(false, msg);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ } else if (requestUri.endsWith("/timeoutSession")) {
+ String portalJSessionId = request.getParameter("portalJSessionId");
+ if (portalJSessionId == null) {
+ portalJSessionId = "";
+ }
+ if (timeoutSession(portalJSessionId)) {
+ if (logger.isDebugEnabled())
+ logger.debug("doPost: timed out session");
+ response.setStatus(HttpServletResponse.SC_OK);
+ } else {
+ String msg = "Failed to timeout session";
+ logger.error("doPost: " + msg);
+ responseJson = buildJsonResponse(false, msg);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ } else
+ // Example: /user <-- create user
+ if (requestUri.endsWith(PortalApiConstants.API_PREFIX + "/user")) {
+ try {
+ EcompUser user = mapper.readValue(requestBody, EcompUser.class);
+ pushUser(user);
+ if (logger.isDebugEnabled())
+ logger.debug("doPost: pushUser: success");
+ responseJson = buildJsonResponse(true, null);
+ response.setStatus(HttpServletResponse.SC_OK);
+ } catch (Exception ex) {
+ responseJson = buildJsonResponse(ex);
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ logger.error("doPost: pushUser: caught exception", ex);
+ }
+ } else
+ // Example: /user/fi241c <-- edit user fi241c
+ if (requestUri.contains(PortalApiConstants.API_PREFIX + "/user/") && !(requestUri.endsWith("/roles"))) {
+ String loginId = requestUri.substring(requestUri.lastIndexOf('/') + 1);
+ try {
+ EcompUser user = mapper.readValue(requestBody, EcompUser.class);
+ editUser(loginId, user);
+ if (logger.isDebugEnabled())
+ logger.debug("doPost: editUser: success");
+ responseJson = buildJsonResponse(true, null);
+ response.setStatus(HttpServletResponse.SC_OK);
+ } catch (Exception ex) {
+ responseJson = buildJsonResponse(ex);
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ logger.error("doPost: editUser: caught exception", ex);
+ }
+ } else
+ // Example: /user/{loginId}/roles <-- save roles for user
+ if (requestUri.contains(PortalApiConstants.API_PREFIX + "/user/") && requestUri.endsWith("/roles")) {
+ String loginId = requestUri.substring(requestUri.indexOf("/user/") + ("/user").length() + 1,
+ requestUri.lastIndexOf('/'));
+ try {
+ TypeReference<List<EcompRole>> typeRef = new TypeReference<List<EcompRole>>() {
+ };
+ List<EcompRole> roles = mapper.readValue(requestBody, typeRef);
+ pushUserRole(loginId, roles);
+ if (logger.isDebugEnabled())
+ logger.debug("doPost: pushUserRole: success");
+ responseJson = buildJsonResponse(true, null);
+ response.setStatus(HttpServletResponse.SC_OK);
+ } catch (Exception ex) {
+ responseJson = buildJsonResponse(ex);
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ logger.error("doPost: pushUserRole: caught exception", ex);
+ }
+ } else {
+ logger.warn("doPost: no match for request " + requestUri);
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ }
+ writeAndFlush(response, responseJson);
+ } catch (Exception ex) {
+ logger.error("doPost: Failed to process request " + requestUri, ex);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ writeAndFlush(response, ex.toString());
+ }
+
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException {
+
+ if (portalRestApiService == null) {
+ // Should never happen due to checks in init()
+ logger.error("doGet: no service class instance");
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ writeAndFlush(response, buildJsonResponse(false, "Misconfigured - no instance of service class"));
+ return;
+ }
+ boolean secure = false;
+ try {
+ secure = isAppAuthenticated(request);
+ } catch (PortalAPIException ex) {
+ logger.error("doGet: isAppAuthenticated threw exception", ex);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ writeAndFlush(response, buildJsonResponse(false, "Failed to authenticate request"));
+ return;
+ }
+ if (!secure) {
+ if (logger.isDebugEnabled())
+ logger.debug("doGet: isAppAuthenticated answered false");
+ response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+ writeAndFlush(response, buildJsonResponse(false, "Not authorized"));
+ return;
+ }
+
+ String requestUri = request.getRequestURI();
+ try {
+ // Ignore any request body in a GET.
+ // String requestBody = readRequestBody(request);
+ if (logger.isDebugEnabled())
+ logger.debug("doGet: URI = " + requestUri);
+
+ String responseJson = "";
+ /*
+ * 1. /roles <-- get roles
+ *
+ * 2. /user/{loginId} <-- get user
+ *
+ * 3. /users <-- get all users
+ *
+ * 4. /user/{loginId}/roles <-- get roles for user
+ */
+
+ if (requestUri.endsWith("/sessionTimeOuts")) {
+ responseJson = getSessionTimeOuts();
+ if (responseJson != null && responseJson.length() > 0) {
+ if (logger.isDebugEnabled())
+ logger.debug("doGet: got session timeouts");
+ response.setStatus(HttpServletResponse.SC_OK);
+ } else {
+ String msg = "Failed to get session time outs";
+ logger.error("doGet: " + msg);
+ responseJson = buildJsonResponse(false, msg);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ } else
+ // Example: /users <-- get all users
+ if (requestUri.endsWith(PortalApiConstants.API_PREFIX + "/users")) {
+ try {
+ List<EcompUser> users = getUsers();
+ responseJson = mapper.writeValueAsString(users);
+ if (logger.isDebugEnabled())
+ logger.debug("doGet: getUsers: " + responseJson);
+ } catch (Exception ex) {
+ responseJson = buildJsonResponse(ex);
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ logger.error("doGet: getUsers: caught exception", ex);
+ }
+ } else
+ // Example: /roles <-- get all roles
+ if (requestUri.endsWith(PortalApiConstants.API_PREFIX + "/roles")) {
+ try {
+ List<EcompRole> roles = getAvailableRoles();
+ responseJson = mapper.writeValueAsString(roles);
+ if (logger.isDebugEnabled())
+ logger.debug("doGet: getAvailableRoles: " + responseJson);
+ } catch (Exception ex) {
+ responseJson = buildJsonResponse(ex);
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ logger.error("doGet: getAvailableRoles: caught exception", ex);
+ }
+ } else
+ // Example: /user/fi241c <-- get user fi241c
+ if (requestUri.contains(PortalApiConstants.API_PREFIX + "/user/") && !requestUri.endsWith("/roles")) {
+ String loginId = requestUri.substring(requestUri.lastIndexOf('/') + 1);
+ try {
+ EcompUser user = getUser(loginId);
+ responseJson = mapper.writeValueAsString(user);
+ if (logger.isDebugEnabled())
+ logger.debug("doGet: getUser: " + responseJson);
+ } catch (Exception ex) {
+ responseJson = buildJsonResponse(ex);
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ logger.error("doGet: getUser: caught exception", ex);
+ }
+ }
+ // Example: /user/fi241c/roles <-- get roles for user fi241c
+ else if (requestUri.contains(PortalApiConstants.API_PREFIX + "/user/") && requestUri.endsWith("/roles")) {
+ String loginId = requestUri.substring(requestUri.indexOf("/user/") + ("/user").length() + 1,
+ requestUri.lastIndexOf('/'));
+ try {
+ List<EcompRole> roles = getUserRoles(loginId);
+ responseJson = mapper.writeValueAsString(roles);
+ if (logger.isDebugEnabled())
+ logger.debug("doGet: getUserRoles: " + responseJson);
+ } catch (Exception ex) {
+ responseJson = buildJsonResponse(ex);
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ logger.error("doGet: getUserRoles: caught exception", ex);
+ }
+ } else {
+ logger.warn("doGet: no match found for request");
+ responseJson = buildJsonResponse(false, "No match for request");
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ }
+ writeAndFlush(response, responseJson);
+ } catch (Exception ex) {
+ logger.error("doGet: Failed to process request", ex);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ writeAndFlush(response, buildJsonResponse(ex));
+ }
+ }
+
+ public String getSessionTimeOuts() throws Exception {
+ return PortalTimeoutHandler.gatherSessionExtensions();
+ }
+
+ public boolean timeoutSession(String portalJSessionId) throws Exception {
+ return PortalTimeoutHandler.invalidateSession(portalJSessionId);
+ }
+
+ public boolean updateSessionTimeOuts(String sessionMap) throws Exception {
+ return PortalTimeoutHandler.updateSessionExtensions(sessionMap);
+ }
+
+ @Override
+ public void pushUser(EcompUser user) throws PortalAPIException {
+ portalRestApiService.pushUser(user);
+ }
+
+ @Override
+ public void editUser(String loginId, EcompUser user) throws PortalAPIException {
+ portalRestApiService.editUser(loginId, user);
+ }
+
+ @Override
+ public EcompUser getUser(String loginId) throws PortalAPIException {
+ return portalRestApiService.getUser(loginId);
+ }
+
+ @Override
+ public List<EcompUser> getUsers() throws PortalAPIException {
+ return portalRestApiService.getUsers();
+ }
+
+ @Override
+ public List<EcompRole> getAvailableRoles() throws PortalAPIException {
+ return portalRestApiService.getAvailableRoles();
+ }
+
+ @Override
+ public void pushUserRole(String loginId, List<EcompRole> roles) throws PortalAPIException {
+ portalRestApiService.pushUserRole(loginId, roles);
+ }
+
+ @Override
+ public List<EcompRole> getUserRoles(String loginId) throws PortalAPIException {
+ return portalRestApiService.getUserRoles(loginId);
+ }
+
+ @Override
+ public boolean isAppAuthenticated(HttpServletRequest request) throws PortalAPIException {
+ return portalRestApiService.isAppAuthenticated(request);
+ }
+
+ private void writeAndFlush(HttpServletResponse response, String jsonResponse) throws IOException {
+ response.setContentType("application/json");
+ PrintWriter out = response.getWriter();
+ out.print(jsonResponse);
+ out.flush();
+ }
+
+ /**
+ * Reads the request body and closes the input stream.
+ *
+ * @param request
+ * @return String read from the request, the empty string if nothing is
+ * read.
+ * @throws IOException
+ */
+ private static String readRequestBody(HttpServletRequest request) throws IOException {
+
+ String body = null;
+ StringBuilder stringBuilder = new StringBuilder();
+ BufferedReader bufferedReader = null;
+ try {
+ InputStream inputStream = request.getInputStream();
+ if (inputStream != null) {
+ bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
+ char[] charBuffer = new char[1024];
+ int bytesRead = -1;
+ while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
+ stringBuilder.append(charBuffer, 0, bytesRead);
+ }
+ } else {
+ stringBuilder.append("");
+ }
+ } finally {
+ if (bufferedReader != null) {
+ try {
+ bufferedReader.close();
+ } catch (IOException ex) {
+ throw ex;
+ }
+ }
+ }
+ body = stringBuilder.toString();
+ return body;
+ }
+
+ /**
+ * Builds JSON object with status + message response body.
+ *
+ * @param success
+ * True to indicate success, false to signal failure.
+ * @param msg
+ * Message to include in the response object; ignored if null.
+ * @return
+ *
+ * <pre>
+ * { "status" : "ok" (or "error"), "message": "some explanation" }
+ * </pre>
+ */
+ private String buildJsonResponse(boolean success, String msg) {
+ PortalAPIResponse response = new PortalAPIResponse(success, msg);
+ String json = null;
+ try {
+ json = mapper.writeValueAsString(response);
+ } catch (JsonProcessingException ex) {
+ // Truly should never, ever happen
+ json = "{ \"status\": \"error\",\"message\":\"" + ex.toString() + "\" }";
+ }
+ return json;
+ }
+
+ /**
+ * Builds JSON object with status of error and message containing stack
+ * trace for the specified throwable.
+ *
+ * @param t
+ * Throwable with stack trace to use as message
+ * @return
+ *
+ * <pre>
+ * { "status" : "error", "message": "some-big-stacktrace" }
+ * </pre>
+ */
+ private String buildJsonResponse(Throwable t) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ t.printStackTrace(pw);
+ return buildJsonResponse(false, sw.toString());
+ }
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutBindingListener.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutBindingListener.java
new file mode 100644
index 00000000..906b7e88
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutBindingListener.java
@@ -0,0 +1,52 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+import java.io.Serializable;
+
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSessionBindingListener;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class PortalTimeoutBindingListener implements HttpSessionBindingListener, Serializable {
+
+ private final Log logger = LogFactory.getLog(getClass());
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void valueBound(HttpSessionBindingEvent event) {
+ final HttpSession session = event.getSession();
+ PortalTimeoutHandler.sessionMap.put((String) session.getAttribute(PortalApiConstants.PORTAL_JSESSION_ID),
+ session);
+ }
+
+ @Override
+ public void valueUnbound(HttpSessionBindingEvent event) {
+ final HttpSession session = event.getSession();
+ String portalJSessionId = (String) session.getAttribute(PortalApiConstants.PORTAL_JSESSION_ID);
+ logger.debug(portalJSessionId + " getting removed");
+ PortalTimeoutHandler.sessionMap.remove(portalJSessionId);
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutHandler.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutHandler.java
new file mode 100644
index 00000000..09166794
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutHandler.java
@@ -0,0 +1,419 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+import java.util.Calendar;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * Invoked by listeners (UserContextListener and UserSessionListener) to track
+ * user sessions.
+ */
+public class PortalTimeoutHandler {
+
+ protected static final SessionCommInf sessionComm = new SessionComm();
+
+
+
+ public interface SessionCommInf {
+ public Integer fetchSessionSlotCheckInterval(String... params) throws Exception;
+
+ public void extendSessionTimeOuts(String... sessionMap) throws Exception;
+ }
+
+ public static class SessionComm implements SessionCommInf {
+ public Integer fetchSessionSlotCheckInterval(String... params) throws Exception {
+
+ String ecompRestURL = params[0];
+ String userName = params[1];
+ String pwd = params[2];
+ String uebKey = params[3];
+
+ String sessionSlot = SessionCommunication.getSessionSlotCheckInterval(ecompRestURL, userName, pwd, uebKey);
+ if(sessionSlot == null)
+ return null;
+ return Integer.parseInt(sessionSlot);
+ }
+
+ public void extendSessionTimeOuts(String... params) throws Exception {
+
+ String ecompRestURL = params[0];
+ String userName = params[1];
+ String pwd = params[2];
+ String uebKey = params[3];
+ String sessionTimeoutMap = params[4];
+
+ SessionCommunication.requestPortalSessionTimeoutExtension(ecompRestURL, userName, pwd, uebKey, sessionTimeoutMap);
+ }
+ }
+
+
+
+ public static final Map<String, HttpSession> sessionMap = new Hashtable<String, HttpSession>();
+ public static final Integer repeatInterval = 15 * 60; // 15 minutes
+ protected static final Log logger = LogFactory.getLog(PortalTimeoutHandler.class);
+ static ObjectMapper mapper = new ObjectMapper();
+ private static PortalTimeoutHandler timeoutHandler;
+
+ public static PortalTimeoutHandler getInstance() {
+ if (timeoutHandler == null)
+ timeoutHandler = new PortalTimeoutHandler();
+
+ return timeoutHandler;
+ }
+
+ /**
+ * TODO: remove static
+ *
+ * @param portalJSessionId
+ * @param jSessionId
+ * @param session
+ */
+ public static void sessionCreated(String portalJSessionId, String jSessionId, HttpSession session) {
+
+ storeMaxInactiveTime(session);
+
+ // this key is a combination of portal jsession id and app session id
+ String jSessionKey = jSessionKey(jSessionId, portalJSessionId);
+ Object jSessionKeySessionVal = session.getAttribute(PortalApiConstants.PORTAL_JSESSION_ID);
+
+ // do not reset the attributes if the same values have already been set
+ // because that will cause PortalTimeoutBindingListener to unbound the value from map
+ if(jSessionKeySessionVal != null && jSessionKeySessionVal.equals(jSessionKey)) {
+ logger.debug(" Session Values already exist in te map for sessionKey " + jSessionKey);
+ return;
+ }
+
+ session.setAttribute(PortalApiConstants.PORTAL_JSESSION_ID, jSessionKey);
+
+ // session binding listener will add this value to the static map
+ // and with session replication the listener will fire in all tomcat
+ // instances
+ session.setAttribute(PortalApiConstants.PORTAL_JSESSION_BIND, new PortalTimeoutBindingListener());
+ // sessionMap.put((String)session.getAttribute(PortalApiConstants.PORTAL_JSESSION_ID),
+ // session);
+
+ }
+
+ /**
+ * TODO: remove static
+ *
+ * @param session
+ */
+ protected static void storeMaxInactiveTime(HttpSession session) {
+ if (session.getAttribute(PortalApiConstants.GLOBAL_SESSION_MAX_IDLE_TIME) == null)
+ session.setAttribute(PortalApiConstants.GLOBAL_SESSION_MAX_IDLE_TIME, session.getMaxInactiveInterval());
+ }
+
+ /**
+ * TODO: remove static
+ *
+ * @param session
+ */
+ public static void sessionDestroyed(HttpSession session) {
+ try {
+ logger.info(" Session getting destroyed - id: " + session.getId());
+ session.removeAttribute(PortalApiConstants.PORTAL_JSESSION_BIND);
+ // sessionMap.remove((String)session.getAttribute(PortalApiConstants.PORTAL_JSESSION_ID));
+ } catch (Exception e) {
+ logger.error("Error while destroy user session" + e.getMessage());
+ }
+ }
+
+ /***
+ * TODO: remove static
+ *
+ * @param portalJSessionId
+ * @return true on success, false if the session cannot be found, etc.
+ */
+ public static boolean invalidateSession(String portalJSessionId) {
+ boolean result = false;
+ logger.debug("Session Management: request from Portal to invalidate the session: " + portalJSessionId);
+ for (String jSessionKey : sessionMap.keySet()) {
+ try {
+ HttpSession session = sessionMap.get(jSessionKey);
+ if (portalJSessionId(jSessionKey).equals(portalJSessionId)) {
+ session.invalidate();
+ result = true;
+ }
+ } catch (Exception e) {
+ logger.error("Session Management: Error when invalidating session", e);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * TODO: remove static
+ *
+ * @return json version of the timeout map: session ID -> timeout object
+ */
+ public static String gatherSessionExtensions() {
+ logger.debug("Session Management: gatherSessionExtensions");
+
+ Map<String, PortalTimeoutVO> sessionTimeoutMap = new Hashtable<String, PortalTimeoutVO>();
+ String jsonMap = "";
+
+ for (String jSessionKey : sessionMap.keySet()) {
+
+ try {
+ // get the expirytime in seconds
+ HttpSession session = sessionMap.get(jSessionKey);
+
+ Long lastAccessedTimeMilliSec = session.getLastAccessedTime();
+ Long maxIntervalMilliSec = session.getMaxInactiveInterval() * 1000L;
+ // Long currentTimeMilliSec =
+ // Calendar.getInstance().getTimeInMillis() ;
+ // (maxIntervalMilliSec - (currentTimeMilliSec -
+ // lastAccessedTimeMilliSec) + ;
+ Calendar instance = Calendar.getInstance();
+ instance.setTimeInMillis(session.getLastAccessedTime());
+ logger.debug("Session Management: Last Accessed time for " + jSessionKey + ": " + instance.getTime());
+
+ Long sessionTimOutMilliSec = maxIntervalMilliSec + lastAccessedTimeMilliSec;
+
+ sessionTimeoutMap.put(portalJSessionId(jSessionKey),
+ getSingleSessionTimeoutObj(jSessionKey, sessionTimOutMilliSec));
+ logger.debug("Session Management: putting session in map " + jSessionKey + " sessionTimoutSec"
+ + (int) (sessionTimOutMilliSec / 1000));
+
+ jsonMap = mapper.writeValueAsString(sessionTimeoutMap);
+
+ } catch (Exception e) {
+ logger.error("Session Management: Error during JsonSessionTimout conversion", e);
+ }
+
+ }
+
+ return jsonMap;
+
+ }
+
+ /**
+ * TODO: remove static
+ *
+ * @param sessionTimeoutMapStr
+ * @return true on success, false otherwise
+ * @throws Exception
+ */
+ public static boolean updateSessionExtensions(String sessionTimeoutMapStr) throws Exception {
+ logger.debug("Session Management: updateSessionExtensions");
+ // Map<String,Object> sessionTimeoutMap =
+ // mapper.readValue(sessionTimeoutMapStr, Map.class);
+ Map<String, PortalTimeoutVO> sessionTimeoutMap = null;
+
+ try {
+ TypeReference<Hashtable<String, PortalTimeoutVO>> typeRef = new TypeReference<Hashtable<String, PortalTimeoutVO>>() {
+ };
+ sessionTimeoutMap = mapper.readValue(sessionTimeoutMapStr, typeRef);
+ } catch (Exception e) {
+ logger.error("Session Management:error when try to parse the sessionTimeoutMap from portal");
+ return false;
+ }
+
+ boolean result = true;
+ for (String jPortalSessionId : sessionTimeoutMap.keySet()) {
+ try {
+ PortalTimeoutVO extendedTimeoutVO = mapper.readValue(
+ mapper.writeValueAsString(sessionTimeoutMap.get(jPortalSessionId)), PortalTimeoutVO.class);
+ HttpSession session = sessionMap.get(jSessionKey(extendedTimeoutVO.getjSessionId(), jPortalSessionId));
+
+ if (session == null) {
+ continue;
+ }
+
+ Long lastAccessedTimeMilliSec = session.getLastAccessedTime();
+ Long maxIntervalMilliSec = session.getMaxInactiveInterval() * 1000L;
+ Long sessionTimOutMilliSec = maxIntervalMilliSec + lastAccessedTimeMilliSec;
+
+ Long maxTimeoutTimeMilliSec = extendedTimeoutVO.getSessionTimOutMilliSec();
+ if (maxTimeoutTimeMilliSec > sessionTimOutMilliSec) {
+ session.setMaxInactiveInterval((int) (maxTimeoutTimeMilliSec - lastAccessedTimeMilliSec) / 1000);
+ logger.debug("Session Management: extended session for :" + session.getId() + " to :"
+ + (int) (maxTimeoutTimeMilliSec / 1000));
+ // System.out.println("!!!!!!!!!extended session for :" +
+ // session.getId() + " to :" +
+ // (int)(maxTimeoutTimeMilliSec/1000));
+ }
+ } catch (Exception e) {
+ logger.error("Session Management: error while updating the sessionTimeout" + e.getMessage());
+ // Signal a problem if any one of them fails
+ result = false;
+ }
+
+ }
+ return result;
+ }
+
+ /**
+ * TODO: Remove static
+ *
+ * @param request
+ * @param userName
+ * @param pwd
+ * @param ecompRestURL
+ * @param _sessionComm
+ */
+ public static void handleSessionUpdatesNative(HttpServletRequest request, String userName, String pwd, String uebKey,
+ String ecompRestURL, SessionCommInf _sessionComm) {
+
+ if (_sessionComm == null) {
+ _sessionComm = sessionComm;
+ }
+ try {
+ synchronizeSessionForLastMinuteRequests(request, ecompRestURL, userName, pwd, uebKey, _sessionComm);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ resetSessionMaxIdleTimeOut(request);
+ }
+
+ /**
+ * TODO: remove Static
+ *
+ * @param request
+ * @param ecompRestURL
+ * @param userName
+ * @param pwd
+ * @param _sessionComm
+ * @throws JsonProcessingException
+ * @throws Exception
+ */
+ public static void synchronizeSessionForLastMinuteRequests(HttpServletRequest request, String ecompRestURL,
+ String userName, String pwd, String uebKey, SessionCommInf _sessionComm) throws JsonProcessingException, Exception {
+
+ HttpSession session = request.getSession(false);
+ if (session == null)
+ return;
+
+ Object portalSessionSlotCheckObj = session.getServletContext()
+ .getAttribute(PortalApiConstants.PORTAL_SESSION_SLOT_CHECK);
+ Integer portalSessionSlotCheckinMilliSec = 5 * 60 * 1000; // (5 minutes)
+ if (portalSessionSlotCheckObj != null) {
+ portalSessionSlotCheckinMilliSec = Integer.valueOf(portalSessionSlotCheckObj.toString());
+ } else {
+ portalSessionSlotCheckObj = _sessionComm
+ .fetchSessionSlotCheckInterval(new String[] { ecompRestURL, userName, pwd, uebKey });
+ logger.debug("Fetching Portal Session Slot Object: " + portalSessionSlotCheckObj);
+ if (portalSessionSlotCheckObj != null) {
+ portalSessionSlotCheckinMilliSec = Integer.valueOf(portalSessionSlotCheckObj.toString());
+ session.getServletContext().setAttribute(PortalApiConstants.PORTAL_SESSION_SLOT_CHECK,
+ portalSessionSlotCheckinMilliSec);
+ }
+ }
+
+ Object previousToLastAccessTimeObj = session.getAttribute(PortalApiConstants.SESSION_PREVIOUS_ACCESS_TIME);
+ final long lastAccessedTimeMilliSec = session.getLastAccessedTime();
+ if (previousToLastAccessTimeObj == null) {
+ previousToLastAccessTimeObj = lastAccessedTimeMilliSec;
+ session.setAttribute(PortalApiConstants.SESSION_PREVIOUS_ACCESS_TIME, previousToLastAccessTimeObj);
+ } else {
+ Long previousToLastAccessTime = (Long) previousToLastAccessTimeObj;
+ final int maxIntervalMilliSec = session.getMaxInactiveInterval() * 1000;
+ if (maxIntervalMilliSec
+ - (lastAccessedTimeMilliSec - previousToLastAccessTime) <= portalSessionSlotCheckinMilliSec) {
+
+ String jSessionKey = (String) session.getAttribute(PortalApiConstants.PORTAL_JSESSION_ID);
+ Map<String, PortalTimeoutVO> sessionTimeoutMap = new Hashtable<String, PortalTimeoutVO>();
+ Long sessionTimOutMilliSec = maxIntervalMilliSec + lastAccessedTimeMilliSec;
+
+ sessionTimeoutMap.put(PortalTimeoutHandler.portalJSessionId(jSessionKey),
+ PortalTimeoutHandler.getSingleSessionTimeoutObj(jSessionKey, sessionTimOutMilliSec));
+ String jsonMap = mapper.writeValueAsString(sessionTimeoutMap);
+ logger.debug("Extension requested for all the Apps and Portal; JessionKey: " + jSessionKey
+ + "; SessionMap: " + sessionTimeoutMap);
+ _sessionComm.extendSessionTimeOuts(new String[] { ecompRestURL, userName, pwd, uebKey, jsonMap });
+ }
+
+ }
+ }
+
+ /**
+ * TODO: remove static
+ *
+ * @param request
+ */
+ public static void resetSessionMaxIdleTimeOut(HttpServletRequest request) {
+ try {
+ HttpSession session = request.getSession(false);
+ if (session == null)
+ return;
+
+ final Object maxIdleAttribute = session.getAttribute(PortalApiConstants.GLOBAL_SESSION_MAX_IDLE_TIME);
+ if (maxIdleAttribute != null) {
+ session.setMaxInactiveInterval(Integer.parseInt(maxIdleAttribute.toString()));
+ }
+
+ } catch (Exception e) {
+ logger.error("Could not reset the session timeout", e);
+ }
+
+ }
+
+ /**
+ *
+ * @param jSessionKey
+ * @param sessionTimOutMilliSec
+ * @return
+ */
+ private static PortalTimeoutVO getSingleSessionTimeoutObj(String jSessionKey, Long sessionTimOutMilliSec) {
+ return new PortalTimeoutVO(jSessionId(jSessionKey), sessionTimOutMilliSec);
+ }
+
+ /**
+ *
+ * @param jSessionId
+ * @param portalJSessionId
+ * @return
+ */
+ private static String jSessionKey(String jSessionId, String portalJSessionId) {
+ return portalJSessionId + "-" + jSessionId;
+ }
+
+ /**
+ *
+ * @param jSessionKey
+ * @return
+ */
+ private static String portalJSessionId(String jSessionKey) {
+ return jSessionKey.split("-")[0];
+ }
+
+ /**
+ *
+ * @param jSessionKey
+ * @return
+ */
+ private static String jSessionId(String jSessionKey) {
+ return jSessionKey.split("-")[1];
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutVO.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutVO.java
new file mode 100644
index 00000000..af6eab8a
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutVO.java
@@ -0,0 +1,63 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+public class PortalTimeoutVO implements Comparable<PortalTimeoutVO>{
+
+ private String jSessionId;
+ private Long sessionTimOutMilliSec;
+
+ public PortalTimeoutVO(){
+
+ }
+
+ public PortalTimeoutVO(String _jSessionId, Long _sessionTimOutMilliSec) {
+ setjSessionId(_jSessionId);
+ setSessionTimOutMilliSec(_sessionTimOutMilliSec);
+
+ }
+
+ public String getjSessionId() {
+ return jSessionId;
+ }
+
+ public void setjSessionId(String jSessionId) {
+ this.jSessionId = jSessionId;
+ }
+
+ public Long getSessionTimOutMilliSec() {
+ return sessionTimOutMilliSec;
+ }
+
+ public void setSessionTimOutMilliSec(Long sessionTimOutMilliSec) {
+ this.sessionTimOutMilliSec = sessionTimOutMilliSec;
+ }
+
+ @Override
+ public int compareTo(PortalTimeoutVO o) {
+ return sessionTimOutMilliSec.compareTo(o.sessionTimOutMilliSec);
+ }
+
+
+
+
+
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/SessionCommunication.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/SessionCommunication.java
new file mode 100644
index 00000000..44178570
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/SessionCommunication.java
@@ -0,0 +1,161 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class SessionCommunication {
+
+ protected static final Log logger = LogFactory.getLog(SessionCommunication.class);
+
+ /**
+ * Calls the ECOMP Portal to retrieve the session slot check interval.
+ *
+ * @param ecompRestURL
+ * @param userName
+ * application user name used for authentication at Portal
+ * @param password
+ * application password used for authentication at Portal
+ * @param uebKey
+ * application UEB key (basically application ID) used for
+ * authentication at Portal
+ * @return Content read from the remote REST endpoint
+ */
+ public static String getSessionSlotCheckInterval(String ecompRestURL, String userName, String password,
+ String uebKey) {
+ try {
+ String url = ecompRestURL + "/getSessionSlotCheckInterval";
+
+ URL obj = new URL(url);
+
+ HttpURLConnection con = (HttpURLConnection) obj.openConnection();
+
+ // optional default is GET
+ con.setRequestMethod("GET");
+ con.setConnectTimeout(3000);
+ con.setReadTimeout(8000);
+ // add request header
+ con.setRequestProperty("username", userName);
+ con.setRequestProperty("password", password);
+ con.setRequestProperty("uebkey", uebKey);
+
+ int responseCode = con.getResponseCode();
+ if (logger.isDebugEnabled()) {
+ logger.debug("getSessionSlotCheckInterval: Sending 'GET' request to URL : " + url);
+ logger.debug("getSessionSlotCheckInterval: Response Code : " + responseCode);
+ }
+
+ StringBuffer response = new StringBuffer();
+
+ BufferedReader in = null;
+ try {
+ in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));
+ String inputLine;
+ while ((inputLine = in.readLine()) != null)
+ response.append(inputLine);
+ } finally {
+ in.close();
+ }
+ return response.toString();
+ } catch (Exception e) {
+ logger.error("getSessionSlotCheckInterval: failed to fetch the session slot check", e);
+ return null;
+ }
+
+ }
+
+ /**
+ * Calls the ECOMP Portal to request an extension of the current session.
+ *
+ * @param ecompRestURL
+ * @param userName
+ * application user name used for authentication at Portal
+ * @param password
+ * application password used for authentication at Portal
+ * @param uebKey
+ * application UEB key (basically application ID) used for
+ * authentication at Portal
+ * @param sessionTimeoutMap
+ * @return Content read from the remote REST endpoint
+ * @throws Exception
+ */
+ public static String requestPortalSessionTimeoutExtension(String ecompRestURL, String userName, String password,
+ String uebKey, String sessionTimeoutMap) throws Exception {
+
+ try {
+
+ String url = ecompRestURL + "/extendSessionTimeOuts";
+ // String decreptedPwd =
+ // app.appPassword;//CipherUtil.decrypt(encriptedPwdDB,
+ // SystemProperties.getProperty(SystemProperties.SECRET_KEY));
+
+ URL obj = new URL(url);
+
+ HttpURLConnection con = (HttpURLConnection) obj.openConnection();
+
+ con.setRequestMethod("POST");
+ con.setConnectTimeout(3000);
+ con.setReadTimeout(15000);
+
+ // add request header
+ con.setRequestProperty("username", userName);
+ con.setRequestProperty("password", password);
+ con.setRequestProperty("uebkey", uebKey);
+ con.setRequestProperty("sessionMap", sessionTimeoutMap);
+ con.setDoInput(true);
+ con.setDoOutput(true);
+ con.getOutputStream().write(sessionTimeoutMap.getBytes());
+ con.getOutputStream().flush();
+ con.getOutputStream().close();
+
+ // con.set
+
+ int responseCode = con.getResponseCode();
+ if (logger.isDebugEnabled()) {
+ logger.debug("requestPortalSessionTimeoutExtension: Sending 'GET' request to URL : " + url);
+ logger.debug("requestPortalSessionTimeoutExtension: Response Code : " + responseCode);
+ }
+
+ StringBuffer response = new StringBuffer();
+ BufferedReader in = null;
+ try {
+ in = new BufferedReader(new InputStreamReader(con.getInputStream()));
+ String inputLine;
+ while ((inputLine = in.readLine()) != null) {
+ response.append(inputLine);
+ }
+ } finally {
+ in.close();
+ }
+ return response.toString();
+ } catch (Exception e) {
+ logger.error("requestPortalSessionTimeoutExtension: failed to request Portal to extend time out ", e);
+ return null;
+ }
+
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/UserContextListener.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/UserContextListener.java
new file mode 100644
index 00000000..ea346f1e
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/UserContextListener.java
@@ -0,0 +1,52 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+import java.util.HashMap;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+import javax.servlet.http.HttpSession;
+
+@WebListener
+public class UserContextListener implements ServletContextListener{
+
+ public void contextInitialized(ServletContextEvent event){
+ ServletContext context = event.getServletContext();
+ //
+ // instanciate a map to store references to all the active
+ // sessions and bind it to context scope.
+ //
+ HashMap<String, HttpSession> activeUsers = new HashMap<String, HttpSession>();
+ context.setAttribute(PortalApiConstants.ACTIVE_USERS_NAME, activeUsers);
+ }
+
+ /**
+ * Needed for the ServletContextListener interface.
+ */
+ public void contextDestroyed(ServletContextEvent event){
+ // To overcome the problem with losing the session references
+ // during server restarts, put code here to serialize the
+ // activeUsers HashMap. Then put code in the contextInitialized
+ // method that reads and reloads it if it exists...
+ }
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/UserSessionListener.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/UserSessionListener.java
new file mode 100644
index 00000000..b468851d
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/UserSessionListener.java
@@ -0,0 +1,84 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.crossapi;
+
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.annotation.WebListener;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Listens to session-create and session-destroy events.
+ */
+@WebListener
+public class UserSessionListener implements HttpSessionListener {
+
+ private Log logger = LogFactory.getLog(getClass());
+
+ public static Map<String, HttpSession> activeSessions = new Hashtable<String, HttpSession>();
+
+ public void init(ServletConfig config) {
+ }
+
+ /**
+ * Adds sessions to the context-scoped HashMap when they begin.
+ */
+ public void sessionCreated(HttpSessionEvent event) {
+ HttpSession session = event.getSession();
+ ServletContext context = session.getServletContext();
+ @SuppressWarnings("unchecked")
+ HashMap<String, HttpSession> activeUsers = (HashMap<String, HttpSession>) context
+ .getAttribute(PortalApiConstants.ACTIVE_USERS_NAME);
+ if (activeUsers != null)
+ activeUsers.put(session.getId(), session);
+ context.setAttribute(PortalApiConstants.ACTIVE_USERS_NAME, activeUsers);
+ activeSessions.put(session.getId(), session);
+ session.getServletContext().setAttribute(PortalApiConstants.MAX_IDLE_TIME, session.getMaxInactiveInterval());
+ }
+
+ /**
+ * Removes sessions from the context-scoped HashMap when they expire or are
+ * invalidated.
+ */
+ public void sessionDestroyed(HttpSessionEvent event) {
+ try {
+ HttpSession session = event.getSession();
+ ServletContext context = session.getServletContext();
+ @SuppressWarnings("unchecked")
+ HashMap<String, HttpSession> activeUsers = (HashMap<String, HttpSession>) context
+ .getAttribute(PortalApiConstants.ACTIVE_USERS_NAME);
+ if (activeUsers != null)
+ activeUsers.remove(session.getId());
+ activeSessions.remove(session.getId());
+ PortalTimeoutHandler.sessionDestroyed(session);
+ } catch (Exception e) {
+ logger.warn(e.getMessage(), e);
+ }
+ }
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FavoritesClient.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FavoritesClient.java
new file mode 100644
index 00000000..9dce0221
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FavoritesClient.java
@@ -0,0 +1,51 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.rest;
+
+/**
+ * Provides a convenience method for fetching the favorites for a user from the
+ * ECOMP Portal.
+ */
+public class FavoritesClient {
+
+ /**
+ * Fetches the favorites data from portal
+ *
+ * @param userId
+ * userId value that it should be using to fetch the
+ * data
+ * @param appName
+ * Application name for logging etc.
+ * @param requestId
+ * 128-bit UUID value to uniquely identify the transaction; if null, a new one is generated.
+ * @param appUserName
+ * REST API user-name
+ * @param appPassword
+ * REST API decrypted password
+ * @return JSON with favorites
+ * @throws Exception
+ * on any failure
+ */
+ public static String getFavorites(String userId, String appName, String requestId, String appUserName,
+ String appPassword) throws Exception {
+ return RestWebServiceClient.getInstance().getPortalContent("/getFavorites", userId, appName, requestId, appUserName,
+ appPassword);
+ }
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FunctionalMenuClient.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FunctionalMenuClient.java
new file mode 100644
index 00000000..8e12b33b
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FunctionalMenuClient.java
@@ -0,0 +1,54 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.rest;
+
+/**
+ * Provides a convenience method for fetching the functional menu for a user
+ * from the ECOMP Portal via UEB.
+ */
+public class FunctionalMenuClient {
+
+ /**
+ * Fetches the functional menu data from the configured ECOMP Portal
+ * instance.
+ *
+ * @param userId
+ * userId for the user to whom the menu will be shown
+ * @param appName
+ * Application name for logging etc.
+ * @param requestId
+ * 128-bit UUID value to uniquely identify the transaction; if
+ * null, a new one is generated.
+ * @param appUserName
+ * REST API user name, used by Portal to authenticate the request
+ * @param appPassword
+ * REST API password (in the clear, not encrypted), used by
+ * Portal to authenticate the request
+ * @return JSON with functional menu
+ * @throws Exception
+ * on any failure
+ */
+ public static String getFunctionalMenu(String userId, String appName, String requestId, String appUserName,
+ String appPassword) throws Exception {
+ return RestWebServiceClient.getInstance().getPortalContent("/functionalMenuItemsForUser", userId, appName,
+ requestId, appUserName, appPassword);
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java
new file mode 100644
index 00000000..fc5ce872
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java
@@ -0,0 +1,178 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.rest;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.UUID;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
+
+public class RestWebServiceClient {
+
+ private final Log logger = LogFactory.getLog(RestWebServiceClient.class);
+
+ /**
+ * Singleton instance
+ */
+ private static RestWebServiceClient instance = null;
+
+ /**
+ * Constructor is private. Clients should obtain an instance via
+ * getInstance().
+ */
+ private RestWebServiceClient() {
+ }
+
+ /**
+ * Gets the static instance of RestWebServiceClient; creates it if
+ * necessary. Synchronized to be thread safe.
+ *
+ * @return Static instance of RestWebServiceClient.
+ */
+ public static synchronized RestWebServiceClient getInstance() {
+ if (instance == null)
+ instance = new RestWebServiceClient();
+ return instance;
+ }
+
+ /**
+ * Convenience method that fetches the URL for the Portal REST API endpoint
+ * and the application UEB key, then calls
+ * {@link #get(String, String, String, String, String, String, String)} to
+ * access the Portal's REST endpoint.
+ *
+ * @param restPath
+ * Partial path of the endpoint; e.g., "/specialRestService"
+ * @param userId
+ * userId for the user originating the request
+ * @param appName
+ * Application Name for logging.
+ * @param requestId
+ * 128-bit UUID value to uniquely identify the transaction.
+ * @param appUserName
+ * REST API user name for Portal to authenticate the request
+ * @param appPassword
+ * REST API password (in the clear, not encrypted) for Portal to
+ * authenticate the request
+ * @return Content from REST endpoint
+ * @throws Exception
+ * on any failure
+ */
+ public String getPortalContent(String restPath, String userId, String appName, String requestId, String appUserName,
+ String appPassword) throws Exception {
+ String restURL = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REST_URL);
+ if (restURL == null) {
+ // should never happen
+ String msg = "getPortalContent: failed to get property " + PortalApiConstants.ECOMP_REST_URL;
+ logger.error(msg);
+ throw new Exception(msg);
+ }
+ String appUebKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY);
+ if (appUebKey == null) {
+ // should never happen
+ String msg = "getPortalContent: failed to get property " + PortalApiConstants.UEB_APP_KEY;
+ logger.error(msg);
+ throw new Exception(msg);
+ }
+ final String restEndpointUrl = restURL + restPath;
+ return get(restEndpointUrl, userId, appName, requestId, appUebKey, appUserName, appPassword);
+ }
+
+ /**
+ * Makes a call to a Portal REST API using the specified URL and parameters.
+ *
+ * @param url
+ * Complete URL of the REST endpoint.
+ * @param loginId
+ * User that it should be fetching the data
+ * @param appName
+ * Application name for logging; if null or empty, defaulted to
+ * Unknown.
+ * @param requestId
+ * 128-bit UUID value to uniquely identify the transaction; if
+ * null or empty, one is generated.
+ * @param appUebKey
+ * Unique key for the application, used by Portal to authenticate
+ * the request
+ * @param appUserName
+ * REST API user name, used by Portal to authenticate the request
+ * @param appPassword
+ * REST API password, used by Portal to authenticate the request
+ * @return Content from REST endpoint
+ * @throws Exception
+ * On any failure; e.g., unknown host.
+ */
+ public String get(String url, String loginId, String appName, String requestId, String appUebKey,
+ String appUserName, String appPassword) throws Exception {
+
+ logger.debug("RestWebServiceClient.get (" + url + ") operation is started.");
+ if (appName == null || appName.trim().length() == 0)
+ appName = "Unknown";
+ if (requestId == null || requestId.trim().length() == 0)
+ requestId = UUID.randomUUID().toString();
+
+ URL obj = new URL(url);
+ // Create the connection object
+ HttpURLConnection con = (HttpURLConnection) obj.openConnection();
+ con.setRequestMethod("GET");
+ con.setConnectTimeout(3000);
+ con.setReadTimeout(8000);
+
+ // add request header
+ con.setRequestProperty("uebkey", appUebKey);
+ con.setRequestProperty("username", appUserName);
+ con.setRequestProperty("password", appPassword);
+ con.setRequestProperty("LoginId", loginId);
+ con.setRequestProperty("user-agent", appName);
+ con.setRequestProperty("X-ECOMP-RequestID", requestId);
+
+ int responseCode = con.getResponseCode();
+ logger.debug("get: received response code '" + responseCode + "' while getting the '" + url + "' for user: "
+ + loginId);
+
+ StringBuffer sb = new StringBuffer();
+ BufferedReader in = null;
+ try {
+ in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));
+ String inputLine = null;
+ while ((inputLine = in.readLine()) != null)
+ sb.append(inputLine);
+ } finally {
+ try {
+ if (in != null)
+ in.close();
+ } catch (IOException ex) {
+ logger.error("get: failed to close reader", ex);
+ }
+ }
+
+ final String response = sb.toString();
+ if (logger.isDebugEnabled())
+ logger.debug("get: url " + url + " yielded " + response);
+ return response;
+ }
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Consumer.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Consumer.java
new file mode 100644
index 00000000..bb152294
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Consumer.java
@@ -0,0 +1,164 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.ueb;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.util.LinkedList;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
+
+import com.att.nsa.cambria.client.CambriaClientBuilders;
+import com.att.nsa.cambria.client.CambriaClientFactory;
+import com.att.nsa.cambria.client.CambriaConsumer;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * Provides a consumer that reads messages from a UEB topic. Intended to be
+ * passed to a separate thread as its runnable object.
+ *
+ */
+public class Consumer implements Runnable {
+
+ private final Log logger = LogFactory.getLog(getClass());
+
+ private final LinkedList<String> urlList = Helper.uebUrlList();
+ private final ConcurrentLinkedQueue<UebMsg> queue;
+ private final WaitingRequestersQueueList waitingRequestersList;
+ private final String consumerKey, consumerSecret, topicName, consumerGroupName;
+
+ /**
+ * Accepts coordinates needed to subscribe to a UEB topic, as well as the
+ * queues for passing along messages that arrive.
+ *
+ * @param consumerKey
+ * UEB key used to subscribe to the topic
+ * @param consumerSecret
+ * UEB secret used to subscribe to the topic
+ * @param topicName
+ * UEB topic name
+ * @param queue
+ * Queue to receive UEB messages. All inbound messages are
+ * enqueued here; ignored if null.
+ * @param waitingRequestersList
+ * Collection of queues to receive UEB messages that arrive in
+ * response to requests; i.e., emulating a synchronous request
+ * via pub/sub.
+ */
+ public Consumer(String consumerKey, String consumerSecret, String topicName, String consumerGroupName,
+ ConcurrentLinkedQueue<UebMsg> queue, WaitingRequestersQueueList waitingRequestersList) {
+ this.consumerKey = consumerKey;
+ this.consumerSecret = consumerSecret;
+ this.topicName = topicName;
+ this.consumerGroupName = consumerGroupName;
+ this.queue = queue;
+ this.waitingRequestersList = waitingRequestersList;
+ }
+
+ /**
+ * Subscribes to a topic using credentials as supplied to the constructor.
+ * Distributes messages appropriately as they arrive:
+ * <UL>
+ * <LI>If the queue is not null, adds the message to the queue.
+ * <LI>If the message's getMsgId() method returns non-null and the ID is
+ * found in the collection of waiting requesters, adds the message in that
+ * requester's queue.
+ * </UL>
+ *
+ * This is intended to be called in a long running thread as a listener for
+ * any published messages on a topic. Typical async pub/sub model. We use a
+ * filter of "0" to prevent collisions with P2P messages with unique filter
+ * ids.
+ */
+ protected void consume() throws IOException, UebException {
+ final String id = UUID.randomUUID().toString();
+
+ CambriaConsumer cc = null;
+ try {
+ cc = new CambriaClientBuilders.ConsumerBuilder()
+ .usingHosts(urlList)
+ .authenticatedBy(consumerKey, consumerSecret)
+ .onTopic (topicName)
+ .knownAs (consumerGroupName,id)
+ .waitAtServer (15*1000)
+ .receivingAtMost (1000)
+ .build();
+ } catch (GeneralSecurityException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ //CambriaClientFactory.createConsumer(urlList, topicName, consumerGroupName, id,
+ //15 * 1000, 1000, null, consumerKey, consumerSecret);
+
+ while (true) {
+ for (String msg : cc.fetch()) {
+ logger.debug(" <== consume from topicName " + topicName + " msg: " + msg);
+ UebMsg uebMsg = new ObjectMapper().readValue(msg, UebMsg.class);
+ if (queue != null) {
+ // Add to general queue allowing listeners to act on any
+ // incoming messages. We don't know if a listener is
+ // also going to be a responder to a synchronous
+ // request. So put all received messages on the general
+ // listener queue.
+ queue.add(uebMsg);
+ if (logger.isDebugEnabled())
+ logger.debug("Added msg to queue " + this.queue + " queue count = " + queue.size() + " msg :"
+ + uebMsg.getPayload());
+ }
+ if (waitingRequestersList != null && uebMsg.getMsgId() != null) {
+ // If a msgId is present, this could be a synchronous
+ // reply. Here we add it to the waiting requester's
+ // queue if we find a requester waiting for this msgId.
+ if (!(uebMsg.getMsgId()
+ .equals(PortalApiProperties.getProperty(PortalApiConstants.ECOMP_DEFAULT_MSG_ID)))) {
+ waitingRequestersList.addMsg(uebMsg.getMsgId(), uebMsg);
+ }
+ }
+ }
+ if (Thread.interrupted()) {
+ logger.warn(Thread.currentThread() + " interrupted, exiting");
+ break;
+ }
+ Helper.sleep(10);
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ @Override
+ public void run() {
+ try {
+ consume();
+ } catch (Exception ex) {
+ Thread t = Thread.currentThread();
+ t.getUncaughtExceptionHandler().uncaughtException(t, ex);
+ }
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/FunctionalMenu.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/FunctionalMenu.java
new file mode 100644
index 00000000..94ca4ee8
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/FunctionalMenu.java
@@ -0,0 +1,61 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.ueb;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Provides a convenience method for fetching the functional menu for a user
+ * from the ECOMP Portal via UEB.
+ */
+public class FunctionalMenu {
+
+ private static final Log logger = LogFactory.getLog(FunctionalMenu.class);
+
+ /**
+ * Makes a synchronous call to ECOMP Portal to get JSON with the functional
+ * menu, which arrives as the payload of the returned UEB message.
+ *
+ * @param userId
+ * User ID as known on the ECOMP Portal for customizing the
+ * functional menu appropriately
+ * @return JSON with functional menu
+ * @throws UebException
+ */
+ public static String get(String userId) throws UebException {
+ String returnString = null;
+ logger.info("Making use of UEB communication and Requesting functional menu for user " + userId);
+ UebMsg funcMenuUebMsg = null;
+ UebMsg msg = new UebMsg();
+ msg.putMsgType(UebMsgTypes.UEB_MSG_TYPE_GET_FUNC_MENU);
+ msg.putUserId(userId);
+ funcMenuUebMsg = UebManager.getInstance().requestReply(msg);
+ if (funcMenuUebMsg != null) {
+ if (funcMenuUebMsg.getPayload().startsWith("Error:")) {
+ logger.error("getFunctionalMenu received an error in UEB msg = " + funcMenuUebMsg.getPayload());
+ } else {
+ returnString = funcMenuUebMsg.getPayload();
+ }
+ }
+ return returnString;
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Helper.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Helper.java
new file mode 100644
index 00000000..ce942341
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Helper.java
@@ -0,0 +1,64 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.ueb;
+
+import java.util.LinkedList;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
+
+/**
+ * Provides utility methods.
+ */
+public class Helper {
+
+ private static final Log logger = LogFactory.getLog(Helper.class);
+
+ /**
+ * Parses a comma-separated list of UEB servers from properties file into a
+ * list.
+ *
+ * @return List of UEB server names
+ */
+ public static LinkedList<String> uebUrlList() {
+ LinkedList<String> urlList = null;
+ String url = PortalApiProperties.getProperty(PortalApiConstants.UEB_URL_LIST);
+ if (url == null) {
+ logger.error("uebUrlList: failed to get property " + PortalApiConstants.UEB_URL_LIST);
+ return null;
+ }
+ urlList = new LinkedList<String>();
+ for (String u : url.split(",")) {
+ urlList.add(u.trim());
+ }
+ return urlList;
+ }
+
+ public static void sleep(int milliseconds) {
+ try {
+ Thread.sleep(milliseconds);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Publisher.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Publisher.java
new file mode 100644
index 00000000..a7e914c2
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Publisher.java
@@ -0,0 +1,124 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.ueb;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.security.GeneralSecurityException;
+import java.util.LinkedList;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+
+import com.att.nsa.cambria.client.CambriaBatchingPublisher;
+import com.att.nsa.cambria.client.CambriaClientBuilders;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
+
+/**
+ * Provides a publisher that sends messages to a UEB topic.
+ *
+ */
+public class Publisher {
+
+ private final Log logger = LogFactory.getLog(getClass());
+
+ protected final LinkedList<String> urlList = Helper.uebUrlList();
+
+ private final String topicName;
+ private final String publisherKey;
+ private final String publisherSecret;
+
+ /**
+ * Accepts coordinates needed to publish to a UEB topic.
+ *
+ * @param publisherKey
+ * UEB key used to publish to the topic
+ * @param publisherSecret
+ * UEB secret used to publish to the topic
+ * @param topicName
+ * UEB topic name
+ */
+ public Publisher(String publisherKey, String publisherSecret, String topicName) {
+ this.publisherKey = publisherKey;
+ this.publisherSecret = publisherSecret;
+ this.topicName = topicName;
+ logger.info("Publisher instantiated for topic " + topicName);
+ }
+
+ /**
+ * Creates a publisher, subscribes to the topic, sends the specified message
+ * to the topic, then closes the publisher. This ensures that the single
+ * message goes immediately. UEB is designed for high throughput and tries
+ * to batch up multiple messages in each send, but this method wants the
+ * single message to go immediately.
+ *
+ * @param uebMsg
+ * Message object to send as the payload.
+ * @throws UebException
+ * If anything goes wrong, including JSON serialization of the
+ * specified message object.
+ */
+ public void send(UebMsg uebMsg) throws UebException {
+ String msg = null;
+
+ CambriaBatchingPublisher pub = null;
+ try {
+ pub = new CambriaClientBuilders.PublisherBuilder()
+ .authenticatedBy(publisherKey, publisherSecret).usingHosts(urlList).onTopic(topicName).build();
+ } catch (MalformedURLException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (GeneralSecurityException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
+ try {
+ ObjectWriter mapper = new ObjectMapper().writer().withDefaultPrettyPrinter();
+ msg = mapper.writeValueAsString(uebMsg);
+ } catch (JsonProcessingException e) {
+ throw new UebException(PortalApiConstants.ECOMP_UEB_INVALID_MSG, topicName, null, null);
+ }
+
+ try {
+ logger.debug("Publishing to " + topicName + " msg: " + msg);
+ int NumSent = pub.send(PortalApiConstants.ECOMP_GENERAL_UEB_PARTITION, msg);
+ if (NumSent == 0) {
+ throw new UebException(PortalApiConstants.ECOMP_UEB_UNKNOWN_PUBLISH_ERROR, topicName, null, msg);
+ }
+ } catch (IOException ex) {
+ logger.error("Failed to publish", ex);
+ throw new UebException(PortalApiConstants.ECOMP_UEB_UNKNOWN_PUBLISH_ERROR, ex, topicName, null, msg);
+ }
+
+ try {
+ // close the publisher to make sure everything's sent before exiting
+ pub.close(5, TimeUnit.SECONDS);
+ } catch (Exception ex) {
+ logger.error("pub.close Exception ", ex);
+ throw new UebException(PortalApiConstants.ECOMP_UEB_UNKNOWN_PUBLISH_ERROR, ex, topicName, null, msg);
+ }
+
+ }
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/PublisherList.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/PublisherList.java
new file mode 100644
index 00000000..a3a00782
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/PublisherList.java
@@ -0,0 +1,77 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.ueb;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A thin wrapper around ConcurrentHashMap that stores a queue for each
+ * Requester that is waiting for a Reply. When a reply is received that has a
+ * matching msgId, that requesters queue is populated with the reply message.
+ *
+ * Primarily for Portal core to track the remote applications that have placed
+ * requests; never used by those applications.
+ */
+public class PublisherList {
+
+ private final Log logger = LogFactory.getLog(getClass());
+
+ private final Map<String, Publisher> map;
+
+ public PublisherList() {
+ map = new ConcurrentHashMap<>();
+ }
+
+ public void addPublisherToMap(String topicName, Publisher publisher) {
+ if (this.map.containsKey(topicName)) {
+ logger.error("Publisher already exists for " + topicName);
+ } else {
+ this.map.put(topicName, publisher);
+ }
+ }
+
+ public Publisher getPublisher(String topicName) {
+ return this.map.get(topicName);
+ }
+
+ public void removePublisherFromMap(String topicName) {
+ this.map.remove(topicName);
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Map contains " + this.map.size() + " Publishers.");
+ for (Map.Entry<String, Publisher> entry : this.map.entrySet()) {
+ String key = entry.getKey().toString();
+ Publisher pub = entry.getValue();
+ sb.append("Entry msgId, " + key + " publisher" + pub);
+ }
+ return sb.toString();
+ }
+
+ public int size() {
+ return this.map.size();
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/TopicManager.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/TopicManager.java
new file mode 100644
index 00000000..b9d730eb
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/TopicManager.java
@@ -0,0 +1,121 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.ueb;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.util.LinkedList;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.att.nsa.apiClient.http.HttpException;
+import com.att.nsa.cambria.client.CambriaClient.CambriaApiException;
+import com.att.nsa.cambria.client.CambriaClientBuilders;
+import com.att.nsa.cambria.client.CambriaClientFactory;
+import com.att.nsa.cambria.client.CambriaTopicManager;
+
+/**
+ * Provides methods to facilitate creating topics, and adding publishers and
+ * subscribers to existing topics.
+ *
+ */
+public class TopicManager {
+
+ private final Log logger = LogFactory.getLog(getClass());
+
+ /**
+ * Creates a topic with the specified information.
+ *
+ * @param key
+ * Topic key
+ * @param secret
+ * Topic secret key
+ * @param topicName
+ * Topic name
+ * @param topicDescription
+ * Topic description
+ * @throws HttpException
+ * @throws CambriaApiException
+ * @throws IOException
+ */
+ public void createTopic(String key, String secret, String topicName, String topicDescription)
+ throws HttpException, CambriaApiException, IOException {
+ final LinkedList<String> urlList = Helper.uebUrlList();
+ if (logger.isInfoEnabled()) {
+ logger.info("==> createTopic");
+ logger.info("topicName: " + topicName);
+ logger.info("topicDescription: " + topicDescription);
+ }
+ final CambriaTopicManager tm = null; //to do for open source
+ //CambriaClientFactory.createTopicManager(urlList, key, secret);
+ tm.createTopic(topicName, topicDescription, 1, 1);
+ }
+
+ /**
+ * Modifies the specified topic to accept a subscriber using the specified
+ * key.
+ *
+ * @param topicOwnerKey
+ * @param topicOwnerSecret
+ * @param subscriberKey
+ * @param topicName
+ * @throws HttpException
+ * @throws CambriaApiException
+ * @throws IOException
+ */
+ public void addSubscriber(String topicOwnerKey, String topicOwnerSecret, String subscriberKey, String topicName)
+ throws HttpException, CambriaApiException, IOException {
+ logger.info("==> addSubscriber to topic " + topicName);
+ final LinkedList<String> urlList = Helper.uebUrlList();
+ CambriaTopicManager tm = null;
+ try {
+ tm = new CambriaClientBuilders.TopicManagerBuilder().usingHosts(urlList).authenticatedBy(topicOwnerKey, topicOwnerSecret).build();
+ } catch (GeneralSecurityException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ //old version num : CambriaClientFactory.createTopicManager(urlList, topicOwnerKey,topicOwnerSecret);
+ tm.allowConsumer(topicName, subscriberKey);
+ }
+
+ /**
+ * Modifies the specified topic to accept a publisher using the specified
+ * key.
+ *
+ * @param topicOwnerKey
+ * @param topicOwnerSecret
+ * @param publisherKey
+ * @param topicName
+ * @throws HttpException
+ * @throws CambriaApiException
+ * @throws IOException
+ */
+
+ public void addPublisher(String topicOwnerKey, String topicOwnerSecret, String publisherKey, String topicName)
+ throws HttpException, CambriaApiException, IOException {
+ logger.info("==> addPublisher to topic " + topicName);
+ final LinkedList<String> urlList = Helper.uebUrlList();
+ final CambriaTopicManager tm = null;
+ //CambriaClientFactory.createTopicManager(urlList, topicOwnerKey,
+ //topicOwnerSecret);
+ tm.allowProducer(topicName, publisherKey);
+ }
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebException.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebException.java
new file mode 100644
index 00000000..62a80dd4
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebException.java
@@ -0,0 +1,65 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.ueb;
+
+/**
+ * Stores UEB-specific information including topic, message ID and message body.
+ */
+public class UebException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+ private String topicName = null;
+ private String msgId = null;
+ private String msg = null;
+
+ public UebException(String errorMsg, String topicName, String msgId, String msg) {
+ super(errorMsg);
+ this.topicName = topicName;
+ this.msgId = msgId;
+ this.msg = msg;
+ }
+
+ public UebException(String errorMsg, Throwable ex, String topicName, String msgId, String msg) {
+ super(errorMsg, ex);
+ this.topicName = topicName;
+ this.msgId = msgId;
+ this.msg = msg;
+ }
+
+ public UebException(String msg, Throwable ex) {
+ super(msg, ex);
+ }
+
+ public UebException(Throwable ex) {
+ super(ex);
+ }
+
+ public String getUebMsg() {
+ return this.msg;
+ }
+
+ public String getTopicName() {
+ return this.topicName;
+ }
+
+ public String getMsgId() {
+ return this.msgId;
+ }
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebManager.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebManager.java
new file mode 100644
index 00000000..b38bcb79
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebManager.java
@@ -0,0 +1,358 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.ueb;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
+
+/**
+ * Manages UEB interactions and provides methods for publishing requests,
+ * replies and others.
+ */
+public class UebManager {
+
+ private final Log logger = LogFactory.getLog(getClass());
+
+ private WaitingRequestersQueueList waitingRequestersQueueList;
+ private PublisherList publisherList = new PublisherList();
+ private static UebManager uebManager = null;
+
+ private final String inTopicName;
+ private final String consumerGroupName;
+ private final String outTopicName;
+ private final String appUebKey;
+ private final String appUebSecret;
+
+ private Publisher appPublisher;
+ private Thread listenerThread;
+ private boolean bThisIsEcompPortalServer = false;
+
+ /**
+ * Constructor initializes fields and validates values obtained from
+ * properties.
+ *
+ * The picture below is a simplified view of the relationships among ECOMP
+ * Portal and applications communicating via UEB:
+ *
+ * <PRE>
+ * ECOMP out to many.
+ * App out to only ECOMP.
+ *
+ * |----------------|<---------------------------------------------
+ * | | | | |
+ * | |---------------------------> App 1 ------ | |
+ * | ECOMP Portal |---------------------------> App 2 --------- |
+ * | | ... |
+ * | |---------------------------> App n -----------
+ * |----------------|
+ * </PRE>
+ *
+ * @throws IOException
+ */
+ protected UebManager() throws UebException {
+ waitingRequestersQueueList = null;
+ listenerThread = null;
+ outTopicName = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME);
+ inTopicName = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_INBOUND_MAILBOX_NAME);
+ appUebKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY);
+ appUebSecret = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET);
+ String consGrp = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_CONSUMER_GROUP_NAME);
+
+ if (outTopicName == null || outTopicName.length() == 0)
+ throw new UebException("Failed to get property " + PortalApiConstants.ECOMP_PORTAL_INBOX_NAME, null, null,
+ null);
+ if (inTopicName == null || inTopicName.length() == 0)
+ throw new UebException("Failed to get property " + PortalApiConstants.UEB_APP_INBOUND_MAILBOX_NAME, null,
+ null, null);
+ if (consGrp == null || consGrp.length() == 0)
+ throw new UebException("Failed to get property " + PortalApiConstants.UEB_APP_CONSUMER_GROUP_NAME, null,
+ null, null);
+ if (appUebKey == null || appUebKey.length() == 0)
+ throw new UebException("Failed to get property " + PortalApiConstants.UEB_APP_KEY, null, null, null);
+ if (appUebSecret == null || appUebSecret.length() == 0)
+ throw new UebException("Failed to get property " + PortalApiConstants.UEB_APP_SECRET, null, null, null);
+ List<String> uebUrlList = Helper.uebUrlList();
+ if (uebUrlList == null || uebUrlList.size() == 0)
+ throw new UebException("Failed to get property" + PortalApiConstants.UEB_URL_LIST, null, null, null);
+ // A bit of magic: if consumer group is a magic token, generate one.
+ consumerGroupName = (PortalApiConstants.UEB_APP_CONSUMER_GROUP_NAME_GENERATOR.equals(consGrp)
+ ? UUID.randomUUID().toString() : consGrp);
+ }
+
+ /**
+ * Gets the static instance, creating it if necessary.
+ *
+ * @return Instance of UebManager
+ * @throws IOException
+ */
+ public static synchronized UebManager getInstance() throws UebException {
+ if (uebManager == null) {
+ uebManager = new UebManager();
+ }
+ return uebManager;
+ }
+
+ /**
+ * Answers whether the getInstance() method has previously been called.
+ *
+ * @return True if a static instance is available, else false.
+ */
+ public static boolean isInstanceAvailable() {
+ return uebManager != null;
+ }
+
+ /**
+ * Creates a list of waiting requesters, creates and a consumer using cached
+ * information, and starts a new thread to run the consumer that listens for
+ * messages published to the inbound topic configured in the constructor.
+ *
+ * @param inboxQueue
+ * Queue supplied to the consumer. If not null, the consumer will
+ * enqueue every message it receives.
+ */
+ public void initListener(ConcurrentLinkedQueue<UebMsg> inboxQueue) throws UebException {
+ waitingRequestersQueueList = new WaitingRequestersQueueList();
+ Consumer runnable = new Consumer(appUebKey, appUebSecret, inTopicName, consumerGroupName, inboxQueue,
+ waitingRequestersQueueList);
+ this.listenerThread = new Thread(runnable, "UEBConsumerThread");
+ this.listenerThread.start();
+ Helper.sleep(400); // UEB functions more reliably when we give this some
+ // time
+
+ logger.info("UEBManager instance starting... " + inTopicName + " listener thread "
+ + this.listenerThread.getName() + " state = " + this.listenerThread.getState());
+
+ /*
+ * ECOMP Portal manages a dynamic list of outbound topics and so the
+ * outTopicName is initialized in this logic with the same value as the
+ * inbound topic. The real outbound topics name will be added to the
+ * publisher list for ECOMP Portal. For an SDK/App instance only one
+ * publisher is needed, appPublisher.
+ */
+ if (inTopicName.equalsIgnoreCase(outTopicName)) {
+ this.bThisIsEcompPortalServer = true;
+ } else {
+ appPublisher = new Publisher(appUebKey, appUebSecret, outTopicName);
+ Helper.sleep(400);
+ }
+ }
+
+ /**
+ * Creates and adds a publisher to the list for the specified topic. This
+ * should only be called by the ECOMP Portal App, other Apps have just one
+ * publisher and use appPublisher
+ *
+ * @param topicName
+ */
+ public void addPublisher(String topicName) {
+ logger.info("UEBManager adding publisher for " + topicName);
+ Publisher outBoxToAppPublisher = new Publisher(appUebKey, appUebSecret, topicName);
+ publisherList.addPublisherToMap(topicName, outBoxToAppPublisher);
+ }
+
+ /**
+ * Removes a publisher from the list for the specified topic.
+ *
+ * This should only be called by the ECOMP Portal App, other Apps have just
+ * one publisher and use appPublisher
+ *
+ * @param topicName
+ */
+ public void removePublisher(String topicName) {
+ logger.info("UEBManager removing publisher for " + topicName);
+ publisherList.removePublisherFromMap(topicName);
+ }
+
+ /**
+ * Adds the default ECOMP message ID to the message and sends the message to
+ * the topic.
+ *
+ * @param msg
+ * @throws UebException
+ */
+ public void publish(UebMsg msg) throws UebException {
+ msg.putMsgId(PortalApiConstants.ECOMP_DEFAULT_MSG_ID);
+ appPublisher.send(msg);
+ }
+
+ /**
+ * Sends the message using the default publisher.
+ *
+ * @param msg
+ * @throws UebException
+ */
+ public void publishReply(UebMsg msg) throws UebException {
+ // Caller populates msgId with the echoed value from the request
+ appPublisher.send(msg);
+ }
+
+ /**
+ * Sends the message using the appropriate publisher for the specified
+ * topic.
+ *
+ * @param msg
+ * @param topicName
+ * @throws UebException
+ */
+ public void publishEP(UebMsg msg, String topicName) throws UebException {
+ Publisher publisher = publisherList.getPublisher(topicName);
+ if (publisher != null) {
+ msg.putMsgId(PortalApiConstants.ECOMP_DEFAULT_MSG_ID);
+ publisher.send(msg);
+ }
+ }
+
+ /**
+ * Publishes a reply using the appropriate publisher for the specified
+ * topic.
+ *
+ * @param msg
+ * @param topicName
+ * @throws UebException
+ */
+ public void publishReplyEP(UebMsg msg, String topicName) throws UebException {
+ // Caller populates msgId with the echoed value from the request
+ Publisher publisher = publisherList.getPublisher(topicName);
+ if (publisher != null) {
+ publisher.send(msg);
+ }
+ }
+
+ /**
+ * Sends the specified message using the specified publisher, and waits for
+ * a reply. Retransmits if no reply is received in 5 seconds; gives up after
+ * 3 retries.
+ *
+ * @param msg
+ * @param publisher
+ * @return Message from a remote publisher, or null if timeout happens.
+ * @throws UebException
+ */
+ public UebMsg requestReplyUsingPublisher(UebMsg msg, Publisher publisher) throws UebException {
+ UebMsg reply = null;
+ if (waitingRequestersQueueList == null) {
+ logger.error("requestReplyUsingPublisher called but listener thread not initialized");
+ } else {
+ // Storing a non-default message ID identifies this as a synchronous
+ // request
+ msg.putMsgId(UUID.randomUUID().toString());
+
+ /*
+ * Create a queue for this request, the consumer thread will insert
+ * the reply on this queue
+ */
+ LinkedBlockingQueue<UebMsg> replyQueue = new LinkedBlockingQueue<UebMsg>();
+ waitingRequestersQueueList.addQueueToMap(msg.getMsgId(), replyQueue);
+
+ /*
+ * Send the request
+ */
+ publisher.send(msg);
+
+ /*
+ * Wait for reply up to 3 * 5 = 15 seconds
+ */
+ int reTransmits = 0;
+ int maxRetransmits = 3;
+ int retransmitTimeMs = 5000;
+ long sendTimeStamp = System.currentTimeMillis();
+ while (reTransmits < maxRetransmits) {
+ if ((reply = replyQueue.poll()) != null)
+ break;
+
+ long now = System.currentTimeMillis();
+ if (now - sendTimeStamp > retransmitTimeMs) {
+ logger.debug("Retransmitting send... msg = " + msg.getPayload() + msg.getMsgId());
+ publisher.send(msg);
+ sendTimeStamp = System.currentTimeMillis();
+ reTransmits++;
+ }
+ }
+ waitingRequestersQueueList.removeQueueFromMap(msg.getMsgId());
+ if (reTransmits == maxRetransmits)
+ throw new UebException(PortalApiConstants.ECOMP_UEB_TIMEOUT_ERROR, inTopicName, null, msg.toString());
+
+ }
+ return reply;
+ }
+
+ /**
+ * Sends the specified message using the default publisher and waits for a
+ * reply.
+ *
+ * @param msg
+ * @return Message from a remote publisher, or null if timeout happens.
+ * @throws UebException
+ */
+ public UebMsg requestReply(UebMsg msg) throws UebException {
+ return requestReplyUsingPublisher(msg, appPublisher);
+ }
+
+ /**
+ * Sends the specified message using the publisher appropriate for the
+ * specified topic name, and waits for a reply.
+ *
+ * @param msg
+ * @param topicName
+ * @return Message from a remote publisher, or null if timeout happens.
+ * @throws UebException
+ */
+ public UebMsg requestReplyEP(UebMsg msg, String topicName) throws UebException {
+ UebMsg returnMsg = null;
+ Publisher publisher = publisherList.getPublisher(topicName);
+ if (publisher != null) {
+ returnMsg = requestReplyUsingPublisher(msg, publisher);
+ }
+ return returnMsg;
+ }
+
+ /**
+ * Publishes the payload as a UEB widget-notification message on the default
+ * publisher. Intended for use by Apps inter widget communication, not EP
+ * itself.
+ *
+ * @param payload
+ * @param userId
+ */
+ public void postWidgetNotification(String payload, String userId) throws UebException {
+ UebMsg msg = new UebMsg();
+ msg.putPayload(payload);
+ msg.putUserId(userId);
+ msg.putMsgType(UebMsgTypes.UEB_MSG_TYPE_WIDGET_NOTIFICATION);
+ this.publish(msg);
+ }
+
+ /**
+ * Interrupts the long-running thread that runs the consumer.
+ */
+ public void shutdown() {
+ if (this.listenerThread != null) {
+ this.listenerThread.interrupt();
+ }
+ }
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebMsg.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebMsg.java
new file mode 100644
index 00000000..ff30840c
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebMsg.java
@@ -0,0 +1,119 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.ueb;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class UebMsg {
+
+ private final Log logger = LogFactory.getLog(getClass());
+
+ private String version;
+ private String msgId;
+ private long timeStamp;
+ private String payload;
+ private String msgType;
+ private String userId;
+ private String sourceTopicName;
+ private String sourceIP;
+ private String sourceHostName;
+
+ /**
+ * Creates a new object and populates the fields source IP, source topic,
+ * time stamp, version, and message id.
+ */
+ public UebMsg() {
+ InetAddress ip;
+ try {
+ ip = InetAddress.getLocalHost();
+ // Do not attempt to get name, why wait on DNS every time?
+ // sourceHostName = ip.getHostName();
+ sourceIP = ip.getHostAddress();
+ } catch (UnknownHostException e) {
+ sourceHostName = "unknown";
+ sourceIP = "unknown";
+ }
+
+ this.timeStamp = System.currentTimeMillis();
+ this.version = "1.0";
+ this.msgId = PortalApiConstants.ECOMP_DEFAULT_MSG_ID;
+ this.payload = "empty payload content";
+ this.sourceTopicName = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_INBOUND_MAILBOX_NAME);
+ if (this.sourceTopicName == null)
+ logger.error("Failed to get property " + PortalApiConstants.UEB_APP_INBOUND_MAILBOX_NAME);
+ }
+
+ public void putMsgId(String msgId) {
+ this.msgId = msgId;
+ }
+
+ public String getMsgId() {
+ return msgId;
+ }
+
+ public void putPayload(String payload) {
+ this.payload = payload;
+ }
+
+ public String getPayload() {
+ return payload;
+ }
+
+ public void putMsgType(String msgType) {
+ this.msgType = msgType;
+ }
+
+ public String getMsgType() {
+ return this.msgType;
+ }
+
+ public void putUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getUserId() {
+ return this.userId;
+ }
+
+ public void putSourceTopicName(String topic) {
+ this.sourceTopicName = topic;
+ }
+
+ public String getSourceTopicName() {
+ return this.sourceTopicName;
+ }
+
+ @Override
+ public String toString() {
+ return "UebMsg [version=" + version + ", msgId=" + msgId + ", timeStamp=" + timeStamp + ", msgType=" + msgType
+ + ", userId=" + userId + ", sourceTopicName=" + sourceTopicName + ", sourceIP=" + sourceIP
+ + ", sourceHostName=" + sourceHostName + "]" + System.lineSeparator() + "payload=" + payload;
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebMsgTypes.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebMsgTypes.java
new file mode 100644
index 00000000..9e51fe5c
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebMsgTypes.java
@@ -0,0 +1,28 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.ueb;
+
+/**
+ * Publishes constants used in the UEB package.
+ */
+public interface UebMsgTypes {
+ public static final String UEB_MSG_TYPE_GET_FUNC_MENU = "uebMsgTypeGetFuncMenu";
+ public static final String UEB_MSG_TYPE_WIDGET_NOTIFICATION = "uebMsgTypeWidgetNotification";
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/WaitingRequestersQueueList.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/WaitingRequestersQueueList.java
new file mode 100644
index 00000000..d4063606
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/WaitingRequestersQueueList.java
@@ -0,0 +1,73 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.onboarding.ueb;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A thin wrapper around ConcurrentHashMap that stores a queue for each
+ * Requester that is waiting for a Reply. When a reply is received that has a
+ * matching msgId, that requesters queue is populated with the reply message.
+ *
+ * Primarily for the UebManager to track requests while it waits for responses.
+ */
+public class WaitingRequestersQueueList {
+ private final Log logger = LogFactory.getLog(getClass());
+
+ private final Map<String, LinkedBlockingQueue<UebMsg>> map;
+
+ public WaitingRequestersQueueList() {
+ map = new ConcurrentHashMap<>();
+ }
+
+ public void addQueueToMap(String msgId, LinkedBlockingQueue<UebMsg> queue) {
+ this.map.put(msgId, queue);
+ }
+
+ public void addMsg(String msgId, UebMsg message) {
+ LinkedBlockingQueue<UebMsg> queue = this.map.get(msgId);
+ if (queue != null) {
+ queue.add(message);
+ } else {
+ logger.warn("Did not find entry in WaitingRequestersQueueList for msgId " + msgId);
+ }
+ }
+
+ public void removeQueueFromMap(String msgId) {
+ this.map.remove(msgId);
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Map contains " + this.map.size() + " Publishers.");
+ for (Map.Entry<String, LinkedBlockingQueue<UebMsg>> entry : this.map.entrySet()) {
+ String key = entry.getKey().toString();
+ LinkedBlockingQueue<UebMsg> queue = entry.getValue();
+ sb.append("Entry msgId, " + key + " queue " + queue);
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/EcompRole.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/EcompRole.java
new file mode 100644
index 00000000..a65d16f5
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/EcompRole.java
@@ -0,0 +1,87 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.restful.domain;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * This bean holds the information for a role in the role and user management
+ * REST API.
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class EcompRole implements Comparable<EcompRole>{
+
+ protected Long id;
+ private String name;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ EcompRole other = (EcompRole) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ String s = "@EcompRole[id: " + id + "; name: " + name + "]";
+ return s;
+ }
+
+ @Override
+ public int compareTo(EcompRole o) {
+ return this.id.compareTo(o.id);
+ }
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/EcompUser.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/EcompUser.java
new file mode 100644
index 00000000..732878e1
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/EcompUser.java
@@ -0,0 +1,197 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.restful.domain;
+
+import java.util.Set;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * This bean holds the information for a user in the role and user management
+ * REST API.
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class EcompUser implements Comparable<EcompUser>{
+
+ private Long orgId;
+ private String managerId;
+ private String firstName;
+ private String middleInitial;
+ private String lastName;
+ private String phone;
+ private String email;
+ private String hrid;
+ private String orgUserId;
+ private String orgCode;
+ private String orgManagerUserId;
+ private String jobTitle;
+ private String loginId;
+ private boolean active;
+
+
+ private Set<EcompRole> roles;
+
+ public Long getOrgId() {
+ return orgId;
+ }
+
+ public void setOrgId(Long orgId) {
+ this.orgId = orgId;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getMiddleInitial() {
+ return middleInitial;
+ }
+
+ public void setMiddleInitial(String middleInitial) {
+ this.middleInitial = middleInitial;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getHrid() {
+ return hrid;
+ }
+
+ public void setHrid(String hrid) {
+ this.hrid = hrid;
+ }
+
+ public String getOrgUserId() {
+ return orgUserId;
+ }
+
+ public void setOrgUserId(String orgUserId) {
+ this.orgUserId = orgUserId;
+ }
+
+ public String getOrgCode() {
+ return orgCode;
+ }
+
+ public void setOrgCode(String orgCode) {
+ this.orgCode = orgCode;
+ }
+
+ public String getOrgManagerUserId() {
+ return orgManagerUserId;
+ }
+
+ public void setOrgManagerUserId(String orgManagerUserId) {
+ this.orgManagerUserId = orgManagerUserId;
+ }
+
+ public String getJobTitle() {
+ return jobTitle;
+ }
+
+ public void setJobTitle(String jobTitle) {
+ this.jobTitle = jobTitle;
+ }
+
+ public String getLoginId() {
+ return loginId;
+ }
+
+ public void setLoginId(String loginId) {
+ this.loginId = loginId;
+ }
+
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+ public Set<EcompRole> getRoles() {
+ return roles;
+ }
+
+ public void setRoles(Set<EcompRole> roles) {
+ this.roles = roles;
+ }
+
+ public String getManagerId() {
+ return managerId;
+ }
+
+ public void setManagerId(String managerId) {
+ this.managerId = managerId;
+ }
+
+ @Override
+ public String toString() {
+ String s = "@EcompUser[orgId: " + orgId //
+ + ", firstName: " + firstName //
+ + ", mi: " + middleInitial //
+ + ", lastName: " + lastName //
+ + ", phone: " + phone //
+ + ", email: " + email //
+ + ", hrid: " + hrid //
+ + ", orgUserId: " + orgUserId //
+ + ", orgCode: " + orgCode //
+ + ", orgManagerUserId: " + orgManagerUserId //
+ + ", jobTitle: " + jobTitle //
+ + ", loginId: " + loginId //
+ + ", active:" + active //
+ + "]";
+ return s;
+ }
+
+ @Override
+ public int compareTo(EcompUser o) {
+ return this.loginId.compareTo(o.loginId);
+ }
+
+
+}
diff --git a/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/SharedContext.java b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/SharedContext.java
new file mode 100644
index 00000000..4eeb12f4
--- /dev/null
+++ b/ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/SharedContext.java
@@ -0,0 +1,300 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.core.restful.domain;
+
+/**
+ * Bean that represents shared-context data transferred in JSON objects. This is
+ * a minimum example:
+ *
+ * <PRE>
+ * {
+ * "context_id": "abc123",
+ * "ckey": "myKey",
+ * "cvalue": "my context value to share"
+ * }
+ * </PRE>
+ */
+public class SharedContext {
+
+ // Response field indicates nothing else is present
+ private String response;
+ // Required fields when data is present
+ private String context_id, ckey, cvalue;
+ private Long id, create_time;
+ // Additional database fields from the DomainVO object.
+ private String created, modified, createdId, modifiedId, auditUserId, auditTrail, rowNum;
+
+ /**
+ * Gets the response field.
+ *
+ * @return response
+ */
+ public String getResponse() {
+ return response;
+ }
+
+ /**
+ * Sets the response field.
+ *
+ * @param response
+ * The response to set
+ */
+ public void setResponse(final String response) {
+ this.response = response;
+ }
+
+ /**
+ * Gets the database row ID.
+ *
+ * @return Database row ID
+ */
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * Sets the database row ID.
+ *
+ * @param id
+ */
+ public void setId(final Long id) {
+ this.id = id;
+ }
+
+ /**
+ * Gets the creation time
+ *
+ * @return Creation time as a Long
+ */
+ public Long getCreate_time() {
+ return create_time;
+ }
+
+ /**
+ * Sets the creation time
+ *
+ * @param create_time
+ */
+ public void setCreate_time(final Long create_time) {
+ this.create_time = create_time;
+ }
+
+ /**
+ * Gets the context ID
+ *
+ * @return Context ID
+ */
+ public String getContext_id() {
+ return context_id;
+ }
+
+ /**
+ * Sets the context ID
+ *
+ * @param context_id
+ */
+ public void setContext_id(final String context_id) {
+ this.context_id = context_id;
+ }
+
+ /**
+ * Gets the key of the key-value pair. Called ckey because "key" is a
+ * reserved word in Mysql.
+ *
+ * @return The key
+ */
+ public String getCkey() {
+ return ckey;
+ }
+
+ /**
+ * Sets the key of the key-value pair.
+ *
+ * @param ckey
+ */
+ public void setCkey(final String ckey) {
+ this.ckey = ckey;
+ }
+
+ /**
+ * Gets the value of the key-value pair. Called cvalue because "value" is a
+ * reserved word in Mysql.
+ *
+ * @return Value of the key-value pair.
+ */
+ public String getCvalue() {
+ return cvalue;
+ }
+
+ /**
+ * Sets the value of the key-value pair.
+ *
+ * @param cvalue
+ */
+ public void setCvalue(final String cvalue) {
+ this.cvalue = cvalue;
+ }
+
+ /**
+ * Gets the created value.
+ *
+ * @return Created info from database
+ */
+ public String getCreated() {
+ return created;
+ }
+
+ /**
+ * Sets the created value.
+ *
+ * @param created
+ */
+ public void setCreated(String created) {
+ this.created = created;
+ }
+
+ /**
+ * Gets the modified value.
+ *
+ * @return Modified info from database
+ */
+ public String getModified() {
+ return modified;
+ }
+
+ /**
+ * Sets the modified value.
+ *
+ * @param modified
+ */
+ public void setModified(String modified) {
+ this.modified = modified;
+ }
+
+ /**
+ * Gets the createdId value.
+ *
+ * @return CreatedId info from database
+ */
+ public String getCreatedId() {
+ return createdId;
+ }
+
+ /**
+ * Sets the createdId value.
+ *
+ * @param createdId
+ */
+ public void setCreatedId(String createdId) {
+ this.createdId = createdId;
+ }
+
+ /**
+ * Gets the modifiedId value.
+ *
+ * @return ModifiedId info from database
+ */
+ public String getModifiedId() {
+ return modifiedId;
+ }
+
+ /**
+ * Sets the modifiedId value.
+ *
+ * @param modifiedId
+ */
+ public void setModifiedId(String modifiedId) {
+ this.modifiedId = modifiedId;
+ }
+
+ /**
+ * Gets the audit user ID value.
+ *
+ * @return AuditUserId from database
+ */
+ public String getAuditUserId() {
+ return auditUserId;
+ }
+
+ /**
+ * Sets the audit user ID value.
+ *
+ * @param auditUserId
+ */
+ public void setAuditUserId(String auditUserId) {
+ this.auditUserId = auditUserId;
+ }
+
+ /**
+ * Gets the audit trail value.
+ *
+ * @return AuditTrail from database.
+ */
+ public String getAuditTrail() {
+ return auditTrail;
+ }
+
+ /**
+ * Sets the audit trail value.
+ *
+ * @param auditTrail
+ */
+ public void setAuditTrail(String auditTrail) {
+ this.auditTrail = auditTrail;
+ }
+
+ /**
+ * Gets the row num value.
+ *
+ * @return rowNum from database.
+ */
+ public String getRowNum() {
+ return rowNum;
+ }
+
+ /**
+ * Sets the row num value.
+ *
+ * @param rowNum
+ */
+ public void setRowNum(String rowNum) {
+ this.rowNum = rowNum;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ SharedContext other = (SharedContext) obj;
+ return this.id == other.id && this.context_id.equals(other.context_id) && this.ckey.equals(other.ckey)
+ && this.cvalue.equals(other.cvalue);
+ }
+
+ @Override
+ public int hashCode() {
+ return (int) (id + context_id.hashCode() + ckey.hashCode() + cvalue.hashCode());
+ }
+
+ @Override
+ public String toString() {
+ String s = "@SharedContext[id: " + id + "; context_id: " + context_id + "; ckey: " + ckey + "; cvalue: "
+ + cvalue + "]";
+ return s;
+ }
+
+}